/*!--------------------------------------------------------
 * 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 */

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;
    return g = { next: verb(0), "throw": verb(1), "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 = {}, 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;
};

export function __importStar(mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __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;
    }
    function next() {
        while (env.stack.length) {
            var rec = env.stack.pop();
            try {
                var result = rec.dispose && rec.dispose.call(rec.value);
                if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
            }
            catch (e) {
                fail(e);
            }
        }
        if (env.hasError) throw env.error;
    }
    return next();
}

export default {
    __extends: __extends,
    __assign: __assign,
    __rest: __rest,
    __decorate: __decorate,
    __param: __param,
    __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,
};

var w1o=Object.defineProperty;var C1o=Object.getOwnPropertyDescriptor;var A4i=a=>{throw TypeError(a)};var I=(a,i,e,t)=>{for(var o=t>1?void 0:t?C1o(i,e):i,n=a.length-1,r;n>=0;n--)(r=a[n])&&(o=(t?r(i,e,o):r(o))||o);return t&&o&&w1o(i,e,o),o},m=(a,i)=>(e,t)=>i(e,t,a);var tii=(a,i,e)=>i.has(a)||A4i("Cannot "+e);var cv=(a,i,e)=>(tii(a,i,"read from private field"),e?e.call(a):i.get(a)),Aye=(a,i,e)=>i.has(a)?A4i("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(a):i.set(a,e),z5e=(a,i,e,t)=>(tii(a,i,"write to private field"),t?t.call(a,e):i.set(a,e),e),K5e=(a,i,e)=>(tii(a,i,"access private method"),e);function G5e(){return globalThis._VSCODE_NLS_MESSAGES}function ble(){return globalThis._VSCODE_NLS_LANGUAGE}var x1o=ble()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function cvt(a,i){let e;return i.length===0?e=a:e=a.replace(/\{(\d+)\}/g,(t,o)=>{let n=o[0],r=i[n],s=t;return typeof r=="string"?s=r:(typeof r=="number"||typeof r=="boolean"||r===void 0||r===null)&&(s=String(r)),s}),x1o&&(e="\uFF3B"+e.replace(/[aouei]/g,"$&$&")+"\uFF3D"),e}function d(a,i,...e){return cvt(typeof a=="number"?N4i(a,i):i,e)}function N4i(a,i){let e=G5e()?.[a];if(typeof e!="string"){if(typeof i=="string")return i;throw new Error(`!!! NLS MISSING: ${a} !!!`)}return e}function P(a,i,...e){let t;typeof a=="number"?t=N4i(a,i):t=i;let o=cvt(t,e);return{value:o,original:i===t?o:cvt(i,e)}}function dvt(a,i){let e=a;typeof e.vscodeWindowId!="number"&&Object.defineProperty(e,"vscodeWindowId",{get:()=>i})}var ut=window;function fI(a){return a===ut?!1:typeof a?.vscodeWindowId=="number"}function yy(a,i){let e=Object.create(null);for(let t of a){let o=i(t),n=e[o];n||(n=e[o]=[]),n.push(t)}return e}function W4i(a,i){let e=new Map;for(let t of a){let o=i(t),n=e.get(o);n||(n=[],e.set(o,n)),n.push(t)}return e}function cz(a,i){let e=[],t=[];for(let o of a)i.has(o)||e.push(o);for(let o of i)a.has(o)||t.push(o);return{removed:e,added:t}}function q5e(a,i){let e=[],t=[];for(let[o,n]of a)i.has(o)||e.push(n);for(let[o,n]of i)a.has(o)||t.push(n);return{removed:e,added:t}}function uvt(a,i){let e=new Set;for(let t of i)a.has(t)&&e.add(t);return e}var O4i,F4i,Sle=class{constructor(i,e){this.toKey=e;this._map=new Map;this[O4i]="SetWithKey";for(let t of i)this.add(t)}get size(){return this._map.size}add(i){let e=this.toKey(i);return this._map.set(e,i),this}delete(i){return this._map.delete(this.toKey(i))}has(i){return this._map.has(this.toKey(i))}*entries(){for(let i of this._map.values())yield[i,i]}keys(){return this.values()}*values(){for(let i of this._map.values())yield i}clear(){this._map.clear()}forEach(i,e){this._map.forEach(t=>i.call(e,t,t,this))}[(F4i=Symbol.iterator,O4i=Symbol.toStringTag,F4i)](){return this.values()}};var iii=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(i){setTimeout(()=>{throw i.stack?ka.isErrorNoTelemetry(i)?new ka(i.message+`

`+i.stack):new Error(i.message+`

`+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}},J7=new iii;function V4i(a){J7.setUnexpectedErrorHandler(a)}function Z7(a){J7.onUnexpectedError(a)}function mt(a){Yi(a)||J7.onUnexpectedError(a)}function vs(a){Yi(a)||J7.onUnexpectedExternalError(a)}function Aj(a){if(a instanceof Error){let{name:i,message:e,cause:t}=a,o=a.stacktrace||a.stack;return{$isError:!0,name:i,message:e,stack:o,noTelemetry:ka.isErrorNoTelemetry(a),cause:t?Aj(t):void 0,code:a.code}}return a}function eY(a){let i;return a.noTelemetry?i=new ka:(i=new Error,i.name=a.name),i.message=a.message,i.stack=a.stack,a.code&&(i.code=a.code),a.cause&&(i.cause=eY(a.cause)),i}var X7="Canceled";function Yi(a){return a instanceof qi?!0:a instanceof Error&&a.name===X7&&a.message===X7}var qi=class extends Error{constructor(){super(X7),this.name=this.message}},pvt=class a extends Error{static{this._name="PendingMigrationError"}static is(i){return i instanceof a||i instanceof Error&&i.name===a._name}constructor(i){super(i),this.name=a._name}};function wy(){let a=new Error(X7);return a.name=a.message,a}function ls(a){return a?new Error(`Illegal argument: ${a}`):new Error("Illegal argument")}function Nye(a){return a?new Error(`Illegal state: ${a}`):new Error("Illegal state")}function Dn(a){return a?a.message?a.message:a.stack?a.stack.split(`
`)[0]:String(a):"Error"}var Pj=class extends Error{constructor(i){super("NotSupported"),i&&(this.message=i)}};var ka=class a extends Error{constructor(i){super(i),this.name="CodeExpectedError"}static fromError(i){if(i instanceof a)return i;let e=new a;return e.message=i.message,e.stack=i.stack,e}static isErrorNoTelemetry(i){return i.name==="CodeExpectedError"}},ci=class a extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,a.prototype)}};function bd(a,i){let e=this,t=!1,o;return function(){if(t)return o;if(t=!0,i)try{o=a.apply(e,arguments)}finally{i()}else o=a.apply(e,arguments);return o}}function wu(a,i,e=a.length-1){let t=Oye(a,i,e);if(t!==-1)return a[t]}function Oye(a,i,e=a.length-1){for(let t=e;t>=0;t--){let o=a[t];if(i(o,t))return t}return-1}function mvt(a,i,e=0){let t=E1o(a,i,e);if(t!==-1)return a[t]}function E1o(a,i,e=0){for(let t=e;t<a.length;t++){let o=a[t];if(i(o,t))return t}return-1}function Nj(a,i){let e=Oj(a,i);return e===-1?void 0:a[e]}function Oj(a,i,e=0,t=a.length){let o=e,n=t;for(;o<n;){let r=Math.floor((o+n)/2);i(a[r])?o=r+1:n=r}return o-1}function B4i(a,i){let e=Mw(a,i);return e===a.length?void 0:a[e]}function Mw(a,i,e=0,t=a.length){let o=e,n=t;for(;o<n;){let r=Math.floor((o+n)/2);i(a[r])?n=r:o=r+1}return o}var $5e=class a{constructor(i){this._array=i;this._findLastMonotonousLastIdx=0}static{this.assertInvariants=!1}findLastMonotonous(i){if(a.assertInvariants){if(this._prevFindLastPredicate){for(let t of this._array)if(this._prevFindLastPredicate(t)&&!i(t))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=i}let e=Oj(this._array,i,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=e+1,e===-1?void 0:this._array[e]}};function j5e(a,i){if(a.length===0)return;let e=a[0];for(let t=1;t<a.length;t++){let o=a[t];i(o,e)>0&&(e=o)}return e}function hvt(a,i){if(a.length===0)return;let e=a[0];for(let t=1;t<a.length;t++){let o=a[t];i(o,e)>=0&&(e=o)}return e}function gvt(a,i){return j5e(a,(e,t)=>-i(e,t))}function H4i(a,i){if(a.length===0)return-1;let e=0;for(let t=1;t<a.length;t++){let o=a[t];i(o,a[e])>0&&(e=t)}return e}function iD(a,i){for(let e of a){let t=i(e);if(t!==void 0)return t}}function Rf(a){if(a.length===0)throw new Error("Invalid tail call");return[a.slice(0,a.length-1),a[a.length-1]]}function eo(a,i,e=(t,o)=>t===o){if(a===i)return!0;if(!a||!i||a.length!==i.length)return!1;for(let t=0,o=a.length;t<o;t++)if(!e(a[t],i[t]))return!1;return!0}function U4i(a,i){let e=a.length-1;i<e&&(a[i]=a[e]),a.pop()}function Ek(a,i,e){return cA(a.length,t=>e(a[t],i))}function cA(a,i){let e=0,t=a-1;for(;e<=t;){let o=(e+t)/2|0,n=i(o);if(n<0)e=o+1;else if(n>0)t=o-1;else return o}return-(e+1)}function tY(a,i,e){if(a=a|0,a>=i.length)throw new TypeError("invalid index");let t=i[Math.floor(i.length*Math.random())],o=[],n=[],r=[];for(let s of i){let l=e(s,t);l<0?o.push(s):l>0?n.push(s):r.push(s)}return a<o.length?tY(a,o,e):a<o.length+r.length?r[0]:tY(a-(o.length+r.length),n,e)}function Lf(a,i){let e=[],t;for(let o of a.slice(0).sort(i))!t||i(t[0],o)!==0?(t=[o],e.push(t)):t.push(o);return e}function*iY(a,i){let e,t;for(let o of a)t!==void 0&&i(t,o)?e.push(o):(e&&(yield e),e=[o]),t=o;e&&(yield e)}function vvt(a,i){for(let e=0;e<=a.length;e++)i(e===0?void 0:a[e-1],e===a.length?void 0:a[e])}function z4i(a,i){for(let e=0;e<a.length;e++)i(e===0?void 0:a[e-1],a[e],e+1===a.length?void 0:a[e+1])}function bvt(...a){return[].concat(...a)}function Q5e(a,i,e){let t=[];function o(s,l,c){if(l===0&&c.length===0)return;let u=t[t.length-1];u&&u.start+u.deleteCount===s?(u.deleteCount+=l,u.toInsert.push(...c)):t.push({start:s,deleteCount:l,toInsert:c})}let n=0,r=0;for(;;){if(n===a.length){o(n,0,i.slice(r));break}if(r===i.length){o(n,a.length-n,[]);break}let s=a[n],l=i[r],c=e(s,l);c===0?(n+=1,r+=1):c<0?(o(n,1,[]),n+=1):c>0&&(o(n,0,[l]),r+=1)}return t}function dA(a,i,e){let t=Q5e(a,i,e),o=[],n=[];for(let r of t)o.push(...a.slice(r.start,r.start+r.deleteCount)),n.push(...r.toInsert);return{removed:o,added:n}}function K4i(a,i,e){if(e===0)return[];let t=a.slice(0,e).sort(i);return T1o(a,i,t,e,a.length),t}function T1o(a,i,e,t,o){for(let n=e.length;t<o;t++){let r=a[t];if(i(r,e[n-1])<0){e.pop();let s=Mw(e,l=>i(r,l)<0);e.splice(s,0,r)}}}function ui(a){return a.filter(i=>!!i)}function Wj(a){let i=0;for(let e=0;e<a.length;e++)a[e]&&(a[i]=a[e],i+=1);a.length=i}function G4i(a,i,e){a.splice(e,0,a.splice(i,1)[0])}function YO(a){return!Array.isArray(a)||a.length===0}function Rr(a){return Array.isArray(a)&&a.length>0}function jo(a,i=e=>e){let e=new Set;return a.filter(t=>{let o=i(t);return e.has(o)?!1:(e.add(o),!0)})}function q4i(a){let i=new Set;return e=>{let t=a(e);return i.has(t)?!1:(i.add(t),!0)}}function $4i(a,i,e=(t,o)=>t===o){let t=0;for(let o=0,n=Math.min(a.length,i.length);o<n&&e(a[o],i[o]);o++)t++;return t}function tf(a,i){let e=typeof i=="number"?a:0;typeof i=="number"?e=a:(e=0,i=a);let t=[];if(e<=i)for(let o=e;o<i;o++)t.push(o);else for(let o=e;o>i;o--)t.push(o);return t}function oY(a,i,e){return a.reduce((t,o)=>(t[i(o)]=e?e(o):o,t),Object.create(null))}function vg(a,i){return a.push(i),()=>Y5e(a,i)}function Y5e(a,i){let e=a.indexOf(i);if(e>-1)return a.splice(e,1),i}function dz(a,i,e){let t=a.slice(0,i),o=a.slice(i);return t.concat(e,o)}function nY(a,i){let e;if(typeof i=="number"){let t=i;e=()=>{let o=Math.sin(t++)*179426549;return o-Math.floor(o)}}else e=Math.random;for(let t=a.length-1;t>0;t-=1){let o=Math.floor(e()*(t+1)),n=a[t];a[t]=a[o],a[o]=n}}function Svt(a,i){let e=a.indexOf(i);e>-1&&(a.splice(e,1),a.unshift(i))}function X5e(a,i){let e=a.indexOf(i);e>-1&&(a.splice(e,1),a.push(i))}function Vj(a,i){for(let e of i)a.push(e)}function j4i(a,i){return Array.isArray(a)?a.map(i):i(a)}function Q4i(a,i){let e=[];for(let t of a){let o=i(t);o!==void 0&&e.push(o)}return e}function Y4i(a){let i=new Set(a);return Array.from(i)}function Ec(a){return Array.isArray(a)?a:[a]}function Ile(a,i,e){let t=X4i(a,i),o=a.length,n=e.length;a.length=o+n;for(let r=o-1;r>=t;r--)a[r+n]=a[r];for(let r=0;r<n;r++)a[r+t]=e[r]}function yle(a,i,e,t){let o=X4i(a,i),n=a.splice(o,e);return n===void 0&&(n=[]),Ile(a,o,t),n}function X4i(a,i){return i<0?Math.max(i+a.length,0):Math.min(i,a.length)}var tx;(s=>{function a(l){return l<0}s.isLessThan=a;function i(l){return l<=0}s.isLessThanOrEqual=i;function e(l){return l>0}s.isGreaterThan=e;function t(l){return l===0}s.isNeitherLessOrGreaterThan=t,s.greaterThan=1,s.lessThan=-1,s.neitherLessOrGreaterThan=0})(tx||={});function Il(a,i){return(e,t)=>i(a(e),a(t))}function Ivt(...a){return(i,e)=>{for(let t of a){let o=t(i,e);if(!tx.isNeitherLessOrGreaterThan(o))return o}return tx.neitherLessOrGreaterThan}}var Hu=(a,i)=>a-i,yvt=(a,i)=>Hu(a?1:0,i?1:0);function wle(a){return(i,e)=>-a(i,e)}function J4i(a){return(i,e)=>i===void 0?e===void 0?tx.neitherLessOrGreaterThan:tx.lessThan:e===void 0?tx.greaterThan:a(i,e)}var nT=class{constructor(i){this.firstIdx=0;this.items=i,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(i){let e=this.firstIdx;for(;e<this.items.length&&i(this.items[e]);)e++;let t=e===this.firstIdx?null:this.items.slice(this.firstIdx,e);return this.firstIdx=e,t}takeFromEndWhile(i){let e=this.lastIdx;for(;e>=0&&i(this.items[e]);)e--;let t=e===this.lastIdx?null:this.items.slice(e+1,this.lastIdx+1);return this.lastIdx=e,t}peek(){if(this.length!==0)return this.items[this.firstIdx]}peekLast(){if(this.length!==0)return this.items[this.lastIdx]}dequeue(){let i=this.items[this.firstIdx];return this.firstIdx++,i}removeLast(){let i=this.items[this.lastIdx];return this.lastIdx--,i}takeCount(i){let e=this.items.slice(this.firstIdx,this.firstIdx+i);return this.firstIdx+=i,e}},Fj=class a{constructor(i){this.iterate=i}static{this.empty=new a(i=>{})}forEach(i){this.iterate(e=>(i(e),!0))}toArray(){let i=[];return this.iterate(e=>(i.push(e),!0)),i}filter(i){return new a(e=>this.iterate(t=>i(t)?e(t):!0))}map(i){return new a(e=>this.iterate(t=>e(i(t))))}some(i){let e=!1;return this.iterate(t=>(e=i(t),!e)),e}findFirst(i){let e;return this.iterate(t=>i(t)?(e=t,!1):!0),e}findLast(i){let e;return this.iterate(t=>(i(t)&&(e=t),!0)),e}findLastMaxBy(i){let e,t=!0;return this.iterate(o=>((t||tx.isGreaterThan(i(o,e)))&&(t=!1,e=o),!0)),e}},fvt=class a{constructor(i){this._indexMap=i}static createSortPermutation(i,e){let t=Array.from(i.keys()).sort((o,n)=>e(i[o],i[n]));return new a(t)}apply(i){return i.map((e,t)=>i[this._indexMap[t]])}inverse(){let i=this._indexMap.slice();for(let e=0;e<this._indexMap.length;e++)i[this._indexMap[e]]=e;return new a(i)}};async function Z4i(a,i){return(await Promise.all(a.map(async(t,o)=>({element:t,ok:await i(t,o)})))).find(t=>t.ok)?.element}function Fye(a){return a.reduce((i,e)=>i+e,0)}function Pw(a,i){return a.reduce((e,t)=>e+i(t),0)}function cB(a,i,e){let t=a.get(i);return t===void 0&&(t=e,a.set(i,t)),t}var oii=class{constructor(i,e){this.uri=i;this.value=e}};function _1o(a){return Array.isArray(a)}var e3i,dt=class a{constructor(i,e){this[e3i]="ResourceMap";if(i instanceof a)this.map=new Map(i.map),this.toKey=e??a.defaultToKey;else if(_1o(i)){this.map=new Map,this.toKey=e??a.defaultToKey;for(let[t,o]of i)this.set(t,o)}else this.map=new Map,this.toKey=i??a.defaultToKey}static{this.defaultToKey=i=>i.toString()}set(i,e){return this.map.set(this.toKey(i),new oii(i,e)),this}get(i){return this.map.get(this.toKey(i))?.value}has(i){return this.map.has(this.toKey(i))}get size(){return this.map.size}clear(){this.map.clear()}delete(i){return this.map.delete(this.toKey(i))}forEach(i,e){typeof e<"u"&&(i=i.bind(e));for(let[t,o]of this.map)i(o.value,o.uri,this)}*values(){for(let i of this.map.values())yield i.value}*keys(){for(let i of this.map.values())yield i.uri}*entries(){for(let i of this.map.values())yield[i.uri,i.value]}*[(e3i=Symbol.toStringTag,Symbol.iterator)](){for(let[,i]of this.map)yield[i.uri,i.value]}},t3i,xn=class{constructor(i,e){this[t3i]="ResourceSet";!i||typeof i=="function"?this._map=new dt(i):(this._map=new dt(e),i.forEach(this.add,this))}get size(){return this._map.size}add(i){return this._map.set(i,i),this}clear(){this._map.clear()}delete(i){return this._map.delete(i)}forEach(i,e){this._map.forEach((t,o)=>i.call(e,o,o,this))}has(i){return this._map.has(i)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(t3i=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}};var i3i,uz=class{constructor(){this[i3i]="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(i){return this._map.has(i)}get(i,e=0){let t=this._map.get(i);if(t)return e!==0&&this.touch(t,e),t.value}set(i,e,t=0){let o=this._map.get(i);if(o)o.value=e,t!==0&&this.touch(o,t);else{switch(o={key:i,value:e,next:void 0,previous:void 0},t){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(i,o),this._size++}return this}delete(i){return!!this.remove(i)}remove(i){let e=this._map.get(i);if(e)return this._map.delete(i),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 i=this._head;return this._map.delete(i.key),this.removeItem(i),this._size--,i.value}forEach(i,e){let t=this._state,o=this._head;for(;o;){if(e?i.bind(e)(o.value,o.key,this):i(o.value,o.key,this),this._state!==t)throw new Error("LinkedMap got modified during iteration.");o=o.next}}keys(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:t.key,done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}values(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:t.value,done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}entries(){let i=this,e=this._state,t=this._head,o={[Symbol.iterator](){return o},next(){if(i._state!==e)throw new Error("LinkedMap got modified during iteration.");if(t){let n={value:[t.key,t.value],done:!1};return t=t.next,n}else return{value:void 0,done:!0}}};return o}[(i3i=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(i){if(i>=this.size)return;if(i===0){this.clear();return}let e=this._head,t=this.size;for(;e&&t>i;)this._map.delete(e.key),e=e.next,t--;this._head=e,this._size=t,e&&(e.previous=void 0),this._state++}trimNew(i){if(i>=this.size)return;if(i===0){this.clear();return}let e=this._tail,t=this.size;for(;e&&t>i;)this._map.delete(e.key),e=e.previous,t--;this._tail=e,this._size=t,e&&(e.next=void 0),this._state++}addItemFirst(i){if(!this._head&&!this._tail)this._tail=i;else if(this._head)i.next=this._head,this._head.previous=i;else throw new Error("Invalid list");this._head=i,this._state++}addItemLast(i){if(!this._head&&!this._tail)this._head=i;else if(this._tail)i.previous=this._tail,this._tail.next=i;else throw new Error("Invalid list");this._tail=i,this._state++}removeItem(i){if(i===this._head&&i===this._tail)this._head=void 0,this._tail=void 0;else if(i===this._head){if(!i.next)throw new Error("Invalid list");i.next.previous=void 0,this._head=i.next}else if(i===this._tail){if(!i.previous)throw new Error("Invalid list");i.previous.next=void 0,this._tail=i.previous}else{let e=i.next,t=i.previous;if(!e||!t)throw new Error("Invalid list");e.previous=t,t.next=e}i.next=void 0,i.previous=void 0,this._state++}touch(i,e){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(e!==1&&e!==2)){if(e===1){if(i===this._head)return;let t=i.next,o=i.previous;i===this._tail?(o.next=void 0,this._tail=o):(t.previous=o,o.next=t),i.previous=void 0,i.next=this._head,this._head.previous=i,this._head=i,this._state++}else if(e===2){if(i===this._tail)return;let t=i.next,o=i.previous;i===this._head?(t.previous=void 0,this._head=t):(t.previous=o,o.next=t),i.next=void 0,i.previous=this._tail,this._tail.next=i,this._tail=i,this._state++}}}toJSON(){let i=[];return this.forEach((e,t)=>{i.push([t,e])}),i}fromJSON(i){this.clear();for(let[e,t]of i)this.set(e,t)}},wvt=class extends uz{constructor(i,e=1){super(),this._limit=i,this._ratio=Math.min(Math.max(0,e),1)}get limit(){return this._limit}set limit(i){this._limit=i,this.checkTrim()}get ratio(){return this._ratio}set ratio(i){this._ratio=Math.min(Math.max(0,i),1),this.checkTrim()}get(i,e=2){return super.get(i,e)}peek(i){return super.get(i,0)}set(i,e){return super.set(i,e,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}},Ua=class extends wvt{constructor(i,e=1){super(i,e)}trim(i){this.trimOld(i)}set(i,e){return super.set(i,e),this.checkTrim(),this}},Cvt=class extends wvt{constructor(i,e=1){super(i,e)}trim(i){this.trimNew(i)}set(i,e){return this._limit<=this.size&&!this.has(i)&&this.trim(Math.round(this._limit*this._ratio)-1),super.set(i,e),this}},Wye=class{constructor(){this.map=new Map}add(i){return this.map.set(i,(this.map.get(i)||0)+1),this}delete(i){let e=this.map.get(i)||0;return e===0?!1:(e--,e===0?this.map.delete(i):this.map.set(i,e),!0)}has(i){return this.map.has(i)}},xvt=class{constructor(i){this._m1=new Map;this._m2=new Map;if(i)for(let[e,t]of i)this.set(e,t)}clear(){this._m1.clear(),this._m2.clear()}set(i,e){this._m1.set(i,e),this._m2.set(e,i)}get(i){return this._m1.get(i)}getKey(i){return this._m2.get(i)}delete(i){let e=this._m1.get(i);return e===void 0?!1:(this._m1.delete(i),this._m2.delete(e),!0)}forEach(i,e){this._m1.forEach((t,o)=>{i.call(e,t,o,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},pz=class{constructor(){this.map=new Map}add(i,e){let t=this.map.get(i);t||(t=new Set,this.map.set(i,t)),t.add(e)}delete(i,e){let t=this.map.get(i);t&&(t.delete(e),t.size===0&&this.map.delete(i))}forEach(i,e){let t=this.map.get(i);t&&t.forEach(e)}get(i){let e=this.map.get(i);return e||new Set}};function Cle(a,i){if(a===i)return!0;if(a.size!==i.size)return!1;for(let[e,t]of a)if(!i.has(e)||i.get(e)!==t)return!1;for(let[e]of i)if(!a.has(e))return!1;return!0}var mz=class{constructor(){this._data=new Map}set(i,...e){let t=this._data;for(let o=0;o<e.length-1;o++){let n=t.get(e[o]);n===void 0&&(n=new Map,t.set(e[o],n)),t=n}t.set(e[e.length-1],i)}get(...i){let e=this._data;for(let t=0;t<i.length-1;t++){let o=e.get(i[t]);if(o===void 0)return;e=o}return e.get(i[i.length-1])}clear(){this._data.clear()}*values(){function*i(e){for(let t of e.values())t instanceof Map?yield*i(t):yield t}yield*i(this._data)}toString(){let i=(e,t)=>{let o="";for(let[n,r]of e)o+=`${"  ".repeat(t)}${n}: `,r instanceof Map?o+=`
`+i(r,t+1):o+=`${r}
`;return o};return i(this._data,0)}};function rY(a,i){if(!a)throw new Error(i?`Assertion failed (${i})`:"Assertion Failed")}function bs(a,i="Unreachable"){throw new Error(i)}function Aw(a,i="unexpected state"){if(!a)throw typeof i=="string"?new ci(`Assertion Failed: ${i}`):i}function nii(a,i="Soft Assertion Failed"){a||mt(new ci(i))}function Wh(a){if(!a()){debugger;a(),mt(new ci("Assertion Failed"))}}function Nw(a,i){let e=0;for(;e<a.length-1;){let t=a[e],o=a[e+1];if(!i(t,o))return!1;e++}return!0}function We(a){return typeof a=="string"}function vI(a){return rii(a,We)}function rii(a,i){return Array.isArray(a)&&a.every(i)}function Di(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)&&!(a instanceof RegExp)&&!(a instanceof Date)}function n3i(a){let i=Object.getPrototypeOf(Uint8Array);return typeof a=="object"&&a instanceof i}function on(a){return typeof a=="number"&&!isNaN(a)}function J5e(a){return!!a&&typeof a[Symbol.iterator]=="function"}function Xa(a){return a===!0||a===!1}function bn(a){return typeof a>"u"}function so(a){return!mr(a)}function mr(a){return bn(a)||a===null}function To(a,i){if(!a)throw new Error(i?`Unexpected type, expected '${i}'`:"Unexpected type")}function Ti(a){return Aw(a!=null,"Argument is `undefined` or `null`."),a}function Z5e(a,i){if(a==null)throw typeof i=="string"?new Error(i):i}function Ow(...a){let i=[];for(let e=0;e<a.length;e++){let t=a[e];if(mr(t))throw new Error(`Assertion Failed: argument at index ${e} is undefined or null`);i.push(t)}return i}var D1o=Object.prototype.hasOwnProperty;function dv(a){if(!Di(a))return!1;for(let i in a)if(D1o.call(a,i))return!1;return!0}function bL(a){return typeof a=="function"}function kvt(...a){return a.length>0&&a.every(bL)}function r3i(a,i){let e=Math.min(a.length,i.length);for(let t=0;t<e;t++)R1o(a[t],i[t])}function R1o(a,i){if(We(i)){if(typeof a!==i)throw new Error(`argument does not match constraint: typeof ${i}`)}else if(bL(i)){try{if(a instanceof i)return}catch{}if(!mr(a)&&a.constructor===i||i.length===1&&i.call(void 0,a)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function yo(a,i){for(let e in i)if(!(e in a))return!1;return!0}var yt;(M=>{function a(N){return!!N&&typeof N=="object"&&typeof N[Symbol.iterator]=="function"}M.is=a;let i=Object.freeze([]);function e(){return i}M.empty=e;function*t(N){yield N}M.single=t;function o(N){return a(N)?N:t(N)}M.wrap=o;function n(N){return N??i}M.from=n;function*r(N){for(let V=N.length-1;V>=0;V--)yield N[V]}M.reverse=r;function s(N){return!N||N[Symbol.iterator]().next().done===!0}M.isEmpty=s;function l(N){return N[Symbol.iterator]().next().value}M.first=l;function c(N,V){let H=0;for(let K of N)if(V(K,H++))return!0;return!1}M.some=c;function u(N,V){let H=0;for(let K of N)if(!V(K,H++))return!1;return!0}M.every=u;function p(N,V){for(let H of N)if(V(H))return H}M.find=p;function*h(N,V){for(let H of N)V(H)&&(yield H)}M.filter=h;function*g(N,V){let H=0;for(let K of N)yield V(K,H++)}M.map=g;function*f(N,V){let H=0;for(let K of N)yield*V(K,H++)}M.flatMap=f;function*v(...N){for(let V of N)J5e(V)?yield*V:yield V}M.concat=v;function b(N,V,H){let K=H;for(let j of N)K=V(K,j);return K}M.reduce=b;function S(N){let V=0;for(let H of N)V++;return V}M.length=S;function*y(N,V,H=N.length){for(V<-N.length&&(V=0),V<0&&(V+=N.length),H<0?H+=N.length:H>N.length&&(H=N.length);V<H;V++)yield N[V]}M.slice=y;function w(N,V=Number.POSITIVE_INFINITY){let H=[];if(V===0)return[H,N];let K=N[Symbol.iterator]();for(let j=0;j<V;j++){let J=K.next();if(J.done)return[H,M.empty()];H.push(J.value)}return[H,{[Symbol.iterator](){return K}}]}M.consume=w;async function x(N){let V=[];for await(let H of N)V.push(H);return V}M.asyncToArray=x;async function E(N){let V=[];for await(let H of N)V=V.concat(H);return V}M.asyncToArrayFlat=E})(yt||={});var L1o=!1,xle=null,Evt=class{constructor(){this._registry=new FinalizationRegistry(i=>{console.warn(`[LEAKED DISPOSABLE] ${i}`)})}trackDisposable(i){let e=new Error("CREATED via:").stack;this._registry.register(i,e,i)}setParent(i,e){e?this._registry.unregister(i):this.trackDisposable(i)}markAsDisposed(i){this._registry.unregister(i)}markAsSingleton(i){this._registry.unregister(i)}},Tvt=class a{constructor(){this.livingDisposables=new Map}static{this.idx=0}getDisposableData(i){let e=this.livingDisposables.get(i);return e||(e={parent:null,source:null,isSingleton:!1,value:i,idx:a.idx++},this.livingDisposables.set(i,e)),e}trackDisposable(i){let e=this.getDisposableData(i);e.source||(e.source=new Error().stack)}setParent(i,e){let t=this.getDisposableData(i);t.parent=e}markAsDisposed(i){this.livingDisposables.delete(i)}markAsSingleton(i){this.getDisposableData(i).isSingleton=!0}getRootParent(i,e){let t=e.get(i);if(t)return t;let o=i.parent?this.getRootParent(this.getDisposableData(i.parent),e):i;return e.set(i,o),o}getTrackedDisposables(){let i=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,i).isSingleton).flatMap(([t])=>t)}computeLeakingDisposables(i=10,e){let t;if(e)t=e;else{let l=new Map,c=[...this.livingDisposables.values()].filter(p=>p.source!==null&&!this.getRootParent(p,l).isSingleton);if(c.length===0)return;let u=new Set(c.map(p=>p.value));if(t=c.filter(p=>!(p.parent&&u.has(p.parent))),t.length===0)throw new Error("There are cyclic diposable chains!")}if(!t)return;function o(l){function c(p,h){for(;p.length>0&&h.some(g=>typeof g=="string"?g===p[0]:p[0].match(g));)p.shift()}let u=l.source.split(`
`).map(p=>p.trim().replace("at ","")).filter(p=>p!=="");return c(u,["Error",/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),u.reverse()}let n=new pz;for(let l of t){let c=o(l);for(let u=0;u<=c.length;u++)n.add(c.slice(0,u).join(`
`),l)}t.sort(Il(l=>l.idx,Hu));let r="",s=0;for(let l of t.slice(0,i)){s++;let c=o(l),u=[];for(let p=0;p<c.length;p++){let h=c[p];h=`(shared with ${n.get(c.slice(0,p+1).join(`
`)).size}/${t.length} leaks) at ${h}`;let f=n.get(c.slice(0,p).join(`
`)),v=yy([...f].map(b=>o(b)[p]),b=>b);delete v[c[p]];for(let[b,S]of Object.entries(v))S&&u.unshift(`    - stacktraces of ${S.length} other leaks continue with ${b}`);u.unshift(h)}r+=`


==================== Leaking disposable ${s}/${t.length}: ${l.value.constructor.name} ====================
${u.join(`
`)}
============================================================

`}return t.length>i&&(r+=`


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

`),{leaks:t,details:r}}};function Hye(a){xle=a}if(L1o){let a="__is_disposable_tracked__";Hye(new class{trackDisposable(i){let e=new Error("Potentially leaked disposable").stack;setTimeout(()=>{i[a]||console.log(e)},3e3)}setParent(i,e){if(i&&i!==k.None)try{i[a]=!0}catch{}}markAsDisposed(i){if(i&&i!==k.None)try{i[a]=!0}catch{}}markAsSingleton(i){}})}function Hj(a){return xle?.trackDisposable(a),a}function Uj(a){xle?.markAsDisposed(a)}function Bj(a,i){xle?.setParent(a,i)}function M1o(a,i){if(xle)for(let e of a)xle.setParent(e,i)}function bp(a){return xle?.markAsSingleton(a),a}function Sd(a){return typeof a=="object"&&a!==null&&typeof a.dispose=="function"&&a.dispose.length===0}function je(a){if(yt.is(a)){let i=[];for(let e of a)if(e)try{e.dispose()}catch(t){i.push(t)}if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(a)?[]:a}else if(a)return a.dispose(),a}function gz(a){for(let i of a)Sd(i)&&i.dispose();return[]}function Fn(...a){let i=ee(()=>je(a));return M1o(a,i),i}var sii=class{constructor(i){this._isDisposed=!1,this._fn=i,Hj(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,Uj(this),this._fn()}}};function ee(a){return new sii(a)}var O=class a{constructor(){this._toDispose=new Set;this._isDisposed=!1;Hj(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(Uj(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{je(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i||i===k.None)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return Bj(i,this),this._isDisposed?a.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(i),i}delete(i){if(i){if(i===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(i),i.dispose()}}deleteAndLeak(i){i&&this._toDispose.delete(i)&&Bj(i,null)}assertNotDisposed(){this._isDisposed&&mt(new ci("Object disposed"))}},k=class{constructor(){this._store=new O;Hj(this),Bj(this._store,this)}static{this.None=Object.freeze({dispose(){}})}dispose(){Uj(this),this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}},ue=class{constructor(){this._isDisposed=!1;Hj(this)}get value(){return this._isDisposed?void 0:this._value}set value(i){this._isDisposed||i===this._value||(this._value?.dispose(),i&&Bj(i,this),this._value=i)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Uj(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i&&Bj(i,null),i}},_vt=class{constructor(i){this._disposable=new ue;this._isDisposed=!1;this._disposable.value=i}get value(){return this._disposable.value}set value(i){this._isDisposed||i===this._disposable.value||(this._disposable.value=i)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},hz=class{constructor(i){this._disposable=i;this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}},ix=class{constructor(){this.references=new Map}acquire(i,...e){let t=this.references.get(i);t||(t={counter:0,object:this.createReferencedObject(i,...e)},this.references.set(i,t));let{object:o}=t,n=bd(()=>{--t.counter===0&&(this.destroyReferencedObject(i,t.object),this.references.delete(i))});return t.counter++,{object:o,dispose:n}}},Vye=class{constructor(i){this.referenceCollection=i}async acquire(i,...e){let t=this.referenceCollection.acquire(i,...e);try{return{object:await t.object,dispose:()=>t.dispose()}}catch(o){throw t.dispose(),o}}},Dvt=class{constructor(i){this.object=i}dispose(){}};var Ot=class{constructor(i=new Map){this._isDisposed=!1;this._store=i,Hj(this)}dispose(){Uj(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{je(this._store.values())}finally{this._store.clear()}}has(i){return this._store.has(i)}get size(){return this._store.size}get(i){return this._store.get(i)}set(i,e,t=!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),t||this._store.get(i)?.dispose(),this._store.set(i,e),Bj(e,this)}deleteAndDispose(i){this._store.get(i)?.dispose(),this._store.delete(i)}deleteAndLeak(i){let e=this._store.get(i);return e&&Bj(e,null),this._store.delete(i),e}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}},Bye=class{constructor(i=new Set){this._isDisposed=!1;this._store=i,Hj(this)}dispose(){Uj(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{je(this._store.values())}finally{this._store.clear()}}has(i){return this._store.has(i)}get size(){return this._store.size}add(i){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableSet that has already been disposed of. The added object will be leaked!").stack),this._store.add(i),Bj(i,this)}deleteAndDispose(i){this._store.delete(i)&&i.dispose()}deleteAndLeak(i){if(this._store.delete(i))return Bj(i,null),i}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}};function Rvt(a,i){let e=!1;return a.then(t=>{e||i(t)}),ee(()=>{e=!0})}function Lvt(a,i){return a.then(e=>(i.isDisposed?e.dispose():i.add(e),e))}var bI=class extends Ot{constructor(){super(new dt)}};var Mf=class a{static{this.Undefined=new a(void 0)}constructor(i){this.element=i,this.next=a.Undefined,this.prev=a.Undefined}},ra=class{constructor(){this._first=Mf.Undefined;this._last=Mf.Undefined;this._size=0}get size(){return this._size}isEmpty(){return this._first===Mf.Undefined}clear(){let i=this._first;for(;i!==Mf.Undefined;){let e=i.next;i.prev=Mf.Undefined,i.next=Mf.Undefined,i=e}this._first=Mf.Undefined,this._last=Mf.Undefined,this._size=0}unshift(i){return this._insert(i,!1)}push(i){return this._insert(i,!0)}_insert(i,e){let t=new Mf(i);if(this._first===Mf.Undefined)this._first=t,this._last=t;else if(e){let n=this._last;this._last=t,t.prev=n,n.next=t}else{let n=this._first;this._first=t,t.next=n,n.prev=t}this._size+=1;let o=!1;return()=>{o||(o=!0,this._remove(t))}}shift(){if(this._first!==Mf.Undefined){let i=this._first.element;return this._remove(this._first),i}}pop(){if(this._last!==Mf.Undefined){let i=this._last.element;return this._remove(this._last),i}}peek(){if(this._last!==Mf.Undefined)return this._last.element}_remove(i){if(i.prev!==Mf.Undefined&&i.next!==Mf.Undefined){let e=i.prev;e.next=i.next,i.next.prev=e}else i.prev===Mf.Undefined&&i.next===Mf.Undefined?(this._first=Mf.Undefined,this._last=Mf.Undefined):i.next===Mf.Undefined?(this._last=this._last.prev,this._last.next=Mf.Undefined):i.prev===Mf.Undefined&&(this._first=this._first.next,this._first.prev=Mf.Undefined);this._size-=1}*[Symbol.iterator](){let i=this._first;for(;i!==Mf.Undefined;)yield i.element,i=i.next}};var fz="en",i4e=!1,o4e=!1,t4e=!1,c3i=!1,d3i=!1,lii=!1,u3i=!1,cii=!1,p3i=!1,m3i=!1,e4e,Mvt=fz,aii=fz,h3i,zj,Kj=globalThis,SL;typeof Kj.vscode<"u"&&typeof Kj.vscode.process<"u"?SL=Kj.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(SL=process);var g3i=typeof SL?.versions?.electron=="string",P1o=g3i&&SL?.type==="renderer";if(typeof SL=="object"){i4e=SL.platform==="win32",o4e=SL.platform==="darwin",t4e=SL.platform==="linux",c3i=t4e&&!!SL.env.SNAP&&!!SL.env.SNAP_REVISION,u3i=g3i,p3i=!!SL.env.CI||!!SL.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!SL.env.GITHUB_WORKSPACE,e4e=fz,Mvt=fz;let a=SL.env.VSCODE_NLS_CONFIG;if(a)try{let i=JSON.parse(a);e4e=i.userLocale,aii=i.osLocale,Mvt=i.resolvedLanguage||fz,h3i=i.languagePack?.translationsConfigFile}catch{}d3i=!0}else typeof navigator=="object"&&!P1o?(zj=navigator.userAgent,i4e=zj.indexOf("Windows")>=0,o4e=zj.indexOf("Macintosh")>=0,cii=(zj.indexOf("Macintosh")>=0||zj.indexOf("iPad")>=0||zj.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,t4e=zj.indexOf("Linux")>=0,m3i=zj?.indexOf("Mobi")>=0,lii=!0,Mvt=ble()||fz,e4e=navigator.language.toLowerCase(),aii=e4e):console.error("Unable to resolve platform.");function oD(a){switch(a){case 0:return"Web";case 1:return"Mac";case 2:return"Linux";case 3:return"Windows"}}var Pvt=0;o4e?Pvt=1:i4e?Pvt=3:t4e&&(Pvt=2);var ii=i4e,et=o4e,Sn=t4e,Uye=c3i,Qr=d3i,Avt=u3i,Ft=lii,A1o=lii&&typeof Kj.importScripts=="function",f3i=A1o?Kj.origin:void 0,Tc=cii,zye=m3i,Pf=p3i,xm=Pvt,vz=zj,Kr=Mvt,SI;(t=>{function a(){return Kr}t.value=a;function i(){return Kr.length===2?Kr==="en":Kr.length>=3?Kr[0]==="e"&&Kr[1]==="n"&&Kr[2]==="-":!1}t.isDefaultVariant=i;function e(){return Kr==="en"}t.isDefault=e})(SI||={});var Kye=e4e,v3i=aii,dii=h3i,N1o=typeof Kj.postMessage=="function"&&!Kj.importScripts,ox=(()=>{if(N1o){let a=[];Kj.addEventListener("message",e=>{if(e.data&&e.data.vscodeScheduleAsyncWork)for(let t=0,o=a.length;t<o;t++){let n=a[t];if(n.id===e.data.vscodeScheduleAsyncWork){a.splice(t,1),n.callback();return}}});let i=0;return e=>{let t=++i;a.push({id:t,callback:e}),Kj.postMessage({vscodeScheduleAsyncWork:t},"*")}}return a=>setTimeout(a)})();var Ao=o4e||cii?2:i4e?1:3,a3i=!0,l3i=!1;function n4e(){if(!l3i){l3i=!0;let a=new Uint8Array(2);a[0]=1,a[1]=2,a3i=new Uint16Array(a.buffer)[0]===513}return a3i}var bz=!!(vz&&vz.indexOf("Chrome")>=0),Gye=!!(vz&&vz.indexOf("Firefox")>=0),qye=!!(!bz&&vz&&vz.indexOf("Safari")>=0),$ye=!!(vz&&vz.indexOf("Edg/")>=0),Nvt=!!(vz&&vz.indexOf("Android")>=0);function Ovt(a){return parseFloat(a)>=25}var kle,uii=globalThis.vscode;if(typeof uii<"u"&&typeof uii.process<"u"){let a=uii.process;kle={get platform(){return a.platform},get arch(){return a.arch},get env(){return a.env},cwd(){return a.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?kle={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:kle={get platform(){return ii?"win32":et?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var Ele=kle.cwd,Sp=kle.env,XO=kle.platform,jye=kle.arch;var O1o=globalThis.performance.now.bind(globalThis.performance),On=class a{static create(i){return new a(i)}constructor(i){this._now=i===!1?Date.now:O1o,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 S3i=!1,F1o=!1,W1o=100,I3i=6e4;function y3i(){return!!Sp.VSCODE_DEV}var U;(ae=>{ae.None=()=>k.None;function i(ce){if(F1o){let{onDidAddListener:Se}=ce,Re=Xye.create(),xe=0;ce.onDidAddListener=()=>{++xe===2&&(console.warn("snapshotted emitter LIKELY used public and SHOULD HAVE BEEN created with DisposableStore. snapshotted here"),Re.print()),Se?.()}}}function e(ce,Se,Re){return g(ce,()=>{},0,void 0,Se??!0,void 0,Re)}ae.defer=e;function t(ce){return(Se,Re=null,xe)=>{let He=!1,Ee;return Ee=ce(Te=>{if(!He)return Ee?Ee.dispose():He=!0,Se.call(Re,Te)},null,xe),He&&Ee.dispose(),Ee}}ae.once=t;function o(ce,Se){return ae.once(ae.filter(ce,Se))}ae.onceIf=o;function n(ce,Se,Re){return p((xe,He=null,Ee)=>ce(Te=>xe.call(He,Se(Te)),null,Ee),Re)}ae.map=n;function r(ce,Se,Re){return p((xe,He=null,Ee)=>ce(Te=>{Se(Te),xe.call(He,Te)},null,Ee),Re)}ae.forEach=r;function s(ce,Se,Re){return p((xe,He=null,Ee)=>ce(Te=>Se(Te)&&xe.call(He,Te),null,Ee),Re)}ae.filter=s;function l(ce){return ce}ae.signal=l;function c(...ce){return(Se,Re=null,xe)=>{let He=Fn(...ce.map(Ee=>Ee(Te=>Se.call(Re,Te))));return h(He,xe)}}ae.any=c;function u(ce,Se,Re,xe){let He=Re;return n(ce,Ee=>(He=Se(He,Ee),He),xe)}ae.reduce=u;function p(ce,Se){let Re,xe={onWillAddFirstListener(){Re=ce(He.fire,He)},onDidRemoveLastListener(){Re?.dispose()}};Se||i(xe);let He=new T(xe);return Se?.add(He),He.event}function h(ce,Se){return Se instanceof Array?Se.push(ce):Se&&Se.add(ce),ce}function g(ce,Se,Re=100,xe=!1,He=!1,Ee,Te){let It,tt,Oi,zt=0,mo,dn={leakWarningThreshold:Ee,onWillAddFirstListener(){It=ce(_i=>{zt++,tt=Se(tt,_i),xe&&!Oi&&(No.fire(tt),tt=void 0),mo=()=>{let ln=tt;tt=void 0,Oi=void 0,(!xe||zt>1)&&No.fire(ln),zt=0},typeof Re=="number"?(Oi&&clearTimeout(Oi),Oi=setTimeout(mo,Re)):Oi===void 0&&(Oi=null,queueMicrotask(mo))})},onWillRemoveListener(){He&&zt>0&&mo?.()},onDidRemoveLastListener(){mo=void 0,It.dispose()}};Te||i(dn);let No=new T(dn);return Te?.add(No),No.event}ae.debounce=g;function f(ce,Se=0,Re,xe){return ae.debounce(ce,(He,Ee)=>He?(He.push(Ee),He):[Ee],Se,void 0,Re??!0,void 0,xe)}ae.accumulate=f;function v(ce,Se,Re=100,xe=!0,He=!0,Ee,Te){let It,tt,Oi,zt=0,mo={leakWarningThreshold:Ee,onWillAddFirstListener(){It=ce(No=>{zt++,tt=Se(tt,No),Oi===void 0&&(xe&&(dn.fire(tt),tt=void 0,zt=0),typeof Re=="number"?Oi=setTimeout(()=>{He&&zt>0&&dn.fire(tt),tt=void 0,Oi=void 0,zt=0},Re):(Oi=0,queueMicrotask(()=>{He&&zt>0&&dn.fire(tt),tt=void 0,Oi=void 0,zt=0})))})},onDidRemoveLastListener(){It.dispose()}};Te||i(mo);let dn=new T(mo);return Te?.add(dn),dn.event}ae.throttle=v;function b(ce,Se=(xe,He)=>xe===He,Re){let xe=!0,He;return s(ce,Ee=>{let Te=xe||!Se(Ee,He);return xe=!1,He=Ee,Te},Re)}ae.latch=b;function S(ce,Se,Re){return[ae.filter(ce,Se,Re),ae.filter(ce,xe=>!Se(xe),Re)]}ae.split=S;function y(ce,Se,Re=!1,xe=[],He){let Ee=xe.slice(),Te;y3i()&&(Te={stack:Xye.create(),timerId:setTimeout(()=>{Ee&&Ee.length>0&&Te&&!Te.warned&&(Te.warned=!0,console.warn(`[Event.buffer][${Se}] potential LEAK detected: ${Ee.length} events buffered for ${I3i/1e3}s without being consumed. Buffered here:`),Te.stack.print())},I3i),warned:!1},He&&He.add(ee(()=>clearTimeout(Te.timerId))));let It=()=>{Te&&clearTimeout(Te.timerId)},tt=ce(mo=>{Ee?(Ee.push(mo),y3i()&&Te&&!Te.warned&&Ee.length>=W1o&&(Te.warned=!0,console.warn(`[Event.buffer][${Se}] potential LEAK detected: ${Ee.length} events buffered without being consumed. Buffered here:`),Te.stack.print())):zt.fire(mo)});He&&He.add(tt);let Oi=()=>{Ee?.forEach(mo=>zt.fire(mo)),Ee=null,It()},zt=new T({onWillAddFirstListener(){tt||(tt=ce(mo=>zt.fire(mo)),He&&He.add(tt))},onDidAddFirstListener(){Ee&&(Re?setTimeout(Oi):Oi())},onDidRemoveLastListener(){tt&&tt.dispose(),tt=null,It()}});return He&&He.add(zt),zt.event}ae.buffer=y;function w(ce,Se){return(xe,He,Ee)=>{let Te=Se(new E);return ce(function(It){let tt=Te.evaluate(It);tt!==x&&xe.call(He,tt)},void 0,Ee)}}ae.chain=w;let x=Symbol("HaltChainable");class E{constructor(){this.steps=[]}map(Se){return this.steps.push(Se),this}forEach(Se){return this.steps.push(Re=>(Se(Re),Re)),this}filter(Se){return this.steps.push(Re=>Se(Re)?Re:x),this}reduce(Se,Re){let xe=Re;return this.steps.push(He=>(xe=Se(xe,He),xe)),this}latch(Se=(Re,xe)=>Re===xe){let Re=!0,xe;return this.steps.push(He=>{let Ee=Re||!Se(He,xe);return Re=!1,xe=He,Ee?He:x}),this}evaluate(Se){for(let Re of this.steps)if(Se=Re(Se),Se===x)break;return Se}}function M(ce,Se,Re=xe=>xe){let xe=(...It)=>Te.fire(Re(...It)),He=()=>ce.on(Se,xe),Ee=()=>ce.removeListener(Se,xe),Te=new T({onWillAddFirstListener:He,onDidRemoveLastListener:Ee});return Te.event}ae.fromNodeEventEmitter=M;function N(ce,Se,Re=xe=>xe){let xe=(...It)=>Te.fire(Re(...It)),He=()=>ce.addEventListener(Se,xe),Ee=()=>ce.removeEventListener(Se,xe),Te=new T({onWillAddFirstListener:He,onDidRemoveLastListener:Ee});return Te.event}ae.fromDOMEventEmitter=N;function V(ce,Se){let Re,xe,He=new Promise(Ee=>{xe=t(ce)(Ee),gii(xe,Se),Re=()=>{w3i(xe,Se)}});return He.cancel=Re,Se&&He.finally(()=>w3i(xe,Se)),He}ae.toPromise=V;function H(ce,Se){return ce(Re=>Se.fire(Re))}ae.forward=H;function K(ce,Se,Re){return Se(Re),ce(xe=>Se(xe))}ae.runAndSubscribe=K;class j{constructor(Se,Re){this._observable=Se;this._counter=0;this._hasChanged=!1;let xe={onWillAddFirstListener:()=>{Se.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{Se.removeObserver(this)}};Re||i(xe),this.emitter=new T(xe),Re&&Re.add(this.emitter)}beginUpdate(Se){this._counter++}handlePossibleChange(Se){}handleChange(Se,Re){this._hasChanged=!0}endUpdate(Se){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function J(ce,Se){return new j(ce,Se).emitter.event}ae.fromObservable=J;function se(ce){return(Se,Re,xe)=>{let He=0,Ee=!1,Te={beginUpdate(){He++},endUpdate(){He--,He===0&&(ce.reportChanges(),Ee&&(Ee=!1,Se.call(Re)))},handlePossibleChange(){},handleChange(){Ee=!0}};ce.addObserver(Te),ce.reportChanges();let It={dispose(){ce.removeObserver(Te)}};return gii(It,xe),It}}ae.fromObservableLight=se})(U||={});var Yye=class a{constructor(i){this.listenerCount=0;this.invocationCount=0;this.elapsedOverall=0;this.durations=[];this.name=`${i}_${a._idPool++}`,a.all.add(this)}static{this.all=new Set}static{this._idPool=0}start(i){this._stopWatch=new On,this.listenerCount=i}stop(){if(this._stopWatch){let i=this._stopWatch.elapsed();this.durations.push(i),this.elapsedOverall+=i,this.invocationCount+=1,this._stopWatch=void 0}}},r4e=-1;function C3i(a){let i=r4e;return r4e=a,{dispose(){r4e=i}}}var pii=class a{constructor(i,e,t=(a._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i;this.threshold=e;this.name=t;this._warnCountdown=0}static{this._idPool=1}dispose(){this._stacks?.clear()}check(i,e){let t=this.threshold;if(t<=0||e<t)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(i.value)||0;if(this._stacks.set(i.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=t*.5;let[n,r]=this.getMostFrequentStack(),s=/^[0-9a-f]+$/i.test(this.name)?void 0:this.name,l=`[${this.name}] potential listener LEAK detected, having ${e} listeners already. MOST frequent listener (${r}):`;console.warn(l),console.warn(n);let c=r/e>.3?"dominated":"popular",u=new Jye(c,l,n,e,s);this._errorHandler(u)}return()=>{let n=this._stacks.get(i.value)||0;this._stacks.set(i.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let i,e=0;for(let[t,o]of this._stacks)(!i||e<o)&&(i=[t,o],e=o);return i}},Xye=class a{constructor(i){this.value=i}static create(){let i=new Error;return new a(i.stack??"")}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}},Jye=class a extends Error{constructor(i,e,t,o,n){super(n?`[${n}] potential listener LEAK detected, ${i}`:`potential listener LEAK detected, ${i}`),this.name="ListenerLeakError",this.kind=i,this.listenerCount=o,this.details=e,this.stack=t}static is(i){return i instanceof a||i instanceof Error&&typeof i.kind=="string"&&typeof i.listenerCount=="number"}},mii=class extends Jye{constructor(i,e,t,o,n){super(i,e,t,o,n),this.name="ListenerRefusalError"}},V1o=0,Qye=class{constructor(i){this.value=i;this.id=V1o++}},B1o=2,x3i=(a,i)=>{if(a instanceof Qye)i(a);else for(let e=0;e<a.length;e++){let t=a[e];t&&i(t)}},T=class{constructor(i){this._size=0;this._options=i,this._leakageMon=r4e>0||this._options?.leakWarningThreshold?new pii(i?.onListenerError??mt,this._options?.leakWarningThreshold??r4e,this._options?.leakWarningName):void 0,this._perfMon=this._options?._profName?new Yye(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(S3i){let i=this._listeners;queueMicrotask(()=>{x3i(i,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(i,e,t)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let c=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],u=c[1]/this._size>.3?"dominated":"popular",p=new mii(u,`${l}. HINT: Stack shows most frequent listener (${c[1]}-times)`,c[0],this._size,this._options?.leakWarningName);return(this._options?.onListenerError||mt)(p),k.None}if(this._disposed)return k.None;e&&(i=i.bind(e));let o=new Qye(i),n,r;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=Xye.create(),n=this._leakageMon.check(o.stack,this._size+1)),S3i&&(o.stack=r??Xye.create()),this._listeners?this._listeners instanceof Qye?(this._deliveryQueue??=new Fvt,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 s=ee(()=>{n?.(),this._removeListener(o)});return gii(s,t),s},this._event}_removeListener(i){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,t=e.indexOf(i);if(t===-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[t]=void 0;let o=this._deliveryQueue.current===this;if(this._size*B1o<=e.length){let n=0;for(let r=0;r<e.length;r++)e[r]?e[n++]=e[r]:o&&n<this._deliveryQueue.end&&(this._deliveryQueue.end--,n<this._deliveryQueue.i&&this._deliveryQueue.i--);e.length=n}}_deliver(i,e){if(!i)return;let t=this._options?.onListenerError||mt;if(!t){i.value(e);return}try{i.value(e)}catch(o){t(o)}}_deliverQueue(i){let e=i.current._listeners;for(;i.i<i.end;)this._deliver(e[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Qye)this._deliver(this._listeners,i);else{let e=this._deliveryQueue;e.enqueue(this,i,this._listeners.length),this._deliverQueue(e)}this._perfMon?.stop()}hasListeners(){return this._size>0}},k3i=()=>new Fvt,Fvt=class{constructor(){this.i=-1;this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},sY=class extends T{async fireAsync(i,e,t){if(this._listeners)for(this._asyncDeliveryQueue||(this._asyncDeliveryQueue=new ra),x3i(this._listeners,o=>this._asyncDeliveryQueue.push([o.value,i]));this._asyncDeliveryQueue.size>0&&!e.isCancellationRequested;){let[o,n]=this._asyncDeliveryQueue.shift(),r=[],s={...n,token:e,waitUntil:l=>{if(Object.isFrozen(r))throw new Error("waitUntil can NOT be called asynchronous");t&&(l=t(l,o)),r.push(l)}};try{o(s)}catch(l){mt(l);continue}Object.freeze(r),await Promise.allSettled(r).then(l=>{for(let c of l)c.status==="rejected"&&mt(c.reason)})}}},Ih=class extends T{constructor(e){super(e);this._isPaused=0;this._eventQueue=new ra;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))}},Zye=class extends Ih{constructor(i){super(i),this._delay=i.delay??100}fire(i){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(i)}},aY=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(t=>super.fire(t)),this._queuedEvents=[]}))}},Cy=class{constructor(){this.hasListeners=!1;this.events=[];this.emitter=new T({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(i){let e={event:i,listener:null};return this.events.push(e),this.hasListeners&&this.hook(e),ee(bd(()=>{this.hasListeners&&this.unhook(e);let o=this.events.indexOf(e);this.events.splice(o,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(i=>this.hook(i))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(i=>this.unhook(i))}hook(i){i.listener=i.event(e=>this.emitter.fire(e))}unhook(i){i.listener?.dispose(),i.listener=null}dispose(){this.emitter.dispose();for(let i of this.events)i.listener?.dispose();this.events=[]}},Tle=class{constructor(i,e,t,o){this._store=new O;let n=this._store.add(new Cy),r=this._store.add(new Ot);function s(l){r.set(l,n.add(o(l)))}for(let l of i)s(l);this._store.add(e(l=>{s(l)})),this._store.add(t(l=>{r.deleteAndDispose(l)})),this.event=n.event}dispose(){this._store.dispose()}},JO=class{constructor(){this.data=[]}wrapEvent(i,e,t){return(o,n,r)=>i(s=>{let l=this.data[this.data.length-1];if(!e){l?l.buffers.push(()=>o.call(n,s)):o.call(n,s);return}let c=l;if(!c){o.call(n,e(t,s));return}c.items??=[],c.items.push(s),c.buffers.length===0&&l.buffers.push(()=>{c.reducedResult??=t?c.items.reduce(e,t):c.items.reduce(e),o.call(n,c.reducedResult)})},void 0,r)}bufferEvents(i){let e={buffers:new Array};this.data.push(e);let t=i();return this.data.pop(),e.buffers.forEach(o=>o()),t}},Ig=class{constructor(){this.listening=!1;this.inputEvent=U.None;this.inputEventListener=k.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(i){this.inputEvent=i,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=i(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}},ewe=class{constructor(i){this._value=i;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}static const(i){return new hii(i)}get value(){return this._value}set value(i){i!==this._value&&(this._value=i,this._onDidChange.fire(void 0))}},hii=class{constructor(i){this.value=i;this.onDidChange=U.None}};function E3i(a,i,e){let t=new Ot,o=new Set(a());for(let r of o)t.set(r,e(r));let n=new O;return n.add(i(()=>{let r=a(),s=cz(o,r);for(let l of s.removed)t.deleteAndDispose(l);for(let l of s.added)t.set(l,e(l));o=new Set(r)})),n.add(t),n}function gii(a,i){i instanceof O?i.add(a):Array.isArray(i)&&i.push(a)}function w3i(a,i){if(i instanceof O)i.delete(a);else if(Array.isArray(i)){let e=i.indexOf(a);e!==-1&&i.splice(e,1)}a.dispose()}var Sz=class a{constructor(){this.mapWindowIdToZoomLevel=new Map;this._onDidChangeZoomLevel=new T;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event;this.mapWindowIdToZoomFactor=new Map;this._onDidChangeFullscreen=new T;this.onDidChangeFullscreen=this._onDidChangeFullscreen.event;this.mapWindowIdToFullScreen=new Map}static{this.INSTANCE=new a}getZoomLevel(i){return this.mapWindowIdToZoomLevel.get(this.getWindowId(i))??0}setZoomLevel(i,e){if(this.getZoomLevel(e)===i)return;let t=this.getWindowId(e);this.mapWindowIdToZoomLevel.set(t,i),this._onDidChangeZoomLevel.fire(t)}getZoomFactor(i){return this.mapWindowIdToZoomFactor.get(this.getWindowId(i))??1}setZoomFactor(i,e){this.mapWindowIdToZoomFactor.set(this.getWindowId(e),i)}setFullscreen(i,e){if(this.isFullscreen(e)===i)return;let t=this.getWindowId(e);this.mapWindowIdToFullScreen.set(t,i),this._onDidChangeFullscreen.fire(t)}isFullscreen(i){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(i))}getWindowId(i){return i.vscodeWindowId}};function H1o(a,i,e){typeof i=="string"&&(i=a.matchMedia(i)),i.addEventListener("change",e)}function _3i(a,i){Sz.INSTANCE.setZoomLevel(a,i)}function nx(a){return Sz.INSTANCE.getZoomLevel(a)}var twe=Sz.INSTANCE.onDidChangeZoomLevel;function uv(a){return Sz.INSTANCE.getZoomFactor(a)}function D3i(a,i){Sz.INSTANCE.setZoomFactor(a,i)}function Gj(a,i){Sz.INSTANCE.setFullscreen(a,i)}function rx(a){return Sz.INSTANCE.isFullscreen(a)}var ZO=Sz.INSTANCE.onDidChangeFullscreen,iwe=navigator.userAgent,ed=iwe.indexOf("Firefox")>=0,dB=iwe.indexOf("AppleWebKit")>=0,Iz=iwe.indexOf("Chrome")>=0,_S=!Iz&&iwe.indexOf("Safari")>=0,R3i=!Iz&&!_S&&dB,nOn=iwe.indexOf("Electron/")>=0,fii=iwe.indexOf("Android")>=0,Wvt=!1;if(typeof ut.matchMedia=="function"){let a=ut.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ut.matchMedia("(display-mode: fullscreen)");Wvt=a.matches,H1o(ut,a,({matches:e})=>{Wvt&&i.matches||(Wvt=e)})}function owe(){return Wvt}function _le(){return!!navigator?.windowControlsOverlay?.visible}function L3i(a){return a.navigator?.windowControlsOverlay?.getTitlebarAreaRect()}function M3i(){return globalThis.MonacoEnvironment}var s4e=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(i,e){this._keyCodeToStr[i]=e,this._strToKeyCode[e.toLowerCase()]=i}keyCodeToStr(i){return this._keyCodeToStr[i]}strToKeyCode(i){return this._strToKeyCode[i.toLowerCase()]||0}},Vvt=new s4e,vii=new s4e,bii=new s4e,Sii=new Array(230),Bvt={},U1o={},P3i=[],A3i=Object.create(null),N3i=Object.create(null),DS={lowerCaseToEnum:a=>N3i[a]||0,toEnum:a=>A3i[a]||0,toString:a=>P3i[a]||"None"},Fw=[],nwe=[];for(let a=0;a<=193;a++)Fw[a]=-1;for(let a=0;a<=132;a++)nwe[a]=-1;(function(){let i=[[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=[],t=[];for(let o of i){let[n,r,s,l,c,u,p,h,g]=o;if(t[r]||(t[r]=!0,P3i[r]=s,A3i[s]=r,N3i[s.toLowerCase()]=r,n&&(Fw[r]=l,l!==0&&l!==3&&!eF(l)&&(nwe[l]=r))),!e[l]){if(e[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${s}`);Vvt.define(l,c),vii.define(l,h||c),bii.define(l,g||h||c)}u&&(Sii[u]=l),s&&(U1o[s]=u),p&&(Bvt[p]=l)}nwe[3]=46})();var sm;(r=>{function a(s){return Vvt.keyCodeToStr(s)}r.toString=a;function i(s){return Vvt.strToKeyCode(s)}r.fromString=i;function e(s){return vii.keyCodeToStr(s)}r.toUserSettingsUS=e;function t(s){return bii.keyCodeToStr(s)}r.toUserSettingsGeneral=t;function o(s){return vii.strToKeyCode(s)||bii.strToKeyCode(s)}r.fromUserSettings=o;function n(s){if(s>=98&&s<=113)return null;switch(s){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right";case 20:return"Delete"}return Vvt.keyCodeToStr(s)}r.toElectronAccelerator=n})(sm||={});function Gi(a,i){let e=(i&65535)<<16>>>0;return(a|e)>>>0}function eF(a){return a===5||a===4||a===6||a===57}var of={clipboard:{writeText:Qr||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:Qr||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},keyboard:Qr||owe()?0:navigator.keyboard||_S?1:2,touch:"ontouchstart"in ut||navigator.maxTouchPoints>0,pointerEvents:ut.PointerEvent&&("ontouchstart"in ut||navigator.maxTouchPoints>0)};function a4e(a,i){if(typeof a=="number"){if(a===0)return null;let e=(a&65535)>>>0,t=(a&4294901760)>>>16;return t!==0?new yz([Hvt(e,i),Hvt(t,i)]):new yz([Hvt(e,i)])}else{let e=[];for(let t=0;t<a.length;t++)e.push(Hvt(a[t],i));return new yz(e)}}function Hvt(a,i){let e=!!(a&2048),t=!!(a&256),o=i===2?t:e,n=!!(a&1024),r=!!(a&512),s=i===2?e:t,l=a&255;return new RS(o,n,r,s,l)}var RS=class a{constructor(i,e,t,o,n){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.keyCode=n}equals(i){return i instanceof a&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let i=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",t=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${i}${e}${t}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new yz([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},IL=class a{constructor(i,e,t,o,n){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.scanCode=n}equals(i){return i instanceof a&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.scanCode===i.scanCode}getHashCode(){let i=this.ctrlKey?"1":"0",e=this.shiftKey?"1":"0",t=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`S${i}${e}${t}${o}${this.scanCode}`}isDuplicateModifierCase(){return this.ctrlKey&&(this.scanCode===157||this.scanCode===161)||this.shiftKey&&(this.scanCode===158||this.scanCode===162)||this.altKey&&(this.scanCode===159||this.scanCode===163)||this.metaKey&&(this.scanCode===160||this.scanCode===164)}},yz=class{constructor(i){if(i.length===0)throw ls("chords");this.chords=i}getHashCode(){let i="";for(let e=0,t=this.chords.length;e<t;e++)e!==0&&(i+=";"),i+=this.chords[e].getHashCode();return i}equals(i){if(i===null||this.chords.length!==i.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(i.chords[e]))return!1;return!0}},Uvt=class{constructor(i,e,t,o,n,r){this.ctrlKey=i;this.shiftKey=e;this.altKey=t;this.metaKey=o;this.keyLabel=n;this.keyAriaLabel=r}},rwe=class{};function z1o(a){if(a.charCode){let e=String.fromCharCode(a.charCode).toUpperCase();return sm.fromString(e)}let i=a.keyCode;if(i===3)return 7;if(ed)switch(i){case 59:return 85;case 60:if(Sn)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(et)return 57;break}else if(dB){if(et&&i===93)return 57;if(!et&&i===92)return 57}return Sii[i]||0}var K1o=et?256:2048,G1o=512,q1o=1024,$1o=et?2048:256;function O3i(a){let i=[];return a.ctrlKey&&i.push("ctrl"),a.shiftKey&&i.push("shift"),a.altKey&&i.push("alt"),a.metaKey&&i.push("meta"),`modifiers: [${i.join(",")}], code: ${a.code}, keyCode: ${a.keyCode}, key: ${a.key}`}function F3i(a){let i=[];return a.ctrlKey&&i.push("ctrl"),a.shiftKey&&i.push("shift"),a.altKey&&i.push("alt"),a.metaKey&&i.push("meta"),`modifiers: [${i.join(",")}], code: ${a.code}, keyCode: ${a.keyCode} ('${sm.toString(a.keyCode)}')`}function zvt(a){return a.ctrlKey||a.shiftKey||a.altKey||a.metaKey}var mi=class{constructor(i){this._standardKeyboardEventBrand=!0;let e=i;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=z1o(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(i){return this._asKeybinding===i}_computeKeybinding(){let i=0;eF(this.keyCode)||(i=this.keyCode);let e=0;return this.ctrlKey&&(e|=K1o),this.altKey&&(e|=G1o),this.shiftKey&&(e|=q1o),this.metaKey&&(e|=$1o),e|=i,e}_computeKeyCodeChord(){let i=0;return eF(this.keyCode)||(i=this.keyCode),new RS(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,i)}};var W3i=new WeakMap;function j1o(a){if(!a.parent||a.parent===a)return null;try{let i=a.location,e=a.parent.location;if(i.origin!=="null"&&e.origin!=="null"&&i.origin!==e.origin)return null}catch{return null}return a.parent}var Kvt=class{static getSameOriginWindowChain(i){let e=W3i.get(i);if(!e){e=[],W3i.set(i,e);let t=i,o;do o=j1o(t),o?e.push({window:new WeakRef(t),iframeElement:t.frameElement||null}):e.push({window:new WeakRef(t),iframeElement:null}),t=o;while(t)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(i,e){if(!e||i===e)return{top:0,left:0};let t=0,o=0,n=this.getSameOriginWindowChain(i);for(let r of n){let s=r.window.deref();if(t+=s?.scrollY??0,o+=s?.scrollX??0,s===e||!r.iframeElement)break;let l=r.iframeElement.getBoundingClientRect();t+=l.top,o+=l.left}return{top:t,left:o}}};async function Gvt(a,i){if(!crypto.subtle)throw new Error("'crypto.subtle' is not available so webviews will not work. This is likely because the editor is not running in a secure context (https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).");let e=JSON.stringify({parentOrigin:a,salt:i}),o=new TextEncoder().encode(e),n=await crypto.subtle.digest("sha-256",o);return Q1o(n)}function Q1o(a){let e=Array.from(new Uint8Array(a)).map(t=>t.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`).toString(32).padStart(52,"0")}var Ln=class{constructor(i,e){this.timestamp=Date.now(),this.browserEvent=e,this.leftButton=e.button===0,this.middleButton=e.button===1,this.rightButton=e.button===2,this.buttons=e.buttons,this.defaultPrevented=e.defaultPrevented,this.target=e.target,this.detail=e.detail||1,e.type==="dblclick"&&(this.detail=2),this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.posx=e.pageX,this.posy=e.pageY;let t=Kvt.getPositionOfChildWindowRelativeToAncestorWindow(i,e.view);this.posx-=t.left,this.posy-=t.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}};var nD=class{constructor(i,e=0,t=0){this.browserEvent=i||null,this.target=i?i.target||i.targetNode||i.srcElement:null,this.deltaY=t,this.deltaX=e;let o=!1;if(Iz){let n=navigator.userAgent.match(/Chrome\/(\d+)/);o=(n?parseInt(n[1]):123)<=122}if(i){let n=i,r=i,s=i.view?.devicePixelRatio||1;if(typeof n.wheelDeltaY<"u")o?this.deltaY=n.wheelDeltaY/(120*s):this.deltaY=n.wheelDeltaY/120;else if(typeof r.VERTICAL_AXIS<"u"&&r.axis===r.VERTICAL_AXIS)this.deltaY=-r.detail/3;else if(i.type==="wheel"){let l=i;l.deltaMode===l.DOM_DELTA_LINE?ed&&!et?this.deltaY=-i.deltaY/3:this.deltaY=-i.deltaY:this.deltaY=-i.deltaY/40}if(typeof n.wheelDeltaX<"u")_S&&ii?this.deltaX=-(n.wheelDeltaX/120):o?this.deltaX=n.wheelDeltaX/(120*s):this.deltaX=n.wheelDeltaX/120;else if(typeof r.HORIZONTAL_AXIS<"u"&&r.axis===r.HORIZONTAL_AXIS)this.deltaX=-i.detail/3;else if(i.type==="wheel"){let l=i;l.deltaMode===l.DOM_DELTA_LINE?ed&&!et?this.deltaX=-i.deltaX/3:this.deltaX=-i.deltaX:this.deltaX=-i.deltaX/40}this.deltaY===0&&this.deltaX===0&&i.wheelDelta&&(o?this.deltaY=i.wheelDelta/(120*s):this.deltaY=i.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}};var V3i=Object.freeze(function(a,i){let e=setTimeout(a.bind(i),0);return{dispose(){clearTimeout(e)}}}),Ie;(t=>{function a(o){return o===t.None||o===t.Cancelled||o instanceof awe?!0:!o||typeof o!="object"?!1:typeof o.isCancellationRequested=="boolean"&&typeof o.onCancellationRequested=="function"}t.isCancellationToken=a,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:U.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:V3i})})(Ie||={});var awe=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?V3i:(this._emitter||(this._emitter=new T),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},qe=class{constructor(i){this._token=void 0;this._parentListener=void 0;this._parentListener=i&&i.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new awe),this._token}cancel(){this._token?this._token instanceof awe&&this._token.cancel():this._token=Ie.Cancelled}dispose(i=!1){i&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof awe&&this._token.dispose():this._token=Ie.None}};function wz(a){let i=new qe;return a.add({dispose(){i.cancel()}}),i.token}var qvt=class{constructor(){this._source=new qe;this._listeners=new O;this._total=0;this._cancelled=0;this._isDone=!1}get token(){return this._source.token}add(i){if(this._isDone)return;if(this._total++,i.isCancellationRequested){this._cancelled++,this._check();return}let e=i.onCancellationRequested(()=>{e.dispose(),this._cancelled++,this._check()});this._listeners.add(e)}_check(){!this._isDone&&this._total>0&&this._total===this._cancelled&&(this._isDone=!0,this._listeners.dispose(),this._source.cancel())}dispose(){this._listeners.dispose(),this._source.dispose()}};var Y1o=65,X1o=97,J1o=90,Z1o=122,Dle=46,sx=47,yL=92,qj=58,ezo=63,$vt=class extends Error{constructor(i,e,t){let o;typeof e=="string"&&e.indexOf("not ")===0?(o="must not be",e=e.replace(/^not /,"")):o="must be";let n=i.indexOf(".")!==-1?"property":"argument",r=`The "${i}" ${n} ${o} of type ${e}`;r+=`. Received type ${typeof t}`,super(r),this.code="ERR_INVALID_ARG_TYPE"}};function tzo(a,i){if(a===null||typeof a!="object")throw new $vt(i,"Object",a)}function LS(a,i){if(typeof a!="string")throw new $vt(i,"string",a)}var wL=XO==="win32";function Id(a){return a===sx||a===yL}function Iii(a){return a===sx}function $j(a){return a>=Y1o&&a<=J1o||a>=X1o&&a<=Z1o}function jvt(a,i,e,t){let o="",n=0,r=-1,s=0,l=0;for(let c=0;c<=a.length;++c){if(c<a.length)l=a.charCodeAt(c);else{if(t(l))break;l=sx}if(t(l)){if(!(r===c-1||s===1))if(s===2){if(o.length<2||n!==2||o.charCodeAt(o.length-1)!==Dle||o.charCodeAt(o.length-2)!==Dle){if(o.length>2){let u=o.lastIndexOf(e);u===-1?(o="",n=0):(o=o.slice(0,u),n=o.length-1-o.lastIndexOf(e)),r=c,s=0;continue}else if(o.length!==0){o="",n=0,r=c,s=0;continue}}i&&(o+=o.length>0?`${e}..`:"..",n=2)}else o.length>0?o+=`${e}${a.slice(r+1,c)}`:o=a.slice(r+1,c),n=c-r-1;r=c,s=0}else l===Dle&&s!==-1?++s:s=-1}return o}function izo(a){return a?`${a[0]==="."?"":"."}${a}`:""}function B3i(a,i){tzo(i,"pathObject");let e=i.dir||i.root,t=i.base||`${i.name||""}${izo(i.ext)}`;return e?e===i.root?`${e}${t}`:`${e}${a}${t}`:t}var Gs={resolve(...a){let i="",e="",t=!1;for(let o=a.length-1;o>=-1;o--){let n;if(o>=0){if(n=a[o],LS(n,`paths[${o}]`),n.length===0)continue}else i.length===0?n=Ele():(n=Sp[`=${i}`]||Ele(),(n===void 0||n.slice(0,2).toLowerCase()!==i.toLowerCase()&&n.charCodeAt(2)===yL)&&(n=`${i}\\`));let r=n.length,s=0,l="",c=!1,u=n.charCodeAt(0);if(r===1)Id(u)&&(s=1,c=!0);else if(Id(u))if(c=!0,Id(n.charCodeAt(1))){let p=2,h=p;for(;p<r&&!Id(n.charCodeAt(p));)p++;if(p<r&&p!==h){let g=n.slice(h,p);for(h=p;p<r&&Id(n.charCodeAt(p));)p++;if(p<r&&p!==h){for(h=p;p<r&&!Id(n.charCodeAt(p));)p++;(p===r||p!==h)&&(l=`\\\\${g}\\${n.slice(h,p)}`,s=p)}}}else s=1;else $j(u)&&n.charCodeAt(1)===qj&&(l=n.slice(0,2),s=2,r>2&&Id(n.charCodeAt(2))&&(c=!0,s=3));if(l.length>0)if(i.length>0){if(l.toLowerCase()!==i.toLowerCase())continue}else i=l;if(t){if(i.length>0)break}else if(e=`${n.slice(s)}\\${e}`,t=c,c&&i.length>0)break}return e=jvt(e,!t,"\\",Id),t?`${i}\\${e}`:`${i}${e}`||"."},normalize(a){LS(a,"path");let i=a.length;if(i===0)return".";let e=0,t,o=!1,n=a.charCodeAt(0);if(i===1)return Iii(n)?"\\":a;if(Id(n))if(o=!0,Id(a.charCodeAt(1))){let s=2,l=s;for(;s<i&&!Id(a.charCodeAt(s));)s++;if(s<i&&s!==l){let c=a.slice(l,s);for(l=s;s<i&&Id(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&!Id(a.charCodeAt(s));)s++;if(s===i)return`\\\\${c}\\${a.slice(l)}\\`;s!==l&&(t=`\\\\${c}\\${a.slice(l,s)}`,e=s)}}}else e=1;else $j(n)&&a.charCodeAt(1)===qj&&(t=a.slice(0,2),e=2,i>2&&Id(a.charCodeAt(2))&&(o=!0,e=3));let r=e<i?jvt(a.slice(e),!o,"\\",Id):"";if(r.length===0&&!o&&(r="."),r.length>0&&Id(a.charCodeAt(i-1))&&(r+="\\"),!o&&t===void 0&&a.includes(":")){if(r.length>=2&&$j(r.charCodeAt(0))&&r.charCodeAt(1)===qj)return`.\\${r}`;let s=a.indexOf(":");do if(s===i-1||Id(a.charCodeAt(s+1)))return`.\\${r}`;while((s=a.indexOf(":",s+1))!==-1)}return t===void 0?o?`\\${r}`:r:o?`${t}\\${r}`:`${t}${r}`},isAbsolute(a){LS(a,"path");let i=a.length;if(i===0)return!1;let e=a.charCodeAt(0);return Id(e)||i>2&&$j(e)&&a.charCodeAt(1)===qj&&Id(a.charCodeAt(2))},join(...a){if(a.length===0)return".";let i,e;for(let n=0;n<a.length;++n){let r=a[n];LS(r,"path"),r.length>0&&(i===void 0?i=e=r:i+=`\\${r}`)}if(i===void 0)return".";let t=!0,o=0;if(typeof e=="string"&&Id(e.charCodeAt(0))){++o;let n=e.length;n>1&&Id(e.charCodeAt(1))&&(++o,n>2&&(Id(e.charCodeAt(2))?++o:t=!1))}if(t){for(;o<i.length&&Id(i.charCodeAt(o));)o++;o>=2&&(i=`\\${i.slice(o)}`)}return Gs.normalize(i)},relative(a,i){if(LS(a,"from"),LS(i,"to"),a===i)return"";let e=Gs.resolve(a),t=Gs.resolve(i);if(e===t||(a=e.toLowerCase(),i=t.toLowerCase(),a===i))return"";if(e.length!==a.length||t.length!==i.length){let f=e.split("\\"),v=t.split("\\");f[f.length-1]===""&&f.pop(),v[v.length-1]===""&&v.pop();let b=f.length,S=v.length,y=b<S?b:S,w;for(w=0;w<y&&f[w].toLowerCase()===v[w].toLowerCase();w++);return w===0?t:w===y?S>y?v.slice(w).join("\\"):b>y?"..\\".repeat(b-1-w)+"..":"":"..\\".repeat(b-w)+v.slice(w).join("\\")}let o=0;for(;o<a.length&&a.charCodeAt(o)===yL;)o++;let n=a.length;for(;n-1>o&&a.charCodeAt(n-1)===yL;)n--;let r=n-o,s=0;for(;s<i.length&&i.charCodeAt(s)===yL;)s++;let l=i.length;for(;l-1>s&&i.charCodeAt(l-1)===yL;)l--;let c=l-s,u=r<c?r:c,p=-1,h=0;for(;h<u;h++){let f=a.charCodeAt(o+h);if(f!==i.charCodeAt(s+h))break;f===yL&&(p=h)}if(h!==u){if(p===-1)return t}else{if(c>u){if(i.charCodeAt(s+h)===yL)return t.slice(s+h+1);if(h===2)return t.slice(s+h)}r>u&&(a.charCodeAt(o+h)===yL?p=h:h===2&&(p=3)),p===-1&&(p=0)}let g="";for(h=o+p+1;h<=n;++h)(h===n||a.charCodeAt(h)===yL)&&(g+=g.length===0?"..":"\\..");return s+=p,g.length>0?`${g}${t.slice(s,l)}`:(t.charCodeAt(s)===yL&&++s,t.slice(s,l))},toNamespacedPath(a){if(typeof a!="string"||a.length===0)return a;let i=Gs.resolve(a);if(i.length<=2)return a;if(i.charCodeAt(0)===yL){if(i.charCodeAt(1)===yL){let e=i.charCodeAt(2);if(e!==ezo&&e!==Dle)return`\\\\?\\UNC\\${i.slice(2)}`}}else if($j(i.charCodeAt(0))&&i.charCodeAt(1)===qj&&i.charCodeAt(2)===yL)return`\\\\?\\${i}`;return i},dirname(a){LS(a,"path");let i=a.length;if(i===0)return".";let e=-1,t=0,o=a.charCodeAt(0);if(i===1)return Id(o)?a:".";if(Id(o)){if(e=t=1,Id(a.charCodeAt(1))){let s=2,l=s;for(;s<i&&!Id(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&Id(a.charCodeAt(s));)s++;if(s<i&&s!==l){for(l=s;s<i&&!Id(a.charCodeAt(s));)s++;if(s===i)return a;s!==l&&(e=t=s+1)}}}}else $j(o)&&a.charCodeAt(1)===qj&&(e=i>2&&Id(a.charCodeAt(2))?3:2,t=e);let n=-1,r=!0;for(let s=i-1;s>=t;--s)if(Id(a.charCodeAt(s))){if(!r){n=s;break}}else r=!1;if(n===-1){if(e===-1)return".";n=e}return a.slice(0,n)},basename(a,i){i!==void 0&&LS(i,"suffix"),LS(a,"path");let e=0,t=-1,o=!0,n;if(a.length>=2&&$j(a.charCodeAt(0))&&a.charCodeAt(1)===qj&&(e=2),i!==void 0&&i.length>0&&i.length<=a.length){if(i===a)return"";let r=i.length-1,s=-1;for(n=a.length-1;n>=e;--n){let l=a.charCodeAt(n);if(Id(l)){if(!o){e=n+1;break}}else s===-1&&(o=!1,s=n+1),r>=0&&(l===i.charCodeAt(r)?--r===-1&&(t=n):(r=-1,t=s))}return e===t?t=s:t===-1&&(t=a.length),a.slice(e,t)}for(n=a.length-1;n>=e;--n)if(Id(a.charCodeAt(n))){if(!o){e=n+1;break}}else t===-1&&(o=!1,t=n+1);return t===-1?"":a.slice(e,t)},extname(a){LS(a,"path");let i=0,e=-1,t=0,o=-1,n=!0,r=0;a.length>=2&&a.charCodeAt(1)===qj&&$j(a.charCodeAt(0))&&(i=t=2);for(let s=a.length-1;s>=i;--s){let l=a.charCodeAt(s);if(Id(l)){if(!n){t=s+1;break}continue}o===-1&&(n=!1,o=s+1),l===Dle?e===-1?e=s:r!==1&&(r=1):e!==-1&&(r=-1)}return e===-1||o===-1||r===0||r===1&&e===o-1&&e===t+1?"":a.slice(e,o)},format:B3i.bind(null,"\\"),parse(a){LS(a,"path");let i={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return i;let e=a.length,t=0,o=a.charCodeAt(0);if(e===1)return Id(o)?(i.root=i.dir=a,i):(i.base=i.name=a,i);if(Id(o)){if(t=1,Id(a.charCodeAt(1))){let p=2,h=p;for(;p<e&&!Id(a.charCodeAt(p));)p++;if(p<e&&p!==h){for(h=p;p<e&&Id(a.charCodeAt(p));)p++;if(p<e&&p!==h){for(h=p;p<e&&!Id(a.charCodeAt(p));)p++;p===e?t=p:p!==h&&(t=p+1)}}}}else if($j(o)&&a.charCodeAt(1)===qj){if(e<=2)return i.root=i.dir=a,i;if(t=2,Id(a.charCodeAt(2))){if(e===3)return i.root=i.dir=a,i;t=3}}t>0&&(i.root=a.slice(0,t));let n=-1,r=t,s=-1,l=!0,c=a.length-1,u=0;for(;c>=t;--c){if(o=a.charCodeAt(c),Id(o)){if(!l){r=c+1;break}continue}s===-1&&(l=!1,s=c+1),o===Dle?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return s!==-1&&(n===-1||u===0||u===1&&n===s-1&&n===r+1?i.base=i.name=a.slice(r,s):(i.name=a.slice(r,n),i.base=a.slice(r,s),i.ext=a.slice(n,s))),r>0&&r!==t?i.dir=a.slice(0,r-1):i.dir=i.root,i},sep:"\\",delimiter:";",win32:null,posix:null},ozo=(()=>{if(wL){let a=/\\/g;return()=>{let i=Ele().replace(a,"/");return i.slice(i.indexOf("/"))}}return()=>Ele()})(),Vo={resolve(...a){let i="",e=!1;for(let t=a.length-1;t>=0&&!e;t--){let o=a[t];LS(o,`paths[${t}]`),o.length!==0&&(i=`${o}/${i}`,e=o.charCodeAt(0)===sx)}if(!e){let t=ozo();i=`${t}/${i}`,e=t.charCodeAt(0)===sx}return i=jvt(i,!e,"/",Iii),e?`/${i}`:i.length>0?i:"."},normalize(a){if(LS(a,"path"),a.length===0)return".";let i=a.charCodeAt(0)===sx,e=a.charCodeAt(a.length-1)===sx;return a=jvt(a,!i,"/",Iii),a.length===0?i?"/":e?"./":".":(e&&(a+="/"),i?`/${a}`:a)},isAbsolute(a){return LS(a,"path"),a.length>0&&a.charCodeAt(0)===sx},join(...a){if(a.length===0)return".";let i=[];for(let e=0;e<a.length;++e){let t=a[e];LS(t,"path"),t.length>0&&i.push(t)}return i.length===0?".":Vo.normalize(i.join("/"))},relative(a,i){if(LS(a,"from"),LS(i,"to"),a===i||(a=Vo.resolve(a),i=Vo.resolve(i),a===i))return"";let e=1,t=a.length,o=t-e,n=1,r=i.length-n,s=o<r?o:r,l=-1,c=0;for(;c<s;c++){let p=a.charCodeAt(e+c);if(p!==i.charCodeAt(n+c))break;p===sx&&(l=c)}if(c===s)if(r>s){if(i.charCodeAt(n+c)===sx)return i.slice(n+c+1);if(c===0)return i.slice(n+c)}else o>s&&(a.charCodeAt(e+c)===sx?l=c:c===0&&(l=0));let u="";for(c=e+l+1;c<=t;++c)(c===t||a.charCodeAt(c)===sx)&&(u+=u.length===0?"..":"/..");return`${u}${i.slice(n+l)}`},toNamespacedPath(a){return a},dirname(a){if(LS(a,"path"),a.length===0)return".";let i=a.charCodeAt(0)===sx,e=-1,t=!0;for(let o=a.length-1;o>=1;--o)if(a.charCodeAt(o)===sx){if(!t){e=o;break}}else t=!1;return e===-1?i?"/":".":i&&e===1?"//":a.slice(0,e)},basename(a,i){i!==void 0&&LS(i,"suffix"),LS(a,"path");let e=0,t=-1,o=!0,n;if(i!==void 0&&i.length>0&&i.length<=a.length){if(i===a)return"";let r=i.length-1,s=-1;for(n=a.length-1;n>=0;--n){let l=a.charCodeAt(n);if(l===sx){if(!o){e=n+1;break}}else s===-1&&(o=!1,s=n+1),r>=0&&(l===i.charCodeAt(r)?--r===-1&&(t=n):(r=-1,t=s))}return e===t?t=s:t===-1&&(t=a.length),a.slice(e,t)}for(n=a.length-1;n>=0;--n)if(a.charCodeAt(n)===sx){if(!o){e=n+1;break}}else t===-1&&(o=!1,t=n+1);return t===-1?"":a.slice(e,t)},extname(a){LS(a,"path");let i=-1,e=0,t=-1,o=!0,n=0;for(let r=a.length-1;r>=0;--r){let s=a[r];if(s==="/"){if(!o){e=r+1;break}continue}t===-1&&(o=!1,t=r+1),s==="."?i===-1?i=r:n!==1&&(n=1):i!==-1&&(n=-1)}return i===-1||t===-1||n===0||n===1&&i===t-1&&i===e+1?"":a.slice(i,t)},format:B3i.bind(null,"/"),parse(a){LS(a,"path");let i={root:"",dir:"",base:"",ext:"",name:""};if(a.length===0)return i;let e=a.charCodeAt(0)===sx,t;e?(i.root="/",t=1):t=0;let o=-1,n=0,r=-1,s=!0,l=a.length-1,c=0;for(;l>=t;--l){let u=a.charCodeAt(l);if(u===sx){if(!s){n=l+1;break}continue}r===-1&&(s=!1,r=l+1),u===Dle?o===-1?o=l:c!==1&&(c=1):o!==-1&&(c=-1)}if(r!==-1){let u=n===0&&e?1:n;o===-1||c===0||c===1&&o===r-1&&o===n+1?i.base=i.name=a.slice(u,r):(i.name=a.slice(u,o),i.base=a.slice(u,r),i.ext=a.slice(o,r))}return n>0?i.dir=a.slice(0,n-1):e&&(i.dir="/"),i},sep:"/",delimiter:":",win32:null,posix:null};Vo.win32=Gs.win32=Gs;Vo.posix=Gs.posix=Vo;var Vh=wL?Gs.normalize:Vo.normalize,Jl=wL?Gs.isAbsolute:Vo.isAbsolute,td=wL?Gs.join:Vo.join,uA=wL?Gs.resolve:Vo.resolve,pA=wL?Gs.relative:Vo.relative,yd=wL?Gs.dirname:Vo.dirname,Jo=wL?Gs.basename:Vo.basename,km=wL?Gs.extname:Vo.extname,COn=wL?Gs.format:Vo.format,jj=wL?Gs.parse:Vo.parse,xOn=wL?Gs.toNamespacedPath:Vo.toNamespacedPath,Cu=wL?Gs.sep:Vo.sep,kOn=wL?Gs.delimiter:Vo.delimiter;var pB=class{constructor(i){this.task=i;this.result=null}get(){if(this.result)return this.result;let i=new qe,e=this.task(i.token);return this.result={promise:e,dispose:()=>{this.result=null,i.cancel(),i.dispose()}},this.result}};function yii(a){return a}var lY=class{constructor(i,e){this.lastCache=void 0;this.lastArgKey=void 0;typeof i=="function"?(this._fn=i,this._computeKey=yii):(this._fn=e,this._computeKey=i.getCacheKey)}get(i){let e=this._computeKey(i);return this.lastArgKey!==e&&(this.lastArgKey=e,this.lastCache=this._fn(i)),this.lastCache}},xy=class{constructor(i,e){this._map=new Map;this._map2=new Map;typeof i=="function"?(this._fn=i,this._computeKey=yii):(this._fn=e,this._computeKey=i.getCacheKey)}get cachedValues(){return this._map}get(i){let e=this._computeKey(i);if(this._map2.has(e))return this._map2.get(e);let t=this._fn(i);return this._map.set(i,t),this._map2.set(e,t),t}},Qvt=class{constructor(i,e){this._map=new WeakMap;typeof i=="function"?(this._fn=i,this._computeKey=yii):(this._fn=e,this._computeKey=i.getCacheKey)}get(i){let e=this._computeKey(i);if(this._map.has(e))return this._map.get(e);let t=this._fn(i);return this._map.set(e,t),t}};var uo=class{constructor(i){this.executor=i;this._state=0}get hasValue(){return this._state===2}get value(){if(this._state===0){this._state=1;try{this._value=this.executor()}catch(i){this._error=i}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 Rle(a){return a<0?0:a>255?255:a|0}function Lle(a){return a<0?0:a>4294967295?4294967295:a|0}function _c(a){return!a||typeof a!="string"?!0:a.trim().length===0}var nzo=/{(\d+)}/g;function Wd(a,...i){return i.length===0?a:a.replace(nzo,function(e,t){let o=parseInt(t,10);return isNaN(o)||o<0||o>=i.length?e:i[o]})}var rzo=/{([^}]+)}/g;function rD(a,i){return Object.keys(i).length===0?a:a.replace(rzo,(e,t)=>i[t]??e)}function Xvt(a){return a.replace(/[<>"'&]/g,i=>{switch(i){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;"}return i})}function Cr(a){return a.replace(/[<>&]/g,function(i){switch(i){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return i}})}function Ss(a){return a.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function rT(a,i){let e=0,t=a.indexOf(i);for(;t!==-1;)e++,t=a.indexOf(i,t+i.length);return e}function tF(a,i,e=Z3i){return a.length<=i?a:`${a.substr(0,i)}${e}`}function Cii(a,i,e=Z3i){if(a.length<=i)return a;let t=Math.ceil(i/2)-e.length/2,o=Math.floor(i/2)-e.length/2;return`${a.substr(0,t)}${e}${a.substr(a.length-o)}`}function CL(a,i=" "){let e=ax(a,i);return Bh(e,i)}function ax(a,i){if(!a||!i)return a;let e=i.length,t=0;if(e===1){let o=i.charCodeAt(0);for(;t<a.length&&a.charCodeAt(t)===o;)t++}else for(;a.startsWith(i,t);)t+=e;return a.substring(t)}function Bh(a,i){if(!a||!i)return a;let e=i.length,t=a.length;if(e===1){let n=t,r=i.charCodeAt(0);for(;n>0&&a.charCodeAt(n-1)===r;)n--;return a.substring(0,n)}let o=t;for(;o>0&&a.endsWith(i,o);)o-=e;return a.substring(0,o)}function U3i(a){return a.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function Yj(a,i,e={}){if(!a)throw new Error("Cannot create regex from empty string");i||(a=Ss(a)),e.wholeWord&&(/\B/.test(a.charAt(0))||(a="\\b"+a),/\B/.test(a.charAt(a.length-1))||(a=a+"\\b"));let t="";return e.global&&(t+="g"),e.matchCase||(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),new RegExp(a,t)}function lwe(a){return a.source==="^"||a.source==="^$"||a.source==="$"||a.source==="^\\s*$"?!1:!!(a.exec("")&&a.lastIndex===0)}function z3i(a,i){return a.filter(e=>e!=null&&e!==!1).join(i)}function Hc(a){return a.split(/\r\n|\r|\n/)}function K3i(a){let i=[],e=a.split(/(\r\n|\r|\n)/);for(let t=0;t<Math.ceil(e.length/2);t++)i.push(e[2*t]+(e[2*t+1]??""));return i}function Em(a){for(let i=0,e=a.length;i<e;i++){let t=a.charCodeAt(i);if(t!==32&&t!==9)return i}return-1}function Ul(a,i=0,e=a.length){for(let t=i;t<e;t++){let o=a.charCodeAt(t);if(o!==32&&o!==9)return a.substring(i,t)}return a.substring(i,e)}function Bv(a,i=a.length-1){for(let e=i;e>=0;e--){let t=a.charCodeAt(e);if(t!==32&&t!==9)return e}return-1}function oc(a,i){return a<i?-1:a>i?1:0}function cwe(a,i,e=0,t=a.length,o=0,n=i.length){for(;e<t&&o<n;e++,o++){let l=a.charCodeAt(e),c=i.charCodeAt(o);if(l<c)return-1;if(l>c)return 1}let r=t-e,s=n-o;return r<s?-1:r>s?1:0}function MS(a,i){return Ple(a,i,0,a.length,0,i.length)}function Ple(a,i,e=0,t=a.length,o=0,n=i.length){for(;e<t&&o<n;e++,o++){let l=a.charCodeAt(e),c=i.charCodeAt(o);if(l===c)continue;if(l>=128||c>=128)return cwe(a.toLowerCase(),i.toLowerCase(),e,t,o,n);Cz(l)&&(l-=32),Cz(c)&&(c-=32);let u=l-c;if(u!==0)return u}let r=t-e,s=n-o;return r<s?-1:r>s?1:0}function l4e(a){return a>=48&&a<=57}function Cz(a){return a>=97&&a<=122}function sT(a){return a>=65&&a<=90}function xr(a,i){return a.length===i.length&&Ple(a,i)===0}function G3i(a,i,e){return a===i||!!e&&a!==void 0&&i!==void 0&&xr(a,i)}function aT(a,i){let e=i.length;return e<=a.length&&Ple(a,i,0,e)===0}function Jvt(a,i){let e=a.length,t=e-i.length;return t>=0&&Ple(a,i,t,e)===0}function Af(a,i){let e=Math.min(a.length,i.length),t;for(t=0;t<e;t++)if(a.charCodeAt(t)!==i.charCodeAt(t))return t;return e}function lx(a,i){let e=Math.min(a.length,i.length),t,o=a.length-1,n=i.length-1;for(t=0;t<e;t++)if(a.charCodeAt(o-t)!==i.charCodeAt(n-t))return t;return e}function Ip(a){return 55296<=a&&a<=56319}function iF(a){return 56320<=a&&a<=57343}function Zvt(a,i){return(a-55296<<10)+(i-56320)+65536}function dwe(a,i,e){let t=a.charCodeAt(e);if(Ip(t)&&e+1<i){let o=a.charCodeAt(e+1);if(iF(o))return Zvt(t,o)}return t}function szo(a,i){let e=a.charCodeAt(i-1);if(iF(e)&&i>1){let t=a.charCodeAt(i-2);if(Ip(t))return Zvt(t,e)}return e}var Mle=class{get offset(){return this._offset}constructor(i,e=0){this._str=i,this._len=i.length,this._offset=e}setOffset(i){this._offset=i}prevCodePoint(){let i=szo(this._str,this._offset);return this._offset-=i>=65536?2:1,i}nextCodePoint(){let i=dwe(this._str,this._len,this._offset);return this._offset+=i>=65536?2:1,i}eol(){return this._offset>=this._len}},Qj=class{get offset(){return this._iterator.offset}constructor(i,e=0){this._iterator=new Mle(i,e)}nextGraphemeLength(){let i=Yvt.getInstance(),e=this._iterator,t=e.offset,o=i.getGraphemeBreakType(e.nextCodePoint());for(;!e.eol();){let n=e.offset,r=i.getGraphemeBreakType(e.nextCodePoint());if(H3i(o,r)){e.setOffset(n);break}o=r}return e.offset-t}prevGraphemeLength(){let i=Yvt.getInstance(),e=this._iterator,t=e.offset,o=i.getGraphemeBreakType(e.prevCodePoint());for(;e.offset>0;){let n=e.offset,r=i.getGraphemeBreakType(e.prevCodePoint());if(H3i(r,o)){e.setOffset(n);break}o=r}return t-e.offset}eol(){return this._iterator.eol()}};function uwe(a,i){return new Qj(a,i).nextGraphemeLength()}function xii(a,i){return new Qj(a,i).prevGraphemeLength()}function ebt(a,i){i>0&&iF(a.charCodeAt(i))&&i--;let e=i+uwe(a,i);return[e-xii(a,e),e]}var wii;function azo(){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 mA(a){return wii||(wii=azo()),wii.test(a)}var lzo=/^[\t\n\r\x20-\x7E]*$/;function xz(a){return lzo.test(a)}var kii=/[\u2028\u2029]/;function tbt(a){return kii.test(a)}function sD(a){return a>=11904&&a<=55215||a>=63744&&a<=64255||a>=65281&&a<=65374||a>=65504&&a<=65510}function c4e(a){return a>=127462&&a<=127487||a===8986||a===8987||a===9200||a===9203||a>=9728&&a<=10175||a===11088||a===11093||a>=127744&&a<=128591||a>=128640&&a<=128764||a>=128992&&a<=129008||a>=129280&&a<=129535||a>=129648&&a<=129782}function q3i(a,i,e=""){let t=a.trimStart();if(t.length<i)return t;let o=/\b/g,n=0;for(;o.test(t)&&!(t.length-o.lastIndex<i);)n=o.lastIndex,o.lastIndex+=1;return n===0?t:e+t.substring(n).trimStart()}function ibt(a,i,e=""){let t=a.trimEnd();if(t.length<=i)return t;let o=/\b/g,n=0,r=!1;for(;o.test(t);){if(o.lastIndex>i){r=!0;break}n=o.lastIndex,o.lastIndex+=1}if(!r)return t;if(n===0)return e;let s=t.substring(0,n).trimEnd();return s.length<n/2?t:s+e}var czo=/(?:\x1b\[|\x9b)[=?>!]?[\d;:]*["$#'* ]?[a-zA-Z@^`{}|~]/,dzo=/(?:\x1b\]|\x9d).*?(?:\x1b\\|\x07|\x9c)/,uzo=/\x1b(?:[ #%\(\)\*\+\-\.\/]?[a-zA-Z0-9\|}~@])/,$3i=new RegExp("(?:"+[czo.source,dzo.source,uzo.source].join("|")+")","g");function*j3i(a){let i=0;for(let e of a.matchAll($3i))i!==e.index&&(yield{isCode:!1,str:a.substring(i,e.index)}),yield{isCode:!0,str:e[0]},i=e.index+e[0].length;i!==a.length&&(yield{isCode:!1,str:a.substring(i)})}function Hv(a){return a&&(a=a.replace($3i,"")),a}var pzo=/\\\[.*?\\\]/g;function Q3i(a){return Hv(a).replace(pzo,"")}var Y3i=String.fromCharCode(65279);function obt(a){return!!(a&&a.length>0&&a.charCodeAt(0)===65279)}function d4e(a,i){if(!a||!i||a.length<i.length)return!1;let e=i.length,t=a.toLowerCase(),o=0,n=-1;for(;o<e;){let r=t.indexOf(i[o],n+1);if(r<0)return!1;n=r,o++}return!0}function u4e(a,i=!1){return a?(i&&(a=a.replace(/\\./g,"")),a.toLowerCase()!==a):!1}function Ale(a){return a.charAt(0).toUpperCase()+a.slice(1)}function X3i(a,i=1){if(i===0)return"";let e=-1;do e=a.indexOf(`
`,e+1),i--;while(i>0&&e>=0);return e===-1?a:(a[e-1]==="\r"&&e--,a.substr(0,e))}function pwe(a){let i=26;return a=a%(2*i),a<i?String.fromCharCode(97+a):String.fromCharCode(65+a-i)}function H3i(a,i){return a===0?i!==5&&i!==7:a===2&&i===3?!1:a===4||a===2||a===3||i===4||i===2||i===3?!0:!(a===8&&(i===8||i===9||i===11||i===12)||(a===11||a===9)&&(i===9||i===10)||(a===12||a===10)&&i===10||i===5||i===13||i===7||a===1||a===13&&i===14||a===6&&i===6)}var Yvt=class a{static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this._data=mzo()}getGraphemeBreakType(i){if(i<32)return i===10?3:i===13?2:4;if(i<127)return 0;let e=this._data,t=e.length/3,o=1;for(;o<=t;)if(i<e[3*o])o=2*o;else if(i>e[3*o+1])o=2*o+1;else return e[3*o+2];return 0}};function mzo(){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]")}function J3i(a,i){if(a===0)return 0;let e=hzo(a,i);if(e!==void 0)return e;let t=new Mle(i,a);return t.prevCodePoint(),t.offset}function hzo(a,i){let e=new Mle(i,a),t=e.prevCodePoint();for(;gzo(t)||t===65039||t===8419;){if(e.offset===0)return;t=e.prevCodePoint()}if(!c4e(t))return;let o=e.offset;return o>0&&e.prevCodePoint()===8205&&(o=e.offset),o}function gzo(a){return 127995<=a&&a<=127999}var oF="\xA0",cY=class a{constructor(i){this.confusableDictionary=i}static{this.ambiguousCharacterData=new uo(()=>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 lY(i=>{let e=i.split(",");function t(p){let h=new Map;for(let g=0;g<p.length;g+=2)h.set(p[g],p[g+1]);return h}function o(p,h){let g=new Map(p);for(let[f,v]of h)g.set(f,v);return g}function n(p,h){if(!p)return h;let g=new Map;for(let[f,v]of p)h.has(f)&&g.set(f,v);return g}let r=this.ambiguousCharacterData.value,s=e.filter(p=>!p.startsWith("_")&&Object.hasOwn(r,p));s.length===0&&(s=["_default"]);let l;for(let p of s){let h=t(r[p]);l=n(l,h)}let c=t(r._common),u=o(c,l);return new a(u)})}static getInstance(i){return a.cache.get(Array.from(i).join(","))}static{this._locales=new uo(()=>Object.keys(a.ambiguousCharacterData.value).filter(i=>!i.startsWith("_")))}static getLocales(){return a._locales.value}isAmbiguous(i){return this.confusableDictionary.has(i)}containsAmbiguousCharacter(i){for(let e=0;e<i.length;e++){let t=i.codePointAt(e);if(typeof t=="number"&&this.isAmbiguous(t))return!0}return!1}getPrimaryConfusable(i){return this.confusableDictionary.get(i)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}},mB=class a{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(a.getRawData())].flat())),this._data}static isInvisibleCharacter(i){return a.getData().has(i)}static containsInvisibleCharacter(i){for(let e=0;e<i.length;e++){let t=i.codePointAt(e);if(typeof t=="number"&&(a.isInvisibleCharacter(t)||t===32))return!0}return!1}static get codePoints(){return a.getData()}},Z3i="\u2026";function fzo(a){let i=new Uint16Array(a.length);for(let o=0;o<i.length;o++)i[o]=a.charCodeAt(o);let e="",t=new Uint8Array(i.buffer);for(let o=0;o<t.length;o++)e+=String.fromCharCode(t[o]);return e}function dY(a){return btoa(fzo(a))}function uY(a){return a===47||a===92}function kz(a){return a.replace(/[\\/]/g,Vo.sep)}function e8i(a){return a.indexOf("/")===-1&&(a=kz(a)),/^[a-zA-Z]:(\/|$)/.test(a)&&(a="/"+a),a}function Eii(a,i=Vo.sep){if(!a)return"";let e=a.length,t=a.charCodeAt(0);if(uY(t)){if(uY(a.charCodeAt(1))&&!uY(a.charCodeAt(2))){let n=3,r=n;for(;n<e&&!uY(a.charCodeAt(n));n++);if(r!==n&&!uY(a.charCodeAt(n+1))){for(n+=1;n<e;n++)if(uY(a.charCodeAt(n)))return a.slice(0,n+1).replace(/[\\/]/g,i)}}return i}else if(i8i(t)&&a.charCodeAt(1)===58)return uY(a.charCodeAt(2))?a.slice(0,2)+i:a.slice(0,2);let o=a.indexOf("://");if(o!==-1){for(o+=3;o<e;o++)if(uY(a.charCodeAt(o)))return a.slice(0,o+1)}return""}function Xj(a){if(!ii||!a||a.length<5)return!1;let i=a.charCodeAt(0);if(i!==92||(i=a.charCodeAt(1),i!==92))return!1;let e=2,t=e;for(;e<a.length&&(i=a.charCodeAt(e),i!==92);e++);return!(t===e||(i=a.charCodeAt(e+1),isNaN(i)||i===92))}var vzo=/[\\/:\*\?"<>\|]/g,bzo=/[/]/g,Szo=/^(con|prn|aux|clock\$|nul|lpt[0-9]|com[0-9])(\.(.*?))?$/i;function Ez(a,i=ii){let e=i?vzo:bzo;return!(!a||a.length===0||/^\s+$/.test(a)||(e.lastIndex=0,e.test(a))||i&&Szo.test(a)||a==="."||a===".."||i&&a[a.length-1]==="."||i&&a.length!==a.trim().length||a.length>255)}function t8i(a,i,e){let t=a===i;return!e||t?t:!a||!i?!1:xr(a,i)}function Nle(a,i,e,t=Cu){if(a===i)return!0;if(!a||!i||i.length>a.length)return!1;if(e){if(!aT(a,i))return!1;if(i.length===a.length)return!0;let n=i.length;return i.charAt(i.length-1)===t&&n--,a.charAt(n)===t}return i.charAt(i.length-1)!==t&&(i+=t),a.indexOf(i)===0}function i8i(a){return a>=65&&a<=90||a>=97&&a<=122}function o8i(a){return ii?(a=Bh(a,Cu),a.endsWith(":")&&(a+=Cu)):(a=Bh(a,Cu),a||(a=Cu)),a}function pY(a,i=ii){return i?i8i(a.charCodeAt(0))&&a.charCodeAt(1)===58:!1}function n8i(a,i=ii){return pY(a,i)?a[0]:void 0}function mwe(a,i,e){return i.length>a.length?-1:a===i?0:(e&&(a=a.toLowerCase(),i=i.toLowerCase()),a.indexOf(i))}function r8i(a){let i=a.split(":"),e,t,o;for(let n of i){let r=Number(n);on(r)?t===void 0?t=r:o===void 0&&(o=r):e=e?[e,n].join(":"):n}if(!e)throw new Error("Format for `--goto` should be: `FILE:LINE(:COLUMN)`");return{path:e,line:t!==void 0?t:void 0,column:o!==void 0?o:t!==void 0?1:void 0}}var Izo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",yzo="BDEFGHIJKMOQRSTUVWXYZbdefghijkmoqrstuvwxyz0123456789";function hwe(a,i,e=8){let t="";for(let n=0;n<e;n++){let r;n===0&&ii&&!i&&(e===3||e===4)?r=yzo:r=Izo,t+=r.charAt(Math.floor(Math.random()*r.length))}let o;return i?o=`${i}-${t}`:o=t,a?td(a,o):o}var wzo=/^\w[\w\d+.-]*$/,Czo=/^\//,xzo=/^\/\//;function kzo(a,i){if(!a.scheme&&i)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${a.authority}", path: "${a.path}", query: "${a.query}", fragment: "${a.fragment}"}`);if(a.scheme&&!wzo.test(a.scheme)){let e=[...a.scheme.matchAll(/[^\w\d+.-]/gu)],t=e.length>0?` Found '${e[0][0]}' at index ${e[0].index} (${e.length} total)`:"";throw new Error(`[UriError]: Scheme contains illegal characters.${t} (len:${a.scheme.length})`)}if(a.path){if(a.authority){if(!Czo.test(a.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(xzo.test(a.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function Ezo(a,i){return!a&&!i?"file":a}function Tzo(a,i){switch(a){case"https":case"http":case"file":i?i[0]!==hB&&(i=hB+i):i=hB;break}return i}var nf="",hB="/",_zo=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,A=class a{static isUri(i){return i instanceof a?!0:!i||typeof i!="object"?!1:typeof i.authority=="string"&&typeof i.fragment=="string"&&typeof i.path=="string"&&typeof i.query=="string"&&typeof i.scheme=="string"&&typeof i.fsPath=="string"&&typeof i.with=="function"&&typeof i.toString=="function"}constructor(i,e,t,o,n,r=!1){typeof i=="object"?(this.scheme=i.scheme||nf,this.authority=i.authority||nf,this.path=i.path||nf,this.query=i.query||nf,this.fragment=i.fragment||nf):(this.scheme=Ezo(i,r),this.authority=e||nf,this.path=Tzo(this.scheme,t||nf),this.query=o||nf,this.fragment=n||nf,kzo(this,r))}get fsPath(){return Ole(this,!1)}with(i){if(!i)return this;let{scheme:e,authority:t,path:o,query:n,fragment:r}=i;return e===void 0?e=this.scheme:e===null&&(e=nf),t===void 0?t=this.authority:t===null&&(t=nf),o===void 0?o=this.path:o===null&&(o=nf),n===void 0?n=this.query:n===null&&(n=nf),r===void 0?r=this.fragment:r===null&&(r=nf),e===this.scheme&&t===this.authority&&o===this.path&&n===this.query&&r===this.fragment?this:new mY(e,t,o,n,r)}static parse(i,e=!1){let t=_zo.exec(i);return t?new mY(t[2]||nf,nbt(t[4]||nf),nbt(t[5]||nf),nbt(t[7]||nf),nbt(t[9]||nf),e):new mY(nf,nf,nf,nf,nf)}static file(i){let e=nf;if(ii&&(i=i.replace(/\\/g,hB)),i[0]===hB&&i[1]===hB){let t=i.indexOf(hB,2);t===-1?(e=i.substring(2),i=hB):(e=i.substring(2,t),i=i.substring(t)||hB)}return new mY("file",e,i,nf,nf)}static from(i,e){return new mY(i.scheme,i.authority,i.path,i.query,i.fragment,e)}static joinPath(i,...e){if(!i.path)throw new Error(`[UriError]: cannot call joinPath on URI without path: ${i.toString()}`);let t;return ii&&i.scheme==="file"?t=a.file(Gs.join(Ole(i,!0),...e)).path:t=Vo.join(i.path,...e),i.with({path:t})}toString(i=!1){return Tii(this,i)}toJSON(){return this}static revive(i){if(i){if(i instanceof a)return i;{let e=new mY(i);return e._formatted=i.external??null,e._fsPath=i._sep===c8i?i.fsPath??null:null,e}}else return i}[Symbol.for("debug.description")](){return`URI(${this.toString()})`}};function jm(a){return!a||typeof a!="object"?!1:typeof a.scheme=="string"&&(typeof a.authority=="string"||typeof a.authority>"u")&&(typeof a.path=="string"||typeof a.path>"u")&&(typeof a.query=="string"||typeof a.query>"u")&&(typeof a.fragment=="string"||typeof a.fragment>"u")}var c8i=ii?1:void 0,mY=class extends A{constructor(){super(...arguments);this._formatted=null;this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=Ole(this,!1)),this._fsPath}toString(e=!1){return e?Tii(this,!0):(this._formatted||(this._formatted=Tii(this,!1)),this._formatted)}toJSON(){let e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=c8i),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}},d8i={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 a8i(a,i,e){let t,o=-1;for(let n=0;n<a.length;n++){let r=a.charCodeAt(n);if(r>=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57||r===45||r===46||r===95||r===126||i&&r===47||e&&r===91||e&&r===93||e&&r===58)o!==-1&&(t+=encodeURIComponent(a.substring(o,n)),o=-1),t!==void 0&&(t+=a.charAt(n));else{t===void 0&&(t=a.substr(0,n));let s=d8i[r];s!==void 0?(o!==-1&&(t+=encodeURIComponent(a.substring(o,n)),o=-1),t+=s):o===-1&&(o=n)}}return o!==-1&&(t+=encodeURIComponent(a.substring(o))),t!==void 0?t:a}function Dzo(a){let i;for(let e=0;e<a.length;e++){let t=a.charCodeAt(e);t===35||t===63?(i===void 0&&(i=a.substr(0,e)),i+=d8i[t]):i!==void 0&&(i+=a[e])}return i!==void 0?i:a}function Ole(a,i){let e;return a.authority&&a.path.length>1&&a.scheme==="file"?e=`//${a.authority}${a.path}`:a.path.charCodeAt(0)===47&&(a.path.charCodeAt(1)>=65&&a.path.charCodeAt(1)<=90||a.path.charCodeAt(1)>=97&&a.path.charCodeAt(1)<=122)&&a.path.charCodeAt(2)===58?i?e=a.path.substr(1):e=a.path[1].toLowerCase()+a.path.substr(2):e=a.path,ii&&(e=e.replace(/\//g,"\\")),e}function Tii(a,i){let e=i?Dzo:a8i,t="",{scheme:o,authority:n,path:r,query:s,fragment:l}=a;if(o&&(t+=o,t+=":"),(n||o==="file")&&(t+=hB,t+=hB),n){let c=n.indexOf("@");if(c!==-1){let u=n.substr(0,c);n=n.substr(c+1),c=u.lastIndexOf(":"),c===-1?t+=e(u,!1,!1):(t+=e(u.substr(0,c),!1,!1),t+=":",t+=e(u.substr(c+1),!1,!0)),t+="@"}n=n.toLowerCase(),c=n.lastIndexOf(":"),c===-1?t+=e(n,!1,!0):(t+=e(n.substr(0,c),!1,!0),t+=n.substr(c))}if(r){if(r.length>=3&&r.charCodeAt(0)===47&&r.charCodeAt(2)===58){let c=r.charCodeAt(1);c>=65&&c<=90&&(r=`/${String.fromCharCode(c+32)}:${r.substr(3)}`)}else if(r.length>=2&&r.charCodeAt(1)===58){let c=r.charCodeAt(0);c>=65&&c<=90&&(r=`${String.fromCharCode(c+32)}:${r.substr(2)}`)}t+=e(r,!0,!1)}return s&&(t+="?",t+=e(s,!1,!1)),l&&(t+="#",t+=i?l:a8i(l,!1,!1)),t}function u8i(a){try{return decodeURIComponent(a)}catch{return a.length>3?a.substr(0,3)+u8i(a.substr(3)):a}}var l8i=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function nbt(a){return a.match(l8i)?a.replace(l8i,i=>u8i(i)):a}var Q;(Ko=>(Ko.inMemory="inmemory",Ko.vscode="vscode",Ko.internal="private",Ko.walkThrough="walkThrough",Ko.walkThroughSnippet="walkThroughSnippet",Ko.http="http",Ko.https="https",Ko.file="file",Ko.mailto="mailto",Ko.untitled="untitled",Ko.data="data",Ko.command="command",Ko.vscodeRemote="vscode-remote",Ko.vscodeRemoteResource="vscode-remote-resource",Ko.vscodeManagedRemoteResource="vscode-managed-remote-resource",Ko.vscodeUserData="vscode-userdata",Ko.vscodeCustomEditor="vscode-custom-editor",Ko.vscodeNotebookCell="vscode-notebook-cell",Ko.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",Ko.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",Ko.vscodeNotebookCellOutput="vscode-notebook-cell-output",Ko.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",Ko.vscodeNotebookMetadata="vscode-notebook-metadata",Ko.vscodeInteractiveInput="vscode-interactive-input",Ko.vscodeSettings="vscode-settings",Ko.vscodeWorkspaceTrust="vscode-workspace-trust",Ko.vscodeTerminal="vscode-terminal",Ko.vscodeImageCarousel="vscode-image-carousel",Ko.vscodeChatCodeBlock="vscode-chat-code-block",Ko.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",Ko.vscodeChatEditor="vscode-chat-editor",Ko.vscodeChatInput="chatSessionInput",Ko.vscodeLocalChatSession="vscode-chat-session",Ko.webviewPanel="webview-panel",Ko.vscodeWebview="vscode-webview",Ko.vscodeBrowser="vscode-browser",Ko.extension="extension",Ko.vscodeFileResource="vscode-file",Ko.tmp="tmp",Ko.vsls="vsls",Ko.vscodeSourceControl="vscode-scm",Ko.commentsInput="comment",Ko.codeSetting="code-setting",Ko.outputChannel="output",Ko.accessibleView="accessible-view",Ko.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",Ko.chatEditingModel="chat-editing-text-model",Ko.copilotPr="copilot-pr"))(Q||={});function hc(a,i){return A.isUri(a)?xr(a.scheme,i):aT(a,i+":")}function gB(a,...i){return i.some(e=>hc(a,e))}var rbt="tkn",_ii=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(i){this._preferredWebSchema=i}setDelegate(i){this._delegate=i}setServerRootPath(i,e){this._serverRootPath=Vo.join(e??"/",Rzo(i))}getServerRootPath(){return this._serverRootPath}get _remoteResourcesPath(){return Vo.join(this._serverRootPath,Q.vscodeRemoteResource)}set(i,e,t){this._hosts[i]=e,this._ports[i]=t}setConnectionToken(i,e){this._connectionTokens[i]=e}getPreferredWebSchema(){return this._preferredWebSchema}rewrite(i){if(this._delegate)try{return this._delegate(i)}catch(s){return vs(s),i}let e=i.authority,t=this._hosts[e];t&&t.indexOf(":")!==-1&&t.indexOf("[")===-1&&(t=`[${t}]`);let o=this._ports[e],n=this._connectionTokens[e],r=`path=${encodeURIComponent(i.path)}`;return typeof n=="string"&&(r+=`&${rbt}=${encodeURIComponent(n)}`),A.from({scheme:Ft?this._preferredWebSchema:Q.vscodeRemoteResource,authority:`${t}:${o}`,path:this._remoteResourcesPath,query:r})}},xL=new _ii;function Rzo(a){return`${a.quality??"oss"}-${a.commit??"dev"}`}var p8i="vs/../../extensions",nF="vs/../../node_modules",hY="vs/../../node_modules.asar",sbt="vs/../../node_modules.asar.unpacked",Rii="vscode-app",Dii=class a{static{this.FALLBACK_AUTHORITY=Rii}asBrowserUri(i){let e=this.toUri(i);return this.uriToBrowserUri(e)}uriToBrowserUri(i){return i.scheme===Q.vscodeRemote?xL.rewrite(i):i.scheme===Q.file&&(Qr||f3i===`${Q.vscodeFileResource}://${a.FALLBACK_AUTHORITY}`)?i.with({scheme:Q.vscodeFileResource,authority:i.authority||a.FALLBACK_AUTHORITY,query:null,fragment:null}):i}asFileUri(i){let e=this.toUri(i);return this.uriToFileUri(e)}uriToFileUri(i){return i.scheme===Q.vscodeFileResource?i.with({scheme:Q.file,authority:i.authority!==a.FALLBACK_AUTHORITY?i.authority:null,query:null,fragment:null}):i}toUri(i){if(A.isUri(i))return i;if(globalThis._VSCODE_FILE_ROOT){let e=globalThis._VSCODE_FILE_ROOT;if(/^\w[\w\d+.-]*:\/\//.test(e))return A.joinPath(A.parse(e,!0),i);let t=td(e,i);return A.file(t)}throw new Error("Cannot determine URI for module id!")}},In=new Dii,$On=Object.freeze({"Cache-Control":"no-cache, no-store"}),jOn=Object.freeze({"Document-Policy":"include-js-call-stacks-in-crash-reports"}),Fle;(n=>{let a=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"}]]);n.CoopAndCoep=Object.freeze(a.get("3"));let e="vscode-coi";function t(r){let s;typeof r=="string"?s=new URL(r).searchParams:r instanceof URL?s=r.searchParams:A.isUri(r)&&(s=new URL(r.toString(!0)).searchParams);let l=s?.get(e);if(l)return a.get(l)}n.getHeadersFromQuery=t;function o(r,s,l){if(!globalThis.crossOriginIsolated)return;let c=s&&l?"3":l?"2":"1";r instanceof URLSearchParams?r.set(e,c):r[e]=c}n.addSearchParam=o})(Fle||={});function fB(a){return Ole(a,!0)}var Wle=class{constructor(i){this._ignorePathCasing=i}compare(i,e,t=!1){return i===e?0:oc(this.getComparisonKey(i,t),this.getComparisonKey(e,t))}isEqual(i,e,t=!1){return i===e?!0:!i||!e?!1:this.getComparisonKey(i,t)===this.getComparisonKey(e,t)}getComparisonKey(i,e=!1){return i.with({path:this._ignorePathCasing(i)?i.path.toLowerCase():void 0,fragment:e?null:void 0}).toString()}ignorePathCasing(i){return this._ignorePathCasing(i)}isEqualOrParent(i,e,t=!1){if(i.scheme===e.scheme){if(i.scheme===Q.file)return Nle(fB(i),fB(e),this._ignorePathCasing(i))&&i.query===e.query&&(t||i.fragment===e.fragment);if(vB(i.authority,e.authority))return Nle(i.path,e.path,this._ignorePathCasing(i),"/")&&i.query===e.query&&(t||i.fragment===e.fragment)}return!1}joinPath(i,...e){return A.joinPath(i,...e)}basenameOrAuthority(i){return Be(i)||i.authority}basename(i,e){return Vo.basename(i.path,e)}extname(i){return Vo.extname(i.path)}dirname(i){if(i.path.length===0)return i;let e;return i.scheme===Q.file?e=A.file(yd(fB(i))).path:(e=Vo.dirname(i.path),i.authority&&e.length&&e.charCodeAt(0)!==47&&(console.error(`dirname("${i.toString})) resulted in a relative path`),e="/")),i.with({path:e})}normalizePath(i){if(!i.path.length)return i;let e;return i.scheme===Q.file?e=A.file(Vh(fB(i))).path:e=Vo.normalize(i.path),i.with({path:e})}relativePath(i,e){if(i.scheme!==e.scheme||!vB(i.authority,e.authority))return;if(i.scheme===Q.file){let n=pA(fB(i),fB(e));return ii?kz(n):n}let t=i.path||"/",o=e.path||"/";if(this._ignorePathCasing(i)){let n=0;for(let r=Math.min(t.length,o.length);n<r&&!(t.charCodeAt(n)!==o.charCodeAt(n)&&t.charAt(n).toLowerCase()!==o.charAt(n).toLowerCase());n++);t=o.substr(0,n)+t.substr(n)}return Vo.relative(t,o)}resolvePath(i,e){if(i.scheme===Q.file){let t=A.file(uA(fB(i),e));return i.with({authority:t.authority,path:t.path})}return e=e8i(e),i.with({path:Vo.resolve(i.path,e)})}isAbsolutePath(i){return!!i.path&&i.path[0]==="/"}isEqualAuthority(i,e){return i===e||i!==void 0&&e!==void 0&&xr(i,e)}hasTrailingPathSeparator(i,e=Cu){if(i.scheme===Q.file){let t=fB(i);return t.length>Eii(t).length&&t[t.length-1]===e}else{let t=i.path;return t.length>1&&t.charCodeAt(t.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(i.fsPath)}}removeTrailingPathSeparator(i,e=Cu){return Vle(i,e)?i.with({path:i.path.substr(0,i.path.length-1)}):i}addTrailingPathSeparator(i,e=Cu){let t=!1;if(i.scheme===Q.file){let o=fB(i);t=o!==void 0&&o.length===Eii(o).length&&o[o.length-1]===e}else{e="/";let o=i.path;t=o.length===1&&o.charCodeAt(o.length-1)===47}return!t&&!Vle(i,e)?i.with({path:i.path+"/"}):i}},Jn=new Wle(()=>!1),kL=new Wle(a=>a.scheme===Q.file?!Sn:!0),Tk=new Wle(a=>!0),ze=Jn.isEqual.bind(Jn),Yr=Jn.isEqualOrParent.bind(Jn),m8i=Jn.getComparisonKey.bind(Jn),sl=Jn.basenameOrAuthority.bind(Jn),Be=Jn.basename.bind(Jn),Ts=Jn.extname.bind(Jn),ai=Jn.dirname.bind(Jn),Ve=Jn.joinPath.bind(Jn),Jj=Jn.normalizePath.bind(Jn),lu=Jn.relativePath.bind(Jn),Mii=Jn.resolvePath.bind(Jn),abt=Jn.isAbsolutePath.bind(Jn),vB=Jn.isEqualAuthority.bind(Jn),Vle=Jn.hasTrailingPathSeparator.bind(Jn),Ble=Jn.removeTrailingPathSeparator.bind(Jn),Zj=Jn.addTrailingPathSeparator.bind(Jn);function p4e(a,i){let e=[];for(let t=0;t<a.length;t++){let o=i(a[t]);a.some((n,r)=>r===t?!1:Yr(o,i(n)))||e.push(a[t])}return e}var e5;(n=>{n.META_DATA_LABEL="label",n.META_DATA_DESCRIPTION="description",n.META_DATA_SIZE="size",n.META_DATA_MIME="mime";function o(r){let s=new Map;r.path.substring(r.path.indexOf(";")+1,r.path.lastIndexOf(";")).split(";").forEach(u=>{let[p,h]=u.split(":");p&&h&&s.set(p,h)});let c=r.path.substring(0,r.path.indexOf(";"));return c&&s.set(n.META_DATA_MIME,c),s}n.parseMetaData=o})(e5||={});function Nf(a,i,e){if(i){let t=a.path;return t&&t[0]!==Vo.sep&&(t=Vo.sep+t),a.with({scheme:e,authority:i,path:t})}return a.with({scheme:e})}var EL=Symbol("MicrotaskDelay");function aD(a){return!!a&&typeof a.then=="function"}function Hn(a){let i=new qe,e=a(i.token),t=!1,o=new Promise((n,r)=>{let s=i.token.onCancellationRequested(()=>{t=!0,s.dispose(),r(new qi)});Promise.resolve(e).then(l=>{s.dispose(),i.dispose(),t?Sd(l)&&l.dispose():n(l)},l=>{s.dispose(),i.dispose(),r(l)})});return new class{cancel(){i.cancel(),i.dispose()}then(n,r){return o.then(n,r)}catch(n){return this.then(void 0,n)}finally(n){return o.finally(n)}}}function Ea(a,i,e){return new Promise((t,o)=>{let n=i.onCancellationRequested(()=>{n.dispose(),t(e)});a.then(t,o).finally(()=>n.dispose())})}function Ym(a,i){return new Promise((e,t)=>{let o=i.onCancellationRequested(()=>{o.dispose(),t(new qi)});a.then(e,t).finally(()=>o.dispose())})}function bwe(a){if(!Yi(a))return Promise.reject(a)}function h8i(a){return new Promise((i,e)=>{a.then(i,e)})}function Hle(a){let i=-1,e=a.map((o,n)=>o.then(r=>(i=n,r))),t=Promise.race(e);return t.cancel=()=>{a.forEach((o,n)=>{n!==i&&o.cancel&&o.cancel()})},t.finally(()=>{t.cancel()}),t}function Uu(a,i,e){let t,o=setTimeout(()=>{t?.(void 0),e?.()},i);return Promise.race([a.finally(()=>clearTimeout(o)),new Promise(n=>t=n)])}function Ey(){let a,i;return{promise:new Promise((t,o)=>{a=t,i=o}),resolve:a,reject:i}}var am=class{constructor(){this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null,this.cancellationTokenSource=new qe}queue(i){if(this.cancellationTokenSource.token.isCancellationRequested)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=i,!this.queuedPromise){let e=()=>{if(this.queuedPromise=null,this.cancellationTokenSource.token.isCancellationRequested)return;let t=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,t};this.queuedPromise=new Promise(t=>{this.activePromise.then(e,e).then(t)})}return new Promise((e,t)=>{this.queuedPromise.then(e,t)})}return this.activePromise=i(this.cancellationTokenSource.token),new Promise((e,t)=>{this.activePromise.then(o=>{this.activePromise=null,e(o)},o=>{this.activePromise=null,t(o)})})}dispose(){this.cancellationTokenSource.cancel()}},Tm=class{constructor(){this.current=Promise.resolve(null)}queue(i){return this.current=this.current.then(()=>i(),()=>i())}},II=class{constructor(){this.promiseMap=new Map}queue(i,e){let o=(this.promiseMap.get(i)??Promise.resolve()).catch(()=>{}).then(e).finally(()=>{this.promiseMap.get(i)===o&&this.promiseMap.delete(i)});return this.promiseMap.set(i,o),o}peek(i){return this.promiseMap.get(i)||void 0}keys(){return this.promiseMap.keys()}},Lzo=(a,i)=>{let e=!0,t=setTimeout(()=>{e=!1,i()},a);return{isTriggered:()=>e,dispose:()=>{clearTimeout(t),e=!1}}},Mzo=a=>{let i=!0;return queueMicrotask(()=>{i&&(i=!1,a())}),{isTriggered:()=>i,dispose:()=>{i=!1}}},rn=class{constructor(i){this.defaultDelay=i;this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(i,e=this.defaultDelay){this.task=i,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((o,n)=>{this.doResolve=o,this.doReject=n}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let o=this.task;return this.task=null,o()}}));let t=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=e===EL?Mzo(t):Lzo(e,t),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new qi),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}},Aa=class{constructor(i){this.delayer=new rn(i),this.throttler=new am}trigger(i,e){return this.delayer.trigger(()=>this.throttler.queue(i),e)}isTriggered(){return this.delayer.isTriggered()}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}},ip=class{constructor(){this._isOpen=!1,this._promise=new Promise((i,e)=>{this._completePromise=i})}isOpen(){return this._isOpen}open(){this._isOpen=!0,this._completePromise(!0)}wait(){return this._promise}},t5=class extends ip{constructor(i){super(),this._timeout=setTimeout(()=>this.open(),i)}open(){clearTimeout(this._timeout),super.open()}};function Li(a,i){return i?new Promise((e,t)=>{let o=setTimeout(()=>{n.dispose(),e()},a),n=i.onCancellationRequested(()=>{clearTimeout(o),n.dispose(),t(new qi)})}):Hn(e=>Li(a,e))}function Zo(a,i=0,e){let t=setTimeout(()=>{a(),e&&o.dispose()},i),o=ee(()=>{clearTimeout(t),e?.delete(o)});return e?.add(o),o}function pbt(a){let i=[],e=0,t=a.length;function o(){return e<t?a[e++]():null}function n(r){r!=null&&i.push(r);let s=o();return s?s.then(n):Promise.resolve(i)}return Promise.resolve(null).then(n)}function Ule(a,i=t=>!!t,e=null){let t=0,o=a.length,n=()=>{if(t>=o)return Promise.resolve(e);let r=a[t++];return Promise.resolve(r()).then(l=>i(l)?Promise.resolve(l):n())};return n()}var _k=class{constructor(i){this._size=0;this._isDisposed=!1;this.maxDegreeOfParalellism=i,this.outstandingPromises=[],this.runningPromises=0,this._onDrained=new T}whenIdle(){return this.size>0?U.toPromise(this.onDrained):Promise.resolve()}get onDrained(){return this._onDrained.event}get size(){return this._size}queue(i){if(this._isDisposed)throw new Error("Object has been disposed");return this._size++,new Promise((e,t)=>{this.outstandingPromises.push({factory:i,c:e,e:t}),this.consume()})}consume(){for(;this.outstandingPromises.length&&this.runningPromises<this.maxDegreeOfParalellism;){let i=this.outstandingPromises.shift();this.runningPromises++;let e=i.factory();e.then(i.c,i.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()}},Hh=class extends _k{constructor(){super(1)}};var Tz=class{constructor(){this.queues=new Map;this.drainers=new Set;this.drainListeners=void 0;this.drainListenerCount=0}async whenDrained(){if(this.isDrained())return;let i=new Mo;return this.drainers.add(i),i.p}isDrained(){for(let[,i]of this.queues)if(i.size>0)return!1;return!0}queueSize(i,e=Jn){let t=e.getComparisonKey(i);return this.queues.get(t)?.size??0}queueFor(i,e,t=Jn){let o=t.getComparisonKey(i),n=this.queues.get(o);if(!n){n=new Hh;let r=this.drainListenerCount++,s=U.once(n.onDrained)(()=>{n?.dispose(),this.queues.delete(o),this.onDidQueueDrain(),this.drainListeners?.deleteAndDispose(r),this.drainListeners?.size===0&&(this.drainListeners.dispose(),this.drainListeners=void 0)});this.drainListeners||(this.drainListeners=new Ot),this.drainListeners.set(r,s),this.queues.set(o,n)}return n.queue(e)}onDidQueueDrain(){this.isDrained()&&this.releaseDrainers()}releaseDrainers(){for(let i of this.drainers)i.complete();this.drainers.clear()}dispose(){for(let[,i]of this.queues)i.dispose();this.queues.clear(),this.releaseDrainers(),this.drainListeners?.dispose()}},fwe=class{constructor(){this._runningTask=void 0;this._pendingTasks=[]}schedule(i){let e=new Mo;return this._pendingTasks.push({task:i,deferred:e,setUndefinedWhenCleared:!1}),this._runIfNotRunning(),e.p}scheduleSkipIfCleared(i){let e=new Mo;return this._pendingTasks.push({task:i,deferred:e,setUndefinedWhenCleared:!0}),this._runIfNotRunning(),e.p}_runIfNotRunning(){this._runningTask===void 0&&this._processQueue()}async _processQueue(){if(this._pendingTasks.length===0)return;let i=this._pendingTasks.shift();if(i){if(this._runningTask)throw new ci;this._runningTask=i.task;try{let e=await i.task();i.deferred.complete(e)}catch(e){i.deferred.error(e)}finally{this._runningTask=void 0,this._processQueue()}}}clearPending(){let i=this._pendingTasks;this._pendingTasks=[];for(let e of i)e.setUndefinedWhenCleared?e.deferred.complete(void 0):e.deferred.error(new qi)}},Nl=class{constructor(i,e){this._isDisposed=!1;this._token=void 0,typeof i=="function"&&typeof e=="number"&&this.setIfNotSet(i,e)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==void 0&&(clearTimeout(this._token),this._token=void 0)}cancelAndSet(i,e){if(this._isDisposed)throw new ci("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=void 0,i()},e)}setIfNotSet(i,e){if(this._isDisposed)throw new ci("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===void 0&&(this._token=setTimeout(()=>{this._token=void 0,i()},e))}},ky=class{constructor(){this.disposable=void 0;this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(i,e,t=globalThis){if(this.isDisposed)throw new ci("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let o=t.setInterval(()=>{i()},e);this.disposable=ee(()=>{t.clearInterval(o),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Dt=class{constructor(i,e){this.timeoutToken=void 0,this.runner=i,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(i=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,i)}get delay(){return this.timeout}set delay(i){this.timeout=i}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?.()}};var hA=class extends Dt{constructor(e,t){super(e,t);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()}};var TL,gwe;(function(){let a=globalThis;typeof a.requestIdleCallback!="function"||typeof a.cancelIdleCallback!="function"?gwe=(i,e,t)=>{ox(()=>{if(o)return;let n=Date.now()+15;e(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,n-Date.now())}}))});let o=!1;return{dispose(){o||(o=!0)}}}:gwe=(i,e,t)=>{let o=i.requestIdleCallback(e,typeof t=="number"?{timeout:t}:void 0),n=!1;return{dispose(){n||(n=!0,i.cancelIdleCallback(o))}}},TL=(i,e)=>gwe(globalThis,i,e)})();var m4e=class{constructor(i,e){this._didRun=!1;this._executor=()=>{try{this._value=e()}catch(t){this._error=t}finally{this._didRun=!0}},this._handle=gwe(i,()=>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}},i5=class extends m4e{constructor(i){super(globalThis,i)}};async function g8i(a,i,e){let t;for(let o=0;o<e;o++)try{return await a()}catch(n){t=n,await Li(i)}throw t}var vwe=class{isRunning(i){return typeof i=="number"?this._running?.taskId===i:!!this._running}get running(){return this._running?.promise}cancelRunning(){this._running?.cancel()}run(i,e,t){return this._running={taskId:i,cancel:()=>t?.(),promise:e},e.then(()=>this.doneRunning(i),()=>this.doneRunning(i)),e}doneRunning(i){this._running&&i===this._running.taskId&&(this._running=void 0,this.runQueued())}runQueued(){if(this._queued){let i=this._queued;this._queued=void 0,i.run().then(i.promiseResolve,i.promiseReject)}}queue(i){if(this._queued)this._queued.run=i;else{let{promise:e,resolve:t,reject:o}=Ey();this._queued={run:i,promise:e,promiseResolve:t,promiseReject:o}}return this._queued.promise}hasQueued(){return!!this._queued}async join(){return this._queued?.promise??this._running?.promise}},lbt=class{constructor(i,e=()=>Date.now()){this.interval=i;this.nowFn=e;this.lastIncrementTime=0;this.value=0}increment(){let i=this.nowFn();return i-this.lastIncrementTime>this.interval&&(this.lastIncrementTime=i,this.value=0),this.value++,this.value}};var Mo=class a{static fromPromise(i){let e=new a;return e.settleWith(i),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((i,e)=>{this.completeCallback=i,this.errorCallback=e})}complete(i){return this.isSettled?Promise.resolve():new Promise(e=>{this.completeCallback(i),this.outcome={outcome:0,value:i},e()})}error(i){return this.isSettled?Promise.resolve():new Promise(e=>{this.errorCallback(i),this.outcome={outcome:1,value:i},e()})}settleWith(i){return i.then(e=>this.complete(e),e=>this.error(e))}cancel(){return this.error(new qi)}},vn;(e=>{async function a(t){let o,n=await Promise.all(t.map(r=>r.then(s=>s,s=>{o||(o=s)})));if(typeof o<"u")throw o;return n}e.settled=a;function i(t){return new Promise(async(o,n)=>{try{await t(o,n)}catch(r){n(r)}})}e.withAsyncBody=i})(vn||={});var Pii=class{constructor(i){this._value=void 0;this._error=void 0;this._isResolved=!1;this.promise=i.then(e=>(this._value=e,this._isResolved=!0,e),e=>{throw this._error=e,this._isResolved=!0,e})}get value(){return this._value}get error(){return this._error}get isResolved(){return this._isResolved}requireValue(){if(!this._isResolved)throw new ci("Promise is not resolved yet");if(this._error)throw this._error;return this._value}},cbt=class{constructor(i){this._compute=i;this._promise=new uo(()=>new Pii(this._compute()))}requireValue(){return this._promise.value.requireValue()}getPromise(){return this._promise.value.promise}get currentValue(){return this._promise.rawValue?.value}};var Aii=class a{static fromArray(i){return new a(e=>{e.emitMany(i)})}static fromPromise(i){return new a(async e=>{e.emitMany(await i)})}static fromPromisesResolveOrder(i){return new a(async e=>{await Promise.all(i.map(async t=>e.emitOne(await t)))})}static merge(i){return new a(async e=>{await Promise.all(i.map(async t=>{for await(let o of t)e.emitOne(o)}))})}static{this.EMPTY=a.fromArray([])}constructor(i,e){this._state=0,this._results=[],this._error=null,this._onReturn=e,this._onStateChanged=new T,queueMicrotask(async()=>{let t={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(i(t)),this.resolve()}catch(o){this.reject(o)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let i=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(i<this._results.length)return{done:!1,value:this._results[i++]};if(this._state===1)return{done:!0,value:void 0};await U.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,e){return new a(async t=>{for await(let o of i)t.emitOne(e(o))})}map(i){return a.map(this,i)}static filter(i,e){return new a(async t=>{for await(let o of i)e(o)&&t.emitOne(o)})}filter(i){return a.filter(this,i)}static coalesce(i){return a.filter(i,e=>!!e)}coalesce(){return a.coalesce(this)}static async toPromise(i){let e=[];for await(let t of i)e.push(t);return e}toPromise(){return a.toPromise(this)}emitOne(i){this._state===0&&(this._results.push(i),this._onStateChanged.fire())}emitMany(i){this._state===0&&(this._results=this._results.concat(i),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(i){this._state===0&&(this._state=2,this._error=i,this._onStateChanged.fire())}};function f8i(a){let i=new qe,e=a(i.token);return new Oii(i,async t=>{let o=i.token.onCancellationRequested(()=>{o.dispose(),i.dispose(),t.reject(new qi)});try{for await(let n of e){if(i.token.isCancellationRequested)return;t.emitOne(n)}o.dispose(),i.dispose()}catch(n){o.dispose(),i.dispose(),t.reject(n)}})}var dbt=class{constructor(i){this._deferred=new Mo;this._asyncIterable=new Aii(o=>{if(e){o.reject(e);return}return t&&o.emitMany(t),this._errorFn=n=>o.reject(n),this._emitOneFn=n=>o.emitOne(n),this._emitManyFn=n=>o.emitMany(n),this._deferred.p},i);let e,t;this._errorFn=o=>{e||(e=o)},this._emitOneFn=o=>{t||(t=[]),t.push(o)},this._emitManyFn=o=>{t?o.forEach(n=>t.push(n)):t=o.slice()}}get asyncIterable(){return this._asyncIterable}resolve(){this._deferred.complete()}reject(i){this._errorFn(i),this._deferred.complete()}emitOne(i){this._emitOneFn(i)}emitMany(i){this._emitManyFn(i)}};var Nii=class{constructor(){this._unsatisfiedConsumers=[];this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(i){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){let e=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(e,i)}else this._unconsumedValues.push(i)}produceFinal(i){this._ensureNoFinalValue(),this._finalValue=i;for(let e of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(e,i);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new ci("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(i,e){e.ok?i.complete(e.value):i.error(e.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){let i=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return i.ok?Promise.resolve(i.value):Promise.reject(i.error)}else{let i=new Mo;return this._unsatisfiedConsumers.push(i),i.p}}},Fp=class a{constructor(i,e){this._onReturn=e;this._producerConsumer=new Nii;this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async i=>(this._finishError(i),{done:!0,value:void 0})};queueMicrotask(async()=>{let t=i({emitOne:o=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:o}}),emitMany:o=>{for(let n of o)this._producerConsumer.produce({ok:!0,value:{done:!1,value:n}})},reject:o=>this._finishError(o)});if(!this._producerConsumer.hasFinalValue)try{await t,this._finishOk()}catch(o){this._finishError(o)}})}static fromArray(i){return new a(e=>{e.emitMany(i)})}static fromPromise(i){return new a(async e=>{e.emitMany(await i)})}static fromPromisesResolveOrder(i){return new a(async e=>{await Promise.all(i.map(async t=>e.emitOne(await t)))})}static merge(i){return new a(async e=>{await Promise.all(i.map(async t=>{for await(let o of t)e.emitOne(o)}))})}static{this.EMPTY=a.fromArray([])}static map(i,e){return new a(async t=>{for await(let o of i)t.emitOne(e(o))})}static tee(i){let e,t,o=new Mo,n=async()=>{if(!(!e||!t))try{for await(let l of i)e.emitOne(l),t.emitOne(l)}catch(l){e.reject(l),t.reject(l)}finally{o.complete()}},r=new a(async l=>(e=l,n(),o.p)),s=new a(async l=>(t=l,n(),o.p));return[r,s]}map(i){return a.map(this,i)}static coalesce(i){return a.filter(i,e=>!!e)}coalesce(){return a.coalesce(this)}static filter(i,e){return new a(async t=>{for await(let o of i)e(o)&&t.emitOne(o)})}filter(i){return a.filter(this,i)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(i){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:i})}[Symbol.asyncIterator](){return this._iterator}},Oii=class extends Fp{constructor(e,t){super(t);this._source=e}cancel(){this._source.cancel()}},gY=Symbol("AsyncReaderEndOfStream"),ubt=class{constructor(i){this._source=i;this._buffer=[];this._atEnd=!1}get endOfStream(){return this._buffer.length===0&&this._atEnd}async read(){return this._buffer.length===0&&!this._atEnd&&await this._extendBuffer(),this._buffer.length===0?gY:this._buffer.shift()}async readWhile(i,e){do{let t=await this.peek();if(t===gY||!i(t))break;await this.read(),await e(t)}while(!0)}readBufferedOrThrow(){let i=this.peekBufferedOrThrow();return this._buffer.shift(),i}async consumeToEnd(){for(;!this.endOfStream;)await this.read()}async peek(){return this._buffer.length===0&&!this._atEnd&&await this._extendBuffer(),this._buffer.length===0?gY:this._buffer[0]}peekBufferedOrThrow(){if(this._buffer.length===0){if(this._atEnd)return gY;throw new ci("No buffered elements")}return this._buffer[0]}async peekTimeout(i){if(this._buffer.length===0&&!this._atEnd&&await Uu(this._extendBuffer(),i),this._atEnd)return gY;if(this._buffer.length!==0)return this._buffer[0]}_extendBuffer(){return this._atEnd?Promise.resolve():(this._extendBufferPromise||(this._extendBufferPromise=(async()=>{let{value:i,done:e}=await this._source.next();this._extendBufferPromise=void 0,e?this._atEnd=!0:this._buffer.push(i)})()),this._extendBufferPromise)}};function fY(a){let i=a;return i?[i.on,i.pause,i.resume,i.destroy].every(e=>typeof e=="function"):!1}function mbt(a){let i=a;return i?fY(i.stream)&&Array.isArray(i.buffer)&&typeof i.ended=="boolean":!1}function Ty(a,i){return new Fii(a,i)}var Fii=class{constructor(i,e){this.reducer=i;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(i){if(!this.state.destroyed){if(this.state.flowing)this.emitData(i);else if(this.buffer.data.push(i),typeof this.options?.highWaterMark=="number"&&this.buffer.data.length>this.options.highWaterMark)return new Promise(e=>this.pendingWritePromises.push(e))}}error(i){this.state.destroyed||(this.state.flowing?this.emitError(i):this.buffer.error.push(i))}end(i){this.state.destroyed||(typeof i<"u"&&this.write(i),this.state.flowing?(this.emitEnd(),this.destroy()):this.state.ended=!0)}emitData(i){this.listeners.data.slice(0).forEach(e=>e(i))}emitError(i){this.listeners.error.length===0?mt(i):this.listeners.error.slice(0).forEach(e=>e(i))}emitEnd(){this.listeners.end.slice(0).forEach(i=>i())}on(i,e){if(!this.state.destroyed)switch(i){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(i,e){if(this.state.destroyed)return;let t;switch(i){case"data":t=this.listeners.data;break;case"end":t=this.listeners.end;break;case"error":t=this.listeners.error;break}if(t){let o=t.indexOf(e);o>=0&&t.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 i=[...this.pendingWritePromises];this.pendingWritePromises.length=0,i.forEach(e=>e())}flowErrors(){if(this.listeners.error.length>0){for(let i of this.buffer.error)this.emitError(i);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 v8i(a,i){let e=[],t;for(;(t=a.read())!==null;)e.push(t);return i(e)}function b8i(a,i,e){let t=[],o;for(;(o=a.read())!==null&&t.length<e;)t.push(o);return o===null&&t.length>0?i(t):{read:()=>{if(t.length>0)return t.shift();if(typeof o<"u"){let n=o;return o=void 0,n}return a.read()}}}function Swe(a,i){return new Promise((e,t)=>{let o=[];_L(a,{onData:n=>{i&&o.push(n)},onError:n=>{i?t(n):e(void 0)},onEnd:()=>{e(i?i(o):void 0)}})})}function _L(a,i,e){a.on("error",t=>{e?.isCancellationRequested||i.onError(t)}),a.on("end",()=>{e?.isCancellationRequested||i.onEnd()}),a.on("data",t=>{e?.isCancellationRequested||i.onData(t)})}function hbt(a,i){return new Promise((e,t)=>{let o=new O,n=[],r=c=>{if(n.push(c),n.length>i)return o.dispose(),a.pause(),e({stream:a,buffer:n,ended:!1})},s=c=>(o.dispose(),t(c)),l=()=>(o.dispose(),e({stream:a,buffer:n,ended:!0}));o.add(ee(()=>a.removeListener("error",s))),a.on("error",s),o.add(ee(()=>a.removeListener("end",l))),a.on("end",l),o.add(ee(()=>a.removeListener("data",r))),a.on("data",r)})}function S8i(a,i){let e=Ty(i);return e.end(a),e}function I8i(){let a=Ty(()=>{throw new Error("not supported")});return a.end(),a}function y8i(a){let i=!1;return{read:()=>i?null:(i=!0,a)}}function Wii(a,i,e){let t=Ty(e);return _L(a,{onData:o=>t.write(i.data(o)),onError:o=>t.error(i.error?i.error(o):o),onEnd:()=>t.end()}),t}function w8i(a,i,e){let t=!1;return{read:()=>{let o=i.read();return t?o:(t=!0,o!==null?e([a,o]):a)}}}function C8i(a,i,e){let t=!1,o=Ty(e);return _L(i,{onData:n=>t?o.write(n):(t=!0,o.write(e([a,n]))),onError:n=>o.error(n),onEnd:()=>{t||(t=!0,o.write(a)),o.end()}}),o}var h4e=typeof Buffer<"u",Nzo=new uo(()=>new Uint8Array(256)),Vii,Bii,Ke=class a{static alloc(i){return h4e?new a(Buffer.allocUnsafe(i)):new a(new Uint8Array(i))}static wrap(i){return h4e&&!Buffer.isBuffer(i)&&(i=Buffer.from(i.buffer,i.byteOffset,i.byteLength)),new a(i)}static fromString(i,e){return!(e?.dontUseNodeBuffer||!1)&&h4e?new a(Buffer.from(i)):(Vii||(Vii=new TextEncoder),new a(Vii.encode(i)))}static fromByteArray(i){let e=a.alloc(i.length);for(let t=0,o=i.length;t<o;t++)e.buffer[t]=i[t];return e}static concat(i,e){if(typeof e>"u"){e=0;for(let n=0,r=i.length;n<r;n++)e+=i[n].byteLength}let t=a.alloc(e),o=0;for(let n=0,r=i.length;n<r;n++){let s=i[n];t.set(s,o),o+=s.byteLength}return t}static isNativeBuffer(i){return h4e&&Buffer.isBuffer(i)}constructor(i){this.buffer=i,this.byteLength=this.buffer.byteLength}clone(){let i=a.alloc(this.byteLength);return i.set(this),i}toString(){return h4e?this.buffer.toString():(Bii||(Bii=new TextDecoder(void 0,{ignoreBOM:!0})),Bii.decode(this.buffer))}slice(i,e){return new a(this.buffer.subarray(i,e))}set(i,e){if(i instanceof a)this.buffer.set(i.buffer,e);else if(i instanceof Uint8Array)this.buffer.set(i,e);else if(i instanceof ArrayBuffer)this.buffer.set(new Uint8Array(i),e);else if(ArrayBuffer.isView(i))this.buffer.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),e);else throw new Error("Unknown argument 'array'")}readUInt32BE(i){return _y(this.buffer,i)}writeUInt32BE(i,e){Dy(this.buffer,i,e)}readUInt32LE(i){return Fzo(this.buffer,i)}writeUInt32LE(i,e){Wzo(this.buffer,i,e)}readUInt8(i){return gbt(this.buffer,i)}writeUInt8(i,e){fbt(this.buffer,i,e)}indexOf(i,e=0){return Ozo(this.buffer,i instanceof a?i.buffer:i,e)}equals(i){return this===i?!0:this.byteLength!==i.byteLength?!1:this.buffer.every((e,t)=>e===i.buffer[t])}};function Ozo(a,i,e=0){let t=i.byteLength,o=a.byteLength;if(t===0)return 0;if(t===1)return a.indexOf(i[0],e);if(t>o-e)return-1;let n=Nzo.value;n.fill(i.length);for(let c=0;c<i.length;c++)n[i[c]]=i.length-c-1;let r=e+i.length-1,s=r,l=-1;for(;r<o;)if(a[r]===i[s]){if(s===0){l=r;break}r--,s--}else r+=Math.max(i.length-s,n[a[r]]),s=i.length-1;return l}function E8i(a,i){return a[i+0]<<0>>>0|a[i+1]<<8>>>0}function T8i(a,i,e){a[e+0]=i&255,i=i>>>8,a[e+1]=i&255}function _y(a,i){return a[i]*2**24+a[i+1]*2**16+a[i+2]*2**8+a[i+3]}function Dy(a,i,e){a[e+3]=i,i=i>>>8,a[e+2]=i,i=i>>>8,a[e+1]=i,i=i>>>8,a[e]=i}function Fzo(a,i){return a[i+0]<<0>>>0|a[i+1]<<8>>>0|a[i+2]<<16>>>0|a[i+3]<<24>>>0}function Wzo(a,i,e){a[e+0]=i&255,i=i>>>8,a[e+1]=i&255,i=i>>>8,a[e+2]=i&255,i=i>>>8,a[e+3]=i&255}function gbt(a,i){return a[i]}function fbt(a,i,e){a[e]=i}function vbt(a){return v8i(a,i=>Ke.concat(i))}function Iwe(a){return y8i(a)}function yI(a){return Swe(a,i=>Ke.concat(i))}async function _8i(a){return a.ended?Ke.concat(a.buffer):Ke.concat([...a.buffer,await yI(a.stream)])}function lD(a){return S8i(a,i=>Ke.concat(i))}function ywe(a){return Ty(i=>Ke.concat(i),a)}function D8i(a,i){return w8i(a,i,e=>Ke.concat(e))}function Hii(a,i){return C8i(a,i,e=>Ke.concat(e))}function Ws(a){let i=0,e=0,t=0,o=new Uint8Array(Math.floor(a.length/4*3)),n=s=>{switch(e){case 3:o[t++]=i|s,e=0;break;case 2:o[t++]=i|s>>>2,i=s<<6,e=3;break;case 1:o[t++]=i|s>>>4,i=s<<4,e=2;break;default:i=s<<2,e=1}};for(let s=0;s<a.length;s++){let l=a.charCodeAt(s);if(l>=65&&l<=90)n(l-65);else if(l>=97&&l<=122)n(l-97+26);else if(l>=48&&l<=57)n(l-48+52);else if(l===43||l===45)n(62);else if(l===47||l===95)n(63);else{if(l===61)break;throw new SyntaxError(`Unexpected base64 character ${a[s]}`)}}let r=t;for(;e>0;)n(0);return Ke.wrap(o).slice(0,r)}var Vzo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bzo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function gc({buffer:a},i=!0,e=!1){let t=e?Bzo:Vzo,o="",n=a.byteLength%3,r=0;for(;r<a.byteLength-n;r+=3){let s=a[r+0],l=a[r+1],c=a[r+2];o+=t[s>>>2],o+=t[(s<<4|l>>>4)&63],o+=t[(l<<2|c>>>6)&63],o+=t[c&63]}if(n===1){let s=a[r+0];o+=t[s>>>2],o+=t[s<<4&63],i&&(o+="==")}else if(n===2){let s=a[r+0],l=a[r+1];o+=t[s>>>2],o+=t[(s<<4|l>>>4)&63],o+=t[l<<2&63],i&&(o+="=")}return o}var x8i="0123456789abcdef";function o5({buffer:a}){let i="";for(let e=0;e<a.length;e++){let t=a[e];i+=x8i[t>>>4],i+=x8i[t&15]}return i}function wwe(a){if(a.length%2!==0)throw new SyntaxError("Hex string must have an even length");let i=new Uint8Array(a.length>>1);for(let e=0;e<a.length;)i[e>>1]=k8i(a,e++)<<4|k8i(a,e++);return Ke.wrap(i)}function k8i(a,i){let e=a.charCodeAt(i);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 ${i}`)}function Lr(a){return g4e(a,0)}function g4e(a,i){switch(typeof a){case"object":return a===null?n5(349,i):Array.isArray(a)?Uzo(a,i):zzo(a,i);case"string":return xwe(a,i);case"boolean":return Hzo(a,i);case"number":return n5(a,i);case"undefined":return n5(937,i);default:return n5(617,i)}}function n5(a,i){return(i<<5)-i+a|0}function Hzo(a,i){return n5(a?433:863,i)}function xwe(a,i){i=n5(149417,i);for(let e=0,t=a.length;e<t;e++)i=n5(a.charCodeAt(e),i);return i}function Uzo(a,i){return i=n5(104579,i),a.reduce((e,t)=>g4e(t,e),i)}function zzo(a,i){return i=n5(181387,i),Object.keys(a).sort().reduce((e,t)=>(e=xwe(t,e),g4e(a[t],e)),i)}var bB=a=>{if(typeof a=="string"&&a.length<250){let e=new wI;return e.update(a),Promise.resolve(e.digest())}let i;return typeof a=="string"?i=new TextEncoder().encode(a):a instanceof Ke?i=a.buffer:i=a,crypto.subtle.digest("sha-1",i).then(Cwe)};function zii(a,i,e=32){let t=e-i,o=~((1<<t)-1);return(a<<i|(o&a)>>>t)>>>0}function Cwe(a,i=32){return a instanceof ArrayBuffer?o5(Ke.wrap(new Uint8Array(a))):(a>>>0).toString(16).padStart(i/4,"0")}var wI=class a{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(i){let e=i.length;if(e===0)return;let t=this._buff,o=this._buffLen,n=this._leftoverHighSurrogate,r,s;for(n!==0?(r=n,s=-1,n=0):(r=i.charCodeAt(0),s=0);;){let l=r;if(Ip(r))if(s+1<e){let c=i.charCodeAt(s+1);iF(c)?(s++,l=Zvt(r,c)):l=65533}else{n=r;break}else iF(r)&&(l=65533);if(o=this._push(t,o,l),s++,s<e)r=i.charCodeAt(s);else break}this._buffLen=o,this._leftoverHighSurrogate=n}_push(i,e,t){return t<128?i[e++]=t:t<2048?(i[e++]=192|(t&1984)>>>6,i[e++]=128|(t&63)>>>0):t<65536?(i[e++]=224|(t&61440)>>>12,i[e++]=128|(t&4032)>>>6,i[e++]=128|(t&63)>>>0):(i[e++]=240|(t&1835008)>>>18,i[e++]=128|(t&258048)>>>12,i[e++]=128|(t&4032)>>>6,i[e++]=128|(t&63)>>>0),e>=64&&(this._step(),e-=64,this._totalLen+=64,i[0]=i[64],i[1]=i[65],i[2]=i[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()),Cwe(this._h0)+Cwe(this._h1)+Cwe(this._h2)+Cwe(this._h3)+Cwe(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 i=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(i/4294967296),!1),this._buffDV.setUint32(60,i%4294967296,!1),this._step()}_step(){let i=a._bigBlock32,e=this._buffDV;for(let p=0;p<64;p+=4)i.setUint32(p,e.getUint32(p,!1),!1);for(let p=64;p<320;p+=4)i.setUint32(p,zii(i.getUint32(p-12,!1)^i.getUint32(p-32,!1)^i.getUint32(p-56,!1)^i.getUint32(p-64,!1),1),!1);let t=this._h0,o=this._h1,n=this._h2,r=this._h3,s=this._h4,l,c,u;for(let p=0;p<80;p++)p<20?(l=o&n|~o&r,c=1518500249):p<40?(l=o^n^r,c=1859775393):p<60?(l=o&n|o&r|n&r,c=2400959708):(l=o^n^r,c=3395469782),u=zii(t,5)+l+s+c+i.getUint32(p*4,!1)&4294967295,s=r,r=n,n=zii(o,30),o=t,t=u;this._h0=this._h0+t&4294967295,this._h1=this._h1+o&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+s&4294967295}};function jn(a,i,e){return Math.min(Math.max(a,i),e)}function SB(a,i){return(i+a%i)%i}var f4e=class{constructor(){this._n=1;this._val=0}update(i){return this._val=this._val+(i-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}},bbt=class{constructor(i){this._n=0;this._val=0;this._values=[];this._index=0;this._sum=0;this._values=new Array(i),this._values.fill(0,0,i)}update(i){let e=this._values[this._index];return this._values[this._index]=i,this._index=(this._index+1)%this._values.length,this._sum-=e,this._sum+=i,this._n<this._values.length&&(this._n+=1),this._val=this._sum/this._n,this._val}get value(){return this._val}};function R8i(a,i,e,t,o,n,r,s){let l=r-e,c=s-t,u=o-e,p=n-t,h=a-e,g=i-t,f=l*l+c*c,v=l*u+c*p,b=l*h+c*g,S=u*u+p*p,y=u*h+p*g,w=1/(f*S-v*v),x=(S*b-v*y)*w,E=(f*y-v*b)*w;return x>=0&&E>=0&&x+E<1}function L8i(a){return Aw(a>=0&&a<=1,"p must be between 0 and 1"),Math.random()<a}var yp=class{constructor(i,e,t){this.owner=i;this.debugNameSource=e;this.referenceFn=t}getDebugName(i){return Gii(i,this)}},M8i=new Map,Kii=new WeakMap;function Gii(a,i){let e=Kii.get(a);if(e)return e;let t=Kzo(a,i);if(t){let o=M8i.get(t)??0;o++,M8i.set(t,o);let n=o===1?t:`${t}#${o}`;return Kii.set(a,n),n}}function Kzo(a,i){let e=Kii.get(a);if(e)return e;let t=i.owner?qzo(i.owner)+".":"",o,n=i.debugNameSource;if(n!==void 0)if(typeof n=="function"){if(o=n(),o!==void 0)return t+o}else return t+n;let r=i.referenceFn;if(r!==void 0&&(o=v4e(r),o!==void 0))return t+o;if(i.owner!==void 0){let s=Gzo(i.owner,a);if(s!==void 0)return t+s}}function Gzo(a,i){for(let e in a)if(a[e]===i)return e}var P8i=new Map,A8i=new WeakMap;function qzo(a){let i=A8i.get(a);if(i)return i;let e=qii(a)??"Object",t=P8i.get(e)??0;t++,P8i.set(e,t);let o=t===1?e:`${e}#${t}`;return A8i.set(a,o),o}function qii(a){let i=a.constructor;if(i)return i.name==="Object"?void 0:i.name}function v4e(a){let i=a.toString(),t=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(i);return(t?t[1]:void 0)?.trim()}function pv(a,i){return a===i}function $zo(){return(a,i)=>a===i}function jii(a,i,e){return eo(a,i,e??pv)}function rF(a){return(i,e)=>eo(i,e,a??pv)}function cD(a,i){if(a===i)return!0;if(Array.isArray(a)&&Array.isArray(i)){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(!cD(a[e],i[e]))return!1;return!0}if(a&&typeof a=="object"&&i&&typeof i=="object"&&Object.getPrototypeOf(a)===Object.prototype&&Object.getPrototypeOf(i)===Object.prototype){let e=a,t=i,o=Object.keys(e),n=Object.keys(t),r=new Set(n);if(o.length!==n.length)return!1;for(let s of o)if(!r.has(s)||!cD(e[s],t[s]))return!1;return!0}return!1}function jzo(){return(a,i)=>cD(a,i)}function O8i(a){return JSON.stringify($ii(a))}var Qzo=0,N8i=new WeakMap;function $ii(a){if(Array.isArray(a))return a.map($ii);if(a&&typeof a=="object")if(Object.getPrototypeOf(a)===Object.prototype){let i=a,e=Object.create(null);for(let t of Object.keys(i).sort())e[t]=$ii(i[t]);return e}else{let i=N8i.get(a);return i===void 0&&(i=Qzo++,N8i.set(a,i)),i+"----2b76a038c20c4bcc"}return a}function Yzo(a,i){return JSON.stringify(a)===JSON.stringify(i)}function Xzo(){return(a,i)=>JSON.stringify(a)===JSON.stringify(i)}function vY(){return(a,i)=>a.equals(i)}function Qii(a,i,e){return a==null||i===void 0||i===null?i===a:e(a,i)}function _z(a){return(i,e)=>i==null||e===void 0||e===null?e===i:a(i,e)}var Sbt;(p=>(p.strict=pv,p.strictC=$zo,p.array=jii,p.arrayC=rF,p.structural=cD,p.structuralC=jzo,p.jsonStringify=Yzo,p.jsonStringifyC=Xzo,p.thisC=vY,p.ifDefined=Qii,p.ifDefinedC=_z))(Sbt||={});function Yii(a){let i=new Error("BugIndicatingErrorRecovery: "+a);mt(i),console.error("recovered from an error that indicates a bug",i)}var zle;function b4e(a){zle?zle instanceof Ibt?zle.loggers.push(a):zle=new Ibt([zle,a]):zle=a}function yg(){return zle}var Xii;function F8i(a){Xii=a}function W8i(a){Xii&&Xii(a)}var Ibt=class{constructor(i){this.loggers=i}handleObservableCreated(i,e){for(let t of this.loggers)t.handleObservableCreated(i,e)}handleOnListenerCountChanged(i,e){for(let t of this.loggers)t.handleOnListenerCountChanged(i,e)}handleObservableUpdated(i,e){for(let t of this.loggers)t.handleObservableUpdated(i,e)}handleAutorunCreated(i,e){for(let t of this.loggers)t.handleAutorunCreated(i,e)}handleAutorunDisposed(i){for(let e of this.loggers)e.handleAutorunDisposed(i)}handleAutorunDependencyChanged(i,e,t){for(let o of this.loggers)o.handleAutorunDependencyChanged(i,e,t)}handleAutorunStarted(i){for(let e of this.loggers)e.handleAutorunStarted(i)}handleAutorunFinished(i){for(let e of this.loggers)e.handleAutorunFinished(i)}handleDerivedDependencyChanged(i,e,t){for(let o of this.loggers)o.handleDerivedDependencyChanged(i,e,t)}handleDerivedCleared(i){for(let e of this.loggers)e.handleDerivedCleared(i)}handleBeginTransaction(i){for(let e of this.loggers)e.handleBeginTransaction(i)}handleEndTransaction(i){for(let e of this.loggers)e.handleEndTransaction(i)}};function Ki(a,i){let e=new sF(a,i);try{a(e)}finally{e.finish()}}var ybt;function bY(a){if(ybt)a(ybt);else{let i=new sF(a,void 0);ybt=i;try{a(i)}finally{i.finish(),ybt=void 0}}}async function Jii(a,i){let e=new sF(a,i);try{await a(e)}finally{e.finish()}}function aF(a,i,e){a?i(a):Ki(i,e)}var sF=class{constructor(i,e){this._fn=i;this._getDebugName=e;this._updatingObservers=[];yg()?.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():v4e(this._fn)}updateObserver(i,e){if(!this._updatingObservers){Yii("Transaction already finished!"),Ki(t=>{t.updateObserver(i,e)});return}this._updatingObservers.push({observer:i,observable:e}),i.beginUpdate(e)}finish(){let i=this._updatingObservers;if(!i){Yii("transaction.finish() has already been called!");return}for(let e=0;e<i.length;e++){let{observer:t,observable:o}=i[e];t.endUpdate(o)}this._updatingObservers=null,yg()?.handleEndTransaction(this)}debugGetUpdatingObservers(){return this._updatingObservers}};var Dl;(t=>{let a=!1;function i(){a=!0}t.enable=i;function e(){if(!a)return;let o=Error,n=o.stackTraceLimit;o.stackTraceLimit=3;let r=new Error().stack;return o.stackTraceLimit=n,Zii.fromStack(r,2)}t.ofCaller=e})(Dl||={});var Zii=class a{constructor(i,e,t,o){this.fileName=i;this.line=e;this.column=t;this.id=o}static fromStack(i,e){let t=i.split(`
`),o=Jzo(t[e+1]);if(o)return new a(o.fileName,o.line,o.column,o.id)}};function Jzo(a){let i=a.match(/\((.*):(\d+):(\d+)\)/);if(i)return{fileName:i[1],line:parseInt(i[2]),column:parseInt(i[3]),id:a};let e=a.match(/at ([^\(\)]*):(\d+):(\d+)/);if(e)return{fileName:e[1],line:parseInt(e[2]),column:parseInt(e[3]),id:a}}var eoi;function V8i(a){eoi=a}var B8i;function H8i(a){B8i=a}var U8i;function z8i(a){U8i=a}var toi;function K8i(a){toi=a}var S4e=class{get TChange(){return null}reportChanges(){this.get()}read(i){return i?i.readObservable(this):this.get()}map(i,e,t=Dl.ofCaller()){let o=e===void 0?void 0:i,n=e===void 0?i:e;return eoi({owner:o,debugName:()=>{let r=v4e(n);if(r!==void 0)return r;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(n.toString());if(l)return`${this.debugName}.${l[2]}`;if(!o)return`${this.debugName} (mapped)`},debugReferenceFn:n},r=>n(this.read(r),r),t)}flatten(){return eoi({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},i=>this.read(i).read(i))}recomputeInitiallyAndOnChange(i,e){return i.add(B8i(this,e)),this}keepObserved(i){return i.add(U8i(this)),this}get debugValue(){return this.get()}get debug(){return new ioi(this)}},ioi=class{constructor(i){this.observable=i}getDependencyGraph(){return toi(this.observable,{type:"dependencies"})}getObserverGraph(){return toi(this.observable,{type:"observers"})}},DL=class extends S4e{constructor(e){super();this._observers=new Set;yg()?.handleObservableCreated(this,e)}addObserver(e){let t=this._observers.size;this._observers.add(e),t===0&&this.onFirstObserverAdded(),t!==this._observers.size&&yg()?.handleOnListenerCountChanged(this,this._observers.size)}removeObserver(e){let t=this._observers.delete(e);t&&this._observers.size===0&&this.onLastObserverRemoved(),t&&yg()?.handleOnListenerCountChanged(this,this._observers.size)}onFirstObserverAdded(){}onLastObserverRemoved(){}log(){let e=!!yg();return W8i(this),e||yg()?.handleObservableCreated(this,Dl.ofCaller()),this}debugGetObservers(){return this._observers}};function De(a,i,e=Dl.ofCaller()){let t;return typeof a=="string"?t=new yp(void 0,a,void 0):t=new yp(a,void 0,void 0),new gA(t,i,pv,e)}var gA=class extends DL{constructor(e,t,o,n){super(n);this._debugNameData=e;this._equalityComparator=o;this._value=t,yg()?.handleObservableUpdated(this,{hadValue:!1,newValue:t,change:void 0,didChange:!0,oldValue:void 0})}get debugName(){return this._debugNameData.getDebugName(this)??"ObservableValue"}get(){return this._value}set(e,t,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new sF(()=>{},()=>`Setting ${this.debugName}`));try{let r=this._value;this._setValue(e),yg()?.handleObservableUpdated(this,{oldValue:r,newValue:e,change:o,didChange:!0,hadValue:!0});for(let s of this._observers)t.updateObserver(s,this),s.handleChange(this,o)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}debugGetState(){return{value:this._value}}debugSetValue(e){this._value=e}};function IB(a,i,e=Dl.ofCaller()){let t;return typeof a=="string"?t=new yp(void 0,a,void 0):t=new yp(a,void 0,void 0),new ooi(t,i,pv,e)}var ooi=class extends gA{_setValue(i){this._value!==i&&(this._value&&this._value.dispose(),this._value=i)}dispose(){this._value?.dispose()}};var wbt=class extends DL{constructor(e,t,o,n){super(n);this._debugNameData=e;this._equalityComparator=o;this._isUpToDate=!0;this._deltas=[];this._updateCounter=0;this._value=t}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){yg()?.handleObservableUpdated(this,{change:e,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(let t of this._observers)t.handleChange(this,e)}this._deltas.length=0}else{yg()?.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 t of e)t.endUpdate(this)}}addObserver(e){let t=!this._observers.has(e)&&this._updateCounter>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){let t=this._observers.has(e)&&this._updateCounter>0;super.removeObserver(e),t&&e.endUpdate(this)}set(e,t,o){if(o===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new sF(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),o!==void 0&&this._deltas.push(o),t.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(r,s)=>{},handlePossibleChange:r=>{}},this),this._updateCounter>1)for(let r of this._observers)r.handlePossibleChange(this)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}};function Xm(a,i,e=Dl.ofCaller()){return a.lazy?new wbt(new yp(a.owner,a.debugName,void 0),i,a.equalsFn??pv,e):new gA(new yp(a.owner,a.debugName,void 0),i,a.equalsFn??pv,e)}function Zzo(a){switch(a){case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var yB=class{constructor(i,e,t,o){this._debugNameData=i;this._runFn=e;this._changeTracker=t;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),yg()?.handleAutorunCreated(this,o),this._run(),Hj(this)}get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}dispose(){if(!this._disposed){this._disposed=!0;for(let i of this._dependencies)i.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&this._store.dispose(),this._delayedStore!==void 0&&this._delayedStore.dispose(),yg()?.handleAutorunDisposed(this),Uj(this)}}_run(){let i=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=i,this._state=3;try{if(!this._disposed){yg()?.handleAutorunStarted(this);let e=this._changeSummary,t=this._delayedStore;t!==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){Z7(o)}finally{this._isRunning=!1,t!==void 0&&t.dispose()}}}finally{this._disposed||yg()?.handleAutorunFinished(this);for(let e of this._dependenciesToBeRemoved)e.removeObserver(this);this._dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(i){this._state===3&&(this._checkIterations(),this._state=1),this._updateCount++}endUpdate(i){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--}Wh(()=>this._updateCount>=0)}handlePossibleChange(i){this._state===3&&this._isDependency(i)&&(this._checkIterations(),this._state=1)}handleChange(i,e){if(this._isDependency(i)){yg()?.handleAutorunDependencyChanged(this,i,e);try{(!this._changeTracker||this._changeTracker.handleChange({changedObservable:i,change:e,didChange:o=>o===i},this._changeSummary))&&(this._checkIterations(),this._state=2)}catch(t){Z7(t)}}}_isDependency(i){return this._dependencies.has(i)&&!this._dependenciesToBeRemoved.has(i)}_ensureNoRunning(){if(!this._isRunning)throw new ci("The reader object cannot be used outside its compute function!")}readObservable(i){if(this._ensureNoRunning(),this._disposed)return i.get();i.addObserver(this);let e=i.get();return this._dependencies.add(i),this._dependenciesToBeRemoved.delete(i),e}get store(){if(this._ensureNoRunning(),this._disposed)throw new ci("Cannot access store after dispose");return this._store===void 0&&(this._store=new O),this._store}get delayedStore(){if(this._ensureNoRunning(),this._disposed)throw new ci("Cannot access store after dispose");return this._delayedStore===void 0&&(this._delayedStore=new O),this._delayedStore}debugGetState(){return{isRunning:this._isRunning,updateCount:this._updateCount,dependencies:this._dependencies,state:this._state,stateStr:Zzo(this._state)}}debugRerun(){this._isRunning?this._state=2:this._run()}_checkIterations(){return this._iteration>100?(Z7(new ci(`Autorun '${this.debugName}' is stuck in an infinite update loop.`)),!0):!1}};function ve(a,i=Dl.ofCaller()){return new yB(new yp(void 0,void 0,a),a,void 0,i)}function dD(a,i,e=Dl.ofCaller()){return new yB(new yp(a.owner,a.debugName,a.debugReferenceFn??i),i,void 0,e)}function fA(a,i,e=Dl.ofCaller()){return new yB(new yp(a.owner,a.debugName,a.debugReferenceFn??i),i,a.changeTracker,e)}function noi(a,i){let e=new O,t=fA({owner:a.owner,debugName:a.debugName,debugReferenceFn:a.debugReferenceFn??i,changeTracker:a.changeTracker},(o,n)=>{e.clear(),i(o,n,e)});return ee(()=>{t.dispose(),e.dispose()})}function Rl(a){let i=new O,e=dD({owner:void 0,debugName:void 0,debugReferenceFn:a},t=>{i.clear(),a(t,i)});return ee(()=>{e.dispose(),i.dispose()})}function Kle(a,i){let e;return dD({debugReferenceFn:i},t=>{let o=a.read(t),n=e;e=o,i({lastValue:n,newValue:o})})}function Gle(a,i,e=t=>t){let t=new Map;return dD({debugReferenceFn:a},o=>{let n=new Map,r=new Map(t);for(let s of a(o)){let l=e(s);t.has(l)?r.delete(l):(n.set(l,s),t.set(l,s))}for(let s of r.keys())t.delete(s);(n.size||r.size)&&i({addedValues:[...n.values()],removedValues:[...r.values()]})})}function I4e(a,i,e,t=Dl.ofCaller()){let o=new Map,n=dD({debugReferenceFn:e},r=>{let s=a.read(r),l=new Set,c=[];Ki(u=>{for(let p of s){let h=i(p);l.add(h);let g=o.get(h);if(g)g.value.set(p,u);else{let f=new O,b={value:De("keyedItem",p),store:f};o.set(h,b),c.push({key:h,cell:b})}}for(let[p,h]of o)l.has(p)||(h.store.dispose(),o.delete(p))});for(let{key:u,cell:p}of c)e(u,p.value,p.store)},t);return ee(()=>{n.dispose();for(let r of o.values())r.store.dispose();o.clear()})}function uD(a,i=Dl.ofCaller()){let e,t=!1;return e=ve(o=>{a({delayedStore:o.delayedStore,store:o.store,readObservable:o.readObservable.bind(o),dispose:()=>{e?.dispose(),t=!0}})},i),t&&e.dispose(),e}function roi(a,i,e=Dl.ofCaller()){let t,o=!1;t=ve(n=>{i({delayedStore:n.delayedStore,store:n.store,readObservable:n.readObservable.bind(n),dispose:()=>{t?a.delete(t):o=!0}})},e),o?t.dispose():a.add(t)}function eKo(a){switch(a){case 0:return"initial";case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}var Lb=class extends DL{constructor(e,t,o,n=void 0,r,s){super(s);this._debugNameData=e;this._computeFn=t;this._changeTracker=o;this._handleLastObserverRemoved=n;this._equalityComparator=r;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,yg()?.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 t;try{this._isReaderValid=!0;let o;this._changeTracker&&(o=this._changeTracker.createChangeSummary(void 0),this._changeTracker.beforeUpdate?.(this,o)),t=this._computeFn(this,o)}finally{this._isReaderValid=!1}return this.onLastObserverRemoved(),t}else{do{if(this._state===1){for(let t of this._dependencies)if(t.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 t=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=t;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 n=this._state!==0,r=this._value;this._state=3;let s=this._delayedStore;s!==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(),s!==void 0&&s.dispose()}e=this._didReportChange||n&&!this._equalityComparator(r,this._value),yg()?.handleObservableUpdated(this,{oldValue:r,newValue:this._value,change:void 0,didChange:e,hadValue:n})}catch(o){Z7(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 ci("Cyclic deriveds are not supported yet!");this._updateCount++,this._isUpdating=!0;try{let t=this._updateCount===1;if(this._state===3&&(this._state=1,!t))for(let o of this._observers)o.handlePossibleChange(this);if(t)for(let o of this._observers)o.beginUpdate(this)}finally{this._isUpdating=!1}}endUpdate(e){if(this._updateCount--,this._updateCount===0){let t=[...this._observers];for(let o of t)o.endUpdate(this);if(this._removedObserverToCallEndUpdateOn){let o=[...this._removedObserverToCallEndUpdateOn];this._removedObserverToCallEndUpdateOn=null;for(let n of o)n.endUpdate(this)}}Wh(()=>this._updateCount>=0)}handlePossibleChange(e){if(this._state===3&&this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)){this._state=1;for(let t of this._observers)t.handlePossibleChange(this)}}handleChange(e,t){if(this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)||this._isInBeforeUpdate){yg()?.handleDerivedDependencyChanged(this,e,t);let o=!1;try{o=this._changeTracker?this._changeTracker.handleChange({changedObservable:e,change:t,didChange:r=>r===e},this._changeSummary):!0}catch(r){Z7(r)}let n=this._state===3;if(o&&(this._state===1||n)&&(this._state=2,n))for(let r of this._observers)r.handlePossibleChange(this)}}_ensureReaderValid(){if(!this._isReaderValid)throw new ci("The reader object cannot be used outside its compute function!")}readObservable(e){this._ensureReaderValid(),e.addObserver(this);let t=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),t}reportChange(e){this._ensureReaderValid(),this._didReportChange=!0;for(let t of this._observers)t.handleChange(this,e)}get store(){return this._ensureReaderValid(),this._store===void 0&&(this._store=new O),this._store}get delayedStore(){return this._ensureReaderValid(),this._delayedStore===void 0&&(this._delayedStore=new O),this._delayedStore}addObserver(e){let t=!this._observers.has(e)&&this._updateCount>0;super.addObserver(e),t&&(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:eKo(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,t,o){this._value=e;let n=this._observers;t.updateObserver(this,this);for(let r of n)r.handleChange(this,o)}},kwe=class extends Lb{constructor(e,t,o,n=void 0,r,s,l){super(e,t,o,n,r,l);this.set=s}};function ke(a,i,e=Dl.ofCaller()){return i!==void 0?new Lb(new yp(a,void 0,i),i,void 0,void 0,pv,e):new Lb(new yp(void 0,void 0,a),a,void 0,void 0,pv,e)}function r5(a,i,e,t=Dl.ofCaller()){return new kwe(new yp(a,void 0,i),i,void 0,void 0,pv,e,t)}function Js(a,i,e=Dl.ofCaller()){return new Lb(new yp(a.owner,a.debugName,a.debugReferenceFn),i,void 0,a.onLastObserverRemoved,a.equalsFn??pv,e)}V8i(Js);function Ewe(a,i,e=Dl.ofCaller()){return new Lb(new yp(a.owner,a.debugName,void 0),i,a.changeTracker,void 0,a.equalityComparer??pv,e)}function Ry(a,i,e=Dl.ofCaller()){let t,o;i===void 0?(t=a,o=void 0):(o=a,t=i);let n;return new Lb(new yp(o,void 0,t),r=>{n?n.clear():n=new O;let s=t(r);return s&&n.add(s),s},void 0,()=>{n&&(n.dispose(),n=void 0)},pv,e)}var Cbt=class{constructor(i){this._computeValue=i;this._value=De(this,void 0)}get cachedValue(){return this._value}getValue(){let i=this._value.get();return i||(i=this._computeValue(),this._value.set(i,void 0)),i}},Uc=class a{constructor(i){this._value=De(this,void 0);this.promiseResult=this._value;this.resolvedValue=ke(this,i=>{let e=this.promiseResult.read(i);if(e)return e.getDataOrThrow()});this.promise=i.then(e=>(Ki(t=>{this._value.set(new y4e(e,void 0),t)}),e),e=>{throw Ki(t=>{this._value.set(new y4e(void 0,e),t)}),e})}static fromFn(i){return new a(i())}static resolved(i){return new a(Promise.resolve(i))}},y4e=class{constructor(i,e){this.data=i;this.error=e}getDataOrThrow(){if(this.error)throw this.error;return this.data}},w4e=class{constructor(i,e,t){this._isResolving=De(this,!1);this.isResolving=this._isResolving;this._lastResolved=De(this,e),this.lastResolved=this._lastResolved,t.add(ve(o=>{let n=i.read(o);this._runningPromise=n;let r=n.promiseResult.read(o);r?n===this._runningPromise&&(this._isResolving.set(!1,void 0),this._lastResolved.set(r.getDataOrThrow(),void 0)):this._isResolving.set(!0,void 0)}))}},C4e=class{constructor(i){this._computePromise=i;this._lazyValue=new Cbt(()=>new Uc(this._computePromise()));this.cachedPromiseResult=ke(this,i=>this._lazyValue.cachedValue.read(i)?.promiseResult.read(i))}getPromise(){return this._lazyValue.getValue().promise}};function yh(a,i,e,t){return i||(i=o=>o!=null),new Promise((o,n)=>{let r=!0,s=!1,l=a.map(u=>({isFinished:i(u),error:e?e(u):!1,state:u})),c=ve(u=>{let{isFinished:p,error:h,state:g}=l.read(u);(p||h)&&(r?s=!0:c.dispose(),h?n(h===!0?g:h):o(g))});if(t){let u=t.onCancellationRequested(()=>{c.dispose(),u.dispose(),n(new qi)});if(t.isCancellationRequested){c.dispose(),u.dispose(),n(new qi);return}}r=!1,s&&c.dispose()})}function vi(...a){let i,e,t,o;return a.length===2?[e,t]=a:[i,e,t,o]=a,new RL(new yp(i,void 0,t),e,t,()=>RL.globalTransaction,pv,o??Dl.ofCaller())}function Mb(a,i,e,t=Dl.ofCaller()){return new RL(new yp(a.owner,a.debugName,a.debugReferenceFn??e),i,e,()=>a.getTransaction?.()??RL.globalTransaction,a.equalsFn??pv,t)}var RL=class extends DL{constructor(e,t,o,n,r,s){super(s);this._debugNameData=e;this.event=t;this._getValue=o;this._getTransaction=n;this._equalityComparator=r;this._hasValue=!1;this.handleEvent=e=>{let t=this._getValue(e),o=this._value,n=!this._hasValue||!this._equalityComparator(o,t),r=!1;n&&(this._value=t,this._hasValue&&(r=!0,aF(this._getTransaction(),s=>{yg()?.handleObservableUpdated(this,{oldValue:o,newValue:t,change:void 0,didChange:n,hadValue:this._hasValue});for(let l of this._observers)s.updateObserver(l,this),l.handleChange(this,void 0)},()=>{let s=this.getDebugName();return"Event fired"+(s?`: ${s}`:"")})),this._hasValue=!0),r||yg()?.handleObservableUpdated(this,{oldValue:o,newValue:t,change:void 0,didChange:n,hadValue:this._hasValue})}}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=RL;function i(t,o){let n=!1;RL.globalTransaction===void 0&&(RL.globalTransaction=t,n=!0);try{o()}finally{n&&(RL.globalTransaction=void 0)}}e.batchEventsGlobally=i})(vi||={});function zc(a,i=Dl.ofCaller()){return typeof a=="string"?new xbt(a,void 0,i):new xbt(void 0,a,i)}var xbt=class extends DL{constructor(e,t,o){super(o);this._debugName=e;this._owner=t}get debugName(){return new yp(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}trigger(e,t){if(!e){Ki(o=>{this.trigger(o,t)},()=>`Trigger signal ${this.debugName}`);return}for(let o of this._observers)e.updateObserver(o,this),o.handleChange(this,t)}get(){}};function x4e(a){let i=De("promiseValue",{});return a.then(e=>{i.set({value:e},void 0)}),i}function vA(a,i,e=Dl.ofCaller()){let t=!1,o,n;return vi(void 0,r=>{let s=ve(l=>{let c=a.read(l);if(!t)t=!0,o=c;else{n&&clearTimeout(n);let u=typeof i=="number"?i:i(o,c);if(u===0){o=c,r();return}n=setTimeout(()=>{o=c,r()},u)}});return{dispose(){s.dispose(),t=!1,o=void 0}}},()=>t?o:a.get(),e)}function soi(a,i,e=Dl.ofCaller()){let t=!1,o,n;return vi(void 0,r=>{let s=ve(l=>{let c=a.read(l);t?n||(n=setTimeout(()=>{n=void 0,o=a.read(void 0),r()},i)):(t=!0,o=c)});return{dispose(){s.dispose(),n&&(clearTimeout(n),n=void 0),t=!1,o=void 0}}},()=>t?o:a.get(),e)}function aoi(a,i,e=Dl.ofCaller()){let t=zc("handleTimeout"),o,n;return Js({owner:void 0,onLastObserverRemoved:()=>{o=void 0}},s=>{let l=a.read(s);if(t.read(s),l!==o){let c=typeof i=="number"?i:i(o,l);if(c===0)return o=l,l;n&&clearTimeout(n),n=setTimeout(()=>{o=l,t.trigger(void 0)},c)}return o},e)}function loi(a,i,e){let t=De("triggeredRecently",!1),o;return e.add(a(()=>{t.set(!0,void 0),o&&clearTimeout(o),o=setTimeout(()=>{t.set(!1,void 0)},i)})),t}function Dz(a){let i=new kbt(!1,void 0);return a.addObserver(i),ee(()=>{a.removeObserver(i)})}z8i(Dz);function bA(a,i){let e=new kbt(!0,i);a.addObserver(e);try{e.beginUpdate(a)}finally{e.endUpdate(a)}return ee(()=>{a.removeObserver(e)})}H8i(bA);var kbt=class{constructor(i,e){this._forceRecompute=i;this._handleValue=e;this._counter=0}beginUpdate(i){this._counter++}endUpdate(i){this._counter===1&&this._forceRecompute&&(this._handleValue?this._handleValue(i.get()):i.reportChanges()),this._counter--}handlePossibleChange(i){}handleChange(i,e){}};function mv(a,i){let e;return Js({owner:a,debugReferenceFn:i},o=>(e=i(o,e),e))}function k4e(a,i){let e,t=zc("derivedObservableWithWritableCache"),o=ke(a,n=>(t.read(n),e=i(n,e),e));return Object.assign(o,{clearCache:n=>{e=void 0,t.trigger(n)},setCache:(n,r)=>{e=n,t.trigger(r)}})}function Pb(a,i,e,t){let o=new Ebt(e,t);return Js({debugReferenceFn:e,owner:a,onLastObserverRemoved:()=>{o.dispose(),o=new Ebt(e)}},r=>{let s=i.read(r);return o.setItems(s),o.getItems()})}var Ebt=class{constructor(i,e){this._map=i;this._keySelector=e;this._cache=new Map;this._items=[]}dispose(){this._cache.forEach(i=>i.store.dispose()),this._cache.clear()}setItems(i){let e=[],t=new Set(this._cache.keys());for(let o of i){let n=this._keySelector?this._keySelector(o):o,r=this._cache.get(n);if(r)t.delete(n);else{let s=new O;r={out:this._map(o,s),store:s},this._cache.set(n,r)}e.push(r.out)}for(let o of t)this._cache.get(o).store.dispose(),this._cache.delete(o);this._items=e}getItems(){return this._items}};function lF(a){return!!a&&a.read!==void 0&&a.reportChanges!==void 0}function coi(a){return{createChangeSummary:i=>({changes:[]}),handleChange(i,e){for(let t in a)i.didChange(a[t])&&e.changes.push({key:t,change:i.change});return!0},beforeUpdate(i,e){for(let t in a){if(t==="changes")throw new ci('property name "changes" is reserved for change tracking');e[t]=a[t].read(i)}}}}function doi(a){let i;return{createChangeSummary:e=>({changes:[]}),handleChange(e,t){i||(i=a());for(let o in i)e.didChange(i[o])&&t.changes.push({key:o,change:e.change});return!0},beforeUpdate(e,t){i||(i=a());for(let o in i){if(o==="changes")throw new ci('property name "changes" is reserved for change tracking');t[o]=i[o].read(e)}}}}function Fo(a){return new uoi(a)}var uoi=class extends S4e{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 qr(a,i,e=Dl.ofCaller()){return new poi(typeof a=="string"?a:new yp(a,void 0,void 0),i,e)}var poi=class extends DL{constructor(e,t,o){super(o);this.event=t;this.handleEvent=()=>{Ki(e=>{for(let t of this._observers)e.updateObserver(t,this),t.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 cF=class{constructor(i){this.observable=i}get onDidChange(){return U.fromObservableLight(this.observable)}get value(){return this.observable.get()}};function qle(a,i){return i instanceof cF?i.observable:vi(a,i.onDidChange,()=>i.value)}function Zs(a,i){let e,t=!0;return noi({changeTracker:{createChangeSummary:()=>({deltas:[],didChange:!1}),handleChange:(o,n)=>{if(o.didChange(a)){let r=o.change;r!==void 0&&n.deltas.push(r),n.didChange=!0}return!0}}},(o,n)=>{let r=a.read(o),s=e;n.didChange&&(e=r,i(r,s,n.deltas)),t&&(t=!1,e=r)})}function Tbt(a,i){let e=new O,t=Zs(a,(o,n,r)=>{e.clear(),i(o,n,r,e)});return{dispose(){t.dispose(),e.dispose()}}}function moi(a,i){return Tbt(a,(e,t,o,n)=>{i(e,t,o,wz(n))})}function E4e(a,i){if(i.length===0)throw new ci;let e=!1,t,o=vi(a,n=>{let r=new O;for(let s of i)r.add(dD({debugName:()=>Gii(o,new yp(a,void 0,void 0))+".updateLastChangedValue"},l=>{e=!0,t=s.read(l),n()}));return r.add({dispose(){e=!1,t=void 0}}),r},()=>e?t:i[i.length-1].get());return o}function hoi(a,i){return mv(a,(e,t)=>t??i(e))}var SY=class{constructor(){this._data=new Set;this._obs=Xm({equalsFn:()=>!1},this);this.observable=this._obs}get size(){return this._data.size}has(i){return this._data.has(i)}add(i,e){return this._data.has(i)||(this._data.add(i),this._obs.set(this,e)),this}delete(i,e){let t=this._data.delete(i);return t&&this._obs.set(this,e),t}clear(i){this._data.size>0&&(this._data.clear(),this._obs.set(this,i))}forEach(i,e){this._data.forEach((t,o,n)=>{i.call(e,t,o,this)})}*entries(){for(let i of this._data)yield[i,i]}*keys(){yield*this._data.keys()}*values(){yield*this._data.values()}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return"ObservableSet"}};var s5=class{constructor(){this._data=new Map;this._obs=Xm({equalsFn:()=>!1},this);this.observable=this._obs}get size(){return this._data.size}has(i){return this._data.has(i)}get(i){return this._data.get(i)}set(i,e,t){let o=this._data.has(i),n=this._data.get(i);return(!o||n!==e)&&(this._data.set(i,e),this._obs.set(this,t)),this}delete(i,e){let t=this._data.delete(i);return t&&this._obs.set(this,e),t}clear(i){this._data.size>0&&(this._data.clear(),this._obs.set(this,i))}forEach(i,e){this._data.forEach((t,o,n)=>{i.call(e,t,o,this)})}*entries(){yield*this._data.entries()}*keys(){yield*this._data.keys()}*values(){yield*this._data.values()}[Symbol.iterator](){return this.entries()}get[Symbol.toStringTag](){return"ObservableMap"}};var _bt;function G8i(a){_bt||(_bt=new T4e,b4e(_bt)),_bt.addFilteredObj(a)}var T4e=class{constructor(){this.indentation=0;this.changedObservablesSets=new WeakMap}addFilteredObj(i){this._filteredObjects||(this._filteredObjects=new Set),this._filteredObjects.add(i)}_isIncluded(i){return this._filteredObjects?.has(i)??!0}textToConsoleArgs(i){return tKo([Twe(nKo("|  ",this.indentation)),i])}formatInfo(i){return i.hadValue?i.didChange?[Twe(" "),dF(SA(i.oldValue,70),{color:"red",strikeThrough:!0}),Twe(" "),dF(SA(i.newValue,60),{color:"green"})]:[Twe(" (unchanged)")]:[Twe(" "),dF(SA(i.newValue,60),{color:"green"}),Twe(" (initial)")]}handleObservableCreated(i){if(i instanceof Lb){let e=i;if(this.changedObservablesSets.set(e,new Set),!1){let o=[];e.__debugUpdating=o;let n=e.beginUpdate;e.beginUpdate=s=>(o.push(s),n.apply(e,[s]));let r=e.endUpdate;e.endUpdate=s=>{let l=o.indexOf(s);return l===-1&&console.error("endUpdate called without beginUpdate",e.debugName,s.debugName),o.splice(l,1),r.apply(e,[s])}}}}handleOnListenerCountChanged(i,e){}handleObservableUpdated(i,e){if(this._isIncluded(i)){if(i instanceof Lb){this._handleDerivedRecomputed(i,e);return}console.log(...this.textToConsoleArgs([_we("observable value changed"),dF(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e)]))}}formatChanges(i){if(i.size!==0)return dF(" (changed deps: "+[...i].map(e=>e.debugName).join(", ")+")",{color:"gray"})}handleDerivedDependencyChanged(i,e,t){this._isIncluded(i)&&this.changedObservablesSets.get(i)?.add(e)}_handleDerivedRecomputed(i,e){if(!this._isIncluded(i))return;let t=this.changedObservablesSets.get(i);t&&(console.log(...this.textToConsoleArgs([_we("derived recomputed"),dF(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e),this.formatChanges(t),{data:[{fn:i._debugNameData.referenceFn??i._computeFn}]}])),t.clear())}handleDerivedCleared(i){this._isIncluded(i)&&console.log(...this.textToConsoleArgs([_we("derived cleared"),dF(i.debugName,{color:"BlueViolet"})]))}handleFromEventObservableTriggered(i,e){this._isIncluded(i)&&console.log(...this.textToConsoleArgs([_we("observable from event triggered"),dF(i.debugName,{color:"BlueViolet"}),...this.formatInfo(e),{data:[{fn:i._getValue}]}]))}handleAutorunCreated(i){this._isIncluded(i)&&this.changedObservablesSets.set(i,new Set)}handleAutorunDisposed(i){}handleAutorunDependencyChanged(i,e,t){this._isIncluded(i)&&this.changedObservablesSets.get(i).add(e)}handleAutorunStarted(i){let e=this.changedObservablesSets.get(i);e&&(this._isIncluded(i)&&console.log(...this.textToConsoleArgs([_we("autorun"),dF(i.debugName,{color:"BlueViolet"}),this.formatChanges(e),{data:[{fn:i._debugNameData.referenceFn??i._runFn}]}])),e.clear(),this.indentation++)}handleAutorunFinished(i){this.indentation--}handleBeginTransaction(i){let e=i.getDebugName();e===void 0&&(e=""),this._isIncluded(i)&&console.log(...this.textToConsoleArgs([_we("transaction"),dF(e,{color:"BlueViolet"}),{data:[{fn:i._fn}]}])),this.indentation++}handleEndTransaction(){this.indentation--}};function tKo(a){let i=new Array,e=[],t="";function o(r){if("length"in r)for(let s of r)s&&o(s);else"text"in r?(t+=`%c${r.text}`,i.push(r.style),r.data&&e.push(...r.data)):"data"in r&&e.push(...r.data)}o(a);let n=[t,...i];return n.push(...e),n}function Twe(a){return dF(a,{color:"black"})}function _we(a){return dF(rKo(`${a}: `,10),{color:"black",bold:!0})}function dF(a,i={color:"black"}){function e(o){return Object.entries(o).reduce((n,[r,s])=>`${n}${r}:${s};`,"")}let t={color:i.color};return i.strikeThrough&&(t["text-decoration"]="line-through"),i.bold&&(t["font-weight"]="bold"),{text:a,style:e(t)}}function SA(a,i){switch(typeof a){case"number":return""+a;case"string":return a.length+2<=i?`"${a}"`:`"${a.substr(0,i-7)}"+...`;case"boolean":return a?"true":"false";case"undefined":return"undefined";case"object":return a===null?"null":Array.isArray(a)?iKo(a,i):oKo(a,i);case"symbol":return a.toString();case"function":return`[[Function${a.name?" "+a.name:""}]]`;default:return""+a}}function iKo(a,i){let e="[ ",t=!0;for(let o of a){if(t||(e+=", "),e.length-5>i){e+="...";break}t=!1,e+=`${SA(o,i-e.length)}`}return e+=" ]",e}function oKo(a,i){if(typeof a.toString=="function"&&a.toString!==Object.prototype.toString){let n=a.toString();return n.length<=i?n:n.substring(0,i-3)+"..."}let e=qii(a),t=e?e+"(":"{ ",o=!0;for(let[n,r]of Object.entries(a)){if(o||(t+=", "),t.length-5>i){t+="...";break}o=!1,t+=`${n}: ${SA(r,i-t.length)}`}return t+=e?")":" }",t}function nKo(a,i){let e="";for(let t=1;t<=i;t++)e+=a;return e}function rKo(a,i){for(;a.length<i;)a+=" ";return a}var Dbt=class a{constructor(i,e){this._channelFactory=i;this._getHandler=e;this._channel=this._channelFactory({handleNotification:n=>{let r=n,s=this._getHandler().notifications[r[0]];if(!s)throw new Error(`Unknown notification "${r[0]}"!`);s(...r[1])},handleRequest:n=>{let r=n;try{return{type:"result",value:this._getHandler().requests[r[0]](...r[1])}}catch(s){return{type:"error",value:s}}}});let t=new Proxy({},{get:(n,r)=>async(...s)=>{let l=await this._channel.sendRequest([r,s]);if(l.type==="error")throw l.value;return l.value}}),o=new Proxy({},{get:(n,r)=>(...s)=>{this._channel.sendNotification([r,s])}});this.api={notifications:o,requests:t}}static createHost(i,e){return new a(i,e)}static createClient(i,e){return new a(i,e)}};function q8i(a,i){let e=globalThis,t=[],o,{channel:n,handler:r}=sKo({sendNotification:l=>{o?o.sendNotification(l):t.push(l)}}),s;return(e.$$debugValueEditor_debugChannels??(e.$$debugValueEditor_debugChannels={}))[a]=l=>{s=i(),o=l;for(let c of t)l.sendNotification(c);return t=[],r},Dbt.createClient(n,()=>{if(!s)throw new Error("Not supported");return s})}function sKo(a){let i;return{channel:t=>(i=t,{sendNotification:o=>{a.sendNotification(o)},sendRequest:o=>{throw new Error("not supported")}}),handler:{handleRequest:t=>t.type==="notification"?i?.handleNotification(t.data):i?.handleRequest(t.data)}}}var Rbt=class{constructor(){this._timeout=void 0}throttle(i,e){this._timeout===void 0&&(this._timeout=setTimeout(()=>{this._timeout=void 0,i()},e))}dispose(){this._timeout!==void 0&&clearTimeout(this._timeout)}};function goi(a,i){for(let e in i)a[e]&&typeof a[e]=="object"&&i[e]&&typeof i[e]=="object"?goi(a[e],i[e]):a[e]=i[e]}function foi(a,i){for(let e in i)i[e]===null?delete a[e]:a[e]&&typeof a[e]=="object"&&i[e]&&typeof i[e]=="object"?foi(a[e],i[e]):a[e]=i[e]}var Lbt=class a{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=q8i("observableDevTools",()=>({notifications:{setDeclarationIdFilter:i=>{},logObservableValue:i=>{console.log("logObservableValue",i)},flushUpdates:()=>{this._flushUpdates()},resetUpdates:()=>{this._pendingChanges=null,this._channel.api.notifications.handleChange(this._fullState,!0)}},requests:{getDeclarations:()=>{let i={};for(let e of this._declarations.values())i[e.id]=e;return{decls:i}},getSummarizedInstances:()=>null,getObservableValueInfo:i=>({observers:[...this._aliveInstances.get(i).debugGetObservers()].map(t=>this._formatObserver(t)).filter(so)}),getDerivedInfo:i=>{let e=this._aliveInstances.get(i);return{dependencies:[...e.debugGetState().dependencies].map(t=>this._formatObservable(t)).filter(so),observers:[...e.debugGetObservers()].map(t=>this._formatObserver(t)).filter(so)}},getAutorunInfo:i=>({dependencies:[...this._aliveInstances.get(i).debugGetState().dependencies].map(t=>this._formatObservable(t)).filter(so)}),getTransactionState:()=>this.getTransactionState(),setValue:(i,e)=>{let t=this._aliveInstances.get(i);if(t instanceof Lb)t.debugSetValue(e);else if(t instanceof gA)t.debugSetValue(e);else if(t instanceof RL)t.debugSetValue(e);else throw new ci("Observable is not supported");let o=[...t.debugGetObservers()];for(let n of o)n.beginUpdate(t);for(let n of o)n.handleChange(t,void 0);for(let n of o)n.endUpdate(t)},getValue:i=>{let e=this._aliveInstances.get(i);if(e instanceof Lb)return SA(e.debugGetState().value,200);if(e instanceof gA)return SA(e.debugGetState().value,200)},logValue:i=>{let e=this._aliveInstances.get(i);if(e&&"get"in e)console.log("Logged Value:",e.get());else throw new ci("Observable is not supported")},rerun:i=>{let e=this._aliveInstances.get(i);if(e instanceof Lb)e.debugRecompute();else if(e instanceof yB)e.debugRerun();else throw new ci("Observable is not supported")}}}));this._pendingChanges=null;this._changeThrottler=new Rbt;this._fullState={};this._flushUpdates=()=>{this._pendingChanges!==null&&(this._channel.api.notifications.handleChange(this._pendingChanges,!1),this._pendingChanges=null)};Dl.enable()}static{this._instance=void 0}static getInstance(){return a._instance===void 0&&(a._instance=new a),a._instance}getTransactionState(){let i=[],e=[...this._activeTransactions];if(e.length===0)return;let t=e.flatMap(n=>n.debugGetUpdatingObservers()??[]).map(n=>n.observer),o=new Set;for(;t.length>0;){let n=t.shift();if(o.has(n))continue;o.add(n);let r=this._getInfo(n,s=>{o.has(s)||t.push(s)});r&&i.push(r)}return{names:e.map(n=>n.getDebugName()??"tx"),affected:i}}_getObservableInfo(i){let e=this._instanceInfos.get(i);if(!e){mt(new ci("No info found"));return}return e}_getAutorunInfo(i){let e=this._instanceInfos.get(i);if(!e){mt(new ci("No info found"));return}return e}_getInfo(i,e){if(i instanceof Lb){let t=[...i.debugGetObservers()];for(let l of t)e(l);let o=this._getObservableInfo(i);if(!o)return;let n=i.debugGetState(),r={name:i.debugName,instanceId:o.instanceId,updateCount:n.updateCount},s=[...o.changedObservables].map(l=>this._instanceInfos.get(l)?.instanceId).filter(so);if(n.isComputing)return{...r,type:"observable/derived",state:"updating",changedDependencies:s,initialComputation:!1};switch(n.state){case 0:return{...r,type:"observable/derived",state:"noValue"};case 3:return{...r,type:"observable/derived",state:"upToDate"};case 2:return{...r,type:"observable/derived",state:"stale",changedDependencies:s};case 1:return{...r,type:"observable/derived",state:"possiblyStale"}}}else if(i instanceof yB){let t=this._getAutorunInfo(i);if(!t)return;let o={name:i.debugName,instanceId:t.instanceId,updateCount:t.updateCount},n=[...t.changedObservables].map(r=>this._instanceInfos.get(r).instanceId);if(i.debugGetState().isRunning)return{...o,type:"autorun",state:"updating",changedDependencies:n};switch(i.debugGetState().state){case 3:return{...o,type:"autorun",state:"upToDate"};case 2:return{...o,type:"autorun",state:"stale",changedDependencies:n};case 1:return{...o,type:"autorun",state:"possiblyStale"}}}}_formatObservable(i){let e=this._getObservableInfo(i);if(e)return{name:i.debugName,instanceId:e.instanceId}}_formatObserver(i){if(i instanceof Lb)return{name:i.toString(),instanceId:this._getObservableInfo(i)?.instanceId};let e=this._getAutorunInfo(i);if(e)return{name:i.toString(),instanceId:e.instanceId}}_handleChange(i){foi(this._fullState,i),this._pendingChanges===null?this._pendingChanges=i:goi(this._pendingChanges,i),this._changeThrottler.throttle(this._flushUpdates,10)}_getDeclarationId(i,e){if(!e)return-1;let t=this._declarations.get(e.id);return t===void 0&&(t={id:this._declarationId++,type:i,url:e.fileName,line:e.line,column:e.column},this._declarations.set(e.id,t),this._handleChange({decls:{[t.id]:t}})),t.id}handleObservableCreated(i,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(i,o)}handleOnListenerCountChanged(i,e){let t=this._getObservableInfo(i);if(t){if(t.listenerCount===0&&e>0){let o=i instanceof Lb?"observable/derived":"observable/value";this._aliveInstances.set(t.instanceId,i),this._handleChange({instances:{[t.instanceId]:{instanceId:t.instanceId,declarationId:t.declarationId,formattedValue:t.lastValue,type:o,name:i.debugName}}})}else t.listenerCount>0&&e===0&&(this._handleChange({instances:{[t.instanceId]:null}}),this._aliveInstances.delete(t.instanceId));t.listenerCount=e}}handleObservableUpdated(i,e){if(i instanceof Lb){this._handleDerivedRecomputed(i,e);return}let t=this._getObservableInfo(i);t&&e.didChange&&(t.lastValue=SA(e.newValue,30),t.listenerCount>0&&this._handleChange({instances:{[t.instanceId]:{formattedValue:t.lastValue}}}))}handleAutorunCreated(i,e){let o={declarationId:this._getDeclarationId("autorun",e),instanceId:this._instanceId++,updateCount:0,changedObservables:new Set};this._instanceInfos.set(i,o),this._aliveInstances.set(o.instanceId,i),o&&this._handleChange({instances:{[o.instanceId]:{instanceId:o.instanceId,declarationId:o.declarationId,runCount:0,type:"autorun",name:i.debugName}}})}handleAutorunDisposed(i){let e=this._getAutorunInfo(i);e&&(this._handleChange({instances:{[e.instanceId]:null}}),this._instanceInfos.delete(i),this._aliveInstances.delete(e.instanceId))}handleAutorunDependencyChanged(i,e,t){let o=this._getAutorunInfo(i);o&&o.changedObservables.add(e)}handleAutorunStarted(i){}handleAutorunFinished(i){let e=this._getAutorunInfo(i);e&&(e.changedObservables.clear(),e.updateCount++,this._handleChange({instances:{[e.instanceId]:{runCount:e.updateCount}}}))}handleDerivedDependencyChanged(i,e,t){let o=this._getObservableInfo(i);o&&o.changedObservables.add(e)}_handleDerivedRecomputed(i,e){let t=this._getObservableInfo(i);if(!t)return;let o=SA(e.newValue,30);t.updateCount++,t.changedObservables.clear(),t.lastValue=o,t.listenerCount>0&&this._handleChange({instances:{[t.instanceId]:{formattedValue:o,recomputationCount:t.updateCount}}})}handleDerivedCleared(i){let e=this._getObservableInfo(i);e&&(e.lastValue=void 0,e.changedObservables.clear(),e.listenerCount>0&&this._handleChange({instances:{[e.instanceId]:{formattedValue:void 0}}}))}handleBeginTransaction(i){this._activeTransactions.add(i)}handleEndTransaction(i){this._activeTransactions.delete(i)}};function $8i(a,i){let e=i?.debugNamePostProcessor??(n=>n),t=$le.from(a,e);if(!t)return"";let o=new Set;return i.type==="observers"?Q8i(t,0,o,i).trim():j8i(t,0,o,i).trim()}function j8i(a,i,e,t){let o="		".repeat(i),n=[];if(e.has(a.sourceObj))return n.push(`${o}* ${a.type} ${a.name} (already listed)`),n.join(`
`);if(e.add(a.sourceObj),n.push(`${o}* ${a.type} ${a.name}:`),n.push(`${o}  value: ${SA(a.value,50)}`),n.push(`${o}  state: ${a.state}`),a.dependencies.length>0){n.push(`${o}  dependencies:`);for(let s of a.dependencies){let l=$le.from(s,t.debugNamePostProcessor??(c=>c))??$le.unknown(s);n.push(j8i(l,i+1,e,t))}}return n.join(`
`)}function Q8i(a,i,e,t){let o="		".repeat(i),n=[];if(e.has(a.sourceObj))return n.push(`${o}* ${a.type} ${a.name} (already listed)`),n.join(`
`);if(e.add(a.sourceObj),n.push(`${o}* ${a.type} ${a.name}:`),n.push(`${o}  value: ${SA(a.value,50)}`),n.push(`${o}  state: ${a.state}`),a.observers.length>0){n.push(`${o}  observers:`);for(let s of a.observers){let l=$le.from(s,t.debugNamePostProcessor??(c=>c))??$le.unknown(s);n.push(Q8i(l,i+1,e,t))}}return n.join(`
`)}var $le=class a{constructor(i,e,t,o,n,r,s){this.sourceObj=i;this.name=e;this.type=t;this.value=o;this.state=n;this.dependencies=r;this.observers=s}static from(i,e){if(i instanceof yB){let t=i.debugGetState();return new a(i,e(i.debugName),"autorun",void 0,t.stateStr,Array.from(t.dependencies),[])}else if(i instanceof Lb){let t=i.debugGetState();return new a(i,e(i.debugName),"derived",t.value,t.stateStr,Array.from(t.dependencies),Array.from(i.debugGetObservers()))}else if(i instanceof gA){let t=i.debugGetState();return new a(i,e(i.debugName),"observableValue",t.value,"upToDate",[],Array.from(i.debugGetObservers()))}else if(i instanceof RL){let t=i.debugGetState();return new a(i,e(i.debugName),"fromEvent",t.value,t.hasValue?"upToDate":"initial",[],Array.from(i.debugGetObservers()))}}static unknown(i){return new a(i,"(unknown)","unknown",void 0,"unknown",[],[])}};K8i($8i);F8i(G8i);var aKo=!1;aKo&&b4e(new T4e);Sp&&Sp.VSCODE_DEV_DEBUG_OBSERVABLES&&b4e(Lbt.getInstance());var{registerWindow:iQi,getWindow:Me,getDocument:Qle,getWindows:dx,getWindowsCount:Dwe,getWindowId:hv,getWindowById:gv,hasWindow:yY,onDidRegisterWindow:Of,onWillUnregisterWindow:oQi,onDidUnregisterWindow:nQi}=(function(){let a=new Map;dvt(ut,1);let i={window:ut,disposables:new O};a.set(ut.vscodeWindowId,i);let e=new T,t=new T,o=new T;function n(r,s){return(typeof r=="number"?a.get(r):void 0)??(s?i:void 0)}return{onDidRegisterWindow:e.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:t.event,registerWindow(r){if(a.has(r.vscodeWindowId))return k.None;let s=new O,l={window:r,disposables:s.add(new O)};return a.set(r.vscodeWindowId,l),s.add(ee(()=>{a.delete(r.vscodeWindowId),t.fire(r)})),s.add($(r,ne.BEFORE_UNLOAD,()=>{o.fire(r)})),e.fire(l),s},getWindows(){return a.values()},getWindowsCount(){return a.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return a.has(r)},getWindowById:n,getWindow(r){let s=r;if(s?.ownerDocument?.defaultView)return s.ownerDocument.defaultView.window;let l=r;return l?.view?l.view.window:ut},getDocument(r){return Me(r).document}}})(),Pbt=new Set;function rQi(a){return Pbt.add(a),ee(()=>{Pbt.delete(a)})}function lKo(){for(let a of Pbt)if(a().hasFocus)return!0;return!1}function cKo(){for(let a of Pbt){let i=a();if(i.hasFocus&&i.window)return i.window}}function sQi(){for(let{window:a}of dx())if(a.document.hasFocus())return!0;return!!lKo()}function St(a){for(;a.firstChild;)a.firstChild.remove()}var voi=class{constructor(i,e,t,o){this._node=i,this._type=e,this._handler=t,this._options=o||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function $(a,i,e,t){return new voi(a,i,e,t)}function Coi(a,i){return function(e){return i(new Ln(a,e))}}function dKo(a){return function(i){return a(new mi(i))}}var Yo=function(i,e,t,o){let n=t;return e==="click"||e==="mousedown"||e==="contextmenu"?n=Coi(Me(i),t):(e==="keydown"||e==="keypress"||e==="keyup")&&(n=dKo(t)),$(i,e,n,o)},Rwe=function(i,e,t){let o=Coi(Me(i),e);return ML(i,o,t)},Abt=function(i,e,t){let o=Coi(Me(i),e);return Yle(i,o,t)};function ML(a,i,e){return $(a,Tc&&of.pointerEvents?ne.POINTER_DOWN:ne.MOUSE_DOWN,i,e)}function Lwe(a,i,e){return $(a,Tc&&of.pointerEvents?ne.POINTER_MOVE:ne.MOUSE_MOVE,i,e)}function Yle(a,i,e){return $(a,Tc&&of.pointerEvents?ne.POINTER_UP:ne.MOUSE_UP,i,e)}function Ff(a,i,e){return gwe(a,i,e)}var uF=class extends m4e{constructor(i,e){super(i,e)}},Cg,kr;function Ly(a,i,e,t){let o=0,n=a.setInterval(()=>{o++,(typeof t=="number"&&o>=t||i()===!0)&&r.dispose()},e),r=ee(()=>{a.clearInterval(n)});return r}var LL=class extends ky{constructor(i){super(),this.defaultTarget=i&&Me(i)}cancelAndSet(i,e,t){return super.cancelAndSet(i,e,t??this.defaultTarget)}},_4e=class{constructor(i,e=0){this._runner=i,this.priority=e,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(i){mt(i)}}static sort(i,e){return e.priority-i.priority}};(function(){let a=new Map,i=new Map,e=new Map,t=new Map,o=n=>{e.set(n,!1);let r=a.get(n)??[];for(i.set(n,r),a.set(n,[]),t.set(n,!0);r.length>0;)r.sort(_4e.sort),r.shift().execute();t.set(n,!1)};kr=(n,r,s=0)=>{let l=hv(n),c=new _4e(r,s),u=a.get(l);return u||(u=[],a.set(l,u)),u.push(c),e.get(l)||(e.set(l,!0),n.requestAnimationFrame(()=>o(l))),c},Cg=(n,r,s)=>{let l=hv(n);if(t.get(l)){let c=new _4e(r,s),u=i.get(l);return u||(u=[],i.set(l,u)),u.push(c),c}else return kr(n,r,s)}})();function xoi(a,i){return kr(a,i,1e4)}function wY(a,i){return kr(a,i,-1e4)}var IY=class{constructor(i,e){this.pendingRunner=new ue;this.node=i,this.runner=e}dispose(){this.pendingRunner.dispose()}cancel(){this.pendingRunner.clear()}schedule(){this.pendingRunner.value||(this.pendingRunner.value=Cg(Me(this.node),()=>{this.pendingRunner.clear(),this.runner()}))}isScheduled(){return this.pendingRunner.value!==void 0}};function mF(a){return Me(a).getComputedStyle(a,null)}function wh(a,i,e){let t=Me(a),o=t.document;if(a!==o.body)return new di(a.clientWidth,a.clientHeight);if(Tc&&t?.visualViewport)return new di(t.visualViewport.width,t.visualViewport.height);if(t?.innerWidth&&t.innerHeight)return new di(t.innerWidth,t.innerHeight);if(o.body&&o.body.clientWidth&&o.body.clientHeight)return new di(o.body.clientWidth,o.body.clientHeight);if(o.documentElement&&o.documentElement.clientWidth&&o.documentElement.clientHeight)return new di(o.documentElement.clientWidth,o.documentElement.clientHeight);if(e)return wh(e,i);if(i)return i;throw new Error("Unable to figure out browser width and height")}var cx=class a{static convertToPixels(i,e){return parseFloat(e)||0}static getDimension(i,e){let t=mF(i),o=t?t.getPropertyValue(e):"0";return a.convertToPixels(i,o)}static getBorderLeftWidth(i){return a.getDimension(i,"border-left-width")}static getBorderRightWidth(i){return a.getDimension(i,"border-right-width")}static getBorderTopWidth(i){return a.getDimension(i,"border-top-width")}static getBorderBottomWidth(i){return a.getDimension(i,"border-bottom-width")}static getPaddingLeft(i){return a.getDimension(i,"padding-left")}static getPaddingRight(i){return a.getDimension(i,"padding-right")}static getPaddingTop(i){return a.getDimension(i,"padding-top")}static getPaddingBottom(i){return a.getDimension(i,"padding-bottom")}static getMarginLeft(i){return a.getDimension(i,"margin-left")}static getMarginTop(i){return a.getDimension(i,"margin-top")}static getMarginRight(i){return a.getDimension(i,"margin-right")}static getMarginBottom(i){return a.getDimension(i,"margin-bottom")}},di=class a{constructor(i,e){this.width=i;this.height=e}static{this.None=new a(0,0)}with(i=this.width,e=this.height){return i!==this.width||e!==this.height?new a(i,e):this}static is(i){return typeof i=="object"&&typeof i.height=="number"&&typeof i.width=="number"}static lift(i){return i instanceof a?i:new a(i.width,i.height)}static equals(i,e){return i===e?!0:!i||!e?!1:i.width===e.width&&i.height===e.height}};function pF(a){let i=a.offsetParent,e=a.offsetTop,t=a.offsetLeft;for(;(a=a.parentNode)!==null&&a!==a.ownerDocument.body&&a!==a.ownerDocument.documentElement;){e-=a.scrollTop;let o=dQi(a)?null:mF(a);o&&(t-=o.direction!=="rtl"?a.scrollLeft:-a.scrollLeft),a===i&&(t+=cx.getBorderLeftWidth(a),e+=cx.getBorderTopWidth(a),e+=a.offsetTop,t+=a.offsetLeft,i=a.offsetParent)}return{left:t,top:e}}function PL(a,i,e){typeof i=="number"&&(a.style.width=`${i}px`),typeof e=="number"&&(a.style.height=`${e}px`)}function aQi(a,i,e,t,o,n="absolute"){typeof i=="number"&&(a.style.top=`${i}px`),typeof e=="number"&&(a.style.right=`${e}px`),typeof t=="number"&&(a.style.bottom=`${t}px`),typeof o=="number"&&(a.style.left=`${o}px`),a.style.position=n}function ur(a){let i=a.getBoundingClientRect(),e=Me(a);return{left:i.left+e.scrollX,top:i.top+e.scrollY,width:i.width,height:i.height}}function CY(a){let i=a,e=1;do{let t=mF(i).zoom;t!=null&&t!=="1"&&(e*=t),i=i.parentElement}while(i!==null&&i!==i.ownerDocument.documentElement);return e}function Dc(a){let i=cx.getMarginLeft(a)+cx.getMarginRight(a);return a.offsetWidth+i}function xY(a){let i=cx.getBorderLeftWidth(a)+cx.getBorderRightWidth(a),e=cx.getPaddingLeft(a)+cx.getPaddingRight(a);return a.offsetWidth-i-e}function uKo(a){let i=cx.getMarginLeft(a)+cx.getMarginRight(a);return a.scrollWidth+i}function Mwe(a){let i=cx.getBorderTopWidth(a)+cx.getBorderBottomWidth(a),e=cx.getPaddingTop(a)+cx.getPaddingBottom(a);return a.offsetHeight-i-e}function Uh(a){let i=cx.getMarginTop(a)+cx.getMarginBottom(a);return a.offsetHeight+i}function pKo(a,i){if(a===null)return 0;let e=pF(a),t=pF(i);return e.left-t.left}function Pwe(a,i){let e=i.map(o=>Math.max(uKo(o),Dc(o))+pKo(o,a)||0);return Math.max(...e)}function ms(a,i){return!!i?.contains(a)}var lQi="parentFlowToElementId";function AL(a,i){a.dataset[lQi]=i.id}function mKo(a){let i=a.dataset[lQi];return typeof i=="string"?a.ownerDocument.getElementById(i):null}function cQi(a,i){let e=a;for(;e;){if(e===i)return!0;if(go(e)){let t=mKo(e);if(t){e=t;continue}}e=e.parentNode}return!1}function rf(a,i,e){for(;a&&a.nodeType===a.ELEMENT_NODE;){if(a.classList.contains(i))return a;if(e){if(typeof e=="string"){if(a.classList.contains(e))return null}else if(a===e)return null}a=a.parentNode}return null}function Awe(a,i,e){return!!rf(a,i,e)}function dQi(a){return a&&!!a.host&&!!a.mode}function a5(a){return!!IA(a)}function IA(a){for(;a.parentNode;){if(a===a.ownerDocument?.body)return null;a=a.parentNode}return dQi(a)?a:null}function Un(){let a=_m().activeElement;for(;a?.shadowRoot;)a=a.shadowRoot.activeElement;return a}function Na(a){return Un()===a}function Is(a){return ms(Un(),a)}function Nbt(a){return a.ownerDocument===_m()}function _m(){if(Dwe()<=1)return ut.document;let i=Array.from(dx()).map(({window:t})=>t.document).find(t=>t.hasFocus());if(i)return i;let e=cKo();return e?e.document:ut.document}function zi(){return _m().defaultView?.window??ut}var R4e=new class{constructor(){this.mutationObservers=new Map}observe(a,i,e){let t=this.mutationObservers.get(a);t||(t=new Map,this.mutationObservers.set(a,t));let o=Lr(e),n=t.get(o);if(n)n.users+=1;else{let r=new T,s=new MutationObserver(c=>r.fire(c));s.observe(a,e);let l=n={users:1,observer:s,onDidMutate:r.event};i.add(ee(()=>{l.users-=1,l.users===0&&(r.dispose(),s.disconnect(),t?.delete(o),t?.size===0&&this.mutationObservers.delete(a))})),t.set(o,n)}return n.onDidMutate}};function Obt(a=ut.document.head){return uQi("meta",a)}function Fbt(a=ut.document.head){return uQi("link",a)}function uQi(a,i=ut.document.head){let e=document.createElement(a);return i.appendChild(e),e}function go(a){return a instanceof HTMLElement||a instanceof Me(a).HTMLElement}function L4e(a){return a instanceof HTMLAnchorElement||a instanceof Me(a).HTMLAnchorElement}function kY(a){return a instanceof HTMLTextAreaElement||a instanceof Me(a).HTMLTextAreaElement}function Xle(a){return a instanceof HTMLInputElement||a instanceof Me(a).HTMLInputElement}function pQi(a){return a instanceof HTMLButtonElement||a instanceof Me(a).HTMLButtonElement}function koi(a){return a instanceof HTMLDivElement||a instanceof Me(a).HTMLDivElement}function Eoi(a){return a instanceof SVGElement||a instanceof Me(a).SVGElement}function Wp(a){return a instanceof MouseEvent||a instanceof Me(a).MouseEvent}function sf(a){return a instanceof KeyboardEvent||a instanceof Me(a).KeyboardEvent}function Wbt(a){return a instanceof PointerEvent||a instanceof Me(a).PointerEvent}function mQi(a){return a instanceof DragEvent||a instanceof Me(a).DragEvent}var ne={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:dB?"webkitAnimationStart":"animationstart",ANIMATION_END:dB?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:dB?"webkitAnimationIteration":"animationiteration"};function Vbt(a){let i=a;return!!(i&&typeof i.preventDefault=="function"&&typeof i.stopPropagation=="function")}var Kt={stop:(a,i)=>(a.preventDefault(),i&&a.stopPropagation(),a)};function hQi(a){let i=[];for(let e=0;a&&a.nodeType===a.ELEMENT_NODE;e++)i[e]=a.scrollTop,a=a.parentNode;return i}function gQi(a,i){for(let e=0;a&&a.nodeType===a.ELEMENT_NODE;e++)a.scrollTop!==i[e]&&(a.scrollTop=i[e]),a=a.parentNode}var boi=class a extends k{constructor(e){super();this._onDidFocus=this._register(new T);this._onDidBlur=this._register(new T);let t=a.hasFocusWithin(e),o=!1,n=()=>{o=!1,t||(t=!0,this._onDidFocus.fire())},r=()=>{t&&(o=!0,(go(e)?Me(e):e).setTimeout(()=>{o&&(o=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{a.hasFocusWithin(e)!==t&&(t?r():n())},this._register($(e,ne.FOCUS,n,!0)),this._register($(e,ne.BLUR,r,!0)),go(e)&&(this._register($(e,ne.FOCUS_IN,()=>this._refreshStateHandler())),this._register($(e,ne.FOCUS_OUT,()=>this._refreshStateHandler())))}get onDidFocus(){return this._onDidFocus.event}get onDidBlur(){return this._onDidBlur.event}static hasFocusWithin(e){if(go(e)){let t=IA(e),o=t?t.activeElement:e.ownerDocument.activeElement;return ms(o,e)}else{let t=e;return ms(t.document.activeElement,t.document)}}refreshState(){this._refreshStateHandler()}};function nr(a){return new boi(a)}function Bbt(a,i){return a.after(i),i}function D(a,...i){if(a.append(...i),i.length===1&&typeof i[0]!="string")return i[0]}function CI(a,i){return a.insertBefore(i,a.firstChild),i}function Ii(a,...i){a.textContent="",D(a,...i)}var hKo=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function fQi(a,i,e,...t){let o=hKo.exec(i);if(!o)throw new Error("Bad use of emmet");let n=o[1]||"div",r;return a!=="http://www.w3.org/1999/xhtml"?r=document.createElementNS(a,n):r=document.createElement(n),o[3]&&(r.id=o[3]),o[4]&&(r.className=o[4].replace(/\./g," ").trim()),e&&Object.entries(e).forEach(([s,l])=>{typeof l>"u"||(/^on\w+$/.test(s)?r[s]=l:s==="selected"?l&&r.setAttribute(s,"true"):r.setAttribute(s,l))}),r.append(...t),r}function _(a,i,...e){return fQi("http://www.w3.org/1999/xhtml",a,i,...e)}_.SVG=function(a,i,...e){return fQi("http://www.w3.org/2000/svg",a,i,...e)};function Md(a,...i){a?Xo(...i):Wi(...i)}function Xo(...a){for(let i of a)i.style.display="",i.removeAttribute("aria-hidden")}function Wi(...a){for(let i of a)i.style.display="none",i.setAttribute("aria-hidden","true")}function Nwe(a){return i=>{i.preventDefault(),i.stopPropagation(),a(i)}}function vQi(a){return new Promise(i=>{if(a.document.readyState==="complete"||a.document&&a.document.body!==null)i(void 0);else{let t=()=>{a.window.removeEventListener("DOMContentLoaded",t,!1),i()};a.window.addEventListener("DOMContentLoaded",t,!1)}})}function Owe(a,i){let e=a.devicePixelRatio*i;return Math.max(1,Math.floor(e))/a.devicePixelRatio}function M4e(a){ut.open(a,"_blank","noopener")}var Y8i=780,X8i=640;function Toi(a){let i=Math.floor(ut.screenLeft+ut.innerWidth/2-Y8i/2),e=Math.floor(ut.screenTop+ut.innerHeight/2-X8i/2);ut.open(a,"_blank",`width=${Y8i},height=${X8i},top=${e},left=${i}`)}function bQi(a,i=!0){let e=ut.open();return e?(i&&(e.opener=null),e.location.href=a,!0):!1}function SQi(a,i){let e=()=>{i(),t=kr(a,e)},t=kr(a,e);return ee(()=>t.dispose())}xL.setPreferredWebSchema(/^https:/.test(ut.location.href)?"https":"http");function IQi(a,i){let e;if(A.isUri(a))e=a.toString(!0);else{let n=new Blob([a]);e=URL.createObjectURL(n),setTimeout(()=>URL.revokeObjectURL(e))}let t=zi(),o=document.createElement("a");t.document.body.appendChild(o),o.download=i,o.href=e,o.click(),setTimeout(()=>o.remove())}function yQi(){return new Promise(a=>{let i=zi(),e=document.createElement("input");i.document.body.appendChild(e),e.type="file",e.multiple=!0,U.once(U.fromDOMEventEmitter(e,"input"))(()=>{a(e.files??void 0)}),e.click(),setTimeout(()=>e.remove())})}var Ab=class a extends T{constructor(){super();this._subscriptions=new O;this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(U.runAndSubscribe(Of,({window:e,disposables:t})=>this.registerListeners(e,t),{window:ut,disposables:this._subscriptions}))}registerListeners(e,t){t.add($(e,"keydown",o=>{if(o.defaultPrevented)return;let n=new mi(o);if(!(n.keyCode===6&&o.repeat)){if(o.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(o.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(o.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(o.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(n.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=o.altKey,this._keyStatus.ctrlKey=o.ctrlKey,this._keyStatus.metaKey=o.metaKey,this._keyStatus.shiftKey=o.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=o,this.fire(this._keyStatus))}},!0)),t.add($(e,"keyup",o=>{o.defaultPrevented||(!o.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!o.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!o.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!o.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=o.altKey,this._keyStatus.ctrlKey=o.ctrlKey,this._keyStatus.metaKey=o.metaKey,this._keyStatus.shiftKey=o.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=o,this.fire(this._keyStatus)))},!0)),t.add($(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add($(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add($(e.document.body,"mousemove",o=>{o.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add($(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}get isModifierPressed(){return zvt(this._keyStatus)}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return a.instance||(a.instance=new a),a.instance}static disposeInstance(){a.instance&&(a.instance.dispose(),a.instance=void 0)}dispose(){super.dispose(),this._subscriptions.dispose()}};var wg=class extends k{constructor(e,t){super();this.element=e;this.callbacks=t;this.counter=0;this.dragStartTime=0;this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register($(this.element,ne.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register($(this.element,ne.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register($(this.element,ne.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register($(this.element,ne.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register($(this.element,ne.DRAG_LEAVE,e=>{this.counter--,this.counter===0&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register($(this.element,ne.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register($(this.element,ne.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}},zu=class extends k{constructor(i,e,t=ut,o){super(),this.name=i;let n=o?.resizeObserverCtor??t.ResizeObserver;this.observer=new n((r,s)=>{Mbt=this,setTimeout(()=>{Mbt===this&&(Mbt=void 0)},0);try{e(r,s)}catch(l){mt(l)}}),this._register(ee(()=>this.observer.disconnect()))}observe(i,e){return this.observer.observe(i,e),ee(()=>this.observer.unobserve(i))}},Mbt;function wQi(a){if(typeof a!="string"||!a.includes("ResizeObserver loop"))return;let i=Mbt;if(i)return`[DisposableResizeObserver(${i.name})] ${a}`}var CQi=/(?<tag>[\w\-]+)?(?:#(?<id>[\w\-]+))?(?<class>(?:\.(?:[\w\-]+))*)(?:@(?<name>(?:[\w\_])+))?/;function st(a,...i){let e,t;Array.isArray(i[0])?(e={},t=i[0]):(e=i[0]||{},t=i[1]);let o=CQi.exec(a);if(!o||!o.groups)throw new Error("Bad use of h");let n=o.groups.tag||"div",r=document.createElement(n);o.groups.id&&(r.id=o.groups.id);let s=[];if(o.groups.class)for(let c of o.groups.class.split("."))c!==""&&s.push(c);if(e.className!==void 0)for(let c of e.className.split("."))c!==""&&s.push(c);s.length>0&&(r.className=s.join(" "));let l={};if(o.groups.name&&(l[o.groups.name]=r),t)for(let c of t)go(c)?r.appendChild(c):typeof c=="string"?r.append(c):"root"in c&&(Object.assign(l,c),r.appendChild(c.root));for(let[c,u]of Object.entries(e))if(c!=="className")if(c==="style")for(let[p,h]of Object.entries(u))r.style.setProperty(jle(p),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?r.tabIndex=u:r.setAttribute(jle(c),u.toString());return l.root=r,l}function xQi(a,...i){let e,t;Array.isArray(i[0])?(e={},t=i[0]):(e=i[0]||{},t=i[1]);let o=CQi.exec(a);if(!o||!o.groups)throw new Error("Bad use of h");let n=o.groups.tag||"div",r=document.createElementNS("http://www.w3.org/2000/svg",n);o.groups.id&&(r.id=o.groups.id);let s=[];if(o.groups.class)for(let c of o.groups.class.split("."))c!==""&&s.push(c);if(e.className!==void 0)for(let c of e.className.split("."))c!==""&&s.push(c);s.length>0&&(r.className=s.join(" "));let l={};if(o.groups.name&&(l[o.groups.name]=r),t)for(let c of t)go(c)?r.appendChild(c):typeof c=="string"?r.append(c):"root"in c&&(Object.assign(l,c),r.appendChild(c.root));for(let[c,u]of Object.entries(e))if(c!=="className")if(c==="style")for(let[p,h]of Object.entries(u))r.style.setProperty(jle(p),typeof h=="number"?h+"px":""+h);else c==="tabIndex"?r.tabIndex=u:r.setAttribute(jle(c),u.toString());return l.root=r,l}function jle(a){return a.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Hbt(a,i,e){for(let{name:t,value:o}of a.attributes)(!e||e.includes(t))&&i.setAttribute(t,o)}function gKo(a,i,e){let t=a.getAttribute(e);t?i.setAttribute(e,t):i.removeAttribute(e)}function Ubt(a,i,e){Hbt(a,i,e);let t=new O;return t.add(R4e.observe(a,t,{attributes:!0,attributeFilter:e})(o=>{for(let n of o)n.type==="attributes"&&n.attributeName&&gKo(a,i,n.attributeName)})),t}function Ch(a){return a.tagName.toLowerCase()==="input"||a.tagName.toLowerCase()==="textarea"||go(a)&&!!a.editContext}var D4e=class{constructor(i,e,t){this.originX=i;this.originY=e;this.points=new Int16Array(8);let{top:o,left:n,right:r,bottom:s}=t.getBoundingClientRect(),l=this.points,c=0;l[c++]=n,l[c++]=o,l[c++]=r,l[c++]=o,l[c++]=n,l[c++]=s,l[c++]=r,l[c++]=s}contains(i,e){let{points:t,originX:o,originY:n}=this;for(let r=0;r<4;r++){let s=2*r,l=2*((r+1)%4);if(R8i(i,e,o,n,t[s],t[s+1],t[l],t[l+1]))return!0}return!1}},$o;(s=>{function a(l=void 0){return(c,u,p)=>{let h=u.class;delete u.class;let g=u.ref;delete u.ref;let f=u.obsRef;return delete u.obsRef,new yoi(c,g,f,l,h,u,p)}}function i(l,c=void 0){let u=a(c);return(p,h)=>u(l,p,h)}s.div=i("div"),s.elem=a(void 0),s.svg=i("svg","http://www.w3.org/2000/svg"),s.svgElem=a("http://www.w3.org/2000/svg");function r(){let l,c=function(u){l=u};return Object.defineProperty(c,"element",{get(){if(!l)throw new ci("Make sure the ref is set before accessing the element. Maybe wrong initialization order?");return l}}),c}s.ref=r})($o||={});var Soi=class a{constructor(i,e,t,o,n,r,s){this._deriveds=[];this._isHovered=void 0;this._didMouseMoveDuringHover=void 0;this._element=o?document.createElementNS(o,i):document.createElement(i),e&&e(this._element),t&&this._deriveds.push(ke(l=>{t(this),l.store.add({dispose:()=>{t(null)}})})),n&&(EQi(n)?this._deriveds.push(ke(this,l=>{J8i(this._element,Z8i(n,l))})):J8i(this._element,Z8i(n,void 0)));for(let[l,c]of Object.entries(r))if(l==="style")for(let[u,p]of Object.entries(c)){let h=jle(u);lF(p)?this._deriveds.push(Js({owner:this,debugName:()=>`set.style.${h}`},g=>{this._element.style.setProperty(h,eQi(p.read(g)))})):this._element.style.setProperty(h,eQi(p))}else l==="tabIndex"?lF(c)?this._deriveds.push(ke(this,u=>{this._element.tabIndex=c.read(u)})):this._element.tabIndex=c:l.startsWith("on")?this._element[l]=c:lF(c)?this._deriveds.push(Js({owner:this,debugName:()=>`set.${l}`},u=>{tQi(this._element,l,c.read(u))})):tQi(this._element,l,c);if(s){let l=function(u,p){return lF(p)?l(u,p.read(u)):Array.isArray(p)?p.flatMap(h=>l(u,h)):p instanceof a?(u&&p.readEffect(u),[p._element]):p?[p]:[]},c=ke(this,u=>{this._element.replaceChildren(...l(u,s))});this._deriveds.push(c),TQi(s)||c.get()}}readEffect(i){for(let e of this._deriveds)e.read(i)}keepUpdated(i){return ke(e=>{this.readEffect(e)}).recomputeInitiallyAndOnChange(i),this}toDisposableLiveElement(){let i=new O;return this.keepUpdated(i),new Ioi(this._element,i)}get isHovered(){if(!this._isHovered){let i=De("hovered",!1);this._element.addEventListener("mouseenter",e=>i.set(!0,void 0)),this._element.addEventListener("mouseleave",e=>i.set(!1,void 0)),this._isHovered=i}return this._isHovered}get didMouseMoveDuringHover(){if(!this._didMouseMoveDuringHover){let i=!1,e=De("didMouseMoveDuringHover",!1);this._element.addEventListener("mouseenter",t=>{i=!0}),this._element.addEventListener("mousemove",t=>{i&&e.set(!0,void 0)}),this._element.addEventListener("mouseleave",t=>{i=!1,e.set(!1,void 0)}),this._didMouseMoveDuringHover=e}return this._didMouseMoveDuringHover}};function J8i(a,i){Eoi(a)?a.setAttribute("class",i):a.className=i}function kQi(a,i,e){if(lF(a)){e(a.read(i));return}if(Array.isArray(a)){for(let t of a)kQi(t,i,e);return}e(a)}function Z8i(a,i){let e="";return kQi(a,i,t=>{t&&(e.length===0?e=t:e+=" "+t)}),e}function EQi(a){return lF(a)?!0:Array.isArray(a)?a.some(i=>EQi(i)):!1}function eQi(a){return typeof a=="number"?a+"px":a}function TQi(a){return lF(a)?!0:Array.isArray(a)?a.some(i=>TQi(i)):!1}var Ioi=class{constructor(i,e){this.element=i;this._disposable=e}dispose(){this._disposable.dispose()}},yoi=class extends Soi{get element(){return this._element}};function tQi(a,i,e){e==null?a.removeAttribute(jle(i)):a.setAttribute(jle(i),String(e))}var woi=class extends HTMLElement{disconnectedCallback(){this.onDidDisconnect?.()}connectedCallback(){this.onDidConnect?.()}};customElements.get("connection-observer")||customElements.define("connection-observer",woi);var _Qi=2e4,Jle,zbt,_oi,Kbt,Doi;function DQi(a){Jle=document.createElement("div"),Jle.className="monaco-aria-container";let i=()=>{let t=document.createElement("div");return t.className="monaco-alert",t.setAttribute("role","alert"),t.setAttribute("aria-atomic","true"),Jle.appendChild(t),t};zbt=i(),_oi=i();let e=()=>{let t=document.createElement("div");return t.className="monaco-status",t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),Jle.appendChild(t),t};Kbt=e(),Doi=e(),a.appendChild(Jle)}function cn(a){Jle&&(zbt.textContent!==a?(St(_oi),Gbt(zbt,a)):(St(zbt),Gbt(_oi,a)))}function Er(a){Jle&&(Kbt.textContent!==a?(St(Doi),Gbt(Kbt,a)):(St(Kbt),Gbt(Doi,a)))}function Gbt(a,i){St(a),i.length>_Qi&&(i=i.substr(0,_Qi)),a.textContent=i,a.style.visibility="hidden",a.style.visibility="visible"}var wB;(o=>{o.serviceIds=new Map,o.DI_TARGET="$di$target",o.DI_DEPENDENCIES="$di$dependencies";function t(n){return n[o.DI_DEPENDENCIES]||[]}o.getServiceDependencies=t})(wB||={});var F=le("instantiationService");function fKo(a,i,e){i[wB.DI_TARGET]===i?i[wB.DI_DEPENDENCIES].push({id:a,index:e}):(i[wB.DI_DEPENDENCIES]=[{id:a,index:e}],i[wB.DI_TARGET]=i)}function le(a){if(wB.serviceIds.has(a))return wB.serviceIds.get(a);let i=function(e,t,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");fKo(i,e,o)};return i.toString=()=>a,wB.serviceIds.set(a,i),i}var Qt=le("codeEditorService");var ye=class a{constructor(i,e){this.lineNumber=i,this.column=e}with(i=this.lineNumber,e=this.column){return i===this.lineNumber&&e===this.column?this:new a(i,e)}delta(i=0,e=0){return this.with(Math.max(1,this.lineNumber+i),Math.max(1,this.column+e))}equals(i){return a.equals(this,i)}static equals(i,e){return!i&&!e?!0:!!i&&!!e&&i.lineNumber===e.lineNumber&&i.column===e.column}isBefore(i){return a.isBefore(this,i)}static isBefore(i,e){return i.lineNumber<e.lineNumber?!0:e.lineNumber<i.lineNumber?!1:i.column<e.column}isBeforeOrEqual(i){return a.isBeforeOrEqual(this,i)}static isBeforeOrEqual(i,e){return i.lineNumber<e.lineNumber?!0:e.lineNumber<i.lineNumber?!1:i.column<=e.column}static compare(i,e){let t=i.lineNumber|0,o=e.lineNumber|0;if(t===o){let n=i.column|0,r=e.column|0;return n-r}return t-o}clone(){return new a(this.lineNumber,this.column)}toString(){return"("+this.lineNumber+","+this.column+")"}static lift(i){return new a(i.lineNumber,i.column)}static isIPosition(i){return!!i&&typeof i.lineNumber=="number"&&typeof i.column=="number"}toJSON(){return{lineNumber:this.lineNumber,column:this.column}}};var _t=le("modelService");var Bt=le("textModelService");function RQi(a){return!!a.textEditorModel}var it=class extends k{constructor(e,t="",o="",n=!0,r){super();this._onDidChange=this._register(new T);this._enabled=!0;this._id=e,this._label=t,this._cssClass=o,this._enabled=n,this._actionCallback=r}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,t){this._actionCallback&&await this._actionCallback(e)}},cs=class extends k{constructor(){super(...arguments);this._onWillRun=this._register(new T);this._onDidRun=this._register(new T)}get onWillRun(){return this._onWillRun.event}get onDidRun(){return this._onDidRun.event}async run(e,t){if(!e.enabled)return;this._onWillRun.fire({action:e});let o;try{await this.runAction(e,t)}catch(n){o=n}this._onDidRun.fire({action:e,error:o})}async runAction(e,t){await e.run(t)}},oi=class a{constructor(){this.id=a.ID;this.label="";this.tooltip="";this.class="separator";this.enabled=!1;this.checked=void 0}static join(...i){let e=[];for(let t of i)t.length&&(e.length?e=[...e,new a,...t]:e=t);return e}static clean(i){for(;i.length>0&&i[0].id===a.ID;)i.shift();for(;i.length>0&&i[i.length-1].id===a.ID;)i.pop();for(let e=i.length-2;e>=0;e--)i[e].id===a.ID&&i[e+1].id===a.ID&&i.splice(e+1,1);return i}static{this.ID="vs.actions.separator"}async run(){}},sa=class{constructor(i,e,t,o){this.tooltip="";this.enabled=!0;this.checked=void 0;this.id=i,this.label=e,this.class=o,this._actions=t}get actions(){return this._actions}async run(){}},qbt=class a extends it{static{this.ID="vs.actions.empty"}constructor(){super(a.ID,d(46,null),void 0,!1)}};function li(a){return{id:a.id,label:a.label,tooltip:a.tooltip??a.label,class:a.class,enabled:a.enabled??!0,checked:a.checked,run:async(...i)=>a.run(...i)}}var Roi=Object.create(null);function pe(a,i){if(We(i)){let e=Roi[i];if(e===void 0)throw new Error(`${a} references an unknown codicon: ${i}`);i=e}return Roi[a]=i,{id:a}}function $bt(){return Roi}var EY={add:pe("add",6e4),plus:pe("plus",6e4),gistNew:pe("gist-new",6e4),repoCreate:pe("repo-create",6e4),lightbulb:pe("lightbulb",60001),lightBulb:pe("light-bulb",60001),repo:pe("repo",60002),repoDelete:pe("repo-delete",60002),gistFork:pe("gist-fork",60003),repoForked:pe("repo-forked",60003),gitPullRequest:pe("git-pull-request",60004),gitPullRequestAbandoned:pe("git-pull-request-abandoned",60004),recordKeys:pe("record-keys",60005),keyboard:pe("keyboard",60005),tag:pe("tag",60006),gitPullRequestLabel:pe("git-pull-request-label",60006),tagAdd:pe("tag-add",60006),tagRemove:pe("tag-remove",60006),person:pe("person",60007),personFollow:pe("person-follow",60007),personOutline:pe("person-outline",60007),personFilled:pe("person-filled",60007),sourceControl:pe("source-control",60008),mirror:pe("mirror",60009),mirrorPublic:pe("mirror-public",60009),star:pe("star",60010),starAdd:pe("star-add",60010),starDelete:pe("star-delete",60010),starEmpty:pe("star-empty",60010),comment:pe("comment",60011),commentAdd:pe("comment-add",60011),alert:pe("alert",60012),warning:pe("warning",60012),search:pe("search",60013),searchSave:pe("search-save",60013),logOut:pe("log-out",60014),signOut:pe("sign-out",60014),logIn:pe("log-in",60015),signIn:pe("sign-in",60015),eye:pe("eye",60016),eyeUnwatch:pe("eye-unwatch",60016),eyeWatch:pe("eye-watch",60016),circleFilled:pe("circle-filled",60017),primitiveDot:pe("primitive-dot",60017),closeDirty:pe("close-dirty",60017),debugBreakpoint:pe("debug-breakpoint",60017),debugBreakpointDisabled:pe("debug-breakpoint-disabled",60017),debugHint:pe("debug-hint",60017),terminalDecorationSuccess:pe("terminal-decoration-success",60017),primitiveSquare:pe("primitive-square",60018),edit:pe("edit",60019),pencil:pe("pencil",60019),info:pe("info",60020),issueOpened:pe("issue-opened",60020),gistPrivate:pe("gist-private",60021),gitForkPrivate:pe("git-fork-private",60021),lock:pe("lock",60021),mirrorPrivate:pe("mirror-private",60021),close:pe("close",60022),removeClose:pe("remove-close",60022),x:pe("x",60022),repoSync:pe("repo-sync",60023),sync:pe("sync",60023),clone:pe("clone",60024),desktopDownload:pe("desktop-download",60024),beaker:pe("beaker",60025),microscope:pe("microscope",60025),vm:pe("vm",60026),deviceDesktop:pe("device-desktop",60026),file:pe("file",60027),more:pe("more",60028),ellipsis:pe("ellipsis",60028),kebabHorizontal:pe("kebab-horizontal",60028),mailReply:pe("mail-reply",60029),reply:pe("reply",60029),organization:pe("organization",60030),organizationFilled:pe("organization-filled",60030),organizationOutline:pe("organization-outline",60030),newFile:pe("new-file",60031),fileAdd:pe("file-add",60031),newFolder:pe("new-folder",60032),fileDirectoryCreate:pe("file-directory-create",60032),trash:pe("trash",60033),trashcan:pe("trashcan",60033),history:pe("history",60034),clock:pe("clock",60034),folder:pe("folder",60035),fileDirectory:pe("file-directory",60035),symbolFolder:pe("symbol-folder",60035),logoGithub:pe("logo-github",60036),markGithub:pe("mark-github",60036),github:pe("github",60036),terminal:pe("terminal",60037),console:pe("console",60037),repl:pe("repl",60037),zap:pe("zap",60038),symbolEvent:pe("symbol-event",60038),error:pe("error",60039),stop:pe("stop",60039),variable:pe("variable",60040),symbolVariable:pe("symbol-variable",60040),array:pe("array",60042),symbolArray:pe("symbol-array",60042),symbolModule:pe("symbol-module",60043),symbolPackage:pe("symbol-package",60043),symbolNamespace:pe("symbol-namespace",60043),symbolObject:pe("symbol-object",60043),symbolMethod:pe("symbol-method",60044),symbolFunction:pe("symbol-function",60044),symbolConstructor:pe("symbol-constructor",60044),symbolBoolean:pe("symbol-boolean",60047),symbolNull:pe("symbol-null",60047),symbolNumeric:pe("symbol-numeric",60048),symbolNumber:pe("symbol-number",60048),symbolStructure:pe("symbol-structure",60049),symbolStruct:pe("symbol-struct",60049),symbolParameter:pe("symbol-parameter",60050),symbolTypeParameter:pe("symbol-type-parameter",60050),symbolKey:pe("symbol-key",60051),symbolText:pe("symbol-text",60051),symbolReference:pe("symbol-reference",60052),goToFile:pe("go-to-file",60052),symbolEnum:pe("symbol-enum",60053),symbolValue:pe("symbol-value",60053),symbolRuler:pe("symbol-ruler",60054),symbolUnit:pe("symbol-unit",60054),activateBreakpoints:pe("activate-breakpoints",60055),archive:pe("archive",60056),arrowBoth:pe("arrow-both",60057),arrowDown:pe("arrow-down",60058),arrowLeft:pe("arrow-left",60059),arrowRight:pe("arrow-right",60060),arrowSmallDown:pe("arrow-small-down",60061),arrowSmallLeft:pe("arrow-small-left",60062),arrowSmallRight:pe("arrow-small-right",60063),arrowSmallUp:pe("arrow-small-up",60064),arrowUp:pe("arrow-up",60065),bell:pe("bell",60066),bold:pe("bold",60067),book:pe("book",60068),bookmark:pe("bookmark",60069),debugBreakpointConditionalUnverified:pe("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:pe("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:pe("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:pe("debug-breakpoint-data-unverified",60072),debugBreakpointData:pe("debug-breakpoint-data",60073),debugBreakpointDataDisabled:pe("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:pe("debug-breakpoint-log-unverified",60074),debugBreakpointLog:pe("debug-breakpoint-log",60075),debugBreakpointLogDisabled:pe("debug-breakpoint-log-disabled",60075),briefcase:pe("briefcase",60076),broadcast:pe("broadcast",60077),browser:pe("browser",60078),bug:pe("bug",60079),calendar:pe("calendar",60080),caseSensitive:pe("case-sensitive",60081),check:pe("check",60082),checklist:pe("checklist",60083),chevronDown:pe("chevron-down",60084),chevronLeft:pe("chevron-left",60085),chevronRight:pe("chevron-right",60086),chevronUp:pe("chevron-up",60087),chromeClose:pe("chrome-close",60088),chromeMaximize:pe("chrome-maximize",60089),chromeMinimize:pe("chrome-minimize",60090),chromeRestore:pe("chrome-restore",60091),circleOutline:pe("circle-outline",60092),circle:pe("circle",60092),debugBreakpointUnverified:pe("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:pe("terminal-decoration-incomplete",60092),circleSlash:pe("circle-slash",60093),circuitBoard:pe("circuit-board",60094),clearAll:pe("clear-all",60095),clippy:pe("clippy",60096),closeAll:pe("close-all",60097),cloudDownload:pe("cloud-download",60098),cloudUpload:pe("cloud-upload",60099),code:pe("code",60100),collapseAll:pe("collapse-all",60101),colorMode:pe("color-mode",60102),commentDiscussion:pe("comment-discussion",60103),creditCard:pe("credit-card",60105),dash:pe("dash",60108),dashboard:pe("dashboard",60109),database:pe("database",60110),debugContinue:pe("debug-continue",60111),debugDisconnect:pe("debug-disconnect",60112),debugPause:pe("debug-pause",60113),debugRestart:pe("debug-restart",60114),debugStart:pe("debug-start",60115),debugStepInto:pe("debug-step-into",60116),debugStepOut:pe("debug-step-out",60117),debugStepOver:pe("debug-step-over",60118),debugStop:pe("debug-stop",60119),debug:pe("debug",60120),deviceCameraVideo:pe("device-camera-video",60121),deviceCamera:pe("device-camera",60122),deviceMobile:pe("device-mobile",60123),diffAdded:pe("diff-added",60124),diffIgnored:pe("diff-ignored",60125),diffModified:pe("diff-modified",60126),diffRemoved:pe("diff-removed",60127),diffRenamed:pe("diff-renamed",60128),diff:pe("diff",60129),diffSidebyside:pe("diff-sidebyside",60129),discard:pe("discard",60130),editorLayout:pe("editor-layout",60131),emptyWindow:pe("empty-window",60132),exclude:pe("exclude",60133),extensions:pe("extensions",60134),eyeClosed:pe("eye-closed",60135),fileBinary:pe("file-binary",60136),fileCode:pe("file-code",60137),fileMedia:pe("file-media",60138),filePdf:pe("file-pdf",60139),fileSubmodule:pe("file-submodule",60140),fileSymlinkDirectory:pe("file-symlink-directory",60141),fileSymlinkFile:pe("file-symlink-file",60142),fileZip:pe("file-zip",60143),files:pe("files",60144),filter:pe("filter",60145),flame:pe("flame",60146),foldDown:pe("fold-down",60147),foldUp:pe("fold-up",60148),fold:pe("fold",60149),folderActive:pe("folder-active",60150),folderOpened:pe("folder-opened",60151),gear:pe("gear",60152),gift:pe("gift",60153),gistSecret:pe("gist-secret",60154),gist:pe("gist",60155),gitCommit:pe("git-commit",60156),gitCompare:pe("git-compare",60157),compareChanges:pe("compare-changes",60157),gitMerge:pe("git-merge",60158),githubAction:pe("github-action",60159),githubAlt:pe("github-alt",60160),globe:pe("globe",60161),grabber:pe("grabber",60162),graph:pe("graph",60163),gripper:pe("gripper",60164),heart:pe("heart",60165),home:pe("home",60166),horizontalRule:pe("horizontal-rule",60167),hubot:pe("hubot",60168),inbox:pe("inbox",60169),issueReopened:pe("issue-reopened",60171),issues:pe("issues",60172),italic:pe("italic",60173),jersey:pe("jersey",60174),json:pe("json",60175),bracket:pe("bracket",60175),kebabVertical:pe("kebab-vertical",60176),key:pe("key",60177),law:pe("law",60178),lightbulbAutofix:pe("lightbulb-autofix",60179),linkExternal:pe("link-external",60180),link:pe("link",60181),listOrdered:pe("list-ordered",60182),listUnordered:pe("list-unordered",60183),liveShare:pe("live-share",60184),loading:pe("loading",60185),location:pe("location",60186),mailRead:pe("mail-read",60187),mail:pe("mail",60188),markdown:pe("markdown",60189),megaphone:pe("megaphone",60190),mention:pe("mention",60191),milestone:pe("milestone",60192),gitPullRequestMilestone:pe("git-pull-request-milestone",60192),mortarBoard:pe("mortar-board",60193),move:pe("move",60194),multipleWindows:pe("multiple-windows",60195),mute:pe("mute",60196),noNewline:pe("no-newline",60197),note:pe("note",60198),octoface:pe("octoface",60199),openPreview:pe("open-preview",60200),package:pe("package",60201),paintcan:pe("paintcan",60202),pin:pe("pin",60203),play:pe("play",60204),run:pe("run",60204),plug:pe("plug",60205),preserveCase:pe("preserve-case",60206),preview:pe("preview",60207),project:pe("project",60208),pulse:pe("pulse",60209),question:pe("question",60210),quote:pe("quote",60211),radioTower:pe("radio-tower",60212),reactions:pe("reactions",60213),references:pe("references",60214),refresh:pe("refresh",60215),regex:pe("regex",60216),remoteExplorer:pe("remote-explorer",60217),remote:pe("remote",60218),remove:pe("remove",60219),replaceAll:pe("replace-all",60220),replace:pe("replace",60221),repoClone:pe("repo-clone",60222),repoForcePush:pe("repo-force-push",60223),repoPull:pe("repo-pull",60224),repoPush:pe("repo-push",60225),report:pe("report",60226),requestChanges:pe("request-changes",60227),rocket:pe("rocket",60228),rootFolderOpened:pe("root-folder-opened",60229),rootFolder:pe("root-folder",60230),rss:pe("rss",60231),ruby:pe("ruby",60232),saveAll:pe("save-all",60233),saveAs:pe("save-as",60234),save:pe("save",60235),screenFull:pe("screen-full",60236),screenNormal:pe("screen-normal",60237),searchStop:pe("search-stop",60238),server:pe("server",60240),settingsGear:pe("settings-gear",60241),settings:pe("settings",60242),shield:pe("shield",60243),smiley:pe("smiley",60244),sortPrecedence:pe("sort-precedence",60245),splitHorizontal:pe("split-horizontal",60246),splitVertical:pe("split-vertical",60247),squirrel:pe("squirrel",60248),starFull:pe("star-full",60249),starHalf:pe("star-half",60250),symbolClass:pe("symbol-class",60251),symbolColor:pe("symbol-color",60252),symbolConstant:pe("symbol-constant",60253),symbolEnumMember:pe("symbol-enum-member",60254),symbolField:pe("symbol-field",60255),symbolFile:pe("symbol-file",60256),symbolInterface:pe("symbol-interface",60257),symbolKeyword:pe("symbol-keyword",60258),symbolMisc:pe("symbol-misc",60259),symbolOperator:pe("symbol-operator",60260),symbolProperty:pe("symbol-property",60261),wrench:pe("wrench",60261),wrenchSubaction:pe("wrench-subaction",60261),symbolSnippet:pe("symbol-snippet",60262),tasklist:pe("tasklist",60263),telescope:pe("telescope",60264),textSize:pe("text-size",60265),threeBars:pe("three-bars",60266),thumbsdown:pe("thumbsdown",60267),thumbsup:pe("thumbsup",60268),tools:pe("tools",60269),triangleDown:pe("triangle-down",60270),triangleLeft:pe("triangle-left",60271),triangleRight:pe("triangle-right",60272),triangleUp:pe("triangle-up",60273),twitter:pe("twitter",60274),unfold:pe("unfold",60275),unlock:pe("unlock",60276),unmute:pe("unmute",60277),unverified:pe("unverified",60278),verified:pe("verified",60279),versions:pe("versions",60280),vmActive:pe("vm-active",60281),vmOutline:pe("vm-outline",60282),vmRunning:pe("vm-running",60283),watch:pe("watch",60284),whitespace:pe("whitespace",60285),wholeWord:pe("whole-word",60286),window:pe("window",60287),wordWrap:pe("word-wrap",60288),zoomIn:pe("zoom-in",60289),zoomOut:pe("zoom-out",60290),listFilter:pe("list-filter",60291),listFlat:pe("list-flat",60292),listSelection:pe("list-selection",60293),selection:pe("selection",60293),listTree:pe("list-tree",60294),debugBreakpointFunctionUnverified:pe("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:pe("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:pe("debug-breakpoint-function-disabled",60296),debugStackframeActive:pe("debug-stackframe-active",60297),circleSmallFilled:pe("circle-small-filled",60298),debugStackframeDot:pe("debug-stackframe-dot",60298),terminalDecorationMark:pe("terminal-decoration-mark",60298),debugStackframe:pe("debug-stackframe",60299),debugStackframeFocused:pe("debug-stackframe-focused",60299),debugBreakpointUnsupported:pe("debug-breakpoint-unsupported",60300),symbolString:pe("symbol-string",60301),debugReverseContinue:pe("debug-reverse-continue",60302),debugStepBack:pe("debug-step-back",60303),debugRestartFrame:pe("debug-restart-frame",60304),debugAlt:pe("debug-alt",60305),callIncoming:pe("call-incoming",60306),callOutgoing:pe("call-outgoing",60307),menu:pe("menu",60308),expandAll:pe("expand-all",60309),feedback:pe("feedback",60310),gitPullRequestReviewer:pe("git-pull-request-reviewer",60310),groupByRefType:pe("group-by-ref-type",60311),ungroupByRefType:pe("ungroup-by-ref-type",60312),account:pe("account",60313),gitPullRequestAssignee:pe("git-pull-request-assignee",60313),bellDot:pe("bell-dot",60314),debugConsole:pe("debug-console",60315),library:pe("library",60316),output:pe("output",60317),runAll:pe("run-all",60318),syncIgnored:pe("sync-ignored",60319),pinned:pe("pinned",60320),githubInverted:pe("github-inverted",60321),serverProcess:pe("server-process",60322),serverEnvironment:pe("server-environment",60323),pass:pe("pass",60324),issueClosed:pe("issue-closed",60324),stopCircle:pe("stop-circle",60325),playCircle:pe("play-circle",60326),record:pe("record",60327),debugAltSmall:pe("debug-alt-small",60328),vmConnect:pe("vm-connect",60329),cloud:pe("cloud",60330),merge:pe("merge",60331),export:pe("export",60332),graphLeft:pe("graph-left",60333),magnet:pe("magnet",60334),notebook:pe("notebook",60335),redo:pe("redo",60336),checkAll:pe("check-all",60337),pinnedDirty:pe("pinned-dirty",60338),passFilled:pe("pass-filled",60339),circleLargeFilled:pe("circle-large-filled",60340),circleLarge:pe("circle-large",60341),circleLargeOutline:pe("circle-large-outline",60341),combine:pe("combine",60342),gather:pe("gather",60342),table:pe("table",60343),variableGroup:pe("variable-group",60344),typeHierarchy:pe("type-hierarchy",60345),typeHierarchySub:pe("type-hierarchy-sub",60346),typeHierarchySuper:pe("type-hierarchy-super",60347),gitPullRequestCreate:pe("git-pull-request-create",60348),runAbove:pe("run-above",60349),runBelow:pe("run-below",60350),notebookTemplate:pe("notebook-template",60351),debugRerun:pe("debug-rerun",60352),workspaceTrusted:pe("workspace-trusted",60353),workspaceUntrusted:pe("workspace-untrusted",60354),workspaceUnknown:pe("workspace-unknown",60355),terminalCmd:pe("terminal-cmd",60356),terminalDebian:pe("terminal-debian",60357),terminalLinux:pe("terminal-linux",60358),terminalPowershell:pe("terminal-powershell",60359),terminalTmux:pe("terminal-tmux",60360),terminalUbuntu:pe("terminal-ubuntu",60361),terminalBash:pe("terminal-bash",60362),arrowSwap:pe("arrow-swap",60363),copy:pe("copy",60364),personAdd:pe("person-add",60365),filterFilled:pe("filter-filled",60366),wand:pe("wand",60367),debugLineByLine:pe("debug-line-by-line",60368),inspect:pe("inspect",60369),layers:pe("layers",60370),layersDot:pe("layers-dot",60371),layersActive:pe("layers-active",60372),compass:pe("compass",60373),compassDot:pe("compass-dot",60374),compassActive:pe("compass-active",60375),azure:pe("azure",60376),issueDraft:pe("issue-draft",60377),gitPullRequestClosed:pe("git-pull-request-closed",60378),gitPullRequestDraft:pe("git-pull-request-draft",60379),debugAll:pe("debug-all",60380),debugCoverage:pe("debug-coverage",60381),runErrors:pe("run-errors",60382),folderLibrary:pe("folder-library",60383),debugContinueSmall:pe("debug-continue-small",60384),beakerStop:pe("beaker-stop",60385),graphLine:pe("graph-line",60386),graphScatter:pe("graph-scatter",60387),pieChart:pe("pie-chart",60388),bracketDot:pe("bracket-dot",60389),bracketError:pe("bracket-error",60390),lockSmall:pe("lock-small",60391),azureDevops:pe("azure-devops",60392),verifiedFilled:pe("verified-filled",60393),newline:pe("newline",60394),layout:pe("layout",60395),layoutActivitybarLeft:pe("layout-activitybar-left",60396),layoutActivitybarRight:pe("layout-activitybar-right",60397),layoutPanelLeft:pe("layout-panel-left",60398),layoutPanelCenter:pe("layout-panel-center",60399),layoutPanelJustify:pe("layout-panel-justify",60400),layoutPanelRight:pe("layout-panel-right",60401),layoutPanel:pe("layout-panel",60402),layoutSidebarLeft:pe("layout-sidebar-left",60403),layoutSidebarRight:pe("layout-sidebar-right",60404),layoutStatusbar:pe("layout-statusbar",60405),layoutMenubar:pe("layout-menubar",60406),layoutCentered:pe("layout-centered",60407),target:pe("target",60408),indent:pe("indent",60409),recordSmall:pe("record-small",60410),errorSmall:pe("error-small",60411),terminalDecorationError:pe("terminal-decoration-error",60411),arrowCircleDown:pe("arrow-circle-down",60412),arrowCircleLeft:pe("arrow-circle-left",60413),arrowCircleRight:pe("arrow-circle-right",60414),arrowCircleUp:pe("arrow-circle-up",60415),layoutSidebarRightOff:pe("layout-sidebar-right-off",60416),layoutPanelOff:pe("layout-panel-off",60417),layoutSidebarLeftOff:pe("layout-sidebar-left-off",60418),blank:pe("blank",60419),heartFilled:pe("heart-filled",60420),map:pe("map",60421),mapHorizontal:pe("map-horizontal",60421),foldHorizontal:pe("fold-horizontal",60421),mapFilled:pe("map-filled",60422),mapHorizontalFilled:pe("map-horizontal-filled",60422),foldHorizontalFilled:pe("fold-horizontal-filled",60422),circleSmall:pe("circle-small",60423),bellSlash:pe("bell-slash",60424),bellSlashDot:pe("bell-slash-dot",60425),commentUnresolved:pe("comment-unresolved",60426),gitPullRequestGoToChanges:pe("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:pe("git-pull-request-new-changes",60428),searchFuzzy:pe("search-fuzzy",60429),commentDraft:pe("comment-draft",60430),send:pe("send",60431),sparkle:pe("sparkle",60432),insert:pe("insert",60433),mic:pe("mic",60434),thumbsdownFilled:pe("thumbsdown-filled",60435),thumbsupFilled:pe("thumbsup-filled",60436),coffee:pe("coffee",60437),snake:pe("snake",60438),game:pe("game",60439),vr:pe("vr",60440),chip:pe("chip",60441),piano:pe("piano",60442),music:pe("music",60443),micFilled:pe("mic-filled",60444),repoFetch:pe("repo-fetch",60445),copilot:pe("copilot",60446),lightbulbSparkle:pe("lightbulb-sparkle",60447),robot:pe("robot",60448),sparkleFilled:pe("sparkle-filled",60449),diffSingle:pe("diff-single",60450),diffMultiple:pe("diff-multiple",60451),surroundWith:pe("surround-with",60452),share:pe("share",60453),gitStash:pe("git-stash",60454),gitStashApply:pe("git-stash-apply",60455),gitStashPop:pe("git-stash-pop",60456),vscode:pe("vscode",60457),vscodeInsiders:pe("vscode-insiders",60458),codeOss:pe("code-oss",60459),runCoverage:pe("run-coverage",60460),runAllCoverage:pe("run-all-coverage",60461),coverage:pe("coverage",60462),githubProject:pe("github-project",60463),mapVertical:pe("map-vertical",60464),foldVertical:pe("fold-vertical",60464),mapVerticalFilled:pe("map-vertical-filled",60465),foldVerticalFilled:pe("fold-vertical-filled",60465),goToSearch:pe("go-to-search",60466),percentage:pe("percentage",60467),sortPercentage:pe("sort-percentage",60467),attach:pe("attach",60468),goToEditingSession:pe("go-to-editing-session",60469),editSession:pe("edit-session",60470),codeReview:pe("code-review",60471),copilotWarning:pe("copilot-warning",60472),python:pe("python",60473),copilotLarge:pe("copilot-large",60474),copilotWarningLarge:pe("copilot-warning-large",60475),keyboardTab:pe("keyboard-tab",60476),copilotBlocked:pe("copilot-blocked",60477),copilotNotConnected:pe("copilot-not-connected",60478),flag:pe("flag",60479),lightbulbEmpty:pe("lightbulb-empty",60480),symbolMethodArrow:pe("symbol-method-arrow",60481),copilotUnavailable:pe("copilot-unavailable",60482),repoPinned:pe("repo-pinned",60483),keyboardTabAbove:pe("keyboard-tab-above",60484),keyboardTabBelow:pe("keyboard-tab-below",60485),gitPullRequestDone:pe("git-pull-request-done",60486),mcp:pe("mcp",60487),extensionsLarge:pe("extensions-large",60488),layoutPanelDock:pe("layout-panel-dock",60489),layoutSidebarLeftDock:pe("layout-sidebar-left-dock",60490),layoutSidebarRightDock:pe("layout-sidebar-right-dock",60491),copilotInProgress:pe("copilot-in-progress",60492),copilotError:pe("copilot-error",60493),copilotSuccess:pe("copilot-success",60494),chatSparkle:pe("chat-sparkle",60495),searchSparkle:pe("search-sparkle",60496),editSparkle:pe("edit-sparkle",60497),copilotSnooze:pe("copilot-snooze",60498),sendToRemoteAgent:pe("send-to-remote-agent",60499),commentDiscussionSparkle:pe("comment-discussion-sparkle",60500),chatSparkleWarning:pe("chat-sparkle-warning",60501),chatSparkleError:pe("chat-sparkle-error",60502),collection:pe("collection",60503),newCollection:pe("new-collection",60504),thinking:pe("thinking",60505),build:pe("build",60506),commentDiscussionQuote:pe("comment-discussion-quote",60507),cursor:pe("cursor",60508),eraser:pe("eraser",60509),fileText:pe("file-text",60510),quotes:pe("quotes",60512),rename:pe("rename",60513),runWithDeps:pe("run-with-deps",60514),debugConnected:pe("debug-connected",60515),strikethrough:pe("strikethrough",60516),openInProduct:pe("open-in-product",60517),indexZero:pe("index-zero",60518),agent:pe("agent",60519),editCode:pe("edit-code",60520),repoSelected:pe("repo-selected",60521),skip:pe("skip",60522),mergeInto:pe("merge-into",60523),gitBranchChanges:pe("git-branch-changes",60524),gitBranchStagedChanges:pe("git-branch-staged-changes",60525),gitBranchConflicts:pe("git-branch-conflicts",60526),gitBranch:pe("git-branch",60527),gitBranchCreate:pe("git-branch-create",60527),gitBranchDelete:pe("git-branch-delete",60527),searchLarge:pe("search-large",60528),terminalGitBash:pe("terminal-git-bash",60529),windowActive:pe("window-active",60530),forward:pe("forward",60531),download:pe("download",60532),clockface:pe("clockface",60533),unarchive:pe("unarchive",60534),sessionInProgress:pe("session-in-progress",60535),collectionSmall:pe("collection-small",60536),vmSmall:pe("vm-small",60537),cloudSmall:pe("cloud-small",60538),addSmall:pe("add-small",60539),removeSmall:pe("remove-small",60540),worktreeSmall:pe("worktree-small",60541),worktree:pe("worktree",60542),screenCut:pe("screen-cut",60543),ask:pe("ask",60544),openai:pe("openai",60545),claude:pe("claude",60546),openInWindow:pe("open-in-window",60547),newSession:pe("new-session",60548),terminalSecure:pe("terminal-secure",60549),chatImport:pe("chat-import",60550),chatExport:pe("chat-export",60551),shareWindow:pe("share-window",60552)};function l5(){return Object.values(L)}var bKo={dialogError:pe("dialog-error","error"),dialogWarning:pe("dialog-warning","warning"),dialogInfo:pe("dialog-info","info"),dialogClose:pe("dialog-close","close"),treeItemExpanded:pe("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:pe("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:pe("tree-filter-on-type-off","list-selection"),treeFilterClear:pe("tree-filter-clear","close"),treeItemLoading:pe("tree-item-loading","loading"),menuSelection:pe("menu-selection","check"),menuSubmenu:pe("menu-submenu","chevron-right"),menuBarMore:pe("menubar-more","more"),scrollbarButtonLeft:pe("scrollbar-button-left","triangle-left"),scrollbarButtonRight:pe("scrollbar-button-right","triangle-right"),scrollbarButtonUp:pe("scrollbar-button-up","triangle-up"),scrollbarButtonDown:pe("scrollbar-button-down","triangle-down"),toolBarMore:pe("toolbar-more","more"),quickInputBack:pe("quick-input-back","arrow-left"),dropDownButton:pe("drop-down-button",60084),symbolCustomColor:pe("symbol-customcolor",60252),exportIcon:pe("export",60332),workspaceUnspecified:pe("workspace-unspecified",60355),newLine:pe("newline",60394),thumbsDownFilled:pe("thumbsdown-filled",60435),thumbsUpFilled:pe("thumbsup-filled",60436),gitFetch:pe("git-fetch",60445),lightbulbSparkleAutofix:pe("lightbulb-sparkle-autofix",60447),debugBreakpointPending:pe("debug-breakpoint-pending",60377),chatImport:pe("chat-import",60550),chatExport:pe("chat-export",60551)},L={...EY,...bKo};var LQi;(i=>{function a(e){return!!e&&typeof e=="object"&&typeof e.id=="string"}i.isThemeColor=a})(LQi||={});function wp(a){return{id:a}}var q;(S=>{S.iconNameSegment="[A-Za-z0-9]+",S.iconNameExpression="[A-Za-z0-9-]+",S.iconModifierExpression="~[A-Za-z]+",S.iconNameCharacter="[A-Za-z0-9~-]";let o=new RegExp(`^(${S.iconNameExpression})(${S.iconModifierExpression})?$`);function n(y){let w=o.exec(y.id);if(!w)return n(L.error);let[,x,E]=w,M=["codicon","codicon-"+x];return E&&M.push("codicon-modifier-"+E.substring(1)),M}S.asClassNameArray=n;function r(y){return n(y).join(" ")}S.asClassName=r;function s(y){return"."+n(y).join(".")}S.asCSSSelector=s;function l(y){return!!y&&typeof y=="object"&&typeof y.id=="string"&&(typeof y.color>"u"||LQi.isThemeColor(y.color))}S.isThemeIcon=l;let c=new RegExp(`^\\$\\((${S.iconNameExpression}(?:${S.iconModifierExpression})?)\\)$`);function u(y){let w=c.exec(y);if(!w)return;let[,x]=w;return{id:x}}S.fromString=u;function p(y){return{id:y}}S.fromId=p;function h(y,w){let x=y.id,E=x.lastIndexOf("~");return E!==-1&&(x=x.substring(0,E)),w&&(x=`${x}~${w}`),{id:x}}S.modify=h;function g(y){let w=y.id.lastIndexOf("~");if(w!==-1)return y.id.substring(w+1)}S.getModifier=g;function f(y,w){return y.id===w.id&&y.color?.id===w.color?.id}S.isEqual=f;function v(y){return y?.id===L.file.id}S.isFile=v;function b(y){return y?.id===L.folder.id}S.isFolder=b})(q||={});var fe=le("commandService"),Ge=new class{constructor(){this._commands=new Map;this._onDidRegisterCommand=new T;this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(a,i){if(!a)throw new Error("invalid command");if(typeof a=="string"){if(!i)throw new Error("invalid command");return this.registerCommand({id:a,handler:i})}if(a.metadata&&Array.isArray(a.metadata.args)){let r=[];for(let l of a.metadata.args)r.push(l.constraint);let s=a.handler;a.handler=function(l,...c){return r3i(c,r),s(l,...c)}}let{id:e}=a,t=this._commands.get(e);t||(t=new ra,this._commands.set(e,t));let o=t.unshift(a),n=ee(()=>{o(),this._commands.get(e)?.isEmpty()&&this._commands.delete(e)});return this._onDidRegisterCommand.fire(e),bp(n)}registerCommandAlias(a,i){return Ge.registerCommand(a,(e,...t)=>e.get(fe).executeCommand(i,...t))}getCommand(a){let i=this._commands.get(a);if(!(!i||i.isEmpty()))return yt.first(i)}getCommands(){let a=new Map;for(let i of this._commands.keys()){let e=this.getCommand(i);e&&a.set(i,e)}return a}};Ge.registerCommand("noop",()=>{});function Loi(...a){switch(a.length){case 1:return d(2124,null,a[0]);case 2:return d(2125,null,a[0],a[1]);case 3:return d(2126,null,a[0],a[1],a[2]);default:return}}var SKo=d(2123,null),IKo=d(2122,null),TY=class a{constructor(){this._input="";this._start=0;this._current=0;this._tokens=[];this._errors=[];this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(i){switch(i.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return i.isTripleEq?"===":"==";case 4:return i.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">";case 8:return">=";case 9:return"=~";case 10:return i.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 i.lexeme;case 18:return i.lexeme;case 19:return i.lexeme;case 20:return"EOF";default:throw Nye(`unhandled token type: ${JSON.stringify(i)}; have you forgotten to add a case?`)}}static{this._regexFlags=new Set(["i","g","s","m","y","u"].map(i=>i.charCodeAt(0)))}static{this._keywords=new Map([["not",14],["in",13],["false",12],["true",11]])}get errors(){return this._errors}reset(i){return this._input=i,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(Loi("==","=~"));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(Loi("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(Loi("||"));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(i){return this._isAtEnd()||this._input.charCodeAt(this._current)!==i?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(i){this._tokens.push({type:i,offset:this._start})}_error(i){let e=this._start,t=this._input.substring(this._start,this._current),o={type:19,offset:this._start,lexeme:t};this._errors.push({offset:e,lexeme:t,additionalInfo:i}),this._tokens.push(o)}_string(){this.stringRe.lastIndex=this._start;let i=this.stringRe.exec(this._input);if(i){this._current=this._start+i[0].length;let e=this._input.substring(this._start,this._current),t=a._keywords.get(e);t?this._addToken(t):this._tokens.push({type:17,lexeme:e,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(SKo);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let i=this._current,e=!1,t=!1;for(;;){if(i>=this._input.length){this._current=i,this._error(IKo);return}let n=this._input.charCodeAt(i);if(e)e=!1;else if(n===47&&!t){i++;break}else n===91?t=!0:n===92?e=!0:n===93&&(t=!1);i++}for(;i<this._input.length&&a._regexFlags.has(this._input.charCodeAt(i));)i++;this._current=i;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 xI=new Map;xI.set("false",!1);xI.set("true",!0);xI.set("isMac",et);xI.set("isLinux",Sn);xI.set("isWindows",ii);xI.set("isWeb",Ft);xI.set("isMacNative",et&&!Ft);xI.set("isEdge",$ye);xI.set("isFirefox",Gye);xI.set("isChrome",bz);xI.set("isSafari",qye);function NQi(a,i){if(xI.get(a)!==void 0)throw ls("contextkey.setConstant(k, v) invoked with already set constant `k`");xI.set(a,i)}var yKo=Object.prototype.hasOwnProperty;var wKo={regexParsingWithErrorRecovery:!0},CKo=d(2103,null),xKo=d(2104,null),kKo=d(2106,null),MQi=d(2102,null),EKo=d(2109,null),TKo=d(2110,null),_Ko=d(2107,null),DKo=d(2108,null),Moi=class a{constructor(i=wKo){this._config=i;this._scanner=new TY;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(i){if(i===""){this._parsingErrors.push({message:CKo,offset:0,lexeme:"",additionalInfo:xKo});return}this._tokens=this._scanner.reset(i).scan(),this._current=0,this._parsingErrors=[];try{let e=this._expr();if(!this._isAtEnd()){let t=this._peek(),o=t.type===17?TKo:void 0;throw this._parsingErrors.push({message:EKo,offset:t.offset,lexeme:TY.getLexeme(t),additionalInfo:o}),a._parseError}return e}catch(e){if(e!==a._parseError)throw e;return}}_expr(){return this._or()}_or(){let i=[this._and()];for(;this._matchOne(16);){let e=this._and();i.push(e)}return i.length===1?i[0]:C.or(...i)}_and(){let i=[this._term()];for(;this._matchOne(15);){let e=this._term();i.push(e)}return i.length===1?i[0]:C.and(...i)}_term(){if(this._matchOne(2)){let i=this._peek();switch(i.type){case 11:return this._advance(),Ww.INSTANCE;case 12:return this._advance(),My.INSTANCE;case 0:{this._advance();let e=this._expr();return this._consume(1,MQi),e?.negate()}case 17:return this._advance(),Zle.create(i.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",i)}}return this._primary()}_primary(){let i=this._peek();switch(i.type){case 11:return this._advance(),C.true();case 12:return this._advance(),C.false();case 0:{this._advance();let e=this._expr();return this._consume(1,MQi),e}case 17:{let e=i.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 n=o.lexeme,r=n.lastIndexOf("/"),s=r===n.length-1?void 0:this._removeFlagsGY(n.substring(r+1)),l;try{l=new RegExp(n.substring(1,r),s)}catch{throw this._errExpectedButGot("REGEX",o)}return W4e.create(e,l)}switch(o.type){case 10:case 19:{let n=[o.lexeme];this._advance();let r=this._peek(),s=0;for(let h=0;h<o.lexeme.length;h++)o.lexeme.charCodeAt(h)===40?s++:o.lexeme.charCodeAt(h)===41&&s--;for(;!this._isAtEnd()&&r.type!==15&&r.type!==16;){switch(r.type){case 0:s++;break;case 1:s--;break;case 10:case 18:for(let h=0;h<r.lexeme.length;h++)r.lexeme.charCodeAt(h)===40?s++:o.lexeme.charCodeAt(h)===41&&s--}if(s<0)break;n.push(TY.getLexeme(r)),this._advance(),r=this._peek()}let l=n.join(""),c=l.lastIndexOf("/"),u=c===l.length-1?void 0:this._removeFlagsGY(l.substring(c+1)),p;try{p=new RegExp(l.substring(1,c),u)}catch{throw this._errExpectedButGot("REGEX",o)}return C.regex(e,p)}case 18:{let n=o.lexeme;this._advance();let r=null;if(!_c(n)){let s=n.indexOf("/"),l=n.lastIndexOf("/");if(s!==l&&s>=0){let c=n.slice(s+1,l),u=n[l+1]==="i"?"i":"";try{r=new RegExp(c,u)}catch{throw this._errExpectedButGot("REGEX",o)}}}if(r===null)throw this._errExpectedButGot("REGEX",o);return W4e.create(e,r)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,kKo);let o=this._value();return C.notIn(e,o)}switch(this._peek().type){case 3:{this._advance();let o=this._value();if(this._previous().type===18)return C.equals(e,o);switch(o){case"true":return C.has(e);case"false":return C.not(e);default:return C.equals(e,o)}}case 4:{this._advance();let o=this._value();if(this._previous().type===18)return C.notEquals(e,o);switch(o){case"true":return C.not(e);case"false":return C.has(e);default:return C.notEquals(e,o)}}case 5:return this._advance(),O4e.create(e,this._value());case 6:return this._advance(),F4e.create(e,this._value());case 7:return this._advance(),_Y.create(e,this._value());case 8:return this._advance(),N4e.create(e,this._value());case 13:return this._advance(),C.in(e,this._value());default:return C.has(e)}}case 20:throw this._parsingErrors.push({message:_Ko,offset:i.offset,lexeme:"",additionalInfo:DKo}),a._parseError;default:throw this._errExpectedButGot(`true | false | KEY 
	| KEY '=~' REGEX 
	| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){let i=this._peek();switch(i.type){case 17:case 18:return this._advance(),i.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(i){return i.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(i){return this._check(i)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(i,e){if(this._check(i))return this._advance();throw this._errExpectedButGot(e,this._peek())}_errExpectedButGot(i,e,t){let o=d(2105,null,i,TY.getLexeme(e)),n=e.offset,r=TY.getLexeme(e);return this._parsingErrors.push({message:o,offset:n,lexeme:r,additionalInfo:t}),a._parseError}_check(i){return this._peek().type===i}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},C=class{static false(){return Ww.INSTANCE}static true(){return My.INSTANCE}static has(i){return lT.create(i)}static equals(i,e){return CB.create(i,e)}static notEquals(i,e){return A4e.create(i,e)}static regex(i,e){return W4e.create(i,e)}static in(i,e){return jbt.create(i,e)}static notIn(i,e){return Qbt.create(i,e)}static not(i){return Zle.create(i)}static and(...i){return Ybt.create(i,null,!0)}static or(...i){return V4e.create(i,null,!0)}static greater(i,e){return _Y.create(i,e)}static greaterEquals(i,e){return N4e.create(i,e)}static smaller(i,e){return O4e.create(i,e)}static smallerEquals(i,e){return F4e.create(i,e)}static{this._parser=new Moi({regexParsingWithErrorRecovery:!1})}static deserialize(i){return i==null?void 0:this._parser.parse(i)}};function P4e(a,i){return a.cmp(i)}var Ww=class a{constructor(){this.type=0}static{this.INSTANCE=new a}cmp(i){return this.type-i.type}equals(i){return i.type===this.type}substituteConstants(){return this}evaluate(i){return!1}serialize(){return"false"}keys(){return[]}map(i){return this}negate(){return My.INSTANCE}},My=class a{constructor(){this.type=1}static{this.INSTANCE=new a}cmp(i){return this.type-i.type}equals(i){return i.type===this.type}substituteConstants(){return this}evaluate(i){return!0}serialize(){return"true"}keys(){return[]}map(i){return this}negate(){return Ww.INSTANCE}},lT=class a{constructor(i,e){this.key=i;this.negated=e;this.type=2}static create(i,e=null){let t=xI.get(i);return typeof t=="boolean"?t?My.INSTANCE:Ww.INSTANCE:new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:FQi(this.key,i.key)}equals(i){return i.type===this.type?this.key===i.key:!1}substituteConstants(){let i=xI.get(this.key);return typeof i=="boolean"?i?My.INSTANCE:Ww.INSTANCE:this}evaluate(i){return!!i.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}map(i){return i.mapDefined(this.key)}negate(){return this.negated||(this.negated=Zle.create(this.key,this)),this.negated}},CB=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=4}static create(i,e,t=null){if(typeof e=="boolean")return e?lT.create(i,t):Zle.create(i,t);let o=xI.get(i);return typeof o=="boolean"?e===(o?"true":"false")?My.INSTANCE:Ww.INSTANCE:new a(i,e,t)}cmp(i){return i.type!==this.type?this.type-i.type:ece(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){let i=xI.get(this.key);if(typeof i=="boolean"){let e=i?"true":"false";return this.value===e?My.INSTANCE:Ww.INSTANCE}return this}evaluate(i){return i.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}map(i){return i.mapEquals(this.key,this.value)}negate(){return this.negated||(this.negated=A4e.create(this.key,this.value,this)),this.negated}},jbt=class a{constructor(i,e){this.key=i;this.valueKey=e;this.type=10;this.negated=null}static create(i,e){return new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:ece(this.key,this.valueKey,i.key,i.valueKey)}equals(i){return i.type===this.type?this.key===i.key&&this.valueKey===i.valueKey:!1}substituteConstants(){return this}evaluate(i){let e=i.getValue(this.valueKey),t=i.getValue(this.key);if(Array.isArray(e)){if(e.includes(t))return!0;if(ii&&typeof t=="string"&&t.startsWith("file:///")){let o=t.toLowerCase();return e.some(n=>typeof n=="string"&&n.toLowerCase()===o)}return!1}if(typeof t=="string"&&typeof e=="object"&&e!==null){if(yKo.call(e,t))return!0;if(ii&&t.startsWith("file:///")){let o=t.toLowerCase();return Object.keys(e).some(n=>n.toLowerCase()===o)}return!1}return!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}map(i){return i.mapIn(this.key,this.valueKey)}negate(){return this.negated||(this.negated=Qbt.create(this.key,this.valueKey)),this.negated}},Qbt=class a{constructor(i,e){this.key=i;this.valueKey=e;this.type=11;this._negated=jbt.create(i,e)}static create(i,e){return new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:this._negated.cmp(i._negated)}equals(i){return i.type===this.type?this._negated.equals(i._negated):!1}substituteConstants(){return this}evaluate(i){return!this._negated.evaluate(i)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}map(i){return i.mapNotIn(this.key,this.valueKey)}negate(){return this._negated}},A4e=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=5}static create(i,e,t=null){if(typeof e=="boolean")return e?Zle.create(i,t):lT.create(i,t);let o=xI.get(i);return typeof o=="boolean"?e===(o?"true":"false")?Ww.INSTANCE:My.INSTANCE:new a(i,e,t)}cmp(i){return i.type!==this.type?this.type-i.type:ece(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){let i=xI.get(this.key);if(typeof i=="boolean"){let e=i?"true":"false";return this.value===e?Ww.INSTANCE:My.INSTANCE}return this}evaluate(i){return i.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}map(i){return i.mapNotEquals(this.key,this.value)}negate(){return this.negated||(this.negated=CB.create(this.key,this.value,this)),this.negated}},Zle=class a{constructor(i,e){this.key=i;this.negated=e;this.type=3}static create(i,e=null){let t=xI.get(i);return typeof t=="boolean"?t?Ww.INSTANCE:My.INSTANCE:new a(i,e)}cmp(i){return i.type!==this.type?this.type-i.type:FQi(this.key,i.key)}equals(i){return i.type===this.type?this.key===i.key:!1}substituteConstants(){let i=xI.get(this.key);return typeof i=="boolean"?i?Ww.INSTANCE:My.INSTANCE:this}evaluate(i){return!i.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}map(i){return i.mapNot(this.key)}negate(){return this.negated||(this.negated=lT.create(this.key,this)),this.negated}};function Jbt(a,i){if(typeof a=="string"){let e=parseFloat(a);isNaN(e)||(a=e)}return typeof a=="string"||typeof a=="number"?i(a):Ww.INSTANCE}var _Y=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=12}static create(i,e,t=null){return Jbt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:ece(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}map(i){return i.mapGreater(this.key,this.value)}negate(){return this.negated||(this.negated=F4e.create(this.key,this.value,this)),this.negated}},N4e=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=13}static create(i,e,t=null){return Jbt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:ece(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}map(i){return i.mapGreaterEquals(this.key,this.value)}negate(){return this.negated||(this.negated=O4e.create(this.key,this.value,this)),this.negated}},O4e=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=14}static create(i,e,t=null){return Jbt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:ece(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}map(i){return i.mapSmaller(this.key,this.value)}negate(){return this.negated||(this.negated=N4e.create(this.key,this.value,this)),this.negated}},F4e=class a{constructor(i,e,t){this.key=i;this.value=e;this.negated=t;this.type=15}static create(i,e,t=null){return Jbt(e,o=>new a(i,o,t))}cmp(i){return i.type!==this.type?this.type-i.type:ece(this.key,this.value,i.key,i.value)}equals(i){return i.type===this.type?this.key===i.key&&this.value===i.value:!1}substituteConstants(){return this}evaluate(i){return typeof this.value=="string"?!1:parseFloat(i.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}map(i){return i.mapSmallerEquals(this.key,this.value)}negate(){return this.negated||(this.negated=_Y.create(this.key,this.value,this)),this.negated}},W4e=class a{constructor(i,e){this.key=i;this.regexp=e;this.type=7;this.negated=null}static create(i,e){return new a(i,e)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.key<i.key)return-1;if(this.key>i.key)return 1;let e=this.regexp?this.regexp.source:"",t=i.regexp?i.regexp.source:"";return e<t?-1:e>t?1:0}equals(i){if(i.type===this.type){let e=this.regexp?this.regexp.source:"",t=i.regexp?i.regexp.source:"";return this.key===i.key&&e===t}return!1}substituteConstants(){return this}evaluate(i){let e=i.getValue(this.key);return this.regexp?this.regexp.test(e):!1}serialize(){let i=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${i}`}keys(){return[this.key]}map(i){return i.mapRegex(this.key,this.regexp)}negate(){return this.negated||(this.negated=Poi.create(this)),this.negated}},Poi=class a{constructor(i){this._actual=i;this.type=8}static create(i){return new a(i)}cmp(i){return i.type!==this.type?this.type-i.type:this._actual.cmp(i._actual)}equals(i){return i.type===this.type?this._actual.equals(i._actual):!1}substituteConstants(){return this}evaluate(i){return!this._actual.evaluate(i)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}map(i){return new a(this._actual.map(i))}negate(){return this._actual}};function OQi(a){let i=null;for(let e=0,t=a.length;e<t;e++){let o=a[e].substituteConstants();if(a[e]!==o&&i===null){i=[];for(let n=0;n<e;n++)i[n]=a[n]}i!==null&&(i[e]=o)}return i===null?a:i}var Ybt=class a{constructor(i,e){this.expr=i;this.negated=e;this.type=6}static create(i,e,t){return a._normalizeArr(i,e,t)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(let e=0,t=this.expr.length;e<t;e++){let o=P4e(this.expr[e],i.expr[e]);if(o!==0)return o}return 0}equals(i){if(i.type===this.type){if(this.expr.length!==i.expr.length)return!1;for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].equals(i.expr[e]))return!1;return!0}return!1}substituteConstants(){let i=OQi(this.expr);return i===this.expr?this:a.create(i,this.negated,!1)}evaluate(i){for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].evaluate(i))return!1;return!0}static _normalizeArr(i,e,t){let o=[],n=!1;for(let r of i)if(r){if(r.type===1){n=!0;continue}if(r.type===0)return Ww.INSTANCE;if(r.type===6){o.push(...r.expr);continue}o.push(r)}if(o.length===0&&n)return My.INSTANCE;if(o.length!==0){if(o.length===1)return o[0];o.sort(P4e);for(let r=1;r<o.length;r++)o[r-1].equals(o[r])&&(o.splice(r,1),r--);if(o.length===1)return o[0];for(;o.length>1;){let r=o[o.length-1];if(r.type!==9)break;o.pop();let s=o.pop(),l=o.length===0,c=V4e.create(r.expr.map(u=>a.create([u,s],null,t)),null,l);c&&(o.push(c),o.sort(P4e))}if(o.length===1)return o[0];if(t){for(let r=0;r<o.length;r++)for(let s=r+1;s<o.length;s++)if(o[r].negate().equals(o[s]))return Ww.INSTANCE;if(o.length===1)return o[0]}return new a(o,e)}}serialize(){return this.expr.map(i=>i.serialize()).join(" && ")}keys(){let i=[];for(let e of this.expr)i.push(...e.keys());return i}map(i){return new a(this.expr.map(e=>e.map(i)),null)}negate(){if(!this.negated){let i=[];for(let e of this.expr)i.push(e.negate());this.negated=V4e.create(i,this,!0)}return this.negated}},V4e=class a{constructor(i,e){this.expr=i;this.negated=e;this.type=9}static create(i,e,t){return a._normalizeArr(i,e,t)}cmp(i){if(i.type!==this.type)return this.type-i.type;if(this.expr.length<i.expr.length)return-1;if(this.expr.length>i.expr.length)return 1;for(let e=0,t=this.expr.length;e<t;e++){let o=P4e(this.expr[e],i.expr[e]);if(o!==0)return o}return 0}equals(i){if(i.type===this.type){if(this.expr.length!==i.expr.length)return!1;for(let e=0,t=this.expr.length;e<t;e++)if(!this.expr[e].equals(i.expr[e]))return!1;return!0}return!1}substituteConstants(){let i=OQi(this.expr);return i===this.expr?this:a.create(i,this.negated,!1)}evaluate(i){for(let e=0,t=this.expr.length;e<t;e++)if(this.expr[e].evaluate(i))return!0;return!1}static _normalizeArr(i,e,t){let o=[],n=!1;if(i){for(let r=0,s=i.length;r<s;r++){let l=i[r];if(l){if(l.type===0){n=!0;continue}if(l.type===1)return My.INSTANCE;if(l.type===9){o=o.concat(l.expr);continue}o.push(l)}}if(o.length===0&&n)return Ww.INSTANCE;o.sort(P4e)}if(o.length!==0){if(o.length===1)return o[0];for(let r=1;r<o.length;r++)o[r-1].equals(o[r])&&(o.splice(r,1),r--);if(o.length===1)return o[0];if(t){for(let r=0;r<o.length;r++)for(let s=r+1;s<o.length;s++)if(o[r].negate().equals(o[s]))return My.INSTANCE;if(o.length===1)return o[0]}return new a(o,e)}}serialize(){return this.expr.map(i=>i.serialize()).join(" || ")}keys(){let i=[];for(let e of this.expr)i.push(...e.keys());return i}map(i){return new a(this.expr.map(e=>e.map(i)),null)}negate(){if(!this.negated){let i=[];for(let e of this.expr)i.push(e.negate());for(;i.length>1;){let e=i.shift(),t=i.shift(),o=[];for(let n of AQi(e))for(let r of AQi(t))o.push(Ybt.create([n,r],null,!1));i.unshift(a.create(o,null,!1))}this.negated=a.create(i,this,!0)}return this.negated}},Y=class a extends lT{static{this._info=[]}static all(){return a._info.values()}constructor(i,e,t){super(i,null),this._defaultValue=e,typeof t=="object"?a._info.push({...t,key:i}):t!==!0&&a._info.push({key:i,description:t,type:e!=null?typeof e:void 0})}bindTo(i){return i.createKey(this.key,this._defaultValue)}getValue(i){return i.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(i){return CB.create(this.key,i)}notEqualsTo(i){return A4e.create(this.key,i)}greater(i){return _Y.create(this.key,i)}},X=le("contextKeyService");function FQi(a,i){return a<i?-1:a>i?1:0}function ece(a,i,e,t){return a<e?-1:a>e?1:i<t?-1:i>t?1:0}function Xbt(a,i){if(a.type===0||i.type===1)return!0;if(a.type===9)return i.type===9?PQi(a.expr,i.expr):!1;if(i.type===9){for(let e of i.expr)if(Xbt(a,e))return!0;return!1}if(a.type===6){if(i.type===6)return PQi(i.expr,a.expr);for(let e of a.expr)if(Xbt(e,i))return!0;return!1}return a.equals(i)}function PQi(a,i){let e=0,t=0;for(;e<a.length&&t<i.length;){let o=a[e].cmp(i[t]);if(o<0)return!1;o===0&&e++,t++}return e===a.length}function AQi(a){return a.type===9?a.expr:[a]}var Aoi=class{constructor(){this.data=new Map}add(i,e){rY(We(i)),rY(Di(e)),rY(!this.data.has(i),"There is already an extension with this id"),this.data.set(i,e)}knows(i){return this.data.has(i)}as(i){return this.data.get(i)||null}dispose(){this.data.forEach(i=>{bL(i.dispose)&&i.dispose()}),this.data.clear()}},oe=new Aoi;var Noi=class a{constructor(){this._coreKeybindings=new ra,this._coreKeybindingRules=new ra,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToPlatform(i,e){if(e===1){if(i&&i.win)return i.win}else if(e===2){if(i&&i.mac)return i.mac}else if(i&&i.linux)return i.linux;return i}static bindToCurrentPlatform(i){return a.bindToPlatform(i,Ao)}registerKeybindingRule(i){let e=a.bindToCurrentPlatform(i),t=new O;if(e&&e.primary){let n=a4e(e.primary,Ao);n&&t.add(this._registerDefaultKeybinding(n,i.id,i.args,i.weight,0,i.when))}if(e&&Array.isArray(e.secondary))for(let n=0,r=e.secondary.length;n<r;n++){let s=e.secondary[n],l=a4e(s,Ao);l&&t.add(this._registerDefaultKeybinding(l,i.id,i.args,i.weight,-n-1,i.when))}let o=this._coreKeybindingRules.push(i);return t.add(ee(()=>{o()})),t}setExtensionKeybindings(i){let e=[],t=0;for(let o of i)o.keybinding&&(e[t++]={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(i){return Fn(this.registerKeybindingRule(i),Ge.registerCommand(i))}_registerDefaultKeybinding(i,e,t,o,n,r){let s=this._coreKeybindings.push({keybinding:i,command:e,commandArgs:t,when:r,weight1:o,weight2:n,extensionId:null,isBuiltinExtension:!1});return this._cachedMergedKeybindings=null,ee(()=>{s(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(WQi)),this._cachedMergedKeybindings.slice(0)}getDefaultKeybindingsForOS(i){let e=[];for(let t of this._coreKeybindingRules){let o=a.bindToPlatform(t,i);if(o&&o.primary){let n=a4e(o.primary,i);n&&e.push({keybinding:n,command:t.id,commandArgs:t.args,when:t.when,weight1:t.weight,weight2:0,extensionId:null,isBuiltinExtension:!1})}if(o&&Array.isArray(o.secondary))for(let n=0,r=o.secondary.length;n<r;n++){let s=o.secondary[n],l=a4e(s,i);l&&e.push({keybinding:l,command:t.id,commandArgs:t.args,when:t.when,weight1:t.weight,weight2:-n-1,extensionId:null,isBuiltinExtension:!1})}}return e.sort(WQi),e}},xt=new Noi,RKo={EditorModes:"platform.keybindingsRegistry"};oe.add(RKo.EditorModes,xt);function WQi(a,i){if(a.weight1!==i.weight1)return a.weight1-i.weight1;if(a.command&&i.command){if(a.command<i.command)return-1;if(a.command>i.command)return 1}return a.weight2-i.weight2}function cT(a){return a.command!==void 0}function VQi(a){return a.submenu!==void 0}var R=class a{static{this._instances=new Map}static{this.CommandPalette=new a("CommandPalette")}static{this.DebugBreakpointsContext=new a("DebugBreakpointsContext")}static{this.DebugCallStackContext=new a("DebugCallStackContext")}static{this.DebugConsoleContext=new a("DebugConsoleContext")}static{this.DebugVariablesContext=new a("DebugVariablesContext")}static{this.NotebookVariablesContext=new a("NotebookVariablesContext")}static{this.DebugHoverContext=new a("DebugHoverContext")}static{this.DebugWatchContext=new a("DebugWatchContext")}static{this.DebugToolBar=new a("DebugToolBar")}static{this.DebugToolBarStop=new a("DebugToolBarStop")}static{this.DebugDisassemblyContext=new a("DebugDisassemblyContext")}static{this.DebugCallStackToolbar=new a("DebugCallStackToolbar")}static{this.DebugCreateConfiguration=new a("DebugCreateConfiguration")}static{this.DebugScopesContext=new a("DebugScopesContext")}static{this.EditorContext=new a("EditorContext")}static{this.SimpleEditorContext=new a("SimpleEditorContext")}static{this.EditorContent=new a("EditorContent")}static{this.EditorLineNumberContext=new a("EditorLineNumberContext")}static{this.EditorContextCopy=new a("EditorContextCopy")}static{this.EditorContextPeek=new a("EditorContextPeek")}static{this.EditorContextShare=new a("EditorContextShare")}static{this.EditorTitle=new a("EditorTitle")}static{this.EditorTitleLayout=new a("EditorTitleLayout")}static{this.ModalEditorTitle=new a("ModalEditorTitle")}static{this.ModalEditorTitleContext=new a("ModalEditorTitleContext")}static{this.ModalEditorEditorTitle=new a("ModalEditorEditorTitle")}static{this.CompactWindowEditorTitle=new a("CompactWindowEditorTitle")}static{this.EditorTitleRun=new a("EditorTitleRun")}static{this.EditorTitleContext=new a("EditorTitleContext")}static{this.EditorTitleContextShare=new a("EditorTitleContextShare")}static{this.EmptyEditorGroup=new a("EmptyEditorGroup")}static{this.EmptyEditorGroupContext=new a("EmptyEditorGroupContext")}static{this.EditorTabsBarContext=new a("EditorTabsBarContext")}static{this.EditorTabsBarShowTabsSubmenu=new a("EditorTabsBarShowTabsSubmenu")}static{this.EditorTabsBarShowTabsZenModeSubmenu=new a("EditorTabsBarShowTabsZenModeSubmenu")}static{this.EditorActionsPositionSubmenu=new a("EditorActionsPositionSubmenu")}static{this.EditorRenderWhitespaceSubmenu=new a("EditorRenderWhitespaceSubmenu")}static{this.EditorSplitMoveSubmenu=new a("EditorSplitMoveSubmenu")}static{this.ExplorerContext=new a("ExplorerContext")}static{this.ExplorerContextShare=new a("ExplorerContextShare")}static{this.ExtensionContext=new a("ExtensionContext")}static{this.ExtensionEditorContextMenu=new a("ExtensionEditorContextMenu")}static{this.GlobalActivity=new a("GlobalActivity")}static{this.CommandCenter=new a("CommandCenter")}static{this.CommandCenterCenter=new a("CommandCenterCenter")}static{this.LayoutControlMenuSubmenu=new a("LayoutControlMenuSubmenu")}static{this.LayoutControlMenu=new a("LayoutControlMenu")}static{this.MenubarMainMenu=new a("MenubarMainMenu")}static{this.MenubarAppearanceMenu=new a("MenubarAppearanceMenu")}static{this.MenubarDebugMenu=new a("MenubarDebugMenu")}static{this.MenubarEditMenu=new a("MenubarEditMenu")}static{this.MenubarCopy=new a("MenubarCopy")}static{this.MenubarFileMenu=new a("MenubarFileMenu")}static{this.MenubarGoMenu=new a("MenubarGoMenu")}static{this.MenubarHelpMenu=new a("MenubarHelpMenu")}static{this.MenubarLayoutMenu=new a("MenubarLayoutMenu")}static{this.MenubarNewBreakpointMenu=new a("MenubarNewBreakpointMenu")}static{this.PanelAlignmentMenu=new a("PanelAlignmentMenu")}static{this.PanelPositionMenu=new a("PanelPositionMenu")}static{this.ActivityBarPositionMenu=new a("ActivityBarPositionMenu")}static{this.NotificationsCenterPositionMenu=new a("NotificationsCenterPositionMenu")}static{this.MenubarPreferencesMenu=new a("MenubarPreferencesMenu")}static{this.MenubarRecentMenu=new a("MenubarRecentMenu")}static{this.MenubarSelectionMenu=new a("MenubarSelectionMenu")}static{this.MenubarShare=new a("MenubarShare")}static{this.MenubarSwitchEditorMenu=new a("MenubarSwitchEditorMenu")}static{this.MenubarSwitchGroupMenu=new a("MenubarSwitchGroupMenu")}static{this.MenubarTerminalMenu=new a("MenubarTerminalMenu")}static{this.MenubarTerminalSuggestStatusMenu=new a("MenubarTerminalSuggestStatusMenu")}static{this.MenubarViewMenu=new a("MenubarViewMenu")}static{this.MenubarHomeMenu=new a("MenubarHomeMenu")}static{this.OpenEditorsContext=new a("OpenEditorsContext")}static{this.OpenEditorsContextShare=new a("OpenEditorsContextShare")}static{this.ProblemsPanelContext=new a("ProblemsPanelContext")}static{this.SCMInputBox=new a("SCMInputBox")}static{this.SCMChangeContext=new a("SCMChangeContext")}static{this.SCMResourceContext=new a("SCMResourceContext")}static{this.SCMResourceContextShare=new a("SCMResourceContextShare")}static{this.SCMResourceFolderContext=new a("SCMResourceFolderContext")}static{this.SCMResourceGroupContext=new a("SCMResourceGroupContext")}static{this.SCMSourceControl=new a("SCMSourceControl")}static{this.SCMSourceControlInline=new a("SCMSourceControlInline")}static{this.SCMSourceControlTitle=new a("SCMSourceControlTitle")}static{this.SCMHistoryTitle=new a("SCMHistoryTitle")}static{this.SCMHistoryItemContext=new a("SCMHistoryItemContext")}static{this.SCMHistoryItemChangeContext=new a("SCMHistoryItemChangeContext")}static{this.SCMHistoryItemRefContext=new a("SCMHistoryItemRefContext")}static{this.SCMArtifactGroupContext=new a("SCMArtifactGroupContext")}static{this.SCMArtifactContext=new a("SCMArtifactContext")}static{this.SCMQuickDiffDecorations=new a("SCMQuickDiffDecorations")}static{this.SCMTitle=new a("SCMTitle")}static{this.SearchContext=new a("SearchContext")}static{this.SearchActionMenu=new a("SearchActionContext")}static{this.StatusBarWindowIndicatorMenu=new a("StatusBarWindowIndicatorMenu")}static{this.StatusBarRemoteIndicatorMenu=new a("StatusBarRemoteIndicatorMenu")}static{this.StickyScrollContext=new a("StickyScrollContext")}static{this.TestItem=new a("TestItem")}static{this.TestItemGutter=new a("TestItemGutter")}static{this.TestProfilesContext=new a("TestProfilesContext")}static{this.TestMessageContext=new a("TestMessageContext")}static{this.TestMessageContent=new a("TestMessageContent")}static{this.TestPeekElement=new a("TestPeekElement")}static{this.TestPeekTitle=new a("TestPeekTitle")}static{this.TestCallStack=new a("TestCallStack")}static{this.TestCoverageFilterItem=new a("TestCoverageFilterItem")}static{this.TouchBarContext=new a("TouchBarContext")}static{this.TitleBar=new a("TitleBar")}static{this.TitleBarAdjacentCenter=new a("TitleBarAdjacentCenter")}static{this.TitleBarContext=new a("TitleBarContext")}static{this.TitleBarTitleContext=new a("TitleBarTitleContext")}static{this.TunnelContext=new a("TunnelContext")}static{this.TunnelPrivacy=new a("TunnelPrivacy")}static{this.TunnelProtocol=new a("TunnelProtocol")}static{this.TunnelPortInline=new a("TunnelInline")}static{this.TunnelTitle=new a("TunnelTitle")}static{this.TunnelLocalAddressInline=new a("TunnelLocalAddressInline")}static{this.TunnelOriginInline=new a("TunnelOriginInline")}static{this.ViewItemContext=new a("ViewItemContext")}static{this.ViewContainerTitle=new a("ViewContainerTitle")}static{this.ViewContainerTitleContext=new a("ViewContainerTitleContext")}static{this.ViewTitle=new a("ViewTitle")}static{this.ViewTitleContext=new a("ViewTitleContext")}static{this.CommentEditorActions=new a("CommentEditorActions")}static{this.CommentThreadTitle=new a("CommentThreadTitle")}static{this.CommentThreadActions=new a("CommentThreadActions")}static{this.CommentThreadAdditionalActions=new a("CommentThreadAdditionalActions")}static{this.CommentThreadTitleContext=new a("CommentThreadTitleContext")}static{this.CommentThreadCommentContext=new a("CommentThreadCommentContext")}static{this.CommentTitle=new a("CommentTitle")}static{this.CommentActions=new a("CommentActions")}static{this.CommentsViewThreadActions=new a("CommentsViewThreadActions")}static{this.InteractiveToolbar=new a("InteractiveToolbar")}static{this.InteractiveCellTitle=new a("InteractiveCellTitle")}static{this.InteractiveCellDelete=new a("InteractiveCellDelete")}static{this.InteractiveCellExecute=new a("InteractiveCellExecute")}static{this.InteractiveInputExecute=new a("InteractiveInputExecute")}static{this.InteractiveInputConfig=new a("InteractiveInputConfig")}static{this.ReplInputExecute=new a("ReplInputExecute")}static{this.IssueReporter=new a("IssueReporter")}static{this.NotebookToolbar=new a("NotebookToolbar")}static{this.NotebookToolbarContext=new a("NotebookToolbarContext")}static{this.NotebookStickyScrollContext=new a("NotebookStickyScrollContext")}static{this.NotebookCellTitle=new a("NotebookCellTitle")}static{this.NotebookCellDelete=new a("NotebookCellDelete")}static{this.NotebookCellInsert=new a("NotebookCellInsert")}static{this.NotebookCellBetween=new a("NotebookCellBetween")}static{this.NotebookCellListTop=new a("NotebookCellTop")}static{this.NotebookCellExecute=new a("NotebookCellExecute")}static{this.NotebookCellExecuteGoTo=new a("NotebookCellExecuteGoTo")}static{this.NotebookCellExecutePrimary=new a("NotebookCellExecutePrimary")}static{this.NotebookDiffCellInputTitle=new a("NotebookDiffCellInputTitle")}static{this.NotebookDiffDocumentMetadata=new a("NotebookDiffDocumentMetadata")}static{this.NotebookDiffCellMetadataTitle=new a("NotebookDiffCellMetadataTitle")}static{this.NotebookDiffCellOutputsTitle=new a("NotebookDiffCellOutputsTitle")}static{this.NotebookOutputToolbar=new a("NotebookOutputToolbar")}static{this.NotebookOutlineFilter=new a("NotebookOutlineFilter")}static{this.NotebookOutlineActionMenu=new a("NotebookOutlineActionMenu")}static{this.NotebookEditorLayoutConfigure=new a("NotebookEditorLayoutConfigure")}static{this.NotebookKernelSource=new a("NotebookKernelSource")}static{this.BulkEditTitle=new a("BulkEditTitle")}static{this.BulkEditContext=new a("BulkEditContext")}static{this.TimelineItemContext=new a("TimelineItemContext")}static{this.TimelineTitle=new a("TimelineTitle")}static{this.TimelineTitleContext=new a("TimelineTitleContext")}static{this.TimelineFilterSubMenu=new a("TimelineFilterSubMenu")}static{this.AccountsContext=new a("AccountsContext")}static{this.SidebarTitle=new a("SidebarTitle")}static{this.PanelTitle=new a("PanelTitle")}static{this.AuxiliaryBarTitle=new a("AuxiliaryBarTitle")}static{this.TerminalInstanceContext=new a("TerminalInstanceContext")}static{this.TerminalEditorInstanceContext=new a("TerminalEditorInstanceContext")}static{this.TerminalNewDropdownContext=new a("TerminalNewDropdownContext")}static{this.TerminalTabContext=new a("TerminalTabContext")}static{this.TerminalTabEmptyAreaContext=new a("TerminalTabEmptyAreaContext")}static{this.TerminalStickyScrollContext=new a("TerminalStickyScrollContext")}static{this.WebviewContext=new a("WebviewContext")}static{this.InlineCompletionsActions=new a("InlineCompletionsActions")}static{this.InlineEditsActions=new a("InlineEditsActions")}static{this.NewFile=new a("NewFile")}static{this.MergeInput1Toolbar=new a("MergeToolbar1Toolbar")}static{this.MergeInput2Toolbar=new a("MergeToolbar2Toolbar")}static{this.MergeBaseToolbar=new a("MergeBaseToolbar")}static{this.MergeInputResultToolbar=new a("MergeToolbarResultToolbar")}static{this.InlineSuggestionToolbar=new a("InlineSuggestionToolbar")}static{this.InlineEditToolbar=new a("InlineEditToolbar")}static{this.ChatContext=new a("ChatContext")}static{this.ChatCodeBlock=new a("ChatCodeblock")}static{this.ChatCompareBlock=new a("ChatCompareBlock")}static{this.ChatMessageTitle=new a("ChatMessageTitle")}static{this.ChatWelcomeContext=new a("ChatWelcomeContext")}static{this.ChatMessageFooter=new a("ChatMessageFooter")}static{this.ChatExecute=new a("ChatExecute")}static{this.ChatExecuteQueue=new a("ChatExecuteQueue")}static{this.ChatInput=new a("ChatInput")}static{this.ChatInputSecondary=new a("ChatInputSecondary")}static{this.ChatInputSide=new a("ChatInputSide")}static{this.ChatModePicker=new a("ChatModePicker")}static{this.ChatEditingWidgetToolbar=new a("ChatEditingWidgetToolbar")}static{this.ChatEditingSessionChangesToolbar=new a("ChatEditingSessionChangesToolbar")}static{this.ChatEditingSessionTitleToolbar=new a("ChatEditingSessionTitleToolbar")}static{this.ChatEditingSessionChangesVersionsSubmenu=new a("ChatEditingSessionChangesVersionsSubmenu")}static{this.ChatEditingSessionChangesFileHeaderToolbar=new a("ChatEditingSessionChangesFileHeaderToolbar")}static{this.ChatEditingSessionChangesFileHeaderRightToolbar=new a("ChatEditingSessionChangesFileHeaderRightToolbar")}static{this.ChatEditingEditorContent=new a("ChatEditingEditorContent")}static{this.ChatEditingEditorHunk=new a("ChatEditingEditorHunk")}static{this.ChatEditingDeletedNotebookCell=new a("ChatEditingDeletedNotebookCell")}static{this.ChatInputAttachmentToolbar=new a("ChatInputAttachmentToolbar")}static{this.ChatEditingWidgetModifiedFilesToolbar=new a("ChatEditingWidgetModifiedFilesToolbar")}static{this.ChatInputResourceAttachmentContext=new a("ChatInputResourceAttachmentContext")}static{this.ChatInputSymbolAttachmentContext=new a("ChatInputSymbolAttachmentContext")}static{this.ChatInlineResourceAnchorContext=new a("ChatInlineResourceAnchorContext")}static{this.ChatInlineSymbolAnchorContext=new a("ChatInlineSymbolAnchorContext")}static{this.ChatMessageCheckpoint=new a("ChatMessageCheckpoint")}static{this.ChatMessageRestoreCheckpoint=new a("ChatMessageRestoreCheckpoint")}static{this.ChatNewMenu=new a("ChatNewMenu")}static{this.ChatEditingCodeBlockContext=new a("ChatEditingCodeBlockContext")}static{this.ChatTitleBarMenu=new a("ChatTitleBarMenu")}static{this.ChatAttachmentsContext=new a("ChatAttachmentsContext")}static{this.ChatTipContext=new a("ChatTipContext")}static{this.ChatTipToolbar=new a("ChatTipToolbar")}static{this.ChatToolOutputResourceToolbar=new a("ChatToolOutputResourceToolbar")}static{this.ChatTextEditorMenu=new a("ChatTextEditorMenu")}static{this.ChatToolOutputResourceContext=new a("ChatToolOutputResourceContext")}static{this.ChatMultiDiffContext=new a("ChatMultiDiffContext")}static{this.ChatConfirmationMenu=new a("ChatConfirmationMenu")}static{this.ChatEditorInlineMenu=new a("ChatEditorInlineGutter")}static{this.ChatEditorInlineExecute=new a("ChatEditorInputExecute")}static{this.ChatEditorInlineInputSide=new a("ChatEditorInputSide")}static{this.InlineChatEditorAffordance=new a("InlineChatEditorAffordance")}static{this.AccessibleView=new a("AccessibleView")}static{this.MultiDiffEditorContent=new a("MultiDiffEditorContent")}static{this.MultiDiffEditorFileToolbar=new a("MultiDiffEditorFileToolbar")}static{this.DiffEditorHunkToolbar=new a("DiffEditorHunkToolbar")}static{this.DiffEditorSelectionToolbar=new a("DiffEditorSelectionToolbar")}static{this.BrowserNavigationToolbar=new a("BrowserNavigationToolbar")}static{this.BrowserActionsToolbar=new a("BrowserActionsToolbar")}static{this.AgentSessionsViewerFilterSubMenu=new a("AgentSessionsViewerFilterSubMenu")}static{this.AgentSessionsContext=new a("AgentSessionsContext")}static{this.AgentSessionSectionContext=new a("AgentSessionSectionContext")}static{this.AgentSessionsCreateSubMenu=new a("AgentSessionsCreateSubMenu")}static{this.AgentSessionsToolbar=new a("AgentSessionsToolbar")}static{this.AgentSessionItemToolbar=new a("AgentSessionItemToolbar")}static{this.AgentSessionSectionToolbar=new a("AgentSessionSectionToolbar")}static{this.AgentsTitleBarControlMenu=new a("AgentsTitleBarControlMenu")}static{this.AgentsChangesToolbar=new a("AgentsChangesToolbar")}static{this.AgentsChangesPrimaryActionSubMenu=new a("AgentsChangesPrimaryActionSubMenu")}static{this.AgentsChangeInlineToolbar=new a("AgentsChangeInlineToolbar")}static{this.ChatViewSessionTitleNavigationToolbar=new a("ChatViewSessionTitleNavigationToolbar")}static{this.ChatViewSessionTitleToolbar=new a("ChatViewSessionTitleToolbar")}static{this.ChatContextUsageActions=new a("ChatContextUsageActions")}static{this.MarkerHoverStatusBar=new a("MarkerHoverParticipant.StatusBar")}static for(i){return a._instances.get(i)??new a(i)}constructor(i){if(a._instances.has(i))throw new TypeError(`MenuId with identifier '${i}' already exists. Use MenuId.for(ident) or a unique identifier`);a._instances.set(i,this),this.id=i}},Yt=le("menuService"),tce=class a{constructor(i){this.id=i;this.has=e=>e===i}static{this._all=new Map}static for(i){let e=this._all.get(i);return e||(e=new a(i),this._all.set(i,e)),e}static merge(i){let e=new Set;for(let t of i)t instanceof a&&e.add(t.id);return e}},be=new class{constructor(){this._commands=new Map;this._menuItems=new Map;this._onDidChangeMenu=new aY({merge:tce.merge});this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(a){return this._commands.set(a.id,a),this._onDidChangeMenu.fire(tce.for(R.CommandPalette)),bp(ee(()=>{this._commands.delete(a.id)&&this._onDidChangeMenu.fire(tce.for(R.CommandPalette))}))}getCommand(a){return this._commands.get(a)}getCommands(){let a=new Map;return this._commands.forEach((i,e)=>a.set(e,i)),a}appendMenuItem(a,i){let e=this._menuItems.get(a);e||(e=new ra,this._menuItems.set(a,e));let t=e.push(i);return this._onDidChangeMenu.fire(tce.for(a)),bp(ee(()=>{t(),this._onDidChangeMenu.fire(tce.for(a))}))}appendMenuItems(a){let i=new O;for(let{id:e,item:t}of a)i.add(this.appendMenuItem(e,t));return i}getMenuItems(a){let i;return this._menuItems.has(a)?i=[...this._menuItems.get(a)]:i=[],a===R.CommandPalette&&this._appendImplicitItems(i),i}_appendImplicitItems(a){let i=new Set;for(let e of a)cT(e)&&(i.add(e.command.id),e.alt&&i.add(e.alt.id));this._commands.forEach((e,t)=>{i.has(t)||a.push({command:e})})}},id=class extends sa{constructor(e,t,o){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,o,"submenu");this.item=e;this.hideActions=t}},Do=class{constructor(i,e,t,o,n,r,s){this.hideActions=o;this.menuKeybinding=n;this._commandService=s;this.id=i.id,this.label=Do.label(i,t),this.tooltip=(typeof i.tooltip=="string"?i.tooltip:i.tooltip?.value)??"",this.enabled=!i.precondition||r.contextMatchesRules(i.precondition),this.checked=void 0;let l;if(i.toggled){let c=i.toggled.condition?i.toggled:{condition:i.toggled};this.checked=r.contextMatchesRules(c.condition),this.checked&&c.tooltip&&(this.tooltip=typeof c.tooltip=="string"?c.tooltip:c.tooltip.value),this.checked&&q.isThemeIcon(c.icon)&&(l=c.icon),this.checked&&c.title&&(this.label=typeof c.title=="string"?c.title:c.title.value)}l||(l=q.isThemeIcon(i.icon)?i.icon:void 0),this.item=i,this.alt=e?new Do(e,void 0,t,o,void 0,r,s):void 0,this._options=t,this.class=l&&q.asClassName(l)}static label(i,e){return e?.renderShortTitle&&i.shortTitle?typeof i.shortTitle=="string"?i.shortTitle:i.shortTitle.value:typeof i.title=="string"?i.title:i.title.value}run(...i){let e=[];return this._options?.args?e=[...e,...this._options.args]:this._options?.arg&&(e=[...e,this._options.arg]),this._options?.shouldForwardArgs&&(e=[...e,...i]),this._commandService.executeCommand(this.id,...e)}};Do=I([m(5,X),m(6,fe)],Do);var z=class{constructor(i){this.desc=i}};function W(a){let i=[],e=new a,{f1:t,menu:o,keybinding:n,...r}=e.desc;if(Ge.getCommand(r.id))throw new Error(`Cannot register two commands with the same id: ${r.id}`);if(i.push(Ge.registerCommand({id:r.id,handler:(s,...l)=>e.run(s,...l),metadata:r.metadata??{description:e.desc.title}})),Array.isArray(o))for(let s of o)i.push(be.appendMenuItem(s.id,{command:{...r,precondition:s.precondition===null?void 0:r.precondition},...s}));else o&&i.push(be.appendMenuItem(o.id,{command:{...r,precondition:o.precondition===null?void 0:r.precondition},...o}));if(t&&(i.push(be.appendMenuItem(R.CommandPalette,{command:r,when:r.precondition})),i.push(be.addCommand(r))),Array.isArray(n))for(let s of n)i.push(xt.registerKeybindingRule({...s,id:r.id,when:r.precondition?C.and(r.precondition,s.when):s.when}));else n&&i.push(xt.registerKeybindingRule({...n,id:r.id,when:r.precondition?C.and(r.precondition,n.when):n.when}));return{dispose(){je(i)}}}var _e=le("telemetryService");function BQi(a,i){return a.telemetryLevel>=i}function Wwe(a){return a?.replace(/[\/\\]/g,"|")}var Zbt=le("customEndpointTelemetryService");var eSt="telemetry.firstSessionDate",HQi="telemetry.lastSessionDate";var UQi="telemetry",dT="telemetry.telemetryLevel",DY="telemetry.enableCrashReporter",xB="telemetry.enableTelemetry";function Ooi(a,i){return i&&(a.stack||a.stacktrace)?d(116,null,KQi(a),zQi(a.stack)||zQi(a.stacktrace)):KQi(a)}function zQi(a){return Array.isArray(a)?a.join(`
`):a}function KQi(a){return a.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${a.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof a.code=="string"&&typeof a.errno=="number"&&typeof a.syscall=="string"?d(115,null,a.message):a.message||d(113,null)}function Mn(a=null,i=!1){if(!a)return d(113,null);if(Array.isArray(a)){let e=ui(a),t=Mn(e[0],i);return e.length>1?d(114,null,t,e.length):t}if(We(a))return a;if(a.detail){let e=a.detail;if(e.error)return Ooi(e.error,i);if(e.exception)return Ooi(e.exception,i)}return a.stack?Ooi(a,i):a.message?a.message:d(113,null)}function RY(a){let i=a;return i instanceof Error&&Array.isArray(i.actions)}function Rz(a,i){let e;return typeof a=="string"?e=new Error(a):e=a,e.actions=i,e}var re=le("logService"),Ol=le("loggerService");function LY(a){return on(a)}var U4e=3;function Bwe(a,i){return a!==0&&a<=i}function MY(a,i,e){switch(i){case 1:a.trace(e);break;case 2:a.debug(e);break;case 3:a.info(e);break;case 4:a.warn(e);break;case 5:a.error(e);break;case 0:break;default:throw new Error(`Invalid log level ${i}`)}}var rSt=!1,Foi=!1,Woi=!1;function LKo(a){switch(a){case"debug":return console.debug;case"error":return console.error;case"info":return console.info;case"log":return console.log;case"warn":return console.warn}}function B4e(a,i){switch(a){case"debug":console.debug=i;break;case"error":console.error=i;break;case"info":console.info=i;break;case"log":console.log=i;break;case"warn":console.warn=i;break}}function Lz(a,...i){if(!Foi){Woi=!0;try{LKo(a).apply(console,i)}finally{Woi=!1}}}function GQi(a){let i={debug:console.debug,error:console.error,info:console.info,log:console.log,warn:console.warn},e=(o,n,r)=>{if(!Woi){Foi=!0;try{MY(a,n,ice(r))}catch{}finally{Foi=!1}}i[o].apply(console,r)},t={debug:(...o)=>e("debug",2,o),error:(...o)=>e("error",5,o),info:(...o)=>e("info",3,o),log:(...o)=>e("log",3,o),warn:(...o)=>e("warn",4,o)};return B4e("debug",t.debug),B4e("error",t.error),B4e("info",t.info),B4e("log",t.log),B4e("warn",t.warn),ee(()=>{console.debug===t.debug&&(console.debug=i.debug),console.error===t.error&&(console.error=i.error),console.info===t.info&&(console.info=i.info),console.log===t.log&&(console.log=i.log),console.warn===t.warn&&(console.warn=i.warn)})}function ice(a,i=!1){let e="";for(let t=0;t<a.length;t++){let o=a[t];if(o instanceof Error&&(o=Mn(o,i)),typeof o=="object")try{o=JSON.stringify(o)}catch{}e+=(t>0?" ":"")+o}return e}var Mz=class extends k{constructor(){super(...arguments);this.level=U4e;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 Bwe(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}},Vwe=class extends Mz{constructor(e){super();this.logAlways=e}checkLogLevel(e){return this.logAlways||super.checkLogLevel(e)}trace(e,...t){this.canLog(1)&&this.log(1,ice([e,...t],!0))}debug(e,...t){this.canLog(2)&&this.log(2,ice([e,...t]))}info(e,...t){this.canLog(3)&&this.log(3,ice([e,...t]))}warn(e,...t){this.canLog(4)&&this.log(4,ice([e,...t]))}error(e,...t){if(this.canLog(5))if(e instanceof Error){let o=Array.prototype.slice.call(arguments);o[0]=e.stack,this.log(5,ice(o))}else this.log(5,ice([e,...t]))}flush(){}};var tSt=class extends Mz{constructor(e=U4e,t=!0){super();this.useColors=t;this.setLevel(e)}trace(e,...t){this.canLog(1)&&(this.useColors?Lz("log","%cTRACE","color: #888",e,...t):Lz("log",e,...t))}debug(e,...t){this.canLog(2)&&(this.useColors?Lz("log","%cDEBUG","background: #eee; color: #888",e,...t):Lz("log",e,...t))}info(e,...t){this.canLog(3)&&(this.useColors?Lz("log","%c INFO","color: #33f",e,...t):Lz("log",e,...t))}warn(e,...t){this.canLog(4)&&(this.useColors?Lz("warn","%c WARN","color: #993",e,...t):Lz("log",e,...t))}error(e,...t){this.canLog(5)&&(this.useColors?Lz("error","%c  ERR","color: #f33",e,...t):Lz("error",e,...t))}flush(){}},H4e=class extends Mz{constructor(e,t=U4e){super();this.adapter=e;this.setLevel(t)}trace(e,...t){this.canLog(1)&&this.adapter.log(1,[this.extractMessage(e),...t])}debug(e,...t){this.canLog(2)&&this.adapter.log(2,[this.extractMessage(e),...t])}info(e,...t){this.canLog(3)&&this.adapter.log(3,[this.extractMessage(e),...t])}warn(e,...t){this.canLog(4)&&this.adapter.log(4,[this.extractMessage(e),...t])}error(e,...t){this.canLog(5)&&this.adapter.log(5,[this.extractMessage(e),...t])}extractMessage(e){return typeof e=="string"?e:Mn(e,this.canLog(1))}flush(){}},iSt=class extends Mz{constructor(e){super();this.loggers=e;e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(let t of this.loggers)t.setLevel(e);super.setLevel(e)}trace(e,...t){for(let o of this.loggers)o.trace(e,...t)}debug(e,...t){for(let o of this.loggers)o.debug(e,...t)}info(e,...t){for(let o of this.loggers)o.info(e,...t)}warn(e,...t){for(let o of this.loggers)o.warn(e,...t)}error(e,...t){for(let o of this.loggers)o.error(e,...t)}flush(){for(let e of this.loggers)e.flush()}dispose(){for(let e of this.loggers)e.dispose();super.dispose()}},oSt=class extends k{constructor(e,t,o){super();this.logLevel=e;this.logsHome=t;this._loggers=new dt;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 n of o)this._loggers.set(n.resource,{logger:void 0,info:n})}getLoggerEntry(e){return We(e)?[...this._loggers.values()].find(t=>t.info.id===e):this._loggers.get(e)}getLogger(e){return this.getLoggerEntry(e)?.logger}createLogger(e,t){let o=this.toResource(e),n=We(e)?e:t?.id??Lr(o.toString()).toString(16),r=this._loggers.get(o)?.logger,s=t?.logLevel==="always"?1:t?.logLevel;r||(r=this.doCreateLogger(o,s??this.getLogLevel(o)??this.logLevel,{...t,id:n}));let l={logger:r,info:{resource:o,id:n,logLevel:s,name:t?.name,hidden:t?.hidden,group:t?.group,extensionId:t?.extensionId,when:t?.when}};return this.registerLogger(l.info),this._loggers.set(o,l),r}toResource(e){return We(e)?Ve(this.logsHome,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`):e}setLogLevel(e,t){if(A.isUri(e)){let o=e,n=t,r=this._loggers.get(o);r&&n!==r.info.logLevel&&(r.info.logLevel=n===this.logLevel?void 0:n,r.logger?.setLevel(n),this._loggers.set(r.info.resource,r),this._onDidChangeLogLevel.fire([o,n]))}else{this.logLevel=e;for(let[o,n]of this._loggers.entries())this._loggers.get(o)?.info.logLevel===void 0&&n.logger?.setLevel(this.logLevel);this._onDidChangeLogLevel.fire(this.logLevel)}}setVisibility(e,t){let o=this.getLoggerEntry(e);o&&t!==!o.info.hidden&&(o.info.hidden=!t,this._loggers.set(o.info.resource,o),this._onDidChangeVisibility.fire([o.info.resource,t]))}getLogLevel(e){let t;return e&&(t=this._loggers.get(e)?.info.logLevel),t??this.logLevel}registerLogger(e){let t=this._loggers.get(e.resource);t?t.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 t=this.toResource(e),o=this._loggers.get(t);o&&(o.logger&&o.logger.dispose(),this._loggers.delete(t),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()}},Voi=class{constructor(){this.onDidChangeLogLevel=new T().event}setLevel(i){}getLevel(){return 3}trace(i,...e){}debug(i,...e){}info(i,...e){}warn(i,...e){}error(i,...e){}critical(i,...e){}dispose(){}flush(){}},nSt=class extends Voi{};function Boi(a){if(a.verbose)return 1;if(typeof a.logLevel=="string"){let i=oce(a.logLevel.toLowerCase());if(i!==void 0)return i}return U4e}function ux(a){switch(a){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";case 0:return"off"}}function z4e(a){switch(a){case 1:return{original:"Trace",value:d(2409,null)};case 2:return{original:"Debug",value:d(2405,null)};case 3:return{original:"Info",value:d(2407,null)};case 4:return{original:"Warning",value:d(2410,null)};case 5:return{original:"Error",value:d(2406,null)};case 0:return{original:"Off",value:d(2408,null)}}}function oce(a){switch(a){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warn":return 4;case"error":return 5;case"critical":return 5;case"off":return 0}}var qQi=new Y("logLevel",ux(3));var Hwe=class a{static{this.REGISTERED_COMMANDS=new Set}static getRegisteredCommands(){return[...a.REGISTERED_COMMANDS]}static registerCommand(i){a.REGISTERED_COMMANDS.add(i)}};var nce=class{constructor(i){this.id=i.id,this.precondition=i.precondition,this._kbOpts=i.kbOpts,this._menuOpts=i.menuOpts,this.metadata=i.metadata,this.canTriggerInlineEdits=i.canTriggerInlineEdits}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){let i=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(let e of i){let t=e.kbExpr;this.precondition&&(t?t=C.and(t,this.precondition):t=this.precondition);let o={id:this.id,weight:e.weight,args:e.args,when:t,primary:e.primary,secondary:e.secondary,win:e.win,linux:e.linux,mac:e.mac};xt.registerKeybindingRule(o)}}Ge.registerCommand({id:this.id,handler:(i,e)=>this.runCommand(i,e),metadata:this.metadata}),this.canTriggerInlineEdits&&Hwe.registerCommand(this.id)}_registerMenuItem(i){be.appendMenuItem(i.menuId,{group:i.group,command:{id:this.id,title:i.title,icon:i.icon,precondition:this.precondition},when:i.when,order:i.order})}},hF=class extends nce{constructor(){super(...arguments);this._implementations=[]}addImplementation(e,t,o,n){return this._implementations.push({priority:e,name:t,implementation:o,when:n}),this._implementations.sort((r,s)=>s.priority-r.priority),{dispose:()=>{for(let r=0;r<this._implementations.length;r++)if(this._implementations[r].implementation===o){this._implementations.splice(r,1);return}}}}runCommand(e,t){let o=e.get(re),n=e.get(X);o.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);for(let r of this._implementations){if(r.when){let l=n.getContext(Un());if(!r.when.evaluate(l))continue}let s=r.implementation(e,t);if(s)return o.trace(`Command '${this.id}' was handled by '${r.name}'.`),typeof s=="boolean"?void 0:s}o.trace(`The Command '${this.id}' was not handled by any implementation.`)}},sSt=class extends nce{constructor(e,t){super(t);this.command=e}runCommand(e,t){return this.command.runCommand(e,t)}},od=class a extends nce{static bindToContribution(i){return class extends a{constructor(t){super(t),this._callback=t.handler}runEditorCommand(t,o,n){let r=i(o);r&&this._callback(r,n)}}}static runEditorCommand(i,e,t,o){let n=i.get(Qt),r=n.getFocusedCodeEditor()||n.getActiveCodeEditor();if(r)return r.invokeWithinContext(s=>{if(s.get(X).contextMatchesRules(t??void 0))return o(s,r,e)})}runCommand(i,e){return a.runEditorCommand(i,e,this.precondition,(t,o,n)=>this.runEditorCommand(t,o,n))}},Mi=class a extends od{static convertOptions(i){let e;Array.isArray(i.menuOpts)?e=i.menuOpts:i.menuOpts?e=[i.menuOpts]:e=[];function t(o){return o.menuId||(o.menuId=R.EditorContext),o.title||(o.title=typeof i.label=="string"?i.label:i.label.value),o.when=C.and(i.precondition,o.when),o}return Array.isArray(i.contextMenuOpts)?e.push(...i.contextMenuOpts.map(t)):i.contextMenuOpts&&e.push(t(i.contextMenuOpts)),i.menuOpts=e,i}constructor(i){super(a.convertOptions(i)),typeof i.label=="string"?(this.label=i.label,this.alias=i.alias??i.label):(this.label=i.label.value,this.alias=i.alias??i.label.original)}runEditorCommand(i,e,t){return this.reportTelemetry(i,e),this.run(i,e,t||{})}reportTelemetry(i,e){i.get(_e).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}},rce=class extends Mi{constructor(){super(...arguments);this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort((o,n)=>n[0]-o[0]),{dispose:()=>{for(let o=0;o<this._implementations.length;o++)if(this._implementations[o][1]===t){this._implementations.splice(o,1);return}}}}run(e,t,o){for(let n of this._implementations){let r=n[1](e,t,o);if(r)return typeof r=="boolean"?void 0:r}}},yl=class extends z{run(i,...e){let t=i.get(Qt),o=t.getFocusedCodeEditor()||t.getActiveCodeEditor();if(o)return o.invokeWithinContext(n=>{let r=n.get(X),s=n.get(re);if(!r.contextMatchesRules(this.desc.precondition??void 0)){s.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this.runEditorCommand(n,o,...e)})}};function kI(a,i){Ge.registerCommand(a,function(e,...t){let o=e.get(F),[n,r]=t;To(A.isUri(n)),To(ye.isIPosition(r));let s=e.get(_t).getModel(n);if(s){let l=ye.lift(r);return o.invokeFunction(i,s,l,...t.slice(2))}return e.get(Bt).createModelReference(n).then(l=>new Promise((c,u)=>{try{let p=o.invokeFunction(i,l.object.textEditorModel,ye.lift(r),t.slice(2));c(p)}catch(p){u(p)}}).finally(()=>{l.dispose()}))})}function ro(a){return OL.INSTANCE.registerEditorCommand(a),a}function ri(a){let i=new a;return OL.INSTANCE.registerEditorAction(i),i}function K4e(a){return OL.INSTANCE.registerEditorAction(a),a}function $Qi(a){OL.INSTANCE.registerEditorAction(a)}function Eo(a,i,e){OL.INSTANCE.registerEditorContribution(a,i,e)}function aSt(a,i){OL.INSTANCE.registerDiffEditorContribution(a,i)}var ml;(n=>{function a(r){return OL.INSTANCE.getEditorCommand(r)}n.getEditorCommand=a;function i(){return OL.INSTANCE.getEditorActions()}n.getEditorActions=i;function e(){return OL.INSTANCE.getEditorContributions()}n.getEditorContributions=e;function t(r){return OL.INSTANCE.getEditorContributions().filter(s=>r.indexOf(s.id)>=0)}n.getSomeEditorContributions=t;function o(){return OL.INSTANCE.getDiffEditorContributions()}n.getDiffEditorContributions=o})(ml||={});var MKo={EditorCommonContributions:"editor.contributions"},OL=class a{constructor(){this.editorContributions=[];this.diffEditorContributions=[];this.editorActions=[];this.editorCommands=Object.create(null)}static{this.INSTANCE=new a}registerEditorContribution(i,e,t){this.editorContributions.push({id:i,ctor:e,instantiation:t})}getEditorContributions(){return this.editorContributions.slice(0)}registerDiffEditorContribution(i,e){this.diffEditorContributions.push({id:i,ctor:e})}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(i){i.register(),this.editorActions.push(i)}getEditorActions(){return this.editorActions}registerEditorCommand(i){i.register(),this.editorCommands[i.id]=i}getEditorCommand(i){return this.editorCommands[i]||null}};oe.add(MKo.EditorCommonContributions,OL.INSTANCE);function G4e(a){return a.register(),a}var pD=G4e(new hF({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:R.MenubarEditMenu,group:"1_do",title:d(185,null),order:1},{menuId:R.CommandPalette,group:"",title:d(188,null),order:1},{menuId:R.SimpleEditorContext,group:"1_do",title:d(188,null),order:1}]}));G4e(new sSt(pD,{id:"default:undo",precondition:void 0}));var mD=G4e(new hF({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:R.MenubarEditMenu,group:"1_do",title:d(183,null),order:2},{menuId:R.CommandPalette,group:"",title:d(186,null),order:1},{menuId:R.SimpleEditorContext,group:"1_do",title:d(186,null),order:2}]}));G4e(new sSt(mD,{id:"default:redo",precondition:void 0}));var lSt=G4e(new hF({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:R.MenubarSelectionMenu,group:"1_basic",title:d(184,null),order:1},{menuId:R.CommandPalette,group:"",title:d(187,null),order:1},{menuId:R.SimpleEditorContext,group:"9_select",title:d(187,null),order:1}]}));function io(a){if(!a||typeof a!="object"||a instanceof RegExp)return a;let i=Array.isArray(a)?[]:{};return Object.entries(a).forEach(([e,t])=>{i[e]=t&&typeof t=="object"?io(t):t}),i}function jQi(a){if(!a||typeof a!="object")return a;let i=[a];for(;i.length>0;){let e=i.shift();Object.freeze(e);for(let t in e)if(QQi.call(e,t)){let o=e[t];typeof o=="object"&&!Object.isFrozen(o)&&!n3i(o)&&i.push(o)}}return a}var QQi=Object.prototype.hasOwnProperty;function Dk(a,i){return Hoi(a,i,new Set)}function Hoi(a,i,e){if(mr(a))return a;let t=i(a);if(typeof t<"u")return t;if(Array.isArray(a)){let o=[];for(let n of a)o.push(Hoi(n,i,e));return o}if(Di(a)){if(e.has(a))throw new Error("Cannot clone recursive data-structure");e.add(a);let o={};for(let n in a)QQi.call(a,n)&&(o[n]=Hoi(a[n],i,e));return e.delete(a),o}return a}function Cp(a,i,e=!0){return Di(a)?(Di(i)&&Object.keys(i).forEach(t=>{t in a?e&&(Di(a[t])&&Di(i[t])?Cp(a[t],i[t],e):a[t]=i[t]):a[t]=i[t]}),a):i}function Qi(a,i){if(a===i)return!0;if(a==null||i===null||i===void 0||typeof a!=typeof i||typeof a!="object"||Array.isArray(a)!==Array.isArray(i))return!1;let e,t;if(Array.isArray(a)){if(a.length!==i.length)return!1;for(e=0;e<a.length;e++)if(!Qi(a[e],i[e]))return!1}else{let o=[];for(t in a)o.push(t);o.sort();let n=[];for(t in i)n.push(t);if(n.sort(),!Qi(o,n))return!1;for(e=0;e<o.length;e++)if(!Qi(a[o[e]],i[o[e]]))return!1}return!0}function gF(a){let i=new Set;return JSON.stringify(a,(e,t)=>{if(Di(t)||Array.isArray(t)){if(i.has(t))return"[Circular]";i.add(t)}return typeof t=="bigint"?`[BigInt ${t.toString()}]`:t})}function YQi(a){if(a===void 0)return"undefined";try{return Uoi(a,new WeakSet)}catch{return""}}function Uoi(a,i){if(a===null||typeof a!="object")return JSON.stringify(a)??"null";if(i.has(a))return'"[Circular]"';if(i.add(a),Array.isArray(a))return"["+a.map(o=>Uoi(o,i)).join(",")+"]";let e=Object.keys(a).sort(),t=[];for(let o of e){let n=a[o];n!==void 0&&t.push(JSON.stringify(o)+":"+Uoi(n,i))}return"{"+t.join(",")+"}"}function q4e(a,i){let e=Object.create(null);return!a||!i||Object.keys(i).forEach(o=>{let n=a[o],r=i[o];Qi(n,r)||(e[o]=r)}),e}function yA(a,i){let e=Object.create(null);for(let[t,o]of Object.entries(a))i(t,o)&&(e[t]=o);return e}function Uwe(a,i){let e={};for(let[t,o]of Object.entries(a))e[t]=i(o,t);return e}var Koi=class a{constructor(i,e,t,o,n,r,s){this._forceIntegerValues=i;this._scrollStateBrand=void 0;this._forceIntegerValues&&(e=e|0,t=t|0,o=o|0,n=n|0,r=r|0,s=s|0),this.rawScrollLeft=o,this.rawScrollTop=s,e<0&&(e=0),o+e>t&&(o=t-e),o<0&&(o=0),n<0&&(n=0),s+n>r&&(s=r-n),s<0&&(s=0),this.width=e,this.scrollWidth=t,this.scrollLeft=o,this.height=n,this.scrollHeight=r,this.scrollTop=s}equals(i){return this.rawScrollLeft===i.rawScrollLeft&&this.rawScrollTop===i.rawScrollTop&&this.width===i.width&&this.scrollWidth===i.scrollWidth&&this.scrollLeft===i.scrollLeft&&this.height===i.height&&this.scrollHeight===i.scrollHeight&&this.scrollTop===i.scrollTop}withScrollDimensions(i,e){return new a(this._forceIntegerValues,typeof i.width<"u"?i.width:this.width,typeof i.scrollWidth<"u"?i.scrollWidth:this.scrollWidth,e?this.rawScrollLeft:this.scrollLeft,typeof i.height<"u"?i.height:this.height,typeof i.scrollHeight<"u"?i.scrollHeight:this.scrollHeight,e?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new a(this._forceIntegerValues,this.width,this.scrollWidth,typeof i.scrollLeft<"u"?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof i.scrollTop<"u"?i.scrollTop:this.rawScrollTop)}createScrollEvent(i,e){let t=this.width!==i.width,o=this.scrollWidth!==i.scrollWidth,n=this.scrollLeft!==i.scrollLeft,r=this.height!==i.height,s=this.scrollHeight!==i.scrollHeight,l=this.scrollTop!==i.scrollTop;return{inSmoothScrolling:e,oldWidth:i.width,oldScrollWidth:i.scrollWidth,oldScrollLeft:i.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:i.height,oldScrollHeight:i.scrollHeight,oldScrollTop:i.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:t,scrollWidthChanged:o,scrollLeftChanged:n,heightChanged:r,scrollHeightChanged:s,scrollTopChanged:l}}},hD=class extends k{constructor(e){super();this._scrollableBrand=void 0;this._onScroll=this._register(new T);this.onScroll=this._onScroll.event;this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Koi(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let o=this._state.withScrollDimensions(e,t);this._setState(o,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let o=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===o.scrollLeft&&this._smoothScrolling.to.scrollTop===o.scrollTop)return;let n;t?n=new dSt(this._smoothScrolling.from,o,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,o,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let o=this._state.withScrollPosition(e);this._smoothScrolling=dSt.start(this._state,o,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let o=this._state;o.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(o,t)))}},cSt=class{constructor(i,e,t){this.scrollLeft=i,this.scrollTop=e,this.isDone=t}};function zoi(a,i){let e=i-a;return function(t){return a+e*NKo(t)}}function PKo(a,i,e){return function(t){return t<e?a(t/e):i((t-e)/(1-e))}}var dSt=class a{constructor(i,e,t,o){this.from=i,this.to=e,this.duration=o,this.startTime=t,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(i,e,t){if(Math.abs(i-e)>2.5*t){let n,r;return i<e?(n=i+.75*t,r=e-.75*t):(n=i-.75*t,r=e+.75*t),PKo(zoi(i,n),zoi(r,e),.33)}return zoi(i,e)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(i){this.to=i.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(i){let e=(i-this.startTime)/this.duration;if(e<1){let t=this.scrollLeft(e),o=this.scrollTop(e);return new cSt(t,o,!1)}return new cSt(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,e,t){return a.start(i,e,t)}static start(i,e,t){t=t+10;let o=Date.now()-10;return new a(i,e,o,t)}};function AKo(a){return Math.pow(a,3)}function NKo(a){return 1-AKo(1-a)}var uT=new class{constructor(){this._zoomLevel=0;this._onDidChangeZoomLevel=new T;this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(a){a=Math.min(Math.max(-5,a),20),this._zoomLevel!==a&&(this._zoomLevel=a,this._onDidChangeZoomLevel.fire(this._zoomLevel))}};var qoi=et?1.5:1.35,Goi=8,zwe=class a{constructor(i){this._bareFontInfoBrand=void 0;this.pixelRatio=i.pixelRatio,this.fontFamily=String(i.fontFamily),this.fontWeight=String(i.fontWeight),this.fontSize=i.fontSize,this.fontFeatureSettings=i.fontFeatureSettings,this.fontVariationSettings=i.fontVariationSettings,this.lineHeight=i.lineHeight|0,this.letterSpacing=i.letterSpacing}static _create(i,e,t,o,n,r,s,l,c){r===0?r=qoi*t:r<Goi&&(r=r*t),r=Math.round(r),r<Goi&&(r=Goi);let u=1+(c?0:uT.getZoomLevel()*.1);return t*=u,r*=u,n===Qoi&&(e==="normal"||e==="bold"?n=joi:(n=`'wght' ${parseInt(e,10)}`,e="normal")),new a({pixelRatio:l,fontFamily:i,fontWeight:e,fontSize:t,fontFeatureSettings:o,fontVariationSettings:n,lineHeight:r,letterSpacing:s})}getId(){return`${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`}getMassagedFontFamily(){let i=Ku.fontFamily,e=a._wrapInQuotes(this.fontFamily);return i&&this.fontFamily!==i?`${e}, ${i}`:e}static _wrapInQuotes(i){return/[,"']/.test(i)?i:/[+ ]/.test(i)?`"${i}"`:i}},$oi=2,PY=class extends zwe{constructor(e,t){super(e);this._editorStylingBrand=void 0;this.version=$oi;this.isTrusted=t,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}},joi="normal",Qoi="translate",OKo="Consolas, 'Courier New', monospace",FKo="Menlo, Monaco, 'Courier New', monospace",WKo="'Droid Sans Mono', monospace",Ku={fontFamily:et?FKo:ii?OKo:WKo,fontWeight:"normal",fontSize:et?12:14,lineHeight:0,letterSpacing:0};var Uv={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}};var kB="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function VKo(a=""){let i="(-?\\d*\\.\\d\\w*)|([^";for(let e of kB)a.indexOf(e)>=0||(i+="\\"+e);return i+="\\s]+)",new RegExp(i,"g")}var AY=VKo();function c5(a){let i=AY;if(a&&a instanceof RegExp)if(a.global)i=a;else{let e="g";a.ignoreCase&&(e+="i"),a.multiline&&(e+="m"),a.unicode&&(e+="u"),i=new RegExp(a.source,e)}return i.lastIndex=0,i}var XQi=new ra;XQi.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function Rk(a,i,e,t,o){if(i=c5(i),o||(o=yt.first(XQi)),e.length>o.maxLen){let c=a-o.maxLen/2;return c<0?c=0:t+=c,e=e.substring(c,a+o.maxLen/2),Rk(a,i,e,t,o)}let n=Date.now(),r=a-1-t,s=-1,l=null;for(let c=1;!(Date.now()-n>=o.timeBudget);c++){let u=r-o.windowSize*c;i.lastIndex=Math.max(0,u);let p=BKo(i,e,r,s);if(!p&&l||(l=p,u<=0))break;s=u}if(l){let c={word:l[0],startColumn:t+1+l.index,endColumn:t+1+l.index+l[0].length};return i.lastIndex=0,c}return null}function BKo(a,i,e,t){let o;for(;o=a.exec(i);){let n=o.index||0;if(n<=e&&a.lastIndex>=e)return o;if(t>0&&n>t)return null}return null}var Ai=le("accessibilityService");var Oa=new Y("accessibilityModeEnabled",!1);function JQi(a){if(!a||typeof a!="object")return!1;let i=a;return typeof i.label=="string"&&(typeof i.role>"u"||typeof i.role=="string")}var $4e="ACCESSIBLE_VIEW_SHOWN_";var EB=8,uSt=class{constructor(i){this._values=i}hasChanged(i){return this._values[i]}},j4e=class{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}},kp=class{constructor(i,e,t,o){this.id=i,this.name=e,this.defaultValue=t,this.schema=o}applyUpdate(i,e){return mSt(i,e)}compute(i,e,t){return t}},Kwe=class{constructor(i,e){this.newValue=i;this.didChange=e}};function mSt(a,i){if(typeof a!="object"||typeof i!="object"||!a||!i)return new Kwe(i,a!==i);if(Array.isArray(a)||Array.isArray(i)){let t=Array.isArray(a)&&Array.isArray(i)&&eo(a,i);return new Kwe(i,!t)}let e=!1;for(let t in i)if(i.hasOwnProperty(t)){let o=mSt(a[t],i[t]);o.didChange&&(a[t]=o.newValue,e=!0)}return new Kwe(a,e)}var Pz=class{constructor(i,e){this.schema=void 0;this.id=i,this.name="_never_",this.defaultValue=e}applyUpdate(i,e){return mSt(i,e)}validate(i){return this.defaultValue}},NY=class{constructor(i,e,t,o){this.id=i,this.name=e,this.defaultValue=t,this.schema=o}applyUpdate(i,e){return mSt(i,e)}compute(i,e,t){return t}};function Rn(a,i){return typeof a>"u"?i:a==="false"?!1:!!a}var Bs=class extends NY{constructor(i,e,t,o=void 0){typeof o<"u"&&(o.type="boolean",o.default=t),super(i,e,t,o)}validate(i){return Rn(i,this.defaultValue)}};function TB(a,i,e,t){if(typeof a=="string"&&(a=parseInt(a,10)),typeof a!="number"||isNaN(a))return i;let o=a;return o=Math.max(e,o),o=Math.min(t,o),o|0}var wd=class a extends NY{static clampedInt(i,e,t,o){return TB(i,e,t,o)}constructor(i,e,t,o,n,r=void 0){typeof r<"u"&&(r.type="integer",r.default=t,r.minimum=o,r.maximum=n),super(i,e,t,r),this.minimum=o,this.maximum=n}validate(i){return a.clampedInt(i,this.defaultValue,this.minimum,this.maximum)}};function e6i(a,i,e,t){if(typeof a>"u")return i;let o=pT.float(a,i);return pT.clamp(o,e,t)}var pT=class a extends NY{static clamp(i,e,t){return i<e?e:i>t?t:i}static float(i,e){return typeof i=="string"&&(i=parseFloat(i)),typeof i!="number"||isNaN(i)?e:i}constructor(i,e,t,o,n,r,s){typeof n<"u"&&(n.type="number",n.default=t,n.minimum=r,n.maximum=s),super(i,e,t,n),this.validationFn=o,this.minimum=r,this.maximum=s}validate(i){return this.validationFn(a.float(i,this.defaultValue))}},px=class a extends NY{static string(i,e){return typeof i!="string"?e:i}constructor(i,e,t,o=void 0){typeof o<"u"&&(o.type="string",o.default=t),super(i,e,t,o)}validate(i){return a.string(i,this.defaultValue)}};function xu(a,i,e,t){return typeof a!="string"?i:t&&a in t?t[a]:e.indexOf(a)===-1?i:a}var xp=class extends NY{constructor(i,e,t,o,n=void 0){typeof n<"u"&&(n.type="string",n.enum=o.slice(0),n.default=t),super(i,e,t,n),this._allowedValues=o}validate(i){return xu(i,this.defaultValue,this._allowedValues)}},sce=class extends kp{constructor(i,e,t,o,n,r,s=void 0){typeof s<"u"&&(s.type="string",s.enum=n,s.default=o),super(i,e,t,s),this._allowedValues=n,this._convert=r}validate(i){return typeof i!="string"?this.defaultValue:this._allowedValues.indexOf(i)===-1?this.defaultValue:this._convert(i)}};function HKo(a){switch(a){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}var Yoi=class extends kp{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[d(327,null),d(329,null),d(328,null)],default:"auto",tags:["accessibility"],description:d(326,null)})}validate(i){switch(i){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(i,e,t){return t===0?i.accessibilitySupport:t}},Xoi=class extends kp{constructor(){let i={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",i,{"editor.comments.insertSpace":{type:"boolean",default:i.insertSpace,description:d(357,null)},"editor.comments.ignoreEmptyLines":{type:"boolean",default:i.ignoreEmptyLines,description:d(356,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{insertSpace:Rn(e.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:Rn(e.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}};function Fni(a){switch(a){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}function t6i(a){switch(a){case 1:return"line";case 2:return"block";case 3:return"underline";case 4:return"line-thin";case 5:return"block-outline";case 6:return"underline-thin"}}function pSt(a){switch(a){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 Joi=class extends Pz{constructor(){super(162,"")}compute(i,e,t){let o=["monaco-editor"];return e.get(48)&&o.push(e.get(48)),i.extraEditorClassName&&o.push(i.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(" ")}},Zoi=class extends Bs{constructor(){super(45,"emptySelectionClipboard",!0,{description:d(480,null)})}compute(i,e,t){return t&&i.emptySelectionClipboard}},eni=class extends kp{constructor(){let i={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,closeOnResult:!1,history:"workspace",replaceHistory:"workspace"};super(50,"find",i,{"editor.find.cursorMoveOnType":{type:"boolean",default:i.cursorMoveOnType,description:d(493,null)},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:i.seedSearchStringFromSelection,enumDescriptions:[d(416,null),d(415,null),d(417,null)],description:d(499,null)},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:i.autoFindInSelection,enumDescriptions:[d(410,null),d(408,null),d(409,null)],description:d(491,null)},"editor.find.globalFindClipboard":{type:"boolean",default:i.globalFindClipboard,description:d(495,null),included:et},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:i.addExtraSpaceOnTop,description:d(490,null)},"editor.find.loop":{type:"boolean",default:i.loop,description:d(497,null)},"editor.find.closeOnResult":{type:"boolean",default:i.closeOnResult,description:d(492,null)},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[d(411,null),d(412,null)],description:d(496,null)},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[d(413,null),d(414,null)],description:d(498,null)},"editor.find.findOnType":{type:"boolean",default:i.findOnType,description:d(494,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{cursorMoveOnType:Rn(e.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:Rn(e.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":xu(e.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":xu(e.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:Rn(e.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:Rn(e.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:Rn(e.loop,this.defaultValue.loop),closeOnResult:Rn(e.closeOnResult,this.defaultValue.closeOnResult),history:xu(e.history,this.defaultValue.history,["never","workspace"]),replaceHistory:xu(e.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}},Mk=class a extends kp{static{this.OFF='"liga" off, "calt" off'}static{this.ON='"liga" on, "calt" on'}constructor(){super(60,"fontLigatures",a.OFF,{anyOf:[{type:"boolean",description:d(509,null)},{type:"string",description:d(508,null)}],description:d(510,null),default:!1})}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i==="false"||i.length===0?a.OFF:i==="true"?a.ON:i:i?a.ON:a.OFF}},tni=class a extends kp{static{this.OFF=joi}static{this.TRANSLATE=Qoi}constructor(){super(63,"fontVariations",a.OFF,{anyOf:[{type:"boolean",description:d(512,null)},{type:"string",description:d(513,null)}],description:d(514,null),default:!1})}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i==="false"?a.OFF:i==="true"?a.TRANSLATE:i:i?a.TRANSLATE:a.OFF}compute(i,e,t){return i.fontInfo.fontVariationSettings}},ini=class extends Pz{constructor(){super(59,new PY({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(i,e,t){return i.fontInfo}},oni=class extends Pz{constructor(){super(161,1)}compute(i,e,t){return i.inputMode==="overtype"?e.get(92):e.get(34)}},nni=class extends Pz{constructor(){super(170,!1)}compute(i,e){return i.editContextSupported&&e.get(44)}},rni=class extends Pz{constructor(){super(172,!1)}compute(i,e){return i.accessibilitySupport===2?e.get(7):e.get(6)}},sni=class extends NY{constructor(){super(61,"fontSize",Ku.fontSize,{type:"number",minimum:6,maximum:100,default:Ku.fontSize,description:d(511,null)})}validate(i){let e=pT.float(i,this.defaultValue);return e===0?Ku.fontSize:pT.clamp(e,6,100)}compute(i,e,t){return i.fontInfo.fontSize}},ani=class a extends kp{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",Ku.fontWeight,{anyOf:[{type:"number",minimum:a.MINIMUM_VALUE,maximum:a.MAXIMUM_VALUE,errorMessage:d(516,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:a.SUGGESTION_VALUES}],default:Ku.fontWeight,description:d(515,null)})}validate(i){return i==="normal"||i==="bold"?i:String(wd.clampedInt(i,Ku.fontWeight,a.MINIMUM_VALUE,a.MAXIMUM_VALUE))}},lni=class extends kp{constructor(){let i={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:i.multiple,enumDescriptions:[d(421,null),d(420,null),d(419,null)]},t=["","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",i,{"editor.gotoLocation.multiple":{deprecationMessage:d(418,null)},"editor.gotoLocation.multipleDefinitions":{description:d(404,null),...e},"editor.gotoLocation.multipleTypeDefinitions":{description:d(407,null),...e},"editor.gotoLocation.multipleDeclarations":{description:d(403,null),...e},"editor.gotoLocation.multipleImplementations":{description:d(405,null),...e},"editor.gotoLocation.multipleReferences":{description:d(406,null),...e},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:i.alternativeDefinitionCommand,enum:t,description:d(334,null)},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:i.alternativeTypeDefinitionCommand,enum:t,description:d(337,null)},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:i.alternativeDeclarationCommand,enum:t,description:d(333,null)},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:i.alternativeImplementationCommand,enum:t,description:d(335,null)},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:i.alternativeReferenceCommand,enum:t,description:d(336,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{multiple:xu(e.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:xu(e.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:xu(e.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:xu(e.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:xu(e.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:xu(e.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:xu(e.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:px.string(e.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:px.string(e.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:px.string(e.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:px.string(e.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:px.string(e.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:px.string(e.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}},cni=class extends kp{constructor(){let i={enabled:"on",delay:300,hidingDelay:300,sticky:!0,above:!0,showLongLineWarning:!0};super(69,"hover",i,{"editor.hover.enabled":{type:"string",enum:["on","off","onKeyboardModifier"],default:i.enabled,markdownEnumDescriptions:[d(525,null),d(524,null),d(526,null,et?"Command":"Control")],description:d(523,null),keywords:["hint","info","tooltip"]},"editor.hover.delay":{type:"number",default:i.delay,minimum:0,maximum:1e4,description:d(522,null)},"editor.hover.sticky":{type:"boolean",default:i.sticky,description:d(529,null)},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:i.hidingDelay,markdownDescription:d(527,null)},"editor.hover.above":{type:"boolean",default:i.above,description:d(521,null)},"editor.hover.showLongLineWarning":{type:"boolean",default:i.showLongLineWarning,description:d(528,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:xu(e.enabled,this.defaultValue.enabled,["on","off","onKeyboardModifier"]),delay:wd.clampedInt(e.delay,this.defaultValue.delay,0,1e4),sticky:Rn(e.sticky,this.defaultValue.sticky),hidingDelay:wd.clampedInt(e.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:Rn(e.above,this.defaultValue.above),showLongLineWarning:Rn(e.showLongLineWarning,this.defaultValue.showLongLineWarning)}}};var Q4e=class a extends Pz{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(i,e,t){return a.computeLayout(e,{memory:i.memory,outerWidth:i.outerWidth,outerHeight:i.outerHeight,isDominatedByLongLines:i.isDominatedByLongLines,lineHeight:i.fontInfo.lineHeight,viewLineCount:i.viewLineCount,lineNumbersDigitCount:i.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:i.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:i.fontInfo.maxDigitWidth,pixelRatio:i.pixelRatio,glyphMarginDecorationLaneCount:i.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(i){let e=i.height/i.lineHeight,t=Math.floor(i.paddingTop/i.lineHeight),o=Math.floor(i.paddingBottom/i.lineHeight);i.scrollBeyondLastLine&&(o=Math.max(o,e-1));let n=(t+i.viewLineCount+o)/(i.pixelRatio*i.height),r=Math.floor(i.viewLineCount/n);return{typicalViewportLineCount:e,extraLinesBeforeFirstLine:t,extraLinesBeyondLastLine:o,desiredRatio:n,minimapLineCount:r}}static _computeMinimapLayout(i,e){let t=i.outerWidth,o=i.outerHeight,n=i.pixelRatio;if(!i.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(n*o),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:o};let r=e.stableMinimapLayoutInput,s=r&&i.outerHeight===r.outerHeight&&i.lineHeight===r.lineHeight&&i.typicalHalfwidthCharacterWidth===r.typicalHalfwidthCharacterWidth&&i.pixelRatio===r.pixelRatio&&i.scrollBeyondLastLine===r.scrollBeyondLastLine&&i.paddingTop===r.paddingTop&&i.paddingBottom===r.paddingBottom&&i.minimap.enabled===r.minimap.enabled&&i.minimap.side===r.minimap.side&&i.minimap.size===r.minimap.size&&i.minimap.showSlider===r.minimap.showSlider&&i.minimap.renderCharacters===r.minimap.renderCharacters&&i.minimap.maxColumn===r.minimap.maxColumn&&i.minimap.scale===r.minimap.scale&&i.verticalScrollbarWidth===r.verticalScrollbarWidth&&i.isViewportWrapping===r.isViewportWrapping,l=i.lineHeight,c=i.typicalHalfwidthCharacterWidth,u=i.scrollBeyondLastLine,p=i.minimap.renderCharacters,h=n>=2?Math.round(i.minimap.scale*2):i.minimap.scale,g=i.minimap.maxColumn,f=i.minimap.size,v=i.minimap.side,b=i.verticalScrollbarWidth,S=i.viewLineCount,y=i.remainingWidth,w=i.isViewportWrapping,x=p?2:3,E=Math.floor(n*o),M=E/n,N=!1,V=!1,H=x*h,K=h/n,j=1;if(f==="fill"||f==="fit"){let{typicalViewportLineCount:xe,extraLinesBeforeFirstLine:He,extraLinesBeyondLastLine:Ee,desiredRatio:Te,minimapLineCount:It}=a.computeContainedMinimapLineCount({viewLineCount:S,scrollBeyondLastLine:u,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,height:o,lineHeight:l,pixelRatio:n});if(S/It>1)N=!0,V=!0,h=1,H=1,K=h/n;else{let Oi=!1,zt=h+1;if(f==="fit"){let mo=Math.ceil((He+S+Ee)*H);w&&s&&y<=e.stableFitRemainingWidth?(Oi=!0,zt=e.stableFitMaxMinimapScale):Oi=mo>E}if(f==="fill"||Oi){N=!0;let mo=h;H=Math.min(l*n,Math.max(1,Math.floor(1/Te))),w&&s&&y<=e.stableFitRemainingWidth&&(zt=e.stableFitMaxMinimapScale),h=Math.min(zt,Math.max(1,Math.floor(H/x))),h>mo&&(j=Math.min(2,h/mo)),K=h/n/j,E=Math.ceil(Math.max(xe,He+S+Ee)*H),w?(e.stableMinimapLayoutInput=i,e.stableFitRemainingWidth=y,e.stableFitMaxMinimapScale=h):(e.stableMinimapLayoutInput=null,e.stableFitRemainingWidth=0)}}}let J=Math.floor(g*K),se=Math.min(J,Math.max(0,Math.floor((y-b-2)*K/(c+K)))+EB),ae=Math.floor(n*se),ce=ae/n;ae=Math.floor(ae*j);let Se=p?1:2,Re=v==="left"?0:t-se-b;return{renderMinimap:Se,minimapLeft:Re,minimapWidth:se,minimapHeightIsEditorHeight:N,minimapIsSampling:V,minimapScale:h,minimapLineHeight:H,minimapCanvasInnerWidth:ae,minimapCanvasInnerHeight:E,minimapCanvasOuterWidth:ce,minimapCanvasOuterHeight:M}}static computeLayout(i,e){let t=e.outerWidth|0,o=e.outerHeight|0,n=e.lineHeight|0,r=e.lineNumbersDigitCount|0,s=e.typicalHalfwidthCharacterWidth,l=e.maxDigitWidth,c=e.pixelRatio,u=e.viewLineCount,p=i.get(154),h=p==="inherit"?i.get(153):p,g=h==="inherit"?i.get(149):h,f=i.get(152),v=e.isDominatedByLongLines,b=i.get(66),S=i.get(76).renderType!==0,y=i.get(77),w=i.get(119),x=i.get(96),E=i.get(81),M=i.get(117),N=M.verticalScrollbarSize,V=M.verticalHasArrows,H=M.arrowSize,K=M.horizontalScrollbarSize,j=i.get(52),J=i.get(126)!=="never",se=i.get(74);j&&J&&(se+=16);let ae=0;if(S){let No=Math.max(r,y);ae=Math.round(No*l)}let ce=0;b&&(ce=n*e.glyphMarginDecorationLaneCount);let Se=0,Re=Se+ce,xe=Re+ae,He=xe+se,Ee=t-ce-ae-se,Te=!1,It=!1,tt=-1;i.get(2)===2&&h==="inherit"&&v?(Te=!0,It=!0):g==="on"||g==="bounded"?It=!0:g==="wordWrapColumn"&&(tt=f);let Oi=a._computeMinimapLayout({outerWidth:t,outerHeight:o,lineHeight:n,typicalHalfwidthCharacterWidth:s,pixelRatio:c,scrollBeyondLastLine:w,paddingTop:x.top,paddingBottom:x.bottom,minimap:E,verticalScrollbarWidth:N,viewLineCount:u,remainingWidth:Ee,isViewportWrapping:It},e.memory||new j4e);Oi.renderMinimap!==0&&Oi.minimapLeft===0&&(Se+=Oi.minimapWidth,Re+=Oi.minimapWidth,xe+=Oi.minimapWidth,He+=Oi.minimapWidth);let zt=Ee-Oi.minimapWidth,mo=Math.max(1,Math.floor((zt-N-2)/s)),dn=V?H:0;return It&&(tt=Math.max(1,mo),g==="bounded"&&(tt=Math.min(tt,f))),{width:t,height:o,glyphMarginLeft:Se,glyphMarginWidth:ce,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount,lineNumbersLeft:Re,lineNumbersWidth:ae,decorationsLeft:xe,decorationsWidth:se,contentLeft:He,contentWidth:zt,minimap:Oi,viewportColumn:mo,isWordWrapMinified:Te,isViewportWrapping:It,wrappingColumn:tt,verticalScrollbarWidth:N,horizontalScrollbarHeight:K,overviewRuler:{top:dn,width:N,height:o-2*dn,right:0}}}},dni=class extends kp{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[d(742,null),d(741,null)],type:"string",enum:["simple","advanced"],default:"simple",description:d(740,null)}})}validate(i){return xu(i,"simple",["simple","advanced"])}compute(i,e,t){return e.get(2)===2?"advanced":t}};var uni=class extends kp{constructor(){let i={enabled:"onCode"};super(73,"lightbulb",i,{"editor.lightbulb.enabled":{type:"string",enum:["off","onCode","on"],default:i.enabled,enumDescriptions:[d(442,null),d(444,null),d(443,null)],description:d(481,null)}})}validate(i){return!i||typeof i!="object"?this.defaultValue:{enabled:xu(i.enabled,this.defaultValue.enabled,["off","onCode","on"])}}},pni=class extends kp{constructor(){let i={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",i,{"editor.stickyScroll.enabled":{type:"boolean",default:i.enabled,description:d(446,null)},"editor.stickyScroll.maxLineCount":{type:"number",default:i.maxLineCount,minimum:1,maximum:20,description:d(447,null)},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:i.defaultModel,description:d(445,null)},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:i.scrollWithEditor,description:d(448,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Rn(e.enabled,this.defaultValue.enabled),maxLineCount:wd.clampedInt(e.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:xu(e.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:Rn(e.scrollWithEditor,this.defaultValue.scrollWithEditor)}}},mni=class extends kp{constructor(){let i={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",i,{"editor.inlayHints.enabled":{type:"string",default:i.enabled,description:d(531,null),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[d(438,null),d(439,null,et?"Ctrl+Option":"Ctrl+Alt"),d(437,null,et?"Ctrl+Option":"Ctrl+Alt"),d(436,null)]},"editor.inlayHints.fontSize":{type:"number",default:i.fontSize,markdownDescription:d(533,null,"`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:i.fontFamily,markdownDescription:d(532,null,"`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:i.padding,description:d(535,null)},"editor.inlayHints.maximumLength":{type:"number",default:i.maximumLength,markdownDescription:d(534,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return typeof e.enabled=="boolean"&&(e.enabled=e.enabled?"on":"off"),{enabled:xu(e.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:wd.clampedInt(e.fontSize,this.defaultValue.fontSize,0,100),fontFamily:px.string(e.fontFamily,this.defaultValue.fontFamily),padding:Rn(e.padding,this.defaultValue.padding),maximumLength:wd.clampedInt(e.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}},hni=class extends kp{constructor(){super(74,"lineDecorationsWidth",10)}validate(i){return typeof i=="string"&&/^\d+(\.\d+)?ch$/.test(i)?-parseFloat(i.substring(0,i.length-2)):wd.clampedInt(i,this.defaultValue,0,1e3)}compute(i,e,t){return t<0?wd.clampedInt(-t*i.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):t}},gni=class extends pT{constructor(){super(75,"lineHeight",Ku.lineHeight,i=>pT.clamp(i,0,150),{markdownDescription:d(557,null)},0,150)}compute(i,e,t){return i.fontInfo.lineHeight}},fni=class extends kp{constructor(){let i={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",i,{"editor.minimap.enabled":{type:"boolean",default:i.enabled,description:d(570,null)},"editor.minimap.autohide":{type:"string",enum:["none","mouseover","scroll"],enumDescriptions:[d(568,null),d(567,null),d(569,null)],default:i.autohide,description:d(566,null)},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[d(584,null),d(582,null),d(583,null)],default:i.size,description:d(581,null)},"editor.minimap.side":{type:"string",enum:["left","right"],default:i.side,description:d(580,null)},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:i.showSlider,description:d(579,null)},"editor.minimap.scale":{type:"number",default:i.scale,minimum:1,maximum:3,enum:[1,2,3],description:d(574,null)},"editor.minimap.renderCharacters":{type:"boolean",default:i.renderCharacters,description:d(573,null)},"editor.minimap.maxColumn":{type:"number",default:i.maxColumn,description:d(572,null)},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:i.showRegionSectionHeaders,description:d(578,null)},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:i.showMarkSectionHeaders,description:d(577,null)},"editor.minimap.markSectionHeaderRegex":{type:"string",default:i.markSectionHeaderRegex,description:d(571,null)},"editor.minimap.sectionHeaderFontSize":{type:"number",default:i.sectionHeaderFontSize,description:d(575,null)},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:i.sectionHeaderLetterSpacing,description:d(576,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i,t=this.defaultValue.markSectionHeaderRegex,o=e.markSectionHeaderRegex;if(typeof o=="string")try{new RegExp(o,"d"),t=o}catch{}return{enabled:Rn(e.enabled,this.defaultValue.enabled),autohide:xu(e.autohide,this.defaultValue.autohide,["none","mouseover","scroll"]),size:xu(e.size,this.defaultValue.size,["proportional","fill","fit"]),side:xu(e.side,this.defaultValue.side,["right","left"]),showSlider:xu(e.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:Rn(e.renderCharacters,this.defaultValue.renderCharacters),scale:wd.clampedInt(e.scale,1,1,3),maxColumn:wd.clampedInt(e.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:Rn(e.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:Rn(e.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),markSectionHeaderRegex:t,sectionHeaderFontSize:pT.clamp(pT.float(e.sectionHeaderFontSize,this.defaultValue.sectionHeaderFontSize),4,32),sectionHeaderLetterSpacing:pT.clamp(pT.float(e.sectionHeaderLetterSpacing,this.defaultValue.sectionHeaderLetterSpacing),0,5)}}};function UKo(a){return a==="ctrlCmd"?et?"metaKey":"ctrlKey":"altKey"}var vni=class extends kp{constructor(){super(96,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:d(609,null)},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:d(608,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{top:wd.clampedInt(e.top,0,0,1e3),bottom:wd.clampedInt(e.bottom,0,0,1e3)}}},bni=class extends kp{constructor(){let i={enabled:!0,cycle:!0};super(98,"parameterHints",i,{"editor.parameterHints.enabled":{type:"boolean",default:i.enabled,description:d(611,null)},"editor.parameterHints.cycle":{type:"boolean",default:i.cycle,description:d(610,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Rn(e.enabled,this.defaultValue.enabled),cycle:Rn(e.cycle,this.defaultValue.cycle)}}},Sni=class extends Pz{constructor(){super(163,1)}compute(i,e,t){return i.pixelRatio}},Ini=class extends kp{constructor(){super(100,"placeholder",void 0)}validate(i){return typeof i>"u"?this.defaultValue:typeof i=="string"?i:this.defaultValue}},yni=class extends kp{constructor(){let i={other:"offWhenInlineCompletions",comments:"off",strings:"off"},e=[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[d(604,null),d(536,null),d(602,null),d(603,null)]}];super(102,"quickSuggestions",i,{anyOf:[{type:"boolean"},{type:"string",enum:["on","inline","off","offWhenInlineCompletions"],enumDescriptions:[d(626,null),d(623,null),d(624,null),d(625,null)]},{type:"object",additionalProperties:!1,properties:{strings:{anyOf:e,default:i.strings,description:d(622,null)},comments:{anyOf:e,default:i.comments,description:d(620,null)},other:{anyOf:e,default:i.other,description:d(621,null)}}}],default:i,markdownDescription:d(619,null,"`#editor.suggestOnTriggerCharacters#`"),experiment:{mode:"auto"}}),this.defaultValue=i}validate(i){if(typeof i=="boolean"){let c=i?"on":"off";return{comments:c,strings:c,other:c}}if(typeof i=="string"){let c=["on","inline","off","offWhenInlineCompletions"],u=xu(i,this.defaultValue.other,c);return{comments:u,strings:u,other:u}}if(!i||typeof i!="object")return this.defaultValue;let{other:e,comments:t,strings:o}=i,n=["on","inline","off","offWhenInlineCompletions"],r,s,l;return typeof e=="boolean"?r=e?"on":"off":r=xu(e,this.defaultValue.other,n),typeof t=="boolean"?s=t?"on":"off":s=xu(t,this.defaultValue.comments,n),typeof o=="boolean"?l=o?"on":"off":l=xu(o,this.defaultValue.strings,n),{other:r,comments:s,strings:l}}};var wni=class extends kp{constructor(){super(76,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[d(560,null),d(561,null),d(562,null),d(559,null)],default:"on",description:d(558,null)})}validate(i){let e=this.defaultValue.renderType,t=this.defaultValue.renderFn;return typeof i<"u"&&(typeof i=="function"?(e=4,t=i):i==="interval"?e=3:i==="relative"?e=2:i==="on"?e=1:e=0),{renderType:e,renderFn:t}}};function ace(a){let i=a.get(112);return i==="editable"?a.get(104):i!=="on"}function lce(a){return!a.get(172)}var Cni=class extends kp{constructor(){let i=[],e={type:"number",description:d(643,null)};super(116,"rulers",i,{type:"array",items:{anyOf:[e,{type:["object"],properties:{column:e,color:{type:"string",description:d(642,null),format:"color-hex"}}}]},default:i,description:d(641,null)})}validate(i){if(Array.isArray(i)){let e=[];for(let t of i)if(typeof t=="number")e.push({column:wd.clampedInt(t,0,0,1e4),color:null});else if(t&&typeof t=="object"){let o=t;e.push({column:wd.clampedInt(o.column,0,0,1e4),color:o.color})}return e.sort((t,o)=>t.column-o.column),e}return this.defaultValue}},xni=class extends kp{constructor(){super(105,"readOnlyMessage",void 0)}validate(i){return!i||typeof i!="object"?this.defaultValue:i}};function ZQi(a,i){if(typeof a!="string")return i;switch(a){case"hidden":return 2;case"visible":return 3;default:return 1}}var kni=class extends kp{constructor(){let i={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",i,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(653,null),d(655,null),d(654,null)],default:"auto",description:d(652,null)},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(646,null),d(648,null),d(647,null)],default:"auto",description:d(645,null)},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:i.verticalScrollbarSize,description:d(656,null)},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:i.horizontalScrollbarSize,description:d(649,null)},"editor.scrollbar.scrollByPage":{type:"boolean",default:i.scrollByPage,description:d(651,null)},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:i.ignoreHorizontalScrollbarInContentHeight,description:d(650,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i,t=wd.clampedInt(e.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),o=wd.clampedInt(e.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:wd.clampedInt(e.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:ZQi(e.vertical,this.defaultValue.vertical),horizontal:ZQi(e.horizontal,this.defaultValue.horizontal),useShadows:Rn(e.useShadows,this.defaultValue.useShadows),verticalHasArrows:Rn(e.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:Rn(e.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:Rn(e.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:Rn(e.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:t,horizontalSliderSize:wd.clampedInt(e.horizontalSliderSize,t,0,1e3),verticalScrollbarSize:o,verticalSliderSize:wd.clampedInt(e.verticalSliderSize,o,0,1e3),scrollByPage:Rn(e.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:Rn(e.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}},gD="inUntrustedWorkspace",Lk={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"},Eni=class extends kp{constructor(){let i={nonBasicASCII:gD,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:gD,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(142,"unicodeHighlight",i,{[Lk.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,gD],default:i.nonBasicASCII,description:d(717,null)},[Lk.invisibleCharacters]:{restricted:!0,type:"boolean",default:i.invisibleCharacters,description:d(716,null)},[Lk.ambiguousCharacters]:{restricted:!0,type:"boolean",default:i.ambiguousCharacters,description:d(713,null)},[Lk.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,gD],default:i.includeComments,description:d(714,null)},[Lk.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,gD],default:i.includeStrings,description:d(715,null)},[Lk.allowedCharacters]:{restricted:!0,type:"object",default:i.allowedCharacters,description:d(711,null),additionalProperties:{type:"boolean"}},[Lk.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:i.allowedLocales,description:d(712,null)}})}applyUpdate(i,e){let t=!1;e.allowedCharacters&&i&&(Qi(i.allowedCharacters,e.allowedCharacters)||(i={...i,allowedCharacters:e.allowedCharacters},t=!0)),e.allowedLocales&&i&&(Qi(i.allowedLocales,e.allowedLocales)||(i={...i,allowedLocales:e.allowedLocales},t=!0));let o=super.applyUpdate(i,e);return t?new Kwe(o.newValue,!0):o}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{nonBasicASCII:Gwe(e.nonBasicASCII,gD,[!0,!1,gD]),invisibleCharacters:Rn(e.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:Rn(e.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:Gwe(e.includeComments,gD,[!0,!1,gD]),includeStrings:Gwe(e.includeStrings,gD,[!0,!1,gD]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(i,e){if(typeof i!="object"||!i)return e;let t={};for(let[o,n]of Object.entries(i))n===!0&&(t[o]=!0);return t}},Tni=class extends kp{constructor(){let i={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},triggerCommandOnProviderChange:!1,experimental:{suppressInlineSuggestions:"",showOnSuggestConflict:"never",emptyResponseInformation:!0}};super(71,"inlineSuggest",i,{"editor.inlineSuggest.enabled":{type:"boolean",default:i.enabled,description:d(543,null)},"editor.inlineSuggest.showToolbar":{type:"string",default:i.showToolbar,enum:["always","onHover","never"],enumDescriptions:[d(548,null),d(550,null),d(549,null)],description:d(547,null)},"editor.inlineSuggest.syntaxHighlightingEnabled":{type:"boolean",default:i.syntaxHighlightingEnabled,description:d(554,null)},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:i.suppressSuggestions,description:d(553,null)},"editor.inlineSuggest.suppressInSnippetMode":{type:"boolean",default:i.suppressInSnippetMode,description:d(552,null)},"editor.inlineSuggest.minShowDelay":{type:"number",default:0,minimum:0,maximum:1e4,description:d(545,null)},"editor.inlineSuggest.experimental.suppressInlineSuggestions":{type:"string",default:i.experimental.suppressInlineSuggestions,tags:["experimental"],description:d(551,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.emptyResponseInformation":{type:"boolean",default:i.experimental.emptyResponseInformation,tags:["experimental"],description:d(542,null),experiment:{mode:"auto"}},"editor.inlineSuggest.triggerCommandOnProviderChange":{type:"boolean",default:i.triggerCommandOnProviderChange,tags:["experimental"],description:d(555,null),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.showOnSuggestConflict":{type:"string",default:i.experimental.showOnSuggestConflict,tags:["experimental"],enum:["always","never","whenSuggestListIsIncomplete"],description:d(546,null),experiment:{mode:"auto"}},"editor.inlineSuggest.fontFamily":{type:"string",default:i.fontFamily,description:d(544,null)},"editor.inlineSuggest.edits.allowCodeShifting":{type:"string",default:i.edits.allowCodeShifting,description:d(538,null),enum:["always","horizontal","never"],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showLongDistanceHint":{type:"boolean",default:i.edits.showLongDistanceHint,description:d(541,null),tags:["nextEditSuggestions","experimental"]},"editor.inlineSuggest.edits.renderSideBySide":{type:"string",default:i.edits.renderSideBySide,description:d(539,null),enum:["auto","never"],enumDescriptions:[d(440,null),d(441,null)],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showCollapsed":{type:"boolean",default:i.edits.showCollapsed,description:d(540,null),tags:["nextEditSuggestions"]}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Rn(e.enabled,this.defaultValue.enabled),mode:xu(e.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:xu(e.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:Rn(e.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:Rn(e.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:px.string(e.fontFamily,this.defaultValue.fontFamily),syntaxHighlightingEnabled:Rn(e.syntaxHighlightingEnabled,this.defaultValue.syntaxHighlightingEnabled),minShowDelay:wd.clampedInt(e.minShowDelay,0,0,1e4),suppressInSnippetMode:Rn(e.suppressInSnippetMode,this.defaultValue.suppressInSnippetMode),edits:this._validateEdits(e.edits),triggerCommandOnProviderChange:Rn(e.triggerCommandOnProviderChange,this.defaultValue.triggerCommandOnProviderChange),experimental:this._validateExperimental(e.experimental)}}_validateEdits(i){if(!i||typeof i!="object")return this.defaultValue.edits;let e=i;return{enabled:Rn(e.enabled,this.defaultValue.edits.enabled),showCollapsed:Rn(e.showCollapsed,this.defaultValue.edits.showCollapsed),allowCodeShifting:xu(e.allowCodeShifting,this.defaultValue.edits.allowCodeShifting,["always","horizontal","never"]),showLongDistanceHint:Rn(e.showLongDistanceHint,this.defaultValue.edits.showLongDistanceHint),renderSideBySide:xu(e.renderSideBySide,this.defaultValue.edits.renderSideBySide,["never","auto"])}}_validateExperimental(i){if(!i||typeof i!="object")return this.defaultValue.experimental;let e=i;return{suppressInlineSuggestions:px.string(e.suppressInlineSuggestions,this.defaultValue.experimental.suppressInlineSuggestions),showOnSuggestConflict:xu(e.showOnSuggestConflict,this.defaultValue.experimental.showOnSuggestConflict,["always","never","whenSuggestListIsIncomplete"]),emptyResponseInformation:Rn(e.emptyResponseInformation,this.defaultValue.experimental.emptyResponseInformation)}}},_ni=class extends kp{constructor(){let i={enabled:Uv.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:Uv.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(21,"bracketPairColorization",i,{"editor.bracketPairColorization.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(347,null,"`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:i.independentColorPoolPerBracketType,description:d(348,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Rn(e.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:Rn(e.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}},Dni=class extends kp{constructor(){let i={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(22,"guides",i,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[d(425,null),d(423,null),d(424,null)],default:i.bracketPairs,description:d(422,null)},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[d(429,null),d(427,null),d(428,null)],default:i.bracketPairsHorizontal,description:d(426,null)},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:i.highlightActiveBracketPair,description:d(430,null)},"editor.guides.indentation":{type:"boolean",default:i.indentation,description:d(435,null)},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[d(434,null),d(432,null),d(433,null)],default:i.highlightActiveIndentation,description:d(431,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{bracketPairs:Gwe(e.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:Gwe(e.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:Rn(e.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:Rn(e.indentation,this.defaultValue.indentation),highlightActiveIndentation:Gwe(e.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}};function Gwe(a,i,e){let t=e.indexOf(a);return t===-1?i:e[t]}var Rni=class extends kp{constructor(){let i={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!1,localityBonus:!1,shareSuggestSelections:!1,selectionMode:"always",showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,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",i,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[d(683,null),d(685,null)],default:i.insertMode,description:d(681,null)},"editor.suggest.filterGraceful":{type:"boolean",default:i.filterGraceful,description:d(680,null)},"editor.suggest.localityBonus":{type:"boolean",default:i.localityBonus,description:d(688,null)},"editor.suggest.shareSuggestSelections":{type:"boolean",default:i.shareSuggestSelections,markdownDescription:d(692,null)},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[d(682,null),d(684,null),d(687,null),d(686,null)],default:i.selectionMode,markdownDescription:d(691,null,"`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:i.snippetsPreventQuickSuggestions,description:d(696,null)},"editor.suggest.showIcons":{type:"boolean",default:i.showIcons,description:d(693,null)},"editor.suggest.showStatusBar":{type:"boolean",default:i.showStatusBar,description:d(695,null)},"editor.suggest.preview":{type:"boolean",default:i.preview,description:d(690,null)},"editor.suggest.showInlineDetails":{type:"boolean",default:i.showInlineDetails,description:d(694,null)},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:d(689,null)},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:d(373,null)},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:d(466,null)},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:d(462,null)},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:d(453,null)},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:d(455,null)},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:d(449,null)},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:d(459,null)},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:d(478,null)},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:d(450,null)},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:d(472,null)},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:d(463,null)},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:d(467,null)},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:d(469,null)},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:d(458,null)},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:d(468,null)},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:d(475,null)},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:d(477,null)},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:d(452,null)},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:d(457,null)},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:d(456,null)},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:d(465,null)},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:d(473,null)},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:d(451,null)},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:d(460,null)},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:d(470,null)},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:d(454,null)},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:d(461,null)},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:d(474,null)},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:d(471,null)},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:d(476,null)},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:d(464,null)}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{insertMode:xu(e.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:Rn(e.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:Rn(e.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:Rn(e.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:Rn(e.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:xu(e.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:Rn(e.showIcons,this.defaultValue.showIcons),showStatusBar:Rn(e.showStatusBar,this.defaultValue.showStatusBar),preview:Rn(e.preview,this.defaultValue.preview),previewMode:xu(e.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:Rn(e.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:Rn(e.showMethods,this.defaultValue.showMethods),showFunctions:Rn(e.showFunctions,this.defaultValue.showFunctions),showConstructors:Rn(e.showConstructors,this.defaultValue.showConstructors),showDeprecated:Rn(e.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:Rn(e.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:Rn(e.showFields,this.defaultValue.showFields),showVariables:Rn(e.showVariables,this.defaultValue.showVariables),showClasses:Rn(e.showClasses,this.defaultValue.showClasses),showStructs:Rn(e.showStructs,this.defaultValue.showStructs),showInterfaces:Rn(e.showInterfaces,this.defaultValue.showInterfaces),showModules:Rn(e.showModules,this.defaultValue.showModules),showProperties:Rn(e.showProperties,this.defaultValue.showProperties),showEvents:Rn(e.showEvents,this.defaultValue.showEvents),showOperators:Rn(e.showOperators,this.defaultValue.showOperators),showUnits:Rn(e.showUnits,this.defaultValue.showUnits),showValues:Rn(e.showValues,this.defaultValue.showValues),showConstants:Rn(e.showConstants,this.defaultValue.showConstants),showEnums:Rn(e.showEnums,this.defaultValue.showEnums),showEnumMembers:Rn(e.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:Rn(e.showKeywords,this.defaultValue.showKeywords),showWords:Rn(e.showWords,this.defaultValue.showWords),showColors:Rn(e.showColors,this.defaultValue.showColors),showFiles:Rn(e.showFiles,this.defaultValue.showFiles),showReferences:Rn(e.showReferences,this.defaultValue.showReferences),showFolders:Rn(e.showFolders,this.defaultValue.showFolders),showTypeParameters:Rn(e.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:Rn(e.showSnippets,this.defaultValue.showSnippets),showUsers:Rn(e.showUsers,this.defaultValue.showUsers),showIssues:Rn(e.showIssues,this.defaultValue.showIssues)}}},Lni=class extends kp{constructor(){super(129,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:d(665,null),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:d(666,null),default:!0,type:"boolean"}})}validate(i){return!i||typeof i!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:Rn(i.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:Rn(i.selectSubwords,this.defaultValue.selectSubwords)}}},Mni=class extends kp{constructor(){let i=[];super(147,"wordSegmenterLocales",i,{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:d(726,null),type:"array",items:{type:"string"},default:i})}validate(i){if(typeof i=="string"&&(i=[i]),Array.isArray(i)){let e=[];for(let t of i)if(typeof t=="string")try{Intl.Segmenter.supportedLocalesOf(t).length>0&&e.push(t)}catch{}return e}return this.defaultValue}};var Pni=class extends kp{constructor(){super(155,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[d(738,null),d(739,null),d(737,null),d(736,null)],description:d(735,null),default:"same"}})}validate(i){switch(i){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(i,e,t){return e.get(2)===2?0:t}},Ani=class extends Pz{constructor(){super(166,{isDominatedByLongLines:!1,isWordWrapMinified:!1,isViewportWrapping:!1,wrappingColumn:-1})}compute(i,e,t){let o=e.get(165);return{isDominatedByLongLines:i.isDominatedByLongLines,isWordWrapMinified:o.isWordWrapMinified,isViewportWrapping:o.isViewportWrapping,wrappingColumn:o.wrappingColumn}}},Nni=class extends kp{constructor(){let i={enabled:!0,showDropSelector:"afterDrop"};super(43,"dropIntoEditor",i,{"editor.dropIntoEditor.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(376,null)},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:d(377,null),enum:["afterDrop","never"],enumDescriptions:[d(378,null),d(379,null)],default:"afterDrop"}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Rn(e.enabled,this.defaultValue.enabled),showDropSelector:xu(e.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}},Oni=class extends kp{constructor(){let i={enabled:!0,showPasteSelector:"afterPaste"};super(97,"pasteAs",i,{"editor.pasteAs.enabled":{type:"boolean",default:i.enabled,markdownDescription:d(612,null)},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:d(613,null),enum:["afterPaste","never"],enumDescriptions:[d(614,null),d(615,null)],default:"afterPaste"}})}validate(i){if(!i||typeof i!="object")return this.defaultValue;let e=i;return{enabled:Rn(e.enabled,this.defaultValue.enabled),showPasteSelector:xu(e.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}},Az=[];function Vi(a){return Az[a.id]=a,a}var PS={acceptSuggestionOnCommitCharacter:Vi(new Bs(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:d(322,null)})),acceptSuggestionOnEnter:Vi(new xp(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",d(324,null),""],markdownDescription:d(323,null)})),accessibilitySupport:Vi(new Yoi),accessibilityPageSize:Vi(new wd(3,"accessibilityPageSize",500,1,1073741824,{description:d(325,null),tags:["accessibility"]})),allowOverflow:Vi(new Bs(4,"allowOverflow",!0)),allowVariableLineHeights:Vi(new Bs(5,"allowVariableLineHeights",!0,{description:d(332,null)})),allowVariableFonts:Vi(new Bs(6,"allowVariableFonts",!0,{description:d(330,null)})),allowVariableFontsInAccessibilityMode:Vi(new Bs(7,"allowVariableFontsInAccessibilityMode",!1,{description:d(331,null),tags:["accessibility"]})),ariaLabel:Vi(new px(8,"ariaLabel",d(479,null))),ariaRequired:Vi(new Bs(9,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:Vi(new Bs(12,"screenReaderAnnounceInlineSuggestion",!0,{description:d(644,null),tags:["accessibility"]})),autoClosingBrackets:Vi(new xp(10,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(382,null),d(381,null),""],description:d(338,null)})),autoClosingComments:Vi(new xp(11,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(384,null),d(383,null),""],description:d(339,null)})),autoClosingDelete:Vi(new xp(13,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",d(385,null),""],description:d(340,null)})),autoClosingOvertype:Vi(new xp(14,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",d(386,null),""],description:d(341,null)})),autoClosingQuotes:Vi(new xp(15,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",d(388,null),d(387,null),""],description:d(342,null)})),autoIndent:Vi(new sce(16,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],HKo,{enumDescriptions:[d(393,null),d(392,null),d(390,null),d(389,null),d(391,null)],description:d(343,null)})),autoIndentOnPaste:Vi(new Bs(17,"autoIndentOnPaste",!1,{description:d(344,null)})),autoIndentOnPasteWithinString:Vi(new Bs(18,"autoIndentOnPasteWithinString",!0,{description:d(345,null)})),automaticLayout:Vi(new Bs(19,"automaticLayout",!1)),autoSurround:Vi(new xp(20,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[d(395,null),d(396,null),d(394,null),""],description:d(346,null)})),bracketPairColorization:Vi(new _ni),bracketPairGuides:Vi(new Dni),stickyTabStops:Vi(new Bs(132,"stickyTabStops",!1,{description:d(679,null)})),codeLens:Vi(new Bs(23,"codeLens",!0,{description:d(349,null)})),codeLensFontFamily:Vi(new px(24,"codeLensFontFamily","",{description:d(350,null)})),codeLensFontSize:Vi(new wd(25,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:d(351,null)})),colorDecorators:Vi(new Bs(26,"colorDecorators",!0,{description:d(353,null)})),colorDecoratorActivatedOn:Vi(new xp(168,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[d(398,null),d(399,null),d(397,null)],description:d(352,null)})),colorDecoratorsLimit:Vi(new wd(27,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:d(354,null)})),columnSelection:Vi(new Bs(28,"columnSelection",!1,{description:d(355,null)})),comments:Vi(new Xoi),contextmenu:Vi(new Bs(30,"contextmenu",!0)),copyWithSyntaxHighlighting:Vi(new Bs(31,"copyWithSyntaxHighlighting",!0,{description:d(358,null)})),cursorBlinking:Vi(new sce(32,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],Fni,{description:d(359,null)})),cursorSmoothCaretAnimation:Vi(new xp(33,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[d(363,null),d(362,null),d(364,null)],description:d(361,null)})),cursorStyle:Vi(new sce(34,"cursorStyle",1,"line",["line","block","underline","line-thin","block-outline","underline-thin"],pSt,{description:d(365,null)})),overtypeCursorStyle:Vi(new sce(92,"overtypeCursorStyle",2,"block",["line","block","underline","line-thin","block-outline","underline-thin"],pSt,{description:d(605,null)})),cursorSurroundingLines:Vi(new wd(35,"cursorSurroundingLines",0,0,1073741824,{description:d(366,null)})),cursorSurroundingLinesStyle:Vi(new xp(36,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[d(369,null),d(368,null)],markdownDescription:d(367,null)})),cursorWidth:Vi(new wd(37,"cursorWidth",0,0,1073741824,{markdownDescription:d(370,null)})),cursorHeight:Vi(new wd(38,"cursorHeight",0,0,1073741824,{markdownDescription:d(360,null)})),disableLayerHinting:Vi(new Bs(39,"disableLayerHinting",!1)),disableMonospaceOptimizations:Vi(new Bs(40,"disableMonospaceOptimizations",!1)),domReadOnly:Vi(new Bs(41,"domReadOnly",!1)),doubleClickSelectsBlock:Vi(new Bs(173,"doubleClickSelectsBlock",!0,{description:d(374,null)})),dragAndDrop:Vi(new Bs(42,"dragAndDrop",!0,{description:d(375,null)})),emptySelectionClipboard:Vi(new Zoi),dropIntoEditor:Vi(new Nni),editContext:Vi(new Bs(44,"editContext",!0,{description:d(380,null),included:bz||$ye||Qr})),renderRichScreenReaderContent:Vi(new Bs(107,"renderRichScreenReaderContent",!1,{markdownDescription:d(635,null)})),stickyScroll:Vi(new pni),experimentalGpuAcceleration:Vi(new xp(46,"experimentalGpuAcceleration","off",["off","on"],{tags:["experimental"],enumDescriptions:[d(483,null),d(484,null)],description:d(482,null)})),experimentalWhitespaceRendering:Vi(new xp(47,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[d(488,null),d(486,null),d(487,null)],description:d(485,null)})),extraEditorClassName:Vi(new px(48,"extraEditorClassName","")),fastScrollSensitivity:Vi(new pT(49,"fastScrollSensitivity",5,a=>a<=0?5:a,{markdownDescription:d(489,null)})),find:Vi(new eni),fixedOverflowWidgets:Vi(new Bs(51,"fixedOverflowWidgets",!1)),folding:Vi(new Bs(52,"folding",!0,{description:d(500,null)})),foldingStrategy:Vi(new xp(53,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[d(505,null),d(506,null)],description:d(504,null)})),foldingHighlight:Vi(new Bs(54,"foldingHighlight",!0,{description:d(501,null)})),foldingImportsByDefault:Vi(new Bs(55,"foldingImportsByDefault",!1,{description:d(502,null)})),foldingMaximumRegions:Vi(new wd(56,"foldingMaximumRegions",5e3,10,65e3,{description:d(503,null)})),unfoldOnClickAfterEndOfLine:Vi(new Bs(57,"unfoldOnClickAfterEndOfLine",!1,{description:d(710,null)})),fontFamily:Vi(new px(58,"fontFamily",Ku.fontFamily,{description:d(507,null)})),fontInfo:Vi(new ini),fontLigatures2:Vi(new Mk),fontSize:Vi(new sni),fontWeight:Vi(new ani),fontVariations:Vi(new tni),formatOnPaste:Vi(new Bs(64,"formatOnPaste",!1,{description:d(517,null)})),formatOnType:Vi(new Bs(65,"formatOnType",!1,{description:d(518,null)})),glyphMargin:Vi(new Bs(66,"glyphMargin",!0,{description:d(519,null)})),gotoLocation:Vi(new lni),hideCursorInOverviewRuler:Vi(new Bs(68,"hideCursorInOverviewRuler",!1,{description:d(520,null)})),hover:Vi(new cni),inDiffEditor:Vi(new Bs(70,"inDiffEditor",!1)),inertialScroll:Vi(new Bs(158,"inertialScroll",!1,{description:d(530,null)})),letterSpacing:Vi(new pT(72,"letterSpacing",Ku.letterSpacing,a=>pT.clamp(a,-5,20),{description:d(556,null)})),lightbulb:Vi(new uni),lineDecorationsWidth:Vi(new hni),lineHeight:Vi(new gni),lineNumbers:Vi(new wni),lineNumbersMinChars:Vi(new wd(77,"lineNumbersMinChars",5,1,300)),linkedEditing:Vi(new Bs(78,"linkedEditing",!1,{description:d(563,null)})),links:Vi(new Bs(79,"links",!0,{description:d(564,null)})),matchBrackets:Vi(new xp(80,"matchBrackets","always",["always","near","never"],{description:d(565,null)})),minimap:Vi(new fni),mouseStyle:Vi(new xp(82,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:Vi(new pT(83,"mouseWheelScrollSensitivity",1,a=>a===0?1:a,{markdownDescription:d(586,null)})),mouseWheelZoom:Vi(new Bs(84,"mouseWheelZoom",!1,{markdownDescription:et?d(588,null):d(587,null)})),multiCursorMergeOverlapping:Vi(new Bs(85,"multiCursorMergeOverlapping",!0,{description:d(590,null)})),multiCursorModifier:Vi(new sce(86,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],UKo,{markdownEnumDescriptions:[d(593,null),d(592,null)],markdownDescription:d(591,null)})),mouseMiddleClickAction:Vi(new xp(87,"mouseMiddleClickAction","default",["default","openLink","ctrlLeftClick"],{description:d(585,null)})),multiCursorPaste:Vi(new xp(88,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[d(596,null),d(595,null)],markdownDescription:d(594,null)})),multiCursorLimit:Vi(new wd(89,"multiCursorLimit",1e4,1,1e5,{markdownDescription:d(589,null)})),occurrencesHighlight:Vi(new xp(90,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[d(599,null),d(600,null),d(598,null)],markdownDescription:d(597,null)})),occurrencesHighlightDelay:Vi(new wd(91,"occurrencesHighlightDelay",0,0,2e3,{description:d(601,null),tags:["preview"]})),overtypeOnPaste:Vi(new Bs(93,"overtypeOnPaste",!0,{description:d(606,null)})),overviewRulerBorder:Vi(new Bs(94,"overviewRulerBorder",!0,{description:d(607,null)})),overviewRulerLanes:Vi(new wd(95,"overviewRulerLanes",3,0,3)),padding:Vi(new vni),pasteAs:Vi(new Oni),parameterHints:Vi(new bni),peekWidgetDefaultFocus:Vi(new xp(99,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[d(618,null),d(617,null)],description:d(616,null)})),placeholder:Vi(new Ini),definitionLinkOpensInPeek:Vi(new Bs(101,"definitionLinkOpensInPeek",!1,{description:d(372,null)})),quickSuggestions:Vi(new yni),quickSuggestionsDelay:Vi(new wd(103,"quickSuggestionsDelay",10,0,1073741824,{description:d(627,null),experiment:{mode:"auto"}})),readOnly:Vi(new Bs(104,"readOnly",!1)),readOnlyMessage:Vi(new xni),renameOnType:Vi(new Bs(106,"renameOnType",!1,{description:d(628,null),markdownDeprecationMessage:d(629,null)})),renderControlCharacters:Vi(new Bs(108,"renderControlCharacters",!0,{description:d(630,null),restricted:!0})),renderFinalNewline:Vi(new xp(109,"renderFinalNewline",Sn?"dimmed":"on",["off","on","dimmed"],{description:d(631,null)})),renderLineHighlight:Vi(new xp(110,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",d(633,null)],description:d(632,null)})),renderLineHighlightOnlyWhenFocus:Vi(new Bs(111,"renderLineHighlightOnlyWhenFocus",!1,{description:d(634,null)})),renderValidationDecorations:Vi(new xp(112,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:Vi(new xp(113,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",d(637,null),d(638,null),d(639,null),""],description:d(636,null)})),revealHorizontalRightPadding:Vi(new wd(114,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:Vi(new Bs(115,"roundedSelection",!0,{description:d(640,null)})),rulers:Vi(new Cni),scrollbar:Vi(new kni),scrollBeyondLastColumn:Vi(new wd(118,"scrollBeyondLastColumn",4,0,1073741824,{description:d(657,null)})),scrollBeyondLastLine:Vi(new Bs(119,"scrollBeyondLastLine",!0,{description:d(658,null)})),scrollOnMiddleClick:Vi(new Bs(171,"scrollOnMiddleClick",!1,{description:d(659,null)})),scrollPredominantAxis:Vi(new Bs(120,"scrollPredominantAxis",!0,{description:d(660,null)})),selectionClipboard:Vi(new Bs(121,"selectionClipboard",!0,{description:d(661,null),included:Sn})),selectionHighlight:Vi(new Bs(122,"selectionHighlight",!0,{description:d(662,null)})),selectionHighlightMaxLength:Vi(new wd(123,"selectionHighlightMaxLength",200,0,1073741824,{description:d(663,null)})),selectionHighlightMultiline:Vi(new Bs(124,"selectionHighlightMultiline",!1,{description:d(664,null)})),selectOnLineNumbers:Vi(new Bs(125,"selectOnLineNumbers",!0)),showFoldingControls:Vi(new xp(126,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[d(669,null),d(671,null),d(670,null)],description:d(668,null)})),showUnused:Vi(new Bs(127,"showUnused",!0,{description:d(672,null)})),showDeprecated:Vi(new Bs(157,"showDeprecated",!0,{description:d(667,null)})),inlayHints:Vi(new mni),snippetSuggestions:Vi(new xp(128,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[d(678,null),d(675,null),d(676,null),d(677,null)],description:d(674,null)})),smartSelect:Vi(new Lni),smoothScrolling:Vi(new Bs(130,"smoothScrolling",!1,{description:d(673,null)})),stopRenderingLineAfter:Vi(new wd(133,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:Vi(new Rni),inlineSuggest:Vi(new Tni),inlineCompletionsAccessibilityVerbose:Vi(new Bs(169,"inlineCompletionsAccessibilityVerbose",!1,{description:d(537,null)})),suggestFontSize:Vi(new wd(135,"suggestFontSize",0,0,1e3,{markdownDescription:d(697,null,"`0`","`#editor.fontSize#`")})),suggestLineHeight:Vi(new wd(136,"suggestLineHeight",0,0,1e3,{markdownDescription:d(698,null,"`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:Vi(new Bs(137,"suggestOnTriggerCharacters",!0,{description:d(699,null)})),suggestSelection:Vi(new xp(138,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[d(701,null),d(702,null),d(703,null)],description:d(700,null)})),tabCompletion:Vi(new xp(139,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[d(706,null),d(705,null),d(707,null)],description:d(704,null)})),tabIndex:Vi(new wd(140,"tabIndex",0,-1,1073741824)),trimWhitespaceOnDelete:Vi(new Bs(141,"trimWhitespaceOnDelete",!1,{description:d(709,null)})),unicodeHighlight:Vi(new Eni),unusualLineTerminators:Vi(new xp(143,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[d(719,null),d(720,null),d(721,null)],description:d(718,null)})),useShadowDOM:Vi(new Bs(144,"useShadowDOM",!0)),useTabStops:Vi(new Bs(145,"useTabStops",!0,{description:d(722,null)})),wordBreak:Vi(new xp(146,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[d(725,null),d(724,null)],description:d(723,null)})),wordSegmenterLocales:Vi(new Mni),wordSeparators:Vi(new px(148,"wordSeparators",kB,{description:d(727,null)})),wordWrap:Vi(new xp(149,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[d(730,null),d(731,null),d(732,null),d(729,null)],description:d(728,null)})),wordWrapBreakAfterCharacters:Vi(new px(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:Vi(new px(151,"wordWrapBreakBeforeCharacters","([{\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\xA3\xA5\uFF04\uFFE1\uFFE5+\uFF0B")),wordWrapColumn:Vi(new wd(152,"wordWrapColumn",80,1,1073741824,{markdownDescription:d(733,null)})),wordWrapOverride1:Vi(new xp(153,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:Vi(new xp(154,"wordWrapOverride2","inherit",["off","on","inherit"])),wrapOnEscapedLineFeeds:Vi(new Bs(160,"wrapOnEscapedLineFeeds",!1,{markdownDescription:d(734,null)})),effectiveCursorStyle:Vi(new oni),editorClassName:Vi(new Joi),defaultColorDecorators:Vi(new xp(167,"defaultColorDecorators","auto",["auto","always","never"],{enumDescriptions:[d(401,null),d(400,null),d(402,null)],description:d(371,null)})),pixelRatio:Vi(new Sni),tabFocusMode:Vi(new Bs(164,"tabFocusMode",!1,{markdownDescription:d(708,null)})),layoutInfo:Vi(new Q4e),wrappingInfo:Vi(new Ani),wrappingIndent:Vi(new Pni),wrappingStrategy:Vi(new dni),effectiveEditContextEnabled:Vi(new nni),effectiveAllowVariableFonts:Vi(new rni)};var G=class a{constructor(i,e,t,o){i>t||i===t&&e>o?(this.startLineNumber=t,this.startColumn=o,this.endLineNumber=i,this.endColumn=e):(this.startLineNumber=i,this.startColumn=e,this.endLineNumber=t,this.endColumn=o)}isEmpty(){return a.isEmpty(this)}static isEmpty(i){return i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn}containsPosition(i){return a.containsPosition(this,i)}static containsPosition(i,e){return!(e.lineNumber<i.startLineNumber||e.lineNumber>i.endLineNumber||e.lineNumber===i.startLineNumber&&e.column<i.startColumn||e.lineNumber===i.endLineNumber&&e.column>i.endColumn)}static strictContainsPosition(i,e){return!(e.lineNumber<i.startLineNumber||e.lineNumber>i.endLineNumber||e.lineNumber===i.startLineNumber&&e.column<=i.startColumn||e.lineNumber===i.endLineNumber&&e.column>=i.endColumn)}containsRange(i){return a.containsRange(this,i)}static containsRange(i,e){return!(e.startLineNumber<i.startLineNumber||e.endLineNumber<i.startLineNumber||e.startLineNumber>i.endLineNumber||e.endLineNumber>i.endLineNumber||e.startLineNumber===i.startLineNumber&&e.startColumn<i.startColumn||e.endLineNumber===i.endLineNumber&&e.endColumn>i.endColumn)}strictContainsRange(i){return a.strictContainsRange(this,i)}static strictContainsRange(i,e){return!(e.startLineNumber<i.startLineNumber||e.endLineNumber<i.startLineNumber||e.startLineNumber>i.endLineNumber||e.endLineNumber>i.endLineNumber||e.startLineNumber===i.startLineNumber&&e.startColumn<=i.startColumn||e.endLineNumber===i.endLineNumber&&e.endColumn>=i.endColumn)}plusRange(i){return a.plusRange(this,i)}static plusRange(i,e){let t,o,n,r;return e.startLineNumber<i.startLineNumber?(t=e.startLineNumber,o=e.startColumn):e.startLineNumber===i.startLineNumber?(t=e.startLineNumber,o=Math.min(e.startColumn,i.startColumn)):(t=i.startLineNumber,o=i.startColumn),e.endLineNumber>i.endLineNumber?(n=e.endLineNumber,r=e.endColumn):e.endLineNumber===i.endLineNumber?(n=e.endLineNumber,r=Math.max(e.endColumn,i.endColumn)):(n=i.endLineNumber,r=i.endColumn),new a(t,o,n,r)}intersectRanges(i){return a.intersectRanges(this,i)}static intersectRanges(i,e){let t=i.startLineNumber,o=i.startColumn,n=i.endLineNumber,r=i.endColumn,s=e.startLineNumber,l=e.startColumn,c=e.endLineNumber,u=e.endColumn;return t<s?(t=s,o=l):t===s&&(o=Math.max(o,l)),n>c?(n=c,r=u):n===c&&(r=Math.min(r,u)),t>n||t===n&&o>r?null:new a(t,o,n,r)}equalsRange(i){return a.equalsRange(this,i)}static equalsRange(i,e){return!i&&!e?!0:!!i&&!!e&&i.startLineNumber===e.startLineNumber&&i.startColumn===e.startColumn&&i.endLineNumber===e.endLineNumber&&i.endColumn===e.endColumn}getEndPosition(){return a.getEndPosition(this)}static getEndPosition(i){return new ye(i.endLineNumber,i.endColumn)}getStartPosition(){return a.getStartPosition(this)}static getStartPosition(i){return new ye(i.startLineNumber,i.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(i,e){return new a(this.startLineNumber,this.startColumn,i,e)}setStartPosition(i,e){return new a(i,e,this.endLineNumber,this.endColumn)}collapseToStart(){return a.collapseToStart(this)}static collapseToStart(i){return new a(i.startLineNumber,i.startColumn,i.startLineNumber,i.startColumn)}collapseToEnd(){return a.collapseToEnd(this)}static collapseToEnd(i){return new a(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn)}delta(i){return new a(this.startLineNumber+i,this.startColumn,this.endLineNumber+i,this.endColumn)}isSingleLine(){return this.startLineNumber===this.endLineNumber}static fromPositions(i,e=i){return new a(i.lineNumber,i.column,e.lineNumber,e.column)}static lift(i){return i?new a(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn):null}static isIRange(i){return!!i&&typeof i.startLineNumber=="number"&&typeof i.startColumn=="number"&&typeof i.endLineNumber=="number"&&typeof i.endColumn=="number"}static areIntersectingOrTouching(i,e){return!(i.endLineNumber<e.startLineNumber||i.endLineNumber===e.startLineNumber&&i.endColumn<e.startColumn||e.endLineNumber<i.startLineNumber||e.endLineNumber===i.startLineNumber&&e.endColumn<i.startColumn)}static areIntersecting(i,e){return!(i.endLineNumber<e.startLineNumber||i.endLineNumber===e.startLineNumber&&i.endColumn<=e.startColumn||e.endLineNumber<i.startLineNumber||e.endLineNumber===i.startLineNumber&&e.endColumn<=i.startColumn)}static areOnlyIntersecting(i,e){return!(i.endLineNumber<e.startLineNumber-1||i.endLineNumber===e.startLineNumber&&i.endColumn<e.startColumn-1||e.endLineNumber<i.startLineNumber-1||e.endLineNumber===i.startLineNumber&&e.endColumn<i.startColumn-1)}static compareRangesUsingStarts(i,e){if(i&&e){let n=i.startLineNumber|0,r=e.startLineNumber|0;if(n===r){let s=i.startColumn|0,l=e.startColumn|0;if(s===l){let c=i.endLineNumber|0,u=e.endLineNumber|0;if(c===u){let p=i.endColumn|0,h=e.endColumn|0;return p-h}return c-u}return s-l}return n-r}return(i?1:0)-(e?1:0)}static compareRangesUsingEnds(i,e){return i.endLineNumber===e.endLineNumber?i.endColumn===e.endColumn?i.startLineNumber===e.startLineNumber?i.startColumn-e.startColumn:i.startLineNumber-e.startLineNumber:i.endColumn-e.endColumn:i.endLineNumber-e.endLineNumber}static spansMultipleLines(i){return i.endLineNumber>i.startLineNumber}toJSON(){return this}};var ei=class a extends G{constructor(i,e,t,o){super(i,e,t,o),this.selectionStartLineNumber=i,this.selectionStartColumn=e,this.positionLineNumber=t,this.positionColumn=o}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(i){return a.selectionsEqual(this,i)}static selectionsEqual(i,e){return i.selectionStartLineNumber===e.selectionStartLineNumber&&i.selectionStartColumn===e.selectionStartColumn&&i.positionLineNumber===e.positionLineNumber&&i.positionColumn===e.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(i,e){return this.getDirection()===0?new a(this.startLineNumber,this.startColumn,i,e):new a(i,e,this.startLineNumber,this.startColumn)}getPosition(){return new ye(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new ye(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(i,e){return this.getDirection()===0?new a(i,e,this.endLineNumber,this.endColumn):new a(this.endLineNumber,this.endColumn,i,e)}static fromPositions(i,e=i){return new a(i.lineNumber,i.column,e.lineNumber,e.column)}static fromRange(i,e){return e===0?new a(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn):new a(i.endLineNumber,i.endColumn,i.startLineNumber,i.startColumn)}static liftSelection(i){return new a(i.selectionStartLineNumber,i.selectionStartColumn,i.positionLineNumber,i.positionColumn)}static selectionsArrEqual(i,e){if(i&&!e||!i&&e)return!1;if(!i&&!e)return!0;if(i.length!==e.length)return!1;for(let t=0,o=i.length;t<o;t++)if(!this.selectionsEqual(i[t],e[t]))return!1;return!0}static isISelection(i){return!!i&&typeof i.selectionStartLineNumber=="number"&&typeof i.selectionStartColumn=="number"&&typeof i.positionLineNumber=="number"&&typeof i.positionColumn=="number"}static createWithDirection(i,e,t,o,n){return n===0?new a(i,e,t,o):new a(t,o,i,e)}};var Vp=class{static getLanguageId(i){return(i&255)>>>0}static getTokenType(i){return(i&768)>>>8}static containsBalancedBrackets(i){return(i&1024)!==0}static getFontStyle(i){return(i&30720)>>>11}static getForeground(i){return(i&16744448)>>>15}static getBackground(i){return(i&4278190080)>>>24}static getClassNameFromMetadata(i){let t="mtk"+this.getForeground(i),o=this.getFontStyle(i);return o&1&&(t+=" mtki"),o&2&&(t+=" mtkb"),o&4&&(t+=" mtku"),o&8&&(t+=" mtks"),t}static getInlineStyleFromMetadata(i,e){let t=this.getForeground(i),o=this.getFontStyle(i),n=`color: ${e[t]};`;o&1&&(n+="font-style: italic;"),o&2&&(n+="font-weight: bold;");let r="";return o&4&&(r+=" underline"),o&8&&(r+=" line-through"),r&&(n+=`text-decoration:${r};`),n}static getPresentationFromMetadata(i){let e=this.getForeground(i),t=this.getFontStyle(i);return{foreground:e,italic:!!(t&1),bold:!!(t&2),underline:!!(t&4),strikethrough:!!(t&8)}}};function Nz(a,i){let e=a.getCount(),t=a.findTokenIndexAtOffset(i),o=a.getLanguageId(t),n=t;for(;n+1<e&&a.getLanguageId(n+1)===o;)n++;let r=t;for(;r>0&&a.getLanguageId(r-1)===o;)r--;return new Wni(a,o,r,n+1,a.getStartOffset(r),a.getEndOffset(n))}var Wni=class{constructor(i,e,t,o,n,r){this._scopedLineTokensBrand=void 0;this._actual=i,this.languageId=e,this._firstTokenIndex=t,this._lastTokenIndex=o,this.firstCharOffset=n,this._lastCharOffset=r,this.languageIdCodec=i.languageIdCodec}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getLineLength(){return this._lastCharOffset-this.firstCharOffset}getActualLineContentBefore(i){return this._actual.getLineContent().substring(0,this.firstCharOffset+i)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(i){return this._actual.findTokenIndexAtOffset(i+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(i){return this._actual.getStandardTokenType(i+this._firstTokenIndex)}toIViewLineTokens(){return this._actual.sliceAndInflate(this.firstCharOffset,this._lastCharOffset,0)}},i6i=(i=>(i[i.value=3]="value",i))(i6i||{});function fF(a){return(a&i6i.value)!==0}var Ll=class a{static _nextVisibleColumn(i,e,t){return i===9?a.nextRenderTabStop(e,t):sD(i)||c4e(i)?e+2:e+1}static visibleColumnFromColumn(i,e,t){let o=Math.min(e-1,i.length),n=i.substring(0,o),r=new Qj(n),s=0;for(;!r.eol();){let l=dwe(n,o,r.offset);r.nextGraphemeLength(),s=this._nextVisibleColumn(l,s,t)}return s}static toStatusbarColumn(i,e,t){let o=i.substring(0,Math.min(e-1,i.length)),n=new Mle(o),r=0;for(;!n.eol();)n.nextCodePoint()===9?r=a.nextRenderTabStop(r,t):r=r+1;return r+1}static columnFromVisibleColumn(i,e,t){if(e<=0)return 1;let o=i.length,n=new Qj(i),r=0,s=1;for(;!n.eol();){let l=dwe(i,o,n.offset);n.nextGraphemeLength();let c=this._nextVisibleColumn(l,r,t),u=n.offset+1;if(c>=e){let p=e-r;return c-e<p?u:s}r=c,s=u}return o+1}static nextRenderTabStop(i,e){return i+e-i%e}static nextIndentTabStop(i,e){return a.nextRenderTabStop(i,e)}static prevRenderTabStop(i,e){return Math.max(0,i-1-(i-1)%e)}static prevIndentTabStop(i,e){return a.prevRenderTabStop(i,e)}};function GKo(a,i,e){let t=0;for(let n=0;n<a.length;n++)a.charAt(n)==="	"?t=Ll.nextIndentTabStop(t,i):t++;let o="";if(!e){let n=Math.floor(t/i);t=t%i;for(let r=0;r<n;r++)o+="	"}for(let n=0;n<t;n++)o+=" ";return o}function qwe(a,i,e){let t=Em(a);return t===-1&&(t=a.length),GKo(a.substring(0,t),i,e)+a.substring(t)}var Vni=class{constructor(){this._inputMode="insert";this._onDidChangeInputMode=new T;this.onDidChangeInputMode=this._onDidChangeInputMode.event}getInputMode(){return this._inputMode}setInputMode(i){this._inputMode=i,this._onDidChangeInputMode.fire(this._inputMode)}},_B=new Vni;var qKo=()=>!0,$Ko=()=>!1,jKo=a=>a===" "||a==="	",DB=class{constructor(i,e,t,o){this.languageConfigurationService=o;this._cursorMoveConfigurationBrand=void 0;this._languageId=i;let n=t.options,r=n.get(165),s=n.get(59);this.readOnly=n.get(104),this.tabSize=e.tabSize,this.indentSize=e.indentSize,this.insertSpaces=e.insertSpaces,this.stickyTabStops=n.get(132),this.lineHeight=s.lineHeight,this.typicalHalfwidthCharacterWidth=s.typicalHalfwidthCharacterWidth,this.pageSize=Math.max(1,Math.floor(r.height/this.lineHeight)-2),this.useTabStops=n.get(145),this.trimWhitespaceOnDelete=n.get(141),this.wordSeparators=n.get(148),this.emptySelectionClipboard=n.get(45),this.copyWithSyntaxHighlighting=n.get(31),this.multiCursorMergeOverlapping=n.get(85),this.multiCursorPaste=n.get(88),this.multiCursorLimit=n.get(89),this.autoClosingBrackets=n.get(10),this.autoClosingComments=n.get(11),this.autoClosingQuotes=n.get(15),this.autoClosingDelete=n.get(13),this.autoClosingOvertype=n.get(14),this.autoSurround=n.get(20),this.autoIndent=n.get(16),this.wordSegmenterLocales=n.get(147),this.overtypeOnPaste=n.get(93),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(i,this.autoClosingQuotes,!0),comment:this._getShouldAutoClose(i,this.autoClosingComments,!1),bracket:this._getShouldAutoClose(i,this.autoClosingBrackets,!1)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(i).getAutoClosingPairs();let l=this.languageConfigurationService.getLanguageConfiguration(i).getSurroundingPairs();if(l)for(let u of l)this.surroundingPairs[u.open]=u.close;let c=this.languageConfigurationService.getLanguageConfiguration(i).comments;this.blockCommentStartToken=c?.blockCommentStartToken??null}static shouldRecreate(i){return i.hasChanged(165)||i.hasChanged(148)||i.hasChanged(45)||i.hasChanged(85)||i.hasChanged(88)||i.hasChanged(89)||i.hasChanged(10)||i.hasChanged(11)||i.hasChanged(15)||i.hasChanged(13)||i.hasChanged(14)||i.hasChanged(20)||i.hasChanged(145)||i.hasChanged(141)||i.hasChanged(59)||i.hasChanged(104)||i.hasChanged(147)||i.hasChanged(93)}get electricChars(){if(!this._electricChars){this._electricChars={};let i=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter?.getElectricCharacters();if(i)for(let e of i)this._electricChars[e]=!0}return this._electricChars}get inputMode(){return _B.getInputMode()}onElectricCharacter(i,e,t){let o=Nz(e,t-1),n=this.languageConfigurationService.getLanguageConfiguration(o.languageId).electricCharacter;return n?n.onElectricCharacter(i,o,t-o.firstCharOffset):null}normalizeIndentation(i){return qwe(i,this.indentSize,this.insertSpaces)}_getShouldAutoClose(i,e,t){switch(e){case"beforeWhitespace":return jKo;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(i,t);case"always":return qKo;case"never":return $Ko}}_getLanguageDefinedShouldAutoClose(i,e){let t=this.languageConfigurationService.getLanguageConfiguration(i).getAutoCloseBeforeSet(e);return o=>t.indexOf(o)!==-1}visibleColumnFromColumn(i,e){return Ll.visibleColumnFromColumn(i.getLineContent(e.lineNumber),e.column,this.tabSize)}columnFromVisibleColumn(i,e,t){let o=Ll.columnFromVisibleColumn(i.getLineContent(e),t,this.tabSize),n=i.getLineMinColumn(e);if(o<n)return n;let r=i.getLineMaxColumn(e);return o>r?r:o}},aa=class a{constructor(i,e){this._cursorStateBrand=void 0;this.modelState=i,this.viewState=e}static fromModelState(i){return new Bni(i)}static fromViewState(i){return new Hni(i)}static fromModelSelection(i){let e=ei.liftSelection(i),t=new zv(G.fromPositions(e.getSelectionStart()),0,0,e.getPosition(),0);return a.fromModelState(t)}static fromModelSelections(i){let e=[];for(let t=0,o=i.length;t<o;t++)e[t]=this.fromModelSelection(i[t]);return e}equals(i){return this.viewState.equals(i.viewState)&&this.modelState.equals(i.modelState)}},Bni=class{constructor(i){this.modelState=i,this.viewState=null}},Hni=class{constructor(i){this.modelState=null,this.viewState=i}};var zv=class a{constructor(i,e,t,o,n){this.selectionStart=i;this.selectionStartKind=e;this.selectionStartLeftoverVisibleColumns=t;this.position=o;this.leftoverVisibleColumns=n;this._singleCursorStateBrand=void 0;this.selection=a._computeSelection(this.selectionStart,this.position)}equals(i){return this.selectionStartLeftoverVisibleColumns===i.selectionStartLeftoverVisibleColumns&&this.leftoverVisibleColumns===i.leftoverVisibleColumns&&this.selectionStartKind===i.selectionStartKind&&this.position.equals(i.position)&&this.selectionStart.equalsRange(i.selectionStart)}hasSelection(){return!this.selection.isEmpty()||!this.selectionStart.isEmpty()}move(i,e,t,o){return i?new a(this.selectionStart,this.selectionStartKind,this.selectionStartLeftoverVisibleColumns,new ye(e,t),o):new a(new G(e,t,e,t),0,o,new ye(e,t),o)}static _computeSelection(i,e){return i.isEmpty()||!e.isBeforeOrEqual(i.getStartPosition())?ei.fromPositions(i.getStartPosition(),e):ei.fromPositions(i.getEndPosition(),e)}},Ob=class{constructor(i,e,t){this._editOperationResultBrand=void 0;this.type=i,this.commands=e,this.shouldPushStackElementBefore=t.shouldPushStackElementBefore,this.shouldPushStackElementAfter=t.shouldPushStackElementAfter}};function RB(a){return a==="'"||a==='"'||a==="`"}var OY=class a{static columnSelect(i,e,t,o,n,r){let s=Math.abs(n-t)+1,l=t>n,c=o>r,u=o<r,p=[];for(let h=0;h<s;h++){let g=t+(l?-h:h),f=i.columnFromVisibleColumn(e,g,o),v=i.columnFromVisibleColumn(e,g,r),b=i.visibleColumnFromColumn(e,new ye(g,f)),S=i.visibleColumnFromColumn(e,new ye(g,v));u&&(b>r||S<o)||c&&(S>o||b<r)||p.push(new zv(new G(g,f,g,f),0,0,new ye(g,v),0))}if(p.length===0)for(let h=0;h<s;h++){let g=t+(l?-h:h),f=e.getLineMaxColumn(g);p.push(new zv(new G(g,f,g,f),0,0,new ye(g,f),0))}return{viewStates:p,reversed:l,fromLineNumber:t,fromVisualColumn:o,toLineNumber:n,toVisualColumn:r}}static columnSelectLeft(i,e,t){let o=t.toViewVisualColumn;return o>0&&o--,a.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,t.toViewLineNumber,o)}static columnSelectRight(i,e,t){let o=0,n=Math.min(t.fromViewLineNumber,t.toViewLineNumber),r=Math.max(t.fromViewLineNumber,t.toViewLineNumber);for(let l=n;l<=r;l++){let c=e.getLineMaxColumn(l),u=i.visibleColumnFromColumn(e,new ye(l,c));o=Math.max(o,u)}let s=t.toViewVisualColumn;return s<o&&s++,this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,t.toViewLineNumber,s)}static columnSelectUp(i,e,t,o){let n=o?i.pageSize:1,r=Math.max(1,t.toViewLineNumber-n);return this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,r,t.toViewVisualColumn)}static columnSelectDown(i,e,t,o){let n=o?i.pageSize:1,r=Math.min(e.getLineCount(),t.toViewLineNumber+n);return this.columnSelect(i,e,t.fromViewLineNumber,t.fromViewVisualColumn,r,t.toViewVisualColumn)}};var kg=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ei.fromPositions(o.getEndPosition())}},$we=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){let t=this._range.getStartPosition(),o=this._range.getEndPosition(),n=o.lineNumber,r=this._text.length+(this._range.isEmpty()?0:-1),s=o6i(i,o,r);s.lineNumber>n&&(s=new ye(n,i.getLineMaxColumn(n)));let l=G.fromPositions(t,s);e.addTrackedEditOperation(l,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ei.fromPositions(o.getEndPosition())}},gSt=class{constructor(i,e){this._range=i,this._text=e}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ei.fromRange(o,0)}},cce=class{constructor(i,e,t=!1){this._range=i,this._text=e,this.insertsAutoWhitespace=t}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ei.fromPositions(o.getStartPosition())}},dce=class{constructor(i,e,t,o,n=!1){this._range=i,this._text=e,this._columnDeltaOffset=o,this._lineNumberDeltaOffset=t,this.insertsAutoWhitespace=n}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ei.fromPositions(o.getEndPosition().delta(this._lineNumberDeltaOffset,this._columnDeltaOffset))}},fSt=class{constructor(i){this._range=i}getEditOperations(i,e){let t=i.getValueInRange(this._range),o=this._range.getEndPosition(),n=o.lineNumber,r=o6i(i,o,t.length);r.lineNumber>n&&(r=new ye(n,i.getLineMaxColumn(n)));let s=G.fromPositions(o,r);e.addTrackedEditOperation(s,"")}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return ei.fromPositions(o.getEndPosition())}},FY=class{constructor(i,e,t,o=!1){this._range=i,this._text=e,this._initialSelection=t,this._forceMoveMarkers=o,this._selectionId=null}getEditOperations(i,e){e.addTrackedEditOperation(this._range,this._text,this._forceMoveMarkers),this._selectionId=e.trackSelection(this._initialSelection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function o6i(a,i,e){if(e<0)throw new Error("Unexpected negative delta");let t=a.getLineCount(),o=new ye(t,a.getLineMaxColumn(t));for(let n=i.lineNumber;n<=t;n++)if(n===i.lineNumber){let r=e-a.getLineMaxColumn(i.lineNumber)+i.column;if(r<=0){o=new ye(i.lineNumber,i.column+e);break}e=r}else{let r=e-a.getLineMaxColumn(n);if(r<=0){o=new ye(n,e);break}e=r}return o}var uce=class a{static whitespaceVisibleColumn(i,e,t){let o=i.length,n=0,r=-1,s=-1;for(let l=0;l<o;l++){if(l===e)return[r,s,n];switch(n%t===0&&(r=l,s=n),i.charCodeAt(l)){case 32:n+=1;break;case 9:n=Ll.nextRenderTabStop(n,t);break;default:return[-1,-1,-1]}}return e===o?[r,s,n]:[-1,-1,-1]}static atomicPosition(i,e,t,o){let n=i.length,[r,s,l]=a.whitespaceVisibleColumn(i,e,t);if(l===-1)return-1;let c;switch(o){case 0:c=!0;break;case 1:c=!1;break;case 2:if(l%t===0)return e;c=l%t<=t/2;break}if(c){if(r===-1)return-1;let h=s;for(let g=r;g<n;++g){if(h===s+t)return r;switch(i.charCodeAt(g)){case 32:h+=1;break;case 9:h=Ll.nextRenderTabStop(h,t);break;default:return-1}}return h===s+t?r:-1}let u=Ll.nextRenderTabStop(l,t),p=l;for(let h=e;h<n;h++){if(p===u)return h;switch(i.charCodeAt(h)){case 32:p+=1;break;case 9:p=Ll.nextRenderTabStop(p,t);break;default:return-1}}return p===u?n:-1}};var jwe=class{constructor(i){this._textModelResolvedOptionsBrand=void 0;this.tabSize=Math.max(1,i.tabSize|0),i.indentSize==="tabSize"?(this.indentSize=this.tabSize,this._indentSizeIsTabSize=!0):(this.indentSize=Math.max(1,i.indentSize|0),this._indentSizeIsTabSize=!1),this.insertSpaces=!!i.insertSpaces,this.defaultEOL=i.defaultEOL|0,this.trimAutoWhitespace=!!i.trimAutoWhitespace,this.bracketPairColorizationOptions=i.bracketPairColorizationOptions}get originalIndentSize(){return this._indentSizeIsTabSize?"tabSize":this.indentSize}equals(i){return this.tabSize===i.tabSize&&this._indentSizeIsTabSize===i._indentSizeIsTabSize&&this.indentSize===i.indentSize&&this.insertSpaces===i.insertSpaces&&this.defaultEOL===i.defaultEOL&&this.trimAutoWhitespace===i.trimAutoWhitespace&&Qi(this.bracketPairColorizationOptions,i.bracketPairColorizationOptions)}createChangeEvent(i){return{tabSize:this.tabSize!==i.tabSize,indentSize:this.indentSize!==i.indentSize,insertSpaces:this.insertSpaces!==i.insertSpaces,trimAutoWhitespace:this.trimAutoWhitespace!==i.trimAutoWhitespace}}},Fz=class{constructor(i,e){this._findMatchBrand=void 0;this.range=i,this.matches=e}};function n6i(a){return!!a&&typeof a.read=="function"}function VY(a){return!!(a&&a.uri)}var WY=class{constructor(i,e,t,o,n,r){this.identifier=i;this.range=e;this.text=t;this.forceMoveMarkers=o;this.isAutoWhitespaceEdit=n;this._isTracked=r}},vSt=class{constructor(i,e,t){this.regex=i,this.wordSeparators=e,this.simpleSearch=t}},bSt=class{constructor(i,e,t){this.reverseEdits=i;this.changes=e;this.trimAutoWhitespaceLineNumbers=t}};function Pk(a){return!a.isTooLargeForSyncing()&&!a.isForSimpleWidget}var Y4e=class{constructor(i,e,t){this._cursorPositionBrand=void 0;this.lineNumber=i,this.column=e,this.leftoverVisibleColumns=t}},op=class a{static leftPosition(i,e){if(e.column>i.getLineMinColumn(e.lineNumber))return e.delta(void 0,-xii(i.getLineContent(e.lineNumber),e.column-1));if(e.lineNumber>1){let t=e.lineNumber-1;return new ye(t,i.getLineMaxColumn(t))}else return e}static leftPositionAtomicSoftTabs(i,e,t){if(e.column<=i.getLineIndentColumn(e.lineNumber)){let o=i.getLineMinColumn(e.lineNumber),n=i.getLineContent(e.lineNumber),r=uce.atomicPosition(n,e.column-1,t,0);if(r!==-1&&r+1>=o)return new ye(e.lineNumber,r+1)}return this.leftPosition(i,e)}static left(i,e,t){let o=i.stickyTabStops?a.leftPositionAtomicSoftTabs(e,t,i.tabSize):a.leftPosition(e,t);return new Y4e(o.lineNumber,o.column,0)}static moveLeft(i,e,t,o,n){let r,s;if(t.hasSelection()&&!o)r=t.selection.startLineNumber,s=t.selection.startColumn;else{let l=t.position.delta(void 0,-(n-1)),c=e.normalizePosition(a.clipPositionColumn(l,e),0),u=a.left(i,e,c);r=u.lineNumber,s=u.column}return t.move(o,r,s,0)}static clipPositionColumn(i,e){return new ye(i.lineNumber,a.clipRange(i.column,e.getLineMinColumn(i.lineNumber),e.getLineMaxColumn(i.lineNumber)))}static clipRange(i,e,t){return i<e?e:i>t?t:i}static rightPosition(i,e,t){return t<i.getLineMaxColumn(e)?t=t+uwe(i.getLineContent(e),t-1):e<i.getLineCount()&&(e=e+1,t=i.getLineMinColumn(e)),new ye(e,t)}static rightPositionAtomicSoftTabs(i,e,t,o,n){if(t<i.getLineIndentColumn(e)){let r=i.getLineContent(e),s=uce.atomicPosition(r,t-1,o,1);if(s!==-1)return new ye(e,s+1)}return this.rightPosition(i,e,t)}static right(i,e,t){let o=i.stickyTabStops?a.rightPositionAtomicSoftTabs(e,t.lineNumber,t.column,i.tabSize,i.indentSize):a.rightPosition(e,t.lineNumber,t.column);return new Y4e(o.lineNumber,o.column,0)}static moveRight(i,e,t,o,n){let r,s;if(t.hasSelection()&&!o)r=t.selection.endLineNumber,s=t.selection.endColumn;else{let l=t.position.delta(void 0,n-1),c=e.normalizePosition(a.clipPositionColumn(l,e),1),u=a.right(i,e,c);r=u.lineNumber,s=u.column}return t.move(o,r,s,0)}static vertical(i,e,t,o,n,r,s,l){let c=Ll.visibleColumnFromColumn(e.getLineContent(t),o,i.tabSize)+n,u=e.getLineCount(),p=t===1&&o===1,h=t===u&&o===e.getLineMaxColumn(t),g=r<t?p:h;if(t=r,t<1?(t=1,s?o=e.getLineMinColumn(t):o=Math.min(e.getLineMaxColumn(t),o)):t>u?(t=u,s?o=e.getLineMaxColumn(t):o=Math.min(e.getLineMaxColumn(t),o)):o=i.columnFromVisibleColumn(e,t,c),g?n=0:n=c-Ll.visibleColumnFromColumn(e.getLineContent(t),o,i.tabSize),l!==void 0){let f=new ye(t,o),v=e.normalizePosition(f,l);n=n+(o-v.column),t=v.lineNumber,o=v.column}return new Y4e(t,o,n)}static down(i,e,t,o,n,r,s){return this.vertical(i,e,t,o,n,t+r,s,4)}static moveDown(i,e,t,o,n){let r,s;t.hasSelection()&&!o?(r=t.selection.endLineNumber,s=t.selection.endColumn):(r=t.position.lineNumber,s=t.position.column);let l=0,c;do if(c=a.down(i,e,r+l,s,t.leftoverVisibleColumns,n,!0),e.normalizePosition(new ye(c.lineNumber,c.column),2).lineNumber>r)break;while(l++<10&&r+l<e.getLineCount());return t.move(o,c.lineNumber,c.column,c.leftoverVisibleColumns)}static translateDown(i,e,t){let o=t.selection,n=a.down(i,e,o.selectionStartLineNumber,o.selectionStartColumn,t.selectionStartLeftoverVisibleColumns,1,!1),r=a.down(i,e,o.positionLineNumber,o.positionColumn,t.leftoverVisibleColumns,1,!1);return new zv(new G(n.lineNumber,n.column,n.lineNumber,n.column),0,n.leftoverVisibleColumns,new ye(r.lineNumber,r.column),r.leftoverVisibleColumns)}static up(i,e,t,o,n,r,s){return this.vertical(i,e,t,o,n,t-r,s,3)}static moveUp(i,e,t,o,n){let r,s;t.hasSelection()&&!o?(r=t.selection.startLineNumber,s=t.selection.startColumn):(r=t.position.lineNumber,s=t.position.column);let l=a.up(i,e,r,s,t.leftoverVisibleColumns,n,!0);return t.move(o,l.lineNumber,l.column,l.leftoverVisibleColumns)}static translateUp(i,e,t){let o=t.selection,n=a.up(i,e,o.selectionStartLineNumber,o.selectionStartColumn,t.selectionStartLeftoverVisibleColumns,1,!1),r=a.up(i,e,o.positionLineNumber,o.positionColumn,t.leftoverVisibleColumns,1,!1);return new zv(new G(n.lineNumber,n.column,n.lineNumber,n.column),0,n.leftoverVisibleColumns,new ye(r.lineNumber,r.column),r.leftoverVisibleColumns)}static _isBlankLine(i,e){return i.getLineFirstNonWhitespaceColumn(e)===0}static moveToPrevBlankLine(i,e,t,o){let n=t.position.lineNumber;for(;n>1&&this._isBlankLine(e,n);)n--;for(;n>1&&!this._isBlankLine(e,n);)n--;return t.move(o,n,e.getLineMinColumn(n),0)}static moveToNextBlankLine(i,e,t,o){let n=e.getLineCount(),r=t.position.lineNumber;for(;r<n&&this._isBlankLine(e,r);)r++;for(;r<n&&!this._isBlankLine(e,r);)r++;return t.move(o,r,e.getLineMinColumn(r),0)}static moveToBeginningOfLine(i,e,t,o){let n=t.position.lineNumber,r=e.getLineMinColumn(n),s=e.getLineFirstNonWhitespaceColumn(n)||r,l;return t.position.column===s?l=r:l=s,t.move(o,n,l,0)}static moveToEndOfLine(i,e,t,o,n){let r=t.position.lineNumber,s=e.getLineMaxColumn(r);return t.move(o,r,s,n?1073741824-s:0)}static moveToBeginningOfBuffer(i,e,t,o){return t.move(o,1,1,0)}static moveToEndOfBuffer(i,e,t,o){let n=e.getLineCount(),r=e.getLineMaxColumn(n);return t.move(o,n,r,0)}};var bF=class a{static deleteRight(i,e,t,o){let n=[],r=i!==3;for(let s=0,l=o.length;s<l;s++){let c=o[s],u=this.getDeleteRightRange(c,t,e);if(u.isEmpty()){n[s]=null;continue}u.startLineNumber!==u.endLineNumber&&(r=!0),n[s]=new kg(u,"")}return[r,n]}static getDeleteRightRange(i,e,t){if(!i.isEmpty())return i;let o=i.getPosition(),n=op.right(t,e,o);if(t.trimWhitespaceOnDelete&&n.lineNumber!==o.lineNumber){let r=e.getLineFirstNonWhitespaceColumn(o.lineNumber)>0,s=e.getLineFirstNonWhitespaceColumn(n.lineNumber);if(r&&s>0)return new G(n.lineNumber,s,o.lineNumber,o.column)}return new G(n.lineNumber,n.column,o.lineNumber,o.column)}static isAutoClosingPairDelete(i,e,t,o,n,r,s){if(e==="never"&&t==="never"||i==="never")return!1;for(let l=0,c=r.length;l<c;l++){let u=r[l],p=u.getPosition();if(!u.isEmpty())return!1;let h=n.getLineContent(p.lineNumber);if(p.column<2||p.column>=h.length+1)return!1;let g=h.charAt(p.column-2),f=o.get(g);if(!f)return!1;if(RB(g)){if(t==="never")return!1}else if(e==="never")return!1;let v=h.charAt(p.column-1),b=!1;for(let S of f)S.open===g&&S.close===v&&(b=!0);if(!b)return!1;if(i==="auto"){let S=!1;for(let y=0,w=s.length;y<w;y++){let x=s[y];if(p.lineNumber===x.startLineNumber&&p.column===x.startColumn){S=!0;break}}if(!S)return!1}}return!0}static _runAutoClosingPairDelete(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].getPosition(),l=new G(s.lineNumber,s.column-1,s.lineNumber,s.column+1);o[n]=new kg(l,"")}return[!0,o]}static deleteLeft(i,e,t,o,n){if(this.isAutoClosingPairDelete(e.autoClosingDelete,e.autoClosingBrackets,e.autoClosingQuotes,e.autoClosingPairs.autoClosingPairsOpenByEnd,t,o,n))return this._runAutoClosingPairDelete(e,t,o);let r=[],s=i!==2;for(let l=0,c=o.length;l<c;l++){let u=a.getDeleteLeftRange(o[l],t,e);if(u.isEmpty()){r[l]=null;continue}u.startLineNumber!==u.endLineNumber&&(s=!0),r[l]=new kg(u,"")}return[s,r]}static getDeleteLeftRange(i,e,t){if(!i.isEmpty())return i;let o=i.getPosition();if(t.useTabStops&&o.column>1){let n=e.getLineContent(o.lineNumber),r=Em(n),s=r===-1?n.length+1:r+1;if(o.column<=s){let l=t.visibleColumnFromColumn(e,o),c=Ll.prevIndentTabStop(l,t.indentSize),u=t.columnFromVisibleColumn(e,o.lineNumber,c);return new G(o.lineNumber,u,o.lineNumber,o.column)}}return G.fromPositions(a.getPositionAfterDeleteLeft(o,e),o)}static getPositionAfterDeleteLeft(i,e){if(i.column>1){let t=J3i(i.column-1,e.getLineContent(i.lineNumber));return i.with(void 0,t+1)}else if(i.lineNumber>1){let t=i.lineNumber-1;return new ye(t,e.getLineMaxColumn(t))}else return i}static cut(i,e,t){let o=[],n=null;t.sort((r,s)=>ye.compare(r.getStartPosition(),s.getEndPosition()));for(let r=0,s=t.length;r<s;r++){let l=t[r];if(l.isEmpty())if(i.emptySelectionClipboard){let c=l.getPosition(),u,p,h,g;c.lineNumber<e.getLineCount()?(u=c.lineNumber,p=1,h=c.lineNumber+1,g=1):c.lineNumber>1&&n?.endLineNumber!==c.lineNumber?(u=c.lineNumber-1,p=e.getLineMaxColumn(c.lineNumber-1),h=c.lineNumber,g=e.getLineMaxColumn(c.lineNumber)):(u=c.lineNumber,p=1,h=c.lineNumber,g=e.getLineMaxColumn(c.lineNumber));let f=new G(u,p,h,g);n=f,f.isEmpty()?o[r]=null:o[r]=new kg(f,"")}else o[r]=null;else o[r]=new kg(l,"")}return new Ob(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}};var Qwe=60,Ywe=Qwe*60,pce=Ywe*24,s6i=pce*7,a6i=pce*30,l6i=pce*365;function ea(a,i,e,t){if(typeof a>"u")return d(85,null);typeof a!="number"&&(a=a.getTime());let o=Math.round((new Date().getTime()-a)/1e3);if(o<-30)return d(59,null,ea(new Date().getTime()+o*1e3,!1));if(!t&&o<30)return d(76,null);let n;return o<Qwe?(n=o,i?n===1?e?d(83,null,n):d(82,null,n):e?d(79,null,n):d(78,null,n):n===1?e?d(84,null,n):d(81,null,n):e?d(80,null,n):d(77,null,n)):o<Ywe?(n=Math.round(o/Qwe),i?n===1?e?d(66,null,n):d(65,null,n):e?d(62,null,n):d(61,null,n):n===1?e?d(67,null,n):d(64,null,n):e?d(63,null,n):d(60,null,n)):o<pce?(n=Math.round(o/Ywe),i?n===1?e?d(57,null,n):d(56,null,n):e?d(53,null,n):d(52,null,n):n===1?e?d(58,null,n):d(55,null,n):e?d(54,null,n):d(51,null,n)):o<s6i?(n=Math.round(o/pce),i?n===1?d(50,null,n):d(48,null,n):n===1?d(49,null,n):d(47,null,n)):o<a6i?(n=Math.round(o/s6i),i?n===1?e?d(92,null,n):d(91,null,n):e?d(88,null,n):d(87,null,n):n===1?e?d(93,null,n):d(90,null,n):e?d(89,null,n):d(86,null,n)):o<l6i?(n=Math.round(o/a6i),i?n===1?e?d(74,null,n):d(73,null,n):e?d(70,null,n):d(69,null,n):n===1?e?d(75,null,n):d(72,null,n):e?d(71,null,n):d(68,null,n)):(n=Math.round(o/l6i),i?n===1?e?d(100,null,n):d(99,null,n):e?d(96,null,n):d(95,null,n):n===1?e?d(101,null,n):d(98,null,n):e?d(97,null,n):d(94,null,n))}function BY(a,i){let e=Math.abs(a/1e3);return e<1?i?d(108,null,a):d(107,null,a):e<Qwe?i?d(110,null,Math.round(a)/1e3):d(109,null,Math.round(a)/1e3):e<Ywe?i?d(106,null,Math.round(a/(1e3*Qwe))):d(105,null,Math.round(a/(1e3*Qwe))):e<pce?i?d(104,null,Math.round(a/(1e3*Ywe))):d(103,null,Math.round(a/(1e3*Ywe))):d(102,null,Math.round(a/(1e3*pce)))}function ISt(a){return a.getFullYear()+"-"+String(a.getMonth()+1).padStart(2,"0")+"-"+String(a.getDate()).padStart(2,"0")+"T"+String(a.getHours()).padStart(2,"0")+":"+String(a.getMinutes()).padStart(2,"0")+":"+String(a.getSeconds()).padStart(2,"0")+"."+(a.getMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"}var nd={DateTimeFormat(a,i){return new uo(()=>{try{return new Intl.DateTimeFormat(a,i)}catch{return new Intl.DateTimeFormat(void 0,i)}})},Collator(a,i){return new uo(()=>{try{return new Intl.Collator(a,i)}catch{return new Intl.Collator(void 0,i)}})},Segmenter(a,i){return new uo(()=>{try{return new Intl.Segmenter(a,i)}catch{return new Intl.Segmenter(void 0,i)}})},Locale(a,i){return new uo(()=>{try{return new Intl.Locale(a,i)}catch{return new Intl.Locale(fz,i)}})},NumberFormat(a,i){return new uo(()=>{try{return new Intl.NumberFormat(a,i)}catch{return new Intl.NumberFormat(void 0,i)}})}};var u5=class a{constructor(i){let e=Rle(i);this._defaultValue=e,this._asciiMap=a._createAsciiMap(e),this._map=new Map}static _createAsciiMap(i){let e=new Uint8Array(256);return e.fill(i),e}set(i,e){let t=Rle(e);i>=0&&i<256?this._asciiMap[i]=t:this._map.set(i,t)}get(i){return i>=0&&i<256?this._asciiMap[i]:this._map.get(i)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}};var p5=class{constructor(){this._actual=new u5(0)}add(i){this._actual.set(i,1)}has(i){return this._actual.get(i)===1}clear(){return this._actual.clear()}};var Uni=class extends u5{constructor(e,t){super(0);this._segmenter=null;this._cachedLine=null;this._cachedSegments=[];this.intlSegmenterLocales=t,this.intlSegmenterLocales.length>0?this._segmenter=nd.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let o=0,n=e.length;o<n;o++)this.set(e.charCodeAt(o),2);this.set(32,1),this.set(9,1)}findPrevIntlWordBeforeOrAtOffset(e,t){let o=null;for(let n of this._getIntlSegmenterWordsOnLine(e)){if(n.index>t)break;o=n}return o}findNextIntlWordAtOrAfterOffset(e,t){for(let o of this._getIntlSegmenterWordsOnLine(e))if(!(o.index<t))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 t=[];for(let o of e)this._isWordLike(o)&&t.push(o);return t}_isWordLike(e){return!!e.isWordLike}},c6i=new Ua(10);function mx(a,i){let e=`${a}/${i.join(",")}`,t=c6i.get(e);return t||(t=new Uni(a,i),c6i.set(e,t)),t}var fv=class a{static _createWord(i,e,t,o,n){return{start:o,end:n,wordType:e,nextCharClass:t}}static _createIntlWord(i,e){return{start:i.index,end:i.index+i.segment.length,wordType:1,nextCharClass:e}}static _findPreviousWordOnLine(i,e,t){let o=e.getLineContent(t.lineNumber);return this._doFindPreviousWordOnLine(o,i,t)}static _doFindPreviousWordOnLine(i,e,t){let o=0,n=e.findPrevIntlWordBeforeOrAtOffset(i,t.column-2);for(let r=t.column-2;r>=0;r--){let s=i.charCodeAt(r),l=e.get(s);if(n&&r===n.index)return this._createIntlWord(n,l);if(l===0){if(o===2)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1));o=1}else if(l===2){if(o===1)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1));o=2}else if(l===1&&o!==0)return this._createWord(i,o,l,r+1,this._findEndOfWord(i,e,o,r+1))}return o!==0?this._createWord(i,o,1,0,this._findEndOfWord(i,e,o,0)):null}static _findEndOfWord(i,e,t,o){let n=e.findNextIntlWordAtOrAfterOffset(i,o),r=i.length;for(let s=o;s<r;s++){let l=i.charCodeAt(s),c=e.get(l);if(n&&s===n.index+n.segment.length||c===1||t===1&&c===2||t===2&&c===0)return s}return r}static _findNextWordOnLine(i,e,t){let o=e.getLineContent(t.lineNumber);return this._doFindNextWordOnLine(o,i,t)}static _doFindNextWordOnLine(i,e,t){let o=0,n=i.length,r=e.findNextIntlWordAtOrAfterOffset(i,t.column-1);for(let s=t.column-1;s<n;s++){let l=i.charCodeAt(s),c=e.get(l);if(r&&s===r.index)return this._createIntlWord(r,c);if(c===0){if(o===2)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s);o=1}else if(c===2){if(o===1)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s);o=2}else if(c===1&&o!==0)return this._createWord(i,o,c,this._findStartOfWord(i,e,o,s-1),s)}return o!==0?this._createWord(i,o,1,this._findStartOfWord(i,e,o,n-1),n):null}static _findStartOfWord(i,e,t,o){let n=e.findPrevIntlWordBeforeOrAtOffset(i,o);for(let r=o;r>=0;r--){let s=i.charCodeAt(r),l=e.get(s);if(n&&r===n.index)return r;if(l===1||t===1&&l===2||t===2&&l===0)return r+1}return 0}static moveWordLeft(i,e,t,o,n){let r=t.lineNumber,s=t.column;s===1&&r>1&&(r=r-1,s=e.getLineMaxColumn(r));let l=a._findPreviousWordOnLine(i,e,new ye(r,s));if(o===0)return new ye(r,l?l.start+1:1);if(o===1)return!n&&l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=a._findPreviousWordOnLine(i,e,new ye(r,l.start+1))),new ye(r,l?l.start+1:1);if(o===3){for(;l&&l.wordType===2;)l=a._findPreviousWordOnLine(i,e,new ye(r,l.start+1));return new ye(r,l?l.start+1:1)}return l&&s<=l.end+1&&(l=a._findPreviousWordOnLine(i,e,new ye(r,l.start+1))),new ye(r,l?l.end+1:1)}static _moveWordPartLeft(i,e){let t=e.lineNumber,o=i.getLineMaxColumn(t);if(e.column===1)return t>1?new ye(t-1,i.getLineMaxColumn(t-1)):e;let n=i.getLineContent(t);for(let r=e.column-1;r>1;r--){let s=n.charCodeAt(r-2),l=n.charCodeAt(r-1);if(s===95&&l!==95)return new ye(t,r);if(s===45&&l!==45)return new ye(t,r);if((Cz(s)||l4e(s))&&sT(l))return new ye(t,r);if(sT(s)&&sT(l)&&r+1<o){let c=n.charCodeAt(r);if(Cz(c)||l4e(c))return new ye(t,r)}}return new ye(t,1)}static moveWordRight(i,e,t,o){let n=t.lineNumber,r=t.column,s=!1;r===e.getLineMaxColumn(n)&&n<e.getLineCount()&&(s=!0,n=n+1,r=1);let l=a._findNextWordOnLine(i,e,new ye(n,r));if(o===2)l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=a._findNextWordOnLine(i,e,new ye(n,l.end+1))),l?r=l.end+1:r=e.getLineMaxColumn(n);else if(o===3){for(s&&(r=0);l&&(l.wordType===2||l.start+1<=r);)l=a._findNextWordOnLine(i,e,new ye(n,l.end+1));l?r=l.start+1:r=e.getLineMaxColumn(n)}else l&&!s&&r>=l.start+1&&(l=a._findNextWordOnLine(i,e,new ye(n,l.end+1))),l?r=l.start+1:r=e.getLineMaxColumn(n);return new ye(n,r)}static _moveWordPartRight(i,e){let t=e.lineNumber,o=i.getLineMaxColumn(t);if(e.column===o)return t<i.getLineCount()?new ye(t+1,1):e;let n=i.getLineContent(t);for(let r=e.column+1;r<o;r++){let s=n.charCodeAt(r-2),l=n.charCodeAt(r-1);if(s!==95&&l===95)return new ye(t,r);if(s!==45&&l===45)return new ye(t,r);if((Cz(s)||l4e(s))&&sT(l))return new ye(t,r);if(sT(s)&&sT(l)&&r+1<o){let c=n.charCodeAt(r);if(Cz(c)||l4e(c))return new ye(t,r)}}return new ye(t,o)}static _deleteWordLeftWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=e.column-2,n=Bv(t,o);return n+1<o?new G(e.lineNumber,n+2,e.lineNumber,e.column):null}static deleteWordLeft(i,e){let t=i.wordSeparators,o=i.model,n=i.selection,r=i.whitespaceHeuristics;if(!n.isEmpty())return n;if(bF.isAutoClosingPairDelete(i.autoClosingDelete,i.autoClosingBrackets,i.autoClosingQuotes,i.autoClosingPairs.autoClosingPairsOpenByEnd,i.model,[i.selection],i.autoClosedCharacters)){let p=i.selection.getPosition();return new G(p.lineNumber,p.column-1,p.lineNumber,p.column+1)}let s=new ye(n.positionLineNumber,n.positionColumn),l=s.lineNumber,c=s.column;if(l===1&&c===1)return null;if(r){let p=this._deleteWordLeftWhitespace(o,s);if(p)return p}let u=a._findPreviousWordOnLine(t,o,s);return e===0?u?c=u.start+1:c>1?c=1:(l--,c=o.getLineMaxColumn(l)):(u&&c<=u.end+1&&(u=a._findPreviousWordOnLine(t,o,new ye(l,u.start+1))),u?c=u.end+1:c>1?c=1:(l--,c=o.getLineMaxColumn(l))),new G(l,c,s.lineNumber,s.column)}static deleteInsideWord(i,e,t,o=!1){if(!t.isEmpty())return t;let n=new ye(t.positionLineNumber,t.positionColumn),r=this._deleteInsideWordWhitespace(e,n);return r||this._deleteInsideWordDetermineDeleteRange(i,e,n,o)}static _charAtIsWhitespace(i,e){let t=i.charCodeAt(e);return t===32||t===9}static _deleteInsideWordWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=t.length;if(o===0)return null;let n=Math.max(e.column-2,0);if(!this._charAtIsWhitespace(t,n))return null;let r=Math.min(e.column-1,o-1);if(!this._charAtIsWhitespace(t,r))return null;for(;n>0&&this._charAtIsWhitespace(t,n-1);)n--;for(;r+1<o&&this._charAtIsWhitespace(t,r+1);)r++;return new G(e.lineNumber,n+1,e.lineNumber,r+2)}static _deleteInsideWordDetermineDeleteRange(i,e,t,o){let n=e.getLineContent(t.lineNumber),r=n.length;if(r===0)return t.lineNumber>1?new G(t.lineNumber-1,e.getLineMaxColumn(t.lineNumber-1),t.lineNumber,1):t.lineNumber<e.getLineCount()?new G(t.lineNumber,1,t.lineNumber+1,1):new G(t.lineNumber,1,t.lineNumber,1);let s=h=>h.start+1<=t.column&&t.column<=h.end+1,l=(h,g)=>(h=Math.min(h,t.column),g=Math.max(g,t.column),new G(t.lineNumber,h,t.lineNumber,g)),c=h=>{let g=h.start+1,f=h.end+1;if(o)return l(g,f);let v=!1;for(;f-1<r&&this._charAtIsWhitespace(n,f-1);)v=!0,f++;if(!v)for(;g>1&&this._charAtIsWhitespace(n,g-2);)g--;return l(g,f)},u=a._findPreviousWordOnLine(i,e,t);if(u&&s(u))return c(u);let p=a._findNextWordOnLine(i,e,t);return p&&s(p)?c(p):u&&p?l(u.end+1,p.start+1):u?l(u.start+1,u.end+1):p?l(p.start+1,p.end+1):l(1,r+1)}static _deleteWordPartLeft(i,e){if(!e.isEmpty())return e;let t=e.getPosition(),o=a._moveWordPartLeft(i,t);return new G(t.lineNumber,t.column,o.lineNumber,o.column)}static _findFirstNonWhitespaceChar(i,e){let t=i.length;for(let o=e;o<t;o++){let n=i.charAt(o);if(n!==" "&&n!=="	")return o}return t}static _deleteWordRightWhitespace(i,e){let t=i.getLineContent(e.lineNumber),o=e.column-1,n=this._findFirstNonWhitespaceChar(t,o);return o+1<n?new G(e.lineNumber,e.column,e.lineNumber,n+1):null}static deleteWordRight(i,e){let t=i.wordSeparators,o=i.model,n=i.selection,r=i.whitespaceHeuristics;if(!n.isEmpty())return n;let s=new ye(n.positionLineNumber,n.positionColumn),l=s.lineNumber,c=s.column,u=o.getLineCount(),p=o.getLineMaxColumn(l);if(l===u&&c===p)return null;if(r){let g=this._deleteWordRightWhitespace(o,s);if(g)return g}let h=a._findNextWordOnLine(t,o,s);return e===2?h?c=h.end+1:c<p||l===u?c=p:(l++,h=a._findNextWordOnLine(t,o,new ye(l,1)),h?c=h.start+1:c=o.getLineMaxColumn(l)):(h&&c>=h.start+1&&(h=a._findNextWordOnLine(t,o,new ye(l,h.end+1))),h?c=h.start+1:c<p||l===u?c=p:(l++,h=a._findNextWordOnLine(t,o,new ye(l,1)),h?c=h.start+1:c=o.getLineMaxColumn(l))),new G(l,c,s.lineNumber,s.column)}static _deleteWordPartRight(i,e){if(!e.isEmpty())return e;let t=e.getPosition(),o=a._moveWordPartRight(i,t);return new G(t.lineNumber,t.column,o.lineNumber,o.column)}static _createWordAtPosition(i,e,t){let o=new G(e,t.start+1,e,t.end+1);return{word:i.getValueInRange(o),startColumn:o.startColumn,endColumn:o.endColumn}}static getWordAtPosition(i,e,t,o){let n=mx(e,t),r=a._findPreviousWordOnLine(n,i,o);if(r&&r.wordType===1&&r.start<=o.column-1&&o.column-1<=r.end)return a._createWordAtPosition(i,o.lineNumber,r);let s=a._findNextWordOnLine(n,i,o);return s&&s.wordType===1&&s.start<=o.column-1&&o.column-1<=s.end?a._createWordAtPosition(i,o.lineNumber,s):null}static word(i,e,t,o,n){let r=mx(i.wordSeparators,i.wordSegmenterLocales),s=a._findPreviousWordOnLine(r,e,n),l=a._findNextWordOnLine(r,e,n);if(!o){let g,f;return s&&s.wordType===1&&s.start<=n.column-1&&n.column-1<=s.end||s&&s.wordType===2&&s.start<=n.column-1&&n.column-1<s.end?(g=s.start+1,f=s.end+1):l&&l.wordType===1&&l.start<=n.column-1&&n.column-1<=l.end||l&&l.wordType===2&&l.start<=n.column-1&&n.column-1<l.end?(g=l.start+1,f=l.end+1):(s?g=s.end+1:g=1,l?f=l.start+1:f=e.getLineMaxColumn(n.lineNumber)),new zv(new G(n.lineNumber,g,n.lineNumber,f),1,0,new ye(n.lineNumber,f),0)}let c,u;s&&s.wordType===1&&s.start<n.column-1&&n.column-1<s.end?(c=s.start+1,u=s.end+1):l&&l.wordType===1&&l.start<n.column-1&&n.column-1<l.end?(c=l.start+1,u=l.end+1):(c=n.column,u=n.column);let p=n.lineNumber,h;if(t.selectionStart.containsPosition(n))h=t.selectionStart.endColumn;else if(n.isBeforeOrEqual(t.selectionStart.getStartPosition())){h=c;let g=new ye(p,h);t.selectionStart.containsPosition(g)&&(h=t.selectionStart.endColumn)}else{h=u;let g=new ye(p,h);t.selectionStart.containsPosition(g)&&(h=t.selectionStart.startColumn)}return t.move(!0,p,h,0)}},mce=class extends fv{static deleteWordPartLeft(i){let e=ySt([fv.deleteWordLeft(i,0),fv.deleteWordLeft(i,2),fv._deleteWordPartLeft(i.model,i.selection)]);return e.sort(G.compareRangesUsingEnds),e[2]}static deleteWordPartRight(i){let e=ySt([fv.deleteWordRight(i,0),fv.deleteWordRight(i,2),fv._deleteWordPartRight(i.model,i.selection)]);return e.sort(G.compareRangesUsingStarts),e[0]}static moveWordPartLeft(i,e,t,o){let n=ySt([fv.moveWordLeft(i,e,t,0,o),fv.moveWordLeft(i,e,t,2,o),fv._moveWordPartLeft(e,t)]);return n.sort(ye.compare),n[2]}static moveWordPartRight(i,e,t){let o=ySt([fv.moveWordRight(i,e,t,0),fv.moveWordRight(i,e,t,2),fv._moveWordPartRight(e,t)]);return o.sort(ye.compare),o[0]}};function ySt(a){return a.filter(i=>!!i)}var Wf=class a{static addCursorDown(i,e,t){let o=[],n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r];o[n++]=new aa(l.modelState,l.viewState),t?o[n++]=aa.fromModelState(op.translateDown(i.cursorConfig,i.model,l.modelState)):o[n++]=aa.fromViewState(op.translateDown(i.cursorConfig,i,l.viewState))}return o}static addCursorUp(i,e,t){let o=[],n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r];o[n++]=new aa(l.modelState,l.viewState),t?o[n++]=aa.fromModelState(op.translateUp(i.cursorConfig,i.model,l.modelState)):o[n++]=aa.fromViewState(op.translateUp(i.cursorConfig,i,l.viewState))}return o}static moveToBeginningOfLine(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=this._moveToLineStart(i,s,t)}return o}static _moveToLineStart(i,e,t){let o=e.viewState.position.column,n=e.modelState.position.column,r=o===n,s=e.viewState.position.lineNumber,l=i.getLineFirstNonWhitespaceColumn(s);return!r&&!(o===l)?this._moveToLineStartByView(i,e,t):this._moveToLineStartByModel(i,e,t)}static _moveToLineStartByView(i,e,t){return aa.fromViewState(op.moveToBeginningOfLine(i.cursorConfig,i,e.viewState,t))}static _moveToLineStartByModel(i,e,t){return aa.fromModelState(op.moveToBeginningOfLine(i.cursorConfig,i.model,e.modelState,t))}static moveToEndOfLine(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=this._moveToLineEnd(i,l,t,o)}return n}static _moveToLineEnd(i,e,t,o){let n=e.viewState.position,r=i.getLineMaxColumn(n.lineNumber),s=n.column===r,l=e.modelState.position,c=i.model.getLineMaxColumn(l.lineNumber),u=r-n.column===c-l.column;return s||u?this._moveToLineEndByModel(i,e,t,o):this._moveToLineEndByView(i,e,t,o)}static _moveToLineEndByView(i,e,t,o){return aa.fromViewState(op.moveToEndOfLine(i.cursorConfig,i,e.viewState,t,o))}static _moveToLineEndByModel(i,e,t,o){return aa.fromModelState(op.moveToEndOfLine(i.cursorConfig,i.model,e.modelState,t,o))}static expandLineSelection(i,e){let t=[];for(let o=0,n=e.length;o<n;o++){let r=e[o],s=r.modelState.selection.startLineNumber,l=i.model.getLineCount(),c=r.modelState.selection.endLineNumber,u;c===l?u=i.model.getLineMaxColumn(l):(c++,u=1),t[o]=aa.fromModelState(new zv(new G(s,1,s,1),0,0,new ye(c,u),0))}return t}static moveToBeginningOfBuffer(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=aa.fromModelState(op.moveToBeginningOfBuffer(i.cursorConfig,i.model,s.modelState,t))}return o}static moveToEndOfBuffer(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n];o[n]=aa.fromModelState(op.moveToEndOfBuffer(i.cursorConfig,i.model,s.modelState,t))}return o}static selectAll(i,e){let t=i.model.getLineCount(),o=i.model.getLineMaxColumn(t);return aa.fromModelState(new zv(new G(1,1,1,1),0,0,new ye(t,o),0))}static line(i,e,t,o,n){let r=i.model.validatePosition(o),s=n?i.coordinatesConverter.validateViewPosition(new ye(n.lineNumber,n.column),r):i.coordinatesConverter.convertModelPositionToViewPosition(r);if(!t){let c=i.model.getLineCount(),u=r.lineNumber+1,p=1;return u>c&&(u=c,p=i.model.getLineMaxColumn(u)),aa.fromModelState(new zv(new G(r.lineNumber,1,u,p),2,0,new ye(u,p),0))}let l=e.modelState.selectionStart.getStartPosition().lineNumber;if(r.lineNumber<l)return aa.fromViewState(e.viewState.move(!0,s.lineNumber,1,0));if(r.lineNumber>l){let c=i.getLineCount(),u=s.lineNumber+1,p=1;return u>c&&(u=c,p=i.getLineMaxColumn(u)),aa.fromViewState(e.viewState.move(!0,u,p,0))}else{let c=e.modelState.selectionStart.getEndPosition();return aa.fromModelState(e.modelState.move(!0,c.lineNumber,c.column,0))}}static word(i,e,t,o){let n=i.model.validatePosition(o);return aa.fromModelState(fv.word(i.cursorConfig,i.model,e.modelState,t,n))}static cancelSelection(i,e){if(!e.modelState.hasSelection())return new aa(e.modelState,e.viewState);let t=e.viewState.position.lineNumber,o=e.viewState.position.column;return aa.fromViewState(new zv(new G(t,o,t,o),0,0,new ye(t,o),0))}static moveTo(i,e,t,o,n){if(t){if(e.modelState.selectionStartKind===1)return this.word(i,e,t,o);if(e.modelState.selectionStartKind===2)return this.line(i,e,t,o,n)}let r=i.model.validatePosition(o),s=n?i.coordinatesConverter.validateViewPosition(new ye(n.lineNumber,n.column),r):i.coordinatesConverter.convertModelPositionToViewPosition(r);return aa.fromViewState(e.viewState.move(t,s.lineNumber,s.column,0))}static simpleMove(i,e,t,o,n,r){switch(t){case Hs.Direction.Left:return r===Hs.Unit.HalfLine?this._moveHalfLineLeft(i,e,o):this._moveLeft(i,e,o,n);case Hs.Direction.Right:return r===Hs.Unit.HalfLine?this._moveHalfLineRight(i,e,o):this._moveRight(i,e,o,n);case Hs.Direction.Up:return r===Hs.Unit.WrappedLine?this._moveUpByViewLines(i,e,o,n):r===Hs.Unit.FoldedLine?this._moveUpByFoldedLines(i,e,o,n):this._moveUpByModelLines(i,e,o,n);case Hs.Direction.Down:return r===Hs.Unit.WrappedLine?this._moveDownByViewLines(i,e,o,n):r===Hs.Unit.FoldedLine?this._moveDownByFoldedLines(i,e,o,n):this._moveDownByModelLines(i,e,o,n);case Hs.Direction.PrevBlankLine:return r===Hs.Unit.WrappedLine?e.map(s=>aa.fromViewState(op.moveToPrevBlankLine(i.cursorConfig,i,s.viewState,o))):e.map(s=>aa.fromModelState(op.moveToPrevBlankLine(i.cursorConfig,i.model,s.modelState,o)));case Hs.Direction.NextBlankLine:return r===Hs.Unit.WrappedLine?e.map(s=>aa.fromViewState(op.moveToNextBlankLine(i.cursorConfig,i,s.viewState,o))):e.map(s=>aa.fromModelState(op.moveToNextBlankLine(i.cursorConfig,i.model,s.modelState,o)));case Hs.Direction.WrappedLineStart:return this._moveToViewMinColumn(i,e,o);case Hs.Direction.WrappedLineFirstNonWhitespaceCharacter:return this._moveToViewFirstNonWhitespaceColumn(i,e,o);case Hs.Direction.WrappedLineColumnCenter:return this._moveToViewCenterColumn(i,e,o);case Hs.Direction.WrappedLineEnd:return this._moveToViewMaxColumn(i,e,o);case Hs.Direction.WrappedLineLastNonWhitespaceCharacter:return this._moveToViewLastNonWhitespaceColumn(i,e,o);default:return null}}static viewportMove(i,e,t,o,n){let r=i.getCompletelyVisibleViewRange(),s=i.coordinatesConverter.convertViewRangeToModelRange(r);switch(t){case Hs.Direction.ViewPortTop:{let l=this._firstLineNumberInRange(i.model,s,n),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case Hs.Direction.ViewPortBottom:{let l=this._lastLineNumberInRange(i.model,s,n),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case Hs.Direction.ViewPortCenter:{let l=Math.round((s.startLineNumber+s.endLineNumber)/2),c=i.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(i,e[0],o,l,c)]}case Hs.Direction.ViewPortIfOutside:{let l=[];for(let c=0,u=e.length;c<u;c++){let p=e[c];l[c]=this.findPositionInViewportIfOutside(i,p,r,o)}return l}default:return null}}static findPositionInViewportIfOutside(i,e,t,o){let n=e.viewState.position.lineNumber;if(t.startLineNumber<=n&&n<=t.endLineNumber-1)return new aa(e.modelState,e.viewState);{let r;n>t.endLineNumber-1?r=t.endLineNumber-1:n<t.startLineNumber?r=t.startLineNumber:r=n;let s=op.vertical(i.cursorConfig,i,n,e.viewState.position.column,e.viewState.leftoverVisibleColumns,r,!1);return aa.fromViewState(e.viewState.move(o,s.lineNumber,s.column,s.leftoverVisibleColumns))}}static _firstLineNumberInRange(i,e,t){let o=e.startLineNumber;return e.startColumn!==i.getLineMinColumn(o)&&o++,Math.min(e.endLineNumber,o+t-1)}static _lastLineNumberInRange(i,e,t){let o=e.startLineNumber;return e.startColumn!==i.getLineMinColumn(o)&&o++,Math.max(o,e.endLineNumber-t+1)}static _moveLeft(i,e,t,o){return e.map(n=>{let s=i.getTextDirection(n.viewState.position.lineNumber)===1;return aa.fromViewState(s?op.moveRight(i.cursorConfig,i,n.viewState,t,o):op.moveLeft(i.cursorConfig,i,n.viewState,t,o))})}static _moveHalfLineLeft(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round(i.getLineLength(l)/2);o[n]=aa.fromViewState(op.moveLeft(i.cursorConfig,i,s.viewState,t,c))}return o}static _moveRight(i,e,t,o){return e.map(n=>{let s=i.getTextDirection(n.viewState.position.lineNumber)===1;return aa.fromViewState(s?op.moveLeft(i.cursorConfig,i,n.viewState,t,o):op.moveRight(i.cursorConfig,i,n.viewState,t,o))})}static _moveHalfLineRight(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round(i.getLineLength(l)/2);o[n]=aa.fromViewState(op.moveRight(i.cursorConfig,i,s.viewState,t,c))}return o}static _moveDownByViewLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=aa.fromViewState(op.moveDown(i.cursorConfig,i,l.viewState,t,o))}return n}static _moveDownByModelLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=aa.fromModelState(op.moveDown(i.cursorConfig,i.model,l.modelState,t,o))}return n}static _moveUpByViewLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=aa.fromViewState(op.moveUp(i.cursorConfig,i,l.viewState,t,o))}return n}static _moveUpByModelLines(i,e,t,o){let n=[];for(let r=0,s=e.length;r<s;r++){let l=e[r];n[r]=aa.fromModelState(op.moveUp(i.cursorConfig,i.model,l.modelState,t,o))}return n}static _moveDownByFoldedLines(i,e,t,o){let n=i.model,r=n.getLineCount(),s=i.getHiddenAreas();return e.map(l=>{let c=l.modelState.hasSelection()&&!t?l.modelState.selection.endLineNumber:l.modelState.position.lineNumber,p=a._targetFoldedDown(c,o,s,r)-c;return p===0?aa.fromModelState(l.modelState):aa.fromModelState(op.moveDown(i.cursorConfig,n,l.modelState,t,p))})}static _moveUpByFoldedLines(i,e,t,o){let n=i.model,r=i.getHiddenAreas();return e.map(s=>{let l=s.modelState.hasSelection()&&!t?s.modelState.selection.startLineNumber:s.modelState.position.lineNumber,c=a._targetFoldedUp(l,o,r),u=l-c;return u===0?aa.fromModelState(s.modelState):aa.fromModelState(op.moveUp(i.cursorConfig,n,s.modelState,t,u))})}static _targetFoldedDown(i,e,t,o){let n=i,r=0;for(;r<t.length&&t[r].endLineNumber<n+1;)r++;for(let s=0;s<e;s++){if(n>=o)return o;let l=n+1;for(;r<t.length&&t[r].endLineNumber<l;)r++;if(r<t.length&&t[r].startLineNumber<=l&&(l=t[r].endLineNumber+1),l>o)return n;n=l}return n}static _targetFoldedUp(i,e,t){let o=i,n=t.length-1;for(;n>=0&&t[n].startLineNumber>o-1;)n--;for(let r=0;r<e;r++){if(o<=1)return 1;let s=o-1;for(;n>=0&&t[n].startLineNumber>s;)n--;if(n>=0&&t[n].endLineNumber>=s&&(s=t[n].startLineNumber-1),s<1)return o;o=s}return o}static _moveToViewPosition(i,e,t,o,n){return aa.fromViewState(e.viewState.move(t,o,n,0))}static _moveToModelPosition(i,e,t,o,n){return aa.fromModelState(e.modelState.move(t,o,n,0))}static _moveToViewMinColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineMinColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewFirstNonWhitespaceColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineFirstNonWhitespaceColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewCenterColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=Math.round((i.getLineMaxColumn(l)+i.getLineMinColumn(l))/2);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewMaxColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineMaxColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}static _moveToViewLastNonWhitespaceColumn(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.viewState.position.lineNumber,c=i.getLineLastNonWhitespaceColumn(l);o[n]=this._moveToViewPosition(i,s,t,l,c)}return o}},Hs;(s=>{let a=function(l){if(!Di(l))return!1;let c=l;return!(!We(c.to)||!bn(c.select)&&!Xa(c.select)||!bn(c.by)&&!We(c.by)||!bn(c.value)&&!on(c.value)||!bn(c.noHistory)&&!Xa(c.noHistory))};s.metadata={description:"Move cursor to a logical position in the view",args:[{name:"Cursor move argument object",description:`Property-value pairs that can be passed through this argument:
					* 'to': A mandatory logical position value providing where to move the cursor.
						\`\`\`
						'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',
						'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'
						'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'
						'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'
						\`\`\`
					* 'by': Unit to move. Default is computed based on 'to' value.
						\`\`\`
						'line', 'wrappedLine', 'character', 'halfLine', 'foldedLine'
						\`\`\`
						Use 'foldedLine' with 'up'/'down' to move by logical lines while treating each
						folded region as a single step.
					* 'value': Number of units to move. Default is '1'.
					* 'select': If 'true' makes the selection. Default is 'false'.
					* 'noHistory': If 'true' does not add the movement to navigation history. Default is 'false'.
				`,constraint:a,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right","up","down","prevBlankLine","nextBlankLine","wrappedLineStart","wrappedLineEnd","wrappedLineColumnCenter","wrappedLineFirstNonWhitespaceCharacter","wrappedLineLastNonWhitespaceCharacter","viewPortTop","viewPortCenter","viewPortBottom","viewPortIfOutside"]},by:{type:"string",enum:["line","wrappedLine","character","halfLine","foldedLine"]},value:{type:"number",default:1},select:{type:"boolean",default:!1},noHistory:{type:"boolean",default:!1}}}}]},s.RawDirection={Left:"left",Right:"right",Up:"up",Down:"down",PrevBlankLine:"prevBlankLine",NextBlankLine:"nextBlankLine",WrappedLineStart:"wrappedLineStart",WrappedLineFirstNonWhitespaceCharacter:"wrappedLineFirstNonWhitespaceCharacter",WrappedLineColumnCenter:"wrappedLineColumnCenter",WrappedLineEnd:"wrappedLineEnd",WrappedLineLastNonWhitespaceCharacter:"wrappedLineLastNonWhitespaceCharacter",ViewPortTop:"viewPortTop",ViewPortCenter:"viewPortCenter",ViewPortBottom:"viewPortBottom",ViewPortIfOutside:"viewPortIfOutside"},s.RawUnit={Line:"line",WrappedLine:"wrappedLine",Character:"character",HalfLine:"halfLine",FoldedLine:"foldedLine"};function o(l){if(!l.to)return null;let c;switch(l.to){case s.RawDirection.Left:c=0;break;case s.RawDirection.Right:c=1;break;case s.RawDirection.Up:c=2;break;case s.RawDirection.Down:c=3;break;case s.RawDirection.PrevBlankLine:c=4;break;case s.RawDirection.NextBlankLine:c=5;break;case s.RawDirection.WrappedLineStart:c=6;break;case s.RawDirection.WrappedLineFirstNonWhitespaceCharacter:c=7;break;case s.RawDirection.WrappedLineColumnCenter:c=8;break;case s.RawDirection.WrappedLineEnd:c=9;break;case s.RawDirection.WrappedLineLastNonWhitespaceCharacter:c=10;break;case s.RawDirection.ViewPortTop:c=11;break;case s.RawDirection.ViewPortBottom:c=13;break;case s.RawDirection.ViewPortCenter:c=12;break;case s.RawDirection.ViewPortIfOutside:c=14;break;default:return null}let u=0;switch(l.by){case s.RawUnit.Line:u=1;break;case s.RawUnit.WrappedLine:u=2;break;case s.RawUnit.Character:u=3;break;case s.RawUnit.HalfLine:u=4;break;case s.RawUnit.FoldedLine:u=5;break}return{direction:c,unit:u,select:!!l.select,value:l.value||1,noHistory:!!l.noHistory}}s.parse=o;let n;(N=>(N[N.Left=0]="Left",N[N.Right=1]="Right",N[N.Up=2]="Up",N[N.Down=3]="Down",N[N.PrevBlankLine=4]="PrevBlankLine",N[N.NextBlankLine=5]="NextBlankLine",N[N.WrappedLineStart=6]="WrappedLineStart",N[N.WrappedLineFirstNonWhitespaceCharacter=7]="WrappedLineFirstNonWhitespaceCharacter",N[N.WrappedLineColumnCenter=8]="WrappedLineColumnCenter",N[N.WrappedLineEnd=9]="WrappedLineEnd",N[N.WrappedLineLastNonWhitespaceCharacter=10]="WrappedLineLastNonWhitespaceCharacter",N[N.ViewPortTop=11]="ViewPortTop",N[N.ViewPortCenter=12]="ViewPortCenter",N[N.ViewPortBottom=13]="ViewPortBottom",N[N.ViewPortIfOutside=14]="ViewPortIfOutside"))(n=s.Direction||={});let r;(f=>(f[f.None=0]="None",f[f.Line=1]="Line",f[f.WrappedLine=2]="WrappedLine",f[f.Character=3]="Character",f[f.HalfLine=4]="HalfLine",f[f.FoldedLine=5]="FoldedLine"))(r=s.Unit||={})})(Hs||={});var Jwe=class{constructor(i){this._neutralCharacter=null;this._neutralCharacterSearched=!1;if(this.open=i.open,this.close=i.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(i.notIn))for(let e=0,t=i.notIn.length;e<t;e++)switch(i.notIn[e]){case"string":this._inString=!1;break;case"comment":this._inComment=!1;break;case"regex":this._inRegEx=!1;break}}isOK(i){switch(i){case 0:return!0;case 1:return this._inComment;case 2:return this._inString;case 3:return this._inRegEx}}shouldAutoClose(i,e){if(i.getTokenCount()===0)return!0;let t=i.findTokenIndexAtOffset(e-2),o=i.getStandardTokenType(t);return this.isOK(o)}_findNeutralCharacterInRange(i,e){for(let t=i;t<=e;t++){let o=String.fromCharCode(t);if(!this.open.includes(o)&&!this.close.includes(o))return o}return null}findNeutralCharacter(){return this._neutralCharacterSearched||(this._neutralCharacterSearched=!0,this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(48,57)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(97,122)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(65,90))),this._neutralCharacter}},wSt=class{constructor(i){this.autoClosingPairsOpenByStart=new Map,this.autoClosingPairsOpenByEnd=new Map,this.autoClosingPairsCloseByStart=new Map,this.autoClosingPairsCloseByEnd=new Map,this.autoClosingPairsCloseSingleChar=new Map;for(let e of i)X4e(this.autoClosingPairsOpenByStart,e.open.charAt(0),e),X4e(this.autoClosingPairsOpenByEnd,e.open.charAt(e.open.length-1),e),X4e(this.autoClosingPairsCloseByStart,e.close.charAt(0),e),X4e(this.autoClosingPairsCloseByEnd,e.close.charAt(e.close.length-1),e),e.close.length===1&&e.open.length===1&&X4e(this.autoClosingPairsCloseSingleChar,e.close,e)}};function X4e(a,i,e){a.has(i)?a.get(i).push(e):a.set(i,[e])}var CSt=class a{static{this.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES=`;:.,=}])> 
	`}static{this.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS=`'"\`;:.,=}])> 
	`}static{this.DEFAULT_AUTOCLOSE_BEFORE_WHITESPACE=` 
	`}constructor(i){if(i.autoClosingPairs?this._autoClosingPairs=i.autoClosingPairs.map(e=>new Jwe(e)):i.brackets?this._autoClosingPairs=i.brackets.map(e=>new Jwe({open:e[0],close:e[1]})):this._autoClosingPairs=[],i.__electricCharacterSupport&&i.__electricCharacterSupport.docComment){let e=i.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new Jwe({open:e.open,close:e.close||""}))}this._autoCloseBeforeForQuotes=typeof i.autoCloseBefore=="string"?i.autoCloseBefore:a.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES,this._autoCloseBeforeForBrackets=typeof i.autoCloseBefore=="string"?i.autoCloseBefore:a.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS,this._surroundingPairs=i.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(i){return i?this._autoCloseBeforeForQuotes:this._autoCloseBeforeForBrackets}getSurroundingPairs(){return this._surroundingPairs}};var Kni;function d6i(){return Kni||(Kni=new TextDecoder("UTF-16LE")),Kni}var Gni;function YKo(){return Gni||(Gni=new TextDecoder("UTF-16BE")),Gni}var qni;function $ni(){return qni||(qni=n4e()?d6i():YKo()),qni}function u6i(a,i,e){let t=new Uint16Array(a.buffer,i,e);return e>0&&(t[0]===65279||t[0]===65534)?XKo(a,i,e):d6i().decode(t)}function XKo(a,i,e){let t=[],o=0;for(let n=0;n<e;n++){let r=E8i(a,i);i+=2,t[o++]=String.fromCharCode(r)}return t.join("")}var EI=class{constructor(i){this._capacity=i|0,this._buffer=new Uint16Array(this._capacity),this._completedStrings=null,this._bufferLength=0}reset(){this._completedStrings=null,this._bufferLength=0}build(){return this._completedStrings!==null?(this._flushBuffer(),this._completedStrings.join("")):this._buildBuffer()}_buildBuffer(){if(this._bufferLength===0)return"";let i=new Uint16Array(this._buffer.buffer,0,this._bufferLength);return $ni().decode(i)}_flushBuffer(){let i=this._buildBuffer();this._bufferLength=0,this._completedStrings===null?this._completedStrings=[i]:this._completedStrings[this._completedStrings.length]=i}appendCharCode(i){let e=this._capacity-this._bufferLength;e<=1&&(e===0||Ip(i))&&this._flushBuffer(),this._buffer[this._bufferLength++]=i}appendASCIICharCode(i){this._bufferLength===this._capacity&&this._flushBuffer(),this._buffer[this._bufferLength++]=i}appendString(i){let e=i.length;if(this._bufferLength+e>=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=i;return}for(let t=0;t<e;t++)this._buffer[this._bufferLength++]=i.charCodeAt(t)}};var jni=class a{constructor(i,e,t,o,n,r){this._richEditBracketBrand=void 0;this.languageId=i,this.index=e,this.open=t,this.close=o,this.forwardRegex=n,this.reversedRegex=r,this._openSet=a._toSet(this.open),this._closeSet=a._toSet(this.close)}isOpen(i){return this._openSet.has(i)}isClose(i){return this._closeSet.has(i)}static _toSet(i){let e=new Set;for(let t of i)e.add(t);return e}};function ZKo(a){let i=a.length;a=a.map(r=>[r[0].toLowerCase(),r[1].toLowerCase()]);let e=[];for(let r=0;r<i;r++)e[r]=r;let t=(r,s)=>{let[l,c]=r,[u,p]=s;return l===u||l===p||c===u||c===p},o=(r,s)=>{let l=Math.min(r,s),c=Math.max(r,s);for(let u=0;u<i;u++)e[u]===c&&(e[u]=l)};for(let r=0;r<i;r++){let s=a[r];for(let l=r+1;l<i;l++){let c=a[l];t(s,c)&&o(e[r],e[l])}}let n=[];for(let r=0;r<i;r++){let s=[],l=[];for(let c=0;c<i;c++)if(e[c]===r){let[u,p]=a[c];s.push(u),l.push(p)}s.length>0&&n.push({open:s,close:l})}return n}var xSt=class{constructor(i,e){this._richEditBracketsBrand=void 0;let t=ZKo(e);this.brackets=t.map((o,n)=>new jni(i,n,o.open,o.close,e2o(o.open,o.close,t,n),t2o(o.open,o.close,t,n))),this.forwardRegex=i2o(this.brackets),this.reversedRegex=o2o(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(let o of this.brackets){for(let n of o.open)this.textIsBracket[n]=o,this.textIsOpenBracket[n]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,n.length);for(let n of o.close)this.textIsBracket[n]=o,this.textIsOpenBracket[n]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,n.length)}}};function p6i(a,i,e,t){for(let o=0,n=i.length;o<n;o++){if(o===e)continue;let r=i[o];for(let s of r.open)s.indexOf(a)>=0&&t.push(s);for(let s of r.close)s.indexOf(a)>=0&&t.push(s)}}function m6i(a,i){return a.length-i.length}function kSt(a){if(a.length<=1)return a;let i=[],e=new Set;for(let t of a)e.has(t)||(i.push(t),e.add(t));return i}function e2o(a,i,e,t){let o=[];o=o.concat(a),o=o.concat(i);for(let n=0,r=o.length;n<r;n++)p6i(o[n],e,t,o);return o=kSt(o),o.sort(m6i),o.reverse(),Zwe(o)}function t2o(a,i,e,t){let o=[];o=o.concat(a),o=o.concat(i);for(let n=0,r=o.length;n<r;n++)p6i(o[n],e,t,o);return o=kSt(o),o.sort(m6i),o.reverse(),Zwe(o.map(Qni))}function i2o(a){let i=[];for(let e of a){for(let t of e.open)i.push(t);for(let t of e.close)i.push(t)}return i=kSt(i),Zwe(i)}function o2o(a){let i=[];for(let e of a){for(let t of e.open)i.push(t);for(let t of e.close)i.push(t)}return i=kSt(i),Zwe(i.map(Qni))}function n2o(a){let i=/^[\w ]+$/.test(a);return a=Ss(a),i?`\\b${a}\\b`:a}function Zwe(a,i){let e=`(${a.map(n2o).join(")|(")})`;return Yj(e,!0,i)}var Qni=(function(){function a(t){let o=new Uint16Array(t.length),n=0;for(let r=t.length-1;r>=0;r--)o[n++]=t.charCodeAt(r);return $ni().decode(o)}let i=null,e=null;return function(o){return i!==o&&(i=o,e=a(i)),e}})(),mT=class{static _findPrevBracketInText(i,e,t,o){let n=t.match(i);if(!n)return null;let r=t.length-(n.index||0),s=n[0].length,l=o+r;return new G(e,l-s+1,e,l+1)}static findPrevBracketInRange(i,e,t,o,n){let s=Qni(t).substring(t.length-n,t.length-o);return this._findPrevBracketInText(i,e,s,o)}static findNextBracketInText(i,e,t,o){let n=t.match(i);if(!n)return null;let r=n.index||0,s=n[0].length;if(s===0)return null;let l=o+r;return new G(e,l+1,e,l+1+s)}static findNextBracketInRange(i,e,t,o,n){let r=t.substring(o,n);return this.findNextBracketInText(i,e,r,o)}};var ESt=class{constructor(i){this._richEditBrackets=i}getElectricCharacters(){let i=[];if(this._richEditBrackets)for(let e of this._richEditBrackets.brackets)for(let t of e.close){let o=t.charAt(t.length-1);i.push(o)}return jo(i)}onElectricCharacter(i,e,t){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;let o=e.findTokenIndexAtOffset(t-1);if(fF(e.getStandardTokenType(o)))return null;let n=this._richEditBrackets.reversedRegex,r=e.getLineContent().substring(0,t-1)+i,s=mT.findPrevBracketInRange(n,1,r,0,r.length);if(!s)return null;let l=r.substring(s.startColumn-1,s.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[l])return null;let u=e.getActualLineContentBefore(s.startColumn-1);return/^\s*$/.test(u)?{matchOpenBracket:l}:null}};function TSt(a){return a.global&&(a.lastIndex=0),!0}var _St=class{constructor(i){this._indentationRules=i}shouldIncrease(i){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&TSt(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(i))}shouldDecrease(i){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&TSt(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(i))}shouldIndentNextLine(i){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&TSt(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(i))}shouldIgnore(i){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&TSt(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(i))}getIndentMetadata(i){let e=0;return this.shouldIncrease(i)&&(e+=1),this.shouldDecrease(i)&&(e+=2),this.shouldIndentNextLine(i)&&(e+=4),this.shouldIgnore(i)&&(e+=8),e}};var DSt=class a{constructor(i){i=i||{},i.brackets=i.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],i.brackets.forEach(e=>{let t=a._createOpenBracketRegExp(e[0]),o=a._createCloseBracketRegExp(e[1]);t&&o&&this._brackets.push({open:e[0],openRegExp:t,close:e[1],closeRegExp:o})}),this._regExpRules=i.onEnterRules||[]}onEnter(i,e,t,o){if(i>=3)for(let n=0,r=this._regExpRules.length;n<r;n++){let s=this._regExpRules[n];if([{reg:s.beforeText,text:t},{reg:s.afterText,text:o},{reg:s.previousLineText,text:e}].every(c=>c.reg?(c.reg.lastIndex=0,c.reg.test(c.text)):!0))return s.action}if(i>=2&&t.length>0&&o.length>0)for(let n=0,r=this._brackets.length;n<r;n++){let s=this._brackets[n];if(s.openRegExp.test(t)&&s.closeRegExp.test(o))return{indentAction:2}}if(i>=2&&t.length>0){for(let n=0,r=this._brackets.length;n<r;n++)if(this._brackets[n].openRegExp.test(t))return{indentAction:1}}return null}static _createOpenBracketRegExp(i){let e=Ss(i);return/\B/.test(e.charAt(0))||(e="\\b"+e),e+="\\s*$",a._safeRegExp(e)}static _createCloseBracketRegExp(i){let e=Ss(i);return/\B/.test(e.charAt(e.length-1))||(e=e+"\\b"),e="^\\s*"+e,a._safeRegExp(e)}static _safeRegExp(i){try{return new RegExp(i)}catch(e){return mt(e),null}}};var B=le("configurationService");function LSt(a){let i=a;return i&&typeof i=="object"&&(!i.overrideIdentifier||typeof i.overrideIdentifier=="string")&&(!i.resource||i.resource instanceof A)}function h6i(a){let i=a;return i&&typeof i=="object"&&(!i.overrideIdentifiers||Array.isArray(i.overrideIdentifiers))&&!i.overrideIdentifier&&(!i.resource||i.resource instanceof A)}function HY(a){switch(a){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 Z4e(a,i){switch(i){case 1:return a.applicationValue;case 2:return a.userValue;case 3:return a.userLocalValue;case 4:return a.userRemoteValue;case 5:return a.workspaceValue;case 6:return a.workspaceFolderValue;case 7:return a.defaultValue;case 8:return a.memoryValue;default:bs(i)}}function m5(a){return a.applicationValue!==void 0||a.userValue!==void 0||a.userLocalValue!==void 0||a.userRemoteValue!==void 0||a.workspaceValue!==void 0||a.workspaceFolderValue!==void 0}function hce(a,i){let e=Object.create(null);for(let t in a)Yni(e,t,a[t],i);return e}function Yni(a,i,e,t){let o=i.split("."),n=o.pop(),r=a;for(let s=0;s<o.length;s++){let l=o[s],c=r[l];switch(typeof c){case"undefined":c=r[l]=Object.create(null);break;case"object":if(c===null){t(`Ignoring ${i} as ${o.slice(0,s+1).join(".")} is null`);return}break;default:t(`Ignoring ${i} as ${o.slice(0,s+1).join(".")} is ${JSON.stringify(c)}`);return}r=c}if(typeof r=="object"&&r!==null)try{r[n]=e}catch{t(`Ignoring ${i} as ${o.join(".")} is ${JSON.stringify(r)}`)}else t(`Ignoring ${i} as ${o.join(".")} is ${JSON.stringify(r)}`)}function g6i(a,i){let e=i.split(".");f6i(a,e)}function f6i(a,i){if(!a)return;let e=a,t=i.shift();if(i.length===0){delete e[t];return}if(Object.keys(e).indexOf(t)!==-1){let o=e[t];typeof o=="object"&&o!==null&&!Array.isArray(o)&&(f6i(o,i),Object.keys(o).length===0&&delete e[t])}}function e3e(a,i,e){function t(r,s){let l=r;for(let c of s){if(typeof l!="object"||l===null)return;l=l[c]}return l}let o=i.split("."),n=t(a,o);return typeof n>"u"?e:n}function eCe(a){return a.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}var Rt=le("languageService");var Vt=class{constructor(i,e=[],t=!1){this.ctor=i,this.staticArguments=e,this.supportsDelayedInstantiation=t}};var v6i=[];function Ce(a,i,e){i instanceof Vt||(i=new Vt(i,[],!!e)),v6i.push([a,i])}function b6i(){return v6i}var cr=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"}),r2o={".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"},Xni={".aac":"audio/x-aac",".avi":"video/x-msvideo",".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 S6i(a){let i=km(a),e=r2o[i.toLowerCase()];return e!==void 0?e:Py(a)}function Py(a){let i=km(a),e=Xni[i.toLowerCase()];return Array.isArray(e)?e[0]:e}function wA(a){for(let i in Xni){let e=Xni[i];if(Array.isArray(e)?e.includes(a):e===a)return i}}var s2o=/^(.+)\/(.+?)(;.+)?$/;function Jni(a,i){let e=s2o.exec(a);return e?`${e[1].toLowerCase()}/${e[2].toLowerCase()}${e[3]??""}`:i?void 0:a}function FL(a){return["application/vnd.code.notebook.stdout","application/vnd.code.notebook.stderr"].includes(a)}function I6i(a){let i=!1,e=new Map,t=new Map;if(a2o(a,u=>{if(a===u)return!0;let p=JSON.stringify(u);if(p.length<30)return!0;let h=e.get(p);if(!h){let g={schemas:[u]};return e.set(p,g),t.set(u,g),!0}return h.schemas.push(u),t.set(u,h),i=!0,!1}),e.clear(),!i)return JSON.stringify(a);let n="$defs";for(;a.hasOwnProperty(n);)n+="_";let r=[];function s(u){return JSON.stringify(u,(p,h)=>{if(h!==u){let g=t.get(h);if(g&&g.schemas.length>1)return g.id||(g.id=`_${r.length}`,r.push(g.schemas[0])),{$ref:`#/${n}/${g.id}`}}return h})}let l=s(a),c=[];for(let u=0;u<r.length;u++)c.push(`"_${u}":${s(r[u])}`);return c.length?`${l.substring(0,l.length-1)},"${n}":{${c.join(",")}}}`:l}function tCe(a){return typeof a=="object"&&a!==null}function a2o(a,i){if(!a||typeof a!="object")return;let e=(...l)=>{for(let c of l)tCe(c)&&r.push(c)},t=(...l)=>{for(let c of l)if(tCe(c))for(let u in c){let p=c[u];tCe(p)&&r.push(p)}},o=(...l)=>{for(let c of l)if(Array.isArray(c))for(let u of c)tCe(u)&&r.push(u)},n=l=>{if(Array.isArray(l))for(let c of l)tCe(c)&&r.push(c);else tCe(l)&&r.push(l)},r=[a],s=r.pop();for(;s;)i(s)&&(e(s.additionalItems,s.additionalProperties,s.not,s.contains,s.propertyNames,s.if,s.then,s.else,s.unevaluatedItems,s.unevaluatedProperties),t(s.definitions,s.$defs,s.properties,s.patternProperties,s.dependencies,s.dependentSchemas),o(s.anyOf,s.allOf,s.oneOf,s.prefixItems),n(s.items)),s=r.pop()}var Ta={JSONContribution:"base.contributions.json"};function y6i(a){return a.length>0&&a.charAt(a.length-1)==="#"?a.substring(0,a.length-1):a}var Zni=class extends k{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,t,o){let n=y6i(e);this.schemasById[n]=t,this._onDidChangeSchema.fire(e),o&&o.add(ee(()=>{delete this.schemasById[n],this._onDidChangeSchema.fire(e)}))}registerSchemaAssociation(e,t){let o=y6i(e);return this.schemaAssociations[o]||(this.schemaAssociations[o]=[]),this.schemaAssociations[o].includes(t)||(this.schemaAssociations[o].push(t),this._onDidChangeSchemaAssociations.fire()),ee(()=>{let n=this.schemaAssociations[o];if(n){let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&delete this.schemaAssociations[o],this._onDidChangeSchemaAssociations.fire())}})}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}getSchemaContributions(){return{schemas:this.schemasById}}getSchemaContent(e){let t=this.schemasById[e];return t?I6i(t):void 0}hasSchemaContent(e){return!!this.schemasById[e]}getSchemaAssociations(){return this.schemaAssociations}},l2o=new Zni;oe.add(Ta.JSONContribution,l2o);var WL,eri=globalThis.vscode;if(typeof eri<"u"&&typeof eri.context<"u"){let a=eri.context.configuration();if(a)WL=a.product;else throw new Error("Sandbox: unable to resolve product configuration from preload script.")}else if(globalThis._VSCODE_PRODUCT_JSON&&globalThis._VSCODE_PACKAGE_JSON){if(WL=globalThis._VSCODE_PRODUCT_JSON,Sp.VSCODE_DEV&&Object.assign(WL,{nameShort:`${WL.nameShort} Dev`,nameLong:`${WL.nameLong} Dev`,dataFolderName:`${WL.dataFolderName}-dev`,serverDataFolderName:WL.serverDataFolderName?`${WL.serverDataFolderName}-dev`:void 0}),!WL.version){let a=globalThis._VSCODE_PACKAGE_JSON;Object.assign(WL,{version:a.version})}}else WL={nameShort:"Code - Insiders",nameLong:"Visual Studio Code - Insiders",applicationName:"code-insiders",win32x64AppId:"{{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}",win32arm64AppId:"{{0AEDB616-9614-463B-97D7-119DD86CCA64}",win32x64UserAppId:"{{217B4C08-948D-4276-BFBB-BEE930AE5A2C}",win32arm64UserAppId:"{{69BD8F7B-65EB-4C6F-A14E-44CFA83712C0}",win32NameVersion:"Microsoft Visual Studio Code Insiders",win32DirName:"Microsoft VS Code Insiders",win32SetupExeBasename:"VSCodeInsidersSetup",win32AppUserModelId:"Microsoft.VisualStudioCodeInsiders",win32ShellNameShort:"Code Insiders",win32MutexName:"vscodeinsiders",win32RegValueName:"VSCodeInsiders",win32VersionedUpdate:!0,darwinCredits:"resources/darwin/Credits.rtf",darwinBundleIdentifier:"com.microsoft.VSCodeInsiders",darwinSharedKeychainServiceName:"com.microsoft.VSCodeInsiders.shared-secrets",darwinProfileUUID:"7CC2F939-3A89-4A22-B9DA-E5B81C0F6C03",darwinProfilePayloadUUID:"BEA6A398-BD82-4EEC-B626-8464DBB73561",darwinExecutable:"VSCodeInsiders",linuxIconName:"vscode-insiders",licenseFileName:"LICENSE.rtf",licenseName:"Multiple, see https://code.visualstudio.com/license",serverGreeting:[],serverLicense:["*","* Visual Studio Code Server","*","* By using the software, you agree to","* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and","* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).","*"],serverLicensePrompt:"Do you accept the terms in the License Agreement (Y/n)?",serverApplicationName:"code-server-insiders",urlProtocol:"vscode-insiders",dataFolderName:".vscode-insiders",sharedDataFolderName:".vscode-insiders-shared",serverDataFolderName:".vscode-server-insiders",downloadUrl:"https://code.visualstudio.com/insiders",updateUrl:"https://update.code.visualstudio.com",webUrl:"https://insiders.vscode.dev",webEndpointUrl:"https://main.vscode-cdn.net",webEndpointUrlTemplate:"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}",nlsCoreBaseUrl:"https://www.vscode-unpkg.net/nls/",webviewContentExternalBaseUrlTemplate:"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}/out/vs/workbench/contrib/webview/browser/pre/",quality:"insider",extensionsGallery:{nlsBaseUrl:"https://www.vscode-unpkg.net/_lp/",serviceUrl:"https://marketplace.visualstudio.com/_apis/public/gallery",itemUrl:"https://marketplace.visualstudio.com/items",publisherUrl:"https://marketplace.visualstudio.com/publishers",resourceUrlTemplate:"https://{publisher}.vscode-unpkg.net/{publisher}/{name}/{version}/{path}",extensionUrlTemplate:"https://www.vscode-unpkg.net/_gallery/{publisher}/{name}/latest",controlUrl:"https://main.vscode-cdn.net/extensions/marketplace.json",mcpUrl:"https://main.vscode-cdn.net/mcp/servers.json",accessSKUs:["copilot_enterprise_seat","copilot_enterprise_seat_quota","copilot_enterprise_seat_multi_quota","copilot_enterprise_seat_assignment","copilot_enterprise_seat_assignment_quota","copilot_enterprise_seat_assignment_multi_quota","copilot_enterprise_trial_seat","copilot_enterprise_trial_seat_quota","copilot_for_business_seat","copilot_for_business_seat_quota","copilot_for_business_seat_multi_quota","copilot_for_business_seat_assignment","copilot_for_business_seat_assignment_quota","copilot_for_business_seat_assignment_multi_quota","copilot_for_business_trial_seat","copilot_for_business_trial_seat_quota"]},extensionProperties:{"github.copilot-chat":{excludeVersionRange:"<=0.16.1"},"github.copilot":{hasPrereleaseVersion:!0}},extensionsForceVersionByQuality:["github.copilot-chat","github.copilot"],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.10",sha256:"7361748ddf9fd09d8a2ed1f2a2d7376a2cf9aae708692820b799708385c38e08",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"}},{name:"TypeScriptTeam.jsts-chat-features",version:"0.0.2",sha256:"288d8bc26a6e3a752c0971bc93078736c3d818384b27989c1e05ec49a28e1c29",metadata:{id:"7d881d23-233c-448d-9700-cf11a0de79c2",publisherId:{publisherId:"4f0355d2-4a53-4ab1-a8ea-507f4a333a6f",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}}],mcpGallery:{serviceUrl:"https://api.mcp.github.com",itemWebUrl:"https://github.com/mcp/{name}",publisherUrl:"https://github.com/{name}",supportUrl:"https://support.github.com",privacyPolicyUrl:"https://docs.github.com/site-policy/privacy-policies/github-general-privacy-statement",termsOfServiceUrl:"https://docs.github.com/site-policy/github-terms/github-terms-of-service",reportUrl:"https://docs.github.com/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam"},profileTemplatesUrl:"https://main.vscode-cdn.net/core/profile-templates.json",emergencyAlertUrl:"https://main.vscode-cdn.net/core/insiders.json",extensionPublisherOrgs:["microsoft"],trustedExtensionPublishers:["microsoft","github","openai"],extensionRecommendations:{"ms-vscode.vscode-chat-customizations-evaluations":{onFileOpen:[{pathGlob:"{**/*prompt.md, **/*skill.md, **/*instructions.md, **/*agent.md}",important:!0},{languages:["prompt","chatagent","skill","instructions"],important:!0}]},"ms-dotnettools.csdevkit":{onFileOpen:[{pathGlob:"{**/*.cs,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln}",important:!0},{languages:["csharp"],important:!0},{pathGlob:"{**/project.json,**/appsettings.json}"}]},"microsoft-aspire.aspire-vscode":{onFileOpen:[{pathGlob:"{**/apphost.cs,**/apphost.js,**/apphost.ts,**/apphost.py,**/AppHost.java,**/aspire.config.json,**/.aspire/settings.json}",important:!0}]},"ms-python.python":{onFileOpen:[{pathGlob:"{**/*.py}",important:!0},{languages:["python"],important:!0},{pathGlob:"{**/*.ipynb}"}]},"ms-toolsai.jupyter":{onFileOpen:[{pathGlob:"{**/*.py}",contentPattern:"^#\\s*%%$",important:!0,whenInstalled:["ms-python.python"]},{pathGlob:"{**/*.ipynb}"}]},"ms-toolsai.datawrangler":{onFileOpen:[{pathGlob:"{**/*.ipynb}",contentPattern:"import\\s*pandas|from\\s*pandas",whenInstalled:["ms-toolsai.jupyter"]}]},"golang.Go":{onFileOpen:[{pathGlob:"**/*.go",important:!0},{languages:["go"],important:!0}]},"vscjava.vscode-java-pack":{onFileOpen:[{pathGlob:"{**/*.java}",important:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]},{languages:["java"],important:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}]},"ms-vscode.PowerShell":{onFileOpen:[{pathGlob:"{**/*.ps1,**/*.psd1,**/*.psm1}",important:!0},{languages:["powershell"],important:!0},{pathGlob:"{**/*.ps.config,**/*.ps1.config}"}]},"ms-toolsai.prompty":{onFileOpen:[{pathGlob:"{**/*.prompty}",important:!1}]},"quantum.qsharp-lang-vscode":{onFileOpen:[{pathGlob:"{**/*.qs,**/*.qsc,**/*.qasm}",important:!0}]},"typespec.typespec-vscode":{onFileOpen:[{pathGlob:"{**/*.tsp,**/tspconfig.yaml}",important:!0}]},"ms-vscode.cpptools-extension-pack":{onFileOpen:[{pathGlob:"{**/*.c,**/*.cpp,**/*.cc,**/.cxx,**/*.hh,**/*.hpp,**/*.hxx,**/*.h}",important:!0,whenNotInstalled:["llvm-vs-code-extensions.vscode-clangd"]},{languages:["c","cpp"],important:!0,whenNotInstalled:["llvm-vs-code-extensions.vscode-clangd"]}]},"ms-azuretools.vscode-containers":{onFileOpen:[{pathGlob:"{**/dockerfile,**/Dockerfile,**/docker-compose.yml,**/docker-compose.*.yml}",important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},{languages:["dockerfile"],important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},{pathGlob:"{**/*.cs,**/project.json,**/global.json,**/*.csproj,**/*.cshtml,**/*.sln,**/appsettings.json,**/*.py,**/*.ipynb,**/*.js,**/*.ts,**/package.json}",whenNotInstalled:["ms-azuretools.vscode-docker"]}]},"vue.volar":{onFileOpen:[{pathGlob:"{**/*.vue}",important:!0},{languages:["vue"],important:!0}]},"ms-vscode.makefile-tools":{onFileOpen:[{pathGlob:"{**/makefile,**/Makefile}",important:!0},{languages:["makefile"],important:!0}]},"ms-vscode.cmake-tools":{onFileOpen:[{pathGlob:"{**/CMakeLists.txt}",important:!0}]},"ms-azure-devops.azure-pipelines":{onFileOpen:[{pathGlob:"{**/azure-pipelines.yaml}",important:!0}]},"msazurermtools.azurerm-vscode-tools":{onFileOpen:[{pathGlob:"{**/azuredeploy.json}",important:!0}]},"ms-vscode-remote.remote-containers":{onFileOpen:[{pathGlob:"{**/devcontainer.json}",important:!0}]},"ms-azuretools.vscode-bicep":{onFileOpen:[{pathGlob:"{**/*.bicep}",important:!0,whenNotInstalled:["ms-azuretools.rad-vscode-bicep"]}]},"svelte.svelte-vscode":{onFileOpen:[{pathGlob:"{**/*.svelte}",important:!0}]},"ms-vscode.vscode-github-issue-notebooks":{onFileOpen:[{pathGlob:"{**/*.github-issues}",important:!0}]},"ms-playwright.playwright":{onFileOpen:[{pathGlob:"{**/*playwright*.config.ts,**/*playwright*.config.js,**/*playwright*.config.mjs}",important:!0}]},"vscjava.vscode-gradle":{onFileOpen:[{pathGlob:"{**/gradlew,**/gradlew.bat,**/build.gradle,**/build.gradle.kts,**/settings.gradle,**/settings.gradle.kts}",important:!0}]},"REditorSupport.r":{onFileOpen:[{pathGlob:"{**/*.r}",important:!0},{languages:["r"],important:!0}]},"firefox-devtools.vscode-firefox-debug":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.es6,**/.babelrc}"}]},"ms-edgedevtools.vscode-edge-devtools":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.css,**/*.html}"}]},"Ionide.Ionide-fsharp":{onFileOpen:[{pathGlob:"{**/*.fsx,**/*.fsi,**/*.fs,**/*.ml,**/*.mli}"}]},"dbaeumer.vscode-eslint":{onFileOpen:[{pathGlob:"{**/*.js,**/*.jsx,**/*.es6,**/.eslintrc.*,**/.eslintrc,**/.babelrc,**/jsconfig.json}"}]},"bmewburn.vscode-intelephense-client":{onFileOpen:[{pathGlob:"{**/*.php,**/php.ini}"}]},"xdebug.php-debug":{onFileOpen:[{pathGlob:"{**/*.php,**/php.ini}"}]},"rust-lang.rust-analyzer":{onFileOpen:[{pathGlob:"{**/*.rs,**/*.rslib}"}]},"DavidAnson.vscode-markdownlint":{onFileOpen:[{pathGlob:"{**/*.md}"}]},"EditorConfig.EditorConfig":{onFileOpen:[{pathGlob:"{**/.editorconfig}"}]},"HookyQR.beautify":{onFileOpen:[{pathGlob:"{**/.jsbeautifyrc}"}]},"donjayamanne.githistory":{onFileOpen:[{pathGlob:"{**/.gitignore,**/.git}"}]},"eamodio.gitlens":{onFileOpen:[{pathGlob:"{**/.gitignore,**/.git}"}]},"Shopify.ruby-lsp":{onFileOpen:[{pathGlob:"{**/*.rb,**/*.erb,**/*.reek,**/.fasterer.yml,**/ruby-lint.yml,**/.rubocop.yml}"}]},"swiftlang.swift-vscode":{onFileOpen:[{pathGlob:"{**/*.swift,**/*.swiftinterface}",important:!0}]},"DotJoshJohnson.xml":{onFileOpen:[{pathGlob:"{**/*.xml}"}]},"stylelint.vscode-stylelint":{onFileOpen:[{pathGlob:"{**/.stylelintrc,**/stylelint.config.js}"}]},"ms-mssql.mssql":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"mtxr.sqltools":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"usqlextpublisher.usql-vscode-ext":{onFileOpen:[{pathGlob:"{**/*.usql}"}]},"ms-vscode.sublime-keybindings":{onFileOpen:[{pathGlob:"{**/.sublime-project,**/.sublime-workspace}"}]},"k--kato.intellij-idea-keybindings":{onFileOpen:[{pathGlob:"{**/.idea}"}]},"christian-kohler.npm-intellisense":{onFileOpen:[{pathGlob:"{**/package.json}"}]},"cake-build.cake-vscode":{onFileOpen:[{pathGlob:"{**/build.cake}"}]},"Angular.ng-template":{onFileOpen:[{pathGlob:"{**/.angular-cli.json,**/angular.json,**/*.ng.html,**/*.ng,**/*.ngml}"}]},"vscjava.vscode-maven":{onFileOpen:[{pathGlob:"**/pom.xml"}]},"ms-azuretools.vscode-azureterraform":{onFileOpen:[{pathGlob:"**/*.tf"}]},"HashiCorp.terraform":{onFileOpen:[{pathGlob:"**/*.tf"}]},"vsciot-vscode.vscode-arduino":{onFileOpen:[{pathGlob:"**/*.ino"}]},"ms-kubernetes-tools.vscode-kubernetes-tools":{onFileOpen:[{pathGlob:"{**/Chart.yaml}"}]},"Oracle.oracledevtools":{onFileOpen:[{pathGlob:"{**/*.sql}"}]},"betterthantomorrow.calva":{onFileOpen:[{pathGlob:"{**/*.clj,**/*.cljs}"}]},"vmware.vscode-boot-dev-pack":{onFileOpen:[{pathGlob:"{**/application.properties}"}]},"GitHub.copilot":{onFileOpen:[{pathGlob:"{**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.py,**/*.go,**/*.rb,**/*.html,**/*.css,**/*.php,**/*.cpp,**/*.vue,**/*.c,**/*.sql,**/*.java,**/*.cs,**/*.rs,**/*.dart,**/*.ps,**/*.ps1,**/*.tex}"}]},"GitHub.copilot-chat":{onSettingsEditorOpen:{descriptionOverride:"GitHub Copilot is an AI-powered coding assistant that helps you write code faster and smarter."}},"GitHub.vscode-github-actions":{onFileOpen:[{pathGlob:"{**/.github/workflows/*.yml}",important:!0}]},"circleci.circleci":{onFileOpen:[{pathGlob:"{**/.circleci/config.yml}"}]},"mechatroner.rainbow-csv":{onFileOpen:[{pathGlob:"**/*.csv",important:!0}]},"tomoki1207.pdf":{onFileOpen:[{pathGlob:"**/*.pdf",important:!0}]},"Redis.redis-for-vscode":{onFileOpen:[{pathGlob:"{**/redis.*,**/redis-server.*,**/redis_*,**/redisinsight.*}",important:!0}]},"SonarSource.sonarlint-vscode":{onFileOpen:[{pathGlob:"{**/sonar-project.properties,**/sonarcloud.properties,**/sonarlint.*}",important:!0}]}},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"}],keymapExtensionTips:["vscodevim.vim","ms-vscode.sublime-keybindings","ms-vscode.atom-keybindings","ms-vscode.brackets-keybindings","ms-vscode.vs-keybindings","ms-vscode.notepadplusplus-keybindings","k--kato.intellij-idea-keybindings","lfs.vscode-emacs-friendly","alphabotsec.vscode-eclipse-keybindings","alefragnani.delphi-keybindings"],languageExtensionTips:["ms-python.python","ms-vscode.cpptools-extension-pack","ms-dotnettools.csdevkit","ms-toolsai.jupyter","vscjava.vscode-java-pack","ecmel.vscode-html-css","vue.volar","bmewburn.vscode-intelephense-client","dsznajder.es7-react-js-snippets","golang.go","ms-vscode.powershell","dart-code.dart-code","rust-lang.rust-analyzer","Shopify.ruby-lsp","GitHub.copilot"],configBasedExtensionTips:{git:{configPath:".git/config",configName:"Git",recommendations:{"github.vscode-pull-request-github":{name:"GitHub Pull Request",contentPattern:"^\\s*url\\s*=\\s*https:\\/\\/github\\.com.*$"},"eamodio.gitlens":{name:"GitLens"}}},devContainer:{configPath:".devcontainer/devcontainer.json",configName:"Dev Container",recommendations:{"ms-vscode-remote.remote-containers":{name:"Dev Containers",important:!0}}},maven:{configPath:"pom.xml",configName:"Maven",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]},"vmware.vscode-boot-dev-pack":{name:"Spring Boot Extension Pack",isExtensionPack:!0}}},gradle:{configPath:"build.gradle",configName:"Gradle",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},"github-pull-request":{configPath:".vscode/.github-pull-request.rec",configName:"GitHub",configScheme:"vscode-vfs",recommendations:{"github.vscode-pull-request-github":{name:"GitHub Pull Request",important:!0}}},"pyproject-formatter":{configPath:"pyproject.toml",configName:"Python Formatter",recommendations:{"ms-python.black-formatter":{name:"Black Formatter",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?black"?\\s*[\\].])|("black\\s*["[(<=>!~;@])'},"ms-python.autopep8":{name:"Autopep8",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?autopep8"?\\s*[\\].])|("autopep8\\s*["[(<=>!~;@])'}}},"pep8-formatter":{configPath:".pep8",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8"}}},"python-setup-cgf-formatter":{configPath:"setup.cfg",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8",contentPattern:"^\\[pep8\\]"}}},"tox-ini-formatter":{configPath:"tox.ini",configName:"Python Formatter",recommendations:{"ms-python.autopep8":{name:"Autopep8",contentPattern:"^\\[pep8\\]"}}},"pyproject-linter":{configPath:"pyproject.toml",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?pylint"?\\s*[\\].])|("pylint\\s*["[(<=>!~;@])'},"charliermarsh.ruff":{name:"Ruff",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?ruff"?\\s*[\\].])|("ruff\\s*["[(<=>!~;@])'},"ms-python.mypy-type-checker":{name:"Mypy Type Checker",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?mypy"?\\s*[\\].])|("mypy\\s*["[(<=>!~;@])'},"ms-python.flake8":{name:"Flake8",contentPattern:'(^\\s*\\[\\[?\\s*"?tool"?\\s*\\.\\s*"?flake8"?\\s*[\\].])|("flake8\\s*["[(<=>!~;@])'}}},".pylintrc-linter":{configPath:".pylintrc",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint"}}},"pylintrc-linter":{configPath:"pylintrc",configName:"Python Linter",recommendations:{"ms-python.pylint":{name:"Pylint"}}},"mypy-ini-linter":{configPath:".mypy.ini",configName:"Python Linter",recommendations:{"ms-python.mypy-type-checker":{name:"Mypy Type Checker"}}},"tox-ini-linter":{configPath:"tox.ini",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8",contentPattern:"^\\[flake8\\]"}}},".flake8-linter":{configPath:".flake8",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8"}}},"python-setup-cgf-linter":{configPath:"setup.cfg",configName:"Python Linter",recommendations:{"ms-python.flake8":{name:"Flake8",contentPattern:"^\\[flake8\\]"}}}},exeBasedExtensionTips:{az:{friendlyName:"Azure CLI",windowsPath:"%ProgramFiles(x86)%\\Microsoft SDKs\\Azure\\CLI2\\wbin\\az.cmd",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},azd:{friendlyName:"Azure Dev CLI",windowsPath:"%USERPROFILE%\\AppData\\Local\\Programs\\Azure Dev CLI\\azd.exe",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},"azd-user":{friendlyName:"Azure Dev CLI",windowsPath:"%ProgramFiles%\\Azure Dev CLI\\azd.exe",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"},"ms-azuretools.vscode-azure-github-copilot":{name:"GitHub Copilot for Azure"}}},"azure-powershell":{friendlyName:"Azure PowerShell",windowsPath:"%USERPROFILE%\\.Azure",recommendations:{"ms-vscode.vscode-node-azure-pack":{name:"Azure Tools"}}},heroku:{friendlyName:"Heroku CLI",windowsPath:"%ProgramFiles%\\Heroku\\bin\\heroku.cmd",recommendations:{"ms-azuretools.vscode-azureappservice":{name:"Azure App Service"},"pkosta2005.heroku-command":{name:"heroku-cli"}}},mongo:{friendlyName:"Mongo",windowsPath:"%ProgramFiles%\\MongoDB\\Server\\3.6\\bin\\mongod.exe",recommendations:{"ms-azuretools.vscode-cosmosdb":{name:"Azure Databases"}}},serverless:{friendlyName:"Serverless framework",windowsPath:"%APPDATA%\\npm\\serverless.cmd",recommendations:{"ms-azuretools.vscode-azurefunctions":{name:"Azure Functions"}}},func:{friendlyName:"Azure Function SDK",windowsPath:"%APPDATA%\\npm\\func.cmd",recommendations:{"ms-azuretools.vscode-azurefunctions":{name:"Azure Functions"}}},mysql:{friendlyName:"MySQL",windowsPath:"%ProgramFiles%\\MySQL\\MySQL Server 8.0\\bin\\mysqld.exe",recommendations:{"mtxr.sqltools":{name:"SQLTools"}}},postgres:{friendlyName:"PostgreSQL",windowsPath:"%ProgramFiles%\\PostgreSQL\\11\\bin\\psql.exe",recommendations:{"ms-ossdata.vscode-postgresql":{name:"PostgreSQL"},"mtxr.sqltools":{name:"SQLTools"}}},sqlcmd:{friendlyName:"SQL CLI",recommendations:{"ms-mssql.mssql":{name:"SQL Server (mssql)"}}},now:{friendlyName:"Now CLI",windowsPath:"%APPDATA%\\npm\\now.cmd",recommendations:{"ms-azuretools.vscode-azureappservice":{name:"Azure App Service"},"ms-azuretools.vscode-containers":{name:"Docker"}}},docker:{friendlyName:"Docker",windowsPath:"%ProgramFiles%\\Docker\\Docker\\Resources\\bin\\docker.exe",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker",important:!0,whenNotInstalled:["ms-azuretools.vscode-docker"]},"ms-vscode-remote.remote-containers":{name:"Dev Containers",important:!0},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},kubectl:{friendlyName:"Kubernetes",windowsPath:"%ProgramFiles%\\Docker\\Docker\\Resources\\bin\\kubectl.exe",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"},"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},ng:{friendlyName:"Angular CLI",windowsPath:"%APPDATA%\\npmexit\\ng.cmd",recommendations:{"johnpapa.Angular2":{name:"Angular Snippets"}}},"create-react-app":{friendlyName:"Create React App",windowsPath:"%APPDATA%\\npm\\create-react-app.cmd",recommendations:{"msjsdiag.vscode-react-native":{name:"React Native Tools"}}},"react-native":{friendlyName:"React Native",windowsPath:"%APPDATA%\\npm\\react-native-cli",recommendations:{"msjsdiag.vscode-react-native":{name:"React Native Tools"}}},p4:{friendlyName:"Perforce",recommendations:{"slevesque.perforce":{name:"Perforce for VS Code"}}},hg:{friendlyName:"Mercurial",recommendations:{"mrcrowl.hg":{name:"Hg"}}},git:{friendlyName:"Git",windowsPath:"%ProgramFiles%\\Git\\git-bash.exe",recommendations:{"eamodio.gitlens":{name:"GitLens"}}},svn:{friendlyName:"Subversion",windowsPath:"%ProgramFiles%\\TortoiseSVN\\bin\\TortoiseProc.exe",recommendations:{"johnstoncode.svn-scm":{name:"SVN"}}},subl:{friendlyName:"Sublime",windowsPath:"%ProgramFiles%\\Sublime Text3\\sublime_text.exe",recommendations:{"ms-vscode.sublime-keybindings":{name:"Sublime Text Keymap and Settings Importer"}}},atom:{friendlyName:"Atom",windowsPath:"%USERPROFILE%\\AppData\\Local\\atom\\bin\\atom.cmd",recommendations:{"ms-vscode.atom-keybindings":{name:"Atom Keymap"}}},brackets:{friendlyName:"Brackets",windowsPath:"%ProgramFiles(x86)%\\Brackets\\Brackets.exe",recommendations:{"ms-vscode.brackets-keybindings":{name:"Brackets Keymap"}}},notepadplusplus:{friendlyName:"Notepad++",windowsPath:"%ProgramFiles%\\Notepad++\\Notepad++.exe",recommendations:{"ms-vscode.notepadplusplus-keybindings":{name:"Notepad++ keymap"}}},vi:{friendlyName:"VIM",windowsPath:"%ProgramFiles(x86)%\\Vim\\vim80\\gvim.exe",recommendations:{"vscodevim.vim":{name:"Vim"}}},mvn:{friendlyName:"Maven",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},gradle:{friendlyName:"Gradle",recommendations:{"vscjava.vscode-java-pack":{name:"Java",important:!0,isExtensionPack:!0,whenNotInstalled:["ASF.apache-netbeans-java","Oracle.oracle-java"]}}},ollama:{friendlyName:"Ollama",windowsPath:"%USERPROFILE%\\AppData\\Local\\Programs\\Ollama\\ollama.exe",recommendations:{"ms-windows-ai-studio.windows-ai-studio":{name:"AI Toolkit for Visual Studio Code"}}},"Microsoft Edge":{friendlyName:"Microsoft Edge",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Dev":{friendlyName:"Microsoft Edge Dev",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge Dev\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Beta":{friendlyName:"Microsoft Edge Beta",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge Beta\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Microsoft Edge Canary":{friendlyName:"Microsoft Edge Canary",windowsPath:"%USERPROFILE%\\AppData\\Local\\Microsoft\\Edge SxS\\Application\\msedge.exe",recommendations:{"ms-edgedevtools.vscode-edge-devtools":{name:"Microsoft Edge Developer Tools"}}},"Mozilla Firefox (x86)":{friendlyName:"Mozilla Firefox",windowsPath:"%ProgramFiles(x86)%\\Mozilla Firefox\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox Developer Edition (x86)":{friendlyName:"Mozilla Firefox Developer Edition",windowsPath:"%ProgramFiles(x86)%\\Firefox Developer Edition\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox":{friendlyName:"Mozilla Firefox",windowsPath:"%ProgramFiles%\\Mozilla Firefox\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},"Mozilla Firefox Developer Edition":{friendlyName:"Mozilla Firefox Developer Edition",windowsPath:"%ProgramFiles%\\Firefox Developer Edition\\firefox.exe",recommendations:{"firefox-devtools.vscode-firefox-debug":{name:"Debugger for Firefox"}}},cordova:{friendlyName:"Cordova",windowsPath:"%APPDATA%\\npm\\cordova",recommendations:{"msjsdiag.cordova-tools":{name:"Cordova Tools"}}},gcloud:{friendlyName:"Google GCloud CLI",windowsPath:"%ProgramFiles(x86)%\\Google\\Cloud SDK\\google-cloud-sdk\\bin\\gcloud.cmd",recommendations:{"GoogleCloudTools.cloudcode":{name:"Cloud Code"}}},skaffold:{friendlyName:"Skaffold Code to Cluster",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"}}},minikube:{friendlyName:"MiniKube Local Kubernetes Cluster",recommendations:{"ms-azuretools.vscode-containers":{name:"Docker"},"ms-kubernetes-tools.vscode-kubernetes-tools":{name:"Kubernetes"},"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},podman:{friendlyName:"Podman",recommendations:{"ms-vscode-remote.remote-containers":{name:"Dev Containers"}}},wsl:{friendlyName:"Windows Subsystem for Linux (WSL)",windowsPath:"%WINDIR%\\system32\\lxss\\LxssManager.dll",recommendations:{"ms-vscode-remote.remote-wsl":{name:"WSL"}}}},webExtensionTips:["tyriar.luna-paint","codespaces-contrib.codeswing","ms-vscode.vscode-github-issue-notebooks","esbenp.prettier-vscode","hediet.vscode-drawio"],virtualWorkspaceExtensionTips:{"vscode-vfs":{friendlyName:"Remote Repositories",extensionId:"ms-vscode.remote-repositories",startEntry:{helpLink:"https://aka.ms/vscode-remote/remote-repositories",startConnectLabel:"Remote Repository",startCommand:"remoteHub.continueOn.openRepository",priority:5}}},remoteExtensionTips:{wsl:{friendlyName:"WSL",extensionId:"ms-vscode-remote.remote-wsl",supportedPlatforms:["Windows","Web"],startEntry:{helpLink:"https://aka.ms/vscode-remote/wsl",startConnectLabel:"WSL",startCommand:"remote-wsl.connect",priority:3}},"ssh-remote":{friendlyName:"Remote - SSH",extensionId:"ms-vscode-remote.remote-ssh",supportedPlatforms:["Windows","Linux","Mac"],startEntry:{helpLink:"https://aka.ms/vscode-remote/ssh",startConnectLabel:"SSH ",startCommand:"opensshremotes.openEmptyWindowInCurrentWindow",priority:1}},"dev-container":{friendlyName:"Dev Containers",extensionId:"ms-vscode-remote.remote-containers",supportedPlatforms:["Windows","Linux","Mac"],startEntry:{helpLink:"https://aka.ms/vscode-remote/containers",startConnectLabel:"Dev Container",startCommand:"remote-containers.reopenInContainer",priority:2}},"attached-container":{friendlyName:"Dev Containers",extensionId:"ms-vscode-remote.remote-containers"},codespaces:{friendlyName:"GitHub Codespaces",extensionId:"github.codespaces",startEntry:{helpLink:"https://aka.ms/vscode-remote-codespaces",startConnectLabel:"GitHub Codespace ",startCommand:"github.codespaces.connect",priority:4}},tunnel:{friendlyName:"Remote - Tunnels",extensionId:"ms-vscode.remote-server",startEntry:{helpLink:"https://aka.ms/remote-tunnels-doc",startConnectLabel:"Tunnel",startCommand:"remote-tunnels.connectCurrentWindowToTunnel",priority:0}},amlext:{friendlyName:"Azure Machine Learning",extensionId:"ms-toolsai.vscode-ai-remote"}},commandPaletteSuggestedCommandIds:["workbench.action.files.openFile","workbench.action.files.openFileFolder","workbench.action.files.openFolder","workbench.action.remote.showMenu","editor.action.formatDocument","editor.action.commentLine","workbench.action.tasks.runTask","workbench.action.openSettings2","workbench.action.selectTheme","workbench.action.openWalkthrough","workbench.action.openIssueReporter"],extensionKeywords:{md:["Markdown"],js:["JavaScript"],jsx:["JavaScript"],es6:["JavaScript"],html:["Html"],ts:["TypeScript"],tsx:["TypeScript"],css:["CSS"],scss:["SASS"],txt:["Text"],php:["PHP"],php3:["PHP"],php4:["PHP"],ph3:["PHP"],ph4:["PHP"],xml:["XML"],py:["Python"],pyc:["Python"],pyd:["Python"],pyo:["Python"],pyw:["Python"],pyz:["Python"],java:["Java"],class:["Java"],jar:["Java"],c:["c","objective c","objective-c"],m:["objective c","objective-c"],mm:["objective c","objective-c"],cpp:["cpp","c plus plus","c","c++"],cc:["cpp","c plus plus","c","c++"],cxx:["cpp","c plus plus","c++"],hh:["cpp","c plus plus","c++"],hpp:["cpp","c++"],h:["cpp","c plus plus","c++","c","objective c","objective-c"],sql:["sql"],sh:["bash"],bash:["bash"],zsh:["bash","zshell"],cs:["c#","csharp"],csproj:["c#","csharp"],sln:["c#","csharp"],go:["go"],sty:["latex"],tex:["latex"],ps:["powershell"],ps1:["powershell"],rs:["rust"],rslib:["rust"],hs:["haskell"],lhs:["haskell"],scm:["scheme"],ss:["scheme"],clj:["clojure"],cljs:["clojure"],cljc:["clojure"],edn:["clojure"],erl:["erlang"],hrl:["erlang"],scala:["scala"],sc:["scala"],pl:["perl"],pm:["perl"],t:["perl"],pod:["perl"],groovy:["groovy"],swift:["swift"],rb:["ruby"],rbw:["ruby"],jl:["julia"],f:["fortran"],for:["fortran"],f90:["fortran"],f95:["fortran"],coffee:["CoffeeScript"],litcoffee:["CoffeeScript"],yaml:["yaml"],yml:["yaml"],dart:["dart"],json:["json"]},extensionAllowedBadgeProviders:["api.travis-ci.com","app.fossa.io","badge.buildkite.com","badge.fury.io","badgen.net","badges.frapsoft.com","badges.gitter.im","cdn.travis-ci.com","ci.appveyor.com","circleci.com","cla.opensource.microsoft.com","codacy.com","codeclimate.com","codecov.io","coveralls.io","david-dm.org","deepscan.io","dev.azure.com","docs.rs","flat.badgen.net","gitlab.com","godoc.org","goreportcard.com","img.shields.io","isitmaintained.com","marketplace.visualstudio.com","nodesecurity.io","opencollective.com","snyk.io","travis-ci.com","travis-ci.org","visualstudio.com","vsmarketplacebadge.apphb.com"],extensionAllowedBadgeProvidersRegex:["^https:\\/\\/github\\.com\\/[^/]+\\/[^/]+\\/(actions\\/)?workflows\\/.*badge\\.svg"],crashReporter:{productName:"VSCode",companyName:"Microsoft"},appCenter:{"win32-x64":"appcenter://code-insiders?aid=f047834f-d0e1-4aef-8870-5805ee483b2d","win32-arm64":"appcenter://code-insiders?aid=fb1c1670-432e-43dc-a88e-8c5ed7293213","linux-x64":"appcenter://code-insiders?aid=a04472a4-f4ea-4854-bf12-95bb0f2dd01a",darwin:"appcenter://code-insiders?aid=5e4c15d3-0a3c-4c3b-a294-2a40850616a2","darwin-arm64":"appcenter://code-insiders?aid=d6599f8f-6aee-4013-b47c-1e1269faa19a","darwin-universal":"appcenter://code-insiders?aid=9198980f-302c-4143-9ddf-29914b57be2e"},enableTelemetry:!0,aiConfig:{ariaKey:"5bbf946d11a54f6783919c455abaddaf-fd62977b-c92d-4714-a45d-649d06980372-7168"},msftInternalDomains:["redmond.corp.microsoft.com","northamerica.corp.microsoft.com","fareast.corp.microsoft.com","ntdev.corp.microsoft.com","wingroup.corp.microsoft.com","southpacific.corp.microsoft.com","wingroup.windeploy.ntdev.microsoft.com","ddnet.microsoft.com","europe.corp.microsoft.com"],documentationUrl:"https://go.microsoft.com/fwlink/?LinkID=533484#vscode",serverDocumentationUrl:"https://aka.ms/vscode-server-doc",releaseNotesUrl:"https://go.microsoft.com/fwlink/?LinkId=724002",keyboardShortcutsUrlMac:"https://go.microsoft.com/fwlink/?linkid=832143",keyboardShortcutsUrlLinux:"https://go.microsoft.com/fwlink/?linkid=832144",keyboardShortcutsUrlWin:"https://go.microsoft.com/fwlink/?linkid=832145",introductoryVideosUrl:"https://go.microsoft.com/fwlink/?linkid=832146",tipsAndTricksUrl:"https://go.microsoft.com/fwlink/?linkid=852118",newsletterSignupUrl:"https://www.research.net/r/vsc-newsletter",youTubeUrl:"https://aka.ms/vscode-youtube",requestFeatureUrl:"https://go.microsoft.com/fwlink/?LinkID=533482",reportIssueUrl:"https://github.com/Microsoft/vscode/issues/new",reportMarketplaceIssueUrl:"https://github.com/microsoft/vsmarketplace/issues/new",licenseUrl:"https://go.microsoft.com/fwlink/?LinkID=761088",serverLicenseUrl:"https://aka.ms/vscode-server-license",privacyStatementUrl:"https://go.microsoft.com/fwlink/?LinkId=521839",showTelemetryOptOut:!0,npsSurveyUrl:"https://aka.ms/vscode-nps",checksumFailMoreInfoUrl:"https://go.microsoft.com/fwlink/?LinkId=828886",electronRepository:"Microsoft/vscode-electron-prebuilt",nodejsRepository:"Microsoft/vscode-node",settingsSearchUrl:"https://bingsettingssearch.trafficmanager.net/api/Search",surveys:[{surveyId:"cpp.1",surveyUrl:"https://www.research.net/r/VBVV6C6",languageId:"cpp",editCount:10,userProbability:.15},{surveyId:"java.2",surveyUrl:"https://www.research.net/r/vscodejava",languageId:"java",editCount:10,userProbability:.3},{surveyId:"javascript.1",surveyUrl:"https://www.research.net/r/vscode-js",languageId:"javascript",editCount:10,userProbability:.05},{surveyId:"typescript.1",surveyUrl:"https://www.research.net/r/vscode-ts",languageId:"typescript",editCount:10,userProbability:.05},{surveyId:"csharp.1",surveyUrl:"https://www.research.net/r/8KGJ9V8",languageId:"csharp",editCount:10,userProbability:.1}],extensionsEnabledWithApiProposalVersion:["GitHub.copilot-chat","ms-vscode.vscode-commander","GitHub.vscode-pull-request-github"],extensionEnabledApiProposals:{"mrleemurray.theme-2026":["css"],"ms-azuretools.vscode-containers":["authenticationChallenges"],"ms-azuretools.vscode-azureresourcegroups":["authenticationChallenges"],"ms-azuretools.vscode-azure-github-copilot":["authenticationChallenges"],"ms-azuretools.vscode-dev-azurecloudshell":["contribEditSessions","authenticationChallenges"],"ms-toolsai.vscode-ai":["authenticationChallenges"],"TeamsDevApp.vscode-ai-foundry":["authenticationChallenges"],"ms-vscode.vscode-selfhost-test-provider":["testObserver","testRelatedCode"],"VisualStudioExptTeam.vscodeintellicode-completions":["inlineCompletionsAdditions"],"ms-vsliveshare.vsliveshare":["contribMenuBarHome","contribShareMenu","contribStatusBarItems","diffCommand","documentFiltersExclusive","fileSearchProvider","findTextInFiles","notebookLiveShare","terminalDimensions","terminalDataWriteEvent","textSearchProvider"],"ms-vscode.js-debug":["portsAttributes","findTextInFiles","workspaceTrust","tunnels","browser"],"ms-toolsai.vscode-ai-remote":["resolvers","authenticationChallenges"],"ms-python.python":["codeActionAI","contribEditorContentMenu","quickPickSortByLabel","portsAttributes","testObserver","quickPickItemTooltip","terminalDataWriteEvent","terminalExecuteCommandEvent","notebookReplDocument","notebookVariableProvider","terminalShellEnv"],"ms-python.vscode-python-envs":["terminalShellEnv","terminalDataWriteEvent","taskExecutionTerminal"],"ms-dotnettools.dotnet-interactive-vscode":["notebookMessaging"],"GitHub.codespaces":["contribEditSessions","contribMenuBarHome","contribRemoteHelp","contribViewsRemote","resolvers","tunnels","terminalDataWriteEvent","treeViewReveal","notebookKernelSource"],"ms-vscode.azure-repos":["extensionRuntime","fileSearchProvider","textSearchProvider"],"ms-vscode.remote-repositories":["canonicalUriProvider","contribEditSessions","contribRemoteHelp","contribMenuBarHome","contribViewsRemote","contribViewsWelcome","contribShareMenu","documentFiltersExclusive","editSessionIdentityProvider","extensionRuntime","fileSearchProvider","quickPickSortByLabel","workspaceTrust","shareProvider","scmActionButton","scmSelectedProvider","scmValidation","textSearchProvider","timeline"],"ms-vscode-remote.remote-wsl":["resolvers","contribRemoteHelp","contribViewsRemote","telemetry"],"ms-vscode-remote.remote-ssh":["resolvers","tunnels","terminalDataWriteEvent","contribRemoteHelp","contribViewsRemote","telemetry"],"ms-vscode.remote-server":["resolvers","tunnels","contribViewsWelcome"],"ms-vscode.remote-explorer":["contribRemoteHelp","contribViewsRemote","extensionsAny"],"ms-vscode-remote.remote-containers":["contribEditSessions","resolvers","portsAttributes","tunnels","workspaceTrust","terminalDimensions","contribRemoteHelp","contribViewsRemote"],"ms-vscode.js-debug-nightly":["portsAttributes","findTextInFiles","workspaceTrust","tunnels","browser"],"ms-vscode.lsif-browser":["documentFiltersExclusive"],"ms-vscode.vscode-speech":["speech"],"GitHub.vscode-pull-request-github":["activeComment","chatContextProvider","chatParticipantAdditions","chatParticipantPrivate","chatSessionsProvider","codiconDecoration","codeActionRanges","commentingRangeHint","commentReactor","commentReveal","commentsDraftState","commentThreadApplicability","contribAccessibilityHelpContent","contribCommentEditorActionsMenu","contribCommentPeekContext","contribCommentThreadAdditionalMenu","contribCommentsViewThreadMenus","contribEditorContentMenu","contribMultiDiffEditorMenus","contribShareMenu","diffCommand","languageModelToolResultAudience","markdownAlertSyntax","quickDiffProvider","remoteCodingAgents","shareProvider","tabInputMultiDiff","tabInputTextMerge","tokenInformation","treeItemMarkdownLabel","treeViewMarkdownMessage"],"GitHub.copilot":["inlineCompletionsAdditions","interactive","terminalDataWriteEvent","devDeviceId"],"GitHub.copilot-nightly":["inlineCompletionsAdditions","interactive","terminalDataWriteEvent","devDeviceId"],"GitHub.copilot-chat":["agentSessionsWorkspace","agentsWindowConfiguration","interactive","terminalDataWriteEvent","terminalExecuteCommandEvent","terminalSelection","terminalQuickFixProvider","chatParticipantAdditions","defaultChatParticipant","embeddings","chatProvider","mappedEditsProvider","aiRelatedInformation","aiSettingsSearch","codeActionAI","findTextInFiles","findTextInFiles2","textSearchProvider","textSearchProvider2","activeComment","commentReveal","contribSourceControlInputBoxMenu","contribCommentEditorActionsMenu","contribCommentThreadAdditionalMenu","contribCommentsViewThreadMenus","contribChatEditorInlineGutterMenu","extensionAffinity","newSymbolNamesProvider","findFiles2","chatReferenceDiagnostic","extensionsAny","authLearnMore","testObserver","aiTextSearchProvider","documentFiltersExclusive","chatParticipantPrivate","contribDebugCreateConfiguration","inlineCompletionsAdditions","chatReferenceBinaryData","languageModelSystem","languageModelCapabilities","languageModelThinkingPart","languageModelToolSupportsModel","chatStatusItem","taskProblemMatcherStatus","contribLanguageModelToolSets","textDocumentChangeReason","resolvers","taskExecutionTerminal","dataChannels","chatSessionsProvider","chatSessionCustomizationProvider","devDeviceId","contribEditorContentMenu","tokenInformation","toolInvocationApproveCombination","chatPromptFiles","mcpServerDefinitions","tabInputMultiDiff","workspaceTrust","chatHooks","chatDebug","environmentPower","terminalTitle","languageModelPricing","chatInputNotification"],"GitHub.remotehub":["contribRemoteHelp","contribMenuBarHome","contribViewsRemote","contribViewsWelcome","documentFiltersExclusive","extensionRuntime","fileSearchProvider","quickPickSortByLabel","workspaceTrust","scmSelectedProvider","scmValidation","textSearchProvider","timeline"],"ms-python.vscode-pylance":["terminalShellEnv","portsAttributes","codeActionAI"],"ms-python.debugpy":["contribViewsWelcome","debugVisualization","portsAttributes"],"ms-toolsai.jupyter-renderers":["contribNotebookStaticPreloads"],"ms-toolsai.jupyter":["notebookDeprecated","notebookMessaging","notebookMime","portsAttributes","quickPickSortByLabel","notebookKernelSource","interactiveWindow","notebookControllerAffinityHidden","contribNotebookStaticPreloads","quickPickItemTooltip","notebookExecution","notebookCellExecution","notebookVariableProvider","notebookReplDocument"],"donjayamanne.kusto":["notebookVariableProvider"],"ms-toolsai.tensorboard":["portsAttributes"],"dbaeumer.vscode-eslint":[],"ms-vscode.azure-sphere-tools-ui":["tunnels"],"ms-azuretools.vscode-azureappservice":["terminalDataWriteEvent"],"ms-vscode.anycode":["extensionsAny"],"ms-vscode.cpptools":["terminalDataWriteEvent","chatParticipantAdditions"],"ms-dotnettools.csdevkit":["inlineCompletionsAdditions"],"ms-dotnettools.vscodeintellicode-csharp":["inlineCompletionsAdditions"],"ms-dotnettools.vscode-dotnet-modernize":["chatParticipantAdditions","chatPromptFiles"],"microsoft-IsvExpTools.powerplatform-vscode":["fileSearchProvider","textSearchProvider"],"microsoft-IsvExpTools.powerplatform-vscode-preview":["fileSearchProvider","textSearchProvider"],"TeamsDevApp.ms-teams-vscode-extension":["chatParticipantAdditions","languageModelSystem","mcpServerDefinitions"],"ms-vscode.vscode-copilot-vision":["chatReferenceBinaryData","codeActionAI"],"ms-autodev.vscode-autodev":["chatParticipantAdditions"],"codetrek.haystack-search":["fileSearchProvider","textSearchProvider2"],"vscjava.migrate-java-to-azure":["chatParticipantAdditions","chatParticipantPrivate"],"vscjava.vscode-java-upgrade":["chatParticipantAdditions","chatParticipantPrivate"],"FoundryLocal.foundry-local-chat":["chatProvider"],"Microsoft.foundry-local-chat":["chatProvider"],"ms-wmcp.windows-mcp-server-extension":["mcpToolDefinitions"],"openai.chatgpt":["languageModelProxy","chatSessionsProvider"],"TypeScriptTeam.native-preview":["editorHoverVerbosityLevel","multiDocumentHighlightProvider"],"ms-vscode.vscode-eng-codereview":["chatContextProvider"],"ms-vscode.vscode-chat-customizations-evaluations":["chatSessionCustomizationProvider","contribEditorContentMenu"]},tasConfig:{endpoint:"https://default.exp-tas.com/vscode/ab",telemetryEventName:"query-expfeature",assignmentContextTelemetryPropertyName:"abexp.assignmentcontext"},extensionKind:{"Shan.code-settings-sync":["ui"],"shalldie.background":["ui"],"techer.open-in-browser":["ui"],"CoenraadS.bracket-pair-colorizer-2":["ui"],"CoenraadS.bracket-pair-colorizer":["ui","workspace"],"hiro-sun.vscode-emacs":["ui","workspace"],"hnw.vscode-auto-open-markdown-preview":["ui","workspace"],"wayou.vscode-todo-highlight":["ui","workspace"],"aaron-bond.better-comments":["ui","workspace"],"vscodevim.vim":["ui"],"ollyhayes.colmak-vim":["ui"]},extensionPointExtensionKind:{typescriptServerPlugins:["workspace"]},extensionSyncedKeys:{"ritwickdey.liveserver":["liveServer.setup.version"]},extensionVirtualWorkspacesSupport:{"esbenp.prettier-vscode":{default:!1},"msjsdiag.debugger-for-chrome":{default:!1},"redhat.java":{default:!1},"HookyQR.beautify":{default:!1},"ritwickdey.LiveServer":{default:!1},"VisualStudioExptTeam.vscodeintellicode":{default:!1},"octref.vetur":{default:!1},"formulahendry.code-runner":{default:!1},"xdebug.php-debug":{default:!1},"ms-mssql.mssql":{default:!1},"christian-kohler.path-intellisense":{default:!1},"eg2.tslint":{default:!1},"eg2.vscode-npm-script":{default:!1},"donjayamanne.githistory":{default:!1},"Zignd.html-css-class-completion":{default:!1},"christian-kohler.npm-intellisense":{default:!1},"EditorConfig.EditorConfig":{default:!1},"austin.code-gnu-global":{default:!1},"johnpapa.Angular2":{default:!1},"ms-vscode.vscode-typescript-tslint-plugin":{default:!1},"DotJoshJohnson.xml":{default:!1},"techer.open-in-browser":{default:!1},"tht13.python":{default:!1},"bmewburn.vscode-intelephense-client":{default:!1},"Angular.ng-template":{default:!1},"xdebug.php-pack":{default:!1},"dbaeumer.jshint":{default:!1},"yzhang.markdown-all-in-one":{default:!1},"Dart-Code.flutter":{default:!1},"streetsidesoftware.code-spell-checker":{default:!1},"rebornix.Ruby":{default:!1},"ms-vscode.sublime-keybindings":{default:!1},"mitaki28.vscode-clang":{default:!1},"steoates.autoimport":{default:!1},"donjayamanne.python-extension-pack":{default:!1},"shd101wyy.markdown-preview-enhanced":{default:!1},"mikestead.dotenv":{default:!1},"pranaygp.vscode-css-peek":{default:!1},"ikappas.phpcs":{default:!1},"platformio.platformio-ide":{default:!1},"jchannon.csharpextensions":{default:!1},"gruntfuggly.todo-tree":{default:!1}},linkProtectionTrustedDomains:["https://*.visualstudio.com","https://*.microsoft.com","https://aka.ms","https://*.gallerycdn.vsassets.io","https://*.github.com","https://login.microsoftonline.com","https://*.vscode.dev","https://*.github.dev","https://gh.io","https://portal.azure.com","https://raw.githubusercontent.com","https://private-user-images.githubusercontent.com","https://avatars.githubusercontent.com","https://auth.openai.com"],trustedExtensionAuthAccess:{github:["vscode.github","github.remotehub","ms-vscode.remote-server","github.vscode-pull-request-github","github.codespaces","github.copilot","github.copilot-chat","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot"],"github-enterprise":["vscode.github","github.remotehub","ms-vscode.remote-server","github.vscode-pull-request-github","github.codespaces","github.copilot","github.copilot-chat","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot"],microsoft:["github.copilot-chat","ms-vscode.azure-repos","ms-vscode.remote-server","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot","ms-azuretools.vscode-azureresourcegroups","ms-azuretools.vscode-dev-azurecloudshell","ms-edu.vscode-learning","ms-toolsai.vscode-ai","ms-toolsai.vscode-ai-remote"],"microsoft-sovereign-cloud":["ms-vscode.azure-repos","ms-vscode.remote-server","ms-vsliveshare.vsliveshare","ms-azuretools.vscode-azure-github-copilot","ms-azuretools.vscode-azureresourcegroups","ms-azuretools.vscode-dev-azurecloudshell","ms-edu.vscode-learning","ms-toolsai.vscode-ai","ms-toolsai.vscode-ai-remote"],"__GitHub.copilot-chat":["ms-azuretools.vscode-azure-github-copilot","github.vscode-pull-request-github"]},trustedExtensionProtocolHandlers:["vscode.git","vscode.github-authentication","vscode.microsoft-authentication","github.vscode-pull-request-github"],authClientIdMetadataUrl:"https://vscode.dev/oauth/client-metadata.json",inheritAuthAccountPreference:{"github.copilot":["github.copilot-chat"]},auth:{loginUrl:"https://login.microsoftonline.com/common/oauth2/authorize",tokenUrl:"https://login.microsoftonline.com/common/oauth2/token",redirectUrl:"https://vscode-redirect.azurewebsites.net/",clientId:"aebc6443-996d-45c2-90f0-388ff96faa56"},"configurationSync.store":{url:"https://vscode-sync-insiders.trafficmanager.net/",stableUrl:"https://vscode-sync.trafficmanager.net/",insidersUrl:"https://vscode-sync-insiders.trafficmanager.net/",canSwitch:!0,authenticationProviders:{github:{scopes:["user:email"]},microsoft:{scopes:["openid","profile","email","offline_access"]}}},enableSyncingProfiles:!0,"editSessions.store":{url:"https://vscode-sync.trafficmanager.net/",authenticationProviders:{microsoft:{scopes:["openid","profile","email","offline_access"]},github:{scopes:["user:email"]}}},tunnelServerQualities:{stable:{serverApplicationName:"code-server"},exploration:{serverApplicationName:"code-server-exploration"},insider:{serverApplicationName:"code-server-insiders"}},tunnelApplicationName:"code-tunnel-insiders",tunnelApplicationConfig:{editorWebUrl:"https://insiders.vscode.dev",extension:{friendlyName:"Remote - Tunnels",extensionId:"ms-vscode.remote-server"},authenticationProviders:{github:{scopes:["user:email","read:org"]},microsoft:{scopes:["46da2f7e-b5ef-422a-88d4-2a7f9de6a0b2/.default","profile","openid"]}}},win32TunnelServiceMutex:"vscodeinsiders-tunnelservice",win32TunnelMutex:"vscodeinsiders-tunnel",aiGeneratedWorkspaceTrust:{title:"This workspace was generated by GitHub Copilot",checkboxText:"Trust the contents of all files in this workspace",trustOption:"Yes, I trust the contents",dontTrustOption:"No, I don't trust the contents",startupTrustRequestLearnMore:"If you don't trust the contents of the files generated by GitHub Copilot, we recommend continuing in restricted mode. See [our docs](https://aka.ms/vscode-workspace-trust) to learn more. "},defaultChatAgent:{providerExtensionId:"vscode.github-authentication",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",publicCodeMatchesUrl:"https://aka.ms/github-copilot-match-public-code",manageSettingsUrl:"https://aka.ms/github-copilot-settings",managePlanUrl:"https://aka.ms/github-copilot-manage-plan",manageOverageUrl:"https://aka.ms/github-copilot-manage-overage",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.com"},google:{id:"google",name:"Google"},apple:{id:"apple",name:"Apple"}},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"},chatParticipantRegistry:"https://main.vscode-cdn.net/extensions/chat.json",remoteDefaultExtensionsIfInstalledLocally:["GitHub.copilot","GitHub.copilot-chat","GitHub.vscode-pull-request-github"],extensionConfigurationPolicy:{"github.copilot.nextEditSuggestions.enabled":{name:"CopilotNextEditSuggestions",minimumVersion:"1.99",category:"InteractiveSession",description:"Whether to enable next edit suggestions (NES). NES can propose a next edit based on your recent changes."},"github.copilot.chat.reviewSelection.enabled":{name:"CopilotReviewSelection",minimumVersion:"1.104",category:"InteractiveSession",description:"Enables code review on current selection."},"github.copilot.chat.reviewAgent.enabled":{name:"CopilotReviewAgent",minimumVersion:"1.104",category:"InteractiveSession",description:"Enables the code review agent."},"github.copilot.chat.claudeAgent.enabled":{name:"Claude3PIntegration",minimumVersion:"1.113",category:"InteractiveSession",description:"Enable Claude Agent sessions in VS Code. Start and resume agentic coding sessions powered by Anthropic Claude Agent SDK directly in the editor. Uses your existing Copilot subscription."}},win32ContextMenu:{x64:{clsid:"799F4F7E-5934-4001-A74C-E207F44F05B8"},arm64:{clsid:"7D34756D-32DD-4EE6-B99F-2691C0DAD875"}},chatSessionRecommendations:[{extensionId:"openai.chatgpt",extensionName:"Codex - OpenAI's coding agent",displayName:"Codex Agent",name:"codex",description:"Codex is OpenAI's coding agent that helps you write, review, and ship code faster.",postInstallCommand:"chatgpt.newCodexPanel"},{extensionId:"GitHub.copilot-chat",extensionName:"GitHub Copilot Chat",displayName:"Background Agent",name:"cli",description:"Delegate tasks to a background agent.",postInstallCommand:"workbench.action.chat.openNewSessionSidebar.copilotcli"},{extensionId:"GitHub.copilot-chat",extensionName:"GitHub Copilot Chat",displayName:"Cloud Agent",name:"cloud",description:"Delegate tasks to the GitHub Copilot Cloud Agent. The agent works asynchronously in the cloud to implement changes, iterates via chat, and can create or update pull requests as needed.",postInstallCommand:"workbench.action.chat.openNewSessionSidebar.copilot-cloud-agent"}],builtInExtensionsEnabledWithAutoUpdates:["GitHub.copilot-chat"],sessionsWindowAllowedExtensions:["pkief.material-icon-theme","zhuangtongfa.material-theme","vscode-icons-team.vscode-icons","oderwat.indent-rainbow","formulahendry.auto-close-tag","pranaygp.vscode-css-peek","codezombiech.gitignore","usernamehw.errorlens","wayou.vscode-todo-highlight","bierner.markdown-mermaid","kisstkondoros.vscode-gutter-preview","tomoki1207.pdf","vscodevim.vim","ecmel.vscode-html-css","bradlc.vscode-tailwindcss","xabikos.JavaScriptSnippets","dsznajder.es7-react-js-snippets","formulahendry.auto-rename-tag","naumovs.color-highlight","streetsidesoftware.code-spell-checker","Vue.volar","dbaeumer.vscode-eslint","esbenp.prettier-vscode","redhat.vscode-xml","redhat.java"],version:"1.121.0-insider",commit:"f6cfa2ea2403534de03f069bdf160d06451ed282",date:"2026-05-19T11:51:53+02:00"},Object.keys(WL).length===0&&Object.assign(WL,{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 $i=WL;var $t={Configuration:"base.contributions.configuration"};function iri(a,i){return a===i?!0:!a||!i?!1:typeof a=="string"||typeof i=="string"?a===i:a.id===i.id}var Ay={properties:{},patternProperties:{}},iCe={properties:{},patternProperties:{}},oCe={properties:{},patternProperties:{}},fce={properties:{},patternProperties:{}},Vz={properties:{},patternProperties:{}},Bz={properties:{},patternProperties:{}},SF={properties:{},patternProperties:{}},h5="vscode://schemas/settings/resourceLanguage",PSt="vscode://schemas/settings/configurationDefaults",MSt=oe.as(Ta.JSONContribution),tri=class extends k{constructor(){super();this.registeredConfigurationDefaults=[];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:d(2098,null),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},MSt.registerSchema(h5,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){return this.registerConfigurations([e],t),e}registerConfigurations(e,t=!0){let o=new Set;this.doRegisterConfigurations(e,t,o),MSt.registerSchema(h5,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}deregisterConfigurations(e){let t=new Set;this.doDeregisterConfigurations(e,t),MSt.registerSchema(h5,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t})}updateConfigurations({add:e,remove:t}){let o=new Set;this.doDeregisterConfigurations(t,o),this.doRegisterConfigurations(e,!1,o),MSt.registerSchema(h5,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:o})}registerDefaultConfigurations(e){let t=new Set;this.doRegisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,t){this.registeredConfigurationDefaults.push(...e);let o=[];for(let{overrides:n,source:r}of e)for(let s in n){t.add(s);let l=this.configurationDefaultsOverrides.get(s)??this.configurationDefaultsOverrides.set(s,{configurationDefaultOverrides:[]}).get(s),c=n[s];if(l.configurationDefaultOverrides.push({value:c,source:r}),af.test(s)){let u=this.mergeDefaultConfigurationsForOverrideIdentifier(s,c,r,l.configurationDefaultOverrideValue);if(!u)continue;l.configurationDefaultOverrideValue=u,this.updateDefaultOverrideProperty(s,u,r),o.push(...Hz(s))}else{let u=this.mergeDefaultConfigurationsForConfigurationProperty(s,c,r,l.configurationDefaultOverrideValue);if(!u)continue;l.configurationDefaultOverrideValue=u;let p=this.configurationProperties[s];p&&(this.updatePropertyDefaultValue(s,p),this.updateSchema(s,p))}}this.doRegisterOverrideIdentifiers(o)}deregisterDefaultConfigurations(e){let t=new Set;this.doDeregisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doDeregisterDefaultConfigurations(e,t){for(let o of e){let n=this.registeredConfigurationDefaults.indexOf(o);n!==-1&&this.registeredConfigurationDefaults.splice(n,1)}for(let{overrides:o,source:n}of e)for(let r in o){let s=this.configurationDefaultsOverrides.get(r);if(!s)continue;let l=s.configurationDefaultOverrides.findIndex(c=>n?iri(c.source,n):c.value===o[r]);if(l!==-1){if(s.configurationDefaultOverrides.splice(l,1),s.configurationDefaultOverrides.length===0&&this.configurationDefaultsOverrides.delete(r),af.test(r)){let c;for(let u of s.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForOverrideIdentifier(r,u.value,u.source,c);c&&!dv(c.value)?(s.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(r,c,n)):(this.configurationDefaultsOverrides.delete(r),delete this.configurationProperties[r],delete this.defaultLanguageConfigurationOverridesNode.properties[r])}else{let c;for(let p of s.configurationDefaultOverrides)c=this.mergeDefaultConfigurationsForConfigurationProperty(r,p.value,p.source,c);s.configurationDefaultOverrideValue=c;let u=this.configurationProperties[r];u&&(this.updatePropertyDefaultValue(r,u),this.updateSchema(r,u))}t.add(r)}}this.updateOverridePropertyPatternKey()}updateDefaultOverrideProperty(e,t,o){let n={section:{id:this.defaultLanguageConfigurationOverridesNode.id,title:this.defaultLanguageConfigurationOverridesNode.title,order:this.defaultLanguageConfigurationOverridesNode.order,extensionInfo:this.defaultLanguageConfigurationOverridesNode.extensionInfo},type:"object",default:t.value,description:d(2097,null,eCe(e)),$ref:h5,defaultDefaultValue:t.value,source:o,defaultValueSource:o};this.configurationProperties[e]=n,this.defaultLanguageConfigurationOverridesNode.properties[e]=n}mergeDefaultConfigurationsForOverrideIdentifier(e,t,o,n){let r=n?.value||{},s=n?.source??new Map;if(!(s instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(let l of Object.keys(t)){let c=t[l];if(Di(c)&&(bn(r[l])||Di(r[l]))){if(r[l]={...r[l]??{},...c},o)for(let p in c)s.set(`${l}.${p}`,o)}else r[l]=c,o?s.set(l,o):s.delete(l)}return{value:r,source:s}}mergeDefaultConfigurationsForConfigurationProperty(e,t,o,n){let r=this.configurationProperties[e],s=n?.value??r?.defaultDefaultValue,l=o;if(Di(t)&&(r!==void 0&&r.type==="object"||r===void 0&&(bn(s)||Di(s)))){if(l=n?.source??new Map,!(l instanceof Map)){console.error("defaultValueSource is not a Map");return}for(let u in t)o&&l.set(`${e}.${u}`,o);t={...Di(s)?s:{},...t}}return{value:t,source:l}}deltaConfiguration(e){let t=!1,o=new Set;e.removedDefaults&&(this.doDeregisterDefaultConfigurations(e.removedDefaults,o),t=!0),e.addedDefaults&&(this.doRegisterDefaultConfigurations(e.addedDefaults,o),t=!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:t})}notifyConfigurationSchemaUpdated(...e){this._onDidSchemaChange.fire()}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(let t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t,o){e.forEach(n=>{this.validateAndRegisterProperties(n,t,n.extensionInfo,n.restrictedProperties,void 0,o),this.configurationContributors.push(n),this.registerJSONConfiguration(n)})}doDeregisterConfigurations(e,t){let o=n=>{if(n.properties)for(let r in n.properties){t.add(r);let s=this.configurationProperties[r];s?.policy?.name&&this.policyConfigurations.delete(s.policy.name),delete this.configurationProperties[r],this.removeFromSchema(r,n.properties[r])}n.allOf?.forEach(r=>o(r))};for(let n of e){o(n);let r=this.configurationContributors.indexOf(n);r!==-1&&this.configurationContributors.splice(r,1)}}validateAndRegisterProperties(e,t=!0,o,n,r=4,s){r=mr(e.scope)?r:e.scope;let l=e.properties;if(l)for(let u in l){let p=l[u];if(p.section={id:e.id,title:e.title,order:e.order,extensionInfo:e.extensionInfo},t&&ori(u,p,o?.id)){delete l[u];continue}p.source=o,p.defaultDefaultValue=l[u].default,this.updatePropertyDefaultValue(u,p),af.test(u)?p.scope=void 0:(p.scope=mr(p.scope)?r:p.scope,p.restricted=mr(p.restricted)?!!n?.includes(u):p.restricted),p.experiment?p.tags?.some(f=>f.toLowerCase()==="onexp")||(p.tags=p.tags??[],p.tags.push("onExP")):p.tags?.some(f=>f.toLowerCase()==="onexp")&&(console.error(`Invalid tag 'onExP' found for property '${u}'. Please use 'experiment' property instead.`),p.experiment={mode:"startup"});let h=l[u].hasOwnProperty("included")&&!l[u].included,g=l[u].policy?.name;h?(this.excludedConfigurationProperties[u]=l[u],g&&(this.policyConfigurations.set(g,u),s.add(u)),delete l[u]):(s.add(u),g&&this.policyConfigurations.set(g,u),this.configurationProperties[u]=l[u],!l[u].deprecationMessage&&l[u].markdownDeprecationMessage&&(l[u].deprecationMessage=l[u].markdownDeprecationMessage))}let c=e.allOf;if(c)for(let u of c)this.validateAndRegisterProperties(u,t,o,n,r,s)}getConfigurations(){return this.configurationContributors}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}getExcludedConfigurationProperties(){return this.excludedConfigurationProperties}getRegisteredDefaultConfigurations(){return[...this.registeredConfigurationDefaults]}getConfigurationDefaultsOverrides(){let e=new Map;for(let[t,o]of this.configurationDefaultsOverrides)o.configurationDefaultOverrideValue&&e.set(t,o.configurationDefaultOverrideValue);return e}registerJSONConfiguration(e){let t=o=>{let n=o.properties;if(n)for(let s in n)this.updateSchema(s,n[s]);o.allOf?.forEach(t)};t(e)}updateSchema(e,t){switch(Ay.properties[e]=t,t.scope){case 1:iCe.properties[e]=t;break;case 2:fce.properties[e]=t;break;case 3:oCe.properties[e]=t;break;case 7:Vz.properties[e]=t;break;case 4:Bz.properties[e]=t;break;case 5:SF.properties[e]=t;break;case 6:SF.properties[e]=t,this.resourceLanguageSettingsSchema.properties[e]=t;break}}removeFromSchema(e,t){switch(delete Ay.properties[e],t.scope){case 1:delete iCe.properties[e];break;case 2:delete fce.properties[e];break;case 3:delete oCe.properties[e];break;case 7:delete Vz.properties[e];break;case 4:delete Bz.properties[e];break;case 5:case 6:delete SF.properties[e],delete this.resourceLanguageSettingsSchema.properties[e];break}}updateOverridePropertyPatternKey(){for(let e of this.overrideIdentifiers.values()){let t=`[${e}]`,o={type:"object",description:d(2099,null),errorMessage:d(2100,null),$ref:h5};this.updatePropertyDefaultValue(t,o),Ay.properties[t]=o,iCe.properties[t]=o,oCe.properties[t]=o,fce.properties[t]=o,Vz.properties[t]=o,Bz.properties[t]=o,SF.properties[t]=o}}registerOverridePropertyPatternKey(){let e={type:"object",description:d(2099,null),errorMessage:d(2100,null),$ref:h5};Ay.patternProperties[Wz]=e,iCe.patternProperties[Wz]=e,oCe.patternProperties[Wz]=e,fce.patternProperties[Wz]=e,Vz.patternProperties[Wz]=e,Bz.patternProperties[Wz]=e,SF.patternProperties[Wz]=e,this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){let o=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue,n,r;o&&(!t.disallowConfigurationDefault||!o.source)&&(n=o.value,r=o.source),bn(n)&&(n=t.defaultDefaultValue,r=void 0),bn(n)&&(n=i3e(t.type)),t.default=n,t.defaultValueSource=r}},C6i="\\[([^\\]]+)\\]",w6i=new RegExp(C6i,"g"),Wz=`^(${C6i})+$`,af=new RegExp(Wz);function Hz(a){let i=[];if(af.test(a)){let e=w6i.exec(a);for(;e?.length;){let t=e[1].trim();t&&i.push(t),e=w6i.exec(a)}}return jo(i)}function ASt(a){return a.reduce((i,e)=>`${i}[${e}]`,"")}function i3e(a){switch(Array.isArray(a)?a[0]:a){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}var t3e=new tri;oe.add($t.Configuration,t3e);function ori(a,i,e){return a.trim()?af.test(a)?d(2096,null,a):t3e.getConfigurationProperties()[a]!==void 0&&(!e||!nri.has(e.toLowerCase()))?d(2094,null,a):i.policy?.name&&t3e.getPolicyConfigurations().get(i.policy?.name)!==void 0?d(2093,null,a,i.policy?.name,t3e.getPolicyConfigurations().get(i.policy?.name)):null:d(2095,null)}function x6i(){let a=[],i=t3e.getConfigurationProperties();for(let e of Object.keys(i))a.push([e,i[e].scope]);return a.push(["launch",5]),a.push(["task",5]),a}function NSt(a){let i={};for(let e of a){let t=e.properties;if(Di(t))for(let o in t)i[o]=t[o];e.allOf&&Object.assign(i,NSt(e.allOf))}return i}function OSt(a){switch(a){case"application":return 1;case"machine":return 2;case"resource":return 5;case"machine-overridable":return 7;case"language-overridable":return 6;default:return 4}}var nri=new Set($i.defaultChatAgent?[$i.defaultChatAgent.extensionId,$i.defaultChatAgent.chatExtensionId].map(a=>a.toLowerCase()):[]);var c2o={ModesRegistry:"editor.modesRegistry"},rri=class extends k{constructor(){super();this._onDidChangeLanguages=this._register(new T);this.onDidChangeLanguages=this._onDidChangeLanguages.event;this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,o=this._languages.length;t<o;t++)if(this._languages[t]===e){this._languages.splice(t,1);return}}}}getLanguages(){return this._languages}},CA=new rri;oe.add(c2o.ModesRegistry,CA);var es="plaintext",o3e=".txt";CA.registerLanguage({id:es,extensions:[o3e],aliases:[d(920,null),"text"],mimetypes:[cr.text]});oe.as($t.Configuration).registerDefaultConfigurations([{overrides:{"[plaintext]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1},"[go]":{"editor.insertSpaces":!1},"[makefile]":{"editor.insertSpaces":!1},"[shellscript]":{"files.eol":`
`},"[yaml]":{"editor.insertSpaces":!0,"editor.tabSize":2}}}]);var FSt=class{constructor(i,e){this.languageId=i;let t=e.brackets?k6i(e.brackets):[],o=new xy(s=>{let l=new Set;return{info:new sri(this,s,l),closing:l}}),n=new xy(s=>{let l=new Set,c=new Set;return{info:new ari(this,s,l,c),opening:l,openingColorized:c}});for(let[s,l]of t){let c=o.get(s),u=n.get(l);c.closing.add(u.info),u.opening.add(c.info)}let r=e.colorizedBracketPairs?k6i(e.colorizedBracketPairs):t.filter(s=>!(s[0]==="<"&&s[1]===">"));for(let[s,l]of r){let c=o.get(s),u=n.get(l);c.closing.add(u.info),u.openingColorized.add(c.info),u.opening.add(c.info)}this._openingBrackets=new Map([...o.cachedValues].map(([s,l])=>[s,l.info])),this._closingBrackets=new Map([...n.cachedValues].map(([s,l])=>[s,l.info]))}get openingBrackets(){return[...this._openingBrackets.values()]}get closingBrackets(){return[...this._closingBrackets.values()]}getOpeningBracketInfo(i){return this._openingBrackets.get(i)}getClosingBracketInfo(i){return this._closingBrackets.get(i)}getBracketInfo(i){return this.getOpeningBracketInfo(i)||this.getClosingBracketInfo(i)}getBracketRegExp(i){let e=Array.from([...this._openingBrackets.keys(),...this._closingBrackets.keys()]);return Zwe(e,i)}};function k6i(a){return a.filter(([i,e])=>i!==""&&e!=="")}var WSt=class{constructor(i,e){this.config=i;this.bracketText=e}get languageId(){return this.config.languageId}},sri=class extends WSt{constructor(e,t,o){super(e,t);this.openedBrackets=o;this.isOpeningBracket=!0}},ari=class extends WSt{constructor(e,t,o,n){super(e,t);this.openingBrackets=o;this.openingColorizedBrackets=n;this.isOpeningBracket=!1}closes(e){return e.config!==this.config?!1:this.openingBrackets.has(e)}closesColorized(e){return e.config!==this.config?!1:this.openingColorizedBrackets.has(e)}getOpeningBrackets(){return[...this.openingBrackets]}};var r3e=class{constructor(i){this.languageId=i}affects(i){return this.languageId?this.languageId===i:!0}},Us=le("languageConfigurationService"),n3e=class extends k{constructor(e,t){super();this.configurationService=e;this.languageService=t;this._registry=this._register(new dri);this.onDidChangeEmitter=this._register(new T);this.onDidChange=this.onDidChangeEmitter.event;this.configurations=new Map;let o=new Set(Object.values(lri));this._register(this.configurationService.onDidChangeConfiguration(n=>{let r=n.change.keys.some(l=>o.has(l)),s=n.change.overrides.filter(([l,c])=>c.some(u=>o.has(u))).map(([l])=>l);if(r)this.configurations.clear(),this.onDidChangeEmitter.fire(new r3e(void 0));else for(let l of s)this.languageService.isRegisteredLanguageId(l)&&(this.configurations.delete(l),this.onDidChangeEmitter.fire(new r3e(l)))})),this._register(this._registry.onDidChange(n=>{this.configurations.delete(n.languageId),this.onDidChangeEmitter.fire(new r3e(n.languageId))}))}register(e,t,o){return this._registry.register(e,t,o)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=d2o(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};n3e=I([m(0,B),m(1,Rt)],n3e);function d2o(a,i,e,t){let o=i.getLanguageConfiguration(a);if(!o){if(!t.isRegisteredLanguageId(a))return new nCe(a,{});o=new nCe(a,{})}let n=u2o(o.languageId,e),r=T6i([o.underlyingConfig,n]);return new nCe(o.languageId,r)}var lri={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function u2o(a,i){let e=i.getValue(lri.brackets,{overrideIdentifier:a}),t=i.getValue(lri.colorizedBracketPairs,{overrideIdentifier:a});return{brackets:E6i(e),colorizedBracketPairs:E6i(t)}}function E6i(a){if(Array.isArray(a))return a.map(i=>{if(!(!Array.isArray(i)||i.length!==2))return[i[0],i[1]]}).filter(i=>!!i)}function HSt(a,i,e){let t=a.getLineContent(i),o=Ul(t);return o.length>e-1&&(o=o.substring(0,e-1)),o}var cri=class{constructor(i){this.languageId=i;this._resolved=null;this._entries=[],this._order=0,this._resolved=null}register(i,e){let t=new VSt(i,e,++this._order);return this._entries.push(t),this._resolved=null,bp(ee(()=>{for(let o=0;o<this._entries.length;o++)if(this._entries[o]===t){this._entries.splice(o,1),this._resolved=null;break}}))}getResolvedConfiguration(){if(!this._resolved){let i=this._resolve();i&&(this._resolved=new nCe(this.languageId,i))}return this._resolved}_resolve(){return this._entries.length===0?null:(this._entries.sort(VSt.cmp),T6i(this._entries.map(i=>i.configuration)))}};function T6i(a){let i={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(let e of a)i={comments:e.comments||i.comments,brackets:e.brackets||i.brackets,wordPattern:e.wordPattern||i.wordPattern,indentationRules:e.indentationRules||i.indentationRules,onEnterRules:e.onEnterRules||i.onEnterRules,autoClosingPairs:e.autoClosingPairs||i.autoClosingPairs,surroundingPairs:e.surroundingPairs||i.surroundingPairs,autoCloseBefore:e.autoCloseBefore||i.autoCloseBefore,folding:e.folding||i.folding,colorizedBracketPairs:e.colorizedBracketPairs||i.colorizedBracketPairs,__electricCharacterSupport:e.__electricCharacterSupport||i.__electricCharacterSupport};return i}var VSt=class{constructor(i,e,t){this.configuration=i;this.priority=e;this.order=t}static cmp(i,e){return i.priority===e.priority?i.order-e.order:i.priority-e.priority}},BSt=class{constructor(i){this.languageId=i}},dri=class extends k{constructor(){super();this._entries=new Map;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(this.register(es,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0))}register(e,t,o=0){let n=this._entries.get(e);n||(n=new cri(e),this._entries.set(e,n));let r=n.register(t,o);return this._onDidChange.fire(new BSt(e)),bp(ee(()=>{r.dispose(),this._onDidChange.fire(new BSt(e))}))}getLanguageConfiguration(e){return this._entries.get(e)?.getResolvedConfiguration()||null}},nCe=class a{constructor(i,e){this.languageId=i;this.underlyingConfig=e;this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new DSt(this.underlyingConfig):null,this.comments=a._handleComments(this.underlyingConfig),this.characterPair=new CSt(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||AY,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new _St(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new FSt(i,this.underlyingConfig)}getWordDefinition(){return c5(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new xSt(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new ESt(this.brackets)),this._electricCharacter}onEnter(i,e,t,o){return this._onEnterSupport?this._onEnterSupport.onEnter(i,e,t,o):null}getAutoClosingPairs(){return new wSt(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(i){return this.characterPair.getAutoCloseBeforeSet(i)}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(i){let e=i.comments;if(!e)return null;let t={};if(e.lineComment&&(typeof e.lineComment=="string"?t.lineCommentToken=e.lineComment:(t.lineCommentToken=e.lineComment.comment,t.lineCommentNoIndent=e.lineComment.noIndent)),e.blockComment){let[o,n]=e.blockComment;t.blockCommentStartToken=o,t.blockCommentEndToken=n}return t}};Ce(Us,n3e,1);var gi=class a{constructor(i,e){this.start=i;this.endExclusive=e;if(i>e)throw new ci(`Invalid range: ${this.toString()}`)}static fromTo(i,e){return new a(i,e)}static equals(i,e){return i.start===e.start&&i.endExclusive===e.endExclusive}static addRange(i,e){let t=0;for(;t<e.length&&e[t].endExclusive<i.start;)t++;let o=t;for(;o<e.length&&e[o].start<=i.endExclusive;)o++;if(t===o)e.splice(t,0,i);else{let n=Math.min(i.start,e[t].start),r=Math.max(i.endExclusive,e[o-1].endExclusive);e.splice(t,o-t,new a(n,r))}}static tryCreate(i,e){if(!(i>e))return new a(i,e)}static ofLength(i){return new a(0,i)}static ofStartAndLength(i,e){return new a(i,i+e)}static emptyAt(i){return new a(i,i)}get isEmpty(){return this.start===this.endExclusive}delta(i){return new a(this.start+i,this.endExclusive+i)}deltaStart(i){return new a(this.start+i,this.endExclusive)}deltaEnd(i){return new a(this.start,this.endExclusive+i)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(i){return this.start===i.start&&this.endExclusive===i.endExclusive}containsRange(i){return this.start<=i.start&&i.endExclusive<=this.endExclusive}contains(i){return this.start<=i&&i<this.endExclusive}join(i){return new a(Math.min(this.start,i.start),Math.max(this.endExclusive,i.endExclusive))}intersect(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);if(e<=t)return new a(e,t)}intersectionLength(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return Math.max(0,t-e)}intersects(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return e<t}intersectsOrTouches(i){let e=Math.max(this.start,i.start),t=Math.min(this.endExclusive,i.endExclusive);return e<=t}isBefore(i){return this.endExclusive<=i.start}isAfter(i){return this.start>=i.endExclusive}slice(i){return i.slice(this.start,this.endExclusive)}substring(i){return i.substring(this.start,this.endExclusive)}clip(i){if(this.isEmpty)throw new ci(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,i))}clipCyclic(i){if(this.isEmpty)throw new ci(`Invalid clipping range: ${this.toString()}`);return i<this.start?this.endExclusive-(this.start-i)%this.length:i>=this.endExclusive?this.start+(i-this.start)%this.length:i}map(i){let e=[];for(let t=this.start;t<this.endExclusive;t++)e.push(i(t));return e}forEach(i){for(let e=this.start;e<this.endExclusive;e++)i(e)}joinRightTouching(i){if(this.endExclusive!==i.start)throw new ci(`Invalid join: ${this.toString()} and ${i.toString()}`);return new a(this.start,i.endExclusive)}withMargin(i,e){return e===void 0&&(e=i),new a(this.start-i,this.endExclusive+e)}},USt=class a{constructor(){this._sortedRanges=[]}get ranges(){return[...this._sortedRanges]}addRange(i){let e=0;for(;e<this._sortedRanges.length&&this._sortedRanges[e].endExclusive<i.start;)e++;let t=e;for(;t<this._sortedRanges.length&&this._sortedRanges[t].start<=i.endExclusive;)t++;if(e===t)this._sortedRanges.splice(e,0,i);else{let o=Math.min(i.start,this._sortedRanges[e].start),n=Math.max(i.endExclusive,this._sortedRanges[t-1].endExclusive);this._sortedRanges.splice(e,t-e,new gi(o,n))}}toString(){return this._sortedRanges.map(i=>i.toString()).join(", ")}intersectsStrict(i){let e=0;for(;e<this._sortedRanges.length&&this._sortedRanges[e].endExclusive<=i.start;)e++;return e<this._sortedRanges.length&&this._sortedRanges[e].start<i.endExclusive}intersectWithRange(i){let e=new a;for(let t of this._sortedRanges){let o=t.intersect(i);o&&e.addRange(o)}return e}intersectWithRangeLength(i){return this.intersectWithRange(i).length}get length(){return this._sortedRanges.reduce((i,e)=>i+e.length,0)}};var Cd=class a{constructor(i,e,t){this._lineTokensBrand=void 0;(i.length>1?i[i.length-2]:0)!==e.length&&mt(new Error("Token length and text length do not match!")),this._tokens=i,this._tokensCount=this._tokens.length>>>1,this._text=e,this.languageIdCodec=t}static createEmpty(i,e){let t=a.defaultTokenMetadata,o=new Uint32Array(2);return o[0]=i.length,o[1]=t,new a(o,i,e)}static createFromTextAndMetadata(i,e){let t=0,o="",n=new Array;for(let{text:r,metadata:s}of i)n.push(t+r.length,s),t+=r.length,o+=r;return new a(new Uint32Array(n),o,e)}static convertToEndOffset(i,e){let o=(i.length>>>1)-1;for(let n=0;n<o;n++)i[n<<1]=i[n+1<<1];i[o<<1]=e}static findIndexInTokensArray(i,e){if(i.length<=2)return 0;let t=0,o=(i.length>>>1)-1;for(;t<o;){let n=t+Math.floor((o-t)/2),r=i[n<<1];if(r===e)return n+1;r<e?t=n+1:r>e&&(o=n)}return t}static{this.defaultTokenMetadata=(32768|2<<24)>>>0}getTextLength(){return this._text.length}equals(i){return i instanceof a?this.slicedEquals(i,0,this._tokensCount):!1}slicedEquals(i,e,t){if(this._text!==i._text||this._tokensCount!==i._tokensCount)return!1;let o=e<<1,n=o+(t<<1);for(let r=o;r<n;r++)if(this._tokens[r]!==i._tokens[r])return!1;return!0}getLineContent(){return this._text}getCount(){return this._tokensCount}getStartOffset(i){return i>0?this._tokens[i-1<<1]:0}getMetadata(i){return this._tokens[(i<<1)+1]}getLanguageId(i){let e=this._tokens[(i<<1)+1],t=Vp.getLanguageId(e);return this.languageIdCodec.decodeLanguageId(t)}getStandardTokenType(i){let e=this._tokens[(i<<1)+1];return Vp.getTokenType(e)}getForeground(i){let e=this._tokens[(i<<1)+1];return Vp.getForeground(e)}getClassName(i){let e=this._tokens[(i<<1)+1];return Vp.getClassNameFromMetadata(e)}getInlineStyle(i,e){let t=this._tokens[(i<<1)+1];return Vp.getInlineStyleFromMetadata(t,e)}getPresentation(i){let e=this._tokens[(i<<1)+1];return Vp.getPresentationFromMetadata(e)}getEndOffset(i){return this._tokens[i<<1]}findTokenIndexAtOffset(i){return a.findIndexInTokensArray(this._tokens,i)}inflate(){return this}sliceAndInflate(i,e,t){return new uri(this,i,e,t)}sliceZeroCopy(i){return this.sliceAndInflate(i.start,i.endExclusive,0)}withInserted(i){if(i.length===0)return this;let e=0,t=0,o="",n=new Array,r=0;for(;;){let s=e<this._tokensCount?this._tokens[e<<1]:-1,l=t<i.length?i[t]:null;if(s!==-1&&(l===null||s<=l.offset)){o+=this._text.substring(r,s);let c=this._tokens[(e<<1)+1];n.push(o.length,c),e++,r=s}else if(l){if(l.offset>r){o+=this._text.substring(r,l.offset);let c=this._tokens[(e<<1)+1];n.push(o.length,c),r=l.offset}o+=l.text,n.push(o.length,l.tokenMetadata),t++}else break}return new a(new Uint32Array(n),o,this.languageIdCodec)}getTokensInRange(i){let e=new pri,t=this.findTokenIndexAtOffset(i.start),o=this.findTokenIndexAtOffset(i.endExclusive);for(let n=t;n<=o;n++){let s=new gi(this.getStartOffset(n),this.getEndOffset(n)).intersectionLength(i);s>0&&e.add(s,this.getMetadata(n))}return e.build()}getTokenText(i){let e=this.getStartOffset(i),t=this.getEndOffset(i);return this._text.substring(e,t)}forEach(i){let e=this.getCount();for(let t=0;t<e;t++)i(t)}toString(){let i="";return this.forEach(e=>{i+=`[${this.getTokenText(e)}]{${this.getClassName(e)}}`}),i}},uri=class a{constructor(i,e,t,o){this._source=i,this._startOffset=e,this._endOffset=t,this._deltaOffset=o,this._firstTokenIndex=i.findTokenIndexAtOffset(e),this.languageIdCodec=i.languageIdCodec,this._tokensCount=0;for(let n=this._firstTokenIndex,r=i.getCount();n<r&&!(i.getStartOffset(n)>=t);n++)this._tokensCount++}getMetadata(i){return this._source.getMetadata(this._firstTokenIndex+i)}getLanguageId(i){return this._source.getLanguageId(this._firstTokenIndex+i)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(i){return i instanceof a?this._startOffset===i._startOffset&&this._endOffset===i._endOffset&&this._deltaOffset===i._deltaOffset&&this._source.slicedEquals(i._source,this._firstTokenIndex,this._tokensCount):!1}getCount(){return this._tokensCount}getStandardTokenType(i){return this._source.getStandardTokenType(this._firstTokenIndex+i)}getForeground(i){return this._source.getForeground(this._firstTokenIndex+i)}getEndOffset(i){let e=this._source.getEndOffset(this._firstTokenIndex+i);return Math.min(this._endOffset,e)-this._startOffset+this._deltaOffset}getClassName(i){return this._source.getClassName(this._firstTokenIndex+i)}getInlineStyle(i,e){return this._source.getInlineStyle(this._firstTokenIndex+i,e)}getPresentation(i){return this._source.getPresentation(this._firstTokenIndex+i)}findTokenIndexAtOffset(i){return this._source.findTokenIndexAtOffset(i+this._startOffset-this._deltaOffset)-this._firstTokenIndex}getTokenText(i){let e=this._firstTokenIndex+i,t=this._source.getStartOffset(e),o=this._source.getEndOffset(e),n=this._source.getTokenText(e);return t<this._startOffset&&(n=n.substring(this._startOffset-t)),o>this._endOffset&&(n=n.substring(0,n.length-(o-this._endOffset))),n}forEach(i){for(let e=0;e<this.getCount();e++)i(e)}};function _6i(a,i){let e=i.lineNumber;if(!a.tokenization.isCheapToTokenize(e))return;a.tokenization.forceTokenization(e);let t=a.tokenization.getLineTokens(e),o=t.findTokenIndexAtOffset(i.column-1);return t.getStandardTokenType(o)}var LB=class a{constructor(i){this._tokenInfo=i}static fromLineTokens(i){let e=[];for(let t=0;t<i.getCount();t++)e.push(new s3e(i.getEndOffset(t)-i.getStartOffset(t),i.getMetadata(t)));return a.create(e)}static create(i){return new a(i)}toLineTokens(i,e){return Cd.createFromTextAndMetadata(this.map((t,o)=>({text:t.substring(i),metadata:o.metadata})),e)}forEach(i){let e=0;for(let t of this._tokenInfo){let o=new gi(e,e+t.length);i(o,t),e+=t.length}}map(i){let e=[],t=0;for(let o of this._tokenInfo){let n=new gi(t,t+o.length);e.push(i(n,o)),t+=o.length}return e}slice(i){let e=[],t=0;for(let o of this._tokenInfo){let n=t,r=n+o.length;if(r>i.start){if(n>=i.endExclusive)break;let s=Math.max(0,i.start-n),l=Math.max(0,r-i.endExclusive);e.push(new s3e(o.length-s-l,o.metadata))}t+=o.length}return a.create(e)}append(i){let e=this._tokenInfo.concat(i._tokenInfo);return a.create(e)}},s3e=class{constructor(i,e){this.length=i;this.metadata=e}},pri=class{constructor(){this._tokens=[]}add(i,e){this._tokens.push(new s3e(i,e))}build(){return LB.create(this._tokens)}};var Sce=class{constructor(i,e,t){this._indentRulesSupport=e,this._indentationLineProcessor=new zSt(i,t)}shouldIncrease(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIncrease(t)}shouldDecrease(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldDecrease(t)}shouldIgnore(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIgnore(t)}shouldIndentNextLine(i,e){let t=this._indentationLineProcessor.getProcessedLine(i,e);return this._indentRulesSupport.shouldIndentNextLine(t)}},Ice=class{constructor(i,e){this.model=i,this.indentationLineProcessor=new zSt(i,e)}getProcessedTokenContextAroundRange(i){let e=this._getProcessedTokensBeforeRange(i),t=this._getProcessedTokensAfterRange(i),o=this._getProcessedPreviousLineTokens(i);return{beforeRangeProcessedTokens:e,afterRangeProcessedTokens:t,previousLineProcessedTokens:o}}_getProcessedTokensBeforeRange(i){this.model.tokenization.forceTokenization(i.startLineNumber);let e=this.model.tokenization.getLineTokens(i.startLineNumber),t=Nz(e,i.startColumn-1),o;if(KSt(this.model,i.getStartPosition())){let r=i.startColumn-1-t.firstCharOffset,s=t.firstCharOffset,l=s+r;o=e.sliceAndInflate(s,l,0)}else{let r=i.startColumn-1;o=e.sliceAndInflate(0,r,0)}return this.indentationLineProcessor.getProcessedTokens(o)}_getProcessedTokensAfterRange(i){let e=i.isEmpty()?i.getStartPosition():i.getEndPosition();this.model.tokenization.forceTokenization(e.lineNumber);let t=this.model.tokenization.getLineTokens(e.lineNumber),o=Nz(t,e.column-1),n=e.column-1-o.firstCharOffset,r=o.firstCharOffset+n,s=o.firstCharOffset+o.getLineLength(),l=t.sliceAndInflate(r,s,0);return this.indentationLineProcessor.getProcessedTokens(l)}_getProcessedPreviousLineTokens(i){let e=g=>{this.model.tokenization.forceTokenization(g);let f=this.model.tokenization.getLineTokens(g),v=this.model.getLineMaxColumn(g)-1;return Nz(f,v)};this.model.tokenization.forceTokenization(i.startLineNumber);let t=this.model.tokenization.getLineTokens(i.startLineNumber),o=Nz(t,i.startColumn-1),n=Cd.createEmpty("",o.languageIdCodec),r=i.startLineNumber-1;if(r===0||!(o.firstCharOffset===0))return n;let c=e(r);if(!(o.languageId===c.languageId))return n;let p=c.toIViewLineTokens();return this.indentationLineProcessor.getProcessedTokens(p)}},zSt=class{constructor(i,e){this.model=i;this.languageConfigurationService=e}getProcessedLine(i,e){let t=(r,s)=>{let l=Ul(r);return s+r.substring(l.length)};this.model.tokenization.forceTokenization?.(i);let o=this.model.tokenization.getLineTokens(i),n=this.getProcessedTokens(o).getLineContent();return e!==void 0&&(n=t(n,e)),n}getProcessedTokens(i){let e=l=>l===2||l===3||l===1,t=i.getLanguageId(0),n=this.languageConfigurationService.getLanguageConfiguration(t).bracketsNew.getBracketRegExp({global:!0}),r=[];return i.forEach(l=>{let c=i.getStandardTokenType(l),u=i.getTokenText(l);e(c)&&(u=u.replace(n,""));let p=i.getMetadata(l);r.push({text:u,metadata:p})}),Cd.createFromTextAndMetadata(r,i.languageIdCodec)}};function KSt(a,i){a.tokenization.forceTokenization(i.lineNumber);let e=a.tokenization.getLineTokens(i.lineNumber),t=Nz(e,i.column-1),o=t.firstCharOffset===0,n=e.getLanguageId(0)===t.languageId;return!o&&!n}function g5(a,i,e,t){i.tokenization.forceTokenization(e.startLineNumber);let o=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),n=t.getLanguageConfiguration(o);if(!n)return null;let s=new Ice(i,t).getProcessedTokenContextAroundRange(e),l=s.previousLineProcessedTokens.getLineContent(),c=s.beforeRangeProcessedTokens.getLineContent(),u=s.afterRangeProcessedTokens.getLineContent(),p=n.onEnter(a,l,c,u);if(!p)return null;let h=p.indentAction,g=p.appendText,f=p.removeText||0;g?h===1&&(g="	"+g):h===1||h===2?g="	":g="";let v=HSt(i,e.startLineNumber,e.startColumn);return f&&(v=v.substring(0,v.length-f)),{indentAction:h,appendText:g,removeText:f,indentation:v}}var mri=Object.create(null);function yce(a,i){if(i<=0)return"";mri[a]||(mri[a]=["",a]);let e=mri[a];for(let t=e.length;t<=i;t++)e[t]=e[t-1]+a;return e[i]}var Fb=class{constructor(i,e,t){this._languageConfigurationService=t;this._opts=e,this._selection=i,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}static unshiftIndent(i,e,t,o,n){let r=Ll.visibleColumnFromColumn(i,e,t);if(n){let s=yce(" ",o),c=Ll.prevIndentTabStop(r,o)/o;return yce(s,c)}else{let c=Ll.prevRenderTabStop(r,t)/t;return yce("	",c)}}static shiftIndent(i,e,t,o,n){let r=Ll.visibleColumnFromColumn(i,e,t);if(n){let s=yce(" ",o),c=Ll.nextIndentTabStop(r,o)/o;return yce(s,c)}else{let c=Ll.nextRenderTabStop(r,t)/t;return yce("	",c)}}_addEditOperation(i,e,t){this._useLastEditRangeForCursorEndPosition?i.addTrackedEditOperation(e,t):i.addEditOperation(e,t)}getEditOperations(i,e){let t=this._selection.startLineNumber,o=this._selection.endLineNumber;this._selection.endColumn===1&&t!==o&&(o=o-1);let{tabSize:n,indentSize:r,insertSpaces:s}=this._opts,l=t===o;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(i.getLineContent(t))&&(this._useLastEditRangeForCursorEndPosition=!0);let c=0,u=0;for(let p=t;p<=o;p++,c=u){u=0;let h=i.getLineContent(p),g=Em(h);if(this._opts.isUnshift&&(h.length===0||g===0)||!l&&!this._opts.isUnshift&&h.length===0)continue;if(g===-1&&(g=h.length),p>1&&Ll.visibleColumnFromColumn(h,g+1,n)%r!==0&&i.tokenization.isCheapToTokenize(p-1)){let b=g5(this._opts.autoIndent,i,new G(p-1,i.getLineMaxColumn(p-1),p-1,i.getLineMaxColumn(p-1)),this._languageConfigurationService);if(b){if(u=c,b.appendText)for(let S=0,y=b.appendText.length;S<y&&u<r&&b.appendText.charCodeAt(S)===32;S++)u++;b.removeText&&(u=Math.max(0,u-b.removeText));for(let S=0;S<u&&!(g===0||h.charCodeAt(g-1)!==32);S++)g--}}if(this._opts.isUnshift&&g===0)continue;let f;this._opts.isUnshift?f=Fb.unshiftIndent(h,g+1,n,r,s):f=Fb.shiftIndent(h,g+1,n,r,s),this._addEditOperation(e,new G(p,1,p,g+1),f),p===t&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn<=g+1)}}else{!this._opts.isUnshift&&this._selection.isEmpty()&&i.getLineLength(t)===0&&(this._useLastEditRangeForCursorEndPosition=!0);let c=s?yce(" ",r):"	";for(let u=t;u<=o;u++){let p=i.getLineContent(u),h=Em(p);if(!(this._opts.isUnshift&&(p.length===0||h===0))&&!(!l&&!this._opts.isUnshift&&p.length===0)&&(h===-1&&(h=p.length),!(this._opts.isUnshift&&h===0)))if(this._opts.isUnshift){h=Math.min(h,r);for(let g=0;g<h;g++)if(p.charCodeAt(g)===9){h=g+1;break}this._addEditOperation(e,new G(u,1,u,h+1),"")}else this._addEditOperation(e,new G(u,1,u,1),c),u===t&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn===1)}}this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){if(this._useLastEditRangeForCursorEndPosition){let o=e.getInverseEditOperations()[0];return new ei(o.range.endLineNumber,o.range.endColumn,o.range.endLineNumber,o.range.endColumn)}let t=e.getTrackedSelection(this._selectionId);if(this._selectionStartColumnStaysPut){let o=this._selection.startColumn;return t.startColumn<=o?t:t.getDirection()===0?new ei(t.startLineNumber,o,t.endLineNumber,t.endColumn):new ei(t.endLineNumber,t.endColumn,t.startLineNumber,o)}return t}};Fb=I([m(2,Us)],Fb);var GSt=class{constructor(i,e,t){this._range=i,this._charBeforeSelection=e,this._charAfterSelection=t}getEditOperations(i,e){e.addTrackedEditOperation(new G(this._range.startLineNumber,this._range.startColumn,this._range.startLineNumber,this._range.startColumn),this._charBeforeSelection),e.addTrackedEditOperation(new G(this._range.endLineNumber,this._range.endColumn,this._range.endLineNumber,this._range.endColumn),this._charAfterSelection||null)}computeCursorState(i,e){let t=e.getInverseEditOperations(),o=t[0].range,n=t[1].range;return new ei(o.endLineNumber,o.endColumn,n.endLineNumber,n.endColumn-this._charAfterSelection.length)}},qSt=class{constructor(i,e,t){this._position=i;this._text=e;this._charAfter=t}getEditOperations(i,e){e.addTrackedEditOperation(new G(this._position.lineNumber,this._position.column,this._position.lineNumber,this._position.column),this._text+this._charAfter)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return new ei(o.endLineNumber,o.startColumn,o.endLineNumber,o.endColumn-this._charAfter.length)}};function p2o(a,i,e){let t=a.tokenization.getLanguageIdAtPosition(i,0);if(i>1){let o,n=-1;for(o=i-1;o>=1;o--){if(a.tokenization.getLanguageIdAtPosition(o,0)!==t)return n;let r=a.getLineContent(o);if(e.shouldIgnore(o)||/^\s+$/.test(r)||r===""){n=o;continue}return o}}return-1}function rCe(a,i,e,t=!0,o){if(a<4)return null;let n=o.getLanguageConfiguration(i.tokenization.getLanguageId()).indentRulesSupport;if(!n)return null;let r=new Sce(i,n,o);if(e<=1)return{indentation:"",action:null};for(let l=e-1;l>0&&i.getLineContent(l)==="";l--)if(l===1)return{indentation:"",action:null};let s=p2o(i,e,r);if(s<0)return null;if(s<1)return{indentation:"",action:null};if(r.shouldIncrease(s)||r.shouldIndentNextLine(s)){let l=i.getLineContent(s);return{indentation:Ul(l),action:1,line:s}}else if(r.shouldDecrease(s)){let l=i.getLineContent(s);return{indentation:Ul(l),action:null,line:s}}else{if(s===1)return{indentation:Ul(i.getLineContent(s)),action:null,line:s};let l=s-1,c=n.getIndentMetadata(i.getLineContent(l));if(!(c&3)&&c&4){let u=0;for(let p=l-1;p>0;p--)if(!r.shouldIndentNextLine(p)){u=p;break}return{indentation:Ul(i.getLineContent(u+1)),action:null,line:u+1}}if(t)return{indentation:Ul(i.getLineContent(s)),action:null,line:s};for(let u=s;u>0;u--){if(r.shouldIncrease(u))return{indentation:Ul(i.getLineContent(u)),action:1,line:u};if(r.shouldIndentNextLine(u)){let p=0;for(let h=u-1;h>0;h--)if(!r.shouldIndentNextLine(u)){p=h;break}return{indentation:Ul(i.getLineContent(p+1)),action:null,line:p+1}}else if(r.shouldDecrease(u))return{indentation:Ul(i.getLineContent(u)),action:null,line:u}}return{indentation:Ul(i.getLineContent(1)),action:null,line:1}}}function wce(a,i,e,t,o,n){if(a<4)return null;let r=n.getLanguageConfiguration(e);if(!r)return null;let s=n.getLanguageConfiguration(e).indentRulesSupport;if(!s)return null;let l=new Sce(i,s,n),c=rCe(a,i,t,void 0,n);if(c){let u=c.line;if(u!==void 0){let p=!0;for(let h=u;h<t-1;h++)if(!/^\s*$/.test(i.getLineContent(h))){p=!1;break}if(p){let h=r.onEnter(a,"",i.getLineContent(u),"");if(h){let g=Ul(i.getLineContent(u));return h.removeText&&(g=g.substring(0,g.length-h.removeText)),h.indentAction===1||h.indentAction===2?g=o.shiftIndent(g):h.indentAction===3&&(g=o.unshiftIndent(g)),l.shouldDecrease(t)&&(g=o.unshiftIndent(g)),h.appendText&&(g+=h.appendText),Ul(g)}}}return l.shouldDecrease(t)?c.action===1?c.indentation:o.unshiftIndent(c.indentation):c.action===1?o.shiftIndent(c.indentation):c.indentation}return null}function R6i(a,i,e,t,o){if(a<4)return null;let n=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),r=o.getLanguageConfiguration(n).indentRulesSupport;if(!r)return null;i.tokenization.forceTokenization(e.startLineNumber);let l=new Ice(i,o).getProcessedTokenContextAroundRange(e),c=l.afterRangeProcessedTokens,u=l.beforeRangeProcessedTokens,p=Ul(u.getLineContent()),h=m2o(i,e.startLineNumber,u),g=KSt(i,e.getStartPosition()),f=i.getLineContent(e.startLineNumber),v=Ul(f),b=rCe(a,h,e.startLineNumber+1,void 0,o);if(!b){let y=g?v:p;return{beforeEnter:y,afterEnter:y}}let S=g?v:b.indentation;return b.action===1&&(S=t.shiftIndent(S)),r.shouldDecrease(c.getLineContent())&&(S=t.unshiftIndent(S)),{beforeEnter:g?v:p,afterEnter:S}}function L6i(a,i,e,t,o,n){let r=a.autoIndent;if(r<4||KSt(i,e.getStartPosition()))return null;let l=i.getLanguageIdAtPosition(e.startLineNumber,e.startColumn),c=n.getLanguageConfiguration(l).indentRulesSupport;if(!c)return null;let p=new Ice(i,n).getProcessedTokenContextAroundRange(e),h=p.beforeRangeProcessedTokens.getLineContent(),g=p.afterRangeProcessedTokens.getLineContent(),f=h+g,v=h+t+g;if(!c.shouldDecrease(f)&&c.shouldDecrease(v)){let S=rCe(r,i,e.startLineNumber,!1,n);if(!S)return null;let y=S.indentation;return S.action!==1&&(y=o.unshiftIndent(y)),y}let b=e.startLineNumber-1;if(b>0){let S=i.getLineContent(b);if(c.shouldIndentNextLine(S)&&c.shouldIncrease(v)){let w=rCe(r,i,e.startLineNumber,!1,n)?.indentation;if(w!==void 0){let x=i.getLineContent(e.startLineNumber),E=Ul(x),N=o.shiftIndent(w)===E,V=/^\s*$/.test(f),H=a.autoClosingPairs.autoClosingPairsOpenByEnd.get(t),j=H&&H.length>0&&V;if(N&&j)return w}}}return null}function $St(a,i,e){let t=e.getLanguageConfiguration(a.getLanguageId()).indentRulesSupport;return!t||i<1||i>a.getLineCount()?null:t.getIndentMetadata(a.getLineContent(i))}function m2o(a,i,e){return{tokenization:{getLineTokens:o=>o===i?e:a.tokenization.getLineTokens(o),getLanguageId:()=>a.getLanguageId(),getLanguageIdAtPosition:(o,n)=>a.getLanguageIdAtPosition(o,n)},getLineContent:o=>o===i?e.getLineContent():a.getLineContent(o)}}var jSt=class{static getEdits(i,e,t,o,n){if(!n&&this._isAutoIndentType(i,e,t)){let r=[];for(let l of t){let c=this._findActualIndentationForSelection(i,e,l,o);if(c===null)return;r.push({selection:l,indentation:c})}let s=sCe.getAutoClosingPairClose(i,e,t,o,!1);return this._getIndentationAndAutoClosingPairEdits(i,e,r,o,s)}}static _isAutoIndentType(i,e,t){if(i.autoIndent<4)return!1;for(let o=0,n=t.length;o<n;o++)if(!e.tokenization.isCheapToTokenize(t[o].getEndPosition().lineNumber))return!1;return!0}static _findActualIndentationForSelection(i,e,t,o){let n=L6i(i,e,t,o,{shiftIndent:s=>l3e(i,s),unshiftIndent:s=>lCe(i,s)},i.languageConfigurationService);if(n===null)return null;let r=HSt(e,t.startLineNumber,t.startColumn);return n===i.normalizeIndentation(r)?null:n}static _getIndentationAndAutoClosingPairEdits(i,e,t,o,n){let r=t.map(({selection:l,indentation:c})=>{if(n!==null){let u=this._getEditFromIndentationAndSelection(i,e,c,l,o,!1);return new gri(u,l,o,n)}else{let u=this._getEditFromIndentationAndSelection(i,e,c,l,o,!0);return Cce(u.range,u.text,!1)}}),s={shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1};return new Ob(4,r,s)}static _getEditFromIndentationAndSelection(i,e,t,o,n,r=!0){let s=o.startLineNumber,l=e.getLineFirstNonWhitespaceColumn(s),c=i.normalizeIndentation(t);if(l!==0){let p=e.getLineContent(s);c+=p.substring(l-1,o.startColumn-1)}return c+=r?n:"",{range:new G(s,1,o.endLineNumber,o.endColumn),text:c}}},QSt=class{static getEdits(i,e,t,o,n,r){if(A6i(e,t,o,n,r))return this._runAutoClosingOvertype(i,o,r)}static _runAutoClosingOvertype(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let l=e[n].getPosition(),c=new G(l.lineNumber,l.column,l.lineNumber,l.column+1);o[n]=new kg(c,t)}return new Ob(4,o,{shouldPushStackElementBefore:nIt(i,4),shouldPushStackElementAfter:!1})}},YSt=class{static getEdits(i,e,t,o,n){if(A6i(i,e,t,o,n)){let r=t.map(s=>new kg(new G(s.positionLineNumber,s.positionColumn,s.positionLineNumber,s.positionColumn+1),"",!1));return new Ob(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}},sCe=class{static getEdits(i,e,t,o,n,r){if(!r){let s=this.getAutoClosingPairClose(i,e,t,o,n);if(s!==null)return this._runAutoClosingOpenCharType(t,o,n,s)}}static _runAutoClosingOpenCharType(i,e,t,o){let n=[];for(let r=0,s=i.length;r<s;r++){let l=i[r];n[r]=new hri(l,e,!t,o)}return new Ob(4,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}static getAutoClosingPairClose(i,e,t,o,n){for(let f of t)if(!f.isEmpty())return null;let r=t.map(f=>{let v=f.getPosition();return n?{lineNumber:v.lineNumber,beforeColumn:v.column-o.length,afterColumn:v.column}:{lineNumber:v.lineNumber,beforeColumn:v.column,afterColumn:v.column}}),s=this._findAutoClosingPairOpen(i,e,r.map(f=>new ye(f.lineNumber,f.beforeColumn)),o);if(!s)return null;let l,c;if(RB(o)?(l=i.autoClosingQuotes,c=i.shouldAutoCloseBefore.quote):(i.blockCommentStartToken?s.open.includes(i.blockCommentStartToken):!1)?(l=i.autoClosingComments,c=i.shouldAutoCloseBefore.comment):(l=i.autoClosingBrackets,c=i.shouldAutoCloseBefore.bracket),l==="never")return null;let p=this._findContainedAutoClosingPair(i,s),h=p?p.close:"",g=!0;for(let f of r){let{lineNumber:v,beforeColumn:b,afterColumn:S}=f,y=e.getLineContent(v),w=y.substring(0,b-1),x=y.substring(S-1);if(x.startsWith(h)||(g=!1),x.length>0){let V=x.charAt(0);if(!this._isBeforeClosingBrace(i,x)&&!c(V))return null}if(s.open.length===1&&(o==="'"||o==='"')&&l!=="always"){let V=mx(i.wordSeparators,[]);if(w.length>0){let H=w.charCodeAt(w.length-1);if(V.get(H)===0)return null}}if(!e.tokenization.isCheapToTokenize(v))return null;e.tokenization.forceTokenization(v);let E=e.tokenization.getLineTokens(v),M=Nz(E,b-1);if(!s.shouldAutoClose(M,b-M.firstCharOffset))return null;let N=s.findNeutralCharacter();if(N){let V=e.tokenization.getTokenTypeIfInsertingCharacter(v,b,N);if(!s.isOK(V))return null}}return g?s.close.substring(0,s.close.length-h.length):s.close}static _findContainedAutoClosingPair(i,e){if(e.open.length<=1)return null;let t=e.close.charAt(e.close.length-1),o=i.autoClosingPairs.autoClosingPairsCloseByEnd.get(t)||[],n=null;for(let r of o)r.open!==e.open&&e.open.includes(r.open)&&e.close.endsWith(r.close)&&(!n||r.open.length>n.open.length)&&(n=r);return n}static _findAutoClosingPairOpen(i,e,t,o){let n=i.autoClosingPairs.autoClosingPairsOpenByEnd.get(o);if(!n)return null;let r=null;for(let s of n)if(r===null||s.open.length>r.open.length){let l=!0;for(let c of t)if(e.getValueInRange(new G(c.lineNumber,c.column-s.open.length+1,c.lineNumber,c.column))+o!==s.open){l=!1;break}l&&(r=s)}return r}static _isBeforeClosingBrace(i,e){let t=e.charAt(0),o=i.autoClosingPairs.autoClosingPairsOpenByStart.get(t)||[],n=i.autoClosingPairs.autoClosingPairsCloseByStart.get(t)||[],r=o.some(l=>e.startsWith(l.open)),s=n.some(l=>e.startsWith(l.close));return!r&&s}},a3e=class{static getEdits(i,e){if(!(i.inputMode==="overtype"))return null;let o=e.map(n=>new fSt(n.insertedTextRange));return new Ob(4,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}},XSt=class{static getEdits(i,e,t,o,n){if(!n&&this._isSurroundSelectionType(i,e,t,o))return this._runSurroundSelectionType(i,t,o)}static _runSurroundSelectionType(i,e,t){let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=i.surroundingPairs[t];o[n]=new GSt(s,t,l)}return new Ob(0,o,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _isSurroundSelectionType(i,e,t,o){if(!vri(i,o)||!i.surroundingPairs.hasOwnProperty(o))return!1;let n=RB(o);for(let r of t){if(r.isEmpty())return!1;let s=!0;for(let l=r.startLineNumber;l<=r.endLineNumber;l++){let c=e.getLineContent(l),u=l===r.startLineNumber?r.startColumn-1:0,p=l===r.endLineNumber?r.endColumn-1:c.length,h=c.substring(u,p);if(/[^ \t]/.test(h)){s=!1;break}}if(s)return!1;if(n&&r.startLineNumber===r.endLineNumber&&r.startColumn+1===r.endColumn){let l=e.getValueInRange(r);if(RB(l))return!1}}return!0}},JSt=class{static getEdits(i,e,t,o,n,r){if(!r&&this._isTypeInterceptorElectricChar(e,t,o)){let s=this._typeInterceptorElectricChar(i,e,t,o[0],n);if(s)return s}}static _isTypeInterceptorElectricChar(i,e,t){return!!(t.length===1&&e.tokenization.isCheapToTokenize(t[0].getEndPosition().lineNumber))}static _typeInterceptorElectricChar(i,e,t,o,n){if(!e.electricChars.hasOwnProperty(n)||!o.isEmpty())return null;let r=o.getPosition();t.tokenization.forceTokenization(r.lineNumber);let s=t.tokenization.getLineTokens(r.lineNumber),l;try{l=e.onElectricCharacter(n,s,r.column)}catch(c){return mt(c),null}if(!l)return null;if(l.matchOpenBracket){let c=(s.getLineContent()+n).lastIndexOf(l.matchOpenBracket)+1,u=t.bracketPairs.findMatchingBracketUp(l.matchOpenBracket,{lineNumber:r.lineNumber,column:c},500);if(u){if(u.startLineNumber===r.lineNumber)return null;let p=t.getLineContent(u.startLineNumber),h=Ul(p),g=e.normalizeIndentation(h),f=t.getLineContent(r.lineNumber),v=t.getLineFirstNonWhitespaceColumn(r.lineNumber)||r.column,b=f.substring(v-1,r.column-1),S=g+b+n,y=new G(r.lineNumber,1,r.lineNumber,r.column),w=new kg(y,S);return new Ob(fri(S,i),[w],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!0})}}return null}},ZSt=class{static getEdits(i,e,t,o,n){let r=[];for(let l=0,c=t.length;l<c;l++){let u=i.inputMode==="overtype"&&!n?$we:kg;r[l]=new u(t[l],o)}let s=fri(o,e);return new Ob(s,r,{shouldPushStackElementBefore:nIt(e,s),shouldPushStackElementAfter:!1})}},f5=class{static getEdits(i,e,t,o,n){if(!n&&o===`
`){let r=[];for(let s=0,l=t.length;s<l;s++)r[s]=this._enter(i,e,!1,t[s]);return new Ob(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}static _enter(i,e,t,o){if(i.autoIndent===0)return Cce(o,`
`,t);if(!e.tokenization.isCheapToTokenize(o.getStartPosition().lineNumber)||i.autoIndent===1){let l=e.getLineContent(o.startLineNumber),c=Ul(l).substring(0,o.startColumn-1);return Cce(o,`
`+i.normalizeIndentation(c),t)}let n=g5(i.autoIndent,e,o,i.languageConfigurationService);if(n){if(n.indentAction===0)return Cce(o,`
`+i.normalizeIndentation(n.indentation+n.appendText),t);if(n.indentAction===1)return Cce(o,`
`+i.normalizeIndentation(n.indentation+n.appendText),t);if(n.indentAction===2){let l=i.normalizeIndentation(n.indentation),c=i.normalizeIndentation(n.indentation+n.appendText),u=`
`+c+`
`+l;return t?new cce(o,u,!0):new dce(o,u,-1,c.length-l.length,!0)}else if(n.indentAction===3){let l=lCe(i,n.indentation);return Cce(o,`
`+i.normalizeIndentation(l+n.appendText),t)}}let r=e.getLineContent(o.startLineNumber),s=Ul(r).substring(0,o.startColumn-1);if(i.autoIndent>=4){let l=R6i(i.autoIndent,e,o,{unshiftIndent:c=>lCe(i,c),shiftIndent:c=>l3e(i,c),normalizeIndentation:c=>i.normalizeIndentation(c)},i.languageConfigurationService);if(l){let c=i.visibleColumnFromColumn(e,o.getEndPosition()),u=o.endColumn,p=e.getLineContent(o.endLineNumber),h=Em(p);if(h>=0?o=o.setEndPosition(o.endLineNumber,Math.max(o.endColumn,h+1)):o=o.setEndPosition(o.endLineNumber,e.getLineMaxColumn(o.endLineNumber)),t)return new cce(o,`
`+i.normalizeIndentation(l.afterEnter),!0);{let g=0;return u<=h+1&&(i.insertSpaces||(c=Math.ceil(c/i.indentSize)),g=Math.min(c+1-i.normalizeIndentation(l.afterEnter).length-1,0)),new dce(o,`
`+i.normalizeIndentation(l.afterEnter),0,g,!0)}}}return Cce(o,`
`+i.normalizeIndentation(s),t)}static lineInsertBefore(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].positionLineNumber;if(s===1)o[n]=new cce(new G(1,1,1,1),`
`);else{s--;let l=e.getLineMaxColumn(s);o[n]=this._enter(i,e,!1,new G(s,l,s,l))}}return o}static lineInsertAfter(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n].positionLineNumber,l=e.getLineMaxColumn(s);o[n]=this._enter(i,e,!1,new G(s,l,s,l))}return o}static lineBreakInsert(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=this._enter(i,e,!0,t[n]);return o}},eIt=class{static getEdits(i,e,t,o,n,r){let s=this._distributePasteToCursors(i,t,o,n,r);return s?(t=t.sort(G.compareRangesUsingStarts),this._distributedPaste(i,e,t,s)):this._simplePaste(i,e,t,o,n)}static _distributePasteToCursors(i,e,t,o,n){if(e.length===1)return null;if(n&&n.length===e.length)return n;if(o)return null;if(i.multiCursorPaste==="spread"){t.charCodeAt(t.length-1)===10&&(t=t.substring(0,t.length-1)),t.charCodeAt(t.length-1)===13&&(t=t.substring(0,t.length-1));let r=Hc(t);if(r.length===e.length)return r}return null}static _distributedPaste(i,e,t,o){let n=[];for(let r=0,s=t.length;r<s;r++){let c=i.overtypeOnPaste&&i.inputMode==="overtype"?$we:kg;n[r]=new c(t[r],o[r])}return new Ob(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _simplePaste(i,e,t,o,n){let r=[];for(let s=0,l=t.length;s<l;s++){let c=t[s],u=c.getPosition();if(n&&!c.isEmpty()&&(n=!1),n&&o.indexOf(`
`)!==o.length-1&&(n=!1),n){let p=new G(u.lineNumber,1,u.lineNumber,1);r[s]=new FY(p,o,c,!0)}else{let h=i.overtypeOnPaste&&i.inputMode==="overtype"?$we:kg;r[s]=new h(c,o)}}return new Ob(0,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}},tIt=class{static getEdits(i,e,t,o,n,r,s,l){let c=o.map(u=>this._compositionType(t,u,n,r,s,l));return new Ob(4,c,{shouldPushStackElementBefore:nIt(i,4),shouldPushStackElementAfter:!1})}static _compositionType(i,e,t,o,n,r){if(!e.isEmpty())return null;let s=e.getPosition(),l=Math.max(1,s.column-o),c=Math.min(i.getLineMaxColumn(s.lineNumber),s.column+n),u=new G(s.lineNumber,l,s.lineNumber,c);return new dce(u,t,0,r)}},iIt=class{static getEdits(i,e,t){let o=[];for(let r=0,s=e.length;r<s;r++)o[r]=new kg(e[r],t);let n=fri(t,i);return new Ob(n,o,{shouldPushStackElementBefore:nIt(i,n),shouldPushStackElementAfter:!1})}},oIt=class{static getCommands(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n];if(s.isEmpty()){let l=e.getLineContent(s.startLineNumber);if(/^\s*$/.test(l)&&e.tokenization.isCheapToTokenize(s.startLineNumber)){let c=this._goodIndentForLine(i,e,s.startLineNumber);c=c||"	";let u=i.normalizeIndentation(c);if(!l.startsWith(u)){o[n]=new kg(new G(s.startLineNumber,1,s.startLineNumber,l.length+1),u,!0);continue}}o[n]=this._replaceJumpToNextIndent(i,e,s,!0)}else{if(s.startLineNumber===s.endLineNumber){let l=e.getLineMaxColumn(s.startLineNumber);if(s.startColumn!==1||s.endColumn!==l){o[n]=this._replaceJumpToNextIndent(i,e,s,!1);continue}}o[n]=new Fb(s,{isUnshift:!1,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService)}}return o}static _goodIndentForLine(i,e,t){let o=null,n="",r=rCe(i.autoIndent,e,t,!1,i.languageConfigurationService);if(r)o=r.action,n=r.indentation;else if(t>1){let s;for(s=t-1;s>=1;s--){let u=e.getLineContent(s);if(Bv(u)>=0)break}if(s<1)return null;let l=e.getLineMaxColumn(s),c=g5(i.autoIndent,e,new G(s,l,s,l),i.languageConfigurationService);c&&(n=c.indentation+c.appendText)}return o&&(o===1&&(n=l3e(i,n)),o===3&&(n=lCe(i,n)),n=i.normalizeIndentation(n)),n||null}static _replaceJumpToNextIndent(i,e,t,o){let n="",r=t.getStartPosition();if(i.insertSpaces){let s=i.visibleColumnFromColumn(e,r),l=i.indentSize,c=l-s%l;for(let u=0;u<c;u++)n+=" "}else n="	";return new kg(t,n,o)}},aCe=class extends dce{constructor(i,e,t,o,n,r){super(i,e,t,o),this._openCharacter=n,this._closeCharacter=r,this.closeCharacterRange=null,this.enclosingRange=null}_computeCursorStateWithRange(i,e,t){return this.closeCharacterRange=new G(e.startLineNumber,e.endColumn-this._closeCharacter.length,e.endLineNumber,e.endColumn),this.enclosingRange=new G(e.startLineNumber,e.endColumn-this._openCharacter.length-this._closeCharacter.length,e.endLineNumber,e.endColumn),super.computeCursorState(i,t)}},hri=class extends aCe{constructor(i,e,t,o){let n=(t?e:"")+o,r=0,s=-o.length;super(i,n,r,s,e,o)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return this._computeCursorStateWithRange(i,o,e)}},gri=class extends aCe{constructor(i,e,t,o){let n=t+o,r=0,s=t.length;super(e,n,r,s,t,o),this._autoIndentationEdit=i,this._autoClosingEdit={range:e,text:n}}getEditOperations(i,e){e.addTrackedEditOperation(this._autoIndentationEdit.range,this._autoIndentationEdit.text),e.addTrackedEditOperation(this._autoClosingEdit.range,this._autoClosingEdit.text)}computeCursorState(i,e){let t=e.getInverseEditOperations();if(t.length!==2)throw new Error("There should be two inverse edit operations!");let o=t[0].range,n=t[1].range,r=o.plusRange(n);return this._computeCursorStateWithRange(i,r,e)}};function fri(a,i){return a===" "?i===5||i===6?6:5:4}function nIt(a,i){return P6i(a)&&!P6i(i)?!0:a===5?!1:M6i(a)!==M6i(i)}function M6i(a){return a===6||a===5?"space":a}function P6i(a){return a===4||a===5||a===6}function A6i(a,i,e,t,o){if(a.autoClosingOvertype==="never"||!a.autoClosingPairs.autoClosingPairsCloseSingleChar.has(o))return!1;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(!s.isEmpty())return!1;let l=s.getPosition(),c=i.getLineContent(l.lineNumber);if(c.charAt(l.column-1)!==o)return!1;let p=RB(o);if((l.column>2?c.charCodeAt(l.column-2):0)===92&&p)return!1;if(a.autoClosingOvertype==="auto"){let g=!1;for(let f=0,v=t.length;f<v;f++){let b=t[f];if(l.lineNumber===b.startLineNumber&&l.column===b.startColumn){g=!0;break}}if(!g)return!1}}return!0}function Cce(a,i,e){return e?new cce(a,i,!0):new kg(a,i,!0)}function l3e(a,i,e){return e=e||1,Fb.shiftIndent(i,i.length+e,a.tabSize,a.indentSize,a.insertSpaces)}function lCe(a,i,e){return e=e||1,Fb.unshiftIndent(i,i.length+e,a.tabSize,a.indentSize,a.insertSpaces)}function vri(a,i){return RB(i)?a.autoSurround==="quotes"||a.autoSurround==="languageDefined":a.autoSurround==="brackets"||a.autoSurround==="languageDefined"}var xA=class{static indent(i,e,t){if(e===null||t===null)return[];let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=new Fb(t[n],{isUnshift:!1,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService);return o}static outdent(i,e,t){let o=[];for(let n=0,r=t.length;n<r;n++)o[n]=new Fb(t[n],{isUnshift:!0,tabSize:i.tabSize,indentSize:i.indentSize,insertSpaces:i.insertSpaces,useTabStops:i.useTabStops,autoIndent:i.autoIndent},i.languageConfigurationService);return o}static shiftIndent(i,e,t){return l3e(i,e,t)}static unshiftIndent(i,e,t){return lCe(i,e,t)}static paste(i,e,t,o,n,r){return eIt.getEdits(i,e,t,o,n,r)}static tab(i,e,t){return oIt.getCommands(i,e,t)}static compositionType(i,e,t,o,n,r,s,l){return tIt.getEdits(i,e,t,o,n,r,s,l)}static compositionEndWithInterceptors(i,e,t,o,n,r){if(!o)return null;let s=null;for(let h of o)if(s===null)s=h.insertedText;else if(s!==h.insertedText)return null;if(!s||s.length!==1)return a3e.getEdits(e,o);let l=s,c=!1;for(let h of o)if(h.deletedText.length!==0){c=!0;break}if(c){if(!vri(e,l)||!e.surroundingPairs.hasOwnProperty(l))return null;let h=RB(l);for(let v of o)if(v.deletedSelectionStart!==0||v.deletedSelectionEnd!==v.deletedText.length||/^[ \t]+$/.test(v.deletedText)||h&&RB(v.deletedText))return null;let g=[];for(let v of n){if(!v.isEmpty())return null;g.push(v.getPosition())}if(g.length!==o.length)return null;let f=[];for(let v=0,b=g.length;v<b;v++)f.push(new qSt(g[v],o[v].deletedText,e.surroundingPairs[l]));return new Ob(4,f,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}let u=YSt.getEdits(e,t,n,r,l);if(u!==void 0)return u;let p=sCe.getEdits(e,t,n,l,!0,!1);return p!==void 0?p:a3e.getEdits(e,o)}static typeWithInterceptors(i,e,t,o,n,r,s){let l=f5.getEdits(t,o,n,s,i);if(l!==void 0)return l;let c=jSt.getEdits(t,o,n,s,i);if(c!==void 0)return c;let u=QSt.getEdits(e,t,o,n,r,s);if(u!==void 0)return u;let p=sCe.getEdits(t,o,n,s,!1,i);if(p!==void 0)return p;let h=XSt.getEdits(t,o,n,s,i);if(h!==void 0)return h;let g=JSt.getEdits(e,t,o,n,s,i);return g!==void 0?g:ZSt.getEdits(t,e,n,s,i)}static typeWithoutInterceptors(i,e,t,o,n){return iIt.getEdits(i,o,n)}},rIt=class{constructor(i,e,t,o,n,r,s){this.deletedText=i;this.deletedSelectionStart=e;this.deletedSelectionEnd=t;this.insertedText=o;this.insertedSelectionStart=n;this.insertedSelectionEnd=r;this.insertedTextRange=s}};function cCe(a){return!!a&&typeof a.id=="string"}var v5={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};var me;(Lo=>(Lo.editorSimpleInput=new Y("editorSimpleInput",!1,!0),Lo.editorTextFocus=new Y("editorTextFocus",!1,d(852,null)),Lo.focus=new Y("editorFocus",!1,d(825,null)),Lo.textInputFocus=new Y("textInputFocus",!1,d(863,null)),Lo.readOnly=new Y("editorReadonly",!1,d(849,null)),Lo.inDiffEditor=new Y("inDiffEditor",!1,d(854,null)),Lo.isEmbeddedDiffEditor=new Y("isEmbeddedDiffEditor",!1,d(857,null)),Lo.inMultiDiffEditor=new Y("inMultiDiffEditor",!1,d(855,null)),Lo.multiDiffEditorAllCollapsed=new Y("multiDiffEditorAllCollapsed",void 0,d(858,null)),Lo.hasChanges=new Y("diffEditorHasChanges",!1,d(817,null)),Lo.comparingMovedCode=new Y("comparingMovedCode",!1,d(816,null)),Lo.accessibleDiffViewerVisible=new Y("accessibleDiffViewerVisible",!1,d(815,null)),Lo.diffEditorRenderSideBySideInlineBreakpointReached=new Y("diffEditorRenderSideBySideInlineBreakpointReached",!1,d(823,null)),Lo.diffEditorInlineMode=new Y("diffEditorInlineMode",!1,d(818,null)),Lo.diffEditorOriginalWritable=new Y("diffEditorOriginalWritable",!1,d(822,null)),Lo.diffEditorModifiedWritable=new Y("diffEditorModifiedWritable",!1,d(820,null)),Lo.diffEditorOriginalUri=new Y("diffEditorOriginalUri","",d(821,null)),Lo.diffEditorModifiedUri=new Y("diffEditorModifiedUri","",d(819,null)),Lo.columnSelection=new Y("editorColumnSelection",!1,d(824,null)),Lo.writable=Lo.readOnly.toNegated(),Lo.hasNonEmptySelection=new Y("editorHasSelection",!1,d(843,null)),Lo.hasOnlyEmptySelection=Lo.hasNonEmptySelection.toNegated(),Lo.hasMultipleSelections=new Y("editorHasMultipleSelections",!1,d(840,null)),Lo.hasSingleSelection=Lo.hasMultipleSelections.toNegated(),Lo.tabMovesFocus=new Y("editorTabMovesFocus",!1,d(851,null)),Lo.tabDoesNotMoveFocus=Lo.tabMovesFocus.toNegated(),Lo.isInEmbeddedEditor=new Y("isInEmbeddedEditor",!1,!0),Lo.canUndo=new Y("canUndo",!1,!0),Lo.canRedo=new Y("canRedo",!1,!0),Lo.hoverVisible=new Y("editorHoverVisible",!1,d(847,null)),Lo.hoverFocused=new Y("editorHoverFocused",!1,d(846,null)),Lo.stickyScrollFocused=new Y("stickyScrollFocused",!1,d(861,null)),Lo.stickyScrollVisible=new Y("stickyScrollVisible",!1,d(862,null)),Lo.standaloneColorPickerVisible=new Y("standaloneColorPickerVisible",!1,d(860,null)),Lo.standaloneColorPickerFocused=new Y("standaloneColorPickerFocused",!1,d(859,null)),Lo.isComposing=new Y("isComposing",!1,d(856,null)),Lo.inCompositeEditor=new Y("inCompositeEditor",void 0,d(853,null)),Lo.notInCompositeEditor=Lo.inCompositeEditor.toNegated(),Lo.languageId=new Y("editorLangId","",d(848,null)),Lo.hasCompletionItemProvider=new Y("editorHasCompletionItemProvider",!1,d(828,null)),Lo.hasCodeActionsProvider=new Y("editorHasCodeActionsProvider",!1,d(826,null)),Lo.hasCodeLensProvider=new Y("editorHasCodeLensProvider",!1,d(827,null)),Lo.hasDefinitionProvider=new Y("editorHasDefinitionProvider",!1,d(830,null)),Lo.hasDeclarationProvider=new Y("editorHasDeclarationProvider",!1,d(829,null)),Lo.hasImplementationProvider=new Y("editorHasImplementationProvider",!1,d(836,null)),Lo.hasTypeDefinitionProvider=new Y("editorHasTypeDefinitionProvider",!1,d(845,null)),Lo.hasHoverProvider=new Y("editorHasHoverProvider",!1,d(835,null)),Lo.hasDocumentHighlightProvider=new Y("editorHasDocumentHighlightProvider",!1,d(832,null)),Lo.hasDocumentSymbolProvider=new Y("editorHasDocumentSymbolProvider",!1,d(834,null)),Lo.hasReferenceProvider=new Y("editorHasReferenceProvider",!1,d(841,null)),Lo.hasRenameProvider=new Y("editorHasRenameProvider",!1,d(842,null)),Lo.hasSignatureHelpProvider=new Y("editorHasSignatureHelpProvider",!1,d(844,null)),Lo.hasInlayHintsProvider=new Y("editorHasInlayHintsProvider",!1,d(837,null)),Lo.hasDocumentFormattingProvider=new Y("editorHasDocumentFormattingProvider",!1,d(831,null)),Lo.hasDocumentSelectionFormattingProvider=new Y("editorHasDocumentSelectionFormattingProvider",!1,d(833,null)),Lo.hasMultipleDocumentFormattingProvider=new Y("editorHasMultipleDocumentFormattingProvider",!1,d(838,null)),Lo.hasMultipleDocumentSelectionFormattingProvider=new Y("editorHasMultipleDocumentSelectionFormattingProvider",!1,d(839,null)),Lo.selectionHasDiagnostics=new Y("editorSelectionHasDiagnostics",!1,d(850,null))))(me||={});var sIt=class{constructor(){this.type=0}},aIt=class{constructor(){this.type=1}},lIt=class{constructor(i){this.type=2;this._source=i}hasChanged(i){return this._source.hasChanged(i)}},cIt=class{constructor(i,e,t){this.selections=i;this.modelSelections=e;this.reason=t;this.type=3}},Uz=class{constructor(i){this.type=4;i?(this.affectsMinimap=i.affectsMinimap,this.affectsOverviewRuler=i.affectsOverviewRuler,this.affectsGlyphMargin=i.affectsGlyphMargin,this.affectsLineNumber=i.affectsLineNumber):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0,this.affectsGlyphMargin=!0,this.affectsLineNumber=!0)}},xce=class{constructor(){this.type=5}},dIt=class{constructor(i){this.type=6;this.isFocused=i}},uIt=class{constructor(){this.type=7}},kce=class{constructor(){this.type=8}},d3e=class{constructor(i,e){this.fromLineNumber=i;this.count=e;this.type=9}},dCe=class{constructor(i,e){this.type=10;this.fromLineNumber=i,this.toLineNumber=e}},uCe=class{constructor(i,e){this.type=11;this.fromLineNumber=i,this.toLineNumber=e}};var b5=class{constructor(i,e,t,o,n,r,s){this.source=i;this.minimalReveal=e;this.range=t;this.selections=o;this.verticalType=n;this.revealHorizontal=r;this.scrollType=s;this.type=12}},pIt=class{constructor(i){this.type=13;this.scrollWidth=i.scrollWidth,this.scrollLeft=i.scrollLeft,this.scrollHeight=i.scrollHeight,this.scrollTop=i.scrollTop,this.scrollWidthChanged=i.scrollWidthChanged,this.scrollLeftChanged=i.scrollLeftChanged,this.scrollHeightChanged=i.scrollHeightChanged,this.scrollTopChanged=i.scrollTopChanged}},mIt=class{constructor(i){this.theme=i;this.type=14}},hIt=class{constructor(i){this.type=15;this.ranges=i}},gIt=class{constructor(){this.type=16}},fIt=class{constructor(){this.type=17}};function bri(a){let i=a;return typeof i?.resolve=="function"&&typeof i?.isResolved=="function"}function N6i(a,i,e){return i?.documentVersion===e?.documentVersion&&a.extUri.isEqual(i?.original,e?.original)&&a.extUri.isEqual(i?.modified,e?.modified)&&eo(i?.changes,e?.changes,(t,o)=>t[0]===o[0]&&t[1]===o[1]&&t[2]===o[2]&&t[3]===o[3])}var fc=0,Jm=class extends od{runEditorCommand(i,e,t){let o=e._getViewModel();o&&this.runCoreEditorCommand(o,t||{})}},Vw;(s=>{let a=function(l){if(!Di(l))return!1;let c=l;return!(!We(c.to)||!bn(c.by)&&!We(c.by)||!bn(c.value)&&!on(c.value)||!bn(c.revealCursor)&&!Xa(c.revealCursor))};s.metadata={description:"Scroll editor in the given direction",args:[{name:"Editor scroll argument object",description:"Property-value pairs that can be passed through this argument:\n					* 'to': A mandatory direction value.\n						```\n						'up', 'down'\n						```\n					* 'by': Unit to move. Default is computed based on 'to' value.\n						```\n						'line', 'wrappedLine', 'page', 'halfPage', 'editor'\n						```\n					* 'value': Number of units to move. Default is '1'.\n					* 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n				",constraint:a,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["up","down"]},by:{type:"string",enum:["line","wrappedLine","page","halfPage","editor"]},value:{type:"number",default:1},revealCursor:{type:"boolean"}}}}]},s.RawDirection={Up:"up",Right:"right",Down:"down",Left:"left"},s.RawUnit={Line:"line",WrappedLine:"wrappedLine",Page:"page",HalfPage:"halfPage",Editor:"editor",Column:"column"};function o(l){let c;switch(l.to){case s.RawDirection.Up:c=1;break;case s.RawDirection.Right:c=2;break;case s.RawDirection.Down:c=3;break;case s.RawDirection.Left:c=4;break;default:return null}let u;switch(l.by){case s.RawUnit.Line:u=1;break;case s.RawUnit.WrappedLine:u=2;break;case s.RawUnit.Page:u=3;break;case s.RawUnit.HalfPage:u=4;break;case s.RawUnit.Editor:u=5;break;case s.RawUnit.Column:u=6;break;default:u=2}let p=Math.floor(l.value||1),h=!!l.revealCursor;return{direction:c,unit:u,value:p,revealCursor:h,select:!!l.select}}s.parse=o;let n;(h=>(h[h.Up=1]="Up",h[h.Right=2]="Right",h[h.Down=3]="Down",h[h.Left=4]="Left"))(n=s.Direction||={});let r;(f=>(f[f.Line=1]="Line",f[f.WrappedLine=2]="WrappedLine",f[f.Page=3]="Page",f[f.HalfPage=4]="HalfPage",f[f.Editor=5]="Editor",f[f.Column=6]="Column"))(r=s.Unit||={})})(Vw||={});var u3e;(t=>{let a=function(o){if(!Di(o))return!1;let n=o;return!(!on(n.lineNumber)&&!We(n.lineNumber)||!bn(n.at)&&!We(n.at))};t.metadata={description:"Reveal the given line at the given logical position",args:[{name:"Reveal line argument object",description:"Property-value pairs that can be passed through this argument:\n					* 'lineNumber': A mandatory line number value.\n					* 'at': Logical position at which line has to be revealed.\n						```\n						'top', 'center', 'bottom'\n						```\n				",constraint:a,schema:{type:"object",required:["lineNumber"],properties:{lineNumber:{type:["number","string"]},at:{type:"string",enum:["top","center","bottom"]}}}}]},t.RawAtArgument={Top:"top",Center:"center",Bottom:"bottom"}})(u3e||={});var p3e=class{constructor(i){i.addImplementation(1e4,"code-editor",(e,t)=>{let o=e.get(Qt).getFocusedCodeEditor();return o&&o.hasTextFocus()?this._runEditorCommand(e,o,t):!1}),i.addImplementation(1e3,"generic-dom-input-textarea",(e,t)=>{let o=Un();return o&&Ch(o)?(this.runDOMCommand(o),!0):!1}),i.addImplementation(0,"generic-dom",(e,t)=>{let o=e.get(Qt).getActiveCodeEditor();return o?(o.focus(),this._runEditorCommand(e,o,t)):!1})}_runEditorCommand(i,e,t){let o=this.runEditorCommand(i,e,t);return o||!0}};var Vf;(_o=>{class a extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){if(!Ye.position)return;Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,[Wf.moveTo(Wt,Wt.getPrimaryCursorState(),this._inSelectionMode,Ye.position,Ye.viewPosition)])&&Ye.revealType!==2&&Wt.revealAllCursors(Ye.source,!0,!0)}}_o.MoveTo=ro(new a({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),_o.MoveToSelect=ro(new a({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends Jm{runCoreEditorCommand(Wt,Ye){Wt.model.pushStackElement();let we=this._getColumnSelectResult(Wt,Wt.getPrimaryCursorState(),Wt.getCursorColumnSelectData(),Ye);we!==null&&(Wt.setCursorStates(Ye.source,3,we.viewStates.map(Qe=>aa.fromViewState(Qe))),Wt.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:we.fromLineNumber,fromViewVisualColumn:we.fromVisualColumn,toViewLineNumber:we.toLineNumber,toViewVisualColumn:we.toVisualColumn}),we.reversed?Wt.revealTopMostCursor(Ye.source):Wt.revealBottomMostCursor(Ye.source))}}_o.ColumnSelect=ro(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(mn,Wt,Ye,we){if(typeof we.position>"u"||typeof we.viewPosition>"u"||typeof we.mouseColumn>"u")return null;let Qe=mn.model.validatePosition(we.position),Pt=mn.coordinatesConverter.validateViewPosition(new ye(we.viewPosition.lineNumber,we.viewPosition.column),Qe),qt=we.doColumnSelect?Ye.fromViewLineNumber:Pt.lineNumber,Oo=we.doColumnSelect?Ye.fromViewVisualColumn:we.mouseColumn-1;return OY.columnSelect(mn.cursorConfig,mn,qt,Oo,Pt.lineNumber,we.mouseColumn-1)}}),_o.CursorColumnSelectLeft=ro(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(mn,Wt,Ye,we){return OY.columnSelectLeft(mn.cursorConfig,mn,Ye)}}),_o.CursorColumnSelectRight=ro(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(mn,Wt,Ye,we){return OY.columnSelectRight(mn.cursorConfig,mn,Ye)}});class s extends t{constructor(Wt){super(Wt),this._isPaged=Wt.isPaged}_getColumnSelectResult(Wt,Ye,we,Qe){return OY.columnSelectUp(Wt.cursorConfig,Wt,we,this._isPaged)}}_o.CursorColumnSelectUp=ro(new s({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:3600,linux:{primary:0}}})),_o.CursorColumnSelectPageUp=ro(new s({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:3595,linux:{primary:0}}}));class u extends t{constructor(Wt){super(Wt),this._isPaged=Wt.isPaged}_getColumnSelectResult(Wt,Ye,we,Qe){return OY.columnSelectDown(Wt.cursorConfig,Wt,we,this._isPaged)}}_o.CursorColumnSelectDown=ro(new u({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:3602,linux:{primary:0}}})),_o.CursorColumnSelectPageDown=ro(new u({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:3596,linux:{primary:0}}}));class g extends Jm{constructor(){super({id:"cursorMove",precondition:void 0,metadata:Hs.metadata})}runCoreEditorCommand(Wt,Ye){let we=Hs.parse(Ye);we&&this._runCursorMove(Wt,Ye.source,we)}_runCursorMove(Wt,Ye,we){let Qe=we.noHistory?"api":Ye;Wt.model.pushStackElement(),Wt.setCursorStates(Qe,3,g._move(Wt,Wt.getCursorStates(),we)),Wt.revealAllCursors(Qe,!0)}static _move(Wt,Ye,we){let Qe=we.select,Pt=we.value;switch(we.direction){case Hs.Direction.Left:case Hs.Direction.Right:case Hs.Direction.Up:case Hs.Direction.Down:case Hs.Direction.PrevBlankLine:case Hs.Direction.NextBlankLine:case Hs.Direction.WrappedLineStart:case Hs.Direction.WrappedLineFirstNonWhitespaceCharacter:case Hs.Direction.WrappedLineColumnCenter:case Hs.Direction.WrappedLineEnd:case Hs.Direction.WrappedLineLastNonWhitespaceCharacter:return Wf.simpleMove(Wt,Ye,we.direction,Qe,Pt,we.unit);case Hs.Direction.ViewPortTop:case Hs.Direction.ViewPortBottom:case Hs.Direction.ViewPortCenter:case Hs.Direction.ViewPortIfOutside:return Wf.viewportMove(Wt,Ye,we.direction,Qe,Pt);default:return null}}}_o.CursorMoveImpl=g,_o.CursorMove=ro(new g);let v;(Wt=>Wt[Wt.PAGE_SIZE_MARKER=-1]="PAGE_SIZE_MARKER")(v||={});class b extends Jm{constructor(Wt){super(Wt),this._staticArgs=Wt.args}runCoreEditorCommand(Wt,Ye){let we=this._staticArgs;this._staticArgs.value===-1&&(we={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:Ye.pageSize||Wt.cursorConfig.pageSize}),Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,Wf.simpleMove(Wt,Wt.getCursorStates(),we.direction,we.select,we.value,we.unit)),Wt.revealAllCursors(Ye.source,!0)}}_o.CursorLeft=ro(new b({args:{direction:Hs.Direction.Left,unit:Hs.Unit.None,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),_o.CursorLeftSelect=ro(new b({args:{direction:Hs.Direction.Left,unit:Hs.Unit.None,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:1039}})),_o.CursorRight=ro(new b({args:{direction:Hs.Direction.Right,unit:Hs.Unit.None,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),_o.CursorRightSelect=ro(new b({args:{direction:Hs.Direction.Right,unit:Hs.Unit.None,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:1041}})),_o.CursorUp=ro(new b({args:{direction:Hs.Direction.Up,unit:Hs.Unit.WrappedLine,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),_o.CursorUpSelect=ro(new b({args:{direction:Hs.Direction.Up,unit:Hs.Unit.WrappedLine,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),_o.CursorPageUp=ro(new b({args:{direction:Hs.Direction.Up,unit:Hs.Unit.WrappedLine,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:11}})),_o.CursorPageUpSelect=ro(new b({args:{direction:Hs.Direction.Up,unit:Hs.Unit.WrappedLine,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:1035}})),_o.CursorDown=ro(new b({args:{direction:Hs.Direction.Down,unit:Hs.Unit.WrappedLine,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),_o.CursorDownSelect=ro(new b({args:{direction:Hs.Direction.Down,unit:Hs.Unit.WrappedLine,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),_o.CursorPageDown=ro(new b({args:{direction:Hs.Direction.Down,unit:Hs.Unit.WrappedLine,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:12}})),_o.CursorPageDownSelect=ro(new b({args:{direction:Hs.Direction.Down,unit:Hs.Unit.WrappedLine,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:1036}})),_o.CreateCursor=ro(new class extends Jm{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(mn,Wt){if(!Wt.position)return;let Ye;Wt.wholeLine?Ye=Wf.line(mn,mn.getPrimaryCursorState(),!1,Wt.position,Wt.viewPosition):Ye=Wf.moveTo(mn,mn.getPrimaryCursorState(),!1,Wt.position,Wt.viewPosition);let we=mn.getCursorStates();if(we.length>1){let Qe=Ye.modelState?Ye.modelState.position:null,Pt=Ye.viewState?Ye.viewState.position:null;for(let qt=0,Oo=we.length;qt<Oo;qt++){let ho=we[qt];if(!(Qe&&!ho.modelState.selection.containsPosition(Qe))&&!(Pt&&!ho.viewState.selection.containsPosition(Pt))){we.splice(qt,1),mn.model.pushStackElement(),mn.setCursorStates(Wt.source,3,we);return}}}we.push(Ye),mn.model.pushStackElement(),mn.setCursorStates(Wt.source,3,we)}}),_o.LastCursorMoveToSelect=ro(new class extends Jm{constructor(){super({id:"_lastCursorMoveToSelect",precondition:void 0})}runCoreEditorCommand(mn,Wt){if(!Wt.position)return;let Ye=mn.getLastAddedCursorIndex(),we=mn.getCursorStates(),Qe=we.slice(0);Qe[Ye]=Wf.moveTo(mn,we[Ye],!0,Wt.position,Wt.viewPosition),mn.model.pushStackElement(),mn.setCursorStates(Wt.source,3,Qe)}});class ce extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,Wf.moveToBeginningOfLine(Wt,Wt.getCursorStates(),this._inSelectionMode)),Wt.revealAllCursors(Ye.source,!0)}}_o.CursorHome=ro(new ce({inSelectionMode:!1,id:"cursorHome",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:14,mac:{primary:14,secondary:[2063]}}})),_o.CursorHomeSelect=ro(new ce({inSelectionMode:!0,id:"cursorHomeSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:1038,mac:{primary:1038,secondary:[3087]}}}));class xe extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,this._exec(Wt.getCursorStates())),Wt.revealAllCursors(Ye.source,!0)}_exec(Wt){let Ye=[];for(let we=0,Qe=Wt.length;we<Qe;we++){let Pt=Wt[we],qt=Pt.modelState.position.lineNumber;Ye[we]=aa.fromModelState(Pt.modelState.move(this._inSelectionMode,qt,1,0))}return Ye}}_o.CursorLineStart=ro(new xe({inSelectionMode:!1,id:"cursorLineStart",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:0,mac:{primary:287}}})),_o.CursorLineStartSelect=ro(new xe({inSelectionMode:!0,id:"cursorLineStartSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:0,mac:{primary:1311}}}));class Te extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,Wf.moveToEndOfLine(Wt,Wt.getCursorStates(),this._inSelectionMode,Ye.sticky||!1)),Wt.revealAllCursors(Ye.source,!0)}}_o.CursorEnd=ro(new Te({inSelectionMode:!1,id:"cursorEnd",precondition:void 0,kbOpts:{args:{sticky:!1},weight:fc,kbExpr:me.textInputFocus,primary:13,mac:{primary:13,secondary:[2065]}},metadata:{description:"Go to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:d(182,null),type:"boolean",default:!1}}}}]}})),_o.CursorEndSelect=ro(new Te({inSelectionMode:!0,id:"cursorEndSelect",precondition:void 0,kbOpts:{args:{sticky:!1},weight:fc,kbExpr:me.textInputFocus,primary:1037,mac:{primary:1037,secondary:[3089]}},metadata:{description:"Select to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:d(182,null),type:"boolean",default:!1}}}}]}}));class Oi extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,this._exec(Wt,Wt.getCursorStates())),Wt.revealAllCursors(Ye.source,!0)}_exec(Wt,Ye){let we=[];for(let Qe=0,Pt=Ye.length;Qe<Pt;Qe++){let qt=Ye[Qe],Oo=qt.modelState.position.lineNumber,ho=Wt.model.getLineMaxColumn(Oo);we[Qe]=aa.fromModelState(qt.modelState.move(this._inSelectionMode,Oo,ho,0))}return we}}_o.CursorLineEnd=ro(new Oi({inSelectionMode:!1,id:"cursorLineEnd",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:0,mac:{primary:291}}})),_o.CursorLineEndSelect=ro(new Oi({inSelectionMode:!0,id:"cursorLineEndSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:0,mac:{primary:1315}}}));class dn extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,Wf.moveToBeginningOfBuffer(Wt,Wt.getCursorStates(),this._inSelectionMode)),Wt.revealAllCursors(Ye.source,!0)}}_o.CursorTop=ro(new dn({inSelectionMode:!1,id:"cursorTop",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:2062,mac:{primary:2064}}})),_o.CursorTopSelect=ro(new dn({inSelectionMode:!0,id:"cursorTopSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:3086,mac:{primary:3088}}}));class ln extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,Wf.moveToEndOfBuffer(Wt,Wt.getCursorStates(),this._inSelectionMode)),Wt.revealAllCursors(Ye.source,!0)}}_o.CursorBottom=ro(new ln({inSelectionMode:!1,id:"cursorBottom",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:2061,mac:{primary:2066}}})),_o.CursorBottomSelect=ro(new ln({inSelectionMode:!0,id:"cursorBottomSelect",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:3085,mac:{primary:3090}}}));class Bn extends Jm{constructor(){super({id:"editorScroll",precondition:void 0,metadata:Vw.metadata})}determineScrollMethod(Wt){let Ye=[6],we=[1,2,3,4,5],Qe=[4,2],Pt=[1,3];return Ye.includes(Wt.unit)&&Qe.includes(Wt.direction)?this._runHorizontalEditorScroll.bind(this):we.includes(Wt.unit)&&Pt.includes(Wt.direction)?this._runVerticalEditorScroll.bind(this):null}runCoreEditorCommand(Wt,Ye){let we=Vw.parse(Ye);if(!we)return;let Qe=this.determineScrollMethod(we);Qe&&Qe(Wt,Ye.source,we)}_runVerticalEditorScroll(Wt,Ye,we){let Qe=this._computeDesiredScrollTop(Wt,we);if(we.revealCursor){let Pt=Wt.getCompletelyVisibleViewRangeAtScrollTop(Qe),qt=Wt.getViewRangeWithCursorPadding(Pt);Wt.setCursorStates(Ye,3,[Wf.findPositionInViewportIfOutside(Wt,Wt.getPrimaryCursorState(),qt,we.select)])}Wt.viewLayout.setScrollPosition({scrollTop:Qe},0)}_computeDesiredScrollTop(Wt,Ye){if(Ye.unit===1){let Pt=Wt.viewLayout.getFutureViewport(),qt=Wt.getCompletelyVisibleViewRangeAtScrollTop(Pt.top),Oo=Wt.coordinatesConverter.convertViewRangeToModelRange(qt),ho;Ye.direction===1?ho=Math.max(1,Oo.startLineNumber-Ye.value):ho=Math.min(Wt.model.getLineCount(),Oo.startLineNumber+Ye.value);let zr=Wt.coordinatesConverter.convertModelPositionToViewPosition(new ye(ho,1));return Wt.viewLayout.getVerticalOffsetForLineNumber(zr.lineNumber)}if(Ye.unit===5){let Pt=0;return Ye.direction===3&&(Pt=Wt.model.getLineCount()-Wt.cursorConfig.pageSize),Wt.viewLayout.getVerticalOffsetForLineNumber(Pt)}let we;Ye.unit===3?we=Wt.cursorConfig.pageSize*Ye.value:Ye.unit===4?we=Math.round(Wt.cursorConfig.pageSize/2)*Ye.value:we=Ye.value;let Qe=(Ye.direction===1?-1:1)*we;return Wt.viewLayout.getCurrentScrollTop()+Qe*Wt.cursorConfig.lineHeight}_runHorizontalEditorScroll(Wt,Ye,we){let Qe=this._computeDesiredScrollLeft(Wt,we);Wt.viewLayout.setScrollPosition({scrollLeft:Qe},0)}_computeDesiredScrollLeft(Wt,Ye){let we=(Ye.direction===4?-1:1)*Ye.value;return Wt.viewLayout.getCurrentScrollLeft()+we*Wt.cursorConfig.typicalHalfwidthCharacterWidth}}_o.EditorScrollImpl=Bn,_o.EditorScroll=ro(new Bn),_o.ScrollLineUp=ro(new class extends Jm{constructor(){super({id:"scrollLineUp",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:2064,mac:{primary:267}}})}runCoreEditorCommand(mn,Wt){_o.EditorScroll.runCoreEditorCommand(mn,{to:Vw.RawDirection.Up,by:Vw.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:Wt.source})}}),_o.ScrollPageUp=ro(new class extends Jm{constructor(){super({id:"scrollPageUp",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:2059,win:{primary:523},linux:{primary:523}}})}runCoreEditorCommand(mn,Wt){_o.EditorScroll.runCoreEditorCommand(mn,{to:Vw.RawDirection.Up,by:Vw.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:Wt.source})}}),_o.ScrollEditorTop=ro(new class extends Jm{constructor(){super({id:"scrollEditorTop",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus}})}runCoreEditorCommand(mn,Wt){_o.EditorScroll.runCoreEditorCommand(mn,{to:Vw.RawDirection.Up,by:Vw.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:Wt.source})}}),_o.ScrollLineDown=ro(new class extends Jm{constructor(){super({id:"scrollLineDown",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:2066,mac:{primary:268}}})}runCoreEditorCommand(mn,Wt){_o.EditorScroll.runCoreEditorCommand(mn,{to:Vw.RawDirection.Down,by:Vw.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:Wt.source})}}),_o.ScrollPageDown=ro(new class extends Jm{constructor(){super({id:"scrollPageDown",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:2060,win:{primary:524},linux:{primary:524}}})}runCoreEditorCommand(mn,Wt){_o.EditorScroll.runCoreEditorCommand(mn,{to:Vw.RawDirection.Down,by:Vw.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:Wt.source})}}),_o.ScrollEditorBottom=ro(new class extends Jm{constructor(){super({id:"scrollEditorBottom",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus}})}runCoreEditorCommand(mn,Wt){_o.EditorScroll.runCoreEditorCommand(mn,{to:Vw.RawDirection.Down,by:Vw.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:Wt.source})}}),_o.ScrollLeft=ro(new class extends Jm{constructor(){super({id:"scrollLeft",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus}})}runCoreEditorCommand(mn,Wt){_o.EditorScroll.runCoreEditorCommand(mn,{to:Vw.RawDirection.Left,by:Vw.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:Wt.source})}}),_o.ScrollRight=ro(new class extends Jm{constructor(){super({id:"scrollRight",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus}})}runCoreEditorCommand(mn,Wt){_o.EditorScroll.runCoreEditorCommand(mn,{to:Vw.RawDirection.Right,by:Vw.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:Wt.source})}});class kc extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){Ye.position&&(Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,[Wf.word(Wt,Wt.getPrimaryCursorState(),this._inSelectionMode,Ye.position)]),Ye.revealType!==2&&Wt.revealAllCursors(Ye.source,!0,!0))}}_o.WordSelect=ro(new kc({inSelectionMode:!1,id:"_wordSelect",precondition:void 0})),_o.WordSelectDrag=ro(new kc({inSelectionMode:!0,id:"_wordSelectDrag",precondition:void 0})),_o.LastCursorWordSelect=ro(new class extends Jm{constructor(){super({id:"lastCursorWordSelect",precondition:void 0})}runCoreEditorCommand(mn,Wt){if(!Wt.position)return;let Ye=mn.getLastAddedCursorIndex(),we=mn.getCursorStates(),Qe=we.slice(0),Pt=we[Ye];Qe[Ye]=Wf.word(mn,Pt,Pt.modelState.hasSelection(),Wt.position),mn.model.pushStackElement(),mn.setCursorStates(Wt.source,3,Qe)}});class rl extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){Ye.position&&(Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,[Wf.line(Wt,Wt.getPrimaryCursorState(),this._inSelectionMode,Ye.position,Ye.viewPosition)]),Ye.revealType!==2&&Wt.revealAllCursors(Ye.source,!1,!0))}}_o.LineSelect=ro(new rl({inSelectionMode:!1,id:"_lineSelect",precondition:void 0})),_o.LineSelectDrag=ro(new rl({inSelectionMode:!0,id:"_lineSelectDrag",precondition:void 0}));class Cm extends Jm{constructor(Wt){super(Wt),this._inSelectionMode=Wt.inSelectionMode}runCoreEditorCommand(Wt,Ye){if(!Ye.position)return;let we=Wt.getLastAddedCursorIndex(),Qe=Wt.getCursorStates(),Pt=Qe.slice(0);Pt[we]=Wf.line(Wt,Qe[we],this._inSelectionMode,Ye.position,Ye.viewPosition),Wt.model.pushStackElement(),Wt.setCursorStates(Ye.source,3,Pt)}}_o.LastCursorLineSelect=ro(new Cm({inSelectionMode:!1,id:"lastCursorLineSelect",precondition:void 0})),_o.LastCursorLineSelectDrag=ro(new Cm({inSelectionMode:!0,id:"lastCursorLineSelectDrag",precondition:void 0})),_o.CancelSelection=ro(new class extends Jm{constructor(){super({id:"cancelSelection",precondition:me.hasNonEmptySelection,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(mn,Wt){mn.model.pushStackElement(),mn.setCursorStates(Wt.source,3,[Wf.cancelSelection(mn,mn.getPrimaryCursorState())]),mn.revealAllCursors(Wt.source,!0)}}),_o.RemoveSecondaryCursors=ro(new class extends Jm{constructor(){super({id:"removeSecondaryCursors",precondition:me.hasMultipleSelections,kbOpts:{weight:fc+1,kbExpr:me.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(mn,Wt){mn.model.pushStackElement(),mn.setCursorStates(Wt.source,3,[mn.getPrimaryCursorState()]),mn.revealAllCursors(Wt.source,!0),Er(d(181,null))}}),_o.RevealLine=ro(new class extends Jm{constructor(){super({id:"revealLine",precondition:void 0,metadata:u3e.metadata})}runCoreEditorCommand(mn,Wt){let Ye=Wt,we=Ye.lineNumber||0,Qe=typeof we=="number"?we+1:parseInt(we)+1;Qe<1&&(Qe=1);let Pt=mn.model.getLineCount();Qe>Pt&&(Qe=Pt);let qt=new G(Qe,1,Qe,mn.model.getLineMaxColumn(Qe)),Oo=0;if(Ye.at)switch(Ye.at){case u3e.RawAtArgument.Top:Oo=3;break;case u3e.RawAtArgument.Center:Oo=1;break;case u3e.RawAtArgument.Bottom:Oo=4;break;default:break}let ho=mn.coordinatesConverter.convertModelRangeToViewRange(qt);mn.revealRange(Wt.source,!1,ho,Oo,0)}}),_o.SelectAll=new class extends p3e{constructor(){super(lSt)}runDOMCommand(mn){ed&&(mn.focus(),mn.select()),mn.ownerDocument.execCommand("selectAll")}runEditorCommand(mn,Wt,Ye){let we=Wt._getViewModel();we&&this.runCoreEditorCommand(we,Ye)}runCoreEditorCommand(mn,Wt){mn.model.pushStackElement(),mn.setCursorStates("keyboard",3,[Wf.selectAll(mn,mn.getPrimaryCursorState())])}},_o.SetSelection=ro(new class extends Jm{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(mn,Wt){Wt.selection&&(mn.model.pushStackElement(),mn.setCursorStates(Wt.source,3,[aa.fromModelSelection(Wt.selection)]))}})})(Vf||={});var h2o=C.and(me.textInputFocus,me.columnSelection);function hCe(a,i){xt.registerKeybindingRule({id:a,primary:i,when:h2o,weight:fc+1})}hCe(Vf.CursorColumnSelectLeft.id,1039);hCe(Vf.CursorColumnSelectRight.id,1041);hCe(Vf.CursorColumnSelectUp.id,1040);hCe(Vf.CursorColumnSelectPageUp.id,1035);hCe(Vf.CursorColumnSelectDown.id,1042);hCe(Vf.CursorColumnSelectPageDown.id,1036);function O6i(a){return a.register(),a}var VL;(l=>{class a extends od{runEditorCommand(u,p,h){let g=p._getViewModel();g&&this.runCoreEditingCommand(p,g,h||{})}}l.CoreEditingCommand=a,l.LineBreakInsert=ro(new class extends a{constructor(){super({id:"lineBreakInsert",precondition:me.writable,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,f5.lineBreakInsert(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection)))}}),l.Outdent=ro(new class extends a{constructor(){super({id:"outdent",precondition:me.writable,kbOpts:{weight:fc,kbExpr:C.and(me.editorTextFocus,me.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,xA.outdent(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection))),c.pushUndoStop()}}),l.Tab=ro(new class extends a{constructor(){super({id:"tab",precondition:me.writable,kbOpts:{weight:fc,kbExpr:C.and(me.editorTextFocus,me.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(c,u,p){c.pushUndoStop(),c.executeCommands(this.id,xA.tab(u.cursorConfig,u.model,u.getCursorStates().map(h=>h.modelState.selection))),c.pushUndoStop()}}),l.DeleteLeft=ro(new class extends a{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(c,u,p){let[h,g]=bF.deleteLeft(u.getPrevEditOperationType(),u.cursorConfig,u.model,u.getCursorStates().map(f=>f.modelState.selection),u.getCursorAutoClosedCharacters());h&&c.pushUndoStop(),c.executeCommands(this.id,g),u.setPrevEditOperationType(2)}}),l.DeleteRight=ro(new class extends a{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:fc,kbExpr:me.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(c,u,p){let[h,g]=bF.deleteRight(u.getPrevEditOperationType(),u.cursorConfig,u.model,u.getCursorStates().map(f=>f.modelState.selection));h&&c.pushUndoStop(),c.executeCommands(this.id,g),u.setPrevEditOperationType(3)}}),l.Undo=new class extends p3e{constructor(){super(pD)}runDOMCommand(c){c.ownerDocument.execCommand("undo")}runEditorCommand(c,u,p){if(!(!u.hasModel()||u.getOption(104)===!0))return u.getModel().undo()}},l.Redo=new class extends p3e{constructor(){super(mD)}runDOMCommand(c){c.ownerDocument.execCommand("redo")}runEditorCommand(c,u,p){if(!(!u.hasModel()||u.getOption(104)===!0))return u.getModel().redo()}}})(VL||={});var vIt=class extends nce{constructor(i,e,t){super({id:i,precondition:void 0,metadata:t}),this._handlerId=e}runCommand(i,e){let t=i.get(Qt).getFocusedCodeEditor();t&&t.trigger("keyboard",this._handlerId,e)}};function Ece(a,i){O6i(new vIt("default:"+a,a)),O6i(new vIt(a,a,i))}Ece("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]});Ece("replacePreviousChar");Ece("compositionType");Ece("compositionStart");Ece("compositionEnd");Ece("paste");Ece("cut");var Qs=le("editorWorkerService");var F6i="default",g2o="$initialize",W6i=!1;function IIt(a){Ft&&(W6i||(W6i=!0,console.warn("Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq")),console.warn(a.message))}var Sri=class{constructor(i,e,t,o,n){this.vsWorker=i;this.req=e;this.channel=t;this.method=o;this.args=n;this.type=0}},bIt=class{constructor(i,e,t,o){this.vsWorker=i;this.seq=e;this.res=t;this.err=o;this.type=1}},Iri=class{constructor(i,e,t,o,n){this.vsWorker=i;this.req=e;this.channel=t;this.eventName=o;this.arg=n;this.type=2}},yri=class{constructor(i,e,t){this.vsWorker=i;this.req=e;this.event=t;this.type=3}},wri=class{constructor(i,e){this.vsWorker=i;this.req=e;this.type=4}},Cri=class{constructor(i){this._workerId=-1,this._handler=i,this._lastSentReq=0,this._pendingReplies=Object.create(null),this._pendingEmitters=new Map,this._pendingEvents=new Map}setWorkerId(i){this._workerId=i}async sendMessage(i,e,t){let o=String(++this._lastSentReq);return new Promise((n,r)=>{this._pendingReplies[o]={resolve:n,reject:r},this._send(new Sri(this._workerId,o,i,e,t))})}listen(i,e,t){let o=null,n=new T({onWillAddFirstListener:()=>{o=String(++this._lastSentReq),this._pendingEmitters.set(o,n),this._send(new Iri(this._workerId,o,i,e,t))},onDidRemoveLastListener:()=>{this._pendingEmitters.delete(o),this._send(new wri(this._workerId,o)),o=null}});return n.event}handleMessage(i){!i||!i.vsWorker||this._workerId!==-1&&i.vsWorker!==this._workerId||this._handleMessage(i)}createProxyToRemoteChannel(i,e){let t={get:(o,n)=>(typeof n=="string"&&!o[n]&&(B6i(n)?o[n]=r=>this.listen(i,n,r):V6i(n)?o[n]=this.listen(i,n,void 0):n.charCodeAt(0)===36&&(o[n]=async(...r)=>(await e?.(),this.sendMessage(i,n,r)))),o[n])};return new Proxy(Object.create(null),t)}_handleMessage(i){switch(i.type){case 1:return this._handleReplyMessage(i);case 0:return this._handleRequestMessage(i);case 2:return this._handleSubscribeEventMessage(i);case 3:return this._handleEventMessage(i);case 4:return this._handleUnsubscribeEventMessage(i)}}_handleReplyMessage(i){if(!this._pendingReplies[i.seq]){console.warn("Got reply to unknown seq");return}let e=this._pendingReplies[i.seq];if(delete this._pendingReplies[i.seq],i.err){let t=i.err;if(i.err.$isError){let o=new Error;o.name=i.err.name,o.message=i.err.message,o.stack=i.err.stack,t=o}e.reject(t);return}e.resolve(i.res)}_handleRequestMessage(i){let e=i.req;this._handler.handleMessage(i.channel,i.method,i.args).then(o=>{this._send(new bIt(this._workerId,e,o,void 0))},o=>{o.detail instanceof Error&&(o.detail=Aj(o.detail)),this._send(new bIt(this._workerId,e,void 0,Aj(o)))})}_handleSubscribeEventMessage(i){let e=i.req,t=this._handler.handleEvent(i.channel,i.eventName,i.arg)(o=>{this._send(new yri(this._workerId,e,o))});this._pendingEvents.set(e,t)}_handleEventMessage(i){let e=this._pendingEmitters.get(i.req);if(e===void 0){console.warn("Got event for unknown req");return}e.fire(i.event)}_handleUnsubscribeEventMessage(i){let e=this._pendingEvents.get(i.req);if(e===void 0){console.warn("Got unsubscribe for unknown req");return}e.dispose(),this._pendingEvents.delete(i.req)}_send(i){let e=[];if(i.type===0)for(let t=0;t<i.args.length;t++){let o=i.args[t];o instanceof ArrayBuffer&&e.push(o)}else i.type===1&&i.res instanceof ArrayBuffer&&e.push(i.res);this._handler.sendMessage(i,e)}},SIt=class extends k{constructor(e){super();this._localChannels=new Map;this._remoteChannels=new Map;this._worker=this._register(e),this._register(this._worker.onMessage(t=>{this._protocol.handleMessage(t)})),this._register(this._worker.onError(t=>{IIt(t),mt(t)})),this._protocol=new Cri({sendMessage:(t,o)=>{this._worker.postMessage(t,o)},handleMessage:(t,o,n)=>this._handleMessage(t,o,n),handleEvent:(t,o,n)=>this._handleEvent(t,o,n)}),this._protocol.setWorkerId(this._worker.getId()),this._onModuleLoaded=this._protocol.sendMessage(F6i,g2o,[this._worker.getId()]).then(()=>{}),this.proxy=this._protocol.createProxyToRemoteChannel(F6i,async()=>{await this._onModuleLoaded}),this._onModuleLoaded.catch(t=>{this._onError("Worker failed to load ",t)})}_handleMessage(e,t,o){let n=this._localChannels.get(e);if(!n)return Promise.reject(new Error(`Missing channel ${e} on main thread`));let r=n[t];if(typeof r!="function")return Promise.reject(new Error(`Missing method ${t} on main thread channel ${e}`));try{return Promise.resolve(r.apply(n,o))}catch(s){return Promise.reject(s)}}_handleEvent(e,t,o){let n=this._localChannels.get(e);if(!n)throw new Error(`Missing channel ${e} on main thread`);if(B6i(t)){let r=n[t];if(typeof r!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);let s=r.call(n,o);if(typeof s!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);return s}if(V6i(t)){let r=n[t];if(typeof r!="function")throw new Error(`Missing event ${t} on main thread channel ${e}.`);return r}throw new Error(`Malformed event name ${t}`)}setChannel(e,t){this._localChannels.set(e,t)}getChannel(e){let t=this._remoteChannels.get(e);return t===void 0&&(t=this._protocol.createProxyToRemoteChannel(e,async()=>{await this._onModuleLoaded}),this._remoteChannels.set(e,t)),t}_onError(e,t){console.error(e),console.info(t)}};function V6i(a){return a[0]==="o"&&a[1]==="n"&&sT(a.charCodeAt(2))}function B6i(a){return/^onDynamic/.test(a)&&sT(a.charCodeAt(9))}var Ak=class{constructor(i){this.esmModuleLocation=i.esmModuleLocation,this.esmModuleLocationBundler=i.esmModuleLocationBundler,this.label=i.label}};var Bw=le("IWebWorkerService");var Qn=class{static insert(i,e){return{range:new G(i.lineNumber,i.column,i.lineNumber,i.column),text:e,forceMoveMarkers:!0}}static delete(i){return{range:i,text:null}}static replace(i,e){return{range:i,text:e}}static replaceMove(i,e){return{range:i,text:e,forceMoveMarkers:!0}}};var yIt=class{constructor(){this._tokenizationSupports=new Map;this._factories=new Map;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._colorMap=null}handleChange(i){this._onDidChange.fire({changedLanguages:i,changedColorMap:!1})}register(i,e){return this._tokenizationSupports.set(i,e),this.handleChange([i]),ee(()=>{this._tokenizationSupports.get(i)===e&&(this._tokenizationSupports.delete(i),this.handleChange([i]))})}get(i){return this._tokenizationSupports.get(i)||null}registerFactory(i,e){this._factories.get(i)?.dispose();let t=new xri(this,i,e);return this._factories.set(i,t),ee(()=>{let o=this._factories.get(i);!o||o!==t||(this._factories.delete(i),o.dispose())})}async getOrCreate(i){let e=this.get(i);if(e)return e;let t=this._factories.get(i);return!t||t.isResolved?null:(await t.resolve(),this.get(i))}isResolved(i){if(this.get(i))return!0;let t=this._factories.get(i);return!!(!t||t.isResolved)}setColorMap(i){this._colorMap=i,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}},xri=class extends k{constructor(e,t,o){super();this._registry=e;this._languageId=t;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 h3e=class{constructor(i,e,t){this.offset=i;this.type=e;this.language=t;this._tokenBrand=void 0}toString(){return"("+this.offset+", "+this.type+")"}};var Tce=class{constructor(i,e,t){this.tokens=i;this.fontInfo=e;this.endState=t;this._encodedTokenizationResultBrand=void 0}};var Kz;(n=>{let a=new Map;a.set(0,L.symbolMethod),a.set(1,L.symbolFunction),a.set(2,L.symbolConstructor),a.set(3,L.symbolField),a.set(4,L.symbolVariable),a.set(5,L.symbolClass),a.set(6,L.symbolStruct),a.set(7,L.symbolInterface),a.set(8,L.symbolModule),a.set(9,L.symbolProperty),a.set(10,L.symbolEvent),a.set(11,L.symbolOperator),a.set(12,L.symbolUnit),a.set(13,L.symbolValue),a.set(15,L.symbolEnum),a.set(14,L.symbolConstant),a.set(15,L.symbolEnum),a.set(16,L.symbolEnumMember),a.set(17,L.symbolKeyword),a.set(28,L.symbolSnippet),a.set(18,L.symbolText),a.set(19,L.symbolColor),a.set(20,L.symbolFile),a.set(21,L.symbolReference),a.set(22,L.symbolCustomColor),a.set(23,L.symbolFolder),a.set(24,L.symbolTypeParameter),a.set(25,L.account),a.set(26,L.issues),a.set(27,L.tools);function i(r){let s=a.get(r);return s||(console.info("No codicon found for CompletionItemKind "+r),s=L.symbolProperty),s}n.toIcon=i;function e(r){switch(r){case 0:return d(903,null);case 1:return d(899,null);case 2:return d(891,null);case 3:return d(896,null);case 4:return d(916,null);case 5:return d(888,null);case 6:return d(909,null);case 7:return d(900,null);case 8:return d(904,null);case 9:return d(906,null);case 10:return d(895,null);case 11:return d(905,null);case 12:return d(913,null);case 13:return d(915,null);case 14:return d(890,null);case 15:return d(893,null);case 16:return d(894,null);case 17:return d(902,null);case 18:return d(910,null);case 19:return d(889,null);case 20:return d(897,null);case 21:return d(907,null);case 22:return d(892,null);case 23:return d(898,null);case 24:return d(912,null);case 25:return d(914,null);case 26:return d(901,null);case 27:return d(911,null);case 28:return d(908,null);default:return""}}n.toLabel=e;let t=new Map;t.set("method",0),t.set("function",1),t.set("constructor",2),t.set("field",3),t.set("variable",4),t.set("class",5),t.set("struct",6),t.set("interface",7),t.set("module",8),t.set("property",9),t.set("event",10),t.set("operator",11),t.set("unit",12),t.set("value",13),t.set("constant",14),t.set("enum",15),t.set("enum-member",16),t.set("enumMember",16),t.set("keyword",17),t.set("snippet",28),t.set("text",18),t.set("color",19),t.set("file",20),t.set("reference",21),t.set("customcolor",22),t.set("folder",23),t.set("type-parameter",24),t.set("typeParameter",24),t.set("account",25),t.set("issue",26),t.set("tool",27);function o(r,s){let l=t.get(r);return typeof l>"u"&&!s&&(l=9),l}n.fromString=o})(Kz||={});var wIt=class{constructor(i,e,t,o){this.range=i;this.text=e;this.completionKind=t;this.isSnippetText=o}equals(i){return G.lift(this.range).equalsRange(i.range)&&this.text===i.text&&this.completionKind===i.completionKind&&this.isSnippetText===i.isSnippetText}};var zz=class a{constructor(i,e,t){this.extensionId=i;this.extensionVersion=e;this.providerId=t}static fromExtensionId(i){return new a(i,void 0,void 0)}toString(){let i="";return this.extensionId&&(i+=this.extensionId),this.extensionVersion&&(i+=`@${this.extensionVersion}`),this.providerId&&(i+=`:${this.providerId}`),i.length===0&&(i="unknown"),i}toStringWithoutVersion(){let i="";return this.extensionId&&(i+=this.extensionId),this.providerId&&(i+=`:${this.providerId}`),i}},CIt=class a{constructor(i,e){this.extensionId=i;this.version=e}static tryCreate(i,e){if(!(!i||!e))return new a(i,e)}toString(){return`${this.extensionId}@${this.version}`}};function H6i(a){return!!a&&A.isUri(a.uri)&&G.isIRange(a.range)&&(G.isIRange(a.originSelectionRange)||G.isIRange(a.targetSelectionRange))}function Bp(a){return!!a&&A.isUri(a.uri)&&G.isIRange(a.range)}var kri={17:d(864,null),16:d(865,null),4:d(866,null),13:d(867,null),8:d(868,null),9:d(869,null),21:d(870,null),23:d(871,null),7:d(872,null),0:d(873,null),11:d(874,null),10:d(875,null),19:d(876,null),5:d(877,null),1:d(878,null),2:d(879,null),20:d(880,null),15:d(881,null),18:d(882,null),24:d(883,null),3:d(884,null),6:d(885,null),14:d(886,null),22:d(887,null),25:d(918,null),12:d(919,null)};function kIt(a,i){return d(917,null,a,kri[i])}var Zm;(o=>{let a=new Map;a.set(0,L.symbolFile),a.set(1,L.symbolModule),a.set(2,L.symbolNamespace),a.set(3,L.symbolPackage),a.set(4,L.symbolClass),a.set(5,L.symbolMethod),a.set(6,L.symbolProperty),a.set(7,L.symbolField),a.set(8,L.symbolConstructor),a.set(9,L.symbolEnum),a.set(10,L.symbolInterface),a.set(11,L.symbolFunction),a.set(12,L.symbolVariable),a.set(13,L.symbolConstant),a.set(14,L.symbolString),a.set(15,L.symbolNumber),a.set(16,L.symbolBoolean),a.set(17,L.symbolArray),a.set(18,L.symbolObject),a.set(19,L.symbolKey),a.set(20,L.symbolNull),a.set(21,L.symbolEnumMember),a.set(22,L.symbolStruct),a.set(23,L.symbolEvent),a.set(24,L.symbolOperator),a.set(25,L.symbolTypeParameter);function i(n){let r=a.get(n);return r||(console.info("No codicon found for SymbolKind "+n),r=L.symbolProperty),r}o.toIcon=i;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 t(n){let r=e.get(n);return r===void 0&&(console.info("No completion kind found for SymbolKind "+n),r=20),r}o.toCompletionKind=t})(Zm||={});var hT=class{static asEditOperation(i){let e=G.lift(i.range);return e.isEmpty()?Qn.insert(e.getStartPosition(),i.text):Qn.replace(e,i.text)}static isTextEdit(i){let e=i;return typeof e.text=="string"&&G.isIRange(e.range)}},gT=class a{constructor(i){this.value=i}static{this.Comment=new a("comment")}static{this.Imports=new a("imports")}static{this.Region=new a("region")}static fromValue(i){switch(i){case"comment":return a.Comment;case"imports":return a.Imports;case"region":return a.Region}return new a(i)}};var _ce;(i=>{function a(e){return!e||typeof e!="object"?!1:typeof e.id=="string"&&typeof e.title=="string"}i.is=a})(_ce||={});var xIt=class{constructor(i){this.createSupport=i;this._tokenizationSupport=null}dispose(){this._tokenizationSupport&&this._tokenizationSupport.then(i=>{i&&i.dispose()})}get tokenizationSupport(){return this._tokenizationSupport||(this._tokenizationSupport=this.createSupport()),this._tokenizationSupport}},vc=new yIt;var MB=class{constructor(i,e,t,o){this.originalStart=i,this.originalLength=e,this.modifiedStart=t,this.modifiedLength=o}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}};var Dce=class{constructor(i){this.source=i}getElements(){let i=this.source,e=new Int32Array(i.length);for(let t=0,o=i.length;t<o;t++)e[t]=i.charCodeAt(t);return e}};function U6i(a,i,e){return new kA(new Dce(a),new Dce(i)).ComputeDiff(e).changes}var UY=class{static Assert(i,e){if(!i)throw new Error(e)}},zY=class{static Copy(i,e,t,o,n){for(let r=0;r<n;r++)t[o+r]=i[e+r]}static Copy2(i,e,t,o,n){for(let r=0;r<n;r++)t[o+r]=i[e+r]}};var EIt=class{constructor(){this.m_changes=[],this.m_originalStart=1073741824,this.m_modifiedStart=1073741824,this.m_originalCount=0,this.m_modifiedCount=0}MarkNextChange(){(this.m_originalCount>0||this.m_modifiedCount>0)&&this.m_changes.push(new MB(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(i,e){this.m_originalStart=Math.min(this.m_originalStart,i),this.m_modifiedStart=Math.min(this.m_modifiedStart,e),this.m_originalCount++}AddModifiedElement(i,e){this.m_originalStart=Math.min(this.m_originalStart,i),this.m_modifiedStart=Math.min(this.m_modifiedStart,e),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}},kA=class a{constructor(i,e,t=null){this.ContinueProcessingPredicate=t,this._originalSequence=i,this._modifiedSequence=e;let[o,n,r]=a._getElements(i),[s,l,c]=a._getElements(e);this._hasStrings=r&&c,this._originalStringElements=o,this._originalElementsOrHash=n,this._modifiedStringElements=s,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(i){return i.length>0&&typeof i[0]=="string"}static _getElements(i){let e=i.getElements();if(a._isStringArray(e)){let t=new Int32Array(e.length);for(let o=0,n=e.length;o<n;o++)t[o]=xwe(e[o],0);return[e,t,!0]}return e instanceof Int32Array?[[],e,!1]:[[],new Int32Array(e),!1]}ElementsAreEqual(i,e){return this._originalElementsOrHash[i]!==this._modifiedElementsOrHash[e]?!1:this._hasStrings?this._originalStringElements[i]===this._modifiedStringElements[e]:!0}ElementsAreStrictEqual(i,e){if(!this.ElementsAreEqual(i,e))return!1;let t=a._getStrictElement(this._originalSequence,i),o=a._getStrictElement(this._modifiedSequence,e);return t===o}static _getStrictElement(i,e){return typeof i.getStrictElement=="function"?i.getStrictElement(e):null}OriginalElementsAreEqual(i,e){return this._originalElementsOrHash[i]!==this._originalElementsOrHash[e]?!1:this._hasStrings?this._originalStringElements[i]===this._originalStringElements[e]:!0}ModifiedElementsAreEqual(i,e){return this._modifiedElementsOrHash[i]!==this._modifiedElementsOrHash[e]?!1:this._hasStrings?this._modifiedStringElements[i]===this._modifiedStringElements[e]:!0}ComputeDiff(i){return this._ComputeDiff(0,this._originalElementsOrHash.length-1,0,this._modifiedElementsOrHash.length-1,i)}_ComputeDiff(i,e,t,o,n){let r=[!1],s=this.ComputeDiffRecursive(i,e,t,o,r);return n&&(s=this.PrettifyChanges(s)),{quitEarly:r[0],changes:s}}ComputeDiffRecursive(i,e,t,o,n){for(n[0]=!1;i<=e&&t<=o&&this.ElementsAreEqual(i,t);)i++,t++;for(;e>=i&&o>=t&&this.ElementsAreEqual(e,o);)e--,o--;if(i>e||t>o){let p;return t<=o?(UY.Assert(i===e+1,"originalStart should only be one more than originalEnd"),p=[new MB(i,0,t,o-t+1)]):i<=e?(UY.Assert(t===o+1,"modifiedStart should only be one more than modifiedEnd"),p=[new MB(i,e-i+1,t,0)]):(UY.Assert(i===e+1,"originalStart should only be one more than originalEnd"),UY.Assert(t===o+1,"modifiedStart should only be one more than modifiedEnd"),p=[]),p}let r=[0],s=[0],l=this.ComputeRecursionPoint(i,e,t,o,r,s,n),c=r[0],u=s[0];if(l!==null)return l;if(!n[0]){let p=this.ComputeDiffRecursive(i,c,t,u,n),h=[];return n[0]?h=[new MB(c+1,e-(c+1)+1,u+1,o-(u+1)+1)]:h=this.ComputeDiffRecursive(c+1,e,u+1,o,n),this.ConcatenateChanges(p,h)}return[new MB(i,e-i+1,t,o-t+1)]}WALKTRACE(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=null,x=null,E=new EIt,M=e,N=t,V=g[0]-b[0]-o,H=-1073741824,K=this.m_forwardHistory.length-1;do{let j=V+i;j===M||j<N&&c[j-1]<c[j+1]?(p=c[j+1],f=p-V-o,p<H&&E.MarkNextChange(),H=p,E.AddModifiedElement(p+1,f),V=j+1-i):(p=c[j-1]+1,f=p-V-o,p<H&&E.MarkNextChange(),H=p-1,E.AddOriginalElement(p,f+1),V=j-1-i),K>=0&&(c=this.m_forwardHistory[K],i=c[0],M=1,N=c.length-1)}while(--K>=-1);if(w=E.getReverseChanges(),y[0]){let j=g[0]+1,J=b[0]+1;if(w!==null&&w.length>0){let se=w[w.length-1];j=Math.max(j,se.getOriginalEnd()),J=Math.max(J,se.getModifiedEnd())}x=[new MB(j,h-j+1,J,v-J+1)]}else{E=new EIt,M=r,N=s,V=g[0]-b[0]-l,H=1073741824,K=S?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{let j=V+n;j===M||j<N&&u[j-1]>=u[j+1]?(p=u[j+1]-1,f=p-V-l,p>H&&E.MarkNextChange(),H=p+1,E.AddOriginalElement(p+1,f+1),V=j+1-n):(p=u[j-1],f=p-V-l,p>H&&E.MarkNextChange(),H=p,E.AddModifiedElement(p+1,f+1),V=j-1-n),K>=0&&(u=this.m_reverseHistory[K],n=u[0],M=1,N=u.length-1)}while(--K>=-1);x=E.getChanges()}return this.ConcatenateChanges(w,x)}ComputeRecursionPoint(i,e,t,o,n,r,s){let l=0,c=0,u=0,p=0,h=0,g=0;i--,t--,n[0]=0,r[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];let f=e-i+(o-t),v=f+1,b=new Int32Array(v),S=new Int32Array(v),y=o-t,w=e-i,x=i-t,E=e-o,N=(w-y)%2===0;b[y]=i,S[w]=e,s[0]=!1;for(let V=1;V<=f/2+1;V++){let H=0,K=0;u=this.ClipDiagonalBound(y-V,V,y,v),p=this.ClipDiagonalBound(y+V,V,y,v);for(let J=u;J<=p;J+=2){J===u||J<p&&b[J-1]<b[J+1]?l=b[J+1]:l=b[J-1]+1,c=l-(J-y)-x;let se=l;for(;l<e&&c<o&&this.ElementsAreEqual(l+1,c+1);)l++,c++;if(b[J]=l,l+c>H+K&&(H=l,K=c),!N&&Math.abs(J-w)<=V-1&&l>=S[J])return n[0]=l,r[0]=c,se<=S[J]&&V<=1448?this.WALKTRACE(y,u,p,x,w,h,g,E,b,S,l,e,n,c,o,r,N,s):null}let j=(H-i+(K-t)-V)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(H,j))return s[0]=!0,n[0]=H,r[0]=K,j>0&&V<=1448?this.WALKTRACE(y,u,p,x,w,h,g,E,b,S,l,e,n,c,o,r,N,s):(i++,t++,[new MB(i,e-i+1,t,o-t+1)]);h=this.ClipDiagonalBound(w-V,V,w,v),g=this.ClipDiagonalBound(w+V,V,w,v);for(let J=h;J<=g;J+=2){J===h||J<g&&S[J-1]>=S[J+1]?l=S[J+1]-1:l=S[J-1],c=l-(J-w)-E;let se=l;for(;l>i&&c>t&&this.ElementsAreEqual(l,c);)l--,c--;if(S[J]=l,N&&Math.abs(J-y)<=V&&l<=b[J])return n[0]=l,r[0]=c,se>=b[J]&&V<=1448?this.WALKTRACE(y,u,p,x,w,h,g,E,b,S,l,e,n,c,o,r,N,s):null}if(V<=1447){let J=new Int32Array(p-u+2);J[0]=y-u+1,zY.Copy2(b,u,J,1,p-u+1),this.m_forwardHistory.push(J),J=new Int32Array(g-h+2),J[0]=w-h+1,zY.Copy2(S,h,J,1,g-h+1),this.m_reverseHistory.push(J)}}return this.WALKTRACE(y,u,p,x,w,h,g,E,b,S,l,e,n,c,o,r,N,s)}PrettifyChanges(i){for(let e=0;e<i.length;e++){let t=i[e],o=e<i.length-1?i[e+1].originalStart:this._originalElementsOrHash.length,n=e<i.length-1?i[e+1].modifiedStart:this._modifiedElementsOrHash.length,r=t.originalLength>0,s=t.modifiedLength>0;for(;t.originalStart+t.originalLength<o&&t.modifiedStart+t.modifiedLength<n&&(!r||this.OriginalElementsAreEqual(t.originalStart,t.originalStart+t.originalLength))&&(!s||this.ModifiedElementsAreEqual(t.modifiedStart,t.modifiedStart+t.modifiedLength));){let c=this.ElementsAreStrictEqual(t.originalStart,t.modifiedStart);if(this.ElementsAreStrictEqual(t.originalStart+t.originalLength,t.modifiedStart+t.modifiedLength)&&!c)break;t.originalStart++,t.modifiedStart++}let l=[null];if(e<i.length-1&&this.ChangesOverlap(i[e],i[e+1],l)){i[e]=l[0],i.splice(e+1,1),e--;continue}}for(let e=i.length-1;e>=0;e--){let t=i[e],o=0,n=0;if(e>0){let p=i[e-1];o=p.originalStart+p.originalLength,n=p.modifiedStart+p.modifiedLength}let r=t.originalLength>0,s=t.modifiedLength>0,l=0,c=this._boundaryScore(t.originalStart,t.originalLength,t.modifiedStart,t.modifiedLength);for(let p=1;;p++){let h=t.originalStart-p,g=t.modifiedStart-p;if(h<o||g<n||r&&!this.OriginalElementsAreEqual(h,h+t.originalLength)||s&&!this.ModifiedElementsAreEqual(g,g+t.modifiedLength))break;let v=(h===o&&g===n?5:0)+this._boundaryScore(h,t.originalLength,g,t.modifiedLength);v>c&&(c=v,l=p)}t.originalStart-=l,t.modifiedStart-=l;let u=[null];if(e>0&&this.ChangesOverlap(i[e-1],i[e],u)){i[e-1]=u[0],i.splice(e,1),e++;continue}}if(this._hasStrings)for(let e=1,t=i.length;e<t;e++){let o=i[e-1],n=i[e],r=n.originalStart-o.originalStart-o.originalLength,s=o.originalStart,l=n.originalStart+n.originalLength,c=l-s,u=o.modifiedStart,p=n.modifiedStart+n.modifiedLength,h=p-u;if(r<5&&c<20&&h<20){let g=this._findBetterContiguousSequence(s,c,u,h,r);if(g){let[f,v]=g;(f!==o.originalStart+o.originalLength||v!==o.modifiedStart+o.modifiedLength)&&(o.originalLength=f-o.originalStart,o.modifiedLength=v-o.modifiedStart,n.originalStart=f+r,n.modifiedStart=v+r,n.originalLength=l-n.originalStart,n.modifiedLength=p-n.modifiedStart)}}}return i}_findBetterContiguousSequence(i,e,t,o,n){if(e<n||o<n)return null;let r=i+e-n+1,s=t+o-n+1,l=0,c=0,u=0;for(let p=i;p<r;p++)for(let h=t;h<s;h++){let g=this._contiguousSequenceScore(p,h,n);g>0&&g>l&&(l=g,c=p,u=h)}return l>0?[c,u]:null}_contiguousSequenceScore(i,e,t){let o=0;for(let n=0;n<t;n++){if(!this.ElementsAreEqual(i+n,e+n))return 0;o+=this._originalStringElements[i+n].length}return o}_OriginalIsBoundary(i){return i<=0||i>=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[i])}_OriginalRegionIsBoundary(i,e){if(this._OriginalIsBoundary(i)||this._OriginalIsBoundary(i-1))return!0;if(e>0){let t=i+e;if(this._OriginalIsBoundary(t-1)||this._OriginalIsBoundary(t))return!0}return!1}_ModifiedIsBoundary(i){return i<=0||i>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[i])}_ModifiedRegionIsBoundary(i,e){if(this._ModifiedIsBoundary(i)||this._ModifiedIsBoundary(i-1))return!0;if(e>0){let t=i+e;if(this._ModifiedIsBoundary(t-1)||this._ModifiedIsBoundary(t))return!0}return!1}_boundaryScore(i,e,t,o){let n=this._OriginalRegionIsBoundary(i,e)?1:0,r=this._ModifiedRegionIsBoundary(t,o)?1:0;return n+r}ConcatenateChanges(i,e){let t=[];if(i.length===0||e.length===0)return e.length>0?e:i;if(this.ChangesOverlap(i[i.length-1],e[0],t)){let o=new Array(i.length+e.length-1);return zY.Copy(i,0,o,0,i.length-1),o[i.length-1]=t[0],zY.Copy(e,1,o,i.length,e.length-1),o}else{let o=new Array(i.length+e.length);return zY.Copy(i,0,o,0,i.length),zY.Copy(e,0,o,i.length,e.length),o}}ChangesOverlap(i,e,t){if(UY.Assert(i.originalStart<=e.originalStart,"Left change is not less than or equal to right change"),UY.Assert(i.modifiedStart<=e.modifiedStart,"Left change is not less than or equal to right change"),i.originalStart+i.originalLength>=e.originalStart||i.modifiedStart+i.modifiedLength>=e.modifiedStart){let o=i.originalStart,n=i.originalLength,r=i.modifiedStart,s=i.modifiedLength;return i.originalStart+i.originalLength>=e.originalStart&&(n=e.originalStart+e.originalLength-i.originalStart),i.modifiedStart+i.modifiedLength>=e.modifiedStart&&(s=e.modifiedStart+e.modifiedLength-i.modifiedStart),t[0]=new MB(o,n,r,s),!0}else return t[0]=null,!1}ClipDiagonalBound(i,e,t,o){if(i>=0&&i<o)return i;let n=t,r=o-t-1,s=e%2===0;if(i<0){let l=n%2===0;return s===l?0:1}else{let l=r%2===0;return s===l?o-1:o-2}}},I5=new Uint32Array(65536),f2o=(a,i)=>{let e=a.length,t=i.length,o=1<<e-1,n=-1,r=0,s=e,l=e;for(;l--;)I5[a.charCodeAt(l)]|=1<<l;for(l=0;l<t;l++){let c=I5[i.charCodeAt(l)],u=c|r;c|=(c&n)+n^n,r|=~(c|n),n&=c,r&o&&s++,n&o&&s--,r=r<<1|1,n=n<<1|~(u|r),r&=u}for(l=e;l--;)I5[a.charCodeAt(l)]=0;return s};function v2o(a,i){let e=a.length,t=i.length,o=[],n=[],r=Math.ceil(e/32),s=Math.ceil(t/32);for(let f=0;f<r;f++)o[f]=-1,n[f]=0;let l=0;for(;l<s-1;l++){let f=0,v=-1,b=l*32,S=Math.min(32,t)+b;for(let y=b;y<S;y++)I5[i.charCodeAt(y)]|=1<<y;for(let y=0;y<e;y++){let w=I5[a.charCodeAt(y)],x=o[y/32|0]>>>y&1,E=n[y/32|0]>>>y&1,M=w|f,N=((w|E)&v)+v^v|w|E,V=f|~(N|v),H=v&N;V>>>31^x&&(o[y/32|0]^=1<<y),H>>>31^E&&(n[y/32|0]^=1<<y),V=V<<1|x,H=H<<1|E,v=H|~(M|V),f=V&M}for(let y=b;y<S;y++)I5[i.charCodeAt(y)]=0}let c=0,u=-1,p=l*32,h=Math.min(32,t-p)+p;for(let f=p;f<h;f++)I5[i.charCodeAt(f)]|=1<<f;let g=t;for(let f=0;f<e;f++){let v=I5[a.charCodeAt(f)],b=o[f/32|0]>>>f&1,S=n[f/32|0]>>>f&1,y=v|c,w=((v|S)&u)+u^u|v|S,x=c|~(w|u),E=u&w;g+=x>>>t-1&1,g-=E>>>t-1&1,x>>>31^b&&(o[f/32|0]^=1<<f),E>>>31^S&&(n[f/32|0]^=1<<f),x=x<<1|b,E=E<<1|S,u=E|~(y|x),c=x&y}for(let f=p;f<h;f++)I5[i.charCodeAt(f)]=0;return g}function z6i(a,i){if(a.length<i.length){let e=i;i=a,a=e}return i.length===0?a.length:a.length<=32?f2o(a,i):v2o(a,i)}var Tri=class{constructor(i,e,t){let o=new Uint8Array(i*e);for(let n=0,r=i*e;n<r;n++)o[n]=t;this._data=o,this.rows=i,this.cols=e}get(i,e){return this._data[i*this.cols+e]}set(i,e,t){this._data[i*this.cols+e]=t}},_ri=class{constructor(i){let e=0,t=0;for(let n=0,r=i.length;n<r;n++){let[s,l,c]=i[n];l>e&&(e=l),s>t&&(t=s),c>t&&(t=c)}e++,t++;let o=new Tri(t,e,0);for(let n=0,r=i.length;n<r;n++){let[s,l,c]=i[n];o.set(s,l,c)}this._states=o,this._maxCharCode=e}nextState(i,e){return e<0||e>=this._maxCharCode?0:this._states.get(i,e)}},Eri=null;function b2o(){return Eri===null&&(Eri=new _ri([[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]])),Eri}var g3e=null;function S2o(){if(g3e===null){g3e=new u5(0);let a=` 	<>'"\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<a.length;e++)g3e.set(a.charCodeAt(e),1);let i=".,;:";for(let e=0;e<i.length;e++)g3e.set(i.charCodeAt(e),2)}return g3e}var f3e=class a{static _createLink(i,e,t,o,n){let r=n-1;do{let s=e.charCodeAt(r);if(i.get(s)!==2)break;r--}while(r>o);if(o>0){let s=e.charCodeAt(o-1),l=e.charCodeAt(r);(s===40&&l===41||s===91&&l===93||s===123&&l===125)&&r--}return{range:{startLineNumber:t,startColumn:o+1,endLineNumber:t,endColumn:r+2},url:e.substring(o,r+1)}}static computeLinks(i,e=b2o()){let t=S2o(),o=[];for(let n=1,r=i.getLineCount();n<=r;n++){let s=i.getLineContent(n),l=s.length,c=0,u=0,p=0,h=1,g=!1,f=!1,v=!1,b=!1;for(;c<l;){let S=!1,y=s.charCodeAt(c);if(h===13){let w;switch(y){case 40:g=!0,w=0;break;case 41:w=g?0:1;break;case 91:v=!0,f=!0,w=0;break;case 93:v=!1,w=f?0:1;break;case 123:b=!0,w=0;break;case 125:w=b?0:1;break;case 39:case 34:case 96:p===y?w=1:p===39||p===34||p===96?w=0:w=1;break;case 42:w=p===42?1:0;break;case 32:w=v?0:1;break;default:w=t.get(y)}w===1&&(o.push(a._createLink(t,s,n,u,c)),S=!0)}else if(h===12){let w;y===91?(f=!0,w=0):w=t.get(y),w===1?S=!0:h=13}else h=e.nextState(h,y),h===0&&(S=!0);S&&(h=1,g=!1,f=!1,b=!1,u=c+1,p=y),c++}h===13&&o.push(a._createLink(t,s,n,u,l))}return o}};function K6i(a){return!a||typeof a.getLineCount!="function"||typeof a.getLineContent!="function"?[]:f3e.computeLinks(a)}var TIt=class a{constructor(){this._defaultValueSet=[["true","false"],["True","False"],["Private","Public","Friend","ReadOnly","Partial","Protected","WriteOnly"],["public","protected","private"]]}static{this.INSTANCE=new a}navigateValueSet(i,e,t,o,n){if(i&&e){let r=this.doNavigateValueSet(e,n);if(r)return{range:i,value:r}}if(t&&o){let r=this.doNavigateValueSet(o,n);if(r)return{range:t,value:r}}return null}doNavigateValueSet(i,e){let t=this.numberReplace(i,e);return t!==null?t:this.textReplace(i,e)}numberReplace(i,e){let t=Math.pow(10,i.length-(i.lastIndexOf(".")+1)),o=Number(i),n=parseFloat(i);return!isNaN(o)&&!isNaN(n)&&o===n?o===0&&!e?null:(o=Math.floor(o*t),o+=e?t:-t,String(o/t)):null}textReplace(i,e){return this.valueSetsReplace(this._defaultValueSet,i,e)}valueSetsReplace(i,e,t){let o=null;for(let n=0,r=i.length;o===null&&n<r;n++)o=this.valueSetReplace(i[n],e,t);return o}valueSetReplace(i,e,t){let o=i.indexOf(e);return o>=0?(o+=t?1:-1,o<0?o=i.length-1:o%=i.length,i[o]):null}};var Dri=(Nt=>(Nt[Nt.DependsOnKbLayout=-1]="DependsOnKbLayout",Nt[Nt.Unknown=0]="Unknown",Nt[Nt.Backspace=1]="Backspace",Nt[Nt.Tab=2]="Tab",Nt[Nt.Enter=3]="Enter",Nt[Nt.Shift=4]="Shift",Nt[Nt.Ctrl=5]="Ctrl",Nt[Nt.Alt=6]="Alt",Nt[Nt.PauseBreak=7]="PauseBreak",Nt[Nt.CapsLock=8]="CapsLock",Nt[Nt.Escape=9]="Escape",Nt[Nt.Space=10]="Space",Nt[Nt.PageUp=11]="PageUp",Nt[Nt.PageDown=12]="PageDown",Nt[Nt.End=13]="End",Nt[Nt.Home=14]="Home",Nt[Nt.LeftArrow=15]="LeftArrow",Nt[Nt.UpArrow=16]="UpArrow",Nt[Nt.RightArrow=17]="RightArrow",Nt[Nt.DownArrow=18]="DownArrow",Nt[Nt.Insert=19]="Insert",Nt[Nt.Delete=20]="Delete",Nt[Nt.Digit0=21]="Digit0",Nt[Nt.Digit1=22]="Digit1",Nt[Nt.Digit2=23]="Digit2",Nt[Nt.Digit3=24]="Digit3",Nt[Nt.Digit4=25]="Digit4",Nt[Nt.Digit5=26]="Digit5",Nt[Nt.Digit6=27]="Digit6",Nt[Nt.Digit7=28]="Digit7",Nt[Nt.Digit8=29]="Digit8",Nt[Nt.Digit9=30]="Digit9",Nt[Nt.KeyA=31]="KeyA",Nt[Nt.KeyB=32]="KeyB",Nt[Nt.KeyC=33]="KeyC",Nt[Nt.KeyD=34]="KeyD",Nt[Nt.KeyE=35]="KeyE",Nt[Nt.KeyF=36]="KeyF",Nt[Nt.KeyG=37]="KeyG",Nt[Nt.KeyH=38]="KeyH",Nt[Nt.KeyI=39]="KeyI",Nt[Nt.KeyJ=40]="KeyJ",Nt[Nt.KeyK=41]="KeyK",Nt[Nt.KeyL=42]="KeyL",Nt[Nt.KeyM=43]="KeyM",Nt[Nt.KeyN=44]="KeyN",Nt[Nt.KeyO=45]="KeyO",Nt[Nt.KeyP=46]="KeyP",Nt[Nt.KeyQ=47]="KeyQ",Nt[Nt.KeyR=48]="KeyR",Nt[Nt.KeyS=49]="KeyS",Nt[Nt.KeyT=50]="KeyT",Nt[Nt.KeyU=51]="KeyU",Nt[Nt.KeyV=52]="KeyV",Nt[Nt.KeyW=53]="KeyW",Nt[Nt.KeyX=54]="KeyX",Nt[Nt.KeyY=55]="KeyY",Nt[Nt.KeyZ=56]="KeyZ",Nt[Nt.Meta=57]="Meta",Nt[Nt.ContextMenu=58]="ContextMenu",Nt[Nt.F1=59]="F1",Nt[Nt.F2=60]="F2",Nt[Nt.F3=61]="F3",Nt[Nt.F4=62]="F4",Nt[Nt.F5=63]="F5",Nt[Nt.F6=64]="F6",Nt[Nt.F7=65]="F7",Nt[Nt.F8=66]="F8",Nt[Nt.F9=67]="F9",Nt[Nt.F10=68]="F10",Nt[Nt.F11=69]="F11",Nt[Nt.F12=70]="F12",Nt[Nt.F13=71]="F13",Nt[Nt.F14=72]="F14",Nt[Nt.F15=73]="F15",Nt[Nt.F16=74]="F16",Nt[Nt.F17=75]="F17",Nt[Nt.F18=76]="F18",Nt[Nt.F19=77]="F19",Nt[Nt.F20=78]="F20",Nt[Nt.F21=79]="F21",Nt[Nt.F22=80]="F22",Nt[Nt.F23=81]="F23",Nt[Nt.F24=82]="F24",Nt[Nt.NumLock=83]="NumLock",Nt[Nt.ScrollLock=84]="ScrollLock",Nt[Nt.Semicolon=85]="Semicolon",Nt[Nt.Equal=86]="Equal",Nt[Nt.Comma=87]="Comma",Nt[Nt.Minus=88]="Minus",Nt[Nt.Period=89]="Period",Nt[Nt.Slash=90]="Slash",Nt[Nt.Backquote=91]="Backquote",Nt[Nt.BracketLeft=92]="BracketLeft",Nt[Nt.Backslash=93]="Backslash",Nt[Nt.BracketRight=94]="BracketRight",Nt[Nt.Quote=95]="Quote",Nt[Nt.OEM_8=96]="OEM_8",Nt[Nt.IntlBackslash=97]="IntlBackslash",Nt[Nt.Numpad0=98]="Numpad0",Nt[Nt.Numpad1=99]="Numpad1",Nt[Nt.Numpad2=100]="Numpad2",Nt[Nt.Numpad3=101]="Numpad3",Nt[Nt.Numpad4=102]="Numpad4",Nt[Nt.Numpad5=103]="Numpad5",Nt[Nt.Numpad6=104]="Numpad6",Nt[Nt.Numpad7=105]="Numpad7",Nt[Nt.Numpad8=106]="Numpad8",Nt[Nt.Numpad9=107]="Numpad9",Nt[Nt.NumpadMultiply=108]="NumpadMultiply",Nt[Nt.NumpadAdd=109]="NumpadAdd",Nt[Nt.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",Nt[Nt.NumpadSubtract=111]="NumpadSubtract",Nt[Nt.NumpadDecimal=112]="NumpadDecimal",Nt[Nt.NumpadDivide=113]="NumpadDivide",Nt[Nt.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",Nt[Nt.ABNT_C1=115]="ABNT_C1",Nt[Nt.ABNT_C2=116]="ABNT_C2",Nt[Nt.AudioVolumeMute=117]="AudioVolumeMute",Nt[Nt.AudioVolumeUp=118]="AudioVolumeUp",Nt[Nt.AudioVolumeDown=119]="AudioVolumeDown",Nt[Nt.BrowserSearch=120]="BrowserSearch",Nt[Nt.BrowserHome=121]="BrowserHome",Nt[Nt.BrowserBack=122]="BrowserBack",Nt[Nt.BrowserForward=123]="BrowserForward",Nt[Nt.MediaTrackNext=124]="MediaTrackNext",Nt[Nt.MediaTrackPrevious=125]="MediaTrackPrevious",Nt[Nt.MediaStop=126]="MediaStop",Nt[Nt.MediaPlayPause=127]="MediaPlayPause",Nt[Nt.LaunchMediaPlayer=128]="LaunchMediaPlayer",Nt[Nt.LaunchMail=129]="LaunchMail",Nt[Nt.LaunchApp2=130]="LaunchApp2",Nt[Nt.Clear=131]="Clear",Nt[Nt.MAX_VALUE=132]="MAX_VALUE",Nt))(Dri||{}),Rri=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(Rri||{}),Lri=(e=>(e[e.Unnecessary=1]="Unnecessary",e[e.Deprecated=2]="Deprecated",e))(Lri||{});var Mri=(e=>(e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e))(Mri||{});var Pri=class{static{this.CtrlCmd=2048}static{this.Shift=1024}static{this.Alt=512}static{this.WinCtrl=256}static chord(i,e){return Gi(i,e)}};function G6i(){return{editor:void 0,languages:void 0,CancellationTokenSource:qe,Emitter:T,KeyCode:Dri,KeyMod:Pri,Position:ye,Range:G,Selection:ei,SelectionDirection:Mri,MarkerSeverity:Rri,MarkerTag:Lri,Uri:A,Token:h3e}}var y2o=999,Uw=class{constructor(i,e,t,o){this.searchString=i,this.isRegex=e,this.matchCase=t,this.wordSeparators=o}parseSearchRequest(){if(this.searchString==="")return null;let i;this.isRegex?i=v3e(this.searchString):i=this.searchString.indexOf(`
`)>=0;let e=null;try{e=Yj(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:i,global:!0,unicode:!0})}catch{return null}if(!e)return null;let t=!this.isRegex&&!i;return t&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(t=this.matchCase),new vSt(e,this.wordSeparators?mx(this.wordSeparators,[]):null,t?this.searchString:null)}};function v3e(a){if(!a||a.length===0)return!1;for(let i=0,e=a.length;i<e;i++){let t=a.charCodeAt(i);if(t===10)return!0;if(t===92){if(i++,i>=e)break;let o=a.charCodeAt(i);if(o===110||o===114||o===87)return!0}}return!1}function KY(a,i,e){if(!e)return new Fz(a,null);let t=[];for(let o=0,n=i.length;o<n;o++)t[o]=i[o];return new Fz(a,t)}var _It=class{constructor(i){let e=[],t=0;for(let o=0,n=i.length;o<n;o++)i.charCodeAt(o)===10&&(e[t++]=o);this._lineFeedsOffsets=e}findLineFeedCountBeforeOffset(i){let e=this._lineFeedsOffsets,t=0,o=e.length-1;if(o===-1||i<=e[0])return 0;for(;t<o;){let n=t+((o-t)/2>>0);e[n]>=i?o=n-1:e[n+1]>=i?(t=n,o=n):t=n+1}return t+1}},Rce=class{static findMatches(i,e,t,o,n){let r=e.parseSearchRequest();return r?r.regex.multiline?this._doFindMatchesMultiline(i,t,new Gz(r.wordSeparators,r.regex),o,n):this._doFindMatchesLineByLine(i,t,r,o,n):[]}static _getMultilineMatchRange(i,e,t,o,n,r){let s,l=0;o?(l=o.findLineFeedCountBeforeOffset(n),s=e+n+l):s=e+n;let c;if(o){let g=o.findLineFeedCountBeforeOffset(n+r.length)-l;c=s+r.length+g}else c=s+r.length;let u=i.getPositionAt(s),p=i.getPositionAt(c);return new G(u.lineNumber,u.column,p.lineNumber,p.column)}static _doFindMatchesMultiline(i,e,t,o,n){let r=i.getOffsetAt(e.getStartPosition()),s=i.getValueInRange(e,1),l=i.getEOL()===`\r
`?new _It(s):null,c=[],u=0,p;for(t.reset(0);p=t.next(s);)if(c[u++]=KY(this._getMultilineMatchRange(i,r,s,l,p.index,p[0]),p,o),u>=n)return c;return c}static _doFindMatchesLineByLine(i,e,t,o,n){let r=[],s=0;if(e.startLineNumber===e.endLineNumber){let c=i.getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);return s=this._findMatchesInLine(t,c,e.startLineNumber,e.startColumn-1,s,r,o,n),r}let l=i.getLineContent(e.startLineNumber).substring(e.startColumn-1);s=this._findMatchesInLine(t,l,e.startLineNumber,e.startColumn-1,s,r,o,n);for(let c=e.startLineNumber+1;c<e.endLineNumber&&s<n;c++)s=this._findMatchesInLine(t,i.getLineContent(c),c,0,s,r,o,n);if(s<n){let c=i.getLineContent(e.endLineNumber).substring(0,e.endColumn-1);s=this._findMatchesInLine(t,c,e.endLineNumber,0,s,r,o,n)}return r}static _findMatchesInLine(i,e,t,o,n,r,s,l){let c=i.wordSeparators;if(!s&&i.simpleSearch){let h=i.simpleSearch,g=h.length,f=e.length,v=-g;for(;(v=e.indexOf(h,v+g))!==-1;)if((!c||DIt(c,e,f,v,g))&&(r[n++]=new Fz(new G(t,v+1+o,t,v+1+g+o),null),n>=l))return n;return n}let u=new Gz(i.wordSeparators,i.regex),p;u.reset(0);do if(p=u.next(e),p&&(r[n++]=KY(new G(t,p.index+1+o,t,p.index+1+p[0].length+o),p,s),n>=l))return n;while(p);return n}static findNextMatch(i,e,t,o){let n=e.parseSearchRequest();if(!n)return null;let r=new Gz(n.wordSeparators,n.regex);return n.regex.multiline?this._doFindNextMatchMultiline(i,t,r,o):this._doFindNextMatchLineByLine(i,t,r,o)}static _doFindNextMatchMultiline(i,e,t,o){let n=new ye(e.lineNumber,1),r=i.getOffsetAt(n),s=i.getLineCount(),l=i.getValueInRange(new G(n.lineNumber,n.column,s,i.getLineMaxColumn(s)),1),c=i.getEOL()===`\r
`?new _It(l):null;t.reset(e.column-1);let u=t.next(l);return u?KY(this._getMultilineMatchRange(i,r,l,c,u.index,u[0]),u,o):e.lineNumber!==1||e.column!==1?this._doFindNextMatchMultiline(i,new ye(1,1),t,o):null}static _doFindNextMatchLineByLine(i,e,t,o){let n=i.getLineCount(),r=e.lineNumber,s=i.getLineContent(r),l=this._findFirstMatchInLine(t,s,r,e.column,o);if(l)return l;for(let c=1;c<=n;c++){let u=(r+c-1)%n,p=i.getLineContent(u+1),h=this._findFirstMatchInLine(t,p,u+1,1,o);if(h)return h}return null}static _findFirstMatchInLine(i,e,t,o,n){i.reset(o-1);let r=i.next(e);return r?KY(new G(t,r.index+1,t,r.index+1+r[0].length),r,n):null}static findPreviousMatch(i,e,t,o){let n=e.parseSearchRequest();if(!n)return null;let r=new Gz(n.wordSeparators,n.regex);return n.regex.multiline?this._doFindPreviousMatchMultiline(i,t,r,o):this._doFindPreviousMatchLineByLine(i,t,r,o)}static _doFindPreviousMatchMultiline(i,e,t,o){let n=this._doFindMatchesMultiline(i,new G(1,1,e.lineNumber,e.column),t,o,10*y2o);if(n.length>0)return n[n.length-1];let r=i.getLineCount();return e.lineNumber!==r||e.column!==i.getLineMaxColumn(r)?this._doFindPreviousMatchMultiline(i,new ye(r,i.getLineMaxColumn(r)),t,o):null}static _doFindPreviousMatchLineByLine(i,e,t,o){let n=i.getLineCount(),r=e.lineNumber,s=i.getLineContent(r).substring(0,e.column-1),l=this._findLastMatchInLine(t,s,r,o);if(l)return l;for(let c=1;c<=n;c++){let u=(n+r-c-1)%n,p=i.getLineContent(u+1),h=this._findLastMatchInLine(t,p,u+1,o);if(h)return h}return null}static _findLastMatchInLine(i,e,t,o){let n=null,r;for(i.reset(0);r=i.next(e);)n=KY(new G(t,r.index+1,t,r.index+1+r[0].length),r,o);return n}};function w2o(a,i,e,t,o){if(t===0)return!0;let n=i.charCodeAt(t-1);if(a.get(n)!==0||n===13||n===10)return!0;if(o>0){let r=i.charCodeAt(t);if(a.get(r)!==0)return!0}return!1}function C2o(a,i,e,t,o){if(t+o===e)return!0;let n=i.charCodeAt(t+o);if(a.get(n)!==0||n===13||n===10)return!0;if(o>0){let r=i.charCodeAt(t+o-1);if(a.get(r)!==0)return!0}return!1}function DIt(a,i,e,t,o){return w2o(a,i,e,t,o)&&C2o(a,i,e,t,o)}var Gz=class{constructor(i,e){this._wordSeparators=i,this._searchRegex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(i){this._searchRegex.lastIndex=i,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(i){let e=i.length,t;do{if(this._prevMatchStartIndex+this._prevMatchLength===e||(t=this._searchRegex.exec(i),!t))return null;let o=t.index,n=t[0].length;if(o===this._prevMatchStartIndex&&n===this._prevMatchLength){if(n===0){dwe(i,e,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=o,this._prevMatchLength=n,!this._wordSeparators||DIt(this._wordSeparators,i,e,o,n))return t}while(t);return null}};var Lce=class{static computeUnicodeHighlights(i,e,t){let o=t?t.startLineNumber:1,n=t?t.endLineNumber:i.getLineCount(),r=new RIt(e),s=r.getCandidateCodePoints(),l;s==="allNonBasicAscii"?l=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):l=new RegExp(`${x2o(Array.from(s))}`,"g");let c=new Gz(null,l),u=[],p=!1,h,g=0,f=0,v=0;e:for(let b=o,S=n;b<=S;b++){let y=i.getLineContent(b),w=y.length;c.reset(0);do if(h=c.next(y),h){let x=h.index,E=h.index+h[0].length;if(x>0){let H=y.charCodeAt(x-1);Ip(H)&&x--}if(E+1<w){let H=y.charCodeAt(E-1);Ip(H)&&E++}let M=y.substring(x,E),N=Rk(x+1,AY,y,0);N&&N.endColumn<=x+1&&(N=null);let V=r.shouldHighlightNonBasicASCII(M,N?N.word:null);if(V!==0){if(V===3?g++:V===2?f++:V===1?v++:bs(V),u.length>=1e3){p=!0;break e}u.push(new G(b,x+1,b,E+1))}}while(h)}return{ranges:u,hasMore:p,ambiguousCharacterCount:g,invisibleCharacterCount:f,nonBasicAsciiCharacterCount:v}}static computeUnicodeHighlightReason(i,e){let t=new RIt(e);switch(t.shouldHighlightNonBasicASCII(i,null)){case 0:return null;case 2:return{kind:1};case 3:{let n=i.codePointAt(0),r=t.ambiguousCharacters.getPrimaryConfusable(n),s=cY.getLocales().filter(l=>!cY.getInstance(new Set([...e.allowedLocales,l])).isAmbiguous(n));return{kind:0,confusableWith:String.fromCodePoint(r),notAmbiguousInLocales:s}}case 1:return{kind:2}}}};function x2o(a,i){return`[${Ss(a.map(t=>String.fromCodePoint(t)).join(""))}]`}var RIt=class{constructor(i){this.options=i;this.allowedCodePoints=new Set(i.allowedCodePoints),this.ambiguousCharacters=cY.getInstance(new Set(i.allowedLocales))}getCandidateCodePoints(){if(this.options.nonBasicASCII)return"allNonBasicAscii";let i=new Set;if(this.options.invisibleCharacters)for(let e of mB.codePoints)q6i(String.fromCodePoint(e))||i.add(e);if(this.options.ambiguousCharacters)for(let e of this.ambiguousCharacters.getConfusableCodePoints())i.add(e);for(let e of this.allowedCodePoints)i.delete(e);return i}shouldHighlightNonBasicASCII(i,e){let t=i.codePointAt(0);if(this.allowedCodePoints.has(t))return 0;if(this.options.nonBasicASCII)return 1;let o=!1,n=!1;if(e)for(let r of e){let s=r.codePointAt(0),l=xz(r);o=o||l,!l&&!this.ambiguousCharacters.isAmbiguous(s)&&!mB.isInvisibleCharacter(s)&&(n=!0)}return!o&&n?0:this.options.invisibleCharacters&&!q6i(i)&&mB.isInvisibleCharacter(t)?2:this.options.ambiguousCharacters&&this.ambiguousCharacters.isAmbiguous(t)?3:0}};function q6i(a){return a===" "||a===`
`||a==="	"}var GY=class{constructor(i,e,t){this.changes=i;this.moves=e;this.hitTimeout=t}},gCe=class a{constructor(i,e){this.lineRangeMapping=i,this.changes=e}flip(){return new a(this.lineRangeMapping.flip(),this.changes.map(i=>i.flip()))}};var vo=class a{static ofLength(i,e){return new a(i,i+e)}static fromRange(i){return new a(i.startLineNumber,i.endLineNumber)}static fromRangeInclusive(i){return new a(i.startLineNumber,i.endLineNumber+1)}static{this.compareByStart=Il(i=>i.startLineNumber,Hu)}static subtract(i,e){return e?i.startLineNumber<e.startLineNumber&&e.endLineNumberExclusive<i.endLineNumberExclusive?[new a(i.startLineNumber,e.startLineNumber),new a(e.endLineNumberExclusive,i.endLineNumberExclusive)]:e.startLineNumber<=i.startLineNumber&&i.endLineNumberExclusive<=e.endLineNumberExclusive?[]:e.endLineNumberExclusive<i.endLineNumberExclusive?[new a(Math.max(e.endLineNumberExclusive,i.startLineNumber),i.endLineNumberExclusive)]:[new a(i.startLineNumber,Math.min(e.startLineNumber,i.endLineNumberExclusive))]:[i]}static joinMany(i){if(i.length===0)return[];let e=new EA(i[0].slice());for(let t=1;t<i.length;t++)e=e.getUnion(new EA(i[t].slice()));return e.ranges}static join(i){if(i.length===0)throw new ci("lineRanges cannot be empty");let e=i[0].startLineNumber,t=i[0].endLineNumberExclusive;for(let o=1;o<i.length;o++)e=Math.min(e,i[o].startLineNumber),t=Math.max(t,i[o].endLineNumberExclusive);return new a(e,t)}static deserialize(i){return new a(i[0],i[1])}constructor(i,e){if(i>e)throw new ci(`startLineNumber ${i} cannot be after endLineNumberExclusive ${e}`);this.startLineNumber=i,this.endLineNumberExclusive=e}contains(i){return this.startLineNumber<=i&&i<this.endLineNumberExclusive}containsRange(i){return this.startLineNumber<=i.startLineNumber&&i.endLineNumberExclusive<=this.endLineNumberExclusive}get isEmpty(){return this.startLineNumber===this.endLineNumberExclusive}delta(i){return new a(this.startLineNumber+i,this.endLineNumberExclusive+i)}deltaLength(i){return new a(this.startLineNumber,this.endLineNumberExclusive+i)}get length(){return this.endLineNumberExclusive-this.startLineNumber}join(i){return new a(Math.min(this.startLineNumber,i.startLineNumber),Math.max(this.endLineNumberExclusive,i.endLineNumberExclusive))}toString(){return`[${this.startLineNumber},${this.endLineNumberExclusive})`}intersect(i){let e=Math.max(this.startLineNumber,i.startLineNumber),t=Math.min(this.endLineNumberExclusive,i.endLineNumberExclusive);if(e<=t)return new a(e,t)}intersectsStrict(i){return this.startLineNumber<i.endLineNumberExclusive&&i.startLineNumber<this.endLineNumberExclusive}intersectsOrTouches(i){return this.startLineNumber<=i.endLineNumberExclusive&&i.startLineNumber<=this.endLineNumberExclusive}equals(i){return this.startLineNumber===i.startLineNumber&&this.endLineNumberExclusive===i.endLineNumberExclusive}toInclusiveRange(){return this.isEmpty?null:new G(this.startLineNumber,1,this.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER)}toExclusiveRange(){return new G(this.startLineNumber,1,this.endLineNumberExclusive,1)}mapToLineArray(i){let e=[];for(let t=this.startLineNumber;t<this.endLineNumberExclusive;t++)e.push(i(t));return e}forEach(i){for(let e=this.startLineNumber;e<this.endLineNumberExclusive;e++)i(e)}serialize(){return[this.startLineNumber,this.endLineNumberExclusive]}toOffsetRange(){return new gi(this.startLineNumber-1,this.endLineNumberExclusive-1)}distanceToRange(i){return this.endLineNumberExclusive<=i.startLineNumber?i.startLineNumber-this.endLineNumberExclusive:i.endLineNumberExclusive<=this.startLineNumber?this.startLineNumber-i.endLineNumberExclusive:0}distanceToLine(i){return this.contains(i)?0:i<this.startLineNumber?this.startLineNumber-i:i-this.endLineNumberExclusive}addMargin(i,e){return new a(this.startLineNumber-i,this.endLineNumberExclusive+e)}},EA=class a{constructor(i=[]){this._normalizedRanges=i}get ranges(){return this._normalizedRanges}addRange(i){if(i.length===0)return;let e=Mw(this._normalizedRanges,o=>o.endLineNumberExclusive>=i.startLineNumber),t=Oj(this._normalizedRanges,o=>o.startLineNumber<=i.endLineNumberExclusive)+1;if(e===t)this._normalizedRanges.splice(e,0,i);else if(e===t-1){let o=this._normalizedRanges[e];this._normalizedRanges[e]=o.join(i)}else{let o=this._normalizedRanges[e].join(this._normalizedRanges[t-1]).join(i);this._normalizedRanges.splice(e,t-e,o)}}contains(i){let e=Nj(this._normalizedRanges,t=>t.startLineNumber<=i);return!!e&&e.endLineNumberExclusive>i}intersects(i){let e=Nj(this._normalizedRanges,t=>t.startLineNumber<i.endLineNumberExclusive);return!!e&&e.endLineNumberExclusive>i.startLineNumber}getUnion(i){if(this._normalizedRanges.length===0)return i;if(i._normalizedRanges.length===0)return this;let e=[],t=0,o=0,n=null;for(;t<this._normalizedRanges.length||o<i._normalizedRanges.length;){let r=null;if(t<this._normalizedRanges.length&&o<i._normalizedRanges.length){let s=this._normalizedRanges[t],l=i._normalizedRanges[o];s.startLineNumber<l.startLineNumber?(r=s,t++):(r=l,o++)}else t<this._normalizedRanges.length?(r=this._normalizedRanges[t],t++):(r=i._normalizedRanges[o],o++);n===null?n=r:n.endLineNumberExclusive>=r.startLineNumber?n=new vo(n.startLineNumber,Math.max(n.endLineNumberExclusive,r.endLineNumberExclusive)):(e.push(n),n=r)}return n!==null&&e.push(n),new a(e)}subtractFrom(i){let e=Mw(this._normalizedRanges,r=>r.endLineNumberExclusive>=i.startLineNumber),t=Oj(this._normalizedRanges,r=>r.startLineNumber<=i.endLineNumberExclusive)+1;if(e===t)return new a([i]);let o=[],n=i.startLineNumber;for(let r=e;r<t;r++){let s=this._normalizedRanges[r];s.startLineNumber>n&&o.push(new vo(n,s.startLineNumber)),n=s.endLineNumberExclusive}return n<i.endLineNumberExclusive&&o.push(new vo(n,i.endLineNumberExclusive)),new a(o)}toString(){return this._normalizedRanges.map(i=>i.toString()).join(", ")}getIntersection(i){let e=[],t=0,o=0;for(;t<this._normalizedRanges.length&&o<i._normalizedRanges.length;){let n=this._normalizedRanges[t],r=i._normalizedRanges[o],s=n.intersect(r);s&&!s.isEmpty&&e.push(s),n.endLineNumberExclusive<r.endLineNumberExclusive?t++:o++}return new a(e)}getWithDelta(i){return new a(this._normalizedRanges.map(e=>e.delta(i)))}};var Rc=class a{constructor(i,e){this.lineCount=i;this.columnCount=e}static{this.zero=new a(0,0)}static lengthDiffNonNegative(i,e){return e.isLessThan(i)?a.zero:i.lineCount===e.lineCount?new a(0,e.columnCount-i.columnCount):new a(e.lineCount-i.lineCount,e.columnCount)}static betweenPositions(i,e){return i.lineNumber===e.lineNumber?new a(0,e.column-i.column):new a(e.lineNumber-i.lineNumber,e.column-1)}static fromPosition(i){return new a(i.lineNumber-1,i.column-1)}static ofRange(i){return a.betweenPositions(i.getStartPosition(),i.getEndPosition())}static ofText(i){let e=0,t=0;for(let o of i)o===`
`?(e++,t=0):t++;return new a(e,t)}static ofSubstr(i,e){return a.ofText(e.substring(i))}static sum(i,e){return i.reduce((t,o)=>t.add(e(o)),a.zero)}isZero(){return this.lineCount===0&&this.columnCount===0}isLessThan(i){return this.lineCount!==i.lineCount?this.lineCount<i.lineCount:this.columnCount<i.columnCount}isGreaterThan(i){return this.lineCount!==i.lineCount?this.lineCount>i.lineCount:this.columnCount>i.columnCount}isGreaterThanOrEqualTo(i){return this.lineCount!==i.lineCount?this.lineCount>i.lineCount:this.columnCount>=i.columnCount}equals(i){return this.lineCount===i.lineCount&&this.columnCount===i.columnCount}compare(i){return this.lineCount!==i.lineCount?this.lineCount-i.lineCount:this.columnCount-i.columnCount}add(i){return i.lineCount===0?new a(this.lineCount,this.columnCount+i.columnCount):new a(this.lineCount+i.lineCount,i.columnCount)}createRange(i){return this.lineCount===0?new G(i.lineNumber,i.column,i.lineNumber,i.column+this.columnCount):new G(i.lineNumber,i.column,i.lineNumber+this.lineCount,this.columnCount+1)}toRange(){return new G(1,1,this.lineCount+1,this.columnCount+1)}toLineRange(){return vo.ofLength(1,this.lineCount+1)}addToPosition(i){return this.lineCount===0?new ye(i.lineNumber,i.column+this.columnCount):new ye(i.lineNumber+this.lineCount,this.columnCount+1)}addToRange(i){return G.fromPositions(this.addToPosition(i.getStartPosition()),this.addToPosition(i.getEndPosition()))}toString(){return`${this.lineCount},${this.columnCount}`}};var fCe=class{getOffsetRange(i){return new gi(this.getOffset(i.getStartPosition()),this.getOffset(i.getEndPosition()))}getRange(i){return G.fromPositions(this.getPosition(i.start),this.getPosition(i.endExclusive))}getStringEdit(i){let e=i.replacements.map(t=>this.getStringReplacement(t));return new y5.deps.StringEdit(e)}getStringReplacement(i){return new y5.deps.StringReplacement(this.getOffsetRange(i.range),i.text)}getTextReplacement(i){return new y5.deps.TextReplacement(this.getRange(i.replaceRange),i.newText)}getTextEdit(i){let e=i.replacements.map(t=>this.getTextReplacement(t));return new y5.deps.TextEdit(e)}},y5=class{static{this._deps=void 0}static get deps(){if(!this._deps)throw new Error("Dependencies not set. Call _setDependencies first.");return this._deps}};function $6i(a){y5._deps=a}var TA=class extends fCe{constructor(e){super();this.text=e}get lineStartOffsetByLineIdx(){return this._lineStartOffsetByLineIdx||this._computeLineOffsets(),this._lineStartOffsetByLineIdx}get lineEndOffsetByLineIdx(){return this._lineEndOffsetByLineIdx||this._computeLineOffsets(),this._lineEndOffsetByLineIdx}_computeLineOffsets(){this._lineStartOffsetByLineIdx=[],this._lineEndOffsetByLineIdx=[],this._lineStartOffsetByLineIdx.push(0);for(let e=0;e<this.text.length;e++)this.text.charAt(e)===`
`&&(this._lineStartOffsetByLineIdx.push(e+1),e>0&&this.text.charAt(e-1)==="\r"?this._lineEndOffsetByLineIdx.push(e-1):this._lineEndOffsetByLineIdx.push(e));this._lineEndOffsetByLineIdx.push(this.text.length)}getOffset(e){let t=this._validatePosition(e);return this.lineStartOffsetByLineIdx[t.lineNumber-1]+t.column-1}_validatePosition(e){if(e.lineNumber<1)return new ye(1,1);let t=this.textLength.lineCount+1;if(e.lineNumber>t){let n=this.getLineLength(t);return new ye(t,n+1)}if(e.column<1)return new ye(e.lineNumber,1);let o=this.getLineLength(e.lineNumber);return e.column-1>o?new ye(e.lineNumber,o+1):e}getPosition(e){let t=Oj(this.lineStartOffsetByLineIdx,r=>r<=e),o=t+1,n=e-this.lineStartOffsetByLineIdx[t]+1;return new ye(o,n)}getTextLength(e){return y5.deps.TextLength.ofRange(this.getRange(e))}get textLength(){let e=this.lineStartOffsetByLineIdx.length-1;return new y5.deps.TextLength(e,this.text.length-this.lineStartOffsetByLineIdx[e])}getLineLength(e){return this.lineEndOffsetByLineIdx[e-1]-this.lineStartOffsetByLineIdx[e-1]}};var qY=class{constructor(){this._transformer=void 0}get endPositionExclusive(){return this.length.addToPosition(new ye(1,1))}get lineRange(){return this.length.toLineRange()}getValue(){return this.getValueOfRange(this.length.toRange())}getValueOfOffsetRange(i){return this.getValueOfRange(this.getTransformer().getRange(i))}getLineLength(i){return this.getValueOfRange(new G(i,1,i,Number.MAX_SAFE_INTEGER)).length}getTransformer(){return this._transformer||(this._transformer=new TA(this.getValue())),this._transformer}getLineAt(i){return this.getValueOfRange(new G(i,1,i,Number.MAX_SAFE_INTEGER))}getLines(){let i=this.getValue();return Hc(i)}getLinesOfRange(i){return i.mapToLineArray(e=>this.getLineAt(e))}equals(i){return this===i?!0:this.getValue()===i.getValue()}},Ari=class extends qY{constructor(e,t){Aw(t>=1);super();this._getLineContent=e;this._lineCount=t}getValueOfRange(e){if(e.startLineNumber===e.endLineNumber)return this._getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);let t=this._getLineContent(e.startLineNumber).substring(e.startColumn-1);for(let o=e.startLineNumber+1;o<e.endLineNumber;o++)t+=`
`+this._getLineContent(o);return t+=`
`+this._getLineContent(e.endLineNumber).substring(0,e.endColumn-1),t}getLineLength(e){return this._getLineContent(e).length}get length(){let e=this._getLineContent(this._lineCount);return new Rc(this._lineCount-1,e.length)}},Mce=class extends Ari{constructor(i){super(e=>i[e-1],i.length)}},_I=class extends qY{constructor(e){super();this.value=e;this._t=new TA(this.value)}getValueOfRange(e){return this._t.getOffsetRange(e).substring(this.value)}get length(){return this._t.textLength}getTransformer(){return this._t}};var lm=class a{constructor(i){this.replacements=i;Wh(()=>Nw(i,(e,t)=>e.range.getEndPosition().isBeforeOrEqual(t.range.getStartPosition())))}static fromStringEdit(i,e){let t=i.replacements.map(o=>ys.fromStringReplacement(o,e));return new a(t)}static replace(i,e){return new a([new ys(i,e)])}static delete(i){return new a([new ys(i,"")])}static insert(i,e){return new a([new ys(G.fromPositions(i,i),e)])}static fromParallelReplacementsUnsorted(i){let e=i.slice().sort(Il(t=>t.range,G.compareRangesUsingStarts));return new a(e)}normalize(){let i=[];for(let e of this.replacements)if(i.length>0&&i[i.length-1].range.getEndPosition().equals(e.range.getStartPosition())){let t=i[i.length-1];i[i.length-1]=new ys(t.range.plusRange(e.range),t.text+e.text)}else e.isEmpty||i.push(e);return new a(i)}mapPosition(i){let e=0,t=0,o=0;for(let n of this.replacements){let r=n.range.getStartPosition();if(i.isBeforeOrEqual(r))break;let s=n.range.getEndPosition(),l=Rc.ofText(n.text);if(i.isBefore(s)){let c=new ye(r.lineNumber+e,r.column+(r.lineNumber+e===t?o:0)),u=l.addToPosition(c);return LIt(c,u)}r.lineNumber+e!==t&&(o=0),e+=l.lineCount-(n.range.endLineNumber-n.range.startLineNumber),l.lineCount===0?s.lineNumber!==r.lineNumber?o+=l.columnCount-(s.column-1):o+=l.columnCount-(s.column-r.column):o=l.columnCount,t=s.lineNumber+e}return new ye(i.lineNumber+e,i.column+(i.lineNumber+e===t?o:0))}mapRange(i){function e(r){return r instanceof ye?r:r.getStartPosition()}function t(r){return r instanceof ye?r:r.getEndPosition()}let o=e(this.mapPosition(i.getStartPosition())),n=t(this.mapPosition(i.getEndPosition()));return LIt(o,n)}inverseMapPosition(i,e){return this.inverse(e).mapPosition(i)}inverseMapRange(i,e){return this.inverse(e).mapRange(i)}apply(i){let e="",t=new ye(1,1);for(let n of this.replacements){let r=n.range,s=r.getStartPosition(),l=r.getEndPosition(),c=LIt(t,s);c.isEmpty()||(e+=i.getValueOfRange(c)),e+=n.text,t=l}let o=LIt(t,i.endPositionExclusive);return o.isEmpty()||(e+=i.getValueOfRange(o)),e}applyToString(i){let e=new _I(i);return this.apply(e)}inverse(i){let e=this.getNewRanges();return new a(this.replacements.map((t,o)=>new ys(e[o],i.getValueOfRange(t.range))))}getNewRanges(){let i=[],e=0,t=0,o=0;for(let n of this.replacements){let r=Rc.ofText(n.text),s=ye.lift({lineNumber:n.range.startLineNumber+t,column:n.range.startColumn+(n.range.startLineNumber===e?o:0)}),l=r.createRange(s);i.push(l),t=l.endLineNumber-n.range.endLineNumber,o=l.endColumn-n.range.endColumn,e=n.range.endLineNumber}return i}toReplacement(i){if(this.replacements.length===0)throw new ci;if(this.replacements.length===1)return this.replacements[0];let e=this.replacements[0].range.getStartPosition(),t=this.replacements[this.replacements.length-1].range.getEndPosition(),o="";for(let n=0;n<this.replacements.length;n++){let r=this.replacements[n];if(o+=r.text,n<this.replacements.length-1){let s=this.replacements[n+1],l=G.fromPositions(r.range.getEndPosition(),s.range.getStartPosition()),c=i.getValueOfRange(l);o+=c}}return new ys(G.fromPositions(e,t),o)}equals(i){return eo(this.replacements,i.replacements,(e,t)=>e.equals(t))}compose(i){let e=this.normalize(),t=i.normalize();if(e.replacements.length===0)return t;if(t.replacements.length===0)return e;let o=[],n=0,r=1,s=1,l=0,c=0,u=0,p=0,h=null,g=0,f=0,v=!1,b=!1,S=1,y=1;function w(){if(!v)if(n<e.replacements.length){let E=e.replacements[n],M=E.range.getStartPosition();if(!(r===M.lineNumber&&s===M.column))l=r,c=s,u=M.lineNumber,p=M.column,h=null,r===M.lineNumber?(g=0,f=M.column-s):(g=M.lineNumber-r,f=M.column-1),v=!0,r=M.lineNumber,s=M.column;else{let V=E.range.getEndPosition();l=M.lineNumber,c=M.column,u=V.lineNumber,p=V.column,h=E.text;let H=0,K=0,j=E.text;for(let J=0;J<j.length;J++)j.charCodeAt(J)===10?(H++,K=0):K++;g=H,f=K,v=!0,r=V.lineNumber,s=V.column,n++}}else b=!0,l=r,c=s,v=!0}function x(E,M,N){if(M===0&&N===0)return["",E];let V=0,H=0;for(;V<M;){let K=E.indexOf(`
`,H);if(K===-1)throw new ci("Text length mismatch");H=K+1,V++}return H+=N,[E.substring(0,H),E.substring(H)]}for(let E of t.replacements){let M=E.range.getStartPosition(),N=E.range.getEndPosition();for(;!(S===M.lineNumber&&y===M.column);){if(w(),b){let ce,Se;S===M.lineNumber?(ce=0,Se=M.column-y):(ce=M.lineNumber-S,Se=M.column-1),S=M.lineNumber,y=M.column,ce===0?c+=Se:(l+=ce,c=Se+1);break}let J,se;g===0?(J=S,se=y+f):(J=S+g,se=f+1);let ae=!1;if(M.lineNumber<J?ae=!0:M.lineNumber===J&&(ae=M.column<se),ae){let ce,Se;S===M.lineNumber?(ce=0,Se=M.column-y):(ce=M.lineNumber-S,Se=M.column-1);let Re,xe;if(ce===g?(Re=0,xe=f-Se):(Re=g-ce,xe=f),h!==null){let[He,Ee]=x(h,ce,Se);o.push(new ys(new G(l,c,u,p),He)),h=Ee,g=Re,f=xe,l=u,c=p}else{let He,Ee;ce===0?(He=l,Ee=c+Se):(He=l+ce,Ee=Se+1),l=He,c=Ee,g=Re,f=xe}S=M.lineNumber,y=M.column;break}h!==null&&o.push(new ys(new G(l,c,u,p),h)),S=J,y=se,v=!1}let V=null,H=null,K=null,j=null;for(;!(S===N.lineNumber&&y===N.column);){if(w(),b){let ce,Se;S===N.lineNumber?(ce=0,Se=N.column-y):(ce=N.lineNumber-S,Se=N.column-1);let Re,xe;ce===0?(Re=l,xe=c+Se):(Re=l+ce,xe=Se+1),V===null&&(V=l,H=c),K=Re,j=xe,S=N.lineNumber,y=N.column,l=Re,c=xe;break}let J,se;g===0?(J=S,se=y+f):(J=S+g,se=f+1);let ae=!1;if(N.lineNumber<J?ae=!0:N.lineNumber===J&&(ae=N.column<se),ae){let ce,Se;S===N.lineNumber?(ce=0,Se=N.column-y):(ce=N.lineNumber-S,Se=N.column-1);let Re,xe;if(ce===g?(Re=0,xe=f-Se):(Re=g-ce,xe=f),h!==null){V===null&&(V=l,H=c),K=u,j=p;let[,He]=x(h,ce,Se);h=He,g=Re,f=xe,l=u,c=p}else{let He,Ee;ce===0?(He=l,Ee=c+Se):(He=l+ce,Ee=Se+1),V===null&&(V=l,H=c),K=He,j=Ee,l=He,c=Ee,g=Re,f=xe}S=N.lineNumber,y=N.column;break}V===null&&(V=l,H=c),K=u,j=p,S=J,y=se,v=!1}if(V!==null)o.push(new ys(new G(V,H,K,j),E.text));else{w();let J=l,se=c;o.push(new ys(new G(J,se,J,se),E.text))}}for(;w(),!b;)h!==null&&o.push(new ys(new G(l,c,u,p),h)),v=!1;return new a(o).normalize()}toString(i){return i===void 0?this.replacements.map(e=>e.toString()).join(`
`):typeof i=="string"?this.toString(new _I(i)):this.replacements.length===0?"":this.replacements.map(e=>{let o=i.getValueOfRange(e.range),n=G.fromPositions(new ye(Math.max(1,e.range.startLineNumber-1),1),e.range.getStartPosition()),r=i.getValueOfRange(n);r.length>10&&(r="..."+r.substring(r.length-10));let s=G.fromPositions(e.range.getEndPosition(),new ye(e.range.endLineNumber+1,1)),l=i.getValueOfRange(s);l.length>10&&(l=l.substring(0,10)+"...");let c=o;if(c.length>10){let p=Math.floor(5);c=c.substring(0,p)+"..."+c.substring(c.length-p)}let u=e.text;if(u.length>10){let p=Math.floor(5);u=u.substring(0,p)+"..."+u.substring(u.length-p)}return c.length===0?`${r}\u2770${u}\u2771${l}`:`${r}\u2770${c}\u21A6${u}\u2771${l}`}).join(`
`)}},ys=class a{constructor(i,e){this.range=i;this.text=e}static joinReplacements(i,e){if(i.length===0)throw new ci;if(i.length===1)return i[0];let t=i[0].range.getStartPosition(),o=i[i.length-1].range.getEndPosition(),n="";for(let r=0;r<i.length;r++){let s=i[r];if(n+=s.text,r<i.length-1){let l=i[r+1],c=G.fromPositions(s.range.getEndPosition(),l.range.getStartPosition()),u=e.getValueOfRange(c);n+=u}}return new a(G.fromPositions(t,o),n)}static fromStringReplacement(i,e){return new a(e.getTransformer().getRange(i.replaceRange),i.newText)}static delete(i){return new a(i,"")}get isEmpty(){return this.range.isEmpty()&&this.text.length===0}static equals(i,e){return i.range.equalsRange(e.range)&&i.text===e.text}toSingleEditOperation(){return{range:this.range,text:this.text}}toEdit(){return new lm([this])}equals(i){return a.equals(this,i)}extendToCoverRange(i,e){if(this.range.containsRange(i))return this;let t=this.range.plusRange(i),o=e.getValueOfRange(G.fromPositions(t.getStartPosition(),this.range.getStartPosition())),n=e.getValueOfRange(G.fromPositions(this.range.getEndPosition(),t.getEndPosition())),r=o+this.text+n;return new a(t,r)}extendToFullLine(i){let e=new G(this.range.startLineNumber,1,this.range.endLineNumber,i.getTransformer().getLineLength(this.range.endLineNumber)+1);return this.extendToCoverRange(e,i)}removeCommonPrefixAndSuffix(i){return this.removeCommonPrefix(i).removeCommonSuffix(i)}removeCommonPrefix(i){let e=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),t=this.text.replaceAll(`\r
`,`
`),o=Af(e,t),n=Rc.ofText(e.substring(0,o)).addToPosition(this.range.getStartPosition()),r=t.substring(o),s=G.fromPositions(n,this.range.getEndPosition());return new a(s,r)}removeCommonSuffix(i){let e=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),t=this.text.replaceAll(`\r
`,`
`),o=lx(e,t),n=Rc.ofText(e.substring(0,e.length-o)).addToPosition(this.range.getStartPosition()),r=t.substring(0,t.length-o),s=G.fromPositions(this.range.getStartPosition(),n);return new a(s,r)}isEffectiveDeletion(i){let e=this.text.replaceAll(`\r
`,`
`),t=i.getValueOfRange(this.range).replaceAll(`\r
`,`
`),o=Af(e,t);e=e.substring(o),t=t.substring(o);let n=lx(e,t);return e=e.substring(0,e.length-n),t=t.substring(0,t.length-n),e===""}toString(){let i=this.range.getStartPosition(),e=this.range.getEndPosition();return`(${i.lineNumber},${i.column} -> ${e.lineNumber},${e.column}): "${this.text}"`}};function LIt(a,i){if(a.lineNumber===i.lineNumber&&a.column===Number.MAX_SAFE_INTEGER)return G.fromPositions(i,i);if(!a.isBeforeOrEqual(i))throw new ci("start must be before end");return new G(a.lineNumber,a.column,i.lineNumber,i.column)}var Oy=class a{static inverse(i,e,t){let o=[],n=1,r=1;for(let l of i){let c=new a(new vo(n,l.original.startLineNumber),new vo(r,l.modified.startLineNumber));c.modified.isEmpty||o.push(c),n=l.original.endLineNumberExclusive,r=l.modified.endLineNumberExclusive}let s=new a(new vo(n,e+1),new vo(r,t+1));return s.modified.isEmpty||o.push(s),o}static clip(i,e,t){let o=[];for(let n of i){let r=n.original.intersect(e),s=n.modified.intersect(t);r&&!r.isEmpty&&s&&!s.isEmpty&&o.push(new a(r,s))}return o}constructor(i,e){this.original=i,this.modified=e}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new a(this.modified,this.original)}join(i){return new a(this.original.join(i.original),this.modified.join(i.modified))}get changedLineCount(){return Math.max(this.original.length,this.modified.length)}toRangeMapping(){let i=this.original.toInclusiveRange(),e=this.modified.toInclusiveRange();if(i&&e)return new lf(i,e);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new ci("not a valid diff");return new lf(new G(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new G(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new lf(new G(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),new G(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER))}toRangeMapping2(i,e){if(j6i(this.original.endLineNumberExclusive,i)&&j6i(this.modified.endLineNumberExclusive,e))return new lf(new G(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new G(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1));if(!this.original.isEmpty&&!this.modified.isEmpty)return new lf(G.fromPositions(new ye(this.original.startLineNumber,1),vCe(new ye(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),i)),G.fromPositions(new ye(this.modified.startLineNumber,1),vCe(new ye(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new lf(G.fromPositions(vCe(new ye(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER),i),vCe(new ye(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),i)),G.fromPositions(vCe(new ye(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER),e),vCe(new ye(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)));throw new ci}};function vCe(a,i){if(a.lineNumber<1)return new ye(1,1);if(a.lineNumber>i.length)return new ye(i.length,i[i.length-1].length+1);let e=i[a.lineNumber-1];return a.column>e.length+1?new ye(a.lineNumber,e.length+1):a}function j6i(a,i){return a>=1&&a<=i.length}var vv=class a extends Oy{static toTextEdit(i,e){let t=[];for(let o of i)for(let n of o.innerChanges??[]){let r=n.toTextEdit(e);t.push(r)}return new lm(t)}static fromRangeMappings(i){let e=vo.join(i.map(o=>vo.fromRangeInclusive(o.originalRange))),t=vo.join(i.map(o=>vo.fromRangeInclusive(o.modifiedRange)));return new a(e,t,i)}constructor(i,e,t){super(i,e),this.innerChanges=t}flip(){return new a(this.modified,this.original,this.innerChanges?.map(i=>i.flip()))}withInnerChangesFromLineRanges(){return new a(this.original,this.modified,[this.toRangeMapping()])}},lf=class a{static fromEdit(i){let e=i.getNewRanges();return i.replacements.map((o,n)=>new a(o.range,e[n]))}static fromEditJoin(i){let e=i.getNewRanges(),t=i.replacements.map((o,n)=>new a(o.range,e[n]));return a.join(t)}static join(i){if(i.length===0)throw new ci("Cannot join an empty list of range mappings");let e=i[0];for(let t=1;t<i.length;t++)e=e.join(i[t]);return e}static assertSorted(i){for(let e=1;e<i.length;e++){let t=i[e-1],o=i[e];if(!(t.originalRange.getEndPosition().isBeforeOrEqual(o.originalRange.getStartPosition())&&t.modifiedRange.getEndPosition().isBeforeOrEqual(o.modifiedRange.getStartPosition())))throw new ci("Range mappings must be sorted")}}constructor(i,e){this.originalRange=i,this.modifiedRange=e}toString(){return`{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`}flip(){return new a(this.modifiedRange,this.originalRange)}toTextEdit(i){let e=i.getValueOfRange(this.modifiedRange);return new ys(this.originalRange,e)}join(i){return new a(this.originalRange.plusRange(i.originalRange),this.modifiedRange.plusRange(i.modifiedRange))}};function bCe(a,i,e,t=!1){let o=[];for(let n of iY(a.map(r=>k2o(r,i,e)),(r,s)=>r.original.intersectsOrTouches(s.original)||r.modified.intersectsOrTouches(s.modified))){let r=n[0],s=n[n.length-1];o.push(new vv(r.original.join(s.original),r.modified.join(s.modified),n.map(l=>l.innerChanges[0])))}return Wh(()=>!t&&o.length>0&&(o[0].modified.startLineNumber!==o[0].original.startLineNumber||e.length.lineCount-o[o.length-1].modified.endLineNumberExclusive!==i.length.lineCount-o[o.length-1].original.endLineNumberExclusive)?!1:Nw(o,(n,r)=>r.original.startLineNumber-n.original.endLineNumberExclusive===r.modified.startLineNumber-n.modified.endLineNumberExclusive&&n.original.endLineNumberExclusive<r.original.startLineNumber&&n.modified.endLineNumberExclusive<r.modified.startLineNumber)),o}function k2o(a,i,e){let t=0,o=0;a.modifiedRange.endColumn===1&&a.originalRange.endColumn===1&&a.originalRange.startLineNumber+t<=a.originalRange.endLineNumber&&a.modifiedRange.startLineNumber+t<=a.modifiedRange.endLineNumber&&(o=-1),a.modifiedRange.startColumn-1>=e.getLineLength(a.modifiedRange.startLineNumber)&&a.originalRange.startColumn-1>=i.getLineLength(a.originalRange.startLineNumber)&&a.originalRange.startLineNumber<=a.originalRange.endLineNumber+o&&a.modifiedRange.startLineNumber<=a.modifiedRange.endLineNumber+o&&(t=1);let n=new vo(a.originalRange.startLineNumber+t,a.originalRange.endLineNumber+1+o),r=new vo(a.modifiedRange.startLineNumber+t,a.modifiedRange.endLineNumber+1+o);return new vv(n,r,[a])}var E2o=3,MIt=class{computeDiff(i,e,t){let n=new S3e(i,e,{maxComputationTime:t.maxComputationTimeMs,shouldIgnoreTrimWhitespace:t.ignoreTrimWhitespace,shouldComputeCharChanges:!0,shouldMakePrettyDiff:!0,shouldPostProcessCharChanges:!0}).computeDiff(),r=[],s=null;for(let l of n.changes){let c;l.originalEndLineNumber===0?c=new vo(l.originalStartLineNumber+1,l.originalStartLineNumber+1):c=new vo(l.originalStartLineNumber,l.originalEndLineNumber+1);let u;l.modifiedEndLineNumber===0?u=new vo(l.modifiedStartLineNumber+1,l.modifiedStartLineNumber+1):u=new vo(l.modifiedStartLineNumber,l.modifiedEndLineNumber+1);let p=new vv(c,u,l.charChanges?.map(h=>new lf(new G(h.originalStartLineNumber,h.originalStartColumn,h.originalEndLineNumber,h.originalEndColumn),new G(h.modifiedStartLineNumber,h.modifiedStartColumn,h.modifiedEndLineNumber,h.modifiedEndColumn))));s&&(s.modified.endLineNumberExclusive===p.modified.startLineNumber||s.original.endLineNumberExclusive===p.original.startLineNumber)&&(p=new vv(s.original.join(p.original),s.modified.join(p.modified),s.innerChanges&&p.innerChanges?s.innerChanges.concat(p.innerChanges):void 0),r.pop()),r.push(p),s=p}return Wh(()=>Nw(r,(l,c)=>c.original.startLineNumber-l.original.endLineNumberExclusive===c.modified.startLineNumber-l.modified.endLineNumberExclusive&&l.original.endLineNumberExclusive<c.original.startLineNumber&&l.modified.endLineNumberExclusive<c.modified.startLineNumber)),new GY(r,[],n.quitEarly)}};function Y6i(a,i,e,t){return new kA(a,i,e).ComputeDiff(t)}var PIt=class{constructor(i){let e=[],t=[];for(let o=0,n=i.length;o<n;o++)e[o]=Ori(i[o],1),t[o]=Fri(i[o],1);this.lines=i,this._startColumns=e,this._endColumns=t}getElements(){let i=[];for(let e=0,t=this.lines.length;e<t;e++)i[e]=this.lines[e].substring(this._startColumns[e]-1,this._endColumns[e]-1);return i}getStrictElement(i){return this.lines[i]}getStartLineNumber(i){return i+1}getEndLineNumber(i){return i+1}createCharSequence(i,e,t){let o=[],n=[],r=[],s=0;for(let l=e;l<=t;l++){let c=this.lines[l],u=i?this._startColumns[l]:1,p=i?this._endColumns[l]:c.length+1;for(let h=u;h<p;h++)o[s]=c.charCodeAt(h-1),n[s]=l+1,r[s]=h,s++;!i&&l<t&&(o[s]=10,n[s]=l+1,r[s]=c.length+1,s++)}return new Nri(o,n,r)}},Nri=class{constructor(i,e,t){this._charCodes=i,this._lineNumbers=e,this._columns=t}toString(){return"["+this._charCodes.map((i,e)=>(i===10?"\\n":String.fromCharCode(i))+`-(${this._lineNumbers[e]},${this._columns[e]})`).join(", ")+"]"}_assertIndex(i,e){if(i<0||i>=e.length)throw new Error("Illegal index")}getElements(){return this._charCodes}getStartLineNumber(i){return i>0&&i===this._lineNumbers.length?this.getEndLineNumber(i-1):(this._assertIndex(i,this._lineNumbers),this._lineNumbers[i])}getEndLineNumber(i){return i===-1?this.getStartLineNumber(i+1):(this._assertIndex(i,this._lineNumbers),this._charCodes[i]===10?this._lineNumbers[i]+1:this._lineNumbers[i])}getStartColumn(i){return i>0&&i===this._columns.length?this.getEndColumn(i-1):(this._assertIndex(i,this._columns),this._columns[i])}getEndColumn(i){return i===-1?this.getStartColumn(i+1):(this._assertIndex(i,this._columns),this._charCodes[i]===10?1:this._columns[i]+1)}},SCe=class a{constructor(i,e,t,o,n,r,s,l){this.originalStartLineNumber=i,this.originalStartColumn=e,this.originalEndLineNumber=t,this.originalEndColumn=o,this.modifiedStartLineNumber=n,this.modifiedStartColumn=r,this.modifiedEndLineNumber=s,this.modifiedEndColumn=l}static createFromDiffChange(i,e,t){let o=e.getStartLineNumber(i.originalStart),n=e.getStartColumn(i.originalStart),r=e.getEndLineNumber(i.originalStart+i.originalLength-1),s=e.getEndColumn(i.originalStart+i.originalLength-1),l=t.getStartLineNumber(i.modifiedStart),c=t.getStartColumn(i.modifiedStart),u=t.getEndLineNumber(i.modifiedStart+i.modifiedLength-1),p=t.getEndColumn(i.modifiedStart+i.modifiedLength-1);return new a(o,n,r,s,l,c,u,p)}};function T2o(a){if(a.length<=1)return a;let i=[a[0]],e=i[0];for(let t=1,o=a.length;t<o;t++){let n=a[t],r=n.originalStart-(e.originalStart+e.originalLength),s=n.modifiedStart-(e.modifiedStart+e.modifiedLength);Math.min(r,s)<E2o?(e.originalLength=n.originalStart+n.originalLength-e.originalStart,e.modifiedLength=n.modifiedStart+n.modifiedLength-e.modifiedStart):(i.push(n),e=n)}return i}var b3e=class a{constructor(i,e,t,o,n){this.originalStartLineNumber=i,this.originalEndLineNumber=e,this.modifiedStartLineNumber=t,this.modifiedEndLineNumber=o,this.charChanges=n}static createFromDiffResult(i,e,t,o,n,r,s){let l,c,u,p,h;if(e.originalLength===0?(l=t.getStartLineNumber(e.originalStart)-1,c=0):(l=t.getStartLineNumber(e.originalStart),c=t.getEndLineNumber(e.originalStart+e.originalLength-1)),e.modifiedLength===0?(u=o.getStartLineNumber(e.modifiedStart)-1,p=0):(u=o.getStartLineNumber(e.modifiedStart),p=o.getEndLineNumber(e.modifiedStart+e.modifiedLength-1)),r&&e.originalLength>0&&e.originalLength<20&&e.modifiedLength>0&&e.modifiedLength<20&&n()){let g=t.createCharSequence(i,e.originalStart,e.originalStart+e.originalLength-1),f=o.createCharSequence(i,e.modifiedStart,e.modifiedStart+e.modifiedLength-1);if(g.getElements().length>0&&f.getElements().length>0){let v=Y6i(g,f,n,!0).changes;s&&(v=T2o(v)),h=[];for(let b=0,S=v.length;b<S;b++)h.push(SCe.createFromDiffChange(v[b],g,f))}}return new a(l,c,u,p,h)}},S3e=class{constructor(i,e,t){this.shouldComputeCharChanges=t.shouldComputeCharChanges,this.shouldPostProcessCharChanges=t.shouldPostProcessCharChanges,this.shouldIgnoreTrimWhitespace=t.shouldIgnoreTrimWhitespace,this.shouldMakePrettyDiff=t.shouldMakePrettyDiff,this.originalLines=i,this.modifiedLines=e,this.original=new PIt(i),this.modified=new PIt(e),this.continueLineDiff=Q6i(t.maxComputationTime),this.continueCharDiff=Q6i(t.maxComputationTime===0?0:Math.min(t.maxComputationTime,5e3))}computeDiff(){if(this.original.lines.length===1&&this.original.lines[0].length===0)return this.modified.lines.length===1&&this.modified.lines[0].length===0?{quitEarly:!1,changes:[]}:{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:1,modifiedStartLineNumber:1,modifiedEndLineNumber:this.modified.lines.length,charChanges:void 0}]};if(this.modified.lines.length===1&&this.modified.lines[0].length===0)return{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:this.original.lines.length,modifiedStartLineNumber:1,modifiedEndLineNumber:1,charChanges:void 0}]};let i=Y6i(this.original,this.modified,this.continueLineDiff,this.shouldMakePrettyDiff),e=i.changes,t=i.quitEarly;if(this.shouldIgnoreTrimWhitespace){let s=[];for(let l=0,c=e.length;l<c;l++)s.push(b3e.createFromDiffResult(this.shouldIgnoreTrimWhitespace,e[l],this.original,this.modified,this.continueCharDiff,this.shouldComputeCharChanges,this.shouldPostProcessCharChanges));return{quitEarly:t,changes:s}}let o=[],n=0,r=0;for(let s=-1,l=e.length;s<l;s++){let c=s+1<l?e[s+1]:null,u=c?c.originalStart:this.originalLines.length,p=c?c.modifiedStart:this.modifiedLines.length;for(;n<u&&r<p;){let h=this.originalLines[n],g=this.modifiedLines[r];if(h!==g){{let f=Ori(h,1),v=Ori(g,1);for(;f>1&&v>1;){let b=h.charCodeAt(f-2),S=g.charCodeAt(v-2);if(b!==S)break;f--,v--}(f>1||v>1)&&this._pushTrimWhitespaceCharChange(o,n+1,1,f,r+1,1,v)}{let f=Fri(h,1),v=Fri(g,1),b=h.length+1,S=g.length+1;for(;f<b&&v<S;){let y=h.charCodeAt(f-1),w=h.charCodeAt(v-1);if(y!==w)break;f++,v++}(f<b||v<S)&&this._pushTrimWhitespaceCharChange(o,n+1,f,b,r+1,v,S)}}n++,r++}c&&(o.push(b3e.createFromDiffResult(this.shouldIgnoreTrimWhitespace,c,this.original,this.modified,this.continueCharDiff,this.shouldComputeCharChanges,this.shouldPostProcessCharChanges)),n+=c.originalLength,r+=c.modifiedLength)}return{quitEarly:t,changes:o}}_pushTrimWhitespaceCharChange(i,e,t,o,n,r,s){if(this._mergeTrimWhitespaceCharChange(i,e,t,o,n,r,s))return;let l;this.shouldComputeCharChanges&&(l=[new SCe(e,t,e,o,n,r,n,s)]),i.push(new b3e(e,e,n,n,l))}_mergeTrimWhitespaceCharChange(i,e,t,o,n,r,s){let l=i.length;if(l===0)return!1;let c=i[l-1];return c.originalEndLineNumber===0||c.modifiedEndLineNumber===0?!1:c.originalEndLineNumber===e&&c.modifiedEndLineNumber===n?(this.shouldComputeCharChanges&&c.charChanges&&c.charChanges.push(new SCe(e,t,e,o,n,r,n,s)),!0):c.originalEndLineNumber+1===e&&c.modifiedEndLineNumber+1===n?(c.originalEndLineNumber=e,c.modifiedEndLineNumber=n,this.shouldComputeCharChanges&&c.charChanges&&c.charChanges.push(new SCe(e,t,e,o,n,r,n,s)),!0):!1}};function Ori(a,i){let e=Em(a);return e===-1?i:e+1}function Fri(a,i){let e=Bv(a);return e===-1?i:e+2}function Q6i(a){if(a===0)return()=>!0;let i=Date.now();return()=>Date.now()-i<a}var $z=class a{constructor(i,e){this.diffs=i;this.hitTimeout=e}static trivial(i,e){return new a([new cf(gi.ofLength(i.length),gi.ofLength(e.length))],!1)}static trivialTimedOut(i,e){return new a([new cf(gi.ofLength(i.length),gi.ofLength(e.length))],!0)}},cf=class a{constructor(i,e){this.seq1Range=i;this.seq2Range=e}static invert(i,e){let t=[];return vvt(i,(o,n)=>{t.push(a.fromOffsetPairs(o?o.getEndExclusives():qz.zero,n?n.getStarts():new qz(e,(o?o.seq2Range.endExclusive-o.seq1Range.endExclusive:0)+e)))}),t}static fromOffsetPairs(i,e){return new a(new gi(i.offset1,e.offset1),new gi(i.offset2,e.offset2))}static assertSorted(i){let e;for(let t of i){if(e&&!(e.seq1Range.endExclusive<=t.seq1Range.start&&e.seq2Range.endExclusive<=t.seq2Range.start))throw new ci("Sequence diffs must be sorted");e=t}}swap(){return new a(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(i){return new a(this.seq1Range.join(i.seq1Range),this.seq2Range.join(i.seq2Range))}delta(i){return i===0?this:new a(this.seq1Range.delta(i),this.seq2Range.delta(i))}deltaStart(i){return i===0?this:new a(this.seq1Range.deltaStart(i),this.seq2Range.deltaStart(i))}deltaEnd(i){return i===0?this:new a(this.seq1Range.deltaEnd(i),this.seq2Range.deltaEnd(i))}intersectsOrTouches(i){return this.seq1Range.intersectsOrTouches(i.seq1Range)||this.seq2Range.intersectsOrTouches(i.seq2Range)}intersect(i){let e=this.seq1Range.intersect(i.seq1Range),t=this.seq2Range.intersect(i.seq2Range);if(!(!e||!t))return new a(e,t)}getStarts(){return new qz(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new qz(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}},qz=class a{constructor(i,e){this.offset1=i;this.offset2=e}static{this.zero=new a(0,0)}static{this.max=new a(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(i){return i===0?this:new a(this.offset1+i,this.offset2+i)}equals(i){return this.offset1===i.offset1&&this.offset2===i.offset2}},$Y=class a{static{this.instance=new a}isValid(){return!0}},AIt=class{constructor(i){this.timeout=i;this.startTime=Date.now();this.valid=!0;if(i<=0)throw new ci("timeout must be positive")}isValid(){return!(Date.now()-this.startTime<this.timeout)&&this.valid&&(this.valid=!1),this.valid}disable(){this.timeout=Number.MAX_SAFE_INTEGER,this.isValid=()=>!0,this.valid=!0}};var ICe=class{constructor(i,e){this.width=i;this.height=e;this.array=[];this.array=new Array(i*e)}get(i,e){return this.array[i+e*this.width]}set(i,e,t){this.array[i+e*this.width]=t}};function y3e(a){return a===32||a===9}var I3e=class a{constructor(i,e,t){this.range=i;this.lines=e;this.source=t;this.histogram=[];let o=0;for(let n=i.startLineNumber-1;n<i.endLineNumberExclusive-1;n++){let r=e[n];for(let l=0;l<r.length;l++){o++;let c=r[l],u=a.getKey(c);this.histogram[u]=(this.histogram[u]||0)+1}o++;let s=a.getKey(`
`);this.histogram[s]=(this.histogram[s]||0)+1}this.totalCount=o}static{this.chrKeys=new Map}static getKey(i){let e=this.chrKeys.get(i);return e===void 0&&(e=this.chrKeys.size,this.chrKeys.set(i,e)),e}computeSimilarity(i){let e=0,t=Math.max(this.histogram.length,i.histogram.length);for(let o=0;o<t;o++)e+=Math.abs((this.histogram[o]??0)-(i.histogram[o]??0));return 1-e/(this.totalCount+i.totalCount)}};var NIt=class{compute(i,e,t=$Y.instance,o){if(i.length===0||e.length===0)return $z.trivial(i,e);let n=new ICe(i.length,e.length),r=new ICe(i.length,e.length),s=new ICe(i.length,e.length);for(let f=0;f<i.length;f++)for(let v=0;v<e.length;v++){if(!t.isValid())return $z.trivialTimedOut(i,e);let b=f===0?0:n.get(f-1,v),S=v===0?0:n.get(f,v-1),y;i.getElement(f)===e.getElement(v)?(f===0||v===0?y=0:y=n.get(f-1,v-1),f>0&&v>0&&r.get(f-1,v-1)===3&&(y+=s.get(f-1,v-1)),y+=o?o(f,v):1):y=-1;let w=Math.max(b,S,y);if(w===y){let x=f>0&&v>0?s.get(f-1,v-1):0;s.set(f,v,x+1),r.set(f,v,3)}else w===b?(s.set(f,v,0),r.set(f,v,1)):w===S&&(s.set(f,v,0),r.set(f,v,2));n.set(f,v,w)}let l=[],c=i.length,u=e.length;function p(f,v){(f+1!==c||v+1!==u)&&l.push(new cf(new gi(f+1,c),new gi(v+1,u))),c=f,u=v}let h=i.length-1,g=e.length-1;for(;h>=0&&g>=0;)r.get(h,g)===3?(p(h,g),h--,g--):r.get(h,g)===1?h--:g--;return p(-1,-1),l.reverse(),new $z(l,!1)}};var yCe=class{compute(i,e,t=$Y.instance){if(i.length===0||e.length===0)return $z.trivial(i,e);let o=i,n=e;function r(v,b){for(;v<o.length&&b<n.length&&o.getElement(v)===n.getElement(b);)v++,b++;return v}let s=0,l=new Wri;l.set(0,r(0,0));let c=new Vri;c.set(0,l.get(0)===0?null:new OIt(null,0,0,l.get(0)));let u=0;e:for(;;){if(s++,!t.isValid())return $z.trivialTimedOut(o,n);let v=-Math.min(s,n.length+s%2),b=Math.min(s,o.length+s%2);for(u=v;u<=b;u+=2){let S=0,y=u===b?-1:l.get(u+1),w=u===v?-1:l.get(u-1)+1;S++;let x=Math.min(Math.max(y,w),o.length),E=x-u;if(S++,x>o.length||E>n.length)continue;let M=r(x,E);l.set(u,M);let N=x===y?c.get(u+1):c.get(u-1);if(c.set(u,M!==x?new OIt(N,x,E,M-x):N),l.get(u)===o.length&&l.get(u)-u===n.length)break e}}let p=c.get(u),h=[],g=o.length,f=n.length;for(;;){let v=p?p.x+p.length:0,b=p?p.y+p.length:0;if((v!==g||b!==f)&&h.push(new cf(new gi(v,g),new gi(b,f))),!p)break;g=p.x,f=p.y,p=p.prev}return h.reverse(),new $z(h,!1)}},OIt=class{constructor(i,e,t,o){this.prev=i;this.x=e;this.y=t;this.length=o}},Wri=class{constructor(){this.positiveArr=new Int32Array(10);this.negativeArr=new Int32Array(10)}get(i){return i<0?(i=-i-1,this.negativeArr[i]):this.positiveArr[i]}set(i,e){if(i<0){if(i=-i-1,i>=this.negativeArr.length){let t=this.negativeArr;this.negativeArr=new Int32Array(t.length*2),this.negativeArr.set(t)}this.negativeArr[i]=e}else{if(i>=this.positiveArr.length){let t=this.positiveArr;this.positiveArr=new Int32Array(t.length*2),this.positiveArr.set(t)}this.positiveArr[i]=e}}},Vri=class{constructor(){this.positiveArr=[];this.negativeArr=[]}get(i){return i<0?(i=-i-1,this.negativeArr[i]):this.positiveArr[i]}set(i,e){i<0?(i=-i-1,this.negativeArr[i]=e):this.positiveArr[i]=e}};var jY=class{constructor(i,e,t){this.lines=i;this.range=e;this.considerWhitespaceChanges=t;this.elements=[];this.firstElementOffsetByLineIdx=[];this.lineStartOffsets=[];this.trimmedWsLengthsByLineIdx=[];this.firstElementOffsetByLineIdx.push(0);for(let o=this.range.startLineNumber;o<=this.range.endLineNumber;o++){let n=i[o-1],r=0;o===this.range.startLineNumber&&this.range.startColumn>1&&(r=this.range.startColumn-1,n=n.substring(r)),this.lineStartOffsets.push(r);let s=0;if(!t){let c=n.trimStart();s=n.length-c.length,n=c.trimEnd()}this.trimmedWsLengthsByLineIdx.push(s);let l=o===this.range.endLineNumber?Math.min(this.range.endColumn-1-r-s,n.length):n.length;for(let c=0;c<l;c++)this.elements.push(n.charCodeAt(c));o<this.range.endLineNumber&&(this.elements.push(10),this.firstElementOffsetByLineIdx.push(this.elements.length))}}toString(){return`Slice: "${this.text}"`}get text(){return this.getText(new gi(0,this.length))}getText(i){return this.elements.slice(i.start,i.endExclusive).map(e=>String.fromCharCode(e)).join("")}getElement(i){return this.elements[i]}get length(){return this.elements.length}getBoundaryScore(i){let e=Z6i(i>0?this.elements[i-1]:-1),t=Z6i(i<this.elements.length?this.elements[i]:-1);if(e===7&&t===8)return 0;if(e===8)return 150;let o=0;return e!==t&&(o+=10,e===0&&t===1&&(o+=1)),o+=J6i(e),o+=J6i(t),o}translateOffset(i,e="right"){let t=Oj(this.firstElementOffsetByLineIdx,n=>n<=i),o=i-this.firstElementOffsetByLineIdx[t];return new ye(this.range.startLineNumber+t,1+this.lineStartOffsets[t]+o+(o===0&&e==="left"?0:this.trimmedWsLengthsByLineIdx[t]))}translateRange(i){let e=this.translateOffset(i.start,"right"),t=this.translateOffset(i.endExclusive,"left");return t.isBefore(e)?G.fromPositions(t,t):G.fromPositions(e,t)}findWordContaining(i){if(i<0||i>=this.elements.length||!wCe(this.elements[i]))return;let e=i;for(;e>0&&wCe(this.elements[e-1]);)e--;let t=i;for(;t<this.elements.length&&wCe(this.elements[t]);)t++;return new gi(e,t)}findSubWordContaining(i){if(i<0||i>=this.elements.length||!wCe(this.elements[i]))return;let e=i;for(;e>0&&wCe(this.elements[e-1])&&!X6i(this.elements[e]);)e--;let t=i;for(;t<this.elements.length&&wCe(this.elements[t])&&!X6i(this.elements[t]);)t++;return new gi(e,t)}countLinesIn(i){return this.translateOffset(i.endExclusive).lineNumber-this.translateOffset(i.start).lineNumber}isStronglyEqual(i,e){return this.elements[i]===this.elements[e]}extendToFullLines(i){let e=Nj(this.firstElementOffsetByLineIdx,o=>o<=i.start)??0,t=B4i(this.firstElementOffsetByLineIdx,o=>i.endExclusive<=o)??this.elements.length;return new gi(e,t)}};function wCe(a){return a>=97&&a<=122||a>=65&&a<=90||a>=48&&a<=57}function X6i(a){return a>=65&&a<=90}var _2o={0:0,1:0,2:0,3:10,4:2,5:30,6:3,7:10,8:10};function J6i(a){return _2o[a]}function Z6i(a){return a===10?8:a===13?7:y3e(a)?6:a>=97&&a<=122?0:a>=65&&a<=90?1:a>=48&&a<=57?2:a===-1?3:a===44||a===59?5:4}function t9i(a,i,e,t,o,n){let{moves:r,excludedChanges:s}=R2o(a,i,e,n);if(!n.isValid())return[];let l=a.filter(u=>!s.has(u)),c=L2o(l,t,o,i,e,n);return Vj(r,c),r=M2o(r),r=r.filter(u=>{let p=u.original.toOffsetRange().slice(i).map(g=>g.trim());return p.join(`
`).length>=15&&D2o(p,g=>g.length>=2)>=2}),r=P2o(a,r),r}function D2o(a,i){let e=0;for(let t of a)i(t)&&e++;return e}function R2o(a,i,e,t){let o=[],n=a.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new I3e(l.original,i,l)),r=new Set(a.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new I3e(l.modified,e,l))),s=new Set;for(let l of n){let c=-1,u;for(let p of r){let h=l.computeSimilarity(p);h>c&&(c=h,u=p)}if(c>.9&&u&&(r.delete(u),o.push(new Oy(l.range,u.range)),s.add(l.source),s.add(u.source)),!t.isValid())return{moves:o,excludedChanges:s}}return{moves:o,excludedChanges:s}}function L2o(a,i,e,t,o,n){let r=[],s=new pz;for(let h of a)for(let g=h.original.startLineNumber;g<h.original.endLineNumberExclusive-2;g++){let f=`${i[g-1]}:${i[g+1-1]}:${i[g+2-1]}`;s.add(f,{range:new vo(g,g+3)})}let l=[];a.sort(Il(h=>h.modified.startLineNumber,Hu));for(let h of a){let g=[];for(let f=h.modified.startLineNumber;f<h.modified.endLineNumberExclusive-2;f++){let v=`${e[f-1]}:${e[f+1-1]}:${e[f+2-1]}`,b=new vo(f,f+3),S=[];s.forEach(v,({range:y})=>{for(let x of g)if(x.originalLineRange.endLineNumberExclusive+1===y.endLineNumberExclusive&&x.modifiedLineRange.endLineNumberExclusive+1===b.endLineNumberExclusive){x.originalLineRange=new vo(x.originalLineRange.startLineNumber,y.endLineNumberExclusive),x.modifiedLineRange=new vo(x.modifiedLineRange.startLineNumber,b.endLineNumberExclusive),S.push(x);return}let w={modifiedLineRange:b,originalLineRange:y};l.push(w),S.push(w)}),g=S}if(!n.isValid())return[]}l.sort(wle(Il(h=>h.modifiedLineRange.length,Hu)));let c=new EA,u=new EA;for(let h of l){let g=h.modifiedLineRange.startLineNumber-h.originalLineRange.startLineNumber,f=c.subtractFrom(h.modifiedLineRange),v=u.subtractFrom(h.originalLineRange).getWithDelta(g),b=f.getIntersection(v);for(let S of b.ranges){if(S.length<3)continue;let y=S,w=S.delta(-g);r.push(new Oy(w,y)),c.addRange(y),u.addRange(w)}}r.sort(Il(h=>h.original.startLineNumber,Hu));let p=new $5e(a);for(let h=0;h<r.length;h++){let g=r[h],f=p.findLastMonotonous(M=>M.original.startLineNumber<=g.original.startLineNumber),v=Nj(a,M=>M.modified.startLineNumber<=g.modified.startLineNumber),b=Math.max(g.original.startLineNumber-f.original.startLineNumber,g.modified.startLineNumber-v.modified.startLineNumber),S=p.findLastMonotonous(M=>M.original.startLineNumber<g.original.endLineNumberExclusive),y=Nj(a,M=>M.modified.startLineNumber<g.modified.endLineNumberExclusive),w=Math.max(S.original.endLineNumberExclusive-g.original.endLineNumberExclusive,y.modified.endLineNumberExclusive-g.modified.endLineNumberExclusive),x;for(x=0;x<b;x++){let M=g.original.startLineNumber-x-1,N=g.modified.startLineNumber-x-1;if(M>t.length||N>o.length||c.contains(N)||u.contains(M)||!e9i(t[M-1],o[N-1],n))break}x>0&&(u.addRange(new vo(g.original.startLineNumber-x,g.original.startLineNumber)),c.addRange(new vo(g.modified.startLineNumber-x,g.modified.startLineNumber)));let E;for(E=0;E<w;E++){let M=g.original.endLineNumberExclusive+E,N=g.modified.endLineNumberExclusive+E;if(M>t.length||N>o.length||c.contains(N)||u.contains(M)||!e9i(t[M-1],o[N-1],n))break}E>0&&(u.addRange(new vo(g.original.endLineNumberExclusive,g.original.endLineNumberExclusive+E)),c.addRange(new vo(g.modified.endLineNumberExclusive,g.modified.endLineNumberExclusive+E))),(x>0||E>0)&&(r[h]=new Oy(new vo(g.original.startLineNumber-x,g.original.endLineNumberExclusive+E),new vo(g.modified.startLineNumber-x,g.modified.endLineNumberExclusive+E)))}return r}function e9i(a,i,e){if(a.trim()===i.trim())return!0;if(a.length>300&&i.length>300)return!1;let o=new yCe().compute(new jY([a],new G(1,1,1,a.length),!1),new jY([i],new G(1,1,1,i.length),!1),e),n=0,r=cf.invert(o.diffs,a.length);for(let u of r)u.seq1Range.forEach(p=>{y3e(a.charCodeAt(p))||n++});function s(u){let p=0;for(let h=0;h<a.length;h++)y3e(u.charCodeAt(h))||p++;return p}let l=s(a.length>i.length?a:i);return n/l>.6&&l>10}function M2o(a){if(a.length===0)return a;a.sort(Il(e=>e.original.startLineNumber,Hu));let i=[a[0]];for(let e=1;e<a.length;e++){let t=i[i.length-1],o=a[e],n=o.original.startLineNumber-t.original.endLineNumberExclusive,r=o.modified.startLineNumber-t.modified.endLineNumberExclusive;if(n>=0&&r>=0&&n+r<=2){i[i.length-1]=t.join(o);continue}i.push(o)}return i}function P2o(a,i){let e=new $5e(a);return i=i.filter(t=>{let o=e.findLastMonotonous(s=>s.original.startLineNumber<t.original.endLineNumberExclusive)||new Oy(new vo(1,1),new vo(1,1)),n=Nj(a,s=>s.modified.startLineNumber<t.modified.endLineNumberExclusive);return o!==n}),i}function w3e(a,i,e){let t=e;return t=i9i(a,i,t),t=i9i(a,i,t),t=A2o(a,i,t),t}function i9i(a,i,e){if(e.length===0)return e;let t=[];t.push(e[0]);for(let n=1;n<e.length;n++){let r=t[t.length-1],s=e[n];if(s.seq1Range.isEmpty||s.seq2Range.isEmpty){let l=s.seq1Range.start-r.seq1Range.endExclusive,c;for(c=1;c<=l&&!(a.getElement(s.seq1Range.start-c)!==a.getElement(s.seq1Range.endExclusive-c)||i.getElement(s.seq2Range.start-c)!==i.getElement(s.seq2Range.endExclusive-c));c++);if(c--,c===l){t[t.length-1]=new cf(new gi(r.seq1Range.start,s.seq1Range.endExclusive-l),new gi(r.seq2Range.start,s.seq2Range.endExclusive-l));continue}s=s.delta(-c)}t.push(s)}let o=[];for(let n=0;n<t.length-1;n++){let r=t[n+1],s=t[n];if(s.seq1Range.isEmpty||s.seq2Range.isEmpty){let l=r.seq1Range.start-s.seq1Range.endExclusive,c;for(c=0;c<l&&!(!a.isStronglyEqual(s.seq1Range.start+c,s.seq1Range.endExclusive+c)||!i.isStronglyEqual(s.seq2Range.start+c,s.seq2Range.endExclusive+c));c++);if(c===l){t[n+1]=new cf(new gi(s.seq1Range.start+l,r.seq1Range.endExclusive),new gi(s.seq2Range.start+l,r.seq2Range.endExclusive));continue}c>0&&(s=s.delta(c))}o.push(s)}return t.length>0&&o.push(t[t.length-1]),o}function A2o(a,i,e){if(!a.getBoundaryScore||!i.getBoundaryScore)return e;for(let t=0;t<e.length;t++){let o=t>0?e[t-1]:void 0,n=e[t],r=t+1<e.length?e[t+1]:void 0,s=new gi(o?o.seq1Range.endExclusive+1:0,r?r.seq1Range.start-1:a.length),l=new gi(o?o.seq2Range.endExclusive+1:0,r?r.seq2Range.start-1:i.length);n.seq1Range.isEmpty?e[t]=o9i(n,a,i,s,l):n.seq2Range.isEmpty&&(e[t]=o9i(n.swap(),i,a,l,s).swap())}return e}function o9i(a,i,e,t,o){let r=1;for(;a.seq1Range.start-r>=t.start&&a.seq2Range.start-r>=o.start&&e.isStronglyEqual(a.seq2Range.start-r,a.seq2Range.endExclusive-r)&&r<100;)r++;r--;let s=0;for(;a.seq1Range.start+s<t.endExclusive&&a.seq2Range.endExclusive+s<o.endExclusive&&e.isStronglyEqual(a.seq2Range.start+s,a.seq2Range.endExclusive+s)&&s<100;)s++;if(r===0&&s===0)return a;let l=0,c=-1;for(let u=-r;u<=s;u++){let p=a.seq2Range.start+u,h=a.seq2Range.endExclusive+u,g=a.seq1Range.start+u,f=i.getBoundaryScore(g)+e.getBoundaryScore(p)+e.getBoundaryScore(h);f>c&&(c=f,l=u)}return a.delta(l)}function n9i(a,i,e){let t=[];for(let o of e){let n=t[t.length-1];if(!n){t.push(o);continue}o.seq1Range.start-n.seq1Range.endExclusive<=2||o.seq2Range.start-n.seq2Range.endExclusive<=2?t[t.length-1]=new cf(n.seq1Range.join(o.seq1Range),n.seq2Range.join(o.seq2Range)):t.push(o)}return t}function Bri(a,i,e,t,o=!1){let n=cf.invert(e,a.length),r=[],s=new qz(0,0);function l(u,p){if(u.offset1<s.offset1||u.offset2<s.offset2)return;let h=t(a,u.offset1),g=t(i,u.offset2);if(!h||!g)return;let f=new cf(h,g),v=f.intersect(p),b=v.seq1Range.length,S=v.seq2Range.length;for(;n.length>0;){let y=n[0];if(!(y.seq1Range.intersects(f.seq1Range)||y.seq2Range.intersects(f.seq2Range)))break;let x=t(a,y.seq1Range.start),E=t(i,y.seq2Range.start),M=new cf(x,E),N=M.intersect(y);if(b+=N.seq1Range.length,S+=N.seq2Range.length,f=f.join(M),f.seq1Range.endExclusive>=y.seq1Range.endExclusive)n.shift();else break}(o&&b+S<f.seq1Range.length+f.seq2Range.length||b+S<(f.seq1Range.length+f.seq2Range.length)*2/3)&&r.push(f),s=f.getEndExclusives()}for(;n.length>0;){let u=n.shift();u.seq1Range.isEmpty||(l(u.getStarts(),u),l(u.getEndExclusives().delta(-1),u))}return N2o(e,r)}function N2o(a,i){let e=[];for(;a.length>0||i.length>0;){let t=a[0],o=i[0],n;t&&(!o||t.seq1Range.start<o.seq1Range.start)?n=a.shift():n=i.shift(),e.length>0&&e[e.length-1].seq1Range.endExclusive>=n.seq1Range.start?e[e.length-1]=e[e.length-1].join(n):e.push(n)}return e}function r9i(a,i,e){let t=e;if(t.length===0)return t;let o=0,n;do{n=!1;let r=[t[0]];for(let s=1;s<t.length;s++){let u=function(h,g){let f=new gi(c.seq1Range.endExclusive,l.seq1Range.start);return a.getText(f).replace(/\s/g,"").length<=4&&(h.seq1Range.length+h.seq2Range.length>5||g.seq1Range.length+g.seq2Range.length>5)},l=t[s],c=r[r.length-1];u(c,l)?(n=!0,r[r.length-1]=r[r.length-1].join(l)):r.push(l)}t=r}while(o++<10&&n);return t}function s9i(a,i,e){let t=e;if(t.length===0)return t;let o=0,n;do{n=!1;let s=[t[0]];for(let l=1;l<t.length;l++){let p=function(g,f){let v=new gi(u.seq1Range.endExclusive,c.seq1Range.start);if(a.countLinesIn(v)>5||v.length>500)return!1;let S=a.getText(v).trim();if(S.length>20||S.split(/\r\n|\r|\n/).length>1)return!1;let y=a.countLinesIn(g.seq1Range),w=g.seq1Range.length,x=i.countLinesIn(g.seq2Range),E=g.seq2Range.length,M=a.countLinesIn(f.seq1Range),N=f.seq1Range.length,V=i.countLinesIn(f.seq2Range),H=f.seq2Range.length,K=130;function j(J){return Math.min(J,K)}return Math.pow(Math.pow(j(y*40+w),1.5)+Math.pow(j(x*40+E),1.5),1.5)+Math.pow(Math.pow(j(M*40+N),1.5)+Math.pow(j(V*40+H),1.5),1.5)>(K**1.5)**1.5*1.3},c=t[l],u=s[s.length-1];p(u,c)?(n=!0,s[s.length-1]=s[s.length-1].join(c)):s.push(c)}t=s}while(o++<10&&n);let r=[];return z4i(t,(s,l,c)=>{let u=l;function p(S){return S.length>0&&S.trim().length<=3&&l.seq1Range.length+l.seq2Range.length>100}let h=a.extendToFullLines(l.seq1Range),g=a.getText(new gi(h.start,l.seq1Range.start));p(g)&&(u=u.deltaStart(-g.length));let f=a.getText(new gi(l.seq1Range.endExclusive,h.endExclusive));p(f)&&(u=u.deltaEnd(f.length));let v=cf.fromOffsetPairs(s?s.getEndExclusives():qz.zero,c?c.getStarts():qz.max),b=u.intersect(v);r.length>0&&b.getStarts().equals(r[r.length-1].getEndExclusives())?r[r.length-1]=r[r.length-1].join(b):r.push(b)}),r}var C3e=class{constructor(i,e){this.trimmedHash=i;this.lines=e}getElement(i){return this.trimmedHash[i]}get length(){return this.trimmedHash.length}getBoundaryScore(i){let e=i===0?0:a9i(this.lines[i-1]),t=i===this.lines.length?0:a9i(this.lines[i]);return 1e3-(e+t)}getText(i){return this.lines.slice(i.start,i.endExclusive).join(`
`)}isStronglyEqual(i,e){return this.lines[i]===this.lines[e]}};function a9i(a){let i=0;for(;i<a.length&&(a.charCodeAt(i)===32||a.charCodeAt(i)===9);)i++;return i}var CCe=class{constructor(){this.dynamicProgrammingDiffing=new NIt;this.myersDiffingAlgorithm=new yCe}computeDiff(i,e,t){if(i.length<=1&&eo(i,e,(N,V)=>N===V))return new GY([],[],!1);if(i.length===1&&i[0].length===0||e.length===1&&e[0].length===0)return new GY([new vv(new vo(1,i.length+1),new vo(1,e.length+1),[new lf(new G(1,1,i.length,i[i.length-1].length+1),new G(1,1,e.length,e[e.length-1].length+1))])],[],!1);let o=t.maxComputationTimeMs===0?$Y.instance:new AIt(t.maxComputationTimeMs),n=!t.ignoreTrimWhitespace,r=new Map;function s(N){let V=r.get(N);return V===void 0&&(V=r.size,r.set(N,V)),V}let l=i.map(N=>s(N.trim())),c=e.map(N=>s(N.trim())),u=new C3e(l,i),p=new C3e(c,e),h=u.length+p.length<1700?this.dynamicProgrammingDiffing.compute(u,p,o,(N,V)=>i[N]===e[V]?e[V].length===0?.1:1+Math.log(1+e[V].length):.99):this.myersDiffingAlgorithm.compute(u,p,o),g=h.diffs,f=h.hitTimeout;g=w3e(u,p,g),g=r9i(u,p,g);let v=[],b=N=>{if(n)for(let V=0;V<N;V++){let H=S+V,K=y+V;if(i[H]!==e[K]){let j=this.refineDiff(i,e,new cf(new gi(H,H+1),new gi(K,K+1)),o,n,t);for(let J of j.mappings)v.push(J);j.hitTimeout&&(f=!0)}}},S=0,y=0;for(let N of g){Wh(()=>N.seq1Range.start-S===N.seq2Range.start-y);let V=N.seq1Range.start-S;b(V),S=N.seq1Range.endExclusive,y=N.seq2Range.endExclusive;let H=this.refineDiff(i,e,N,o,n,t);H.hitTimeout&&(f=!0);for(let K of H.mappings)v.push(K)}b(i.length-S);let w=new Mce(i),x=new Mce(e),E=bCe(v,w,x),M=[];return t.computeMoves&&(M=this.computeMoves(E,i,e,l,c,o,n,t)),Wh(()=>{function N(H,K){if(H.lineNumber<1||H.lineNumber>K.length)return!1;let j=K[H.lineNumber-1];return!(H.column<1||H.column>j.length+1)}function V(H,K){return!(H.startLineNumber<1||H.startLineNumber>K.length+1||H.endLineNumberExclusive<1||H.endLineNumberExclusive>K.length+1)}for(let H of E){if(!H.innerChanges)return!1;for(let K of H.innerChanges)if(!(N(K.modifiedRange.getStartPosition(),e)&&N(K.modifiedRange.getEndPosition(),e)&&N(K.originalRange.getStartPosition(),i)&&N(K.originalRange.getEndPosition(),i)))return!1;if(!V(H.modified,e)||!V(H.original,i))return!1}return!0}),new GY(E,M,f)}computeMoves(i,e,t,o,n,r,s,l){return t9i(i,e,t,o,n,r).map(p=>{let h=this.refineDiff(e,t,new cf(p.original.toOffsetRange(),p.modified.toOffsetRange()),r,s,l),g=bCe(h.mappings,new Mce(e),new Mce(t),!0);return new gCe(p,g)})}refineDiff(i,e,t,o,n,r){let l=O2o(t).toRangeMapping2(i,e),c=new jY(i,l.originalRange,n),u=new jY(e,l.modifiedRange,n),p=c.length+u.length<500?this.dynamicProgrammingDiffing.compute(c,u,o):this.myersDiffingAlgorithm.compute(c,u,o),h=!1,g=p.diffs;h&&cf.assertSorted(g),g=w3e(c,u,g),h&&cf.assertSorted(g),g=Bri(c,u,g,(v,b)=>v.findWordContaining(b)),h&&cf.assertSorted(g),r.extendToSubwords&&(g=Bri(c,u,g,(v,b)=>v.findSubWordContaining(b),!0),h&&cf.assertSorted(g)),g=n9i(c,u,g),h&&cf.assertSorted(g),g=s9i(c,u,g),h&&cf.assertSorted(g);let f=g.map(v=>new lf(c.translateRange(v.seq1Range),u.translateRange(v.seq2Range)));return h&&lf.assertSorted(f),{mappings:f,hitTimeout:p.hitTimeout}}};function O2o(a){return new Oy(new vo(a.seq1Range.start+1,a.seq1Range.endExclusive+1),new vo(a.seq2Range.start+1,a.seq2Range.endExclusive+1))}var yF={getLegacy:()=>new MIt,getDefault:()=>new CCe};function QY(a,i){let e=Math.pow(10,i);return Math.round(a*e)/e}var Ut=class{constructor(i,e,t,o=1){this._rgbaBrand=void 0;this.r=Math.min(255,Math.max(0,i))|0,this.g=Math.min(255,Math.max(0,e))|0,this.b=Math.min(255,Math.max(0,t))|0,this.a=QY(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.r===e.r&&i.g===e.g&&i.b===e.b&&i.a===e.a}},jz=class a{constructor(i,e,t,o){this._hslaBrand=void 0;this.h=Math.max(Math.min(360,i),0)|0,this.s=QY(Math.max(Math.min(1,e),0),3),this.l=QY(Math.max(Math.min(1,t),0),3),this.a=QY(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.h===e.h&&i.s===e.s&&i.l===e.l&&i.a===e.a}static fromRGBA(i){let e=i.r/255,t=i.g/255,o=i.b/255,n=i.a,r=Math.max(e,t,o),s=Math.min(e,t,o),l=0,c=0,u=(s+r)/2,p=r-s;if(p>0){switch(c=Math.min(u<=.5?p/(2*u):p/(2-2*u),1),r){case e:l=(t-o)/p+(t<o?6:0);break;case t:l=(o-e)/p+2;break;case o:l=(e-t)/p+4;break}l*=60,l=Math.round(l)}return new a(l,c,u,n)}static _hue2rgb(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}static toRGBA(i){let e=i.h/360,{s:t,l:o,a:n}=i,r,s,l;if(t===0)r=s=l=o;else{let c=o<.5?o*(1+t):o+t-o*t,u=2*o-c;r=a._hue2rgb(u,c,e+1/3),s=a._hue2rgb(u,c,e),l=a._hue2rgb(u,c,e-1/3)}return new Ut(Math.round(r*255),Math.round(s*255),Math.round(l*255),n)}},wF=class a{constructor(i,e,t,o){this._hsvaBrand=void 0;this.h=Math.max(Math.min(360,i),0)|0,this.s=QY(Math.max(Math.min(1,e),0),3),this.v=QY(Math.max(Math.min(1,t),0),3),this.a=QY(Math.max(Math.min(1,o),0),3)}static equals(i,e){return i.h===e.h&&i.s===e.s&&i.v===e.v&&i.a===e.a}static fromRGBA(i){let e=i.r/255,t=i.g/255,o=i.b/255,n=Math.max(e,t,o),r=Math.min(e,t,o),s=n-r,l=n===0?0:s/n,c;return s===0?c=0:n===e?c=((t-o)/s%6+6)%6:n===t?c=(o-e)/s+2:c=(e-t)/s+4,new a(Math.round(c*60),l,n,i.a)}static toRGBA(i){let{h:e,s:t,v:o,a:n}=i,r=o*t,s=r*(1-Math.abs(e/60%2-1)),l=o-r,[c,u,p]=[0,0,0];return e<60?(c=r,u=s):e<120?(c=s,u=r):e<180?(u=r,p=s):e<240?(u=s,p=r):e<300?(c=s,p=r):e<=360&&(c=r,p=s),c=Math.round((c+l)*255),u=Math.round((u+l)*255),p=Math.round((p+l)*255),new Ut(c,u,p,n)}},Ue=class a{static fromHex(i){return a.Format.CSS.parseHex(i)||a.red}static equals(i,e){return!i&&!e?!0:!i||!e?!1:i.equals(e)}get hsla(){return this._hsla?this._hsla:jz.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:wF.fromRGBA(this.rgba)}constructor(i){if(i)if(i instanceof Ut)this.rgba=i;else if(i instanceof jz)this._hsla=i,this.rgba=jz.toRGBA(i);else if(i instanceof wF)this._hsva=i,this.rgba=wF.toRGBA(i);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(i){return!!i&&Ut.equals(this.rgba,i.rgba)&&jz.equals(this.hsla,i.hsla)&&wF.equals(this.hsva,i.hsva)}getRelativeLuminance(){let i=a._relativeLuminanceForComponent(this.rgba.r),e=a._relativeLuminanceForComponent(this.rgba.g),t=a._relativeLuminanceForComponent(this.rgba.b),o=.2126*i+.7152*e+.0722*t;return QY(o,4)}reduceRelativeLuminace(i,e){let{r:t,g:o,b:n}=i.rgba,r=this.getContrastRatio(i);for(;r<e&&(t>0||o>0||n>0);)t-=Math.max(0,Math.ceil(t*.1)),o-=Math.max(0,Math.ceil(o*.1)),n-=Math.max(0,Math.ceil(n*.1)),r=this.getContrastRatio(new a(new Ut(t,o,n)));return new a(new Ut(t,o,n))}increaseRelativeLuminace(i,e){let{r:t,g:o,b:n}=i.rgba,r=this.getContrastRatio(i);for(;r<e&&(t<255||o<255||n<255);)t=Math.min(255,t+Math.ceil((255-t)*.1)),o=Math.min(255,o+Math.ceil((255-o)*.1)),n=Math.min(255,n+Math.ceil((255-n)*.1)),r=this.getContrastRatio(new a(new Ut(t,o,n)));return new a(new Ut(t,o,n))}static _relativeLuminanceForComponent(i){let e=i/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}getContrastRatio(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)}isDarker(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3<128}isLighter(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3>=128}isLighterThan(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e>t}isDarkerThan(i){let e=this.getRelativeLuminance(),t=i.getRelativeLuminance();return e<t}ensureConstrast(i,e){let t=this.getRelativeLuminance(),o=i.getRelativeLuminance();if(this.getContrastRatio(i)<e){if(o<t){let l=this.reduceRelativeLuminace(i,e),c=this.getContrastRatio(l);if(c<e){let u=this.increaseRelativeLuminace(i,e),p=this.getContrastRatio(u);return c>p?l:u}return l}let r=this.increaseRelativeLuminace(i,e),s=this.getContrastRatio(r);if(s<e){let l=this.reduceRelativeLuminace(i,e),c=this.getContrastRatio(l);return s>c?r:l}return r}return i}lighten(i){return new a(new jz(this.hsla.h,this.hsla.s,this.hsla.l+this.hsla.l*i,this.hsla.a))}darken(i){return new a(new jz(this.hsla.h,this.hsla.s,this.hsla.l-this.hsla.l*i,this.hsla.a))}transparent(i){let{r:e,g:t,b:o,a:n}=this.rgba;return new a(new Ut(e,t,o,n*i))}isTransparent(){return this.rgba.a===0}isOpaque(){return this.rgba.a===1}opposite(){return new a(new Ut(255-this.rgba.r,255-this.rgba.g,255-this.rgba.b,this.rgba.a))}blend(i){let e=i.rgba,t=this.rgba.a,o=e.a,n=t+o*(1-t);if(n<1e-6)return a.transparent;let r=this.rgba.r*t/n+e.r*o*(1-t)/n,s=this.rgba.g*t/n+e.g*o*(1-t)/n,l=this.rgba.b*t/n+e.b*o*(1-t)/n;return new a(new Ut(r,s,l,n))}mix(i,e=.5){let t=Math.min(Math.max(e,0),1),o=this.rgba,n=i.rgba,r=o.r+(n.r-o.r)*t,s=o.g+(n.g-o.g)*t,l=o.b+(n.b-o.b)*t,c=o.a+(n.a-o.a)*t;return new a(new Ut(r,s,l,c))}makeOpaque(i){if(this.isOpaque()||i.rgba.a!==1)return this;let{r:e,g:t,b:o,a:n}=this.rgba;return new a(new Ut(i.rgba.r-n*(i.rgba.r-e),i.rgba.g-n*(i.rgba.g-t),i.rgba.b-n*(i.rgba.b-o),1))}flatten(...i){let e=i.reduceRight((t,o)=>a._flatten(o,t));return a._flatten(this,e)}static _flatten(i,e){let t=1-i.rgba.a;return new a(new Ut(t*e.rgba.r+i.rgba.a*i.rgba.r,t*e.rgba.g+i.rgba.a*i.rgba.g,t*e.rgba.b+i.rgba.a*i.rgba.b))}toString(){return this._toString||(this._toString=a.Format.CSS.format(this)),this._toString}toNumber32Bit(){return this._toNumber32Bit||(this._toNumber32Bit=(this.rgba.r<<24|this.rgba.g<<16|this.rgba.b<<8|this.rgba.a*255<<0)>>>0),this._toNumber32Bit}static getLighterColor(i,e,t){if(i.isLighterThan(e))return i;t=t||.5;let o=i.getRelativeLuminance(),n=e.getRelativeLuminance();return t=t*(n-o)/n,i.lighten(t)}static getDarkerColor(i,e,t){if(i.isDarkerThan(e))return i;t=t||.5;let o=i.getRelativeLuminance(),n=e.getRelativeLuminance();return t=t*(o-n)/o,i.darken(t)}static{this.white=new a(new Ut(255,255,255,1))}static{this.black=new a(new Ut(0,0,0,1))}static{this.red=new a(new Ut(255,0,0,1))}static{this.blue=new a(new Ut(0,0,255,1))}static{this.green=new a(new Ut(0,255,0,1))}static{this.cyan=new a(new Ut(0,255,255,1))}static{this.lightgrey=new a(new Ut(211,211,211,1))}static{this.transparent=new a(new Ut(0,0,0,0))}};(i=>{let a;(t=>{let e;(b=>{function o(S){return S.rgba.a===1?`rgb(${S.rgba.r}, ${S.rgba.g}, ${S.rgba.b})`:i.Format.CSS.formatRGBA(S)}b.formatRGB=o;function n(S){return`rgba(${S.rgba.r}, ${S.rgba.g}, ${S.rgba.b}, ${+S.rgba.a.toFixed(2)})`}b.formatRGBA=n;function r(S){return S.hsla.a===1?`hsl(${S.hsla.h}, ${Math.round(S.hsla.s*100)}%, ${Math.round(S.hsla.l*100)}%)`:i.Format.CSS.formatHSLA(S)}b.formatHSL=r;function s(S){return`hsla(${S.hsla.h}, ${Math.round(S.hsla.s*100)}%, ${Math.round(S.hsla.l*100)}%, ${S.hsla.a.toFixed(2)})`}b.formatHSLA=s;function l(S){let y=S.toString(16);return y.length!==2?"0"+y:y}function c(S){return`#${l(S.rgba.r)}${l(S.rgba.g)}${l(S.rgba.b)}`}b.formatHex=c;function u(S,y=!1){return y&&S.rgba.a===1?i.Format.CSS.formatHex(S):`#${l(S.rgba.r)}${l(S.rgba.g)}${l(S.rgba.b)}${l(Math.round(S.rgba.a*255))}`}b.formatHexA=u;function p(S){return S.isOpaque()?i.Format.CSS.formatHex(S):i.Format.CSS.formatRGBA(S)}b.format=p;function h(S){if(S==="transparent")return i.transparent;if(S.startsWith("#"))return f(S);if(S.startsWith("rgba(")){let y=S.match(/rgba\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+), *(?<a>(?:\+|-)?\d+(\.\d+)?)\)/);if(!y)throw new Error("Invalid color format "+S);let w=parseInt(y.groups?.r??"0"),x=parseInt(y.groups?.g??"0"),E=parseInt(y.groups?.b??"0"),M=parseFloat(y.groups?.a??"0");return new i(new Ut(w,x,E,M))}if(S.startsWith("rgb(")){let y=S.match(/rgb\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+)\)/);if(!y)throw new Error("Invalid color format "+S);let w=parseInt(y.groups?.r??"0"),x=parseInt(y.groups?.g??"0"),E=parseInt(y.groups?.b??"0");return new i(new Ut(w,x,E))}return g(S)}b.parse=h;function g(S){switch(S){case"aliceblue":return new i(new Ut(240,248,255,1));case"antiquewhite":return new i(new Ut(250,235,215,1));case"aqua":return new i(new Ut(0,255,255,1));case"aquamarine":return new i(new Ut(127,255,212,1));case"azure":return new i(new Ut(240,255,255,1));case"beige":return new i(new Ut(245,245,220,1));case"bisque":return new i(new Ut(255,228,196,1));case"black":return new i(new Ut(0,0,0,1));case"blanchedalmond":return new i(new Ut(255,235,205,1));case"blue":return new i(new Ut(0,0,255,1));case"blueviolet":return new i(new Ut(138,43,226,1));case"brown":return new i(new Ut(165,42,42,1));case"burlywood":return new i(new Ut(222,184,135,1));case"cadetblue":return new i(new Ut(95,158,160,1));case"chartreuse":return new i(new Ut(127,255,0,1));case"chocolate":return new i(new Ut(210,105,30,1));case"coral":return new i(new Ut(255,127,80,1));case"cornflowerblue":return new i(new Ut(100,149,237,1));case"cornsilk":return new i(new Ut(255,248,220,1));case"crimson":return new i(new Ut(220,20,60,1));case"cyan":return new i(new Ut(0,255,255,1));case"darkblue":return new i(new Ut(0,0,139,1));case"darkcyan":return new i(new Ut(0,139,139,1));case"darkgoldenrod":return new i(new Ut(184,134,11,1));case"darkgray":return new i(new Ut(169,169,169,1));case"darkgreen":return new i(new Ut(0,100,0,1));case"darkgrey":return new i(new Ut(169,169,169,1));case"darkkhaki":return new i(new Ut(189,183,107,1));case"darkmagenta":return new i(new Ut(139,0,139,1));case"darkolivegreen":return new i(new Ut(85,107,47,1));case"darkorange":return new i(new Ut(255,140,0,1));case"darkorchid":return new i(new Ut(153,50,204,1));case"darkred":return new i(new Ut(139,0,0,1));case"darksalmon":return new i(new Ut(233,150,122,1));case"darkseagreen":return new i(new Ut(143,188,143,1));case"darkslateblue":return new i(new Ut(72,61,139,1));case"darkslategray":return new i(new Ut(47,79,79,1));case"darkslategrey":return new i(new Ut(47,79,79,1));case"darkturquoise":return new i(new Ut(0,206,209,1));case"darkviolet":return new i(new Ut(148,0,211,1));case"deeppink":return new i(new Ut(255,20,147,1));case"deepskyblue":return new i(new Ut(0,191,255,1));case"dimgray":return new i(new Ut(105,105,105,1));case"dimgrey":return new i(new Ut(105,105,105,1));case"dodgerblue":return new i(new Ut(30,144,255,1));case"firebrick":return new i(new Ut(178,34,34,1));case"floralwhite":return new i(new Ut(255,250,240,1));case"forestgreen":return new i(new Ut(34,139,34,1));case"fuchsia":return new i(new Ut(255,0,255,1));case"gainsboro":return new i(new Ut(220,220,220,1));case"ghostwhite":return new i(new Ut(248,248,255,1));case"gold":return new i(new Ut(255,215,0,1));case"goldenrod":return new i(new Ut(218,165,32,1));case"gray":return new i(new Ut(128,128,128,1));case"green":return new i(new Ut(0,128,0,1));case"greenyellow":return new i(new Ut(173,255,47,1));case"grey":return new i(new Ut(128,128,128,1));case"honeydew":return new i(new Ut(240,255,240,1));case"hotpink":return new i(new Ut(255,105,180,1));case"indianred":return new i(new Ut(205,92,92,1));case"indigo":return new i(new Ut(75,0,130,1));case"ivory":return new i(new Ut(255,255,240,1));case"khaki":return new i(new Ut(240,230,140,1));case"lavender":return new i(new Ut(230,230,250,1));case"lavenderblush":return new i(new Ut(255,240,245,1));case"lawngreen":return new i(new Ut(124,252,0,1));case"lemonchiffon":return new i(new Ut(255,250,205,1));case"lightblue":return new i(new Ut(173,216,230,1));case"lightcoral":return new i(new Ut(240,128,128,1));case"lightcyan":return new i(new Ut(224,255,255,1));case"lightgoldenrodyellow":return new i(new Ut(250,250,210,1));case"lightgray":return new i(new Ut(211,211,211,1));case"lightgreen":return new i(new Ut(144,238,144,1));case"lightgrey":return new i(new Ut(211,211,211,1));case"lightpink":return new i(new Ut(255,182,193,1));case"lightsalmon":return new i(new Ut(255,160,122,1));case"lightseagreen":return new i(new Ut(32,178,170,1));case"lightskyblue":return new i(new Ut(135,206,250,1));case"lightslategray":return new i(new Ut(119,136,153,1));case"lightslategrey":return new i(new Ut(119,136,153,1));case"lightsteelblue":return new i(new Ut(176,196,222,1));case"lightyellow":return new i(new Ut(255,255,224,1));case"lime":return new i(new Ut(0,255,0,1));case"limegreen":return new i(new Ut(50,205,50,1));case"linen":return new i(new Ut(250,240,230,1));case"magenta":return new i(new Ut(255,0,255,1));case"maroon":return new i(new Ut(128,0,0,1));case"mediumaquamarine":return new i(new Ut(102,205,170,1));case"mediumblue":return new i(new Ut(0,0,205,1));case"mediumorchid":return new i(new Ut(186,85,211,1));case"mediumpurple":return new i(new Ut(147,112,219,1));case"mediumseagreen":return new i(new Ut(60,179,113,1));case"mediumslateblue":return new i(new Ut(123,104,238,1));case"mediumspringgreen":return new i(new Ut(0,250,154,1));case"mediumturquoise":return new i(new Ut(72,209,204,1));case"mediumvioletred":return new i(new Ut(199,21,133,1));case"midnightblue":return new i(new Ut(25,25,112,1));case"mintcream":return new i(new Ut(245,255,250,1));case"mistyrose":return new i(new Ut(255,228,225,1));case"moccasin":return new i(new Ut(255,228,181,1));case"navajowhite":return new i(new Ut(255,222,173,1));case"navy":return new i(new Ut(0,0,128,1));case"oldlace":return new i(new Ut(253,245,230,1));case"olive":return new i(new Ut(128,128,0,1));case"olivedrab":return new i(new Ut(107,142,35,1));case"orange":return new i(new Ut(255,165,0,1));case"orangered":return new i(new Ut(255,69,0,1));case"orchid":return new i(new Ut(218,112,214,1));case"palegoldenrod":return new i(new Ut(238,232,170,1));case"palegreen":return new i(new Ut(152,251,152,1));case"paleturquoise":return new i(new Ut(175,238,238,1));case"palevioletred":return new i(new Ut(219,112,147,1));case"papayawhip":return new i(new Ut(255,239,213,1));case"peachpuff":return new i(new Ut(255,218,185,1));case"peru":return new i(new Ut(205,133,63,1));case"pink":return new i(new Ut(255,192,203,1));case"plum":return new i(new Ut(221,160,221,1));case"powderblue":return new i(new Ut(176,224,230,1));case"purple":return new i(new Ut(128,0,128,1));case"rebeccapurple":return new i(new Ut(102,51,153,1));case"red":return new i(new Ut(255,0,0,1));case"rosybrown":return new i(new Ut(188,143,143,1));case"royalblue":return new i(new Ut(65,105,225,1));case"saddlebrown":return new i(new Ut(139,69,19,1));case"salmon":return new i(new Ut(250,128,114,1));case"sandybrown":return new i(new Ut(244,164,96,1));case"seagreen":return new i(new Ut(46,139,87,1));case"seashell":return new i(new Ut(255,245,238,1));case"sienna":return new i(new Ut(160,82,45,1));case"silver":return new i(new Ut(192,192,192,1));case"skyblue":return new i(new Ut(135,206,235,1));case"slateblue":return new i(new Ut(106,90,205,1));case"slategray":return new i(new Ut(112,128,144,1));case"slategrey":return new i(new Ut(112,128,144,1));case"snow":return new i(new Ut(255,250,250,1));case"springgreen":return new i(new Ut(0,255,127,1));case"steelblue":return new i(new Ut(70,130,180,1));case"tan":return new i(new Ut(210,180,140,1));case"teal":return new i(new Ut(0,128,128,1));case"thistle":return new i(new Ut(216,191,216,1));case"tomato":return new i(new Ut(255,99,71,1));case"turquoise":return new i(new Ut(64,224,208,1));case"violet":return new i(new Ut(238,130,238,1));case"wheat":return new i(new Ut(245,222,179,1));case"white":return new i(new Ut(255,255,255,1));case"whitesmoke":return new i(new Ut(245,245,245,1));case"yellow":return new i(new Ut(255,255,0,1));case"yellowgreen":return new i(new Ut(154,205,50,1));default:return null}}function f(S){let y=S.length;if(y===0||S.charCodeAt(0)!==35)return null;if(y===7){let w=16*v(S.charCodeAt(1))+v(S.charCodeAt(2)),x=16*v(S.charCodeAt(3))+v(S.charCodeAt(4)),E=16*v(S.charCodeAt(5))+v(S.charCodeAt(6));return new i(new Ut(w,x,E,1))}if(y===9){let w=16*v(S.charCodeAt(1))+v(S.charCodeAt(2)),x=16*v(S.charCodeAt(3))+v(S.charCodeAt(4)),E=16*v(S.charCodeAt(5))+v(S.charCodeAt(6)),M=16*v(S.charCodeAt(7))+v(S.charCodeAt(8));return new i(new Ut(w,x,E,M/255))}if(y===4){let w=v(S.charCodeAt(1)),x=v(S.charCodeAt(2)),E=v(S.charCodeAt(3));return new i(new Ut(16*w+w,16*x+x,16*E+E))}if(y===5){let w=v(S.charCodeAt(1)),x=v(S.charCodeAt(2)),E=v(S.charCodeAt(3)),M=v(S.charCodeAt(4));return new i(new Ut(16*w+w,16*x+x,16*E+E,(16*M+M)/255))}return null}b.parseHex=f;function v(S){switch(S){case 48:return 0;case 49:return 1;case 50:return 2;case 51:return 3;case 52:return 4;case 53:return 5;case 54:return 6;case 55:return 7;case 56:return 8;case 57:return 9;case 97:return 10;case 65:return 10;case 98:return 11;case 66:return 11;case 99:return 12;case 67:return 12;case 100:return 13;case 68:return 13;case 101:return 14;case 69:return 14;case 102:return 15;case 70:return 15}return 0}})(e=t.CSS||={})})(a=i.Format||={})})(Ue||={});function d9i(a){let i=[];for(let e of a){let t=Number(e);(t||t===0&&e.replace(/\s/g,"")!=="")&&i.push(t)}return i}function Hri(a,i,e,t){return{red:a/255,blue:e/255,green:i/255,alpha:t}}function x3e(a,i){let e=i.index,t=i[0].length;if(e===void 0)return;let o=a.positionAt(e);return{startLineNumber:o.lineNumber,startColumn:o.column,endLineNumber:o.lineNumber,endColumn:o.column+t}}function F2o(a,i){if(!a)return;let e=Ue.Format.CSS.parseHex(i);if(e)return{range:a,color:Hri(e.rgba.r,e.rgba.g,e.rgba.b,e.rgba.a)}}function l9i(a,i,e){if(!a||i.length!==1)return;let o=i[0].values(),n=d9i(o);return{range:a,color:Hri(n[0],n[1],n[2],e?n[3]:1)}}function c9i(a,i,e){if(!a||i.length!==1)return;let o=i[0].values(),n=d9i(o),r=new Ue(new jz(n[0],n[1]/100,n[2]/100,e?n[3]:1));return{range:a,color:Hri(r.rgba.r,r.rgba.g,r.rgba.b,r.rgba.a)}}function k3e(a,i){return typeof a=="string"?[...a.matchAll(i)]:a.findMatches(i)}function W2o(a){let i=[],t=k3e(a,/\b(rgb|rgba|hsl|hsla)(\([0-9\s,.\%\/]*\))|^(#)([A-Fa-f0-9]{3})\b|^(#)([A-Fa-f0-9]{4})\b|^(#)([A-Fa-f0-9]{6})\b|^(#)([A-Fa-f0-9]{8})\b|(?<=['"\s])(#)([A-Fa-f0-9]{3})\b|(?<=['"\s])(#)([A-Fa-f0-9]{4})\b|(?<=['"\s])(#)([A-Fa-f0-9]{6})\b|(?<=['"\s])(#)([A-Fa-f0-9]{8})\b/gm);if(t.length>0)for(let o of t){let n=o.filter(c=>c!==void 0),r=n[1],s=n[2];if(!s)continue;let l;if(r==="rgb"){let c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*\)$/gm;l=l9i(x3e(a,o),k3e(s,c),!1)}else if(r==="rgba"){let c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*[\s,]\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*(?:[\s,]|[\s]*\/)\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=l9i(x3e(a,o),k3e(s,c),!0)}else if(r==="hsl"){let c=/^\(\s*((?:360(?:\.0+)?|(?:36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])(?:\.\d+)?))\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*\)$/gm;l=c9i(x3e(a,o),k3e(s,c),!1)}else if(r==="hsla"){let c=/^\(\s*((?:360(?:\.0+)?|(?:36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])(?:\.\d+)?))\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(100(?:\.0+)?|\d{1,2}[.]\d*|\d{1,2})%\s*(?:[\s,]|[\s]*\/)\s*(0[.][0-9]+|[.][0-9]+|[01][.]0*|[01])\s*\)$/gm;l=c9i(x3e(a,o),k3e(s,c),!0)}else r==="#"&&(l=F2o(x3e(a,o),r+s));l&&i.push(l)}return i}function u9i(a){return!a||typeof a.getValue!="function"||typeof a.positionAt!="function"?[]:W2o(a)}var V2o=/^-+|-+$/g,p9i=100,B2o=5;function m9i(a,i){let e=[];if(i.findRegionSectionHeaders&&i.foldingRules?.markers){let t=H2o(a,i);e=e.concat(t)}if(i.findMarkSectionHeaders){let t=U2o(a,i);e=e.concat(t)}return e}function H2o(a,i){let e=[],t=a.getLineCount();for(let o=1;o<=t;o++){let n=a.getLineContent(o),r=n.match(i.foldingRules.markers.start);if(r){let s={startLineNumber:o,startColumn:r[0].length+1,endLineNumber:o,endColumn:n.length+1};if(s.endColumn>s.startColumn){let l={range:s,...z2o(n.substring(r[0].length)),shouldBeInComments:!1};(l.text||l.hasSeparatorLine)&&e.push(l)}}}return e}function U2o(a,i){let e=[],t=a.getLineCount();if(!i.markSectionHeaderRegex||i.markSectionHeaderRegex.trim()==="")return e;let o=v3e(i.markSectionHeaderRegex),n=new RegExp(i.markSectionHeaderRegex,`gdm${o?"s":""}`);if(lwe(n))return e;for(let r=1;r<=t;r+=p9i-B2o){let s=Math.min(r+p9i-1,t),l=[];for(let p=r;p<=s;p++)l.push(a.getLineContent(p));let c=l.join(`
`);n.lastIndex=0;let u;for(;(u=n.exec(c))!==null;){let p=c.substring(0,u.index),h=(p.match(/\n/g)||[]).length,g=r+h,f=u[0].split(`
`),v=f.length,b=g+v-1,S=p.lastIndexOf(`
`)+1,y=u.index-S+1,w=f[f.length-1],x=v===1?y+u[0].length:w.length+1,E={startLineNumber:g,startColumn:y,endLineNumber:b,endColumn:x},M=(u.groups??{}).label??"",N=((u.groups??{}).separator??"")!=="",V={range:E,text:M,hasSeparatorLine:N,shouldBeInComments:!0};(V.text||V.hasSeparatorLine)&&(e.length===0||e[e.length-1].range.endLineNumber<V.range.startLineNumber)&&e.push(V),n.lastIndex=u.index+u[0].length}}return e}function z2o(a){a=a.trim();let i=a.startsWith("-");return a=a.replace(V2o,""),{text:a,hasSeparatorLine:i}}var fD=class{constructor(i){this.values=i,this.prefixSum=new Uint32Array(i.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}getCount(){return this.values.length}insertValues(i,e){i=Lle(i);let t=this.values,o=this.prefixSum,n=e.length;return n===0?!1:(this.values=new Uint32Array(t.length+n),this.values.set(t.subarray(0,i),0),this.values.set(t.subarray(i),i+n),this.values.set(e,i),i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-1),this.prefixSum=new Uint32Array(this.values.length),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(o.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(i,e){return i=Lle(i),e=Lle(e),this.values[i]===e?!1:(this.values[i]=e,i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-1),!0)}removeValues(i,e){i=Lle(i),e=Lle(e);let t=this.values,o=this.prefixSum;if(i>=t.length)return!1;let n=t.length-i;return e>=n&&(e=n),e===0?!1:(this.values=new Uint32Array(t.length-e),this.values.set(t.subarray(0,i),0),this.values.set(t.subarray(i+e),i),this.prefixSum=new Uint32Array(this.values.length),i-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=i-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(i){return i<0?0:(i=Lle(i),this._getPrefixSum(i))}_getPrefixSum(i){if(i<=this.prefixSumValidIndex[0])return this.prefixSum[i];let e=this.prefixSumValidIndex[0]+1;e===0&&(this.prefixSum[0]=this.values[0],e++),i>=this.values.length&&(i=this.values.length-1);for(let t=e;t<=i;t++)this.prefixSum[t]=this.prefixSum[t-1]+this.values[t];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],i),this.prefixSum[i]}getIndexOf(i){i=Math.floor(i),this.getTotalSum();let e=0,t=this.values.length-1,o=0,n=0,r=0;for(;e<=t;)if(o=e+(t-e)/2|0,n=this.prefixSum[o],r=n-this.values[o],i<r)t=o-1;else if(i>=n)e=o+1;else break;return new E3e(o,i-r)}},xCe=class{constructor(i){this._values=i,this._isValid=!1,this._validEndIndex=-1,this._prefixSum=[],this._indexBySum=[]}getTotalSum(){return this._ensureValid(),this._indexBySum.length}getPrefixSum(i){return this._ensureValid(),i===0?0:this._prefixSum[i-1]}getIndexOf(i){this._ensureValid();let e=this._indexBySum[i];if(e===void 0){let o=Math.max(0,this._values.length-1),n=o>0?this._prefixSum[o-1]:0;return new E3e(o,i-n)}let t=e>0?this._prefixSum[e-1]:0;return new E3e(e,i-t)}removeValues(i,e){this._values.splice(i,e),this._invalidate(i)}insertValues(i,e){this._values=dz(this._values,i,e),this._invalidate(i)}_invalidate(i){this._isValid=!1,this._validEndIndex=Math.min(this._validEndIndex,i-1)}_ensureValid(){if(!this._isValid){for(let i=this._validEndIndex+1,e=this._values.length;i<e;i++){let t=this._values[i],o=i>0?this._prefixSum[i-1]:0;this._prefixSum[i]=o+t;for(let n=0;n<t;n++)this._indexBySum[o+n]=i}this._prefixSum.length=this._values.length,this._indexBySum.length=this._values.length>0?this._prefixSum[this._values.length-1]:0,this._isValid=!0,this._validEndIndex=this._values.length-1}}setValue(i,e){this._values[i]!==e&&(this._values[i]=e,this._invalidate(i))}},E3e=class{constructor(i,e){this.index=i;this.remainder=e;this._prefixSumIndexOfResultBrand=void 0;this.index=i,this.remainder=e}};var FIt=class{constructor(i,e,t,o){this._uri=i,this._lines=e,this._eol=t,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(i){i.eol&&i.eol!==this._eol&&(this._eol=i.eol,this._lineStarts=null);let e=i.changes;for(let t of e)this._acceptDeleteRange(t.range),this._acceptInsertText(new ye(t.range.startLineNumber,t.range.startColumn),t.text);this._versionId=i.versionId,this._cachedTextValue=null}_ensureLineStarts(){if(!this._lineStarts){let i=this._eol.length,e=this._lines.length,t=new Uint32Array(e);for(let o=0;o<e;o++)t[o]=this._lines[o].length+i;this._lineStarts=new fD(t)}}_setLineText(i,e){this._lines[i]=e,this._lineStarts&&this._lineStarts.setValue(i,this._lines[i].length+this._eol.length)}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber){if(i.startColumn===i.endColumn)return;this._setLineText(i.startLineNumber-1,this._lines[i.startLineNumber-1].substring(0,i.startColumn-1)+this._lines[i.startLineNumber-1].substring(i.endColumn-1));return}this._setLineText(i.startLineNumber-1,this._lines[i.startLineNumber-1].substring(0,i.startColumn-1)+this._lines[i.endLineNumber-1].substring(i.endColumn-1)),this._lines.splice(i.startLineNumber,i.endLineNumber-i.startLineNumber),this._lineStarts&&this._lineStarts.removeValues(i.startLineNumber,i.endLineNumber-i.startLineNumber)}_acceptInsertText(i,e){if(e.length===0)return;let t=Hc(e);if(t.length===1){this._setLineText(i.lineNumber-1,this._lines[i.lineNumber-1].substring(0,i.column-1)+t[0]+this._lines[i.lineNumber-1].substring(i.column-1));return}t[t.length-1]+=this._lines[i.lineNumber-1].substring(i.column-1),this._setLineText(i.lineNumber-1,this._lines[i.lineNumber-1].substring(0,i.column-1)+t[0]);let o=new Uint32Array(t.length-1);for(let n=1;n<t.length;n++)this._lines.splice(i.lineNumber+n-1,0,t[n]),o[n-1]=t[n].length+this._eol.length;this._lineStarts&&this._lineStarts.insertValues(i.lineNumber,o)}};var h9i=60*1e3,g9i="workerTextModelSync",YY=class a extends k{constructor(e,t,o=!1){super();this._syncedModels=Object.create(null);this._syncedModelsLastUsedTime=Object.create(null);if(this._proxy=e,this._modelService=t,!o){let n=new ky;n.cancelAndSet(()=>this._checkStopModelSync(),Math.round(h9i/2)),this._register(n)}}static create(e,t){return new a(e.getChannel(g9i),t)}dispose(){for(let e in this._syncedModels)je(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e,t=!1){for(let o of e){let n=o.toString();this._syncedModels[n]||this._beginModelSync(o,t),this._syncedModels[n]&&(this._syncedModelsLastUsedTime[n]=new Date().getTime())}}_checkStopModelSync(){let e=new Date().getTime(),t=[];for(let o in this._syncedModelsLastUsedTime)e-this._syncedModelsLastUsedTime[o]>h9i&&t.push(o);for(let o of t)this._stopModelSync(o)}_beginModelSync(e,t){let o=this._modelService.getModel(e);if(!o||!t&&o.isTooLargeForSyncing())return;let n=e.toString();this._proxy.$acceptNewModel({url:o.uri.toString(),lines:o.getLinesContent(),EOL:o.getEOL(),versionId:o.getVersionId()});let r=new O;r.add(o.onDidChangeContent(s=>{this._proxy.$acceptModelChanged(n.toString(),s)})),r.add(o.onWillDispose(()=>{this._stopModelSync(n)})),r.add(ee(()=>{this._proxy.$acceptRemovedModel(n)})),this._syncedModels[n]=r}_stopModelSync(e){let t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],je(t)}},WIt=class{constructor(){this._models=Object.create(null)}bindToServer(i){i.setChannel(g9i,this)}getModel(i){return this._models[i]}getModels(){let i=[];return Object.keys(this._models).forEach(e=>i.push(this._models[e])),i}$acceptNewModel(i){this._models[i.url]=new Uri(A.parse(i.url),i.lines,i.EOL,i.versionId)}$acceptModelChanged(i,e){if(!this._models[i])return;this._models[i].onEvents(e)}$acceptRemovedModel(i){this._models[i]&&delete this._models[i]}},Uri=class extends FIt{get uri(){return this._uri}get eol(){return this._eol}getValue(){return this.getText()}findMatches(i){let e=[];for(let t=0;t<this._lines.length;t++){let o=this._lines[t],n=this.offsetAt(new ye(t+1,1)),r=o.matchAll(i);for(let s of r)(s.index||s.index===0)&&(s.index=s.index+n),e.push(s)}return e}getLinesContent(){return this._lines.slice(0)}getLineCount(){return this._lines.length}getLineContent(i){return this._lines[i-1]}getWordAtPosition(i,e){let t=Rk(i.column,c5(e),this._lines[i.lineNumber-1],0);return t?new G(i.lineNumber,t.startColumn,i.lineNumber,t.endColumn):null}getWordUntilPosition(i,e){let t=this.getWordAtPosition(i,e);return t?{word:this._lines[i.lineNumber-1].substring(t.startColumn-1,i.column-1),startColumn:t.startColumn,endColumn:i.column}:{word:"",startColumn:i.column,endColumn:i.column}}words(i){let e=this._lines,t=this._wordenize.bind(this),o=0,n="",r=0,s=[];return{*[Symbol.iterator](){for(;;)if(r<s.length){let l=n.substring(s[r].start,s[r].end);r+=1,yield l}else if(o<e.length)n=e[o],s=t(n,i),r=0,o+=1;else break}}}getLineWords(i,e){let t=this._lines[i-1],o=this._wordenize(t,e),n=[];for(let r of o)n.push({word:t.substring(r.start,r.end),startColumn:r.start+1,endColumn:r.end+1});return n}_wordenize(i,e){let t=[],o;for(e.lastIndex=0;(o=e.exec(i))&&o[0].length!==0;)t.push({start:o.index,end:o.index+o[0].length});return t}getValueInRange(i){if(i=this._validateRange(i),i.startLineNumber===i.endLineNumber)return this._lines[i.startLineNumber-1].substring(i.startColumn-1,i.endColumn-1);let e=this._eol,t=i.startLineNumber-1,o=i.endLineNumber-1,n=[];n.push(this._lines[t].substring(i.startColumn-1));for(let r=t+1;r<o;r++)n.push(this._lines[r]);return n.push(this._lines[o].substring(0,i.endColumn-1)),n.join(e)}offsetAt(i){return i=this._validatePosition(i),this._ensureLineStarts(),this._lineStarts.getPrefixSum(i.lineNumber-2)+(i.column-1)}positionAt(i){i=Math.floor(i),i=Math.max(0,i),this._ensureLineStarts();let e=this._lineStarts.getIndexOf(i),t=this._lines[e.index].length;return{lineNumber:1+e.index,column:1+Math.min(e.remainder,t)}}_validateRange(i){let e=this._validatePosition({lineNumber:i.startLineNumber,column:i.startColumn}),t=this._validatePosition({lineNumber:i.endLineNumber,column:i.endColumn});return e.lineNumber!==i.startLineNumber||e.column!==i.startColumn||t.lineNumber!==i.endLineNumber||t.column!==i.endColumn?{startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:t.lineNumber,endColumn:t.column}:i}_validatePosition(i){if(!ye.isIPosition(i))throw new Error("bad position");let{lineNumber:e,column:t}=i,o=!1;if(e<1)e=1,t=1,o=!0;else if(e>this._lines.length)e=this._lines.length,t=this._lines[e-1].length+1,o=!0;else{let n=this._lines[e-1].length+1;t<1?(t=1,o=!0):t>n&&(t=n,o=!0)}return o?{lineNumber:e,column:t}:i}};var Pce=class{constructor(i){this.replacements=i;let e=-1;for(let t of i){if(!(t.replaceRange.start>=e))throw new ci(`Edits must be disjoint and sorted. Found ${t} after ${e}`);e=t.replaceRange.endExclusive}}equals(i){if(this.replacements.length!==i.replacements.length)return!1;for(let e=0;e<this.replacements.length;e++)if(!this.replacements[e].equals(i.replacements[e]))return!1;return!0}toString(){return`[${this.replacements.map(e=>e.toString()).join(", ")}]`}normalize(){let i=[],e;for(let t of this.replacements)if(!(t.getNewLength()===0&&t.replaceRange.length===0)){if(e&&e.replaceRange.endExclusive===t.replaceRange.start){let o=e.tryJoinTouching(t);if(o){e=o;continue}}e&&i.push(e),e=t}return e&&i.push(e),this._createNew(i)}compose(i){let e=this.normalize(),t=i.normalize();if(e.isEmpty())return t;if(t.isEmpty())return e;let o=[...e.replacements],n=[],r=0;for(let s of t.replacements){for(;;){let p=o[0];if(!p||p.replaceRange.start+r+p.getNewLength()>=s.replaceRange.start)break;o.shift(),n.push(p),r+=p.getNewLength()-p.replaceRange.length}let l=r,c,u;for(;;){let p=o[0];if(!p||p.replaceRange.start+r>s.replaceRange.endExclusive)break;c||(c=p),u=p,o.shift(),r+=p.getNewLength()-p.replaceRange.length}if(!c)n.push(s.delta(-r));else{let p=Math.min(c.replaceRange.start,s.replaceRange.start-l),h=s.replaceRange.start-(c.replaceRange.start+l);if(h>0){let b=c.slice(gi.emptyAt(p),new gi(0,h));n.push(b)}if(!u)throw new ci("Invariant violation: lastIntersecting is undefined");let g=u.replaceRange.endExclusive+r-s.replaceRange.endExclusive;if(g>0){let b=u.slice(gi.ofStartAndLength(u.replaceRange.endExclusive,0),new gi(u.getNewLength()-g,u.getNewLength()));o.unshift(b),r-=b.getNewLength()-b.replaceRange.length}let f=new gi(p,s.replaceRange.endExclusive-r),v=s.slice(f,new gi(0,s.getNewLength()));n.push(v)}}for(;;){let s=o.shift();if(!s)break;n.push(s)}return this._createNew(n).normalize()}decomposeSplit(i){let e=[],t=[],o=0;for(let n of this.replacements)i(n)?(e.push(n),o+=n.getNewLength()-n.replaceRange.length):t.push(n.slice(n.replaceRange.delta(o),new gi(0,n.getNewLength())));return{e1:this._createNew(e),e2:this._createNew(t)}}getNewRanges(){let i=[],e=0;for(let t of this.replacements)i.push(gi.ofStartAndLength(t.replaceRange.start+e,t.getNewLength())),e+=t.getLengthDelta();return i}getJoinedReplaceRange(){if(this.replacements.length!==0)return this.replacements[0].replaceRange.join(this.replacements.at(-1).replaceRange)}isEmpty(){return this.replacements.length===0}getLengthDelta(){return Pw(this.replacements,i=>i.getLengthDelta())}getNewDataLength(i){return i+this.getLengthDelta()}applyToOffset(i){let e=0;for(let t of this.replacements)if(t.replaceRange.start<=i){if(i<t.replaceRange.endExclusive)return t.replaceRange.start+e;e+=t.getNewLength()-t.replaceRange.length}else break;return i+e}applyToOffsetRange(i){return new gi(this.applyToOffset(i.start),this.applyToOffset(i.endExclusive))}applyInverseToOffset(i){let e=0;for(let t of this.replacements){let o=t.getNewLength();if(t.replaceRange.start<=i-e){if(i-e<t.replaceRange.start+o)return t.replaceRange.start;e+=o-t.replaceRange.length}else break}return i-e}applyToOffsetOrUndefined(i){let e=0;for(let t of this.replacements)if(t.replaceRange.start<=i){if(i<t.replaceRange.endExclusive)return;e+=t.getNewLength()-t.replaceRange.length}else break;return i+e}applyToOffsetRangeOrUndefined(i){let e=this.applyToOffsetOrUndefined(i.start);if(e===void 0)return;let t=this.applyToOffsetOrUndefined(i.endExclusive);if(t!==void 0)return new gi(e,t)}},kCe=class{constructor(i){this.replaceRange=i}delta(i){return this.slice(this.replaceRange.delta(i),new gi(0,this.getNewLength()))}getLengthDelta(){return this.getNewLength()-this.replaceRange.length}toString(){return`{ ${this.replaceRange.toString()} -> ${this.getNewLength()} }`}get isEmpty(){return this.getNewLength()===0&&this.replaceRange.length===0}getRangeAfterReplace(){return new gi(this.replaceRange.start,this.replaceRange.start+this.getNewLength())}},f9i=class a extends Pce{static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}_createNew(i){return new a(i)}};var TCe=class extends Pce{get TReplacement(){throw new Error("TReplacement is not defined for BaseStringEdit")}static composeOrUndefined(i){if(i.length===0)return;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}static trySwap(i,e){let t=i.inverseOnSlice((r,s)=>" ".repeat(s-r)),o=e.tryRebase(t);if(!o)return;let n=i.tryRebase(o);if(n)return{e1:o,e2:n}}apply(i){let e=[],t=0;for(let o of this.replacements)e.push(i.substring(t,o.replaceRange.start)),e.push(o.newText),t=o.replaceRange.endExclusive;return e.push(i.substring(t)),e.join("")}inverseOnSlice(i){let e=[],t=0;for(let o of this.replacements)e.push(xd.replace(gi.ofStartAndLength(o.replaceRange.start+t,o.newText.length),i(o.replaceRange.start,o.replaceRange.endExclusive))),t+=o.newText.length-o.replaceRange.length;return new Ad(e)}inverse(i){return this.inverseOnSlice((e,t)=>i.substring(e,t))}rebaseSkipConflicting(i){return this._tryRebase(i,!1)}tryRebase(i){return this._tryRebase(i,!0)}_tryRebase(i,e){let t=[],o=0,n=0,r=0;for(;n<this.replacements.length||o<i.replacements.length;){let s=i.replacements.at(o),l=this.replacements.at(n);if(l)if(s)if(l.replaceRange.intersects(s.replaceRange)||K2o(l.replaceRange,s.replaceRange)||v9i(l.replaceRange,s.replaceRange)||v9i(s.replaceRange,l.replaceRange)){if(n++,e)return}else if(l.replaceRange.start<s.replaceRange.start||l.replaceRange.isEmpty&&l.replaceRange.start===s.replaceRange.start){let c=l.replaceRange.delta(r);t.push(new xd(c,l.newText)),n++}else o++,r+=s.newText.length-s.replaceRange.length;else{let c=l.replaceRange.delta(r);t.push(new xd(c,l.newText)),n++}else break}return new Ad(t)}toJson(){return this.replacements.map(i=>i.toJson())}isNeutralOn(i){return this.replacements.every(e=>e.isNeutralOn(i))}removeCommonSuffixPrefix(i){let e=[];for(let t of this.replacements){let o=t.removeCommonSuffixPrefix(i);o.isEmpty||e.push(o)}return new Ad(e)}normalizeEOL(i){return new Ad(this.replacements.map(e=>e.normalizeEOL(i)))}normalizeOnSource(i){let e=this.apply(i),o=xd.replace(gi.ofLength(i.length),e).removeCommonSuffixAndPrefix(i);return o.isEmpty?Ad.empty:o.toEdit()}removeCommonSuffixAndPrefix(i){return this._createNew(this.replacements.map(e=>e.removeCommonSuffixAndPrefix(i))).normalize()}applyOnText(i){return new _I(this.apply(i.value))}mapData(i){return new Fy(this.replacements.map(e=>new ECe(e.replaceRange,e.newText,i(e))))}},VIt=class extends kCe{constructor(e,t){super(e);this.newText=t}getNewLength(){return this.newText.length}toString(){return`${this.replaceRange} -> ${JSON.stringify(this.newText)}`}replace(e){return e.substring(0,this.replaceRange.start)+this.newText+e.substring(this.replaceRange.endExclusive)}isNeutralOn(e){return this.newText===e.substring(this.replaceRange.start,this.replaceRange.endExclusive)}removeCommonSuffixPrefix(e){let t=e.substring(this.replaceRange.start,this.replaceRange.endExclusive),o=Af(t,this.newText),n=Math.min(t.length-o,this.newText.length-o,lx(t,this.newText)),r=new gi(this.replaceRange.start+o,this.replaceRange.endExclusive-n),s=this.newText.substring(o,this.newText.length-n);return new xd(r,s)}normalizeEOL(e){let t=this.newText.replace(/\r\n|\n/g,e);return new xd(this.replaceRange,t)}removeCommonSuffixAndPrefix(e){return this.removeCommonSuffix(e).removeCommonPrefix(e)}removeCommonPrefix(e){let t=this.replaceRange.substring(e),o=Af(t,this.newText);return o===0?this:this.slice(this.replaceRange.deltaStart(o),new gi(o,this.newText.length))}removeCommonSuffix(e){let t=this.replaceRange.substring(e),o=lx(t,this.newText);return o===0?this:this.slice(this.replaceRange.deltaEnd(-o),new gi(0,this.newText.length-o))}toEdit(){return new Ad([this])}toJson(){return{txt:this.newText,pos:this.replaceRange.start,len:this.replaceRange.length}}},Ad=class a extends TCe{static parse(i){let e=[],t=/\[(\d+),\s*(\d+)\)\s*->\s*"([^"]*)"/g,o;for(;(o=t.exec(i))!==null;){let n=parseInt(o[1],10),r=parseInt(o[2],10),s=o[3].replace(/\\n/g,`
`).replace(/\\r/g,"\r").replace(/\\\\/g,"\\");e.push(new xd(new gi(n,r),s))}return new a(e)}static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e){return new a([new xd(i,e)])}static insert(i,e){return new a([new xd(gi.emptyAt(i),e)])}static delete(i){return new a([new xd(i,"")])}static fromJson(i){return new a(i.map(xd.fromJson))}static compose(i){if(i.length===0)return a.empty;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}static composeSequentialReplacements(i){let e=a.empty,t=[];for(let o of i){let n=t.at(-1);!n||o.replaceRange.isBefore(n.replaceRange)?t.push(o):(e=e.compose(a.create(t.reverse())),t=[o])}return e=e.compose(a.create(t.reverse())),e}constructor(i){super(i)}_createNew(i){return new a(i)}},xd=class a extends VIt{static insert(i,e){return new a(gi.emptyAt(i),e)}static replace(i,e){return new a(i,e)}static delete(i){return new a(i,"")}static fromJson(i){return new a(gi.ofStartAndLength(i.pos,i.len),i.txt)}equals(i){return this.replaceRange.equals(i.replaceRange)&&this.newText===i.newText}tryJoinTouching(i){return new a(this.replaceRange.joinRightTouching(i.replaceRange),this.newText+i.newText)}slice(i,e){return new a(i,e?e.substring(this.newText):this.newText)}};function zri(a,i){a=a.slice();let e=[],t=0;for(let o of i.replacements){for(;;){let r=a[0];if(!r||r.endExclusive>=o.replaceRange.start)break;a.shift(),e.push(r.delta(t))}let n=[];for(;;){let r=a[0];if(!r||!r.intersectsOrTouches(o.replaceRange))break;a.shift(),n.push(r)}for(let r=n.length-1;r>=0;r--){let s=n[r],l=s.intersect(o.replaceRange).length;s=s.deltaEnd(-l+(r===0?o.newText.length:0));let c=s.start-o.replaceRange.start;c>0&&(s=s.delta(-c)),r!==0&&(s=s.delta(o.newText.length)),s=s.delta(-(o.newText.length-o.replaceRange.length)),a.unshift(s)}t+=o.newText.length-o.replaceRange.length}for(;;){let o=a[0];if(!o)break;a.shift(),e.push(o.delta(t))}return e}var Fy=class a extends TCe{static{this.empty=new a([])}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e,t){return new a([new ECe(i,e,t)])}static insert(i,e,t){return new a([new ECe(gi.emptyAt(i),e,t)])}static delete(i,e){return new a([new ECe(i,"",e)])}static compose(i){if(i.length===0)return a.empty;let e=i[0];for(let t=1;t<i.length;t++)e=e.compose(i[t]);return e}constructor(i){super(i)}_createNew(i){return new a(i)}toStringEdit(i){let e=[];for(let t of this.replacements)(!i||i(t))&&e.push(new xd(t.replaceRange,t.newText));return new Ad(e)}},ECe=class a extends VIt{constructor(e,t,o){super(e,t);this.data=o}static insert(e,t,o){return new a(gi.emptyAt(e),t,o)}static replace(e,t,o){return new a(e,t,o)}static delete(e,t){return new a(e,"",t)}equals(e){return this.replaceRange.equals(e.replaceRange)&&this.newText===e.newText&&this.data===e.data}tryJoinTouching(e){let t=this.data.join(e.data);if(t!==void 0)return new a(this.replaceRange.joinRightTouching(e.replaceRange),this.newText+e.newText,t)}slice(e,t){return new a(e,t?t.substring(this.newText):this.newText,this.data)}};function K2o(a,i){return a.isEmpty&&i.isEmpty&&a.start===i.start}function v9i(a,i){return a.isEmpty&&i.start<a.start&&a.start<i.endExclusive}$6i({StringEdit:Ad,StringReplacement:xd,TextReplacement:ys,TextEdit:lm,TextLength:Rc});var BIt=class a{constructor(i=null){this._foreignModule=i;this._requestHandlerBrand=void 0;this._workerTextModelSyncServer=new WIt}dispose(){}async $ping(){return"pong"}_getModel(i){return this._workerTextModelSyncServer.getModel(i)}getModels(){return this._workerTextModelSyncServer.getModels()}$acceptNewModel(i){this._workerTextModelSyncServer.$acceptNewModel(i)}$acceptModelChanged(i,e){this._workerTextModelSyncServer.$acceptModelChanged(i,e)}$acceptRemovedModel(i){this._workerTextModelSyncServer.$acceptRemovedModel(i)}async $computeUnicodeHighlights(i,e,t){let o=this._getModel(i);return o?Lce.computeUnicodeHighlights(o,e,t):{ranges:[],hasMore:!1,ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0}}async $findSectionHeaders(i,e){let t=this._getModel(i);return t?m9i(t,e):[]}async $computeDiff(i,e,t,o){let n=this._getModel(i),r=this._getModel(e);return!n||!r?null:a.computeDiff(n,r,t,o)}static computeDiff(i,e,t,o){let n=o==="advanced"?yF.getDefault():yF.getLegacy(),r=i.getLinesContent(),s=e.getLinesContent(),l=n.computeDiff(r,s,t),c=l.changes.length>0?!1:this._modelsAreIdentical(i,e);function u(p){return p.map(h=>[h.original.startLineNumber,h.original.endLineNumberExclusive,h.modified.startLineNumber,h.modified.endLineNumberExclusive,h.innerChanges?.map(g=>[g.originalRange.startLineNumber,g.originalRange.startColumn,g.originalRange.endLineNumber,g.originalRange.endColumn,g.modifiedRange.startLineNumber,g.modifiedRange.startColumn,g.modifiedRange.endLineNumber,g.modifiedRange.endColumn])])}return{identical:c,quitEarly:l.hitTimeout,changes:u(l.changes),moves:l.moves.map(p=>[p.lineRangeMapping.original.startLineNumber,p.lineRangeMapping.original.endLineNumberExclusive,p.lineRangeMapping.modified.startLineNumber,p.lineRangeMapping.modified.endLineNumberExclusive,u(p.changes)])}}static _modelsAreIdentical(i,e){let t=i.getLineCount(),o=e.getLineCount();if(t!==o)return!1;for(let n=1;n<=t;n++){let r=i.getLineContent(n),s=e.getLineContent(n);if(r!==s)return!1}return!0}async $computeDirtyDiff(i,e,t){let o=this._getModel(i),n=this._getModel(e);if(!o||!n)return null;let r=o.getLinesContent(),s=n.getLinesContent();return new S3e(r,s,{shouldComputeCharChanges:!1,shouldPostProcessCharChanges:!1,shouldIgnoreTrimWhitespace:t,shouldMakePrettyDiff:!0,maxComputationTime:1e3}).computeDiff().changes}$computeStringDiff(i,e,t,o){return G2o(i,e,t,o).toJson()}static{this._diffLimit=1e5}async $computeMoreMinimalEdits(i,e,t){let o=this._getModel(i);if(!o)return e;let n=[],r;e=e.slice(0).sort((l,c)=>{if(l.range&&c.range)return G.compareRangesUsingStarts(l.range,c.range);let u=l.range?0:1,p=c.range?0:1;return u-p});let s=0;for(let l=1;l<e.length;l++)G.getEndPosition(e[s].range).equals(G.getStartPosition(e[l].range))?(e[s].range=G.fromPositions(G.getStartPosition(e[s].range),G.getEndPosition(e[l].range)),e[s].text+=e[l].text):(s++,e[s]=e[l]);e.length=s+1;for(let{range:l,text:c,eol:u}of e){if(typeof u=="number"&&(r=u),G.isEmpty(l)&&!c)continue;let p=o.getValueInRange(l);if(c=c.replace(/\r\n|\n|\r/g,o.eol),p===c)continue;if(Math.max(c.length,p.length)>a._diffLimit){n.push({range:l,text:c});continue}let h=U6i(p,c,t),g=o.offsetAt(G.lift(l).getStartPosition());for(let f of h){let v=o.positionAt(g+f.originalStart),b=o.positionAt(g+f.originalStart+f.originalLength),S={text:c.substr(f.modifiedStart,f.modifiedLength),range:{startLineNumber:v.lineNumber,startColumn:v.column,endLineNumber:b.lineNumber,endColumn:b.column}};o.getValueInRange(S.range)!==S.text&&n.push(S)}}return typeof r=="number"&&n.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),n}$computeHumanReadableDiff(i,e,t){let o=this._getModel(i);if(!o)return e;let n=[],r;e=e.slice(0).sort((s,l)=>{if(s.range&&l.range)return G.compareRangesUsingStarts(s.range,l.range);let c=s.range?0:1,u=l.range?0:1;return c-u});for(let{range:s,text:l,eol:c}of e){let v=function(S,y){return new ye(S.lineNumber+y.lineNumber-1,y.lineNumber===1?S.column+y.column-1:y.column)},b=function(S,y){let w=[];for(let x=y.startLineNumber;x<=y.endLineNumber;x++){let E=S[x-1];x===y.startLineNumber&&x===y.endLineNumber?w.push(E.substring(y.startColumn-1,y.endColumn-1)):x===y.startLineNumber?w.push(E.substring(y.startColumn-1)):x===y.endLineNumber?w.push(E.substring(0,y.endColumn-1)):w.push(E)}return w};if(typeof c=="number"&&(r=c),G.isEmpty(s)&&!l)continue;let u=o.getValueInRange(s);if(l=l.replace(/\r\n|\n|\r/g,o.eol),u===l)continue;if(Math.max(l.length,u.length)>a._diffLimit){n.push({range:s,text:l});continue}let p=u.split(/\r\n|\n|\r/),h=l.split(/\r\n|\n|\r/),g=yF.getDefault().computeDiff(p,h,t),f=G.lift(s).getStartPosition();for(let S of g.changes)if(S.innerChanges)for(let y of S.innerChanges)n.push({range:G.fromPositions(v(f,y.originalRange.getStartPosition()),v(f,y.originalRange.getEndPosition())),text:b(h,y.modifiedRange).join(o.eol)});else throw new ci("The experimental diff algorithm always produces inner changes")}return typeof r=="number"&&n.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),n}async $computeLinks(i){let e=this._getModel(i);return e?K6i(e):null}async $computeDefaultDocumentColors(i){let e=this._getModel(i);return e?u9i(e):null}static{this._suggestionsLimit=1e4}async $textualSuggest(i,e,t,o){let n=new On,r=new RegExp(t,o),s=new Set;e:for(let l of i){let c=this._getModel(l);if(c){for(let u of c.words(r))if(!(u===e||!isNaN(Number(u)))&&(s.add(u),s.size>a._suggestionsLimit))break e}}return{words:Array.from(s),duration:n.elapsed()}}async $computeWordRanges(i,e,t,o){let n=this._getModel(i);if(!n)return Object.create(null);let r=new RegExp(t,o),s=Object.create(null);for(let l=e.startLineNumber;l<e.endLineNumber;l++){let c=n.getLineWords(l,r);for(let u of c){if(!isNaN(Number(u.word)))continue;let p=s[u.word];p||(p=[],s[u.word]=p),p.push({startLineNumber:l,startColumn:u.startColumn,endLineNumber:l,endColumn:u.endColumn})}}return s}async $navigateValueSet(i,e,t,o,n){let r=this._getModel(i);if(!r)return null;let s=new RegExp(o,n);e.startColumn===e.endColumn&&(e={startLineNumber:e.startLineNumber,startColumn:e.startColumn,endLineNumber:e.endLineNumber,endColumn:e.endColumn+1});let l=r.getValueInRange(e),c=r.getWordAtPosition({lineNumber:e.startLineNumber,column:e.startColumn},s);if(!c)return null;let u=r.getValueInRange(c);return TIt.INSTANCE.navigateValueSet(e,l,c,u,t)}$fmr(i,e){if(!this._foreignModule||typeof this._foreignModule[i]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+i));try{return Promise.resolve(this._foreignModule[i].apply(this._foreignModule,e))}catch(t){return Promise.reject(t)}}};typeof importScripts=="function"&&(globalThis.monaco=G6i());function G2o(a,i,e,t){let o=t==="advanced"?yF.getDefault():yF.getLegacy();let n=new _I(a),r=n.getLines(),s=new _I(i),l=s.getLines(),c=o.computeDiff(r,l,{ignoreTrimWhitespace:!1,maxComputationTimeMs:e.maxComputationTimeMs,computeMoves:!1,extendToSubwords:!1}),u=vv.toTextEdit(c.changes,s);return n.getTransformer().getStringEdit(u)}var Gn=le("textResourceConfigurationService"),BL=le("textResourcePropertiesService");var Jt=le("ILanguageFeaturesService");var HIt=class a{static{this.CHANNEL_NAME="editorWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};function b9i(){return $i.defaultChatAgent?.completionsEnablementSetting}function XY(a,i="*"){let e=b9i();return e?UIt(a.getValue(e),i):!1}function S9i(a,i,e="*"){let t=b9i();return t?UIt(a.getValue(i,t),e):!1}function UIt(a,i="*"){return Di(a)?typeof a[i]<"u"?!!a[i]:!!a["*"]:!1}var I9i=300*1e3;function Qz(a,i){let e=a.getModel(i);return!(!e||e.isTooLargeForSyncing())}var JY=class extends k{constructor(e,t,o,n,r,s){super();this._languageConfigurationService=n;this._webWorkerService=s;this._modelService=e,this._workerManager=this._register(new T3e(JY.workerDescriptor,this._modelService,this._webWorkerService)),this._logService=o,this._register(r.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:async(l,c)=>{if(!Qz(this._modelService,l.uri))return Promise.resolve({links:[]});let p=await(await this._workerWithResources([l.uri])).$computeLinks(l.uri.toString());return p&&{links:p}}})),this._register(r.completionProvider.register("*",new Kri(this._workerManager,t,this._modelService,this._languageConfigurationService,this._logService,r)))}static{this.workerDescriptor=new Ak({esmModuleLocation:()=>In.asBrowserUri("vs/editor/common/services/editorWebWorkerMain.js"),esmModuleLocationBundler:()=>new URL("../../common/services/editorWebWorkerMain.ts?esm",import.meta.url),label:"editorWorkerService"})}canComputeUnicodeHighlights(e){return Qz(this._modelService,e)}async computedUnicodeHighlights(e,t,o){return(await this._workerWithResources([e])).$computeUnicodeHighlights(e.toString(),t,o)}async computeDiff(e,t,o,n){let s=await(await this._workerWithResources([e,t],!0)).$computeDiff(e.toString(),t.toString(),o,n);if(!s)return null;return{identical:s.identical,quitEarly:s.quitEarly,changes:c(s.changes),moves:s.moves.map(u=>new gCe(new Oy(new vo(u[0],u[1]),new vo(u[2],u[3])),c(u[4])))};function c(u){return u.map(p=>new vv(new vo(p[0],p[1]),new vo(p[2],p[3]),p[4]?.map(h=>new lf(new G(h[0],h[1],h[2],h[3]),new G(h[4],h[5],h[6],h[7])))))}}canComputeDirtyDiff(e,t){return Qz(this._modelService,e)&&Qz(this._modelService,t)}async computeDirtyDiff(e,t,o){return(await this._workerWithResources([e,t])).$computeDirtyDiff(e.toString(),t.toString(),o)}async computeMoreMinimalEdits(e,t,o=!1){if(Rr(t)){if(!Qz(this._modelService,e))return Promise.resolve(t);let n=On.create(),r=this._workerWithResources([e]).then(s=>s.$computeMoreMinimalEdits(e.toString(),t,o));return r.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),n.elapsed())),Promise.race([r,Li(1e3).then(()=>t)])}else return Promise.resolve(void 0)}computeHumanReadableDiff(e,t){if(Rr(t)){if(!Qz(this._modelService,e))return Promise.resolve(t);let o=On.create(),n={ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3,computeMoves:!1},r=this._workerWithResources([e]).then(s=>s.$computeHumanReadableDiff(e.toString(),t,n)).catch(s=>(mt(s),this.computeMoreMinimalEdits(e,t,!0)));return r.finally(()=>this._logService.trace("FORMAT#computeHumanReadableDiff",e.toString(!0),o.elapsed())),r}else return Promise.resolve(void 0)}async computeStringEditFromDiff(e,t,o,n){try{let s=await(await this._workerWithResources([])).$computeStringDiff(e,t,o,n);return Ad.fromJson(s)}catch(r){return mt(r),Ad.replace(gi.ofLength(e.length),t)}}canNavigateValueSet(e){return Qz(this._modelService,e)}async navigateValueSet(e,t,o){let n=this._modelService.getModel(e);if(!n)return null;let r=this._languageConfigurationService.getLanguageConfiguration(n.getLanguageId()).getWordDefinition(),s=r.source,l=r.flags;return(await this._workerWithResources([e])).$navigateValueSet(e.toString(),t,o,s,l)}canComputeWordRanges(e){return Qz(this._modelService,e)}async computeWordRanges(e,t){let o=this._modelService.getModel(e);if(!o)return Promise.resolve(null);let n=this._languageConfigurationService.getLanguageConfiguration(o.getLanguageId()).getWordDefinition(),r=n.source,s=n.flags;return(await this._workerWithResources([e])).$computeWordRanges(e.toString(),t,r,s)}async findSectionHeaders(e,t){return(await this._workerWithResources([e])).$findSectionHeaders(e.toString(),t)}async computeDefaultDocumentColors(e){return(await this._workerWithResources([e])).$computeDefaultDocumentColors(e.toString())}async _workerWithResources(e,t=!1){return await(await this._workerManager.withWorker()).workerWithSyncedResources(e,t)}};JY=I([m(0,_t),m(1,Gn),m(2,re),m(3,Us),m(4,Jt),m(5,Bw)],JY);var Kri=class{constructor(i,e,t,o,n,r){this.languageConfigurationService=o;this.logService=n;this.languageFeaturesService=r;this._debugDisplayName="wordbasedCompletions";this._workerManager=i,this._configurationService=e,this._modelService=t}async provideCompletionItems(i,e){let t=this._configurationService.getValue(i.uri,e,"editor");if(t.wordBasedSuggestions==="off"||t.wordBasedSuggestions==="offWithInlineSuggestions"&&this.languageFeaturesService.inlineCompletionsProvider.has(i)&&S9i(this._configurationService,i.uri,i.getLanguageId()))return;let o=[];if(t.wordBasedSuggestions==="currentDocument")Qz(this._modelService,i.uri)&&o.push(i.uri);else for(let p of this._modelService.getModels())Qz(this._modelService,p.uri)&&(p===i?o.unshift(p.uri):(t.wordBasedSuggestions==="allDocuments"||p.getLanguageId()===i.getLanguageId())&&o.push(p.uri));if(o.length===0)return;let n=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition(),r=i.getWordAtPosition(e),s=r?new G(e.lineNumber,r.startColumn,e.lineNumber,r.endColumn):G.fromPositions(e),l=s.setEndPosition(e.lineNumber,e.column);this.logService.trace("[WordBasedCompletionItemProvider]",`word: "${r?.word||""}", wordDef: "${n}", replace: [${s.toString()}], insert: [${l.toString()}]`);let u=await(await this._workerManager.withWorker()).textualSuggest(o,r?.word,n);if(u)return{duration:u.duration,suggestions:u.words.map(p=>({kind:18,label:p,insertText:p,range:{insert:l,replace:s}}))}}},T3e=class extends k{constructor(e,t,o){super();this._workerDescriptor=e;this._modelService=t,this._webWorkerService=o,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new LL).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(I9i/2),ut),this._register(this._modelService.onModelRemoved(r=>this._checkStopEmptyWorker()))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;this._modelService.getModels().length===0&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;new Date().getTime()-this._lastWorkerUsedTime>I9i&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new _3e(this._workerDescriptor,!1,this._modelService,this._webWorkerService)),Promise.resolve(this._editorWorkerClient)}};T3e=I([m(1,_t),m(2,Bw)],T3e);var Gri=class{constructor(i){this._instance=i,this.proxy=this._instance}dispose(){this._instance.dispose()}setChannel(i,e){throw new Error("Not supported")}getChannel(i){throw new Error("Not supported")}},_3e=class extends k{constructor(e,t,o,n){super();this._workerDescriptorOrWorker=e;this._disposed=!1;this._modelService=o,this._webWorkerService=n,this._keepIdleModels=t,this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(this._webWorkerService.createWorkerClient(this._workerDescriptorOrWorker)),HIt.setChannel(this._worker,this._createEditorWorkerHost())}catch(e){IIt(e),this._worker=this._createFallbackLocalWorker()}return this._worker}async _getProxy(){try{let e=this._getOrCreateWorker().proxy;return await e.$ping(),e}catch(e){return IIt(e),this._worker=this._createFallbackLocalWorker(),this._worker.proxy}}_createFallbackLocalWorker(){return new Gri(new BIt(null))}_createEditorWorkerHost(){return{$fhr:(e,t)=>this.fhr(e,t)}}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new YY(e,this._modelService,this._keepIdleModels))),this._modelManager}async workerWithSyncedResources(e,t=!1){if(this._disposed)return Promise.reject(wy());let o=await this._getProxy();return this._getOrCreateModelManager(o).ensureSyncedResources(e,t),o}async textualSuggest(e,t,o){let n=await this.workerWithSyncedResources(e),r=o.source,s=o.flags;return n.$textualSuggest(e.map(l=>l.toString()),t,r,s)}dispose(){super.dispose(),this._disposed=!0}};_3e=I([m(2,_t),m(3,Bw)],_3e);var Yz=le("markerDecorationsService");var Ace=class{static{this.ID="editor.contrib.markerDecorations"}constructor(i,e){}dispose(){}};Ace=I([m(1,Yz)],Ace);Ce(Qs,JY,0);Eo(Ace.ID,Ace,0);var Kv=class{constructor(i){this.domNode=i;this._maxWidth="";this._width="";this._height="";this._top="";this._left="";this._bottom="";this._right="";this._paddingTop="";this._paddingLeft="";this._paddingBottom="";this._paddingRight="";this._fontFamily="";this._fontWeight="";this._fontSize="";this._fontStyle="";this._fontFeatureSettings="";this._fontVariationSettings="";this._textDecoration="";this._lineHeight="";this._letterSpacing="";this._className="";this._display="";this._position="";this._visibility="";this._color="";this._backgroundColor="";this._layerHint=!1;this._contain="none";this._boxShadow=""}focus(){this.domNode.focus()}setMaxWidth(i){let e=HL(i);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(i){let e=HL(i);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(i){let e=HL(i);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(i){let e=HL(i);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(i){let e=HL(i);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(i){let e=HL(i);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(i){let e=HL(i);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(i){let e=HL(i);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(i){let e=HL(i);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(i){let e=HL(i);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(i){let e=HL(i);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(i){this._fontFamily!==i&&(this._fontFamily=i,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(i){let e=HL(i);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(i){this._fontFeatureSettings!==i&&(this._fontFeatureSettings=i,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(i){this._fontVariationSettings!==i&&(this._fontVariationSettings=i,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(i){this._textDecoration!==i&&(this._textDecoration=i,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(i){let e=HL(i);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(i){let e=HL(i);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(i){this._className!==i&&(this._className=i,this.domNode.className=this._className)}toggleClassName(i,e){this.domNode.classList.toggle(i,e),this._className=this.domNode.className}setDisplay(i){this._display!==i&&(this._display=i,this.domNode.style.display=this._display)}setPosition(i){this._position!==i&&(this._position=i,this.domNode.style.position=this._position)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this.domNode.style.visibility=this._visibility)}setColor(i){this._color!==i&&(this._color=i,this.domNode.style.color=this._color)}setBackgroundColor(i){this._backgroundColor!==i&&(this._backgroundColor=i,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(i){this._layerHint!==i&&(this._layerHint=i,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(i){this._boxShadow!==i&&(this._boxShadow=i,this.domNode.style.boxShadow=i)}setContain(i){this._contain!==i&&(this._contain=i,this.domNode.style.contain=this._contain)}setAttribute(i,e){this.domNode.setAttribute(i,e)}removeAttribute(i){this.domNode.removeAttribute(i)}appendChild(i){this.domNode.appendChild(i.domNode)}removeChild(i){this.domNode.removeChild(i.domNode)}};function HL(a){return typeof a=="number"?`${a}px`:a}function Ir(a){return new Kv(a)}function ku(a,i){a instanceof Kv?(a.setFontFamily(i.getMassagedFontFamily()),a.setFontWeight(i.fontWeight),a.setFontSize(i.fontSize),a.setFontFeatureSettings(i.fontFeatureSettings),a.setFontVariationSettings(i.fontVariationSettings),a.setLineHeight(i.lineHeight),a.setLetterSpacing(i.letterSpacing)):(a.style.fontFamily=i.getMassagedFontFamily(),a.style.fontWeight=i.fontWeight,a.style.fontSize=i.fontSize+"px",a.style.fontFeatureSettings=i.fontFeatureSettings,a.style.fontVariationSettings=i.fontVariationSettings,a.style.lineHeight=i.lineHeight+"px",a.style.letterSpacing=i.letterSpacing+"px")}var ZY=class extends k{constructor(e,t){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){if(!this._resizeObserver&&this._referenceDomElement){let e=null,t=()=>{e?this.observe({width:e.width,height:e.height}):this.observe()},o=!1,n=!1,r=()=>{if(o&&!n)try{o=!1,n=!0,t()}finally{kr(Me(this._referenceDomElement),()=>{n=!1,r()})}};this._resizeObserver=new ResizeObserver(s=>{s&&s[0]&&s[0].contentRect?e={width:s[0].contentRect.width,height:s[0].contentRect.height}:e=null,o=!0,r()}),this._resizeObserver.observe(this._referenceDomElement)}}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let o=0,n=0;t?(o=t.width,n=t.height):this._referenceDomElement&&(o=this._referenceDomElement.clientWidth,n=this._referenceDomElement.clientHeight),o=Math.max(5,o),n=Math.max(5,n),(this._width!==o||this._height!==n)&&(this._width=o,this._height=n,e&&this._onDidChange.fire())}};var qri=class extends k{constructor(e){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._listener=()=>this._handleChange(e,!0),this._mediaQueryList=null,this._handleChange(e,!1),this._register(ee(()=>this._mediaQueryList?.removeEventListener("change",this._listener)))}_handleChange(e,t){this._mediaQueryList?.removeEventListener("change",this._listener),this._mediaQueryList=e.matchMedia(`(resolution: ${e.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),t&&this._onDidChange.fire()}},$ri=class extends k{constructor(e){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._value=this._getPixelRatio(e);let t=this._register(new qri(e));this._register(t.onDidChange(()=>{this._value=this._getPixelRatio(e),this._onDidChange.fire(this._value)}))}get value(){return this._value}_getPixelRatio(e){let t=document.createElement("canvas").getContext("2d"),o=e.devicePixelRatio||1,n=t?.webkitBackingStorePixelRatio||t?.mozBackingStorePixelRatio||t?.msBackingStorePixelRatio||t?.oBackingStorePixelRatio||t?.backingStorePixelRatio||1;return o/n}},jri=class{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(i){let e=hv(i),t=this.mapWindowIdToPixelRatioMonitor.get(e);return t||(t=bp(new $ri(i)),this.mapWindowIdToPixelRatioMonitor.set(e,t),bp(U.once(nQi)(({vscodeWindowId:o})=>{o===e&&(t?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(e))}))),t}getInstance(i){return this._getOrCreatePixelRatioMonitor(i)}},Gu=new jri;var zIt=class{constructor(i,e){this.chr=i,this.type=e,this.width=0}fulfill(i){this.width=i}},Qri=class a{constructor(i,e){this._bareFontInfo=i,this._requests=e,this._container=null,this._testElements=null}read(i){this._createDomElements(),i.document.body.appendChild(this._container),this._readFromDomElements(),this._container?.remove(),this._container=null,this._testElements=null}_createDomElements(){let i=document.createElement("div");i.style.position="absolute",i.style.top="-50000px",i.style.width="50000px";let e=document.createElement("div");ku(e,this._bareFontInfo),i.appendChild(e);let t=document.createElement("div");ku(t,this._bareFontInfo),t.style.fontWeight="bold",i.appendChild(t);let o=document.createElement("div");ku(o,this._bareFontInfo),o.style.fontStyle="italic",i.appendChild(o);let n=[];for(let r of this._requests){let s;r.type===0&&(s=e),r.type===2&&(s=t),r.type===1&&(s=o),s.appendChild(document.createElement("br"));let l=document.createElement("span");a._render(l,r),s.appendChild(l),n.push(l)}this._container=i,this._testElements=n}static _render(i,e){if(e.chr===" "){let t="\xA0";for(let o=0;o<8;o++)t+=t;i.innerText=t}else{let t=e.chr;for(let o=0;o<8;o++)t+=t;i.textContent=t}}_readFromDomElements(){for(let i=0,e=this._requests.length;i<e;i++){let t=this._requests[i],o=this._testElements[i];t.fulfill(o.offsetWidth/256)}}};function y9i(a,i,e){new Qri(i,e).read(a)}var Yri=class extends k{constructor(){super(...arguments);this._cache=new Map;this._evictUntrustedReadingsTimeout=-1;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event}dispose(){this._evictUntrustedReadingsTimeout!==-1&&(clearTimeout(this._evictUntrustedReadingsTimeout),this._evictUntrustedReadingsTimeout=-1),super.dispose()}clearAllFontInfos(){this._cache.clear(),this._onDidChange.fire()}_ensureCache(e){let t=hv(e),o=this._cache.get(t);return o||(o=new Xri,this._cache.set(t,o)),o}_writeToCache(e,t,o){this._ensureCache(e).put(t,o),!o.isTrusted&&this._evictUntrustedReadingsTimeout===-1&&(this._evictUntrustedReadingsTimeout=e.setTimeout(()=>{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings(e)},5e3))}_evictUntrustedReadings(e){let t=this._ensureCache(e),o=t.getValues(),n=!1;for(let r of o)r.isTrusted||(n=!0,t.remove(r));n&&this._onDidChange.fire()}serializeFontInfo(e){return this._ensureCache(e).getValues().filter(o=>o.isTrusted)}restoreFontInfo(e,t){for(let o of t){if(o.version!==$oi)continue;let n=new PY(o,!1);this._writeToCache(e,n,n)}}readFontInfo(e,t){let o=this._ensureCache(e);if(!o.has(t)){let n=this._actualReadFontInfo(e,t);(n.typicalHalfwidthCharacterWidth<=2||n.typicalFullwidthCharacterWidth<=2||n.spaceWidth<=2||n.maxDigitWidth<=2)&&(n=new PY({pixelRatio:Gu.getInstance(e).value,fontFamily:n.fontFamily,fontWeight:n.fontWeight,fontSize:n.fontSize,fontFeatureSettings:n.fontFeatureSettings,fontVariationSettings:n.fontVariationSettings,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,isMonospace:n.isMonospace,typicalHalfwidthCharacterWidth:Math.max(n.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(n.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:n.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(n.spaceWidth,5),middotWidth:Math.max(n.middotWidth,5),wsmiddotWidth:Math.max(n.wsmiddotWidth,5),maxDigitWidth:Math.max(n.maxDigitWidth,5)},!1)),this._writeToCache(e,t,n)}return o.get(t)}_createRequest(e,t,o,n){let r=new zIt(e,t);return o.push(r),n?.push(r),r}_actualReadFontInfo(e,t){let o=[],n=[],r=this._createRequest("n",0,o,n),s=this._createRequest("\uFF4D",0,o,null),l=this._createRequest(" ",0,o,n),c=this._createRequest("0",0,o,n),u=this._createRequest("1",0,o,n),p=this._createRequest("2",0,o,n),h=this._createRequest("3",0,o,n),g=this._createRequest("4",0,o,n),f=this._createRequest("5",0,o,n),v=this._createRequest("6",0,o,n),b=this._createRequest("7",0,o,n),S=this._createRequest("8",0,o,n),y=this._createRequest("9",0,o,n),w=this._createRequest("\u2192",0,o,n),x=this._createRequest("\uFFEB",0,o,null),E=this._createRequest("\xB7",0,o,n),M=this._createRequest("\u2E31",0,o,null),N="|/-_ilm%";for(let J=0,se=N.length;J<se;J++)this._createRequest(N.charAt(J),0,o,n),this._createRequest(N.charAt(J),1,o,n),this._createRequest(N.charAt(J),2,o,n);y9i(e,t,o);let V=Math.max(c.width,u.width,p.width,h.width,g.width,f.width,v.width,b.width,S.width,y.width),H=t.fontFeatureSettings===Mk.OFF,K=n[0].width;for(let J=1,se=n.length;H&&J<se;J++){let ae=K-n[J].width;if(ae<-.001||ae>.001){H=!1;break}}let j=!0;return H&&x.width!==K&&(j=!1),x.width>w.width&&(j=!1),new PY({pixelRatio:Gu.getInstance(e).value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,fontVariationSettings:t.fontVariationSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:H,typicalHalfwidthCharacterWidth:r.width,typicalFullwidthCharacterWidth:s.width,canUseHalfwidthRightwardsArrow:j,spaceWidth:l.width,middotWidth:E.width,wsmiddotWidth:M.width,maxDigitWidth:V},!0)}},Xri=class{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(i){let e=i.getId();return!!this._values[e]}get(i){let e=i.getId();return this._values[e]}put(i,e){let t=i.getId();this._keys[t]=i,this._values[t]=e}remove(i){let e=i.getId();delete this._keys[e],delete this._values[e]}getValues(){return Object.keys(this._keys).map(i=>this._values[i])}},zw=new Yri;var Nce=class a{constructor(i,e){this.key=i;this.migrate=e}static{this.items=[]}apply(i){let e=a._read(i,this.key),t=n=>a._read(i,n),o=(n,r)=>a._write(i,n,r);this.migrate(e,t,o)}static _read(i,e){if(typeof i>"u"||i===null)return;let t=e.indexOf(".");if(t>=0){let o=e.substring(0,t);return this._read(i[o],e.substring(t+1))}return i[e]}static _write(i,e,t){let o=e.indexOf(".");if(o>=0){let n=e.substring(0,o);i[n]=i[n]||{},this._write(i[n],e.substring(o+1),t);return}i[e]=t}};function UL(a,i){Nce.items.push(new Nce(a,i))}function Nk(a,i){UL(a,(e,t,o)=>{if(typeof e<"u"){for(let[n,r]of i)if(e===n){o(a,r);return}}})}function w9i(a){Nce.items.forEach(i=>i.apply(a))}Nk("wordWrap",[[!0,"on"],[!1,"off"]]);Nk("lineNumbers",[[!0,"on"],[!1,"off"]]);Nk("cursorBlinking",[["visible","solid"]]);Nk("renderWhitespace",[[!0,"boundary"],[!1,"none"]]);Nk("renderLineHighlight",[[!0,"line"],[!1,"none"]]);Nk("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]);Nk("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]);Nk("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);Nk("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]);Nk("autoIndent",[[!1,"advanced"],[!0,"full"]]);Nk("matchBrackets",[[!0,"always"],[!1,"never"]]);Nk("renderFinalNewline",[[!0,"on"],[!1,"off"]]);Nk("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]);Nk("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]);Nk("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]);Nk("defaultColorDecorators",[[!0,"auto"],[!1,"never"]]);Nk("minimap.autohide",[[!0,"mouseover"],[!1,"none"]]);UL("autoClosingBrackets",(a,i,e)=>{a===!1&&(e("autoClosingBrackets","never"),typeof i("autoClosingQuotes")>"u"&&e("autoClosingQuotes","never"),typeof i("autoSurround")>"u"&&e("autoSurround","never"))});UL("renderIndentGuides",(a,i,e)=>{typeof a<"u"&&(e("renderIndentGuides",void 0),typeof i("guides.indentation")>"u"&&e("guides.indentation",!!a))});UL("highlightActiveIndentGuide",(a,i,e)=>{typeof a<"u"&&(e("highlightActiveIndentGuide",void 0),typeof i("guides.highlightActiveIndentation")>"u"&&e("guides.highlightActiveIndentation",!!a))});var $2o={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};UL("suggest.filteredTypes",(a,i,e)=>{if(a&&typeof a=="object"){for(let t of Object.entries($2o))a[t[0]]===!1&&typeof i(`suggest.${t[1]}`)>"u"&&e(`suggest.${t[1]}`,!1);e("suggest.filteredTypes",void 0)}});UL("quickSuggestions",(a,i,e)=>{if(typeof a=="boolean"){let t=a?"on":"off";e("quickSuggestions",{comments:t,strings:t,other:t})}});UL("experimental.stickyScroll.enabled",(a,i,e)=>{typeof a=="boolean"&&(e("experimental.stickyScroll.enabled",void 0),typeof i("stickyScroll.enabled")>"u"&&e("stickyScroll.enabled",a))});UL("experimental.stickyScroll.maxLineCount",(a,i,e)=>{typeof a=="number"&&(e("experimental.stickyScroll.maxLineCount",void 0),typeof i("stickyScroll.maxLineCount")>"u"&&e("stickyScroll.maxLineCount",a))});UL("editor.experimentalEditContextEnabled",(a,i,e)=>{typeof a=="boolean"&&(e("editor.experimentalEditContextEnabled",void 0),typeof i("editor.editContext")>"u"&&e("editor.editContext",a))});UL("codeActionsOnSave",(a,i,e)=>{if(a&&typeof a=="object"){let t=!1,o={};for(let n of Object.entries(a))typeof n[1]=="boolean"?(t=!0,o[n[0]]=n[1]?"explicit":"never"):o[n[0]]=n[1];t&&e("codeActionsOnSave",o)}});UL("codeActionWidget.includeNearbyQuickfixes",(a,i,e)=>{typeof a=="boolean"&&(e("codeActionWidget.includeNearbyQuickfixes",void 0),typeof i("codeActionWidget.includeNearbyQuickFixes")>"u"&&e("codeActionWidget.includeNearbyQuickFixes",a))});UL("lightbulb.enabled",(a,i,e)=>{typeof a=="boolean"&&e("lightbulb.enabled",a?void 0:"off")});UL("inlineSuggest.edits.codeShifting",(a,i,e)=>{typeof a=="boolean"&&(e("inlineSuggest.edits.codeShifting",void 0),e("inlineSuggest.edits.allowCodeShifting",a?"always":"never"))});UL("hover.enabled",(a,i,e)=>{typeof a=="boolean"&&e("hover.enabled",a?"on":"off")});var Jri=class extends k{constructor(){super(...arguments);this._tabFocus=!1;this._onDidChangeTabFocus=this._register(new T);this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus)}},vD=new Jri;function C9i(a,i,e){let t=a.get(58),o=a.get(62),n=a.get(61),r=a.get(60),s=a.get(63),l=a.get(75),c=a.get(72);return zwe._create(t,o,n,r,s,l,c,i,e)}function RI(a,i,e=!1){let t=PS.fontFamily.validate(a.fontFamily),o=PS.fontWeight.validate(a.fontWeight),n=PS.fontSize.validate(a.fontSize),r=PS.fontLigatures2.validate(a.fontLigatures),s=PS.fontVariations.validate(a.fontVariations),l=PS.lineHeight.validate(a.lineHeight),c=PS.letterSpacing.validate(a.letterSpacing);return zwe._create(t,o,n,r,s,l,c,i,e)}var eX=class extends k{constructor(e,t,o,n,r){super();this._accessibilityService=r;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onDidChangeFast=this._register(new T);this.onDidChangeFast=this._onDidChangeFast.event;this._isDominatedByLongLines=!1;this._viewLineCount=1;this._lineNumbersDigitCount=1;this._reservedHeight=0;this._glyphMarginDecorationLaneCount=1;this._computeOptionsMemory=new j4e;this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new ZY(n,o.dimension)),this._targetWindowId=Me(n).vscodeWindowId,this._rawOptions=x9i(o),this._validatedOptions=Oce.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(19)&&this._containerObserver.startObserving(),this._register(uT.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(vD.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(zw.onDidChange(()=>this._recomputeOptions())),this._register(Gu.getInstance(Me(n)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions())),this._register(_B.onDidChangeInputMode(()=>this._recomputeOptions()))}_recomputeOptions(){let e=this._computeOptions(),t=Oce.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){let e=this._readEnvConfiguration(),t=C9i(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),o=this._readFontInfo(t),n={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:o,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:this._validatedOptions.get(164)||vD.getTabFocusMode(),inputMode:_B.getInputMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount,editContextSupported:e.editContextSupported};return Oce.computeOptions(this._validatedOptions,n)}_readEnvConfiguration(){return{extraEditorClassName:Q2o(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:dB||ed,pixelRatio:Gu.getInstance(gv(this._targetWindowId,!0).window).value,editContextSupported:typeof globalThis.EditContext=="function",accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return zw.readFontInfo(gv(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){let t=x9i(e);Oce.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=Oce.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){let t=j2o(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}setGlyphMarginDecorationLaneCount(e){this._glyphMarginDecorationLaneCount!==e&&(this._glyphMarginDecorationLaneCount=e,this._recomputeOptions())}};eX=I([m(4,Ai)],eX);function j2o(a){let i=0;for(;a;)a=Math.floor(a/10),i++;return i||1}function Q2o(){let a="";return _S||R3i?(a+="no-minimap-shadow ",a+="enable-user-select "):a+="no-user-select ",et&&(a+="mac "),a}var Zri=class{constructor(){this._values=[]}_read(i){return this._values[i]}get(i){return this._values[i]}_write(i,e){this._values[i]=e}},esi=class{constructor(){this._values=[]}_read(i){if(i>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[i]}get(i){return this._read(i)}_write(i,e){this._values[i]=e}},Oce=class a{static validateOptions(i){let e=new Zri;for(let t of Az){let o=t.name==="_never_"?void 0:i[t.name];e._write(t.id,t.validate(o))}return e}static computeOptions(i,e){let t=new esi;for(let o of Az)t._write(o.id,o.compute(e,t,i._read(o.id)));return t}static _deepEquals(i,e){if(typeof i!="object"||typeof e!="object"||!i||!e)return i===e;if(Array.isArray(i)||Array.isArray(e))return Array.isArray(i)&&Array.isArray(e)?eo(i,e):!1;if(Object.keys(i).length!==Object.keys(e).length)return!1;for(let t in i)if(!a._deepEquals(i[t],e[t]))return!1;return!0}static checkEquals(i,e){let t=[],o=!1;for(let n of Az){let r=!a._deepEquals(i._read(n.id),e._read(n.id));t[n.id]=r,r&&(o=!0)}return o?new uSt(t):null}static applyUpdate(i,e){let t=!1;for(let o of Az)if(e.hasOwnProperty(o.name)){let n=o.applyUpdate(i[o.name],e[o.name]);i[o.name]=n.newValue,t=t||n.didChange}return t}};function x9i(a){let i=io(a);return w9i(i),i}var hx;(V=>{let a={total:0,min:Number.MAX_VALUE,max:0},i={...a},e={...a},t={...a},o=0;V.sampleCount=De("inputLatency.sampleCount",0);let r;(J=>(J[J.Before=0]="Before",J[J.InProgress=1]="InProgress",J[J.Finished=2]="Finished"))(r||={});let s={keydown:0,input:0,render:0};function l(){y(),performance.mark("inputlatency/start"),performance.mark("keydown/start"),s.keydown=1,queueMicrotask(c)}V.onKeyDown=l;function c(){s.keydown===1&&(performance.mark("keydown/end"),s.keydown=2)}function u(){performance.mark("input/start"),s.input=1,S()}V.onBeforeInput=u;function p(){s.input===0&&u(),queueMicrotask(h)}V.onInput=p;function h(){s.input===1&&(performance.mark("input/end"),s.input=2)}function g(){y()}V.onKeyUp=g;function f(){y()}V.onSelectionChange=f;function v(){s.keydown===2&&s.input===2&&s.render===0&&(performance.mark("render/start"),s.render=1,queueMicrotask(b),S())}V.onRenderStart=v;function b(){s.render===1&&(performance.mark("render/end"),s.render=2)}function S(){setTimeout(y)}function y(){s.keydown===2&&s.input===2&&s.render===2&&(performance.mark("inputlatency/end"),performance.measure("keydown","keydown/start","keydown/end"),performance.measure("input","input/start","input/end"),performance.measure("render","render/start","render/end"),performance.measure("inputlatency","inputlatency/start","inputlatency/end"),w("keydown",a),w("input",i),w("render",e),w("inputlatency",t),o++,V.sampleCount.set(V.sampleCount.get()+1,void 0),x())}function w(H,K){let j=performance.getEntriesByName(H)[0].duration;K.total+=j,K.min=Math.min(K.min,j),K.max=Math.max(K.max,j)}function x(){performance.clearMarks("keydown/start"),performance.clearMarks("keydown/end"),performance.clearMarks("input/start"),performance.clearMarks("input/end"),performance.clearMarks("render/start"),performance.clearMarks("render/end"),performance.clearMarks("inputlatency/start"),performance.clearMarks("inputlatency/end"),performance.clearMeasures("keydown"),performance.clearMeasures("input"),performance.clearMeasures("render"),performance.clearMeasures("inputlatency"),s.keydown=0,s.input=0,s.render=0}function E(){if(o===0)return;let H={keydown:M(a),input:M(i),render:M(e),total:M(t),sampleCount:o};return N(a),N(i),N(e),N(t),o=0,H}V.getAndClearMeasurements=E;function M(H){return{average:H.total/o,max:H.max,min:H.min}}function N(H){H.total=0,H.min=Number.MAX_VALUE,H.max=0}})(hx||={});function fn(a){return a&&typeof a.getEditorType=="function"?a.getEditorType()===v5.ICodeEditor:!1}function Lc(a){return a&&typeof a.getEditorType=="function"?a.getEditorType()===v5.IDiffEditor:!1}function CF(a){return!!a&&typeof a=="object"&&typeof a.onDidChangeActiveEditor=="function"}function da(a){return fn(a)?a:Lc(a)?a.getModifiedEditor():CF(a)&&fn(a.activeCodeEditor)?a.activeCodeEditor:null}function k9i(a){return fn(a)||Lc(a)?a:null}var _Ce=new Map;function E9i(a){return _Ce.has(a)}var isi=class extends k{constructor(){super(...arguments);this._currentCssStyle="";this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.textContent=e:this._styleSheet=Pr(ut.document.head,t=>t.textContent=e,this._store))}dispose(){super.dispose(),this._styleSheet=void 0}};function Pr(a=ut.document.head,i,e){let t=document.createElement("style");if(t.type="text/css",t.media="screen",i?.(t),a.appendChild(t),e&&e.add(ee(()=>t.remove())),a===ut.document.head){let o=new Set;_Ce.set(t,o),e&&e.add(ee(()=>_Ce.delete(t)));for(let{window:n,disposables:r}of dx()){if(n===ut)continue;let s=r.add(_9i(t,o,n));e?.add(s)}}return t}function T9i(a){let i=new O;for(let[e,t]of _Ce)i.add(_9i(e,t,a));return i}function _9i(a,i,e){let t=new O,o=a.cloneNode(!0);e.document.head.appendChild(o),t.add(ee(()=>o.remove()));for(let n of a.sheet?.cssRules??[])o.sheet?.insertRule(n.cssText,o.sheet?.cssRules.length);return t.add(R4e.observe(a,t,{childList:!0,subtree:ed,characterData:ed})(()=>{o.textContent=a.textContent})),i.add(o),t.add(ee(()=>i.delete(o))),t}var tsi=null;function D9i(){return tsi||(tsi=Pr()),tsi}function Eg(a,i,e=D9i()){if(!(!e||!i)){e.sheet?.insertRule(`${a} {${i}}`,0);for(let t of _Ce.get(e)??[])Eg(a,i,t)}}function xF(a,i=D9i()){if(!i)return;let e=i.sheet?.cssRules??[],t=[];for(let o=0;o<e.length;o++){let n=e[o];Y2o(n)&&n.selectorText.indexOf(a)!==-1&&t.push(o)}for(let o=t.length-1;o>=0;o--)i.sheet?.deleteRule(t[o]);for(let o of _Ce.get(i)??[])xF(a,o)}function Y2o(a){return typeof a.selectorText=="string"}function R9i(a){let i=new O,e=i.add(new isi);return i.add(ve(t=>{e.setStyle(a.read(t))})),i}var fT=class{constructor(){this._hooks=new O;this._pointerMoveCallback=null;this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(i,e){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let t=this._onStopCallback;this._onStopCallback=null,i&&t&&t(e)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(i,e,t,o,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=o,this._onStopCallback=n;let r=i;try{i.setPointerCapture(e),this._hooks.add(ee(()=>{try{i.releasePointerCapture(e)}catch{}}))}catch{r=Me(i)}this._hooks.add($(r,ne.POINTER_MOVE,s=>{if(s.buttons!==t){this.stopMonitoring(!0);return}s.preventDefault(),this._pointerMoveCallback(s)})),this._hooks.add($(r,ne.POINTER_UP,s=>this.stopMonitoring(!0)))}};function kF(a){return`--vscode-${a.replace(/\./g,"-")}`}function Tt(a){return`var(${kF(a)})`}function tX(a,i){return`var(${kF(a)}, ${i})`}function X2o(a){return a!==null&&typeof a=="object"&&"light"in a&&"dark"in a}var Fce={ColorContribution:"base.contributions.colors"},D3e="default",osi=class extends k{constructor(){super();this._onDidChangeSchema=this._register(new T);this.onDidChangeSchema=this._onDidChangeSchema.event;this.colorSchema={type:"object",properties:{}};this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]};this.colorsById={}}notifyThemeUpdate(e){for(let t of Object.keys(this.colorsById)){let o=e.getColor(t);o&&(this.colorSchema.properties[t].oneOf[0].defaultSnippets[0].body=`\${1:${Ue.Format.CSS.formatHexA(o,!0)}}`)}this._onDidChangeSchema.fire()}registerColor(e,t,o,n=!1,r){let s={id:e,description:o,defaults:t,needsTransparency:n,deprecationMessage:r};this.colorsById[e]=s;let l={type:"string",format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return r&&(l.deprecationMessage=r),n&&(l.pattern="^#(?:(?<rgba>[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$",l.patternErrorMessage=d(2865,null)),this.colorSchema.properties[e]={description:o,oneOf:[l,{type:"string",const:D3e,description:d(2866,null)}]},this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(o),this._onDidChangeSchema.fire(),e}updateDefaultColor(e,t){let o=this.colorsById[e];o&&(this.colorsById[e]={...o,defaults:t})}deregisterColor(e){delete this.colorsById[e],delete this.colorSchema.properties[e];let t=this.colorReferenceSchema.enum.indexOf(e);t!==-1&&(this.colorReferenceSchema.enum.splice(t,1),this.colorReferenceSchema.enumDescriptions.splice(t,1)),this._onDidChangeSchema.fire()}getColors(){return Object.keys(this.colorsById).map(e=>this.colorsById[e])}resolveDefaultColor(e,t){let o=this.colorsById[e];if(o?.defaults){let n=X2o(o.defaults)?o.defaults[t.type]:o.defaults;return bD(n,t)}}getColorSchema(){return this.colorSchema}getColorReferenceSchema(){return this.colorReferenceSchema}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(`
`)}},R3e=new osi;oe.add(Fce.ColorContribution,R3e);function te(a,i,e,t,o){return R3e.registerColor(a,i,e,t,o)}function DCe(){return R3e}function J2o(a,i){switch(a.op){case 0:return bD(a.value,i)?.darken(a.factor);case 1:return bD(a.value,i)?.lighten(a.factor);case 2:return bD(a.value,i)?.transparent(a.factor);case 7:{let e=bD(a.color,i)||Ue.transparent,t=bD(a.with,i)||Ue.transparent;return e.mix(t,a.ratio)}case 3:{let e=bD(a.background,i);return e?bD(a.value,i)?.makeOpaque(e):bD(a.value,i)}case 4:for(let e of a.values){let t=bD(e,i);if(t)return t}return;case 6:return bD(i.defines(a.if)?a.then:a.else,i);case 5:{let e=bD(a.value,i);if(!e)return;let t=bD(a.background,i);return t?e.isDarkerThan(t)?Ue.getLighterColor(e,t,a.factor).transparent(a.transparency):Ue.getDarkerColor(e,t,a.factor).transparent(a.transparency):e.transparent(a.factor*a.transparency)}default:throw bs(a)}}function Eu(a,i){return{op:0,value:a,factor:i}}function Bf(a,i){return{op:1,value:a,factor:i}}function ni(a,i){return{op:2,value:a,factor:i}}function w5(a,i){return{op:3,value:a,background:i}}function Wce(...a){return{op:4,values:a}}function Vce(a,i,e){return{op:6,if:a,then:i,else:e}}function nsi(a,i,e,t){return{op:5,value:a,background:i,factor:e,transparency:t}}function bD(a,i){if(a!==null){if(typeof a=="string")return a[0]==="#"?Ue.fromHex(a):i.getColor(a);if(a instanceof Ue)return a;if(typeof a=="object")return J2o(a,i)}}var Bce="vscode://schemas/workbench-colors",M9i=oe.as(Ta.JSONContribution);M9i.registerSchema(Bce,R3e.getColorSchema());var L9i=new Dt(()=>M9i.notifySchemaChanged(Bce),200);R3e.onDidChangeSchema(()=>{L9i.isScheduled()||L9i.schedule()});var xo=te("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},d(2619,null)),E6n=te("strongForeground",{dark:"#FFFFFF",light:"#000000",hcDark:"#FFFFFF",hcLight:"#000000"},d(2622,null)),rsi=te("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},d(2616,null)),Hce=te("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},d(2617,null)),L3e=te("descriptionForeground",{light:"#717171",dark:ni(xo,.7),hcDark:ni(xo,.7),hcLight:ni(xo,.7)},d(2615,null)),C5=te("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},d(2620,null)),Kc=te("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},d(2618,null)),Ei=te("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},d(2614,null)),la=te("contrastActiveBorder",{light:null,dark:null,hcDark:Kc,hcLight:Kc},d(2613,null)),KIt=te("selection.background",null,d(2621,null)),AS=te("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},d(2627,null)),GIt=te("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},d(2626,null)),T6n=te("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:Ue.black,hcLight:"#292929"},d(2631,null)),_6n=te("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#FFFFFF",hcLight:"#FFFFFF"},d(2630,null)),D6n=te("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:null,hcLight:"#09345f"},d(2628,null)),R6n=te("textPreformat.border",{light:null,dark:null,hcDark:Ei,hcLight:null},d(2629,null)),L6n=te("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},d(2623,null)),M6n=te("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:Ue.white,hcLight:"#292929"},d(2624,null)),P6n=te("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:Ue.black,hcLight:"#F2F2F2"},d(2625,null));var W6n=te("sash.hoverBorder",Kc,d(2846,null)),Gv=te("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Ue.black,hcLight:"#0F4A85"},d(2840,null)),gx=te("badge.foreground",{dark:Ue.white,light:"#333",hcDark:Ue.white,hcLight:Ue.white},d(2841,null)),P9i=te("activityWarningBadge.foreground",{dark:Ue.white,light:Ue.white,hcDark:Ue.white,hcLight:Ue.white},d(2839,null)),A9i=te("activityWarningBadge.background",{dark:"#B27C00",light:"#B27C00",hcDark:null,hcLight:"#B27C00"},d(2838,null)),ssi=te("activityErrorBadge.foreground",{dark:Ue.black.lighten(.2),light:Ue.white,hcDark:null,hcLight:Ue.black.lighten(.2)},d(2837,null)),asi=te("activityErrorBadge.background",{dark:"#F14C4C",light:"#E51400",hcDark:null,hcLight:"#F14C4C"},d(2836,null)),Xz=te("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},d(2848,null)),iX=te("scrollbarSlider.background",{dark:Ue.fromHex("#797979").transparent(.4),light:Ue.fromHex("#646464").transparent(.4),hcDark:ni(Ei,.6),hcLight:ni(Ei,.4)},d(2850,null)),Jz=te("scrollbarSlider.hoverBackground",{dark:Ue.fromHex("#646464").transparent(.7),light:Ue.fromHex("#646464").transparent(.7),hcDark:ni(Ei,.8),hcLight:ni(Ei,.8)},d(2851,null)),Zz=te("scrollbarSlider.activeBackground",{dark:Ue.fromHex("#BFBFBF").transparent(.4),light:Ue.fromHex("#000000").transparent(.6),hcDark:Ei,hcLight:Ei},d(2849,null)),V6n=te("scrollbar.background",null,d(2847,null)),N9i=te("progressBar.background",{dark:Ue.fromHex("#0E70C0"),light:Ue.fromHex("#0E70C0"),hcDark:Ei,hcLight:Ei},d(2845,null)),O9i=te("chart.line",{dark:"#236B8E",light:"#236B8E",hcDark:"#236B8E",hcLight:"#236B8E"},d(2844,null)),lsi=te("chart.axis",{dark:Ue.fromHex("#BFBFBF").transparent(.4),light:Ue.fromHex("#000000").transparent(.6),hcDark:Ei,hcLight:Ei},d(2842,null)),F9i=te("chart.guide",{dark:Ue.fromHex("#BFBFBF").transparent(.2),light:Ue.fromHex("#000000").transparent(.2),hcDark:Ei,hcLight:Ei},d(2843,null));var Bo=te("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:Ue.black,hcLight:Ue.white},d(2660,null)),Vd=te("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:Ue.white,hcLight:xo},d(2667,null)),G6n=te("editorStickyScroll.background",Bo,d(2685,null)),q6n=te("editorStickyScrollGutter.background",Bo,d(2687,null)),$6n=te("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:Ue.fromHex("#0F4A85").transparent(.1)},d(2688,null)),j6n=te("editorStickyScroll.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(2686,null)),Q6n=te("editorStickyScroll.shadow",Xz,d(2689,null)),qu=te("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:Ue.white},d(2692,null)),vT=te("editorWidget.foreground",xo,d(2694,null)),bT=te("editorWidget.border",{dark:ni(vT,.2),light:ni(vT,.2),hcDark:Ei,hcLight:Ei},d(2693,null)),Y6n=te("editorWidget.resizeBorder",null,d(2695,null)),X6n=te("editorError.background",null,d(2662,null),!0),$v=te("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},d(2663,null)),H9i=te("editorError.border",{dark:null,light:null,hcDark:Ue.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},d(2696,null)),U9i=te("editorWarning.background",null,d(2690,null),!0),Tg=te("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},d(2691,null)),oX=te("editorWarning.border",{dark:null,light:null,hcDark:Ue.fromHex("#FFCC00").transparent(.8),hcLight:Ue.fromHex("#FFCC00").transparent(.8)},d(2731,null)),J6n=te("editorInfo.background",null,d(2670,null),!0),eh=te("editorInfo.foreground",{dark:"#59a4f9",light:"#0063d3",hcDark:"#59a4f9",hcLight:"#0063d3"},d(2671,null)),nX=te("editorInfo.border",{dark:null,light:null,hcDark:Ue.fromHex("#59a4f9").transparent(.8),hcLight:"#292929"},d(2707,null)),z9i=te("editorHint.foreground",{dark:Ue.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},d(2668,null)),Z6n=te("editorHint.border",{dark:null,light:null,hcDark:Ue.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},d(2702,null)),K9i=te("editorLink.activeForeground",{dark:"#4E94CE",light:Ue.blue,hcDark:Ue.cyan,hcLight:"#292929"},d(2640,null)),qv=te("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},d(2681,null)),G9i=te("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:Ue.white},d(2682,null)),q9i=te("editor.inactiveSelectionBackground",{light:ni(qv,.5),dark:ni(qv,.5),hcDark:ni(qv,.7),hcLight:ni(qv,.5)},d(2669,null),!0),ACe=te("editor.selectionHighlightBackground",{light:nsi(qv,Bo,.3,.6),dark:nsi(qv,Bo,.3,.6),hcDark:null,hcLight:null},d(2683,null),!0),e9n=te("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:la,hcLight:la},d(2684,null)),t9n=te("editor.compositionBorder",{light:"#000000",dark:"#ffffff",hcLight:"#000000",hcDark:"#ffffff"},d(2661,null)),Uce=te("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},d(2664,null)),$9i=te("editor.findMatchForeground",null,d(2666,null)),NS=te("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},d(2697,null),!0),j9i=te("editor.findMatchHighlightForeground",null,d(2699,null),!0),Q9i=te("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},d(2700,null),!0),i9n=te("editor.findMatchBorder",{light:null,dark:null,hcDark:la,hcLight:la},d(2665,null)),TF=te("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:la,hcLight:la},d(2698,null)),Y9i=te("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:ni(la,.4),hcLight:ni(la,.4)},d(2701,null),!0),qIt=te("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},d(2706,null),!0),EF=te("editorHoverWidget.background",qu,d(2703,null)),rX=te("editorHoverWidget.foreground",vT,d(2705,null)),eK=te("editorHoverWidget.border",bT,d(2704,null)),o9n=te("editorHoverWidget.statusBarBackground",{dark:Bf(EF,.2),light:Eu(EF,.05),hcDark:qu,hcLight:qu},d(2727,null)),$It=te("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:Ue.white,hcLight:Ue.black},d(2675,null)),jIt=te("editorInlayHint.background",{dark:ni(Gv,.1),light:ni(Gv,.1),hcDark:ni(Ue.white,.1),hcLight:ni(Gv,.1)},d(2672,null)),X9i=te("editorInlayHint.typeForeground",$It,d(2677,null)),J9i=te("editorInlayHint.typeBackground",jIt,d(2674,null)),Z9i=te("editorInlayHint.parameterForeground",$It,d(2676,null)),e7i=te("editorInlayHint.parameterBackground",jIt,d(2673,null)),Z2o=te("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},d(2680,null)),n9n=te("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(2679,null)),r9n=te("editorLightBulbAi.foreground",Z2o,d(2678,null)),s9n=te("editor.snippetTabstopHighlightBackground",{dark:new Ue(new Ut(124,124,124,.3)),light:new Ue(new Ut(10,50,100,.2)),hcDark:new Ue(new Ut(124,124,124,.3)),hcLight:new Ue(new Ut(10,50,100,.2))},d(2725,null)),a9n=te("editor.snippetTabstopHighlightBorder",null,d(2726,null)),l9n=te("editor.snippetFinalTabstopHighlightBackground",null,d(2723,null)),c9n=te("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new Ue(new Ut(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},d(2724,null)),RCe=new Ue(new Ut(155,185,85,.2)),LCe=new Ue(new Ut(255,0,0,.2)),_g=te("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},d(2650,null),!0),df=te("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},d(2656,null),!0),A3e=te("diffEditor.insertedLineBackground",{dark:RCe,light:RCe,hcDark:null,hcLight:null},d(2652,null),!0),d9n=te("diffEditor.removedLineBackground",{dark:LCe,light:LCe,hcDark:null,hcLight:null},d(2658,null),!0),u9n=te("diffEditorGutter.insertedLineBackground",null,d(2651,null)),p9n=te("diffEditorGutter.removedLineBackground",null,d(2657,null)),QIt=te("diffEditorOverview.insertedForeground",null,d(2654,null)),YIt=te("diffEditorOverview.removedForeground",null,d(2655,null)),m9n=te("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},d(2653,null)),h9n=te("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},d(2659,null)),g9n=te("diffEditor.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(2649,null)),t7i=te("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},d(2645,null)),f9n=te("diffEditor.unchangedRegionBackground","sideBar.background",d(2647,null)),v9n=te("diffEditor.unchangedRegionForeground","foreground",d(2648,null)),b9n=te("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},d(2646,null)),_F=te("widget.shadow",{dark:ni(Ue.black,.36),light:ni(Ue.black,.16),hcDark:null,hcLight:null},d(2733,null)),SD=te("widget.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(2732,null)),x5=te("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},d(2729,null)),S9n=te("toolbar.hoverOutline",{dark:null,light:null,hcDark:la,hcLight:la},d(2730,null)),I9n=te("toolbar.activeBackground",{dark:Bf(x5,.1),light:Eu(x5,.1),hcDark:null,hcLight:null},d(2728,null)),i7i=te("breadcrumb.foreground",ni(xo,.8),d(2642,null)),o7i=te("breadcrumb.background",Bo,d(2641,null)),dsi=te("breadcrumb.focusForeground",{light:Eu(xo,.2),dark:Bf(xo,.1),hcDark:Bf(xo,.1),hcLight:Bf(xo,.1)},d(2642,null)),n7i=te("breadcrumb.activeSelectionForeground",{light:Eu(xo,.2),dark:Bf(xo,.1),hcDark:Bf(xo,.1),hcLight:Bf(xo,.1)},d(2644,null)),usi=te("breadcrumbPicker.background",qu,d(2643,null)),r7i=.5,W9i=Ue.fromHex("#40C8AE").transparent(r7i),V9i=Ue.fromHex("#40A6FF").transparent(r7i),B9i=Ue.fromHex("#606060").transparent(.4),psi=.4,MCe=1,M3e=te("merge.currentHeaderBackground",{dark:W9i,light:W9i,hcDark:null,hcLight:null},d(2712,null),!0),y9n=te("merge.currentContentBackground",ni(M3e,psi),d(2711,null),!0),P3e=te("merge.incomingHeaderBackground",{dark:V9i,light:V9i,hcDark:null,hcLight:null},d(2714,null),!0),w9n=te("merge.incomingContentBackground",ni(P3e,psi),d(2713,null),!0),csi=te("merge.commonHeaderBackground",{dark:B9i,light:B9i,hcDark:null,hcLight:null},d(2710,null),!0),C9n=te("merge.commonContentBackground",ni(csi,psi),d(2709,null),!0),PCe=te("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},d(2708,null)),x9n=te("editorOverviewRuler.currentContentForeground",{dark:ni(M3e,MCe),light:ni(M3e,MCe),hcDark:PCe,hcLight:PCe},d(2716,null)),k9n=te("editorOverviewRuler.incomingContentForeground",{dark:ni(P3e,MCe),light:ni(P3e,MCe),hcDark:PCe,hcLight:PCe},d(2718,null)),E9n=te("editorOverviewRuler.commonContentForeground",{dark:ni(csi,MCe),light:ni(csi,MCe),hcDark:PCe,hcLight:PCe},d(2715,null)),DF=te("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:"#AB5A00"},d(2717,null),!0),NCe=te("editorOverviewRuler.selectionHighlightForeground","#A0A0A0CC",d(2719,null),!0),s7i=te("problemsErrorIcon.foreground",$v,d(2720,null)),a7i=te("problemsWarningIcon.foreground",Tg,d(2722,null)),l7i=te("problemsInfoIcon.foreground",eh,d(2721,null));var sX=te("minimap.findMatchHighlight",NS,d(2827,null),!0),N3e=te("minimap.selectionOccurrenceHighlight",ACe,d(2831,null),!0),msi=te("minimap.selectionHighlight",qv,d(2830,null),!0),c7i=te("minimap.infoHighlight",{dark:eh,light:eh,hcDark:nX,hcLight:nX},d(2829,null)),d7i=te("minimap.warningHighlight",{dark:Tg,light:Tg,hcDark:oX,hcLight:oX},d(2835,null)),u7i=te("minimap.errorHighlight",{dark:new Ue(new Ut(255,18,18,.7)),light:new Ue(new Ut(255,18,18,.7)),hcDark:new Ue(new Ut(255,50,50,1)),hcLight:"#B5200D"},d(2826,null)),p7i=te("minimap.background",null,d(2825,null)),m7i=te("minimap.foregroundOpacity",Ue.fromHex("#000f"),d(2828,null)),M9n=te("minimapSlider.background",ni(iX,.5),d(2833,null)),P9n=te("minimapSlider.hoverBackground",ni(Jz,.5),d(2834,null)),A9n=te("minimapSlider.activeBackground",ni(Zz,.5),d(2832,null));var OCe=te("charts.foreground",xo,d(2633,null)),XIt=te("charts.lines",ni(xo,.5),d(2635,null)),zce=te("charts.red",$v,d(2638,null)),O3e=te("charts.blue",eh,d(2632,null)),h7i=te("charts.yellow",Tg,d(2639,null)),B9n=te("charts.orange",sX,d(2636,null)),k5=te("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},d(2634,null)),JIt=te("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(2637,null));var lX=te("list.focusBackground",null,d(2802,null)),FCe=te("list.focusForeground",null,d(2803,null)),F3e=te("list.focusOutline",{dark:Kc,light:Kc,hcDark:la,hcLight:la},d(2805,null)),g7i=te("list.focusAndSelectionOutline",null,d(2801,null)),Kw=te("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:Ue.fromHex("#0F4A85").transparent(.1)},d(2788,null)),ID=te("list.activeSelectionForeground",{dark:Ue.white,light:Ue.white,hcDark:null,hcLight:null},d(2789,null)),ZIt=te("list.activeSelectionIconForeground",null,d(2790,null)),bv=te("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:Ue.fromHex("#0F4A85").transparent(.1)},d(2810,null)),eyt=te("list.inactiveSelectionForeground",null,d(2811,null)),f7i=te("list.inactiveSelectionIconForeground",null,d(2812,null)),tyt=te("list.inactiveFocusBackground",null,d(2808,null)),v7i=te("list.inactiveFocusOutline",null,d(2809,null)),ST=te("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:Ue.white.transparent(.1),hcLight:Ue.fromHex("#0F4A85").transparent(.1)},d(2806,null)),WCe=te("list.hoverForeground",null,d(2807,null)),iyt=te("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},d(2792,null)),b7i=te("list.dropBetweenBackground",{dark:C5,light:C5,hcDark:null,hcLight:null},d(2793,null)),aX=te("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:Kc,hcLight:Kc},d(2786,null)),oyt=te("list.focusHighlightForeground",{dark:aX,light:Vce(Kw,aX,"#BBE7FF"),hcDark:aX,hcLight:aX},d(2804,null)),S7i=te("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},d(2787,null)),Ok=te("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},d(2794,null)),tK=te("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},d(2813,null)),I7i=te("listFilterWidget.background",{light:Eu(qu,0),dark:Bf(qu,0),hcDark:qu,hcLight:qu},d(2797,null)),y7i=te("listFilterWidget.outline",{dark:Ue.transparent,light:Ue.transparent,hcDark:"#f38518",hcLight:"#007ACC"},d(2799,null)),w7i=te("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:Ei,hcLight:Ei},d(2798,null)),C7i=te("listFilterWidget.shadow",_F,d(2800,null)),x7i=te("list.filterMatchBackground",{dark:NS,light:NS,hcDark:null,hcLight:null},d(2795,null)),k7i=te("list.filterMatchBorder",{dark:TF,light:TF,hcDark:Ei,hcLight:la},d(2796,null)),nyt=te("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},d(2791,null)),VCe=te("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},d(2817,null)),E7i=te("tree.inactiveIndentGuidesStroke",ni(VCe,.4),d(2816,null)),T7i=te("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},d(2814,null)),W3e=te("tree.tableOddRowsBackground",{dark:ni(xo,.04),light:ni(xo,.04),hcDark:null,hcLight:null},d(2815,null)),q9n=te("editorActionList.background",qu,d(2782,null)),_7i=te("editorActionList.foreground",vT,d(2785,null)),$9n=te("editorActionList.focusForeground",ID,d(2784,null)),j9n=te("editorActionList.focusBackground",Kw,d(2783,null));var Hf=te("input.background",{dark:"#3C3C3C",light:Ue.white,hcDark:Ue.black,hcLight:Ue.white},d(2755,null)),IT=te("input.foreground",xo,d(2757,null)),LI=te("input.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(2756,null)),PB=te("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:Ei,hcLight:Ei},d(2754,null)),eGo=te("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},d(2760,null)),AB=te("inputOption.activeBackground",{dark:ni(Kc,.4),light:ni(Kc,.2),hcDark:Ue.transparent,hcLight:Ue.transparent},d(2758,null)),E5=te("inputOption.activeForeground",{dark:Ue.white,light:Ue.black,hcDark:xo,hcLight:xo},d(2759,null)),cX=te("input.placeholderForeground",{light:ni(xo,.5),dark:ni(xo,.5),hcDark:ni(xo,.7),hcLight:ni(xo,.7)},d(2761,null)),D7i=te("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:Ue.black,hcLight:Ue.white},d(2765,null)),R7i=te("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:xo},d(2767,null)),L7i=te("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:Ei,hcLight:Ei},d(2766,null)),M7i=te("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:Ue.black,hcLight:Ue.white},d(2768,null)),P7i=te("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:xo},d(2770,null)),A7i=te("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:Ei,hcLight:Ei},d(2769,null)),ryt=te("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:Ue.black,hcLight:Ue.white},d(2762,null)),syt=te("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:xo},d(2764,null)),ayt=te("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:Ei,hcLight:Ei},d(2763,null)),iK=te("dropdown.background",{dark:"#3C3C3C",light:Ue.white,hcDark:Ue.black,hcLight:Ue.white},d(2750,null)),N7i=te("dropdown.listBackground",{dark:null,light:null,hcDark:Ue.black,hcLight:Ue.white},d(2753,null)),Kce=te("dropdown.foreground",{dark:"#F0F0F0",light:xo,hcDark:Ue.white,hcLight:xo},d(2752,null)),RF=te("dropdown.border",{dark:iK,light:"#CECECE",hcDark:Ei,hcLight:Ei},d(2751,null)),Fk=te("button.foreground",Ue.white,d(2736,null)),lyt=te("button.separator",ni(Fk,.4),d(2742,null)),th=te("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:Ue.black,hcLight:"#0F4A85"},d(2734,null)),T5=te("button.hoverBackground",{dark:Bf(th,.2),light:Eu(th,.2),hcDark:th,hcLight:th},d(2737,null)),dX=te("button.border",Ei,d(2735,null)),Gce=te("button.secondaryForeground",{dark:xo,light:xo,hcDark:Ue.white,hcLight:xo},d(2740,null)),_5=te("button.secondaryBackground",{dark:ST,light:ST,hcDark:null,hcLight:Ue.white},d(2738,null)),i7n=te("button.secondaryBorder",Ei,d(2739,null)),qce=te("button.secondaryHoverBackground",{dark:Bf(ST,.2),light:Bf(ST,.2),hcDark:null,hcLight:null},d(2741,null)),BCe=te("radio.activeForeground",E5,d(2776,null)),O7i=te("radio.activeBackground",AB,d(2777,null)),F7i=te("radio.activeBorder",PB,d(2775,null)),W7i=te("radio.inactiveForeground",null,d(2781,null)),V7i=te("radio.inactiveBackground",null,d(2779,null)),B7i=te("radio.inactiveBorder",{light:ni(BCe,.2),dark:ni(BCe,.2),hcDark:ni(BCe,.4),hcLight:ni(BCe,.2)},d(2780,null)),H7i=te("radio.inactiveHoverBackground",eGo,d(2778,null)),HCe=te("checkbox.background",iK,d(2743,null)),o7n=te("checkbox.selectBackground",qu,d(2748,null)),UCe=te("checkbox.foreground",Kce,d(2747,null)),cyt=te("checkbox.border",RF,d(2744,null)),n7n=te("checkbox.selectBorder",C5,d(2749,null)),U7i=te("checkbox.disabled.background",{op:7,color:HCe,with:UCe,ratio:.33},d(2745,null)),z7i=te("checkbox.disabled.foreground",{op:7,color:UCe,with:HCe,ratio:.33},d(2746,null)),K7i=te("keybindingLabel.background",{dark:new Ue(new Ut(128,128,128,.17)),light:new Ue(new Ut(221,221,221,.4)),hcDark:Ue.transparent,hcLight:Ue.transparent},d(2771,null)),G7i=te("keybindingLabel.foreground",{dark:Ue.fromHex("#CCCCCC"),light:Ue.fromHex("#555555"),hcDark:Ue.white,hcLight:xo},d(2774,null)),q7i=te("keybindingLabel.border",{dark:new Ue(new Ut(51,51,51,.6)),light:new Ue(new Ut(204,204,204,.4)),hcDark:new Ue(new Ut(111,195,223)),hcLight:Ei},d(2772,null)),$7i=te("keybindingLabel.bottomBorder",{dark:new Ue(new Ut(68,68,68,.6)),light:new Ue(new Ut(187,187,187,.4)),hcDark:new Ue(new Ut(111,195,223)),hcLight:xo},d(2773,null));var j7i=te("menu.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(2819,null)),Q7i=te("menu.foreground",Kce,d(2820,null)),Y7i=te("menu.background",iK,d(2818,null)),d7n=te("menu.selectionForeground",ID,d(2823,null)),u7n=te("menu.selectionBackground",Kw,d(2821,null)),X7i=te("menu.selectionBorder",{dark:null,light:null,hcDark:la,hcLight:la},d(2822,null)),J7i=te("menu.separatorBackground",{dark:ni(xo,.2),light:ni(xo,.2),hcDark:Ei,hcLight:Ei},d(2824,null));var zCe=te("quickInput.background",qu,d(2852,null)),dyt=te("quickInput.foreground",vT,d(2853,null)),eYi=te("quickInputTitle.background",{dark:new Ue(new Ut(255,255,255,.105)),light:new Ue(new Ut(0,0,0,.06)),hcDark:"#000000",hcLight:Ue.white},d(2856,null)),uyt=te("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:Ue.white,hcLight:"#0F4A85"},d(2855,null)),tYi=te("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:Ue.white,hcLight:"#0F4A85"},d(2854,null)),Z7i=te("quickInput.list.focusBackground",null,"",void 0,d(2857,null)),oK=te("quickInputList.focusForeground",ID,d(2859,null)),KCe=te("quickInputList.focusIconForeground",ZIt,d(2861,null)),nK=te("quickInputList.focusBackground",{dark:Wce(Z7i,Kw),light:Wce(Z7i,Kw),hcDark:null,hcLight:null},d(2858,null)),v7n=te("quickInputList.focusHighlightForeground",oyt,d(2860,null));var w7n=te("search.resultsInfoForeground",{light:xo,dark:ni(xo,.65),hcDark:xo,hcLight:xo},d(2862,null)),C7n=te("searchEditor.findMatchBackground",{light:ni(NS,.66),dark:ni(NS,.66),hcDark:NS,hcLight:NS},d(2864,null)),x7n=te("searchEditor.findMatchBorder",{light:ni(TF,.66),dark:ni(TF,.66),hcDark:TF,hcLight:TF},d(2863,null));var D5=class{constructor(i,e){this.x=i;this.y=e;this._pageCoordinatesBrand=void 0}toClientCoordinates(i){return new V3e(this.x-i.scrollX,this.y-i.scrollY)}},V3e=class{constructor(i,e){this.clientX=i;this.clientY=e;this._clientCoordinatesBrand=void 0}toPageCoordinates(i){return new D5(this.clientX+i.scrollX,this.clientY+i.scrollY)}},gsi=class{constructor(i,e,t,o){this.x=i;this.y=e;this.width=t;this.height=o;this._editorPagePositionBrand=void 0}},fsi=class{constructor(i,e){this.x=i;this.y=e;this._positionRelativeToEditorBrand=void 0}};function GCe(a){let i=ur(a);return new gsi(i.left,i.top,i.width,i.height)}function qCe(a,i,e){let t=i.width/a.offsetWidth,o=i.height/a.offsetHeight,n=(e.x-i.x)/t,r=(e.y-i.y)/o;return new fsi(n,r)}var zL=class extends Ln{constructor(e,t,o){super(Me(o),e);this._editorMouseEventBrand=void 0;this.isFromPointerCapture=t,this.pos=new D5(this.posx,this.posy),this._editorViewDomNode=o}get editorPos(){return this._editorPos??=GCe(this._editorViewDomNode),this._editorPos}get relativePos(){return this._relativePos??=qCe(this._editorViewDomNode,this.editorPos,this.pos),this._relativePos}},pyt=class{constructor(i){this._editorViewDomNode=i}_create(i){return new zL(i,!1,this._editorViewDomNode)}onContextMenu(i,e){return $(i,ne.CONTEXT_MENU,t=>{e(this._create(t))})}onMouseUp(i,e){return $(i,ne.MOUSE_UP,t=>{e(this._create(t))})}onMouseDown(i,e){return $(i,ne.MOUSE_DOWN,t=>{e(this._create(t))})}onPointerDown(i,e){return $(i,ne.POINTER_DOWN,t=>{e(this._create(t),t.pointerId)})}onMouseLeave(i,e){return $(i,ne.MOUSE_LEAVE,t=>{e(this._create(t))})}onMouseMove(i,e){return $(i,ne.MOUSE_MOVE,t=>e(this._create(t)))}},myt=class{constructor(i){this._editorViewDomNode=i}_create(i){return new zL(i,!1,this._editorViewDomNode)}onPointerUp(i,e){return $(i,"pointerup",t=>{e(this._create(t))})}onPointerDown(i,e){return $(i,ne.POINTER_DOWN,t=>{e(this._create(t),t.pointerId)})}onPointerLeave(i,e){return $(i,ne.POINTER_LEAVE,t=>{e(this._create(t))})}onPointerMove(i,e){return $(i,"pointermove",t=>e(this._create(t)))}},hyt=class extends k{constructor(i){super(),this._editorViewDomNode=i,this._globalPointerMoveMonitor=this._register(new fT),this._keydownListener=null}startMonitoring(i,e,t,o,n){this._keydownListener=Yo(i.ownerDocument,"keydown",r=>{r.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,r.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(i,e,t,r=>{o(new zL(r,!0,this._editorViewDomNode))},r=>{this._keydownListener.dispose(),n(r)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}},uX=class a{constructor(i){this._editor=i;this._instanceId=++a._idPool;this._counter=0;this._rules=new Ot;this._garbageCollectionScheduler=new Dt(()=>this.garbageCollect(),1e3)}static{this._idPool=0}dispose(){this._rules.dispose(),this._garbageCollectionScheduler.dispose()}createClassNameRef(i){let e=this.getOrCreateRule(i);return e.increaseRefCount(),{className:e.className,dispose:()=>{e.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(i){let e=this.computeUniqueKey(i),t=this._rules.get(e);if(!t){let o=this._counter++;t=new vsi(e,`dyn-rule-${this._instanceId}-${o}`,a5(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,i),this._rules.set(e,t)}return t}computeUniqueKey(i){return JSON.stringify(i)}garbageCollect(){for(let i of this._rules.values())i.hasReferences()||this._rules.deleteAndDispose(i.key)}},vsi=class{constructor(i,e,t,o){this.key=i;this.className=e;this.properties=o;this._referenceCount=0;this._styleElementDisposables=new O,this._styleElement=Pr(t,void 0,this._styleElementDisposables),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(i,e){let t=`.${i} {`;for(let o in e){let n=e[o],r;typeof n=="object"?r=Tt(n.id):r=n;let s=tGo(o);t+=`
	${s}: ${r};`}return t+=`
}`,t}dispose(){this._styleElementDisposables.dispose(),this._styleElement=void 0}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}};function tGo(a){return a.replace(/(^[A-Z])/,([i])=>i.toLowerCase()).replace(/([A-Z])/g,([i])=>`-${i.toLowerCase()}`)}var yT=class extends k{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(i){return!1}onCompositionEnd(i){return!1}onConfigurationChanged(i){return!1}onCursorStateChanged(i){return!1}onDecorationsChanged(i){return!1}onFlushed(i){return!1}onFocusChanged(i){return!1}onLanguageConfigurationChanged(i){return!1}onLineMappingChanged(i){return!1}onLinesChanged(i){return!1}onLinesDeleted(i){return!1}onLinesInserted(i){return!1}onRevealRangeRequest(i){return!1}onScrollChanged(i){return!1}onThemeChanged(i){return!1}onTokensChanged(i){return!1}onTokensColorsChanged(i){return!1}onZonesChanged(i){return!1}handleEvents(i){let e=!1;for(let t=0,o=i.length;t<o;t++){let n=i[t];switch(n.type){case 0:this.onCompositionStart(n)&&(e=!0);break;case 1:this.onCompositionEnd(n)&&(e=!0);break;case 2:this.onConfigurationChanged(n)&&(e=!0);break;case 3:this.onCursorStateChanged(n)&&(e=!0);break;case 4:this.onDecorationsChanged(n)&&(e=!0);break;case 5:this.onFlushed(n)&&(e=!0);break;case 6:this.onFocusChanged(n)&&(e=!0);break;case 7:this.onLanguageConfigurationChanged(n)&&(e=!0);break;case 8:this.onLineMappingChanged(n)&&(e=!0);break;case 9:this.onLinesChanged(n)&&(e=!0);break;case 10:this.onLinesDeleted(n)&&(e=!0);break;case 11:this.onLinesInserted(n)&&(e=!0);break;case 12:this.onRevealRangeRequest(n)&&(e=!0);break;case 13:this.onScrollChanged(n)&&(e=!0);break;case 15:this.onTokensChanged(n)&&(e=!0);break;case 14:this.onThemeChanged(n)&&(e=!0);break;case 16:this.onTokensColorsChanged(n)&&(e=!0);break;case 17:this.onZonesChanged(n)&&(e=!0);break;default:console.info("View received unknown event: "),console.info(n)}}e&&(this._shouldRender=!0)}};var np=class extends yT{constructor(i){super(),this._context=i,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onBeforeRender(i){}};var MI=class{static write(i,e){i.setAttribute("data-mprt",String(e))}static read(i){let e=i.getAttribute("data-mprt");return e===null?0:parseInt(e,10)}static collect(i,e){let t=[],o=0;for(;i&&i!==i.ownerDocument.body&&i!==e;)i.nodeType===i.ELEMENT_NODE&&(t[o++]=this.read(i)),i=i.parentElement;let n=new Uint8Array(o);for(let r=0;r<o;r++)n[r]=t[o-r-1];return n}};var bsi=class{constructor(i,e){this._restrictedRenderingContextBrand=void 0;this._viewLayout=i,this.viewportData=e,this.scrollWidth=this._viewLayout.getScrollWidth(),this.scrollHeight=this._viewLayout.getScrollHeight(),this.visibleRange=this.viewportData.visibleRange,this.bigNumbersDelta=this.viewportData.bigNumbersDelta;let t=this._viewLayout.getCurrentViewport();this.scrollTop=t.top,this.scrollLeft=t.left,this.viewportWidth=t.width,this.viewportHeight=t.height}getScrolledTopFromAbsoluteTop(i){return i-this.scrollTop}getVerticalOffsetForLineNumber(i,e){return this._viewLayout.getVerticalOffsetForLineNumber(i,e)}getVerticalOffsetAfterLineNumber(i,e){return this._viewLayout.getVerticalOffsetAfterLineNumber(i,e)}getLineHeightForLineNumber(i){return this._viewLayout.getLineHeightForLineNumber(i)}getDecorationsInViewport(){return this.viewportData.getDecorationsInViewport()}},gyt=class extends bsi{constructor(e,t,o,n){super(e,t);this._renderingContextBrand=void 0;this._viewLines=o,this._viewLinesGpu=n}linesVisibleRangesForRange(e,t){let o=this._viewLines.linesVisibleRangesForRange(e,t);if(!this._viewLinesGpu)return o;let n=this._viewLinesGpu.linesVisibleRangesForRange(e,t);return o?n?o.concat(n).sort((r,s)=>r.lineNumber-s.lineNumber):o:n}visibleRangeForPosition(e){return this._viewLines.visibleRangeForPosition(e)??this._viewLinesGpu?.visibleRangeForPosition(e)??null}},$Ce=class{constructor(i,e,t,o){this.outsideRenderedLine=i;this.lineNumber=e;this.ranges=t;this.continuesOnNextLine=o}static firstLine(i){if(!i)return null;let e=null;for(let t of i)(!e||t.lineNumber<e.lineNumber)&&(e=t);return e}static lastLine(i){if(!i)return null;let e=null;for(let t of i)(!e||t.lineNumber>e.lineNumber)&&(e=t);return e}},pX=class a{constructor(i,e){this._horizontalRangeBrand=void 0;this.left=Math.round(i),this.width=Math.round(e)}static from(i){let e=new Array(i.length);for(let t=0,o=i.length;t<o;t++){let n=i[t];e[t]=new a(n.left,n.width)}return e}toString(){return`[${this.left},${this.width}]`}},_A=class{constructor(i,e){this._floatHorizontalRangeBrand=void 0;this.left=i,this.width=e}toString(){return`[${this.left},${this.width}]`}static compare(i,e){return i.left-e.left}},jCe=class{constructor(i,e){this.outsideRenderedLine=i,this.originalLeft=e,this.left=Math.round(this.originalLeft)}},$ce=class{constructor(i,e){this.outsideRenderedLine=i;this.ranges=e}};var jce=class{static _createRange(){return this._handyReadyRange||(this._handyReadyRange=document.createRange()),this._handyReadyRange}static _detachRange(i,e){i.selectNodeContents(e)}static _readClientRects(i,e,t,o,n){let r=this._createRange();try{return r.setStart(i,e),r.setEnd(t,o),r.getClientRects()}catch{return null}finally{this._detachRange(r,n)}}static _mergeAdjacentRanges(i){if(i.length===1)return i;i.sort(_A.compare);let e=[],t=0,o=i[0];for(let n=1,r=i.length;n<r;n++){let s=i[n];o.left+o.width+.9>=s.left?o.width=Math.max(o.width,s.left+s.width-o.left):(e[t++]=o,o=s)}return e[t++]=o,e}static _createHorizontalRangesFromClientRects(i,e,t){if(!i||i.length===0)return null;let o=[];for(let n=0,r=i.length;n<r;n++){let s=i[n];o[n]=new _A(Math.max(0,(s.left-e)/t),s.width/t)}return this._mergeAdjacentRanges(o)}static readHorizontalRanges(i,e,t,o,n,r){let l=i.children.length-1;if(0>l)return null;if(e=Math.min(l,Math.max(0,e)),o=Math.min(l,Math.max(0,o)),e===o&&t===n&&t===0&&!i.children[e].firstChild){let h=i.children[e].getClientRects();return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(h,r.clientRectDeltaLeft,r.clientRectScale)}e!==o&&o>0&&n===0&&(o--,n=1073741824);let c=i.children[e].firstChild,u=i.children[o].firstChild;if((!c||!u)&&(!c&&t===0&&e>0&&(c=i.children[e-1].firstChild,t=1073741824),!u&&n===0&&o>0&&(u=i.children[o-1].firstChild,n=1073741824)),!c||!u)return null;t=Math.min(c.textContent.length,Math.max(0,t)),n=Math.min(u.textContent.length,Math.max(0,n));let p=this._readClientRects(c,t,u,n,r.endNode);return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(p,r.clientRectDeltaLeft,r.clientRectScale)}};var QCe=class{constructor(i,e){this._viewModelDecorationBrand=void 0;this.range=i,this.options=e}};function B3e(a,i){return!(i.options.hideInCommentTokens&&fyt(a,i)||i.options.hideInStringTokens&&vyt(a,i))}function fyt(a,i){return iYi(a,i.range,e=>e===1)}function vyt(a,i){return iYi(a,i.range,e=>e===2)}function iYi(a,i,e){for(let t=i.startLineNumber;t<=i.endLineNumber;t++){let o=a.tokenization.getLineTokens(t),n=t===i.startLineNumber,r=t===i.endLineNumber,s=n?o.findTokenIndexAtOffset(i.startColumn-1):0;for(;s<o.getCount()&&!(r&&o.getStartOffset(s)>i.endColumn-1);){if(!e(o.getStandardTokenType(s)))return!1;s++}}return!0}var wT=class{constructor(i,e,t){this.range=i;this.inlineClassName=e;this.type=t}},byt=class{constructor(i,e,t){this.context=i;this.model=e;this.coordinatesConverter=t;this._decorationsCache=Object.create(null)}getInlineDecorations(i){let e=new G(i,1,i,this.model.getLineMaxColumn(i)),t=this.coordinatesConverter.convertModelRangeToViewRange(e);return this.getDecorations(t,!1,!1).inlineDecorations}getDecorations(i,e,t){let o=this.context.getModelDecorations(i,e,t),n=i.startLineNumber,r=i.endLineNumber,s=[],l=0,c=[],u=[];for(let p=n;p<=r;p++)c[p-n]=[],u[p-n]=!1;for(let p=0,h=o.length;p<h;p++){let g=o[p],f=g.options;if(!B3e(this.model,g))continue;let v=this._getOrCreateViewModelDecoration(g),b=v.range;if(s[l++]=v,f.inlineClassName){let S=new wT(b,f.inlineClassName,f.inlineClassNameAffectsLetterSpacing?3:0),y=Math.max(n,b.startLineNumber),w=Math.min(r,b.endLineNumber);for(let x=y;x<=w;x++)c[x-n].push(S),f.affectsFont&&(u[x-n]=!0)}if(f.beforeContentClassName&&n<=b.startLineNumber&&b.startLineNumber<=r){let S=new wT(new G(b.startLineNumber,b.startColumn,b.startLineNumber,b.startColumn),f.beforeContentClassName,1);c[b.startLineNumber-n].push(S),f.affectsFont&&(u[b.startLineNumber-n]=!0)}if(f.afterContentClassName&&n<=b.endLineNumber&&b.endLineNumber<=r){let S=new wT(new G(b.endLineNumber,b.endColumn,b.endLineNumber,b.endColumn),f.afterContentClassName,2);c[b.endLineNumber-n].push(S),f.affectsFont&&(u[b.endLineNumber-n]=!0)}}return{decorations:s,inlineDecorations:c,hasVariableFonts:u}}reset(){this._decorationsCache=Object.create(null)}onModelDecorationsChanged(){this.reset()}onLineMappingChanged(){this.reset()}_getOrCreateViewModelDecoration(i){let e=i.id,t=this._decorationsCache[e];if(!t){let o=i.range,n=i.options,r;if(n.isWholeLine){let s=this.coordinatesConverter.convertModelPositionToViewPosition(new ye(o.startLineNumber,1),0,!1,!0),l=this.coordinatesConverter.convertModelPositionToViewPosition(new ye(o.endLineNumber,this.model.getLineMaxColumn(o.endLineNumber)),1);r=new G(s.lineNumber,s.column,l.lineNumber,l.column)}else r=this.coordinatesConverter.convertModelRangeToViewRange(o,1);t=new QCe(r,n),this._decorationsCache[e]=t}return t}},Syt=class{constructor(i){this.context=i}getInlineDecorations(i){let e=this.context.getInjectionOffsets(i);if(!e)return[];let t=[],o=0,n=0,r=this.context.getInjectionOptions(i),s=this.context.getBreakOffsets(i);for(let l=0;l<s.length;l++){let c=new Array;t[l]=c;let u=l>0?s[l-1]:0,p=s[l];for(;n<e.length;){let h=r[n].content.length,g=e[n]+o,f=g+h;if(g>p)break;if(u<f){let v=r[n];if(v.inlineClassName){let b=this.context.getWrappedTextIndentLength(i),S=l>0?b:0,y=S+Math.max(g-u,0),w=S+Math.min(f-u,p-u);if(y!==w){let x=this.context.getBaseViewLineNumber(i)+l,E=new G(x,y+1,x,w+1),M=v.inlineClassNameAffectsLetterSpacing?3:0;c.push(new wT(E,v.inlineClassName,M))}}}if(f<=p)o+=h,n++;else break}}return t}};var uf=class{constructor(i,e,t,o){this.endIndex=i;this.type=e;this.metadata=t;this.containsRTL=o;this._linePartBrand=void 0}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}};var Wb=class a{constructor(i,e,t,o){this.startColumn=i;this.endColumn=e;this.className=t;this.type=o;this._lineDecorationBrand=void 0}static _equals(i,e){return i.startColumn===e.startColumn&&i.endColumn===e.endColumn&&i.className===e.className&&i.type===e.type}static equalsArr(i,e){let t=i.length,o=e.length;if(t!==o)return!1;for(let n=0;n<t;n++)if(!a._equals(i[n],e[n]))return!1;return!0}static extractWrapped(i,e,t){if(i.length===0)return i;let o=e+1,n=t+1,r=t-e,s=[],l=0;for(let c of i)c.endColumn<=o||c.startColumn>=n||(s[l++]=new a(Math.max(1,c.startColumn-o+1),Math.min(r+1,c.endColumn-o+1),c.className,c.type));return s}static filter(i,e,t,o){if(i.length===0)return[];let n=[],r=0;for(let s=0,l=i.length;s<l;s++){let c=i[s],u=c.range;if(u.endLineNumber<e||u.startLineNumber>e||u.isEmpty()&&(c.type===0||c.type===3))continue;let p=u.startLineNumber===e?u.startColumn:t,h=u.endLineNumber===e?u.endColumn:o;n[r++]=new a(p,h,c.inlineClassName,c.type)}return n}static _typeCompare(i,e){let t=[2,0,1,3];return t[i]-t[e]}static compare(i,e){if(i.startColumn!==e.startColumn)return i.startColumn-e.startColumn;if(i.endColumn!==e.endColumn)return i.endColumn-e.endColumn;let t=a._typeCompare(i.type,e.type);return t!==0?t:i.className!==e.className?i.className<e.className?-1:1:0}},Iyt=class{constructor(i,e,t,o){this.startOffset=i,this.endOffset=e,this.className=t,this.metadata=o}},Ssi=class a{constructor(){this.stopOffsets=[],this.classNames=[],this.metadata=[],this.count=0}static _metadata(i){let e=0;for(let t=0,o=i.length;t<o;t++)e|=i[t];return e}consumeLowerThan(i,e,t){for(;this.count>0&&this.stopOffsets[0]<i;){let o=0;for(;o+1<this.count&&this.stopOffsets[o]===this.stopOffsets[o+1];)o++;t.push(new Iyt(e,this.stopOffsets[o],this.classNames.join(" "),a._metadata(this.metadata))),e=this.stopOffsets[o]+1,this.stopOffsets.splice(0,o+1),this.classNames.splice(0,o+1),this.metadata.splice(0,o+1),this.count-=o+1}return this.count>0&&e<i&&(t.push(new Iyt(e,i-1,this.classNames.join(" "),a._metadata(this.metadata))),e=i),e}insert(i,e,t){if(this.count===0||this.stopOffsets[this.count-1]<=i)this.stopOffsets.push(i),this.classNames.push(e),this.metadata.push(t);else for(let o=0;o<this.count;o++)if(this.stopOffsets[o]>=i){this.stopOffsets.splice(o,0,i),this.classNames.splice(o,0,e),this.metadata.splice(o,0,t);break}this.count++}},yyt=class{static normalize(i,e){if(e.length===0)return[];let t=[],o=new Ssi,n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r],c=l.startColumn,u=l.endColumn,p=l.className,h=l.type===1?2:l.type===2?4:0;if(c>1){let v=i.charCodeAt(c-2);Ip(v)&&c--}if(u>1){let v=i.charCodeAt(u-2);Ip(v)&&u--}let g=c-1,f=u-2;n=o.consumeLowerThan(g,n,t),o.count===0&&(n=g),o.insert(f,p,h)}return o.consumeLowerThan(1073741824,n,t),t}};var KL=class{get isLTR(){return!this.containsRTL&&this.textDirection!==1}constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M=!1){this.useMonospaceOptimizations=i,this.canUseHalfwidthRightwardsArrow=e,this.lineContent=t,this.continuesWithWrappedLine=o,this.isBasicASCII=n,this.containsRTL=r,this.fauxIndentLength=s,this.lineTokens=l,this.lineDecorations=c.sort(Wb.compare),this.tabSize=u,this.startVisibleColumn=p,this.spaceWidth=h,this.stopRenderingLineAfter=v,this.renderWhitespace=b==="all"?4:b==="boundary"?1:b==="selection"?2:b==="trailing"?3:0,this.renderControlCharacters=S,this.fontLigatures=y,this.selectionsOnLine=w&&w.sort((H,K)=>H.start<K.start?-1:1),this.renderNewLineWhenEmpty=M,this.textDirection=x,this.verticalScrollbarSize=E;let N=Math.abs(f-h),V=Math.abs(g-h);N<V?(this.renderSpaceWidth=f,this.renderSpaceCharCode=11825):(this.renderSpaceWidth=g,this.renderSpaceCharCode=183)}sameSelection(i){if(this.selectionsOnLine===null)return i===null;if(i===null||i.length!==this.selectionsOnLine.length)return!1;for(let e=0;e<this.selectionsOnLine.length;e++)if(!this.selectionsOnLine[e].equals(i[e]))return!1;return!0}equals(i){return this.useMonospaceOptimizations===i.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineContent===i.lineContent&&this.continuesWithWrappedLine===i.continuesWithWrappedLine&&this.isBasicASCII===i.isBasicASCII&&this.containsRTL===i.containsRTL&&this.fauxIndentLength===i.fauxIndentLength&&this.tabSize===i.tabSize&&this.startVisibleColumn===i.startVisibleColumn&&this.spaceWidth===i.spaceWidth&&this.renderSpaceWidth===i.renderSpaceWidth&&this.renderSpaceCharCode===i.renderSpaceCharCode&&this.stopRenderingLineAfter===i.stopRenderingLineAfter&&this.renderWhitespace===i.renderWhitespace&&this.renderControlCharacters===i.renderControlCharacters&&this.fontLigatures===i.fontLigatures&&Wb.equalsArr(this.lineDecorations,i.lineDecorations)&&this.lineTokens.equals(i.lineTokens)&&this.sameSelection(i.selectionsOnLine)&&this.textDirection===i.textDirection&&this.verticalScrollbarSize===i.verticalScrollbarSize&&this.renderNewLineWhenEmpty===i.renderNewLineWhenEmpty}};var H3e=class{constructor(i,e){this.partIndex=i;this.charIndex=e}},U3e=class a{static getPartIndex(i){return(i&4294901760)>>>16}static getCharIndex(i){return(i&65535)>>>0}constructor(i,e){this.length=i,this._data=new Uint32Array(this.length),this._horizontalOffset=new Uint32Array(this.length)}setColumnInfo(i,e,t,o){let n=(e<<16|t<<0)>>>0;this._data[i-1]=n,this._horizontalOffset[i-1]=o}getHorizontalOffset(i){return this._horizontalOffset.length===0?0:this._horizontalOffset[i-1]}charOffsetToPartData(i){return this.length===0?0:i<0?this._data[0]:i>=this.length?this._data[this.length-1]:this._data[i]}getDomPosition(i){let e=this.charOffsetToPartData(i-1),t=a.getPartIndex(e),o=a.getCharIndex(e);return new H3e(t,o)}getColumn(i,e){return this.partDataToCharOffset(i.partIndex,e,i.charIndex)+1}partDataToCharOffset(i,e,t){if(this.length===0)return 0;let o=(i<<16|t<<0)>>>0,n=0,r=this.length-1;for(;n+1<r;){let v=n+r>>>1,b=this._data[v];if(b===o)return v;b>o?r=v:n=v}if(n===r)return n;let s=this._data[n],l=this._data[r];if(s===o)return n;if(l===o)return r;let c=a.getPartIndex(s),u=a.getCharIndex(s),p=a.getPartIndex(l),h;c!==p?h=e:h=a.getCharIndex(l);let g=t-u,f=h-t;return g<=f?n:r}inflate(){let i=[];for(let e=0;e<this.length;e++){let t=this._data[e],o=a.getPartIndex(t),n=a.getCharIndex(t),r=this._horizontalOffset[e];i.push([o,n,r])}return i}};var Qce=class{constructor(i,e){this._renderLineOutputBrand=void 0;this.characterMapping=i,this.containsForeignElements=e}};function NB(a,i){if(a.lineContent.length===0){if(a.lineDecorations.length>0){i.appendString("<span>");let e=0,t=0,o=0;for(let r of a.lineDecorations)(r.type===1||r.type===2)&&(i.appendString('<span class="'),i.appendString(r.className),i.appendString('"></span>'),r.type===1&&(o|=1,e++),r.type===2&&(o|=2,t++));i.appendString("</span>");let n=new U3e(1,e+t);return n.setColumnInfo(1,e,0,0),new Qce(n,o)}return a.renderNewLineWhenEmpty?i.appendString(`<span><span>
</span></span>`):i.appendString("<span><span></span></span>"),new Qce(new U3e(0,0),0)}return uGo(nGo(a),i)}var Isi=class{constructor(i,e,t){this.characterMapping=i;this.html=e;this.containsForeignElements=t}};function oYi(a){let i=new EI(1e4),e=NB(a,i);return new Isi(e.characterMapping,i.build(),e.containsForeignElements)}var ysi=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){this.fontIsMonospace=i;this.canUseHalfwidthRightwardsArrow=e;this.lineContent=t;this.len=o;this.isOverflowing=n;this.overflowingCharCount=r;this.parts=s;this.containsForeignElements=l;this.fauxIndentLength=c;this.tabSize=u;this.startVisibleColumn=p;this.spaceWidth=h;this.renderSpaceCharCode=g;this.renderWhitespace=f;this.renderControlCharacters=v}};function nGo(a){let i=a.lineContent,e,t,o;a.stopRenderingLineAfter!==-1&&a.stopRenderingLineAfter<i.length?(e=!0,t=i.length-a.stopRenderingLineAfter,o=a.stopRenderingLineAfter):(e=!1,t=0,o=i.length);let n=rGo(i,a.containsRTL,a.lineTokens,a.fauxIndentLength,o);a.renderControlCharacters&&!a.isBasicASCII&&(n=lGo(i,n)),(a.renderWhitespace===4||a.renderWhitespace===1||a.renderWhitespace===2&&a.selectionsOnLine||a.renderWhitespace===3&&!a.continuesWithWrappedLine)&&(n=cGo(a,i,o,n));let r=0;if(a.lineDecorations.length>0){for(let s=0,l=a.lineDecorations.length;s<l;s++){let c=a.lineDecorations[s];c.type===3||c.type===1?r|=1:c.type===2&&(r|=2)}n=dGo(i,o,n,a.lineDecorations)}return a.containsRTL?n=aGo(i,n):n=sGo(i,n,!a.isBasicASCII||a.fontLigatures),new ysi(a.useMonospaceOptimizations,a.canUseHalfwidthRightwardsArrow,i,o,e,t,n,r,a.fauxIndentLength,a.tabSize,a.startVisibleColumn,a.spaceWidth,a.renderSpaceCharCode,a.renderWhitespace,a.renderControlCharacters)}function rGo(a,i,e,t,o){let n=[],r=0;t>0&&(n[r++]=new uf(t,"",0,!1));let s=t;for(let l=0,c=e.getCount();l<c;l++){let u=e.getEndOffset(l);if(u<=t)continue;let p=e.getClassName(l);if(u>=o){let g=i?mA(a.substring(s,o)):!1;n[r++]=new uf(o,p,0,g);break}let h=i?mA(a.substring(s,u)):!1;n[r++]=new uf(u,p,0,h),s=u}return n}function sGo(a,i,e){let t=0,o=[],n=0;if(e)for(let r=0,s=i.length;r<s;r++){let l=i[r],c=l.endIndex;if(t+50<c){let u=l.type,p=l.metadata,h=l.containsRTL,g=-1,f=t;for(let v=t;v<c;v++)a.charCodeAt(v)===32&&(g=v),g!==-1&&v-f>=50&&(o[n++]=new uf(g+1,u,p,h),f=g+1,g=-1);f!==c&&(o[n++]=new uf(c,u,p,h))}else o[n++]=l;t=c}else for(let r=0,s=i.length;r<s;r++){let l=i[r],c=l.endIndex,u=c-t;if(u>50){let p=l.type,h=l.metadata,g=l.containsRTL,f=Math.ceil(u/50);for(let v=1;v<f;v++){let b=t+v*50;o[n++]=new uf(b,p,h,g)}o[n++]=new uf(c,p,h,g)}else o[n++]=l;t=c}return o}function aGo(a,i){if(i.length===0)return i;let e=i[0];if(!e.containsRTL)return i;let t=e.endIndex,o=0;for(let r=0;r<t;r++){let s=a.charCodeAt(r);if(s!==32&&s!==9){o=r;break}}if(o===0)return i;let n=[];n.push(new uf(o,e.type,e.metadata,!1)),n.push(new uf(t,e.type,e.metadata,e.containsRTL));for(let r=1;r<i.length;r++)n.push(i[r]);return n}function nYi(a){return a<32?a!==9:a===127||a>=8234&&a<=8238||a>=8294&&a<=8297||a>=8206&&a<=8207||a===1564}function lGo(a,i){let e=[],t=new uf(0,"",0,!1),o=0;for(let n of i){let r=n.endIndex;for(;o<r;o++){let s=a.charCodeAt(o);nYi(s)&&(o>t.endIndex&&(t=new uf(o,n.type,n.metadata,n.containsRTL),e.push(t)),t=new uf(o+1,"mtkcontrol",n.metadata,!1),e.push(t))}o>t.endIndex&&(t=new uf(r,n.type,n.metadata,n.containsRTL),e.push(t))}return e}function cGo(a,i,e,t){let o=a.continuesWithWrappedLine,n=a.fauxIndentLength,r=a.tabSize,s=a.startVisibleColumn,l=a.useMonospaceOptimizations,c=a.selectionsOnLine,u=a.renderWhitespace===1,p=a.renderWhitespace===3,h=a.renderSpaceWidth!==a.spaceWidth,g=[],f=0,v=0,b=t[v].type,S=t[v].containsRTL,y=t[v].endIndex,w=t.length,x=!1,E=Em(i),M;E===-1?(x=!0,E=e,M=e):M=Bv(i);let N=!1,V=0,H=c&&c[V],K=s%r;for(let J=n;J<e;J++){let se=i.charCodeAt(J);H&&H.endExclusive<=J&&(V++,H=c&&c[V]);let ae;if(J<E||J>M)ae=!0;else if(se===9)ae=!0;else if(se===32)if(u)if(N)ae=!0;else{let ce=J+1<e?i.charCodeAt(J+1):0;ae=ce===32||ce===9}else ae=!0;else ae=!1;if(ae&&c&&(ae=!!H&&H.start<=J&&J<H.endExclusive),ae&&p&&(ae=x||J>M),ae&&S&&J>=E&&J<=M&&(ae=!1),N){if(!ae||!l&&K>=r){if(h){let ce=f>0?g[f-1].endIndex:n;for(let Se=ce+1;Se<=J;Se++)g[f++]=new uf(Se,"mtkw",1,!1)}else g[f++]=new uf(J,"mtkw",1,!1);K=K%r}}else(J===y||ae&&J>n)&&(g[f++]=new uf(J,b,0,S),K=K%r);for(se===9?K=r:sD(se)?K+=2:K++,N=ae;J===y&&(v++,v<w);)b=t[v].type,S=t[v].containsRTL,y=t[v].endIndex}let j=!1;if(N)if(o&&u){let J=e>0?i.charCodeAt(e-1):0,se=e>1?i.charCodeAt(e-2):0;J===32&&se!==32&&se!==9||(j=!0)}else j=!0;if(j)if(h){let J=f>0?g[f-1].endIndex:n;for(let se=J+1;se<=e;se++)g[f++]=new uf(se,"mtkw",1,!1)}else g[f++]=new uf(e,"mtkw",1,!1);else g[f++]=new uf(e,b,0,S);return g}function dGo(a,i,e,t){t.sort(Wb.compare);let o=yyt.normalize(a,t),n=o.length,r=0,s=[],l=0,c=0;for(let p=0,h=e.length;p<h;p++){let g=e[p],f=g.endIndex,v=g.type,b=g.metadata,S=g.containsRTL;for(;r<n&&o[r].startOffset<f;){let y=o[r];if(y.startOffset>c&&(c=y.startOffset,s[l++]=new uf(c,v,b,S)),y.endOffset+1<=f)c=y.endOffset+1,s[l++]=new uf(c,v+" "+y.className,b|y.metadata,S),r++;else{c=f,s[l++]=new uf(c,v+" "+y.className,b|y.metadata,S);break}}f>c&&(c=f,s[l++]=new uf(c,v,b,S))}let u=e[e.length-1].endIndex;if(r<n&&o[r].startOffset===u)for(;r<n&&o[r].startOffset===u;){let p=o[r];s[l++]=new uf(c,p.className,p.metadata,!1),r++}return s}function uGo(a,i){let e=a.fontIsMonospace,t=a.canUseHalfwidthRightwardsArrow,o=a.containsForeignElements,n=a.lineContent,r=a.len,s=a.isOverflowing,l=a.overflowingCharCount,c=a.parts,u=a.fauxIndentLength,p=a.tabSize,h=a.startVisibleColumn,g=a.spaceWidth,f=a.renderSpaceCharCode,v=a.renderWhitespace,b=a.renderControlCharacters,S=new U3e(r+1,c.length),y=!1,w=0,x=h,E=0,M=0,N=0;i.appendString("<span>");for(let V=0,H=c.length;V<H;V++){let K=c[V],j=K.endIndex,J=K.type,se=K.containsRTL,ae=v!==0&&K.isWhitespace(),ce=ae&&!e&&(J==="mtkw"||!o),Se=w===j&&K.isPseudoAfter();if(E=0,i.appendString("<span "),se&&i.appendString('style="unicode-bidi:isolate" '),i.appendString('class="'),i.appendString(ce?"mtkz":J),i.appendASCIICharCode(34),ae){let Re=0;{let xe=w,He=x;for(;xe<j;xe++){let Te=(n.charCodeAt(xe)===9?p-He%p:1)|0;Re+=Te,xe>=u&&(He+=Te)}}for(ce&&(i.appendString(' style="width:'),i.appendString(String(g*Re)),i.appendString('px"')),i.appendASCIICharCode(62);w<j;w++){S.setColumnInfo(w+1,V-N,E,M),N=0;let xe=n.charCodeAt(w),He,Ee;if(xe===9){He=p-x%p|0,Ee=He,!t||Ee>1?i.appendCharCode(8594):i.appendCharCode(65515);for(let Te=2;Te<=Ee;Te++)i.appendCharCode(160)}else He=2,Ee=1,i.appendCharCode(f),i.appendCharCode(8204);E+=He,M+=Ee,w>=u&&(x+=Ee)}}else for(i.appendASCIICharCode(62);w<j;w++){S.setColumnInfo(w+1,V-N,E,M),N=0;let Re=n.charCodeAt(w),xe=1,He=1;switch(Re){case 9:xe=p-x%p,He=xe;for(let Ee=1;Ee<=xe;Ee++)i.appendCharCode(160);break;case 32:i.appendCharCode(160);break;case 60:i.appendString("&lt;");break;case 62:i.appendString("&gt;");break;case 38:i.appendString("&amp;");break;case 0:b?i.appendCharCode(9216):i.appendString("&#00;");break;case 65279:case 8232:case 8233:case 133:i.appendCharCode(65533);break;default:sD(Re)&&He++,b&&Re<32?i.appendCharCode(9216+Re):b&&Re===127?i.appendCharCode(9249):b&&nYi(Re)?(i.appendString("[U+"),i.appendString(pGo(Re)),i.appendString("]"),xe=8,He=xe):i.appendCharCode(Re)}E+=xe,M+=He,w>=u&&(x+=He)}Se?N++:N=0,w>=r&&!y&&K.isPseudoAfter()&&(y=!0,S.setColumnInfo(w+1,V,E,M)),i.appendString("</span>")}return y||S.setColumnInfo(r+1,c.length-1,E,M),s&&(i.appendString('<span class="mtkoverflow">'),i.appendString(d(973,null,mGo(l))),i.appendString("</span>")),i.appendString("</span>"),new Qce(S,o)}function pGo(a){return a.toString(16).toUpperCase().padStart(4,"0")}function mGo(a){return a<1024?d(972,null,a):a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/1024/1024).toFixed(1)} MB`}function Uf(a){return a==="hcDark"||a==="hcLight"}function cm(a){return a==="dark"||a==="hcDark"}var hGo=(function(){return Qr?!0:!(Sn||ed||_S)})(),XCe=!0,OB=class a{constructor(i,e){this._viewGpuContext=i;this._options=e,this._isMaybeInvalid=!0,this._renderedViewLine=null}static{this.CLASS_NAME="view-line"}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(i){if(this._renderedViewLine)this._renderedViewLine.domNode=Ir(i);else throw new Error("I have no rendered view line to set the dom node to...")}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(i){this._isMaybeInvalid=!0,this._options=i}onSelectionChanged(){return Uf(this._options.themeType)||this._renderedViewLine?.input.renderWhitespace===2?(this._isMaybeInvalid=!0,!0):!1}renderLine(i,e,t,o,n){if(this._options.useGpu&&this._viewGpuContext?.canRender(this._options,o,i))return this._renderedViewLine?.domNode?.domNode.remove(),this._renderedViewLine=null,!1;if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;let r=o.getViewLineRenderingData(i),s=this._options,l=Wb.filter(r.inlineDecorations,i,r.minColumn,r.maxColumn),c=s.experimentalWhitespaceRendering==="off"?s.renderWhitespace:"none",u=!r.hasVariableFonts,p=null;if(Uf(s.themeType)||c==="selection"){let v=o.selections;for(let b of v){if(b.endLineNumber<i||b.startLineNumber>i)continue;let S=b.startLineNumber===i?b.startColumn:r.minColumn,y=b.endLineNumber===i?b.endColumn:r.maxColumn;S<y&&(Uf(s.themeType)&&l.push(new Wb(S,y,"inline-selected-text",0)),c==="selection"&&(p||(p=[]),p.push(new gi(S-1,y-1))))}}let h=new KL(s.useMonospaceOptimizations,s.canUseHalfwidthRightwardsArrow,r.content,r.continuesWithWrappedLine,r.isBasicASCII,r.containsRTL,r.minColumn-1,r.tokens,l,r.tabSize,r.startVisibleColumn,s.spaceWidth,s.middotWidth,s.wsmiddotWidth,s.stopRenderingLineAfter,c,s.renderControlCharacters,s.fontLigatures!==Mk.OFF,p,r.textDirection,s.verticalScrollbarSize);if(this._renderedViewLine&&this._renderedViewLine.input.equals(h))return!1;n.appendString("<div "),r.textDirection===1?n.appendString('dir="rtl" '):r.containsRTL&&n.appendString('dir="ltr" '),n.appendString('style="top:'),n.appendString(String(e)),n.appendString("px;height:"),n.appendString(String(t)),n.appendString("px;line-height:"),n.appendString(String(t)),r.textDirection===1&&(n.appendString("px;padding-right:"),n.appendString(String(s.verticalScrollbarSize))),n.appendString('px;" class="'),n.appendString(a.CLASS_NAME),n.appendString('">');let g=NB(h,n);n.appendString("</div>");let f=null;return u&&XCe&&hGo&&r.isBasicASCII&&h.isLTR&&s.useMonospaceOptimizations&&g.containsForeignElements===0&&(f=new YCe(this._renderedViewLine?this._renderedViewLine.domNode:null,h,g.characterMapping)),f||(f=rYi(this._renderedViewLine?this._renderedViewLine.domNode:null,h,g.characterMapping,g.containsForeignElements)),this._renderedViewLine=f,!0}layoutLine(i,e,t){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(e),this._renderedViewLine.domNode.setHeight(t),this._renderedViewLine.domNode.setLineHeight(t))}isRenderedRTL(){return this._renderedViewLine?this._renderedViewLine.input.textDirection===1:!1}getWidth(i){return this._renderedViewLine?this._renderedViewLine.getWidth(i):0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof YCe:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof YCe?this._renderedViewLine.monospaceAssumptionsAreValid():XCe}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof YCe&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(i,e,t,o){if(!this._renderedViewLine)return null;e=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,e)),t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t));let n=this._renderedViewLine.input.stopRenderingLineAfter;if(n!==-1&&e>n+1&&t>n+1)return new $ce(!0,[new _A(this.getWidth(o),0)]);n!==-1&&e>n+1&&(e=n+1),n!==-1&&t>n+1&&(t=n+1);let r=this._renderedViewLine.getVisibleRangesForRange(i,e,t,o);return r&&r.length>0?new $ce(!1,r):null}getColumnOfNodeOffset(i,e){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(i,e):1}resetCachedWidth(){this._renderedViewLine?.resetCachedWidth()}};var YCe=class{constructor(i,e,t){this._cachedWidth=-1;this.domNode=i,this.input=e;let o=Math.floor(e.lineContent.length/300);if(o>0){this._keyColumnPixelOffsetCache=new Float32Array(o);for(let n=0;n<o;n++)this._keyColumnPixelOffsetCache[n]=-1}else this._keyColumnPixelOffsetCache=null;this._characterMapping=t,this._charWidth=e.spaceWidth}getWidth(i){if(!this.domNode||this.input.lineContent.length<300){let e=this._characterMapping.getHorizontalOffset(this._characterMapping.length);return Math.round(this._charWidth*e)}return this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,i?.markDidDomLayout()),this._cachedWidth}getWidthIsFast(){return this.input.lineContent.length<300||this._cachedWidth!==-1}resetCachedWidth(){this._cachedWidth=-1}monospaceAssumptionsAreValid(){if(!this.domNode)return XCe;if(this.input.lineContent.length<300){let i=this.getWidth(null),e=this.domNode.domNode.firstChild.offsetWidth;Math.abs(i-e)>=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),XCe=!1)}return XCe}toSlowRenderedLine(){return rYi(this.domNode,this.input,this._characterMapping,0)}getVisibleRangesForRange(i,e,t,o){let n=this._getColumnPixelOffset(i,e,o),r=this._getColumnPixelOffset(i,t,o);return[new _A(n,r-n)]}_getColumnPixelOffset(i,e,t){if(e<=300){let c=this._characterMapping.getHorizontalOffset(e);return this._charWidth*c}let o=Math.floor((e-1)/300)-1,n=(o+1)*300+1,r=-1;if(this._keyColumnPixelOffsetCache&&(r=this._keyColumnPixelOffsetCache[o],r===-1&&(r=this._actualReadPixelOffset(i,n,t),this._keyColumnPixelOffsetCache[o]=r)),r===-1){let c=this._characterMapping.getHorizontalOffset(e);return this._charWidth*c}let s=this._characterMapping.getHorizontalOffset(n),l=this._characterMapping.getHorizontalOffset(e);return r+this._charWidth*(l-s)}_getReadingTarget(i){return i.domNode.firstChild}_actualReadPixelOffset(i,e,t){if(!this.domNode)return-1;let o=this._characterMapping.getDomPosition(e),n=jce.readHorizontalRanges(this._getReadingTarget(this.domNode),o.partIndex,o.charIndex,o.partIndex,o.charIndex,t);return!n||n.length===0?-1:n[0].left}getColumnOfNodeOffset(i,e){return L5(this._characterMapping,i,e)}},wyt=class{constructor(i,e,t,o){if(this.domNode=i,this.input=e,this._characterMapping=t,this._isWhitespaceOnly=/^\s*$/.test(e.lineContent),this._containsForeignElements=o,this._cachedWidth=-1,this._pixelOffsetCache=null,e.isLTR){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let n=0,r=this._characterMapping.length;n<=r;n++)this._pixelOffsetCache[n]=-1}}_getReadingTarget(i){return i.domNode.firstChild}getWidth(i){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,i?.markDidDomLayout()),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}resetCachedWidth(){if(this._cachedWidth=-1,this._pixelOffsetCache!==null)for(let i=0,e=this._pixelOffsetCache.length;i<e;i++)this._pixelOffsetCache[i]=-1}getVisibleRangesForRange(i,e,t,o){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){let n=this._readPixelOffset(this.domNode,i,e,o);if(n===-1)return null;let r=this._readPixelOffset(this.domNode,i,t,o);return r===-1?null:[new _A(n,r-n)]}return this._readVisibleRangesForRange(this.domNode,i,e,t,o)}_readVisibleRangesForRange(i,e,t,o,n){if(t===o){let r=this._readPixelOffset(i,e,t,n);return r===-1?null:[new _A(r,0)]}else return this._readRawVisibleRangesForRange(i,t,o,n)}_readPixelOffset(i,e,t,o){if(this.input.isLTR&&this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth(o);let n=this._getReadingTarget(i);return n.firstChild?(o.markDidDomLayout(),n.firstChild.offsetWidth):0}if(this._pixelOffsetCache!==null){let n=this._pixelOffsetCache[t];if(n!==-1)return n;let r=this._actualReadPixelOffset(i,e,t,o);return this._pixelOffsetCache[t]=r,r}return this._actualReadPixelOffset(i,e,t,o)}_actualReadPixelOffset(i,e,t,o){if(this._characterMapping.length===0){let l=jce.readHorizontalRanges(this._getReadingTarget(i),0,0,0,0,o);return!l||l.length===0?-1:l[0].left}if(this.input.isLTR&&t===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth(o);let n=this._characterMapping.getDomPosition(t),r=jce.readHorizontalRanges(this._getReadingTarget(i),n.partIndex,n.charIndex,n.partIndex,n.charIndex,o);if(!r||r.length===0)return-1;let s=r[0].left;if(this.input.isBasicASCII){let l=this._characterMapping.getHorizontalOffset(t),c=Math.round(this.input.spaceWidth*l);if(Math.abs(c-s)<=1)return c}return s}_readRawVisibleRangesForRange(i,e,t,o){if(this.input.isLTR&&e===1&&t===this._characterMapping.length)return[new _A(0,this.getWidth(o))];let n=this._characterMapping.getDomPosition(e),r=this._characterMapping.getDomPosition(t);return jce.readHorizontalRanges(this._getReadingTarget(i),n.partIndex,n.charIndex,r.partIndex,r.charIndex,o)}getColumnOfNodeOffset(i,e){return L5(this._characterMapping,i,e)}},wsi=class extends wyt{_readVisibleRangesForRange(i,e,t,o,n){let r=super._readVisibleRangesForRange(i,e,t,o,n);if(!r||r.length===0||t===o||t===1&&o===this._characterMapping.length)return r;if(this.input.isLTR){let s=this._readPixelOffset(i,e,o,n);if(s!==-1){let l=r[r.length-1];l.left<s&&(l.width=s-l.left)}}return r}},rYi=(function(){return dB?gGo:fGo})();function gGo(a,i,e,t){return new wsi(a,i,e,t)}function fGo(a,i,e,t){return new wyt(a,i,e,t)}function L5(a,i,e){let t=i.textContent.length,o=-1;for(;i;)i=i.previousSibling,o++;return a.getColumn(new H3e(o,e),t)}var rK=class{constructor(i=null){this.hitTarget=i;this.type=0}},Cyt=class{constructor(i,e,t){this.position=i;this.spanNode=e;this.injectedText=t;this.type=1}get hitTarget(){return this.spanNode}},JCe;(i=>{function a(e,t,o){let n=e.getPositionFromDOMInfo(t,o);return n?new Cyt(n,t,null):new rK(t)}i.createFromDOMInfo=a})(JCe||={});var xyt=class{constructor(i,e){this.lastViewCursorsRenderData=i;this.lastTextareaPosition=e}},jv=class{static _deduceRage(i,e=null){return!e&&i?new G(i.lineNumber,i.column,i.lineNumber,i.column):e??null}static createUnknown(i,e,t){return{type:0,element:i,mouseColumn:e,position:t,range:this._deduceRage(t)}}static createTextarea(i,e){return{type:1,element:i,mouseColumn:e,position:null,range:null}}static createMargin(i,e,t,o,n,r){return{type:i,element:e,mouseColumn:t,position:o,range:n,detail:r}}static createViewZone(i,e,t,o,n){return{type:i,element:e,mouseColumn:t,position:o,range:this._deduceRage(o),detail:n}}static createContentText(i,e,t,o,n){return{type:6,element:i,mouseColumn:e,position:t,range:this._deduceRage(t,o),detail:n}}static createContentEmpty(i,e,t,o){return{type:7,element:i,mouseColumn:e,position:t,range:this._deduceRage(t),detail:o}}static createContentWidget(i,e,t){return{type:9,element:i,mouseColumn:e,position:null,range:null,detail:t}}static createScrollbar(i,e,t){return{type:11,element:i,mouseColumn:e,position:t,range:this._deduceRage(t)}}static createOverlayWidget(i,e,t){return{type:12,element:i,mouseColumn:e,position:null,range:null,detail:t}}static createOutsideEditor(i,e,t,o){return{type:13,element:null,mouseColumn:i,position:e,range:this._deduceRage(e),outsidePosition:t,outsideDistance:o}}static _typeToString(i){return i===1?"TEXTAREA":i===2?"GUTTER_GLYPH_MARGIN":i===3?"GUTTER_LINE_NUMBERS":i===4?"GUTTER_LINE_DECORATIONS":i===5?"GUTTER_VIEW_ZONE":i===6?"CONTENT_TEXT":i===7?"CONTENT_EMPTY":i===8?"CONTENT_VIEW_ZONE":i===9?"CONTENT_WIDGET":i===10?"OVERVIEW_RULER":i===11?"SCROLLBAR":i===12?"OVERLAY_WIDGET":"UNKNOWN"}static toString(i){return this._typeToString(i.type)+": "+i.position+" - "+i.range+" - "+JSON.stringify(i.detail)}},Gw=class{static isTextArea(i){return i.length===2&&i[0]===3&&i[1]===7}static isChildOfViewLines(i){return i.length>=4&&i[0]===3&&i[3]===8}static isStrictChildOfViewLines(i){return i.length>4&&i[0]===3&&i[3]===8}static isChildOfScrollableElement(i){return i.length>=2&&i[0]===3&&i[1]===6}static isChildOfMinimap(i){return i.length>=2&&i[0]===3&&i[1]===9}static isChildOfContentWidgets(i){return i.length>=4&&i[0]===3&&i[3]===1}static isChildOfOverflowGuard(i){return i.length>=1&&i[0]===3}static isChildOfOverflowingContentWidgets(i){return i.length>=1&&i[0]===2}static isChildOfOverlayWidgets(i){return i.length>=2&&i[0]===3&&i[1]===4}static isChildOfOverflowingOverlayWidgets(i){return i.length>=1&&i[0]===5}},ZCe=class a{constructor(i,e,t){this.viewModel=i.viewModel;let o=i.configuration.options;this.layoutInfo=o.get(165),this.viewDomNode=e.viewDomNode,this.viewLinesGpu=e.viewLinesGpu,this.lineHeight=o.get(75),this.stickyTabStops=o.get(132),this.typicalHalfwidthCharacterWidth=o.get(59).typicalHalfwidthCharacterWidth,this.lastRenderData=t,this._context=i,this._viewHelper=e}getZoneAtCoord(i){return a.getZoneAtCoord(this._context,i)}static getZoneAtCoord(i,e){let t=i.viewLayout.getWhitespaceAtVerticalOffset(e);if(t){let o=t.verticalOffset+t.height/2,n=i.viewModel.getLineCount(),r=null,s,l=null;return t.afterLineNumber!==n&&(l=new ye(t.afterLineNumber+1,1)),t.afterLineNumber>0&&(r=new ye(t.afterLineNumber,i.viewModel.getLineMaxColumn(t.afterLineNumber))),l===null?s=r:r===null?s=l:e<o?s=r:s=l,{viewZoneId:t.id,afterLineNumber:t.afterLineNumber,positionBefore:r,positionAfter:l,position:s}}return null}getFullLineRangeAtCoord(i){if(this._context.viewLayout.isAfterLines(i)){let o=this._context.viewModel.getLineCount(),n=this._context.viewModel.getLineMaxColumn(o);return{range:new G(o,n,o,n),isAfterLines:!0}}let e=this._context.viewLayout.getLineNumberAtVerticalOffset(i),t=this._context.viewModel.getLineMaxColumn(e);return{range:new G(e,1,e,t),isAfterLines:!1}}getLineNumberAtVerticalOffset(i){return this._context.viewLayout.getLineNumberAtVerticalOffset(i)}isAfterLines(i){return this._context.viewLayout.isAfterLines(i)}isInTopPadding(i){return this._context.viewLayout.isInTopPadding(i)}isInBottomPadding(i){return this._context.viewLayout.isInBottomPadding(i)}getVerticalOffsetForLineNumber(i){return this._context.viewLayout.getVerticalOffsetForLineNumber(i)}findAttribute(i,e){return a._findAttribute(i,e,this._viewHelper.viewDomNode)}static _findAttribute(i,e,t){for(;i&&i!==i.ownerDocument.body;){if(i.hasAttribute&&i.hasAttribute(e))return i.getAttribute(e);if(i===t)return null;i=i.parentNode}return null}getLineWidth(i){return this._viewHelper.getLineWidth(i)}isRtl(i){return this.viewModel.getTextDirection(i)===1}visibleRangeForPosition(i,e){return this._viewHelper.visibleRangeForPosition(i,e)}getPositionFromDOMInfo(i,e){return this._viewHelper.getPositionFromDOMInfo(i,e)}getCurrentScrollTop(){return this._context.viewLayout.getCurrentScrollTop()}getCurrentScrollLeft(){return this._context.viewLayout.getCurrentScrollLeft()}},Csi=class{constructor(i,e,t,o){this.editorPos=e,this.pos=t,this.relativePos=o,this.mouseVerticalOffset=Math.max(0,i.getCurrentScrollTop()+this.relativePos.y),this.mouseContentHorizontalOffset=i.getCurrentScrollLeft()+this.relativePos.x-i.layoutInfo.contentLeft,this.isInMarginArea=this.relativePos.x<i.layoutInfo.contentLeft&&this.relativePos.x>=i.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,exe._getMouseColumn(this.mouseContentHorizontalOffset,i.typicalHalfwidthCharacterWidth))}},xsi=class extends Csi{constructor(e,t,o,n,r){super(e,t,o,n);this.hitTestResult=new uo(()=>exe.doHitTest(this._ctx,this));this._targetPathCacheElement=null;this._targetPathCacheValue=new Uint8Array(0);this._ctx=e,this._eventTarget=r;let s=!!this._eventTarget;this._useHitTestTarget=!s}get target(){return this._useHitTestTarget?this.hitTestResult.value.hitTarget:this._eventTarget}get targetPath(){return this._targetPathCacheElement!==this.target&&(this._targetPathCacheElement=this.target,this._targetPathCacheValue=MI.collect(this.target,this._ctx.viewDomNode)),this._targetPathCacheValue}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}
	target: ${this.target?this.target.outerHTML:null}`}get wouldBenefitFromHitTestTargetSwitch(){return!this._useHitTestTarget&&this.hitTestResult.value.hitTarget!==null&&this.target!==this.hitTestResult.value.hitTarget}switchToHitTestTarget(){this._useHitTestTarget=!0}_getMouseColumn(e=null){return e&&e.column<this._ctx.viewModel.getLineMaxColumn(e.lineNumber)?Ll.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(e.lineNumber),e.column,this._ctx.viewModel.model.getOptions().tabSize)+1:this.mouseColumn}fulfillUnknown(e=null){return jv.createUnknown(this.target,this._getMouseColumn(e),e)}fulfillTextarea(){return jv.createTextarea(this.target,this._getMouseColumn())}fulfillMargin(e,t,o,n){return jv.createMargin(e,this.target,this._getMouseColumn(t),t,o,n)}fulfillViewZone(e,t,o){return jv.createViewZone(e,this.target,this._getMouseColumn(),t,o)}fulfillContentText(e,t,o){return jv.createContentText(this.target,this._getMouseColumn(e),e,t,o)}fulfillContentEmpty(e,t){return jv.createContentEmpty(this.target,this._getMouseColumn(e),e,t)}fulfillContentWidget(e){return jv.createContentWidget(this.target,this._getMouseColumn(),e)}fulfillScrollbar(e){return jv.createScrollbar(this.target,this._getMouseColumn(e),e)}fulfillOverlayWidget(e){return jv.createOverlayWidget(this.target,this._getMouseColumn(),e)}},sYi={isAfterLines:!0};function Yce(a){return{isAfterLines:!1,horizontalDistanceToText:a}}var exe=class a{constructor(i,e){this._context=i,this._viewHelper=e}mouseTargetIsWidget(i){let e=i.target,t=MI.collect(e,this._viewHelper.viewDomNode);return!!(Gw.isChildOfContentWidgets(t)||Gw.isChildOfOverflowingContentWidgets(t)||Gw.isChildOfOverlayWidgets(t)||Gw.isChildOfOverflowingOverlayWidgets(t))}createMouseTarget(i,e,t,o,n){let r=new ZCe(this._context,this._viewHelper,i),s=new xsi(r,e,t,o,n);try{let l=a._createMouseTarget(r,s);if(l.type===6&&r.stickyTabStops&&l.position!==null){let c=a._snapToSoftTabBoundary(l.position,r.viewModel),u=G.fromPositions(c,c).plusRange(l.range);return s.fulfillContentText(c,u,l.detail)}return l}catch{return s.fulfillUnknown()}}static _createMouseTarget(i,e){if(e.target===null)return e.fulfillUnknown();let t=e,o=null;return!Gw.isChildOfOverflowGuard(e.targetPath)&&!Gw.isChildOfOverflowingContentWidgets(e.targetPath)&&!Gw.isChildOfOverflowingOverlayWidgets(e.targetPath)&&(o=o||e.fulfillUnknown()),o=o||a._hitTestContentWidget(i,t),o=o||a._hitTestOverlayWidget(i,t),o=o||a._hitTestMinimap(i,t),o=o||a._hitTestScrollbarSlider(i,t),o=o||a._hitTestViewZone(i,t),o=o||a._hitTestMargin(i,t),o=o||a._hitTestViewCursor(i,t),o=o||a._hitTestTextArea(i,t),o=o||a._hitTestViewLines(i,t),o=o||a._hitTestScrollbar(i,t),o||e.fulfillUnknown()}static _hitTestContentWidget(i,e){if(Gw.isChildOfContentWidgets(e.targetPath)||Gw.isChildOfOverflowingContentWidgets(e.targetPath)){let t=i.findAttribute(e.target,"widgetId");return t?e.fulfillContentWidget(t):e.fulfillUnknown()}return null}static _hitTestOverlayWidget(i,e){if(Gw.isChildOfOverlayWidgets(e.targetPath)||Gw.isChildOfOverflowingOverlayWidgets(e.targetPath)){let t=i.findAttribute(e.target,"widgetId");return t?e.fulfillOverlayWidget(t):e.fulfillUnknown()}return null}static _hitTestViewCursor(i,e){if(e.target){let t=i.lastRenderData.lastViewCursorsRenderData;for(let o of t)if(e.target===o.domNode)return e.fulfillContentText(o.position,null,{mightBeForeignElement:!1,injectedText:null})}if(e.isInContentArea){let t=i.lastRenderData.lastViewCursorsRenderData,o=e.mouseContentHorizontalOffset,n=e.mouseVerticalOffset;for(let r of t){if(o<r.contentLeft||o>r.contentLeft+r.width)continue;let s=i.getVerticalOffsetForLineNumber(r.position.lineNumber);if(s<=n&&n<=s+r.height)return e.fulfillContentText(r.position,null,{mightBeForeignElement:!1,injectedText:null})}}return null}static _hitTestViewZone(i,e){let t=i.getZoneAtCoord(e.mouseVerticalOffset);if(t){let o=e.isInContentArea?8:5;return e.fulfillViewZone(o,t.position,t)}return null}static _hitTestTextArea(i,e){return Gw.isTextArea(e.targetPath)?i.lastRenderData.lastTextareaPosition?e.fulfillContentText(i.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1,injectedText:null}):e.fulfillTextarea():null}static _hitTestMargin(i,e){if(e.isInMarginArea){let t=i.getFullLineRangeAtCoord(e.mouseVerticalOffset),o=t.range.getStartPosition(),n=Math.abs(e.relativePos.x),r={isAfterLines:t.isAfterLines,glyphMarginLeft:i.layoutInfo.glyphMarginLeft,glyphMarginWidth:i.layoutInfo.glyphMarginWidth,lineNumbersWidth:i.layoutInfo.lineNumbersWidth,offsetX:n};if(n-=i.layoutInfo.glyphMarginLeft,n<=i.layoutInfo.glyphMarginWidth){let s=i.viewModel.coordinatesConverter.convertViewPositionToModelPosition(t.range.getStartPosition()),l=i.viewModel.glyphLanes.getLanesAtLine(s.lineNumber);return r.glyphMarginLane=l[Math.floor(n/i.lineHeight)],e.fulfillMargin(2,o,t.range,r)}return n-=i.layoutInfo.glyphMarginWidth,n<=i.layoutInfo.lineNumbersWidth?e.fulfillMargin(3,o,t.range,r):(n-=i.layoutInfo.lineNumbersWidth,e.fulfillMargin(4,o,t.range,r))}return null}static _hitTestViewLines(i,e){if(!Gw.isChildOfViewLines(e.targetPath))return null;if(i.isInTopPadding(e.mouseVerticalOffset))return e.fulfillContentEmpty(new ye(1,1),sYi);if(i.isAfterLines(e.mouseVerticalOffset)||i.isInBottomPadding(e.mouseVerticalOffset)){let o=i.viewModel.getLineCount(),n=i.viewModel.getLineMaxColumn(o);return e.fulfillContentEmpty(new ye(o,n),sYi)}if(Gw.isStrictChildOfViewLines(e.targetPath)){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),n=i.viewModel.getLineLength(o),r=i.getLineWidth(o);if(n===0){let l=Yce(e.mouseContentHorizontalOffset-r);return e.fulfillContentEmpty(new ye(o,1),l)}if(i.isRtl(o)){if(e.mouseContentHorizontalOffset+r<=i.layoutInfo.contentWidth-i.layoutInfo.verticalScrollbarWidth){let l=Yce(e.mouseContentHorizontalOffset-r),c=new ye(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(e.mouseContentHorizontalOffset>=r){let l=Yce(e.mouseContentHorizontalOffset-r),c=new ye(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(i.viewLinesGpu){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset);if(i.viewModel.getLineLength(o)===0){let l=i.getLineWidth(o),c=Yce(e.mouseContentHorizontalOffset-l);return e.fulfillContentEmpty(new ye(o,1),c)}let n=i.getLineWidth(o);if(i.isRtl(o)){if(e.mouseContentHorizontalOffset+n<=i.layoutInfo.contentWidth-i.layoutInfo.verticalScrollbarWidth){let l=Yce(e.mouseContentHorizontalOffset-n),c=new ye(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}}else if(e.mouseContentHorizontalOffset>=n){let l=Yce(e.mouseContentHorizontalOffset-n),c=new ye(o,i.viewModel.getLineMaxColumn(o));return e.fulfillContentEmpty(c,l)}let s=i.viewLinesGpu.getPositionAtCoordinate(o,e.mouseContentHorizontalOffset);if(s){let l={injectedText:null,mightBeForeignElement:!1};return e.fulfillContentText(s,G.fromPositions(s,s),l)}}let t=e.hitTestResult.value;return t.type===1?a.createMouseTargetFromHitTestPosition(i,e,t.spanNode,t.position,t.injectedText):e.wouldBenefitFromHitTestTargetSwitch?(e.switchToHitTestTarget(),this._createMouseTarget(i,e)):e.fulfillUnknown()}static _hitTestMinimap(i,e){if(Gw.isChildOfMinimap(e.targetPath)){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.viewModel.getLineMaxColumn(t);return e.fulfillScrollbar(new ye(t,o))}return null}static _hitTestScrollbarSlider(i,e){if(Gw.isChildOfScrollableElement(e.targetPath)&&e.target&&e.target.nodeType===1){let t=e.target.className;if(t&&/\b(slider|scrollbar)\b/.test(t)){let o=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),n=i.viewModel.getLineMaxColumn(o);return e.fulfillScrollbar(new ye(o,n))}}return null}static _hitTestScrollbar(i,e){if(Gw.isChildOfScrollableElement(e.targetPath)){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.viewModel.getLineMaxColumn(t);return e.fulfillScrollbar(new ye(t,o))}return null}getMouseColumn(i){let e=this._context.configuration.options,t=e.get(165),o=this._context.viewLayout.getCurrentScrollLeft()+i.x-t.contentLeft;return a._getMouseColumn(o,e.get(59).typicalHalfwidthCharacterWidth)}static _getMouseColumn(i,e){return i<0?1:Math.round(i/e)+1}static createMouseTargetFromHitTestPosition(i,e,t,o,n){let r=o.lineNumber,s=o.column,l=i.getLineWidth(r);if(e.mouseContentHorizontalOffset>l){let S=Yce(e.mouseContentHorizontalOffset-l);return e.fulfillContentEmpty(o,S)}let c=i.visibleRangeForPosition(r,s);if(!c)return e.fulfillUnknown(o);let u=c.left;if(Math.abs(e.mouseContentHorizontalOffset-u)<1)return e.fulfillContentText(o,null,{mightBeForeignElement:!!n,injectedText:n});let p=[];if(p.push({offset:c.left,column:s}),s>1){let S=i.visibleRangeForPosition(r,s-1);S&&p.push({offset:S.left,column:s-1})}let h=i.viewModel.getLineMaxColumn(r);if(s<h){let S=i.visibleRangeForPosition(r,s+1);S&&p.push({offset:S.left,column:s+1})}p.sort((S,y)=>S.offset-y.offset);let g=e.pos.toClientCoordinates(Me(i.viewDomNode)),f=t.getBoundingClientRect(),v=f.left<=g.clientX&&g.clientX<=f.right,b=null;for(let S=1;S<p.length;S++){let y=p[S-1],w=p[S];if(y.offset<=e.mouseContentHorizontalOffset&&e.mouseContentHorizontalOffset<=w.offset){b=new G(r,y.column,r,w.column);let x=Math.abs(y.offset-e.mouseContentHorizontalOffset),E=Math.abs(w.offset-e.mouseContentHorizontalOffset);o=x<E?new ye(r,y.column):new ye(r,w.column);break}}return e.fulfillContentText(o,b,{mightBeForeignElement:!v||!!n,injectedText:n})}static _doHitTestWithCaretRangeFromPoint(i,e){let t=i.getLineNumberAtVerticalOffset(e.mouseVerticalOffset),o=i.getVerticalOffsetForLineNumber(t),n=o+i.lineHeight;if(!(t===i.viewModel.getLineCount()&&e.mouseVerticalOffset>n)){let s=Math.floor((o+n)/2),l=e.pos.y+(s-e.mouseVerticalOffset);l<=e.editorPos.y&&(l=e.editorPos.y+1),l>=e.editorPos.y+e.editorPos.height&&(l=e.editorPos.y+e.editorPos.height-1);let c=new D5(e.pos.x,l),u=this._actualDoHitTestWithCaretRangeFromPoint(i,c.toClientCoordinates(Me(i.viewDomNode)));if(u.type===1)return u}return this._actualDoHitTestWithCaretRangeFromPoint(i,e.pos.toClientCoordinates(Me(i.viewDomNode)))}static _actualDoHitTestWithCaretRangeFromPoint(i,e){let t=IA(i.viewDomNode),o;if(t?typeof t.caretRangeFromPoint>"u"?o=vGo(t,e.clientX,e.clientY):o=t.caretRangeFromPoint(e.clientX,e.clientY):o=i.viewDomNode.ownerDocument.caretRangeFromPoint(e.clientX,e.clientY),!o||!o.startContainer)return new rK;let n=o.startContainer;if(n.nodeType===n.TEXT_NODE){let r=n.parentNode,s=r?r.parentNode:null,l=s?s.parentNode:null;return(l&&l.nodeType===l.ELEMENT_NODE?l.className:null)===OB.CLASS_NAME?JCe.createFromDOMInfo(i,r,o.startOffset):new rK(n.parentNode)}else if(n.nodeType===n.ELEMENT_NODE){let r=n.parentNode,s=r?r.parentNode:null;return(s&&s.nodeType===s.ELEMENT_NODE?s.className:null)===OB.CLASS_NAME?JCe.createFromDOMInfo(i,n,n.textContent.length):new rK(n)}return new rK}static _doHitTestWithCaretPositionFromPoint(i,e){let t=i.viewDomNode.ownerDocument.caretPositionFromPoint(e.clientX,e.clientY);if(t.offsetNode.nodeType===t.offsetNode.TEXT_NODE){let o=t.offsetNode.parentNode,n=o?o.parentNode:null,r=n?n.parentNode:null;return(r&&r.nodeType===r.ELEMENT_NODE?r.className:null)===OB.CLASS_NAME?JCe.createFromDOMInfo(i,t.offsetNode.parentNode,t.offset):new rK(t.offsetNode.parentNode)}if(t.offsetNode.nodeType===t.offsetNode.ELEMENT_NODE){let o=t.offsetNode.parentNode,n=o&&o.nodeType===o.ELEMENT_NODE?o.className:null,r=o?o.parentNode:null,s=r&&r.nodeType===r.ELEMENT_NODE?r.className:null;if(n===OB.CLASS_NAME){let l=t.offsetNode.childNodes[Math.min(t.offset,t.offsetNode.childNodes.length-1)];if(l)return JCe.createFromDOMInfo(i,l,0)}else if(s===OB.CLASS_NAME)return JCe.createFromDOMInfo(i,t.offsetNode,0)}return new rK(t.offsetNode)}static _snapToSoftTabBoundary(i,e){let t=e.getLineContent(i.lineNumber),{tabSize:o}=e.model.getOptions(),n=uce.atomicPosition(t,i.column-1,o,2);return n!==-1?new ye(i.lineNumber,n+1):i}static doHitTest(i,e){let t=new rK;if(typeof i.viewDomNode.ownerDocument.caretRangeFromPoint=="function"?t=this._doHitTestWithCaretRangeFromPoint(i,e):i.viewDomNode.ownerDocument.caretPositionFromPoint&&(t=this._doHitTestWithCaretPositionFromPoint(i,e.pos.toClientCoordinates(Me(i.viewDomNode)))),t.type===1){let o=i.viewModel.getInjectedTextAt(t.position),n=i.viewModel.normalizePosition(t.position,2);(o||!n.equals(t.position))&&(t=new Cyt(n,t.spanNode,o))}return t}};function vGo(a,i,e){let t=document.createRange(),o=a.elementFromPoint(i,e);if(o?.hasChildNodes()){for(;o&&o.firstChild&&o.firstChild.nodeType!==o.firstChild.TEXT_NODE&&o.lastChild&&o.lastChild.firstChild;)o=o.lastChild;let n=o.getBoundingClientRect(),r=Me(o),s=r.getComputedStyle(o,null).getPropertyValue("font-style"),l=r.getComputedStyle(o,null).getPropertyValue("font-variant"),c=r.getComputedStyle(o,null).getPropertyValue("font-weight"),u=r.getComputedStyle(o,null).getPropertyValue("font-size"),p=r.getComputedStyle(o,null).getPropertyValue("line-height"),h=r.getComputedStyle(o,null).getPropertyValue("font-family"),g=`${s} ${l} ${c} ${u}/${p} ${h}`,f=o.innerText,v=n.left,b=0,S;if(i>n.left+n.width)b=f.length;else{let y=ksi.getInstance();for(let w=0;w<f.length+1;w++){if(S=y.getCharWidth(f.charAt(w),g)/2,v+=S,i<v){b=w;break}v+=S}}t.setStart(o.firstChild,b),t.setEnd(o.firstChild,b)}return t}var ksi=class a{static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this._cache={},this._canvas=document.createElement("canvas")}getCharWidth(i,e){let t=i+e;if(this._cache[t])return this._cache[t];let o=this._canvas.getContext("2d");o.font=e;let r=o.measureText(i).width;return this._cache[t]=r,r}};function aYi(a){return(i,e,t)=>{let o=null,n=null;if(typeof t.value=="function"?(o="value",n=t.value):typeof t.get=="function"&&(o="get",n=t.get),!n||typeof e=="symbol")throw new Error("not supported");t[o]=a(n,e)}}function bi(a,i,e){let t=null,o=null;if(typeof e.value=="function"?(t="value",o=e.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof e.get=="function"&&(t="get",o=e.get),!o)throw new Error("not supported");let n=`$memoize$${i}`;e[t]=function(...r){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,r)}),this[n]}}function Tu(a,i,e){return aYi((t,o)=>{let n=`$debounce$${o}`,r=`$debounce$result$${o}`;return function(...s){this[r]||(this[r]=e?e():void 0),clearTimeout(this[n]),i&&(this[r]=i(this[r],...s),s=[this[r]]),this[n]=setTimeout(()=>{t.apply(this,s),this[r]=e?e():void 0},a)}})}function DA(a,i,e){return aYi((t,o)=>{let n=`$throttle$timer$${o}`,r=`$throttle$result$${o}`,s=`$throttle$lastRun$${o}`,l=`$throttle$pending$${o}`;return function(...c){if(this[r]||(this[r]=e?e():void 0),(this[s]===null||this[s]===void 0)&&(this[s]=-Number.MAX_VALUE),i&&(this[r]=i(this[r],...c)),this[l])return;let u=this[s]+a;u<=Date.now()?(this[s]=Date.now(),t.apply(this,[this[r]]),this[r]=e?e():void 0):(this[l]=!0,this[n]=setTimeout(()=>{this[l]=!1,this[s]=Date.now(),t.apply(this,[this[r]]),this[r]=e?e():void 0},u-Date.now()))}})}var Vn;(n=>(n.Tap="-monaco-gesturetap",n.Change="-monaco-gesturechange",n.Start="-monaco-gesturestart",n.End="-monaco-gesturesend",n.Contextmenu="-monaco-gesturecontextmenu"))(Vn||={});var qw=class qw extends k{constructor(){super();this.dispatched=!1;this.targets=new ra;this.ignoreTargets=new ra;this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(U.runAndSubscribe(Of,({window:e,disposables:t})=>{t.add($(e.document,"touchstart",o=>this.onTouchStart(o),{passive:!1})),t.add($(e.document,"touchend",o=>this.onTouchEnd(e,o))),t.add($(e.document,"touchmove",o=>this.onTouchMove(o),{passive:!1}))},{window:ut,disposables:this._store}))}static{this.SCROLL_FRICTION=-.005}static{this.HOLD_DELAY=700}static{this.CLEAR_TAP_COUNT_TIME=400}static addTarget(e){if(!qw.isTouchDevice())return k.None;qw.INSTANCE||(qw.INSTANCE=bp(new qw));let t=qw.INSTANCE.targets.push(e);return ee(t)}static ignoreTarget(e){if(!qw.isTouchDevice())return k.None;qw.INSTANCE||(qw.INSTANCE=bp(new qw));let t=qw.INSTANCE.ignoreTargets.push(e);return ee(t)}static isTouchDevice(){return"ontouchstart"in ut||navigator.maxTouchPoints>0}static isHoverDevice(){return ut.matchMedia("(hover: hover)").matches}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let o=0,n=e.targetTouches.length;o<n;o++){let r=e.targetTouches.item(o);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let s=this.newGestureEvent(Vn.Start,r.target);s.pageX=r.pageX,s.pageY=r.pageY,this.dispatchEvent(s)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,t){let o=Date.now(),n=Object.keys(this.activeTouches).length;for(let r=0,s=t.changedTouches.length;r<s;r++){let l=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],u=Date.now()-c.initialTimeStamp;if(u<qw.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){let p=this.newGestureEvent(Vn.Tap,c.initialTarget);p.pageX=c.rollingPageX.at(-1),p.pageY=c.rollingPageY.at(-1),this.dispatchEvent(p)}else if(u>=qw.HOLD_DELAY&&Math.abs(c.initialPageX-c.rollingPageX.at(-1))<30&&Math.abs(c.initialPageY-c.rollingPageY.at(-1))<30){let p=this.newGestureEvent(Vn.Contextmenu,c.initialTarget);p.pageX=c.rollingPageX.at(-1),p.pageY=c.rollingPageY.at(-1),this.dispatchEvent(p)}else if(n===1){let p=c.rollingPageX.at(-1),h=c.rollingPageY.at(-1),g=c.rollingTimestamps.at(-1)-c.rollingTimestamps[0],f=p-c.rollingPageX[0],v=h-c.rollingPageY[0],b=[...this.targets].filter(S=>c.initialTarget instanceof Node&&S.contains(c.initialTarget));this.inertia(e,b,o,Math.abs(f)/g,f>0?1:-1,p,Math.abs(v)/g,v>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Vn.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let o=document.createEvent("CustomEvent");return o.initEvent(e,!1,!0),o.initialTarget=t,o.tapCount=0,o}dispatchEvent(e){if(e.type===Vn.Tap){let t=new Date().getTime(),o=0;t-this._lastSetTapCountTime>qw.CLEAR_TAP_COUNT_TIME?o=1:o=2,this._lastSetTapCountTime=t,e.tapCount=o}else(e.type===Vn.Change||e.type===Vn.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let o of this.ignoreTargets)if(o.contains(e.initialTarget))return;let t=[];for(let o of this.targets)if(o.contains(e.initialTarget)){let n=0,r=e.initialTarget;for(;r&&r!==o;)n++,r=r.parentElement;t.push([n,o])}t.sort((o,n)=>o[0]-n[0]);for(let[o,n]of t)n.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,o,n,r,s,l,c,u){this.handle=kr(e,()=>{let p=Date.now(),h=p-o,g=0,f=0,v=!0;n+=qw.SCROLL_FRICTION*h,l+=qw.SCROLL_FRICTION*h,n>0&&(v=!1,g=r*n*h),l>0&&(v=!1,f=c*l*h);let b=this.newGestureEvent(Vn.Change);b.translationX=g,b.translationY=f,t.forEach(S=>S.dispatchEvent(b)),v||this.inertia(e,t,p,n,r,s+g,l,c,u+f)})}onTouchMove(e){let t=Date.now();for(let o=0,n=e.changedTouches.length;o<n;o++){let r=e.changedTouches.item(o);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn("end of an UNKNOWN touch",r);continue}let s=this.activeTouches[r.identifier],l=this.newGestureEvent(Vn.Change,s.initialTarget);l.translationX=r.pageX-s.rollingPageX.at(-1),l.translationY=r.pageY-s.rollingPageY.at(-1),l.pageX=r.pageX,l.pageY=r.pageY,this.dispatchEvent(l),s.rollingPageX.length>3&&(s.rollingPageX.shift(),s.rollingPageY.shift(),s.rollingTimestamps.shift()),s.rollingPageX.push(r.pageX),s.rollingPageY.push(r.pageY),s.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};I([bi],qw,"isTouchDevice",1),I([bi],qw,"isHoverDevice",1);var ds=qw;var ll=class extends k{onclick(i,e){this._register($(i,ne.CLICK,t=>e(new Ln(Me(i),t))))}onmousedown(i,e){this._register($(i,ne.MOUSE_DOWN,t=>e(new Ln(Me(i),t))))}onmouseover(i,e){this._register($(i,ne.MOUSE_OVER,t=>e(new Ln(Me(i),t))))}onmouseleave(i,e){this._register($(i,ne.MOUSE_LEAVE,t=>e(new Ln(Me(i),t))))}onkeydown(i,e){this._register($(i,ne.KEY_DOWN,t=>e(new mi(t))))}onkeyup(i,e){this._register($(i,ne.KEY_UP,t=>e(new mi(t))))}oninput(i,e){this._register($(i,ne.INPUT,e))}onblur(i,e){this._register($(i,ne.BLUR,e))}onfocus(i,e){this._register($(i,ne.FOCUS,e))}onchange(i,e){this._register($(i,ne.CHANGE,e))}ignoreGesture(i){return ds.ignoreTarget(i)}};var mX=11,kyt=class extends ll{constructor(i){super(),this._onActivate=i.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=i.bgWidth+"px",this.bgDomNode.style.height=i.bgHeight+"px",typeof i.top<"u"&&(this.bgDomNode.style.top="0px"),typeof i.left<"u"&&(this.bgDomNode.style.left="0px"),typeof i.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof i.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=i.className,this.domNode.classList.add(...q.asClassNameArray(i.icon)),this.domNode.style.position="absolute",this.domNode.style.width=mX+"px",this.domNode.style.height=mX+"px",typeof i.top<"u"&&(this.domNode.style.top=i.top+"px"),typeof i.left<"u"&&(this.domNode.style.left=i.left+"px"),typeof i.bottom<"u"&&(this.domNode.style.bottom=i.bottom+"px"),typeof i.right<"u"&&(this.domNode.style.right=i.right+"px"),this._pointerMoveMonitor=this._register(new fT),this._register(Yo(this.bgDomNode,ne.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Yo(this.domNode,ne.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new LL),this._pointerdownScheduleRepeatTimer=this._register(new Nl)}_arrowPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Me(i))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,t=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),i.preventDefault()}};var Eyt=class extends k{constructor(i,e,t){super(),this._visibility=i,this._visibleClassName=e,this._invisibleClassName=t,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Nl)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this._updateShouldBeVisible())}setShouldBeVisible(i){this._rawShouldBeVisible=i,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let i=this._applyVisibilitySetting();this._shouldBeVisible!==i&&(this._shouldBeVisible=i,this.ensureVisibility())}setIsNeeded(i){this._isNeeded!==i&&(this._isNeeded=i,this.ensureVisibility())}setDomNode(i){this._domNode=i,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(i){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(i?" fade":"")))}};var bGo=140,txe=class extends ll{constructor(i){super(),this._lazyRender=i.lazyRender,this._host=i.host,this._scrollable=i.scrollable,this._scrollByPage=i.scrollByPage,this._scrollbarState=i.scrollbarState,this._visibilityController=this._register(new Eyt(i.visibility,"visible scrollbar "+i.extraScrollbarClassName,"invisible scrollbar "+i.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new fT),this._shouldRender=!0,this.domNode=Ir(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition("absolute"),this._register($(this.domNode.domNode,ne.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(i){let e=this._register(new kyt(i));this.domNode.domNode.appendChild(e.bgDomNode),this.domNode.domNode.appendChild(e.domNode)}_createSlider(i,e,t,o){this.slider=Ir(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(i),this.slider.setLeft(e),typeof t=="number"&&this.slider.setWidth(t),typeof o=="number"&&this.slider.setHeight(o),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register($(this.slider.domNode,ne.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.stopPropagation()})}_onElementSize(i){return this._scrollbarState.setVisibleSize(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(i){return this._scrollbarState.setScrollSize(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(i){return this._scrollbarState.setScrollPosition(i)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(i){i.target===this.domNode.domNode&&this._onPointerDown(i)}delegatePointerDown(i){let e=this.domNode.domNode.getClientRects()[0].top,t=e+this._scrollbarState.getSliderPosition(),o=e+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(i);t<=n&&n<=o?i.button===0&&(i.preventDefault(),this._sliderPointerDown(i)):this._onPointerDown(i)}_onPointerDown(i){let e,t;if(i.target===this.domNode.domNode&&typeof i.offsetX=="number"&&typeof i.offsetY=="number")e=i.offsetX,t=i.offsetY;else{let r=ur(this.domNode.domNode);e=i.pageX-r.left,t=i.pageY-r.top}let o=i.pointerType==="mouse",n=i.button===0;if(n||!o){let r=this._pointerDownRelativePosition(e,t);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r))}n&&(i.preventDefault(),this._sliderPointerDown(i))}_sliderPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=this._sliderPointerPosition(i),t=this._sliderOrthogonalPointerPosition(i),o=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,n=>{let r=this._sliderOrthogonalPointerPosition(n),s=Math.abs(r-t);if(ii&&s>bGo){this._setDesiredScrollPositionNow(o.getScrollPosition());return}let c=this._sliderPointerPosition(n)-e;this._setDesiredScrollPositionNow(o.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(i){let e={};this.writeScrollPosition(e,i),this._scrollable.setScrollPositionNow(e)}updateScrollbarSize(i){this._updateScrollbarSize(i),this._scrollbarState.setScrollbarSize(i),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}};var hX=class a{constructor(i,e,t,o,n,r){this._scrollbarSize=Math.round(e),this._oppositeScrollbarSize=Math.round(t),this._arrowSize=Math.round(i),this._visibleSize=o,this._scrollSize=n,this._scrollPosition=r,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new a(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(i){let e=Math.round(i);return this._visibleSize!==e?(this._visibleSize=e,this._refreshComputedValues(),!0):!1}setScrollSize(i){let e=Math.round(i);return this._scrollSize!==e?(this._scrollSize=e,this._refreshComputedValues(),!0):!1}setScrollPosition(i){let e=Math.round(i);return this._scrollPosition!==e?(this._scrollPosition=e,this._refreshComputedValues(),!0):!1}setScrollbarSize(i){this._scrollbarSize=Math.round(i)}setOppositeScrollbarSize(i){this._oppositeScrollbarSize=Math.round(i)}static _computeValues(i,e,t,o,n){let r=Math.max(0,t-i),s=Math.max(0,r-2*e),l=o>0&&o>t;if(!l)return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(s),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(t*s/o))),u=(s-c)/(o-t),p=n*u;return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(p)}}_refreshComputedValues(){let i=a._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(i){if(!this._computedIsNeeded)return 0;let e=i-this._arrowSize-this._computedSliderSize/2;return Math.round(e/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(i){if(!this._computedIsNeeded)return 0;let e=i-this._arrowSize,t=this._scrollPosition;return e<this._computedSliderPosition?t-=this._visibleSize:t+=this._visibleSize,t}getDesiredScrollPositionFromDelta(i){if(!this._computedIsNeeded)return 0;let e=this._computedSliderPosition+i;return Math.round(e/this._computedSliderRatio)}};var Tyt=class extends txe{constructor(i,e,t){let o=i.getScrollDimensions(),n=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new hX(e.horizontalHasArrows?e.arrowSize:0,e.horizontal===2?0:e.horizontalScrollbarSize,e.vertical===2?0:e.verticalScrollbarSize,o.width,o.scrollWidth,n.scrollLeft),visibility:e.horizontal,extraScrollbarClassName:"horizontal",scrollable:i,scrollByPage:e.scrollByPage}),e.horizontalHasArrows){let r=(e.arrowSize-mX)/2,s=(e.horizontalScrollbarSize-mX)/2;this._createArrow({className:"scra",icon:L.scrollbarButtonLeft,top:s,left:r,bottom:void 0,right:void 0,bgWidth:e.arrowSize,bgHeight:e.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new nD(null,1,0))}),this._createArrow({className:"scra",icon:L.scrollbarButtonRight,top:s,left:void 0,bottom:void 0,right:r,bgWidth:e.arrowSize,bgHeight:e.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new nD(null,-1,0))})}this._createSlider(Math.floor((e.horizontalScrollbarSize-e.horizontalSliderSize)/2),0,void 0,e.horizontalSliderSize)}_updateSlider(i,e){this.slider.setWidth(i),this.slider.setLeft(e)}_renderDomNode(i,e){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(i.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return i}_sliderPointerPosition(i){return i.pageX}_sliderOrthogonalPointerPosition(i){return i.pageY}_updateScrollbarSize(i){this.slider.setHeight(i)}writeScrollPosition(i,e){i.scrollLeft=e}updateOptions(i){this.updateScrollbarSize(i.horizontal===2?0:i.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._visibilityController.setVisibility(i.horizontal),this._scrollByPage=i.scrollByPage}};var _yt=class extends txe{constructor(i,e,t){let o=i.getScrollDimensions(),n=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new hX(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,o.height,o.scrollHeight,n.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:i,scrollByPage:e.scrollByPage}),e.verticalHasArrows){let r=(e.arrowSize-mX)/2,s=(e.verticalScrollbarSize-mX)/2;this._createArrow({className:"scra",icon:L.scrollbarButtonUp,top:r,left:s,bottom:void 0,right:void 0,bgWidth:e.verticalScrollbarSize,bgHeight:e.arrowSize,onActivate:()=>this._host.onMouseWheel(new nD(null,0,1))}),this._createArrow({className:"scra",icon:L.scrollbarButtonDown,top:void 0,left:s,bottom:r,right:void 0,bgWidth:e.verticalScrollbarSize,bgHeight:e.arrowSize,onActivate:()=>this._host.onMouseWheel(new nD(null,0,-1))})}this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(i,e){this.slider.setHeight(i),this.slider.setTop(e)}_renderDomNode(i,e){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(i.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return e}_sliderPointerPosition(i){return i.pageY}_sliderOrthogonalPointerPosition(i){return i.pageX}_updateScrollbarSize(i){this.slider.setWidth(i)}writeScrollPosition(i,e){i.scrollTop=e}updateOptions(i){this.updateScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(i.vertical),this._scrollByPage=i.scrollByPage}};var SGo=500,lYi=50,cYi=!0,Esi=class{constructor(i,e,t){this.timestamp=i,this.deltaX=e,this.deltaY=t,this.score=0}},sK=class a{static{this.INSTANCE=new a}constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let i=1,e=0,t=1,o=this._rear;do{let n=o===this._front?i:Math.pow(2,-t);if(i-=n,e+=this._memory[o].score*n,o===this._front)break;o=(this._capacity+o-1)%this._capacity,t++}while(!0);return e<=.5}acceptStandardWheelEvent(i){if(Iz){let e=Me(i.browserEvent),t=uv(e);this.accept(Date.now(),i.deltaX*t,i.deltaY*t)}else this.accept(Date.now(),i.deltaX,i.deltaY)}accept(i,e,t){let o=null,n=new Esi(i,e,t);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(o=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=n),n.score=this._computeScore(n,o)}_computeScore(i,e){if(Math.abs(i.deltaX)>0&&Math.abs(i.deltaY)>0)return 1;let t=.5;if((!this._isAlmostInt(i.deltaX)||!this._isAlmostInt(i.deltaY))&&(t+=.25),e){let o=Math.abs(i.deltaX),n=Math.abs(i.deltaY),r=Math.abs(e.deltaX),s=Math.abs(e.deltaY),l=Math.max(Math.min(o,r),1),c=Math.max(Math.min(n,s),1),u=Math.max(o,r),p=Math.max(n,s);u%l===0&&p%c===0&&(t-=.5)}return Math.min(Math.max(t,0),1)}_isAlmostInt(i){let e=Number.EPSILON*100;return Math.abs(Math.round(i)-i)<.01+e}},z3e=class extends ll{constructor(e,t,o){super();this._inertialTimeout=null;this._inertialSpeed={X:0,Y:0};this._onScroll=this._register(new T);this._onWillScroll=this._register(new T);e.style.overflow="hidden",this._options=IGo(t),this._scrollable=o,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let n={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new _yt(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new Tyt(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Ir(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Ir(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Ir(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new Nl),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get onScroll(){return this._onScroll.event}get onWillScroll(){return this._onWillScroll.event}get options(){return this._options}dispose(){this._mouseWheelToDispose=je(this._mouseWheelToDispose),this._inertialTimeout&&(this._inertialTimeout.dispose(),this._inertialTimeout=null),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,et&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new nD(e))}async _periodicSync(){let e=!1;(this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0)&&(this._scrollable.setScrollPositionNow({scrollTop:this._scrollable.getCurrentScrollPosition().scrollTop-this._inertialSpeed.Y*100,scrollLeft:this._scrollable.getCurrentScrollPosition().scrollLeft-this._inertialSpeed.X*100}),this._inertialSpeed.X*=.9,this._inertialSpeed.Y*=.9,Math.abs(this._inertialSpeed.X)<.01&&(this._inertialSpeed.X=0),Math.abs(this._inertialSpeed.Y)<.01&&(this._inertialSpeed.Y=0),e=this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0),e?(this._inertialTimeout||(this._inertialTimeout=new Nl),this._inertialTimeout.cancelAndSet(()=>this._periodicSync(),1e3/60)):(this._inertialTimeout?.dispose(),this._inertialTimeout=null)}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=je(this._mouseWheelToDispose),e)){let o=n=>{this._onMouseWheel(new nD(n))};this._mouseWheelToDispose.push($(this._listenOnDomNode,ne.MOUSE_WHEEL,o,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=sK.INSTANCE;cYi&&t.acceptStandardWheelEvent(e);let o=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+r===0?s=r=0:Math.abs(r)>=Math.abs(s)?s=0:r=0),this._options.flipAxes&&([r,s]=[s,r]);let l=!et&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!s&&(s=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(s=s*this._options.fastScrollSensitivity,r=r*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(r){let p=lYi*r,h=c.scrollTop-(p<0?Math.floor(p):Math.ceil(p));this._verticalScrollbar.writeScrollPosition(u,h)}if(s){let p=lYi*s,h=c.scrollLeft-(p<0?Math.floor(p):Math.ceil(p));this._horizontalScrollbar.writeScrollPosition(u,h)}if(u=this._scrollable.validateScrollPosition(u),this._options.inertialScroll&&(s||r)&&!t.isPhysicalMouseWheel()){let p=!1;this._inertialSpeed.X===0&&this._inertialSpeed.Y===0&&(p=!0),this._inertialSpeed.Y=(r<0?-1:1)*Math.abs(r)**1.02,this._inertialSpeed.X=(s<0?-1:1)*Math.abs(s)**1.02,p&&this._periodicSync()}(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(cYi&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),o=!0)}let n=o;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,o=e.scrollLeft>0,n=o?" left":"",r=t?" top":"",s=o||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${r}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),SGo)}},gX=class extends z3e{constructor(i,e){e=e||{},e.mouseWheelSmoothScroll=!1;let t=new hD({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>kr(Me(i),o)});super(i,e,t),this._register(t)}setScrollPosition(i){this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},LF=class extends z3e{constructor(i,e,t){super(i,e,t)}setScrollPosition(i){i.reuseAnimation?this._scrollable.setScrollPositionSmooth(i,i.reuseAnimation):this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}},Ar=class extends z3e{constructor(i,e){e=e||{},e.mouseWheelSmoothScroll=!1;let t=new hD({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:o=>kr(Me(i),o)});super(i,e,t),this._register(t),this._element=i,this._register(this.onScroll(o=>{o.scrollTopChanged&&(this._element.scrollTop=o.scrollTop),o.scrollLeftChanged&&(this._element.scrollLeft=o.scrollLeft)})),this.scanDomNode()}setScrollPosition(i){this._scrollable.setScrollPositionNow(i)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}};function IGo(a){let i={lazyRender:typeof a.lazyRender<"u"?a.lazyRender:!1,className:typeof a.className<"u"?a.className:"",useShadows:typeof a.useShadows<"u"?a.useShadows:!0,handleMouseWheel:typeof a.handleMouseWheel<"u"?a.handleMouseWheel:!0,flipAxes:typeof a.flipAxes<"u"?a.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof a.consumeMouseWheelIfScrollbarIsNeeded<"u"?a.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof a.alwaysConsumeMouseWheel<"u"?a.alwaysConsumeMouseWheel:!1,scrollYToX:typeof a.scrollYToX<"u"?a.scrollYToX:!1,mouseWheelScrollSensitivity:typeof a.mouseWheelScrollSensitivity<"u"?a.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof a.fastScrollSensitivity<"u"?a.fastScrollSensitivity:5,scrollPredominantAxis:typeof a.scrollPredominantAxis<"u"?a.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof a.mouseWheelSmoothScroll<"u"?a.mouseWheelSmoothScroll:!0,inertialScroll:typeof a.inertialScroll<"u"?a.inertialScroll:!1,arrowSize:typeof a.arrowSize<"u"?a.arrowSize:11,listenOnDomNode:typeof a.listenOnDomNode<"u"?a.listenOnDomNode:null,horizontal:typeof a.horizontal<"u"?a.horizontal:1,horizontalScrollbarSize:typeof a.horizontalScrollbarSize<"u"?a.horizontalScrollbarSize:10,horizontalSliderSize:typeof a.horizontalSliderSize<"u"?a.horizontalSliderSize:0,horizontalHasArrows:typeof a.horizontalHasArrows<"u"?a.horizontalHasArrows:!1,vertical:typeof a.vertical<"u"?a.vertical:1,verticalScrollbarSize:typeof a.verticalScrollbarSize<"u"?a.verticalScrollbarSize:10,verticalHasArrows:typeof a.verticalHasArrows<"u"?a.verticalHasArrows:!1,verticalSliderSize:typeof a.verticalSliderSize<"u"?a.verticalSliderSize:0,scrollByPage:typeof a.scrollByPage<"u"?a.scrollByPage:!1};return i.horizontalSliderSize=typeof a.horizontalSliderSize<"u"?a.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize=typeof a.verticalSliderSize<"u"?a.verticalSliderSize:i.verticalScrollbarSize,et&&(i.className+=" mac"),i}var Dyt=class extends k{constructor(e,t,o,n){super();this._context=e;this._viewHelper=t;this._mouseTargetFactory=o;this._dispatchMouse=n;this._operation=null}dispose(){super.dispose(),this.stop()}start(e,t){this._operation?this._operation.setPosition(e,t):this._operation=this._createDragScrollingOperation(e,t)}stop(){this._operation&&(this._operation.dispose(),this._operation=null)}},Ryt=class extends k{constructor(e,t,o,n,r,s){super();this._context=e;this._viewHelper=t;this._mouseTargetFactory=o;this._dispatchMouse=n;this._position=r,this._mouseEvent=s,this._lastTime=Date.now(),this._animationFrameDisposable=kr(Me(s.browserEvent),()=>this._execute())}dispose(){this._animationFrameDisposable.dispose(),super.dispose()}setPosition(e,t){this._position=e,this._mouseEvent=t}_tick(){let e=Date.now(),t=e-this._lastTime;return this._lastTime=e,t}},Lyt=class extends Dyt{_createDragScrollingOperation(i,e){return new Tsi(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,i,e)}},Tsi=class extends Ryt{_getScrollSpeed(){let i=this._context.configuration.options.get(75),e=this._context.configuration.options.get(165).height/i,t=this._position.outsideDistance/i;return t<=1.5?Math.max(30,e*(1+t)):t<=3?Math.max(60,e*(2+t)):Math.max(200,e*(7+t))}_execute(){let i=this._context.configuration.options.get(75),e=this._getScrollSpeed(),t=this._tick(),o=e*(t/1e3)*i,n=this._position.outsidePosition==="above"?-o:o;this._context.viewModel.viewLayout.deltaScrollNow(0,n),this._viewHelper.renderNow();let r=this._context.viewLayout.getLinesViewportData(),s=this._position.outsidePosition==="above"?r.startLineNumber:r.endLineNumber,l=this._position.outsidePosition==="above"?r.startLineNumber===1:r.endLineNumber===this._context.viewModel.getLineCount(),c;{let u=GCe(this._viewHelper.viewDomNode),p=this._context.configuration.options.get(165).horizontalScrollbarHeight,h=new D5(this._mouseEvent.pos.x,u.y+u.height-p-.1),g=qCe(this._viewHelper.viewDomNode,u,h);c=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),u,h,g,null)}(!c.position||c.position.lineNumber!==s||l)&&(this._position.outsidePosition==="above"?c=jv.createOutsideEditor(this._position.mouseColumn,new ye(s,1),"above",this._position.outsideDistance):c=jv.createOutsideEditor(this._position.mouseColumn,new ye(s,this._context.viewModel.getLineMaxColumn(s)),"below",this._position.outsideDistance)),this._dispatchMouse(c,!0,2),this._animationFrameDisposable=kr(Me(c.element),()=>this._execute())}},Myt=class extends Dyt{_createDragScrollingOperation(i,e){return new _si(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,i,e)}},_si=class extends Ryt{_getScrollSpeed(){let i=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,e=this._context.configuration.options.get(165).contentWidth/i,t=this._position.outsideDistance/i;return t<=1.5?Math.max(30,e*(1+t)):t<=3?Math.max(60,e*(2+t)):Math.max(200,e*(7+t))}_execute(){let i=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,e=this._getScrollSpeed(),t=this._tick(),o=e*(t/1e3)*i*.5,n=this._position.outsidePosition==="left"?-o:o;if(this._context.viewModel.viewLayout.deltaScrollNow(n,0),this._viewHelper.renderNow(),!this._position.position)return;let r=this._position.position.lineNumber,s;{let l=GCe(this._viewHelper.viewDomNode),c=this._context.configuration.options.get(165).horizontalScrollbarHeight,u=new D5(this._mouseEvent.pos.x,l.y+l.height-c-.1),p=qCe(this._viewHelper.viewDomNode,l,u);s=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),l,u,p,null)}this._position.outsidePosition==="left"?s=jv.createOutsideEditor(s.mouseColumn,new ye(r,s.mouseColumn),"left",this._position.outsideDistance):s=jv.createOutsideEditor(s.mouseColumn,new ye(r,s.mouseColumn),"right",this._position.outsideDistance),this._dispatchMouse(s,!0,2),this._animationFrameDisposable=kr(Me(s.element),()=>this._execute())}};var ixe=class extends yT{constructor(e,t,o){super();this._mouseLeaveMonitor=null;this._context=e,this.viewController=t,this.viewHelper=o,this.mouseTargetFactory=new exe(this._context,o),this._mouseDownOperation=this._register(new Dsi(this._context,this.viewController,this.viewHelper,this.mouseTargetFactory,(s,l)=>this._createMouseTarget(s,l),s=>this._getMouseColumn(s))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(165).height;let n=new pyt(this.viewHelper.viewDomNode);this._register(n.onContextMenu(this.viewHelper.viewDomNode,s=>this._onContextMenu(s,!0))),this._register(n.onMouseMove(this.viewHelper.viewDomNode,s=>{this._onMouseMove(s),this._mouseLeaveMonitor||(this._mouseLeaveMonitor=$(this.viewHelper.viewDomNode.ownerDocument,"mousemove",l=>{this.viewHelper.viewDomNode.contains(l.target)||this._onMouseLeave(new zL(l,!1,this.viewHelper.viewDomNode))}))})),this._register(n.onMouseUp(this.viewHelper.viewDomNode,s=>this._onMouseUp(s))),this._register(n.onMouseLeave(this.viewHelper.viewDomNode,s=>this._onMouseLeave(s)));let r=0;this._register(n.onPointerDown(this.viewHelper.viewDomNode,(s,l)=>{r=l})),this._register($(this.viewHelper.viewDomNode,ne.POINTER_UP,s=>{this._mouseDownOperation.onPointerUp()})),this._register(n.onMouseDown(this.viewHelper.viewDomNode,s=>this._onMouseDown(s,r))),this._setupMouseWheelZoomListener(),this._context.addEventHandler(this)}_setupMouseWheelZoomListener(){let e=sK.INSTANCE,t=0,o=uT.getZoomLevel(),n=!1,r=0,s=c=>{if(this.viewController.emitMouseWheel(c),!this._context.configuration.options.get(84))return;let u=new nD(c);if(e.acceptStandardWheelEvent(u),e.isPhysicalMouseWheel()){if(l(c)){let p=uT.getZoomLevel(),h=u.deltaY>0?1:-1;uT.setZoomLevel(p+h),u.preventDefault(),u.stopPropagation()}}else Date.now()-t>50&&(o=uT.getZoomLevel(),n=l(c),r=0),t=Date.now(),r+=u.deltaY,n&&(uT.setZoomLevel(o+r/5),u.preventDefault(),u.stopPropagation())};this._register($(this.viewHelper.viewDomNode,ne.MOUSE_WHEEL,s,{capture:!0,passive:!1}));function l(c){return et?(c.metaKey||c.ctrlKey)&&!c.shiftKey&&!c.altKey:c.ctrlKey&&!c.metaKey&&!c.shiftKey&&!c.altKey}}dispose(){this._context.removeEventHandler(this),this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(165)){let t=this._context.configuration.options.get(165).height;this._height!==t&&(this._height=t,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}getTargetAtClientPoint(e,t){let n=new V3e(e,t).toPageCoordinates(Me(this.viewHelper.viewDomNode)),r=GCe(this.viewHelper.viewDomNode);if(n.y<r.y||n.y>r.y+r.height||n.x<r.x||n.x>r.x+r.width)return null;let s=qCe(this.viewHelper.viewDomNode,r,n);return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),r,n,s,null)}_createMouseTarget(e,t){let o=e.target;if(!this.viewHelper.viewDomNode.contains(o)){let n=IA(this.viewHelper.viewDomNode);n&&(o=n.elementsFromPoint(e.posx,e.posy).find(s=>this.viewHelper.viewDomNode.contains(s))??null)}return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,e.relativePos,t?o:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.relativePos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){this.mouseTargetFactory.mouseTargetIsWidget(e)||e.preventDefault(),!(this._mouseDownOperation.isActive()||e.timestamp<this.lastMouseLeaveTime)&&this.viewController.emitMouseMove({event:e,target:this._createMouseTarget(e,!0)})}_onMouseLeave(e){this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),this.lastMouseLeaveTime=new Date().getTime(),this.viewController.emitMouseLeave({event:e,target:null})}_onMouseUp(e){this.viewController.emitMouseUp({event:e,target:this._createMouseTarget(e,!0)})}_onMouseDown(e,t){let o=this._createMouseTarget(e,!0),n=o.type===6||o.type===7,r=o.type===2||o.type===3||o.type===4,s=o.type===3,l=this._context.configuration.options.get(125),c=o.type===8||o.type===5,u=o.type===9,p=e.leftButton||e.middleButton;et&&e.leftButton&&e.ctrlKey&&(p=!1);let h=()=>{e.preventDefault(),this.viewHelper.focusTextArea()};if(p&&(n||s&&l))h(),this._mouseDownOperation.start(o.type,e,t);else if(r)e.preventDefault();else if(c){let g=o.detail;p&&this.viewHelper.shouldSuppressMouseDownOnViewZone(g.viewZoneId)&&(h(),this._mouseDownOperation.start(o.type,e,t),e.preventDefault())}else u&&this.viewHelper.shouldSuppressMouseDownOnWidget(o.detail)&&(h(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:o})}_onMouseWheel(e){this.viewController.emitMouseWheel(e)}},Dsi=class extends k{constructor(e,t,o,n,r,s){super();this._context=e;this._viewController=t;this._viewHelper=o;this._mouseTargetFactory=n;this._createMouseTarget=r,this._getMouseColumn=s,this._mouseMoveMonitor=this._register(new hyt(this._viewHelper.viewDomNode)),this._topBottomDragScrolling=this._register(new Lyt(this._context,this._viewHelper,this._mouseTargetFactory,(l,c,u)=>this._dispatchMouse(l,c,u))),this._leftRightDragScrolling=this._register(new Myt(this._context,this._viewHelper,this._mouseTargetFactory,(l,c,u)=>this._dispatchMouse(l,c,u))),this._mouseState=new Rsi,this._currentSelection=new ei(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);let t=this._findMousePosition(e,!1);t&&(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):t.type===13?t.outsidePosition==="above"||t.outsidePosition==="below"?(this._topBottomDragScrolling.start(t,e),this._leftRightDragScrolling.stop()):(this._leftRightDragScrolling.start(t,e),this._topBottomDragScrolling.stop()):(this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop(),this._dispatchMouse(t,!0,1)))}start(e,t,o){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(e===3),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);let n=this._findMousePosition(t,!0);if(!n||!n.position)return;this._mouseState.trySetCount(t.detail,n.position),t.detail=this._mouseState.count;let r=this._context.configuration.options;if(!r.get(104)&&r.get(42)&&!r.get(28)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&n.type===6&&n.position&&this._currentSelection.containsPosition(n.position)){this._mouseState.isDragAndDrop=!0,this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,o,t.buttons,s=>this._onMouseDownThenMove(s),s=>{let l=this._findMousePosition(this._lastMouseEvent,!1);sf(s)?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:l?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()});return}this._mouseState.isDragAndDrop=!1,this._dispatchMouse(n,t.shiftKey,1),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,o,t.buttons,s=>this._onMouseDownThenMove(s),()=>this._stop()))}_stop(){this._isActive=!1,this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onPointerUp(){this._mouseMoveMonitor.stopMonitoring()}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){let t=e.editorPos,o=this._context.viewModel,n=this._context.viewLayout,r=this._getMouseColumn(e);if(e.posy<t.y){let h=t.y-e.posy,g=Math.max(n.getCurrentScrollTop()-h,0),f=ZCe.getZoneAtCoord(this._context,g);if(f){let b=this._helpPositionJumpOverViewZone(f);if(b)return jv.createOutsideEditor(r,b,"above",h)}let v=n.getLineNumberAtVerticalOffset(g);return jv.createOutsideEditor(r,new ye(v,1),"above",h)}if(e.posy>t.y+t.height){let h=e.posy-t.y-t.height,g=n.getCurrentScrollTop()+e.relativePos.y,f=ZCe.getZoneAtCoord(this._context,g);if(f){let b=this._helpPositionJumpOverViewZone(f);if(b)return jv.createOutsideEditor(r,b,"below",h)}let v=n.getLineNumberAtVerticalOffset(g);return jv.createOutsideEditor(r,new ye(v,o.getLineMaxColumn(v)),"below",h)}let s=n.getLineNumberAtVerticalOffset(n.getCurrentScrollTop()+e.relativePos.y),l=this._context.configuration.options.get(165),c=l.contentLeft;if(e.relativePos.x<=c){let h=c-e.relativePos.x,g=o.getTextDirection(s)===1;return jv.createOutsideEditor(r,new ye(s,g?o.getLineMaxColumn(s):1),"left",h)}let p=l.minimap.minimapLeft===0?l.width-l.verticalScrollbarWidth:l.minimap.minimapLeft;if(e.relativePos.x>=p){let h=e.relativePos.x-p,g=o.getTextDirection(s)===1;return jv.createOutsideEditor(r,new ye(s,g?1:o.getLineMaxColumn(s)),"right",h)}return null}_findMousePosition(e,t){let o=this._getPositionOutsideEditor(e);if(o)return o;let n=this._createMouseTarget(e,t);if(!n.position)return null;if(n.type===8||n.type===5){let s=this._helpPositionJumpOverViewZone(n.detail);if(s)return jv.createViewZone(n.type,n.element,n.mouseColumn,s,n.detail)}return n}_helpPositionJumpOverViewZone(e){let t=new ye(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),o=e.positionBefore,n=e.positionAfter;return o&&n?o.isBefore(t)?o:n:null}_dispatchMouse(e,t,o){e.position&&this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,revealType:o,inSelectionMode:t,mouseDownCount:this._mouseState.count,altKey:this._mouseState.altKey,ctrlKey:this._mouseState.ctrlKey,metaKey:this._mouseState.metaKey,shiftKey:this._mouseState.shiftKey,leftButton:this._mouseState.leftButton,middleButton:this._mouseState.middleButton,onInjectedText:e.type===6&&e.detail.injectedText!==null})}},Rsi=class a{static{this.CLEAR_MOUSE_DOWN_COUNT_TIME=400}get altKey(){return this._altKey}get ctrlKey(){return this._ctrlKey}get metaKey(){return this._metaKey}get shiftKey(){return this._shiftKey}get leftButton(){return this._leftButton}get middleButton(){return this._middleButton}get startedOnLineNumbers(){return this._startedOnLineNumbers}constructor(){this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._leftButton=!1,this._middleButton=!1,this._startedOnLineNumbers=!1,this._lastMouseDownPosition=null,this._lastMouseDownPositionEqualCount=0,this._lastMouseDownCount=0,this._lastSetMouseDownCountTime=0,this.isDragAndDrop=!1}get count(){return this._lastMouseDownCount}setModifiers(i){this._altKey=i.altKey,this._ctrlKey=i.ctrlKey,this._metaKey=i.metaKey,this._shiftKey=i.shiftKey}setStartButtons(i){this._leftButton=i.leftButton,this._middleButton=i.middleButton}setStartedOnLineNumbers(i){this._startedOnLineNumbers=i}trySetCount(i,e){let t=new Date().getTime();t-this._lastSetMouseDownCountTime>a.CLEAR_MOUSE_DOWN_COUNT_TIME&&(i=1),this._lastSetMouseDownCountTime=t,i>this._lastMouseDownCount+1&&(i=this._lastMouseDownCount+1),this._lastMouseDownPosition&&this._lastMouseDownPosition.equals(e)?this._lastMouseDownPositionEqualCount++:this._lastMouseDownPositionEqualCount=1,this._lastMouseDownPosition=e,this._lastMouseDownCount=Math.min(i,this._lastMouseDownPositionEqualCount)}};var Zn=class{get event(){return this.emitter.event}constructor(i,e,t){let o=n=>this.emitter.fire(n);this.emitter=new T({onWillAddFirstListener:()=>i.addEventListener(e,o,t),onDidRemoveLastListener:()=>i.removeEventListener(e,o,t)})}dispose(){this.emitter.dispose()}};var yGo=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Pyt(a){return yGo.test(a)}var ht=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);let a=new Uint8Array(16),i=[];for(let e=0;e<256;e++)i.push(e.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(a),a[6]=a[6]&15|64,a[8]=a[8]&63|128;let t=0,o="";return o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+="-",o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o+=i[a[t++]],o}})();function Ayt(a){return`${a}-${ht()}`}var oxe=class extends k{constructor(e,t){super();this.timeout=void 0;this._register($(e,"dragover",o=>{o.preventDefault(),this.timeout||(this.timeout=setTimeout(()=>{t(),this.timeout=void 0},800))})),["dragleave","drop","dragend"].forEach(o=>{this._register($(e,o,()=>{this.clearDragTimeout()}))})}clearDragTimeout(){this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0)}dispose(){super.dispose(),this.clearDragTimeout()}},Fl={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:cr.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"};function MF(a,i){return{id:i,asString:async()=>a,asFile:()=>{},value:typeof a=="string"?a:void 0}}function uYi(a,i,e,t){let o={id:ht(),name:a,uri:i,data:e};return{id:t,asString:async()=>"",asFile:()=>o,value:void 0}}var Wk=class{constructor(){this._entries=new Map}get size(){let i=0;for(let e of this._entries)i++;return i}has(i){return this._entries.has(this.toKey(i))}matches(i){let e=[...this._entries.keys()];return yt.some(this,([t,o])=>o.asFile())&&e.push("files"),pYi(Nyt(i),e)}get(i){return this._entries.get(this.toKey(i))?.[0]}append(i,e){let t=this._entries.get(i);t?t.push(e):this._entries.set(this.toKey(i),[e])}replace(i,e){this._entries.set(this.toKey(i),[e])}delete(i){this._entries.delete(this.toKey(i))}*[Symbol.iterator](){for(let[i,e]of this._entries)for(let t of e)yield[i,t]}toKey(i){return Nyt(i)}};function Nyt(a){return a.toLowerCase()}function K3e(a,i){return pYi(Nyt(a),i.map(Nyt))}function pYi(a,i){if(a==="*/*")return i.length>0;if(i.includes(a))return!0;let e=a.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!e)return!1;let[t,o,n]=e;return n==="*"?i.some(r=>r.startsWith(o+"/")):!1}var $w=Object.freeze({create:a=>jo(a.map(i=>i.toString())).join(`\r
`),split:a=>a.split(`\r
`),parse:a=>$w.split(a).filter(i=>!i.startsWith("#"))});function nxe(a){return JSON.stringify(a,wGo)}function Dm(a){let i=JSON.parse(a);return i=er(i),i}function wGo(a,i){return i instanceof RegExp?{$mid:2,source:i.source,flags:i.flags}:i}function er(a,i=0){if(!a||i>200)return a;if(typeof a=="object"){switch(a.$mid){case 1:return A.revive(a);case 2:return new RegExp(a.source,a.flags);case 17:return new Date(a.source)}if(a instanceof Ke||a instanceof Uint8Array)return a;if(Array.isArray(a))for(let e=0;e<a.length;++e)a[e]=er(a[e],i+1);else for(let e in a)Object.hasOwnProperty.call(a,e)&&(a[e]=er(a[e],i+1))}return a}var Oyt=(o=>(o[o.Ignore=0]="Ignore",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error",o))(Oyt||{});(s=>{let a="error",i="warning",e="warn",t="info",o="ignore";function n(l){return l?xr(a,l)?3:xr(i,l)||xr(e,l)?2:xr(t,l)?1:0:0}s.fromValue=n;function r(l){switch(l){case 3:return a;case 2:return i;case 1:return t;default:return o}}s.toString=r})(Oyt||={});var wt=Oyt;function gYi(a,i){let{os:e,tildify:t,relative:o}=i;if(o){let s=CGo(a,o,e);if(typeof s=="string")return s}let n=a.fsPath;if(e===1&&!ii?n=n.replace(/\//g,"\\"):e!==1&&ii&&(n=n.replace(/\\/g,"/")),e!==1&&t?.userHome){let s=t.userHome.fsPath,l;a.scheme!==t.userHome.scheme&&a.path[0]===Vo.sep&&a.path[1]!==Vo.sep?l=t.userHome.with({path:a.path}).fsPath:l=n,n=$3e(l,s,e)}return(e===1?Gs:Vo).normalize(dm(n,e===1))}function CGo(a,i,e){let t=e===1?Gs:Vo,o=e===3?Jn:Tk,n=i.getWorkspace(),r=n.folders.at(0);if(!r)return;a.scheme!==r.uri.scheme&&a.path[0]===Vo.sep&&a.path[1]!==Vo.sep&&(a=r.uri.with({path:a.path}));let s=i.getWorkspaceFolder(a);if(!s)return;let l;if(o.isEqual(s.uri,a)?l="":l=o.relativePath(s.uri,a)??"",l&&(l=t.normalize(l)),n.folders.length>1&&!i.noPrefix){let c=s.name?s.name:o.basenameOrAuthority(s.uri);l=l?`${c} \u2022 ${l}`:c}return l}function dm(a,i=ii){return pY(a,i)?a.charAt(0).toUpperCase()+a.slice(1):a}var Lsi=Object.create(null);function $3e(a,i,e=Ao){if(e===1||!a||!i)return a;let t=Lsi.original===i?Lsi.normalized:void 0;t||(t=i,ii&&(t=kz(t)),t=`${Bh(t,Vo.sep)}${Vo.sep}`,Lsi={original:i,normalized:t});let o=a;return ii&&(o=kz(o)),(e===3?o.startsWith(t):aT(o,t))?`~/${o.substr(t.length)}`:a}function aK(a,i){return a.replace(/^~($|\/|\\)/,`${i}$1`)}var mYi="\u2026",G3e="\\\\",xGo=/^[^:/\\?#]+?:\/\//,q3e="~";function rxe(a,i=Cu){let e=new Array(a.length),t=!1;for(let o=0;o<a.length;o++){let n=i,r=a[o];if(r===""){e[o]=`.${n}`;continue}if(!r){e[o]=r;continue}t=!0;let s="",l=r;xGo.test(l)?(s=l.substr(0,l.indexOf("//")+2),l=l.substr(l.indexOf("//")+2),n="/"):l.indexOf(G3e)===0?(s=l.substr(0,l.indexOf(G3e)+G3e.length),l=l.substr(l.indexOf(G3e)+G3e.length)):l.indexOf(n)===0?(s=l.substr(0,l.indexOf(n)+n.length),l=l.substr(l.indexOf(n)+n.length)):l.indexOf(q3e)===0&&(s=l.substr(0,l.indexOf(q3e)+q3e.length),l=l.substr(l.indexOf(q3e)+q3e.length));let c=l.split(n);for(let u=1;t&&u<=c.length;u++)for(let p=c.length-u;t&&p>=0;p--){t=!1;let h=c.slice(p,p+u).join(n);for(let g=0;!t&&g<a.length;g++)if(g!==o&&a[g]&&a[g].indexOf(h)>-1){let f=p+u===c.length,v=p>0&&a[g].indexOf(n)>-1?n+h:h,b=a[g].endsWith(v);t=!f||b}if(!t){let g="";(c[0].endsWith(":")||s!=="")&&(p===1&&(p=0,u++,h=c[0]+n+h),p>0&&(g=c[0]+n),g=s+g),p>0&&(g=g+mYi+n),g=g+h,p+u<c.length&&(p+u===c.length-1&&c[c.length-1]===""?g=g+n:g=g+n+mYi),e[o]=g}}t&&(e[o]=r)}return e}function Fyt(a,i=Object.create(null)){let e=[],t=!1,o="";for(let n of a)if(n==="$"||t&&n==="{")o&&e.push({value:o,type:0}),o="",t=!0;else if(n==="}"&&t){let r=i[o];if(typeof r=="string")r.length&&e.push({value:r,type:1});else if(r){let s=e[e.length-1];(!s||s.type!==2)&&e.push({value:r.label,type:2})}o="",t=!1}else o+=n;return o&&!t&&e.push({value:o,type:0}),e.filter((n,r)=>{if(n.type===2){let s=e[r-1],l=e[r+1];return[s,l].every(c=>c&&(c.type===1||c.type===0)&&c.value.length>0)}return!0}).map(n=>n.value).join("")}function M5(a,i){return et||i?a.replace(/\(&&\w\)|&&/g,"").replace(/&/g,et?"&":"&&"):a.replace(/&&|&/g,e=>e==="&"?"&&":"&")}function FB(a,i){let e=a.replace(/\(&&\w\)|&&/g,"");if(i)return e;if(et)return{withMnemonic:e,withoutMnemonic:e};let t;return ii?t=a.replace(/&&|&/g,o=>o==="&"?"&&":"&"):t=a.replace(/&&/g,"_"),{withMnemonic:t,withoutMnemonic:e}}function j3e(a){return a.replace(/&/g,"&&")}function Wyt(a){if(a.endsWith("]")){let i=a.lastIndexOf(" [",a.length-2);if(i!==-1){let e=hYi(a.substring(0,i)),t=a.substring(i);return{name:e.name+t,parentPath:e.parentPath}}}return hYi(a)}function hYi(a){let i=a.indexOf("/")!==-1?Vo:Gs,e=i.basename(a),t=i.dirname(a);return e.length?{name:e,parentPath:t}:{name:t,parentPath:""}}var ct=le("dialogService");var sxe=class{getConfirmationButtons(i){return this.getButtons(i,1)}getPromptButtons(i){return this.getButtons(i,2)}getInputButtons(i){return this.getButtons(i,3)}getButtons(i,e){let t=[];switch(e){case 1:{let o=i;o.primaryButton?t.push(o.primaryButton):t.push(d(2131,null)),o.cancelButton?t.push(o.cancelButton):t.push(d(2127,null));break}case 2:{let o=i;Array.isArray(o.buttons)&&o.buttons.length>0&&t.push(...o.buttons.map(n=>n.label)),o.cancelButton&&(o.cancelButton===!0?t.push(d(2127,null)):typeof o.cancelButton=="string"?t.push(o.cancelButton):o.cancelButton.label?t.push(o.cancelButton.label):t.push(d(2127,null))),t.length===0&&t.push(d(2130,null));break}case 3:{let o=i;o.primaryButton?t.push(o.primaryButton):t.push(d(2130,null)),o.cancelButton?t.push(o.cancelButton):t.push(d(2127,null));break}}return t}getDialogType(i){if(typeof i=="string")return i;if(typeof i=="number")return i===wt.Info?"info":i===wt.Error?"error":i===wt.Warning?"warning":"none"}getPromptResult(i,e,t){let o=[...i.buttons??[]];i.cancelButton&&typeof i.cancelButton!="string"&&typeof i.cancelButton!="boolean"&&o.push(i.cancelButton);let n=o[e]?.run({checkboxChecked:t});return n instanceof Promise||(n=Promise.resolve(n)),{result:n,checkboxChecked:t}}},nn=le("fileDialogService");var Vyt=10;function fx(a){let i=[];return i.push(...a.slice(0,Vyt).map(e=>typeof e=="string"?e:Be(e))),a.length>Vyt&&(a.length-Vyt===1?i.push(d(2128,null)):i.push(d(2129,null,a.length-Vyt))),i.push(""),i.join(`
`)}var Msi=class{constructor(){this._value="";this._pos=0}reset(i){return this._value=i,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(i){let e=i.charCodeAt(0),t=this._value.charCodeAt(this._pos);return e-t}value(){return this._value[this._pos]}},Psi=class{constructor(i=!0){this._caseSensitive=i}reset(i){return this._value=i,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let i=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(i)this._from++;else break;else i=!1;return this}cmp(i){return this._caseSensitive?cwe(i,this._value,0,i.length,this._from,this._to):Ple(i,this._value,0,i.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}},fX=class{constructor(i=!0,e=!0){this._splitOnBackslash=i;this._caseSensitive=e}reset(i){this._from=0,this._to=0,this._value=i,this._valueLen=i.length;for(let e=i.length-1;e>=0;e--,this._valueLen--){let t=this._value.charCodeAt(e);if(!(t===47||this._splitOnBackslash&&t===92))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let i=!0;for(;this._to<this._valueLen;this._to++){let e=this._value.charCodeAt(this._to);if(e===47||this._splitOnBackslash&&e===92)if(i)this._from++;else break;else i=!1}return this}cmp(i){return this._caseSensitive?cwe(i,this._value,0,i.length,this._from,this._to):Ple(i,this._value,0,i.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}};var Asi=class{constructor(i,e){this._ignorePathCasing=i;this._ignoreQueryAndFragment=e;this._states=[];this._stateIdx=0}reset(i){return this._value=i,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new fX(!1,!this._ignorePathCasing(i)),this._pathIterator.reset(i.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(i)||(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(i){if(this._states[this._stateIdx]===1)return MS(i,this._value.scheme);if(this._states[this._stateIdx]===2)return MS(i,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(i);if(this._states[this._stateIdx]===4)return oc(i,this._value.query);if(this._states[this._stateIdx]===5)return oc(i,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}},P5=class a{static{this.Val=Symbol("undefined_placeholder")}static wrap(i){return i===void 0?a.Val:i}static unwrap(i){return i===a.Val?void 0:i}},axe=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 i=this.right;return this.right=i.left,i.left=this,this.updateHeight(),i.updateHeight(),i}rotateRight(){let i=this.left;return this.left=i.right,i.right=this,this.updateHeight(),i.updateHeight(),i}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 Hp=class a{static forUris(i=()=>!1,e=()=>!1){return new a(new Asi(i,e))}static forPaths(i=!1){return new a(new fX(void 0,!i))}static forStrings(){return new a(new Msi)}static forConfigKeys(){return new a(new Psi)}constructor(i){this._iter=i}clear(){this._root=void 0}fill(i,e){if(e){let t=e.slice(0);nY(t);for(let o of t)this.set(o,i)}else{let t=i.slice(0);nY(t);for(let o of t)this.set(o[0],o[1])}}set(i,e){let t=this._iter.reset(i),o;this._root||(this._root=new axe,this._root.segment=t.value());let n=[];for(o=this._root;;){let s=t.cmp(o.segment);if(s>0)o.left||(o.left=new axe,o.left.segment=t.value()),n.push([-1,o]),o=o.left;else if(s<0)o.right||(o.right=new axe,o.right.segment=t.value()),n.push([1,o]),o=o.right;else if(t.hasNext())t.next(),o.mid||(o.mid=new axe,o.mid.segment=t.value()),n.push([0,o]),o=o.mid;else break}let r=P5.unwrap(o.value);o.value=P5.wrap(e),o.key=i;for(let s=n.length-1;s>=0;s--){let l=n[s][1];l.updateHeight();let c=l.balanceFactor();if(c<-1||c>1){let u=n[s][0],p=n[s+1][0];if(u===1&&p===1)n[s][1]=l.rotateLeft();else if(u===-1&&p===-1)n[s][1]=l.rotateRight();else if(u===1&&p===-1)l.right=n[s+1][1]=n[s+1][1].rotateRight(),n[s][1]=l.rotateLeft();else if(u===-1&&p===1)l.left=n[s+1][1]=n[s+1][1].rotateLeft(),n[s][1]=l.rotateRight();else throw new Error;if(s>0)switch(n[s-1][0]){case-1:n[s-1][1].left=n[s][1];break;case 1:n[s-1][1].right=n[s][1];break;case 0:n[s-1][1].mid=n[s][1];break}else this._root=n[0][1]}}return r}get(i){return P5.unwrap(this._getNode(i)?.value)}_getNode(i){let e=this._iter.reset(i),t=this._root;for(;t;){let o=e.cmp(t.segment);if(o>0)t=t.left;else if(o<0)t=t.right;else if(e.hasNext())e.next(),t=t.mid;else break}return t}has(i){let e=this._getNode(i);return!(e?.value===void 0&&e?.mid===void 0)}delete(i){return this._delete(i,!1)}deleteSuperstr(i){return this._delete(i,!0)}_delete(i,e){let t=this._iter.reset(i),o=[],n=this._root;for(;n;){let r=t.cmp(n.segment);if(r>0)o.push([-1,n]),n=n.left;else if(r<0)o.push([1,n]),n=n.right;else if(t.hasNext())t.next(),o.push([0,n]),n=n.mid;else break}if(n){if(e?(n.left=void 0,n.mid=void 0,n.right=void 0,n.height=1):(n.key=void 0,n.value=void 0),!n.mid&&!n.value)if(n.left&&n.right){let r=[[1,n]],s=this._min(n.right,r);if(s.key){n.key=s.key,n.value=s.value,n.segment=s.segment;let l=s.right;if(r.length>1){let[u,p]=r[r.length-1];switch(u){case-1:p.left=l;break;case 0:Aw(!1);case 1:Aw(!1)}}else n.right=l;let c=this._balanceByStack(r);if(o.length>0){let[u,p]=o[o.length-1];switch(u){case-1:p.left=c;break;case 0:p.mid=c;break;case 1:p.right=c;break}}else this._root=c}}else{let r=n.left??n.right;if(o.length>0){let[s,l]=o[o.length-1];switch(s){case-1:l.left=r;break;case 0:l.mid=r;break;case 1:l.right=r;break}}else this._root=r}this._root=this._balanceByStack(o)??this._root}}_min(i,e){for(;i.left;)e.push([-1,i]),i=i.left;return i}_balanceByStack(i){for(let e=i.length-1;e>=0;e--){let t=i[e][1];t.updateHeight();let o=t.balanceFactor();if(o>1?(t.right.balanceFactor()>=0||(t.right=t.right.rotateRight()),i[e][1]=t.rotateLeft()):o<-1&&(t.left.balanceFactor()<=0||(t.left=t.left.rotateLeft()),i[e][1]=t.rotateRight()),e>0)switch(i[e-1][0]){case-1:i[e-1][1].left=i[e][1];break;case 1:i[e-1][1].right=i[e][1];break;case 0:i[e-1][1].mid=i[e][1];break}else return i[0][1]}}findSubstr(i){let e=this._iter.reset(i),t=this._root,o;for(;t;){let n=e.cmp(t.segment);if(n>0)t=t.left;else if(n<0)t=t.right;else if(e.hasNext())e.next(),o=P5.unwrap(t.value)||o,t=t.mid;else break}return t&&P5.unwrap(t.value)||o}findSuperstr(i){return this._findSuperstrOrElement(i,!1)}_findSuperstrOrElement(i,e){let t=this._iter.reset(i),o=this._root;for(;o;){let n=t.cmp(o.segment);if(n>0)o=o.left;else if(n<0)o=o.right;else if(t.hasNext())t.next(),o=o.mid;else return o.mid?this._entries(o.mid):e?P5.unwrap(o.value):void 0}}hasElementOrSubtree(i){return this._findSuperstrOrElement(i,!0)!==void 0}forEach(i){for(let[e,t]of this)i(t,e)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(i){let e=[];return this._dfsEntries(i,e),e[Symbol.iterator]()}_dfsEntries(i,e){i&&(i.left&&this._dfsEntries(i.left,e),i.value!==void 0&&e.push([i.key,P5.unwrap(i.value)]),i.mid&&this._dfsEntries(i.mid,e),i.right&&this._dfsEntries(i.right,e))}_isBalanced(){let i=e=>{if(!e)return!0;let t=e.balanceFactor();return t<-1||t>1?!1:i(e.left)&&i(e.right)};return i(this._root)}};var ge=le("fileService");function fYi(a){return a.create===!0}function yD(a){return!!(a.capabilities&2)}function vYi(a){return!!(a.capabilities&524288)}function Q3e(a){return!!(a.capabilities&8)}function Byt(a){return!!(a.capabilities&131072)}function bYi(a){return!!(a.capabilities&262144)}function A5(a){return!!(a.capabilities&4)}function Hyt(a){return!!(a.capabilities&16)}function Uyt(a){return yD(a)?!!(a.capabilities&16384):!1}function Nsi(a){return yD(a)?!!(a.capabilities&32768):!1}function SYi(a){return!!(a.capabilities&65536)}function IYi(a){return!!(a.capabilities&2048)}var lxe=class a extends Error{constructor(e,t){super(e);this.code=t}static create(e,t){let o=new a(e.toString(),t);return Osi(o,t),o}};function Ys(a,i){return lxe.create(a,i)}function N5(a){return a||Ys(d(2326,null),"Unknown")}function Osi(a,i){return a.name=i?`${i} (FileSystemError)`:"FileSystemError",a}function O5(a){if(!a)return"Unknown";if(a instanceof lxe)return a.code;let i=/^(.+) \(FileSystemError\)$/.exec(a.name);if(!i)return"Unknown";switch(i[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 rp(a){if(a instanceof ua)return a.fileOperationResult;switch(O5(a)){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 PF=class{constructor(i,e,t){this.resource=i;this.operation=e;this.target=t}isOperation(i){return this.operation===i}};var AF=class a{constructor(i,e){this.ignorePathCasing=e;this.correlationId=void 0;this.added=new uo(()=>{let i=Hp.forUris(()=>this.ignorePathCasing);return i.fill(this.rawAdded.map(e=>[e,!0])),i});this.updated=new uo(()=>{let i=Hp.forUris(()=>this.ignorePathCasing);return i.fill(this.rawUpdated.map(e=>[e,!0])),i});this.deleted=new uo(()=>{let i=Hp.forUris(()=>this.ignorePathCasing);return i.fill(this.rawDeleted.map(e=>[e,!0])),i});this.rawAdded=[];this.rawUpdated=[];this.rawDeleted=[];for(let t of i){switch(t.type){case 1:this.rawAdded.push(t.resource);break;case 0:this.rawUpdated.push(t.resource);break;case 2:this.rawDeleted.push(t.resource);break}this.correlationId!==a.MIXED_CORRELATION&&(typeof t.cId=="number"?this.correlationId===void 0?this.correlationId=t.cId:this.correlationId!==t.cId&&(this.correlationId=a.MIXED_CORRELATION):this.correlationId!==void 0&&(this.correlationId=a.MIXED_CORRELATION))}}static{this.MIXED_CORRELATION=null}contains(i,...e){return this.doContains(i,{includeChildren:!1},...e)}affects(i,...e){return this.doContains(i,{includeChildren:!0},...e)}doContains(i,e,...t){if(!i)return!1;let o=t.length>0;return!!((!o||t.includes(1))&&(this.added.value.get(i)||e.includeChildren&&this.added.value.findSuperstr(i))||(!o||t.includes(0))&&(this.updated.value.get(i)||e.includeChildren&&this.updated.value.findSuperstr(i))||(!o||t.includes(2))&&(this.deleted.value.findSubstr(i)||e.includeChildren&&this.deleted.value.findSuperstr(i)))}gotAdded(){return this.rawAdded.length>0}gotDeleted(){return this.rawDeleted.length>0}gotUpdated(){return this.rawUpdated.length>0}correlates(i){return this.correlationId===i}hasCorrelation(){return typeof this.correlationId=="number"}};var ua=class extends Error{constructor(e,t,o){super(e);this.fileOperationResult=t;this.options=o}},NF=class extends ua{constructor(e,t,o,n){super(e,t,n);this.fileOperationResult=t;this.size=o}},lK=class extends ua{constructor(e,t,o){super(e,2,o);this.stat=t}};var Qv={OFF:"off",AFTER_DELAY:"afterDelay",ON_FOCUS_CHANGE:"onFocusChange",ON_WINDOW_CHANGE:"onWindowChange"},PI={OFF:"off",ON_EXIT:"onExit",ON_EXIT_AND_WINDOW_CLOSE:"onExitAndWindowClose"},F5="files.associations",zyt="files.exclude",Kyt="files.readonlyInclude",Gyt="files.readonlyExclude",yYi="files.readonlyFromPermissions",$u=(t=>(t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER",t))($u||{}),GL="";function Fsi(a){if(!(typeof a.size!="number"||typeof a.mtime!="number"))return a.mtime.toString(29)+a.size.toString(31)}async function Wsi(a,i){if(!i.hasProvider(A.from({scheme:a.scheme})))return new Promise(e=>{let t=i.onDidChangeFileSystemProviderRegistrations(o=>{o.scheme===a.scheme&&o.added&&(t.dispose(),e())})})}var Ml=class a{static{this.KB=1024}static{this.MB=a.KB*a.KB}static{this.GB=a.MB*a.KB}static{this.TB=a.GB*a.KB}static formatSize(i){return on(i)||(i=0),i<a.KB?d(2321,null,i.toFixed(0)):i<a.MB?d(2323,null,(i/a.KB).toFixed(2)):i<a.GB?d(2324,null,(i/a.MB).toFixed(2)):i<a.TB?d(2322,null,(i/a.GB).toFixed(2)):d(2325,null,(i/a.TB).toFixed(2))}};function qyt(a){let i=typeof a=="string"||a?.scheme===Q.vscodeRemote;return typeof a!="string"&&a?.scheme===Q.file?1024*Ml.MB:i?10*Ml.MB:Ft?50*Ml.MB:1024*Ml.MB}var Vk;(o=>{function a(n){return typeof n?.showDirectoryPicker=="function"}o.supported=a;function i(n){let r=n;return r?typeof r.kind=="string"&&typeof r.queryPermission=="function"&&typeof r.requestPermission=="function":!1}o.isFileSystemHandle=i;function e(n){return n.kind==="file"}o.isFileSystemFileHandle=e;function t(n){return n.kind==="directory"}o.isFileSystemDirectoryHandle=t})(Vk||={});var Vsi;(i=>{function a(e){return typeof e?.FileSystemObserver=="function"}i.supported=a})(Vsi||={});var $yt=class extends k{constructor(e,t,o){super();this.indexedDB=e;this.store=t;this.logService=o;this.onDidChangeCapabilities=U.None;this.extUri=Sn?Jn:Tk;this._onDidChangeFileEmitter=this._register(new T);this.onDidChangeFile=this._onDidChangeFileEmitter.event;this._files=new Map;this._directories=new Map}get capabilities(){return this._capabilities||(this._capabilities=18,Sn&&(this._capabilities|=1024)),this._capabilities}async stat(e){try{let t=await this.getHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, stat","EntryNotFound");if(Vk.isFileSystemFileHandle(t)){let o=await t.getFile();return{type:1,mtime:o.lastModified,ctime:0,size:o.size}}return{type:2,mtime:0,ctime:0,size:0}}catch(t){throw this.toFileSystemProviderError(t)}}async readdir(e){try{let t=await this.getDirectoryHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, readdir","EntryNotFound");let o=[];for await(let[n,r]of t)o.push([n,Vk.isFileSystemFileHandle(r)?1:2]);return o}catch(t){throw this.toFileSystemProviderError(t)}}readFileStream(e,t,o){let n=Ty(r=>Ke.concat(r.map(s=>Ke.wrap(s))).buffer,{highWaterMark:10});return(async()=>{try{let r=await this.getFileHandle(e);if(!r)throw this.createFileSystemProviderError(e,"No such file or directory, readFile","EntryNotFound");let s=await r.getFile();if(typeof t.length=="number"||typeof t.position=="number"){let l=new Uint8Array(await s.arrayBuffer());typeof t?.position=="number"&&(l=l.slice(t.position)),typeof t?.length=="number"&&(l=l.slice(0,t.length)),n.end(l)}else{let l=s.stream().getReader(),c=await l.read();for(;!c.done&&!(o.isCancellationRequested||(await n.write(c.value),o.isCancellationRequested));)c=await l.read();n.end(void 0)}}catch(r){n.error(this.toFileSystemProviderError(r)),n.end()}})(),n}async readFile(e){try{let t=await this.getFileHandle(e);if(!t)throw this.createFileSystemProviderError(e,"No such file or directory, readFile","EntryNotFound");let o=await t.getFile();return new Uint8Array(await o.arrayBuffer())}catch(t){throw this.toFileSystemProviderError(t)}}async writeFile(e,t,o){try{let n=await this.getFileHandle(e);if(!o.create||!o.overwrite){if(n){if(!o.overwrite)throw this.createFileSystemProviderError(e,"File already exists, writeFile","EntryExists")}else if(!o.create)throw this.createFileSystemProviderError(e,"No such file, writeFile","EntryNotFound")}if(!n){let s=await this.getDirectoryHandle(this.extUri.dirname(e));if(!s)throw this.createFileSystemProviderError(e,"No such parent directory, writeFile","EntryNotFound");if(n=await s.getFileHandle(this.extUri.basename(e),{create:!0}),!n)throw this.createFileSystemProviderError(e,"Unable to create file , writeFile","Unknown")}let r=await n.createWritable();await r.write(t),await r.close()}catch(n){throw this.toFileSystemProviderError(n)}}async mkdir(e){try{let t=await this.getDirectoryHandle(this.extUri.dirname(e));if(!t)throw this.createFileSystemProviderError(e,"No such parent directory, mkdir","EntryNotFound");await t.getDirectoryHandle(this.extUri.basename(e),{create:!0})}catch(t){throw this.toFileSystemProviderError(t)}}async delete(e,t){try{let o=await this.getDirectoryHandle(this.extUri.dirname(e));if(!o)throw this.createFileSystemProviderError(e,"No such parent directory, delete","EntryNotFound");return o.removeEntry(this.extUri.basename(e),{recursive:t.recursive})}catch(o){throw this.toFileSystemProviderError(o)}}async rename(e,t,o){try{if(this.extUri.isEqual(e,t))return;let n=await this.getFileHandle(e);if(n){let r=await n.getFile(),s=new Uint8Array(await r.arrayBuffer());await this.writeFile(t,s,{create:!0,overwrite:o.overwrite,unlock:!1,atomic:!1}),await this.delete(e,{recursive:!1,useTrash:!1,atomic:!1})}else throw this.createFileSystemProviderError(e,d(2320,null),"Unavailable")}catch(n){throw this.toFileSystemProviderError(n)}}watch(e,t){let o=new O;return this.doWatch(e,t,o).catch(n=>this.logService.error(`[File Watcher ('FileSystemObserver')] Error: ${n} (${e})`)),o}async doWatch(e,t,o){if(!Vsi.supported(globalThis))return;let n=await this.getHandle(e);if(!n||o.isDisposed)return;let r=new globalThis.FileSystemObserver(s=>{if(o.isDisposed)return;let l=[];for(let c of s)switch(this.logService.getLevel()===1&&this.logService.trace(`[File Watcher ('FileSystemObserver')] [${c.type}] ${Ve(e,...c.relativePathComponents)}`),c.type){case"appeared":l.push({resource:Ve(e,...c.relativePathComponents),type:1});break;case"disappeared":l.push({resource:Ve(e,...c.relativePathComponents),type:2});break;case"modified":l.push({resource:Ve(e,...c.relativePathComponents),type:0});break;case"errored":this.logService.trace(`[File Watcher ('FileSystemObserver')] errored, disposing observer (${e})`),o.dispose()}l.length&&this._onDidChangeFileEmitter.fire(l)});try{await r.observe(n,t.recursive?{recursive:!0}:void 0)}finally{o.isDisposed?r.disconnect():o.add(ee(()=>r.disconnect()))}}registerFileHandle(e){return this.registerHandle(e,this._files)}registerDirectoryHandle(e){return this.registerHandle(e,this._directories)}get directories(){return this._directories.values()}async registerHandle(e,t){let o=`/${e.name}`;if(t.has(o)&&!await t.get(o)?.isSameEntry(e)){let n=km(e.name),r=Jo(e.name,n),s=1;do o=`/${r}-${s++}${n}`;while(t.has(o)&&!await t.get(o)?.isSameEntry(e))}t.set(o,e);try{await this.indexedDB?.runInTransaction(this.store,"readwrite",n=>n.put(e,o))}catch(n){this.logService.error(n)}return A.from({scheme:Q.file,path:o})}async getHandle(e){let t=await this.doGetHandle(e);if(!t){let o=await this.getDirectoryHandle(this.extUri.dirname(e));if(o){let n=Jn.basename(e);try{t=await o.getFileHandle(n)}catch{try{t=await o.getDirectoryHandle(n)}catch{}}}}return t}async getFileHandle(e){let t=await this.doGetHandle(e);if(t instanceof FileSystemFileHandle)return t;let o=await this.getDirectoryHandle(this.extUri.dirname(e));try{return await o?.getFileHandle(Jn.basename(e))}catch{return}}async getDirectoryHandle(e){let t=await this.doGetHandle(e);if(t instanceof FileSystemDirectoryHandle)return t;let o=this.extUri.dirname(e);if(this.extUri.isEqual(o,e))return;let n=await this.getDirectoryHandle(o);try{return await n?.getDirectoryHandle(Jn.basename(e))}catch{return}}async doGetHandle(e){if(this.extUri.dirname(e).path!=="/")return;let t=e.path.replace(/\/$/,""),o=this._files.get(t)??this._directories.get(t);if(o)return o;let n=await this.indexedDB?.runInTransaction(this.store,"readonly",r=>r.get(t));if(Vk.isFileSystemHandle(n)){let r=await n.queryPermission()==="granted";try{r||(r=await n.requestPermission()==="granted")}catch(s){this.logService.error(s)}if(r)return Vk.isFileSystemFileHandle(n)?this._files.set(t,n):Vk.isFileSystemDirectoryHandle(n)&&this._directories.set(t,n),n}throw this.createFileSystemProviderError(e,"No file system handle registered","Unavailable")}toFileSystemProviderError(e){if(e instanceof lxe)return e;let t="Unknown";return e.name==="NotAllowedError"&&(e=new Error(d(2319,null)),t="Unavailable"),Ys(e,t)}createFileSystemProviderError(e,t,o){return Ys(new Error(`${t} (${Vh(e.path)})`),o)}};var Je=le("openerService");function $L(a,i){return a.with({fragment:`${i.startLineNumber},${i.startColumn}${i.endLineNumber?`-${i.endLineNumber}${i.endColumn?`,${i.endColumn}`:""}`:""}`})}function cxe(a){let i,e=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(a.fragment);return e&&(i={startLineNumber:parseInt(e[1]),startColumn:e[2]?parseInt(e[2]):1,endLineNumber:e[4]?parseInt(e[4]):void 0,endColumn:e[4]?e[5]?parseInt(e[5]):1:void 0},a=a.with({fragment:""})),{selection:i,uri:a}}var Mc={EDITORS:"CodeEditors",FILES:"CodeFiles",SYMBOLS:"application/vnd.code.symbols",MARKERS:"application/vnd.code.diagnostics",NOTEBOOK_CELL_OUTPUT:"notebook-cell-output",SCM_HISTORY_ITEM:"scm-history-item"};function Hsi(a){let i=[];if(a.dataTransfer&&a.dataTransfer.types.length>0){let o=a.dataTransfer.getData(Mc.EDITORS);if(o)try{i.push(...Dm(o))}catch{}else try{let s=a.dataTransfer.getData(Fl.RESOURCES);i.push(...Usi(s))}catch{}if(a.dataTransfer?.files)for(let s=0;s<a.dataTransfer.files.length;s++){let l=a.dataTransfer.files[s];if(l&&wD(l))try{i.push({resource:A.file(wD(l)),isExternal:!0,allowWorkspaceOpen:!0})}catch{}}let n=a.dataTransfer.getData(Mc.FILES);if(n)try{let s=JSON.parse(n);for(let l of s)i.push({resource:A.file(l),isExternal:!0,allowWorkspaceOpen:!0})}catch{}let r=oe.as(WB.DragAndDropContribution).getAll();for(let s of r){let l=a.dataTransfer.getData(s.dataFormatKey);if(l)try{i.push(...s.getEditorInputs(l))}catch{}}}let e=[],t=new dt;for(let o of i)o.resource?t.has(o.resource)||(e.push(o),t.set(o.resource,!0)):e.push(o);return e}async function dxe(a,i){let e=Hsi(i);if(i.dataTransfer&&Ft&&Up(i,Fl.FILES)&&i.dataTransfer.items){let n=await a.get(F).invokeFunction(r=>kGo(r,i));for(let r of n)e.push({resource:r.resource,contents:r.contents?.toString(),isExternal:!0,allowWorkspaceOpen:r.isDirectory})}return e}function Usi(a){let i=[];if(a){let e=JSON.parse(a);for(let t of e)if(t.indexOf(":")>0){let{selection:o,uri:n}=cxe(A.parse(t));i.push({resource:n,options:{selection:o}})}}return i}async function kGo(a,i){if(Vk.supported(ut)){let t=i.dataTransfer?.items;if(t)return EGo(a,t)}let e=i.dataTransfer?.files;return e?TGo(a,e):[]}async function EGo(a,i){let e=a.get(ge).getProvider(Q.file);if(!(e instanceof $yt))return[];let t=[];for(let o=0;o<i.length;o++){let n=i[o];if(n){let r=new Mo;t.push(r),(async()=>{try{let s=await n.getAsFileSystemHandle();if(!s){r.complete(void 0);return}Vk.isFileSystemFileHandle(s)?r.complete({resource:await e.registerFileHandle(s),isDirectory:!1}):Vk.isFileSystemDirectoryHandle(s)?r.complete({resource:await e.registerDirectoryHandle(s),isDirectory:!0}):r.complete(void 0)}catch{r.complete(void 0)}})()}}return ui(await Promise.all(t.map(o=>o.p)))}async function TGo(a,i){let e=a.get(ct),t=[];for(let o=0;o<i.length;o++){let n=i.item(o);if(n){if(n.size>100*Ml.MB){e.warn(d(2139,null));continue}let r=new Mo;t.push(r);let s=new FileReader;s.onerror=()=>r.complete(void 0),s.onabort=()=>r.complete(void 0),s.onload=async l=>{let c=n.name,u=l.target?.result??void 0;if(typeof c!="string"||typeof u>"u"){r.complete(void 0);return}r.complete({resource:A.from({scheme:Q.untitled,path:c}),contents:typeof u=="string"?Ke.fromString(u):Ke.wrap(new Uint8Array(u))})},s.readAsArrayBuffer(n)}}return ui(await Promise.all(t.map(o=>o.p)))}function Up(a,...i){if(!a.dataTransfer)return!1;let e=a.dataTransfer.types,t=[];for(let o=0;o<e.length;o++)t.push(e[o].toLowerCase());for(let o of i)if(t.indexOf(o.toLowerCase())>=0)return!0;return!1}var Bsi=class{constructor(){this._contributions=new Map;this._dropHandlers=new Set}register(i){if(this._contributions.has(i.dataFormatKey))throw new Error(`A drag and drop contributiont with key '${i.dataFormatKey}' was already registered.`);this._contributions.set(i.dataFormatKey,i)}getAll(){return this._contributions.values()}registerDropHandler(i){return this._dropHandlers.add(i),ee(()=>this._dropHandlers.delete(i))}async handleResourceDrop(i,e){for(let t of this._dropHandlers)if(await t.handleDrop(i,e))return!0;return!1}},WB={DragAndDropContribution:"workbench.contributions.dragAndDrop"};oe.add(WB.DragAndDropContribution,new Bsi);var Vy=class a{static{this.INSTANCE=new a}constructor(){}static getInstance(){return a.INSTANCE}hasData(i){return i&&i===this.proto}clearData(i){this.hasData(i)&&(this.proto=void 0,this.data=void 0)}getData(i){if(this.hasData(i))return this.data}setData(i,e){e&&(this.data=i,this.proto=e)}};function wYi(a,i,e){a.dataTransfer?.setData(i,JSON.stringify(e))}function zsi(a,i,e){let t=a.dataTransfer?.getData(i);if(t)try{return JSON.parse(t)}catch{}return e}function CYi(a){return zsi(a,Mc.SYMBOLS,[])}function uxe(a,i){wYi(i,Mc.SYMBOLS,a)}function xYi(a){return zsi(a,Mc.MARKERS,void 0)}function kYi(a,i){wYi(i,Mc.MARKERS,a)}function EYi(a){return zsi(a,Mc.NOTEBOOK_CELL_OUTPUT,void 0)}function wD(a){if(Qr&&typeof globalThis.vscode?.webUtils?.getPathForFile=="function")return globalThis.vscode?.webUtils?.getPathForFile(a)}function _Go(a){let i=new Wk;for(let e of a.items){let t=e.type;if(e.kind==="string"){let o=new Promise(n=>e.getAsString(n));i.append(t,MF(o))}else if(e.kind==="file"){let o=e.getAsFile();o&&i.append(t,DGo(o))}}return i}function DGo(a){let i=wD(a),e=i?A.parse(i):void 0;return uYi(a.name,e,async()=>new Uint8Array(await a.arrayBuffer()))}var RGo=Object.freeze([Mc.EDITORS,Mc.FILES,Fl.RESOURCES,Fl.INTERNAL_URI_LIST]);function Zce(a,i=!1){let e=_Go(a),t=e.get(Fl.INTERNAL_URI_LIST);if(t)e.replace(cr.uriList,t);else if(i||!e.has(cr.uriList)){let o=[];for(let n of a.items){let r=n.getAsFile();if(r){let s=wD(r);try{s?o.push(A.file(s).toString()):o.push(A.parse(r.name,!0).toString())}catch{}}}o.length&&e.replace(cr.uriList,MF($w.create(o)))}for(let o of RGo)e.delete(o);return e}function TYi(a,i,e){let{dataToCopy:t,metadata:o}=DYi(a);return _Yi(t.text,o,e),{dataToCopy:t,metadata:o}}function _Yi(a,i,e){vX.INSTANCE.set(e?a.replace(/\r\n/g,`
`):a,i)}function DYi(a){let i=a.getEditorOption(45),e=a.getEditorOption(31),t=a.getCursorStates().map(r=>r.modelState.selection),o=LGo(a,t,i,e),n={version:1,id:ht(),isFromEmptySelection:o.isFromEmptySelection,multicursorText:o.multicursorText,mode:o.mode};return{dataToCopy:o,metadata:n}}function LGo(a,i,e,t){let{sourceRanges:o,sourceText:n}=a.getPlainTextToCopy(i,e,ii),r=a.model.getEOL(),s=e&&i.length===1&&i[0].isEmpty(),l=Array.isArray(n)?n:null,c=Array.isArray(n)?n.join(r):n,u,p=null;if(cK.forceCopyWithSyntaxHighlighting||t&&n.length<65536){let g=a.getRichTextToCopy(i,e);g&&(u=g.html,p=g.mode)}return{isFromEmptySelection:s,sourceRanges:o,multicursorText:l,text:c,html:u,mode:p}}var vX=class a{static{this.INSTANCE=new a}constructor(){this._lastState=null}set(i,e){this._lastState={lastCopiedValue:i,data:e}}get(i){return this._lastState&&this._lastState.lastCopiedValue===i?this._lastState.data:(this._lastState=null,null)}},cK={forceCopyWithSyntaxHighlighting:!1,electronBugWorkaroundCopyEventHasFired:!1},RYi={getTextData(a){let i=a.getData(cr.text),e=null,t=a.getData("vscode-editor-data");if(typeof t=="string")try{e=JSON.parse(t),e.version!==1&&(e=null)}catch{}return i.length===0&&e===null&&a.files.length>0?[Array.prototype.slice.call(a.files,0).map(n=>n.name).join(`
`),null]:[i,e]},setTextData(a,i,e,t){a.setData(cr.text,i),typeof e=="string"&&a.setData("text/html",e),a.setData("vscode-editor-data",JSON.stringify(t))}};function pxe(a,i,e,t,o){let{dataToCopy:n,metadata:r}=DYi(e.viewModel),s=!1;return{isCut:i,clipboardData:{setData:(l,c)=>{a.clipboardData?.setData(l,c)}},dataToCopy:n,ensureClipboardGetsEditorData:()=>{a.preventDefault(),a.clipboardData&&RYi.setTextData(a.clipboardData,n.text,n.html,r),_Yi(n.text,r,o),t.trace("ensureClipboardGetsEditorSelection with id : ",r.id," with text.length: ",n.text.length)},setHandled:()=>{s=!0,a.preventDefault(),a.stopImmediatePropagation()},get isHandled(){return s}}}function jyt(a){let i=!1,[e,t]=a.clipboardData?RYi.getTextData(a.clipboardData):["",null];return t=t||vX.INSTANCE.get(e),{clipboardData:MGo(a.clipboardData),metadata:t,text:e,toExternalVSDataTransfer:()=>a.clipboardData?Zce(a.clipboardData):void 0,browserEvent:a,setHandled:()=>{i=!0,a.preventDefault(),a.stopImmediatePropagation()},get isHandled(){return i}}}function MGo(a){return{types:Array.from(a?.types??[]),files:Array.prototype.slice.call(a?.files??[],0),getData:i=>a?.getData(i)??""}}var CD=!1,AI=class a{constructor(i,e,t,o,n){this.value=i;this.selectionStart=e;this.selectionEnd=t;this.selection=o;this.newlineCountBeforeSelection=n}static{this.EMPTY=new a("",0,0,null,void 0)}toString(){return`[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`}static readFromTextArea(i,e){let t=i.getValue(),o=i.getSelectionStart(),n=i.getSelectionEnd(),r;if(e){let s=t.substring(0,o),l=e.value.substring(0,e.selectionStart);s===l&&(r=e.newlineCountBeforeSelection)}return new a(t,o,n,null,r)}collapseSelection(){return this.selectionStart===this.value.length?this:new a(this.value,this.value.length,this.value.length,null,void 0)}isWrittenToTextArea(i,e){let t=this.value===i.getValue();return e?this.selectionStart===i.getSelectionStart()&&this.selectionEnd===i.getSelectionEnd()&&t:t}writeToTextArea(i,e,t){CD&&console.log(`writeToTextArea ${i}: ${this.toString()}`),e.setValue(i,this.value),t&&e.setSelectionRange(i,this.selectionStart,this.selectionEnd)}deduceEditorPosition(i){if(i<=this.selectionStart){let o=this.value.substring(i,this.selectionStart);return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,o,-1)}if(i>=this.selectionEnd){let o=this.value.substring(this.selectionEnd,i);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,o,1)}let e=this.value.substring(this.selectionStart,i);if(e.indexOf("\u2026")===-1)return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,e,1);let t=this.value.substring(i,this.selectionEnd);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,t,-1)}_finishDeduceEditorPosition(i,e,t){let o=0,n=-1;for(;(n=e.indexOf(`
`,n+1))!==-1;)o++;return[i,t*e.length,o]}static deduceInput(i,e,t){if(!i)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};CD&&(console.log("------------------------deduceInput"),console.log(`PREVIOUS STATE: ${i.toString()}`),console.log(`CURRENT STATE: ${e.toString()}`));let o=Math.min(Af(i.value,e.value),i.selectionStart,e.selectionStart),n=Math.min(lx(i.value,e.value),i.value.length-i.selectionEnd,e.value.length-e.selectionEnd),r=i.value.substring(o,i.value.length-n),s=e.value.substring(o,e.value.length-n),l=i.selectionStart-o,c=i.selectionEnd-o,u=e.selectionStart-o,p=e.selectionEnd-o;if(CD&&(console.log(`AFTER DIFFING PREVIOUS STATE: <${r}>, selectionStart: ${l}, selectionEnd: ${c}`),console.log(`AFTER DIFFING CURRENT STATE: <${s}>, selectionStart: ${u}, selectionEnd: ${p}`)),u===p){let g=i.selectionStart-o;return CD&&console.log(`REMOVE PREVIOUS: ${g} chars`),{text:s,replacePrevCharCnt:g,replaceNextCharCnt:0,positionDelta:0}}let h=c-l;return{text:s,replacePrevCharCnt:h,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(i,e){if(!i)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(CD&&(console.log("------------------------deduceAndroidCompositionInput"),console.log(`PREVIOUS STATE: ${i.toString()}`),console.log(`CURRENT STATE: ${e.toString()}`)),i.value===e.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:e.selectionEnd-i.selectionEnd};let t=Math.min(Af(i.value,e.value),i.selectionEnd),o=Math.min(lx(i.value,e.value),i.value.length-i.selectionEnd),n=i.value.substring(t,i.value.length-o),r=e.value.substring(t,e.value.length-o),s=i.selectionStart-t,l=i.selectionEnd-t,c=e.selectionStart-t,u=e.selectionEnd-t;return CD&&(console.log(`AFTER DIFFING PREVIOUS STATE: <${n}>, selectionStart: ${s}, selectionEnd: ${l}`),console.log(`AFTER DIFFING CURRENT STATE: <${r}>, selectionStart: ${c}, selectionEnd: ${u}`)),{text:r,replacePrevCharCnt:l,replaceNextCharCnt:n.length-l,positionDelta:u-r.length}}static fromScreenReaderContentState(i){let e,t;switch(i.selection.getDirection()){case 0:e=i.selectionStart,t=i.selectionEnd;break;case 1:e=i.selectionEnd,t=i.selectionStart;break}return new a(i.value,e,t,i.selection,i.newlineCountBeforeSelection)}};var Yyt;(i=>i.Tap="-monaco-textarea-synthetic-tap")(Yyt||={});var Ksi=class{constructor(){this._lastTypeTextLength=0}handleCompositionUpdate(i){i=i||"";let e={text:i,replacePrevCharCnt:this._lastTypeTextLength,replaceNextCharCnt:0,positionDelta:0};return this._lastTypeTextLength=i.length,e}},mxe=class extends k{constructor(e,t,o,n,r,s){super();this._host=e;this._textArea=t;this._OS=o;this._browser=n;this._accessibilityService=r;this._logService=s;this._onFocus=this._register(new T);this.onFocus=this._onFocus.event;this._onBlur=this._register(new T);this.onBlur=this._onBlur.event;this._onKeyDown=this._register(new T);this.onKeyDown=this._onKeyDown.event;this._onKeyUp=this._register(new T);this.onKeyUp=this._onKeyUp.event;this._onCut=this._register(new T);this.onCut=this._onCut.event;this._onPaste=this._register(new T);this.onPaste=this._onPaste.event;this._onWillCopy=this._register(new T);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new T);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new T);this.onWillPaste=this._onWillPaste.event;this._onType=this._register(new T);this.onType=this._onType.event;this._onCompositionStart=this._register(new T);this.onCompositionStart=this._onCompositionStart.event;this._onCompositionUpdate=this._register(new T);this.onCompositionUpdate=this._onCompositionUpdate.event;this._onCompositionEnd=this._register(new T);this.onCompositionEnd=this._onCompositionEnd.event;this._onSelectionChangeRequest=this._register(new T);this.onSelectionChangeRequest=this._onSelectionChangeRequest.event;this._asyncFocusGainWriteScreenReaderContent=this._register(new ue);this._asyncTriggerCut=this._register(new Dt(()=>this._onCut.fire(),0)),this._textAreaState=AI.EMPTY,this._selectionChangeListener=null,this._accessibilityService.isScreenReaderOptimized()&&this.writeNativeTextAreaContent("ctor"),this._register(U.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>{this._accessibilityService.isScreenReaderOptimized()&&!this._asyncFocusGainWriteScreenReaderContent.value?this._asyncFocusGainWriteScreenReaderContent.value=new Dt(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0):this._asyncFocusGainWriteScreenReaderContent.clear()})),this._hasFocus=!1,this._currentComposition=null;let l=null;this._register(this._textArea.onKeyDown(c=>{let u=new mi(c);(u.keyCode===114||this._currentComposition&&u.keyCode===1)&&u.stopPropagation(),u.equals(9)&&u.preventDefault(),l=u,this._onKeyDown.fire(u)})),this._register(this._textArea.onKeyUp(c=>{let u=new mi(c);this._onKeyUp.fire(u)})),this._register(this._textArea.onCompositionStart(c=>{CD&&console.log("[compositionstart]",c);let u=new Ksi;if(this._currentComposition){this._currentComposition=u;return}if(this._currentComposition=u,this._OS===2&&l&&l.equals(114)&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===c.data&&(l.code==="ArrowRight"||l.code==="ArrowLeft")){CD&&console.log("[compositionstart] Handling long press case on macOS + arrow key",c),u.handleCompositionUpdate("x"),this._onCompositionStart.fire({data:c.data});return}if(this._browser.isAndroid){this._onCompositionStart.fire({data:c.data});return}this._onCompositionStart.fire({data:c.data})})),this._register(this._textArea.onCompositionUpdate(c=>{CD&&console.log("[compositionupdate]",c);let u=this._currentComposition;if(!u)return;if(this._browser.isAndroid){let h=AI.readFromTextArea(this._textArea,this._textAreaState),g=AI.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(g),this._onCompositionUpdate.fire(c);return}let p=u.handleCompositionUpdate(c.data);this._textAreaState=AI.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(p),this._onCompositionUpdate.fire(c)})),this._register(this._textArea.onCompositionEnd(c=>{CD&&console.log("[compositionend]",c);let u=this._currentComposition;if(!u)return;if(this._currentComposition=null,this._browser.isAndroid){let h=AI.readFromTextArea(this._textArea,this._textAreaState),g=AI.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(g),this._onCompositionEnd.fire();return}let p=u.handleCompositionUpdate(c.data);this._textAreaState=AI.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(p),this._onCompositionEnd.fire()})),this._register(this._textArea.onInput(c=>{if(CD&&console.log("[input]",c),this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;let u=AI.readFromTextArea(this._textArea,this._textAreaState),p=AI.deduceInput(this._textAreaState,u,this._OS===2);p.replacePrevCharCnt===0&&p.text.length===1&&(Ip(p.text.charCodeAt(0))||p.text.charCodeAt(0)===127)||(this._textAreaState=u,(p.text!==""||p.replacePrevCharCnt!==0||p.replaceNextCharCnt!==0||p.positionDelta!==0)&&(c.inputType==="insertFromPaste"?this._onPaste.fire({text:p.text,metadata:vX.INSTANCE.get(p.text)}):this._onType.fire(p)))})),this._register(this._textArea.onCut(c=>{this._logService.trace("TextAreaInput#onCut",c);let u=pxe(c,!0,this._host.context,this._logService,this._browser.isFirefox);this._onWillCut.fire(u),!u.isHandled&&(this._textArea.setIgnoreSelectionChangeTime("received cut event"),u.ensureClipboardGetsEditorData(),this._asyncTriggerCut.schedule())})),this._register(this._textArea.onCopy(c=>{this._logService.trace("TextAreaInput#onCopy",c),cK.electronBugWorkaroundCopyEventHasFired=!0;let u=pxe(c,!1,this._host.context,this._logService,this._browser.isFirefox);this._onWillCopy.fire(u),!u.isHandled&&u.ensureClipboardGetsEditorData()})),this._register(this._textArea.onPaste(c=>{this._logService.trace("TextAreaInput#onPaste",c);let u=jyt(c);this._onWillPaste.fire(u),!u.isHandled&&(this._textArea.setIgnoreSelectionChangeTime("received paste event"),c.preventDefault(),this._logService.trace("TextAreaInput#onPaste with id : ",u.metadata?.id," with text.length: ",u.text.length),u.text&&(this._logService.trace("TextAreaInput#onPaste (before onPaste)"),this._onPaste.fire({text:u.text,metadata:u.metadata})))})),this._register(this._textArea.onFocus(()=>{let c=this._hasFocus;this._setHasFocus(!0),this._accessibilityService.isScreenReaderOptimized()&&this._browser.isSafari&&!c&&this._hasFocus&&(this._asyncFocusGainWriteScreenReaderContent.value||(this._asyncFocusGainWriteScreenReaderContent.value=new Dt(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)),this._asyncFocusGainWriteScreenReaderContent.value.schedule())})),this._register(this._textArea.onBlur(()=>{this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(this._textArea.onSyntheticTap(()=>{this._browser.isAndroid&&this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}get textAreaState(){return this._textAreaState}_initializeFromTest(){this._hasFocus=!0,this._textAreaState=AI.readFromTextArea(this._textArea,null)}_installSelectionChangeListener(){let e=0;return $(this._textArea.ownerDocument,"selectionchange",t=>{if(hx.onSelectionChange(),!this._hasFocus||this._currentComposition||!this._browser.isChrome)return;let o=Date.now(),n=o-e;if(e=o,n<5)return;let r=o-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),r<100||!this._textAreaState.selection)return;let s=this._textArea.getValue();if(this._textAreaState.value!==s)return;let l=this._textArea.getSelectionStart(),c=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===l&&this._textAreaState.selectionEnd===c)return;let u=this._textAreaState.deduceEditorPosition(l),p=this._host.deduceModelPosition(u[0],u[1],u[2]),h=this._textAreaState.deduceEditorPosition(c),g=this._host.deduceModelPosition(h[0],h[1],h[2]),f=new ei(p.lineNumber,p.column,g.lineNumber,g.column);this._onSelectionChangeRequest.fire(f)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){this._setHasFocus(this._textArea.hasFocus())}_setHasFocus(e){this._hasFocus!==e&&(this._hasFocus=e,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeNativeTextAreaContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.isWrittenToTextArea(this._textArea,this._hasFocus)||this._logService.trace(`writeTextAreaState(reason: ${e})`),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeNativeTextAreaContent(e){!this._accessibilityService.isScreenReaderOptimized()&&e==="render"||this._currentComposition||this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent())}};mxe=I([m(4,Ai),m(5,re)],mxe);var Qyt=class extends k{constructor(e){super();this._actual=e;this._onSyntheticTap=this._register(new T);this.onSyntheticTap=this._onSyntheticTap.event;this._ignoreSelectionChangeTime=0,this.onKeyDown=this._register(new Zn(this._actual,"keydown")).event,this.onKeyPress=this._register(new Zn(this._actual,"keypress")).event,this.onKeyUp=this._register(new Zn(this._actual,"keyup")).event,this.onCompositionStart=this._register(new Zn(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(new Zn(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(new Zn(this._actual,"compositionend")).event,this.onBeforeInput=this._register(new Zn(this._actual,"beforeinput")).event,this.onInput=this._register(new Zn(this._actual,"input")).event,this.onCut=this._register(new Zn(this._actual,"cut")).event,this.onCopy=this._register(new Zn(this._actual,"copy")).event,this.onPaste=this._register(new Zn(this._actual,"paste")).event,this.onFocus=this._register(new Zn(this._actual,"focus")).event,this.onBlur=this._register(new Zn(this._actual,"blur")).event,this._register(this.onKeyDown(()=>hx.onKeyDown())),this._register(this.onBeforeInput(()=>hx.onBeforeInput())),this._register(this.onInput(()=>hx.onInput())),this._register(this.onKeyUp(()=>hx.onKeyUp())),this._register($(this._actual,Yyt.Tap,()=>this._onSyntheticTap.fire()))}get ownerDocument(){return this._actual.ownerDocument}hasFocus(){let e=IA(this._actual);return e?e.activeElement===this._actual:this._actual.isConnected?Un()===this._actual:!1}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.value}setValue(e,t){let o=this._actual;o.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),o.value=t)}getSelectionStart(){return this._actual.selectionDirection==="backward"?this._actual.selectionEnd:this._actual.selectionStart}getSelectionEnd(){return this._actual.selectionDirection==="backward"?this._actual.selectionStart:this._actual.selectionEnd}setSelectionRange(e,t,o){let n=this._actual,r=null,s=IA(n);s?r=s.activeElement:r=Un();let l=Me(r),c=r===n,u=n.selectionStart,p=n.selectionEnd;if(c&&u===t&&p===o){ed&&l.parent!==l&&n.focus();return}if(c){this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,o),ed&&l.parent!==l&&n.focus();return}try{let h=hQi(n);this.setIgnoreSelectionChangeTime("setSelectionRange"),n.focus(),n.setSelectionRange(t,o),gQi(n,h)}catch{}}};var Gsi=class extends ixe{constructor(i,e,t){super(i,e,t),this._register(ds.addTarget(this.viewHelper.linesContentDomNode)),this._register($(this.viewHelper.linesContentDomNode,Vn.Tap,n=>this.onTap(n))),this._register($(this.viewHelper.linesContentDomNode,Vn.Change,n=>this.onChange(n))),this._register($(this.viewHelper.linesContentDomNode,Vn.Contextmenu,n=>this._onContextMenu(new zL(n,!1,this.viewHelper.viewDomNode),!1))),this._lastPointerType="mouse",this._register($(this.viewHelper.linesContentDomNode,"pointerdown",n=>{let r=n.pointerType;if(r==="mouse"){this._lastPointerType="mouse";return}else r==="touch"?this._lastPointerType="touch":this._lastPointerType="pen"}));let o=new myt(this.viewHelper.viewDomNode);this._register(o.onPointerMove(this.viewHelper.viewDomNode,n=>this._onMouseMove(n))),this._register(o.onPointerUp(this.viewHelper.viewDomNode,n=>this._onMouseUp(n))),this._register(o.onPointerLeave(this.viewHelper.viewDomNode,n=>this._onMouseLeave(n))),this._register(o.onPointerDown(this.viewHelper.viewDomNode,(n,r)=>this._onMouseDown(n,r)))}onTap(i){!i.initialTarget||!this.viewHelper.linesContentDomNode.contains(i.initialTarget)||(i.preventDefault(),this.viewHelper.focusTextArea(),this._dispatchGesture(i,!1))}onChange(i){this._lastPointerType==="touch"&&this._context.viewModel.viewLayout.deltaScrollNow(-i.translationX,-i.translationY),this._lastPointerType==="pen"&&this._dispatchGesture(i,!0)}_dispatchGesture(i,e){let t=this._createMouseTarget(new zL(i,!1,this.viewHelper.viewDomNode),!1);t.position&&this.viewController.dispatchMouse({position:t.position,mouseColumn:t.position.column,startedOnLineNumbers:!1,revealType:1,mouseDownCount:i.tapCount,inSelectionMode:e,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1,onInjectedText:t.type===6&&t.detail.injectedText!==null})}_onMouseDown(i,e){i.browserEvent.pointerType!=="touch"&&super._onMouseDown(i,e)}},qsi=class extends ixe{constructor(i,e,t){super(i,e,t),this._register(ds.addTarget(this.viewHelper.linesContentDomNode)),this._register($(this.viewHelper.linesContentDomNode,Vn.Tap,o=>this.onTap(o))),this._register($(this.viewHelper.linesContentDomNode,Vn.Change,o=>this.onChange(o))),this._register($(this.viewHelper.linesContentDomNode,Vn.Contextmenu,o=>this._onContextMenu(new zL(o,!1,this.viewHelper.viewDomNode),!1)))}onTap(i){i.preventDefault(),this.viewHelper.focusTextArea();let e=this._createMouseTarget(new zL(i,!1,this.viewHelper.viewDomNode),!1);if(e.position){let t=document.createEvent("CustomEvent");t.initEvent(Yyt.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(t),this.viewController.moveTo(e.position,1)}}onChange(i){this._context.viewModel.viewLayout.deltaScrollNow(-i.translationX,-i.translationY)}},Xyt=class extends k{constructor(i,e,t){super(),(Tc||Nvt&&zye)&&of.pointerEvents?this.handler=this._register(new Gsi(i,e,t)):ut.TouchEvent?this.handler=this._register(new qsi(i,e,t)):this.handler=this._register(new ixe(i,e,t))}getTargetAtClientPoint(i,e){return this.handler.getTargetAtClientPoint(i,e)}};var Jyt=class a{constructor(i,e,t,o){this.configuration=i,this.viewModel=e,this.userInputEvents=t,this.commandDelegate=o}paste(i,e,t,o){this.commandDelegate.paste(i,e,t,o)}type(i){this.commandDelegate.type(i)}compositionType(i,e,t,o){this.commandDelegate.compositionType(i,e,t,o)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(i){Vf.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:i})}_validateViewColumn(i){let e=this.viewModel.getLineMinColumn(i.lineNumber);return i.column<e?new ye(i.lineNumber,e):i}_hasMulticursorModifier(i){switch(this.configuration.options.get(86)){case"altKey":return i.altKey;case"ctrlKey":return i.ctrlKey;case"metaKey":return i.metaKey;default:return!1}}_hasNonMulticursorModifier(i){switch(this.configuration.options.get(86)){case"altKey":return i.ctrlKey||i.metaKey;case"ctrlKey":return i.altKey||i.metaKey;case"metaKey":return i.ctrlKey||i.altKey;default:return!1}}static _trySelectBracketContent(i,e){if(e.column>1){let t=i.bracketPairs.matchBracket(e.with(void 0,e.column-1));if(t&&t[0].getEndPosition().equals(e))return ei.fromPositions(t[0].getEndPosition(),t[1].getStartPosition())}if(e.column<=i.getLineMaxColumn(e.lineNumber)){let t=i.bracketPairs.matchBracket(e);if(t&&t[1].getStartPosition().equals(e))return ei.fromPositions(t[0].getEndPosition(),t[1].getStartPosition())}}static _trySelectStringContent(i,e){let{lineNumber:t,column:o}=e,{tokenization:n}=i;if(!n.hasAccurateTokensForLine(t))if(n.isCheapToTokenize(t))n.forceTokenization(t);else return;let r=n.getLineTokens(t),s=r.findTokenIndexAtOffset(o-1),l=s;for(;s>0&&r.getStandardTokenType(s-1)===2;)s--;for(;l+1<r.getCount()&&r.getStandardTokenType(l+1)===2;)l++;let c=r.getStartOffset(s),u=r.getEndOffset(l);if(o!==c+2&&o!==u)return;let p=i.getLineContent(t),h=p.charAt(c);if(h!=='"'&&h!=="'"&&h!=="`"||p.charAt(u-1)!==h)return;let g=p.substring(c+1,u-1);if(!mA(g))return new ei(t,c+2,t,u)}dispatchMouse(i){let e=this.configuration.options,t=Sn&&e.get(121),o=e.get(28),n=e.get(171);if(i.middleButton&&!t)n||this._columnSelect(i.position,i.mouseColumn,i.inSelectionMode);else if(i.startedOnLineNumbers)this._hasMulticursorModifier(i)?i.inSelectionMode?this._lastCursorLineSelect(i.position,i.revealType):this._createCursor(i.position,!0):i.inSelectionMode?this._lineSelectDrag(i.position,i.revealType):this._lineSelect(i.position,i.revealType);else if(i.mouseDownCount>=4)this._selectAll();else if(i.mouseDownCount===3)this._hasMulticursorModifier(i)?i.inSelectionMode?this._lastCursorLineSelectDrag(i.position,i.revealType):this._lastCursorLineSelect(i.position,i.revealType):i.inSelectionMode?this._lineSelectDrag(i.position,i.revealType):this._lineSelect(i.position,i.revealType);else if(i.mouseDownCount===2){if(!i.onInjectedText)if(this._hasMulticursorModifier(i))this._lastCursorWordSelect(i.position,i.revealType);else if(i.inSelectionMode)this._wordSelectDrag(i.position,i.revealType);else{let r;if(e.get(173)){let s=this.viewModel.model,l=this._convertViewToModelPosition(i.position);r=a._trySelectBracketContent(s,l)||a._trySelectStringContent(s,l)}r?this._select(r):this._wordSelect(i.position,i.revealType)}}else this._hasMulticursorModifier(i)?this._hasNonMulticursorModifier(i)||(i.shiftKey?this._columnSelect(i.position,i.mouseColumn,!0):i.inSelectionMode?this._lastCursorMoveToSelect(i.position,i.revealType):this._createCursor(i.position,!1)):i.inSelectionMode?i.altKey?this._columnSelect(i.position,i.mouseColumn,!0):o?this._columnSelect(i.position,i.mouseColumn,!0):this._moveToSelect(i.position,i.revealType):this.moveTo(i.position,i.revealType)}_usualArgs(i,e){return i=this._validateViewColumn(i),{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,revealType:e}}moveTo(i,e){Vf.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_moveToSelect(i,e){Vf.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_columnSelect(i,e,t){i=this._validateViewColumn(i),Vf.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,mouseColumn:e,doColumnSelect:t})}_createCursor(i,e){i=this._validateViewColumn(i),Vf.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(i),viewPosition:i,wholeLine:e})}_lastCursorMoveToSelect(i,e){Vf.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_wordSelect(i,e){Vf.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_wordSelectDrag(i,e){Vf.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorWordSelect(i,e){Vf.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lineSelect(i,e){Vf.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lineSelectDrag(i,e){Vf.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorLineSelect(i,e){Vf.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_lastCursorLineSelectDrag(i,e){Vf.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(i,e))}_select(i){Vf.SetSelection.runCoreEditorCommand(this.viewModel,{source:"mouse",selection:i})}_selectAll(){Vf.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(i){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(i)}emitKeyDown(i){this.userInputEvents.emitKeyDown(i)}emitKeyUp(i){this.userInputEvents.emitKeyUp(i)}emitContextMenu(i){this.userInputEvents.emitContextMenu(i)}emitMouseMove(i){this.userInputEvents.emitMouseMove(i)}emitMouseLeave(i){this.userInputEvents.emitMouseLeave(i)}emitMouseUp(i){this.userInputEvents.emitMouseUp(i)}emitMouseDown(i){this.userInputEvents.emitMouseDown(i)}emitMouseDrag(i){this.userInputEvents.emitMouseDrag(i)}emitMouseDrop(i){this.userInputEvents.emitMouseDrop(i)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(i){this.userInputEvents.emitMouseWheel(i)}};function zf(a,i){let e=M3i();if(e?.createTrustedTypesPolicy)try{return e.createTrustedTypesPolicy(a,i)}catch(t){mt(t);return}try{return globalThis.trustedTypes?.createPolicy(a,i)}catch(t){mt(t);return}}var Y3e=class{constructor(i){this._lineFactory=i;this._set(1,[])}flush(){this._set(1,[])}_set(i,e){this._lines=e,this._rendLineNumberStart=i}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(i){let e=i-this._rendLineNumberStart;if(e<0||e>=this._lines.length)throw new ci("Illegal value for lineNumber");return this._lines[e]}onLinesDeleted(i,e){if(this.getCount()===0)return null;let t=this.getStartLineNumber(),o=this.getEndLineNumber();if(e<t){let l=e-i+1;return this._rendLineNumberStart-=l,null}if(i>o)return null;let n=0,r=0;for(let l=t;l<=o;l++){let c=l-this._rendLineNumberStart;i<=l&&l<=e&&(r===0?(n=c,r=1):r++)}if(i<t){let l=0;e<t?l=e-i+1:l=t-i,this._rendLineNumberStart-=l}return this._lines.splice(n,r)}onLinesChanged(i,e){let t=i+e-1;if(this.getCount()===0)return!1;let o=this.getStartLineNumber(),n=this.getEndLineNumber(),r=!1;for(let s=i;s<=t;s++)s>=o&&s<=n&&(this._lines[s-this._rendLineNumberStart].onContentChanged(),r=!0);return r}onLinesInserted(i,e){if(this.getCount()===0)return null;let t=e-i+1,o=this.getStartLineNumber(),n=this.getEndLineNumber();if(i<=o)return this._rendLineNumberStart+=t,null;if(i>n)return null;if(t+i>n)return this._lines.splice(i-this._rendLineNumberStart,n-i+1);let r=[];for(let p=0;p<t;p++)r[p]=this._lineFactory.createLine();let s=i-this._rendLineNumberStart,l=this._lines.slice(0,s),c=this._lines.slice(s,this._lines.length-t),u=this._lines.slice(this._lines.length-t,this._lines.length);return this._lines=l.concat(r).concat(c),u}onTokensChanged(i){if(this.getCount()===0)return!1;let e=this.getStartLineNumber(),t=this.getEndLineNumber(),o=!1;for(let n=0,r=i.length;n<r;n++){let s=i[n];if(s.toLineNumber<e||s.fromLineNumber>t)continue;let l=Math.max(e,s.fromLineNumber),c=Math.min(t,s.toLineNumber);for(let u=l;u<=c;u++){let p=u-this._rendLineNumberStart;this._lines[p].onTokensChanged(),o=!0}}return o}},hxe=class{constructor(i,e){this._viewContext=i;this._lineFactory=e;this.domNode=this._createDomNode(),this._linesCollection=new Y3e(this._lineFactory)}_createDomNode(){let i=Ir(document.createElement("div"));return i.setClassName("view-layer"),i.setPosition("absolute"),i.domNode.setAttribute("role","presentation"),i.domNode.setAttribute("aria-hidden","true"),i}onConfigurationChanged(i){return!!i.hasChanged(165)}onFlushed(i,e){if(e){let t=this._linesCollection.getStartLineNumber(),o=this._linesCollection.getEndLineNumber();for(let n=t;n<=o;n++)this._linesCollection.getLine(n).getDomNode()?.remove()}return this._linesCollection.flush(),!0}onLinesChanged(i){return this._linesCollection.onLinesChanged(i.fromLineNumber,i.count)}onLinesDeleted(i){let e=this._linesCollection.onLinesDeleted(i.fromLineNumber,i.toLineNumber);if(e)for(let t=0,o=e.length;t<o;t++)e[t].getDomNode()?.remove();return!0}onLinesInserted(i){let e=this._linesCollection.onLinesInserted(i.fromLineNumber,i.toLineNumber);if(e)for(let t=0,o=e.length;t<o;t++)e[t].getDomNode()?.remove();return!0}onScrollChanged(i){return i.scrollTopChanged}onTokensChanged(i){return this._linesCollection.onTokensChanged(i.ranges)}onZonesChanged(i){return!0}getStartLineNumber(){return this._linesCollection.getStartLineNumber()}getEndLineNumber(){return this._linesCollection.getEndLineNumber()}getVisibleLine(i){return this._linesCollection.getLine(i)}renderLines(i){let e=this._linesCollection._get(),t=new $si(this.domNode.domNode,this._lineFactory,i,this._viewContext),o={rendLineNumberStart:e.rendLineNumberStart,lines:e.lines,linesLength:e.lines.length},n=t.render(o,i.startLineNumber,i.endLineNumber,i.relativeVerticalOffset);this._linesCollection._set(n.rendLineNumberStart,n.lines)}},$si=class a{constructor(i,e,t,o){this._domNode=i;this._lineFactory=e;this._viewportData=t;this._viewContext=o}static{this._ttPolicy=zf("editorViewLayer",{createHTML:i=>i})}render(i,e,t,o){let n={rendLineNumberStart:i.rendLineNumberStart,lines:i.lines.slice(0),linesLength:i.linesLength};if(n.rendLineNumberStart+n.linesLength-1<e||t<n.rendLineNumberStart){n.rendLineNumberStart=e,n.linesLength=t-e+1,n.lines=[];for(let r=e;r<=t;r++)n.lines[r-e]=this._lineFactory.createLine();return this._finishRendering(n,!0,o),n}if(this._renderUntouchedLines(n,Math.max(e-n.rendLineNumberStart,0),Math.min(t-n.rendLineNumberStart,n.linesLength-1),o,e),n.rendLineNumberStart>e){let r=e,s=Math.min(t,n.rendLineNumberStart-1);r<=s&&(this._insertLinesBefore(n,r,s,o,e),n.linesLength+=s-r+1)}else if(n.rendLineNumberStart<e){let r=Math.min(n.linesLength,e-n.rendLineNumberStart);r>0&&(this._removeLinesBefore(n,r),n.linesLength-=r)}if(n.rendLineNumberStart=e,n.rendLineNumberStart+n.linesLength-1<t){let r=n.rendLineNumberStart+n.linesLength,s=t;r<=s&&(this._insertLinesAfter(n,r,s,o,e),n.linesLength+=s-r+1)}else if(n.rendLineNumberStart+n.linesLength-1>t){let r=Math.max(0,t-n.rendLineNumberStart+1),l=n.linesLength-1-r+1;l>0&&(this._removeLinesAfter(n,l),n.linesLength-=l)}return this._finishRendering(n,!1,o),n}_renderUntouchedLines(i,e,t,o,n){let r=i.rendLineNumberStart,s=i.lines;for(let l=e;l<=t;l++){let c=r+l;s[l].layoutLine(c,o[c-n],this._lineHeightForLineNumber(c))}}_insertLinesBefore(i,e,t,o,n){let r=[],s=0;for(let l=e;l<=t;l++)r[s++]=this._lineFactory.createLine();i.lines=r.concat(i.lines)}_removeLinesBefore(i,e){for(let t=0;t<e;t++)i.lines[t].getDomNode()?.remove();i.lines.splice(0,e)}_insertLinesAfter(i,e,t,o,n){let r=[],s=0;for(let l=e;l<=t;l++)r[s++]=this._lineFactory.createLine();i.lines=i.lines.concat(r)}_removeLinesAfter(i,e){let t=i.linesLength-e;for(let o=0;o<e;o++)i.lines[t+o].getDomNode()?.remove();i.lines.splice(t,e)}_finishRenderingNewLines(i,e,t,o){a._ttPolicy&&(t=a._ttPolicy.createHTML(t));let n=this._domNode.lastChild;e||!n?this._domNode.innerHTML=t:n.insertAdjacentHTML("afterend",t);let r=this._domNode.lastChild;for(let s=i.linesLength-1;s>=0;s--){let l=i.lines[s];o[s]&&(l.setDomNode(r),r=r.previousSibling)}}_finishRenderingInvalidLines(i,e,t){let o=document.createElement("div");a._ttPolicy&&(e=a._ttPolicy.createHTML(e)),o.innerHTML=e;for(let n=0;n<i.linesLength;n++){let r=i.lines[n];if(t[n]){let s=o.firstChild;r.getDomNode().replaceWith(s),r.setDomNode(s)}}}static{this._sb=new EI(1e5)}_finishRendering(i,e,t){let o=a._sb,n=i.linesLength,r=i.lines,s=i.rendLineNumberStart,l=[];{o.reset();let c=!1;for(let u=0;u<n;u++){let p=r[u];if(l[u]=!1,p.getDomNode())continue;let g=u+s;p.renderLine(g,t[u],this._lineHeightForLineNumber(g),this._viewportData,o)&&(l[u]=!0,c=!0)}c&&this._finishRenderingNewLines(i,e,o.build(),l)}{o.reset();let c=!1,u=[];for(let p=0;p<n;p++){let h=r[p];if(u[p]=!1,l[p])continue;let g=p+s;h.renderLine(g,t[p],this._lineHeightForLineNumber(g),this._viewportData,o)&&(u[p]=!0,c=!0)}c&&this._finishRenderingInvalidLines(i,o.build(),u)}}_lineHeightForLineNumber(i){return this._viewContext.viewLayout.getLineHeightForLineNumber(i)}};var Zyt=class extends np{constructor(e){super(e);this._dynamicOverlays=[];this._isFocused=!1;this._visibleLines=new hxe(this._context,{createLine:()=>new jsi(this._dynamicOverlays)}),this.domNode=this._visibleLines.domNode;let o=this._context.configuration.options.get(59);ku(this.domNode,o),this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;e<t;e++)if(this._dynamicOverlays[e].shouldRender())return!0;return!1}dispose(){super.dispose();for(let e=0,t=this._dynamicOverlays.length;e<t;e++)this._dynamicOverlays[e].dispose();this._dynamicOverlays=[]}getDomNode(){return this.domNode}addDynamicOverlay(e){this._dynamicOverlays.push(e)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e);let o=this._context.configuration.options.get(59);return ku(this.domNode,o),!0}onFlushed(e){return this._visibleLines.onFlushed(e)}onFocusChanged(e){return this._isFocused=e.isFocused,!0}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onScrollChanged(e){return this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._visibleLines.onZonesChanged(e)}prepareRender(e){let t=this._dynamicOverlays.filter(o=>o.shouldRender());for(let o=0,n=t.length;o<n;o++){let r=t[o];r.prepareRender(e),r.onDidRender()}}render(e){this._viewOverlaysRender(e),this.domNode.toggleClassName("focused",this._isFocused)}_viewOverlaysRender(e){this._visibleLines.renderLines(e.viewportData)}},jsi=class{constructor(i){this._dynamicOverlays=i,this._domNode=null,this._renderedContent=null}getDomNode(){return this._domNode?this._domNode.domNode:null}setDomNode(i){this._domNode=Ir(i)}onContentChanged(){}onTokensChanged(){}renderLine(i,e,t,o,n){let r="";for(let s=0,l=this._dynamicOverlays.length;s<l;s++){let c=this._dynamicOverlays[s];r+=c.render(o.startLineNumber,i)}return this._renderedContent===r?!1:(this._renderedContent=r,n.appendString('<div style="top:'),n.appendString(String(e)),n.appendString("px;height:"),n.appendString(String(t)),n.appendString("px;line-height:"),n.appendString(String(t)),n.appendString('px;">'),n.appendString(r),n.appendString("</div>"),!0)}layoutLine(i,e,t){this._domNode&&(this._domNode.setTop(e),this._domNode.setHeight(t),this._domNode.setLineHeight(t))}},ewt=class extends Zyt{constructor(i){super(i);let t=this._context.configuration.options.get(165);this._contentWidth=t.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._contentWidth=t.contentWidth,super.onConfigurationChanged(i)||!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollWidthChanged}_viewOverlaysRender(i){super._viewOverlaysRender(i),this.domNode.setWidth(Math.max(i.scrollWidth,this._contentWidth))}},twt=class extends Zyt{constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._contentLeft=t.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),ku(this.domNode,e.get(59))}onConfigurationChanged(i){let e=this._context.configuration.options;ku(this.domNode,e.get(59));let t=e.get(165);return this._contentLeft=t.contentLeft,super.onConfigurationChanged(i)||!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollHeightChanged}_viewOverlaysRender(i){super._viewOverlaysRender(i);let e=Math.min(i.scrollHeight,1e6);this.domNode.setHeight(e),this.domNode.setWidth(this._contentLeft)}};var gxe=class a{constructor(i){this.onKeyDown=null;this.onKeyUp=null;this.onContextMenu=null;this.onMouseMove=null;this.onMouseLeave=null;this.onMouseDown=null;this.onMouseUp=null;this.onMouseDrag=null;this.onMouseDrop=null;this.onMouseDropCanceled=null;this.onMouseWheel=null;this._coordinatesConverter=i}emitKeyDown(i){this.onKeyDown?.(i)}emitKeyUp(i){this.onKeyUp?.(i)}emitContextMenu(i){this.onContextMenu?.(this._convertViewToModelMouseEvent(i))}emitMouseMove(i){this.onMouseMove?.(this._convertViewToModelMouseEvent(i))}emitMouseLeave(i){this.onMouseLeave?.(this._convertViewToModelMouseEvent(i))}emitMouseDown(i){this.onMouseDown?.(this._convertViewToModelMouseEvent(i))}emitMouseUp(i){this.onMouseUp?.(this._convertViewToModelMouseEvent(i))}emitMouseDrag(i){this.onMouseDrag?.(this._convertViewToModelMouseEvent(i))}emitMouseDrop(i){this.onMouseDrop?.(this._convertViewToModelMouseEvent(i))}emitMouseDropCanceled(){this.onMouseDropCanceled?.()}emitMouseWheel(i){this.onMouseWheel?.(i)}_convertViewToModelMouseEvent(i){return i.target?{event:i.event,target:this._convertViewToModelMouseTarget(i.target)}:i}_convertViewToModelMouseTarget(i){return a.convertViewToModelMouseTarget(i,this._coordinatesConverter)}static convertViewToModelMouseTarget(i,e){let t={...i};return t.position&&(t.position=e.convertViewPositionToModelPosition(t.position)),t.range&&(t.range=e.convertViewRangeToModelRange(t.range)),(t.type===5||t.type===8)&&(t.detail=this.convertViewToModelViewZoneData(t.detail,e)),t}static convertViewToModelViewZoneData(i,e){return{viewZoneId:i.viewZoneId,positionBefore:i.positionBefore?e.convertViewPositionToModelPosition(i.positionBefore):i.positionBefore,positionAfter:i.positionAfter?e.convertViewPositionToModelPosition(i.positionAfter):i.positionAfter,position:e.convertViewPositionToModelPosition(i.position),afterLineNumber:e.convertViewPositionToModelPosition(new ye(i.afterLineNumber,1)).lineNumber}}};var iwt=class extends np{constructor(e){super(e);this.blocks=[];this.contentWidth=-1;this.contentLeft=0;this.domNode=Ir(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("blockDecorations-container"),this.update()}update(){let e=!1,o=this._context.configuration.options.get(165),n=o.contentWidth-o.verticalScrollbarWidth;this.contentWidth!==n&&(this.contentWidth=n,e=!0);let r=o.contentLeft;return this.contentLeft!==r&&(this.contentLeft=r,e=!0),e}onConfigurationChanged(e){return this.update()}onScrollChanged(e){return e.scrollTopChanged||e.scrollLeftChanged}onDecorationsChanged(e){return!0}onZonesChanged(e){return!0}prepareRender(e){}render(e){let t=0,o=e.getDecorationsInViewport();for(let n of o){if(!n.options.blockClassName)continue;let r=this.blocks[t];r||(r=this.blocks[t]=Ir(document.createElement("div")),this.domNode.appendChild(r));let s,l;n.options.blockIsAfterEnd?(s=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!1),l=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0)):(s=e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!0),l=n.range.isEmpty()&&!n.options.blockDoesNotCollapse?e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!1):e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0));let[c,u,p,h]=n.options.blockPadding??[0,0,0,0];r.setClassName("blockDecorations-block "+n.options.blockClassName),r.setLeft(this.contentLeft-h),r.setWidth(this.contentWidth+h+u),r.setTop(s-e.scrollTop-c),r.setHeight(l-s+c+p),t++}for(let n=t;n<this.blocks.length;n++)this.blocks[n].domNode.remove();this.blocks.length=t}};var owt=class extends np{constructor(i,e){super(i),this._viewDomNode=e,this._widgets={},this.domNode=Ir(document.createElement("div")),MI.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=Ir(document.createElement("div")),MI.write(this.overflowingContentWidgetsDomNode,2),this.overflowingContentWidgetsDomNode.setClassName("overflowingContentWidgets")}dispose(){super.dispose(),this._widgets={}}onConfigurationChanged(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].onConfigurationChanged(i);return!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLineMappingChanged(i){return this._updateAnchorsViewPositions(),!0}onLinesChanged(i){return this._updateAnchorsViewPositions(),!0}onLinesDeleted(i){return this._updateAnchorsViewPositions(),!0}onLinesInserted(i){return this._updateAnchorsViewPositions(),!0}onScrollChanged(i){return!0}onZonesChanged(i){return!0}_updateAnchorsViewPositions(){let i=Object.keys(this._widgets);for(let e of i)this._widgets[e].updateAnchorViewPosition()}addWidget(i){let e=new Ysi(this._context,this._viewDomNode,i);this._widgets[e.id]=e,e.allowEditorOverflow?this.overflowingContentWidgetsDomNode.appendChild(e.domNode):this.domNode.appendChild(e.domNode),this.setShouldRender()}setWidgetPosition(i,e,t,o,n){let r=this._widgets[i.getId()];r.setPosition(e,t,o,n),r.useDisplayNone||this.setShouldRender()}removeWidget(i){let e=i.getId();if(this._widgets.hasOwnProperty(e)){let t=this._widgets[e];delete this._widgets[e];let o=t.domNode.domNode;o.remove(),o.removeAttribute("monaco-visible-content-widget"),this.setShouldRender()}}shouldSuppressMouseDownOnWidget(i){return this._widgets.hasOwnProperty(i)?this._widgets[i].suppressMouseDown:!1}onBeforeRender(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].onBeforeRender(i)}prepareRender(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].prepareRender(i)}render(i){let e=Object.keys(this._widgets);for(let t of e)this._widgets[t].render(i)}},Ysi=class{constructor(i,e,t){this._primaryAnchor=new ede(null,null);this._secondaryAnchor=new ede(null,null);this._context=i,this._viewDomNode=e,this._actual=t;let o=this._context.configuration.options,n=o.get(165),r=o.get(4);this.domNode=Ir(this._actual.getDomNode()),this.id=this._actual.getId(),this.allowEditorOverflow=(this._actual.allowEditorOverflow||!1)&&r,this.suppressMouseDown=this._actual.suppressMouseDown||!1,this.useDisplayNone=this._actual.useDisplayNone||!1,this._fixedOverflowWidgets=o.get(51),this._contentWidth=n.contentWidth,this._contentLeft=n.contentLeft,this._affinity=null,this._preference=[],this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1,this._maxWidth=this._getMaxWidth(),this._isVisible=!1,this._renderData=null,this.domNode.setPosition(this._fixedOverflowWidgets&&this.allowEditorOverflow?"fixed":"absolute"),this.domNode.setDisplay("none"),this.domNode.setVisibility("hidden"),this.domNode.setAttribute("widgetId",this.id),this.domNode.setMaxWidth(this._maxWidth)}onConfigurationChanged(i){let e=this._context.configuration.options;if(i.hasChanged(165)){let t=e.get(165);this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._maxWidth=this._getMaxWidth()}}updateAnchorViewPosition(){this._setPosition(this._affinity,this._primaryAnchor.modelPosition,this._secondaryAnchor.modelPosition)}_setPosition(i,e,t){this._affinity=i,this._primaryAnchor=o(e,this._context.viewModel,this._affinity),this._secondaryAnchor=o(t,this._context.viewModel,this._affinity);function o(n,r,s){if(!n)return new ede(null,null);let l=r.model.validatePosition(n);if(r.coordinatesConverter.modelPositionIsVisible(l)){let c=r.coordinatesConverter.convertModelPositionToViewPosition(l,s??void 0);return new ede(n,c)}return new ede(n,null)}}_getMaxWidth(){let i=this.domNode.domNode.ownerDocument,e=i.defaultView;return this.allowEditorOverflow?e?.innerWidth||i.documentElement.offsetWidth||i.body.offsetWidth:this._contentWidth}setPosition(i,e,t,o){this._setPosition(o,i,e),this._preference=t,!this.useDisplayNone&&this._primaryAnchor.viewPosition&&this._preference&&this._preference.length>0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(i,e,t,o){let n=i.top,r=n,s=i.top+i.height,l=o.viewportHeight-s,c=n-t,u=r>=t,p=s,h=l>=t,g=i.left;return g+e>o.scrollLeft+o.viewportWidth&&(g=o.scrollLeft+o.viewportWidth-e),g<o.scrollLeft&&(g=o.scrollLeft),{fitsAbove:u,aboveTop:c,fitsBelow:h,belowTop:p,left:g}}_layoutHorizontalSegmentInPage(i,e,t,o){let s=Math.max(15,e.left-o),l=Math.min(e.left+e.width+o,i.width-15),u=this._viewDomNode.domNode.ownerDocument.defaultView,p=e.left+t-(u?.scrollX??0);if(p+o>l){let h=p-(l-o);p-=h,t-=h}if(p<s){let h=p-s;p-=h,t-=h}return[t,p]}_layoutBoxInPage(i,e,t,o){let n=i.top-t,r=i.top+i.height,s=ur(this._viewDomNode.domNode),l=this._viewDomNode.domNode.ownerDocument,c=l.defaultView,u=s.top+n-(c?.scrollY??0),p=s.top+r-(c?.scrollY??0),h=wh(l.body),[g,f]=this._layoutHorizontalSegmentInPage(h,s,i.left-o.scrollLeft+this._contentLeft,e),v=22,b=22,S=u>=v,y=p+t<=h.height-b;return this._fixedOverflowWidgets?{fitsAbove:S,aboveTop:Math.max(u,v),fitsBelow:y,belowTop:p,left:f}:{fitsAbove:S,aboveTop:n,fitsBelow:y,belowTop:r,left:g}}_prepareRenderWidgetAtExactPositionOverflowing(i){return new tde(i.top,i.left+this._contentLeft)}_getAnchorsCoordinates(i){let e=n(this._primaryAnchor.viewPosition,this._affinity),t=this._secondaryAnchor.viewPosition?.lineNumber===this._primaryAnchor.viewPosition?.lineNumber?this._secondaryAnchor.viewPosition:null,o=n(t,this._affinity);return{primary:e,secondary:o};function n(r,s){if(!r)return null;let l=i.visibleRangeForPosition(r);if(!l)return null;let c=r.column===1&&s===3?0:l.left,u=i.getVerticalOffsetForLineNumber(r.lineNumber)-i.scrollTop,p=i.getLineHeightForLineNumber(r.lineNumber);return new nwt(u,c,p)}}_reduceAnchorCoordinates(i,e,t){if(!e)return i;let o=this._context.configuration.options.get(59),n=e.left;return n<i.left?n=Math.max(n,i.left-t+o.typicalFullwidthCharacterWidth):n=Math.min(n,i.left+t-o.typicalFullwidthCharacterWidth),new nwt(i.top,n,i.height)}_prepareRenderWidget(i){if(!this._preference||this._preference.length===0)return null;let{primary:e,secondary:t}=this._getAnchorsCoordinates(i);if(!e)return{kind:"offViewport",preserveFocus:this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)};if(this._cachedDomNodeOffsetWidth===-1||this._cachedDomNodeOffsetHeight===-1){let r=null;if(typeof this._actual.beforeRender=="function"&&(r=Qsi(this._actual.beforeRender,this._actual)),r)this._cachedDomNodeOffsetWidth=r.width,this._cachedDomNodeOffsetHeight=r.height;else{let l=this.domNode.domNode.getBoundingClientRect();this._cachedDomNodeOffsetWidth=Math.round(l.width),this._cachedDomNodeOffsetHeight=Math.round(l.height)}}let o=this._reduceAnchorCoordinates(e,t,this._cachedDomNodeOffsetWidth),n;this.allowEditorOverflow?n=this._layoutBoxInPage(o,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,i):n=this._layoutBoxInViewport(o,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,i);for(let r=1;r<=2;r++)for(let s of this._preference)if(s===1){if(!n)return null;if(r===2||n.fitsAbove)return{kind:"inViewport",coordinate:new tde(n.aboveTop,n.left),position:1}}else if(s===2){if(!n)return null;if(r===2||n.fitsBelow)return{kind:"inViewport",coordinate:new tde(n.belowTop,n.left),position:2}}else return this.allowEditorOverflow?{kind:"inViewport",coordinate:this._prepareRenderWidgetAtExactPositionOverflowing(new tde(o.top,o.left)),position:0}:{kind:"inViewport",coordinate:new tde(o.top,o.left),position:0};return null}onBeforeRender(i){!this._primaryAnchor.viewPosition||!this._preference||this._primaryAnchor.viewPosition.lineNumber<i.startLineNumber||this._primaryAnchor.viewPosition.lineNumber>i.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(i){this._renderData=this._prepareRenderWidget(i)}render(i){if(!this._renderData||this._renderData.kind==="offViewport"){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this._renderData?.kind==="offViewport"&&this._renderData.preserveFocus?this.domNode.setTop(-1e3):this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&Qsi(this._actual.afterRender,this._actual,null,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+i.scrollTop-i.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&Qsi(this._actual.afterRender,this._actual,this._renderData.position,this._renderData.coordinate)}},ede=class{constructor(i,e){this.modelPosition=i;this.viewPosition=e}},tde=class{constructor(i,e){this.top=i;this.left=e;this._coordinateBrand=void 0}},nwt=class{constructor(i,e,t){this.top=i;this.left=e;this.height=t;this._anchorCoordinateBrand=void 0}};function Qsi(a,i,...e){try{return a.call(i,...e)}catch{return null}}var vx=class extends yT{};var Pe=le("themeService");function _s(a){return{id:a}}var LYi=L.file,W5=L.folder;function V5(a){switch(a){case"dark":return"vs-dark";case"hcDark":return"hc-black";case"hcLight":return"hc-light";default:return"vs"}}var Zsi={ThemingContribution:"base.contributions.theming"},Xsi=class extends k{constructor(){super();this.themingParticipants=[];this.themingParticipants=[],this.onThemingParticipantAddedEmitter=this._register(new T)}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),ee(()=>{let t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}get onThemingParticipantAdded(){return this.onThemingParticipantAddedEmitter.event}getThemingParticipants(){return this.themingParticipants}},MYi=new Xsi;oe.add(Zsi.ThemingContribution,MYi);function hs(a){return MYi.onColorThemeChange(a)}var ju=class extends k{constructor(e){super();this.themeService=e;this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(t=>this.onThemeChange(t)))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}getColor(e,t){let o=this.theme.getColor(e);return o&&t&&(o=t(o,this.theme)),o?o.toString():null}};var fxe=te("editor.lineHighlightBackground",null,d(803,null)),PYi=te("editor.inactiveLineHighlightBackground",fxe,d(802,null)),eai=te("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:Ei},d(804,null)),AYi=te("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},d(809,null),!0),_or=te("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:la,hcLight:la},d(810,null)),Dor=te("editor.symbolHighlightBackground",{dark:NS,light:NS,hcDark:null,hcLight:null},d(811,null),!0),Ror=te("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:la,hcLight:la},d(812,null)),bX=te("editorCursor.foreground",{dark:"#AEAFAD",light:Ue.black,hcDark:Ue.white,hcLight:"#0F4A85"},d(743,null)),rwt=te("editorCursor.background",null,d(778,null)),swt=te("editorMultiCursor.primary.foreground",bX,d(793,null)),NYi=te("editorMultiCursor.primary.background",rwt,d(792,null)),awt=te("editorMultiCursor.secondary.foreground",bX,d(795,null)),OYi=te("editorMultiCursor.secondary.background",rwt,d(794,null)),vxe=te("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},d(801,null)),FYi=te("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:Ue.white,hcLight:"#292929"},d(791,null)),PGo=te("editorIndentGuide.background",vxe,d(784,null),!1,d(746,null)),AGo=te("editorIndentGuide.activeBackground",vxe,d(747,null),!1,d(744,null)),lwt=te("editorIndentGuide.background1",PGo,d(785,null)),WYi=te("editorIndentGuide.background2","#00000000",d(786,null)),VYi=te("editorIndentGuide.background3","#00000000",d(787,null)),BYi=te("editorIndentGuide.background4","#00000000",d(788,null)),HYi=te("editorIndentGuide.background5","#00000000",d(789,null)),UYi=te("editorIndentGuide.background6","#00000000",d(790,null)),cwt=te("editorIndentGuide.activeBackground1",AGo,d(748,null)),zYi=te("editorIndentGuide.activeBackground2","#00000000",d(749,null)),KYi=te("editorIndentGuide.activeBackground3","#00000000",d(750,null)),GYi=te("editorIndentGuide.activeBackground4","#00000000",d(751,null)),qYi=te("editorIndentGuide.activeBackground5","#00000000",d(752,null)),$Yi=te("editorIndentGuide.activeBackground6","#00000000",d(753,null)),NGo=te("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:la,hcLight:la},d(754,null),!1,d(745,null)),Lor=te("editorLineNumber.activeForeground",NGo,d(754,null)),jYi=te("editorLineNumber.dimmedForeground",null,d(779,null)),QYi=te("editorRuler.foreground",{dark:"#5A5A5A",light:Ue.lightgrey,hcDark:Ue.white,hcLight:"#292929"},d(798,null)),Mor=te("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},d(777,null)),Por=te("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},d(762,null)),Aor=te("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:Ei,hcLight:Ei},d(763,null)),YYi=te("editorBracketMatch.foreground",null,d(764,null)),dwt=te("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},d(797,null)),XYi=te("editorOverviewRuler.background",null,d(796,null)),Nor=te("editorGutter.background",Bo,d(783,null)),Oor=te("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:Ue.fromHex("#fff").transparent(.8),hcLight:Ei},d(813,null)),JYi=te("editorUnnecessaryCode.opacity",{dark:Ue.fromHex("#000a"),light:Ue.fromHex("#0007"),hcDark:null,hcLight:null},d(814,null)),For=te("editorGhostText.border",{dark:null,light:null,hcDark:Ue.fromHex("#fff").transparent(.8),hcLight:Ue.fromHex("#292929").transparent(.8)},d(781,null)),ZYi=te("editorGhostText.foreground",{dark:Ue.fromHex("#ffffff56"),light:Ue.fromHex("#0007"),hcDark:null,hcLight:null},d(782,null)),Wor=te("editorGhostText.background",null,d(780,null)),OGo=new Ue(new Ut(0,122,204,.6)),bxe=te("editorOverviewRuler.rangeHighlightForeground",OGo,d(807,null),!0),ode=te("editorOverviewRuler.errorForeground",{dark:new Ue(new Ut(255,18,18,.7)),light:new Ue(new Ut(255,18,18,.7)),hcDark:new Ue(new Ut(255,50,50,1)),hcLight:"#B5200D"},d(805,null)),eXi=te("editorOverviewRuler.warningForeground",{dark:Tg,light:Tg,hcDark:oX,hcLight:oX},d(808,null)),SX=te("editorOverviewRuler.infoForeground",{dark:eh,light:eh,hcDark:nX,hcLight:nX},d(806,null)),uwt=te("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},d(755,null)),pwt=te("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},d(756,null)),mwt=te("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},d(757,null)),hwt=te("editorBracketHighlight.foreground4","#00000000",d(758,null)),gwt=te("editorBracketHighlight.foreground5","#00000000",d(759,null)),fwt=te("editorBracketHighlight.foreground6","#00000000",d(760,null)),tXi=te("editorBracketHighlight.unexpectedBracket.foreground",{dark:new Ue(new Ut(255,18,18,.8)),light:new Ue(new Ut(255,18,18,.8)),hcDark:new Ue(new Ut(255,50,50,1)),hcLight:"#B5200D"},d(761,null)),iXi=te("editorBracketPairGuide.background1","#00000000",d(771,null)),oXi=te("editorBracketPairGuide.background2","#00000000",d(772,null)),nXi=te("editorBracketPairGuide.background3","#00000000",d(773,null)),rXi=te("editorBracketPairGuide.background4","#00000000",d(774,null)),sXi=te("editorBracketPairGuide.background5","#00000000",d(775,null)),aXi=te("editorBracketPairGuide.background6","#00000000",d(776,null)),lXi=te("editorBracketPairGuide.activeBackground1","#00000000",d(765,null)),cXi=te("editorBracketPairGuide.activeBackground2","#00000000",d(766,null)),dXi=te("editorBracketPairGuide.activeBackground3","#00000000",d(767,null)),uXi=te("editorBracketPairGuide.activeBackground4","#00000000",d(768,null)),pXi=te("editorBracketPairGuide.activeBackground5","#00000000",d(769,null)),mXi=te("editorBracketPairGuide.activeBackground6","#00000000",d(770,null)),Vor=te("editorUnicodeHighlight.border",Tg,d(800,null)),Bor=te("editorUnicodeHighlight.background",U9i,d(799,null));hs((a,i)=>{let e=a.getColor(Bo),t=a.getColor(fxe),o=t&&!t.isTransparent()?t:e;o&&i.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${o}; }`)});var vwt=class extends vx{constructor(i){super(),this._context=i;let e=this._context.configuration.options,t=e.get(165);this._renderLineHighlight=e.get(110),this._renderLineHighlightOnlyWhenFocus=e.get(111),this._wordWrap=t.isViewportWrapping,this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new ei(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let i=!1,e=new Set;for(let n of this._selections)e.add(n.positionLineNumber);let t=Array.from(e);t.sort((n,r)=>n-r),eo(this._cursorLineNumbers,t)||(this._cursorLineNumbers=t,i=!0);let o=this._selections.every(n=>n.isEmpty());return this._selectionIsEmpty!==o&&(this._selectionIsEmpty=o,i=!0),i}onThemeChanged(i){return this._readFromSelections()}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._renderLineHighlight=e.get(110),this._renderLineHighlightOnlyWhenFocus=e.get(111),this._wordWrap=t.isViewportWrapping,this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,!0}onCursorStateChanged(i){return this._selections=i.selections,this._readFromSelections()}onFlushed(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollWidthChanged||i.scrollTopChanged}onZonesChanged(i){return!0}onFocusChanged(i){return this._renderLineHighlightOnlyWhenFocus?(this._focused=i.isFocused,!0):!1}prepareRender(i){if(!this._shouldRenderThis()){this._renderData=null;return}let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=[];for(let r=e;r<=t;r++){let s=r-e;o[s]=""}if(this._wordWrap){let r=this._renderOne(i,!1);for(let s of this._cursorLineNumbers){let l=this._context.viewModel.coordinatesConverter,c=l.convertViewPositionToModelPosition(new ye(s,1)).lineNumber,u=l.convertModelPositionToViewPosition(new ye(c,1)).lineNumber,p=l.convertModelPositionToViewPosition(new ye(c,this._context.viewModel.model.getLineMaxColumn(c))).lineNumber,h=Math.max(u,e),g=Math.min(p,t);for(let f=h;f<=g;f++){let v=f-e;o[v]=r}}}let n=this._renderOne(i,!0);for(let r of this._cursorLineNumbers){if(r<e||r>t)continue;let s=r-e;o[s]=n}this._renderData=o}render(i,e){if(!this._renderData)return"";let t=e-i;return t>=this._renderData.length?"":this._renderData[t]}_shouldRenderInMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}},bwt=class extends vwt{_renderOne(i,e){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-both":"")+(e?" current-line-exact":"")}" style="width:${Math.max(i.scrollWidth,this._contentWidth)}px;"></div>`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}},Swt=class extends vwt{_renderOne(i,e){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-margin":"")+(this._shouldRenderOther()?" current-line-margin-both":"")+(this._shouldRenderInMargin()&&e?" current-line-exact-margin":"")}" style="width:${this._contentLeft}px"></div>`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}};hs((a,i)=>{let e=a.getColor(fxe),t=a.getColor(PYi);if(e&&(i.addRule(`.monaco-editor.focused .view-overlays .current-line { background-color: ${e}; }`),i.addRule(`.monaco-editor.focused .margin-view-overlays .current-line-margin { background-color: ${e}; border: none; }`)),t&&(i.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${t}; }`),i.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),!e||e.isTransparent()||a.defines(eai)){let o=a.getColor(eai);o&&(i.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${o}; }`),i.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${o}; }`),Uf(a.type)&&(i.addRule(".monaco-editor .view-overlays .current-line-exact { border-width: 1px; }"),i.addRule(".monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }")))}});var Iwt=class extends vx{constructor(i){super(),this._context=i;let e=this._context.configuration.options;this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options;return this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged||i.scrollWidthChanged}onZonesChanged(i){return!0}prepareRender(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let l=0,c=e.length;l<c;l++){let u=e[l];u.options.className&&(t[o++]=u)}t=t.sort((l,c)=>{if(l.options.zIndex<c.options.zIndex)return-1;if(l.options.zIndex>c.options.zIndex)return 1;let u=l.options.className,p=c.options.className;return u<p?-1:u>p?1:G.compareRangesUsingStarts(l.range,c.range)});let n=i.visibleRange.startLineNumber,r=i.visibleRange.endLineNumber,s=[];for(let l=n;l<=r;l++){let c=l-n;s[c]=""}this._renderWholeLineDecorations(i,t,s),this._renderNormalDecorations(i,t,s),this._renderResult=s}_renderWholeLineDecorations(i,e,t){let o=i.visibleRange.startLineNumber,n=i.visibleRange.endLineNumber;for(let r=0,s=e.length;r<s;r++){let l=e[r];if(!l.options.isWholeLine)continue;let c='<div class="cdr '+l.options.className+'" style="left:0;width:100%;"></div>',u=Math.max(l.range.startLineNumber,o),p=Math.min(l.range.endLineNumber,n);for(let h=u;h<=p;h++){let g=h-o;t[g]+=c}}}_renderNormalDecorations(i,e,t){let o=i.visibleRange.startLineNumber,n=null,r=!1,s=null,l=!1;for(let c=0,u=e.length;c<u;c++){let p=e[c];if(p.options.isWholeLine)continue;let h=p.options.className,g=!!p.options.showIfCollapsed,f=p.range;if(g&&f.endColumn===1&&f.endLineNumber!==f.startLineNumber&&(f=new G(f.startLineNumber,f.startColumn,f.endLineNumber-1,this._context.viewModel.getLineMaxColumn(f.endLineNumber-1))),n===h&&r===g&&G.areIntersectingOrTouching(s,f)){s=G.plusRange(s,f);continue}n!==null&&this._renderNormalDecoration(i,s,n,l,r,o,t),n=h,r=g,s=f,l=p.options.shouldFillLineOnLineBreak??!1}n!==null&&this._renderNormalDecoration(i,s,n,l,r,o,t)}_renderNormalDecoration(i,e,t,o,n,r,s){let l=i.linesVisibleRangesForRange(e,t==="findMatch");if(l)for(let c=0,u=l.length;c<u;c++){let p=l[c];if(p.outsideRenderedLine)continue;let h=p.lineNumber-r;if(n&&p.ranges.length===1){let g=p.ranges[0];if(g.width<this._typicalHalfwidthCharacterWidth){let f=Math.round(g.left+g.width/2),v=Math.max(0,Math.round(f-this._typicalHalfwidthCharacterWidth/2));p.ranges[0]=new pX(v,this._typicalHalfwidthCharacterWidth)}}for(let g=0,f=p.ranges.length;g<f;g++){let v=o&&p.continuesOnNextLine&&f===1,b=p.ranges[g],S='<div class="cdr '+t+'" style="left:'+String(b.left)+"px;width:"+(v?"100%;":String(b.width)+"px;")+'"></div>';s[h]+=S}}}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};var ywt=class extends np{constructor(i,e,t,o){super(i);let n=this._context.configuration.options,r=n.get(117),s=n.get(83),l=n.get(49),c=n.get(120),u=n.get(158),p={listenOnDomNode:t.domNode,className:"editor-scrollable "+V5(i.theme.type),useShadows:!1,lazyRender:!0,vertical:r.vertical,horizontal:r.horizontal,verticalHasArrows:r.verticalHasArrows,horizontalHasArrows:r.horizontalHasArrows,verticalScrollbarSize:r.verticalScrollbarSize,verticalSliderSize:r.verticalSliderSize,horizontalScrollbarSize:r.horizontalScrollbarSize,horizontalSliderSize:r.horizontalSliderSize,handleMouseWheel:r.handleMouseWheel,alwaysConsumeMouseWheel:r.alwaysConsumeMouseWheel,arrowSize:r.arrowSize,mouseWheelScrollSensitivity:s,fastScrollSensitivity:l,scrollPredominantAxis:c,scrollByPage:r.scrollByPage,inertialScroll:u};this.scrollbar=this._register(new LF(e.domNode,p,this._context.viewLayout.getScrollable())),MI.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=Ir(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();let h=(g,f,v)=>{let b={};if(f){let S=g.scrollTop;S&&(b.scrollTop=this._context.viewLayout.getCurrentScrollTop()+S,g.scrollTop=0)}if(v){let S=g.scrollLeft;S&&(b.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+S,g.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(b,1)};this._register($(t.domNode,"scroll",g=>h(t.domNode,!0,!0))),this._register($(e.domNode,"scroll",g=>h(e.domNode,!0,!1))),this._register($(o.domNode,"scroll",g=>h(o.domNode,!0,!1))),this._register($(this.scrollbarDomNode.domNode,"scroll",g=>h(this.scrollbarDomNode.domNode,!0,!1)))}_setLayout(){let i=this._context.configuration.options,e=i.get(165);this.scrollbarDomNode.setLeft(e.contentLeft),i.get(81).side==="right"?this.scrollbarDomNode.setWidth(e.contentWidth+e.minimap.minimapWidth):this.scrollbarDomNode.setWidth(e.contentWidth),this.scrollbarDomNode.setHeight(e.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarPointerDown(i){this.scrollbar.delegateVerticalScrollbarPointerDown(i)}delegateScrollFromMouseWheelEvent(i){this.scrollbar.delegateScrollFromMouseWheelEvent(i)}onConfigurationChanged(i){if(i.hasChanged(117)||i.hasChanged(83)||i.hasChanged(49)){let e=this._context.configuration.options,t=e.get(117),o=e.get(83),n=e.get(49),r=e.get(120),s={vertical:t.vertical,horizontal:t.horizontal,verticalScrollbarSize:t.verticalScrollbarSize,horizontalScrollbarSize:t.horizontalScrollbarSize,scrollByPage:t.scrollByPage,handleMouseWheel:t.handleMouseWheel,mouseWheelScrollSensitivity:o,fastScrollSensitivity:n,scrollPredominantAxis:r};this.scrollbar.updateOptions(s)}return i.hasChanged(165)&&this._setLayout(),!0}onScrollChanged(i){return!0}onThemeChanged(i){return this.scrollbar.updateClassName("editor-scrollable "+V5(this._context.theme.type)),!0}prepareRender(i){}render(i){this.scrollbar.renderNow()}};var nde=class{constructor(i,e,t,o,n){this.startLineNumber=i;this.endLineNumber=e;this.className=t;this.tooltip=o;this._decorationToRenderBrand=void 0;this.zIndex=n??0}},tai=class{constructor(i,e,t){this.className=i;this.zIndex=e;this.tooltip=t}},iai=class{constructor(){this.decorations=[]}add(i){this.decorations.push(i)}getDecorations(){return this.decorations}},Sxe=class extends vx{_render(i,e,t){let o=[];for(let s=i;s<=e;s++){let l=s-i;o[l]=new iai}if(t.length===0)return o;t.sort((s,l)=>s.className===l.className?s.startLineNumber===l.startLineNumber?s.endLineNumber-l.endLineNumber:s.startLineNumber-l.startLineNumber:s.className<l.className?-1:1);let n=null,r=0;for(let s of t){let l=s.className,c=s.zIndex,u=Math.max(s.startLineNumber,i)-i,p=Math.min(s.endLineNumber,e)-i;n===l?(u=Math.max(r+1,u),r=Math.max(r,p)):(n=l,r=p);for(let h=u;h<=r;h++)o[h].add(new tai(l,c,s.tooltip))}return o}},wwt=class extends np{constructor(e){super(e);this._widgets={};this._context=e;let t=this._context.configuration.options,o=t.get(165);this.domNode=Ir(document.createElement("div")),this.domNode.setClassName("glyph-margin-widgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=o.glyphMarginLeft,this._glyphMarginWidth=o.glyphMarginWidth,this._glyphMarginDecorationLaneCount=o.glyphMarginDecorationLaneCount,this._managedDomNodes=[],this._decorationGlyphsToRender=[]}dispose(){this._managedDomNodes=[],this._decorationGlyphsToRender=[],this._widgets={},super.dispose()}getWidgets(){return Object.values(this._widgets)}onConfigurationChanged(e){let t=this._context.configuration.options,o=t.get(165);return this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=o.glyphMarginLeft,this._glyphMarginWidth=o.glyphMarginWidth,this._glyphMarginDecorationLaneCount=o.glyphMarginDecorationLaneCount,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}addWidget(e){let t=Ir(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:e.getPosition(),domNode:t,renderInfo:null},t.setPosition("absolute"),t.setDisplay("none"),t.setAttribute("widgetId",e.getId()),this.domNode.appendChild(t),this.setShouldRender()}setWidgetPosition(e,t){let o=this._widgets[e.getId()];return o.preference.lane===t.lane&&o.preference.zIndex===t.zIndex&&G.equalsRange(o.preference.range,t.range)?!1:(o.preference=t,this.setShouldRender(),!0)}removeWidget(e){let t=e.getId();if(this._widgets[t]){let n=this._widgets[t].domNode.domNode;delete this._widgets[t],n.remove(),this.setShouldRender()}}_collectDecorationBasedGlyphRenderRequest(e,t){let o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,r=e.getDecorationsInViewport();for(let s of r){let l=s.options.glyphMarginClassName;if(!l)continue;let c=Math.max(s.range.startLineNumber,o),u=Math.min(s.range.endLineNumber,n),p=s.options.glyphMargin?.position??2,h=s.options.zIndex??0;for(let g=c;g<=u;g++){let f=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(g,0)),v=this._context.viewModel.glyphLanes.getLanesAtLine(f.lineNumber).indexOf(p);t.push(new oai(g,v,h,l))}}}_collectWidgetBasedGlyphRenderRequest(e,t){let o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let r of Object.values(this._widgets)){let s=r.preference.range,{startLineNumber:l,endLineNumber:c}=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(G.lift(s));if(!l||!c||c<o||l>n)continue;let u=Math.max(l,o),p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(u,0)),h=this._context.viewModel.glyphLanes.getLanesAtLine(p.lineNumber).indexOf(r.preference.lane);t.push(new nai(u,h,r.preference.zIndex,r))}}_collectSortedGlyphRenderRequests(e){let t=[];return this._collectDecorationBasedGlyphRenderRequest(e,t),this._collectWidgetBasedGlyphRenderRequest(e,t),t.sort((o,n)=>o.lineNumber===n.lineNumber?o.laneIndex===n.laneIndex?o.zIndex===n.zIndex?n.type===o.type?o.type===0&&n.type===0?o.className<n.className?-1:1:0:n.type-o.type:n.zIndex-o.zIndex:o.laneIndex-n.laneIndex:o.lineNumber-n.lineNumber),t}prepareRender(e){if(!this._glyphMargin){this._decorationGlyphsToRender=[];return}for(let n of Object.values(this._widgets))n.renderInfo=null;let t=new nT(this._collectSortedGlyphRenderRequests(e)),o=[];for(;t.length>0;){let n=t.peek();if(!n)break;let r=t.takeWhile(l=>l.lineNumber===n.lineNumber&&l.laneIndex===n.laneIndex);if(!r||r.length===0)break;let s=r[0];if(s.type===0){let l=[];for(let c of r){if(c.zIndex!==s.zIndex||c.type!==s.type)break;(l.length===0||l[l.length-1]!==c.className)&&l.push(c.className)}o.push(s.accept(l.join(" ")))}else s.widget.renderInfo={lineNumber:s.lineNumber,laneIndex:s.laneIndex}}this._decorationGlyphsToRender=o}render(e){if(!this._glyphMargin){for(let o of Object.values(this._widgets))o.domNode.setDisplay("none");for(;this._managedDomNodes.length>0;)this._managedDomNodes.pop()?.domNode.remove();return}let t=Math.round(this._glyphMarginWidth/this._glyphMarginDecorationLaneCount);for(let o of Object.values(this._widgets))if(!o.renderInfo)o.domNode.setDisplay("none");else{let n=e.viewportData.relativeVerticalOffset[o.renderInfo.lineNumber-e.viewportData.startLineNumber],r=this._glyphMarginLeft+o.renderInfo.laneIndex*this._lineHeight;o.domNode.setDisplay("block"),o.domNode.setTop(n),o.domNode.setLeft(r),o.domNode.setWidth(t),o.domNode.setHeight(this._lineHeight)}for(let o=0;o<this._decorationGlyphsToRender.length;o++){let n=this._decorationGlyphsToRender[o],r=n.lineNumber,s=e.viewportData.relativeVerticalOffset[r-e.viewportData.startLineNumber],l=this._glyphMarginLeft+n.laneIndex*this._lineHeight,c;o<this._managedDomNodes.length?c=this._managedDomNodes[o]:(c=Ir(document.createElement("div")),this._managedDomNodes.push(c),this.domNode.appendChild(c));let u=this._context.viewLayout.getLineHeightForLineNumber(r);c.setClassName("cgmr codicon "+n.combinedClassName),c.setPosition("absolute"),c.setTop(s),c.setLeft(l),c.setWidth(t),c.setHeight(u)}for(;this._managedDomNodes.length>this._decorationGlyphsToRender.length;)this._managedDomNodes.pop()?.domNode.remove()}};var oai=class{constructor(i,e,t,o){this.lineNumber=i;this.laneIndex=e;this.zIndex=t;this.className=o;this.type=0}accept(i){return new rai(this.lineNumber,this.laneIndex,i)}},nai=class{constructor(i,e,t,o){this.lineNumber=i;this.laneIndex=e;this.zIndex=t;this.widget=o;this.type=1}},rai=class{constructor(i,e,t){this.lineNumber=i;this.laneIndex=e;this.combinedClassName=t}};var Ixe=class extends k{constructor(){super(...arguments);this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}};function H5(a,i){let e=0,t=0,o=a.length;for(;t<o;){let n=a.charCodeAt(t);if(n===32)e++;else if(n===9)e=e-e%i+i;else break;t++}return t===o?-1:e}var OF=class{constructor(i,e,t,o,n,r){this.visibleColumn=i;this.column=e;this.className=t;this.horizontalLine=o;this.forWrappedLinesAfterColumn=n;this.forWrappedLinesBeforeOrAtColumn=r;if(i!==-1==(e!==-1))throw new Error}},U5=class{constructor(i,e){this.top=i;this.endColumn=e}};var Cwt=class extends Ixe{constructor(e,t){super();this.textModel=e;this.languageConfigurationService=t}getLanguageConfiguration(e){return this.languageConfigurationService.getLanguageConfiguration(e)}_computeIndentLevel(e){return H5(this.textModel.getLineContent(e+1),this.textModel.getOptions().tabSize)}getActiveIndentGuide(e,t,o){this.assertNotDisposed();let n=this.textModel.getLineCount();if(e<1||e>n)throw new ci("Illegal value for lineNumber");let r=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,s=!!(r&&r.offSide),l=-2,c=-1,u=-2,p=-1,h=V=>{if(l!==-1&&(l===-2||l>V-1)){l=-1,c=-1;for(let H=V-2;H>=0;H--){let K=this._computeIndentLevel(H);if(K>=0){l=H,c=K;break}}}if(u===-2){u=-1,p=-1;for(let H=V;H<n;H++){let K=this._computeIndentLevel(H);if(K>=0){u=H,p=K;break}}}},g=-2,f=-1,v=-2,b=-1,S=V=>{if(g===-2){g=-1,f=-1;for(let H=V-2;H>=0;H--){let K=this._computeIndentLevel(H);if(K>=0){g=H,f=K;break}}}if(v!==-1&&(v===-2||v<V-1)){v=-1,b=-1;for(let H=V;H<n;H++){let K=this._computeIndentLevel(H);if(K>=0){v=H,b=K;break}}}},y=0,w=!0,x=0,E=!0,M=0,N=0;for(let V=0;w||E;V++){let H=e-V,K=e+V;V>1&&(H<1||H<t)&&(w=!1),V>1&&(K>n||K>o)&&(E=!1),V>5e4&&(w=!1,E=!1);let j=-1;if(w&&H>=1){let se=this._computeIndentLevel(H-1);se>=0?(u=H-1,p=se,j=Math.ceil(se/this.textModel.getOptions().indentSize)):(h(H),j=this._getIndentLevelForWhitespaceLine(s,c,p))}let J=-1;if(E&&K<=n){let se=this._computeIndentLevel(K-1);se>=0?(g=K-1,f=se,J=Math.ceil(se/this.textModel.getOptions().indentSize)):(S(K),J=this._getIndentLevelForWhitespaceLine(s,f,b))}if(V===0){N=j;continue}if(V===1){if(K<=n&&J>=0&&N+1===J){w=!1,y=K,x=K,M=J;continue}if(H>=1&&j>=0&&j-1===N){E=!1,y=H,x=H,M=j;continue}if(y=e,x=e,M=N,M===0)return{startLineNumber:y,endLineNumber:x,indent:M}}w&&(j>=M?y=H:w=!1),E&&(J>=M?x=K:E=!1)}return{startLineNumber:y,endLineNumber:x,indent:M}}getLinesBracketGuides(e,t,o,n){let r=[];for(let h=e;h<=t;h++)r.push([]);let s=!0,l=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new G(e,1,t,this.textModel.getLineMaxColumn(t))).toArray(),c;if(o&&l.length>0){let h=(e<=o.lineNumber&&o.lineNumber<=t?l:this.textModel.bracketPairs.getBracketPairsInRange(G.fromPositions(o)).toArray()).filter(g=>G.strictContainsPosition(g.range,o));c=wu(h,g=>s||g.range.startLineNumber!==g.range.endLineNumber)?.range}let u=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,p=new X3e;for(let h of l){if(!h.closingBracketRange)continue;let g=c&&h.range.equalsRange(c);if(!g&&!n.includeInactive)continue;let f=p.getInlineClassName(h.nestingLevel,h.nestingLevelOfEqualBracketType,u)+(n.highlightActive&&g?" "+p.activeClassName:""),v=h.openingBracketRange.getStartPosition(),b=h.closingBracketRange.getStartPosition(),S=n.horizontalGuides===2||n.horizontalGuides===1&&g;if(h.range.startLineNumber===h.range.endLineNumber){s&&S&&r[h.range.startLineNumber-e].push(new OF(-1,h.openingBracketRange.getEndPosition().column,f,new U5(!1,b.column),-1,-1));continue}let y=this.getVisibleColumnFromPosition(b),w=this.getVisibleColumnFromPosition(h.openingBracketRange.getStartPosition()),x=Math.min(w,y,h.minVisibleColumnIndentation+1),E=!1;Em(this.textModel.getLineContent(h.closingBracketRange.startLineNumber))<h.closingBracketRange.startColumn-1&&(E=!0);let V=Math.max(v.lineNumber,e),H=Math.min(b.lineNumber,t),K=E?1:0;for(let j=V;j<H+K;j++)r[j-e].push(new OF(x,-1,f,null,j===v.lineNumber?v.column:-1,j===b.lineNumber?b.column:-1));S&&(v.lineNumber>=e&&w>x&&r[v.lineNumber-e].push(new OF(x,-1,f,new U5(!1,v.column),-1,-1)),b.lineNumber<=t&&y>x&&r[b.lineNumber-e].push(new OF(x,-1,f,new U5(!E,b.column),-1,-1)))}for(let h of r)h.sort((g,f)=>g.visibleColumn-f.visibleColumn);return r}getVisibleColumnFromPosition(e){return Ll.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();let o=this.textModel.getLineCount();if(e<1||e>o)throw new Error("Illegal value for startLineNumber");if(t<1||t>o)throw new Error("Illegal value for endLineNumber");let n=this.textModel.getOptions(),r=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,s=!!(r&&r.offSide),l=new Array(t-e+1),c=-2,u=-1,p=-2,h=-1;for(let g=e;g<=t;g++){let f=g-e,v=this._computeIndentLevel(g-1);if(v>=0){c=g-1,u=v,l[f]=Math.ceil(v/n.indentSize);continue}if(c===-2){c=-1,u=-1;for(let b=g-2;b>=0;b--){let S=this._computeIndentLevel(b);if(S>=0){c=b,u=S;break}}}if(p!==-1&&(p===-2||p<g-1)){p=-1,h=-1;for(let b=g;b<o;b++){let S=this._computeIndentLevel(b);if(S>=0){p=b,h=S;break}}}l[f]=this._getIndentLevelForWhitespaceLine(s,u,h)}return l}_getIndentLevelForWhitespaceLine(e,t,o){let n=this.textModel.getOptions();return t===-1||o===-1?0:t<o?1+Math.floor(t/n.indentSize):t===o||e?Math.ceil(o/n.indentSize):1+Math.floor(o/n.indentSize)}},X3e=class{constructor(){this.activeClassName="indent-active"}getInlineClassName(i,e,t){return this.getInlineClassNameOfLevel(t?e:i)}getInlineClassNameOfLevel(i){return`bracket-indent-guide lvl-${i%30}`}};var xwt=class extends vx{constructor(i){super(),this._context=i,this._primaryPosition=null;let e=this._context.configuration.options,t=e.get(166),o=e.get(59);this._spaceWidth=o.spaceWidth,this._maxIndentLeft=t.wrappingColumn===-1?-1:t.wrappingColumn*o.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=e.get(22),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(166),o=e.get(59);return this._spaceWidth=o.spaceWidth,this._maxIndentLeft=t.wrappingColumn===-1?-1:t.wrappingColumn*o.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=e.get(22),!0}onCursorStateChanged(i){let t=i.selections[0].getPosition();return this._primaryPosition?.equals(t)?!1:(this._primaryPosition=t,!0)}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}onLanguageConfigurationChanged(i){return!0}prepareRender(i){if(!this._bracketPairGuideOptions.indentation&&this._bracketPairGuideOptions.bracketPairs===!1){this._renderResult=null;return}let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=i.scrollWidth,n=this._primaryPosition,r=this.getGuidesByLine(e,Math.min(t+1,this._context.viewModel.getLineCount()),n),s=[];for(let l=e;l<=t;l++){let c=l-e,u=r[c],p="",h=i.visibleRangeForPosition(new ye(l,1))?.left??0;for(let g of u){let f=g.column===-1?h+(g.visibleColumn-1)*this._spaceWidth:i.visibleRangeForPosition(new ye(l,g.column)).left;if(f>o||this._maxIndentLeft>0&&f>this._maxIndentLeft)break;let v=g.horizontalLine?g.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",b=g.horizontalLine?(i.visibleRangeForPosition(new ye(l,g.horizontalLine.endColumn))?.left??f+this._spaceWidth)-f:this._spaceWidth;p+=`<div class="core-guide ${g.className} ${v}" style="left:${f}px;width:${b}px"></div>`}s[c]=p}this._renderResult=s}getGuidesByLine(i,e,t){let o=this._bracketPairGuideOptions.bracketPairs!==!1?this._context.viewModel.getBracketGuidesInRangeByLine(i,e,t,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:this._bracketPairGuideOptions.bracketPairsHorizontal===!0?2:this._bracketPairGuideOptions.bracketPairsHorizontal==="active"?1:0,includeInactive:this._bracketPairGuideOptions.bracketPairs===!0}):null,n=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(i,e):null,r=0,s=0,l=0;if(this._bracketPairGuideOptions.highlightActiveIndentation!==!1&&t){let p=this._context.viewModel.getActiveIndentGuide(t.lineNumber,i,e);r=p.startLineNumber,s=p.endLineNumber,l=p.indent}let{indentSize:c}=this._context.viewModel.model.getOptions(),u=[];for(let p=i;p<=e;p++){let h=new Array;u.push(h);let g=o?o[p-i]:[],f=new nT(g),v=n?n[p-i]:0;for(let b=1;b<=v;b++){let S=(b-1)*c+1,y=(this._bracketPairGuideOptions.highlightActiveIndentation==="always"||g.length===0)&&r<=p&&p<=s&&b===l;h.push(...f.takeWhile(x=>x.visibleColumn<S)||[]);let w=f.peek();(!w||w.visibleColumn!==S||w.horizontalLine)&&h.push(new OF(S,-1,`core-guide-indent lvl-${(b-1)%30}`+(y?" indent-active":""),null,-1,-1))}h.push(...f.takeWhile(b=>!0)||[])}return u}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};function yxe(a){if(!(a&&a.isTransparent()))return a}hs((a,i)=>{let e=[{bracketColor:uwt,guideColor:iXi,guideColorActive:lXi},{bracketColor:pwt,guideColor:oXi,guideColorActive:cXi},{bracketColor:mwt,guideColor:nXi,guideColorActive:dXi},{bracketColor:hwt,guideColor:rXi,guideColorActive:uXi},{bracketColor:gwt,guideColor:sXi,guideColorActive:pXi},{bracketColor:fwt,guideColor:aXi,guideColorActive:mXi}],t=new X3e,o=[{indentColor:lwt,indentColorActive:cwt},{indentColor:WYi,indentColorActive:zYi},{indentColor:VYi,indentColorActive:KYi},{indentColor:BYi,indentColorActive:GYi},{indentColor:HYi,indentColorActive:qYi},{indentColor:UYi,indentColorActive:$Yi}],n=e.map(s=>{let l=a.getColor(s.bracketColor),c=a.getColor(s.guideColor),u=a.getColor(s.guideColorActive),p=yxe(yxe(c)??l?.transparent(.3)),h=yxe(yxe(u)??l);if(!(!p||!h))return{guideColor:p,guideColorActive:h}}).filter(so),r=o.map(s=>{let l=a.getColor(s.indentColor),c=a.getColor(s.indentColorActive),u=yxe(l),p=yxe(c);if(!(!u||!p))return{indentColor:u,indentColorActive:p}}).filter(so);if(n.length>0){for(let s=0;s<30;s++){let l=n[s%n.length];i.addRule(`.monaco-editor .${t.getInlineClassNameOfLevel(s).replace(/ /g,".")} { --guide-color: ${l.guideColor}; --guide-color-active: ${l.guideColorActive}; }`)}i.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),i.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),i.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),i.addRule(`.monaco-editor .vertical.${t.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),i.addRule(`.monaco-editor .horizontal-top.${t.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),i.addRule(`.monaco-editor .horizontal-bottom.${t.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}if(r.length>0){for(let s=0;s<30;s++){let l=r[s%r.length];i.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${s} { --indent-color: ${l.indentColor}; --indent-color-active: ${l.indentColorActive}; }`)}i.addRule(".monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }"),i.addRule(".monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }")}});var wxe=class a extends vx{static{this.CLASS_NAME="line-numbers"}constructor(i){super(),this._context=i,this._readConfig(),this._lastCursorModelPosition=new ye(1,1),this._renderResult=null,this._activeModelLineNumber=1,this._context.addEventHandler(this)}_readConfig(){let i=this._context.configuration.options;this._lineHeight=i.get(75);let e=i.get(76);this._renderLineNumbers=e.renderType,this._renderCustomLineNumbers=e.renderFn,this._renderFinalNewline=i.get(109);let t=i.get(165);this._lineNumbersLeft=t.lineNumbersLeft,this._lineNumbersWidth=t.lineNumbersWidth}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){return this._readConfig(),!0}onCursorStateChanged(i){let e=i.selections[0].getPosition();this._lastCursorModelPosition=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e);let t=!1;return this._activeModelLineNumber!==this._lastCursorModelPosition.lineNumber&&(this._activeModelLineNumber=this._lastCursorModelPosition.lineNumber,t=!0),(this._renderLineNumbers===2||this._renderLineNumbers===3)&&(t=!0),t}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}onDecorationsChanged(i){return i.affectsLineNumber}_getLineRenderLineNumber(i){let e=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(i,1));if(e.column!==1)return"";let t=e.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(t);if(this._renderLineNumbers===2){let o=Math.abs(this._lastCursorModelPosition.lineNumber-t);return o===0?'<span class="relative-current-line-number">'+t+"</span>":String(o)}if(this._renderLineNumbers===3){if(this._lastCursorModelPosition.lineNumber===t||t%10===0)return String(t);let o=this._context.viewModel.getLineCount();return t===o?String(t):""}return String(t)}prepareRender(i){if(this._renderLineNumbers===0){this._renderResult=null;return}let e=Sn?this._lineHeight%2===0?" lh-even":" lh-odd":"",t=i.visibleRange.startLineNumber,o=i.visibleRange.endLineNumber,n=this._context.viewModel.getDecorationsInViewport(i.visibleRange).filter(c=>!!c.options.lineNumberClassName);n.sort((c,u)=>G.compareRangesUsingEnds(c.range,u.range));let r=0,s=this._context.viewModel.getLineCount(),l=[];for(let c=t;c<=o;c++){let u=c-t,p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(c,1)).lineNumber,h=this._getLineRenderLineNumber(c),g="";for(;r<n.length&&n[r].range.endLineNumber<c;)r++;for(let f=r;f<n.length;f++){let{range:v,options:b}=n[f];v.startLineNumber<=c&&(g+=" "+b.lineNumberClassName)}if(!h&&!g){l[u]="";continue}c===s&&this._context.viewModel.getLineLength(c)===0&&(this._renderFinalNewline==="off"&&(h=""),this._renderFinalNewline==="dimmed"&&(g+=" dimmed-line-number")),p===this._activeModelLineNumber&&(g+=" active-line-number"),l[u]=`<div class="${a.CLASS_NAME}${e}${g}" style="left:${this._lineNumbersLeft}px;width:${this._lineNumbersWidth}px;">${h}</div>`}this._renderResult=l}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}};hs((a,i)=>{let e=a.getColor(FYi),t=a.getColor(jYi);t?i.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${t}; }`):e&&i.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${e.transparent(.4)}; }`)});var xT="monaco-mouse-cursor-text";var Cxe=class{constructor(i,e){this._domNode=i;this.endNode=e;this._didDomLayout=!1;this._clientRectDeltaLeft=0;this._clientRectScale=1;this._clientRectRead=!1}get didDomLayout(){return this._didDomLayout}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;let i=this._domNode.getBoundingClientRect();this.markDidDomLayout(),this._clientRectDeltaLeft=i.left;let e=this._domNode.offsetWidth;this._clientRectScale=e>0?i.width/e:1}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}markDidDomLayout(){this._didDomLayout=!0}};var z5=class{constructor(i,e){this.themeType=e;let t=i.options,o=t.get(59);this.renderWhitespace=t.get(113),this.experimentalWhitespaceRendering=t.get(47),this.renderControlCharacters=t.get(108),this.spaceWidth=o.spaceWidth,this.middotWidth=o.middotWidth,this.wsmiddotWidth=o.wsmiddotWidth,this.useMonospaceOptimizations=o.isMonospace&&!t.get(40),this.canUseHalfwidthRightwardsArrow=o.canUseHalfwidthRightwardsArrow,this.lineHeight=t.get(75),this.stopRenderingLineAfter=t.get(133),this.fontLigatures=t.get(60),this.verticalScrollbarSize=t.get(117).verticalScrollbarSize,this.useGpu=t.get(46)==="on"}equals(i){return this.themeType===i.themeType&&this.renderWhitespace===i.renderWhitespace&&this.experimentalWhitespaceRendering===i.experimentalWhitespaceRendering&&this.renderControlCharacters===i.renderControlCharacters&&this.spaceWidth===i.spaceWidth&&this.middotWidth===i.middotWidth&&this.wsmiddotWidth===i.wsmiddotWidth&&this.useMonospaceOptimizations===i.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineHeight===i.lineHeight&&this.stopRenderingLineAfter===i.stopRenderingLineAfter&&this.fontLigatures===i.fontLigatures&&this.verticalScrollbarSize===i.verticalScrollbarSize&&this.useGpu===i.useGpu}};var sai=class{constructor(){this._currentVisibleRange=new G(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(i){this._currentVisibleRange=i}},aai=class{constructor(i,e,t,o,n,r,s){this.minimalReveal=i;this.lineNumber=e;this.startColumn=t;this.endColumn=o;this.startScrollTop=n;this.stopScrollTop=r;this.scrollType=s;this.type="range";this.minLineNumber=e,this.maxLineNumber=e}},lai=class{constructor(i,e,t,o,n){this.minimalReveal=i;this.selections=e;this.startScrollTop=t;this.stopScrollTop=o;this.scrollType=n;this.type="selections";let r=e[0].startLineNumber,s=e[0].endLineNumber;for(let l=1,c=e.length;l<c;l++){let u=e[l];r=Math.min(r,u.startLineNumber),s=Math.max(s,u.endLineNumber)}this.minLineNumber=r,this.maxLineNumber=s}},kwt=class a extends np{static{this.HORIZONTAL_EXTRA_PX=30}constructor(i,e,t){super(i);let o=this._context.configuration,n=this._context.configuration.options,r=n.get(59),s=n.get(166);this._lineHeight=n.get(75),this._typicalHalfwidthCharacterWidth=r.typicalHalfwidthCharacterWidth,this._isViewportWrapping=s.isViewportWrapping,this._revealHorizontalRightPadding=n.get(114),this._cursorSurroundingLines=n.get(35),this._cursorSurroundingLinesStyle=n.get(36),this._canUseLayerHinting=!n.get(39),this._viewLineOptions=new z5(o,this._context.theme.type),this._linesContent=t,this._textRangeRestingSpot=document.createElement("div"),this._visibleLines=new hxe(this._context,{createLine:()=>new OB(e,this._viewLineOptions)}),this.domNode=this._visibleLines.domNode,MI.write(this.domNode,8),this.domNode.setClassName(`view-lines ${xT}`),ku(this.domNode,r),this._maxLineWidth=0,this._asyncUpdateLineWidths=new Dt(()=>{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new Dt(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new sai,this._horizontalRevealRequest=null,this._stickyScrollEnabled=n.get(131).enabled,this._maxNumberStickyLines=n.get(131).maxLineCount}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}onConfigurationChanged(i){this._visibleLines.onConfigurationChanged(i),i.hasChanged(166)&&(this._maxLineWidth=0);let e=this._context.configuration.options,t=e.get(59),o=e.get(166);return this._lineHeight=e.get(75),this._typicalHalfwidthCharacterWidth=t.typicalHalfwidthCharacterWidth,this._isViewportWrapping=o.isViewportWrapping,this._revealHorizontalRightPadding=e.get(114),this._cursorSurroundingLines=e.get(35),this._cursorSurroundingLinesStyle=e.get(36),this._canUseLayerHinting=!e.get(39),this._stickyScrollEnabled=e.get(131).enabled,this._maxNumberStickyLines=e.get(131).maxLineCount,ku(this.domNode,t),this._onOptionsMaybeChanged(),i.hasChanged(165)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){let i=this._context.configuration,e=new z5(i,this._context.theme.type);if(!this._viewLineOptions.equals(e)){this._viewLineOptions=e;let t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++)this._visibleLines.getVisibleLine(n).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber(),o=!1;for(let n=e;n<=t;n++)o=this._visibleLines.getVisibleLine(n).onSelectionChanged()||o;return o}onDecorationsChanged(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let o=e;o<=t;o++)this._visibleLines.getVisibleLine(o).onDecorationsChanged();return!0}onFlushed(i){let e=this._visibleLines.onFlushed(i,this._viewLineOptions.useGpu);return this._maxLineWidth=0,e}onLinesChanged(i){return this._visibleLines.onLinesChanged(i)}onLinesDeleted(i){return this._visibleLines.onLinesDeleted(i)}onLinesInserted(i){return this._visibleLines.onLinesInserted(i)}onRevealRangeRequest(i){let e=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),i.source,i.minimalReveal,i.range,i.selections,i.verticalType);if(e===-1)return!1;let t=this._context.viewLayout.validateScrollPosition({scrollTop:e});i.revealHorizontal?i.range&&i.range.startLineNumber!==i.range.endLineNumber?t={scrollTop:t.scrollTop,scrollLeft:0}:i.range?this._horizontalRevealRequest=new aai(i.minimalReveal,i.range.startLineNumber,i.range.startColumn,i.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),t.scrollTop,i.scrollType):i.selections&&i.selections.length>0&&(this._horizontalRevealRequest=new lai(i.minimalReveal,i.selections,this._context.viewLayout.getCurrentScrollTop(),t.scrollTop,i.scrollType)):this._horizontalRevealRequest=null;let n=Math.abs(this._context.viewLayout.getCurrentScrollTop()-t.scrollTop)<=this._lineHeight?1:i.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(t,n),!0}onScrollChanged(i){if(this._horizontalRevealRequest&&i.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&i.scrollTopChanged){let e=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),t=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(i.scrollTop<e||i.scrollTop>t)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(i.scrollWidth),this._visibleLines.onScrollChanged(i)||i.scrollTopChanged||i.scrollLeftChanged}onTokensChanged(i){return this._visibleLines.onTokensChanged(i)}onZonesChanged(i){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(i)}onThemeChanged(i){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(i,e){let t=this._getViewLineDomNode(i);if(t===null)return null;let o=this._getLineNumberFor(t);if(o===-1||o<1||o>this._context.viewModel.getLineCount())return null;if(this._context.viewModel.getLineMaxColumn(o)===1)return new ye(o,1);let n=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();if(o<n||o>r)return null;let s=this._visibleLines.getVisibleLine(o).getColumnOfNodeOffset(i,e),l=this._context.viewModel.getLineMinColumn(o);return s<l&&(s=l),new ye(o,s)}_getViewLineDomNode(i){for(;i&&i.nodeType===1;){if(i.className===OB.CLASS_NAME)return i;i=i.parentElement}return null}_getLineNumberFor(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();for(let o=e;o<=t;o++){let n=this._visibleLines.getVisibleLine(o);if(i===n.getDomNode())return o}return-1}getLineWidth(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber();if(i<e||i>t)return-1;let o=new Cxe(this.domNode.domNode,this._textRangeRestingSpot),n=this._visibleLines.getVisibleLine(i).getWidth(o);return this._updateLineWidthsSlowIfDomDidLayout(o),n}resetLineWidthCaches(){let i=this._visibleLines.getStartLineNumber(),e=this._visibleLines.getEndLineNumber();for(let t=i;t<=e;t++)this._visibleLines.getVisibleLine(t).resetCachedWidth()}linesVisibleRangesForRange(i,e){let t=i.endLineNumber,o=G.intersectRanges(i,this._lastRenderedData.getCurrentVisibleRange());if(!o)return null;let n=[],r=0,s=new Cxe(this.domNode.domNode,this._textRangeRestingSpot),l=0;e&&(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(o.startLineNumber,1)).lineNumber);let c=this._visibleLines.getStartLineNumber(),u=this._visibleLines.getEndLineNumber();for(let p=o.startLineNumber;p<=o.endLineNumber;p++){if(p<c||p>u)continue;let h=p===o.startLineNumber?o.startColumn:1,g=p!==t,f=g?this._context.viewModel.getLineMaxColumn(p):o.endColumn,b=this._visibleLines.getVisibleLine(p).getVisibleRangesForRange(p,h,f,s);if(b){if(e&&p<t){let S=l;if(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(p+1,1)).lineNumber,S!==l){let y=b.ranges[b.ranges.length-1];y.width+=this._typicalHalfwidthCharacterWidth,this._context.viewModel.getTextDirection(S)===1&&(y.left-=this._typicalHalfwidthCharacterWidth)}}n[r++]=new $Ce(b.outsideRenderedLine,p,pX.from(b.ranges),g)}}return this._updateLineWidthsSlowIfDomDidLayout(s),r===0?null:n}_visibleRangesForLineRange(i,e,t){if(i<this._visibleLines.getStartLineNumber()||i>this._visibleLines.getEndLineNumber())return null;let o=new Cxe(this.domNode.domNode,this._textRangeRestingSpot),n=this._visibleLines.getVisibleLine(i).getVisibleRangesForRange(i,e,t,o);return this._updateLineWidthsSlowIfDomDidLayout(o),n}_lineIsRenderedRTL(i){return i<this._visibleLines.getStartLineNumber()||i>this._visibleLines.getEndLineNumber()?!1:this._visibleLines.getVisibleLine(i).isRenderedRTL()}visibleRangeForPosition(i){let e=this._visibleRangesForLineRange(i.lineNumber,i.column,i.column);return e?new jCe(e.outsideRenderedLine,e.ranges[0].left):null}updateLineWidths(){this._updateLineWidths(!1)}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidthsSlowIfDomDidLayout(i){i.didDomLayout&&this._asyncUpdateLineWidths.isScheduled()&&(this._asyncUpdateLineWidths.cancel(),this._updateLineWidthsSlow())}_updateLineWidths(i){let e=this._visibleLines.getStartLineNumber(),t=this._visibleLines.getEndLineNumber(),o=1,n=!0;for(let r=e;r<=t;r++){let s=this._visibleLines.getVisibleLine(r);if(i&&!s.getWidthIsFast()){n=!1;continue}o=Math.max(o,s.getWidth(null))}return n&&e===1&&t===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(o),n}_checkMonospaceFontAssumptions(){let i=-1,e=-1,t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++){let r=this._visibleLines.getVisibleLine(n);if(r.needsMonospaceFontCheck()){let s=r.getWidth(null);s>e&&(e=s,i=n)}}if(i!==-1&&!this._visibleLines.getVisibleLine(i).monospaceAssumptionsAreValid())for(let n=t;n<=o;n++)this._visibleLines.getVisibleLine(n).onMonospaceAssumptionsInvalidated()}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(i){if(this._visibleLines.renderLines(i),this._lastRenderedData.setCurrentVisibleRange(i.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){let t=this._horizontalRevealRequest;if(i.startLineNumber<=t.minLineNumber&&t.maxLineNumber<=i.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();let o=this._computeScrollLeftToReveal(t);o&&(!this._isViewportWrapping&&!o.hasRTL&&this._ensureMaxLineWidth(o.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:o.scrollLeft},t.scrollType))}}if(this._updateLineWidthsFast()?this._asyncUpdateLineWidths.cancel():this._asyncUpdateLineWidths.schedule(),Sn&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){let t=this._visibleLines.getStartLineNumber(),o=this._visibleLines.getEndLineNumber();for(let n=t;n<=o;n++)if(this._visibleLines.getVisibleLine(n).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");let e=this._context.viewLayout.getCurrentScrollTop()-i.bigNumbersDelta;this._linesContent.setTop(-e),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(i){if(this._viewLineOptions.useGpu)return;let e=Math.ceil(i);this._maxLineWidth<e&&(this._maxLineWidth=e,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeScrollTopToRevealRange(i,e,t,o,n,r){let s=i.top,l=i.height,c=s+l,u,p,h;if(n&&n.length>0){let S=n[0].startLineNumber,y=n[0].endLineNumber;for(let w=1,x=n.length;w<x;w++){let E=n[w];S=Math.min(S,E.startLineNumber),y=Math.max(y,E.endLineNumber)}u=!1,p=this._context.viewLayout.getVerticalOffsetForLineNumber(S),h=this._context.viewLayout.getVerticalOffsetForLineNumber(y)+this._lineHeight}else if(o)u=!0,p=this._context.viewLayout.getVerticalOffsetForLineNumber(o.startLineNumber),h=this._context.viewLayout.getVerticalOffsetForLineNumber(o.endLineNumber)+this._lineHeight;else return-1;let g=(e==="mouse"||t)&&this._cursorSurroundingLinesStyle==="default",f=0,v=0;if(g)t||(f=this._lineHeight);else{let S=l/this._lineHeight,y=Math.max(this._cursorSurroundingLines,this._stickyScrollEnabled?this._maxNumberStickyLines:0),w=Math.min(S/2,y);f=w*this._lineHeight,v=Math.max(0,w-1)*this._lineHeight}t||(r===0||r===4)&&(v+=this._lineHeight),p-=f,h+=v;let b;if(h-p>l){if(!u)return-1;b=p}else if(r===5||r===6)if(r===6&&s<=p&&h<=c)b=s;else{let S=Math.max(5*this._lineHeight,l*.2),y=p-S,w=h-l;b=Math.max(w,y)}else if(r===1||r===2)if(r===2&&s<=p&&h<=c)b=s;else{let S=(p+h)/2;b=Math.max(0,S-l/2)}else b=this._computeMinimumScrolling(s,c,p,h,r===3,r===4);return b}_computeScrollLeftToReveal(i){let e=this._context.viewLayout.getCurrentViewport(),t=this._context.configuration.options.get(165),o=e.left,n=o+e.width-t.verticalScrollbarWidth,r=1073741824,s=0,l=!1;if(i.type==="range"){l=this._lineIsRenderedRTL(i.lineNumber);let u=this._visibleRangesForLineRange(i.lineNumber,i.startColumn,i.endColumn);if(!u)return null;for(let p of u.ranges)r=Math.min(r,Math.round(p.left)),s=Math.max(s,Math.round(p.left+p.width))}else for(let u of i.selections){if(u.startLineNumber!==u.endLineNumber)return null;let p=this._visibleRangesForLineRange(u.startLineNumber,u.startColumn,u.endColumn);if(l||=this._lineIsRenderedRTL(u.startLineNumber),!p)return null;for(let h of p.ranges)r=Math.min(r,Math.round(h.left)),s=Math.max(s,Math.round(h.left+h.width))}return i.minimalReveal||(r=Math.max(0,r-a.HORIZONTAL_EXTRA_PX),s+=this._revealHorizontalRightPadding),i.type==="selections"&&s-r>e.width?null:{scrollLeft:this._computeMinimumScrolling(o,n,r,s),maxHorizontalOffset:s,hasRTL:l}}_computeMinimumScrolling(i,e,t,o,n,r){i=i|0,e=e|0,t=t|0,o=o|0,n=!!n,r=!!r;let s=e-i;if(o-t<s){if(n)return t;if(r)return Math.max(0,o-s);if(t<i)return t;if(o>e)return Math.max(0,o-s)}else return t;return i}};var Ewt=class extends Sxe{constructor(i){super(),this._context=i;let t=this._context.configuration.options.get(165);this._decorationsLeft=t.decorationsLeft,this._decorationsWidth=t.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._decorationsLeft=t.decorationsLeft,this._decorationsWidth=t.decorationsWidth,!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}_getDecorations(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.options.linesDecorationsClassName,c=s.options.zIndex;l&&(t[o++]=new nde(s.range.startLineNumber,s.range.endLineNumber,l,s.options.linesDecorationsTooltip??null,c));let u=s.options.firstLineDecorationClassName;u&&(t[o++]=new nde(s.range.startLineNumber,s.range.startLineNumber,u,s.options.linesDecorationsTooltip??null,c))}return t}prepareRender(i){let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=this._render(e,t,this._getDecorations(i)),n=this._decorationsLeft.toString(),r=this._decorationsWidth.toString(),s='" style="left:'+n+"px;width:"+r+'px;"></div>',l=[];for(let c=e;c<=t;c++){let u=c-e,p=o[u].getDecorations(),h="";for(let g of p){let f='<div class="cldr '+g.className;g.tooltip!==null&&(f+='" title="'+g.tooltip),f+=s,h+=f}l[u]=h}this._renderResult=l}render(i,e){return this._renderResult?this._renderResult[e-i]:""}};var xxe=class a extends np{static{this.CLASS_NAME="glyph-margin"}static{this.OUTER_CLASS_NAME="margin"}constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._canUseLayerHinting=!e.get(39),this._contentLeft=t.contentLeft,this._glyphMarginLeft=t.glyphMarginLeft,this._glyphMarginWidth=t.glyphMarginWidth,this._domNode=Ir(document.createElement("div")),this._domNode.setClassName(a.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=Ir(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(a.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}getDomNode(){return this._domNode}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._canUseLayerHinting=!e.get(39),this._contentLeft=t.contentLeft,this._glyphMarginLeft=t.glyphMarginLeft,this._glyphMarginWidth=t.glyphMarginWidth,!0}onScrollChanged(i){return super.onScrollChanged(i)||i.scrollTopChanged}prepareRender(i){}render(i){this._domNode.setLayerHinting(this._canUseLayerHinting),this._domNode.setContain("strict");let e=i.scrollTop-i.bigNumbersDelta;this._domNode.setTop(-e);let t=Math.min(i.scrollHeight,1e6);this._domNode.setHeight(t),this._domNode.setWidth(this._contentLeft),this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft),this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth),this._glyphMarginBackgroundDomNode.setHeight(t)}};var Twt=class extends Sxe{constructor(i){super(),this._context=i,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){return!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}_getDecorations(i){let e=i.getDecorationsInViewport(),t=[],o=0;for(let n=0,r=e.length;n<r;n++){let s=e[n],l=s.options.marginClassName,c=s.options.zIndex;l&&(t[o++]=new nde(s.range.startLineNumber,s.range.endLineNumber,l,null,c))}return t}prepareRender(i){let e=i.visibleRange.startLineNumber,t=i.visibleRange.endLineNumber,o=this._render(e,t,this._getDecorations(i)),n=[];for(let r=e;r<=t;r++){let s=r-e,l=o[s].getDecorations(),c="";for(let u of l)c+='<div class="cmdr '+u.className+'" style=""></div>';n[s]=c}this._renderResult=n}render(i,e){return this._renderResult?this._renderResult[e-i]:""}};var FF=class a{constructor(i,e,t,o){this._rgba8Brand=void 0;this.r=a._clamp(i),this.g=a._clamp(e),this.b=a._clamp(t),this.a=a._clamp(o)}static{this.Empty=new a(0,0,0,0)}equals(i){return this.r===i.r&&this.g===i.g&&this.b===i.b&&this.a===i.a}static _clamp(i){return i<0?0:i>255?255:i|0}};var hXi=(()=>{let a=[];for(let i=32;i<=126;i++)a.push(i);return a.push(65533),a})(),gXi=(a,i)=>(a-=32,a<0||a>96?i<=2?(a+96)%96:95:a);var kxe=class a extends k{constructor(){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._updateColorMap(),this._register(vc.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}static{this._INSTANCE=null}static getInstance(){return this._INSTANCE||(this._INSTANCE=bp(new a)),this._INSTANCE}_updateColorMap(){let e=vc.getColorMap();if(!e){this._colors=[];for(let o=0;o<=2;o++)this._colors[o]=FF.Empty;this._backgroundIsLight=!0;return}this._colors=[FF.Empty];for(let o=1;o<e.length;o++){let n=e[o].rgba;this._colors[o]=new FF(n.r,n.g,n.b,Math.round(n.a*255))}let t=e[2].getRelativeLuminance();this._backgroundIsLight=t>=.5,this._onDidChange.fire(void 0)}getColor(e){(e<1||e>=this._colors.length)&&(e=2);let t=this._colors[e];return t||(mt(new ci(`Missing color for colorId ${e}`)),t=FF.Empty),t}backgroundIsLight(){return this._backgroundIsLight}};var J3e=class a{constructor(i,e){this.scale=e;this._minimapCharRendererBrand=void 0;this.charDataNormal=a.soften(i,12/15),this.charDataLight=a.soften(i,50/60)}static soften(i,e){let t=new Uint8ClampedArray(i.length);for(let o=0,n=i.length;o<n;o++)t[o]=Rle(i[o]*e);return t}renderChar(i,e,t,o,n,r,s,l,c,u,p){let h=1*this.scale,g=2*this.scale,f=p?1:g;if(e+h>i.width||t+f>i.height){console.warn("bad render request outside image data");return}let v=u?this.charDataLight:this.charDataNormal,b=gXi(o,c),S=i.width*4,y=s.r,w=s.g,x=s.b,E=n.r-y,M=n.g-w,N=n.b-x,V=Math.max(r,l),H=i.data,K=b*h*g,j=t*S+e*4;for(let J=0;J<f;J++){let se=j;for(let ae=0;ae<h;ae++){let ce=v[K++]/255*(r/255);H[se++]=y+E*ce,H[se++]=w+M*ce,H[se++]=x+N*ce,H[se++]=V}j+=S}}blockRenderChar(i,e,t,o,n,r,s,l){let c=1*this.scale,u=2*this.scale,p=l?1:u;if(e+c>i.width||t+p>i.height){console.warn("bad render request outside image data");return}let h=i.width*4,g=.5*(n/255),f=r.r,v=r.g,b=r.b,S=o.r-f,y=o.g-v,w=o.b-b,x=f+S*g,E=v+y*g,M=b+w*g,N=Math.max(n,s),V=i.data,H=t*h+e*4;for(let K=0;K<p;K++){let j=H;for(let J=0;J<c;J++)V[j++]=x,V[j++]=E,V[j++]=M,V[j++]=N;H+=h}}};var vXi={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15},bXi=a=>{let i=new Uint8ClampedArray(a.length/2);for(let e=0;e<a.length;e+=2)i[e>>1]=vXi[a[e]]<<4|vXi[a[e+1]]&15;return i},cai={1:bd(()=>bXi("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:bd(()=>bXi("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};var _wt=class a{static create(i,e){if(this.lastCreated&&i===this.lastCreated.scale&&e===this.lastFontFamily)return this.lastCreated;let t;return cai[i]?t=new J3e(cai[i](),i):t=a.createFromSampleData(a.createSampleData(e).data,i),this.lastFontFamily=e,this.lastCreated=t,t}static createSampleData(i){let e=document.createElement("canvas"),t=e.getContext("2d");e.style.height="16px",e.height=16,e.width=960,e.style.width=960+"px",t.fillStyle="#ffffff",t.font=`bold 16px ${i}`,t.textBaseline="middle";let o=0;for(let n of hXi)t.fillText(String.fromCharCode(n),o,16/2),o+=10;return t.getImageData(0,0,960,16)}static createFromSampleData(i,e){let t=640*96;if(i.length!==t)throw new Error("Unexpected source in MinimapCharRenderer");let o=a._downsample(i,e);return new J3e(o,e)}static _downsampleChar(i,e,t,o,n){let r=1*n,s=2*n,l=o,c=0;for(let u=0;u<s;u++){let p=u/s*16,h=(u+1)/s*16;for(let g=0;g<r;g++){let f=g/r*10,v=(g+1)/r*10,b=0,S=0;for(let w=p;w<h;w++){let x=e+Math.floor(w)*3840,E=1-(w-Math.floor(w));for(let M=f;M<v;M++){let N=1-(M-Math.floor(M)),V=x+Math.floor(M)*4,H=N*E;S+=H,b+=i[V]*i[V+3]/255*H}}let y=b/S;c=Math.max(c,y),t[l++]=Rle(y)}}return c}static _downsample(i,e){let t=2*e*1*e,o=t*96,n=new Uint8ClampedArray(o),r=0,s=0,l=0;for(let c=0;c<96;c++)l=Math.max(l,this._downsampleChar(i,s,n,r,e)),r+=t,s+=40;if(l>0){let c=255/l;for(let u=0;u<o;u++)n[u]*=c}return n}};var WF=ii?'"Segoe WPC", "Segoe UI", sans-serif':et?"-apple-system, BlinkMacSystemFont, sans-serif":'system-ui, "Ubuntu", "Droid Sans", sans-serif',VGo=async()=>{try{return[...await ut.queryLocalFonts()].map(t=>t.family)}catch(a){return console.error(`Failed to query fonts: ${a}`),[]}},Dwt=async()=>Avt?(await VGo()).map(e=>({body:`${e}`})):[];var UGo=140,zGo=2,Rwt=class a{constructor(i,e,t){let o=i.options,n=o.get(163),r=o.get(165),s=r.minimap,l=o.get(59),c=o.get(81);this.renderMinimap=s.renderMinimap,this.size=c.size,this.minimapHeightIsEditorHeight=s.minimapHeightIsEditorHeight,this.scrollBeyondLastLine=o.get(119),this.paddingTop=o.get(96).top,this.paddingBottom=o.get(96).bottom,this.showSlider=c.showSlider,this.autohide=c.autohide,this.pixelRatio=n,this.typicalHalfwidthCharacterWidth=l.typicalHalfwidthCharacterWidth,this.lineHeight=o.get(75),this.minimapLeft=s.minimapLeft,this.minimapWidth=s.minimapWidth,this.minimapHeight=r.height,this.canvasInnerWidth=s.minimapCanvasInnerWidth,this.canvasInnerHeight=s.minimapCanvasInnerHeight,this.canvasOuterWidth=s.minimapCanvasOuterWidth,this.canvasOuterHeight=s.minimapCanvasOuterHeight,this.isSampling=s.minimapIsSampling,this.editorHeight=r.height,this.fontScale=s.minimapScale,this.minimapLineHeight=s.minimapLineHeight,this.minimapCharWidth=1*this.fontScale,this.sectionHeaderFontFamily=WF,this.sectionHeaderFontSize=c.sectionHeaderFontSize*n,this.sectionHeaderLetterSpacing=c.sectionHeaderLetterSpacing,this.sectionHeaderFontColor=a._getSectionHeaderColor(e,t.getColor(1)),this.charRenderer=bd(()=>_wt.create(this.fontScale,l.fontFamily)),this.defaultBackgroundColor=t.getColor(2),this.backgroundColor=a._getMinimapBackground(e,this.defaultBackgroundColor),this.foregroundAlpha=a._getMinimapForegroundOpacity(e)}static _getMinimapBackground(i,e){let t=i.getColor(p7i);return t?new FF(t.rgba.r,t.rgba.g,t.rgba.b,Math.round(255*t.rgba.a)):e}static _getMinimapForegroundOpacity(i){let e=i.getColor(m7i);return e?FF._clamp(Math.round(255*e.rgba.a)):255}static _getSectionHeaderColor(i,e){let t=i.getColor(Vd);return t?new FF(t.rgba.r,t.rgba.g,t.rgba.b,Math.round(255*t.rgba.a)):e}equals(i){return this.renderMinimap===i.renderMinimap&&this.size===i.size&&this.minimapHeightIsEditorHeight===i.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===i.scrollBeyondLastLine&&this.paddingTop===i.paddingTop&&this.paddingBottom===i.paddingBottom&&this.showSlider===i.showSlider&&this.autohide===i.autohide&&this.pixelRatio===i.pixelRatio&&this.typicalHalfwidthCharacterWidth===i.typicalHalfwidthCharacterWidth&&this.lineHeight===i.lineHeight&&this.minimapLeft===i.minimapLeft&&this.minimapWidth===i.minimapWidth&&this.minimapHeight===i.minimapHeight&&this.canvasInnerWidth===i.canvasInnerWidth&&this.canvasInnerHeight===i.canvasInnerHeight&&this.canvasOuterWidth===i.canvasOuterWidth&&this.canvasOuterHeight===i.canvasOuterHeight&&this.isSampling===i.isSampling&&this.editorHeight===i.editorHeight&&this.fontScale===i.fontScale&&this.minimapLineHeight===i.minimapLineHeight&&this.minimapCharWidth===i.minimapCharWidth&&this.sectionHeaderFontSize===i.sectionHeaderFontSize&&this.sectionHeaderLetterSpacing===i.sectionHeaderLetterSpacing&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(i.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(i.backgroundColor)&&this.foregroundAlpha===i.foregroundAlpha}},dai=class a{constructor(i,e,t,o,n,r,s,l,c){this.scrollTop=i;this.scrollHeight=e;this.sliderNeeded=t;this._computedSliderRatio=o;this.sliderTop=n;this.sliderHeight=r;this.topPaddingLineCount=s;this.startLineNumber=l;this.endLineNumber=c}getDesiredScrollTopFromDelta(i){return Math.round(this.scrollTop+i/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(i){return Math.round((i-this.sliderHeight/2)/this._computedSliderRatio)}intersectWithViewport(i){let e=Math.max(this.startLineNumber,i.startLineNumber),t=Math.min(this.endLineNumber,i.endLineNumber);return e>t?null:[e,t]}getYForLineNumber(i,e){return+(i-this.startLineNumber+this.topPaddingLineCount)*e}static create(i,e,t,o,n,r,s,l,c,u,p){let h=i.pixelRatio,g=i.minimapLineHeight,f=Math.floor(i.canvasInnerHeight/g),v=i.lineHeight;if(i.minimapHeightIsEditorHeight){let M=l*i.lineHeight+i.paddingTop+i.paddingBottom;i.scrollBeyondLastLine&&(M+=Math.max(0,n-i.lineHeight-i.paddingBottom));let N=Math.max(1,Math.floor(n*n/M)),V=Math.max(0,i.minimapHeight-N),H=V/(u-n),K=c*H,j=V>0,J=Math.floor(i.canvasInnerHeight/i.minimapLineHeight),se=Math.floor(i.paddingTop/i.lineHeight);return new a(c,u,j,H,K,N,se,1,Math.min(s,J))}let b;if(r&&t!==s){let M=t-e+1;b=Math.floor(M*g/h)}else{let M=n/v;b=Math.floor(M*g/h)}let S=Math.floor(i.paddingTop/v),y=Math.floor(i.paddingBottom/v);if(i.scrollBeyondLastLine){let M=n/v;y=Math.max(y,M-1)}let w;if(y>0){let M=n/v;w=(S+s+y-M-1)*g/h}else w=Math.max(0,(S+s)*g/h-b);w=Math.min(i.minimapHeight-b,w);let x=w/(u-n),E=c*x;if(f>=S+s+y){let M=w>0;return new a(c,u,M,x,E,b,S,1,s)}else{let M;e>1?M=e+S:M=Math.max(1,c/v);let N,V=Math.max(1,Math.floor(M-E*h/g));V<S?(N=S-V+1,V=1):(N=0,V=Math.max(1,V-S)),p&&p.scrollHeight===u&&(p.scrollTop>c&&(V=Math.min(V,p.startLineNumber),N=Math.max(N,p.topPaddingLineCount)),p.scrollTop<c&&(V=Math.max(V,p.startLineNumber),N=Math.min(N,p.topPaddingLineCount)));let H=Math.min(s,V-N+f-1),K=(c-o)/v,j;return c>=i.paddingTop?j=(e-V+N+K)*g/h:j=c/i.paddingTop*(N+K)*g/h,new a(c,u,!0,x,j,b,N,V,H)}}},Lwt=class a{static{this.INVALID=new a(-1)}constructor(i){this.dy=i}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}},Mwt=class{constructor(i,e,t){this.renderedLayout=i,this._imageData=e,this._renderedLines=new Y3e({createLine:()=>Lwt.INVALID}),this._renderedLines._set(i.startLineNumber,t)}linesEquals(i){if(!this.scrollEquals(i))return!1;let t=this._renderedLines._get().lines;for(let o=0,n=t.length;o<n;o++)if(t[o].dy===-1)return!1;return!0}scrollEquals(i){return this.renderedLayout.startLineNumber===i.startLineNumber&&this.renderedLayout.endLineNumber===i.endLineNumber}_get(){let i=this._renderedLines._get();return{imageData:this._imageData,rendLineNumberStart:i.rendLineNumberStart,lines:i.lines}}onLinesChanged(i,e){return this._renderedLines.onLinesChanged(i,e)}onLinesDeleted(i,e){this._renderedLines.onLinesDeleted(i,e)}onLinesInserted(i,e){this._renderedLines.onLinesInserted(i,e)}onTokensChanged(i){return this._renderedLines.onTokensChanged(i)}},uai=class a{constructor(i,e,t,o){this._backgroundFillData=a._createBackgroundFillData(e,t,o),this._buffers=[i.createImageData(e,t),i.createImageData(e,t)],this._lastUsedBuffer=0}getBuffer(){this._lastUsedBuffer=1-this._lastUsedBuffer;let i=this._buffers[this._lastUsedBuffer];return i.data.set(this._backgroundFillData),i}static _createBackgroundFillData(i,e,t){let o=t.r,n=t.g,r=t.b,s=t.a,l=new Uint8ClampedArray(i*e*4),c=0;for(let u=0;u<e;u++)for(let p=0;p<i;p++)l[c]=o,l[c+1]=n,l[c+2]=r,l[c+3]=s,c+=4;return l}},Pwt=class a{constructor(i,e){this.samplingRatio=i;this.minimapLines=e}static compute(i,e,t){if(i.renderMinimap===0||!i.isSampling)return[null,[]];let{minimapLineCount:o}=Q4e.computeContainedMinimapLineCount({viewLineCount:e,scrollBeyondLastLine:i.scrollBeyondLastLine,paddingTop:i.paddingTop,paddingBottom:i.paddingBottom,height:i.editorHeight,lineHeight:i.lineHeight,pixelRatio:i.pixelRatio}),n=e/o,r=n/2;if(!t||t.minimapLines.length===0){let b=[];if(b[0]=1,o>1){for(let S=0,y=o-1;S<y;S++)b[S]=Math.round(S*n+r);b[o-1]=e}return[new a(n,b),[]]}let s=t.minimapLines,l=s.length,c=[],u=0,p=0,h=1,g=10,f=[],v=null;for(let b=0;b<o;b++){let S=Math.max(h,Math.round(b*n)),y=Math.max(S,Math.round((b+1)*n));for(;u<l&&s[u]<S;){if(f.length<g){let x=u+1+p;v&&v.type==="deleted"&&v._oldIndex===u-1?v.deleteToLineNumber++:(v={type:"deleted",_oldIndex:u,deleteFromLineNumber:x,deleteToLineNumber:x},f.push(v)),p--}u++}let w;if(u<l&&s[u]<=y)w=s[u],u++;else if(b===0?w=1:b+1===o?w=e:w=Math.round(b*n+r),f.length<g){let x=u+1+p;v&&v.type==="inserted"&&v._i===b-1?v.insertToLineNumber++:(v={type:"inserted",_i:b,insertFromLineNumber:x,insertToLineNumber:x},f.push(v)),p++}c[b]=w,h=w}if(f.length<g)for(;u<l;){let b=u+1+p;v&&v.type==="deleted"&&v._oldIndex===u-1?v.deleteToLineNumber++:(v={type:"deleted",_oldIndex:u,deleteFromLineNumber:b,deleteToLineNumber:b},f.push(v)),p--,u++}else f=[{type:"flush"}];return[new a(n,c),f]}modelLineToMinimapLine(i){return Math.min(this.minimapLines.length,Math.max(1,Math.round(i/this.samplingRatio)))}modelLineRangeToMinimapLineRange(i,e){let t=this.modelLineToMinimapLine(i)-1;for(;t>0&&this.minimapLines[t-1]>=i;)t--;let o=this.modelLineToMinimapLine(e)-1;for(;o+1<this.minimapLines.length&&this.minimapLines[o+1]<=e;)o++;if(t===o){let n=this.minimapLines[t];if(n<i||n>e)return null}return[t+1,o+1]}decorationLineRangeToMinimapLineRange(i,e){let t=this.modelLineToMinimapLine(i),o=this.modelLineToMinimapLine(e);return i!==e&&o===t&&(o===this.minimapLines.length?t>1&&t--:o++),[t,o]}onLinesDeleted(i){let e=i.toLineNumber-i.fromLineNumber+1,t=this.minimapLines.length,o=0;for(let n=this.minimapLines.length-1;n>=0&&!(this.minimapLines[n]<i.fromLineNumber);n--)this.minimapLines[n]<=i.toLineNumber?(this.minimapLines[n]=Math.max(1,i.fromLineNumber-1),t=Math.min(t,n),o=Math.max(o,n)):this.minimapLines[n]-=e;return[t,o]}onLinesInserted(i){let e=i.toLineNumber-i.fromLineNumber+1;for(let t=this.minimapLines.length-1;t>=0&&!(this.minimapLines[t]<i.fromLineNumber);t--)this.minimapLines[t]+=e}},Awt=class extends np{constructor(e){super(e);this._sectionHeaderCache=new Ua(10,1.5);this.tokensColorTracker=kxe.getInstance(),this._selections=[],this._minimapSelections=null,this.options=new Rwt(this._context.configuration,this._context.theme,this.tokensColorTracker);let[t]=Pwt.compute(this.options,this._context.viewModel.getLineCount(),null);this._samplingState=t,this._shouldCheckSampling=!1,this._actual=new pai(e.theme,this)}dispose(){this._actual.dispose(),super.dispose()}getDomNode(){return this._actual.getDomNode()}_onOptionsMaybeChanged(){let e=new Rwt(this._context.configuration,this._context.theme,this.tokensColorTracker);return this.options.equals(e)?!1:(this.options=e,this._recreateLineSampling(),this._actual.onDidChangeOptions(),!0)}onConfigurationChanged(e){return this._onOptionsMaybeChanged()}onCursorStateChanged(e){return this._selections=e.selections,this._minimapSelections=null,this._actual.onSelectionChanged()}onDecorationsChanged(e){return e.affectsMinimap?this._actual.onDecorationsChanged():!1}onFlushed(e){return this._samplingState&&(this._shouldCheckSampling=!0),this._actual.onFlushed()}onLinesChanged(e){if(this._samplingState){let t=this._samplingState.modelLineRangeToMinimapLineRange(e.fromLineNumber,e.fromLineNumber+e.count-1);return t?this._actual.onLinesChanged(t[0],t[1]-t[0]+1):!1}else return this._actual.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){if(this._samplingState){let[t,o]=this._samplingState.onLinesDeleted(e);return t<=o&&this._actual.onLinesChanged(t+1,o-t+1),this._shouldCheckSampling=!0,!0}else return this._actual.onLinesDeleted(e.fromLineNumber,e.toLineNumber)}onLinesInserted(e){return this._samplingState?(this._samplingState.onLinesInserted(e),this._shouldCheckSampling=!0,!0):this._actual.onLinesInserted(e.fromLineNumber,e.toLineNumber)}onScrollChanged(e){return this._actual.onScrollChanged(e)}onThemeChanged(e){return this._actual.onThemeChanged(),this._onOptionsMaybeChanged(),!0}onTokensChanged(e){if(this._samplingState){let t=[];for(let o of e.ranges){let n=this._samplingState.modelLineRangeToMinimapLineRange(o.fromLineNumber,o.toLineNumber);n&&t.push({fromLineNumber:n[0],toLineNumber:n[1]})}return t.length?this._actual.onTokensChanged(t):!1}else return this._actual.onTokensChanged(e.ranges)}onTokensColorsChanged(e){return this._onOptionsMaybeChanged(),this._actual.onTokensColorsChanged()}onZonesChanged(e){return this._actual.onZonesChanged()}prepareRender(e){this._shouldCheckSampling&&(this._shouldCheckSampling=!1,this._recreateLineSampling())}render(e){let t=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber;this._samplingState&&(t=this._samplingState.modelLineToMinimapLine(t),o=this._samplingState.modelLineToMinimapLine(o));let n={viewportContainsWhitespaceGaps:e.viewportData.whitespaceViewportData.length>0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:o,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(n)}_recreateLineSampling(){this._minimapSelections=null;let e=!!this._samplingState,[t,o]=Pwt.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(let n of o)switch(n.type){case"deleted":this._actual.onLinesDeleted(n.deleteFromLineNumber,n.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(n.insertFromLineNumber,n.insertToLineNumber);break;case"flush":this._actual.onFlushed();break}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,o){if(this._samplingState){let n=[];for(let r=0,s=t-e+1;r<s;r++)o[r]?n[r]=this._context.viewModel.getViewLineData(this._samplingState.minimapLines[e+r-1]):n[r]=null;return n}return this._context.viewModel.getMinimapLinesRenderingData(e,t,o).data}getSelections(){if(this._minimapSelections===null)if(this._samplingState){this._minimapSelections=[];for(let e of this._selections){let[t,o]=this._samplingState.decorationLineRangeToMinimapLineRange(e.startLineNumber,e.endLineNumber);this._minimapSelections.push(new ei(t,e.startColumn,o,e.endColumn))}}else this._minimapSelections=this._selections;return this._minimapSelections}getMinimapDecorationsInViewport(e,t){return this._getMinimapDecorationsInViewport(e,t).filter(o=>!o.options.minimap?.sectionHeaderStyle)}getSectionHeaderDecorationsInViewport(e,t){let o=this.options.sectionHeaderFontSize/this.options.minimapLineHeight;return e=Math.floor(Math.max(1,e-o)),this._getMinimapDecorationsInViewport(e,t).filter(n=>!!n.options.minimap?.sectionHeaderStyle)}_getMinimapDecorationsInViewport(e,t){let o;if(this._samplingState){let r=this._samplingState.minimapLines[e-1],s=this._samplingState.minimapLines[t-1];o=new G(r,1,s,this._context.viewModel.getLineMaxColumn(s))}else o=new G(e,1,t,this._context.viewModel.getLineMaxColumn(t));let n=this._context.viewModel.getMinimapDecorationsInRange(o);if(this._samplingState){let r=[];for(let s of n){if(!s.options.minimap)continue;let l=s.range,c=this._samplingState.modelLineToMinimapLine(l.startLineNumber),u=this._samplingState.modelLineToMinimapLine(l.endLineNumber);r.push(new QCe(new G(c,l.startColumn,u,l.endColumn),s.options))}return r}return n}getSectionHeaderText(e,t){let o=e.options.minimap?.sectionHeaderText;if(!o)return null;let n=this._sectionHeaderCache.get(o);if(n)return n;let r=t(o);return this._sectionHeaderCache.set(o,r),r}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new G(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}},pai=class a extends k{constructor(e,t){super();this._renderDecorations=!1;this._gestureInProgress=!1;this._isMouseOverMinimap=!1;this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor(msi),this._domNode=Ir(document.createElement("div")),MI.write(this._domNode,9),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=Ir(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=Ir(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=Ir(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=Ir(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=Ir(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._hideDelayedScheduler=this._register(new Dt(()=>this._hideImmediatelyIfMouseIsOutside(),500)),this._register(Yo(this._domNode.domNode,ne.MOUSE_OVER,()=>{this._isMouseOverMinimap=!0})),this._register(Yo(this._domNode.domNode,ne.MOUSE_LEAVE,()=>{this._isMouseOverMinimap=!1})),this._pointerDownListener=Yo(this._domNode.domNode,ne.POINTER_DOWN,o=>{o.preventDefault();let n=o.pointerType==="mouse",r=o.button===0;if(this._model.options.renderMinimap!==0&&this._lastRenderData){if(this._model.options.size!=="proportional"){if(r&&this._lastRenderData){let l=ur(this._slider.domNode),c=l.top+l.height/2;this._startSliderDragging(o,c,this._lastRenderData.renderedLayout)}return}if(r||!n){let l=this._model.options.minimapLineHeight,c=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*o.offsetY,p=Math.floor(c/l)+this._lastRenderData.renderedLayout.startLineNumber-this._lastRenderData.renderedLayout.topPaddingLineCount;p=Math.min(p,this._model.getLineCount()),this._model.revealLineNumber(p)}}}),this._sliderPointerMoveMonitor=new fT,this._sliderPointerDownListener=Yo(this._slider.domNode,ne.POINTER_DOWN,o=>{o.preventDefault(),o.stopPropagation(),o.button===0&&this._lastRenderData&&this._startSliderDragging(o,o.pageY,this._lastRenderData.renderedLayout)}),this._gestureDisposable=ds.addTarget(this._domNode.domNode),this._sliderTouchStartListener=$(this._domNode.domNode,Vn.Start,o=>{o.preventDefault(),o.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(o))},{passive:!1}),this._sliderTouchMoveListener=$(this._domNode.domNode,Vn.Change,o=>{o.preventDefault(),o.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(o)},{passive:!1}),this._sliderTouchEndListener=Yo(this._domNode.domNode,Vn.End,o=>{o.preventDefault(),o.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_hideSoon(){this._hideDelayedScheduler.cancel(),this._hideDelayedScheduler.schedule()}_hideImmediatelyIfMouseIsOutside(){if(this._isMouseOverMinimap){this._hideSoon();return}this._domNode.toggleClassName("active",!1)}_startSliderDragging(e,t,o){if(!e.target||!(e.target instanceof Element))return;let n=e.pageX;this._slider.toggleClassName("active",!0);let r=(s,l)=>{let c=ur(this._domNode.domNode),u=Math.min(Math.abs(l-n),Math.abs(l-c.left),Math.abs(l-c.left-c.width));if(ii&&u>UGo){this._model.setScrollTop(o.scrollTop);return}let p=s-t;this._model.setScrollTop(o.getDesiredScrollTopFromDelta(p))};e.pageY!==t&&r(e.pageY,n),this._sliderPointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>r(s.pageY,s.pageX),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){let t=this._domNode.domNode.getBoundingClientRect().top,o=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(o)}dispose(){this._pointerDownListener.dispose(),this._sliderPointerMoveMonitor.dispose(),this._sliderPointerDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){let e=["minimap"];return this._model.options.showSlider==="always"?e.push("slider-always"):e.push("slider-mouseover"),this._model.options.autohide==="mouseover"?e.push("minimap-autohide-mouseover"):this._model.options.autohide==="scroll"&&e.push("minimap-autohide-scroll"),e.join(" ")}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new uai(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return this._lastRenderData?this._lastRenderData.onLinesChanged(e,t):!1}onLinesDeleted(e,t){return this._lastRenderData?.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData?.onLinesInserted(e,t),!0}onScrollChanged(e){return this._model.options.autohide==="scroll"&&(e.scrollTopChanged||e.scrollHeightChanged)&&(this._domNode.toggleClassName("active",!0),this._hideSoon()),this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(msi),this._renderDecorations=!0,!0}onTokensChanged(e){return this._lastRenderData?this._lastRenderData.onTokensChanged(e):!1}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(this._model.options.renderMinimap===0){this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),this._sliderHorizontal.setHeight(0);return}e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");let o=dai.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(o.sliderNeeded?"block":"none"),this._slider.setTop(o.sliderTop),this._slider.setHeight(o.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(o.sliderHeight),this.renderDecorations(o),this._lastRenderData=this.renderLines(o)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;let t=this._model.getSelections();t.sort(G.compareRangesUsingStarts);let o=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);o.sort((g,f)=>(g.options.zIndex||0)-(f.options.zIndex||0));let{canvasInnerWidth:n,canvasInnerHeight:r}=this._model.options,s=this._model.options.minimapLineHeight,l=this._model.options.minimapCharWidth,c=this._model.getOptions().tabSize,u=this._decorationsCanvas.domNode.getContext("2d");u.clearRect(0,0,n,r);let p=new Nwt(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(u,t,p,e,s),this._renderDecorationsLineHighlights(u,o,p,e,s);let h=new Nwt(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(u,t,h,e,s,c,l,n),this._renderDecorationsHighlights(u,o,h,e,s,c,l,n),this._renderSectionHeaders(e)}}_renderSelectionLineHighlights(e,t,o,n,r){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let s=0,l=0;for(let c of t){let u=n.intersectWithViewport(c);if(!u)continue;let[p,h]=u;for(let v=p;v<=h;v++)o.set(v,!0);let g=n.getYForLineNumber(p,r),f=n.getYForLineNumber(h,r);l>=g||(l>s&&e.fillRect(EB,s,e.canvas.width,l-s),s=g),l=f}l>s&&e.fillRect(EB,s,e.canvas.width,l-s)}_renderDecorationsLineHighlights(e,t,o,n,r){let s=new Map;for(let l=t.length-1;l>=0;l--){let c=t[l],u=c.options.minimap;if(!u||u.position!==1)continue;let p=n.intersectWithViewport(c.range);if(!p)continue;let[h,g]=p,f=u.getColor(this._theme.value);if(!f||f.isTransparent())continue;let v=s.get(f.toString());v||(v=f.transparent(.5).toString(),s.set(f.toString(),v)),e.fillStyle=v;for(let b=h;b<=g;b++){if(o.has(b))continue;o.set(b,!0);let S=n.getYForLineNumber(b,r);e.fillRect(EB,S,e.canvas.width,r)}}}_renderSelectionsHighlights(e,t,o,n,r,s,l,c){if(!(!this._selectionColor||this._selectionColor.isTransparent()))for(let u of t){let p=n.intersectWithViewport(u);if(!p)continue;let[h,g]=p;for(let f=h;f<=g;f++)this.renderDecorationOnLine(e,o,u,this._selectionColor,n,f,r,r,s,l,c)}}_renderDecorationsHighlights(e,t,o,n,r,s,l,c){for(let u of t){let p=u.options.minimap;if(!p)continue;let h=n.intersectWithViewport(u.range);if(!h)continue;let[g,f]=h,v=p.getColor(this._theme.value);if(!(!v||v.isTransparent()))for(let b=g;b<=f;b++)switch(p.position){case 1:this.renderDecorationOnLine(e,o,u.range,v,n,b,r,r,s,l,c);continue;case 2:{let S=n.getYForLineNumber(b,r);this.renderDecoration(e,v,2,S,zGo,r);continue}}}}renderDecorationOnLine(e,t,o,n,r,s,l,c,u,p,h){let g=r.getYForLineNumber(s,c);if(g+l<0||g>this._model.options.canvasInnerHeight)return;let{startLineNumber:f,endLineNumber:v}=o,b=f===s?o.startColumn:1,S=v===s?o.endColumn:this._model.getLineMaxColumn(s),y=this.getXOffsetForPosition(t,s,b,u,p,h),w=this.getXOffsetForPosition(t,s,S,u,p,h);this.renderDecoration(e,n,y,g,w-y,l)}getXOffsetForPosition(e,t,o,n,r,s){if(o===1)return EB;if((o-1)*r>=s)return s;let c=e.get(t);if(!c){let u=this._model.getLineContent(t);c=[EB];let p=EB;for(let h=1;h<u.length+1;h++){let g=u.charCodeAt(h-1),f=g===9?n*r:sD(g)?2*r:r,v=p+f;if(v>=s){c[h]=s;break}c[h]=v,p=v}e.set(t,c)}return o-1<c.length?c[o-1]:s}renderDecoration(e,t,o,n,r,s){e.fillStyle=t&&t.toString()||"",e.fillRect(o,n,r,s)}_renderSectionHeaders(e){let t=this._model.options.minimapLineHeight,o=this._model.options.sectionHeaderFontSize,n=this._model.options.sectionHeaderLetterSpacing,r=o*1.5,{canvasInnerWidth:s}=this._model.options,l=this._model.options.backgroundColor,c=`rgb(${l.r} ${l.g} ${l.b} / .7)`,u=this._model.options.sectionHeaderFontColor,p=`rgb(${u.r} ${u.g} ${u.b})`,h=p,g=this._decorationsCanvas.domNode.getContext("2d");g.letterSpacing=n+"px",g.font="500 "+o+"px "+this._model.options.sectionHeaderFontFamily,g.strokeStyle=h,g.lineWidth=.4;let f=this._model.getSectionHeaderDecorationsInViewport(e.startLineNumber,e.endLineNumber);f.sort((b,S)=>b.range.startLineNumber-S.range.startLineNumber);let v=a._fitSectionHeader.bind(null,g,s-EB);for(let b of f){let S=e.getYForLineNumber(b.range.startLineNumber,t)+o,y=S-o,w=y+2,x=this._model.getSectionHeaderText(b,v);a._renderSectionLabel(g,x,b.options.minimap?.sectionHeaderStyle===2,c,p,s,y,r,S,w)}}static _fitSectionHeader(e,t,o){if(!o)return o;let n="\u2026",r=e.measureText(o).width,s=e.measureText(n).width;if(r<=t||r<=s)return o;let l=o.length,c=r/o.length,u=Math.floor((t-s)/c)-1,p=Math.ceil(u/2);for(;p>0&&/\s/.test(o[p-1]);)--p;return o.substring(0,p)+n+o.substring(l-(u-p))}static _renderSectionLabel(e,t,o,n,r,s,l,c,u,p){t&&(e.fillStyle=n,e.fillRect(0,l,s,c),e.fillStyle=r,e.fillText(t,EB,u)),o&&(e.beginPath(),e.moveTo(0,p),e.lineTo(s,p),e.closePath(),e.stroke())}renderLines(e){let t=e.startLineNumber,o=e.endLineNumber,n=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){let Se=this._lastRenderData._get();return new Mwt(e,Se.imageData,Se.lines)}let r=this._getBuffer();if(!r)return null;let[s,l,c]=a._renderUntouchedLines(r,e.topPaddingLineCount,t,o,n,this._lastRenderData),u=this._model.getMinimapLinesRenderingData(t,o,c),p=this._model.getOptions().tabSize,h=this._model.options.defaultBackgroundColor,g=this._model.options.backgroundColor,f=this._model.options.foregroundAlpha,v=this._model.tokensColorTracker,b=v.backgroundIsLight(),S=this._model.options.renderMinimap,y=this._model.options.charRenderer(),w=this._model.options.fontScale,x=this._model.options.minimapCharWidth,M=(S===1?2:3)*w,N=n>M?Math.floor((n-M)/2):0,V=g.a/255,H=new FF(Math.round((g.r-h.r)*V+h.r),Math.round((g.g-h.g)*V+h.g),Math.round((g.b-h.b)*V+h.b),255),K=e.topPaddingLineCount*n,j=[];for(let Se=0,Re=o-t+1;Se<Re;Se++)c[Se]&&a._renderLine(r,H,g.a,b,S,x,v,f,y,K,N,p,u[Se],w,n),j[Se]=new Lwt(K),K+=n;let J=s===-1?0:s,ae=(l===-1?r.height:l)-J;return this._canvas.domNode.getContext("2d").putImageData(r,0,0,0,J,r.width,ae),new Mwt(e,r,j)}static _renderUntouchedLines(e,t,o,n,r,s){let l=[];if(!s){for(let K=0,j=n-o+1;K<j;K++)l[K]=!0;return[-1,-1,l]}let c=s._get(),u=c.imageData.data,p=c.rendLineNumberStart,h=c.lines,g=h.length,f=e.width,v=e.data,b=(n-o+1)*r*f*4,S=-1,y=-1,w=-1,x=-1,E=-1,M=-1,N=t*r;for(let K=o;K<=n;K++){let j=K-o,J=K-p,se=J>=0&&J<g?h[J].dy:-1;if(se===-1){l[j]=!0,N+=r;continue}let ae=se*f*4,ce=(se+r)*f*4,Se=N*f*4,Re=(N+r)*f*4;x===ae&&M===Se?(x=ce,M=Re):(w!==-1&&(v.set(u.subarray(w,x),E),S===-1&&w===0&&w===E&&(S=x),y===-1&&x===b&&w===E&&(y=w)),w=ae,x=ce,E=Se,M=Re),l[j]=!1,N+=r}w!==-1&&(v.set(u.subarray(w,x),E),S===-1&&w===0&&w===E&&(S=x),y===-1&&x===b&&w===E&&(y=w));let V=S===-1?-1:S/(f*4),H=y===-1?-1:y/(f*4);return[V,H,l]}static _renderLine(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=f.content,y=f.tokens,w=e.width-s,x=b===1,E=EB,M=0,N=0;for(let V=0,H=y.getCount();V<H;V++){let K=y.getEndOffset(V),j=y.getForeground(V),J=l.getColor(j);for(;M<K;M++){if(E>w)return;let se=S.charCodeAt(M);if(se===9){let ae=g-(M+N)%g;N+=ae-1,E+=ae*s}else if(se===32)E+=s;else{let ae=sD(se)?2:1;for(let ce=0;ce<ae;ce++)if(r===2?u.blockRenderChar(e,E,p+h,J,c,t,o,x):u.renderChar(e,E,p+h,se,J,c,t,o,v,n,x),E+=s,E>w)return}}}}},Nwt=class{constructor(i,e,t){this._startLineNumber=i,this._endLineNumber=e,this._defaultValue=t,this._values=[];for(let o=0,n=this._endLineNumber-this._startLineNumber+1;o<n;o++)this._values[o]=t}has(i){return this.get(i)!==this._defaultValue}set(i,e){i<this._startLineNumber||i>this._endLineNumber||(this._values[i-this._startLineNumber]=e)}get(i){return i<this._startLineNumber||i>this._endLineNumber?this._defaultValue:this._values[i-this._startLineNumber]}};var Owt=class extends np{constructor(i,e){super(i),this._viewDomNode=e;let o=this._context.configuration.options.get(165);this._widgets={},this._verticalScrollbarWidth=o.verticalScrollbarWidth,this._minimapWidth=o.minimap.minimapWidth,this._horizontalScrollbarHeight=o.horizontalScrollbarHeight,this._editorHeight=o.height,this._editorWidth=o.width,this._viewDomNodeRect={top:0,left:0,width:0,height:0},this._domNode=Ir(document.createElement("div")),MI.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=Ir(document.createElement("div")),MI.write(this.overflowingOverlayWidgetsDomNode,5),this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(i){let t=this._context.configuration.options.get(165);return this._verticalScrollbarWidth=t.verticalScrollbarWidth,this._minimapWidth=t.minimap.minimapWidth,this._horizontalScrollbarHeight=t.horizontalScrollbarHeight,this._editorHeight=t.height,this._editorWidth=t.width,!0}_widgetCanOverflow(i){let t=this._context.configuration.options.get(4);return(i.allowEditorOverflow||!1)&&t}addWidget(i){let e=Ir(i.getDomNode());this._widgets[i.getId()]={widget:i,preference:null,domNode:e},e.setPosition("absolute"),e.setAttribute("widgetId",i.getId()),this._widgetCanOverflow(i)?this.overflowingOverlayWidgetsDomNode.appendChild(e):this._domNode.appendChild(e),this.setShouldRender(),this._updateMaxMinWidth()}setWidgetPosition(i,e){let t=this._widgets[i.getId()],o=e?e.preference:null,n=e?.stackOrdinal;return t.preference===o&&t.stack===n?(this._updateMaxMinWidth(),!1):(t.preference=o,t.stack=n,this.setShouldRender(),this._updateMaxMinWidth(),!0)}removeWidget(i){let e=i.getId();if(this._widgets.hasOwnProperty(e)){let o=this._widgets[e].domNode.domNode;delete this._widgets[e],o.remove(),this.setShouldRender(),this._updateMaxMinWidth()}}_updateMaxMinWidth(){let i=0,e=Object.keys(this._widgets);for(let t=0,o=e.length;t<o;t++){let n=e[t],s=this._widgets[n].widget.getMinContentWidthInPx?.();typeof s<"u"&&(i=Math.max(i,s))}this._context.viewLayout.setOverlayWidgetsMinWidth(i)}_renderWidget(i,e){let t=i.domNode;if(i.preference===null){t.setTop("");return}let o=2*this._verticalScrollbarWidth+this._minimapWidth;if(i.preference===0||i.preference===1){if(i.preference===1){let n=t.domNode.clientHeight;t.setTop(this._editorHeight-n-2*this._horizontalScrollbarHeight)}else t.setTop(0);i.stack!==void 0?(t.setTop(e[i.preference]),e[i.preference]+=t.domNode.clientWidth):t.setRight(o)}else if(i.preference===2)t.domNode.style.right="50%",i.stack!==void 0?(t.setTop(e[2]),e[2]+=t.domNode.clientHeight):t.setTop(0);else{let{top:n,left:r}=i.preference;if(this._context.configuration.options.get(51)&&this._widgetCanOverflow(i.widget)){let l=this._viewDomNodeRect;t.setTop(n+l.top),t.setLeft(r+l.left),t.setPosition("fixed")}else t.setTop(n),t.setLeft(r),t.setPosition("absolute")}}prepareRender(i){this._viewDomNodeRect=ur(this._viewDomNode.domNode)}render(i){this._domNode.setWidth(this._editorWidth);let e=Object.keys(this._widgets),t=Array.from({length:3},()=>0);e.sort((o,n)=>(this._widgets[o].stack||0)-(this._widgets[n].stack||0));for(let o=0,n=e.length;o<n;o++){let r=e[o];this._renderWidget(this._widgets[r],t)}}};var Z3e=class{constructor(i,e,t,o){this._viewportBrand=void 0;this.top=i|0,this.left=e|0,this.width=t|0,this.height=o|0}},Fwt=class{constructor(i,e){this.tabSize=i,this.data=e}},sde=class{constructor(i,e,t,o,n,r,s){this._viewLineDataBrand=void 0;this.content=i,this.continuesWithWrappedLine=e,this.minColumn=t,this.maxColumn=o,this.startVisibleColumn=n,this.tokens=r,this.inlineDecorations=s}},dK=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.minColumn=i,this.maxColumn=e,this.content=t,this.continuesWithWrappedLine=o,this.isBasicASCII=a.isBasicASCII(t,r),this.containsRTL=a.containsRTL(t,this.isBasicASCII,n),this.tokens=s,this.inlineDecorations=l,this.tabSize=c,this.startVisibleColumn=u,this.textDirection=p,this.hasVariableFonts=h}static isBasicASCII(i,e){return e?xz(i):!0}static containsRTL(i,e,t){return!e&&t?mA(i):!1}};var ade=class a{constructor(i,e,t){this.color=i;this.zIndex=e;this.data=t}static compareByRenderingProps(i,e){return i.zIndex===e.zIndex?i.color<e.color?-1:i.color>e.color?1:0:i.zIndex-e.zIndex}static equals(i,e){return i.color===e.color&&i.zIndex===e.zIndex&&eo(i.data,e.data)}static equalsArr(i,e){return eo(i,e,a.equals)}};var mai=class{constructor(i,e){let t=i.options;this.lineHeight=t.get(75),this.pixelRatio=t.get(163),this.overviewRulerLanes=t.get(95),this.renderBorder=t.get(94);let o=e.getColor(dwt);this.borderColor=o?o.toString():null,this.hideCursor=t.get(68);let n=e.getColor(bX);this.cursorColorSingle=n?n.transparent(.7).toString():null;let r=e.getColor(swt);this.cursorColorPrimary=r?r.transparent(.7).toString():null;let s=e.getColor(awt);this.cursorColorSecondary=s?s.transparent(.7).toString():null,this.themeType=e.type;let l=t.get(81),c=l.enabled,u=l.side,p=e.getColor(XYi),h=vc.getDefaultBackground();p?this.backgroundColor=p:c&&u==="right"?this.backgroundColor=h:this.backgroundColor=null;let f=t.get(165).overviewRuler;this.top=f.top,this.right=f.right,this.domWidth=f.width,this.domHeight=f.height,this.overviewRulerLanes===0?(this.canvasWidth=0,this.canvasHeight=0):(this.canvasWidth=this.domWidth*this.pixelRatio|0,this.canvasHeight=this.domHeight*this.pixelRatio|0);let[v,b]=this._initLanes(1,this.canvasWidth,this.overviewRulerLanes);this.x=v,this.w=b}_initLanes(i,e,t){let o=e-i;if(t>=3){let n=Math.floor(o/3),r=Math.floor(o/3),s=o-n-r,l=i,c=l+n,u=l+n+s;return[[0,l,c,l,u,l,c,l],[0,n,s,n+s,r,n+s+r,s+r,n+s+r]]}else if(t===2){let n=Math.floor(o/2),r=o-n,s=i,l=s+n;return[[0,s,s,s,l,s,s,s],[0,n,n,n,r,n+r,n+r,n+r]]}else{let n=i,r=o;return[[0,n,n,n,n,n,n,n],[0,r,r,r,r,r,r,r]]}}equals(i){return this.lineHeight===i.lineHeight&&this.pixelRatio===i.pixelRatio&&this.overviewRulerLanes===i.overviewRulerLanes&&this.renderBorder===i.renderBorder&&this.borderColor===i.borderColor&&this.hideCursor===i.hideCursor&&this.cursorColorSingle===i.cursorColorSingle&&this.cursorColorPrimary===i.cursorColorPrimary&&this.cursorColorSecondary===i.cursorColorSecondary&&this.themeType===i.themeType&&Ue.equals(this.backgroundColor,i.backgroundColor)&&this.top===i.top&&this.right===i.right&&this.domWidth===i.domWidth&&this.domHeight===i.domHeight&&this.canvasWidth===i.canvasWidth&&this.canvasHeight===i.canvasHeight}};var Wwt=class extends np{constructor(e){super(e);this._actualShouldRender=0;this._renderedDecorations=[];this._renderedCursorPositions=[];this._domNode=Ir(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=vc.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new ye(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){let t=new mai(this._context.configuration,this._context.theme);return this._settings&&this._settings.equals(t)?!1:(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}_markRenderingIsNeeded(){return this._actualShouldRender=2,!0}_markRenderingIsMaybeNeeded(){return this._actualShouldRender=1,!0}onConfigurationChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,o=e.selections.length;t<o;t++){let n=this._settings.cursorColorSingle;o>1&&(n=t===0?this._settings.cursorColorPrimary:this._settings.cursorColorSecondary),this._cursorPositions.push({position:e.selections[t].getPosition(),color:n})}return this._cursorPositions.sort((t,o)=>ye.compare(t.position,o.position)),this._markRenderingIsMaybeNeeded()}onDecorationsChanged(e){return e.affectsOverviewRuler?this._markRenderingIsMaybeNeeded():!1}onFlushed(e){return this._markRenderingIsNeeded()}onScrollChanged(e){return e.scrollHeightChanged?this._markRenderingIsNeeded():!1}onZonesChanged(e){return this._markRenderingIsNeeded()}onThemeChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render(),this._actualShouldRender=0}_render(){let e=this._settings.backgroundColor;if(this._settings.overviewRulerLanes===0){this._domNode.setBackgroundColor(e?Ue.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}let t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(ade.compareByRenderingProps),this._actualShouldRender===1&&!ade.equalsArr(this._renderedDecorations,t)&&(this._actualShouldRender=2),this._actualShouldRender===1&&!eo(this._renderedCursorPositions,this._cursorPositions,(v,b)=>v.position.lineNumber===b.position.lineNumber&&v.color===b.color)&&(this._actualShouldRender=2),this._actualShouldRender===1)return;this._renderedDecorations=t,this._renderedCursorPositions=this._cursorPositions,this._domNode.setDisplay("block");let o=this._settings.canvasWidth,n=this._settings.canvasHeight,r=this._settings.lineHeight,s=this._context.viewLayout,l=this._context.viewLayout.getScrollHeight(),c=n/l,u=6*this._settings.pixelRatio|0,p=u/2|0,h=this._domNode.domNode.getContext("2d");e?e.isOpaque()?(h.fillStyle=Ue.Format.CSS.formatHexA(e),h.fillRect(0,0,o,n)):(h.clearRect(0,0,o,n),h.fillStyle=Ue.Format.CSS.formatHexA(e),h.fillRect(0,0,o,n)):h.clearRect(0,0,o,n);let g=this._settings.x,f=this._settings.w;for(let v of t){let b=v.color,S=v.data;h.fillStyle=b;let y=0,w=0,x=0;for(let E=0,M=S.length/3;E<M;E++){let N=S[3*E],V=S[3*E+1],H=S[3*E+2],K=s.getVerticalOffsetForLineNumber(V)*c|0,j=(s.getVerticalOffsetForLineNumber(H)+r)*c|0;if(j-K<u){let se=(K+j)/2|0;se<p?se=p:se+p>n&&(se=n-p),K=se-p,j=se+p}K>x+1||N!==y?(E!==0&&h.fillRect(g[y],w,f[y],x-w),y=N,w=K,x=j):j>x&&(x=j)}h.fillRect(g[y],w,f[y],x-w)}if(!this._settings.hideCursor){let v=2*this._settings.pixelRatio|0,b=v/2|0,S=this._settings.x[7],y=this._settings.w[7],w=-100,x=-100,E=null;for(let M=0,N=this._cursorPositions.length;M<N;M++){let V=this._cursorPositions[M].color;if(!V)continue;let H=this._cursorPositions[M].position,K=s.getVerticalOffsetForLineNumber(H.lineNumber)*c|0;K<b?K=b:K+b>n&&(K=n-b);let j=K-b,J=j+v;j>x+1||V!==E?(M!==0&&E&&h.fillRect(S,w,y,x-w),w=j,x=J):J>x&&(x=J),E=V,h.fillStyle=V}E&&h.fillRect(S,w,y,x-w)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(h.beginPath(),h.lineWidth=1,h.strokeStyle=this._settings.borderColor,h.moveTo(0,0),h.lineTo(0,n),h.moveTo(1,0),h.lineTo(o,0),h.stroke())}};var Vwt=class{constructor(i,e,t){this._colorZoneBrand=void 0;this.from=i|0,this.to=e|0,this.colorId=t|0}static compare(i,e){return i.colorId===e.colorId?i.from===e.from?i.to-e.to:i.from-e.from:i.colorId-e.colorId}},e8e=class{constructor(i,e,t,o){this._overviewRulerZoneBrand=void 0;this.startLineNumber=i,this.endLineNumber=e,this.heightInLines=t,this.color=o,this._colorZone=null}static compare(i,e){return i.color===e.color?i.startLineNumber===e.startLineNumber?i.heightInLines===e.heightInLines?i.endLineNumber-e.endLineNumber:i.heightInLines-e.heightInLines:i.startLineNumber-e.startLineNumber:i.color<e.color?-1:1}setColorZone(i){this._colorZone=i}getColorZones(){return this._colorZone}},Bwt=class{constructor(i){this._getVerticalOffsetForLine=i,this._zones=[],this._colorZonesInvalid=!1,this._lineHeight=0,this._domWidth=0,this._domHeight=0,this._outerHeight=0,this._pixelRatio=1,this._lastAssignedId=0,this._color2Id=Object.create(null),this._id2Color=[]}getId2Color(){return this._id2Color}setZones(i){this._zones=i,this._zones.sort(e8e.compare)}setLineHeight(i){return this._lineHeight===i?!1:(this._lineHeight=i,this._colorZonesInvalid=!0,!0)}setPixelRatio(i){this._pixelRatio=i,this._colorZonesInvalid=!0}getDOMWidth(){return this._domWidth}getCanvasWidth(){return this._domWidth*this._pixelRatio}setDOMWidth(i){return this._domWidth===i?!1:(this._domWidth=i,this._colorZonesInvalid=!0,!0)}getDOMHeight(){return this._domHeight}getCanvasHeight(){return this._domHeight*this._pixelRatio}setDOMHeight(i){return this._domHeight===i?!1:(this._domHeight=i,this._colorZonesInvalid=!0,!0)}getOuterHeight(){return this._outerHeight}setOuterHeight(i){return this._outerHeight===i?!1:(this._outerHeight=i,this._colorZonesInvalid=!0,!0)}resolveColorZones(){let i=this._colorZonesInvalid,e=Math.floor(this._lineHeight),t=Math.floor(this.getCanvasHeight()),o=Math.floor(this._outerHeight),n=t/o,r=Math.floor(4*this._pixelRatio/2),s=[];for(let l=0,c=this._zones.length;l<c;l++){let u=this._zones[l];if(!i){let x=u.getColorZones();if(x){s.push(x);continue}}let p=this._getVerticalOffsetForLine(u.startLineNumber),h=u.heightInLines===0?this._getVerticalOffsetForLine(u.endLineNumber)+e:p+u.heightInLines*e,g=Math.floor(n*p),f=Math.floor(n*h),v=Math.floor((g+f)/2),b=f-v;b<r&&(b=r),v-b<0&&(v=b),v+b>t&&(v=t-b);let S=u.color,y=this._color2Id[S];y||(y=++this._lastAssignedId,this._color2Id[S]=y,this._id2Color[y]=S);let w=new Vwt(v-b,v+b,y);u.setColorZone(w),s.push(w)}return this._colorZonesInvalid=!1,s.sort(Vwt.compare),s}};var Hwt=class extends yT{constructor(i,e){super(),this._context=i;let t=this._context.configuration.options;this._domNode=Ir(document.createElement("canvas")),this._domNode.setClassName(e),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new Bwt(o=>this._context.viewLayout.getVerticalOffsetForLineNumber(o)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(t.get(75)),this._zoneManager.setPixelRatio(t.get(163)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(i){let e=this._context.configuration.options;return i.hasChanged(75)&&(this._zoneManager.setLineHeight(e.get(75)),this._render()),i.hasChanged(163)&&(this._zoneManager.setPixelRatio(e.get(163)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(i){return this._render(),!0}onScrollChanged(i){return i.scrollHeightChanged&&(this._zoneManager.setOuterHeight(i.scrollHeight),this._render()),!0}onZonesChanged(i){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(i){this._domNode.setTop(i.top),this._domNode.setRight(i.right);let e=!1;e=this._zoneManager.setDOMWidth(i.width)||e,e=this._zoneManager.setDOMHeight(i.height)||e,e&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(i){this._zoneManager.setZones(i),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;let i=this._zoneManager.getCanvasWidth(),e=this._zoneManager.getCanvasHeight(),t=this._zoneManager.resolveColorZones(),o=this._zoneManager.getId2Color(),n=this._domNode.domNode.getContext("2d");return n.clearRect(0,0,i,e),t.length>0&&this._renderOneLane(n,t,o,i),!0}_renderOneLane(i,e,t,o){let n=0,r=0,s=0;for(let l of e){let c=l.colorId,u=l.from,p=l.to;c!==n?(n!==0&&i.fillRect(0,r,o,s-r),n=c,i.fillStyle=t[n],r=u,s=p):s>=u?s=Math.max(s,p):(i.fillRect(0,r,o,s-r),r=u,s=p)}i.fillRect(0,r,o,s-r)}};var Uwt=class extends np{constructor(i){super(i),this.domNode=Ir(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];let e=this._context.configuration.options;this._rulers=e.get(116),this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth}onConfigurationChanged(i){let e=this._context.configuration.options;return this._rulers=e.get(116),this._typicalHalfwidthCharacterWidth=e.get(59).typicalHalfwidthCharacterWidth,!0}onScrollChanged(i){return i.scrollHeightChanged}prepareRender(i){}_ensureRulersCount(){let i=this._renderedRulers.length,e=this._rulers.length;if(i===e)return;if(i<e){let o=e-i;for(;o>0;){let n=Ir(document.createElement("div"));n.setClassName("view-ruler"),n.setWidth("1ch"),this.domNode.appendChild(n),this._renderedRulers.push(n),o--}return}let t=i-e;for(;t>0;){let o=this._renderedRulers.pop();this.domNode.removeChild(o),t--}}render(i){this._ensureRulersCount();for(let e=0,t=this._rulers.length;e<t;e++){let o=this._renderedRulers[e],n=this._rulers[e];o.setBoxShadow(n.color?`1px 0 0 0 ${n.color} inset`:""),o.setHeight(Math.min(i.scrollHeight,1e6)),o.setLeft(n.column*this._typicalHalfwidthCharacterWidth)}}};var zwt=class extends np{constructor(i){super(i),this._scrollTop=0,this._width=0,this._updateWidth(),this._shouldShow=!1;let t=this._context.configuration.options.get(117);this._useShadows=t.useShadows,this._domNode=Ir(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true")}_updateShouldShow(){let i=this._useShadows&&this._scrollTop>0;return this._shouldShow!==i?(this._shouldShow=i,!0):!1}getDomNode(){return this._domNode}_updateWidth(){let e=this._context.configuration.options.get(165);e.minimap.renderMinimap===0||e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?this._width=e.width:this._width=e.width-e.verticalScrollbarWidth}onConfigurationChanged(i){let t=this._context.configuration.options.get(117);return this._useShadows=t.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(i){return this._scrollTop=i.scrollTop,this._updateShouldShow()}prepareRender(i){}render(i){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}};var hai=class{constructor(i){this.left=i.left,this.width=i.width,this.startStyle=null,this.endStyle=null}},gai=class{constructor(i,e){this.lineNumber=i,this.ranges=e}};function KGo(a){return new hai(a)}function GGo(a){return new gai(a.lineNumber,a.ranges.map(KGo))}var Gwt=class a extends vx{constructor(e){super();this._previousFrameVisibleRangesWithStyle=[];this._context=e;let t=this._context.configuration.options;this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}static{this.SELECTION_CLASS_NAME="selected-text"}static{this.SELECTION_TOP_LEFT="top-left-radius"}static{this.SELECTION_BOTTOM_LEFT="bottom-left-radius"}static{this.SELECTION_TOP_RIGHT="top-right-radius"}static{this.SELECTION_BOTTOM_RIGHT="bottom-right-radius"}static{this.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background"}static{this.ROUNDED_PIECE_WIDTH=10}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){let t=this._context.configuration.options;return this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,o=e.length;t<o;t++)if(e[t].ranges.length>1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,o){let n=this._typicalHalfwidthCharacterWidth/4,r=null,s=null;if(o&&o.length>0&&t.length>0){let l=t[0].lineNumber;if(l===e.startLineNumber)for(let u=0;!r&&u<o.length;u++)o[u].lineNumber===l&&(r=o[u].ranges[0]);let c=t[t.length-1].lineNumber;if(c===e.endLineNumber)for(let u=o.length-1;!s&&u>=0;u--)o[u].lineNumber===c&&(s=o[u].ranges[0]);r&&!r.startStyle&&(r=null),s&&!s.startStyle&&(s=null)}for(let l=0,c=t.length;l<c;l++){let u=t[l].ranges[0],p=u.left,h=u.left+u.width,g={top:0,bottom:0},f={top:0,bottom:0};if(l>0){let v=t[l-1].ranges[0].left,b=t[l-1].ranges[0].left+t[l-1].ranges[0].width;Kwt(p-v)<n?g.top=2:p>v&&(g.top=1),Kwt(h-b)<n?f.top=2:v<h&&h<b&&(f.top=1)}else r&&(g.top=r.startStyle.top,f.top=r.endStyle.top);if(l+1<c){let v=t[l+1].ranges[0].left,b=t[l+1].ranges[0].left+t[l+1].ranges[0].width;Kwt(p-v)<n?g.bottom=2:v<p&&p<b&&(g.bottom=1),Kwt(h-b)<n?f.bottom=2:h<b&&(f.bottom=1)}else s&&(g.bottom=s.startStyle.bottom,f.bottom=s.endStyle.bottom);u.startStyle=g,u.endStyle=f}}_getVisibleRangesWithStyle(e,t,o){let r=(t.linesVisibleRangesForRange(e,!0)||[]).map(GGo);return!this._visibleRangesHaveGaps(r)&&this._roundedSelection&&this._enrichVisibleRangesWithStyle(t.visibleRange,r,o),r}_createSelectionPiece(e,t,o,n,r){return'<div class="cslr '+o+'" style="top:'+e.toString()+"px;bottom:"+t.toString()+"px;left:"+n.toString()+"px;width:"+r.toString()+'px;"></div>'}_actualRenderOneSelection(e,t,o,n){if(n.length===0)return;let r=!!n[0].ranges[0].startStyle,s=n[0].lineNumber,l=n[n.length-1].lineNumber;for(let c=0,u=n.length;c<u;c++){let p=n[c],h=p.lineNumber,g=h-t,f=o&&h===s?1:0,v=o&&h!==s&&h===l?1:0,b="",S="";for(let y=0,w=p.ranges.length;y<w;y++){let x=p.ranges[y];if(r){let M=x.startStyle,N=x.endStyle;if(M.top===1||M.bottom===1){b+=this._createSelectionPiece(f,v,a.SELECTION_CLASS_NAME,x.left-a.ROUNDED_PIECE_WIDTH,a.ROUNDED_PIECE_WIDTH);let V=a.EDITOR_BACKGROUND_CLASS_NAME;M.top===1&&(V+=" "+a.SELECTION_TOP_RIGHT),M.bottom===1&&(V+=" "+a.SELECTION_BOTTOM_RIGHT),b+=this._createSelectionPiece(f,v,V,x.left-a.ROUNDED_PIECE_WIDTH,a.ROUNDED_PIECE_WIDTH)}if(N.top===1||N.bottom===1){b+=this._createSelectionPiece(f,v,a.SELECTION_CLASS_NAME,x.left+x.width,a.ROUNDED_PIECE_WIDTH);let V=a.EDITOR_BACKGROUND_CLASS_NAME;N.top===1&&(V+=" "+a.SELECTION_TOP_LEFT),N.bottom===1&&(V+=" "+a.SELECTION_BOTTOM_LEFT),b+=this._createSelectionPiece(f,v,V,x.left+x.width,a.ROUNDED_PIECE_WIDTH)}}let E=a.SELECTION_CLASS_NAME;if(r){let M=x.startStyle,N=x.endStyle;M.top===0&&(E+=" "+a.SELECTION_TOP_LEFT),M.bottom===0&&(E+=" "+a.SELECTION_BOTTOM_LEFT),N.top===0&&(E+=" "+a.SELECTION_TOP_RIGHT),N.bottom===0&&(E+=" "+a.SELECTION_BOTTOM_RIGHT)}S+=this._createSelectionPiece(f,v,E,x.left,x.width)}e[g][0]+=b,e[g][1]+=S}}prepareRender(e){let t=[],o=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let s=o;s<=n;s++){let l=s-o;t[l]=["",""]}let r=[];for(let s=0,l=this._selections.length;s<l;s++){let c=this._selections[s];if(c.isEmpty()){r[s]=null;continue}let u=this._getVisibleRangesWithStyle(c,e,this._previousFrameVisibleRangesWithStyle[s]);r[s]=u,this._actualRenderOneSelection(t,o,this._selections.length>1,u)}this._previousFrameVisibleRangesWithStyle=r,this._renderResult=t.map(([s,l])=>s+l)}render(e,t){if(!this._renderResult)return"";let o=t-e;return o<0||o>=this._renderResult.length?"":this._renderResult[o]}};hs((a,i)=>{let e=a.getColor(G9i);e&&!e.isTransparent()&&i.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${e}; }`)});function Kwt(a){return a<0?-a:a}var qwt=class{constructor(i,e,t,o,n,r,s){this.top=i;this.left=e;this.paddingLeft=t;this.width=o;this.height=n;this.textContent=r;this.textContentClassName=s}};var t8e=class{constructor(i,e){this._context=i;let t=this._context.configuration.options,o=t.get(59);this._cursorStyle=t.get(161),this._typicalHalfwidthCharacterWidth=o.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=t.get(38),this._isVisible=!0,this._domNode=Ir(document.createElement("div")),this._domNode.setClassName(`cursor ${xT}`),this._domNode.setHeight(this._context.viewLayout.getLineHeightForLineNumber(1)),this._domNode.setTop(0),this._domNode.setLeft(0),ku(this._domNode,o),this._domNode.setDisplay("none"),this._position=new ye(1,1),this._pluralityClass="",this.setPlurality(e),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}setPlurality(i){switch(i){default:case 0:this._pluralityClass="";break;case 1:this._pluralityClass="cursor-primary";break;case 2:this._pluralityClass="cursor-secondary";break}}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(59);return this._cursorStyle=e.get(161),this._typicalHalfwidthCharacterWidth=t.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(e.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=e.get(38),ku(this._domNode,t),!0}onCursorPositionChanged(i,e){return e?this._domNode.domNode.style.transitionProperty="none":this._domNode.domNode.style.transitionProperty="",this._position=i,!0}_getGraphemeAwarePosition(){let{lineNumber:i,column:e}=this._position,t=this._context.viewModel.getLineContent(i),[o,n]=ebt(t,e-1);return[new ye(i,o+1),t.substring(o,n)]}_prepareRender(i){let e="",t="",[o,n]=this._getGraphemeAwarePosition(),r=this._context.viewLayout.getLineHeightForLineNumber(o.lineNumber),s=this._lineCursorHeight===0?r:Math.min(r,this._lineCursorHeight),l=(r-s)/2;if(this._cursorStyle===1||this._cursorStyle===4){let v=i.visibleRangeForPosition(o);if(!v||v.outsideRenderedLine)return null;let b=Me(this._domNode.domNode),S;this._cursorStyle===1?(S=Owe(b,this._lineCursorWidth>0?this._lineCursorWidth:2),S>2&&(e=n,t=this._getTokenClassName(o))):S=Owe(b,1);let y=v.left,w=0;S>=2&&y>=1&&(w=1,y-=w);let x=i.getVerticalOffsetForLineNumber(o.lineNumber)-i.bigNumbersDelta+l;return new qwt(x,y,w,S,s,e,t)}let c=i.linesVisibleRangesForRange(new G(o.lineNumber,o.column,o.lineNumber,o.column+n.length),!1);if(!c||c.length===0)return null;let u=c[0];if(u.outsideRenderedLine||u.ranges.length===0)return null;let p=u.ranges[0],h=n==="	"?this._typicalHalfwidthCharacterWidth:p.width<1?this._typicalHalfwidthCharacterWidth:p.width;this._cursorStyle===2&&(e=n,t=this._getTokenClassName(o));let g=i.getVerticalOffsetForLineNumber(o.lineNumber)-i.bigNumbersDelta,f=r;return(this._cursorStyle===3||this._cursorStyle===6)&&(g+=r-2,f=2),new qwt(g,p.left,0,h,f,e,t)}_getTokenClassName(i){let e=this._context.viewModel.getViewLineData(i.lineNumber),t=e.tokens.findTokenIndexAtOffset(i.column-1);return e.tokens.getClassName(t)}prepareRender(i){this._renderData=this._prepareRender(i)}render(i){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor ${this._pluralityClass} ${xT} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setPaddingLeft(this._renderData.paddingLeft),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}};var $wt=class a extends np{static{this.BLINK_INTERVAL=500}constructor(i){super(i);let e=this._context.configuration.options;this._readOnly=e.get(104),this._cursorBlinking=e.get(32),this._cursorStyle=e.get(161),this._cursorSmoothCaretAnimation=e.get(33),this._editContextEnabled=e.get(170),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new t8e(this._context,0),this._secondaryCursors=[],this._renderData=[],this._domNode=Ir(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new Nl,this._cursorFlatBlinkInterval=new LL,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(i){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(i){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(i){let e=this._context.configuration.options;this._readOnly=e.get(104),this._cursorBlinking=e.get(32),this._cursorStyle=e.get(161),this._cursorSmoothCaretAnimation=e.get(33),this._editContextEnabled=e.get(170),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(i);for(let t=0,o=this._secondaryCursors.length;t<o;t++)this._secondaryCursors[t].onConfigurationChanged(i);return!0}_onCursorPositionChanged(i,e,t){let o=this._secondaryCursors.length!==e.length||this._cursorSmoothCaretAnimation==="explicit"&&t!==3;if(this._primaryCursor.setPlurality(e.length?1:0),this._primaryCursor.onCursorPositionChanged(i,o),this._updateBlinking(),this._secondaryCursors.length<e.length){let n=e.length-this._secondaryCursors.length;for(let r=0;r<n;r++){let s=new t8e(this._context,2);this._domNode.domNode.insertBefore(s.getDomNode().domNode,this._primaryCursor.getDomNode().domNode.nextSibling),this._secondaryCursors.push(s)}}else if(this._secondaryCursors.length>e.length){let n=this._secondaryCursors.length-e.length;for(let r=0;r<n;r++)this._domNode.removeChild(this._secondaryCursors[0].getDomNode()),this._secondaryCursors.splice(0,1)}for(let n=0;n<e.length;n++)this._secondaryCursors[n].onCursorPositionChanged(e[n],o)}onCursorStateChanged(i){let e=[];for(let o=0,n=i.selections.length;o<n;o++)e[o]=i.selections[o].getPosition();this._onCursorPositionChanged(e[0],e.slice(1),i.reason);let t=i.selections[0].isEmpty();return this._selectionIsEmpty!==t&&(this._selectionIsEmpty=t,this._updateDomClassName()),!0}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onFocusChanged(i){return this._editorHasFocus=i.isFocused,this._updateBlinking(),!1}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return!0}onTokensChanged(i){let e=t=>{for(let o=0,n=i.ranges.length;o<n;o++)if(i.ranges[o].fromLineNumber<=t.lineNumber&&t.lineNumber<=i.ranges[o].toLineNumber)return!0;return!1};if(e(this._primaryCursor.getPosition()))return!0;for(let t of this._secondaryCursors)if(e(t.getPosition()))return!0;return!1}onZonesChanged(i){return!0}_getCursorBlinking(){return this._isComposingInput&&!this._editContextEnabled?0:this._editorHasFocus?this._readOnly?5:this._cursorBlinking:0}_updateBlinking(){this._startCursorBlinkAnimation.cancel(),this._cursorFlatBlinkInterval.cancel();let i=this._getCursorBlinking(),e=i===0,t=i===5;e?this._hide():this._show(),this._blinkingEnabled=!1,this._updateDomClassName(),!e&&!t&&(i===1?this._cursorFlatBlinkInterval.cancelAndSet(()=>{this._isVisible?this._hide():this._show()},a.BLINK_INTERVAL,Me(this._domNode.domNode)):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},a.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let i="cursors-layer";switch(this._selectionIsEmpty||(i+=" has-selection"),this._cursorStyle){case 1:i+=" cursor-line-style";break;case 2:i+=" cursor-block-style";break;case 3:i+=" cursor-underline-style";break;case 4:i+=" cursor-line-thin-style";break;case 5:i+=" cursor-block-outline-style";break;case 6:i+=" cursor-underline-thin-style";break;default:i+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:i+=" cursor-blink";break;case 2:i+=" cursor-smooth";break;case 3:i+=" cursor-phase";break;case 4:i+=" cursor-expand";break;case 5:i+=" cursor-solid";break;default:i+=" cursor-solid"}else i+=" cursor-solid";return(this._cursorSmoothCaretAnimation==="on"||this._cursorSmoothCaretAnimation==="explicit")&&(i+=" cursor-smooth-caret-animation"),i}_show(){this._primaryCursor.show();for(let i=0,e=this._secondaryCursors.length;i<e;i++)this._secondaryCursors[i].show();this._isVisible=!0}_hide(){this._primaryCursor.hide();for(let i=0,e=this._secondaryCursors.length;i<e;i++)this._secondaryCursors[i].hide();this._isVisible=!1}prepareRender(i){this._primaryCursor.prepareRender(i);for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].prepareRender(i)}render(i){let e=[],t=0,o=this._primaryCursor.render(i);o&&(e[t++]=o);for(let n=0,r=this._secondaryCursors.length;n<r;n++){let s=this._secondaryCursors[n].render(i);s&&(e[t++]=s)}this._renderData=e}getLastRenderData(){return this._renderData}};hs((a,i)=>{let e=[{class:".cursor",foreground:bX,background:rwt},{class:".cursor-primary",foreground:swt,background:NYi},{class:".cursor-secondary",foreground:awt,background:OYi}];for(let t of e){let o=a.getColor(t.foreground);if(o){let n=a.getColor(t.background);n||(n=o.opposite()),i.addRule(`.monaco-editor .cursors-layer ${t.class} { background-color: ${o}; border-color: ${o}; color: ${n}; }`),Uf(a.type)&&i.addRule(`.monaco-editor .cursors-layer.has-selection ${t.class} { border-left: 1px solid ${n}; border-right: 1px solid ${n}; }`)}}});var vai=()=>{throw new Error("Invalid change accessor")},jwt=class extends np{constructor(i){super(i);let e=this._context.configuration.options,t=e.get(165);this._lineHeight=e.get(75),this._contentWidth=t.contentWidth,this._contentLeft=t.contentLeft,this.domNode=Ir(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=Ir(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){let i=this._context.viewLayout.getWhitespaces(),e=new Map;for(let o of i)e.set(o.id,o);let t=!1;return this._context.viewModel.changeWhitespace(o=>{let n=Object.keys(this._zones);for(let r=0,s=n.length;r<s;r++){let l=n[r],c=this._zones[l],u=this._computeWhitespaceProps(c.delegate);c.isInHiddenArea=u.isInHiddenArea;let p=e.get(l);p&&(p.afterLineNumber!==u.afterViewLineNumber||p.height!==u.heightInPx)&&(o.changeOneWhitespace(l,u.afterViewLineNumber,u.heightInPx),this._safeCallOnComputedHeight(c.delegate,u.heightInPx),t=!0)}}),t}onConfigurationChanged(i){let e=this._context.configuration.options,t=e.get(165);return this._lineHeight=e.get(75),this._contentWidth=t.contentWidth,this._contentLeft=t.contentLeft,i.hasChanged(75)&&this._recomputeWhitespacesProps(),!0}onLineMappingChanged(i){return this._recomputeWhitespacesProps()}onLinesDeleted(i){return!0}onScrollChanged(i){return i.scrollTopChanged||i.scrollWidthChanged}onZonesChanged(i){return!0}onLinesInserted(i){return!0}_getZoneOrdinal(i){return i.ordinal??i.afterColumn??1e4}_computeWhitespaceProps(i){if(i.afterLineNumber===0)return{isInHiddenArea:!1,afterViewLineNumber:0,heightInPx:this._heightInPixels(i),minWidthInPx:this._minWidthInPixels(i)};let e;if(typeof i.afterColumn<"u")e=this._context.viewModel.model.validatePosition({lineNumber:i.afterLineNumber,column:i.afterColumn});else{let r=this._context.viewModel.model.validatePosition({lineNumber:i.afterLineNumber,column:1}).lineNumber;e=new ye(r,this._context.viewModel.model.getLineMaxColumn(r))}let t;e.column===this._context.viewModel.model.getLineMaxColumn(e.lineNumber)?t=this._context.viewModel.model.validatePosition({lineNumber:e.lineNumber+1,column:1}):t=this._context.viewModel.model.validatePosition({lineNumber:e.lineNumber,column:e.column+1});let o=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(e,i.afterColumnAffinity,!0),n=i.showInHiddenAreas||this._context.viewModel.coordinatesConverter.modelPositionIsVisible(t);return{isInHiddenArea:!n,afterViewLineNumber:o.lineNumber,heightInPx:n?this._heightInPixels(i):0,minWidthInPx:this._minWidthInPixels(i)}}changeViewZones(i){let e=!1;return this._context.viewModel.changeWhitespace(t=>{let o={addZone:n=>(e=!0,this._addZone(t,n)),removeZone:n=>{n&&(e=this._removeZone(t,n)||e)},layoutZone:n=>{n&&(e=this._layoutZone(t,n)||e)}};$Go(i,o),o.addZone=vai,o.removeZone=vai,o.layoutZone=vai}),e}_addZone(i,e){let t=this._computeWhitespaceProps(e),n={whitespaceId:i.insertWhitespace(t.afterViewLineNumber,this._getZoneOrdinal(e),t.heightInPx,t.minWidthInPx),delegate:e,isInHiddenArea:t.isInHiddenArea,isVisible:!1,domNode:Ir(e.domNode),marginDomNode:e.marginDomNode?Ir(e.marginDomNode):null};return this._safeCallOnComputedHeight(n.delegate,t.heightInPx),n.domNode.setPosition("absolute"),n.domNode.domNode.style.width="100%",n.domNode.setDisplay("none"),n.domNode.setAttribute("monaco-view-zone",n.whitespaceId),this.domNode.appendChild(n.domNode),n.marginDomNode&&(n.marginDomNode.setPosition("absolute"),n.marginDomNode.domNode.style.width="100%",n.marginDomNode.setDisplay("none"),n.marginDomNode.setAttribute("monaco-view-zone",n.whitespaceId),this.marginDomNode.appendChild(n.marginDomNode)),this._zones[n.whitespaceId]=n,this.setShouldRender(),n.whitespaceId}_removeZone(i,e){if(this._zones.hasOwnProperty(e)){let t=this._zones[e];return delete this._zones[e],i.removeWhitespace(t.whitespaceId),t.domNode.removeAttribute("monaco-visible-view-zone"),t.domNode.removeAttribute("monaco-view-zone"),t.domNode.domNode.remove(),t.marginDomNode&&(t.marginDomNode.removeAttribute("monaco-visible-view-zone"),t.marginDomNode.removeAttribute("monaco-view-zone"),t.marginDomNode.domNode.remove()),this.setShouldRender(),!0}return!1}_layoutZone(i,e){if(this._zones.hasOwnProperty(e)){let t=this._zones[e],o=this._computeWhitespaceProps(t.delegate);return t.isInHiddenArea=o.isInHiddenArea,i.changeOneWhitespace(t.whitespaceId,o.afterViewLineNumber,o.heightInPx),this._safeCallOnComputedHeight(t.delegate,o.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(i){return this._zones.hasOwnProperty(i)?!!this._zones[i].delegate.suppressMouseDown:!1}_heightInPixels(i){return typeof i.heightInPx=="number"?i.heightInPx:typeof i.heightInLines=="number"?this._lineHeight*i.heightInLines:this._lineHeight}_minWidthInPixels(i){return typeof i.minWidthInPx=="number"?i.minWidthInPx:0}_safeCallOnComputedHeight(i,e){if(typeof i.onComputedHeight=="function")try{i.onComputedHeight(e)}catch(t){mt(t)}}_safeCallOnDomNodeTop(i,e){if(typeof i.onDomNodeTop=="function")try{i.onDomNodeTop(e)}catch(t){mt(t)}}prepareRender(i){}render(i){let e=i.viewportData.whitespaceViewportData,t={},o=!1;for(let r of e)this._zones[r.id].isInHiddenArea||(t[r.id]=r,o=!0);let n=Object.keys(this._zones);for(let r=0,s=n.length;r<s;r++){let l=n[r],c=this._zones[l],u=0,p=0,h="none";t.hasOwnProperty(l)?(u=t[l].verticalOffset-i.bigNumbersDelta,p=t[l].height,h="block",c.isVisible||(c.domNode.setAttribute("monaco-visible-view-zone","true"),c.isVisible=!0),this._safeCallOnDomNodeTop(c.delegate,i.getScrolledTopFromAbsoluteTop(t[l].verticalOffset))):(c.isVisible&&(c.domNode.removeAttribute("monaco-visible-view-zone"),c.isVisible=!1),this._safeCallOnDomNodeTop(c.delegate,i.getScrolledTopFromAbsoluteTop(-1e6))),c.domNode.setTop(u),c.domNode.setHeight(p),c.domNode.setDisplay(h),c.marginDomNode&&(c.marginDomNode.setTop(u),c.marginDomNode.setHeight(p),c.marginDomNode.setDisplay(h))}o&&(this.domNode.setWidth(Math.max(i.scrollWidth,this._contentWidth)),this.marginDomNode.setWidth(this._contentLeft))}};function $Go(a,i){try{return a(i)}catch(e){mt(e);return}}var Qwt=class extends vx{constructor(i){super(),this._context=i,this._options=new Ywt(this._context.configuration),this._selection=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(i){let e=new Ywt(this._context.configuration);return this._options.equals(e)?i.hasChanged(165):(this._options=e,!0)}onCursorStateChanged(i){return this._selection=i.selections,this._options.renderWhitespace==="selection"}onDecorationsChanged(i){return!0}onFlushed(i){return!0}onLinesChanged(i){return!0}onLinesDeleted(i){return!0}onLinesInserted(i){return!0}onScrollChanged(i){return i.scrollTopChanged}onZonesChanged(i){return!0}prepareRender(i){if(this._options.renderWhitespace==="none"){this._renderResult=null;return}this._renderResult=[];for(let e=i.viewportData.startLineNumber;e<=i.viewportData.endLineNumber;e++){let t=e-i.viewportData.startLineNumber,o=this._context.viewModel.getViewLineRenderingData(e),n=null;if(this._options.renderWhitespace==="selection"){let r=this._selection;for(let s of r){if(s.endLineNumber<e||s.startLineNumber>e)continue;let l=s.startLineNumber===e?s.startColumn:o.minColumn,c=s.endLineNumber===e?s.endColumn:o.maxColumn;l<c&&(n||(n=[]),n.push(new gi(l-1,c-1)))}}this._renderResult[t]=this._applyRenderWhitespace(i,e,n,o)}}_applyRenderWhitespace(i,e,t,o){if(this._options.renderWhitespace==="selection"&&!t||this._options.renderWhitespace==="trailing"&&o.continuesWithWrappedLine)return"";let n=this._context.theme.getColor(vxe),r=this._options.renderWithSVG,s=o.content,l=this._options.stopRenderingLineAfter===-1?s.length:Math.min(this._options.stopRenderingLineAfter,s.length),c=o.continuesWithWrappedLine,u=o.minColumn-1,p=this._options.renderWhitespace==="boundary",h=this._options.renderWhitespace==="trailing",g=i.getLineHeightForLineNumber(e),f=this._options.middotWidth,v=this._options.wsmiddotWidth,b=this._options.spaceWidth,S=Math.abs(v-b),y=Math.abs(f-b),w=S<y?11825:183,x=this._options.canUseHalfwidthRightwardsArrow,E="",M=!1,N=Em(s),V;N===-1?(M=!0,N=l,V=l):V=Bv(s);let H=0,K=t&&t[H],j=0;for(let J=u;J<l;J++){let se=s.charCodeAt(J);if(K&&K.endExclusive<=J&&(H++,K=t&&t[H]),se!==9&&se!==32||h&&!M&&J<=V)continue;if(p&&J>=N&&J<=V&&se===32){let ce=J-1>=0?s.charCodeAt(J-1):0,Se=J+1<l?s.charCodeAt(J+1):0;if(ce!==32&&Se!==32)continue}if(p&&c&&J===l-1){let ce=J-1>=0?s.charCodeAt(J-1):0;if(se===32&&ce!==32&&ce!==9)continue}if(t&&!(K&&K.start<=J&&J<K.endExclusive))continue;let ae=i.visibleRangeForPosition(new ye(e,J+1));ae&&(r?(j=Math.max(j,ae.left),se===9?E+=this._renderArrow(g,b,ae.left):E+=`<circle cx="${(ae.left+b/2).toFixed(2)}" cy="${(g/2).toFixed(2)}" r="${(b/7).toFixed(2)}" />`):se===9?E+=`<div class="mwh" style="left:${ae.left}px;height:${g}px;">${x?"\uFFEB":"\u2192"}</div>`:E+=`<div class="mwh" style="left:${ae.left}px;height:${g}px;">${String.fromCharCode(w)}</div>`)}return r?(j=Math.round(j+b),`<svg style="bottom:0;position:absolute;width:${j}px;height:${g}px" viewBox="0 0 ${j} ${g}" xmlns="http://www.w3.org/2000/svg" fill="${n}">`+E+"</svg>"):E}_renderArrow(i,e,t){let o=e/7,n=e,r=i/2,s=t,l={x:0,y:o/2},c={x:100/125*n,y:l.y},u={x:c.x-.2*c.x,y:c.y+.2*c.x},p={x:u.x+.1*c.x,y:u.y+.1*c.x},h={x:p.x+.35*c.x,y:p.y-.35*c.x},g={x:h.x,y:-h.y},f={x:p.x,y:-p.y},v={x:u.x,y:-u.y},b={x:c.x,y:-c.y},S={x:l.x,y:-l.y};return`<path d="M ${[l,c,u,p,h,g,f,v,b,S].map(x=>`${(s+x.x).toFixed(2)} ${(r+x.y).toFixed(2)}`).join(" L ")}" />`}render(i,e){if(!this._renderResult)return"";let t=e-i;return t<0||t>=this._renderResult.length?"":this._renderResult[t]}},Ywt=class{constructor(i){let e=i.options,t=e.get(59),o=e.get(47);o==="off"?(this.renderWhitespace="none",this.renderWithSVG=!1):o==="svg"?(this.renderWhitespace=e.get(113),this.renderWithSVG=!0):(this.renderWhitespace=e.get(113),this.renderWithSVG=!1),this.spaceWidth=t.spaceWidth,this.middotWidth=t.middotWidth,this.wsmiddotWidth=t.wsmiddotWidth,this.canUseHalfwidthRightwardsArrow=t.canUseHalfwidthRightwardsArrow,this.lineHeight=e.get(75),this.stopRenderingLineAfter=e.get(133)}equals(i){return this.renderWhitespace===i.renderWhitespace&&this.renderWithSVG===i.renderWithSVG&&this.spaceWidth===i.spaceWidth&&this.middotWidth===i.middotWidth&&this.wsmiddotWidth===i.wsmiddotWidth&&this.canUseHalfwidthRightwardsArrow===i.canUseHalfwidthRightwardsArrow&&this.lineHeight===i.lineHeight&&this.stopRenderingLineAfter===i.stopRenderingLineAfter}};var Xwt=class{constructor(i,e,t,o){this.selections=i,this.startLineNumber=e.startLineNumber|0,this.endLineNumber=e.endLineNumber|0,this.relativeVerticalOffset=e.relativeVerticalOffset,this.bigNumbersDelta=e.bigNumbersDelta|0,this.lineHeight=e.lineHeight|0,this.whitespaceViewportData=t,this._model=o,this.visibleRange=new G(e.startLineNumber,this._model.getLineMinColumn(e.startLineNumber),e.endLineNumber,this._model.getLineMaxColumn(e.endLineNumber))}getViewLineRenderingData(i){return this._model.getViewportViewLineRenderingData(this.visibleRange,i)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}};var Jwt=class{get type(){return this._theme.type}get value(){return this._theme}constructor(i){this._theme=i}update(i){this._theme=i}getColor(i){return this._theme.getColor(i)}};var Zwt=class{constructor(i,e,t){this.configuration=i,this.theme=new Jwt(e),this.viewModel=t,this.viewLayout=t.viewLayout}addEventHandler(i){this.viewModel.addViewEventHandler(i)}removeEventHandler(i){this.viewModel.removeViewEventHandler(i)}};var VB=new Float32Array([1,0,1,1,0,1,0,0,0,1,1,0]);function VF(a){if(!a)throw new Error(`Value "${a}" cannot be null`);return a}function eCt(a,i,e){let t=new i.ResizeObserver(o=>{let n=o.find(l=>l.target===a);if(!n)return;if(!("devicePixelContentBoxSize"in n)){t?.disconnect(),t=void 0;return}let r=n.devicePixelContentBoxSize[0].inlineSize,s=n.devicePixelContentBoxSize[0].blockSize;r>0&&s>0&&e(r,s)});try{t.observe(a,{box:["device-pixel-content-box"]})}catch{throw t.disconnect(),t=void 0,new ci("Could not observe device pixel dimensions")}return ee(()=>t?.disconnect())}var jGo=0,uK=class extends k{constructor(e,t,o,n){super();this.fontSize=e;this.fontFamily=t;this.devicePixelRatio=o;this._decorationStyleCache=n;this.id=jGo++;this._workGlyph={source:null,boundingBox:{left:0,bottom:0,right:0,top:0},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0};this._workGlyphConfig={chars:void 0,tokenMetadata:0,decorationStyleSetId:0};this._antiAliasing=et?"greyscale":"subpixel";let r=Math.ceil(this.fontSize*o);this._canvas=new OffscreenCanvas(r*3,r*3),this._ctx=VF(this._canvas.getContext("2d",{willReadFrequently:!0,alpha:this._antiAliasing==="greyscale"})),this._ctx.textBaseline="top",this._ctx.fillStyle="#FFFFFF",this._ctx.font=`${r}px ${this.fontFamily}`,this._textMetrics=this._ctx.measureText("A")}get cacheKey(){return`${this.fontFamily}_${this.fontSize}px`}rasterizeGlyph(e,t,o,n){return e===""?{source:this._canvas,boundingBox:{top:0,left:0,bottom:-1,right:-1},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0}:this._workGlyphConfig.chars===e&&this._workGlyphConfig.tokenMetadata===t&&this._workGlyphConfig.decorationStyleSetId===o?this._workGlyph:(this._workGlyphConfig.chars=e,this._workGlyphConfig.tokenMetadata=t,this._workGlyphConfig.decorationStyleSetId=o,this._rasterizeGlyph(e,t,o,n))}_rasterizeGlyph(e,t,o,n){let r=Math.ceil(this.fontSize*this.devicePixelRatio),s=r*3;this._canvas.width!==s&&(this._canvas.width=s,this._canvas.height=s),this._ctx.save();let l=(t&15)/10,c=Vp.getBackground(t),u=n[c]??n[2],p=this._decorationStyleCache.getStyleSet(o);this._antiAliasing==="subpixel"?(this._ctx.fillStyle=u,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height)):this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height);let h=new EI(200),g=Vp.getFontStyle(t);g&1&&h.appendString("italic "),p?.bold!==void 0?p.bold&&h.appendString("bold "):g&2&&h.appendString("bold "),h.appendString(`${r}px ${this.fontFamily}`),this._ctx.font=h.build();let f=r,v=r;if(p?.color!==void 0?this._ctx.fillStyle=`#${p.color.toString(16).padStart(8,"0")}`:this._ctx.fillStyle=n[Vp.getForeground(t)],p?.opacity!==void 0&&(this._ctx.globalAlpha=p.opacity),this._ctx.textBaseline="top",this._ctx.fillText(e,f+l,v),p?.strikethrough){let S=Math.round(v-this._textMetrics.alphabeticBaseline*.65),y=p?.strikethroughThickness!==void 0?Math.round(p.strikethroughThickness*this.devicePixelRatio):Math.max(1,Math.floor(r/10));p?.strikethroughColor!==void 0&&(this._ctx.fillStyle=`#${p.strikethroughColor.toString(16).padStart(8,"0")}`),this._ctx.fillRect(f,S-Math.floor(y/2),Math.ceil(this._textMetrics.width),y)}this._ctx.restore();let b=this._ctx.getImageData(0,0,this._canvas.width,this._canvas.height);if(this._antiAliasing==="subpixel"){let S=parseInt(u.substring(1,3),16),y=parseInt(u.substring(3,5),16),w=parseInt(u.substring(5,7),16);this._clearColor(b,S,y,w),this._ctx.putImageData(b,0,0)}return this._findGlyphBoundingBox(b,this._workGlyph.boundingBox),this._workGlyph.source=this._canvas,this._workGlyph.originOffset.x=this._workGlyph.boundingBox.left-f,this._workGlyph.originOffset.y=this._workGlyph.boundingBox.top-v,this._workGlyph.fontBoundingBoxAscent=this._textMetrics.fontBoundingBoxAscent,this._workGlyph.fontBoundingBoxDescent=this._textMetrics.fontBoundingBoxDescent,this._workGlyph}_clearColor(e,t,o,n){for(let r=0;r<e.data.length;r+=4)e.data[r]===t&&e.data[r+1]===o&&e.data[r+2]===n&&(e.data[r+3]=0)}_findGlyphBoundingBox(e,t){let o=this._canvas.height,n=this._canvas.width,r=!1;for(let s=0;s<o;s++){for(let l=0;l<n;l++){let c=s*n*4+l*4+3;if(e.data[c]!==0){t.top=s,r=!0;break}}if(r)break}t.left=0,r=!1;for(let s=0;s<n;s++){for(let l=0;l<o;l++){let c=l*n*4+s*4+3;if(e.data[c]!==0){t.left=s,r=!0;break}}if(r)break}t.right=n,r=!1;for(let s=n-1;s>=t.left;s--){for(let l=0;l<o;l++){let c=l*n*4+s*4+3;if(e.data[c]!==0){t.right=s,r=!0;break}}if(r)break}t.bottom=t.top,r=!1;for(let s=o-1;s>=0;s--){for(let l=0;l<n;l++){let c=s*n*4+l*4+3;if(e.data[c]!==0){t.bottom=s,r=!0;break}}if(r)break}}getTextMetrics(e){return this._ctx.measureText(e)}};I([bi],uK.prototype,"cacheKey",1);var Exe=class extends k{constructor(e){super();this._logService=e;this._tasks=[];this._i=0;this._register(ee(()=>this.clear()))}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,o=0,n=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),o=Math.max(t,o),r=e.timeRemaining(),o*1.5>r){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=r}this.clear()}};Exe=I([m(0,re)],Exe);var bai=class extends Exe{_requestCallback(i){return zi().setTimeout(()=>i(this._createDeadline(16)))}_cancelCallback(i){zi().clearTimeout(i)}_createDeadline(i){let e=Date.now()+i;return{timeRemaining:()=>Math.max(0,e-Date.now())}}},Sai=class extends Exe{_requestCallback(i){return zi().requestIdleCallback(i)}_cancelCallback(i){zi().cancelIdleCallback(i)}},Iai="requestIdleCallback"in zi()?Sai:bai,tCt=class{constructor(i){this._queue=i.createInstance(Iai)}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}};tCt=I([m(0,F)],tCt);var iCt=class{constructor(i,e){this._canvas=i;this._textureIndex=e;this._currentRow={x:0,y:0,h:0};this._allocatedGlyphs=new Set;this._nextIndex=0;this._ctx=VF(this._canvas.getContext("2d",{willReadFrequently:!0}))}allocate(i){let e=i.boundingBox.right-i.boundingBox.left+1,t=i.boundingBox.bottom-i.boundingBox.top+1;if(e>this._canvas.width||t>this._canvas.height)throw new ci("Glyph is too large for the atlas page");if(i.boundingBox.right-i.boundingBox.left+1>this._canvas.width-this._currentRow.x&&(this._currentRow.x=0,this._currentRow.y+=this._currentRow.h,this._currentRow.h=1),this._currentRow.y+i.boundingBox.bottom-i.boundingBox.top+1>this._canvas.height)return;this._ctx.drawImage(i.source,i.boundingBox.left,i.boundingBox.top,e,t,this._currentRow.x,this._currentRow.y,e,t);let o={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:this._currentRow.x,y:this._currentRow.y,w:e,h:t,originOffsetX:i.originOffset.x,originOffsetY:i.originOffset.y,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent};return this._currentRow.x+=e,this._currentRow.h=Math.max(this._currentRow.h,t),this._allocatedGlyphs.add(o),o}getUsagePreview(){let i=this._canvas.width,e=this._canvas.height,t=new OffscreenCanvas(i,e),o=VF(t.getContext("2d"));o.fillStyle="#808080",o.fillRect(0,0,i,e);let n=new Map,r=new Map;for(let s of this._allocatedGlyphs)n.set(s.y,Math.max(n.get(s.y)??0,s.h)),r.set(s.y,Math.max(r.get(s.y)??0,s.x+s.w));for(let s of this._allocatedGlyphs)o.fillStyle="#4040FF",o.fillRect(s.x,s.y,s.w,s.h),o.fillStyle="#FF0000",o.fillRect(s.x,s.y+s.h,s.w,n.get(s.y)-s.h);for(let[s,l]of r.entries())s!==this._currentRow.y&&(o.fillStyle="#FF0000",o.fillRect(l,s,i-l,n.get(s)));return t.convertToBlob()}getStats(){let i=this._canvas.width,e=this._canvas.height,t=0,o=0,n=i*e,r=new Map,s=new Map;for(let l of this._allocatedGlyphs)r.set(l.y,Math.max(r.get(l.y)??0,l.h)),s.set(l.y,Math.max(s.get(l.y)??0,l.x+l.w));for(let l of this._allocatedGlyphs)t+=l.w*l.h,o+=l.w*(r.get(l.y)-l.h);for(let[l,c]of s.entries())l!==this._currentRow.y&&(o+=(i-c)*r.get(l));return[`page${this._textureIndex}:`,`     Total: ${n} (${i}x${e})`,`      Used: ${t} (${(t/n*100).toPrecision(2)}%)`,`    Wasted: ${o} (${(o/n*100).toPrecision(2)}%)`,`Efficiency: ${(t/(t+o)*100).toPrecision(2)}%`].join(`
`)}};var oCt=class{constructor(i,e,t){this._canvas=i;this._textureIndex=e;this._slabs=[];this._activeSlabsByDims=new mz;this._unusedRects=[];this._openRegionsByHeight=new Map;this._openRegionsByWidth=new Map;this._allocatedGlyphs=new Set;this._nextIndex=0;this._ctx=VF(this._canvas.getContext("2d",{willReadFrequently:!0})),this._slabW=Math.min(t?.slabW??64<<Math.max(Math.floor(zi().devicePixelRatio)-1,0),this._canvas.width),this._slabH=Math.min(t?.slabH??this._slabW,this._canvas.height),this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}allocate(i){let e=i.boundingBox.right-i.boundingBox.left+1,t=i.boundingBox.bottom-i.boundingBox.top+1;if(e>this._canvas.width||t>this._canvas.height)throw new ci("Glyph is too large for the atlas page");if(e>this._slabW||t>this._slabH){if(this._allocatedGlyphs.size>0)return;let c=this._canvas.width;for(;e<c/2&&t<c/2;)c/=2;this._slabW=c,this._slabH=c,this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}let o={w:e,h:t},n=this._activeSlabsByDims.get(o.w,o.h);if(n){let c=Math.floor(this._slabW/n.entryW)*Math.floor(this._slabH/n.entryH);n.count>=c&&(n=void 0)}let r,s;if(!n)if(e<t){let c=this._openRegionsByWidth.get(e);if(c?.length)for(let u=c.length-1;u>=0;u--){let p=c[u];if(p.w>=e&&p.h>=t){r=p.x,s=p.y,e<p.w&&this._unusedRects.push({x:p.x+e,y:p.y,w:p.w-e,h:t}),p.y+=t,p.h-=t,p.h===0&&(u===c.length-1?c.pop():this._unusedRects.splice(u,1));break}}}else{let c=this._openRegionsByHeight.get(t);if(c?.length)for(let u=c.length-1;u>=0;u--){let p=c[u];if(p.w>=e&&p.h>=t){r=p.x,s=p.y,t<p.h&&this._unusedRects.push({x:p.x,y:p.y+t,w:e,h:p.h-t}),p.x+=e,p.w-=e,p.h===0&&(u===c.length-1?c.pop():this._unusedRects.splice(u,1));break}}}if(r===void 0||s===void 0){if(!n){if(this._slabs.length>=this._slabsPerRow*this._slabsPerColumn)return;n={x:Math.floor(this._slabs.length%this._slabsPerRow)*this._slabW,y:Math.floor(this._slabs.length/this._slabsPerRow)*this._slabH,entryW:o.w,entryH:o.h,count:0};let u=this._slabW%n.entryW,p=this._slabH%n.entryH;u&&SXi(this._openRegionsByWidth,u,{x:n.x+this._slabW-u,w:u,y:n.y,h:this._slabH-(p??0)}),p&&SXi(this._openRegionsByHeight,p,{x:n.x,w:this._slabW,y:n.y+this._slabH-p,h:p}),this._slabs.push(n),this._activeSlabsByDims.set(n,o.w,o.h)}let c=Math.floor(this._slabW/n.entryW);r=n.x+Math.floor(n.count%c)*n.entryW,s=n.y+Math.floor(n.count/c)*n.entryH,n.count++}this._ctx.drawImage(i.source,i.boundingBox.left,i.boundingBox.top,e,t,r,s,e,t);let l={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:r,y:s,w:e,h:t,originOffsetX:i.originOffset.x,originOffsetY:i.originOffset.y,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent};return this._allocatedGlyphs.add(l),l}getUsagePreview(){let i=this._canvas.width,e=this._canvas.height,t=new OffscreenCanvas(i,e),o=VF(t.getContext("2d"));o.fillStyle="#808080",o.fillRect(0,0,i,e);let n=0,r=0,s=0,l=0,c=64<<Math.floor(zi().devicePixelRatio)-1,u=c;for(let h of this._slabs){let g=0,f=0;for(let y=0;y<h.count;y++)g+h.entryW>c&&(g=0,f+=h.entryH),o.fillStyle="#FF0000",o.fillRect(h.x+g,h.y+f,h.entryW,h.entryH),n+=h.entryW*h.entryH,g+=h.entryW;let v=Math.floor(c/h.entryW),b=Math.floor(u/h.entryH),S=h.entryW*v*h.entryH*b;s+=c*u-S}for(let h of this._allocatedGlyphs)r+=h.w*h.h,o.fillStyle="#4040FF",o.fillRect(h.x,h.y,h.w,h.h);let p=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(let h of p)o.fillStyle="#FF000088",o.fillRect(h.x,h.y,h.w,h.h),l+=h.w*h.h;return o.globalAlpha=.5,o.drawImage(this._canvas,0,0),o.globalAlpha=1,t.convertToBlob()}getStats(){let i=this._canvas.width,e=this._canvas.height,t=0,o=0,n=0,r=0,s=0,l=i*e,c=64<<Math.floor(zi().devicePixelRatio)-1,u=c;for(let f of this._slabs){let v=0,b=0;for(let x=0;x<f.count;x++)v+f.entryW>c&&(v=0,b+=f.entryH),t+=f.entryW*f.entryH,v+=f.entryW;let S=Math.floor(c/f.entryW),y=Math.floor(u/f.entryH),w=f.entryW*S*f.entryH*y;n+=c*u-w}for(let f of this._allocatedGlyphs)o+=f.w*f.h;let p=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(let f of p)s+=f.w*f.h;let h=n-s;r=t-(o-h);let g=o/(o+r+s);return[`page[${this._textureIndex}]:`,`     Total: ${l}px (${i}x${e})`,`      Used: ${o}px (${(o/l*100).toFixed(2)}%)`,`    Wasted: ${r}px (${(r/l*100).toFixed(2)}%)`,`Restricted: ${s}px (${(s/l*100).toFixed(2)}%) (hard to allocate)`,`Efficiency: ${g===1?"100":(g*100).toFixed(2)}%`,`     Slabs: ${this._slabs.length} of ${Math.floor(this._canvas.width/c)*Math.floor(this._canvas.height/u)}`].join(`
`)}};function SXi(a,i,e){let t=a.get(i);t||(t=[],a.set(i,t)),t.push(e)}var bx=class extends k{constructor(e,t,o,n,r){super();this._logService=n;this._version=0;this._usedArea={left:0,top:0,right:0,bottom:0};this._glyphMap=new mz;this._glyphInOrderSet=new Set;switch(this._canvas=new OffscreenCanvas(t,t),this._colorMap=r.getColorTheme().tokenColorMap,o){case"shelf":this._allocator=new iCt(this._canvas,e);break;case"slab":this._allocator=new oCt(this._canvas,e);break;default:this._allocator=o(this._canvas,e);break}this._register(ee(()=>{this._canvas.width=1,this._canvas.height=1}))}get version(){return this._version}static{this.maximumGlyphCount=5e3}get usedArea(){return this._usedArea}get source(){return this._canvas}get glyphs(){return this._glyphInOrderSet.values()}getGlyph(e,t,o,n){return this._glyphMap.get(t,o,n,e.cacheKey)??this._createGlyph(e,t,o,n)}_createGlyph(e,t,o,n){if(this._glyphInOrderSet.size>=bx.maximumGlyphCount)return;let r=e.rasterizeGlyph(t,o,n,this._colorMap),s=this._allocator.allocate(r);if(s!==void 0)return this._glyphMap.set(s,t,o,n,e.cacheKey),this._glyphInOrderSet.add(s),this._version++,this._usedArea.right=Math.max(this._usedArea.right,s.x+s.w-1),this._usedArea.bottom=Math.max(this._usedArea.bottom,s.y+s.h-1),this._logService.getLevel()===1&&this._logService.trace("New glyph",{chars:t,tokenMetadata:o,decorationStyleSetId:n,rasterizedGlyph:r,glyph:s}),s}getUsagePreview(){return this._allocator.getUsagePreview()}getStats(){return this._allocator.getStats()}};bx=I([m(3,re),m(4,Pe)],bx);var kT=class extends k{constructor(e,t,o,n,r){super();this._maxTextureSize=e;this._decorationStyleCache=o;this._themeService=n;this._instantiationService=r;this._warmUpTask=this._register(new ue);this._warmedUpRasterizers=new Set;this._pages=[];this._glyphPageIndex=new mz;this._onDidDeleteGlyphs=this._register(new T);this.onDidDeleteGlyphs=this._onDidDeleteGlyphs.event;this._allocatorType=t?.allocatorType??"slab",this._register(U.runAndSubscribe(this._themeService.onDidColorThemeChange,()=>{this._colorMap&&this.clear(),this._colorMap=this._themeService.getColorTheme().tokenColorMap}));let s=Math.max(1,Math.floor(zi().devicePixelRatio));this.pageSize=Math.min(1024*s,this._maxTextureSize),this._initFirstPage(),this._register(ee(()=>je(this._pages)))}static{this.maximumPageCount=16}get pages(){return this._pages}_initFirstPage(){let e=this._instantiationService.createInstance(bx,0,this.pageSize,this._allocatorType);this._pages.push(e);let t=new uK(1,"",1,this._decorationStyleCache);e.getGlyph(t,"",0,0),t.dispose()}clear(){for(let e of this._pages)e.dispose();this._pages.length=0,this._glyphPageIndex.clear(),this._warmedUpRasterizers.clear(),this._warmUpTask.clear(),this._initFirstPage(),this._onDidDeleteGlyphs.fire()}getGlyph(e,t,o,n,r){return o&=-2048,o|=Math.floor(r%1*10),this._warmedUpRasterizers.has(e.id)||(this._warmUpAtlas(e),this._warmedUpRasterizers.add(e.id)),this._tryGetGlyph(this._glyphPageIndex.get(t,o,n,e.cacheKey)??0,e,t,o,n)}_tryGetGlyph(e,t,o,n,r){return this._glyphPageIndex.set(e,o,n,r,t.cacheKey),this._pages[e].getGlyph(t,o,n,r)??(e+1<this._pages.length?this._tryGetGlyph(e+1,t,o,n,r):void 0)??this._getGlyphFromNewPage(t,o,n,r)}_getGlyphFromNewPage(e,t,o,n){if(this._pages.length>=kT.maximumPageCount)throw new Error(`Attempt to create a texture atlas page past the limit ${kT.maximumPageCount}`);return this._pages.push(this._instantiationService.createInstance(bx,this._pages.length,this.pageSize,this._allocatorType)),this._glyphPageIndex.set(this._pages.length-1,t,o,n,e.cacheKey),this._pages[this._pages.length-1].getGlyph(e,t,o,n)}getUsagePreview(){return Promise.all(this._pages.map(e=>e.getUsagePreview()))}getStats(){return this._pages.map(e=>e.getStats())}_warmUpAtlas(e){let t=this._colorMap;if(!t)throw new ci("Cannot warm atlas without color map");this._warmUpTask.value?.clear();let o=this._warmUpTask.value=this._instantiationService.createInstance(Iai);for(let n=65;n<=90;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)});for(let n=97;n<=122;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)});for(let n=33;n<=126;n++)for(let r of t.keys())o.enqueue(()=>{for(let s=0;s<1;s+=.1)this.getGlyph(e,String.fromCharCode(n),r<<15&16744448,0,s)})}};kT=I([m(3,Pe),m(4,F)],kT);var ft=wt,Ne=le("notificationService");function yX(a){if(a){let i=a;return typeof i.id=="string"&&typeof i.label=="string"}return!1}var lde=class{constructor(){this.progress=new yai;this.onDidClose=U.None;this.onDidChangeVisibility=U.None}updateSeverity(i){}updateMessage(i){}updateActions(i){}close(){}},yai=class{infinite(){}done(){}total(i){}worked(i){}};function wX(a,i){return i===ft.Error?d(2481,null,a):i===ft.Warning?d(2483,null,a):d(2482,null,a)}var By;(t=>{async function a(o){try{if(!navigator.gpu)throw new Error("This browser does not support WebGPU");let n=await navigator.gpu.requestAdapter();if(!n)throw new Error("This browser supports WebGPU but it appears to be disabled");return wai(await n.requestDevice())}catch(n){throw o&&o(n.message),n}}t.requestDevice=a;function i(o,n,r){let s=o.createBuffer(n);return r&&o.queue.writeBuffer(s,0,bL(r)?r():r),wai(s)}t.createBuffer=i;function e(o,n){return wai(o.createTexture(n))}t.createTexture=e})(By||={});function wai(a){return{object:a,dispose:()=>a.destroy()}}var nCt=class{get dataOffset(){return this._startIndex}get dirtySize(){if(!(this._startIndex===void 0||this._endIndex===void 0))return this._endIndex-this._startIndex+1}get isDirty(){return this._startIndex!==void 0}flag(i,e=1){return this._flag(i),e>1&&this._flag(i+e-1),i}_flag(i){(this._startIndex===void 0||i<this._startIndex)&&(this._startIndex=i),(this._endIndex===void 0||i>this._endIndex)&&(this._endIndex=i)}clear(){this._startIndex=void 0,this._endIndex=void 0}};function IXi(a,i){return new Cai(a,i)}var Cai=class extends k{constructor(e,t){super();this.propertySpecs=e;this.capacity=t;this._dirtyTracker=new nCt;this._propertySpecsMap=new Map;this._entries=new ra;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onDidChangeBuffer=this._register(new T);this.onDidChangeBuffer=this._onDidChangeBuffer.event;this.view=new Float32Array(t*e.length),this.buffer=this.view.buffer,this._entrySize=e.length;for(let o=0;o<e.length;o++){let n={offset:o,...e[o]};this._propertySpecsMap.set(n.name,n)}this._register(ee(()=>je(this._entries)))}get bufferUsedSize(){return this.viewUsedSize*Float32Array.BYTES_PER_ELEMENT}get viewUsedSize(){return this._entries.size*this._entrySize}get entryCount(){return this._entries.size}get dirtyTracker(){return this._dirtyTracker}createEntry(e){this._entries.size===this.capacity&&(this._expandBuffer(),this._onDidChangeBuffer.fire());let t=new xai(this.view,this._propertySpecsMap,this._dirtyTracker,this._entries.size,e),o=this._entries.push(t),n=[];return n.push(U.forward(t.onDidChange,this._onDidChange)),n.push(t.onWillDispose(()=>{let r=t.i;o(),this.view.set(this.view.subarray(r*this._entrySize+2,this._entries.size*this._entrySize+2),r*this._entrySize);for(let s of this._entries)s.i>r&&s.i--;this._dirtyTracker.flag(r,(this._entries.size-r)*this._entrySize),je(n)})),t}_expandBuffer(){this.capacity*=2;let e=new Float32Array(this.capacity*this._entrySize);e.set(this.view),this.view=e,this.buffer=this.view.buffer}},xai=class extends k{constructor(e,t,o,n,r){super();this._view=e;this._propertySpecsMap=t;this._dirtyTracker=o;this.i=n;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;for(let s of this._propertySpecsMap.values())this._view[this.i*this._propertySpecsMap.size+s.offset]=r[s.name];this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}dispose(){this._onWillDispose.fire(),super.dispose()}set(e,t){let o=this.i*this._propertySpecsMap.size+this._propertySpecsMap.get(e).offset;this._view[this._dirtyTracker.flag(o)]=t,this._onDidChange.fire()}get(e){return this._view[this.i*this._propertySpecsMap.size+this._propertySpecsMap.get(e).offset]}setRaw(e){if(e.length!==this._propertySpecsMap.size)throw new Error(`Data length ${e.length} does not match the number of properties in the collection (${this._propertySpecsMap.size})`);this._view.set(e,this.i*this._propertySpecsMap.size),this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}};var yXi=`

struct Vertex {
	@location(0) position: vec2f,
};

struct LayoutInfo {
	canvasDims: vec2f,
	viewportOffset: vec2f,
	viewportDims: vec2f,
}

struct ScrollOffset {
	offset: vec2f,
}

struct Shape {
	position: vec2f,
	size: vec2f,
	color: vec4f,
};

struct VSOutput {
	@builtin(position) position: vec4f,
	@location(1)       color:    vec4f,
};

// Uniforms
@group(0) @binding(1) var<uniform>       layoutInfo:      LayoutInfo;

// Storage buffers
@group(0) @binding(0)            var<storage, read> shapes:          array<Shape>;
@group(0) @binding(2)      var<uniform>       scrollOffset:    ScrollOffset;

@vertex fn vs(
	vert: Vertex,
	@builtin(instance_index) instanceIndex: u32,
	@builtin(vertex_index) vertexIndex : u32
) -> VSOutput {
	let shape = shapes[instanceIndex];

	var vsOut: VSOutput;
	vsOut.position = vec4f(
		(
			// Top left corner
			vec2f(-1,  1) +
			// Convert pixel position to clipspace
			vec2f( 2, -2) / layoutInfo.canvasDims *
			// Shape position and size
			(layoutInfo.viewportOffset - scrollOffset.offset + shape.position + vert.position * shape.size)
		),
		0.0,
		1.0
	);
	vsOut.color = shape.color;
	return vsOut;
}

@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
	return vsOut.color;
}
`;var rCt=class extends yT{constructor(e,t,o,n,r,s){super();this._context=e;this._contentLeft=t;this._devicePixelRatio=o;this._canvas=n;this._ctx=r;this._shapeBindBuffer=this._register(new ue);this._initialized=!1;this._shapeCollection=this._register(IXi([{name:"x"},{name:"y"},{name:"width"},{name:"height"},{name:"red"},{name:"green"},{name:"blue"},{name:"alpha"}],32));this._context.addEventHandler(this),this._initWebgpu(s)}async _initWebgpu(e){if(this._device=await e,this._store.isDisposed)return;let t=navigator.gpu.getPreferredCanvasFormat();this._ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco rectangle renderer render pass",colorAttachments:[this._renderPassColorAttachment]};let o;{let l;(w=>(w[w.FloatsPerEntry=6]="FloatsPerEntry",w[w.BytesPerEntry=24]="BytesPerEntry",w[w.Offset_CanvasWidth____=0]="Offset_CanvasWidth____",w[w.Offset_CanvasHeight___=1]="Offset_CanvasHeight___",w[w.Offset_ViewportOffsetX=2]="Offset_ViewportOffsetX",w[w.Offset_ViewportOffsetY=3]="Offset_ViewportOffsetY",w[w.Offset_ViewportWidth__=4]="Offset_ViewportWidth__",w[w.Offset_ViewportHeight_=5]="Offset_ViewportHeight_"))(l||={});let c=new Float32Array(6),u=(p=this._canvas.width,h=this._canvas.height)=>(c[0]=p,c[1]=h,c[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*zi().devicePixelRatio),c[3]=0,c[4]=c[0]-c[2],c[5]=c[1]-c[3],c);o=this._register(By.createBuffer(this._device,{label:"Monaco rectangle renderer uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>u())).object,this._register(eCt(this._canvas,zi(),(p,h)=>{this._device.queue.writeBuffer(o,0,u(p,h))}))}let n=2;this._scrollOffsetBindBuffer=this._register(By.createBuffer(this._device,{label:"Monaco rectangle renderer scroll offset buffer",size:n*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(n);let r=()=>By.createBuffer(this._device,{label:"Monaco rectangle renderer shape buffer",size:this._shapeCollection.buffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});this._shapeBindBuffer.value=r(),this._register(U.runAndSubscribe(this._shapeCollection.onDidChangeBuffer,()=>{this._shapeBindBuffer.value=r(),this._pipeline&&this._updateBindGroup(this._pipeline,o)})),this._vertexBuffer=this._register(By.createBuffer(this._device,{label:"Monaco rectangle renderer vertex buffer",size:VB.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},VB)).object;let s=this._device.createShaderModule({label:"Monaco rectangle renderer shader module",code:yXi});this._pipeline=this._device.createRenderPipeline({label:"Monaco rectangle renderer render pipeline",layout:"auto",vertex:{module:s,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:s,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._updateBindGroup(this._pipeline,o),this._initialized=!0}_updateBindGroup(e,t){this._bindGroup=this._device.createBindGroup({label:"Monaco rectangle renderer bind group",layout:e.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._shapeBindBuffer.value.object}},{binding:1,resource:{buffer:t}},{binding:2,resource:{buffer:this._scrollOffsetBindBuffer}}]})}register(e,t,o,n,r,s,l,c){return this._shapeCollection.createEntry({x:e,y:t,width:o,height:n,red:r,green:s,blue:l,alpha:c})}onScrollChanged(e){if(this._device){let t=zi().devicePixelRatio;this._scrollOffsetValueBuffer[0]=this._context.viewLayout.getCurrentScrollLeft()*t,this._scrollOffsetValueBuffer[1]=this._context.viewLayout.getCurrentScrollTop()*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer)}return!0}_update(){if(!this._device)return;let e=this._shapeCollection;e.dirtyTracker.isDirty&&(this._device.queue.writeBuffer(this._shapeBindBuffer.value.object,0,e.buffer,e.dirtyTracker.dataOffset,e.dirtyTracker.dirtySize*e.view.BYTES_PER_ELEMENT),e.dirtyTracker.clear())}draw(e){if(!this._initialized)return;this._update();let t=this._device.createCommandEncoder({label:"Monaco rectangle renderer command encoder"});this._renderPassColorAttachment.view=this._ctx.getCurrentTexture().createView();let o=t.beginRenderPass(this._renderPassDescriptor);o.setPipeline(this._pipeline),o.setVertexBuffer(0,this._vertexBuffer),o.setBindGroup(0,this._bindGroup);let n=Math.ceil(this._contentLeft.get()*this._devicePixelRatio.get());o.setScissorRect(n,0,this._canvas.width-n,this._canvas.height),o.draw(VB.length/2,this._shapeCollection.entryCount),o.end();let r=t.finish();this._device.queue.submit([r])}};var sCt=class extends k{constructor(){super();this._ruleCache=new Map;this._cssVariableCache=new Map;this._container=_("div.monaco-decoration-css-rule-extractor"),this._dummyElement=_("span"),this._container.appendChild(this._dummyElement),this._register(ee(()=>this._container.remove()))}getStyleRules(e,t){let o=this._ruleCache.get(t);if(o)return o;this._dummyElement.className=t,e.appendChild(this._container);let n=this._getStyleRules(t);return this._ruleCache.set(t,n),e.removeChild(this._container),n}_getStyleRules(e){let t=[],n=[..._m().styleSheets],r=e.split(" ").filter(s=>s.length>0);for(let s=0;s<n.length;s++){let l=n[s];this._collectMatchingRules(l.cssRules,r,t)}return t}_collectMatchingRules(e,t,o){for(let n of e)if(n instanceof CSSImportRule)n.styleSheet&&this._collectMatchingRules(n.styleSheet.cssRules,t,o);else if(n instanceof CSSStyleRule){for(let r of t){let s=`.${r}`,l=n.selectorText.indexOf(s);if(l!==-1){let c=l+s.length;if(n.selectorText.length===c||n.selectorText.substring(c,c+1).match(/[ :.]/)){o.push(n);break}}}n.cssRules?.length&&this._collectMatchingRules(n.cssRules,t,o)}}resolveCssVariable(e,t){let o=this._cssVariableCache.get(t);return o===void 0&&(e.appendChild(this._container),o=zi().getComputedStyle(this._container).getPropertyValue(t).trim(),e.removeChild(this._container),this._cssVariableCache.set(t,o)),o}clear(){this._ruleCache.clear(),this._cssVariableCache.clear()}};var aCt=class{constructor(){this._nextId=1;this._cacheById=new Map;this._cacheByStyle=new mz}getOrCreateEntry(i,e,t,o,n,r){if(i===void 0&&e===void 0&&t===void 0&&o===void 0&&n===void 0&&r===void 0)return 0;let s=this._cacheByStyle.get(i??0,e?1:0,t===void 0?"":t.toFixed(2),o?1:0,n===void 0?"":n.toFixed(2),r??0);if(s)return s.id;let l=this._nextId++,c={id:l,color:i,bold:e,opacity:t,strikethrough:o,strikethroughThickness:n,strikethroughColor:r};return this._cacheById.set(l,c),this._cacheByStyle.set(c,i??0,e?1:0,t===void 0?"":t.toFixed(2),o?1:0,n===void 0?"":n.toFixed(2),r??0),l}getStyleSet(i){if(i!==0)return this._cacheById.get(i)}};var Pc=class extends k{constructor(e,t,o,n,r){super();this._instantiationService=t;this._notificationService=o;this.configurationService=n;this._themeService=r;this.maxGpuCols=2e3;this.canvas=Ir(document.createElement("canvas")),this.canvas.setClassName("editorCanvas"),this._register(U.runAndSubscribe(n.onDidChangeConfiguration,u=>{if(!u||u.affectsConfiguration("editor.scrollbar.verticalScrollbarSize")){let p=n.getValue("editor").scrollbar?.verticalScrollbarSize??14;this.canvas.domNode.style.boxSizing="border-box",this.canvas.domNode.style.paddingRight=`${p}px`}})),this.ctx=VF(this.canvas.domNode.getContext("webgpu")),Pc.device||(Pc.device=By.requestDevice(u=>{let p=[{label:d(189,null),run:()=>this.configurationService.updateValue("editor.experimentalGpuAcceleration","off")}];this._notificationService.prompt(ft.Warning,u,p)}).then(u=>(Pc.deviceSync=u.object,Pc._atlas||(Pc._atlas=this._instantiationService.createInstance(kT,u.object.limits.maxTextureDimension2D,void 0,Pc.decorationStyleCache)),u.object)));let s=De(this,zi().devicePixelRatio);this._register($(zi(),"resize",()=>{s.set(zi().devicePixelRatio,void 0)})),this.devicePixelRatio=s,this._register(Zs(this.devicePixelRatio,()=>Pc.atlas?.clear())),this._register(this._themeService.onDidColorThemeChange(()=>{Pc.decorationCssRuleExtractor.clear(),Pc.atlas?.clear()}));let l=De(this,{width:this.canvas.domNode.width,height:this.canvas.domNode.height});this._register(eCt(this.canvas.domNode,zi(),(u,p)=>{this.canvas.domNode.width=u,this.canvas.domNode.height=p,l.set({width:u,height:p},void 0)})),this.canvasDevicePixelDimensions=l;let c=De(this,0);this._register(this.configurationService.onDidChangeConfiguration(u=>{c.set(e.configuration.options.get(165).contentLeft,void 0)})),this.contentLeft=c,this.rectangleRenderer=this._register(this._instantiationService.createInstance(rCt,e,this.contentLeft,this.devicePixelRatio,this.canvas.domNode,this.ctx,Pc.device))}static{this._decorationCssRuleExtractor=new sCt}static get decorationCssRuleExtractor(){return Pc._decorationCssRuleExtractor}static{this._decorationStyleCache=new aCt}static get decorationStyleCache(){return Pc._decorationStyleCache}static get atlas(){if(!Pc._atlas)throw new ci("Cannot call ViewGpuContext.textureAtlas before device is resolved");return Pc._atlas}get atlas(){return Pc.atlas}canRender(e,t,o){let n=t.getViewLineRenderingData(o);if(n.containsRTL||n.maxColumn>this.maxGpuCols)return!1;if(n.inlineDecorations.length>0){let r=!0;for(let s of n.inlineDecorations){if(s.type!==0){r=!1;break}let l=Pc._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,s.inlineClassName);if(r&&=l.every(c=>{if(c.selectorText.includes(":"))return!1;for(let u of c.style)if(!wXi(u,c.style))return!1;return!0}),!r)break}return r}return!0}canRenderDetailed(e,t,o){let n=t.getViewLineRenderingData(o),r=[];if(n.containsRTL&&r.push("containsRTL"),n.maxColumn>this.maxGpuCols&&r.push("maxColumn > maxGpuCols"),n.inlineDecorations.length>0){let s=!0,l=[],c=[],u=[];for(let p of n.inlineDecorations){if(p.type!==0){l.push(p.type),s=!1;continue}let h=Pc._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,p.inlineClassName);s&&=h.every(g=>{if(g.selectorText.includes(":"))return c.push(g.selectorText),!1;for(let f of g.style)if(!wXi(f,g.style))return u.push(`${f}: ${g.style[f]}`),!1;return!0})}l.length>0&&r.push(`inlineDecorations with unsupported types (${l.map(p=>`\`${p}\``).join(", ")})`),u.length>0&&r.push(`inlineDecorations with unsupported CSS rules (${u.map(p=>`\`${p}\``).join(", ")})`),c.length>0&&r.push(`inlineDecorations with unsupported CSS selectors (${c.map(p=>`\`${p}\``).join(", ")})`)}return r}};Pc=I([m(1,F),m(2,Ne),m(3,B),m(4,Pe)],Pc);var YGo=["color","font-weight","opacity","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-decoration-thickness"];function wXi(a,i){if(!YGo.includes(a))return!1;switch(a){case"text-decoration":case"text-decoration-line":return i.getPropertyValue(a)==="line-through";case"text-decoration-color":{let e=i.getPropertyValue(a);return/^var\(--[^,]+,\s*(?:initial|inherit)\)$/.test(e)?!0:Ue.Format.CSS.parse(e)!==null}case"text-decoration-style":return i.getPropertyValue(a)==="initial";case"text-decoration-thickness":{let e=i.getPropertyValue(a);return e==="initial"||/^\d+(\.\d+)?px$/.test(e)}default:return!0}}function CX(a,i){return a.isBasicASCII&&i.useMonospaceOptimizations?new kai(a):new Eai(a)}var kai=class{constructor(i){this._content=i.content}getSegmentAtIndex(i){return this._content[i]}getSegmentData(i){}},Eai=class{constructor(i){this._segments=[];let e=i.content,t=nd.Segmenter(void 0,{granularity:"grapheme"}).value,o=Array.from(t.segment(e)),n=0;for(let r=0;r<e.length;r++){let s=o[n];if(!s)break;if(s.index!==r){this._segments.push(void 0);continue}n++,this._segments.push(s)}}getSegmentAtIndex(i){return this._segments[i]?.segment}getSegmentData(i){return this._segments[i]}};var Txe=class extends yT{constructor(e,t,o,n){super();this._context=e;this._viewGpuContext=t;this._device=o;this._glyphRasterizer=n;this._context.addEventHandler(this)}get glyphRasterizer(){return this._glyphRasterizer.value}};var lCt=`
struct GlyphInfo {
	position: vec2f,
	size: vec2f,
	origin: vec2f,
};

struct Vertex {
	@location(0) position: vec2f,
};

struct Cell {
	position: vec2f,
	unused1: vec2f,
	glyphIndex: f32,
	textureIndex: f32
};

struct LayoutInfo {
	canvasDims: vec2f,
	viewportOffset: vec2f,
	viewportDims: vec2f,
}

struct ScrollOffset {
	offset: vec2f
}

struct VSOutput {
	@builtin(position) position:   vec4f,
	@location(1)       layerIndex: f32,
	@location(0)       texcoord:   vec2f,
};

// Uniforms
@group(0) @binding(4)       var<uniform>       layoutInfo:      LayoutInfo;
@group(0) @binding(5)  var<uniform>       atlasDims:       vec2f;
@group(0) @binding(6)            var<uniform>       scrollOffset:    ScrollOffset;

// Storage buffers
@group(0) @binding(0)               var<storage, read> glyphInfo:       array<array<GlyphInfo, ${bx.maximumGlyphCount}>, ${kT.maximumPageCount}>;
@group(0) @binding(1)                   var<storage, read> cells:           array<Cell>;

@vertex fn vs(
	vert: Vertex,
	@builtin(instance_index) instanceIndex: u32,
	@builtin(vertex_index) vertexIndex : u32
) -> VSOutput {
	let cell = cells[instanceIndex];
	var glyph = glyphInfo[u32(cell.textureIndex)][u32(cell.glyphIndex)];

	var vsOut: VSOutput;
	// Multiple vert.position by 2,-2 to get it into clipspace which ranged from -1 to 1
	vsOut.position = vec4f(
		// Make everything relative to top left instead of center
		vec2f(-1, 1) +
		((vert.position * vec2f(2, -2)) / layoutInfo.canvasDims) * glyph.size +
		((cell.position * vec2f(2, -2)) / layoutInfo.canvasDims) +
		((glyph.origin * vec2f(2, -2)) / layoutInfo.canvasDims) +
		(((layoutInfo.viewportOffset - scrollOffset.offset * vec2(1, -1)) * 2) / layoutInfo.canvasDims),
		0.0,
		1.0
	);

	vsOut.layerIndex = cell.textureIndex;
	// Textures are flipped from natural direction on the y-axis, so flip it back
	vsOut.texcoord = vert.position;
	vsOut.texcoord = (
		// Glyph offset (0-1)
		(glyph.position / atlasDims) +
		// Glyph coordinate (0-1)
		(vsOut.texcoord * (glyph.size / atlasDims))
	);

	return vsOut;
}

@group(0) @binding(2) var ourSampler: sampler;
@group(0) @binding(3)        var ourTexture: texture_2d_array<f32>;

@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
	return textureSample(ourTexture, ourSampler, vsOut.texcoord, u32(vsOut.layerIndex));
}
`;var cCt=class a extends Txe{constructor(e,t,o,n){super(e,t,o,n);this.type="viewport";this.wgsl=lCt;this._cellBindBufferLineCapacity=63;this._activeDoubleBufferIndex=0;this._visibleObjectCount=0;this._lastViewportLineCount=0;this._scrollInitialized=!1;this._onDidChangeBindGroupEntries=this._register(new T);this.onDidChangeBindGroupEntries=this._onDidChangeBindGroupEntries.event;this._rebuildCellBuffer(this._cellBindBufferLineCapacity);let r=2;this._scrollOffsetBindBuffer=this._register(By.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:r*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(r)}static{this.maxSupportedColumns=2e3}get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}_rebuildCellBuffer(e){this._cellBindBuffer?.destroy();let t=(Math.floor(e/32)+1)*32,o=t*a.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(By.createBuffer(this._device,{label:"Monaco full file cell buffer",size:o,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(o),new ArrayBuffer(o)],this._cellBindBufferLineCapacity=t,this._lastViewportLineCount=0,this._onDidChangeBindGroupEntries.fire()}onConfigurationChanged(e){return!0}onDecorationsChanged(e){return!0}onTokensChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onLinesChanged(e){return!0}onScrollChanged(e){if(this._store.isDisposed)return!1;let t=zi().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return!0}onLineMappingChanged(e){return!0}onZonesChanged(e){return!0}reset(){for(let e of[0,1]){let t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._lastViewportLineCount=0}update(e,t){let o="",n,r=0,s=0,l=0,c=0,u=0,p=0,h,g=0,f=0,v=0,b=0,S,y,w,x,E,M,N,V,H=0,K=0,j,J=zi().devicePixelRatio,se;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0),this._cellBindBufferLineCapacity<e.endLineNumber-e.startLineNumber+1&&this._rebuildCellBuffer(e.endLineNumber-e.startLineNumber+1);let ae=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]);ae.fill(0);let ce=a.maxSupportedColumns*6;for(s=e.startLineNumber;s<=e.endLineNumber;s++)if(this._viewGpuContext.canRender(t,e,s)){N=e.getViewLineRenderingData(s),p=0,se=CX(N,t),r=t.spaceWidth*J,c=(N.minColumn-1)*r,j=N.tokens,f=N.minColumn-1,v=0;for(let xe=0,He=j.getCount();xe<He;xe++)if(v=j.getEndOffset(xe),!(v<=f)){for(b=j.getMetadata(xe),l=f;l<v&&!(l>a.maxSupportedColumns);l++){if(n=se.getSegmentAtIndex(l),n===void 0)continue;o=n,N.isBasicASCII&&t.useMonospaceOptimizations||(r=this.glyphRasterizer.getTextMetrics(o).width),y=void 0,S=void 0,w=void 0,x=void 0,E=void 0,M=void 0;for(V of N.inlineDecorations){if(s<V.range.startLineNumber||s>V.range.endLineNumber||s===V.range.startLineNumber&&l<V.range.startColumn-1||s===V.range.endLineNumber&&l>=V.range.endColumn-1)continue;let Te=Pc.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,V.inlineClassName);for(let It of Te)for(let tt of It.style){let Oi=It.styleMap.get(tt)?.toString()??"";switch(tt){case"color":{let zt=Ue.Format.CSS.parse(Oi);if(!zt)throw new ci("Invalid color format "+Oi);y=zt.toNumber32Bit();break}case"font-weight":{XGo(Oi)>=400?S=!0:S=!1;break}case"opacity":{w=JGo(Oi);break}case"text-decoration":case"text-decoration-line":{Oi==="line-through"&&(x=!0);break}case"text-decoration-thickness":{let zt=Oi.match(/^(\d+(?:\.\d+)?)px$/);zt&&(E=parseFloat(zt[1]));break}case"text-decoration-color":{let zt=Oi,mo=Oi.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);mo&&(zt=Pc.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,mo[1]));let dn=Ue.Format.CSS.parse(zt);dn&&(M=dn.toNumber32Bit());break}case"text-decoration-style":break;default:throw new ci("Unexpected inline decoration style")}}}if(o===" "||o==="	"){if(g=((s-1)*a.maxSupportedColumns+l)*6,ae.fill(0,g,g+6),o==="	"){let Te=l+p;p=Ll.nextRenderTabStop(l+p,N.tabSize),c+=r*(p-Te),p-=l+1}else c+=r;continue}let Ee=Pc.decorationStyleCache.getOrCreateEntry(y,S,w,x,E,M);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,o,b,Ee,c),u=Math.round(e.relativeVerticalOffset[s-e.startLineNumber]*J+Math.floor((e.lineHeight*J-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),g=((s-e.startLineNumber)*a.maxSupportedColumns+l)*6,ae[g+0]=Math.floor(c),ae[g+1]=u,ae[g+4]=h.glyphIndex,ae[g+5]=h.pageIndex,c+=r}f=v}H=((s-e.startLineNumber)*a.maxSupportedColumns+v)*6,K=(s-e.startLineNumber)*a.maxSupportedColumns*6,ae.fill(0,H,K)}let Se=(e.endLineNumber-e.startLineNumber+1)*ce,Re=e.endLineNumber-e.startLineNumber+1;if(this._device.queue.writeBuffer(this._cellBindBuffer,0,ae.buffer,0,Se*Float32Array.BYTES_PER_ELEMENT),Re<this._lastViewportLineCount){let xe=this._lastViewportLineCount-Re,He=Se*Float32Array.BYTES_PER_ELEMENT,Ee=xe*ce*Float32Array.BYTES_PER_ELEMENT;this._device.queue.writeBuffer(this._cellBindBuffer,He,ae.buffer,Se*Float32Array.BYTES_PER_ELEMENT,Ee)}return this._lastViewportLineCount=Re,this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=Se,Se}draw(e,t){if(this._visibleObjectCount<=0)throw new ci("Attempt to draw 0 objects");e.draw(VB.length/2,this._visibleObjectCount)}};function XGo(a){switch(a){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(a)}function JGo(a){return a.endsWith("%")?parseFloat(a.substring(0,a.length-1))/100:a.match(/^\d+(?:\.\d*)/)?parseFloat(a):1}var xX=class a extends Txe{constructor(e,t,o,n){super(e,t,o,n);this.type="fullfile";this.wgsl=lCt;this._activeDoubleBufferIndex=0;this._upToDateLines=[new Set,new Set];this._visibleObjectCount=0;this._finalRenderedLine=0;this._scrollInitialized=!1;this._queuedBufferUpdates=[[],[]];let r=a.maxSupportedLines*a.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(By.createBuffer(this._device,{label:"Monaco full file cell buffer",size:r,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(r),new ArrayBuffer(r)];let s=2;this._scrollOffsetBindBuffer=this._register(By.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:s*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(s)}static{this.maxSupportedLines=3e3}static{this.maxSupportedColumns=200}get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}onConfigurationChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onDecorationsChanged(e){return this._invalidateAllLines(),!0}onTokensChanged(e){for(let t of e.ranges)this._invalidateLineRange(t.fromLineNumber,t.toLineNumber);return!0}onLinesDeleted(e){return this._invalidateLinesFrom(e.fromLineNumber),this._queueBufferUpdate(e),!0}onLinesInserted(e){return this._invalidateLinesFrom(e.fromLineNumber),!0}onLinesChanged(e){return this._invalidateLineRange(e.fromLineNumber,e.fromLineNumber+e.count),!0}onScrollChanged(e){if(this._store.isDisposed)return!1;let t=zi().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return this._invalidateAllLines(),!0}onLineMappingChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onZonesChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}_invalidateAllLines(){this._upToDateLines[0].clear(),this._upToDateLines[1].clear()}_invalidateLinesFrom(e){for(let t of[0,1]){let o=this._upToDateLines[t];for(let n of o)n>=e&&o.delete(n)}}_invalidateLineRange(e,t){for(let o=e;o<=t;o++)this._upToDateLines[0].delete(o),this._upToDateLines[1].delete(o)}reset(){this._invalidateAllLines();for(let e of[0,1]){let t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._finalRenderedLine=0}update(e,t){let o="",n,r=0,s=0,l=0,c=0,u=0,p=0,h,g=0,f=0,v=0,b=0,S,y,w,x,E,M,N,V,H=0,K=0,j,J=zi().devicePixelRatio,se;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0);let ae=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]),ce=a.maxSupportedColumns*6,Se=this._upToDateLines[this._activeDoubleBufferIndex],Re=3e3,xe=0,He=this._queuedBufferUpdates[this._activeDoubleBufferIndex];for(;He.length;){let Te=He.shift();switch(Te.type){case 2:case 8:case 17:{ae.fill(0),Re=1,xe=Math.max(xe,this._finalRenderedLine),this._finalRenderedLine=0;break}case 10:{let It=(Te.fromLineNumber-1)*a.maxSupportedColumns*6,tt=Te.toLineNumber*a.maxSupportedColumns*6,Oi=(this._finalRenderedLine-(Te.toLineNumber-Te.fromLineNumber+1))*a.maxSupportedColumns*6;ae.set(ae.subarray(tt),It),ae.fill(0,Oi),Re=Math.min(Re,Te.fromLineNumber),xe=Math.max(xe,this._finalRenderedLine),this._finalRenderedLine-=Te.toLineNumber-Te.fromLineNumber+1;break}}}for(s=e.startLineNumber;s<=e.endLineNumber;s++){if(!this._viewGpuContext.canRender(t,e,s)){H=(s-1)*a.maxSupportedColumns*6,K=s*a.maxSupportedColumns*6,ae.fill(0,H,K),Re=Math.min(Re,s),xe=Math.max(xe,s);continue}if(!Se.has(s)){Re=Math.min(Re,s),xe=Math.max(xe,s),N=e.getViewLineRenderingData(s),p=0,se=CX(N,t),r=t.spaceWidth*J,c=(N.minColumn-1)*r,j=N.tokens,f=N.minColumn-1,v=0;for(let Te=0,It=j.getCount();Te<It;Te++)if(v=j.getEndOffset(Te),!(v<=f)){for(b=j.getMetadata(Te),l=f;l<v&&!(l>a.maxSupportedColumns);l++){if(n=se.getSegmentAtIndex(l),n===void 0)continue;o=n,N.isBasicASCII&&t.useMonospaceOptimizations||(r=this.glyphRasterizer.getTextMetrics(o).width),y=void 0,S=void 0,w=void 0,x=void 0,E=void 0,M=void 0;for(V of N.inlineDecorations){if(s<V.range.startLineNumber||s>V.range.endLineNumber||s===V.range.startLineNumber&&l<V.range.startColumn-1||s===V.range.endLineNumber&&l>=V.range.endColumn-1)continue;let Oi=Pc.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,V.inlineClassName);for(let zt of Oi)for(let mo of zt.style){let dn=zt.styleMap.get(mo)?.toString()??"";switch(mo){case"color":{let No=Ue.Format.CSS.parse(dn);if(!No)throw new ci("Invalid color format "+dn);y=No.toNumber32Bit();break}case"font-weight":{ZGo(dn)>=400?S=!0:S=!1;break}case"opacity":{w=eqo(dn);break}case"text-decoration":case"text-decoration-line":{dn==="line-through"&&(x=!0);break}case"text-decoration-thickness":{let No=dn.match(/^(\d+(?:\.\d+)?)px$/);No&&(E=parseFloat(No[1]));break}case"text-decoration-color":{let No=dn,_i=dn.match(/^var\((--[^,]+),\s*(?:initial|inherit)\)$/);_i&&(No=Pc.decorationCssRuleExtractor.resolveCssVariable(this._viewGpuContext.canvas.domNode,_i[1]));let ln=Ue.Format.CSS.parse(No);ln&&(M=ln.toNumber32Bit());break}case"text-decoration-style":break;default:throw new ci("Unexpected inline decoration style")}}}if(o===" "||o==="	"){if(g=((s-1)*a.maxSupportedColumns+l)*6,ae.fill(0,g,g+6),o==="	"){let Oi=l+p;p=Ll.nextRenderTabStop(l+p,N.tabSize),c+=r*(p-Oi),p-=l+1}else c+=r;continue}let tt=Pc.decorationStyleCache.getOrCreateEntry(y,S,w,x,E,M);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,o,b,tt,c),u=Math.round(e.relativeVerticalOffset[s-e.startLineNumber]*J+Math.floor((e.lineHeight*J-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),g=((s-1)*a.maxSupportedColumns+l)*6,ae[g+0]=Math.floor(c),ae[g+1]=u,ae[g+4]=h.glyphIndex,ae[g+5]=h.pageIndex,c+=r}f=v}H=((s-1)*a.maxSupportedColumns+v)*6,K=s*a.maxSupportedColumns*6,ae.fill(0,H,K),Se.add(s)}}let Ee=(e.endLineNumber-e.startLineNumber+1)*ce;return Re=Math.min(Re,a.maxSupportedLines),xe=Math.min(xe,a.maxSupportedLines),Re<=xe&&this._device.queue.writeBuffer(this._cellBindBuffer,(Re-1)*ce*Float32Array.BYTES_PER_ELEMENT,ae.buffer,(Re-1)*ce*Float32Array.BYTES_PER_ELEMENT,(xe-Re+1)*ce*Float32Array.BYTES_PER_ELEMENT),this._finalRenderedLine=Math.max(this._finalRenderedLine,xe),this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=Ee,Ee}draw(e,t){if(this._visibleObjectCount<=0)throw new ci("Attempt to draw 0 objects");e.draw(VB.length/2,this._visibleObjectCount,void 0,(t.startLineNumber-1)*a.maxSupportedColumns)}_queueBufferUpdate(e){this._queuedBufferUpdates[0].push(e),this._queuedBufferUpdates[1].push(e)}};function ZGo(a){switch(a){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(a)}function eqo(a){return a.endsWith("%")?parseFloat(a.substring(0,a.length-1))/100:a.match(/^\d+(?:\.\d*)/)?parseFloat(a):1}var _xe=class extends np{constructor(e,t,o,n){super(e);this._viewGpuContext=t;this._instantiationService=o;this._logService=n;this._maxLineWidth=0;this._atlasGpuTextureVersions=[];this._initialized=!1;this._glyphRasterizer=this._register(new ue);this._renderStrategy=this._register(new ue);this.canvas=this._viewGpuContext.canvas.domNode,this._register(ve(r=>{this._viewGpuContext.canvasDevicePixelDimensions.read(r);let s=this._lastViewportData;s&&setTimeout(()=>{s===this._lastViewportData&&this.renderText(s)})})),this.initWebgpu()}async initWebgpu(){if(this._device=Pc.deviceSync||await Pc.device,this._store.isDisposed)return;let e=Pc.atlas;this._register(e.onDidDeleteGlyphs(()=>{this._atlasGpuTextureVersions.length=0,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._renderStrategy.value.reset()}));let t=navigator.gpu.getPreferredCanvasFormat();this._viewGpuContext.ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco render pass",colorAttachments:[this._renderPassColorAttachment]};let o;{let c;(x=>(x[x.FloatsPerEntry=6]="FloatsPerEntry",x[x.BytesPerEntry=24]="BytesPerEntry",x[x.Offset_CanvasWidth____=0]="Offset_CanvasWidth____",x[x.Offset_CanvasHeight___=1]="Offset_CanvasHeight___",x[x.Offset_ViewportOffsetX=2]="Offset_ViewportOffsetX",x[x.Offset_ViewportOffsetY=3]="Offset_ViewportOffsetY",x[x.Offset_ViewportWidth__=4]="Offset_ViewportWidth__",x[x.Offset_ViewportHeight_=5]="Offset_ViewportHeight_"))(c||={});let u=new Float32Array(6),p=(h=this.canvas.width,g=this.canvas.height)=>(u[0]=h,u[1]=g,u[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*zi().devicePixelRatio),u[3]=0,u[4]=u[0]-u[2],u[5]=u[1]-u[3],u);o=this._register(By.createBuffer(this._device,{label:"Monaco uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>p())).object,this._register(Zs(this._viewGpuContext.canvasDevicePixelDimensions,({width:h,height:g})=>{this._device.queue.writeBuffer(o,0,p(h,g))})),this._register(Zs(this._viewGpuContext.contentLeft,()=>{this._device.queue.writeBuffer(o,0,p())}))}let n;{let c;(f=>(f[f.FloatsPerEntry=2]="FloatsPerEntry",f[f.BytesPerEntry=8]="BytesPerEntry",f[f.Offset_Width_=0]="Offset_Width_",f[f.Offset_Height=1]="Offset_Height"))(c||={}),n=this._register(By.createBuffer(this._device,{label:"Monaco atlas info uniform buffer",size:8,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>{let u=new Float32Array(2);return u[0]=e.pageSize,u[1]=e.pageSize,u})).object}let r=this._context.configuration.options.get(58),s=this._context.configuration.options.get(61);this._glyphRasterizer.value=this._register(new uK(s,r,this._viewGpuContext.devicePixelRatio.get(),Pc.decorationStyleCache)),this._register(Zs(this._viewGpuContext.devicePixelRatio,()=>{this._refreshGlyphRasterizer()})),this._renderStrategy.value=this._instantiationService.createInstance(xX,this._context,this._viewGpuContext,this._device,this._glyphRasterizer),this._glyphStorageBuffer=this._register(By.createBuffer(this._device,{label:"Monaco glyph storage buffer",size:kT.maximumPageCount*(bx.maximumGlyphCount*24),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._atlasGpuTexture=this._register(By.createTexture(this._device,{label:"Monaco atlas texture",format:"rgba8unorm",size:{width:e.pageSize,height:e.pageSize,depthOrArrayLayers:kT.maximumPageCount},dimension:"2d",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT})).object,this._updateAtlasStorageBufferAndTexture(),this._vertexBuffer=this._register(By.createBuffer(this._device,{label:"Monaco vertex buffer",size:VB.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},VB)).object;let l=this._device.createShaderModule({label:"Monaco shader module",code:this._renderStrategy.value.wgsl});if(this._pipeline=this._device.createRenderPipeline({label:"Monaco render pipeline",layout:"auto",vertex:{module:l,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:l,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._rebuildBindGroup=()=>{this._bindGroup=this._device.createBindGroup({label:"Monaco bind group",layout:this._pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._glyphStorageBuffer}},{binding:2,resource:this._device.createSampler({label:"Monaco atlas sampler",magFilter:"nearest",minFilter:"nearest"})},{binding:3,resource:this._atlasGpuTexture.createView()},{binding:4,resource:{buffer:o}},{binding:5,resource:{buffer:n}},...this._renderStrategy.value.bindGroupEntries]})},this._rebuildBindGroup(),this._initialized=!0,this._initViewportData){for(let c of this._initViewportData)this.renderText(c);this._initViewportData=void 0}}_refreshRenderStrategy(e){if(this._renderStrategy.value?.type==="viewport"||e.endLineNumber<xX.maxSupportedLines&&this._viewportMaxColumn(e)<xX.maxSupportedColumns)return;this._logService.trace(`File is larger than ${xX.maxSupportedLines} lines or ${xX.maxSupportedColumns} columns, switching to viewport render strategy`);let t=this._instantiationService.createInstance(cCt,this._context,this._viewGpuContext,this._device,this._glyphRasterizer);this._renderStrategy.value=t,this._register(t.onDidChangeBindGroupEntries(()=>this._rebuildBindGroup?.())),this._rebuildBindGroup?.()}_viewportMaxColumn(e){let t=0,o;for(let n=e.startLineNumber;n<=e.endLineNumber;n++)o=e.getViewLineRenderingData(n),t=Math.max(t,o.maxColumn);return t}_updateAtlasStorageBufferAndTexture(){for(let[e,t]of Pc.atlas.pages.entries()){if(e>=kT.maximumPageCount){console.log(`Attempt to upload atlas page [${e}], only ${kT.maximumPageCount} are supported currently`);continue}if(t.version===this._atlasGpuTextureVersions[e])continue;this._logService.trace("Updating atlas page[",e,"] from version ",this._atlasGpuTextureVersions[e]," to version ",t.version);let o=6*bx.maximumGlyphCount,n=new Float32Array(o),r=0;for(let s of t.glyphs)n[r+0]=s.x,n[r+0+1]=s.y,n[r+2]=s.w,n[r+2+1]=s.h,n[r+4]=s.originOffsetX,n[r+4+1]=s.originOffsetY,r+=6;if(r/6>bx.maximumGlyphCount)throw new Error(`Attempting to write more glyphs (${r/6}) than the GPUBuffer can hold (${bx.maximumGlyphCount})`);this._device.queue.writeBuffer(this._glyphStorageBuffer,e*6*bx.maximumGlyphCount*Float32Array.BYTES_PER_ELEMENT,n,0,6*bx.maximumGlyphCount),t.usedArea.right-t.usedArea.left>0&&t.usedArea.bottom-t.usedArea.top>0&&this._device.queue.copyExternalImageToTexture({source:t.source},{texture:this._atlasGpuTexture,origin:{x:t.usedArea.left,y:t.usedArea.top,z:e}},{width:t.usedArea.right-t.usedArea.left+1,height:t.usedArea.bottom-t.usedArea.top+1}),this._atlasGpuTextureVersions[e]=t.version}}prepareRender(e){throw new ci("Should not be called")}render(e){throw new ci("Should not be called")}onConfigurationChanged(e){return this._refreshGlyphRasterizer(),this._maxLineWidth=0,!0}onCursorStateChanged(e){return!0}onDecorationsChanged(e){return!0}onFlushed(e){return this._maxLineWidth=0,!0}onLinesChanged(e){return!0}onLinesDeleted(e){return this._maxLineWidth=0,!0}onLinesInserted(e){return!0}onLineMappingChanged(e){return!0}onRevealRangeRequest(e){return!0}onScrollChanged(e){return!0}onThemeChanged(e){return!0}onZonesChanged(e){return!0}_refreshGlyphRasterizer(){let e=this._glyphRasterizer.value;if(!e)return;let t=this._context.configuration.options.get(58),o=this._context.configuration.options.get(61),n=this._viewGpuContext.devicePixelRatio.get();(e.fontFamily!==t||e.fontSize!==o||e.devicePixelRatio!==n)&&(this._glyphRasterizer.value=new uK(o,t,n,Pc.decorationStyleCache))}renderText(e){if(this._initialized)return this._refreshRenderStrategy(e),this._renderText(e);this._initViewportData=this._initViewportData??[],this._initViewportData.push(e)}_renderText(e){this._viewGpuContext.rectangleRenderer.draw(e);let t=new z5(this._context.configuration,this._context.theme.type);this._renderStrategy.value.update(e,t),this._updateAtlasStorageBufferAndTexture();let o=this._device.createCommandEncoder({label:"Monaco command encoder"});this._renderPassColorAttachment.view=this._viewGpuContext.ctx.getCurrentTexture().createView({label:"Monaco canvas texture view"});let n=o.beginRenderPass(this._renderPassDescriptor);n.setPipeline(this._pipeline),n.setVertexBuffer(0,this._vertexBuffer);let r=Math.ceil(this._viewGpuContext.contentLeft.get()*this._viewGpuContext.devicePixelRatio.get());n.setScissorRect(r,0,this.canvas.width-r,this.canvas.height),n.setBindGroup(0,this._bindGroup),this._renderStrategy.value.draw(n,e),n.end();let s=o.finish();this._device.queue.submit([s]),this._lastViewportData=e,this._lastViewLineOptions=t,this._updateMaxLineWidth(e,t)}_updateMaxLineWidth(e,t){let o=zi().devicePixelRatio,n=0;for(let s=e.startLineNumber;s<=e.endLineNumber;s++){if(!this._viewGpuContext.canRender(t,e,s))continue;let l=e.getViewLineRenderingData(s),c=this._computeLineWidth(l,t,o);n=Math.max(n,c)}let r=Math.ceil(n);r>this._maxLineWidth&&(this._maxLineWidth=r,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeLineWidth(e,t,o){let n=e.content,r;e.isBasicASCII&&t.useMonospaceOptimizations||(r=CX(e,t));let s=0,l=0;for(let c=0;c<n.length;c++){let u;if(e.isBasicASCII&&t.useMonospaceOptimizations)u=n.charAt(c);else{let p=r.getSegmentAtIndex(c);if(p===void 0)continue;u=p}if(u==="	"){let p=c+l;l=Ll.nextRenderTabStop(c+l,e.tabSize),s+=t.spaceWidth*(l-p),l-=c+1}else e.isBasicASCII&&t.useMonospaceOptimizations?s+=t.spaceWidth:s+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/o}return s}linesVisibleRangesForRange(e,t){if(!this._lastViewportData)return null;let o=e.endLineNumber,n=G.intersectRanges(e,this._lastViewportData.visibleRange);if(!n)return null;let r=this._lastViewportData.startLineNumber,s=this._lastViewportData.endLineNumber,l=this._lastViewportData,c=this._lastViewLineOptions;if(!l||!c)return null;let u=[],p=0;t&&(p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(n.startLineNumber,1)).lineNumber);for(let h=n.startLineNumber;h<=n.endLineNumber;h++){if(h<r||h>s)continue;let g=h===n.startLineNumber?n.startColumn:1,f=h!==o,v=f?this._context.viewModel.getLineMaxColumn(h):n.endColumn,b=this._visibleRangesForLineRange(h,g,v);if(b){if(t&&h<o){let S=p;p=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new ye(h+1,1)).lineNumber,S!==p&&(b.ranges[b.ranges.length-1].width+=c.spaceWidth)}u.push(new $Ce(b.outsideRenderedLine,h,pX.from(b.ranges),f))}}return u.length===0?null:u}_visibleRangesForLineRange(e,t,o){if(this.shouldRender())return null;let n=this._lastViewportData,r=this._lastViewLineOptions;if(!n||!r||e<n.startLineNumber||e>n.endLineNumber)return null;let s=n.getViewLineRenderingData(e),l=s.content,c;s.isBasicASCII&&r.useMonospaceOptimizations||(c=CX(s,r));let u="",p=0,h=0;for(let b=0;b<t-1;b++){if(s.isBasicASCII&&r.useMonospaceOptimizations)u=l.charAt(b);else{if(u=c.getSegmentAtIndex(b),u===void 0)continue;h+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/zi().devicePixelRatio-r.spaceWidth}u==="	"?p=Ll.nextRenderTabStop(p,s.tabSize):p++}let g=p,f=0;for(let b=t-1;b<o-1;b++){if(s.isBasicASCII&&r.useMonospaceOptimizations)u=l.charAt(b);else{if(u=c.getSegmentAtIndex(b),u===void 0)continue;f+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(u).width/zi().devicePixelRatio-r.spaceWidth}u==="	"?g=Ll.nextRenderTabStop(g,s.tabSize):g++}return new $ce(!1,[new _A(p*r.spaceWidth+h,(g-p)*r.spaceWidth+f)])}visibleRangeForPosition(e){let t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new jCe(t.outsideRenderedLine,t.ranges[0].left):null}getLineWidth(e){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;let t=this._lastViewportData.getViewLineRenderingData(e),n=this._visibleRangesForLineRange(e,1,t.maxColumn)?.ranges.at(-1);if(n)return n.left+n.width}getPositionAtCoordinate(e,t){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;let o=this._lastViewportData.getViewLineRenderingData(e),n=o.content,r=zi().devicePixelRatio,s=t*r,l=this._lastViewLineOptions.spaceWidth*r,c=CX(o,this._lastViewLineOptions),u=0,p=0,h=0,g=0;for(let f=0;f<n.length;f++){let v=c.getSegmentAtIndex(f);if(v===void 0){g++;continue}if(v==="	"){let b=f+h;h=Ll.nextRenderTabStop(f+h,o.tabSize),p=l*(h-b),h-=f+1}else o.isBasicASCII&&this._lastViewLineOptions.useMonospaceOptimizations?p=l:p=this._renderStrategy.value.glyphRasterizer.getTextMetrics(v).width;if(s<u+p/2)break;u+=p,g++}return new ye(e,g+1)}};_xe=I([m(2,F),m(3,re)],_xe);var _ai=class{constructor(){this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._enabled=!0}get enabled(){return this._enabled}enable(){this._enabled=!0,this._onDidChange.fire()}disable(){this._enabled=!1,this._onDidChange.fire()}},xD=new _ai;var Le=le("keybindingService");var Dxe=class extends np{constructor(){super(...arguments);this._onWillCopy=this._register(new T);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new T);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new T);this.onWillPaste=this._onWillPaste.event}};var Rxe=class{_getPageOfLine(i,e){return Math.floor((i-1)/e)}_getRangeForPage(i,e){let t=i*e,o=t+1,n=t+e;return new G(o,1,n+1,1)}fromEditorSelection(i,e,t,o){let r=this._getPageOfLine(e.startLineNumber,t),s=this._getRangeForPage(r,t),l=this._getPageOfLine(e.endLineNumber,t),c=this._getRangeForPage(l,t),u=s.intersectRanges(new G(1,1,e.startLineNumber,e.startColumn));if(o&&i.getValueLengthInRange(u,1)>500){let w=i.modifyPosition(u.getEndPosition(),-500);u=G.fromPositions(w,u.getEndPosition())}let p=i.getValueInRange(u,1),h=i.getLineCount(),g=i.getLineMaxColumn(h),f=c.intersectRanges(new G(e.endLineNumber,e.endColumn,h,g));if(o&&i.getValueLengthInRange(f,1)>500){let w=i.modifyPosition(f.getStartPosition(),500);f=G.fromPositions(f.getStartPosition(),w)}let v=i.getValueInRange(f,1),b;if(r===l||r+1===l)b=i.getValueInRange(e,1);else{let w=s.intersectRanges(e),x=c.intersectRanges(e);b=i.getValueInRange(w,1)+"\u2026"+i.getValueInRange(x,1)}o&&b.length>2*500&&(b=b.substring(0,500)+"\u2026"+b.substring(b.length-500,b.length));let S,y;return e.getDirection()===0?(S=p.length,y=p.length+b.length):(y=p.length,S=p.length+b.length),{value:p+b+v,selection:e,selectionStart:S,selectionEnd:y,startPositionWithinEditor:u.getStartPosition(),newlineCountBeforeSelection:u.endLineNumber-u.startLineNumber}}};function i8e(a,i){if(a.get(2)===1){let t=i.lookupKeybinding("editor.action.toggleScreenReaderAccessibilityMode")?.getAriaLabel(),o=i.lookupKeybinding("workbench.action.showCommands")?.getAriaLabel(),n=i.lookupKeybinding("workbench.action.openGlobalKeybindings")?.getAriaLabel(),r=d(176,null);return t?d(177,null,r,t):o?d(178,null,r,o):n?d(179,null,r,n):r}return a.get(8)}function Dai(a){let i=0,e=-1;do{if(e=a.indexOf(`
`,e+1),e===-1)break;i++}while(!0);return i}var Rai=class{constructor(){this._textAreaEditContextMapping=new Map}register(i,e){return this._textAreaEditContextMapping.set(i,e),{dispose:()=>{this._textAreaEditContextMapping.delete(i)}}}get(i){return this._textAreaEditContextMapping.get(i)}},dCt=new Rai;var Mai=class{constructor(i,e,t,o,n){this._context=i;this.modelLineNumber=e;this.distanceToModelLineStart=t;this.widthOfHiddenLineTextBefore=o;this.distanceToModelLineEnd=n;this._visibleTextAreaBrand=void 0;this.startPosition=null;this.endPosition=null;this.visibleTextareaStart=null;this.visibleTextareaEnd=null;this._previousPresentation=null}prepareRender(i){let e=new ye(this.modelLineNumber,this.distanceToModelLineStart+1),t=new ye(this.modelLineNumber,this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber)-this.distanceToModelLineEnd);this.startPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(e),this.endPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t),this.startPosition.lineNumber===this.endPosition.lineNumber?(this.visibleTextareaStart=i.visibleRangeForPosition(this.startPosition),this.visibleTextareaEnd=i.visibleRangeForPosition(this.endPosition)):(this.visibleTextareaStart=null,this.visibleTextareaEnd=null)}definePresentation(i){return this._previousPresentation||(i?this._previousPresentation=i:this._previousPresentation={foreground:1,italic:!1,bold:!1,underline:!1,strikethrough:!1}),this._previousPresentation}},Lai=ed,Lxe=class extends Dxe{constructor(e,t,o,n,r,s,l){super(t);this._keybindingService=s;this._instantiationService=l;this._primaryCursorPosition=new ye(1,1);this._primaryCursorVisibleRange=null;this._viewController=n,this._visibleRangeProvider=r,this._scrollLeft=0,this._scrollTop=0;let c=this._context.configuration.options,u=c.get(165);this._setAccessibilityOptions(c),this._contentLeft=u.contentLeft,this._contentWidth=u.contentWidth,this._contentHeight=u.height,this._fontInfo=c.get(59),this._emptySelectionClipboard=c.get(45),this._visibleTextArea=null,this._selections=[new ei(1,1,1,1)],this._modelSelections=[new ei(1,1,1,1)],this._lastRenderPosition=null,this.textArea=Ir(document.createElement("textarea")),MI.write(this.textArea,7),this.textArea.setClassName(`inputarea ${xT}`),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");let{tabSize:p}=this._context.viewModel.model.getOptions();this.textArea.domNode.style.tabSize=`${p*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("autocorrect","off"),this.textArea.setAttribute("autocapitalize","off"),this.textArea.setAttribute("autocomplete","off"),this.textArea.setAttribute("spellcheck","false"),this.textArea.setAttribute("aria-label",i8e(c,this._keybindingService)),this.textArea.setAttribute("aria-required",c.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(c.get(140))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",d(180,null)),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-autocomplete",c.get(104)?"none":"both"),this._ensureReadOnlyAttribute(),this.textAreaCover=Ir(document.createElement("div")),this.textAreaCover.setPosition("absolute"),o.appendChild(this.textArea),o.appendChild(this.textAreaCover);let h=new Rxe,g={context:this._context,getScreenReaderContent:()=>{if(this._accessibilitySupport===1){let b=this._selections[0];if(et&&b.isEmpty()){let y=b.getStartPosition(),w=this._getWordBeforePosition(y);if(w.length===0&&(w=this._getCharacterBeforePosition(y)),w.length>0)return new AI(w,w.length,w.length,G.fromPositions(y),0)}if(et&&!b.isEmpty()&&this._context.viewModel.getValueLengthInRange(b,0)<500){let y=this._context.viewModel.getValueInRange(b,0);return new AI(y,0,y.length,b,0)}if(_S&&!b.isEmpty()){let y="vscode-placeholder";return new AI(y,0,y.length,null,void 0)}return AI.EMPTY}if(fii){let b=this._selections[0];if(b.isEmpty()){let S=b.getStartPosition(),[y,w]=this._getAndroidWordAtPosition(S);if(y.length>0)return new AI(y,w,w,G.fromPositions(S),0)}return AI.EMPTY}let v=h.fromEditorSelection(this._context.viewModel,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0);return AI.fromScreenReaderContentState(v)},deduceModelPosition:(v,b,S)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(v,b,S)},f=this._register(new Qyt(this.textArea.domNode));this._textAreaInput=this._register(this._instantiationService.createInstance(mxe,g,f,Ao,{isAndroid:fii,isChrome:Iz,isFirefox:ed,isSafari:_S})),this._register(this._textAreaInput.onWillCopy(v=>this._onWillCopy.fire(v))),this._register(this._textAreaInput.onWillCut(v=>this._onWillCut.fire(v))),this._register(this._textAreaInput.onWillPaste(v=>this._onWillPaste.fire(v))),this._register(this._textAreaInput.onKeyDown(v=>{this._viewController.emitKeyDown(v)})),this._register(this._textAreaInput.onKeyUp(v=>{this._viewController.emitKeyUp(v)})),this._register(this._textAreaInput.onPaste(v=>{let b=!1,S=null,y=null;v.metadata&&(b=this._emptySelectionClipboard&&!!v.metadata.isFromEmptySelection,S=typeof v.metadata.multicursorText<"u"?v.metadata.multicursorText:null,y=v.metadata.mode),this._viewController.paste(v.text,b,S,y)})),this._register(this._textAreaInput.onCut(()=>{this._viewController.cut()})),this._register(this._textAreaInput.onType(v=>{v.replacePrevCharCnt||v.replaceNextCharCnt||v.positionDelta?(CD&&console.log(` => compositionType: <<${v.text}>>, ${v.replacePrevCharCnt}, ${v.replaceNextCharCnt}, ${v.positionDelta}`),this._viewController.compositionType(v.text,v.replacePrevCharCnt,v.replaceNextCharCnt,v.positionDelta)):(CD&&console.log(` => type: <<${v.text}>>`),this._viewController.type(v.text))})),this._register(this._textAreaInput.onSelectionChangeRequest(v=>{this._viewController.setSelection(v)})),this._register(this._textAreaInput.onCompositionStart(v=>{let b=this.textArea.domNode,S=this._modelSelections[0],{distanceToModelLineStart:y,widthOfHiddenTextBefore:w}=(()=>{let E=b.value.substring(0,Math.min(b.selectionStart,b.selectionEnd)),M=E.lastIndexOf(`
`),N=E.substring(M+1),V=N.lastIndexOf("	"),H=N.length-V-1,K=S.getStartPosition(),j=Math.min(K.column-1,H),J=K.column-1-j,se=N.substring(0,N.length-j),{tabSize:ae}=this._context.viewModel.model.getOptions(),ce=tqo(this.textArea.domNode.ownerDocument,se,this._fontInfo,ae);return{distanceToModelLineStart:J,widthOfHiddenTextBefore:ce}})(),{distanceToModelLineEnd:x}=(()=>{let E=b.value.substring(Math.max(b.selectionStart,b.selectionEnd)),M=E.indexOf(`
`),N=M===-1?E:E.substring(0,M),V=N.indexOf("	"),H=V===-1?N.length:N.length-V-1,K=S.getEndPosition(),j=Math.min(this._context.viewModel.model.getLineMaxColumn(K.lineNumber)-K.column,H);return{distanceToModelLineEnd:this._context.viewModel.model.getLineMaxColumn(K.lineNumber)-K.column-j}})();this._context.viewModel.revealRange("keyboard",!0,G.fromPositions(this._selections[0].getStartPosition()),0,1),this._visibleTextArea=new Mai(this._context,S.startLineNumber,y,w,x),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render(),this.textArea.setClassName(`inputarea ${xT} ime-input`),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(this._textAreaInput.onCompositionUpdate(v=>{this._visibleTextArea&&(this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render())})),this._register(this._textAreaInput.onCompositionEnd(()=>{this._visibleTextArea=null,this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._render(),this.textArea.setClassName(`inputarea ${xT}`),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()})),this._register(this._textAreaInput.onFocus(()=>{this._context.viewModel.setHasFocus(!0)})),this._register(this._textAreaInput.onBlur(()=>{this._context.viewModel.setHasFocus(!1)})),this._register(xD.onDidChange(()=>{this._ensureReadOnlyAttribute()})),this._register(dCt.register(e,this))}get domNode(){return this.textArea}writeScreenReaderContent(e){this._textAreaInput.writeNativeTextAreaContent(e)}getTextAreaDomNode(){return this.textArea.domNode}dispose(){super.dispose(),this.textArea.domNode.remove(),this.textAreaCover.domNode.remove()}_getAndroidWordAtPosition(e){let t='`~!@#$%^&*()-=+[{]}\\|;:",.<>/?',o=this._context.viewModel.getLineContent(e.lineNumber),n=mx(t,[]),r=!0,s=e.column,l=!0,c=e.column,u=0;for(;u<50&&(r||l);){if(r&&s<=1&&(r=!1),r){let p=o.charCodeAt(s-2);n.get(p)!==0?r=!1:s--}if(l&&c>o.length&&(l=!1),l){let p=o.charCodeAt(c-1);n.get(p)!==0?l=!1:c++}u++}return[o.substring(s-1,c-1),e.column-s]}_getWordBeforePosition(e){let t=this._context.viewModel.getLineContent(e.lineNumber),o=mx(this._context.configuration.options.get(148),[]),n=e.column,r=0;for(;n>1;){let s=t.charCodeAt(n-2);if(o.get(s)!==0||r>50)return t.substring(n-1,e.column-1);r++,n--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){let o=this._context.viewModel.getLineContent(e.lineNumber).charAt(e.column-2);if(!Ip(o.charCodeAt(0)))return o}return""}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);let t=e.get(3);this._accessibilitySupport===2&&t===PS.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t;let n=e.get(165).wrappingColumn;if(n!==-1&&this._accessibilitySupport!==1){let r=e.get(59);this._textAreaWrapping=!0,this._textAreaWidth=Math.round(n*r.typicalHalfwidthCharacterWidth)}else this._textAreaWrapping=!1,this._textAreaWidth=Lai?0:1}onConfigurationChanged(e){let t=this._context.configuration.options,o=t.get(165);this._setAccessibilityOptions(t),this._contentLeft=o.contentLeft,this._contentWidth=o.contentWidth,this._contentHeight=o.height,this._fontInfo=t.get(59),this._emptySelectionClipboard=t.get(45),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");let{tabSize:n}=this._context.viewModel.model.getOptions();return this.textArea.domNode.style.tabSize=`${n*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("aria-label",i8e(t,this._keybindingService)),this.textArea.setAttribute("aria-required",t.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(t.get(140))),(e.hasChanged(41)||e.hasChanged(104))&&this._ensureReadOnlyAttribute(),e.hasChanged(2)&&this._textAreaInput.writeNativeTextAreaContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeNativeTextAreaContent("selection changed"),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}isFocused(){return this._textAreaInput.isFocused()}focus(){this._textAreaInput.focusTextArea()}refreshFocusState(){this._textAreaInput.refreshFocusState()}getLastRenderData(){return this._lastRenderPosition}setAriaOptions(e){e.activeDescendant?(this.textArea.setAttribute("aria-haspopup","true"),this.textArea.setAttribute("aria-autocomplete","list"),this.textArea.setAttribute("aria-activedescendant",e.activeDescendant)):(this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),this.textArea.removeAttribute("aria-activedescendant")),e.role&&this.textArea.setAttribute("role",e.role)}_ensureReadOnlyAttribute(){let e=this._context.configuration.options;!xD.enabled||e.get(41)&&e.get(104)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")}prepareRender(e){this._primaryCursorPosition=new ye(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition),this._visibleTextArea?.prepareRender(e)}render(e){this._textAreaInput.writeNativeTextAreaContent("render"),this._render()}_render(){if(this._visibleTextArea){let o=this._visibleTextArea.visibleTextareaStart,n=this._visibleTextArea.visibleTextareaEnd,r=this._visibleTextArea.startPosition,s=this._visibleTextArea.endPosition;if(r&&s&&o&&n&&n.left>=this._scrollLeft&&o.left<=this._scrollLeft+this._contentWidth){let l=this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber)-this._scrollTop,c=Dai(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart)),u=this._visibleTextArea.widthOfHiddenLineTextBefore,p=this._contentLeft+o.left-this._scrollLeft,h=n.left-o.left+1;if(p<this._contentLeft){let x=this._contentLeft-p;p+=x,u+=x,h-=x}h>this._contentWidth&&(h=this._contentWidth);let g=this._context.viewLayout.getLineHeightForLineNumber(r.lineNumber),f=this._context.viewModel.getFontSizeAtPosition(this._primaryCursorPosition),v=this._context.viewModel.getViewLineData(r.lineNumber),b=v.tokens.findTokenIndexAtOffset(r.column-1),S=v.tokens.findTokenIndexAtOffset(s.column-1),y=b===S,w=this._visibleTextArea.definePresentation(y?v.tokens.getPresentation(b):null);this.textArea.domNode.scrollTop=c*g,this.textArea.domNode.scrollLeft=u,this._doRender({lastRenderPosition:null,top:l,left:p,width:h,height:g,useCover:!1,color:(vc.getColorMap()||[])[w.foreground],italic:w.italic,bold:w.bold,underline:w.underline,strikethrough:w.strikethrough,fontSize:f})}return}if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}let e=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(e<this._contentLeft||e>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}let t=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(t<0||t>this._contentHeight){this._renderAtTopLeft();return}if(et||this._accessibilitySupport===2){let o=this._primaryCursorPosition.lineNumber,n=this._context.viewLayout.getLineHeightForLineNumber(o);this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:n,useCover:!1}),this.textArea.domNode.scrollLeft=this._primaryCursorVisibleRange.left;let r=this._textAreaInput.textAreaState.newlineCountBeforeSelection??Dai(this.textArea.domNode.value.substring(0,this.textArea.domNode.selectionStart));this.textArea.domNode.scrollTop=r*n;return}this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:Lai?0:1,useCover:!1})}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:this._textAreaWidth,height:Lai?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;let t=this.textArea,o=this.textAreaCover;ku(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setLineHeight(e.height),t.setFontSize(e.fontSize??this._fontInfo.fontSize),t.setColor(e.color?Ue.Format.CSS.formatHex(e.color):""),t.setFontStyle(e.italic?"italic":""),e.bold&&t.setFontWeight("bold"),t.setTextDecoration(`${e.underline?" underline":""}${e.strikethrough?" line-through":""}`),o.setTop(e.useCover?e.top:0),o.setLeft(e.useCover?e.left:0),o.setWidth(e.useCover?e.width:0),o.setHeight(e.useCover?e.height:0);let n=this._context.configuration.options;n.get(66)?o.setClassName("monaco-editor-background textAreaCover "+xxe.OUTER_CLASS_NAME):n.get(76).renderType!==0?o.setClassName("monaco-editor-background textAreaCover "+wxe.CLASS_NAME):o.setClassName("monaco-editor-background textAreaCover")}};Lxe=I([m(5,Le),m(6,F)],Lxe);function tqo(a,i,e,t){if(i.length===0)return 0;let o=a.createElement("div");o.style.position="absolute",o.style.top="-50000px",o.style.width="50000px";let n=a.createElement("span");ku(n,e),n.style.whiteSpace="pre",n.style.tabSize=`${t*e.spaceWidth}px`,n.append(i),o.appendChild(n),a.body.appendChild(o);let r=n.offsetWidth;return o.remove(),r}var Mxe=class extends k{constructor(e,t,o){super();this._domNode=t;this._onFocusChange=o;this._isFocused=!1;this._isPaused=!1;this._register($(this._domNode,"focus",()=>{e.trace("NativeEditContext.focus"),!this._isPaused&&this.refreshFocusState()})),this._register($(this._domNode,"blur",()=>{e.trace("NativeEditContext.blur"),!this._isPaused&&this._handleFocusedChanged(!1)}))}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this.refreshFocusState()}_handleFocusedChanged(e){this._isFocused!==e&&(this._isFocused=e,this._onFocusChange(this._isFocused))}focus(){this._domNode.focus(),this.refreshFocusState()}refreshFocusState(){let e=IA(this._domNode),t=e?e.activeElement:Un(),o=this._domNode===t;this._handleFocusedChanged(o)}get isFocused(){return this._isFocused}};Mxe=I([m(0,re)],Mxe);function Pxe(a,i,e,t){return a.addEventListener(i,e,t),{dispose(){a.removeEventListener(i,e)}}}var iqo=zf("richScreenReaderContent",{createHTML:a=>a}),Pai="data-line-number",Axe=class extends k{constructor(e,t,o,n){super();this._domNode=e;this._context=t;this._viewController=o;this._accessibilityService=n;this._selectionChangeListener=this._register(new ue);this._accessibilityPageSize=1;this._ignoreSelectionChangeTime=0;this._state=o8e.NULL;this._strategy=new Oai;this._renderedLines=new Map;this._renderedSelection=new ei(1,1,1,1);this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){let t=zi().document.activeElement;if(!t||t!==this._domNode.domNode)return;if(this._accessibilityService.isScreenReaderOptimized()){let n=this._getScreenReaderContentLineIntervals(e);this._state.equals(n)||(this._state=n,this._renderedLines=this._renderScreenReaderContent(n)),this._renderedSelection.equalsSelection(e)||(this._renderedSelection=e,this._setSelectionOnScreenReaderContent(this._context,this._renderedLines,e))}else this._state=o8e.NULL,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){let t=this._state.intervals;if(!t.length)return;let o=this._context.viewModel.viewLayout,n=t[0].startLine,r=o.getVerticalOffsetForLineNumber(n),s=o.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=s-r}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return $(this._domNode.domNode.ownerDocument,"selectionchange",()=>{if(!(zi().document.activeElement===this._domNode.domNode)||!this._accessibilityService.isScreenReaderOptimized()||!xD.enabled)return;let r=Date.now(),s=r-e;if(e=r,s<5)return;let l=r-this._ignoreSelectionChangeTime;if(this._ignoreSelectionChangeTime=0,l<100)return;let c=this._getEditorSelectionFromDomRange();c&&this._viewController.setSelection(c)})}_renderScreenReaderContent(e){let t=[],o=new Map;for(let n of e.intervals)for(let r=n.startLine;r<=n.endLine;r++){let s=this._renderLine(r);o.set(r,s),t.push(s.domNode)}return this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.replaceChildren(...t),o}_renderLine(e){let t=this._context.viewModel,o=t.getViewLineRenderingData(e),n=this._context.configuration.options,r=n.get(59),s=n.get(133),l=n.get(108),c=n.get(60),u=n.get(40),p=Wb.filter(o.inlineDecorations,e,o.minColumn,o.maxColumn),h=r.isMonospace&&!u,g=c!==Mk.OFF,f;n.get(47)==="off"?f=n.get(113):f="none";let b=new KL(h,r.canUseHalfwidthRightwardsArrow,o.content,o.continuesWithWrappedLine,o.isBasicASCII,o.containsRTL,o.minColumn-1,o.tokens,p,o.tabSize,o.startVisibleColumn,r.spaceWidth,r.middotWidth,r.wsmiddotWidth,s,f,l,g,null,null,0,!0),S=new EI(1e4),y=NB(b,S),w=S.build(),x=iqo?.createHTML(w)??w,E=t.viewLayout.getLineHeightForLineNumber(e)+"px",M=document.createElement("div");return M.innerHTML=x,M.style.lineHeight=E,M.style.height=E,M.setAttribute(Pai,e.toString()),new Aai(M,y.characterMapping)}_setSelectionOnScreenReaderContent(e,t,o){let r=zi().document.getSelection();if(!r)return;let s=o.startLineNumber,l=o.endLineNumber,c=t.get(s),u=t.get(l);if(!c||!u)return;let p=e.viewModel,h=p.model,g=p.coordinatesConverter,f=new G(s,1,s,o.selectionStartColumn),v=g.convertViewRangeToModelRange(f),b=h.getCharacterCountInRange(v),S=new G(l,1,l,o.positionColumn),y=g.convertViewRangeToModelRange(S),w=h.getCharacterCountInRange(y),x=c.characterMapping.getDomPosition(b),E=u.characterMapping.getDomPosition(w),M=c.domNode.firstChild,N=u.domNode.firstChild,V=M.childNodes,H=N.childNodes,K=V.item(x.partIndex),j=H.item(E.partIndex);!K.firstChild||!j.firstChild||(this._setIgnoreSelectionChangeTime("setRange"),r.setBaseAndExtent(K.firstChild,o.startColumn===1?0:x.charIndex+1,j.firstChild,o.endColumn===1?0:E.charIndex+1))}_getScreenReaderContentLineIntervals(e){return this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize)}_getEditorSelectionFromDomRange(){if(!this._renderedLines)return;let e=zi().document.getSelection();if(!e||e.rangeCount===0)return;let o=e.getRangeAt(0),n=o.startContainer,r=o.endContainer,s=n.parentElement,l=r.parentElement;if(!s||!go(s)||!l||!go(l))return;let c=s.parentElement?.parentElement,u=l.parentElement?.parentElement;if(!c||!u)return;let p=c.getAttribute(Pai),h=u.getAttribute(Pai);if(!p||!h)return;let g=parseInt(p),f=parseInt(h),v=this._renderedLines.get(g)?.characterMapping,b=this._renderedLines.get(f)?.characterMapping;if(!v||!b)return;let S=L5(v,s,o.startOffset),y=L5(b,l,o.endOffset);return e.direction==="forward"?new ei(g,S,f,y):new ei(f,y,g,S)}};Axe=I([m(3,Ai)],Axe);var Aai=class{constructor(i,e){this.domNode=i;this.characterMapping=e}},Nai=class{constructor(i,e){this.startLine=i;this.endLine=e}},o8e=class a{constructor(i,e){this.intervals=e;let t="";for(let o of e)for(let n=o.startLine;n<=o.endLine;n++)t+=i.getLineContent(n)+`
`;this.value=t}equals(i){return this.value===i.value}static get NULL(){let i={getLineContent:()=>"",getLineCount:()=>1,getLineMaxColumn:()=>1,getValueInRange:()=>"",getValueLengthInRange:()=>0,modifyPosition:(e,t)=>e};return new a(i,[])}},Oai=class{constructor(){}_getPageOfLine(i,e){return Math.floor((i-1)/e)}_getRangeForPage(i,e,t){let o=e*t,n=o+1,r=Math.min(o+t,i.getLineCount());return new Nai(n,r)}fromEditorSelection(i,e,t){let o=this._getPageOfLine(e.startLineNumber,t),n=this._getRangeForPage(i,o,t),r=this._getPageOfLine(e.endLineNumber,t),s=this._getRangeForPage(i,r,t),l=[{startLine:n.startLine,endLine:n.endLine}];return o+1<r&&l.push({startLine:s.startLine,endLine:s.endLine}),new o8e(i,l)}};var Nxe=class extends k{constructor(e,t,o,n){super();this._domNode=e;this._context=t;this._viewController=o;this._accessibilityService=n;this._selectionChangeListener=this._register(new ue);this._accessibilityPageSize=1;this._ignoreSelectionChangeTime=0;this._strategy=new Rxe;this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){let t=this._domNode.domNode,o=zi().document.activeElement;if(!o||o!==t)return;if(this._accessibilityService.isScreenReaderOptimized()){this._state=this._getScreenReaderContentState(e),t.textContent!==this._state.value&&(this._setIgnoreSelectionChangeTime("setValue"),t.textContent=this._state.value);let r=zi().document.getSelection();if(!r)return;let s=this._getScreenReaderRange(this._state.selectionStart,this._state.selectionEnd);if(!s)return;this._setIgnoreSelectionChangeTime("setRange"),r.setBaseAndExtent(s.anchorNode,s.anchorOffset,s.focusNode,s.focusOffset)}else this._state=void 0,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){if(!this._state)return;let t=this._context.viewModel.viewLayout,o=this._state.startPositionWithinEditor.lineNumber,n=t.getVerticalOffsetForLineNumber(o),r=t.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=r-n}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return $(this._domNode.domNode.ownerDocument,"selectionchange",()=>{let t=this._accessibilityService.isScreenReaderOptimized();if(!this._state||!t||!xD.enabled||!(zi().document.activeElement===this._domNode.domNode))return;let r=zi().document.getSelection();if(!r||r.rangeCount===0)return;let l=r.getRangeAt(0),c=Date.now(),u=c-e;if(e=c,u<5)return;let p=c-this._ignoreSelectionChangeTime;this._ignoreSelectionChangeTime=0,!(p<100)&&this._viewController.setSelection(this._getEditorSelectionFromDomRange(this._context,this._state,r.direction,l))})}_getScreenReaderContentState(e){let t=this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize,this._accessibilityService.getAccessibilitySupport()===0),o=this._context.viewModel.model.getPositionAt(1/0),n=t.value;return o.column===1&&e.getEndPosition().equals(o)&&(n+=`
`),t.value=n,t}_getScreenReaderRange(e,t){let o=this._domNode.domNode.firstChild;if(!o)return;let n=new globalThis.Range;return n.setStart(o,e),n.setEnd(o,t),{anchorNode:o,anchorOffset:e,focusNode:o,focusOffset:t}}_getEditorSelectionFromDomRange(e,t,o,n){let r=e.viewModel,s=r.model,c=r.coordinatesConverter.convertViewPositionToModelPosition(t.startPositionWithinEditor),u=s.getOffsetAt(c),p=n.startOffset+u,h=n.endOffset+u;if(s.getEndOfLineSequence()===1){let y=t.value,w=new TA(y),x=w.getPosition(n.startOffset),E=w.getPosition(n.endOffset);p+=x.lineNumber-1,h+=E.lineNumber-1}let f=s.getPositionAt(p),v=s.getPositionAt(h),b=o==="forward"?f:v,S=o==="forward"?v:f;return ei.fromPositions(b,S)}};Nxe=I([m(3,Ai)],Nxe);var Fxe=class extends k{constructor(e,t,o,n,r){super();this._domNode=e;this._context=t;this._viewController=o;this._keybindingService=n;this._accessibilityService=r;this._contentLeft=1;this._contentWidth=1;this._contentHeight=1;this._divWidth=1;this._primarySelection=new ei(1,1,1,1);this._primaryCursorVisibleRange=null;this._state=this._register(new ue),this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes()}onWillPaste(){this._state.value?.onWillPaste()}onWillCut(){this._state.value?.onWillCut()}handleFocusChange(e){this._state.value?.onFocusChange(e),this.writeScreenReaderContent()}onConfigurationChanged(e){this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes(),e.hasChanged(2)&&this.writeScreenReaderContent()}_instantiateScreenReaderContent(){let e=this._context.configuration.options.get(107);this._renderRichContent!==e&&(this._renderRichContent=e,this._state.value=this._createScreenReaderContent(e))}_createScreenReaderContent(e){return e?new Axe(this._domNode,this._context,this._viewController,this._accessibilityService):new Nxe(this._domNode,this._context,this._viewController,this._accessibilityService)}_updateConfigurationSettings(){let e=this._context.configuration.options,t=e.get(165),o=t.wrappingColumn;this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._contentHeight=t.height,this._fontInfo=e.get(59),this._divWidth=Math.round(o*this._fontInfo.typicalHalfwidthCharacterWidth),this._state.value?.onConfigurationChanged(e)}_updateDomAttributes(){let e=this._context.configuration.options;this._domNode.domNode.setAttribute("role","textbox"),this._domNode.domNode.setAttribute("aria-required",e.get(9)?"true":"false"),this._domNode.domNode.setAttribute("aria-multiline","true"),this._domNode.domNode.setAttribute("aria-autocomplete",e.get(104)?"none":"both"),this._domNode.domNode.setAttribute("aria-roledescription",d(175,null)),this._domNode.domNode.setAttribute("aria-label",i8e(e,this._keybindingService));let t=this._context.viewModel.model.getOptions().tabSize,o=e.get(59).spaceWidth;this._domNode.domNode.style.tabSize=`${t*o}px`;let n=e.get(154),r=n==="inherit"?e.get(153):n,s=r==="inherit"?e.get(149):r;this._domNode.domNode.style.textWrap=s==="off"?"nowrap":"wrap"}onCursorStateChanged(e){this._primarySelection=e.selections[0]??new ei(1,1,1,1)}prepareRender(e){this.writeScreenReaderContent(),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primarySelection.getPosition())}render(e){if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}let t=this._context.viewLayout.getCurrentScrollLeft(),o=this._contentLeft+this._primaryCursorVisibleRange.left-t;if(o<this._contentLeft||o>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}let n=this._context.viewLayout.getCurrentScrollTop(),r=this._primarySelection.positionLineNumber,s=this._context.viewLayout.getVerticalOffsetForLineNumber(r)-n;if(s<0||s>this._contentHeight){this._renderAtTopLeft();return}let l=this._context.viewLayout.getLineHeightForLineNumber(r);this._doRender(s,this._contentLeft,this._divWidth,l),this._state.value?.updateScrollTop(this._primarySelection)}_renderAtTopLeft(){this._doRender(0,0,this._contentWidth,1)}_doRender(e,t,o,n){ku(this._domNode,this._fontInfo),this._domNode.setTop(e),this._domNode.setLeft(t),this._domNode.setWidth(o),this._domNode.setHeight(n),this._domNode.setLineHeight(n)}setAriaOptions(e){e.activeDescendant?(this._domNode.setAttribute("aria-haspopup","true"),this._domNode.setAttribute("aria-autocomplete","list"),this._domNode.setAttribute("aria-activedescendant",e.activeDescendant)):(this._domNode.setAttribute("aria-haspopup","false"),this._domNode.setAttribute("aria-autocomplete","both"),this._domNode.removeAttribute("aria-activedescendant")),e.role&&this._domNode.setAttribute("role",e.role)}writeScreenReaderContent(){this._state.value?.updateScreenReaderContent(this._primarySelection)}};Fxe=I([m(3,Le),m(4,Ai)],Fxe);var Fai;(i=>{function a(e,t){return new e.EditContext(t)}i.create=a})(Fai||={});var Wai=class{constructor(){this._nativeEditContextMapping=new Map}register(i,e){return this._nativeEditContextMapping.set(i,e),{dispose:()=>{this._nativeEditContextMapping.delete(i)}}}get(i){return this._nativeEditContextMapping.get(i)}},cde=new Wai;var dde=class extends Dxe{constructor(e,t,o,n,r,s,l){super(t);this._viewController=n;this._visibleRangeProvider=r;this.logService=l;this._previousEditContextSelection=new gi(0,0);this._previousEditContextText="";this._editContextPrimarySelection=new ei(1,1,1,1);this._parentBounds=null;this._decorations=[];this._primarySelection=new ei(1,1,1,1);this._targetWindowId=-1;this._scrollTop=0;this._scrollLeft=0;this._linesVisibleRanges=null;this.domNode=new Kv(document.createElement("div")),this.domNode.setClassName("native-edit-context"),this._imeTextArea=new Kv(document.createElement("textarea")),this._imeTextArea.setClassName("ime-text-area"),this._imeTextArea.setAttribute("readonly","true"),this._imeTextArea.setAttribute("tabindex","-1"),this._imeTextArea.setAttribute("aria-hidden","true"),this.domNode.setAttribute("autocorrect","off"),this.domNode.setAttribute("autocapitalize","off"),this.domNode.setAttribute("autocomplete","off"),this.domNode.setAttribute("spellcheck","false"),this._updateDomAttributes(),o.appendChild(this.domNode),o.appendChild(this._imeTextArea),this._parent=o.domNode,this._focusTracker=this._register(new Mxe(l,this.domNode.domNode,h=>{l.trace("NativeEditContext#handleFocusChange : ",h),this._screenReaderSupport.handleFocusChange(h),this._context.viewModel.setHasFocus(h)}));let c=Me(this.domNode.domNode);this._editContext=Fai.create(c),this.setEditContextOnDomNode(),this._screenReaderSupport=this._register(s.createInstance(Fxe,this.domNode,t,this._viewController)),this._register($(this.domNode.domNode,"copy",h=>{this.logService.trace("NativeEditContext#copy"),cK.electronBugWorkaroundCopyEventHasFired=!0;let g=pxe(h,!1,this._context,this.logService,ed);this._onWillCopy.fire(g),!g.isHandled&&g.ensureClipboardGetsEditorData()})),this._register($(this.domNode.domNode,"cut",h=>{this.logService.trace("NativeEditContext#cut");let g=pxe(h,!0,this._context,this.logService,ed);this._onWillCut.fire(g),!g.isHandled&&(this._screenReaderSupport.onWillCut(),g.ensureClipboardGetsEditorData(),this.logService.trace("NativeEditContext#cut (before viewController.cut)"),this._viewController.cut())})),this._register($(this.domNode.domNode,"selectionchange",()=>{hx.onSelectionChange()})),this._register($(this.domNode.domNode,"keyup",h=>this._onKeyUp(h))),this._register($(this.domNode.domNode,"keydown",async h=>this._onKeyDown(h))),this._register($(this._imeTextArea.domNode,"keyup",h=>this._onKeyUp(h))),this._register($(this._imeTextArea.domNode,"keydown",async h=>this._onKeyDown(h))),this._register($(this.domNode.domNode,"beforeinput",async h=>{hx.onBeforeInput(),(h.inputType==="insertParagraph"||h.inputType==="insertLineBreak")&&this._onType(this._viewController,{text:`
`,replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0})})),this._register($(this.domNode.domNode,"paste",h=>{this.logService.trace("NativeEditContext#paste");let g=jyt(h);if(this._onWillPaste.fire(g),g.isHandled){h.preventDefault();return}if(h.preventDefault(),!h.clipboardData||(this.logService.trace("NativeEditContext#paste with id : ",g.metadata?.id," with text.length: ",g.text.length),!g.text))return;let f=!1,v=null,b=null;g.metadata&&(f=this._context.configuration.options.get(45)&&!!g.metadata.isFromEmptySelection,v=typeof g.metadata.multicursorText<"u"?g.metadata.multicursorText:null,b=g.metadata.mode),this.logService.trace("NativeEditContext#paste (before viewController.paste)"),this._viewController.paste(g.text,f,v,b)})),this._register(Pxe(this._editContext,"textformatupdate",h=>this._handleTextFormatUpdate(h))),this._register(Pxe(this._editContext,"characterboundsupdate",h=>this._updateCharacterBounds(h)));let u;this._register(Pxe(this._editContext,"textupdate",h=>{hx.onInput();let g=h.text;if(g.length===1){let f=g.charCodeAt(0);if(Ip(f)){u=g;return}if(iF(f)&&u){let v={text:u+g,selectionEnd:h.selectionEnd,selectionStart:h.selectionStart,updateRangeStart:h.updateRangeStart-1,updateRangeEnd:h.updateRangeEnd-1};u=void 0,this._emitTypeEvent(this._viewController,v);return}}this._emitTypeEvent(this._viewController,h)})),this._register(Pxe(this._editContext,"compositionstart",h=>{this._updateEditContext(),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(Pxe(this._editContext,"compositionend",h=>{this._updateEditContext(),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()}));let p=!1;this._register(xD.onDidChange(()=>{xD.enabled&&p&&(this._focusTracker.resume(),this.domNode.focus(),p=!1),!xD.enabled&&this.isFocused()&&(this._focusTracker.pause(),this._imeTextArea.focus(),p=!0)})),this._register(cde.register(e,this)),this._register(t.viewModel.model.onDidChangeContent(h=>{let g=!1;for(let f of h.changes)if(f.range.startLineNumber<=this._editContextPrimarySelection.endLineNumber&&f.range.endLineNumber>=this._editContextPrimarySelection.startLineNumber){g=!0;break}g&&this._updateEditContext()}))}dispose(){this.domNode.domNode.editContext=void 0,this.domNode.domNode.blur(),this.domNode.domNode.remove(),this._imeTextArea.domNode.remove(),super.dispose()}setAriaOptions(e){this._screenReaderSupport.setAriaOptions(e)}getLastRenderData(){return this._primarySelection.getPosition()}onBeforeRender(e){this._parentBounds=this._parent.getBoundingClientRect()}prepareRender(e){this._screenReaderSupport.prepareRender(e),this._updateSelectionAndControlBoundsData(e)}render(e){this._screenReaderSupport.render(e),this._updateSelectionAndControlBounds()}onCursorStateChanged(e){return this._primarySelection=e.modelSelections[0]??new ei(1,1,1,1),this._screenReaderSupport.onCursorStateChanged(e),this._updateEditContext(),!0}onConfigurationChanged(e){return this._screenReaderSupport.onConfigurationChanged(e),this._updateDomAttributes(),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}handleWillPaste(){this.logService.trace("NativeEditContext#handleWillPaste"),this._prepareScreenReaderForPaste()}_prepareScreenReaderForPaste(){this._screenReaderSupport.onWillPaste()}handleWillCopy(){this.logService.trace("NativeEditContext#handleWillCopy"),this.logService.trace("NativeEditContext#isFocused : ",this.domNode.domNode===Un())}writeScreenReaderContent(){this._screenReaderSupport.writeScreenReaderContent()}isFocused(){return this._focusTracker.isFocused}focus(){this._focusTracker.focus(),this.refreshFocusState()}refreshFocusState(){this._focusTracker.refreshFocusState()}setEditContextOnDomNode(){let e=Me(this.domNode.domNode),t=hv(e);this._targetWindowId!==t&&(this.domNode.domNode.editContext=this._editContext,this._targetWindowId=t)}_onKeyUp(e){hx.onKeyUp(),this._viewController.emitKeyUp(new mi(e))}_onKeyDown(e){hx.onKeyDown();let t=new mi(e);t.keyCode===114&&t.stopPropagation(),this._viewController.emitKeyDown(t)}_updateDomAttributes(){let e=this._context.configuration.options;this.domNode.domNode.setAttribute("tabindex",String(e.get(140)))}_updateEditContext(){let e=this._getNewEditContextState();if(!e)return;let t=e.text??" ";t!==this._previousEditContextText&&(this._editContext.updateText(0,this._previousEditContextText.length,t),this._previousEditContextText=t),(e.selectionStartOffset!==this._previousEditContextSelection.start||e.selectionEndOffset!==this._previousEditContextSelection.endExclusive)&&this._editContext.updateSelection(e.selectionStartOffset,e.selectionEndOffset),this._editContextPrimarySelection=e.editContextPrimarySelection,this._previousEditContextSelection=new gi(e.selectionStartOffset,e.selectionEndOffset)}_emitTypeEvent(e,t){if(!this._editContext)return;let o=this._previousEditContextSelection.endExclusive,n=this._previousEditContextSelection.start;this._previousEditContextSelection=new gi(t.selectionStart,t.selectionEnd);let r=0,s=0;t.updateRangeEnd>o&&(r=t.updateRangeEnd-o),t.updateRangeStart<n&&(s=n-t.updateRangeStart);let l="";n<t.updateRangeStart&&(l+=this._editContext.text.substring(n,t.updateRangeStart)),l+=t.text,o>t.updateRangeEnd&&(l+=this._editContext.text.substring(t.updateRangeEnd,o));let c=0;t.selectionStart===t.selectionEnd&&n===o&&(c=t.selectionStart-(t.updateRangeStart+t.text.length));let u={text:l,replacePrevCharCnt:s,replaceNextCharCnt:r,positionDelta:c};this._onType(e,u)}_onType(e,t){t.replacePrevCharCnt||t.replaceNextCharCnt||t.positionDelta?e.compositionType(t.text,t.replacePrevCharCnt,t.replaceNextCharCnt,t.positionDelta):e.type(t.text)}_getNewEditContextState(){let e=this._primarySelection,t=this._context.viewModel.model;if(!t.isValidRange(e))return;let o=e.startLineNumber,n=e.endLineNumber,r=t.getLineMaxColumn(n),s=new G(o,1,n,r),l=t.getValueInRange(s,0),c=e.startColumn-1,u=l.length+e.endColumn-r;return{text:l,selectionStartOffset:c,selectionEndOffset:u,editContextPrimarySelection:e}}_editContextStartPosition(){return new ye(this._editContextPrimarySelection.startLineNumber,1)}_handleTextFormatUpdate(e){if(!this._editContext)return;let t=e.getTextFormats(),o=this._editContextStartPosition(),n=[];t.forEach(r=>{let s=this._context.viewModel.model,l=s.getOffsetAt(o),c=s.getPositionAt(l+r.rangeStart),u=s.getPositionAt(l+r.rangeEnd),p=G.fromPositions(c,u),h=r.underlineThickness.toLowerCase(),g="edit-context-composition-none";switch(h){case"thin":g="edit-context-composition-secondary";break;case"thick":g="edit-context-composition-primary";break}n.push({range:p,options:{description:"textFormatDecoration",inlineClassName:g}})}),this._decorations=this._context.viewModel.model.deltaDecorations(this._decorations,n)}_updateSelectionAndControlBoundsData(e){let t=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection);if(this._primarySelection.isEmpty()){let o=e.visibleRangeForPosition(t.getStartPosition());this._linesVisibleRanges=o}else this._linesVisibleRanges=null}_updateSelectionAndControlBounds(){let t=this._context.configuration.options.get(165).contentLeft,o=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection),n=this._context.viewLayout.getVerticalOffsetForLineNumber(o.startLineNumber),r=this._context.viewLayout.getVerticalOffsetAfterLineNumber(o.endLineNumber),s=this._parentBounds,l=s.top+n-this._scrollTop,c=r-n,u=s.left+t-this._scrollLeft,p;this._primarySelection.isEmpty()?(this._linesVisibleRanges&&(u+=this._linesVisibleRanges.left),p=0):p=s.width-t;let h=new DOMRect(u,l,p,c);this._editContext.updateSelectionBounds(h),this._editContext.updateControlBounds(h)}_updateCharacterBounds(e){let t=this._context.configuration.options,o=t.get(59).typicalHalfwidthCharacterWidth,n=t.get(165).contentLeft,r=this._parentBounds,s=[],l=new TA(this._editContext.text);for(let c=e.rangeStart;c<e.rangeEnd;c++){let u=l.getPosition(c),p=this._editContextPrimarySelection.startLineNumber-1,h=new ye(p+u.lineNumber,u.column),g=h.delta(0,1),f=G.fromPositions(h,g),v=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(f),b=this._visibleRangeProvider.linesVisibleRangesForRange(v,!0)??[],S=v.startLineNumber,y=this._context.viewLayout.getVerticalOffsetForLineNumber(S),w=r.top+y-this._scrollTop,x=0,E=o;if(b.length>0)for(let N of b[0].ranges){x=N.left,E=N.width;break}let M=this._context.viewLayout.getLineHeightForLineNumber(S);s.push(new DOMRect(r.left+n+x-this._scrollLeft,w,E,M))}this._editContext.updateCharacterBounds(e.rangeStart,s)}};dde=I([m(5,F),m(6,re)],dde);var uCt=class extends np{constructor(e,t){super(e);this._viewGpuContext=t;this._gpuShapes=[];this._register(ve(o=>this._updateEntries(o)))}onConfigurationChanged(e){return this._updateEntries(void 0),!0}prepareRender(e){}render(e){}_updateEntries(e){let t=this._context.configuration.options,o=t.get(116),n=t.get(59).typicalHalfwidthCharacterWidth,r=this._viewGpuContext.devicePixelRatio.read(e);for(let s=0,l=o.length;s<l;s++){let c=o[s],u=this._gpuShapes[s],p=c.color?Ue.fromHex(c.color):this._context.theme.getColor(QYi)??Ue.white,h=[c.column*n*r,0,Math.max(1,Math.ceil(r)),Number.MAX_SAFE_INTEGER,p.rgba.r/255,p.rgba.g/255,p.rgba.b/255,p.rgba.a];u?u.setRaw(h):this._gpuShapes[s]=this._viewGpuContext.rectangleRenderer.register(...h)}for(;this._gpuShapes.length>o.length;)this._gpuShapes.splice(-1,1)[0].dispose()}};var pCt=class a extends vx{constructor(e,t){super();this._viewGpuContext=t;this._context=e,this._renderResult=null,this._context.addEventHandler(this)}static{this.CLASS_NAME="gpu-mark"}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return!0}onCursorStateChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return!0}prepareRender(e){let t=e.visibleRange.startLineNumber,o=e.visibleRange.endLineNumber,n=e.viewportData,r=new z5(this._context.configuration,this._context.theme.type),s=[];for(let l=t;l<=o;l++){let c=l-t,u=this._viewGpuContext.canRenderDetailed(r,n,l);s[c]=u.length?`<div class="${a.CLASS_NAME}" title="Cannot render on GPU: ${u.join(", ")}"></div>`:""}this._renderResult=s}render(e,t){if(!this._renderResult)return"";let o=t-e;return o<0||o>=this._renderResult.length?"":this._renderResult[o]}};var ET=le("userInteractionService");var Wxe=class extends yT{constructor(e,t,o,n,r,s,l,c,u,p){super();this._instantiationService=u;this._userInteractionService=p;this._editContextClipboardListeners=new O;this._onWillCopy=this._register(new T);this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new T);this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new T);this.onWillPaste=this._onWillPaste.event;this._shouldRecomputeGlyphMarginLanes=!1;this._ownerID=t,this._widgetFocusTracker=this._register(new Bai(e,c,this._userInteractionService)),this._register(this._widgetFocusTracker.onChange(()=>{this._context.viewModel.setHasWidgetFocus(this._widgetFocusTracker.hasFocus())})),this._selections=[new ei(1,1,1,1)],this._renderAnimationFrame=null,this._overflowGuardContainer=Ir(document.createElement("div")),MI.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._viewController=new Jyt(n,s,l,o),this._context=new Zwt(n,r,s),this._context.addEventHandler(this),this._viewParts=[],this._editContextEnabled=this._context.configuration.options.get(170),this._accessibilitySupport=this._context.configuration.options.get(2),this._editContext=this._instantiateEditContext(),this._connectEditContextClipboardEvents(),this._viewParts.push(this._editContext),this._linesContent=Ir(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=Ir(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._context.configuration.options.get(46)==="on"&&(this._viewGpuContext=this._instantiationService.createInstance(Pc,this._context)),this._scrollbar=new ywt(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new kwt(this._context,this._viewGpuContext,this._linesContent),this._viewGpuContext&&(this._viewLinesGpu=this._instantiationService.createInstance(_xe,this._context,this._viewGpuContext)),this._viewZones=new jwt(this._context),this._viewParts.push(this._viewZones);let h=new Wwt(this._context);this._viewParts.push(h);let g=new zwt(this._context);this._viewParts.push(g);let f=new ewt(this._context);this._viewParts.push(f),f.addDynamicOverlay(new bwt(this._context)),f.addDynamicOverlay(new Gwt(this._context)),f.addDynamicOverlay(new xwt(this._context)),f.addDynamicOverlay(new Iwt(this._context)),f.addDynamicOverlay(new Qwt(this._context));let v=new twt(this._context);this._viewParts.push(v),v.addDynamicOverlay(new Swt(this._context)),v.addDynamicOverlay(new Twt(this._context)),v.addDynamicOverlay(new Ewt(this._context)),v.addDynamicOverlay(new wxe(this._context)),this._viewGpuContext&&v.addDynamicOverlay(new pCt(this._context,this._viewGpuContext)),this._glyphMarginWidgets=new wwt(this._context),this._viewParts.push(this._glyphMarginWidgets);let b=new xxe(this._context);b.getDomNode().appendChild(this._viewZones.marginDomNode),b.getDomNode().appendChild(v.getDomNode()),b.getDomNode().appendChild(this._glyphMarginWidgets.domNode),this._viewParts.push(b),this._contentWidgets=new owt(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new $wt(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new Owt(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);let S=this._viewGpuContext?new uCt(this._context,this._viewGpuContext):new Uwt(this._context);this._viewParts.push(S);let y=new iwt(this._context);this._viewParts.push(y);let w=new Awt(this._context);if(this._viewParts.push(w),h){let x=this._scrollbar.getOverviewRulerLayoutInfo();x.parent.insertBefore(h.getDomNode(),x.insertBefore)}this._linesContent.appendChild(f.getDomNode()),"domNode"in S&&this._linesContent.appendChild(S.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(b.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._viewGpuContext&&this._overflowGuardContainer.appendChild(this._viewGpuContext.canvas),this._overflowGuardContainer.appendChild(g.getDomNode()),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(w.getDomNode()),this._overflowGuardContainer.appendChild(y.domNode),this.domNode.appendChild(this._overflowGuardContainer),c?(c.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode),c.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode)):(this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode)),this._applyLayout(),this._pointerHandler=this._register(new Xyt(this._context,this._viewController,this._createPointerHandlerHelper()))}_instantiateEditContext(){return this._context.configuration.options.get(170)?this._instantiationService.createInstance(dde,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper()):this._instantiationService.createInstance(Lxe,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper())}_updateEditContext(){let e=this._context.configuration.options.get(170),t=this._context.configuration.options.get(2);if(this._editContextEnabled===e&&this._accessibilitySupport===t)return;this._editContextEnabled=e,this._accessibilitySupport=t;let o=this._editContext.isFocused(),n=this._viewParts.indexOf(this._editContext);this._editContext.dispose(),this._editContext=this._instantiateEditContext(),this._connectEditContextClipboardEvents(),o&&this._editContext.focus(),n!==-1&&this._viewParts.splice(n,1,this._editContext)}_connectEditContextClipboardEvents(){this._editContextClipboardListeners.clear(),this._editContextClipboardListeners.add(this._editContext.onWillCopy(e=>this._onWillCopy.fire(e))),this._editContextClipboardListeners.add(this._editContext.onWillCut(e=>this._onWillCut.fire(e))),this._editContextClipboardListeners.add(this._editContext.onWillPaste(e=>this._onWillPaste.fire(e)))}_computeGlyphMarginLanes(){let e=this._context.viewModel.model,t=this._context.viewModel.glyphLanes,o=[],n=0;o=o.concat(e.getAllMarginDecorations().map(r=>{let s=r.options.glyphMargin?.position??2;return n=Math.max(n,r.range.endLineNumber),{range:r.range,lane:s,persist:r.options.glyphMargin?.persistLane}})),o=o.concat(this._glyphMarginWidgets.getWidgets().map(r=>{let s=e.validateRange(r.preference.range);return n=Math.max(n,s.endLineNumber),{range:s,lane:r.preference.lane}})),o.sort((r,s)=>G.compareRangesUsingStarts(r.range,s.range)),t.reset(n);for(let r of o)t.push(r.lane,r.range,r.persist);return t}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,viewLinesDomNode:this._viewLines.getDomNode().domNode,viewLinesGpu:this._viewLinesGpu,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._editContext.domNode.domNode.dispatchEvent(e)},getLastRenderData:()=>{let e=this._viewCursors.getLastRenderData()||[],t=this._editContext.getLastRenderData();return new xyt(e,t)},renderNow:()=>{this.render(!0,!1)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>{this._flushAccumulatedAndRenderNow();let o=new ye(e,t);return this._viewLines.visibleRangeForPosition(o)??this._viewLinesGpu?.visibleRangeForPosition(o)??null},getLineWidth:e=>{if(this._flushAccumulatedAndRenderNow(),this._viewLinesGpu){let t=this._viewLinesGpu.getLineWidth(e);if(t!==void 0)return t}return this._viewLines.getLineWidth(e)}}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e)),linesVisibleRangesForRange:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.linesVisibleRangesForRange(e,t))}}_applyLayout(){let t=this._context.configuration.options.get(165);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(16777216),this._linesContent.setHeight(16777216)}_getEditorClassName(){let e=this._editContext.isFocused()?" focused":"";return this._context.configuration.options.get(162)+" "+V5(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._updateEditContext(),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onDecorationsChanged(e){return e.affectsGlyphMargin&&(this._shouldRecomputeGlyphMarginLanes=!0),!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._editContextClipboardListeners.dispose(),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewGpuContext?.dispose(),this._viewLines.dispose(),this._viewLinesGpu?.dispose();for(let e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){if(this._store.isDisposed)throw new ci;if(this._renderAnimationFrame===null){this._editContext instanceof dde&&this._editContext.setEditContextOnDomNode();let e=this._createCoordinatedRendering();this._renderAnimationFrame=Vai.INSTANCE.scheduleCoordinatedRendering({window:Me(this.domNode?.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new ci;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:t=>{if(this._store.isDisposed)throw new ci;return e.renderText(t)},prepareRender:(t,o)=>{if(this._store.isDisposed)throw new ci;return e.prepareRender(t,o)},render:(t,o)=>{if(this._store.isDisposed)throw new ci;return e.render(t,o)}})}}_flushAccumulatedAndRenderNow(){let e=this._createCoordinatedRendering(),t=kX(()=>e.prepareRenderText());if(!t)return;let o=kX(()=>e.renderText(t));if(!o)return;let[n,r]=o;kX(()=>e.prepareRender(n,r)),kX(()=>e.render(n,r))}_getViewPartsToRender(){let e=[],t=0;for(let o of this._viewParts)o.shouldRender()&&(e[t++]=o);return e}_createCoordinatedRendering(){return{prepareRenderText:()=>{if(this._shouldRecomputeGlyphMarginLanes){this._shouldRecomputeGlyphMarginLanes=!1;let r=this._computeGlyphMarginLanes();this._context.configuration.setGlyphMarginDecorationLaneCount(r.requiredLanes)}if(hx.onRenderStart(),!this.domNode.domNode.isConnected)return null;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return null;let o=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(o.startLineNumber,o.endLineNumber,o.centeredLineNumber);let n=new Xwt(this._selections,o,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);for(let r of this._viewParts)r.shouldRender()&&r.onBeforeRender(n);return n},renderText:e=>(this._viewLines.shouldRender()&&(this._viewLines.renderText(e),this._viewLines.onDidRender()),this._viewLinesGpu?.shouldRender()&&(this._viewLinesGpu.renderText(e),this._viewLinesGpu.onDidRender()),[this._getViewPartsToRender(),new gyt(this._context.viewLayout,e,this._viewLines,this._viewLinesGpu)]),prepareRender:(e,t)=>{for(let o of e)o.prepareRender(t)},render:(e,t)=>{for(let o of e)o.render(t),o.onDidRender()}}}delegateVerticalScrollbarPointerDown(e){this._scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this._scrollbar.delegateScrollFromMouseWheelEvent(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft},1),this._context.viewModel.visibleLinesStabilized()}getOffsetForColumn(e,t){let o=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(o);this._flushAccumulatedAndRenderNow();let r=this._viewLines.visibleRangeForPosition(new ye(n.lineNumber,n.column));return r?r.left:-1}getLineWidth(e){let t=this._context.viewModel.model,o=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(new ye(e,t.getLineMaxColumn(e))).lineNumber;return this._flushAccumulatedAndRenderNow(),this._viewLines.getLineWidth(o)}resetLineWidthCaches(){this._viewLines.resetLineWidthCaches()}getTargetAtClientPoint(e,t){let o=this._pointerHandler.getTargetAtClientPoint(e,t);return o?gxe.convertViewToModelMouseTarget(o,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new Hwt(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(let o of this._viewParts)o.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}writeScreenReaderContent(e){this._editContext.writeScreenReaderContent(e)}focus(){this._editContext.focus()}isFocused(){return this._editContext.isFocused()}isWidgetFocused(){return this._widgetFocusTracker.hasFocus()}refreshFocusState(){this._editContext.refreshFocusState(),this._widgetFocusTracker.refreshState()}setAriaOptions(e){this._editContext.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){this._contentWidgets.setWidgetPosition(e.widget,e.position?.position??null,e.position?.secondaryPosition??null,e.position?.preference??null,e.position?.positionAffinity??null),this._contentWidgets.shouldRender()&&this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){this._overlayWidgets.setWidgetPosition(e.widget,e.position)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}addGlyphMarginWidget(e){this._glyphMarginWidgets.addWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}layoutGlyphMarginWidget(e){let t=e.position;this._glyphMarginWidgets.setWidgetPosition(e.widget,t)&&(this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender())}removeGlyphMarginWidget(e){this._glyphMarginWidgets.removeWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}};Wxe=I([m(8,F),m(9,ET)],Wxe);function kX(a){try{return a()}catch(i){return mt(i),null}}var Vai=class a{constructor(){this._coordinatedRenderings=[];this._animationFrameRunners=new Map}static{this.INSTANCE=new a}scheduleCoordinatedRendering(i){return this._coordinatedRenderings.push(i),this._scheduleRender(i.window),{dispose:()=>{let e=this._coordinatedRenderings.indexOf(i);if(e!==-1&&(this._coordinatedRenderings.splice(e,1),this._coordinatedRenderings.length===0)){for(let[t,o]of this._animationFrameRunners)o.dispose();this._animationFrameRunners.clear()}}}}_scheduleRender(i){if(!this._animationFrameRunners.has(i)){let e=()=>{this._animationFrameRunners.delete(i),this._onRenderScheduled()};this._animationFrameRunners.set(i,Cg(i,e,100))}}_onRenderScheduled(){let i=this._coordinatedRenderings.slice(0);this._coordinatedRenderings=[];let e=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];e[o]=kX(()=>r.prepareRenderText())}let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o],s=e[o];if(!s){t[o]=null;continue}t[o]=kX(()=>r.renderText(s))}for(let o=0,n=i.length;o<n;o++){let r=i[o],s=t[o];if(!s)continue;let[l,c]=s;kX(()=>r.prepareRender(l,c))}for(let o=0,n=i.length;o<n;o++){let r=i[o],s=t[o];if(!s)continue;let[l,c]=s;kX(()=>r.render(l,c))}}},Bai=class extends k{constructor(e,t,o){super();this._onChange=this._register(new T);this.onChange=this._onChange.event;this._hadFocus=void 0;this._hasDomElementFocus=!1,this._domFocusTracker=this._register(o.createDomFocusTracker(e)),this._overflowWidgetsDomNodeHasFocus=!1,this._register(this._domFocusTracker.onDidFocus(()=>{this._hasDomElementFocus=!0,this._update()})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasDomElementFocus=!1,this._update()})),t&&(this._overflowWidgetsDomNode=this._register(o.createDomFocusTracker(t)),this._register(this._overflowWidgetsDomNode.onDidFocus(()=>{this._overflowWidgetsDomNodeHasFocus=!0,this._update()})),this._register(this._overflowWidgetsDomNode.onDidBlur(()=>{this._overflowWidgetsDomNodeHasFocus=!1,this._update()})))}_update(){let e=this._hasDomElementFocus||this._overflowWidgetsDomNodeHasFocus;this._hadFocus!==e&&(this._hadFocus=e,this._onChange.fire(void 0))}hasFocus(){return this._hadFocus??!1}refreshState(){this._domFocusTracker.refreshState(),this._overflowWidgetsDomNode?.refreshState?.()}};var K5=class{constructor(i,e,t,o,n){this.injectionOffsets=i;this.injectionOptions=e;this.breakOffsets=t;this.breakOffsetsVisibleColumn=o;this.wrappedTextIndentLength=n}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(i){return i>0?this.wrappedTextIndentLength:0}getLineLength(i){let e=i>0?this.breakOffsets[i-1]:0,o=this.breakOffsets[i]-e;return i>0&&(o+=this.wrappedTextIndentLength),o}getMaxOutputOffset(i){return this.getLineLength(i)}translateToInputOffset(i,e){i>0&&(e=Math.max(0,e-this.wrappedTextIndentLength));let o=i===0?e:this.breakOffsets[i-1]+e;if(this.injectionOffsets!==null)for(let n=0;n<this.injectionOffsets.length&&o>this.injectionOffsets[n];n++)o<this.injectionOffsets[n]+this.injectionOptions[n].content.length?o=this.injectionOffsets[n]:o-=this.injectionOptions[n].content.length;return o}translateToOutputPosition(i,e=2){let t=i;if(this.injectionOffsets!==null)for(let o=0;o<this.injectionOffsets.length&&!(i<this.injectionOffsets[o]||e!==1&&i===this.injectionOffsets[o]);o++)t+=this.injectionOptions[o].content.length;return this.offsetInInputWithInjectionsToOutputPosition(t,e)}offsetInInputWithInjectionsToOutputPosition(i,e=2){let t=0,o=this.breakOffsets.length-1,n=0,r=0;for(;t<=o;){n=t+(o-t)/2|0;let l=this.breakOffsets[n];if(r=n>0?this.breakOffsets[n-1]:0,e===0)if(i<=r)o=n-1;else if(i>l)t=n+1;else break;else if(i<r)o=n-1;else if(i>=l)t=n+1;else break}let s=i-r;return n>0&&(s+=this.wrappedTextIndentLength),new Vxe(n,s)}normalizeOutputPosition(i,e,t){if(this.injectionOffsets!==null){let o=this.outputPositionToOffsetInInputWithInjections(i,e),n=this.normalizeOffsetInInputWithInjectionsAroundInjections(o,t);if(n!==o)return this.offsetInInputWithInjectionsToOutputPosition(n,t)}if(t===0){if(i>0&&e===this.getMinOutputOffset(i))return new Vxe(i-1,this.getMaxOutputOffset(i-1))}else if(t===1){let o=this.getOutputLineCount()-1;if(i<o&&e===this.getMaxOutputOffset(i))return new Vxe(i+1,this.getMinOutputOffset(i+1))}return new Vxe(i,e)}outputPositionToOffsetInInputWithInjections(i,e){return i>0&&(e=Math.max(0,e-this.wrappedTextIndentLength)),(i>0?this.breakOffsets[i-1]:0)+e}normalizeOffsetInInputWithInjectionsAroundInjections(i,e){let t=this.getInjectedTextAtOffset(i);if(!t)return i;if(e===2){if(i===t.offsetInInputWithInjections+t.length&&CXi(this.injectionOptions[t.injectedTextIndex].cursorStops))return t.offsetInInputWithInjections+t.length;{let o=t.offsetInInputWithInjections;if(xXi(this.injectionOptions[t.injectedTextIndex].cursorStops))return o;let n=t.injectedTextIndex-1;for(;n>=0&&this.injectionOffsets[n]===this.injectionOffsets[t.injectedTextIndex]&&!(CXi(this.injectionOptions[n].cursorStops)||(o-=this.injectionOptions[n].content.length,xXi(this.injectionOptions[n].cursorStops)));)n--;return o}}else if(e===1||e===4){let o=t.offsetInInputWithInjections+t.length,n=t.injectedTextIndex;for(;n+1<this.injectionOffsets.length&&this.injectionOffsets[n+1]===this.injectionOffsets[n];)o+=this.injectionOptions[n+1].content.length,n++;return o}else if(e===0||e===3){let o=t.offsetInInputWithInjections,n=t.injectedTextIndex;for(;n-1>=0&&this.injectionOffsets[n-1]===this.injectionOffsets[n];)o-=this.injectionOptions[n-1].content.length,n--;return o}bs(e)}getInjectedText(i,e){let t=this.outputPositionToOffsetInInputWithInjections(i,e),o=this.getInjectedTextAtOffset(t);return o?{options:this.injectionOptions[o.injectedTextIndex]}:null}getInjectedTextAtOffset(i){let e=this.injectionOffsets,t=this.injectionOptions;if(e!==null){let o=0;for(let n=0;n<e.length;n++){let r=t[n].content.length,s=e[n]+o,l=e[n]+o+r;if(s>i)break;if(i<=l)return{injectedTextIndex:n,offsetInInputWithInjections:s,length:r};o+=r}}}};function CXi(a){return a==null?!0:a===1||a===0}function xXi(a){return a==null?!0:a===2||a===0}var Vxe=class{constructor(i,e){this.outputLineIndex=i,this.outputOffset=e}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(i){return new ye(i+this.outputLineIndex,this.outputOffset+1)}};function kXi(){return a=>({fontFamily:a.fontFamily?String(a.fontFamily):void 0,fontSizeMultiplier:a.fontSizeMultiplier?Number(a.fontSizeMultiplier):void 0,lineHeightMultiplier:a.lineHeightMultiplier?Number(a.lineHeightMultiplier):void 0})}var mCt=class{constructor(){this.changeType=1}},BF=class a{constructor(i,e,t,o,n){this.ownerId=i;this.lineNumber=e;this.column=t;this.options=o;this.order=n}static applyInjectedText(i,e){if(!e||e.length===0)return i;let t="",o=0;for(let n of e)t+=i.substring(o,n.column-1),o=n.column-1,t+=n.options.content;return t+=i.substring(o),t}static fromDecorations(i){let e=[];for(let t of i)t.options.before&&t.options.before.content.length>0&&e.push(new a(t.ownerId,t.range.startLineNumber,t.range.startColumn,t.options.before,0)),t.options.after&&t.options.after.content.length>0&&e.push(new a(t.ownerId,t.range.endLineNumber,t.range.endColumn,t.options.after,1));return e.sort((t,o)=>t.lineNumber===o.lineNumber?t.column===o.column?t.order-o.order:t.column-o.column:t.lineNumber-o.lineNumber),e}withText(i){return new a(this.ownerId,this.lineNumber,this.column,{...this.options,content:i},this.order)}},r8e=class{constructor(i,e){this.changeType=2;this.lineNumber=i,this.lineNumberPostEdit=e}},hCt=class{constructor(i,e,t,o){this.ownerId=i,this.decorationId=e,this.lineNumber=t,this.lineHeightMultiplier=o}},gCt=class{constructor(i,e){this.ownerId=i,this.lineNumber=e}},fCt=class{constructor(i,e,t){this.changeType=3;this.fromLineNumber=i,this.toLineNumber=e,this.lastUntouchedLinePostEdit=t}},vCt=class{constructor(i,e,t){this.changeType=4;this.fromLineNumber=i,this.fromLineNumberPostEdit=e,this.count=t}get toLineNumber(){return this.fromLineNumber+this.count-1}get toLineNumberPostEdit(){return this.fromLineNumberPostEdit+this.count-1}},bCt=class{constructor(){this.changeType=5}},ude=class a{constructor(i,e,t,o){this.changes=i,this.versionId=e,this.isUndoing=t,this.isRedoing=o,this.resultingSelection=null}containsEvent(i){for(let e=0,t=this.changes.length;e<t;e++)if(this.changes[e].changeType===i)return!0;return!1}static merge(i,e){let t=[].concat(i.changes).concat(e.changes),o=e.versionId,n=i.isUndoing||e.isUndoing,r=i.isRedoing||e.isRedoing;return new a(t,o,n,r)}},Bxe=class{constructor(i){this.changes=i}},Hxe=class{constructor(i){this.changes=i}affects(i){if(G.isIRange(i)){for(let e of this.changes)if(e.lineNumber>=i.startLineNumber&&e.lineNumber<=i.endLineNumber)return!0;return!1}else{for(let e of this.changes)if(e.lineNumber===i.lineNumber)return!0;return!1}}},Uxe=class{constructor(i){this.changes=i}},EX=class a{constructor(i,e){this.rawContentChangedEvent=i;this.contentChangedEvent=e}merge(i){let e=ude.merge(this.rawContentChangedEvent,i.rawContentChangedEvent),t=a._mergeChangeEvents(this.contentChangedEvent,i.contentChangedEvent);return new a(e,t)}static _mergeChangeEvents(i,e){let t=[].concat(i.changes).concat(e.changes),o=e.eol,n=e.versionId,r=i.isUndoing||e.isUndoing,s=i.isRedoing||e.isRedoing,l=i.isFlush||e.isFlush,c=i.isEolChange&&e.isEolChange;return{changes:t,eol:o,isEolChange:c,versionId:n,isUndoing:r,isRedoing:s,isFlush:l,detailedReasons:i.detailedReasons.concat(e.detailedReasons),detailedReasonsChangeLengths:i.detailedReasonsChangeLengths.concat(e.detailedReasonsChangeLengths)}}};var rqo=zf("domLineBreaksComputer",{createHTML:a=>a}),SCt=class a{constructor(i){this.targetWindow=i}static create(i){return new a(new WeakRef(i))}createLineBreaksComputer(i,e,t,o,n,r,s){let l=[];return{addRequest:(c,u)=>{l.push(c)},finalize:()=>sqo(Ti(this.targetWindow.deref()),i,l,e,t,o,n,r)}}};function sqo(a,i,e,t,o,n,r,s){function l(H){let K=i.getLineInjectedText(H);if(K){let j=i.getLineContent(H),J=BF.applyInjectedText(j,K),se=K.map(ce=>ce.options),ae=K.map(ce=>ce.column-1);return new K5(ae,se,[J.length],[],0)}else return null}if(n===-1){let H=[];for(let K=0,j=e.length;K<j;K++)H[K]=l(e[K]);return H}let c=Math.round(n*t.typicalHalfwidthCharacterWidth),u=r===3?2:r===2?1:0,p=Math.round(o*u),h=Math.ceil(t.spaceWidth*p),g=document.createElement("div");ku(g,t);let f=new EI(1e4),v=[],b=[],S=[],y=[],w=[];for(let H=0;H<e.length;H++){let K=e[H],j=BF.applyInjectedText(i.getLineContent(K),i.getLineInjectedText(K)),J=0,se=0,ae=c;if(r!==0)if(J=Em(j),J===-1)J=0;else{for(let xe=0;xe<J;xe++){let He=j.charCodeAt(xe)===9?o-se%o:1;se+=He}let Re=Math.ceil(t.spaceWidth*se);Re+t.typicalFullwidthCharacterWidth>c?(J=0,se=0):ae=c-Re}let ce=j.substr(J),Se=aqo(ce,se,o,ae,f,h);v[H]=J,b[H]=se,S[H]=ce,y[H]=Se[0],w[H]=Se[1]}let x=f.build(),E=rqo?.createHTML(x)??x;g.innerHTML=E,g.style.position="absolute",g.style.top="10000px",s==="keepAll"?(g.style.wordBreak="keep-all",g.style.overflowWrap="anywhere"):(g.style.wordBreak="inherit",g.style.overflowWrap="break-word"),a.document.body.appendChild(g);let M=document.createRange(),N=Array.prototype.slice.call(g.children,0),V=[];for(let H=0;H<e.length;H++){let K=e[H],j=N[H],J=lqo(M,j,S[H],y[H]);if(J===null){V[H]=l(K);continue}let se=v[H],ae=b[H]+p,ce=w[H],Se=[];for(let Ee=0,Te=J.length;Ee<Te;Ee++)Se[Ee]=ce[J[Ee]];if(se!==0)for(let Ee=0,Te=J.length;Ee<Te;Ee++)J[Ee]+=se;let Re,xe,He=i.getLineInjectedText(K);He?(Re=He.map(Ee=>Ee.options),xe=He.map(Ee=>Ee.column-1)):(Re=null,xe=null),V[H]=new K5(xe,Re,J,Se,ae)}return g.remove(),V}function aqo(a,i,e,t,o,n){if(n!==0){let h=String(n);o.appendString('<div style="text-indent: -'),o.appendString(h),o.appendString("px; padding-left: "),o.appendString(h),o.appendString("px; box-sizing: border-box; width:")}else o.appendString('<div style="width:');o.appendString(String(t)),o.appendString('px;">');let r=a.length,s=i,l=0,c=[],u=[],p=0<r?a.charCodeAt(0):0;o.appendString("<span>");for(let h=0;h<r;h++){h!==0&&h%16384===0&&o.appendString("</span><span>"),c[h]=l,u[h]=s;let g=p;p=h+1<r?a.charCodeAt(h+1):0;let f=1,v=1;switch(g){case 9:f=e-s%e,v=f;for(let b=1;b<=f;b++)b<f?o.appendCharCode(160):o.appendASCIICharCode(32);break;case 32:p===32?o.appendCharCode(160):o.appendASCIICharCode(32);break;case 60:o.appendString("&lt;");break;case 62:o.appendString("&gt;");break;case 38:o.appendString("&amp;");break;case 0:o.appendString("&#00;");break;case 65279:case 8232:case 8233:case 133:o.appendCharCode(65533);break;default:sD(g)&&v++,g<32?o.appendCharCode(9216+g):o.appendCharCode(g)}l+=f,s+=v}return o.appendString("</span>"),c[a.length]=l,u[a.length]=s,o.appendString("</div>"),[c,u]}function lqo(a,i,e,t){if(e.length<=1)return null;let o=Array.prototype.slice.call(i.children,0),n=[];try{Uai(a,o,t,0,null,e.length-1,null,n)}catch(r){return console.error(r),null}return n.length===0?null:(n.push(e.length),n)}function Uai(a,i,e,t,o,n,r,s){if(t===n||(o=o||Hai(a,i,e[t],e[t+1]),r=r||Hai(a,i,e[n],e[n+1]),Math.abs(o[0].top-r[0].top)<=.1))return;if(t+1===n){s.push(n);return}let l=t+(n-t)/2|0,c=Hai(a,i,e[l],e[l+1]);Uai(a,i,e,t,o,l,c,s),Uai(a,i,e,l,c,n,r,s)}function Hai(a,i,e,t){return a.setStart(i[e/16384|0].firstChild,e%16384),a.setEnd(i[t/16384|0].firstChild,t%16384),a.getClientRects()}var ICt=class extends k{constructor(){super();this._editor=null;this._instantiationService=null;this._instances=this._register(new Ot);this._pending=new Map;this._finishedInstantiation=[];this._finishedInstantiation[0]=!1,this._finishedInstantiation[1]=!1,this._finishedInstantiation[2]=!1,this._finishedInstantiation[3]=!1}initialize(e,t,o){this._editor=e,this._instantiationService=o;for(let n of t){if(this._pending.has(n.id)){mt(new Error(`Cannot have two contributions with the same id ${n.id}`));continue}this._pending.set(n.id,n)}this._instantiateSome(0),this._register(Ff(Me(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(Ff(Me(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(Ff(Me(this._editor.getDomNode()),()=>{this._instantiateSome(3)},5e3))}saveViewState(){let e={};for(let[t,o]of this._instances)typeof o.saveViewState=="function"&&(e[t]=o.saveViewState());return e}restoreViewState(e){for(let[t,o]of this._instances)typeof o.restoreViewState=="function"&&o.restoreViewState(e[t])}get(e){return this._instantiateById(e),this._instances.get(e)||null}set(e,t){this._instances.set(e,t)}onBeforeInteractionEvent(){this._instantiateSome(2)}onAfterModelAttached(){return Ff(Me(this._editor?.getDomNode()),()=>{this._instantiateSome(1)},50)}_instantiateSome(e){if(this._finishedInstantiation[e])return;this._finishedInstantiation[e]=!0;let t=this._findPendingContributionsByInstantiation(e);for(let o of t)this._instantiateById(o.id)}_findPendingContributionsByInstantiation(e){let t=[];for(let[,o]of this._pending)o.instantiation===e&&t.push(o);return t}_instantiateById(e){let t=this._pending.get(e);if(t){if(this._pending.delete(e),!this._instantiationService||!this._editor)throw new Error("Cannot instantiate contributions before being initialized!");try{let o=this._instantiationService.createInstance(t.ctor,this._editor);this._instances.set(t.id,o),typeof o.restoreViewState=="function"&&t.instantiation!==0&&console.warn(`Editor contribution '${t.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`)}catch(o){mt(o)}}}};var yCt=class{constructor(i,e,t,o,n,r,s){this.id=i;this.label=e;this.alias=t;this.metadata=o;this._precondition=n;this._run=r;this._contextKeyService=s}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(i){return this.isSupported()?this._run(i):Promise.resolve(void 0)}};function TT(a){return(a.metadata&1)>>>0}function zp(a,i){a.metadata=a.metadata&254|i<<0}function Hy(a){return(a.metadata&2)>>>1===1}function Ep(a,i){a.metadata=a.metadata&253|(i?1:0)<<1}function AXi(a){return(a.metadata&4)>>>2===1}function EXi(a,i){a.metadata=a.metadata&251|(i?1:0)<<2}function NXi(a){return(a.metadata&64)>>>6===1}function TXi(a,i){a.metadata=a.metadata&191|(i?1:0)<<6}function OXi(a){return(a.metadata&128)>>>7===1}function _Xi(a,i){a.metadata=a.metadata&127|(i?1:0)<<7}function cqo(a){return(a.metadata&24)>>>3}function DXi(a,i){a.metadata=a.metadata&231|i<<3}function dqo(a){return(a.metadata&32)>>>5===1}function RXi(a,i){a.metadata=a.metadata&223|(i?1:0)<<5}var pde=class{constructor(i,e,t){this.metadata=0,this.parent=this,this.left=this,this.right=this,zp(this,1),this.start=e,this.end=t,this.delta=0,this.maxEnd=t,this.id=i,this.ownerId=0,this.options=null,EXi(this,!1),TXi(this,!1),DXi(this,1),RXi(this,!1),_Xi(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t,this.range=null,Ep(this,!1)}reset(i,e,t,o){this.start=e,this.end=t,this.maxEnd=t,this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t,this.range=o}setOptions(i){this.options=i;let e=this.options.className;EXi(this,e==="squiggly-error"||e==="squiggly-warning"||e==="squiggly-info"),TXi(this,this.options.glyphMarginClassName!==null),DXi(this,this.options.stickiness),RXi(this,this.options.collapseOnReplaceEdit),_Xi(this,this.options.affectsFont??!1)}setCachedOffsets(i,e,t){this.cachedVersionId!==t&&(this.range=null),this.cachedVersionId=t,this.cachedAbsoluteStart=i,this.cachedAbsoluteEnd=e}detach(){this.parent=null,this.left=null,this.right=null}},Fa=new pde(null,0,0);Fa.parent=Fa;Fa.left=Fa;Fa.right=Fa;zp(Fa,0);var _X=class{constructor(){this.root=Fa,this.requestNormalizeDelta=!1}intervalSearch(i,e,t,o,n,r,s){return this.root===Fa?[]:vqo(this,i,e,t,o,n,r,s)}search(i,e,t,o,n){return this.root===Fa?[]:LXi(this,i,e,t,o,n)}collectNodesFromOwner(i){return gqo(this,i)}collectNodesPostOrder(){return fqo(this)}insert(i){MXi(this,i),this._normalizeDeltaIfNecessary()}delete(i){PXi(this,i),this._normalizeDeltaIfNecessary()}resolveNode(i,e){let t=i,o=0;for(;i!==this.root;)i===i.parent.right&&(o+=i.parent.delta),i=i.parent;let n=t.start+o,r=t.end+o;t.setCachedOffsets(n,r,e)}acceptReplace(i,e,t,o){let n=mqo(this,i,i+e);for(let r=0,s=n.length;r<s;r++){let l=n[r];PXi(this,l)}this._normalizeDeltaIfNecessary(),hqo(this,i,i+e,t),this._normalizeDeltaIfNecessary();for(let r=0,s=n.length;r<s;r++){let l=n[r];l.start=l.cachedAbsoluteStart,l.end=l.cachedAbsoluteEnd,pqo(l,i,i+e,t,o),l.maxEnd=l.end,MXi(this,l)}this._normalizeDeltaIfNecessary()}getAllInOrder(){return LXi(this,0,!1,!1,0,!1)}_normalizeDeltaIfNecessary(){this.requestNormalizeDelta&&(this.requestNormalizeDelta=!1,uqo(this))}};function uqo(a){let i=a.root,e=0;for(;i!==Fa;){if(i.left!==Fa&&!Hy(i.left)){i=i.left;continue}if(i.right!==Fa&&!Hy(i.right)){e+=i.delta,i=i.right;continue}i.start=e+i.start,i.end=e+i.end,i.delta=0,G5(i),Ep(i,!0),Ep(i.left,!1),Ep(i.right,!1),i===i.parent.right&&(e-=i.parent.delta),i=i.parent}Ep(a.root,!1)}function zxe(a,i,e,t){return a<e?!0:a>e||t===1?!1:t===2?!0:i}function pqo(a,i,e,t,o){let n=cqo(a),r=n===0||n===2,s=n===1||n===2,l=e-i,c=t,u=Math.min(l,c),p=a.start,h=!1,g=a.end,f=!1;i<=p&&g<=e&&dqo(a)&&(a.start=i,h=!0,a.end=i,f=!0);{let b=o?1:l>0?2:0;!h&&zxe(p,r,i,b)&&(h=!0),!f&&zxe(g,s,i,b)&&(f=!0)}if(u>0&&!o){let b=l>c?2:0;!h&&zxe(p,r,i+u,b)&&(h=!0),!f&&zxe(g,s,i+u,b)&&(f=!0)}{let b=o?1:0;!h&&zxe(p,r,e,b)&&(a.start=i+c,h=!0),!f&&zxe(g,s,e,b)&&(a.end=i+c,f=!0)}let v=c-l;h||(a.start=Math.max(0,p+v)),f||(a.end=Math.max(0,g+v)),a.start>a.end&&(a.end=a.start)}function mqo(a,i,e){let t=a.root,o=0,n=0,r=0,s=0,l=[],c=0;for(;t!==Fa;){if(Hy(t)){Ep(t.left,!1),Ep(t.right,!1),t===t.parent.right&&(o-=t.parent.delta),t=t.parent;continue}if(!Hy(t.left)){if(n=o+t.maxEnd,n<i){Ep(t,!0);continue}if(t.left!==Fa){t=t.left;continue}}if(r=o+t.start,r>e){Ep(t,!0);continue}if(s=o+t.end,s>=i&&(t.setCachedOffsets(r,s,0),l[c++]=t),Ep(t,!0),t.right!==Fa&&!Hy(t.right)){o+=t.delta,t=t.right;continue}}return Ep(a.root,!1),l}function hqo(a,i,e,t){let o=a.root,n=0,r=0,s=0,l=t-(e-i);for(;o!==Fa;){if(Hy(o)){Ep(o.left,!1),Ep(o.right,!1),o===o.parent.right&&(n-=o.parent.delta),G5(o),o=o.parent;continue}if(!Hy(o.left)){if(r=n+o.maxEnd,r<i){Ep(o,!0);continue}if(o.left!==Fa){o=o.left;continue}}if(s=n+o.start,s>e){o.start+=l,o.end+=l,o.delta+=l,(o.delta<-1073741824||o.delta>1073741824)&&(a.requestNormalizeDelta=!0),Ep(o,!0);continue}if(Ep(o,!0),o.right!==Fa&&!Hy(o.right)){n+=o.delta,o=o.right;continue}}Ep(a.root,!1)}function gqo(a,i){let e=a.root,t=[],o=0;for(;e!==Fa;){if(Hy(e)){Ep(e.left,!1),Ep(e.right,!1),e=e.parent;continue}if(e.left!==Fa&&!Hy(e.left)){e=e.left;continue}if(e.ownerId===i&&(t[o++]=e),Ep(e,!0),e.right!==Fa&&!Hy(e.right)){e=e.right;continue}}return Ep(a.root,!1),t}function fqo(a){let i=a.root,e=[],t=0;for(;i!==Fa;){if(Hy(i)){Ep(i.left,!1),Ep(i.right,!1),i=i.parent;continue}if(i.left!==Fa&&!Hy(i.left)){i=i.left;continue}if(i.right!==Fa&&!Hy(i.right)){i=i.right;continue}e[t++]=i,Ep(i,!0)}return Ep(a.root,!1),e}function LXi(a,i,e,t,o,n){let r=a.root,s=0,l=0,c=0,u=[],p=0;for(;r!==Fa;){if(Hy(r)){Ep(r.left,!1),Ep(r.right,!1),r===r.parent.right&&(s-=r.parent.delta),r=r.parent;continue}if(r.left!==Fa&&!Hy(r.left)){r=r.left;continue}l=s+r.start,c=s+r.end,r.setCachedOffsets(l,c,o);let h=!0;if(i&&r.ownerId&&r.ownerId!==i&&(h=!1),e&&AXi(r)&&(h=!1),t&&OXi(r)&&(h=!1),n&&!NXi(r)&&(h=!1),h&&(u[p++]=r),Ep(r,!0),r.right!==Fa&&!Hy(r.right)){s+=r.delta,r=r.right;continue}}return Ep(a.root,!1),u}function vqo(a,i,e,t,o,n,r,s){let l=a.root,c=0,u=0,p=0,h=0,g=[],f=0;for(;l!==Fa;){if(Hy(l)){Ep(l.left,!1),Ep(l.right,!1),l===l.parent.right&&(c-=l.parent.delta),l=l.parent;continue}if(!Hy(l.left)){if(u=c+l.maxEnd,u<i){Ep(l,!0);continue}if(l.left!==Fa){l=l.left;continue}}if(p=c+l.start,p>e){Ep(l,!0);continue}if(h=c+l.end,h>=i){l.setCachedOffsets(p,h,r);let v=!0;t&&l.ownerId&&l.ownerId!==t&&(v=!1),o&&AXi(l)&&(v=!1),n&&OXi(l)&&(v=!1),s&&!NXi(l)&&(v=!1),v&&(g[f++]=l)}if(Ep(l,!0),l.right!==Fa&&!Hy(l.right)){c+=l.delta,l=l.right;continue}}return Ep(a.root,!1),g}function MXi(a,i){if(a.root===Fa)return i.parent=Fa,i.left=Fa,i.right=Fa,zp(i,0),a.root=i,a.root;bqo(a,i),TX(i.parent);let e=i;for(;e!==a.root&&TT(e.parent)===1;)if(e.parent===e.parent.parent.left){let t=e.parent.parent.right;TT(t)===1?(zp(e.parent,0),zp(t,0),zp(e.parent.parent,1),e=e.parent.parent):(e===e.parent.right&&(e=e.parent,s8e(a,e)),zp(e.parent,0),zp(e.parent.parent,1),a8e(a,e.parent.parent))}else{let t=e.parent.parent.left;TT(t)===1?(zp(e.parent,0),zp(t,0),zp(e.parent.parent,1),e=e.parent.parent):(e===e.parent.left&&(e=e.parent,a8e(a,e)),zp(e.parent,0),zp(e.parent.parent,1),s8e(a,e.parent.parent))}return zp(a.root,0),i}function bqo(a,i){let e=0,t=a.root,o=i.start,n=i.end;for(;;)if(Iqo(o,n,t.start+e,t.end+e)<0)if(t.left===Fa){i.start-=e,i.end-=e,i.maxEnd-=e,t.left=i;break}else t=t.left;else if(t.right===Fa){i.start-=e+t.delta,i.end-=e+t.delta,i.maxEnd-=e+t.delta,t.right=i;break}else e+=t.delta,t=t.right;i.parent=t,i.left=Fa,i.right=Fa,zp(i,1)}function PXi(a,i){let e,t;if(i.left===Fa?(e=i.right,t=i,e.delta+=i.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),e.start+=i.delta,e.end+=i.delta):i.right===Fa?(e=i.left,t=i):(t=Sqo(i.right),e=t.right,e.start+=t.delta,e.end+=t.delta,e.delta+=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),t.start+=i.delta,t.end+=i.delta,t.delta=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(a.requestNormalizeDelta=!0)),t===a.root){a.root=e,zp(e,0),i.detach(),zai(),G5(e),a.root.parent=Fa;return}let o=TT(t)===1;if(t===t.parent.left?t.parent.left=e:t.parent.right=e,t===i?e.parent=t.parent:(t.parent===i?e.parent=t:e.parent=t.parent,t.left=i.left,t.right=i.right,t.parent=i.parent,zp(t,TT(i)),i===a.root?a.root=t:i===i.parent.left?i.parent.left=t:i.parent.right=t,t.left!==Fa&&(t.left.parent=t),t.right!==Fa&&(t.right.parent=t)),i.detach(),o){TX(e.parent),t!==i&&(TX(t),TX(t.parent)),zai();return}TX(e),TX(e.parent),t!==i&&(TX(t),TX(t.parent));let n;for(;e!==a.root&&TT(e)===0;)e===e.parent.left?(n=e.parent.right,TT(n)===1&&(zp(n,0),zp(e.parent,1),s8e(a,e.parent),n=e.parent.right),TT(n.left)===0&&TT(n.right)===0?(zp(n,1),e=e.parent):(TT(n.right)===0&&(zp(n.left,0),zp(n,1),a8e(a,n),n=e.parent.right),zp(n,TT(e.parent)),zp(e.parent,0),zp(n.right,0),s8e(a,e.parent),e=a.root)):(n=e.parent.left,TT(n)===1&&(zp(n,0),zp(e.parent,1),a8e(a,e.parent),n=e.parent.left),TT(n.left)===0&&TT(n.right)===0?(zp(n,1),e=e.parent):(TT(n.left)===0&&(zp(n.right,0),zp(n,1),s8e(a,n),n=e.parent.left),zp(n,TT(e.parent)),zp(e.parent,0),zp(n.left,0),a8e(a,e.parent),e=a.root));zp(e,0),zai()}function Sqo(a){for(;a.left!==Fa;)a=a.left;return a}function zai(){Fa.parent=Fa,Fa.delta=0,Fa.start=0,Fa.end=0}function s8e(a,i){let e=i.right;e.delta+=i.delta,(e.delta<-1073741824||e.delta>1073741824)&&(a.requestNormalizeDelta=!0),e.start+=i.delta,e.end+=i.delta,i.right=e.left,e.left!==Fa&&(e.left.parent=i),e.parent=i.parent,i.parent===Fa?a.root=e:i===i.parent.left?i.parent.left=e:i.parent.right=e,e.left=i,i.parent=e,G5(i),G5(e)}function a8e(a,i){let e=i.left;i.delta-=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(a.requestNormalizeDelta=!0),i.start-=e.delta,i.end-=e.delta,i.left=e.right,e.right!==Fa&&(e.right.parent=i),e.parent=i.parent,i.parent===Fa?a.root=e:i===i.parent.right?i.parent.right=e:i.parent.left=e,e.right=i,i.parent=e,G5(i),G5(e)}function FXi(a){let i=a.end;if(a.left!==Fa){let e=a.left.maxEnd;e>i&&(i=e)}if(a.right!==Fa){let e=a.right.maxEnd+a.delta;e>i&&(i=e)}return i}function G5(a){a.maxEnd=FXi(a)}function TX(a){for(;a!==Fa;){let i=FXi(a);if(a.maxEnd===i)return;a.maxEnd=i,a=a.parent}}function Iqo(a,i,e,t){return a===e?i-t:a-e}var wl=le("undoRedoService");var l8e=class{constructor(i,e){this.resource=i;this.elements=e}},DX=class a{static{this._ID=0}constructor(){this.id=a._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new a}},pK=class a{static{this._ID=0}constructor(){this.id=a._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}static{this.None=new a}};function NI(a){let i=0,e=0,t=0,o=0;for(let n=0,r=a.length;n<r;n++){let s=a.charCodeAt(n);s===13?(i===0&&(e=n),i++,n+1<r&&a.charCodeAt(n+1)===10?(o|=2,n++):o|=3,t=n+1):s===10&&(o|=1,i===0&&(e=n),i++,t=n+1)}return i===0&&(e=a.length),[i,e,a.length-t,o]}var q5=class a{constructor(i){this.replacements=i;Aw(Nw(i,(e,t)=>e.lineRange.endLineNumberExclusive<=t.lineRange.startLineNumber))}static{this.empty=new a([])}static deserialize(i){return new a(i.map(e=>mK.deserialize(e)))}static fromStringEdit(i,e){let t=lm.fromStringEdit(i,e);return a.fromTextEdit(t,e)}static fromTextEdit(i,e){let t=i.replacements,o=[],n=[];for(let r=0;r<t.length;r++){let s=t[r],l=r+1<t.length?t[r+1]:void 0;if(n.push(s),l&&l.range.startLineNumber===s.range.endLineNumber)continue;let c=ys.joinReplacements(n,e);n.length=0;let u=mK.fromSingleTextEdit(c,e);o.push(u)}return new a(o)}static createFromUnsorted(i){let e=i.slice();return e.sort(Il(t=>t.lineRange.startLineNumber,Hu)),new a(e)}isEmpty(){return this.replacements.length===0}toEdit(i){let e=[];for(let t of this.replacements){let o=t.toSingleEdit(i);e.push(o)}return new Ad(e)}toString(){return this.replacements.map(i=>i.toString()).join(",")}serialize(){return this.replacements.map(i=>i.serialize())}getNewLineRanges(){let i=[],e=0;for(let t of this.replacements)i.push(vo.ofLength(t.lineRange.startLineNumber+e,t.newLines.length)),e+=t.newLines.length-t.lineRange.length;return i}mapLineNumber(i){let e=0;for(let t of this.replacements){if(t.lineRange.endLineNumberExclusive>i)break;e+=t.newLines.length-t.lineRange.length}return i+e}mapLineRange(i){return new vo(this.mapLineNumber(i.startLineNumber),this.mapLineNumber(i.endLineNumberExclusive))}mapBackLineRange(i,e){return this.inverse(e).mapLineRange(i)}touches(i){return this.replacements.some(e=>i.replacements.some(t=>e.lineRange.intersect(t.lineRange)))}rebase(i){return new a(this.replacements.map(e=>new mK(i.mapLineRange(e.lineRange),e.newLines)))}humanReadablePatch(i){let e=[];function t(s,l,c,u){let p=c==="unmodified"?" ":c==="deleted"?"-":"+";u===void 0&&(u="[[[[[ WARNING: LINE DOES NOT EXIST ]]]]]");let h=s===-1?"   ":s.toString().padStart(3," "),g=l===-1?"   ":l.toString().padStart(3," ");e.push(`${p} ${h} ${g} ${u}`)}function o(){e.push("---")}let n=0,r=!0;for(let s of iY(this.replacements,(l,c)=>l.lineRange.distanceToRange(c.lineRange)<=5)){r?r=!1:o();let l=s[0].lineRange.startLineNumber-2;for(let c of s){for(let h=Math.max(1,l);h<c.lineRange.startLineNumber;h++)t(h,h+n,"unmodified",i[h-1]);let u=c.lineRange,p=c.newLines;for(let h of u.mapToLineArray(g=>g)){let g=i[h-1];t(h,-1,"deleted",g)}for(let h=0;h<p.length;h++){let g=p[h];t(-1,u.startLineNumber+n+h,"added",g)}l=u.endLineNumberExclusive,n+=c.newLines.length-c.lineRange.length}for(let c=l;c<=Math.min(l+2,i.length);c++)t(c,c+n,"unmodified",i[c-1])}return e.join(`
`)}apply(i){let e=[],t=0;for(let o of this.replacements){for(;t<o.lineRange.startLineNumber-1;)e.push(i[t]),t++;for(let n of o.newLines)e.push(n);t=o.lineRange.endLineNumberExclusive-1}for(;t<i.length;)e.push(i[t]),t++;return e}inverse(i){let e=this.getNewLineRanges();return new a(this.replacements.map((t,o)=>new mK(e[o],i.slice(t.lineRange.startLineNumber-1,t.lineRange.endLineNumberExclusive-1))))}},mK=class a{constructor(i,e){this.lineRange=i;this.newLines=e}static deserialize(i){return new a(vo.ofLength(i[0],i[1]-i[0]),i[2])}static fromSingleTextEdit(i,e){let t=Hc(i.text),o=i.range.startLineNumber,n=e.getValueOfRange(G.fromPositions(new ye(i.range.startLineNumber,1),i.range.getStartPosition()));t[0]=n+t[0];let r=i.range.endLineNumber+1,s=e.getTransformer().getLineLength(i.range.endLineNumber)+1,l=e.getValueOfRange(G.fromPositions(i.range.getEndPosition(),new ye(i.range.endLineNumber,s)));t[t.length-1]=t[t.length-1]+l;let c=i.range.startColumn===e.getTransformer().getLineLength(i.range.startLineNumber)+1,u=i.range.endColumn===1;return c&&t[0].length===n.length&&(o++,t.shift()),t.length>0&&o<r&&u&&t[t.length-1].length===l.length&&(r--,t.pop()),new a(new vo(o,r),t)}toSingleTextEdit(i){if(this.newLines.length===0){let e=i.getTransformer().textLength;if(this.lineRange.endLineNumberExclusive===e.lineCount+2){let t;if(this.lineRange.startLineNumber>1){let n=this.lineRange.startLineNumber-1,r=i.getTransformer().getLineLength(n)+1;t=new ye(n,r)}else t=new ye(1,1);let o=e.addToPosition(new ye(1,1));return new ys(G.fromPositions(t,o),"")}else return new ys(new G(this.lineRange.startLineNumber,1,this.lineRange.endLineNumberExclusive,1),"")}else if(this.lineRange.isEmpty){let e,t,o,n=this.lineRange.startLineNumber;return n===i.getTransformer().textLength.lineCount+2?(e=n-1,t=i.getTransformer().getLineLength(e)+1,o=this.newLines.map(r=>`
`+r).join("")):(e=n,t=1,o=this.newLines.map(r=>r+`
`).join("")),new ys(G.fromPositions(new ye(e,t)),o)}else{let e=this.lineRange.endLineNumberExclusive-1,t=i.getTransformer().getLineLength(e)+1,o=new G(this.lineRange.startLineNumber,1,e,t),n=this.newLines.join(`
`);return new ys(o,n)}}toSingleEdit(i){let e=this.toSingleTextEdit(i),t=i.getTransformer().getOffsetRange(e.range);return new xd(t,e.text)}toString(){return`${this.lineRange}->${JSON.stringify(this.newLines)}`}serialize(){return[this.lineRange.startLineNumber,this.lineRange.endLineNumberExclusive,this.newLines]}removeCommonSuffixPrefixLines(i){let e=this.lineRange.startLineNumber,t=this.lineRange.endLineNumberExclusive,o=0;for(;e<t&&o<this.newLines.length&&this.newLines[o]===i.getLineAt(e);)e++,o++;let n=0;for(;e<t&&n+o<this.newLines.length&&this.newLines[this.newLines.length-1-n]===i.getLineAt(t-1);)t--,n++;return o===0&&n===0?this:new a(new vo(e,t),this.newLines.slice(o,this.newLines.length-n))}toLineEdit(){return new q5([this])}},yqo;(i=>{function a(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="number"&&typeof e[1]=="number"&&Array.isArray(e[2])&&e[2].every(t=>typeof t=="string")}i.is=a})(yqo||={});var wqo=Symbol("TextModelEditSource"),c8e=class{constructor(i,e){this.metadata=i}toString(){return`${this.metadata.source}`}getType(){let i=this.metadata;switch(i.source){case"cursor":return i.kind;case"inlineCompletionAccept":return i.source+(i.$nes?":nes":"");case"unknown":return i.name||"unknown";default:return i.source}}toKey(i,e={}){let t=this.metadata;return Object.entries(t).filter(([n,r])=>{let s=e[n];return s!==void 0?s:(n.match(/\$/g)||[]).length<=i&&r!==void 0&&r!==null&&r!==""}).map(([n,r])=>`${n}:${r}`).join("-")}get props(){return this.metadata}};function _T(a){return new c8e(a,wqo)}function VXi(a){switch(a.metadata.source){case"inlineCompletionAccept":case"inlineCompletionPartialAccept":case"inlineChat.applyEdits":case"Chat.applyEdits":return!0}return!1}function BXi(a){return a.metadata.source==="cursor"?a.metadata.kind==="type":!1}var sd={unknown(a){return _T({source:"unknown",name:a.name})},rename:(a,i)=>_T({source:"rename",$$$oldName:a,$$$newName:i}),chatApplyEdits(a){return _T({source:"Chat.applyEdits",$modelId:WXi(a.modelId),$extensionId:a.extensionId?.extensionId,$extensionVersion:a.extensionId?.version,$$languageId:a.languageId,$$sessionId:a.sessionId,$$requestId:a.requestId,$$mode:a.mode,$$codeBlockSuggestionId:a.codeBlockSuggestionId})},chatUndoEdits:()=>_T({source:"Chat.undoEdits"}),chatReset:()=>_T({source:"Chat.reset"}),inlineCompletionAccept(a){return _T({source:"inlineCompletionAccept",$nes:a.nes,...wCt(a.providerId),$$correlationId:a.correlationId,$$requestUuid:a.requestUuid,$$languageId:a.languageId})},inlineCompletionPartialAccept(a){return _T({source:"inlineCompletionPartialAccept",type:a.type,$nes:a.nes,...wCt(a.providerId),$$correlationId:a.correlationId,$$requestUuid:a.requestUuid,$$languageId:a.languageId})},inlineChatApplyEdit(a){return _T({source:"inlineChat.applyEdits",$modelId:WXi(a.modelId),$extensionId:a.extensionId?.extensionId,$extensionVersion:a.extensionId?.version,$$sessionId:a.sessionId,$$requestId:a.requestId,$$languageId:a.languageId})},reloadFromDisk:()=>_T({source:"reloadFromDisk"}),cursor(a){return _T({source:"cursor",kind:a.kind,detailedSource:a.detailedSource})},setValue:()=>_T({source:"setValue"}),eolChange:()=>_T({source:"eolChange"}),applyEdits:()=>_T({source:"applyEdits"}),snippet:()=>_T({source:"snippet"}),suggest:a=>_T({source:"suggest",...wCt(a.providerId)}),codeAction:a=>_T({source:"codeAction",$kind:a.kind,...wCt(a.providerId)})};function wCt(a){return a?{$extensionId:a.extensionId,$extensionVersion:a.extensionVersion,$providerId:a.providerId}:{}}function WXi(a){if(a!==void 0)return a.replaceAll("/","|")}var Uy=class a{constructor(i,e,t,o){this.linesAdded=i;this.linesRemoved=e;this.charsAdded=t;this.charsRemoved=o}static fromText(i){let e=Rc.ofText(i).lineCount,t=i.length;return new a(e,0,t,0)}static fromEdit(i,e){let t=q5.fromStringEdit(i,e),o=Pw(t.replacements,l=>l.newLines.length),n=Pw(t.replacements,l=>l.lineRange.length),r=Pw(i.replacements,l=>l.getNewLength()),s=Pw(i.replacements,l=>l.replaceRange.length);return new a(o,n,r,s)}static tryCreate(i,e,t,o){if(!(i===void 0||e===void 0||t===void 0||o===void 0))return new a(i,e,t,o)}},Kai;(i=>{function a(e){let t=e?e("sgt"):Ayt("sgt");return t}i.newId=a})(Kai||={});var d8e=class{constructor(i,e,t,o){this.range=i;this.nestingLevel=e;this.nestingLevelOfEqualBracketType=t;this.isInvalid=o}},Gai=class{constructor(i,e,t,o,n,r){this.range=i;this.openingBracketRange=e;this.closingBracketRange=t;this.nestingLevel=o;this.nestingLevelOfEqualBracketType=n;this.bracketPairNode=r}get openingBracketInfo(){return this.bracketPairNode.openingBracket.bracketInfo}get closingBracketInfo(){return this.bracketPairNode.closingBracket?.bracketInfo}},CCt=class extends Gai{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r,s);this.minVisibleColumnIndentation=l}};function HXi(a,i,e,t){return a!==e?oh(e-a,t):oh(0,t-i)}var Ub=0;function Kxe(a){return a===0}var QL=2**26;function oh(a,i){return a*QL+i}function Bk(a){let i=a,e=Math.floor(i/QL),t=i-e*QL;return new Rc(e,t)}function UXi(a){return Math.floor(a/QL)}function _u(a,i){let e=a+i;return i>=QL&&(e=e-a%QL),e}function zXi(a,i){return a.reduce((e,t)=>_u(e,i(t)),Ub)}function qai(a,i){return a===i}function mde(a,i){let e=a,t=i;if(t-e<=0)return Ub;let n=Math.floor(e/QL),r=Math.floor(t/QL),s=t-r*QL;if(n===r){let l=e-n*QL;return oh(0,s-l)}else return oh(r-n,s)}function $5(a,i){return a<i}function RX(a,i){return a<=i}function Gxe(a,i){return a>=i}function LX(a){return oh(a.lineNumber-1,a.column-1)}function MX(a,i){let e=a,t=Math.floor(e/QL),o=e-t*QL,n=i,r=Math.floor(n/QL),s=n-r*QL;return new G(t+1,o+1,r+1,s+1)}function KXi(a){let i=Hc(a);return oh(i.length-1,i[i.length-1].length)}var xCt=[],jw=class a{constructor(i,e){this.items=i;this.additionalItems=e}static{this.cache=new Array(129)}static create(i,e){if(i<=128&&e.length===0){let t=a.cache[i];return t||(t=new a(i,e),a.cache[i]=t),t}return new a(i,e)}static{this.empty=a.create(0,xCt)}static getEmpty(){return this.empty}add(i,e){let t=e.getKey(i),o=t>>5;if(o===0){let r=1<<t|this.items;return r===this.items?this:a.create(r,this.additionalItems)}o--;let n=this.additionalItems.slice(0);for(;n.length<o;)n.push(0);return n[o]|=1<<(t&31),a.create(this.items,n)}has(i,e){let t=e.getKey(i),o=t>>5;return o===0?(this.items&1<<t)!==0:(o--,((this.additionalItems[o]||0)&1<<(t&31))!==0)}merge(i){let e=this.items|i.items;if(this.additionalItems===xCt&&i.additionalItems===xCt)return e===this.items?this:e===i.items?i:a.create(e,xCt);let t=[];for(let o=0;o<Math.max(this.additionalItems.length,i.additionalItems.length);o++){let n=this.additionalItems[o]||0,r=i.additionalItems[o]||0;t.push(n|r)}return a.create(e,t)}intersects(i){if((this.items&i.items)!==0)return!0;for(let e=0;e<Math.min(this.additionalItems.length,i.additionalItems.length);e++)if((this.additionalItems[e]&i.additionalItems[e])!==0)return!0;return!1}equals(i){if(this.items!==i.items||this.additionalItems.length!==i.additionalItems.length)return!1;for(let e=0;e<this.additionalItems.length;e++)if(this.additionalItems[e]!==i.additionalItems[e])return!1;return!0}},$ai={getKey(a){return a}},qxe=class{constructor(){this.items=new Map}getKey(i){let e=this.items.get(i);return e===void 0&&(e=this.items.size,this.items.set(i,e)),e}reverseLookup(i){return[...this.items].find(([e,t])=>t===i)?.[0]}reverseLookupSet(i){let e=[];for(let[t]of this.items)i.has(t,this)&&e.push(t);return e}keys(){return this.items.keys()}};var u8e=class{get length(){return this._length}constructor(i){this._length=i}},p8e=class a extends u8e{constructor(e,t,o,n,r){super(e);this.openingBracket=t;this.child=o;this.closingBracket=n;this.missingOpeningBracketIds=r}static create(e,t,o){let n=e.length;return t&&(n=_u(n,t.length)),o&&(n=_u(n,o.length)),new a(n,e,t,o,t?t.missingOpeningBracketIds:jw.getEmpty())}get kind(){return 2}get listHeight(){return 0}get childrenLength(){return 3}getChild(e){switch(e){case 0:return this.openingBracket;case 1:return this.child;case 2:return this.closingBracket}throw new Error("Invalid child index")}get children(){let e=[];return e.push(this.openingBracket),this.child&&e.push(this.child),this.closingBracket&&e.push(this.closingBracket),e}canBeReused(e){return!(this.closingBracket===null||e.intersects(this.missingOpeningBracketIds))}flattenLists(){return a.create(this.openingBracket.flattenLists(),this.child&&this.child.flattenLists(),this.closingBracket&&this.closingBracket.flattenLists())}deepClone(){return new a(this.length,this.openingBracket.deepClone(),this.child&&this.child.deepClone(),this.closingBracket&&this.closingBracket.deepClone(),this.missingOpeningBracketIds)}computeMinIndentation(e,t){return this.child?this.child.computeMinIndentation(_u(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}},YL=class a extends u8e{constructor(e,t,o){super(e);this.listHeight=t;this._missingOpeningBracketIds=o;this.cachedMinIndentation=-1}static create23(e,t,o,n=!1){let r=e.length,s=e.missingOpeningBracketIds;if(e.listHeight!==t.listHeight)throw new Error("Invalid list heights");if(r=_u(r,t.length),s=s.merge(t.missingOpeningBracketIds),o){if(e.listHeight!==o.listHeight)throw new Error("Invalid list heights");r=_u(r,o.length),s=s.merge(o.missingOpeningBracketIds)}return n?new jai(r,e.listHeight+1,e,t,o,s):new m8e(r,e.listHeight+1,e,t,o,s)}static create(e,t=!1){if(e.length===0)return this.getEmpty();{let o=e[0].length,n=e[0].missingOpeningBracketIds;for(let r=1;r<e.length;r++)o=_u(o,e[r].length),n=n.merge(e[r].missingOpeningBracketIds);return t?new kCt(o,e[0].listHeight+1,e,n):new h8e(o,e[0].listHeight+1,e,n)}}static getEmpty(){return new kCt(Ub,0,[],jw.getEmpty())}get kind(){return 4}get missingOpeningBracketIds(){return this._missingOpeningBracketIds}throwIfImmutable(){}makeLastElementMutable(){this.throwIfImmutable();let e=this.childrenLength;if(e===0)return;let t=this.getChild(e-1),o=t.kind===4?t.toMutable():t;return t!==o&&this.setChild(e-1,o),o}makeFirstElementMutable(){if(this.throwIfImmutable(),this.childrenLength===0)return;let t=this.getChild(0),o=t.kind===4?t.toMutable():t;return t!==o&&this.setChild(0,o),o}canBeReused(e){if(e.intersects(this.missingOpeningBracketIds)||this.childrenLength===0)return!1;let t=this;for(;t.kind===4;){let o=t.childrenLength;if(o===0)throw new ci;t=t.getChild(o-1)}return t.canBeReused(e)}handleChildrenChanged(){this.throwIfImmutable();let e=this.childrenLength,t=this.getChild(0).length,o=this.getChild(0).missingOpeningBracketIds;for(let n=1;n<e;n++){let r=this.getChild(n);t=_u(t,r.length),o=o.merge(r.missingOpeningBracketIds)}this._length=t,this._missingOpeningBracketIds=o,this.cachedMinIndentation=-1}flattenLists(){let e=[];for(let t of this.children){let o=t.flattenLists();o.kind===4?e.push(...o.children):e.push(o)}return a.create(e)}computeMinIndentation(e,t){if(this.cachedMinIndentation!==-1)return this.cachedMinIndentation;let o=Number.MAX_SAFE_INTEGER,n=e;for(let r=0;r<this.childrenLength;r++){let s=this.getChild(r);s&&(o=Math.min(o,s.computeMinIndentation(n,t)),n=_u(n,s.length))}return this.cachedMinIndentation=o,o}},m8e=class a extends YL{constructor(e,t,o,n,r,s){super(e,t,s);this._item1=o;this._item2=n;this._item3=r}get childrenLength(){return this._item3!==null?3:2}getChild(e){switch(e){case 0:return this._item1;case 1:return this._item2;case 2:return this._item3}throw new Error("Invalid child index")}setChild(e,t){switch(e){case 0:this._item1=t;return;case 1:this._item2=t;return;case 2:this._item3=t;return}throw new Error("Invalid child index")}get children(){return this._item3?[this._item1,this._item2,this._item3]:[this._item1,this._item2]}get item1(){return this._item1}get item2(){return this._item2}get item3(){return this._item3}deepClone(){return new a(this.length,this.listHeight,this._item1.deepClone(),this._item2.deepClone(),this._item3?this._item3.deepClone():null,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){if(this._item3)throw new Error("Cannot append to a full (2,3) tree node");this.throwIfImmutable(),this._item3=e,this.handleChildrenChanged()}unappendChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();let e=this._item3;return this._item3=null,this.handleChildrenChanged(),e}prependChildOfSameHeight(e){if(this._item3)throw new Error("Cannot prepend to a full (2,3) tree node");this.throwIfImmutable(),this._item3=this._item2,this._item2=this._item1,this._item1=e,this.handleChildrenChanged()}unprependChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();let e=this._item1;return this._item1=this._item2,this._item2=this._item3,this._item3=null,this.handleChildrenChanged(),e}toMutable(){return this}},jai=class extends m8e{toMutable(){return new m8e(this.length,this.listHeight,this.item1,this.item2,this.item3,this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}},h8e=class a extends YL{constructor(e,t,o,n){super(e,t,n);this._children=o}get childrenLength(){return this._children.length}getChild(e){return this._children[e]}setChild(e,t){this._children[e]=t}get children(){return this._children}deepClone(){let e=new Array(this._children.length);for(let t=0;t<this._children.length;t++)e[t]=this._children[t].deepClone();return new a(this.length,this.listHeight,e,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){this.throwIfImmutable(),this._children.push(e),this.handleChildrenChanged()}unappendChild(){this.throwIfImmutable();let e=this._children.pop();return this.handleChildrenChanged(),e}prependChildOfSameHeight(e){this.throwIfImmutable(),this._children.unshift(e),this.handleChildrenChanged()}unprependChild(){this.throwIfImmutable();let e=this._children.shift();return this.handleChildrenChanged(),e}toMutable(){return this}},kCt=class extends h8e{toMutable(){return new h8e(this.length,this.listHeight,[...this.children],this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}},Cqo=[],g8e=class extends u8e{get listHeight(){return 0}get childrenLength(){return 0}getChild(i){return null}get children(){return Cqo}flattenLists(){return this}deepClone(){return this}},BB=class extends g8e{get kind(){return 0}get missingOpeningBracketIds(){return jw.getEmpty()}canBeReused(i){return!0}computeMinIndentation(i,e){let t=Bk(i),o=(t.columnCount===0?t.lineCount:t.lineCount+1)+1,n=UXi(_u(i,this.length))+1,r=Number.MAX_SAFE_INTEGER;for(let s=o;s<=n;s++){let l=e.getLineFirstNonWhitespaceColumn(s),c=e.getLineContent(s);if(l===0)continue;let u=Ll.visibleColumnFromColumn(c,l,e.getOptions().tabSize);r=Math.min(r,u)}return r}},f8e=class a extends g8e{constructor(e,t,o){super(e);this.bracketInfo=t;this.bracketIds=o}static create(e,t,o){return new a(e,t,o)}get kind(){return 1}get missingOpeningBracketIds(){return jw.getEmpty()}get text(){return this.bracketInfo.bracketText}get languageId(){return this.bracketInfo.languageId}canBeReused(e){return!1}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}},ECt=class extends g8e{get kind(){return 3}constructor(i,e){super(e),this.missingOpeningBracketIds=i}canBeReused(i){return!i.intersects(this.missingOpeningBracketIds)}computeMinIndentation(i,e){return Number.MAX_SAFE_INTEGER}};var HF=class a{constructor(i,e,t){this.startOffset=i;this.endOffset=e;this.newLength=t}static fromModelContentChanges(i){return i.map(t=>{let o=G.lift(t.range);return new a(LX(o.getStartPosition()),LX(o.getEndPosition()),KXi(t.text))}).reverse()}toString(){return`[${Bk(this.startOffset)}...${Bk(this.endOffset)}) -> ${Bk(this.newLength)}`}},TCt=class{constructor(i){this.nextEditIdx=0;this.deltaOldToNewLineCount=0;this.deltaOldToNewColumnCount=0;this.deltaLineIdxInOld=-1;this.edits=i.map(e=>Qai.from(e))}getOffsetBeforeChange(i){return this.adjustNextEdit(i),this.translateCurToOld(i)}getDistanceToNextChange(i){this.adjustNextEdit(i);let e=this.edits[this.nextEditIdx],t=e?this.translateOldToCur(e.offsetObj):null;return t===null?null:mde(i,t)}translateOldToCur(i){return i.lineCount===this.deltaLineIdxInOld?oh(i.lineCount+this.deltaOldToNewLineCount,i.columnCount+this.deltaOldToNewColumnCount):oh(i.lineCount+this.deltaOldToNewLineCount,i.columnCount)}translateCurToOld(i){let e=Bk(i);return e.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?oh(e.lineCount-this.deltaOldToNewLineCount,e.columnCount-this.deltaOldToNewColumnCount):oh(e.lineCount-this.deltaOldToNewLineCount,e.columnCount)}adjustNextEdit(i){for(;this.nextEditIdx<this.edits.length;){let e=this.edits[this.nextEditIdx],t=this.translateOldToCur(e.endOffsetAfterObj);if(RX(t,i)){this.nextEditIdx++;let o=Bk(t),n=Bk(this.translateOldToCur(e.endOffsetBeforeObj)),r=o.lineCount-n.lineCount;this.deltaOldToNewLineCount+=r;let s=this.deltaLineIdxInOld===e.endOffsetBeforeObj.lineCount?this.deltaOldToNewColumnCount:0,l=o.columnCount-n.columnCount;this.deltaOldToNewColumnCount=s+l,this.deltaLineIdxInOld=e.endOffsetBeforeObj.lineCount}else break}}},Qai=class a{static from(i){return new a(i.startOffset,i.endOffset,i.newLength)}constructor(i,e,t){this.endOffsetBeforeObj=Bk(e),this.endOffsetAfterObj=Bk(_u(i,t)),this.offsetObj=Bk(i)}};var HB=class{constructor(i,e,t,o,n){this.length=i;this.kind=e;this.bracketId=t;this.bracketIds=o;this.astNode=n}},$xe=class{constructor(i,e){this.textModel=i;this.bracketTokens=e;this.reader=new Yai(this.textModel,this.bracketTokens),this._offset=Ub,this.didPeek=!1,this.peeked=null,this.textBufferLineCount=i.getLineCount(),this.textBufferLastLineLength=i.getLineLength(this.textBufferLineCount)}get offset(){return this._offset}get length(){return oh(this.textBufferLineCount-1,this.textBufferLastLineLength)}getText(){return this.textModel.getValue()}skip(i){this.didPeek=!1,this._offset=_u(this._offset,i);let e=Bk(this._offset);this.reader.setPosition(e.lineCount,e.columnCount)}read(){let i;return this.peeked?(this.didPeek=!1,i=this.peeked):i=this.reader.read(),i&&(this._offset=_u(this._offset,i.length)),i}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}},Yai=class{constructor(i,e){this.textModel=i;this.bracketTokens=e;this.lineIdx=0;this.line=null;this.lineCharOffset=0;this.lineTokens=null;this.lineTokenOffset=0;this.peekedToken=null;this.textBufferLineCount=i.getLineCount(),this.textBufferLastLineLength=i.getLineLength(this.textBufferLineCount)}setPosition(i,e){i===this.lineIdx?(this.lineCharOffset=e,this.line!==null&&(this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset))):(this.lineIdx=i,this.lineCharOffset=e,this.line=null),this.peekedToken=null}read(){if(this.peekedToken){let n=this.peekedToken;return this.peekedToken=null,this.lineCharOffset+=n.length,n}if(this.lineIdx>this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;this.line===null&&(this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));let i=this.lineIdx,e=this.lineCharOffset,t=0;for(;;){let n=this.lineTokens,r=n.getCount(),s=null;if(this.lineTokenOffset<r){let l=n.getMetadata(this.lineTokenOffset);for(;this.lineTokenOffset+1<r&&l===n.getMetadata(this.lineTokenOffset+1);)this.lineTokenOffset++;let c=Vp.getTokenType(l)===0,u=Vp.containsBalancedBrackets(l),p=n.getEndOffset(this.lineTokenOffset);if(u&&c&&this.lineCharOffset<p){let h=n.getLanguageId(this.lineTokenOffset),g=this.line.substring(this.lineCharOffset,p),f=this.bracketTokens.getSingleLanguageBracketTokens(h),v=f.regExpGlobal;if(v){v.lastIndex=0;let b=v.exec(g);b&&(s=f.getToken(b[0]),s&&(this.lineCharOffset+=b.index))}}if(t+=p-this.lineCharOffset,s)if(i!==this.lineIdx||e!==this.lineCharOffset){this.peekedToken=s;break}else return this.lineCharOffset+=s.length,s;else this.lineTokenOffset++,this.lineCharOffset=p}else if(this.lineIdx===this.textBufferLineCount-1||(this.lineIdx++,this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.lineTokenOffset=0,this.line=this.lineTokens.getLineContent(),this.lineCharOffset=0,t+=33,t>1e3))break;if(t>1500)break}let o=HXi(i,e,this.lineIdx,this.lineCharOffset);return new HB(o,0,-1,jw.getEmpty(),new BB(o))}},_Ct=class{constructor(i,e){this.text=i;this._offset=Ub;this.idx=0;let t=e.getRegExpStr(),o=t?new RegExp(t+`|
`,"gi"):null,n=[],r,s=0,l=0,c=0,u=0,p=[];for(let f=0;f<60;f++)p.push(new HB(oh(0,f),0,-1,jw.getEmpty(),new BB(oh(0,f))));let h=[];for(let f=0;f<60;f++)h.push(new HB(oh(1,f),0,-1,jw.getEmpty(),new BB(oh(1,f))));if(o)for(o.lastIndex=0;(r=o.exec(i))!==null;){let f=r.index,v=r[0];if(v===`
`)s++,l=f+1;else{if(c!==f){let b;if(u===s){let S=f-c;if(S<p.length)b=p[S];else{let y=oh(0,S);b=new HB(y,0,-1,jw.getEmpty(),new BB(y))}}else{let S=s-u,y=f-l;if(S===1&&y<h.length)b=h[y];else{let w=oh(S,y);b=new HB(w,0,-1,jw.getEmpty(),new BB(w))}}n.push(b)}n.push(e.getToken(v)),c=f+v.length,u=s}}let g=i.length;if(c!==g){let f=u===s?oh(0,g-c):oh(s-u,g-l);n.push(new HB(f,0,-1,jw.getEmpty(),new BB(f)))}this.length=oh(s,g-l),this.tokens=n}get offset(){return this._offset}read(){return this.tokens[this.idx++]||null}peek(){return this.tokens[this.idx]||null}skip(i){throw new Pj}getText(){return this.text}};var Xai=class a{constructor(i){this.map=i;this.hasRegExp=!1;this._regExpGlobal=null}static createFromLanguage(i,e){function t(n){return e.getKey(`${n.languageId}:::${n.bracketText}`)}let o=new Map;for(let n of i.bracketsNew.openingBrackets){let r=oh(0,n.bracketText.length),s=t(n),l=jw.getEmpty().add(s,$ai);o.set(n.bracketText,new HB(r,1,s,l,f8e.create(r,n,l)))}for(let n of i.bracketsNew.closingBrackets){let r=oh(0,n.bracketText.length),s=jw.getEmpty(),l=n.getOpeningBrackets();for(let c of l)s=s.add(t(c),$ai);o.set(n.bracketText,new HB(r,2,t(l[0]),s,f8e.create(r,n,s)))}return new a(o)}getRegExpStr(){if(this.isEmpty)return null;{let i=[...this.map.keys()];return i.sort(),i.reverse(),i.map(e=>Eqo(e)).join("|")}}get regExpGlobal(){if(!this.hasRegExp){let i=this.getRegExpStr();this._regExpGlobal=i?new RegExp(i,"gi"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(i){return this.map.get(i.toLowerCase())}findClosingTokenText(i){for(let[e,t]of this.map)if(t.kind===2&&t.bracketIds.intersects(i))return e}get isEmpty(){return this.map.size===0}};function Eqo(a){let i=Ss(a);return/^[\w ]+/.test(a)&&(i=`\\b${i}`),/[\w ]+$/.test(a)&&(i=`${i}\\b`),i}var jxe=class{constructor(i,e){this.denseKeyProvider=i;this.getLanguageConfiguration=e;this.languageIdToBracketTokens=new Map}didLanguageChange(i){return this.languageIdToBracketTokens.has(i)}getSingleLanguageBracketTokens(i){let e=this.languageIdToBracketTokens.get(i);return e||(e=Xai.createFromLanguage(this.getLanguageConfiguration(i),this.denseKeyProvider),this.languageIdToBracketTokens.set(i,e)),e}getToken(i,e){return this.getSingleLanguageBracketTokens(e).getToken(i)}};function qXi(a){if(a.length===0)return null;if(a.length===1)return a[0];let i=0;function e(){if(i>=a.length)return null;let r=i,s=a[r].listHeight;for(i++;i<a.length&&a[i].listHeight===s;)i++;return i-r>=2?eli(r===0&&i===a.length?a:a.slice(r,i),!1):a[r]}let t=e(),o=e();if(!o)return t;for(let r=e();r;r=e())GXi(t,o)<=GXi(o,r)?(t=Jai(t,o),o=r):o=Jai(o,r);return Jai(t,o)}function eli(a,i=!1){if(a.length===0)return null;if(a.length===1)return a[0];let e=a.length;for(;e>3;){let t=e>>1;for(let o=0;o<t;o++){let n=o<<1;a[o]=YL.create23(a[n],a[n+1],n+3===e?a[n+2]:null,i)}e=t}return YL.create23(a[0],a[1],e>=3?a[2]:null,i)}function GXi(a,i){return Math.abs(a.listHeight-i.listHeight)}function Jai(a,i){return a.listHeight===i.listHeight?YL.create23(a,i,null,!1):a.listHeight>i.listHeight?Tqo(a,i):_qo(i,a)}function Tqo(a,i){a=a.toMutable();let e=a,t=[],o;for(;;){if(i.listHeight===e.listHeight){o=i;break}if(e.kind!==4)throw new Error("unexpected");t.push(e),e=e.makeLastElementMutable()}for(let n=t.length-1;n>=0;n--){let r=t[n];o?r.childrenLength>=3?o=YL.create23(r.unappendChild(),o,null,!1):(r.appendChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?YL.create23(a,o,null,!1):a}function _qo(a,i){a=a.toMutable();let e=a,t=[];for(;i.listHeight!==e.listHeight;){if(e.kind!==4)throw new Error("unexpected");t.push(e),e=e.makeFirstElementMutable()}let o=i;for(let n=t.length-1;n>=0;n--){let r=t[n];o?r.childrenLength>=3?o=YL.create23(o,r.unprependChild(),null,!1):(r.prependChildOfSameHeight(o),o=void 0):r.handleChildrenChanged()}return o?YL.create23(o,a,null,!1):a}var DCt=class{constructor(i){this.lastOffset=Ub;this.nextNodes=[i],this.offsets=[Ub],this.idxs=[]}readLongestNodeAt(i,e){if($5(i,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=i;;){let t=v8e(this.nextNodes);if(!t)return;let o=v8e(this.offsets);if($5(i,o))return;if($5(o,i))if(_u(o,t.length)<=i)this.nextNodeAfterCurrent();else{let n=tli(t);n!==-1?(this.nextNodes.push(t.getChild(n)),this.offsets.push(o),this.idxs.push(n)):this.nextNodeAfterCurrent()}else{if(e(t))return this.nextNodeAfterCurrent(),t;{let n=tli(t);if(n===-1){this.nextNodeAfterCurrent();return}else this.nextNodes.push(t.getChild(n)),this.offsets.push(o),this.idxs.push(n)}}}}nextNodeAfterCurrent(){for(;;){let i=v8e(this.offsets),e=v8e(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;let t=v8e(this.nextNodes),o=tli(t,this.idxs[this.idxs.length-1]);if(o!==-1){this.nextNodes.push(t.getChild(o)),this.offsets.push(_u(i,e.length)),this.idxs[this.idxs.length-1]=o;break}else this.idxs.pop()}}};function tli(a,i=-1){for(;;){if(i++,i>=a.childrenLength)return-1;if(a.getChild(i))return i}}function v8e(a){return a.length>0?a[a.length-1]:void 0}function b8e(a,i,e,t){return new ili(a,i,e,t).parseDocument()}var ili=class{constructor(i,e,t,o){this.tokenizer=i;this.createImmutableLists=o;this._itemsConstructed=0;this._itemsFromCache=0;if(t&&o)throw new Error("Not supported");this.oldNodeReader=t?new DCt(t):void 0,this.positionMapper=new TCt(e)}get nodesConstructed(){return this._itemsConstructed}get nodesReused(){return this._itemsFromCache}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let i=this.parseList(jw.getEmpty(),0);return i||(i=YL.getEmpty()),i}parseList(i,e){let t=[];for(;;){let n=this.tryReadChildFromCache(i);if(!n){let r=this.tokenizer.peek();if(!r||r.kind===2&&r.bracketIds.intersects(i))break;n=this.parseChild(i,e+1)}n.kind===4&&n.childrenLength===0||t.push(n)}return this.oldNodeReader?qXi(t):eli(t,this.createImmutableLists)}tryReadChildFromCache(i){if(this.oldNodeReader){let e=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(e===null||!Kxe(e)){let t=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),o=>e!==null&&!$5(o.length,e)?!1:o.canBeReused(i));if(t)return this._itemsFromCache++,this.tokenizer.skip(t.length),t}}}parseChild(i,e){this._itemsConstructed++;let t=this.tokenizer.read();switch(t.kind){case 2:return new ECt(t.bracketIds,t.length);case 0:return t.astNode;case 1:{if(e>300)return new BB(t.length);let o=i.merge(t.bracketIds),n=this.parseList(o,e+1),r=this.tokenizer.peek();return r&&r.kind===2&&(r.bracketId===t.bracketId||r.bracketIds.intersects(t.bracketIds))?(this.tokenizer.read(),p8e.create(t.astNode,n,r.astNode)):p8e.create(t.astNode,n,null)}default:throw new Error("unexpected")}}};function Qxe(a,i){if(a.length===0)return i;if(i.length===0)return a;let e=new nT($Xi(a)),t=$Xi(i);t.push({modified:!1,lengthBefore:void 0,lengthAfter:void 0});let o=e.dequeue();function n(c){if(c===void 0){let p=e.takeWhile(h=>!0)||[];return o&&p.unshift(o),p}let u=[];for(;o&&!Kxe(c);){let[p,h]=o.splitAt(c);u.push(p),c=mde(p.lengthAfter,c),o=h??e.dequeue()}return Kxe(c)||u.push(new S8e(!1,c,c)),u}let r=[];function s(c,u,p){if(r.length>0&&qai(r[r.length-1].endOffset,c)){let h=r[r.length-1];r[r.length-1]=new HF(h.startOffset,u,_u(h.newLength,p))}else r.push({startOffset:c,endOffset:u,newLength:p})}let l=Ub;for(let c of t){let u=n(c.lengthBefore);if(c.modified){let p=zXi(u,g=>g.lengthBefore),h=_u(l,p);s(l,h,c.lengthAfter),l=h}else for(let p of u){let h=l;l=_u(l,p.lengthBefore),p.modified&&s(h,l,p.lengthAfter)}}return r}var S8e=class a{constructor(i,e,t){this.modified=i;this.lengthBefore=e;this.lengthAfter=t}splitAt(i){let e=mde(i,this.lengthAfter);return qai(e,Ub)?[this,void 0]:this.modified?[new a(this.modified,this.lengthBefore,i),new a(this.modified,Ub,e)]:[new a(this.modified,i,i),new a(this.modified,e,e)]}toString(){return`${this.modified?"M":"U"}:${Bk(this.lengthBefore)} -> ${Bk(this.lengthAfter)}`}};function $Xi(a){let i=[],e=Ub;for(let t of a){let o=mde(e,t.startOffset);Kxe(o)||i.push(new S8e(!1,o,o));let n=mde(t.startOffset,t.endOffset);i.push(new S8e(!0,n,t.newLength)),e=t.endOffset}return i}var RCt=class extends k{constructor(e,t){super();this.textModel=e;this.getLanguageConfiguration=t;if(this.didChangeEmitter=this._register(new T),this.denseKeyProvider=new qxe,this.brackets=new jxe(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,this.queuedTextEditsForInitialAstWithoutTokens=[],this.queuedTextEdits=[],e.tokenization.hasTokens)e.tokenization.backgroundTokenizationState===2?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens);else{let o=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),n=new _Ct(this.textModel.getValue(),o);this.initialAstWithoutTokens=b8e(n,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}}didLanguageChange(e){return this.brackets.didLanguageChange(e)}handleDidChangeBackgroundTokenizationState(){if(this.textModel.tokenization.backgroundTokenizationState===2){let e=this.initialAstWithoutTokens===void 0;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){let t=e.map(o=>new HF(oh(o.fromLineNumber-1,0),oh(o.toLineNumber,0),oh(o.toLineNumber-o.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){let t=HF.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){let o=Qxe(this.queuedTextEdits,e);this.queuedTextEdits=o,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=Qxe(this.queuedTextEditsForInitialAstWithoutTokens,e))}flushQueue(){this.queuedTextEdits.length>0&&(this.astWithTokens=this.parseDocumentFromTextBuffer(this.queuedTextEdits,this.astWithTokens,!1),this.queuedTextEdits=[]),this.queuedTextEditsForInitialAstWithoutTokens.length>0&&(this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens,this.initialAstWithoutTokens,!1)),this.queuedTextEditsForInitialAstWithoutTokens=[])}parseDocumentFromTextBuffer(e,t,o){let r=t,s=new $xe(this.textModel,this.brackets);return b8e(s,e,r,o)}getBracketsInRange(e,t){this.flushQueue();let o=oh(e.startLineNumber-1,e.startColumn-1),n=oh(e.endLineNumber-1,e.endColumn-1);return new Fj(r=>{let s=this.initialAstWithoutTokens||this.astWithTokens;oli(s,Ub,s.length,o,n,r,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();let o=LX(e.getStartPosition()),n=LX(e.getEndPosition());return new Fj(r=>{let s=this.initialAstWithoutTokens||this.astWithTokens,l=new nli(r,t,this.textModel);rli(s,Ub,s.length,o,n,l,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return QXi(t,Ub,t.length,LX(e))}getFirstBracketBefore(e){this.flushQueue();let t=this.initialAstWithoutTokens||this.astWithTokens;return jXi(t,Ub,t.length,LX(e))}};function jXi(a,i,e,t){if(a.kind===4||a.kind===2){let o=[];for(let n of a.children)e=_u(i,n.length),o.push({nodeOffsetStart:i,nodeOffsetEnd:e}),i=e;for(let n=o.length-1;n>=0;n--){let{nodeOffsetStart:r,nodeOffsetEnd:s}=o[n];if($5(r,t)){let l=jXi(a.children[n],r,s,t);if(l)return l}}return null}else{if(a.kind===3)return null;if(a.kind===1){let o=MX(i,e);return{bracketInfo:a.bracketInfo,range:o}}}return null}function QXi(a,i,e,t){if(a.kind===4||a.kind===2){for(let o of a.children){if(e=_u(i,o.length),$5(t,e)){let n=QXi(o,i,e,t);if(n)return n}i=e}return null}else{if(a.kind===3)return null;if(a.kind===1){let o=MX(i,e);return{bracketInfo:a.bracketInfo,range:o}}}return null}function oli(a,i,e,t,o,n,r,s,l,c,u=!1){if(r>200)return!0;e:for(;;)switch(a.kind){case 4:{let p=a.childrenLength;for(let h=0;h<p;h++){let g=a.getChild(h);if(g){if(e=_u(i,g.length),RX(i,o)&&Gxe(e,t)){if(Gxe(e,o)){a=g;continue e}if(!oli(g,i,e,t,o,n,r,0,l,c))return!1}i=e}}return!0}case 2:{let p=!c||!a.closingBracket||a.closingBracket.bracketInfo.closesColorized(a.openingBracket.bracketInfo),h=0;if(l){let f=l.get(a.openingBracket.text);f===void 0&&(f=0),h=f,p&&(f++,l.set(a.openingBracket.text,f))}let g=a.childrenLength;for(let f=0;f<g;f++){let v=a.getChild(f);if(v){if(e=_u(i,v.length),RX(i,o)&&Gxe(e,t)){if(Gxe(e,o)&&v.kind!==1){a=v,p?(r++,s=h+1):s=h;continue e}if((p||v.kind!==1||!a.closingBracket)&&!oli(v,i,e,t,o,n,p?r+1:r,p?h+1:h,l,c,!a.closingBracket))return!1}i=e}}return l?.set(a.openingBracket.text,h),!0}case 3:{let p=MX(i,e);return n(new d8e(p,r-1,0,!0))}case 1:{let p=MX(i,e);return n(new d8e(p,r-1,s-1,u))}case 0:return!0}}var nli=class{constructor(i,e,t){this.push=i;this.includeMinIndentation=e;this.textModel=t}};function rli(a,i,e,t,o,n,r,s){if(r>200)return!0;let l=!0;if(a.kind===2){let c=0;if(s){let h=s.get(a.openingBracket.text);h===void 0&&(h=0),c=h,h++,s.set(a.openingBracket.text,h)}let u=_u(i,a.openingBracket.length),p=-1;if(n.includeMinIndentation&&(p=a.computeMinIndentation(i,n.textModel)),l=n.push(new CCt(MX(i,e),MX(i,u),a.closingBracket?MX(_u(u,a.child?.length||Ub),e):void 0,r,c,a,p)),i=u,l&&a.child){let h=a.child;if(e=_u(i,h.length),RX(i,o)&&Gxe(e,t)&&(l=rli(h,i,e,t,o,n,r+1,s),!l))return!1}s?.set(a.openingBracket.text,c)}else{let c=i;for(let u of a.children){let p=c;if(c=_u(c,u.length),RX(p,o)&&RX(t,c)&&(l=rli(u,p,c,t,o,n,r,s),!l))return!1}}return l}var MCt=class extends k{constructor(e,t){super();this.textModel=e;this.languageConfigurationService=t;this.bracketPairsTree=this._register(new ue);this.onDidChangeEmitter=this._register(new T);this.onDidChange=this.onDidChangeEmitter.event;this.bracketsRequested=!1}get canBuildAST(){return this.textModel.getValueLength()<=5e6}handleLanguageConfigurationServiceChange(e){(!e.languageId||this.bracketPairsTree.value?.object.didLanguageChange(e.languageId))&&(this.bracketPairsTree.clear(),this.updateBracketPairsTree())}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){this.bracketPairsTree.value?.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){this.bracketPairsTree.value?.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){this.bracketPairsTree.value?.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.canBuildAST){if(!this.bracketPairsTree.value){let e=new O;this.bracketPairsTree.value=Dqo(e.add(new RCt(this.textModel,t=>this.languageConfigurationService.getLanguageConfiguration(t))),e),e.add(this.bracketPairsTree.value.object.onDidChange(t=>this.onDidChangeEmitter.fire(t))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire())}getBracketPairsInRange(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!1)||Fj.empty}getBracketPairsInRangeWithMinIndentation(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!0)||Fj.empty}getBracketsInRange(e,t=!1){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketsInRange(e,t)||Fj.empty}findMatchingBracketUp(e,t,o){let n=this.textModel.validatePosition(t),r=this.textModel.getLanguageIdAtPosition(n.lineNumber,n.column);if(this.canBuildAST){let s=this.languageConfigurationService.getLanguageConfiguration(r).bracketsNew.getClosingBracketInfo(e);if(!s)return null;let l=this.getBracketPairsInRange(G.fromPositions(t,t)).findLast(c=>s.closes(c.openingBracketInfo));return l?l.openingBracketRange:null}else{let s=e.toLowerCase(),l=this.languageConfigurationService.getLanguageConfiguration(r).brackets;if(!l)return null;let c=l.textIsBracket[s];return c?LCt(this._findMatchingBracketUp(c,n,ali(o))):null}}matchBracket(e,t){if(this.canBuildAST){let o=this.getBracketPairsInRange(G.fromPositions(e,e)).filter(n=>n.closingBracketRange!==void 0&&(n.openingBracketRange.containsPosition(e)||n.closingBracketRange.containsPosition(e))).findLastMaxBy(Il(n=>n.openingBracketRange.containsPosition(e)?n.openingBracketRange:n.closingBracketRange,G.compareRangesUsingStarts));return o?[o.openingBracketRange,o.closingBracketRange]:null}else{let o=ali(t);return this._matchBracket(this.textModel.validatePosition(e),o)}}_establishBracketSearchOffsets(e,t,o,n){let r=t.getCount(),s=t.getLanguageId(n),l=Math.max(0,e.column-1-o.maxBracketLength);for(let u=n-1;u>=0;u--){let p=t.getEndOffset(u);if(p<=l)break;if(fF(t.getStandardTokenType(u))||t.getLanguageId(u)!==s){l=p;break}}let c=Math.min(t.getLineContent().length,e.column-1+o.maxBracketLength);for(let u=n+1;u<r;u++){let p=t.getStartOffset(u);if(p>=c)break;if(fF(t.getStandardTokenType(u))||t.getLanguageId(u)!==s){c=p;break}}return{searchStartOffset:l,searchEndOffset:c}}_matchBracket(e,t){let o=e.lineNumber,n=this.textModel.tokenization.getLineTokens(o),r=this.textModel.getLineContent(o),s=n.findTokenIndexAtOffset(e.column-1);if(s<0)return null;let l=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(s)).brackets;if(l&&!fF(n.getStandardTokenType(s))){let{searchStartOffset:c,searchEndOffset:u}=this._establishBracketSearchOffsets(e,n,l,s),p=null;for(;;){let h=mT.findNextBracketInRange(l.forwardRegex,o,r,c,u);if(!h)break;if(h.startColumn<=e.column&&e.column<=h.endColumn){let g=r.substring(h.startColumn-1,h.endColumn-1).toLowerCase(),f=this._matchFoundBracket(h,l.textIsBracket[g],l.textIsOpenBracket[g],t);if(f){if(f instanceof j5)return null;p=f}}c=h.endColumn-1}if(p)return p}if(s>0&&n.getStartOffset(s)===e.column-1){let c=s-1,u=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(c)).brackets;if(u&&!fF(n.getStandardTokenType(c))){let{searchStartOffset:p,searchEndOffset:h}=this._establishBracketSearchOffsets(e,n,u,c),g=mT.findPrevBracketInRange(u.reversedRegex,o,r,p,h);if(g&&g.startColumn<=e.column&&e.column<=g.endColumn){let f=r.substring(g.startColumn-1,g.endColumn-1).toLowerCase(),v=this._matchFoundBracket(g,u.textIsBracket[f],u.textIsOpenBracket[f],t);if(v)return v instanceof j5?null:v}}}return null}_matchFoundBracket(e,t,o,n){if(!t)return null;let r=o?this._findMatchingBracketDown(t,e.getEndPosition(),n):this._findMatchingBracketUp(t,e.getStartPosition(),n);return r?r instanceof j5?r:[e,r]:null}_findMatchingBracketUp(e,t,o){let n=e.languageId,r=e.reversedRegex,s=-1,l=0,c=(u,p,h,g)=>{for(;;){if(o&&++l%100===0&&!o())return j5.INSTANCE;let f=mT.findPrevBracketInRange(r,u,p,h,g);if(!f)break;let v=p.substring(f.startColumn-1,f.endColumn-1).toLowerCase();if(e.isOpen(v)?s++:e.isClose(v)&&s--,s===0)return f;g=f.startColumn-1}return null};for(let u=t.lineNumber;u>=1;u--){let p=this.textModel.tokenization.getLineTokens(u),h=p.getCount(),g=this.textModel.getLineContent(u),f=h-1,v=g.length,b=g.length;u===t.lineNumber&&(f=p.findTokenIndexAtOffset(t.column-1),v=t.column-1,b=t.column-1);let S=!0;for(;f>=0;f--){let y=p.getLanguageId(f)===n&&!fF(p.getStandardTokenType(f));if(y)S?v=p.getStartOffset(f):(v=p.getStartOffset(f),b=p.getEndOffset(f));else if(S&&v!==b){let w=c(u,g,v,b);if(w)return w}S=y}if(S&&v!==b){let y=c(u,g,v,b);if(y)return y}}return null}_findMatchingBracketDown(e,t,o){let n=e.languageId,r=e.forwardRegex,s=1,l=0,c=(p,h,g,f)=>{for(;;){if(o&&++l%100===0&&!o())return j5.INSTANCE;let v=mT.findNextBracketInRange(r,p,h,g,f);if(!v)break;let b=h.substring(v.startColumn-1,v.endColumn-1).toLowerCase();if(e.isOpen(b)?s++:e.isClose(b)&&s--,s===0)return v;g=v.endColumn-1}return null},u=this.textModel.getLineCount();for(let p=t.lineNumber;p<=u;p++){let h=this.textModel.tokenization.getLineTokens(p),g=h.getCount(),f=this.textModel.getLineContent(p),v=0,b=0,S=0;p===t.lineNumber&&(v=h.findTokenIndexAtOffset(t.column-1),b=t.column-1,S=t.column-1);let y=!0;for(;v<g;v++){let w=h.getLanguageId(v)===n&&!fF(h.getStandardTokenType(v));if(w)y||(b=h.getStartOffset(v)),S=h.getEndOffset(v);else if(y&&b!==S){let x=c(p,f,b,S);if(x)return x}y=w}if(y&&b!==S){let w=c(p,f,b,S);if(w)return w}}return null}findPrevBracket(e){let t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketBefore(t)||null;let o=null,n=null,r=null;for(let s=t.lineNumber;s>=1;s--){let l=this.textModel.tokenization.getLineTokens(s),c=l.getCount(),u=this.textModel.getLineContent(s),p=c-1,h=u.length,g=u.length;if(s===t.lineNumber){p=l.findTokenIndexAtOffset(t.column-1),h=t.column-1,g=t.column-1;let v=l.getLanguageId(p);o!==v&&(o=v,n=this.languageConfigurationService.getLanguageConfiguration(o).brackets,r=this.languageConfigurationService.getLanguageConfiguration(o).bracketsNew)}let f=!0;for(;p>=0;p--){let v=l.getLanguageId(p);if(o!==v){if(n&&r&&f&&h!==g){let S=mT.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(S)return this._toFoundBracket(r,S);f=!1}o=v,n=this.languageConfigurationService.getLanguageConfiguration(o).brackets,r=this.languageConfigurationService.getLanguageConfiguration(o).bracketsNew}let b=!!n&&!fF(l.getStandardTokenType(p));if(b)f?h=l.getStartOffset(p):(h=l.getStartOffset(p),g=l.getEndOffset(p));else if(r&&n&&f&&h!==g){let S=mT.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(S)return this._toFoundBracket(r,S)}f=b}if(r&&n&&f&&h!==g){let v=mT.findPrevBracketInRange(n.reversedRegex,s,u,h,g);if(v)return this._toFoundBracket(r,v)}}return null}findNextBracket(e){let t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketAfter(t)||null;let o=this.textModel.getLineCount(),n=null,r=null,s=null;for(let l=t.lineNumber;l<=o;l++){let c=this.textModel.tokenization.getLineTokens(l),u=c.getCount(),p=this.textModel.getLineContent(l),h=0,g=0,f=0;if(l===t.lineNumber){h=c.findTokenIndexAtOffset(t.column-1),g=t.column-1,f=t.column-1;let b=c.getLanguageId(h);n!==b&&(n=b,r=this.languageConfigurationService.getLanguageConfiguration(n).brackets,s=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew)}let v=!0;for(;h<u;h++){let b=c.getLanguageId(h);if(n!==b){if(s&&r&&v&&g!==f){let y=mT.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(y)return this._toFoundBracket(s,y);v=!1}n=b,r=this.languageConfigurationService.getLanguageConfiguration(n).brackets,s=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew}let S=!!r&&!fF(c.getStandardTokenType(h));if(S)v||(g=c.getStartOffset(h)),f=c.getEndOffset(h);else if(s&&r&&v&&g!==f){let y=mT.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(y)return this._toFoundBracket(s,y)}v=S}if(s&&r&&v&&g!==f){let b=mT.findNextBracketInRange(r.forwardRegex,l,p,g,f);if(b)return this._toFoundBracket(s,b)}}return null}findEnclosingBrackets(e,t){let o=this.textModel.validatePosition(e);if(this.canBuildAST){let f=G.fromPositions(o),v=this.getBracketPairsInRange(G.fromPositions(o,o)).findLast(b=>b.closingBracketRange!==void 0&&b.range.strictContainsRange(f));return v?[v.openingBracketRange,v.closingBracketRange]:null}let n=ali(t),r=this.textModel.getLineCount(),s=new Map,l=[],c=(f,v)=>{if(!s.has(f)){let b=[];for(let S=0,y=v?v.brackets.length:0;S<y;S++)b[S]=0;s.set(f,b)}l=s.get(f)},u=0,p=(f,v,b,S,y)=>{for(;;){if(n&&++u%100===0&&!n())return j5.INSTANCE;let w=mT.findNextBracketInRange(f.forwardRegex,v,b,S,y);if(!w)break;let x=b.substring(w.startColumn-1,w.endColumn-1).toLowerCase(),E=f.textIsBracket[x];if(E&&(E.isOpen(x)?l[E.index]++:E.isClose(x)&&l[E.index]--,l[E.index]===-1))return this._matchFoundBracket(w,E,!1,n);S=w.endColumn-1}return null},h=null,g=null;for(let f=o.lineNumber;f<=r;f++){let v=this.textModel.tokenization.getLineTokens(f),b=v.getCount(),S=this.textModel.getLineContent(f),y=0,w=0,x=0;if(f===o.lineNumber){y=v.findTokenIndexAtOffset(o.column-1),w=o.column-1,x=o.column-1;let M=v.getLanguageId(y);h!==M&&(h=M,g=this.languageConfigurationService.getLanguageConfiguration(h).brackets,c(h,g))}let E=!0;for(;y<b;y++){let M=v.getLanguageId(y);if(h!==M){if(g&&E&&w!==x){let V=p(g,f,S,w,x);if(V)return LCt(V);E=!1}h=M,g=this.languageConfigurationService.getLanguageConfiguration(h).brackets,c(h,g)}let N=!!g&&!fF(v.getStandardTokenType(y));if(N)E||(w=v.getStartOffset(y)),x=v.getEndOffset(y);else if(g&&E&&w!==x){let V=p(g,f,S,w,x);if(V)return LCt(V)}E=N}if(g&&E&&w!==x){let M=p(g,f,S,w,x);if(M)return LCt(M)}}return null}_toFoundBracket(e,t){if(!t)return null;let o=this.textModel.getValueInRange(t);o=o.toLowerCase();let n=e.getBracketInfo(o);return n?{range:t,bracketInfo:n}:null}};function Dqo(a,i){return{object:a,dispose:()=>i?.dispose()}}function ali(a){if(typeof a>"u")return()=>!0;{let i=Date.now();return()=>Date.now()-i<=a}}var j5=class a{constructor(){this._searchCanceledBrand=void 0}static{this.INSTANCE=new a}};function LCt(a){return a instanceof j5?null:a}var PCt=class extends k{constructor(e){super();this.textModel=e;this.colorProvider=new ACt;this.onDidChangeEmitter=this._register(new T);this.onDidChange=this.onDidChangeEmitter.event;this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange(t=>{this.onDidChangeEmitter.fire()}))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,o,n,r){return r?[]:t===void 0?[]:this.colorizationOptions.enabled?this.textModel.bracketPairs.getBracketsInRange(e,!0).map(l=>({id:`bracket${l.range.toString()}-${l.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(l,this.colorizationOptions.independentColorPoolPerBracketType)},ownerId:0,range:l.range})).toArray():[]}getAllDecorations(e,t,o){return e===void 0?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new G(1,1,this.textModel.getLineCount(),1),e,t,o):[]}},ACt=class{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(i,e){return i.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(e?i.nestingLevelOfEqualBracketType:i.nestingLevel)}getInlineClassNameOfLevel(i){return`bracket-highlighting-${i%30}`}};hs((a,i)=>{let e=[uwt,pwt,mwt,hwt,gwt,fwt],t=new ACt;i.addRule(`.monaco-editor .${t.unexpectedClosingBracketClassName} { color: ${a.getColor(tXi)}; }`);let o=e.map(n=>a.getColor(n)).filter(n=>!!n).filter(n=>!n.isTransparent());for(let n=0;n<30;n++){let r=o[n%o.length];i.addRule(`.monaco-editor .${t.getInlineClassNameOfLevel(n)} { color: ${r}; }`)}});function NCt(a){return a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var XL=class a{constructor(i,e,t,o){this.oldPosition=i;this.oldText=e;this.newPosition=t;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} "${NCt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${NCt(this.oldText)}")`:`(replace@${this.oldPosition} "${NCt(this.oldText)}" with "${NCt(this.newText)}")`}static _writeStringSize(i){return 4+2*i.length}static _writeString(i,e,t){let o=e.length;Dy(i,o,t),t+=4;for(let n=0;n<o;n++)T8i(i,e.charCodeAt(n),t),t+=2;return t}static _readString(i,e){let t=_y(i,e);return e+=4,u6i(i,e,t)}writeSize(){return 8+a._writeStringSize(this.oldText)+a._writeStringSize(this.newText)}write(i,e){return Dy(i,this.oldPosition,e),e+=4,Dy(i,this.newPosition,e),e+=4,e=a._writeString(i,this.oldText,e),e=a._writeString(i,this.newText,e),e}static read(i,e,t){let o=_y(i,e);e+=4;let n=_y(i,e);e+=4;let r=a._readString(i,e);e+=a._writeStringSize(r);let s=a._readString(i,e);return e+=a._writeStringSize(s),t.push(new a(o,r,n,s)),e}};function YXi(a,i){return a===null||a.length===0?i:new lli(a,i).compress()}var lli=class a{constructor(i,e){this._prevEdits=i,this._currEdits=e,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let i=0,e=0,t=this._getPrev(i),o=this._getCurr(e);for(;i<this._prevLen||e<this._currLen;){if(t===null){this._acceptCurr(o),o=this._getCurr(++e);continue}if(o===null){this._acceptPrev(t),t=this._getPrev(++i);continue}if(o.oldEnd<=t.newPosition){this._acceptCurr(o),o=this._getCurr(++e);continue}if(t.newEnd<=o.oldPosition){this._acceptPrev(t),t=this._getPrev(++i);continue}if(o.oldPosition<t.newPosition){let[c,u]=a._splitCurr(o,t.newPosition-o.oldPosition);this._acceptCurr(c),o=u;continue}if(t.newPosition<o.oldPosition){let[c,u]=a._splitPrev(t,o.oldPosition-t.newPosition);this._acceptPrev(c),t=u;continue}let s,l;if(o.oldEnd===t.newEnd)s=t,l=o,t=this._getPrev(++i),o=this._getCurr(++e);else if(o.oldEnd<t.newEnd){let[c,u]=a._splitPrev(t,o.oldLength);s=c,l=o,t=u,o=this._getCurr(++e)}else{let[c,u]=a._splitCurr(o,t.newLength);s=t,l=c,t=this._getPrev(++i),o=u}this._result[this._resultLen++]=new XL(s.oldPosition,s.oldText,l.newPosition,l.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=l.newLength-l.oldLength}let n=a._merge(this._result);return a._removeNoOps(n)}_acceptCurr(i){this._result[this._resultLen++]=a._rebaseCurr(this._prevDeltaOffset,i),this._currDeltaOffset+=i.newLength-i.oldLength}_getCurr(i){return i<this._currLen?this._currEdits[i]:null}_acceptPrev(i){this._result[this._resultLen++]=a._rebasePrev(this._currDeltaOffset,i),this._prevDeltaOffset+=i.newLength-i.oldLength}_getPrev(i){return i<this._prevLen?this._prevEdits[i]:null}static _rebaseCurr(i,e){return new XL(e.oldPosition-i,e.oldText,e.newPosition,e.newText)}static _rebasePrev(i,e){return new XL(e.oldPosition,e.oldText,e.newPosition+i,e.newText)}static _splitPrev(i,e){let t=i.newText.substr(0,e),o=i.newText.substr(e);return[new XL(i.oldPosition,i.oldText,i.newPosition,t),new XL(i.oldEnd,"",i.newPosition+e,o)]}static _splitCurr(i,e){let t=i.oldText.substr(0,e),o=i.oldText.substr(e);return[new XL(i.oldPosition,t,i.newPosition,i.newText),new XL(i.oldPosition+e,o,i.newEnd,"")]}static _merge(i){if(i.length===0)return i;let e=[],t=0,o=i[0];for(let n=1;n<i.length;n++){let r=i[n];o.oldEnd===r.oldPosition?o=new XL(o.oldPosition,o.oldText+r.oldText,o.newPosition,o.newText+r.newText):(e[t++]=o,o=r)}return e[t++]=o,e}static _removeNoOps(i){if(i.length===0)return i;let e=[],t=0;for(let o=0;o<i.length;o++){let n=i[o];n.oldText!==n.newText&&(e[t++]=n)}return e}};function Yxe(a){return a.toString()}var kD=class a{constructor(i,e,t,o,n,r,s){this.beforeVersionId=i;this.afterVersionId=e;this.beforeEOL=t;this.afterEOL=o;this.beforeCursorState=n;this.afterCursorState=r;this.changes=s}static create(i,e){let t=i.getAlternativeVersionId(),o=cli(i);return new a(t,t,o,o,e,e,[])}append(i,e,t,o,n){e.length>0&&(this.changes=YXi(this.changes,e)),this.afterEOL=t,this.afterVersionId=o,this.afterCursorState=n}static _writeSelectionsSize(i){return 4+16*(i?i.length:0)}static _writeSelections(i,e,t){if(Dy(i,e?e.length:0,t),t+=4,e)for(let o of e)Dy(i,o.selectionStartLineNumber,t),t+=4,Dy(i,o.selectionStartColumn,t),t+=4,Dy(i,o.positionLineNumber,t),t+=4,Dy(i,o.positionColumn,t),t+=4;return t}static _readSelections(i,e,t){let o=_y(i,e);e+=4;for(let n=0;n<o;n++){let r=_y(i,e);e+=4;let s=_y(i,e);e+=4;let l=_y(i,e);e+=4;let c=_y(i,e);e+=4,t.push(new ei(r,s,l,c))}return e}serialize(){let i=10+a._writeSelectionsSize(this.beforeCursorState)+a._writeSelectionsSize(this.afterCursorState)+4;for(let o of this.changes)i+=o.writeSize();let e=new Uint8Array(i),t=0;Dy(e,this.beforeVersionId,t),t+=4,Dy(e,this.afterVersionId,t),t+=4,fbt(e,this.beforeEOL,t),t+=1,fbt(e,this.afterEOL,t),t+=1,t=a._writeSelections(e,this.beforeCursorState,t),t=a._writeSelections(e,this.afterCursorState,t),Dy(e,this.changes.length,t),t+=4;for(let o of this.changes)t=o.write(e,t);return e.buffer}static deserialize(i){let e=new Uint8Array(i),t=0,o=_y(e,t);t+=4;let n=_y(e,t);t+=4;let r=gbt(e,t);t+=1;let s=gbt(e,t);t+=1;let l=[];t=a._readSelections(e,t,l);let c=[];t=a._readSelections(e,t,c);let u=_y(e,t);t+=4;let p=[];for(let h=0;h<u;h++)t=XL.read(e,t,p);return new a(o,n,r,s,l,c,p)}},JL=class{constructor(i,e,t,o){this.label=i;this.code=e;this.model=t,this._data=kD.create(t,o)}get type(){return 0}get resource(){return A.isUri(this.model)?this.model:this.model.uri}toString(){return(this._data instanceof kD?this._data:kD.deserialize(this._data)).changes.map(e=>e.toString()).join(", ")}matchesResource(i){return(A.isUri(this.model)?this.model:this.model.uri).toString()===i.toString()}setModel(i){this.model=i}canAppend(i){return this.model===i&&this._data instanceof kD}append(i,e,t,o,n){this._data instanceof kD&&this._data.append(i,e,t,o,n)}close(){this._data instanceof kD&&(this._data=this._data.serialize())}open(){this._data instanceof kD||(this._data=kD.deserialize(this._data))}undo(){if(A.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof kD&&(this._data=this._data.serialize());let i=kD.deserialize(this._data);this.model._applyUndo(i.changes,i.beforeEOL,i.beforeVersionId,i.beforeCursorState)}redo(){if(A.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof kD&&(this._data=this._data.serialize());let i=kD.deserialize(this._data);this.model._applyRedo(i.changes,i.afterEOL,i.afterVersionId,i.afterCursorState)}heapSize(){return this._data instanceof kD&&(this._data=this._data.serialize()),this._data.byteLength+168}},UB=class{constructor(i,e,t){this.label=i;this.code=e;this.type=1;this._isOpen=!0,this._editStackElementsArr=t.slice(0),this._editStackElementsMap=new Map;for(let o of this._editStackElementsArr){let n=Yxe(o.resource);this._editStackElementsMap.set(n,o)}this._delegate=null}get resources(){return this._editStackElementsArr.map(i=>i.resource)}setDelegate(i){this._delegate=i}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}getMissingModels(){let i=[];for(let e of this._editStackElementsArr)A.isUri(e.model)&&i.push(e.model);return i}matchesResource(i){let e=Yxe(i);return this._editStackElementsMap.has(e)}setModel(i){let e=Yxe(A.isUri(i)?i:i.uri);this._editStackElementsMap.has(e)&&this._editStackElementsMap.get(e).setModel(i)}canAppend(i){if(!this._isOpen)return!1;let e=Yxe(i.uri);return this._editStackElementsMap.has(e)?this._editStackElementsMap.get(e).canAppend(i):!1}append(i,e,t,o,n){let r=Yxe(i.uri);this._editStackElementsMap.get(r).append(i,e,t,o,n)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(let i of this._editStackElementsArr)i.undo()}redo(){for(let i of this._editStackElementsArr)i.redo()}heapSize(i){let e=Yxe(i);return this._editStackElementsMap.has(e)?this._editStackElementsMap.get(e).heapSize():0}split(){return this._editStackElementsArr}toString(){let i=[];for(let e of this._editStackElementsArr)i.push(`${Be(e.resource)}: ${e}`);return`{${i.join(", ")}}`}};function cli(a){return a.getEOL()===`
`?0:1}function hK(a){return a?a instanceof JL||a instanceof UB:!1}var OCt=class a{constructor(i,e){this._model=i,this._undoRedoService=e}pushStackElement(){let i=this._undoRedoService.getLastElement(this._model.uri);hK(i)&&i.close()}popStackElement(){let i=this._undoRedoService.getLastElement(this._model.uri);hK(i)&&i.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(i,e){let t=this._undoRedoService.getLastElement(this._model.uri);if(hK(t)&&t.canAppend(this._model))return t;let o=new JL(d(921,null),"undoredo.textBufferEdit",this._model,i);return this._undoRedoService.pushElement(o,e),o}pushEOL(i){let e=this._getOrCreateEditStackElement(null,void 0);this._model.setEOL(i),e.append(this._model,[],cli(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(i,e,t,o,n=sd.unknown({name:"pushEditOperation"})){let r=this._getOrCreateEditStackElement(i,o),s=this._model.applyEdits(e,!0,n),l=a._computeCursorState(t,s),c=s.map((u,p)=>({index:p,textChange:u.textChange}));return c.sort((u,p)=>u.textChange.oldPosition===p.textChange.oldPosition?u.index-p.index:u.textChange.oldPosition-p.textChange.oldPosition),r.append(this._model,c.map(u=>u.textChange),cli(this._model),this._model.getAlternativeVersionId(),l),l}static _computeCursorState(i,e){try{return i?i(e):null}catch(t){return mt(t),null}}};var dli=class{constructor(){this.spacesDiff=0;this.looksLikeAlignment=!1}};function Rqo(a,i,e,t,o){o.spacesDiff=0,o.looksLikeAlignment=!1;let n;for(n=0;n<i&&n<t;n++){let h=a.charCodeAt(n),g=e.charCodeAt(n);if(h!==g)break}let r=0,s=0;for(let h=n;h<i;h++)a.charCodeAt(h)===32?r++:s++;let l=0,c=0;for(let h=n;h<t;h++)e.charCodeAt(h)===32?l++:c++;if(r>0&&s>0||l>0&&c>0)return;let u=Math.abs(s-c),p=Math.abs(r-l);if(u===0){o.spacesDiff=p,p>0&&0<=l-1&&l-1<a.length&&l<e.length&&e.charCodeAt(l)!==32&&a.charCodeAt(l-1)===32&&a.charCodeAt(a.length-1)===44&&(o.looksLikeAlignment=!0);return}if(p%u===0){o.spacesDiff=p/u;return}}function uli(a,i,e){let t=Math.min(a.getLineCount(),1e4),o=0,n=0,r="",s=0,l=[2,4,6,8,3,5,7],c=8,u=[0,0,0,0,0,0,0,0,0],p=new dli;for(let f=1;f<=t;f++){let v=a.getLineLength(f),b=a.getLineContent(f),S=v<=65536,y=!1,w=0,x=0,E=0;for(let N=0,V=v;N<V;N++){let H=S?b.charCodeAt(N):a.getLineCharCode(f,N);if(H===9)E++;else if(H===32)x++;else{y=!0,w=N;break}}if(!y||(E>0?o++:x>1&&n++,Rqo(r,s,b,w,p),p.looksLikeAlignment&&!(e&&i===p.spacesDiff)))continue;let M=p.spacesDiff;M<=c&&u[M]++,r=b,s=w}let h=e;o!==n&&(h=o<n);let g=i;if(h){let f=0;l.forEach(v=>{let b=u[v];b>f&&(f=b,g=v)}),g===4&&u[4]>0&&u[2]>0&&u[2]>=u[4]*2/3&&(g=2)}return{insertSpaces:h,tabSize:g}}var Xxe=class{constructor(i,e){this.piece=i,this.color=e,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==Cs)return FCt(this.right);let i=this;for(;i.parent!==Cs&&i.parent.left!==i;)i=i.parent;return i.parent===Cs?Cs:i.parent}prev(){if(this.left!==Cs)return mli(this.left);let i=this;for(;i.parent!==Cs&&i.parent.right!==i;)i=i.parent;return i.parent===Cs?Cs:i.parent}detach(){this.parent=null,this.left=null,this.right=null}};var Cs=new Xxe(null,0);Cs.parent=Cs;Cs.left=Cs;Cs.right=Cs;Cs.color=0;function FCt(a){for(;a.left!==Cs;)a=a.left;return a}function mli(a){for(;a.right!==Cs;)a=a.right;return a}function hli(a){return a===Cs?0:a.size_left+a.piece.length+hli(a.right)}function gli(a){return a===Cs?0:a.lf_left+a.piece.lineFeedCnt+gli(a.right)}function pli(){Cs.parent=Cs}function y8e(a,i){let e=i.right;e.size_left+=i.size_left+(i.piece?i.piece.length:0),e.lf_left+=i.lf_left+(i.piece?i.piece.lineFeedCnt:0),i.right=e.left,e.left!==Cs&&(e.left.parent=i),e.parent=i.parent,i.parent===Cs?a.root=e:i.parent.left===i?i.parent.left=e:i.parent.right=e,e.left=i,i.parent=e}function w8e(a,i){let e=i.left;i.left=e.right,e.right!==Cs&&(e.right.parent=i),e.parent=i.parent,i.size_left-=e.size_left+(e.piece?e.piece.length:0),i.lf_left-=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),i.parent===Cs?a.root=e:i===i.parent.right?i.parent.right=e:i.parent.left=e,e.right=i,i.parent=e}function C8e(a,i){let e,t;if(i.left===Cs?(t=i,e=t.right):i.right===Cs?(t=i,e=t.left):(t=FCt(i.right),e=t.right),t===a.root){a.root=e,e.color=0,i.detach(),pli(),a.root.parent=Cs;return}let o=t.color===1;if(t===t.parent.left?t.parent.left=e:t.parent.right=e,t===i?(e.parent=t.parent,I8e(a,e)):(t.parent===i?e.parent=t:e.parent=t.parent,I8e(a,e),t.left=i.left,t.right=i.right,t.parent=i.parent,t.color=i.color,i===a.root?a.root=t:i===i.parent.left?i.parent.left=t:i.parent.right=t,t.left!==Cs&&(t.left.parent=t),t.right!==Cs&&(t.right.parent=t),t.size_left=i.size_left,t.lf_left=i.lf_left,I8e(a,t)),i.detach(),e.parent.left===e){let r=hli(e),s=gli(e);if(r!==e.parent.size_left||s!==e.parent.lf_left){let l=r-e.parent.size_left,c=s-e.parent.lf_left;e.parent.size_left=r,e.parent.lf_left=s,fK(a,e.parent,l,c)}}if(I8e(a,e.parent),o){pli();return}let n;for(;e!==a.root&&e.color===0;)e===e.parent.left?(n=e.parent.right,n.color===1&&(n.color=0,e.parent.color=1,y8e(a,e.parent),n=e.parent.right),n.left.color===0&&n.right.color===0?(n.color=1,e=e.parent):(n.right.color===0&&(n.left.color=0,n.color=1,w8e(a,n),n=e.parent.right),n.color=e.parent.color,e.parent.color=0,n.right.color=0,y8e(a,e.parent),e=a.root)):(n=e.parent.left,n.color===1&&(n.color=0,e.parent.color=1,w8e(a,e.parent),n=e.parent.left),n.left.color===0&&n.right.color===0?(n.color=1,e=e.parent):(n.left.color===0&&(n.right.color=0,n.color=1,y8e(a,n),n=e.parent.left),n.color=e.parent.color,e.parent.color=0,n.left.color=0,w8e(a,e.parent),e=a.root));e.color=0,pli()}function fli(a,i){for(I8e(a,i);i!==a.root&&i.parent.color===1;)if(i.parent===i.parent.parent.left){let e=i.parent.parent.right;e.color===1?(i.parent.color=0,e.color=0,i.parent.parent.color=1,i=i.parent.parent):(i===i.parent.right&&(i=i.parent,y8e(a,i)),i.parent.color=0,i.parent.parent.color=1,w8e(a,i.parent.parent))}else{let e=i.parent.parent.left;e.color===1?(i.parent.color=0,e.color=0,i.parent.parent.color=1,i=i.parent.parent):(i===i.parent.left&&(i=i.parent,w8e(a,i)),i.parent.color=0,i.parent.parent.color=1,y8e(a,i.parent.parent))}a.root.color=0}function fK(a,i,e,t){for(;i!==a.root&&i!==Cs;)i.parent.left===i&&(i.parent.size_left+=e,i.parent.lf_left+=t),i=i.parent}function I8e(a,i){let e=0,t=0;if(i!==a.root){for(;i!==a.root&&i===i.parent.right;)i=i.parent;if(i!==a.root)for(i=i.parent,e=hli(i.left)-i.size_left,t=gli(i.left)-i.lf_left,i.size_left+=e,i.lf_left+=t;i!==a.root&&(e!==0||t!==0);)i.parent.left===i&&(i.parent.size_left+=e,i.parent.lf_left+=t),i=i.parent}}var Q5=65535;function XXi(a){let i;return a[a.length-1]<65536?i=new Uint16Array(a.length):i=new Uint32Array(a.length),i.set(a,0),i}var vli=class{constructor(i,e,t,o,n){this.lineStarts=i;this.cr=e;this.lf=t;this.crlf=o;this.isBasicASCII=n}};function vK(a,i=!0){let e=[0],t=1;for(let o=0,n=a.length;o<n;o++){let r=a.charCodeAt(o);r===13?o+1<n&&a.charCodeAt(o+1)===10?(e[t++]=o+2,o++):e[t++]=o+1:r===10&&(e[t++]=o+1)}return i?XXi(e):e}function JXi(a,i){a.length=0,a[0]=0;let e=1,t=0,o=0,n=0,r=!0;for(let l=0,c=i.length;l<c;l++){let u=i.charCodeAt(l);u===13?l+1<c&&i.charCodeAt(l+1)===10?(n++,a[e++]=l+2,l++):(t++,a[e++]=l+1):u===10?(o++,a[e++]=l+1):r&&u!==9&&(u<32||u>126)&&(r=!1)}let s=new vli(XXi(a),t,o,n,r);return a.length=0,s}var Hk=class{constructor(i,e,t,o,n){this.bufferIndex=i,this.start=e,this.end=t,this.lineFeedCnt=o,this.length=n}},bK=class{constructor(i,e){this.buffer=i,this.lineStarts=e}},bli=class{constructor(i,e){this._pieces=[],this._tree=i,this._BOM=e,this._index=0,i.root!==Cs&&i.iterate(i.root,t=>(t!==Cs&&this._pieces.push(t.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++])}},Sli=class{constructor(i){this._limit=i,this._cache=[]}get(i){for(let e=this._cache.length-1;e>=0;e--){let t=this._cache[e];if(t.nodeStartOffset<=i&&t.nodeStartOffset+t.node.piece.length>=i)return t}return null}get2(i){for(let e=this._cache.length-1;e>=0;e--){let t=this._cache[e];if(t.nodeStartLineNumber&&t.nodeStartLineNumber<i&&t.nodeStartLineNumber+t.node.piece.lineFeedCnt>=i)return t}return null}set(i){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(i)}validate(i){let e=!1,t=this._cache;for(let o=0;o<t.length;o++){let n=t[o];if(n.node.parent===null||n.nodeStartOffset>=i){t[o]=null,e=!0;continue}}if(e){let o=[];for(let n of t)n!==null&&o.push(n);this._cache=o}}},WCt=class{constructor(i,e,t){this.create(i,e,t)}create(i,e,t){this._buffers=[new bK("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=Cs,this._lineCnt=1,this._length=0,this._EOL=e,this._EOLLength=e.length,this._EOLNormalized=t;let o=null;for(let n=0,r=i.length;n<r;n++)if(i[n].buffer.length>0){i[n].lineStarts||(i[n].lineStarts=vK(i[n].buffer));let s=new Hk(n+1,{line:0,column:0},{line:i[n].lineStarts.length-1,column:i[n].buffer.length-i[n].lineStarts[i[n].lineStarts.length-1]},i[n].lineStarts.length-1,i[n].buffer.length);this._buffers.push(i[n]),o=this.rbInsertRight(o,s)}this._searchCache=new Sli(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(i){let e=Q5,t=e-Math.floor(e/3),o=t*2,n="",r=0,s=[];if(this.iterate(this.root,l=>{let c=this.getNodeContent(l),u=c.length;if(r<=t||r+u<o)return n+=c,r+=u,!0;let p=n.replace(/\r\n|\r|\n/g,i);return s.push(new bK(p,vK(p))),n=c,r=u,!0}),r>0){let l=n.replace(/\r\n|\r|\n/g,i);s.push(new bK(l,vK(l)))}this.create(s,i,!0)}getEOL(){return this._EOL}setEOL(i){this._EOL=i,this._EOLLength=this._EOL.length,this.normalizeEOL(i)}createSnapshot(i){return new bli(this,i)}equal(i){if(this.getLength()!==i.getLength()||this.getLineCount()!==i.getLineCount())return!1;let e=0;return this.iterate(this.root,o=>{if(o===Cs)return!0;let n=this.getNodeContent(o),r=n.length,s=i.nodeAt(e),l=i.nodeAt(e+r),c=i.getValueInRange2(s,l);return e+=r,n===c})}getOffsetAt(i,e){let t=0,o=this.root;for(;o!==Cs;)if(o.left!==Cs&&o.lf_left+1>=i)o=o.left;else if(o.lf_left+o.piece.lineFeedCnt+1>=i){t+=o.size_left;let n=this.getAccumulatedValue(o,i-o.lf_left-2);return t+=n+e-1}else i-=o.lf_left+o.piece.lineFeedCnt,t+=o.size_left+o.piece.length,o=o.right;return t}getPositionAt(i){i=Math.floor(i),i=Math.max(0,i);let e=this.root,t=0,o=i;for(;e!==Cs;)if(e.size_left!==0&&e.size_left>=i)e=e.left;else if(e.size_left+e.piece.length>=i){let n=this.getIndexOf(e,i-e.size_left);if(t+=e.lf_left+n.index,n.index===0){let r=this.getOffsetAt(t+1,1),s=o-r;return new ye(t+1,s+1)}return new ye(t+1,n.remainder+1)}else if(i-=e.size_left+e.piece.length,t+=e.lf_left+e.piece.lineFeedCnt,e.right===Cs){let n=this.getOffsetAt(t+1,1),r=o-i-n;return new ye(t+1,r+1)}else e=e.right;return new ye(1,1)}getValueInRange(i,e){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return"";let t=this.nodeAt2(i.startLineNumber,i.startColumn),o=this.nodeAt2(i.endLineNumber,i.endColumn),n=this.getValueInRange2(t,o);return e?e!==this._EOL||!this._EOLNormalized?n.replace(/\r\n|\r|\n/g,e):e===this.getEOL()&&this._EOLNormalized?n:n.replace(/\r\n|\r|\n/g,e):n}getValueInRange2(i,e){if(i.node===e.node){let s=i.node,l=this._buffers[s.piece.bufferIndex].buffer,c=this.offsetInBuffer(s.piece.bufferIndex,s.piece.start);return l.substring(c+i.remainder,c+e.remainder)}let t=i.node,o=this._buffers[t.piece.bufferIndex].buffer,n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start),r=o.substring(n+i.remainder,n+t.piece.length);for(t=t.next();t!==Cs;){let s=this._buffers[t.piece.bufferIndex].buffer,l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);if(t===e.node){r+=s.substring(l,l+e.remainder);break}else r+=s.substr(l,t.piece.length);t=t.next()}return r}getLinesContent(){let i=[],e=0,t="",o=!1;return this.iterate(this.root,n=>{if(n===Cs)return!0;let r=n.piece,s=r.length;if(s===0)return!0;let l=this._buffers[r.bufferIndex].buffer,c=this._buffers[r.bufferIndex].lineStarts,u=r.start.line,p=r.end.line,h=c[u]+r.start.column;if(o&&(l.charCodeAt(h)===10&&(h++,s--),i[e++]=t,t="",o=!1,s===0))return!0;if(u===p)return!this._EOLNormalized&&l.charCodeAt(h+s-1)===13?(o=!0,t+=l.substr(h,s-1)):t+=l.substr(h,s),!0;t+=this._EOLNormalized?l.substring(h,Math.max(h,c[u+1]-this._EOLLength)):l.substring(h,c[u+1]).replace(/(\r\n|\r|\n)$/,""),i[e++]=t;for(let g=u+1;g<p;g++)t=this._EOLNormalized?l.substring(c[g],c[g+1]-this._EOLLength):l.substring(c[g],c[g+1]).replace(/(\r\n|\r|\n)$/,""),i[e++]=t;return!this._EOLNormalized&&l.charCodeAt(c[p]+r.end.column-1)===13?(o=!0,r.end.column===0?e--:t=l.substr(c[p],r.end.column-1)):t=l.substr(c[p],r.end.column),!0}),o&&(i[e++]=t,t=""),i[e++]=t,i}getLength(){return this._length}getLineCount(){return this._lineCnt}getLineContent(i){return this._lastVisitedLine.lineNumber===i?this._lastVisitedLine.value:(this._lastVisitedLine.lineNumber=i,i===this._lineCnt?this._lastVisitedLine.value=this.getLineRawContent(i):this._EOLNormalized?this._lastVisitedLine.value=this.getLineRawContent(i,this._EOLLength):this._lastVisitedLine.value=this.getLineRawContent(i).replace(/(\r\n|\r|\n)$/,""),this._lastVisitedLine.value)}_getCharCode(i){if(i.remainder===i.node.piece.length){let e=i.node.next();if(!e)return 0;let t=this._buffers[e.piece.bufferIndex],o=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start);return t.buffer.charCodeAt(o)}else{let e=this._buffers[i.node.piece.bufferIndex],o=this.offsetInBuffer(i.node.piece.bufferIndex,i.node.piece.start)+i.remainder;return e.buffer.charCodeAt(o)}}getLineCharCode(i,e){let t=this.nodeAt2(i,e+1);return this._getCharCode(t)}getLineLength(i){if(i===this.getLineCount()){let e=this.getOffsetAt(i,1);return this.getLength()-e}return this.getOffsetAt(i+1,1)-this.getOffsetAt(i,1)-this._EOLLength}getCharCode(i){let e=this.nodeAt(i);return this._getCharCode(e)}getNearestChunk(i){let e=this.nodeAt(i);if(e.remainder===e.node.piece.length){let t=e.node.next();if(!t||t===Cs)return"";let o=this._buffers[t.piece.bufferIndex],n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return o.buffer.substring(n,n+t.piece.length)}else{let t=this._buffers[e.node.piece.bufferIndex],o=this.offsetInBuffer(e.node.piece.bufferIndex,e.node.piece.start),n=o+e.remainder,r=o+e.node.piece.length;return t.buffer.substring(n,r)}}findMatchesInNode(i,e,t,o,n,r,s,l,c,u,p){let h=this._buffers[i.piece.bufferIndex],g=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start),f=this.offsetInBuffer(i.piece.bufferIndex,n),v=this.offsetInBuffer(i.piece.bufferIndex,r),b,S={line:0,column:0},y,w;e._wordSeparators?(y=h.buffer.substring(f,v),w=x=>x+f,e.reset(0)):(y=h.buffer,w=x=>x,e.reset(f));do if(b=e.next(y),b){if(w(b.index)>=v)return u;this.positionInBuffer(i,w(b.index)-g,S);let x=this.getLineFeedCnt(i.piece.bufferIndex,n,S),E=S.line===n.line?S.column-n.column+o:S.column+1,M=E+b[0].length;if(p[u++]=KY(new G(t+x,E,t+x,M),b,l),w(b.index)+b[0].length>=v||u>=c)return u}while(b);return u}findMatchesLineByLine(i,e,t,o){let n=[],r=0,s=new Gz(e.wordSeparators,e.regex),l=this.nodeAt2(i.startLineNumber,i.startColumn);if(l===null)return[];let c=this.nodeAt2(i.endLineNumber,i.endColumn);if(c===null)return[];let u=this.positionInBuffer(l.node,l.remainder),p=this.positionInBuffer(c.node,c.remainder);if(l.node===c.node)return this.findMatchesInNode(l.node,s,i.startLineNumber,i.startColumn,u,p,e,t,o,r,n),n;let h=i.startLineNumber,g=l.node;for(;g!==c.node;){let v=this.getLineFeedCnt(g.piece.bufferIndex,u,g.piece.end);if(v>=1){let S=this._buffers[g.piece.bufferIndex].lineStarts,y=this.offsetInBuffer(g.piece.bufferIndex,g.piece.start),w=S[u.line+v],x=h===i.startLineNumber?i.startColumn:1;if(r=this.findMatchesInNode(g,s,h,x,u,this.positionInBuffer(g,w-y),e,t,o,r,n),r>=o)return n;h+=v}let b=h===i.startLineNumber?i.startColumn-1:0;if(h===i.endLineNumber){let S=this.getLineContent(h).substring(b,i.endColumn-1);return r=this._findMatchesInLine(e,s,S,i.endLineNumber,b,r,n,t,o),n}if(r=this._findMatchesInLine(e,s,this.getLineContent(h).substr(b),h,b,r,n,t,o),r>=o)return n;h++,l=this.nodeAt2(h,1),g=l.node,u=this.positionInBuffer(l.node,l.remainder)}if(h===i.endLineNumber){let v=h===i.startLineNumber?i.startColumn-1:0,b=this.getLineContent(h).substring(v,i.endColumn-1);return r=this._findMatchesInLine(e,s,b,i.endLineNumber,v,r,n,t,o),n}let f=h===i.startLineNumber?i.startColumn:1;return r=this.findMatchesInNode(c.node,s,h,f,u,p,e,t,o,r,n),n}_findMatchesInLine(i,e,t,o,n,r,s,l,c){let u=i.wordSeparators;if(!l&&i.simpleSearch){let h=i.simpleSearch,g=h.length,f=t.length,v=-g;for(;(v=t.indexOf(h,v+g))!==-1;)if((!u||DIt(u,t,f,v,g))&&(s[r++]=new Fz(new G(o,v+1+n,o,v+1+g+n),null),r>=c))return r;return r}let p;e.reset(0);do if(p=e.next(t),p&&(s[r++]=KY(new G(o,p.index+1+n,o,p.index+1+p[0].length+n),p,l),r>=c))return r;while(p);return r}insert(i,e,t=!1){if(this._EOLNormalized=this._EOLNormalized&&t,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==Cs){let{node:o,remainder:n,nodeStartOffset:r}=this.nodeAt(i),s=o.piece,l=s.bufferIndex,c=this.positionInBuffer(o,n);if(o.piece.bufferIndex===0&&s.end.line===this._lastChangeBufferPos.line&&s.end.column===this._lastChangeBufferPos.column&&r+s.length===i&&e.length<Q5){this.appendToNode(o,e),this.computeBufferMetadata();return}if(r===i)this.insertContentToNodeLeft(e,o),this._searchCache.validate(i);else if(r+o.piece.length>i){let u=[],p=new Hk(s.bufferIndex,c,s.end,this.getLineFeedCnt(s.bufferIndex,c,s.end),this.offsetInBuffer(l,s.end)-this.offsetInBuffer(l,c));if(this.shouldCheckCRLF()&&this.endWithCR(e)&&this.nodeCharCodeAt(o,n)===10){let v={line:p.start.line+1,column:0};p=new Hk(p.bufferIndex,v,p.end,this.getLineFeedCnt(p.bufferIndex,v,p.end),p.length-1),e+=`
`}if(this.shouldCheckCRLF()&&this.startWithLF(e))if(this.nodeCharCodeAt(o,n-1)===13){let v=this.positionInBuffer(o,n-1);this.deleteNodeTail(o,v),e="\r"+e,o.piece.length===0&&u.push(o)}else this.deleteNodeTail(o,c);else this.deleteNodeTail(o,c);let h=this.createNewPieces(e);p.length>0&&this.rbInsertRight(o,p);let g=o;for(let f=0;f<h.length;f++)g=this.rbInsertRight(g,h[f]);this.deleteNodes(u)}else this.insertContentToNodeRight(e,o)}else{let o=this.createNewPieces(e),n=this.rbInsertLeft(null,o[0]);for(let r=1;r<o.length;r++)n=this.rbInsertRight(n,o[r])}this.computeBufferMetadata()}delete(i,e){if(this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",e<=0||this.root===Cs)return;let t=this.nodeAt(i),o=this.nodeAt(i+e),n=t.node,r=o.node;if(n===r){let h=this.positionInBuffer(n,t.remainder),g=this.positionInBuffer(n,o.remainder);if(t.nodeStartOffset===i){if(e===n.piece.length){let f=n.next();C8e(this,n),this.validateCRLFWithPrevNode(f),this.computeBufferMetadata();return}this.deleteNodeHead(n,g),this._searchCache.validate(i),this.validateCRLFWithPrevNode(n),this.computeBufferMetadata();return}if(t.nodeStartOffset+n.piece.length===i+e){this.deleteNodeTail(n,h),this.validateCRLFWithNextNode(n),this.computeBufferMetadata();return}this.shrinkNode(n,h,g),this.computeBufferMetadata();return}let s=[],l=this.positionInBuffer(n,t.remainder);this.deleteNodeTail(n,l),this._searchCache.validate(i),n.piece.length===0&&s.push(n);let c=this.positionInBuffer(r,o.remainder);this.deleteNodeHead(r,c),r.piece.length===0&&s.push(r);let u=n.next();for(let h=u;h!==Cs&&h!==r;h=h.next())s.push(h);let p=n.piece.length===0?n.prev():n;this.deleteNodes(s),this.validateCRLFWithNextNode(p),this.computeBufferMetadata()}insertContentToNodeLeft(i,e){let t=[];if(this.shouldCheckCRLF()&&this.endWithCR(i)&&this.startWithLF(e)){let r=e.piece,s={line:r.start.line+1,column:0},l=new Hk(r.bufferIndex,s,r.end,this.getLineFeedCnt(r.bufferIndex,s,r.end),r.length-1);e.piece=l,i+=`
`,fK(this,e,-1,-1),e.piece.length===0&&t.push(e)}let o=this.createNewPieces(i),n=this.rbInsertLeft(e,o[o.length-1]);for(let r=o.length-2;r>=0;r--)n=this.rbInsertLeft(n,o[r]);this.validateCRLFWithPrevNode(n),this.deleteNodes(t)}insertContentToNodeRight(i,e){this.adjustCarriageReturnFromNext(i,e)&&(i+=`
`);let t=this.createNewPieces(i),o=this.rbInsertRight(e,t[0]),n=o;for(let r=1;r<t.length;r++)n=this.rbInsertRight(n,t[r]);this.validateCRLFWithPrevNode(o)}positionInBuffer(i,e,t){let o=i.piece,n=i.piece.bufferIndex,r=this._buffers[n].lineStarts,l=r[o.start.line]+o.start.column+e,c=o.start.line,u=o.end.line,p=0,h=0,g=0;for(;c<=u&&(p=c+(u-c)/2|0,g=r[p],p!==u);)if(h=r[p+1],l<g)u=p-1;else if(l>=h)c=p+1;else break;return t?(t.line=p,t.column=l-g,null):{line:p,column:l-g}}getLineFeedCnt(i,e,t){if(t.column===0)return t.line-e.line;let o=this._buffers[i].lineStarts;if(t.line===o.length-1)return t.line-e.line;let n=o[t.line+1],r=o[t.line]+t.column;if(n>r+1)return t.line-e.line;let s=r-1;return this._buffers[i].buffer.charCodeAt(s)===13?t.line-e.line+1:t.line-e.line}offsetInBuffer(i,e){return this._buffers[i].lineStarts[e.line]+e.column}deleteNodes(i){for(let e=0;e<i.length;e++)C8e(this,i[e])}createNewPieces(i){if(i.length>Q5){let u=[];for(;i.length>Q5;){let h=i.charCodeAt(Q5-1),g;h===13||h>=55296&&h<=56319?(g=i.substring(0,Q5-1),i=i.substring(Q5-1)):(g=i.substring(0,Q5),i=i.substring(Q5));let f=vK(g);u.push(new Hk(this._buffers.length,{line:0,column:0},{line:f.length-1,column:g.length-f[f.length-1]},f.length-1,g.length)),this._buffers.push(new bK(g,f))}let p=vK(i);return u.push(new Hk(this._buffers.length,{line:0,column:0},{line:p.length-1,column:i.length-p[p.length-1]},p.length-1,i.length)),this._buffers.push(new bK(i,p)),u}let e=this._buffers[0].buffer.length,t=vK(i,!1),o=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===e&&e!==0&&this.startWithLF(i)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},o=this._lastChangeBufferPos;for(let u=0;u<t.length;u++)t[u]+=e+1;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(t.slice(1)),this._buffers[0].buffer+="_"+i,e+=1}else{if(e!==0)for(let u=0;u<t.length;u++)t[u]+=e;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(t.slice(1)),this._buffers[0].buffer+=i}let n=this._buffers[0].buffer.length,r=this._buffers[0].lineStarts.length-1,s=n-this._buffers[0].lineStarts[r],l={line:r,column:s},c=new Hk(0,o,l,this.getLineFeedCnt(0,o,l),n-e);return this._lastChangeBufferPos=l,[c]}getLinesRawContent(){return this.getContentOfSubTree(this.root)}getLineRawContent(i,e=0){let t=this.root,o="",n=this._searchCache.get2(i);if(n){t=n.node;let r=this.getAccumulatedValue(t,i-n.nodeStartLineNumber-1),s=this._buffers[t.piece.bufferIndex].buffer,l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);if(n.nodeStartLineNumber+t.piece.lineFeedCnt===i)o=s.substring(l+r,l+t.piece.length);else{let c=this.getAccumulatedValue(t,i-n.nodeStartLineNumber);return s.substring(l+r,l+c-e)}}else{let r=0,s=i;for(;t!==Cs;)if(t.left!==Cs&&t.lf_left>=i-1)t=t.left;else if(t.lf_left+t.piece.lineFeedCnt>i-1){let l=this.getAccumulatedValue(t,i-t.lf_left-2),c=this.getAccumulatedValue(t,i-t.lf_left-1),u=this._buffers[t.piece.bufferIndex].buffer,p=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return r+=t.size_left,this._searchCache.set({node:t,nodeStartOffset:r,nodeStartLineNumber:s-(i-1-t.lf_left)}),u.substring(p+l,p+c-e)}else if(t.lf_left+t.piece.lineFeedCnt===i-1){let l=this.getAccumulatedValue(t,i-t.lf_left-2),c=this._buffers[t.piece.bufferIndex].buffer,u=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);o=c.substring(u+l,u+t.piece.length);break}else i-=t.lf_left+t.piece.lineFeedCnt,r+=t.size_left+t.piece.length,t=t.right}for(t=t.next();t!==Cs;){let r=this._buffers[t.piece.bufferIndex].buffer;if(t.piece.lineFeedCnt>0){let s=this.getAccumulatedValue(t,0),l=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return o+=r.substring(l,l+s-e),o}else{let s=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);o+=r.substr(s,t.piece.length)}t=t.next()}return o}computeBufferMetadata(){let i=this.root,e=1,t=0;for(;i!==Cs;)e+=i.lf_left+i.piece.lineFeedCnt,t+=i.size_left+i.piece.length,i=i.right;this._lineCnt=e,this._length=t,this._searchCache.validate(this._length)}getIndexOf(i,e){let t=i.piece,o=this.positionInBuffer(i,e),n=o.line-t.start.line;if(this.offsetInBuffer(t.bufferIndex,t.end)-this.offsetInBuffer(t.bufferIndex,t.start)===e){let r=this.getLineFeedCnt(i.piece.bufferIndex,t.start,o);if(r!==n)return{index:r,remainder:0}}return{index:n,remainder:o.column}}getAccumulatedValue(i,e){if(e<0)return 0;let t=i.piece,o=this._buffers[t.bufferIndex].lineStarts,n=t.start.line+e+1;return n>t.end.line?o[t.end.line]+t.end.column-o[t.start.line]-t.start.column:o[n]-o[t.start.line]-t.start.column}deleteNodeTail(i,e){let t=i.piece,o=t.lineFeedCnt,n=this.offsetInBuffer(t.bufferIndex,t.end),r=e,s=this.offsetInBuffer(t.bufferIndex,r),l=this.getLineFeedCnt(t.bufferIndex,t.start,r),c=l-o,u=s-n,p=t.length+u;i.piece=new Hk(t.bufferIndex,t.start,r,l,p),fK(this,i,u,c)}deleteNodeHead(i,e){let t=i.piece,o=t.lineFeedCnt,n=this.offsetInBuffer(t.bufferIndex,t.start),r=e,s=this.getLineFeedCnt(t.bufferIndex,r,t.end),l=this.offsetInBuffer(t.bufferIndex,r),c=s-o,u=n-l,p=t.length+u;i.piece=new Hk(t.bufferIndex,r,t.end,s,p),fK(this,i,u,c)}shrinkNode(i,e,t){let o=i.piece,n=o.start,r=o.end,s=o.length,l=o.lineFeedCnt,c=e,u=this.getLineFeedCnt(o.bufferIndex,o.start,c),p=this.offsetInBuffer(o.bufferIndex,e)-this.offsetInBuffer(o.bufferIndex,n);i.piece=new Hk(o.bufferIndex,o.start,c,u,p),fK(this,i,p-s,u-l);let h=new Hk(o.bufferIndex,t,r,this.getLineFeedCnt(o.bufferIndex,t,r),this.offsetInBuffer(o.bufferIndex,r)-this.offsetInBuffer(o.bufferIndex,t)),g=this.rbInsertRight(i,h);this.validateCRLFWithPrevNode(g)}appendToNode(i,e){this.adjustCarriageReturnFromNext(e,i)&&(e+=`
`);let t=this.shouldCheckCRLF()&&this.startWithLF(e)&&this.endWithCR(i),o=this._buffers[0].buffer.length;this._buffers[0].buffer+=e;let n=vK(e,!1);for(let g=0;g<n.length;g++)n[g]+=o;if(t){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(n.slice(1));let r=this._buffers[0].lineStarts.length-1,s=this._buffers[0].buffer.length-this._buffers[0].lineStarts[r],l={line:r,column:s},c=i.piece.length+e.length,u=i.piece.lineFeedCnt,p=this.getLineFeedCnt(0,i.piece.start,l),h=p-u;i.piece=new Hk(i.piece.bufferIndex,i.piece.start,l,p,c),this._lastChangeBufferPos=l,fK(this,i,e.length,h)}nodeAt(i){let e=this.root,t=this._searchCache.get(i);if(t)return{node:t.node,nodeStartOffset:t.nodeStartOffset,remainder:i-t.nodeStartOffset};let o=0;for(;e!==Cs;)if(e.size_left>i)e=e.left;else if(e.size_left+e.piece.length>=i){o+=e.size_left;let n={node:e,remainder:i-e.size_left,nodeStartOffset:o};return this._searchCache.set(n),n}else i-=e.size_left+e.piece.length,o+=e.size_left+e.piece.length,e=e.right;return null}nodeAt2(i,e){let t=this.root,o=0;for(;t!==Cs;)if(t.left!==Cs&&t.lf_left>=i-1)t=t.left;else if(t.lf_left+t.piece.lineFeedCnt>i-1){let n=this.getAccumulatedValue(t,i-t.lf_left-2),r=this.getAccumulatedValue(t,i-t.lf_left-1);return o+=t.size_left,{node:t,remainder:Math.min(n+e-1,r),nodeStartOffset:o}}else if(t.lf_left+t.piece.lineFeedCnt===i-1){let n=this.getAccumulatedValue(t,i-t.lf_left-2);if(n+e-1<=t.piece.length)return{node:t,remainder:n+e-1,nodeStartOffset:o};e-=t.piece.length-n;break}else i-=t.lf_left+t.piece.lineFeedCnt,o+=t.size_left+t.piece.length,t=t.right;for(t=t.next();t!==Cs;){if(t.piece.lineFeedCnt>0){let n=this.getAccumulatedValue(t,0),r=this.offsetOfNode(t);return{node:t,remainder:Math.min(e-1,n),nodeStartOffset:r}}else if(t.piece.length>=e-1){let n=this.offsetOfNode(t);return{node:t,remainder:e-1,nodeStartOffset:n}}else e-=t.piece.length;t=t.next()}return null}nodeCharCodeAt(i,e){if(i.piece.lineFeedCnt<1)return-1;let t=this._buffers[i.piece.bufferIndex],o=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start)+e;return t.buffer.charCodeAt(o)}offsetOfNode(i){if(!i)return 0;let e=i.size_left;for(;i!==this.root;)i.parent.right===i&&(e+=i.parent.size_left+i.parent.piece.length),i=i.parent;return e}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===`
`)}startWithLF(i){if(typeof i=="string")return i.charCodeAt(0)===10;if(i===Cs||i.piece.lineFeedCnt===0)return!1;let e=i.piece,t=this._buffers[e.bufferIndex].lineStarts,o=e.start.line,n=t[o]+e.start.column;return o===t.length-1||t[o+1]>n+1?!1:this._buffers[e.bufferIndex].buffer.charCodeAt(n)===10}endWithCR(i){return typeof i=="string"?i.charCodeAt(i.length-1)===13:i===Cs||i.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(i,i.piece.length-1)===13}validateCRLFWithPrevNode(i){if(this.shouldCheckCRLF()&&this.startWithLF(i)){let e=i.prev();this.endWithCR(e)&&this.fixCRLF(e,i)}}validateCRLFWithNextNode(i){if(this.shouldCheckCRLF()&&this.endWithCR(i)){let e=i.next();this.startWithLF(e)&&this.fixCRLF(i,e)}}fixCRLF(i,e){let t=[],o=this._buffers[i.piece.bufferIndex].lineStarts,n;i.piece.end.column===0?n={line:i.piece.end.line-1,column:o[i.piece.end.line]-o[i.piece.end.line-1]-1}:n={line:i.piece.end.line,column:i.piece.end.column-1};let r=i.piece.length-1,s=i.piece.lineFeedCnt-1;i.piece=new Hk(i.piece.bufferIndex,i.piece.start,n,s,r),fK(this,i,-1,-1),i.piece.length===0&&t.push(i);let l={line:e.piece.start.line+1,column:0},c=e.piece.length-1,u=this.getLineFeedCnt(e.piece.bufferIndex,l,e.piece.end);e.piece=new Hk(e.piece.bufferIndex,l,e.piece.end,u,c),fK(this,e,-1,-1),e.piece.length===0&&t.push(e);let p=this.createNewPieces(`\r
`);this.rbInsertRight(i,p[0]);for(let h=0;h<t.length;h++)C8e(this,t[h])}adjustCarriageReturnFromNext(i,e){if(this.shouldCheckCRLF()&&this.endWithCR(i)){let t=e.next();if(this.startWithLF(t)){if(i+=`
`,t.piece.length===1)C8e(this,t);else{let o=t.piece,n={line:o.start.line+1,column:0},r=o.length-1,s=this.getLineFeedCnt(o.bufferIndex,n,o.end);t.piece=new Hk(o.bufferIndex,n,o.end,s,r),fK(this,t,-1,-1)}return!0}}return!1}iterate(i,e){if(i===Cs)return e(Cs);let t=this.iterate(i.left,e);return t&&e(i)&&this.iterate(i.right,e)}getNodeContent(i){if(i===Cs)return"";let e=this._buffers[i.piece.bufferIndex],t=i.piece,o=this.offsetInBuffer(t.bufferIndex,t.start),n=this.offsetInBuffer(t.bufferIndex,t.end);return e.buffer.substring(o,n)}getPieceContent(i){let e=this._buffers[i.bufferIndex],t=this.offsetInBuffer(i.bufferIndex,i.start),o=this.offsetInBuffer(i.bufferIndex,i.end);return e.buffer.substring(t,o)}rbInsertRight(i,e){let t=new Xxe(e,1);if(t.left=Cs,t.right=Cs,t.parent=Cs,t.size_left=0,t.lf_left=0,this.root===Cs)this.root=t,t.color=0;else if(i.right===Cs)i.right=t,t.parent=i;else{let n=FCt(i.right);n.left=t,t.parent=n}return fli(this,t),t}rbInsertLeft(i,e){let t=new Xxe(e,1);if(t.left=Cs,t.right=Cs,t.parent=Cs,t.size_left=0,t.lf_left=0,this.root===Cs)this.root=t,t.color=0;else if(i.left===Cs)i.left=t,t.parent=i;else{let o=mli(i.left);o.right=t,t.parent=o}return fli(this,t),t}getContentOfSubTree(i){let e="";return this.iterate(i,t=>(e+=this.getNodeContent(t),!0)),e}};var PX=class a extends k{constructor(e,t,o,n,r,s,l){super();this._onDidChangeContent=this._register(new T);this._BOM=t,this._mightContainNonBasicASCII=!s,this._mightContainRTL=n,this._mightContainUnusualLineTerminators=r,this._pieceTree=new WCt(e,o,l)}get onDidChangeContent(){return this._onDidChangeContent.event}equals(e){return!(e instanceof a)||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,t){return this._pieceTree.getOffsetAt(e,t)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,t){let o=e+t,n=this.getPositionAt(e),r=this.getPositionAt(o);return new G(n.lineNumber,n.column,r.lineNumber,r.column)}getValueInRange(e,t=0){if(e.isEmpty())return"";let o=this._getEndOfLine(t);return this._pieceTree.getValueInRange(e,o)}getValueLengthInRange(e,t=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;let o=this.getOffsetAt(e.startLineNumber,e.startColumn),n=this.getOffsetAt(e.endLineNumber,e.endColumn),r=0,s=this._getEndOfLine(t),l=this.getEOL();if(s.length!==l.length){let c=s.length-l.length,u=e.endLineNumber-e.startLineNumber;r=c*u}return n-o+r}getCharacterCountInRange(e,t=0){if(this._mightContainNonBasicASCII){let o=0,n=e.startLineNumber,r=e.endLineNumber;for(let s=n;s<=r;s++){let l=this.getLineContent(s),c=s===n?e.startColumn-1:0,u=s===r?e.endColumn-1:l.length;for(let p=c;p<u;p++)Ip(l.charCodeAt(p))?(o=o+1,p=p+1):o=o+1}return o+=this._getEndOfLine(t).length*(r-n),o}return this.getValueLengthInRange(e,t)}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,t){return this._pieceTree.getLineCharCode(e,t)}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 t=Em(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=Bv(this.getLineContent(e));return t===-1?0:t+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,t,o){let n=this._mightContainRTL,r=this._mightContainUnusualLineTerminators,s=this._mightContainNonBasicASCII,l=!0,c=[];for(let b=0;b<e.length;b++){let S=e[b];l&&S._isTracked&&(l=!1);let y=S.range;if(S.text){let N=!0;s||(N=!xz(S.text),s=N),!n&&N&&(n=mA(S.text)),!r&&N&&(r=tbt(S.text))}let w="",x=0,E=0,M=0;if(S.text){let N;[x,E,M,N]=NI(S.text);let V=this.getEOL(),H=V===`\r
`?2:1;N===0||N===H?w=S.text:w=S.text.replace(/\r\n|\r|\n/g,V)}c[b]={sortIndex:b,identifier:S.identifier||null,range:y,rangeOffset:this.getOffsetAt(y.startLineNumber,y.startColumn),rangeLength:this.getValueLengthInRange(y),text:w,eolCount:x,firstLineLength:E,lastLineLength:M,forceMoveMarkers:!!S.forceMoveMarkers,isAutoWhitespaceEdit:S.isAutoWhitespaceEdit||!1}}c.sort(a._sortOpsAscending);let u=!1;for(let b=0,S=c.length-1;b<S;b++){let y=c[b].range.getEndPosition(),w=c[b+1].range.getStartPosition();if(w.isBeforeOrEqual(y)){if(w.isBefore(y))throw new Error("Overlapping ranges are not allowed!");u=!0}}l&&(c=this._reduceOperations(c));let p=o||t?a._getInverseEditRanges(c):[],h=[];if(t)for(let b=0;b<c.length;b++){let S=c[b],y=p[b];if(S.isAutoWhitespaceEdit&&S.range.isEmpty())for(let w=y.startLineNumber;w<=y.endLineNumber;w++){let x="";w===y.startLineNumber&&(x=this.getLineContent(S.range.startLineNumber),Em(x)!==-1)||h.push({lineNumber:w,oldContent:x})}}let g=null;if(o){let b=0;g=[];for(let S=0;S<c.length;S++){let y=c[S],w=p[S],x=this.getValueInRange(y.range),E=y.rangeOffset+b;b+=y.text.length-x.length,g[S]={sortIndex:y.sortIndex,identifier:y.identifier,range:w,text:x,textChange:new XL(y.rangeOffset,x,E,y.text)}}u||g.sort((S,y)=>S.sortIndex-y.sortIndex)}this._mightContainRTL=n,this._mightContainUnusualLineTerminators=r,this._mightContainNonBasicASCII=s;let f=this._doApplyEdits(c),v=null;if(t&&h.length>0){h.sort((b,S)=>S.lineNumber-b.lineNumber),v=[];for(let b=0,S=h.length;b<S;b++){let y=h[b].lineNumber;if(b>0&&h[b-1].lineNumber===y)continue;let w=h[b].oldContent,x=this.getLineContent(y);x.length===0||x===w||Em(x)!==-1||v.push(y)}}return this._onDidChangeContent.fire(),new bSt(g,f,v)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1,o=e[0].range,n=e[e.length-1].range,r=new G(o.startLineNumber,o.startColumn,n.endLineNumber,n.endColumn),s=o.startLineNumber,l=o.startColumn,c=[];for(let f=0,v=e.length;f<v;f++){let b=e[f],S=b.range;t=t||b.forceMoveMarkers,c.push(this.getValueInRange(new G(s,l,S.startLineNumber,S.startColumn))),b.text.length>0&&c.push(b.text),s=S.endLineNumber,l=S.endColumn}let u=c.join(""),[p,h,g]=NI(u);return{sortIndex:0,identifier:e[0].identifier,range:r,rangeOffset:this.getOffsetAt(r.startLineNumber,r.startColumn),rangeLength:this.getValueLengthInRange(r,0),text:u,eolCount:p,firstLineLength:h,lastLineLength:g,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(a._sortOpsDescending);let t=[];for(let o=0;o<e.length;o++){let n=e[o],r=n.range.startLineNumber,s=n.range.startColumn,l=n.range.endLineNumber,c=n.range.endColumn;if(r===l&&s===c&&n.text.length===0)continue;n.text?(this._pieceTree.delete(n.rangeOffset,n.rangeLength),this._pieceTree.insert(n.rangeOffset,n.text,!0)):this._pieceTree.delete(n.rangeOffset,n.rangeLength);let u=new G(r,s,l,c);t.push({range:u,rangeLength:n.rangeLength,text:n.text,rangeOffset:n.rangeOffset,forceMoveMarkers:n.forceMoveMarkers})}return t}findMatchesLineByLine(e,t,o,n){return this._pieceTree.findMatchesLineByLine(e,t,o,n)}getPieceTree(){return this._pieceTree}static _getInverseEditRange(e,t){let o=e.startLineNumber,n=e.startColumn,[r,s,l]=NI(t),c;if(t.length>0){let u=r+1;u===1?c=new G(o,n,o,n+s):c=new G(o,n,o+u-1,l+1)}else c=new G(o,n,o,n);return c}static _getInverseEditRanges(e){let t=[],o=0,n=0,r=null;for(let s=0,l=e.length;s<l;s++){let c=e[s],u,p;r?r.range.endLineNumber===c.range.startLineNumber?(u=o,p=n+(c.range.startColumn-r.range.endColumn)):(u=o+(c.range.startLineNumber-r.range.endLineNumber),p=c.range.startColumn):(u=c.range.startLineNumber,p=c.range.startColumn);let h;if(c.text.length>0){let g=c.eolCount+1;g===1?h=new G(u,p,u,p+c.firstLineLength):h=new G(u,p,u+g-1,c.lastLineLength+1)}else h=new G(u,p,u,p);o=h.endLineNumber,n=h.endColumn,t.push(h),r=c}return t}static _sortOpsAscending(e,t){let o=G.compareRangesUsingEnds(e.range,t.range);return o===0?e.sortIndex-t.sortIndex:o}static _sortOpsDescending(e,t){let o=G.compareRangesUsingEnds(e.range,t.range);return o===0?t.sortIndex-e.sortIndex:-o}};var Ili=class{constructor(i,e,t,o,n,r,s,l,c){this._chunks=i;this._bom=e;this._cr=t;this._lf=o;this._crlf=n;this._containsRTL=r;this._containsUnusualLineTerminators=s;this._isBasicASCII=l;this._normalizeEOL=c}_getEOL(i){let e=this._cr+this._lf+this._crlf,t=this._cr+this._crlf;return e===0?i===1?`
`:`\r
`:t>e/2?`\r
`:`
`}create(i){let e=this._getEOL(i),t=this._chunks;if(this._normalizeEOL&&(e===`\r
`&&(this._cr>0||this._lf>0)||e===`
`&&(this._cr>0||this._crlf>0)))for(let n=0,r=t.length;n<r;n++){let s=t[n].buffer.replace(/\r\n|\r|\n/g,e),l=vK(s);t[n]=new bK(s,l)}let o=new PX(t,this._bom,e,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:o,disposable:o}}getFirstLineText(i){return this._chunks[0].buffer.substr(0,i).split(/\r\n|\r|\n/)[0]}},Y5=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(i){if(i.length===0)return;this.chunks.length===0&&obt(i)&&(this.BOM=Y3i,i=i.substr(1));let e=i.charCodeAt(i.length-1);e===13||e>=55296&&e<=56319?(this._acceptChunk1(i.substr(0,i.length-1),!1),this._hasPreviousChar=!0,this._previousChar=e):(this._acceptChunk1(i,!1),this._hasPreviousChar=!1,this._previousChar=e)}_acceptChunk1(i,e){!e&&i.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+i):this._acceptChunk2(i))}_acceptChunk2(i){let e=JXi(this._tmpLineStarts,i);this.chunks.push(new bK(i,e.lineStarts)),this.cr+=e.cr,this.lf+=e.lf,this.crlf+=e.crlf,e.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=mA(i)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=tbt(i)))}finish(i=!0){return this._finish(),new Ili(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,i)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;let i=this.chunks[this.chunks.length-1];i.buffer+=String.fromCharCode(this._previousChar);let e=vK(i.buffer);i.lineStarts=e,this._previousChar===13&&this.cr++}}};var VCt=class{constructor(){this._onDidChangeVisibleRanges=new T;this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._views=new Set;this._viewsChanged=zc(this);this.visibleLineRanges=Js({owner:this,equalsFn:rF(vY())},i=>(this._viewsChanged.read(i),vo.joinMany([...this._views].map(t=>t.state.read(i)?.visibleLineRanges??[]))))}attachView(){let i=new wli(e=>{this._onDidChangeVisibleRanges.fire({view:i,state:e})});return this._views.add(i),this._viewsChanged.trigger(void 0),i}detachView(i){this._views.delete(i),this._onDidChangeVisibleRanges.fire({view:i,state:void 0}),this._viewsChanged.trigger(void 0)}dispose(){this._onDidChangeVisibleRanges.dispose()}},yli=class{constructor(i,e){this.visibleLineRanges=i;this.stabilized=e}equals(i){return this===i?!0:!(!eo(this.visibleLineRanges,i.visibleLineRanges,(e,t)=>e.equals(t))||this.stabilized!==i.stabilized)}},wli=class{constructor(i){this.handleStateChange=i;this._state=Xm({owner:this,equalsFn:_z((e,t)=>e.equals(t))},void 0)}get state(){return this._state}setVisibleLines(i,e){let t=i.map(n=>new vo(n.startLineNumber,n.endLineNumber+1)),o=new yli(t,e);this._state.set(o,void 0,void 0),this.handleStateChange(o)}},BCt=class extends k{constructor(e){super();this._refreshTokens=e;this.runner=this._register(new Dt(()=>this.update(),50));this._computedLineRanges=[];this._lineRanges=[]}get lineRanges(){return this._lineRanges}update(){eo(this._computedLineRanges,this._lineRanges,(e,t)=>e.equals(t))||(this._computedLineRanges=this._lineRanges,this._refreshTokens())}handleStateChange(e){this._lineRanges=e.visibleLineRanges,e.stabilized?(this.runner.cancel(),this.update()):this.runner.schedule()}},Zxe=class extends k{constructor(e,t){super();this._languageIdCodec=e;this._textModel=t;this._onDidChangeTokens=this._register(new T);this.onDidChangeTokens=this._onDidChangeTokens.event;this._onDidChangeFontTokens=this._register(new T);this.onDidChangeFontTokens=this._onDidChangeFontTokens.event}get backgroundTokenizationState(){return this._backgroundTokenizationState}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}};var X5=class{constructor(i,e,t,o){this.ownerId=i;this.decorationId=e;this.lineNumber=t;this.lineHeight=o}static toKey(i){return`${i.ownerId};${i.decorationId};${i.lineNumber}`}},J5=class{constructor(i,e,t){this.ownerId=i;this.decorationId=e;this.lineNumber=t}static toKey(i){return`${i.ownerId};${i.decorationId};${i.lineNumber}`}};var Lqo=/\b(comment|string|regex|regexp)\b/;function ZXi(a){let i=a.match(Lqo);if(!i)return 0;switch(i[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}function ED(a){let i=[];for(let e=1,t=a.length;e<t;e++){let o=a[e];i[e]=`.mtk${e} { color: ${o}; }`}return i.push(".mtki { font-style: italic; }"),i.push(".mtkb { font-weight: bold; }"),i.push(".mtku { text-decoration: underline; text-underline-position: under; }"),i.push(".mtks { text-decoration: line-through; }"),i.push(".mtks.mtku { text-decoration: underline line-through; text-underline-position: under; }"),i.join(`
`)}function eJi(a){let i=[],e=new Set;for(let t=1,o=a.length;t<o;t++){let n=a[t];if(!n.fontFamily&&!n.fontSizeMultiplier)continue;let r=Cli(n.fontFamily??"",n.fontSizeMultiplier??0);if(e.has(r))continue;e.add(r);let s=`.${r} {`;n.fontFamily&&(s+=`font-family: ${n.fontFamily};`),n.fontSizeMultiplier&&(s+=`font-size: calc(var(--editor-font-size)*${n.fontSizeMultiplier});`),s+="}",i.push(s)}return i.join(`
`)}function Cli(a,i){let e=Mqo(a);return tJi(`font-decoration-${e}-${i}`)}function Mqo(a){let i=a.toLowerCase().trim();return i?tJi(i):"default"}function tJi(a){return a.replace(/[^a-z0-9_-]/gi,"-")}var x8e=class a{constructor(i=[]){this._annotations=[];this._annotations=i}setAnnotations(i){for(let e of i.annotations){let t=this._getStartIndexOfIntersectingAnnotation(e.range.start),o=this._getEndIndexOfIntersectingAnnotation(e.range.endExclusive);e.annotation!==void 0?this._annotations.splice(t,o-t,{range:e.range,annotation:e.annotation}):this._annotations.splice(t,o-t)}}getAnnotationsIntersecting(i){let e=this._getStartIndexOfIntersectingAnnotation(i.start),t=this._getEndIndexOfIntersectingAnnotation(i.endExclusive);return this._annotations.slice(e,t)}_getStartIndexOfIntersectingAnnotation(i){let e=cA(this._annotations.length,o=>this._annotations[o].range.start-i),t;if(e>=0){t=e;let o=this._annotations[t]?.range;o&&o.endExclusive===i&&t--}else{let o=this._annotations[-(e+2)]?.range;o&&i>=o.start&&i<o.endExclusive?t=-(e+2):t=-(e+1)}return t}_getEndIndexOfIntersectingAnnotation(i){let e=cA(this._annotations.length,o=>this._annotations[o].range.endExclusive-i),t;if(e>=0){t=e+1;let o=this._annotations[t]?.range;o&&o.start===i&&t++}else{let o=this._annotations[-(e+1)]?.range;o&&i>=o.start&&i<=o.endExclusive?t=-e:t=-(e+1)}return t}getAllAnnotations(){return this._annotations.slice()}applyEdit(i){let e=this._annotations.slice(),t=[],o=[],n=0;for(let r of i.replacements){for(;;){let l=e[0];if(!l)break;let c=l.range;if(c.endExclusive>=r.replaceRange.start)break;e.shift();let u={range:c.delta(n),annotation:l.annotation};u.range.isEmpty?o.push(u):t.push(u)}let s=[];for(;;){let l=e[0];if(!l||!l.range.intersectsOrTouches(r.replaceRange))break;e.shift(),s.push(l)}for(let l=s.length-1;l>=0;l--){let c=s[l],u=c.range,p=l===0&&r.replaceRange.endExclusive>u.start&&r.replaceRange.start<u.endExclusive,h=u.intersect(r.replaceRange).length;u=u.deltaEnd(-h+(p?r.newText.length:0));let g=u.start-r.replaceRange.start;g>0&&(u=u.delta(-g)),!p&&g>=0&&(u=u.delta(r.newText.length)),u=u.delta(-(r.newText.length-r.replaceRange.length)),e.unshift({annotation:c.annotation,range:u})}n+=r.newText.length-r.replaceRange.length}for(;;){let r=e[0];if(!r)break;e.shift();let s={annotation:r.annotation,range:r.range.delta(n)};s.range.isEmpty?o.push(s):t.push(s)}return this._annotations=t,o}clone(){return new a(this._annotations.slice())}},eke=class a{static create(i){return new a(i)}constructor(i){this._annotations=i}get annotations(){return this._annotations}rebase(i){let e=new x8e(this._annotations);e.applyEdit(i),this._annotations=e.getAllAnnotations()}serialize(i){return this._annotations.map(e=>{let t={start:e.range.start,endExclusive:e.range.endExclusive};return e.annotation?{range:t,annotation:i(e.annotation)}:{range:t,annotation:void 0}})}static deserialize(i,e){let t=i.map(o=>{let n=new gi(o.range.start,o.range.endExclusive);return o.annotation?{range:n,annotation:e(o.annotation)}:{range:n,annotation:void 0}});return new a(t)}};var k8e=class a extends Pce{static{this.empty=new a([])}static fromEdit(i){return new a(i.replacements.map(e=>new hde(e.replaceRange,e.getNewLength())))}static create(i){return new a(i)}static single(i){return new a([i])}static replace(i,e){return new a([new hde(i,e)])}static insert(i,e){return new a([new hde(gi.emptyAt(i),e)])}static delete(i){return new a([new hde(i,0)])}static compose(i){let e=a.empty;for(let t of i)e=e.compose(t);return e}inverse(){let i=[],e=0;for(let t of this.replacements)i.push(new hde(gi.ofStartAndLength(t.replaceRange.start+e,t.newLength),t.replaceRange.length)),e+=t.newLength-t.replaceRange.length;return new a(i)}_createNew(i){return new a(i)}applyArray(i,e){let t=new Array(this.getNewDataLength(i.length)),o=0,n=0;for(let r of this.replacements){for(let s=o;s<r.replaceRange.start;s++)t[n++]=i[s];o=r.replaceRange.endExclusive;for(let s=0;s<r.newLength;s++)t[n++]=e}for(;o<i.length;)t[n++]=i[o++];return t}},hde=class a extends kCe{constructor(e,t){super(e);this.newLength=t}static create(e,t,o){return new a(new gi(e,t),o)}equals(e){return this.replaceRange.equals(e.replaceRange)&&this.newLength===e.newLength}getNewLength(){return this.newLength}tryJoinTouching(e){return new a(this.replaceRange.joinRightTouching(e.replaceRange),this.newLength+e.newLength)}slice(e,t){return new a(e,t.length)}toString(){return`[${this.replaceRange.start}, +${this.replaceRange.length}) -> +${this.newLength}}`}};function iJi(a,i){let e=[];for(let t of a.replacements){let o=G.fromPositions(i.getPositionAt(t.replaceRange.start),i.getPositionAt(t.replaceRange.start+t.replaceRange.length));e.push(Qn.replace(o,t.newText))}return e}function AX(a){let i=a.map(t=>new xd(gi.ofStartAndLength(t.rangeOffset,t.rangeLength),t.text));return i.reverse(),new Ad(i)}function oJi(a,i,e){let t=[];for(let o of e)for(let n of o.innerChanges??[]){let r=i.getValueInRange(n.modifiedRange),s=a.getOffsetAt(n.originalRange.getStartPosition()),l=a.getOffsetAt(n.originalRange.getEndPosition()),c=new gi(s,l);t.push(new xd(c,r))}return new Ad(t)}function xli(a){let e=a.slice().reverse().map(o=>k8e.replace(new gi(o.range.startLineNumber-1,o.range.endLineNumber),NI(o.text)[0]+1));return k8e.compose(e)}var HCt=class a extends k{constructor(e,t){super();this.textModel=e;this.tokenizationTextModelPart=t;this._onDidChangeLineHeight=this._register(new T);this.onDidChangeLineHeight=this._onDidChangeLineHeight.event;this._onDidChangeFont=this._register(new T);this.onDidChangeFont=this._onDidChangeFont.event;this._fontAnnotatedString=new x8e;this._register(this.tokenizationTextModelPart.onDidChangeFontTokens(o=>{let n=new Set,r=[],s=new Set,l=new Set;for(let c of o.changes.annotations){let p=this.textModel.getPositionAt(c.range.start).lineNumber,h;if(c.annotation===void 0)h={range:c.range,annotation:void 0};else{let g=`tokenization-font-decoration-${a.DECORATION_COUNT}`,f={fontToken:c.annotation,decorationId:g};h={range:c.range,annotation:f},a.DECORATION_COUNT++,c.annotation.lineHeightMultiplier&&s.add(new X5(0,g,p,c.annotation.lineHeightMultiplier)),l.add(new J5(0,g,p))}if(r.push(h),!n.has(p)){let g=this.textModel.getOffsetAt(new ye(p,1)),f=this.textModel.getOffsetAt(new ye(p,this.textModel.getLineMaxColumn(p))),v=new gi(g,f),b=this._fontAnnotatedString.getAnnotationsIntersecting(v);for(let S of b){let y=S.annotation.decorationId;s.add(new X5(0,y,p,null)),l.add(new J5(0,y,p))}n.add(p)}}this._fontAnnotatedString.setAnnotations(eke.create(r)),this._onDidChangeLineHeight.fire(s),this._onDidChangeFont.fire(l)}))}static{this.DECORATION_COUNT=0}handleDidChangeContent(e){let t=AX(e.changes),o=this._fontAnnotatedString.applyEdit(t);if(o.length===0)return;let n=new Set,r=new Set;for(let s of o){let c=this.textModel.getPositionAt(s.range.start).lineNumber,u=s.annotation.decorationId;n.add(new X5(0,u,c,null)),r.add(new J5(0,u,c))}this._onDidChangeLineHeight.fire(n),this._onDidChangeFont.fire(r)}getDecorationsInRange(e,t,o,n,r){let s=this.textModel.getOffsetAt(e.getStartPosition()),l=this.textModel.getOffsetAt(e.getEndPosition()),c=this._fontAnnotatedString.getAnnotationsIntersecting(new gi(s,l)),u=[];for(let p of c){let h=p.annotation,g=!!(h.fontToken.fontFamily||h.fontToken.fontSizeMultiplier);if(!(g&&n)){let f=this.textModel.getPositionAt(p.range.start),v=this.textModel.getPositionAt(p.range.endExclusive),b=G.fromPositions(f,v),S=p.annotation,y=Cli(S.fontToken.fontFamily??"",S.fontToken.fontSizeMultiplier??0),w=S.decorationId;u.push({id:w,options:{description:"FontOptionDecoration",inlineClassName:y,lineHeight:S.fontToken.lineHeightMultiplier,affectsFont:g},ownerId:0,range:b})}}return u}getAllDecorations(e,t){return this.getDecorationsInRange(new G(1,1,this.textModel.getLineCount(),this.textModel.getLineMaxColumn(this.textModel.getLineCount())),e,t)}};function Pqo(a,i){let e=a.gotoNextSibling(),t=i.gotoNextSibling();if(e!==t)throw new Error("Trees are out of sync");return e&&t}function kli(a,i){let e=a.gotoParent(),t=i.gotoParent();if(e!==t)throw new Error("Trees are out of sync");return e&&t}function nJi(a,i,e){let t=a.gotoFirstChild(),o=i.gotoFirstChild();if(t!==o)throw new Error("Trees are out of sync");if(e===0)return t&&o;for(let n=1;n<=e;n++){let r=a.gotoNextSibling(),s=i.gotoNextSibling();if(r!==s)throw new Error("Trees are out of sync");if(!r||!s)return!1}return t&&o}function Eli(a,i){do{if(a.currentNode.nextSibling)return Pqo(a,i);a.currentNode.parent&&kli(a,i)}while(a.currentNode.nextSibling||a.currentNode.parent);return!1}function rJi(a,i){let e=i.walk();e.resetTo(a);let t=a.currentNode;do if(e.currentNode.previousSibling&&e.currentNode.endIndex-e.currentNode.startIndex!==0)e.gotoPreviousSibling();else{for(;!e.currentNode.previousSibling&&e.currentNode.parent;)e.gotoParent();e.gotoPreviousSibling()}while(e.currentNode.endIndex>t.startIndex&&(e.currentNode.parent||e.currentNode.previousSibling)&&e.currentNode.id!==t.id);if(e.currentNode.id!==t.id&&e.currentNode.endIndex<=t.startIndex)return e.currentNode}var tke=class extends k{constructor(e,t,o,n,r,s,l){super();this.languageId=e;this._ranges=t;this._parser=o;this._parserClass=n;this.textModel=r;this._logService=s;this._telemetryService=l;this._tree=De(this,void 0);this.tree=this._tree;this._treeLastParsedVersion=De(this,-1);this.treeLastParsedVersion=this._treeLastParsedVersion;this._onDidChangeContentQueue=new fwe;this._tree=De(this,void 0),this.tree=this._tree,this._register(ee(()=>{this._tree.get()?.delete(),this._lastFullyParsed?.delete(),this._lastFullyParsedWithEdits?.delete(),this._parser.delete()})),this.handleContentChange(void 0,this._ranges)}handleContentChange(e,t){let o=this.textModel.getVersionId(),n=[];t&&(n=this._setRanges(t)),e&&this._applyEdits(e.changes),this._onDidChangeContentQueue.clearPending(),this._onDidChangeContentQueue.schedule(async()=>{if(this._store.isDisposed)return;let r=this._lastFullyParsed,s;this._lastFullyParsedWithEdits&&this._lastFullyParsed&&(s=this._findChangedNodes(this._lastFullyParsedWithEdits,this._lastFullyParsed));let l=await this._parseAndUpdateTree(o);if(l){let c;s?r&&s&&(c=this._findTreeChanges(l,s,n)):this._ranges&&(c=this._ranges.map(p=>({newRange:new G(p.startPosition.row+1,p.startPosition.column+1,p.endPosition.row+1,p.endPosition.column+1),oldRangeLength:p.endIndex-p.startIndex,newRangeStartOffset:p.startIndex,newRangeEndOffset:p.endIndex}))),c||(c=[{newRange:this.textModel.getFullModelRange(),newRangeStartOffset:0,newRangeEndOffset:this.textModel.getValueLength()}]);let u=this._tree.get();Ki(p=>{this._tree.set(l,p,{ranges:c,versionId:o}),this._treeLastParsedVersion.set(o,p)}),u?.delete()}})}get ranges(){return this._ranges}getInjectionTrees(e,t){}_applyEdits(e){for(let t of e){let o=Rc.ofRange(G.lift(t.range)),n=Rc.ofText(t.text),r=t.text.length===0?n:o.add(n),s={startIndex:t.rangeOffset,oldEndIndex:t.rangeOffset+t.rangeLength,newEndIndex:t.rangeOffset+t.text.length,startPosition:{row:t.range.startLineNumber-1,column:t.range.startColumn-1},oldEndPosition:{row:t.range.endLineNumber-1,column:t.range.endColumn-1},newEndPosition:{row:t.range.startLineNumber+r.lineCount-1,column:r.lineCount?r.columnCount:t.range.endColumn+r.columnCount}};this._tree.get()?.edit(s),this._lastFullyParsedWithEdits?.edit(s)}}_findChangedNodes(e,t){if(this._ranges&&this._ranges.every(l=>l.startPosition.row!==e.rootNode.startPosition.row)||e.rootNode.startPosition.row!==0)return[];let o=e.walk(),n=t.walk(),r=[],s=!0;do if(o.currentNode.hasChanges){let l=o.currentNode.children,c=[],u=l.filter((p,h)=>p?.hasChanges||n.currentNode.children.length<=h?(c.push(h),!0):!1);if(u.length===0||o.currentNode.hasError!==n.currentNode.hasError){for(;o.currentNode.parent&&s&&!o.currentNode.isNamed;)s=kli(o,n);let p=o.currentNode,h=rJi(o,e)??p;r.push({startIndex:h.startIndex,endIndex:p.endIndex,startPosition:h.startPosition,endPosition:p.endPosition}),s=Eli(o,n)}else u.length>=1&&(s=nJi(o,n,c[0]))}else s=Eli(o,n);while(s);return o.delete(),n.delete(),r}_findTreeChanges(e,t,o){let n=0,r=[];for(let s=0;s<t.length;s++){let l=t[s];if(r.length>0&&l.startIndex>=r[r.length-1].newRangeStartOffset&&l.endIndex<=r[r.length-1].newRangeEndOffset)continue;let c=e.walk(),u=()=>c.startIndex<l.startIndex&&c.endIndex>l.endIndex;for(;u();){let b=c.gotoFirstChild(),S=!1;for(;b;)if(u()&&c.currentNode.isNamed){S=!0;break}else b=c.gotoNextSibling();if(!S){c.gotoParent();break}if(c.currentNode.childCount===0)break}let p=c.currentNode.startPosition,h=c.currentNode.endPosition,g=c.currentNode.startIndex,f=c.currentNode.endIndex,v={newRange:new G(p.row+1,p.column+1,h.row+1,h.column+1),newRangeStartOffset:g,newRangeEndOffset:f};n<o.length&&sJi(o[n],{startIndex:g,endIndex:f,startPosition:p,endPosition:h})?(o[n].startIndex<v.newRangeStartOffset&&(v.newRange=v.newRange.setStartPosition(o[n].startPosition.row+1,o[n].startPosition.column+1),v.newRangeStartOffset=o[n].startIndex),o[n].endIndex>v.newRangeEndOffset&&(v.newRange=v.newRange.setEndPosition(o[n].endPosition.row+1,o[n].endPosition.column+1),v.newRangeEndOffset=o[n].endIndex),n++):n<o.length&&o[n].endIndex<v.newRangeStartOffset&&r.push({newRange:new G(o[n].startPosition.row+1,o[n].startPosition.column+1,o[n].endPosition.row+1,o[n].endPosition.column+1),newRangeStartOffset:o[n].startIndex,newRangeEndOffset:o[n].endIndex}),r.length>0&&r[r.length-1].newRangeEndOffset>=v.newRangeStartOffset?(r[r.length-1].newRange=G.fromPositions(r[r.length-1].newRange.getStartPosition(),v.newRange.getEndPosition()),r[r.length-1].newRangeEndOffset=v.newRangeEndOffset):r.push(v)}return this._constrainRanges(r)}_constrainRanges(e){if(!this._ranges)return e;let t=[],o=0,n=0;for(;o<e.length&&n<this._ranges.length;){let r=e[o],s=this._ranges[n];if(r.newRangeEndOffset<s.startIndex)o++;else if(r.newRangeStartOffset>s.endIndex)n++;else{let l=Math.max(r.newRangeStartOffset,s.startIndex),c=Math.min(r.newRangeEndOffset,s.endIndex),u=r.newRange.intersectRanges(new G(s.startPosition.row+1,s.startPosition.column+1,s.endPosition.row+1,s.endPosition.column+1));t.push({newRange:u,newRangeEndOffset:c,newRangeStartOffset:l}),c<r.newRangeEndOffset?(r.newRange=G.fromPositions(u.getEndPosition(),r.newRange.getEndPosition()),r.newRangeStartOffset=c+1):o++}}return t}async _parseAndUpdateTree(e){let t=await this._parse();if(t)return this._lastFullyParsed?.delete(),this._lastFullyParsed=t.copy(),this._lastFullyParsedWithEdits?.delete(),this._lastFullyParsedWithEdits=t.copy(),t;this._tree.get()||this._parser.reset()}_parse(){let e="fullParse";return this._tree.get()&&(e="incrementalParse"),this._parseAndYield(e)}async _parseAndYield(e){let t=0,o=0,n=this.textModel.getVersionId(),r,s=Aqo();do{let l=performance.now();r=this._parser.parse((c,u)=>this._parseCallback(c),this._tree.get(),{progressCallback:s,includedRanges:this._ranges}),t+=performance.now()-l,o++,await new Promise(c=>ox(c))}while(!this._store.isDisposed&&!r&&n===this.textModel.getVersionId());return this._sendParseTimeTelemetry(e,t,o),r&&n===this.textModel.getVersionId()?r:void 0}_parseCallback(e){try{return this.textModel.getTextBuffer().getNearestChunk(e)}catch(t){this._logService.debug("Error getting chunk for tree-sitter parsing",t)}}_setRanges(e){let t=[];if(this._ranges)for(let o of e){let n=!1;for(let r=0;r<this._ranges.length;r++){let s=this._ranges[r];if(Nqo(s,o)||sJi(s,o)){n=!0;break}}n||t.push(o)}else t.push(...e);return this._ranges=e,t}_sendParseTimeTelemetry(e,t,o){this._logService.debug(`Tree parsing (${e}) took ${t} ms and ${o} passes.`),e==="fullParse"?this._telemetryService.publicLog2("treeSitter.fullParse",{languageId:this.languageId,time:t,passes:o}):this._telemetryService.publicLog2("treeSitter.incrementalParse",{languageId:this.languageId,time:t,passes:o})}createParsedTreeSync(e){let t=new this._parserClass;t.setLanguage(this._parser.language);let o=t.parse(e);return t.delete(),o??void 0}};tke=I([m(5,re),m(6,_e)],tke);function Aqo(){let a=performance.now();return function(e){let t=performance.now();return t-a>50?(a=t,!0):!1}}function Nqo(a,i){return a.startPosition.row===i.startPosition.row&&a.startPosition.column===i.startPosition.column&&a.endPosition.row===i.endPosition.row&&a.endPosition.column===i.endPosition.column&&a.startIndex===i.startIndex&&a.endIndex===i.endIndex}function sJi(a,i){return a.startIndex<=i.startIndex&&a.endIndex>=i.startIndex||i.startIndex<=a.startIndex&&i.endIndex>=a.startIndex}var Tli=new class{clone(){return this}equals(a){return this===a}};function ike(a,i){let e=new Uint32Array(2);return e[0]=0,e[1]=(a<<0|0|0|32768|2<<24)>>>0,new Tce(e,[],i===null?Tli:i)}var UCt=class{constructor(i){this._default=i;this._store=[]}get(i){return i<this._store.length?this._store[i]:this._default}set(i,e){for(;i>=this._store.length;)this._store[this._store.length]=this._default;this._store[i]=e}replace(i,e,t){if(i>=this._store.length)return;if(e===0){this.insert(i,t);return}else if(t===0){this.delete(i,e);return}let o=this._store.slice(0,i),n=this._store.slice(i+e),r=Oqo(t,this._default);this._store=o.concat(r,n)}delete(i,e){e===0||i>=this._store.length||this._store.splice(i,e)}insert(i,e){if(e===0||i>=this._store.length)return;let t=[];for(let o=0;o<e;o++)t[o]=this._default;this._store=dz(this._store,i,t)}};function Oqo(a,i){let e=[];for(let t=0;t<a;t++)e[t]=i;return e}var SK=new Uint32Array(0).buffer,zy=class a{static deleteBeginning(i,e){return i===null||i===SK?i:a.delete(i,0,e)}static deleteEnding(i,e){if(i===null||i===SK)return i;let t=IK(i),o=t[t.length-2];return a.delete(i,e,o)}static delete(i,e,t){if(i===null||i===SK||e===t)return i;let o=IK(i),n=o.length>>>1;if(e===0&&o[o.length-2]===t)return SK;let r=Cd.findIndexInTokensArray(o,e),s=r>0?o[r-1<<1]:0,l=o[r<<1];if(t<l){let g=t-e;for(let f=r;f<n;f++)o[f<<1]-=g;return i}let c,u;s!==e?(o[r<<1]=e,c=r+1<<1,u=e):(c=r<<1,u=s);let p=t-e;for(let g=r+1;g<n;g++){let f=o[g<<1]-p;f>u&&(o[c++]=f,o[c++]=o[(g<<1)+1],u=f)}if(c===o.length)return i;let h=new Uint32Array(c);return h.set(o.subarray(0,c),0),h.buffer}static append(i,e){if(e===SK)return i;if(i===SK)return e;if(i===null)return i;if(e===null)return null;let t=IK(i),o=IK(e),n=o.length>>>1,r=new Uint32Array(t.length+o.length);r.set(t,0);let s=t.length,l=t[t.length-2];for(let c=0;c<n;c++)r[s++]=o[c<<1]+l,r[s++]=o[(c<<1)+1];return r.buffer}static insert(i,e,t){if(i===null||i===SK)return i;let o=IK(i),n=o.length>>>1,r=Cd.findIndexInTokensArray(o,e);r>0&&o[r-1<<1]===e&&r--;for(let s=r;s<n;s++)o[s<<1]+=t;return i}};function IK(a){return a instanceof Uint32Array?a:new Uint32Array(a)}var E8e=class a{static deserialize(i,e,t){let o=new Uint32Array(i.buffer),n=_y(i,e);e+=4;let r=_y(i,e);e+=4;let s=[];for(let l=0;l<r;l++){let c=_y(i,e);e+=4,s.push(o.subarray(e/4,e/4+c/4)),e+=c}return t.push(new a(n,s)),e}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._startLineNumber+this._tokens.length-1}constructor(i,e){this._startLineNumber=i,this._tokens=e}getLineRange(){return new vo(this._startLineNumber,this._startLineNumber+this._tokens.length)}getLineTokens(i){return this._tokens[i-this._startLineNumber]}appendLineTokens(i){this._tokens.push(i)}serializeSize(){let i=0;i+=4,i+=4;for(let e=0;e<this._tokens.length;e++){let t=this._tokens[e];if(!(t instanceof Uint32Array))throw new Error("Not supported!");i+=4,i+=t.byteLength}return i}serialize(i,e){Dy(i,this._startLineNumber,e),e+=4,Dy(i,this._tokens.length,e),e+=4;for(let t=0;t<this._tokens.length;t++){let o=this._tokens[t];if(!(o instanceof Uint32Array))throw new Error("Not supported!");Dy(i,o.byteLength,e),e+=4,i.set(new Uint8Array(o.buffer),e),e+=o.byteLength}return e}applyEdit(i,e){let[t,o]=NI(e);this._acceptDeleteRange(i),this._acceptInsertText(new ye(i.startLineNumber,i.startColumn),t,o)}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return;let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;if(t<0){let o=t-e;this._startLineNumber-=o;return}if(!(e>=this._tokens.length)){if(e<0&&t>=this._tokens.length){this._startLineNumber=0,this._tokens=[];return}if(e===t){this._tokens[e]=zy.delete(this._tokens[e],i.startColumn-1,i.endColumn-1);return}if(e>=0)if(this._tokens[e]=zy.deleteEnding(this._tokens[e],i.startColumn-1),t<this._tokens.length){let o=zy.deleteBeginning(this._tokens[t],i.endColumn-1);this._tokens[e]=zy.append(this._tokens[e],o),this._tokens.splice(e+1,t-e)}else this._tokens[e]=zy.append(this._tokens[e],null),this._tokens=this._tokens.slice(0,e+1);else{let o=-e;this._startLineNumber-=o,this._tokens[t]=zy.deleteBeginning(this._tokens[t],i.endColumn-1),this._tokens=this._tokens.slice(t)}}}_acceptInsertText(i,e,t){if(e===0&&t===0)return;let o=i.lineNumber-this._startLineNumber;if(o<0){this._startLineNumber+=e;return}if(!(o>=this._tokens.length)){if(e===0){this._tokens[o]=zy.insert(this._tokens[o],i.column-1,t);return}this._tokens[o]=zy.deleteEnding(this._tokens[o],i.column-1),this._tokens[o]=zy.insert(this._tokens[o],i.column-1,t),this._insertLines(i.lineNumber,e)}}_insertLines(i,e){if(e===0)return;let t=[];for(let o=0;o<e;o++)t[o]=null;this._tokens=dz(this._tokens,i,t)}};var yK=class{static deserialize(i){let e=0,t=_y(i,e);e+=4;let o=[];for(let n=0;n<t;n++)e=E8e.deserialize(i,e,o);return o}constructor(){this._tokens=[]}add(i,e){if(this._tokens.length>0){let t=this._tokens[this._tokens.length-1];if(t.endLineNumber+1===i){t.appendLineTokens(e);return}}this._tokens.push(new E8e(i,[e]))}finalize(){return this._tokens}serialize(){let i=this._serializeSize(),e=new Uint8Array(i);return this._serialize(e),e}_serializeSize(){let i=0;i+=4;for(let e=0;e<this._tokens.length;e++)i+=this._tokens[e].serializeSize();return i}_serialize(i){let e=0;Dy(i,this._tokens.length,e),e+=4;for(let t=0;t<this._tokens.length;t++)e=this._tokens[t].serialize(i,e)}};var _li=class{constructor(i,e){this.tokenizationSupport=e;this.initialState=this.tokenizationSupport.getInitialState(),this.store=new oke(i)}getStartState(i){return this.store.getStartState(i,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}},zCt=class extends _li{constructor(e,t,o,n){super(e,t);this._textModel=o;this._languageIdCodec=n}updateTokensUntilLine(e,t){let o=this._textModel.getLanguageId();for(;;){let n=this.getFirstInvalidLine();if(!n||n.lineNumber>t)break;let r=this._textModel.getLineContent(n.lineNumber),s=T8e(this._languageIdCodec,o,this.tokenizationSupport,r,!0,n.startState);e.add(n.lineNumber,s.tokens),this.store.setEndState(n.lineNumber,s.endState)}}getTokenTypeIfInsertingCharacter(e,t){let o=this.getStartState(e.lineNumber);if(!o)return 0;let n=this._textModel.getLanguageId(),r=this._textModel.getLineContent(e.lineNumber),s=r.substring(0,e.column-1)+t+r.substring(e.column-1),l=T8e(this._languageIdCodec,n,this.tokenizationSupport,s,!0,o),c=new Cd(l.tokens,s,this._languageIdCodec);if(c.getCount()===0)return 0;let u=c.findTokenIndexAtOffset(e.column-1);return c.getStandardTokenType(u)}tokenizeLinesAt(e,t){let o=this.getStartState(e);if(!o)return null;let n=this._textModel.getLanguageId(),r=[],s=o;for(let l of t){let c=T8e(this._languageIdCodec,n,this.tokenizationSupport,l,!0,s);r.push(new Cd(c.tokens,l,this._languageIdCodec)),s=c.endState}return r}hasAccurateTokensForLine(e){let t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t}isCheapToTokenize(e){let t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t||e===t&&this._textModel.getLineLength(e)<2048}tokenizeHeuristically(e,t,o){if(o<=this.store.getFirstInvalidEndStateLineNumberOrMax())return{heuristicTokens:!1};if(t<=this.store.getFirstInvalidEndStateLineNumberOrMax())return this.updateTokensUntilLine(e,o),{heuristicTokens:!1};let n=this.guessStartState(t),r=this._textModel.getLanguageId();for(let s=t;s<=o;s++){let l=this._textModel.getLineContent(s),c=T8e(this._languageIdCodec,r,this.tokenizationSupport,l,!0,n);e.add(s,c.tokens),n=c.endState}return{heuristicTokens:!0}}guessStartState(e){let{likelyRelevantLines:t,initialState:o}=Rli(this._textModel,e,this);o||(o=this.tokenizationSupport.getInitialState());let n=this._textModel.getLanguageId(),r=o;for(let s of t)r=T8e(this._languageIdCodec,n,this.tokenizationSupport,s,!1,r).endState;return r}};function Rli(a,i,e){let t=a.getLineFirstNonWhitespaceColumn(i),o=[],n=null;for(let r=i-1;t>1&&r>=1;r--){let s=a.getLineFirstNonWhitespaceColumn(r);if(s!==0&&s<t&&(o.push(a.getLineContent(r)),t=s,n=e?.getStartState(r),n))break}return o.reverse(),{likelyRelevantLines:o,initialState:n??void 0}}var oke=class{constructor(i){this.lineCount=i;this._tokenizationStateStore=new _8e;this._invalidEndStatesLineNumbers=new Dli;this._invalidEndStatesLineNumbers.addRange(new gi(1,i+1))}getEndState(i){return this._tokenizationStateStore.getEndState(i)}setEndState(i,e){if(!e)throw new ci("Cannot set null/undefined state");this._invalidEndStatesLineNumbers.delete(i);let t=this._tokenizationStateStore.setEndState(i,e);return t&&i<this.lineCount&&this._invalidEndStatesLineNumbers.addRange(new gi(i+1,i+2)),t}acceptChange(i,e){this.lineCount+=e-i.length,this._tokenizationStateStore.acceptChange(i,e),this._invalidEndStatesLineNumbers.addRangeAndResize(new gi(i.startLineNumber,i.endLineNumberExclusive),e)}acceptChanges(i){for(let e of i){let[t]=NI(e.text);this.acceptChange(new vo(e.range.startLineNumber,e.range.endLineNumber+1),t+1)}}invalidateEndStateRange(i){this._invalidEndStatesLineNumbers.addRange(new gi(i.startLineNumber,i.endLineNumberExclusive))}getFirstInvalidEndStateLineNumber(){return this._invalidEndStatesLineNumbers.min}getFirstInvalidEndStateLineNumberOrMax(){return this.getFirstInvalidEndStateLineNumber()||Number.MAX_SAFE_INTEGER}allStatesValid(){return this._invalidEndStatesLineNumbers.min===null}getStartState(i,e){return i===1?e:this.getEndState(i-1)}getFirstInvalidLine(i){let e=this.getFirstInvalidEndStateLineNumber();if(e===null)return null;let t=this.getStartState(e,i);if(!t)throw new ci("Start state must be defined");return{lineNumber:e,startState:t}}},_8e=class{constructor(){this._lineEndStates=new UCt(null)}getEndState(i){return this._lineEndStates.get(i)}setEndState(i,e){let t=this._lineEndStates.get(i);return t&&t.equals(e)?!1:(this._lineEndStates.set(i,e),!0)}acceptChange(i,e){let t=i.length;e>0&&t>0&&(t--,e--),this._lineEndStates.replace(i.startLineNumber,t,e)}acceptChanges(i){for(let e of i){let[t]=NI(e.text);this.acceptChange(new vo(e.range.startLineNumber,e.range.endLineNumber+1),t+1)}}},Dli=class{constructor(){this._ranges=[]}getRanges(){return this._ranges}get min(){return this._ranges.length===0?null:this._ranges[0].start}removeMin(){if(this._ranges.length===0)return null;let i=this._ranges[0];return i.start+1===i.endExclusive?this._ranges.shift():this._ranges[0]=new gi(i.start+1,i.endExclusive),i.start}delete(i){let e=this._ranges.findIndex(t=>t.contains(i));if(e!==-1){let t=this._ranges[e];t.start===i?t.endExclusive===i+1?this._ranges.splice(e,1):this._ranges[e]=new gi(i+1,t.endExclusive):t.endExclusive===i+1?this._ranges[e]=new gi(t.start,i):this._ranges.splice(e,1,new gi(t.start,i),new gi(i+1,t.endExclusive))}}addRange(i){gi.addRange(i,this._ranges)}addRangeAndResize(i,e){let t=0;for(;!(t>=this._ranges.length||i.start<=this._ranges[t].endExclusive);)t++;let o=t;for(;!(o>=this._ranges.length||i.endExclusive<this._ranges[o].start);)o++;let n=e-i.length;for(let r=o;r<this._ranges.length;r++)this._ranges[r]=this._ranges[r].delta(n);if(t===o){let r=new gi(i.start,i.start+e);r.isEmpty||this._ranges.splice(t,0,r)}else{let r=Math.min(i.start,this._ranges[t].start),s=Math.max(i.endExclusive,this._ranges[o-1].endExclusive),l=new gi(r,s+n);l.isEmpty?this._ranges.splice(t,o-t):this._ranges.splice(t,o-t,l)}}toString(){return this._ranges.map(i=>i.toString()).join(" + ")}};function T8e(a,i,e,t,o,n){let r=null;if(e)try{r=e.tokenizeEncoded(t,o,n.clone())}catch(s){mt(s)}return r||(r=ike(a.encodeLanguageId(i),n)),Cd.convertToEndOffset(r.tokens,t.length),r}var KCt=class{constructor(i,e){this._tokenizerWithStateStore=i;this._backgroundTokenStore=e;this._isDisposed=!1;this._isScheduled=!1}dispose(){this._isDisposed=!0}handleChanges(){this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._isScheduled||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._isScheduled=!0,TL(i=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(i)}))}_backgroundTokenizeWithDeadline(i){let e=Date.now()+i.timeRemaining(),t=()=>{this._isDisposed||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._backgroundTokenizeForAtLeast1ms(),Date.now()<e?ox(t):this._beginBackgroundTokenization())};t()}_backgroundTokenizeForAtLeast1ms(){let i=this._tokenizerWithStateStore._textModel.getLineCount(),e=new yK,t=On.create(!1);do if(t.elapsed()>1||this._tokenizeOneInvalidLine(e)>=i)break;while(this._hasLinesToTokenize());this._backgroundTokenStore.setTokens(e.finalize()),this.checkFinished()}_hasLinesToTokenize(){return this._tokenizerWithStateStore?!this._tokenizerWithStateStore.store.allStatesValid():!1}_tokenizeOneInvalidLine(i){let e=this._tokenizerWithStateStore?.getFirstInvalidLine();return e?(this._tokenizerWithStateStore.updateTokensUntilLine(i,e.lineNumber),e.lineNumber):this._tokenizerWithStateStore._textModel.getLineCount()+1}checkFinished(){this._isDisposed||this._tokenizerWithStateStore.store.allStatesValid()&&this._backgroundTokenStore.backgroundTokenizationFinished()}requestTokens(i,e){this._tokenizerWithStateStore.store.invalidateEndStateRange(new vo(i,e))}};var Z5=class a{constructor(i){this.height=i;this._children=[];this._length=0}get children(){return this._children}get length(){return this._length}static create(i,e){let t=new a(i.height+1);return t.appendChild(i),t.appendChild(e),t}canAppendChild(){return this._children.length<3}appendChild(i){if(!this.canAppendChild())throw new Error("Cannot insert more than 3 children in a ListNode");this._children.push(i),this._length+=i.length,this._updateParentLength(i.length),OI(i)||(i.parent=this)}_updateParentLength(i){let e=this.parent;for(;e;)e._length+=i,e=e.parent}unappendChild(){let i=this._children.pop();return this._length-=i.length,this._updateParentLength(-i.length),i}prependChild(i){if(this._children.length>=3)throw new Error("Cannot prepend more than 3 children in a ListNode");this._children.unshift(i),this._length+=i.length,this._updateParentLength(i.length),OI(i)||(i.parent=this)}unprependChild(){let i=this._children.shift();return this._length-=i.length,this._updateParentLength(-i.length),i}lastChild(){return this._children[this._children.length-1]}dispose(){this._children.splice(0,this._children.length)}};function OI(a){return a.token!==void 0}function aJi(a,i){let e=a,t=[],o;for(;;){if(i.height===e.height){o=i;break}if(OI(e))throw new Error("unexpected");t.push(e),e=e.lastChild()}for(let n=t.length-1;n>=0;n--){let r=t[n];o&&(r.children.length>=3?o=Z5.create(r.unappendChild(),o):(r.appendChild(o),o=void 0))}if(o){let n=new Z5(o.height+1);return n.appendChild(a),n.appendChild(o),n}else return a}function Fqo(a,i){let e=a,t=[];for(;i.height!==e.height;){if(OI(e))throw new Error("unexpected");t.push(e),e=e.children[0]}let o=i;for(let n=t.length-1;n>=0;n--){let r=t[n];o&&(r.children.length>=3?o=Z5.create(o,r.unprependChild()):(r.prependChild(o),o=void 0))}return o?Z5.create(o,a):a}function Wqo(a,i){return a.height===i.height?Z5.create(a,i):a.height>i.height?aJi(a,i):Fqo(i,a)}var GCt=class a{constructor(i){this._textModel=i;this._root=this.createEmptyRoot()}get root(){return this._root}createEmptyRoot(){return{length:this._textModel.getValueLength(),token:0,height:0,tokenQuality:0}}buildStore(i,e){this._root=this.createFromUpdates(i,e)}createFromUpdates(i,e){if(i.length===0)return this.createEmptyRoot();let t={length:i[0].length,token:i[0].token,height:0,tokenQuality:e};for(let o=1;o<i.length;o++)t=aJi(t,{length:i[o].length,token:i[o].token,height:0,tokenQuality:e});return t}update(i,e,t){e.length!==0&&this.replace(i,e[0].startOffsetInclusive,e,t)}delete(i,e){this.replace(i,e,[],2)}replace(i,e,t,o){let n=e+i,r=[],s=[],l=[{node:this._root,offset:0}];for(;l.length>0;){let p=l.pop(),h=p.offset;if(h<e&&h+p.node.length<=e){OI(p.node)||(p.node.parent=void 0),r.push(p.node);continue}else OI(p.node)&&h<e&&r.push({length:e-h,token:p.node.token,height:0,tokenQuality:p.node.tokenQuality});if(!(e<=h&&h+p.node.length<=n)){if(h>=n){OI(p.node)||(p.node.parent=void 0),s.push(p.node);continue}else if(OI(p.node)&&h+p.node.length>n){s.push({length:h+p.node.length-n,token:p.node.token,height:0,tokenQuality:p.node.tokenQuality});continue}if(!OI(p.node)){let g=h+p.node.length;for(let f=p.node.children.length-1;f>=0;f--)g-=p.node.children[f].length,l.push({node:p.node.children[f],offset:g})}}}let c;t.length>0?c=r.concat(this.createFromUpdates(t,o),s):c=r.concat(s);let u=c[0];for(let p=1;p<c.length;p++)u=Wqo(u,c[p]);this._root=u??this.createEmptyRoot()}traverseInOrderInRange(i,e,t){let o=[{node:this._root,offset:0}];for(;o.length>0;){let{node:n,offset:r}=o.pop();if(!(r+n.length<=i||r>=e)){if(t(n,r))return;if(!OI(n)){let l=r+n.length;for(let c=n.children.length-1;c>=0;c--)l-=n.children[c].length,o.push({node:n.children[c],offset:l})}}}}getTokenAt(i){let e;return this.traverseInOrderInRange(i,this._root.length,(t,o)=>OI(t)?(e={token:t.token,startOffsetInclusive:o,length:t.length},!0):!1),e}getTokensInRange(i,e){let t=[];return this.traverseInOrderInRange(i,e,(o,n)=>{if(OI(o)){let r=o.length,s=n;n<i&&n+o.length>e?(s=i,r=e-i):n<i?(r-=i-n,s=i):n+o.length>e&&(r-=n+o.length-e),t.push({token:o.token,startOffsetInclusive:s,length:r})}return!1}),t}markForRefresh(i,e){this.traverseInOrderInRange(i,e,t=>(OI(t)&&(t.tokenQuality=0),!1))}rangeHasTokens(i,e,t){let o=!0;return this.traverseInOrderInRange(i,e,n=>(OI(n)&&n.tokenQuality<t&&(o=!1),!1)),o}rangeNeedsRefresh(i,e){let t=!1;return this.traverseInOrderInRange(i,e,o=>(OI(o)&&o.tokenQuality!==3&&(t=!0),!1)),t}getNeedsRefresh(){let i=[];return this.traverseInOrderInRange(0,this._textModel.getValueLength(),(e,t)=>(OI(e)&&e.tokenQuality!==3&&(i.length>0&&i[i.length-1].endOffset===t?i[i.length-1].endOffset+=e.length:i.push({startOffset:t,endOffset:t+e.length})),!1)),i}deepCopy(){let i=new a(this._textModel);return i._root=this._copyNodeIterative(this._root),i}_copyNodeIterative(i){let e=OI(i)?{length:i.length,token:i.token,tokenQuality:i.tokenQuality,height:i.height}:new Z5(i.height),t=[[i,e]];for(;t.length>0;){let[o,n]=t.pop();if(!OI(o))for(let r of o.children){let s=OI(r)?{length:r.length,token:r.token,tokenQuality:r.tokenQuality,height:r.height}:new Z5(r.height);n.appendChild(s),t.push([r,s])}}return e}printTree(i=this._root){let e=[],t=[[i,0]];for(;t.length>0;){let[o,n]=t.pop(),r="  ".repeat(n);if(OI(o))e.push(`${r}Leaf(length: ${o.length}, token: ${o.token}, refresh: ${o.tokenQuality})
`);else{e.push(`${r}List(length: ${o.length})
`);for(let s=o.children.length-1;s>=0;s--)t.push([o.children[s],n+1])}}return e.join("")}dispose(){let i=[[this._root,!1]];for(;i.length>0;){let[e,t]=i.pop();if(!OI(e))if(t)e.dispose(),e.parent=void 0;else{i.push([e,!0]);for(let o=e.children.length-1;o>=0;o--)i.push([e.children[o],!1])}}this._root=void 0}};var qCt=le("treeSitterThemeService");var nke=class extends k{constructor(e,t,o,n,r){super();this._tree=e;this._highlightingQueries=t;this._languageIdCodec=o;this._visibleLineRanges=n;this._treeSitterThemeService=r;this._onDidChangeTokens=this._register(new T);this.onDidChangeTokens=this._onDidChangeTokens.event;this._onDidCompleteBackgroundTokenization=this._register(new T);this.onDidChangeBackgroundTokenization=this._onDidCompleteBackgroundTokenization.event;this._encodedLanguageId=this._languageIdCodec.encodeLanguageId(this._tree.languageId),this._register(Zs(this._treeSitterThemeService.onChange,()=>{this._updateTheme()})),this._tokenStore=this._register(new GCt(this._textModel)),this._accurateVersion=this._textModel.getVersionId(),this._guessVersion=this._textModel.getVersionId(),this._tokenStore.buildStore(this._createEmptyTokens(),0),this._register(ve(s=>{let l=this._visibleLineRanges.read(s);this._parseAndTokenizeViewPort(l)})),this._register(fA({owner:this,changeTracker:coi({tree:this._tree.tree})},(s,l)=>{let c=l.changes.at(0)?.change;if(l.changes.length>1)throw new ci("The tree changed twice in one transaction. This is currently not supported and should not happen.");if(!c)l.tree&&this._firstTreeUpdate(this._tree.treeLastParsedVersion.read(s));else{if(this.hasTokens())for(let u of c.ranges)this._markForRefresh(u.newRange);this.hasTokens()?this._handleTreeUpdate(c.ranges,c.versionId):this._firstTreeUpdate(c.versionId)}}))}get _textModel(){return this._tree.textModel}handleContentChanged(e){this._guessVersion=e.versionId;for(let t of e.changes)if(t.text.length>t.rangeLength){let o=t.rangeOffset>0?t.rangeOffset-1:t.rangeOffset,n=this._tokenStore.getTokenAt(o),r;n?(r={startOffsetInclusive:n.startOffsetInclusive,length:n.length+t.text.length-t.rangeLength,token:n.token},this._tokenStore.markForRefresh(o,t.rangeOffset+(t.text.length>t.rangeLength?t.text.length:t.rangeLength))):r={startOffsetInclusive:o,length:t.text.length,token:0},this._tokenStore.update(n?.length??0,[r],2)}else if(t.text.length<t.rangeLength){let o=t.rangeLength-t.text.length;this._tokenStore.delete(o,t.rangeOffset)}}getLineTokens(e){let t=this._textModel.getLineContent(e),o=this.getTokens(e);return new Cd(o,t,this._languageIdCodec)}_createEmptyTokens(){let e=this._emptyToken(),t=this._textModel.getValueLength();return[this._emptyTokensForOffsetAndLength(0,t,e)]}_emptyToken(){return this._treeSitterThemeService.findMetadata([],this._encodedLanguageId,!1,void 0)}_emptyTokensForOffsetAndLength(e,t,o){return{token:o,length:e+t,startOffsetInclusive:0}}hasAccurateTokensForLine(e){return this.hasTokens(new G(e,1,e,this._textModel.getLineMaxColumn(e)))}tokenizeLinesAt(e,t){let o=this._guessTokensForLinesContent(e,t),n=[];if(!o)return null;for(let r=0;r<o.length;r++)n.push(new Cd(o[r],t[r],this._languageIdCodec));return n}_rangeHasTokens(e,t){return this._tokenStore.rangeHasTokens(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()),t)}hasTokens(e){return!e||this._guessVersion===this._accurateVersion?!0:!this._tokenStore.rangeNeedsRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}getTokens(e){let t=this._textModel.getOffsetAt({lineNumber:e,column:1}),o=this._textModel.getOffsetAt({lineNumber:e,column:this._textModel.getLineLength(e)+1}),n=this._tokenStore.getTokensInRange(t,o),r=new Uint32Array(n.length*2);for(let s=0;s<n.length;s++)r[s*2]=n[s].startOffsetInclusive-t+n[s].length,r[s*2+1]=n[s].token;return r}getTokensInRange(e,t,o,n){let r=n?this._tokenizeCapturesWithMetadata(n,t,o):this._tokenize(e,t,o);if(r?.endOffsetsAndMetadata)return this._rangeTokensAsUpdates(t,r.endOffsetsAndMetadata)}_updateTokensInStore(e,t,o){this._accurateVersion=e;for(let n of t){let r=n.newTokens.length>0?n.newTokens[n.newTokens.length-1]:void 0,s;r&&this._guessVersion>=e?s=r.startOffsetInclusive+r.length-n.newTokens[0].startOffsetInclusive:n.oldRangeLength?s=n.oldRangeLength:s=0,this._tokenStore.update(s,n.newTokens,o)}}_markForRefresh(e){this._tokenStore.markForRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}_getNeedsRefresh(){let e=this._tokenStore.getNeedsRefresh();return e?e.map(t=>({range:G.fromPositions(this._textModel.getPositionAt(t.startOffset),this._textModel.getPositionAt(t.endOffset)),startOffset:t.startOffset,endOffset:t.endOffset})):[]}_parseAndTokenizeViewPort(e){let t=e.map(o=>o.toInclusiveRange()).filter(so);for(let o of t){let n=this._textModel.getOffsetAt(o.getStartPosition()),r=this._textModel.getOffsetAt(o.getEndPosition()),s=this._textModel.getVersionId();if(this._rangeHasTokens(o,1))continue;let l=this._textModel.getValueInRange(o),c=this._forceParseAndTokenizeContent(o,n,r,l,!0);if(!c||this._rangeHasTokens(o,1)||c.length===0)continue;let u=c[c.length-1],p=u.startOffsetInclusive+u.length-c[0].startOffsetInclusive;this._updateTokensInStore(s,[{newTokens:c,oldRangeLength:p}],1),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:o.startLineNumber,toLineNumber:o.endLineNumber}]}})}}_guessTokensForLinesContent(e,t){if(t.length===0)return;let o=t.join(this._textModel.getEOL()),n=new G(1,1,e+t.length,t[t.length-1].length+1),r=this._textModel.getOffsetAt({lineNumber:e,column:1}),s=this._forceParseAndTokenizeContent(n,r,r+o.length,o,!1);if(!s)return;let l=new Array(t.length),c=0,u=0,p=0;for(let h=0;h<t.length;h++){let g=[],f=!1;for(let v=c;!f&&v<s.length;v++){let b=s[v],S=b.endOffset-p,y=u-p;if(S<=t[h].length)g.push({endOffset:S,metadata:b.metadata}),c++;else if(y<t[h].length){let w={endOffset:t[h].length,metadata:b.metadata};g.push(w),f=!0}else f=!0;u=b.endOffset}l[h]=this._endOffsetTokensToUint32Array(g),p+=t[h].length+this._textModel.getEOL().length}return l}_forceParseAndTokenizeContent(e,t,o,n,r){let s=Rli(this._textModel,e.startLineNumber).likelyRelevantLines,l=s.join(this._textModel.getEOL()),c=this._tree.createParsedTreeSync(`${l}${n}`);if(!c)return;let u=new G(1,1,e.endLineNumber-e.startLineNumber+1+s.length,e.endColumn),p=this.captureAtRange(u),h=this._tokenizeCapturesWithMetadata(p,l.length,o-t+l.length);if(c.delete(),!!h)return r?this._rangeTokensAsUpdates(t,h.endOffsetsAndMetadata,l.length):h.endOffsetsAndMetadata}_firstTreeUpdate(e){return this._setViewPortTokens(e)}_setViewPortTokens(e){let t=this._visibleLineRanges.get().map(o=>{let n=o.toInclusiveRange();if(!n)return;let r=this._textModel.getOffsetAt(n.getStartPosition()),s=this._textModel.getOffsetAt(n.getEndPosition());return{newRange:n,newRangeEndOffset:s,newRangeStartOffset:r}}).filter(so);return this._handleTreeUpdate(t,e)}_handleTreeUpdate(e,t){let o=[];for(let s=0;s<e.length;s++)if(e[s].newRange.endLineNumber-e[s].newRange.startLineNumber>1e3){let c=e[s].newRange.endLineNumber,u=e[s].newRange.startLineNumber,p=e[s].newRange.startColumn,h=u+1e3;do{let g=new ye(u,p),f=h===e[s].newRange.endLineNumber?e[s].newRange.endColumn:this._textModel.getLineMaxColumn(h),v=new ye(h,f),b=G.fromPositions(g,v);o.push({range:b,startOffset:this._textModel.getOffsetAt(b.getStartPosition()),endOffset:this._textModel.getOffsetAt(b.getEndPosition())}),u=h+1,p=1,h<c&&h+1e3>c?h=c:h=h+1e3}while(h<=c)}else if(s===0||o[s-1].endOffset<e[s].newRangeStartOffset)o.push({range:e[s].newRange,startOffset:e[s].newRangeStartOffset,endOffset:e[s].newRangeEndOffset});else if(o[s-1].endOffset<e[s].newRangeEndOffset){let c=this._textModel.getPositionAt(o[s-1].endOffset+1),u=new G(c.lineNumber,c.column,e[s].newRange.endLineNumber,e[s].newRange.endColumn);o.push({range:u,startOffset:o[s-1].endOffset+1,endOffset:e[s].newRangeEndOffset})}let r=o.map(s=>this._getCaptures(s.range));return this._updateTreeForRanges(o,t,r).then(()=>{!this._textModel.isDisposed()&&this._tree.treeLastParsedVersion.get()===this._textModel.getVersionId()&&this._refreshNeedsRefresh(t)})}async _updateTreeForRanges(e,t,o){let n;for(let r=0;r<e.length&&!(!this._textModel.isDisposed()&&t!==this._textModel.getVersionId());r++){let s=o[r],l=e[r],c=this.getTokensInRange(l.range,l.startOffset,l.endOffset,s);c?n={newTokens:c}:n={newTokens:[]},this._updateTokensInStore(t,[n],3),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:l.range.getStartPosition().lineNumber,toLineNumber:l.range.getEndPosition().lineNumber}]}}),await new Promise(u=>ox(u))}this._onDidCompleteBackgroundTokenization.fire()}_refreshNeedsRefresh(e){let t=this._getNeedsRefresh();if(t.length===0)return;let o=new Array(t.length);for(let n=0;n<t.length;n++){let r=t[n];o[n]={newRange:r.range,newRangeStartOffset:r.startOffset,newRangeEndOffset:r.endOffset}}this._handleTreeUpdate(o,e)}_rangeTokensAsUpdates(e,t,o){let n=[],r=0;for(let s of t){if(s.endOffset<=r||o&&s.endOffset<o)continue;let l;o&&r<o?l={startOffsetInclusive:e+o,length:s.endOffset-o,token:s.metadata}:l={startOffsetInclusive:e+r,length:s.endOffset-r,token:s.metadata},n.push(l),r=s.endOffset}return n}_updateTheme(){let e=this._textModel.getFullModelRange();this._markForRefresh(e),this._parseAndTokenizeViewPort(this._visibleLineRanges.get())}captureAtPosition(e,t){return this.captureAtRangeWithInjections(new G(e,t,e,t+1))}captureAtRangeTree(e){return this.captureAtRangeWithInjections(e)}captureAtRange(e){let t=this._tree.tree.get();return t?this._highlightingQueries.captures(t.rootNode,{startPosition:{row:e.startLineNumber-1,column:e.startColumn-1},endPosition:{row:e.endLineNumber-1,column:e.endColumn-1}}).map(o=>({name:o.name,text:o.node.text,node:{startIndex:o.node.startIndex,endIndex:o.node.endIndex,startPosition:{lineNumber:o.node.startPosition.row+1,column:o.node.startPosition.column+1},endPosition:{lineNumber:o.node.endPosition.row+1,column:o.node.endPosition.column+1}},encodedLanguageId:this._encodedLanguageId})):[]}captureAtRangeWithInjections(e){let t=this.captureAtRange(e);for(let o=0;o<t.length;o++){let n=t[o],r=n.node.startPosition.lineNumber,s=n.node.endPosition.lineNumber,l=n.node.startPosition.column,c=n.node.endPosition.column,u=r>e.startLineNumber&&r<e.endLineNumber?r:e.startLineNumber,p=s>e.startLineNumber&&s<e.endLineNumber?s:e.endLineNumber,h=r===e.startLineNumber?l<e.startColumn?e.startColumn:l:r<e.startLineNumber?e.startColumn:l,g=s===e.endLineNumber?c>e.endColumn?e.endColumn:c:s>e.endLineNumber?e.endColumn:c,f=new G(u,h,p,g),v=this._getInjectionCaptures(n,f);v&&v.length>0&&(t.splice(o+1,0,...v),o+=v.length)}return t}tokenizeEncoded(e){let t=this._tokenizeEncoded(e);if(!t)return;let o=this._rangeTokensAsUpdates(this._textModel.getOffsetAt({lineNumber:e,column:1}),t.result);t.versionId===this._textModel.getVersionId()&&this._updateTokensInStore(t.versionId,[{newTokens:o,oldRangeLength:this._textModel.getLineLength(e)}],3)}tokenizeEncodedInstrumented(e){let t=this._tokenizeEncoded(e);if(t)return{result:this._endOffsetTokensToUint32Array(t.result),captureTime:t.captureTime,metadataTime:t.metadataTime}}_getCaptures(e){return this.captureAtRangeWithInjections(e)}_tokenize(e,t,o){let n=this._getCaptures(e),r=this._tokenizeCapturesWithMetadata(n,t,o);if(r)return{...r,versionId:this._tree.treeLastParsedVersion.get()}}_createTokensFromCaptures(e,t,o){let n=this._tree.tree.get(),r=On.create(),s=o-t,l=this._languageIdCodec.encodeLanguageId(this._tree.languageId),c=Vqo[this._tree.languageId]||"source";if(e.length===0)return n?(r.stop(),{endOffsets:[{endOffset:s,scopes:[],encodedLanguageId:l}],captureTime:r.elapsed()}):void 0;let u=Array(e.length);u.fill({endOffset:0,scopes:[c],encodedLanguageId:l});let p=0,h=()=>{u.push({endOffset:0,scopes:[c],encodedLanguageId:l})},g=(b,S)=>b.name.includes("punctuation")&&b.text?Array.from(b.text.matchAll(Bqo)).map(y=>S+y.index):void 0,f=(b,S,y,w)=>{if(w!==void 0){let x=u[w].scopes,E=u[w].bracket;if((w>0?u[w-1].endOffset:0)!==S){let N;if(E&&E.length>0){N=[];let V=[];for(let H=0;H<E.length;H++){let K=E[H];K<S?N.push(K):K>y&&V.push(K)}N.length===0&&(N=void 0),V.length===0?E=void 0:E=V}u.splice(w,0,{endOffset:S,scopes:[...x],bracket:N,encodedLanguageId:b.encodedLanguageId}),w++,h(),p++}u.splice(w,0,{endOffset:y,scopes:[...x,b.name],bracket:g(b,S),encodedLanguageId:b.encodedLanguageId}),u[p].bracket=E}else u[p]={endOffset:y,scopes:[c,b.name],bracket:g(b,S),encodedLanguageId:b.encodedLanguageId};p++};for(let b=0;b<e.length;b++){let S=e[b],y=S.node.endIndex<o?S.node.endIndex<t?t:S.node.endIndex:o,w=S.node.startIndex<t?t:S.node.startIndex,x=y-t,E,M=y-w;b>0?E=u[p-1].endOffset:E=w-t-1;let N=x-M;if(E>=0&&E<N&&(u[p]={endOffset:N,scopes:[c],encodedLanguageId:this._encodedLanguageId},p++,h()),!(M<0))if(E>=x){let V=p-1,H=u[V].endOffset,K=V>=2?u[V-1].endOffset:0;do{if(K+M===H){if(K===N){u[V].scopes.push(S.name);let j=u[V].bracket;u[V].bracket=j&&j.length>0?j:g(S,N)}}else if(K<=N){f(S,N,x,V);break}V--,K=V>=1?u[V-1].endOffset:0,H=V>=0?u[V].endOffset:0}while(H>N)}else f(S,N,x)}u[p-1].endOffset<s&&s-u[p-1].endOffset>0&&(h(),u[p]={endOffset:s,scopes:u[p].scopes,encodedLanguageId:this._encodedLanguageId},p++);for(let b=0;b<u.length;b++)if(u[b].endOffset===0&&b!==0){u.splice(b,u.length-b);break}let v=r.elapsed();return{endOffsets:u,captureTime:v}}_getInjectionCaptures(e,t){return[]}_tokenizeCapturesWithMetadata(e,t,o){let n=On.create(),r=this._createTokensFromCaptures(e,t,o);if(!r)return;let s=r.endOffsets;for(let c=0;c<s.length;c++){let u=s[c];u.metadata=this._treeSitterThemeService.findMetadata(u.scopes,u.encodedLanguageId,!!u.bracket&&u.bracket.length>0,void 0)}let l=n.elapsed();return{endOffsetsAndMetadata:s,captureTime:r.captureTime,metadataTime:l}}_tokenizeEncoded(e){let t=this._textModel.getOffsetAt({lineNumber:e,column:1}),o=this._textModel.getLineCount(),n=e+1<=o?this._textModel.getOffsetAt({lineNumber:e+1,column:1}):this._textModel.getValueLength(),r=n-t,s=this._tokenize(new G(e,1,e,r+1),t,n);if(s)return{result:s.endOffsetsAndMetadata,captureTime:s.captureTime,metadataTime:s.metadataTime,versionId:s.versionId}}_endOffsetTokensToUint32Array(e){let t=new Uint32Array(e.length*2);for(let o=0;o<e.length;o++)t[o*2]=e[o].endOffset,t[o*2+1]=e[o].metadata;return t}};nke=I([m(4,qCt)],nke);var Vqo={css:"source.css",typescript:"source.ts",ini:"source.ini",regex:"source.regex"},Bqo=/[\{\}\[\]\<\>\(\)]/g;var NX=le("treeSitterLibraryService");var wK=class extends Zxe{constructor(e,t,o,n,r,s){super(t,o);this._languageIdObs=e;this._treeSitterLibraryService=r;this._instantiationService=s;this._backgroundTokenizationState=1;this._onDidChangeBackgroundTokenizationState=this._register(new T);this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event;let l=new Uc(this._treeSitterLibraryService.getParserClass()),c=ke(this,u=>l.promiseResult?.read(u)?.getDataOrThrow());this._tree=ke(this,u=>{let p=c.read(u);if(!p)return;let h=this._languageIdObs.read(u),g=this._treeSitterLibraryService.getLanguage(h,!1,u);if(!g)return;let f=new p;if(u.store.add(ee(()=>{f.delete()})),f.setLanguage(g),this._treeSitterLibraryService.getInjectionQueries(h,u)!==void 0)return u.store.add(this._instantiationService.createInstance(tke,h,void 0,f,p,this._textModel))}),this._tokenizationImpl=ke(this,u=>{let p=this._tree.read(u);if(!p)return;let h=this._treeSitterLibraryService.getHighlightingQueries(p.languageId,u);if(h)return u.store.add(this._instantiationService.createInstance(nke,p,h,this._languageIdCodec,n))}),this._register(ve(u=>{let p=this._tokenizationImpl.read(u);p&&(u.store.add(p.onDidChangeTokens(h=>{this._onDidChangeTokens.fire(h.changes)})),u.store.add(p.onDidChangeBackgroundTokenization(h=>{this._backgroundTokenizationState=2,this._onDidChangeBackgroundTokenizationState.fire()})))}))}get tree(){return this._tree}get tokenizationImpl(){return this._tokenizationImpl}getLineTokens(e){let t=this._tokenizationImpl.get();if(!t){let o=this._textModel.getLineContent(e);return Cd.createEmpty(o,this._languageIdCodec)}return t.getLineTokens(e)}todo_resetTokenization(e=!0){e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}handleDidChangeAttached(){}handleDidChangeContent(e){e.isFlush?this.todo_resetTokenization(!1):this._tokenizationImpl.get()?.handleContentChanged(e),this._tree.get()?.handleContentChange(e)}forceTokenization(e){let t=this._tokenizationImpl.get();t&&(t.hasAccurateTokensForLine(e)||t.tokenizeEncoded(e))}hasAccurateTokensForLine(e){let t=this._tokenizationImpl.get();return t?t.hasAccurateTokensForLine(e):!1}isCheapToTokenize(e){return!0}getTokenTypeIfInsertingCharacter(e,t,o){return 0}tokenizeLinesAt(e,t){let o=this._tokenizationImpl.get();return o?o.tokenizeLinesAt(e,t):null}get hasTokens(){let e=this._tokenizationImpl.get();return e?e.hasTokens():!1}};wK=I([m(4,NX),m(5,F)],wK);var $Ct=class a{constructor(i){this._pieces=[],this._isComplete=!1,this._languageIdCodec=i}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(i,e,t=void 0){if(this._pieces=i||[],this._isComplete=e,t)for(let o of this._pieces)o.reportIfInvalid(t)}setPartial(i,e){let t=i;if(e.length>0){let n=e[0].getRange(),r=e[e.length-1].getRange();if(!n||!r)return i;t=i.plusRange(n).plusRange(r)}let o=null;for(let n=0,r=this._pieces.length;n<r;n++){let s=this._pieces[n];if(s.endLineNumber<t.startLineNumber)continue;if(s.startLineNumber>t.endLineNumber){o=o||{index:n};break}if(s.removeTokens(t),s.isEmpty()){this._pieces.splice(n,1),n--,r--;continue}if(s.endLineNumber<t.startLineNumber)continue;if(s.startLineNumber>t.endLineNumber){o=o||{index:n};continue}let[l,c]=s.split(t);if(l.isEmpty()){o=o||{index:n};continue}c.isEmpty()||(this._pieces.splice(n,1,l,c),n++,r++,o=o||{index:n})}return o=o||{index:this._pieces.length},e.length>0&&(this._pieces=dz(this._pieces,o.index,e)),t}isComplete(){return this._isComplete}addSparseTokens(i,e){if(e.getTextLength()===0)return e;let t=this._pieces;if(t.length===0)return e;let o=a._findFirstPieceWithLine(t,i),n=t[o].getLineTokens(i);if(!n)return e;let r=e.getCount(),s=n.getCount(),l=0,c=[],u=0,p=0,h=(g,f)=>{g!==p&&(p=g,c[u++]=g,c[u++]=f)};for(let g=0;g<s;g++){let f=Math.min(n.getStartCharacter(g),e.getTextLength()),v=Math.min(n.getEndCharacter(g),e.getTextLength()),b=n.getMetadata(g),S=((b&1?2048:0)|(b&2?4096:0)|(b&4?8192:0)|(b&8?16384:0)|(b&16?16744448:0)|(b&32?4278190080:0))>>>0,y=~S>>>0;for(;l<r&&e.getEndOffset(l)<=f;)h(e.getEndOffset(l),e.getMetadata(l)),l++;for(l<r&&e.getStartOffset(l)<f&&h(f,e.getMetadata(l));l<r&&e.getEndOffset(l)<v;)h(e.getEndOffset(l),e.getMetadata(l)&y|b&S),l++;if(l<r)h(v,e.getMetadata(l)&y|b&S),e.getEndOffset(l)===v&&l++;else{let w=Math.min(Math.max(0,l-1),r-1);h(v,e.getMetadata(w)&y|b&S)}}for(;l<r;)h(e.getEndOffset(l),e.getMetadata(l)),l++;return new Cd(new Uint32Array(c),e.getLineContent(),this._languageIdCodec)}static _findFirstPieceWithLine(i,e){let t=0,o=i.length-1;for(;t<o;){let n=t+Math.floor((o-t)/2);if(i[n].endLineNumber<e)t=n+1;else if(i[n].startLineNumber>e)o=n-1;else{for(;n>t&&i[n-1].startLineNumber<=e&&e<=i[n-1].endLineNumber;)n--;return n}}return t}acceptEdit(i,e,t,o,n){for(let r=0;r<this._pieces.length;r++){let s=this._pieces[r];s.acceptEdit(i,e,t,o,n),s.isEmpty()&&(this._pieces.splice(r,1),r--)}}};var D8e=class a{constructor(i){this._lineTokens=[],this._len=0,this._languageIdCodec=i}flush(){this._lineTokens=[],this._len=0}get hasTokens(){return this._lineTokens.length>0}getTokens(i,e,t){let o=null;if(e<this._len&&(o=this._lineTokens[e]),o!==null&&o!==SK)return new Cd(IK(o),t,this._languageIdCodec);let n=new Uint32Array(2);return n[0]=t.length,n[1]=lJi(this._languageIdCodec.encodeLanguageId(i)),new Cd(n,t,this._languageIdCodec)}static _massageTokens(i,e,t){let o=t?IK(t):null;if(e===0){let n=!1;if(o&&o.length>1&&(n=Vp.getLanguageId(o[1])!==i),!n)return SK}if(!o||o.length===0){let n=new Uint32Array(2);return n[0]=e,n[1]=lJi(i),n.buffer}return o[o.length-2]=e,o.byteOffset===0&&o.byteLength===o.buffer.byteLength?o.buffer:o}_ensureLine(i){for(;i>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(i,e){e!==0&&(i+e>this._len&&(e=this._len-i),this._lineTokens.splice(i,e),this._len-=e)}_insertLines(i,e){if(e===0)return;let t=[];for(let o=0;o<e;o++)t[o]=null;this._lineTokens=dz(this._lineTokens,i,t),this._len+=e}setTokens(i,e,t,o,n){let r=a._massageTokens(this._languageIdCodec.encodeLanguageId(i),t,o);this._ensureLine(e);let s=this._lineTokens[e];return this._lineTokens[e]=r,n?!a._equals(s,r):!1}static _equals(i,e){if(!i||!e)return!i&&!e;let t=IK(i),o=IK(e);if(t.length!==o.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==o[n])return!1;return!0}acceptEdit(i,e,t){this._acceptDeleteRange(i),this._acceptInsertText(new ye(i.startLineNumber,i.startColumn),e,t)}_acceptDeleteRange(i){let e=i.startLineNumber-1;if(e>=this._len)return;if(i.startLineNumber===i.endLineNumber){if(i.startColumn===i.endColumn)return;this._lineTokens[e]=zy.delete(this._lineTokens[e],i.startColumn-1,i.endColumn-1);return}this._lineTokens[e]=zy.deleteEnding(this._lineTokens[e],i.startColumn-1);let t=i.endLineNumber-1,o=null;t<this._len&&(o=zy.deleteBeginning(this._lineTokens[t],i.endColumn-1)),this._lineTokens[e]=zy.append(this._lineTokens[e],o),this._deleteLines(i.startLineNumber,i.endLineNumber-i.startLineNumber)}_acceptInsertText(i,e,t){if(e===0&&t===0)return;let o=i.lineNumber-1;if(!(o>=this._len)){if(e===0){this._lineTokens[o]=zy.insert(this._lineTokens[o],i.column-1,t);return}this._lineTokens[o]=zy.deleteEnding(this._lineTokens[o],i.column-1),this._lineTokens[o]=zy.insert(this._lineTokens[o],i.column-1,t),this._insertLines(i.lineNumber,e)}}setMultilineTokens(i,e){if(i.length===0)return{changes:[]};let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o],s=0,l=0,c=!1;for(let u=r.startLineNumber;u<=r.endLineNumber;u++)c?(this.setTokens(e.getLanguageId(),u-1,e.getLineLength(u),r.getLineTokens(u),!1),l=u):this.setTokens(e.getLanguageId(),u-1,e.getLineLength(u),r.getLineTokens(u),!0)&&(c=!0,s=u,l=u);c&&t.push({fromLineNumber:s,toLineNumber:l})}return{changes:t}}};function lJi(a){return(a<<0|0|0|32768|2<<24|1024)>>>0}var jCt=class extends Zxe{constructor(e,t,o,n){super(e,t);this.getLanguageId=o;this._tokenizer=null;this._backgroundTokenizationState=1;this._onDidChangeBackgroundTokenizationState=this._register(new T);this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event;this._defaultBackgroundTokenizer=null;this._backgroundTokenizer=this._register(new ue);this._tokens=new D8e(this._languageIdCodec);this._debugBackgroundTokenizer=this._register(new ue);this._attachedViewStates=this._register(new Ot);this._register(vc.onDidChange(r=>{let s=this.getLanguageId();r.changedLanguages.indexOf(s)!==-1&&this.todo_resetTokenization()})),this.todo_resetTokenization(),this._register(n.onDidChangeVisibleRanges(({view:r,state:s})=>{if(s){let l=this._attachedViewStates.get(r);l||(l=new BCt(()=>this.refreshRanges(l.lineRanges)),this._attachedViewStates.set(r,l)),l.handleStateChange(s)}else this._attachedViewStates.deleteAndDispose(r)}))}todo_resetTokenization(e=!0){this._tokens.flush(),this._debugBackgroundTokens?.flush(),this._debugBackgroundStates&&(this._debugBackgroundStates=new oke(this._textModel.getLineCount())),e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]});let t=()=>{if(this._textModel.isTooLargeForTokenization())return[null,null];let r=vc.get(this.getLanguageId());if(!r)return[null,null];let s;try{s=r.getInitialState()}catch(l){return mt(l),[null,null]}return[r,s]},[o,n]=t();if(o&&n?this._tokenizer=new zCt(this._textModel.getLineCount(),o,this._textModel,this._languageIdCodec):this._tokenizer=null,this._backgroundTokenizer.clear(),this._defaultBackgroundTokenizer=null,this._tokenizer){let r={setTokens:s=>{this.setTokens(s)},setFontInfo:s=>{this.setFontInfo(s)},backgroundTokenizationFinished:()=>{if(this._backgroundTokenizationState===2)return;let s=2;this._backgroundTokenizationState=s,this._onDidChangeBackgroundTokenizationState.fire()},setEndState:(s,l)=>{if(!this._tokenizer)return;let c=this._tokenizer.store.getFirstInvalidEndStateLineNumber();c!==null&&s>=c&&this._tokenizer?.store.setEndState(s,l)}};o&&o.createBackgroundTokenizer&&!o.backgroundTokenizerShouldOnlyVerifyTokens&&(this._backgroundTokenizer.value=o.createBackgroundTokenizer(this._textModel,r)),!this._backgroundTokenizer.value&&!this._textModel.isTooLargeForTokenization()&&(this._backgroundTokenizer.value=this._defaultBackgroundTokenizer=new KCt(this._tokenizer,r),this._defaultBackgroundTokenizer.handleChanges()),o?.backgroundTokenizerShouldOnlyVerifyTokens&&o.createBackgroundTokenizer?(this._debugBackgroundTokens=new D8e(this._languageIdCodec),this._debugBackgroundStates=new oke(this._textModel.getLineCount()),this._debugBackgroundTokenizer.clear(),this._debugBackgroundTokenizer.value=o.createBackgroundTokenizer(this._textModel,{setTokens:s=>{this._debugBackgroundTokens?.setMultilineTokens(s,this._textModel)},setFontInfo:s=>{this.setFontInfo(s)},backgroundTokenizationFinished(){},setEndState:(s,l)=>{this._debugBackgroundStates?.setEndState(s,l)}})):(this._debugBackgroundTokens=void 0,this._debugBackgroundStates=void 0,this._debugBackgroundTokenizer.value=void 0)}this.refreshAllVisibleLineTokens()}handleDidChangeAttached(){this._defaultBackgroundTokenizer?.handleChanges()}handleDidChangeContent(e){if(e.isFlush)this.todo_resetTokenization(!1);else if(!e.isEolChange){for(let t of e.changes){let[o,n]=NI(t.text);this._tokens.acceptEdit(t.range,o,n),this._debugBackgroundTokens?.acceptEdit(t.range,o,n)}this._debugBackgroundStates?.acceptChanges(e.changes),this._tokenizer&&this._tokenizer.store.acceptChanges(e.changes),this._defaultBackgroundTokenizer?.handleChanges()}}setTokens(e){let{changes:t}=this._tokens.setMultilineTokens(e,this._textModel);return t.length>0&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:t}),{changes:t}}setFontInfo(e){this._onDidChangeFontTokens.fire({changes:e})}refreshAllVisibleLineTokens(){let e=vo.joinMany([...this._attachedViewStates].map(([t,o])=>o.lineRanges));this.refreshRanges(e)}refreshRanges(e){for(let t of e)this.refreshRange(t.startLineNumber,t.endLineNumberExclusive-1)}refreshRange(e,t){if(!this._tokenizer)return;e=Math.max(1,Math.min(this._textModel.getLineCount(),e)),t=Math.min(this._textModel.getLineCount(),t);let o=new yK,{heuristicTokens:n}=this._tokenizer.tokenizeHeuristically(o,e,t),r=this.setTokens(o.finalize());if(n)for(let s of r.changes)this._backgroundTokenizer.value?.requestTokens(s.fromLineNumber,s.toLineNumber+1);this._defaultBackgroundTokenizer?.checkFinished()}forceTokenization(e){let t=new yK;this._tokenizer?.updateTokensUntilLine(t,e),this.setTokens(t.finalize()),this._defaultBackgroundTokenizer?.checkFinished()}hasAccurateTokensForLine(e){return this._tokenizer?this._tokenizer.hasAccurateTokensForLine(e):!0}isCheapToTokenize(e){return this._tokenizer?this._tokenizer.isCheapToTokenize(e):!0}getLineTokens(e){let t=this._textModel.getLineContent(e),o=this._tokens.getTokens(this._textModel.getLanguageId(),e-1,t);if(this._debugBackgroundTokens&&this._debugBackgroundStates&&this._tokenizer&&this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax()>e&&this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax()>e){let n=this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(),e-1,t);!o.equals(n)&&this._debugBackgroundTokenizer.value?.reportMismatchingTokens&&this._debugBackgroundTokenizer.value.reportMismatchingTokens(e)}return o}getTokenTypeIfInsertingCharacter(e,t,o){if(!this._tokenizer)return 0;let n=this._textModel.validatePosition(new ye(e,t));return this.forceTokenization(n.lineNumber),this._tokenizer.getTokenTypeIfInsertingCharacter(n,o)}tokenizeLinesAt(e,t){return this._tokenizer?(this.forceTokenization(e),this._tokenizer.tokenizeLinesAt(e,t)):null}get hasTokens(){return this._tokens.hasTokens}};var e4=class extends Ixe{constructor(e,t,o,n,r,s,l,c){super();this._textModel=e;this._bracketPairsTextModelPart=t;this._languageId=o;this._attachedViews=n;this._languageService=r;this._languageConfigurationService=s;this._instantiationService=l;this._treeSitterLibraryService=c;this._onDidChangeFontTokens=this._register(new T);this.onDidChangeFontTokens=this._onDidChangeFontTokens.event;this._languageIdObs=De(this,this._languageId),this._useTreeSitter=ke(this,p=>{let h=this._languageIdObs.read(p);return this._treeSitterLibraryService.supportsLanguage(h,p)}),this.tokens=ke(this,p=>{let h;return this._useTreeSitter.read(p)?h=p.store.add(this._instantiationService.createInstance(wK,this._languageIdObs,this._languageService.languageIdCodec,this._textModel,this._attachedViews.visibleLineRanges)):h=p.store.add(new jCt(this._languageService.languageIdCodec,this._textModel,()=>this._languageId,this._attachedViews)),p.store.add(h.onDidChangeTokens(g=>{this._emitModelTokensChangedEvent(g)})),p.store.add(h.onDidChangeFontTokens(g=>{this._textModel._isDisposing()||this._onDidChangeFontTokens.fire(g)})),p.store.add(h.onDidChangeBackgroundTokenizationState(g=>{this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState()})),h});let u=!1;this.tokens.recomputeInitiallyAndOnChange(this._store,p=>{u&&p.todo_resetTokenization(),u=!0}),this._semanticTokens=new $Ct(this._languageService.languageIdCodec),this._onDidChangeLanguage=this._register(new T),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new T),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new T),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidChangeFontTokens=this._register(new T),this.onDidChangeFontTokens=this._onDidChangeFontTokens.event}_hasListeners(){return this._onDidChangeLanguage.hasListeners()||this._onDidChangeLanguageConfiguration.hasListeners()||this._onDidChangeTokens.hasListeners()}handleLanguageConfigurationServiceChange(e){e.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})}handleDidChangeContent(e){if(e.isFlush)this._semanticTokens.flush();else if(!e.isEolChange)for(let t of e.changes){let[o,n,r]=NI(t.text);this._semanticTokens.acceptEdit(t.range,o,n,r,t.text.length>0?t.text.charCodeAt(0):0)}this.tokens.get().handleDidChangeContent(e)}handleDidChangeAttached(){this.tokens.get().handleDidChangeAttached()}getLineTokens(e){this.validateLineNumber(e);let t=this.tokens.get().getLineTokens(e);return this._semanticTokens.addSparseTokens(e,t)}_emitModelTokensChangedEvent(e){this._textModel._isDisposing()||(this._bracketPairsTextModelPart.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}validateLineNumber(e){if(e<1||e>this._textModel.getLineCount())throw new ci("Illegal value for lineNumber")}get hasTokens(){return this.tokens.get().hasTokens}resetTokenization(){this.tokens.get().todo_resetTokenization()}get backgroundTokenizationState(){return this.tokens.get().backgroundTokenizationState}forceTokenization(e){this.validateLineNumber(e),this.tokens.get().forceTokenization(e)}hasAccurateTokensForLine(e){return this.validateLineNumber(e),this.tokens.get().hasAccurateTokensForLine(e)}isCheapToTokenize(e){return this.validateLineNumber(e),this.tokens.get().isCheapToTokenize(e)}tokenizeIfCheap(e){this.validateLineNumber(e),this.tokens.get().tokenizeIfCheap(e)}getTokenTypeIfInsertingCharacter(e,t,o){return this.tokens.get().getTokenTypeIfInsertingCharacter(e,t,o)}tokenizeLinesAt(e,t){return this.tokens.get().tokenizeLinesAt(e,t)}setSemanticTokens(e,t){this._semanticTokens.set(e,t,this._textModel),this._emitModelTokensChangedEvent({semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;let o=this._textModel.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({semanticTokensApplied:!0,ranges:[{fromLineNumber:o.startLineNumber,toLineNumber:o.endLineNumber}]})}getWordAtPosition(e){this.assertNotDisposed();let t=this._textModel.validatePosition(e),o=this._textModel.getLineContent(t.lineNumber),n=this.getLineTokens(t.lineNumber),r=n.findTokenIndexAtOffset(t.column-1),[s,l]=e4._findLanguageBoundaries(n,r),c=Rk(t.column,this.getLanguageConfiguration(n.getLanguageId(r)).getWordDefinition(),o.substring(s,l),s);if(c&&c.startColumn<=e.column&&e.column<=c.endColumn)return c;if(r>0&&s===t.column-1){let[u,p]=e4._findLanguageBoundaries(n,r-1),h=Rk(t.column,this.getLanguageConfiguration(n.getLanguageId(r-1)).getWordDefinition(),o.substring(u,p),u);if(h&&h.startColumn<=e.column&&e.column<=h.endColumn)return h}return null}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}static _findLanguageBoundaries(e,t){let o=e.getLanguageId(t),n=0;for(let s=t;s>=0&&e.getLanguageId(s)===o;s--)n=e.getStartOffset(s);let r=e.getLineContent().length;for(let s=t,l=e.getCount();s<l&&e.getLanguageId(s)===o;s++)r=e.getEndOffset(s);return[n,r]}getWordUntilPosition(e){let t=this.getWordAtPosition(e);return t?{word:t.word.substr(0,e.column-t.startColumn),startColumn:t.startColumn,endColumn:e.column}:{word:"",startColumn:e.column,endColumn:e.column}}getLanguageId(){return this._languageId}getLanguageIdAtPosition(e,t){let o=this._textModel.validatePosition(new ye(e,t)),n=this.getLineTokens(o.lineNumber);return n.getLanguageId(n.findTokenIndexAtOffset(o.column-1))}setLanguageId(e,t="api"){if(this._languageId===e)return;let o={oldLanguage:this._languageId,newLanguage:e,source:t};this._languageId=e,this._languageIdObs.set(e,void 0),this._bracketPairsTextModelPart.handleDidChangeLanguage(o),this._onDidChangeLanguage.fire(o),this._onDidChangeLanguageConfiguration.fire({})}};e4=I([m(4,Rt),m(5,Us),m(6,F),m(7,NX)],e4);function t4(a){let i=new Y5;return i.acceptChunk(a),i.finish()}function OX(a){return new Promise((i,e)=>{let t=new Y5,o=!1;_L(a,{onData:n=>{t.acceptChunk(typeof n=="string"?n:n.toString())},onError:n=>{o||(o=!0,e(n))},onEnd:()=>{o||(o=!0,i(t.finish()))}})})}function Uk(a){let i=new Y5,e;for(;typeof(e=a.read())=="string";)i.acceptChunk(e);return i.finish()}function xK(a,i){let e;return typeof a=="string"?e=t4(a):n6i(a)?e=Uk(a):e=a,e.create(i)}var QCt=0,Hqo=999,Uqo=1e4,zqo=300,Mli=class{constructor(i){this._source=i,this._eos=!1}read(){if(this._eos)return null;let i=[],e=0,t=0;do{let o=this._source.read();if(o===null)return this._eos=!0,e===0?null:i.join("");if(o.length>0&&(i[e++]=o,t+=o.length),t>=64*1024)return i.join("")}while(!0)}},R8e=()=>{throw new Error("Invalid change accessor")};var Tp=class extends k{constructor(e,t,o,n=null,r,s,l,c){super();this._undoRedoService=r;this._languageService=s;this._languageConfigurationService=l;this.instantiationService=c;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this._onDidChangeDecorations=this._register(new Oli((e,t,o)=>this.handleBeforeFireDecorationsChangedEvent(e,t,o)));this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._onDidChangeOptions=this._register(new T);this._onDidChangeAttached=this._register(new T);this._onDidChangeLineHeight=this._register(new T);this._onDidChangeFont=this._register(new T);this._eventEmitter=this._register(new Fli);this._languageSelectionListener=this._register(new ue);this._deltaDecorationCallCnt=0;this._attachedViews=this._register(new VCt);this._viewModels=new Set;QCt++,this.id="$model"+QCt,this.isForSimpleWidget=o.isForSimpleWidget,typeof n>"u"||n===null?this._associatedResource=A.parse("inmemory://model/"+QCt):this._associatedResource=n,this._attachedEditorCount=0;let{textBuffer:u,disposable:p}=xK(e,o.defaultEOL);this._buffer=u,this._bufferDisposable=p;let h=this._buffer.getLineCount(),g=this._buffer.getValueLengthInRange(new G(1,1,h,this._buffer.getLineLength(h)+1),0);o.largeFileOptimizations?(this._isTooLargeForTokenization=g>Tp.LARGE_FILE_SIZE_THRESHOLD||h>Tp.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=g>Tp.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._options=Tp.resolveOptions(this._buffer,o);let f=typeof t=="string"?t:t.languageId;typeof t!="string"&&(this._languageSelectionListener.value=t.onDidChange(()=>this._setLanguage(t.languageId))),this._bracketPairs=this._register(new MCt(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new Cwt(this,this._languageConfigurationService)),this._decorationProvider=this._register(new PCt(this)),this._tokenizationTextModelPart=this.instantiationService.createInstance(e4,this,this._bracketPairs,f,this._attachedViews),this._fontTokenDecorationsProvider=this._register(new HCt(this,this._tokenizationTextModelPart)),this._isTooLargeForSyncing=g>Tp._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=pwe(QCt),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new XCt,this._commandManager=new OCt(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._register(this._decorationProvider.onDidChange(()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})),this._register(this._fontTokenDecorationsProvider.onDidChangeLineHeight(v=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._fireOnDidChangeLineHeight(v),this._onDidChangeDecorations.endDeferredEmit()})),this._register(this._fontTokenDecorationsProvider.onDidChangeFont(v=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._fireOnDidChangeFont(v),this._onDidChangeDecorations.endDeferredEmit()})),this._languageService.requestRichLanguageFeatures(f),this._register(this._languageConfigurationService.onDidChange(v=>{this._bracketPairs.handleLanguageConfigurationServiceChange(v),this._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(v)}))}static{this._MODEL_SYNC_LIMIT=50*1024*1024}static{this.LARGE_FILE_SIZE_THRESHOLD=20*1024*1024}static{this.LARGE_FILE_LINE_COUNT_THRESHOLD=300*1e3}static{this.LARGE_FILE_HEAP_OPERATION_THRESHOLD=256*1024*1024}static{this.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:Uv.tabSize,indentSize:Uv.indentSize,insertSpaces:Uv.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:Uv.trimAutoWhitespace,largeFileOptimizations:Uv.largeFileOptimizations,bracketPairColorizationOptions:Uv.bracketPairColorizationOptions}}static resolveOptions(e,t){if(t.detectIndentation){let o=uli(e,t.tabSize,t.insertSpaces);return new jwe({tabSize:o.tabSize,indentSize:"tabSize",insertSpaces:o.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new jwe(t)}get onDidChangeLanguage(){return this._tokenizationTextModelPart.onDidChangeLanguage}get onDidChangeLanguageConfiguration(){return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration}get onDidChangeTokens(){return this._tokenizationTextModelPart.onDidChangeTokens}get onDidChangeOptions(){return this._onDidChangeOptions.event}get onDidChangeAttached(){return this._onDidChangeAttached.event}get onDidChangeLineHeight(){return this._onDidChangeLineHeight.event}get onDidChangeFont(){return this._onDidChangeFont.event}onDidChangeContent(e){return this._eventEmitter.event(t=>e(t.contentChangedEvent))}_isDisposing(){return this.__isDisposing}get tokenization(){return this._tokenizationTextModelPart}get bracketPairs(){return this._bracketPairs}get guides(){return this._guidesTextModelPart}dispose(){this.__isDisposing=!0,this._onWillDispose.fire(),this._tokenizationTextModelPart.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this.__isDisposing=!1;let e=new PX([],"",`
`,!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=k.None}_hasListeners(){return this._onWillDispose.hasListeners()||this._onDidChangeDecorations.hasListeners()||this._tokenizationTextModelPart._hasListeners()||this._onDidChangeOptions.hasListeners()||this._onDidChangeAttached.hasListeners()||this._onDidChangeLineHeight.hasListeners()||this._onDidChangeFont.hasListeners()||this._eventEmitter.hasListeners()}_assertNotDisposed(){if(this._isDisposed)throw new ci("Model is disposed!")}registerViewModel(e){this._viewModels.add(e)}unregisterViewModel(e){this._viewModels.delete(e)}equalsTextBuffer(e){return this._assertNotDisposed(),this._buffer.equals(e)}getTextBuffer(){return this._assertNotDisposed(),this._buffer}_emitContentChangedEvent(e,t,o=null){if(this.__isDisposing)return;this._tokenizationTextModelPart.handleDidChangeContent(t),this._bracketPairs.handleDidChangeContent(t),this._fontTokenDecorationsProvider.handleDidChangeContent(t);let n=new EX(e,t);o&&(n.rawContentChangedEvent.resultingSelection=o),this._onDidChangeContentOrInjectedText(n),this._eventEmitter.fire(n)}setValue(e,t=sd.setValue()){if(this._assertNotDisposed(),e==null)throw ls();let{textBuffer:o,disposable:n}=xK(e,this._options.defaultEOL);this._setValueFromTextBuffer(o,n,t)}_createContentChanged2(e,t,o,n,r,s,l,c,u,p){return{changes:[{range:e,rangeOffset:t,rangeLength:o,text:r}],eol:this._buffer.getEOL(),isEolChange:u,versionId:this.getVersionId(),isUndoing:s,isRedoing:l,isFlush:c,detailedReasons:[p],detailedReasonsChangeLengths:[1]}}_setValueFromTextBuffer(e,t,o){this._assertNotDisposed();let n=this.getFullModelRange(),r=this.getValueLengthInRange(n),s=this.getLineCount(),l=this.getLineMaxColumn(s);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._decorations=Object.create(null),this._decorationsTree=new XCt,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new ude([new mCt],this._versionId,!1,!1),this._createContentChanged2(new G(1,1,s,l),0,r,new ye(s,l),this.getValue(),!1,!1,!0,!1,o))}setEOL(e){this._assertNotDisposed();let t=e===1?`\r
`:`
`;if(this._buffer.getEOL()===t)return;let o=this.getFullModelRange(),n=this.getValueLengthInRange(o),r=this.getLineCount(),s=this.getLineMaxColumn(r);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new ude([new bCt],this._versionId,!1,!1),this._createContentChanged2(new G(1,1,r,s),0,n,new ye(r,s),this.getValue(),!1,!1,!1,!0,sd.eolChange()))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){let e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let o=0,n=t.length;o<n;o++){let r=t[o],s=r.range,l=r.cachedAbsoluteStart-r.start,c=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),u=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);r.cachedAbsoluteStart=c,r.cachedAbsoluteEnd=u,r.cachedVersionId=e,r.start=c-l,r.end=u-l,G5(r)}}onBeforeAttached(){return this._attachedEditorCount++,this._attachedEditorCount===1&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.attachView()}onBeforeDetached(e){this._attachedEditorCount--,this._attachedEditorCount===0&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.detachView(e)}isAttachedToEditor(){return this._attachedEditorCount>0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isTooLargeForHeapOperation(){return this._isTooLargeForHeapOperation}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0,o=this._buffer.getLineCount();for(let n=1;n<=o;n++){let r=this._buffer.getLineLength(n);r>=Uqo?t+=r:e+=r}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();let t=typeof e.tabSize<"u"?e.tabSize:this._options.tabSize,o=typeof e.indentSize<"u"?e.indentSize:this._options.originalIndentSize,n=typeof e.insertSpaces<"u"?e.insertSpaces:this._options.insertSpaces,r=typeof e.trimAutoWhitespace<"u"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,s=typeof e.bracketColorizationOptions<"u"?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,l=new jwe({tabSize:t,indentSize:o,insertSpaces:n,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:r,bracketPairColorizationOptions:s});if(this._options.equals(l))return;let c=this._options.createChangeEvent(l);this._options=l,this._bracketPairs.handleDidChangeOptions(c),this._decorationProvider.handleDidChangeOptions(c),this._onDidChangeOptions.fire(c)}detectIndentation(e,t){this._assertNotDisposed();let o=uli(this._buffer,t,e);this.updateOptions({insertSpaces:o.insertSpaces,tabSize:o.tabSize,indentSize:o.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),qwe(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){let t=this.findMatches(kii.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map(o=>({range:o.range,text:null})),()=>null)}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();let t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();let t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new ci("Operation would exceed heap memory limits");let o=this.getFullModelRange(),n=this.getValueInRange(o,e);return t?this._buffer.getBOM()+n:n}createSnapshot(e=!1){return new Mli(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();let o=this.getFullModelRange(),n=this.getValueLengthInRange(o,e);return t?this._buffer.getBOM().length+n:n}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ci("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ci("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new ci("Operation would exceed heap memory limits");return this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),this._buffer.getEOL()===`
`?0:1}getLineMinColumn(e){return this._assertNotDisposed(),1}getLineMaxColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ci("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ci("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new ci("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){let t=this._buffer.getLineCount(),o=e.startLineNumber,n=e.startColumn,r=Math.floor(typeof o=="number"&&!isNaN(o)?o:1),s=Math.floor(typeof n=="number"&&!isNaN(n)?n:1);if(r<1)r=1,s=1;else if(r>t)r=t,s=this.getLineMaxColumn(r);else if(s<=1)s=1;else{let h=this.getLineMaxColumn(r);s>=h&&(s=h)}let l=e.endLineNumber,c=e.endColumn,u=Math.floor(typeof l=="number"&&!isNaN(l)?l:1),p=Math.floor(typeof c=="number"&&!isNaN(c)?c:1);if(u<1)u=1,p=1;else if(u>t)u=t,p=this.getLineMaxColumn(u);else if(p<=1)p=1;else{let h=this.getLineMaxColumn(u);p>=h&&(p=h)}return o===r&&n===s&&l===u&&c===p&&e instanceof G&&!(e instanceof ei)?e:new G(r,s,u,p)}_isValidPosition(e,t,o){if(typeof e!="number"||typeof t!="number"||isNaN(e)||isNaN(t)||e<1||t<1||(e|0)!==e||(t|0)!==t)return!1;let n=this._buffer.getLineCount();if(e>n)return!1;if(t===1)return!0;let r=this.getLineMaxColumn(e);if(t>r)return!1;if(o===1){let s=this._buffer.getLineCharCode(e,t-2);if(Ip(s))return!1}return!0}_validatePosition(e,t,o){let n=Math.floor(typeof e=="number"&&!isNaN(e)?e:1),r=Math.floor(typeof t=="number"&&!isNaN(t)?t:1),s=this._buffer.getLineCount();if(n<1)return new ye(1,1);if(n>s)return new ye(s,this.getLineMaxColumn(s));if(r<=1)return new ye(n,1);let l=this.getLineMaxColumn(n);if(r>=l)return new ye(n,l);if(o===1){let c=this._buffer.getLineCharCode(n,r-2);if(Ip(c))return new ye(n,r-1)}return new ye(n,r)}validatePosition(e){let t=1;return this._assertNotDisposed(),e instanceof ye&&this._isValidPosition(e.lineNumber,e.column,t)?e:this._validatePosition(e.lineNumber,e.column,t)}isValidRange(e){return this._isValidRange(e,1)}_isValidRange(e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn;if(!this._isValidPosition(o,n,0)||!this._isValidPosition(r,s,0))return!1;if(t===1){let l=n>1?this._buffer.getLineCharCode(o,n-2):0,c=s>1&&s<=this._buffer.getLineLength(r)?this._buffer.getLineCharCode(r,s-2):0,u=Ip(l),p=Ip(c);return!u&&!p}return!0}validateRange(e){let t=1;if(this._assertNotDisposed(),e instanceof G&&!(e instanceof ei)&&this._isValidRange(e,t))return e;let o=this._validatePosition(e.startLineNumber,e.startColumn,0),n=this._validatePosition(e.endLineNumber,e.endColumn,0),r=o.lineNumber,s=o.column,l=n.lineNumber,c=n.column;if(t===1){let u=s>1?this._buffer.getLineCharCode(r,s-2):0,p=c>1&&c<=this._buffer.getLineLength(l)?this._buffer.getLineCharCode(l,c-2):0,h=Ip(u),g=Ip(p);return!h&&!g?new G(r,s,l,c):r===l&&s===c?new G(r,s-1,l,c-1):h&&g?new G(r,s-1,l,c+1):h?new G(r,s-1,l,c):new G(r,s,l,c+1)}return new G(r,s,l,c)}modifyPosition(e,t){this._assertNotDisposed();let o=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,o)))}getFullModelRange(){this._assertNotDisposed();let e=this.getLineCount();return new G(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,o,n){return this._buffer.findMatchesLineByLine(e,t,o,n)}findMatches(e,t,o,n,r,s,l=Hqo){this._assertNotDisposed();let c=null;t!==null&&typeof t!="boolean"&&(Array.isArray(t)||(t=[t]),t.every(h=>G.isIRange(h))&&(c=t.map(h=>this.validateRange(h)))),c===null&&(c=[this.getFullModelRange()]),c=c.sort((h,g)=>h.startLineNumber-g.startLineNumber||h.startColumn-g.startColumn);let u=[];u.push(c.reduce((h,g)=>G.areIntersecting(h,g)?h.plusRange(g):(u.push(h),g)));let p;if(!o&&e.indexOf(`
`)<0){let g=new Uw(e,o,n,r).parseSearchRequest();if(!g)return[];p=f=>this.findMatchesLineByLine(f,g,s,l)}else p=h=>Rce.findMatches(this,new Uw(e,o,n,r),h,s,l);return u.map(p).reduce((h,g)=>h.concat(g),[])}findNextMatch(e,t,o,n,r,s){this._assertNotDisposed();let l=this.validatePosition(t);if(!o&&e.indexOf(`
`)<0){let u=new Uw(e,o,n,r).parseSearchRequest();if(!u)return null;let p=this.getLineCount(),h=new G(l.lineNumber,l.column,p,this.getLineMaxColumn(p)),g=this.findMatchesLineByLine(h,u,s,1);return Rce.findNextMatch(this,new Uw(e,o,n,r),l,s),g.length>0||(h=new G(1,1,l.lineNumber,this.getLineMaxColumn(l.lineNumber)),g=this.findMatchesLineByLine(h,u,s,1),g.length>0)?g[0]:null}return Rce.findNextMatch(this,new Uw(e,o,n,r),l,s)}findPreviousMatch(e,t,o,n,r,s){this._assertNotDisposed();let l=this.validatePosition(t);return Rce.findPreviousMatch(this,new Uw(e,o,n,r),l,s)}pushStackElement(){this._commandManager.pushStackElement()}popStackElement(){this._commandManager.popStackElement()}pushEOL(e){if((this.getEOL()===`
`?0:1)!==e)try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEOL(e)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_validateEditOperation(e){if(e instanceof WY)return e;let t=this.validateRange(e.range),o=e.text;if(o){let n=o.length>0&&o.charCodeAt(o.length-1)===13;this.getEOL()===`\r
`&&n&&t.endColumn===this.getLineMaxColumn(t.endLineNumber)&&(o=o.substring(0,o.length-1))}return new WY(e.identifier||null,t,o,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){let t=[];for(let o=0,n=e.length;o<n;o++)t[o]=this._validateEditOperation(e[o]);return t}edit(e,t){this.pushEditOperations(null,e.replacements.map(o=>({range:o.range,text:o.text})),null)}pushEditOperations(e,t,o,n,r){try{return this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._pushEditOperations(e,this._validateEditOperations(t),o,n,r)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_pushEditOperations(e,t,o,n,r){if(this._options.trimAutoWhitespace&&this._trimAutoWhitespaceLines){let s=t.map(c=>({range:this.validateRange(c.range),text:c.text})),l=!0;if(e)for(let c=0,u=e.length;c<u;c++){let p=e[c],h=!1;for(let g=0,f=s.length;g<f;g++){let v=s[g].range,b=v.startLineNumber>p.endLineNumber,S=p.startLineNumber>v.endLineNumber;if(!b&&!S){h=!0;break}}if(!h){l=!1;break}}if(l)for(let c=0,u=this._trimAutoWhitespaceLines.length;c<u;c++){let p=this._trimAutoWhitespaceLines[c],h=this.getLineMaxColumn(p),g=!0;for(let f=0,v=s.length;f<v;f++){let b=s[f].range,S=s[f].text;if(!(p<b.startLineNumber||p>b.endLineNumber)&&!(p===b.startLineNumber&&b.startColumn===h&&b.isEmpty()&&S&&S.length>0&&S.charAt(0)===`
`)&&!(p===b.startLineNumber&&b.startColumn===1&&b.isEmpty()&&S&&S.length>0&&S.charAt(S.length-1)===`
`)){g=!1;break}}if(g){let f=new G(p,1,p,h);t.push(new WY(null,f,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,o,n,r)}_applyUndo(e,t,o,n){let r=e.map(s=>{let l=this.getPositionAt(s.newPosition),c=this.getPositionAt(s.newEnd);return{range:new G(l.lineNumber,l.column,c.lineNumber,c.column),text:s.oldText}});this._applyUndoRedoEdits(r,t,!0,!1,o,n)}_applyRedo(e,t,o,n){let r=e.map(s=>{let l=this.getPositionAt(s.oldPosition),c=this.getPositionAt(s.oldEnd);return{range:new G(l.lineNumber,l.column,c.lineNumber,c.column),text:s.newText}});this._applyUndoRedoEdits(r,t,!1,!0,o,n)}_applyUndoRedoEdits(e,t,o,n,r,s){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=o,this._isRedoing=n;let l=this._validateEditOperations(e);this._doApplyEdits(l,!1,sd.applyEdits(),s),this.setEOL(t),this._overwriteAlternativeVersionId(r)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(s),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t,o){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();let n=this._validateEditOperations(e);return this._doApplyEdits(n,t??!1,o??sd.applyEdits())}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t,o,n=null){let r=this._buffer.getLineCount(),s=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),l=this._buffer.getLineCount(),c=s.changes;if(this._trimAutoWhitespaceLines=s.trimAutoWhitespaceLineNumbers,c.length!==0){for(let h=0,g=c.length;h<g;h++){let f=c[h];this._decorationsTree.acceptReplace(f.rangeOffset,f.rangeLength,f.text.length,f.forceMoveMarkers)}let u=[];this._increaseVersionId();let p=r;for(let h=0,g=c.length;h<g;h++){let f=c[h],[v]=NI(f.text);this._onDidChangeDecorations.fire();let b=f.range.startLineNumber,S=f.range.endLineNumber,y=S-b,w=v,x=Math.min(y,w),E=w-y,M=l-p-E+b;for(let N=x;N>=0;N--){let V=b+N,H=M+N;u.push(new r8e(V,H))}if(x<y){let N=b+x,V=w-y,H=l-p-V+N;u.push(new fCt(N+1,S,H))}if(x<w){let N=b+x,V=w-x,H=l-p-V+N+1;u.push(new vCt(N+1,H,V))}p+=E}this._emitContentChangedEvent(new ude(u,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:c,eol:this._buffer.getEOL(),isEolChange:!1,versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1,detailedReasons:[o],detailedReasonsChangeLengths:[c.length]},n)}return s.reverseEdits===null?void 0:s.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e,t,o){if(e&&e.size>0){let r=Array.from(e).map(s=>new r8e(s,s));this._onDidChangeContentOrInjectedText(new Bxe(r))}this._fireOnDidChangeLineHeight(t),this._fireOnDidChangeFont(o)}_fireOnDidChangeLineHeight(e){if(e&&e.size>0){let o=Array.from(e).map(n=>new hCt(n.ownerId,n.decorationId,n.lineNumber,n.lineHeight));this._onDidChangeLineHeight.fire(new Hxe(o))}}_fireOnDidChangeFont(e){if(e&&e.size>0){let o=Array.from(e).map(n=>new gCt(n.ownerId,n.lineNumber));this._onDidChangeFont.fire(new Uxe(o))}}_onDidChangeContentOrInjectedText(e){for(let t of this._viewModels)try{t.onDidChangeContentOrInjectedText(e)}catch(o){mt(o)}for(let t of this._viewModels)try{t.emitContentChangeEvent(e)}catch(o){mt(o)}}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){let o={addDecoration:(r,s)=>this._deltaDecorationsImpl(e,[],[{range:r,options:s}])[0],changeDecoration:(r,s)=>{this._changeDecorationImpl(e,r,s)},changeDecorationOptions:(r,s)=>{this._changeDecorationOptionsImpl(e,r,dJi(s))},removeDecoration:r=>{this._deltaDecorationsImpl(e,[r],[])},deltaDecorations:(r,s)=>r.length===0&&s.length===0?[]:this._deltaDecorationsImpl(e,r,s)},n=null;try{n=t(o)}catch(r){mt(r)}return o.addDecoration=R8e,o.changeDecoration=R8e,o.changeDecorationOptions=R8e,o.removeDecoration=R8e,o.deltaDecorations=R8e,n}deltaDecorations(e,t,o=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._deltaDecorationCallCnt++,this._deltaDecorationCallCnt>1&&(console.warn("Invoking deltaDecorations recursively could lead to leaking decorations."),mt(new Error("Invoking deltaDecorations recursively could lead to leaking decorations."))),this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(o,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit(),this._deltaDecorationCallCnt--}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,o){let n=e?this._decorations[e]:null;if(!n)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:cJi[o]}],!0)[0]:null;if(!t)return this._decorationsTree.delete(n),delete this._decorations[n.id],null;let r=this._validateRangeRelaxedNoAllocations(t),s=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),l=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);return this._decorationsTree.delete(n),n.reset(this.getVersionId(),s,l,r),n.setOptions(cJi[o]),this._decorationsTree.insert(n),n.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;let t=this._decorationsTree.collectNodesFromOwner(e);for(let o=0,n=t.length;o<n;o++){let r=t[o];this._decorationsTree.delete(r),delete this._decorations[r.id]}}getDecorationOptions(e){let t=this._decorations[e];return t?t.options:null}getDecorationRange(e){let t=this._decorations[e];return t?this._decorationsTree.getNodeRange(this,t):null}getLineDecorations(e,t=0,o=!1,n=!1){return e<1||e>this.getLineCount()?[]:this.getLinesDecorations(e,e,t,o,n)}getLinesDecorations(e,t,o=0,n=!1,r=!1,s=!1){let l=this.getLineCount(),c=Math.min(l,Math.max(1,e)),u=Math.min(l,Math.max(1,t)),p=this.getLineMaxColumn(u),h=new G(c,1,u,p),g=this._getDecorationsInRange(h,o,n,r,s);return Vj(g,this._decorationProvider.getDecorationsInRange(h,o,n,r)),Vj(g,this._fontTokenDecorationsProvider.getDecorationsInRange(h,o,n,r)),g}getDecorationsInRange(e,t=0,o=!1,n=!1,r=!1,s=!1){let l=this.validateRange(e),c=this._getDecorationsInRange(l,t,o,n,s);return Vj(c,this._decorationProvider.getDecorationsInRange(l,t,o,n,r)),Vj(c,this._fontTokenDecorationsProvider.getDecorationsInRange(l,t,o,n,r)),c}getOverviewRulerDecorations(e=0,t=!1,o=!1){return this._decorationsTree.getAll(this,e,t,o,!0,!1)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}getCustomLineHeightsDecorations(e=0){let t=this._decorationsTree.getAllCustomLineHeights(this,e);return Vj(t,this._fontTokenDecorationsProvider.getAllDecorations(e)),t}getCustomLineHeightsDecorationsInRange(e,t=0){let o=this._decorationsTree.getCustomLineHeightsInInterval(this,this.getOffsetAt(e.getStartPosition()),this.getOffsetAt(e.getEndPosition()),t);return Vj(o,this._fontTokenDecorationsProvider.getDecorationsInRange(e,t)),o}getLineInjectedText(e,t=0){let o=this._buffer.getOffsetAt(e,1),n=o+this._buffer.getLineLength(e),r=this._decorationsTree.getInjectedTextInInterval(this,o,n,t);return BF.fromDecorations(r).filter(s=>s.lineNumber===e)}getFontDecorationsInRange(e,t=0){let o=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),n=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getFontDecorationsInInterval(this,o,n,t)}getAllDecorations(e=0,t=!1,o=!1){let n=this._decorationsTree.getAll(this,e,t,o,!1,!1);return n=n.concat(this._decorationProvider.getAllDecorations(e,t)),n=n.concat(this._fontTokenDecorationsProvider.getAllDecorations(e,t)),n}getAllMarginDecorations(e=0){return this._decorationsTree.getAll(this,e,!1,!1,!1,!0)}_getDecorationsInRange(e,t,o,n,r){let s=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),l=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,s,l,t,o,n,r)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t,o){let n=this._decorations[t];if(!n)return;if(n.options.after){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.endLineNumber)}if(n.options.before){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.startLineNumber)}if(n.options.lineHeight!==null){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,c.startLineNumber,null)}if(n.options.affectsFont){let c=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,c.startLineNumber)}let r=this._validateRangeRelaxedNoAllocations(o),s=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),l=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);this._decorationsTree.delete(n),n.reset(this.getVersionId(),s,l,r),this._decorationsTree.insert(n),this._onDidChangeDecorations.checkAffectedAndFire(n.options),n.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.endLineNumber),n.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(r.startLineNumber),n.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,r.startLineNumber,n.options.lineHeight),n.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,r.startLineNumber)}_changeDecorationOptionsImpl(e,t,o){let n=this._decorations[t];if(!n)return;let r=!!(n.options.overviewRuler&&n.options.overviewRuler.color),s=!!(o.overviewRuler&&o.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(n.options),this._onDidChangeDecorations.checkAffectedAndFire(o),n.options.after||o.after){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(u.endLineNumber)}if(n.options.before||o.before){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(u.startLineNumber)}if(n.options.lineHeight!==null||o.lineHeight!==null){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,u.startLineNumber,o.lineHeight)}if(n.options.affectsFont||o.affectsFont){let u=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,t,u.startLineNumber)}let l=r!==s,c=Kqo(o)!==YCt(n);l||c?(this._decorationsTree.delete(n),n.setOptions(o),this._decorationsTree.insert(n)):n.setOptions(o)}_deltaDecorationsImpl(e,t,o,n=!1){let r=this.getVersionId(),s=t.length,l=0,c=o.length,u=0;this._onDidChangeDecorations.beginDeferredEmit();try{let p=new Array(c);for(;l<s||u<c;){let h=null;if(l<s){let g;do g=t[l++],h=this._decorations[g];while(!h&&l<s);if(h){if(h.options.after){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.endLineNumber)}if(h.options.before){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.startLineNumber)}if(h.options.lineHeight!==null){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,g,f.startLineNumber,null)}if(h.options.affectsFont){let f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,g,f.startLineNumber)}this._decorationsTree.delete(h),n||this._onDidChangeDecorations.checkAffectedAndFire(h.options)}}if(u<c){if(!h){let y=++this._lastDecorationId,w=`${this._instanceId};${y}`;h=new pde(w,0,0),this._decorations[w]=h}let g=o[u],f=this._validateRangeRelaxedNoAllocations(g.range),v=dJi(g.options),b=this._buffer.getOffsetAt(f.startLineNumber,f.startColumn),S=this._buffer.getOffsetAt(f.endLineNumber,f.endColumn);h.ownerId=e,h.reset(r,b,S,f),h.setOptions(v),h.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.endLineNumber),h.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.startLineNumber),h.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,h.id,f.startLineNumber,h.options.lineHeight),h.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,h.id,f.startLineNumber),n||this._onDidChangeDecorations.checkAffectedAndFire(v),this._decorationsTree.insert(h),p[u]=h.id,u++}else h&&delete this._decorations[h.id]}return p}finally{this._onDidChangeDecorations.endDeferredEmit()}}getLanguageId(){return this.tokenization.getLanguageId()}setLanguage(e,t){typeof e=="string"?(this._languageSelectionListener.clear(),this._setLanguage(e,t)):(this._languageSelectionListener.value=e.onDidChange(()=>this._setLanguage(e.languageId,t)),this._setLanguage(e.languageId,t))}_setLanguage(e,t){this.tokenization.setLanguageId(e,t),this._languageService.requestRichLanguageFeatures(e)}getLanguageIdAtPosition(e,t){return this.tokenization.getLanguageIdAtPosition(e,t)}getWordAtPosition(e){return this._tokenizationTextModelPart.getWordAtPosition(e)}getWordUntilPosition(e){return this._tokenizationTextModelPart.getWordUntilPosition(e)}normalizePosition(e,t){return e}getLineIndentColumn(e){return rke(this.getLineContent(e))+1}toString(){return`TextModel(${this.uri.toString()})`}};Tp=I([m(4,wl),m(5,Rt),m(6,Us),m(7,F)],Tp);function uJi(a,i,e){let t;if(e){let o=[];for(let n=0;n<e.length;n++){let r=e[n],s=i[n].tokens;s?s.forEach((l,c)=>{o.push({offset:r,text:l.substring(i[n].content),tokenMetadata:c.metadata})}):o.push({offset:r,text:i[n].content,tokenMetadata:Cd.defaultTokenMetadata})}t=a.withInserted(o)}else t=a;return t}function rke(a){let i=0;for(let e of a)if(e===" "||e==="	")i++;else break;return i}function Lli(a){return!!(a.options.overviewRuler&&a.options.overviewRuler.color)}function Kqo(a){return!!a.after||!!a.before}function YCt(a){return!!a.options.after||!!a.options.before}var XCt=class{constructor(){this._decorationsTree0=new _X,this._decorationsTree1=new _X,this._injectedTextDecorationsTree=new _X}ensureAllNodesHaveRanges(i){this.getAll(i,0,!1,!1,!1,!1)}_ensureNodesHaveRanges(i,e){for(let t of e)t.range===null&&(t.range=i.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd));return e}getAllInInterval(i,e,t,o,n,r,s){let l=i.getVersionId(),c=this._intervalSearch(e,t,o,n,r,l,s);return this._ensureNodesHaveRanges(i,c)}_intervalSearch(i,e,t,o,n,r,s){let l=this._decorationsTree0.intervalSearch(i,e,t,o,n,r,s),c=this._decorationsTree1.intervalSearch(i,e,t,o,n,r,s),u=this._injectedTextDecorationsTree.intervalSearch(i,e,t,o,n,r,s);return l.concat(c).concat(u)}getInjectedTextInInterval(i,e,t,o){let n=i.getVersionId(),r=this._injectedTextDecorationsTree.intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>s.options.showIfCollapsed||!s.range.isEmpty())}getFontDecorationsInInterval(i,e,t,o){let n=i.getVersionId(),r=this._decorationsTree0.intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>s.options.affectsFont)}getAllInjectedText(i,e){let t=i.getVersionId(),o=this._injectedTextDecorationsTree.search(e,!1,!1,t,!1);return this._ensureNodesHaveRanges(i,o).filter(n=>n.options.showIfCollapsed||!n.range.isEmpty())}getAllCustomLineHeights(i,e){let t=i.getVersionId(),o=this._search(e,!1,!1,!1,t,!1);return this._ensureNodesHaveRanges(i,o).filter(n=>typeof n.options.lineHeight=="number")}getCustomLineHeightsInInterval(i,e,t,o){let n=i.getVersionId(),r=this._intervalSearch(e,t,o,!1,!1,n,!1);return this._ensureNodesHaveRanges(i,r).filter(s=>typeof s.options.lineHeight=="number")}getAll(i,e,t,o,n,r){let s=i.getVersionId(),l=this._search(e,t,o,n,s,r);return this._ensureNodesHaveRanges(i,l)}_search(i,e,t,o,n,r){if(o)return this._decorationsTree1.search(i,e,t,n,r);{let s=this._decorationsTree0.search(i,e,t,n,r),l=this._decorationsTree1.search(i,e,t,n,r),c=this._injectedTextDecorationsTree.search(i,e,t,n,r);return s.concat(l).concat(c)}}collectNodesFromOwner(i){let e=this._decorationsTree0.collectNodesFromOwner(i),t=this._decorationsTree1.collectNodesFromOwner(i),o=this._injectedTextDecorationsTree.collectNodesFromOwner(i);return e.concat(t).concat(o)}collectNodesPostOrder(){let i=this._decorationsTree0.collectNodesPostOrder(),e=this._decorationsTree1.collectNodesPostOrder(),t=this._injectedTextDecorationsTree.collectNodesPostOrder();return i.concat(e).concat(t)}insert(i){YCt(i)?this._injectedTextDecorationsTree.insert(i):Lli(i)?this._decorationsTree1.insert(i):this._decorationsTree0.insert(i)}delete(i){YCt(i)?this._injectedTextDecorationsTree.delete(i):Lli(i)?this._decorationsTree1.delete(i):this._decorationsTree0.delete(i)}getNodeRange(i,e){let t=i.getVersionId();return e.cachedVersionId!==t&&this._resolveNode(e,t),e.range===null&&(e.range=i.getRangeAt(e.cachedAbsoluteStart,e.cachedAbsoluteEnd)),e.range}_resolveNode(i,e){YCt(i)?this._injectedTextDecorationsTree.resolveNode(i,e):Lli(i)?this._decorationsTree1.resolveNode(i,e):this._decorationsTree0.resolveNode(i,e)}acceptReplace(i,e,t,o){this._decorationsTree0.acceptReplace(i,e,t,o),this._decorationsTree1.acceptReplace(i,e,t,o),this._injectedTextDecorationsTree.acceptReplace(i,e,t,o)}};function CK(a){return a.replace(/[^a-z0-9\-_]/gi," ")}var JCt=class{constructor(i){this.color=i.color||"",this.darkColor=i.darkColor||""}},Pli=class extends JCt{constructor(i){super(i),this._resolvedColor=null,this.position=typeof i.position=="number"?i.position:2}getColor(i){return this._resolvedColor||(cm(i.type)&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,i):this._resolvedColor=this._resolveColor(this.color,i)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(i,e){if(typeof i=="string")return i;let t=i?e.getColor(i.id):null;return t?t.toString():""}},Ali=class{constructor(i){this.position=i?.position??2,this.persistLane=i?.persistLane}},Nli=class extends JCt{constructor(i){super(i),this.position=i.position,this.sectionHeaderStyle=i.sectionHeaderStyle??null,this.sectionHeaderText=i.sectionHeaderText??null}getColor(i){return this._resolvedColor||(cm(i.type)&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,i):this._resolvedColor=this._resolveColor(this.color,i)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(i,e){return typeof i=="string"?Ue.fromHex(i):e.getColor(i.id)}},kK=class a{static from(i){return i instanceof a?i:new a(i)}constructor(i){this.content=i.content||"",this.tokens=i.tokens??null,this.inlineClassName=i.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=i.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=i.attachedData||null,this.cursorStops=i.cursorStops||null}},So=class a{static register(i){return new a(i)}static createDynamic(i){return new a(i)}constructor(i){this.description=i.description,this.blockClassName=i.blockClassName?CK(i.blockClassName):null,this.blockDoesNotCollapse=i.blockDoesNotCollapse??null,this.blockIsAfterEnd=i.blockIsAfterEnd??null,this.blockPadding=i.blockPadding??null,this.stickiness=i.stickiness||0,this.zIndex=i.zIndex||0,this.className=i.className?CK(i.className):null,this.shouldFillLineOnLineBreak=i.shouldFillLineOnLineBreak??null,this.hoverMessage=i.hoverMessage||null,this.glyphMarginHoverMessage=i.glyphMarginHoverMessage||null,this.lineNumberHoverMessage=i.lineNumberHoverMessage||null,this.isWholeLine=i.isWholeLine||!1,this.lineHeight=i.lineHeight?Math.min(i.lineHeight,zqo):null,this.fontSize=i.fontSize||null,this.affectsFont=!!i.fontSize||!!i.fontFamily||!!i.fontWeight||!!i.fontStyle,this.showIfCollapsed=i.showIfCollapsed||!1,this.collapseOnReplaceEdit=i.collapseOnReplaceEdit||!1,this.overviewRuler=i.overviewRuler?new Pli(i.overviewRuler):null,this.minimap=i.minimap?new Nli(i.minimap):null,this.glyphMargin=i.glyphMarginClassName?new Ali(i.glyphMargin):null,this.glyphMarginClassName=i.glyphMarginClassName?CK(i.glyphMarginClassName):null,this.linesDecorationsClassName=i.linesDecorationsClassName?CK(i.linesDecorationsClassName):null,this.lineNumberClassName=i.lineNumberClassName?CK(i.lineNumberClassName):null,this.linesDecorationsTooltip=i.linesDecorationsTooltip?Xvt(i.linesDecorationsTooltip):null,this.firstLineDecorationClassName=i.firstLineDecorationClassName?CK(i.firstLineDecorationClassName):null,this.marginClassName=i.marginClassName?CK(i.marginClassName):null,this.inlineClassName=i.inlineClassName?CK(i.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=i.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=i.beforeContentClassName?CK(i.beforeContentClassName):null,this.afterContentClassName=i.afterContentClassName?CK(i.afterContentClassName):null,this.after=i.after?kK.from(i.after):null,this.before=i.before?kK.from(i.before):null,this.hideInCommentTokens=i.hideInCommentTokens??!1,this.hideInStringTokens=i.hideInStringTokens??!1,this.textDirection=i.textDirection??null}};So.EMPTY=So.register({description:"empty"});var cJi=[So.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),So.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),So.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),So.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function dJi(a){return a instanceof So?a:So.createDynamic(a)}var Oli=class extends k{constructor(e){super();this.handleBeforeFire=e;this._actual=this._register(new T);this.event=this._actual.event;this._affectedInjectedTextLines=null;this._affectedLineHeights=null;this._affectedFontLines=null;this._deferredCnt=0,this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._affectsLineNumber=!1}hasListeners(){return this._actual.hasListeners()}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){this._deferredCnt--,this._deferredCnt===0&&(this._shouldFireDeferred&&this.doFire(),this._affectedInjectedTextLines?.clear(),this._affectedInjectedTextLines=null,this._affectedLineHeights?.clear(),this._affectedLineHeights=null,this._affectedFontLines?.clear(),this._affectedFontLines=null)}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}recordLineAffectedByLineHeightChange(e,t,o,n){this._affectedLineHeights||(this._affectedLineHeights=new Sle([],X5.toKey)),this._affectedLineHeights.add(new X5(e,t,o,n))}recordLineAffectedByFontChange(e,t,o){this._affectedFontLines||(this._affectedFontLines=new Sle([],J5.toKey)),this._affectedFontLines.add(new J5(e,t,o))}checkAffectedAndFire(e){this._affectsMinimap||=!!e.minimap?.position,this._affectsOverviewRuler||=!!e.overviewRuler?.color,this._affectsGlyphMargin||=!!e.glyphMarginClassName,this._affectsLineNumber||=!!e.lineNumberClassName,this.tryFire()}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._affectsGlyphMargin=!0,this.tryFire()}tryFire(){this._deferredCnt===0?this.doFire():this._shouldFireDeferred=!0}doFire(){this.handleBeforeFire(this._affectedInjectedTextLines,this._affectedLineHeights,this._affectedFontLines);let e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler,affectsGlyphMargin:this._affectsGlyphMargin,affectsLineNumber:this._affectsLineNumber};this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._actual.fire(e)}},Fli=class extends k{constructor(){super();this._emitter=this._register(new T);this.event=this._emitter.event;this._deferredCnt=0,this._deferredEvent=null}hasListeners(){return this._emitter.hasListeners()}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,this._deferredCnt===0&&this._deferredEvent!==null){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;let t=this._deferredEvent;this._deferredEvent=null,this._emitter.fire(t)}}fire(e){if(this._deferredCnt>0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._emitter.fire(e)}};var ZCt=class a{static create(i){return new a(i.get(151),i.get(150))}constructor(i,e){this.classifier=new Wli(i,e)}createLineBreaksComputer(i,e,t,o,n,r,s){let l=[],c=[];return{addRequest:(u,p)=>{l.push(u),c.push(p)},finalize:()=>{let u=e.typicalFullwidthCharacterWidth/e.typicalHalfwidthCharacterWidth,p=[];for(let h=0,g=l.length;h<g;h++){let f=l[h],v=i.getLineInjectedText(f),b=i.getLineContent(f),S=c[h],y=s&&b.includes('"')&&b.includes("\\n");S&&!S.injectionOptions&&!v&&!y?p[h]=Gqo(this.classifier,S,b,t,o,u,n,r):p[h]=qqo(this.classifier,b,v,t,o,u,n,r,y)}return Vli.length=0,Bli.length=0,p}}}};var Wli=class extends u5{constructor(i,e){super(0);for(let t=0;t<i.length;t++)this.set(i.charCodeAt(t),1);for(let t=0;t<e.length;t++)this.set(e.charCodeAt(t),2)}get(i){return i>=0&&i<256?this._asciiMap[i]:i>=12352&&i<=12543||i>=13312&&i<=19903||i>=19968&&i<=40959?3:this._map.get(i)||this._defaultValue}},Vli=[],Bli=[];function Gqo(a,i,e,t,o,n,r,s){if(o===-1)return null;let l=e.length;if(l<=1)return null;let c=s==="keepAll",u=i.breakOffsets,p=i.breakOffsetsVisibleColumn,h=mJi(e,t,o,n,r),g=o-h,f=Vli,v=Bli,b=0,S=0,y=0,w=o,x=u.length,E=0;if(E>=0){let M=Math.abs(p[E]-w);for(;E+1<x;){let N=Math.abs(p[E+1]-w);if(N>=M)break;M=N,E++}}for(;E<x;){let M=E<0?0:u[E],N=E<0?0:p[E];S>M&&(M=S,N=y);let V=0,H=0,K=0,j=0;if(N<=w){let se=N,ae=M===0?0:e.charCodeAt(M-1),ce=M===0?0:a.get(ae),Se=!0;for(let Re=M;Re<l;Re++){let xe=Re,He=e.charCodeAt(Re),Ee,Te;if(Ip(He)?(Re++,Ee=0,Te=2):(Ee=a.get(He),Te=L8e(He,se,t,n)),xe>S&&Hli(ae,ce,He,Ee,c)&&(V=xe,H=se),se+=Te,se>w){xe>S?(K=xe,j=se-Te):(K=Re+1,j=se),se-H>g&&(V=0),Se=!1;break}ae=He,ce=Ee}if(Se){b>0&&(f[b]=u[u.length-1],v[b]=p[u.length-1],b++);break}}if(V===0){let se=N,ae=e.charCodeAt(M),ce=a.get(ae),Se=!1;for(let Re=M-1;Re>=S;Re--){let xe=Re+1,He=e.charCodeAt(Re);if(He===9){Se=!0;break}let Ee,Te;if(iF(He)?(Re--,Ee=0,Te=2):(Ee=a.get(He),Te=sD(He)?n:1),se<=w){if(K===0&&(K=xe,j=se),se<=w-g)break;if(Hli(He,Ee,ae,ce,c)){V=xe,H=se;break}}se-=Te,ae=He,ce=Ee}if(V!==0){let Re=g-(j-H);if(Re<=t){let xe=e.charCodeAt(K),He;Ip(xe)?He=2:He=L8e(xe,j,t,n),Re-He<0&&(V=0)}}if(Se){E--;continue}}if(V===0&&(V=K,H=j),V<=S){let se=e.charCodeAt(S);Ip(se)?(V=S+2,H=y+2):(V=S+1,H=y+L8e(se,y,t,n))}for(S=V,f[b]=V,y=H,v[b]=H,b++,w=H+g;E<0||E<x&&p[E]<H;)E++;let J=Math.abs(p[E]-w);for(;E+1<x;){let se=Math.abs(p[E+1]-w);if(se>=J)break;J=se,E++}}return b===0?null:(f.length=b,v.length=b,Vli=i.breakOffsets,Bli=i.breakOffsetsVisibleColumn,i.breakOffsets=f,i.breakOffsetsVisibleColumn=v,i.wrappedTextIndentLength=h,i)}function qqo(a,i,e,t,o,n,r,s,l){let c=BF.applyInjectedText(i,e),u,p;if(e&&e.length>0?(u=e.map(K=>K.options),p=e.map(K=>K.column-1)):(u=null,p=null),o===-1)return u?new K5(p,u,[c.length],[],0):null;let h=c.length;if(h<=1)return u?new K5(p,u,[c.length],[],0):null;let g=s==="keepAll",f=mJi(c,t,o,n,r),v=o-f,b=[],S=[],y=0,w=0,x=0,E=o,M=c.charCodeAt(0),N=a.get(M),V=L8e(M,0,t,n),H=1;Ip(M)&&(V+=1,M=c.charCodeAt(1),N=a.get(M),H++);for(let K=H;K<h;K++){let j=K,J=c.charCodeAt(K),se,ae,ce=!1;Ip(J)?(K++,se=0,ae=2):(se=a.get(J),ae=L8e(J,V,t,n)),l&&$qo(c,K)?(w=j,x=V,ce=!0):Hli(M,N,J,se,g)&&(w=j,x=V),V+=ae,(V>E||ce)&&((w===0||V-x>v)&&(w=j,x=V-ae),b[y]=w,S[y]=x,y++,E=x+v,w=0),M=J,N=se}return y===0&&(!e||e.length===0)?null:(b[y]=h,S[y]=V,new K5(p,u,b,S,f))}function L8e(a,i,e,t){return a===9?e-i%e:sD(a)||a<32?t:1}function pJi(a,i){return i-a%i}function $qo(a,i){if(i>=2&&a.charAt(i-1)==="n"){let e=0;for(let t=i-2;t>=0;t--)if(a.charAt(t)==="\\")e++;else return e%2===1}return!1}function Hli(a,i,e,t,o){return e!==32&&(i===2&&t!==2||i!==1&&t===1||!o&&i===3&&t!==2||!o&&t===3&&i!==1)}function mJi(a,i,e,t,o){let n=0;if(o!==0){let r=Em(a);if(r!==-1){for(let l=0;l<r;l++){let c=a.charCodeAt(l)===9?pJi(n,i):1;n+=c}let s=o===3?2:o===2?1:0;for(let l=0;l<s;l++){let c=pJi(n,i);n+=c}n+t>e&&(n=0)}}return n}var M8e=class a{constructor(i){this._selTrackedRange=null,this._trackSelection=!0,this._setState(i,new zv(new G(1,1,1,1),0,0,new ye(1,1),0),new zv(new G(1,1,1,1),0,0,new ye(1,1),0))}dispose(i){this._removeTrackedRange(i)}startTrackingSelection(i){this._trackSelection=!0,this._updateTrackedRange(i)}stopTrackingSelection(i){this._trackSelection=!1,this._removeTrackedRange(i)}_updateTrackedRange(i){this._trackSelection&&(this._selTrackedRange=i.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(i){this._selTrackedRange=i.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new aa(this.modelState,this.viewState)}readSelectionFromMarkers(i){let e=i.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!e.isEmpty()?ei.fromRange(e.collapseToEnd(),this.modelState.selection.getDirection()):ei.fromRange(e,this.modelState.selection.getDirection())}ensureValidState(i){this._setState(i,this.modelState,this.viewState)}setState(i,e,t){this._setState(i,e,t)}static _validatePositionWithCache(i,e,t,o){return e.equals(t)?o:i.normalizePosition(e,2)}static _validateViewState(i,e){let t=e.position,o=e.selectionStart.getStartPosition(),n=e.selectionStart.getEndPosition(),r=i.normalizePosition(t,2),s=this._validatePositionWithCache(i,o,t,r),l=this._validatePositionWithCache(i,n,o,s);return t.equals(r)&&o.equals(s)&&n.equals(l)?e:new zv(G.fromPositions(s,l),e.selectionStartKind,e.selectionStartLeftoverVisibleColumns+o.column-s.column,r,e.leftoverVisibleColumns+t.column-r.column)}_setState(i,e,t){if(t&&(t=a._validateViewState(i.viewModel,t)),e){let o=i.model.validateRange(e.selectionStart),n=e.selectionStart.equalsRange(o)?e.selectionStartLeftoverVisibleColumns:0,r=i.model.validatePosition(e.position),s=e.position.equals(r)?e.leftoverVisibleColumns:0;e=new zv(o,e.selectionStartKind,n,r,s)}else{if(!t)return;let o=i.model.validateRange(i.coordinatesConverter.convertViewRangeToModelRange(t.selectionStart)),n=i.model.validatePosition(i.coordinatesConverter.convertViewPositionToModelPosition(t.position));e=new zv(o,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,n,t.leftoverVisibleColumns)}if(t){let o=i.coordinatesConverter.validateViewRange(t.selectionStart,e.selectionStart),n=i.coordinatesConverter.validateViewPosition(t.position,e.position);t=new zv(o,e.selectionStartKind,e.selectionStartLeftoverVisibleColumns,n,e.leftoverVisibleColumns)}else{let o=i.coordinatesConverter.convertModelPositionToViewPosition(new ye(e.selectionStart.startLineNumber,e.selectionStart.startColumn)),n=i.coordinatesConverter.convertModelPositionToViewPosition(new ye(e.selectionStart.endLineNumber,e.selectionStart.endColumn)),r=new G(o.lineNumber,o.column,n.lineNumber,n.column),s=i.coordinatesConverter.convertModelPositionToViewPosition(e.position);t=new zv(r,e.selectionStartKind,e.selectionStartLeftoverVisibleColumns,s,e.leftoverVisibleColumns)}this.modelState=e,this.viewState=t,this._updateTrackedRange(i)}};var P8e=class{constructor(i){this.context=i,this.cursors=[new M8e(i)],this.lastAddedCursorIndex=0}dispose(){for(let i of this.cursors)i.dispose(this.context)}startTrackingSelections(){for(let i of this.cursors)i.startTrackingSelection(this.context)}stopTrackingSelections(){for(let i of this.cursors)i.stopTrackingSelection(this.context)}updateContext(i){this.context=i}ensureValidState(){for(let i of this.cursors)i.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map(i=>i.readSelectionFromMarkers(this.context))}getAll(){return this.cursors.map(i=>i.asCursorState())}getViewPositions(){return this.cursors.map(i=>i.viewState.position)}getTopMostViewPosition(){return gvt(this.cursors,Il(i=>i.viewState.position,ye.compare)).viewState.position}getBottomMostViewPosition(){return hvt(this.cursors,Il(i=>i.viewState.position,ye.compare)).viewState.position}getSelections(){return this.cursors.map(i=>i.modelState.selection)}getViewSelections(){return this.cursors.map(i=>i.viewState.selection)}setSelections(i){this.setStates(aa.fromModelSelections(i))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(i){i!==null&&(this.cursors[0].setState(this.context,i[0].modelState,i[0].viewState),this._setSecondaryStates(i.slice(1)))}_setSecondaryStates(i){let e=this.cursors.length-1,t=i.length;if(e<t){let o=t-e;for(let n=0;n<o;n++)this._addSecondaryCursor()}else if(e>t){let o=e-t;for(let n=0;n<o;n++)this._removeSecondaryCursor(this.cursors.length-2)}for(let o=0;o<t;o++)this.cursors[o+1].setState(this.context,i[o].modelState,i[o].viewState)}killSecondaryCursors(){this._setSecondaryStates([])}_addSecondaryCursor(){this.cursors.push(new M8e(this.context)),this.lastAddedCursorIndex=this.cursors.length-1}getLastAddedCursorIndex(){return this.cursors.length===1||this.lastAddedCursorIndex===0?0:this.lastAddedCursorIndex}_removeSecondaryCursor(i){this.lastAddedCursorIndex>=i+1&&this.lastAddedCursorIndex--,this.cursors[i+1].dispose(this.context),this.cursors.splice(i+1,1)}normalize(){if(this.cursors.length===1)return;let i=this.cursors.slice(0),e=[];for(let t=0,o=i.length;t<o;t++)e.push({index:t,selection:i[t].modelState.selection});e.sort(Il(t=>t.selection,G.compareRangesUsingStarts));for(let t=0;t<e.length-1;t++){let o=e[t],n=e[t+1],r=o.selection,s=n.selection;if(!this.context.cursorConfig.multiCursorMergeOverlapping)continue;let l;if(s.isEmpty()||r.isEmpty()?l=s.getStartPosition().isBeforeOrEqual(r.getEndPosition()):l=s.getStartPosition().isBefore(r.getEndPosition()),l){let c=o.index<n.index?t:t+1,u=o.index<n.index?t+1:t,p=e[u].index,h=e[c].index,g=e[u].selection,f=e[c].selection;if(!g.equalsSelection(f)){let v=g.plusRange(f),b=g.selectionStartLineNumber===g.startLineNumber&&g.selectionStartColumn===g.startColumn,S=f.selectionStartLineNumber===f.startLineNumber&&f.selectionStartColumn===f.startColumn,y;p===this.lastAddedCursorIndex?(y=b,this.lastAddedCursorIndex=h):y=S;let w;y?w=new ei(v.startLineNumber,v.startColumn,v.endLineNumber,v.endColumn):w=new ei(v.endLineNumber,v.endColumn,v.startLineNumber,v.startColumn),e[c].selection=w;let x=aa.fromModelSelection(w);i[h].setState(this.context,x.modelState,x.viewState)}for(let v of e)v.index>p&&v.index--;i.splice(p,1),e.splice(u,1),this._removeSecondaryCursor(p-1),t--}}}};var A8e=class{constructor(i,e,t,o){this._cursorContextBrand=void 0;this.model=i,this.viewModel=e,this.coordinatesConverter=t,this.cursorConfig=o}};var ext=class extends k{constructor(){super();this._onEvent=this._register(new T);this.onEvent=this._onEvent.event;this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,o=this._outgoingEvents.length;t<o;t++){let n=this._outgoingEvents[t].kind===e.kind?this._outgoingEvents[t].attemptToMerge(e):null;if(n){this._outgoingEvents[t]=n;return}}this._outgoingEvents.push(e)}_emitOutgoingEvents(){for(;this._outgoingEvents.length>0;){if(this._collector||this._isConsumingViewEventQueue)return;let e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,o=this._eventHandlers.length;t<o;t++)this._eventHandlers[t]===e&&console.warn("Detected duplicate listener in ViewEventDispatcher",e);this._eventHandlers.push(e)}removeViewEventHandler(e){for(let t=0;t<this._eventHandlers.length;t++)if(this._eventHandlers[t]===e){this._eventHandlers.splice(t,1);break}}beginEmitViewEvents(){return this._collectorCnt++,this._collectorCnt===1&&(this._collector=new RA),this._collector}endEmitViewEvents(){if(this._collectorCnt--,this._collectorCnt===0){let e=this._collector.outgoingEvents,t=this._collector.viewEvents;this._collector=null;for(let o of e)this._addOutgoingEvent(o);t.length>0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){let e=this._viewEventQueue;this._viewEventQueue=null;let t=this._eventHandlers.slice(0);for(let o of t)o.handleEvents(e)}}},RA=class{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(i){this.viewEvents.push(i)}emitOutgoingEvent(i){this.outgoingEvents.push(i)}};var txt=class a{constructor(i,e,t,o){this.kind=0;this._oldContentWidth=i,this._oldContentHeight=e,this.contentWidth=t,this.contentHeight=o,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}attemptToMerge(i){return i.kind!==this.kind?null:new a(this._oldContentWidth,this._oldContentHeight,i.contentWidth,i.contentHeight)}},N8e=class a{constructor(i,e){this.kind=1;this.oldHasFocus=i,this.hasFocus=e}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(i){return i.kind!==this.kind?null:new a(this.oldHasFocus,i.hasFocus)}},ixt=class{constructor(i,e){this.kind=2;this.oldHasFocus=i,this.hasFocus=e}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(i){return i.kind!==this.kind?null:new N8e(this.oldHasFocus,i.hasFocus)}},oxt=class a{constructor(i,e,t,o,n,r,s,l){this.kind=3;this._oldScrollWidth=i,this._oldScrollLeft=e,this._oldScrollHeight=t,this._oldScrollTop=o,this.scrollWidth=n,this.scrollLeft=r,this.scrollHeight=s,this.scrollTop=l,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}attemptToMerge(i){return i.kind!==this.kind?null:new a(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,i.scrollWidth,i.scrollLeft,i.scrollHeight,i.scrollTop)}},nxt=class{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},rxt=class{constructor(){this.kind=5}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},sxt=class a{constructor(i,e,t,o,n,r,s){this.kind=7;this.oldSelections=i,this.selections=e,this.oldModelVersionId=t,this.modelVersionId=o,this.source=n,this.reason=r,this.reachedMaxCursorCount=s}static _selectionsAreEqual(i,e){if(!i&&!e)return!0;if(!i||!e)return!1;let t=i.length,o=e.length;if(t!==o)return!1;for(let n=0;n<t;n++)if(!i[n].equalsSelection(e[n]))return!1;return!0}isNoOp(){return a._selectionsAreEqual(this.oldSelections,this.selections)&&this.oldModelVersionId===this.modelVersionId}attemptToMerge(i){return i.kind!==this.kind?null:new a(this.oldSelections,i.selections,this.oldModelVersionId,i.modelVersionId,i.source,i.reason,this.reachedMaxCursorCount||i.reachedMaxCursorCount)}},axt=class{constructor(){this.kind=6}isNoOp(){return!1}attemptToMerge(i){return i.kind!==this.kind?null:this}},lxt=class{constructor(i){this.event=i;this.kind=8}isNoOp(){return!1}attemptToMerge(i){return null}},cxt=class{constructor(i){this.event=i;this.kind=9}isNoOp(){return!1}attemptToMerge(i){return null}},dxt=class{constructor(i){this.event=i;this.kind=10}isNoOp(){return!1}attemptToMerge(i){return null}},uxt=class{constructor(i){this.event=i;this.kind=11}isNoOp(){return!1}attemptToMerge(i){return null}},pxt=class{constructor(i){this.event=i;this.kind=12}isNoOp(){return!1}attemptToMerge(i){return null}},mxt=class{constructor(i){this.event=i;this.kind=13}isNoOp(){return!1}attemptToMerge(i){return null}},hxt=class{constructor(i){this.event=i;this.kind=14}isNoOp(){return!1}attemptToMerge(i){return null}},gxt=class{constructor(i){this.event=i;this.kind=15}isNoOp(){return!1}attemptToMerge(i){return null}};var ske=class extends k{constructor(i,e,t,o){super(),this._model=i,this._knownModelVersionId=this._model.getVersionId(),this._viewModel=e,this._coordinatesConverter=t,this.context=new A8e(this._model,this._viewModel,this._coordinatesConverter,o),this._cursors=new P8e(this.context),this._hasFocus=!1,this._isHandling=!1,this._compositionState=null,this._columnSelectData=null,this._autoClosedActions=[],this._prevEditOperationType=0}dispose(){this._cursors.dispose(),this._autoClosedActions=je(this._autoClosedActions),super.dispose()}updateConfiguration(i){this.context=new A8e(this._model,this._viewModel,this._coordinatesConverter,i),this._cursors.updateContext(this.context)}onLineMappingChanged(i){this._knownModelVersionId===this._model.getVersionId()&&this.setStates(i,"viewModel",0,this.getCursorStates())}setHasFocus(i){this._hasFocus=i}_validateAutoClosedActions(){if(this._autoClosedActions.length>0){let i=this._cursors.getSelections();for(let e=0;e<this._autoClosedActions.length;e++){let t=this._autoClosedActions[e];t.isValid(i)||(t.dispose(),this._autoClosedActions.splice(e,1),e--)}}}getPrimaryCursorState(){return this._cursors.getPrimaryCursor()}getLastAddedCursorIndex(){return this._cursors.getLastAddedCursorIndex()}getCursorStates(){return this._cursors.getAll()}setStates(i,e,t,o){let n=!1,r=this.context.cursorConfig.multiCursorLimit;o!==null&&o.length>r&&(o=o.slice(0,r),n=!0);let s=O8e.from(this._model,this);return this._cursors.setStates(o),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(i,e,t,s,n)}setCursorColumnSelectData(i){this._columnSelectData=i}revealAll(i,e,t,o,n,r){let s=this._cursors.getViewPositions(),l=null,c=null;s.length>1?c=this._cursors.getViewSelections():l=G.fromPositions(s[0],s[0]),i.emitViewEvent(new b5(e,t,l,c,o,n,r))}revealPrimary(i,e,t,o,n,r){let l=[this._cursors.getPrimaryCursor().viewState.selection];i.emitViewEvent(new b5(e,t,null,l,o,n,r))}saveState(){let i=[],e=this._cursors.getSelections();for(let t=0,o=e.length;t<o;t++){let n=e[t];i.push({inSelectionMode:!n.isEmpty(),selectionStart:{lineNumber:n.selectionStartLineNumber,column:n.selectionStartColumn},position:{lineNumber:n.positionLineNumber,column:n.positionColumn}})}return i}restoreState(i,e){let t=[];for(let o=0,n=e.length;o<n;o++){let r=e[o],s=1,l=1;r.position&&r.position.lineNumber&&(s=r.position.lineNumber),r.position&&r.position.column&&(l=r.position.column);let c=s,u=l;r.selectionStart&&r.selectionStart.lineNumber&&(c=r.selectionStart.lineNumber),r.selectionStart&&r.selectionStart.column&&(u=r.selectionStart.column),t.push({selectionStartLineNumber:c,selectionStartColumn:u,positionLineNumber:s,positionColumn:l})}this.setStates(i,"restoreState",0,aa.fromModelSelections(t)),this.revealAll(i,"restoreState",!1,0,!0,1)}onModelContentChanged(i,e){if(e instanceof Bxe){if(this._isHandling)return;this._isHandling=!0;try{this.setStates(i,"modelChange",0,this.getCursorStates())}finally{this._isHandling=!1}}else{let t=e.rawContentChangedEvent;if(this._knownModelVersionId=t.versionId,this._isHandling)return;let o=t.containsEvent(1);if(this._prevEditOperationType=0,o)this._cursors.dispose(),this._cursors=new P8e(this.context),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(i,"model",1,null,!1);else if(this._hasFocus&&t.resultingSelection&&t.resultingSelection.length>0){let n=aa.fromModelSelections(t.resultingSelection);this.setStates(i,"modelChange",t.isUndoing?5:t.isRedoing?6:2,n)&&this.revealAll(i,"modelChange",!1,0,!0,0)}else{let n=this._cursors.readSelectionFromMarkers();this.setStates(i,"modelChange",2,aa.fromModelSelections(n))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;let i=this._cursors.getPrimaryCursor(),e=i.viewState.selectionStart.getStartPosition(),t=i.viewState.position;return{isReal:!1,fromViewLineNumber:e.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,e),toViewLineNumber:t.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t)}}getSelections(){return this._cursors.getSelections()}getPosition(){return this._cursors.getPrimaryCursor().modelState.position}setSelections(i,e,t,o){this.setStates(i,e,o,aa.fromModelSelections(t))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(i){this._prevEditOperationType=i}_pushAutoClosedAction(i,e){let t=[],o=[];for(let s=0,l=i.length;s<l;s++)t.push({range:i[s],options:{description:"auto-closed-character",inlineClassName:"auto-closed-character",stickiness:1}}),o.push({range:e[s],options:{description:"auto-closed-enclosing",stickiness:1}});let n=this._model.deltaDecorations([],t),r=this._model.deltaDecorations([],o);this._autoClosedActions.push(new fxt(this._model,n,r))}_executeEditOperation(i,e){if(!i)return;i.shouldPushStackElementBefore&&this._model.pushStackElement();let t=FX.executeCommands(this._model,this._cursors.getSelections(),i.commands,e);if(t){this._interpretCommandResult(t);let o=[],n=[];for(let r=0;r<i.commands.length;r++){let s=i.commands[r];s instanceof aCe&&s.enclosingRange&&s.closeCharacterRange&&(o.push(s.closeCharacterRange),n.push(s.enclosingRange))}o.length>0&&this._pushAutoClosedAction(o,n),this._prevEditOperationType=i.type}i.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(i){(!i||i.length===0)&&(i=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(i),this._cursors.normalize()}_emitStateChangedIfNecessary(i,e,t,o,n){let r=O8e.from(this._model,this);if(r.equals(o))return!1;let s=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(i.emitViewEvent(new cIt(l,s,t)),!o||o.cursorState.length!==r.cursorState.length||r.cursorState.some((c,u)=>!c.modelState.equals(o.cursorState[u].modelState))){let c=o?o.cursorState.map(p=>p.modelState.selection):null,u=o?o.modelVersionId:0;i.emitOutgoingEvent(new sxt(c,s,u,r.modelVersionId,e||"keyboard",t,n))}return!0}_findAutoClosingPairs(i){if(!i.length)return null;let e=[];for(let t=0,o=i.length;t<o;t++){let n=i[t];if(!n.text||n.text.indexOf(`
`)>=0)return null;let r=n.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!r)return null;let s=r[1],l=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(s);if(!l||l.length!==1)return null;let c=l[0].open,u=n.text.length-r[2].length-1,p=n.text.lastIndexOf(c,u-1);if(p===-1)return null;e.push([p,u])}return e}executeEdits(i,e,t,o,n){let r=null;e==="snippet"&&(r=this._findAutoClosingPairs(t)),r&&(t[0]._isTracked=!0);let s=[],l=[],c=this._model.pushEditOperations(this.getSelections(),t,u=>{if(r)for(let h=0,g=r.length;h<g;h++){let[f,v]=r[h],b=u[h],S=b.range.startLineNumber,y=b.range.startColumn-1+f,w=b.range.startColumn-1+v;s.push(new G(S,w+1,S,w+2)),l.push(new G(S,y+1,S,w+2))}let p=o(u);return p&&(this._isHandling=!0),p},void 0,n);c&&(this._isHandling=!1,this.setSelections(i,e,c,0)),s.length>0&&this._pushAutoClosedAction(s,l)}_executeEdit(i,e,t,o=0){if(this.context.cursorConfig.readOnly)return;let n=O8e.from(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),i()}catch(r){mt(r)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,o,n,!1)&&this.revealAll(e,t,!1,0,!0,0)}getAutoClosedCharacters(){return fxt.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(i){this._compositionState=new zli(this._model,this.getSelections())}endComposition(i,e){let t=sd.cursor({kind:"compositionEnd",detailedSource:e}),o=this._compositionState?this._compositionState.deduceOutcome(this._model,this.getSelections()):null;this._compositionState=null,this._executeEdit(()=>{e==="keyboard"&&this._executeEditOperation(xA.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,o,this.getSelections(),this.getAutoClosedCharacters()),t)},i,e)}type(i,e,t){let o=sd.cursor({kind:"type",detailedSource:t});this._executeEdit(()=>{if(t==="keyboard"){let n=e.length,r=0;for(;r<n;){let s=uwe(e,r),l=e.substr(r,s);this._executeEditOperation(xA.typeWithInterceptors(!!this._compositionState,this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),this.getAutoClosedCharacters(),l),o),r+=s}}else this._executeEditOperation(xA.typeWithoutInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),e),o)},i,t)}compositionType(i,e,t,o,n,r){let s=sd.cursor({kind:"compositionType",detailedSource:r});if(e.length===0&&t===0&&o===0){if(n!==0){let l=this.getSelections().map(c=>{let u=c.getPosition();return new ei(u.lineNumber,u.column+n,u.lineNumber,u.column+n)});this.setSelections(i,r,l,0)}return}this._executeEdit(()=>{this._executeEditOperation(xA.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),e,t,o,n),s)},i,r)}paste(i,e,t,o,n){let r=sd.cursor({kind:"paste",detailedSource:n});this._executeEdit(()=>{this._executeEditOperation(xA.paste(this.context.cursorConfig,this._model,this.getSelections(),e,t,o||[]),r)},i,n,4)}cut(i,e){let t=sd.cursor({kind:"cut",detailedSource:e});this._executeEdit(()=>{this._executeEditOperation(bF.cut(this.context.cursorConfig,this._model,this.getSelections()),t)},i,e)}executeCommand(i,e,t){let o=sd.cursor({kind:"executeCommand",detailedSource:t});this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new Ob(0,[e],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),o)},i,t)}executeCommands(i,e,t){let o=sd.cursor({kind:"executeCommands",detailedSource:t});this._executeEdit(()=>{this._executeEditOperation(new Ob(0,e,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),o)},i,t)}},O8e=class a{constructor(i,e){this.modelVersionId=i;this.cursorState=e}static from(i,e){return new a(i.getVersionId(),e.getCursorStates())}equals(i){if(!i||this.modelVersionId!==i.modelVersionId||this.cursorState.length!==i.cursorState.length)return!1;for(let e=0,t=this.cursorState.length;e<t;e++)if(!this.cursorState[e].equals(i.cursorState[e]))return!1;return!0}},fxt=class{static getAllAutoClosedCharacters(i){let e=[];for(let t of i)e=e.concat(t.getAutoClosedCharactersRanges());return e}constructor(i,e,t){this._model=i,this._autoClosedCharactersDecorations=e,this._autoClosedEnclosingDecorations=t}dispose(){this._autoClosedCharactersDecorations=this._model.deltaDecorations(this._autoClosedCharactersDecorations,[]),this._autoClosedEnclosingDecorations=this._model.deltaDecorations(this._autoClosedEnclosingDecorations,[])}getAutoClosedCharactersRanges(){let i=[];for(let e=0;e<this._autoClosedCharactersDecorations.length;e++){let t=this._model.getDecorationRange(this._autoClosedCharactersDecorations[e]);t&&i.push(t)}return i}isValid(i){let e=[];for(let t=0;t<this._autoClosedEnclosingDecorations.length;t++){let o=this._model.getDecorationRange(this._autoClosedEnclosingDecorations[t]);if(o&&(e.push(o),o.startLineNumber!==o.endLineNumber))return!1}e.sort(G.compareRangesUsingStarts),i.sort(G.compareRangesUsingStarts);for(let t=0;t<i.length;t++)if(t>=e.length||!e[t].strictContainsRange(i[t]))return!1;return!0}},FX=class{static executeCommands(i,e,t,o=sd.unknown({name:"executeCommands"})){let n={model:i,selectionsBefore:e,trackedRanges:[],trackedRangesDirection:[]},r=this._innerExecuteCommands(n,t,o);for(let s=0,l=n.trackedRanges.length;s<l;s++)n.model._setTrackedRange(n.trackedRanges[s],null,0);return r}static _innerExecuteCommands(i,e,t){if(this._arrayIsEmpty(e))return null;let o=this._getEditOperations(i,e);if(o.operations.length===0)return null;let n=o.operations,r=this._getLoserCursorMap(n);if(r.hasOwnProperty("0"))return console.warn("Ignoring commands"),null;let s=[];for(let u=0,p=n.length;u<p;u++)r.hasOwnProperty(n[u].identifier.major.toString())||s.push(n[u]);o.hadTrackedEditOperation&&s.length>0&&(s[0]._isTracked=!0);let l=i.model.pushEditOperations(i.selectionsBefore,s,u=>{let p=[];for(let f=0;f<i.selectionsBefore.length;f++)p[f]=[];for(let f of u)f.identifier&&p[f.identifier.major].push(f);let h=(f,v)=>f.identifier.minor-v.identifier.minor,g=[];for(let f=0;f<i.selectionsBefore.length;f++)p[f].length>0?(p[f].sort(h),g[f]=e[f].computeCursorState(i.model,{getInverseEditOperations:()=>p[f],getTrackedSelection:v=>{let b=parseInt(v,10),S=i.model._getTrackedRange(i.trackedRanges[b]);return i.trackedRangesDirection[b]===0?new ei(S.startLineNumber,S.startColumn,S.endLineNumber,S.endColumn):new ei(S.endLineNumber,S.endColumn,S.startLineNumber,S.startColumn)}})):g[f]=i.selectionsBefore[f];return g},void 0,t);l||(l=i.selectionsBefore);let c=[];for(let u in r)r.hasOwnProperty(u)&&c.push(parseInt(u,10));c.sort((u,p)=>p-u);for(let u of c)l.splice(u,1);return l}static _arrayIsEmpty(i){for(let e=0,t=i.length;e<t;e++)if(i[e])return!1;return!0}static _getEditOperations(i,e){let t=[],o=!1;for(let n=0,r=e.length;n<r;n++){let s=e[n];if(s){let l=this._getEditOperationsFromCommand(i,n,s);t=t.concat(l.operations),o=o||l.hadTrackedEditOperation}}return{operations:t,hadTrackedEditOperation:o}}static _getEditOperationsFromCommand(i,e,t){let o=[],n=0,r=(p,h,g=!1)=>{G.isEmpty(p)&&h===""||o.push({identifier:{major:e,minor:n++},range:p,text:h,forceMoveMarkers:g,isAutoWhitespaceEdit:t.insertsAutoWhitespace})},s=!1,u={addEditOperation:r,addTrackedEditOperation:(p,h,g)=>{s=!0,r(p,h,g)},trackSelection:(p,h)=>{let g=ei.liftSelection(p),f;if(g.isEmpty())if(typeof h=="boolean")h?f=2:f=3;else{let S=i.model.getLineMaxColumn(g.startLineNumber);g.startColumn===S?f=2:f=3}else f=1;let v=i.trackedRanges.length,b=i.model._setTrackedRange(null,g,f);return i.trackedRanges[v]=b,i.trackedRangesDirection[v]=g.getDirection(),v.toString()}};try{t.getEditOperations(i.model,u)}catch(p){return mt(p),{operations:[],hadTrackedEditOperation:!1}}return{operations:o,hadTrackedEditOperation:s}}static _getLoserCursorMap(i){i=i.slice(0),i.sort((t,o)=>-G.compareRangesUsingEnds(t.range,o.range));let e={};for(let t=1;t<i.length;t++){let o=i[t-1],n=i[t];if(G.getStartPosition(o.range).isBefore(G.getEndPosition(n.range))){let r;o.identifier.major>n.identifier.major?r=o.identifier.major:r=n.identifier.major,e[r.toString()]=!0;for(let s=0;s<i.length;s++)i[s].identifier.major===r&&(i.splice(s,1),s<t&&t--,s--);t>0&&t--}}return e}},Uli=class{constructor(i,e,t,o){this.text=i;this.lineNumber=e;this.startSelectionOffset=t;this.endSelectionOffset=o}},zli=class a{static _capture(i,e){let t=[];for(let o of e){if(o.startLineNumber!==o.endLineNumber)return null;let n=o.startLineNumber;t.push(new Uli(i.getLineContent(n),n,o.startColumn-1,o.endColumn-1))}return t}constructor(i,e){this._original=a._capture(i,e)}deduceOutcome(i,e){if(!this._original)return null;let t=a._capture(i,e);if(!t||this._original.length!==t.length)return null;let o=[];for(let n=0,r=this._original.length;n<r;n++)o.push(a._deduceOutcome(this._original[n],t[n]));return o}static _deduceOutcome(i,e){let t=Math.min(i.startSelectionOffset,e.startSelectionOffset,Af(i.text,e.text)),o=Math.min(i.text.length-i.endSelectionOffset,e.text.length-e.endSelectionOffset,lx(i.text,e.text)),n=i.text.substring(t,i.text.length-o),r=t,s=e.text.length-o,l=e.text.substring(r,s),c=new G(e.lineNumber,r+1,e.lineNumber,s+1);return new rIt(n,i.startSelectionOffset-t,i.endSelectionOffset-t,l,e.startSelectionOffset-t,e.endSelectionOffset-t,c)}};var Kli={getInitialState:()=>Tli,tokenizeEncoded:(a,i,e)=>ike(0,e)};function vxt(a,i,e){return Gli(i,a.languageIdCodec,vc.get(e)||Kli)}async function EK(a,i,e){if(!e)return Gli(i,a.languageIdCodec,Kli);let t=await vc.getOrCreate(e);return Gli(i,a.languageIdCodec,t||Kli)}function bxt(a,i,e,t,o,n,r){let s="<div>",l=0,c=0,u=!0;for(let p=0,h=i.getCount();p<h;p++){let g=i.getEndOffset(p),f="";for(;l<g&&l<o;l++){let v=a.charCodeAt(l),b=v===9;if(c+=sD(v)?2:b?0:1,l<t){if(b){let S=c%n;c+=S===0?n:n-S}continue}switch(v){case 9:{let S=c%n,y=S===0?n:n-S;c+=y;let w=y;for(;w>0;)r&&u?(f+="&#160;",u=!1):(f+=" ",u=!0),w--;break}case 60:f+="&lt;",u=!1;break;case 62:f+="&gt;",u=!1;break;case 38:f+="&amp;",u=!1;break;case 0:f+="&#00;",u=!1;break;case 65279:case 8232:case 8233:case 133:f+="\uFFFD",u=!1;break;case 13:f+="&#8203",u=!1;break;case 32:r&&u?(f+="&#160;",u=!1):(f+=" ",u=!0);break;default:f+=String.fromCharCode(v),u=!1}}if(!(g<=t)&&(s+=`<span style="${i.getInlineStyle(p,e)}">${f}</span>`,g>o||l>=o||t>=o))break}return s+="</div>",s}function Gli(a,i,e){let t='<div class="monaco-tokenized-source">',o=Hc(a),n=e.getInitialState();for(let r=0,s=o.length;r<s;r++){let l=o[r];r>0&&(t+="<br/>");let c=e.tokenizeEncoded(l,!0,n);Cd.convertToEndOffset(c.tokens,l.length);let p=new Cd(c.tokens,l,i).inflate(),h=0;for(let g=0,f=p.getCount();g<f;g++){let v=p.getClassName(g),b=p.getEndOffset(g);t+=`<span class="${v}">${Cr(l.substring(h,b))}</span>`,h=b}n=c.endState}return t+="</div>",t}var qli=class{constructor(i,e,t,o,n){this.decorationId=i,this.index=e,this.lineNumber=t,this.specialHeight=o,this.prefixSum=n,this.maximumSpecialHeight=o,this.deleted=!1}},F8e=class{constructor(i,e){this._decorationIDToCustomLine=new ake;this._orderedCustomLines=[];this._pendingChanges=[];this._invalidIndex=1/0;this._hasPending=!1;this._defaultLineHeight=i;for(let t of e)this.insertOrChangeCustomLineHeight(t.decorationId,t.startLineNumber,t.endLineNumber,t.lineHeight)}set defaultLineHeight(i){this._defaultLineHeight=i}get defaultLineHeight(){return this._defaultLineHeight}removeCustomLineHeight(i){this._pendingChanges.push({kind:1,decorationId:i}),this._hasPending=!0}insertOrChangeCustomLineHeight(i,e,t,o){this._pendingChanges.push({kind:0,decorationId:i,startLineNumber:e,endLineNumber:t,lineHeight:o}),this._hasPending=!0}heightForLineNumber(i){this._commit();let e=this._binarySearchOverOrderedCustomLinesArray(i);return e>=0?this._orderedCustomLines[e].maximumSpecialHeight:this._defaultLineHeight}getAccumulatedLineHeightsIncludingLineNumber(i){this._commit();let e=this._binarySearchOverOrderedCustomLinesArray(i);if(e>=0)return this._orderedCustomLines[e].prefixSum+this._orderedCustomLines[e].maximumSpecialHeight;if(e===-1)return this._defaultLineHeight*i;let t=-(e+1),o=this._orderedCustomLines[t-1];return o.prefixSum+o.maximumSpecialHeight+this._defaultLineHeight*(i-o.lineNumber)}onLinesDeleted(i,e){this._pendingChanges.push({kind:2,fromLineNumber:i,toLineNumber:e}),this._hasPending=!0}onLinesInserted(i,e){this._pendingChanges.push({kind:3,fromLineNumber:i,toLineNumber:e}),this._hasPending=!0}_commit(){if(!this._hasPending)return;let i=this._pendingChanges;this._pendingChanges=[],this._hasPending=!1;let e=[],t=new ake;for(let o of i)switch(o.kind){case 1:this._doRemoveCustomLineHeight(o.decorationId,t);break;case 0:this._doInsertOrChangeCustomLineHeight(o.decorationId,o.startLineNumber,o.endLineNumber,o.lineHeight,e,t);break;case 2:this._flushStagedDecorationChanges(e,t),this._doLinesDeleted(o.fromLineNumber,o.toLineNumber);break;case 3:this._flushStagedDecorationChanges(e,t),this._doLinesInserted(o.fromLineNumber,o.toLineNumber,e,t);break}this._flushStagedDecorationChanges(e,t)}_doRemoveCustomLineHeight(i,e){let t=this._decorationIDToCustomLine.get(i);if(t){this._decorationIDToCustomLine.delete(i);for(let n of t)n.deleted=!0,this._invalidIndex=Math.min(this._invalidIndex,n.index)}let o=e.get(i);if(o){e.delete(i);for(let n of o)n.deleted=!0}}_doInsertOrChangeCustomLineHeight(i,e,t,o,n,r){this._doRemoveCustomLineHeight(i,r);for(let s=e;s<=t;s++){let l=new qli(i,-1,s,o,0);n.push(l),r.add(i,l)}}_flushStagedDecorationChanges(i,e){if(i.length===0&&this._invalidIndex===1/0)return;for(let s of i){if(s.deleted)continue;let l=this._binarySearchOverOrderedCustomLinesArray(s.lineNumber),c=l>=0?l:-(l+1);this._orderedCustomLines.splice(c,0,s),this._invalidIndex=Math.min(this._invalidIndex,c)}if(i.length=0,e.clear(),this._invalidIndex===1/0)return;let t=new ake,o=[];for(let s=0;s<this._invalidIndex;s++){let l=this._orderedCustomLines[s];o.push(l),t.add(l.decorationId,l)}let n=0,r=this._invalidIndex>0?o[this._invalidIndex-1]:void 0;for(let s=this._invalidIndex;s<this._orderedCustomLines.length;s++){let l=this._orderedCustomLines[s];if(l.deleted){n++;continue}if(l.index=s-n,r&&r.lineNumber===l.lineNumber)l.maximumSpecialHeight=r.maximumSpecialHeight,l.prefixSum=r.prefixSum;else{let c=l.specialHeight;for(let p=s;p<this._orderedCustomLines.length;p++){let h=this._orderedCustomLines[p];if(!h.deleted){if(h.lineNumber!==l.lineNumber)break;c=Math.max(c,h.specialHeight)}}l.maximumSpecialHeight=c;let u;r?u=r.prefixSum+r.maximumSpecialHeight+this._defaultLineHeight*(l.lineNumber-r.lineNumber-1):u=this._defaultLineHeight*(l.lineNumber-1),l.prefixSum=u}r=l,o.push(l),t.add(l.decorationId,l)}this._orderedCustomLines=o,this._decorationIDToCustomLine=t,this._invalidIndex=1/0}_doLinesDeleted(i,e){let t=e-i+1,o=this._orderedCustomLines.length,n=this._binarySearchOverOrderedCustomLinesArray(i),r;if(n>=0){r=n;for(let p=n-1;p>=0&&this._orderedCustomLines[p].lineNumber===i;p--)r--}else r=n===-(o+1)&&n!==-1?o-1:-(n+1);let s=this._binarySearchOverOrderedCustomLinesArray(e),l;if(s>=0){l=s;for(let p=s+1;p<o&&this._orderedCustomLines[p].lineNumber===e;p++)l++}else l=s===-(o+1)&&s!==-1?o-1:-(s+1);let c=l>r,u=l===r&&this._orderedCustomLines[r]&&this._orderedCustomLines[r].lineNumber>=i&&this._orderedCustomLines[r].lineNumber<=e;if(c||u){let p=0;for(let M=r;M<=l;M++)p=Math.max(p,this._orderedCustomLines[M].maximumSpecialHeight);let h=0;if(r>0){let M=this._orderedCustomLines[r-1];h=M.prefixSum+M.maximumSpecialHeight+this._defaultLineHeight*(i-M.lineNumber-1)}else h=i>0?(i-1)*this._defaultLineHeight:0;let g=this._orderedCustomLines[r],f=this._orderedCustomLines[l],v=this._orderedCustomLines[l+1],b=v&&v.lineNumber===e+1?v.maximumSpecialHeight:this._defaultLineHeight,S=f.prefixSum+f.maximumSpecialHeight-g.prefixSum+this._defaultLineHeight*(e-f.lineNumber)+this._defaultLineHeight*(g.lineNumber-i)+b-p,y=new Set,w=[],x=new ake,E=0;for(let M=0;M<this._orderedCustomLines.length;M++){let N=this._orderedCustomLines[M];if(M<r)w.push(N),x.add(N.decorationId,N);else if(M>=r&&M<=l){let V=N.decorationId;y.has(V)?E++:(N.index-=E,N.lineNumber=i,N.prefixSum=h,N.maximumSpecialHeight=p,w.push(N),x.add(N.decorationId,N))}else M>l&&(N.index-=E,N.lineNumber-=t,N.prefixSum-=S,w.push(N),x.add(N.decorationId,N));y.add(N.decorationId)}this._orderedCustomLines=w,this._decorationIDToCustomLine=x}else{let p=t*this._defaultLineHeight;for(let h=l;h<this._orderedCustomLines.length;h++){let g=this._orderedCustomLines[h];g.lineNumber>e&&(g.lineNumber-=t,g.prefixSum-=p)}}}_doLinesInserted(i,e,t,o){let n=e-i+1,r=this._binarySearchOverOrderedCustomLinesArray(i),s;if(r>=0){s=r;for(let g=r-1;g>=0&&this._orderedCustomLines[g].lineNumber===i;g--)s--}else s=-(r+1);let l=[],c=new Set;for(let g=s;g<this._orderedCustomLines.length;g++)this._orderedCustomLines[g].lineNumber===i&&c.add(this._orderedCustomLines[g].decorationId);let u=new Set;for(let g=s-1;g>=0;g--)this._orderedCustomLines[g].lineNumber===i-1&&u.add(this._orderedCustomLines[g].decorationId);let p=uvt(u,c),h=n*this._defaultLineHeight;for(let g=s;g<this._orderedCustomLines.length;g++)this._orderedCustomLines[g].lineNumber+=n,this._orderedCustomLines[g].prefixSum+=h;if(p.size>0){for(let g of p){let f=this._decorationIDToCustomLine.get(g);if(f){let v=f.reduce((y,w)=>Math.min(y,w.lineNumber),i),b=f.reduce((y,w)=>Math.max(y,w.lineNumber),i),S=f.reduce((y,w)=>Math.max(y,w.specialHeight),0);l.push({decorationId:g,startLineNumber:v,endLineNumber:b,lineHeight:S})}}for(let g of l)this._doInsertOrChangeCustomLineHeight(g.decorationId,g.startLineNumber,g.endLineNumber,g.lineHeight,t,o)}}_binarySearchOverOrderedCustomLinesArray(i){return cA(this._orderedCustomLines.length,e=>{let t=this._orderedCustomLines[e];return t.lineNumber===i?0:t.lineNumber<i?-1:1})}},W8e=class a{constructor(i,e,t,o){this.decorationId=i;this.startLineNumber=e;this.endLineNumber=t;this.lineHeight=o}static fromDecorations(i,e,t){let o=t.options.get(75);return i.map(n=>{let r=e.convertModelRangeToViewRange(n.range);return new a(n.id,r.startLineNumber,r.endLineNumber,n.options.lineHeight?n.options.lineHeight*o:0)})}},ake=class{constructor(){this._map=new Map}add(i,e){let t=this._map.get(i);t?t.push(e):this._map.set(i,[e])}get(i){return this._map.get(i)}delete(i){this._map.delete(i)}clear(){this._map.clear()}};var $li=class{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(i){this._hasPending=!0,this._inserts.push(i)}change(i){this._hasPending=!0,this._changes.push(i)}remove(i){this._hasPending=!0,this._removes.push(i)}commit(i){if(!this._hasPending)return;let e=this._inserts,t=this._changes,o=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],i._commitPendingChanges(e,t,o)}},jli=class{constructor(i,e,t,o,n){this.id=i,this.afterLineNumber=e,this.ordinal=t,this.height=o,this.minWidth=n,this.prefixSum=0}},Sxt=class a{static{this.INSTANCE_COUNT=0}constructor(i,e,t,o,n){this._instanceId=pwe(++a.INSTANCE_COUNT),this._pendingChanges=new $li,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=i,this._paddingTop=t,this._paddingBottom=o,this._lineHeightsManager=new F8e(e,n)}static findInsertionIndex(i,e,t){let o=0,n=i.length;for(;o<n;){let r=o+n>>>1;e===i[r].afterLineNumber?t<i[r].ordinal?n=r:o=r+1:e<i[r].afterLineNumber?n=r:o=r+1}return o}setDefaultLineHeight(i){this._lineHeightsManager.defaultLineHeight=i}setPadding(i,e){this._paddingTop=i,this._paddingBottom=e}onFlushed(i,e){this._lineCount=i,this._lineHeightsManager=new F8e(this._lineHeightsManager.defaultLineHeight,e)}changeLineHeights(i){let e=!1;return i({insertOrChangeCustomLineHeight:(o,n,r,s)=>{e=!0,this._lineHeightsManager.insertOrChangeCustomLineHeight(o,n,r,s)},removeCustomLineHeight:o=>{e=!0,this._lineHeightsManager.removeCustomLineHeight(o)}}),e}changeWhitespace(i){let e=!1;try{i({insertWhitespace:(o,n,r,s)=>{e=!0,o=o|0,n=n|0,r=r|0,s=s|0;let l=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new jli(l,o,n,r,s)),l},changeOneWhitespace:(o,n,r)=>{e=!0,n=n|0,r=r|0,this._pendingChanges.change({id:o,newAfterLineNumber:n,newHeight:r})},removeWhitespace:o=>{e=!0,this._pendingChanges.remove({id:o})}})}finally{this._pendingChanges.commit(this)}return e}_commitPendingChanges(i,e,t){if((i.length>0||t.length>0)&&(this._minWidth=-1),i.length+e.length+t.length<=1){for(let l of i)this._insertWhitespace(l);for(let l of e)this._changeOneWhitespace(l.id,l.newAfterLineNumber,l.newHeight);for(let l of t){let c=this._findWhitespaceIndex(l.id);c!==-1&&this._removeWhitespace(c)}return}let o=new Set;for(let l of t)o.add(l.id);let n=new Map;for(let l of e)n.set(l.id,l);let r=l=>{let c=[];for(let u of l)if(!o.has(u.id)){if(n.has(u.id)){let p=n.get(u.id);u.afterLineNumber=p.newAfterLineNumber,u.height=p.newHeight}c.push(u)}return c},s=r(this._arr).concat(r(i));s.sort((l,c)=>l.afterLineNumber===c.afterLineNumber?l.ordinal-c.ordinal:l.afterLineNumber-c.afterLineNumber),this._arr=s,this._prefixSumValidIndex=-1}_insertWhitespace(i){let e=a.findInsertionIndex(this._arr,i.afterLineNumber,i.ordinal);this._arr.splice(e,0,i),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,e-1)}_findWhitespaceIndex(i){let e=this._arr;for(let t=0,o=e.length;t<o;t++)if(e[t].id===i)return t;return-1}_changeOneWhitespace(i,e,t){let o=this._findWhitespaceIndex(i);if(o!==-1&&(this._arr[o].height!==t&&(this._arr[o].height=t,this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,o-1)),this._arr[o].afterLineNumber!==e)){let n=this._arr[o];this._removeWhitespace(o),n.afterLineNumber=e,this._insertWhitespace(n)}}_removeWhitespace(i){this._arr.splice(i,1),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,i-1)}onLinesDeleted(i,e){i=i|0,e=e|0,this._lineCount-=e-i+1;for(let t=0,o=this._arr.length;t<o;t++){let n=this._arr[t].afterLineNumber;i<=n&&n<=e?this._arr[t].afterLineNumber=i-1:n>e&&(this._arr[t].afterLineNumber-=e-i+1)}this._lineHeightsManager.onLinesDeleted(i,e)}onLinesInserted(i,e){i=i|0,e=e|0,this._lineCount+=e-i+1;for(let t=0,o=this._arr.length;t<o;t++){let n=this._arr[t].afterLineNumber;i<=n&&(this._arr[t].afterLineNumber+=e-i+1)}this._lineHeightsManager.onLinesInserted(i,e)}getWhitespacesTotalHeight(){return this._arr.length===0?0:this.getWhitespacesAccumulatedHeight(this._arr.length-1)}getWhitespacesAccumulatedHeight(i){i=i|0;let e=Math.max(0,this._prefixSumValidIndex+1);e===0&&(this._arr[0].prefixSum=this._arr[0].height,e++);for(let t=e;t<=i;t++)this._arr[t].prefixSum=this._arr[t-1].prefixSum+this._arr[t].height;return this._prefixSumValidIndex=Math.max(this._prefixSumValidIndex,i),this._arr[i].prefixSum}getLinesTotalHeight(){let i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(this._lineCount),e=this.getWhitespacesTotalHeight();return i+e+this._paddingTop+this._paddingBottom}getWhitespaceAccumulatedHeightBeforeLineNumber(i){i=i|0;let e=this._findLastWhitespaceBeforeLineNumber(i);return e===-1?0:this.getWhitespacesAccumulatedHeight(e)}_findLastWhitespaceBeforeLineNumber(i){i=i|0;let e=this._arr,t=0,o=e.length-1;for(;t<=o;){let r=(o-t|0)/2|0,s=t+r|0;if(e[s].afterLineNumber<i){if(s+1>=e.length||e[s+1].afterLineNumber>=i)return s;t=s+1|0}else o=s-1|0}return-1}_findFirstWhitespaceAfterLineNumber(i){i=i|0;let t=this._findLastWhitespaceBeforeLineNumber(i)+1;return t<this._arr.length?t:-1}getFirstWhitespaceIndexAfterLineNumber(i){return i=i|0,this._findFirstWhitespaceAfterLineNumber(i)}getVerticalOffsetForLineNumber(i,e=!1){i=i|0;let t;i>1?t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(i-1):t=0;let o=this.getWhitespaceAccumulatedHeightBeforeLineNumber(i-(e?1:0));return t+o+this._paddingTop}getLineHeightForLineNumber(i){return this._lineHeightsManager.heightForLineNumber(i)}getVerticalOffsetAfterLineNumber(i,e=!1){i=i|0;let t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(i),o=this.getWhitespaceAccumulatedHeightBeforeLineNumber(i+(e?1:0));return t+o+this._paddingTop}hasWhitespace(){return this.getWhitespacesCount()>0}getWhitespaceMinWidth(){if(this._minWidth===-1){let i=0;for(let e=0,t=this._arr.length;e<t;e++)i=Math.max(i,this._arr[e].minWidth);this._minWidth=i}return this._minWidth}isAfterLines(i){let e=this.getLinesTotalHeight();return i>e}isInTopPadding(i){return this._paddingTop===0?!1:i<this._paddingTop}isInBottomPadding(i){if(this._paddingBottom===0)return!1;let e=this.getLinesTotalHeight();return i>=e-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(i){if(i=i|0,i<0)return 1;let e=this._lineCount|0,t=1,o=e;for(;t<o;){let n=(t+o)/2|0,r=this.getLineHeightForLineNumber(n),s=this.getVerticalOffsetForLineNumber(n)|0;if(i>=s+r)t=n+1;else{if(i>=s)return n;o=n}}return t>e?e:t}getLinesViewportData(i,e){i=i|0,e=e|0;let t=this.getLineNumberAtOrAfterVerticalOffset(i)|0,o=this.getVerticalOffsetForLineNumber(t)|0,n=this._lineCount|0,r=this.getFirstWhitespaceIndexAfterLineNumber(t)|0,s=this.getWhitespacesCount()|0,l,c;r===-1?(r=s,c=n+1,l=0):(c=this.getAfterLineNumberForWhitespaceIndex(r)|0,l=this.getHeightForWhitespaceIndex(r)|0);let u=o,p=u,h=5e5,g=0;o>=h&&(g=Math.floor(o/h)*h,g=Math.floor(g/this._lineHeightsManager.defaultLineHeight)*this._lineHeightsManager.defaultLineHeight,p-=g);let f=[],v=i+(e-i)/2,b=-1;for(let x=t;x<=n;x++){let E=this.getLineHeightForLineNumber(x);if(b===-1){let M=u,N=u+E;(M<=v&&v<N||M>v)&&(b=x)}for(u+=E,f[x-t]=p,p+=E;c===x;)p+=l,u+=l,r++,r>=s?c=n+1:(c=this.getAfterLineNumberForWhitespaceIndex(r)|0,l=this.getHeightForWhitespaceIndex(r)|0);if(u>=e){n=x;break}}b===-1&&(b=n);let S=this.getVerticalOffsetForLineNumber(n)|0,y=t,w=n;if(y<w&&o<i&&y++,y<w){let x=this.getLineHeightForLineNumber(n);S+x>e&&w--}return{bigNumbersDelta:g,startLineNumber:t,endLineNumber:n,relativeVerticalOffset:f,centeredLineNumber:b,completelyVisibleStartLineNumber:y,completelyVisibleEndLineNumber:w,lineHeight:this._lineHeightsManager.defaultLineHeight}}getVerticalOffsetForWhitespaceIndex(i){i=i|0;let e=this.getAfterLineNumberForWhitespaceIndex(i),t;e>=1?t=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(e):t=0;let o;return i>0?o=this.getWhitespacesAccumulatedHeight(i-1):o=0,t+o+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(i){i=i|0;let e=0,t=this.getWhitespacesCount()-1;if(t<0)return-1;let o=this.getVerticalOffsetForWhitespaceIndex(t),n=this.getHeightForWhitespaceIndex(t);if(i>=o+n)return-1;for(;e<t;){let r=Math.floor((e+t)/2),s=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(i>=s+l)e=r+1;else{if(i>=s)return r;t=r}}return e}getWhitespaceAtVerticalOffset(i){i=i|0;let e=this.getWhitespaceIndexAtOrAfterVerticallOffset(i);if(e<0||e>=this.getWhitespacesCount())return null;let t=this.getVerticalOffsetForWhitespaceIndex(e);if(t>i)return null;let o=this.getHeightForWhitespaceIndex(e),n=this.getIdForWhitespaceIndex(e),r=this.getAfterLineNumberForWhitespaceIndex(e);return{id:n,afterLineNumber:r,verticalOffset:t,height:o}}getWhitespaceViewportData(i,e){i=i|0,e=e|0;let t=this.getWhitespaceIndexAtOrAfterVerticallOffset(i),o=this.getWhitespacesCount()-1;if(t<0)return[];let n=[];for(let r=t;r<=o;r++){let s=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(s>=e)break;n.push({id:this.getIdForWhitespaceIndex(r),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(r),verticalOffset:s,height:l})}return n}getWhitespaces(){return this._arr.slice(0)}getWhitespacesCount(){return this._arr.length}getIdForWhitespaceIndex(i){return i=i|0,this._arr[i].id}getAfterLineNumberForWhitespaceIndex(i){return i=i|0,this._arr[i].afterLineNumber}getHeightForWhitespaceIndex(i){return i=i|0,this._arr[i].height}};var Yqo=125,gde=class{constructor(i,e,t,o){i=i|0,e=e|0,t=t|0,o=o|0,i<0&&(i=0),e<0&&(e=0),t<0&&(t=0),o<0&&(o=0),this.width=i,this.contentWidth=e,this.scrollWidth=Math.max(i,e),this.height=t,this.contentHeight=o,this.scrollHeight=Math.max(t,o)}equals(i){return this.width===i.width&&this.contentWidth===i.contentWidth&&this.height===i.height&&this.contentHeight===i.contentHeight}},Qli=class extends k{constructor(e,t){super();this._onDidContentSizeChange=this._register(new T);this.onDidContentSizeChange=this._onDidContentSizeChange.event;this._dimensions=new gde(0,0,0,0),this._scrollable=this._register(new hD({forceIntegerValues:!0,smoothScrollDuration:e,scheduleAtNextAnimationFrame:t})),this.onDidScroll=this._scrollable.onScroll}getScrollable(){return this._scrollable}setSmoothScrollDuration(e){this._scrollable.setSmoothScrollDuration(e)}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}getScrollDimensions(){return this._dimensions}setScrollDimensions(e){if(this._dimensions.equals(e))return;let t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);let o=t.contentWidth!==e.contentWidth,n=t.contentHeight!==e.contentHeight;(o||n)&&this._onDidContentSizeChange.fire(new txt(t.contentWidth,t.contentHeight,e.contentWidth,e.contentHeight))}getFutureScrollPosition(){return this._scrollable.getFutureScrollPosition()}getCurrentScrollPosition(){return this._scrollable.getCurrentScrollPosition()}setScrollPositionNow(e){this._scrollable.setScrollPositionNow(e)}setScrollPositionSmooth(e){this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}},Ixt=class extends k{constructor(i,e,t,o){super(),this._configuration=i;let n=this._configuration.options,r=n.get(165),s=n.get(96);this._linesLayout=new Sxt(e,n.get(75),s.top,s.bottom,t),this._maxLineWidth=0,this._overlayWidgetsMinWidth=0,this._scrollable=this._register(new Qli(0,o)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new gde(r.contentWidth,0,r.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(130)?Yqo:0)}onConfigurationChanged(i){let e=this._configuration.options;if(i.hasChanged(75)&&this._linesLayout.setDefaultLineHeight(e.get(75)),i.hasChanged(96)){let t=e.get(96);this._linesLayout.setPadding(t.top,t.bottom)}if(i.hasChanged(165)){let t=e.get(165),o=t.contentWidth,n=t.height,r=this._scrollable.getScrollDimensions(),s=r.contentWidth;this._scrollable.setScrollDimensions(new gde(o,r.contentWidth,n,this._getContentHeight(o,n,s)))}else this._updateHeight();i.hasChanged(130)&&this._configureSmoothScrollDuration()}onFlushed(i,e){this._linesLayout.onFlushed(i,e)}onLinesDeleted(i,e){this._linesLayout.onLinesDeleted(i,e)}onLinesInserted(i,e){this._linesLayout.onLinesInserted(i,e)}_getHorizontalScrollbarHeight(i,e){let o=this._configuration.options.get(117);return o.horizontal===2||i>=e?0:o.horizontalScrollbarSize}_getContentHeight(i,e,t){let o=this._configuration.options,n=this._linesLayout.getLinesTotalHeight();return o.get(119)?n+=Math.max(0,e-o.get(75)-o.get(96).bottom):o.get(117).ignoreHorizontalScrollbarInContentHeight||(n+=this._getHorizontalScrollbarHeight(i,t)),n}_updateHeight(){let i=this._scrollable.getScrollDimensions(),e=i.width,t=i.height,o=i.contentWidth;this._scrollable.setScrollDimensions(new gde(e,i.contentWidth,t,this._getContentHeight(e,t,o)))}getCurrentViewport(){let i=this._scrollable.getScrollDimensions(),e=this._scrollable.getCurrentScrollPosition();return new Z3e(e.scrollTop,e.scrollLeft,i.width,i.height)}getFutureViewport(){let i=this._scrollable.getScrollDimensions(),e=this._scrollable.getFutureScrollPosition();return new Z3e(e.scrollTop,e.scrollLeft,i.width,i.height)}_computeContentWidth(){let i=this._configuration.options,e=this._maxLineWidth,t=i.get(166),o=i.get(59),n=i.get(165);if(t.isViewportWrapping){let r=i.get(81);return e>n.contentWidth+o.typicalHalfwidthCharacterWidth&&r.enabled&&r.side==="right"?e+n.verticalScrollbarWidth:e}else{let r=i.get(118)*o.typicalHalfwidthCharacterWidth,s=this._linesLayout.getWhitespaceMinWidth();return Math.max(e+r+n.verticalScrollbarWidth,s,this._overlayWidgetsMinWidth)}}setMaxLineWidth(i){this._maxLineWidth=i,this._updateContentWidth()}setOverlayWidgetsMinWidth(i){this._overlayWidgetsMinWidth=i,this._updateContentWidth()}_updateContentWidth(){let i=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new gde(i.width,this._computeContentWidth(),i.height,i.contentHeight)),this._updateHeight()}saveState(){let i=this._scrollable.getFutureScrollPosition(),e=i.scrollTop,t=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(e),o=this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(t);return{scrollTop:e,scrollTopWithoutViewZones:e-o,scrollLeft:i.scrollLeft}}changeWhitespace(i){let e=this._linesLayout.changeWhitespace(i);return e&&this.onHeightMaybeChanged(),e}changeSpecialLineHeights(i){let e=this._linesLayout.changeLineHeights(i);return e&&this.onHeightMaybeChanged(),e}getVerticalOffsetForLineNumber(i,e=!1){return this._linesLayout.getVerticalOffsetForLineNumber(i,e)}getVerticalOffsetAfterLineNumber(i,e=!1){return this._linesLayout.getVerticalOffsetAfterLineNumber(i,e)}getLineHeightForLineNumber(i){return this._linesLayout.getLineHeightForLineNumber(i)}isAfterLines(i){return this._linesLayout.isAfterLines(i)}isInTopPadding(i){return this._linesLayout.isInTopPadding(i)}isInBottomPadding(i){return this._linesLayout.isInBottomPadding(i)}getLineNumberAtVerticalOffset(i){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(i)}getWhitespaceAtVerticalOffset(i){return this._linesLayout.getWhitespaceAtVerticalOffset(i)}getLinesViewportData(){let i=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(i.top,i.top+i.height)}getLinesViewportDataAtScrollTop(i){let e=this._scrollable.getScrollDimensions();return i+e.height>e.scrollHeight&&(i=e.scrollHeight-e.height),i<0&&(i=0),this._linesLayout.getLinesViewportData(i,i+e.height)}getWhitespaceViewportData(){let i=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(i.top,i.top+i.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(i){return this._scrollable.validateScrollPosition(i)}setScrollPosition(i,e){e===1?this._scrollable.setScrollPositionNow(i):this._scrollable.setScrollPositionSmooth(i)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}deltaScrollNow(i,e){let t=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:t.scrollLeft+i,scrollTop:t.scrollTop+e})}};var yxt=class{constructor(i,e,t,o,n){this.editorId=i,this.configuration=t,this._linesCollection=o;let r={getModelDecorations:(s,l,c)=>this._linesCollection.getDecorationsInRange(s,this.editorId,ace(this.configuration.options),lce(this.configuration.options),l,c)};this._inlineDecorationsComputer=new byt(r,e,n),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._inlineDecorationsComputer.reset(),this._clearCachedModelDecorationsResolver()}reset(){this._inlineDecorationsComputer.reset(),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._inlineDecorationsComputer.onModelDecorationsChanged(),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._inlineDecorationsComputer.onLineMappingChanged(),this._clearCachedModelDecorationsResolver()}getMinimapDecorationsInRange(i){return this._inlineDecorationsComputer.getDecorations(i,!0,!1).decorations}getDecorationsViewportData(i){let e=this._cachedModelDecorationsResolver!==null;return e=e&&i.equalsRange(this._cachedModelDecorationsResolverViewRange),e||(this._cachedModelDecorationsResolver=this._inlineDecorationsComputer.getDecorations(i,!1,!1),this._cachedModelDecorationsResolverViewRange=i),this._cachedModelDecorationsResolver}getDecorationsOnLine(i,e=!1,t=!1){let o=new G(i,this._linesCollection.getViewLineMinColumn(i),i,this._linesCollection.getViewLineMaxColumn(i));return this._inlineDecorationsComputer.getDecorations(o,e,t)}};function xxt(a,i){return a===null?i?wxt.INSTANCE:Cxt.INSTANCE:new Xli(a,i)}var Xli=class{constructor(i,e){this._projectionData=i,this._isVisible=e}isVisible(){return this._isVisible}setVisible(i){return this._isVisible=i,this}getProjectionData(){return this._projectionData}getViewLineCount(){return this._isVisible?this._projectionData.getOutputLineCount():0}getViewLineContent(i,e,t){this._assertVisible();let o=t>0?this._projectionData.breakOffsets[t-1]:0,n=this._projectionData.breakOffsets[t],r;if(this._projectionData.injectionOffsets!==null){let s=this._projectionData.injectionOffsets.map((c,u)=>new BF(0,0,c+1,this._projectionData.injectionOptions[u],0));r=BF.applyInjectedText(i.getLineContent(e),s).substring(o,n)}else r=i.getValueInRange({startLineNumber:e,startColumn:o+1,endLineNumber:e,endColumn:n+1});return t>0&&(r=hJi(this._projectionData.wrappedTextIndentLength)+r),r}getViewLineLength(i,e,t){return this._assertVisible(),this._projectionData.getLineLength(t)}getViewLineMinColumn(i,e,t){return this._assertVisible(),this._projectionData.getMinOutputOffset(t)+1}getViewLineMaxColumn(i,e,t){return this._assertVisible(),this._projectionData.getMaxOutputOffset(t)+1}getViewLineData(i,e,t,o){let n=new Array;return this.getViewLinesData(i,e,t,1,o,0,[!0],n),n[0]}getViewLinesData(i,e,t,o,n,r,s,l){this._assertVisible();let c=this._projectionData,u=c.injectionOffsets,p=c.injectionOptions,h={getInjectionOptions:()=>p,getInjectionOffsets:()=>u,getBreakOffsets:()=>c.breakOffsets,getWrappedTextIndentLength:()=>c.wrappedTextIndentLength,getBaseViewLineNumber:()=>n},f=new Syt(h).getInlineDecorations(e),v=i.tokenization.getLineTokens(e),b=uJi(v,p,u);for(let S=t;S<t+o;S++){let y=r+S-t;if(!s[y]){l[y]=null;continue}l[y]=this._getViewLineData(b,f?f[S]:null,S)}}_getViewLineData(i,e,t){this._assertVisible();let o=this._projectionData,n=t>0?o.wrappedTextIndentLength:0,r=t>0?o.breakOffsets[t-1]:0,s=o.breakOffsets[t],l=i.sliceAndInflate(r,s,n),c=l.getLineContent();t>0&&(c=hJi(o.wrappedTextIndentLength)+c);let u=this._projectionData.getMinOutputOffset(t)+1,p=c.length+1,h=t+1<this.getViewLineCount(),g=t===0?0:o.breakOffsetsVisibleColumn[t-1];return new sde(c,h,u,p,g,l,e)}getModelColumnOfViewPosition(i,e){return this._assertVisible(),this._projectionData.translateToInputOffset(i,e-1)+1}getViewPositionOfModelPosition(i,e,t=2){return this._assertVisible(),this._projectionData.translateToOutputPosition(e-1,t).toPosition(i)}getViewLineNumberOfModelPosition(i,e){this._assertVisible();let t=this._projectionData.translateToOutputPosition(e-1);return i+t.outputLineIndex}normalizePosition(i,e,t){let o=e.lineNumber-i;return this._projectionData.normalizeOutputPosition(i,e.column-1,t).toPosition(o)}getInjectedTextAt(i,e){return this._projectionData.getInjectedText(i,e-1)}_assertVisible(){if(!this._isVisible)throw new Error("Not supported")}},wxt=class a{static{this.INSTANCE=new a}constructor(){}isVisible(){return!0}setVisible(i){return i?this:Cxt.INSTANCE}getProjectionData(){return null}getViewLineCount(){return 1}getViewLineContent(i,e,t){return i.getLineContent(e)}getViewLineLength(i,e,t){return i.getLineLength(e)}getViewLineMinColumn(i,e,t){return i.getLineMinColumn(e)}getViewLineMaxColumn(i,e,t){return i.getLineMaxColumn(e)}getViewLineData(i,e,t,o){let n=i.tokenization.getLineTokens(e),r=n.getLineContent();return new sde(r,!1,1,r.length+1,0,n.inflate(),null)}getViewLinesData(i,e,t,o,n,r,s,l){if(!s[r]){l[r]=null;return}l[r]=this.getViewLineData(i,e,0,n)}getModelColumnOfViewPosition(i,e){return e}getViewPositionOfModelPosition(i,e){return new ye(i,e)}getViewLineNumberOfModelPosition(i,e){return i}normalizePosition(i,e,t){return e}getInjectedTextAt(i,e){return null}},Cxt=class a{static{this.INSTANCE=new a}constructor(){}isVisible(){return!1}setVisible(i){return i?wxt.INSTANCE:this}getProjectionData(){return null}getViewLineCount(){return 0}getViewLineContent(i,e,t){throw new Error("Not supported")}getViewLineLength(i,e,t){throw new Error("Not supported")}getViewLineMinColumn(i,e,t){throw new Error("Not supported")}getViewLineMaxColumn(i,e,t){throw new Error("Not supported")}getViewLineData(i,e,t,o){throw new Error("Not supported")}getViewLinesData(i,e,t,o,n,r,s,l){throw new Error("Not supported")}getModelColumnOfViewPosition(i,e){throw new Error("Not supported")}getViewPositionOfModelPosition(i,e){throw new Error("Not supported")}getViewLineNumberOfModelPosition(i,e){throw new Error("Not supported")}normalizePosition(i,e,t){throw new Error("Not supported")}getInjectedTextAt(i,e){throw new Error("Not supported")}},Yli=[""];function hJi(a){if(a>=Yli.length)for(let i=1;i<=a;i++)Yli[i]=Xqo(i);return Yli[a]}function Xqo(a){return new Array(a+1).join(" ")}var kxt=class{constructor(i){this._model=i}_validPosition(i){return this._model.validatePosition(i)}_validRange(i){return this._model.validateRange(i)}convertViewPositionToModelPosition(i){return this._validPosition(i)}convertViewRangeToModelRange(i){return this._validRange(i)}validateViewPosition(i,e){return this._validPosition(e)}validateViewRange(i,e){return this._validRange(e)}convertModelPositionToViewPosition(i){return this._validPosition(i)}convertModelRangeToViewRange(i){return this._validRange(i)}modelPositionIsVisible(i){let e=this._model.getLineCount();return!(i.lineNumber<1||i.lineNumber>e)}modelRangeIsVisible(i){let e=this._model.getLineCount();return!(i.startLineNumber<1||i.startLineNumber>e||i.endLineNumber<1||i.endLineNumber>e)}getModelLineViewLineCount(i){return 1}getViewLineNumberOfModelPosition(i,e){return i}};var Ext=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._editorId=i,this.model=e,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=t,this._monospaceLineBreaksComputerFactory=o,this.fontInfo=n,this.tabSize=r,this.wrappingStrategy=s,this.wrappingColumn=l,this.wrappingIndent=c,this.wordBreak=u,this.wrapOnEscapedLineFeeds=p,this._constructLines(!0,null)}dispose(){this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[])}createCoordinatesConverter(){return new Jli(this)}_constructLines(i,e){this.modelLineProjections=[],i&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));let o=this.model.getLinesContent().length,n=this.createLineBreaksComputer();for(let g=0;g<o;g++)n.addRequest(g+1,e?e[g]:null);let r=n.finalize(),s=[],l=this.hiddenAreasDecorationIds.map(g=>this.model.getDecorationRange(g)).sort(G.compareRangesUsingStarts),c=1,u=0,p=-1,h=p+1<l.length?u+1:o+2;for(let g=0;g<o;g++){let f=g+1;f===h&&(p++,c=l[p].startLineNumber,u=l[p].endLineNumber,h=p+1<l.length?u+1:o+2);let v=f>=c&&f<=u,b=xxt(r[g],!v);s[g]=b.getViewLineCount(),this.modelLineProjections[g]=b}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new xCe(s),this._ensureAtLeastOneVisibleLine()}getHiddenAreas(){return this.hiddenAreasDecorationIds.map(i=>this.model.getDecorationRange(i))}setHiddenAreas(i){let e=i.map(h=>this.model.validateRange(h)),t=Jqo(e),o=this.hiddenAreasDecorationIds.map(h=>this.model.getDecorationRange(h)).sort(G.compareRangesUsingStarts);if(t.length===o.length){let h=!1;for(let g=0;g<t.length;g++)if(!t[g].equalsRange(o[g])){h=!0;break}if(!h)return!1}let n=t.map(h=>({range:h,options:So.EMPTY}));this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,n);let r=t,s=1,l=0,c=-1,u=c+1<r.length?l+1:this.modelLineProjections.length+2,p=!1;for(let h=0;h<this.modelLineProjections.length;h++){let g=h+1;g===u&&(c++,s=r[c].startLineNumber,l=r[c].endLineNumber,u=c+1<r.length?l+1:this.modelLineProjections.length+2);let f=!1;if(g>=s&&g<=l?this.modelLineProjections[h].isVisible()&&(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!1),f=!0):(p=!0,this.modelLineProjections[h].isVisible()||(this.modelLineProjections[h]=this.modelLineProjections[h].setVisible(!0),f=!0)),f){let v=this.modelLineProjections[h].getViewLineCount();this.projectedModelLineLineCounts.setValue(h,v)}}return p||this.setHiddenAreas([]),!0}modelPositionIsVisible(i,e){return i<1||i>this.modelLineProjections.length?!1:this.modelLineProjections[i-1].isVisible()}getModelLineViewLineCount(i){return i<1||i>this.modelLineProjections.length?1:this.modelLineProjections[i-1].getViewLineCount()}setTabSize(i){return this.tabSize===i?!1:(this.tabSize=i,this._constructLines(!1,null),!0)}setWrappingSettings(i,e,t,o,n){let r=this.fontInfo.equals(i),s=this.wrappingStrategy===e,l=this.wrappingColumn===t,c=this.wrappingIndent===o,u=this.wordBreak===n;if(r&&s&&l&&c&&u)return!1;let p=r&&s&&!l&&c&&u;this.fontInfo=i,this.wrappingStrategy=e,this.wrappingColumn=t,this.wrappingIndent=o,this.wordBreak=n;let h=null;if(p){h=[];for(let g=0,f=this.modelLineProjections.length;g<f;g++)h[g]=this.modelLineProjections[g].getProjectionData()}return this._constructLines(!1,h),!0}createLineBreaksComputer(i){let e=this.wrappingStrategy==="advanced"?this._domLineBreaksComputerFactory:this._monospaceLineBreaksComputerFactory,t=i??{getLineContent:o=>this.model.getLineContent(o),getLineInjectedText:o=>this.model.getLineInjectedText(o,this._editorId)};return e.createLineBreaksComputer(t,this.fontInfo,this.tabSize,this.wrappingColumn,this.wrappingIndent,this.wordBreak,this.wrapOnEscapedLineFeeds)}onModelFlushed(){this._constructLines(!0,null)}onModelLinesDeleted(i,e,t){if(!i||i<=this._validModelVersionId)return null;let o=e===1?1:this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,n=this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections.splice(e-1,t-e+1),this.projectedModelLineLineCounts.removeValues(e-1,t-e+1),new dCe(o,n)}onModelLinesInserted(i,e,t,o){if(!i||i<=this._validModelVersionId)return null;let n=e>2&&!this.modelLineProjections[e-2].isVisible(),r=e===1?1:this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,s=0,l=[],c=[];for(let u=0,p=o.length;u<p;u++){let h=xxt(o[u],!n);l.push(h);let g=h.getViewLineCount();s+=g,c[u]=g}return this.modelLineProjections=this.modelLineProjections.slice(0,e-1).concat(l).concat(this.modelLineProjections.slice(e-1)),this.projectedModelLineLineCounts.insertValues(e-1,c),new uCe(r,r+s-1)}onModelLineChanged(i,e,t){if(i!==null&&i<=this._validModelVersionId)return[!1,null,null,null];let o=e-1,n=this.modelLineProjections[o].getViewLineCount(),r=this.modelLineProjections[o].isVisible(),s=xxt(t,r);this.modelLineProjections[o]=s;let l=this.modelLineProjections[o].getViewLineCount(),c=!1,u=0,p=-1,h=0,g=-1,f=0,v=-1;n>l?(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+l-1,f=p+1,v=f+(n-l)-1,c=!0):n<l?(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+n-1,h=p+1,g=h+(l-n)-1,c=!0):(u=this.projectedModelLineLineCounts.getPrefixSum(e-1)+1,p=u+l-1),this.projectedModelLineLineCounts.setValue(o,l);let b=u<=p?new d3e(u,p-u+1):null,S=h<=g?new uCe(h,g):null,y=f<=v?new dCe(f,v):null;return[c,b,S,y]}acceptVersionId(i){this._validModelVersionId=i,this._ensureAtLeastOneVisibleLine()}_ensureAtLeastOneVisibleLine(){this.getViewLineCount()===0&&this.modelLineProjections.length>0&&(this.modelLineProjections[0]=this.modelLineProjections[0].setVisible(!0),this.projectedModelLineLineCounts.setValue(0,this.modelLineProjections[0].getViewLineCount()))}getViewLineCount(){return this.projectedModelLineLineCounts.getTotalSum()}_toValidViewLineNumber(i){if(i<1)return 1;let e=this.getViewLineCount();return i>e?e:i|0}getActiveIndentGuide(i,e,t){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);let o=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),n=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),r=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),s=this.model.guides.getActiveIndentGuide(o.lineNumber,n.lineNumber,r.lineNumber),l=this.convertModelPositionToViewPosition(s.startLineNumber,1),c=this.convertModelPositionToViewPosition(s.endLineNumber,this.model.getLineMaxColumn(s.endLineNumber));return{startLineNumber:l.lineNumber,endLineNumber:c.lineNumber,indent:s.indent}}getViewLineInfo(i){i=this._toValidViewLineNumber(i);let e=this.projectedModelLineLineCounts.getIndexOf(i-1),t=e.index,o=e.remainder;return new Txt(t+1,o)}getMinColumnOfViewLine(i){return this.modelLineProjections[i.modelLineNumber-1].getViewLineMinColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx)}getMaxColumnOfViewLine(i){return this.modelLineProjections[i.modelLineNumber-1].getViewLineMaxColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx)}getModelStartPositionOfViewLine(i){let e=this.modelLineProjections[i.modelLineNumber-1],t=e.getViewLineMinColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx),o=e.getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return new ye(i.modelLineNumber,o)}getModelEndPositionOfViewLine(i){let e=this.modelLineProjections[i.modelLineNumber-1],t=e.getViewLineMaxColumn(this.model,i.modelLineNumber,i.modelLineWrappedLineIdx),o=e.getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return new ye(i.modelLineNumber,o)}getViewLineInfosGroupedByModelRanges(i,e){let t=this.getViewLineInfo(i),o=this.getViewLineInfo(e),n=new Array,r=this.getModelStartPositionOfViewLine(t),s=new Array;for(let l=t.modelLineNumber;l<=o.modelLineNumber;l++){let c=this.modelLineProjections[l-1];if(c.isVisible()){let u=l===t.modelLineNumber?t.modelLineWrappedLineIdx:0,p=l===o.modelLineNumber?o.modelLineWrappedLineIdx+1:c.getViewLineCount();for(let h=u;h<p;h++)s.push(new Txt(l,h))}if(!c.isVisible()&&r){let u=new ye(l-1,this.model.getLineMaxColumn(l-1)+1),p=G.fromPositions(r,u);n.push(new _xt(p,s)),s=[],r=null}else c.isVisible()&&!r&&(r=new ye(l,1))}if(r){let l=G.fromPositions(r,this.getModelEndPositionOfViewLine(o));n.push(new _xt(l,s))}return n}getViewLinesBracketGuides(i,e,t,o){let n=t?this.convertViewPositionToModelPosition(t.lineNumber,t.column):null,r=[];for(let s of this.getViewLineInfosGroupedByModelRanges(i,e)){let l=s.modelRange.startLineNumber,c=this.model.guides.getLinesBracketGuides(l,s.modelRange.endLineNumber,n,o);for(let u of s.viewLines){let h=c[u.modelLineNumber-l].map(g=>{if(g.forWrappedLinesAfterColumn!==-1&&this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.forWrappedLinesAfterColumn).lineNumber>=u.modelLineWrappedLineIdx||g.forWrappedLinesBeforeOrAtColumn!==-1&&this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.forWrappedLinesBeforeOrAtColumn).lineNumber<u.modelLineWrappedLineIdx)return;if(!g.horizontalLine)return g;let f=-1;if(g.column!==-1){let S=this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.column);if(S.lineNumber===u.modelLineWrappedLineIdx)f=S.column;else if(S.lineNumber<u.modelLineWrappedLineIdx)f=this.getMinColumnOfViewLine(u);else if(S.lineNumber>u.modelLineWrappedLineIdx)return}let v=this.convertModelPositionToViewPosition(u.modelLineNumber,g.horizontalLine.endColumn),b=this.modelLineProjections[u.modelLineNumber-1].getViewPositionOfModelPosition(0,g.horizontalLine.endColumn);return b.lineNumber===u.modelLineWrappedLineIdx?new OF(g.visibleColumn,f,g.className,new U5(g.horizontalLine.top,v.column),-1,-1):b.lineNumber<u.modelLineWrappedLineIdx||g.visibleColumn!==-1?void 0:new OF(g.visibleColumn,f,g.className,new U5(g.horizontalLine.top,this.getMaxColumnOfViewLine(u)),-1,-1)});r.push(h.filter(g=>!!g))}}return r}getViewLinesIndentGuides(i,e){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e);let t=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),o=this.convertViewPositionToModelPosition(e,this.getViewLineMaxColumn(e)),n=[],r=[],s=[],l=t.lineNumber-1,c=o.lineNumber-1,u=null;for(let f=l;f<=c;f++){let v=this.modelLineProjections[f];if(v.isVisible()){let b=v.getViewLineNumberOfModelPosition(0,f===l?t.column:1),S=v.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(f+1)),y=S-b+1,w=0;y>1&&v.getViewLineMinColumn(this.model,f+1,S)===1&&(w=b===0?1:2),r.push(y),s.push(w),u===null&&(u=new ye(f+1,0))}else u!==null&&(n=n.concat(this.model.guides.getLinesIndentGuides(u.lineNumber,f)),u=null)}u!==null&&(n=n.concat(this.model.guides.getLinesIndentGuides(u.lineNumber,o.lineNumber)),u=null);let p=e-i+1,h=new Array(p),g=0;for(let f=0,v=n.length;f<v;f++){let b=n[f],S=Math.min(p-g,r[f]),y=s[f],w;y===2?w=0:y===1?w=1:w=S;for(let x=0;x<S;x++)x===w&&(b=0),h[g++]=b}return h}getViewLineContent(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineContent(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineLength(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineLength(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineMinColumn(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineMaxColumn(i){let e=this.getViewLineInfo(i);return this.modelLineProjections[e.modelLineNumber-1].getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getViewLineData(i){let e=this.getViewLineInfo(i),t=this.projectedModelLineLineCounts.getPrefixSum(e.modelLineNumber-1)+1;return this.modelLineProjections[e.modelLineNumber-1].getViewLineData(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx,t)}getViewLinesData(i,e,t){i=this._toValidViewLineNumber(i),e=this._toValidViewLineNumber(e);let o=this.projectedModelLineLineCounts.getIndexOf(i-1),n=i,r=o.index,s=o.remainder,l=[];for(let c=r,u=this.model.getLineCount();c<u;c++){let p=this.modelLineProjections[c];if(!p.isVisible())continue;let h=c===r?s:0,g=p.getViewLineCount()-h,f=!1;n+g>e&&(f=!0,g=e-n+1);let v=this.projectedModelLineLineCounts.getPrefixSum(c)+1;if(p.getViewLinesData(this.model,c+1,h,g,v,n-i,t,l),n+=g,f)break}return l}validateViewPosition(i,e,t){i=this._toValidViewLineNumber(i);let o=this.projectedModelLineLineCounts.getIndexOf(i-1),n=o.index,r=o.remainder,s=this.modelLineProjections[n],l=s.getViewLineMinColumn(this.model,n+1,r),c=s.getViewLineMaxColumn(this.model,n+1,r);e<l&&(e=l),e>c&&(e=c);let u=s.getModelColumnOfViewPosition(r,e);return this.model.validatePosition(new ye(n+1,u)).equals(t)?new ye(i,e):this.convertModelPositionToViewPosition(t.lineNumber,t.column)}validateViewRange(i,e){let t=this.validateViewPosition(i.startLineNumber,i.startColumn,e.getStartPosition()),o=this.validateViewPosition(i.endLineNumber,i.endColumn,e.getEndPosition());return new G(t.lineNumber,t.column,o.lineNumber,o.column)}convertViewPositionToModelPosition(i,e){let t=this.getViewLineInfo(i),o=this.modelLineProjections[t.modelLineNumber-1].getModelColumnOfViewPosition(t.modelLineWrappedLineIdx,e);return this.model.validatePosition(new ye(t.modelLineNumber,o))}convertViewRangeToModelRange(i){let e=this.convertViewPositionToModelPosition(i.startLineNumber,i.startColumn),t=this.convertViewPositionToModelPosition(i.endLineNumber,i.endColumn);return new G(e.lineNumber,e.column,t.lineNumber,t.column)}convertModelPositionToViewPosition(i,e,t=2,o=!1,n=!1){let r=this.model.validatePosition(new ye(i,e)),s=r.lineNumber,l=r.column,c=s-1,u=!1;if(n)for(;c<this.modelLineProjections.length&&!this.modelLineProjections[c].isVisible();)c++,u=!0;else for(;c>0&&!this.modelLineProjections[c].isVisible();)c--,u=!0;if(c===0&&!this.modelLineProjections[c].isVisible())return new ye(o?0:1,1);let p=1+this.projectedModelLineLineCounts.getPrefixSum(c),h;return u?n?h=this.modelLineProjections[c].getViewPositionOfModelPosition(p,1,t):h=this.modelLineProjections[c].getViewPositionOfModelPosition(p,this.model.getLineMaxColumn(c+1),t):h=this.modelLineProjections[s-1].getViewPositionOfModelPosition(p,l,t),h}convertModelRangeToViewRange(i,e=0){if(i.isEmpty()){let t=this.convertModelPositionToViewPosition(i.startLineNumber,i.startColumn,e);return G.fromPositions(t)}else{let t=this.convertModelPositionToViewPosition(i.startLineNumber,i.startColumn,1),o=this.convertModelPositionToViewPosition(i.endLineNumber,i.endColumn,0);return new G(t.lineNumber,t.column,o.lineNumber,o.column)}}getViewLineNumberOfModelPosition(i,e){let t=i-1;if(this.modelLineProjections[t].isVisible()){let n=1+this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections[t].getViewLineNumberOfModelPosition(n,e)}for(;t>0&&!this.modelLineProjections[t].isVisible();)t--;if(t===0&&!this.modelLineProjections[t].isVisible())return 1;let o=1+this.projectedModelLineLineCounts.getPrefixSum(t);return this.modelLineProjections[t].getViewLineNumberOfModelPosition(o,this.model.getLineMaxColumn(t+1))}getDecorationsInRange(i,e,t,o,n,r){let s=this.convertViewPositionToModelPosition(i.startLineNumber,i.startColumn),l=this.convertViewPositionToModelPosition(i.endLineNumber,i.endColumn);if(l.lineNumber-s.lineNumber<=i.endLineNumber-i.startLineNumber)return this.model.getDecorationsInRange(new G(s.lineNumber,1,l.lineNumber,l.column),e,t,o,n,r);let c=[],u=s.lineNumber-1,p=l.lineNumber-1,h=null;for(let b=u;b<=p;b++)if(this.modelLineProjections[b].isVisible())h===null&&(h=new ye(b+1,b===u?s.column:1));else if(h!==null){let y=this.model.getLineMaxColumn(b);c=c.concat(this.model.getDecorationsInRange(new G(h.lineNumber,h.column,b,y),e,t,o,n)),h=null}h!==null&&(c=c.concat(this.model.getDecorationsInRange(new G(h.lineNumber,h.column,l.lineNumber,l.column),e,t,o,n)),h=null),c.sort((b,S)=>{let y=G.compareRangesUsingStarts(b.range,S.range);return y===0?b.id<S.id?-1:b.id>S.id?1:0:y});let g=[],f=0,v=null;for(let b of c){let S=b.id;v!==S&&(v=S,g[f++]=b)}return g}getInjectedTextAt(i){let e=this.getViewLineInfo(i.lineNumber);return this.modelLineProjections[e.modelLineNumber-1].getInjectedTextAt(e.modelLineWrappedLineIdx,i.column)}normalizePosition(i,e){let t=this.getViewLineInfo(i.lineNumber);return this.modelLineProjections[t.modelLineNumber-1].normalizePosition(t.modelLineWrappedLineIdx,i,e)}getLineIndentColumn(i){let e=this.getViewLineInfo(i);return e.modelLineWrappedLineIdx===0?this.model.getLineIndentColumn(e.modelLineNumber):0}};function Jqo(a){if(a.length===0)return[];let i=a.slice();i.sort(G.compareRangesUsingStarts);let e=[],t=i[0].startLineNumber,o=i[0].endLineNumber;for(let n=1,r=i.length;n<r;n++){let s=i[n];s.startLineNumber>o+1?(e.push(new G(t,1,o,1)),t=s.startLineNumber,o=s.endLineNumber):s.endLineNumber>o&&(o=s.endLineNumber)}return e.push(new G(t,1,o,1)),e}var Txt=class{constructor(i,e){this.modelLineNumber=i;this.modelLineWrappedLineIdx=e}get isWrappedLineContinuation(){return this.modelLineWrappedLineIdx>0}},_xt=class{constructor(i,e){this.modelRange=i;this.viewLines=e}},Jli=class{constructor(i){this._lines=i}convertViewPositionToModelPosition(i){return this._lines.convertViewPositionToModelPosition(i.lineNumber,i.column)}convertViewRangeToModelRange(i){return this._lines.convertViewRangeToModelRange(i)}validateViewPosition(i,e){return this._lines.validateViewPosition(i.lineNumber,i.column,e)}validateViewRange(i,e){return this._lines.validateViewRange(i,e)}convertModelPositionToViewPosition(i,e,t,o){return this._lines.convertModelPositionToViewPosition(i.lineNumber,i.column,e,t,o)}convertModelRangeToViewRange(i,e){return this._lines.convertModelRangeToViewRange(i,e)}modelPositionIsVisible(i){return this._lines.modelPositionIsVisible(i.lineNumber,i.column)}getModelLineViewLineCount(i){return this._lines.getModelLineViewLineCount(i)}getViewLineNumberOfModelPosition(i,e){return this._lines.getViewLineNumberOfModelPosition(i,e)}};var Dxt=class{constructor(i){this.model=i}dispose(){}createCoordinatesConverter(){return new kxt(this.model)}getHiddenAreas(){return[]}setHiddenAreas(i){return!1}setTabSize(i){return!1}setWrappingSettings(i,e,t,o){return!1}createLineBreaksComputer(){let i=[];return{addRequest:(e,t)=>{i.push(null)},finalize:()=>i}}onModelFlushed(){}onModelLinesDeleted(i,e,t){return new dCe(e,t)}onModelLinesInserted(i,e,t,o){return new uCe(e,t)}onModelLineChanged(i,e,t){return[!1,new d3e(e,1),null,null]}acceptVersionId(i){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(i,e,t){return{startLineNumber:i,endLineNumber:i,indent:0}}getViewLinesBracketGuides(i,e,t){return new Array(e-i+1).fill([])}getViewLinesIndentGuides(i,e){let t=e-i+1,o=new Array(t);for(let n=0;n<t;n++)o[n]=0;return o}getViewLineContent(i){return this.model.getLineContent(i)}getViewLineLength(i){return this.model.getLineLength(i)}getViewLineMinColumn(i){return this.model.getLineMinColumn(i)}getViewLineMaxColumn(i){return this.model.getLineMaxColumn(i)}getViewLineData(i){let e=this.model.tokenization.getLineTokens(i),t=e.getLineContent();return new sde(t,!1,1,t.length+1,0,e.inflate(),null)}getViewLinesData(i,e,t){let o=this.model.getLineCount();i=Math.min(Math.max(1,i),o),e=Math.min(Math.max(1,e),o);let n=[];for(let r=i;r<=e;r++){let s=r-i;n[s]=t[s]?this.getViewLineData(r):null}return n}getDecorationsInRange(i,e,t,o,n,r){return this.model.getDecorationsInRange(i,e,t,o,n,r)}normalizePosition(i,e){return this.model.normalizePosition(i,e)}getLineIndentColumn(i){return this.model.getLineIndentColumn(i)}getInjectedTextAt(i){return null}};var fde=3,Rxt=class{constructor(i){this.persist=0;this._requiredLanes=1;this.lanes=new Uint8Array(Math.ceil((i+1)*fde/8))}reset(i){let e=Math.ceil((i+1)*fde/8);this.lanes.length<e?this.lanes=new Uint8Array(e):this.lanes.fill(0),this._requiredLanes=1}get requiredLanes(){return this._requiredLanes}push(i,e,t){t&&(this.persist|=1<<i-1);for(let o=e.startLineNumber;o<=e.endLineNumber;o++){let n=fde*o+(i-1);this.lanes[n>>>3]|=1<<n%8,this._requiredLanes=Math.max(this._requiredLanes,this.countAtLine(o))}}getLanesAtLine(i){let e=[],t=fde*i;for(let o=0;o<fde;o++)(this.persist&1<<o||this.lanes[t>>>3]&1<<t%8)&&e.push(o+1),t++;return e.length?e:[2]}countAtLine(i){let e=fde*i,t=0;for(let o=0;o<fde;o++)(this.persist&1<<o||this.lanes[e>>>3]&1<<e%8)&&t++,e++;return t}};var Zqo=!0,Lxt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.languageConfigurationService=l;this._themeService=c;this._attachedView=u;this._transactionalTarget=p;this.hiddenAreasModel=new tci;this.previousHiddenAreas=[];if(this._editorId=e,this._configuration=t,this.model=o,this._eventDispatcher=new ext,this.onEvent=this._eventDispatcher.onEvent,this.cursorConfig=new DB(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._updateConfigurationViewLineCount=this._register(new Dt(()=>this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStart=Zli.create(this.model),this.glyphLanes=new Rxt(0),Zqo&&this.model.isTooLargeForTokenization())this._lines=new Dxt(this.model);else{let h=this._configuration.options,g=h.get(59),f=h.get(156),v=h.get(166),b=h.get(155),S=h.get(146),y=h.get(160);this._lines=new Ext(this._editorId,this.model,n,r,g,this.model.getOptions().tabSize,f,v.wrappingColumn,b,S,y)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new ske(o,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new Ixt(this._configuration,this.getLineCount(),this._getCustomLineHeights(),s)),this._register(this.viewLayout.onDidScroll(h=>{h.scrollTopChanged&&this._handleVisibleLinesChanged(),h.scrollTopChanged&&this._viewportStart.invalidate(),this._eventDispatcher.emitSingleViewEvent(new pIt(h)),this._eventDispatcher.emitOutgoingEvent(new oxt(h.oldScrollWidth,h.oldScrollLeft,h.oldScrollHeight,h.oldScrollTop,h.scrollWidth,h.scrollLeft,h.scrollHeight,h.scrollTop))})),this._register(this.viewLayout.onDidContentSizeChange(h=>{this._eventDispatcher.emitOutgoingEvent(h)})),this._decorations=new yxt(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast(h=>{try{let g=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(g,h)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(kxe.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new gIt)})),this._register(this._themeService.onDidColorThemeChange(h=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new mIt(h))})),this._updateConfigurationViewLineCountNow(),this.model.registerViewModel(this)}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this._viewportStart.dispose(),this._eventDispatcher.dispose(),this.model.unregisterViewModel(this)}getEditorOption(e){return this._configuration.options.get(e)}createLineBreaksComputer(e){return this._lines.createLineBreaksComputer(e)}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_getCustomLineHeights(){if(!this._configuration.options.get(5))return[];let t=this.model.getCustomLineHeightsDecorations(this._editorId);return W8e.fromDecorations(t,this.coordinatesConverter,this._configuration)}_getCustomLineHeightsForLines(e,t){if(!this._configuration.options.get(5))return[];let n=new G(e,1,t,this.model.getLineMaxColumn(t)),r=this.model.getCustomLineHeightsDecorationsInRange(n,this._editorId);return W8e.fromDecorations(r,this.coordinatesConverter,this._configuration)}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}getModelVisibleRanges(){let e=this.viewLayout.getLinesViewportData(),t=new G(e.startLineNumber,this.getLineMinColumn(e.startLineNumber),e.endLineNumber,this.getLineMaxColumn(e.endLineNumber));return this._toModelVisibleRanges(t)}visibleLinesStabilized(){let e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!0)}_handleVisibleLinesChanged(){let e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!1)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new dIt(e)),this._eventDispatcher.emitOutgoingEvent(new N8e(!e,e))}setHasWidgetFocus(e){this._eventDispatcher.emitOutgoingEvent(new ixt(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new sIt)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new aIt)}_captureStableViewport(){if(this._viewportStart.isValid&&this.viewLayout.getCurrentScrollTop()>0){let e=new ye(this._viewportStart.viewLineNumber,this.getLineMinColumn(this._viewportStart.viewLineNumber)),t=this.coordinatesConverter.convertViewPositionToModelPosition(e);return new Mxt(t,this._viewportStart.startLineDelta)}return new Mxt(null,0)}_onConfigurationChanged(e,t){let o=this._captureStableViewport(),n=this._configuration.options,r=n.get(59),s=n.get(156),l=n.get(166),c=n.get(155),u=n.get(146);this._lines.setWrappingSettings(r,s,l.wrappingColumn,c,u)&&(e.emitViewEvent(new xce),e.emitViewEvent(new kce),e.emitViewEvent(new Uz(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(104)&&(this._decorations.reset(),e.emitViewEvent(new Uz(null))),t.hasChanged(112)&&(this._decorations.reset(),e.emitViewEvent(new Uz(null))),e.emitViewEvent(new lIt(t)),this.viewLayout.onConfigurationChanged(t),o.recoverViewportStart(this.coordinatesConverter,this.viewLayout),DB.shouldRecreate(t)&&(this.cursorConfig=new DB(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig))}onDidChangeContentOrInjectedText(e){try{let o=this._eventDispatcher.beginEmitViewEvents(),n=!1,r=!1,s=e instanceof EX?e.rawContentChangedEvent.changes:e.changes,l=e instanceof EX?e.rawContentChangedEvent.versionId:null,c=this._lines.createLineBreaksComputer();for(let g of s)switch(g.changeType){case 4:{for(let f=0;f<g.count;f++)c.addRequest(g.fromLineNumberPostEdit+f,null);break}case 2:{c.addRequest(g.lineNumberPostEdit,null);break}}let u=c.finalize(),p=new nT(u),h=[];for(let g of s)switch(g.changeType){case 1:{this._lines.onModelFlushed(),o.emitViewEvent(new xce),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),n=!0;break}case 3:{let f=this._lines.onModelLinesDeleted(l,g.fromLineNumber,g.toLineNumber);f!==null&&(o.emitViewEvent(f),this.viewLayout.onLinesDeleted(f.fromLineNumber,f.toLineNumber),h.push({fromLineNumber:g.lastUntouchedLinePostEdit,toLineNumber:g.lastUntouchedLinePostEdit})),n=!0;break}case 4:{let f=p.takeCount(g.count),v=this._lines.onModelLinesInserted(l,g.fromLineNumber,g.toLineNumber,f);v!==null&&(o.emitViewEvent(v),this.viewLayout.onLinesInserted(v.fromLineNumber,v.toLineNumber),h.push({fromLineNumber:g.fromLineNumberPostEdit,toLineNumber:g.toLineNumberPostEdit})),n=!0;break}case 2:{let f=p.dequeue(),[v,b,S,y]=this._lines.onModelLineChanged(l,g.lineNumber,f);r=v,b&&o.emitViewEvent(b),S&&(o.emitViewEvent(S),this.viewLayout.onLinesInserted(S.fromLineNumber,S.toLineNumber),h.push({fromLineNumber:g.lineNumberPostEdit,toLineNumber:g.lineNumberPostEdit})),y&&(o.emitViewEvent(y),this.viewLayout.onLinesDeleted(y.fromLineNumber,y.toLineNumber),h.push({fromLineNumber:g.lineNumberPostEdit,toLineNumber:g.lineNumberPostEdit}));break}case 5:break}l!==null&&this._lines.acceptVersionId(l),h.length>0&&this.viewLayout.changeSpecialLineHeights(g=>{for(let f of h){let v=this._getCustomLineHeightsForLines(f.fromLineNumber,f.toLineNumber);for(let b of v)g.insertOrChangeCustomLineHeight(b.decorationId,b.startLineNumber,b.endLineNumber,b.lineHeight)}}),this.viewLayout.onHeightMaybeChanged(),!n&&r&&(o.emitViewEvent(new kce),o.emitViewEvent(new Uz(null)),this._cursor.onLineMappingChanged(o),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}let t=this._viewportStart.isValid;if(this._viewportStart.invalidate(),this._configuration.setModelLineCount(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&t){let o=this.model._getTrackedRange(this._viewportStart.modelTrackedRange);if(o){let n=this.coordinatesConverter.convertModelPositionToViewPosition(o.getStartPosition()),r=this.viewLayout.getVerticalOffsetForLineNumber(n.lineNumber);this.viewLayout.setScrollPosition({scrollTop:r+this._viewportStart.startLineDelta},1)}}this._handleVisibleLinesChanged()}emitContentChangeEvent(e){this._emitViewEvent(t=>{e instanceof EX&&t.emitOutgoingEvent(new uxt(e.contentChangedEvent)),this._cursor.onModelContentChanged(t,e)})}_registerModelEvents(){this._configuration.options.get(5)&&this._register(this.model.onDidChangeLineHeight(o=>{let n=o.changes.filter(r=>r.ownerId===this._editorId||r.ownerId===0);if(this.viewLayout.changeSpecialLineHeights(r=>{for(let s of n){let{decorationId:l,lineNumber:c,lineHeightMultiplier:u}=s,p=this.coordinatesConverter.convertModelRangeToViewRange(new G(c,1,c,this.model.getLineMaxColumn(c)));u!==null?r.insertOrChangeCustomLineHeight(l,p.startLineNumber,p.endLineNumber,u*this._configuration.options.get(75)):r.removeCustomLineHeight(l)}}),n.length>0){let r=new Hxe(n);this._eventDispatcher.emitOutgoingEvent(new hxt(r))}})),this._configuration.options.get(172)&&this._register(this.model.onDidChangeFont(o=>{let n=o.changes.filter(r=>r.ownerId===this._editorId||r.ownerId===0);if(n.length>0){let r=new Uxe(n);this._eventDispatcher.emitOutgoingEvent(new gxt(r))}})),this._register(this.model.onDidChangeTokens(o=>{let n=[];for(let r=0,s=o.ranges.length;r<s;r++){let l=o.ranges[r],c=this.coordinatesConverter.convertModelPositionToViewPosition(new ye(l.fromLineNumber,1)).lineNumber,u=this.coordinatesConverter.convertModelPositionToViewPosition(new ye(l.toLineNumber,this.model.getLineMaxColumn(l.toLineNumber))).lineNumber;n[r]={fromLineNumber:c,toLineNumber:u}}this._eventDispatcher.emitSingleViewEvent(new hIt(n)),this._eventDispatcher.emitOutgoingEvent(new mxt(o))})),this._register(this.model.onDidChangeLanguageConfiguration(o=>{this._eventDispatcher.emitSingleViewEvent(new uIt),this.cursorConfig=new DB(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new dxt(o))})),this._register(this.model.onDidChangeLanguage(o=>{this.cursorConfig=new DB(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new cxt(o))})),this._register(this.model.onDidChangeOptions(o=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{let n=this._eventDispatcher.beginEmitViewEvents();n.emitViewEvent(new xce),n.emitViewEvent(new kce),n.emitViewEvent(new Uz(null)),this._cursor.onLineMappingChanged(n),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new DB(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new pxt(o))})),this._register(this.model.onDidChangeDecorations(o=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new Uz(o)),this._eventDispatcher.emitOutgoingEvent(new lxt(o))}))}getFontSizeAtPosition(e){if(!this._configuration.options.get(172))return null;let o=this.model.getFontDecorationsInRange(G.fromPositions(e),this._editorId),n=this._configuration.options.get(59).fontSize+"px";for(let r of o)if(r.options.fontSize){n=r.options.fontSize;break}return n}setHiddenAreas(e,t,o){this.hiddenAreasModel.setHiddenAreas(t,e);let n=this.hiddenAreasModel.getMergedRanges();if(n===this.previousHiddenAreas&&!o)return;this.previousHiddenAreas=n;let r=this._captureStableViewport(),s=!1;try{let l=this._eventDispatcher.beginEmitViewEvents();s=this._lines.setHiddenAreas(n),s&&(l.emitViewEvent(new xce),l.emitViewEvent(new kce),l.emitViewEvent(new Uz(null)),this._cursor.onLineMappingChanged(l),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this.viewLayout.onHeightMaybeChanged());let c=r.viewportStartModelPosition?.lineNumber;c&&n.some(p=>p.startLineNumber<=c&&c<=p.endLineNumber)||r.recoverViewportStart(this.coordinatesConverter,this.viewLayout)}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule(),s&&this._eventDispatcher.emitOutgoingEvent(new rxt)}getVisibleRangesPlusViewportAboveBelow(){let e=this._configuration.options.get(165),t=this._configuration.options.get(75),o=Math.max(20,Math.round(e.height/t)),n=this.viewLayout.getLinesViewportData(),r=Math.max(1,n.completelyVisibleStartLineNumber-o),s=Math.min(this.getLineCount(),n.completelyVisibleEndLineNumber+o);return this._toModelVisibleRanges(new G(r,this.getLineMinColumn(r),s,this.getLineMaxColumn(s)))}getVisibleRanges(){let e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}getHiddenAreas(){return this._lines.getHiddenAreas()}_toModelVisibleRanges(e){let t=this.coordinatesConverter.convertViewRangeToModelRange(e),o=this._lines.getHiddenAreas();if(o.length===0)return[t];let n=[],r=0,s=t.startLineNumber,l=t.startColumn,c=t.endLineNumber,u=t.endColumn;for(let p=0,h=o.length;p<h;p++){let g=o[p].startLineNumber,f=o[p].endLineNumber;f<s||g>c||(s<g&&(n[r++]=new G(s,l,g-1,this.model.getLineMaxColumn(g-1))),s=f+1,l=1)}return(s<c||s===c&&l<u)&&(n[r++]=new G(s,l,c,u)),n}getCompletelyVisibleViewRange(){let e=this.viewLayout.getLinesViewportData(),t=e.completelyVisibleStartLineNumber,o=e.completelyVisibleEndLineNumber;return new G(t,this.getLineMinColumn(t),o,this.getLineMaxColumn(o))}getCompletelyVisibleViewRangeAtScrollTop(e){let t=this.viewLayout.getLinesViewportDataAtScrollTop(e),o=t.completelyVisibleStartLineNumber,n=t.completelyVisibleEndLineNumber;return new G(o,this.getLineMinColumn(o),n,this.getLineMaxColumn(n))}getViewRangeWithCursorPadding(e){let t=this._configuration.options,o=t.get(35),n=t.get(131),{startLineNumber:r,endLineNumber:s}=e,l=Math.min(Math.max(o,n.enabled?n.maxLineCount:0),Math.floor((s-r+1)/2));return r+=l,s-=Math.max(0,l-1),l===0||r>s?e:new G(r,this.getLineMinColumn(r),s,this.getLineMaxColumn(s))}saveState(){let e=this.viewLayout.saveState(),t=e.scrollTop,o=this.viewLayout.getLineNumberAtVerticalOffset(t),n=this.coordinatesConverter.convertViewPositionToModelPosition(new ye(o,this.getLineMinColumn(o))),r=this.viewLayout.getVerticalOffsetForLineNumber(o)-t;return{scrollLeft:e.scrollLeft,firstPosition:n,firstPositionDeltaTop:r}}reduceRestoreState(e){if(typeof e.firstPosition>"u")return this._reduceRestoreStateCompatibility(e);let t=this.model.validatePosition(e.firstPosition),o=this.coordinatesConverter.convertModelPositionToViewPosition(t),n=this.viewLayout.getVerticalOffsetForLineNumber(o.lineNumber)-e.firstPositionDeltaTop;return{scrollLeft:e.scrollLeft,scrollTop:n}}_reduceRestoreStateCompatibility(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTopWithoutViewZones}}getTabSize(){return this.model.getOptions().tabSize}getLineCount(){return this._lines.getViewLineCount()}setViewport(e,t,o){this._viewportStart.update(this,e)}getActiveIndentGuide(e,t,o){return this._lines.getActiveIndentGuide(e,t,o)}getLinesIndentGuides(e,t){return this._lines.getViewLinesIndentGuides(e,t)}getBracketGuidesInRangeByLine(e,t,o,n){return this._lines.getViewLinesBracketGuides(e,t,o,n)}getLineContent(e){return this._lines.getViewLineContent(e)}getLineLength(e){return this._lines.getViewLineLength(e)}getLineMinColumn(e){return this._lines.getViewLineMinColumn(e)}getLineMaxColumn(e){return this._lines.getViewLineMaxColumn(e)}getLineFirstNonWhitespaceColumn(e){let t=Em(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){let t=Bv(this.getLineContent(e));return t===-1?0:t+2}getMinimapDecorationsInRange(e){return this._decorations.getMinimapDecorationsInRange(e)}getDecorationsInViewport(e){return this._decorations.getDecorationsViewportData(e).decorations}getInjectedTextAt(e){return this._lines.getInjectedTextAt(e)}_getTextDirection(e,t){let o=0;for(let n of t){let r=n.range;if(r.startLineNumber>e||r.endLineNumber<e)continue;let s=n.options.textDirection;s===1?o++:s===0&&o--}return o>0?1:0}getTextDirection(e){let t=this._decorations.getDecorationsOnLine(e);return this._getTextDirection(e,t.decorations)}getViewportViewLineRenderingData(e,t){let o=this._decorations.getDecorationsViewportData(e),n=t-e.startLineNumber,r=o.inlineDecorations[n],s=o.hasVariableFonts[n];return this._getViewLineRenderingData(t,r,s,o.decorations)}getViewLineRenderingData(e){let t=this._decorations.getDecorationsOnLine(e);return this._getViewLineRenderingData(e,t.inlineDecorations[0],t.hasVariableFonts[0],t.decorations)}_getViewLineRenderingData(e,t,o,n){let r=this.model.mightContainRTL(),s=this.model.mightContainNonBasicASCII(),l=this.getTabSize(),c=this._lines.getViewLineData(e);return c.inlineDecorations&&(t=[...t,...c.inlineDecorations]),new dK(c.minColumn,c.maxColumn,c.content,c.continuesWithWrappedLine,r,s,c.tokens,t,l,c.startVisibleColumn,this._getTextDirection(e,n),o)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,o){let n=this._lines.getViewLinesData(e,t,o);return new Fwt(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){let t=this.model.getOverviewRulerDecorations(this._editorId,ace(this._configuration.options),lce(this._configuration.options)),o=new eci;for(let n of t){let r=n.options,s=r.overviewRuler;if(!s)continue;let l=s.position;if(l===0)continue;let c=s.getColor(e.value),u=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.startLineNumber,n.range.startColumn),p=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.endLineNumber,n.range.endColumn);o.accept(c,r.zIndex,u,p,l)}return o.asArray}_invalidateDecorationsColorCache(){let e=this.model.getOverviewRulerDecorations();for(let t of e)t.options.overviewRuler?.invalidateCachedColor(),t.options.minimap?.invalidateCachedColor()}getValueInRange(e,t){let o=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(o,t)}getValueLengthInRange(e,t){let o=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueLengthInRange(o,t)}modifyPosition(e,t){let o=this.coordinatesConverter.convertViewPositionToModelPosition(e),n=this.model.modifyPosition(o,t);return this.coordinatesConverter.convertModelPositionToViewPosition(n)}deduceModelPositionRelativeToViewPosition(e,t,o){let n=this.coordinatesConverter.convertViewPositionToModelPosition(e);this.model.getEOL().length===2&&(t<0?t-=o:t+=o);let s=this.model.getOffsetAt(n)+t;return this.model.getPositionAt(s)}getPlainTextToCopy(e,t,o){let n=o?`\r
`:this.model.getEOL();e=e.slice(0),e.sort(G.compareRangesUsingStarts);let r=!1,s=!1;for(let p of e)p.isEmpty()?r=!0:s=!0;if(!s&&!t)return{sourceRanges:[],sourceText:""};let l=[],c=[],u=(p,h="")=>{l.push(p),c.push(this.model.getValueInRange(p,o?2:0)+h)};if(r&&t){let p=0;for(let h of e){let g=h.startLineNumber;h.isEmpty()?g!==p&&u(new G(g,this.model.getLineMinColumn(g),g,this.model.getLineMaxColumn(g)),n):u(h),p=g}}else for(let p of e)p.isEmpty()||u(p);return{sourceRanges:l,sourceText:c.length===1?c[0]:c}}getRichTextToCopy(e,t){let o=this.model.getLanguageId();if(o===es||e.length!==1)return null;let n=e[0];if(n.isEmpty()){if(!t)return null;let p=n.startLineNumber;n=new G(p,this.model.getLineMinColumn(p),p,this.model.getLineMaxColumn(p))}let r=this._configuration.options.get(59),s=this._getColorMap(),c=/[:;\\\/<>]/.test(r.fontFamily)||r.fontFamily===Ku.fontFamily,u;return c?u=Ku.fontFamily:(u=r.fontFamily,u=u.replace(/"/g,"'"),/[,']/.test(u)||/[+ ]/.test(u)&&(u=`'${u}'`),u=`${u}, ${Ku.fontFamily}`),{mode:o,html:`<div style="color: ${s[1]};background-color: ${s[2]};font-family: ${u};font-weight: ${r.fontWeight};font-size: ${r.fontSize}px;line-height: ${r.lineHeight}px;white-space: pre;">`+this._getHTMLToCopy(n,s)+"</div>"}}_getHTMLToCopy(e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn,l=this.getTabSize(),c="";for(let u=o;u<=r;u++){let p=this.model.tokenization.getLineTokens(u),h=p.getLineContent(),g=u===o?n-1:0,f=u===r?s-1:h.length;h===""?c+="<br>":c+=bxt(h,p.inflate(),t,g,f,l,ii)}return c}_getColorMap(){let e=vc.getColorMap(),t=["#000000"];if(e)for(let o=1,n=e.length;o<n;o++)t[o]=Ue.Format.CSS.formatHex(e[o]);return t}getPrimaryCursorState(){return this._cursor.getPrimaryCursorState()}getLastAddedCursorIndex(){return this._cursor.getLastAddedCursorIndex()}getCursorStates(){return this._cursor.getCursorStates()}setCursorStates(e,t,o){return this._withViewEventsCollector(n=>this._cursor.setStates(n,e,t,o))}getCursorColumnSelectData(){return this._cursor.getCursorColumnSelectData()}getCursorAutoClosedCharacters(){return this._cursor.getAutoClosedCharacters()}setCursorColumnSelectData(e){this._cursor.setCursorColumnSelectData(e)}getPrevEditOperationType(){return this._cursor.getPrevEditOperationType()}setPrevEditOperationType(e){this._cursor.setPrevEditOperationType(e)}getSelection(){return this._cursor.getSelection()}getSelections(){return this._cursor.getSelections()}getPosition(){return this._cursor.getPrimaryCursorState().modelState.position}setSelections(e,t,o=0){this._withViewEventsCollector(n=>this._cursor.setSelections(n,e,t,o))}saveCursorState(){return this._cursor.saveState()}restoreCursorState(e){this._withViewEventsCollector(t=>this._cursor.restoreState(t,e))}_executeCursorEdit(e){if(this._cursor.context.cursorConfig.readOnly){this._eventDispatcher.emitOutgoingEvent(new axt);return}this._withViewEventsCollector(e)}executeEdits(e,t,o,n){this._executeCursorEdit(r=>this._cursor.executeEdits(r,e,t,o,n))}startComposition(){this._executeCursorEdit(e=>this._cursor.startComposition(e))}endComposition(e){this._executeCursorEdit(t=>this._cursor.endComposition(t,e))}type(e,t){this._executeCursorEdit(o=>this._cursor.type(o,e,t))}compositionType(e,t,o,n,r){this._executeCursorEdit(s=>this._cursor.compositionType(s,e,t,o,n,r))}paste(e,t,o,n){this._executeCursorEdit(r=>this._cursor.paste(r,e,t,o,n))}cut(e){this._executeCursorEdit(t=>this._cursor.cut(t,e))}executeCommand(e,t){this._executeCursorEdit(o=>this._cursor.executeCommand(o,e,t))}executeCommands(e,t){this._executeCursorEdit(o=>this._cursor.executeCommands(o,e,t))}revealAllCursors(e,t,o=!1){this._withViewEventsCollector(n=>this._cursor.revealAll(n,e,o,0,t,0))}revealPrimaryCursor(e,t,o=!1){this._withViewEventsCollector(n=>this._cursor.revealPrimary(n,e,o,0,t,0))}revealTopMostCursor(e){let t=this._cursor.getTopMostViewPosition(),o=new G(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new b5(e,!1,o,null,0,!0,0)))}revealBottomMostCursor(e){let t=this._cursor.getBottomMostViewPosition(),o=new G(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new b5(e,!1,o,null,0,!0,0)))}revealRange(e,t,o,n,r){this._withViewEventsCollector(s=>s.emitViewEvent(new b5(e,!1,o,null,n,t,r)))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new fIt),this._eventDispatcher.emitOutgoingEvent(new nxt))}_withViewEventsCollector(e){return this._transactionalTarget.batchChanges(()=>this._emitViewEvent(e))}_emitViewEvent(e){try{let t=this._eventDispatcher.beginEmitViewEvents();return e(t)}finally{this._eventDispatcher.endEmitViewEvents()}}batchEvents(e){this._withViewEventsCollector(()=>{e()})}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}},Zli=class a{constructor(i,e,t,o,n){this._model=i;this._viewLineNumber=e;this._isValid=t;this._modelTrackedRange=o;this._startLineDelta=n}static create(i){let e=i._setTrackedRange(null,new G(1,1,1,1),1);return new a(i,1,!1,e,0)}get viewLineNumber(){return this._viewLineNumber}get isValid(){return this._isValid}get modelTrackedRange(){return this._modelTrackedRange}get startLineDelta(){return this._startLineDelta}dispose(){this._model._setTrackedRange(this._modelTrackedRange,null,1)}update(i,e){let t=i.coordinatesConverter.convertViewPositionToModelPosition(new ye(e,i.getLineMinColumn(e))),o=i.model._setTrackedRange(this._modelTrackedRange,new G(t.lineNumber,t.column,t.lineNumber,t.column),1),n=i.viewLayout.getVerticalOffsetForLineNumber(e),r=i.viewLayout.getCurrentScrollTop();this._viewLineNumber=e,this._isValid=!0,this._modelTrackedRange=o,this._startLineDelta=r-n}invalidate(){this._isValid=!1}},eci=class{constructor(){this._asMap=Object.create(null);this.asArray=[]}accept(i,e,t,o,n){let r=this._asMap[i];if(r){let s=r.data,l=s[s.length-3],c=s[s.length-1];if(l===n&&c+1>=t){o>c&&(s[s.length-1]=o);return}s.push(n,t,o)}else{let s=new ade(i,e,[n,t,o]);this._asMap[i]=s,this.asArray.push(s)}}},tci=class{constructor(){this.hiddenAreas=new Map;this.shouldRecompute=!1;this.ranges=[]}setHiddenAreas(i,e){let t=this.hiddenAreas.get(i);t&&gJi(t,e)||(this.hiddenAreas.set(i,e),this.shouldRecompute=!0)}getMergedRanges(){if(!this.shouldRecompute)return this.ranges;this.shouldRecompute=!1;let i=Array.from(this.hiddenAreas.values()).reduce((e,t)=>e$o(e,t),[]);return gJi(this.ranges,i)?this.ranges:(this.ranges=i,this.ranges)}};function e$o(a,i){let e=[],t=0,o=0;for(;t<a.length&&o<i.length;){let n=a[t],r=i[o];if(n.endLineNumber<r.startLineNumber-1)e.push(a[t++]);else if(r.endLineNumber<n.startLineNumber-1)e.push(i[o++]);else{let s=Math.min(n.startLineNumber,r.startLineNumber),l=Math.max(n.endLineNumber,r.endLineNumber);e.push(new G(s,1,l,1)),t++,o++}}for(;t<a.length;)e.push(a[t++]);for(;o<i.length;)e.push(i[o++]);return e}function gJi(a,i){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(!a[e].equalsRange(i[e]))return!1;return!0}var Mxt=class{constructor(i,e){this.viewportStartModelPosition=i;this.startLineDelta=e}recoverViewportStart(i,e){if(!this.viewportStartModelPosition)return;let t=i.convertModelPositionToViewPosition(this.viewportStartModelPosition),o=e.getVerticalOffsetForLineNumber(t.lineNumber);e.setScrollPosition({scrollTop:o+this.startLineDelta},1)}};var Po=class{constructor(...i){this._entries=new Map;for(let[e,t]of i)this.set(e,t)}set(i,e){let t=this._entries.get(i);return this._entries.set(i,e),t}has(i){return this._entries.has(i)}get(i){return this._entries.get(i)}};var us=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.languageConfigurationService=h;this._deliveryQueue=k3i();this._contributions=this._register(new ICt);this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event;this._onDidChangeModelContent=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelContent=this._onDidChangeModelContent.event;this._onDidChangeModelLanguage=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event;this._onDidChangeModelLanguageConfiguration=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event;this._onDidChangeModelOptions=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelOptions=this._onDidChangeModelOptions.event;this._onDidChangeModelDecorations=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event;this._onDidChangeLineHeight=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeLineHeight=this._onDidChangeLineHeight.event;this._onDidChangeFont=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeFont=this._onDidChangeFont.event;this._onDidChangeModelTokens=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeModelTokens=this._onDidChangeModelTokens.event;this._onDidChangeConfiguration=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._onWillChangeModel=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onWillChangeModel=this._onWillChangeModel.event;this._onDidChangeModel=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeModel=this._onDidChangeModel.event;this._onDidChangeCursorPosition=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event;this._onDidChangeCursorSelection=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event;this._onDidAttemptReadOnlyEdit=this._register(new Kb(this._contributions,this._deliveryQueue));this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event;this._onDidLayoutChange=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidLayoutChange=this._onDidLayoutChange.event;this._editorTextFocus=this._register(new Pxt({deliveryQueue:this._deliveryQueue}));this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue;this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse;this._editorWidgetFocus=this._register(new Pxt({deliveryQueue:this._deliveryQueue}));this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue;this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse;this._onWillType=this._register(new Kb(this._contributions,this._deliveryQueue));this.onWillType=this._onWillType.event;this._onDidType=this._register(new Kb(this._contributions,this._deliveryQueue));this.onDidType=this._onDidType.event;this._onDidCompositionStart=this._register(new Kb(this._contributions,this._deliveryQueue));this.onDidCompositionStart=this._onDidCompositionStart.event;this._onDidCompositionEnd=this._register(new Kb(this._contributions,this._deliveryQueue));this.onDidCompositionEnd=this._onDidCompositionEnd.event;this._onDidPaste=this._register(new Kb(this._contributions,this._deliveryQueue));this.onDidPaste=this._onDidPaste.event;this._onWillCopy=this._register(new Kb(this._contributions,this._deliveryQueue));this.onWillCopy=this._onWillCopy.event;this._onWillCut=this._register(new Kb(this._contributions,this._deliveryQueue));this.onWillCut=this._onWillCut.event;this._onWillPaste=this._register(new Kb(this._contributions,this._deliveryQueue));this.onWillPaste=this._onWillPaste.event;this._onMouseUp=this._register(new Kb(this._contributions,this._deliveryQueue));this.onMouseUp=this._onMouseUp.event;this._onMouseDown=this._register(new Kb(this._contributions,this._deliveryQueue));this.onMouseDown=this._onMouseDown.event;this._onMouseDrag=this._register(new Kb(this._contributions,this._deliveryQueue));this.onMouseDrag=this._onMouseDrag.event;this._onMouseDrop=this._register(new Kb(this._contributions,this._deliveryQueue));this.onMouseDrop=this._onMouseDrop.event;this._onMouseDropCanceled=this._register(new Kb(this._contributions,this._deliveryQueue));this.onMouseDropCanceled=this._onMouseDropCanceled.event;this._onDropIntoEditor=this._register(new Kb(this._contributions,this._deliveryQueue));this.onDropIntoEditor=this._onDropIntoEditor.event;this._onContextMenu=this._register(new Kb(this._contributions,this._deliveryQueue));this.onContextMenu=this._onContextMenu.event;this._onMouseMove=this._register(new Kb(this._contributions,this._deliveryQueue));this.onMouseMove=this._onMouseMove.event;this._onMouseLeave=this._register(new Kb(this._contributions,this._deliveryQueue));this.onMouseLeave=this._onMouseLeave.event;this._onMouseWheel=this._register(new Kb(this._contributions,this._deliveryQueue));this.onMouseWheel=this._onMouseWheel.event;this._onKeyUp=this._register(new Kb(this._contributions,this._deliveryQueue));this.onKeyUp=this._onKeyUp.event;this._onKeyDown=this._register(new Kb(this._contributions,this._deliveryQueue));this.onKeyDown=this._onKeyDown.event;this._onDidContentSizeChange=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidContentSizeChange=this._onDidContentSizeChange.event;this._onDidScrollChange=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidScrollChange=this._onDidScrollChange.event;this._onDidChangeViewZones=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeViewZones=this._onDidChangeViewZones.event;this._onDidChangeHiddenAreas=this._register(new T({deliveryQueue:this._deliveryQueue}));this.onDidChangeHiddenAreas=this._onDidChangeHiddenAreas.event;this._updateCounter=0;this._onWillTriggerEditorOperationEvent=this._register(new T);this.onWillTriggerEditorOperationEvent=this._onWillTriggerEditorOperationEvent.event;this._onBeginUpdate=this._register(new T);this.onBeginUpdate=this._onBeginUpdate.event;this._onEndUpdate=this._register(new T);this.onEndUpdate=this._onEndUpdate.event;this._onBeforeExecuteEdit=this._register(new T);this.onBeforeExecuteEdit=this._onBeforeExecuteEdit.event;this._actions=new Map;this._bannerDomNode=null;this._dropIntoEditorDecorations=this.createDecorationsCollection();this.inComposition=!1;r.willCreateCodeEditor();let v={...t};if(this._domElement=e,this._userInteractionService=f,this._overflowWidgetsDomNode=v.overflowWidgetsDomNode,delete v.overflowWidgetsDomNode,this._id=++i$o,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this._telemetryData=o.telemetryData,this._configuration=this._register(this._createConfiguration(o.isSimpleWidget||!1,o.contextMenuId??(o.isSimpleWidget?R.SimpleEditorContext:R.EditorContext),v,p)),this._domElement.style?.setProperty("--editor-font-size",this._configuration.options.get(61)+"px"),this._register(this._configuration.onDidChange(y=>{this._onDidChangeConfiguration.fire(y);let w=this._configuration.options;if(y.hasChanged(165)){let x=w.get(165);this._onDidLayoutChange.fire(x)}y.hasChanged(61)&&this._domElement.style.setProperty("--editor-font-size",w.get(61)+"px")})),this._contextKeyService=this._register(l.createScoped(this._domElement)),o.contextKeyValues)for(let[y,w]of Object.entries(o.contextKeyValues))this._contextKeyService.createKey(y,w);this._notificationService=u,this._codeEditorService=r,this._commandService=s,this._themeService=c,this._register(new oci(this,this._contextKeyService)),this._register(new nci(this,this._contextKeyService,g)),this._instantiationService=this._register(n.createChild(new Po([X,this._contextKeyService]))),this._modelData=null,this._contentWidgets={},this._overlayWidgets={},this._glyphMarginWidgets={};let b;Array.isArray(o.contributions)?b=o.contributions:b=ml.getEditorContributions(),this._contributions.initialize(this,b,this._instantiationService);for(let y of ml.getEditorActions()){if(this._actions.has(y.id)){mt(new Error(`Cannot have two actions with the same id ${y.id}`));continue}let w=new yCt(y.id,y.label,y.alias,y.metadata,y.precondition??void 0,x=>this._instantiationService.invokeFunction(E=>Promise.resolve(y.runEditorCommand(E,this,x))),this._contextKeyService);this._actions.set(w.id,w)}let S=()=>!this._configuration.options.get(104)&&this._configuration.options.get(43).enabled;this._register(new wg(this._domElement,{onDragOver:y=>{if(!S())return;let w=this.getTargetAtClientPoint(y.clientX,y.clientY);w?.position&&this.showDropIndicatorAt(w.position)},onDrop:async y=>{if(!S()||(this.removeDropIndicator(),!y.dataTransfer))return;let w=this.getTargetAtClientPoint(y.clientX,y.clientY);w?.position&&this._onDropIntoEditor.fire({position:w.position,event:y})},onDragLeave:()=>{this.removeDropIndicator()},onDragEnd:()=>{this.removeDropIndicator()}})),this._codeEditorService.addCodeEditor(this)}static{this.dropIntoEditorDecorationOptions=So.register({description:"workbench-dnd-target",className:"dnd-target"})}get isSimpleWidget(){return this._configuration.isSimpleWidget}get contextMenuId(){return this._configuration.contextMenuId}get contextKeyService(){return this._contextKeyService}writeScreenReaderContent(e){this._modelData?.view.writeScreenReaderContent(e)}_createConfiguration(e,t,o,n){return new eX(e,t,o,this._domElement,n)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return v5.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._actions.clear(),this._contentWidgets={},this._overlayWidgets={},this._removeDecorationTypes(),this._postDetachModelCleanup(this._detachModel()),this._onDidDispose.fire(),super.dispose()}invokeWithinContext(e){return this._instantiationService.invokeFunction(e)}updateOptions(e){this._configuration.updateOptions(e||{})}getOptions(){return this._configuration.options}getOption(e){return this._configuration.options.get(e)}getRawOptions(){return this._configuration.getRawOptions()}getOverflowWidgetsDomNode(){return this._overflowWidgetsDomNode}getConfiguredWordAtPosition(e){return this._modelData?fv.getWordAtPosition(this._modelData.model,this._configuration.options.get(148),this._configuration.options.get(147),e):null}getValue(e=null){if(!this._modelData)return"";let t=!!(e&&e.preserveBOM),o=0;return e&&e.lineEnding&&e.lineEnding===`
`?o=1:e&&e.lineEnding&&e.lineEnding===`\r
`&&(o=2),this._modelData.model.getValue(o,t)}setValue(e){try{if(this._beginUpdate(),!this._modelData)return;this._modelData.model.setValue(e)}finally{this._endUpdate()}}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){try{this._beginUpdate();let t=e;if(this._modelData===null&&t===null||this._modelData&&this._modelData.model===t)return;let o={oldModelUrl:this._modelData?.model.uri||null,newModelUrl:t?.uri||null};this._onWillChangeModel.fire(o);let n=this.hasTextFocus(),r=this._detachModel();this._attachModel(t),this.hasModel()?n&&this.focus():(this._editorTextFocus.setValue(!1),this._editorWidgetFocus.setValue(!1)),this._removeDecorationTypes(),this._onDidChangeModel.fire(o),this._postDetachModelCleanup(r),this._contributionsDisposable=this._contributions.onAfterModelAttached()}finally{this._endUpdate()}}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(let e in this._decorationTypeSubtypes){let t=this._decorationTypeSubtypes[e];for(let o in t)this._removeDecorationType(e+"-"+o)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetAfterPosition(e,t,o,n){let r=e.model.validatePosition({lineNumber:t,column:o}),s=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(r);return e.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(s.lineNumber,n)}getTopForLineNumber(e,t=!1){return this._modelData?us._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?us._getVerticalOffsetForPosition(this._modelData,e,t,!1):-1}static _getVerticalOffsetForPosition(e,t,o,n=!1){let r=e.model.validatePosition({lineNumber:t,column:o}),s=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(r);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(s.lineNumber,n)}getBottomForLineNumber(e,t=!1){return this._modelData?us._getVerticalOffsetAfterPosition(this._modelData,e,Number.MAX_SAFE_INTEGER,t):-1}getLineHeightForPosition(e){if(!this._modelData)return-1;let t=this._modelData.viewModel,o=t.coordinatesConverter,n=ye.lift(e);if(o.modelPositionIsVisible(n)){let r=o.convertModelPositionToViewPosition(n);return t.viewLayout.getLineHeightForLineNumber(r.lineNumber)}return 0}setHiddenAreas(e,t,o){this._modelData?.viewModel.setHiddenAreas(e.map(n=>G.lift(n)),t,o)}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;let t=this._modelData.model.validatePosition(e),o=this._modelData.model.getOptions().tabSize;return Ll.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,o)+1}getStatusbarColumn(e){if(!this._modelData)return e.column;let t=this._modelData.model.validatePosition(e),o=this._modelData.model.getOptions().tabSize;return Ll.toStatusbarColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,o)}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!ye.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,o,n){if(!this._modelData)return;if(!G.isIRange(e))throw new Error("Invalid arguments");let r=this._modelData.model.validateRange(e),s=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(r);this._modelData.viewModel.revealRange("api",o,s,t,n)}revealAllCursors(e,t){this._modelData&&this._modelData.viewModel.revealAllCursors("api",e,t)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,o){if(typeof e!="number")throw new Error("Invalid arguments");this._sendRevealRange(new G(e,1,e,1),t,!1,o)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,o,n){if(!ye.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new G(e.lineNumber,e.column,e.lineNumber,e.column),t,o,n)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){let o=ei.isISelection(e),n=G.isIRange(e);if(!o&&!n)throw new Error("Invalid arguments");if(o)this._setSelectionImpl(e,t);else if(n){let r={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(r,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;let o=new ei(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[o])}revealLines(e,t,o=0){this._revealLines(e,t,0,o)}revealLinesInCenter(e,t,o=0){this._revealLines(e,t,1,o)}revealLinesInCenterIfOutsideViewport(e,t,o=0){this._revealLines(e,t,2,o)}revealLinesNearTop(e,t,o=0){this._revealLines(e,t,5,o)}_revealLines(e,t,o,n){if(typeof e!="number"||typeof t!="number")throw new Error("Invalid arguments");this._sendRevealRange(new G(e,1,t,1),o,!1,n)}revealRange(e,t=0,o=!1,n=!0){this._revealRange(e,o?1:0,n,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,o,n){if(!G.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange(G.lift(e),t,o,n)}setSelections(e,t="api",o=0){if(this._modelData){if(!e||e.length===0)throw new Error("Invalid arguments");for(let n=0,r=e.length;n<r;n++)if(!ei.isISelection(e[n]))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,e,o)}}getContentWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getContentWidth():-1}getScrollWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollWidth():-1}getScrollLeft(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollLeft():-1}getContentHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getContentHeight():-1}getScrollHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollHeight():-1}getScrollTop(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollTop():-1}setScrollLeft(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollLeft:e},t)}}setScrollTop(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollTop:e},t)}}setScrollPosition(e,t=1){this._modelData&&this._modelData.viewModel.viewLayout.setScrollPosition(e,t)}hasPendingScrollAnimation(){return this._modelData?this._modelData.viewModel.viewLayout.hasPendingScrollAnimation():!1}saveViewState(){if(!this._modelData)return null;let e=this._contributions.saveViewState(),t=this._modelData.viewModel.saveCursorState(),o=this._modelData.viewModel.saveState();return{cursorState:t,viewState:o,contributionsState:e}}restoreViewState(e){if(!this._modelData||!this._modelData.hasRealView)return;let t=e;if(t&&t.cursorState&&t.viewState){let o=t.cursorState;Array.isArray(o)?o.length>0&&this._modelData.viewModel.restoreCursorState(o):this._modelData.viewModel.restoreCursorState([o]),this._contributions.restoreViewState(t.contributionsState||{});let n=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(n)}}handleInitialized(){this._getViewModel()?.visibleLinesStabilized()}onVisible(){this._modelData?.view.refreshFocusState()}onHide(){this._modelData?.view.refreshFocusState()}getContribution(e){return this._contributions.get(e)}getActions(){return Array.from(this._actions.values())}getSupportedActions(){let e=this.getActions();return e=e.filter(t=>t.isSupported()),e}getAction(e){return this._actions.get(e)||null}trigger(e,t,o){o=o||{};try{switch(this._onWillTriggerEditorOperationEvent.fire({source:e,handlerId:t,payload:o}),this._beginUpdate(),t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{let r=o;this._type(e,r.text||"");return}case"replacePreviousChar":{let r=o;this._compositionType(e,r.text||"",r.replaceCharCnt||0,0,0);return}case"compositionType":{let r=o;this._compositionType(e,r.text||"",r.replacePrevCharCnt||0,r.replaceNextCharCnt||0,r.positionDelta||0);return}case"paste":{let r=o;this._paste(e,r.text||"",r.pasteOnNewLine||!1,r.multicursorText||null,r.mode||null,r.clipboardEvent);return}case"cut":this._cut(e);return}let n=this.getAction(t);if(n){Promise.resolve(n.run(o)).then(void 0,mt);return}if(!this._modelData||this._triggerEditorCommand(e,t,o))return;this._triggerCommand(t,o)}finally{this._endUpdate()}}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this.inComposition=!0,this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this.inComposition=!1,this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){!this._modelData||t.length===0||(e==="keyboard"&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),e==="keyboard"&&this._onDidType.fire(t))}_compositionType(e,t,o,n,r){this._modelData&&this._modelData.viewModel.compositionType(t,o,n,r,e)}_paste(e,t,o,n,r,s){if(!this._modelData)return;let l=this._modelData.viewModel,c=l.getSelection().getStartPosition();l.paste(t,o,n,e);let u=l.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({clipboardEvent:s,range:new G(c.lineNumber,c.column,u.lineNumber,u.column),languageId:r})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,o){let n=ml.getEditorCommand(t);return n?(o=o||{},Di(o)&&(o.source=e),this._instantiationService.invokeFunction(r=>{Promise.resolve(n.runEditorCommand(r,this,o)).then(void 0,mt)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.popStackElement(),!0)}edit(e,t){return this.executeEdits(t,e.replacements.map(o=>({range:o.range,text:o.text})),void 0)}executeEdits(e,t,o){if(!this._modelData||this._configuration.options.get(104))return!1;let n;o?Array.isArray(o)?n=()=>o:n=o:n=()=>null;let r,s;return e instanceof c8e?(s=e,r=e.metadata.source):(s=sd.unknown({name:e}),r=e),this._onBeforeExecuteEdit.fire({source:r??void 0}),this._modelData.viewModel.executeEdits(r,t,n,s),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}createDecorationsCollection(e){return new rci(this,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){if(!this._modelData)return null;let t=this._configuration.options;return this._modelData.model.getLineDecorations(e,this._id,ace(t),lce(t))}getDecorationsInRange(e){if(!this._modelData)return null;let t=this._configuration.options;return this._modelData.model.getDecorationsInRange(e,this._id,ace(t),lce(t))}getFontSizeAtPosition(e){return this._modelData?this._modelData.viewModel.getFontSizeAtPosition(e):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){!this._modelData||e.length===0||this._modelData.model.changeDecorations(t=>{t.deltaDecorations(e,[])})}setDecorationsByType(e,t,o){let n={},r=this._decorationTypeSubtypes[t]||{};this._decorationTypeSubtypes[t]=n;let s=[];for(let c of o){let u=t;if(c.renderOptions){let h=Lr(c.renderOptions).toString(16);u=t+"-"+h,!r[h]&&!n[h]&&this._registerDecorationType(e,u,c.renderOptions,t),n[h]=!0}let p=this._resolveDecorationOptions(u,!!c.hoverMessage);c.hoverMessage&&(p.hoverMessage=c.hoverMessage),s.push({range:c.range,options:p})}for(let c in r)n[c]||this._removeDecorationType(t+"-"+c);let l=this._decorationTypeKeysToIds[t]||[];return this.changeDecorations(c=>this._decorationTypeKeysToIds[t]=c.deltaDecorations(l,s)),this._decorationTypeKeysToIds[t]||[]}setDecorationsByTypeFast(e,t){let o=this._decorationTypeSubtypes[e]||{};for(let l in o)this._removeDecorationType(e+"-"+l);this._decorationTypeSubtypes[e]={};let n=So.createDynamic(this._resolveDecorationOptions(e,!1)),r=new Array(t.length);for(let l=0,c=t.length;l<c;l++)r[l]={range:t[l],options:n};let s=this._decorationTypeKeysToIds[e]||[];this.changeDecorations(l=>this._decorationTypeKeysToIds[e]=l.deltaDecorations(s,r))}removeDecorationsByType(e){let t=this._decorationTypeKeysToIds[e];if(t&&this.changeDecorations(o=>o.deltaDecorations(t,[])),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)){let o=this._decorationTypeSubtypes[e];for(let n of Object.keys(o))this._removeDecorationType(e+"-"+n);delete this._decorationTypeSubtypes[e]}}getLayoutInfo(){return this._configuration.options.get(165)}createOverviewRuler(e){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.createOverviewRuler(e)}getContainerDomNode(){return this._domElement}getDomNode(){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.domNode.domNode}delegateVerticalScrollbarPointerDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateScrollFromMouseWheelEvent(e)}layout(e,t=!1){this._configuration.observeContainer(e),t||this.render()}focus(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.focus()}hasTextFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isFocused()}hasWidgetFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isWidgetFocused()}addContentWidget(e){let t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id:"+e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let o=this._contentWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(o)}}removeContentWidget(e){let t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){let o=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(o)}}addOverlayWidget(e){let t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting an overlay widget with the same id."),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let o=this._overlayWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(o)}}removeOverlayWidget(e){let t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){let o=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(o)}}addGlyphMarginWidget(e){let t={widget:e,position:e.getPosition()};this._glyphMarginWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a glyph margin widget with the same id."),this._glyphMarginWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addGlyphMarginWidget(t)}layoutGlyphMarginWidget(e){let t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){let o=this._glyphMarginWidgets[t];o.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutGlyphMarginWidget(o)}}removeGlyphMarginWidget(e){let t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){let o=this._glyphMarginWidgets[t];delete this._glyphMarginWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeGlyphMarginWidget(o)}}changeViewZones(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.getTargetAtClientPoint(e,t)}getScrolledVisiblePosition(e){if(!this._modelData||!this._modelData.hasRealView)return null;let t=this._modelData.model.validatePosition(e),n=this._configuration.options.get(165),r=us._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),s=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+n.glyphMarginWidth+n.lineNumbersWidth+n.decorationsWidth-this.getScrollLeft(),l=this.getLineHeightForPosition(t);return{top:r,left:s,height:l}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}getWidthOfLine(e){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getLineWidth(e)}resetLineWidthCaches(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.resetLineWidthCaches()}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!0,e)})}renderAsync(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!1,e)})}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){ku(e,this._configuration.options.get(59))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e){this._modelData=null;return}let t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount());let o=e.onBeforeAttached(),n=new Lxt(this._id,this._configuration,e,SCt.create(Me(this._domElement)),ZCt.create(this._configuration.options),l=>kr(Me(this._domElement),l),this.languageConfigurationService,this._themeService,o,{batchChanges:l=>{try{return this._beginUpdate(),l()}finally{this._endUpdate()}}});t.push(e.onWillDispose(()=>this.setModel(null))),t.push(n.onEvent(l=>{switch(l.kind){case 0:this._onDidContentSizeChange.fire(l);break;case 1:this._editorTextFocus.setValue(l.hasFocus);break;case 2:this._editorWidgetFocus.setValue(l.hasFocus);break;case 3:this._onDidScrollChange.fire(l);break;case 4:this._onDidChangeViewZones.fire();break;case 5:this._onDidChangeHiddenAreas.fire();break;case 6:this._onDidAttemptReadOnlyEdit.fire();break;case 7:{if(l.reachedMaxCursorCount){let h=this.getOption(89),g=d(206,null,h);this._notificationService.prompt(ft.Warning,g,[{label:"Find and Replace",run:()=>{this._commandService.executeCommand("editor.action.startFindReplaceAction")}},{label:d(207,null),run:()=>{this._commandService.executeCommand("workbench.action.openSettings2",{query:"editor.multiCursorLimit"})}}])}let c=[];for(let h=0,g=l.selections.length;h<g;h++)c[h]=l.selections[h].getPosition();let u={position:c[0],secondaryPositions:c.slice(1),reason:l.reason,source:l.source};this._onDidChangeCursorPosition.fire(u);let p={selection:l.selections[0],secondarySelections:l.selections.slice(1),modelVersionId:l.modelVersionId,oldSelections:l.oldSelections,oldModelVersionId:l.oldModelVersionId,source:l.source,reason:l.reason};this._onDidChangeCursorSelection.fire(p);break}case 8:this._onDidChangeModelDecorations.fire(l.event);break;case 9:this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._onDidChangeModelLanguage.fire(l.event);break;case 10:this._onDidChangeModelLanguageConfiguration.fire(l.event);break;case 11:this._onDidChangeModelContent.fire(l.event);break;case 12:this._onDidChangeModelOptions.fire(l.event);break;case 13:this._onDidChangeModelTokens.fire(l.event);break;case 14:this._onDidChangeLineHeight.fire(l.event);break;case 15:this._onDidChangeFont.fire(l.event);break}}));let[r,s]=this._createView(n);if(s){this._domElement.appendChild(r.domNode.domNode);let l=Object.keys(this._contentWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addContentWidget(this._contentWidgets[p])}l=Object.keys(this._overlayWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addOverlayWidget(this._overlayWidgets[p])}l=Object.keys(this._glyphMarginWidgets);for(let c=0,u=l.length;c<u;c++){let p=l[c];r.addGlyphMarginWidget(this._glyphMarginWidgets[p])}r.render(!1,!0),r.domNode.domNode.setAttribute("data-uri",e.uri.toString()),t.push(r.onWillCopy(c=>this._onWillCopy.fire(c))),t.push(r.onWillCut(c=>this._onWillCut.fire(c))),t.push(r.onWillPaste(c=>this._onWillPaste.fire(c)))}this._modelData=new ici(e,n,r,s,t,o)}_createView(e){let t;this.isSimpleWidget?t={paste:(r,s,l,c)=>{this._paste("keyboard",r,s,l,c)},type:r=>{this._type("keyboard",r)},compositionType:(r,s,l,c)=>{this._compositionType("keyboard",r,s,l,c)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(r,s,l,c)=>{let u={text:r,pasteOnNewLine:s,multicursorText:l,mode:c};this._commandService.executeCommand("paste",u)},type:r=>{let s={text:r};this._commandService.executeCommand("type",s)},compositionType:(r,s,l,c)=>{if(l||c){let u={text:r,replacePrevCharCnt:s,replaceNextCharCnt:l,positionDelta:c};this._commandService.executeCommand("compositionType",u)}else{let u={text:r,replaceCharCnt:s};this._commandService.executeCommand("replacePreviousChar",u)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};let o=new gxe(e.coordinatesConverter);return o.onKeyDown=r=>this._onKeyDown.fire(r),o.onKeyUp=r=>this._onKeyUp.fire(r),o.onContextMenu=r=>this._onContextMenu.fire(r),o.onMouseMove=r=>this._onMouseMove.fire(r),o.onMouseLeave=r=>this._onMouseLeave.fire(r),o.onMouseDown=r=>this._onMouseDown.fire(r),o.onMouseUp=r=>this._onMouseUp.fire(r),o.onMouseDrag=r=>this._onMouseDrag.fire(r),o.onMouseDrop=r=>this._onMouseDrop.fire(r),o.onMouseDropCanceled=r=>this._onMouseDropCanceled.fire(r),o.onMouseWheel=r=>this._onMouseWheel.fire(r),[new Wxe(this._domElement,this.getId(),t,this._configuration,this._themeService.getColorTheme(),e,o,this._overflowWidgetsDomNode,this._instantiationService,this._userInteractionService),!0]}_postDetachModelCleanup(e){e?.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(this._contributionsDisposable?.dispose(),this._contributionsDisposable=void 0,!this._modelData)return null;let e=this._modelData.model,t=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),t&&this._domElement.contains(t)&&t.remove(),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),e}_registerDecorationType(e,t,o,n){this._codeEditorService.registerDecorationType(e,t,o,n,this)}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}_resolveDecorationOptions(e,t){return this._codeEditorService.resolveDecorationOptions(e,t)}getTelemetryData(){return this._telemetryData}hasModel(){return this._modelData!==null}showDropIndicatorAt(e){let t=[{range:new G(e.lineNumber,e.column,e.lineNumber,e.column),options:us.dropIntoEditorDecorationOptions}];this._dropIntoEditorDecorations.set(t),this.revealPosition(e,1)}removeDropIndicator(){this._dropIntoEditorDecorations.clear()}setContextValue(e,t){this._contextKeyService.createKey(e,t)}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&this._onBeginUpdate.fire()}_endUpdate(){this._updateCounter--,this._updateCounter===0&&this._onEndUpdate.fire()}};us=I([m(3,F),m(4,Qt),m(5,fe),m(6,X),m(7,Pe),m(8,Ne),m(9,Ai),m(10,Us),m(11,Jt),m(12,ET)],us);var i$o=0,ici=class{constructor(i,e,t,o,n,r){this.model=i;this.viewModel=e;this.view=t;this.hasRealView=o;this.listenersToRemove=n;this.attachedView=r}dispose(){je(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}};var Pxt=class extends k{constructor(e){super();this._emitterOptions=e;this._onDidChangeToTrue=this._register(new T(this._emitterOptions)),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new T(this._emitterOptions)),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){let t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}},Kb=class extends T{constructor(e,t){super({deliveryQueue:t});this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}},oci=class extends k{constructor(i,e){super(),this._editor=i,e.createKey("editorId",i.getId()),this._editorSimpleInput=me.editorSimpleInput.bindTo(e),this._editorFocus=me.focus.bindTo(e),this._textInputFocus=me.textInputFocus.bindTo(e),this._editorTextFocus=me.editorTextFocus.bindTo(e),this._tabMovesFocus=me.tabMovesFocus.bindTo(e),this._editorReadonly=me.readOnly.bindTo(e),this._inDiffEditor=me.inDiffEditor.bindTo(e),this._editorColumnSelection=me.columnSelection.bindTo(e),this._hasMultipleSelections=me.hasMultipleSelections.bindTo(e),this._hasNonEmptySelection=me.hasNonEmptySelection.bindTo(e),this._canUndo=me.canUndo.bindTo(e),this._canRedo=me.canRedo.bindTo(e),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromConfig())),this._register(this._editor.onDidChangeCursorSelection(()=>this._updateFromSelection())),this._register(this._editor.onDidFocusEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidFocusEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidChangeModel(()=>this._updateFromModel())),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromModel())),this._register(vD.onDidChangeTabFocus(t=>this._tabMovesFocus.set(t))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){let i=this._editor.getOptions();this._tabMovesFocus.set(i.get(164)||vD.getTabFocusMode()),this._editorReadonly.set(i.get(104)),this._inDiffEditor.set(i.get(70)),this._editorColumnSelection.set(i.get(28))}_updateFromSelection(){let i=this._editor.getSelections();i?(this._hasMultipleSelections.set(i.length>1),this._hasNonEmptySelection.set(i.some(e=>!e.isEmpty()))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){let i=this._editor.getModel();this._canUndo.set(!!(i&&i.canUndo())),this._canRedo.set(!!(i&&i.canRedo()))}},nci=class extends k{constructor(e,t,o){super();this._editor=e;this._contextKeyService=t;this._languageFeaturesService=o;this._langId=me.languageId.bindTo(t),this._hasCompletionItemProvider=me.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=me.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=me.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=me.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=me.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=me.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=me.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=me.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=me.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=me.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=me.hasReferenceProvider.bindTo(t),this._hasRenameProvider=me.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=me.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=me.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=me.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=me.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=me.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=me.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=me.isInEmbeddedEditor.bindTo(t);let n=()=>this._update();this._register(e.onDidChangeModel(n)),this._register(e.onDidChangeModelLanguage(n)),this._register(o.completionProvider.onDidChange(n)),this._register(o.codeActionProvider.onDidChange(n)),this._register(o.codeLensProvider.onDidChange(n)),this._register(o.definitionProvider.onDidChange(n)),this._register(o.declarationProvider.onDidChange(n)),this._register(o.implementationProvider.onDidChange(n)),this._register(o.typeDefinitionProvider.onDidChange(n)),this._register(o.hoverProvider.onDidChange(n)),this._register(o.documentHighlightProvider.onDidChange(n)),this._register(o.documentSymbolProvider.onDidChange(n)),this._register(o.referenceProvider.onDidChange(n)),this._register(o.renameProvider.onDidChange(n)),this._register(o.documentFormattingEditProvider.onDidChange(n)),this._register(o.documentRangeFormattingEditProvider.onDidChange(n)),this._register(o.signatureHelpProvider.onDidChange(n)),this._register(o.inlayHintsProvider.onDidChange(n)),n()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents(()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInEmbeddedEditor.reset()})}_update(){let e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInEmbeddedEditor.set(e.uri.scheme===Q.walkThroughSnippet||e.uri.scheme===Q.vscodeChatCodeBlock)})}},rci=class{constructor(i,e){this._editor=i;this._decorationIds=[];this._isChangingDecorations=!1;Array.isArray(e)&&e.length>0&&this.set(e)}get length(){return this._decorationIds.length}onDidChange(i,e,t){return this._editor.onDidChangeModelDecorations(o=>{this._isChangingDecorations||i.call(e,o)},t)}getRange(i){return!this._editor.hasModel()||i>=this._decorationIds.length?null:this._editor.getModel().getDecorationRange(this._decorationIds[i])}getRanges(){if(!this._editor.hasModel())return[];let i=this._editor.getModel(),e=[];for(let t of this._decorationIds){let o=i.getDecorationRange(t);o&&e.push(o)}return e}has(i){return this._decorationIds.includes(i.id)}clear(){this._decorationIds.length!==0&&this.set([])}set(i){try{this._isChangingDecorations=!0,this._editor.changeDecorations(e=>{this._decorationIds=e.deltaDecorations(this._decorationIds,i)})}finally{this._isChangingDecorations=!1}return this._decorationIds}append(i){let e=[];try{this._isChangingDecorations=!0,this._editor.changeDecorations(t=>{e=t.deltaDecorations([],i),this._decorationIds=this._decorationIds.concat(e)})}finally{this._isChangingDecorations=!1}return e}},o$o=encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3' enable-background='new 0 0 6 3' height='3' width='6'><g fill='"),n$o=encodeURIComponent("'><polygon points='5.5,0 2.5,3 1.1,3 4.1,0'/><polygon points='4,0 6,2 6,0.6 5.4,0'/><polygon points='0,2 1,3 2.4,3 0,0.6'/></g></svg>");function lke(a){return o$o+encodeURIComponent(a.toString())+n$o}var r$o=encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" height="3" width="12"><g fill="'),s$o=encodeURIComponent('"><circle cx="1" cy="1" r="1"/><circle cx="5" cy="1" r="1"/><circle cx="9" cy="1" r="1"/></g></svg>');function fJi(a){return r$o+encodeURIComponent(a.toString())+s$o}hs((a,i)=>{let e=a.getColor($v);e&&(i.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${lke(e)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-error-decoration: url("data:image/svg+xml,${lke(e)}"); }`));let t=a.getColor(Tg);t&&(i.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${lke(t)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-warning-decoration: url("data:image/svg+xml,${lke(t)}"); }`));let o=a.getColor(eh);o&&(i.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${lke(o)}") repeat-x bottom left; }`),i.addRule(`:root { --monaco-editor-info-decoration: url("data:image/svg+xml,${lke(o)}"); }`));let n=a.getColor(z9i);n&&(i.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${fJi(n)}") no-repeat bottom left; }`),i.addRule(`:root { --monaco-editor-hint-decoration: url("data:image/svg+xml,${fJi(n)}"); }`));let r=a.getColor(JYi);r&&(i.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${r.rgba.a}; }`),i.addRule(`:root { --monaco-editor-unnecessary-decoration-opacity: ${r.rgba.a}; }`))});var a$o=!1;function DT(){return a$o}function sci(a){if(DT()){let i=l$o();return i.add(a),{dispose(){i.delete(a)}}}else return{dispose(){}}}function l$o(){Axt||(Axt=new Set);let a=globalThis;return a.$hotReload_applyNewExports||(a.$hotReload_applyNewExports=i=>{let e={config:{mode:void 0},...i},t=[];for(let o of Axt){let n=o(e);n&&t.push(n)}if(t.length>0)return o=>{let n=!1;for(let r of t)r(o)&&(n=!0);return n}}),Axt}var Axt;DT()&&sci(({oldExports:a,newSrc:i,config:e})=>{if(e.mode==="patch-prototype")return t=>{for(let o in t){let n=t[o];if(console.log(`[hot-reload] Patching prototype methods of '${o}'`,{exportedItem:n}),typeof n=="function"&&n.prototype){let r=a[o];if(r){for(let s of Object.getOwnPropertyNames(n.prototype)){let l=Object.getOwnPropertyDescriptor(n.prototype,s),c=Object.getOwnPropertyDescriptor(r.prototype,s);l?.value?.toString()!==c?.value?.toString()&&console.log(`[hot-reload] Patching prototype method '${o}.${s}'`),Object.defineProperty(r.prototype,s,l)}t[o]=r}}}return!0}});function zk(a,i){return c$o([a],i),a}function c$o(a,i){DT()&&qr("reload",t=>sci(({oldExports:o})=>{if([...Object.values(o)].some(n=>a.includes(n)))return n=>(t(void 0),!0)})).read(i)}var vJi=new Map;function TK(a){if(!DT())return Fo(a);let i=a.name,e=vJi.get(i);return e?setTimeout(()=>{e.set(a,void 0)},0):(e=De(i,a),vJi.set(i,e)),e}function hr(a,i,e,t=Dl.ofCaller()){return Mb({debugName:()=>`Configuration Key "${a}"`},o=>e.onDidChangeConfiguration(n=>{n.affectsConfiguration(a)&&o(n)}),()=>e.getValue(a)??i,t)}function cu(a,i,e,t=Dl.ofCaller()){let o=a.bindTo(i),n=new O;return Js({debugName:()=>`Set Context Key "${a.key}"`},r=>{let s=e(r);return o.set(s),s},t).recomputeInitiallyAndOnChange(n),n}var br=le("accessibilitySignalService"),SJi=Symbol("AcknowledgeDocCommentsToken"),cke=class extends k{constructor(e,t,o){super();this.configurationService=e;this.accessibilityService=t;this.telemetryService=o;this.sounds=new Map,this.screenReaderAttached=vi(this,this.accessibilityService.onDidChangeScreenReaderOptimized,()=>this.accessibilityService.isScreenReaderOptimized()),this.sentTelemetry=new Set,this.playingSounds=new Set,this._signalConfigValue=new xy(n=>hr(n.settingsKey,{sound:"off",announcement:"off"},this.configurationService)),this._signalEnabledState=new xy({getCacheKey:O8i},n=>ke(r=>{let s=this._signalConfigValue.get(n.signal).read(r);return!!((n.modality==="sound"||n.modality===void 0)&&(n.signal.managesOwnEnablement||bJi(s.sound,()=>this.screenReaderAttached.read(r),n.userGesture))||(n.modality==="announcement"||n.modality===void 0)&&bJi(s.announcement,()=>this.screenReaderAttached.read(r),n.userGesture))}).recomputeInitiallyAndOnChange(this._store))}getEnabledState(e,t,o){return new cF(this._signalEnabledState.get({signal:e,userGesture:t,modality:o}))}async playSignal(e,t={}){let o=t.modality==="announcement"||t.modality===void 0,n=t.customAlertMessage??e.announcementMessage;o&&this.isAnnouncementEnabled(e,t.userGesture)&&n&&this.accessibilityService.status(n),(t.modality==="sound"||t.modality===void 0)&&this.isSoundEnabled(e,t.userGesture)&&(this.sendSignalTelemetry(e,t.source),await this.playSound(e.sound.getSound(),t.allowManyInParallel))}async playSignals(e){for(let r of e)this.sendSignalTelemetry("signal"in r?r.signal:r,"source"in r?r.source:void 0);let t=e.map(r=>"signal"in r?r.signal:r),o=t.filter(r=>this.isAnnouncementEnabled(r)).map(r=>r.announcementMessage);o.length&&this.accessibilityService.status(o.join(", "));let n=new Set(t.filter(r=>this.isSoundEnabled(r)).map(r=>r.sound.getSound()));await Promise.all(Array.from(n).map(r=>this.playSound(r,!0)))}sendSignalTelemetry(e,t){let o=this.accessibilityService.isScreenReaderOptimized(),n=e.name+(t?`::${t}`:"")+(o?"{screenReaderOptimized}":"");this.sentTelemetry.has(n)||this.getVolumeInPercent()===0||(this.sentTelemetry.add(n),this.telemetryService.publicLog2("signal.played",{signal:e.name,source:t??"",isScreenReaderOptimized:o}))}getVolumeInPercent(){let e=this.configurationService.getValue("accessibility.signalOptions.volume");return typeof e!="number"?50:Math.max(Math.min(e,100),0)}async playSound(e,t=!1){if(!t&&this.playingSounds.has(e))return;this.playingSounds.add(e);let o=In.asBrowserUri(`vs/platform/accessibilitySignal/browser/media/${e.fileName}`).toString(!0);try{let n=this.sounds.get(o);if(n)n.volume=this.getVolumeInPercent()/100,n.currentTime=0,await n.play();else{let r=await d$o(o,this.getVolumeInPercent()/100);this.sounds.set(o,r)}}catch(n){n.message.includes("play() can only be initiated by a user gesture")||console.error("Error while playing sound",n)}finally{this.playingSounds.delete(e)}}playSignalLoop(e,t){let o=!0,n=()=>{o&&this.playSignal(e,{allowManyInParallel:!0}).finally(()=>{setTimeout(()=>{o&&n()},t)})};return n(),ee(()=>o=!1)}isAnnouncementEnabled(e,t){return e.announcementMessage?this._signalEnabledState.get({signal:e,userGesture:!!t,modality:"announcement"}).get():!1}isSoundEnabled(e,t){return this._signalEnabledState.get({signal:e,userGesture:!!t,modality:"sound"}).get()}onSoundEnabledChanged(e){return this.getEnabledState(e,!1).onDidChange}getDelayMs(e,t,o){if(!this.configurationService.getValue("accessibility.signalOptions.debouncePositionChanges"))return 0;let n;return e.name===tn.errorAtPosition.name&&o==="positional"?n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.errorAtPosition"):e.name===tn.warningAtPosition.name&&o==="positional"?n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.warningAtPosition"):n=this.configurationService.getValue("accessibility.signalOptions.experimental.delays.general"),t==="sound"?n.sound:n.announcement}};cke=I([m(0,B),m(1,Ai),m(2,_e)],cke);function bJi(a,i,e){return a==="on"||a==="always"||a==="auto"&&i()||a==="userGesture"&&e}async function d$o(a,i){let e=new O;try{return await u$o(a,i,e)}finally{e.dispose()}}function u$o(a,i,e){return new Promise((t,o)=>{let n=new Audio(a);n.volume=i,e.add($(n,"ended",()=>{t(n)})),e.add($(n,"error",r=>{o(r.error)})),n.play().catch(r=>{o(r)})})}var Bd=class a{constructor(i){this.fileName=i}static register(i){return new a(i.fileName)}static{this.error=a.register({fileName:"error.mp3"})}static{this.warning=a.register({fileName:"warning.mp3"})}static{this.success=a.register({fileName:"success.mp3"})}static{this.foldedArea=a.register({fileName:"foldedAreas.mp3"})}static{this.break=a.register({fileName:"break.mp3"})}static{this.quickFixes=a.register({fileName:"quickFixes.mp3"})}static{this.taskCompleted=a.register({fileName:"taskCompleted.mp3"})}static{this.taskFailed=a.register({fileName:"taskFailed.mp3"})}static{this.terminalBell=a.register({fileName:"terminalBell.mp3"})}static{this.diffLineInserted=a.register({fileName:"diffLineInserted.mp3"})}static{this.diffLineDeleted=a.register({fileName:"diffLineDeleted.mp3"})}static{this.diffLineModified=a.register({fileName:"diffLineModified.mp3"})}static{this.requestSent=a.register({fileName:"requestSent.mp3"})}static{this.responseReceived1=a.register({fileName:"responseReceived1.mp3"})}static{this.responseReceived2=a.register({fileName:"responseReceived2.mp3"})}static{this.responseReceived3=a.register({fileName:"responseReceived3.mp3"})}static{this.responseReceived4=a.register({fileName:"responseReceived4.mp3"})}static{this.clear=a.register({fileName:"clear.mp3"})}static{this.save=a.register({fileName:"save.mp3"})}static{this.format=a.register({fileName:"format.mp3"})}static{this.voiceRecordingStarted=a.register({fileName:"voiceRecordingStarted.mp3"})}static{this.voiceRecordingStopped=a.register({fileName:"voiceRecordingStopped.mp3"})}static{this.progress=a.register({fileName:"progress.mp3"})}static{this.chatEditModifiedFile=a.register({fileName:"chatEditModifiedFile.mp3"})}static{this.editsKept=a.register({fileName:"editsKept.mp3"})}static{this.editsUndone=a.register({fileName:"editsUndone.mp3"})}static{this.nextEditSuggestion=a.register({fileName:"nextEditSuggestion.mp3"})}static{this.terminalCommandSucceeded=a.register({fileName:"terminalCommandSucceeded.mp3"})}static{this.chatUserActionRequired=a.register({fileName:"chatUserActionRequired.mp3"})}static{this.codeActionTriggered=a.register({fileName:"codeActionTriggered.mp3"})}static{this.codeActionApplied=a.register({fileName:"codeActionApplied.mp3"})}},aci=class{constructor(i){this.randomOneOf=i}getSound(i=!1){if(i||this.randomOneOf.length===1)return this.randomOneOf[0];{let e=Math.floor(Math.random()*this.randomOneOf.length);return this.randomOneOf[e]}}},tn=class a{constructor(i,e,t,o,n,r,s=!1){this.sound=i;this.name=e;this.legacySoundSettingsKey=t;this.settingsKey=o;this.legacyAnnouncementSettingsKey=n;this.announcementMessage=r;this.managesOwnEnablement=s}static{this._signals=new Set}static register(i){let e=new aci("randomOneOf"in i.sound?i.sound.randomOneOf:[i.sound]),t=new a(e,i.name,i.legacySoundSettingsKey,i.settingsKey,i.legacyAnnouncementSettingsKey,i.announcementMessage,i.managesOwnEnablement);return a._signals.add(t),t}static get allAccessibilitySignals(){return[...this._signals]}static{this.errorAtPosition=a.register({name:d(1803,null),sound:Bd.error,announcementMessage:d(1770,null),settingsKey:"accessibility.signals.positionHasError",delaySettingsKey:"accessibility.signalOptions.delays.errorAtPosition"})}static{this.warningAtPosition=a.register({name:d(1804,null),sound:Bd.warning,announcementMessage:d(1771,null),settingsKey:"accessibility.signals.positionHasWarning",delaySettingsKey:"accessibility.signalOptions.delays.warningAtPosition"})}static{this.errorOnLine=a.register({name:d(1794,null),sound:Bd.error,legacySoundSettingsKey:"audioCues.lineHasError",legacyAnnouncementSettingsKey:"accessibility.alert.error",announcementMessage:d(1762,null),settingsKey:"accessibility.signals.lineHasError"})}static{this.warningOnLine=a.register({name:d(1797,null),sound:Bd.warning,legacySoundSettingsKey:"audioCues.lineHasWarning",legacyAnnouncementSettingsKey:"accessibility.alert.warning",announcementMessage:d(1764,null),settingsKey:"accessibility.signals.lineHasWarning"})}static{this.foldedArea=a.register({name:d(1795,null),sound:Bd.foldedArea,legacySoundSettingsKey:"audioCues.lineHasFoldedArea",legacyAnnouncementSettingsKey:"accessibility.alert.foldedArea",announcementMessage:d(1763,null),settingsKey:"accessibility.signals.lineHasFoldedArea"})}static{this.break=a.register({name:d(1793,null),sound:Bd.break,legacySoundSettingsKey:"audioCues.lineHasBreakpoint",legacyAnnouncementSettingsKey:"accessibility.alert.breakpoint",announcementMessage:d(1761,null),settingsKey:"accessibility.signals.lineHasBreakpoint"})}static{this.inlineSuggestion=a.register({name:d(1796,null),sound:Bd.quickFixes,legacySoundSettingsKey:"audioCues.lineHasInlineSuggestion",settingsKey:"accessibility.signals.lineHasInlineSuggestion"})}static{this.nextEditSuggestion=a.register({name:d(1798,null),sound:Bd.nextEditSuggestion,legacySoundSettingsKey:"audioCues.nextEditSuggestion",settingsKey:"accessibility.signals.nextEditSuggestion",announcementMessage:d(1765,null)})}static{this.terminalQuickFix=a.register({name:d(1812,null),sound:Bd.quickFixes,legacySoundSettingsKey:"audioCues.terminalQuickFix",legacyAnnouncementSettingsKey:"accessibility.alert.terminalQuickFix",announcementMessage:d(1779,null),settingsKey:"accessibility.signals.terminalQuickFix"})}static{this.onDebugBreak=a.register({name:d(1802,null),sound:Bd.break,legacySoundSettingsKey:"audioCues.onDebugBreak",legacyAnnouncementSettingsKey:"accessibility.alert.onDebugBreak",announcementMessage:d(1769,null),settingsKey:"accessibility.signals.onDebugBreak"})}static{this.noInlayHints=a.register({name:d(1799,null),sound:Bd.error,legacySoundSettingsKey:"audioCues.noInlayHints",legacyAnnouncementSettingsKey:"accessibility.alert.noInlayHints",announcementMessage:d(1766,null),settingsKey:"accessibility.signals.noInlayHints"})}static{this.taskCompleted=a.register({name:d(1807,null),sound:Bd.taskCompleted,legacySoundSettingsKey:"audioCues.taskCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.taskCompleted",announcementMessage:d(1774,null),settingsKey:"accessibility.signals.taskCompleted"})}static{this.taskFailed=a.register({name:d(1808,null),sound:Bd.taskFailed,legacySoundSettingsKey:"audioCues.taskFailed",legacyAnnouncementSettingsKey:"accessibility.alert.taskFailed",announcementMessage:d(1775,null),settingsKey:"accessibility.signals.taskFailed"})}static{this.terminalCommandFailed=a.register({name:d(1810,null),sound:Bd.error,legacySoundSettingsKey:"audioCues.terminalCommandFailed",legacyAnnouncementSettingsKey:"accessibility.alert.terminalCommandFailed",announcementMessage:d(1777,null),settingsKey:"accessibility.signals.terminalCommandFailed"})}static{this.terminalCommandSucceeded=a.register({name:d(1811,null),sound:Bd.terminalCommandSucceeded,announcementMessage:d(1778,null),settingsKey:"accessibility.signals.terminalCommandSucceeded"})}static{this.terminalBell=a.register({name:d(1809,null),sound:Bd.terminalBell,legacySoundSettingsKey:"audioCues.terminalBell",legacyAnnouncementSettingsKey:"accessibility.alert.terminalBell",announcementMessage:d(1776,null),settingsKey:"accessibility.signals.terminalBell"})}static{this.notebookCellCompleted=a.register({name:d(1800,null),sound:Bd.taskCompleted,legacySoundSettingsKey:"audioCues.notebookCellCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellCompleted",announcementMessage:d(1767,null),settingsKey:"accessibility.signals.notebookCellCompleted"})}static{this.notebookCellFailed=a.register({name:d(1801,null),sound:Bd.taskFailed,legacySoundSettingsKey:"audioCues.notebookCellFailed",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellFailed",announcementMessage:d(1768,null),settingsKey:"accessibility.signals.notebookCellFailed"})}static{this.diffLineInserted=a.register({name:d(1788,null),sound:Bd.diffLineInserted,legacySoundSettingsKey:"audioCues.diffLineInserted",settingsKey:"accessibility.signals.diffLineInserted"})}static{this.diffLineDeleted=a.register({name:d(1787,null),sound:Bd.diffLineDeleted,legacySoundSettingsKey:"audioCues.diffLineDeleted",settingsKey:"accessibility.signals.diffLineDeleted"})}static{this.diffLineModified=a.register({name:d(1789,null),sound:Bd.diffLineModified,legacySoundSettingsKey:"audioCues.diffLineModified",settingsKey:"accessibility.signals.diffLineModified"})}static{this.chatEditModifiedFile=a.register({name:d(1780,null),sound:Bd.chatEditModifiedFile,announcementMessage:d(1753,null),settingsKey:"accessibility.signals.chatEditModifiedFile"})}static{this.chatRequestSent=a.register({name:d(1781,null),sound:Bd.requestSent,legacySoundSettingsKey:"audioCues.chatRequestSent",legacyAnnouncementSettingsKey:"accessibility.alert.chatRequestSent",announcementMessage:d(1754,null),settingsKey:"accessibility.signals.chatRequestSent"})}static{this.chatResponseReceived=a.register({name:d(1782,null),legacySoundSettingsKey:"audioCues.chatResponseReceived",sound:{randomOneOf:[Bd.responseReceived1,Bd.responseReceived2,Bd.responseReceived3,Bd.responseReceived4]},settingsKey:"accessibility.signals.chatResponseReceived"})}static{this.codeActionTriggered=a.register({name:d(1786,null),sound:Bd.codeActionTriggered,legacySoundSettingsKey:"audioCues.codeActionRequestTriggered",legacyAnnouncementSettingsKey:"accessibility.alert.codeActionRequestTriggered",announcementMessage:d(1757,null),settingsKey:"accessibility.signals.codeActionTriggered"})}static{this.codeActionApplied=a.register({name:d(1785,null),legacySoundSettingsKey:"audioCues.codeActionApplied",sound:Bd.codeActionApplied,settingsKey:"accessibility.signals.codeActionApplied"})}static{this.progress=a.register({name:d(1805,null),sound:Bd.progress,legacySoundSettingsKey:"audioCues.chatResponsePending",legacyAnnouncementSettingsKey:"accessibility.alert.progress",announcementMessage:d(1772,null),settingsKey:"accessibility.signals.progress"})}static{this.clear=a.register({name:d(1784,null),sound:Bd.clear,legacySoundSettingsKey:"audioCues.clear",legacyAnnouncementSettingsKey:"accessibility.alert.clear",announcementMessage:d(1756,null),settingsKey:"accessibility.signals.clear"})}static{this.save=a.register({name:d(1806,null),sound:Bd.save,legacySoundSettingsKey:"audioCues.save",legacyAnnouncementSettingsKey:"accessibility.alert.save",announcementMessage:d(1773,null),settingsKey:"accessibility.signals.save"})}static{this.format=a.register({name:d(1792,null),sound:Bd.format,legacySoundSettingsKey:"audioCues.format",legacyAnnouncementSettingsKey:"accessibility.alert.format",announcementMessage:d(1760,null),settingsKey:"accessibility.signals.format"})}static{this.voiceRecordingStarted=a.register({name:d(1813,null),sound:Bd.voiceRecordingStarted,legacySoundSettingsKey:"audioCues.voiceRecordingStarted",settingsKey:"accessibility.signals.voiceRecordingStarted"})}static{this.voiceRecordingStopped=a.register({name:d(1814,null),sound:Bd.voiceRecordingStopped,legacySoundSettingsKey:"audioCues.voiceRecordingStopped",settingsKey:"accessibility.signals.voiceRecordingStopped"})}static{this.editsKept=a.register({name:d(1790,null),sound:Bd.editsKept,announcementMessage:d(1758,null),settingsKey:"accessibility.signals.editsKept"})}static{this.editsUndone=a.register({name:d(1791,null),sound:Bd.editsUndone,announcementMessage:d(1759,null),settingsKey:"accessibility.signals.editsUndone"})}static{this.chatUserActionRequired=a.register({name:d(1783,null),sound:Bd.chatUserActionRequired,announcementMessage:d(1755,null),settingsKey:"accessibility.signals.chatUserActionRequired"})}};var Go=le("progressService");var Nxt=Object.freeze({total(){},worked(){},done(){}}),nh=class{constructor(i){this.callback=i}static{this.None=Object.freeze({report(){}})}get value(){return this._value}report(i){this._value=i,this.callback(this._value)}},dke=class extends k{constructor(e,t){super();this.deferred=new Mo;t.withProgress(e,o=>(this.reporter=o,this.lastStep&&o.report(this.lastStep),this.deferred.p)),this._register(ee(()=>this.deferred.complete()))}report(e){this.reporter?this.reporter.report(e):this.lastStep=e}};dke=I([m(1,Go)],dke);var uke=class extends k{constructor(e){super();this.progressIndicator=e;this.currentOperationId=0;this.currentOperationDisposables=this._register(new O);this.currentProgressTimeout=void 0}start(e){this.stop();let t=++this.currentOperationId,o=new qe;return this.currentProgressTimeout=setTimeout(()=>{t===this.currentOperationId&&(this.currentProgressRunner=this.progressIndicator.show(!0))},e),this.currentOperationDisposables.add(ee(()=>clearTimeout(this.currentProgressTimeout))),this.currentOperationDisposables.add(ee(()=>o.cancel())),this.currentOperationDisposables.add(ee(()=>this.currentProgressRunner?this.currentProgressRunner.done():void 0)),{id:t,token:o.token,stop:()=>this.doStop(t),isCurrent:()=>this.currentOperationId===t}}stop(){this.doStop(this.currentOperationId)}doStop(e){this.currentOperationId===e&&this.currentOperationDisposables.clear()}},Hd=le("editorProgressService");var Sx=class a{constructor(i,e,t,o,n){this._initialScrollTop=i;this._initialContentHeight=e;this._visiblePosition=t;this._visiblePositionScrollDelta=o;this._cursorPosition=n}static capture(i){if(i.getScrollTop()===0||i.hasPendingScrollAnimation())return new a(i.getScrollTop(),i.getContentHeight(),null,0,null);let e=null,t=0,o=i.getVisibleRanges();if(o.length>0){e=o[0].getStartPosition();let n=i.getTopForPosition(e.lineNumber,e.column);t=i.getScrollTop()-n}return new a(i.getScrollTop(),i.getContentHeight(),e,t,i.getPosition())}restore(i){if(!(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())&&this._visiblePosition){let e=i.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);i.setScrollTop(e+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(i){if(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())return;let e=i.getPosition();if(!this._cursorPosition||!e)return;let t=i.getTopForLineNumber(e.lineNumber)-i.getTopForLineNumber(this._cursorPosition.lineNumber);i.setScrollTop(i.getScrollTop()+t,1)}},V8e=class a{constructor(i,e,t,o){this._initialScrollTop=i;this._initialContentHeight=e;this._visiblePosition=t;this._visiblePositionScrollDelta=o}static capture(i){if(i.hasPendingScrollAnimation())return new a(i.getScrollTop(),i.getContentHeight(),null,0);let e=null,t=0,o=i.getVisibleRanges();return o.length>0&&(e=o.at(-1).getEndPosition(),t=i.getBottomForLineNumber(e.lineNumber)-i.getScrollTop()),new a(i.getScrollTop(),i.getContentHeight(),e,t)}restore(i){if(!(this._initialContentHeight===i.getContentHeight()&&this._initialScrollTop===i.getScrollTop())&&this._visiblePosition){let e=i.getBottomForLineNumber(this._visiblePosition.lineNumber);i.setScrollTop(e-this._visiblePositionScrollDelta,1)}}};var p$o=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}}),Oxt=p$o,m$o=new uo(()=>Oxt("mouse",!1)),h$o=new uo(()=>Oxt("element",!1));function IJi(a){Oxt=a}function yi(a){return a==="element"?h$o.value:m$o.value}function Dg(){return Oxt("element",!0)}function _D(a,i){if(a!==void 0){let e=a.match(/^\s*var\((.+)\)$/);if(e){let t=e[1].split(",",2);return t.length===2&&(i=_D(t[1].trim(),i)),`var(${t[0]}, ${i})`}return a}return i}function lci(a){let i=a.replaceAll(/[^\w.%+-]/gi,"");return i!==a&&console.warn(`CSS size ${a} modified to ${i} to be safe for CSS`),i}function yJi(a){let i=a.replaceAll(/[^[0-9a-fA-F#]]/gi,"");return i!==a&&console.warn(`CSS hex color ${a} modified to ${i} to be safe for CSS`),i}function pke(a){let i=a.replaceAll(/[^_\-a-z0-9]/gi,"");return i!==a&&console.warn(`CSS ident value ${a} modified to ${i} to be safe for CSS`),i}function FI(a){return`'${a.replaceAll(/'/g,"\\000027")}'`}function cl(a){return a?pa`url('${CSS.escape(In.uriToBrowserUri(a).toString(!0))}')`:"url('')"}function _K(a,i=!1){let e=CSS.escape(a);return!i&&e!==a&&console.warn(`CSS class name ${a} modified to ${e} to be safe for CSS`),e}function pa(a,...i){return a.reduce((e,t,o)=>{let n=i[o]||"";return e+t+n},"")}var TD=class{constructor(){this._parts=[]}push(...i){this._parts.push(...i)}join(i=`
`){return this._parts.join(i)}};var Fxt=class{constructor(i){this.spliceables=i}splice(i,e,t){this.spliceables.forEach(o=>o.splice(i,e,t))}};function wJi(a){let i=g$o(a);if(i&&i.length>0)return new Uint32Array(i)}var ZL=0,WX=new Uint32Array(10);function g$o(a){if(ZL=0,DK(a,cci,4352),ZL>0||(DK(a,dci,4449),ZL>0)||(DK(a,uci,4520),ZL>0)||(DK(a,vde,12593),ZL))return WX.subarray(0,ZL);if(a>=44032&&a<=55203){let i=a-44032,e=i%588,t=Math.floor(i/588),o=Math.floor(e/28),n=e%28-1;if(t<cci.length?DK(t,cci,0):4352+t-12593<vde.length&&DK(4352+t,vde,12593),o<dci.length?DK(o,dci,0):4449+o-12593<vde.length&&DK(4449+o-12593,vde,12593),n>=0&&(n<uci.length?DK(n,uci,0):4520+n-12593<vde.length&&DK(4520+n-12593,vde,12593)),ZL>0)return WX.subarray(0,ZL)}}function DK(a,i,e){a>=e&&a<e+i.length&&f$o(i[a-e])}function f$o(a){a!==0&&(WX[ZL++]=a&255,a>>8&&(WX[ZL++]=a>>8&255),a>>16&&(WX[ZL++]=a>>16&255))}var cci=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),dci=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),uci=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]),vde=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]);var vRr=new Ua(1e4);var v$o=new Ua(1e4);function b$o(a){return I$o(a,"NFD",v$o)}var S$o=/[^\u0000-\u0080]/;function I$o(a,i,e){if(!a)return a;let t=e.get(a);if(t)return t;let o;return S$o.test(a)?o=a.normalize(i):o=a,e.set(a,o),o}var B8e=(function(){let a=new Ua(1e4),i=/[\u0300-\u036f]/g;return function(e){let t=a.get(e);if(t)return t;let o=b$o(e).replace(i,""),n=(o.length===e.length?o:e).toLowerCase();return a.set(e,n),n}})();function UF(...a){return function(i,e){for(let t=0,o=a.length;t<o;t++){let n=a[t](i,e);if(n)return n}return null}}var CRr=_Ji.bind(void 0,!1),bde=_Ji.bind(void 0,!0);function _Ji(a,i,e){if(!e||e.length<i.length)return null;let t;return a?t=aT(e,i):t=e.indexOf(i)===0,t?i.length>0?[{start:0,end:i.length}]:[]:null}function zF(a,i){if(a.length>i.length)return null;let e=i.toLowerCase().indexOf(a.toLowerCase());return e===-1?null:[{start:e,end:e+a.length}]}function HX(a,i){if(a.length>i.length)return null;a=B8e(a),i=B8e(i);let e=i.indexOf(a);return e===-1?null:[{start:e,end:e+a.length}]}function U8e(a,i){return a.length>i.length?null:hci(a.toLowerCase(),i.toLowerCase(),0,0)}function hci(a,i,e,t){if(e===a.length)return[];if(t===i.length)return null;if(a[e]===i[t]){let o=null;return(o=hci(a,i,e+1,t+1))?Ici({start:t,end:t+1},o):null}return hci(a,i,e,t+1)}function bci(a){return 97<=a&&a<=122}function mke(a){return 65<=a&&a<=90}function Sci(a){return 48<=a&&a<=57}function DJi(a){return a===32||a===9||a===10||a===13}var RJi=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(a=>RJi.add(a.charCodeAt(0)));function Bxt(a){return DJi(a)||RJi.has(a)}function CJi(a,i){return a===i||Bxt(a)&&Bxt(i)}var pci=new Map;function xJi(a){if(pci.has(a))return pci.get(a);let i,e=wJi(a);return e&&(i=e),pci.set(a,i),i}function LJi(a){return bci(a)||mke(a)||Sci(a)}function Ici(a,i){return i.length===0?i=[a]:a.end===i[0].start?i[0].start=a.start:i.unshift(a),i}function MJi(a,i){for(let e=i;e<a.length;e++){let t=a.charCodeAt(e);if(mke(t)||Sci(t)||e>0&&!LJi(a.charCodeAt(e-1)))return e}return a.length}function gci(a,i,e,t){if(e===a.length)return[];if(t===i.length)return null;if(a[e]!==i[t].toLowerCase())return null;{let o=null,n=t+1;for(o=gci(a,i,e+1,t+1);!o&&(n=MJi(i,n))<i.length;)o=gci(a,i,e+1,n),n++;return o===null?null:Ici({start:t,end:t+1},o)}}function y$o(a){let i=0,e=0,t=0,o=0,n=0;for(let u=0;u<a.length;u++)n=a.charCodeAt(u),mke(n)&&i++,bci(n)&&e++,LJi(n)&&t++,Sci(n)&&o++;let r=i/a.length,s=e/a.length,l=t/a.length,c=o/a.length;return{upperPercent:r,lowerPercent:s,alphaPercent:l,numericPercent:c}}function w$o(a){let{upperPercent:i,lowerPercent:e}=a;return e===0&&i>.6}function C$o(a){let{upperPercent:i,lowerPercent:e,alphaPercent:t,numericPercent:o}=a;return e>.2&&i<.8&&t>.6&&o<.2}function x$o(a){let i=0,e=0,t=0,o=0;for(let n=0;n<a.length;n++)t=a.charCodeAt(n),mke(t)&&i++,bci(t)&&e++,DJi(t)&&o++;return(i===0||e===0)&&o===0?a.length<=30:i<=5}function UX(a,i){if(!i||(i=i.trim(),i.length===0)||!x$o(a))return null;i.length>60&&(i=i.substring(0,60));let e=y$o(i);if(!C$o(e)){if(!w$o(e))return null;i=i.toLowerCase()}let t=null,o=0;for(a=a.toLowerCase();o<i.length&&(t=gci(a,i,0,o))===null;)o=MJi(i,o+1);return t}function Qw(a,i,e=!1){if(!i||i.length===0)return null;let t=null,o=0;a=B8e(a),i=B8e(i);let n=new Map;for(;o<i.length&&(t=fci(a,i,0,o,e,n),t===null);)o=PJi(i,o+1);return t}function kJi(a){if(a===null)return null;let i=[];for(let e of a)i.push({start:e.start,end:e.end});return i}function fci(a,i,e,t,o,n){if(e===a.length)return[];if(t===i.length)return null;let r=e*(i.length+1)+t,s=n.get(r);if(s!==void 0)return kJi(s);let l=k$o(a,i,e,t,o,n);return n.set(r,kJi(l)),l}function k$o(a,i,e,t,o,n){let r=0;if(!CJi(a.charCodeAt(e),i.charCodeAt(t))){let c=xJi(a.charCodeAt(e));if(!c)return null;for(let u=0;u<c.length;u++)if(!CJi(c[u],i.charCodeAt(t+u)))return null;r+=c.length-1}let s=null,l=t+r+1;if(s=fci(a,i,e+1,l,o,n),!o)for(;!s&&(l=PJi(i,l))<i.length;)s=fci(a,i,e+1,l,o,n),l++;if(!s)return null;if(a.charCodeAt(e)!==i.charCodeAt(t)){let c=xJi(a.charCodeAt(e));if(!c)return s;for(let u=0;u<c.length;u++)if(c[u]!==i.charCodeAt(t+u))return s}return Ici({start:t,end:t+r+1},s)}function PJi(a,i){for(let e=i;e<a.length;e++)if(Bxt(a.charCodeAt(e))||e>0&&Bxt(a.charCodeAt(e-1)))return e;return a.length}var E$o=UF(bde,UX,zF),T$o=UF(bde,UX,U8e),EJi=new Ua(1e4);function xh(a,i,e=!1){if(typeof a!="string"||typeof i!="string")return null;let t=EJi.get(a);t||(t=new RegExp(U3i(a),"i"),EJi.set(a,t));let o=t.exec(i);return o?[{start:o.index,end:o.index+o[0].length}]:e?T$o(a,i):E$o(a,i)}function hke(a,i){let e=eM(a,a.toLowerCase(),0,i,i.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return e?Wa(e):null}function AJi(a,i,e,t,o,n){let r=Math.min(13,a.length);for(;e<r;e++){let s=eM(a,i,e,t,o,n,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(s)return s}return[0,n]}function Wa(a){if(typeof a>"u")return[];let i=[],e=a[1];for(let t=a.length-1;t>1;t--){let o=a[t]+e,n=i[i.length-1];n&&n.end===o?n.end=o+1:i.push({start:o,end:o+1})}return i}var BX=128;function yci(){let a=[],i=[];for(let e=0;e<=BX;e++)i[e]=0;for(let e=0;e<=BX;e++)a.push(i.slice(0));return a}function NJi(a){let i=[];for(let e=0;e<=a;e++)i[e]=0;return i}var OJi=NJi(2*BX),vci=NJi(2*BX),RK=yci(),VX=yci(),H8e=yci(),_$o=!1;function mci(a,i,e,t,o){function n(s,l,c=" "){for(;s.length<l;)s=c+s;return s}let r=` |   |${t.split("").map(s=>n(s,3)).join("|")}
`;for(let s=0;s<=e;s++)s===0?r+=" |":r+=`${i[s-1]}|`,r+=a[s].slice(0,o+1).map(l=>n(l.toString(),3)).join("|")+`
`;return r}function D$o(a,i,e,t){a=a.substr(i),e=e.substr(t),console.log(mci(VX,a,a.length,e,e.length)),console.log(mci(H8e,a,a.length,e,e.length)),console.log(mci(RK,a,a.length,e,e.length))}function Wxt(a,i){if(i<0||i>=a.length)return!1;let e=a.codePointAt(i);switch(e){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 62:case 40:case 41:case 91:case 93:case 123:case 125:return!0;case void 0:return!1;default:return!!c4e(e)}}function TJi(a,i){if(i<0||i>=a.length)return!1;switch(a.charCodeAt(i)){case 32:case 9:return!0;default:return!1}}function Vxt(a,i,e){return i[a]!==e[a]}function gke(a,i,e,t,o,n,r=!1){for(;i<e&&o<n;)a[i]===t[o]&&(r&&(OJi[i]=o),i+=1),o+=1;return i===e}var Xv;(e=>{e.Default=[-100,0];function i(t){return!t||t.length===2&&t[0]===-100&&t[1]===0}e.isDefault=i})(Xv||={});var i4=class{constructor(i,e){this.firstMatchCanBeWeak=i;this.boostFullMatch=e}static{this.default={boostFullMatch:!0,firstMatchCanBeWeak:!1}}};function eM(a,i,e,t,o,n,r=i4.default){let s=a.length>BX?BX:a.length,l=t.length>BX?BX:t.length;if(e>=s||n>=l||s-e>l-n||!gke(i,e,s,o,n,l,!0))return;R$o(s,l,e,n,i,o);let c=1,u=1,p=e,h=n,g=[!1];for(c=1,p=e;p<s;c++,p++){let y=OJi[p],w=vci[p],x=p+1<s?vci[p+1]:l;for(u=y-n+1,h=y;h<x;u++,h++){let E=Number.MIN_SAFE_INTEGER,M=!1;h<=w&&(E=L$o(a,i,p,e,t,o,h,l,n,RK[c-1][u-1]===0,g));let N=0;E!==Number.MIN_SAFE_INTEGER&&(M=!0,N=E+VX[c-1][u-1]);let V=h>y,H=V?VX[c][u-1]+(RK[c][u-1]>0?-5:0):0,K=h>y+1&&RK[c][u-1]>0,j=K?VX[c][u-2]+(RK[c][u-2]>0?-5:0):0;if(K&&(!V||j>=H)&&(!M||j>=N))VX[c][u]=j,H8e[c][u]=3,RK[c][u]=0;else if(V&&(!M||H>=N))VX[c][u]=H,H8e[c][u]=2,RK[c][u]=0;else if(M)VX[c][u]=N,H8e[c][u]=1,RK[c][u]=RK[c-1][u-1]+1;else throw new Error("not possible")}}if(_$o&&D$o(a,e,t,n),!g[0]&&!r.firstMatchCanBeWeak)return;c--,u--;let f=[VX[c][u],n],v=0,b=0;for(;c>=1;){let y=u;do{let w=H8e[c][y];if(w===3)y=y-2;else if(w===2)y=y-1;else break}while(y>=1);v>1&&i[e+c-1]===o[n+u-1]&&!Vxt(y+n-1,t,o)&&v+1>RK[c][y]&&(y=u),y===u?v++:v=1,b||(b=y),c--,u=y-1,f.push(u)}l-n===s&&r.boostFullMatch&&(f[0]+=2);let S=b-s;return f[0]-=S,f}function R$o(a,i,e,t,o,n){let r=a-1,s=i-1;for(;r>=e&&s>=t;)o[r]===n[s]&&(vci[r]=s,r--),s--}function L$o(a,i,e,t,o,n,r,s,l,c,u){if(i[e]!==n[r])return Number.MIN_SAFE_INTEGER;let p=1,h=!1;return r===e-t?p=a[e]===o[r]?7:5:Vxt(r,o,n)&&(r===0||!Vxt(r-1,o,n))?(p=a[e]===o[r]?7:5,h=!0):Wxt(n,r)&&(r===0||!Wxt(n,r-1))?p=5:(Wxt(n,r-1)||TJi(n,r-1))&&(p=5,h=!0),p>1&&e===t&&(u[0]=!0),h||(h=Vxt(r,o,n)||Wxt(n,r-1)||TJi(n,r-1)),e===t?r>l&&(p-=h?3:5):c?p+=h?2:0:p+=h?0:1,r+1===s&&(p-=h?3:5),p}function Hxt(a,i,e,t,o,n,r){return M$o(a,i,e,t,o,n,!0,r)}function M$o(a,i,e,t,o,n,r,s){let l=eM(a,i,e,t,o,n,s);if(l&&!r)return l;if(a.length>=3){let c=Math.min(7,a.length-1);for(let u=e+1;u<c;u++){let p=P$o(a,u);if(p){let h=eM(p,p.toLowerCase(),e,t,o,n,s);h&&(h[0]-=3,(!l||h[0]>l[0])&&(l=h))}}}return l}function P$o(a,i){if(i+1>=a.length)return;let e=a[i],t=a[i+1];if(e!==t)return a.slice(0,i)+t+e+a.slice(i+2)}var Sde="notSelectable";var tM=class extends Error{constructor(i,e){super(`ListError [${i}] ${e}`)}},LK=class{constructor(){this.cache=new WeakMap}getHeight(i){return this.cache.get(i)??this.estimateHeight(i)}setDynamicHeight(i,e){e>0&&this.cache.set(i,e)}};var OS;(o=>{function a(n,r){if(n.start>=r.end||r.start>=n.end)return{start:0,end:0};let s=Math.max(n.start,r.start),l=Math.min(n.end,r.end);return l-s<=0?{start:0,end:0}:{start:s,end:l}}o.intersect=a;function i(n){return n.end-n.start<=0}o.isEmpty=i;function e(n,r){return!i(a(n,r))}o.intersects=e;function t(n,r){let s=[],l={start:n.start,end:Math.min(r.start,n.end)},c={start:Math.max(r.end,n.start),end:n.end};return i(l)||s.push(l),i(c)||s.push(c),s}o.relativeComplement=t})(OS||={});function FJi(a,i){let e=[];for(let t of i){if(a.start>=t.range.end)continue;if(a.end<t.range.start)break;let o=OS.intersect(a,t.range);OS.isEmpty(o)||e.push({range:o,size:t.size})}return e}function zxt({start:a,end:i},e){return{start:a+e,end:i+e}}function A$o(a){let i=[],e=null;for(let t of a){let o=t.range.start,n=t.range.end,r=t.size;if(e&&r===e.size){e.range.end=n;continue}e={range:{start:o,end:n},size:r},i.push(e)}return i}function N$o(...a){return A$o(a.reduce((i,e)=>i.concat(e),[]))}var Uxt=class{constructor(i){this.groups=[];this._size=0;this._paddingTop=0;this._paddingTop=i??0,this._size=this._paddingTop}get paddingTop(){return this._paddingTop}set paddingTop(i){this._size=this._size+i-this._paddingTop,this._paddingTop=i}splice(i,e,t=[]){let o=t.length-e,n=FJi({start:0,end:i},this.groups),r=FJi({start:i+e,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:zxt(l.range,o),size:l.size})),s=t.map((l,c)=>({range:{start:i+c,end:i+c+1},size:l.size}));this.groups=N$o(n,s,r),this._size=this._paddingTop+this.groups.reduce((l,c)=>l+c.size*(c.range.end-c.range.start),0)}get count(){let i=this.groups.length;return i?this.groups[i-1].range.end:0}get size(){return this._size}indexAt(i){if(i<0)return-1;if(i<this._paddingTop)return 0;let e=0,t=this._paddingTop;for(let o of this.groups){let n=o.range.end-o.range.start,r=t+n*o.size;if(i<r)return e+Math.floor((i-t)/o.size);e+=n,t=r}return e}indexAfter(i){return Math.min(this.indexAt(i)+1,this.count)}positionAt(i){if(i<0)return-1;let e=0,t=0;for(let o of this.groups){let n=o.range.end-o.range.start,r=t+n;if(i<r)return this._paddingTop+e+(i-t)*o.size;e+=n*o.size,t=r}return-1}};var Kxt=class{constructor(i){this.renderers=i;this.cache=new Map;this.transactionNodesPendingRemoval=new Set;this.inTransaction=!1}alloc(i){let e=this.getTemplateCache(i).pop(),t=!1;if(e)t=this.transactionNodesPendingRemoval.delete(e.domNode);else{let o=_(".monaco-list-row"),r=this.getRenderer(i).renderTemplate(o);e={domNode:o,templateId:i,templateData:r}}return{row:e,isReusingConnectedDomNode:t}}release(i){i&&this.releaseRow(i)}transact(i){if(this.inTransaction)throw new Error("Already in transaction");this.inTransaction=!0;try{i()}finally{for(let e of this.transactionNodesPendingRemoval)this.doRemoveNode(e);this.transactionNodesPendingRemoval.clear(),this.inTransaction=!1}}releaseRow(i){let{domNode:e,templateId:t}=i;e&&(this.inTransaction?this.transactionNodesPendingRemoval.add(e):this.doRemoveNode(e)),this.getTemplateCache(t).push(i)}doRemoveNode(i){i.classList.remove("scrolling"),i.remove()}getTemplateCache(i){let e=this.cache.get(i);return e||(e=[],this.cache.set(i,e)),e}dispose(){this.cache.forEach((i,e)=>{for(let t of i)this.getRenderer(e).disposeTemplate(t.templateData),t.templateData=null}),this.cache.clear(),this.transactionNodesPendingRemoval.clear()}getRenderer(i){let e=this.renderers.get(i);if(!e)throw new Error(`No renderer found for ${i}`);return e}};function LA(a,i,e,t=[]){if(!a.dataTransfer)return;let o=_(".monaco-drag-image");o.textContent=e,o.classList.add(...t),(s=>{for(;s&&!s.classList.contains("monaco-workbench");)s=s.parentElement;return s||i.ownerDocument.body})(i).appendChild(o),a.dataTransfer.setDragImage(o,-10,-10),setTimeout(()=>o.remove(),0)}var Ide={CurrentDragAndDropData:void 0};var MK={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(a){return[a]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0},Yw=class{get context(){return this._context}set context(i){this._context=i}constructor(i){this.elements=i}update(){}getData(){return this.elements}},z8e=class{constructor(i){this.elements=i}update(){}getData(){return this.elements}},PK=class{constructor(){this.types=[],this.files=[]}update(i){if(i.types&&this.types.splice(0,this.types.length,...i.types),i.files){this.files.splice(0,this.files.length);for(let e=0;e<i.files.length;e++){let t=i.files.item(e);t&&(t.size||t.type)&&this.files.push(t)}}}getData(){return{types:this.types,files:this.files}}};function O$o(a,i){return Array.isArray(a)&&Array.isArray(i)?eo(a,i):a===i}var wci=class{constructor(i){i?.getSetSize?this.getSetSize=i.getSetSize.bind(i):this.getSetSize=(e,t,o)=>o,i?.getPosInSet?this.getPosInSet=i.getPosInSet.bind(i):this.getPosInSet=(e,t)=>t+1,i?.getRole?this.getRole=i.getRole.bind(i):this.getRole=e=>"listitem",i?.isChecked?this.isChecked=i.isChecked.bind(i):this.isChecked=e=>{}}},iM=class iM{constructor(i,e,t,o=MK){this.virtualDelegate=e;this.domId=`list_id_${++iM.InstanceCount}`;this.renderers=new Map;this.renderWidth=0;this._scrollHeight=0;this.scrollableElementUpdateDisposable=null;this.scrollableElementWidthDelayer=new rn(50);this.splicing=!1;this.dragOverAnimationStopDisposable=k.None;this.dragOverMouseY=0;this.canDrop=!1;this.currentDragFeedbackDisposable=k.None;this.onDragLeaveTimeout=k.None;this.currentSelectionDisposable=k.None;this.disposables=new O;this._onDidChangeContentHeight=this.disposables.add(new T);this._onDidChangeContentWidth=this.disposables.add(new T);this.onDidChangeContentHeight=U.latch(this._onDidChangeContentHeight.event,void 0,this.disposables);this.onDidChangeContentWidth=U.latch(this._onDidChangeContentWidth.event,void 0,this.disposables);this._horizontalScrolling=!1;if(o.horizontalScrolling&&o.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=this.createRangeMap(o.paddingTop??0);for(let r of t)this.renderers.set(r.templateId,r);if(this.cache=this.disposables.add(new Kxt(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support",typeof o.mouseSupport=="boolean"?o.mouseSupport:!0),this._horizontalScrolling=o.horizontalScrolling??MK.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof o.paddingBottom>"u"?0:o.paddingBottom,this.accessibilityProvider=new wci(o.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(o.transformOptimization??MK.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(ds.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new hD({forceIntegerValues:!0,smoothScrollDuration:o.smoothScrolling??!1?125:0,scheduleAtNextAnimationFrame:r=>kr(Me(this.domNode),r)})),this.scrollableElement=this.disposables.add(new LF(this.rowsContainer,{alwaysConsumeMouseWheel:o.alwaysConsumeMouseWheel??MK.alwaysConsumeMouseWheel,horizontal:1,vertical:o.verticalScrollMode??MK.verticalScrollMode,useShadows:o.useShadows??MK.useShadows,mouseWheelScrollSensitivity:o.mouseWheelScrollSensitivity,fastScrollSensitivity:o.fastScrollSensitivity,scrollByPage:o.scrollByPage},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),i.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add($(this.rowsContainer,Vn.Change,r=>this.onTouchChange(r))),this.disposables.add($(this.scrollableElement.getDomNode(),"scroll",r=>{let s=r.target,l=s.scrollTop;s.scrollTop=0,o.scrollToActiveElement&&this.setScrollTop(this.scrollTop+l)})),this.disposables.add($(this.domNode,"dragover",r=>this.onDragOver(this.toDragEvent(r)))),this.disposables.add($(this.domNode,"drop",r=>this.onDrop(this.toDragEvent(r)))),this.disposables.add($(this.domNode,"dragleave",r=>this.onDragLeave(this.toDragEvent(r)))),this.disposables.add($(this.domNode,"dragend",r=>this.onDragEnd(r))),o.userSelection){if(o.dnd)throw new Error("DND and user selection cannot be used simultaneously");this.disposables.add($(this.domNode,"mousedown",r=>this.onPotentialSelectionStart(r)))}this.setRowLineHeight=o.setRowLineHeight??MK.setRowLineHeight,this.setRowHeight=o.setRowHeight??MK.setRowHeight,this.supportDynamicHeights=o.supportDynamicHeights??MK.supportDynamicHeights,this.dnd=o.dnd??this.disposables.add(MK.dnd),this.layout(o.initialSize?.height,o.initialSize?.width),o.scrollToActiveElement&&this._setupFocusObserver(i)}static{this.InstanceCount=0}get contentHeight(){return this.rangeMap.size}get contentWidth(){return this.scrollWidth??0}get onDidScroll(){return this.scrollableElement.onScroll}get onWillScroll(){return this.scrollableElement.onWillScroll}get containerDomNode(){return this.rowsContainer}get scrollableElementDomNode(){return this.scrollableElement.getDomNode()}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(i){if(i!==this._horizontalScrolling){if(i&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=i,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(let e of this.items)this.measureItemWidth(e);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:xY(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width="",this.domNode.style.removeProperty("--list-scroll-right-offset")}}_setupFocusObserver(i){this.disposables.add($(i,"focus",()=>{let e=Un();this.activeElement!==e&&e!==null&&(this.activeElement=e,this._scrollToActiveElement(this.activeElement,i))},!0))}_scrollToActiveElement(i,e){let t=e.getBoundingClientRect(),n=i.getBoundingClientRect().top-t.top;n<0&&this.setScrollTop(this.scrollTop+n)}updateOptions(i){i.paddingBottom!==void 0&&(this.paddingBottom=i.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),i.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(i.smoothScrolling?125:0),i.horizontalScrolling!==void 0&&(this.horizontalScrolling=i.horizontalScrolling);let e;if(i.scrollByPage!==void 0&&(e={...e??{},scrollByPage:i.scrollByPage}),i.mouseWheelScrollSensitivity!==void 0&&(e={...e??{},mouseWheelScrollSensitivity:i.mouseWheelScrollSensitivity}),i.fastScrollSensitivity!==void 0&&(e={...e??{},fastScrollSensitivity:i.fastScrollSensitivity}),e&&this.scrollableElement.updateOptions(e),i.paddingTop!==void 0&&i.paddingTop!==this.rangeMap.paddingTop){let t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),o=i.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=i.paddingTop,this.render(t,Math.max(0,this.lastRenderTop+o),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}delegateScrollFromMouseWheelEvent(i){this.scrollableElement.delegateScrollFromMouseWheelEvent(i)}delegateVerticalScrollbarPointerDown(i){this.scrollableElement.delegateVerticalScrollbarPointerDown(i)}updateElementHeight(i,e,t){if(i<0||i>=this.items.length)return;let o=this.items[i].size;if(typeof e>"u"){if(!this.supportDynamicHeights){console.warn("Dynamic heights not supported",new Error().stack);return}this.items[i].lastDynamicHeightWidth=void 0,e=o+this.probeDynamicHeight(i)}if(o===e)return;let n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),r=0;i<n.start||t!==null&&t>i&&t<n.end?r=e-o:r=0,this.rangeMap.splice(i,1,[{size:e}]),this.items[i].size=e,this.render(n,Math.max(0,this.lastRenderTop+r),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights?this._rerender(this.lastRenderTop,this.lastRenderHeight):this._onDidChangeContentHeight.fire(this.contentHeight)}createRangeMap(i){return new Uxt(i)}splice(i,e,t=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(i,e,t)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(i,e,t=[]){let o=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),n={start:i,end:i+e},r=OS.intersect(o,n),s=new Map;for(let E=r.end-1;E>=r.start;E--){let M=this.items[E];if(M.dragStartDisposable.dispose(),M.checkedDisposable.dispose(),M.row){let N=s.get(M.templateId);N||(N=[],s.set(M.templateId,N));let V=this.renderers.get(M.templateId);V&&V.disposeElement&&V.disposeElement(M.element,E,M.row.templateData,{height:M.size}),N.unshift(M.row)}M.row=null,M.stale=!0}let l={start:i+e,end:this.items.length},c=OS.intersect(l,o),u=OS.relativeComplement(l,o),p=t.map(E=>({id:String(this.itemId++),element:E,templateId:this.virtualDelegate.getTemplateId(E),size:this.virtualDelegate.getHeight(E),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(E),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:k.None,checkedDisposable:k.None,stale:!1})),h;i===0&&e>=this.items.length?(this.rangeMap=this.createRangeMap(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,p),h=this.items,this.items=p):(this.rangeMap.splice(i,e,p),h=yle(this.items,i,e,p));let g=t.length-e,f=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),v=zxt(c,g),b=OS.intersect(f,v);for(let E=b.start;E<b.end;E++)this.updateItemInDOM(this.items[E],E);let S=OS.relativeComplement(v,f);for(let E of S)for(let M=E.start;M<E.end;M++)this.removeItemFromDOM(M);let y=u.map(E=>zxt(E,g)),x=[{start:i,end:i+t.length},...y].map(E=>OS.intersect(f,E)).reverse();for(let E of x)for(let M=E.end-1;M>=E.start;M--){let N=this.items[M],H=s.get(N.templateId)?.pop();this.insertItemInDOM(M,H)}for(let E of s.values())for(let M of E)this.cache.release(M);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),h.map(E=>E.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=kr(Me(this.domNode),()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let i=0;for(let e of this.items)typeof e.width<"u"&&(i=Math.max(i,e.width));this.scrollWidth=i,this.scrollableElement.setScrollDimensions({scrollWidth:i===0?0:i+10}),this._onDidChangeContentWidth.fire(this.scrollWidth)}updateWidth(i){if(!this.horizontalScrolling||typeof this.scrollWidth>"u")return;let e=this.items[i];this.measureItemWidth(e),typeof e.width<"u"&&e.width>this.scrollWidth&&(this.scrollWidth=e.width,this.scrollableElement.setScrollDimensions({scrollWidth:this.scrollWidth+10}),this._onDidChangeContentWidth.fire(this.scrollWidth))}rerender(){if(this.supportDynamicHeights){for(let i of this.items)i.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}get firstVisibleIndex(){return this.getVisibleRange(this.lastRenderTop,this.lastRenderHeight).start}get firstMostlyVisibleIndex(){let i=this.firstVisibleIndex,e=this.rangeMap.positionAt(i),t=this.rangeMap.positionAt(i+1);return t!==-1&&(t-e)/2+e<this.scrollTop?i+1:i}get lastVisibleIndex(){return this.getRenderRange(this.lastRenderTop,this.lastRenderHeight).end-1}element(i){return this.items[i].element}indexOf(i){return this.items.findIndex(e=>e.element===i)}domElement(i){let e=this.items[i].row;return e&&e.domNode}elementHeight(i){return this.items[i].size}elementTop(i){return this.rangeMap.positionAt(i)}indexAt(i){return this.rangeMap.indexAt(i)}indexAfter(i){return this.rangeMap.indexAfter(i)}layout(i,e){let t={height:typeof i=="number"?i:Mwe(this.domNode)};if(this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,t.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(t),typeof e<"u"&&(this.renderWidth=e,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling){this.scrollableElement.setScrollDimensions({width:typeof e=="number"?e:xY(this.domNode)});let o=this.scrollableElement.getScrollPosition(),n=this.scrollableElement.getScrollDimensions(),r=Math.max(0,n.scrollWidth-o.scrollLeft-this.renderWidth);this.domNode.style.setProperty("--list-scroll-right-offset",`${Math.max(r-12,0)}px`)}}render(i,e,t,o,n,r=!1,s=!1){let l=this.getRenderRange(e,t),c=OS.relativeComplement(l,i).reverse(),u=OS.relativeComplement(i,l);if(r){let p=OS.intersect(i,l);for(let h=p.start;h<p.end;h++)this.updateItemInDOM(this.items[h],h)}if(this.cache.transact(()=>{for(let p of u)for(let h=p.start;h<p.end;h++)this.removeItemFromDOM(h,s);for(let p of c)for(let h=p.end-1;h>=p.start;h--)this.insertItemInDOM(h)}),o!==void 0&&(this.rowsContainer.style.left=`-${o}px`),this.rowsContainer.style.top=`-${e}px`,this.horizontalScrolling&&n!==void 0){this.rowsContainer.style.width=`${Math.max(n,this.renderWidth)}px`;let p=Math.max(0,n-(o??0)-this.renderWidth);this.domNode.style.setProperty("--list-scroll-right-offset",`${Math.max(p-12,0)}px`)}this.lastRenderTop=e,this.lastRenderHeight=t}insertItemInDOM(i,e){let t=this.items[i];if(!t.row)if(e)t.row=e,t.stale=!0;else{let c=this.cache.alloc(t.templateId);t.row=c.row,t.stale||=c.isReusingConnectedDomNode}let o=this.accessibilityProvider.getRole(t.element)||"listitem";t.row.domNode.setAttribute("role",o);let n=this.accessibilityProvider.isChecked(t.element),r=c=>c==="mixed"?"mixed":String(!!c);if(typeof n=="boolean"||n==="mixed")t.row.domNode.setAttribute("aria-checked",r(n));else if(n){let c=u=>t.row.domNode.setAttribute("aria-checked",r(u));c(n.value),t.checkedDisposable=n.onDidChange(()=>c(n.value))}if(t.stale||!t.row.domNode.parentElement){let c=this.items.at(i+1)?.row?.domNode??null;(t.row.domNode.parentElement!==this.rowsContainer||t.row.domNode.nextElementSibling!==c)&&this.rowsContainer.insertBefore(t.row.domNode,c),t.stale=!1}this.updateItemInDOM(t,i);let s=this.renderers.get(t.templateId);if(!s)throw new Error(`No renderer found for template id ${t.templateId}`);s?.renderElement(t.element,i,t.row.templateData,{height:t.size});let l=this.dnd.getDragURI(t.element);t.dragStartDisposable.dispose(),t.row.domNode.draggable=!!l,l&&(t.dragStartDisposable=$(t.row.domNode,"dragstart",c=>this.onDragStart(t.element,l,c))),this.horizontalScrolling&&(this.measureItemWidth(t),this.eventuallyUpdateScrollWidth())}measureItemWidth(i){if(!i.row||!i.row.domNode)return;i.row.domNode.style.width="fit-content",i.width=xY(i.row.domNode);let e=Me(i.row.domNode).getComputedStyle(i.row.domNode);e.paddingLeft&&(i.width+=parseFloat(e.paddingLeft)),e.paddingRight&&(i.width+=parseFloat(e.paddingRight)),i.row.domNode.style.width=""}updateItemInDOM(i,e){i.row.domNode.style.top=`${this.elementTop(e)}px`,this.setRowHeight&&(i.row.domNode.style.height=`${i.size}px`),this.setRowLineHeight&&(i.row.domNode.style.lineHeight=`${i.size}px`),i.row.domNode.setAttribute("data-index",`${e}`),i.row.domNode.setAttribute("data-last-element",e===this.length-1?"true":"false"),i.row.domNode.setAttribute("data-parity",e%2===0?"even":"odd"),i.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(i.element,e,this.length))),i.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(i.element,e))),i.row.domNode.setAttribute("id",this.getElementDomId(e)),i.row.domNode.classList.toggle("drop-target",i.dropTarget)}removeItemFromDOM(i,e){let t=this.items[i];if(t.dragStartDisposable.dispose(),t.checkedDisposable.dispose(),t.row){let o=this.renderers.get(t.templateId);o&&o.disposeElement&&o.disposeElement(t.element,i,t.row.templateData,{height:t.size,onScroll:e}),this.cache.release(t.row),t.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(i,e){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:i,reuseAnimation:e})}getScrollLeft(){return this.scrollableElement.getScrollPosition().scrollLeft}setScrollLeft(i){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollWidth:this.scrollWidth})),this.scrollableElement.setScrollPosition({scrollLeft:i})}get scrollTop(){return this.getScrollTop()}set scrollTop(i){this.setScrollTop(i)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.paddingBottom}get onMouseClick(){return U.map(this.disposables.add(new Zn(this.domNode,"click")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseDblClick(){return U.map(this.disposables.add(new Zn(this.domNode,"dblclick")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseMiddleClick(){return U.filter(U.map(this.disposables.add(new Zn(this.domNode,"auxclick")).event,i=>this.toMouseEvent(i),this.disposables),i=>i.browserEvent.button===1,this.disposables)}get onMouseUp(){return U.map(this.disposables.add(new Zn(this.domNode,"mouseup")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseDown(){return U.map(this.disposables.add(new Zn(this.domNode,"mousedown")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseOver(){return U.map(this.disposables.add(new Zn(this.domNode,"mouseover")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseMove(){return U.map(this.disposables.add(new Zn(this.domNode,"mousemove")).event,i=>this.toMouseEvent(i),this.disposables)}get onMouseOut(){return U.map(this.disposables.add(new Zn(this.domNode,"mouseout")).event,i=>this.toMouseEvent(i),this.disposables)}get onContextMenu(){return U.any(U.map(this.disposables.add(new Zn(this.domNode,"contextmenu")).event,i=>this.toMouseEvent(i),this.disposables),U.map(this.disposables.add(new Zn(this.domNode,Vn.Contextmenu)).event,i=>this.toGestureEvent(i),this.disposables))}get onTouchStart(){return U.map(this.disposables.add(new Zn(this.domNode,"touchstart")).event,i=>this.toTouchEvent(i),this.disposables)}get onTap(){return U.map(this.disposables.add(new Zn(this.rowsContainer,Vn.Tap)).event,i=>this.toGestureEvent(i),this.disposables)}toMouseEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toTouchEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toGestureEvent(i){let e=this.getItemIndexFromEventTarget(i.initialTarget||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element;return{browserEvent:i,index:e,element:o}}toDragEvent(i){let e=this.getItemIndexFromEventTarget(i.target||null),t=typeof e>"u"?void 0:this.items[e],o=t&&t.element,n=this.getTargetSector(i,e);return{browserEvent:i,index:e,element:o,sector:n}}onScroll(i){try{let e=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(e,i.scrollTop,i.height,i.scrollLeft,i.scrollWidth,void 0,!0),this.supportDynamicHeights&&this._rerender(i.scrollTop,i.height,i.inSmoothScrolling)}catch(e){throw console.error("Got bad scroll event:",i),e}}onTouchChange(i){i.preventDefault(),i.stopPropagation(),this.scrollTop-=i.translationY}onDragStart(i,e,t){if(!t.dataTransfer)return;let o=this.dnd.getDragElements(i);t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData(Fl.TEXT,e);let n;this.dnd.getDragLabel&&(n=this.dnd.getDragLabel(o,t)),typeof n>"u"&&(n=String(o.length)),LA(t,this.domNode,n,[this.domId]),this.domNode.classList.add("dragging"),this.currentDragData=new Yw(o),Ide.CurrentDragAndDropData=new z8e(o),this.dnd.onDragStart?.(this.currentDragData,t)}onPotentialSelectionStart(i){this.currentSelectionDisposable.dispose();let e=Qle(this.domNode),t=this.currentSelectionDisposable=new O,o=t.add(new O);o.add($(this.domNode,"selectstart",()=>{o.add($(e,"mousemove",n=>{e.getSelection()?.isCollapsed===!1&&this.setupDragAndDropScrollTopAnimation(n)})),t.add(ee(()=>{let n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.currentSelectionBounds=void 0,this.render(n,this.lastRenderTop,this.lastRenderHeight,void 0,void 0)})),t.add($(e,"selectionchange",()=>{let n=e.getSelection();if(!n||n.isCollapsed){o.isDisposed&&t.dispose();return}let r=this.getIndexOfListElement(n.anchorNode),s=this.getIndexOfListElement(n.focusNode);r!==void 0&&s!==void 0&&(s<r&&([r,s]=[s,r]),this.currentSelectionBounds={start:r,end:s})}))})),o.add($(e,"mouseup",()=>{o.dispose(),this.teardownDragAndDropScrollTopAnimation(),e.getSelection()?.isCollapsed!==!1&&t.dispose()}))}getIndexOfListElement(i){if(!(!i||!this.domNode.contains(i)))for(;i&&i!==this.domNode;){if(i.dataset?.index)return Number(i.dataset.index);i=i.parentElement}}onDragOver(i){if(i.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),Ide.CurrentDragAndDropData&&Ide.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(i.browserEvent),!i.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(Ide.CurrentDragAndDropData)this.currentDragData=Ide.CurrentDragAndDropData;else{if(!i.browserEvent.dataTransfer.types)return!1;this.currentDragData=new PK}let e=this.dnd.onDragOver(this.currentDragData,i.element,i.index,i.sector,i.browserEvent);if(this.canDrop=typeof e=="boolean"?e:e.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;i.browserEvent.dataTransfer.dropEffect=typeof e!="boolean"&&e.effect?.type===0?"copy":"move";let t;typeof e!="boolean"&&e.feedback?t=e.feedback:typeof i.index>"u"?t=[-1]:t=[i.index],t=jo(t).filter(n=>n>=-1&&n<this.length).sort((n,r)=>n-r),t=t[0]===-1?[-1]:t;let o=typeof e!="boolean"&&e.effect&&e.effect.position?e.effect.position:"drop-target";if(O$o(this.currentDragFeedback,t)&&this.currentDragFeedbackPosition===o)return!0;if(this.currentDragFeedback=t,this.currentDragFeedbackPosition=o,this.currentDragFeedbackDisposable.dispose(),t[0]===-1)this.domNode.classList.add(o),this.rowsContainer.classList.add(o),this.currentDragFeedbackDisposable=ee(()=>{this.domNode.classList.remove(o),this.rowsContainer.classList.remove(o)});else{if(t.length>1&&o!=="drop-target")throw new Error("Can't use multiple feedbacks with position different than 'over'");o==="drop-target-after"&&t[0]<this.length-1&&(t[0]+=1,o="drop-target-before");for(let n of t){let r=this.items[n];r.dropTarget=!0,r.row?.domNode.classList.add(o)}this.currentDragFeedbackDisposable=ee(()=>{for(let n of t){let r=this.items[n];r.dropTarget=!1,r.row?.domNode.classList.remove(o)}})}return!0}onDragLeave(i){this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=Zo(()=>this.clearDragOverFeedback(),100,this.disposables),this.currentDragData&&this.dnd.onDragLeave?.(this.currentDragData,i.element,i.index,i.browserEvent)}onDrop(i){if(!this.canDrop)return;let e=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,Ide.CurrentDragAndDropData=void 0,!(!e||!i.browserEvent.dataTransfer)&&(i.browserEvent.preventDefault(),e.update(i.browserEvent.dataTransfer),this.dnd.drop(e,i.element,i.index,i.sector,i.browserEvent))}onDragEnd(i){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,Ide.CurrentDragAndDropData=void 0,this.dnd.onDragEnd?.(i)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=k.None}setupDragAndDropScrollTopAnimation(i){if(!this.dragOverAnimationDisposable){let e=pF(this.domNode).top;this.dragOverAnimationDisposable=SQi(Me(this.domNode),this.animateDragAndDropScrollTop.bind(this,e))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=Zo(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3,this.disposables),this.dragOverMouseY=i.pageY}animateDragAndDropScrollTop(i){if(this.dragOverMouseY===void 0)return;let e=this.dragOverMouseY-i,t=this.renderHeight-35;e<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(e-35))):e>t&&(this.scrollTop+=Math.min(14,Math.floor(.3*(e-t))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getTargetSector(i,e){if(e===void 0)return;let t=i.offsetY/this.items[e].size,o=Math.floor(t/.25);return jn(o,0,3)}getItemIndexFromEventTarget(i){let e=this.scrollableElement.getDomNode(),t=i;for(;(go(t)||Eoi(t))&&t!==this.rowsContainer&&e.contains(t);){let o=t.getAttribute("data-index");if(o){let n=Number(o);if(!isNaN(n))return n}t=t.parentElement}}getVisibleRange(i,e){return{start:this.rangeMap.indexAt(i),end:this.rangeMap.indexAfter(i+e-1)}}getRenderRange(i,e){let t=this.getVisibleRange(i,e);if(this.currentSelectionBounds){let o=this.rangeMap.count;t.start=Math.min(t.start,this.currentSelectionBounds.start,o),t.end=Math.min(Math.max(t.end,this.currentSelectionBounds.end+1),o)}return t}_rerender(i,e,t){let o=this.getRenderRange(i,e),n,r;i===this.elementTop(o.start)?(n=o.start,r=0):o.end-o.start>1&&(n=o.start+1,r=this.elementTop(n)-i);let s=0;for(;;){let l=this.getRenderRange(i,e),c=!1;for(let u=l.start;u<l.end;u++){let p=this.probeDynamicHeight(u);p!==0&&this.rangeMap.splice(u,1,[this.items[u]]),s+=p,c=c||p!==0}if(!c){s!==0&&this.eventuallyUpdateScrollDimensions();let u=OS.relativeComplement(o,l);for(let h of u)for(let g=h.start;g<h.end;g++)this.items[g].row&&this.removeItemFromDOM(g);let p=OS.relativeComplement(l,o).reverse();for(let h of p)for(let g=h.end-1;g>=h.start;g--)this.insertItemInDOM(g);for(let h=l.start;h<l.end;h++)this.items[h].row&&this.updateItemInDOM(this.items[h],h);if(typeof n=="number"){let h=this.scrollable.getFutureScrollPosition().scrollTop-i,g=this.elementTop(n)-r+h;this.setScrollTop(g,t)}this._onDidChangeContentHeight.fire(this.contentHeight);return}}}probeDynamicHeight(i){let e=this.items[i],t=this.probeDynamicHeightForItem(e,i);return t>0&&this.virtualDelegate.setDynamicHeight?.(e.element,e.size),t}probeDynamicHeightForItem(i,e){if(this.virtualDelegate.getDynamicHeight){let r=this.virtualDelegate.getDynamicHeight(i.element);if(r!==null){let s=i.size;return i.size=r,i.lastDynamicHeightWidth=this.renderWidth,r-s}}if(!i.hasDynamicHeight||i.lastDynamicHeightWidth===this.renderWidth||this.virtualDelegate.hasDynamicHeight&&!this.virtualDelegate.hasDynamicHeight(i.element))return 0;let t=i.size;if(i.row)return i.row.domNode.style.height="",i.size=i.row.domNode.offsetHeight,i.size===0&&(ms(i.row.domNode,Me(i.row.domNode).document.body)?console.warn("Measured item node at 0px- ensure that ListView is not display:none before measuring row height!",new Error().stack):console.warn("Measuring item node that is not in DOM! Add ListView to the DOM before measuring row height!",new Error().stack)),i.lastDynamicHeightWidth=this.renderWidth,i.size-t;let{row:o}=this.cache.alloc(i.templateId);o.domNode.style.height="",this.rowsContainer.appendChild(o.domNode);let n=this.renderers.get(i.templateId);if(!n)throw new ci("Missing renderer for templateId: "+i.templateId);return n.renderElement(i.element,e,o.templateData),i.size=o.domNode.offsetHeight,n.disposeElement?.(i.element,e,o.templateData),i.lastDynamicHeightWidth=this.renderWidth,o.domNode.remove(),this.cache.release(o),i.size-t}getElementDomId(i){return`${this.domId}_${i}`}dispose(){for(let i of this.items)if(i.dragStartDisposable.dispose(),i.checkedDisposable.dispose(),i.row){let e=this.renderers.get(i.row.templateId);e&&(e.disposeElement?.(i.element,-1,i.row.templateData,void 0),e.disposeTemplate(i.row.templateData))}this.items=[],this.domNode?.remove(),this.dragOverAnimationDisposable?.dispose(),this.disposables.dispose()}};I([bi],iM.prototype,"onMouseClick",1),I([bi],iM.prototype,"onMouseDblClick",1),I([bi],iM.prototype,"onMouseMiddleClick",1),I([bi],iM.prototype,"onMouseUp",1),I([bi],iM.prototype,"onMouseDown",1),I([bi],iM.prototype,"onMouseOver",1),I([bi],iM.prototype,"onMouseMove",1),I([bi],iM.prototype,"onMouseOut",1),I([bi],iM.prototype,"onContextMenu",1),I([bi],iM.prototype,"onTouchStart",1),I([bi],iM.prototype,"onTap",1);var fke=iM;var Cci=class{constructor(i){this.trait=i;this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(i){return i}renderElement(i,e,t){let o=this.renderedElements.findIndex(n=>n.templateData===t);if(o>=0){let n=this.renderedElements[o];this.trait.unrender(t),n.index=e}else{let n={index:e,templateData:t};this.renderedElements.push(n)}this.trait.renderIndex(e,t)}splice(i,e,t){let o=[];for(let n of this.renderedElements)n.index<i?o.push(n):n.index>=i+e&&o.push({index:n.index+t-e,templateData:n.templateData});this.renderedElements=o}renderIndexes(i){for(let{index:e,templateData:t}of this.renderedElements)i.indexOf(e)>-1&&this.trait.renderIndex(e,t)}disposeTemplate(i){let e=this.renderedElements.findIndex(t=>t.templateData===i);e<0||this.renderedElements.splice(e,1)}},vke=class{constructor(i){this._trait=i;this.indexes=[];this.sortedIndexes=[];this._onChange=new T}get onChange(){return this._onChange.event}get name(){return this._trait}get renderer(){return new Cci(this)}splice(i,e,t){let o=t.length-e,n=i+e,r=[],s=0;for(;s<this.sortedIndexes.length&&this.sortedIndexes[s]<i;)r.push(this.sortedIndexes[s++]);for(let l=0;l<t.length;l++)t[l]&&r.push(l+i);for(;s<this.sortedIndexes.length&&this.sortedIndexes[s]>=n;)r.push(this.sortedIndexes[s++]+o);this.renderer.splice(i,e,t.length),this._set(r,r)}renderIndex(i,e){e.classList.toggle(this._trait,this.contains(i))}unrender(i){i.classList.remove(this._trait)}set(i,e){return this._set(i,[...i].sort(VJi),e)}_set(i,e,t){let o=this.indexes,n=this.sortedIndexes;this.indexes=i,this.sortedIndexes=e;let r=Tci(n,i);return this.renderer.renderIndexes(r),this._onChange.fire({indexes:i,browserEvent:t}),o}get(){return this.indexes}contains(i){return Ek(this.sortedIndexes,i,VJi)>=0}dispose(){je(this._onChange)}};I([bi],vke.prototype,"renderer",1);var xci=class extends vke{constructor(e){super("selected");this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}},q8e=class{constructor(i,e,t){this.trait=i;this.view=e;this.identityProvider=t}splice(i,e,t){if(!this.identityProvider)return this.trait.splice(i,e,new Array(t.length).fill(!1));let o=this.trait.get().map(s=>this.identityProvider.getId(this.view.element(s)).toString());if(o.length===0)return this.trait.splice(i,e,new Array(t.length).fill(!1));let n=new Set(o),r=t.map(s=>n.has(this.identityProvider.getId(s).toString()));this.trait.splice(i,e,r)}};function $8e(a,i){return a.classList.contains(i)?!0:a.classList.contains("monaco-list")||!a.parentElement?!1:$8e(a.parentElement,i)}function zX(a){return $8e(a,"monaco-editor")}function BJi(a){return $8e(a,"monaco-custom-toggle")}function HJi(a){return $8e(a,"action-item")}function bke(a){return $8e(a,"monaco-tree-sticky-row")}function Ske(a){return a.classList.contains("monaco-tree-sticky-container")}function Lci(a){return a.tagName==="A"&&a.classList.contains("monaco-button")||a.tagName==="DIV"&&a.classList.contains("monaco-button-dropdown")?!0:a.classList.contains("monaco-list")||!a.parentElement?!1:Lci(a.parentElement)}var Gxt=class{constructor(i,e,t){this.list=i;this.view=e;this.disposables=new O;this.multipleSelectionDisposables=new O;this.multipleSelectionSupport=t.multipleSelectionSupport,this.disposables.add(this.onKeyDown(o=>{switch(o.keyCode){case 3:return this.onEnter(o);case 16:return this.onUpArrow(o);case 18:return this.onDownArrow(o);case 11:return this.onPageUpArrow(o);case 12:return this.onPageDownArrow(o);case 9:return this.onEscape(o);case 31:this.multipleSelectionSupport&&(et?o.metaKey:o.ctrlKey)&&this.onCtrlA(o)}}))}get onKeyDown(){return U.chain(this.disposables.add(new Zn(this.view.domNode,"keydown")).event,i=>i.filter(e=>!Ch(e.target)).map(e=>new mi(e)))}updateOptions(i){i.multipleSelectionSupport!==void 0&&(this.multipleSelectionSupport=i.multipleSelectionSupport)}onEnter(i){i.preventDefault(),i.stopPropagation(),this.list.setSelection(this.list.getFocus(),i.browserEvent)}onUpArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusPrevious(1,!1,i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onDownArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusNext(1,!1,i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onPageUpArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusPreviousPage(i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onPageDownArrow(i){i.preventDefault(),i.stopPropagation(),this.list.focusNextPage(i.browserEvent);let e=this.list.getFocus()[0];this.list.setAnchor(e),this.list.reveal(e),this.view.domNode.focus()}onCtrlA(i){i.preventDefault(),i.stopPropagation();let e=tf(this.list.length),t=this.list.getFocus(),o=t.length>0?this.list.getElementGroupId(t[0]):void 0;o!==void 0&&(e=this.list.filterIndicesByGroup(e,o)),this.list.setSelection(e,i.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(i){this.list.getSelection().length&&(i.preventDefault(),i.stopPropagation(),this.list.setSelection([],i.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}};I([bi],Gxt.prototype,"onKeyDown",1);var Mci=new class{mightProducePrintableCharacter(a){return a.ctrlKey||a.metaKey||a.altKey?!1:a.keyCode>=31&&a.keyCode<=56||a.keyCode>=21&&a.keyCode<=30||a.keyCode>=98&&a.keyCode<=107||a.keyCode>=85&&a.keyCode<=95}},kci=class{constructor(i,e,t,o,n){this.list=i;this.view=e;this.keyboardNavigationLabelProvider=t;this.keyboardNavigationEventFilter=o;this.delegate=n;this.enabled=!1;this.state=0;this.mode=0;this.triggered=!1;this.previouslyFocused=-1;this.enabledDisposables=new O;this.disposables=new O;this.updateOptions(i.options)}updateOptions(i){i.typeNavigationEnabled??!0?this.enable():this.disable(),this.mode=i.typeNavigationMode??0}trigger(){this.triggered=!this.triggered}enable(){if(this.enabled)return;let i=!1,e=U.chain(this.enabledDisposables.add(new Zn(this.view.domNode,"keydown")).event,n=>n.filter(r=>!Ch(r.target)).filter(()=>this.mode===0||this.triggered).map(r=>new mi(r)).filter(r=>i||this.keyboardNavigationEventFilter(r)).filter(r=>this.delegate.mightProducePrintableCharacter(r)).forEach(r=>Kt.stop(r,!0)).map(r=>r.browserEvent.key)),t=U.debounce(e,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);U.reduce(U.any(e,t),(n,r)=>r===null?null:(n||"")+r,void 0,this.enabledDisposables)(this.onInput,this,this.enabledDisposables),t(this.onClear,this,this.enabledDisposables),e(()=>i=!0,void 0,this.enabledDisposables),t(()=>i=!1,void 0,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){let i=this.list.getFocus();if(i.length>0&&i[0]===this.previouslyFocused){let e=this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(i[0]));typeof e=="string"?cn(e):e&&cn(e.get())}this.previouslyFocused=-1}onInput(i){if(!i){this.state=0,this.triggered=!1;return}let e=this.list.getFocus(),t=e.length>0?e[0]:0,o=this.state===0?1:0;this.state=1;for(let n=0;n<this.list.length;n++){let r=(t+n+o)%this.list.length,s=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(r)),l=s&&s.toString();if(this.list.options.typeNavigationEnabled){if(typeof l<"u"){if(bde(i,l)){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}let c=hke(i,l);if(c&&c[0].end-c[0].start>1&&c.length===1){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}}}else if(typeof l>"u"||bde(i,l)){this.previouslyFocused=t,this.list.setFocus([r]),this.list.reveal(r);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}},Eci=class{constructor(i,e){this.list=i;this.view=e;this.disposables=new O;let t=U.chain(this.disposables.add(new Zn(e.domNode,"keydown")).event,n=>n.filter(r=>!Ch(r.target)).map(r=>new mi(r)));U.chain(t,n=>n.filter(r=>r.keyCode===2&&!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&!r.altKey))(this.onTab,this,this.disposables)}onTab(i){if(i.target!==this.view.domNode)return;let e=this.list.getFocus();if(e.length===0)return;let t=this.view.domElement(e[0]);if(!t)return;let o=t.querySelector("[tabIndex]");if(!o||!go(o)||o.tabIndex===-1)return;let n=Me(o).getComputedStyle(o);n.visibility==="hidden"||n.display==="none"||(i.preventDefault(),i.stopPropagation(),o.focus())}dispose(){this.disposables.dispose()}};function Pci(a){return et?a.browserEvent.metaKey:a.browserEvent.ctrlKey}function Aci(a){return a.browserEvent.shiftKey}function F$o(a){return Wp(a)&&a.button===2}var WJi={isSelectionSingleChangeEvent:Pci,isSelectionRangeChangeEvent:Aci},yde=class{constructor(i){this.list=i;this.disposables=new O;this._onPointer=this.disposables.add(new T);i.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||WJi),this.mouseSupport=typeof i.options.mouseSupport>"u"||!!i.options.mouseSupport,this.mouseSupport&&(i.onMouseDown(this.onMouseDown,this,this.disposables),i.onContextMenu(this.onContextMenu,this,this.disposables),i.onMouseDblClick(this.onDoubleClick,this,this.disposables),i.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(ds.addTarget(i.getHTMLElement()))),U.any(i.onMouseClick,i.onMouseMiddleClick,i.onTap)(this.onViewPointer,this,this.disposables)}get onPointer(){return this._onPointer.event}updateOptions(i){i.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,i.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||WJi))}isSelectionSingleChangeEvent(i){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(i):!1}isSelectionRangeChangeEvent(i){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(i):!1}isSelectionChangeEvent(i){return this.isSelectionSingleChangeEvent(i)||this.isSelectionRangeChangeEvent(i)}onMouseDown(i){zX(i.browserEvent.target)||Un()!==i.browserEvent.target&&this.list.domFocus()}onContextMenu(i){if(Ch(i.browserEvent.target)||zX(i.browserEvent.target))return;let e=typeof i.index>"u"?[]:[i.index];this.list.setFocus(e,i.browserEvent)}onViewPointer(i){if(!this.mouseSupport||Ch(i.browserEvent.target)||zX(i.browserEvent.target)||i.browserEvent.isHandledByList)return;i.browserEvent.isHandledByList=!0;let e=i.index;if(typeof e>"u"){this.list.setFocus([],i.browserEvent),this.list.setSelection([],i.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionChangeEvent(i))return this.changeSelection(i);this.list.setFocus([e],i.browserEvent),this.list.setAnchor(e),F$o(i.browserEvent)||this.list.getElementGroupId(e)!==Sde&&this.list.setSelection([e],i.browserEvent),this._onPointer.fire(i)}onDoubleClick(i){if(Ch(i.browserEvent.target)||zX(i.browserEvent.target)||this.isSelectionChangeEvent(i)||i.browserEvent.isHandledByList)return;i.browserEvent.isHandledByList=!0;let e=this.list.getFocus();this.list.setSelection(e,i.browserEvent)}changeSelection(i){let e=i.index,t=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(i)){typeof t>"u"&&(t=this.list.getFocus()[0]??e,this.list.setAnchor(t));let o=Math.min(t,e),n=Math.max(t,e),r=tf(o,n+1),s=this.list.getSelection()[0];if(s!==void 0){let p=this.list.getElementGroupId(s);p!==void 0&&(r=this.list.filterIndicesByGroup(r,p))}let l=this.list.getSelection(),c=V$o(Tci(l,[t]),t);if(c.length===0)return;let u=Tci(r,B$o(l,c));this.list.setSelection(u,i.browserEvent),this.list.setFocus([e],i.browserEvent)}else if(this.isSelectionSingleChangeEvent(i)){let o=this.list.getSelection(),n=o.filter(s=>s!==e);this.list.setFocus([e]),this.list.setAnchor(e);let r=this.list.getElementGroupId(e);if(r===Sde)return;if(o.length===n.length){let s=r!==void 0?this.list.filterIndicesByGroup([...n,e],r):[...n,e];this.list.setSelection(s,i.browserEvent)}else this.list.setSelection(n,i.browserEvent)}}dispose(){this.disposables.dispose()}},wde=class{constructor(i,e){this.styleElement=i;this.selectorSuffix=e}style(i){let e=this.selectorSuffix&&`.${this.selectorSuffix}`,t=[];i.listBackground&&t.push(`.monaco-list${e} .monaco-list-rows { background: ${i.listBackground}; }`),i.listFocusBackground&&(t.push(`.monaco-list${e}:focus .monaco-list-row.focused { background-color: ${i.listFocusBackground}; }`),t.push(`.monaco-list${e}:focus .monaco-list-row.focused:hover { background-color: ${i.listFocusBackground}; }`)),i.listFocusForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),i.listActiveSelectionBackground&&(t.push(`.monaco-list${e}:focus .monaco-list-row.selected { background-color: ${i.listActiveSelectionBackground}; }`),t.push(`.monaco-list${e}:focus .monaco-list-row.selected:hover { background-color: ${i.listActiveSelectionBackground}; }`)),i.listActiveSelectionForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.selected { color: ${i.listActiveSelectionForeground}; }`),i.listActiveSelectionIconForeground&&t.push(`.monaco-list${e}:focus .monaco-list-row.selected .codicon { color: ${i.listActiveSelectionIconForeground}; }`),i.listFocusAndSelectionBackground&&t.push(`
				.monaco-drag-image${e},
				.monaco-list${e}:focus .monaco-list-row.selected.focused { background-color: ${i.listFocusAndSelectionBackground}; }
			`),i.listFocusAndSelectionForeground&&t.push(`
				.monaco-drag-image${e},
				.monaco-list${e}:focus .monaco-list-row.selected.focused { color: ${i.listFocusAndSelectionForeground}; }
			`),i.listInactiveFocusForeground&&(t.push(`.monaco-list${e} .monaco-list-row.focused { color:  ${i.listInactiveFocusForeground}; }`),t.push(`.monaco-list${e} .monaco-list-row.focused:hover { color:  ${i.listInactiveFocusForeground}; }`)),i.listInactiveSelectionIconForeground&&t.push(`.monaco-list${e} .monaco-list-row.focused .codicon { color:  ${i.listInactiveSelectionIconForeground}; }`),i.listInactiveFocusBackground&&(t.push(`.monaco-list${e} .monaco-list-row.focused { background-color:  ${i.listInactiveFocusBackground}; }`),t.push(`.monaco-list${e} .monaco-list-row.focused:hover { background-color:  ${i.listInactiveFocusBackground}; }`)),i.listInactiveSelectionBackground&&(t.push(`.monaco-list${e} .monaco-list-row.selected { background-color:  ${i.listInactiveSelectionBackground}; }`),t.push(`.monaco-list${e} .monaco-list-row.selected:hover { background-color:  ${i.listInactiveSelectionBackground}; }`)),i.listInactiveSelectionForeground&&t.push(`.monaco-list${e} .monaco-list-row.selected { color: ${i.listInactiveSelectionForeground}; }`),i.listHoverBackground&&t.push(`.monaco-list${e}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${i.listHoverBackground}; }`),i.listHoverForeground&&t.push(`.monaco-list${e}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color:  ${i.listHoverForeground}; }`);let o=_D(i.listFocusAndSelectionOutline,_D(i.listSelectionOutline,i.listFocusOutline??""));o&&t.push(`.monaco-list${e}:focus .monaco-list-row.focused.selected { outline: 1px solid ${o}; outline-offset: -1px;}`),i.listFocusOutline&&t.push(`
				.monaco-drag-image${e},
				.monaco-list${e}:focus .monaco-list-row.focused,
				.context-menu-visible .monaco-list${e}.last-focused .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }
			`);let n=_D(i.listSelectionOutline,i.listInactiveFocusOutline??"");n&&t.push(`.monaco-list${e} .monaco-list-row.focused.selected { outline: 1px dotted ${n}; outline-offset: -1px; }`),i.listSelectionOutline&&t.push(`.monaco-list${e} .monaco-list-row.selected { outline: 1px dotted ${i.listSelectionOutline}; outline-offset: -1px; }`),i.listInactiveFocusOutline&&t.push(`.monaco-list${e} .monaco-list-row.focused { outline: 1px dotted ${i.listInactiveFocusOutline}; outline-offset: -1px; }`),i.listHoverOutline&&t.push(`.monaco-list${e} .monaco-list-row:hover { outline: 1px dashed ${i.listHoverOutline}; outline-offset: -1px; }`),i.listDropOverBackground&&t.push(`
				.monaco-list${e}.drop-target,
				.monaco-list${e} .monaco-list-rows.drop-target,
				.monaco-list${e} .monaco-list-row.drop-target { background-color: ${i.listDropOverBackground} !important; color: inherit !important; }
			`),i.listDropBetweenBackground&&(t.push(`
			.monaco-list${e} .monaco-list-rows.drop-target-before .monaco-list-row:first-child::before,
			.monaco-list${e} .monaco-list-row.drop-target-before::before {
				content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 1px;
				background-color: ${i.listDropBetweenBackground};
			}`),t.push(`
			.monaco-list${e} .monaco-list-rows.drop-target-after .monaco-list-row:last-child::after,
			.monaco-list${e} .monaco-list-row.drop-target-after::after {
				content: ""; position: absolute; bottom: 0px; left: 0px; width: 100%; height: 1px;
				background-color: ${i.listDropBetweenBackground};
			}`)),i.tableColumnsBorder&&t.push(`
				.monaco-table > .monaco-split-view2,
				.monaco-table > .monaco-split-view2 .monaco-sash.vertical::before,
				.monaco-enable-motion .monaco-table:hover > .monaco-split-view2,
				.monaco-enable-motion .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {
					border-color: ${i.tableColumnsBorder};
				}

				.monaco-enable-motion .monaco-table > .monaco-split-view2,
				.monaco-enable-motion .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before {
					border-color: transparent;
				}
			`),i.tableOddRowsBackgroundColor&&t.push(`
				.monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr,
				.monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr,
				.monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr {
					background-color: ${i.tableOddRowsBackgroundColor};
				}
			`),this.styleElement.textContent=t.join(`
`)}},qxt={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:Ue.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:Ue.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:Ue.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},W$o={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function V$o(a,i){let e=a.indexOf(i);if(e===-1)return[];let t=[],o=e-1;for(;o>=0&&a[o]===i-(e-o);)t.push(a[o--]);for(t.reverse(),o=e;o<a.length&&a[o]===i+(o-e);)t.push(a[o++]);return t}function Tci(a,i){let e=[],t=0,o=0;for(;t<a.length||o<i.length;)if(t>=a.length)e.push(i[o++]);else if(o>=i.length)e.push(a[t++]);else if(a[t]===i[o]){e.push(a[t]),t++,o++;continue}else a[t]<i[o]?e.push(a[t++]):e.push(i[o++]);return e}function B$o(a,i){let e=[],t=0,o=0;for(;t<a.length||o<i.length;)if(t>=a.length)e.push(i[o++]);else if(o>=i.length)e.push(a[t++]);else if(a[t]===i[o]){t++,o++;continue}else a[t]<i[o]?e.push(a[t++]):o++;return e}var VJi=(a,i)=>a-i,_ci=class{constructor(i,e){this._templateId=i;this.renderers=e}get templateId(){return this._templateId}renderTemplate(i){return this.renderers.map(e=>e.renderTemplate(i))}renderElement(i,e,t,o){let n=0;for(let r of this.renderers)r.renderElement(i,e,t[n++],o)}disposeElement(i,e,t,o){let n=0;for(let r of this.renderers)r.disposeElement?.(i,e,t[n],o),n+=1}disposeTemplate(i){let e=0;for(let t of this.renderers)t.disposeTemplate(i[e++])}},Dci=class{constructor(i){this.accessibilityProvider=i;this.templateId="a18n"}renderTemplate(i){return{container:i,disposables:new O}}renderElement(i,e,t){let o=this.accessibilityProvider.getAriaLabel(i),n=o&&typeof o!="string"?o:Fo(o);t.disposables.add(ve(s=>{this.setAriaLabel(s.readObservable(n),t.container)}));let r=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(i);typeof r=="number"?t.container.setAttribute("aria-level",`${r}`):t.container.removeAttribute("aria-level")}setAriaLabel(i,e){i?e.setAttribute("aria-label",i):e.removeAttribute("aria-label")}disposeElement(i,e,t){t.disposables.clear()}disposeTemplate(i){i.disposables.dispose()}},Rci=class{constructor(i,e){this.list=i;this.dnd=e}getDragElements(i){let e=this.list.getSelectedElements();return e.indexOf(i)>-1?e:[i]}getDragURI(i){return this.dnd.getDragURI(i)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i,e)}onDragStart(i,e){this.dnd.onDragStart?.(i,e)}onDragOver(i,e,t,o,n){return this.dnd.onDragOver(i,e,t,o,n)}onDragLeave(i,e,t,o){this.dnd.onDragLeave?.(i,e,t,o)}onDragEnd(i){this.dnd.onDragEnd?.(i)}drop(i,e,t,o,n){this.dnd.drop(i,e,t,o,n)}dispose(){this.dnd.dispose()}},Gc=class{constructor(i,e,t,o,n=W$o){this.user=i;this._options=n;this.focus=new vke("focused");this.anchor=new vke("anchor");this.eventBufferer=new JO;this._ariaLabel="";this.disposables=new O;this._onDidDispose=new T;this.onDidDispose=this._onDidDispose.event;let r=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?this._options.accessibilityProvider?.getWidgetRole():"list";this.selection=new xci(r!=="listbox");let s=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=n.accessibilityProvider,this.accessibilityProvider&&(s.push(new Dci(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),o=o.map(c=>new _ci(c.templateId,[...s,c]));let l={...n,dnd:n.dnd&&new Rci(this,n.dnd)};if(this.view=this.createListView(e,t,o,l),this.view.domNode.setAttribute("role",r),n.styleController)this.styleController=n.styleController(this.view.domId);else{let c=Pr(this.view.domNode);this.styleController=new wde(c,this.view.domId)}if(this.spliceable=new Fxt([new q8e(this.focus,this.view,n.identityProvider),new q8e(this.selection,this.view,n.identityProvider),new q8e(this.anchor,this.view,n.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new Eci(this,this.view)),(typeof n.keyboardSupport!="boolean"||n.keyboardSupport)&&(this.keyboardController=new Gxt(this,this.view,n),this.disposables.add(this.keyboardController)),n.keyboardNavigationLabelProvider){let c=n.keyboardNavigationDelegate||Mci;this.typeNavigationController=new kci(this,this.view,n.keyboardNavigationLabelProvider,n.keyboardNavigationEventFilter??(()=>!0),c),this.disposables.add(this.typeNavigationController)}if(this.mouseController=this.createMouseController(n),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider){let c=this.accessibilityProvider.getWidgetAriaLabel(),u=c&&typeof c!="string"?c:Fo(c);this.disposables.add(ve(p=>{this.ariaLabel=p.readObservable(u)}))}this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}get onDidChangeFocus(){return U.map(this.eventBufferer.wrapEvent(this.focus.onChange),i=>this.toListEvent(i),this.disposables)}get onDidChangeSelection(){return U.map(this.eventBufferer.wrapEvent(this.selection.onChange),i=>this.toListEvent(i),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseUp(){return this.view.onMouseUp}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseMove(){return this.view.onMouseMove}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let i=!1,e=U.chain(this.disposables.add(new Zn(this.view.domNode,"keydown")).event,n=>n.map(r=>new mi(r)).filter(r=>i=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>Kt.stop(r,!0)).filter(()=>!1)),t=U.chain(this.disposables.add(new Zn(this.view.domNode,"keyup")).event,n=>n.forEach(()=>i=!1).map(r=>new mi(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>Kt.stop(r,!0)).map(({browserEvent:r})=>{let s=this.getFocus(),l=s.length?s[0]:void 0,c=typeof l<"u"?this.view.element(l):void 0,u=typeof l<"u"?this.view.domElement(l):this.view.domNode;return{index:l,element:c,anchor:u,browserEvent:r}})),o=U.chain(this.view.onContextMenu,n=>n.filter(r=>!i).map(({element:r,index:s,browserEvent:l})=>({element:r,index:s,anchor:new Ln(Me(this.view.domNode),l),browserEvent:l})));return U.any(e,t,o)}get onKeyDown(){return this.disposables.add(new Zn(this.view.domNode,"keydown")).event}get onKeyUp(){return this.disposables.add(new Zn(this.view.domNode,"keyup")).event}get onKeyPress(){return this.disposables.add(new Zn(this.view.domNode,"keypress")).event}get onDidFocus(){return U.signal(this.disposables.add(new Zn(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return U.signal(this.disposables.add(new Zn(this.view.domNode,"blur",!0)).event)}createListView(i,e,t,o){return new fke(i,e,t,o)}createMouseController(i){return new yde(this)}updateOptions(i={}){this._options={...this._options,...i},this.typeNavigationController?.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(i),this.keyboardController?.updateOptions(i),this.view.updateOptions(i)}get options(){return this._options}splice(i,e,t=[]){if(i<0||i>this.view.length)throw new tM(this.user,`Invalid start index: ${i}`);if(e<0)throw new tM(this.user,`Invalid delete count: ${e}`);e===0&&t.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(i,e,t))}updateWidth(i){this.view.updateWidth(i)}updateElementHeight(i,e){this.view.updateElementHeight(i,e,null)}rerender(){this.view.rerender()}element(i){return this.view.element(i)}indexOf(i){return this.view.indexOf(i)}indexAt(i){return this.view.indexAt(i)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get contentWidth(){return this.view.contentWidth}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.view.onDidChangeContentWidth}get scrollTop(){return this.view.getScrollTop()}set scrollTop(i){this.view.setScrollTop(i)}get scrollLeft(){return this.view.getScrollLeft()}set scrollLeft(i){this.view.setScrollLeft(i)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get firstMostlyVisibleIndex(){return this.view.firstMostlyVisibleIndex}get lastVisibleIndex(){return this.view.lastVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(i){this._ariaLabel=i,this.view.domNode.setAttribute("aria-label",i)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(i,e){this.view.layout(i,e)}triggerTypeNavigation(){this.typeNavigationController?.trigger()}setSelection(i,e){for(let t of i)if(t<0||t>=this.length)throw new tM(this.user,`Invalid index ${t}`);i=i.filter(t=>this.getElementGroupId(t)!==Sde),this.selection.set(i,e)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map(i=>this.view.element(i))}setAnchor(i){if(typeof i>"u"){this.anchor.set([]);return}if(i<0||i>=this.length)throw new tM(this.user,`Invalid index ${i}`);this.anchor.set([i])}getAnchor(){return this.anchor.get().at(0)}getAnchorElement(){let i=this.getAnchor();return typeof i>"u"?void 0:this.element(i)}getElementGroupId(i){let e=this.options.identityProvider;if(!e?.getGroupId)return;let t=this.element(i);return e.getGroupId(t)}filterIndicesByGroup(i,e){let t=this.options.identityProvider;return t?.getGroupId?e===Sde?[]:i.filter(o=>{let n=this.element(o);return t.getGroupId(n)===e}):i}setFocus(i,e){for(let t of i)if(t<0||t>=this.length)throw new tM(this.user,`Invalid index ${t}`);this.focus.set(i,e)}focusNext(i=1,e=!1,t,o){if(this.length===0)return;let n=this.focus.get(),r=this.findNextIndex(n.length>0?n[0]+i:0,e,o);r>-1&&this.setFocus([r],t)}focusPrevious(i=1,e=!1,t,o){if(this.length===0)return;let n=this.focus.get(),r=this.findPreviousIndex(n.length>0?n[0]-i:0,e,o);r>-1&&this.setFocus([r],t)}async focusNextPage(i,e){let t=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);t=t===0?0:t-1;let o=this.getFocus()[0];if(o!==t&&(o===void 0||t>o)){let n=this.findPreviousIndex(t,!1,e);n>-1&&o!==n?this.setFocus([n],i):this.setFocus([t],i)}else{let n=this.view.getScrollTop(),r=n+this.view.renderHeight;t>o&&(r-=this.view.elementHeight(t)),this.view.setScrollTop(r),this.view.getScrollTop()!==n&&(this.setFocus([]),await Li(0),await this.focusNextPage(i,e))}}async focusPreviousPage(i,e,t=()=>0){let o,n=t(),r=this.view.getScrollTop()+n;r===0?o=this.view.indexAt(r):o=this.view.indexAfter(r-1);let s=this.getFocus()[0];if(s!==o&&(s===void 0||s>=o)){let l=this.findNextIndex(o,!1,e);l>-1&&s!==l?this.setFocus([l],i):this.setFocus([o],i)}else{let l=r;this.view.setScrollTop(r-this.view.renderHeight-n),this.view.getScrollTop()+t()!==l&&(this.setFocus([]),await Li(0),await this.focusPreviousPage(i,e,t))}}focusLast(i,e){if(this.length===0)return;let t=this.findPreviousIndex(this.length-1,!1,e);t>-1&&this.setFocus([t],i)}focusFirst(i,e){this.focusNth(0,i,e)}focusNth(i,e,t){if(this.length===0)return;let o=this.findNextIndex(i,!1,t);o>-1&&this.setFocus([o],e)}findNextIndex(i,e=!1,t){for(let o=0;o<this.length;o++){if(i>=this.length&&!e)return-1;if(i=i%this.length,!t||t(this.element(i)))return i;i++}return-1}findPreviousIndex(i,e=!1,t){for(let o=0;o<this.length;o++){if(i<0&&!e)return-1;if(i=(this.length+i%this.length)%this.length,!t||t(this.element(i)))return i;i--}return-1}getFocus(){return this.focus.get()}getFocusedElements(){return this.getFocus().map(i=>this.view.element(i))}reveal(i,e,t=0){if(i<0||i>=this.length)throw new tM(this.user,`Invalid index ${i}`);let o=this.view.getScrollTop(),n=this.view.elementTop(i),r=this.view.elementHeight(i);if(on(e)){let s=r-this.view.renderHeight+t;this.view.setScrollTop(s*jn(e,0,1)+n-t)}else{let s=n+r,l=o+this.view.renderHeight;n<o+t&&s>=l||(n<o+t||s>=l&&r>=this.view.renderHeight?this.view.setScrollTop(n-t):s>=l&&this.view.setScrollTop(s-this.view.renderHeight))}}getRelativeTop(i,e=0){if(i<0||i>=this.length)throw new tM(this.user,`Invalid index ${i}`);let t=this.view.getScrollTop(),o=this.view.elementTop(i),n=this.view.elementHeight(i);if(o<t+e||o+n>t+this.view.renderHeight)return null;let r=n-this.view.renderHeight+e;return Math.abs((t+e-o)/r)}isDOMFocused(){return Na(this.view.domNode)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(i){return this.view.getElementDomId(i)}getElementTop(i){return this.view.elementTop(i)}style(i){this.styleController.style(i)}delegateScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}toListEvent({indexes:i,browserEvent:e}){return{indexes:i,elements:i.map(t=>this.view.element(t)),browserEvent:e}}_onFocusChange(){let i=this.focus.get();this.view.domNode.classList.toggle("element-focused",i.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){let i=this.focus.get();if(i.length>0){let e;this.accessibilityProvider?.getActiveDescendantId&&(e=this.accessibilityProvider.getActiveDescendantId(this.view.element(i[0]))),this.view.domNode.setAttribute("aria-activedescendant",e||this.view.getElementDomId(i[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){let i=this.selection.get();this.view.domNode.classList.toggle("selection-none",i.length===0),this.view.domNode.classList.toggle("selection-single",i.length===1),this.view.domNode.classList.toggle("selection-multiple",i.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}};I([bi],Gc.prototype,"onDidChangeFocus",1),I([bi],Gc.prototype,"onDidChangeSelection",1),I([bi],Gc.prototype,"onContextMenu",1),I([bi],Gc.prototype,"onKeyDown",1),I([bi],Gc.prototype,"onKeyUp",1),I([bi],Gc.prototype,"onKeyPress",1),I([bi],Gc.prototype,"onDidFocus",1),I([bi],Gc.prototype,"onDidBlur",1);var H$o="$(",Oci=new RegExp(`\\$\\(${q.iconNameExpression}(?:${q.iconModifierExpression})?\\)`,"g"),U$o=new RegExp(`(\\\\)?${Oci.source}`,"g");function UJi(a){return a.replace(U$o,(i,e)=>e?i:`\\${i}`)}var z$o=new RegExp(`\\\\${Oci.source}`,"g");function zJi(a){return a.replace(z$o,i=>`\\${i}`)}var K$o=new RegExp(`(\\s)?(\\\\)?${Oci.source}(\\s)?`,"g");function Du(a){return a.indexOf(H$o)===-1?a:a.replace(K$o,(i,e,t,o)=>t?i:e||o||"")}function AK(a){return a?a.replace(/\$\((.*?)\)/g,(i,e)=>` ${e} `).trim():""}var Nci=new RegExp(`\\$\\(${q.iconNameCharacter}+\\)`,"g");function MA(a){Nci.lastIndex=0;let i="",e=[],t=0;for(;;){let o=Nci.lastIndex,n=Nci.exec(a),r=a.substring(o,n?.index);if(r.length>0){i+=r;for(let s=0;s<r.length;s++)e.push(t)}if(!n)break;t+=n[0].length}return{text:i,iconOffsets:e}}function zB(a,i,e=!1){let{text:t,iconOffsets:o}=i;if(!o||o.length===0)return xh(a,t,e);let n=ax(t," "),r=t.length-n.length,s=xh(a,n,e);if(s)for(let l of s){let c=o[l.start+r]+r;l.start+=c,l.end+=c}return s}var he=class a{static lift(i){let e=new a(i.value,i);return e.uris=i.uris,e.baseUri=i.baseUri?A.revive(i.baseUri):void 0,e}constructor(i="",e=!1){if(this.value=i,typeof this.value!="string")throw ls("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(i,e=0){return this.value+=Ru(this.supportThemeIcons?UJi(i):i).replace(/([ \t]+)/g,(t,o)=>"&nbsp;".repeat(o.length)).replace(/\>/gm,"\\>").replace(/\n/g,e===1?`\\
`:`

`),this}appendMarkdown(i){return this.value+=i,this}appendCodeblock(i,e){return this.value+=`
${G$o(e,i)}
`,this}appendLink(i,e,t){return this.value+="[",this.value+=this._escape(e,"]"),this.value+="](",this.value+=this._escape(String(i),")"),t&&(this.value+=` "${this._escape(this._escape(t,'"'),")")}"`),this.value+=")",this}_escape(i,e){let t=new RegExp(Ss(e),"g");return i.replace(t,(o,n)=>i.charAt(n-1)!=="\\"?`\\${o}`:o)}};function KB(a){return yr(a)?!a.value:Array.isArray(a)?a.every(KB):!0}function yr(a){return a instanceof he?!0:a&&typeof a=="object"?typeof a.value=="string"&&(typeof a.isTrusted=="boolean"||typeof a.isTrusted=="object"||a.isTrusted===void 0)&&(typeof a.supportThemeIcons=="boolean"||a.supportThemeIcons===void 0)&&(typeof a.supportAlertSyntax=="boolean"||a.supportAlertSyntax===void 0):!1}function Cde(a,i){return a===i?!0:!a||!i?!1:a.value===i.value&&a.isTrusted===i.isTrusted&&a.supportThemeIcons===i.supportThemeIcons&&a.supportHtml===i.supportHtml&&a.supportAlertSyntax===i.supportAlertSyntax&&(a.baseUri===i.baseUri||!!a.baseUri&&!!i.baseUri&&ze(A.from(a.baseUri),A.from(i.baseUri)))}function Ru(a){return a.replace(/[\\`*_{}[\]()#+\-!~]/g,"\\$&")}function KJi(a){return a.replace(/[\\\]]/g,"\\$&")}function G$o(a,i){let e=a.match(/^`+/gm)?.reduce((o,n)=>o.length>n.length?o:n).length??0,t=e>=3?e+1:3;return[`${"`".repeat(t)}${i}`,a,`${"`".repeat(t)}`].join(`
`)}function $xt(a){let i=Math.max(0,...(a.match(/`+/g)??[]).map(n=>n.length)),e="`".repeat(i+1),o=a.startsWith("`")||a.endsWith("`")?` ${a} `:a;return`${e}${o}${e}`}function Ike(a){return a.replace(/"/g,"&quot;")}function jxt(a){return a&&a.replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")}function Qxt(a){let i=[],e=a.split("|").map(o=>o.trim());a=e[0];let t=e[1];if(t){let o=/height=(\d+)/.exec(t),n=/width=(\d+)/.exec(t),r=o?o[1]:"",s=n?n[1]:"",l=isFinite(parseInt(s)),c=isFinite(parseInt(r));l&&i.push(`width="${s}"`),c&&i.push(`height="${r}"`)}return{href:a,dimensions:i}}function Yxt(a,i,e,t=!0){return`[${t?Ru(a):a}](${i}${e?` "${Ru(e)}"`:""})`}function Xw(a,i=!0){let e=nc(a.id,...a.arguments||[]).toString();return Yxt(a.text,e,a.tooltip,i)}function nc(a,...i){return A.from({scheme:Q.command,path:a,query:i.length?encodeURIComponent(JSON.stringify(i)):void 0})}var xde=class{constructor(i){this._prefix=i,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}},o4=new xde("id#");function Wci(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ede=Wci();function YJi(a){Ede=a}var XJi=/[&<>"']/,$$o=new RegExp(XJi.source,"g"),JJi=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,j$o=new RegExp(JJi.source,"g"),Q$o={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},GJi=a=>Q$o[a];function PA(a,i){if(i){if(XJi.test(a))return a.replace($$o,GJi)}else if(JJi.test(a))return a.replace(j$o,GJi);return a}var Y$o=/(^|[^\[])\^/g;function Rg(a,i){let e=typeof a=="string"?a:a.source;i=i||"";let t={replace:(o,n)=>{let r=typeof n=="string"?n:n.source;return r=r.replace(Y$o,"$1"),e=e.replace(o,r),t},getRegex:()=>new RegExp(e,i)};return t}function qJi(a){try{a=encodeURI(a).replace(/%25/g,"%")}catch{return null}return a}var Y8e={exec:()=>null};function $Ji(a,i){let e=a.replace(/\|/g,(n,r,s)=>{let l=!1,c=r;for(;--c>=0&&s[c]==="\\";)l=!l;return l?"|":" |"}),t=e.split(/ \|/),o=0;if(t[0].trim()||t.shift(),t.length>0&&!t[t.length-1].trim()&&t.pop(),i)if(t.length>i)t.splice(i);else for(;t.length<i;)t.push("");for(;o<t.length;o++)t[o]=t[o].trim().replace(/\\\|/g,"|");return t}function j8e(a,i,e){let t=a.length;if(t===0)return"";let o=0;for(;o<t;){let n=a.charAt(t-o-1);if(n===i&&!e)o++;else if(n!==i&&e)o++;else break}return a.slice(0,t-o)}function X$o(a,i){if(a.indexOf(i[1])===-1)return-1;let e=0;for(let t=0;t<a.length;t++)if(a[t]==="\\")t++;else if(a[t]===i[0])e++;else if(a[t]===i[1]&&(e--,e<0))return t;return-1}function jJi(a,i,e,t){let o=i.href,n=i.title?PA(i.title):null,r=a[1].replace(/\\([\[\]])/g,"$1");if(a[0].charAt(0)!=="!"){t.state.inLink=!0;let s={type:"link",raw:e,href:o,title:n,text:r,tokens:t.inlineTokens(r)};return t.state.inLink=!1,s}return{type:"image",raw:e,href:o,title:n,text:PA(r)}}function J$o(a,i){let e=a.match(/^(\s+)(?:```)/);if(e===null)return i;let t=e[1];return i.split(`
`).map(o=>{let n=o.match(/^\s+/);if(n===null)return o;let[r]=n;return r.length>=t.length?o.slice(t.length):o}).join(`
`)}var wke=class{options;rules;lexer;constructor(i){this.options=i||Ede}space(i){let e=this.rules.block.newline.exec(i);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(i){let e=this.rules.block.code.exec(i);if(e){let t=e[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?t:j8e(t,`
`)}}}fences(i){let e=this.rules.block.fences.exec(i);if(e){let t=e[0],o=J$o(t,e[3]||"");return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:o}}}heading(i){let e=this.rules.block.heading.exec(i);if(e){let t=e[2].trim();if(/#$/.test(t)){let o=j8e(t,"#");(this.options.pedantic||!o||/ $/.test(o))&&(t=o.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(i){let e=this.rules.block.hr.exec(i);if(e)return{type:"hr",raw:j8e(e[0],`
`)}}blockquote(i){let e=this.rules.block.blockquote.exec(i);if(e){let t=j8e(e[0],`
`).split(`
`),o="",n="",r=[];for(;t.length>0;){let s=!1,l=[],c;for(c=0;c<t.length;c++)if(/^ {0,3}>/.test(t[c]))l.push(t[c]),s=!0;else if(!s)l.push(t[c]);else break;t=t.slice(c);let u=l.join(`
`),p=u.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
    $1`).replace(/^ {0,3}>[ \t]?/gm,"");o=o?`${o}
${u}`:u,n=n?`${n}
${p}`:p;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,r,!0),this.lexer.state.top=h,t.length===0)break;let g=r[r.length-1];if(g?.type==="code")break;if(g?.type==="blockquote"){let f=g,v=f.raw+`
`+t.join(`
`),b=this.blockquote(v);r[r.length-1]=b,o=o.substring(0,o.length-f.raw.length)+b.raw,n=n.substring(0,n.length-f.text.length)+b.text;break}else if(g?.type==="list"){let f=g,v=f.raw+`
`+t.join(`
`),b=this.list(v);r[r.length-1]=b,o=o.substring(0,o.length-g.raw.length)+b.raw,n=n.substring(0,n.length-f.raw.length)+b.raw,t=v.substring(r[r.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:o,tokens:r,text:n}}}list(i){let e=this.rules.block.list.exec(i);if(e){let t=e[1].trim(),o=t.length>1,n={type:"list",raw:"",ordered:o,start:o?+t.slice(0,-1):"",loose:!1,items:[]};t=o?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=o?t:"[*+-]");let r=new RegExp(`^( {0,3}${t})((?:[	 ][^\\n]*)?(?:\\n|$))`),s=!1;for(;i;){let l=!1,c="",u="";if(!(e=r.exec(i))||this.rules.block.hr.test(i))break;c=e[0],i=i.substring(c.length);let p=e[2].split(`
`,1)[0].replace(/^\t+/,S=>" ".repeat(3*S.length)),h=i.split(`
`,1)[0],g=!p.trim(),f=0;if(this.options.pedantic?(f=2,u=p.trimStart()):g?f=e[1].length+1:(f=e[2].search(/[^ ]/),f=f>4?1:f,u=p.slice(f),f+=e[1].length),g&&/^ *$/.test(h)&&(c+=h+`
`,i=i.substring(h.length+1),l=!0),!l){let S=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),y=new RegExp(`^ {0,${Math.min(3,f-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),w=new RegExp(`^ {0,${Math.min(3,f-1)}}(?:\`\`\`|~~~)`),x=new RegExp(`^ {0,${Math.min(3,f-1)}}#`);for(;i;){let E=i.split(`
`,1)[0];if(h=E,this.options.pedantic&&(h=h.replace(/^ {1,4}(?=( {4})*[^ ])/g,"  ")),w.test(h)||x.test(h)||S.test(h)||y.test(i))break;if(h.search(/[^ ]/)>=f||!h.trim())u+=`
`+h.slice(f);else{if(g||p.search(/[^ ]/)>=4||w.test(p)||x.test(p)||y.test(p))break;u+=`
`+h}!g&&!h.trim()&&(g=!0),c+=E+`
`,i=i.substring(E.length+1),p=h.slice(f)}}n.loose||(s?n.loose=!0:/\n *\n *$/.test(c)&&(s=!0));let v=null,b;this.options.gfm&&(v=/^\[[ xX]\] /.exec(u),v&&(b=v[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),n.items.push({type:"list_item",raw:c,task:!!v,checked:b,loose:!1,text:u,tokens:[]}),n.raw+=c}n.items[n.items.length-1].raw=n.items[n.items.length-1].raw.trimEnd(),n.items[n.items.length-1].text=n.items[n.items.length-1].text.trimEnd(),n.raw=n.raw.trimEnd();for(let l=0;l<n.items.length;l++)if(this.lexer.state.top=!1,n.items[l].tokens=this.lexer.blockTokens(n.items[l].text,[]),!n.loose){let c=n.items[l].tokens.filter(p=>p.type==="space"),u=c.length>0&&c.some(p=>/\n.*\n/.test(p.raw));n.loose=u}if(n.loose)for(let l=0;l<n.items.length;l++)n.items[l].loose=!0;return n}}html(i){let e=this.rules.block.html.exec(i);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(i){let e=this.rules.block.def.exec(i);if(e){let t=e[1].toLowerCase().replace(/\s+/g," "),o=e[2]?e[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:e[0],href:o,title:n}}}table(i){let e=this.rules.block.table.exec(i);if(!e||!/[:|]/.test(e[2]))return;let t=$Ji(e[1]),o=e[2].replace(/^\||\| *$/g,"").split("|"),n=e[3]&&e[3].trim()?e[3].replace(/\n[ \t]*$/,"").split(`
`):[],r={type:"table",raw:e[0],header:[],align:[],rows:[]};if(t.length===o.length){for(let s of o)/^ *-+: *$/.test(s)?r.align.push("right"):/^ *:-+: *$/.test(s)?r.align.push("center"):/^ *:-+ *$/.test(s)?r.align.push("left"):r.align.push(null);for(let s=0;s<t.length;s++)r.header.push({text:t[s],tokens:this.lexer.inline(t[s]),header:!0,align:r.align[s]});for(let s of n)r.rows.push($Ji(s,r.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[c]})));return r}}lheading(i){let e=this.rules.block.lheading.exec(i);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(i){let e=this.rules.block.paragraph.exec(i);if(e){let t=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(i){let e=this.rules.block.text.exec(i);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(i){let e=this.rules.inline.escape.exec(i);if(e)return{type:"escape",raw:e[0],text:PA(e[1])}}tag(i){let e=this.rules.inline.tag.exec(i);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(i){let e=this.rules.inline.link.exec(i);if(e){let t=e[2].trim();if(!this.options.pedantic&&/^</.test(t)){if(!/>$/.test(t))return;let r=j8e(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=X$o(e[2],"()");if(r>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let o=e[2],n="";if(this.options.pedantic){let r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(o);r&&(o=r[1],n=r[3])}else n=e[3]?e[3].slice(1,-1):"";return o=o.trim(),/^</.test(o)&&(this.options.pedantic&&!/>$/.test(t)?o=o.slice(1):o=o.slice(1,-1)),jJi(e,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer)}}reflink(i,e){let t;if((t=this.rules.inline.reflink.exec(i))||(t=this.rules.inline.nolink.exec(i))){let o=(t[2]||t[1]).replace(/\s+/g," "),n=e[o.toLowerCase()];if(!n){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return jJi(t,n,t[0],this.lexer)}}emStrong(i,e,t=""){let o=this.rules.inline.emStrongLDelim.exec(i);if(!o||o[3]&&t.match(/[\p{L}\p{N}]/u))return;if(!(o[1]||o[2]||"")||!t||this.rules.inline.punctuation.exec(t)){let r=[...o[0]].length-1,s,l,c=r,u=0,p=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,e=e.slice(-1*i.length+r);(o=p.exec(e))!=null;){if(s=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!s)continue;if(l=[...s].length,o[3]||o[4]){c+=l;continue}else if((o[5]||o[6])&&r%3&&!((r+l)%3)){u+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+u);let h=[...o[0]][0].length,g=i.slice(0,r+o.index+h+l);if(Math.min(r,l)%2){let v=g.slice(1,-1);return{type:"em",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}let f=g.slice(2,-2);return{type:"strong",raw:g,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(i){let e=this.rules.inline.code.exec(i);if(e){let t=e[2].replace(/\n/g," "),o=/[^ ]/.test(t),n=/^ /.test(t)&&/ $/.test(t);return o&&n&&(t=t.substring(1,t.length-1)),t=PA(t,!0),{type:"codespan",raw:e[0],text:t}}}br(i){let e=this.rules.inline.br.exec(i);if(e)return{type:"br",raw:e[0]}}del(i){let e=this.rules.inline.del.exec(i);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(i){let e=this.rules.inline.autolink.exec(i);if(e){let t,o;return e[2]==="@"?(t=PA(e[1]),o="mailto:"+t):(t=PA(e[1]),o=t),{type:"link",raw:e[0],text:t,href:o,tokens:[{type:"text",raw:t,text:t}]}}}url(i){let e;if(e=this.rules.inline.url.exec(i)){let t,o;if(e[2]==="@")t=PA(e[0]),o="mailto:"+t;else{let n;do n=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(n!==e[0]);t=PA(e[0]),e[1]==="www."?o="http://"+e[0]:o=e[0]}return{type:"link",raw:e[0],text:t,href:o,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(i){let e=this.rules.inline.text.exec(i);if(e){let t;return this.lexer.state.inRawBlock?t=e[0]:t=PA(e[0]),{type:"text",raw:e[0],text:t}}}},Z$o=/^(?: *(?:\n|$))+/,ejo=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,tjo=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,J8e=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,ijo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ZJi=/(?:[*+-]|\d{1,9}[.)])/,eZi=Rg(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,ZJi).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(),Vci=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ojo=/^[^\n]+/,Bci=/(?!\s*\])(?:\\.|[^\[\]\\])+/,njo=Rg(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Bci).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rjo=Rg(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ZJi).getRegex(),Zxt="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",Hci=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sjo=Rg("^ {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",Hci).replace("tag",Zxt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tZi=Rg(Vci).replace("hr",J8e).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",Zxt).getRegex(),ajo=Rg(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",tZi).getRegex(),Uci={blockquote:ajo,code:ejo,def:njo,fences:tjo,heading:ijo,hr:J8e,html:sjo,lheading:eZi,list:rjo,newline:Z$o,paragraph:tZi,table:Y8e,text:ojo},QJi=Rg("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",J8e).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",Zxt).getRegex(),ljo={...Uci,table:QJi,paragraph:Rg(Vci).replace("hr",J8e).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",QJi).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",Zxt).getRegex()},cjo={...Uci,html:Rg(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Hci).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:Y8e,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Rg(Vci).replace("hr",J8e).replace("heading",` *#{1,6} *[^
]`).replace("lheading",eZi).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},iZi=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,djo=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,oZi=/^( {2,}|\\)\n(?!\s*$)/,ujo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Z8e="\\p{P}\\p{S}",pjo=Rg(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Z8e).getRegex(),mjo=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,hjo=Rg(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Z8e).getRegex(),gjo=Rg("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Z8e).getRegex(),fjo=Rg("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Z8e).getRegex(),vjo=Rg(/\\([punct])/,"gu").replace(/punct/g,Z8e).getRegex(),bjo=Rg(/^<(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(),Sjo=Rg(Hci).replace("(?:-->|$)","-->").getRegex(),Ijo=Rg("^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",Sjo).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Jxt=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,yjo=Rg(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Jxt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nZi=Rg(/^!?\[(label)\]\[(ref)\]/).replace("label",Jxt).replace("ref",Bci).getRegex(),rZi=Rg(/^!?\[(ref)\](?:\[\])?/).replace("ref",Bci).getRegex(),wjo=Rg("reflink|nolink(?!\\()","g").replace("reflink",nZi).replace("nolink",rZi).getRegex(),zci={_backpedal:Y8e,anyPunctuation:vjo,autolink:bjo,blockSkip:mjo,br:oZi,code:djo,del:Y8e,emStrongLDelim:hjo,emStrongRDelimAst:gjo,emStrongRDelimUnd:fjo,escape:iZi,link:yjo,nolink:rZi,punctuation:pjo,reflink:nZi,reflinkSearch:wjo,tag:Ijo,text:ujo,url:Y8e},Cjo={...zci,link:Rg(/^!?\[(label)\]\((.*?)\)/).replace("label",Jxt).getRegex(),reflink:Rg(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Jxt).getRegex()},Fci={...zci,escape:Rg(iZi).replace("])","~|])").getRegex(),url:Rg(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},xjo={...Fci,br:Rg(oZi).replace("{2,}","*").getRegex(),text:Rg(Fci.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Xxt={normal:Uci,gfm:ljo,pedantic:cjo},Q8e={normal:zci,gfm:Fci,breaks:xjo,pedantic:Cjo},n4=class a{tokens;options;state;tokenizer;inlineQueue;constructor(i){this.tokens=[],this.tokens.links=Object.create(null),this.options=i||Ede,this.options.tokenizer=this.options.tokenizer||new wke,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:Xxt.normal,inline:Q8e.normal};this.options.pedantic?(e.block=Xxt.pedantic,e.inline=Q8e.pedantic):this.options.gfm&&(e.block=Xxt.gfm,this.options.breaks?e.inline=Q8e.breaks:e.inline=Q8e.gfm),this.tokenizer.rules=e}static get rules(){return{block:Xxt,inline:Q8e}}static lex(i,e){return new a(e).lex(i)}static lexInline(i,e){return new a(e).inlineTokens(i)}lex(i){i=i.replace(/\r\n|\r/g,`
`),this.blockTokens(i,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(i,e=[],t=!1){this.options.pedantic?i=i.replace(/\t/g,"    ").replace(/^ +$/gm,""):i=i.replace(/^( *)(\t+)/gm,(s,l,c)=>l+"    ".repeat(c.length));let o,n,r;for(;i;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(s=>(o=s.call({lexer:this},i,e))?(i=i.substring(o.raw.length),e.push(o),!0):!1))){if(o=this.tokenizer.space(i)){i=i.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(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&(n.type==="paragraph"||n.type==="text")?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o);continue}if(o=this.tokenizer.fences(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.heading(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.hr(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.blockquote(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.list(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.html(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.def(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&(n.type==="paragraph"||n.type==="text")?(n.raw+=`
`+o.raw,n.text+=`
`+o.raw,this.inlineQueue[this.inlineQueue.length-1].src=n.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(i)){i=i.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.lheading(i)){i=i.substring(o.raw.length),e.push(o);continue}if(r=i,this.options.extensions&&this.options.extensions.startBlock){let s=1/0,l=i.slice(1),c;this.options.extensions.startBlock.forEach(u=>{c=u.call({lexer:this},l),typeof c=="number"&&c>=0&&(s=Math.min(s,c))}),s<1/0&&s>=0&&(r=i.substring(0,s+1))}if(this.state.top&&(o=this.tokenizer.paragraph(r))){n=e[e.length-1],t&&n?.type==="paragraph"?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o),t=r.length!==i.length,i=i.substring(o.raw.length);continue}if(o=this.tokenizer.text(i)){i=i.substring(o.raw.length),n=e[e.length-1],n&&n.type==="text"?(n.raw+=`
`+o.raw,n.text+=`
`+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=n.text):e.push(o);continue}if(i){let s="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(s);break}else throw new Error(s)}}return this.state.top=!0,e}inline(i,e=[]){return this.inlineQueue.push({src:i,tokens:e}),e}inlineTokens(i,e=[]){let t,o,n,r=i,s,l,c;if(this.tokens.links){let u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;i;)if(l||(c=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(u=>(t=u.call({lexer:this},i,e))?(i=i.substring(t.raw.length),e.push(t),!0):!1))){if(t=this.tokenizer.escape(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.tag(i)){i=i.substring(t.raw.length),o=e[e.length-1],o&&t.type==="text"&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(t=this.tokenizer.link(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.reflink(i,this.tokens.links)){i=i.substring(t.raw.length),o=e[e.length-1],o&&t.type==="text"&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(t=this.tokenizer.emStrong(i,r,c)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.codespan(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.br(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.del(i)){i=i.substring(t.raw.length),e.push(t);continue}if(t=this.tokenizer.autolink(i)){i=i.substring(t.raw.length),e.push(t);continue}if(!this.state.inLink&&(t=this.tokenizer.url(i))){i=i.substring(t.raw.length),e.push(t);continue}if(n=i,this.options.extensions&&this.options.extensions.startInline){let u=1/0,p=i.slice(1),h;this.options.extensions.startInline.forEach(g=>{h=g.call({lexer:this},p),typeof h=="number"&&h>=0&&(u=Math.min(u,h))}),u<1/0&&u>=0&&(n=i.substring(0,u+1))}if(t=this.tokenizer.inlineText(n)){i=i.substring(t.raw.length),t.raw.slice(-1)!=="_"&&(c=t.raw.slice(-1)),l=!0,o=e[e.length-1],o&&o.type==="text"?(o.raw+=t.raw,o.text+=t.text):e.push(t);continue}if(i){let u="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(u);break}else throw new Error(u)}}return e}},KX=class{options;parser;constructor(i){this.options=i||Ede}space(i){return""}code({text:i,lang:e,escaped:t}){let o=(e||"").match(/^\S*/)?.[0],n=i.replace(/\n$/,"")+`
`;return o?'<pre><code class="language-'+PA(o)+'">'+(t?n:PA(n,!0))+`</code></pre>
`:"<pre><code>"+(t?n:PA(n,!0))+`</code></pre>
`}blockquote({tokens:i}){return`<blockquote>
${this.parser.parse(i)}</blockquote>
`}html({text:i}){return i}heading({tokens:i,depth:e}){return`<h${e}>${this.parser.parseInline(i)}</h${e}>
`}hr(i){return`<hr>
`}list(i){let e=i.ordered,t=i.start,o="";for(let s=0;s<i.items.length;s++){let l=i.items[s];o+=this.listitem(l)}let n=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+n+r+`>
`+o+"</"+n+`>
`}listitem(i){let e="";if(i.task){let t=this.checkbox({checked:!!i.checked});i.loose?i.tokens.length>0&&i.tokens[0].type==="paragraph"?(i.tokens[0].text=t+" "+i.tokens[0].text,i.tokens[0].tokens&&i.tokens[0].tokens.length>0&&i.tokens[0].tokens[0].type==="text"&&(i.tokens[0].tokens[0].text=t+" "+i.tokens[0].tokens[0].text)):i.tokens.unshift({type:"text",raw:t+" ",text:t+" "}):e+=t+" "}return e+=this.parser.parse(i.tokens,!!i.loose),`<li>${e}</li>
`}checkbox({checked:i}){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:i}){return`<p>${this.parser.parseInline(i)}</p>
`}table(i){let e="",t="";for(let n=0;n<i.header.length;n++)t+=this.tablecell(i.header[n]);e+=this.tablerow({text:t});let o="";for(let n=0;n<i.rows.length;n++){let r=i.rows[n];t="";for(let s=0;s<r.length;s++)t+=this.tablecell(r[s]);o+=this.tablerow({text:t})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+o+`</table>
`}tablerow({text:i}){return`<tr>
${i}</tr>
`}tablecell(i){let e=this.parser.parseInline(i.tokens),t=i.header?"th":"td";return(i.align?`<${t} align="${i.align}">`:`<${t}>`)+e+`</${t}>
`}strong({tokens:i}){return`<strong>${this.parser.parseInline(i)}</strong>`}em({tokens:i}){return`<em>${this.parser.parseInline(i)}</em>`}codespan({text:i}){return`<code>${i}</code>`}br(i){return"<br>"}del({tokens:i}){return`<del>${this.parser.parseInline(i)}</del>`}link({href:i,title:e,tokens:t}){let o=this.parser.parseInline(t),n=qJi(i);if(n===null)return o;i=n;let r='<a href="'+i+'"';return e&&(r+=' title="'+e+'"'),r+=">"+o+"</a>",r}image({href:i,title:e,text:t}){let o=qJi(i);if(o===null)return t;i=o;let n=`<img src="${i}" alt="${t}"`;return e&&(n+=` title="${e}"`),n+=">",n}text(i){return"tokens"in i&&i.tokens?this.parser.parseInline(i.tokens):i.text}},X8e=class{strong({text:i}){return i}em({text:i}){return i}codespan({text:i}){return i}del({text:i}){return i}html({text:i}){return i}text({text:i}){return i}link({text:i}){return""+i}image({text:i}){return""+i}br(){return""}},r4=class a{options;renderer;textRenderer;constructor(i){this.options=i||Ede,this.options.renderer=this.options.renderer||new KX,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new X8e}static parse(i,e){return new a(e).parse(i)}static parseInline(i,e){return new a(e).parseInline(i)}parse(i,e=!0){let t="";for(let o=0;o<i.length;o++){let n=i[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){let s=n,l=this.options.extensions.renderers[s.type].call({parser:this},s);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(s.type)){t+=l||"";continue}}let r=n;switch(r.type){case"space":{t+=this.renderer.space(r);continue}case"hr":{t+=this.renderer.hr(r);continue}case"heading":{t+=this.renderer.heading(r);continue}case"code":{t+=this.renderer.code(r);continue}case"table":{t+=this.renderer.table(r);continue}case"blockquote":{t+=this.renderer.blockquote(r);continue}case"list":{t+=this.renderer.list(r);continue}case"html":{t+=this.renderer.html(r);continue}case"paragraph":{t+=this.renderer.paragraph(r);continue}case"text":{let s=r,l=this.renderer.text(s);for(;o+1<i.length&&i[o+1].type==="text";)s=i[++o],l+=`
`+this.renderer.text(s);e?t+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l}]}):t+=l;continue}default:{let s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}parseInline(i,e){e=e||this.renderer;let t="";for(let o=0;o<i.length;o++){let n=i[o];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[n.type]){let s=this.options.extensions.renderers[n.type].call({parser:this},n);if(s!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){t+=s||"";continue}}let r=n;switch(r.type){case"escape":{t+=e.text(r);break}case"html":{t+=e.html(r);break}case"link":{t+=e.link(r);break}case"image":{t+=e.image(r);break}case"strong":{t+=e.strong(r);break}case"em":{t+=e.em(r);break}case"codespan":{t+=e.codespan(r);break}case"br":{t+=e.br(r);break}case"del":{t+=e.del(r);break}case"text":{t+=e.text(r);break}default:{let s='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(s),"";throw new Error(s)}}}return t}},yke=class{options;constructor(i){this.options=i||Ede}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}},s4=class{defaults=Wci();options=this.setOptions;parse=this.parseMarkdown(n4.lex,r4.parse);parseInline=this.parseMarkdown(n4.lexInline,r4.parseInline);Parser=r4;Renderer=KX;TextRenderer=X8e;Lexer=n4;Tokenizer=wke;Hooks=yke;constructor(...i){this.use(...i)}walkTokens(i,e){let t=[];for(let o of i)switch(t=t.concat(e.call(this,o)),o.type){case"table":{let n=o;for(let r of n.header)t=t.concat(this.walkTokens(r.tokens,e));for(let r of n.rows)for(let s of r)t=t.concat(this.walkTokens(s.tokens,e));break}case"list":{let n=o;t=t.concat(this.walkTokens(n.items,e));break}default:{let n=o;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(r=>{let s=n[r].flat(1/0);t=t.concat(this.walkTokens(s,e))}):n.tokens&&(t=t.concat(this.walkTokens(n.tokens,e)))}}return t}use(...i){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(t=>{let o={...t};if(o.async=this.defaults.async||o.async||!1,t.extensions&&(t.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let r=e.renderers[n.name];r?e.renderers[n.name]=function(...s){let l=n.renderer.apply(this,s);return l===!1&&(l=r.apply(this,s)),l}:e.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[n.level];r?r.unshift(n.tokenizer):e[n.level]=[n.tokenizer],n.start&&(n.level==="block"?e.startBlock?e.startBlock.push(n.start):e.startBlock=[n.start]:n.level==="inline"&&(e.startInline?e.startInline.push(n.start):e.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(e.childTokens[n.name]=n.childTokens)}),o.extensions=e),t.renderer){let n=this.defaults.renderer||new KX(this.defaults);for(let r in t.renderer){if(!(r in n))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let s=r,l=t.renderer[s],c=n[s];n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p||""}}o.renderer=n}if(t.tokenizer){let n=this.defaults.tokenizer||new wke(this.defaults);for(let r in t.tokenizer){if(!(r in n))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let s=r,l=t.tokenizer[s],c=n[s];n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p}}o.tokenizer=n}if(t.hooks){let n=this.defaults.hooks||new yke;for(let r in t.hooks){if(!(r in n))throw new Error(`hook '${r}' does not exist`);if(r==="options")continue;let s=r,l=t.hooks[s],c=n[s];yke.passThroughHooks.has(r)?n[s]=u=>{if(this.defaults.async)return Promise.resolve(l.call(n,u)).then(h=>c.call(n,h));let p=l.call(n,u);return c.call(n,p)}:n[s]=(...u)=>{let p=l.apply(n,u);return p===!1&&(p=c.apply(n,u)),p}}o.hooks=n}if(t.walkTokens){let n=this.defaults.walkTokens,r=t.walkTokens;o.walkTokens=function(s){let l=[];return l.push(r.call(this,s)),n&&(l=l.concat(n.call(this,s))),l}}this.defaults={...this.defaults,...o}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,e){return n4.lex(i,e??this.defaults)}parser(i,e){return r4.parse(i,e??this.defaults)}parseMarkdown(i,e){return(o,n)=>{let r={...n},s={...this.defaults,...r},l=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&r.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(s.hooks&&(s.hooks.options=s),s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(o):o).then(c=>i(c,s)).then(c=>s.hooks?s.hooks.processAllTokens(c):c).then(c=>s.walkTokens?Promise.all(this.walkTokens(c,s.walkTokens)).then(()=>c):c).then(c=>e(c,s)).then(c=>s.hooks?s.hooks.postprocess(c):c).catch(l);try{s.hooks&&(o=s.hooks.preprocess(o));let c=i(o,s);s.hooks&&(c=s.hooks.processAllTokens(c)),s.walkTokens&&this.walkTokens(c,s.walkTokens);let u=e(c,s);return s.hooks&&(u=s.hooks.postprocess(u)),u}catch(c){return l(c)}}}onError(i,e){return t=>{if(t.message+=`
Please report this to https://github.com/markedjs/marked.`,i){let o="<p>An error occurred:</p><pre>"+PA(t.message+"",!0)+"</pre>";return e?Promise.resolve(o):o}if(e)return Promise.reject(t);throw t}}},kde=new s4;function zl(a,i){return kde.parse(a,i)}zl.options=zl.setOptions=function(a){return kde.setOptions(a),zl.defaults=kde.defaults,YJi(zl.defaults),zl};zl.getDefaults=Wci;zl.defaults=Ede;zl.use=function(...a){return kde.use(...a),zl.defaults=kde.defaults,YJi(zl.defaults),zl};zl.walkTokens=function(a,i){return kde.walkTokens(a,i)};zl.parseInline=kde.parseInline;zl.Parser=r4;zl.parser=r4.parse;zl.Renderer=KX;zl.TextRenderer=X8e;zl.Lexer=n4;zl.lexer=n4.lex;zl.Tokenizer=wke;zl.Hooks=yke;zl.parse=zl;var NMr=zl.options,OMr=zl.setOptions,FMr=zl.use,WMr=zl.walkTokens,VMr=zl.parseInline,sZi=zl,BMr=r4.parse,Cke=n4.lex;var{entries:gZi,setPrototypeOf:aZi,isFrozen:kjo,getPrototypeOf:Ejo,getOwnPropertyDescriptor:Tjo}=Object,{freeze:RD,seal:KF,create:fZi}=Object,{apply:Yci,construct:Xci}=typeof Reflect<"u"&&Reflect;RD||(RD=function(i){return i});KF||(KF=function(i){return i});Yci||(Yci=function(i,e){for(var t=arguments.length,o=new Array(t>2?t-2:0),n=2;n<t;n++)o[n-2]=arguments[n];return i.apply(e,o)});Xci||(Xci=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),o=1;o<e;o++)t[o-1]=arguments[o];return new i(...t)});var ekt=LD(Array.prototype.forEach),_jo=LD(Array.prototype.lastIndexOf),lZi=LD(Array.prototype.pop),eQe=LD(Array.prototype.push),Djo=LD(Array.prototype.splice),ikt=LD(String.prototype.toLowerCase),Kci=LD(String.prototype.toString),Gci=LD(String.prototype.match),tQe=LD(String.prototype.replace),Rjo=LD(String.prototype.indexOf),Ljo=LD(String.prototype.trim),GB=LD(Object.prototype.hasOwnProperty),DD=LD(RegExp.prototype.test),iQe=Mjo(TypeError);function LD(a){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var e=arguments.length,t=new Array(e>1?e-1:0),o=1;o<e;o++)t[o-1]=arguments[o];return Yci(a,i,t)}}function Mjo(a){return function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return Xci(a,e)}}function Qu(a,i){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ikt;aZi&&aZi(a,null);let t=i.length;for(;t--;){let o=i[t];if(typeof o=="string"){let n=e(o);n!==o&&(kjo(i)||(i[t]=n),o=n)}a[o]=!0}return a}function Pjo(a){for(let i=0;i<a.length;i++)GB(a,i)||(a[i]=null);return a}function a4(a){let i=fZi(null);for(let[e,t]of gZi(a))GB(a,e)&&(Array.isArray(t)?i[e]=Pjo(t):t&&typeof t=="object"&&t.constructor===Object?i[e]=a4(t):i[e]=t);return i}function oQe(a,i){for(;a!==null;){let t=Tjo(a,i);if(t){if(t.get)return LD(t.get);if(typeof t.value=="function")return LD(t.value)}a=Ejo(a)}function e(){return null}return e}var cZi=RD(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),qci=RD(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),$ci=RD(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ajo=RD(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),jci=RD(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Njo=RD(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),dZi=RD(["#text"]),uZi=RD(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Qci=RD(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),pZi=RD(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),tkt=RD(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ojo=KF(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Fjo=KF(/<%[\w\W]*|[\w\W]*%>/gm),Wjo=KF(/\$\{[\w\W]*/gm),Vjo=KF(/^data-[\-\w.\u00B7-\uFFFF]+$/),Bjo=KF(/^aria-[\-\w]+$/),vZi=KF(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Hjo=KF(/^(?:\w+script|data):/i),Ujo=KF(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),bZi=KF(/^html$/i),zjo=KF(/^[a-z][.\w]*(-[.\w]+)+$/i),mZi=Object.freeze({__proto__:null,ARIA_ATTR:Bjo,ATTR_WHITESPACE:Ujo,CUSTOM_ELEMENT:zjo,DATA_ATTR:Vjo,DOCTYPE_NAME:bZi,ERB_EXPR:Fjo,IS_ALLOWED_URI:vZi,IS_SCRIPT_OR_DATA:Hjo,MUSTACHE_EXPR:Ojo,TMPLIT_EXPR:Wjo}),nQe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Kjo=function(){return typeof window>"u"?null:window},Gjo=function(i,e){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let t=null,o="data-tt-policy-suffix";e&&e.hasAttribute(o)&&(t=e.getAttribute(o));let n="dompurify"+(t?"#"+t:"");try{return i.createPolicy(n,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},hZi=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function SZi(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Kjo(),i=Ya=>SZi(Ya);if(i.version="3.2.7",i.removed=[],!a||!a.document||a.document.nodeType!==nQe.document||!a.Element)return i.isSupported=!1,i;let{document:e}=a,t=e,o=t.currentScript,{DocumentFragment:n,HTMLTemplateElement:r,Node:s,Element:l,NodeFilter:c,NamedNodeMap:u=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:p,DOMParser:h,trustedTypes:g}=a,f=l.prototype,v=oQe(f,"cloneNode"),b=oQe(f,"remove"),S=oQe(f,"nextSibling"),y=oQe(f,"childNodes"),w=oQe(f,"parentNode");if(typeof r=="function"){let Ya=e.createElement("template");Ya.content&&Ya.content.ownerDocument&&(e=Ya.content.ownerDocument)}let x,E="",{implementation:M,createNodeIterator:N,createDocumentFragment:V,getElementsByTagName:H}=e,{importNode:K}=t,j=hZi();i.isSupported=typeof gZi=="function"&&typeof w=="function"&&M&&M.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:J,ERB_EXPR:se,TMPLIT_EXPR:ae,DATA_ATTR:ce,ARIA_ATTR:Se,IS_SCRIPT_OR_DATA:Re,ATTR_WHITESPACE:xe,CUSTOM_ELEMENT:He}=mZi,{IS_ALLOWED_URI:Ee}=mZi,Te=null,It=Qu({},[...cZi,...qci,...$ci,...jci,...dZi]),tt=null,Oi=Qu({},[...uZi,...Qci,...pZi,...tkt]),zt=Object.seal(fZi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),mo=null,dn=null,No=!0,_i=!0,ln=!1,Tn=!0,Ko=!1,Bn=!0,Mr=!1,va=!1,$s=!1,_l=!1,mc=!1,su=!1,yu=!0,sr=!1,Lo="user-content-",kc=!0,Cn=!1,xa={},Os=null,rl=Qu({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),js=null,Fh=Qu({},["audio","video","img","source","image","track"]),Cm=null,TS=Qu({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jt="http://www.w3.org/1998/Math/MathML",Fi="http://www.w3.org/2000/svg",lo="http://www.w3.org/1999/xhtml",rs=lo,Pa=!1,Df=null,_o=Qu({},[jt,Fi,lo],Kci),mn=Qu({},["mi","mo","mn","ms","mtext"]),Wt=Qu({},["annotation-xml"]),Ye=Qu({},["title","style","font","a","script"]),we=null,Qe=["application/xhtml+xml","text/html"],Pt="text/html",qt=null,Oo=null,ho=e.createElement("form"),zr=function(Si){return Si instanceof RegExp||Si instanceof Function},Fs=function(){let Si=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Oo&&Oo===Si)){if((!Si||typeof Si!="object")&&(Si={}),Si=a4(Si),we=Qe.indexOf(Si.PARSER_MEDIA_TYPE)===-1?Pt:Si.PARSER_MEDIA_TYPE,qt=we==="application/xhtml+xml"?Kci:ikt,Te=GB(Si,"ALLOWED_TAGS")?Qu({},Si.ALLOWED_TAGS,qt):It,tt=GB(Si,"ALLOWED_ATTR")?Qu({},Si.ALLOWED_ATTR,qt):Oi,Df=GB(Si,"ALLOWED_NAMESPACES")?Qu({},Si.ALLOWED_NAMESPACES,Kci):_o,Cm=GB(Si,"ADD_URI_SAFE_ATTR")?Qu(a4(TS),Si.ADD_URI_SAFE_ATTR,qt):TS,js=GB(Si,"ADD_DATA_URI_TAGS")?Qu(a4(Fh),Si.ADD_DATA_URI_TAGS,qt):Fh,Os=GB(Si,"FORBID_CONTENTS")?Qu({},Si.FORBID_CONTENTS,qt):rl,mo=GB(Si,"FORBID_TAGS")?Qu({},Si.FORBID_TAGS,qt):a4({}),dn=GB(Si,"FORBID_ATTR")?Qu({},Si.FORBID_ATTR,qt):a4({}),xa=GB(Si,"USE_PROFILES")?Si.USE_PROFILES:!1,No=Si.ALLOW_ARIA_ATTR!==!1,_i=Si.ALLOW_DATA_ATTR!==!1,ln=Si.ALLOW_UNKNOWN_PROTOCOLS||!1,Tn=Si.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ko=Si.SAFE_FOR_TEMPLATES||!1,Bn=Si.SAFE_FOR_XML!==!1,Mr=Si.WHOLE_DOCUMENT||!1,_l=Si.RETURN_DOM||!1,mc=Si.RETURN_DOM_FRAGMENT||!1,su=Si.RETURN_TRUSTED_TYPE||!1,$s=Si.FORCE_BODY||!1,yu=Si.SANITIZE_DOM!==!1,sr=Si.SANITIZE_NAMED_PROPS||!1,kc=Si.KEEP_CONTENT!==!1,Cn=Si.IN_PLACE||!1,Ee=Si.ALLOWED_URI_REGEXP||vZi,rs=Si.NAMESPACE||lo,mn=Si.MATHML_TEXT_INTEGRATION_POINTS||mn,Wt=Si.HTML_INTEGRATION_POINTS||Wt,zt=Si.CUSTOM_ELEMENT_HANDLING||{},Si.CUSTOM_ELEMENT_HANDLING&&zr(Si.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(zt.tagNameCheck=Si.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Si.CUSTOM_ELEMENT_HANDLING&&zr(Si.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(zt.attributeNameCheck=Si.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Si.CUSTOM_ELEMENT_HANDLING&&typeof Si.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(zt.allowCustomizedBuiltInElements=Si.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ko&&(_i=!1),mc&&(_l=!0),xa&&(Te=Qu({},dZi),tt=[],xa.html===!0&&(Qu(Te,cZi),Qu(tt,uZi)),xa.svg===!0&&(Qu(Te,qci),Qu(tt,Qci),Qu(tt,tkt)),xa.svgFilters===!0&&(Qu(Te,$ci),Qu(tt,Qci),Qu(tt,tkt)),xa.mathMl===!0&&(Qu(Te,jci),Qu(tt,pZi),Qu(tt,tkt))),Si.ADD_TAGS&&(Te===It&&(Te=a4(Te)),Qu(Te,Si.ADD_TAGS,qt)),Si.ADD_ATTR&&(tt===Oi&&(tt=a4(tt)),Qu(tt,Si.ADD_ATTR,qt)),Si.ADD_URI_SAFE_ATTR&&Qu(Cm,Si.ADD_URI_SAFE_ATTR,qt),Si.FORBID_CONTENTS&&(Os===rl&&(Os=a4(Os)),Qu(Os,Si.FORBID_CONTENTS,qt)),kc&&(Te["#text"]=!0),Mr&&Qu(Te,["html","head","body"]),Te.table&&(Qu(Te,["tbody"]),delete mo.tbody),Si.TRUSTED_TYPES_POLICY){if(typeof Si.TRUSTED_TYPES_POLICY.createHTML!="function")throw iQe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Si.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw iQe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=Si.TRUSTED_TYPES_POLICY,E=x.createHTML("")}else x===void 0&&(x=Gjo(g,o)),x!==null&&typeof E=="string"&&(E=x.createHTML(""));RD&&RD(Si),Oo=Si}},as=Qu({},[...qci,...$ci,...Ajo]),Ha=Qu({},[...jci,...Njo]),Zr=function(Si){let or=w(Si);(!or||!or.tagName)&&(or={namespaceURI:rs,tagName:"template"});let ba=ikt(Si.tagName),Wv=ikt(or.tagName);return Df[Si.namespaceURI]?Si.namespaceURI===Fi?or.namespaceURI===lo?ba==="svg":or.namespaceURI===jt?ba==="svg"&&(Wv==="annotation-xml"||mn[Wv]):!!as[ba]:Si.namespaceURI===jt?or.namespaceURI===lo?ba==="math":or.namespaceURI===Fi?ba==="math"&&Wt[Wv]:!!Ha[ba]:Si.namespaceURI===lo?or.namespaceURI===Fi&&!Wt[Wv]||or.namespaceURI===jt&&!mn[Wv]?!1:!Ha[ba]&&(Ye[ba]||!as[ba]):!!(we==="application/xhtml+xml"&&Df[Si.namespaceURI]):!1},Sl=function(Si){eQe(i.removed,{element:Si});try{w(Si).removeChild(Si)}catch{b(Si)}},au=function(Si,or){try{eQe(i.removed,{attribute:or.getAttributeNode(Si),from:or})}catch{eQe(i.removed,{attribute:null,from:or})}if(or.removeAttribute(Si),Si==="is")if(_l||mc)try{Sl(or)}catch{}else try{or.setAttribute(Si,"")}catch{}},Lw=function(Si){let or=null,ba=null;if($s)Si="<remove></remove>"+Si;else{let Iy=Gci(Si,/^[\r\n\t ]+/);ba=Iy&&Iy[0]}we==="application/xhtml+xml"&&rs===lo&&(Si='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Si+"</body></html>");let Wv=x?x.createHTML(Si):Si;if(rs===lo)try{or=new h().parseFromString(Wv,we)}catch{}if(!or||!or.documentElement){or=M.createDocument(rs,"template",null);try{or.documentElement.innerHTML=Pa?E:Wv}catch{}}let oT=or.body||or.documentElement;return Si&&ba&&oT.insertBefore(e.createTextNode(ba),oT.childNodes[0]||null),rs===lo?H.call(or,Mr?"html":"body")[0]:Mr?or.documentElement:oT},Y7=function(Si){return N.call(Si.ownerDocument||Si,Si,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},lz=function(Si){return Si instanceof p&&(typeof Si.nodeName!="string"||typeof Si.textContent!="string"||typeof Si.removeChild!="function"||!(Si.attributes instanceof u)||typeof Si.removeAttribute!="function"||typeof Si.setAttribute!="function"||typeof Si.namespaceURI!="string"||typeof Si.insertBefore!="function"||typeof Si.hasChildNodes!="function")},$n=function(Si){return typeof s=="function"&&Si instanceof s};function Lj(Ya,Si,or){ekt(Ya,ba=>{ba.call(i,Si,or,Oo)})}let D4i=function(Si){let or=null;if(Lj(j.beforeSanitizeElements,Si,null),lz(Si))return Sl(Si),!0;let ba=qt(Si.nodeName);if(Lj(j.uponSanitizeElement,Si,{tagName:ba,allowedTags:Te}),Bn&&Si.hasChildNodes()&&!$n(Si.firstElementChild)&&DD(/<[/\w!]/g,Si.innerHTML)&&DD(/<[/\w!]/g,Si.textContent)||Si.nodeType===nQe.progressingInstruction||Bn&&Si.nodeType===nQe.comment&&DD(/<[/\w]/g,Si.data))return Sl(Si),!0;if(!Te[ba]||mo[ba]){if(!mo[ba]&&Mye(ba)&&(zt.tagNameCheck instanceof RegExp&&DD(zt.tagNameCheck,ba)||zt.tagNameCheck instanceof Function&&zt.tagNameCheck(ba)))return!1;if(kc&&!Os[ba]){let Wv=w(Si)||Si.parentNode,oT=y(Si)||Si.childNodes;if(oT&&Wv){let Iy=oT.length;for(let vL=Iy-1;vL>=0;--vL){let Mj=v(oT[vL],!0);Mj.__removalCount=(Si.__removalCount||0)+1,Wv.insertBefore(Mj,S(Si))}}}return Sl(Si),!0}return Si instanceof l&&!Zr(Si)||(ba==="noscript"||ba==="noembed"||ba==="noframes")&&DD(/<\/no(script|embed|frames)/i,Si.innerHTML)?(Sl(Si),!0):(Ko&&Si.nodeType===nQe.text&&(or=Si.textContent,ekt([J,se,ae],Wv=>{or=tQe(or,Wv," ")}),Si.textContent!==or&&(eQe(i.removed,{element:Si.cloneNode()}),Si.textContent=or)),Lj(j.afterSanitizeElements,Si,null),!1)},R4i=function(Si,or,ba){if(yu&&(or==="id"||or==="name")&&(ba in e||ba in ho))return!1;if(!(_i&&!dn[or]&&DD(ce,or))){if(!(No&&DD(Se,or))){if(!tt[or]||dn[or]){if(!(Mye(Si)&&(zt.tagNameCheck instanceof RegExp&&DD(zt.tagNameCheck,Si)||zt.tagNameCheck instanceof Function&&zt.tagNameCheck(Si))&&(zt.attributeNameCheck instanceof RegExp&&DD(zt.attributeNameCheck,or)||zt.attributeNameCheck instanceof Function&&zt.attributeNameCheck(or,Si))||or==="is"&&zt.allowCustomizedBuiltInElements&&(zt.tagNameCheck instanceof RegExp&&DD(zt.tagNameCheck,ba)||zt.tagNameCheck instanceof Function&&zt.tagNameCheck(ba))))return!1}else if(!Cm[or]){if(!DD(Ee,tQe(ba,xe,""))){if(!((or==="src"||or==="xlink:href"||or==="href")&&Si!=="script"&&Rjo(ba,"data:")===0&&js[Si])){if(!(ln&&!DD(Re,tQe(ba,xe,"")))){if(ba)return!1}}}}}}return!0},Mye=function(Si){return Si!=="annotation-xml"&&Gci(Si,He)},L4i=function(Si){Lj(j.beforeSanitizeAttributes,Si,null);let{attributes:or}=Si;if(!or||lz(Si))return;let ba={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:tt,forceKeepAttr:void 0},Wv=or.length;for(;Wv--;){let oT=or[Wv],{name:Iy,namespaceURI:vL,value:Mj}=oT,Pye=qt(Iy),eii=Mj,kk=Iy==="value"?eii:Ljo(eii);if(ba.attrName=Pye,ba.attrValue=kk,ba.keepAttr=!0,ba.forceKeepAttr=void 0,Lj(j.uponSanitizeAttribute,Si,ba),kk=ba.attrValue,sr&&(Pye==="id"||Pye==="name")&&(au(Iy,Si),kk=Lo+kk),Bn&&DD(/((--!?|])>)|<\/(style|title|textarea)/i,kk)){au(Iy,Si);continue}if(Pye==="attributename"&&Gci(kk,"href")){au(Iy,Si);continue}if(ba.forceKeepAttr)continue;if(!ba.keepAttr){au(Iy,Si);continue}if(!Tn&&DD(/\/>/i,kk)){au(Iy,Si);continue}Ko&&ekt([J,se,ae],P4i=>{kk=tQe(kk,P4i," ")});let M4i=qt(Si.nodeName);if(!R4i(M4i,Pye,kk)){au(Iy,Si);continue}if(x&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!vL)switch(g.getAttributeType(M4i,Pye)){case"TrustedHTML":{kk=x.createHTML(kk);break}case"TrustedScriptURL":{kk=x.createScriptURL(kk);break}}if(kk!==eii)try{vL?Si.setAttributeNS(vL,Iy,kk):Si.setAttribute(Iy,kk),lz(Si)?Sl(Si):lZi(i.removed)}catch{au(Iy,Si)}}Lj(j.afterSanitizeAttributes,Si,null)},y1o=function Ya(Si){let or=null,ba=Y7(Si);for(Lj(j.beforeSanitizeShadowDOM,Si,null);or=ba.nextNode();)Lj(j.uponSanitizeShadowNode,or,null),D4i(or),L4i(or),or.content instanceof n&&Ya(or.content);Lj(j.afterSanitizeShadowDOM,Si,null)};return i.sanitize=function(Ya){let Si=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},or=null,ba=null,Wv=null,oT=null;if(Pa=!Ya,Pa&&(Ya="<!-->"),typeof Ya!="string"&&!$n(Ya))if(typeof Ya.toString=="function"){if(Ya=Ya.toString(),typeof Ya!="string")throw iQe("dirty is not a string, aborting")}else throw iQe("toString is not a function");if(!i.isSupported)return Ya;if(va||Fs(Si),i.removed=[],typeof Ya=="string"&&(Cn=!1),Cn){if(Ya.nodeName){let Mj=qt(Ya.nodeName);if(!Te[Mj]||mo[Mj])throw iQe("root node is forbidden and cannot be sanitized in-place")}}else if(Ya instanceof s)or=Lw("<!---->"),ba=or.ownerDocument.importNode(Ya,!0),ba.nodeType===nQe.element&&ba.nodeName==="BODY"||ba.nodeName==="HTML"?or=ba:or.appendChild(ba);else{if(!_l&&!Ko&&!Mr&&Ya.indexOf("<")===-1)return x&&su?x.createHTML(Ya):Ya;if(or=Lw(Ya),!or)return _l?null:su?E:""}or&&$s&&Sl(or.firstChild);let Iy=Y7(Cn?Ya:or);for(;Wv=Iy.nextNode();)D4i(Wv),L4i(Wv),Wv.content instanceof n&&y1o(Wv.content);if(Cn)return Ya;if(_l){if(mc)for(oT=V.call(or.ownerDocument);or.firstChild;)oT.appendChild(or.firstChild);else oT=or;return(tt.shadowroot||tt.shadowrootmode)&&(oT=K.call(t,oT,!0)),oT}let vL=Mr?or.outerHTML:or.innerHTML;return Mr&&Te["!doctype"]&&or.ownerDocument&&or.ownerDocument.doctype&&or.ownerDocument.doctype.name&&DD(bZi,or.ownerDocument.doctype.name)&&(vL="<!DOCTYPE "+or.ownerDocument.doctype.name+`>
`+vL),Ko&&ekt([J,se,ae],Mj=>{vL=tQe(vL,Mj," ")}),x&&su?x.createHTML(vL):vL},i.setConfig=function(){let Ya=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Fs(Ya),va=!0},i.clearConfig=function(){Oo=null,va=!1},i.isValidAttribute=function(Ya,Si,or){Oo||Fs({});let ba=qt(Ya),Wv=qt(Si);return R4i(ba,Wv,or)},i.addHook=function(Ya,Si){typeof Si=="function"&&eQe(j[Ya],Si)},i.removeHook=function(Ya,Si){if(Si!==void 0){let or=_jo(j[Ya],Si);return or===-1?void 0:Djo(j[Ya],or,1)[0]}return lZi(j[Ya])},i.removeHooks=function(Ya){j[Ya]=[]},i.removeAllHooks=function(){j=hZi()},i}var Tde=SZi();var Zci=Object.freeze(["a","abbr","b","bdo","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","label","li","mark","ol","p","pre","q","rp","rt","ruby","s","samp","small","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","tt","u","ul","var","video","wbr"]),yZi=Object.freeze(["href","target","src","alt","title","for","name","role","tabindex","x-dispatch","required","checked","placeholder","type","start","width","height","align"]),Jci="vscode-relative-path";function IZi(a,i){if(i.override==="*")return!0;try{let e=new URL(a,Jci+"://");return!!(i.override.includes(e.protocol.replace(/:$/,""))||i.allowRelativePaths&&e.protocol===Jci+":"&&!a.trim().toLowerCase().startsWith(Jci))}catch{return!1}}function qjo(a,i){Tde.addHook("afterSanitizeAttributes",e=>{for(let t of["href","src"])if(e.hasAttribute(t)){let o=e.getAttribute(t);t==="href"?!o.startsWith("#")&&!IZi(o,a)&&e.removeAttribute(t):IZi(o,i)||e.removeAttribute(t)}})}var $jo=Object.freeze({ALLOWED_TAGS:[...Zci],ALLOWED_ATTR:[...yZi],ALLOW_UNKNOWN_PROTOCOLS:!0});function okt(a,i){return wZi(a,i,"trusted")}function wZi(a,i,e){try{let t={...$jo};i?.allowedTags&&(i.allowedTags.override&&(t.ALLOWED_TAGS=[...i.allowedTags.override]),i.allowedTags.augment&&(t.ALLOWED_TAGS=[...t.ALLOWED_TAGS??[],...i.allowedTags.augment]));let o=[...yZi];i?.allowedAttributes&&(i.allowedAttributes.override&&(o=[...i.allowedAttributes.override]),i.allowedAttributes.augment&&(o=[...o,...i.allowedAttributes.augment])),o=o.map(s=>typeof s=="string"?s.toLowerCase():{attributeName:s.attributeName.toLowerCase(),shouldKeep:s.shouldKeep});let n=new Set(o.map(s=>typeof s=="string"?s:s.attributeName)),r=new Map;for(let s of o)typeof s=="string"?r.delete(s):r.set(s.attributeName,s);return t.ALLOWED_ATTR=Array.from(n),qjo({override:i?.allowedLinkProtocols?.override??[Q.http,Q.https],allowRelativePaths:i?.allowRelativeLinkPaths??!1},{override:i?.allowedMediaProtocols?.override??[Q.http,Q.https],allowRelativePaths:i?.allowRelativeMediaPaths??!1}),i?.replaceWithPlaintext&&Tde.addHook("uponSanitizeElement",Qjo),r.size&&Tde.addHook("uponSanitizeAttribute",(s,l)=>{let c=r.get(l.attrName);if(c){let u=c.shouldKeep(s,l);typeof u=="string"?(l.keepAttr=!0,l.attrValue=u):l.keepAttr=u}else l.keepAttr=n.has(l.attrName)}),e==="dom"?Tde.sanitize(a,{...t,RETURN_DOM_FRAGMENT:!0}):Tde.sanitize(a,{...t,RETURN_TRUSTED_TYPE:!0})}finally{Tde.removeAllHooks()}}var jjo=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],Qjo=(a,i,e)=>{if(!i.allowedTags[i.tagName]&&i.tagName!=="body"){let t=edi(a);t&&(a.nodeType===Node.COMMENT_NODE?a.parentElement?.insertBefore(t,a):a.parentElement?.replaceChild(t,a))}};function edi(a){if(!a.ownerDocument)return;let i,e;if(a.nodeType===Node.COMMENT_NODE)i=`<!--${a.textContent}-->`;else if(a instanceof Element){let r=a.tagName.toLowerCase(),s=jjo.includes(r),l=a.attributes.length?" "+Array.from(a.attributes).map(c=>`${c.name}="${c.value}"`).join(" "):"";i=`<${r}${l}>`,s||(e=`</${r}>`)}else return;let t=document.createDocumentFragment(),o=a.ownerDocument.createTextNode(i);for(t.appendChild(o);a.firstChild;)t.appendChild(a.firstChild);let n=e?a.ownerDocument.createTextNode(e):void 0;return n&&t.appendChild(n),t}function AA(a,i,e){let t=wZi(i,e,"dom");Ii(a,t)}var Yjo=new RegExp(`(\\\\)?\\$\\((${q.iconNameExpression}(?:${q.iconModifierExpression})?)\\)`,"g");function ir(a){let i=new Array,e,t=0,o=0;for(;(e=Yjo.exec(a))!==null;){o=e.index||0,t<o&&i.push(a.substring(t,o)),t=(e.index||0)+e[0].length;let[,n,r]=e;i.push(n?`$(${r})`:un({id:r}))}return t<a.length&&i.push(a.substring(t)),i}function un(a){let i=_("span");return i.classList.add(...q.asClassNameArray(a)),i}function Xjo(a){try{let i=A.parse(a);if(i.scheme===Q.file){let e=i.fsPath,t=i.fragment;return Ike(t?`${e}#${t}`:e)}}catch{}return""}var idi=Object.freeze({image:({href:a,title:i,text:e})=>{let t=[],o=[];return a&&({href:a,dimensions:t}=Qxt(a),o.push(`src="${Ike(a)}"`)),e&&o.push(`alt="${Ike(e)}"`),i&&o.push(`title="${Ike(i)}"`),t.length&&(o=o.concat(t)),"<img "+o.join(" ")+">"},paragraph({tokens:a}){return`<p>${this.parser.parseInline(a)}</p>`},link({href:a,title:i,tokens:e}){let t=this.parser.parseInline(e);return typeof a!="string"?"":(a===t&&(t=jxt(t)),i=typeof i=="string"?Ike(jxt(i)):"",a=jxt(a),!i&&a.startsWith(`${Q.file}:`)&&(i=Xjo(a)),a=a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),`<a href="${a}" title="${i||a}" draggable="false">${t}</a>`)}});function Jjo(a){return function(i){let{tokens:e}=i,t=e[0];if(t?.type!=="paragraph")return a.call(this,i);let o=t.tokens;if(!o||o.length===0)return a.call(this,i);let n=o[0];if(n?.type!=="text")return a.call(this,i);let r=/^\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*?\n*/i,s=n.raw.match(r);if(!s)return a.call(this,i);n.raw=n.raw.replace(r,""),n.text=n.text.replace(r,"");let l={note:"info",tip:"light-bulb",important:"comment",warning:"alert",caution:"stop"},c=s[1],u=c.charAt(0).toUpperCase()+c.slice(1).toLowerCase(),p=c.toLowerCase(),h=un({id:l[p]}).outerHTML,g=this.parser.parse(e);return`<blockquote data-severity="${p}"><p><span>${h}${u}</span>${g.substring(3)}</blockquote>
`}}function Lg(a,i={},e){let t=new O,o=!1,n=new s4(...i.markedExtensions??[]),{renderer:r,codeBlocks:s,syncCodeBlocks:l}=e5o(n,i,a),c=t5o(a),u;if(i.fillInIncompleteTokens){let f={...n.defaults,...i.markedOptions,renderer:r},v=n.lexer(c,f),b=m5o(v);u=n.parser(b,f)}else u=n.parse(c,{...i?.markedOptions,renderer:r,async:!1});a.supportThemeIcons&&(u=ir(u).map(v=>typeof v=="string"?v:v.outerHTML).join(""));let p=document.createElement("div"),h=EZi(a,i.sanitizerConfig??{});AA(p,u,h),Zjo(a,i,p);let g;if(e?(g=e,Ii(e,...p.childNodes)):g=p,s.length>0)Promise.all(s).then(f=>{if(o)return;let v=new Map(f),b=g.querySelectorAll("div[data-code]");for(let S of b){let y=v.get(S.dataset.code??"");y&&Ii(S,y)}i.asyncRenderCallback?.()});else if(l.length>0){let f=new Map(l),v=g.querySelectorAll("div[data-code]");for(let b of v){let S=f.get(b.dataset.code??"");S&&Ii(b,S)}}if(i.asyncRenderCallback)for(let f of g.getElementsByTagName("img")){let v=t.add($(f,"load",()=>{v.dispose(),i.asyncRenderCallback()}))}if(i.actionHandler){let f=v=>{let b=new Ln(Me(g),v);!b.leftButton&&!b.middleButton||CZi(a,i,b)};t.add($(g,"click",f)),t.add($(g,"auxclick",f)),t.add($(g,"keydown",v=>{let b=new mi(v);!b.equals(10)&&!b.equals(3)||CZi(a,i,b)}))}for(let f of[...g.getElementsByTagName("input")])if(f.attributes.getNamedItem("type")?.value==="checkbox")f.setAttribute("disabled","");else if(i.sanitizerConfig?.replaceWithPlaintext){let v=edi(f);v?f.parentElement?.replaceChild(v,f):f.remove()}else f.remove();return{element:g,dispose:()=>{o=!0,t.dispose()}}}function Zjo(a,i,e){for(let t of e.querySelectorAll("img, audio, video, source")){let o=t.getAttribute("src");if(o){let n=o;try{a.baseUri&&(n=odi(A.from(a.baseUri),n))}catch{}if(t.setAttribute("src",xZi(a,n,!0)),i.sanitizerConfig?.remoteImageIsAllowed){let r=A.parse(n);r.scheme!==Q.file&&r.scheme!==Q.data&&!i.sanitizerConfig.remoteImageIsAllowed(r)&&t.replaceWith(_("",void 0,t.outerHTML))}}}for(let t of e.querySelectorAll("a")){let o=t.getAttribute("href");if(t.setAttribute("href",""),!o||/^data:|javascript:/i.test(o)||/^command:/i.test(o)&&!a.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(o))t.replaceWith(...t.childNodes);else{let n=xZi(a,o,!1);a.baseUri&&(n=odi(A.from(a.baseUri),o)),t.dataset.href=n}}}function e5o(a,i,e){let t=new a.Renderer(i.markedOptions);t.image=idi.image,t.link=idi.link,t.paragraph=idi.paragraph,e.supportAlertSyntax&&(t.blockquote=Jjo(t.blockquote));let o=[],n=[];return i.codeBlockRendererSync?t.code=({text:r,lang:s,raw:l})=>{let c=o4.nextId(),u=i.codeBlockRendererSync(kZi(s),r,l);return n.push([c,u]),`<div class="code" data-code="${c}">${Cr(r)}</div>`}:i.codeBlockRenderer&&(t.code=({text:r,lang:s})=>{let l=o4.nextId(),c=i.codeBlockRenderer(kZi(s),r);return o.push(c.then(u=>[l,u])),`<div class="code" data-code="${l}">${Cr(r)}</div>`}),e.supportHtml||(t.html=({text:r})=>i.sanitizerConfig?.replaceWithPlaintext?Cr(r):(e.isTrusted?r.match(/^(<span[^>]+>)|(<\/\s*span>)$/):void 0)?r:""),{renderer:t,codeBlocks:o,syncCodeBlocks:n}}function t5o(a){let i=a.value;return i.length>1e5&&(i=`${i.substr(0,1e5)}\u2026`),a.supportThemeIcons&&(i=zJi(i)),i}function CZi(a,i,e){let t=e.target.closest("a[data-href]");if(go(t))try{let o=t.dataset.href;o&&(a.baseUri&&(o=odi(A.from(a.baseUri),o)),i.actionHandler?.(o,a))}catch(o){mt(o)}finally{e.preventDefault(),e.stopPropagation()}}function i5o(a,i){let e;try{e=Dm(decodeURIComponent(i))}catch{}return e?(e=Dk(e,t=>{if(a.uris&&a.uris[t])return A.revive(a.uris[t])}),encodeURIComponent(JSON.stringify(e))):i}function xZi(a,i,e){let t=a.uris&&a.uris[i],o=A.revive(t);return e?i.startsWith(Q.data+":")?i:(o||(o=A.parse(i)),In.uriToBrowserUri(o).toString(!0)):!o||A.parse(i).toString()===o.toString()?i:(o.query&&(o=o.with({query:i5o(a,o.query)})),o.toString())}function kZi(a){if(!a)return"";let i=a.split(/[\s+|:|,|\{|\?]/,1);return i.length?i[0]:a}function odi(a,i){return/^\w[\w\d+.-]*:/.test(i)?i:a.path.endsWith("/")?Mii(a,i).toString():Mii(ai(a),i).toString()}function o5o(a,i,e={}){let t=EZi(i,e);return okt(a,t)}var ndi=Object.freeze([...Zci,"input"]),sQe=Object.freeze(["align","autoplay","alt","colspan","controls","draggable","height","href","loop","muted","playsinline","poster","rowspan","src","target","title","type","width","start","checked","disabled","value","data-code","data-href","data-severity",{attributeName:"style",shouldKeep:(a,i)=>a.tagName==="SPAN"&&i.attrName==="style"?/^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(border-radius:[0-9]+px;)?$/.test(i.attrValue):!1},{attributeName:"class",shouldKeep:(a,i)=>a.tagName==="SPAN"&&i.attrName==="class"?/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(i.attrValue):!1}]);function EZi(a,i){let e=a.isTrusted??!1,t=[Q.http,Q.https,Q.mailto,Q.file,Q.vscodeFileResource,Q.vscodeRemote,Q.vscodeRemoteResource,Q.vscodeNotebookCell,Q.internal];return e&&t.push(Q.command),i.allowedLinkSchemes?.augment&&t.push(...i.allowedLinkSchemes.augment),{allowedTags:{override:i.allowedTags?.override??ndi},allowedAttributes:{override:i.allowedAttributes?.override??sQe},allowedLinkProtocols:{override:t},allowRelativeLinkPaths:!!a.baseUri,allowedMediaProtocols:{override:[Q.http,Q.https,Q.data,Q.file,Q.vscodeFileResource,Q.vscodeRemote,Q.vscodeRemoteResource]},allowRelativeMediaPaths:!!a.baseUri,replaceWithPlaintext:i.replaceWithPlaintext}}function ma(a,i){if(typeof a=="string")return a;let e=a.value??"";e.length>1e5&&(e=`${e.substr(0,1e5)}\u2026`);let t=r5o();i?.includeCodeBlocksFences&&(t.code=s5o),i?.useLinkFormatter&&(t.link=a5o);let o=sZi(e,{async:!1,renderer:t});return o5o(o,{isTrusted:!1},{}).toString().replace(/&(#\d+|[a-zA-Z]+);/g,n=>n5o.get(n)??n).trim()}var n5o=new Map([["&quot;",'"'],["&nbsp;"," "],["&amp;","&"],["&#39;","'"],["&lt;","<"],["&gt;",">"]]);function r5o(){let a=new KX;return a.code=({text:i})=>Cr(i),a.blockquote=({text:i})=>i+`
`,a.html=i=>"",a.heading=function({tokens:i}){return this.parser.parseInline(i)+`
`},a.hr=()=>"",a.list=function({items:i}){return i.map(e=>this.listitem(e)).join(`
`)+`
`},a.listitem=({text:i})=>i+`
`,a.paragraph=function({tokens:i}){return this.parser.parseInline(i)+`
`},a.table=function({header:i,rows:e}){return i.map(t=>this.tablecell(t)).join(" ")+`
`+e.map(t=>t.map(o=>this.tablecell(o)).join(" ")).join(`
`)+`
`},a.tablerow=({text:i})=>i,a.tablecell=function({tokens:i}){return this.parser.parseInline(i)},a.strong=({text:i})=>i,a.em=({text:i})=>i,a.codespan=({text:i})=>Cr(i),a.br=i=>`
`,a.del=({text:i})=>i,a.image=i=>"",a.text=({text:i})=>i,a.link=({text:i})=>i,a}var s5o=({text:a})=>`
\`\`\`
${Cr(a)}
\`\`\`
`,a5o=({text:a,href:i})=>{try{if(i){let e=A.parse(i);return a.trim()||Be(e)}}catch{return a.trim()||Jo(i)}return a};function rQe(a){let i="";return a.forEach(e=>{i+=e.raw}),i}function TZi(a){if(a.tokens)for(let i=a.tokens.length-1;i>=0;i--){let e=a.tokens[i];if(e.type==="text"){let t=e.raw.split(`
`),o=t[t.length-1];if(o.includes("`"))return g5o(a);if(o.includes("**"))return y5o(a);if(o.match(/\*\w/))return f5o(a);if(o.match(/(^|\s)__\w/))return w5o(a);if(o.match(/(^|\s)_\w/))return v5o(a);if(l5o(o)||c5o(o)&&a.tokens.slice(0,i).some(n=>n.type==="text"&&n.raw.match(/\[[^\]]*$/))){let n=a.tokens.slice(i+1);return n[0]?.type==="link"&&n[1]?.type==="text"&&n[1].raw.match(/^ *"[^"]*$/)||o.match(/^[^"]* +"[^"]*$/)?S5o(a):b5o(a)}else if(o.match(/(^|\s)\[\w*[^\]]*$/))return I5o(a)}}}function l5o(a){return!!a.match(/(^|\s)\[.*\]\(\w*/)}function c5o(a){return!!a.match(/^[^\[]*\]\([^\)]*$/)}function d5o(a){let i=a.items[a.items.length-1],e=i.tokens?i.tokens[i.tokens.length-1]:void 0,t=c=>{let p=c.items.at(-1)?.tokens.at(-1);return p?.type==="heading"||p?.type==="list"&&t(p)},o;if(e?.type==="text"&&!("inRawBlock"in i))o=TZi(e);else if(t(a)){let c=Cke(a.raw.trim()+" &nbsp;")[0];return c.type!=="list"?void 0:c}if(!o||o.type!=="paragraph")return;let n=rQe(a.items.slice(0,-1)),r=i.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];if(!r)return;let s=r+rQe(i.tokens.slice(0,-1))+o.raw,l=Cke(n+s)[0];if(l.type==="list")return l}function u5o(a,i){if(a.raw.match(/-\s*$/))return Cke(i+" &nbsp;")}var p5o=3;function m5o(a){for(let i=0;i<p5o;i++){let e=h5o(a);if(e)a=e;else break}return a}function h5o(a){let i,e;for(i=0;i<a.length;i++){let o=a[i];if(o.type==="paragraph"&&o.raw.match(/(\n|^)\|/)){e=C5o(a.slice(i));break}}let t=a.at(-1);if(!e&&t?.type==="list"){let o=d5o(t);o&&(e=[o],i=a.length-1)}if(!e&&t?.type==="paragraph"){let o=TZi(t);o&&(e=[o],i=a.length-1)}if(e){let o=[...a.slice(0,i),...e];return o.links=a.links,o}if(t?.type==="heading"){let o=u5o(t,rQe(a));if(o)return o}return null}function g5o(a){return GX(a,"`")}function f5o(a){return GX(a,"*")}function v5o(a){return GX(a,"_")}function b5o(a){return GX(a,")",!1)}function S5o(a){return GX(a,'")',!1)}function I5o(a){return GX(a,"](https://microsoft.com)",!1)}function y5o(a){return GX(a,"**")}function w5o(a){return GX(a,"__")}function GX(a,i,e=!0){let t=rQe(Array.isArray(a)?a:[a]),o=e?t.trimEnd():t;return Cke(o+i)[0]}function C5o(a){let i=rQe(a),e=i.split(`
`),t,o=!1;for(let n=0;n<e.length;n++){let r=e[n].trim();if(typeof t>"u"&&r.match(/^\s*\|/)){let s=r.match(/(\|[^\|]+)(?=\||$)/g);s&&(t=s.length)}else if(typeof t=="number")if(r.match(/^\s*\|/)){if(n!==e.length-1)return;o=!0}else return}if(typeof t=="number"&&t>0){let n=o?e.slice(0,-1).join(`
`):i,r=!!n.match(/\|\s*$/),s=n+(r?"":"|")+`
|${" --- |".repeat(t)}`;return Cke(s)}}function _de(a,i,e){let t=e.mode===1?e.offset:e.offset+e.size,o=e.mode===1?e.offset+e.size:e.offset;return e.position===0?i<=a-t?{position:t,result:"ok"}:i<=o?{position:o-i,result:"flipped"}:{position:Math.max(a-i,0),result:"overlap"}:i<=o?{position:o-i,result:"ok"}:i<=a-t&&o<i/2?{position:t,result:"flipped"}:{position:0,result:"overlap"}}function nkt(a,i,e,t){let o=t?.anchorAlignment??0,n=t?.anchorPosition??0,r=t?.anchorAxisAlignment??0,s,l;if(r===0){let p={offset:e.top-a.top,size:e.height,position:n===0?0:1},h={offset:e.left,size:e.width,position:o===0?0:1,mode:1},g=_de(a.height,i.height,p);s=g.position+a.top,g.result==="flipped"&&(n=n===0?1:0),OS.intersects({start:s,end:s+i.height},{start:p.offset,end:p.offset+p.size})&&(h.mode=0);let f=_de(a.width,i.width,h);l=f.position,f.result==="flipped"&&(o=o===0?1:0)}else{let p={offset:e.left,size:e.width,position:o===0?0:1},h={offset:e.top,size:e.height,position:n===0?0:1,mode:1},g=_de(a.width,i.width,p);l=g.position,g.result==="flipped"&&(o=o===0?1:0),OS.intersects({start:l,end:l+i.width},{start:p.offset,end:p.offset+p.size})&&(h.mode=0);let f=_de(a.height,i.height,h);s=f.position+a.top,f.result==="flipped"&&(n=n===0?1:0)}let c=a.width-(l+i.width),u=a.height-(s+i.height);return{top:s,left:l,bottom:u,right:c,anchorAlignment:o,anchorPosition:n}}function rdi(a){let i=a;return!!i&&typeof i.x=="number"&&typeof i.y=="number"}function lQe(a){if(go(a)){let i=ur(a),e=CY(a);return{top:i.top*e,left:i.left*e,width:i.width*e,height:i.height*e}}else return rdi(a)?{top:a.y,left:a.x,width:a.width||1,height:a.height||2}:{top:a.posy,left:a.posx,width:2,height:2}}var kke=class a extends k{constructor(e,t){super();this.container=null;this.useFixedPosition=!1;this.useShadowDOM=!1;this.delegate=null;this.toDisposeOnClean=k.None;this.toDisposeOnSetContainer=k.None;this.shadowRoot=null;this.shadowRootHostElement=null;this.view=_(".context-view"),Wi(this.view),this.setContainer(e,t),this._register(ee(()=>this.setContainer(null,1)))}static{this.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"]}static{this.BUBBLE_DOWN_EVENTS=["click"]}setContainer(e,t){this.useFixedPosition=t!==1;let o=this.useShadowDOM;if(this.useShadowDOM=t===3,!(e===this.container&&o===this.useShadowDOM)&&(this.container&&(this.toDisposeOnSetContainer.dispose(),this.view.remove(),this.shadowRoot&&(this.shadowRoot=null,this.shadowRootHostElement?.remove(),this.shadowRootHostElement=null),this.container=null),e)){if(this.container=e,this.useShadowDOM){this.shadowRootHostElement=_(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});let r=document.createElement("style");r.textContent=x5o,this.shadowRoot.appendChild(r),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(_("slot"))}else this.container.appendChild(this.view);let n=new O;a.BUBBLE_UP_EVENTS.forEach(r=>{n.add(Yo(this.container,r,s=>{this.onDOMEvent(s,!1)}))}),a.BUBBLE_DOWN_EVENTS.forEach(r=>{n.add(Yo(this.container,r,s=>{this.onDOMEvent(s,!0)},!0))}),this.toDisposeOnSetContainer=n}}show(e){this.isVisible()&&this.hide(),St(this.view),this.view.className="context-view monaco-component",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex=`${2575+(e.layer??0)}`,this.view.style.position=this.useFixedPosition?"fixed":"absolute",Xo(this.view),this.toDisposeOnClean=e.render(this.view)||k.None,this.delegate=e,this.doLayout(),this.delegate.focus?.()}getViewElement(){return this.view}layout(){if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(Tc&&of.pointerEvents)){this.hide();return}this.delegate?.layout?.(),this.doLayout()}}doLayout(){if(!this.isVisible())return;let e=lQe(this.delegate.getAnchor()),t=this.container?Me(this.container):zi(),o={top:t.pageYOffset,left:t.pageXOffset,width:t.innerWidth,height:t.innerHeight},n={width:Dc(this.view),height:Uh(this.view)},r=this.delegate.anchorPosition,s=this.delegate.anchorAlignment,l=this.delegate.anchorAxisAlignment,{top:c,left:u}=nkt(o,n,e,{anchorAlignment:s,anchorPosition:r,anchorAxisAlignment:l});this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(r===0?"bottom":"top"),this.view.classList.add(s===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);let p=ur(this.container),h=this.container.scrollTop||0,g=this.container.scrollLeft||0;this.view.style.top=`${c-(this.useFixedPosition?ur(this.view).top:p.top)+h}px`,this.view.style.left=`${u-(this.useFixedPosition?ur(this.view).left:p.left)+g}px`,this.view.style.width="initial"}hide(e){let t=this.delegate;this.delegate=null,t?.onHide&&t.onHide(e),this.toDisposeOnClean.dispose(),Wi(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,Me(e).document.activeElement):t&&!ms(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}},x5o=`
	:host {
		all: initial; /* 1st rule so subsequent properties are reset. */
	}

	.codicon[class*='codicon-'] {
		font: normal normal normal 16px/1 codicon;
		display: inline-block;
		text-decoration: none;
		text-rendering: auto;
		text-align: center;
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
		user-select: none;
		-webkit-user-select: none;
		-ms-user-select: none;
	}

	:host {
		font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;
	}

	:host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
	:host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; }
	:host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }
	:host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; }
	:host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Nanum Gothic", "AppleGothic", sans-serif; }

	:host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; }
	:host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }
	:host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }
	:host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }
	:host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }

	:host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; }
	:host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }
	:host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; }
	:host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }
	:host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
`;var DZi={showInstantHover:()=>{},showDelayedHover:()=>{},setupDelayedHover:()=>k.None,setupDelayedHoverAtMouse:()=>k.None,hideHover:()=>{},showAndFocusLastHover:()=>{},setupManagedHover:()=>({dispose:()=>{},show:()=>{},hide:()=>{},update:()=>{}}),showManagedHover:()=>{}};function RZi(a){DZi=a}function sp(){return DZi}var Dde=_,LZi="selectOption.entry.template",sdi=class{get templateId(){return LZi}renderTemplate(i){let e=Object.create(null);return e.root=i,e.text=D(i,Dde(".option-text")),e.detail=D(i,Dde(".option-detail")),e.decoratorRight=D(i,Dde(".option-decorator-right")),e}renderElement(i,e,t){let o=t,n=i.text,r=i.detail,s=i.decoratorRight,l=i.isDisabled;o.text.textContent=n,o.detail.textContent=r||"",o.decoratorRight.textContent=s||"",l?o.root.classList.add("option-disabled"):o.root.classList.remove("option-disabled"),i.isSeparator?(o.root.classList.add("option-separator"),o.root.classList.add("option-disabled")):o.root.classList.remove("option-separator")}disposeTemplate(i){}},rkt=class a extends k{constructor(e,t,o,n,r){super();this.options=[];this._currentSelection=0;this._hasDetails=!1;this._selectionDetailsDisposables=this._register(new O);this._skipLayout=!1;this._sticky=!1;this._isVisible=!1,this.styles=n,this.selectBoxOptions=r||Object.create(null),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=a.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new T,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(o),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}static{this.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN=32}static{this.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN=2}static{this.DEFAULT_MINIMUM_VISIBLE_OPTIONS=3}setTitle(e){!this._hover&&e?this._hover=this._register(sp().setupManagedHover(yi("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return LZi}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=_(".monaco-select-box-dropdown-container"),this.selectionDetailsPane=D(this.selectDropDownContainer,Dde(".select-box-details-pane"));let t=D(this.selectDropDownContainer,Dde(".select-box-dropdown-container-width-control")),o=D(t,Dde(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",D(o,this.widthControlElement),this._dropDownPosition=0,this.styleElement=Pr(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register($(this.selectDropDownContainer,ne.DRAG_START,n=>{Kt.stop(n,!0)}))}registerListeners(){this._register(Yo(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register($(this.selectElement,ne.CLICK,t=>{Kt.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register($(this.selectElement,ne.MOUSE_DOWN,t=>{Kt.stop(t)}));let e;this._register($(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register($(this.selectElement,"touchend",t=>{Kt.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register($(this.selectElement,ne.KEY_DOWN,t=>{let o=new mi(t),n=!1;et?(o.keyCode===18||o.keyCode===16||o.keyCode===10||o.keyCode===3)&&(n=!0):(o.keyCode===18&&o.altKey||o.keyCode===16&&o.altKey||o.keyCode===10||o.keyCode===3)&&(n=!0),n&&(this.showSelectDropDown(),Kt.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){eo(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((o,n)=>{this.selectElement.add(this.createOption(o.text,n,o.isDisabled)),typeof o.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setEnabled(e){this.selectElement.disabled=!e}setOptionsList(){this.selectList?.splice(0,this.selectList.length,this.options)}select(e){e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)}setAriaLabel(e){this.selectBoxOptions.ariaLabel=e,this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){let e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1px solid ${this.styles.listFocusOutline} !important; outline-offset: -1px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1px solid ${this.styles.listHoverOutline} !important; outline-offset: -1px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join(`
`)}styleSelectElement(){let e=this.styles.selectBackground??"",t=this.styles.selectForeground??"",o=this.styles.selectBorder??"";this.selectElement.style.backgroundColor=e,this.selectElement.style.color=t,this.selectElement.style.borderColor=o}styleList(){let e=this.styles.selectBackground??"",t=_D(this.styles.selectListBackground,e);this.selectDropDownContainer.style.backgroundColor=t,this.selectDropDownListContainer.style.backgroundColor=t,this.selectionDetailsPane.style.backgroundColor=t,this.selectList.style(this.styles)}createOption(e,t,o){let n=document.createElement("option");return n.value=e,n.text=e,n.disabled=!!o,n}showSelectDropDown(){this.selectionDetailsPane.textContent="",!(!this.contextViewProvider||this._isVisible)&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){!this.contextViewProvider||!this._isVisible||(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){e.appendChild(this.selectDropDownContainer);let o=Me(this.selectElement).getComputedStyle(this.selectElement).fontSize;return o&&(this.selectDropDownContainer.style.fontSize=o),this.layoutSelectDropDown(t),{dispose:()=>{this.selectDropDownContainer.remove()}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach((t,o)=>{this.updateDetail(o),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)}),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");let t=Me(this.selectElement),o=ur(this.selectElement),n=t.innerHeight-o.top-o.height-(this.selectBoxOptions.minBottomMargin||0),r=o.top-a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,s=this.selectElement.offsetWidth,l=this.setWidthControlElement(this.widthControlElement),c=`${Math.max(l,Math.round(s))}px`;this.selectDropDownContainer.style.width=c,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let u=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());let p=this._hasDetails?this._cachedMaxDetailsHeight:0,h=u+p,g=Math.floor((n-p)/this.getHeight()),f=Math.floor((r-p)/this.getHeight());if(e)return o.top+o.height>t.innerHeight-22||o.top<a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||g<1&&f<1?!1:(g<a.DEFAULT_MINIMUM_VISIBLE_OPTIONS&&f>g&&this.options.length>g?(this._dropDownPosition=1,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(o.top+o.height>t.innerHeight-22||o.top<a.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||this._dropDownPosition===0&&g<1||this._dropDownPosition===1&&f<1)return this.hideSelectDropDown(!0),!1;if(this._dropDownPosition===0){if(this._isVisible&&g+f<1)return this.hideSelectDropDown(!0),!1;h>n&&(u=g*this.getHeight())}else h>r&&(u=f*this.getHeight());return this.selectList.layout(u),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=`${u}px`,this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=`${u}px`,this.updateDetail(this.selected),this.selectDropDownContainer.style.width=c,this.selectDropDownListContainer.setAttribute("tabindex","0"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let o=0,n=0;this.options.forEach((r,s)=>{let l=r.detail?r.detail.length:0,c=r.decoratorRight?r.decoratorRight.length:0,u=r.text.length+l+c;u>n&&(o=s,n=u)}),e.textContent=this.options[o].text+(this.options[o].decoratorRight?`${this.options[o].decoratorRight} `:""),t=Dc(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=D(e,Dde(".select-box-dropdown-list-container")),this.listRenderer=new sdi,this.selectList=this._register(new Gc("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:n=>{if(n.isSeparator)return d(30,null);let r=n.text;return n.detail&&(r+=`. ${n.detail}`),n.decoratorRight&&(r+=`. ${n.decoratorRight}`),n.description&&(r+=`. ${n.description}`),r},getWidgetAriaLabel:()=>d(29,null),getRole:()=>et?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);let t=this._register(new Zn(this.selectDropDownListContainer,"keydown")),o=U.chain(t.event,n=>n.filter(()=>this.selectList.length>0).map(r=>new mi(r)));this._register(U.chain(o,n=>n.filter(r=>r.keyCode===3))(this.onEnter,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===2))(this.onEnter,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===9))(this.onEscape,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===16))(this.onUpArrow,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===18))(this.onDownArrow,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===12))(this.onPageDown,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===11))(this.onPageUp,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===14))(this.onHome,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode===13))(this.onEnd,this)),this._register(U.chain(o,n=>n.filter(r=>r.keyCode>=21&&r.keyCode<=56||r.keyCode>=85&&r.keyCode<=113))(this.onCharacter,this)),this._register($(this.selectList.getHTMLElement(),ne.POINTER_UP,n=>this.onPointerUp(n))),this._register(this.selectList.onMouseOver(n=>typeof n.index<"u"&&!this.options[n.index]?.isDisabled&&this.selectList.setFocus([n.index]))),this._register(this.selectList.onDidChangeFocus(n=>this.onListFocus(n))),this._register($(this.selectDropDownContainer,ne.FOCUS_OUT,n=>{!this._isVisible||ms(n.relatedTarget,this.selectDropDownContainer)||this.onListBlur()})),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;Kt.stop(e);let t=e.target;if(!t||t.classList.contains("slider"))return;let o=t.closest(".monaco-list-row");if(!o)return;let n=Number(o.getAttribute("data-index")),r=o.classList.contains("option-disabled");n>=0&&n<this.options.length&&!r&&(this.selected=n,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]),this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0))}onListBlur(){this._sticky||(this.selected!==this._currentSelection&&this.select(this._currentSelection),this.hideSelectDropDown(!1))}renderDescriptionMarkdown(e,t){let o=r=>{for(let s=0;s<r.childNodes.length;s++){let l=r.childNodes.item(s);(l.tagName&&l.tagName.toLowerCase())==="img"?l.remove():o(l)}},n=Lg({value:e,supportThemeIcons:!0},{actionHandler:t});return n.element.classList.add("select-box-description-markdown"),o(n.element),n}onListFocus(e){!this._isVisible||!this._hasDetails||this.updateDetail(e.indexes[0])}updateDetail(e){this._selectionDetailsDisposables.clear(),this.selectionDetailsPane.textContent="";let t=this.options[e],o=t?.description??"",n=t?.descriptionIsMarkdown??!1;if(o){if(n){let r=t.descriptionMarkdownActionHandler,s=this._selectionDetailsDisposables.add(this.renderDescriptionMarkdown(o,r));this.selectionDetailsPane.appendChild(s.element)}else this.selectionDetailsPane.textContent=o;this.selectionDetailsPane.style.display="block"}else this.selectionDetailsPane.style.display="none";this._skipLayout=!0,this.contextViewProvider.layout(),this._skipLayout=!1}onEscape(e){Kt.stop(e),this.select(this._currentSelection),this.hideSelectDropDown(!0)}onEnter(e){if(Kt.stop(e),this.options[this.selected]?.isDisabled){this.hideSelectDropDown(!0);return}this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0)}onDownArrow(e){if(this.selected<this.options.length-1){Kt.stop(e,!0);let t=this.selected+1;for(;t<this.options.length&&this.options[t].isDisabled;)t++;if(t>=this.options.length)return;this.selected=t,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){if(this.selected>0){Kt.stop(e,!0);let t=this.selected-1;for(;t>=0&&this.options[t].isDisabled;)t--;if(t<0)return;this.selected=t,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onPageUp(e){Kt.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{let t=this.selectList.getFocus()[0];for(;t>0&&this.options[t].isDisabled;)t--;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))},1)}onPageDown(e){Kt.stop(e),this.selectList.focusNextPage(),setTimeout(()=>{let t=this.selectList.getFocus()[0];for(;t<this.options.length-1&&this.options[t].isDisabled;)t++;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))},1)}onHome(e){if(Kt.stop(e),this.options.length<2)return;let t=0;for(;t<this.options.length-1&&this.options[t].isDisabled;)t++;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){if(Kt.stop(e),this.options.length<2)return;let t=this.options.length-1;for(;t>0&&this.options[t].isDisabled;)t--;this.options[t].isDisabled||(this.selected=t,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){let t=sm.toString(e.keyCode),o=-1;for(let n=0;n<this.options.length-1;n++)if(o=(n+this.selected+1)%this.options.length,this.options[o].text.charAt(0).toUpperCase()===t&&!this.options[o].isDisabled){this.select(o),this.selectList.setFocus([o]),this.selectList.reveal(this.selectList.getFocus()[0]),Kt.stop(e);break}}dispose(){this.hideSelectDropDown(!1),super.dispose()}};var skt=class extends k{constructor(e,t,o,n){super();this.selected=0;this.selectBoxOptions=n||Object.create(null),this.options=[],this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=this._register(new T),this.styles=o,this.registerListeners(),this.setOptions(e,t)}registerListeners(){this._register(ds.addTarget(this.selectElement)),[Vn.Tap].forEach(e=>{this._register($(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Yo(this.selectElement,"click",e=>{Kt.stop(e,!0)})),this._register(Yo(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Yo(this.selectElement,"keydown",e=>{let t=!1;et?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!eo(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((o,n)=>{this.selectElement.add(this.createOption(o.text,n,o.isDisabled,o.isSeparator))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected<this.options.length&&typeof this.options[this.selected].text=="string"?this.selectElement.title=this.options[this.selected].text:this.selectElement.title=""}setAriaLabel(e){this.selectBoxOptions.ariaLabel=e,this.selectElement.setAttribute("aria-label",e)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setEnabled(e){this.selectElement.disabled=!e}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){e.classList.add("select-container"),e.appendChild(this.selectElement),this.setOptions(this.options,this.selected),this.applyStyles()}style(e){this.styles=e,this.applyStyles()}applyStyles(){this.selectElement&&(this.selectElement.style.backgroundColor=this.styles.selectBackground??"",this.selectElement.style.color=this.styles.selectForeground??"",this.selectElement.style.borderColor=this.styles.selectBorder??"")}createOption(e,t,o,n){let r=document.createElement("option");return r.value=e,r.text=e,r.disabled=!!o||!!n,n&&r.setAttribute("role","separator"),r}};var GF=Object.freeze({text:"\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",isDisabled:!0,isSeparator:!0}),uAr={...qxt,selectBackground:"#3C3C3C",selectForeground:"#F0F0F0",selectBorder:"#3C3C3C",decoratorRightForeground:void 0,selectListBackground:void 0,selectListBorder:void 0,focusBorder:void 0},Jw=class extends ll{constructor(i,e,t,o,n){super(),et&&!n?.useCustomDrawn?this.selectBoxDelegate=new skt(i,e,o,n):this.selectBoxDelegate=new rkt(i,e,t,o,n),this._register(this.selectBoxDelegate)}get onDidSelect(){return this.selectBoxDelegate.onDidSelect}setOptions(i,e){this.selectBoxDelegate.setOptions(i,e)}select(i){this.selectBoxDelegate.select(i)}setAriaLabel(i){this.selectBoxDelegate.setAriaLabel(i)}focus(){this.selectBoxDelegate.focus()}blur(){this.selectBoxDelegate.blur()}setFocusable(i){this.selectBoxDelegate.setFocusable(i)}setEnabled(i){this.selectBoxDelegate.setEnabled(i)}render(i){this.selectBoxDelegate.render(i)}};var Ja=class extends k{constructor(e,t,o={}){super();this.options=o;this._context=e||this,this._action=t,t instanceof it&&this._register(t.onDidChange(n=>{this.element&&this.handleActionChangeEvent(n)}))}get action(){return this._action}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new cs)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){let t=this.element=e;this._register(ds.addTarget(e));let o=this.options&&this.options.draggable;o&&(e.draggable=!0,ed&&this._register($(e,ne.DRAG_START,n=>n.dataTransfer?.setData(Fl.TEXT,this._action.label)))),this._register($(t,Vn.Tap,n=>this.onClick(n,!0))),this._register($(t,ne.MOUSE_DOWN,n=>{o||Kt.stop(n,!0),this._action.enabled&&n.button===0&&t.classList.add("active")})),et&&this._register($(t,ne.CONTEXT_MENU,n=>{n.button===0&&n.ctrlKey===!0&&this.onClick(n)})),this._register($(t,ne.CLICK,n=>{Kt.stop(n,!0),this.options&&this.options.isMenu||this.onClick(n)})),this._register($(t,ne.DBLCLICK,n=>{Kt.stop(n,!0)})),[ne.MOUSE_UP,ne.MOUSE_OUT].forEach(n=>{this._register($(t,n,r=>{Kt.stop(r),t.classList.remove("active")}))})}onClick(e,t=!1){Kt.stop(e,!0);let o=mr(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,o)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}isFocused(){return!!this.element?.classList.contains("focused")}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}getHoverContents(){return this.getTooltip()}updateTooltip(){if(!this.element)return;let e=this.getHoverContents()??"";if(this.updateAriaLabel(),!this.customHover&&e!==""){let t=this.options.hoverDelegate??yi("element");this.customHover=this._store.add(sp().setupManagedHover(t,this.element,e))}else this.customHover&&this.customHover.update(e)}updateAriaLabel(){if(this.element){let e=this.getTooltip()??"";this.element.setAttribute("aria-label",e)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}},ts=class extends Ja{constructor(i,e,t){t={...t,icon:t.icon!==void 0?t.icon:!1,label:t.label!==void 0?t.label:!0},super(i,e,t),this.options=t,this.cssClass=""}render(i){super.render(i),To(this.element);let e=document.createElement("a");if(e.classList.add("action-label"),e.setAttribute("role",this.getDefaultAriaRole()),this.label=e,this.element.appendChild(e),this.options.label&&this.options.keybinding&&!this.options.keybindingNotRenderedWithLabel){let t=document.createElement("span");t.classList.add("keybinding"),t.textContent=this.options.keybinding,this.element.appendChild(t)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===oi.ID?"presentation":this.options.isMenu?"menuitem":this.options.isTabList?"tab":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}isFocused(){return!!this.label&&this.label?.tabIndex===0}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(i){this.label&&(this.label.tabIndex=i?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let i=null;return this.action.tooltip?i=this.action.tooltip:this.action.label&&(i=this.action.label,this.options.keybinding&&(i=d(0,null,i,this.options.keybinding))),i??void 0}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.action.id===oi.ID&&this.action.class?this.label?.classList.add(this.action.class):this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label?.classList.remove("codicon")}updateEnabled(){this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element?.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element?.classList.add("disabled"))}updateAriaLabel(){if(this.label){let i=this.getTooltip()??"";this.label.setAttribute("aria-label",i)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.options.isTabList?this.label.setAttribute("aria-selected",this.action.checked?"true":"false"):(this.label.setAttribute("aria-pressed",this.action.checked?"true":"false"),this.label.setAttribute("role","button"))):(this.label.classList.remove("checked"),this.label.removeAttribute(this.options.isTabList?"aria-selected":"aria-pressed"),this.label.setAttribute("role",this.getDefaultAriaRole())))}},NK=class extends Ja{constructor(i,e,t,o,n,r,s){super(i,e),this.selectBox=new Jw(t,o,n,r,s),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}setOptions(i,e){this.selectBox.setOptions(i,e)}select(i){this.selectBox.select(i)}registerListeners(){this._register(this.selectBox.onDidSelect(i=>this.runAction(i.selected,i.index)))}runAction(i,e){this.actionRunner.run(this._action,this.getActionContext(i,e))}getActionContext(i,e){return i}setFocusable(i){this.selectBox.setFocusable(i)}focus(){this.selectBox?.focus()}blur(){this.selectBox?.blur()}render(i){this.selectBox.render(i)}};var oo=class extends k{constructor(e,t={}){super();this._actionRunnerDisposables=this._register(new O);this.viewItemDisposables=this._register(new Ot);this.triggerKeyDown=!1;this.focusable=!0;this._onDidBlur=this._register(new T);this._onDidCancel=this._register(new T({onWillAddFirstListener:()=>this.cancelHasListener=!0}));this.cancelHasListener=!1;this._onDidRun=this._register(new T);this._onWillRun=this._register(new T);this.options=t,this._context=t.context??null,this._orientation=this.options.orientation??0,this._triggerKeys={keyDown:this.options.triggerKeys?.keyDown??!1,keys:this.options.triggerKeys?.keys??[3,10]},this._hoverDelegate=t.hoverDelegate??this._register(Dg()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new cs,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(r=>this._onDidRun.fire(r))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(r=>this._onWillRun.fire(r))),this._viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let o,n;switch(this._orientation){case 0:o=[15],n=[17];break;case 1:o=[16],n=[18],this.domNode.className+=" vertical";break}this._register($(this.domNode,ne.KEY_DOWN,r=>{let s=new mi(r),l=!0,c=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;o&&(s.equals(o[0])||s.equals(o[1]))?l=this.focusPrevious():n&&(s.equals(n[0])||s.equals(n[1]))?l=this.focusNext():s.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():s.equals(14)?l=this.focusFirst():s.equals(13)?l=this.focusLast():s.equals(2)&&c instanceof Ja&&c.trapsArrowNavigation?l=this.focusNext(void 0,!0):this.isTriggerKeyEvent(s)?this._triggerKeys.keyDown?this.doTrigger(s):this.triggerKeyDown=!0:l=!1,l&&(s.preventDefault(),s.stopPropagation())})),this._register($(this.domNode,ne.KEY_UP,r=>{let s=new mi(r);this.isTriggerKeyEvent(s)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(s)),s.preventDefault(),s.stopPropagation()):(s.equals(2)||s.equals(1026)||s.equals(16)||s.equals(18)||s.equals(15)||s.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(nr(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(Un()===this.domNode||!ms(Un(),this.domNode))&&(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)})),this._register(this.focusTracker.onDidFocus(()=>this.updateFocusedItem())),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}get viewItems(){return this._viewItems}get onDidBlur(){return this._onDidBlur.event}get onDidCancel(){return this._onDidCancel.event}get onDidRun(){return this._onDidRun.event}get onWillRun(){return this._onWillRun.event}refreshRole(){this.length()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setAriaLabel(e){e?this.actionsList.setAttribute("aria-label",e):this.actionsList.removeAttribute("aria-label")}setFocusable(e){if(this.focusable=e,this.focusable){let t=this.viewItems.find(o=>o instanceof Ja&&o.isEnabled());t instanceof Ja&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof Ja&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(o=>{t=t||e.equals(o)}),t}updateFocusedItem(){for(let e=0;e<this.actionsList.children.length;e++){let t=this.actionsList.children[e];if(ms(Un(),t)){this.focusedItem=e,this.viewItems[this.focusedItem]?.showHover?.();break}}}get context(){return this._context}set context(e){this._context=e,this.viewItems.forEach(t=>t.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}hasAction(e){return this.viewItems.findIndex(t=>t.action.id===e.id)!==-1}getAction(e){if(typeof e=="number")return this.viewItems[e]?.action;if(go(e)){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t<this.actionsList.childNodes.length;t++)if(this.actionsList.childNodes[t]===e)return this.viewItems[t].action}}push(e,t={}){let o=Array.isArray(e)?e:[e],n=on(t.index)?t.index:null;if(o.forEach(r=>{let s=document.createElement("li");s.className="action-item",s.setAttribute("role","presentation");let l,c={hoverDelegate:this._hoverDelegate,...t,isTabList:this.options.ariaRole==="tablist"};this.options.actionViewItemProvider&&(l=this.options.actionViewItemProvider(r,c)),l||(l=new ts(this.context,r,c)),this.options.allowContextMenu||this.viewItemDisposables.set(l,$(s,ne.CONTEXT_MENU,u=>{Kt.stop(u,!0)})),l.actionRunner=this._actionRunner,l.setActionContext(this.context),l.render(s),n===null||n<0||n>=this.actionsList.children.length?(this.actionsList.appendChild(s),this._viewItems.push(l)):(this.actionsList.insertBefore(s,this.actionsList.children[n]),this._viewItems.splice(n,0,l),n++)}),this.focusable){let r=!1;for(let s of this.viewItems){if(!(s instanceof Ja))continue;let l;r||s.action.id===oi.ID||!s.isEnabled()&&this.options.focusOnlyEnabledItems?l=!1:l=!0,l?(s.setFocusable(!0),r=!0):s.setFocusable(!1)}}typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}getWidth(e){return this.actionsList.children.item(e)?.clientWidth??0}getHeight(e){return this.actionsList.children.item(e)?.clientHeight??0}pull(e){e>=0&&e<this.viewItems.length&&(this.actionsList.childNodes[e].remove(),this.viewItemDisposables.deleteAndDispose(this.viewItems[e]),je(this._viewItems.splice(e,1)),this.refreshRole())}clear(){this.isEmpty()||(this._viewItems=je(this._viewItems),this.viewItemDisposables.clearAndDisposeAll(),St(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}isFocused(e){return e===void 0?ms(Un(),this.domNode):ms(Un(),this.actionsList.children[e])}focus(e){let t=!1,o;if(e===void 0?t=!0:typeof e=="number"?o=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){let n=this.viewItems.findIndex(r=>r.isEnabled());this.focusedItem=n===-1?void 0:n,this.updateFocus(void 0,void 0,!0)}else o!==void 0&&(this.focusedItem=o),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e,t){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;let o=this.focusedItem,n;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=o,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,n=this.viewItems[this.focusedItem]}while(this.focusedItem!==o&&(this.options.focusOnlyEnabledItems&&!n.isEnabled()||n.action.id===oi.ID));return this.updateFocus(void 0,void 0,t),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;let t=this.focusedItem,o;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}o=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!o.isEnabled()||o.action.id===oi.ID));return this.updateFocus(!0),!0}updateFocus(e,t,o=!1){typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&this.viewItems[this.previouslyFocusedItem]?.blur();let n=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(n){let r=!0;bL(n.focus)||(r=!1),this.options.focusOnlyEnabledItems&&bL(n.isEnabled)&&!n.isEnabled()&&(r=!1),n.action.id===oi.ID&&(r=!1),r?(o||this.previouslyFocusedItem!==this.focusedItem)&&(n.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),r&&n.showHover?.()}}doTrigger(e){if(typeof this.focusedItem>"u")return;let t=this.viewItems[this.focusedItem];if(t instanceof Ja){let o=t._context===null||t._context===void 0?e:t._context;this.run(t._action,o)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this._viewItems=je(this._viewItems),this.getContainer().remove(),super.dispose()}};function Kk(a){if(!a.length)return a;let i=-1;for(let t=0;t<a.length;t++)if(a[t].id!==oi.ID){i=t;break}if(i===-1)return[];a=a.slice(i);for(let t=a.length-1;t>=0&&a[t].id===oi.ID;t--)a.splice(t,1);let e=!1;for(let t=a.length-1;t>=0;t--){let o=a[t].id===oi.ID;o&&!e?a.splice(t,1):o?o&&(e=!1):e=!0}return a}function MZi(a,i,e,t){if(a.length===0)return i;if(i.length===0)return a;let o=[],n=0,r=0;for(;n<a.length&&r<i.length;){let s=a[n],l=i[r],c=e(s),u=e(l);c<u?(o.push(s),n++):c>u?(o.push(l),r++):(o.push(t(s,l)),n++,r++)}for(;n<a.length;)o.push(a[n]),n++;for(;r<i.length;)o.push(i[r]),r++;return o}function Tke(a,i){let e=new O,t=a.createDecorationsCollection();return e.add(dD({debugName:()=>`Apply decorations from ${i.debugName}`},o=>{let n=i.read(o);t.set(n)})),e.add({dispose:()=>{t.clear()}}),e}function l4(a,i){return a.appendChild(i),ee(()=>{i.remove()})}function PZi(a,i){return a.prepend(i),ee(()=>{i.remove()})}var Eke=class extends k{constructor(e,t){super();this._automaticLayout=!1;this.elementSizeObserver=this._register(new ZY(e,t)),this._width=De(this,this.elementSizeObserver.getWidth()),this._height=De(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(o=>Ki(n=>{this._width.set(this.elementSizeObserver.getWidth(),n),this._height.set(this.elementSizeObserver.getHeight(),n)})))}get width(){return this._width}get height(){return this._height}get automaticLayout(){return this._automaticLayout}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){this._automaticLayout=e,e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}};function cdi(a,i,e){let t=i.get(),o=t,n=t,r=De("animatedValue",t),s=-1,l=300,c;e.add(fA({changeTracker:{createChangeSummary:()=>({animate:!1}),handleChange:(p,h)=>(p.didChange(i)&&(h.animate=h.animate||p.change),!0)}},(p,h)=>{c!==void 0&&(a.cancelAnimationFrame(c),c=void 0),o=n,t=i.read(p),o===t?s=Date.now()-l:s=Date.now()-(h.animate?0:l),u()}));function u(){let p=Date.now()-s;n=Math.floor(k5o(p,o,t-o,l)),p<l?c=a.requestAnimationFrame(u):n=t,r.set(n,void 0)}return r}function k5o(a,i,e,t){return a===t?i+e:e*(-Math.pow(2,-10*a/t)+1)+i}var Rde=class extends k{constructor(i,e,t){super(),this._register(new adi(i,t)),this._register(NA(t,{height:e.actualHeight,top:e.actualTop}))}},OK=class{constructor(i,e){this._afterLineNumber=i;this.heightInPx=e;this.domNode=document.createElement("div"),this._actualTop=De(this,void 0),this._actualHeight=De(this,void 0),this.actualTop=this._actualTop,this.actualHeight=this._actualHeight,this.showInHiddenAreas=!0,this.onChange=this._afterLineNumber,this.onDomNodeTop=t=>{this._actualTop.set(t,void 0)},this.onComputedHeight=t=>{this._actualHeight.set(t,void 0)}}get afterLineNumber(){return this._afterLineNumber.get()}},adi=class a{constructor(i,e){this._editor=i;this._domElement=e;this._overlayWidgetId=`managedOverlayWidget-${a._counter++}`;this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null};this._editor.addOverlayWidget(this._overlayWidget)}static{this._counter=0}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}};function NA(a,i){return ve(e=>{for(let[t,o]of Object.entries(i))o&&typeof o=="object"&&"read"in o&&(o=o.read(e)),typeof o=="number"&&(o=`${o}px`),t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),a.style[t]=o})}function _ke(a,i,e,t){let o=new O,n=[];return o.add(Rl((r,s)=>{let l=i.read(r),c=new Map,u=new Map;e&&e(!0),a.changeViewZones(p=>{for(let h of n)p.removeZone(h),t?.delete(h);n.length=0;for(let h of l){let g=p.addZone(h);h.setZoneId&&h.setZoneId(g),n.push(g),t?.add(g),c.set(h,g)}}),e&&e(!1),s.add(fA({changeTracker:{createChangeSummary(){return{zoneIds:[]}},handleChange(p,h){let g=u.get(p.changedObservable);return g!==void 0&&h.zoneIds.push(g),!0}}},(p,h)=>{for(let g of l)g.onChange&&(u.set(g.onChange,c.get(g)),g.onChange.read(p));e&&e(!0),a.changeViewZones(g=>{for(let f of h.zoneIds)g.layoutZone(f)}),e&&e(!1)}))})),o.add({dispose(){e&&e(!0),a.changeViewZones(r=>{for(let s of n)r.removeZone(s)}),t?.clear(),e&&e(!1)}}),o}var akt=class extends qe{dispose(){super.dispose(!0)}};function ddi(a,i){let e=wu(i,o=>o.original.startLineNumber<=a.lineNumber);if(!e)return G.fromPositions(a);if(e.original.endLineNumberExclusive<=a.lineNumber){let o=a.lineNumber-e.original.endLineNumberExclusive+e.modified.endLineNumberExclusive;return G.fromPositions(new ye(o,a.column))}if(!e.innerChanges)return G.fromPositions(new ye(e.modified.startLineNumber,1));let t=wu(e.innerChanges,o=>o.originalRange.getStartPosition().isBeforeOrEqual(a));if(!t){let o=a.lineNumber-e.original.startLineNumber+e.modified.startLineNumber;return G.fromPositions(new ye(o,a.column))}if(t.originalRange.containsPosition(a))return t.modifiedRange;{let o=E5o(t.originalRange.getEndPosition(),a);return G.fromPositions(o.addToPosition(t.modifiedRange.getEndPosition()))}}function E5o(a,i){return a.lineNumber===i.lineNumber?new Rc(0,i.column-a.column):new Rc(i.lineNumber-a.lineNumber,i.column-1)}function AZi(a,i){let e;return a.filter(t=>{let o=i(t,e);return e=t,o})}var qF=class{static create(i,e=void 0){return new cQe(i,i,e)}static createWithDisposable(i,e,t=void 0){let o=new O;return o.add(e),o.add(i),new cQe(i,o,t)}static createOfNonDisposable(i,e,t=void 0){return new cQe(i,e,t)}},cQe=class extends qF{constructor(e,t,o){super();this.object=e;this._disposable=t;this._debugOwner=o;this._refCount=1;this._isDisposed=!1;this._owners=[];o&&this._addOwner(o)}_addOwner(e){e&&this._owners.push(e)}createNewRef(e){return this._refCount++,e&&this._addOwner(e),new ldi(this,e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._decreaseRefCount(this._debugOwner))}_decreaseRefCount(e){if(this._refCount--,this._refCount===0&&this._disposable.dispose(),e){let t=this._owners.indexOf(e);t!==-1&&this._owners.splice(t,1)}}},ldi=class extends qF{constructor(e,t){super();this._base=e;this._debugOwner=t;this._isDisposed=!1}get object(){return this._base.object}createNewRef(e){return this._base.createNewRef(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._base._decreaseRefCount(this._debugOwner))}};var pdi={IconContribution:"base.contributions.icons"},T5o;(i=>{function a(e,t){let o=e.defaults;for(;q.isThemeIcon(o);){let n=Lde.getIcon(o.id);if(!n)return;o=n.defaults}return o}i.getDefinition=a})(T5o||={});var lkt;(e=>{function a(t){return{weight:t.weight,style:t.style,src:t.src.map(o=>({format:o.format,location:o.location.toString()}))}}e.toJSONObject=a;function i(t){let o=n=>We(n)?n:void 0;if(t&&Array.isArray(t.src)&&t.src.every(n=>We(n.format)&&We(n.location)))return{weight:o(t.weight),style:o(t.style),src:t.src.map(n=>({format:n.format,location:A.parse(n.location)}))}}e.fromJSONObject=i})(lkt||={});var qX=/^([\w_-]+)$/,Dke=/^(normal|italic|(oblique[ \w\s-]+))$/,Rke=/^(normal|bold|lighter|bolder|(\d{0-1000}))$/,dQe=/^([\w_.%+-]+)$/,OZi=/^woff|woff2|truetype|opentype|embedded-opentype|svg$/,ckt=/^#[0-9a-fA-F]{0,6}$/,Lke=d(2871,null),udi=class extends k{constructor(){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:d(2868,null),pattern:qX.source,patternErrorMessage:Lke},fontCharacter:{type:"string",description:d(2867,null)}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}};this.iconReferenceSchema={type:"string",pattern:`^${q.iconNameExpression}$`,enum:[],enumDescriptions:[]};this.iconsById={},this.iconFontsById={}}registerIcon(e,t,o,n){let r=this.iconsById[e];if(r){if(o&&!r.description){r.description=o,this.iconSchema.properties[e].markdownDescription=`${o} $(${e})`;let c=this.iconReferenceSchema.enum.indexOf(e);c!==-1&&(this.iconReferenceSchema.enumDescriptions[c]=o),this._onDidChange.fire()}return r}let s={id:e,description:o,defaults:t,deprecationMessage:n};this.iconsById[e]=s;let l={$ref:"#/definitions/icons"};return n&&(l.deprecationMessage=n),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 t=this.iconReferenceSchema.enum.indexOf(e);t!==-1&&(this.iconReferenceSchema.enum.splice(t,1),this.iconReferenceSchema.enumDescriptions.splice(t,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,t){let o=this.iconFontsById[e];return o||(this.iconFontsById[e]=t,this._onDidChange.fire(),t)}deregisterIconFont(e){delete this.iconFontsById[e]}getIconFont(e){return this.iconFontsById[e]}toString(){let e=(r,s)=>r.id.localeCompare(s.id),t=r=>{for(;q.isThemeIcon(r.defaults);)r=this.iconsById[r.defaults.id];return`codicon codicon-${r?r.id:""}`},o=[];o.push("| preview     | identifier                        | default codicon ID                | description"),o.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");let n=Object.keys(this.iconsById).map(r=>this.iconsById[r]);for(let r of n.filter(s=>!!s.description).sort(e))o.push(`|<i class="${t(r)}"></i>|${r.id}|${q.isThemeIcon(r.defaults)?r.defaults.id:r.id}|${r.description||""}|`);o.push("| preview     | identifier                        "),o.push("| ----------- | --------------------------------- |");for(let r of n.filter(s=>!q.isThemeIcon(s.defaults)).sort(e))o.push(`|<i class="${t(r)}"></i>|${r.id}|`);return o.join(`
`)}},Lde=new udi;oe.add(pdi.IconContribution,Lde);function Oe(a,i,e,t){return Lde.registerIcon(a,i,e,t)}function Zw(){return Lde}function _5o(){let a=$bt();for(let i in a){let e="\\"+a[i].toString(16);Lde.registerIcon(i,{fontCharacter:e})}}_5o();var dkt="vscode://schemas/icons",FZi=oe.as(Ta.JSONContribution);FZi.registerSchema(dkt,Lde.getIconSchema());var NZi=new Dt(()=>FZi.notifySchemaChanged(dkt),200);Lde.onDidChange(()=>{NZi.isScheduled()||NZi.schedule()});var MT=Oe("widget-close",L.close,d(2872,null)),WZi=Oe("goto-previous-location",L.arrowUp,d(2870,null)),VZi=Oe("goto-next-location",L.arrowDown,d(2869,null)),uQe=q.modify(L.sync,"spin"),PT=q.modify(L.loading,"spin");var D5o=Oe("diff-review-insert",L.add,d(221,null)),R5o=Oe("diff-review-remove",L.remove,d(222,null)),L5o=Oe("diff-review-close",L.close,d(220,null)),$F=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._parentNode=e;this._visible=t;this._setVisible=o;this._canClose=n;this._width=r;this._height=s;this._diffs=l;this._models=c;this._instantiationService=u;this._state=ke(this,e=>{let t=this._visible.read(e);if(this._parentNode.style.visibility=t?"visible":"hidden",!t)return null;let o=e.store.add(this._instantiationService.createInstance(mQe,this._diffs,this._models,this._setVisible,this._canClose)),n=e.store.add(this._instantiationService.createInstance(hQe,this._parentNode,o,this._width,this._height,this._models));return{model:o,view:n}}).recomputeInitiallyAndOnChange(this._store)}static{this._ttPolicy=zf("diffReview",{createHTML:e=>e})}next(){Ki(e=>{let t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){Ki(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){Ki(e=>{this._setVisible(!1,e)})}};$F=I([m(8,F)],$F);var mQe=class extends k{constructor(e,t,o,n,r){super();this._diffs=e;this._models=t;this._setVisible=o;this.canClose=n;this._accessibilitySignalService=r;this._groups=De(this,[]);this._currentGroupIdx=De(this,0);this._currentElementIdx=De(this,0);this.groups=this._groups;this.currentGroup=this._currentGroupIdx.map((e,t)=>this._groups.read(t)[e]);this.currentGroupIndex=this._currentGroupIdx;this.currentElement=this._currentElementIdx.map((e,t)=>this.currentGroup.read(t)?.lines[e]);this._register(ve(s=>{let l=this._diffs.read(s);if(!l){this._groups.set([],void 0);return}let c=M5o(l,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());Ki(u=>{let p=this._models.getModifiedPosition();if(p){let h=c.findIndex(g=>p?.lineNumber<g.range.modified.endLineNumberExclusive);h!==-1&&this._currentGroupIdx.set(h,u)}this._groups.set(c,u)})})),this._register(ve(s=>{let l=this.currentElement.read(s);l?.type===2?this._accessibilitySignalService.playSignal(tn.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):l?.type===3&&this._accessibilitySignalService.playSignal(tn.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(ve(s=>{let l=this.currentElement.read(s);if(l&&l.type!==0){let c=l.modifiedLineNumber??l.diff.modified.startLineNumber;this._models.modifiedSetSelection(G.fromPositions(new ye(c,1)))}}))}_goToGroupDelta(e,t){let o=this.groups.get();!o||o.length<=1||aF(t,n=>{this._currentGroupIdx.set(gi.ofLength(o.length).clipCyclic(this._currentGroupIdx.get()+e),n),this._currentElementIdx.set(0,n)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){let t=this.currentGroup.get();!t||t.lines.length<=1||Ki(o=>{this._currentElementIdx.set(gi.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),o)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){let t=this.currentGroup.get();if(!t)return;let o=t.lines.indexOf(e);o!==-1&&Ki(n=>{this._currentElementIdx.set(o,n)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);let e=this.currentElement.get();e&&(e.type===2?this._models.originalReveal(G.fromPositions(new ye(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==0?G.fromPositions(new ye(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};mQe=I([m(4,br)],mQe);var pQe=3;function M5o(a,i,e){let t=[];for(let o of iY(a,(n,r)=>r.modified.startLineNumber-n.modified.endLineNumberExclusive<2*pQe)){let n=[];n.push(new hdi);let r=new vo(Math.max(1,o[0].original.startLineNumber-pQe),Math.min(o[o.length-1].original.endLineNumberExclusive+pQe,i+1)),s=new vo(Math.max(1,o[0].modified.startLineNumber-pQe),Math.min(o[o.length-1].modified.endLineNumberExclusive+pQe,e+1));vvt(o,(u,p)=>{let h=new vo(u?u.original.endLineNumberExclusive:r.startLineNumber,p?p.original.startLineNumber:r.endLineNumberExclusive),g=new vo(u?u.modified.endLineNumberExclusive:s.startLineNumber,p?p.modified.startLineNumber:s.endLineNumberExclusive);h.forEach(f=>{n.push(new vdi(f,g.startLineNumber+(f-h.startLineNumber)))}),p&&(p.original.forEach(f=>{n.push(new gdi(p,f))}),p.modified.forEach(f=>{n.push(new fdi(p,f))}))});let l=o[0].modified.join(o[o.length-1].modified),c=o[0].original.join(o[o.length-1].original);t.push(new mdi(new Oy(l,c),n))}return t}var mdi=class{constructor(i,e){this.range=i;this.lines=e}},hdi=class{constructor(){this.type=0}},gdi=class{constructor(i,e){this.diff=i;this.originalLineNumber=e;this.type=2;this.modifiedLineNumber=void 0}},fdi=class{constructor(i,e){this.diff=i;this.modifiedLineNumber=e;this.type=3;this.originalLineNumber=void 0}},vdi=class{constructor(i,e){this.originalLineNumber=i;this.modifiedLineNumber=e;this.type=1}},hQe=class extends k{constructor(e,t,o,n,r,s){super();this._element=e;this._model=t;this._width=o;this._height=n;this._models=r;this._languageService=s;this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";let l=document.createElement("div");l.className="diff-review-actions",this._actionBar=this._register(new oo(l)),this._register(ve(c=>{this._actionBar.clear(),this._model.canClose.read(c)&&this._actionBar.push(li({id:"diffreview.close",label:d(229,null),class:"close-diff-review "+q.asClassName(L5o),enabled:!0,run:async()=>t.close()}),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new Ar(this._content,{})),Ii(this.domNode,this._scrollbar.getDomNode(),l),this._register(ve(c=>{this._height.read(c),this._width.read(c),this._scrollbar.scanDomNode()})),this._register(ee(()=>{Ii(this.domNode)})),this._register(NA(this.domNode,{width:this._width,height:this._height})),this._register(NA(this._content,{width:this._width,height:this._height})),this._register(Rl((c,u)=>{this._model.currentGroup.read(c),this._render(u)})),this._register(Yo(this.domNode,"keydown",c=>{(c.equals(18)||c.equals(2066)||c.equals(530))&&(c.preventDefault(),this._model.goToNextLine()),(c.equals(16)||c.equals(2064)||c.equals(528))&&(c.preventDefault(),this._model.goToPreviousLine()),(c.equals(9)||c.equals(2057)||c.equals(521)||c.equals(1033))&&(c.preventDefault(),this._model.close()),(c.equals(10)||c.equals(3))&&(c.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){let t=this._models.getOriginalOptions(),o=this._models.getModifiedOptions(),n=document.createElement("div");n.className="diff-review-table",n.setAttribute("role","list"),n.setAttribute("aria-label",d(223,null)),ku(n,o.get(59)),Ii(this._content,n);let r=this._models.getOriginalModel(),s=this._models.getModifiedModel();if(!r||!s)return;let l=r.getOptions(),c=s.getOptions(),u=o.get(75),p=this._model.currentGroup.get();for(let h of p?.lines||[]){if(!p)break;let g;if(h.type===0){let v=document.createElement("div");v.className="diff-review-row",v.setAttribute("role","listitem");let b=p.range,S=this._model.currentGroupIndex.get(),y=this._model.groups.get().length,w=N=>N===0?d(231,null):N===1?d(232,null):d(230,null,N),x=w(b.original.length),E=w(b.modified.length);v.setAttribute("aria-label",d(227,null,S+1,y,b.original.startLineNumber,x,b.modified.startLineNumber,E));let M=document.createElement("div");M.className="diff-review-cell diff-review-summary",M.appendChild(document.createTextNode(`${S+1}/${y}: @@ -${b.original.startLineNumber},${b.original.length} +${b.modified.startLineNumber},${b.modified.length} @@`)),v.appendChild(M),g=v}else g=this._createRow(h,u,this._width.get(),t,r,l,o,s,c);n.appendChild(g);let f=ke(v=>this._model.currentElement.read(v)===h);e.add(ve(v=>{let b=f.read(v);g.tabIndex=b?0:-1,b&&g.focus()})),e.add($(g,"focus",()=>{this._model.goToLine(h)}))}this._scrollbar.scanDomNode()}_createRow(e,t,o,n,r,s,l,c,u){let p=n.get(165),h=p.glyphMarginWidth+p.lineNumbersWidth,g=l.get(165),f=10+g.glyphMarginWidth+g.lineNumbersWidth,v="diff-review-row",b="",S="diff-review-spacer",y=null;switch(e.type){case 3:v="diff-review-row line-insert",b=" char-insert",y=D5o;break;case 2:v="diff-review-row line-delete",b=" char-delete",y=R5o;break}let w=document.createElement("div");w.style.minWidth=o+"px",w.className=v,w.setAttribute("role","listitem"),w.ariaLevel="";let x=document.createElement("div");x.className="diff-review-cell",x.style.height=`${t}px`,w.appendChild(x);let E=document.createElement("span");E.style.width=h+"px",E.style.minWidth=h+"px",E.className="diff-review-line-number"+b,e.originalLineNumber!==void 0?E.appendChild(document.createTextNode(String(e.originalLineNumber))):E.innerText="\xA0",x.appendChild(E);let M=document.createElement("span");M.style.width=f+"px",M.style.minWidth=f+"px",M.style.paddingRight="10px",M.className="diff-review-line-number"+b,e.modifiedLineNumber!==void 0?M.appendChild(document.createTextNode(String(e.modifiedLineNumber))):M.innerText="\xA0",x.appendChild(M);let N=document.createElement("span");if(N.className=S,y){let K=document.createElement("span");K.className=q.asClassName(y),K.innerText="\xA0\xA0",N.appendChild(K)}else N.innerText="\xA0\xA0";x.appendChild(N);let V;if(e.modifiedLineNumber!==void 0){let K=this._getLineHtml(c,l,u.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);$F._ttPolicy&&(K=$F._ttPolicy.createHTML(K)),x.insertAdjacentHTML("beforeend",K),V=c.getLineContent(e.modifiedLineNumber)}else{let K=this._getLineHtml(r,n,s.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);$F._ttPolicy&&(K=$F._ttPolicy.createHTML(K)),x.insertAdjacentHTML("beforeend",K),V=r.getLineContent(e.originalLineNumber)}V.length===0&&(V=d(224,null));let H="";switch(e.type){case 1:e.originalLineNumber===e.modifiedLineNumber?H=d(233,null,V,e.originalLineNumber):H=d(226,null,V,e.originalLineNumber,e.modifiedLineNumber);break;case 3:H=d(228,null,V,e.modifiedLineNumber);break;case 2:H=d(225,null,V,e.originalLineNumber);break}return w.setAttribute("aria-label",H),w}_getLineHtml(e,t,o,n,r){let s=e.getLineContent(n),l=t.get(59),c=t.get(117).verticalScrollbarSize,u=Cd.createEmpty(s,r),p=dK.isBasicASCII(s,e.mightContainNonBasicASCII()),h=dK.containsRTL(s,p,e.mightContainRTL());return oYi(new KL(l.isMonospace&&!t.get(40),l.canUseHalfwidthRightwardsArrow,s,!1,p,h,0,u,[],o,0,l.spaceWidth,l.middotWidth,l.wsmiddotWidth,t.get(133),t.get(113),t.get(108),t.get(60)!==Mk.OFF,null,null,c)).html}};hQe=I([m(5,Rt)],hQe);var ukt=class{constructor(i){this.editors=i}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(i){this.editors.original.revealRange(i),this.editors.original.setSelection(i),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(i){i&&(this.editors.modified.revealRange(i),this.editors.modified.setSelection(i)),this.editors.modified.focus()}modifiedSetSelection(i){this.editors.modified.setSelection(i)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){return this.editors.modified.getPosition()??void 0}};var dOr=te("diffEditor.move.border","#8b8b8b9c",d(259,null)),uOr=te("diffEditor.moveActive.border","#FFA500",d(260,null)),pOr=te("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},d(261,null)),P5o=Oe("diff-insert",L.add,d(262,null)),bdi=Oe("diff-remove",L.remove,d(263,null)),Sdi=So.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+q.asClassName(P5o),marginClassName:"gutter-insert"}),Idi=So.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+q.asClassName(bdi),marginClassName:"gutter-delete"}),ydi=So.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),wdi=So.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),Mde=So.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),Mke=So.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),BZi=So.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),c4=So.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),HZi=So.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),UZi=So.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"});var Cdi=le("diffProviderFactoryService"),gQe=class{constructor(i){this.instantiationService=i}createDiffProvider(i){return this.instantiationService.createInstance(qB,i)}};gQe=I([m(0,F)],gQe);Ce(Cdi,gQe,1);var qB=class{constructor(i,e,t){this.editorWorkerService=e;this.telemetryService=t;this.onDidChangeEventEmitter=new T;this.onDidChange=this.onDidChangeEventEmitter.event;this.diffAlgorithm="advanced";this.diffAlgorithmOnDidChangeSubscription=void 0;this.setOptions(i)}static{this.diffCache=new Map}dispose(){this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.onDidChangeEventEmitter.dispose()}async computeDiff(i,e,t,o){if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(i,e,t,o);if(i.isDisposed()||e.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(i.getLineCount()===1&&i.getLineMaxColumn(1)===1)return e.getLineCount()===1&&e.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new vv(new vo(1,2),new vo(1,e.getLineCount()+1),[new lf(i.getFullModelRange(),e.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};let n=JSON.stringify([i.uri.toString(),e.uri.toString()]),r=JSON.stringify([i.id,e.id,i.getAlternativeVersionId(),e.getAlternativeVersionId(),JSON.stringify(t)]),s=qB.diffCache.get(n);if(s&&s.context===r)return s.result;let l=On.create(),c=await this.editorWorkerService.computeDiff(i.uri,e.uri,t,this.diffAlgorithm),u=l.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:u,timedOut:c?.quitEarly??!0,detectedMoves:t.computeMoves?c?.moves.length??0:-1}),o.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!c)throw new Error("no diff result available");return qB.diffCache.size>10&&qB.diffCache.delete(qB.diffCache.keys().next().value),qB.diffCache.set(n,{result:c,context:r}),c}setOptions(i){let e=!1;i.diffAlgorithm&&this.diffAlgorithm!==i.diffAlgorithm&&(this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=i.diffAlgorithm,typeof i.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=i.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),e=!0),e&&this.onDidChangeEventEmitter.fire()}};qB=I([m(1,Qs),m(2,_e)],qB);var $X=class extends k{constructor(e,t,o){super();this.model=e;this._options=t;this._diffProviderFactoryService=o;this._isDiffUpToDate=De(this,!1);this.isDiffUpToDate=this._isDiffUpToDate;this._diff=De(this,void 0);this.diff=this._diff;this._unchangedRegions=De(this,void 0);this.unchangedRegions=ke(this,e=>this._options.hideUnchangedRegions.read(e)?this._unchangedRegions.read(e)?.regions??[]:(Ki(t=>{for(let o of this._unchangedRegions.read(void 0)?.regions||[])o.collapseAll(t)}),[]));this.movedTextToCompare=De(this,void 0);this._activeMovedText=De(this,void 0);this._hoveredMovedText=De(this,void 0);this.activeMovedText=ke(this,e=>this.movedTextToCompare.read(e)??this._hoveredMovedText.read(e)??this._activeMovedText.read(e));this._cancellationTokenSource=new qe;this._diffProvider=ke(this,e=>{let t=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(e)}),o=qr("onDidChange",t.onDidChange);return{diffProvider:t,onChangeSignal:o}});this._register(ee(()=>this._cancellationTokenSource.cancel()));let n=zc("contentChangedSignal"),r=this._register(new Dt(()=>n.trigger(void 0),200));this._register(ve(l=>{let c=this._unchangedRegions.read(l);if(!c||c.regions.some(v=>v.isDragged.read(l)))return;let u=c.originalDecorationIds.map(v=>e.original.getDecorationRange(v)).map(v=>v?vo.fromRangeInclusive(v):void 0),p=c.modifiedDecorationIds.map(v=>e.modified.getDecorationRange(v)).map(v=>v?vo.fromRangeInclusive(v):void 0),h=c.regions.map((v,b)=>!u[b]||!p[b]?void 0:new jX(u[b].startLineNumber,p[b].startLineNumber,u[b].length,v.visibleLineCountTop.read(l),v.visibleLineCountBottom.read(l))).filter(so),g=[],f=!1;for(let v of iY(h,(b,S)=>b.getHiddenModifiedRange(l).endLineNumberExclusive===S.getHiddenModifiedRange(l).startLineNumber))if(v.length>1){f=!0;let b=v.reduce((y,w)=>y+w.lineCount,0),S=new jX(v[0].originalLineNumber,v[0].modifiedLineNumber,b,v[0].visibleLineCountTop.read(void 0),v[v.length-1].visibleLineCountBottom.read(void 0));g.push(S)}else g.push(v[0]);if(f){let v=e.original.deltaDecorations(c.originalDecorationIds,g.map(S=>({range:S.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),b=e.modified.deltaDecorations(c.modifiedDecorationIds,g.map(S=>({range:S.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));Ki(S=>{this._unchangedRegions.set({regions:g,originalDecorationIds:v,modifiedDecorationIds:b},S)})}}));let s=(l,c,u)=>{let p=jX.fromDiffs(l.changes,e.original.getLineCount(),e.modified.getLineCount(),this._options.hideUnchangedRegionsMinimumLineCount.read(u),this._options.hideUnchangedRegionsContextLineCount.read(u)),h,g=this._unchangedRegions.get();if(g){let S=g.originalDecorationIds.map(E=>e.original.getDecorationRange(E)).map(E=>E?vo.fromRangeInclusive(E):void 0),y=g.modifiedDecorationIds.map(E=>e.modified.getDecorationRange(E)).map(E=>E?vo.fromRangeInclusive(E):void 0),x=AZi(g.regions.map((E,M)=>{if(!S[M]||!y[M])return;let N=S[M].length;return new jX(S[M].startLineNumber,y[M].startLineNumber,N,Math.min(E.visibleLineCountTop.get(),N),Math.min(E.visibleLineCountBottom.get(),N-E.visibleLineCountTop.get()))}).filter(so),(E,M)=>!M||E.modifiedLineNumber>=M.modifiedLineNumber+M.lineCount&&E.originalLineNumber>=M.originalLineNumber+M.lineCount).map(E=>new Oy(E.getHiddenOriginalRange(u),E.getHiddenModifiedRange(u)));x=Oy.clip(x,vo.ofLength(1,e.original.getLineCount()),vo.ofLength(1,e.modified.getLineCount())),h=Oy.inverse(x,e.original.getLineCount(),e.modified.getLineCount())}let f=[];if(h)for(let S of p){let y=h.filter(w=>w.original.intersectsStrict(S.originalUnchangedRange)&&w.modified.intersectsStrict(S.modifiedUnchangedRange));f.push(...S.setVisibleRanges(y,c))}else f.push(...p);let v=e.original.deltaDecorations(g?.originalDecorationIds||[],f.map(S=>({range:S.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),b=e.modified.deltaDecorations(g?.modifiedDecorationIds||[],f.map(S=>({range:S.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));this._unchangedRegions.set({regions:f,originalDecorationIds:v,modifiedDecorationIds:b},c)};this._register(e.modified.onDidChangeContent(l=>{if(this._diff.get()){let u=HF.fromModelContentChanges(l.changes),p=(this._lastDiff,e.original,e.modified,void 0);p&&(this._lastDiff=p,Ki(h=>{this._diff.set(Pde.fromDiffResult(this._lastDiff),h),s(p,h);let g=this.movedTextToCompare.get();this.movedTextToCompare.set(g?this._lastDiff.moves.find(f=>f.lineRangeMapping.modified.intersect(g.lineRangeMapping.modified)):void 0,h)}))}this._isDiffUpToDate.set(!1,void 0),r.schedule()})),this._register(e.original.onDidChangeContent(l=>{if(this._diff.get()){let u=HF.fromModelContentChanges(l.changes),p=(this._lastDiff,e.original,e.modified,void 0);p&&(this._lastDiff=p,Ki(h=>{this._diff.set(Pde.fromDiffResult(this._lastDiff),h),s(p,h);let g=this.movedTextToCompare.get();this.movedTextToCompare.set(g?this._lastDiff.moves.find(f=>f.lineRangeMapping.modified.intersect(g.lineRangeMapping.modified)):void 0,h)}))}this._isDiffUpToDate.set(!1,void 0),r.schedule()})),this._register(ve(async l=>{let c=l.store;this._options.hideUnchangedRegionsMinimumLineCount.read(l),this._options.hideUnchangedRegionsContextLineCount.read(l),r.cancel(),n.read(l);let u=this._diffProvider.read(l);u.onChangeSignal.read(l),zk(CCe,l),zk(w3e,l),this._isDiffUpToDate.set(!1,void 0);let p=[];c.add(e.original.onDidChangeContent(f=>{let v=HF.fromModelContentChanges(f.changes);p=Qxe(p,v)}));let h=[];c.add(e.modified.onDidChangeContent(f=>{let v=HF.fromModelContentChanges(f.changes);h=Qxe(h,v)}));let g=await u.diffProvider.computeDiff(e.original,e.modified,{ignoreTrimWhitespace:this._options.ignoreTrimWhitespace.read(l),maxComputationTimeMs:this._options.maxComputationTimeMs.read(l),computeMoves:this._options.showMoves.read(l)},this._cancellationTokenSource.token).catch(bwe);!g||this._cancellationTokenSource.token.isCancellationRequested||e.original.isDisposed()||e.modified.isDisposed()||(g=A5o(g,e.original,e.modified),g=(e.original,e.modified,void 0)??g,g=(e.original,e.modified,void 0)??g,Ki(f=>{s(g,f),this._lastDiff=g;let v=Pde.fromDiffResult(g);this._diff.set(v,f),this._isDiffUpToDate.set(!0,f);let b=this.movedTextToCompare.read(void 0);this.movedTextToCompare.set(b?this._lastDiff.moves.find(S=>S.lineRangeMapping.modified.intersect(b.lineRangeMapping.modified)):void 0,f)}))}))}setActiveMovedText(e){this._activeMovedText.set(e,void 0)}setHoveredMovedText(e){this._hoveredMovedText.set(e,void 0)}ensureModifiedLineIsVisible(e,t,o){if(this.diff.get()?.mappings.length===0)return;let n=this._unchangedRegions.get()?.regions||[];for(let r of n)if(r.getHiddenModifiedRange(void 0).contains(e)){r.showModifiedLine(e,t,o);return}}ensureOriginalLineIsVisible(e,t,o){if(this.diff.get()?.mappings.length===0)return;let n=this._unchangedRegions.get()?.regions||[];for(let r of n)if(r.getHiddenOriginalRange(void 0).contains(e)){r.showOriginalLine(e,t,o);return}}async waitForDiff(){await yh(this.isDiffUpToDate,e=>e,void 0,this._cancellationTokenSource.token).catch(bwe)}serializeState(){return{collapsedRegions:this._unchangedRegions.get()?.regions.map(t=>({range:t.getHiddenModifiedRange(void 0).serialize()}))}}restoreSerializedState(e){let t=e.collapsedRegions?.map(n=>vo.deserialize(n.range)),o=this._unchangedRegions.get();!o||!t||Ki(n=>{for(let r of o.regions)for(let s of t)if(r.modifiedUnchangedRange.intersect(s)){r.setHiddenModifiedRange(s,n);break}})}};$X=I([m(2,Cdi)],$X);function A5o(a,i,e){return{changes:a.changes.map(t=>new vv(t.original,t.modified,t.innerChanges?t.innerChanges.map(o=>N5o(o,i,e)):void 0)),moves:a.moves,identical:a.identical,quitEarly:a.quitEarly}}function N5o(a,i,e){let t=a.originalRange,o=a.modifiedRange;return t.startColumn===1&&o.startColumn===1&&(t.endColumn!==1||o.endColumn!==1)&&t.endColumn===i.getLineMaxColumn(t.endLineNumber)&&o.endColumn===e.getLineMaxColumn(o.endLineNumber)&&t.endLineNumber<i.getLineCount()&&o.endLineNumber<e.getLineCount()&&(t=t.setEndPosition(t.endLineNumber+1,1),o=o.setEndPosition(o.endLineNumber+1,1)),new lf(t,o)}var Pde=class a{constructor(i,e,t,o){this.mappings=i;this.movedTexts=e;this.identical=t;this.quitEarly=o}static fromDiffResult(i){return new a(i.changes.map(e=>new fQe(e)),i.moves||[],i.identical,i.quitEarly)}},fQe=class{constructor(i){this.lineRangeMapping=i}},jX=class a{constructor(i,e,t,o,n){this.originalLineNumber=i;this.modifiedLineNumber=e;this.lineCount=t;this._visibleLineCountTop=De(this,0);this.visibleLineCountTop=this._visibleLineCountTop;this._visibleLineCountBottom=De(this,0);this.visibleLineCountBottom=this._visibleLineCountBottom;this._shouldHideControls=ke(this,i=>this.visibleLineCountTop.read(i)+this.visibleLineCountBottom.read(i)===this.lineCount&&!this.isDragged.read(i));this.isDragged=De(this,void 0);let r=Math.max(Math.min(o,this.lineCount),0),s=Math.max(Math.min(n,this.lineCount-o),0);nii(o===r),nii(n===s),this._visibleLineCountTop.set(r,void 0),this._visibleLineCountBottom.set(s,void 0)}static fromDiffs(i,e,t,o,n){let r=vv.inverse(i,e,t),s=[];for(let l of r){let c=l.original.startLineNumber,u=l.modified.startLineNumber,p=l.original.length,h=c===1&&u===1,g=c+p===e+1&&u+p===t+1;(h||g)&&p>=n+o?(h&&!g&&(p-=n),g&&!h&&(c+=n,u+=n,p-=n),s.push(new a(c,u,p,0,0))):p>=n*2+o&&(c+=n,u+=n,p-=n*2,s.push(new a(c,u,p,0,0)))}return s}get originalUnchangedRange(){return vo.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return vo.ofLength(this.modifiedLineNumber,this.lineCount)}setVisibleRanges(i,e){let t=[],o=new EA(i.map(l=>l.modified)).subtractFrom(this.modifiedUnchangedRange),n=this.originalLineNumber,r=this.modifiedLineNumber,s=this.modifiedLineNumber+this.lineCount;if(o.ranges.length===0)this.showAll(e),t.push(this);else{let l=0;for(let c of o.ranges){let u=l===o.ranges.length-1;l++;let p=(u?s:c.endLineNumberExclusive)-r,h=new a(n,r,p,0,0);h.setHiddenModifiedRange(c,e),t.push(h),n=h.originalUnchangedRange.endLineNumberExclusive,r=h.modifiedUnchangedRange.endLineNumberExclusive}}return t}shouldHideControls(i){return this._shouldHideControls.read(i)}getHiddenOriginalRange(i){return vo.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(i),this.lineCount-this._visibleLineCountTop.read(i)-this._visibleLineCountBottom.read(i))}getHiddenModifiedRange(i){return vo.ofLength(this.modifiedLineNumber+this._visibleLineCountTop.read(i),this.lineCount-this._visibleLineCountTop.read(i)-this._visibleLineCountBottom.read(i))}setHiddenModifiedRange(i,e){let t=i.startLineNumber-this.modifiedLineNumber,o=this.modifiedLineNumber+this.lineCount-i.endLineNumberExclusive;this.setState(t,o,e)}getMaxVisibleLineCountTop(){return this.lineCount-this._visibleLineCountBottom.get()}getMaxVisibleLineCountBottom(){return this.lineCount-this._visibleLineCountTop.get()}showMoreAbove(i=10,e){let t=this.getMaxVisibleLineCountTop();this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+i,t),e)}showMoreBelow(i=10,e){let t=this.lineCount-this._visibleLineCountTop.get();this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+i,t),e)}showAll(i){this._visibleLineCountBottom.set(this.lineCount-this._visibleLineCountTop.get(),i)}showModifiedLine(i,e,t){let o=i+1-(this.modifiedLineNumber+this._visibleLineCountTop.get()),n=this.modifiedLineNumber-this._visibleLineCountBottom.get()+this.lineCount-i;e===0&&o<n||e===1?this._visibleLineCountTop.set(this._visibleLineCountTop.get()+o,t):this._visibleLineCountBottom.set(this._visibleLineCountBottom.get()+n,t)}showOriginalLine(i,e,t){let o=i-this.originalLineNumber,n=this.originalLineNumber+this.lineCount-i;e===0&&o<n||e===1?this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+n-o,this.getMaxVisibleLineCountTop()),t):this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+o-n,this.getMaxVisibleLineCountBottom()),t)}collapseAll(i){this._visibleLineCountTop.set(0,i),this._visibleLineCountBottom.set(0,i)}setState(i,e,t){i=Math.max(Math.min(i,this.lineCount),0),e=Math.max(Math.min(e,this.lineCount-i),0),this._visibleLineCountTop.set(i,t),this._visibleLineCountBottom.set(e,t)}};function zZi(a){let{domNode:i,renderLinesResult:e,diffEntry:t,originalModel:o,clipboardService:n}=a,r=new O;return r.add($(i,"copy",s=>{s.preventDefault();let l=i.ownerDocument.getSelection();if(!l||l.rangeCount===0)return;let c=l.getRangeAt(0);if(!c||c.collapsed)return;let u=c.startContainer.nodeType===Node.TEXT_NODE?c.startContainer.parentElement:c.startContainer,p=c.endContainer.nodeType===Node.TEXT_NODE?c.endContainer.parentElement:c.endContainer;if(!u||!p)return;let h=e.getModelPositionAt(u,c.startOffset),g=e.getModelPositionAt(p,c.endOffset);if(!h||!g)return;let f=h.delta(t.original.startLineNumber-1),v=g.delta(t.original.startLineNumber-1),b=v.isBefore(f)?G.fromPositions(v,f):G.fromPositions(f,v),S=o.getValueInRange(b);n.writeText(S)})),r}var pkt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._getViewZoneId=e;this._marginDomNode=t;this._deletedCodeDomNode=o;this._modifiedEditor=n;this._diff=r;this._editor=s;this._renderLinesResult=l;this._originalTextModel=c;this._contextMenuService=u;this._clipboardService=p;this._visibility=!1;this._marginDomNode.style.zIndex="10",this._diffActions=document.createElement("div"),this._diffActions.className=q.asClassName(L.lightBulb)+" lightbulb-glyph",this._diffActions.style.position="absolute";let h=this._modifiedEditor.getOption(75);this._diffActions.style.right="0px",this._diffActions.style.visibility="hidden",this._diffActions.style.height=`${h}px`,this._diffActions.style.lineHeight=`${h}px`,this._marginDomNode.appendChild(this._diffActions);let g=0,f=n.getOption(144)&&!Tc,v=(b,S,y)=>{this._contextMenuService.showContextMenu({domForShadowRoot:f?n.getDomNode()??void 0:void 0,getAnchor:()=>b,onHide:y,getActions:()=>{let w=S??[],x=r.modified.isEmpty;return w.push(new it("diff.clipboard.copyDeletedContent",x?r.original.length>1?d(239,null):d(240,null):r.original.length>1?d(236,null):d(237,null),void 0,!0,async()=>{let M=this._originalTextModel.getValueInRange(r.original.toExclusiveRange());await this._clipboardService.writeText(M)})),r.original.length>1&&w.push(new it("diff.clipboard.copyDeletedLineContent",x?d(238,null,r.original.startLineNumber+g):d(235,null,r.original.startLineNumber+g),void 0,!0,async()=>{let M=this._originalTextModel.getLineContent(r.original.startLineNumber+g);M===""&&(M=this._originalTextModel.getEndOfLineSequence()===0?`
`:`\r
`),await this._clipboardService.writeText(M)})),n.getOption(104)||w.push(new it("diff.inline.revertChange",d(241,null),void 0,!0,async()=>{this._editor.revert(this._diff)})),w},autoSelectFirstItem:!0})};this._register(Yo(this._diffActions,"mousedown",b=>{if(!b.leftButton)return;let{top:S,height:y}=ur(this._diffActions),w=Math.floor(h/3);b.preventDefault(),v({x:b.posx,y:S+y+w})})),this._register(n.onMouseMove(b=>{(b.target.type===8||b.target.type===5)&&b.target.detail.viewZoneId===this._getViewZoneId()?(g=this._updateLightBulbPosition(this._marginDomNode,b.event.browserEvent.y,h),this.visibility=!0):this.visibility=!1})),this._register(zZi({domNode:this._deletedCodeDomNode,diffEntry:r,originalModel:this._originalTextModel,renderLinesResult:this._renderLinesResult,clipboardService:p}))}get visibility(){return this._visibility}set visibility(e){this._visibility!==e&&(this._visibility=e,this._diffActions.style.visibility=e?"visible":"hidden")}_updateLightBulbPosition(e,t,o){let{top:n}=ur(e),r=t-n,s=Math.floor(r/o),l=s*o;if(this._diffActions.style.top=`${l}px`,this._renderLinesResult.viewLineCounts){let c=0;for(let u=0;u<this._renderLinesResult.viewLineCounts.length;u++)if(c+=this._renderLinesResult.viewLineCounts[u],s<c)return u}return s}};var KZi=zf("diffEditorWidget",{createHTML:a=>a});function oM(a,i,e,t,o=!1){ku(t,i.fontInfo);let n=e.length>0,r=new EI(1e4),s=0,l=0,c=[],u=[];for(let f=0;f<a.lineTokens.length;f++){let v=f+1,b=a.lineTokens[f],S=a.lineBreakData[f],y=Wb.filter(e,v,1,Number.MAX_SAFE_INTEGER);if(S){let w=0;for(let x of S.breakOffsets){let E=b.sliceAndInflate(w,x,0),M=GZi(l,E,Wb.extractWrapped(y,w,x),n,a.mightContainNonBasicASCII,a.mightContainRTL,i,r,o);s=Math.max(s,M.maxCharWidth),u.push(new mkt(M.output.characterMapping,M.output.containsForeignElements,w)),l++,w=x}c.push(S.breakOffsets.length)}else{c.push(1);let w=GZi(l,b,y,n,a.mightContainNonBasicASCII,a.mightContainRTL,i,r,o);s=Math.max(s,w.maxCharWidth),u.push(new mkt(w.output.characterMapping,w.output.containsForeignElements,0)),l++}}s+=i.scrollBeyondLastColumn;let p=r.build(),h=KZi?KZi.createHTML(p):p;t.innerHTML=h;let g=s*i.typicalHalfwidthCharacterWidth;return new xdi(l,g,c,u,a)}var AT=class{constructor(i,e=i.map(n=>null),t=!0,o=!0){this.lineTokens=i;this.lineBreakData=e;this.mightContainNonBasicASCII=t;this.mightContainRTL=o}},NT=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g=!0){this.tabSize=i;this.fontInfo=e;this.disableMonospaceOptimizations=t;this.typicalHalfwidthCharacterWidth=o;this.scrollBeyondLastColumn=n;this.lineHeight=r;this.lineDecorationsWidth=s;this.stopRenderingLineAfter=l;this.renderWhitespace=c;this.renderControlCharacters=u;this.fontLigatures=p;this.verticalScrollbarSize=h;this.setWidth=g}static fromEditor(i){let e=i.getOptions(),t=e.get(59),o=e.get(165);return new a(i.getModel()?.getOptions().tabSize||0,t,e.get(40),t.typicalHalfwidthCharacterWidth,e.get(118),e.get(75),o.decorationsWidth,e.get(133),e.get(113),e.get(108),e.get(60),e.get(117).verticalScrollbarSize)}withSetWidth(i){return new a(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,this.scrollBeyondLastColumn,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,i)}withScrollBeyondLastColumn(i){return new a(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,i,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,this.setWidth)}},xdi=class{constructor(i,e,t,o,n){this.heightInLines=i;this.minWidthInPx=e;this.viewLineCounts=t;this._renderOutputs=o;this._source=n}getModelPositionAt(i,e){let t=i;for(;t&&!t.classList.contains("view-line");)t=t.parentElement;if(!t)return;let o=t.parentElement;if(!o)return;let n=o.querySelectorAll(".view-line"),r=-1;for(let p=0;p<n.length;p++)if(n[p]===t){r=p;break}if(r===-1||r>=this._renderOutputs.length)return;let s=1,l=r;for(let p=0;p<this.viewLineCounts.length;p++){if(l<this.viewLineCounts[p]){s=p+1;break}l-=this.viewLineCounts[p]}if(s>this._source.lineTokens.length)return;let c=this._renderOutputs[r];if(!c)return;let u=L5(c.characterMapping,i,e)+c.offset;return new ye(s,u)}},mkt=class extends Qce{constructor(e,t,o){super(e,t);this.offset=o}};function GZi(a,i,e,t,o,n,r,s,l){s.appendString('<div class="view-line'),!l&&!t&&s.appendString(" char-delete"),s.appendString('" style="top:'),s.appendString(String(a*r.lineHeight)),r.setWidth?s.appendString('px;width:1000000px;">'):s.appendString('px;">');let c=i.getLineContent(),u=dK.isBasicASCII(c,o),p=dK.containsRTL(c,u,n),h=NB(new KL(r.fontInfo.isMonospace&&!r.disableMonospaceOptimizations,r.fontInfo.canUseHalfwidthRightwardsArrow,c,!1,u,p,0,i,e,r.tabSize,0,r.fontInfo.spaceWidth,r.fontInfo.middotWidth,r.fontInfo.wsmiddotWidth,r.stopRenderingLineAfter,r.renderWhitespace,r.renderControlCharacters,r.fontLigatures!==Mk.OFF,null,null,r.verticalScrollbarSize),s);s.appendString("</div>");let g=h.characterMapping.getHorizontalOffset(h.characterMapping.length);return{output:h,maxCharWidth:g}}var Bi=le("clipboardService");var qn=le("contextViewService"),Xe=le("contextMenuService");var Pke=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._targetWindow=e;this._editors=t;this._diffModel=o;this._options=n;this._diffEditorWidget=r;this._canIgnoreViewZoneUpdateEvent=s;this._origViewZonesToIgnore=l;this._modViewZonesToIgnore=c;this._clipboardService=u;this._contextMenuService=p;this._originalTopPadding=De(this,0),this._originalScrollOffset=De(this,0),this._originalScrollOffsetAnimated=cdi(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=De(this,0),this._modifiedScrollOffset=De(this,0),this._modifiedScrollOffsetAnimated=cdi(this._targetWindow,this._modifiedScrollOffset,this._store);let h=De("invalidateAlignmentsState",0),g=this._register(new Dt(()=>{h.set(h.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(x=>{this._canIgnoreViewZoneUpdateEvent()||g.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(x=>{this._canIgnoreViewZoneUpdateEvent()||g.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(x=>{(x.hasChanged(166)||x.hasChanged(75))&&g.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(x=>{(x.hasChanged(166)||x.hasChanged(75))&&g.schedule()}));let f=this._diffModel.map(x=>x?vi(this,x.model.original.onDidChangeTokens,()=>x.model.original.tokenization.backgroundTokenizationState===2):void 0).map((x,E)=>x?.read(E)),v=ke(x=>{let E=this._diffModel.read(x),M=E?.diff.read(x);if(!E||!M)return null;h.read(x);let V=this._options.renderSideBySide.read(x);return qZi(this._editors.original,this._editors.modified,M.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,V)}),b=ke(x=>{let E=this._diffModel.read(x)?.movedTextToCompare.read(x);if(!E)return null;h.read(x);let M=E.changes.map(N=>new fQe(N));return qZi(this._editors.original,this._editors.modified,M,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function S(){let x=document.createElement("div");return x.className="diagonal-fill",x}let y=this._register(new O);this.viewZones=ke(this,x=>{y.clear();let E=v.read(x)||[],M=[],N=[],V=this._modifiedTopPadding.read(x);V>0&&N.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:V,showInHiddenAreas:!0,suppressMouseDown:!0});let H=this._originalTopPadding.read(x);H>0&&M.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:H,showInHiddenAreas:!0,suppressMouseDown:!0});let K=this._options.renderSideBySide.read(x),j={getLineContent:Ee=>this._editors.original.getModel().getLineContent(Ee),getLineInjectedText:Ee=>null},J=K?void 0:this._editors.modified._getViewModel()?.createLineBreaksComputer(j);if(J){let Ee=this._editors.original.getModel();for(let Te of E)if(Te.diff)for(let It=Te.originalRange.startLineNumber;It<Te.originalRange.endLineNumberExclusive;It++){if(It>Ee.getLineCount())return{orig:M,mod:N};J?.addRequest(It,null)}}let se=J?.finalize()??[],ae=0,ce=this._editors.modified.getOption(75),Se=this._diffModel.read(x)?.movedTextToCompare.read(x),Re=this._editors.original.getModel()?.mightContainNonBasicASCII()??!1,xe=this._editors.original.getModel()?.mightContainRTL()??!1,He=NT.fromEditor(this._editors.modified);for(let Ee of E)if(Ee.diff&&!K&&(!this._options.useTrueInlineDiffRendering.read(x)||!bQe(Ee.diff))){if(!Ee.originalRange.isEmpty){f.read(x);let It=document.createElement("div");It.classList.add("view-lines","line-delete","line-delete-selectable","monaco-mouse-cursor-text");let tt=this._editors.original.getModel();if(Ee.originalRange.endLineNumberExclusive-1>tt.getLineCount())return{orig:M,mod:N};let Oi=new AT(Ee.originalRange.mapToLineArray(_i=>tt.tokenization.getLineTokens(_i)),Ee.originalRange.mapToLineArray(_i=>se[ae++]),Re,xe),zt=[];for(let _i of Ee.diff.innerChanges||[])zt.push(new wT(_i.originalRange.delta(-(Ee.diff.original.startLineNumber-1)),c4.className,0));let mo=oM(Oi,He,zt,It),dn=document.createElement("div");if(dn.className="inline-deleted-margin-view-zone",ku(dn,He.fontInfo),this._options.renderIndicators.read(x))for(let _i=0;_i<mo.heightInLines;_i++){let ln=document.createElement("div");ln.className=`delete-sign ${q.asClassName(bdi)}`,ln.setAttribute("style",`position:absolute;top:${_i*ce}px;width:${He.lineDecorationsWidth}px;height:${ce}px;right:0;`),dn.appendChild(ln)}let No;y.add(new pkt(()=>Ti(No),dn,It,this._editors.modified,Ee.diff,this._diffEditorWidget,mo,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let _i=0;_i<mo.viewLineCounts.length;_i++){let ln=mo.viewLineCounts[_i];ln>1&&M.push({afterLineNumber:Ee.originalRange.startLineNumber+_i,domNode:S(),heightInPx:(ln-1)*ce,showInHiddenAreas:!0,suppressMouseDown:!0})}N.push({afterLineNumber:Ee.modifiedRange.startLineNumber-1,domNode:It,heightInPx:mo.heightInLines*ce,minWidthInPx:mo.minWidthInPx,marginDomNode:dn,setZoneId(_i){No=_i},showInHiddenAreas:!0,suppressMouseDown:!1})}let Te=document.createElement("div");Te.className="gutter-delete",M.push({afterLineNumber:Ee.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Ee.modifiedHeightInPx,marginDomNode:Te,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Te=Ee.modifiedHeightInPx-Ee.originalHeightInPx;if(Te>0){if(Se?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(Ee.originalRange.endLineNumberExclusive-1))continue;M.push({afterLineNumber:Ee.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Te,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let It=function(){let Oi=document.createElement("div");return Oi.className="arrow-revert-change "+q.asClassName(L.arrowRight),x.store.add($(Oi,"mousedown",zt=>zt.stopPropagation())),x.store.add($(Oi,"click",zt=>{zt.stopPropagation(),r.revert(Ee.diff)})),_("div",{},Oi)};if(Se?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(Ee.modifiedRange.endLineNumberExclusive-1))continue;let tt;Ee.diff&&Ee.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(x)&&(tt=It()),N.push({afterLineNumber:Ee.modifiedRange.endLineNumberExclusive-1,domNode:S(),heightInPx:-Te,marginDomNode:tt,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(let Ee of b.read(x)??[]){if(!Se?.lineRangeMapping.original.intersect(Ee.originalRange)||!Se?.lineRangeMapping.modified.intersect(Ee.modifiedRange))continue;let Te=Ee.modifiedHeightInPx-Ee.originalHeightInPx;Te>0?M.push({afterLineNumber:Ee.originalRange.endLineNumberExclusive-1,domNode:S(),heightInPx:Te,showInHiddenAreas:!0,suppressMouseDown:!0}):N.push({afterLineNumber:Ee.modifiedRange.endLineNumberExclusive-1,domNode:S(),heightInPx:-Te,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:M,mod:N}});let w=!1;this._register(this._editors.original.onDidScrollChange(x=>{x.scrollLeftChanged&&!w&&(w=!0,this._editors.modified.setScrollLeft(x.scrollLeft),w=!1)})),this._register(this._editors.modified.onDidScrollChange(x=>{x.scrollLeftChanged&&!w&&(w=!0,this._editors.original.setScrollLeft(x.scrollLeft),w=!1)})),this._originalScrollTop=vi(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=vi(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(ve(x=>{let E=this._originalScrollTop.read(x)-(this._originalScrollOffsetAnimated.read(void 0)-this._modifiedScrollOffsetAnimated.read(x))-(this._originalTopPadding.read(void 0)-this._modifiedTopPadding.read(x));E!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(E,1)})),this._register(ve(x=>{let E=this._modifiedScrollTop.read(x)-(this._modifiedScrollOffsetAnimated.read(void 0)-this._originalScrollOffsetAnimated.read(x))-(this._modifiedTopPadding.read(void 0)-this._originalTopPadding.read(x));E!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(E,1)})),this._register(ve(x=>{let E=this._diffModel.read(x)?.movedTextToCompare.read(x),M=0;if(E){let N=this._editors.original.getTopForLineNumber(E.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.read(void 0);M=this._editors.modified.getTopForLineNumber(E.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.read(void 0)-N}M>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(M,void 0)):M<0?(this._modifiedTopPadding.set(-M,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.read(void 0)-M,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.read(void 0)+M,void 0,!0)}))}};Pke=I([m(8,Bi),m(9,Xe)],Pke);function qZi(a,i,e,t,o,n){let r=new nT($Zi(a,t)),s=new nT($Zi(i,o)),l=a.getOption(75),c=i.getOption(75),u=[],p=0,h=0;function g(f,v){for(;;){let b=r.peek(),S=s.peek();if(b&&b.lineNumber>=f&&(b=void 0),S&&S.lineNumber>=v&&(S=void 0),!b&&!S)break;let y=b?b.lineNumber-p:Number.MAX_VALUE,w=S?S.lineNumber-h:Number.MAX_VALUE;y<w?(r.dequeue(),S={lineNumber:b.lineNumber-p+h,heightInPx:0}):y>w?(s.dequeue(),b={lineNumber:S.lineNumber-h+p,heightInPx:0}):(r.dequeue(),s.dequeue()),u.push({originalRange:vo.ofLength(b.lineNumber,1),modifiedRange:vo.ofLength(S.lineNumber,1),originalHeightInPx:l+b.heightInPx,modifiedHeightInPx:c+S.heightInPx,diff:void 0})}}for(let f of e){let w=function(x,E,M=!1){if(x<y||E<S)return;if(b)b=!1;else if(!M&&(x===y||E===S))return;let N=new vo(y,x),V=new vo(S,E);if(N.isEmpty&&V.isEmpty)return;let H=r.takeWhile(j=>j.lineNumber<x)?.reduce((j,J)=>j+J.heightInPx,0)??0,K=s.takeWhile(j=>j.lineNumber<E)?.reduce((j,J)=>j+J.heightInPx,0)??0;u.push({originalRange:N,modifiedRange:V,originalHeightInPx:N.length*l+H,modifiedHeightInPx:V.length*c+K,diff:f.lineRangeMapping}),y=x,S=E},v=f.lineRangeMapping;g(v.original.startLineNumber,v.modified.startLineNumber);let b=!0,S=v.modified.startLineNumber,y=v.original.startLineNumber;if(n)for(let x of v.innerChanges||[]){x.originalRange.startColumn>1&&x.modifiedRange.startColumn>1&&w(x.originalRange.startLineNumber,x.modifiedRange.startLineNumber);let E=a.getModel(),M=x.originalRange.endLineNumber<=E.getLineCount()?E.getLineMaxColumn(x.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;x.originalRange.endColumn<M&&w(x.originalRange.endLineNumber,x.modifiedRange.endLineNumber)}w(v.original.endLineNumberExclusive,v.modified.endLineNumberExclusive,!0),p=v.original.endLineNumberExclusive,h=v.modified.endLineNumberExclusive}return g(Number.MAX_VALUE,Number.MAX_VALUE),u}function $Zi(a,i){let e=[],t=[],o=a.getOption(166).wrappingColumn!==-1,n=a._getViewModel().coordinatesConverter,r=a.getOption(75);if(o)for(let l=1;l<=a.getModel().getLineCount();l++){let c=n.getModelLineViewLineCount(l);c>1&&t.push({lineNumber:l,heightInPx:r*(c-1)})}for(let l of a.getWhitespaces()){if(i.has(l.id))continue;let c=l.afterLineNumber===0?0:n.convertViewPositionToModelPosition(new ye(l.afterLineNumber,1)).lineNumber;e.push({lineNumber:c,heightInPx:l.height})}return MZi(e,t,l=>l.lineNumber,(l,c)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+c.heightInPx}))}function bQe(a){return a.innerChanges?a.innerChanges.every(i=>vQe(i.modifiedRange)&&vQe(i.originalRange)||i.originalRange.equalsRange(new G(1,1,1,1))):!1}function vQe(a){return a.startLineNumber===a.endLineNumber}var QX=class a extends k{constructor(e,t,o,n,r){super();this._rootElement=e;this._diffModel=t;this._originalEditorLayoutInfo=o;this._modifiedEditorLayoutInfo=n;this._editors=r;this._originalScrollTop=vi(this,this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=vi(this,this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._viewZonesChanged=qr("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=De(this,0),this._modifiedViewZonesChangedSignal=qr("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=qr("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=ke(this,p=>{this._element.replaceChildren();let h=this._diffModel.read(p),g=h?.diff.read(p)?.movedTexts;if(!g||g.length===0){this.width.set(0,void 0);return}this._viewZonesChanged.read(p);let f=this._originalEditorLayoutInfo.read(p),v=this._modifiedEditorLayoutInfo.read(p);if(!f||!v){this.width.set(0,void 0);return}this._modifiedViewZonesChangedSignal.read(p),this._originalViewZonesChangedSignal.read(p);let b=g.map(N=>{function V(Re,xe){let He=xe.getTopForLineNumber(Re.startLineNumber,!0),Ee=xe.getTopForLineNumber(Re.endLineNumberExclusive,!0);return(He+Ee)/2}let H=V(N.lineRangeMapping.original,this._editors.original),K=this._originalScrollTop.read(p),j=V(N.lineRangeMapping.modified,this._editors.modified),J=this._modifiedScrollTop.read(p),se=H-K,ae=j-J,ce=Math.min(H,j),Se=Math.max(H,j);return{range:new gi(ce,Se),from:se,to:ae,fromWithoutScroll:H,toWithoutScroll:j,move:N}});b.sort(Ivt(Il(N=>N.fromWithoutScroll>N.toWithoutScroll,yvt),Il(N=>N.fromWithoutScroll>N.toWithoutScroll?N.fromWithoutScroll:-N.toWithoutScroll,Hu)));let S=kdi.compute(b.map(N=>N.range)),y=10,w=f.verticalScrollbarWidth,x=(S.getTrackCount()-1)*10+y*2,E=w+x+(v.contentLeft-a.movedCodeBlockPadding),M=0;for(let N of b){let V=S.getTrack(M),H=w+y+V*10,K=15,j=15,J=E,se=v.glyphMarginWidth+v.lineNumbersWidth,ae=18,ce=document.createElementNS("http://www.w3.org/2000/svg","rect");ce.classList.add("arrow-rectangle"),ce.setAttribute("x",`${J-se}`),ce.setAttribute("y",`${N.to-ae/2}`),ce.setAttribute("width",`${se}`),ce.setAttribute("height",`${ae}`),this._element.appendChild(ce);let Se=document.createElementNS("http://www.w3.org/2000/svg","g"),Re=document.createElementNS("http://www.w3.org/2000/svg","path");Re.setAttribute("d",`M 0 ${N.from} L ${H} ${N.from} L ${H} ${N.to} L ${J-j} ${N.to}`),Re.setAttribute("fill","none"),Se.appendChild(Re);let xe=document.createElementNS("http://www.w3.org/2000/svg","polygon");xe.classList.add("arrow"),p.store.add(ve(He=>{Re.classList.toggle("currentMove",N.move===h.activeMovedText.read(He)),xe.classList.toggle("currentMove",N.move===h.activeMovedText.read(He))})),xe.setAttribute("points",`${J-j},${N.to-K/2} ${J},${N.to} ${J-j},${N.to+K/2}`),Se.appendChild(xe),this._element.appendChild(Se),M++}this.width.set(x,void 0)}),this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("class","moved-blocks-lines"),this._rootElement.appendChild(this._element),this._register(ee(()=>this._element.remove())),this._register(ve(p=>{let h=this._originalEditorLayoutInfo.read(p),g=this._modifiedEditorLayoutInfo.read(p);!h||!g||(this._element.style.left=`${h.width-h.verticalScrollbarWidth}px`,this._element.style.height=`${h.height}px`,this._element.style.width=`${h.verticalScrollbarWidth+h.contentLeft-a.movedCodeBlockPadding+this.width.read(p)}px`)})),this._register(bA(this._state));let s=ke(p=>{let g=this._diffModel.read(p)?.diff.read(p);return g?g.movedTexts.map(f=>({move:f,original:new OK(Fo(f.lineRangeMapping.original.startLineNumber-1),18),modified:new OK(Fo(f.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(_ke(this._editors.original,s.map(p=>p.map(h=>h.original)))),this._register(_ke(this._editors.modified,s.map(p=>p.map(h=>h.modified)))),this._register(Rl((p,h)=>{let g=s.read(p);for(let f of g)h.add(new hkt(this._editors.original,f.original,f.move,"original",this._diffModel.get())),h.add(new hkt(this._editors.modified,f.modified,f.move,"modified",this._diffModel.get()))}));let l=qr("original.onDidFocusEditorWidget",p=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>p(void 0),0))),c=qr("modified.onDidFocusEditorWidget",p=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>p(void 0),0))),u="modified";this._register(fA({changeTracker:{createChangeSummary:()=>{},handleChange:(p,h)=>(p.didChange(l)&&(u="original"),p.didChange(c)&&(u="modified"),!0)}},p=>{l.read(p),c.read(p);let h=this._diffModel.read(p);if(!h)return;let g=h.diff.read(p),f;if(g&&u==="original"){let v=this._editors.originalCursor.read(p);v&&(f=g.movedTexts.find(b=>b.lineRangeMapping.original.contains(v.lineNumber)))}if(g&&u==="modified"){let v=this._editors.modifiedCursor.read(p);v&&(f=g.movedTexts.find(b=>b.lineRangeMapping.modified.contains(v.lineNumber)))}f!==h.movedTextToCompare.read(void 0)&&h.movedTextToCompare.set(void 0,void 0),h.setActiveMovedText(f)}))}static{this.movedCodeBlockPadding=4}},kdi=class a{constructor(i,e){this._trackCount=i;this.trackPerLineIdx=e}static compute(i){let e=[],t=[];for(let o of i){let n=e.findIndex(r=>!r.intersectsStrict(o));n===-1&&(e.length>=6?n=H4i(e,Il(s=>s.intersectWithRangeLength(o),Hu)):(n=e.length,e.push(new USt))),e[n].addRange(o),t.push(n)}return new a(e.length,t)}getTrack(i){return this.trackPerLineIdx[i]}getTrackCount(){return this._trackCount}},hkt=class extends Rde{constructor(e,t,o,n,r){let s=st("div.diff-hidden-lines-widget");super(e,t,s.root);this._editor=e;this._move=o;this._kind=n;this._diffModel=r;this._nodes=st("div.diff-moved-code-block",{style:{marginRight:"4px"}},[st("div.text-content@textContent"),st("div.action-bar@actionBar")]);s.root.appendChild(this._nodes.root);let l=vi(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(NA(this._nodes.root,{paddingRight:l.map(g=>g.verticalScrollbarWidth)}));let c;o.changes.length>0?c=this._kind==="original"?d(256,null,this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):d(254,null,this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1):c=this._kind==="original"?d(255,null,this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):d(253,null,this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1);let u=this._register(new oo(this._nodes.actionBar,{highlightToggledItems:!0})),p=new it("",c,"",!1);u.push(p,{icon:!1,label:!0});let h=new it("","Compare",q.asClassName(L.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===o?void 0:this._move,void 0)});this._register(ve(g=>{let f=this._diffModel.movedTextToCompare.read(g)===o;h.checked=f})),u.push(h,{icon:!1,label:!0})}};var gkt=class extends k{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._decorations=ke(this,e=>{let t=this._diffModel.read(e),o=t?.diff.read(e);if(!o)return null;let n=this._diffModel.read(e).movedTextToCompare.read(e),r=this._options.renderIndicators.read(e),s=this._options.showEmptyDecorations.read(e),l=[],c=[];if(!n)for(let p of o.mappings)if(p.lineRangeMapping.original.isEmpty||l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:r?Idi:wdi}),p.lineRangeMapping.modified.isEmpty||c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:r?Sdi:ydi}),p.lineRangeMapping.modified.isEmpty||p.lineRangeMapping.original.isEmpty)p.lineRangeMapping.original.isEmpty||l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:HZi}),p.lineRangeMapping.modified.isEmpty||c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:Mke});else{let h=this._options.useTrueInlineDiffRendering.read(e)&&bQe(p.lineRangeMapping);for(let g of p.lineRangeMapping.innerChanges||[])if(p.lineRangeMapping.original.contains(g.originalRange.startLineNumber)&&l.push({range:g.originalRange,options:g.originalRange.isEmpty()&&s?UZi:c4}),p.lineRangeMapping.modified.contains(g.modifiedRange.startLineNumber)&&c.push({range:g.modifiedRange,options:g.modifiedRange.isEmpty()&&s&&!h?BZi:Mde}),h){let f=t.model.original.getValueInRange(g.originalRange);c.push({range:g.modifiedRange,options:{description:"deleted-text",before:{content:f,inlineClassName:"inline-deleted-text"},zIndex:1e5,showIfCollapsed:!0}})}}if(n)for(let p of n.changes){let h=p.original.toInclusiveRange();h&&l.push({range:h,options:r?Idi:wdi});let g=p.modified.toInclusiveRange();g&&c.push({range:g,options:r?Sdi:ydi});for(let f of p.innerChanges||[])l.push({range:f.originalRange,options:c4}),c.push({range:f.modifiedRange,options:Mde})}let u=this._diffModel.read(e).activeMovedText.read(e);for(let p of o.movedTexts)l.push({range:p.lineRangeMapping.original.toInclusiveRange(),options:{description:"moved",blockClassName:"movedOriginal"+(p===u?" currentMove":""),blockPadding:[QX.movedCodeBlockPadding,0,QX.movedCodeBlockPadding,QX.movedCodeBlockPadding]}}),c.push({range:p.lineRangeMapping.modified.toInclusiveRange(),options:{description:"moved",blockClassName:"movedModified"+(p===u?" currentMove":""),blockPadding:[4,0,4,4]}});return{originalDecorations:l,modifiedDecorations:c}});this._register(Tke(this._editors.original,this._decorations.map(r=>r?.originalDecorations||[]))),this._register(Tke(this._editors.modified,this._decorations.map(r=>r?.modifiedDecorations||[])))}};var Mg=class a{constructor(i,e){this.x=i;this.y=e}static equals(i,e){return i.x===e.x&&i.y===e.y}add(i){return new a(this.x+i.x,this.y+i.y)}deltaX(i){return new a(this.x+i,this.y)}deltaY(i){return new a(this.x,this.y+i)}toString(){return`(${this.x},${this.y})`}subtract(i){return new a(this.x-i.x,this.y-i.y)}scale(i){return new a(this.x*i,this.y*i)}mapComponents(i){return new a(i(this.x),i(this.y))}isZero(){return this.x===0&&this.y===0}withThreshold(i){return this.mapComponents(e=>e>i?e-i:e<-i?e+i:0)}};function Ds(a){return Edi.get(a)}var Edi=class a extends k{constructor(e){super();this.editor=e;this._sawZeroLineWidth=!1;this._onDidContainerResize=Mb({owner:this,getTransaction:()=>this._currentTransaction},e=>{let t=this.editor.getContainerDomNode(),o=new ResizeObserver(()=>{this._sawZeroLineWidth&&(this._sawZeroLineWidth=!1,this.editor.resetLineWidthCaches()),e(void 0)});return o.observe(t),{dispose:()=>o.disconnect()}},()=>({}));this._updateCounter=0,this._currentTransaction=void 0,this._model=De(this,this.editor.getModel()),this.model=this._model,this.isReadonly=Mb({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidChangeConfiguration,()=>this.editor.getOption(104)),this._versionId=Xm({owner:this,lazy:!0},this.editor.getModel()?.getVersionId()??null),this.versionId=this._versionId,this._selections=Xm({owner:this,equalsFn:_z(rF(ei.selectionsEqual)),lazy:!0},this.editor.getSelections()??null),this.selections=this._selections,this.positions=Js({owner:this,equalsFn:_z(rF(ye.equals))},t=>this.selections.read(t)?.map(o=>o.getStartPosition())??null),this.isFocused=Mb({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidFocusEditorWidget(t),n=this.editor.onDidBlurEditorWidget(t);return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.hasWidgetFocus()),this.isTextFocused=Mb({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidFocusEditorText(t),n=this.editor.onDidBlurEditorText(t);return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.hasTextFocus()),this.inComposition=Mb({owner:this,getTransaction:()=>this._currentTransaction},t=>{let o=this.editor.onDidCompositionStart(()=>{t(void 0)}),n=this.editor.onDidCompositionEnd(()=>{t(void 0)});return{dispose(){o.dispose(),n.dispose()}}},()=>this.editor.inComposition),this.value=r5(this,t=>(this.versionId.read(t),this.model.read(t)?.getValue()??""),(t,o)=>{let n=this.model.get();n!==null&&t!==n.getValue()&&n.setValue(t)}),this.valueIsEmpty=ke(this,t=>(this.versionId.read(t),this.editor.getModel()?.getValueLength()===0)),this.cursorSelection=Js({owner:this,equalsFn:_z(ei.selectionsEqual)},t=>this.selections.read(t)?.[0]??null),this.cursorPosition=Js({owner:this,equalsFn:ye.equals},t=>this.selections.read(t)?.[0]?.getPosition()??null),this.cursorLineNumber=ke(this,t=>this.cursorPosition.read(t)?.lineNumber??null),this.onDidType=zc(this),this.onDidPaste=zc(this),this.scrollTop=Mb({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollTop()),this.scrollLeft=Mb({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidScrollChange,()=>this.editor.getScrollLeft()),this.layoutInfo=Mb({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidLayoutChange,()=>this.editor.getLayoutInfo()),this.layoutInfoContentLeft=this.layoutInfo.map(t=>t.contentLeft),this.layoutInfoDecorationsLeft=this.layoutInfo.map(t=>t.decorationsLeft),this.layoutInfoWidth=this.layoutInfo.map(t=>t.width),this.layoutInfoHeight=this.layoutInfo.map(t=>t.height),this.layoutInfoMinimap=this.layoutInfo.map(t=>t.minimap),this.layoutInfoVerticalScrollbarWidth=this.layoutInfo.map(t=>t.verticalScrollbarWidth),this.contentWidth=Mb({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentWidth()),this.contentHeight=Mb({owner:this,getTransaction:()=>this._currentTransaction},this.editor.onDidContentSizeChange,()=>this.editor.getContentHeight()),this._onDidChangeViewZones=qr(this,this.editor.onDidChangeViewZones),this._onDidHiddenAreasChanged=qr(this,this.editor.onDidChangeHiddenAreas),this._onDidLineHeightChanged=qr(this,this.editor.onDidChangeLineHeight),this._widgetCounter=0,this.openedPeekWidgets=De(this,0),this._register(this.editor.onBeginUpdate(()=>this._beginUpdate())),this._register(this.editor.onEndUpdate(()=>this._endUpdate())),this._register(this.editor.onDidChangeModel(()=>{this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidType(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidType.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidPaste(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidPaste.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeModelContent(t=>{this._beginUpdate();try{this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeCursorSelection(t=>{this._beginUpdate();try{this._selections.set(this.editor.getSelections(),this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this.domNode=ke(t=>(this.model.read(t),this.editor.getDomNode()))}static{this._map=new Map}static get(e){let t=a._map.get(e);if(!t){t=new a(e),a._map.set(e,t);let o=e.onDidDispose(()=>{let n=a._map.get(e);n&&(a._map.delete(e),n.dispose(),o.dispose())})}return t}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&(this._currentTransaction=new sF(()=>{}))}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){let e=this._currentTransaction;this._currentTransaction=void 0,e.finish()}}transaction(e){this._beginUpdate();try{return e(this._currentTransaction)}finally{this._endUpdate()}}forceUpdate(e){this._beginUpdate();try{return this._forceUpdate(),e?e(this._currentTransaction):void 0}finally{this._endUpdate()}}_forceUpdate(){this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,void 0),this._selections.set(this.editor.getSelections(),this._currentTransaction,void 0)}finally{this._endUpdate()}}getOption(e,t=Dl.ofCaller()){return vi(this,o=>this.editor.onDidChangeConfiguration(n=>{n.hasChanged(e)&&o(void 0)}),()=>this.editor.getOption(e),t)}setDecorations(e){let t=new O,o=this.editor.createDecorationsCollection();return t.add(dD({owner:this,debugName:()=>`Apply decorations from ${e.debugName}`},n=>{let r=e.read(n);o.set(r)})),t.add({dispose:()=>{o.clear()}}),t}createOverlayWidget(e){let t="observableOverlayWidget"+this._widgetCounter++,o={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow,getMinContentWidthInPx:()=>e.minContentWidthInPx.get()};this.editor.addOverlayWidget(o);let n=ve(r=>{e.position.read(r),e.minContentWidthInPx.read(r),this.editor.layoutOverlayWidget(o)});return ee(()=>{n.dispose(),this.editor.removeOverlayWidget(o)})}createContentWidget(e){let t="observableContentWidget"+this._widgetCounter++,o={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow};this.editor.addContentWidget(o);let n=ve(r=>{e.position.read(r),this.editor.layoutContentWidget(o)});return ee(()=>{n.dispose(),this.editor.removeContentWidget(o)})}observeLineOffsetRange(e,t){let o=this.observePosition(e.map(r=>new ye(r.startLineNumber,1)),t),n=this.observePosition(e.map(r=>new ye(r.endLineNumberExclusive+1,1)),t);return ke(r=>{o.read(r),n.read(r);let s=e.read(r),l=this.model.read(r)?.getLineCount(),c=(typeof l<"u"&&s.startLineNumber>l?this.editor.getBottomForLineNumber(l):this.editor.getTopForLineNumber(s.startLineNumber))-this.scrollTop.read(r),u=s.isEmpty?c:this.editor.getBottomForLineNumber(s.endLineNumberExclusive-1)-this.scrollTop.read(r);return new gi(c,u)})}getLeftOfPosition(e,t){this.layoutInfo.read(t),this.value.read(t);let o=this.editor.getOffsetForColumn(e.lineNumber,e.column);if(o===-1){let n=this.editor.getOption(59).typicalHalfwidthCharacterWidth;o=e.column*n}return o}observePosition(e,t){let o=e.get(),n=Xm({owner:this,debugName:()=>`topLeftOfPosition${o?.toString()}`,equalsFn:_z(Mg.equals)},new Mg(0,0)),r="observablePositionWidget"+this._widgetCounter++,s=document.createElement("div"),l={getDomNode:()=>s,getPosition:()=>o?{preference:[0],position:e.get()}:null,getId:()=>r,allowEditorOverflow:!1,useDisplayNone:!0,afterRender:(c,u)=>{let p=this._model.get();p&&o&&o.lineNumber>p.getLineCount()?n.set(new Mg(0,this.editor.getBottomForLineNumber(p.getLineCount())-this.scrollTop.get()),void 0):n.set(u?new Mg(u.left,u.top):null,void 0)}};return this.editor.addContentWidget(l),t.add(ve(c=>{o=e.read(c),this.editor.layoutContentWidget(l)})),t.add(ee(()=>{this.editor.removeContentWidget(l)})),n}isTargetHovered(e,t){let o=De("isInjectedTextHovered",!1);return t.add(this.editor.onMouseMove(n=>{let r=e(n);o.set(r,void 0)})),t.add(this.editor.onMouseLeave(n=>{o.set(!1,void 0)})),o}observeLineHeightForPosition(e){return ke(t=>{let o=e instanceof ye?e:e.read(t);return o===null?null:(this.getOption(75).read(t),this.editor.getLineHeightForPosition(o))})}observeLineHeightForLine(e){return typeof e=="number"?this.observeLineHeightForPosition(new ye(e,1)):ke(t=>{let o=e.read(t);return o===null?null:this.observeLineHeightForPosition(new ye(o,1)).read(t)})}observeLineHeightsForLineRange(e){return ke(t=>{let o=e instanceof vo?e:e.read(t),n=[];for(let r=o.startLineNumber;r<o.endLineNumberExclusive;r++)n.push(this.observeLineHeightForLine(r).read(t));return n})}getWidthOfLine(e,t){this.layoutInfo.read(t),this.value.read(t),this.scrollTop.read(t);let o=this.editor.getWidthOfLine(e);return this._onDidContainerResize.read(t),o===0&&(this._sawZeroLineWidth=!0),o}observeTopForLineNumber(e){return ke(t=>(this.layoutInfo.read(t),this._onDidChangeViewZones.read(t),this._onDidHiddenAreasChanged.read(t),this._onDidLineHeightChanged.read(t),this._versionId.read(t),this.editor.getTopForLineNumber(e)))}observeBottomForLineNumber(e){return ke(t=>(this.layoutInfo.read(t),this._onDidChangeViewZones.read(t),this._onDidHiddenAreasChanged.read(t),this._onDidLineHeightChanged.read(t),this._versionId.read(t),this.editor.getBottomForLineNumber(e)))}};var Ky=class extends k{constructor(e,t,o,n,r,s,l){super();this._editors=e;this._rootElement=t;this._diffModel=o;this._rootWidth=n;this._rootHeight=r;this._modifiedEditorLayoutInfo=s;this._themeService=l;this.width=Ky.ENTIRE_DIFF_OVERVIEW_WIDTH;let c=vi(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),u=ke(g=>{let f=c.read(g),v=f.getColor(QIt)||(f.getColor(_g)||RCe).transparent(2),b=f.getColor(YIt)||(f.getColor(df)||LCe).transparent(2);return{insertColor:v,removeColor:b}}),p=Ir(document.createElement("div"));p.setClassName("diffViewport"),p.setPosition("absolute");let h=st("div.diffOverview",{style:{position:"absolute",top:"0px",width:Ky.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register(l4(h,p.domNode)),this._register(Yo(h,ne.POINTER_DOWN,g=>{this._editors.modified.delegateVerticalScrollbarPointerDown(g)})),this._register($(h,ne.MOUSE_WHEEL,g=>{this._editors.modified.delegateScrollFromMouseWheelEvent(g)},{passive:!1})),this._register(l4(this._rootElement,h)),this._register(Rl((g,f)=>{let v=this._diffModel.read(g),b=this._editors.original.createOverviewRuler("original diffOverviewRuler");b&&(f.add(b),f.add(l4(h,b.getDomNode())));let S=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(S&&(f.add(S),f.add(l4(h,S.getDomNode()))),!b||!S)return;let y=qr("viewZoneChanged",this._editors.original.onDidChangeViewZones),w=qr("viewZoneChanged",this._editors.modified.onDidChangeViewZones),x=qr("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),E=qr("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);f.add(ve(M=>{y.read(M),w.read(M),x.read(M),E.read(M);let N=u.read(M),V=v?.diff.read(M)?.mappings;function H(J,se,ae){let ce=ae._getViewModel();return ce?J.filter(Se=>Se.length>0).map(Se=>{let Re=ce.coordinatesConverter.convertModelPositionToViewPosition(new ye(Se.startLineNumber,1)),xe=ce.coordinatesConverter.convertModelPositionToViewPosition(new ye(Se.endLineNumberExclusive,1)),He=xe.lineNumber-Re.lineNumber;return new e8e(Re.lineNumber,xe.lineNumber,He,se.toString())}):[]}let K=H((V||[]).map(J=>J.lineRangeMapping.original),N.removeColor,this._editors.original),j=H((V||[]).map(J=>J.lineRangeMapping.modified),N.insertColor,this._editors.modified);b?.setZones(K),S?.setZones(j)})),f.add(ve(M=>{let N=this._rootHeight.read(M),V=this._rootWidth.read(M),H=this._modifiedEditorLayoutInfo.read(M);if(H){let K=Ky.ENTIRE_DIFF_OVERVIEW_WIDTH-2*Ky.ONE_OVERVIEW_WIDTH;b.setLayout({top:0,height:N,right:K+Ky.ONE_OVERVIEW_WIDTH,width:Ky.ONE_OVERVIEW_WIDTH}),S.setLayout({top:0,height:N,right:0,width:Ky.ONE_OVERVIEW_WIDTH});let j=this._editors.modifiedScrollTop.read(M),J=this._editors.modifiedScrollHeight.read(M),se=this._editors.modified.getOption(117),ae=new hX(se.verticalHasArrows?se.arrowSize:0,se.verticalScrollbarSize,0,H.height,J,j);p.setTop(ae.getSliderPosition()),p.setHeight(ae.getSliderSize())}else p.setTop(0),p.setHeight(0);h.style.height=N+"px",h.style.left=V-Ky.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",p.setWidth(Ky.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}static{this.ONE_OVERVIEW_WIDTH=15}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=this.ONE_OVERVIEW_WIDTH*2}};Ky=I([m(6,Pe)],Ky);var Ake=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.originalEditorElement=e;this.modifiedEditorElement=t;this._options=o;this._argCodeEditorWidgetOptions=n;this._createInnerEditor=r;this._contextKeyService=s;this._instantiationService=l;this._keybindingService=c;this.original=this._register(this._createLeftHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.modifiedEditor||{})),this._onDidContentSizeChange=this._register(new T),this.modifiedScrollTop=vi(this,this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=vi(this,this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedObs=Ds(this.modified),this.originalObs=Ds(this.original),this.modifiedModel=this.modifiedObs.model,this.modifiedSelections=vi(this,this.modified.onDidChangeCursorSelection,()=>this.modified.getSelections()??[]),this.modifiedCursor=Js({owner:this,equalsFn:ye.equals},u=>this.modifiedSelections.read(u)[0]?.getPosition()??new ye(1,1)),this.originalCursor=vi(this,this.original.onDidChangeCursorPosition,()=>this.original.getPosition()??new ye(1,1)),this.isOriginalFocused=Ds(this.original).isFocused,this.isModifiedFocused=Ds(this.modified).isFocused,this.isFocused=ke(this,u=>this.isOriginalFocused.read(u)||this.isModifiedFocused.read(u)),this._argCodeEditorWidgetOptions=null,this._register(fA({changeTracker:{createChangeSummary:()=>({}),handleChange:(u,p)=>(u.didChange(o.editorOptions)&&Object.assign(p,u.change.changedOptions),!0)}},(u,p)=>{o.editorOptions.read(u),this._options.renderSideBySide.read(u),this.modified.updateOptions(this._adjustOptionsForRightHandSide(u,p)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(u,p))}))}get onDidContentSizeChange(){return this._onDidContentSizeChange.event}_createLeftHandSideEditor(e,t){let o=this._adjustOptionsForLeftHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,o,t),r=this._contextKeyService.createKey("isInDiffLeftEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>r.set(!0))),this._register(n.onDidBlurEditorWidget(()=>r.set(!1))),n}_createRightHandSideEditor(e,t){let o=this._adjustOptionsForRightHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,o,t),r=this._contextKeyService.createKey("isInDiffRightEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>r.set(!0))),this._register(n.onDidBlurEditorWidget(()=>r.set(!1))),n}_constructInnerEditor(e,t,o,n){let r=this._createInnerEditor(e,t,o,n);return this._register(r.onDidContentSizeChange(s=>{let l=this.original.getContentWidth()+this.modified.getContentWidth()+Ky.ENTIRE_DIFF_OVERVIEW_WIDTH,c=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:c,contentWidth:l,contentHeightChanged:s.contentHeightChanged,contentWidthChanged:s.contentWidthChanged})})),r}_adjustOptionsForLeftHandSide(e,t){let o=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(o.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},o.wordWrapOverride1=this._options.diffWordWrap.get()):(o.wordWrapOverride1="off",o.wordWrapOverride2="off",o.stickyScroll={enabled:!1},o.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),o.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(o.ariaLabel=t.originalAriaLabel),o.ariaLabel=this._updateAriaLabel(o.ariaLabel),o.readOnly=!this._options.originalEditable.get(),o.dropIntoEditor={enabled:!o.readOnly},o.extraEditorClassName="original-in-monaco-diff-editor",o}_adjustOptionsForRightHandSide(e,t){let o=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(o.ariaLabel=t.modifiedAriaLabel),o.ariaLabel=this._updateAriaLabel(o.ariaLabel),o.wordWrapOverride1=this._options.diffWordWrap.get(),o.revealHorizontalRightPadding=PS.revealHorizontalRightPadding.defaultValue+Ky.ENTIRE_DIFF_OVERVIEW_WIDTH,o.scrollbar.verticalHasArrows=!1,o.extraEditorClassName="modified-in-monaco-diff-editor",o}_adjustOptionsForSubEditor(e){let t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.allowVariableLineHeights=!1,t.allowVariableFonts=!1,t.allowVariableFontsInAccessibilityMode=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){e||(e="");let t=d(234,null,this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel());return this._options.accessibilityVerbose.get()?e+t:e?e.replaceAll(t,""):""}};Ake=I([m(5,X),m(6,F),m(7,Le)],Ake);var O5o=!1;var QZi=4,YZi=new T;function XZi(a){QZi=a,YZi.fire(a)}var JZi=300,ZZi=new T;function eeo(a){JZi=a,ZZi.fire(a)}var SQe=class{constructor(i){this.el=i;this.disposables=new O}get onPointerMove(){return this.disposables.add(new Zn(Me(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new Zn(Me(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}};I([bi],SQe.prototype,"onPointerMove",1),I([bi],SQe.prototype,"onPointerUp",1);var IQe=class{constructor(i){this.el=i;this.disposables=new O}get onPointerMove(){return this.disposables.add(new Zn(this.el,Vn.Change)).event}get onPointerUp(){return this.disposables.add(new Zn(this.el,Vn.End)).event}dispose(){this.disposables.dispose()}};I([bi],IQe.prototype,"onPointerMove",1),I([bi],IQe.prototype,"onPointerUp",1);var Nke=class{constructor(i){this.factory=i}get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}dispose(){}};I([bi],Nke.prototype,"onPointerMove",1),I([bi],Nke.prototype,"onPointerUp",1);var jZi="pointer-events-disabled",kh=class a extends k{constructor(e,t,o){super();this.hoverDelay=JZi;this.hoverDelayer=this._register(new rn(this.hoverDelay));this._state=3;this.onDidEnablementChange=this._register(new T);this._onDidStart=this._register(new T);this._onDidChange=this._register(new T);this._onDidReset=this._register(new T);this._onDidEnd=this._register(new T);this.orthogonalStartSashDisposables=this._register(new O);this.orthogonalStartDragHandleDisposables=this._register(new O);this.orthogonalEndSashDisposables=this._register(new O);this.orthogonalEndDragHandleDisposables=this._register(new O);this.linkedSash=void 0;this.el=D(e,_(".monaco-sash")),o.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${o.orthogonalEdge}`),et&&this.el.classList.add("mac"),this._register($(this.el,"mousedown",r=>this.onPointerStart(r,new SQe(e)))),this._register($(this.el,"dblclick",r=>this.onPointerDoublePress(r))),this._register($(this.el,"mouseenter",()=>a.onMouseEnter(this))),this._register($(this.el,"mouseleave",()=>a.onMouseLeave(this))),this._register(ds.addTarget(this.el)),this._register($(this.el,Vn.Start,r=>this.onPointerStart(r,new IQe(this.el))));let n;this._register($(this.el,Vn.Tap,r=>{if(n){clearTimeout(n),n=void 0,this.onPointerDoublePress(r);return}clearTimeout(n),n=setTimeout(()=>n=void 0,250)})),typeof o.size=="number"?(this.size=o.size,o.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=QZi,this._register(YZi.event(r=>{this.size=r,this.layout()}))),this._register(ZZi.event(r=>this.hoverDelay=r)),this.layoutProvider=t,this.orthogonalStartSash=o.orthogonalStartSash,this.orthogonalEndSash=o.orthogonalEndSash,this.orientation=o.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",O5o),this.layout()}get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",e===0),this.el.classList.toggle("minimum",e===1),this.el.classList.toggle("maximum",e===2),this._state=e,this.onDidEnablementChange.fire(e))}get onDidStart(){return this._onDidStart.event}get onDidChange(){return this._onDidChange.event}get onDidReset(){return this._onDidReset.event}get onDidEnd(){return this._onDidEnd.event}set orthogonalStartSash(e){if(this._orthogonalStartSash!==e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){let t=o=>{this.orthogonalStartDragHandleDisposables.clear(),o!==0&&(this._orthogonalStartDragHandle=D(this.el,_(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(ee(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add($(this._orthogonalStartDragHandle,"mouseenter",()=>a.onMouseEnter(e))),this.orthogonalStartDragHandleDisposables.add($(this._orthogonalStartDragHandle,"mouseleave",()=>a.onMouseLeave(e))))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}}set orthogonalEndSash(e){if(this._orthogonalEndSash!==e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){let t=o=>{this.orthogonalEndDragHandleDisposables.clear(),o!==0&&(this._orthogonalEndDragHandle=D(this.el,_(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(ee(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add($(this._orthogonalEndDragHandle,"mouseenter",()=>a.onMouseEnter(e))),this.orthogonalEndDragHandleDisposables.add($(this._orthogonalEndDragHandle,"mouseleave",()=>a.onMouseLeave(e))))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}}onPointerStart(e,t){Kt.stop(e);let o=!1;if(!e.__orthogonalSashEvent){let v=this.getOrthogonalSash(e);v&&(o=!0,e.__orthogonalSashEvent=!0,v.onPointerStart(e,new Nke(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new Nke(t))),!this.state)return;let n=this.el.ownerDocument.getElementsByTagName("iframe");for(let v of n)v.classList.add(jZi);let r=e.pageX,s=e.pageY,l=e.altKey,c={startX:r,currentX:r,startY:s,currentY:s,altKey:l};this.el.classList.add("active"),this._onDidStart.fire(c);let u=Pr(this.el),p=()=>{let v="";o?v="all-scroll":this.orientation===1?this.state===1?v="s-resize":this.state===2?v="n-resize":v=et?"row-resize":"ns-resize":this.state===1?v="e-resize":this.state===2?v="w-resize":v=et?"col-resize":"ew-resize",u.textContent=`* { cursor: ${v} !important; }`},h=new O;p(),o||this.onDidEnablementChange.event(p,null,h);let g=v=>{Kt.stop(v,!1);let b={startX:r,currentX:v.pageX,startY:s,currentY:v.pageY,altKey:l};this._onDidChange.fire(b)},f=v=>{Kt.stop(v,!1),u.remove(),this.el.classList.remove("active"),this._onDidEnd.fire(),h.dispose();for(let b of n)b.classList.remove(jZi)};t.onPointerMove(g,null,h),t.onPointerUp(f,null,h),h.add(t)}onPointerDoublePress(e){let t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger(()=>e.el.classList.add("hover"),e.hoverDelay).then(void 0,()=>{}),!t&&e.linkedSash&&a.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&a.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){a.onMouseLeave(this)}layout(){if(this.orientation===0){let e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{let e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){let t=e.initialTarget??e.target;if(!(!t||!go(t))&&t.classList.contains("orthogonal-drag-handle"))return t.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}};var fkt=class{constructor(i,e){this._options=i;this.dimensions=e;this.sashLeft=r5(this,i=>{let e=this._sashRatio.read(i)??this._options.splitViewDefaultRatio.read(i);return this._computeSashLeft(e,i)},(i,e)=>{let t=this.dimensions.width.get();this._sashRatio.set(i/t,e)});this._sashRatio=De(this,void 0)}resetSash(){this._sashRatio.set(void 0,void 0)}_computeSashLeft(i,e){let t=this.dimensions.width.read(e),o=Math.floor(this._options.splitViewDefaultRatio.read(e)*t),n=this._options.enableSplitViewResizing.read(e)?Math.floor(i*t):o,r=100;return t<=r*2?o:n<r?r:n>t-r?t-r:n}},Oke=class extends k{constructor(e,t,o,n,r,s){super();this._domNode=e;this._dimensions=t;this._enabled=o;this._boundarySashes=n;this.sashLeft=r;this._resetSash=s;this._sash=this._register(new kh(this._domNode,{getVerticalSashTop:l=>0,getVerticalSashLeft:l=>this.sashLeft.get(),getVerticalSashHeight:l=>this._dimensions.height.get()},{orientation:0})),this._startSashPosition=void 0,this._register(this._sash.onDidStart(()=>{this._startSashPosition=this.sashLeft.get()})),this._register(this._sash.onDidChange(l=>{this.sashLeft.set(this._startSashPosition+(l.currentX-l.startX),void 0)})),this._register(this._sash.onDidEnd(()=>this._sash.layout())),this._register(this._sash.onDidReset(()=>this._resetSash())),this._register(ve(l=>{let c=this._boundarySashes.read(l);c&&(this._sash.orthogonalEndSash=c.bottom)})),this._register(ve(l=>{let c=this._enabled.read(l);this._sash.state=c?3:0,this.sashLeft.read(l),this._dimensions.height.read(l),this._sash.layout()}))}};var vkt=class a extends k{constructor(){super(...arguments);this._id=++a.idCounter;this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event}static{this.idCounter=0}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getStatusbarColumn(e){return this._targetEditor.getStatusbarColumn(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,o=0){this._targetEditor.revealLines(e,t,o)}revealLinesInCenter(e,t,o=0){this._targetEditor.revealLinesInCenter(e,t,o)}revealLinesInCenterIfOutsideViewport(e,t,o=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,o)}revealLinesNearTop(e,t,o=0){this._targetEditor.revealLinesNearTop(e,t,o)}revealRange(e,t=0,o=!1,n=!0){this._targetEditor.revealRange(e,t,o,n)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,o){this._targetEditor.trigger(e,t,o)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}};var FS={enableSplitViewResizing:!0,splitViewDefaultRatio:.5,renderSideBySide:!0,renderMarginRevertIcon:!0,renderGutterMenu:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit",diffAlgorithm:"advanced",accessibilityVerbose:!1,experimental:{showMoves:!1,showEmptyDecorations:!0,useTrueInlineView:!1},hideUnchangedRegions:{enabled:!1,contextLineCount:3,minimumLineCount:3,revealLineCount:20},isInEmbeddedEditor:!1,onlyShowAccessibleDiffViewer:!1,renderSideBySideInlineBreakpoint:900,useInlineViewWhenSpaceIsLimited:!0,compactMode:!1};var YX=class{constructor(i,e){this._accessibilityService=e;this._diffEditorWidth=De(this,0),this._screenReaderMode=vi(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=ke(this,o=>this._options.read(o).renderSideBySide&&this._diffEditorWidth.read(o)<=this._options.read(o).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=ke(this,o=>this._options.read(o).renderOverviewRuler),this.renderSideBySide=ke(this,o=>this.compactMode.read(o)&&this.shouldRenderInlineViewInSmartMode.read(o)?!1:this._options.read(o).renderSideBySide&&!(this._options.read(o).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(o)&&!this._screenReaderMode.read(o))),this.readOnly=ke(this,o=>this._options.read(o).readOnly),this.shouldRenderOldRevertArrows=ke(this,o=>!(!this._options.read(o).renderMarginRevertIcon||!this.renderSideBySide.read(o)||this.readOnly.read(o)||this.shouldRenderGutterMenu.read(o))),this.shouldRenderGutterMenu=ke(this,o=>this._options.read(o).renderGutterMenu),this.renderIndicators=ke(this,o=>this._options.read(o).renderIndicators),this.enableSplitViewResizing=ke(this,o=>this._options.read(o).enableSplitViewResizing),this.splitViewDefaultRatio=ke(this,o=>this._options.read(o).splitViewDefaultRatio),this.ignoreTrimWhitespace=ke(this,o=>this._options.read(o).ignoreTrimWhitespace),this.maxComputationTimeMs=ke(this,o=>this._options.read(o).maxComputationTime),this.showMoves=ke(this,o=>this._options.read(o).experimental.showMoves&&this.renderSideBySide.read(o)),this.isInEmbeddedEditor=ke(this,o=>this._options.read(o).isInEmbeddedEditor),this.diffWordWrap=ke(this,o=>this._options.read(o).diffWordWrap),this.originalEditable=ke(this,o=>this._options.read(o).originalEditable),this.diffCodeLens=ke(this,o=>this._options.read(o).diffCodeLens),this.accessibilityVerbose=ke(this,o=>this._options.read(o).accessibilityVerbose),this.diffAlgorithm=ke(this,o=>this._options.read(o).diffAlgorithm),this.showEmptyDecorations=ke(this,o=>this._options.read(o).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=ke(this,o=>this._options.read(o).onlyShowAccessibleDiffViewer),this.compactMode=ke(this,o=>this._options.read(o).compactMode),this.trueInlineDiffRenderingEnabled=ke(this,o=>this._options.read(o).experimental.useTrueInlineView),this.useTrueInlineDiffRendering=ke(this,o=>!this.renderSideBySide.read(o)&&this.trueInlineDiffRenderingEnabled.read(o)),this.hideUnchangedRegions=ke(this,o=>this._options.read(o).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=ke(this,o=>this._options.read(o).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=ke(this,o=>this._options.read(o).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=ke(this,o=>this._options.read(o).hideUnchangedRegions.minimumLineCount),this._model=De(this,void 0),this.shouldRenderInlineViewInSmartMode=this._model.map(this,o=>hoi(this,n=>{let r=o?.diff.read(n);return r?F5o(r,this.trueInlineDiffRenderingEnabled.read(n)):void 0})).flatten().map(this,o=>!!o),this.inlineViewHideOriginalLineNumbers=this.compactMode;let t={...i,...teo(i,FS)};this._options=De(this,t)}get editorOptions(){return this._options}updateOptions(i){let e=teo(i,this._options.get()),t={...this._options.get(),...i,...e};this._options.set(t,void 0,{changedOptions:i})}setWidth(i){this._diffEditorWidth.set(i,void 0)}setModel(i){this._model.set(i,void 0)}};YX=I([m(1,Ai)],YX);function F5o(a,i){return a.mappings.every(e=>W5o(e.lineRangeMapping)||V5o(e.lineRangeMapping)||i&&bQe(e.lineRangeMapping))}function W5o(a){return a.original.length===0}function V5o(a){return a.modified.length===0}function teo(a,i){return{enableSplitViewResizing:Rn(a.enableSplitViewResizing,i.enableSplitViewResizing),splitViewDefaultRatio:e6i(a.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:Rn(a.renderSideBySide,i.renderSideBySide),renderMarginRevertIcon:Rn(a.renderMarginRevertIcon,i.renderMarginRevertIcon),maxComputationTime:TB(a.maxComputationTime,i.maxComputationTime,0,1073741824),maxFileSize:TB(a.maxFileSize,i.maxFileSize,0,1073741824),ignoreTrimWhitespace:Rn(a.ignoreTrimWhitespace,i.ignoreTrimWhitespace),renderIndicators:Rn(a.renderIndicators,i.renderIndicators),originalEditable:Rn(a.originalEditable,i.originalEditable),diffCodeLens:Rn(a.diffCodeLens,i.diffCodeLens),renderOverviewRuler:Rn(a.renderOverviewRuler,i.renderOverviewRuler),diffWordWrap:xu(a.diffWordWrap,i.diffWordWrap,["off","on","inherit"]),diffAlgorithm:xu(a.diffAlgorithm,i.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:Rn(a.accessibilityVerbose,i.accessibilityVerbose),experimental:{showMoves:Rn(a.experimental?.showMoves,i.experimental.showMoves),showEmptyDecorations:Rn(a.experimental?.showEmptyDecorations,i.experimental.showEmptyDecorations),useTrueInlineView:Rn(a.experimental?.useTrueInlineView,i.experimental.useTrueInlineView)},hideUnchangedRegions:{enabled:Rn(a.hideUnchangedRegions?.enabled??a.experimental?.collapseUnchangedRegions,i.hideUnchangedRegions.enabled),contextLineCount:TB(a.hideUnchangedRegions?.contextLineCount,i.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:TB(a.hideUnchangedRegions?.minimumLineCount,i.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:TB(a.hideUnchangedRegions?.revealLineCount,i.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:Rn(a.isInEmbeddedEditor,i.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:Rn(a.onlyShowAccessibleDiffViewer,i.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:TB(a.renderSideBySideInlineBreakpoint,i.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:Rn(a.useInlineViewWhenSpaceIsLimited,i.useInlineViewWhenSpaceIsLimited),renderGutterMenu:Rn(a.renderGutterMenu,i.renderGutterMenu),compactMode:Rn(a.compactMode,i.compactMode)}}var bkt=_;var XX=class extends k{constructor(i){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.classList.toggle("fade-in",!!i),this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new Ar(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}},JX=class a extends k{static render(i,e,t){return new a(i,e,t)}constructor(i,e,t){super(),this.actionLabel=e.label,this.actionKeybindingLabel=t,this.actionContainer=D(i,bkt("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=D(this.actionContainer,bkt("a.action")),this.action.setAttribute("role","button"),e.iconClass&&D(this.action,bkt("span.icon")).classList.add(...e.iconClass.split(" ")),this.actionRenderedLabel=t?`${e.label} (${t})`:e.label;let o=D(this.action,bkt("span"));o.textContent=this.actionRenderedLabel,this._store.add(new yQe(this.actionContainer,e.run)),this._store.add(new wQe(this.actionContainer,e.run,[3,10])),this.setEnabled(!0)}setEnabled(i){i?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}};function Skt(a,i){return a&&i?d(15,null,i):a?d(16,null):""}var yQe=class extends k{constructor(i,e){super(),this._register($(i,ne.CLICK,t=>{t.stopPropagation(),t.preventDefault(),e(i)}))}},wQe=class extends k{constructor(i,e,t){super(),this._register($(i,ne.KEY_DOWN,o=>{let n=new mi(o);t.some(r=>n.equals(r))&&(o.stopPropagation(),o.preventDefault(),e(i))}))}};var CQe=class extends cs{constructor(e,t){super();this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._element=D(e,_(".monaco-dropdown")),this._label=D(this._element,_(".dropdown-label"));let o=t.labelRenderer;o||(o=r=>(r.textContent=t.label||"",null));for(let r of[ne.CLICK,ne.MOUSE_DOWN,Vn.Tap])this._register($(this.element,r,s=>Kt.stop(s,!0)));for(let r of[ne.MOUSE_DOWN,Vn.Tap])this._register($(this._label,r,s=>{Wp(s)&&s.button!==0||(this.visible?this.hide():this.show())}));this._register($(this._label,ne.KEY_DOWN,r=>{let s=new mi(r);(s.equals(3)||s.equals(10))&&(Kt.stop(r,!0),this.visible?this.hide():this.show())}));let n=o(this._label);n&&this._register(n),this._register(ds.addTarget(this._label))}get element(){return this._element}get label(){return this._label}set tooltip(e){this._label&&(!this.hover&&e!==""?this.hover=this._register(sp().setupManagedHover(yi("mouse"),this._label,e)):this.hover&&this.hover.update(e))}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}isVisible(){return!!this.visible}onEvent(e,t){this.hide()}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}};function ieo(a){return typeof a?.getActions=="function"}var Ikt=class extends CQe{constructor(e,t){super(e,t);this._options=t;this._actions=[];this.actions=t.actions||[]}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this._options.actionProvider?this._options.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._options.contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:(e,t)=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e,t):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this._options.menuClassName||"",onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this._options.menuAsChild?this.element:void 0,skipTelemetry:this._options.skipTelemetry})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}};var rh=class extends Ja{constructor(e,t,o,n=Object.create(null)){super(null,e,n);this.actionItem=null;this._onDidChangeVisibility=this._register(new T);this.menuActionsOrProvider=t,this.contextMenuProvider=o,this.options=n,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}get onDidChangeVisibility(){return this._onDidChangeVisibility.event}render(e){this.actionItem=e;let t=r=>(this.element=D(r,_("a.action-label")),this.setAriaLabelAttributes(this.element),this.renderLabel(this.element)),o=Array.isArray(this.menuActionsOrProvider),n={contextMenuProvider:this.contextMenuProvider,labelRenderer:t,menuAsChild:this.options.menuAsChild,actions:o?this.menuActionsOrProvider:void 0,actionProvider:o?void 0:this.menuActionsOrProvider,skipTelemetry:this.options.skipTelemetry};if(this.dropdownMenu=this._register(new Ikt(e,n)),this._register(this.dropdownMenu.onDidChangeVisibility(r=>{this.element?.setAttribute("aria-expanded",`${r}`),this._onDidChangeVisibility.fire(r)})),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){let r=this;this.dropdownMenu.menuOptions={...this.dropdownMenu.menuOptions,get anchorAlignment(){return r.options.anchorAlignmentProvider()}}}this.updateTooltip(),this.updateEnabled()}renderLabel(e){let t=[];return typeof this.options.classNames=="string"?t=this.options.classNames.split(/\s+/g).filter(o=>!!o):this.options.classNames&&(t=this.options.classNames),t.find(o=>o==="icon")||t.push("codicon"),e.classList.add(...t),this._action.label&&this._register(sp().setupManagedHover(this.options.hoverDelegate??yi("mouse"),e,this._action.label)),null}setAriaLabelAttributes(e){e.setAttribute("role","button"),e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"),e.ariaLabel=this._action.label||""}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label),e??void 0}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}show(){this.dropdownMenu?.show()}updateEnabled(){let e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e)}},ZX=class extends ts{constructor(e,t,o,n){super(e,t,o);this.contextMenuProvider=n}render(e){if(super.render(e),this.element){this.element.classList.add("action-dropdown-item");let t={getActions:()=>{let r=this.options.menuActionsOrProvider;return Array.isArray(r)?r:r.getActions()}},o=this.options.menuActionClassNames||[],n=st("div.action-dropdown-item-separator",[st("div",{})]).root;n.classList.toggle("prominent",o.includes("prominent")),D(this.element,n),this.dropdownMenuActionViewItem=this._register(new rh(this._register(new it("dropdownAction",d(8,null))),t,this.contextMenuProvider,{classNames:["dropdown",...q.asClassNameArray(L.dropDownButton),...o],hoverDelegate:this.options.hoverDelegate})),this.dropdownMenuActionViewItem.render(this.element),this._register($(this.element,ne.KEY_DOWN,r=>{if(t.getActions().length===0)return;let s=new mi(r),l=!1;this.dropdownMenuActionViewItem?.isFocused()&&s.equals(15)?(l=!0,this.dropdownMenuActionViewItem?.blur(),this.focus()):this.isFocused()&&s.equals(17)&&(l=!0,this.blur(),this.dropdownMenuActionViewItem?.focus()),l&&(s.preventDefault(),s.stopPropagation())}))}}blur(){super.blur(),this.dropdownMenuActionViewItem?.blur()}setFocusable(e){super.setFocusable(e),this.dropdownMenuActionViewItem?.setFocusable(e)}};var Wke=20,Vke=4,Tdi="--vscode-toolbar-action-min-width",Kp=class extends k{constructor(e,t,o={orientation:0}){super();this.container=e;this.submenuActionViewItems=[];this.hasSecondaryActions=!1;this._onDidChangeDropdownVisibility=this._register(new Cy);this.originalPrimaryActions=[];this.originalSecondaryActions=[];this.hiddenActions=[];this.disposables=this._register(new O);if(o.hoverDelegate=o.hoverDelegate??this._register(Dg()),this.options=o,this.toggleMenuAction=this._register(new Ade(()=>this.toggleMenuActionViewItem?.show(),o.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new oo(this.element,{orientation:o.orientation,ariaLabel:o.ariaLabel,actionRunner:o.actionRunner,allowContextMenu:o.allowContextMenu,highlightToggledItems:o.highlightToggledItems,hoverDelegate:o.hoverDelegate,actionViewItemProvider:(n,r)=>{if(n.id===Ade.ID)return this.toggleMenuActionViewItem=new rh(n,{getActions:()=>this.toggleMenuAction.menuActions},t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:q.asClassNameArray(o.moreIcon??L.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0,hoverDelegate:this.options.hoverDelegate}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(o.actionViewItemProvider){let s=o.actionViewItemProvider(n,r);if(s)return s}if(n instanceof sa){let s=new rh(n,n.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:n.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,hoverDelegate:this.options.hoverDelegate});return s.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(s),this.disposables.add(this._onDidChangeDropdownVisibility.add(s.onDidChangeVisibility)),s}}})),this.options.responsiveBehavior?.enabled){this.element.classList.toggle("responsive",!0),this.element.classList.toggle("responsive-all",this.options.responsiveBehavior.kind==="all"),this.element.classList.toggle("responsive-last",this.options.responsiveBehavior.kind==="last"),this.element.style.setProperty(Tdi,`${this.getConfiguredActionMinWidth()}px`);let n=new ResizeObserver(()=>{this.updateActions(this.element.getBoundingClientRect().width)});n.observe(this.element),this._store.add(ee(()=>n.disconnect()))}}get onDidChangeDropdownVisibility(){return this._onDidChangeDropdownVisibility.event}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}set context(e){this.actionBar.context=e,this.toggleMenuActionViewItem?.setActionContext(e);for(let t of this.submenuActionViewItems)t.setActionContext(e)}getElement(){return this.element}focus(){this.actionBar.focus()}getItemsWidth(){let e=0;for(let t=0;t<this.actionBar.length();t++)e+=this.actionBar.getWidth(t);return e}getItemAction(e){return this.actionBar.getAction(e)}getItemWidth(e){return this.actionBar.getWidth(e)}getItemsLength(){return this.actionBar.length()}setAriaLabel(e){this.actionBar.setAriaLabel(e)}relayout(){if(this.options.responsiveBehavior?.enabled){let e=this.element.getBoundingClientRect().width;this.updateActions(e)}}setActions(e,t){this.clear(),this.originalPrimaryActions=e?e.slice(0):[],this.originalSecondaryActions=t?t.slice(0):[];let o=e?e.slice(0):[];if(this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),o.push(this.toggleMenuAction)),o.length>0&&this.options.trailingSeparator&&o.push(new oi),o.forEach(n=>{this.actionBar.push(n,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(n)})}),this.updateOverflowClassName(),this.applyResponsiveActionMinWidths(),this.options.responsiveBehavior?.enabled){if(this.hiddenActions.length=0,this.options.responsiveBehavior?.minItems!==void 0){let n=this.options.responsiveBehavior.minItems,r=this.originalPrimaryActions.slice(0,n).reduce((l,c)=>l+this.getActionMinWidth(c),0),s=0;(this.originalSecondaryActions.length>0||n<this.originalPrimaryActions.length)&&(s=Wke+Vke),this.container.style.minWidth=`${r+s}px`,this.element.style.minWidth=`${r+s}px`}else{let n=this.originalPrimaryActions.length>0?this.getActionMinWidth(this.originalPrimaryActions[0]):Wke+Vke;this.container.style.minWidth=`${n}px`,this.element.style.minWidth=`${n}px`}this.updateActions(this.element.getBoundingClientRect().width)}}isEmpty(){return this.actionBar.isEmpty()}getKeybindingLabel(e){return this.options.getKeyBinding?.(e)?.getLabel()??void 0}getConfiguredActionMinWidth(e){return e?.id===Ade.ID?Wke:this.options.responsiveBehavior?.getActionMinWidth?.(e??this.toggleMenuAction)??this.options.responsiveBehavior?.actionMinWidth??Wke}getActionMinWidth(e){return this.getConfiguredActionMinWidth(e)+Vke}applyResponsiveActionMinWidths(){if(!this.options.responsiveBehavior?.enabled)return;if(this.options.responsiveBehavior.kind==="last"){let o=this.actionBar.hasAction(this.toggleMenuAction)?this.actionBar.length()-2:this.actionBar.length()-1,n=o>=0?this.actionBar.getAction(o):void 0,r=`${this.getConfiguredActionMinWidth(n)}px`;this.element.style.getPropertyValue(Tdi)!==r&&this.element.style.setProperty(Tdi,r);return}let e=this.actionBar.getContainer().firstElementChild;if(go(e))for(let t=0;t<e.children.length;t++){let o=e.children.item(t);if(!go(o))continue;let n=this.actionBar.getAction(t),r=`${this.getConfiguredActionMinWidth(n)}px`;o.style.minWidth!==r&&(o.style.minWidth=r)}}updateActions(e){if(this.actionBar.isEmpty())return;this.applyResponsiveActionMinWidths();let t=parseInt(this.element.style.minWidth);e=Math.max(e,Number.isNaN(t)?0:t);let o=s=>{if(this.options.responsiveBehavior?.kind==="last"){let l=this.actionBar.hasAction(this.toggleMenuAction),c=l?this.actionBar.length()-1:this.actionBar.length();if(c===0)return l?Wke+Vke:0;let u=0;for(let h=0;h<c-1;h++)u+=this.actionBar.getWidth(h)+Vke;let p=this.actionBar.getAction(c-1);return u+=s?this.actionBar.getWidth(c-1):this.getActionMinWidth(p),u+=l?Wke+Vke:0,u}else{let l=0;for(let c=0;c<this.actionBar.length();c++)l+=s?this.actionBar.getWidth(c):this.getActionMinWidth(this.actionBar.getAction(c));return l}},n=o(!1);if(n<=e&&this.hiddenActions.length===0)return;if(n>e){if(this.options.responsiveBehavior?.minItems!==void 0&&(this.actionBar.hasAction(this.toggleMenuAction)?this.actionBar.length()-1:this.actionBar.length())<=this.options.responsiveBehavior.minItems)return;for(;o(!1)>e&&this.actionBar.length()>0;){let s=this.originalPrimaryActions.length-this.hiddenActions.length-1;if(s<0)break;let l=this.originalPrimaryActions[s],c=Math.min(this.getActionMinWidth(l),this.getItemWidth(s));this.hiddenActions.unshift({action:l,size:c}),this.actionBar.pull(s),this.originalSecondaryActions.length===0&&this.hiddenActions.length===1&&(this.actionBar.push(this.toggleMenuAction,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(this.toggleMenuAction)}),this.updateOverflowClassName()),this.applyResponsiveActionMinWidths()}}else for(;this.hiddenActions.length>0;){let s=this.hiddenActions.shift();if(o(!0)+s.size>e){this.hiddenActions.unshift(s);break}this.actionBar.push(s.action,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(s.action),index:this.originalPrimaryActions.length-this.hiddenActions.length-1}),this.originalSecondaryActions.length===0&&this.hiddenActions.length===0&&(this.toggleMenuAction.menuActions=[],this.actionBar.pull(this.actionBar.length()-1),this.updateOverflowClassName()),this.applyResponsiveActionMinWidths()}let r=this.hiddenActions.map(s=>s.action);if(this.originalSecondaryActions.length>0||r.length>0){let s=this.originalSecondaryActions.slice(0);this.toggleMenuAction.menuActions=oi.join(r,s)}this.updateOverflowClassName(),this.applyResponsiveActionMinWidths()}updateOverflowClassName(){this.actionBar.domNode.classList.toggle("has-overflow",this.actionBar.hasAction(this.toggleMenuAction))}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),this.element.remove(),super.dispose()}},Ade=class a extends it{static{this.ID="toolbar.toggle.more"}constructor(i,e){e=e||d(32,null),super(a.ID,e,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=i}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(i){this._menuActions=i}};var Bke=class{constructor(i,e,t=e){this.modifierLabels=[null],this.modifierLabels[2]=i,this.modifierLabels[1]=e,this.modifierLabels[3]=t}toLabel(i,e,t){if(e.length===0)return null;let o=[];for(let n=0,r=e.length;n<r;n++){let s=e[n],l=t(s);if(l===null)return null;o[n]=B5o(s,l,this.modifierLabels[i])}return o.join(" ")}},nM=new Bke({ctrlKey:"\u2303",shiftKey:"\u21E7",altKey:"\u2325",metaKey:"\u2318",separator:""},{ctrlKey:d(129,null),shiftKey:d(132,null),altKey:d(126,null),metaKey:d(136,null),separator:"+"},{ctrlKey:d(129,null),shiftKey:d(132,null),altKey:d(126,null),metaKey:d(134,null),separator:"+"}),ykt=new Bke({ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(131,null),metaKey:d(128,null),separator:"+"},{ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(127,null),metaKey:d(137,null),separator:"+"},{ctrlKey:d(130,null),shiftKey:d(133,null),altKey:d(127,null),metaKey:d(135,null),separator:"+"}),oeo=new Bke({ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Cmd",separator:"+"},{ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Super",separator:"+"}),Hke=new Bke({ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"cmd",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"win",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"meta",separator:"+"});function B5o(a,i,e){if(i===null)return"";let t=[];return a.ctrlKey&&t.push(e.ctrlKey),a.shiftKey&&t.push(e.shiftKey),a.altKey&&t.push(e.altKey),a.metaKey&&t.push(e.metaKey),i!==""&&t.push(i),t.join(e.separator)}function d4(a){return!!a&&typeof a=="object"&&typeof a.original=="string"&&typeof a.value=="string"}function Uke(a){return a?a.condition!==void 0:!1}function _di(a){let i=[];typeof a=="number"&&i.push("code/timeOrigin",a);function e(n,r){i.push(n,r?.startTime??Date.now())}function t(){let n=[];for(let r=0;r<i.length;r+=2)n.push({name:i[r],startTime:i[r+1]});return n}function o(n){if(typeof n>"u"){let r=i.length>=2&&i[0]==="code/timeOrigin",s=r?i[1]:void 0;i.length=0,r&&i.push("code/timeOrigin",s)}else for(let r=i.length-2;r>=0;r-=2)i[r]===n&&i.splice(r,2)}return{mark:e,getMarks:t,clearMarks:o}}function H5o(){if(typeof performance=="object"&&typeof performance.mark=="function"&&!performance.nodeTiming)return typeof performance.timeOrigin!="number"&&!performance.timing?_di():{mark(a,i){performance.mark(a,i)},clearMarks(a){performance.clearMarks(a)},getMarks(){let a=performance.timeOrigin;typeof a!="number"&&(a=(performance.timing.navigationStart||performance.timing.redirectStart||performance.timing.fetchStart)??0);let i=[{name:"code/timeOrigin",startTime:Math.round(a)}];for(let e of performance.getEntriesByType("mark"))i.push({name:e.name,startTime:Math.round(a+e.startTime)});return i}};if(typeof process=="object"){let a=performance?.timeOrigin;return _di(a)}else return console.trace("perf-util loaded in UNKNOWN environment"),_di()}function U5o(a){return a.MonacoPerformanceMarks||(a.MonacoPerformanceMarks=H5o()),a.MonacoPerformanceMarks}var Ddi=U5o(globalThis),Wo=Ddi.mark,neo=Ddi.clearMarks,reo=Ddi.getMarks;var Gk=class a extends k{constructor(e,t=Object.create(null)){super();this.database=e;this.options=t;this._onDidChangeStorage=this._register(new Ih);this.onDidChangeStorage=this._onDidChangeStorage.event;this.state=0;this.cache=new Map;this.flushDelayer=this._register(new Aa(a.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((t,o)=>this.acceptExternal(o,t)),e.deleted?.forEach(t=>this.acceptExternal(t,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===2)return;let o=!1;mr(t)?o=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),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,t){let o=this.cache.get(e);return mr(o)?t:o}getBoolean(e,t){let o=this.get(e);return mr(o)?t:o==="true"}getNumber(e,t){let o=this.get(e);return mr(o)?t:parseInt(o,10)}getObject(e,t){let o=this.get(e);return mr(o)?t:Dm(o)}async set(e,t,o=!1){if(this.state===2)return;if(mr(t))return this.delete(e,o);let n=Di(t)||Array.isArray(t)?nxe(t):String(t);if(this.cache.get(e)!==n)return this.cache.set(e,n),this.pendingInserts.set(e,n),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:o}),this.doFlush()}async delete(e,t=!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:t}),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}},Nde=class{constructor(){this.onDidChangeItemsExternal=U.None;this.items=new Map}async getItems(){return this.items}async updateItems(i){i.insert?.forEach((e,t)=>this.items.set(t,e)),i.delete?.forEach(e=>this.items.delete(e))}async optimize(){}async close(){}},seo="__$__migratedStorageMarker",xQe=class a extends Gk{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,t){this.fallbackStorage=e,this.isFallbackStorageReadonly=t}static{this.INTERNAL_KEY_PREFIX="__$__"}get(e,t){if(!e.startsWith(a.INTERNAL_KEY_PREFIX)&&!this.migratedKeys.has(e)&&bn(super.get(e))){this.migratedKeys.add(e);let o=this.fallbackStorage?.items.get(e);bn(o)||(this.set(e,o),this.isFallbackStorageReadonly||this.fallbackStorage?.delete(e),this.persistMigratedKeys())}return super.get(e,t)}loadMigratedKeys(){let e=super.get(seo);if(e)try{return new Set(JSON.parse(e))}catch{}return new Set}persistMigratedKeys(){this.set(seo,JSON.stringify([...this.migratedKeys]))}};var ko=le("environmentService"),Ix=ko;var Ae=le("contextService");function Pg(a){let i=a;return typeof i?.id=="string"&&A.isUri(i.uri)}function u4(a){return typeof a?.id=="string"&&!Pg(a)&&!Gy(a)}var z5o={id:"ext-dev"},Kke={id:"empty-window"};function pf(a,i){if(typeof a=="string"||typeof a>"u")return typeof a=="string"?{id:Jo(a)}:i?z5o:Kke;let e=a;return e.configuration?{id:e.id,configPath:e.configuration}:e.folders.length===1?{id:e.id,uri:e.folders[0].uri}:{id:e.id}}function Gy(a){let i=a;return typeof i?.id=="string"&&A.isUri(i.configPath)}function aeo(a){let i=a;if(i?.uri)return{id:i.id,uri:A.revive(i.uri)};let e=a;if(e?.configPath)return{id:e.id,configPath:A.revive(e.configPath)};if(a?.id)return{id:a.id}}function p4(a){let i=a;return!!(i&&typeof i=="object"&&typeof i.id=="string"&&Array.isArray(i.folders))}function eC(a){let i=a;return!!(i&&typeof i=="object"&&A.isUri(i.uri)&&typeof i.name=="string"&&typeof i.toResource=="function")}var wkt=class{constructor(i,e,t,o,n,r){this._id=i;this._transient=t;this._configuration=o;this.ignorePathCasing=n;this._workspaceName=r;this.foldersMap=Hp.forUris(this.ignorePathCasing,()=>!0),this.folders=e}get folders(){return this._folders}set folders(i){this._folders=i,this.updateFoldersMap()}update(i){this._id=i.id,this._configuration=i.configuration,this._transient=i.transient,this._workspaceName=i.name,this.ignorePathCasing=i.ignorePathCasing,this.folders=i.folders}get id(){return this._id}get transient(){return this._transient}get configuration(){return this._configuration}set configuration(i){this._configuration=i}get name(){return this._workspaceName}getFolder(i){return i&&this.foldersMap.findSubstr(i)||null}updateFoldersMap(){this.foldersMap=Hp.forUris(this.ignorePathCasing,()=>!0);for(let i of this.folders)this.foldersMap.set(i.uri,i)}toJSON(){return{id:this.id,folders:this.folders,transient:this.transient,configuration:this.configuration,name:this.name}}},Ode=class{constructor(i,e){this.raw=e;this.uri=i.uri,this.index=i.index,this.name=i.name}toResource(i){return Ve(this.uri,i)}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}};function tJ(a){return new Ode({uri:a,index:0,name:sl(a)},{uri:a.toString()})}var OT="code-workspace",kQe=`.${OT}`,leo=[{name:d(2998,null),extensions:[OT]}],ceo="workspace.json";function rM(a,i){return kL.isEqualOrParent(a,i.untitledWorkspacesHome)}function tC(a){let i;return A.isUri(a)?i=a:i=a.configuration,i?.scheme===Q.tmp}var K5o="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function deo(a){return a.id===K5o}function Fde(a,i){return!rM(a,i)&&!tC(a)}function jF(a){return(typeof a=="string"?km(a):Ts(a))===kQe}var gt=le("IUriIdentityService");var EQe="agents",G5o={settings:!0,keybindings:!0,prompts:!0,mcp:!0,snippets:!0,tasks:!0,extensions:!0};function QF(a){let i=a;return!!(i&&typeof i=="object"&&typeof i.id=="string"&&typeof i.isDefault=="boolean"&&typeof i.name=="string"&&A.isUri(i.location)&&A.isUri(i.globalStorageHome)&&A.isUri(i.settingsResource)&&A.isUri(i.keybindingsResource)&&A.isUri(i.tasksResource)&&A.isUri(i.snippetsHome)&&A.isUri(i.promptsHome)&&A.isUri(i.extensionsResource)&&A.isUri(i.mcpResource)&&A.isUri(i.agentPluginsHome))}var hn=le("IUserDataProfilesService");function iC(a,i){return{id:a.id,isDefault:a.isDefault,name:a.name,icon:a.icon,location:A.revive(a.location).with({scheme:i}),globalStorageHome:A.revive(a.globalStorageHome).with({scheme:i}),settingsResource:A.revive(a.settingsResource).with({scheme:i}),keybindingsResource:A.revive(a.keybindingsResource).with({scheme:i}),tasksResource:A.revive(a.tasksResource).with({scheme:i}),snippetsHome:A.revive(a.snippetsHome).with({scheme:i}),promptsHome:A.revive(a.promptsHome).with({scheme:i}),extensionsResource:A.revive(a.extensionsResource).with({scheme:i}),mcpResource:A.revive(a.mcpResource).with({scheme:i}),agentPluginsHome:A.revive(a.agentPluginsHome),cacheHome:A.revive(a.cacheHome).with({scheme:i}),useDefaultFlags:a.useDefaultFlags,isTransient:a.isTransient,isInternal:a.isInternal,isAgentsWindowProfile:a.isAgentsWindowProfile,workspaces:a.workspaces?.map(e=>A.revive(e))}}function Wde(a,i,e,t,o,n){let r=a===EQe;return{id:a,name:i,location:e,isDefault:!1,icon:o?.icon,globalStorageHome:n&&o?.useDefaultFlags?.globalState?n.globalStorageHome:Ve(e,"globalStorage"),settingsResource:n&&o?.useDefaultFlags?.settings?n.settingsResource:Ve(e,"settings.json"),keybindingsResource:n&&o?.useDefaultFlags?.keybindings?n.keybindingsResource:Ve(e,"keybindings.json"),tasksResource:n&&o?.useDefaultFlags?.tasks?n.tasksResource:Ve(e,"tasks.json"),snippetsHome:n&&o?.useDefaultFlags?.snippets?n.snippetsHome:Ve(e,"snippets"),promptsHome:n&&o?.useDefaultFlags?.prompts?n.promptsHome:Ve(e,"prompts"),extensionsResource:n&&o?.useDefaultFlags?.extensions?n.extensionsResource:Ve(e,"extensions.json"),mcpResource:n&&o?.useDefaultFlags?.mcp?n.mcpResource:Ve(e,"mcp.json"),agentPluginsHome:n?n.agentPluginsHome:Ve(e,"agent-plugins"),cacheHome:Ve(t,a),useDefaultFlags:o?.useDefaultFlags,isTransient:o?.transient,isInternal:r||o?.transient,isAgentsWindowProfile:r,workspaces:o?.workspaces}}var ueo="builtin",Ckt=class extends k{constructor(e,t,o,n){super();this.environmentService=e;this.fileService=t;this.uriIdentityService=o;this.logService=n;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=Ve(this.environmentService.userRoamingDataHome,"profiles"),this.profilesCacheHome=Ve(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(),t=[e];try{for(let n of this.getStoredProfiles()){if(this.isInvalidProfile(n)){this.logService.warn("Skipping the invalid stored profile",n.location||n.name);continue}let r=Be(n.location);t.push(Wde(r,n.name,n.location,this.profilesCacheHome,{icon:n.icon,useDefaultFlags:r===EQe?G5o:n.useDefaultFlags},e))}}catch(n){this.logService.error(n)}let o=new Map;if(t.length)try{let n=this.getStoredProfileAssociations();if(n.workspaces)for(let[r,s]of Object.entries(n.workspaces)){let l=A.parse(r),c=t.find(u=>u.id===s);if(c){let u=c.workspaces?c.workspaces.slice(0):[];u.push(l),c.workspaces=u}}if(n.emptyWindows)for(let[r,s]of Object.entries(n.emptyWindows)){let l=t.find(c=>c.id===s);l&&o.set(r,l)}}catch(n){this.logService.error(n)}this._profilesObject={profiles:t,emptyWindows:o}}return this._profilesObject}isInvalidProfile(e){return!e.name||!We(e.name)||!e.location}createDefaultProfile(){let e=Wde("__default__profile__",d(2957,null),this.environmentService.userRoamingDataHome,this.profilesCacheHome);return{...e,extensionsResource:this.getDefaultProfileExtensionsLocation()??e.extensionsResource,isDefault:!0}}async createTransientProfile(e){let t="Temp",o=new RegExp(`${Ss(t)}\\s(\\d+)`),n=0;for(let s of this.profiles){let l=o.exec(s.name),c=l?parseInt(l[1]):0;n=c>n?c:n}let r=`${t} ${n+1}`;return this.createProfile(Lr(ht()).toString(16),r,{transient:!0},e)}async createNamedProfile(e,t,o){return this.createProfile(Lr(ht()).toString(16),e,t,o)}async createProfile(e,t,o,n){return await this.doCreateProfile(e,t,o,n)}async doCreateProfile(e,t,o,n){if(!We(t)||!t)throw new Error("Name of the profile is mandatory and must be of type `string`");let r=this.profileCreationPromises.get(t);return r||(r=(async()=>{try{if(this.profiles.find(p=>p.id===e||e!==EQe&&!p.isTransient&&!o?.transient&&p.name===t))throw new Error(`Profile with ${t} name already exists`);let l=n?this.getWorkspace(n):void 0;A.isUri(l)&&(o={...o,workspaces:[l]});let c=Wde(e,t,this.uriIdentityService.extUri.joinPath(this.profilesHome,...e===EQe?[ueo,e]:[e]),this.profilesCacheHome,e===EQe?{}:o,this.defaultProfile);await this.fileService.createFolder(c.location);let u=[];return this._onWillCreateProfile.fire({profile:c,join(p){u.push(p)}}),await vn.settled(u),l&&!A.isUri(l)&&this.updateEmptyWindowAssociation(l,c,!!c.isTransient),this.updateProfiles([c],[],[]),this.profiles.find(p=>p.id===c.id)??c}finally{this.profileCreationPromises.delete(t)}})(),this.profileCreationPromises.set(t,r)),r}async updateProfile(e,t){if(e.isAgentsWindowProfile)throw new Error("Cannot update agents window profile");let o=[];for(let r of this.profiles){let s;if(e.id===r.id)r.isDefault?t.workspaces&&(s=r,s.workspaces=t.workspaces):s=Wde(r.id,t.name??r.name,r.location,this.profilesCacheHome,{icon:t.icon===null?void 0:t.icon??r.icon,transient:t.transient??r.isTransient,useDefaultFlags:t.useDefaultFlags??r.useDefaultFlags,workspaces:t.workspaces??r.workspaces},this.defaultProfile);else if(t.workspaces){let l=r.workspaces?.filter(c=>!t.workspaces?.some(u=>this.uriIdentityService.extUri.isEqual(c,u)));r.workspaces?.length!==l?.length&&(s=r,s.workspaces=l)}s&&o.push(s)}if(!o.length)throw e.isDefault?new Error("Cannot update default profile"):new Error(`Profile '${e.name}' does not exist`);this.updateProfiles([],[],o);let n=this.profiles.find(r=>r.id===e.id);if(!n)throw new Error(`Profile '${e.name}' was not updated`);return n}async removeProfile(e){if(e.isDefault)throw new Error("Cannot remove default profile");let t=this.profiles.find(n=>n.id===e.id);if(!t)throw new Error(`Profile '${e.name}' does not exist`);let o=[];this._onWillRemoveProfile.fire({profile:t,join(n){o.push(n)}});try{await Promise.allSettled(o)}catch(n){this.logService.error(n)}this.updateProfiles([],[t],[]);try{await this.fileService.del(t.cacheHome,{recursive:!0})}catch(n){rp(n)!==1&&this.logService.error(n)}}async setProfileForWorkspace(e,t){let o=this.profiles.find(r=>r.id===t.id);if(!o)throw new Error(`Profile '${t.name}' does not exist`);let n=this.getWorkspace(e);if(A.isUri(n)){let r=o.workspaces?[...o.workspaces]:[];r.some(s=>this.uriIdentityService.extUri.isEqual(s,n))||(r.push(n),await this.updateProfile(o,{workspaces:r}))}else this.updateEmptyWindowAssociation(n,o,!1),this.updateStoredProfiles(this.profiles)}unsetWorkspace(e,t=!1){let o=this.getWorkspace(e);if(A.isUri(o)){let n=this.getProfileForWorkspace(e);n&&this.updateProfile(n,{workspaces:n.workspaces?.filter(r=>!this.uriIdentityService.extUri.isEqual(r,o))})}else this.updateEmptyWindowAssociation(o,void 0,t),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(t=>t.isDirectory&&t.name!==ueo&&this.profiles.every(o=>!this.uriIdentityService.extUri.isEqual(o.location,t.resource))).map(t=>this.fileService.del(t.resource,{recursive:!0})))}}catch(e){this.logService.error("Error deleting redundant profile folders",e)}try{let e=this.getStoredProfiles(),t=[];for(let o of this.getStoredProfiles())this.isInvalidProfile(o)?this.logService.warn(`Invalid user data profile found: ${o.name}`):t.push(o);e.length!==t.length&&this.saveStoredProfiles(t)}catch(e){this.logService.error("Error removing invalid stored profiles",e)}}async cleanUpTransientProfiles(){let e=this.transientProfilesObject.profiles.filter(t=>!this.isProfileAssociatedToWorkspace(t));await Promise.allSettled(e.map(t=>this.removeProfile(t)))}getProfileForWorkspace(e){let t=this.getWorkspace(e);return A.isUri(t)&&this.uriIdentityService.extUri.isEqual(t,this.environmentService.agentSessionsWorkspace)?this.profiles.find(o=>o.isAgentsWindowProfile):A.isUri(t)?this.profiles.find(o=>o.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,t))):this.profilesObject.emptyWindows.get(t)??this.transientProfilesObject.emptyWindows.get(t)}getWorkspace(e){return Pg(e)?e.uri:Gy(e)?e.configPath:e.id}isProfileAssociatedToWorkspace(e){return!!(e.workspaces?.length||[...this.profilesObject.emptyWindows.values()].some(t=>this.uriIdentityService.extUri.isEqual(t.location,e.location))||[...this.transientProfilesObject.emptyWindows.values()].some(t=>this.uriIdentityService.extUri.isEqual(t.location,e.location)))}updateProfiles(e,t,o,n=!1){let r=[...this.profiles,...e],s=this.transientProfilesObject.profiles;this.transientProfilesObject.profiles=[];let l=[];for(let c of r){if(t.some(u=>c.id===u.id)){for(let u of[...this.profilesObject.emptyWindows.keys()])c.id===this.profilesObject.emptyWindows.get(u)?.id&&this.profilesObject.emptyWindows.delete(u);continue}if(!c.isDefault){c=o.find(p=>c.id===p.id)??c;let u=s.find(p=>c.id===p.id);if(c.isTransient)this.transientProfilesObject.profiles.push(c);else if(u){for(let[p,h]of this.transientProfilesObject.emptyWindows.entries())if(c.id===h.id){this.transientProfilesObject.emptyWindows.delete(p),this.profilesObject.emptyWindows.set(p,c);break}}}c.workspaces?.length===0&&(c.workspaces=void 0),l.push(c)}this.updateStoredProfiles(l),n||this.triggerProfilesChanges(e,t,o)}triggerProfilesChanges(e,t,o){this._onDidChangeProfiles.fire({added:e,removed:t,updated:o,all:this.profiles})}updateEmptyWindowAssociation(e,t,o){o=t?.isTransient?!0:o,o?t?this.transientProfilesObject.emptyWindows.set(e,t):this.transientProfilesObject.emptyWindows.delete(e):(this.transientProfilesObject.emptyWindows.delete(e),t?this.profilesObject.emptyWindows.set(e,t):this.profilesObject.emptyWindows.delete(e))}updateStoredProfiles(e){let t=[],o={},n={};for(let r of e)if(!r.isTransient&&(r.isDefault||t.push({location:r.location,name:r.name,icon:r.icon,useDefaultFlags:r.useDefaultFlags}),r.workspaces))for(let s of r.workspaces)o[s.toString()]=r.id;for(let[r,s]of this.profilesObject.emptyWindows.entries())n[r.toString()]=s.id;this.saveStoredProfileAssociations({workspaces:o,emptyWindows:n}),this.saveStoredProfiles(t),this._profilesObject=void 0}getStoredProfiles(){return[]}saveStoredProfiles(e){throw new Error("not implemented")}getStoredProfileAssociations(){return{}}saveStoredProfileAssociations(e){throw new Error("not implemented")}getDefaultProfileExtensionsLocation(){}};Ckt=I([m(0,ko),m(1,ge),m(2,gt),m(3,re)],Ckt);var Rdi="__$__isNewStorageMarker",xkt="__$__targetStorageMarker",de=le("storageService");function q5o(a){let i=a.get(xkt);if(i)try{return JSON.parse(i)}catch{}return Object.create(null)}var Vde=class a extends k{constructor(e={flushInterval:a.DEFAULT_FLUSH_INTERVAL}){super();this._onDidChangeValue=this._register(new Ih);this._onDidChangeTarget=this._register(new Ih);this.onDidChangeTarget=this._onDidChangeTarget.event;this._onWillSaveState=this._register(new T);this.onWillSaveState=this._onWillSaveState.event;this.runFlushWhenIdle=this._register(new ue);this._workspaceKeyTargets=void 0;this._profileKeyTargets=void 0;this._applicationKeyTargets=void 0;this._applicationSharedKeyTargets=void 0;this.flushWhenIdleScheduler=this._register(new Dt(()=>this.doFlushWhenIdle(),e.flushInterval))}static{this.DEFAULT_FLUSH_INTERVAL=60*1e3}onDidChangeValue(e,t,o){return U.filter(this._onDidChangeValue.event,n=>n.scope===e&&(t===void 0||n.key===t),o)}doFlushWhenIdle(){this.runFlushWhenIdle.value=TL(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}stopFlushWhenIdle(){je([this.runFlushWhenIdle,this.flushWhenIdleScheduler])}initialize(){return this.initializationPromise||(this.initializationPromise=(async()=>{Wo("code/willInitStorage");try{await this.doInitialize()}finally{Wo("code/didInitStorage")}this.flushWhenIdleScheduler.schedule()})()),this.initializationPromise}emitDidChangeValue(e,t){let{key:o,external:n}=t;if(o===xkt){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:n})}emitWillSaveState(e){this._onWillSaveState.fire({reason:e})}get(e,t,o){return this.getStorage(t)?.get(e,o)}getBoolean(e,t,o){return this.getStorage(t)?.getBoolean(e,o)}getNumber(e,t,o){return this.getStorage(t)?.getNumber(e,o)}getObject(e,t,o){return this.getStorage(t)?.getObject(e,o)}storeAll(e,t){this.withPausedEmitters(()=>{for(let o of e)this.store(o.key,o.value,o.scope,o.target,t)})}store(e,t,o,n,r=!1){if(mr(t)){this.remove(e,o,r);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,o,n),this.getStorage(o)?.set(e,t,r)})}remove(e,t,o=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,t,void 0),this.getStorage(t)?.delete(e,o)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}keys(e,t){let o=[],n=this.getKeyTargets(e);for(let r of Object.keys(n))n[r]===t&&o.push(r);return o}updateKeyTarget(e,t,o,n=!1){let r=this.getKeyTargets(t);typeof o=="number"?r[e]!==o&&(r[e]=o,this.getStorage(t)?.set(xkt,JSON.stringify(r),n)):typeof r[e]=="number"&&(delete r[e],this.getStorage(t)?.set(xkt,JSON.stringify(r),n))}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 t=this.getStorage(e);return t?q5o(t):Object.create(null)}isNew(e){return this.getBoolean(Rdi,e)===!0}async flush(e=0){this._onWillSaveState.fire({reason:e});let t=this.getStorage(-1),o=this.getStorage(-2),n=this.getStorage(0),r=this.getStorage(1);switch(e){case 0:await vn.settled([t?.whenFlushed()??Promise.resolve(),o?.whenFlushed()??Promise.resolve(),n?.whenFlushed()??Promise.resolve(),r?.whenFlushed()??Promise.resolve()]);break;case 1:await vn.settled([t?.flush(0)??Promise.resolve(),o?.flush(0)??Promise.resolve(),n?.flush(0)??Promise.resolve(),r?.flush(0)??Promise.resolve()]);break}}async log(){let e=this.getStorage(-1)?.items??new Map,t=this.getStorage(-2)?.items??new Map,o=this.getStorage(0)?.items??new Map,n=this.getStorage(1)?.items??new Map;return $5o(e,t,o,n,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,t){return this.emitWillSaveState(0),QF(e)?this.switchToProfile(e,t):this.switchToWorkspace(e,t)}canSwitchProfile(e,t){return!(e.id===t.id||Gke(t)&&Gke(e))}switchData(e,t,o){this.withPausedEmitters(()=>{let n=new Set;for(let[r,s]of e)n.add(r),t.get(r)!==s&&this.emitDidChangeValue(o,{key:r,external:!0});for(let[r]of t.items)n.has(r)||this.emitDidChangeValue(o,{key:r,external:!0})})}};function Gke(a){return a.isDefault||!!a.useDefaultFlags?.globalState}var kkt=class extends Vde{constructor(){super();this.applicationStorage=this._register(new Gk(new Nde,{hint:1}));this.applicationSharedStorage=this._register(new Gk(new Nde,{hint:1}));this.profileStorage=this._register(new Gk(new Nde,{hint:1}));this.workspaceStorage=this._register(new Gk(new Nde,{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 $5o(a,i,e,t,o,n,r,s){let l=x=>{try{return JSON.parse(x)}catch{return x}},c=new Map,u=new Map;a.forEach((x,E)=>{c.set(E,x),u.set(E,l(x))});let p=new Map,h=new Map;i.forEach((x,E)=>{p.set(E,x),h.set(E,l(x))});let g=new Map,f=new Map;e.forEach((x,E)=>{g.set(E,x),f.set(E,l(x))});let v=new Map,b=new Map;t.forEach((x,E)=>{v.set(E,x),b.set(E,l(x))}),console.group(o!==r?`Storage: Application (path: ${o})`:`Storage: Application & Profile (path: ${o}, default profile)`);let S=[];c.forEach((x,E)=>{S.push({key:E,value:x})}),console.table(S),console.groupEnd(),console.log(u),console.group(`Storage: Application Shared (path: ${n})`);let y=[];if(p.forEach((x,E)=>{y.push({key:E,value:x})}),console.table(y),console.groupEnd(),console.log(h),o!==r){console.group(`Storage: Profile (path: ${r}, profile specific)`);let x=[];g.forEach((E,M)=>{x.push({key:M,value:E})}),console.table(x),console.groupEnd(),console.log(f)}console.group(`Storage: Workspace (path: ${s})`);let w=[];v.forEach((x,E)=>{w.push({key:E,value:x})}),console.table(w),console.groupEnd(),console.log(b)}function Ekt(a,i){let e={...i};for(let t in a){let o=a[t];e[t]=o!==void 0?Tt(o):void 0}return e}var qk={keybindingLabelBackground:Tt(K7i),keybindingLabelForeground:Tt(G7i),keybindingLabelBorder:Tt(q7i),keybindingLabelBottomBorder:Tt($7i),keybindingLabelShadow:Tt(_F)};var Ro={buttonForeground:Tt(Fk),buttonSeparator:Tt(lyt),buttonBackground:Tt(th),buttonHoverBackground:Tt(T5),buttonSecondaryForeground:Tt(Gce),buttonSecondaryBackground:Tt(_5),buttonSecondaryHoverBackground:Tt(qce),buttonSecondaryBorder:Tt(dX),buttonBorder:Tt(dX)};var oC={progressBarBackground:Tt(N9i)};var zh={inputActiveOptionBorder:Tt(PB),inputActiveOptionForeground:Tt(E5),inputActiveOptionBackground:Tt(AB)},FHr={activeForeground:Tt(BCe),activeBackground:Tt(O7i),activeBorder:Tt(F7i),inactiveForeground:Tt(W7i),inactiveBackground:Tt(V7i),inactiveBorder:Tt(B7i),inactiveHoverBackground:Tt(H7i)};function peo(a){return Ekt(a,zh)}var Ag={checkboxBackground:Tt(HCe),checkboxBorder:Tt(cyt),checkboxForeground:Tt(UCe),checkboxDisabledBackground:Tt(U7i),checkboxDisabledForeground:Tt(z7i)},meo={dialogBackground:Tt(qu),dialogForeground:Tt(vT),dialogShadow:Tt(_F),dialogBorder:Tt(SD),errorIconForeground:Tt(s7i),warningIconForeground:Tt(a7i),infoIconForeground:Tt(l7i),textLinkForeground:Tt(AS)};var Wl={inputBackground:Tt(Hf),inputForeground:Tt(IT),inputBorder:Tt(LI),inputValidationInfoBorder:Tt(L7i),inputValidationInfoBackground:Tt(D7i),inputValidationInfoForeground:Tt(R7i),inputValidationWarningBorder:Tt(A7i),inputValidationWarningBackground:Tt(M7i),inputValidationWarningForeground:Tt(P7i),inputValidationErrorBorder:Tt(ayt),inputValidationErrorBackground:Tt(ryt),inputValidationErrorForeground:Tt(syt)};function MD(a){return Ekt(a,Wl)}var heo={listFilterWidgetBackground:Tt(I7i),listFilterWidgetOutline:Tt(y7i),listFilterWidgetNoMatchesOutline:Tt(w7i),listFilterWidgetShadow:Tt(C7i),inputBoxStyles:Wl,toggleStyles:zh},VI={badgeBackground:Tt(Gv),badgeForeground:Tt(gx),badgeBorder:Tt(Ei)};var YF={breadcrumbsBackground:Tt(o7i),breadcrumbsForeground:Tt(i7i),breadcrumbsHoverForeground:Tt(dsi),breadcrumbsFocusForeground:Tt(dsi),breadcrumbsFocusAndSelectionForeground:Tt(n7i)};var iJ={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:Tt(lX),listFocusForeground:Tt(FCe),listFocusOutline:Tt(F3e),listActiveSelectionBackground:Tt(Kw),listActiveSelectionForeground:Tt(ID),listActiveSelectionIconForeground:Tt(ZIt),listFocusAndSelectionOutline:Tt(g7i),listFocusAndSelectionBackground:Tt(Kw),listFocusAndSelectionForeground:Tt(ID),listInactiveSelectionBackground:Tt(bv),listInactiveSelectionIconForeground:Tt(f7i),listInactiveSelectionForeground:Tt(eyt),listInactiveFocusBackground:Tt(tyt),listInactiveFocusOutline:Tt(v7i),listHoverBackground:Tt(ST),listHoverForeground:Tt(WCe),listDropOverBackground:Tt(iyt),listDropBetweenBackground:Tt(b7i),listSelectionOutline:Tt(la),listHoverOutline:Tt(la),treeIndentGuidesStroke:Tt(VCe),treeInactiveIndentGuidesStroke:Tt(E7i),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:Tt(Xz),tableColumnsBorder:Tt(T7i),tableOddRowsBackgroundColor:Tt(W3e)};function WS(a){return Ekt(a,iJ)}var nC={selectBackground:Tt(iK),selectListBackground:Tt(N7i),selectForeground:Tt(Kce),decoratorRightForeground:Tt(uyt),selectBorder:Tt(RF),focusBorder:Tt(Kc),listFocusBackground:Tt(nK),listInactiveSelectionIconForeground:Tt(KCe),listFocusForeground:Tt(oK),listFocusOutline:tX(la,Ue.transparent.toString()),listHoverBackground:Tt(ST),listHoverForeground:Tt(WCe),listHoverOutline:Tt(la),selectListBorder:Tt(bT),listBackground:void 0,listActiveSelectionBackground:void 0,listActiveSelectionForeground:void 0,listActiveSelectionIconForeground:void 0,listFocusAndSelectionBackground:void 0,listDropOverBackground:void 0,listDropBetweenBackground:void 0,listInactiveSelectionBackground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusBackground:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listFocusAndSelectionForeground:void 0,listFocusAndSelectionOutline:void 0,listInactiveFocusForeground:void 0,tableColumnsBorder:void 0,tableOddRowsBackgroundColor:void 0,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0};function Tkt(a){return Ekt(a,nC)}var _kt={shadowColor:Tt(_F),borderColor:tX(j7i,bT),foregroundColor:Tt(Q7i),backgroundColor:Tt(Y7i),selectionForegroundColor:Tt(WCe),selectionBackgroundColor:Tt(ST),selectionBorderColor:Tt(X7i),separatorColor:Tt(J7i),scrollbarShadow:Tt(Xz),scrollbarSliderBackground:Tt(iX),scrollbarSliderHoverBackground:Tt(Jz),scrollbarSliderActiveBackground:Tt(Zz)};var geo=["#007acc","#005a9e","#0098ff","#4fc3f7","#64b5f6","#42a5f5"],TQe;function Dkt(a){if(TQe)return;let i=a.getBoundingClientRect(),e=Me(a).document,t=_(".animation-overlay");return t.style.position="fixed",t.style.left=`${i.left}px`,t.style.top=`${i.top}px`,t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,t.style.pointerEvents="none",t.style.overflow="visible",t.style.zIndex="10000",e.body.appendChild(t),TQe=t,{overlay:t,cx:i.width/2,cy:i.height/2}}function Rkt(a){setTimeout(()=>{TQe&&(TQe.remove(),TQe=void 0)},a)}function Lkt(a,i){let e=[],t=Math.max(i.scale?.length??0,i.rotate?.length??0,i.translateY?.length??0);if(t!==0){for(let o=0;o<t;o++){let n={offset:t===1?1:o/(t-1)},r="",s=i.scale?.[o];s!==void 0&&(r+=`scale(${s})`);let l=i.rotate?.[o];l!==void 0&&(r+=` rotate(${l}deg)`);let c=i.translateY?.[o];c!==void 0&&(r+=` translateY(${c}px)`),r&&(n.transform=r.trim()),e.push(n)}a.animate(e,{duration:i.duration??350,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}}function j5o(a){let i=Dkt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i,n=a.getBoundingClientRect();Lkt(a,{scale:[1,1.3,1],rotate:[0,-10,10,0],duration:350});let r=10;for(let l=0;l<r;l++){let c=3+l%3*1.5,u=l*36*Math.PI/180,p=35,h=.6+l%4*.1,g=_(".animation-particle");g.style.position="absolute",g.style.width=`${c}px`,g.style.height=`${c}px`,g.style.borderRadius="50%",g.style.backgroundColor=geo[l%geo.length],g.style.left=`${t-c/2}px`,g.style.top=`${o-c/2}px`,e.appendChild(g);let f=Math.cos(u)*p,v=Math.sin(u)*p;g.animate([{opacity:0,transform:"scale(0) translate(0, 0)"},{opacity:h,transform:`scale(1) translate(${f*.5}px, ${v*.5}px)`,offset:.3},{opacity:h,transform:`scale(1) translate(${f}px, ${v}px)`,offset:.7},{opacity:0,transform:`scale(0) translate(${f}px, ${v}px)`}],{duration:1100,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let s=_(".animation-particle");s.style.position="absolute",s.style.left="0",s.style.top="0",s.style.width=`${n.width}px`,s.style.height=`${n.height}px`,s.style.borderRadius="50%",s.style.border="2px solid var(--vscode-focusBorder, #007acc)",s.style.boxSizing="border-box",e.appendChild(s),s.animate([{transform:"scale(1)",opacity:1},{transform:"scale(2)",opacity:0}],{duration:800,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),Rkt(2e3)}function Q5o(a,i){let e=Dkt(a);if(!e)return;let{overlay:t,cx:o,cy:n}=e,r=a.getBoundingClientRect();Lkt(a,{translateY:[0,-6,0],duration:350});let s=6;for(let c=0;c<s;c++){let u=12+c%3*2,p=_(".animation-particle");p.style.position="absolute",p.style.left=`${o}px`,p.style.top=`${n}px`,p.style.fontSize=`${u}px`,p.style.lineHeight="1",p.style.color="var(--vscode-focusBorder, #007acc)",p.classList.add(...q.asClassNameArray(i)),t.appendChild(p);let h=(Math.random()-.5)*50,g=-50-c%3*10,f=(Math.random()-.5)*20,v=(Math.random()-.5)*40;p.animate([{opacity:0,transform:`translate(-50%, -50%) scale(0) rotate(${f}deg)`},{opacity:1,transform:`translate(calc(-50% + ${h*.3}px), calc(-50% + ${g*.3}px)) scale(1) rotate(${(f+v)*.3}deg)`,offset:.3},{opacity:1,transform:`translate(calc(-50% + ${h*.7}px), calc(-50% + ${g*.7}px)) scale(1) rotate(${(f+v)*.7}deg)`,offset:.7},{opacity:0,transform:`translate(calc(-50% + ${h}px), calc(-50% + ${g}px)) scale(0.8) rotate(${v}deg)`}],{duration:800+c%3*200,delay:c*80,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let l=_(".animation-particle");l.style.position="absolute",l.style.left="0",l.style.top="0",l.style.width=`${r.width}px`,l.style.height=`${r.height}px`,l.style.borderRadius="50%",l.style.border="2px solid var(--vscode-focusBorder, #007acc)",l.style.boxSizing="border-box",t.appendChild(l),l.animate([{transform:"scale(1)",opacity:1},{transform:"scale(2)",opacity:0}],{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),Rkt(2e3)}function Y5o(a){let i=Dkt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i,n=a.getBoundingClientRect();Lkt(a,{scale:[1,1.1,1],rotate:[0,-12,0],duration:400});for(let s=0;s<2;s++){let l=_(".animation-particle");l.style.position="absolute",l.style.left="0",l.style.top="0",l.style.width=`${n.width}px`,l.style.height=`${n.height}px`,l.style.borderRadius="50%",l.style.border="2px solid var(--vscode-focusBorder, #007acc)",l.style.boxSizing="border-box",e.appendChild(l),l.animate([{transform:"scale(0.8)",opacity:0},{transform:"scale(0.8)",opacity:.6,offset:.01},{transform:"scale(2.5)",opacity:0}],{duration:800,delay:s*150,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}for(let s=0;s<6;s++){let l=s*60*Math.PI/180,c=30+s%2*10,u=3.5,p=_(".animation-particle");p.style.position="absolute",p.style.width=`${u}px`,p.style.height=`${u}px`,p.style.borderRadius="50%",p.style.backgroundColor="#0098ff",p.style.left=`${t-u/2}px`,p.style.top=`${o-u/2}px`,e.appendChild(p);let h=Math.cos(l)*c,g=Math.sin(l)*c;p.animate([{opacity:0,transform:"scale(0) translate(0, 0)"},{opacity:1,transform:`scale(1) translate(${h}px, ${g}px)`,offset:.5},{opacity:0,transform:`scale(0) translate(${h}px, ${g}px)`}],{duration:600,delay:100+s*50,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}let r=_(".animation-particle");r.style.position="absolute",r.style.left="0",r.style.top="0",r.style.width=`${n.width}px`,r.style.height=`${n.height}px`,r.style.borderRadius="50%",r.style.backgroundColor="var(--vscode-focusBorder, #007acc)",e.appendChild(r),r.animate([{transform:"scale(0.9)",opacity:0},{transform:"scale(0.9)",opacity:.5,offset:.01},{transform:"scale(1.5)",opacity:0}],{duration:500,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"}),Rkt(2e3)}function X5o(a){let i=Dkt(a);if(!i)return;let{overlay:e,cx:t,cy:o}=i;Lkt(a,{scale:[1,1.15,1],duration:350});for(let n=0;n<8;n++){let l=(n*45+22.5)*Math.PI/180,c=14,u=30,p=_(".animation-particle");p.style.position="absolute",p.style.width="3px",p.style.height="3px",p.style.borderRadius="50%",p.style.backgroundColor="var(--vscode-editor-foreground, #ffffff)",p.style.left=`${t-3/2}px`,p.style.top=`${o-3/2}px`,e.appendChild(p);let h=Math.cos(l)*c,g=Math.sin(l)*c,f=Math.cos(l)*u,v=Math.sin(l)*u;p.animate([{opacity:0,transform:`scale(0) translate(${h}px, ${g}px)`},{opacity:.7,transform:`scale(1.2) translate(${(h+f)/2}px, ${(g+v)/2}px)`,offset:.25},{opacity:.7,transform:`scale(1) translate(${f*.8}px, ${v*.8}px)`,offset:.5},{opacity:.7*.5,transform:`scale(1) translate(${f}px, ${v}px)`,offset:.75},{opacity:0,transform:`scale(0.5) translate(${f}px, ${v}px)`}],{duration:1100,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}for(let n=0;n<8;n++){let r=n*45,s=_(".animation-particle");s.style.position="absolute",s.style.left=`${t}px`,s.style.top=`${o}px`,s.style.width="0",s.style.height="0",s.style.transform=`rotate(${r}deg)`,e.appendChild(s);let l=_(".animation-particle");l.style.position="absolute",l.style.width="2px",l.style.height="10px",l.style.backgroundColor="var(--vscode-focusBorder, #007acc)",l.style.left="-1px",l.style.top="-22px",l.style.transformOrigin="bottom center",s.appendChild(l),l.animate([{transform:"scale(1, 0)",opacity:.6},{transform:"scale(1, 1)",opacity:.6,offset:.2},{transform:"scale(1, 1)",opacity:.6,offset:.6},{transform:"scale(1, 1)",opacity:.6,offset:.8},{transform:"scale(0, 0.3)",opacity:0}],{duration:1200,delay:150,easing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"forwards"})}Rkt(2e3)}function feo(a,i,e){switch(i){case 1:j5o(a);break;case 2:e&&Q5o(a,e);break;case 3:Y5o(a);break;case 4:X5o(a);break}}var qke={WIDTH:400,WIDTH_WITH_VERTICAL_PANEL:600,HEIGHT:270};function veo(a){return typeof a.parentId=="number"}function $ke(a){return!!a.workspaceUri}function beo(a){return!!a.folderUri}function Seo(a){return!!a.fileUri}function BI(a,i){if(Ft)return!1;let e=yx(a,i),t=a.getValue("window");return t?.menuStyle==="native"?!(!et&&!e):t?.menuStyle==="custom"?!1:e}function XF(a,i){return Ft?!1:et?!0:BI(a,i)}function sM(a){let i=a.getValue("window.menuBarVisibility");return i==="default"||i==="compact"&&XF(a)||et&&Qr?"classic":i}function JF(a,i){return!0}function yx(a,i){return i||(i=oJ(a)),i==="native"}function oJ(a){if(Ft)return"custom";let i=a.getValue("window");if(i){if(et&&i.nativeTabs===!0||et&&i.nativeFullScreen===!1)return"native";let o=i.titleBarStyle;if(o==="native"||o==="custom")return o}return"custom"}function _Qe(a){if(Ft||et||oJ(a)==="native")return"native";let e=a.getValue("window")?.controlsStyle;return e==="custom"||e==="hidden"?e:"native"}var nJ=35;function jke(a){if(Ft||yx(a))return!1;if(!et){let i=_Qe(a);if(i==="custom"||i==="hidden")return!1}return!0}function Bde(a=0){return 1.2**a}var Ldi={width:1200,height:800},Mdi={width:1440,height:900},Mkt={width:1024,height:768};function um(a,i){let e={primary:[],secondary:[]};return Ieo(a,e,i),e}function Lu(a,i){let e=[];return Ieo(a,e,i),e}function Ieo(a,i,e){let t=Ab.getInstance(),o=t.keyStatus.altKey||(ii||Sn)&&t.keyStatus.shiftKey;yeo(a,i,o,e?n=>n===e:n=>n==="navigation")}function xl(a,i,e,t){let o={primary:[],secondary:[]};return $B(a,o,i,e,t),o}function Ng(a,i,e,t){let o=[];return $B(a,o,i,e,t),o}function $B(a,i,e,t,o){yeo(a,i,!1,typeof e=="string"?r=>r===e:e,t,o)}function yeo(a,i,e,t=r=>r==="navigation",o=()=>!1,n=!1){let r,s;Array.isArray(i)?(r=i,s=i):(r=i.primary,s=i.secondary);let l=new Set;for(let[c,u]of a){let p;t(c)?(p=r,p.length>0&&n&&p.push(new oi)):(p=s,p.length>0&&p.push(new oi));for(let h of u){e&&(h=h instanceof Do&&h.alt?h.alt:h);let g=p.push(h);h instanceof sa&&l.add({group:c,action:h,index:g-1})}}for(let{group:c,action:u,index:p}of l){let h=t(c)?r:s,g=u.actions;o(u,c,h.length)&&h.splice(p,1,...g)}}var Cl=class extends ts{constructor(e,t,o,n,r,s,l,c){super(void 0,e,{icon:!!(e.class||e.item.icon),label:!e.class&&!e.item.icon,draggable:t?.draggable,keybinding:t?.keybinding,hoverDelegate:t?.hoverDelegate,keybindingNotRenderedWithLabel:t?.keybindingNotRenderedWithLabel});this._options=t;this._keybindingService=o;this._notificationService=n;this._contextKeyService=r;this._themeService=s;this._contextMenuService=l;this._accessibilityService=c;this._wantsAltCommand=!1;this._itemClassDispose=this._register(new ue);this._altKey=Ab.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}async onClick(e){if(e.preventDefault(),e.stopPropagation(),this._options?.onClickAnimation&&this.element&&!this._accessibilityService.isMotionReduced()){let t=this._menuItemAction.item.icon;feo(this.element,this._options.onClickAnimation,q.isThemeIcon(t)?t:void 0)}try{await this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}render(e){if(super.render(e),e.classList.add("menu-entry"),this.options.icon&&this._updateItemClass(this._menuItemAction.item),this._menuItemAction.alt){let t=!1,o=()=>{let n=!!this._menuItemAction.alt?.enabled&&(!this._accessibilityService.isMotionReduced()||t)&&(this._altKey.keyStatus.altKey||this._altKey.keyStatus.shiftKey&&t);n!==this._wantsAltCommand&&(this._wantsAltCommand=n,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._register(this._altKey.event(o)),this._register($(e,"mouseleave",n=>{t=!1,o()})),this._register($(e,"mouseenter",n=>{t=!0,o()})),o()}}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}getTooltip(){let e=this._commandAction.tooltip||this._commandAction.label,t=this._keybindingService.appendKeybinding(e,this._commandAction.id,this._contextKeyService);if(!this._wantsAltCommand&&this._menuItemAction.alt?.enabled){let o=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,n=this._keybindingService.appendKeybinding(o,this._menuItemAction.alt.id,this._contextKeyService);t=d(1824,null,t,nM.modifierLabels[Ao].altKey,n)}return t}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){this._itemClassDispose.value=void 0;let{element:t,label:o}=this;if(!t||!o)return;let n=this._commandAction.checked&&Uke(e.toggled)&&e.toggled.icon?e.toggled.icon:e.icon;if(n)if(q.isThemeIcon(n)){let r=q.asClassNameArray(n);o.classList.add(...r),this._itemClassDispose.value=ee(()=>{o.classList.remove(...r)})}else o.style.backgroundImage=cm(this._themeService.getColorTheme().type)?cl(n.dark):cl(n.light),o.classList.add("icon"),this._itemClassDispose.value=Fn(ee(()=>{o.style.backgroundImage="",o.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}};Cl=I([m(2,Le),m(3,Ne),m(4,X),m(5,Pe),m(6,Xe),m(7,Ai)],Cl);var Pkt=class a extends Cl{render(i){this.options.label=!0,this.options.icon=!1,super.render(i),i.classList.add("text-only"),i.classList.toggle("use-comma",this._options?.useComma??!1)}updateLabel(){let i=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!i)return super.updateLabel();if(this.label){let e=a._symbolPrintEnter(i);this._options?.conversational?this.label.textContent=d(1823,null,this._action.label,e):this.label.textContent=d(1822,null,this._action.label,e)}}static _symbolPrintEnter(i){return i.getLabel()?.replace(/\benter\b/gi,"\u23CE").replace(/\bEscape\b/gi,"Esc")}},FT=class extends rh{constructor(e,t,o,n,r){let s={...t,menuAsChild:t?.menuAsChild??!1,classNames:t?.classNames??(q.isThemeIcon(e.item.icon)?q.asClassName(e.item.icon):void 0),keybindingProvider:t?.keybindingProvider??(l=>o.lookupKeybinding(l.id))};super(e,{getActions:()=>e.actions},n,s);this._keybindingService=o;this._contextMenuService=n;this._themeService=r}render(e){super.render(e),To(this.element),e.classList.add("menu-entry");let t=this._action,{icon:o}=t.item;if(o&&!q.isThemeIcon(o)){this.element.classList.add("icon");let n=()=>{this.element&&(this.element.style.backgroundImage=cm(this._themeService.getColorTheme().type)?cl(o.dark):cl(o.light))};n(),this._register(this._themeService.onDidColorThemeChange(()=>{n()}))}}};FT=I([m(2,Le),m(3,Xe),m(4,Pe)],FT);var DQe=class extends Ja{constructor(e,t,o,n,r,s,l,c){super(null,e);this._keybindingService=o;this._notificationService=n;this._contextMenuService=r;this._menuService=s;this._instaService=l;this._storageService=c;this._defaultActionDisposables=this._register(new O);this._container=null;this._primaryActionListener=this._register(new ue);this._options=t,this._storageKey=`${e.item.submenu.id}_lastActionId`;let u,p=t?.togglePrimaryAction?c.get(this._storageKey,1):void 0;p&&(u=e.actions.find(g=>p===g.id)),u||(u=e.actions[0]),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(Cl,u,{keybinding:this._getDefaultActionKeybindingLabel(u)}));let h={keybindingProvider:g=>this._keybindingService.lookupKeybinding(g.id),...t,menuAsChild:t?.menuAsChild??!0,classNames:t?.classNames??["codicon","codicon-chevron-down"],actionRunner:t?.actionRunner??this._register(new cs)};this._dropdown=this._register(new rh(e,e.actions,this._contextMenuService,h)),t?.togglePrimaryAction&&this.registerTogglePrimaryActionListener()}get onDidChangeDropdownVisibility(){return this._dropdown.onDidChangeVisibility}registerTogglePrimaryActionListener(){this._primaryActionListener.value=this._dropdown.actionRunner.onDidRun(e=>{e.action instanceof Do&&this.update(e.action)})}update(e){this._options?.togglePrimaryAction&&this._storageService.store(this._storageKey,e.id,1,1),this._defaultActionDisposables.clear(),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(Cl,e,{keybinding:this._getDefaultActionKeybindingLabel(e)})),this._defaultAction.actionRunner=this._defaultActionDisposables.add(new class extends cs{async runAction(t,o){await t.run(void 0)}}),this._container&&this._defaultAction.render(CI(this._container,_(".action-container")))}_getDefaultActionKeybindingLabel(e){let t;if(this._options?.renderKeybindingWithDefaultActionLabel){let o=this._keybindingService.lookupKeybinding(e.id);o&&(t=`(${o.getLabel()})`)}return t}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}set actionRunner(e){super.actionRunner=e,this._defaultAction.actionRunner=e,this._options?.togglePrimaryAction||(this._dropdown.actionRunner=e),this._primaryActionListener.value&&this.registerTogglePrimaryActionListener()}get actionRunner(){return super.actionRunner}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");let t=_(".action-container");this._defaultAction.render(D(this._container,t)),this._register($(t,ne.KEY_DOWN,n=>{let r=new mi(n);r.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),r.stopPropagation())}));let o=_(".dropdown-action-container");this._dropdown.render(D(this._container,o)),this._register($(o,ne.KEY_DOWN,n=>{let r=new mi(n);r.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._defaultAction.element?.focus(),r.stopPropagation())}))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}};DQe=I([m(2,Le),m(3,Ne),m(4,Xe),m(5,Yt),m(6,F),m(7,de)],DQe);var RQe=class extends NK{constructor(i,e,t){super(null,i,i.actions.map(o=>o.id===oi.ID?GF:{text:o.label,isDisabled:!o.enabled}),0,e,nC,{ariaLabel:i.tooltip||i.label,optionsAsChildren:!0,useCustomDrawn:!BI(t)}),this.select(Math.max(0,i.actions.findIndex(o=>o.checked)))}render(i){super.render(i),i.style.borderColor=Tt(RF)}runAction(i,e){let t=this.action.actions[e];t&&this.actionRunner.run(t)}};RQe=I([m(1,qn),m(2,B)],RQe);function ta(a,i,e){return i instanceof Do?a.createInstance(Cl,i,e):i instanceof id?i.item.isSelection?a.createInstance(RQe,i):i.item.isSplitButton?a.createInstance(DQe,i,{...e,togglePrimaryAction:typeof i.item.isSplitButton!="boolean"?i.item.isSplitButton.togglePrimaryAction:!1}):a.createInstance(FT,i,e):void 0}var Qke=class extends k{constructor(e,t,o){super();this._commandService=e;this._keybindingService=t;this._hiddenStates=this._register(new FK(o))}createMenu(e,t,o){return new Yke(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...o},this._commandService,this._keybindingService,t)}getMenuActions(e,t,o){let n=new Yke(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...o},this._commandService,this._keybindingService,t),r=n.getActions(o);return n.dispose(),r}getMenuContexts(e){let t=new Akt(e,!1);return new Set([...t.structureContextKeys,...t.preconditionContextKeys,...t.toggledContextKeys])}resetHiddenStates(e){this._hiddenStates.reset(e)}};Qke=I([m(0,fe),m(1,Le),m(2,de)],Qke);var FK=class{constructor(i){this._storageService=i;this._disposables=new O;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._ignoreChangeEvent=!1;this._hiddenByDefaultCache=new Map;try{let e=i.get(FK._key,0,"{}");this._data=JSON.parse(e)}catch{this._data=Object.create(null)}this._disposables.add(i.onDidChangeValue(0,FK._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{let e=i.get(FK._key,0,"{}");this._data=JSON.parse(e)}catch(e){console.log("FAILED to read storage after UPDATE",e)}this._onDidChange.fire()}))}static{this._key="menu.hiddenCommands"}dispose(){this._onDidChange.dispose(),this._disposables.dispose()}_isHiddenByDefault(i,e){return this._hiddenByDefaultCache.get(`${i.id}/${e}`)??!1}setDefaultState(i,e,t){this._hiddenByDefaultCache.set(`${i.id}/${e}`,t)}isHidden(i,e){let t=this._isHiddenByDefault(i,e),o=this._data[i.id]?.includes(e)??!1;return t?!o:o}updateHidden(i,e,t){this._isHiddenByDefault(i,e)&&(t=!t);let n=this._data[i.id];if(t)n?n.indexOf(e)<0&&n.push(e):this._data[i.id]=[e];else if(n){let r=n.indexOf(e);r>=0&&U4i(n,r),n.length===0&&delete this._data[i.id]}this._persist()}reset(i){if(i===void 0)this._data=Object.create(null),this._persist();else{for(let{id:e}of i)this._data[e]&&delete this._data[e];this._persist()}}_persist(){try{this._ignoreChangeEvent=!0;let i=JSON.stringify(this._data);this._storageService.store(FK._key,i,0,0)}finally{this._ignoreChangeEvent=!1}}};FK=I([m(0,de)],FK);var Akt=class a{constructor(i,e){this._id=i;this._collectContextKeysForSubmenus=e;this._menuGroups=[];this._allMenuIds=new Set;this._structureContextKeys=new Set;this._preconditionContextKeys=new Set;this._toggledContextKeys=new Set;this.refresh()}get allMenuIds(){return this._allMenuIds}get structureContextKeys(){return this._structureContextKeys}get preconditionContextKeys(){return this._preconditionContextKeys}get toggledContextKeys(){return this._toggledContextKeys}refresh(){this._menuGroups.length=0,this._allMenuIds.clear(),this._structureContextKeys.clear(),this._preconditionContextKeys.clear(),this._toggledContextKeys.clear();let i=this._sort(be.getMenuItems(this._id)),e;for(let t of i){let o=t.group||"";(!e||e[0]!==o)&&(e=[o,[]],this._menuGroups.push(e)),e[1].push(t),this._collectContextKeysAndSubmenuIds(t)}this._allMenuIds.add(this._id)}_sort(i){return i}_collectContextKeysAndSubmenuIds(i){if(a._fillInKbExprKeys(i.when,this._structureContextKeys),cT(i)){if(i.command.precondition&&a._fillInKbExprKeys(i.command.precondition,this._preconditionContextKeys),i.command.toggled){let e=i.command.toggled.condition||i.command.toggled;a._fillInKbExprKeys(e,this._toggledContextKeys)}}else this._collectContextKeysForSubmenus&&(be.getMenuItems(i.submenu).forEach(this._collectContextKeysAndSubmenuIds,this),this._allMenuIds.add(i.submenu))}static _fillInKbExprKeys(i,e){if(i)for(let t of i.keys())e.add(t)}},m4=class extends Akt{constructor(e,t,o,n,r,s){super(e,o);this._hiddenStates=t;this._commandService=n;this._keybindingService=r;this._contextKeyService=s;this.refresh()}createActionGroups(e){let t=[];for(let o of this._menuGroups){let[n,r]=o,s;for(let l of r)if(this._contextKeyService.contextMatchesRules(l.when)){let c=cT(l);c&&this._hiddenStates.setDefaultState(this._id,l.command.id,!!l.isHiddenByDefault);let u=J5o(this._id,c?l.command:l,this._hiddenStates);if(c){let p=LQe(this._commandService,this._keybindingService,l.command.id,l.when);(s??=[]).push(new Do(l.command,l.alt,e,u,p,this._contextKeyService,this._commandService))}else{let p=new m4(l.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),h=oi.join(...p.map(g=>g[1]));h.length>0&&(s??=[]).push(new id(l,u,h))}}s&&s.length>0&&t.push([n,s])}return t}_sort(e){return e.sort(m4._compareMenuItems)}static _compareMenuItems(e,t){let o=e.group,n=t.group;if(o!==n){if(o){if(!n)return-1}else return 1;if(o==="navigation")return-1;if(n==="navigation")return 1;let l=o.localeCompare(n);if(l!==0)return l}let r=e.order||0,s=t.order||0;return r<s?-1:r>s?1:m4._compareTitles(cT(e)?e.command.title:e.title,cT(t)?t.command.title:t.title)}static _compareTitles(e,t){let o=typeof e=="string"?e:e.original,n=typeof t=="string"?t:t.original;return o.localeCompare(n)}};m4=I([m(3,fe),m(4,Le),m(5,X)],m4);var Yke=class{constructor(i,e,t,o,n,r){this._disposables=new O;this._menuInfo=new m4(i,e,t.emitEventsForSubmenuChanges,o,n,r);let s=new Dt(()=>{this._menuInfo.refresh(),this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!0,isToggleChange:!0})},t.eventDebounceDelay);this._disposables.add(s),this._disposables.add(be.onDidChangeMenu(p=>{for(let h of this._menuInfo.allMenuIds)if(p.has(h)){s.schedule();break}}));let l=this._disposables.add(new O),c=p=>{let h=!1,g=!1,f=!1;for(let v of p)if(h=h||v.isStructuralChange,g=g||v.isEnablementChange,f=f||v.isToggleChange,h&&g&&f)break;return{menu:this,isStructuralChange:h,isEnablementChange:g,isToggleChange:f}},u=()=>{l.add(r.onDidChangeContext(p=>{let h=p.affectsSome(this._menuInfo.structureContextKeys),g=p.affectsSome(this._menuInfo.preconditionContextKeys),f=p.affectsSome(this._menuInfo.toggledContextKeys);(h||g||f)&&this._onDidChange.fire({menu:this,isStructuralChange:h,isEnablementChange:g,isToggleChange:f})})),l.add(e.onDidChange(p=>{this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!1,isToggleChange:!1})}))};this._onDidChange=new Zye({onWillAddFirstListener:u,onDidRemoveLastListener:l.clear.bind(l),delay:t.eventDebounceDelay,merge:c}),this.onDidChange=this._onDidChange.event}getActions(i){return this._menuInfo.createActionGroups(i)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}};Yke=I([m(3,fe),m(4,Le),m(5,X)],Yke);function J5o(a,i,e){let t=VQi(i)?i.submenu.id:i.id,o=typeof i.title=="string"?i.title:i.title.value,n=li({id:`hide/${a.id}/${t}`,label:d(1829,null,o),run(){e.updateHidden(a,t,!0)}}),r=li({id:`toggle/${a.id}/${t}`,label:o,get checked(){return!e.isHidden(a,t)},run(){e.updateHidden(a,t,!!this.checked)}});return{hide:n,toggle:r,get isHidden(){return!r.checked}}}function LQe(a,i,e,t=void 0,o=!0){return li({id:`configureKeybinding/${e}`,label:d(1828,null),enabled:o,run(){let r=!!!i.lookupKeybinding(e)&&t?t.serialize():void 0;a.executeCommand("workbench.action.openGlobalKeybindings",`@command:${e}`+(r?` +when:${r}`:""))}})}var sh=le("IActionViewItemService");var Pdi=class{constructor(){this._providers=new Map;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}register(i,e,t,o){let n=this._makeKey(i,e);if(this._providers.has(n))throw new Error(`A provider for the command ${e} and menu ${i} is already registered.`);this._providers.set(n,t);let r=o?.(()=>{this._onDidChange.fire(i)});return ee(()=>{r?.dispose(),this._providers.delete(n)})}lookUp(i,e){return this._providers.get(this._makeKey(i,e))}_makeKey(i,e){return`${i.id}/${e instanceof R?e.id:e}`}};Ce(sh,Pdi,1);var dl=class extends Kp{constructor(e,t,o,n,r,s,l,c){super(e,r,{getKeyBinding:p=>s.lookupKeybinding(p.id)??void 0,...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"});this._options=t;this._menuService=o;this._contextKeyService=n;this._contextMenuService=r;this._keybindingService=s;this._commandService=l;this._sessionDisposables=this._store.add(new O);let u=t?.telemetrySource;u&&this._store.add(this.actionBar.onDidRun(p=>c.publicLog2("workbenchActionExecuted",{id:p.action.id,from:u})))}setActions(e,t=[],o){this._sessionDisposables.clear();let n=e.slice(),r=t.slice(),s=[],l=0,c=[],u=!1;if(this._options?.hiddenItemStrategy!==-1)for(let p=0;p<n.length;p++){let h=n[p];!(h instanceof Do)&&!(h instanceof id)||h.hideActions&&(s.push(h.hideActions.toggle),h.hideActions.toggle.checked&&l++,h.hideActions.isHidden&&(u=!0,n[p]=void 0,this._options?.hiddenItemStrategy!==0&&(c[p]=h)))}if(this._options?.overflowBehavior!==void 0){let p=uvt(new Set(this._options.overflowBehavior.exempted),yt.map(n,f=>f?.id)),h=this._options.overflowBehavior.maxItems-p.size,g=0;for(let f=0;f<n.length;f++){let v=n[f];v&&(g++,!p.has(v.id)&&g>=h&&(n[f]=void 0,c[f]=v))}}Wj(n),Wj(c),super.setActions(oi.clean(n),oi.join(c,r)),(s.length>0||n.length>0)&&this._sessionDisposables.add($(this.getElement(),"contextmenu",p=>{let h=new Ln(Me(this.getElement()),p),g=this.getItemAction(h.target);if(!g)return;h.preventDefault(),h.stopPropagation();let f=[];if(g instanceof Do&&g.menuKeybinding)f.push(g.menuKeybinding);else if(!(g instanceof id||g instanceof Ade)){let b=!!this._keybindingService.lookupKeybinding(g.id);f.push(LQe(this._commandService,this._keybindingService,g.id,void 0,b))}if(s.length>0){let b=!1;if(l===1&&this._options?.hiddenItemStrategy===0){b=!0;for(let S=0;S<s.length;S++)if(s[S].checked){s[S]=li({id:g.id,label:g.label,checked:!0,enabled:!1,run(){}});break}}if(!b&&(g instanceof Do||g instanceof id)){if(!g.hideActions)return;f.push(g.hideActions.hide)}else f.push(li({id:"label",label:d(1825,null),enabled:!1,run(){}}))}let v=oi.join(f,s);this._options?.resetMenu&&!o&&(o=[this._options.resetMenu]),u&&o&&(v.push(new oi),v.push(li({id:"resetThisMenu",label:d(1826,null),run:()=>this._menuService.resetHiddenStates(o)}))),v.length!==0&&this._contextMenuService.showContextMenu({getAnchor:()=>h,getActions:()=>v,menuId:this._options?.contextMenu,menuActionOptions:{renderShortTitle:!0,...this._options?.menuOptions},skipTelemetry:typeof this._options?.telemetrySource=="string",contextKeyService:this._contextKeyService})}))}};dl=I([m(2,Yt),m(3,X),m(4,Xe),m(5,Le),m(6,fe),m(7,_e)],dl);var pr=class extends dl{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{resetMenu:t,...o,actionViewItemProvider:(g,f)=>{let v=p.lookUp(t,g instanceof id?g.item.submenu.id:g.id);v||(v=o?.actionViewItemProvider);let b=v?.(g,f,h,Me(e).vscodeWindowId);return b||ta(h,g,f)}},n,r,s,l,c,u);this._onDidChangeMenuItems=this._store.add(new T);this._container=e,this._menuOptions=o?.menuOptions,this._toolbarOptions=o?.toolbarOptions,this._menu=this._store.add(n.createMenu(t,r,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:o?.eventDebounceDelay})),this._store.add(this._menu.onDidChange(()=>{this._updateToolbar(),this._onDidChangeMenuItems.fire(this)})),this._store.add(p.onDidChange(g=>{g===t&&this._updateToolbar()})),this._updateToolbar()}get onDidChangeMenuItems(){return this._onDidChangeMenuItems.event}_updateToolbar(){let{primary:e,secondary:t}=xl(this._menu.getActions(this._menuOptions),this._toolbarOptions?.primaryGroup,this._toolbarOptions?.shouldInlineSubmenu,this._toolbarOptions?.useSeparatorsInPrimaryActions);this._container.classList.toggle("has-no-actions",e.length===0&&t.length===0),super.setActions(e,t)}refresh(){this._updateToolbar()}setActions(){throw new ci("This toolbar is populated from a menu.")}};pr=I([m(3,Yt),m(4,X),m(5,Xe),m(6,Le),m(7,fe),m(8,_e),m(9,sh),m(10,F)],pr);var ot=le("hoverService"),Kf=class extends k{constructor(e,t,o={},n,r){super();this.placement=e;this.hoverOptions=t;this.overrideOptions=o;this.configurationService=n;this.hoverService=r;this.lastHoverHideTime=0;this.timeLimit=200;this.hoverDisposables=this._register(new O);this._delay=this.configurationService.getValue("workbench.hover.delay"),this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration("workbench.hover.delay")&&(this._delay=this.configurationService.getValue("workbench.hover.delay"))}))}get delay(){return this.isInstantlyHovering()?0:this.hoverOptions?.dynamicDelay?e=>this.hoverOptions?.dynamicDelay?.(e)??this._delay:this._delay}showHover(e,t){let o=typeof this.overrideOptions=="function"?this.overrideOptions(e,t):this.overrideOptions;this.hoverDisposables.clear();let n=go(e.target)?[e.target]:e.target.targetElements;for(let s of n)this.hoverDisposables.add(Yo(s,"keydown",l=>{l.equals(9)&&this.hoverService.hideHover()}));let r=go(e.content)?void 0:typeof e.content=="string"?e.content.toString():e.content.value;return this.hoverService.showInstantHover({...e,...o,persistence:{hideOnKeyDown:!0,...o.persistence},id:r,appearance:{...e.appearance,compact:!0,skipFadeInAnimation:this.isInstantlyHovering(),...o.appearance}},t)}isInstantlyHovering(){return!!this.hoverOptions?.instantHover&&Date.now()-this.lastHoverHideTime<this.timeLimit}setInstantHoverTimeLimit(e){if(!this.hoverOptions?.instantHover)throw new Error("Instant hover is not enabled");this.timeLimit=e}onDidHideHover(){this.hoverDisposables.clear(),this.hoverOptions?.instantHover&&(this.lastHoverHideTime=Date.now())}};Kf=I([m(3,B),m(4,ot)],Kf);var rC={showHover:function(){throw new Error("Native hover function not implemented.")},delay:0,showNativeHover:!0};var aM=class extends qY{constructor(e){super();this._textModel=e}getValueOfRange(e){return this._textModel.getValueInRange(e)}getLineLength(e){return this._textModel.getLineLength(e)}get length(){let e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new Rc(e-1,t)}};var Xke=class extends cs{constructor(e){super();this._getContext=e}runAction(e,t){let o=this._getContext();return super.runAction(e,o)}};var Nkt=class extends k{constructor(e,t,o){super();this._editor=e;this._domNode=t;this.itemProvider=o;this.scrollTop=vi(this,this._editor.onDidScrollChange,s=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(s=>s===0),this.modelAttached=vi(this,this._editor.onDidChangeModel,s=>this._editor.hasModel()),this.editorOnDidChangeViewZones=qr("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=qr("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=zc("domNodeSizeChanged"),this.views=this._register(new Ot),this._domNode.className="gutter monaco-editor";let n=this._domNode.appendChild(st("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),r=new ResizeObserver(()=>{Ki(s=>{this.domNodeSizeChanged.trigger(s)})});r.observe(this._domNode),this._register(ee(()=>r.disconnect())),this._register(ve(s=>{n.className=this.isScrollTopZero.read(s)?"":"scroll-decoration"})),this._register(ve(s=>this.render(s)))}dispose(){super.dispose(),Ii(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);let t=this.scrollTop.read(e),o=this._editor.getVisibleRanges(),n=new Set(this.views.keys()),r=gi.ofStartAndLength(0,this._domNode.clientHeight);if(!r.isEmpty)for(let s of o){let l=new vo(s.startLineNumber,s.endLineNumber+1),c=this.itemProvider.getIntersectingGutterItems(l,e);Ki(u=>{for(let p of c){if(!p.range.intersect(l))continue;n.delete(p.id);let h=this.views.get(p.id);if(h)h.item.set(p,u);else{let b=document.createElement("div");this._domNode.appendChild(b);let S=De("item",p),y=this.itemProvider.createView(S,b);h=new Adi(S,y,b),this.views.set(p.id,h)}let g=p.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(p.range.startLineNumber,!0)-t:p.range.startLineNumber>1?this._editor.getBottomForLineNumber(p.range.startLineNumber-1,!1)-t:0,v=(p.range.endLineNumberExclusive===1?Math.max(g,this._editor.getTopForLineNumber(p.range.startLineNumber,!1)-t):Math.max(g,this._editor.getBottomForLineNumber(p.range.endLineNumberExclusive-1,!0)-t))-g;h.domNode.style.top=`${g}px`,h.domNode.style.height=`${v}px`,h.gutterItemView.layout(gi.ofStartAndLength(g,v),r)}})}for(let s of n)this.views.deleteAndDispose(s)}},Adi=class{constructor(i,e,t){this.item=i;this.gutterItemView=e;this.domNode=t}dispose(){this.gutterItemView.dispose(),this.domNode.remove()}};var Ndi=[],Okt=35,Jke=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._diffModel=t;this._editors=o;this._options=n;this._sashLayout=r;this._boundarySashes=s;this._instantiationService=l;this._contextKeyService=c;this._menuService=u;this._menu=this._register(this._menuService.createMenu(R.DiffEditorHunkToolbar,this._contextKeyService)),this._actions=vi(this,this._menu.onDidChange,()=>this._menu.getActions()),this._hasActions=this._actions.map(h=>h.length>0),this._showSash=ke(this,h=>this._options.renderSideBySide.read(h)&&this._hasActions.read(h)),this.width=ke(this,h=>this._hasActions.read(h)?Okt:0),this.elements=st("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:Okt+"px"}},[]),this._currentDiff=ke(this,h=>{let g=this._diffModel.read(h);if(!g)return;let f=g.diff.read(h)?.mappings,v=this._editors.modifiedCursor.read(h);if(v)return f?.find(b=>b.lineRangeMapping.modified.contains(v.lineNumber))}),this._selectedDiffs=ke(this,h=>{let f=this._diffModel.read(h)?.diff.read(h);if(!f)return Ndi;let v=this._editors.modifiedSelections.read(h);if(v.every(w=>w.isEmpty()))return Ndi;let b=new EA(v.map(w=>vo.fromRangeInclusive(w))),y=f.mappings.filter(w=>w.lineRangeMapping.innerChanges&&b.intersects(w.lineRangeMapping.modified)).map(w=>({mapping:w,rangeMappings:w.lineRangeMapping.innerChanges.filter(x=>v.some(E=>G.areIntersecting(x.modifiedRange,E)))}));return y.length===0||y.every(w=>w.rangeMappings.length===0)?Ndi:y}),this._register(PZi(e,this.elements.root)),this._register($(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(NA(this.elements.root,{display:this._hasActions.map(h=>h?"block":"none")})),Ry(this,h=>this._showSash.read(h)?new Oke(e,this._sashLayout.dimensions,this._options.enableSplitViewResizing,this._boundarySashes,r5(this,f=>this._sashLayout.sashLeft.read(f)-Okt,(f,v)=>this._sashLayout.sashLeft.set(f+Okt,v)),()=>this._sashLayout.resetSash()):void 0).recomputeInitiallyAndOnChange(this._store);let p=ke(this,h=>{let g=this._diffModel.read(h);if(!g)return[];let f=g.diff.read(h);if(!f)return[];let v=this._selectedDiffs.read(h);if(v.length>0){let S=vv.fromRangeMappings(v.flatMap(y=>y.rangeMappings));return[new Fkt(S,!0,R.DiffEditorSelectionToolbar,void 0,g.model.original.uri,g.model.modified.uri)]}let b=this._currentDiff.read(h);return f.mappings.map(S=>new Fkt(S.lineRangeMapping.withInnerChangesFromLineRanges(),S.lineRangeMapping===b?.lineRangeMapping,R.DiffEditorHunkToolbar,void 0,g.model.original.uri,g.model.modified.uri))});this._register(new Nkt(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(h,g)=>p.read(g),createView:(h,g)=>this._instantiationService.createInstance(MQe,h,g,this)})),this._register($(this.elements.gutter,ne.MOUSE_WHEEL,h=>{this._editors.modified.getOption(117).handleMouseWheel&&this._editors.modified.delegateScrollFromMouseWheelEvent(h)},{passive:!1}))}computeStagedValue(e){let t=e.innerChanges??[],o=new aM(this._editors.modifiedModel.get()),n=new aM(this._editors.original.getModel());return new lm(t.map(l=>l.toTextEdit(o))).apply(n)}layout(e){this.elements.gutter.style.left=e+"px"}};Jke=I([m(6,F),m(7,X),m(8,Yt)],Jke);var Fkt=class{constructor(i,e,t,o,n,r){this.mapping=i;this.showAlways=e;this.menuId=t;this.rangeOverride=o;this.originalUri=n;this.modifiedUri=r}get id(){return this.mapping.modified.toString()}get range(){return this.rangeOverride??this.mapping.modified}},MQe=class extends k{constructor(e,t,o,n){super();this._item=e;this._elements=st("div.gutterItem",{style:{height:"20px",width:"34px"}},[st("div.background@background",{},[]),st("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,s=>s.showAlways),this._menuId=this._item.map(this,s=>s.menuId),this._isSmall=De(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;let r=this._register(n.createInstance(Kf,"element",{instantHover:!0},{position:{hoverPosition:1}}));this._register(l4(t,this._elements.root)),this._register(ve(s=>{let l=this._showAlways.read(s);this._elements.root.classList.toggle("noTransition",!0),this._elements.root.classList.toggle("showAlways",l),setTimeout(()=>{this._elements.root.classList.toggle("noTransition",!1)},0)})),this._register(Rl((s,l)=>{this._elements.buttons.replaceChildren();let c=l.add(n.createInstance(pr,this._elements.buttons,this._menuId.read(s),{orientation:1,hoverDelegate:r,toolbarOptions:{primaryGroup:u=>u.startsWith("primary")},overflowBehavior:{maxItems:this._isSmall.read(s)?1:3},hiddenItemStrategy:0,actionRunner:l.add(new Xke(()=>{let u=this._item.read(void 0),p=u.mapping;return{mapping:p,originalWithModifiedChanges:o.computeStagedValue(p),originalUri:u.originalUri,modifiedUri:u.modifiedUri}})),menuOptions:{shouldForwardArgs:!0}}));l.add(c.onDidChangeMenuItems(()=>{this._lastItemRange&&this.layout(this._lastItemRange,this._lastViewRange)}))}))}layout(e,t){this._lastItemRange=e,this._lastViewRange=t;let o=this._elements.buttons.clientHeight;this._isSmall.set(this._item.get().mapping.original.startLineNumber===1&&e.length<30,void 0),o=this._elements.buttons.clientHeight;let n=e.length/2-o/2,r=o,s=e.start+n,l=gi.tryCreate(r,t.endExclusive-r-o),c=gi.tryCreate(e.start+r,e.endExclusive-o-r);c&&l&&c.start<c.endExclusive&&(s=l.clip(s),s=c.clip(s)),this._elements.buttons.style.top=`${s-e.start}px`}};MQe=I([m(3,F)],MQe);var ZF=class extends k{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._instantiationService=n;this._modifiedOutlineSource=Ry(this,e=>{let t=this._editors.modifiedModel.read(e),o=ZF._breadcrumbsSourceFactory.read(e);return!t||!o?void 0:o(t,this._instantiationService)});this._isUpdatingHiddenAreas=!1;this._register(this._editors.original.onDidChangeCursorPosition(c=>{if(c.reason===1)return;let u=this._diffModel.get();Ki(p=>{for(let h of this._editors.original.getSelections()||[])u?.ensureOriginalLineIsVisible(h.getStartPosition().lineNumber,0,p),u?.ensureOriginalLineIsVisible(h.getEndPosition().lineNumber,0,p)})})),this._register(this._editors.modified.onDidChangeCursorPosition(c=>{if(c.reason===1)return;let u=this._diffModel.get();Ki(p=>{for(let h of this._editors.modified.getSelections()||[])u?.ensureModifiedLineIsVisible(h.getStartPosition().lineNumber,0,p),u?.ensureModifiedLineIsVisible(h.getEndPosition().lineNumber,0,p)})}));let r=this._diffModel.map((c,u)=>{let p=c?.unchangedRegions.read(u)??[];return p.length===1&&p[0].modifiedLineNumber===1&&p[0].lineCount===this._editors.modifiedModel.read(u)?.getLineCount()?[]:p});this.viewZones=ke(this,c=>{let u=this._modifiedOutlineSource.read(c);if(!u)return{origViewZones:[],modViewZones:[]};let p=[],h=[],g=this._options.renderSideBySide.read(c),f=this._options.compactMode.read(c),v=r.read(c);for(let b=0;b<v.length;b++){let S=v[b];if(!S.shouldHideControls(c)&&!(f&&(b===0||b===v.length-1)))if(f){{let y=ke(this,x=>S.getHiddenOriginalRange(x).startLineNumber-1),w=new OK(y,12);p.push(w),c.store.add(new Wkt(this._editors.original,w,S,!g))}{let y=ke(this,x=>S.getHiddenModifiedRange(x).startLineNumber-1),w=new OK(y,12);h.push(w),c.store.add(new Wkt(this._editors.modified,w,S))}}else{{let y=ke(this,x=>S.getHiddenOriginalRange(x).startLineNumber-1),w=new OK(y,24);p.push(w),c.store.add(new Vkt(this._editors.original,w,S,S.originalUnchangedRange,!g,u,x=>this._diffModel.get().ensureModifiedLineIsVisible(x,2,void 0),this._options))}{let y=ke(this,x=>S.getHiddenModifiedRange(x).startLineNumber-1),w=new OK(y,24);h.push(w),c.store.add(new Vkt(this._editors.modified,w,S,S.modifiedUnchangedRange,!1,u,x=>this._diffModel.get().ensureModifiedLineIsVisible(x,2,void 0),this._options))}}}return{origViewZones:p,modViewZones:h}});let s={description:"unchanged lines",className:"diff-unchanged-lines",isWholeLine:!0},l={description:"Fold Unchanged",glyphMarginHoverMessage:new he(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(d(250,null)),glyphMarginClassName:"fold-unchanged "+q.asClassName(L.fold),zIndex:10001};this._register(Tke(this._editors.original,ke(this,c=>{let u=r.read(c),p=u.map(h=>({range:h.originalUnchangedRange.toInclusiveRange(),options:s}));for(let h of u)h.shouldHideControls(c)&&p.push({range:G.fromPositions(new ye(h.originalLineNumber,1)),options:l});return p}))),this._register(Tke(this._editors.modified,ke(this,c=>{let u=r.read(c),p=u.map(h=>({range:h.modifiedUnchangedRange.toInclusiveRange(),options:s}));for(let h of u)h.shouldHideControls(c)&&p.push({range:vo.ofLength(h.modifiedLineNumber,1).toInclusiveRange(),options:l});return p}))),this._register(ve(c=>{let u=r.read(c);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(u.map(p=>p.getHiddenOriginalRange(c).toInclusiveRange()).filter(so)),this._editors.modified.setHiddenAreas(u.map(p=>p.getHiddenModifiedRange(c).toInclusiveRange()).filter(so))}finally{this._isUpdatingHiddenAreas=!1}})),this._register(this._editors.modified.onMouseUp(c=>{if(!c.event.rightButton&&c.target.position&&c.target.element?.className.includes("fold-unchanged")){let u=c.target.position.lineNumber,p=this._diffModel.get();if(!p)return;let h=p.unchangedRegions.get().find(g=>g.modifiedUnchangedRange.contains(u));if(!h)return;h.collapseAll(void 0),c.event.stopPropagation(),c.event.preventDefault()}})),this._register(this._editors.original.onMouseUp(c=>{if(!c.event.rightButton&&c.target.position&&c.target.element?.className.includes("fold-unchanged")){let u=c.target.position.lineNumber,p=this._diffModel.get();if(!p)return;let h=p.unchangedRegions.get().find(g=>g.originalUnchangedRange.contains(u));if(!h)return;h.collapseAll(void 0),c.event.stopPropagation(),c.event.preventDefault()}}))}static{this._breadcrumbsSourceFactory=De(this,()=>({dispose(){},getBreadcrumbItems(e,t){return[]},getAt:()=>[]}))}static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}};ZF=I([m(3,F)],ZF);var Wkt=class extends Rde{constructor(e,t,o,n=!1){let r=st("div.diff-hidden-lines-widget");super(e,t,r.root);this._unchangedRegion=o;this._hide=n;this._nodes=st("div.diff-hidden-lines-compact",[st("div.line-left",[]),st("div.text@text",[]),st("div.line-right",[])]);r.root.appendChild(this._nodes.root),this._hide&&this._nodes.root.replaceChildren(),this._register(ve(s=>{if(!this._hide){let l=this._unchangedRegion.getHiddenModifiedRange(s).length,c=d(251,null,l);this._nodes.text.innerText=c}}))}},Vkt=class extends Rde{constructor(e,t,o,n,r,s,l,c){let u=st("div.diff-hidden-lines-widget");super(e,t,u.root);this._editor=e;this._unchangedRegion=o;this._unchangedRegionRange=n;this._hide=r;this._modifiedOutlineSource=s;this._revealModifiedHiddenLine=l;this._options=c;this._nodes=st("div.diff-hidden-lines",[st("div.top@top",{title:d(249,null)}),st("div.center@content",{style:{display:"flex"}},[st("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[_("a",{title:d(252,null),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...ir("$(unfold)"))]),st("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),st("div.bottom@bottom",{title:d(247,null),role:"button"})]);u.root.appendChild(this._nodes.root),this._hide?Ii(this._nodes.first):this._register(NA(this._nodes.first,{width:Ds(this._editor).layoutInfoContentLeft})),this._register(ve(h=>{let g=this._unchangedRegion.visibleLineCountTop.read(h)+this._unchangedRegion.visibleLineCountBottom.read(h)===this._unchangedRegion.lineCount;this._nodes.bottom.classList.toggle("canMoveTop",!g),this._nodes.bottom.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(h)>0),this._nodes.top.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(h)>0),this._nodes.top.classList.toggle("canMoveBottom",!g);let f=this._unchangedRegion.isDragged.read(h),v=this._editor.getDomNode();v&&(v.classList.toggle("draggingUnchangedRegion",!!f),f==="top"?(v.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(h)>0),v.classList.toggle("canMoveBottom",!g)):f==="bottom"?(v.classList.toggle("canMoveTop",!g),v.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(h)>0)):(v.classList.toggle("canMoveTop",!1),v.classList.toggle("canMoveBottom",!1)))}));let p=this._editor;this._register($(this._nodes.top,"mousedown",h=>{if(h.button!==0)return;this._nodes.top.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),h.preventDefault();let g=h.clientY,f=!1,v=this._unchangedRegion.visibleLineCountTop.get();this._unchangedRegion.isDragged.set("top",void 0);let b=Me(this._nodes.top),S=$(b,"mousemove",w=>{let E=w.clientY-g;f=f||Math.abs(E)>2;let M=Math.round(E/p.getOption(75)),N=Math.max(0,Math.min(v+M,this._unchangedRegion.getMaxVisibleLineCountTop()));this._unchangedRegion.visibleLineCountTop.set(N,void 0)}),y=$(b,"mouseup",w=>{f||this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0),this._nodes.top.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),this._unchangedRegion.isDragged.set(void 0,void 0),S.dispose(),y.dispose()})})),this._register($(this._nodes.bottom,"mousedown",h=>{if(h.button!==0)return;this._nodes.bottom.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),h.preventDefault();let g=h.clientY,f=!1,v=this._unchangedRegion.visibleLineCountBottom.get();this._unchangedRegion.isDragged.set("bottom",void 0);let b=Me(this._nodes.bottom),S=$(b,"mousemove",w=>{let E=w.clientY-g;f=f||Math.abs(E)>2;let M=Math.round(E/p.getOption(75)),N=Math.max(0,Math.min(v-M,this._unchangedRegion.getMaxVisibleLineCountBottom())),V=this._unchangedRegionRange.endLineNumberExclusive>p.getModel().getLineCount()?p.getContentHeight():p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.visibleLineCountBottom.set(N,void 0);let H=this._unchangedRegionRange.endLineNumberExclusive>p.getModel().getLineCount()?p.getContentHeight():p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);p.setScrollTop(p.getScrollTop()+(H-V))}),y=$(b,"mouseup",w=>{if(this._unchangedRegion.isDragged.set(void 0,void 0),!f){let x=p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0);let E=p.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);p.setScrollTop(p.getScrollTop()+(E-x))}this._nodes.bottom.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),S.dispose(),y.dispose()})})),this._register(ve(h=>{let g=[];if(!this._hide){let f=o.getHiddenModifiedRange(h).length,v=d(251,null,f),b=_("span",{title:d(248,null)},v);b.addEventListener("dblclick",w=>{w.button===0&&(w.preventDefault(),this._unchangedRegion.showAll(void 0))}),g.push(b);let S=this._unchangedRegion.getHiddenModifiedRange(h),y=this._modifiedOutlineSource.getBreadcrumbItems(S,h);if(y.length>0){g.push(_("span",void 0,"\xA0\xA0|\xA0\xA0"));for(let w=0;w<y.length;w++){let x=y[w],E=Zm.toIcon(x.kind),M=st("div.breadcrumb-item",{style:{display:"flex",alignItems:"center"}},[un(E),"\xA0",x.name,...w===y.length-1?[]:[un(L.chevronRight)]]).root;g.push(M),M.onclick=()=>{this._revealModifiedHiddenLine(x.startLineNumber)}}}}Ii(this._nodes.others,...g)}))}};var Odi=[],Bkt=class extends k{constructor(e,t,o,n){super();this._editors=e;this._diffModel=t;this._options=o;this._widget=n;this._selectedDiffs=ke(this,e=>{let o=this._diffModel.read(e)?.diff.read(e);if(!o)return Odi;let n=this._editors.modifiedSelections.read(e);if(n.every(c=>c.isEmpty()))return Odi;let r=new EA(n.map(c=>vo.fromRangeInclusive(c))),l=o.mappings.filter(c=>c.lineRangeMapping.innerChanges&&r.intersects(c.lineRangeMapping.modified)).map(c=>({mapping:c,rangeMappings:c.lineRangeMapping.innerChanges.filter(u=>n.some(p=>G.areIntersecting(u.modifiedRange,p)))}));return l.length===0||l.every(c=>c.rangeMappings.length===0)?Odi:l});this._register(Rl((r,s)=>{if(!this._options.shouldRenderOldRevertArrows.read(r))return;let l=this._diffModel.read(r),c=l?.diff.read(r);if(!l||!c||l.movedTextToCompare.read(r))return;let u=[],p=this._selectedDiffs.read(r),h=new Set(p.map(g=>g.mapping));if(p.length>0){let g=this._editors.modifiedSelections.read(r),f=s.add(new Hkt(g[g.length-1].positionLineNumber,this._widget,p.flatMap(v=>v.rangeMappings),!0));this._editors.modified.addGlyphMarginWidget(f),u.push(f)}for(let g of c.mappings)if(!h.has(g)&&!g.lineRangeMapping.modified.isEmpty&&g.lineRangeMapping.innerChanges){let f=s.add(new Hkt(g.lineRangeMapping.modified.startLineNumber,this._widget,g.lineRangeMapping,!1));this._editors.modified.addGlyphMarginWidget(f),u.push(f)}s.add(ee(()=>{for(let g of u)this._editors.modified.removeGlyphMarginWidget(g)}))}))}},Hkt=class a extends k{constructor(e,t,o,n){super();this._lineNumber=e;this._widget=t;this._diffs=o;this._revertSelection=n;this._id=`revertButton${a.counter++}`,this._domNode=st("div.revertButton",{title:this._revertSelection?d(258,null):d(257,null)},[un(L.arrowRight)]).root,this._register($(this._domNode,ne.MOUSE_DOWN,r=>{r.button!==2&&(r.stopPropagation(),r.preventDefault())})),this._register($(this._domNode,ne.MOUSE_UP,r=>{r.stopPropagation(),r.preventDefault()})),this._register($(this._domNode,ne.CLICK,r=>{this._diffs instanceof Oy?this._widget.revert(this._diffs):this._widget.revertRangeMappings(this._diffs),r.stopPropagation(),r.preventDefault()}))}static{this.counter=0}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return{lane:3,range:{startColumn:1,startLineNumber:this._lineNumber,endColumn:1,endLineNumber:this._lineNumber},zIndex:10001}}};var _p=class extends vkt{constructor(e,t,o,n,r,s,l,c){super();this._domElement=e;this._parentContextKeyService=n;this._parentInstantiationService=r;this._codeEditorService=s;this._accessibilitySignalService=l;this._editorProgressService=c;this.elements=st("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[st("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),st("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),st("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModelSrc=this._register(IB(this,void 0)),this._diffModel=ke(this,E=>this._diffModelSrc.read(E)?.object),this.onDidChangeModel=U.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new Po([X,this._contextKeyService]))),this._boundarySashes=De(this,void 0),this._accessibleDiffViewerShouldBeVisible=De(this,!1),this._accessibleDiffViewerVisible=ke(this,E=>this._options.onlyShowAccessibleDiffViewer.read(E)?!0:this._accessibleDiffViewerShouldBeVisible.read(E)),this._movedBlocksLinesPart=De(this,void 0),this._layoutInfo=ke(this,E=>{let M=this._rootSizeObserver.width.read(E),N=this._rootSizeObserver.height.read(E);this._rootSizeObserver.automaticLayout?this.elements.root.style.height="100%":this.elements.root.style.height=N+"px";let V=this._sash.read(E),H=this._gutter.read(E),K=H?.width.read(E)??0,j=this._overviewRulerPart.read(E)?.width??0,J,se,ae,ce,Se;if(!!V){let xe=V.sashLeft.read(E),He=this._movedBlocksLinesPart.read(E)?.width.read(E)??0;J=0,se=xe-K-He,Se=xe-K,ae=xe,ce=M-ae-j}else{Se=0;let xe=this._options.inlineViewHideOriginalLineNumbers.read(E);J=K,xe?se=0:se=Math.max(5,this._editors.originalObs.layoutInfoDecorationsLeft.read(E)),ae=K+se,ce=M-ae-j}return this.elements.original.style.left=J+"px",this.elements.original.style.width=se+"px",this._editors.original.layout({width:se,height:N},!0),H?.layout(Se),this.elements.modified.style.left=ae+"px",this.elements.modified.style.width=ce+"px",this._editors.modified.layout({width:ce,height:N},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((E,M)=>E?.diff.read(M)),this.onDidUpdateDiff=U.fromObservableLight(this._diffValue),this._codeEditorService.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(ee(()=>this.elements.root.remove())),this._rootSizeObserver=this._register(new Eke(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout(t.automaticLayout??!1),this._options=this._instantiationService.createInstance(YX,t),this._register(ve(E=>{this._options.setWidth(this._rootSizeObserver.width.read(E))})),this._contextKeyService.createKey(me.isEmbeddedDiffEditor.key,!1),this._register(cu(me.isEmbeddedDiffEditor,this._contextKeyService,E=>this._options.isInEmbeddedEditor.read(E))),this._register(cu(me.comparingMovedCode,this._contextKeyService,E=>!!this._diffModel.read(E)?.movedTextToCompare.read(E))),this._register(cu(me.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,E=>this._options.couldShowInlineViewBecauseOfSize.read(E))),this._register(cu(me.diffEditorInlineMode,this._contextKeyService,E=>!this._options.renderSideBySide.read(E))),this._register(cu(me.hasChanges,this._contextKeyService,E=>(this._diffModel.read(E)?.diff.read(E)?.mappings.length??0)>0)),this._editors=this._register(this._instantiationService.createInstance(Ake,this.elements.original,this.elements.modified,this._options,o,(E,M,N,V)=>this._createInnerEditor(E,M,N,V))),this._register(cu(me.diffEditorOriginalWritable,this._contextKeyService,E=>this._options.originalEditable.read(E))),this._register(cu(me.diffEditorModifiedWritable,this._contextKeyService,E=>!this._options.readOnly.read(E))),this._register(cu(me.diffEditorOriginalUri,this._contextKeyService,E=>this._diffModel.read(E)?.model.original.uri.toString()??"")),this._register(cu(me.diffEditorModifiedUri,this._contextKeyService,E=>this._diffModel.read(E)?.model.modified.uri.toString()??"")),this._overviewRulerPart=Ry(this,E=>this._options.renderOverviewRuler.read(E)?this._instantiationService.createInstance(zk(Ky,E),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(M=>M.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store);let u={height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((E,M)=>E-(this._overviewRulerPart.read(M)?.width??0))};this._sashLayout=new fkt(this._options,u),this._sash=Ry(this,E=>{let M=this._options.renderSideBySide.read(E);return this.elements.root.classList.toggle("side-by-side",M),M?new Oke(this.elements.root,u,this._options.enableSplitViewResizing,this._boundarySashes,this._sashLayout.sashLeft,()=>this._sashLayout.resetSash()):void 0}).recomputeInitiallyAndOnChange(this._store);let p=Ry(this,E=>this._instantiationService.createInstance(zk(ZF,E),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);Ry(this,E=>this._instantiationService.createInstance(zk(gkt,E),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);let h=new Set,g=new Set,f=!1,v=Ry(this,E=>this._instantiationService.createInstance(zk(Pke,E),Me(this._domElement),this._editors,this._diffModel,this._options,this,()=>f||p.read(void 0).isUpdatingHiddenAreas,h,g)).recomputeInitiallyAndOnChange(this._store),b=ke(this,E=>{let M=v.read(E).viewZones.read(E).orig,N=p.read(E).viewZones.read(E).origViewZones;return M.concat(N)}),S=ke(this,E=>{let M=v.read(E).viewZones.read(E).mod,N=p.read(E).viewZones.read(E).modViewZones;return M.concat(N)});this._register(_ke(this._editors.original,b,E=>{f=E},h));let y;this._register(_ke(this._editors.modified,S,E=>{f=E,f?y=Sx.capture(this._editors.modified):(y?.restore(this._editors.modified),y=void 0)},g)),this._accessibleDiffViewer=Ry(this,E=>this._instantiationService.createInstance(zk($F,E),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(M,N)=>this._accessibleDiffViewerShouldBeVisible.set(M,N),this._options.onlyShowAccessibleDiffViewer.map(M=>!M),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((M,N)=>M?.diff.read(N)?.mappings.map(V=>V.lineRangeMapping)),new ukt(this._editors))).recomputeInitiallyAndOnChange(this._store);let w=this._accessibleDiffViewerVisible.map(E=>E?"hidden":"visible");this._register(NA(this.elements.modified,{visibility:w})),this._register(NA(this.elements.original,{visibility:w})),this._createDiffEditorContributions(),this._codeEditorService.addDiffEditor(this),this._register(ee(()=>{this._codeEditorService.removeDiffEditor(this)})),this._gutter=Ry(this,E=>this._options.shouldRenderGutterMenu.read(E)?this._instantiationService.createInstance(zk(Jke,E),this.elements.root,this._diffModel,this._editors,this._options,this._sashLayout,this._boundarySashes):void 0),this._register(bA(this._layoutInfo)),Ry(this,E=>new(zk(QX,E))(this.elements.root,this._diffModel,this._layoutInfo.map(M=>M.originalEditor),this._layoutInfo.map(M=>M.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,E=>{this._movedBlocksLinesPart.set(E,void 0)}),this._register(U.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,E=>this._handleCursorPositionChange(E,!0))),this._register(U.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,E=>this._handleCursorPositionChange(E,!1)));let x=this._diffModel.map(this,(E,M)=>{if(E)return E.diff.read(M)===void 0&&!E.isDiffUpToDate.read(M)});this._register(Rl((E,M)=>{if(x.read(E)===!0){let N=this._editorProgressService.show(!0,1e3);M.add(ee(()=>N.done()))}})),this._register(Rl((E,M)=>{M.add(new(zk(Bkt,E))(this._editors,this._diffModel,this._options,this))})),this._register(Rl((E,M)=>{let N=this._diffModel.read(E);if(N)for(let V of[N.model.original,N.model.modified])M.add(V.onWillDispose(H=>{mt(new ci("TextModel got disposed before DiffEditorWidget model got reset")),this.setModel(null)}))})),this._register(ve(E=>{this._options.setModel(this._diffModel.read(E))}))}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=Ky.ENTIRE_DIFF_OVERVIEW_WIDTH}get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}get collapseUnchangedRegions(){return this._options.hideUnchangedRegions.get()}getViewWidth(){return this._rootSizeObserver.width.get()}getContentHeight(){return this._editors.modified.getContentHeight()}_createInnerEditor(e,t,o,n){return e.createInstance(us,t,o,n)}_createDiffEditorContributions(){let e=ml.getDiffEditorContributions();for(let t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(o){mt(o)}}get _targetEditor(){return this._editors.modified}getEditorType(){return v5.IDiffEditor}onVisible(){this._editors.original.onVisible(),this._editors.modified.onVisible()}onHide(){this._editors.original.onHide(),this._editors.modified.onHide()}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){let e=this._editors.original.saveViewState(),t=this._editors.modified.saveViewState();return{original:e,modified:t,modelState:this._diffModel.get()?.serializeState()}}restoreViewState(e){if(e&&e.original&&e.modified){let t=e;this._editors.original.restoreViewState(t.original),this._editors.modified.restoreViewState(t.modified),t.modelState&&this._diffModel.get()?.restoreSerializedState(t.modelState)}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance($X,e,this._options)}getModel(){return this._diffModel.get()?.model??null}setModel(e){let t=e?"model"in e?qF.create(e).createNewRef(this):qF.create(this.createViewModel(e),this):null;this.setDiffModel(t)}setDiffModel(e,t){let o=this._diffModel.get();!e&&o&&this._accessibleDiffViewer.get().close(),this._diffModel.get()!==e?.object&&aF(t,n=>{let r=e?.object;vi.batchEventsGlobally(n,()=>{this._editors.original.setModel(r?r.model.original:null),this._editors.modified.setModel(r?r.model.modified:null)});let s=this._diffModelSrc.get()?.createNewRef(this);this._diffModelSrc.set(e?.createNewRef(this),n),setTimeout(()=>{s?.dispose()},0)})}updateOptions(e){this._options.updateOptions(e)}getDomNode(){return this.elements.root}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}setBoundarySashes(e){this._boundarySashes.set(e,void 0)}get ignoreTrimWhitespace(){return this._options.ignoreTrimWhitespace.get()}get maxComputationTime(){return this._options.maxComputationTimeMs.get()}get renderSideBySide(){return this._options.renderSideBySide.get()}getLineChanges(){let e=this._diffModel.get()?.diff.get();return e?Fdi(e):null}getDiffComputationResult(){let e=this._diffModel.get()?.diff.get();return e?{changes:this.getLineChanges(),changes2:e.mappings.map(t=>t.lineRangeMapping),identical:e.identical,quitEarly:e.quitEarly}:null}revert(e){let t=this._diffModel.get();!t||!t.isDiffUpToDate.get()||(this._editors.modified.pushUndoStop(),this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:t.model.original.getValueInRange(e.original.toExclusiveRange())}]),this._editors.modified.pushUndoStop())}revertRangeMappings(e){let t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;let o=e.map(n=>({range:n.modifiedRange,text:t.model.original.getValueInRange(n.originalRange)}));this._editors.modified.pushUndoStop(),this._editors.modified.executeEdits("diffEditor",o),this._editors.modified.pushUndoStop()}revertFocusedRangeMappings(){let e=this._diffModel.get();if(!e||!e.isDiffUpToDate.get())return;let t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;let o=this._editors.modified;if(!o.hasTextFocus())return;let n=o.getPosition().lineNumber,r=o.getSelection(),s=vo.fromRange(r||new G(n,0,n,0)),l=t.filter(c=>c.lineRangeMapping.modified.intersect(s));o.pushUndoStop(),o.executeEdits("diffEditor",l.map(c=>({range:c.lineRangeMapping.modified.toExclusiveRange(),text:e.model.original.getValueInRange(c.lineRangeMapping.original.toExclusiveRange())}))),o.pushUndoStop()}_goTo(e){this._editors.modified.setPosition(new ye(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){let t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;let o=this._editors.modified.getPosition().lineNumber,n;e==="next"?this._editors.modified.getModel().getLineCount()===o?n=t[0]:n=t.find(s=>s.lineRangeMapping.modified.startLineNumber>o)??t[0]:n=wu(t,r=>r.lineRangeMapping.modified.startLineNumber<o)??t[t.length-1],this._goTo(n),n.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(tn.diffLineDeleted,{source:"diffEditor.goToDiff"}):n.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(tn.diffLineInserted,{source:"diffEditor.goToDiff"}):n&&this._accessibilitySignalService.playSignal(tn.diffLineModified,{source:"diffEditor.goToDiff"})}revealFirstDiff(){let e=this._diffModel.get();e&&this.waitForDiff().then(()=>{let t=e.diff.get()?.mappings;!t||t.length===0||this._goTo(t[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){let e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){let e=this._editors.modified.hasWidgetFocus(),t=e?this._editors.modified:this._editors.original,o=e?this._editors.original:this._editors.modified,n,r=t.getSelection();if(r){let s=this._diffModel.get()?.diff.get()?.mappings.map(l=>e?l.lineRangeMapping.flip():l.lineRangeMapping);if(s){let l=ddi(r.getStartPosition(),s),c=ddi(r.getEndPosition(),s);n=G.plusRange(l,c)}}return{destination:o,destinationSelection:n}}switchSide(){let{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){let e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){let e=this._diffModel.get()?.unchangedRegions.get();e&&Ki(t=>{for(let o of e)o.collapseAll(t)})}showAllUnchangedRegions(){let e=this._diffModel.get()?.unchangedRegions.get();e&&Ki(t=>{for(let o of e)o.showAll(t)})}_handleCursorPositionChange(e,t){if(e?.reason===3){let o=this._diffModel.get()?.diff.get()?.mappings.find(n=>t?n.lineRangeMapping.modified.contains(e.position.lineNumber):n.lineRangeMapping.original.contains(e.position.lineNumber));o?.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(tn.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):o?.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(tn.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):o&&this._accessibilitySignalService.playSignal(tn.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}};_p=I([m(3,X),m(4,F),m(5,Qt),m(6,br),m(7,Hd)],_p);function Fdi(a){return a.mappings.map(i=>{let e=i.lineRangeMapping,t,o,n,r,s=e.innerChanges;return e.original.isEmpty?(t=e.original.startLineNumber-1,o=0,s=void 0):(t=e.original.startLineNumber,o=e.original.endLineNumberExclusive-1),e.modified.isEmpty?(n=e.modified.startLineNumber-1,r=0,s=void 0):(n=e.modified.startLineNumber,r=e.modified.endLineNumberExclusive-1),{originalStartLineNumber:t,originalEndLineNumber:o,modifiedStartLineNumber:n,modifiedEndLineNumber:r,charChanges:s?.map(l=>({originalStartLineNumber:l.originalRange.startLineNumber,originalStartColumn:l.originalRange.startColumn,originalEndLineNumber:l.originalRange.endLineNumber,originalEndColumn:l.originalRange.endColumn,modifiedStartLineNumber:l.modifiedRange.startLineNumber,modifiedStartColumn:l.modifiedRange.startColumn,modifiedEndLineNumber:l.modifiedRange.endLineNumber,modifiedEndColumn:l.modifiedRange.endColumn}))}})}var Ukt=class extends z{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:P(217,"Toggle Collapse Unchanged Regions"),icon:L.map,toggled:C.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:C.has("isInDiffEditor"),menu:{when:C.has("isInDiffEditor"),id:R.EditorTitle,order:22,group:"navigation"}})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.hideUnchangedRegions.enabled");t.updateValue("diffEditor.hideUnchangedRegions.enabled",o)}},PQe=class extends z{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:P(218,"Toggle Show Moved Code Blocks"),precondition:C.has("isInDiffEditor")})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.experimental.showMoves");t.updateValue("diffEditor.experimental.showMoves",o)}},AQe=class extends z{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:P(219,"Toggle Use Inline View When Space Is Limited"),precondition:C.has("isInDiffEditor")})}run(i,...e){let t=i.get(B),o=!t.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");t.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",o)}},NQe=P(210,"Diff Editor"),zkt=class extends yl{constructor(){super({id:"diffEditor.switchSide",title:P(216,"Switch Side"),icon:L.arrowSwap,precondition:C.has("isInDiffEditor"),f1:!0,category:NQe})}runEditorCommand(i,e,t){let o=Ude(i);if(o instanceof _p){if(t&&t.dryRun)return{destinationSelection:o.mapToOtherSide().destinationSelection};o.switchSide()}}},Kkt=class extends yl{constructor(){super({id:"diffEditor.exitCompareMove",title:P(213,"Exit Compare Move"),icon:L.close,precondition:me.comparingMovedCode,f1:!1,category:NQe,keybinding:{weight:1e4,primary:9}})}runEditorCommand(i,e,...t){let o=Ude(i);o instanceof _p&&o.exitCompareMove()}},Gkt=class extends yl{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:P(209,"Collapse All Unchanged Regions"),icon:L.fold,precondition:C.has("isInDiffEditor"),f1:!0,category:NQe})}runEditorCommand(i,e,...t){let o=Ude(i);o instanceof _p&&o.collapseAllUnchangedRegions()}},qkt=class extends yl{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:P(215,"Show All Unchanged Regions"),icon:L.unfold,precondition:C.has("isInDiffEditor"),f1:!0,category:NQe})}runEditorCommand(i,e,...t){let o=Ude(i);o instanceof _p&&o.showAllUnchangedRegions()}},Zke=class extends z{constructor(){super({id:"diffEditor.revert",title:P(214,"Revert"),f1:!0,category:NQe,precondition:C.has("isInDiffEditor")})}run(i,e){return e?this.runViaToolbarContext(i,e):this.runViaCursorOrSelection(i)}runViaCursorOrSelection(i){let e=Ude(i);e instanceof _p&&e.revertFocusedRangeMappings()}runViaToolbarContext(i,e){let t=Z5o(i,e.originalUri,e.modifiedUri);t instanceof _p&&t.revertRangeMappings(e.mapping.innerChanges??[])}},weo=P(208,"Accessible Diff Viewer"),WK=class a extends z{static{this.id="editor.action.accessibleDiffViewer.next"}constructor(){super({id:a.id,title:P(211,"Go to Next Difference"),category:weo,precondition:C.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(i){Ude(i)?.accessibleDiffViewerNext()}},Hde=class a extends z{static{this.id="editor.action.accessibleDiffViewer.prev"}constructor(){super({id:a.id,title:P(212,"Go to Previous Difference"),category:weo,precondition:C.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(i){Ude(i)?.accessibleDiffViewerPrev()}};function Z5o(a,i,e){return a.get(Qt).listDiffEditors().find(n=>{let r=n.getModifiedEditor(),s=n.getOriginalEditor();return r&&r.getModel()?.uri.toString()===e.toString()&&s&&s.getModel()?.uri.toString()===i.toString()})||null}function Ude(a){let e=a.get(Qt).listDiffEditors(),t=Un();if(t){for(let o of e)if(o.getContainerDomNode().contains(t))return o}return null}function $kt(a,i){if(!i.getOption(70))return null;let e=a.get(Qt);for(let t of e.listDiffEditors()){let o=t.getOriginalEditor(),n=t.getModifiedEditor();if(o===i||n===i)return t}return null}W(Ukt);W(PQe);W(AQe);be.appendMenuItem(R.EditorTitle,{command:{id:new AQe().desc.id,title:d(246,null),toggled:C.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:C.has("isInDiffEditor")},order:11,group:"1_diff",when:C.and(me.diffEditorRenderSideBySideInlineBreakpointReached,C.has("isInDiffEditor"))});be.appendMenuItem(R.EditorTitle,{command:{id:new PQe().desc.id,title:d(245,null),icon:L.move,toggled:CB.create("config.diffEditor.experimental.showMoves",!0),precondition:C.has("isInDiffEditor")},order:10,group:"1_diff",when:C.has("isInDiffEditor")});W(Zke);for(let a of[{icon:L.arrowRight,key:me.diffEditorInlineMode.toNegated()},{icon:L.discard,key:me.diffEditorInlineMode}])be.appendMenuItem(R.DiffEditorHunkToolbar,{command:{id:new Zke().desc.id,title:d(243,null),icon:a.icon},when:C.and(me.diffEditorModifiedWritable,a.key),order:5,group:"primary"}),be.appendMenuItem(R.DiffEditorSelectionToolbar,{command:{id:new Zke().desc.id,title:d(244,null),icon:a.icon},when:C.and(me.diffEditorModifiedWritable,a.key),order:5,group:"primary"});W(zkt);W(Kkt);W(Gkt);W(qkt);be.appendMenuItem(R.EditorTitle,{command:{id:WK.id,title:d(242,null),precondition:C.has("isInDiffEditor")},order:10,group:"2_diff",when:C.and(me.accessibleDiffViewerVisible.negate(),C.has("isInDiffEditor"))});Ge.registerCommandAlias("editor.action.diffReview.next",WK.id);W(WK);Ge.registerCommandAlias("editor.action.diffReview.prev",Hde.id);W(Hde);var jkt=new Y("selectionAnchorSet",!1),e0=class{constructor(i,e){this.editor=i;this.selectionAnchorSetContextKey=jkt.bindTo(e),this.modelChangeListener=i.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}static{this.ID="editor.contrib.selectionAnchorController"}static get(i){return i.getContribution(e0.ID)}setSelectionAnchor(){if(this.editor.hasModel()){let i=this.editor.getPosition();this.editor.changeDecorations(e=>{this.decorationId&&e.removeDecoration(this.decorationId),this.decorationId=e.addDecoration(ei.fromPositions(i,i),{description:"selection-anchor",stickiness:1,hoverMessage:new he().appendText(d(978,null)),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),cn(d(974,null,i.lineNumber,i.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){let i=this.editor.getModel().getDecorationRange(this.decorationId);i&&this.editor.setPosition(i.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){let i=this.editor.getModel().getDecorationRange(this.decorationId);if(i){let e=this.editor.getPosition();this.editor.setSelection(ei.fromPositions(i.getStartPosition(),e)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){let i=this.decorationId;this.editor.changeDecorations(e=>{e.removeDecoration(i),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};e0=I([m(1,X)],e0);var Wdi=class extends Mi{constructor(){super({id:"editor.action.setSelectionAnchor",label:P(979,"Set Selection Anchor"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2080),weight:100}})}async run(i,e){e0.get(e)?.setSelectionAnchor()}},Vdi=class extends Mi{constructor(){super({id:"editor.action.goToSelectionAnchor",label:P(976,"Go to Selection Anchor"),precondition:jkt})}async run(i,e){e0.get(e)?.goToSelectionAnchor()}},Bdi=class extends Mi{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:P(977,"Select from Anchor to Cursor"),precondition:jkt,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2089),weight:100}})}async run(i,e){e0.get(e)?.selectFromAnchorToCursor()}},Hdi=class extends Mi{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:P(975,"Cancel Selection Anchor"),precondition:jkt,kbOpts:{kbExpr:me.editorTextFocus,primary:9,weight:100}})}async run(i,e){e0.get(e)?.cancelSelectionAnchor()}};Eo(e0.ID,e0,4);ri(Wdi);ri(Vdi);ri(Bdi);ri(Hdi);var e4o=te("editorOverviewRuler.bracketMatchForeground","#A0A0A0",d(981,null)),Udi=class extends Mi{constructor(){super({id:"editor.action.jumpToBracket",label:P(982,"Go to Bracket"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:3165,weight:100}})}run(i,e){VK.get(e)?.jumpToBracket()}},zdi=class extends Mi{constructor(){super({id:"editor.action.selectToBracket",label:P(984,"Select to Bracket"),precondition:void 0,metadata:{description:P(985,"Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(i,e,t){let o=!0;t&&t.selectBrackets===!1&&(o=!1),VK.get(e)?.selectToBracket(o)}},Kdi=class extends Mi{constructor(){super({id:"editor.action.removeBrackets",label:P(983,"Remove Brackets"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:2561,weight:100},canTriggerInlineEdits:!0})}run(i,e){VK.get(e)?.removeBrackets(this.id)}},Gdi=class{constructor(i,e,t){this.position=i,this.brackets=e,this.options=t}},VK=class a extends k{static{this.ID="editor.contrib.bracketMatchingController"}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Dt(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(80),this._updateBracketsSoon.schedule(),this._register(i.onDidChangeCursorPosition(e=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModelContent(e=>{this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModel(e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeModelLanguageConfiguration(e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(i.onDidChangeConfiguration(e=>{e.hasChanged(80)&&(this._matchBrackets=this._editor.getOption(80),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(i.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(i.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;let i=this._editor.getModel(),e=this._editor.getSelections().map(t=>{let o=t.getStartPosition(),n=i.bracketPairs.matchBracket(o),r=null;if(n)n[0].containsPosition(o)&&!n[1].containsPosition(o)?r=n[1].getStartPosition():n[1].containsPosition(o)&&(r=n[0].getStartPosition());else{let s=i.bracketPairs.findEnclosingBrackets(o);if(s)r=s[1].getStartPosition();else{let l=i.bracketPairs.findNextBracket(o);l&&l.range&&(r=l.range.getStartPosition())}}return r?new ei(r.lineNumber,r.column,r.lineNumber,r.column):new ei(o.lineNumber,o.column,o.lineNumber,o.column)});this._editor.setSelections(e),this._editor.revealRange(e[0])}selectToBracket(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=[];this._editor.getSelections().forEach(o=>{let n=o.getStartPosition(),r=e.bracketPairs.matchBracket(n);if(!r&&(r=e.bracketPairs.findEnclosingBrackets(n),!r)){let c=e.bracketPairs.findNextBracket(n);c&&c.range&&(r=e.bracketPairs.matchBracket(c.range.getStartPosition()))}let s=null,l=null;if(r){r.sort(G.compareRangesUsingStarts);let[c,u]=r;if(s=i?c.getStartPosition():c.getEndPosition(),l=i?u.getEndPosition():u.getStartPosition(),u.containsPosition(n)){let p=s;s=l,l=p}}s&&l&&t.push(new ei(s.lineNumber,s.column,l.lineNumber,l.column))}),t.length>0&&(this._editor.setSelections(t),this._editor.revealRange(t[0]))}removeBrackets(i){if(!this._editor.hasModel())return;let e=this._editor.getModel();this._editor.getSelections().forEach(t=>{let o=t.getPosition(),n=e.bracketPairs.matchBracket(o);n||(n=e.bracketPairs.findEnclosingBrackets(o)),n&&(this._editor.pushUndoStop(),this._editor.executeEdits(i,[{range:n[0],text:""},{range:n[1],text:""}]),this._editor.pushUndoStop())})}static{this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=So.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline",overviewRuler:{color:_s(e4o),position:2}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=So.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline"})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();let i=[],e=0;for(let t of this._lastBracketsData){let o=t.brackets;o&&(i[e++]={range:o[0],options:t.options},i[e++]={range:o[1],options:t.options})}this._decorations.set(i)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}let i=this._editor.getSelections();if(i.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}let e=this._editor.getModel(),t=e.getVersionId(),o=[];this._lastVersionId===t&&(o=this._lastBracketsData);let n=[],r=0;for(let p=0,h=i.length;p<h;p++){let g=i[p];g.isEmpty()&&(n[r++]=g.getStartPosition())}n.length>1&&n.sort(ye.compare);let s=[],l=0,c=0,u=o.length;for(let p=0,h=n.length;p<h;p++){let g=n[p];for(;c<u&&o[c].position.isBefore(g);)c++;if(c<u&&o[c].position.equals(g))s[l++]=o[c];else{let f=e.bracketPairs.matchBracket(g,20),v=a._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!f&&this._matchBrackets==="always"&&(f=e.bracketPairs.findEnclosingBrackets(g,20),v=a._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),s[l++]=new Gdi(g,f,v)}}this._lastBracketsData=s,this._lastVersionId=t}};Eo(VK.ID,VK,1);ri(zdi);ri(Udi);ri(Kdi);be.appendMenuItem(R.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:d(980,null)},order:2});hs((a,i)=>{let e=a.getColor(YYi);e&&i.addRule(`.monaco-editor .bracket-match-inline { color: ${e} !important; }`)});var Qkt=class{constructor(i,e){this._selection=i,this._isMovingLeft=e}getEditOperations(i,e){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;let t=this._selection.startLineNumber,o=this._selection.startColumn,n=this._selection.endColumn;if(!(this._isMovingLeft&&o===1)&&!(!this._isMovingLeft&&n===i.getLineMaxColumn(t)))if(this._isMovingLeft){let r=new G(t,o-1,t,o),s=i.getValueInRange(r);e.addEditOperation(r,null),e.addEditOperation(new G(t,n,t,n),s)}else{let r=new G(t,n,t,n+1),s=i.getValueInRange(r);e.addEditOperation(r,null),e.addEditOperation(new G(t,o,t,o),s)}}computeCursorState(i,e){return this._isMovingLeft?new ei(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ei(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}};var Ykt=class extends Mi{constructor(i,e){super(e),this.left=i}run(i,e){if(!e.hasModel())return;let t=[],o=e.getSelections();for(let n of o)t.push(new Qkt(n,this.left));e.pushUndoStop(),e.executeCommands(this.id,t),e.pushUndoStop()}},qdi=class extends Ykt{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:P(986,"Move Selected Text Left"),precondition:me.writable})}},$di=class extends Ykt{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:P(987,"Move Selected Text Right"),precondition:me.writable})}};ri(qdi);ri($di);var jdi=class extends Mi{constructor(){super({id:"editor.action.transposeLetters",label:P(988,"Transpose Letters"),precondition:me.writable,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=[],n=e.getSelections();for(let r of n){if(!r.isEmpty())continue;let s=r.startLineNumber,l=r.startColumn,c=t.getLineMaxColumn(s);if(s===1&&(l===1||l===2&&c===2))continue;let u=l===c?r.getPosition():op.rightPosition(t,r.getPosition().lineNumber,r.getPosition().column),p=op.leftPosition(t,u),h=op.leftPosition(t,p),g=t.getValueInRange(G.fromPositions(h,p)),f=t.getValueInRange(G.fromPositions(p,u)),v=G.fromPositions(h,u);o.push(new kg(v,f+g))}o.length>0&&(e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop())}};ri(jdi);var Rs=class a{constructor(i){this.value=i}static{this.sep="."}static{this.None=new a("@@none@@")}static{this.Empty=new a("")}equals(i){return this.value===i.value}contains(i){return this.equals(i)||this.value===""||i.value.startsWith(this.value+a.sep)}intersects(i){return this.contains(i)||i.contains(this)}append(...i){return new a((this.value?[this.value,...i]:i).join(a.sep))}};function Ceo(a){return a.ctrlCmd||a.alt||a.shift}var xeo={ctrlCmd:!1,alt:!1,shift:!1};var OQe=class{constructor(i){this.options=i}getItemLabel(i){return i.label}getItemDescription(i){if(!this.options?.skipDescription)return i.description}getItemPath(i){if(!this.options?.skipPath)return i.resource?.scheme===Q.file?i.resource.fsPath:i.resource?.path}},rJ=new OQe,$e=le("quickInputService");var Ka=le("IWorkspaceEditService"),sJ=class{constructor(i){this.metadata=i}static convert(i){return i.edits.map(e=>{if(hl.is(e))return hl.lift(e);if(Yu.is(e))return Yu.lift(e);throw new Error("Unsupported edit")})}},hl=class a extends sJ{constructor(e,t,o=void 0,n){super(n);this.resource=e;this.textEdit=t;this.versionId=o}static is(e){return e instanceof a?!0:Di(e)&&A.isUri(e.resource)&&Di(e.textEdit)}static lift(e){return e instanceof a?e:new a(e.resource,e.textEdit,e.versionId,e.metadata)}},Yu=class a extends sJ{constructor(e,t,o={},n){super(n);this.oldResource=e;this.newResource=t;this.options=o}static is(e){return e instanceof a?!0:Di(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof a?e:new a(e.oldResource,e.newResource,e.options,e.metadata)}};var Qdi=le("IEditorCancelService"),keo=new Y("cancellableOperation",!1,d(1110,null));Ce(Qdi,class{constructor(){this._tokens=new WeakMap}add(a,i){let e=this._tokens.get(a);e||(e=a.invokeWithinContext(o=>{let n=keo.bindTo(o.get(X)),r=new ra;return{key:n,tokens:r}}),this._tokens.set(a,e));let t;return e.key.set(!0),t=e.tokens.push(i),()=>{t&&(t(),e.key.set(!e.tokens.isEmpty()),t=void 0)}}cancel(a){let i=this._tokens.get(a);if(!i)return;let e=i.tokens.pop();e&&(e.cancel(),i.key.set(!i.tokens.isEmpty()))}},1);var Xkt=class extends qe{constructor(e,t){super(t);this.editor=e;this._unregister=e.invokeWithinContext(o=>o.get(Qdi).add(e,this))}dispose(){this._unregister(),super.dispose()}};ro(new class extends od{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:keo})}runEditorCommand(a,i){a.get(Qdi).cancel(i)}});var BK=class a{constructor(i,e){if(this.flags=e,(this.flags&1)!==0){let t=i.getModel();this.modelVersionId=t?Wd("{0}#{1}",t.uri.toString(),t.getVersionId()):null}else this.modelVersionId=null;(this.flags&4)!==0?this.position=i.getPosition():this.position=null,(this.flags&2)!==0?this.selection=i.getSelection():this.selection=null,(this.flags&8)!==0?(this.scrollLeft=i.getScrollLeft(),this.scrollTop=i.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(i){if(!(i instanceof a))return!1;let e=i;return!(this.modelVersionId!==e.modelVersionId||this.scrollLeft!==e.scrollLeft||this.scrollTop!==e.scrollTop||!this.position&&e.position||this.position&&!e.position||this.position&&e.position&&!this.position.equals(e.position)||!this.selection&&e.selection||this.selection&&!e.selection||this.selection&&e.selection&&!this.selection.equalsRange(e.selection))}validate(i){return this._equals(new a(i,this.flags))}},$k=class extends Xkt{constructor(e,t,o,n){super(e,n);this._listener=new O;t&4&&this._listener.add(e.onDidChangeCursorPosition(r=>{(!o||!G.containsPosition(o,r.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(r=>{(!o||!G.containsRange(o,r.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(r=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(r=>this.cancel())),this._listener.add(e.onDidChangeModelContent(r=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}},zde=class extends qe{constructor(i,e){super(e),this._listener=i.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}};var t4o=So.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:oF,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),Ydi=class a extends k{constructor(e,t,o,n,r){super();this.typeId=e;this.editor=t;this.range=o;this.delegate=r;this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}static{this.baseId="editor.widget.inlineProgressWidget"}create(e){this.domNode=_(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;let t=_("span.icon");this.domNode.append(t),t.classList.add(...q.asClassNameArray(L.loading),"codicon-modifier-spin");let o=()=>{let n=this.editor.getOption(75);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};o(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(61)||n.hasChanged(75))&&o()})),this._register($(this.domNode,ne.CLICK,n=>{this.delegate.cancel()}))}getId(){return a.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}},aJ=class extends k{constructor(e,t,o){super();this.id=e;this._editor=t;this._instantiationService=o;this._showDelay=500;this._showPromise=this._register(new ue);this._currentWidget=this._register(new ue);this._operationIdPool=0;this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,o,n,r){let s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=Zo(()=>{let l=G.fromPositions(e);this._currentDecorations.set([{range:l,options:t4o}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(Ydi,this.id,this._editor,l,t,n))},r??this._showDelay);try{return await o}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};aJ=I([m(2,F)],aJ);var _n=le("markdownRendererService"),FQe=class{constructor(i){this._openerService=i}render(i,e,t){let o={...e};o.actionHandler||(o.actionHandler=(r,s)=>WT(this._openerService,r,s.isTrusted)),o.codeBlockRenderer||(o.codeBlockRenderer=(r,s)=>this._defaultCodeBlockRenderer?.renderCodeBlock(r,s,o??{})??Promise.resolve(document.createElement("span")));let n=Lg(i,o,t);return n.element.classList.add("rendered-markdown"),n}setDefaultCodeBlockRenderer(i){this._defaultCodeBlockRenderer=i}};FQe=I([m(0,Je)],FQe);async function WT(a,i,e,t){try{return await a.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:i4o(e),skipValidation:t})}catch(o){return mt(o),!1}}function i4o(a){return a===!0?!0:a&&Array.isArray(a.enabledCommands)?a.enabledCommands:!1}Ce(_n,FQe,1);var Xu=class{constructor(i,e,t){this._openerService=t;this._messageWidget=new ue;this._messageListeners=new O;this._mouseOverMessage=!1;this._editor=i,this._visible=Xu.MESSAGE_VISIBLE.bindTo(e)}static{this.ID="editor.contrib.messageController"}static{this.MESSAGE_VISIBLE=new Y("messageVisible",!1,d(1462,null))}static get(i){return i.getContribution(Xu.ID)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}isVisible(){return this._visible.get()}showMessage(i,e){if(cn(yr(i)?i.value:i),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),yr(i)){let o=this._messageListeners.add(Lg(i,{actionHandler:(n,r)=>{this.closeMessage(),WT(this._openerService,n,r.isTrusted)}}));this._messageWidget.value=new WQe(this._editor,e,o.element)}else this._messageWidget.value=new WQe(this._editor,e,i);this._messageListeners.add(U.debounce(this._editor.onDidBlurEditorText,(o,n)=>n,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&ms(Un(),this._messageWidget.value.getDomNode())||this.closeMessage()})),this._messageListeners.add(this._editor.onDidChangeCursorPosition(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidDispose(()=>this.closeMessage())),this._messageListeners.add(this._editor.onDidChangeModel(()=>this.closeMessage())),this._messageListeners.add($(this._messageWidget.value.getDomNode(),ne.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add($(this._messageWidget.value.getDomNode(),ne.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let t;this._messageListeners.add(this._editor.onMouseMove(o=>{o.target.position&&(t?t.containsPosition(o.target.position)||this.closeMessage():t=new G(e.lineNumber-3,1,o.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(WQe.fadeOut(this._messageWidget.value))}};Xu=I([m(1,X),m(2,Je)],Xu);var o4o=od.bindToContribution(Xu.get);ro(new o4o({id:"leaveEditorMessage",precondition:Xu.MESSAGE_VISIBLE,handler:a=>a.closeMessage(),kbOpts:{weight:130,primary:9}}));var WQe=class{constructor(i,{lineNumber:e,column:t},o){this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._editor=i,this._editor.revealLinesInCenterIfOutsideViewport(e,e,0),this._position={lineNumber:e,column:t},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";let n=document.createElement("div");n.classList.add("anchor","top"),this._domNode.appendChild(n);let r=document.createElement("div");typeof o=="string"?(r.classList.add("message"),r.textContent=o):(o.classList.add("message"),r.appendChild(o)),this._domNode.appendChild(r);let s=document.createElement("div");s.classList.add("anchor","below"),this._domNode.appendChild(s),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}static fadeOut(i){let e=()=>{i.dispose(),clearTimeout(t),i.getDomNode().removeEventListener("animationend",e)},t=setTimeout(e,110);return i.getDomNode().addEventListener("animationend",e),i.getDomNode().classList.add("fadeOut"),{dispose:e}}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(i){this._domNode.classList.toggle("below",i===2)}};Eo(Xu.ID,Xu,4);var VQe=class{constructor(i){this.copyMimeTypes=[];this.kind=i,this.providedDropEditKinds=[this.kind],this.providedPasteEditKinds=[this.kind]}async provideDocumentPasteEdits(i,e,t,o,n){let r=await this.getEdit(t,n);if(r)return{edits:[{insertText:r.insertText,title:r.title,kind:r.kind,handledMimeType:r.handledMimeType,yieldTo:r.yieldTo}],dispose(){}}}async provideDocumentDropEdits(i,e,t,o){let n=await this.getEdit(t,o);if(n)return{edits:[{insertText:n.insertText,title:n.title,kind:n.kind,handledMimeType:n.handledMimeType,yieldTo:n.yieldTo}],dispose(){}}}},h4=class a extends VQe{constructor(){super(Rs.Empty.append("text","plain"));this.id=a.id;this.dropMimeTypes=[cr.text];this.pasteMimeTypes=[cr.text]}static{this.id="text"}async getEdit(e,t){let o=e.get(cr.text);if(!o||e.has(cr.uriList))return;let n=await o.asString();return{handledMimeType:cr.text,title:d(1104,null),insertText:n,kind:this.kind}}},Jkt=class extends VQe{constructor(){super(Rs.Empty.append("uri","path","absolute"));this.dropMimeTypes=[cr.uriList];this.pasteMimeTypes=[cr.uriList]}async getEdit(e,t){let o=await Eeo(e);if(!o.length||t.isCancellationRequested)return;let n=0,r=o.map(({uri:l,originalText:c})=>l.scheme===Q.file?l.fsPath:(n++,c)).join(" "),s;return n>0?s=o.length>1?d(1102,null):d(1101,null):s=o.length>1?d(1098,null):d(1097,null),{handledMimeType:cr.uriList,insertText:r,title:s,kind:this.kind}}},eEe=class extends VQe{constructor(e){super(Rs.Empty.append("uri","path","relative"));this._workspaceContextService=e;this.dropMimeTypes=[cr.uriList];this.pasteMimeTypes=[cr.uriList]}async getEdit(e,t){let o=await Eeo(e);if(!o.length||t.isCancellationRequested)return;let n=ui(o.map(({uri:r})=>{let s=this._workspaceContextService.getWorkspaceFolder(r);return s?lu(s.uri,r):void 0}));if(n.length)return{handledMimeType:cr.uriList,insertText:n.join(" "),title:o.length>1?d(1100,null):d(1099,null),kind:this.kind}}};eEe=I([m(0,Ae)],eEe);var Xdi=class{constructor(){this.kind=new Rs("html");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=["text/html"];this._yieldTo=[{mimeType:cr.text}]}async provideDocumentPasteEdits(i,e,t,o,n){if(o.triggerKind!==1&&!o.only?.contains(this.kind))return;let s=await t.get("text/html")?.asString();if(!(!s||n.isCancellationRequested))return{dispose(){},edits:[{insertText:s,yieldTo:this._yieldTo,title:d(1103,null),kind:this.kind}]}}};async function Eeo(a){let i=a.get(cr.uriList);if(!i)return[];let e=await i.asString(),t=[];for(let o of $w.parse(e))try{t.push({uri:A.parse(o),originalText:o})}catch{}return t}var Kde={scheme:"*",hasAccessToAllModels:!0},tEe=class extends k{constructor(i,e){super(),this._register(i.documentDropEditProvider.register(Kde,new h4)),this._register(i.documentDropEditProvider.register(Kde,new Jkt)),this._register(i.documentDropEditProvider.register(Kde,new eEe(e)))}};tEe=I([m(0,Jt),m(1,Ae)],tEe);var iEe=class extends k{constructor(i,e){super(),this._register(i.documentPasteEditProvider.register(Kde,new h4)),this._register(i.documentPasteEditProvider.register(Kde,new Jkt)),this._register(i.documentPasteEditProvider.register(Kde,new eEe(e))),this._register(i.documentPasteEditProvider.register(Kde,new Xdi))}};iEe=I([m(0,Jt),m(1,Ae)],iEe);var Jdi=class a{constructor(){this.value="";this.pos=0}static{this._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13}}static isDigitCharacter(i){return i>=48&&i<=57}static isVariableCharacter(i){return i===95||i>=97&&i<=122||i>=65&&i<=90}text(i){this.value=i,this.pos=0}tokenText(i){return this.value.substr(i.pos,i.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};let i=this.pos,e=0,t=this.value.charCodeAt(i),o;if(o=a._table[t],typeof o=="number")return this.pos+=1,{type:o,pos:i,len:1};if(a.isDigitCharacter(t)){o=8;do e+=1,t=this.value.charCodeAt(i+e);while(a.isDigitCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}if(a.isVariableCharacter(t)){o=9;do t=this.value.charCodeAt(i+ ++e);while(a.isVariableCharacter(t)||a.isDigitCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}o=10;do e+=1,t=this.value.charCodeAt(i+e);while(!isNaN(t)&&typeof a._table[t]>"u"&&!a.isDigitCharacter(t)&&!a.isVariableCharacter(t));return this.pos+=e,{type:o,pos:i,len:e}}},lJ=class{constructor(){this._children=[]}appendChild(i){return i instanceof VS&&this._children[this._children.length-1]instanceof VS?this._children[this._children.length-1].value+=i.value:(i.parent=this,this._children.push(i)),this}replace(i,e){let{parent:t}=i,o=t.children.indexOf(i),n=t.children.slice(0);n.splice(o,1,...e),t._children=n,(function r(s,l){for(let c of s)c.parent=l,r(c.children,c)})(e,t)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let i=this;for(;;){if(!i)return;if(i instanceof oEe)return i;i=i.parent}}toString(){return this.children.reduce((i,e)=>i+e.toString(),"")}len(){return 0}},VS=class a extends lJ{constructor(e){super();this.value=e}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}toString(){return this.value}toTextmateString(){return a.escape(this.value)}len(){return this.value.length}clone(){return new a(this.value)}},Zkt=class extends lJ{},jk=class a extends Zkt{constructor(e){super();this.index=e}static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof Gde?this._children[0]:void 0}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0&&!this.transform?`$${this.index}`:this.children.length===0?`\${${this.index}${e}}`:this.choice?`\${${this.index}|${this.choice.toTextmateString()}|${e}}`:`\${${this.index}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new a(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}},Gde=class a extends lJ{constructor(){super(...arguments);this.options=[]}appendChild(e){return e instanceof VS&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}toTextmateString(){return this.options.map(e=>e.value.replace(/\||,|\\/g,"\\$&")).join(",")}len(){return this.options[0].len()}clone(){let e=new a;return this.options.forEach(e.appendChild,e),e}},Zdi=class a extends lJ{constructor(){super(...arguments);this.regexp=new RegExp("")}resolve(e){let t=this,o=!1,n=e.replace(this.regexp,function(){return o=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!o&&this._children.some(r=>r instanceof jB&&!!r.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(let o of this._children)if(o instanceof jB){let n=e[o.index]||"";n=o.resolve(n),t+=n}else t+=o.toString();return t}toString(){return""}toTextmateString(){return`/${this.regexp.source}/${this.children.map(e=>e.toTextmateString()).join("")}/${(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")}`}clone(){let e=new a;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}},jB=class a extends lJ{constructor(e,t,o,n){super();this.index=e;this.shorthandName=t;this.ifValue=o;this.elseValue=n}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":this.shorthandName==="kebabcase"?e?this._toKebabCase(e):"":this.shorthandName==="snakecase"?e?this._toSnakeCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toKebabCase(e){if(!e.match(/[\p{L}0-9]+/gu))return e;if(!e.match(/[\p{L}0-9]/u))return e.trim().toLowerCase().replace(/^_+|_+$/g,"").replace(/[\s_]+/g,"-");let o=e.trim().replace(/^_+|_+$/g,""),n=o.match(/\p{Lu}{2,}(?=\p{Lu}\p{Ll}+[0-9]*|[\s_-]|$)|\p{Lu}?\p{Ll}+[0-9]*|\p{Lu}(?=\p{Lu}\p{Ll})|\p{Lu}(?=[\s_-]|$)|[0-9]+/gu);return n?n.map(r=>r.toLowerCase()).join("-"):o.split(/[\s_-]+/).filter(r=>r.length>0).map(r=>r.toLowerCase()).join("-")}_toPascalCase(e){let t=e.match(/[\p{L}0-9]+/gu);return t?t.map(o=>o.charAt(0).toUpperCase()+o.substr(1)).join(""):e}_toCamelCase(e){let t=e.match(/[\p{L}0-9]+/gu);return t?t.map((o,n)=>n===0?o.charAt(0).toLowerCase()+o.substr(1):o.charAt(0).toUpperCase()+o.substr(1)).join(""):e}_toSnakeCase(e){return e.replace(/(\p{Ll})(\p{Lu})/gu,"$1_$2").replace(/[\s\-]+/g,"_").toLowerCase()}toTextmateString(){let e="${";return e+=this.index,this.shorthandName?e+=`:/${this.shorthandName}`:this.ifValue&&this.elseValue?e+=`:?${this.ifValue}:${this.elseValue}`:this.ifValue?e+=`:+${this.ifValue}`:this.elseValue&&(e+=`:-${this.elseValue}`),e+="}",e}clone(){return new a(this.index,this.shorthandName,this.ifValue,this.elseValue)}},HK=class a extends Zkt{constructor(e){super();this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new VS(t)],!0):!1}toTextmateString(){let e="";return this.transform&&(e=this.transform.toTextmateString()),this.children.length===0?`\${${this.name}${e}}`:`\${${this.name}:${this.children.map(t=>t.toTextmateString()).join("")}${e}}`}clone(){let e=new a(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}};function Teo(a,i){let e=[...a];for(;e.length>0;){let t=e.shift();if(!i(t))break;e.unshift(...t.children)}}var oEe=class a extends lJ{get placeholderInfo(){if(!this._placeholders){let i=[],e;this.walk(function(t){return t instanceof jk&&(i.push(t),e=!e||e.index<t.index?t:e),!0}),this._placeholders={all:i,last:e}}return this._placeholders}get placeholders(){let{all:i}=this.placeholderInfo;return i}offset(i){let e=0,t=!1;return this.walk(o=>o===i?(t=!0,!1):(e+=o.len(),!0)),t?e:-1}fullLen(i){let e=0;return Teo([i],t=>(e+=t.len(),!0)),e}enclosingPlaceholders(i){let e=[],{parent:t}=i;for(;t;)t instanceof jk&&e.push(t),t=t.parent;return e}resolveVariables(i){return this.walk(e=>(e instanceof HK&&e.resolve(i)&&(this._placeholders=void 0),!0)),this}appendChild(i){return this._placeholders=void 0,super.appendChild(i)}replace(i,e){return this._placeholders=void 0,super.replace(i,e)}toTextmateString(){return this.children.reduce((i,e)=>i+e.toTextmateString(),"")}clone(){let i=new a;return i._children=this.children.map(e=>e.clone()),i}walk(i){Teo(this.children,i)}},Og=class a{constructor(){this._scanner=new Jdi;this._token={type:14,pos:0,len:0}}static escape(i){return i.replace(/\$|}|\\/g,"\\$&")}static asInsertText(i){return new a().parse(i).toString()}static guessNeedsClipboard(i){return/\${?CLIPBOARD/.test(i)}parse(i,e,t){let o=new oEe;return this.parseFragment(i,o),this.ensureFinalTabstop(o,t??!1,e??!1),o}parseFragment(i,e){let t=e.children.length;for(this._scanner.text(i),this._token=this._scanner.next();this._parse(e););let o=new Map,n=[];e.walk(l=>(l instanceof jk&&(l.isFinalTabstop?o.set(0,void 0):!o.has(l.index)&&l.children.length>0?o.set(l.index,l.children):n.push(l)),!0));let r=(l,c)=>{let u=o.get(l.index);if(!u)return;let p=new jk(l.index);p.transform=l.transform;for(let h of u){let g=h.clone();p.appendChild(g),g instanceof jk&&o.has(g.index)&&!c.has(g.index)&&(c.add(g.index),r(g,c),c.delete(g.index))}e.replace(l,[p])},s=new Set;for(let l of n)r(l,s);return e.children.slice(t)}ensureFinalTabstop(i,e,t){(e||t&&i.placeholders.length>0)&&(i.placeholders.find(n=>n.index===0)||i.appendChild(new jk(0)))}_accept(i,e){if(i===void 0||this._token.type===i){let t=e?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),t}return!1}_backTo(i){return this._scanner.pos=i.pos+i.len,this._token=i,!1}_until(i){let e=this._token;for(;this._token.type!==i;){if(this._token.type===14)return!1;if(this._token.type===5){let o=this._scanner.next();if(o.type!==0&&o.type!==4&&o.type!==5)return!1}this._token=this._scanner.next()}let t=this._scanner.value.substring(e.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),t}_parse(i){return this._parseEscaped(i)||this._parseTabstopOrVariableName(i)||this._parseComplexPlaceholder(i)||this._parseComplexVariable(i)||this._parseAnything(i)}_parseEscaped(i){let e;return(e=this._accept(5,!0))?(e=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||e,i.appendChild(new VS(e)),!0):!1}_parseTabstopOrVariableName(i){let e,t=this._token;return this._accept(0)&&(e=this._accept(9,!0)||this._accept(8,!0))?(i.appendChild(/^\d+$/.test(e)?new jk(Number(e)):new HK(e)),!0):this._backTo(t)}_parseComplexPlaceholder(i){let e,t=this._token;if(!(this._accept(0)&&this._accept(3)&&(e=this._accept(8,!0))))return this._backTo(t);let n=new jk(Number(e));if(this._accept(1))for(;;){if(this._accept(4))return i.appendChild(n),!0;if(!this._parse(n))return i.appendChild(new VS("${"+e+":")),n.children.forEach(i.appendChild,i),!0}else if(n.index>0&&this._accept(7)){let r=new Gde;for(;;){if(this._parseChoiceElement(r)){if(this._accept(2))continue;if(this._accept(7)&&(n.appendChild(r),this._accept(4)))return i.appendChild(n),!0}return this._backTo(t),!1}}else return this._accept(6)?this._parseTransform(n)?(i.appendChild(n),!0):(this._backTo(t),!1):this._accept(4)?(i.appendChild(n),!0):this._backTo(t)}_parseChoiceElement(i){let e=this._token,t=[];for(;!(this._token.type===2||this._token.type===7);){let o;if((o=this._accept(5,!0))?o=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||o:o=this._accept(void 0,!0),!o)return this._backTo(e),!1;t.push(o)}return t.length===0?(this._backTo(e),!1):(i.appendChild(new VS(t.join(""))),!0)}_parseComplexVariable(i){let e,t=this._token;if(!(this._accept(0)&&this._accept(3)&&(e=this._accept(9,!0))))return this._backTo(t);let n=new HK(e);if(this._accept(1))for(;;){if(this._accept(4))return i.appendChild(n),!0;if(!this._parse(n))return i.appendChild(new VS("${"+e+":")),n.children.forEach(i.appendChild,i),!0}else return this._accept(6)?this._parseTransform(n)?(i.appendChild(n),!0):(this._backTo(t),!1):this._accept(4)?(i.appendChild(n),!0):this._backTo(t)}_parseTransform(i){let e=new Zdi,t="",o="";for(;!this._accept(6);){let n;if(n=this._accept(5,!0)){n=this._accept(6,!0)||n,t+=n;continue}if(this._token.type!==14){t+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let n;if(n=this._accept(5,!0)){n=this._accept(5,!0)||this._accept(6,!0)||n,e.appendChild(new VS(n));continue}if(!(this._parseFormatString(e)||this._parseAnything(e)))return!1}for(;!this._accept(4);){if(this._token.type!==14){o+=this._accept(void 0,!0);continue}return!1}try{e.regexp=new RegExp(t,o)}catch{return!1}return i.transform=e,!0}_parseFormatString(i){let e=this._token;if(!this._accept(0))return!1;let t=!1;this._accept(3)&&(t=!0);let o=this._accept(8,!0);if(o)if(t){if(this._accept(4))return i.appendChild(new jB(Number(o))),!0;if(!this._accept(1))return this._backTo(e),!1}else return i.appendChild(new jB(Number(o))),!0;else return this._backTo(e),!1;if(this._accept(6)){let n=this._accept(9,!0);return!n||!this._accept(4)?(this._backTo(e),!1):(i.appendChild(new jB(Number(o),n)),!0)}else if(this._accept(11)){let n=this._until(4);if(n)return i.appendChild(new jB(Number(o),void 0,n,void 0)),!0}else if(this._accept(12)){let n=this._until(4);if(n)return i.appendChild(new jB(Number(o),void 0,void 0,n)),!0}else if(this._accept(13)){let n=this._until(1);if(n){let r=this._until(4);if(r)return i.appendChild(new jB(Number(o),void 0,n,r)),!0}}else{let n=this._until(4);if(n)return i.appendChild(new jB(Number(o),void 0,void 0,n)),!0}return this._backTo(e),!1}_parseAnything(i){return this._token.type!==14?(i.appendChild(new VS(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}};function eEt(a,i,e){return(typeof e.insertText=="string"?e.insertText==="":e.insertText.snippet==="")?{edits:e.additionalEdit?.edits??[]}:{edits:[...i.map(t=>new hl(a,{range:t,text:typeof e.insertText=="string"?Og.escape(e.insertText)+"$0":e.insertText.snippet,insertAsSnippet:!0})),...e.additionalEdit?.edits??[]]}}function tEt(a){function i(r,s){return"mimeType"in r?r.mimeType===s.handledMimeType:!!s.kind&&r.kind.contains(s.kind)}let e=new Map;for(let r of a)for(let s of r.yieldTo??[])for(let l of a)if(l!==r&&i(s,l)){let c=e.get(r);c||(c=[],e.set(r,c)),c.push(l)}if(!e.size)return Array.from(a);let t=new Set,o=[];function n(r){if(!r.length)return[];let s=r[0];if(o.includes(s))return console.warn("Yield to cycle detected",s),r;if(t.has(s))return n(r.slice(1));let l=[],c=e.get(s);return c&&(o.push(s),l=n(c),o.pop()),t.add(s),[...l,s,...n(r.slice(1))]}return n(Array.from(a))}var nEe={buttonBackground:"#0E639C",buttonHoverBackground:"#006BB3",buttonSeparator:Ue.white.toString(),buttonForeground:Ue.white.toString(),buttonBorder:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSecondaryBorder:void 0},_eo=Object.freeze({allowedTags:{override:["b","i","u","code","span"]},allowedAttributes:{override:["class"]}}),Deo=Object.freeze({sanitizerConfig:{allowedAttributes:{override:["class"]}}}),Pi=class extends k{constructor(e,t){super();this._label="";this._onDidClick=this._register(new T);this._onDidEscape=this._register(new T);this.options=t,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),this._element.classList.toggle("secondary",!!t.secondary),this._element.classList.toggle("small",!!t.small);let o=t.secondary?t.buttonSecondaryBackground:t.buttonBackground,n=t.secondary?t.buttonSecondaryForeground:t.buttonForeground,r=t.secondary?t.buttonSecondaryBorder:t.buttonBorder;this._element.style.color=n||"",this._element.style.backgroundColor=o||"",r&&(this._element.style.border=`1px solid ${r}`),t.supportShortLabel&&(this._labelShortElement=document.createElement("div"),this._labelShortElement.classList.add("monaco-button-label-short"),this._element.appendChild(this._labelShortElement),this._labelElement=document.createElement("div"),this._labelElement.classList.add("monaco-button-label"),this._element.appendChild(this._labelElement),this._element.classList.add("monaco-text-button-with-short-label")),typeof t.title=="string"&&this.setTitle(t.title),typeof t.ariaLabel=="string"&&this._element.setAttribute("aria-label",t.ariaLabel),e.appendChild(this._element),this.enabled=!t.disabled,this._register(ds.addTarget(this._element)),[ne.CLICK,Vn.Tap].forEach(s=>{this._register($(this._element,s,l=>{if(!this.enabled){Kt.stop(l);return}this._onDidClick.fire(l)}))}),this._register($(this._element,ne.KEY_DOWN,s=>{let l=new mi(s),c=!1;this.enabled&&(l.equals(3)||l.equals(10))?(this._onDidClick.fire(s),c=!0):l.equals(9)&&(this._onDidEscape.fire(s),this._element.blur(),c=!0),c&&Kt.stop(l,!0)})),this._register($(this._element,ne.MOUSE_OVER,s=>{this._element.classList.contains("disabled")||this.updateStyles(!0)})),this._register($(this._element,ne.MOUSE_OUT,s=>{this.updateStyles(!1)})),this.focusTracker=this._register(nr(this._element)),this._register(this.focusTracker.onDidFocus(()=>{this.enabled&&this.updateStyles(!0)})),this._register(this.focusTracker.onDidBlur(()=>{this.enabled&&this.updateStyles(!1)}))}get onDidClick(){return this._onDidClick.event}get onDidEscape(){return this._onDidEscape.event}dispose(){super.dispose(),this._element.remove()}getContentElements(e){let t=[];for(let o of ir(e))if(typeof o=="string"){if(o=o.trim(),o==="")continue;let n=document.createElement("span");n.textContent=o,t.push(n)}else t.push(o);return t}updateStyles(e){let t,o,n;this.options.secondary?(t=e?this.options.buttonSecondaryHoverBackground:this.options.buttonSecondaryBackground,o=this.options.buttonSecondaryForeground,n=this.options.buttonSecondaryBorder):(t=e?this.options.buttonHoverBackground:this.options.buttonBackground,o=this.options.buttonForeground,n=this.options.buttonBorder),this._element.style.backgroundColor=t||"",this._element.style.color=o||"",this._element.style.border=n?`1px solid ${n}`:""}get element(){return this._element}set label(e){if(this._label===e||yr(this._label)&&yr(e)&&Cde(this._label,e))return;this._element.classList.add("monaco-text-button");let t=this.options.supportShortLabel?this._labelElement:this._element;if(yr(e)){let n=Lg(e,Deo,document.createElement("span"));n.dispose();let r=n.element.querySelector("p")?.innerHTML;r?AA(t,r,_eo):Ii(t)}else this.options.supportIcons?Ii(t,...this.getContentElements(e)):t.textContent=e;let o="";typeof this.options.title=="string"?o=this.options.title:this.options.title&&(o=ma(e)),this.setTitle(o),this._setAriaLabel(),this._label=e}get label(){return this._label}set labelShort(e){!this.options.supportShortLabel||!this._labelShortElement||(this.options.supportIcons?Ii(this._labelShortElement,...this.getContentElements(e)):this._labelShortElement.textContent=e)}_setAriaLabel(){typeof this.options.ariaLabel=="string"?this._element.setAttribute("aria-label",this.options.ariaLabel):typeof this.options.title=="string"&&this._element.setAttribute("aria-label",this.options.title)}set icon(e){this._setAriaLabel();let t=Array.from(this._element.classList).filter(o=>o.startsWith("codicon-"));this._element.classList.remove(...t),this._element.classList.add(...q.asClassNameArray(e))}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}set secondary(e){this._element.classList.toggle("secondary",e),this.options.secondary=e,this.updateStyles(!1)}set checked(e){e?(this._element.classList.add("checked"),this._element.setAttribute("aria-pressed","true")):(this._element.classList.remove("checked"),this._element.setAttribute("aria-pressed","false"))}get checked(){return this._element.classList.contains("checked")}setTitle(e){!this._hover&&e!==""?this._hover=this._register(sp().setupManagedHover(this.options.hoverDelegate??yi("element"),this._element,e)):this._hover&&this._hover.update(e)}setAriaLabel(e){this._element.setAttribute("aria-label",e)}focus(){this._element.focus()}hasFocus(){return Na(this._element)}},Jv=class extends k{constructor(e,t){super();this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this.element=document.createElement("div"),this.element.classList.add("monaco-button-dropdown"),e.appendChild(this.element),t.hoverDelegate||(t={...t,hoverDelegate:this._register(Dg())}),this.primaryButton=this._register(new Pi(this.element,t)),this._register(this.primaryButton.onDidClick(r=>this._onDidClick.fire(r))),this.action=li({id:"primaryAction",label:ma(this.primaryButton.label),run:async()=>this._onDidClick.fire(void 0)}),this.separatorContainer=document.createElement("div"),this.separatorContainer.classList.add("monaco-button-dropdown-separator"),this.separator=document.createElement("div"),this.separatorContainer.appendChild(this.separator),this.element.appendChild(this.separatorContainer);let o=t.buttonBorder;o&&(this.separatorContainer.style.borderTop="1px solid "+o,this.separatorContainer.style.borderBottom="1px solid "+o);let n=t.secondary?t.buttonSecondaryBackground:t.buttonBackground;this.separatorContainer.style.backgroundColor=n??"",this.separator.style.backgroundColor=t.buttonSeparator??"",this.dropdownButton=this._register(new Pi(this.element,{...t,title:d(1,null),supportIcons:!0})),this.dropdownButton.element.setAttribute("aria-haspopup","true"),this.dropdownButton.element.setAttribute("aria-expanded","false"),this.dropdownButton.element.classList.add("monaco-dropdown-button"),this.dropdownButton.icon=L.dropDownButton,this._register(this.dropdownButton.onDidClick(r=>{let s=Array.isArray(t.actions)?t.actions:t.actions.getActions();t.contextMenuProvider.showContextMenu({getAnchor:()=>this.dropdownButton.element,getActions:()=>t.addPrimaryActionToDropdown===!1?[...s]:[this.action,...s],actionRunner:t.actionRunner,onHide:()=>this.dropdownButton.element.setAttribute("aria-expanded","false"),layer:t.dropdownLayer}),this.dropdownButton.element.setAttribute("aria-expanded","true")}))}dispose(){super.dispose(),this.element.remove()}set label(e){this.primaryButton.label=e,this.action.label=e}set icon(e){this.primaryButton.icon=e}set enabled(e){this.primaryButton.enabled=e,this.dropdownButton.enabled=e,this.element.classList.toggle("disabled",!e)}get enabled(){return this.primaryButton.enabled}set checked(e){this.primaryButton.checked=e}get checked(){return this.primaryButton.checked}setTitle(e){this.primaryButton.setTitle(e)}setAriaLabel(e){this.primaryButton.setAriaLabel(e)}focus(){this.primaryButton.focus()}hasFocus(){return this.primaryButton.hasFocus()||this.dropdownButton.hasFocus()}},BQe=class{constructor(i,e){this.options=e;this._element=document.createElement("div"),this._element.classList.add("monaco-description-button"),this._button=new Pi(this._element,e),this._descriptionElement=document.createElement("div"),this._descriptionElement.classList.add("monaco-button-description"),this._element.appendChild(this._descriptionElement),i.appendChild(this._element)}get onDidClick(){return this._button.onDidClick}get element(){return this._element}set label(i){this._button.label=i}set icon(i){this._button.icon=i}get enabled(){return this._button.enabled}set enabled(i){this._button.enabled=i}set checked(i){this._button.checked=i}get checked(){return this._button.checked}setTitle(i){this._button.setTitle(i)}setAriaLabel(i){this._button.setAriaLabel(i)}focus(){this._button.focus()}hasFocus(){return this._button.hasFocus()}dispose(){this._button.dispose()}set description(i){this.options.supportIcons?Ii(this._descriptionElement,...ir(i)):this._descriptionElement.textContent=i}};var sC=class{constructor(i,e){this.container=i;this.options=e;this._buttons=[];this._buttonStore=new O}dispose(){this._buttonStore.dispose()}get buttons(){return this._buttons}clear(){this._buttonStore.clear(),this._buttons.length=0}addButton(i){let e=this._buttonStore.add(new Pi(this.container,i));return this.pushButton(e),e}addButtonWithDescription(i){let e=this._buttonStore.add(new BQe(this.container,i));return this.pushButton(e),e}addButtonWithDropdown(i){let e=this._buttonStore.add(new Jv(this.container,i));return this.pushButton(e),e}pushButton(i){this._buttons.push(i);let e=this._buttons.length-1;this._buttonStore.add($(i.element,ne.KEY_DOWN,t=>{let o=new mi(t),n=!0,r;o.equals(this.options?.alignment===1?16:15)?r=e>0?e-1:this._buttons.length-1:o.equals(this.options?.alignment===1?18:17)?r=e===this._buttons.length-1?0:e+1:n=!1,n&&typeof r=="number"&&(this._buttons[r].focus(),Kt.stop(t,!0))}))}},lM=class extends Pi{get labelElement(){return this._mdlabelElement}get iconElement(){return this._iconElement}constructor(i,e){if(super(i,e),e.supportShortLabel)throw new Error("ButtonWithIcon does not support short labels");this._element.classList.add("monaco-icon-button"),this._iconElement=_(""),this._mdlabelElement=_(".monaco-button-mdlabel"),this._element.append(this._iconElement,this._mdlabelElement)}get label(){return super.label}set label(i){if(this._label===i||yr(this._label)&&yr(i)&&Cde(this._label,i))return;if(this._element.classList.add("monaco-text-button"),yr(i)){let t=Lg(i,Deo,document.createElement("span"));t.dispose();let o=t.element.querySelector("p")?.innerHTML;o?AA(this._mdlabelElement,o,_eo):Ii(this._mdlabelElement)}else this.options.supportIcons?Ii(this._mdlabelElement,...this.getContentElements(i)):this._mdlabelElement.textContent=i;let e="";typeof this.options.title=="string"?e=this.options.title:this.options.title&&(e=ma(i)),this.setTitle(e),this._setAriaLabel(),this._label=i}get icon(){return super.icon}set icon(i){this._iconElement.classList.value="",this._iconElement.classList.add(...q.asClassNameArray(i)),this._setAriaLabel()}};var iEt=_,HQe={keybindingLabelBackground:void 0,keybindingLabelForeground:void 0,keybindingLabelBorder:void 0,keybindingLabelBottomBorder:void 0,keybindingLabelShadow:void 0},ah=class a extends k{constructor(e,t,o){super();this.os=t;this.keyElements=new Set;this.options=o||Object.create(null);let n=this.options.keybindingLabelForeground;this.domNode=D(e,iEt(".monaco-keybinding")),n&&(this.domNode.style.color=n),this.hover=this._register(sp().setupManagedHover(yi("mouse"),this.domNode,"")),this.didEverRender=!1,e.appendChild(this.domNode)}get element(){return this.domNode}set(e,t){this.didEverRender&&this.keybinding===e&&a.areSame(this.matches,t)||(this.keybinding=e,this.matches=t,this.render())}render(){if(this.clear(),this.keybinding){let e=this.keybinding.getChords();e[0]&&this.renderChord(this.domNode,e[0],this.matches?this.matches.firstPart:null);for(let o=1;o<e.length;o++)D(this.domNode,iEt("span.monaco-keybinding-key-chord-separator",void 0," ")),this.renderChord(this.domNode,e[o],this.matches?this.matches.chordPart:null);let t=this.options.disableTitle??!1?void 0:this.keybinding.getAriaLabel()||void 0;this.hover.update(t),this.domNode.setAttribute("aria-label",t||"")}else this.options&&this.options.renderUnboundKeybindings&&this.renderUnbound(this.domNode);this.didEverRender=!0}clear(){St(this.domNode),this.keyElements.clear()}renderChord(e,t,o){let n=nM.modifierLabels[this.os];t.ctrlKey&&this.renderKey(e,n.ctrlKey,!!o?.ctrlKey,n.separator),t.shiftKey&&this.renderKey(e,n.shiftKey,!!o?.shiftKey,n.separator),t.altKey&&this.renderKey(e,n.altKey,!!o?.altKey,n.separator),t.metaKey&&this.renderKey(e,n.metaKey,!!o?.metaKey,n.separator);let r=t.keyLabel;r&&this.renderKey(e,r,!!o?.keyCode,"")}renderKey(e,t,o,n){D(e,this.createKeyElement(t,o?".highlight":"")),n&&D(e,iEt("span.monaco-keybinding-key-separator",void 0,n))}renderUnbound(e){D(e,this.createKeyElement(d(25,null)))}createKeyElement(e,t=""){let o=iEt("span.monaco-keybinding-key"+t,void 0,e);return this.keyElements.add(o),this.options.keybindingLabelBackground&&(o.style.backgroundColor=this.options.keybindingLabelBackground),this.options.keybindingLabelBorder&&(o.style.borderColor=this.options.keybindingLabelBorder),this.options.keybindingLabelBottomBorder&&(o.style.borderBottomColor=this.options.keybindingLabelBottomBorder),this.options.keybindingLabelShadow&&(o.style.boxShadow=`inset 0 -1px 0 ${this.options.keybindingLabelShadow}`),o}static areSame(e,t){return e===t||!e&&!t?!0:!!e&&!!t&&Qi(e.firstPart,t.firstPart)&&Qi(e.chordPart,t.chordPart)}};var Kl=le("layoutService");var oui="acceptSelectedCodeAction",nui="previewSelectedCodeAction";var eui=class{get templateId(){return"header"}renderTemplate(i){i.classList.add("group-header");let e=document.createElement("span");return i.append(e),{container:i,text:e}}renderElement(i,e,t){t.text.textContent=i.group?.title??i.label??""}disposeTemplate(i){}},tui=class{get templateId(){return"separator"}renderTemplate(i){i.classList.add("separator");let e=document.createElement("span");return i.append(e),{container:i,text:e}}renderElement(i,e,t){t.text.textContent=i.label??""}disposeTemplate(i){}},UQe=class{constructor(i,e,t,o,n,r,s,l,c){this._supportsPreview=i;this._onRemoveItem=e;this._onShowSubmenu=t;this._hasAnySubmenuActions=o;this._groupTitleByIndex=n;this._linkHandler=r;this._hideDefaultKeybindingTooltip=s;this._keybindingService=l;this._openerService=c}get templateId(){return"action"}renderTemplate(i){i.classList.add(this.templateId);let e=document.createElement("div");e.className="icon",i.append(e);let t=document.createElement("span");t.className="title",i.append(t);let o=document.createElement("span");o.className="action-item-badge",i.append(o);let n=document.createElement("span");n.className="description",i.append(n);let r=document.createElement("span");r.className="group-title",i.append(r);let s=document.createElement("span");s.className="detail",i.append(s);let l=new ah(i,Ao),c=document.createElement("div");c.className="action-list-item-toolbar",i.append(c);let u=document.createElement("div");u.className="action-list-submenu-indicator",i.append(u);let p=new O;return{container:i,icon:e,text:t,detail:s,badge:o,description:n,groupTitle:r,keybinding:l,toolbar:c,submenuIndicator:u,elementDisposables:p}}renderElement(i,e,t){if(t.elementDisposables.clear(),i.group?.icon?(t.icon.className=q.asClassName(i.group.icon),i.group.icon.color&&(t.icon.style.color=Tt(i.group.icon.color.id))):(t.icon.className=q.asClassName(L.lightBulb),t.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!i.item||!i.label)return;if(Md(!i.hideIcon,t.icon),i.isSectionToggle){let l=i.group?.icon===L.chevronDown;t.container.setAttribute("aria-expanded",String(l))}else t.container.removeAttribute("aria-expanded");if(t.previousClassName&&t.container.classList.remove(t.previousClassName),t.container.classList.toggle("action-list-custom",!!i.className),i.className&&t.container.classList.add(i.className),t.previousClassName=i.className,t.text.textContent=$de(i.label),i.badge?(t.badge.textContent=i.badge,t.badge.style.display=""):(t.badge.textContent="",t.badge.style.display="none"),i.keybinding)t.description.textContent=i.keybinding.getLabel(),t.description.style.display="inline",t.description.style.letterSpacing="0.5px";else if(i.description){if(St(t.description),typeof i.description=="string")t.description.textContent=$de(i.description);else{let l=Lg(i.description,{actionHandler:c=>{let u=A.parse(c);this._linkHandler?this._linkHandler(u,i):this._openerService.open(u,{allowCommands:!0})}});t.elementDisposables.add(l),t.description.appendChild(l.element)}t.description.style.display="inline"}else t.description.textContent="",t.description.style.display="none";let o=this._groupTitleByIndex.get(e);o?(t.groupTitle.textContent=o,t.groupTitle.style.display=""):(t.groupTitle.textContent="",t.groupTitle.style.display="none"),i.detail?(t.detail.textContent=$de(i.detail),t.detail.style.display=""):(t.detail.textContent="",t.detail.style.display="none");let n=this._keybindingService.lookupKeybinding(oui)?.getLabel(),r=this._keybindingService.lookupKeybinding(nui)?.getLabel();t.container.classList.toggle("option-disabled",!!i.disabled),i.hover!==void 0?t.container.title="":i.tooltip?t.container.title=i.tooltip:i.disabled?t.container.title=i.label:this._hideDefaultKeybindingTooltip?t.container.title="":n&&r?this._supportsPreview&&i.canPreview?t.container.title=d(1837,null,n,r):t.container.title=d(1836,null,n):t.container.title="",St(t.toolbar);let s=[...i.toolbarActions??[]];if(i.onRemove&&s.push(li({id:"actionList.remove",label:d(1832,null),class:q.asClassName(L.close),run:async()=>{await i.onRemove(),this._onRemoveItem?.(i)}})),t.container.classList.toggle("has-toolbar",s.length>0),s.length>0){let l=new oo(t.toolbar);t.elementDisposables.add(l),l.push(s,{icon:!0,label:!1})}i.submenuActions?.length&&!i.hover?.content?(t.submenuIndicator.className="action-list-submenu-indicator has-submenu "+q.asClassName(L.chevronRight),t.submenuIndicator.style.display="",t.submenuIndicator.style.visibility="",t.elementDisposables.add($(t.submenuIndicator,ne.CLICK,l=>{l.stopPropagation(),this._onShowSubmenu?.(i)}))):this._hasAnySubmenuActions?(t.submenuIndicator.className="action-list-submenu-indicator",t.submenuIndicator.style.display="",t.submenuIndicator.style.visibility="hidden"):(t.submenuIndicator.className="action-list-submenu-indicator",t.submenuIndicator.style.display="none")}disposeTemplate(i){i.keybinding.dispose(),i.elementDisposables.dispose()}};UQe=I([m(7,Le),m(8,Je)],UQe);var iui=class extends UIEvent{constructor(){super("acceptSelectedAction")}},oEt=class extends UIEvent{constructor(){super("previewSelectedAction")}};function r4o(a){if(a.kind==="action")return a.label}var qde=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._delegate=n;this._options=s;this._keybindingService=l;this._openerService=c;this._instantiationService=u;this._headerLineHeight=24;this._separatorLineHeight=8;this.cts=this._register(new qe);this._submenuDisposables=this._register(new O);this._collapsedSections=new Set;this._filterText="";this._suppressHover=!1;this._hasLaidOut=!1;this._filterCts=this._register(new ue);this._groupTitleByIndex=new Map;this._onDidRequestLayout=this._register(new T);this.onDidRequestLayout=this._onDidRequestLayout.event;if(this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._options?.inlineDescription&&this.domNode.classList.add("inline-description"),this._actionLineHeight=24,this._submenuContainer=document.createElement("div"),this._submenuContainer.className="action-list-submenu-panel action-widget",this._submenuContainer.style.display="none",this.domNode.append(this._submenuContainer),this._register($(this._submenuContainer,"mouseenter",()=>{this._cancelSubmenuHide()})),this._register($(this._submenuContainer,"mouseleave",()=>{this._scheduleSubmenuHide()})),this._register(ee(()=>{this._cancelSubmenuHide(),this._cancelSubmenuShow()})),this._options?.collapsedByDefault)for(let f of this._options.collapsedByDefault)this._collapsedSections.add(f);let p={getHeight:f=>this._getItemHeight(f),getTemplateId:f=>f.kind},g=(this._options?.reserveSubmenuSpace??!0)&&o.some(f=>!!f.submenuActions?.length&&!f.hover?.content);if(this._list=this._register(new Gc(e,this.domNode,p,[new UQe(t,f=>this._removeItem(f),f=>this._showSubmenuForItem(f),g,this._groupTitleByIndex,this._options?.linkHandler,this._options?.hideDefaultKeybindingTooltip??!1,this._keybindingService,this._openerService),new eui,new tui],{keyboardSupport:!1,typeNavigationEnabled:!this._options?.showFilter,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:r4o},accessibilityProvider:{getAriaLabel:f=>{if(f.kind==="action"){let v=f.label?$de(f?.label):"";if(f.detail&&(v=v+", "+$de(f.detail)),f.ariaDescription)v=v+", "+$de(f.ariaDescription);else if(f.description){let b=typeof f.description=="string"?f.description:f.description.value;v=v+", "+$de(b)}return f.group?.title&&(v=v+", "+f.group.title),f.disabled&&(v=d(1835,null,v,f.disabled)),f.submenuActions?.length&&(v=d(1833,null,v)),v}return null},getWidgetAriaLabel:()=>d(1834,null),getRole:f=>{switch(f.kind){case"action":return"option";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"listbox",...r}})),this._list.style(iJ),this._register(this._list.onMouseClick(f=>this.onListClick(f))),this._register(this._list.onMouseOver(f=>this.onListHover(f))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(f=>this.onListSelection(f))),this._allMenuItems=[...o],this._options?.showFilter||this._options?.secondaryHeading){this._filterContainer=document.createElement("div"),this._filterContainer.className="action-list-filter";let f=D(this._filterContainer,_(".action-list-filter-row"));if(this._options?.showFilter){this._filterInput=document.createElement("input"),this._filterInput.type="text",this._filterInput.className="action-list-filter-input",this._filterInput.placeholder=this._options?.filterPlaceholder??d(1831,null),this._filterInput.setAttribute("aria-label",d(1830,null)),f.appendChild(this._filterInput);let v=this._options?.filterActions??[];if(v.length>0){let b=D(f,_(".action-list-filter-actions"));this._register(new oo(b)).push(v,{icon:!0,label:!1})}this._register($(this._filterInput,"input",()=>{this._filterText=this._filterInput.value,this._applyOrUpdateFilter()}))}if(this._options?.secondaryHeading){let v=D(f,_(".action-list-filter-label"));v.textContent=this._options.secondaryHeading}}this._options?.footerText&&(this._footerContainer=document.createElement("div"),this._footerContainer.className="action-list-footer",this._footerContainer.textContent=this._options.footerText),this._applyFilter(),this._list.length&&this._focusCheckedOrFirst(),this._register($(this.domNode,"keydown",f=>{if(f.key==="ArrowRight"){let v=this._list.getFocus();if(v.length>0){let b=this._list.element(v[0]);if(b?.submenuActions?.length){Kt.stop(f,!0);let S=this._getRowElement(v[0]);S&&(this._showSubmenuForElement(b,S),this._currentSubmenuWidget?.focus())}}}})),this._filterInput&&this._register($(this.domNode,"keydown",f=>{this._filterInput&&!Na(this._filterInput)&&f.key.length===1&&f.key!==" "&&!f.ctrlKey&&!f.metaKey&&!f.altKey&&(this._filterInput.focus(),this._filterInput.value=f.key,this._filterText=f.key,this._applyOrUpdateFilter(),f.preventDefault(),f.stopPropagation())}))}_toggleSection(e){this._collapsedSections.has(e)?this._collapsedSections.delete(e):this._collapsedSections.add(e),this._options?.onDidToggleSection?.(e,this._collapsedSections.has(e)),this._applyFilter()}_applyOrUpdateFilter(){if(!this._delegate.onFilter){this._applyFilter();return}let e=this._filterText;this._filterCts.value?.cancel();let t=new qe;this._filterCts.value=t,this._delegate.onFilter(e,t.token).then(o=>{t.token.isCancellationRequested||(this._allMenuItems=[...o],this._applyFilter(!0))}).catch(()=>{})}_applyFilter(e=!1){let t=e?"":this._filterText.toLowerCase(),o=!e&&t.length>0,n=[],r=this._list.getFocus(),s;if(r.length>0&&(s=this._list.element(r[0])),o){let g,f=[],v=!1,b=()=>{g&&v&&n.push(g),n.push(...f),g=void 0,f=[],v=!1},S=y=>{let w=(y.label??"").toLowerCase(),x=typeof y.description=="string"?y.description:y.description?.value??"";return w.includes(t)||x.toLowerCase().includes(t)};for(let y of this._allMenuItems)if(y.kind!=="header"){if(y.kind==="separator"){b(),g=y.label?y:void 0;continue}if(y.showAlways){f.push(y);continue}y.isSectionToggle||S(y)&&(v=!0,f.push(y))}b()}else for(let g of this._allMenuItems){if(g.kind==="header"){n.push(g);continue}if(g.kind==="separator"){if(g.section&&this._collapsedSections.has(g.section))continue;n.push(g);continue}if(g.isSectionToggle&&g.section){let f=this._collapsedSections.has(g.section);n.push({...g,group:{...g.group,icon:f?L.chevronRight:L.chevronDown}});continue}g.section&&this._collapsedSections.has(g.section)||n.push(g)}let l=[],c=!1;for(let g=0;g<n.length;g++)l[g]=c,n[g].kind==="action"&&(c=!0);let u=[],p=!1;for(let g=n.length-1;g>=0;g--){if(n[g].kind==="action"){p=!0;continue}n[g].kind==="separator"&&(u[g]=p,p=!1)}for(let g=n.length-1;g>=0;g--){let f=n[g];if(f.kind!=="separator")continue;let v=u[g],b=!f.label&&!l[g];(!v||b)&&n.splice(g,1)}this._options?.showGroupTitleOnFirstItem&&this._recomputeGroupTitles(n);let h=this._filterInput&&Na(this._filterInput);if(this._list.splice(0,this._list.length,n),this._onDidRequestLayout.fire(),h)this._filterInput?.focus(),this._focusCheckedOrFirst();else if(this._hasLaidOut&&s){let g=s.item?.id;if(g){for(let f=0;f<this._list.length;f++)if(this._list.element(f).item?.id===g){this._list.setFocus([f]),this._list.reveal(f);break}}}}get filterContainer(){return this._filterContainer}get footerContainer(){return this._footerContainer}get filterInput(){return this._filterInput}focusCondition(e){return!e.disabled&&e.kind==="action"}focus(){if(this._filterInput&&this._options?.focusFilterOnOpen){this._filterInput.focus(),this._focusCheckedOrFirst();return}this._list.domFocus(),this._focusCheckedOrFirst()}clearFocus(){this._list.setFocus([])}getFocusedElement(){let e=this._list.getFocus();if(e.length>0)return this._list.element(e[0])}_focusCheckedOrFirst(){this._suppressHover=!0;try{for(let t=0;t<this._list.length;t++){let o=this._list.element(t);if(o.kind==="action"&&o.item?.checked){this._list.setFocus([t]),this._list.reveal(t);return}}this._list.focusFirst(void 0,this.focusCondition);let e=this._list.getFocus();e.length>0&&this._list.reveal(e[0])}finally{this._suppressHover=!1}}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._filterCts.value?.cancel(),this._filterCts.clear(),this._hideSubmenu()}clearFilter(){return this._filterInput&&this._filterText?(this._filterInput.value="",this._filterText="",this._applyOrUpdateFilter(),!0):!1}get hasDynamicHeight(){return this._options?.showFilter?!0:this._allMenuItems.some(e=>e.isSectionToggle)}get lineHeight(){return this._actionLineHeight}_getItemHeight(e){switch(e.kind){case"header":return this._headerLineHeight;case"separator":return e.label?this._actionLineHeight:this._separatorLineHeight;default:return e.detail?this._options?.detailItemHeight??48:this._actionLineHeight}}computeFullHeight(){let e=0;for(let t of this._allMenuItems)e+=this._getItemHeight(t);return e}computeListHeight(){let e=this._list.length,t=0;for(let o=0;o<e;o++){let n=this._list.element(o);t+=this._getItemHeight(n)}return t}layout(e,t){this._hasLaidOut=!0,this._list.layout(e,t),this.domNode.style.height=`${e}px`,this._filterContainer&&this._filterContainer.parentElement&&this._filterContainer.parentElement.insertBefore(this._filterContainer,this.domNode)}computeMaxWidth(e){let t=this._list.length,o=Math.max(e,this._options?.minWidth??0),n=this._options?.maxWidth??Number.POSITIVE_INFINITY,r=Math.max(n,o),s=p=>Math.min(Math.max(p,o),r),l=o,c=this._allMenuItems.length;if(c>=50)return s(380);if(c>t){let p=[];for(let v=0;v<t;v++)p.push(this._list.element(v));let h=[...this._allMenuItems];this._list.splice(0,t,h);let g=0;for(let v of h)g+=this._getItemHeight(v);this._list.layout(g);let f=[];for(let v=0;v<h.length;v++){let b=this._getRowElement(v);if(b){b.style.width="auto";let S=b.getBoundingClientRect().width;b.style.width="",f.push(S+this._computeToolbarWidth(h[v]))}}return l=s(Math.max(...f)),this._list.splice(0,h.length,p),l}let u=[];for(let p=0;p<t;p++){let h=this._getRowElement(p);if(h){h.style.width="auto";let g=h.getBoundingClientRect().width;h.style.width="",u.push(g+this._computeToolbarWidth(this._list.element(p)))}}return s(Math.max(...u))}focusPrevious(){if(this._filterInput&&Na(this._filterInput)){this._list.domFocus();let o=this._list.getFocus();if(o.length>0){this._list.focusPrevious(1,!1,void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&n[0]>=o[0]?this._filterInput.focus():n.length>0&&this._list.reveal(n[0])}else{this._list.focusLast(void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}return}let e=this._list.getFocus();this._list.focusPrevious(1,!0,void 0,this.focusCondition);let t=this._list.getFocus();if(t.length>0){if(this._filterInput&&e.length>0&&t[0]>e[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(t[0])}}focusNext(){if(this._filterInput&&Na(this._filterInput)){if(this._list.domFocus(),this._list.getFocus().length>0){this._list.focusNext(1,!1,void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}else{this._list.focusFirst(void 0,this.focusCondition);let n=this._list.getFocus();n.length>0&&this._list.reveal(n[0])}return}let e=this._list.getFocus();this._list.focusNext(1,!0,void 0,this.focusCondition);let t=this._list.getFocus();if(t.length>0){if(this._filterInput&&e.length>0&&t[0]<e[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(t[0])}}collapseFocusedSection(){let e=this._getFocusedSection();e&&!this._collapsedSections.has(e)&&this._toggleSection(e)}expandFocusedSection(){let e=this._getFocusedSection();e&&this._collapsedSections.has(e)&&this._toggleSection(e)}toggleFocusedSection(){let e=this._list.getFocus();if(e.length===0)return!1;let t=this._list.element(e[0]);return t.isSectionToggle&&t.section?(this._toggleSection(t.section),!0):!1}_getFocusedSection(){let e=this._list.getFocus();if(e.length===0)return;let t=this._list.element(e[0]);return t.isSectionToggle&&t.section,t.section}acceptSelected(e){let t=this._list.getFocus();if(t.length===0)return;let o=t[0],n=this._list.element(o);if(!this.focusCondition(n))return;let r=e?new oEt:new iui;this._list.setSelection([o],r)}onListSelection(e){if(!e.elements.length)return;let t=e.elements[0];if(t.isSectionToggle&&t.section){this._list.setSelection([]);let o=t.section;queueMicrotask(()=>{this._toggleSection(o)});return}if(Wp(e.browserEvent)){let o=e.browserEvent.target;if(go(o)&&(o.closest(".action-list-item-toolbar")||o.closest(".action-list-submenu-indicator"))){this._list.setSelection([]);return}}t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof oEt):this._list.setSelection([])}onFocus(){let e=this._list.getFocus();if(e.length===0)return;let t=e[0],o=this._list.element(t);this._delegate.onFocus?.(o.item),this._suppressHover||this._showHoverForElement(o,t)}_removeItem(e){let t=this._allMenuItems.indexOf(e);t>=0&&(this._allMenuItems.splice(t,1),this._applyFilter())}_recomputeGroupTitles(e){this._groupTitleByIndex.clear();let t=new Set;for(let o=0;o<e.length;o++){let n=e[o];n.kind==="action"&&n.group?.title&&!t.has(n.group.title)&&(t.add(n.group.title),this._groupTitleByIndex.set(o,n.group.title))}}_computeToolbarWidth(e){let t=e.toolbarActions?.length??0;return e.onRemove&&t++,t===0?0:t*22+6}_getRowElement(e){return this.domNode.ownerDocument.getElementById(this._list.getElementID(e))}_showHoverForElement(e,t){if(this._currentSubmenuElement===e)return;let o=!!e.hover?.content,n=!!e.submenuActions?.length;if(o||n){let r=this._getRowElement(t);r&&this._showSubmenuForElement(e,r);return}this._hideSubmenu()}_showSubmenuForItem(e){let t=this._list.indexOf(e);if(t>=0){let o=this._getRowElement(t);o&&this._showSubmenuForElement(e,o)}}_showSubmenuForElement(e,t){if(this._currentSubmenuElement===e)return;this._submenuDisposables.clear(),this._currentSubmenuElement=e,St(this._submenuContainer);let o,n=e.hover?.content;if(n){if(go(n))o=n,e.hover?.disposable&&this._submenuDisposables.add(e.hover.disposable);else{let N=typeof n=="string"?new he(n):n,V=this._options?.linkHandler,H=Lg(N,{actionHandler:K=>{let j=A.parse(K);V?V(j,e):this._openerService.open(j,{allowCommands:!0})}});this._submenuDisposables.add(H),o=H.element}o.classList.add("action-list-submenu-hover-header"),e.submenuActions?.length&&o.classList.add("has-submenu"),this._submenuContainer.appendChild(o)}let r=!!e.submenuActions?.length;this._submenuContainer.style.display="",this._submenuContainer.style.position="absolute",this._submenuContainer.removeAttribute("role");let s=t.getBoundingClientRect(),l=this.domNode.getBoundingClientRect(),c=Me(this.domNode),u=0,p=o?o.offsetWidth:0;if(r){let N=[],H=e.submenuActions.filter(se=>se instanceof sa).filter(se=>se.actions.length>0);for(let se=0;se<H.length;se++){let ae=H[se];ae.label&&N.push({kind:"header",group:{title:ae.label},label:ae.label});for(let ce=0;ce<ae.actions.length;ce++){let Se=ae.actions[ce],Re=Se,xe=Re.icon??q.fromId(Se.checked?L.check.id:L.blank.id),He=Re.hoverContent;N.push({item:Se,kind:"action",label:Se.label,description:Se.tooltip||void 0,group:{title:"",icon:xe},hideIcon:!1,hover:He?{content:He}:{},onRemove:Re.onRemove})}se<H.length-1&&N.push({kind:"separator",label:""})}for(let se of e.submenuActions)if(!(se instanceof sa)){let ae=se;N.push({item:se,kind:"action",label:se.label,description:se.tooltip||void 0,group:{title:""},hideIcon:!1,hover:{},onRemove:ae.onRemove})}let K={onHide:()=>{},onSelect:se=>{se.run();let ae=this._currentSubmenuElement?.item;this._hideSubmenu(),ae&&this._delegate.onSelect(ae),this.hide()}},j=this._submenuDisposables.add(this._instantiationService.createInstance(qde,"submenu",!1,N,K,void 0,void 0));this._submenuContainer.appendChild(j.domNode),this._currentSubmenuWidget=j,j.clearFocus(),u=j.computeListHeight(),j.layout(u);let J=j.computeMaxWidth(0);p=Math.max(p,J),j.layout(u,p),j.domNode.style.width=`${p}px`,this._submenuDisposables.add($(j.domNode,"keydown",se=>{if(se.key==="ArrowLeft"||se.key==="Escape")Kt.stop(se,!0),this._hideSubmenu(),this._list.domFocus();else if(se.key==="Enter"){Kt.stop(se,!0);let ae=j.getFocusedElement();if(ae?.item){ae.item.run();let ce=this._currentSubmenuElement?.item;this._hideSubmenu(),ce&&this._delegate.onSelect(ce),this.hide()}}else se.key==="ArrowDown"?(Kt.stop(se,!0),j.focusNext()):se.key==="ArrowUp"&&(Kt.stop(se,!0),j.focusPrevious())}))}let g=c.innerWidth-s.right,f=l.left,v=p+10,b=4;g>=v||g>=f?this._submenuContainer.style.left=`${l.right-l.left+b}px`:this._submenuContainer.style.left=`${-v-b}px`;let S=o?o.offsetHeight:0,y=u+S,w=c.innerHeight,x=s.height,E=s.top-l.top+(x-y)/2,M=l.top+E+y;M>w&&(E-=M-w+8),l.top+E<0&&(E=-l.top),this._submenuContainer.style.top=`${E}px`}_hideSubmenu(){this._cancelSubmenuHide(),this._cancelSubmenuShow(),this._submenuDisposables.clear(),this._currentSubmenuWidget=void 0,this._currentSubmenuElement=void 0,St(this._submenuContainer),this._submenuContainer.style.display="none"}_scheduleSubmenuHide(){this._cancelSubmenuHide(),this._submenuHideTimeout=setTimeout(()=>{this._hideSubmenu()},300)}_cancelSubmenuHide(){this._submenuHideTimeout!==void 0&&(clearTimeout(this._submenuHideTimeout),this._submenuHideTimeout=void 0)}_scheduleSubmenuShow(e,t){this._cancelSubmenuShow(),this._submenuShowTimeout=setTimeout(()=>{this._submenuShowTimeout=void 0;let o=typeof t=="number"?this._getRowElement(t):null;o&&this._showSubmenuForElement(e,o)},500)}_cancelSubmenuShow(){this._submenuShowTimeout!==void 0&&(clearTimeout(this._submenuShowTimeout),this._submenuShowTimeout=void 0)}async onListHover(e){let t=e.element;if(t&&t.item&&this.focusCondition(t)){if(go(e.browserEvent.target)&&e.browserEvent.target.closest(".action-list-item-toolbar")!==null){t.submenuActions?.length||this._cancelSubmenuShow(),this._list.setFocus([]);return}let n=!!(t.submenuActions?.length||t.hover?.content);if(n&&(this._suppressHover=!0),this._list.setFocus(typeof e.index=="number"?[e.index]:[]),n&&(this._suppressHover=!1),n){this._currentSubmenuElement===t?(this._cancelSubmenuHide(),this._cancelSubmenuShow()):(this._hideSubmenu(),this._scheduleSubmenuShow(t,e.index));return}if(this._currentSubmenuElement===t?this._cancelSubmenuHide():(this._cancelSubmenuShow(),this._hideSubmenu()),this._delegate.onHover&&!t.disabled&&t.kind==="action"&&this._currentSubmenuElement!==t){let r=await this._delegate.onHover(t.item,this.cts.token),s=r?r.canPreview:void 0;s!==t.canPreview&&(t.canPreview=s,typeof e.index=="number"&&(this._list.splice(e.index,1,[t]),this._list.setFocus([e.index])))}}else t&&t.hover?.content&&typeof e.index=="number"&&(this._currentSubmenuElement===t?(this._cancelSubmenuHide(),this._cancelSubmenuShow()):(this._hideSubmenu(),this._scheduleSubmenuShow(t,e.index)))}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};qde=I([m(6,Le),m(7,Je),m(8,F)],qde);var rEe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._contextViewService=c;this._layoutService=u;this._lastMinWidth=0;this._hasLaidOut=!1;this._anchor=l,this._widget=this._register(p.createInstance(qde,e,t,o,n,r,s)),this._register(this._widget.onDidRequestLayout(()=>{this._hasLaidOut&&(this.layout(this._lastMinWidth),this._contextViewService.layout())}))}get domNode(){return this._widget.domNode}get filterContainer(){return this._widget.filterContainer}get footerContainer(){return this._widget.footerContainer}get filterInput(){return this._widget.filterInput}get anchorPosition(){if(this._showAbove!==void 0)return this._showAbove?1:0}focus(){this._widget.focus()}hide(e){this._widget.hide(e),this._contextViewService.hideContextView()}clearFilter(){return this._widget.clearFilter()}focusPrevious(){this._widget.focusPrevious()}focusNext(){this._widget.focusNext()}collapseFocusedSection(){this._widget.collapseFocusedSection()}expandFocusedSection(){this._widget.expandFocusedSection()}toggleFocusedSection(){return this._widget.toggleFocusedSection()}acceptSelected(e){this._widget.acceptSelected(e)}hasDynamicHeight(){return this._widget.hasDynamicHeight}computeActionWidgetVerticalChromeHeight(){let e=this.domNode.parentElement?.closest(".action-widget");if(!e)return 0;let t=Me(e).getComputedStyle(e),o=n=>Number.parseFloat(n)||0;return o(t.paddingTop)+o(t.paddingBottom)+o(t.borderTopWidth)+o(t.borderBottomWidth)}computeHeight(){let e=this._widget.computeListHeight(),t=this._widget.filterContainer?36:0,o=this._widget.footerContainer?32:0,n=t+o,r=Me(this.domNode),s;if(this.hasDynamicHeight()){let h=r.innerHeight,g=lQe(this._anchor),f=g.top-r.pageYOffset,b=h-f-g.height-30,S=f;if(this._showAbove===void 0){let y=n+this._widget.computeFullHeight();this._showAbove=y>b&&S>b}s=Math.max(0,(this._showAbove?S:b)-this.computeActionWidgetVerticalChromeHeight())}else{let g=this._layoutService.getContainer(r).clientHeight,f=this.domNode.getBoundingClientRect().top;s=f>0?g-f-10:g*.7}let l=Math.floor(r.innerHeight*.6),c=this._widget.lineHeight,u=Math.min(Math.max(s,c*3+n),l);return Math.min(e+n,u)-n}layout(e){this._hasLaidOut=!0,this._lastMinWidth=e;let t=this.computeHeight();this._widget.layout(t);let o=this._widget.computeMaxWidth(e);return this._cachedMaxWidth=o,this._widget.layout(t,this._cachedMaxWidth),this._cachedMaxWidth}};rEe=I([m(7,qn),m(8,Kl),m(9,F)],rEe);function $de(a){return a.replace(/\r\n|\r|\n/g," ")}te("actionBar.toggledBackground",AB,d(1839,null));var VT={Visible:new Y("codeActionMenuVisible",!1,d(1842,null)),FilterFocused:new Y("codeActionMenuFilterFocused",!1,d(1841,null))},kd=le("actionWidgetService"),OA=class extends k{constructor(e,t,o){super();this._contextViewService=e;this._contextKeyService=t;this._instantiationService=o;this._list=this._register(new ue)}get isVisible(){return VT.Visible.getValue(this._contextKeyService)||!1}show(e,t,o,n,r,s,l,c,u){let p=VT.Visible.bindTo(this._contextKeyService),h=this._instantiationService.createInstance(rEe,e,t,o,n,c,u,r);this._contextViewService.showContextView({getAnchor:()=>r,render:g=>(p.set(!0),this._renderWidget(g,h,l??[])),onHide:g=>{p.reset(),this._onWidgetClosed(g)},get anchorPosition(){return h.anchorPosition}},s,!1)}acceptSelected(e){this._list.value?.acceptSelected(e)}focusPrevious(){this._list?.value?.focusPrevious()}focusNext(){this._list?.value?.focusNext()}collapseSection(){this._list?.value?.collapseFocusedSection()}expandSection(){this._list?.value?.expandFocusedSection()}toggleSection(){return this._list?.value?.toggleFocusedSection()??!1}clearFilter(){return this._list?.value?.clearFilter()??!1}hide(e){this._list.value?.hide(e),this._list.clear()}clear(){this._list.clear()}_renderWidget(e,t,o){let n=document.createElement("div");if(n.classList.add("action-widget"),e.appendChild(n),this._list.value=t,this._list.value)this._list.value.filterContainer&&n.appendChild(this._list.value.filterContainer),n.appendChild(this._list.value.domNode),this._list.value.footerContainer&&n.appendChild(this._list.value.footerContainer);else throw new Error("List has no value");let r=new O,s=document.createElement("div"),l=e.appendChild(s);l.classList.add("context-view-block"),r.add(ML(l,v=>v.stopPropagation()));let c=document.createElement("div"),u=e.appendChild(c);u.classList.add("context-view-pointerBlock"),r.add($(u,ne.POINTER_MOVE,()=>u.remove())),r.add(ML(u,()=>u.remove()));let p=0;if(o.length){let v=this._createActionBar(".action-widget-action-bar",o);v&&(n.appendChild(v.getContainer().parentElement),r.add(v),p=v.getContainer().offsetWidth)}let h=this._list.value?.layout(p);n.style.width=`${h}px`,this._list.value?.focus();let g=VT.FilterFocused.bindTo(this._contextKeyService);if(r.add({dispose:()=>g.reset()}),this._list.value?.filterInput){let v=this._list.value.filterInput;r.add($(v,"focus",()=>g.set(!0))),r.add($(v,"blur",()=>g.set(!1)))}let f=r.add(nr(e));return r.add(f.onDidBlur(()=>{let v=Un();v?.closest(".action-widget-hover")||v?.closest(".action-list-submenu-panel")||this.hide(!0)})),r}_createActionBar(e,t){if(!t.length)return;let o=_(e),n=new oo(o);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){this._list.value?.hide(e)}};OA=I([m(0,qn),m(1,X),m(2,F)],OA);Ce(kd,OA,1);var g4=1100;W(class extends z{constructor(){super({id:"hideCodeActionWidget",title:P(1845,"Hide action widget"),precondition:VT.Visible,keybinding:{weight:g4,primary:9,secondary:[1033]}})}run(a){a.get(kd).hide(!0)}});W(class extends z{constructor(){super({id:"clearFilterCodeActionWidget",title:P(1840,"Clear action widget filter"),precondition:C.and(VT.Visible,VT.FilterFocused),keybinding:{weight:g4+1,primary:9}})}run(a){let i=a.get(kd);i instanceof OA&&(i.clearFilter()||i.hide(!0))}});W(class extends z{constructor(){super({id:"selectPrevCodeAction",title:P(1848,"Select previous action"),precondition:VT.Visible,keybinding:{weight:g4,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(a){let i=a.get(kd);i instanceof OA&&i.focusPrevious()}});W(class extends z{constructor(){super({id:"selectNextCodeAction",title:P(1847,"Select next action"),precondition:VT.Visible,keybinding:{weight:g4,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(a){let i=a.get(kd);i instanceof OA&&i.focusNext()}});W(class extends z{constructor(){super({id:"collapseSectionCodeAction",title:P(1843,"Collapse section"),precondition:C.and(VT.Visible,VT.FilterFocused.negate()),keybinding:{weight:g4,primary:15}})}run(a){let i=a.get(kd);i instanceof OA&&i.collapseSection()}});W(class extends z{constructor(){super({id:"expandSectionCodeAction",title:P(1844,"Expand section"),precondition:C.and(VT.Visible,VT.FilterFocused.negate()),keybinding:{weight:g4,primary:17}})}run(a){let i=a.get(kd);i instanceof OA&&i.expandSection()}});W(class extends z{constructor(){super({id:"toggleSectionCodeAction",title:P(1849,"Toggle section"),precondition:C.and(VT.Visible,VT.FilterFocused.negate()),keybinding:{weight:g4,primary:10}})}run(a){let i=a.get(kd);i instanceof OA&&(i.toggleSection()||i.acceptSelected())}});W(class extends z{constructor(){super({id:oui,title:P(1838,"Accept selected action"),precondition:VT.Visible,keybinding:{weight:g4,primary:3,secondary:[2137]}})}run(a){let i=a.get(kd);i instanceof OA&&i.acceptSelected()}});W(class extends z{constructor(){super({id:nui,title:P(1846,"Preview selected action"),precondition:VT.Visible,keybinding:{weight:g4,primary:2051}})}run(a){let i=a.get(kd);i instanceof OA&&i.acceptSelected(!0)}});var jde=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.typeId=e;this.editor=t;this.showCommand=n;this.range=r;this.edits=s;this.onSelectNewEdit=l;this.additionalActions=c;this._keybindingService=p;this._actionWidgetService=h;this.allowEditorOverflow=!0;this.suppressMouseDown=!0;this.create(),this.visibleContext=o.bindTo(u),this.visibleContext.set(!0),this._register(ee(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(ee((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(g=>{this.dispose()})),this._register(U.runAndSubscribe(p.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}static{this.baseId="editor.widget.postEditWidget"}_updateButtonTitle(){this.button.element.title=this._keybindingService.appendKeybinding(this.showCommand.label,this.showCommand.id)}create(){this.domNode=_(".post-edit-widget"),this.button=this._register(new Pi(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register($(this.domNode,ne.CLICK,()=>this.showSelector()))}getId(){return jde.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){let e=ur(this.button.element),t={x:e.left+e.width,y:e.top+e.height};this._actionWidgetService.show("postEditWidget",!1,this.edits.allEdits.map((o,n)=>({kind:"action",item:o,label:o.title,disabled:!1,canPreview:!1,group:{title:"",icon:q.fromId(n===this.edits.activeEditIndex?L.check.id:L.blank.id)}})),{onHide:()=>{this.editor.focus()},onSelect:o=>{this._actionWidgetService.hide(!1);let n=this.edits.allEdits.findIndex(r=>r===o);if(n!==this.edits.activeEditIndex)return this.onSelectNewEdit(n)}},t,this.editor.getDomNode()??void 0,this.additionalActions)}};jde=I([m(8,X),m(9,Le),m(10,kd)],jde);var cJ=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._id=e;this._editor=t;this._visibleContext=o;this._showCommand=n;this._getAdditionalActions=r;this._instantiationService=s;this._bulkEditService=l;this._notificationService=c;this._currentWidget=this._register(new ue);this._register(U.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,o,n,r){if(!e.length||!this._editor.hasModel())return;let s=this._editor.getModel(),l=t.allEdits.at(t.activeEditIndex);if(!l)return;let c=async y=>{let w=this._editor.getModel();w&&(await w.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:y,allEdits:t.allEdits},o,n,r))},u=(y,w)=>{Yi(y)||(this._notificationService.error(w),o&&this.show(e[0],t,c))},p=new $k(this._editor,3,void 0,r),h;try{h=await Ym(n(l,p.token),p.token)}catch(y){return u(y,d(1109,null,l.title,Mn(y)))}finally{p.dispose()}if(r.isCancellationRequested)return;let g=eEt(s.uri,e,h),f=e[0],v=s.deltaDecorations([],[{range:f,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let b,S;try{b=await this._bulkEditService.apply(g,{editor:this._editor,token:r}),S=s.getDecorationRange(v[0])}catch(y){return u(y,d(1108,null,l.title,Mn(y)))}finally{s.deltaDecorations(v,[])}r.isCancellationRequested||o&&b.isApplied&&t.allEdits.length>1&&this.show(S??f,t,c)}show(e,t,o){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(jde,this._id,this._editor,this._visibleContext,this._showCommand,e,t,o,this._getAdditionalActions()))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};cJ=I([m(5,F),m(6,Ka),m(7,Ne)],cJ);var sui="editor.changePasteType",KQe="editor.pasteAs.preferences",nEt=new Y("pasteWidgetVisible",!1,d(1094,null)),rui="application/vnd.code.copymetadata",Ju=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._logService=o;this._bulkEditService=n;this._clipboardService=r;this._commandService=s;this._configService=l;this._languageFeaturesService=c;this._quickInputService=u;this._progressService=p;this._editor=e,this._register(e.onWillCopy(h=>this.handleCopy(h))),this._register(e.onWillCut(h=>this.handleCopy(h))),this._register(e.onWillPaste(h=>this.handlePaste(h))),this._pasteProgressManager=this._register(new aJ("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(cJ,"pasteIntoEditor",e,nEt,{id:sui,label:d(1095,null)},()=>Ju._configureDefaultAction?[Ju._configureDefaultAction]:[]))}static{this.ID="editor.contrib.copyPasteActionController"}static get(e){return e.getContribution(Ju.ID)}static setConfigureDefaultAction(e){Ju._configureDefaultAction=e}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}async pasteAs(e){this._logService.trace("CopyPasteController.pasteAs"),this._editor.focus();try{this._logService.trace("Before calling editor.action.clipboardPasteAction"),this._pasteAsActionContext={preferred:e},await this._commandService.executeCommand("editor.action.clipboardPasteAction")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(97).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){if(this._logService.trace("CopyPasteController#handleCopy"),!this._editor.hasTextFocus()||(this._clipboardService.clearInternalState?.(),!this.isPasteAsEnabled()))return;let t=this._editor.getModel(),o=this._editor._getViewModel(),n=this._editor.getSelections();if(!t||!o||!n?.length)return;let r={multicursorText:e.dataToCopy.multicursorText??null,pasteOnNewLine:e.dataToCopy.isFromEmptySelection,mode:null},s=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(h=>!!h.prepareDocumentPaste);if(!s.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:r});return}let l=new Wk,c=s.flatMap(h=>h.copyMimeTypes??[]),u=ht();this.setCopyMetadata(e.clipboardData,{id:u,providerCopyMimeTypes:c,defaultPastePayload:r});let p=s.map(h=>({providerMimeTypes:h.copyMimeTypes,operation:Hn(g=>h.prepareDocumentPaste(t,e.dataToCopy.sourceRanges,l,g).catch(f=>{console.error(f)}))}));Ju._currentCopyOperation?.operations.forEach(h=>h.operation.cancel()),Ju._currentCopyOperation={handle:u,operations:p}}async handlePaste(e){if(this._logService.trace("CopyPasteController#handlePaste for id : ",e.metadata?.id),!this._editor.hasTextFocus())return;let t=e.toExternalVSDataTransfer();if(!t)return;t.delete(rui),Xu.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;let o=this._editor.getModel(),n=this._editor.getSelections();if(!n?.length||!o||this._editor.getOption(104)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;let r=this.fetchCopyMetadata(e);this._logService.trace("CopyPasteController#handlePaste with metadata : ",r?.id," and text.length : ",e.clipboardData.getData("text/plain").length);let s=Array.from(e.clipboardData.files).map(u=>u.type),l=[...e.clipboardData.types,...s,...r?.providerCopyMimeTypes??[],cr.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(o).filter(u=>{let p=this._pasteAsActionContext?.preferred;return p&&!this.providerMatchesPreference(u,p)?!1:u.pasteMimeTypes?.some(h=>K3e(h,l))});if(!c.length){this._pasteAsActionContext?.preferred&&(this.showPasteAsNoEditMessage(n,this._pasteAsActionContext.preferred),e.setHandled());return}e.setHandled(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,c,n,t,r):this.doPasteInline(c,n,t,r,e.browserEvent)}showPasteAsNoEditMessage(e,t){let o="only"in t?t.only.value:"preferences"in t?t.preferences.length?t.preferences.map(n=>n.value).join(", "):d(1088,null):t.providerId;Xu.get(this._editor)?.showMessage(d(1090,null,o),e[0].getStartPosition())}doPasteInline(e,t,o,n,r){this._logService.trace("CopyPasteController#doPasteInline");let s=this._editor;if(!s.hasModel())return;let l=new $k(s,3,void 0),c=Hn(async u=>{let p=this._editor;if(!p.hasModel())return;let h=p.getModel(),g=new O,f=g.add(new qe(u));g.add(l.token.onCancellationRequested(()=>f.cancel()));let v=f.token;try{if(await this.mergeInDataFromCopy(e,o,n,v),v.isCancellationRequested)return;let b=e.filter(w=>this.isSupportedPasteProvider(w,o));if(!b.length||b.length===1&&b[0]instanceof h4)return this.applyDefaultPasteHandler(o,n,v,r);let S={triggerKind:0},y=await this.getPasteEdits(b,o,h,t,S,v);if(g.add(y),v.isCancellationRequested)return;if(y.edits.length===1&&y.edits[0].provider instanceof h4)return this.applyDefaultPasteHandler(o,n,v,r);if(y.edits.length){let w=p.getOption(97).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:this.getInitialActiveEditIndex(h,y.edits),allEdits:y.edits},w,async(x,E)=>{if(!x.provider.resolveDocumentPasteEdit)return x;let M=x.provider.resolveDocumentPasteEdit(x,E),N=new Mo,V=await this._pasteProgressManager.showWhile(t[0].getEndPosition(),d(1096,null,x.title),Ea(Promise.race([N.p,M]),E),{cancel:()=>N.cancel()},0);return V&&(x.insertText=V.insertText,x.additionalEdit=V.additionalEdit),x},v)}await this.applyDefaultPasteHandler(o,n,v,r)}finally{g.dispose(),this._currentPasteOperation===c&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),d(1093,null),c,{cancel:async()=>{c.cancel(),!l.token.isCancellationRequested&&await this.applyDefaultPasteHandler(o,n,l.token,r)}}).finally(()=>{l.dispose()}),this._currentPasteOperation=c}showPasteAsPick(e,t,o,n,r){this._logService.trace("CopyPasteController#showPasteAsPick");let s=Hn(async l=>{let c=this._editor;if(!c.hasModel())return;let u=c.getModel(),p=new O,h=p.add(new $k(c,3,void 0,l));try{if(await this.mergeInDataFromCopy(t,n,r,h.token),h.token.isCancellationRequested)return;let g=t.filter(y=>this.isSupportedPasteProvider(y,n,e));e&&(g=g.filter(y=>this.providerMatchesPreference(y,e)));let f={triggerKind:1,only:e&&"only"in e?e.only:void 0},v=p.add(await this.getPasteEdits(g,n,u,o,f,h.token));if(h.token.isCancellationRequested)return;if(e&&(v={edits:v.edits.filter(y=>"only"in e?e.only.contains(y.kind):"preferences"in e?e.preferences.some(w=>w.contains(y.kind)):e.providerId===y.provider.id),dispose:v.dispose}),!v.edits.length){e&&this.showPasteAsNoEditMessage(o,e);return}let b;if(e)b=v.edits.at(0);else{let y={id:"editor.pasteAs.default",label:d(1089,null),edit:void 0},w=await this._quickInputService.pick([...v.edits.map(x=>({label:x.title,description:x.kind?.value,edit:x})),...Ju._configureDefaultAction?[{type:"separator"},{label:Ju._configureDefaultAction.label,edit:void 0}]:[]],{placeHolder:d(1091,null)});if(w===y){Ju._configureDefaultAction?.run();return}b=w?.edit}if(!b)return;let S=eEt(u.uri,o,b);await this._bulkEditService.apply(S,{editor:this._editor})}finally{p.dispose(),this._currentPasteOperation===s&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:d(1092,null)},()=>s)}setCopyMetadata(e,t){this._logService.trace("CopyPasteController#setCopyMetadata new id : ",t.id),e.setData(rui,JSON.stringify(t))}fetchCopyMetadata(e){this._logService.trace("CopyPasteController#fetchCopyMetadata");let t=e.clipboardData.getData(rui);if(t)try{return JSON.parse(t)}catch{return}if(e.metadata)return{defaultPastePayload:{mode:e.metadata.mode,multicursorText:e.metadata.multicursorText??null,pasteOnNewLine:!!e.metadata.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,o,n){if(this._logService.trace("CopyPasteController#mergeInDataFromCopy with metadata : ",o?.id),o?.id&&Ju._currentCopyOperation?.handle===o.id){let r=Ju._currentCopyOperation.operations.filter(l=>e.some(c=>c.pasteMimeTypes.some(u=>K3e(u,l.providerMimeTypes)))).map(l=>l.operation),s=await Promise.all(r);if(n.isCancellationRequested)return;for(let l of s.reverse())if(l)for(let[c,u]of l)t.replace(c,u)}if(!t.has(cr.uriList)){let r=await this._clipboardService.readResources();if(n.isCancellationRequested)return;r.length&&t.append(cr.uriList,MF($w.create(r)))}}async getPasteEdits(e,t,o,n,r,s){let l=new O,c=await Ea(Promise.all(e.map(async p=>{try{let h=await p.provideDocumentPasteEdits?.(o,n,t,r,s);return h&&l.add(h),h?.edits?.map(g=>({...g,provider:p}))}catch(h){Yi(h)||console.error(h);return}})),s),u=ui(c??[]).flat().filter(p=>!r.only||r.only.contains(p.kind));return{edits:tEt(u),dispose:()=>l.dispose()}}async applyDefaultPasteHandler(e,t,o,n){let s=await(e.get(cr.text)??e.get("text"))?.asString()??"";if(o.isCancellationRequested)return;let l={clipboardEvent:n,text:s,pasteOnNewLine:t?.defaultPastePayload.pasteOnNewLine??!1,multicursorText:t?.defaultPastePayload.multicursorText??null,mode:null};this._logService.trace("CopyPasteController#applyDefaultPasteHandler for id : ",t?.id),this._editor.trigger("keyboard","paste",l)}isSupportedPasteProvider(e,t,o){return e.pasteMimeTypes?.some(n=>t.matches(n))?!o||this.providerMatchesPreference(e,o):!1}providerMatchesPreference(e,t){return"only"in t?e.providedPasteEditKinds.some(o=>t.only.contains(o)):"preferences"in t?e.providedPasteEditKinds.some(o=>t.preferences.some(n=>n.contains(o))):e.id===t.providerId}getInitialActiveEditIndex(e,t){let o=this._configService.getValue(KQe,{resource:e.uri});for(let n of Array.isArray(o)?o:[]){let r=new Rs(n),s=t.findIndex(l=>r.contains(l.kind));if(s>=0)return s}return 0}};Ju=I([m(1,F),m(2,re),m(3,Ka),m(4,Bi),m(5,fe),m(6,B),m(7,Jt),m(8,$e),m(9,Go)],Ju);var Qde="9_cutcopypaste",a4o=Qr||document.queryCommandSupported("cut"),Leo=Qr||document.queryCommandSupported("copy"),l4o=typeof navigator.clipboard>"u"||ed?document.queryCommandSupported("paste"):!0;function cui(a){return a.register(),a}var QB=a4o?cui(new hF({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:Qr?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:R.MenubarEditMenu,group:"2_ccp",title:d(995,null),order:1},{menuId:R.EditorContext,group:Qde,title:d(991,null),when:me.writable,order:1},{menuId:R.CommandPalette,group:"",title:d(991,null),order:1},{menuId:R.SimpleEditorContext,group:Qde,title:d(991,null),when:me.writable,order:1}]})):void 0,WA=Leo?cui(new hF({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:Qr?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:R.MenubarEditMenu,group:"2_ccp",title:d(994,null),order:2},{menuId:R.EditorContext,group:Qde,title:d(989,null),order:2},{menuId:R.CommandPalette,group:"",title:d(989,null),order:1},{menuId:R.SimpleEditorContext,group:Qde,title:d(989,null),order:2}]})):void 0;be.appendMenuItem(R.MenubarEditMenu,{submenu:R.MenubarCopy,title:P(993,"Copy As"),group:"2_ccp",order:3});be.appendMenuItem(R.EditorContext,{submenu:R.EditorContextCopy,title:P(993,"Copy As"),group:Qde,order:3});be.appendMenuItem(R.EditorContext,{submenu:R.EditorContextShare,title:P(997,"Share"),group:"11_share",order:-1,when:C.and(C.notEquals("resourceScheme","output"),me.editorTextFocus)});be.appendMenuItem(R.ExplorerContext,{submenu:R.ExplorerContextShare,title:P(997,"Share"),group:"11_share",order:-1});var FA=l4o?cui(new hF({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:Qr?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:R.MenubarEditMenu,group:"2_ccp",title:d(996,null),order:4},{menuId:R.EditorContext,group:Qde,title:d(992,null),when:me.writable,order:4},{menuId:R.CommandPalette,group:"",title:d(992,null),order:1},{menuId:R.SimpleEditorContext,group:Qde,title:d(992,null),when:me.writable,order:4}]})):void 0,aui=class extends Mi{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:P(990,"Copy with Syntax Highlighting"),precondition:void 0,kbOpts:{kbExpr:me.textInputFocus,primary:0,weight:100}})}run(i,e){let t=i.get(re),o=i.get(Bi);t.trace("ExecCommandCopyWithSyntaxHighlightingAction#run"),!(!e.hasModel()||!e.getOption(45)&&e.getSelection().isEmpty())&&(cK.forceCopyWithSyntaxHighlighting=!0,e.focus(),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)"),lui(e,o),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)"),cK.forceCopyWithSyntaxHighlighting=!1)}};function lui(a,i){if(cK.electronBugWorkaroundCopyEventHasFired=!1,a.getContainerDomNode().ownerDocument.execCommand("copy"),Qr&&cK.electronBugWorkaroundCopyEventHasFired===!1){let{dataToCopy:e}=TYi(a._getViewModel(),void 0,ed);i.writeText(e.text)}}function Meo(a,i){a&&(a.addImplementation(1e4,"code-editor",(e,t)=>{let o=e.get(re),n=e.get(Bi);o.trace("registerExecCommandImpl (addImplementation code-editor for : ",i,")");let r=e.get(Qt).getFocusedCodeEditor();if(r&&r.hasTextFocus()&&r.hasModel()){let s=r.getOption(45),l=r.getSelection();return l&&l.isEmpty()&&!s||(r.getOption(170)&&i==="cut"?(Reo(r),o.trace("registerExecCommandImpl (before execCommand copy)"),lui(r,n),r.trigger(void 0,"cut",void 0),o.trace("registerExecCommandImpl (after execCommand copy)")):(Reo(r),o.trace("registerExecCommandImpl (before execCommand "+i+")"),i==="copy"?lui(r,n):r.getContainerDomNode().ownerDocument.execCommand(i),o.trace("registerExecCommandImpl (after execCommand "+i+")"))),!0}return!1}),a.addImplementation(0,"generic-dom",(e,t)=>{let o=e.get(re);return o.trace("registerExecCommandImpl (addImplementation generic-dom for : ",i,")"),o.trace("registerExecCommandImpl (before execCommand "+i+")"),_m().execCommand(i),o.trace("registerExecCommandImpl (after execCommand "+i+")"),!0}))}function Reo(a){if(a.getOption(170)){let e=cde.get(a.getId());e&&e.handleWillCopy()}}Meo(QB,"cut");Meo(WA,"copy");FA&&(FA.addImplementation(1e4,"code-editor",(a,i)=>{let e=a.get(re);e.trace("registerExecCommandImpl (addImplementation code-editor for : paste)");let t=a.get(Qt),o=a.get(Bi),n=t.getFocusedCodeEditor();if(n&&n.hasModel()&&n.hasTextFocus()){if(n.getOption(170)){let l=cde.get(n.getId());l&&l.handleWillPaste()}e.trace("registerExecCommandImpl (before triggerPaste)");let s=o.triggerPaste(zi().vscodeWindowId);return s?(e.trace("registerExecCommandImpl (triggerPaste defined)"),s.then(async()=>(e.trace("registerExecCommandImpl (after triggerPaste)"),Ju.get(n)?.finishedPaste()??Promise.resolve()))):(e.trace("registerExecCommandImpl (triggerPaste undefined)"),Ft?(e.trace("registerExecCommandImpl (Paste handling on web)"),(async()=>{let l=await o.readText();if(l!==""){let c=vX.INSTANCE.get(l),u=!1,p=null,h=null;c&&(u=n.getOption(45)&&!!c.isFromEmptySelection,p=typeof c.multicursorText<"u"?c.multicursorText:null,h=c.mode),e.trace("registerExecCommandImpl (clipboardText.length : ",l.length," id : ",c?.id,")"),n.trigger("keyboard","paste",{text:l,pasteOnNewLine:u,multicursorText:p,mode:h})}})()):!0)}return!1}),FA.addImplementation(0,"generic-dom",(a,i)=>(a.get(re).trace("registerExecCommandImpl (addImplementation generic-dom for : paste)"),a.get(Bi).triggerPaste(zi().vscodeWindowId)??!1)));Leo&&ri(aui);var wx=Object.freeze({id:"editor",order:5,type:"object",title:d(281,null),scope:6}),sEe={...wx,properties:{"editor.tabSize":{type:"number",default:Uv.tabSize,minimum:1,maximum:100,markdownDescription:d(309,null,"`#editor.detectIndentation#`")},"editor.indentSize":{anyOf:[{type:"string",enum:["tabSize"]},{type:"number",minimum:1}],default:"tabSize",markdownDescription:d(287,null)},"editor.insertSpaces":{type:"boolean",default:Uv.insertSpaces,markdownDescription:d(288,null,"`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:Uv.detectIndentation,markdownDescription:d(270,null,"`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:Uv.trimAutoWhitespace,description:d(310,null)},"editor.largeFileOptimizations":{type:"boolean",default:Uv.largeFileOptimizations,description:d(289,null)},"editor.wordBasedSuggestions":{enum:["off","offWithInlineSuggestions","currentDocument","matchingDocuments","allDocuments"],default:"offWithInlineSuggestions",enumDescriptions:[d(317,null),d(318,null),d(315,null),d(316,null),d(314,null)],description:d(313,null),experiment:{mode:"auto"}},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[d(304,null),d(303,null),d(301,null)],default:"configuredByTheme",description:d(302,null)},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:d(308,null)},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:d(292,null)},"editor.experimental.asyncTokenization":{type:"boolean",default:!0,description:d(273,null),tags:["experimental"]},"editor.experimental.asyncTokenizationLogging":{type:"boolean",default:!1,description:d(274,null)},"editor.experimental.asyncTokenizationVerification":{type:"boolean",default:!1,description:d(275,null),tags:["experimental"]},"editor.experimental.treeSitterTelemetry":{type:"boolean",default:!1,markdownDescription:d(280,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.css":{type:"boolean",default:!1,markdownDescription:d(276,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.typescript":{type:"boolean",default:!1,markdownDescription:d(279,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.ini":{type:"boolean",default:!1,markdownDescription:d(277,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.regex":{type:"boolean",default:!1,markdownDescription:d(278,null),tags:["experimental"],experiment:{mode:"auto"}},"editor.language.brackets":{type:["array","null"],default:null,description:d(297,null),items:{type:"array",items:[{type:"string",description:d(300,null)},{type:"string",description:d(298,null)}]}},"editor.language.colorizedBracketPairs":{type:["array","null"],default:null,description:d(299,null),items:{type:"array",items:[{type:"string",description:d(300,null)},{type:"string",description:d(298,null)}]}},"diffEditor.maxComputationTime":{type:"number",default:FS.maxComputationTime,description:d(290,null)},"diffEditor.maxFileSize":{type:"number",default:FS.maxFileSize,description:d(291,null)},"diffEditor.renderSideBySide":{type:"boolean",default:FS.renderSideBySide,description:d(307,null),agentsWindow:{default:!0}},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:FS.renderSideBySideInlineBreakpoint,description:d(296,null)},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:FS.useInlineViewWhenSpaceIsLimited,description:d(311,null),agentsWindow:{default:!0}},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:FS.renderMarginRevertIcon,description:d(295,null),agentsWindow:{default:!1}},"diffEditor.renderGutterMenu":{type:"boolean",default:FS.renderGutterMenu,description:d(293,null),agentsWindow:{default:!1}},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:FS.ignoreTrimWhitespace,description:d(286,null)},"diffEditor.renderIndicators":{type:"boolean",default:FS.renderIndicators,description:d(294,null),agentsWindow:{default:!1}},"diffEditor.codeLens":{type:"boolean",default:FS.diffCodeLens,description:d(269,null)},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:FS.diffWordWrap,markdownEnumDescriptions:[d(320,null),d(321,null),d(319,null,"`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:FS.diffAlgorithm,markdownEnumDescriptions:[d(272,null),d(271,null)]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:FS.hideUnchangedRegions.enabled,markdownDescription:d(283,null),agentsWindow:{default:!0}},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:FS.hideUnchangedRegions.revealLineCount,markdownDescription:d(285,null),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:FS.hideUnchangedRegions.minimumLineCount,markdownDescription:d(284,null),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:FS.hideUnchangedRegions.contextLineCount,markdownDescription:d(282,null),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:FS.experimental.showMoves,markdownDescription:d(306,null)},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:FS.experimental.showEmptyDecorations,description:d(305,null)},"diffEditor.experimental.useTrueInlineView":{type:"boolean",default:FS.experimental.useTrueInlineView,description:d(312,null)}}};function c4o(a){return typeof a.type<"u"||typeof a.anyOf<"u"}for(let a of Az){let i=a.schema;if(typeof i<"u")if(c4o(i))sEe.properties[`editor.${a.name}`]=i;else for(let e in i)Object.hasOwnProperty.call(i,e)&&(sEe.properties[e]=i[e])}var d4o=oe.as($t.Configuration);d4o.registerConfiguration(sEe);async function Peo(a){let i=["editor.fontFamily"],e=await a();for(let t of i)sEe.properties&&sEe.properties[t]&&(sEe.properties[t].defaultSnippets=e)}var Nr=new class{constructor(){this.QuickFix=new Rs("quickfix");this.Refactor=new Rs("refactor");this.RefactorExtract=this.Refactor.append("extract");this.RefactorInline=this.Refactor.append("inline");this.RefactorMove=this.Refactor.append("move");this.RefactorRewrite=this.Refactor.append("rewrite");this.Notebook=new Rs("notebook");this.Source=new Rs("source");this.SourceOrganizeImports=this.Source.append("organizeImports");this.SourceFixAll=this.Source.append("fixAll");this.SurroundWith=this.Refactor.append("surround")}};function Aeo(a,i){return!(a.include&&!a.include.intersects(i)||a.excludes&&a.excludes.some(e=>Oeo(i,e,a.include))||!a.includeSourceActions&&Nr.Source.contains(i))}function Neo(a,i){let e=i.kind?new Rs(i.kind):void 0;return!(a.include&&(!e||!a.include.contains(e))||a.excludes&&e&&a.excludes.some(t=>Oeo(e,t,a.include))||!a.includeSourceActions&&e&&Nr.Source.contains(e)||a.onlyIncludePreferredActions&&!i.isPreferred)}function Oeo(a,i,e){return!(!i.contains(a)||e&&i.contains(e))}var dJ=class a{constructor(i,e,t){this.kind=i;this.apply=e;this.preferred=t}static fromUser(i,e){return!i||typeof i!="object"?new a(e.kind,e.apply,!1):new a(a.getKindFromUser(i,e.kind),a.getApplyFromUser(i,e.apply),a.getPreferredUser(i))}static getApplyFromUser(i,e){switch(typeof i.apply=="string"?i.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return e}}static getKindFromUser(i,e){return typeof i.kind=="string"?new Rs(i.kind):e}static getPreferredUser(i){return typeof i.preferred=="boolean"?i.preferred:!1}},rEt=class{constructor(i,e,t){this.action=i;this.provider=e;this.highlightRange=t}async resolve(i){if(this.provider?.resolveCodeAction&&!this.action.edit){let e;try{e=await this.provider.resolveCodeAction(this.action,i)}catch(t){vs(t)}e&&(this.action.edit=e.edit)}return this}};var aEe="editor.action.codeAction",UK="editor.action.quickFix",lEe="editor.action.autoFix",cEe="editor.action.refactor";var dEe="editor.action.sourceAction",GQe="editor.action.organizeImports",qQe="editor.action.fixAll",u4o=1e3,dui=class a extends k{constructor(e,t,o){super();this.documentation=t;this._register(o),this.allActions=[...e].sort(a.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:Rr(e.diagnostics)?Rr(t.diagnostics)?a.codeActionsPreferredComparator(e,t):-1:Rr(t.diagnostics)?1:a.codeActionsPreferredComparator(e,t)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Nr.QuickFix.contains(new Rs(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}},Feo={actions:[],documentation:void 0};async function cM(a,i,e,t,o,n){let r=t.filter||{},s={...r,excludes:[...r.excludes||[],Nr.Notebook]},l={only:r.include?.value,trigger:t.type},c=new zde(i,n),u=t.type===2,p=p4o(a,i,u?s:r),h=new O,g=p.map(async v=>{let b=setTimeout(()=>o.report(v),1250);try{let S=await v.provideCodeActions(i,e,l,c.token);if(c.token.isCancellationRequested)return S?.dispose(),Feo;S&&h.add(S);let y=(S?.actions||[]).filter(x=>x&&Neo(r,x)),w=h4o(v,y,r.include);return{actions:y.map(x=>new rEt(x,v)),documentation:w}}catch(S){if(Yi(S))throw S;return vs(S),Feo}finally{clearTimeout(b)}}),f=a.onDidChange(()=>{let v=a.all(i);eo(v,p)||c.cancel()});try{let v=await Promise.all(g),b=v.map(w=>w.actions).flat(),S=[...ui(v.map(w=>w.documentation)),...m4o(a,i,t,b)],y=new dui(b,S,h);return h.add(y),y}catch(v){throw h.dispose(),v}finally{f.dispose(),c.dispose()}}function p4o(a,i,e){return a.all(i).filter(t=>t.providedCodeActionKinds?t.providedCodeActionKinds.some(o=>Aeo(e,new Rs(o))):!0)}function*m4o(a,i,e,t){if(i&&t.length)for(let o of a.all(i))o._getAdditionalMenuItems&&(yield*o._getAdditionalMenuItems?.({trigger:e.type,only:e.filter?.include?.value},t.map(n=>n.action)))}function h4o(a,i,e){if(!a.documentation)return;let t=a.documentation.map(o=>({kind:new Rs(o.kind),command:o.command}));if(e){let o;for(let n of t)n.kind.contains(e)&&(o?o.kind.contains(n.kind)&&(o=n):o=n);if(o)return o?.command}for(let o of i)if(o.kind){for(let n of t)if(n.kind.contains(new Rs(o.kind)))return n.command}}async function v4(a,i,e,t,o=Ie.None){let n=a.get(Ka),r=a.get(fe),s=a.get(_e),l=a.get(Ne),c=a.get(br);if(s.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:e}),c.playSignal(tn.codeActionTriggered),await i.resolve(o),!o.isCancellationRequested&&!(i.action.edit?.edits.length&&!(await n.apply(i.action.edit,{editor:t?.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:e!=="onSave",showPreview:t?.preview,reason:sd.codeAction({kind:i.action.kind,providerId:zz.fromExtensionId(i.provider?.extensionId)})})).isApplied)){if(i.action.command)try{await r.executeCommand(i.action.command.id,...i.action.command.arguments||[])}catch(u){let p=g4o(u);l.error(typeof p=="string"?p:d(998,null))}setTimeout(()=>c.playSignal(tn.codeActionApplied),u4o)}}function g4o(a){return typeof a=="string"?a:a instanceof Error&&typeof a.message=="string"?a.message:void 0}Ge.registerCommand("_executeCodeActionProvider",async function(a,i,e,t,o){if(!(i instanceof A))throw ls();let{codeActionProvider:n}=a.get(Jt),r=a.get(_t).getModel(i);if(!r)throw ls();let s=ei.isISelection(e)?ei.liftSelection(e):G.isIRange(e)?r.validateRange(e):void 0;if(!s)throw ls();let l=typeof t=="string"?new Rs(t):void 0,c=await cM(n,r,s,{type:1,triggerAction:"other (default)",filter:{includeSourceActions:!0,include:l}},nh.None,Ie.None),u=[],p=Math.min(c.validActions.length,typeof o=="number"?o:0);for(let h=0;h<p;h++)u.push(c.validActions[h].resolve(Ie.None));try{return await Promise.all(u),c.validActions.map(h=>h.action)}finally{setTimeout(()=>c.dispose(),100)}});var Pl=(o=>(o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error",o))(Pl||{});(s=>{function a(l,c){return c-l}s.compare=a;let i=Object.create(null);i[8]=d(2411,null),i[4]=d(2415,null),i[2]=d(2413,null);function e(l){return i[l]||""}s.toString=e;let t=Object.create(null);t[8]=d(2412,null),t[4]=d(2416,null),t[2]=d(2414,null);function o(l){return t[l]||""}s.toStringPlural=o;function n(l){switch(l){case wt.Error:return 8;case wt.Warning:return 4;case wt.Info:return 2;case wt.Ignore:return 1}}s.fromSeverity=n;function r(l){switch(l){case 8:return wt.Error;case 4:return wt.Warning;case 2:return wt.Info;case 1:return wt.Ignore}}s.toSeverity=r})(Pl||={});var YB;(t=>{function i(o){return e(o,!0)}t.makeKey=i;function e(o,n){let r=[""];return o.source?r.push(o.source.replace("\xA6","\\\xA6")):r.push(""),o.code?typeof o.code=="string"?r.push(o.code.replace("\xA6","\\\xA6")):r.push(o.code.value.replace("\xA6","\\\xA6")):r.push(""),o.severity!==void 0&&o.severity!==null?r.push(Pl.toString(o.severity)):r.push(""),o.message&&n?r.push(o.message.replace("\xA6","\\\xA6")):r.push(""),o.startLineNumber!==void 0&&o.startLineNumber!==null?r.push(o.startLineNumber.toString()):r.push(""),o.startColumn!==void 0&&o.startColumn!==null?r.push(o.startColumn.toString()):r.push(""),o.endLineNumber!==void 0&&o.endLineNumber!==null?r.push(o.endLineNumber.toString()):r.push(""),o.endColumn!==void 0&&o.endColumn!==null?r.push(o.endColumn.toString()):r.push(""),r.push(""),r.join("\xA6")}t.makeKeyOptionalMessage=e})(YB||={});var ha=le("markerService");var pJ=class{constructor(i){this.keybindingService=i}static{this.codeActionCommands=[cEe,aEe,dEe,GQe,qQe]}getResolver(){let i=new uo(()=>this.keybindingService.getKeybindings().filter(e=>pJ.codeActionCommands.indexOf(e.command)>=0).filter(e=>e.resolvedKeybinding).map(e=>{let t=e.commandArgs;return e.command===GQe?t={kind:Nr.SourceOrganizeImports.value}:e.command===qQe&&(t={kind:Nr.SourceFixAll.value}),{resolvedKeybinding:e.resolvedKeybinding,...dJ.fromUser(t,{kind:Rs.None,apply:"never"})}}));return e=>{if(e.kind)return this.bestKeybindingForCodeAction(e,i.value)?.resolvedKeybinding}}bestKeybindingForCodeAction(i,e){if(!i.kind)return;let t=new Rs(i.kind);return e.filter(o=>o.kind.contains(t)).filter(o=>o.preferred?i.isPreferred:!0).reduceRight((o,n)=>o?o.kind.contains(n.kind)?n:o:n,void 0)}};pJ=I([m(0,Le)],pJ);var O8r=te("symbolIcon.arrayForeground",xo,d(1670,null)),F8r=te("symbolIcon.booleanForeground",xo,d(1671,null)),W8r=te("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1672,null)),V8r=te("symbolIcon.colorForeground",xo,d(1673,null)),B8r=te("symbolIcon.constantForeground",xo,d(1674,null)),H8r=te("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1675,null)),uui=te("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1676,null)),Veo=te("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1677,null)),U8r=te("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},d(1678,null)),z8r=te("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1679,null)),XB=te("symbolIcon.fileForeground",xo,d(1680,null)),pui=te("symbolIcon.folderForeground",xo,d(1681,null)),K8r=te("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1682,null)),G8r=te("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1683,null)),q8r=te("symbolIcon.keyForeground",xo,d(1684,null)),$8r=te("symbolIcon.keywordForeground",xo,d(1685,null)),mui=te("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},d(1686,null)),j8r=te("symbolIcon.moduleForeground",xo,d(1687,null)),Q8r=te("symbolIcon.namespaceForeground",xo,d(1688,null)),Y8r=te("symbolIcon.nullForeground",xo,d(1689,null)),X8r=te("symbolIcon.numberForeground",xo,d(1690,null)),J8r=te("symbolIcon.objectForeground",xo,d(1691,null)),Z8r=te("symbolIcon.operatorForeground",xo,d(1692,null)),eQr=te("symbolIcon.packageForeground",xo,d(1693,null)),tQr=te("symbolIcon.propertyForeground",xo,d(1694,null)),iQr=te("symbolIcon.referenceForeground",xo,d(1695,null)),oQr=te("symbolIcon.snippetForeground",xo,d(1696,null)),nQr=te("symbolIcon.stringForeground",xo,d(1697,null)),rQr=te("symbolIcon.structForeground",xo,d(1698,null)),sQr=te("symbolIcon.textForeground",xo,d(1699,null)),aQr=te("symbolIcon.typeParameterForeground",xo,d(1700,null)),lQr=te("symbolIcon.unitForeground",xo,d(1701,null)),Beo=te("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(1702,null));var Heo=Object.freeze({kind:Rs.Empty,title:d(1037,null)}),f4o=Object.freeze([{kind:Nr.QuickFix,title:d(1039,null)},{kind:Nr.RefactorExtract,title:d(1035,null),icon:L.wrench},{kind:Nr.RefactorInline,title:d(1036,null),icon:L.wrench},{kind:Nr.RefactorRewrite,title:d(1034,null),icon:L.wrench},{kind:Nr.RefactorMove,title:d(1038,null),icon:L.wrench},{kind:Nr.SurroundWith,title:d(1041,null),icon:L.surroundWith},{kind:Nr.Source,title:d(1040,null),icon:L.symbolFile},Heo]);function Ueo(a,i,e){if(!i)return a.map(n=>({kind:"action",item:n,group:Heo,disabled:!!n.action.disabled,label:n.action.disabled||n.action.title,canPreview:!!n.action.edit?.edits.length}));let t=f4o.map(n=>({group:n,actions:[]}));for(let n of a){let r=n.action.kind?new Rs(n.action.kind):Rs.None;for(let s of t)if(s.group.kind.contains(r)){s.actions.push(n);break}}let o=[];for(let n of t)if(n.actions.length){o.push({kind:"header",group:n.group});for(let r of n.actions){let s=n.group;o.push({kind:"action",item:r,group:r.action.isAI?{title:s.title,kind:s.kind,icon:L.sparkle}:s,label:r.action.title,disabled:!!r.action.disabled,keybinding:e(r.action)})}}return o}var fui=new Y("supportedCodeAction",""),zeo="_typescript.applyFixAllCodeAction",hui=class extends k{constructor(e,t,o,n=250){super();this._editor=e;this._markerService=t;this._signalChange=o;this._delay=n;this._autoTriggerTimer=this._register(new Nl);this.ignoreLightbulbOff=!1;this._register(this._markerService.onMarkerChanged(r=>this._onMarkerChanges(r))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){let t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){let t=this._editor.getModel();t&&e.some(o=>ze(o,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:"other (default)"})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;let t=this._editor.getSelection();if(e.type===1)return t;let o=this._editor.getOption(73).enabled;if(!(o==="off"&&!this.ignoreLightbulbOff)){{if(o==="off"||o==="on")return t;if(o==="onCode"){if(!t.isEmpty())return t;let r=this._editor.getModel(),{lineNumber:s,column:l}=t.getPosition(),c=r.getLineContent(s);if(c.length===0)return;if(l===1){if(/\s/.test(c[0]))return}else if(l===r.getLineMaxColumn(s)){if(/\s/.test(c[c.length-1]))return}else if(/\s/.test(c[l-2])&&/\s/.test(c[l-1]))return}}return t}}},mJ;(t=>{let a;(r=>(r[r.Empty=0]="Empty",r[r.Triggered=1]="Triggered"))(a=t.Type||={}),t.Empty={type:0};class e{constructor(n,r,s){this.trigger=n;this.position=r;this._cancellablePromise=s;this.type=1;this.actions=s.catch(l=>{if(Yi(l))return gui;throw l})}cancel(){this._cancellablePromise.cancel()}}t.Triggered=e})(mJ||={});var gui=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1}),sEt=class extends k{constructor(e,t,o,n,r,s){super();this._editor=e;this._registry=t;this._markerService=o;this._progressService=r;this._configurationService=s;this._codeActionOracle=this._register(new ue);this._state=mJ.Empty;this._onDidChangeState=this._register(new T);this.onDidChangeState=this._onDidChangeState.event;this.codeActionsDisposable=this._register(new ue);this._disposed=!1;this._ignoreLightbulbOff=!1;this._supportedCodeActions=fui.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(l=>{l.hasChanged(73)&&this._update()})),this._update()}set ignoreLightbulbOff(e){if(this._ignoreLightbulbOff===e)return;this._ignoreLightbulbOff=e;let t=this._codeActionOracle.value;t&&(t.ignoreLightbulbOff=e,e&&t.trigger({type:2,triggerAction:"other (default)"}))}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(mJ.Empty,!0))}_settingEnabledNearbyQuickfixes(){let e=this._editor?.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:e?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(mJ.Empty);let e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(104)){let t=this._registry.all(e).flatMap(n=>n.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(" "));let o=new hui(this._editor,this._markerService,n=>{if(!n){this.setState(mJ.Empty);return}let r=n.selection.getStartPosition(),s=Hn(async u=>{if(this._settingEnabledNearbyQuickfixes()&&n.trigger.type===1&&(n.trigger.triggerAction==="quick fix action"||n.trigger.filter?.include?.contains(Nr.QuickFix))){let h=await cM(this._registry,e,n.selection,n.trigger,nh.None,u);this.codeActionsDisposable.value=h;let g=[...h.allActions];if(u.isCancellationRequested)return h.dispose(),gui;let f=h.validActions?.some(b=>b.action.kind&&Nr.QuickFix.contains(new Rs(b.action.kind))&&!b.action.isAI),v=this._markerService.read({resource:e.uri});if(f){for(let b of h.validActions)b.action.command?.arguments?.some(S=>typeof S=="string"&&S.includes(zeo))&&(b.action.diagnostics=[...v.filter(S=>S.relatedInformation)]);return{validActions:h.validActions,allActions:g,documentation:h.documentation,hasAutoFix:h.hasAutoFix,hasAIFix:h.hasAIFix,allAIFixes:h.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=h}}}else if(!f&&v.length>0){let b=n.selection.getPosition(),S=b,y=Number.MAX_VALUE,w=[...h.validActions];for(let E of v){let M=E.endColumn,N=E.endLineNumber,V=E.startLineNumber;if(N===b.lineNumber||V===b.lineNumber){S=new ye(N,M);let H={type:n.trigger.type,triggerAction:n.trigger.triggerAction,filter:{include:n.trigger.filter?.include?n.trigger.filter?.include:Nr.QuickFix},autoApply:n.trigger.autoApply,context:{notAvailableMessage:n.trigger.context?.notAvailableMessage||"",position:S}},K=new ei(S.lineNumber,S.column,S.lineNumber,S.column),j=await cM(this._registry,e,K,H,nh.None,u);if(u.isCancellationRequested)return j.dispose(),gui;if(j.validActions.length!==0){for(let J of j.validActions)J.action.command?.arguments?.some(se=>typeof se=="string"&&se.includes(zeo))&&(J.action.diagnostics=[...v.filter(se=>se.relatedInformation)]);h.allActions.length===0&&g.push(...j.allActions),Math.abs(b.column-M)<y?w.unshift(...j.validActions):w.push(...j.validActions)}y=Math.abs(b.column-M)}}let x=w.filter((E,M,N)=>N.findIndex(V=>V.action.title===E.action.title)===M);return x.sort((E,M)=>E.action.isPreferred&&!M.action.isPreferred?-1:!E.action.isPreferred&&M.action.isPreferred||E.action.isAI&&!M.action.isAI?1:!E.action.isAI&&M.action.isAI?-1:0),{validActions:x,allActions:g,documentation:h.documentation,hasAutoFix:h.hasAutoFix,hasAIFix:h.hasAIFix,allAIFixes:h.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=h}}}}if(n.trigger.type===1){let h=await cM(this._registry,e,n.selection,n.trigger,nh.None,u);return this.codeActionsDisposable.value=h,h}let p=await cM(this._registry,e,n.selection,n.trigger,nh.None,u);return this.codeActionsDisposable.value=p,p});n.trigger.type===1&&this._progressService?.showWhile(s,250);let l=new mJ.Triggered(n.trigger,r,s),c=!1;this._state.type===1&&(c=this._state.trigger.type===1&&l.type===1&&l.trigger.type===2&&this._state.position!==l.position),c?setTimeout(()=>{this.setState(l)},500):this.setState(l)},void 0);o.ignoreLightbulbOff=this._ignoreLightbulbOff,this._codeActionOracle.value=o,this._codeActionOracle.value.trigger({type:2,triggerAction:"other (default)"})}else this._supportedCodeActions.reset()}trigger(e){this._codeActionOracle.value?.trigger(e),this.codeActionsDisposable.dispose()}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}};var Geo=Oe("gutter-lightbulb",L.lightBulb,d(1049,null)),qeo=Oe("gutter-lightbulb-auto-fix",L.lightbulbAutofix,d(1047,null)),$eo=Oe("gutter-lightbulb-sparkle",L.lightbulbSparkle,d(1046,null)),jeo=Oe("gutter-lightbulb-aifix-auto-fix",L.lightbulbSparkleAutofix,d(1045,null)),Qeo=Oe("gutter-lightbulb-sparkle-filled",L.sparkleFilled,d(1048,null)),zK;(t=>{let a;(r=>(r[r.Hidden=0]="Hidden",r[r.Showing=1]="Showing"))(a=t.Type||={}),t.Hidden={type:0};class e{constructor(n,r,s,l){this.actions=n;this.trigger=r;this.editorPosition=s;this.widgetPosition=l;this.type=1}}t.Showing=e})(zK||={});function vui(a,i,e,t,o=!1){if(a.validActions.length<=0)return;let n,r=!1;a.allAIFixes?(n=o?Qeo:L.sparkleFilled,a.validActions.length===1&&(r=!0)):a.hasAutoFix?a.hasAIFix?n=o?jeo:L.lightbulbSparkleAutofix:n=o?qeo:L.lightbulbAutofix:a.hasAIFix?n=o?$eo:L.lightbulbSparkle:n=o?Geo:L.lightBulb;let s;return r?s=d(1043,null,a.validActions[0].action.title):a.hasAutoFix&&e?s=d(1050,null,e):!a.hasAutoFix&&t?s=d(1044,null,t):s=d(1042,null),{actions:a,trigger:i,icon:n,autoRun:r,title:s,isGutter:o}}var BT=class extends k{constructor(e,t){super();this._editor=e;this._keybindingService=t;this.onlyWithEmptySelection=!1;this._onClick=this._register(new T);this.onClick=this._onClick.event;this._state=De(this,zK.Hidden);this._gutterState=De(this,zK.Hidden);this._combinedInfo=ke(this,e=>{let t=this._gutterState.read(e);if(t.type===1)return BT._computeLightBulbInfo(t,!0,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e));let o=this._state.read(e);if(o.type===1)return BT._computeLightBulbInfo(o,!1,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e))});this.lightBulbInfo=this._combinedInfo;this._iconClasses=[];this.lightbulbClasses=["codicon-"+Geo.id,"codicon-"+jeo.id,"codicon-"+qeo.id,"codicon-"+$eo.id,"codicon-"+Qeo.id];this._preferredKbLabel=De(this,void 0);this._quickFixKbLabel=De(this,void 0);this.gutterDecoration=BT.GUTTER_DECORATION;this._domNode=_("div.lightBulbWidget"),this._domNode.role="listbox",this._register(ds.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(o=>{let n=this._editor.getModel(),r=this._state.get();(r.type!==1||!n||r.editorPosition.lineNumber>=n.getLineCount())&&this.hide();let s=this._gutterState.get();(s.type!==1||!n||s.editorPosition.lineNumber>=n.getLineCount())&&this.gutterHide()})),this._register(Rwe(this._domNode,o=>{let n=this._state.get();if(n.type!==1)return;this._editor.focus(),o.preventDefault();let{top:r,height:s}=ur(this._domNode),l=this._editor.getOption(75),c=Math.floor(l/3);n.widgetPosition.position!==null&&n.widgetPosition.position.lineNumber<n.editorPosition.lineNumber&&(c+=l),this._onClick.fire({x:o.posx,y:r+s+c,actions:n.actions,trigger:n.trigger})})),this._register($(this._domNode,"mouseenter",o=>{(o.buttons&1)===1&&this.hide()})),this._register(U.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(lEe)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(UK)?.getLabel()??void 0,void 0)})),this._register(ve(o=>{let n=this._combinedInfo.read(o);this._updateLightBulbTitleAndIcon(n),this._updateGutterDecorationOptions(n)})),this._register(this._editor.onMouseDown(async o=>{if(!o.target.element||!this.lightbulbClasses.some(u=>o.target.element&&o.target.element.classList.contains(u)))return;let n=this._gutterState.get();if(n.type!==1)return;this._editor.focus();let{top:r,height:s}=ur(o.target.element),l=this._editor.getOption(75),c=Math.floor(l/3);n.widgetPosition.position!==null&&n.widgetPosition.position.lineNumber<n.editorPosition.lineNumber&&(c+=l),this._onClick.fire({x:o.event.posx,y:r+s+c,actions:n.actions,trigger:n.trigger})}))}static{this.GUTTER_DECORATION=So.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:q.asClassName(L.lightBulb),glyphMargin:{position:1},stickiness:1})}static{this.ID="editor.contrib.lightbulbWidget"}static{this._posPref=[0]}static _computeLightBulbInfo(e,t,o,n){if(e.type===1)return vui(e.actions,e.trigger,o,n,t)}dispose(){super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){let e=this._state.get();return e.type===1?e.widgetPosition:null}update(e,t,o){if(e.validActions.length<=0)return this.gutterHide(),this.hide();if(this.onlyWithEmptySelection&&!this._editor.getSelection()?.isEmpty())return this.gutterHide(),this.hide();if(!this._editor.hasTextFocus())return this.gutterHide(),this.hide();if(this._editor.getOptions().get(73).enabled==="off")return this.gutterHide(),this.hide();let s=this._editor.getModel();if(!s)return this.gutterHide(),this.hide();let{lineNumber:l,column:c}=s.validatePosition(o),u=s.getOptions().tabSize,p=this._editor.getOptions().get(59),h=s.getLineContent(l),g=H5(h,u),f=p.spaceWidth*g>22,v=M=>M>2&&this._editor.getTopForLineNumber(M)===this._editor.getTopForLineNumber(M-1),b=this._editor.getLineDecorations(l),S=!1;if(b)for(let M of b){let N=M.options.glyphMarginClassName;if(N&&!this.lightbulbClasses.some(V=>N.includes(V))){S=!0;break}}let y=l,w=1;if(!f){let M=N=>{let V=s.getLineContent(N);return/^\s*$|^\s+/.test(V)||V.length<=w};if(l>1&&!v(l-1)){let N=s.getLineCount(),V=l===N,H=l>1&&M(l-1),K=!V&&M(l+1),j=M(l),J=!K&&!H;if(!K&&!H&&!S)return this._gutterState.set(new zK.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:BT._posPref}),void 0),this.renderGutterLightbub(),this.hide();H||V||H&&!j?y-=1:(K||J&&j)&&(y+=1)}else if(l===1&&(l===s.getLineCount()||!M(l+1)&&!M(l)))if(this._gutterState.set(new zK.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:BT._posPref}),void 0),S)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(l<s.getLineCount()&&!v(l+1))y+=1;else if(c*p.spaceWidth<22)return this.hide();w=/^\S\s*$/.test(s.getLineContent(y))?2:1}this._state.set(new zK.Showing(e,t,o,{position:{lineNumber:y,column:w},preference:BT._posPref}),void 0),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());let x=e.validActions,E=e.validActions[0].action.kind;if(x.length!==1||!E){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this._state.get()!==zK.Hidden&&(this._state.set(zK.Hidden,void 0),this._editor.layoutContentWidget(this))}gutterHide(){this._gutterState.get()!==zK.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this._gutterState.set(zK.Hidden,void 0))}_updateLightBulbTitleAndIcon(e){this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],!(!e||e.isGutter)&&(this._domNode.title=e.title,this._iconClasses=q.asClassNameArray(e.icon),this._domNode.classList.add(...this._iconClasses))}_updateGutterDecorationOptions(e){!e||!e.isGutter||(this.gutterDecoration=So.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:q.asClassName(e.icon),glyphMargin:{position:1},stickiness:1}))}renderGutterLightbub(){let e=this._editor.getSelection();e&&(this._gutterDecorationID===void 0?this._addGutterDecoration(e.startLineNumber):this._updateGutterDecoration(this._gutterDecorationID,e.startLineNumber))}_addGutterDecoration(e){this._editor.changeDecorations(t=>{this._gutterDecorationID=t.addDecoration(new G(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(o=>{o.changeDecoration(e,new G(t,0,t,0)),o.changeDecorationOptions(e,this.gutterDecoration)})}};BT=I([m(1,Le)],BT);var v4o="quickfix-edit-highlight",Rm=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._commandService=l;this._configurationService=c;this._actionWidgetService=u;this._instantiationService=p;this._progressService=h;this._keybindingService=g;this._activeCodeActions=this._register(new ue);this._showDisabled=!1;this._disposed=!1;this._onlyLightBulbWithEmptySelection=!1;this._lightBulbInfoObs=De(this,void 0);this._preferredKbLabel=De(this,void 0);this._quickFixKbLabel=De(this,void 0);this._hasLightBulbStateObservers=!1;this.lightBulbState=Js({owner:this,onLastObserverRemoved:()=>{this._hasLightBulbStateObservers=!1,this._model.ignoreLightbulbOff=!1}},e=>(this._hasLightBulbStateObservers||(this._hasLightBulbStateObservers=!0,this._model.ignoreLightbulbOff=!0),this._lightBulbInfoObs.read(e)));this._editor=e,this._model=this._register(new sEt(this._editor,r.codeActionProvider,t,o,s,c)),this._register(this._model.onDidChangeState(f=>this.update(f))),this._register(U.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(lEe)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(UK)?.getLabel()??void 0,void 0)})),this._lightBulbWidget=new uo(()=>{let f=this._editor.getContribution(BT.ID);return f&&(this._register(f.onClick(v=>this.showCodeActionsFromLightbulb(v.actions,v))),f.onlyWithEmptySelection=this._onlyLightBulbWithEmptySelection),f}),this._resolver=n.createInstance(pJ),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}static{this.ID="editor.contrib.codeActionController"}static get(e){return e.getContribution(Rm.ID)}set onlyLightBulbWithEmptySelection(e){let t=this._lightBulbWidget.rawValue;t&&(t.onlyWithEmptySelection=e),this._onlyLightBulbWithEmptySelection=e}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){let o=e.validActions[0],n=o.action.command;n&&n.id==="inlineChat.start"&&n.arguments&&n.arguments.length>=1&&n.arguments[0]&&(n.arguments[0]={...n.arguments[0],autoSend:!1}),await this.applyCodeAction(o,!1,!1,"fromAILightbulb");return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,o){return this.showCodeActionList(t,o,{includeDisabledActions:!1,fromLightbulb:!1})}hideCodeActions(){this._actionWidgetService.hide()}manualTriggerAtCurrentPosition(e,t,o,n){if(!this._editor.hasModel())return;Xu.get(this._editor)?.closeMessage();let r=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:o,autoApply:n,context:{notAvailableMessage:e,position:r}})}_trigger(e){return this._model.trigger(e)}async applyCodeAction(e,t,o,n){let r=this._progressService.show(!0,500);try{await this._instantiationService.invokeFunction(v4,e,n,{preview:o,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:"quick fix action",filter:{}}),r.done()}}hideLightBulbWidget(){this._lightBulbWidget.rawValue?.hide(),this._lightBulbWidget.rawValue?.gutterHide()}async update(e){if(e.type!==mJ.Type.Triggered){this.hideLightBulbWidget(),this._lightBulbInfoObs.set(void 0,void 0);return}let t;try{t=await e.actions}catch(n){mt(n);return}if(!(this._disposed||this._editor.getSelection()?.startLineNumber!==e.position.lineNumber))if(this._lightBulbWidget.value?.update(t,e.trigger,e.position),this._lightBulbInfoObs.set(vui(t,e.trigger,this._preferredKbLabel.get(),this._quickFixKbLabel.get()),void 0),e.trigger.type===1){if(e.trigger.filter?.include){let r=this.tryGetValidActionToApply(e.trigger,t);if(r){try{this.hideLightBulbWidget(),await this.applyCodeAction(r,!1,!1,"fromCodeActions")}finally{t.dispose()}return}if(e.trigger.context){let s=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(s&&s.action.disabled){Xu.get(this._editor)?.showMessage(s.action.disabled,e.trigger.context.position),t.dispose();return}}}let n=!!e.trigger.filter?.include;if(e.trigger.context&&(!t.allActions.length||!n&&!t.validActions.length)){Xu.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:n,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:o})=>o.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}static{this.DECORATION=So.register({description:"quickfix-highlight",className:v4o})}async showCodeActionList(e,t,o){let n=this._editor.createDecorationsCollection(),r=this._editor.getDomNode();if(!r)return;let s=o.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!s.length)return;let l=ye.isIPosition(t)?this.toCoords(t):t,c={onSelect:async(u,p)=>{this.applyCodeAction(u,!0,!!p,o.fromLightbulb?"fromAILightbulb":"fromCodeActions"),this._actionWidgetService.hide(!1),n.clear()},onHide:u=>{this._editor?.focus(),n.clear()},onHover:async(u,p)=>{if(p.isCancellationRequested)return;let h=!1,g=u.action.kind;if(g){let f=new Rs(g);h=[Nr.RefactorExtract,Nr.RefactorInline,Nr.RefactorRewrite,Nr.RefactorMove,Nr.Source].some(b=>b.contains(f))}return{canPreview:h||!!u.action.edit?.edits.length}},onFocus:u=>{if(u&&u.action){let p=u.action.ranges,h=u.action.diagnostics;if(n.clear(),p&&p.length>0){let g=h&&h?.length>1?h.map(f=>({range:f,options:Rm.DECORATION})):p.map(f=>({range:f,options:Rm.DECORATION}));n.set(g)}else if(h&&h.length>0){let g=h.map(v=>({range:v,options:Rm.DECORATION}));n.set(g);let f=h[0];if(f.startLineNumber&&f.startColumn){let v=this._editor.getModel()?.getWordAtPosition({lineNumber:f.startLineNumber,column:f.startColumn})?.word;Er(d(1031,null,v,f.startLineNumber,f.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,Ueo(s,this._shouldShowHeaders(),this._resolver.getResolver()),c,l,r,this._getActionBarActions(e,t,o))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();let t=this._editor.getScrolledVisiblePosition(e),o=ur(this._editor.getDomNode()),n=o.left+t.left,r=o.top+t.top+t.height;return{x:n,y:r}}_shouldShowHeaders(){let e=this._editor?.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e?.uri})}_getActionBarActions(e,t,o){if(o.fromLightbulb)return[];let n=e.documentation.map(r=>({id:r.id,label:r.title,tooltip:r.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(r.id,...r.arguments??[])}));return o.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:d(1032,null),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,o))}:{id:"showMoreActions",label:d(1033,null),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,o))}),n}};Rm=I([m(1,ha),m(2,X),m(3,F),m(4,Jt),m(5,Hd),m(6,fe),m(7,B),m(8,kd),m(9,F),m(10,Hd),m(11,Le)],Rm);hs((a,i)=>{((o,n)=>{n&&i.addRule(`.monaco-editor ${o} { background-color: ${n}; }`)})(".quickfix-edit-highlight",a.getColor(NS));let t=a.getColor(TF);t&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Uf(a.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`)});function $Qe(a){return C.regex(fui.keys()[0],new RegExp("(\\s|^)"+Ss(a.value)+"\\b"))}var bui={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:d(1003,null)},apply:{type:"string",description:d(999,null),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[d(1000,null),d(1001,null),d(1002,null)]},preferred:{type:"boolean",default:!1,description:d(1004,null)}}};function Xde(a,i,e,t,o="other (default)"){a.hasModel()&&Rm.get(a)?.manualTriggerAtCurrentPosition(i,o,e,t)}var lEt=class extends yl{constructor(){super({id:UK,title:P(1025,"Quick Fix..."),precondition:C.and(me.writable,me.hasCodeActionsProvider),icon:L.lightBulb,f1:!0,keybinding:{when:me.textInputFocus,primary:2137,weight:100},menu:{id:R.InlineChatEditorAffordance,group:"1_quickfix",order:0,when:C.and(me.writable,me.hasCodeActionsProvider)}})}runEditorCommand(i,e){return Xde(e,d(1012,null),void 0,void 0,"quick fix action")}},cEt=class extends od{constructor(){super({id:aEe,precondition:C.and(me.writable,me.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:bui}]}})}runEditorCommand(i,e,t){let o=dJ.fromUser(t,{kind:Rs.Empty,apply:"ifSingle"});return Xde(e,typeof t?.kind=="string"?o.preferred?d(1010,null,t.kind):d(1008,null,t.kind):o.preferred?d(1009,null):d(1007,null),{include:o.kind,includeSourceActions:!0,onlyIncludePreferredActions:o.preferred},o.apply)}},dEt=class extends Mi{constructor(){super({id:cEe,label:P(1026,"Refactor..."),precondition:C.and(me.writable,me.hasCodeActionsProvider),kbOpts:{kbExpr:me.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:C.and(me.writable,$Qe(Nr.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:bui}]}})}run(i,e,t){let o=dJ.fromUser(t,{kind:Nr.Refactor,apply:"never"});return Xde(e,typeof t?.kind=="string"?o.preferred?d(1016,null,t.kind):d(1014,null,t.kind):o.preferred?d(1015,null):d(1013,null),{include:Nr.Refactor.contains(o.kind)?o.kind:Rs.None,onlyIncludePreferredActions:o.preferred},o.apply,"refactor")}},uEt=class extends Mi{constructor(){super({id:dEe,label:P(1027,"Source Action..."),precondition:C.and(me.writable,me.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:C.and(me.writable,$Qe(Nr.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:bui}]}})}run(i,e,t){let o=dJ.fromUser(t,{kind:Nr.Source,apply:"never"});return Xde(e,typeof t?.kind=="string"?o.preferred?d(1020,null,t.kind):d(1018,null,t.kind):o.preferred?d(1019,null):d(1017,null),{include:Nr.Source.contains(o.kind)?o.kind:Rs.None,includeSourceActions:!0,onlyIncludePreferredActions:o.preferred},o.apply,"source action")}},pEt=class extends Mi{constructor(){super({id:GQe,label:P(1024,"Organize Imports"),precondition:C.and(me.writable,$Qe(Nr.SourceOrganizeImports)),kbOpts:{kbExpr:me.textInputFocus,primary:1581,weight:100},metadata:{description:P(1023,"Organize imports in the current file. Also called 'Optimize Imports' by some tools")}})}run(i,e){return Xde(e,d(1011,null),{include:Nr.SourceOrganizeImports,includeSourceActions:!0},"ifSingle","organize imports")}},mEt=class extends Mi{constructor(){super({id:qQe,label:P(1021,"Fix All"),precondition:C.and(me.writable,$Qe(Nr.SourceFixAll))})}run(i,e){return Xde(e,d(1022,null),{include:Nr.SourceFixAll,includeSourceActions:!0},"ifSingle","fix all")}},hEt=class extends Mi{constructor(){super({id:lEe,label:P(1005,"Auto Fix..."),precondition:C.and(me.writable,$Qe(Nr.QuickFix)),kbOpts:{kbExpr:me.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(i,e){return Xde(e,d(1006,null),{include:Nr.QuickFix,onlyIncludePreferredActions:!0},"ifSingle","auto fix")}};Eo(Rm.ID,Rm,3);Eo(BT.ID,BT,4);W(lEt);ri(dEt);ri(uEt);ri(pEt);ri(hEt);ri(mEt);ro(new cEt);oe.as($t.Configuration).registerConfiguration({...wx,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:6,description:d(1029,null),default:!0}}});oe.as($t.Configuration).registerConfiguration({...wx,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:6,description:d(1028,null),default:!0}}});oe.as($t.Configuration).registerConfiguration({...wx,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:6,markdownDescription:d(1030,null,"`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});var Jde=class a{constructor(){this.lenses=[]}static{this.Empty=new a}dispose(){this._store?.dispose()}get isDisposed(){return this._store?.isDisposed??!1}add(i,e){Sd(i)&&(this._store??=new O,this._store.add(i));for(let t of i.lenses)this.lenses.push({symbol:t,provider:e})}};async function Sui(a,i,e){let t=a.ordered(i),o=new Map,n=new Jde,r=t.map(async(s,l)=>{o.set(s,l);try{let c=await Promise.resolve(s.provideCodeLenses(i,e));c&&n.add(c,s)}catch(c){vs(c)}});return await Promise.all(r),e.isCancellationRequested?(n.dispose(),Jde.Empty):(n.lenses=n.lenses.sort((s,l)=>s.symbol.range.startLineNumber<l.symbol.range.startLineNumber?-1:s.symbol.range.startLineNumber>l.symbol.range.startLineNumber?1:o.get(s.provider)<o.get(l.provider)?-1:o.get(s.provider)>o.get(l.provider)?1:s.symbol.range.startColumn<l.symbol.range.startColumn?-1:s.symbol.range.startColumn>l.symbol.range.startColumn?1:0),n)}Ge.registerCommand("_executeCodeLensProvider",function(a,...i){let[e,t]=i;To(A.isUri(e)),To(typeof t=="number"||!t);let{codeLensProvider:o}=a.get(Jt),n=a.get(_t).getModel(e);if(!n)throw ls();let r=[],s=new O;return Sui(o,n,Ie.None).then(l=>{s.add(l);let c=[];for(let u of l.lenses)t==null||u.symbol.command?r.push(u.symbol):t-- >0&&u.provider.resolveCodeLens&&c.push(Promise.resolve(u.provider.resolveCodeLens(n,u.symbol,Ie.None)).then(p=>r.push(p||u.symbol)));return Promise.all(c)}).then(()=>r).finally(()=>{setTimeout(()=>s.dispose(),100)})});var Iui=le("ICodeLensCache"),gEt=class{constructor(i,e){this.lineCount=i;this.data=e}},jQe=class{constructor(i){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}};this._cache=new Ua(20,.75);let e="codelens/cache";Ff(ut,()=>i.remove(e,1));let t="codelens/cache2",o=i.get(t,1,"{}");this._deserialize(o);let n=U.filter(i.onWillSaveState,r=>r.reason===1);U.once(n)(r=>{i.store(t,this._serialize(),1,1)})}put(i,e){let t=e.lenses.map(r=>({range:r.symbol.range,command:r.symbol.command&&{id:"",title:r.symbol.command?.title}})),o=new Jde;o.add({lenses:t},this._fakeProvider);let n=new gEt(i.getLineCount(),o);this._cache.set(i.uri.toString(),n)}get(i){let e=this._cache.get(i.uri.toString());return e&&e.lineCount===i.getLineCount()?e.data:void 0}delete(i){this._cache.delete(i.uri.toString())}_serialize(){let i=Object.create(null);for(let[e,t]of this._cache){let o=new Set;for(let n of t.data.lenses)o.add(n.symbol.range.startLineNumber);i[e]={lineCount:t.lineCount,lines:[...o.values()]}}return JSON.stringify(i)}_deserialize(i){try{let e=JSON.parse(i);for(let t in e){let o=e[t],n=[];for(let s of o.lines)n.push({range:new G(s,1,s,11)});let r=new Jde;r.add({lenses:n},this._fakeProvider),this._cache.set(t,new gEt(o.lineCount,r))}}catch{}}};jQe=I([m(0,de)],jQe);Ce(Iui,jQe,1);var yui=class{constructor(i,e,t){this.afterColumn=1073741824;this.afterLineNumber=i,this.heightInPx=e,this._onHeight=t,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(i){this._lastHeight===void 0?this._lastHeight=i:this._lastHeight!==i&&(this._lastHeight=i,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}},wui=class a{constructor(i,e){this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this._commands=new Map;this._isEmpty=!0;this._editor=i,this._id=`codelens.widget-${a._idPool++}`,this.updatePosition(e),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}static{this._idPool=0}withCommands(i,e){this._commands.clear();let t=[],o=!1;for(let n=0;n<i.length;n++){let r=i[n];if(r&&(o=!0,r.command)){let s=ir(r.command.title.trim());if(r.command.id){let l=`c${a._idPool++}`;t.push(_("a",{id:l,title:r.command.tooltip,role:"button"},...s)),this._commands.set(l,r.command)}else t.push(_("span",{title:r.command.tooltip},...s));n+1<i.length&&t.push(_("span",void 0,"\xA0|\xA0"))}}o?(Ii(this._domNode,...t),this._isEmpty&&e&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Ii(this._domNode,_("span",void 0,"no commands"))}getCommand(i){return i.parentElement===this._domNode?this._commands.get(i.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(i){let e=this._editor.getModel().getLineFirstNonWhitespaceColumn(i);this._widgetPosition={position:{lineNumber:i,column:e},preference:[1]}}getPosition(){return this._widgetPosition||null}},uEe=class{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(i,e){this._addDecorations.push(i),this._addDecorationsCallbacks.push(e)}removeDecoration(i){this._removeDecorations.push(i)}commit(i){let e=i.deltaDecorations(this._removeDecorations,this._addDecorations);for(let t=0,o=e.length;t<o;t++)this._addDecorationsCallbacks[t](e[t])}},Yeo=So.register({collapseOnReplaceEdit:!0,description:"codelens"}),QQe=class{constructor(i,e,t,o,n,r){this._isDisposed=!1;this._editor=e,this._data=i,this._decorationIds=[];let s,l=[];this._data.forEach((c,u)=>{c.symbol.command&&l.push(c.symbol),t.addDecoration({range:c.symbol.range,options:Yeo},p=>this._decorationIds[u]=p),s?s=G.plusRange(s,c.symbol.range):s=G.lift(c.symbol.range)}),this._viewZone=new yui(s.startLineNumber-1,n,r),this._viewZoneId=o.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new wui(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(i,e){this._decorationIds.forEach(i.removeDecoration,i),this._decorationIds=[],e?.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((i,e)=>{let t=this._editor.getModel().getDecorationRange(i),o=this._data[e].symbol;return!!(t&&G.isEmpty(o.range)===t.isEmpty())})}updateCodeLensSymbols(i,e){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],this._data=i,this._data.forEach((t,o)=>{e.addDecoration({range:t.symbol.range,options:Yeo},n=>this._decorationIds[o]=n)})}updateHeight(i,e){this._viewZone.heightInPx=i,e.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(i){if(!this._viewZone.isVisible())return null;for(let e=0;e<this._decorationIds.length;e++){let t=i.getDecorationRange(this._decorationIds[e]);t&&(this._data[e].symbol.range=t)}return this._data}updateCommands(i){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(i,!0);for(let e=0;e<this._data.length;e++){let t=i[e];if(t){let{symbol:o}=this._data[e];o.command=t.command||o.command}}}getCommand(i){return this._contentWidget?.getCommand(i)}getLineNumber(){let i=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return i?i.startLineNumber:-1}update(i){if(this.isValid()){let e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);e&&(this._viewZone.afterLineNumber=e.startLineNumber-1,i.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(e.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}getItems(){return this._data}};var Gf=le("ILanguageFeatureDebounceService"),kui;(t=>{let a=new WeakMap,i=0;function e(o){let n=a.get(o);return n===void 0&&(n=++i,a.set(o,n)),n}t.of=e})(kui||={});var Cui=class{constructor(i){this._default=i}get(i){return this._default}update(i,e){return this._default}default(){return this._default}},xui=class{constructor(i,e,t,o,n,r){this._logService=i;this._name=e;this._registry=t;this._default=o;this._min=n;this._max=r;this._cache=new Ua(50,.7)}_key(i){return i.id+this._registry.all(i).reduce((e,t)=>g4e(kui.of(t),e),0)}get(i){let e=this._key(i),t=this._cache.get(e);return t?jn(t.value,this._min,this._max):this.default()}update(i,e){let t=this._key(i),o=this._cache.get(t);o||(o=new bbt(6),this._cache.set(t,o));let n=jn(o.update(e),this._min,this._max);return hc(i.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${i.uri.toString()} is ${n}ms`),n}_overall(){let i=new f4e;for(let[,e]of this._cache)i.update(e.value);return i.value}default(){let i=this._overall()|0||this._default;return jn(i,this._min,this._max)}},YQe=class{constructor(i,e){this._logService=i;this._data=new Map;this._isDev=e.isExtensionDevelopment||!e.isBuilt}for(i,e,t){let o=t?.min??50,n=t?.max??o**2,r=t?.key??void 0,s=`${kui.of(i)},${o}${r?","+r:""}`,l=this._data.get(s);return l||(this._isDev?(this._logService.debug(`[DEBOUNCE: ${e}] is disabled in developed mode`),l=new Cui(o*1.5)):l=new xui(this._logService,e,i,this._overallAverage()|0||o*1.5,o,n),this._data.set(s,l)),l}_overallAverage(){let i=new f4e;for(let e of this._data.values())i.update(e.default());return i.value}};YQe=I([m(0,re),m(1,ko)],YQe);Ce(Gf,YQe,1);var S4=class{constructor(i,e,t,o,n,r){this._editor=i;this._languageFeaturesService=e;this._commandService=o;this._notificationService=n;this._codeLensCache=r;this._disposables=new O;this._localToDispose=new O;this._lenses=[];this._oldCodeLensModels=new O;this._provideCodeLensDebounce=t.for(e.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=t.for(e.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new Dt(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(s=>{(s.hasChanged(59)||s.hasChanged(25)||s.hasChanged(24))&&this._updateLensStyle(),s.hasChanged(23)&&this._onModelChange()})),this._disposables.add(e.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}static{this.ID="css.editor.codeLens"}dispose(){this._localDispose(),this._localToDispose.dispose(),this._disposables.dispose(),this._resolveCodeLensesScheduler.dispose(),this._oldCodeLensModels.dispose(),this._currentCodeLensModel?.dispose()}_getLayoutInfo(){let i=Math.max(1.3,this._editor.getOption(75)/this._editor.getOption(61)),e=this._editor.getOption(25);return(!e||e<5)&&(e=this._editor.getOption(61)*.9|0),{fontSize:e,codeLensHeight:e*i|0}}_updateLensStyle(){let{codeLensHeight:i,fontSize:e}=this._getLayoutInfo(),t=this._editor.getOption(24),o=this._editor.getOption(59),{style:n}=this._editor.getContainerDomNode();n.setProperty("--vscode-editorCodeLens-lineHeight",`${i}px`),n.setProperty("--vscode-editorCodeLens-fontSize",`${e}px`),n.setProperty("--vscode-editorCodeLens-fontFeatureSettings",o.fontFeatureSettings),t&&(n.setProperty("--vscode-editorCodeLens-fontFamily",t),n.setProperty("--vscode-editorCodeLens-fontFamilyDefault",Ku.fontFamily)),this._editor.changeViewZones(r=>{for(let s of this._lenses)s.updateHeight(i,r)})}_localDispose(){this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=void 0,this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),this._currentCodeLensModel?.dispose()}_onModelChange(){this._localDispose();let i=this._editor.getModel();if(!i||!this._editor.getOption(23)||i.isTooLargeForTokenization())return;let e=this._codeLensCache.get(i);if(e&&this._renderCodeLensSymbols(e),!this._languageFeaturesService.codeLensProvider.has(i)){e&&Zo(()=>{let o=this._codeLensCache.get(i);e===o&&(this._codeLensCache.delete(i),this._onModelChange())},30*1e3,this._localToDispose);return}for(let o of this._languageFeaturesService.codeLensProvider.all(i))if(typeof o.onDidChange=="function"){let n=o.onDidChange(()=>t.schedule());this._localToDispose.add(n)}let t=new Dt(()=>{let o=Date.now();this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=Hn(n=>Sui(this._languageFeaturesService.codeLensProvider,i,n)),this._getCodeLensModelPromise.then(n=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=n,this._codeLensCache.put(i,n);let r=this._provideCodeLensDebounce.update(i,Date.now()-o);t.delay=r,this._renderCodeLensSymbols(n),this._resolveCodeLensesInViewportSoon()},mt)},this._provideCodeLensDebounce.get(i));this._localToDispose.add(t),this._localToDispose.add(ee(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._editor.changeDecorations(o=>{this._editor.changeViewZones(n=>{let r=[],s=-1;this._lenses.forEach(c=>{!c.isValid()||s===c.getLineNumber()?r.push(c):(c.update(n),s=c.getLineNumber())});let l=new uEe;r.forEach(c=>{c.dispose(l,n),this._lenses.splice(this._lenses.indexOf(c),1)}),l.commit(o)})}),t.schedule(),this._resolveCodeLensesScheduler.cancel(),this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{t.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{t.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(o=>{o.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(ee(()=>{if(this._editor.getModel()){let o=Sx.capture(this._editor);this._editor.changeDecorations(n=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(n,r)})}),o.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(o=>{if(o.target.type!==9)return;let n=o.target.element;if(n?.tagName==="SPAN"&&(n=n.parentElement),n?.tagName==="A")for(let r of this._lenses){let s=r.getCommand(n);if(s){this._commandService.executeCommand(s.id,...s.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),t.schedule()}_disposeAllLenses(i,e){let t=new uEe;for(let o of this._lenses)o.dispose(t,e);i&&t.commit(i),this._lenses.length=0}_renderCodeLensSymbols(i){if(!this._editor.hasModel())return;let e=this._editor.getModel().getLineCount(),t=[],o;for(let s of i.lenses){let l=s.symbol.range.startLineNumber;l<1||l>e||(o&&o[o.length-1].symbol.range.startLineNumber===l?o.push(s):(o=[s],t.push(o)))}if(!t.length&&!this._lenses.length)return;let n=Sx.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(s=>{this._editor.changeViewZones(l=>{let c=new uEe,u=0,p=0;for(;p<t.length&&u<this._lenses.length;){let h=t[p][0].symbol.range.startLineNumber,g=this._lenses[u].getLineNumber();g<h?(this._lenses[u].dispose(c,l),this._lenses.splice(u,1)):g===h?(this._lenses[u].updateCodeLensSymbols(t[p],c),p++,u++):(this._lenses.splice(u,0,new QQe(t[p],this._editor,c,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),u++,p++)}for(;u<this._lenses.length;)this._lenses[u].dispose(c,l),this._lenses.splice(u,1);for(;p<t.length;)this._lenses.push(new QQe(t[p],this._editor,c,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),p++;c.commit(s)})}),n.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0;let i=this._editor.getModel();if(!i)return;let e=[],t=[];if(this._lenses.forEach(r=>{let s=r.computeIfNecessary(i);s&&(e.push(s),t.push(r))}),e.length===0){this._oldCodeLensModels.clear();return}let o=Date.now(),n=Hn(r=>{let s=e.map((l,c)=>{let u=new Array(l.length),p=l.map((h,g)=>!h.symbol.command&&typeof h.provider.resolveCodeLens=="function"?Promise.resolve(h.provider.resolveCodeLens(i,h.symbol,r)).then(f=>{u[g]=f},vs):(u[g]=h.symbol,Promise.resolve(void 0)));return Promise.all(p).then(()=>{!r.isCancellationRequested&&!t[c].isDisposed()&&t[c].updateCommands(u)})});return Promise.all(s)});this._resolveCodeLensesPromise=n,this._resolveCodeLensesPromise.then(()=>{let r=this._resolveCodeLensesDebounce.update(i,Date.now()-o);this._resolveCodeLensesScheduler.delay=r,this._currentCodeLensModel&&this._codeLensCache.put(i,this._currentCodeLensModel),this._oldCodeLensModels.clear(),n===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},r=>{mt(r),n===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,this._currentCodeLensModel?.isDisposed?void 0:this._currentCodeLensModel}};S4=I([m(1,Jt),m(2,Gf),m(3,fe),m(4,Ne),m(5,Iui)],S4);Eo(S4.ID,S4,1);ri(class extends Mi{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:me.hasCodeLensProvider,label:P(1052,"Show CodeLens Commands for Current Line")})}async run(i,e){if(!e.hasModel())return;let t=i.get($e),o=i.get(fe),n=i.get(Ne),r=e.getSelection().positionLineNumber,s=e.getContribution(S4.ID);if(!s)return;let l=await s.getModel();if(!l)return;let c=[];for(let h of l.lenses)h.symbol.command&&h.symbol.range.startLineNumber===r&&c.push({label:h.symbol.command.title,command:h.symbol.command});if(c.length===0)return;let u=await t.pick(c,{canPickMany:!1,placeHolder:d(1051,null)});if(!u)return;let p=u.command;if(l.isDisposed){let g=(await s.getModel())?.lenses.find(f=>f.symbol.range.startLineNumber===r&&f.symbol.command?.title===p.title);if(!g||!g.symbol.command)return;p=g.symbol.command}try{await o.executeCommand(p.id,...p.arguments||[])}catch(h){n.error(h)}}});var Xeo=[];function Qk(a){Xeo.push(a)}function Jeo(){return Xeo.slice(0)}var pEe=class{constructor(i,e,t,o){this.priority=i;this.range=e;this.initialMousePosX=t;this.initialMousePosY=o;this.type=1}equals(i){return i.type===1&&this.range.equalsRange(i.range)}canAdoptVisibleHover(i,e){return i.type===1&&e.lineNumber===this.range.startLineNumber}},I4=class{constructor(i,e,t,o,n,r){this.priority=i;this.owner=e;this.range=t;this.initialMousePosX=o;this.initialMousePosY=n;this.supportsMarkerHover=r;this.type=2}equals(i){return i.type===2&&this.owner===i.owner}canAdoptVisibleHover(i,e){return i.type===2&&this.owner===i.owner}},Yk=class{constructor(i,e){this.renderedHoverParts=i;this.disposables=e}dispose(){for(let i of this.renderedHoverParts)i.dispose();this.disposables?.dispose()}},PD=new class{constructor(){this._participants=[]}register(i){this._participants.push(i)}getAll(){return this._participants}};var y4=class{constructor(i){this._editorWorkerService=i}async provideDocumentColors(i,e){return this._editorWorkerService.computeDefaultDocumentColors(i.uri)}provideColorPresentations(i,e,t){let o=e.range,n=e.color,r=new Ue(new Ut(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),n.alpha)),s=Ue.Format.CSS.formatRGB(r),l=Ue.Format.CSS.formatHSL(r),c=Ue.Format.CSS.formatHexA(r,!0),u=[];return u.push({label:s,textEdit:{range:o,text:s}}),u.push({label:l,textEdit:{range:o,text:l}}),u.push({label:c,textEdit:{range:o,text:c}}),u}};y4=I([m(0,Qs)],y4);var mEe=class extends k{constructor(i,e){super(),this._register(i.colorProvider.register("*",new y4(e)))}};mEe=I([m(0,Jt),m(1,Qs)],mEe);async function bEt(a,i,e,t="auto"){return SEt(new Eui,a,i,e,t)}function Tui(a,i,e,t){return Promise.resolve(e.provideColorPresentations(a,i,t))}var Eui=class{constructor(){}async compute(i,e,t,o){let n=await i.provideDocumentColors(e,t);if(Array.isArray(n))for(let r of n)o.push({colorInfo:r,provider:i});return Array.isArray(n)}},fEt=class{constructor(){}async compute(i,e,t,o){let n=await i.provideDocumentColors(e,t);if(Array.isArray(n))for(let r of n)o.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(n)}},vEt=class{constructor(i){this.colorInfo=i}async compute(i,e,t,o){let n=await i.provideColorPresentations(e,this.colorInfo,Ie.None);return Array.isArray(n)&&o.push(...n),Array.isArray(n)}};async function SEt(a,i,e,t,o){let n=!1,r,s=[],l=i.ordered(e);for(let c=l.length-1;c>=0;c--){let u=l[c];if(o!=="always"&&u instanceof y4)r=u;else try{await a.compute(u,e,t,s)&&(n=!0)}catch(p){vs(p)}}return n?s:r&&o!=="never"?(await a.compute(r,e,t,s),s):[]}function _ui(a,i){let{colorProvider:e}=a.get(Jt),t=a.get(_t).getModel(i);if(!t)throw ls();let o=a.get(B).getValue("editor.defaultColorDecorators",{resource:i});return{model:t,colorProviderRegistry:e,defaultColorDecoratorsEnablement:o}}var Rui=Object.create({}),aC=class extends k{constructor(e,t,o,n){super();this._editor=e;this._configurationService=t;this._languageFeaturesService=o;this._localToDispose=this._register(new O);this._decorationsIds=[];this._colorDatas=new Map;this._decoratorLimitReporter=this._register(new Dui);this._colorDecorationClassRefs=this._register(new O);this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=this._register(new uX(this._editor)),this._debounceInformation=n.for(o.colorProvider,"Document Colors",{min:aC.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(o.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(r=>{let s=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167);let l=s!==this._isColorDecoratorsEnabled||r.hasChanged(27),c=r.hasChanged(167);(l||c)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167),this.updateColors()}static{this.ID="editor.contrib.colorDetector"}static{this.RECOMPUTE_TIME=1e3}isEnabled(){let e=this._editor.getModel();if(!e)return!1;let t=e.getLanguageId(),o=this._configurationService.getValue(t);if(o&&typeof o=="object"){let n=o.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(26)}get limitReporter(){return this._decoratorLimitReporter}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;let e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new Nl,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=Hn(async e=>{let t=this._editor.getModel();if(!t)return[];let o=new On(!1),n=await bEt(this._languageFeaturesService.colorProvider,t,e,this._defaultColorDecoratorsEnablement);return this._debounceInformation.update(t,o.elapsed()),n});try{let e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){mt(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){let t=e.map(o=>({range:{startLineNumber:o.colorInfo.range.startLineNumber,startColumn:o.colorInfo.range.startColumn,endLineNumber:o.colorInfo.range.endLineNumber,endColumn:o.colorInfo.range.endColumn},options:So.EMPTY}));this._editor.changeDecorations(o=>{this._decorationsIds=o.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,r)=>this._colorDatas.set(n,e[r]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();let t=[],o=this._editor.getOption(27);for(let r=0;r<e.length&&t.length<o;r++){let{red:s,green:l,blue:c,alpha:u}=e[r].colorInfo.color,p=new Ut(Math.round(s*255),Math.round(l*255),Math.round(c*255),u),h=`rgba(${p.r}, ${p.g}, ${p.b}, ${p.a})`,g=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:h}));t.push({range:{startLineNumber:e[r].colorInfo.range.startLineNumber,startColumn:e[r].colorInfo.range.startColumn,endLineNumber:e[r].colorInfo.range.endLineNumber,endColumn:e[r].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:oF,inlineClassName:`${g.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:Rui}}})}let n=o<e.length?o:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){let t=this._editor.getModel();if(!t)return null;let o=t.getDecorationsInRange(G.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return o.length===0?null:this._colorDatas.get(o[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};aC=I([m(1,B),m(2,Jt),m(3,Gf)],aC);var Dui=class extends k{constructor(){super(...arguments);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._computed=0;this._limited=!1}get computed(){return this._computed}get limited(){return this._limited}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}};var IEt="editor.action.showHover",Zeo="editor.action.showDefinitionPreviewHover",eto="editor.action.hideHover",tto="editor.action.scrollUpHover",ito="editor.action.scrollDownHover",oto="editor.action.scrollLeftHover",nto="editor.action.scrollRightHover",rto="editor.action.pageUpHover",sto="editor.action.pageDownHover",ato="editor.action.goToTopHover",lto="editor.action.goToBottomHover",KK="editor.action.increaseHoverVerbosityLevel",cto="editor.action.increaseHoverVerbosityLevelFromAccessibleView",dto=d(1278,null),GK="editor.action.decreaseHoverVerbosityLevel",uto="editor.action.decreaseHoverVerbosityLevelFromAccessibleView",pto=d(1277,null),XQe="editor.action.hideLongLineWarningHover";var qK="editor.action.inlineSuggest.commit",Zde="editor.action.inlineSuggest.commitAlternativeAction",yEt="editor.action.inlineSuggest.showPrevious",wEt="editor.action.inlineSuggest.showNext",CEt="editor.action.inlineSuggest.jump",xEt="editor.action.inlineSuggest.hide",JQe="editor.action.inlineSuggest.toggleShowCollapsed",Lui="editor.action.inlineSuggest.renameSymbol";var hEe=class extends k{constructor(e,t,o){super();this.editor=e;this.model=t;this.instantiationService=o;this.alwaysShowToolbar=vi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).showToolbar==="always"),this.sessionPosition=void 0,this.position=ke(this,n=>{let r=this.model.read(n)?.primaryGhostText.read(n);if(!this.alwaysShowToolbar.read(n)||!r||r.parts.length===0)return this.sessionPosition=void 0,null;let s=r.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==r.lineNumber&&(this.sessionPosition=void 0);let l=new ye(r.lineNumber,Math.min(s,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=l,l}),this._register(Rl((n,r)=>{let s=this.model.read(n);if(!s||!this.alwaysShowToolbar.read(n))return;let l=ke(u=>{let p=u.store.add(this.instantiationService.createInstance(dM.hot.read(u),this.editor,!0,this.position,s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands,s.warning,()=>{}));return e.addContentWidget(p),u.store.add(ee(()=>e.removeContentWidget(p))),u.store.add(ve(h=>{this.position.read(h)&&s.lastTriggerKind.read(h)!==1&&s.triggerExplicitly()})),p}),c=mv(this,(u,p)=>!!this.position.read(u)||!!p);r.add(ve(u=>{c.read(u)&&l.read(u)}))}))}};hEe=I([m(2,F)],hEe);var b4o=Oe("inline-suggestion-hints-next",L.chevronRight,d(1381,null)),S4o=Oe("inline-suggestion-hints-previous",L.chevronLeft,d(1382,null)),dM=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.editor=e;this.withBorder=t;this._position=o;this._currentSuggestionIdx=n;this._suggestionCount=r;this._extraCommands=s;this._warning=l;this._relayout=c;this._commandService=u;this.keybindingService=h;this._contextKeyService=g;this._menuService=f;this.id=`InlineSuggestionHintsContentWidget${dM.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._warningMessageContentNode=ke(v=>{let b=this._warning.read(v);return b?typeof b.message=="string"?b.message:v.store.add(Lg(b.message)).element:void 0}),this._warningMessageNode=$o.div({class:"warningMessage",style:{maxWidth:400,margin:4,marginBottom:4,display:ke(v=>this._warning.read(v)?"block":"none")}},[this._warningMessageContentNode]).keepUpdated(this._store),this.nodes=st("div.inlineSuggestionsHints",{className:this.withBorder?"monaco-hover monaco-hover-content":""},[this._warningMessageNode.element,st("div@toolBar")]),this.previousAction=this._register(this.createCommandAction(yEt,d(1383,null),q.asClassName(S4o))),this.availableSuggestionCountAction=this._register(new it("inlineSuggestionHints.availableSuggestionCount","",void 0,!1)),this.nextAction=this._register(this.createCommandAction(wEt,d(1380,null),q.asClassName(b4o))),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(R.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Dt(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new Dt(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this._register(ve(v=>{this._warningMessageContentNode.read(v),this._warningMessageNode.readEffect(v),this._relayout()})),this.toolBar=this._register(p.createInstance(ZQe,this.nodes.toolBar,R.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:v=>v.startsWith("primary")},actionViewItemProvider:(v,b)=>{if(v instanceof Do)return p.createInstance(Pui,v,void 0);if(v===this.availableSuggestionCountAction){let S=new Mui(void 0,v,{label:!0,icon:!1});return S.setClass("availableSuggestionCount"),S}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(v=>{dM._dropDownVisible=v})),this._register(ve(v=>{this._position.read(v),this.editor.layoutContentWidget(this)})),this._register(ve(v=>{let b=this._suggestionCount.read(v),S=this._currentSuggestionIdx.read(v);b!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${S+1}/${b}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),b!==void 0&&b>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(ve(v=>{let S=this._extraCommands.read(v).map(y=>({class:void 0,id:y.command.id,enabled:!0,tooltip:y.command.tooltip||"",label:y.command.title,run:w=>this._commandService.executeCommand(y.command.id)}));for(let[y,w]of this.inlineCompletionsActionsMenus.getActions())for(let x of w)x instanceof Do&&S.push(x);S.length>0&&S.unshift(new oi),this.toolBar.setAdditionalSecondaryActions(S)}))}static{this.hot=TK(this)}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(e,t,o){let n=new it(e,t,o,!0,()=>this._commandService.executeCommand(e));return n.tooltip=this.keybindingService.appendKeybinding(t,e,this._contextKeyService),n}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};dM=I([m(8,fe),m(9,F),m(10,Le),m(11,X),m(12,Yt)],dM);var Mui=class extends ts{constructor(){super(...arguments);this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}},Pui=class extends Cl{updateLabel(){let i=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService,!0);if(!i)return super.updateLabel();if(this.label){let e=st("div.keybinding").root;this._register(new ah(e,Ao,{disableTitle:!0,...HQe})).set(i),this.label.textContent=this._action.label,this.label.appendChild(e),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},ZQe=class extends dl{constructor(e,t,o,n,r,s,l,c,u){super(e,{resetMenu:t,...o},n,r,s,l,c,u);this.menuId=t;this.options2=o;this.menuService=n;this.contextKeyService=r;this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this.additionalPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){let{primary:e,secondary:t}=xl(this.menu.getActions(this.options2?.menuOptions),this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions);t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),e.push(...this.additionalPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){eo(this.prependedPrimaryActions,e,(t,o)=>t===o)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalPrimaryActions(e){eo(this.additionalPrimaryActions,e,(t,o)=>t===o)||(this.additionalPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){eo(this.additionalActions,e,(t,o)=>t===o)||(this.additionalActions=e,this.updateToolbar())}};ZQe=I([m(3,Yt),m(4,X),m(5,Xe),m(6,Le),m(7,fe),m(8,_e)],ZQe);var e6e={kind:0},I4o={kind:1};function y4o(a,i,e){return{kind:2,commandId:a,commandArgs:i,isBubble:e}}var gEe=class a{constructor(i,e,t){this._log=t,this._defaultKeybindings=i,this._defaultBoundCommands=new Map;for(let o of i){let n=o.command;n&&n.charAt(0)!=="-"&&this._defaultBoundCommands.set(n,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=a.handleRemovals([].concat(i).concat(e));for(let o=0,n=this._keybindings.length;o<n;o++){let r=this._keybindings[o];if(r.chords.length===0)continue;let s=r.when?.substituteConstants();s&&s.type===0||this._addKeyPress(r.chords[0],r)}}static _isTargetedForRemoval(i,e,t){if(e){for(let o=0;o<e.length;o++)if(e[o]!==i.chords[o])return!1}if(t&&t.type!==1){if(!i.when)return!1;let o=i.when.substituteConstants(),n=t.substituteConstants();if(!a.whenIsEntirelyIncluded(o,n))return!1}return!0}static handleRemovals(i){let e=new Map;for(let o=0,n=i.length;o<n;o++){let r=i[o];if(r.command&&r.command.charAt(0)==="-"){let s=r.command.substring(1);e.has(s)?e.get(s).push(r):e.set(s,[r])}}if(e.size===0)return i;let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];if(!r.command||r.command.length===0){t.push(r);continue}if(r.command.charAt(0)==="-")continue;let s=e.get(r.command);if(!s||!r.isDefault){t.push(r);continue}let l=!1;for(let c of s){let u=c.when;if(this._isTargetedForRemoval(r,c.chords,u)){l=!0;break}}if(!l){t.push(r);continue}}return t}_addKeyPress(i,e){let t=this._map.get(i);if(typeof t>"u"){this._map.set(i,[e]),this._addToLookupMap(e);return}for(let o=t.length-1;o>=0;o--){let n=t[o];if(n.command===e.command)continue;let r=!0;for(let s=1;s<n.chords.length&&s<e.chords.length;s++)if(n.chords[s]!==e.chords[s]){r=!1;break}r&&a.whenIsEntirelyIncluded(n.when,e.when)&&this._removeFromLookupMap(n)}t.push(e),this._addToLookupMap(e)}_addToLookupMap(i){if(!i.command)return;let e=this._lookupMap.get(i.command);typeof e>"u"?(e=[i],this._lookupMap.set(i.command,e)):e.push(i)}_removeFromLookupMap(i){if(!i.command)return;let e=this._lookupMap.get(i.command);if(!(typeof e>"u")){for(let t=0,o=e.length;t<o;t++)if(e[t]===i){e.splice(t,1);return}}}static whenIsEntirelyIncluded(i,e){return!e||e.type===1?!0:!i||i.type===1?!1:Xbt(i,e)}getDefaultBoundCommands(){return this._defaultBoundCommands}getDefaultKeybindings(){return this._defaultKeybindings}getKeybindings(){return this._keybindings}lookupKeybindings(i){let e=this._lookupMap.get(i);if(typeof e>"u"||e.length===0)return[];let t=[],o=0;for(let n=e.length-1;n>=0;n--)t[o++]=e[n];return t}lookupPrimaryKeybinding(i,e,t=!1){let o=this._lookupMap.get(i);if(typeof o>"u"||o.length===0)return null;if(o.length===1&&!t)return o[0];for(let n=o.length-1;n>=0;n--){let r=o[n];if(e.contextMatchesRules(r.when))return r}return t?null:o[o.length-1]}resolve(i,e,t){let o=[...e,t];this._log(`| Resolving ${o}`);let n=this._map.get(o[0]);if(n===void 0)return this._log("\\ No keybinding entries."),e6e;let r=null;if(o.length<2)r=n;else{r=[];for(let l=0,c=n.length;l<c;l++){let u=n[l];if(o.length>u.chords.length)continue;let p=!0;for(let h=1;h<o.length;h++)if(u.chords[h]!==o[h]){p=!1;break}p&&r.push(u)}}let s=this._findCommand(i,r);return s?o.length<s.chords.length?(this._log(`\\ From ${r.length} keybinding entries, awaiting ${s.chords.length-o.length} more chord(s), when: ${mto(s.when)}, source: ${hto(s)}.`),I4o):(this._log(`\\ From ${r.length} keybinding entries, matched ${s.command}, when: ${mto(s.when)}, source: ${hto(s)}.`),y4o(s.command,s.commandArgs,s.bubble)):(this._log(`\\ From ${r.length} keybinding entries, no when clauses matched the context.`),e6e)}_findCommand(i,e){for(let t=e.length-1;t>=0;t--){let o=e[t];if(a._contextMatchesRules(i,o.when))return o}return null}static _contextMatchesRules(i,e){return e?e.evaluate(i):!0}};function mto(a){return a?`${a.serialize()}`:"no when condition"}function hto(a){return a.extensionId?a.isBuiltinExtension?`built-in extension ${a.extensionId}`:`user extension ${a.extensionId}`:a.isDefault?"built-in":"user"}function hJ(a,i,e){let t=ur(a);return!(i<t.left+3||i>t.left+t.width-3||e<t.top+3||e>t.top+t.height-3)}function EEt(a,i,e){return a==="on"?!0:a==="off"?!1:t6e(i,e.event)}function t6e(a,i){return a==="altKey"?i.ctrlKey||i.metaKey:i.altKey}var Aui=class{constructor(i,e,t,o){this.value=i;this.isComplete=e;this.hasLoadingMessage=t;this.options=o}},fEe=class extends k{constructor(e,t){super();this._editor=e;this._computer=t;this._onResult=this._register(new T);this.onResult=this._onResult.event;this._asyncComputationScheduler=this._register(new i6e(e=>this._triggerAsyncComputation(e),0));this._syncComputationScheduler=this._register(new i6e(e=>this._triggerSyncComputation(e),0));this._loadingMessageScheduler=this._register(new i6e(e=>this._triggerLoadingMessage(e),0));this._state=0;this._asyncIterable=null;this._asyncIterableDone=!1;this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._options=void 0,super.dispose()}get _hoverTime(){return this._editor.getOption(69).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t){this._options=t,this._state=e,this._fireResult(t)}_triggerAsyncComputation(e){this._setState(2,e),this._syncComputationScheduler.schedule(e,this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=f8i(t=>this._computer.computeAsync(e,t)),(async()=>{try{for await(let t of this._asyncIterable)t&&(this._result.push(t),this._fireResult(e));this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0,e)}catch(t){mt(t)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(e){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync(e))),this._setState(this._asyncIterableDone?0:3,e)}_triggerLoadingMessage(e){this._state===3&&this._setState(4,e)}_fireResult(e){if(this._state===1||this._state===2)return;let t=this._state===0,o=this._state===4;this._onResult.fire(new Aui(this._result.slice(0),t,o,e))}start(e,t){if(e===0)this._state===0&&(this._setState(1,t),this._asyncComputationScheduler.schedule(t,this._firstWaitTime),this._loadingMessageScheduler.schedule(t,this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(t),this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break;case 2:this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break}}cancel(){this._asyncComputationScheduler.cancel(),this._syncComputationScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._options=void 0,this._state=0}get options(){return this._options}},i6e=class extends k{constructor(i,e){super(),this._scheduler=this._register(new Dt(()=>i(this._options),e))}schedule(i,e){this._options=i,this._scheduler.schedule(e)}cancel(){this._scheduler.cancel()}};var uM=class{constructor(){this._onDidWillResize=new T;this._onDidResize=new T;this._sashListener=new O;this._size=new di(0,0);this._minSize=new di(0,0);this._maxSize=new di(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);this.domNode=document.createElement("div"),this._eastSash=new kh(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new kh(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new kh(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:"north"}),this._southSash=new kh(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:"south"}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let i,e=0,t=0;this._sashListener.add(U.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{i===void 0&&(this._onDidWillResize.fire(),i=this._size,e=0,t=0)})),this._sashListener.add(U.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{i!==void 0&&(i=void 0,e=0,t=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(o=>{i&&(t=o.currentX-o.startX,this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(o=>{i&&(t=-(o.currentX-o.startX),this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(o=>{i&&(e=-(o.currentY-o.startY),this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(o=>{i&&(e=o.currentY-o.startY,this.layout(i.height+e,i.width+t),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(U.any(this._eastSash.onDidReset,this._westSash.onDidReset)(o=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(U.any(this._northSash.onDidReset,this._southSash.onDidReset)(o=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}get onDidWillResize(){return this._onDidWillResize.event}get onDidResize(){return this._onDidResize.event}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(i,e,t,o){this._northSash.state=i?3:0,this._eastSash.state=e?3:0,this._southSash.state=t?3:0,this._westSash.state=o?3:0}layout(i=this.size.height,e=this.size.width){let{height:t,width:o}=this._minSize,{height:n,width:r}=this._maxSize;i=Math.max(t,Math.min(n,i)),e=Math.max(o,Math.min(r,e));let s=new di(e,i);di.equals(s,this._size)||(this.domNode.style.height=i+"px",this.domNode.style.width=e+"px",this._size=s,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(i){this._maxSize=i}get maxSize(){return this._maxSize}set minSize(i){this._minSize=i}get minSize(){return this._minSize}set preferredSize(i){this._preferredSize=i}get preferredSize(){return this._preferredSize}};var w4o=30,C4o=24,TEt=class extends k{constructor(e,t=new di(10,10)){super();this._editor=e;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._resizableNode=this._register(new uM);this._contentPosition=null;this._isResizing=!1;this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=di.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(o=>{this._resize(new di(o.dimension.width,o.dimension.height)),o.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){return this._contentPosition?.position?ye.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){let t=this._editor.getDomNode(),o=this._editor.getScrolledVisiblePosition(e);return!t||!o?void 0:ur(t).top+o.top-w4o}_availableVerticalSpaceBelow(e){let t=this._editor.getDomNode(),o=this._editor.getScrolledVisiblePosition(e);if(!t||!o)return;let n=ur(t),r=wh(t.ownerDocument.body),s=n.top+o.top+o.height;return r.height-s-C4o}_findPositionPreference(e,t){let o=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),n=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),r=Math.min(Math.max(n,o),e),s=Math.min(e,r),l;return this._editor.getOption(69).above?l=s<=n?1:2:l=s<=o?2:1,l===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),l}_resize(e){this._resizableNode.layout(e.height,e.width)}};var gto=30,Xk=class extends TEt{constructor(e,t,o,n,r){let s=e.getOption(75)+8,l=150,c=new di(l,s);super(e,c);this._configurationService=o;this._accessibilityService=n;this._keybindingService=r;this._hover=this._register(new XX(!0));this._onDidResize=this._register(new T);this.onDidResize=this._onDidResize.event;this._onDidScroll=this._register(new T);this.onDidScroll=this._onDidScroll.event;this._onContentsChanged=this._register(new T);this.onContentsChanged=this._onContentsChanged.event;this._minimumSize=c,this._hoverVisibleKey=me.hoverVisible.bindTo(t),this._hoverFocusedKey=me.hoverFocused.bindTo(t),D(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._resizableNode.domNode.className="monaco-resizable-hover",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(p=>{p.hasChanged(59)&&this._updateFont()}));let u=this._register(nr(this._resizableNode.domNode));this._register(u.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(u.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._register(this._hover.scrollbar.onScroll(p=>{this._onDidScroll.fire(p)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}static{this.ID="editor.contrib.resizableContentHoverWidget"}static{this._lastDimensions=new di(0,0)}get isVisibleFromKeyboard(){return this._renderedHover?.source===2}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return Xk.ID}static _applyDimensions(e,t,o){let n=typeof t=="number"?`${t}px`:t,r=typeof o=="number"?`${o}px`:o;e.style.width=n,e.style.height=r}_setContentsDomNodeDimensions(e,t){let o=this._hover.contentsDomNode;return Xk._applyDimensions(o,e,t)}_setContainerDomNodeDimensions(e,t){let o=this._hover.containerDomNode;return Xk._applyDimensions(o,e,t)}_setScrollableElementDimensions(e,t){let o=this._hover.scrollbar.getDomNode();return Xk._applyDimensions(o,e,t)}_setHoverWidgetDimensions(e,t){this._setContainerDomNodeDimensions(e,t),this._setScrollableElementDimensions(e,t),this._setContentsDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,o){let n=typeof t=="number"?`${t}px`:t,r=typeof o=="number"?`${o}px`:o;e.style.maxWidth=n,e.style.maxHeight=r}_setHoverWidgetMaxDimensions(e,t){Xk._applyMaxDimensions(this._hover.contentsDomNode,e,t),Xk._applyMaxDimensions(this._hover.scrollbar.getDomNode(),e,t),Xk._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none"),this._setHoverWidgetDimensions(e.width,e.height)}_updateResizableNodeMaxDimensions(){let e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new di(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){Xk._lastDimensions=new di(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){let e=this._renderedHover?.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){let e=this._findAvailableSpaceVertically();if(!e)return;let o=this._hover.contentsDomNode.children.length-1;return Array.from(this._hover.contentsDomNode.children).forEach(n=>{o+=n.clientHeight}),Math.min(e,o)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");let e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;let e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth;return e||this._hover.containerDomNode.clientWidth<t?wh(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth}isMouseGettingCloser(e,t){if(!this._renderedHover)return!1;if(this._renderedHover.initialMousePosX===void 0||this._renderedHover.initialMousePosY===void 0)return this._renderedHover.initialMousePosX=e,this._renderedHover.initialMousePosY=t,!1;let o=ur(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=fto(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,o.left,o.top,o.width,o.height));let n=fto(e,t,o.left,o.top,o.width,o.height);return n>this._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,n),!0)}_setRenderedHover(e){this._renderedHover?.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){let{fontSize:e,lineHeight:t}=this._editor.getOption(59),o=this._hover.contentsDomNode;o.style.fontSize=`${e}px`,o.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(r=>this._editor.applyFontInfo(r))}_updateContent(e){let t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){let e=Math.max(this._editor.getLayoutInfo().height/4,250,Xk._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,750,Xk._lastDimensions.width);this._resizableNode.maxSize=new di(t,e),this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this.handleContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){if(!this._editor||!this._editor.hasModel())return;this._render(e);let t=Uh(this._hover.containerDomNode),o=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,o)??1,this.handleContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();let r=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&Skt(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel()??"");r&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+r)}hide(){if(!this._renderedHover)return;let e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new di(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){let e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto"),this._updateMaxDimensions()}setMinimumDimensions(e){this._minimumSize=new di(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){let e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new di(e,this._minimumSize.height)}handleContentsChanged(){this._removeConstraintsRenderNormally();let e=this._hover.contentsDomNode,t=Uh(e),o=Dc(e)+2;if(this._resizableNode.layout(t,o),this._setHoverWidgetDimensions(o,t),t=Uh(e),o=Dc(e),this._contentWidth=o,this._updateMinimumWidth(),this._resizableNode.layout(t,o),this._renderedHover?.showAtPosition){let n=Uh(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(n,this._renderedHover.showAtPosition)}this._layoutContentWidget(),this._onContentsChanged.fire()}focus(){this._hover.containerDomNode.focus()}scrollUp(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-gto})}scrollRight(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+gto})}pageUp(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};Xk=I([m(1,X),m(2,B),m(3,Ai),m(4,Le)],Xk);function fto(a,i,e,t,o,n){let r=e+o/2,s=t+n/2,l=Math.max(Math.abs(a-r)-o/2,0),c=Math.max(Math.abs(i-s)-n/2,0);return Math.sqrt(l*l+c*c)}var _Et=class a{constructor(i,e){this._editor=i;this._participants=e}static _getLineDecorations(i,e){if(e.type!==1&&!e.supportsMarkerHover)return[];let t=i.getModel(),o=e.range.startLineNumber;if(o>t.getLineCount())return[];let n=t.getLineMaxColumn(o);return i.getLineDecorations(o).filter(r=>{if(r.options.isWholeLine)return!0;let s=r.range.startLineNumber===o?r.range.startColumn:1,l=r.range.endLineNumber===o?r.range.endColumn:n;if(r.options.showIfCollapsed){if(s>e.range.startColumn+1||e.range.endColumn-1>l)return!1}else if(s>e.range.startColumn||e.range.endColumn>l)return!1;return!0})}computeAsync(i,e){let t=i.anchor;if(!this._editor.hasModel()||!t)return Fp.EMPTY;let o=a._getLineDecorations(this._editor,t);return Fp.merge(this._participants.map(n=>n.computeAsync?n.computeAsync(t,o,i.source,e):Fp.EMPTY))}computeSync(i){if(!this._editor.hasModel())return[];let e=i.anchor,t=a._getLineDecorations(this._editor,e),o=[];for(let n of this._participants)o=o.concat(n.computeSync(e,t,i.source));return ui(o)}};var n6e=class{constructor(i,e,t){this.hoverParts=i;this.isComplete=e;this.options=t}filter(i){let e=this.hoverParts.filter(t=>t.isValidForHoverAnchor(i));return e.length===this.hoverParts.length?this:new Nui(this,e,this.isComplete,this.options)}},Nui=class extends n6e{constructor(e,t,o,n){super(t,o,n);this.original=e}filter(e){return this.original.filter(e)}};var vto=_,gJ=class extends k{constructor(e,t){super();this._keybindingService=e;this._hoverService=t;this.actions=[];this._hasContent=!1;this.hoverElement=vto("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=D(this.hoverElement,vto("div.actions"))}get hasContent(){return this._hasContent}addAction(e){let t=this._keybindingService.lookupKeybinding(e.commandId),o=t?t.getLabel():null;this._hasContent=!0;let n=this._register(JX.render(this.actionsElement,e,o));return this._register(this._hoverService.setupManagedHover(yi("element"),n.actionContainer,n.actionRenderedLabel)),this.actions.push(n),n}append(e){let t=D(this.actionsElement,e);return this._hasContent=!0,t}};gJ=I([m(0,Le),m(1,ot)],gJ);function bEe(a){let i=a;return typeof i=="object"&&"markdown"in i&&"markdownNotSupportedFallback"in i}function bto(a){let i=a;return typeof i=="object"&&"element"in i}var fJ={inputActiveOptionBorder:"#007ACC00",inputActiveOptionForeground:"#FFFFFF",inputActiveOptionBackground:"#0E639C50"},eue=class extends Ja{constructor(i,e,t){super(i,e,t);let o=this.options.keybinding?`${this._action.label} (${this.options.keybinding})`:this._action.label;this.toggle=this._register(new Lm({actionClassName:this._action.class,isChecked:!!this._action.checked,title:o,notFocusable:!0,inputActiveOptionBackground:t.toggleStyles?.inputActiveOptionBackground,inputActiveOptionBorder:t.toggleStyles?.inputActiveOptionBorder,inputActiveOptionForeground:t.toggleStyles?.inputActiveOptionForeground})),this._register(this.toggle.onChange(()=>{this._action.checked=!!this.toggle&&this.toggle.checked}))}render(i){this.element=i,this.element.appendChild(this.toggle.domNode),this.updateChecked(),this.updateEnabled()}updateEnabled(){this.toggle&&(this.isEnabled()?(this.toggle.enable(),this.element?.classList.remove("disabled")):(this.toggle.disable(),this.element?.classList.add("disabled")))}updateChecked(){this.toggle.checked=!!this._action.checked}updateLabel(){let i=this.options.keybinding?`${this._action.label} (${this.options.keybinding})`:this._action.label;this.toggle.setTitle(i)}focus(){this.toggle.domNode.tabIndex=0,this.toggle.focus()}blur(){this.toggle.domNode.tabIndex=-1,this.toggle.domNode.blur()}setFocusable(i){this.toggle.domNode.tabIndex=i?0:-1}},Lm=class extends ll{constructor(e){super();this._onChange=this._register(new T);this._onKeyDown=this._register(new T);this._opts=e,this._title=this._opts.title,this._checked=this._opts.isChecked;let t=["monaco-custom-toggle"];this._opts.icon&&(this._icon=this._opts.icon,t.push(...q.asClassNameArray(this._icon))),this._opts.actionClassName&&t.push(...this._opts.actionClassName.split(" ")),this._checked&&t.push("checked"),this.domNode=document.createElement("div"),this._register(sp().setupDelayedHover(this.domNode,()=>({content:!yr(this._title)&&!go(this._title)?Du(this._title):this._title,style:1}),this._opts.hoverLifecycleOptions)),this.domNode.classList.add(...t),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.setTitle(this._opts.title),this.applyStyles(),this.onclick(this.domNode,o=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),o.preventDefault(),o.stopPropagation())}),this._register(this.ignoreGesture(this.domNode)),this.onkeydown(this.domNode,o=>{if(this.enabled){if(o.keyCode===10||o.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),o.preventDefault(),o.stopPropagation();return}this._onKeyDown.fire(o)}})}get onChange(){return this._onChange.event}get onKeyDown(){return this._onKeyDown.event}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}setIcon(e){this._icon&&this.domNode.classList.remove(...q.asClassNameArray(this._icon)),this._icon=e,this._icon&&this.domNode.classList.add(...q.asClassNameArray(this._icon))}width(){return 22}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder||"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground||"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground||"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1)),this.domNode.classList.remove("disabled")}disable(){this.domNode.setAttribute("aria-disabled",String(!0)),this.domNode.classList.add("disabled")}setTitle(e){this._title=e;let t=typeof e=="string"?e:yr(e)?e.value:e.textContent;this.domNode.setAttribute("aria-label",AK(t))}set visible(e){this.domNode.style.display=e?"":"none"}get visible(){return this.domNode.style.display!=="none"}},r6e=class extends ll{constructor(e,t,o){super();this.checkbox=e;this.domNode=t;this.styles=o;this._onChange=this._register(new T);this.onChange=this._onChange.event;this.applyStyles()}static{this.CLASS_NAME="monaco-checkbox"}get enabled(){return this.checkbox.enabled}focus(){this.domNode.focus()}hasFocus(){return Na(this.domNode)}enable(){this.checkbox.enable(),this.applyStyles(!0)}disable(){this.checkbox.disable(),this.applyStyles(!1)}setTitle(e){this.checkbox.setTitle(e)}applyStyles(e=this.enabled){this.domNode.style.color=(e?this.styles.checkboxForeground:this.styles.checkboxDisabledForeground)||"",this.domNode.style.backgroundColor=(e?this.styles.checkboxBackground:this.styles.checkboxDisabledBackground)||"",this.domNode.style.borderColor=(e?this.styles.checkboxBorder:this.styles.checkboxDisabledBackground)||"";let t=this.styles.size||18;this.domNode.style.width=this.domNode.style.height=this.domNode.style.fontSize=`${t}px`,this.domNode.style.fontSize=`${t-2}px`}},qf=class extends r6e{constructor(i,e,t){let o=new Lm({title:i,isChecked:e,icon:L.check,actionClassName:r6e.CLASS_NAME,hoverLifecycleOptions:t.hoverLifecycleOptions,...fJ});super(o,o.domNode,t),this._register(o),this._register(this.checkbox.onChange(n=>{this.applyStyles(),this._onChange.fire(n)}))}get checked(){return this.checkbox.checked}set checked(i){this.checkbox.checked=i,this.applyStyles()}applyStyles(i){this.checkbox.checked?this.checkbox.setIcon(L.check):this.checkbox.setIcon(void 0),super.applyStyles(i)}},$K=class extends r6e{constructor(e,t,o){let n;switch(t){case!0:n=L.check;break;case"mixed":n=L.dash;break;case!1:n=void 0;break}let r=new Lm({title:e,isChecked:t===!0,icon:n,actionClassName:qf.CLASS_NAME,hoverLifecycleOptions:o.hoverLifecycleOptions,...fJ});super(r,r.domNode,o);this._state=t;this._register(r),this._register(this.checkbox.onChange(s=>{this._state=this.checkbox.checked,this.applyStyles(),this._onChange.fire(s)}))}get checked(){return this._state}set checked(e){this._state!==e&&(this._state=e,this.checkbox.checked=e===!0,this.applyStyles())}applyStyles(e){switch(this._state){case!0:this.checkbox.setIcon(L.check);break;case"mixed":this.checkbox.setIcon(L.dash);break;case!1:this.checkbox.setIcon(void 0);break}super.applyStyles(e)}},DEt=class extends Ja{constructor(i,e,t){super(i,e,t),this.toggle=this._register(new qf(this._action.label,!!this._action.checked,t.checkboxStyles)),this._register(this.toggle.onChange(()=>this.onChange()))}render(i){if(this.element=i,this.element.classList.add("checkbox-action-item"),this.element.appendChild(this.toggle.domNode),this.options.label&&this._action.label){let e=this.element.appendChild(_("span.checkbox-label",void 0,this._action.label));this._register($(e,ne.CLICK,t=>{this.toggle.checked=!this.toggle.checked,t.stopPropagation(),t.preventDefault(),this.onChange()}))}this.updateEnabled(),this.updateClass(),this.updateChecked()}onChange(){this._action.checked=!!this.toggle&&this.toggle.checked,this.actionRunner.run(this._action,this._context)}updateEnabled(){this.isEnabled()?this.toggle.enable():this.toggle.disable(),this.action.enabled?this.element?.classList.remove("disabled"):this.element?.classList.add("disabled")}updateChecked(){this.toggle.checked=!!this._action.checked}updateClass(){this.cssClass&&this.toggle.domNode.classList.remove(...this.cssClass.split(" ")),this.cssClass=this.getClass(),this.cssClass&&this.toggle.domNode.classList.add(...this.cssClass.split(" "))}focus(){this.toggle.domNode.tabIndex=0,this.toggle.focus()}blur(){this.toggle.domNode.tabIndex=-1,this.toggle.domNode.blur()}setFocusable(i){this.toggle.domNode.tabIndex=i?0:-1}};function jK(a){return(i,e)=>{if(i.checked!==void 0)return new eue(null,i,{...e,toggleStyles:a})}}var w4=class a{constructor(i){this._editor=i,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){let i=this._findScopeDecorationIds.map(e=>this._editor.getModel().getDecorationRange(e)).filter(e=>!!e);if(i.length)return i}return null}getStartPosition(){return this._startPosition}setStartPosition(i){this._startPosition=i,this.setCurrentFindMatch(null)}_getDecorationIndex(i){let e=this._decorations.indexOf(i);return e>=0?e+1:1}getDecorationRangeAt(i){let e=i<this._decorations.length?this._decorations[i]:null;return e?this._editor.getModel().getDecorationRange(e):null}getCurrentMatchesPosition(i){let e=this._editor.getModel().getDecorationsInRange(i);for(let t of e){let o=t.options;if(o===a._FIND_MATCH_DECORATION||o===a._FIND_MATCH_NO_OVERVIEW_DECORATION||o===a._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(t.id)}return 0}setCurrentFindMatch(i){let e=null,t=0;if(i)for(let o=0,n=this._decorations.length;o<n;o++){let r=this._editor.getModel().getDecorationRange(this._decorations[o]);if(i.equalsRange(r)){e=this._decorations[o],t=o+1;break}}return(this._highlightedDecorationId!==null||e!==null)&&this._editor.changeDecorations(o=>{if(this._highlightedDecorationId!==null&&(o.changeDecorationOptions(this._highlightedDecorationId,a._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),e!==null&&(this._highlightedDecorationId=e,o.changeDecorationOptions(this._highlightedDecorationId,a._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(o.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),e!==null){let n=this._editor.getModel().getDecorationRange(e);if(n.startLineNumber!==n.endLineNumber&&n.endColumn===1){let r=n.endLineNumber-1,s=this._editor.getModel().getLineMaxColumn(r);n=new G(n.startLineNumber,n.startColumn,r,s)}this._rangeHighlightDecorationId=o.addDecoration(n,a._RANGE_HIGHLIGHT_DECORATION)}}),t}set(i,e){this._editor.changeDecorations(t=>{let o=a._FIND_MATCH_DECORATION,n=[];if(i.length>1e3){o=a._FIND_MATCH_NO_OVERVIEW_DECORATION;let s=this._editor.getModel().getLineCount(),c=this._editor.getLayoutInfo().height/s,u=Math.max(2,Math.ceil(3/c)),p=i[0].range.startLineNumber,h=i[0].range.endLineNumber;for(let g=1,f=i.length;g<f;g++){let v=i[g].range;h+u>=v.startLineNumber?v.endLineNumber>h&&(h=v.endLineNumber):(n.push({range:new G(p,1,h,1),options:a._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),p=v.startLineNumber,h=v.endLineNumber)}n.push({range:new G(p,1,h,1),options:a._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}let r=new Array(i.length);for(let s=0,l=i.length;s<l;s++)r[s]={range:i[s].range,options:o};this._decorations=t.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=t.deltaDecorations(this._overviewRulerApproximateDecorations,n),this._rangeHighlightDecorationId&&(t.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(s=>t.removeDecoration(s)),this._findScopeDecorationIds=[]),e?.length&&(this._findScopeDecorationIds=e.map(s=>t.addDecoration(s,a._FIND_SCOPE_DECORATION)))})}matchBeforePosition(i){if(this._decorations.length===0)return null;for(let e=this._decorations.length-1;e>=0;e--){let t=this._decorations[e],o=this._editor.getModel().getDecorationRange(t);if(!(!o||o.endLineNumber>i.lineNumber)){if(o.endLineNumber<i.lineNumber)return o;if(!(o.endColumn>i.column))return o}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(i){if(this._decorations.length===0)return null;for(let e=0,t=this._decorations.length;e<t;e++){let o=this._decorations[e],n=this._editor.getModel().getDecorationRange(o);if(!(!n||n.startLineNumber<i.lineNumber)){if(n.startLineNumber>i.lineNumber)return n;if(!(n.startColumn<i.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let i=[];return i=i.concat(this._decorations),i=i.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&i.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&i.push(this._rangeHighlightDecorationId),i}static{this._CURRENT_FIND_MATCH_DECORATION=So.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:_s(DF),position:2},minimap:{color:_s(sX),position:1}})}static{this._FIND_MATCH_DECORATION=So.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:_s(DF),position:2},minimap:{color:_s(sX),position:1}})}static{this._FIND_MATCH_NO_OVERVIEW_DECORATION=So.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0})}static{this._FIND_MATCH_ONLY_OVERVIEW_DECORATION=So.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:_s(DF),position:2}})}static{this._RANGE_HIGHLIGHT_DECORATION=So.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._FIND_SCOPE_DECORATION=So.register({description:"find-scope",className:"findScope",isWholeLine:!0})}};var REt=class{constructor(i,e,t){this._editorSelection=i,this._ranges=e,this._replaceStrings=t,this._trackedEditorSelectionId=null}getEditOperations(i,e){if(this._ranges.length>0){let t=[];for(let r=0;r<this._ranges.length;r++)t.push({range:this._ranges[r],text:this._replaceStrings[r]});t.sort((r,s)=>G.compareRangesUsingStarts(r.range,s.range));let o=[],n=t[0];for(let r=1;r<t.length;r++)n.range.endLineNumber===t[r].range.startLineNumber&&n.range.endColumn===t[r].range.startColumn?(n.range=n.range.plusRange(t[r].range),n.text=n.text+t[r].text):(o.push(n),n=t[r]);o.push(n);for(let r of o)e.addEditOperation(r.range,r.text)}this._trackedEditorSelectionId=e.trackSelection(this._editorSelection)}computeCursorState(i,e){return e.getTrackedSelection(this._trackedEditorSelectionId)}};function s6e(a,i){if(a&&a[0]!==""){let e=Sto(a,i,"-"),t=Sto(a,i,"_");return e&&!t?Ito(a,i,"-"):!e&&t?Ito(a,i,"_"):a[0].toUpperCase()===a[0]?i.toUpperCase():a[0].toLowerCase()===a[0]?i.toLowerCase():u4e(a[0][0])&&i.length>0?i[0].toUpperCase()+i.substr(1):a[0][0].toUpperCase()!==a[0][0]&&i.length>0?i[0].toLowerCase()+i.substr(1):i}else return i}function Sto(a,i,e){return a[0].indexOf(e)!==-1&&i.indexOf(e)!==-1&&a[0].split(e).length===i.split(e).length}function Ito(a,i,e){let t=i.split(e),o=a[0].split(e),n="";return t.forEach((r,s)=>{n+=s6e([o[s]],r)+e}),n.slice(0,-1)}var LEt=class{constructor(i){this.staticValue=i;this.kind=0}},Oui=class{constructor(i){this.pieces=i;this.kind=1}},vJ=class a{static fromStaticValue(i){return new a([SEe.staticValue(i)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(i){!i||i.length===0?this._state=new LEt(""):i.length===1&&i[0].staticValue!==null?this._state=new LEt(i[0].staticValue):this._state=new Oui(i)}buildReplaceString(i,e){if(this._state.kind===0)return e?s6e(i,this._state.staticValue):this._state.staticValue;let t="";for(let o=0,n=this._state.pieces.length;o<n;o++){let r=this._state.pieces[o];if(r.staticValue!==null){t+=r.staticValue;continue}let s=a._substitute(r.matchIndex,i);if(r.caseOps!==null&&r.caseOps.length>0){let l=[],c=r.caseOps.length,u=0;for(let p=0,h=s.length;p<h;p++){if(u>=c){l.push(s.slice(p));break}switch(r.caseOps[u]){case"U":l.push(s[p].toUpperCase());break;case"u":l.push(s[p].toUpperCase()),u++;break;case"L":l.push(s[p].toLowerCase());break;case"l":l.push(s[p].toLowerCase()),u++;break;default:l.push(s[p])}}s=l.join("")}t+=s}return t}static _substitute(i,e){if(e===null)return"";if(i===0)return e[0];let t="";for(;i>0;){if(i<e.length)return(e[i]||"")+t;t=String(i%10)+t,i=Math.floor(i/10)}return"$"+t}},SEe=class a{static staticValue(i){return new a(i,-1,null)}static matchIndex(i){return new a(null,i,null)}static caseOps(i,e){return new a(null,i,e)}constructor(i,e,t){this.staticValue=i,this.matchIndex=e,!t||t.length===0?this.caseOps=null:this.caseOps=t.slice(0)}},Fui=class{constructor(i){this._source=i,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(i){this._emitStatic(this._source.substring(this._lastCharIndex,i)),this._lastCharIndex=i}emitStatic(i,e){this._emitStatic(i),this._lastCharIndex=e}_emitStatic(i){i.length!==0&&(this._currentStaticPiece+=i)}emitMatchIndex(i,e,t){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=SEe.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=SEe.caseOps(i,t),this._lastCharIndex=e}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=SEe.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new vJ(this._result)}};function MEt(a){if(!a||a.length===0)return new vJ(null);let i=[],e=new Fui(a);for(let t=0,o=a.length;t<o;t++){let n=a.charCodeAt(t);if(n===92){if(t++,t>=o)break;let r=a.charCodeAt(t);switch(r){case 92:e.emitUnchanged(t-1),e.emitStatic("\\",t+1);break;case 110:e.emitUnchanged(t-1),e.emitStatic(`
`,t+1);break;case 116:e.emitUnchanged(t-1),e.emitStatic("	",t+1);break;case 117:case 85:case 108:case 76:e.emitUnchanged(t-1),e.emitStatic("",t+1),i.push(String.fromCharCode(r));break}continue}if(n===36){if(t++,t>=o)break;let r=a.charCodeAt(t);if(r===36){e.emitUnchanged(t-1),e.emitStatic("$",t+1);continue}if(r===48||r===38){e.emitUnchanged(t-1),e.emitMatchIndex(0,t+1,i),i.length=0;continue}if(49<=r&&r<=57){let s=r-48;if(t+1<o){let l=a.charCodeAt(t+1);if(48<=l&&l<=57){t++,s=s*10+(l-48),e.emitUnchanged(t-2),e.emitMatchIndex(s,t+1,i),i.length=0;continue}}e.emitUnchanged(t-1),e.emitMatchIndex(s,t+1,i),i.length=0;continue}}}return e.finalize()}var HT=new Y("findWidgetVisible",!1),yto=HT.toNegated(),IEe=new Y("findInputFocussed",!1),a6e=new Y("replaceInputFocussed",!1),AEt=new Y("findWidgetFocused",!1),C4={primary:545,mac:{primary:2593}},x4={primary:565,mac:{primary:2613}},k4={primary:560,mac:{primary:2608}},l6e={primary:554,mac:{primary:2602}},tue={primary:558,mac:{primary:2606}},zd={StartFindAction:"actions.find",StartFindWithSelection:"actions.findWithSelection",StartFindWithArgs:"editor.actions.findWithArgs",NextMatchFindAction:"editor.action.nextMatchFindAction",PreviousMatchFindAction:"editor.action.previousMatchFindAction",GoToMatchFindAction:"editor.action.goToMatchFindAction",NextSelectionMatchFindAction:"editor.action.nextSelectionMatchFindAction",PreviousSelectionMatchFindAction:"editor.action.previousSelectionMatchFindAction",StartFindReplaceAction:"editor.action.startFindReplaceAction",CloseFindWidgetCommand:"closeFindWidget",ToggleCaseSensitiveCommand:"toggleFindCaseSensitive",ToggleWholeWordCommand:"toggleFindWholeWord",ToggleRegexCommand:"toggleFindRegex",ToggleSearchScopeCommand:"toggleFindInSelection",TogglePreserveCaseCommand:"togglePreserveCase",ReplaceOneAction:"editor.action.replaceOne",ReplaceAllAction:"editor.action.replaceAll",SelectAllMatchesAction:"editor.action.selectAllMatches"},t0=19999,x4o=240,PEt=class a{constructor(i,e){this._toDispose=new O;this._editor=i,this._state=e,this._isDisposed=!1,this._startSearchingTimer=new Nl,this._decorations=new w4(i),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Dt(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(t=>{(t.reason===3||t.reason===5||t.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(t=>{this._ignoreModelContentChanged||(t.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(t=>this._onStateChanged(t))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,je(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(i){this._isDisposed||this._editor.hasModel()&&(i.searchString||i.isReplaceRevealed||i.isRegex||i.wholeWord||i.matchCase||i.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{i.searchScope?this.research(i.moveCursor,this._state.searchScope):this.research(i.moveCursor)},x4o)):i.searchScope?this.research(i.moveCursor,this._state.searchScope):this.research(i.moveCursor))}static _getSearchRange(i,e){return e||i.getFullModelRange()}research(i,e){let t=null;typeof e<"u"?e!==null&&(Array.isArray(e)?t=e:t=[e]):t=this._decorations.getFindScopes(),t!==null&&(t=t.map(s=>{if(s.startLineNumber!==s.endLineNumber){let l=s.endLineNumber;return s.endColumn===1&&(l=l-1),new G(s.startLineNumber,1,l,this._editor.getModel().getLineMaxColumn(l))}return s}));let o=this._findMatches(t,!1,t0);this._decorations.set(o,t);let n=this._editor.getSelection(),r=this._decorations.getCurrentMatchesPosition(n);if(r===0&&o.length>0){let s=Mw(o.map(l=>l.range),l=>G.compareRangesUsingStarts(l,n)>=0);r=s>0?s-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),i&&this._editor.getOption(50).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){let i=this._decorations.getFindScope();return i&&this._editor.revealRangeInCenterIfOutsideViewport(i,0),!0}return!1}_setCurrentFindMatch(i){let e=this._decorations.setCurrentFindMatch(i);this._state.changeMatchInfo(e,this._decorations.getCount(),i),this._editor.setSelection(i),this._editor.revealRangeInCenterIfOutsideViewport(i,0)}_prevSearchPosition(i){let e=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:t,column:o}=i,n=this._editor.getModel();return e||o===1?(t===1?t=n.getLineCount():t--,o=n.getLineMaxColumn(t)):o--,new ye(t,o)}_moveToPrevMatch(i,e=!1){if(!this._state.canNavigateBack()){let u=this._decorations.matchAfterPosition(i);u&&this._setCurrentFindMatch(u);return}if(this._decorations.getCount()<t0){let u=this._decorations.matchBeforePosition(i);u&&u.isEmpty()&&u.getStartPosition().equals(i)&&(i=this._prevSearchPosition(i),u=this._decorations.matchBeforePosition(i)),u&&this._setCurrentFindMatch(u);return}if(this._cannotFind())return;let t=this._decorations.getFindScope(),o=a._getSearchRange(this._editor.getModel(),t);o.getEndPosition().isBefore(i)&&(i=o.getEndPosition()),i.isBefore(o.getStartPosition())&&(i=o.getEndPosition());let{lineNumber:n,column:r}=i,s=this._editor.getModel(),l=new ye(n,r),c=s.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1);if(c&&c.range.isEmpty()&&c.range.getStartPosition().equals(l)&&(l=this._prevSearchPosition(l),c=s.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1)),!!c){if(!e&&!o.containsRange(c.range))return this._moveToPrevMatch(c.range.getStartPosition(),!0);this._setCurrentFindMatch(c.range)}}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(i){let e=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:t,column:o}=i,n=this._editor.getModel();return e||o===n.getLineMaxColumn(t)?(t===n.getLineCount()?t=1:t++,o=1):o++,new ye(t,o)}_moveToNextMatch(i){if(!this._state.canNavigateForward()){let t=this._decorations.matchBeforePosition(i);t&&this._setCurrentFindMatch(t);return}if(this._decorations.getCount()<t0){let t=this._decorations.matchAfterPosition(i);t&&t.isEmpty()&&t.getStartPosition().equals(i)&&(i=this._nextSearchPosition(i),t=this._decorations.matchAfterPosition(i)),t&&this._setCurrentFindMatch(t);return}let e=this._getNextMatch(i,!1,!0);e&&this._setCurrentFindMatch(e.range)}_getNextMatch(i,e,t,o=!1){if(this._cannotFind())return null;let n=this._decorations.getFindScope(),r=a._getSearchRange(this._editor.getModel(),n);r.getEndPosition().isBefore(i)&&(i=r.getStartPosition()),i.isBefore(r.getStartPosition())&&(i=r.getStartPosition());let{lineNumber:s,column:l}=i,c=this._editor.getModel(),u=new ye(s,l),p=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e);return t&&p&&p.range.isEmpty()&&p.range.getStartPosition().equals(u)&&(u=this._nextSearchPosition(u),p=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e)),p?!o&&!r.containsRange(p.range)?this._getNextMatch(p.range.getEndPosition(),e,t,!0):p:null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(i){let e=this._decorations.getDecorationRangeAt(i);e&&this._setCurrentFindMatch(e)}moveToMatch(i){this._moveToMatch(i)}_getReplacePattern(){return this._state.isRegex?MEt(this._state.replaceString):vJ.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;let i=this._getReplacePattern(),e=this._editor.getSelection(),t=this._getNextMatch(e.getStartPosition(),!0,!1);if(t)if(e.equalsRange(t.range)){let o=i.buildReplaceString(t.matches,this._state.preserveCase),n=new kg(e,o);this._executeEditorCommand("replace",n),this._decorations.setStartPosition(new ye(e.startLineNumber,e.startColumn+o.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(t.range)}_findMatches(i,e,t){let o=(i||[null]).map(n=>a._getSearchRange(this._editor.getModel(),n));return this._editor.getModel().findMatches(this._state.searchString,o,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,e,t)}replaceAll(){if(!this._hasMatches())return;let i=this._decorations.getFindScopes();i===null&&this._state.matchesCount>=t0?this._largeReplaceAll():this._regularReplaceAll(i),this.research(!1)}_largeReplaceAll(){let e=new Uw(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null).parseSearchRequest();if(!e)return;let t=e.regex;if(!t.multiline){let p="mu";t.ignoreCase&&(p+="i"),t.global&&(p+="g"),t=new RegExp(t.source,p)}let o=this._editor.getModel(),n=o.getValue(1),r=o.getFullModelRange(),s=this._getReplacePattern(),l,c=this._state.preserveCase;s.hasReplacementPatterns||c?l=n.replace(t,function(){return s.buildReplaceString(arguments,c)}):l=n.replace(t,s.buildReplaceString(null,c));let u=new FY(r,l,this._editor.getSelection());this._executeEditorCommand("replaceAll",u)}_regularReplaceAll(i){let e=this._getReplacePattern(),t=this._findMatches(i,e.hasReplacementPatterns||this._state.preserveCase,1073741824),o=[];for(let r=0,s=t.length;r<s;r++)o[r]=e.buildReplaceString(t[r].matches,this._state.preserveCase);let n=new REt(this._editor.getSelection(),t.map(r=>r.range),o);this._executeEditorCommand("replaceAll",n)}selectAllMatches(){if(!this._hasMatches())return;let i=this._decorations.getFindScopes(),t=this._findMatches(i,!1,1073741824).map(n=>new ei(n.range.startLineNumber,n.range.startColumn,n.range.endLineNumber,n.range.endColumn)),o=this._editor.getSelection();for(let n=0,r=t.length;n<r;n++)if(t[n].equalsRange(o)){t=[o].concat(t.slice(0,n)).concat(t.slice(n+1));break}this._editor.setSelections(t)}_executeEditorCommand(i,e){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(i,e),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}};var k4o=d(10,null),E4o=d(12,null),T4o=d(11,null),yEe=class extends Lm{constructor(i){super({icon:L.caseSensitive,title:k4o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},wEe=class extends Lm{constructor(i){super({icon:L.wholeWord,title:E4o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},CEe=class extends Lm{constructor(i){super({icon:L.regex,title:T4o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}};function wto(a,i,e){let t=e??document.createElement("div");return t.textContent=a,t}function Jk(a,i,e){let t=e??document.createElement("div");return t.textContent="",Cto(t,_4o(a,!!i?.renderCodeSegments),i?.actionHandler,i?.renderCodeSegments),t}var Wui=class{constructor(i){this.source=i,this.index=0}eos(){return this.index>=this.source.length}next(){let i=this.peek();return this.advance(),i}peek(){return this.source[this.index]}advance(){this.index++}};function Cto(a,i,e,t){let o;if(i.type===2)o=document.createTextNode(i.content||"");else if(i.type===3)o=document.createElement("b");else if(i.type===4)o=document.createElement("i");else if(i.type===7&&t)o=document.createElement("code");else if(i.type===5&&e){let n=document.createElement("a");e.disposables.add(Yo(n,"click",r=>{e.callback(String(i.index),r)})),o=n}else i.type===8?o=document.createElement("br"):i.type===1&&(o=a);o&&a!==o&&a.appendChild(o),o&&Array.isArray(i.children)&&i.children.forEach(n=>{Cto(o,n,e,t)})}function _4o(a,i){let e={type:1,children:[]},t=0,o=e,n=[],r=new Wui(a);for(;!r.eos();){let s=r.next(),l=s==="\\"&&Vui(r.peek(),i)!==0;if(l&&(s=r.next()),!l&&D4o(s,i)&&s===r.peek()){r.advance(),o.type===2&&(o=n.pop());let c=Vui(s,i);if(o.type===c||o.type===5&&c===6)o=n.pop();else{let u={type:c,children:[]};c===5&&(u.index=t,t++),o.children.push(u),n.push(o),o=u}}else if(s===`
`)o.type===2&&(o=n.pop()),o.children.push({type:8});else if(o.type!==2){let c={type:2,content:s};o.children.push(c),n.push(o),o=c}else o.content+=s}return o.type===2&&(o=n.pop()),n.length,e}function D4o(a,i){return Vui(a,i)!==0}function Vui(a,i){switch(a){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return i?7:0;default:return 0}}var NEt=class{constructor(i,e=0,t=i.length,o=e-1){this.items=i;this.start=e;this.end=t;this.index=o}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}};var bJ=class{constructor(i=new Set,e=10){this._history=i;this._limit=e,this._onChange(),this._history.onDidChange&&(this._disposable=this._history.onDidChange(()=>this._onChange()))}getHistory(){return this._elements}add(i){this._history.delete(i),this._history.add(i),this._onChange()}next(){return this._navigator.next()}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}isFirst(){return this._currentPosition()===0}isLast(){return this._currentPosition()>=this._elements.length-1}isNowhere(){return this._navigator.current()===null}has(i){return this._history.has(i)}clear(){this._history.clear(),this._onChange()}_onChange(){this._reduceToLimit();let i=this._elements;this._navigator=new NEt(i,0,i.length,i.length)}_reduceToLimit(){let i=this._elements;if(i.length>this._limit){let e=i.slice(i.length-this._limit);this._history.replace?this._history.replace(e):this._history=new Set(e)}}_currentPosition(){let i=this._navigator.current();return i?this._elements.indexOf(i):-1}get _elements(){let i=[];return this._history.forEach(e=>i.push(e)),i}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=void 0)}},E4=class{constructor(i,e=10,t=o=>o){this.capacity=e;this.identityFn=t;if(i.length<1)throw new Error("not supported");this._size=1,this.head=this.tail=this.cursor={value:i[0],previous:void 0,next:void 0},this.valueSet=new Sle([i[0]],t);for(let o=1;o<i.length;o++)this.add(i[o])}get size(){return this._size}add(i){let e={value:i,previous:this.tail,next:void 0};for(this.tail.next=e,this.tail=e,this.cursor=this.tail,this._size++,this.valueSet.has(i)?this._deleteFromList(i):this.valueSet.add(i);this._size>this.capacity;)this.valueSet.delete(this.head.value),this.head=this.head.next,this.head.previous=void 0,this._size--}replaceLast(i){if(this.identityFn(this.tail.value)===this.identityFn(i))return i;let e=this.tail.value;return this.valueSet.delete(e),this.tail.value=i,this.valueSet.has(i)?this._deleteFromList(i):this.valueSet.add(i),e}prepend(i){if(this._size===this.capacity||this.valueSet.has(i))return;let e={value:i,previous:void 0,next:this.head};this.head.previous=e,this.head=e,this._size++,this.valueSet.add(i)}isAtEnd(){return this.cursor===this.tail}current(){return this.cursor.value}previous(){return this.cursor.previous&&(this.cursor=this.cursor.previous),this.cursor.value}next(){return this.cursor.next&&(this.cursor=this.cursor.next),this.cursor.value}has(i){return this.valueSet.has(i)}resetCursor(){return this.cursor=this.tail,this.cursor.value}*[Symbol.iterator](){let i=this.head;for(;i;)yield i.value,i=i.next}_deleteFromList(i){let e=this.head,t=this.identityFn(i);for(;e!==this.tail;)this.identityFn(e.value)===t&&(e===this.head?(this.head=this.head.next,this.head.previous=void 0):(e.previous.next=e.next,e.next.previous=e.previous),this._size--),e=e.next}};var xEe=_;var xto={inputBackground:"#3C3C3C",inputForeground:"#CCCCCC",inputValidationInfoBorder:"#55AAFF",inputValidationInfoBackground:"#063B49",inputValidationWarningBorder:"#B89500",inputValidationWarningBackground:"#352A05",inputValidationErrorBorder:"#BE1100",inputValidationErrorBackground:"#5A1D1D",inputBorder:void 0,inputValidationErrorForeground:void 0,inputValidationInfoForeground:void 0,inputValidationWarningForeground:void 0},ad=class extends ll{constructor(e,t,o){super();this.state="idle";this.maxHeight=Number.POSITIVE_INFINITY;this.hover=this._register(new ue);this._onDidChange=this._register(new T);this._onDidHeightChange=this._register(new T);this.contextViewProvider=t,this.options=o,this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=this.options.tooltip??(this.placeholder||""),this.ariaLabel=this.options.ariaLabel||"",this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=D(e,xEe(".monaco-inputbox.idle"));let n=this.options.flexibleHeight?"textarea":"input",r=D(this.element,xEe(".ibwrapper"));if(this.input=D(r,xEe(n+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,()=>this.element.classList.add("synthetic-focus")),this.onblur(this.input,()=>this.element.classList.remove("synthetic-focus")),this.options.flexibleHeight){this.maxHeight=typeof this.options.flexibleMaxHeight=="number"?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=D(r,xEe("div.mirror")),this.mirror.innerText="\xA0",this.scrollableElement=new gX(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),D(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(c=>this.input.scrollTop=c.scrollTop));let s=this._register(new Zn(e.ownerDocument,"selectionchange")),l=U.filter(s.event,()=>e.ownerDocument.getSelection()?.anchorNode===r);this._register(l(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,()=>this.onValueChange()),this.onblur(this.input,()=>this.onBlur()),this.onfocus(this.input,()=>this.onFocus()),this._register(this.ignoreGesture(this.input)),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new oo(this.element,{actionViewItemProvider:this.options.actionViewItemProvider})),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}get onDidChange(){return this._onDidChange.event}get onDidHeightChange(){return this._onDidHeightChange.event}setActions(e,t){this.actionbar?(this.actionbar.clear(),e&&this.actionbar.push(e,{icon:!0,label:!1})):e&&(this.actionbar=this._register(new oo(this.element,{actionViewItemProvider:t??this.options.actionViewItemProvider})),this.actionbar.push(e,{icon:!0,label:!1}))}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.hover.value||(this.hover.value=this._register(sp().setupDelayedHoverAtMouse(this.input,()=>({content:this.tooltip,appearance:{compact:!0}}))))}setAriaLabel(e){this.ariaLabel=e,e?this.input.setAttribute("aria-label",this.ariaLabel):this.input.removeAttribute("aria-label")}getAriaLabel(){return this.ariaLabel}get mirrorElement(){return this.mirror}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get step(){return this.input.step}set step(e){this.input.step=e}get height(){return typeof this.cachedHeight=="number"?this.cachedHeight:Uh(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return Na(this.input)}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}getSelection(){let e=this.input.selectionStart;if(e===null)return null;let t=this.input.selectionEnd??e;return{start:e,end:t}}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}setEnabled(e){e?this.enable():this.disable()}get width(){return Dc(this.input)}set width(e){if(this.options.flexibleHeight&&this.options.flexibleWidth){let t=0;if(this.mirror){let o=parseFloat(this.mirror.style.paddingLeft||"")||0,n=parseFloat(this.mirror.style.paddingRight||"")||0;t=o+n}this.input.style.width=e-t+"px"}else this.input.style.width=e+"px";this.mirror&&(this.mirror.style.width=e+"px")}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;let e=this.cachedContentHeight,t=this.cachedHeight,o=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:o})}showMessage(e,t){if(this.state==="open"&&Qi(this.message,e))return;this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));let o=this.stylesForType(this.message.type);this.element.style.border=`1px solid ${_D(o.border,"transparent")}`,this.message.content&&(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}isInputValid(){return!!this.validation&&!this.validation(this.value)}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),e?.type}stylesForType(e){let t=this.options.inputBoxStyles;switch(e){case 1:return{border:t.inputValidationInfoBorder,background:t.inputValidationInfoBackground,foreground:t.inputValidationInfoForeground};case 2:return{border:t.inputValidationWarningBorder,background:t.inputValidationWarningBackground,foreground:t.inputValidationWarningForeground};default:return{border:t.inputValidationErrorBorder,background:t.inputValidationErrorBackground,foreground:t.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e,t=()=>e.style.width=Dc(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:n=>{if(!this.message)return null;e=D(n,xEe(".monaco-inputbox-container")),t();let r=xEe("span.monaco-inputbox-message");this.message.formatContent?Jk(this.message.content,void 0,r):wto(this.message.content,void 0,r),r.classList.add(this.classForType(this.message.type));let s=this.stylesForType(this.message.type);return r.style.backgroundColor=s.background??"",r.style.color=s.foreground??"",r.style.border=s.border?`1px solid ${s.border}`:"",D(e,r),null},onHide:()=>{this.state="closed"},layout:t});let o;this.message.type===3?o=d(19,null,this.message.content):this.message.type===2?o=d(21,null,this.message.content):o=d(20,null,this.message.content),cn(o),this.state="open"}_hideMessage(){this.contextViewProvider&&(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}layoutMessage(){this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout()}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout(),this.options.hideHoverOnValueChange&&sp().hideHover()}updateMirror(){if(!this.mirror)return;let e=this.value,o=e.charCodeAt(e.length-1)===10?" ":"";(e+o).replace(/\u000c/g,"")?this.mirror.textContent=e+o:this.mirror.innerText="\xA0",this.layout()}applyStyles(){let e=this.options.inputBoxStyles,t=e.inputBackground??"",o=e.inputForeground??"",n=e.inputBorder??"";this.element.style.backgroundColor=t,this.element.style.color=o,this.input.style.backgroundColor="inherit",this.input.style.color=o,this.element.style.border=`1px solid ${_D(n,"transparent")}`}layout(){if(!this.mirror){this.layoutMessage();return}let e=this.cachedContentHeight;this.cachedContentHeight=Uh(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight)),this.layoutMessage()}insertAtCursor(e){let t=this.inputElement,o=t.selectionStart,n=t.selectionEnd,r=t.value;o!==null&&n!==null&&(this.value=r.substr(0,o)+e+r.substr(n),t.setSelectionRange(o+1,o+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar?.dispose(),super.dispose()}},SJ=class extends ad{constructor(e,t,o){let n=d(24,null,"\u21C5"),r=d(23,null,"\u21C5");super(e,t,o);this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new T);this.onDidBlur=this._onDidBlur.event;this.history=this._register(new bJ(o.history,100));let s=()=>{if(o.showHistoryHint&&o.showHistoryHint()&&!this.placeholder.endsWith(n)&&!this.placeholder.endsWith(r)&&this.history.getHistory().length){let l=this.placeholder.endsWith(")")?n:r,c=this.placeholder+l;o.showPlaceholderOnFocus&&!Na(this.input)?this.placeholder=c:this.setPlaceHolder(c)}};this.observer=new MutationObserver((l,c)=>{l.forEach(u=>{u.target.textContent||s()})}),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,()=>s()),this.onblur(this.input,()=>{let l=c=>{if(this.placeholder.endsWith(c)){let u=this.placeholder.slice(0,this.placeholder.length-c.length);return o.showPlaceholderOnFocus?this.placeholder=u:this.setPlaceHolder(u),!0}else return!1};l(r)||l(n)})}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(e){this.value&&(e||this.value!==this.getCurrentValue())&&this.history.add(this.value)}prependHistory(e){let t=this.getHistory();this.clearHistory(),e.forEach(o=>{this.history.add(o)}),t.forEach(o=>{this.history.add(o)})}getHistory(){return this.history.getHistory()}isAtFirstInHistory(){return this.history.isFirst()}isAtLastInHistory(){return this.history.isLast()}isNowhereInHistory(){return this.history.isNowhere()}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),this.value=e??"",Er(this.value?this.value:d(22,null))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,Er(this.value))}clearHistory(){this.history.clear()}setPlaceHolder(e){super.setPlaceHolder(e),this.setTooltip(e)}onBlur(){super.onBlur(),this._onDidBlur.fire()}onFocus(){super.onFocus(),this._onDidFocus.fire()}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}};var R4o=d(9,null),QK=class extends ll{constructor(e,t,o){super();this.fixFocusOnOptionClickEnabled=!0;this.imeSessionInProgress=!1;this.additionalTogglesDisposables=this._register(new ue);this.additionalToggles=[];this._onDidOptionChange=this._register(new T);this._onKeyDown=this._register(new T);this._onMouseDown=this._register(new T);this._onInput=this._register(new T);this._onKeyUp=this._register(new T);this._onCaseSensitiveKeyDown=this._register(new T);this._onRegexKeyDown=this._register(new T);this._lastHighlightFindOptions=0;this.placeholder=o.placeholder||"",this.validation=o.validation,this.label=o.label||R4o,this.showCommonFindToggles=!!o.showCommonFindToggles;let n=o.appendCaseSensitiveLabel||"",r=o.appendWholeWordsLabel||"",s=o.appendRegexLabel||"",l=!!o.flexibleHeight,c=!!o.flexibleWidth,u=o.flexibleMaxHeight;if(this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new SJ(this.domNode,t,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},showHistoryHint:o.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:u,inputBoxStyles:o.inputBoxStyles,history:o.history,actions:o.actions,actionViewItemProvider:o.actionViewItemProvider,hideHoverOnValueChange:o.hideHoverOnValueChange})),this.showCommonFindToggles){let p=o?.hoverLifecycleOptions||{groupId:"find-input"};this.regex=this._register(new CEe({appendTitle:s,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.regex.onChange(h=>{this._onDidOptionChange.fire(h),!h&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.regex.onKeyDown(h=>{this._onRegexKeyDown.fire(h)})),this.wholeWords=this._register(new wEe({appendTitle:r,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.wholeWords.onChange(h=>{this._onDidOptionChange.fire(h),!h&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this.caseSensitive=this._register(new yEe({appendTitle:n,isChecked:!1,hoverLifecycleOptions:p,...o.toggleStyles})),this._register(this.caseSensitive.onChange(h=>{this._onDidOptionChange.fire(h),!h&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.caseSensitive.onKeyDown(h=>{this._onCaseSensitiveKeyDown.fire(h)})),this.onkeydown(this.domNode,h=>{if(h.equals(15)||h.equals(17)||h.equals(9)){let g=this.getToggleDomNodes(),f=g.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let v=-1;h.equals(17)?v=(f+1)%g.length:h.equals(15)&&(f===0?v=g.length-1:v=f-1),h.equals(9)?(g[f].blur(),this.inputBox.focus()):v>=0&&g[v].focus(),Kt.stop(h,!0)}}})}this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this.showCommonFindToggles?"":"none",this.caseSensitive&&this.controls.append(this.caseSensitive.domNode),this.wholeWords&&this.controls.appendChild(this.wholeWords.domNode),this.regex&&this.controls.appendChild(this.regex.domNode),this.setAdditionalToggles(o?.additionalToggles),this.controls&&this.domNode.appendChild(this.controls),e?.appendChild(this.domNode),this._register($(this.inputBox.inputElement,"compositionstart",p=>{this.imeSessionInProgress=!0})),this._register($(this.inputBox.inputElement,"compositionend",p=>{this.imeSessionInProgress=!1,this._onInput.fire()})),this.onkeydown(this.inputBox.inputElement,p=>this._onKeyDown.fire(p)),this.onkeyup(this.inputBox.inputElement,p=>this._onKeyUp.fire(p)),this.oninput(this.inputBox.inputElement,p=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,p=>this._onMouseDown.fire(p))}static{this.OPTION_CHANGE="optionChange"}get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onMouseDown(){return this._onMouseDown.event}get onInput(){return this._onInput.event}get onKeyUp(){return this._onKeyUp.event}get onCaseSensitiveKeyDown(){return this._onCaseSensitiveKeyDown.event}get onRegexKeyDown(){return this._onRegexKeyDown.event}get isImeSessionInProgress(){return this.imeSessionInProgress}get onDidChange(){return this.inputBox.onDidChange}layout(e){this.inputBox.layout(),this.updateInputBoxPadding(e.collapsedFindWidget)}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.regex?.enable(),this.wholeWords?.enable(),this.caseSensitive?.enable();for(let e of this.additionalToggles)e.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.regex?.disable(),this.wholeWords?.disable(),this.caseSensitive?.disable();for(let e of this.additionalToggles)e.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}setAdditionalToggles(e){for(let t of this.additionalToggles)t.domNode.remove();this.additionalToggles=[],this.additionalTogglesDisposables.value=new O;for(let t of e??[])this.additionalTogglesDisposables.value.add(t),this.controls.appendChild(t.domNode),this.additionalTogglesDisposables.value.add(t.onChange(o=>{this._onDidOptionChange.fire(o),!o&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus()})),this.additionalToggles.push(t);this.additionalToggles.length>0&&(this.controls.style.display=""),this.updateInputBoxPadding()}getToggleDomNodes(){let e=[];this.caseSensitive&&e.push(this.caseSensitive.domNode),this.wholeWords&&e.push(this.wholeWords.domNode),this.regex&&e.push(this.regex.domNode);for(let t of this.additionalToggles)e.push(t.domNode);return e}setActions(e,t){this.inputBox.setActions(e,t)}updateInputBoxPadding(e=!1){e?this.inputBox.paddingRight=0:this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this.additionalToggles.reduce((t,o)=>t+o.width(),0)}clear(){this.clearValidation(),this.setValue(""),this.focus()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}onSearchSubmit(){this.inputBox.addToHistory()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){return this.caseSensitive?.checked??!1}setCaseSensitive(e){this.caseSensitive&&(this.caseSensitive.checked=e)}getWholeWords(){return this.wholeWords?.checked??!1}setWholeWords(e){this.wholeWords&&(this.wholeWords.checked=e)}getRegex(){return this.regex?.checked??!1}setRegex(e){this.regex&&(this.regex.checked=e,this.validate())}focusOnCaseSensitive(){this.caseSensitive?.focus()}focusOnRegex(){this.regex?.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}showMessage(e){this.inputBox.showMessage(e)}clearMessage(){this.inputBox.hideMessage()}clearValidation(){this.inputBox.hideMessage()}};var L4o=d(13,null),M4o=d(14,null),Bui=class extends Lm{constructor(i){super({icon:L.preserveCase,title:M4o+i.appendTitle,isChecked:i.isChecked,hoverLifecycleOptions:i.hoverLifecycleOptions,inputActiveOptionBorder:i.inputActiveOptionBorder,inputActiveOptionForeground:i.inputActiveOptionForeground,inputActiveOptionBackground:i.inputActiveOptionBackground})}},OEt=class extends ll{constructor(e,t,o,n){super();this._showOptionButtons=o;this.fixFocusOnOptionClickEnabled=!0;this.cachedOptionsWidth=0;this._onDidOptionChange=this._register(new T);this._onKeyDown=this._register(new T);this._onMouseDown=this._register(new T);this._onInput=this._register(new T);this._onKeyUp=this._register(new T);this._onPreserveCaseKeyDown=this._register(new T);this._lastHighlightFindOptions=0;this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||L4o;let r=n.appendPreserveCaseLabel||"",s=n.history||new Set([]),l=!!n.flexibleHeight,c=!!n.flexibleWidth,u=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new SJ(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:s,showHistoryHint:n.showHistoryHint,flexibleHeight:l,flexibleWidth:c,flexibleMaxHeight:u,inputBoxStyles:n.inputBoxStyles})),this.preserveCase=this._register(new Bui({appendTitle:r,isChecked:!1,hoverLifecycleOptions:n.hoverLifecycleOptions,...n.toggleStyles})),this._register(this.preserveCase.onChange(g=>{this._onDidOptionChange.fire(g),!g&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(g=>{this._onPreserveCaseKeyDown.fire(g)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;let p=[this.preserveCase.domNode];this.onkeydown(this.domNode,g=>{if(g.equals(15)||g.equals(17)||g.equals(9)){let f=p.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let v=-1;g.equals(17)?v=(f+1)%p.length:g.equals(15)&&(f===0?v=p.length-1:v=f-1),g.equals(9)?(p[f].blur(),this.inputBox.focus()):v>=0&&p[v].focus(),Kt.stop(g,!0)}}});let h=document.createElement("div");h.className="controls",h.style.display=this._showOptionButtons?"block":"none",h.appendChild(this.preserveCase.domNode),this.domNode.appendChild(h),e?.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,g=>this._onKeyDown.fire(g)),this.onkeyup(this.inputBox.inputElement,g=>this._onKeyUp.fire(g)),this.oninput(this.inputBox.inputElement,g=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,g=>this._onMouseDown.fire(g))}static{this.OPTION_CHANGE="optionChange"}get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onMouseDown(){return this._onMouseDown.event}get onInput(){return this._onInput.event}get onKeyUp(){return this._onKeyUp.event}get onPreserveCaseKeyDown(){return this._onPreserveCaseKeyDown.event}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}clear(){this.clearValidation(),this.setValue(""),this.focus()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}onSearchSubmit(){this.inputBox.addToHistory()}applyStyles(){}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox?.validate()}showMessage(e){this.inputBox?.showMessage(e)}clearMessage(){this.inputBox?.hideMessage()}clearValidation(){this.inputBox?.hideMessage()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}};var WEt=new Y("suggestWidgetVisible",!1,d(2364,null)),Hui="historyNavigationWidgetFocus",kto="historyNavigationForwardsEnabled",Eto="historyNavigationBackwardsEnabled",c6e,FEt=[];function JB(a,i){if(FEt.includes(i))throw new Error("Cannot register the same widget multiple times");FEt.push(i);let e=new O,t=new Y(Hui,!1).bindTo(a),o=new Y(kto,!0).bindTo(a),n=new Y(Eto,!0).bindTo(a),r=()=>{t.set(!0),c6e=i},s=()=>{t.set(!1),c6e===i&&(c6e=void 0)};return Na(i.element)&&r(),e.add(i.onDidFocus(()=>r())),e.add(i.onDidBlur(()=>s())),e.add(ee(()=>{FEt.splice(FEt.indexOf(i),1),s()})),{historyNavigationForwardsEnablement:o,historyNavigationBackwardsEnablement:n,dispose(){e.dispose()}}}var YK=class extends SJ{constructor(i,e,t,o){super(i,e,t);let n=this._register(o.createScoped(this.element));this._register(JB(n,this))}};YK=I([m(3,X)],YK);var XK=class extends QK{constructor(i,e,t,o){super(i,e,t);let n=this._register(o.createScoped(this.inputBox.element));this._register(JB(n,this.inputBox))}};XK=I([m(3,X)],XK);var JK=class extends OEt{constructor(i,e,t,o,n=!1){super(i,e,n,t);let r=this._register(o.createScoped(this.inputBox.element));this._register(JB(r,this.inputBox))}};JK=I([m(3,X)],JK);xt.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:C.and(C.has(Hui),C.equals(Eto,!0),C.not("isComposing"),WEt.isEqualTo(!1)),primary:16,secondary:[528],handler:a=>{c6e?.showPreviousValue()}});xt.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:C.and(C.has(Hui),C.equals(kto,!0),C.not("isComposing"),WEt.isEqualTo(!1)),primary:18,secondary:[530],handler:a=>{c6e?.showNextValue()}});function mM(a){return a.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&a.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}var Tto=Oe("find-collapsed",L.chevronRight,d(1132,null)),_to=Oe("find-expanded",L.chevronDown,d(1133,null)),Kui=Oe("find-selection",L.selection,d(1139,null)),Gui=Oe("find-replace",L.replace,d(1138,null)),qui=Oe("find-replace-all",L.replaceAll,d(1137,null)),p6e=Oe("find-previous-match",L.arrowUp,d(1136,null)),m6e=Oe("find-next-match",L.arrowDown,d(1135,null)),P4o=d(1142,null),Uui=d(1141,null),A4o=d(1152,null),N4o=d(1146,null),O4o=d(1144,null),F4o=d(1151,null),W4o=d(1140,null),zui=d(1147,null),V4o=d(1153,null),B4o=d(1149,null),H4o=d(1148,null),U4o=d(1150,null),z4o=d(1155,null,t0),h6e=d(1143,null),e2=d(1145,null),ZK=419,K4o=275,G4o=K4o-54,d6e=69,q4o=33,Dto=et?256:2048,u6e=class{constructor(i){this.afterLineNumber=i,this.heightInPx=q4o,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}};function Rto(a,i,e){let t=!!i.match(/\n/);if(e&&t&&e.selectionStart>0){a.stopPropagation();return}}function Lto(a,i,e){let t=!!i.match(/\n/);if(e&&t&&e.selectionEnd<e.value.length){a.stopPropagation();return}}var VEt=class a extends ll{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._hoverService=l;this._findWidgetSearchHistory=c;this._replaceWidgetHistory=u;this._configurationService=p;this._accessibilityService=h;this._cachedHeight=null;this._lastFocusedInputWasReplace=!1;this._lastFocusedElement=null;this._revealTimeouts=[];this._codeEditor=e,this._controller=t,this._state=o,this._contextViewProvider=n,this._keybindingService=r,this._contextKeyService=s,this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._accessibilityHelpHintAnnounced=!1,this._updateHistoryDelayer=new rn(500),this._register(ee(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(g=>this._onStateChanged(g))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(g=>{if(g.hasChanged(104)&&(this._codeEditor.getOption(104)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),g.hasChanged(165)&&this._tryUpdateWidgetWidth(),g.hasChanged(2)&&this.updateAccessibilitySupport(),g.hasChanged(50)){let f=this._codeEditor.getOption(50).loop;this._state.change({loop:f},!1);let v=this._codeEditor.getOption(50).addExtraSpaceOnTop;v&&!this._viewZone&&(this._viewZone=new u6e(0),this._showViewZone()),!v&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){let g=await this._controller.getGlobalBufferTerm();g&&g!==this._state.searchString&&(this._state.change({searchString:g},!1),this._findInput.select())}})),this._findInputFocused=IEe.bindTo(s),this._findFocusTracker=this._register(nr(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._lastFocusedInputWasReplace=!1,this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=a6e.bindTo(s),this._replaceFocusTracker=this._register(nr(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._lastFocusedInputWasReplace=!0,this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._findWidgetFocused=AEt.bindTo(s),this._widgetFocusTracker=this._register(nr(this._domNode)),this._register(this._widgetFocusTracker.onDidFocus(()=>{this._findWidgetFocused.set(!0)})),this._register(this._widgetFocusTracker.onDidBlur(()=>{this._findWidgetFocused.set(!1)})),this._register($(this._domNode,"focusin",g=>{go(g.target)&&(this._lastFocusedElement=g.target)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(50).addExtraSpaceOnTop&&(this._viewZone=new u6e(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(g=>{if(g.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}static{this.ID="editor.contrib.findWidget"}getId(){return a.ID}getDomNode(){return this._domNode}get lastFocusedInputWasReplace(){return this._lastFocusedInputWasReplace}get lastFocusedElement(){return this._lastFocusedElement}focusLastElement(){this._isVisible&&(this._lastFocusedElement&&this._domNode.contains(this._lastFocusedElement)&&Me(this._lastFocusedElement).document.body.contains(this._lastFocusedElement)?this._lastFocusedElement.focus():this._lastFocusedInputWasReplace?this.focusReplaceInput():this.focusFindInput())}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(104)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=Dc(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){let t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,mt)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){this._matchesCount.style.minWidth=d6e+"px",this._state.matchesCount>=t0?this._matchesCount.title=z4o:this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=t0&&(t+="+");let o=String(this._state.matchesPosition);o==="0"&&(o="?"),e=Wd(h6e,o,t)}else e=e2;this._matchesCount.appendChild(document.createTextNode(e)),cn(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),d6e=Math.max(d6e,this._matchesCount.clientWidth)}_getAriaLabel(e,t,o){let n;if(e===e2)n=o===""?d(1129,null,e):d(1128,null,e,o);else if(t){let r=d(1130,null,e,o,t.startLineNumber+":"+t.startColumn),s=this._codeEditor.getModel();s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1?n=`${s.getLineContent(t.startLineNumber)}, ${r}`:n=r}else n=d(1131,null,e,o);return n}_updateToggleSelectionFindButton(){let e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,o=this._toggleSelectionFind.checked;this._isVisible&&(o||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);let e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);let o=!this._codeEditor.getOption(104);this._toggleReplaceBtn.setEnabled(this._isVisible&&o)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;let e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(50).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{let o=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=o;break}default:break}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false"),this._updateFindInputAriaLabel()},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(50).seedSearchStringFromSelection&&e){let o=this._codeEditor.getDomNode();if(o){let n=ur(o),r=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),s=n.left+(r?r.left:0),l=r?r.top:0;if(this._viewZone&&l<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);let c=pF(this._domNode).left;s>c&&(t=!1);let u=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(u?u.left:0)>c&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._accessibilityHelpHintAnnounced=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(50).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;let o=this._viewZone;this._viewZoneId!==void 0||!o||this._codeEditor.changeViewZones(n=>{o.heightInPx=this._getHeight(),this._viewZoneId=n.addZone(o),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+o.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(50).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new u6e(0));let o=this._viewZone;this._codeEditor.changeViewZones(n=>{if(this._viewZoneId!==void 0){let r=this._getHeight();if(r===o.heightInPx)return;let s=r-o.heightInPx;o.heightInPx=r,n.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s);return}else{let r=this._getHeight();if(r-=this._codeEditor.getOption(96).top,r<=0)return;o.heightInPx=r,this._viewZoneId=n.addZone(o),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+r)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;let e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");let o=e.width,n=e.minimap.minimapWidth,r=!1,s=!1,l=!1;if(this._resized&&Dc(this._domNode)>ZK){this._domNode.style.maxWidth=`${o-28-n-15}px`,this._replaceInput.width=Dc(this._findInput.domNode);return}if(ZK+28+n>=o&&(s=!0),ZK+28+n-d6e>=o&&(l=!0),ZK+28+n-d6e>=o+50&&(r=!0),this._domNode.classList.toggle("collapsed-find-widget",r),this._domNode.classList.toggle("narrow-find-widget",l),this._domNode.classList.toggle("reduced-find-widget",s),!l&&!r&&(this._domNode.style.maxWidth=`${o-28-n-15}px`),this._findInput.layout({collapsedFindWidget:r,narrowFindWidget:l,reducedFindWidget:s}),this._resized){let c=this._findInput.inputBox.element.clientWidth;c>0&&(this._replaceInput.width=c)}else this._isReplaceVisible&&(this._replaceInput.width=Dc(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){let e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){let e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));let o=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!G.equalsRange(t,o)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(Dto|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
`),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return Rto(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return Lto(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(Dto|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._replaceInput.inputBox.insertAtCursor(`
`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return Rto(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return Lto(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding("",e)}_buildDomNode(){let o=this._codeEditor.getOption(50).history,n=this._codeEditor.getOption(50).replaceHistory;this._findInput=this._register(new XK(null,this._contextViewProvider,{width:G4o,label:Uui,placeholder:A4o,appendCaseSensitiveLabel:this._keybindingLabelFor(zd.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(zd.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(zd.ToggleRegexCommand),validation:h=>{if(h.length===0||!this._findInput.getRegex())return null;try{return new RegExp(h,"gu"),null}catch(g){return{content:g.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>mM(this._keybindingService),inputBoxStyles:Wl,toggleStyles:zh,history:o==="workspace"?this._findWidgetSearchHistory:new Set([])},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(h=>{h.equals(3)&&!this._codeEditor.getOption(50).findOnType&&this._state.change({searchString:this._findInput.getValue()},!0),this._onFindInputKeyDown(h)})),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||!this._codeEditor.getOption(50).findOnType||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(h=>{h.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),h.preventDefault())})),this._register(this._findInput.onRegexKeyDown(h=>{h.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),h.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(h=>{this._tryUpdateHeight()&&this._showViewZone()})),Sn&&this._register(this._findInput.onMouseDown(h=>this._onFindInputMouseDown(h))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();let r={groupId:"find-widget"};this._prevBtn=this._register(new UI({label:N4o+this._keybindingLabelFor(zd.PreviousMatchFindAction),icon:p6e,hoverLifecycleOptions:r,onTrigger:()=>{Ti(this._codeEditor.getAction(zd.PreviousMatchFindAction)).run().then(void 0,mt)}},this._hoverService)),this._nextBtn=this._register(new UI({label:O4o+this._keybindingLabelFor(zd.NextMatchFindAction),icon:m6e,hoverLifecycleOptions:r,onTrigger:()=>{Ti(this._codeEditor.getAction(zd.NextMatchFindAction)).run().then(void 0,mt)}},this._hoverService));let s=document.createElement("div");s.className="find-part",s.appendChild(this._findInput.domNode);let l=document.createElement("div");l.className="find-actions",s.appendChild(l),l.appendChild(this._matchesCount),l.appendChild(this._prevBtn.domNode),l.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new Lm({icon:Kui,title:F4o+this._keybindingLabelFor(zd.ToggleSearchScopeCommand),isChecked:!1,hoverLifecycleOptions:r,inputActiveOptionBackground:Tt(AB),inputActiveOptionBorder:Tt(PB),inputActiveOptionForeground:Tt(E5)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let h=this._codeEditor.getSelections();h=h.map(g=>(g.endColumn===1&&g.endLineNumber>g.startLineNumber&&(g=g.setEndPosition(g.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(g.endLineNumber-1))),g.isEmpty()?null:g)).filter(g=>!!g),h.length&&this._state.change({searchScope:h},!0)}}else this._state.change({searchScope:null},!0)})),l.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new UI({label:W4o+this._keybindingLabelFor(zd.CloseFindWidgetCommand),icon:MT,hoverLifecycleOptions:r,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:h=>{h.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),h.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new JK(null,void 0,{label:zui,placeholder:V4o,appendPreserveCaseLabel:this._keybindingLabelFor(zd.TogglePreserveCaseCommand),history:n==="workspace"?this._replaceWidgetHistory:new Set([]),flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>mM(this._keybindingService),inputBoxStyles:Wl,toggleStyles:zh,hoverLifecycleOptions:r},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(h=>this._onReplaceInputKeyDown(h))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(h=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(h=>{h.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),h.preventDefault())})),this._replaceBtn=this._register(new UI({label:B4o+this._keybindingLabelFor(zd.ReplaceOneAction),icon:Gui,hoverLifecycleOptions:r,onTrigger:()=>{this._controller.replace()},onKeyDown:h=>{h.equals(1026)&&(this._closeBtn.focus(),h.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new UI({label:H4o+this._keybindingLabelFor(zd.ReplaceAllAction),icon:qui,hoverLifecycleOptions:r,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));let c=document.createElement("div");c.className="replace-part",c.appendChild(this._replaceInput.domNode);let u=document.createElement("div");u.className="replace-actions",c.appendChild(u),u.appendChild(this._replaceBtn.domNode),u.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new UI({label:U4o,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=Dc(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=P4o,this._domNode.role="dialog",this._domNode.style.width=`${ZK}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(s),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(c),this._resizeSash=this._register(new kh(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let p=ZK;this._register(this._resizeSash.onDidStart(()=>{p=Dc(this._domNode)})),this._register(this._resizeSash.onDidChange(h=>{this._resized=!0;let g=p+h.startX-h.currentX;if(g<ZK)return;let f=parseFloat(mF(this._domNode).maxWidth)||0;g>f||(this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=Dc(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{let h=Dc(this._domNode);if(h<ZK)return;let g=ZK;if(!this._resized||h===ZK){let f=this._codeEditor.getLayoutInfo();g=f.width-28-f.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${g}px`,this._isReplaceVisible&&(this._replaceInput.width=Dc(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){let e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2),this._updateFindInputAriaLabel()}_updateFindInputAriaLabel(){let e=Uui,t=zui;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue("accessibility.verbosity.find")&&this._accessibilityService.isScreenReaderOptimized()){let o=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();if(o){let n=d(1127,null,o);e=d(1134,null,e,n),t=d(1154,null,t,n)}this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=Zo(()=>{this._isVisible&&(this._findInput.inputBox.setAriaLabel(Uui),this._replaceInput.inputBox.setAriaLabel(zui))},1e3)}this._findInput.inputBox.setAriaLabel(e),this._replaceInput.inputBox.setAriaLabel(t)}getViewState(){let e=!1;return this._viewZone&&this._viewZoneId&&(e=this._viewZone.heightInPx>this._codeEditor.getScrollTop()),{widgetViewZoneVisible:e,scrollTop:this._codeEditor.getScrollTop()}}setViewState(e){e&&e.widgetViewZoneVisible&&this._layoutViewZone(e.scrollTop)}},UI=class extends ll{constructor(i,e){super(),this._opts=i;let t="button";this._opts.className&&(t=t+" "+this._opts.className),this._opts.icon&&(t=t+" "+q.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.tabIndex=0,this._domNode.className=t,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this._register(e.setupDelayedHover(this._domNode,{content:this._opts.label,style:1},i.hoverLifecycleOptions)),this.onclick(this._domNode,o=>{this._opts.onTrigger(),o.preventDefault()}),this.onkeydown(this._domNode,o=>{if(o.equals(10)||o.equals(3)){this._opts.onTrigger(),o.preventDefault();return}this._opts.onKeyDown?.(o)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(i){this._domNode.classList.toggle("disabled",!i),this._domNode.setAttribute("aria-disabled",String(!i)),this._domNode.tabIndex=i?0:-1}setExpanded(i){this._domNode.setAttribute("aria-expanded",String(!!i)),i?(this._domNode.classList.remove(...q.asClassNameArray(Tto)),this._domNode.classList.add(...q.asClassNameArray(_to))):(this._domNode.classList.remove(...q.asClassNameArray(_to)),this._domNode.classList.add(...q.asClassNameArray(Tto)))}};hs((a,i)=>{let e=a.getColor(TF);e&&i.addRule(`.monaco-editor .findMatch { border: 1px ${Uf(a.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`);let t=a.getColor(Y9i);t&&i.addRule(`.monaco-editor .findScope { border: 1px ${Uf(a.type)?"dashed":"solid"} ${t}; }`);let o=a.getColor(Ei);o&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${o}; }`);let n=a.getColor($9i);n&&i.addRule(`.monaco-editor .findMatchInline { color: ${n}; }`);let r=a.getColor(j9i);r&&i.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var kEe=class extends k{constructor(e,t,o,n){super();this._container=e;this._getContent=t;this._clipboardService=o;this._hoverService=n;this._container.classList.add("hover-row-with-copy"),this._button=this._register(new UI({label:d(1304,null),icon:L.copy,onTrigger:()=>this._copyContent(),className:"hover-copy-button"},this._hoverService)),this._container.appendChild(this._button.domNode)}async _copyContent(){let e=this._getContent();e&&(await this._clipboardService.writeText(e),Er(d(1303,null)))}};kEe=I([m(2,Bi),m(3,ot)],kEe);var $ui=class{constructor(i,e,t){this.provider=i;this.hover=e;this.ordinal=t}};async function $4o(a,i,e,t,o){let n=await Promise.resolve(a.provideHover(e,t,o)).catch(vs);if(!(!n||!j4o(n)))return new $ui(a,n,i)}function g6e(a,i,e,t,o=!1){let r=a.ordered(i,o).map((s,l)=>$4o(s,l,i,e,t));return Fp.fromPromisesResolveOrder(r).coalesce()}async function Mto(a,i,e,t,o=!1){let n=[];for await(let r of g6e(a,i,e,t,o))n.push(r.hover);return n}kI("_executeHoverProvider",(a,i,e)=>{let t=a.get(Jt);return Mto(t.hoverProvider,i,e,Ie.None)});kI("_executeHoverProvider_recursive",(a,i,e)=>{let t=a.get(Jt);return Mto(t.hoverProvider,i,e,Ie.None,!0)});function j4o(a){let i=typeof a.range<"u",e=typeof a.contents<"u"&&a.contents&&a.contents.length>0;return i&&e}var iue=_,Q4o=Oe("hover-increase-verbosity",L.addSmall,d(1307,null)),Y4o=Oe("hover-decrease-verbosity",L.removeSmall,d(1305,null)),UT=class{constructor(i,e,t,o,n,r=void 0){this.owner=i;this.range=e;this.contents=t;this.isBeforeContent=o;this.ordinal=n;this.source=r}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},BEt=class{constructor(i,e,t){this.hover=i;this.hoverProvider=e;this.hoverPosition=t}supportsVerbosityAction(i){switch(i){case 0:return this.hover.canIncreaseVerbosity??!1;case 1:return this.hover.canDecreaseVerbosity??!1}}},t2=class{constructor(i,e,t,o,n,r,s){this._editor=i;this._markdownRendererService=e;this._configurationService=t;this._languageFeaturesService=o;this._keybindingService=n;this._hoverService=r;this._commandService=s;this.hoverOrdinal=3}createLoadingMessage(i){return new UT(this,i.range,[new he().appendText(d(1309,null))],!1,2e3)}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1)return[];let t=this._editor.getModel(),o=i.range.startLineNumber,n=t.getLineMaxColumn(o),r=[],s=1e3,l=t.getLineLength(o),c=t.getLanguageIdAtPosition(i.range.startLineNumber,i.range.startColumn),u=this._editor.getOption(133),p=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c}),h=this._editor.getOption(69).showLongLineWarning,g=!1;u>=0&&l>u&&i.range.startColumn>=u&&(g=!0,h&&r.push(new UT(this,i.range,[{value:d(1310,null,XQe),isTrusted:!0}],!1,s++))),!g&&typeof p=="number"&&l>=p&&h&&r.push(new UT(this,i.range,[{value:d(1311,null,XQe),isTrusted:!0}],!1,s++));let f=!1;for(let v of e){let b=v.range.startLineNumber===o?v.range.startColumn:1,S=v.range.endLineNumber===o?v.range.endColumn:n,y=v.options.hoverMessage;if(!y||KB(y))continue;v.options.beforeContentClassName&&(f=!0);let w=new G(i.range.startLineNumber,b,i.range.startLineNumber,S);r.push(new UT(this,w,Ec(y),f,s++))}return r}computeAsync(i,e,t,o){if(!this._editor.hasModel()||i.type!==1)return Fp.EMPTY;let n=this._editor.getModel(),r=this._languageFeaturesService.hoverProvider;return r.has(n)?this._getMarkdownHovers(r,n,i,o):Fp.EMPTY}async*_getMarkdownHovers(i,e,t,o){let n=t.range.getStartPosition(),r=g6e(i,e,n,o);for await(let s of r)if(!KB(s.hover.contents)){let l=s.hover.range?G.lift(s.hover.range):t.range,c=new BEt(s.hover,s.provider,n);yield new UT(this,l,s.hover.contents,!1,s.ordinal,c)}}renderHoverParts(i,e){return this._renderedHoverParts=new jui(e,i.fragment,this,this._editor,this._commandService,this._keybindingService,this._hoverService,this._configurationService,this._markdownRendererService,i.onContentsChanged),this._renderedHoverParts}handleScroll(i){this._renderedHoverParts?.handleScroll(i)}getAccessibleContent(i){return this._renderedHoverParts?.getAccessibleContent(i)??""}doesMarkdownHoverAtIndexSupportVerbosityAction(i,e){return this._renderedHoverParts?.doesMarkdownHoverAtIndexSupportVerbosityAction(i,e)??!1}updateMarkdownHoverVerbosityLevel(i,e){return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(i,e))}};t2=I([m(1,_n),m(2,B),m(3,Jt),m(4,Le),m(5,ot),m(6,fe)],t2);var EEe=class{constructor(i,e,t,o){this.hoverPart=i;this.hoverElement=e;this.disposables=t;this.actionsContainer=o}get hoverAccessibleContent(){return this.hoverElement.innerText.trim()}dispose(){this.disposables.dispose()}},jui=class{constructor(i,e,t,o,n,r,s,l,c,u){this._hoverParticipant=t;this._editor=o;this._commandService=n;this._keybindingService=r;this._hoverService=s;this._configurationService=l;this._markdownRendererService=c;this._onFinishedRendering=u;this._ongoingHoverOperations=new Map;this._disposables=new O;this.renderedHoverParts=this._renderHoverParts(i,e,this._onFinishedRendering),this._disposables.add(ee(()=>{this.renderedHoverParts.forEach(p=>{p.dispose()}),this._ongoingHoverOperations.forEach(p=>{p.tokenSource.dispose(!0)})}))}_renderHoverParts(i,e,t){return i.sort(Il(o=>o.ordinal,Hu)),i.map(o=>{let n=this._renderHoverPart(o,t);return e.appendChild(n.hoverElement),n})}_renderHoverPart(i,e){let t=this._renderMarkdownHover(i,e),o=t.hoverElement,n=i.source,r=new O;if(r.add(t),!n)return new EEe(i,o,r);let s=n.supportsVerbosityAction(0),l=n.supportsVerbosityAction(1);if(!s&&!l)return new EEe(i,o,r);let c=iue("div.verbosity-actions");o.prepend(c);let u=iue("div.verbosity-actions-inner");return c.append(u),r.add(this._renderHoverExpansionAction(u,0,s)),r.add(this._renderHoverExpansionAction(u,1,l)),new EEe(i,o,r,u)}_renderMarkdownHover(i,e){return Nto(this._editor,i,this._markdownRendererService,e)}_renderHoverExpansionAction(i,e,t){let o=new O,n=e===0,r=D(i,iue(q.asCSSSelector(n?Q4o:Y4o)));r.tabIndex=0;let s=o.add(new Kf("mouse",void 0,{target:i,position:{hoverPosition:0}},this._configurationService,this._hoverService));if(o.add(this._hoverService.setupManagedHover(s,r,Qui(this._keybindingService,e))),!t)return r.classList.add("disabled"),o;r.classList.add("enabled");let l=()=>this._commandService.executeCommand(e===0?KK:GK,{focus:!0});return o.add(new yQe(r,l)),o.add(new wQe(r,l,[3,10])),o}handleScroll(i){this.renderedHoverParts.forEach(e=>{let t=e.actionsContainer;if(!t)return;let o=e.hoverElement,r=i.scrollTop+i.height,s=o.offsetTop,l=o.clientHeight,c=s+l,u=22,p;c<=r||s>=r?p=l-u:p=r-s-u,t.style.top=`${p}px`})}async updateMarkdownHoverPartVerbosityLevel(i,e){let t=this._editor.getModel();if(!t)return;let o=this._getRenderedHoverPartAtIndex(e),n=o?.hoverPart.source;if(!o||!n?.supportsVerbosityAction(i))return;let r=await this._fetchHover(n,t,i);if(!r)return;let s=new BEt(r,n.hoverProvider,n.hoverPosition),l=o.hoverPart,c=new UT(this._hoverParticipant,l.range,r.contents,l.isBeforeContent,l.ordinal,s),u=this._updateRenderedHoverPart(e,c);if(u)return{hoverPart:c,hoverElement:u.hoverElement}}getAccessibleContent(i){let e=this.renderedHoverParts.findIndex(r=>r.hoverPart===i);if(e===-1)return;let t=this._getRenderedHoverPartAtIndex(e);return t?t.hoverElement.innerText.replace(/[^\S\n\r]+/gu," "):void 0}doesMarkdownHoverAtIndexSupportVerbosityAction(i,e){let t=this._getRenderedHoverPartAtIndex(i),o=t?.hoverPart.source;return!(!t||!o?.supportsVerbosityAction(e))}async _fetchHover(i,e,t){let o=t===0?1:-1,n=i.hoverProvider,r=this._ongoingHoverOperations.get(n);r&&(r.tokenSource.cancel(),o+=r.verbosityDelta);let s=new qe;this._ongoingHoverOperations.set(n,{verbosityDelta:o,tokenSource:s});let l={verbosityRequest:{verbosityDelta:o,previousHover:i.hover}},c;try{c=await Promise.resolve(n.provideHover(e,i.hoverPosition,s.token,l))}catch(u){vs(u)}return s.dispose(),this._ongoingHoverOperations.delete(n),c}_updateRenderedHoverPart(i,e){if(i>=this.renderedHoverParts.length||i<0)return;let t=this._renderHoverPart(e,this._onFinishedRendering),o=this.renderedHoverParts[i],n=o.hoverElement,r=t.hoverElement,s=Array.from(r.children);n.replaceChildren(...s);let l=new EEe(e,n,t.disposables,t.actionsContainer);return o.dispose(),this.renderedHoverParts[i]=l,l}_getRenderedHoverPartAtIndex(i){return this.renderedHoverParts[i]}dispose(){this._disposables.dispose()}};function Ato(a,i,e,t){i.sort(Il(n=>n.ordinal,Hu));let o=[];for(let n of i){let r=Nto(e,n,t,a.onContentsChanged);a.fragment.appendChild(r.hoverElement),o.push(r)}return new Yk(o)}function Nto(a,i,e,t){let o=new O,n=iue("div.hover-row"),r=iue("div.hover-row-contents");n.appendChild(r);let s=i.contents;for(let c of s){if(KB(c))continue;let u=iue("div.markdown-hover"),p=D(u,iue("div.hover-contents")),h=o.add(e.render(c,{context:a,asyncRenderCallback:()=>{p.className="hover-contents code-hover-contents",t()}}));p.appendChild(h.element),r.appendChild(u)}return{hoverPart:i,hoverElement:n,dispose(){o.dispose()}}}function Qui(a,i){switch(i){case 0:return a.appendKeybinding(d(1308,null),KK);case 1:return a.appendKeybinding(d(1306,null),GK)}}var Oto=_,HEt=class extends k{constructor(e,t,o){super();this.model=t;this.pixelRatio=o;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onColorFlushed=this._register(new T);this.onColorFlushed=this._onColorFlushed.event;this._domNode=Oto(".saturation-wrap"),D(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",D(this._domNode,this._canvas),this.selection=Oto(".saturation-selection"),D(this._domNode,this.selection),this.layout(),this._register($(this._domNode,ne.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new fT);let t=ur(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);let o=$(e.target.ownerDocument,ne.POINTER_UP,()=>{this._onColorFlushed.fire(),o.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){let o=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(o,n),this._onDidChange.fire({s:o,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();let e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){let e=this.model.color.hsva,t=new Ue(new wF(e.h,1,1,1)),o=this._canvas.getContext("2d"),n=o.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");let r=o.createLinearGradient(0,0,0,this._canvas.height);r.addColorStop(0,"rgba(0, 0, 0, 0)"),r.addColorStop(1,"rgba(0, 0, 0, 1)"),o.rect(0,0,this._canvas.width,this._canvas.height),o.fillStyle=Ue.Format.CSS.format(t),o.fill(),o.fillStyle=n,o.fill(),o.fillStyle=r,o.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();let t=e.hsva;this.paintSelection(t.s,t.v)}};var UEt=class extends k{constructor(e){super();this._onClicked=this._register(new T);this.onClicked=this._onClicked.event;this._button=D(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register($(this._button,ne.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}};var zEt=class extends k{constructor(e,t,o){super();this.presentationIndex=o;this._onColorFlushed=this._register(new T);this.onColorFlushed=this._onColorFlushed.event;this._onDidChangeColor=this._register(new T);this.onDidChangeColor=this._onDidChangeColor.event;this._onDidChangePresentation=this._register(new T);this.onDidChangePresentation=this._onDidChangePresentation.event;this.originalColor=e,this._color=e,this._colorPresentations=t}get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let o=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){o=n;break}if(o===-1){let n=t.split("(")[0].toLowerCase();for(let r=0;r<this.colorPresentations.length;r++)if(this.colorPresentations[r].label.toLowerCase().startsWith(n)){o=r;break}}o!==-1&&o!==this.presentationIndex&&(this.presentationIndex=o,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}};async function KEt(a,i,e){let t=a.getValueInRange(i.range),{red:o,green:n,blue:r,alpha:s}=i.color,l=new Ut(Math.round(o*255),Math.round(n*255),Math.round(r*255),s),c=new Ue(l),u=await Tui(a,i,e,Ie.None),p=new zEt(c,[],0);return p.colorPresentations=u||[],p.guessColorPresentation(c,t),{range:G.lift(i.range),model:p,provider:e}}function GEt(a,i,e){let t=[],o=e.presentation.textEdit??{range:i,text:e.presentation.label,forceMoveMarkers:!1};t.push(o),e.presentation.additionalTextEdits&&t.push(...e.presentation.additionalTextEdits);let n=G.lift(o.range),r=a.getModel()._setTrackedRange(null,n,3);return a.executeEdits("colorpicker",t),a.pushUndoStop(),a.getModel()._getTrackedRange(r)??n}async function oue(a,i,e,t,o){let n=await Tui(a,{range:t,color:{red:e.rgba.r/255,green:e.rgba.g/255,blue:e.rgba.b/255,alpha:e.rgba.a}},o.provider,Ie.None);i.colorPresentations=n||[]}var f6e=_,qEt=class extends k{constructor(e,t,o){super();this.model=t;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onColorFlushed=this._register(new T);this.onColorFlushed=this._onColorFlushed.event;o==="standalone"?(this.domNode=D(e,f6e(".standalone-strip")),this.overlay=D(this.domNode,f6e(".standalone-overlay"))):(this.domNode=D(e,f6e(".strip")),this.overlay=D(this.domNode,f6e(".overlay"))),this.slider=D(this.domNode,f6e(".slider")),this.slider.style.top="0px",this._register($(this.domNode,ne.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;let e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){let t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._register(new fT),o=ur(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,r=>this.onDidChangeTop(r.pageY-o.top),()=>null);let n=$(e.target.ownerDocument,ne.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){let t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}},$Et=class extends qEt{constructor(i,e,t){super(i,e,t),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(i){super.onDidChangeColor(i);let{r:e,g:t,b:o}=i.rgba,n=new Ue(new Ut(e,t,o,1)),r=new Ue(new Ut(e,t,o,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(i){return i.hsva.a}},jEt=class extends qEt{constructor(i,e,t){super(i,e,t),this.domNode.classList.add("hue-strip")}getValue(i){return 1-i.hsva.h/360}};var X4o=_,YEt=class extends k{constructor(e,t,o,n){super();this.model=t;this.pixelRatio=o;this._insertButton=null;this._domNode=X4o(".colorpicker-body"),D(e,this._domNode),this._saturationBox=new HEt(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new $Et(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new jEt(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n==="standalone"&&(this._insertButton=this._register(new UEt(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){let o=this.model.color.hsva;this.model.color=new Ue(new wF(o.h,e,t,o.a))}onDidOpacityChange(e){let t=this.model.color.hsva;this.model.color=new Ue(new wF(t.h,t.s,t.v,e))}onDidHueChange(e){let t=this.model.color.hsva,o=(1-e)*360;this.model.color=new Ue(new wF(o===360?0:o,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get opacityStrip(){return this._opacityStrip}get hueStrip(){return this._hueStrip}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}};var J4o=_,XEt=class extends k{constructor(e){super();this._onClicked=this._register(new T);this.onClicked=this._onClicked.event;this._button=document.createElement("div"),this._button.classList.add("close-button"),D(e,this._button);let t=document.createElement("div");t.classList.add("close-button-inner-div"),D(this._button,t),D(t,J4o(".button"+q.asCSSSelector(Oe("color-picker-close",L.close,d(1053,null))))).classList.add("close-icon"),this._register($(this._button,ne.CLICK,()=>{this._onClicked.fire()}))}};var JEt=_,ZEt=class extends k{constructor(e,t,o,n){super();this.model=t;this.type=n;this._closeButton=null;this._domNode=JEt(".colorpicker-header"),D(e,this._domNode),this._pickedColorNode=D(this._domNode,JEt(".picked-color")),D(this._pickedColorNode,JEt("span.codicon.codicon-color-mode")),this._pickedColorPresentation=D(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");let r=d(1054,null);this._pickedColorNode.setAttribute("title",r),this._originalColorNode=D(this._domNode,JEt(".original-color")),this._originalColorNode.style.backgroundColor=Ue.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=o.getColorTheme().getColor(EF)||Ue.white,this._register(o.onDidColorThemeChange(s=>{this.backgroundColor=s.getColor(EF)||Ue.white})),this._register($(this._pickedColorNode,ne.CLICK,()=>this.model.selectNextColorPresentation())),this._register($(this._originalColorNode,ne.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=Ue.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.type==="standalone"&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new XEt(this._domNode)))}get domNode(){return this._domNode}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=Ue.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}};var Z4o=_,TEe=class a extends ll{constructor(e,t,o,n,r){super();this.model=t;this.pixelRatio=o;this._register(Gu.getInstance(Me(e)).onDidChange(()=>this.layout())),this._domNode=Z4o(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new ZEt(this._domNode,this.model,n,r)),this.body=this._register(new YEt(this._domNode,this.model,this.pixelRatio,r))}static{this.ID="editor.contrib.colorPickerWidget"}getId(){return a.ID}layout(){this.body.layout()}get domNode(){return this._domNode}};var eTt=class a{constructor(i,e,t,o){this.owner=i;this.range=e;this.model=t;this.provider=o;this.forceShowAtRange=!0}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}static fromBaseColor(i,e){return new a(i,e.range,e.model,e.provider)}},IJ=class{constructor(i,e){this._editor=i;this._themeService=e;this.hoverOrdinal=2}computeSync(i,e,t){return[]}computeAsync(i,e,t,o){return Fp.fromPromise(this._computeAsync(i,e,t))}async _computeAsync(i,e,t){if(!this._editor.hasModel())return[];if(!this._isValidRequest(t))return[];let o=aC.get(this._editor);if(!o)return[];for(let n of e){if(!o.isColorDecoration(n))continue;let r=o.getColorData(n.range.getStartPosition());if(r)return[eTt.fromBaseColor(this,await KEt(this._editor.getModel(),r.colorInfo,r.provider))]}return[]}_isValidRequest(i){let e=this._editor.getOption(168);switch(i){case 0:return e==="hover"||e==="clickAndHover";case 1:return e==="click"||e==="clickAndHover";case 2:return!0}}renderHoverParts(i,e){let t=this._editor;if(e.length===0||!t.hasModel())return new Yk([]);let o=t.getOption(75)+8;i.setMinimumDimensions(new di(302,o));let n=new O,r=e[0],s=t.getModel(),l=r.model;this._colorPicker=n.add(new TEe(i.fragment,l,t.getOption(163),this._themeService,"hover"));let c=!1,u=new G(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);n.add(l.onColorFlushed(async h=>{await oue(s,l,h,u,r),c=!0,u=GEt(t,u,l)})),n.add(l.onDidChangeColor(h=>{oue(s,l,h,u,r)})),n.add(t.onDidChangeModelContent(h=>{c?c=!1:(i.hide(),t.focus())}));let p={hoverPart:eTt.fromBaseColor(this,r),hoverElement:this._colorPicker.domNode,dispose(){n.dispose()}};return new Yk([p])}getAccessibleContent(i){return d(1055,null)}handleResize(){this._colorPicker?.layout()}handleContentsChanged(){this._colorPicker?.layout()}handleHide(){this._colorPicker?.dispose(),this._colorPicker=void 0}isColorPickerVisible(){return!!this._colorPicker}};IJ=I([m(1,Pe)],IJ);function Yui(a,i){return!!a[i]}var v6e=class{constructor(i,e){this.target=i.target,this.isLeftClick=i.event.leftButton,this.isMiddleClick=i.event.middleButton,this.isRightClick=i.event.rightButton,this.mouseMiddleClickAction=e.mouseMiddleClickAction,this.hasTriggerModifier=Yui(i.event,e.triggerModifier),this.isMiddleClick&&e.mouseMiddleClickAction==="ctrlLeftClick"&&(this.isMiddleClick=!1,this.isLeftClick=!0,this.hasTriggerModifier=!0),this.hasSideBySideModifier=Yui(i.event,e.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=i.event.detail<=1}},tTt=class{constructor(i,e){this.keyCodeIsTriggerKey=i.keyCode===e.triggerKey,this.keyCodeIsSideBySideKey=i.keyCode===e.triggerSideBySideKey,this.hasTriggerModifier=Yui(i,e.triggerModifier)}},_Ee=class{constructor(i,e,t,o,n){this.mouseMiddleClickAction=n;this.triggerKey=i,this.triggerModifier=e,this.triggerSideBySideKey=t,this.triggerSideBySideModifier=o}equals(i){return this.triggerKey===i.triggerKey&&this.triggerModifier===i.triggerModifier&&this.triggerSideBySideKey===i.triggerSideBySideKey&&this.triggerSideBySideModifier===i.triggerSideBySideModifier&&this.mouseMiddleClickAction===i.mouseMiddleClickAction}};function Fto(a,i){return a==="altKey"?et?new _Ee(57,"metaKey",6,"altKey",i):new _Ee(5,"ctrlKey",6,"altKey",i):et?new _Ee(6,"altKey",57,"metaKey",i):new _Ee(6,"altKey",5,"ctrlKey",i)}var i0=class extends k{constructor(e,t){super();this._onMouseMoveOrRelevantKeyDown=this._register(new T);this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event;this._onExecute=this._register(new T);this.onExecute=this._onExecute.event;this._onCancel=this._register(new T);this.onCancel=this._onCancel.event;this._editor=e,this._extractLineNumberFromMouseEvent=t?.extractLineNumberFromMouseEvent??(o=>o.target.position?o.target.position.lineNumber:0),this._opts=Fto(this._editor.getOption(86),this._editor.getOption(87)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(o=>{if(o.hasChanged(86)||o.hasChanged(87)){let n=Fto(this._editor.getOption(86),this._editor.getOption(87));if(this._opts.equals(n))return;this._opts=n,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(o=>this._onEditorMouseMove(new v6e(o,this._opts)))),this._register(this._editor.onMouseDown(o=>this._onEditorMouseDown(new v6e(o,this._opts)))),this._register(this._editor.onMouseUp(o=>this._onEditorMouseUp(new v6e(o,this._opts)))),this._register(this._editor.onKeyDown(o=>this._onEditorKeyDown(new tTt(o,this._opts)))),this._register(this._editor.onKeyUp(o=>this._onEditorKeyUp(new tTt(o,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(o=>this._onDidChangeCursorSelection(o))),this._register(this._editor.onDidChangeModel(o=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(o=>{(o.scrollTopChanged||o.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){let t=this._extractLineNumberFromMouseEvent(e);this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&(this._hasTriggerKeyOnMouseDown||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink")&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}};var b6e=class{constructor(i,e){this.range=i;this.direction=e}},Xui=class a{constructor(i,e,t){this.hint=i;this.anchor=e;this.provider=t;this._isResolved=!1}with(i){let e=new a(this.hint,i.anchor,this.provider);return e._isResolved=this._isResolved,e._currentResolve=this._currentResolve,e}async resolve(i){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,i.isCancellationRequested?void 0:this.resolve(i);this._isResolved||(this._currentResolve=this._doResolve(i).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(i){try{let e=await Promise.resolve(this.provider.resolveInlayHint(this.hint,i));this.hint.tooltip=e?.tooltip??this.hint.tooltip,this.hint.label=e?.label??this.hint.label,this.hint.textEdits=e?.textEdits??this.hint.textEdits,this._isResolved=!0}catch(e){vs(e),this._isResolved=!1}}},S6e=class a{constructor(i,e,t){this._disposables=new O;this.ranges=i,this.provider=new Set;let o=[];for(let[n,r]of e){this._disposables.add(n),this.provider.add(r);for(let s of n.hints){let l=t.validatePosition(s.position),c="before",u=a._getRangeAtPosition(t,l),p;u.getStartPosition().isBefore(l)?(p=G.fromPositions(u.getStartPosition(),l),c="after"):(p=G.fromPositions(l,u.getEndPosition()),c="before"),o.push(new Xui(s,new b6e(p,c),r))}}this.items=o.sort((n,r)=>ye.compare(n.hint.position,r.hint.position))}static{this._emptyInlayHintList=Object.freeze({dispose(){},hints:[]})}static async create(i,e,t,o){let n=[],r=i.ordered(e).reverse().map(s=>t.map(async l=>{try{let c=await s.provideInlayHints(e,l,o);(c?.hints.length||s.onDidChangeInlayHints)&&n.push([c??a._emptyInlayHintList,s])}catch(c){vs(c)}}));if(await Promise.all(r.flat()),o.isCancellationRequested||e.isDisposed())throw new qi;return new a(t,n,e)}dispose(){this._disposables.dispose()}static _getRangeAtPosition(i,e){let t=e.lineNumber,o=i.getWordAtPosition(e);if(o)return new G(t,o.startColumn,t,o.endColumn);i.tokenization.tokenizeIfCheap(t);let n=i.tokenization.getLineTokens(t),r=e.column-1,s=n.findTokenIndexAtOffset(r),l=n.getStartOffset(s),c=n.getEndOffset(s);return c-l===1&&(l===r&&s>1?(l=n.getStartOffset(s-1),c=n.getEndOffset(s-1)):c===r&&s<n.getCount()-1&&(l=n.getStartOffset(s+1),c=n.getEndOffset(s+1))),new G(t,l+1,t,c+1)}};function iTt(a){return nc(a.id,...a.arguments??[]).toString()}var Ed=class extends us{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,{...o.getRawOptions(),overflowWidgetsDomNode:o.getOverflowWidgetsDomNode()},t,n,r,s,l,c,u,p,h,g,f),this._parentEditor=o,this._overwriteOptions=e,super.updateOptions(this._overwriteOptions),this._register(o.onDidChangeConfiguration(v=>this._onParentConfigurationChanged(v)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(i){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(i){Cp(this._overwriteOptions,i,!0),super.updateOptions(this._overwriteOptions)}};Ed=I([m(4,F),m(5,Qt),m(6,fe),m(7,X),m(8,Pe),m(9,Ne),m(10,Ai),m(11,Us),m(12,Jt),m(13,ET)],Ed);function DEe(a){let i=a.get(Qt).getFocusedCodeEditor();return i instanceof Ed?i.getParentEditor():i}var Wto=new Ue(new Ut(0,122,204)),e3o={showArrow:!0,showFrame:!0,className:"",frameColor:Wto,arrowColor:Wto,keepEditorSelection:!1},t3o="vs.editor.contrib.zoneWidget",Jui=class{constructor(i,e,t,o,n,r,s,l){this.id="";this.domNode=i,this.afterLineNumber=e,this.afterColumn=t,this.heightInLines=o,this.showInHiddenAreas=s,this.ordinal=l,this._onDomNodeTop=n,this._onComputedHeight=r}onDomNodeTop(i){this._onDomNodeTop(i)}onComputedHeight(i){this._onComputedHeight(i)}},Zui=class{constructor(i,e){this._id=i,this._domNode=e}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}},epi=class a{constructor(i){this._editor=i;this._ruleName=a._IdGenerator.nextId();this._color=null;this._height=-1;this._decorations=this._editor.createDecorationsCollection()}static{this._IdGenerator=new xde(".arrow-decoration-")}dispose(){this.hide(),xF(this._ruleName)}set color(i){this._color!==i&&(this._color=i,this._updateStyle())}set height(i){this._height!==i&&(this._height=i,this._updateStyle())}_updateStyle(){xF(this._ruleName),Eg(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(i){i.column===1&&(i={lineNumber:i.lineNumber,column:2}),this._decorations.set([{range:G.fromPositions(i),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}},o0=class{constructor(i,e={}){this._arrow=null;this._overlayWidget=null;this._resizeSash=null;this._isSashResizeHeight=!1;this._viewZone=null;this._disposables=new O;this.container=null;this._isShowing=!1;this.editor=i,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=io(e),Cp(this.options,e3o,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(t=>{let o=this._getWidth(t);this.domNode.style.width=o+"px",this.domNode.style.left=this._getLeft(t)+"px",this._onWidth(o)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(i=>{this._viewZone&&i.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new epi(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(i){i.frameColor&&(this.options.frameColor=i.frameColor),i.arrowColor&&(this.options.arrowColor=i.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){let i=this.options.frameColor.toString();this.container.style.borderTopColor=i,this.container.style.borderBottomColor=i}if(this._arrow&&this.options.arrowColor){let i=this.options.arrowColor.toString();this._arrow.color=i}}_getWidth(i){return i.width-i.minimap.minimapWidth-i.verticalScrollbarWidth}_getLeft(i){return i.minimap.minimapWidth>0&&i.minimap.minimapLeft===0?i.minimap.minimapWidth:0}_onViewZoneTop(i){this.domNode.style.top=i+"px"}_onViewZoneHeight(i){if(this.domNode.style.height=`${i}px`,this.container){let e=i-this._decoratingElementsHeight();this.container.style.height=`${e}px`;let t=this.editor.getLayoutInfo();this._doLayout(e,this._getWidth(t))}this._resizeSash?.layout()}get position(){let i=this._positionMarkerId.getRange(0);if(i)return i.getStartPosition()}hasFocus(){return this.domNode.contains(Un())}show(i,e){let t=G.isIRange(i)?G.lift(i):G.fromPositions(i);this._isShowing=!0,this._showImpl(t,e),this._isShowing=!1,this._positionMarkerId.set([{range:t,options:So.EMPTY}])}updatePositionAndHeight(i,e){this._viewZone&&(i=G.isIRange(i)?G.getStartPosition(i):i,this._viewZone.afterLineNumber=i.lineNumber,this._viewZone.afterColumn=i.column,this._viewZone.heightInLines=e??this._viewZone.heightInLines,this.editor.changeViewZones(t=>{t.layoutZone(this._viewZone.id)}),this._positionMarkerId.set([{range:G.isIRange(i)?i:G.fromPositions(i),options:So.EMPTY}]),this._updateSashEnablement())}hide(){this._viewZone&&(this.editor.changeViewZones(i=>{this._viewZone&&i.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._arrow?.hide(),this._positionMarkerId.clear(),this._isSashResizeHeight=!1}_decoratingElementsHeight(){let i=this.editor.getOption(75),e=0;if(this.options.showArrow){let t=Math.round(i/3);e+=2*t}if(this.options.showFrame){let t=this.options.frameWidth??Math.round(i/9);e+=2*t}return e}_getMaximumHeightInLines(){return Math.max(12,this.editor.getLayoutInfo().height/this.editor.getOption(75)*.8)}_showImpl(i,e){let t=i.getStartPosition(),o=this.editor.getLayoutInfo(),n=this._getWidth(o);this.domNode.style.width=`${n}px`,this.domNode.style.left=this._getLeft(o)+"px";let r=document.createElement("div");r.style.overflow="hidden";let s=this.editor.getOption(75),l=this._getMaximumHeightInLines();l!==void 0&&(e=Math.min(e,l));let c=0,u=0;if(this._arrow&&this.options.showArrow&&(c=Math.round(s/3),this._arrow.height=c,this._arrow.show(t)),this.options.showFrame&&(u=Math.round(s/9)),this.editor.changeViewZones(g=>{this._viewZone&&g.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new Jui(r,t.lineNumber,t.column,e,f=>this._onViewZoneTop(f),f=>this._onViewZoneHeight(f),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=g.addZone(this._viewZone),this._overlayWidget=new Zui(t3o+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this._updateSashEnablement(),this.container&&this.options.showFrame){let g=this.options.frameWidth?this.options.frameWidth:u;this.container.style.borderTopWidth=g+"px",this.container.style.borderBottomWidth=g+"px"}let p=e*s-this._decoratingElementsHeight();this.container&&(this.container.style.top=c+"px",this.container.style.height=p+"px",this.container.style.overflow="hidden"),this._doLayout(p,n),this.options.keepEditorSelection||this.editor.setSelection(i);let h=this.editor.getModel();if(h){let g=h.validateRange(new G(i.startLineNumber,1,i.endLineNumber+1,1));this.revealRange(g,g.startLineNumber===h.getLineCount())}}revealRange(i,e){e?this.editor.revealLineNearTop(i.endLineNumber,0):this.editor.revealRange(i,0)}setCssClass(i,e){this.container&&(e&&this.container.classList.remove(e),this.container.classList.add(i))}_onWidth(i){}_doLayout(i,e){}_relayout(i,e){let t=this._getMaximumHeightInLines(),o=e&&t!==void 0?Math.min(t,i):i;this._viewZone&&this._viewZone.heightInLines!==o&&(this.editor.changeViewZones(n=>{this._viewZone&&(this._viewZone.heightInLines=o,n.layoutZone(this._viewZone.id))}),this._updateSashEnablement())}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new kh(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let i;this._disposables.add(this._resizeSash.onDidStart(e=>{this._viewZone&&(i={startY:e.startY,heightInLines:this._viewZone.heightInLines,...this._getResizeBounds()})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{i=void 0})),this._disposables.add(this._resizeSash.onDidChange(e=>{if(i){let t=(e.currentY-i.startY)/this.editor.getOption(75),o=t<0?Math.ceil(t):Math.floor(t),n=i.heightInLines+o;n>i.minLines&&n<i.maxLines&&(this._isSashResizeHeight=!0,this._relayout(n))}}))}_updateSashEnablement(){if(this._resizeSash){let{minLines:i,maxLines:e}=this._getResizeBounds();this._resizeSash.state=i===e?0:3}}get _usesResizeHeight(){return this._isSashResizeHeight}_getResizeBounds(){return{minLines:5,maxLines:35}}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){let i=this.editor.getLayoutInfo();return i.width-i.minimap.minimapWidth}};var T4=le("IPeekViewService");Ce(T4,class{constructor(){this._widgets=new Map}addExclusiveWidget(a,i){let e=this._widgets.get(a);e&&(e.listener.dispose(),e.widget.dispose());let t=()=>{let o=this._widgets.get(a);o&&o.widget===i&&(o.listener.dispose(),this._widgets.delete(a))};this._widgets.set(a,{widget:i,listener:i.onDidClose(t)})}},1);var Fg;(e=>(e.inPeekEditor=new Y("inReferenceSearchEditor",!0,d(1491,null)),e.notInPeekEditor=e.inPeekEditor.toNegated()))(Fg||={});var REe=class{static{this.ID="editor.contrib.referenceController"}constructor(i,e){i instanceof Ed&&Fg.inPeekEditor.bindTo(e)}dispose(){}};REe=I([m(1,X)],REe);Eo(REe.ID,REe,0);var i3o={headerBackgroundColor:Ue.white,primaryHeadingColor:Ue.fromHex("#333333"),secondaryHeadingColor:Ue.fromHex("#6c6c6cb3")},zT=class extends o0{constructor(e,t,o){super(e,t);this.instantiationService=o;this._onDidClose=new T;this.onDidClose=this._onDidClose.event;Cp(this.options,i3o,!1);let n=Ds(this.editor);n.openedPeekWidgets.set(n.openedPeekWidgets.get()+1,void 0)}dispose(){if(!this.disposed){this.disposed=!0,super.dispose(),this._onDidClose.fire(this),this._onDidClose.dispose();let e=Ds(this.editor);e.openedPeekWidgets.set(e.openedPeekWidgets.get()-1,void 0)}}style(e){let t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();let e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=_(".head"),this._bodyElement=_(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=_(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Yo(this._titleElement,"click",r=>this._onTitleClick(r))),D(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=_("span.filename"),this._secondaryHeading=_("span.dirname"),this._metaHeading=_("span.meta"),D(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);let o=_(".peekview-actions");D(this._headElement,o);let n=this._getActionBarOptions();this._actionbarWidget=new oo(o,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(this._disposables.add(new it("peekview.close",d(1492,null),q.asClassName(L.close),!0,()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:ta.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:St(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Xo(this._metaHeading)):Wi(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}let o=Math.ceil(this.editor.getOption(75)*1.2),n=Math.round(e-(o+1));this._doLayoutHead(o,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};zT=I([m(2,F)],zT);var ZB=te("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Ue.black,hcLight:Ue.white},d(1506,null)),n0=te("peekViewTitleLabel.foreground",{dark:Ue.white,light:Ue.black,hcDark:Ue.white,hcLight:Vd},d(1507,null)),r0=te("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},d(1508,null)),AD=te("peekView.border",{dark:eh,light:eh,hcDark:Ei,hcLight:Ei},d(1493,null)),yJ=te("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Ue.black,hcLight:Ue.white},d(1500,null)),krs=te("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Ue.white,hcLight:Vd},d(1502,null)),Ers=te("peekViewResult.fileForeground",{dark:Ue.white,light:"#1E1E1E",hcDark:Ue.white,hcLight:Vd},d(1501,null)),Trs=te("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},d(1504,null)),_rs=te("peekViewResult.selectionForeground",{dark:Ue.white,light:"#6C6C6C",hcDark:Ue.white,hcLight:Vd},d(1505,null)),tpi=te("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Ue.black,hcLight:Ue.white},d(1494,null)),Drs=te("peekViewEditorGutter.background",tpi,d(1495,null)),Rrs=te("peekViewEditorStickyScroll.background",tpi,d(1498,null)),Lrs=te("peekViewEditorStickyScrollGutter.background",tpi,d(1499,null)),Mrs=te("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},d(1503,null)),oTt=te("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},d(1496,null)),Prs=te("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:la,hcLight:la},d(1497,null));var opi=class{constructor(i,e){this.renderer=i;this.modelProvider=e}get templateId(){return this.renderer.templateId}renderTemplate(i){return{data:this.renderer.renderTemplate(i),disposable:k.None}}renderElement(i,e,t,o){if(t.disposable?.dispose(),!t.data)return;let n=this.modelProvider();if(n.isResolved(i))return this.renderer.renderElement(n.get(i),i,t.data,o);let r=new qe,s=n.resolve(i,r.token);t.disposable={dispose:()=>r.cancel()},this.renderer.renderPlaceholder(i,t.data),s.then(l=>this.renderer.renderElement(l,i,t.data,o))}disposeTemplate(i){i.disposable&&(i.disposable.dispose(),i.disposable=void 0),i.data&&(this.renderer.disposeTemplate(i.data),i.data=void 0)}},npi=class{constructor(i,e){this.modelProvider=i;this.accessibilityProvider=e}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(i){let e=this.modelProvider();return e.isResolved(i)?this.accessibilityProvider.getAriaLabel(e.get(i)):null}};function o3o(a,i){return{...i,accessibilityProvider:i.accessibilityProvider&&new npi(a,i.accessibilityProvider)}}var i2=class{constructor(i,e,t,o,n={}){this.modelDisposables=new O;let r=()=>this.model,s=o.map(l=>new opi(l,r));this.list=new Gc(i,e,t,s,o3o(r,n))}updateOptions(i){this.list.updateOptions(i)}getHTMLElement(){return this.list.getHTMLElement()}isDOMFocused(){return Na(this.getHTMLElement())}domFocus(){this.list.domFocus()}get onDidFocus(){return this.list.onDidFocus}get onDidBlur(){return this.list.onDidBlur}get widget(){return this.list}get onDidDispose(){return this.list.onDidDispose}get onMouseClick(){return U.map(this.list.onMouseClick,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onMouseDblClick(){return U.map(this.list.onMouseDblClick,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onTap(){return U.map(this.list.onTap,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onPointer(){return U.map(this.list.onPointer,({element:i,index:e,browserEvent:t})=>({element:i===void 0?void 0:this._model.get(i),index:e,browserEvent:t}))}get onDidChangeFocus(){return U.map(this.list.onDidChangeFocus,({elements:i,indexes:e,browserEvent:t})=>({elements:i.map(o=>this._model.get(o)),indexes:e,browserEvent:t}))}get onDidChangeSelection(){return U.map(this.list.onDidChangeSelection,({elements:i,indexes:e,browserEvent:t})=>({elements:i.map(o=>this._model.get(o)),indexes:e,browserEvent:t}))}get onContextMenu(){return U.map(this.list.onContextMenu,({element:i,index:e,anchor:t,browserEvent:o})=>typeof i>"u"?{element:i,index:e,anchor:t,browserEvent:o}:{element:this._model.get(i),index:e,anchor:t,browserEvent:o})}get model(){return this._model}set model(i){this.modelDisposables.clear(),this._model=i,this.list.splice(0,this.list.length,tf(i.length)),this.modelDisposables.add(i.onDidIncrementLength(e=>this.list.splice(this.list.length,0,tf(this.list.length,e))))}get length(){return this.list.length}get scrollTop(){return this.list.scrollTop}set scrollTop(i){this.list.scrollTop=i}get scrollLeft(){return this.list.scrollLeft}set scrollLeft(i){this.list.scrollLeft=i}setAnchor(i){this.list.setAnchor(i)}getAnchor(){return this.list.getAnchor()}setFocus(i){this.list.setFocus(i)}focusNext(i,e){this.list.focusNext(i,e)}focusPrevious(i,e){this.list.focusPrevious(i,e)}focusNextPage(){return this.list.focusNextPage()}focusPreviousPage(){return this.list.focusPreviousPage()}focusLast(){this.list.focusLast()}focusFirst(){this.list.focusFirst()}getFocus(){return this.list.getFocus()}setSelection(i,e){this.list.setSelection(i,e)}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(i=>this.model.get(i))}layout(i,e){this.list.layout(i,e)}triggerTypeNavigation(){this.list.triggerTypeNavigation()}reveal(i,e){this.list.reveal(i,e)}style(i){this.list.style(i)}dispose(){this.list.dispose(),this.modelDisposables.dispose()}};var n3o={separatorBorder:Ue.transparent};var nTt=class{constructor(i,e,t,o){this.container=i;this.view=e;this.disposable=o;this._cachedVisibleSize=void 0;typeof t=="number"?(this._size=t,this._cachedVisibleSize=void 0,i.classList.add("visible")):(this._size=0,this._cachedVisibleSize=t.cachedVisibleSize)}set size(i){this._size=i}get size(){return this._size}get cachedVisibleSize(){return this._cachedVisibleSize}get visible(){return typeof this._cachedVisibleSize>"u"}setVisible(i,e){if(i!==this.visible){i?(this.size=jn(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof e=="number"?e:this.size,this.size=0),this.container.classList.toggle("visible",i);try{this.view.setVisible?.(i)}catch(t){console.error("Splitview: Failed to set visible view"),console.error(t)}}}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return!!this.view.snap}set enabled(i){this.container.style.pointerEvents=i?"":"none"}layout(i,e){this.layoutContainer(i);try{this.view.layout(this.size,i,e)}catch(t){console.error("Splitview: Failed to layout view"),console.error(t)}}dispose(){this.disposable.dispose()}},rpi=class extends nTt{layoutContainer(i){this.container.style.top=`${i}px`,this.container.style.height=`${this.size}px`}},spi=class extends nTt{layoutContainer(i){this.container.style.left=`${i}px`,this.container.style.width=`${this.size}px`}};var Ac;(o=>{o.Distribute={type:"distribute"};function i(n){return{type:"split",index:n}}o.Split=i;function e(n){return{type:"auto",index:n}}o.Auto=e;function t(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=t})(Ac||={});var Gp=class extends k{constructor(e,t={}){super();this.size=0;this._contentSize=0;this.proportions=void 0;this.viewItems=[];this.sashItems=[];this.state=0;this._onDidSashChange=this._register(new T);this._onDidSashReset=this._register(new T);this._startSnappingEnabled=!0;this._endSnappingEnabled=!0;this.onDidSashChange=this._onDidSashChange.event;this.onDidSashReset=this._onDidSashReset.event;this.orientation=t.orientation??0,this.inverseAltBehavior=t.inverseAltBehavior??!1,this.proportionalLayout=t.proportionalLayout??!0,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=D(this.el,_(".sash-container")),this.viewContainer=_(".split-view-container"),this.scrollable=this._register(new hD({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>kr(Me(this.el),n)})),this.scrollableElement=this._register(new LF(this.viewContainer,{vertical:this.orientation===0?t.scrollbarVisibility??1:2,horizontal:this.orientation===1?t.scrollbarVisibility??1:2},this.scrollable));let o=this._register(new Zn(this.viewContainer,"scroll")).event;this._register(o(n=>{let r=this.scrollableElement.getScrollPosition(),s=Math.abs(this.viewContainer.scrollLeft-r.scrollLeft)<=1?void 0:this.viewContainer.scrollLeft,l=Math.abs(this.viewContainer.scrollTop-r.scrollTop)<=1?void 0:this.viewContainer.scrollTop;(s!==void 0||l!==void 0)&&this.scrollableElement.setScrollPosition({scrollLeft:s,scrollTop:l})})),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(n=>{n.scrollTopChanged&&(this.viewContainer.scrollTop=n.scrollTop),n.scrollLeftChanged&&(this.viewContainer.scrollLeft=n.scrollLeft)})),D(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||n3o),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((n,r)=>{let s=bn(n.visible)||n.visible?n.size:{type:"invisible",cachedVisibleSize:n.size},l=n.view;this.doAddView(l,s,r,!0)}),this._contentSize=this.viewItems.reduce((n,r)=>n+r.size,0),this.saveProportions())}get contentSize(){return this._contentSize}get length(){return this.viewItems.length}get minimumSize(){return this.viewItems.reduce((e,t)=>e+t.minimumSize,0)}get maximumSize(){return this.length===0?Number.POSITIVE_INFINITY:this.viewItems.reduce((e,t)=>e+t.maximumSize,0)}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(let t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(let t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}get sashes(){return this.sashItems.map(e=>e.sash)}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,o=this.viewItems.length,n){this.doAddView(e,t,o,n)}removeView(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{t?.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index});let o=t?.type==="split"?this.viewItems[t.index]:void 0,n=this.viewItems.splice(e,1)[0];if(o&&(o.size+=n.size),this.viewItems.length>=1){let s=Math.max(e-1,0);this.sashItems.splice(s,1)[0].disposable.dispose()}this.relayout(),t?.type==="distribute"&&this.distributeViewSizes();let r=n.view;return n.dispose(),r}finally{this.state=0}}removeAllViews(){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let e=this.viewItems.splice(0,this.viewItems.length);for(let o of e)o.dispose();let t=this.sashItems.splice(0,this.sashItems.length);for(let o of t)o.disposable.dispose();return this.relayout(),e.map(o=>o.view)}finally{this.state=0}}moveView(e,t){if(this.state!==0)throw new Error("Cant modify splitview");let o=this.getViewCachedVisibleSize(e),n=typeof o>"u"?this.getViewSize(e):Ac.Invisible(o),r=this.removeView(e);this.addView(r,n,t)}swapViews(e,t){if(this.state!==0)throw new Error("Cant modify splitview");if(e>t)return this.swapViews(t,e);let o=this.getViewSize(e),n=this.getViewSize(t),r=this.removeView(t),s=this.removeView(e);this.addView(r,o,e),this.addView(s,n,t)}isViewVisible(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].visible}setViewVisible(e,t){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");this.viewItems[e].setVisible(t),this.distributeEmptySpace(e),this.layoutViews(),this.saveProportions()}getViewCachedVisibleSize(e){if(e<0||e>=this.viewItems.length)throw new Error("Index out of bounds");return this.viewItems[e].cachedVisibleSize}layout(e,t){let o=Math.max(this.size,this._contentSize);if(this.size=e,this.layoutContext=t,this.proportions){let n=0;for(let r=0;r<this.viewItems.length;r++){let s=this.viewItems[r],l=this.proportions[r];typeof l=="number"?n+=l:e-=s.size}for(let r=0;r<this.viewItems.length;r++){let s=this.viewItems[r],l=this.proportions[r];typeof l=="number"&&n>0&&(s.size=jn(Math.round(l*e/n),s.minimumSize,s.maximumSize))}}else{let n=tf(this.viewItems.length),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);this.resize(this.viewItems.length-1,e-o,void 0,r,s)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this.proportions=this.viewItems.map(e=>e.proportionalLayout&&e.visible?e.size/this._contentSize:void 0))}onSashStart({sash:e,start:t,alt:o}){for(let l of this.viewItems)l.enabled=!1;let n=this.sashItems.findIndex(l=>l.sash===e),r=Fn($(this.el.ownerDocument.body,"keydown",l=>s(this.sashDragState.current,l.altKey)),$(this.el.ownerDocument.body,"keyup",()=>s(this.sashDragState.current,!1))),s=(l,c)=>{let u=this.viewItems.map(v=>v.size),p=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(c=!c),c)if(n===this.sashItems.length-1){let b=this.viewItems[n];p=(b.minimumSize-b.size)/2,h=(b.maximumSize-b.size)/2}else{let b=this.viewItems[n+1];p=(b.size-b.maximumSize)/2,h=(b.size-b.minimumSize)/2}let g,f;if(!c){let v=tf(n,-1),b=tf(n+1,this.viewItems.length),S=v.reduce((H,K)=>H+(this.viewItems[K].minimumSize-u[K]),0),y=v.reduce((H,K)=>H+(this.viewItems[K].viewMaximumSize-u[K]),0),w=b.length===0?Number.POSITIVE_INFINITY:b.reduce((H,K)=>H+(u[K]-this.viewItems[K].minimumSize),0),x=b.length===0?Number.NEGATIVE_INFINITY:b.reduce((H,K)=>H+(u[K]-this.viewItems[K].viewMaximumSize),0),E=Math.max(S,x),M=Math.min(w,y),N=this.findFirstSnapIndex(v),V=this.findFirstSnapIndex(b);if(typeof N=="number"){let H=this.viewItems[N],K=Math.floor(H.viewMinimumSize/2);g={index:N,limitDelta:H.visible?E-K:E+K,size:H.size}}if(typeof V=="number"){let H=this.viewItems[V],K=Math.floor(H.viewMinimumSize/2);f={index:V,limitDelta:H.visible?M+K:M-K,size:H.size}}}this.sashDragState={start:l,current:l,index:n,sizes:u,minDelta:p,maxDelta:h,alt:c,snapBefore:g,snapAfter:f,disposable:r}};s(t,o)}onSashChange({current:e}){let{index:t,start:o,sizes:n,alt:r,minDelta:s,maxDelta:l,snapBefore:c,snapAfter:u}=this.sashDragState;this.sashDragState.current=e;let p=e-o,h=this.resize(t,p,n,void 0,void 0,s,l,c,u);if(r){let g=t===this.sashItems.length-1,f=this.viewItems.map(x=>x.size),v=g?t:t+1,b=this.viewItems[v],S=b.size-b.maximumSize,y=b.size-b.minimumSize,w=g?t-1:t+1;this.resize(w,-h,f,void 0,void 0,S,y)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(let t of this.viewItems)t.enabled=!0}onViewChange(e,t){let o=this.viewItems.indexOf(e);o<0||o>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=jn(t,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&o>0?(this.resize(o-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([o],void 0)))}resizeView(e,t){if(!(e<0||e>=this.viewItems.length)){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let o=tf(this.viewItems.length).filter(l=>l!==e),n=[...o.filter(l=>this.viewItems[l].priority===1),e],r=o.filter(l=>this.viewItems[l].priority===2),s=this.viewItems[e];t=Math.round(t),t=jn(t,s.minimumSize,Math.min(s.maximumSize,this.size)),s.size=t,this.relayout(n,r)}finally{this.state=0}}}isViewExpanded(e){if(e<0||e>=this.viewItems.length)return!1;for(let t of this.viewItems)if(t!==this.viewItems[e]&&t.size>t.minimumSize)return!1;return!0}distributeViewSizes(){let e=[],t=0;for(let l of this.viewItems)l.maximumSize-l.minimumSize>0&&(e.push(l),t+=l.size);let o=Math.floor(t/e.length);for(let l of e)l.size=jn(o,l.minimumSize,l.maximumSize);let n=tf(this.viewItems.length),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);this.relayout(r,s)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,o=this.viewItems.length,n){if(this.state!==0)throw new Error("Cant modify splitview");this.state=1;try{let r=_(".split-view-view");o===this.viewItems.length?this.viewContainer.appendChild(r):this.viewContainer.insertBefore(r,this.viewContainer.children.item(o));let s=e.onDidChange(g=>this.onViewChange(p,g)),l=ee(()=>r.remove()),c=Fn(s,l),u;typeof t=="number"?u=t:(t.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index}),t.type==="split"?u=this.getViewSize(t.index)/2:t.type==="invisible"?u={cachedVisibleSize:t.cachedVisibleSize}:u=e.minimumSize);let p=this.orientation===0?new rpi(r,e,u,c):new spi(r,e,u,c);if(this.viewItems.splice(o,0,p),this.viewItems.length>1){let g={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},f=this.orientation===0?new kh(this.sashContainer,{getHorizontalSashTop:H=>this.getSashPosition(H),getHorizontalSashWidth:this.getSashOrthogonalSize},{...g,orientation:1}):new kh(this.sashContainer,{getVerticalSashLeft:H=>this.getSashPosition(H),getVerticalSashHeight:this.getSashOrthogonalSize},{...g,orientation:0}),v=this.orientation===0?H=>({sash:f,start:H.startY,current:H.currentY,alt:H.altKey}):H=>({sash:f,start:H.startX,current:H.currentX,alt:H.altKey}),S=U.map(f.onDidStart,v)(this.onSashStart,this),w=U.map(f.onDidChange,v)(this.onSashChange,this),E=U.map(f.onDidEnd,()=>this.sashItems.findIndex(H=>H.sash===f))(this.onSashEnd,this),M=f.onDidReset(()=>{let H=this.sashItems.findIndex(ae=>ae.sash===f),K=tf(H,-1),j=tf(H+1,this.viewItems.length),J=this.findFirstSnapIndex(K),se=this.findFirstSnapIndex(j);typeof J=="number"&&!this.viewItems[J].visible||typeof se=="number"&&!this.viewItems[se].visible||this._onDidSashReset.fire(H)}),N=Fn(S,w,E,M,f),V={sash:f,disposable:N};this.sashItems.splice(o-1,0,V)}r.appendChild(e.element);let h;typeof t!="number"&&t.type==="split"&&(h=[t.index]),n||this.relayout([o],h),!n&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}finally{this.state=0}}relayout(e,t){let o=this.viewItems.reduce((n,r)=>n+r.size,0);this.resize(this.viewItems.length-1,this.size-o,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,o=this.viewItems.map(p=>p.size),n,r,s=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,c,u){if(e<0||e>=this.viewItems.length)return 0;let p=tf(e,-1),h=tf(e+1,this.viewItems.length);if(r)for(let V of r)Svt(p,V),Svt(h,V);if(n)for(let V of n)X5e(p,V),X5e(h,V);let g=p.map(V=>this.viewItems[V]),f=p.map(V=>o[V]),v=h.map(V=>this.viewItems[V]),b=h.map(V=>o[V]),S=p.reduce((V,H)=>V+(this.viewItems[H].minimumSize-o[H]),0),y=p.reduce((V,H)=>V+(this.viewItems[H].maximumSize-o[H]),0),w=h.length===0?Number.POSITIVE_INFINITY:h.reduce((V,H)=>V+(o[H]-this.viewItems[H].minimumSize),0),x=h.length===0?Number.NEGATIVE_INFINITY:h.reduce((V,H)=>V+(o[H]-this.viewItems[H].maximumSize),0),E=Math.max(S,x,s),M=Math.min(w,y,l),N=!1;if(c){let V=this.viewItems[c.index],H=t>=c.limitDelta;N=H!==V.visible,V.setVisible(H,c.size)}if(!N&&u){let V=this.viewItems[u.index],H=t<u.limitDelta;N=H!==V.visible,V.setVisible(H,u.size)}if(N)return this.resize(e,t,o,n,r,s,l);t=jn(t,E,M);for(let V=0,H=t;V<g.length;V++){let K=g[V],j=jn(f[V]+H,K.minimumSize,K.maximumSize),J=j-f[V];H-=J,K.size=j}for(let V=0,H=t;V<v.length;V++){let K=v[V],j=jn(b[V]-H,K.minimumSize,K.maximumSize),J=j-b[V];H+=J,K.size=j}return t}distributeEmptySpace(e){let t=this.viewItems.reduce((l,c)=>l+c.size,0),o=this.size-t,n=tf(this.viewItems.length-1,-1),r=n.filter(l=>this.viewItems[l].priority===1),s=n.filter(l=>this.viewItems[l].priority===2);for(let l of s)Svt(n,l);for(let l of r)X5e(n,l);typeof e=="number"&&X5e(n,e);for(let l=0;o!==0&&l<n.length;l++){let c=this.viewItems[n[l]],u=jn(c.size+o,c.minimumSize,c.maximumSize),p=u-c.size;o-=p,c.size=u}}layoutViews(){this._contentSize=this.viewItems.reduce((t,o)=>t+o.size,0);let e=0;for(let t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach(t=>t.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this._contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this._contentSize})}updateSashEnablement(){let e=!1,t=this.viewItems.map(c=>e=c.size-c.minimumSize>0||e);e=!1;let o=this.viewItems.map(c=>e=c.maximumSize-c.size>0||e),n=[...this.viewItems].reverse();e=!1;let r=n.map(c=>e=c.size-c.minimumSize>0||e).reverse();e=!1;let s=n.map(c=>e=c.maximumSize-c.size>0||e).reverse(),l=0;for(let c=0;c<this.sashItems.length;c++){let{sash:u}=this.sashItems[c],p=this.viewItems[c];l+=p.size;let h=!(t[c]&&s[c+1]),g=!(o[c]&&r[c+1]);if(h&&g){let f=tf(c,-1),v=tf(c+1,this.viewItems.length),b=this.findFirstSnapIndex(f),S=this.findFirstSnapIndex(v),y=typeof b=="number"&&!this.viewItems[b].visible,w=typeof S=="number"&&!this.viewItems[S].visible;y&&r[c]&&(l>0||this.startSnappingEnabled)?u.state=1:w&&t[c]&&(l<this._contentSize||this.endSnappingEnabled)?u.state=2:u.state=0}else h&&!g?u.state=1:!h&&g?u.state=2:u.state=3}}getSashPosition(e){let t=0;for(let o=0;o<this.sashItems.length;o++)if(t+=this.viewItems[o].size,this.sashItems[o].sash===e)return t;return 0}findFirstSnapIndex(e){for(let t of e){let o=this.viewItems[t];if(o.visible&&o.snap)return t}for(let t of e){let o=this.viewItems[t];if(o.visible&&o.maximumSize-o.minimumSize>0)return;if(!o.visible&&o.snap)return t}}areViewsDistributed(){let e,t;for(let o of this.viewItems)if(e=e===void 0?o.size:Math.min(e,o.size),t=t===void 0?o.size:Math.max(t,o.size),t-e>2)return!1;return!0}dispose(){this.sashDragState?.disposable.dispose(),je(this.viewItems),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[],super.dispose()}};var rTt=class a{constructor(i,e,t){this.columns=i;this.getColumnSize=t;this.templateId=a.TemplateId;this.renderedTemplates=new Set;let o=new Map(e.map(n=>[n.templateId,n]));this.renderers=[];for(let n of i){let r=o.get(n.templateId);if(!r)throw new Error(`Table cell renderer for template id ${n.templateId} not found.`);this.renderers.push(r)}}static{this.TemplateId="row"}renderTemplate(i){let e=D(i,_(".monaco-table-tr")),t=[],o=[];for(let r=0;r<this.columns.length;r++){let s=this.renderers[r],l=D(e,_(".monaco-table-td",{"data-col-index":r}));l.style.width=`${this.getColumnSize(r)}px`,t.push(l),o.push(s.renderTemplate(l))}let n={container:i,cellContainers:t,cellTemplateData:o};return this.renderedTemplates.add(n),n}renderElement(i,e,t,o){for(let n=0;n<this.columns.length;n++){let s=this.columns[n].project(i);this.renderers[n].renderElement(s,e,t.cellTemplateData[n],o)}}disposeElement(i,e,t,o){for(let n=0;n<this.columns.length;n++){let r=this.renderers[n];if(r.disposeElement){let l=this.columns[n].project(i);r.disposeElement(l,e,t.cellTemplateData[n],o)}}}disposeTemplate(i){for(let e=0;e<this.columns.length;e++)this.renderers[e].disposeTemplate(i.cellTemplateData[e]);St(i.container),this.renderedTemplates.delete(i)}layoutColumn(i,e){for(let{cellContainers:t}of this.renderedTemplates)t[i].style.width=`${e}px`}};function r3o(a){return{getHeight(i){return a.getHeight(i)},getTemplateId(){return rTt.TemplateId}}}var api=class extends k{constructor(e,t){super();this.column=e;this.index=t;this._onDidLayout=this._register(new T);this.onDidLayout=this._onDidLayout.event;this.element=_(".monaco-table-th",{"data-col-index":t},e.label),e.tooltip&&this._register(sp().setupManagedHover(yi("mouse"),this.element,e.tooltip))}get minimumSize(){return this.column.minimumWidth??120}get maximumSize(){return this.column.maximumWidth??Number.POSITIVE_INFINITY}get onDidChange(){return this.column.onDidChangeWidthConstraints??U.None}layout(e){this._onDidLayout.fire([this.index,e])}},s0=class a{constructor(i,e,t,o,n,r){this.virtualDelegate=t;this.columns=o;this.domId=`table_id_${++a.InstanceCount}`;this.disposables=new O;this.cachedWidth=0;this.cachedHeight=0;this.domNode=D(e,_(`.monaco-table.${this.domId}`));let s=o.map((u,p)=>this.disposables.add(new api(u,p))),l={size:s.reduce((u,p)=>u+p.column.weight,0),views:s.map(u=>({size:u.column.weight,view:u}))};this.splitview=this.disposables.add(new Gp(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:l})),this.splitview.el.style.height=`${t.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${t.headerRowHeight}px`;let c=new rTt(o,n,u=>this.splitview.getViewSize(u));this.list=this.disposables.add(new Gc(i,this.domNode,r3o(t),[c],r)),U.any(...s.map(u=>u.onDidLayout))(([u,p])=>c.layoutColumn(u,p),null,this.disposables),this.splitview.onDidSashReset(u=>{let p=o.reduce((g,f)=>g+f.weight,0),h=o[u].weight/p*this.cachedWidth;this.splitview.resizeView(u,h)},null,this.disposables),this.styleElement=Pr(this.domNode),this.style(qxt)}static{this.InstanceCount=0}get onDidChangeFocus(){return this.list.onDidChangeFocus}get onDidChangeSelection(){return this.list.onDidChangeSelection}get onDidScroll(){return this.list.onDidScroll}get onMouseClick(){return this.list.onMouseClick}get onMouseDblClick(){return this.list.onMouseDblClick}get onMouseMiddleClick(){return this.list.onMouseMiddleClick}get onPointer(){return this.list.onPointer}get onMouseUp(){return this.list.onMouseUp}get onMouseDown(){return this.list.onMouseDown}get onMouseOver(){return this.list.onMouseOver}get onMouseMove(){return this.list.onMouseMove}get onMouseOut(){return this.list.onMouseOut}get onTouchStart(){return this.list.onTouchStart}get onTap(){return this.list.onTap}get onContextMenu(){return this.list.onContextMenu}get onDidFocus(){return this.list.onDidFocus}get onDidBlur(){return this.list.onDidBlur}get scrollTop(){return this.list.scrollTop}set scrollTop(i){this.list.scrollTop=i}get scrollLeft(){return this.list.scrollLeft}set scrollLeft(i){this.list.scrollLeft=i}get scrollHeight(){return this.list.scrollHeight}get renderHeight(){return this.list.renderHeight}get onDidDispose(){return this.list.onDidDispose}getColumnLabels(){return this.columns.map(i=>i.label)}resizeColumn(i,e){let t=Math.round(e/100*this.cachedWidth);this.splitview.resizeView(i,t)}updateOptions(i){this.list.updateOptions(i)}splice(i,e,t=[]){this.list.splice(i,e,t)}rerender(){this.list.rerender()}row(i){return this.list.element(i)}indexOf(i){return this.list.indexOf(i)}get length(){return this.list.length}getHTMLElement(){return this.domNode}layout(i,e){i=i??Mwe(this.domNode),e=e??xY(this.domNode),this.cachedWidth=e,this.cachedHeight=i,this.splitview.layout(e);let t=i-this.virtualDelegate.headerRowHeight;this.list.getHTMLElement().style.height=`${t}px`,this.list.layout(t,e)}triggerTypeNavigation(){this.list.triggerTypeNavigation()}style(i){let e=[];e.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before {
			top: ${this.virtualDelegate.headerRowHeight+1}px;
			height: calc(100% - ${this.virtualDelegate.headerRowHeight}px);
		}`),this.styleElement.textContent=e.join(`
`),this.list.style(i)}domFocus(){this.list.domFocus()}setAnchor(i){this.list.setAnchor(i)}getAnchor(){return this.list.getAnchor()}getSelectedElements(){return this.list.getSelectedElements()}setSelection(i,e){this.list.setSelection(i,e)}getSelection(){return this.list.getSelection()}setFocus(i,e){this.list.setFocus(i,e)}focusNext(i=1,e=!1,t){this.list.focusNext(i,e,t)}focusPrevious(i=1,e=!1,t){this.list.focusPrevious(i,e,t)}focusNextPage(i){return this.list.focusNextPage(i)}focusPreviousPage(i){return this.list.focusPreviousPage(i)}focusFirst(i){this.list.focusFirst(i)}focusLast(i){this.list.focusLast(i)}getFocus(){return this.list.getFocus()}getFocusedElements(){return this.list.getFocusedElements()}getRelativeTop(i){return this.list.getRelativeTop(i)}reveal(i,e){this.list.reveal(i,e)}dispose(){this.disposables.dispose()}};var mf=class extends Error{constructor(i,e){super(`TreeError [${i}] ${e}`)}},nue=class{constructor(i){this.fn=i;this._map=new WeakMap}map(i){let e=this._map.get(i);return e||(e=this.fn(i),this._map.set(i,e)),e}};function wJ(a){return!!a&&a.visibility!==void 0}function o2(a){switch(a){case!0:return 1;case!1:return 0;default:return a}}function lpi(a){return"collapsible"in a}var sTt=class{constructor(i,e,t={}){this.user=i;this.rootRef=[];this.eventBufferer=new JO;this._onDidSpliceModel=new T;this.onDidSpliceModel=this._onDidSpliceModel.event;this._onDidSpliceRenderedNodes=new T;this.onDidSpliceRenderedNodes=this._onDidSpliceRenderedNodes.event;this._onDidChangeCollapseState=new T;this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event);this._onDidChangeRenderNodeCount=new T;this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event);this.refilterDelayer=new rn(EL);this.collapseByDefault=typeof t.collapseByDefault>"u"?!1:t.collapseByDefault,this.allowNonCollapsibleParents=t.allowNonCollapsibleParents??!1,this.filter=t.filter,this.autoExpandSingleChildren=typeof t.autoExpandSingleChildren>"u"?!1:t.autoExpandSingleChildren,this.root={parent:void 0,element:e,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(i,e,t=yt.empty(),o={}){if(i.length===0)throw new mf(this.user,"Invalid tree location");o.diffIdentityProvider?this.spliceSmart(o.diffIdentityProvider,i,e,t,o):this.spliceSimple(i,e,t,o)}spliceSmart(i,e,t,o=yt.empty(),n,r=n.diffDepth??0){let{parentNode:s}=this.getParentNodeWithListIndex(e);if(!s.lastDiffIds)return this.spliceSimple(e,t,o,n);let l=[...o],c=e[e.length-1],u=new kA({getElements:()=>s.lastDiffIds},{getElements:()=>[...s.children.slice(0,c),...l,...s.children.slice(c+t)].map(v=>i.getId(v.element).toString())}).ComputeDiff(!1);if(u.quitEarly)return s.lastDiffIds=void 0,this.spliceSimple(e,t,l,n);let p=e.slice(0,-1),h=(v,b,S)=>{if(r>0)for(let y=0;y<S;y++)v--,b--,this.spliceSmart(i,[...p,v,0],Number.MAX_SAFE_INTEGER,l[b].children,n,r-1)},g=Math.min(s.children.length,c+t),f=l.length;for(let v of u.changes.sort((b,S)=>S.originalStart-b.originalStart))h(g,f,g-(v.originalStart+v.originalLength)),g=v.originalStart,f=v.modifiedStart-c,this.spliceSimple([...p,g],v.originalLength,yt.slice(l,f,f+v.modifiedLength),n);h(g,f,g)}spliceSimple(i,e,t=yt.empty(),{onDidCreateNode:o,onDidDeleteNode:n,diffIdentityProvider:r}){let{parentNode:s,listIndex:l,revealed:c,visible:u}=this.getParentNodeWithListIndex(i),p=[],h=yt.map(t,E=>this.createTreeNode(E,s,s.visible?1:0,c,p,o)),g=i[i.length-1],f=0;for(let E=g;E>=0&&E<s.children.length;E--){let M=s.children[E];if(M.visible){f=M.visibleChildIndex;break}}let v=[],b=0,S=0;for(let E of h)v.push(E),S+=E.renderNodeCount,E.visible&&(E.visibleChildIndex=f+b++);let y=yle(s.children,g,e,v);r?s.lastDiffIds?yle(s.lastDiffIds,g,e,v.map(E=>r.getId(E.element).toString())):s.lastDiffIds=s.children.map(E=>r.getId(E.element).toString()):s.lastDiffIds=void 0;let w=0;for(let E of y)E.visible&&w++;if(w!==0)for(let E=g+v.length;E<s.children.length;E++){let M=s.children[E];M.visible&&(M.visibleChildIndex-=w)}if(s.visibleChildrenCount+=b-w,y.length>0&&n){let E=M=>{n(M),M.children.forEach(E)};y.forEach(E)}if(c&&u){let E=y.reduce((M,N)=>M+(N.visible?N.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(s,S-E),this._onDidSpliceRenderedNodes.fire({start:l,deleteCount:E,elements:p})}this._onDidSpliceModel.fire({insertedNodes:v,deletedNodes:y});let x=s;for(;x;){if(x.visibility===2){this.refilterDelayer.trigger(()=>this.refilter());break}x=x.parent}}rerender(i){if(i.length===0)throw new mf(this.user,"Invalid tree location");let{node:e,listIndex:t,revealed:o}=this.getTreeNodeWithListIndex(i);e.visible&&o&&this._onDidSpliceRenderedNodes.fire({start:t,deleteCount:1,elements:[e]})}has(i){return this.hasTreeNode(i)}getListIndex(i){let{listIndex:e,visible:t,revealed:o}=this.getTreeNodeWithListIndex(i);return t&&o?e:-1}getListRenderCount(i){return this.getTreeNode(i).renderNodeCount}isCollapsible(i){return this.getTreeNode(i).collapsible}setCollapsible(i,e){let t=this.getTreeNode(i);typeof e>"u"&&(e=!t.collapsible);let o={collapsible:e};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(i,o))}isCollapsed(i){return this.getTreeNode(i).collapsed}setCollapsed(i,e,t){let o=this.getTreeNode(i);typeof e>"u"&&(e=!o.collapsed);let n={collapsed:e,recursive:t||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(i,n))}_setCollapseState(i,e){let{node:t,listIndex:o,revealed:n}=this.getTreeNodeWithListIndex(i),r=this._setListNodeCollapseState(t,o,n,e);if(t!==this.root&&this.autoExpandSingleChildren&&r&&!lpi(e)&&t.collapsible&&!t.collapsed&&!e.recursive){let s=-1;for(let l=0;l<t.children.length;l++)if(t.children[l].visible)if(s>-1){s=-1;break}else s=l;s>-1&&this._setCollapseState([...i,s],e)}return r}_setListNodeCollapseState(i,e,t,o){let n=this._setNodeCollapseState(i,o,!1);if(!t||!i.visible||!n)return n;let r=i.renderNodeCount,s=this.updateNodeAfterCollapseChange(i),l=r-(e===-1?0:1);return this._onDidSpliceRenderedNodes.fire({start:e+1,deleteCount:l,elements:s.slice(1)}),n}_setNodeCollapseState(i,e,t){let o;if(i===this.root?o=!1:(lpi(e)?(o=i.collapsible!==e.collapsible,i.collapsible=e.collapsible):i.collapsible?(o=i.collapsed!==e.collapsed,i.collapsed=e.collapsed):o=!1,o&&this._onDidChangeCollapseState.fire({node:i,deep:t})),!lpi(e)&&e.recursive)for(let n of i.children)o=this._setNodeCollapseState(n,e,!0)||o;return o}expandTo(i){this.eventBufferer.bufferEvents(()=>{let e=this.getTreeNode(i);for(;e.parent;)e=e.parent,i=i.slice(0,i.length-1),e.collapsed&&this._setCollapseState(i,{collapsed:!1,recursive:!1})})}refilter(){let i=this.root.renderNodeCount,e=this.updateNodeAfterFilterChange(this.root);this._onDidSpliceRenderedNodes.fire({start:0,deleteCount:i,elements:e}),this.refilterDelayer.cancel()}createTreeNode(i,e,t,o,n,r){let s={parent:e,element:i.element,children:[],depth:e.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof i.collapsible=="boolean"?i.collapsible:typeof i.collapsed<"u",collapsed:typeof i.collapsed>"u"?this.collapseByDefault:i.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},l=this._filterNode(s,t);s.visibility=l,o&&n.push(s);let c=i.children||yt.empty(),u=o&&l!==0&&!s.collapsed,p=0,h=1;for(let g of c){let f=this.createTreeNode(g,s,l,u,n,r);s.children.push(f),h+=f.renderNodeCount,f.visible&&(f.visibleChildIndex=p++)}return this.allowNonCollapsibleParents||(s.collapsible=s.collapsible||s.children.length>0),s.visibleChildrenCount=p,s.visible=l===2?p>0:l===1,s.visible?s.collapsed||(s.renderNodeCount=h):(s.renderNodeCount=0,o&&n.pop()),r?.(s),s}updateNodeAfterCollapseChange(i){let e=i.renderNodeCount,t=[];return this._updateNodeAfterCollapseChange(i,t),this._updateAncestorsRenderNodeCount(i.parent,t.length-e),t}_updateNodeAfterCollapseChange(i,e){if(i.visible===!1)return 0;if(e.push(i),i.renderNodeCount=1,!i.collapsed)for(let t of i.children)i.renderNodeCount+=this._updateNodeAfterCollapseChange(t,e);return this._onDidChangeRenderNodeCount.fire(i),i.renderNodeCount}updateNodeAfterFilterChange(i){let e=i.renderNodeCount,t=[];return this._updateNodeAfterFilterChange(i,i.visible?1:0,t),this._updateAncestorsRenderNodeCount(i.parent,t.length-e),t}_updateNodeAfterFilterChange(i,e,t,o=!0){let n;if(i!==this.root){if(n=this._filterNode(i,e),n===0)return i.visible=!1,i.renderNodeCount=0,!1;o&&t.push(i)}let r=t.length;i.renderNodeCount=i===this.root?0:1;let s=!1;if(!i.collapsed||n!==0){let l=0;for(let c of i.children)s=this._updateNodeAfterFilterChange(c,n,t,o&&!i.collapsed)||s,c.visible&&(c.visibleChildIndex=l++);i.visibleChildrenCount=l}else i.visibleChildrenCount=0;return i!==this.root&&(i.visible=n===2?s:n===1,i.visibility=n),i.visible?i.collapsed||(i.renderNodeCount+=t.length-r):(i.renderNodeCount=0,o&&t.pop()),this._onDidChangeRenderNodeCount.fire(i),i.visible}_updateAncestorsRenderNodeCount(i,e){if(e!==0)for(;i;)i.renderNodeCount+=e,this._onDidChangeRenderNodeCount.fire(i),i=i.parent}_filterNode(i,e){let t=this.filter?this.filter.filter(i.element,e):1;return typeof t=="boolean"?(i.filterData=void 0,t?1:0):wJ(t)?(i.filterData=t.data,o2(t.visibility)):(i.filterData=void 0,o2(t))}hasTreeNode(i,e=this.root){if(!i||i.length===0)return!0;let[t,...o]=i;return t<0||t>e.children.length?!1:this.hasTreeNode(o,e.children[t])}getTreeNode(i,e=this.root){if(!i||i.length===0)return e;let[t,...o]=i;if(t<0||t>e.children.length)throw new mf(this.user,"Invalid tree location");return this.getTreeNode(o,e.children[t])}getTreeNodeWithListIndex(i){if(i.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};let{parentNode:e,listIndex:t,revealed:o,visible:n}=this.getParentNodeWithListIndex(i),r=i[i.length-1];if(r<0||r>e.children.length)throw new mf(this.user,"Invalid tree location");let s=e.children[r];return{node:s,listIndex:t,revealed:o,visible:n&&s.visible}}getParentNodeWithListIndex(i,e=this.root,t=0,o=!0,n=!0){let[r,...s]=i;if(r<0||r>e.children.length)throw new mf(this.user,"Invalid tree location");for(let l=0;l<r;l++)t+=e.children[l].renderNodeCount;return o=o&&!e.collapsed,n=n&&e.visible,s.length===0?{parentNode:e,listIndex:t,revealed:o,visible:n}:this.getParentNodeWithListIndex(s,e.children[r],t+1,o,n)}getNode(i=[]){return this.getTreeNode(i)}getNodeLocation(i){let e=[],t=i;for(;t.parent;)e.push(t.parent.children.indexOf(t)),t=t.parent;return e.reverse()}getParentNodeLocation(i){if(i.length!==0)return i.length===1?[]:Rf(i)[0]}getFirstElementChild(i){let e=this.getTreeNode(i);if(e.children.length!==0)return e.children[0].element}getLastElementAncestor(i=[]){let e=this.getTreeNode(i);if(e.children.length!==0)return this._getLastElementAncestor(e)}_getLastElementAncestor(i){return i.children.length===0?i.element:this._getLastElementAncestor(i.children[i.children.length-1])}};var dpi=class extends Yw{constructor(e){super(e.elements.map(t=>t.element));this.data=e}set context(e){this.data.context=e}get context(){return this.data.context}};function cpi(a){return a instanceof Yw?new dpi(a):a}var upi=class{constructor(i,e){this.modelProvider=i;this.dnd=e;this.autoExpandDisposable=k.None;this.disposables=new O}getDragURI(i){return this.dnd.getDragURI(i.element)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i.map(t=>t.element),e)}onDragStart(i,e){this.dnd.onDragStart?.(cpi(i),e)}onDragOver(i,e,t,o,n,r=!0){let s=this.dnd.onDragOver(cpi(i),e&&e.element,t,o,n),l=this.autoExpandNode!==e;if(l&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=e),typeof e>"u")return s;if(l&&typeof s!="boolean"&&s.autoExpand&&(this.autoExpandDisposable=Zo(()=>{let g=this.modelProvider(),f=g.getNodeLocation(e);g.isCollapsed(f)&&g.setCollapsed(f,!1),this.autoExpandNode=void 0},500,this.disposables)),typeof s=="boolean"||!s.accept||typeof s.bubble>"u"||s.feedback){if(!r){let g=typeof s=="boolean"?s:s.accept,f=typeof s=="boolean"?void 0:s.effect;return{accept:g,effect:f,feedback:[t]}}return s}if(s.bubble===1){let g=this.modelProvider(),f=g.getNodeLocation(e),v=g.getParentNodeLocation(f),b=g.getNode(v),S=v&&g.getListIndex(v);return this.onDragOver(i,b,S,o,n,!1)}let c=this.modelProvider(),u=c.getNodeLocation(e),p=c.getListIndex(u),h=c.getListRenderCount(u);return{...s,feedback:tf(p,p+h)}}drop(i,e,t,o,n){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(cpi(i),e&&e.element,t,o,n)}onDragEnd(i){this.dnd.onDragEnd?.(i)}dispose(){this.disposables.dispose(),this.dnd.dispose()}};function s3o(a,i,e){return e&&{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(t.element)},getGroupId:e.identityProvider.getGroupId?t=>e.identityProvider.getGroupId(t.element):void 0},dnd:e.dnd&&i.add(new upi(a,e.dnd)),multipleSelectionController:e.multipleSelectionController&&{isSelectionSingleChangeEvent(t){return e.multipleSelectionController.isSelectionSingleChangeEvent({...t,element:t.element})},isSelectionRangeChangeEvent(t){return e.multipleSelectionController.isSelectionRangeChangeEvent({...t,element:t.element})}},accessibilityProvider:e.accessibilityProvider&&{...e.accessibilityProvider,getSetSize(t){let o=a(),n=o.getNodeLocation(t),r=o.getParentNodeLocation(n);return o.getNode(r).visibleChildrenCount},getPosInSet(t){return t.visibleChildIndex+1},isChecked:e.accessibilityProvider&&e.accessibilityProvider.isChecked?t=>e.accessibilityProvider.isChecked(t.element):void 0,getRole:e.accessibilityProvider&&e.accessibilityProvider.getRole?t=>e.accessibilityProvider.getRole(t.element):()=>"treeitem",getAriaLabel(t){return e.accessibilityProvider.getAriaLabel(t.element)},getWidgetAriaLabel(){return e.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:e.accessibilityProvider&&e.accessibilityProvider.getWidgetRole?()=>e.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:e.accessibilityProvider&&e.accessibilityProvider.getAriaLevel?t=>e.accessibilityProvider.getAriaLevel(t.element):t=>t.depth,getActiveDescendantId:e.accessibilityProvider.getActiveDescendantId&&(t=>e.accessibilityProvider.getActiveDescendantId(t.element))},keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(t){return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t.element)}}}}var LEe=class{constructor(i){this.delegate=i}getHeight(i){return this.delegate.getHeight(i.element)}getTemplateId(i){return this.delegate.getTemplateId(i.element)}hasDynamicHeight(i){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(i.element)}setDynamicHeight(i,e){this.delegate.setDynamicHeight?.(i.element,e)}},y6e=class a{static lift(i){return i instanceof a?i:new a(i)}static empty(i=0){return new a({focus:[],selection:[],expanded:Object.create(null),scrollTop:i})}constructor(i){if(this.focus=new Set(i.focus),this.selection=new Set(i.selection),i.expanded instanceof Array){this.expanded=Object.create(null);for(let e of i.expanded)this.expanded[e]=1}else this.expanded=i.expanded;this.expanded=i.expanded,this.scrollTop=i.scrollTop}toJSON(){return{focus:Array.from(this.focus),selection:Array.from(this.selection),expanded:this.expanded,scrollTop:this.scrollTop}}};var ppi=class{constructor(i,e=[]){this._elements=e;this.disposables=new O;this.onDidChange=U.forEach(i,t=>this._elements=t,this.disposables)}get elements(){return this._elements}dispose(){this.disposables.dispose()}},mpi=class a{constructor(i,e,t,o,n,r={}){this.renderer=i;this.model=e;this.activeNodes=o;this.renderedIndentGuides=n;this.renderedElements=new Map;this.renderedNodes=new Map;this.indent=a.DefaultIndent;this.defaultIndent=a.DefaultIndent;this.hideTwistiesOfChildlessElements=!1;this.shouldRenderIndentGuides=!1;this.activeIndentNodes=new Set;this.indentGuidesDisposable=k.None;this.disposables=new O;this.templateId=i.templateId,this.updateOptions(r),U.map(t,s=>s.node)(this.onDidChangeNodeTwistieState,this,this.disposables),i.onDidChangeTwistieState?.(this.onDidChangeTwistieState,this,this.disposables)}static{this.DefaultIndent=8}updateOptions(i={}){if(typeof i.defaultIndent<"u"&&(this.defaultIndent=i.defaultIndent),typeof i.indent<"u"||typeof i.defaultIndent<"u"){let e=typeof i.indent<"u"?jn(i.indent,0,40):this.indent;if(e!==this.indent||typeof i.defaultIndent<"u"){this.indent=e;for(let[o,n]of this.renderedNodes)n.indentSize=this.defaultIndent+(o.depth-1)*this.indent,this.renderTreeElement(o,n)}}if(typeof i.renderIndentGuides<"u"){let e=i.renderIndentGuides!=="none";if(e!==this.shouldRenderIndentGuides){this.shouldRenderIndentGuides=e;for(let[t,o]of this.renderedNodes)this._renderIndentGuides(t,o);if(this.indentGuidesDisposable.dispose(),e){let t=new O;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,t),this.indentGuidesDisposable=t,this._onDidChangeActiveNodes(this.activeNodes.elements)}}}typeof i.hideTwistiesOfChildlessElements<"u"&&(this.hideTwistiesOfChildlessElements=i.hideTwistiesOfChildlessElements),typeof i.twistieAdditionalCssClass<"u"&&(this.twistieAdditionalCssClass=i.twistieAdditionalCssClass)}renderTemplate(i){let e=D(i,_(".monaco-tl-row")),t=D(e,_(".monaco-tl-indent")),o=D(e,_(".monaco-tl-twistie")),n=D(e,_(".monaco-tl-contents")),r=this.renderer.renderTemplate(n);return{container:i,indent:t,twistie:o,indentGuidesDisposable:k.None,indentSize:0,templateData:r}}renderElement(i,e,t,o){t.indentSize=this.defaultIndent+(i.depth-1)*this.indent,this.renderedNodes.set(i,t),this.renderedElements.set(i.element,i),this.renderTreeElement(i,t),this.renderer.renderElement(i,e,t.templateData,{...o,indent:t.indentSize})}disposeElement(i,e,t,o){t.indentGuidesDisposable.dispose(),this.renderer.disposeElement?.(i,e,t.templateData,{...o,indent:t.indentSize}),typeof o?.height=="number"&&(this.renderedNodes.delete(i),this.renderedElements.delete(i.element))}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}onDidChangeTwistieState(i){let e=this.renderedElements.get(i);e&&this.onDidChangeNodeTwistieState(e)}onDidChangeNodeTwistieState(i){let e=this.renderedNodes.get(i);e&&(this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderTreeElement(i,e))}renderTreeElement(i,e){e.twistie.className=e.twistie.classList.item(0),e.twistie.style.paddingLeft=`${e.indentSize}px`,e.indent.style.width=`${e.indentSize+this.indent-16}px`,i.collapsible?e.container.setAttribute("aria-expanded",String(!i.collapsed)):e.container.removeAttribute("aria-expanded"),e.twistie.classList.remove(...q.asClassNameArray(L.treeItemExpanded));let t=!1;if(this.renderer.renderTwistie&&(t=this.renderer.renderTwistie(i.element,e.twistie)),i.collapsible&&(!this.hideTwistiesOfChildlessElements||i.visibleChildrenCount>0)?(t||e.twistie.classList.add(...q.asClassNameArray(L.treeItemExpanded)),e.twistie.classList.add("collapsible"),e.twistie.classList.toggle("collapsed",i.collapsed)):e.twistie.classList.remove("collapsible","collapsed"),this.twistieAdditionalCssClass){let o=this.twistieAdditionalCssClass(i.element);o&&e.twistie.classList.add(o)}this._renderIndentGuides(i,e)}_renderIndentGuides(i,e){if(St(e.indent),e.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;let t=new O;for(;;){let o=this.model.getNodeLocation(i),n=this.model.getParentNodeLocation(o);if(!n)break;let r=this.model.getNode(n),s=_(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(r)&&s.classList.add("active"),e.indent.childElementCount===0?e.indent.appendChild(s):e.indent.insertBefore(s,e.indent.firstElementChild),this.renderedIndentGuides.add(r,s),t.add(ee(()=>this.renderedIndentGuides.delete(r,s))),i=r}e.indentGuidesDisposable=t}_onDidChangeActiveNodes(i){if(!this.shouldRenderIndentGuides)return;let e=new Set;i.forEach(t=>{let o=this.model.getNodeLocation(t);try{let n=this.model.getParentNodeLocation(o);t.collapsible&&t.children.length>0&&!t.collapsed?e.add(t):n&&e.add(this.model.getNode(n))}catch{}}),this.activeIndentNodes.forEach(t=>{e.has(t)||this.renderedIndentGuides.forEach(t,o=>o.classList.remove("active"))}),e.forEach(t=>{this.activeIndentNodes.has(t)||this.renderedIndentGuides.forEach(t,o=>o.classList.add("active"))}),this.activeIndentNodes=e}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),je(this.disposables)}};function a3o(a,i){let e=i.toLowerCase().indexOf(a),t;if(e>-1){t=[Number.MAX_SAFE_INTEGER,0];for(let o=a.length;o>0;o--)t.push(e+o-1)}return t}var w6e=class{constructor(i,e,t){this._keyboardNavigationLabelProvider=i;this._filter=e;this._defaultFindVisibility=t;this._totalCount=0;this._matchCount=0;this._findMatchType=0;this._findMode=0;this._pattern="";this._lowercasePattern="";this.disposables=new O}get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}set findMatchType(i){this._findMatchType=i}get findMatchType(){return this._findMatchType}set findMode(i){this._findMode=i}get findMode(){return this._findMode}set pattern(i){this._pattern=i,this._lowercasePattern=i.toLowerCase()}filter(i,e){let t=1;if(this._filter){let r=this._filter.filter(i,e);if(typeof r=="boolean"?t=r?1:0:wJ(r)?t=o2(r.visibility):t=r,t===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:Xv.Default,visibility:t};let o=this._keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i),n=Array.isArray(o)?o:[o];for(let r of n){let s=r&&r.toString();if(typeof s>"u")return{data:Xv.Default,visibility:t};let l;if(this._findMatchType===1?l=a3o(this._lowercasePattern,s.toLowerCase()):l=eM(this._pattern,this._lowercasePattern,0,s,s.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0}),l)return this._matchCount++,n.length===1?{data:l,visibility:t}:{data:{label:s,score:l},visibility:t}}return this._findMode===1?typeof this._defaultFindVisibility=="number"?this._defaultFindVisibility:this._defaultFindVisibility?this._defaultFindVisibility(i):2:{data:Xv.Default,visibility:t}}reset(){this._totalCount=0,this._matchCount=0}dispose(){je(this.disposables)}},hpi=class extends Lm{constructor(i,e,t){super({icon:i.icon,title:i.title,isChecked:i.isChecked,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground,hoverLifecycleOptions:t}),this.id=i.id}},gpi=class{constructor(i){this.stateMap=new Map(i.map(e=>[e.id,{...e}]))}states(){return Array.from(this.stateMap.values())}get(i){let e=this.stateMap.get(i);if(e===void 0)throw new Error(`No state found for toggle id ${i}`);return e.isChecked}set(i,e){let t=this.stateMap.get(i);if(t===void 0)throw new Error(`No state found for toggle id ${i}`);return t.isChecked===e?!1:(t.isChecked=e,!0)}},l3o={inputBoxStyles:xto,toggleStyles:fJ,listFilterWidgetBackground:void 0,listFilterWidgetNoMatchesOutline:void 0,listFilterWidgetOutline:void 0,listFilterWidgetShadow:void 0};var fpi=class extends k{constructor(e,t,o,n,r=[],s){super();this.tree=t;this.elements=st(".monaco-tree-type-filter",[st(".monaco-tree-type-filter-input@findInput"),st(".monaco-tree-type-filter-actionbar@actionbar")]);this.toggles=[];this._onDidDisable=this._register(new T);this.onDidDisable=this._onDidDisable.event;e.appendChild(this.elements.root),this._register(ee(()=>this.elements.root.remove()));let l=s?.styles??l3o;l.listFilterWidgetBackground&&(this.elements.root.style.backgroundColor=l.listFilterWidgetBackground),l.listFilterWidgetShadow&&(this.elements.root.style.boxShadow=`0 0 8px 2px ${l.listFilterWidgetShadow}`);let c={groupId:"abstract-tree"};this.toggles=r.map(f=>this._register(new hpi(f,l.toggleStyles,c))),this.onDidToggleChange=U.any(...this.toggles.map(f=>U.map(f.onChange,()=>({id:f.id,isChecked:f.checked}))));let u=s?.history||[];this.findInput=this._register(new QK(this.elements.findInput,o,{label:d(42,null),placeholder:n,additionalToggles:this.toggles,showCommonFindToggles:!1,inputBoxStyles:l.inputBoxStyles,toggleStyles:l.toggleStyles,history:new Set(u),hoverLifecycleOptions:c})),this.actionbar=this._register(new oo(this.elements.actionbar));let p=this._register(new Zn(this.findInput.inputBox.inputElement,"keydown")),h=U.chain(p.event,f=>f.map(v=>new mi(v)));this._register(h(f=>{if(f.equals(3)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.addToHistory(),this.tree.domFocus();return}if(f.equals(18)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.isAtLastInHistory()||this.findInput.inputBox.isNowhereInHistory()?(this.findInput.inputBox.addToHistory(),this.tree.domFocus()):this.findInput.inputBox.showNextValue();return}if(f.equals(16)){f.preventDefault(),f.stopPropagation(),this.findInput.inputBox.showPreviousValue();return}}));let g=this._register(new it("close",d(33,null),"codicon codicon-close",!0,()=>this.dispose()));this.actionbar.push(g,{icon:!0,label:!1}),this.onDidChangeValue=this.findInput.onDidChange}get value(){return this.findInput.inputBox.value}set value(e){this.findInput.inputBox.value=e}setToggleState(e,t){let o=this.toggles.find(n=>n.id===e);o&&(o.checked=t)}setPlaceHolder(e){this.findInput.inputBox.setPlaceHolder(e)}getHistory(){return this.findInput.inputBox.getHistory()}focus(){this.findInput.focus()}select(){this.findInput.select(),this.findInput.inputBox.addToHistory(!0)}showMessage(e){this.findInput.showMessage(e)}clearMessage(){this.findInput.clearMessage()}async dispose(){this._onDidDisable.fire(),this.elements.root.classList.add("disabled"),await Li(300),super.dispose()}};var vpi=class{constructor(i,e,t,o={}){this.tree=i;this.filter=e;this.contextViewProvider=t;this.options=o;this._pattern="";this.previousPattern="";this._onDidChangePattern=new T;this.onDidChangePattern=this._onDidChangePattern.event;this._onDidChangeOpenState=new T;this.onDidChangeOpenState=this._onDidChangeOpenState.event;this.enabledDisposables=new O;this.disposables=new O;this.toggles=new gpi(o.toggles??[]),this._placeholder=o.placeholder??d(42,null)}get pattern(){return this._pattern}get placeholder(){return this._placeholder}set placeholder(i){this._placeholder=i,this.widget?.setPlaceHolder(i)}isOpened(){return!!this.widget}open(){if(this.widget){this.widget.focus(),this.widget.select();return}let i=this.options.findWidgetContainer??this.tree.getHTMLElement();this.options.findWidgetContainer||this.tree.updateOptions({paddingTop:30}),this.widget=new fpi(i,this.tree,this.contextViewProvider,this.placeholder,this.toggles.states(),{...this.options,history:this._history}),this.enabledDisposables.add(this.widget),this.widget.onDidChangeValue(this.onDidChangeValue,this,this.enabledDisposables),this.widget.onDidDisable(this.close,this,this.enabledDisposables),this.widget.onDidToggleChange(this.onDidToggleChange,this,this.enabledDisposables),this.widget.focus(),this.widget.value=this.previousPattern,this.widget.select(),this._onDidChangeOpenState.fire(!0)}close(){this.widget&&(this.options.findWidgetContainer||this.tree.updateOptions({paddingTop:0}),this._history=this.widget.getHistory(),this.widget=void 0,this.enabledDisposables.clear(),this.previousPattern=this.pattern,this.onDidChangeValue(""),this.tree.domFocus(),this._onDidChangeOpenState.fire(!1))}onDidChangeValue(i){this._pattern=i,this._onDidChangePattern.fire(i),this.filter.pattern=i,this.applyPattern(i)}onDidToggleChange(i){this.toggles.set(i.id,i.isChecked)}updateToggleState(i,e){this.toggles.set(i,e),this.widget?.setToggleState(i,e)}renderMessage(i,e){i?this.tree.options.showNotFoundMessage??!0?this.widget?.showMessage({type:2,content:e??d(37,null)}):this.widget?.showMessage({type:2}):this.widget?.clearMessage()}alertResults(i){i?cn(d(35,null,i)):cn(d(38,null))}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}},C6e=class extends vpi{constructor(e,t,o,n={}){let r=n.defaultFindMode??0,s=n.defaultFindMatchType??0,l=[{id:"mode",icon:L.listFilter,title:d(34,null),isChecked:r===1},{id:"matchType",icon:L.searchFuzzy,title:d(36,null),isChecked:s===0}];t.findMatchType=s,t.findMode=r;super(e,t,o,{...n,toggles:l});this.filter=t;this._onDidChangeMode=new T;this.onDidChangeMode=this._onDidChangeMode.event;this._onDidChangeMatchType=new T;this.onDidChangeMatchType=this._onDidChangeMatchType.event;this.disposables.add(this.tree.onDidChangeModel(()=>{this.isOpened()&&(this.pattern.length!==0&&this.tree.refilter(),this.render())})),this.disposables.add(this.tree.onWillRefilter(()=>this.filter.reset()))}get mode(){return this.toggles.get("mode")?1:0}set mode(e){if(e===this.mode)return;let t=e===1;this.updateToggleState("mode",t),this.placeholder=t?d(41,null):d(42,null),this.filter.findMode=e,this.tree.refilter(),this.render(),this._onDidChangeMode.fire(e)}get matchType(){return this.toggles.get("matchType")?0:1}set matchType(e){e!==this.matchType&&(this.updateToggleState("matchType",e===0),this.filter.findMatchType=e,this.tree.refilter(),this.render(),this._onDidChangeMatchType.fire(e))}updateOptions(e={}){e.defaultFindMode!==void 0&&(this.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.matchType=e.defaultFindMatchType)}applyPattern(e){this.tree.refilter(),e&&this.tree.focusNext(0,!0,void 0,o=>!Xv.isDefault(o.filterData));let t=this.tree.getFocus();if(t.length>0){let o=t[0];this.tree.getRelativeTop(o)===null&&this.tree.reveal(o,.5)}this.render()}shouldAllowFocus(e){return!this.isOpened()||!this.pattern||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!Xv.isDefault(e.filterData)}onDidToggleChange(e){e.id==="mode"?this.mode=e.isChecked?1:0:e.id==="matchType"&&(this.matchType=e.isChecked?0:1)}render(){let t=this.filter.matchCount===0&&this.filter.totalCount>0&&this.pattern.length>0;this.renderMessage(t),this.pattern.length&&this.alertResults(this.filter.matchCount)}};function c3o(a,i){return a.position===i.position&&Hto(a,i)}function Hto(a,i){return a.node.element===i.node.element&&a.startIndex===i.startIndex&&a.height===i.height&&a.endIndex===i.endIndex}var bpi=class{constructor(i=[]){this.stickyNodes=i}get count(){return this.stickyNodes.length}equal(i){return eo(this.stickyNodes,i.stickyNodes,c3o)}contains(i){return this.stickyNodes.some(e=>e.node.element===i.element)}lastNodePartiallyVisible(){if(this.count===0)return!1;let i=this.stickyNodes[this.count-1];if(this.count===1)return i.position!==0;let e=this.stickyNodes[this.count-2];return e.position+e.height!==i.position}animationStateChanged(i){if(!eo(this.stickyNodes,i.stickyNodes,Hto)||this.count===0)return!1;let e=this.stickyNodes[this.count-1],t=i.stickyNodes[i.count-1];return e.position!==t.position}},Spi=class{constrainStickyScrollNodes(i,e,t){for(let o=0;o<i.length;o++){let n=i[o];if(n.position+n.height>t||o>=e)return i.slice(0,o)}return i}},lTt=class extends k{constructor(e,t,o,n,r,s={}){super();this.tree=e;this.model=t;this.view=o;this.treeDelegate=r;this.maxWidgetViewRatio=.4;let l=this.validateStickySettings(s);this.stickyScrollMaxItemCount=l.stickyScrollMaxItemCount,this.stickyScrollDelegate=s.stickyScrollDelegate??new Spi,this.paddingTop=s.paddingTop??0,this._widget=this._register(new Ipi(o.getScrollableElement(),o,e,n,r,s.accessibilityProvider)),this.onDidChangeHasFocus=this._widget.onDidChangeHasFocus,this.onContextMenu=this._widget.onContextMenu,this._register(o.onDidScroll(()=>this.update())),this._register(o.onDidChangeContentHeight(()=>this.update())),this._register(e.onDidChangeCollapseState(()=>this.update())),this._register(t.onDidSpliceRenderedNodes(c=>{let u=this._widget.state;if(!u)return;if(c.deleteCount>0&&u.stickyNodes.some(g=>!this.model.has(this.model.getNodeLocation(g.node)))){this.update();return}u.stickyNodes.some(g=>{let f=this.model.getListIndex(this.model.getNodeLocation(g.node));return f>=c.start&&f<c.start+c.deleteCount&&u.contains(g.node)})&&this._widget.rerender()})),this.update()}get height(){return this._widget.height}get count(){return this._widget.count}getNode(e){return this._widget.getNode(e)}getNodeAtHeight(e){let t;if(e===0?t=this.view.firstVisibleIndex:t=this.view.indexAt(e+this.view.scrollTop),!(t<0||t>=this.view.length))return this.view.element(t)}update(){let e=this.getNodeAtHeight(this.paddingTop);if(!e||this.tree.scrollTop<=this.paddingTop||this.view.renderHeight===0){this._widget.setState(void 0);return}let t=this.findStickyState(e);this._widget.setState(t)}findStickyState(e){let t=[],o=e,n=0,r=this.getNextStickyNode(o,void 0,n);for(;r&&(t.push(r),n+=r.height,!(t.length<=this.stickyScrollMaxItemCount&&(o=this.getNextVisibleNode(r),!o)));)r=this.getNextStickyNode(o,r.node,n);let s=this.constrainStickyNodes(t);return s.length?new bpi(s):void 0}getNextVisibleNode(e){return this.getNodeAtHeight(e.position+e.height)}getNextStickyNode(e,t,o){let n=this.getAncestorUnderPrevious(e,t);if(n&&!(n===e&&(!this.nodeIsUncollapsedParent(e)||this.nodeTopAlignsWithStickyNodesBottom(e,o))))return this.createStickyScrollNode(n,o)}nodeTopAlignsWithStickyNodesBottom(e,t){let o=this.getNodeIndex(e),n=this.view.getElementTop(o),r=t;return this.view.scrollTop===n-r}createStickyScrollNode(e,t){let o=this.treeDelegate.getHeight(e),{startIndex:n,endIndex:r}=this.getNodeRange(e),s=this.calculateStickyNodePosition(r,t,o);return{node:e,position:s,height:o,startIndex:n,endIndex:r}}getAncestorUnderPrevious(e,t=void 0){let o=e,n=this.getParentNode(o);for(;n;){if(n===t)return o;o=n,n=this.getParentNode(o)}if(t===void 0)return o}calculateStickyNodePosition(e,t,o){let n=this.view.getRelativeTop(e);if(n===null&&this.view.firstVisibleIndex===e&&e+1<this.view.length){let u=this.treeDelegate.getHeight(this.view.element(e)),p=this.view.getRelativeTop(e+1);n=p?p-u/this.view.renderHeight:null}if(n===null)return t;let r=this.view.element(e),s=this.treeDelegate.getHeight(r),c=n*this.view.renderHeight+s;return t+o>c&&t<=c?c-o:t}constrainStickyNodes(e){if(e.length===0)return[];let t=this.view.renderHeight*this.maxWidgetViewRatio,o=e[e.length-1];if(e.length<=this.stickyScrollMaxItemCount&&o.position+o.height<=t)return e;let n=this.stickyScrollDelegate.constrainStickyScrollNodes(e,this.stickyScrollMaxItemCount,t);if(!n.length)return[];let r=n[n.length-1];if(n.length>this.stickyScrollMaxItemCount||r.position+r.height>t)throw new Error("stickyScrollDelegate violates constraints");return n}getParentNode(e){let t=this.model.getNodeLocation(e),o=this.model.getParentNodeLocation(t);return o?this.model.getNode(o):void 0}nodeIsUncollapsedParent(e){let t=this.model.getNodeLocation(e);return this.model.getListRenderCount(t)>1}getNodeIndex(e){let t=this.model.getNodeLocation(e);return this.model.getListIndex(t)}getNodeRange(e){let t=this.model.getNodeLocation(e),o=this.model.getListIndex(t);if(o<0)throw new Error("Node not found in tree");let n=this.model.getListRenderCount(t),r=o+n-1;return{startIndex:o,endIndex:r}}nodePositionTopBelowWidget(e){let t=[],o=this.getParentNode(e);for(;o;)t.push(o),o=this.getParentNode(o);let n=0;for(let r=0;r<t.length&&r<this.stickyScrollMaxItemCount;r++)n+=this.treeDelegate.getHeight(t[r]);return n}getFocus(){return this._widget.getFocus()}domFocus(){this._widget.domFocus()}focusedLast(){return this._widget.focusedLast()}updateOptions(e={}){if(e.paddingTop!==void 0&&(this.paddingTop=e.paddingTop),e.stickyScrollMaxItemCount!==void 0){let t=this.validateStickySettings(e);this.stickyScrollMaxItemCount!==t.stickyScrollMaxItemCount&&(this.stickyScrollMaxItemCount=t.stickyScrollMaxItemCount,this.update())}}validateStickySettings(e){let t=7;return typeof e.stickyScrollMaxItemCount=="number"&&(t=Math.max(e.stickyScrollMaxItemCount,1)),{stickyScrollMaxItemCount:t}}},Ipi=class{constructor(i,e,t,o,n,r){this.view=e;this.tree=t;this.treeRenderers=o;this.treeDelegate=n;this.accessibilityProvider=r;this._previousElements=[];this._previousStateDisposables=new O;this._rootDomNode=_(".monaco-tree-sticky-container.empty"),i.appendChild(this._rootDomNode);let s=_(".monaco-tree-sticky-container-shadow");this._rootDomNode.appendChild(s),this.stickyScrollFocus=new ypi(this._rootDomNode,e),this.onDidChangeHasFocus=this.stickyScrollFocus.onDidChangeHasFocus,this.onContextMenu=this.stickyScrollFocus.onContextMenu}get state(){return this._previousState}get height(){if(!this._previousState)return 0;let i=this._previousState.stickyNodes[this._previousState.count-1];return i.position+i.height}get count(){return this._previousState?.count??0}getNode(i){return this._previousState?.stickyNodes.find(e=>e.node===i)}setState(i){let e=!!this._previousState&&this._previousState.count>0,t=!!i&&i.count>0;if(!e&&!t||e&&t&&this._previousState.equal(i))return;if(e!==t&&this.setVisible(t),!t){this._previousState=void 0,this._previousElements=[],this._previousStateDisposables.clear();return}let o=i.stickyNodes[i.count-1];this._previousState&&i.animationStateChanged(this._previousState)?this._previousElements[this._previousState.count-1].style.top=`${o.position}px`:this.renderState(i),this._previousState=i,this._rootDomNode.style.height=`${o.position+o.height}px`}renderState(i){this._previousStateDisposables.clear();let e=Array(i.count);for(let t=i.count-1;t>=0;t--){let o=i.stickyNodes[t],{element:n,disposable:r}=this.createElement(o,t,i.count);e[t]=n,this._rootDomNode.appendChild(n),this._previousStateDisposables.add(r)}this.stickyScrollFocus.updateElements(e,i),this._previousElements=e}rerender(){this._previousState&&this.renderState(this._previousState)}createElement(i,e,t){let o=i.startIndex,n=document.createElement("div");n.style.top=`${i.position}px`,this.tree.options.setRowHeight!==!1&&(n.style.height=`${i.height}px`),this.tree.options.setRowLineHeight!==!1&&(n.style.lineHeight=`${i.height}px`),n.classList.add("monaco-tree-sticky-row"),n.classList.add("monaco-list-row"),n.setAttribute("data-index",`${o}`),n.setAttribute("data-parity",o%2===0?"even":"odd"),n.setAttribute("id",this.view.getElementID(o));let r=this.setAccessibilityAttributes(n,i.node.element,e,t),s=this.treeDelegate.getTemplateId(i.node),l=this.treeRenderers.find(h=>h.templateId===s);if(!l)throw new Error(`No renderer found for template id ${s}`);let c=i.node;c===this.tree.getNode(this.tree.getNodeLocation(i.node))&&(c=new Proxy(i.node,{}));let u=l.renderTemplate(n);l.renderElement(c,i.startIndex,u,{height:i.height});let p=ee(()=>{r.dispose(),l.disposeElement(c,i.startIndex,u,{height:i.height}),l.disposeTemplate(u),n.remove()});return{element:n,disposable:p}}setAccessibilityAttributes(i,e,t,o){if(!this.accessibilityProvider)return k.None;this.accessibilityProvider.getSetSize&&i.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e,t,o))),this.accessibilityProvider.getPosInSet&&i.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e,t))),this.accessibilityProvider.getRole&&i.setAttribute("role",this.accessibilityProvider.getRole(e)??"treeitem");let n=this.accessibilityProvider.getAriaLabel(e),r=n&&typeof n!="string"?n:Fo(n),s=ve(c=>{let u=c.readObservable(r);u?i.setAttribute("aria-label",u):i.removeAttribute("aria-label")});typeof n=="string"||n&&i.setAttribute("aria-label",n.get());let l=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);return typeof l=="number"&&i.setAttribute("aria-level",`${l}`),i.setAttribute("aria-selected",String(!1)),s}setVisible(i){this._rootDomNode.classList.toggle("empty",!i),i||this.stickyScrollFocus.updateElements([],void 0)}getFocus(){return this.stickyScrollFocus.getFocus()}domFocus(){this.stickyScrollFocus.domFocus()}focusedLast(){return this.stickyScrollFocus.focusedLast()}dispose(){this.stickyScrollFocus.dispose(),this._previousStateDisposables.dispose(),this._rootDomNode.remove()}},ypi=class extends k{constructor(e,t){super();this.container=e;this.view=t;this.focusedIndex=-1;this.elements=[];this._onDidChangeHasFocus=this._register(new T);this.onDidChangeHasFocus=this._onDidChangeHasFocus.event;this._onContextMenu=this._register(new T);this.onContextMenu=this._onContextMenu.event;this._domHasFocus=!1;this._register($(this.container,"focus",()=>this.onFocus())),this._register($(this.container,"blur",()=>this.onBlur())),this._register(this.view.onDidFocus(()=>this.toggleStickyScrollFocused(!1))),this._register(this.view.onKeyDown(o=>this.onKeyDown(o))),this._register(this.view.onMouseDown(o=>this.onMouseDown(o))),this._register(this.view.onContextMenu(o=>this.handleContextMenu(o)))}get domHasFocus(){return this._domHasFocus}set domHasFocus(e){e!==this._domHasFocus&&(this._onDidChangeHasFocus.fire(e),this._domHasFocus=e)}handleContextMenu(e){let t=e.browserEvent.target;if(!Ske(t)&&!bke(t)){this.focusedLast()&&this.view.domFocus();return}if(!sf(e.browserEvent)){if(!this.state)throw new Error("Context menu should not be triggered when state is undefined");let s=this.state.stickyNodes.findIndex(l=>l.node.element===e.element?.element);if(s===-1)throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");this.container.focus(),this.setFocus(s);return}if(!this.state||this.focusedIndex<0)throw new Error("Context menu key should not be triggered when focus is not in sticky scroll widget");let n=this.state.stickyNodes[this.focusedIndex].node.element,r=this.elements[this.focusedIndex];this._onContextMenu.fire({element:n,anchor:r,browserEvent:e.browserEvent,isStickyScroll:!0})}onKeyDown(e){if(this.domHasFocus&&this.state){if(e.key==="ArrowUp")this.setFocusedElement(Math.max(0,this.focusedIndex-1)),e.preventDefault(),e.stopPropagation();else if(e.key==="ArrowDown"||e.key==="ArrowRight"){if(this.focusedIndex>=this.state.count-1){let t=this.state.stickyNodes[this.state.count-1].startIndex+1;this.view.domFocus(),this.view.setFocus([t]),this.scrollNodeUnderWidget(t,this.state)}else this.setFocusedElement(this.focusedIndex+1);e.preventDefault(),e.stopPropagation()}}}onMouseDown(e){let t=e.browserEvent.target;!Ske(t)&&!bke(t)||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation())}updateElements(e,t){if(t&&t.count===0)throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");if(t&&t.count!==e.length)throw new Error("Sticky scroll focus received illigel state");let o=this.focusedIndex;if(this.removeFocus(),this.elements=e,this.state=t,t){let n=jn(o,0,t.count-1);this.setFocus(n)}else this.domHasFocus&&this.view.domFocus();this.container.tabIndex=t?0:-1}setFocusedElement(e){let t=this.state;if(!t)throw new Error("Cannot set focus when state is undefined");if(this.setFocus(e),!(e<t.count-1)&&t.lastNodePartiallyVisible()){let o=t.stickyNodes[e];this.scrollNodeUnderWidget(o.endIndex+1,t)}}scrollNodeUnderWidget(e,t){let o=t.stickyNodes[t.count-1],n=t.count>1?t.stickyNodes[t.count-2]:void 0,r=this.view.getElementTop(e),s=n?n.position+n.height+o.height:o.height;this.view.scrollTop=r-s}getFocus(){if(!(!this.state||this.focusedIndex===-1))return this.state.stickyNodes[this.focusedIndex].node.element}domFocus(){if(!this.state)throw new Error("Cannot focus when state is undefined");this.container.focus()}focusedLast(){return this.state?this.view.getHTMLElement().classList.contains("sticky-scroll-focused"):!1}removeFocus(){this.focusedIndex!==-1&&(this.toggleElementFocus(this.elements[this.focusedIndex],!1),this.focusedIndex=-1)}setFocus(e){if(0>e)throw new Error("addFocus() can not remove focus");if(!this.state&&e>=0)throw new Error("Cannot set focus index when state is undefined");if(this.state&&e>=this.state.count)throw new Error("Cannot set focus index to an index that does not exist");let t=this.focusedIndex;t>=0&&this.toggleElementFocus(this.elements[t],!1),e>=0&&this.toggleElementFocus(this.elements[e],!0),this.focusedIndex=e}toggleElementFocus(e,t){this.toggleElementActiveFocus(e,t&&this.domHasFocus),this.toggleElementPassiveFocus(e,t)}toggleCurrentElementActiveFocus(e){this.focusedIndex!==-1&&this.toggleElementActiveFocus(this.elements[this.focusedIndex],e)}toggleElementActiveFocus(e,t){e.classList.toggle("focused",t)}toggleElementPassiveFocus(e,t){e.classList.toggle("passive-focused",t)}toggleStickyScrollFocused(e){this.view.getHTMLElement().classList.toggle("sticky-scroll-focused",e)}onFocus(){if(!this.state||this.elements.length===0)throw new Error("Cannot focus when state is undefined or elements are empty");this.domHasFocus=!0,this.toggleStickyScrollFocused(!0),this.toggleCurrentElementActiveFocus(!0),this.focusedIndex===-1&&this.setFocus(0)}onBlur(){this.domHasFocus=!1,this.toggleCurrentElementActiveFocus(!1)}dispose(){this.toggleStickyScrollFocused(!1),this._onDidChangeHasFocus.fire(!1),super.dispose()}};function rue(a){let i=0;return Awe(a.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?i=1:Awe(a.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?i=2:Awe(a.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(i=3),{browserEvent:a.browserEvent,element:a.element?a.element.element:null,target:i}}function d3o(a){let i=Ske(a.browserEvent.target);return{element:a.element?a.element.element:null,browserEvent:a.browserEvent,anchor:a.anchor,isStickyScroll:i}}function aTt(a,i){i(a),a.children.forEach(e=>aTt(e,i))}var I6e=class{constructor(i,e){this.getFirstViewElementWithTrait=i;this.identityProvider=e;this.nodes=[];this._onDidChange=new T;this.onDidChange=this._onDidChange.event}get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}set(i,e){!e?.__forceEvent&&eo(this.nodes,i)||this._set(i,!1,e)}_set(i,e,t){if(this.nodes=[...i],this.elements=void 0,this._nodeSet=void 0,!e){let o=this;this._onDidChange.fire({get elements(){return o.get()},browserEvent:t})}}get(){return this.elements||(this.elements=this.nodes.map(i=>i.element)),[...this.elements]}getNodes(){return this.nodes}has(i){return this.nodeSet.has(i)}onDidModelSplice({insertedNodes:i,deletedNodes:e}){if(!this.identityProvider){let l=this.createNodeSet(),c=u=>l.delete(u);e.forEach(u=>aTt(u,c)),this.set([...l.values()]);return}let t=new Set,o=l=>t.add(this.identityProvider.getId(l.element).toString());e.forEach(l=>aTt(l,o));let n=new Map,r=l=>n.set(this.identityProvider.getId(l.element).toString(),l);i.forEach(l=>aTt(l,r));let s=[];for(let l of this.nodes){let c=this.identityProvider.getId(l.element).toString();if(!t.has(c))s.push(l);else{let p=n.get(c);p&&p.visible&&s.push(p)}}if(this.nodes.length>0&&s.length===0){let l=this.getFirstViewElementWithTrait();l&&s.push(l)}this._set(s,!0)}createNodeSet(){let i=new Set;for(let e of this.nodes)i.add(e);return i}},wpi=class extends yde{constructor(e,t,o){super(e);this.tree=t;this.stickyScrollProvider=o}onViewPointer(e){if(Lci(e.browserEvent.target)||Ch(e.browserEvent.target)||zX(e.browserEvent.target)||e.browserEvent.isHandledByList)return;let t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);let o=e.browserEvent.target,n=o.classList.contains("monaco-tl-twistie")||o.classList.contains("monaco-icon-label")&&o.classList.contains("folder-icon")&&e.browserEvent.offsetX<16,r=bke(e.browserEvent.target),s=!1;if(r?s=!0:typeof this.tree.expandOnlyOnTwistieClick=="function"?s=this.tree.expandOnlyOnTwistieClick(t.element):s=!!this.tree.expandOnlyOnTwistieClick,r)this.handleStickyScrollMouseEvent(e,t);else{if(s&&!n&&e.browserEvent.detail!==2)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&e.browserEvent.detail===2)return super.onViewPointer(e)}if(t.collapsible&&(!r||n)){let l=this.tree.getNodeLocation(t),c=e.browserEvent.altKey;if(this.tree.setFocus([l]),this.tree.toggleCollapsed(l,c),n){e.browserEvent.isHandledByList=!0;return}}r||super.onViewPointer(e)}handleStickyScrollMouseEvent(e,t){if(BJi(e.browserEvent.target)||HJi(e.browserEvent.target))return;let o=this.stickyScrollProvider();if(!o)throw new Error("Sticky scroll controller not found");let n=this.list.indexOf(t),r=this.list.getElementTop(n),s=o.nodePositionTopBelowWidget(t);this.tree.scrollTop=r-s,this.list.domFocus(),this.list.setFocus([n]),this.list.setSelection([n])}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||e.browserEvent.isHandledByList||super.onDoubleClick(e)}onMouseDown(e){let t=e.browserEvent.target;if(!Ske(t)&&!bke(t)){super.onMouseDown(e);return}}onContextMenu(e){let t=e.browserEvent.target;if(!Ske(t)&&!bke(t)){super.onContextMenu(e);return}}},Cpi=class extends Gc{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,c);this.focusTrait=r;this.selectionTrait=s;this.anchorTrait=l}createMouseController(e){return new wpi(this,e.tree,e.stickyScrollProvider)}splice(e,t,o=[]){if(super.splice(e,t,o),o.length===0)return;let n=[],r=[],s;o.forEach((l,c)=>{this.focusTrait.has(l)&&n.push(e+c),this.selectionTrait.has(l)&&r.push(e+c),this.anchorTrait.has(l)&&(s=e+c)}),n.length>0&&super.setFocus(jo([...super.getFocus(),...n])),r.length>0&&super.setSelection(jo([...super.getSelection(),...r])),typeof s=="number"&&super.setAnchor(s)}setFocus(e,t,o=!1){super.setFocus(e,t),o||this.focusTrait.set(e.map(n=>this.element(n)),t)}setSelection(e,t,o=!1){super.setSelection(e,t),o||this.selectionTrait.set(e.map(n=>this.element(n)),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(typeof e>"u"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}};var eH=class{constructor(i,e,t,o,n={}){this._user=i;this._options=n;this.eventBufferer=new JO;this.onDidChangeFindOpenState=U.None;this.onDidChangeStickyScrollFocused=U.None;this.disposables=new O;this.onDidSwapModel=this.disposables.add(new T);this.onDidChangeModelRelay=this.disposables.add(new Ig);this.onDidSpliceModelRelay=this.disposables.add(new Ig);this.onDidChangeCollapseStateRelay=this.disposables.add(new Ig);this.onDidChangeRenderNodeCountRelay=this.disposables.add(new Ig);this.onDidChangeActiveNodesRelay=this.disposables.add(new Ig);this._onWillRefilter=new T;this.onWillRefilter=this._onWillRefilter.event;this._onDidUpdateOptions=new T;this.onDidUpdateOptions=this._onDidUpdateOptions.event;this.modelDisposables=new O;n.keyboardNavigationLabelProvider&&(n.findWidgetEnabled??!0)&&(this.findFilter=new w6e(n.keyboardNavigationLabelProvider,n.filter,n.defaultFindVisibility),n={...n,filter:this.findFilter},this.disposables.add(this.findFilter)),this.model=this.createModel(i,n),this.treeDelegate=new LEe(t);let r=this.disposables.add(new ppi(this.onDidChangeActiveNodesRelay.event)),s=new pz;this.renderers=o.map(l=>new mpi(l,this.model,this.onDidChangeCollapseStateRelay.event,r,s,n));for(let l of this.renderers)this.disposables.add(l);if(this.focus=new I6e(()=>this.view.getFocusedElements()[0],n.identityProvider),this.selection=new I6e(()=>this.view.getSelectedElements()[0],n.identityProvider),this.anchor=new I6e(()=>this.view.getAnchorElement(),n.identityProvider),this.view=new Cpi(i,e,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...s3o(()=>this.model,this.disposables,n),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.setupModel(this.model),n.keyboardSupport!==!1){let l=U.chain(this.view.onKeyDown,c=>c.filter(u=>!Ch(u.target)).map(u=>new mi(u)));U.chain(l,c=>c.filter(u=>u.keyCode===15))(this.onLeftArrow,this,this.disposables),U.chain(l,c=>c.filter(u=>u.keyCode===17))(this.onRightArrow,this,this.disposables),U.chain(l,c=>c.filter(u=>u.keyCode===10))(this.onSpace,this,this.disposables)}if((n.findWidgetEnabled??!0)&&n.keyboardNavigationLabelProvider&&n.contextViewProvider){let l={styles:n.findWidgetStyles,defaultFindMode:n.defaultFindMode,defaultFindMatchType:n.defaultFindMatchType,showNotFoundMessage:n.showNotFoundMessage,findWidgetContainer:n.findWidgetContainer};this.findController=this.disposables.add(new C6e(this,this.findFilter,n.contextViewProvider,l)),this.focusNavigationFilter=c=>this.findController.shouldAllowFocus(c),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindMode=U.None,this.onDidChangeFindMatchType=U.None;n.enableStickyScroll&&(this.stickyScrollController=new lTt(this,this.model,this.view,this.renderers,this.treeDelegate,n),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=Pr(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides==="always")}get onDidScroll(){return this.view.onDidScroll}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseClick(){return U.map(this.view.onMouseClick,rue)}get onMouseDblClick(){return U.filter(U.map(this.view.onMouseDblClick,rue),i=>i.target!==3)}get onMouseMiddleClick(){return U.filter(U.map(this.view.onMouseMiddleClick,rue),i=>i.target!==3)}get onMouseOver(){return U.map(this.view.onMouseOver,rue)}get onMouseOut(){return U.map(this.view.onMouseOut,rue)}get onContextMenu(){return U.any(U.filter(U.map(this.view.onContextMenu,d3o),i=>!i.isStickyScroll),this.stickyScrollController?.onContextMenu??U.None)}get onTap(){return U.map(this.view.onTap,rue)}get onPointer(){return U.map(this.view.onPointer,rue)}get onKeyDown(){return this.view.onKeyDown}get onKeyUp(){return this.view.onKeyUp}get onKeyPress(){return this.view.onKeyPress}get onDidFocus(){return this.view.onDidFocus}get onDidBlur(){return this.view.onDidBlur}get onDidChangeModel(){return U.any(this.onDidChangeModelRelay.event,this.onDidSwapModel.event)}get onDidChangeCollapseState(){return this.onDidChangeCollapseStateRelay.event}get onDidChangeRenderNodeCount(){return this.onDidChangeRenderNodeCountRelay.event}get findMode(){return this.findController?.mode??0}set findMode(i){this.findController&&(this.findController.mode=i)}get findMatchType(){return this.findController?.matchType??0}set findMatchType(i){this.findController&&(this.findController.matchType=i)}get onDidChangeFindPattern(){return this.findController?this.findController.onDidChangePattern:U.None}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick>"u"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick>"u"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}updateOptions(i={}){this._options={...this._options,...i};for(let e of this.renderers)e.updateOptions(i);this.view.updateOptions(i),this.findController?.updateOptions(i),this.updateStickyScroll(i),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides==="always")}get options(){return this._options}updateStickyScroll(i){!this.stickyScrollController&&this._options.enableStickyScroll?(this.stickyScrollController=new lTt(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=U.None,this.stickyScrollController.dispose(),this.stickyScrollController=void 0),this.stickyScrollController?.updateOptions(i)}updateWidth(i){let e=this.model.getListIndex(i);e!==-1&&this.view.updateWidth(e)}getHTMLElement(){return this.view.getHTMLElement()}get contentHeight(){return this.view.contentHeight}get contentWidth(){return this.view.contentWidth}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.view.onDidChangeContentWidth}get scrollTop(){return this.view.scrollTop}set scrollTop(i){this.view.scrollTop=i}get scrollLeft(){return this.view.scrollLeft}set scrollLeft(i){this.view.scrollLeft=i}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleElement(){let i=this.view.firstVisibleIndex;return this.stickyScrollController&&(i+=this.stickyScrollController.count),i<0||i>=this.view.length?void 0:this.view.element(i).element}get lastVisibleElement(){let i=this.view.lastVisibleIndex;return this.view.element(i).element}get ariaLabel(){return this.view.ariaLabel}set ariaLabel(i){this.view.ariaLabel=i}get selectionSize(){return this.selection.getNodes().length}domFocus(){this.stickyScrollController?.focusedLast()?this.stickyScrollController.domFocus():this.view.domFocus()}isDOMFocused(){return Na(this.getHTMLElement())}layout(i,e){this.view.layout(i,e)}style(i){let e=`.${this.view.domId}`,t=[];i.treeIndentGuidesStroke&&(t.push(`.monaco-list${e}:hover .monaco-tl-indent > .indent-guide, .monaco-list${e}.always .monaco-tl-indent > .indent-guide  { opacity: 1; border-color: ${i.treeInactiveIndentGuidesStroke}; }`),t.push(`.monaco-list${e} .monaco-tl-indent > .indent-guide.active { opacity: 1; border-color: ${i.treeIndentGuidesStroke}; }`));let o=i.treeStickyScrollBackground??i.listBackground;o&&(t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${o}; }`),t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${o}; }`)),i.treeStickyScrollBorder&&t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${i.treeStickyScrollBorder}; }`),i.treeStickyScrollShadow&&t.push(`.monaco-list${e} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${i.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`),i.listFocusForeground&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`));let n=_D(i.listFocusAndSelectionOutline,_D(i.listSelectionOutline,i.listFocusOutline??""));n&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${n}; outline-offset: -1px;}`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`)),i.listFocusOutline&&(t.push(`.monaco-list${e}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }`),t.push(`.monaco-list${e}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`),t.push(`.context-menu-visible .monaco-list${e}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`)),this.styleElement.textContent=t.join(`
`),this.view.style(i)}getParentElement(i){let e=this.model.getParentNodeLocation(i);return this.model.getNode(e).element}getFirstElementChild(i){return this.model.getFirstElementChild(i)}getNode(i){return this.model.getNode(i)}getNodeLocation(i){return this.model.getNodeLocation(i)}collapse(i,e=!1){return this.model.setCollapsed(i,!0,e)}expand(i,e=!1){return this.model.setCollapsed(i,!1,e)}toggleCollapsed(i,e=!1){return this.model.setCollapsed(i,void 0,e)}expandAll(){this.model.setCollapsed(this.model.rootRef,!1,!0)}collapseAll(){this.model.setCollapsed(this.model.rootRef,!0,!0)}isCollapsible(i){return this.model.isCollapsible(i)}setCollapsible(i,e){return this.model.setCollapsible(i,e)}isCollapsed(i){return this.model.isCollapsed(i)}expandTo(i){this.model.expandTo(i)}triggerTypeNavigation(){this.view.triggerTypeNavigation()}openFind(){this.findController?.open()}closeFind(){this.findController?.close()}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setAnchor(i){if(typeof i>"u")return this.view.setAnchor(void 0);this.eventBufferer.bufferEvents(()=>{let e=this.model.getNode(i);this.anchor.set([e]);let t=this.model.getListIndex(i);t>-1&&this.view.setAnchor(t,!0)})}getAnchor(){return this.anchor.get().at(0)}setSelection(i,e){this.eventBufferer.bufferEvents(()=>{let t=i.map(n=>this.model.getNode(n));this.selection.set(t,e);let o=i.map(n=>this.model.getListIndex(n)).filter(n=>n>-1);this.view.setSelection(o,e,!0)})}getSelection(){return this.selection.get()}setFocus(i,e){this.eventBufferer.bufferEvents(()=>{let t=i.map(n=>this.model.getNode(n));this.focus.set(t,e);let o=i.map(n=>this.model.getListIndex(n)).filter(n=>n>-1);this.view.setFocus(o,e,!0)})}focusNext(i=1,e=!1,t,o=sf(t)&&t.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(i,e,t,o)}focusPrevious(i=1,e=!1,t,o=sf(t)&&t.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(i,e,t,o)}focusNextPage(i,e=sf(i)&&i.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(i,e)}focusPreviousPage(i,e=sf(i)&&i.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(i,e,()=>this.stickyScrollController?.height??0)}focusLast(i,e=sf(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusLast(i,e)}focusFirst(i,e=sf(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusFirst(i,e)}getFocus(){return this.focus.get()}getStickyScrollFocus(){let i=this.stickyScrollController?.getFocus();return i!==void 0?[i]:[]}getFocusedPart(){return this.stickyScrollController?.focusedLast()?1:0}reveal(i,e){this.model.expandTo(i);let t=this.model.getListIndex(i);if(t!==-1)if(!this.stickyScrollController)this.view.reveal(t,e);else{let o=this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(i));this.view.reveal(t,e,o)}}getRelativeTop(i){let e=this.model.getListIndex(i);if(e===-1)return null;let t=this.stickyScrollController?.getNode(this.getNode(i));return this.view.getRelativeTop(e,t?.position??this.stickyScrollController?.height)}getViewState(i=this.options.identityProvider){if(!i)throw new mf(this._user,"Can't get tree view state without an identity provider");let e=r=>i.getId(r).toString(),t=y6e.empty(this.scrollTop);for(let r of this.getFocus())t.focus.add(e(r));for(let r of this.getSelection())t.selection.add(e(r));let o=this.model.getNode(),n=[o];for(;n.length>0;){let r=n.pop();r!==o&&r.collapsible&&(t.expanded[e(r.element)]=r.collapsed?0:1),Ile(n,n.length,r.children)}return t}onLeftArrow(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t);if(!this.model.setCollapsed(o,!0)){let r=this.model.getParentNodeLocation(o);if(!r)return;let s=this.model.getListIndex(r);this.view.reveal(s),this.view.setFocus([s])}}onRightArrow(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t);if(!this.model.setCollapsed(o,!1)){if(!t.children.some(l=>l.visible))return;let[r]=this.view.getFocus(),s=r+1;this.view.reveal(s),this.view.setFocus([s])}}onSpace(i){i.preventDefault(),i.stopPropagation();let e=this.view.getFocusedElements();if(e.length===0)return;let t=e[0],o=this.model.getNodeLocation(t),n=i.browserEvent.altKey;this.model.setCollapsed(o,void 0,n)}setupModel(i){this.modelDisposables.clear(),this.modelDisposables.add(i.onDidSpliceRenderedNodes(({start:n,deleteCount:r,elements:s})=>this.view.splice(n,r,s)));let e=U.forEach(i.onDidSpliceModel,n=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(n),this.selection.onDidModelSplice(n)})},this.modelDisposables);e(()=>null,null,this.modelDisposables);let t=this.modelDisposables.add(new T),o=this.modelDisposables.add(new rn(0));this.modelDisposables.add(U.any(e,this.focus.onDidChange,this.selection.onDidChange)(()=>{o.trigger(()=>{let n=new Set;for(let r of this.focus.getNodes())n.add(r);for(let r of this.selection.getNodes())n.add(r);t.fire([...n.values()])})})),this.onDidChangeActiveNodesRelay.input=t.event,this.onDidChangeModelRelay.input=U.signal(i.onDidSpliceModel),this.onDidChangeCollapseStateRelay.input=i.onDidChangeCollapseState,this.onDidChangeRenderNodeCountRelay.input=i.onDidChangeRenderNodeCount,this.onDidSpliceModelRelay.input=i.onDidSpliceModel,et&&this.modelDisposables.add(i.onDidChangeCollapseState(n=>{let{node:r,deep:s}=n;r.collapsible&&!s&&this.isDOMFocused()&&cn(r.collapsed?d(39,null):d(40,null))}))}navigate(i){return new xpi(this.view,this.model,i)}delegateScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}dispose(){je(this.disposables),this.stickyScrollController?.dispose(),this.view.dispose(),this.modelDisposables.dispose()}},xpi=class{constructor(i,e,t){this.view=i;this.model=e;t?this.index=this.model.getListIndex(t):this.index=-1}current(){return this.index<0||this.index>=this.view.length?null:this.view.element(this.index).element}previous(){return this.index--,this.current()}next(){return this.index++,this.current()}first(){return this.index=0,this.current()}last(){return this.index=this.view.length-1,this.current()}};var n2=class{constructor(i,e={}){this.user=i;this.rootRef=null;this.nodes=new Map;this.nodesByIdentity=new Map;this.model=new sTt(i,null,e),this.onDidSpliceModel=this.model.onDidSpliceModel,this.onDidSpliceRenderedNodes=this.model.onDidSpliceRenderedNodes,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,e.sorter&&(this.sorter={compare(t,o){return e.sorter.compare(t.element,o.element)}}),this.identityProvider=e.identityProvider}get size(){return this.nodes.size}setChildren(i,e=yt.empty(),t={}){let o=this.getElementLocation(i);this._setChildren(o,this.preserveCollapseState(e),t)}_setChildren(i,e=yt.empty(),t){let o=new Set,n=new Set,r=l=>{if(l.element===null)return;let c=l;if(o.add(c.element),this.nodes.set(c.element,c),this.identityProvider){let u=this.identityProvider.getId(c.element).toString();n.add(u),this.nodesByIdentity.set(u,c)}t.onDidCreateNode?.(c)},s=l=>{if(l.element===null)return;let c=l;if(o.has(c.element)||this.nodes.delete(c.element),this.identityProvider){let u=this.identityProvider.getId(c.element).toString();n.has(u)||this.nodesByIdentity.delete(u)}t.onDidDeleteNode?.(c)};this.model.splice([...i,0],Number.MAX_VALUE,e,{...t,onDidCreateNode:r,onDidDeleteNode:s})}preserveCollapseState(i=yt.empty()){return this.sorter&&(i=[...i].sort(this.sorter.compare.bind(this.sorter))),yt.map(i,e=>{let t=this.nodes.get(e.element);if(!t&&this.identityProvider){let r=this.identityProvider.getId(e.element).toString();t=this.nodesByIdentity.get(r)}if(!t){let r;return typeof e.collapsed>"u"?r=void 0:e.collapsed===1||e.collapsed===3?r=!0:e.collapsed===0||e.collapsed===2?r=!1:r=!!e.collapsed,{...e,children:this.preserveCollapseState(e.children),collapsed:r}}let o=typeof e.collapsible=="boolean"?e.collapsible:t.collapsible,n;return typeof e.collapsed>"u"||e.collapsed===3||e.collapsed===2?n=t.collapsed:e.collapsed===1?n=!0:e.collapsed===0?n=!1:n=!!e.collapsed,{...e,collapsible:o,collapsed:n,children:this.preserveCollapseState(e.children)}})}rerender(i){let e=this.getElementLocation(i);this.model.rerender(e)}resort(i=null,e=!0){if(!this.sorter)return;let t=this.getElementLocation(i),o=this.model.getNode(t);this._setChildren(t,this.resortChildren(o,e),{})}resortChildren(i,e,t=!0){let o=[...i.children];return(e||t)&&(o=o.sort(this.sorter.compare.bind(this.sorter))),yt.map(o,n=>({element:n.element,collapsible:n.collapsible,collapsed:n.collapsed,children:this.resortChildren(n,e,!1)}))}getFirstElementChild(i=null){let e=this.getElementLocation(i);return this.model.getFirstElementChild(e)}getLastElementAncestor(i=null){let e=this.getElementLocation(i);return this.model.getLastElementAncestor(e)}has(i){return this.nodes.has(i)}getListIndex(i){let e=this.getElementLocation(i);return this.model.getListIndex(e)}getListRenderCount(i){let e=this.getElementLocation(i);return this.model.getListRenderCount(e)}isCollapsible(i){let e=this.getElementLocation(i);return this.model.isCollapsible(e)}setCollapsible(i,e){let t=this.getElementLocation(i);return this.model.setCollapsible(t,e)}isCollapsed(i){let e=this.getElementLocation(i);return this.model.isCollapsed(e)}setCollapsed(i,e,t){let o=this.getElementLocation(i);return this.model.setCollapsed(o,e,t)}expandTo(i){let e=this.getElementLocation(i);this.model.expandTo(e)}refilter(){this.model.refilter()}getNode(i=null){if(i===null)return this.model.getNode(this.model.rootRef);let e=this.nodes.get(i);if(!e)throw new mf(this.user,`Tree element not found: ${i}`);return e}getNodeLocation(i){return i.element}getParentNodeLocation(i){if(i===null)throw new mf(this.user,"Invalid getParentNodeLocation call");let e=this.nodes.get(i);if(!e)throw new mf(this.user,`Tree element not found: ${i}`);let t=this.model.getNodeLocation(e),o=this.model.getParentNodeLocation(t);return this.model.getNode(o).element}getElementLocation(i){if(i===null)return[];let e=this.nodes.get(i);if(!e)throw new mf(this.user,`Tree element not found: ${i}`);return this.model.getNodeLocation(e)}};function dTt(a){let i=[a.element],e=a.incompressible||!1;return{element:{elements:i,incompressible:e},children:yt.map(yt.from(a.children),dTt),collapsible:a.collapsible,collapsed:a.collapsed}}function uTt(a){let i=[a.element],e=a.incompressible||!1,t,o;for(;[o,t]=yt.consume(yt.from(a.children),2),!(o.length!==1||o[0].incompressible);)a=o[0],i.push(a.element);return{element:{elements:i,incompressible:e},children:yt.map(yt.concat(o,t),uTt),collapsible:a.collapsible,collapsed:a.collapsed}}function kpi(a,i=0){let e;return i<a.element.elements.length-1?e=[kpi(a,i+1)]:e=yt.map(yt.from(a.children),t=>kpi(t,0)),i===0&&a.element.incompressible?{element:a.element.elements[i],children:e,incompressible:!0,collapsible:a.collapsible,collapsed:a.collapsed}:{element:a.element.elements[i],children:e,collapsible:a.collapsible,collapsed:a.collapsed}}function Uto(a){return kpi(a,0)}function zto(a,i,e){return a.element===i?{...a,children:e}:{...a,children:yt.map(yt.from(a.children),t=>zto(t,i,e))}}var u3o=a=>({getId(i){return i.elements.map(e=>a.getId(e).toString()).join("\0")},getGroupId:a.getGroupId?i=>a.getGroupId(i.elements[i.elements.length-1]):void 0}),Epi=class{constructor(i,e={}){this.user=i;this.rootRef=null;this.nodes=new Map;this.model=new n2(i,e),this.enabled=typeof e.compressionEnabled>"u"?!0:e.compressionEnabled,this.identityProvider=e.identityProvider}get onDidSpliceRenderedNodes(){return this.model.onDidSpliceRenderedNodes}get onDidSpliceModel(){return this.model.onDidSpliceModel}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}get size(){return this.nodes.size}setChildren(i,e=yt.empty(),t){let o=t.diffIdentityProvider&&u3o(t.diffIdentityProvider);if(i===null){let f=yt.map(e,this.enabled?uTt:dTt);this._setChildren(null,f,{diffIdentityProvider:o,diffDepth:1/0});return}let n=this.nodes.get(i);if(!n)throw new mf(this.user,"Unknown compressed tree node");let r=this.model.getNode(n),s=this.model.getParentNodeLocation(n),l=this.model.getNode(s),c=Uto(r),u=zto(c,i,e),p=(this.enabled?uTt:dTt)(u),h=t.diffIdentityProvider?((f,v)=>t.diffIdentityProvider.getId(f)===t.diffIdentityProvider.getId(v)):void 0;if(eo(p.element.elements,r.element.elements,h)){this._setChildren(n,p.children||yt.empty(),{diffIdentityProvider:o,diffDepth:1});return}let g=l.children.map(f=>f===r?p:f);this._setChildren(l.element,g,{diffIdentityProvider:o,diffDepth:r.depth-l.depth})}isCompressionEnabled(){return this.enabled}setCompressionEnabled(i){if(i===this.enabled)return;this.enabled=i;let t=this.model.getNode().children,o=yt.map(t,Uto),n=yt.map(o,i?uTt:dTt);this._setChildren(null,n,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(i,e,t){let o=new Set,n=s=>{for(let l of s.element.elements)o.add(l),this.nodes.set(l,s.element)},r=s=>{for(let l of s.element.elements)o.has(l)||this.nodes.delete(l)};this.model.setChildren(i,e,{...t,onDidCreateNode:n,onDidDeleteNode:r})}has(i){return this.nodes.has(i)}getListIndex(i){let e=this.getCompressedNode(i);return this.model.getListIndex(e)}getListRenderCount(i){let e=this.getCompressedNode(i);return this.model.getListRenderCount(e)}getNode(i){if(typeof i>"u")return this.model.getNode();let e=this.getCompressedNode(i);return this.model.getNode(e)}getNodeLocation(i){let e=this.model.getNodeLocation(i);return e===null?null:e.elements[e.elements.length-1]}getParentNodeLocation(i){let e=this.getCompressedNode(i),t=this.model.getParentNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getFirstElementChild(i){let e=this.getCompressedNode(i);return this.model.getFirstElementChild(e)}getLastElementAncestor(i){let e=typeof i>"u"?void 0:this.getCompressedNode(i);return this.model.getLastElementAncestor(e)}isCollapsible(i){let e=this.getCompressedNode(i);return this.model.isCollapsible(e)}setCollapsible(i,e){let t=this.getCompressedNode(i);return this.model.setCollapsible(t,e)}isCollapsed(i){let e=this.getCompressedNode(i);return this.model.isCollapsed(e)}setCollapsed(i,e,t){let o=this.getCompressedNode(i);return this.model.setCollapsed(o,e,t)}expandTo(i){let e=this.getCompressedNode(i);this.model.expandTo(e)}rerender(i){let e=this.getCompressedNode(i);this.model.rerender(e)}refilter(){this.model.refilter()}resort(i=null,e=!0){let t=this.getCompressedNode(i);this.model.resort(t,e)}getCompressedNode(i){if(i===null)return null;let e=this.nodes.get(i);if(!e)throw new mf(this.user,`Tree element not found: ${i}`);return e}},p3o=a=>a[a.length-1],Tpi=class a{constructor(i,e){this.unwrapper=i;this.node=e}get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(i=>new a(this.unwrapper,i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}};function m3o(a,i){return{...i,identityProvider:i.identityProvider&&{getId(e){return i.identityProvider.getId(a(e))},getGroupId:i.identityProvider.getGroupId?e=>i.identityProvider.getGroupId(a(e)):void 0},sorter:i.sorter&&{compare(e,t){return i.sorter.compare(e.elements[0],t.elements[0])}},filter:i.filter&&{filter(e,t){let o=e.elements;for(let n=0;n<o.length-1;n++){let r=i.filter.filter(o[n],t);t=o2(wJ(r)?r.visibility:r)}return i.filter.filter(o[o.length-1],t)}}}}var pTt=class{constructor(i,e={}){this.rootRef=null;this.elementMapper=e.elementMapper||p3o;let t=o=>this.elementMapper(o.elements);this.nodeMapper=new nue(o=>new Tpi(t,o)),this.model=new Epi(i,m3o(t,e))}get onDidSpliceModel(){return U.map(this.model.onDidSpliceModel,({insertedNodes:i,deletedNodes:e})=>({insertedNodes:i.map(t=>this.nodeMapper.map(t)),deletedNodes:e.map(t=>this.nodeMapper.map(t))}))}get onDidSpliceRenderedNodes(){return U.map(this.model.onDidSpliceRenderedNodes,({start:i,deleteCount:e,elements:t})=>({start:i,deleteCount:e,elements:t.map(o=>this.nodeMapper.map(o))}))}get onDidChangeCollapseState(){return U.map(this.model.onDidChangeCollapseState,({node:i,deep:e})=>({node:this.nodeMapper.map(i),deep:e}))}get onDidChangeRenderNodeCount(){return U.map(this.model.onDidChangeRenderNodeCount,i=>this.nodeMapper.map(i))}setChildren(i,e=yt.empty(),t={}){this.model.setChildren(i,e,t)}isCompressionEnabled(){return this.model.isCompressionEnabled()}setCompressionEnabled(i){this.model.setCompressionEnabled(i)}has(i){return this.model.has(i)}getListIndex(i){return this.model.getListIndex(i)}getListRenderCount(i){return this.model.getListRenderCount(i)}getNode(i){return this.nodeMapper.map(this.model.getNode(i))}getNodeLocation(i){return i.element}getParentNodeLocation(i){return this.model.getParentNodeLocation(i)}getFirstElementChild(i){let e=this.model.getFirstElementChild(i);return e===null||typeof e>"u"?e:this.elementMapper(e.elements)}getLastElementAncestor(i){let e=this.model.getLastElementAncestor(i);return e===null||typeof e>"u"?e:this.elementMapper(e.elements)}isCollapsible(i){return this.model.isCollapsible(i)}setCollapsible(i,e){return this.model.setCollapsible(i,e)}isCollapsed(i){return this.model.isCollapsed(i)}setCollapsed(i,e,t){return this.model.setCollapsed(i,e,t)}expandTo(i){return this.model.expandTo(i)}rerender(i){return this.model.rerender(i)}refilter(){return this.model.refilter()}resort(i=null,e=!0){return this.model.resort(i,e)}getCompressedTreeNode(i=null){return this.model.getNode(i)}};var lC=class extends eH{constructor(e,t,o,n,r={}){super(e,t,o,n,r);this.user=e}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}setChildren(e,t=yt.empty(),o){this.model.setChildren(e,t,o)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}updateElementHeight(e,t){let o=this.model.getListIndex(e);o!==-1&&this.view.updateElementHeight(o,t)}resort(e,t=!0){this.model.resort(e,t)}hasElement(e){return this.model.has(e)}createModel(e,t){return new n2(e,t)}},mTt=class{constructor(i,e,t){this._compressedTreeNodeProvider=i;this.stickyScrollDelegate=e;this.renderer=t;this.templateId=t.templateId,t.onDidChangeTwistieState&&(this.onDidChangeTwistieState=t.onDidChangeTwistieState)}get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}renderTemplate(i){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){let n=this.stickyScrollDelegate.getCompressedNode(i);n||(n=this.compressedTreeNodeProvider.getCompressedTreeNode(i.element)),n.element.elements.length===1?(t.compressedTreeNode=void 0,this.renderer.renderElement(i,e,t.data,o)):(t.compressedTreeNode=n,this.renderer.renderCompressedElements(n,e,t.data,o))}disposeElement(i,e,t,o){t.compressedTreeNode?this.renderer.disposeCompressedElements?.(t.compressedTreeNode,e,t.data,o):this.renderer.disposeElement?.(i,e,t.data,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.data)}renderTwistie(i,e){return this.renderer.renderTwistie?.(i,e)??!1}};I([bi],mTt.prototype,"compressedTreeNodeProvider",1);var _pi=class{constructor(i){this.modelProvider=i;this.compressedStickyNodes=new Map}getCompressedNode(i){return this.compressedStickyNodes.get(i)}constrainStickyScrollNodes(i,e,t){if(this.compressedStickyNodes.clear(),i.length===0)return[];for(let o=0;o<i.length;o++){let n=i[o],r=n.position+n.height;if(o+1<i.length&&r+i[o+1].height>t||o>=e-1&&e<i.length){let l=i.slice(0,o),c=i.slice(o),u=this.compressStickyNodes(c);return[...l,u]}}return i}compressStickyNodes(i){if(i.length===0)throw new Error("Can't compress empty sticky nodes");let e=this.modelProvider();if(!e.isCompressionEnabled())return i[0];let t=[];for(let c=0;c<i.length;c++){let u=i[c],p=e.getCompressedTreeNode(u.node.element);if(p.element){if(c!==0&&p.element.incompressible)break;t.push(...p.element.elements)}}if(t.length<2)return i[0];let o=i[i.length-1],n={elements:t,incompressible:!1},r={...o.node,children:[],element:n},s=new Proxy(i[0].node,{}),l={node:s,startIndex:i[0].startIndex,endIndex:o.endIndex,position:i[0].position,height:i[0].height};return this.compressedStickyNodes.set(s,r),l}};function h3o(a,i){return i&&{...i,keyboardNavigationLabelProvider:i.keyboardNavigationLabelProvider&&{getKeyboardNavigationLabel(e){let t;try{t=a().getCompressedTreeNode(e)}catch{return i.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e)}return t.element.elements.length===1?i.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e):i.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.element.elements)}}}}var MEe=class extends lC{constructor(i,e,t,o,n={}){let r=()=>this,s=new _pi(()=>this.model),l=o.map(c=>new mTt(r,s,c));super(i,e,t,l,{...h3o(r,n),stickyScrollDelegate:s})}setChildren(i,e=yt.empty(),t){this.model.setChildren(i,e,t)}createModel(i,e){return new pTt(i,e)}updateOptions(i={}){super.updateOptions(i),typeof i.compressionEnabled<"u"&&this.model.setCompressionEnabled(i.compressionEnabled)}getCompressedTreeNode(i=null){return this.model.getCompressedTreeNode(i)}};function Dpi(a){return{...a,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function Lpi(a,i){return i.parent?i.parent===a?!0:Lpi(a,i.parent):!1}function g3o(a,i){return a===i||Lpi(a,i)||Lpi(i,a)}var Mpi=class a{constructor(i){this.node=i}get element(){return this.node.element.element}get children(){return this.node.children.map(i=>new a(i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}},Ppi=class{constructor(i,e,t){this.renderer=i;this.nodeMapper=e;this.onDidChangeTwistieState=t;this.renderedNodes=new Map;this.templateId=i.templateId}renderTemplate(i){return{templateData:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){this.renderer.renderElement(this.nodeMapper.map(i),e,t.templateData,o)}renderTwistie(i,e){return i.slow?(e.classList.add(...q.asClassNameArray(L.treeItemLoading)),!0):(e.classList.remove(...q.asClassNameArray(L.treeItemLoading)),!1)}disposeElement(i,e,t,o){this.renderer.disposeElement?.(this.nodeMapper.map(i),e,t.templateData,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}dispose(){this.renderedNodes.clear()}};function Kto(a){return{browserEvent:a.browserEvent,elements:a.elements.map(i=>i.element)}}function hTt(a){return{browserEvent:a.browserEvent,element:a.element&&a.element.element,target:a.target}}function f3o(a){return{browserEvent:a.browserEvent,element:a.element&&a.element.element,anchor:a.anchor,isStickyScroll:a.isStickyScroll}}var Api=class extends Yw{constructor(e){super(e.elements.map(t=>t.element));this.data=e}set context(e){this.data.context=e}get context(){return this.data.context}};function Rpi(a){return a instanceof Yw?new Api(a):a}var Npi=class{constructor(i){this.dnd=i}getDragURI(i){return this.dnd.getDragURI(i.element)}getDragLabel(i,e){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(i.map(t=>t.element),e)}onDragStart(i,e){this.dnd.onDragStart?.(Rpi(i),e)}onDragOver(i,e,t,o,n,r=!0){return this.dnd.onDragOver(Rpi(i),e&&e.element,t,o,n)}drop(i,e,t,o,n){this.dnd.drop(Rpi(i),e&&e.element,t,o,n)}onDragEnd(i){this.dnd.onDragEnd?.(i)}dispose(){this.dnd.dispose()}},Opi=class extends w6e{constructor(e,t,o){super(t,o);this.findProvider=e;this.isFindSessionActive=!1}filter(e,t){let o=super.filter(e,t);if(!this.isFindSessionActive||this.findMode===0||!this.findProvider.isVisible)return o;let n=wJ(o)?o.visibility:o;return o2(n)===0?0:this.findProvider.isVisible(e)?o:0}},Fpi=class extends C6e{constructor(e,t,o,n,r){super(e,o,n,r);this.findProvider=t;this.filter=o;this.activeSession=!1;this.asyncWorkInProgress=!1;this.taskQueue=new Aa(250);this.disposables.add(ee(async()=>{this.activeSession&&await this.findProvider.endSession?.()}))}applyPattern(e){this.renderMessage(!1),this.activeTokenSource?.cancel(),this.activeTokenSource=new qe,this.taskQueue.trigger(()=>this.applyPatternAsync())}async applyPatternAsync(){let e=this.activeTokenSource?.token;if(!e||e.isCancellationRequested)return;let t=this.pattern;if(t===""){this.activeSession&&(this.asyncWorkInProgress=!0,await this.deactivateFindSession(),this.asyncWorkInProgress=!1,e.isCancellationRequested||(this.filter.reset(),super.applyPattern("")));return}this.activeSession||this.activateFindSession(),this.asyncWorkInProgress=!0,this.activeFindMetadata=void 0;let o=await this.findProvider.find(t,{matchType:this.matchType,findMode:this.mode},e);e.isCancellationRequested||o===void 0||(this.asyncWorkInProgress=!1,this.activeFindMetadata=o,this.filter.reset(),super.applyPattern(t),o.warningMessage&&this.renderMessage(!0,o.warningMessage))}activateFindSession(){this.activeSession=!0,this.filter.isFindSessionActive=!0,this.findProvider.startSession?.()}async deactivateFindSession(){this.activeSession=!1,this.filter.isFindSessionActive=!1,await this.findProvider.endSession?.()}render(){if(this.asyncWorkInProgress||!this.activeFindMetadata)return;let e=this.activeFindMetadata.matchCount===0&&this.pattern.length>0;this.renderMessage(e),this.pattern.length&&this.alertResults(this.activeFindMetadata.matchCount)}onDidToggleChange(e){this.toggles.set(e.id,e.isChecked),this.filter.findMode=this.mode,this.filter.findMatchType=this.matchType,this.placeholder=this.mode===1?d(43,null):d(44,null),this.applyPattern(this.pattern)}shouldAllowFocus(e){return this.shouldFocusWhenNavigating(e)}shouldFocusWhenNavigating(e){if(!this.activeSession||!this.activeFindMetadata)return!0;let t=e.element?.element;return t&&this.activeFindMetadata.isMatch(t)?!0:!Xv.isDefault(e.filterData)}};function Gto(a){return a&&{...a,collapseByDefault:!0,identityProvider:a.identityProvider&&{getId(i){return a.identityProvider.getId(i.element)},getGroupId:a.identityProvider.getGroupId?i=>a.identityProvider.getGroupId(i.element):void 0},dnd:a.dnd&&new Npi(a.dnd),multipleSelectionController:a.multipleSelectionController&&{isSelectionSingleChangeEvent(i){return a.multipleSelectionController.isSelectionSingleChangeEvent({...i,element:i.element})},isSelectionRangeChangeEvent(i){return a.multipleSelectionController.isSelectionRangeChangeEvent({...i,element:i.element})}},accessibilityProvider:a.accessibilityProvider&&{...a.accessibilityProvider,getPosInSet:void 0,getSetSize:void 0,getRole:a.accessibilityProvider.getRole?i=>a.accessibilityProvider.getRole(i.element):()=>"treeitem",isChecked:a.accessibilityProvider.isChecked?i=>!!a.accessibilityProvider?.isChecked(i.element):void 0,getAriaLabel(i){return a.accessibilityProvider.getAriaLabel(i.element)},getWidgetAriaLabel(){return a.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:a.accessibilityProvider.getWidgetRole?()=>a.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:a.accessibilityProvider.getAriaLevel&&(i=>a.accessibilityProvider.getAriaLevel(i.element)),getActiveDescendantId:a.accessibilityProvider.getActiveDescendantId&&(i=>a.accessibilityProvider.getActiveDescendantId(i.element))},filter:a.filter&&{filter(i,e){return a.filter.filter(i.element,e)}},keyboardNavigationLabelProvider:a.keyboardNavigationLabelProvider&&{...a.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(i){return a.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i.element)}},sorter:void 0,expandOnlyOnTwistieClick:typeof a.expandOnlyOnTwistieClick>"u"?void 0:typeof a.expandOnlyOnTwistieClick!="function"?a.expandOnlyOnTwistieClick:(i=>a.expandOnlyOnTwistieClick(i.element)),twistieAdditionalCssClass:typeof a.twistieAdditionalCssClass>"u"?void 0:(i=>a.twistieAdditionalCssClass(i.element)),defaultFindVisibility:i=>i.hasChildren&&i.stale?1:typeof a.defaultFindVisibility=="number"?a.defaultFindVisibility:typeof a.defaultFindVisibility>"u"?2:a.defaultFindVisibility(i.element),stickyScrollDelegate:a.stickyScrollDelegate}}function Wpi(a,i){i(a),a.children.forEach(e=>Wpi(e,i))}var Zv=class{constructor(i,e,t,o,n,r={}){this.user=i;this.dataSource=n;this.nodes=new Map;this.subTreeRefreshPromises=new Map;this.refreshPromises=new Map;this._onDidRender=new T;this._onDidChangeNodeSlowState=new T;this.nodeMapper=new nue(i=>new Mpi(i));this.disposables=new O;this.identityProvider=r.identityProvider,this.autoExpandSingleChildren=typeof r.autoExpandSingleChildren>"u"?!1:r.autoExpandSingleChildren,this.sorter=r.sorter,this.getDefaultCollapseState=c=>r.collapseByDefault?r.collapseByDefault(c)?3:2:void 0;let s=!1,l;if(r.findProvider&&(r.findWidgetEnabled??!0)&&r.keyboardNavigationLabelProvider&&r.contextViewProvider&&(s=!0,l=new Opi(r.findProvider,r.keyboardNavigationLabelProvider,r.filter)),this.tree=this.createTree(i,e,t,o,{...r,findWidgetEnabled:!s,filter:l??r.filter}),this.root=Dpi({element:void 0,parent:null,hasChildren:!0,defaultCollapseState:void 0}),this.identityProvider&&(this.root={...this.root,id:null}),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables),s){let c={styles:r.findWidgetStyles,showNotFoundMessage:r.showNotFoundMessage,defaultFindMatchType:r.defaultFindMatchType,defaultFindMode:r.defaultFindMode};this.findController=this.disposables.add(new Fpi(this.tree,r.findProvider,l,this.tree.options.contextViewProvider,c)),this.focusNavigationFilter=u=>this.findController.shouldFocusWhenNavigating(u),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindOpenState=this.tree.onDidChangeFindOpenState,this.onDidChangeFindMode=this.tree.onDidChangeFindMode,this.onDidChangeFindMatchType=this.tree.onDidChangeFindMatchType}get onDidScroll(){return this.tree.onDidScroll}get onDidChangeFocus(){return U.map(this.tree.onDidChangeFocus,Kto)}get onDidChangeSelection(){return U.map(this.tree.onDidChangeSelection,Kto)}get onKeyDown(){return this.tree.onKeyDown}get onMouseClick(){return U.map(this.tree.onMouseClick,hTt)}get onMouseDblClick(){return U.map(this.tree.onMouseDblClick,hTt)}get onContextMenu(){return U.map(this.tree.onContextMenu,f3o)}get onTap(){return U.map(this.tree.onTap,hTt)}get onPointer(){return U.map(this.tree.onPointer,hTt)}get onDidFocus(){return this.tree.onDidFocus}get onDidBlur(){return this.tree.onDidBlur}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidUpdateOptions(){return this.tree.onDidUpdateOptions}get onDidChangeStickyScrollFocused(){return this.tree.onDidChangeStickyScrollFocused}get findMode(){return this.findController?this.findController.mode:this.tree.findMode}set findMode(i){this.findController?this.findController.mode=i:this.tree.findMode=i}get findMatchType(){return this.findController?this.findController.matchType:this.tree.findMatchType}set findMatchType(i){this.findController?this.findController.matchType=i:this.tree.findMatchType=i}get expandOnlyOnTwistieClick(){if(typeof this.tree.expandOnlyOnTwistieClick=="boolean")return this.tree.expandOnlyOnTwistieClick;let i=this.tree.expandOnlyOnTwistieClick;return e=>i(this.nodes.get(e===this.root.element?null:e)||null)}get onDidDispose(){return this.tree.onDidDispose}createTree(i,e,t,o,n){let r=new LEe(t),s=o.map(c=>new Ppi(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=Gto(n)||{};return new lC(i,e,r,s,l)}updateOptions(i={}){this.findController&&(i.defaultFindMode!==void 0&&(this.findController.mode=i.defaultFindMode),i.defaultFindMatchType!==void 0&&(this.findController.matchType=i.defaultFindMatchType)),this.tree.updateOptions(i)}get options(){return this.tree.options}getHTMLElement(){return this.tree.getHTMLElement()}get contentHeight(){return this.tree.contentHeight}get contentWidth(){return this.tree.contentWidth}get onDidChangeContentHeight(){return this.tree.onDidChangeContentHeight}get onDidChangeContentWidth(){return this.tree.onDidChangeContentWidth}get scrollTop(){return this.tree.scrollTop}set scrollTop(i){this.tree.scrollTop=i}get scrollLeft(){return this.tree.scrollLeft}set scrollLeft(i){this.tree.scrollLeft=i}get scrollHeight(){return this.tree.scrollHeight}get renderHeight(){return this.tree.renderHeight}get lastVisibleElement(){return this.tree.lastVisibleElement.element}get ariaLabel(){return this.tree.ariaLabel}set ariaLabel(i){this.tree.ariaLabel=i}domFocus(){this.tree.domFocus()}isDOMFocused(){return this.tree.isDOMFocused()}navigate(i){let e;return i&&(e=this.getDataNode(i)),new Hpi(this.tree.navigate(e))}layout(i,e){this.tree.layout(i,e)}style(i){this.tree.style(i)}getInput(){return this.root.element}async setInput(i,e){this.cancelAllRefreshPromises(),this.root.element=i;let t=e&&{viewState:e,focus:[],selection:[]};await this._updateChildren(i,!0,!1,t),t&&(this.tree.setFocus(t.focus),this.tree.setSelection(t.selection)),e&&typeof e.scrollTop=="number"&&(this.scrollTop=e.scrollTop)}async updateChildren(i=this.root.element,e=!0,t=!1,o){await this._updateChildren(i,e,t,void 0,o)}cancelAllRefreshPromises(i=!1){this.refreshPromises.forEach(e=>e.cancel()),this.refreshPromises.clear(),i&&(this.subTreeRefreshPromises.forEach(e=>e.cancel()),this.subTreeRefreshPromises.clear())}async _updateChildren(i=this.root.element,e=!0,t=!1,o,n){if(typeof this.root.element>"u")throw new mf(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await U.toPromise(this._onDidRender.event));let r=this.getDataNode(i);if(await this.refreshAndRenderNode(r,e,o,n),t)try{this.tree.rerender(r)}catch{}}resort(i=this.root.element,e=!0){this.tree.resort(this.getDataNode(i),e)}hasNode(i){return i===this.root.element||this.nodes.has(i)}rerender(i){if(i===void 0||i===this.root.element){this.tree.rerender();return}let e=this.getDataNode(i);this.tree.rerender(e)}updateElementHeight(i,e){let t=this.getDataNode(i);this.tree.updateElementHeight(t,e)}updateWidth(i){let e=this.getDataNode(i);this.tree.updateWidth(e)}getNode(i=this.root.element){let e=this.getDataNode(i),t=this.tree.getNode(e===this.root?null:e);return this.nodeMapper.map(t)}collapse(i,e=!1){let t=this.getDataNode(i);return this.tree.collapse(t===this.root?null:t,e)}async expand(i,e=!1){if(typeof this.root.element>"u")throw new mf(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await U.toPromise(this._onDidRender.event));let t=this.getDataNode(i);if(this.tree.hasElement(t)&&!this.tree.isCollapsible(t)||(t.refreshPromise&&(await t.refreshPromise,await U.toPromise(this._onDidRender.event)),t!==this.root&&!t.refreshPromise&&!this.tree.isCollapsed(t)))return!1;let o=this.tree.expand(t===this.root?null:t,e);return t.refreshPromise&&(await t.refreshPromise,await U.toPromise(this._onDidRender.event)),o}toggleCollapsed(i,e=!1){return this.tree.toggleCollapsed(this.getDataNode(i),e)}expandAll(){this.tree.expandAll()}async expandTo(i){if(!this.dataSource.getParent)throw new Error("Can't expand to element without getParent method");let e=[];for(;!this.hasNode(i);)i=this.dataSource.getParent(i),i!==this.root.element&&e.push(i);for(let t of yt.reverse(e))await this.expand(t);this.tree.expandTo(this.getDataNode(i))}collapseAll(){this.tree.collapseAll()}isCollapsible(i){return this.tree.isCollapsible(this.getDataNode(i))}isCollapsed(i){return this.tree.isCollapsed(this.getDataNode(i))}triggerTypeNavigation(){this.tree.triggerTypeNavigation()}openFind(){this.findController?this.findController.open():this.tree.openFind()}closeFind(){this.findController?this.findController.close():this.tree.closeFind()}refilter(){this.tree.refilter()}setAnchor(i){this.tree.setAnchor(typeof i>"u"?void 0:this.getDataNode(i))}getAnchor(){return this.tree.getAnchor()?.element}setSelection(i,e){let t=i.map(o=>this.getDataNode(o));this.tree.setSelection(t,e)}getSelection(){return this.tree.getSelection().map(e=>e.element)}setFocus(i,e){let t=i.map(o=>this.getDataNode(o));this.tree.setFocus(t,e)}focusNext(i=1,e=!1,t){this.tree.focusNext(i,e,t,this.focusNavigationFilter)}focusPrevious(i=1,e=!1,t){this.tree.focusPrevious(i,e,t,this.focusNavigationFilter)}focusNextPage(i){return this.tree.focusNextPage(i,this.focusNavigationFilter)}focusPreviousPage(i){return this.tree.focusPreviousPage(i,this.focusNavigationFilter)}focusLast(i){this.tree.focusLast(i,this.focusNavigationFilter)}focusFirst(i){this.tree.focusFirst(i,this.focusNavigationFilter)}getFocus(){return this.tree.getFocus().map(e=>e.element)}getStickyScrollFocus(){return this.tree.getStickyScrollFocus().map(e=>e.element)}getFocusedPart(){return this.tree.getFocusedPart()}reveal(i,e){this.tree.reveal(this.getDataNode(i),e)}getRelativeTop(i){return this.tree.getRelativeTop(this.getDataNode(i))}getParentElement(i){let e=this.tree.getParentElement(this.getDataNode(i));return e&&e.element}getFirstElementChild(i=this.root.element){let e=this.getDataNode(i),t=this.tree.getFirstElementChild(e===this.root?null:e);return t&&t.element}getDataNode(i){let e=this.nodes.get(i===this.root.element?null:i);if(!e){let t=this.identityProvider?.getId(i).toString();throw new mf(this.user,`Data tree node not found${t?`: ${t}`:""}`)}return e}async refreshAndRenderNode(i,e,t,o){this.disposables.isDisposed||(await this.refreshNode(i,e,t),!this.disposables.isDisposed&&this.render(i,t,o))}async refreshNode(i,e,t){let o;if(this.subTreeRefreshPromises.forEach((n,r)=>{!o&&g3o(r,i)&&(o=n.then(()=>this.refreshNode(i,e,t)))}),o)return o;if(i!==this.root&&this.tree.getNode(i).collapsed){i.hasChildren=!!this.dataSource.hasChildren(i.element),i.stale=!0,this.setChildren(i,[],e,t);return}return this.doRefreshSubTree(i,e,t)}async doRefreshSubTree(i,e,t){let o=Hn(async()=>{let n=await this.doRefreshNode(i,e,t);i.stale=!1,await vn.settled(n.map(r=>this.doRefreshSubTree(r,e,t)))});return i.refreshPromise=o,this.subTreeRefreshPromises.set(i,o),o.finally(()=>{i.refreshPromise=void 0,this.subTreeRefreshPromises.delete(i)}),o}async doRefreshNode(i,e,t){i.hasChildren=!!this.dataSource.hasChildren(i.element);let o;if(!i.hasChildren)o=Promise.resolve(yt.empty());else{let n=this.doGetChildren(i);if(J5e(n))o=Promise.resolve(n);else{let r=Li(800);r.then(()=>{i.slow=!0,this._onDidChangeNodeSlowState.fire(i)},s=>null),o=n.finally(()=>r.cancel())}}try{let n=await o;return this.setChildren(i,n,e,t)}catch(n){if(i!==this.root&&this.tree.hasElement(i)&&this.tree.collapse(i),Yi(n))return[];throw n}finally{i.slow&&(i.slow=!1,this._onDidChangeNodeSlowState.fire(i))}}doGetChildren(i){let e=this.refreshPromises.get(i);if(e)return e;let t=this.dataSource.getChildren(i.element);return J5e(t)?this.processChildren(t):(e=Hn(async()=>this.processChildren(await t)),this.refreshPromises.set(i,e),e.finally(()=>{this.refreshPromises.delete(i)}))}_onDidChangeCollapseState({node:i,deep:e}){i.element!==null&&!i.collapsed&&i.element.stale&&(e?this.collapse(i.element.element):this.refreshAndRenderNode(i.element,!1).catch(mt))}setChildren(i,e,t,o){let n=[...e];if(i.children.length===0&&n.length===0)return[];let r=new Map,s=new Map;for(let u of i.children)r.set(u.element,u),this.identityProvider&&s.set(u.id,{node:u,collapsed:this.tree.hasElement(u)&&this.tree.isCollapsed(u)});let l=[],c=n.map(u=>{let p=!!this.dataSource.hasChildren(u);if(!this.identityProvider){let v=Dpi({element:u,parent:i,hasChildren:p,defaultCollapseState:this.getDefaultCollapseState(u)});return p&&v.defaultCollapseState===2&&l.push(v),v}let h=this.identityProvider.getId(u).toString(),g=s.get(h);if(g){let v=g.node;return r.delete(v.element),this.nodes.delete(v.element),this.nodes.set(u,v),v.element=u,v.hasChildren=p,t?g.collapsed?(v.children.forEach(b=>Wpi(b,S=>this.nodes.delete(S.element))),v.children.splice(0,v.children.length),v.stale=!0):l.push(v):p&&!g.collapsed&&l.push(v),v}let f=Dpi({element:u,parent:i,id:h,hasChildren:p,defaultCollapseState:this.getDefaultCollapseState(u)});return o&&o.viewState.focus&&o.viewState.focus.indexOf(h)>-1&&o.focus.push(f),o&&o.viewState.selection&&o.viewState.selection.indexOf(h)>-1&&o.selection.push(f),(o&&o.viewState.expanded&&o.viewState.expanded.indexOf(h)>-1||p&&f.defaultCollapseState===2)&&l.push(f),f});for(let u of r.values())Wpi(u,p=>this.nodes.delete(p.element));for(let u of c)this.nodes.set(u.element,u);return yle(i.children,0,i.children.length,c),i!==this.root&&this.autoExpandSingleChildren&&c.length===1&&l.length===0&&(c[0].forceExpanded=!0,l.push(c[0])),l}render(i,e,t){let o=i.children.map(r=>this.asTreeElement(r,e)),n=t&&{...t,diffIdentityProvider:t.diffIdentityProvider&&{getId(r){return t.diffIdentityProvider.getId(r.element)},getGroupId:t.diffIdentityProvider.getGroupId?r=>t.diffIdentityProvider.getGroupId(r.element):void 0}};this.tree.setChildren(i===this.root?null:i,o,n),i!==this.root&&this.tree.setCollapsible(i,i.hasChildren),this._onDidRender.fire()}asTreeElement(i,e){if(i.stale)return{element:i,collapsible:i.hasChildren,collapsed:!0};let t;return e&&e.viewState.expanded&&i.id&&e.viewState.expanded.indexOf(i.id)>-1?t=!1:i.forceExpanded?(t=!1,i.forceExpanded=!1):t=i.defaultCollapseState,{element:i,children:i.hasChildren?yt.map(i.children,o=>this.asTreeElement(o,e)):[],collapsible:i.hasChildren,collapsed:t}}processChildren(i){return this.sorter&&(i=[...i].sort(this.sorter.compare.bind(this.sorter))),i}getViewState(){if(!this.identityProvider)throw new mf(this.user,"Can't get tree view state without an identity provider");let i=s=>this.identityProvider.getId(s).toString(),e=this.getFocus().map(i),t=this.getSelection().map(i),o=[],n=this.tree.getNode(),r=[n];for(;r.length>0;){let s=r.pop();s!==n&&s.collapsible&&!s.collapsed&&o.push(i(s.element.element)),Ile(r,r.length,s.children)}return{focus:e,selection:t,expanded:o,scrollTop:this.scrollTop}}dispose(){this._onDidRender.dispose(),this._onDidChangeNodeSlowState.dispose(),this.disposables.dispose(),this.tree.dispose()}},Vpi=class a{constructor(i){this.node=i}get element(){return{elements:this.node.element.elements.map(i=>i.element),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map(i=>new a(i))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}},Bpi=class{constructor(i,e,t,o){this.renderer=i;this.nodeMapper=e;this.compressibleNodeMapperProvider=t;this.onDidChangeTwistieState=o;this.renderedNodes=new Map;this.disposables=[];this.templateId=i.templateId}renderTemplate(i){return{templateData:this.renderer.renderTemplate(i)}}renderElement(i,e,t,o){this.renderer.renderElement(this.nodeMapper.map(i),e,t.templateData,o)}renderCompressedElements(i,e,t,o){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(i),e,t.templateData,o)}renderTwistie(i,e){return i.slow?(e.classList.add(...q.asClassNameArray(L.treeItemLoading)),!0):(e.classList.remove(...q.asClassNameArray(L.treeItemLoading)),!1)}disposeElement(i,e,t,o){this.renderer.disposeElement?.(this.nodeMapper.map(i),e,t.templateData,o)}disposeCompressedElements(i,e,t,o){this.renderer.disposeCompressedElements?.(this.compressibleNodeMapperProvider().map(i),e,t.templateData,o)}disposeTemplate(i){this.renderer.disposeTemplate(i.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=je(this.disposables)}};function v3o(a){let i=a&&Gto(a);return i&&{...i,keyboardNavigationLabelProvider:i.keyboardNavigationLabelProvider&&{...i.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(e){return a.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(e.map(t=>t.element))}},stickyScrollDelegate:i.stickyScrollDelegate}}var gTt=class extends Zv{constructor(e,t,o,n,r,s,l={}){super(e,t,o,r,s,l);this.compressionDelegate=n;this.compressibleNodeMapper=new nue(e=>new Vpi(e));this.filter=l.filter}getCompressedTreeNode(e){let t=this.getDataNode(e);return this.tree.getCompressedTreeNode(t).element}createTree(e,t,o,n,r){let s=new LEe(o),l=n.map(u=>new Bpi(u,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),c=v3o(r)||{};return new MEe(e,t,s,l,c)}asTreeElement(e,t){return{incompressible:this.compressionDelegate.isIncompressible(e.element),...super.asTreeElement(e,t)}}getViewState(){if(!this.identityProvider)throw new mf(this.user,"Can't get tree view state without an identity provider");let e=l=>this.identityProvider.getId(l).toString(),t=this.getFocus().map(e),o=this.getSelection().map(e),n=[],r=this.tree.getCompressedTreeNode(),s=[r];for(;s.length>0;){let l=s.pop();if(l!==r&&l.collapsible&&!l.collapsed)for(let c of l.element.elements)n.push(e(c.element));s.push(...l.children)}return{focus:t,selection:o,expanded:n,scrollTop:this.scrollTop}}render(e,t,o){if(!this.identityProvider)return super.render(e,t);let n=f=>this.identityProvider.getId(f).toString(),r=f=>{let v=new Set;for(let b of f){let S=this.tree.getCompressedTreeNode(b===this.root?null:b);if(S.element)for(let y of S.element.elements)v.add(n(y.element))}return v},s=r(this.tree.getSelection()),l=r(this.tree.getFocus());super.render(e,t,o);let c=this.getSelection(),u=!1,p=this.getFocus(),h=!1,g=f=>{let v=f.element;if(v)for(let b=0;b<v.elements.length;b++){let S=n(v.elements[b].element),y=v.elements[v.elements.length-1].element;s.has(S)&&c.indexOf(y)===-1&&(c.push(y),u=!0),l.has(S)&&p.indexOf(y)===-1&&(p.push(y),h=!0)}f.children.forEach(g)};g(this.tree.getCompressedTreeNode(e===this.root?null:e)),u&&this.setSelection(c),h&&this.setFocus(p)}processChildren(e){return this.filter&&(e=yt.filter(e,t=>{let o=this.filter.filter(t,1),n=b3o(o);if(n===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return n===1})),super.processChildren(e)}navigate(e){return super.navigate(e)}};function b3o(a){return typeof a=="boolean"?a?1:0:wJ(a)?o2(a.visibility):o2(a)}var Hpi=class{constructor(i){this.navigator=i}current(){let i=this.navigator.current();return i===null?null:i.element}previous(){return this.navigator.previous(),this.current()}first(){return this.navigator.first(),this.current()}last(){return this.navigator.last(),this.current()}next(){return this.navigator.next(),this.current()}};var KT=class extends eH{constructor(e,t,o,n,r,s={}){super(e,t,o,n,s);this.user=e;this.dataSource=r;this.nodesByIdentity=new Map;this.identityProvider=s.identityProvider}getInput(){return this.input}setInput(e,t){if(t&&!this.identityProvider)throw new mf(this.user,"Can't restore tree view state without an identity provider");if(this.input=e,!e){this.nodesByIdentity.clear(),this.model.setChildren(null,yt.empty());return}if(!t){this._refresh(e);return}let o=[],n=[],r=l=>{let c=this.identityProvider.getId(l).toString();return!t.expanded[c]},s=l=>{let c=this.identityProvider.getId(l.element).toString();t.focus.has(c)&&o.push(l.element),t.selection.has(c)&&n.push(l.element)};this._refresh(e,r,s),this.setFocus(o),this.setSelection(n),t&&typeof t.scrollTop=="number"&&(this.scrollTop=t.scrollTop)}updateChildren(e=this.input){if(typeof this.input>"u")throw new mf(this.user,"Tree input not set");let t;this.identityProvider&&(t=o=>{let n=this.identityProvider.getId(o).toString(),r=this.nodesByIdentity.get(n);if(r)return r.collapsed}),this._refresh(e,t)}resort(e=this.input,t=!0){this.model.resort(e===this.input?null:e,t)}refresh(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}_refresh(e,t,o){let n;if(this.identityProvider){let r=new Set,s=o;o=l=>{let c=this.identityProvider.getId(l.element).toString();r.add(c),this.nodesByIdentity.set(c,l),s?.(l)},n=l=>{let c=this.identityProvider.getId(l.element).toString();r.has(c)||this.nodesByIdentity.delete(c)}}this.model.setChildren(e===this.input?null:e,this.iterate(e,t).elements,{onDidCreateNode:o,onDidDeleteNode:n})}iterate(e,t){let o=[...this.dataSource.getChildren(e)];return{elements:yt.map(o,r=>{let{elements:s,size:l}=this.iterate(r,t),c=this.dataSource.hasChildren?this.dataSource.hasChildren(r):void 0,u=l===0?void 0:t&&t(r);return{element:r,children:s,collapsible:c,collapsed:u}}),size:o.length}}createModel(e,t){return new n2(e,t)}};var fTt=new Y("isMac",et,d(2116,null)),aue=new Y("isLinux",Sn,d(2115,null)),cC=new Y("isWindows",ii,d(2120,null)),Mu=new Y("isWeb",Ft,d(2119,null)),Zk=new Y("isMacNative",et&&!Ft,d(2117,null)),vTt=new Y("isIOS",Tc,d(2114,null)),qto=new Y("isMobile",zye,d(2118,null)),_4=new Y("isDevelopment",!1,!0),D4=new Y("productQualityType","",d(2121,null)),Dp="inputFocus",Wg=new Y(Dp,!1,d(2113,null));var Co=le("listService"),STt=class{constructor(){this.disposables=new O;this.lists=[];this._lastFocusedWidget=void 0}get lastFocusedList(){return this._lastFocusedWidget}setLastFocusedList(i){i!==this._lastFocusedWidget&&(this._lastFocusedWidget?.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=i,this._lastFocusedWidget?.getHTMLElement().classList.add("last-focused"))}register(i,e){if(this.lists.some(o=>o.widget===i))throw new Error("Cannot register the same widget multiple times");let t={widget:i,extraContextKeys:e};return this.lists.push(t),Na(i.getHTMLElement())&&this.setLastFocusedList(i),Fn(i.onDidFocus(()=>this.setLastFocusedList(i)),ee(()=>this.lists.splice(this.lists.indexOf(t),1)),i.onDidDispose(()=>{this.lists=this.lists.filter(o=>o!==t),this._lastFocusedWidget===i&&this.setLastFocusedList(void 0)}))}dispose(){this.disposables.dispose()}},x6e=new Y("listScrollAtBoundary","none"),ETt=C.or(x6e.isEqualTo("top"),x6e.isEqualTo("both")),TTt=C.or(x6e.isEqualTo("bottom"),x6e.isEqualTo("both")),T6e=new Y("listFocus",!0),AEe=new Y("treestickyScrollFocused",!1),CJ=new Y("listSupportsMultiselect",!0),Nc=C.and(T6e,C.not(Dp),AEe.negate()),_6e=new Y("listHasSelectionOrFocus",!1),oH=new Y("listDoubleSelection",!1),Gpi=new Y("listMultiSelection",!1),lue=new Y("listSelectionNavigation",!1),qpi=new Y("listSupportsFind",!0),NEe=new Y("treeElementCanCollapse",!1),$pi=new Y("treeElementHasParent",!1),OEe=new Y("treeElementCanExpand",!1),jpi=new Y("treeElementHasChild",!1),Qpi=new Y("treeFindOpen",!1),jto="listTypeNavigationMode",Qto="listAutomaticKeyboardNavigation";function _Tt(a,i){let e=a.createScoped(i.getHTMLElement());return T6e.bindTo(e),e}function DTt(a,i){let e=x6e.bindTo(a),t=()=>{let o=i.scrollTop===0,n=i.scrollHeight-i.renderHeight-i.scrollTop<1;o&&n?e.set("both"):o?e.set("top"):n?e.set("bottom"):e.set("none")};return t(),i.onDidScroll(t)}var cue="workbench.list.multiSelectModifier",bTt="workbench.list.openMode",VA="workbench.list.horizontalScrolling",Ypi="workbench.list.defaultFindMode",Xpi="workbench.list.typeNavigationMode",ITt="workbench.list.keyboardNavigation",tH="workbench.list.scrollByPage",Jpi="workbench.list.defaultFindMatchType",k6e="workbench.tree.indent",yTt="workbench.tree.renderIndentGuides",iH="workbench.list.smoothScrolling",s2="workbench.list.mouseWheelScrollSensitivity",a2="workbench.list.fastScrollSensitivity",wTt="workbench.tree.expandMode",CTt="workbench.tree.enableStickyScroll",xTt="workbench.tree.stickyScrollMaxItemCount";function l2(a){return a.getValue(cue)==="alt"}var Upi=class extends k{constructor(e){super();this.configurationService=e;this.useAltAsMultipleSelectionModifier=l2(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(cue)&&(this.useAltAsMultipleSelectionModifier=l2(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:Pci(e)}isSelectionRangeChangeEvent(e){return Aci(e)}};function RTt(a,i){let e=a.get(B),t=a.get(Le),o=new O;return[{...i,keyboardNavigationDelegate:{mightProducePrintableCharacter(r){return t.mightProducePrintableCharacter(r)}},smoothScrolling:!!e.getValue(iH),mouseWheelScrollSensitivity:e.getValue(s2),fastScrollSensitivity:e.getValue(a2),multipleSelectionController:i.multipleSelectionController??o.add(new Upi(e)),keyboardNavigationEventFilter:S3o(t),scrollByPage:!!e.getValue(tH)},o]}var bc=class extends Gc{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let u=typeof n.horizontalScrolling<"u"?n.horizontalScrolling:!!l.getValue(VA),[p,h]=c.invokeFunction(RTt,n);super(i,e,t,o,{keyboardSupport:!1,...p,horizontalScrolling:u}),this.disposables.add(h),this.contextKeyService=_Tt(r,this),this.disposables.add(DTt(this.contextKeyService,this)),this.listSupportsMultiSelect=CJ.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(n.multipleSelectionSupport!==!1),lue.bindTo(this.contextKeyService).set(!!n.selectionNavigation),this.listHasSelectionOrFocus=_6e.bindTo(this.contextKeyService),this.listDoubleSelection=oH.bindTo(this.contextKeyService),this.listMultiSelection=Gpi.bindTo(this.contextKeyService),this.horizontalScrolling=n.horizontalScrolling,this._useAltAsMultipleSelectionModifier=l2(l),this.disposables.add(this.contextKeyService),this.disposables.add(s.register(this)),this.updateStyles(n.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let f=this.getSelection(),v=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(f.length>0||v.length>0),this.listMultiSelection.set(f.length>1),this.listDoubleSelection.set(f.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let f=this.getSelection(),v=this.getFocus();this.listHasSelectionOrFocus.set(f.length>0||v.length>0)})),this.disposables.add(l.onDidChangeConfiguration(f=>{f.affectsConfiguration(cue)&&(this._useAltAsMultipleSelectionModifier=l2(l));let v={};if(f.affectsConfiguration(VA)&&this.horizontalScrolling===void 0){let b=!!l.getValue(VA);v={...v,horizontalScrolling:b}}if(f.affectsConfiguration(tH)){let b=!!l.getValue(tH);v={...v,scrollByPage:b}}if(f.affectsConfiguration(iH)){let b=!!l.getValue(iH);v={...v,smoothScrolling:b}}if(f.affectsConfiguration(s2)){let b=l.getValue(s2);v={...v,mouseWheelScrollSensitivity:b}}if(f.affectsConfiguration(a2)){let b=l.getValue(a2);v={...v,fastScrollSensitivity:b}}Object.keys(v).length>0&&this.updateOptions(v)})),this.navigator=new kTt(this,{configurationService:l,...n}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?WS(i):iJ)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}};bc=I([m(5,X),m(6,Co),m(7,B),m(8,F)],bc);var r2=class extends i2{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let u=typeof n.horizontalScrolling<"u"?n.horizontalScrolling:!!l.getValue(VA),[p,h]=c.invokeFunction(RTt,n);super(i,e,t,o,{keyboardSupport:!1,...p,horizontalScrolling:u}),this.disposables=new O,this.disposables.add(h),this.contextKeyService=_Tt(r,this),this.disposables.add(DTt(this.contextKeyService,this.widget)),this.horizontalScrolling=n.horizontalScrolling,this.listSupportsMultiSelect=CJ.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(n.multipleSelectionSupport!==!1),lue.bindTo(this.contextKeyService).set(!!n.selectionNavigation),this._useAltAsMultipleSelectionModifier=l2(l),this.disposables.add(this.contextKeyService),this.disposables.add(s.register(this)),this.updateStyles(n.overrideStyles),this.disposables.add(l.onDidChangeConfiguration(f=>{f.affectsConfiguration(cue)&&(this._useAltAsMultipleSelectionModifier=l2(l));let v={};if(f.affectsConfiguration(VA)&&this.horizontalScrolling===void 0){let b=!!l.getValue(VA);v={...v,horizontalScrolling:b}}if(f.affectsConfiguration(tH)){let b=!!l.getValue(tH);v={...v,scrollByPage:b}}if(f.affectsConfiguration(iH)){let b=!!l.getValue(iH);v={...v,smoothScrolling:b}}if(f.affectsConfiguration(s2)){let b=l.getValue(s2);v={...v,mouseWheelScrollSensitivity:b}}if(f.affectsConfiguration(a2)){let b=l.getValue(a2);v={...v,fastScrollSensitivity:b}}Object.keys(v).length>0&&this.updateOptions(v)})),this.navigator=new kTt(this,{configurationService:l,...n}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?WS(i):iJ)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}dispose(){this.disposables.dispose(),super.dispose()}};r2=I([m(5,X),m(6,Co),m(7,B),m(8,F)],r2);var Cx=class extends s0{get onDidOpen(){return this.navigator.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let p=typeof r.horizontalScrolling<"u"?r.horizontalScrolling:!!c.getValue(VA),[h,g]=u.invokeFunction(RTt,r);super(i,e,t,o,n,{keyboardSupport:!1,...h,horizontalScrolling:p}),this.disposables.add(g),this.contextKeyService=_Tt(s,this),this.disposables.add(DTt(this.contextKeyService,this)),this.listSupportsMultiSelect=CJ.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),lue.bindTo(this.contextKeyService).set(!!r.selectionNavigation),this.listHasSelectionOrFocus=_6e.bindTo(this.contextKeyService),this.listDoubleSelection=oH.bindTo(this.contextKeyService),this.listMultiSelection=Gpi.bindTo(this.contextKeyService),this.horizontalScrolling=r.horizontalScrolling,this._useAltAsMultipleSelectionModifier=l2(c),this.disposables.add(this.contextKeyService),this.disposables.add(l.register(this)),this.updateStyles(r.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{let v=this.getSelection(),b=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(v.length>0||b.length>0),this.listMultiSelection.set(v.length>1),this.listDoubleSelection.set(v.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{let v=this.getSelection(),b=this.getFocus();this.listHasSelectionOrFocus.set(v.length>0||b.length>0)})),this.disposables.add(c.onDidChangeConfiguration(v=>{v.affectsConfiguration(cue)&&(this._useAltAsMultipleSelectionModifier=l2(c));let b={};if(v.affectsConfiguration(VA)&&this.horizontalScrolling===void 0){let S=!!c.getValue(VA);b={...b,horizontalScrolling:S}}if(v.affectsConfiguration(tH)){let S=!!c.getValue(tH);b={...b,scrollByPage:S}}if(v.affectsConfiguration(iH)){let S=!!c.getValue(iH);b={...b,smoothScrolling:S}}if(v.affectsConfiguration(s2)){let S=c.getValue(s2);b={...b,mouseWheelScrollSensitivity:S}}if(v.affectsConfiguration(a2)){let S=c.getValue(a2);b={...b,fastScrollSensitivity:S}}Object.keys(b).length>0&&this.updateOptions(b)})),this.navigator=new zpi(this,{configurationService:c,...r}),this.disposables.add(this.navigator)}updateOptions(i){super.updateOptions(i),i.overrideStyles!==void 0&&this.updateStyles(i.overrideStyles),i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyles(i){this.style(i?WS(i):iJ)}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}dispose(){this.disposables.dispose(),super.dispose()}};Cx=I([m(6,X),m(7,Co),m(8,B),m(9,F)],Cx);function GT(a="keydown",i,e){let t=new KeyboardEvent(a);return t.preserveFocus=i,t.pinned=e,t.__forceEvent=!0,t}var E6e=class extends k{constructor(e,t){super();this.widget=e;this._onDidOpen=this._register(new T);this.onDidOpen=this._onDidOpen.event;this._register(U.filter(this.widget.onDidChangeSelection,o=>sf(o.browserEvent))(o=>this.onSelectionFromKeyboard(o))),this._register(this.widget.onPointer(o=>this.onPointer(o.element,o.browserEvent))),this._register(this.widget.onMouseDblClick(o=>this.onMouseDblClick(o.element,o.browserEvent))),typeof t?.openOnSingleClick!="boolean"&&t?.configurationService?(this.openOnSingleClick=t?.configurationService.getValue(bTt)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(bTt)&&(this.openOnSingleClick=t?.configurationService.getValue(bTt)!=="doubleClick")}))):this.openOnSingleClick=t?.openOnSingleClick??!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;let t=e.browserEvent,o=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,n=typeof t.pinned=="boolean"?t.pinned:!o;this._open(this.getSelectedElement(),o,n,!1,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;let n=t.button===1,r=!0,s=n,l=t.ctrlKey||t.metaKey||t.altKey;this._open(e,r,s,l,t)}onMouseDblClick(e,t){if(!t)return;let o=t.target;if(o.classList.contains("monaco-tl-twistie")||o.classList.contains("monaco-icon-label")&&o.classList.contains("folder-icon")&&t.offsetX<16)return;let r=!1,s=!0,l=t.ctrlKey||t.metaKey||t.altKey;this._open(e,r,s,l,t)}_open(e,t,o,n,r){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:o,revealIfVisible:!0},sideBySide:n,element:e,browserEvent:r})}},kTt=class extends E6e{constructor(i,e){super(i,e),this.widget=i}getSelectedElement(){return this.widget.getSelectedElements()[0]}},zpi=class extends E6e{constructor(i,e){super(i,e)}getSelectedElement(){return this.widget.getSelectedElements()[0]}},Kpi=class extends E6e{constructor(i,e){super(i,e)}getSelectedElement(){return this.widget.getSelection()[0]??void 0}};function S3o(a){let i=!1;return e=>{if(e.toKeyCodeChord().isModifierKey())return!1;if(i)return i=!1,!1;let t=a.softDispatch(e,e.target);return t.kind===1?(i=!0,!1):(i=!1,t.kind===0)}}var hf=class extends lC{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let{options:u,getTypeNavigationMode:p,disposable:h}=r.invokeFunction(D6e,n);super(i,e,t,o,u),this.disposables.add(h),this.internals=new R4(this,n,p,n.overrideStyles,s,l,c),this.disposables.add(this.internals)}updateOptions(i){super.updateOptions(i),this.internals.updateOptions(i)}};hf=I([m(5,F),m(6,X),m(7,Co),m(8,B)],hf);var l0=class extends MEe{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c){let{options:u,getTypeNavigationMode:p,disposable:h}=r.invokeFunction(D6e,n);super(i,e,t,o,u),this.disposables.add(h),this.internals=new R4(this,n,p,n.overrideStyles,s,l,c),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};l0=I([m(5,F),m(6,X),m(7,Co),m(8,B)],l0);var c0=class extends KT{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let{options:p,getTypeNavigationMode:h,disposable:g}=s.invokeFunction(D6e,r);super(i,e,t,o,n,p),this.disposables.add(g),this.internals=new R4(this,r,h,r.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles!==void 0&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};c0=I([m(6,F),m(7,X),m(8,Co),m(9,B)],c0);var Rp=class extends Zv{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u){let{options:p,getTypeNavigationMode:h,disposable:g}=s.invokeFunction(D6e,r);super(i,e,t,o,n,p),this.disposables.add(g),this.internals=new R4(this,r,h,r.overrideStyles,l,c,u),this.disposables.add(this.internals)}updateOptions(i={}){super.updateOptions(i),i.overrideStyles&&this.internals.updateStyleOverrides(i.overrideStyles),this.internals.updateOptions(i)}};Rp=I([m(6,F),m(7,X),m(8,Co),m(9,B)],Rp);var qy=class extends gTt{get contextKeyService(){return this.internals.contextKeyService}get useAltAsMultipleSelectionModifier(){return this.internals.useAltAsMultipleSelectionModifier}get onDidOpen(){return this.internals.onDidOpen}constructor(i,e,t,o,n,r,s,l,c,u,p){let{options:h,getTypeNavigationMode:g,disposable:f}=l.invokeFunction(D6e,s);super(i,e,t,o,n,r,h),this.disposables.add(f),this.internals=new R4(this,s,g,s.overrideStyles,c,u,p),this.disposables.add(this.internals)}updateOptions(i){super.updateOptions(i),this.internals.updateOptions(i)}};qy=I([m(7,F),m(8,X),m(9,Co),m(10,B)],qy);function Yto(a){let i=a.getValue(Ypi);if(i==="highlight")return 0;if(i==="filter")return 1;let e=a.getValue(ITt);if(e==="simple"||e==="highlight")return 0;if(e==="filter")return 1}function Xto(a){let i=a.getValue(Jpi);if(i==="fuzzy")return 0;if(i==="contiguous")return 1}function D6e(a,i){let e=a.get(B),t=a.get(qn),o=a.get(X),n=a.get(F),r=()=>{let h=o.getContextKeyValue(jto);if(h==="automatic")return 0;if(h==="trigger")return 1;if(o.getContextKeyValue(Qto)===!1)return 1;let f=e.getValue(Xpi);if(f==="automatic")return 0;if(f==="trigger")return 1},s=i.horizontalScrolling!==void 0?i.horizontalScrolling:!!e.getValue(VA),[l,c]=n.invokeFunction(RTt,i),u=i.paddingBottom,p=i.renderIndentGuides!==void 0?i.renderIndentGuides:e.getValue(yTt);return{getTypeNavigationMode:r,disposable:c,options:{keyboardSupport:!1,...l,indent:typeof e.getValue(k6e)=="number"?e.getValue(k6e):void 0,renderIndentGuides:p,smoothScrolling:!!e.getValue(iH),defaultFindMode:i.defaultFindMode??Yto(e),defaultFindMatchType:i.defaultFindMatchType??Xto(e),horizontalScrolling:s,scrollByPage:!!e.getValue(tH),paddingBottom:u,hideTwistiesOfChildlessElements:i.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:i.expandOnlyOnTwistieClick??e.getValue(wTt)==="doubleClick",contextViewProvider:t,findWidgetStyles:heo,enableStickyScroll:!!e.getValue(CTt),stickyScrollMaxItemCount:Number(e.getValue(xTt))}}}var R4=class{constructor(i,e,t,o,n,r,s){this.tree=i;this.disposables=[];this.contextKeyService=_Tt(n,i),this.disposables.push(DTt(this.contextKeyService,i)),this.listSupportsMultiSelect=CJ.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(e.multipleSelectionSupport!==!1),lue.bindTo(this.contextKeyService).set(!!e.selectionNavigation),this.listSupportFindWidget=qpi.bindTo(this.contextKeyService),this.listSupportFindWidget.set(e.findWidgetEnabled??!0),this.hasSelectionOrFocus=_6e.bindTo(this.contextKeyService),this.hasDoubleSelection=oH.bindTo(this.contextKeyService),this.hasMultiSelection=Gpi.bindTo(this.contextKeyService),this.treeElementCanCollapse=NEe.bindTo(this.contextKeyService),this.treeElementHasParent=$pi.bindTo(this.contextKeyService),this.treeElementCanExpand=OEe.bindTo(this.contextKeyService),this.treeElementHasChild=jpi.bindTo(this.contextKeyService),this.treeFindOpen=Qpi.bindTo(this.contextKeyService),this.treeStickyScrollFocused=AEe.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=l2(s),this.updateStyleOverrides(o);let c=()=>{let p=i.getFocus()[0];if(!p)return;let h=i.getNode(p);this.treeElementCanCollapse.set(h.collapsible&&!h.collapsed),this.treeElementHasParent.set(!!i.getParentElement(p)),this.treeElementCanExpand.set(h.collapsible&&h.collapsed),this.treeElementHasChild.set(!!i.getFirstElementChild(p))},u=new Set;u.add(jto),u.add(Qto),this.disposables.push(this.contextKeyService,r.register(i),i.onDidChangeSelection(()=>{let p=i.getSelection(),h=i.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(p.length>0||h.length>0),this.hasMultiSelection.set(p.length>1),this.hasDoubleSelection.set(p.length===2)})}),i.onDidChangeFocus(()=>{let p=i.getSelection(),h=i.getFocus();this.hasSelectionOrFocus.set(p.length>0||h.length>0),c()}),i.onDidChangeCollapseState(c),i.onDidChangeModel(c),i.onDidChangeFindOpenState(p=>this.treeFindOpen.set(p)),i.onDidChangeStickyScrollFocused(p=>this.treeStickyScrollFocused.set(p)),s.onDidChangeConfiguration(p=>{let h={};if(p.affectsConfiguration(cue)&&(this._useAltAsMultipleSelectionModifier=l2(s)),p.affectsConfiguration(k6e)){let g=s.getValue(k6e);h={...h,indent:g}}if(p.affectsConfiguration(yTt)&&e.renderIndentGuides===void 0){let g=s.getValue(yTt);h={...h,renderIndentGuides:g}}if(p.affectsConfiguration(iH)){let g=!!s.getValue(iH);h={...h,smoothScrolling:g}}if(p.affectsConfiguration(Ypi)||p.affectsConfiguration(ITt)){let g=Yto(s);h={...h,defaultFindMode:g}}if(p.affectsConfiguration(Xpi)||p.affectsConfiguration(ITt)){let g=t();h={...h,typeNavigationMode:g}}if(p.affectsConfiguration(Jpi)){let g=Xto(s);h={...h,defaultFindMatchType:g}}if(p.affectsConfiguration(VA)&&e.horizontalScrolling===void 0){let g=!!s.getValue(VA);h={...h,horizontalScrolling:g}}if(p.affectsConfiguration(tH)){let g=!!s.getValue(tH);h={...h,scrollByPage:g}}if(p.affectsConfiguration(wTt)&&e.expandOnlyOnTwistieClick===void 0&&(h={...h,expandOnlyOnTwistieClick:s.getValue(wTt)==="doubleClick"}),p.affectsConfiguration(CTt)){let g=s.getValue(CTt);h={...h,enableStickyScroll:g}}if(p.affectsConfiguration(xTt)){let g=Math.max(1,s.getValue(xTt));h={...h,stickyScrollMaxItemCount:g}}if(p.affectsConfiguration(s2)){let g=s.getValue(s2);h={...h,mouseWheelScrollSensitivity:g}}if(p.affectsConfiguration(a2)){let g=s.getValue(a2);h={...h,fastScrollSensitivity:g}}Object.keys(h).length>0&&i.updateOptions(h)}),this.contextKeyService.onDidChangeContext(p=>{p.affectsSome(u)&&i.updateOptions({typeNavigationMode:t()})})),this.navigator=new Kpi(i,{configurationService:s,...e}),this.disposables.push(this.navigator)}get onDidOpen(){return this.navigator.onDidOpen}get useAltAsMultipleSelectionModifier(){return this._useAltAsMultipleSelectionModifier}updateOptions(i){i.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!i.multipleSelectionSupport)}updateStyleOverrides(i){this.tree.style(i?WS(i):iJ)}dispose(){this.disposables=je(this.disposables)}};R4=I([m(4,X),m(5,Co),m(6,B)],R4);var I3o=oe.as($t.Configuration);I3o.registerConfiguration({id:"workbench",order:7,title:d(2404,null),type:"object",properties:{[cue]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[d(2397,null),d(2396,null)],default:"ctrlCmd",description:d(2395,null)},[bTt]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:d(2398,null)},[VA]:{type:"boolean",default:!1,description:d(2386,null)},[tH]:{type:"boolean",default:!1,description:d(2393,null)},[k6e]:{type:"number",default:8,minimum:4,maximum:40,description:d(2402,null)},[yTt]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:d(2399,null)},[iH]:{type:"boolean",default:!1,description:d(2392,null)},[s2]:{type:"number",default:1,markdownDescription:d(2394,null)},[a2]:{type:"number",default:5,markdownDescription:d(2385,null)},[Ypi]:{type:"string",enum:["highlight","filter"],enumDescriptions:[d(2383,null),d(2382,null)],default:"highlight",description:d(2381,null)},[ITt]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[d(2390,null),d(2389,null),d(2388,null)],default:"highlight",description:d(2387,null),deprecated:!0,deprecationMessage:d(2391,null)},[Jpi]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[d(2380,null),d(2379,null)],default:"fuzzy",description:d(2378,null)},[wTt]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:d(2384,null)},[CTt]:{type:"boolean",default:!0,description:d(2400,null)},[xTt]:{type:"number",minimum:1,default:7,markdownDescription:d(2401,null,"`#workbench.tree.enableStickyScroll#`")},[Xpi]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:d(2403,null)}}});var hM=class{constructor(i,e,t,o){this.isProviderFirst=i;this.parent=e;this.link=t;this._rangeCallback=o;this.id=o4.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(i){this._range=i,this._rangeCallback(this)}get ariaMessage(){let i=this.parent.getPreview(this)?.preview(this.range);return i?d(1260,null,i.value,Be(this.uri),this.range.startLineNumber,this.range.startColumn):d(1259,null,Be(this.uri),this.range.startLineNumber,this.range.startColumn)}},Zpi=class{constructor(i){this._modelReference=i}dispose(){this._modelReference.dispose()}preview(i,e=8){let t=this._modelReference.object.textEditorModel;if(!t)return;let{startLineNumber:o,startColumn:n,endLineNumber:r,endColumn:s}=i,l=t.getWordUntilPosition({lineNumber:o,column:n-e}),c=new G(o,l.startColumn,o,n),u=new G(r,s,r,1073741824),p=t.getValueInRange(c).replace(/^\s+/,""),h=t.getValueInRange(i),g=t.getValueInRange(u).replace(/\s+$/,"");return{value:p+h+g,highlight:{start:p.length,end:p.length+h.length}}}},c2=class{constructor(i,e){this.parent=i;this.uri=e;this.children=[];this._previews=new dt}dispose(){je(this._previews.values()),this._previews.clear()}getPreview(i){return this._previews.get(i.uri)}get ariaMessage(){let i=this.children.length;return i===1?d(1257,null,Be(this.uri),this.uri.fsPath):d(1258,null,i,Be(this.uri),this.uri.fsPath)}async resolve(i){if(this._previews.size!==0)return this;for(let e of this.children)if(!this._previews.has(e.uri))try{let t=await i.createModelReference(e.uri);this._previews.set(e.uri,new Zpi(t))}catch(t){mt(t)}return this}},dC=class a{constructor(i,e){this.groups=[];this.references=[];this._onDidChangeReferenceRange=new T;this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event;this._links=i,this._title=e;let[t]=i;i.sort(a._compareReferences);let o;for(let n of i)if((!o||!Jn.isEqual(o.uri,n.uri,!0))&&(o=new c2(this,n.uri),this.groups.push(o)),o.children.length===0||a._compareReferences(n,o.children[o.children.length-1])!==0){let r=new hM(t===n,o,n,s=>this._onDidChangeReferenceRange.fire(s));this.references.push(r),o.children.push(r)}}dispose(){je(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new a(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?d(1261,null):this.references.length===1?d(1262,null,this.references[0].uri.fsPath):this.groups.length===1?d(1263,null,this.references.length,this.groups[0].uri.fsPath):d(1264,null,this.references.length,this.groups.length)}nextOrPreviousReference(i,e){let{parent:t}=i,o=t.children.indexOf(i),n=t.children.length,r=t.parent.groups.length;return r===1||e&&o+1<n||!e&&o>0?(e?o=(o+1)%n:o=(o+n-1)%n,t.children[o]):(o=t.parent.groups.indexOf(t),e?(o=(o+1)%r,t.parent.groups[o].children[0]):(o=(o+r-1)%r,t.parent.groups[o].children[t.parent.groups[o].children.length-1]))}nearestReference(i,e){let t=this.references.map((o,n)=>({idx:n,prefixLen:Af(o.uri.toString(),i.toString()),offsetDist:Math.abs(o.range.startLineNumber-e.lineNumber)*100+Math.abs(o.range.startColumn-e.column)})).sort((o,n)=>o.prefixLen>n.prefixLen?-1:o.prefixLen<n.prefixLen?1:o.offsetDist<n.offsetDist?-1:o.offsetDist>n.offsetDist?1:0)[0];if(t)return this.references[t.idx]}referenceAt(i,e){for(let t of this.references)if(t.uri.toString()===i.toString()&&G.containsPosition(t.range,e))return t}firstReference(){for(let i of this.references)if(i.isProviderFirst)return i;return this.references[0]}static _compareReferences(i,e){return Jn.compare(i.uri,e.uri)||G.compareRangesUsingStarts(i.range,e.range)}};var eb=class extends k{constructor(e,t,o){super();this.options=t;this.styles=o;this.count=0;this.hover=this._register(new ue);this.element=D(e,_(".monaco-count-badge")),this._register(ee(()=>e.removeChild(this.element))),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0),this.updateHover()}setCount(e){this.count=e,this.render()}setCountFormat(e){this.countFormat=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.updateHover(),this.render()}updateHover(){this.titleFormat!==""&&!this.hover.value?this.hover.value=sp().setupDelayedHoverAtMouse(this.element,()=>({content:Wd(this.titleFormat,this.count),appearance:{compact:!0}})):this.titleFormat===""&&this.hover.value&&(this.hover.value=void 0)}render(){this.element.textContent=Wd(this.countFormat,this.count),this.element.style.backgroundColor=this.styles.badgeBackground??"",this.element.style.color=this.styles.badgeForeground??"",this.styles.badgeBorder&&(this.element.style.border=`1px solid ${this.styles.badgeBorder}`)}};var ul=class a extends k{constructor(e,t){super();this.options=t;this.text="";this.title="";this.highlights=[];this.didEverRender=!1;this.domNode=D(e,_("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],o="",n,r){e||(e=""),n&&(e=a.escapeNewLines(e,t)),!(this.didEverRender&&this.text===e&&this.title===o&&Qi(this.highlights,t))&&(this.text=e,this.title=o,this.highlights=t,this.render(r))}render(e){let t=[],o=0;for(let n of this.highlights){if(n.end===n.start)continue;if(o<n.start){let l=this.text.substring(o,n.start);e?t.push(...ir(l)):t.push(l),o=n.start}let r=this.text.substring(o,n.end),s=_("span.highlight",void 0,...e?ir(r):[r]);n.extraClasses&&s.classList.add(...n.extraClasses),t.push(s),o=n.end}if(o<this.text.length){let n=this.text.substring(o);e?t.push(...ir(n)):t.push(n)}if(Ii(this.domNode,...t),!this.customHover&&this.title!==""){let n=this.options?.hoverDelegate??yi("mouse");this.customHover=this._register(sp().setupManagedHover(n,this.domNode,this.title))}else this.customHover&&this.customHover.update(this.title);this.didEverRender=!0}static escapeNewLines(e,t){let o=0,n=0;return e.replace(/\r\n|\r|\n/g,(r,s)=>{n=r===`\r
`?-1:0,s+=o;for(let l of t)l.end<=s||(l.start>=s&&(l.start+=n),l.end>=s&&(l.end+=n));return o+=n,"\u23CE"})}};var due=class{constructor(i){this._element=i}get element(){return this._element}set textContent(i){this.disposed||i===this._textContent||(this._textContent=i,this._element.textContent=i)}set classNames(i){this.disposed||Qi(i,this._classNames)||(this._classNames=i,this._element.classList.value="",this._element.classList.add(...i))}set empty(i){this.disposed||i===this._empty||(this._empty=i,this._element.style.marginLeft=i?"0":"")}dispose(){this.disposed=!0}},ld=class extends k{constructor(e,t){super();this.customHovers=new Map;this.creationOptions=t,this.domNode=this._register(new due(D(e,_(".monaco-icon-label")))),this.labelContainer=D(this.domNode.element,_(".monaco-icon-label-container")),this.nameContainer=D(this.labelContainer,_("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new tmi(this.nameContainer,!!t.supportIcons)):this.nameNode=new emi(this.nameContainer),this.hoverDelegate=t?.hoverDelegate??yi("mouse")}get element(){return this.domNode.element}setLabel(e,t,o){let n=["monaco-icon-label"],r=["monaco-icon-label-container"],s="";o&&(o.extraClasses&&n.push(...o.extraClasses),o.bold&&n.push("bold"),o.italic&&n.push("italic"),o.strikethrough&&n.push("strikethrough"),o.disabledCommand&&r.push("disabled"),o.title&&(typeof o.title=="string"?s+=o.title:s+=e));let l=this.domNode.element.querySelector(".monaco-icon-label-iconpath");if(o?.iconPath){let c;if(!l||!go(l)?(c=_(".monaco-icon-label-iconpath"),this.domNode.element.prepend(c)):c=l,q.isThemeIcon(o.iconPath)){let u=q.asClassName(o.iconPath);c.className=`monaco-icon-label-iconpath ${u}`,c.style.backgroundImage=""}else c.style.backgroundImage=cl(o?.iconPath);c.style.backgroundRepeat="no-repeat",c.style.backgroundPosition="center",c.style.backgroundSize="contain"}else l&&l.remove();if(this.domNode.classNames=n,this.domNode.element.setAttribute("aria-label",s),this.labelContainer.classList.value="",this.labelContainer.classList.add(...r),this.setupHover(o?.descriptionTitle?this.labelContainer:this.element,o?.title),this.nameNode.setLabel(e,o),t||this.descriptionNode){let c=this.getOrCreateDescriptionNode();if(c instanceof ul){let u=o?.supportIcons??this.creationOptions?.supportIcons;c.set(t||"",o?o.descriptionMatches:void 0,void 0,o?.labelEscapeNewLines,u),this.setupHover(c.element,o?.descriptionTitle)}else c.textContent=t&&o?.labelEscapeNewLines?ul.escapeNewLines(t,[]):t||"",this.setupHover(c.element,o?.descriptionTitle||""),c.empty=!t}if(o?.suffix||this.suffixNode){let c=this.getOrCreateSuffixNode();c.textContent=o?.suffix??""}}setupHover(e,t){let o=this.customHovers.get(e);if(o&&(o.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}let n=e;if(this.creationOptions?.hoverTargetOverride){if(!ms(e,this.creationOptions.hoverTargetOverride))throw new Error("hoverTargetOverrride must be an ancestor of the htmlElement");n=this.creationOptions.hoverTargetOverride}let r=sp().setupManagedHover(this.hoverDelegate,n,t);r&&this.customHovers.set(e,r)}dispose(){super.dispose();for(let e of this.customHovers.values())e.dispose();this.customHovers.clear()}getOrCreateSuffixNode(){if(!this.suffixNode){let e=this._register(new due(Bbt(this.nameContainer,_("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new due(D(e.element,_("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){if(!this.descriptionNode){let e=this._register(new due(D(this.labelContainer,_("span.monaco-icon-description-container"))));this.creationOptions?.supportDescriptionHighlights?this.descriptionNode=this._register(new ul(D(e.element,_("span.label-description")))):this.descriptionNode=this._register(new due(D(e.element,_("span.label-description"))))}return this.descriptionNode}},emi=class{constructor(i){this.container=i;this.label=void 0;this.singleLabel=void 0}setLabel(i,e){if(!(this.label===i&&Qi(this.options,e)))if(this.label=i,this.options=e,typeof i=="string")this.singleLabel||(this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=D(this.container,_("a.label-name",{id:e?.domId}))),this.singleLabel.textContent=i;else{this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let t=0;t<i.length;t++){let o=i[t],n=e?.domId&&`${e?.domId}_${t}`;D(this.container,_("a.label-name",{id:n,"data-icon-label-count":i.length,"data-icon-label-index":t,role:"treeitem"},o)),t<i.length-1&&D(this.container,_("span.label-separator",void 0,e?.separator||"/"))}}}};function y3o(a,i,e){if(!e)return;let t=0;return a.map(o=>{let n={start:t,end:t+o.length},r=e.map(s=>OS.intersect(n,s)).filter(s=>!OS.isEmpty(s)).map(({start:s,end:l})=>({start:s-t,end:l-t}));return t=n.end+i.length,r})}var tmi=class extends k{constructor(e,t){super();this.container=e;this.supportIcons=t;this.label=void 0;this.singleLabel=void 0;this._labelDisposables=this._register(new O)}setLabel(e,t){if(this.label===e&&Qi(this.options,t))return;this.label=e,this.options=t;let o=t?.supportIcons??this.supportIcons;if(typeof e=="string")this.singleLabel||(this._labelDisposables.clear(),this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=this._labelDisposables.add(new ul(D(this.container,_("a.label-name",{id:t?.domId}))))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines,o);else{this._labelDisposables.clear(),this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;let n=t?.separator||"/",r=y3o(e,n,t?.matches);for(let s=0;s<e.length;s++){let l=e[s],c=r?r[s]:void 0,u=t?.domId&&`${t?.domId}_${s}`,p=_("a.label-name",{id:u,"data-icon-label-count":e.length,"data-icon-label-index":s,role:"treeitem"});this._labelDisposables.add(new ul(D(this.container,p))).set(l,c,void 0,t?.labelEscapeNewLines,o),s<e.length-1&&D(p,_("span.label-separator",void 0,n))}}}};var nt=le("labelService");var FEe=class{constructor(i){this._resolverService=i}hasChildren(i){return i instanceof dC||i instanceof c2}getChildren(i){if(i instanceof dC)return i.groups;if(i instanceof c2)return i.resolve(this._resolverService).then(e=>e.children);throw new Error("bad tree")}};FEe=I([m(0,Bt)],FEe);var LTt=class{getHeight(){return 23}getTemplateId(i){return i instanceof c2?M4.id:L6e.id}},WEe=class{constructor(i){this._keybindingService=i}getKeyboardNavigationLabel(i){if(i instanceof hM){let e=i.parent.getPreview(i)?.preview(i.range);if(e)return e.value}return Be(i.uri)}mightProducePrintableCharacter(i){return this._keybindingService.mightProducePrintableCharacter(i)}};WEe=I([m(0,Le)],WEe);var MTt=class{getId(i){return i instanceof hM?i.id:i.uri}},R6e=class extends k{constructor(e,t){super();this._labelService=t;let o=document.createElement("div");o.classList.add("reference-file"),this.file=this._register(new ld(o,{supportHighlights:!0})),this.badge=this._register(new eb(D(o,_(".count")),{},VI)),e.appendChild(o)}set(e,t){let o=ai(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(o,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});let n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(d(1252,null,n)):this.badge.setTitleFormat(d(1251,null,n))}};R6e=I([m(1,nt)],R6e);var M4=class{constructor(i){this._instantiationService=i;this.templateId=M4.id}static{this.id="FileReferencesRenderer"}renderTemplate(i){return this._instantiationService.createInstance(R6e,i)}renderElement(i,e,t){t.set(i.element,Wa(i.filterData))}disposeTemplate(i){i.dispose()}};M4=I([m(0,F)],M4);var imi=class extends k{constructor(i){super(),this.label=this._register(new ul(i))}set(i,e){let t=i.parent.getPreview(i)?.preview(i.range);if(!t||!t.value)this.label.set(`${Be(i.uri)}:${i.range.startLineNumber+1}:${i.range.startColumn+1}`);else{let{value:o,highlight:n}=t;e&&!Xv.isDefault(e)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(o,Wa(e))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(o,[n]))}}},L6e=class a{constructor(){this.templateId=a.id}static{this.id="OneReferenceRenderer"}renderTemplate(i){return new imi(i)}renderElement(i,e,t){t.set(i.element,i.filterData)}disposeTemplate(i){i.dispose()}},PTt=class{getWidgetAriaLabel(){return d(1253,null)}getAriaLabel(i){return i.ariaMessage}};var omi=class a{constructor(i,e){this._editor=i;this._model=e;this._decorations=new Map;this._decorationIgnoreSet=new Set;this._callOnDispose=new O;this._callOnModelChange=new O;this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}static{this.DecorationOptions=So.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"})}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();let i=this._editor.getModel();if(i){for(let e of this._model.references)if(e.uri.toString()===i.uri.toString()){this._addDecorations(e.parent);return}}}_addDecorations(i){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));let e=[],t=[];for(let o=0,n=i.children.length;o<n;o++){let r=i.children[o];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(e.push({range:r.range,options:a.DecorationOptions}),t.push(o))}this._editor.changeDecorations(o=>{let n=o.deltaDecorations([],e);for(let r=0;r<n.length;r++)this._decorations.set(n[r],i.children[t[r]])})}_onDecorationChanged(){let i=[],e=this._editor.getModel();if(e){for(let[t,o]of this._decorations){let n=e.getDecorationRange(t);if(!n)continue;let r=!1;if(!G.equalsRange(n,o.range)){if(G.spansMultipleLines(n))r=!0;else{let s=o.range.endColumn-o.range.startColumn,l=n.endColumn-n.startColumn;s!==l&&(r=!0)}r?(this._decorationIgnoreSet.add(o.id),i.push(t)):o.range=n}}for(let t=0,o=i.length;t<o;t++)this._decorations.delete(i[t]);this._editor.removeDecorations(i)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}},ATt=class{constructor(){this.ratio=.7;this.heightInLines=18}static fromJSON(i){let e,t;try{let o=JSON.parse(i);e=o.ratio,t=o.heightInLines}catch{}return{ratio:e||.7,heightInLines:t||18}}},nmi=class extends Rp{},M6e=class{constructor(i){this.labelService=i;this.disposables=new O}getDragURI(i){return i instanceof c2?i.uri.toString():i instanceof hM?$L(i.uri,i.range).toString():null}getDragLabel(i){return i.length===0?void 0:i.map(t=>this.labelService.getUriBasenameLabel(t.uri)).join(", ")}onDragStart(i,e){if(!e.dataTransfer)return;let o=i.elements.map(n=>this.getDragURI(n)).filter(Boolean);o.length&&(e.dataTransfer.setData(Fl.RESOURCES,JSON.stringify(o)),e.dataTransfer.setData(Fl.TEXT,o.join(`
`)))}onDragOver(){return!1}drop(){}dispose(){this.disposables.dispose()}};M6e=I([m(0,nt)],M6e);var VEe=class extends zT{constructor(e,t,o,n,r,s,l,c,u){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},s);this._defaultTreeKeyboardSupport=t;this.layoutData=o;this._textModelResolverService=r;this._instantiationService=s;this._peekViewService=l;this._uriLabel=c;this._keybindingService=u;this._disposeOnNewModel=new O;this._callOnDispose=new O;this._onDidSelectReference=this._callOnDispose.add(new T);this.onDidSelectReference=this._onDidSelectReference.event;this._dim=new di(0,0);this._isClosing=!1;this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}get isClosing(){return this._isClosing}dispose(){this._isClosing=!0,this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),je(this._preview),je(this._previewNotAvailableMessage),je(this._tree),je(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){let t=e.getColor(AD)||Ue.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(ZB)||Ue.transparent,primaryHeadingColor:e.getColor(n0),secondaryHeadingColor:e.getColor(r0)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=D(e,_("div.messages")),Wi(this._messageContainer),this._splitView=new Gp(e,{orientation:1}),this._previewContainer=D(e,_("div.preview.inline"));let t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(Ed,this._previewContainer,t,{},this.editor),Wi(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(Tp,d(1254,null),es,Tp.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=D(e,_("div.ref-tree.inline"));let o={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new PTt,keyboardNavigationLabelProvider:this._instantiationService.createInstance(WEe),identityProvider:new MTt,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:yJ},dnd:this._instantiationService.createInstance(M6e)};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Yo(this._treeContainer,"keydown",r=>{r.equals(9)&&(this._keybindingService.dispatchEvent(r,r.target),r.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(nmi,"ReferencesWidget",this._treeContainer,new LTt,[this._instantiationService.createInstance(M4),this._instantiationService.createInstance(L6e)],this._instantiationService.createInstance(FEe),o),this._splitView.addView({onDidChange:U.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:r=>{this._preview.layout({height:this._dim.height,width:r})}},Ac.Distribute),this._splitView.addView({onDidChange:U.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:r=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${r}px`,this._tree.layout(this._dim.height,r)}},Ac.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));let n=(r,s)=>{r instanceof hM&&(s==="show"&&this._revealReference(r,!1),this._onDidSelectReference.fire({element:r,kind:s,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(r=>{r.sideBySide?n(r.element,"side"):r.editorOptions.pinned?n(r.element,"goto"):n(r.element,"show")})),Wi(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new di(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=d(1255,null),Xo(this._messageContainer),Promise.resolve(void 0)):(Wi(this._messageContainer),this._decorationsManager=new omi(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{let{event:t,target:o}=e;if(t.detail!==2)return;let n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:o.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Xo(this._treeContainer),Xo(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){let[e]=this._tree.getFocus();if(e instanceof hM)return e;if(e instanceof c2&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Q.inMemory?this.setTitle(sl(e.uri),this._uriLabel.getUriLabel(ai(e.uri))):this.setTitle(d(1256,null));let o=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));let n=await o;if(!this._model){n.dispose();return}je(this._previewModelReference);let r=n.object;if(r){let s=this._preview.getModel()===r.textEditorModel?0:1,l=G.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(r.textEditorModel),this._preview.setSelection(l),this._preview.revealRangeInCenter(l,s)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};VEe=I([m(3,Pe),m(4,Bt),m(5,F),m(6,T4),m(7,nt),m(8,Le)],VEe);var uue=new Y("referenceSearchVisible",!1,d(1250,null)),qT=class{constructor(i,e,t,o,n,r,s,l){this._defaultTreeKeyboardSupport=i;this._editor=e;this._editorService=o;this._notificationService=n;this._instantiationService=r;this._storageService=s;this._configurationService=l;this._disposables=new O;this._requestIdPool=0;this._ignoreModelChangeEvent=!1;this._referenceSearchVisible=uue.bindTo(t)}static{this.ID="editor.contrib.referencesController"}static get(i){return i.getContribution(qT.ID)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(i,e,t){let o;if(this._widget&&(o=this._widget.position),this.closeWidget(),o&&i.containsPosition(o))return;this._peekMode=t,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));let n="peekViewLayout",r=ATt.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(VEe,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(d(1248,null)),this._widget.show(i),this._disposables.add(this._widget.onDidClose(()=>{e.cancel(),this._widget?(this._storageService.store(n,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{let{element:c,kind:u}=l;if(c)switch(u){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(c,!1,!1);break;case"side":this.openReference(c,!0,!1);break;case"goto":t?this._gotoReference(c,!0):this.openReference(c,!1,!0);break}}));let s=++this._requestIdPool;e.then(l=>{if(s!==this._requestIdPool||!this._widget){l.dispose();return}return this._model?.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(d(1249,null,this._model.title,this._model.references.length));let c=this._editor.getModel().uri,u=new ye(i.startLineNumber,i.startColumn),p=this._model.nearestReference(c,u);if(p)return this._widget.setSelection(p).then(()=>{this._widget&&this._editor.getOption(99)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(i){if(!this._editor.hasModel()||!this._model||!this._widget)return;let e=this._widget.position;if(!e)return;let t=this._model.nearestReference(this._editor.getModel().uri,e);if(!t)return;let o=this._model.nextOrPreviousReference(t,i),n=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(o),await this._gotoReference(o,!1),n?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(i){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(i)}closeWidget(i=!0){this._widget?.dispose(),this._model?.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,i&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(i,e){this._widget?.hide(),this._ignoreModelChangeEvent=!0;let t=G.lift(i.range).collapseToStart();return this._editorService.openCodeEditor({resource:i.uri,options:{selection:t,selectionSource:"code.jump",pinned:e}},this._editor).then(o=>{if(this._ignoreModelChangeEvent=!1,!o||!this._widget){this.closeWidget();return}if(this._editor===o)this._widget.show(t),this._widget.focusOnReferenceTree();else{let n=qT.get(o),r=this._model.clone();this.closeWidget(),o.focus(),n?.toggleWidget(t,Hn(s=>Promise.resolve(r)),this._peekMode??!1)}},o=>{this._ignoreModelChangeEvent=!1,mt(o)})}openReference(i,e,t){e||this.closeWidget();let{uri:o,range:n}=i;this._editorService.openCodeEditor({resource:o,options:{selection:n,selectionSource:"code.jump",pinned:t}},this._editor,e)}};qT=I([m(2,X),m(3,Qt),m(4,Ne),m(5,F),m(6,de),m(7,B)],qT);function pue(a,i){let e=DEe(a);if(!e)return;let t=qT.get(e);t&&i(t)}xt.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Gi(2089,60),when:C.or(uue,Fg.inPeekEditor),handler(a){pue(a,i=>{i.changeFocusBetweenPreviewAndReferences()})}});xt.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:C.or(uue,Fg.inPeekEditor),handler(a){pue(a,i=>{i.goToNextOrPreviousReference(!0)})}});xt.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:C.or(uue,Fg.inPeekEditor),handler(a){pue(a,i=>{i.goToNextOrPreviousReference(!1)})}});Ge.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Ge.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Ge.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Ge.registerCommand("closeReferenceSearch",a=>pue(a,i=>i.closeWidget()));xt.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:C.and(Fg.inPeekEditor,C.not("config.editor.stablePeek"))});xt.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:C.and(uue,C.not("config.editor.stablePeek"),C.or(me.editorTextFocus,Wg.negate()))});xt.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:C.and(uue,Nc,NEe.negate(),OEe.negate()),handler(a){let e=a.get(Co).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof hM&&pue(a,t=>t.revealReference(e[0]))}});xt.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:C.and(uue,Nc,NEe.negate(),OEe.negate()),handler(a){let e=a.get(Co).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof hM&&pue(a,t=>t.openReference(e[0],!0,!0))}});Ge.registerCommand("openReference",a=>{let e=a.get(Co).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof hM&&pue(a,t=>t.openReference(e[0],!1,!0))});var rmi=new Y("hasSymbols",!1,d(1265,null)),N6e=le("ISymbolNavigationService"),P6e=class{constructor(i,e,t,o){this._editorService=e;this._notificationService=t;this._keybindingService=o;this._currentModel=void 0;this._currentIdx=-1;this._ignoreEditorChange=!1;this._ctxHasSymbols=rmi.bindTo(i)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.close(),this._currentModel=void 0,this._currentIdx=-1}put(i){let e=i.parent.parent;if(e.references.length<=1){this.reset();return}this._currentModel=e,this._currentIdx=e.references.indexOf(i),this._ctxHasSymbols.set(!0),this._showMessage();let t=new A6e(this._editorService),o=t.onDidChange(n=>{if(this._ignoreEditorChange)return;let r=this._editorService.getActiveCodeEditor();if(!r)return;let s=r.getModel(),l=r.getPosition();if(!s||!l)return;let c=!1,u=!1;for(let p of e.references)if(ze(p.uri,s.uri))c=!0,u=u||G.containsPosition(p.range,l);else if(c)break;(!c||!u)&&this.reset()});this._currentState=Fn(t,o)}revealNext(i){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;let e=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:e.uri,options:{selection:G.collapseToStart(e.range),selectionRevealType:3}},i).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.close();let i=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),e=i?d(1267,null,this._currentIdx+1,this._currentModel.references.length,i.getLabel()):d(1266,null,this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(e)}};P6e=I([m(0,X),m(1,Qt),m(2,Ne),m(3,Le)],P6e);Ce(N6e,P6e,1);ro(new class extends od{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:rmi,kbOpts:{weight:100,primary:70}})}runEditorCommand(a,i){return a.get(N6e).revealNext(i)}});xt.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:rmi,primary:9,handler(a){a.get(N6e).reset()}});var A6e=class{constructor(i){this._listener=new Map;this._disposables=new O;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._disposables.add(i.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(i.onCodeEditorAdd(this._onDidAddEditor,this)),i.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),je(this._listener.values())}_onDidAddEditor(i){this._listener.set(i,Fn(i.onDidChangeCursorPosition(e=>this._onDidChange.fire({editor:i})),i.onDidChangeModelContent(e=>this._onDidChange.fire({editor:i}))))}_onDidRemoveEditor(i){this._listener.get(i)?.dispose(),this._listener.delete(i)}};A6e=I([m(0,Qt)],A6e);function smi(a,i){return i.uri.scheme===a.uri.scheme?!0:!gB(i.uri,Q.walkThroughSnippet,Q.vscodeChatCodeBlock,Q.vscodeChatCodeCompareBlock)}async function O6e(a,i,e,t,o){let r=e.ordered(a,t).map(l=>Promise.resolve(o(l,a,i)).then(void 0,c=>{vs(c)})),s=await Promise.all(r);return ui(s.flat()).filter(l=>smi(a,l))}function d0(a,i,e,t,o){return O6e(i,e,a,t,(n,r,s)=>n.provideDefinition(r,s,o))}function NTt(a,i,e,t,o){return O6e(i,e,a,t,(n,r,s)=>n.provideDeclaration(r,s,o))}function BEe(a,i,e,t,o){return O6e(i,e,a,t,(n,r,s)=>n.provideImplementation(r,s,o))}function OTt(a,i,e,t,o){return O6e(i,e,a,t,(n,r,s)=>n.provideTypeDefinition(r,s,o))}function xJ(a,i,e,t,o,n){return O6e(i,e,a,o,async(r,s,l)=>{let c=(await r.provideReferences(s,l,{includeDeclaration:!0},n))?.filter(p=>smi(s,p));if(!t||!c||c.length!==2)return c;let u=(await r.provideReferences(s,l,{includeDeclaration:!1},n))?.filter(p=>smi(s,p));return u&&u.length===1?u:c})}async function d2(a){let i=await a(),e=new dC(i,""),t=e.references.map(o=>o.link);return e.dispose(),t}kI("_executeDefinitionProvider",(a,i,e)=>{let t=a.get(Jt),o=d0(t.definitionProvider,i,e,!1,Ie.None);return d2(()=>o)});kI("_executeDefinitionProvider_recursive",(a,i,e)=>{let t=a.get(Jt),o=d0(t.definitionProvider,i,e,!0,Ie.None);return d2(()=>o)});kI("_executeTypeDefinitionProvider",(a,i,e)=>{let t=a.get(Jt),o=OTt(t.typeDefinitionProvider,i,e,!1,Ie.None);return d2(()=>o)});kI("_executeTypeDefinitionProvider_recursive",(a,i,e)=>{let t=a.get(Jt),o=OTt(t.typeDefinitionProvider,i,e,!0,Ie.None);return d2(()=>o)});kI("_executeDeclarationProvider",(a,i,e)=>{let t=a.get(Jt),o=NTt(t.declarationProvider,i,e,!1,Ie.None);return d2(()=>o)});kI("_executeDeclarationProvider_recursive",(a,i,e)=>{let t=a.get(Jt),o=NTt(t.declarationProvider,i,e,!0,Ie.None);return d2(()=>o)});kI("_executeReferenceProvider",(a,i,e)=>{let t=a.get(Jt),o=xJ(t.referenceProvider,i,e,!1,!1,Ie.None);return d2(()=>o)});kI("_executeReferenceProvider_recursive",(a,i,e)=>{let t=a.get(Jt),o=xJ(t.referenceProvider,i,e,!1,!0,Ie.None);return d2(()=>o)});kI("_executeImplementationProvider",(a,i,e)=>{let t=a.get(Jt),o=BEe(t.implementationProvider,i,e,!1,Ie.None);return d2(()=>o)});kI("_executeImplementationProvider_recursive",(a,i,e)=>{let t=a.get(Jt),o=BEe(t.implementationProvider,i,e,!0,Ie.None);return d2(()=>o)});be.appendMenuItem(R.EditorContext,{submenu:R.EditorContextPeek,title:d(1241,null),group:"navigation",order:100});var mue=class a{constructor(i,e){this.model=i;this.position=e}static is(i){return!i||typeof i!="object"?!1:!!(i instanceof a||ye.isIPosition(i.position)&&i.model)}},u0=class a extends yl{static{this._allSymbolNavigationCommands=new Map}static{this._activeAlternativeCommands=new Set}static all(){return a._allSymbolNavigationCommands.values()}static _patchConfig(i){let e={...i,f1:!0};if(e.menu)for(let t of yt.wrap(e.menu))(t.id===R.EditorContext||t.id===R.EditorContextPeek)&&(t.when=C.and(i.precondition,t.when));return e}constructor(i,e){super(a._patchConfig(e)),this.configuration=i,a._allSymbolNavigationCommands.set(e.id,this)}runEditorCommand(i,e,t,o){if(!e.hasModel())return Promise.resolve(void 0);let n=i.get(Ne),r=i.get(Qt),s=i.get(Hd),l=i.get(N6e),c=i.get(Jt),u=i.get(F),p=e.getModel(),h=e.getPosition(),g=mue.is(t)?t:new mue(p,h),f=new $k(e,5),v=Ea(this._getLocationModel(c,g.model,g.position,f.token),f.token).then(async b=>{if(!b||f.token.isCancellationRequested)return;cn(b.ariaMessage);let S;if(b.referenceAt(p.uri,h)){let w=this._getAlternativeCommand(e);w!==void 0&&!a._activeAlternativeCommands.has(w)&&a._allSymbolNavigationCommands.has(w)&&(S=a._allSymbolNavigationCommands.get(w))}let y=b.references.length;if(y===0){if(!this.configuration.muteMessage){let w=p.getWordAtPosition(h);Xu.get(e)?.showMessage(this._getNoResultFoundMessage(w),h)}}else if(y===1&&S)a._activeAlternativeCommands.add(this.desc.id),u.invokeFunction(w=>S.runEditorCommand(w,e,t,o).finally(()=>{a._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,l,e,b,o)},b=>{n.error(b)}).finally(()=>{f.dispose()});return s.showWhile(v,250),v}async _onResult(i,e,t,o,n){let r=this._getGoToPreference(t);if(!(t instanceof Ed)&&(this.configuration.openInPeek||r==="peek"&&o.references.length>1))this._openInPeek(t,o,n);else{let s=o.firstReference(),l=o.references.length>1&&r==="gotoAndPeek",c=await this._openReference(t,i,s,this.configuration.openToSide,!l);l&&c?this._openInPeek(c,o,n):o.dispose(),r==="goto"&&e.put(s)}}async _openReference(i,e,t,o,n){let r;if(H6i(t)&&(r=t.targetSelectionRange),r||(r=t.range),!r)return;let s=await e.openCodeEditor({resource:t.uri,options:{selection:G.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},i,o);if(s){if(n){let l=s.getModel(),c=s.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{s.getModel()===l&&c.clear()},350)}return s}}_openInPeek(i,e,t){let o=qT.get(i);o&&i.hasModel()?o.toggleWidget(t??i.getSelection(),Hn(n=>Promise.resolve(e)),this.configuration.openInPeek):e.dispose()}},nH=class extends u0{async _getLocationModel(i,e,t,o){return new dC(await d0(i.definitionProvider,e,t,!1,o),d(1224,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1240,null,i.word):d(1226,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeDefinitionCommand}_getGoToPreference(i){return i.getOption(67).multipleDefinitions}};W(class ami extends nH{static{this.id="editor.action.revealDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:ami.id,title:{...P(1212,"Go to Definition"),mnemonicTitle:d(1236,null)},precondition:me.hasDefinitionProvider,keybinding:[{when:me.editorTextFocus,primary:70,weight:100},{when:C.and(me.editorTextFocus,Mu),primary:2118,weight:100}],menu:[{id:R.EditorContext,group:"navigation",order:1.1},{id:R.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Ge.registerCommandAlias("editor.action.goToDeclaration",ami.id)}});W(class lmi extends nH{static{this.id="editor.action.revealDefinitionAside"}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:lmi.id,title:P(1214,"Open Definition to the Side"),precondition:C.and(me.hasDefinitionProvider,me.isInEmbeddedEditor.toNegated()),keybinding:[{when:me.editorTextFocus,primary:Gi(2089,70),weight:100},{when:C.and(me.editorTextFocus,Mu),primary:Gi(2089,2118),weight:100}]}),Ge.registerCommandAlias("editor.action.openDeclarationToTheSide",lmi.id)}});W(class cmi extends nH{static{this.id="editor.action.peekDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:cmi.id,title:P(1220,"Peek Definition"),precondition:C.and(me.hasDefinitionProvider,Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated()),keybinding:{when:me.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:R.EditorContextPeek,group:"peek",order:2}}),Ge.registerCommandAlias("editor.action.previewDeclaration",cmi.id)}});var FTt=class extends u0{async _getLocationModel(i,e,t,o){return new dC(await NTt(i.declarationProvider,e,t,!1,o),d(1223,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1222,null,i.word):d(1221,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeDeclarationCommand}_getGoToPreference(i){return i.getOption(67).multipleDeclarations}};W(class Jto extends FTt{static{this.id="editor.action.revealDeclaration"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Jto.id,title:{...P(1213,"Go to Declaration"),mnemonicTitle:d(1235,null)},precondition:C.and(me.hasDeclarationProvider,me.isInEmbeddedEditor.toNegated()),menu:[{id:R.EditorContext,group:"navigation",order:1.3},{id:R.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(i){return i&&i.word?d(1222,null,i.word):d(1221,null)}});W(class extends FTt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:P(1217,"Peek Declaration"),precondition:C.and(me.hasDeclarationProvider,Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated()),menu:{id:R.EditorContextPeek,group:"peek",order:3}})}});var WTt=class extends u0{async _getLocationModel(i,e,t,o){return new dC(await OTt(i.typeDefinitionProvider,e,t,!1,o),d(1246,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1232,null,i.word):d(1231,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeTypeDefinitionCommand}_getGoToPreference(i){return i.getOption(67).multipleTypeDefinitions}};W(class Zto extends WTt{static{this.ID="editor.action.goToTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Zto.ID,title:{...P(1216,"Go to Type Definition"),mnemonicTitle:d(1239,null)},precondition:me.hasTypeDefinitionProvider,keybinding:{when:me.editorTextFocus,primary:0,weight:100},menu:[{id:R.EditorContext,group:"navigation",order:1.4},{id:R.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}});W(class eio extends WTt{static{this.ID="editor.action.peekTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:eio.ID,title:P(1219,"Peek Type Definition"),precondition:C.and(me.hasTypeDefinitionProvider,Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated()),menu:{id:R.EditorContextPeek,group:"peek",order:4}})}});var VTt=class extends u0{async _getLocationModel(i,e,t,o){return new dC(await BEe(i.implementationProvider,e,t,!1,o),d(1233,null))}_getNoResultFoundMessage(i){return i&&i.word?d(1229,null,i.word):d(1228,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeImplementationCommand}_getGoToPreference(i){return i.getOption(67).multipleImplementations}};W(class tio extends VTt{static{this.ID="editor.action.goToImplementation"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:tio.ID,title:{...P(1215,"Go to Implementations"),mnemonicTitle:d(1237,null)},precondition:me.hasImplementationProvider,keybinding:{when:me.editorTextFocus,primary:2118,weight:100},menu:[{id:R.EditorContext,group:"navigation",order:1.45},{id:R.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}});W(class iio extends VTt{static{this.ID="editor.action.peekImplementation"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:iio.ID,title:P(1218,"Peek Implementations"),precondition:C.and(me.hasImplementationProvider,Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated()),keybinding:{when:me.editorTextFocus,primary:3142,weight:100},menu:{id:R.EditorContextPeek,group:"peek",order:5}})}});var BTt=class extends u0{_getNoResultFoundMessage(i){return i?d(1244,null,i.word):d(1245,null)}_getAlternativeCommand(i){return i.getOption(67).alternativeReferenceCommand}_getGoToPreference(i){return i.getOption(67).multipleReferences}};W(class extends BTt{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...P(1230,"Go to References"),mnemonicTitle:d(1238,null)},precondition:C.and(me.hasReferenceProvider,Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated()),keybinding:{when:me.editorTextFocus,primary:1094,weight:100},menu:[{id:R.EditorContext,group:"navigation",order:1.45},{id:R.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(i,e,t,o){return new dC(await xJ(i.referenceProvider,e,t,!0,!1,o),d(1242,null))}});W(class extends BTt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:P(1243,"Peek References"),precondition:C.and(me.hasReferenceProvider,Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated()),menu:{id:R.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(i,e,t,o){return new dC(await xJ(i.referenceProvider,e,t,!1,!1,o),d(1242,null))}});var dmi=class extends u0{constructor(e,t,o){super(e,{id:"editor.action.goToLocation",title:P(1234,"Go to Any Symbol"),precondition:C.and(Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated())});this._references=t;this._gotoMultipleBehaviour=o}async _getLocationModel(e,t,o,n){return new dC(this._references,d(1227,null))}_getNoResultFoundMessage(e){return e&&d(1225,null,e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(67).multipleReferences}_getAlternativeCommand(){}};Ge.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:A},{name:"position",description:"The position at which to start",constraint:ye.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(a,i,e,t,o,n,r)=>{To(A.isUri(i)),To(ye.isIPosition(e)),To(Array.isArray(t)),To(typeof o>"u"||typeof o=="string"),To(typeof r>"u"||typeof r=="boolean");let s=a.get(Qt),l=await s.openCodeEditor({resource:i},s.getFocusedCodeEditor());if(fn(l))return l.setPosition(e),l.revealPositionInCenterIfOutsideViewport(e,0),l.invokeWithinContext(c=>{let u=new class extends dmi{_getNoResultFoundMessage(p){return n||super._getNoResultFoundMessage(p)}}({muteMessage:!n,openInPeek:!!r,openToSide:!1},t,o);c.get(F).invokeFunction(u.run.bind(u),l)})}});Ge.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:A},{name:"position",description:"The position at which to start",constraint:ye.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(a,i,e,t,o)=>{a.get(fe).executeCommand("editor.action.goToLocations",i,e,t,o,void 0,!0)}});Ge.registerCommand({id:"editor.action.findReferences",handler:(a,i,e)=>{To(A.isUri(i)),To(ye.isIPosition(e));let t=a.get(Jt),o=a.get(Qt);return o.openCodeEditor({resource:i},o.getFocusedCodeEditor()).then(n=>{if(!fn(n)||!n.hasModel())return;let r=qT.get(n);if(!r)return;let s=Hn(c=>xJ(t.referenceProvider,n.getModel(),ye.lift(e),!1,!1,c).then(u=>new dC(u,d(1242,null)))),l=new G(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(r.toggleWidget(l,s,!1))})}});Ge.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function oio(a,i,e,t){let o=a.get(Bt),n=a.get(Xe),r=a.get(fe),s=a.get(F),l=a.get(Ne);if(await t.item.resolve(Ie.None),!t.part.location)return;let c=t.part.location,u=[],p=new Set(be.getMenuItems(R.EditorContext).map(g=>cT(g)?g.command.id:ht()));for(let g of u0.all())p.has(g.desc.id)&&u.push(new it(g.desc.id,Do.label(g.desc,{renderShortTitle:!0}),void 0,!0,async()=>{let f=await o.createModelReference(c.uri);try{let v=new mue(f.object.textEditorModel,G.getStartPosition(c.range)),b=t.item.anchor.range;await s.invokeFunction(g.runEditorCommand.bind(g),i,v,b)}finally{f.dispose()}}));if(t.part.command){let{command:g}=t.part;u.push(new oi),u.push(new it(g.id,g.title,void 0,!0,async()=>{try{await r.executeCommand(g.id,...g.arguments??[])}catch(f){l.notify({severity:ft.Error,source:t.item.provider.displayName,message:f})}}))}let h=i.getOption(144);n.showContextMenu({domForShadowRoot:h?i.getDomNode()??void 0:void 0,getAnchor:()=>{let g=ur(e);return{x:g.left,y:g.top+g.height+8}},getActions:()=>u,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}async function HTt(a,i,e,t){let n=await a.get(Bt).createModelReference(t.uri);await e.invokeWithinContext(async r=>{let s=i.hasSideBySideModifier,l=r.get(X),c=Fg.inPeekEditor.getValue(l),u=!s&&e.getOption(101)&&!c;return new nH({openToSide:s,openInPeek:u,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new mue(n.object.textEditorModel,G.getStartPosition(t.range)),G.lift(t.range))}),n.dispose()}var umi=class a{constructor(){this._entries=new Ua(50)}get(i){let e=a._key(i);return this._entries.get(e)}set(i,e){let t=a._key(i);this._entries.set(t,e)}static _key(i){return`${i.uri.toString()}/${i.getVersionId()}`}},nio=le("IInlayHintsCache");Ce(nio,umi,1);var HEe=class{constructor(i,e){this.item=i;this.index=e}get part(){let i=this.item.hint.label;return typeof i=="string"?{label:i}:i[this.index]}},pmi=class{constructor(i,e){this.part=i;this.hasTriggerModifier=e}};var mmi=class{constructor(){this._store=new ue;this._tokenSource=new qe}dispose(){this._store.dispose(),this._tokenSource.dispose(!0)}reset(){return this._tokenSource.dispose(!0),this._tokenSource=new qe,this._store.value=new O,{store:this._store.value,token:this._tokenSource.token}}},$T=class{constructor(i,e,t,o,n,r,s){this._editor=i;this._languageFeaturesService=e;this._inlayHintsCache=o;this._commandService=n;this._notificationService=r;this._instaService=s;this._disposables=new O;this._sessionDisposables=new O;this._decorationsMetadata=new Map;this._activeRenderMode=0;this._ruleFactory=this._disposables.add(new uX(this._editor)),this._debounceInfo=t.for(e.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(e.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(i.onDidChangeModel(()=>this._update())),this._disposables.add(i.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(i.onDidChangeConfiguration(l=>{l.hasChanged(159)&&this._update()})),this._update()}static{this.ID="editor.contrib.InlayHints"}static{this._MAX_DECORATORS=1500}static{this._whitespaceData={}}static get(i){return i.getContribution($T.ID)??void 0}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();let i=this._editor.getOption(159);if(i.enabled==="off")return;let e=this._editor.getModel();if(!e||!this._languageFeaturesService.inlayHintsProvider.has(e))return;if(i.enabled==="on")this._activeRenderMode=0;else{let c,u;i.enabled==="onUnlessPressed"?(c=0,u=1):(c=1,u=0),this._activeRenderMode=c,this._sessionDisposables.add(Ab.getInstance().event(p=>{if(!this._editor.hasModel())return;let h=p.altKey&&p.ctrlKey&&!(p.shiftKey||p.metaKey)?u:c;if(h!==this._activeRenderMode){this._activeRenderMode=h;let g=this._editor.getModel(),f=this._copyInlayHintsWithCurrentAnchor(g);this._updateHintsDecorators([g.getFullModelRange()],f),s.schedule(0)}}))}let t=this._inlayHintsCache.get(e);t&&this._updateHintsDecorators([e.getFullModelRange()],t),this._sessionDisposables.add(ee(()=>{e.isDisposed()||this._cacheHintsForFastRestore(e)}));let o,n=new Set;this._sessionDisposables.add(e.onWillDispose(()=>o?.cancel()));let r=this._sessionDisposables.add(new mmi),s=new Dt(async()=>{let c=Date.now(),{store:u,token:p}=r.reset();try{let h=await S6e.create(this._languageFeaturesService.inlayHintsProvider,e,this._getHintsRanges(),p);if(s.delay=this._debounceInfo.update(e,Date.now()-c),p.isCancellationRequested){h.dispose();return}for(let g of h.provider)typeof g.onDidChangeInlayHints=="function"&&!n.has(g)&&(n.add(g),u.add(g.onDidChangeInlayHints(()=>{s.isScheduled()||s.schedule()})));u.add(h),u.add(ee(()=>n.clear())),this._updateHintsDecorators(h.ranges,h.items),this._cacheHintsForFastRestore(e)}catch(h){mt(h)}},this._debounceInfo.get(e));this._sessionDisposables.add(s),s.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(c=>{(c.scrollTopChanged||!s.isScheduled())&&s.schedule()}));let l=this._sessionDisposables.add(new ue);this._sessionDisposables.add(this._editor.onDidChangeModelContent(c=>{o?.cancel();let u=Math.max(s.delay,800);this._cursorInfo={position:this._editor.getPosition(),notEarlierThan:Date.now()+u},l.value=Zo(()=>s.schedule(0),u),s.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeConfiguration(c=>{c.hasChanged(159)&&s.schedule()})),this._sessionDisposables.add(this._installDblClickGesture(()=>s.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){let i=new O,e=i.add(new i0(this._editor)),t=new O;return i.add(t),i.add(e.onMouseMoveOrRelevantKeyDown(o=>{let[n]=o,r=this._getInlayHintLabelPart(n),s=this._editor.getModel();if(!r||!s){t.clear();return}let l=new qe;t.add(ee(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new pmi(r,n.hasTriggerModifier):void 0;let c=s.validatePosition(r.item.hint.position).lineNumber,u=new G(c,1,c,s.getLineMaxColumn(c)),p=this._getInlineHintsForRange(u);this._updateHintsDecorators([u],p),t.add(ee(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([u],p)}))})),i.add(e.onCancel(()=>t.clear())),i.add(e.onExecute(async o=>{let n=this._getInlayHintLabelPart(o);if(n){let r=n.part;r.location?this._instaService.invokeFunction(HTt,o,this._editor,r.location):_ce.is(r.command)&&await this._invokeCommand(r.command,n.item)}})),i}_getInlineHintsForRange(i){let e=new Set;for(let t of this._decorationsMetadata.values())i.containsRange(t.item.anchor.range)&&e.add(t.item);return Array.from(e)}_installDblClickGesture(i){return this._editor.onMouseUp(async e=>{if(e.event.detail!==2)return;let t=this._getInlayHintLabelPart(e);if(t&&(e.event.preventDefault(),await t.item.resolve(Ie.None),Rr(t.item.hint.textEdits))){let o=t.item.hint.textEdits.map(n=>Qn.replace(G.lift(n.range),n.text));this._editor.executeEdits("inlayHint.default",o),i()}})}_installContextMenu(){return this._editor.onContextMenu(async i=>{if(!go(i.event.target))return;let e=this._getInlayHintLabelPart(i);e&&await this._instaService.invokeFunction(oio,this._editor,i.event.target,e)})}_getInlayHintLabelPart(i){if(i.target.type!==6)return;let e=i.target.detail.injectedText?.options;if(e instanceof kK&&e?.attachedData instanceof HEe)return e.attachedData}async _invokeCommand(i,e){try{await this._commandService.executeCommand(i.id,...i.arguments??[])}catch(t){this._notificationService.notify({severity:ft.Error,source:e.provider.displayName,message:t})}}_cacheHintsForFastRestore(i){let e=this._copyInlayHintsWithCurrentAnchor(i);this._inlayHintsCache.set(i,e)}_copyInlayHintsWithCurrentAnchor(i){let e=new Map;for(let[t,o]of this._decorationsMetadata){if(e.has(o.item))continue;let n=i.getDecorationRange(t);if(n){let r=new b6e(n,o.item.anchor.direction),s=o.item.with({anchor:r});e.set(o.item,s)}}return Array.from(e.values())}_getHintsRanges(){let e=this._editor.getModel(),t=this._editor.getVisibleRangesPlusViewportAboveBelow(),o=[];for(let n of t.sort(G.compareRangesUsingStarts)){let r=e.validateRange(new G(n.startLineNumber-30,n.startColumn,n.endLineNumber+30,n.endColumn));o.length===0||!G.areIntersectingOrTouching(o[o.length-1],r)?o.push(r):o[o.length-1]=G.plusRange(o[o.length-1],r)}return o}_updateHintsDecorators(i,e){let t=new Map;if(this._cursorInfo&&this._cursorInfo.notEarlierThan>Date.now()&&i.some(b=>b.containsPosition(this._cursorInfo.position))){let{position:b}=this._cursorInfo;this._cursorInfo=void 0;let S=new Map;for(let E of this._editor.getLineDecorations(b.lineNumber)??[]){let M=this._decorationsMetadata.get(E.id);if(E.range.startColumn>b.column)continue;let N=M?.decoration.options[M.item.anchor.direction];if(N&&N.attachedData!==$T._whitespaceData){let V=S.get(M.item)??0;S.set(M.item,V+N.content.length)}}let y=e.filter(E=>E.anchor.range.startLineNumber===b.lineNumber&&E.anchor.range.endColumn<=b.column),w=Array.from(S.values()),x;for(;;){let E=y.shift(),M=w.shift();if(!M&&!E)break;if(E)t.set(E,M??0),x=E;else if(x&&M){let N=t.get(x);N+=M,N+=w.reduce((V,H)=>V+H,0),w.length=0;break}}}let o=[],n=(b,S,y,w,x)=>{let E={content:y,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:S.className,cursorStops:w,attachedData:x};o.push({item:b,classNameRef:S,decoration:{range:b.anchor.range,options:{description:"InlayHint",showIfCollapsed:b.anchor.range.isEmpty(),collapseOnReplaceEdit:!b.anchor.range.isEmpty(),stickiness:0,[b.anchor.direction]:this._activeRenderMode===0?E:void 0}}})},r=(b,S)=>{let y=this._ruleFactory.createClassNameRef({width:`${s/3|0}px`,display:"inline-block"});n(b,y,"\u200A",S?1:3,$T._whitespaceData)},{fontSize:s,fontFamily:l,padding:c,isUniform:u}=this._getLayoutInfo(),p=this._editor.getOption(159).maximumLength,h="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(h,l);let g={line:0,totalLen:0};for(let b=0;b<e.length;b++){let S=e[b];if(g.line!==S.anchor.range.startLineNumber&&(g={line:S.anchor.range.startLineNumber,totalLen:0}),p&&g.totalLen>p)continue;S.hint.paddingLeft&&r(S,!1);let y=typeof S.hint.label=="string"?[{label:S.hint.label}]:S.hint.label,w=t.get(S),x=0;for(let E=0;E<y.length;E++){let M=y[E],N=E===0,V=E===y.length-1,H={fontSize:`${s}px`,fontFamily:`var(${h}), ${Ku.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};Rr(S.hint.textEdits)&&(H.cursor="default"),this._fillInColors(H,S.hint),(M.command||M.location)&&this._activeInlayHintPart?.part.item===S&&this._activeInlayHintPart.part.index===E&&(H.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(H.color=_s(K9i),H.cursor="pointer"));let K=M.label;g.totalLen+=K.length;let j=!1,J=p!==0?g.totalLen-p:0;if(J>0&&(K=K.slice(0,-J)+"\u2026",j=!0),x+=K.length,w!==void 0){let se=x-w;se>=0&&(x-=se,K=K.slice(0,-(1+se))+"\u2026",j=!0)}if(c&&(N&&(V||j)?(H.padding=`1px ${Math.max(1,s/4)|0}px`,H.borderRadius=`${s/4|0}px`):N?(H.padding=`1px 0 1px ${Math.max(1,s/4)|0}px`,H.borderRadius=`${s/4|0}px 0 0 ${s/4|0}px`):V||j?(H.padding=`1px ${Math.max(1,s/4)|0}px 1px 0`,H.borderRadius=`0 ${s/4|0}px ${s/4|0}px 0`):H.padding="1px 0 1px 0"),n(S,this._ruleFactory.createClassNameRef(H),w3o(K),V&&!S.hint.paddingRight?1:3,new HEe(S,E)),j)break}if(w!==void 0&&x<w){let E=w-x;n(S,this._ruleFactory.createClassNameRef({}),"\u200A".repeat(E),3)}if(S.hint.paddingRight&&r(S,!0),o.length>$T._MAX_DECORATORS)break}let f=[];for(let[b,S]of this._decorationsMetadata){let y=this._editor.getModel()?.getDecorationRange(b);y&&i.some(w=>w.containsRange(y))&&(f.push(b),S.classNameRef.dispose(),this._decorationsMetadata.delete(b))}let v=Sx.capture(this._editor);this._editor.changeDecorations(b=>{let S=b.deltaDecorations(f,o.map(y=>y.decoration));for(let y=0;y<S.length;y++){let w=o[y];this._decorationsMetadata.set(S[y],w)}}),v.restore(this._editor)}_fillInColors(i,e){e.kind===2?(i.backgroundColor=_s(e7i),i.color=_s(Z9i)):e.kind===1?(i.backgroundColor=_s(J9i),i.color=_s(X9i)):(i.backgroundColor=_s(jIt),i.color=_s($It))}_getLayoutInfo(){let i=this._editor.getOption(159),e=i.padding,t=this._editor.getOption(61),o=this._editor.getOption(58),n=i.fontSize;(!n||n<5||n>t)&&(n=t);let r=i.fontFamily||o;return{fontSize:n,fontFamily:r,padding:e,isUniform:!e&&r===o&&n===t}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(let i of this._decorationsMetadata.values())i.classNameRef.dispose();this._decorationsMetadata.clear()}getInlayHintsForLine(i){if(!this._editor.hasModel())return[];let e=new Set,t=[];for(let o of this._editor.getLineDecorations(i)){let n=this._decorationsMetadata.get(o.id);n&&!e.has(n.item.hint)&&(e.add(n.item.hint),t.push(n.item))}return t}};$T=I([m(1,Jt),m(2,Gf),m(3,nio),m(4,fe),m(5,Ne),m(6,F)],$T);function w3o(a){return a.replace(/[ \t]/g,"\xA0")}Ge.registerCommand("_executeInlayHintProvider",async(a,...i)=>{let[e,t]=i;To(A.isUri(e)),To(G.isIRange(t));let{inlayHintsProvider:o}=a.get(Jt),n=await a.get(Bt).createModelReference(e);try{let r=await S6e.create(o,n.object.textEditorModel,[G.lift(t)],Ie.None),s=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),s}finally{n.dispose()}});var UTt=class extends I4{constructor(e,t,o,n){super(10,t,e.item.anchor.range,o,n,!0);this.part=e}},kJ=class extends t2{constructor(e,t,o,n,r,s,l,c){super(e,t,r,l,o,n,c);this._resolverService=s;this.hoverOrdinal=6}suggestHoverAnchor(e){if(!$T.get(this._editor)||e.target.type!==6)return null;let o=e.target.detail.injectedText?.options;return o instanceof kK&&o.attachedData instanceof HEe?new UTt(o.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,o,n){return e instanceof UTt?new Fp(async r=>{let{part:s}=e;if(await s.item.resolve(n),n.isCancellationRequested)return;let l;typeof s.item.hint.tooltip=="string"?l=new he().appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(l=s.item.hint.tooltip),l&&r.emitOne(new UT(this,e.range,[l],!1,0)),Rr(s.item.hint.textEdits)&&r.emitOne(new UT(this,e.range,[new he().appendText(d(1337,null))],!1,10001));let c;if(typeof s.part.tooltip=="string"?c=new he().appendText(s.part.tooltip):s.part.tooltip&&(c=s.part.tooltip),c&&r.emitOne(new UT(this,e.range,[c],!1,1)),s.part.location||s.part.command){let p,g=this._editor.getOption(86)==="altKey"?et?d(1343,null):d(1342,null):et?d(1341,null):d(1340,null);s.part.location&&s.part.command?p=new he().appendText(d(1339,null,g)):s.part.location?p=new he().appendText(d(1338,null,g)):s.part.command&&(p=new he(`[${d(1336,null)}](${iTt(s.part.command)} "${s.part.command.title}") (${g})`,{isTrusted:!0})),p&&r.emitOne(new UT(this,e.range,[p],!1,1e4))}let u=this._resolveInlayHintLabelPartHover(s,n);for await(let p of u)r.emitOne(p)}):Fp.EMPTY}async*_resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return;let{uri:o,range:n}=e.part.location,r=await this._resolverService.createModelReference(o);try{let s=r.object.textEditorModel;if(!this._languageFeaturesService.hoverProvider.has(s))return;for await(let l of g6e(this._languageFeaturesService.hoverProvider,s,new ye(n.startLineNumber,n.startColumn),t))KB(l.hover.contents)||(yield new UT(this,e.item.anchor.range,l.hover.contents,!1,2+l.ordinal))}finally{r.dispose()}}};kJ=I([m(1,_n),m(2,Le),m(3,ot),m(4,B),m(5,Bt),m(6,Jt),m(7,fe)],kJ);var zTt=class{constructor(i,e,t){this.marker=i;this.index=e;this.total=t}},hue=class{constructor(i,e,t){this._markerService=e;this._configService=t;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._dispoables=new O;this._markers=[];this._nextIdx=-1;A.isUri(i)?this._resourceFilter=s=>s.toString()===i.toString():i&&(this._resourceFilter=i);let o=this._configService.getValue("problems.sortOrder"),n=(s,l)=>{let c=oc(s.resource.toString(),l.resource.toString());return c===0&&(o==="position"?c=G.compareRangesUsingStarts(s,l)||Pl.compare(s.severity,l.severity):c=Pl.compare(s.severity,l.severity)||G.compareRangesUsingStarts(s,l)),c},r=()=>{let s=this._markerService.read({resource:A.isUri(i)?i:void 0,severities:14});return typeof i=="function"&&(s=s.filter(l=>this._resourceFilter(l.resource))),s.sort(n),eo(s,this._markers,(l,c)=>l.resource.toString()===c.resource.toString()&&l.startLineNumber===c.startLineNumber&&l.startColumn===c.startColumn&&l.endLineNumber===c.endLineNumber&&l.endColumn===c.endColumn&&l.severity===c.severity&&l.message===c.message)?!1:(this._markers=s,!0)};r(),this._dispoables.add(e.onMarkerChanged(s=>{(!this._resourceFilter||s.some(l=>this._resourceFilter(l)))&&r()&&(this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(i){return!this._resourceFilter&&!i?!0:!this._resourceFilter||!i?!1:this._resourceFilter(i)}get selected(){let i=this._markers[this._nextIdx];return i&&new zTt(i,this._nextIdx+1,this._markers.length)}_initIdx(i,e,t){let o=this._markers.findIndex(n=>ze(n.resource,i.uri));if(o<0)o=cA(this._markers.length,n=>oc(this._markers[n].resource.toString(),i.uri.toString())),o<0&&(o=~o),t?this._nextIdx=o:this._nextIdx=(this._markers.length+o-1)%this._markers.length;else{let n=!1,r=!1;for(let s=o;s<this._markers.length;s++){let l=G.lift(this._markers[s]);if(l.isEmpty()){let c=i.getWordAtPosition(l.getStartPosition());c&&(l=new G(l.startLineNumber,c.startColumn,l.startLineNumber,c.endColumn))}if(e&&(l.containsPosition(e)||e.isBeforeOrEqual(l.getStartPosition()))){this._nextIdx=s,n=!0,r=!l.containsPosition(e);break}if(this._markers[s].resource.toString()!==i.uri.toString())break}n?r&&!t&&(this._nextIdx-=1):this._nextIdx=t?0:this._markers.length-1}this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(i,e,t){if(this._markers.length===0)return!1;let o=this._nextIdx;return this._nextIdx===-1?this._initIdx(e,t,i):i?this._nextIdx=(this._nextIdx+1)%this._markers.length:i||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),o!==this._nextIdx}find(i,e){let t=this._markers.findIndex(o=>o.resource.toString()===i.toString());if(!(t<0)){for(;t<this._markers.length;t++)if(G.containsPosition(this._markers[t],e))return new zTt(this._markers[t],t+1,this._markers.length)}}};hue=I([m(1,ha),m(2,B)],hue);var W6e=le("IMarkerNavigationService"),F6e=class{constructor(i,e){this._markerService=i;this._configService=e;this._provider=new ra}registerProvider(i){let e=this._provider.unshift(i);return ee(()=>e())}getMarkerList(i){for(let e of this._provider){let t=e.getMarkerList(i);if(t)return t}return new hue(i,this._markerService,this._configService)}};F6e=I([m(0,ha),m(1,B)],F6e);Ce(W6e,F6e,1);var eE;(i=>{function a(e){switch(e){case wt.Ignore:return"severity-ignore "+q.asClassName(L.info);case wt.Info:return q.asClassName(L.info);case wt.Warning:return q.asClassName(L.warning);case wt.Error:return q.asClassName(L.error);default:return""}}i.className=a})(eE||={});var hmi=class{constructor(i,e,t,o,n){this._openerService=o;this._labelService=n;this._lines=0;this._longestLineLength=0;this._relatedDiagnostics=new WeakMap;this._disposables=new O;this._editor=e;let r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(Yo(this._relatedBlock,"click",s=>{s.preventDefault();let l=this._relatedDiagnostics.get(s.target);l&&t(l)})),this._scrollable=new gX(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),i.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(s=>{r.style.left=`-${s.scrollLeft}px`,r.style.top=`-${s.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){je(this._disposables)}update(i){let{source:e,message:t,relatedInformation:o,code:n}=i,r=(e?.length||0)+2;n&&(typeof n=="string"?r+=n.length:r+=n.value.length);let s=Hc(t);this._lines=s.length,this._longestLineLength=0;for(let h of s)this._longestLineLength=Math.max(h.length+r,this._longestLineLength);St(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(i)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(let h of s)l=document.createElement("div"),l.innerText=h,h===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(e||n){let h=document.createElement("span");if(h.classList.add("details"),l.appendChild(h),e){let g=document.createElement("span");g.innerText=e,g.classList.add("source"),h.appendChild(g)}if(n)if(typeof n=="string"){let g=document.createElement("span");g.innerText=`(${n})`,g.classList.add("code"),h.appendChild(g)}else{this._codeLink=_("a.code-link"),this._codeLink.setAttribute("href",`${n.target.toString()}`),this._codeLink.onclick=f=>{this._openerService.open(n.target,{allowCommands:!0}),f.preventDefault(),f.stopPropagation()};let g=D(this._codeLink,_("span"));g.innerText=n.value,h.appendChild(this._codeLink)}}if(St(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Rr(o)){let h=this._relatedBlock.appendChild(document.createElement("div"));h.style.paddingTop=`${Math.floor(this._editor.getOption(75)*.66)}px`,this._lines+=1;for(let g of o){let f=document.createElement("div"),v=document.createElement("a");v.classList.add("filename"),v.innerText=`${this._labelService.getUriBasenameLabel(g.resource)}(${g.startLineNumber}, ${g.startColumn}): `,v.title=this._labelService.getUriLabel(g.resource),this._relatedDiagnostics.set(v,g);let b=document.createElement("span");b.innerText=g.message,f.appendChild(v),f.appendChild(b),this._lines+=1,h.appendChild(f)}}let c=this._editor.getOption(59),u=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75),p=c.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:u,scrollHeight:p})}layout(i,e){this._scrollable.getDomNode().style.height=`${i}px`,this._scrollable.getDomNode().style.width=`${e}px`,this._scrollable.setScrollDimensions({width:e,height:i})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(i){let e="";switch(i.severity){case 8:e=d(1206,null);break;case 4:e=d(1211,null);break;case 2:e=d(1208,null);break;case 1:e=d(1207,null);break}let t=d(1209,null,e,i.startLineNumber+":"+i.startColumn),o=this._editor.getModel();return o&&i.startLineNumber<=o.getLineCount()&&i.startLineNumber>=1&&(t=`${o.getLineContent(i.startLineNumber)}, ${t}`),t}},u2=class extends zT{constructor(e,t,o,n,r,s,l){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},r);this._themeService=t;this._openerService=o;this._menuService=n;this._contextKeyService=s;this._labelService=l;this._callOnDispose=new O;this._onDidSelectRelatedInformation=new T;this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event;this._severity=4,this._backgroundColor=Ue.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}static{this.TitleMenu=new R("gotoErrorTitleMenu")}_applyTheme(e){this._backgroundColor=e.getColor(E3o);let t=gmi,o=C3o;this._severity===4?(t=KTt,o=x3o):this._severity===2&&(t=fmi,o=k3o);let n=e.getColor(t),r=e.getColor(o);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:r,primaryHeadingColor:e.getColor(n0),secondaryHeadingColor:e.getColor(r0)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),this._onDidSelectRelatedInformation.dispose(),super.dispose()}focus(){this._parentContainer.focus()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(n=>this.editor.focus()));let t=this._menuService.getMenuActions(u2.TitleMenu,this._contextKeyService),o=Ng(t);this._actionbarWidget.push(o,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=D(e,_(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new hmi(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,o){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());let n=G.lift(e),r=this.editor.getPosition(),s=r&&n.containsPosition(r)?r:n.getStartPosition();super.show(s,this.computeRequiredHeight());let l=this.editor.getModel();if(l){let c=o>1?d(1210,null,t,o):d(1198,null,t,o);this.setTitle(Be(l.uri),c)}this._icon.className=`codicon ${eE.className(Pl.toSeverity(this._severity))}`,this.editor.revealPositionInCenterIfOutsideViewport(s,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};u2=I([m(1,Pe),m(2,Je),m(3,Yt),m(4,F),m(5,X),m(6,nt)],u2);var rio=Wce($v,H9i),sio=Wce(Tg,oX),aio=Wce(eh,nX),gmi=te("editorMarkerNavigationError.background",{dark:rio,light:rio,hcDark:Ei,hcLight:Ei},d(1200,null)),C3o=te("editorMarkerNavigationError.headerBackground",{dark:ni(gmi,.1),light:ni(gmi,.1),hcDark:null,hcLight:null},d(1201,null)),KTt=te("editorMarkerNavigationWarning.background",{dark:sio,light:sio,hcDark:Ei,hcLight:Ei},d(1204,null)),x3o=te("editorMarkerNavigationWarning.headerBackground",{dark:ni(KTt,.1),light:ni(KTt,.1),hcDark:"#0C141F",hcLight:ni(KTt,.2)},d(1205,null)),fmi=te("editorMarkerNavigationInfo.background",{dark:aio,light:aio,hcDark:Ei,hcLight:Ei},d(1202,null)),k3o=te("editorMarkerNavigationInfo.headerBackground",{dark:ni(fmi,.1),light:ni(fmi,.1),hcDark:null,hcLight:null},d(1203,null)),E3o=te("editorMarkerNavigation.background",Bo,d(1199,null));var uC=class{constructor(i,e,t,o,n){this._markerNavigationService=e;this._contextKeyService=t;this._editorService=o;this._instantiationService=n;this._sessionDispoables=new O;this._editor=i,this._widgetVisible=lio.bindTo(this._contextKeyService)}static{this.ID="editor.contrib.markerController"}static get(i){return i.getContribution(uC.ID)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(i){if(this._model&&this._model.matches(i))return this._model;let e=!1;return this._model&&(e=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(i),e&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(u2,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(t=>{(!this._model?.selected||!G.containsPosition(this._model?.selected.marker,t.position))&&this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;let t=this._model.find(this._editor.getModel().uri,this._widget.position);t?this._widget.updateMarker(t.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(t=>{this._editorService.openCodeEditor({resource:t.resource,options:{pinned:!0,revealIfOpened:!0,selection:G.lift(t).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(i=!0){this._cleanUp(),i&&this._editor.focus()}showAtMarker(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=this._getOrCreateModel(e.uri);t.resetIndex(),t.move(!0,e,new ye(i.startLineNumber,i.startColumn)),t.selected&&this._widget.showAtMarker(t.selected.marker,t.selected.index,t.selected.total)}async navigate(i,e){if(!this._editor.hasModel())return;let t=this._editor.getModel(),o=this._getOrCreateModel(e?void 0:t.uri);if(o.move(i,t,this._editor.getPosition()),!!o.selected)if(o.selected.marker.resource.toString()!==t.uri.toString()){this._cleanUp();let n=await this._editorService.openCodeEditor({resource:o.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:o.selected.marker}},this._editor);n&&(uC.get(n)?.close(),uC.get(n)?.navigate(i,e))}else this._widget.showAtMarker(o.selected.marker,o.selected.index,o.selected.total)}};uC=I([m(1,W6e),m(2,X),m(3,Qt),m(4,F)],uC);var UEe=class extends Mi{constructor(e,t,o){super(o);this._next=e;this._multiFile=t}async run(e,t){t.hasModel()&&await uC.get(t)?.navigate(this._next,this._multiFile)}},gue=class a extends UEe{static{this.ID="editor.action.marker.next"}static{this.LABEL=P(1190,"Go to Next Problem (Error, Warning, Info)")}constructor(){super(!0,!1,{id:a.ID,label:a.LABEL,precondition:void 0,kbOpts:{kbExpr:me.focus,primary:578,weight:100},menuOpts:{menuId:u2.TitleMenu,title:a.LABEL.value,icon:Oe("marker-navigation-next",L.arrowDown,d(1196,null)),group:"navigation",order:1}})}},V6e=class a extends UEe{static{this.ID="editor.action.marker.prev"}static{this.LABEL=P(1192,"Go to Previous Problem (Error, Warning, Info)")}constructor(){super(!1,!1,{id:a.ID,label:a.LABEL,precondition:void 0,kbOpts:{kbExpr:me.focus,primary:1602,weight:100},menuOpts:{menuId:u2.TitleMenu,title:a.LABEL.value,icon:Oe("marker-navigation-previous",L.arrowUp,d(1197,null)),group:"navigation",order:2}})}},B6e=class a extends UEe{static{this.ID="editor.action.marker.nextInFiles"}constructor(){super(!0,!0,{id:a.ID,label:P(1191,"Go to Next Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:me.focus,primary:66,weight:100},menuOpts:{menuId:R.MenubarGoMenu,title:d(1194,null),group:"6_problem_nav",order:1}})}},H6e=class a extends UEe{static{this.ID="editor.action.marker.prevInFiles"}constructor(){super(!1,!0,{id:a.ID,label:P(1193,"Go to Previous Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:me.focus,primary:1090,weight:100},menuOpts:{menuId:R.MenubarGoMenu,title:d(1195,null),group:"6_problem_nav",order:2}})}};Eo(uC.ID,uC,4);ri(gue);ri(V6e);ri(B6e);ri(H6e);var lio=new Y("markersNavigationVisible",!1),T3o=od.bindToContribution(uC.get);ro(new T3o({id:"closeMarkersNavigation",precondition:lio,handler:a=>a.close(),kbOpts:{weight:150,kbExpr:me.focus,primary:9,secondary:[1033]}}));var p0=_,U6e=class{constructor(i,e,t){this.owner=i;this.range=e;this.marker=t}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},cio={type:1,filter:{include:Nr.QuickFix},triggerAction:"quick fix hover window"},zEe=class{constructor(i,e,t,o,n,r){this._editor=i;this._markerDecorationsService=e;this._openerService=t;this._languageFeaturesService=o;this._menuService=n;this._contextKeyService=r;this.hoverOrdinal=1;this.recentMarkerCodeActionsInfo=void 0}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1&&!i.supportsMarkerHover)return[];let t=this._editor.getModel(),o=i.range;if(!t.isValidRange(i.range))return[];let n=o.startLineNumber,r=t.getLineMaxColumn(n),s=[];for(let l of e){let c=l.range.startLineNumber===n?l.range.startColumn:1,u=l.range.endLineNumber===n?l.range.endColumn:r,p=this._markerDecorationsService.getMarker(t.uri,l);if(!p)continue;let h=new G(i.range.startLineNumber,c,i.range.startLineNumber,u);s.push(new U6e(this,h,p))}return s}renderHoverParts(i,e){if(!e.length)return new Yk([]);let t=[];e.forEach(r=>{let s=this._renderMarkerHover(r);i.fragment.appendChild(s.hoverElement),t.push(s)});let o=e.length===1?e[0]:e.sort((r,s)=>Pl.compare(r.marker.severity,s.marker.severity))[0],n=this._renderMarkerStatusbar(i,o);return new Yk(t,n)}getAccessibleContent(i){return i.marker.message}_renderMarkerHover(i){let e=new O,t=p0("div.hover-row"),o=D(t,p0("div.marker.hover-contents")),{source:n,message:r,code:s,relatedInformation:l}=i.marker;this._editor.applyFontInfo(o);let c=D(o,p0("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||s)if(s&&typeof s!="string"){let p=p0("span");if(n){let v=D(p,p0("span"));v.innerText=n}let h=D(p,p0("a.code-link"));h.setAttribute("href",s.target.toString(!0)),e.add($(h,"click",v=>{this._openerService.open(s.target,{allowCommands:!0}),v.preventDefault(),v.stopPropagation()}));let g=D(h,p0("span"));g.innerText=s.value;let f=D(o,p);f.style.opacity="0.6",f.style.paddingLeft="6px"}else{let p=D(o,p0("span"));p.style.opacity="0.6",p.style.paddingLeft="6px",p.innerText=n&&s?`${n}(${s})`:n||`(${s})`}if(Rr(l))for(let{message:p,resource:h,startLineNumber:g,startColumn:f}of l){let v=D(o,p0("div"));v.style.marginTop="8px";let b=D(v,p0("a"));b.innerText=`${Be(h)}(${g}, ${f}): `,b.style.cursor="pointer",e.add($(b,"click",y=>{if(y.stopPropagation(),y.preventDefault(),this._openerService){let w={selection:{startLineNumber:g,startColumn:f}};this._openerService.open(h,{fromUserGesture:!0,editorOptions:w}).catch(mt)}}));let S=D(v,p0("span"));S.innerText=p,this._editor.applyFontInfo(S)}return{hoverPart:i,hoverElement:t,dispose:()=>e.dispose()}}_renderMarkerStatusbar(i,e){let t=new O;if(e.marker.severity===8||e.marker.severity===4||e.marker.severity===2){let r=uC.get(this._editor);r&&i.statusBar.addAction({label:d(1315,null),commandId:gue.ID,run:()=>{i.hide(),r.showAtMarker(e.marker),this._editor.focus()}})}let o=[];for(let[,r]of this._menuService.getMenuActions(R.MarkerHoverStatusBar,this._contextKeyService))for(let s of r)s instanceof Do&&s.enabled&&o.push(s);let n=()=>{for(let r of o)i.statusBar.addAction({label:r.label,commandId:r.id,iconClass:r.class,run:()=>{i.hide(),this._editor.setSelection(G.lift(e.range)),r.run()}})};if(this._editor.getOption(104))n();else{let r=i.statusBar.append(p0("div"));this.recentMarkerCodeActionsInfo&&(YB.makeKey(this.recentMarkerCodeActionsInfo.marker)===YB.makeKey(e.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||o.length===0&&(r.textContent=d(1313,null)):this.recentMarkerCodeActionsInfo=void 0);let s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?k.None:Zo(()=>r.textContent=d(1312,null),200,t);r.textContent||(r.textContent="\xA0");let l=this.getCodeActions(e.marker);t.add(ee(()=>l.cancel())),l.then(c=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:e.marker,hasCodeActions:c.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){c.dispose(),o.length===0?r.textContent=d(1313,null):r.style.display="none",n();return}r.style.display="none";let u=!1;t.add(ee(()=>{u||c.dispose()})),i.statusBar.addAction({label:d(1314,null),commandId:UK,run:h=>{u=!0;let g=Rm.get(this._editor),f=ur(h);i.hide(),g?.showCodeActions(cio,c,{x:f.left,y:f.top,width:f.width,height:f.height})}});let p=c.validActions.find(h=>h.action.isAI);p?i.statusBar.addAction({label:p.action.title,commandId:p.action.command?.id??"",iconClass:q.asClassName(L.sparkle),run:()=>{Rm.get(this._editor)?.applyCodeAction(p,!1,!1,"fromProblemsHover")}}):n(),i.onContentsChanged()},mt)}return t}getCodeActions(i){return Hn(e=>cM(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new G(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn),cio,nh.None,e))}};zEe=I([m(1,Yz),m(2,Je),m(3,Jt),m(4,Yt),m(5,X)],zEe);var EJ=class extends k{constructor(i,e,t,o,n,r,s){super();let l=e.hoverParts;this._renderedHoverParts=this._register(new fue(i,t,l,o,n,r,s));let c=e.options,u=c.anchor,{showAtPosition:p,showAtSecondaryPosition:h}=EJ.computeHoverPositions(i,u.range,l);this.shouldAppearBeforeContent=l.some(g=>g.isBeforeContent),this.showAtPosition=p,this.showAtSecondaryPosition=h,this.initialMousePosX=u.initialMousePosX,this.initialMousePosY=u.initialMousePosY,this.shouldFocus=c.shouldFocus,this.source=c.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}get hoverPartsCount(){return this._renderedHoverParts.hoverPartsCount}focusHoverPartWithIndex(i){this._renderedHoverParts.focusHoverPartWithIndex(i)}getAccessibleWidgetContent(){return this._renderedHoverParts.getAccessibleContent()}getAccessibleWidgetContentAtIndex(i){return this._renderedHoverParts.getAccessibleHoverContentAtIndex(i)}async updateHoverVerbosityLevel(i,e,t){this._renderedHoverParts.updateHoverVerbosityLevel(i,e,t)}doesHoverAtIndexSupportVerbosityAction(i,e){return this._renderedHoverParts.doesHoverAtIndexSupportVerbosityAction(i,e)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(i,e,t){let o=1;if(i.hasModel()){let u=i._getViewModel(),p=u.coordinatesConverter,h=p.convertModelRangeToViewRange(e),g=u.getLineMinColumn(h.startLineNumber),f=new ye(h.startLineNumber,g);o=p.convertViewPositionToModelPosition(f).column}let n=e.startLineNumber,r=e.startColumn,s;for(let u of t){let p=u.range,h=p.startLineNumber===n,g=p.endLineNumber===n;if(h&&g){let v=p.startColumn,b=Math.min(r,v);r=Math.max(b,o)}u.forceShowAtRange&&(s=p)}let l,c;if(s){let u=s.getStartPosition();l=u,c=u}else l=e.getStartPosition(),c=new ye(n,r);return{showAtPosition:l,showAtSecondaryPosition:c}}};EJ=I([m(4,Le),m(5,ot),m(6,Bi)],EJ);var vmi=class{constructor(i,e){this._statusBar=e;i.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}},fue=class extends k{constructor(e,t,o,n,r,s,l){super();this._hoverService=s;this._clipboardService=l;this._renderedParts=[];this._focusedHoverPartIndex=-1;this._context=n,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,o,n,r,this._hoverService)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,o)),this._updateMarkdownAndColorParticipantInfo(t)}static{this._DECORATION_OPTIONS=So.register({description:"content-hover-highlight",className:"hoverHighlight"})}_createEditorDecorations(e,t){if(t.length===0)return k.None;let o=t[0].range;for(let r of t){let s=r.range;o=G.plusRange(o,s)}let n=e.createDecorationsCollection();return n.set([{range:o,options:fue._DECORATION_OPTIONS}]),ee(()=>{n.clear()})}_renderParts(e,t,o,n,r){let s=new gJ(n,r),l={fragment:this._fragment,statusBar:s,...o},c=new O;c.add(s);for(let p of e){let h=this._renderHoverPartsForParticipant(t,p,l);c.add(h);for(let g of h.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:p,hoverPart:g.hoverPart,hoverElement:g.hoverElement})}let u=this._renderStatusBar(this._fragment,s);return u&&(c.add(u),this._renderedParts.push({type:"statusBar",hoverElement:u.hoverElement,actions:u.actions})),c}_renderHoverPartsForParticipant(e,t,o){let n=e.filter(s=>s.owner===t);return n.length>0?t.renderHoverParts(o,n):new Yk([])}_renderStatusBar(e,t){if(t.hasContent)return new vmi(e,t)}_registerListenersOnRenderedParts(){let e=new O;return this._renderedParts.forEach((t,o)=>{let n=t.hoverElement;n.tabIndex=0,e.add($(n,ne.FOCUS_IN,r=>{r.stopPropagation(),this._focusedHoverPartIndex=o})),e.add($(n,ne.FOCUS_OUT,r=>{r.stopPropagation(),this._focusedHoverPartIndex=-1})),t.type==="hoverPart"&&t.hoverPart instanceof U6e&&e.add(new kEe(n,()=>t.participant.getAccessibleContent(t.hoverPart),this._clipboardService,this._hoverService))}),e}_updateMarkdownAndColorParticipantInfo(e){let t=e.find(o=>o instanceof t2&&!(o instanceof kJ));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(o=>o instanceof IJ)}focusHoverPartWithIndex(e){e<0||e>=this._renderedParts.length||this._renderedParts[e].hoverElement.focus()}getAccessibleContent(){let e=[];for(let t=0;t<this._renderedParts.length;t++)e.push(this.getAccessibleHoverContentAtIndex(t));return e.join(`

`)}getAccessibleHoverContentAtIndex(e){let t=this._renderedParts[e];if(!t)return"";if(t.type==="statusBar"){let o=[d(1272,null)];for(let n of t.actions){let r=n.actionKeybindingLabel;r?o.push(d(1273,null,n.actionLabel,r)):o.push(d(1274,null,n.actionLabel))}return o.join(`
`)}return t.participant.getAccessibleContent(t.hoverPart)}async updateHoverVerbosityLevel(e,t,o){if(!this._markdownHoverParticipant)return;let n;t>=0?n={start:t,endExclusive:t+1}:n=this._findRangeOfMarkdownHoverParts(this._markdownHoverParticipant);for(let r=n.start;r<n.endExclusive;r++){let s=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,r);if(s===void 0)continue;let l=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,s);l&&(this._renderedParts[r]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:l.hoverPart,hoverElement:l.hoverElement})}o&&(t>=0?this.focusHoverPartWithIndex(t):this._context.focus()),this._context.onContentsChanged()}doesHoverAtIndexSupportVerbosityAction(e,t){if(!this._markdownHoverParticipant)return!1;let o=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,e);return o===void 0?!1:this._markdownHoverParticipant.doesMarkdownHoverAtIndexSupportVerbosityAction(o,t)}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){let o=this._renderedParts[t];if(!o||o.type!=="hoverPart"||!(o.participant===e))return;let r=this._renderedParts.findIndex(s=>s.type==="hoverPart"&&s.participant===e);if(r===-1)throw new ci;return t-r}_findRangeOfMarkdownHoverParts(e){let t=this._renderedParts.slice(),o=t.findIndex(s=>s.type==="hoverPart"&&s.participant===e),n=t.reverse().findIndex(s=>s.type==="hoverPart"&&s.participant===e),r=n>=0?t.length-n:n;return{start:o,endExclusive:r+1}}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}get hoverPartsCount(){return this._renderedParts.length}};fue=I([m(4,Le),m(5,ot),m(6,Bi)],fue);var KEe=class extends k{constructor(e,t,o,n,r){super();this._editor=e;this._instantiationService=t;this._keybindingService=o;this._hoverService=n;this._clipboardService=r;this._currentResult=null;this._renderedContentHover=this._register(new ue);this._onContentsChanged=this._register(new T);this.onContentsChanged=this._onContentsChanged.event;this._contentHoverWidget=this._register(this._instantiationService.createInstance(Xk,this._editor)),this._participants=this._initializeHoverParticipants(),this._hoverOperation=this._register(new fEe(this._editor,new _Et(this._editor,this._participants))),this._registerListeners()}_initializeHoverParticipants(){let e=[];for(let t of PD.getAll()){let o=this._instantiationService.createInstance(t,this._editor);e.push(o)}return e.sort((t,o)=>t.hoverOrdinal-o.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>t.handleResize?.())})),this._register(this._contentHoverWidget.onDidScroll(t=>{this._participants.forEach(o=>o.handleScroll?.(t))})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._participants.forEach(t=>t.handleContentsChanged?.())})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{let o=t.hasLoadingMessage?this._addLoadingMessage(t):t.value;this._withResult(new n6e(o,t.isComplete,t.options))}));let e=this._contentHoverWidget.getDomNode();this._register(Yo(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Yo(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(vc.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._onContentsChanged.fire()}))}_startShowingOrUpdateHover(e,t,o,n,r){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):!1;let l=this._editor.getOption(69).sticky,c=r&&this._contentHoverWidget.isMouseGettingCloser(r.event.posx,r.event.posy);return l&&c?(e&&this._startHoverOperationIfNecessary(e,t,o,n,!0),!0):e?this._currentResult&&this._currentResult.options.anchor.equals(e)?!0:this._currentResult&&e.canAdoptVisibleHover(this._currentResult.options.anchor,this._contentHoverWidget.position)?(this._currentResult&&this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,o,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,o,n,r){if(this._hoverOperation.options&&this._hoverOperation.options.anchor.equals(e))return;this._hoverOperation.cancel();let l={anchor:e,source:o,shouldFocus:n,insistOnKeepingHoverVisible:r};this._hoverOperation.start(t,l)}_setCurrentResult(e){let t=e;if(this._currentResult===t)return;t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover()}_addLoadingMessage(e){for(let t of this._participants){if(!t.createLoadingMessage)continue;let o=t.createLoadingMessage(e.options.anchor);if(o)return e.value.slice(0).concat([o])}return e.value}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;let n=e.hoverParts.length===0,r=e.options.insistOnKeepingHoverVisible;n&&r||this._setCurrentResult(e)}_showHover(e){let t=this._getHoverContext();this._renderedContentHover.value=new EJ(this._editor,e,this._participants,t,this._keybindingService,this._hoverService,this._clipboardService),this._renderedContentHover.value.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover.value):this._renderedContentHover.clear()}_hideHover(){this._contentHoverWidget.hide(),this._participants.forEach(e=>e.handleHide?.())}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._contentHoverWidget.handleContentsChanged()},setMinimumDimensions:r=>{this._contentHoverWidget.setMinimumDimensions(r)},focus:()=>this.focus()}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;let o=this._findHoverAnchorCandidates(e);if(!(o.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);let r=o[0];return this._startShowingOrUpdateHover(r,0,0,!1,e)}_findHoverAnchorCandidates(e){let t=[];for(let n of this._participants){if(!n.suggestHoverAnchor)continue;let r=n.suggestHoverAnchor(e);r&&t.push(r)}let o=e.target;switch(o.type){case 6:{t.push(new pEe(0,o.range,e.event.posx,e.event.posy));break}case 7:{let n=this._editor.getOption(59).typicalHalfwidthCharacterWidth/2;if(!(!o.detail.isAfterLines&&typeof o.detail.horizontalDistanceToText=="number"&&o.detail.horizontalDistanceToText<n))break;t.push(new pEe(0,o.range,e.event.posx,e.event.posy));break}}return t.sort((n,r)=>r.priority-n.priority),t}_onMouseLeave(e){let t=this._editor.getDomNode();(!t||!hJ(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,o,n){this._startShowingOrUpdateHover(new pEe(0,e,void 0,void 0),t,o,n,null)}getWidgetContent(){let e=this._contentHoverWidget.getDomNode();if(e.textContent)return e.textContent}async updateHoverVerbosityLevel(e,t,o){this._renderedContentHover.value?.updateHoverVerbosityLevel(e,t,o)}doesHoverAtIndexSupportVerbosityAction(e,t){return this._renderedContentHover.value?.doesHoverAtIndexSupportVerbosityAction(e,t)??!1}getAccessibleWidgetContent(){return this._renderedContentHover.value?.getAccessibleWidgetContent()}getAccessibleWidgetContentAtIndex(e){return this._renderedContentHover.value?.getAccessibleWidgetContentAtIndex(e)}focusedHoverPartIndex(){return this._renderedContentHover.value?.focusedHoverPartIndex??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){if(this._renderedContentHover.value?.hoverPartsCount===1){this.focusHoverPartWithIndex(0);return}this._contentHoverWidget.focus()}focusHoverPartWithIndex(e){this._renderedContentHover.value?.focusHoverPartWithIndex(e)}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){return this._renderedContentHover.value?.isColorPickerVisible()??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};KEe=I([m(1,F),m(2,Le),m(3,ot),m(4,Bi)],KEe);function qTt(a){let i=a.target;return!!i&&i.type===6&&i.detail.injectedText?.options.attachedData===Rui}var bmi=!1,ql=class extends k{constructor(e,t,o,n){super();this._editor=e;this._instantiationService=o;this._keybindingService=n;this._onHoverContentsChanged=this._register(new T);this.onHoverContentsChanged=this._onHoverContentsChanged.event;this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1;this._listenersStore=new O;this._isMouseDown=!1;this._ignoreMouseEvents=!1;this._reactToEditorMouseMoveRunner=this._register(new Dt(()=>{this._mouseMoveEvent&&this._reactToEditorMouseMove(this._mouseMoveEvent)},0)),this._register(t.onDidShowContextMenu(()=>{this.hideContentHover(),this._ignoreMouseEvents=!0})),this._register(t.onDidHideContextMenu(()=>{this._ignoreMouseEvents=!1})),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static{this.ID="editor.contrib.contentHover"}static get(e){return e.getContribution(ql.ID)}_hookListeners(){let e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled==="off"&&this._cancelSchedulerAndHide(),this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>this._cancelSchedulerAndHide())),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelSchedulerAndHide(){this._cancelScheduler(),this.hideContentHover()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){this._ignoreMouseEvents||(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideContentHover()}_onEditorMouseDown(e){this._ignoreMouseEvents||(this._isMouseDown=!0,this._shouldKeepHoverWidgetVisible(e))||this.hideContentHover()}_shouldKeepHoverWidgetVisible(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()||qTt(e)}_isMouseOnContentHoverWidget(e){return this._contentWidget?hJ(this._contentWidget.getDomNode(),e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._ignoreMouseEvents||(this._isMouseDown=!1)}_onEditorMouseLeave(e){this._ignoreMouseEvents||this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._shouldKeepHoverWidgetVisible(e))||bmi||this.hideContentHover()}_shouldKeepCurrentHover(e){let t=this._contentWidget;if(!t)return!1;let o=this._hoverSettings.sticky,n=(p,h)=>{let g=this._isMouseOnContentHoverWidget(p);return h&&g},r=p=>{let h=t.isColorPickerVisible,g=this._isMouseOnContentHoverWidget(p),f=h&&g,v=h&&this._isMouseDown;return f||v},s=(p,h)=>{let g=p.event.browserEvent.view;return g?h&&t.containsNode(g.document.activeElement)&&!g.getSelection()?.isCollapsed:!1},l=t.isFocused,c=t.isResizing,u=this._hoverSettings.sticky&&t.isVisibleFromKeyboard;return this.shouldKeepOpenOnEditorMouseMoveOrLeave||l||c||u||n(e,o)||r(e)||s(e,o)}_onEditorMouseMove(e){if(this._ignoreMouseEvents)return;if(this._mouseMoveEvent=e,this._shouldKeepCurrentHover(e)){this._reactToEditorMouseMoveRunner.cancel();return}if(this._shouldRescheduleHoverComputation()){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hoverSettings.hidingDelay);return}this._reactToEditorMouseMove(e)}_shouldRescheduleHoverComputation(){let e=this._hoverSettings.hidingDelay;return(this._contentWidget?.isVisible??!1)&&this._hoverSettings.sticky&&e>0}_reactToEditorMouseMove(e){EEt(this._hoverSettings.enabled,this._editor.getOption(86),e)&&this._getOrCreateContentWidget().showsOrWillShow(e)||bmi||this.hideContentHover()}_onKeyDown(e){if(this._ignoreMouseEvents||!this._contentWidget)return;if(this._hoverSettings.enabled==="onKeyboardModifier"&&t6e(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._contentWidget.isVisible||this._contentWidget.showsOrWillShow(this._mouseMoveEvent);return}let t=this._isPotentialKeyboardShortcut(e),o=eF(e.keyCode);t||o||this._contentWidget.isFocused&&e.keyCode===2||this.hideContentHover()}_isPotentialKeyboardShortcut(e){if(!this._editor.hasModel()||!this._contentWidget)return!1;let t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),o=t.kind===1,n=t.kind===2&&(t.commandId===IEt||t.commandId===KK||t.commandId===GK)&&this._contentWidget.isVisible;return o||n}hideContentHover(){bmi||dM.dropDownVisible||this._contentWidget?.hide()}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(KEe,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,o,n){this._getOrCreateContentWidget().startShowingAtRange(e,t,o,n)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}doesHoverAtIndexSupportVerbosityAction(e,t){return this._getOrCreateContentWidget().doesHoverAtIndexSupportVerbosityAction(e,t)}updateHoverVerbosityLevel(e,t,o){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,o)}focus(){this._contentWidget?.focus()}focusHoverPartWithIndex(e){this._contentWidget?.focusHoverPartWithIndex(e)}scrollUp(){this._contentWidget?.scrollUp()}scrollDown(){this._contentWidget?.scrollDown()}scrollLeft(){this._contentWidget?.scrollLeft()}scrollRight(){this._contentWidget?.scrollRight()}pageUp(){this._contentWidget?.pageUp()}pageDown(){this._contentWidget?.pageDown()}goToTop(){this._contentWidget?.goToTop()}goToBottom(){this._contentWidget?.goToBottom()}getWidgetContent(){return this._contentWidget?.getWidgetContent()}getAccessibleWidgetContent(){return this._contentWidget?.getAccessibleWidgetContent()}getAccessibleWidgetContentAtIndex(e){return this._contentWidget?.getAccessibleWidgetContentAtIndex(e)}get isColorPickerVisible(){return this._contentWidget?.isColorPickerVisible}get isHoverVisible(){return this._contentWidget?.isVisible}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._contentWidget?.dispose()}};ql=I([m(1,Xe),m(2,F),m(3,Le)],ql);var z6e=class extends k{constructor(e){super();this._editor=e;this._register(e.onMouseDown(t=>this.onMouseDown(t)))}static{this.ID="editor.contrib.colorContribution"}static{this.RECOMPUTE_TIME=1e3}dispose(){super.dispose()}onMouseDown(e){let t=this._editor.getOption(168);if(t!=="click"&&t!=="clickAndHover"||!qTt(e))return;let o=this._editor.getContribution(ql.ID);if(!o||o.isColorPickerVisible)return;let n=e.target.range;if(!n)return;let r=new G(n.startLineNumber,n.startColumn+1,n.endLineNumber,n.endColumn+1);o.showContentHover(r,1,1,!1)}};var Smi=class a{constructor(i,e,t,o){this.owner=i;this.range=e;this.model=t;this.provider=o}static fromBaseColor(i,e){return new a(i,e.range,e.model,e.provider)}},Imi=class extends k{constructor(i,e,t,o){super();let n=i.getModel(),r=t.model;this.color=t.model.color,this.colorPicker=this._register(new TEe(e.fragment,r,i.getOption(163),o,"standalone")),this._register(r.onColorFlushed(l=>{this.color=l})),this._register(r.onDidChangeColor(l=>{oue(n,r,l,t.range,t)}));let s=!1;this._register(i.onDidChangeModelContent(l=>{s?s=!1:(e.hide(),i.focus())})),oue(n,r,this.color,t.range,t)}},GEe=class{constructor(i,e){this._editor=i;this._themeService=e;this.hoverOrdinal=2}async createColorHover(i,e,t){if(!this._editor.hasModel()||!aC.get(this._editor))return null;let n=await bEt(t,this._editor.getModel(),Ie.None),r=null,s=null;for(let h of n){let g=h.colorInfo;G.containsRange(g.range,i.range)&&(r=g,s=h.provider)}let l=r??i,c=s??e,u=!!r;return{colorHover:Smi.fromBaseColor(this,await KEt(this._editor.getModel(),l,c)),foundInEditor:u}}async updateEditorModel(i){if(!this._editor.hasModel())return;let e=i.model,t=new G(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn);this._color&&(await oue(this._editor.getModel(),e,this._color,t,i),t=GEt(this._editor,t,e))}renderHoverParts(i,e){if(!(e.length===0||!this._editor.hasModel()))return this._setMinimumDimensions(i),this._renderedParts=new Imi(this._editor,i,e[0],this._themeService),this._renderedParts}_setMinimumDimensions(i){let e=this._editor.getOption(75)+8;i.setMinimumDimensions(new di(302,e))}get _color(){return this._renderedParts?.color}};GEe=I([m(1,Pe)],GEe);var ymi=class{constructor(i,e){this.value=i;this.foundInEditor=e}},dio=8,_3o=22,TJ=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._standaloneColorPickerVisible=t;this._standaloneColorPickerFocused=o;this._keybindingService=r;this._languageFeaturesService=s;this._editorWorkerService=l;this._hoverService=c;this.allowEditorOverflow=!0;this._position=void 0;this._body=document.createElement("div");this._colorHover=null;this._selectionSetInEditor=!1;this._onResult=this._register(new T);this.onResult=this._onResult.event;this._renderedHoverParts=this._register(new ue);this._renderedStatusBar=this._register(new ue);this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(GEe,this._editor),this._position=this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;let u=this._editor.getSelection(),p=u?{startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},h=this._register(nr(this._body));this._register(h.onDidBlur(g=>{this.hide()})),this._register(h.onDidFocus(g=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(g=>{let f=g.target.element?.classList;f&&f.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(g=>{this._render(g.value,g.foundInEditor)})),this._start(p),this._body.style.zIndex="50",this._editor.addContentWidget(this)}static{this.ID="editor.contrib.standaloneColorPickerWidget"}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return TJ.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;let e=this._editor.getOption(69).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){let t=await this._computeAsync(e);t&&this._onResult.fire(new ymi(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;let t={range:e,color:{red:0,green:0,blue:0,alpha:1}},o=await this._standaloneColorPickerParticipant.createColorHover(t,new y4(this._editorWorkerService),this._languageFeaturesService.colorProvider);return o?{result:o.colorHover,foundInEditor:o.foundInEditor}:null}_render(e,t){let o=document.createDocumentFragment();this._renderedStatusBar.value=this._register(new gJ(this._keybindingService,this._hoverService));let n={fragment:o,statusBar:this._renderedStatusBar.value,onContentsChanged:()=>{},setMinimumDimensions:()=>{},hide:()=>this.hide(),focus:()=>this.focus()};if(this._colorHover=e,this._renderedHoverParts.value=this._standaloneColorPickerParticipant.renderHoverParts(n,[e]),!this._renderedHoverParts.value){this._renderedStatusBar.clear(),this._renderedHoverParts.clear();return}let r=this._renderedHoverParts.value.colorPicker;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(o),r.layout();let s=r.body,l=s.saturationBox.domNode.clientWidth,c=s.domNode.clientWidth-l-_3o-dio,u=r.body.enterButton;u?.onClicked(()=>{this.updateEditor(),this.hide()});let p=r.header,h=p.pickedColorNode;h.style.width=l+dio+"px";let g=p.originalColorNode;g.style.width=c+"px",r.header.closeButton?.onClicked(()=>{this.hide()}),t&&(u&&(u.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};TJ=I([m(3,F),m(4,Le),m(5,Jt),m(6,Qs),m(7,ot)],TJ);var BA=class extends k{constructor(e,t,o){super();this._editor=e;this._instantiationService=o;this._standaloneColorPickerWidget=null;this._standaloneColorPickerVisible=me.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=me.standaloneColorPickerFocused.bindTo(t)}static{this.ID="editor.contrib.standaloneColorPickerController"}showOrFocus(){this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||this._standaloneColorPickerWidget?.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(TJ,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerWidget?.hide(),this._editor.focus()}insertColor(){this._standaloneColorPickerWidget?.updateEditor(),this.hide()}static get(e){return e.getContribution(BA.ID)}};BA=I([m(1,X),m(2,F)],BA);var $Tt=class extends yl{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...P(1061,"Show or Focus Standalone Color Picker"),mnemonicTitle:d(1060,null)},precondition:void 0,menu:[{id:R.CommandPalette}],metadata:{description:P(1062,"Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(i,e){BA.get(e)?.showOrFocus()}},jTt=class extends Mi{constructor(){super({id:"editor.action.hideColorPicker",label:P(1056,"Hide the Color Picker"),precondition:me.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:P(1057,"Hide the standalone color picker.")}})}run(i,e){BA.get(e)?.hide()}},QTt=class extends Mi{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:P(1058,"Insert Color with Standalone Color Picker"),precondition:me.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:P(1059,"Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(i,e){BA.get(e)?.insertColor()}};ri(jTt);ri(QTt);W($Tt);Eo(z6e.ID,z6e,2);Eo(BA.ID,BA,1);Eo(aC.ID,aC,1);Qk(mEe);PD.register(IJ);Ge.registerCommand("_executeDocumentColorProvider",function(a,...i){let[e]=i;if(!(e instanceof A))throw ls();let{model:t,colorProviderRegistry:o,defaultColorDecoratorsEnablement:n}=_ui(a,e);return SEt(new fEt,o,t,Ie.None,n)});Ge.registerCommand("_executeColorPresentationProvider",function(a,...i){let[e,t]=i;if(!t)return;let{uri:o,range:n}=t;if(!(o instanceof A)||!Array.isArray(e)||e.length!==4||!G.isIRange(n))throw ls();let{model:r,colorProviderRegistry:s,defaultColorDecoratorsEnablement:l}=_ui(a,o),[c,u,p,h]=e;return SEt(new vEt({range:n,color:{red:c,green:u,blue:p,alpha:h}}),s,r,Ie.None,l)});var P4=class a{constructor(i,e,t){this.languageConfigurationService=t;this._selection=i,this._insertSpace=e,this._usedEndToken=null}static _haystackHasNeedleAtOffset(i,e,t){if(t<0)return!1;let o=e.length,n=i.length;if(t+o>n)return!1;for(let r=0;r<o;r++){let s=i.charCodeAt(t+r),l=e.charCodeAt(r);if(s!==l&&!(s>=65&&s<=90&&s+32===l)&&!(l>=65&&l<=90&&l+32===s))return!1}return!0}_createOperationsForBlockComment(i,e,t,o,n,r){let s=i.startLineNumber,l=i.startColumn,c=i.endLineNumber,u=i.endColumn,p=n.getLineContent(s),h=n.getLineContent(c),g=p.lastIndexOf(e,l-1+e.length),f=h.indexOf(t,u-1-t.length);if(g!==-1&&f!==-1)if(s===c)p.substring(g+e.length,f).indexOf(t)>=0&&(g=-1,f=-1);else{let b=p.substring(g+e.length),S=h.substring(0,f);(b.indexOf(t)>=0||S.indexOf(t)>=0)&&(g=-1,f=-1)}let v;g!==-1&&f!==-1?(o&&g+e.length<p.length&&p.charCodeAt(g+e.length)===32&&(e=e+" "),o&&f>0&&h.charCodeAt(f-1)===32&&(t=" "+t,f-=1),v=a._createRemoveBlockCommentOperations(new G(s,g+e.length+1,c,f+1),e,t)):(v=a._createAddBlockCommentOperations(i,e,t,this._insertSpace),this._usedEndToken=v.length===1?t:null);for(let b of v)r.addTrackedEditOperation(b.range,b.text)}static _createRemoveBlockCommentOperations(i,e,t){let o=[];return G.isEmpty(i)?o.push(Qn.delete(new G(i.startLineNumber,i.startColumn-e.length,i.endLineNumber,i.endColumn+t.length))):(o.push(Qn.delete(new G(i.startLineNumber,i.startColumn-e.length,i.startLineNumber,i.startColumn))),o.push(Qn.delete(new G(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn+t.length)))),o}static _createAddBlockCommentOperations(i,e,t,o){let n=[];return G.isEmpty(i)?n.push(Qn.replace(new G(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn),e+"  "+t)):(n.push(Qn.insert(new ye(i.startLineNumber,i.startColumn),e+(o?" ":""))),n.push(Qn.insert(new ye(i.endLineNumber,i.endColumn),(o?" ":"")+t))),n}getEditOperations(i,e){let t=this._selection.startLineNumber,o=this._selection.startColumn;i.tokenization.tokenizeIfCheap(t);let n=i.getLanguageIdAtPosition(t,o),r=this.languageConfigurationService.getLanguageConfiguration(n).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,i,e)}computeCursorState(i,e){let t=e.getInverseEditOperations();if(t.length===2){let o=t[0],n=t[1];return new ei(o.range.endLineNumber,o.range.endColumn,n.range.startLineNumber,n.range.startColumn)}else{let o=t[0].range,n=this._usedEndToken?-this._usedEndToken.length-1:0;return new ei(o.endLineNumber,o.endColumn+n,o.endLineNumber,o.endColumn+n)}}};var qEe=class a{constructor(i,e,t,o,n,r,s){this.languageConfigurationService=i;this._selection=e,this._indentSize=t,this._type=o,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=s||!1}static _gatherPreflightCommentStrings(i,e,t,o){i.tokenization.tokenizeIfCheap(e);let n=i.getLanguageIdAtPosition(e,1),r=o.getLanguageConfiguration(n).comments,s=r?r.lineCommentToken:null;if(!s)return null;let l=[];for(let c=0,u=t-e+1;c<u;c++)l[c]={ignore:!1,commentStr:s,commentStrOffset:0,commentStrLength:s.length};return l}static _analyzeLines(i,e,t,o,n,r,s,l,c){let u=!0,h=l.getLanguageConfiguration(c).comments?.lineCommentNoIndent??!1,g;i===0?g=!0:i===1?g=!1:g=!0;for(let f=0,v=o.length;f<v;f++){let b=o[f],S=n+f;if(S===n&&s){b.ignore=!0;continue}let y=t.getLineContent(S),w=Em(y);if(w===-1){b.ignore=r,b.commentStrOffset=h?0:y.length;continue}u=!1;let x=h?0:w;if(b.ignore=!1,b.commentStrOffset=x,g&&!P4._haystackHasNeedleAtOffset(y,b.commentStr,x)&&(i===0?g=!1:i===1||(b.ignore=!0)),g&&e){let E=w+b.commentStrLength;E<y.length&&y.charCodeAt(E)===32&&(b.commentStrLength+=1)}}if(i===0&&u){g=!1;for(let f=0,v=o.length;f<v;f++)o[f].ignore=!1}return{supported:!0,shouldRemoveComments:g,lines:o}}static _gatherPreflightData(i,e,t,o,n,r,s,l){let c=a._gatherPreflightCommentStrings(t,o,n,l),u=t.getLanguageIdAtPosition(o,1);return c===null?{supported:!1}:a._analyzeLines(i,e,t,c,o,r,s,l,u)}_executeLineComments(i,e,t,o){let n;t.shouldRemoveComments?n=a._createRemoveLineCommentsOperations(t.lines,o.startLineNumber):(a._normalizeInsertionPoint(i,t.lines,o.startLineNumber,this._indentSize),n=this._createAddLineCommentsOperations(t.lines,o.startLineNumber));let r=new ye(o.positionLineNumber,o.positionColumn);for(let s=0,l=n.length;s<l;s++)e.addEditOperation(n[s].range,n[s].text),G.isEmpty(n[s].range)&&G.getStartPosition(n[s].range).equals(r)&&i.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(n[s].text||"").length);this._selectionId=e.trackSelection(o)}_attemptRemoveBlockComment(i,e,t,o){let n=e.startLineNumber,r=e.endLineNumber,s=o.length+Math.max(i.getLineFirstNonWhitespaceColumn(e.startLineNumber),e.startColumn),l=i.getLineContent(n).lastIndexOf(t,s-1),c=i.getLineContent(r).indexOf(o,e.endColumn-1-t.length);return l!==-1&&c===-1&&(c=i.getLineContent(n).indexOf(o,l+t.length),r=n),l===-1&&c!==-1&&(l=i.getLineContent(r).lastIndexOf(t,c),n=r),e.isEmpty()&&(l===-1||c===-1)&&(l=i.getLineContent(n).indexOf(t),l!==-1&&(c=i.getLineContent(n).indexOf(o,l+t.length))),l!==-1&&i.getLineContent(n).charCodeAt(l+t.length)===32&&(t+=" "),c!==-1&&i.getLineContent(r).charCodeAt(c-1)===32&&(o=" "+o,c-=1),l!==-1&&c!==-1?P4._createRemoveBlockCommentOperations(new G(n,l+t.length+1,r,c+1),t,o):null}_executeBlockComment(i,e,t){i.tokenization.tokenizeIfCheap(t.startLineNumber);let o=i.getLanguageIdAtPosition(t.startLineNumber,1),n=this.languageConfigurationService.getLanguageConfiguration(o).comments;if(!n||!n.blockCommentStartToken||!n.blockCommentEndToken)return;let r=n.blockCommentStartToken,s=n.blockCommentEndToken,l=this._attemptRemoveBlockComment(i,t,r,s);if(!l){if(t.isEmpty()){let c=i.getLineContent(t.startLineNumber),u=Em(c);u===-1&&(u=c.length),l=P4._createAddBlockCommentOperations(new G(t.startLineNumber,u+1,t.startLineNumber,c.length+1),r,s,this._insertSpace)}else l=P4._createAddBlockCommentOperations(new G(t.startLineNumber,i.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.endLineNumber,i.getLineMaxColumn(t.endLineNumber)),r,s,this._insertSpace);l.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=e.trackSelection(t);for(let c of l)e.addEditOperation(c.range,c.text)}getEditOperations(i,e){let t=this._selection;if(this._moveEndPositionDown=!1,t.startLineNumber===t.endLineNumber&&this._ignoreFirstLine){e.addEditOperation(new G(t.startLineNumber,i.getLineMaxColumn(t.startLineNumber),t.startLineNumber+1,1),t.startLineNumber===i.getLineCount()?"":`
`),this._selectionId=e.trackSelection(t);return}t.startLineNumber<t.endLineNumber&&t.endColumn===1&&(this._moveEndPositionDown=!0,t=t.setEndPosition(t.endLineNumber-1,i.getLineMaxColumn(t.endLineNumber-1)));let o=a._gatherPreflightData(this._type,this._insertSpace,i,t.startLineNumber,t.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return o.supported?this._executeLineComments(i,e,o,t):this._executeBlockComment(i,e,t)}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(t=t.setEndPosition(t.endLineNumber+1,1)),new ei(t.selectionStartLineNumber,t.selectionStartColumn+this._deltaColumn,t.positionLineNumber,t.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(i,e){let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];r.ignore||t.push(Qn.delete(new G(e+o,r.commentStrOffset+1,e+o,r.commentStrOffset+r.commentStrLength+1)))}return t}_createAddLineCommentsOperations(i,e){let t=[],o=this._insertSpace?" ":"";for(let n=0,r=i.length;n<r;n++){let s=i[n];s.ignore||t.push(Qn.insert(new ye(e+n,s.commentStrOffset+1),s.commentStr+o))}return t}static nextVisibleColumn(i,e,t,o){return t?i+(e-i%e):i+o}static _normalizeInsertionPoint(i,e,t,o){let n=1073741824,r,s;for(let l=0,c=e.length;l<c;l++){if(e[l].ignore)continue;let u=i.getLineContent(t+l),p=0;for(let h=0,g=e[l].commentStrOffset;p<n&&h<g;h++)p=a.nextVisibleColumn(p,o,u.charCodeAt(h)===9,1);p<n&&(n=p)}n=Math.floor(n/o)*o;for(let l=0,c=e.length;l<c;l++){if(e[l].ignore)continue;let u=i.getLineContent(t+l),p=0;for(r=0,s=e[l].commentStrOffset;p<n&&r<s;r++)p=a.nextVisibleColumn(p,o,u.charCodeAt(r)===9,1);p>n?e[l].commentStrOffset=r-1:e[l].commentStrOffset=r}}};var K6e=class extends Mi{constructor(i,e){super(e),this._type=i}run(i,e){let t=i.get(Us);if(!e.hasModel())return;let o=e.getModel(),n=[],r=o.getOptions(),s=e.getOption(29),l=e.getSelections().map((u,p)=>({selection:u,index:p,ignoreFirstLine:!1}));l.sort((u,p)=>G.compareRangesUsingStarts(u.selection,p.selection));let c=l[0];for(let u=1;u<l.length;u++){let p=l[u];c.selection.endLineNumber===p.selection.startLineNumber&&(c.index<p.index?p.ignoreFirstLine=!0:(c.ignoreFirstLine=!0,c=p))}for(let u of l)n.push(new qEe(t,u.selection,r.indentSize,this._type,s.insertSpace,s.ignoreEmptyLines,u.ignoreFirstLine));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},wmi=class extends K6e{constructor(){super(0,{id:"editor.action.commentLine",label:P(1064,"Toggle Line Comment"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:R.MenubarEditMenu,group:"5_insert",title:d(1068,null),order:1},canTriggerInlineEdits:!0})}},Cmi=class extends K6e{constructor(){super(1,{id:"editor.action.addCommentLine",label:P(1065,"Add Line Comment"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2081),weight:100},canTriggerInlineEdits:!0})}},xmi=class extends K6e{constructor(){super(2,{id:"editor.action.removeCommentLine",label:P(1066,"Remove Line Comment"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2099),weight:100},canTriggerInlineEdits:!0})}},kmi=class extends Mi{constructor(){super({id:"editor.action.blockComment",label:P(1063,"Toggle Block Comment"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:R.MenubarEditMenu,group:"5_insert",title:d(1067,null),order:2},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(Us);if(!e.hasModel())return;let o=e.getOption(29),n=[],r=e.getSelections();for(let s of r)n.push(new P4(s,o.insertSpace,t));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}};ri(wmi);ri(Cmi);ri(xmi);ri(kmi);var Vg=class{constructor(i,e,t,o,n,r,s,l){this._contextMenuService=e;this._contextViewService=t;this._contextKeyService=o;this._keybindingService=n;this._menuService=r;this._configurationService=s;this._workspaceContextService=l;this._toDispose=new O;this._contextMenuIsBeingShownCount=0;this._editor=i,this._toDispose.add(this._editor.onContextMenu(c=>this._onContextMenu(c))),this._toDispose.add(this._editor.onMouseWheel(c=>{if(this._contextMenuIsBeingShownCount>0){let u=this._contextViewService.getContextViewElement(),p=c.srcElement;p.shadowRoot&&IA(u)===p.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(c=>{this._editor.getOption(30)&&c.keyCode===58&&(c.preventDefault(),c.stopPropagation(),this.showContextMenu())}))}static{this.ID="editor.contrib.contextmenu"}static get(i){return i.getContribution(Vg.ID)}_onContextMenu(i){if(!this._editor.hasModel())return;if(!this._editor.getOption(30)){this._editor.focus(),i.target.position&&!this._editor.getSelection().containsPosition(i.target.position)&&this._editor.setPosition(i.target.position);return}if(i.target.type===12||i.target.type===6&&i.target.detail.injectedText)return;if(i.event.preventDefault(),i.event.stopPropagation(),i.target.type===11)return this._showScrollbarContextMenu(i.event);if(i.target.type!==6&&i.target.type!==7&&i.target.type!==1)return;if(this._editor.focus(),i.target.position){let t=!1;for(let o of this._editor.getSelections())if(o.containsPosition(i.target.position)){t=!0;break}t||this._editor.setPosition(i.target.position)}let e=null;i.target.type!==1&&(e=i.event),this.showContextMenu(e)}showContextMenu(i){if(!this._editor.getOption(30)||!this._editor.hasModel())return;let e=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);e.length>0&&this._doShowContextMenu(e,i)}_getMenuActions(i,e){let t=[],o=this._menuService.getMenuActions(e,this._contextKeyService,{arg:i.uri});for(let n of o){let[,r]=n,s=0;for(let l of r)if(l instanceof id){let c=this._getMenuActions(i,l.item.submenu);c.length>0&&(t.push(new sa(l.id,l.label,c)),s++)}else t.push(l),s++;s&&t.push(new oi)}return t.length&&t.pop(),t}_doShowContextMenu(i,e=null){if(!this._editor.hasModel())return;let t=e;if(!t){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();let n=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),r=ur(this._editor.getDomNode()),s=r.left+n.left,l=r.top+n.top+n.height;t={x:s,y:l}}let o=this._editor.getOption(144)&&!Tc;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:o?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>i,getActionViewItem:n=>{let r=this._keybindingFor(n);if(r)return new ts(n,n,{label:!0,keybinding:r.getLabel(),isMenu:!0});let s=n;return typeof s.getActionViewItem=="function"?s.getActionViewItem():new ts(n,n,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:n=>this._keybindingFor(n),onHide:n=>{this._contextMenuIsBeingShownCount--}})}_showScrollbarContextMenu(i){if(!this._editor.hasModel()||deo(this._workspaceContextService.getWorkspace()))return;let e=this._editor.getOption(81),t=0,o=c=>({id:`menu-action-${++t}`,label:c.label,tooltip:"",class:void 0,enabled:typeof c.enabled>"u"?!0:c.enabled,checked:c.checked,run:c.run}),n=(c,u)=>new sa(`menu-action-${++t}`,c,u,void 0),r=(c,u,p,h,g)=>{if(!u)return o({label:c,enabled:u,run:()=>{}});let f=b=>()=>{this._configurationService.updateValue(p,b)},v=[];for(let b of g)v.push(o({label:b.label,checked:h===b.value,run:f(b.value)}));return n(c,v)},s=[];s.push(o({label:d(1070,null),checked:e.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!e.enabled)}})),s.push(new oi),s.push(o({label:d(1071,null),enabled:e.enabled,checked:e.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!e.renderCharacters)}})),s.push(r(d(1075,null),e.enabled,"editor.minimap.size",e.size,[{label:d(1078,null),value:"proportional"},{label:d(1076,null),value:"fill"},{label:d(1077,null),value:"fit"}])),s.push(r(d(1079,null),e.enabled,"editor.minimap.showSlider",e.showSlider,[{label:d(1081,null),value:"mouseover"},{label:d(1080,null),value:"always"}])),s.push(r(d(1072,null),e.enabled,"editor.minimap.side",e.side,[{label:d(1074,null),value:"right"},{label:d(1073,null),value:"left"}]));let l=this._editor.getOption(144)&&!Tc;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>i,getActions:()=>s,onHide:c=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(i){return this._keybindingService.lookupKeybinding(i.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};Vg=I([m(1,Xe),m(2,qn),m(3,X),m(4,Le),m(5,Yt),m(6,B),m(7,Ae)],Vg);var Emi=class extends Mi{constructor(){super({id:"editor.action.showContextMenu",label:P(1069,"Show Editor Context Menu"),precondition:void 0,kbOpts:{kbExpr:me.textInputFocus,primary:1092,weight:100}})}run(i,e){Vg.get(e)?.showContextMenu()}};Eo(Vg.ID,Vg,2);ri(Emi);var G6e=class{constructor(i){this.selections=i}equals(i){let e=this.selections.length,t=i.selections.length;if(e!==t)return!1;for(let o=0;o<e;o++)if(!this.selections[o].equalsSelection(i.selections[o]))return!1;return!0}},q6e=class{constructor(i,e,t){this.cursorState=i;this.scrollTop=e;this.scrollLeft=t}},$Ee=class a extends k{static{this.ID="editor.contrib.cursorUndoRedoController"}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(i.onDidChangeModel(e=>{this._undoStack=[],this._redoStack=[]})),this._register(i.onDidChangeModelContent(e=>{this._undoStack=[],this._redoStack=[]})),this._register(i.onDidChangeCursorSelection(e=>{if(this._isCursorUndoRedo||!e.oldSelections||e.oldModelVersionId!==e.modelVersionId)return;let t=new G6e(e.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(t)||(this._undoStack.push(new q6e(t,i.getScrollTop(),i.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new q6e(new G6e(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new q6e(new G6e(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(i){this._isCursorUndoRedo=!0,this._editor.setSelections(i.cursorState.selections),this._editor.setScrollPosition({scrollTop:i.scrollTop,scrollLeft:i.scrollLeft}),this._isCursorUndoRedo=!1}},Tmi=class extends Mi{constructor(){super({id:"cursorUndo",label:P(1083,"Cursor Undo"),precondition:void 0,kbOpts:{kbExpr:me.textInputFocus,primary:2099,weight:100}})}run(i,e,t){$Ee.get(e)?.cursorUndo()}},_mi=class extends Mi{constructor(){super({id:"cursorRedo",label:P(1082,"Cursor Redo"),precondition:void 0})}run(i,e,t){$Ee.get(e)?.cursorRedo()}};Eo($Ee.ID,$Ee,0);ri(Tmi);ri(_mi);var YTt=class{constructor(i,e,t){this.selection=i,this.targetPosition=e,this.copy=t,this.targetSelection=null}getEditOperations(i,e){let t=i.getValueInRange(this.selection);if(this.copy||e.addEditOperation(this.selection,null),e.addEditOperation(new G(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),t),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new ei(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new ei(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber<this.selection.endLineNumber){this.targetSelection=new ei(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new ei(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column-this.selection.endColumn+this.selection.startColumn:this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new ei(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn)}computeCursorState(i,e){return this.targetSelection}};function jEe(a){return et?a.altKey:a.ctrlKey}var QEe=class a extends k{static{this.ID="editor.contrib.dragAndDrop"}static{this.TRIGGER_KEY_VALUE=et?6:5}static get(i){return i.getContribution(a.ID)}constructor(i){super(),this._editor=i,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown(e=>this._onEditorMouseDown(e))),this._register(this._editor.onMouseUp(e=>this._onEditorMouseUp(e))),this._register(this._editor.onMouseDrag(e=>this._onEditorMouseDrag(e))),this._register(this._editor.onMouseDrop(e=>this._onEditorMouseDrop(e))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(e=>this.onEditorKeyDown(e))),this._register(this._editor.onKeyUp(e=>this.onEditorKeyUp(e))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(i){!this._editor.getOption(42)||this._editor.getOption(28)||(jEe(i)&&(this._modifierPressed=!0),this._mouseDown&&jEe(i)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(i){!this._editor.getOption(42)||this._editor.getOption(28)||(jEe(i)&&(this._modifierPressed=!1),this._mouseDown&&i.keyCode===a.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(i){this._mouseDown=!0}_onEditorMouseUp(i){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(i){let e=i.target;if(this._dragSelection===null){let o=(this._editor.getSelections()||[]).filter(n=>e.position&&n.containsPosition(e.position));if(o.length===1)this._dragSelection=o[0];else return}jEe(i.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),e.position&&(this._dragSelection.containsPosition(e.position)?this._removeDecoration():this.showAt(e.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(i){if(i.target&&(this._hitContent(i.target)||this._hitMargin(i.target))&&i.target.position){let e=new ye(i.target.position.lineNumber,i.target.position.column);if(this._dragSelection===null){let t=null;if(i.event.shiftKey){let o=this._editor.getSelection();if(o){let{selectionStartLineNumber:n,selectionStartColumn:r}=o;t=[new ei(n,r,e.lineNumber,e.column)]}}else t=(this._editor.getSelections()||[]).map(o=>o.containsPosition(e)?new ei(e.lineNumber,e.column,e.lineNumber,e.column):o);this._editor.setSelections(t||[],"mouse",3)}else(!this._dragSelection.containsPosition(e)||(jEe(i.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(e)||this._dragSelection.getStartPosition().equals(e)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(a.ID,new YTt(this._dragSelection,e,jEe(i.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=So.register({description:"dnd-target",className:"dnd-target"})}showAt(i){this._dndDecorationIds.set([{range:new G(i.lineNumber,i.column,i.lineNumber,i.column),options:a._DECORATION_OPTIONS}]),this._editor.revealPosition(i,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(i){return i.type===6||i.type===7}_hitMargin(i){return i.type===2||i.type===3||i.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}};Eo(QEe.ID,QEe,2);var Dmi="editor.action.pasteAs";Eo(Ju.ID,Ju,0);Qk(iEe);ro(new class extends od{constructor(){super({id:sui,precondition:nEt,kbOpts:{weight:100,primary:2137}})}runEditorCommand(a,i){return Ju.get(i)?.changePasteType()}});ro(new class extends od{constructor(){super({id:"editor.hidePasteWidget",precondition:nEt,kbOpts:{weight:100,primary:9}})}runEditorCommand(a,i){Ju.get(i)?.clearWidgets()}});ri(class uio extends Mi{static{this.argsSchema={oneOf:[{type:"object",required:["kind"],properties:{kind:{type:"string",description:d(1085,null)}}},{type:"object",required:["preferences"],properties:{preferences:{type:"array",description:d(1086,null),items:{type:"string"}}}}]}}constructor(){super({id:Dmi,label:P(1084,"Paste As..."),precondition:me.writable,metadata:{description:"Paste as",args:[{name:"args",schema:uio.argsSchema}]},canTriggerInlineEdits:!0})}run(i,e,t){let o;return t&&("kind"in t?o={only:new Rs(t.kind)}:"preferences"in t&&(o={preferences:t.preferences.map(n=>new Rs(n))})),Ju.get(e)?.pasteAs(o)}});ri(class extends Mi{constructor(){super({id:"editor.action.pasteAsText",label:P(1087,"Paste as Text"),precondition:me.writable,canTriggerInlineEdits:!0})}run(a,i){return Ju.get(i)?.pasteAs({providerId:h4.id})}});var XTt=class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(i){if(i&&this._dragOperations.has(i)){let e=this._dragOperations.get(i);return this._dragOperations.delete(i),e}}addDragOperationTransfer(i,e){this._dragOperations.set(i,e)}},xx=class{constructor(i){this.identifier=i}};var A4=le("treeViewsDndService");Ce(A4,XTt,1);var $6e="editor.dropIntoEditor.preferences",Rmi="editor.changeDropType",JTt=new Y("dropWidgetVisible",!1,d(1106,null)),Gh=class extends k{constructor(e,t,o,n,r){super();this._configService=o;this._languageFeaturesService=n;this._treeViewsDragAndDropService=r;this.treeItemsTransfer=Vy.getInstance();this._dropProgressManager=this._register(t.createInstance(aJ,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(cJ,"dropIntoEditor",e,JTt,{id:Rmi,label:d(1107,null)},()=>Gh._configureDefaultAction?[Gh._configureDefaultAction]:[])),this._register(e.onDropIntoEditor(s=>this.onDropIntoEditor(e,s.position,s.event)))}static{this.ID="editor.contrib.dropIntoEditorController"}static get(e){return e.getContribution(Gh.ID)}static setConfigureDefaultAction(e){this._configureDefaultAction=e}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,o){if(!o.dataTransfer||!e.hasModel())return;Gh._currentDropOperation?.cancel(),e.focus(),e.setPosition(t);let n=Hn(async r=>{let s=new O,l=s.add(new $k(e,1,void 0,r));try{let c=await this.extractDataTransferData(o);if(c.size===0||l.token.isCancellationRequested)return;let u=e.getModel();if(!u)return;let p=this._languageFeaturesService.documentDropEditProvider.ordered(u).filter(g=>g.dropMimeTypes?g.dropMimeTypes.some(f=>c.matches(f)):!0),h=s.add(await this.getDropEdits(p,u,t,c,l.token));if(l.token.isCancellationRequested)return;if(h.edits.length){let g=this.getInitialActiveEditIndex(u,h.edits),f=e.getOption(43).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([G.fromPositions(t)],{activeEditIndex:g,allEdits:h.edits},f,async v=>v,r)}}finally{s.dispose(),Gh._currentDropOperation===n&&(Gh._currentDropOperation=void 0)}});this._dropProgressManager.showWhile(t,d(1105,null),n,{cancel:()=>n.cancel()}),Gh._currentDropOperation=n}async getDropEdits(e,t,o,n,r){let s=new O,l=await Ea(Promise.all(e.map(async u=>{try{let p=await u.provideDocumentDropEdits(t,o,n,r);return p&&s.add(p),p?.edits.map(h=>({...h,providerId:u.id}))}catch(p){Yi(p)||console.error(p),console.error(p)}})),r),c=ui(l??[]).flat();return{edits:tEt(c),dispose:()=>s.dispose()}}getInitialActiveEditIndex(e,t){let o=this._configService.getValue($6e,{resource:e.uri});for(let n of Array.isArray(o)?o:[]){let r=new Rs(n),s=t.findIndex(l=>l.kind&&r.contains(l.kind));if(s>=0)return s}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new Wk;let t=Zce(e.dataTransfer);if(this.treeItemsTransfer.hasData(xx.prototype)){let o=this.treeItemsTransfer.getData(xx.prototype);if(Array.isArray(o))for(let n of o){let r=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(r)for(let[s,l]of r)t.replace(s,l)}}return t}};Gh=I([m(1,F),m(2,B),m(3,Jt),m(4,A4)],Gh);Eo(Gh.ID,Gh,2);Qk(tEe);ro(new class extends od{constructor(){super({id:Rmi,precondition:JTt,kbOpts:{weight:100,primary:2137}})}runEditorCommand(a,i,e){Gh.get(i)?.changeDropType()}});ro(new class extends od{constructor(){super({id:"editor.hideDropWidget",precondition:JTt,kbOpts:{weight:100,primary:9}})}runEditorCommand(a,i,e){Gh.get(i)?.clearWidgets()}});var ZTt=class a extends ll{constructor(e,t,o){super();this._hideSoon=this._register(new Dt(()=>this._hide(),2e3));this._isVisible=!1;this._editor=e,this._state=t,this._keybindingService=o,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");let n={inputActiveOptionBorder:Tt(PB),inputActiveOptionForeground:Tt(E5),inputActiveOptionBackground:Tt(AB)},r={groupId:"find-options-widget"};this.caseSensitive=this._register(new yEe({appendTitle:this._keybindingLabelFor(zd.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new wEe({appendTitle:this._keybindingLabelFor(zd.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new CEe({appendTitle:this._keybindingLabelFor(zd.ToggleRegexCommand),isChecked:this._state.isRegex,hoverLifecycleOptions:r,...n})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange(()=>{this._state.change({isRegex:this.regex.checked},!1)})),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange(s=>{let l=!1;s.isRegex&&(this.regex.checked=this._state.isRegex,l=!0),s.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,l=!0),s.matchCase&&(this.caseSensitive.checked=this._state.matchCase,l=!0),!this._state.isRevealed&&l&&this._revealTemporarily()})),this._register($(this._domNode,ne.MOUSE_LEAVE,s=>this._onMouseLeave())),this._register($(this._domNode,"mouseover",s=>this._onMouseOver()))}static{this.ID="editor.contrib.findOptionsWidget"}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding("",e)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return a.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}};function e_t(a,i){return a===1?!0:a===2?!1:i}var p2=class extends k{constructor(){super();this._onFindReplaceStateChange=this._register(new T);this.onFindReplaceStateChange=this._onFindReplaceStateChange.event;this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return e_t(this._isRegexOverride,this._isRegex)}get wholeWord(){return e_t(this._wholeWordOverride,this._wholeWord)}get matchCase(){return e_t(this._matchCaseOverride,this._matchCase)}get preserveCase(){return e_t(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}get isSearching(){return this._isSearching}get filters(){return this._filters}changeMatchInfo(e,t,o){let n={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1},r=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,n.matchesPosition=!0,r=!0),this._matchesCount!==t&&(this._matchesCount=t,n.matchesCount=!0,r=!0),typeof o<"u"&&(G.equalsRange(this._currentMatch,o)||(this._currentMatch=o,n.currentMatch=!0,r=!0)),r&&this._onFindReplaceStateChange.fire(n)}change(e,t,o=!0){let n={moveCursor:t,updateHistory:o,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1},r=!1,s=this.isRegex,l=this.wholeWord,c=this.matchCase,u=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,n.searchString=!0,r=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,n.replaceString=!0,r=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,n.isRevealed=!0,r=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,n.isReplaceRevealed=!0,r=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&(e.searchScope?.every(p=>this._searchScope?.some(h=>!G.equalsRange(h,p)))||(this._searchScope=e.searchScope,n.searchScope=!0,r=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,n.loop=!0,r=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,n.isSearching=!0,r=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,n.filters=!0,r=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,s!==this.isRegex&&(r=!0,n.isRegex=!0),l!==this.wholeWord&&(r=!0,n.wholeWord=!0),c!==this.matchCase&&(r=!0,n.matchCase=!0),u!==this.preserveCase&&(r=!0,n.preserveCase=!0),r&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=t0}};var OD=class{constructor(i){this.storageService=i;this.inMemoryValues=new Set;this._onDidChangeEmitter=new T,this.onDidChange=this._onDidChangeEmitter.event,this.load()}static{this.FIND_HISTORY_KEY="workbench.find.history"}static{this._instance=null}static getOrCreate(i){return OD._instance||(OD._instance=new OD(i)),OD._instance}delete(i){let e=this.inMemoryValues.delete(i);return this.save(),e}add(i){return this.inMemoryValues.add(i),this.save(),this}has(i){return this.inMemoryValues.has(i)}clear(){this.inMemoryValues.clear(),this.save()}forEach(i,e){return this.load(),this.inMemoryValues.forEach(i)}replace(i){this.inMemoryValues=new Set(i),this.save()}load(){let i,e=this.storageService.get(OD.FIND_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}this.inMemoryValues=new Set(i||[])}save(){let i=[];return this.inMemoryValues.forEach(e=>i.push(e)),new Promise(e=>{this.storageService.store(OD.FIND_HISTORY_KEY,JSON.stringify(i),1,0),this._onDidChangeEmitter.fire(i),e()})}};OD=I([m(0,de)],OD);var FD=class{constructor(i){this.storageService=i;this.inMemoryValues=new Set;this._onDidChangeEmitter=new T,this.onDidChange=this._onDidChangeEmitter.event,this.load()}static{this.FIND_HISTORY_KEY="workbench.replace.history"}static{this._instance=null}static getOrCreate(i){return FD._instance||(FD._instance=new FD(i)),FD._instance}delete(i){let e=this.inMemoryValues.delete(i);return this.save(),e}add(i){return this.inMemoryValues.add(i),this.save(),this}has(i){return this.inMemoryValues.has(i)}clear(){this.inMemoryValues.clear(),this.save()}forEach(i,e){return this.load(),this.inMemoryValues.forEach(i)}replace(i){this.inMemoryValues=new Set(i),this.save()}load(){let i,e=this.storageService.get(FD.FIND_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}this.inMemoryValues=new Set(i||[])}save(){let i=[];return this.inMemoryValues.forEach(e=>i.push(e)),new Promise(e=>{this.storageService.store(FD.FIND_HISTORY_KEY,JSON.stringify(i),1,0),this._onDidChangeEmitter.fire(i),e()})}};FD=I([m(0,de)],FD);var R3o=524288;function _J(a,i="single",e=!1){if(!a.hasModel())return null;let t=a.getSelection();if(i==="single"&&t.startLineNumber===t.endLineNumber||i==="multiple"){if(t.isEmpty()){let o=a.getConfiguredWordAtPosition(t.getStartPosition());if(o&&e===!1)return o.word}else if(a.getModel().getValueLengthInRange(t)<R3o)return a.getModel().getValueInRange(t)}return null}var Sv=class extends k{static{this.ID="editor.contrib.findController"}get editor(){return this._editor}static get(i){return i.getContribution(Sv.ID)}constructor(i,e,t,o,n,r){super(),this._editor=i,this._findWidgetVisible=HT.bindTo(e),this._contextKeyService=e,this._storageService=t,this._clipboardService=o,this._notificationService=n,this._hoverService=r,this._updateHistoryDelayer=this._register(new rn(500)),this._state=this._register(new p2),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange(s=>this._onStateChanged(s))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{let s=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),s&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(50).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(i){this.saveQueryState(i),i.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),i.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(i){i.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),i.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),i.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),i.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!IEe.getValue(this._contextKeyService)}wasReplaceInputLastFocused(){return!1}focusLastElement(){}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let i=this._editor.getSelections();i=i.map(e=>(e.endColumn===1&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._editor.getModel().getLineMaxColumn(e.endLineNumber-1))),e.isEmpty()?null:e)).filter(e=>!!e),i.length&&this._state.change({searchScope:i},!0)}}setSearchString(i){this._state.isRegex&&(i=Ss(i)),this._state.change({searchString:i},!1)}highlightFindOptions(i=!1){}async _start(i,e){if(this.disposeModel(),!this._editor.hasModel())return;let t={...e,isRevealed:!0};if(i.seedSearchStringFromSelection==="single"){let o=_J(this._editor,i.seedSearchStringFromSelection,i.seedSearchStringFromNonEmptySelection);o&&(this._state.isRegex?t.searchString=Ss(o):t.searchString=o)}else if(i.seedSearchStringFromSelection==="multiple"&&!i.updateSearchScope){let o=_J(this._editor,i.seedSearchStringFromSelection);o&&(t.searchString=o)}if(!t.searchString&&i.seedSearchStringFromGlobalClipboard){let o=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;o&&(t.searchString=o)}if(i.forceRevealReplace||t.isReplaceRevealed?t.isReplaceRevealed=!0:this._findWidgetVisible.get()||(t.isReplaceRevealed=!1),i.updateSearchScope){let o=this._editor.getSelections();o.some(n=>!n.isEmpty())&&(t.searchScope=o)}t.loop=i.loop,this._state.change(t,!1),this._model||(this._model=new PEt(this._editor,this._state))}start(i,e){return this._start(i,e)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(i){return this._model?(this._model.moveToMatch(i),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){return this._model?this._editor.getModel()?.isTooLargeForHeapOperation()?(this._notificationService.warn(d(1126,null)),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(i){this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(i)}};Sv=I([m(1,X),m(2,de),m(3,Bi),m(4,Ne),m(5,ot)],Sv);var j6e=class extends Sv{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,s,l,r,c);this._contextViewService=t;this._keybindingService=n;this._configurationService=u;this._accessibilityService=p;this._widget=null,this._findOptionsWidget=null,this._findWidgetSearchHistory=OD.getOrCreate(s),this._replaceWidgetHistory=FD.getOrCreate(s)}async _start(e,t){this._widget||this._createFindWidget();let o=this._editor.getSelection(),n=!1;switch(this._editor.getOption(50).autoFindInSelection){case"always":n=!0;break;case"never":n=!1;break;case"multiline":{n=!!o&&o.startLineNumber!==o.endLineNumber;break}default:break}e.updateSearchScope=e.updateSearchScope||n,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new VEt(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._hoverService,this._findWidgetSearchHistory,this._replaceWidgetHistory,this._configurationService,this._accessibilityService)),this._findOptionsWidget=this._register(new ZTt(this._editor,this._state,this._keybindingService))}wasReplaceInputLastFocused(){return this._widget?.lastFocusedInputWasReplace??!1}focusLastElement(){this._widget?.focusLastElement()}saveViewState(){return this._widget?.getViewState()}restoreViewState(e){this._widget?.setViewState(e)}};j6e=I([m(1,qn),m(2,X),m(3,Le),m(4,Ne),m(5,de),m(6,Bi),m(7,ot),m(8,B),m(9,Ai)],j6e);var Omi=K4e(new rce({id:zd.StartFindAction,label:P(1122,"Find"),precondition:C.or(me.focus,C.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:R.MenubarEditMenu,group:"3_find",title:d(1118,null),order:1}}));Omi.addImplementation(0,(a,i,e)=>{let t=Sv.get(i);return t?t.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop}):!1});var L3o={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]},Lmi=class extends Mi{constructor(){super({id:zd.StartFindWithArgs,label:P(1123,"Find with Arguments"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:L3o})}async run(i,e,t){let o=Sv.get(e);if(o){let n=t?{searchString:t.searchString,replaceString:t.replaceString,isReplaceRevealed:t.replaceString!==void 0,isRegex:t.isRegex,wholeWord:t.matchWholeWord,matchCase:t.isCaseSensitive,preserveCase:t.preserveCase}:{};await o.start({forceRevealReplace:!1,seedSearchStringFromSelection:o.getState().searchString.length===0&&e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:t?.findInSelection||!1,loop:e.getOption(50).loop},n),o.setGlobalBufferTerm(o.getState().searchString)}}},Mmi=class extends Mi{constructor(){super({id:zd.StartFindWithSelection,label:P(1124,"Find with Selection"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(i,e){let t=Sv.get(e);t&&(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),t.setGlobalBufferTerm(t.getState().searchString))}};async function pio(a,i){let e=Sv.get(a);if(!e)return;let t=a.getOption(50).closeOnResult,o=e.getState().isRevealed,n=()=>{let r=e.editor.getSelection(),s=i?e.moveToNextMatch():e.moveToPrevMatch(),l=!1;if(s){let c=e.editor.getSelection();(!r&&c||r&&c&&!r.equalsSelection(c))&&(l=!0)}return l?(e.editor.pushUndoStop(),t&&o&&e.isFindInputFocused()&&e.closeFindWidget(),!0):!1};if(!n()&&(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getState().searchString.length===0&&a.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:a.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:a.getOption(50).loop}),!n())){let r=e.getState();o&&r.matchesCount===0&&r.searchString&&cn(d(1111,null,e2,r.searchString))}}var Fmi=K4e(new rce({id:zd.NextMatchFindAction,label:P(1116,"Find Next"),precondition:void 0,kbOpts:[{kbExpr:me.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:C.and(me.focus,IEe),primary:3,weight:100}]}));Fmi.addImplementation(0,async(a,i,e)=>pio(i,!0));var Wmi=K4e(new rce({id:zd.PreviousMatchFindAction,label:P(1117,"Find Previous"),precondition:void 0,kbOpts:[{kbExpr:me.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:C.and(me.focus,IEe),primary:1027,weight:100}]}));Wmi.addImplementation(0,async(a,i,e)=>pio(i,!1));var Pmi=class extends Mi{constructor(){super({id:zd.GoToMatchFindAction,label:P(1112,"Go to Match..."),precondition:HT});this._highlightDecorations=[]}run(e,t){let o=Sv.get(t);if(!o)return;let n=o.getState().matchesCount;if(n<1){e.get(Ne).notify({severity:ft.Warning,message:d(1115,null)});return}let r=e.get($e),s=new O,l=s.add(r.createInputBox());l.placeholder=d(1113,null,n);let c=p=>{let h=parseInt(p);if(isNaN(h))return;let g=o.getState().matchesCount;if(h>0&&h<=g)return h-1;if(h<0&&h>=-g)return g+h},u=p=>{let h=c(p);if(typeof h=="number"){l.validationMessage=void 0,o.goToMatch(h);let g=o.getState().currentMatch;g&&this.addDecorations(t,g)}else l.validationMessage=d(1114,null,o.getState().matchesCount),this.clearDecorations(t)};s.add(l.onDidChangeValue(p=>{u(p)})),s.add(l.onDidAccept(()=>{let p=c(l.value);typeof p=="number"?(o.goToMatch(p),l.hide()):l.validationMessage=d(1114,null,o.getState().matchesCount)})),s.add(l.onDidHide(()=>{this.clearDecorations(t),s.dispose()})),l.show()}clearDecorations(e){e.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(o=>{this._highlightDecorations=o.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:_s(bxe),position:7}}}])})}},t_t=class extends Mi{async run(i,e){let t=Sv.get(e);if(!t)return;let o=_J(e,"single",!1);o&&t.setSearchString(o),this._run(t)||(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),this._run(t))}},Ami=class extends t_t{constructor(){super({id:zd.NextSelectionMatchFindAction,label:P(1120,"Find Next Selection"),precondition:void 0,kbOpts:{kbExpr:me.focus,primary:2109,weight:100}})}_run(i){return i.moveToNextMatch()}},Nmi=class extends t_t{constructor(){super({id:zd.PreviousSelectionMatchFindAction,label:P(1121,"Find Previous Selection"),precondition:void 0,kbOpts:{kbExpr:me.focus,primary:3133,weight:100}})}_run(i){return i.moveToPrevMatch()}},Vmi=K4e(new rce({id:zd.StartFindReplaceAction,label:P(1125,"Replace"),precondition:C.or(me.focus,C.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:R.MenubarEditMenu,group:"3_find",title:d(1119,null),order:2}}));Vmi.addImplementation(0,(a,i,e)=>{if(!i.hasModel()||i.getOption(104))return!1;let t=Sv.get(i);if(!t)return!1;let o=i.getSelection(),n=t.isFindInputFocused(),r=!o.isEmpty()&&o.startLineNumber===o.endLineNumber&&i.getOption(50).seedSearchStringFromSelection!=="never"&&!n,s=n||r?2:1;return t.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).seedSearchStringFromSelection!=="never",shouldFocus:s,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop})});Eo(Sv.ID,j6e,0);ri(Lmi);ri(Mmi);ri(Pmi);ri(Ami);ri(Nmi);var rH=od.bindToContribution(Sv.get);ro(new rH({id:zd.CloseFindWidgetCommand,precondition:HT,handler:a=>a.closeFindWidget(),kbOpts:{weight:105,kbExpr:C.and(me.focus,C.not("isComposing")),primary:9,secondary:[1033]}}));ro(new rH({id:zd.ToggleCaseSensitiveCommand,precondition:void 0,handler:a=>a.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:me.focus,primary:C4.primary,mac:C4.mac,win:C4.win,linux:C4.linux}}));ro(new rH({id:zd.ToggleWholeWordCommand,precondition:void 0,handler:a=>a.toggleWholeWords(),kbOpts:{weight:105,kbExpr:me.focus,primary:x4.primary,mac:x4.mac,win:x4.win,linux:x4.linux}}));ro(new rH({id:zd.ToggleRegexCommand,precondition:void 0,handler:a=>a.toggleRegex(),kbOpts:{weight:105,kbExpr:me.focus,primary:k4.primary,mac:k4.mac,win:k4.win,linux:k4.linux}}));ro(new rH({id:zd.ToggleSearchScopeCommand,precondition:void 0,handler:a=>a.toggleSearchScope(),kbOpts:{weight:105,kbExpr:me.focus,primary:l6e.primary,mac:l6e.mac,win:l6e.win,linux:l6e.linux}}));ro(new rH({id:zd.TogglePreserveCaseCommand,precondition:void 0,handler:a=>a.togglePreserveCase(),kbOpts:{weight:105,kbExpr:me.focus,primary:tue.primary,mac:tue.mac,win:tue.win,linux:tue.linux}}));ro(new rH({id:zd.ReplaceOneAction,precondition:HT,handler:a=>a.replace(),kbOpts:{weight:105,kbExpr:me.focus,primary:3094}}));ro(new rH({id:zd.ReplaceOneAction,precondition:HT,handler:a=>a.replace(),kbOpts:{weight:105,kbExpr:C.and(me.focus,a6e,me.isComposing.negate()),primary:3}}));ro(new rH({id:zd.ReplaceAllAction,precondition:HT,handler:a=>a.replaceAll(),kbOpts:{weight:105,kbExpr:me.focus,primary:2563}}));ro(new rH({id:zd.ReplaceAllAction,precondition:HT,handler:a=>a.replaceAll(),kbOpts:{weight:105,kbExpr:C.and(me.focus,a6e),primary:void 0,mac:{primary:2051}}}));ro(new rH({id:zd.SelectAllMatchesAction,precondition:HT,handler:a=>a.selectAllMatches(),kbOpts:{weight:105,kbExpr:me.focus,primary:515}}));var M3o={0:" ",1:"u",2:"r"},mio=65535,HA=16777215,hio=4278190080,Q6e=class{constructor(i){let e=Math.ceil(i/32);this._states=new Uint32Array(e)}get(i){let e=i/32|0,t=i%32;return(this._states[e]&1<<t)!==0}set(i,e){let t=i/32|0,o=i%32,n=this._states[t];e?this._states[t]=n|1<<o:this._states[t]=n&~(1<<o)}},$y=class a{constructor(i,e,t){if(i.length!==e.length||i.length>mio)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=i,this._endIndexes=e,this._collapseStates=new Q6e(i.length),this._userDefinedStates=new Q6e(i.length),this._recoveredStates=new Q6e(i.length),this._types=t,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;let i=[],e=(t,o)=>{let n=i[i.length-1];return this.getStartLineNumber(n)<=t&&this.getEndLineNumber(n)>=o};for(let t=0,o=this._startIndexes.length;t<o;t++){let n=this._startIndexes[t],r=this._endIndexes[t];if(n>HA||r>HA)throw new Error("startLineNumber or endLineNumber must not exceed "+HA);for(;i.length>0&&!e(n,r);)i.pop();let s=i.length>0?i[i.length-1]:-1;i.push(t),this._startIndexes[t]=n+((s&255)<<24),this._endIndexes[t]=r+((s&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(i){return this._startIndexes[i]&HA}getEndLineNumber(i){return this._endIndexes[i]&HA}getType(i){return this._types?this._types[i]:void 0}hasTypes(){return!!this._types}isCollapsed(i){return this._collapseStates.get(i)}setCollapsed(i,e){this._collapseStates.set(i,e)}isUserDefined(i){return this._userDefinedStates.get(i)}setUserDefined(i,e){return this._userDefinedStates.set(i,e)}isRecovered(i){return this._recoveredStates.get(i)}setRecovered(i,e){return this._recoveredStates.set(i,e)}getSource(i){return this.isUserDefined(i)?1:this.isRecovered(i)?2:0}setSource(i,e){e===1?(this.setUserDefined(i,!0),this.setRecovered(i,!1)):e===2?(this.setUserDefined(i,!1),this.setRecovered(i,!0)):(this.setUserDefined(i,!1),this.setRecovered(i,!1))}setCollapsedAllOfType(i,e){let t=!1;if(this._types)for(let o=0;o<this._types.length;o++)this._types[o]===i&&(this.setCollapsed(o,e),t=!0);return t}toRegion(i){return new Bmi(this,i)}getParentIndex(i){this.ensureParentIndices();let e=((this._startIndexes[i]&hio)>>>24)+((this._endIndexes[i]&hio)>>>16);return e===mio?-1:e}contains(i,e){return this.getStartLineNumber(i)<=e&&this.getEndLineNumber(i)>=e}findIndex(i){let e=0,t=this._startIndexes.length;if(t===0)return-1;for(;e<t;){let o=Math.floor((e+t)/2);i<this.getStartLineNumber(o)?t=o:e=o+1}return e-1}findRange(i){let e=this.findIndex(i);if(e>=0){if(this.getEndLineNumber(e)>=i)return e;for(e=this.getParentIndex(e);e!==-1;){if(this.contains(e,i))return e;e=this.getParentIndex(e)}}return-1}toString(){let i=[];for(let e=0;e<this.length;e++)i[e]=`[${M3o[this.getSource(e)]}${this.isCollapsed(e)?"+":"-"}] ${this.getStartLineNumber(e)}/${this.getEndLineNumber(e)}`;return i.join(", ")}toFoldRange(i){return{startLineNumber:this._startIndexes[i]&HA,endLineNumber:this._endIndexes[i]&HA,type:this._types?this._types[i]:void 0,isCollapsed:this.isCollapsed(i),source:this.getSource(i)}}static fromFoldRanges(i){let e=i.length,t=new Uint32Array(e),o=new Uint32Array(e),n=[],r=!1;for(let l=0;l<e;l++){let c=i[l];t[l]=c.startLineNumber,o[l]=c.endLineNumber,n.push(c.type),c.type&&(r=!0)}r||(n=void 0);let s=new a(t,o,n);for(let l=0;l<e;l++)i[l].isCollapsed&&s.setCollapsed(l,!0),s.setSource(l,i[l].source);return s}static sanitizeAndMerge(i,e,t,o){t=t??Number.MAX_VALUE;let n=(b,S)=>Array.isArray(b)?(y=>y<S?b[y]:void 0):(y=>y<S?b.toFoldRange(y):void 0),r=n(i,i.length),s=n(e,e.length),l=0,c=0,u=r(0),p=s(0),h=[],g,f=0,v=[];for(;u||p;){let b;if(p&&(!u||u.startLineNumber>=p.startLineNumber))u&&u.startLineNumber===p.startLineNumber?(p.source===1?b=p:(b=u,b.isCollapsed=p.isCollapsed&&(u.endLineNumber===p.endLineNumber||!o?.startsInside(u.startLineNumber+1,u.endLineNumber+1)),b.source=0),u=r(++l)):(b=p,p.isCollapsed&&p.source===0&&(b.source=2)),p=s(++c);else{let S=c,y=p;for(;;){if(!y||y.startLineNumber>u.endLineNumber){b=u;break}if(y.source===1&&y.endLineNumber>u.endLineNumber)break;y=s(++S)}u=r(++l)}if(b){for(;g&&g.endLineNumber<b.startLineNumber;)g=h.pop();b.endLineNumber>b.startLineNumber&&b.startLineNumber>f&&b.endLineNumber<=t&&(!g||g.endLineNumber>=b.endLineNumber)&&(v.push(b),f=b.startLineNumber,g&&h.push(g),g=b)}}return v}},Bmi=class{constructor(i,e){this.ranges=i;this.index=e}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(i){return i.startLineNumber<=this.startLineNumber&&i.endLineNumber>=this.endLineNumber}containsLine(i){return this.startLineNumber<=i&&i<=this.endLineNumber}hidesLine(i){return this.startLineNumber<i&&i<=this.endLineNumber}};var i_t=class{constructor(i,e){this._updateEventEmitter=new T;this.onDidChange=this._updateEventEmitter.event;this._textModel=i,this._decorationProvider=e,this._regions=new $y(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}get regions(){return this._regions}get textModel(){return this._textModel}get decorationProvider(){return this._decorationProvider}toggleCollapseState(i){if(!i.length)return;i=i.sort((t,o)=>t.regionIndex-o.regionIndex);let e={};this._decorationProvider.changeDecorations(t=>{let o=0,n=-1,r=-1,s=l=>{for(;o<l;){let c=this._regions.getEndLineNumber(o),u=this._regions.isCollapsed(o);if(c<=n){let p=this.regions.getSource(o)!==0;t.changeDecorationOptions(this._editorDecorationIds[o],this._decorationProvider.getDecorationOption(u,c<=r,p))}u&&c>r&&(r=c),o++}};for(let l of i){let c=l.regionIndex,u=this._editorDecorationIds[c];if(u&&!e[u]){e[u]=!0,s(c);let p=!this._regions.isCollapsed(c);this._regions.setCollapsed(c,p),n=Math.max(n,this._regions.getEndLineNumber(c))}}s(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:i})}removeManualRanges(i){let e=new Array,t=o=>{for(let n of i)if(!(n.startLineNumber>o.endLineNumber||o.startLineNumber>n.endLineNumber))return!0;return!1};for(let o=0;o<this._regions.length;o++){let n=this._regions.toFoldRange(o);(n.source===0||!t(n))&&e.push(n)}this.updatePost($y.fromFoldRanges(e))}update(i,e){let t=this._currentFoldedOrManualRanges(e),o=$y.sanitizeAndMerge(i,t,this._textModel.getLineCount(),e);this.updatePost($y.fromFoldRanges(o))}updatePost(i){let e=[],t=-1;for(let o=0,n=i.length;o<n;o++){let r=i.getStartLineNumber(o),s=i.getEndLineNumber(o),l=i.isCollapsed(o),c=i.getSource(o)!==0,u={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:s,endColumn:this._textModel.getLineMaxColumn(s)+1};e.push({range:u,options:this._decorationProvider.getDecorationOption(l,s<=t,c)}),l&&s>t&&(t=s)}this._decorationProvider.changeDecorations(o=>this._editorDecorationIds=o.deltaDecorations(this._editorDecorationIds,e)),this._regions=i,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(i){let e=[];for(let t=0,o=this._regions.length;t<o;t++){let n=this.regions.isCollapsed(t),r=this.regions.getSource(t);if(n||r!==0){let s=this._regions.toFoldRange(t),l=this._textModel.getDecorationRange(this._editorDecorationIds[t]);l&&(n&&i?.startsInside(l.startLineNumber+1,l.endLineNumber)&&(n=!1),e.push({startLineNumber:l.startLineNumber,endLineNumber:l.endLineNumber,type:s.type,isCollapsed:n,source:r}))}}return e}getMemento(){let i=this._currentFoldedOrManualRanges(),e=[],t=this._textModel.getLineCount();for(let o=0,n=i.length;o<n;o++){let r=i[o];if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>t)continue;let s=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);e.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,isCollapsed:r.isCollapsed,source:r.source,checksum:s})}return e.length>0?e:void 0}applyMemento(i){if(!Array.isArray(i))return;let e=[],t=this._textModel.getLineCount();for(let n of i){if(n.startLineNumber>=n.endLineNumber||n.startLineNumber<1||n.endLineNumber>t)continue;let r=this._getLinesChecksum(n.startLineNumber+1,n.endLineNumber);(!n.checksum||r===n.checksum)&&e.push({startLineNumber:n.startLineNumber,endLineNumber:n.endLineNumber,type:void 0,isCollapsed:n.isCollapsed??!0,source:n.source??0})}let o=$y.sanitizeAndMerge(this._regions,e,t);this.updatePost($y.fromFoldRanges(o))}_getLinesChecksum(i,e){return Lr(this._textModel.getLineContent(i)+this._textModel.getLineContent(e))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds),this._updateEventEmitter.dispose()}getAllRegionsAtLine(i,e){let t=[];if(this._regions){let o=this._regions.findRange(i),n=1;for(;o>=0;){let r=this._regions.toRegion(o);(!e||e(r,n))&&t.push(r),n++,o=r.parentIndex}}return t}getRegionAtLine(i){if(this._regions){let e=this._regions.findRange(i);if(e>=0)return this._regions.toRegion(e)}return null}getRegionsInside(i,e){let t=[],o=i?i.regionIndex+1:0,n=i?i.endLineNumber:Number.MAX_VALUE;if(e&&e.length===2){let r=[];for(let s=o,l=this._regions.length;s<l;s++){let c=this._regions.toRegion(s);if(this._regions.getStartLineNumber(s)<n){for(;r.length>0&&!c.containedBy(r[r.length-1]);)r.pop();r.push(c),e(c,r.length)&&t.push(c)}else break}}else for(let r=o,s=this._regions.length;r<s;r++){let l=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<n)(!e||e(l))&&t.push(l);else break}return t}};function Y6e(a,i,e){let t=[];for(let o of e){let n=a.getRegionAtLine(o);if(n){let r=!n.isCollapsed;if(t.push(n),i>1){let s=a.getRegionsInside(n,(l,c)=>l.isCollapsed!==r&&c<i);t.push(...s)}}}a.toggleCollapseState(t)}function vue(a,i,e=Number.MAX_VALUE,t){let o=[];if(t&&t.length>0)for(let n of t){let r=a.getRegionAtLine(n);if(r&&(r.isCollapsed!==i&&o.push(r),e>1)){let s=a.getRegionsInside(r,(l,c)=>l.isCollapsed!==i&&c<e);o.push(...s)}}else{let n=a.getRegionsInside(null,(r,s)=>r.isCollapsed!==i&&s<e);o.push(...n)}a.toggleCollapseState(o)}function Hmi(a,i,e,t){let o=[];for(let n of t){let r=a.getAllRegionsAtLine(n,(s,l)=>s.isCollapsed!==i&&l<=e);o.push(...r)}a.toggleCollapseState(o)}function gio(a,i,e){let t=[];for(let o of e){let n=a.getAllRegionsAtLine(o,r=>r.isCollapsed!==i);n.length>0&&t.push(n[0])}a.toggleCollapseState(t)}function fio(a,i,e,t){let o=(r,s)=>s===i&&r.isCollapsed!==e&&!t.some(l=>r.containsLine(l)),n=a.getRegionsInside(null,o);a.toggleCollapseState(n)}function Umi(a,i,e){let t=[];for(let r of e){let s=a.getAllRegionsAtLine(r,void 0);s.length>0&&t.push(s[0])}let o=r=>t.every(s=>!s.containedBy(r)&&!r.containedBy(s))&&r.isCollapsed!==i,n=a.getRegionsInside(null,o);a.toggleCollapseState(n)}function o_t(a,i,e){let t=a.textModel,o=a.regions,n=[];for(let r=o.length-1;r>=0;r--)if(e!==o.isCollapsed(r)){let s=o.getStartLineNumber(r);i.test(t.getLineContent(s))&&n.push(o.toRegion(r))}a.toggleCollapseState(n)}function n_t(a,i,e){let t=a.regions,o=[];for(let n=t.length-1;n>=0;n--)e!==t.isCollapsed(n)&&i===t.getType(n)&&o.push(t.toRegion(n));a.toggleCollapseState(o)}function vio(a,i){let e=null,t=i.getRegionAtLine(a);if(t!==null&&(e=t.startLineNumber,a===e)){let o=t.parentIndex;o!==-1?e=i.regions.getStartLineNumber(o):e=null}return e}function bio(a,i){let e=i.getRegionAtLine(a);if(e!==null&&e.startLineNumber===a){if(a!==e.startLineNumber)return e.startLineNumber;{let t=e.parentIndex,o=0;for(t!==-1&&(o=i.regions.getStartLineNumber(e.parentIndex));e!==null;)if(e.regionIndex>0){if(e=i.regions.toRegion(e.regionIndex-1),e.startLineNumber<=o)return null;if(e.parentIndex===t)return e.startLineNumber}else return null}}else if(i.regions.length>0)for(e=i.regions.toRegion(i.regions.length-1);e!==null;){if(e.startLineNumber<a)return e.startLineNumber;e.regionIndex>0?e=i.regions.toRegion(e.regionIndex-1):e=null}return null}function Sio(a,i){let e=i.getRegionAtLine(a);if(e!==null&&e.startLineNumber===a){let t=e.parentIndex,o=0;if(t!==-1)o=i.regions.getEndLineNumber(e.parentIndex);else{if(i.regions.length===0)return null;o=i.regions.getEndLineNumber(i.regions.length-1)}for(;e!==null;)if(e.regionIndex<i.regions.length){if(e=i.regions.toRegion(e.regionIndex+1),e.startLineNumber>=o)return null;if(e.parentIndex===t)return e.startLineNumber}else return null}else if(i.regions.length>0)for(e=i.regions.toRegion(0);e!==null;){if(e.startLineNumber>a)return e.startLineNumber;e.regionIndex<i.regions.length?e=i.regions.toRegion(e.regionIndex+1):e=null}return null}var r_t=class{constructor(i){this._updateEventEmitter=new T;this._hasLineChanges=!1;this._foldingModel=i,this._foldingModelListener=i.onDidChange(e=>this.updateHiddenRanges()),this._hiddenRanges=[],i.regions.length&&this.updateHiddenRanges()}get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}notifyChangeModelContent(i){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=i.changes.some(e=>e.range.endLineNumber!==e.range.startLineNumber||NI(e.text)[0]!==0))}updateHiddenRanges(){let i=!1,e=[],t=0,o=0,n=Number.MAX_VALUE,r=-1,s=this._foldingModel.regions;for(;t<s.length;t++){if(!s.isCollapsed(t))continue;let l=s.getStartLineNumber(t)+1,c=s.getEndLineNumber(t);n<=l&&c<=r||(!i&&o<this._hiddenRanges.length&&this._hiddenRanges[o].startLineNumber===l&&this._hiddenRanges[o].endLineNumber===c?(e.push(this._hiddenRanges[o]),o++):(i=!0,e.push(new G(l,1,c,1))),n=l,r=c)}(this._hasLineChanges||i||o<this._hiddenRanges.length)&&this.applyHiddenRanges(e)}applyHiddenRanges(i){this._hiddenRanges=i,this._hasLineChanges=!1,this._updateEventEmitter.fire(i)}hasRanges(){return this._hiddenRanges.length>0}isHidden(i){return Iio(this._hiddenRanges,i)!==null}adjustSelections(i){let e=!1,t=this._foldingModel.textModel,o=null,n=r=>((!o||!A3o(r,o))&&(o=Iio(this._hiddenRanges,r)),o?o.startLineNumber-1:null);for(let r=0,s=i.length;r<s;r++){let l=i[r],c=n(l.startLineNumber);c&&(l=l.setStartPosition(c,t.getLineMaxColumn(c)),e=!0);let u=n(l.endLineNumber);u&&(l=l.setEndPosition(u,t.getLineMaxColumn(u)),e=!0),i[r]=l}return e}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null),this._updateEventEmitter.dispose()}};function A3o(a,i){return a>=i.startLineNumber&&a<=i.endLineNumber}function Iio(a,i){let e=Mw(a,t=>i<t.startLineNumber)-1;return e>=0&&a[e].endLineNumber>=i?a[e]:null}var N3o=5e3,O3o="indent",bue=class{constructor(i,e,t){this.editorModel=i;this.languageConfigurationService=e;this.foldingRangesLimit=t;this.id=O3o}dispose(){}compute(i){let e=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,t=e&&!!e.offSide,o=e&&e.markers;return Promise.resolve(W3o(this.editorModel,t,o,this.foldingRangesLimit))}},zmi=class{constructor(i){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=i}insertFirst(i,e,t){if(i>HA||e>HA)return;let o=this._length;this._startIndexes[o]=i,this._endIndexes[o]=e,this._length++,t<1e3&&(this._indentOccurrences[t]=(this._indentOccurrences[t]||0)+1)}toIndentRanges(i){let e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);let t=new Uint32Array(this._length),o=new Uint32Array(this._length);for(let n=this._length-1,r=0;n>=0;n--,r++)t[r]=this._startIndexes[n],o[r]=this._endIndexes[n];return new $y(t,o)}else{this._foldingRangesLimit.update(this._length,e);let t=0,o=this._indentOccurrences.length;for(let l=0;l<this._indentOccurrences.length;l++){let c=this._indentOccurrences[l];if(c){if(c+t>e){o=l;break}t+=c}}let n=i.getOptions().tabSize,r=new Uint32Array(e),s=new Uint32Array(e);for(let l=this._length-1,c=0;l>=0;l--){let u=this._startIndexes[l],p=i.getLineContent(u),h=H5(p,n);(h<o||h===o&&t++<e)&&(r[c]=u,s[c]=this._endIndexes[l],c++)}return new $y(r,s)}}},F3o={limit:N3o,update:()=>{}};function W3o(a,i,e,t=F3o){let o=a.getOptions().tabSize,n=new zmi(t),r;e&&(r=new RegExp(`(${e.start.source})|(?:${e.end.source})`));let s=[],l=a.getLineCount()+1;s.push({indent:-1,endAbove:l,line:l});for(let c=a.getLineCount();c>0;c--){let u=a.getLineContent(c),p=H5(u,o),h=s[s.length-1];if(p===-1){i&&(h.endAbove=c);continue}let g;if(r&&(g=u.match(r)))if(g[1]){let f=s.length-1;for(;f>0&&s[f].indent!==-2;)f--;if(f>0){s.length=f+1,h=s[f],n.insertFirst(c,h.line,p),h.line=c,h.indent=p,h.endAbove=c;continue}}else{s.push({indent:-2,endAbove:c,line:c});continue}if(h.indent>p){do s.pop(),h=s[s.length-1];while(h.indent>p);let f=h.endAbove-1;f-c>=1&&n.insertFirst(c,f,p)}h.indent===p?h.endAbove=c:s.push({indent:p,endAbove:c,line:c})}return n.toIndentRanges(a)}var V3o=te("editor.foldBackground",{light:ni(qv,.3),dark:ni(qv,.3),hcDark:null,hcLight:null},d(1178,null),!0);te("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},d(1176,null));te("editorGutter.foldingControlForeground",C5,d(1177,null));var Sue=Oe("folding-expanded",L.chevronDown,d(1180,null)),Iue=Oe("folding-collapsed",L.chevronRight,d(1179,null)),yio=Oe("folding-manual-collapsed",Iue,d(1181,null)),wio=Oe("folding-manual-expanded",Sue,d(1182,null)),Kmi={color:_s(V3o),position:1},YEe=d(1183,null),s_t=d(1184,null),a_t=class a{constructor(i){this.editor=i;this.showFoldingControls="mouseover";this.showFoldingHighlights=!0}static{this.COLLAPSED_VISUAL_DECORATION=So.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:YEe,firstLineDecorationClassName:q.asClassName(Iue)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=So.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Kmi,isWholeLine:!0,linesDecorationsTooltip:YEe,firstLineDecorationClassName:q.asClassName(Iue)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=So.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:YEe,firstLineDecorationClassName:q.asClassName(yio)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=So.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Kmi,isWholeLine:!0,linesDecorationsTooltip:YEe,firstLineDecorationClassName:q.asClassName(yio)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=So.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:YEe})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=So.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:Kmi,isWholeLine:!0,linesDecorationsTooltip:YEe})}static{this.EXPANDED_VISUAL_DECORATION=So.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+q.asClassName(Sue),linesDecorationsTooltip:s_t})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=So.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:q.asClassName(Sue),linesDecorationsTooltip:s_t})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=So.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+q.asClassName(wio),linesDecorationsTooltip:s_t})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=So.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:q.asClassName(wio),linesDecorationsTooltip:s_t})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=So.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=So.register({description:"folding-hidden-range-decoration",stickiness:1})}getDecorationOption(i,e,t){return e?a.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?i?this.showFoldingHighlights?a.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:a.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:a.NO_CONTROLS_EXPANDED_RANGE_DECORATION:i?t?this.showFoldingHighlights?a.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:a.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?a.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:a.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?t?a.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:a.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:t?a.MANUALLY_EXPANDED_VISUAL_DECORATION:a.EXPANDED_VISUAL_DECORATION}changeDecorations(i){return this.editor.changeDecorations(i)}removeDecorations(i){this.editor.removeDecorations(i)}};var B3o={},H3o="syntax",yue=class{constructor(i,e,t,o,n){this.editorModel=i;this.providers=e;this.handleFoldingRangesChange=t;this.foldingRangesLimit=o;this.fallbackRangeProvider=n;this.id=H3o;this.disposables=new O,n&&this.disposables.add(n);for(let r of e)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(t))}compute(i){return U3o(this.providers,this.editorModel,i).then(e=>this.editorModel.isDisposed()?null:e?qmi(e,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(i)??null)}dispose(){this.disposables.dispose()}};function U3o(a,i,e){let t=null,o=a.map((n,r)=>Promise.resolve(n.provideFoldingRanges(i,B3o,e)).then(s=>{if(!e.isCancellationRequested&&Array.isArray(s)){Array.isArray(t)||(t=[]);let l=i.getLineCount();for(let c of s)c.start>0&&c.end>c.start&&c.end<=l&&t.push({start:c.start,end:c.end,rank:r,kind:c.kind})}},vs));return Promise.all(o).then(n=>t)}var Gmi=class{constructor(i){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=i}add(i,e,t,o){if(i>HA||e>HA)return;let n=this._length;this._startIndexes[n]=i,this._endIndexes[n]=e,this._nestingLevels[n]=o,this._types[n]=t,this._length++,o<30&&(this._nestingLevelCounts[o]=(this._nestingLevelCounts[o]||0)+1)}toIndentRanges(){let i=this._foldingRangesLimit.limit;if(this._length<=i){this._foldingRangesLimit.update(this._length,!1);let e=new Uint32Array(this._length),t=new Uint32Array(this._length);for(let o=0;o<this._length;o++)e[o]=this._startIndexes[o],t[o]=this._endIndexes[o];return new $y(e,t,this._types)}else{this._foldingRangesLimit.update(this._length,i);let e=0,t=this._nestingLevelCounts.length;for(let s=0;s<this._nestingLevelCounts.length;s++){let l=this._nestingLevelCounts[s];if(l){if(l+e>i){t=s;break}e+=l}}let o=new Uint32Array(i),n=new Uint32Array(i),r=[];for(let s=0,l=0;s<this._length;s++){let c=this._nestingLevels[s];(c<t||c===t&&e++<i)&&(o[l]=this._startIndexes[s],n[l]=this._endIndexes[s],r[l]=this._types[s],l++)}return new $y(o,n,r)}}};function qmi(a,i){let e=a.sort((r,s)=>{let l=r.start-s.start;return l===0&&(l=r.rank-s.rank),l}),t=new Gmi(i),o,n=[];for(let r of e)if(!o)o=r,t.add(r.start,r.end,r.kind&&r.kind.value,n.length);else if(r.start>o.start)if(r.end<=o.end)n.push(o),o=r,t.add(r.start,r.end,r.kind&&r.kind.value,n.length);else{if(r.start>o.end){do o=n.pop();while(o&&r.start>o.end);o&&n.push(o),o=r}t.add(r.start,r.end,r.kind&&r.kind.value,n.length)}return t.toIndentRanges()}var zI=new Y("foldingEnabled",!1),$f=class extends k{constructor(e,t,o,n,r,s){super();this.contextKeyService=t;this.languageConfigurationService=o;this.languageFeaturesService=s;this.localToDispose=this._register(new O);this.editor=e,this._foldingLimitReporter=this._register(new X6e(e));let l=this.editor.getOptions();this._isEnabled=l.get(52),this._useFoldingProviders=l.get(53)!=="indentation",this._unfoldOnClickAfterEndOfLine=l.get(57),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=l.get(55),this.updateDebounceInfo=r.for(s.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new a_t(e),this.foldingDecorationProvider.showFoldingControls=l.get(126),this.foldingDecorationProvider.showFoldingHighlights=l.get(54),this.foldingEnabled=zI.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(c=>{if(c.hasChanged(52)&&(this._isEnabled=this.editor.getOptions().get(52),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),c.hasChanged(56)&&this.onModelChanged(),c.hasChanged(126)||c.hasChanged(54)){let u=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=u.get(126),this.foldingDecorationProvider.showFoldingHighlights=u.get(54),this.triggerFoldingModelChanged()}c.hasChanged(53)&&(this._useFoldingProviders=this.editor.getOptions().get(53)!=="indentation",this.onFoldingStrategyChanged()),c.hasChanged(57)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(57)),c.hasChanged(55)&&(this._foldingImportsByDefault=this.editor.getOptions().get(55))})),this.onModelChanged()}static{this.ID="editor.contrib.folding"}static get(e){return e.getContribution($f.ID)}static getFoldingRangeProviders(e,t){let o=e.foldingRangeProvider.ordered(t);return $f._foldingRangeSelector?.(o,t)??o}static setFoldingRangeProviderSelector(e){return $f._foldingRangeSelector=e,{dispose:()=>{$f._foldingRangeSelector=void 0}}}get limitReporter(){return this._foldingLimitReporter}saveViewState(){let e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){let t=this.foldingModel.getMemento(),o=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:o,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){let t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();let e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new i_t(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new r_t(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new rn(this.updateDebounceInfo.get(e)),this.localToDispose.add(this.updateScheduler),this.cursorChangedScheduler=new Dt(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.updateScheduler?.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.rangeProvider?.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){this.rangeProvider?.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;let t=new bue(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){let o=$f.getFoldingRangeProviders(this.languageFeaturesService,e);o.length>0&&(this.rangeProvider=new yue(e,o,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){this.hiddenRangeModel?.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{let e=this.foldingModel;if(!e)return null;let t=new On,o=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=Hn(r=>o.compute(r));return n.then(r=>{if(r&&n===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){let u=r.setCollapsedAllOfType(gT.Imports.value,!0);u&&(s=Sx.capture(this.editor),this._currentModelHasFoldedImports=u)}let l=this.editor.getSelections();e.update(r,z3o(l)),s?.restore(this.editor);let c=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=c)}return e})}).then(void 0,e=>(mt(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){let t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){let e=this.getFoldingModel();e&&e.then(t=>{if(t){let o=this.editor.getSelections();if(o&&o.length>0){let n=[];for(let r of o){let s=r.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(s)&&n.push(...t.getAllRegionsAtLine(s,l=>l.isCollapsed&&s>l.startLineNumber))}n.length&&(t.toggleCollapseState(n),this.reveal(o[0].getPosition()))}}}).then(void 0,mt)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;let t=e.target.range,o=!1;switch(e.target.type){case 4:{let n=e.target.detail,r=e.target.element.offsetLeft;if(n.offsetX-r<4)return;o=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return}case 6:{if(this.hiddenRangeModel.hasRanges()){let n=this.editor.getModel();if(n&&t.startColumn===n.getLineMaxColumn(t.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:o}}onEditorMouseUp(e){let t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;let o=this.mouseDownInfo.lineNumber,n=this.mouseDownInfo.iconClicked,r=e.target.range;if(!r||r.startLineNumber!==o)return;if(n){if(e.target.type!==4)return}else{let l=this.editor.getModel();if(!l||r.startColumn!==l.getLineMaxColumn(o))return}let s=t.getRegionAtLine(o);if(s&&s.startLineNumber===o){let l=s.isCollapsed;if(n||l){let c=e.event.altKey,u=[];if(c){let p=g=>!g.containedBy(s)&&!s.containedBy(g),h=t.getRegionsInside(null,p);for(let g of h)g.isCollapsed&&u.push(g);u.length===0&&(u=h)}else{let p=e.event.middleButton||e.event.shiftKey;if(p)for(let h of t.getRegionsInside(s))h.isCollapsed===l&&u.push(h);(l||!p||u.length===0)&&u.push(s)}t.toggleCollapseState(u),this.reveal({lineNumber:o,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}};$f=I([m(1,X),m(2,Us),m(3,Ne),m(4,Gf),m(5,Jt)],$f);var X6e=class extends k{constructor(e){super();this.editor=e;this._onDidChange=this._register(new T);this._computed=0;this._limited=!1}get limit(){return this.editor.getOptions().get(56)}get onDidChange(){return this._onDidChange.event}get computed(){return this._computed}get limited(){return this._limited}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}},BS=class extends Mi{runEditorCommand(i,e,t){let o=i.get(Us),n=$f.get(e);if(!n)return;let r=n.getFoldingModel();if(r)return this.reportTelemetry(i,e),r.then(s=>{if(s){this.invoke(n,s,e,t,o);let l=e.getSelection();l&&n.reveal(l.getStartPosition())}})}getSelectedLines(i){let e=i.getSelections();return e?e.map(t=>t.startLineNumber):[]}getLineNumbers(i,e){return i&&i.selectionLines?i.selectionLines.map(t=>t+1):this.getSelectedLines(e)}run(i,e){}};function z3o(a){return!a||a.length===0?{startsInside:()=>!1}:{startsInside(i,e){for(let t of a){let o=t.startLineNumber;if(o>=i&&o<=e)return!0}return!1}}}function Cio(a){if(!bn(a)){if(!Di(a))return!1;let i=a;if(!bn(i.levels)&&!on(i.levels)||!bn(i.direction)&&!We(i.direction)||!bn(i.selectionLines)&&(!Array.isArray(i.selectionLines)||!i.selectionLines.every(on)))return!1}return!0}var $mi=class extends BS{constructor(){super({id:"editor.unfold",label:P(1171,"Unfold"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument:
						* 'levels': Number of levels to unfold. If not set, defaults to 1.
						* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
						* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.
						`,constraint:Cio,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(i,e,t,o){let n=o&&o.levels||1,r=this.getLineNumbers(o,t);o&&o.direction==="up"?Hmi(e,!1,n,r):vue(e,!1,n,r)}},jmi=class extends BS{constructor(){super({id:"editor.unfoldRecursively",label:P(1175,"Unfold Recursively"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2142),weight:100}})}invoke(i,e,t,o){vue(e,!1,Number.MAX_VALUE,this.getSelectedLines(t))}},Qmi=class extends BS{constructor(){super({id:"editor.fold",label:P(1157,"Fold"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
							* 'levels': Number of levels to fold.
							* 'direction': If 'up', folds given number of levels up otherwise folds down.
							* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.
							If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
						`,constraint:Cio,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(i,e,t,o){let n=this.getLineNumbers(o,t),r=o&&o.levels,s=o&&o.direction;typeof r!="number"&&typeof s!="string"?gio(e,!0,n):s==="up"?Hmi(e,!0,r||1,n):vue(e,!0,r||1,n)}},Ymi=class extends BS{constructor(){super({id:"editor.toggleFold",label:P(1168,"Toggle Fold"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2090),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);Y6e(e,1,o)}},Xmi=class extends BS{constructor(){super({id:"editor.foldRecursively",label:P(1163,"Fold Recursively"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2140),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);vue(e,!0,Number.MAX_VALUE,o)}},Jmi=class extends BS{constructor(){super({id:"editor.toggleFoldRecursively",label:P(1169,"Toggle Fold Recursively"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,3114),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);Y6e(e,Number.MAX_VALUE,o)}},Zmi=class extends BS{constructor(){super({id:"editor.foldAllBlockComments",label:P(1159,"Fold All Block Comments"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2138),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())n_t(e,gT.Comment.value,!0);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).comments;if(s&&s.blockCommentStartToken){let l=new RegExp("^\\s*"+Ss(s.blockCommentStartToken));o_t(e,l,!0)}}}},ehi=class extends BS{constructor(){super({id:"editor.foldAllMarkerRegions",label:P(1161,"Fold All Regions"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2077),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())n_t(e,gT.Region.value,!0);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(s&&s.markers&&s.markers.start){let l=new RegExp(s.markers.start);o_t(e,l,!0)}}}},thi=class extends BS{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:P(1174,"Unfold All Regions"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2078),weight:100}})}invoke(i,e,t,o,n){if(e.regions.hasTypes())n_t(e,gT.Region.value,!1);else{let r=t.getModel();if(!r)return;let s=n.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(s&&s.markers&&s.markers.start){let l=new RegExp(s.markers.start);o_t(e,l,!1)}}}},ihi=class extends BS{constructor(){super({id:"editor.foldAllExcept",label:P(1160,"Fold All Except Selected"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2136),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);Umi(e,!0,o)}},ohi=class extends BS{constructor(){super({id:"editor.unfoldAllExcept",label:P(1173,"Unfold All Except Selected"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2134),weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);Umi(e,!1,o)}},nhi=class extends BS{constructor(){super({id:"editor.foldAll",label:P(1158,"Fold All"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2069),weight:100}})}invoke(i,e,t){vue(e,!0)}},rhi=class extends BS{constructor(){super({id:"editor.unfoldAll",label:P(1172,"Unfold All"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2088),weight:100}})}invoke(i,e,t){vue(e,!1)}},l_t=class a extends BS{static{this.ID_PREFIX="editor.foldLevel"}static{this.ID=i=>a.ID_PREFIX+i}getFoldingLevel(){return parseInt(this.id.substr(a.ID_PREFIX.length))}invoke(i,e,t){fio(e,this.getFoldingLevel(),!0,this.getSelectedLines(t))}},shi=class extends BS{constructor(){super({id:"editor.gotoParentFold",label:P(1165,"Go to Parent Fold"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=vio(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},ahi=class extends BS{constructor(){super({id:"editor.gotoPreviousFold",label:P(1166,"Go to Previous Folding Range"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=bio(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},lhi=class extends BS{constructor(){super({id:"editor.gotoNextFold",label:P(1164,"Go to Next Folding Range"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,weight:100}})}invoke(i,e,t){let o=this.getSelectedLines(t);if(o.length>0){let n=Sio(o[0],e);n!==null&&t.setSelection({startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:1})}}},chi=class extends BS{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:P(1156,"Create Folding Range from Selection"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2135),weight:100}})}invoke(i,e,t){let o=[],n=t.getSelections();if(n){for(let r of n){let s=r.endLineNumber;r.endColumn===1&&--s,s>r.startLineNumber&&(o.push({startLineNumber:r.startLineNumber,endLineNumber:s,type:void 0,isCollapsed:!0,source:1}),t.setSelection({startLineNumber:r.startLineNumber,startColumn:1,endLineNumber:r.startLineNumber,endColumn:1}))}if(o.length>0){o.sort((s,l)=>s.startLineNumber-l.startLineNumber);let r=$y.sanitizeAndMerge(e.regions,o,t.getModel()?.getLineCount());e.updatePost($y.fromFoldRanges(r))}}}},dhi=class extends BS{constructor(){super({id:"editor.removeManualFoldingRanges",label:P(1167,"Remove Manual Folding Ranges"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2137),weight:100}})}invoke(i,e,t){let o=t.getSelections();if(o){let n=[];for(let r of o){let{startLineNumber:s,endLineNumber:l}=r;n.push(l>=s?{startLineNumber:s,endLineNumber:l}:{endLineNumber:l,startLineNumber:s})}e.removeManualRanges(n),i.triggerFoldingModelChanged()}}},uhi=class extends BS{constructor(){super({id:"editor.toggleImportFold",label:P(1170,"Toggle Import Fold"),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,weight:100}})}async invoke(i,e){let t=[],o=e.regions;for(let n=o.length-1;n>=0;n--)o.getType(n)===gT.Imports.value&&t.push(o.toRegion(n));e.toggleCollapseState(t),i.triggerFoldingModelChanged()}};Eo($f.ID,$f,0);ri($mi);ri(jmi);ri(Qmi);ri(Xmi);ri(Jmi);ri(nhi);ri(rhi);ri(Zmi);ri(ehi);ri(thi);ri(ihi);ri(ohi);ri(Ymi);ri(shi);ri(ahi);ri(lhi);ri(chi);ri(dhi);ri(uhi);for(let a=1;a<=7;a++)$Qi(new l_t({id:l_t.ID(a),label:P(1162,"Fold Level {0}",a),precondition:zI,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2048|21+a),weight:100}}));Ge.registerCommand("_executeFoldingRangeProvider",async function(a,...i){let[e]=i;if(!(e instanceof A))throw ls();let t=a.get(Jt),o=a.get(_t).getModel(e);if(!o)throw ls();let n=a.get(B);if(!n.getValue("editor.folding",{resource:e}))return[];let r=a.get(Us),s=n.getValue("editor.foldingStrategy",{resource:e}),l={get limit(){return n.getValue("editor.foldingMaximumRegions",{resource:e})},update:(g,f)=>{}},c=new bue(o,r,l),u=c;if(s!=="indentation"){let g=$f.getFoldingRangeProviders(t,o);g.length&&(u=new yue(o,g,()=>{},l,c))}let p=await u.compute(Ie.None),h=[];try{if(p)for(let g=0;g<p.length;g++){let f=p.getType(g);h.push({start:p.getStartLineNumber(g),end:p.getEndLineNumber(g),kind:f?gT.fromValue(f):void 0})}return h}finally{u.dispose()}});var phi=class extends Mi{constructor(){super({id:"editor.action.fontZoomIn",label:P(1185,"Increase Editor Font Size"),precondition:void 0})}run(i,e){uT.setZoomLevel(uT.getZoomLevel()+1)}},mhi=class extends Mi{constructor(){super({id:"editor.action.fontZoomOut",label:P(1186,"Decrease Editor Font Size"),precondition:void 0})}run(i,e){uT.setZoomLevel(uT.getZoomLevel()-1)}},hhi=class extends Mi{constructor(){super({id:"editor.action.fontZoomReset",label:P(1187,"Reset Editor Font Size"),precondition:void 0})}run(i,e){uT.setZoomLevel(0)}};ri(phi);ri(mhi);ri(hhi);var wue=class a{static _handleEolEdits(i,e){let t,o=[];for(let n of e)typeof n.eol=="number"&&(t=n.eol),n.range&&typeof n.text=="string"&&o.push(n);return typeof t=="number"&&i.hasModel()&&i.getModel().pushEOL(t),o}static _isFullModelReplaceEdit(i,e){if(!i.hasModel())return!1;let t=i.getModel(),o=t.validateRange(e.range);return t.getFullModelRange().equalsRange(o)}static execute(i,e,t){t&&i.pushUndoStop();let o=Sx.capture(i),n=a._handleEolEdits(i,e);n.length===1&&a._isFullModelReplaceEdit(i,n[0])?i.executeEdits("formatEditsCommand",n.map(r=>Qn.replace(G.lift(r.range),r.text))):i.executeEdits("formatEditsCommand",n.map(r=>Qn.replaceMove(G.lift(r.range),r.text))),t&&i.pushUndoStop(),o.restoreRelativeVerticalPositionOfCursor(i)}};function N4(a){return a.scheme===Q.vscodeRemote?a.authority:void 0}function Gb(a){if(!a)return;let i=a.indexOf("+");return i<0?a:a.substr(0,i)}function c_t(a){if(!a)return;let i=a.indexOf("+");if(!(i<0))return a.substring(i+1)}function xio(a){let{host:i,port:e}=K3o(a);if(typeof e>"u")throw new Error(`Invalid remote authority: ${a}. It must either be a remote of form <remoteName>+<arg> or a remote host of form <host>:<port>.`);return{host:i,port:e}}function K3o(a){let i=a.match(/^(\[[0-9a-z:]+\]):(\d+)$/);if(i)return{host:i[1],port:parseInt(i[2],10)};let e=a.match(/^(\[[0-9a-z:]+\])$/);if(e)return{host:e[1],port:void 0};let t=a.match(/(.*):(\d+)$/);return t?{host:t[1],port:parseInt(t[2],10)}:{host:a,port:void 0}}var kio="extensions.user.cache",Eio="extensions.builtin.cache",d_t="undefined_publisher",Tio=["ui","workspace","web"];function Cue(a){if(typeof a=="object"&&a!==null&&a.supported!==!0)return a.description}var m0=["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 hi=class{constructor(i){this.value=i,this._lower=i.toLowerCase()}static equals(i,e){if(typeof i>"u"||i===null)return typeof e>"u"||e===null;if(typeof e>"u"||e===null)return!1;if(typeof i=="string"||typeof e=="string"){let t=typeof i=="string"?i:i.value,o=typeof e=="string"?e:e.value;return xr(t,o)}return i._lower===e._lower}static toKey(i){return typeof i=="string"?i.toLowerCase():i._lower}},HS=class{constructor(i){this._set=new Set;if(i)for(let e of i)this.add(e)}get size(){return this._set.size}add(i){this._set.add(hi.toKey(i))}delete(i){return this._set.delete(hi.toKey(i))}has(i){return this._set.has(hi.toKey(i))}},uu=class{constructor(){this._map=new Map}clear(){this._map.clear()}delete(i){this._map.delete(hi.toKey(i))}get(i){return this._map.get(hi.toKey(i))}has(i){return this._map.has(hi.toKey(i))}set(i,e){this._map.set(hi.toKey(i),e)}values(){return this._map.values()}forEach(i){this._map.forEach(i)}[Symbol.iterator](){return this._map[Symbol.iterator]()}};function O4(a){return gM(a)}function gM(a){return a.contributes&&a.contributes.localizations?a.contributes.localizations.length>0:!1}function ghi(a){return a.contributes&&a.contributes.authentication?a.contributes.authentication.length>0:!1}function XEe(a,i){if(i){let e=`onResolveRemoteAuthority:${Gb(i)}`;return!!a.activationEvents?.includes(e)}return!1}function _io(a){return a.map(i=>{let[e,t]=i.split("@");return{proposalName:e,version:t?parseInt(t):void 0}})}function Dio(a){return a.map(i=>i.split("@")[0])}var Rio=le("IBuiltinExtensionsScannerService");function JEe(a,i,e){let t=[],o=new HS,n=a.ordered(e);for(let s of n)t.push(s),s.extensionId&&o.add(s.extensionId);let r=i.ordered(e);for(let s of r){if(s.extensionId){if(o.has(s.extensionId))continue;o.add(s.extensionId)}t.push({displayName:s.displayName,extensionId:s.extensionId,provideDocumentFormattingEdits(l,c,u){return s.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),c,u)}})}return t}var xue=class a{static{this._selectors=new ra}static setFormatterSelector(i){return{dispose:a._selectors.unshift(i)}}static async select(i,e,t,o){if(i.length===0)return;let n=yt.first(a._selectors);if(n)return await n(i,e,t,o)}};async function kue(a,i,e,t,o,n,r){let s=a.get(F),{documentRangeFormattingEditProvider:l}=a.get(Jt),c=fn(i)?i.getModel():i,u=l.ordered(c),p=await xue.select(u,c,t,2);p&&(o.report(p),await s.invokeFunction(fhi,p,i,e,n,r))}async function fhi(a,i,e,t,o,n){let r=a.get(Qs),s=a.get(re),l=a.get(br),c,u;fn(e)?(c=e.getModel(),u=new $k(e,5,void 0,o)):(c=e,u=new zde(e,o));let p=[],h=0;for(let S of Ec(t).sort(G.compareRangesUsingStarts))h>0&&G.areIntersectingOrTouching(p[h-1],S)?p[h-1]=G.fromPositions(p[h-1].getStartPosition(),S.getEndPosition()):h=p.push(S);let g=async S=>{s.trace("[format][provideDocumentRangeFormattingEdits] (request)",i.extensionId?.value,S);let y=await i.provideDocumentRangeFormattingEdits(c,S,c.getFormattingOptions(),u.token)||[];return s.trace("[format][provideDocumentRangeFormattingEdits] (response)",i.extensionId?.value,y),y},f=(S,y)=>{if(!S.length||!y.length)return!1;let w=S.reduce((x,E)=>G.plusRange(x,E.range),S[0].range);if(!y.some(x=>G.intersectRanges(w,x.range)))return!1;for(let x of S)for(let E of y)if(G.intersectRanges(x.range,E.range))return!0;return!1},v=[],b=[];try{if(typeof i.provideDocumentRangesFormattingEdits=="function"){s.trace("[format][provideDocumentRangeFormattingEdits] (request)",i.extensionId?.value,p);let S=await i.provideDocumentRangesFormattingEdits(c,p,c.getFormattingOptions(),u.token)||[];s.trace("[format][provideDocumentRangeFormattingEdits] (response)",i.extensionId?.value,S),b.push(S)}else{for(let S of p){if(u.token.isCancellationRequested)return!0;b.push(await g(S))}for(let S=0;S<p.length;++S)for(let y=S+1;y<p.length;++y){if(u.token.isCancellationRequested)return!0;if(f(b[S],b[y])){let w=G.plusRange(p[S],p[y]),x=await g(w);p.splice(y,1),p.splice(S,1),p.push(w),b.splice(y,1),b.splice(S,1),b.push(x),S=0,y=0}}}for(let S of b){if(u.token.isCancellationRequested)return!0;let y=await r.computeMoreMinimalEdits(c.uri,S);y&&v.push(...y)}if(u.token.isCancellationRequested)return!0}finally{u.dispose()}if(v.length===0)return!1;if(fn(e))wue.execute(e,v,!0),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1);else{let[{range:S}]=v,y=new ei(S.startLineNumber,S.startColumn,S.endLineNumber,S.endColumn);c.pushEditOperations([y],v.map(w=>({text:w.text,range:G.lift(w.range),forceMoveMarkers:!0})),w=>{for(let{range:x}of w)if(G.areIntersectingOrTouching(x,y))return[new ei(x.startLineNumber,x.startColumn,x.endLineNumber,x.endColumn)];return null})}return l.playSignal(tn.format,{userGesture:n}),!0}async function Eue(a,i,e,t,o,n){let r=a.get(F),s=a.get(Jt),l=fn(i)?i.getModel():i,c=JEe(s.documentFormattingEditProvider,s.documentRangeFormattingEditProvider,l),u=await xue.select(c,l,e,1);u&&(t.report(u),await r.invokeFunction(vhi,u,i,e,o,n))}async function vhi(a,i,e,t,o,n){let r=a.get(Qs),s=a.get(br),l,c;fn(e)?(l=e.getModel(),c=new $k(e,5,void 0,o)):(l=e,c=new zde(e,o));let u;try{let p=await i.provideDocumentFormattingEdits(l,l.getFormattingOptions(),c.token);if(u=await r.computeMoreMinimalEdits(l.uri,p),c.token.isCancellationRequested)return!0}finally{c.dispose()}if(!u||u.length===0)return!1;if(fn(e))wue.execute(e,u,t!==2),t!==2&&e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1);else{let[{range:p}]=u,h=new ei(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn);l.pushEditOperations([h],u.map(g=>({text:g.text,range:G.lift(g.range),forceMoveMarkers:!0})),g=>{for(let{range:f}of g)if(G.areIntersectingOrTouching(f,h))return[new ei(f.startLineNumber,f.startColumn,f.endLineNumber,f.endColumn)];return null})}return s.playSignal(tn.format,{userGesture:n}),!0}async function G3o(a,i,e,t,o,n){let r=i.documentRangeFormattingEditProvider.ordered(e);for(let s of r){let l=await Promise.resolve(s.provideDocumentRangeFormattingEdits(e,t,o,n)).catch(vs);if(Rr(l))return await a.computeMoreMinimalEdits(e.uri,l)}}async function q3o(a,i,e,t,o){let n=JEe(i.documentFormattingEditProvider,i.documentRangeFormattingEditProvider,e);for(let r of n){let s=await Promise.resolve(r.provideDocumentFormattingEdits(e,t,o)).catch(vs);if(Rr(s))return await a.computeMoreMinimalEdits(e.uri,s)}}async function J6e(a,i,e,t,o){let n=fn(e)?e.getModel():e,r=JEe(i.documentFormattingEditProvider,i.documentRangeFormattingEditProvider,n),s=await xue.select(r,n,t,1);if(s){let l=await Promise.resolve(s.provideDocumentFormattingEdits(n,n.getOptions(),o)).catch(vs);return await a.computeMoreMinimalEdits(n.uri,l)}}function bhi(a,i,e,t,o,n,r){let s=i.onTypeFormattingEditProvider.ordered(e);return s.length===0||s[0].autoFormatTriggerCharacters.indexOf(o)<0?Promise.resolve(void 0):Promise.resolve(s[0].provideOnTypeFormattingEdits(e,t,o,n,r)).catch(vs).then(l=>a.computeMoreMinimalEdits(e.uri,l))}function $3o(a){let i=a;return!!i&&typeof i=="object"&&typeof i.tabSize=="number"&&typeof i.insertSpaces=="boolean"}Ge.registerCommand("_executeFormatRangeProvider",async function(a,...i){let[e,t,o]=i;To(A.isUri(e)),To(G.isIRange(t));let n=a.get(Bt),r=a.get(Qs),s=a.get(Jt),l=await n.createModelReference(e);try{return G3o(r,s,l.object.textEditorModel,G.lift(t),Shi(o,l),Ie.None)}finally{l.dispose()}});Ge.registerCommand("_executeFormatDocumentProvider",async function(a,...i){let[e,t]=i;To(A.isUri(e));let o=a.get(Bt),n=a.get(Qs),r=a.get(Jt),s=await o.createModelReference(e);try{return q3o(n,r,s.object.textEditorModel,Shi(t,s),Ie.None)}finally{s.dispose()}});Ge.registerCommand("_executeFormatOnTypeProvider",async function(a,...i){let[e,t,o,n]=i;To(A.isUri(e)),To(ye.isIPosition(t)),To(typeof o=="string");let r=a.get(Bt),s=a.get(Qs),l=a.get(Jt),c=await r.createModelReference(e);try{return bhi(s,l,c.object.textEditorModel,ye.lift(t),o,Shi(n,c),Ie.None)}finally{c.dispose()}});function Shi(a,i){let e;if($3o(a))e=a;else{let t=i.object.textEditorModel.getOptions();e={tabSize:t.tabSize,insertSpaces:t.insertSpaces}}return e}var DJ=class{constructor(i,e,t,o){this._editor=i;this._languageFeaturesService=e;this._workerService=t;this._accessibilitySignalService=o;this._disposables=new O;this._sessionDisposables=new O;this._disposables.add(e.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(i.onDidChangeModel(()=>this._update())),this._disposables.add(i.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(i.onDidChangeConfiguration(n=>{n.hasChanged(65)&&this._update()})),this._update()}static{this.ID="editor.contrib.autoFormat"}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(65)||!this._editor.hasModel())return;let i=this._editor.getModel(),[e]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(i);if(!e||!e.autoFormatTriggerCharacters)return;let t=new p5;for(let o of e.autoFormatTriggerCharacters)t.add(o.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(o=>{let n=o.charCodeAt(o.length-1);t.has(n)&&this._trigger(String.fromCharCode(n))}))}_trigger(i){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;let e=this._editor.getModel(),t=this._editor.getPosition(),o=new qe,n=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){o.cancel(),n.dispose();return}for(let s=0,l=r.changes.length;s<l;s++)if(r.changes[s].range.endLineNumber<=t.lineNumber){o.cancel(),n.dispose();return}});bhi(this._workerService,this._languageFeaturesService,e,t,i,e.getFormattingOptions(),o.token).then(r=>{o.token.isCancellationRequested||Rr(r)&&(this._accessibilitySignalService.playSignal(tn.format,{userGesture:!1}),wue.execute(this._editor,r,!0))}).finally(()=>{n.dispose()})}};DJ=I([m(1,Jt),m(2,Qs),m(3,br)],DJ);var ZEe=class{constructor(i,e,t){this.editor=i;this._languageFeaturesService=e;this._instantiationService=t;this._callOnDispose=new O;this._callOnModel=new O;this._callOnDispose.add(i.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(i.onDidChangeModel(()=>this._update())),this._callOnDispose.add(i.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(e.documentRangeFormattingEditProvider.onDidChange(this._update,this))}static{this.ID="editor.contrib.formatOnPaste"}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(64)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:i})=>this._trigger(i)))}_trigger(i){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(kue,this.editor,i,2,nh.None,Ie.None,!1).catch(mt))}};ZEe=I([m(1,Jt),m(2,F)],ZEe);var Ihi=class extends Mi{constructor(){super({id:"editor.action.formatDocument",label:P(1188,"Format Document"),precondition:C.and(me.notInCompositeEditor,me.writable,me.hasDocumentFormattingProvider),kbOpts:{kbExpr:me.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(i,e){if(e.hasModel()){let t=i.get(F);await i.get(Hd).showWhile(t.invokeFunction(Eue,e,1,nh.None,Ie.None,!0),250)}}},yhi=class extends Mi{constructor(){super({id:"editor.action.formatSelection",label:P(1189,"Format Selection"),precondition:C.and(me.writable,me.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2084),weight:100},contextMenuOpts:{when:me.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(i,e){if(!e.hasModel())return;let t=i.get(F),o=e.getModel(),n=e.getSelections().map(s=>s.isEmpty()?new G(s.startLineNumber,1,s.startLineNumber,o.getLineMaxColumn(s.startLineNumber)):s);await i.get(Hd).showWhile(t.invokeFunction(kue,e,n,1,nh.None,Ie.None,!0),250)}};Eo(DJ.ID,DJ,2);Eo(ZEe.ID,ZEe,2);ri(Ihi);ri(yhi);Ge.registerCommand("editor.action.format",async a=>{let i=a.get(Qt).getFocusedCodeEditor();if(!i||!i.hasModel())return;let e=a.get(fe);i.getSelection().isEmpty()?await e.executeCommand("editor.action.formatDocument"):await e.executeCommand("editor.action.formatSelection")});var fM=class a{remove(){this.parent?.children.delete(this.id)}static findId(i,e){let t;typeof i=="string"?t=`${e.id}/${i}`:(t=`${e.id}/${i.name}`,e.children.get(t)!==void 0&&(t=`${e.id}/${i.name}_${i.range.startLineNumber}_${i.range.startColumn}`));let o=t;for(let n=0;e.children.get(o)!==void 0;n++)o=`${t}_${n}`;return o}static getElementById(i,e){if(!i)return;let t=Af(i,e.id);if(t===i.length)return e;if(!(t<e.id.length))for(let[,o]of e.children){let n=a.getElementById(i,o);if(n)return n}}static size(i){let e=1;for(let[,t]of i.children)e+=a.size(t);return e}static empty(i){return i.children.size===0}},Iv=class extends fM{constructor(e,t,o){super();this.id=e;this.parent=t;this.symbol=o;this.children=new Map}},pC=class extends fM{constructor(e,t,o,n){super();this.id=e;this.parent=t;this.label=o;this.order=n;this.children=new Map}getItemEnclosingPosition(e){return e?this._getItemEnclosingPosition(e,this.children):void 0}_getItemEnclosingPosition(e,t){for(let[,o]of t)if(!(!o.symbol.range||!G.containsPosition(o.symbol.range,e)))return this._getItemEnclosingPosition(e,o.children)||o}updateMarker(e){for(let[,t]of this.children)this._updateMarker(e,t)}_updateMarker(e,t){t.marker=void 0;let o=Ek(e,t.symbol.range,G.compareRangesUsingStarts),n;o<0?(n=~o,n>0&&G.areIntersecting(e[n-1],t.symbol.range)&&(n-=1)):n=o;let r=[],s;for(;n<e.length&&G.areIntersecting(t.symbol.range,e[n]);n++){let l=e[n];r.push(l),e[n]=void 0,(!s||l.severity>s)&&(s=l.severity)}for(let[,l]of t.children)this._updateMarker(r,l);s&&(t.marker={count:r.length,topSev:s}),Wj(e)}},h0=class a extends fM{constructor(e){super();this.uri=e;this.id="root";this.parent=void 0;this._groups=new Map;this.children=new Map;this.id="root",this.parent=void 0}static create(e,t,o){let n=new qe(o),r=new a(t.uri),s=e.ordered(t),l=s.map((u,p)=>{let h=fM.findId(`provider_${p}`,r),g=new pC(h,r,u.displayName??"Unknown Outline Provider",p);return Promise.resolve(u.provideDocumentSymbols(t,n.token)).then(f=>{for(let v of f||[])a._makeOutlineElement(v,g);return g},f=>(vs(f),g)).then(f=>{fM.empty(f)?f.remove():r._groups.set(h,f)})}),c=e.onDidChange(()=>{let u=e.ordered(t);eo(u,s)||n.cancel()});return Promise.all(l).then(()=>n.token.isCancellationRequested&&!o.isCancellationRequested?a.create(e,t,o):r._compact()).finally(()=>{n.dispose(),c.dispose(),n.dispose()})}static _makeOutlineElement(e,t){let o=fM.findId(e,t),n=new Iv(o,t,e);if(e.children)for(let r of e.children)a._makeOutlineElement(r,n);t.children.set(n.id,n)}static get(e){for(;e;){if(e instanceof a)return e;e=e.parent}}_compact(){let e=0;for(let[t,o]of this._groups)o.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{let t=yt.first(this._groups.values());for(let[,o]of t.children)o.parent=this,this.children.set(o.id,o)}return this}merge(e){return this.uri.toString()!==e.uri.toString()||this._groups.size!==e._groups.size?!1:(this._groups=e._groups,this.children=e.children,!0)}getItemEnclosingPosition(e,t){let o;if(t){let r=t.parent;for(;r&&!o;)r instanceof pC&&(o=r),r=r.parent}let n;for(let[,r]of this._groups)if(n=r.getItemEnclosingPosition(e),n&&(!o||o===r))break;return n}getItemById(e){return fM.getElementById(e,this)}updateMarker(e){e.sort(G.compareRangesUsingStarts);for(let[,t]of this._groups)t.updateMarker(e.slice(0))}getTopLevelSymbols(){let e=[];for(let t of this.children.values())t instanceof Iv?e.push(t.symbol):e.push(...yt.map(t.children.values(),o=>o.symbol));return e.sort((t,o)=>G.compareRangesUsingStarts(t.range,o.range))}asListOfDocumentSymbols(){let e=this.getTopLevelSymbols(),t=[];return a._flattenDocumentSymbols(t,e,""),t.sort((o,n)=>ye.compare(G.getStartPosition(o.range),G.getStartPosition(n.range))||ye.compare(G.getEndPosition(n.range),G.getEndPosition(o.range)))}static _flattenDocumentSymbols(e,t,o){for(let n of t)e.push({kind:n.kind,tags:n.tags,name:n.name,detail:n.detail,containerName:n.containerName||o,range:n.range,selectionRange:n.selectionRange,children:void 0}),n.children&&a._flattenDocumentSymbols(e,n.children,n.name)}},kx=le("IOutlineModelService"),e9e=class{constructor(i,e,t){this._languageFeaturesService=i;this._disposables=new O;this._cache=new Ua(15,.7);this._debounceInformation=e.for(i.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(t.onModelRemoved(o=>{this._cache.delete(o.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(i,e){let t=this._languageFeaturesService.documentSymbolProvider,o=t.ordered(i),n=this._cache.get(i.id);if(!n||n.versionId!==i.getVersionId()||!eo(n.provider,o)){let s=new qe;n={versionId:i.getVersionId(),provider:o,promiseCnt:0,source:s,promise:h0.create(t,i,s.token),model:void 0},this._cache.set(i.id,n);let l=Date.now();n.promise.then(c=>{n.model=c,this._debounceInformation.update(i,Date.now()-l)}).catch(c=>{this._cache.delete(i.id)})}if(n.model)return n.model;n.promiseCnt+=1;let r=e.onCancellationRequested(()=>{--n.promiseCnt===0&&(n.source.cancel(),this._cache.delete(i.id))});try{return await n.promise}finally{r.dispose()}}getDebounceValue(i){return this._debounceInformation.get(i)}getCachedModels(){return yt.filter(yt.map(this._cache.values(),i=>i.model),i=>i!==void 0)}};e9e=I([m(0,Jt),m(1,Gf),m(2,_t)],e9e);Ce(kx,e9e,1);Ge.registerCommand("_executeDocumentSymbolProvider",async function(a,...i){let[e]=i;To(A.isUri(e));let t=a.get(kx),n=await a.get(Bt).createModelReference(e);try{return(await t.getOrCreate(n.object.textEditorModel,Ie.None)).getTopLevelSymbols()}finally{n.dispose()}});var _a=new class{constructor(){this._implementations=[]}register(i){return this._implementations.push(i),{dispose:()=>{let e=this._implementations.indexOf(i);e!==-1&&this._implementations.splice(e,1)}}}getImplementations(){return this._implementations}};function Lio(a){return a instanceof i9e?a._instance:a}var i9e=class{constructor(i){this.instantiationService=i}init(...i){}};function j3o(a,i){return class extends i{constructor(){super(...arguments);this._autorun=void 0}init(...o){this._autorun=Rl((n,r)=>{let s=a.read(n);this._instance=r.add(this.instantiationService.createInstance(s,...o))})}dispose(){this._autorun?.dispose()}}}var u_t=class extends i9e{constructor(i){super(i),this.init()}};u_t=I([m(0,F)],u_t);function p_t(a){return DT()?j3o(a,t9e):a.get()}var t9e=class extends i9e{constructor(i,e){super(e),this.init(i)}};t9e=I([m(1,F)],t9e);var RJ=class{validateOrThrow(i){let e=this.validate(i);if(e.error)throw new Error(e.error.message);return e.content}},eTe=class extends RJ{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}}},Q3o=new eTe("string");function Mio(){return Q3o}var O_s=new eTe("number");var Y3o=new eTe("boolean");function Ehi(){return Y3o}var F_s=new eTe("object");var whi=class extends RJ{validate(i){return{content:i,error:void 0}}getJSONSchema(){return{}}};function Pio(){return new whi}var m_t=class extends RJ{validate(i){return i!==void 0?{content:void 0,error:{message:`Expected undefined, but got ${typeof i}`}}:{content:void 0,error:void 0}}getJSONSchema(){return{}}};function Aio(){return new m_t}var o9e=class{constructor(i){this.validator=i}};function n9e(a){return new o9e(a)}var Chi=class extends RJ{constructor(e){super();this.properties=e}validate(e){if(typeof e!="object"||e===null)return{content:void 0,error:{message:"Expected object"}};let t={};for(let o in this.properties){let n=this.properties[o],r=e[o],s=n instanceof o9e,l=s?n.validator:n;if(s&&r===void 0)continue;let{content:c,error:u}=l.validate(r);if(u)return{content:void 0,error:{message:`Error in property '${o}': ${u.message}`}};t[o]=c}return{content:t,error:void 0}}getJSONSchema(){let e=[],t={};for(let[n,r]of Object.entries(this.properties)){let s=r instanceof o9e,l=s?r.validator:r;t[n]=l.getJSONSchema(),s||e.push(n)}return{type:"object",properties:t,...e.length>0?{required:e}:{}}}};function Nio(a){return new Chi(a)}var xhi=class extends RJ{constructor(e){super();this.validators=e}validate(e){let t;for(let o of this.validators){let{content:n,error:r}=o.validate(e);if(!r)return{content:n,error:void 0};t=r}return{content:void 0,error:t}}getJSONSchema(){return{oneOf:Q4i(this.validators,e=>{if(!(e instanceof m_t))return e.getJSONSchema()})}}};function Oio(...a){return new xhi(a)}var khi=class extends RJ{constructor(e,t){super();this._ref=e;this._validator=t}validate(e){return this._validator.validate(e)}getJSONSchema(){return{$ref:this._ref}}};function Fio(a,i){return new khi(a,i)}var ar={Visible:WEt,HasFocusedSuggestion:new Y("suggestWidgetHasFocusedSuggestion",!1,d(1638,null)),DetailsVisible:new Y("suggestWidgetDetailsVisible",!1,d(1637,null)),DetailsFocused:new Y("suggestWidgetDetailsFocused",!1,d(1636,null)),MultipleSuggestions:new Y("suggestWidgetMultipleSuggestions",!1,d(1639,null)),MakesTextEdit:new Y("suggestionMakesTextEdit",!0,d(1635,null)),AcceptSuggestionsOnEnter:new Y("acceptSuggestionOnEnter",!0,d(1631,null)),HasInsertAndReplaceRange:new Y("suggestionHasInsertAndReplaceRange",!1,d(1633,null)),InsertMode:new Y("suggestionInsertMode",void 0,{type:"string",description:d(1634,null)}),CanResolve:new Y("suggestionCanResolve",!1,d(1632,null))},sH=new R("suggestWidgetStatusBar"),Thi=class{constructor(i,e,t,o){this.position=i;this.completion=e;this.container=t;this.provider=o;this.isInvalid=!1;this.score=Xv.Default;this.distance=0;this.textLabel=typeof e.label=="string"?e.label:e.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=e.sortText&&e.sortText.toLowerCase(),this.filterTextLow=e.filterText&&e.filterText.toLowerCase(),this.extensionId=e.extensionId,G.isIRange(e.range)?(this.editStart=new ye(e.range.startLineNumber,e.range.startColumn),this.editInsertEnd=new ye(e.range.endLineNumber,e.range.endColumn),this.editReplaceEnd=new ye(e.range.endLineNumber,e.range.endColumn),this.isInvalid=this.isInvalid||G.spansMultipleLines(e.range)||e.range.startLineNumber!==i.lineNumber):(this.editStart=new ye(e.range.insert.startLineNumber,e.range.insert.startColumn),this.editInsertEnd=new ye(e.range.insert.endLineNumber,e.range.insert.endColumn),this.editReplaceEnd=new ye(e.range.replace.endLineNumber,e.range.replace.endColumn),this.isInvalid=this.isInvalid||G.spansMultipleLines(e.range.insert)||G.spansMultipleLines(e.range.replace)||e.range.insert.startLineNumber!==i.lineNumber||e.range.replace.startLineNumber!==i.lineNumber||e.range.insert.startColumn!==e.range.replace.startColumn),typeof o.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(i){if(!this._resolveCache){let e=i.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),t=new On(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,i)).then(o=>{Object.assign(this.completion,o),this._resolveDuration=t.elapsed()},o=>{Yi(o)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{e.dispose()})}return this._resolveCache}};var F4=class a{constructor(i=2,e=new Set,t=new Set,o=new Map,n=!0){this.snippetSortOrder=i;this.kindFilter=e;this.providerFilter=t;this.providerItemsToReuse=o;this.showDeprecated=n}static{this.default=new a}},LJ;function Vio(){return LJ}function Bio(a){let i=LJ;return LJ=a,i}var _hi=class{constructor(i,e,t,o){this.items=i;this.needsClipboard=e;this.durations=t;this.disposable=o}};async function _ue(a,i,e,t=F4.default,o={triggerKind:0},n=Ie.None){let r=new On;e=e.clone();let s=i.getWordAtPosition(e),l=s?new G(e.lineNumber,s.startColumn,e.lineNumber,s.endColumn):G.fromPositions(e),c={replace:l,insert:l.setEndPosition(e.lineNumber,e.column)},u=[],p=new O,h=[],g=!1,f=(b,S,y)=>{let w=!1;if(!S)return w;for(let x of S.suggestions)if(!t.kindFilter.has(x.kind)){if(!t.showDeprecated&&x?.tags?.includes(1))continue;x.range||(x.range=c),x.sortText||(x.sortText=typeof x.label=="string"?x.label:x.label.label),!g&&x.insertTextRules&&x.insertTextRules&4&&(g=Og.guessNeedsClipboard(x.insertText)),u.push(new Thi(e,x,S,b)),w=!0}return Sd(S)&&p.add(S),h.push({providerName:b._debugDisplayName??"unknown_provider",elapsedProvider:S.duration??-1,elapsedOverall:y.elapsed()}),w},v=(async()=>{if(!LJ||t.kindFilter.has(28))return;let b=t.providerItemsToReuse.get(LJ);if(b){b.forEach(w=>u.push(w));return}if(t.providerFilter.size>0&&!t.providerFilter.has(LJ))return;let S=new On,y=await LJ.provideCompletionItems(i,e,o,n);f(LJ,y,S)})();for(let b of a.orderedGroups(i)){let S=!1;if(await Promise.all(b.map(async y=>{if(t.providerItemsToReuse.has(y)){let w=t.providerItemsToReuse.get(y);w.forEach(x=>u.push(x)),S=S||w.length>0;return}if(!(t.providerFilter.size>0&&!t.providerFilter.has(y)))try{let w=new On,x=await y.provideCompletionItems(i,e,o,n);S=f(y,x,w)||S}catch(w){vs(w)}})),S||n.isCancellationRequested)break}return await v,n.isCancellationRequested?(p.dispose(),Promise.reject(new qi)):new _hi(u.sort(Z3o(t.snippetSortOrder)),g,{entries:h,elapsed:r.elapsed()},p)}function Dhi(a,i){if(a.sortTextLow&&i.sortTextLow){if(a.sortTextLow<i.sortTextLow)return-1;if(a.sortTextLow>i.sortTextLow)return 1}return a.textLabel<i.textLabel?-1:a.textLabel>i.textLabel?1:a.completion.kind-i.completion.kind}function X3o(a,i){if(a.completion.kind!==i.completion.kind){if(a.completion.kind===28)return-1;if(i.completion.kind===28)return 1}return Dhi(a,i)}function J3o(a,i){if(a.completion.kind!==i.completion.kind){if(a.completion.kind===28)return 1;if(i.completion.kind===28)return-1}return Dhi(a,i)}var h_t=new Map;h_t.set(0,X3o);h_t.set(2,J3o);h_t.set(1,Dhi);function Z3o(a){return h_t.get(a)}Ge.registerCommand("_executeCompletionItemProvider",async(a,...i)=>{let[e,t,o,n]=i;To(A.isUri(e)),To(ye.isIPosition(t)),To(typeof o=="string"||!o),To(typeof n=="number"||!n);let{completionProvider:r}=a.get(Jt),s=await a.get(Bt).createModelReference(e);try{let l={incomplete:!1,suggestions:[]},c=[],u=s.object.textEditorModel.validatePosition(t),p=await _ue(r,s.object.textEditorModel,u,void 0,{triggerCharacter:o??void 0,triggerKind:o?1:0});for(let h of p.items)c.length<(n??0)&&c.push(h.resolve(Ie.None)),l.incomplete=l.incomplete||h.container.incomplete,l.suggestions.push(h.completion);try{return await Promise.all(c),l}finally{setTimeout(()=>p.disposable.dispose(),100)}}finally{s.dispose()}});function g_t(a,i){a.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(i),void 0,!0)}var m2=class{static isAllOff(i){return i.other==="off"&&i.comments==="off"&&i.strings==="off"}static isAllOn(i){return i.other==="on"&&i.comments==="on"&&i.strings==="on"}static valueFor(i,e){switch(e){case 1:return i.comments;case 2:return i.strings;default:return i.other}}};var Za=class{static{this.inlineSuggestionVisible=new Y("inlineSuggestionVisible",!1,d(1373,null))}static{this.inlineSuggestionAlternativeActionVisible=new Y("inlineSuggestionAlternativeActionVisible",!1,d(1370,null))}static{this.inlineSuggestionHasIndentation=new Y("inlineSuggestionHasIndentation",!1,d(1371,null))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new Y("inlineSuggestionHasIndentationLessThanTabSize",!0,d(1372,null))}static{this.suppressSuggestions=new Y("inlineSuggestionSuppressSuggestions",void 0,d(1374,null))}static{this.cursorBeforeGhostText=new Y("cursorBeforeGhostText",!1,d(1365,null))}static{this.cursorInIndentation=new Y("cursorInIndentation",!1,d(1366,null))}static{this.hasSelection=new Y("editor.hasSelection",!1,d(1367,null))}static{this.cursorAtInlineEdit=new Y("cursorAtInlineEdit",!1,d(1364,null))}static{this.inlineEditVisible=new Y("inlineEditIsVisible",!1,d(1369,null))}static{this.tabShouldJumpToInlineEdit=new Y("tabShouldJumpToInlineEdit",!1,d(1376,null))}static{this.tabShouldAcceptInlineEdit=new Y("tabShouldAcceptInlineEdit",!1,d(1375,null))}static{this.inInlineEditsPreviewEditor=new Y("inInlineEditsPreviewEditor",!0,d(1368,null))}};var f_t=class{constructor(i,e,t){this._selection=i,this._cursors=e,this._selectionId=null,this._trimInRegexesAndStrings=t}getEditOperations(i,e){let t=r9e(i,this._cursors,this._trimInRegexesAndStrings);for(let o=0,n=t.length;o<n;o++){let r=t[o];e.addEditOperation(r.range,r.text)}this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function r9e(a,i,e){i.sort((s,l)=>s.lineNumber===l.lineNumber?s.column-l.column:s.lineNumber-l.lineNumber);for(let s=i.length-2;s>=0;s--)i[s].lineNumber===i[s+1].lineNumber&&i.splice(s,1);let t=[],o=0,n=0,r=i.length;for(let s=1,l=a.getLineCount();s<=l;s++){let c=a.getLineContent(s),u=c.length+1,p=0;if(n<r&&i[n].lineNumber===s&&(p=i[n].column,n++,p===u)||c.length===0)continue;let h=Bv(c),g=0;if(h===-1)g=1;else if(h!==c.length-1)g=h+2;else continue;if(!e){if(!a.tokenization.hasAccurateTokensForLine(s))continue;let f=a.tokenization.getLineTokens(s),v=f.getStandardTokenType(f.findTokenIndexAtOffset(g));if(v===2||v===3)continue}g=Math.max(p,g),t[o++]=Qn.delete(new G(s,g,s,u))}return t}var s9e=class{constructor(i,e,t){this._selection=i,this._isCopyingDown=e,this._noop=t||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(i,e){let t=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,t.startLineNumber<t.endLineNumber&&t.endColumn===1&&(this._endLineNumberDelta=1,t=t.setEndPosition(t.endLineNumber-1,i.getLineMaxColumn(t.endLineNumber-1)));let o=[];for(let r=t.startLineNumber;r<=t.endLineNumber;r++)o.push(i.getLineContent(r));let n=o.join(`
`);n===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?e.addEditOperation(new G(t.endLineNumber,i.getLineMaxColumn(t.endLineNumber),t.endLineNumber+1,1),t.endLineNumber===i.getLineCount()?"":`
`):this._isCopyingDown?e.addEditOperation(new G(t.startLineNumber,1,t.startLineNumber,1),n+`
`):e.addEditOperation(new G(t.endLineNumber,i.getLineMaxColumn(t.endLineNumber),t.endLineNumber,i.getLineMaxColumn(t.endLineNumber)),`
`+n),this._selectionId=e.trackSelection(t),this._selectionDirection=this._selection.getDirection()}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let o=t.startLineNumber,n=t.startColumn,r=t.endLineNumber,s=t.endColumn;this._startLineNumberDelta!==0&&(o=o+this._startLineNumberDelta,n=1),this._endLineNumberDelta!==0&&(r=r+this._endLineNumberDelta,s=1),t=ei.createWithDirection(o,n,r,s,this._selectionDirection)}return t}};function tE(a,i){let e=0;for(let t=0;t<a.length;t++)a.charAt(t)==="	"?e+=i:e++;return e}function Due(a,i,e){a=a<0?0:a;let t="";if(!e){let o=Math.floor(a/i);a=a%i;for(let n=0;n<o;n++)t+="	"}for(let o=0;o<a;o++)t+=" ";return t}var iTe=class{constructor(i,e,t,o){this._languageConfigurationService=o;this._selection=i,this._isMovingDown=e,this._autoIndent=t,this._selectionId=null,this._moveEndLineSelectionShrink=!1}createVirtualModel(i,e,t){return{tokenization:{getLineTokens:o=>i.tokenization.getLineTokens(e(o)),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(o,n)=>i.getLanguageIdAtPosition(o,n)},getLineContent:o=>{let n=t?.(o);return n!==void 0?n:i.getLineContent(e(o))}}}getEditOperations(i,e){let t=i.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===t){this._selectionId=e.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=e.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let o=this._selection;o.startLineNumber<o.endLineNumber&&o.endColumn===1&&(this._moveEndPositionDown=!0,o=o.setEndPosition(o.endLineNumber-1,i.getLineMaxColumn(o.endLineNumber-1)));let{tabSize:n,indentSize:r,insertSpaces:s}=i.getOptions(),l=this.buildIndentConverter(n,r,s);if(o.startLineNumber===o.endLineNumber&&i.getLineMaxColumn(o.startLineNumber)===1){let c=o.startLineNumber,u=this._isMovingDown?c+1:c-1;i.getLineMaxColumn(u)===1?e.addEditOperation(new G(1,1,1,1),null):(e.addEditOperation(new G(c,1,c,1),i.getLineContent(u)),e.addEditOperation(new G(u,1,u,i.getLineMaxColumn(u)),null)),o=new ei(u,1,u,1)}else{let c,u;if(this._isMovingDown){c=o.endLineNumber+1,u=i.getLineContent(c),e.addEditOperation(new G(c-1,i.getLineMaxColumn(c-1),c,i.getLineMaxColumn(c)),null);let p=u;if(this.shouldAutoIndent(i,o)){let h=this.matchEnterRule(i,l,n,c,o.startLineNumber-1);if(h!==null){let f=Ul(i.getLineContent(c)),v=h+tE(f,n);p=Due(v,n,s)+this.trimStart(u)}else{let f=this.createVirtualModel(i,b=>b===o.startLineNumber?c:b),v=wce(this._autoIndent,f,i.getLanguageIdAtPosition(c,1),o.startLineNumber,l,this._languageConfigurationService);if(v!==null){let b=Ul(i.getLineContent(c)),S=tE(v,n),y=tE(b,n);S!==y&&(p=Due(S,n,s)+this.trimStart(u))}}e.addEditOperation(new G(o.startLineNumber,1,o.startLineNumber,1),p+`
`);let g=this.matchEnterRuleMovingDown(i,l,n,o.startLineNumber,c,p);if(g!==null)g!==0&&this.getIndentEditsOfMovingBlock(i,e,o,n,s,g);else{let f=this.createVirtualModel(i,b=>b===o.startLineNumber?c:b>=o.startLineNumber+1&&b<=o.endLineNumber+1?b-1:b,b=>b===o.startLineNumber?p:void 0),v=wce(this._autoIndent,f,i.getLanguageIdAtPosition(c,1),o.startLineNumber+1,l,this._languageConfigurationService);if(v!==null){let b=Ul(i.getLineContent(o.startLineNumber)),S=tE(v,n),y=tE(b,n);if(S!==y){let w=S-y;this.getIndentEditsOfMovingBlock(i,e,o,n,s,w)}}}}else e.addEditOperation(new G(o.startLineNumber,1,o.startLineNumber,1),p+`
`)}else if(c=o.startLineNumber-1,u=i.getLineContent(c),e.addEditOperation(new G(c,1,c+1,1),null),e.addEditOperation(new G(o.endLineNumber,i.getLineMaxColumn(o.endLineNumber),o.endLineNumber,i.getLineMaxColumn(o.endLineNumber)),`
`+u),this.shouldAutoIndent(i,o)){let p=this.createVirtualModel(i,g=>g===c?o.startLineNumber:g),h=this.matchEnterRule(i,l,n,o.startLineNumber,o.startLineNumber-2);if(h!==null)h!==0&&this.getIndentEditsOfMovingBlock(i,e,o,n,s,h);else{let g=wce(this._autoIndent,p,i.getLanguageIdAtPosition(o.startLineNumber,1),c,l,this._languageConfigurationService);if(g!==null){let f=Ul(i.getLineContent(o.startLineNumber)),v=tE(g,n),b=tE(f,n);if(v!==b){let S=v-b;this.getIndentEditsOfMovingBlock(i,e,o,n,s,S)}}}}}this._selectionId=e.trackSelection(o)}buildIndentConverter(i,e,t){return{shiftIndent:o=>Fb.shiftIndent(o,o.length+1,i,e,t),unshiftIndent:o=>Fb.unshiftIndent(o,o.length+1,i,e,t)}}parseEnterResult(i,e,t,o,n){if(n){let r=n.indentation;n.indentAction===0||n.indentAction===1?r=n.indentation+n.appendText:n.indentAction===2?r=n.indentation:n.indentAction===3&&(r=e.unshiftIndent(n.indentation)+n.appendText);let s=i.getLineContent(o);if(this.trimStart(s).indexOf(this.trimStart(r))>=0){let l=Ul(i.getLineContent(o)),c=Ul(r),u=$St(i,o,this._languageConfigurationService);u!==null&&u&2&&(c=e.unshiftIndent(c));let p=tE(c,t),h=tE(l,t);return p-h}}return null}matchEnterRuleMovingDown(i,e,t,o,n,r){if(Bv(r)>=0){let s=i.getLineMaxColumn(n),l=g5(this._autoIndent,i,new G(n,s,n,s),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,l)}else{let s=o-1;for(;s>=1;){let u=i.getLineContent(s);if(Bv(u)>=0)break;s--}if(s<1||o>i.getLineCount())return null;let l=i.getLineMaxColumn(s),c=g5(this._autoIndent,i,new G(s,l,s,l),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,c)}}matchEnterRule(i,e,t,o,n,r){let s=n;for(;s>=1;){let u;if(s===n&&r!==void 0?u=r:u=i.getLineContent(s),Bv(u)>=0)break;s--}if(s<1||o>i.getLineCount())return null;let l=i.getLineMaxColumn(s),c=g5(this._autoIndent,i,new G(s,l,s,l),this._languageConfigurationService);return this.parseEnterResult(i,e,t,o,c)}trimStart(i){return i.replace(/^\s+/,"")}shouldAutoIndent(i,e){if(this._autoIndent<4||!i.tokenization.isCheapToTokenize(e.startLineNumber))return!1;let t=i.getLanguageIdAtPosition(e.startLineNumber,1),o=i.getLanguageIdAtPosition(e.endLineNumber,1);return!(t!==o||this._languageConfigurationService.getLanguageConfiguration(t).indentRulesSupport===null)}getIndentEditsOfMovingBlock(i,e,t,o,n,r){for(let s=t.startLineNumber;s<=t.endLineNumber;s++){let l=i.getLineContent(s),c=Ul(l),p=tE(c,o)+r,h=Due(p,o,n);h!==c&&(e.addEditOperation(new G(s,1,s,c.length+1),h),s===t.endLineNumber&&t.endColumn<=c.length+1&&h===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(i,e){let t=e.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(t=t.setEndPosition(t.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&t.startLineNumber<t.endLineNumber&&(t=t.setEndPosition(t.endLineNumber,2)),t}};iTe=I([m(3,Us)],iTe);var oTe=class{static{this._COLLATOR=nd.Collator()}constructor(i,e){this.selection=i,this.descending=e,this.selectionId=null}getEditOperations(i,e){let t=e8o(i,this.selection,this.descending);t&&e.addEditOperation(t.range,t.text),this.selectionId=e.trackSelection(this.selection)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}static canRun(i,e,t){if(i===null)return!1;let o=Uio(i,e,t);if(!o)return!1;for(let n=0,r=o.before.length;n<r;n++)if(o.before[n]!==o.after[n])return!0;return!1}};function Uio(a,i,e){let t=i.startLineNumber,o=i.endLineNumber;if(i.endColumn===1&&o--,t>=o)return null;let n=[];for(let s=t;s<=o;s++)n.push(a.getLineContent(s));let r=n.slice(0);return r.sort(oTe._COLLATOR.value.compare),e===!0&&(r=r.reverse()),{startLineNumber:t,endLineNumber:o,before:n,after:r}}function e8o(a,i,e){let t=Uio(a,i,e);return t?Qn.replace(new G(t.startLineNumber,1,t.endLineNumber,a.getLineMaxColumn(t.endLineNumber)),t.after.join(`
`)):null}var v_t=class extends Mi{constructor(i,e){super(e),this.down=i}run(i,e){if(!e.hasModel())return;let t=e.getSelections().map((r,s)=>({selection:r,index:s,ignore:!1}));t.sort((r,s)=>G.compareRangesUsingStarts(r.selection,s.selection));let o=t[0];for(let r=1;r<t.length;r++){let s=t[r];o.selection.endLineNumber===s.selection.startLineNumber&&(o.index<s.index?s.ignore=!0:(o.ignore=!0,o=s))}let n=[];for(let r of t)n.push(new s9e(r.selection,this.down,r.ignore));e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Rhi=class extends v_t{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:P(1429,"Copy Line Up"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"2_line",title:d(1446,null),order:1},canTriggerInlineEdits:!0})}},Lhi=class extends v_t{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:P(1428,"Copy Line Down"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"2_line",title:d(1445,null),order:2},canTriggerInlineEdits:!0})}},Mhi=class extends Mi{constructor(){super({id:"editor.action.duplicateSelection",label:P(1419,"Duplicate Selection"),precondition:me.writable,menuOpts:{menuId:R.MenubarSelectionMenu,group:"2_line",title:d(1447,null),order:5},canTriggerInlineEdits:!0})}run(i,e,t){if(!e.hasModel())return;let o=[],n=e.getSelections(),r=e.getModel();for(let s of n)if(s.isEmpty())o.push(new s9e(s,!0));else{let l=new ei(s.endLineNumber,s.endColumn,s.endLineNumber,s.endColumn);o.push(new gSt(l,r.getValueInRange(s)))}e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop()}},b_t=class extends Mi{constructor(i,e){super(e),this.down=i}run(i,e){let t=i.get(Us),o=[],n=e.getSelections()||[],r=e.getOption(16);for(let s of n)o.push(new iTe(s,this.down,r,t));e.pushUndoStop(),e.executeCommands(this.id,o),e.pushUndoStop()}},Phi=class extends b_t{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:P(1439,"Move Line Up"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"2_line",title:d(1449,null),order:3},canTriggerInlineEdits:!0})}},Ahi=class extends b_t{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:P(1438,"Move Line Down"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"2_line",title:d(1448,null),order:4},canTriggerInlineEdits:!0})}},S_t=class extends Mi{constructor(i,e){super(e),this.descending=i}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections();o.length===1&&o[0].isSingleLine()&&(o=[new ei(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);for(let r of o)if(!oTe.canRun(e.getModel(),r,this.descending))return;let n=[];for(let r=0,s=o.length;r<s;r++)n[r]=new oTe(o[r],this.descending);e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},Nhi=class extends S_t{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:P(1442,"Sort Lines Ascending"),precondition:me.writable,canTriggerInlineEdits:!0})}},Ohi=class extends S_t{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:P(1443,"Sort Lines Descending"),precondition:me.writable,canTriggerInlineEdits:!0})}},Fhi=class extends Mi{constructor(){super({id:"editor.action.removeDuplicateLines",label:P(1433,"Delete Duplicate Lines"),precondition:me.writable,canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=e.getModel();if(t.getLineCount()===1&&t.getLineMaxColumn(1)===1)return;let o=[],n=[],r=0,s=!0,l=e.getSelections();l.length===1&&l[0].isSingleLine()&&(l=[new ei(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))],s=!1);for(let c of l){let u=new Set,p=[];for(let v=c.startLineNumber;v<=c.endLineNumber;v++){let b=t.getLineContent(v);u.has(b)||(p.push(b),u.add(b))}let h=new ei(c.startLineNumber,1,c.endLineNumber,t.getLineMaxColumn(c.endLineNumber)),g=c.startLineNumber-r,f=new ei(g,1,g+p.length-1,p[p.length-1].length+1);o.push(Qn.replace(h,p.join(`
`))),n.push(f),r+=c.endLineNumber-c.startLineNumber+1-p.length}e.pushUndoStop(),e.executeEdits(this.id,o,s?n:void 0),e.pushUndoStop()}},Whi=class extends Mi{constructor(){super({id:"editor.action.reverseLines",label:P(1441,"Reverse lines"),precondition:me.writable,canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections(),n=o;n.length===1&&n[0].isSingleLine()&&(n=[new ei(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);let r=[],s=[];for(let l=0;l<n.length;l++){let c=n[l],u=o[l],p=c.endLineNumber;c.startLineNumber<c.endLineNumber&&c.endColumn===1&&p--;let h=new G(c.startLineNumber,1,p,t.getLineMaxColumn(p));p===t.getLineCount()&&t.getLineContent(h.endLineNumber)===""&&(h=h.setEndPosition(h.endLineNumber-1,t.getLineMaxColumn(h.endLineNumber-1)));let g=[];for(let S=h.endLineNumber;S>=h.startLineNumber;S--)g.push(t.getLineContent(S));let f=Qn.replace(h,g.join(`
`));r.push(f);let v=function(S){return S<=h.endLineNumber?h.endLineNumber-S+h.startLineNumber:S},b=function(S){if(S.isEmpty())return new ei(v(S.positionLineNumber),S.positionColumn,v(S.positionLineNumber),S.positionColumn);{let y=v(S.selectionStartLineNumber),w=v(S.positionLineNumber),x=S.selectionStartColumn,E=S.positionColumn;return new ei(y,x,w,E)}};s.push(b(u))}e.pushUndoStop(),e.executeEdits(this.id,r,s),e.pushUndoStop()}},c9e=class a extends Mi{static{this.ID="editor.action.trimTrailingWhitespace"}constructor(){super({id:a.ID,label:P(1444,"Trim Trailing Whitespace"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2102),weight:100}})}run(i,e,t){let o=[];t.reason==="auto-save"&&(o=(e.getSelections()||[]).map(u=>new ye(u.positionLineNumber,u.positionColumn)));let n=e.getSelection();if(n===null)return;let r=i.get(B),s=e.getModel(),l=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:s?.getLanguageId(),resource:s?.uri}),c=new f_t(n,o,l);e.pushUndoStop(),e.executeCommands(this.id,[c]),e.pushUndoStop()}},Vhi=class extends Mi{constructor(){super({id:"editor.action.deleteLines",label:P(1430,"Delete Line"),precondition:me.writable,kbOpts:{kbExpr:me.textInputFocus,primary:3113,weight:100},canTriggerInlineEdits:!0})}run(i,e){if(!e.hasModel())return;let t=this._getLinesToRemove(e),o=e.getModel();if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n=0,r=[],s=[];for(let l=0,c=t.length;l<c;l++){let u=t[l],p=u.startLineNumber,h=u.endLineNumber,g=1,f=o.getLineMaxColumn(h);h<o.getLineCount()?(h+=1,f=1):p>1&&(p-=1,g=o.getLineMaxColumn(p)),r.push(Qn.replace(new ei(p,g,h,f),"")),s.push(new ei(p-n,u.positionColumn,p-n,u.positionColumn)),n+=u.endLineNumber-u.startLineNumber+1}e.pushUndoStop(),e.executeEdits(this.id,r,s),e.revealAllCursors(!0),e.pushUndoStop()}_getLinesToRemove(i){let e=i.getSelections().map(n=>{let r=n.endLineNumber;return n.startLineNumber<n.endLineNumber&&n.endColumn===1&&(r-=1),{startLineNumber:n.startLineNumber,selectionStartColumn:n.selectionStartColumn,endLineNumber:r,positionColumn:n.positionColumn}});e.sort((n,r)=>n.startLineNumber===r.startLineNumber?n.endLineNumber-r.endLineNumber:n.startLineNumber-r.startLineNumber);let t=[],o=e[0];for(let n=1;n<e.length;n++)o.endLineNumber+1>=e[n].startLineNumber?o.endLineNumber=e[n].endLineNumber:(t.push(o),o=e[n]);return t.push(o),t}},Bhi=class extends Mi{constructor(){super({id:"editor.action.indentLines",label:P(1434,"Indent Line"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:2142,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,xA.indent(t.cursorConfig,e.getModel(),e.getSelections())),e.pushUndoStop())}},Hhi=class extends Mi{constructor(){super({id:"editor.action.outdentLines",label:P(1440,"Outdent Line"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:2140,weight:100},canTriggerInlineEdits:!0})}run(i,e){VL.Outdent.runEditorCommand(i,e,null)}},d9e=class a extends Mi{static{this.ID="editor.action.insertLineBefore"}constructor(){super({id:a.ID,label:P(1436,"Insert Line Above"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:3075,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,f5.lineInsertBefore(t.cursorConfig,e.getModel(),e.getSelections())))}},Rue=class a extends Mi{static{this.ID="editor.action.insertLineAfter"}constructor(){super({id:a.ID,label:P(1435,"Insert Line Below"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:2051,weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,f5.lineInsertAfter(t.cursorConfig,e.getModel(),e.getSelections())))}},I_t=class extends Mi{run(i,e){if(!e.hasModel())return;let t=e.getSelection(),o=this._getRangesToDelete(e),n=[];for(let l=0,c=o.length-1;l<c;l++){let u=o[l],p=o[l+1];G.intersectRanges(u,p)===null?n.push(u):o[l+1]=G.plusRange(u,p)}n.push(o[o.length-1]);let r=this._getEndCursorState(t,n),s=n.map(l=>Qn.replace(l,""));e.pushUndoStop(),e.executeEdits(this.id,s,r),e.pushUndoStop()}},Uhi=class extends I_t{constructor(){super({id:"deleteAllLeft",label:P(1431,"Delete All Left"),precondition:me.writable,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:2049},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(i,e){let t=null,o=[],n=0;return e.forEach(r=>{let s;if(r.endColumn===1&&n>0){let l=r.startLineNumber-n;s=new ei(l,r.startColumn,l,r.startColumn)}else s=new ei(r.startLineNumber,r.startColumn,r.startLineNumber,r.startColumn);n+=r.endLineNumber-r.startLineNumber,r.intersectRanges(i)?t=s:o.push(s)}),t&&o.unshift(t),o}_getRangesToDelete(i){let e=i.getSelections();if(e===null)return[];let t=e,o=i.getModel();return o===null?[]:(t.sort(G.compareRangesUsingStarts),t=t.map(n=>{if(n.isEmpty())if(n.startColumn===1){let r=Math.max(1,n.startLineNumber-1),s=n.startLineNumber===1?1:o.getLineLength(r)+1;return new G(r,s,n.startLineNumber,1)}else return new G(n.startLineNumber,1,n.startLineNumber,n.startColumn);else return new G(n.startLineNumber,1,n.endLineNumber,n.endColumn)}),t)}},zhi=class extends I_t{constructor(){super({id:"deleteAllRight",label:P(1432,"Delete All Right"),precondition:me.writable,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(i,e){let t=null,o=[];for(let n=0,r=e.length,s=0;n<r;n++){let l=e[n],c=new ei(l.startLineNumber-s,l.startColumn,l.startLineNumber-s,l.startColumn);l.intersectRanges(i)?t=c:o.push(c)}return t&&o.unshift(t),o}_getRangesToDelete(i){let e=i.getModel();if(e===null)return[];let t=i.getSelections();if(t===null)return[];let o=t.map(n=>{if(n.isEmpty()){let r=e.getLineMaxColumn(n.startLineNumber);return n.startColumn===r?new G(n.startLineNumber,n.startColumn,n.startLineNumber+1,1):new G(n.startLineNumber,n.startColumn,n.startLineNumber,r)}return n});return o.sort(G.compareRangesUsingStarts),o}},Khi=class extends Mi{constructor(){super({id:"editor.action.joinLines",label:P(1437,"Join Lines"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:0,mac:{primary:296},weight:100},canTriggerInlineEdits:!0})}run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getSelection();if(o===null)return;t.sort(G.compareRangesUsingStarts);let n=[],r=t.reduce((h,g)=>h.isEmpty()?h.endLineNumber===g.startLineNumber?(o.equalsSelection(h)&&(o=g),g):g.startLineNumber>h.endLineNumber+1?(n.push(h),g):new ei(h.startLineNumber,h.startColumn,g.endLineNumber,g.endColumn):g.startLineNumber>h.endLineNumber?(n.push(h),g):new ei(h.startLineNumber,h.startColumn,g.endLineNumber,g.endColumn));n.push(r);let s=e.getModel();if(s===null)return;let l=[],c=[],u=o,p=0;for(let h=0,g=n.length;h<g;h++){let f=n[h],v=f.startLineNumber,b=1,S=0,y,w,x=s.getLineLength(f.endLineNumber)-f.endColumn;if(f.isEmpty()||f.startLineNumber===f.endLineNumber){let N=f.getStartPosition();N.lineNumber<s.getLineCount()?(y=v+1,w=s.getLineMaxColumn(y)):(y=N.lineNumber,w=s.getLineMaxColumn(N.lineNumber))}else y=f.endLineNumber,w=s.getLineMaxColumn(y);let E=s.getLineContent(v);for(let N=v+1;N<=y;N++){let V=s.getLineContent(N),H=s.getLineFirstNonWhitespaceColumn(N);if(H>=1){let K=!0;E===""&&(K=!1),K&&(E.charAt(E.length-1)===" "||E.charAt(E.length-1)==="	")&&(K=!1,E=E.replace(/[\s\uFEFF\xA0]+$/g," "));let j=V.substr(H-1);E+=(K?" ":"")+j,K?S=j.length+1:S=j.length}else S=0}let M=new G(v,b,y,w);if(!M.isEmpty()){let N;f.isEmpty()?(l.push(Qn.replace(M,E)),N=new ei(M.startLineNumber-p,E.length-S+1,v-p,E.length-S+1)):f.startLineNumber===f.endLineNumber?(l.push(Qn.replace(M,E)),N=new ei(f.startLineNumber-p,f.startColumn,f.endLineNumber-p,f.endColumn)):(l.push(Qn.replace(M,E)),N=new ei(f.startLineNumber-p,f.startColumn,f.startLineNumber-p,E.length-x)),G.intersectRanges(M,o)!==null?u=N:c.push(N)}p+=M.endLineNumber-M.startLineNumber}c.unshift(u),e.pushUndoStop(),e.executeEdits(this.id,l,c),e.pushUndoStop()}},Ghi=class extends Mi{constructor(){super({id:"editor.action.transpose",label:P(1427,"Transpose Characters around the Cursor"),precondition:me.writable,canTriggerInlineEdits:!0})}run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getModel();if(o===null)return;let n=[];for(let r=0,s=t.length;r<s;r++){let l=t[r];if(!l.isEmpty())continue;let c=l.getStartPosition(),u=o.getLineMaxColumn(c.lineNumber);if(c.column>=u){if(c.lineNumber===o.getLineCount())continue;let p=new G(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h=o.getValueInRange(p).split("").reverse().join("");n.push(new kg(new ei(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),h))}else{let p=new G(c.lineNumber,Math.max(1,c.column-1),c.lineNumber,c.column+1),h=o.getValueInRange(p).split("").reverse().join("");n.push(new FY(p,h,new ei(c.lineNumber,c.column+1,c.lineNumber,c.column+1)))}}e.pushUndoStop(),e.executeCommands(this.id,n),e.pushUndoStop()}},W4=class extends Mi{run(i,e){let t=e.getSelections();if(t===null)return;let o=e.getModel();if(o===null)return;let n=e.getOption(148),r=[];for(let s of t)if(s.isEmpty()){let l=s.getStartPosition(),c=e.getConfiguredWordAtPosition(l);if(!c)continue;let u=new G(l.lineNumber,c.startColumn,l.lineNumber,c.endColumn),p=o.getValueInRange(u);r.push(Qn.replace(u,this._modifyText(p,n)))}else{let l=o.getValueInRange(s);r.push(Qn.replace(s,this._modifyText(l,n)))}e.pushUndoStop(),e.executeEdits(this.id,r),e.pushUndoStop()}},qhi=class extends W4{constructor(){super({id:"editor.action.transformToUppercase",label:P(1426,"Transform to Uppercase"),precondition:me.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){return i.toLocaleUpperCase()}},$hi=class extends W4{constructor(){super({id:"editor.action.transformToLowercase",label:P(1422,"Transform to Lowercase"),precondition:me.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){return i.toLocaleLowerCase()}},vM=class{constructor(i,e){this._pattern=i;this._flags=e;this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}},y_t=class a extends W4{static{this.titleBoundary=new vM("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu")}constructor(){super({id:"editor.action.transformToTitlecase",label:P(1425,"Transform to Title Case"),precondition:me.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.titleBoundary.get();return t?i.toLocaleLowerCase().replace(t,o=>o.toLocaleUpperCase()):i}},a9e=class a extends W4{static{this.caseBoundary=new vM("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new vM("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu")}constructor(){super({id:"editor.action.transformToSnakecase",label:P(1424,"Transform to Snake Case"),precondition:me.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.caseBoundary.get(),o=a.singleLetters.get();return!t||!o?i:i.replace(t,"$1_$2").replace(o,"$1_$2$3").toLocaleLowerCase()}},l9e=class a extends W4{static{this.singleLineWordBoundary=new vM("[_\\s-]+","gm")}static{this.multiLineWordBoundary=new vM("[_-]+","gm")}static{this.validWordStart=new vM("^(\\p{Lu}[^\\p{Lu}])","gmu")}constructor(){super({id:"editor.action.transformToCamelcase",label:P(1420,"Transform to Camel Case"),precondition:me.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=/\r\n|\r|\n/.test(i)?a.multiLineWordBoundary.get():a.singleLineWordBoundary.get(),o=a.validWordStart.get();if(!t||!o)return i;let n=i.split(t);return n.shift()?.replace(o,s=>s.toLocaleLowerCase())+n.map(s=>s.substring(0,1).toLocaleUpperCase()+s.substring(1)).join("")}},w_t=class a extends W4{static{this.wordBoundary=new vM("[_ \\t-]","gm")}static{this.wordBoundaryToMaintain=new vM("(?<=\\.)","gm")}static{this.upperCaseWordMatcher=new vM("^\\p{Lu}+$","mu")}constructor(){super({id:"editor.action.transformToPascalcase",label:P(1423,"Transform to Pascal Case"),precondition:me.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.wordBoundary.get(),o=a.wordBoundaryToMaintain.get(),n=a.upperCaseWordMatcher.get();return!t||!o||!n?i:i.split(o).map(l=>l.split(t)).flat().map(l=>{let c=l.charAt(0).toLocaleUpperCase()+l.slice(1);return c.length>1&&n.test(c)?c.charAt(0)+c.slice(1).toLocaleLowerCase():c}).join("")}},C_t=class a extends W4{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(e=>e.isSupported())}static{this.caseBoundary=new vM("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new vM("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu")}static{this.underscoreBoundary=new vM("(\\S)(_)(\\S)","gm")}constructor(){super({id:"editor.action.transformToKebabcase",label:P(1421,"Transform to Kebab Case"),precondition:me.writable,canTriggerInlineEdits:!0})}_modifyText(i,e){let t=a.caseBoundary.get(),o=a.singleLetters.get(),n=a.underscoreBoundary.get();return!t||!o||!n?i:i.replace(n,"$1-$3").replace(t,"$1-$2").replace(o,"$1-$2").toLocaleLowerCase()}};ri(Rhi);ri(Lhi);ri(Mhi);ri(Phi);ri(Ahi);ri(Nhi);ri(Ohi);ri(Fhi);ri(c9e);ri(Vhi);ri(Bhi);ri(Hhi);ri(d9e);ri(Rue);ri(Uhi);ri(zhi);ri(Khi);ri(Ghi);ri(qhi);ri($hi);ri(Whi);a9e.caseBoundary.isSupported()&&a9e.singleLetters.isSupported()&&ri(a9e);l9e.singleLineWordBoundary.isSupported()&&l9e.multiLineWordBoundary.isSupported()&&ri(l9e);w_t.wordBoundary.isSupported()&&ri(w_t);y_t.titleBoundary.isSupported()&&ri(y_t);C_t.isSupported()&&ri(C_t);var MJ=le("dataChannelService");function zio(a){return a.sourceId+" @@ "+JSON.stringify({...a,modelUri:a.modelUri?.toString(),sourceId:void 0})}var PJ=class extends k{constructor(e,t,o){super();this._key=e;this._contextKeyService=t;this._dataChannelService=o;this._isEnabledContextKeyValue=t8o("structuredLogger.enabled:"+this._key,this._contextKeyService).recomputeInitiallyAndOnChange(this._store),this.isEnabled=this._isEnabledContextKeyValue.map(n=>n!==void 0)}static cast(){return this}log(e){return this._isEnabledContextKeyValue.get()?(this._dataChannelService.getDataChannel("structuredLogger:"+this._key).sendData(e),!0):!1}};PJ=I([m(1,X),m(2,MJ)],PJ);function t8o(a,i){return vi(i.onDidChangeContext,()=>i.getContextKeyValue(a))}var nTe=class extends k{constructor(e,t,o){super();this._editor=e;this._instantiationService=t;this._loggerService=o;this._structuredLogger=this._register(this._instantiationService.createInstance(PJ.cast(),"editor.inlineSuggest.logChangeReason.commandId"));let n=this._loggerService?.createLogger("textModelChanges",{hidden:!1,name:"Text Model Changes Reason"}),r=vi(this,n.onDidChangeLogLevel,()=>n.getLevel());this._register(ve(s=>{Bwe(r.read(s),1)&&s.store.add(this._editor.onDidChangeModelContent(l=>{this._editor.getModel()?.uri.scheme!=="output"&&n.trace("onDidChangeModelContent: "+l.detailedReasons.map(c=>c.toKey(Number.MAX_VALUE)).join(", "))}))})),this._register(ve(s=>{this._editor instanceof us&&this._structuredLogger.isEnabled.read(s)&&s.store.add(this._editor.onDidChangeModelContent(l=>{let c=this._editor.getModel();if(!c)return;let u=l.detailedReasons[0],p={...u.metadata,sourceId:"TextModel.setChangeReason",source:u.metadata.source,time:Date.now(),modelUri:c.uri,modelVersion:c.getVersionId()};setTimeout(()=>{this._structuredLogger.log(p)},0)}))}))}};nTe=I([m(1,F),m(2,Ol)],nTe);var Kio=Object.freeze({CURRENT_YEAR:!0,CURRENT_YEAR_SHORT:!0,CURRENT_MONTH:!0,CURRENT_DATE:!0,CURRENT_HOUR:!0,CURRENT_MINUTE:!0,CURRENT_SECOND:!0,CURRENT_MILLISECOND:!0,CURRENT_DAY_NAME:!0,CURRENT_DAY_NAME_SHORT:!0,CURRENT_MONTH_NAME:!0,CURRENT_MONTH_NAME_SHORT:!0,CURRENT_SECONDS_UNIX:!0,CURRENT_MILLISECONDS_UNIX:!0,CURRENT_TIMEZONE_OFFSET:!0,CURRENT_TIMEZONE_NAME:!0,SELECTION:!0,CLIPBOARD:!0,TM_SELECTED_TEXT:!0,TM_CURRENT_LINE:!0,TM_CURRENT_WORD:!0,TM_LINE_INDEX:!0,TM_LINE_NUMBER:!0,TM_FILENAME:!0,TM_FILENAME_BASE:!0,TM_DIRECTORY:!0,TM_DIRECTORY_BASE:!0,TM_FILEPATH:!0,CURSOR_INDEX:!0,CURSOR_NUMBER:!0,RELATIVE_FILEPATH:!0,BLOCK_COMMENT_START:!0,BLOCK_COMMENT_END:!0,LINE_COMMENT:!0,WORKSPACE_NAME:!0,WORKSPACE_FOLDER:!0,RANDOM:!0,RANDOM_HEX:!0,UUID:!0}),u9e=class{constructor(i){this._delegates=i}resolve(i){for(let e of this._delegates){let t=e.resolve(i);if(t!==void 0)return t}}},p9e=class{constructor(i,e,t,o){this._model=i;this._selection=e;this._selectionIdx=t;this._overtypingCapturer=o}resolve(i){let{name:e}=i;if(e==="SELECTION"||e==="TM_SELECTED_TEXT"){let t=this._model.getValueInRange(this._selection)||void 0,o=this._selection.startLineNumber!==this._selection.endLineNumber;if(!t&&this._overtypingCapturer){let n=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);n&&(t=n.value,o=n.multiline)}if(t&&o&&i.snippet){let n=this._model.getLineContent(this._selection.startLineNumber),r=Ul(n,0,this._selection.startColumn-1),s=r;i.snippet.walk(c=>c===i?!1:(c instanceof VS&&(s=Ul(Hc(c.value).pop())),!0));let l=Af(s,r);t=t.replace(/(\r\n|\r|\n)(.*)/g,(c,u,p)=>`${u}${s.substr(l)}${p}`)}return t}else{if(e==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(e==="TM_CURRENT_WORD"){let t=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return t&&t.word||void 0}else{if(e==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(e==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(e==="CURSOR_INDEX")return String(this._selectionIdx);if(e==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}},m9e=class{constructor(i,e){this._labelService=i;this._model=e}resolve(i){let{name:e}=i;if(e==="TM_FILENAME")return Jo(this._model.uri.fsPath);if(e==="TM_FILENAME_BASE"){let t=Jo(this._model.uri.fsPath),o=t.lastIndexOf(".");return o<=0?t:t.slice(0,o)}else{if(e==="TM_DIRECTORY")return yd(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(ai(this._model.uri));if(e==="TM_DIRECTORY_BASE")return yd(this._model.uri.fsPath)==="."?"":Jo(yd(this._model.uri.fsPath));if(e==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(e==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}},h9e=class{constructor(i,e,t,o){this._readClipboardText=i;this._selectionIdx=e;this._selectionCount=t;this._spread=o}resolve(i){if(i.name!=="CLIPBOARD")return;let e=this._readClipboardText();if(e){if(this._spread){let t=e.split(/\r\n|\n|\r/).filter(o=>!_c(o));if(t.length===this._selectionCount)return t[this._selectionIdx]}return e}}},Lue=class{constructor(i,e,t){this._model=i;this._selection=e;this._languageConfigurationService=t}resolve(i){let{name:e}=i,t=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),o=this._languageConfigurationService.getLanguageConfiguration(t).comments;if(o){if(e==="LINE_COMMENT")return o.lineCommentToken||void 0;if(e==="BLOCK_COMMENT_START")return o.blockCommentStartToken||void 0;if(e==="BLOCK_COMMENT_END")return o.blockCommentEndToken||void 0}}};Lue=I([m(2,Us)],Lue);var g9e=class a{constructor(){this._date=new Date}static{this.dayNames=[d(1612,null),d(1602,null),d(1616,null),d(1618,null),d(1614,null),d(1590,null),d(1608,null)]}static{this.dayNamesShort=[d(1613,null),d(1603,null),d(1617,null),d(1619,null),d(1615,null),d(1591,null),d(1609,null)]}static{this.monthNames=[d(1592,null),d(1588,null),d(1598,null),d(1582,null),d(1600,null),d(1596,null),d(1594,null),d(1584,null),d(1610,null),d(1606,null),d(1604,null),d(1586,null)]}static{this.monthNamesShort=[d(1593,null),d(1589,null),d(1599,null),d(1583,null),d(1601,null),d(1597,null),d(1595,null),d(1585,null),d(1611,null),d(1607,null),d(1605,null),d(1587,null)]}resolve(i){let{name:e}=i;switch(e){case"CURRENT_YEAR":return String(this._date.getFullYear());case"CURRENT_YEAR_SHORT":return String(this._date.getFullYear()).slice(-2);case"CURRENT_MONTH":return String(this._date.getMonth().valueOf()+1).padStart(2,"0");case"CURRENT_DATE":return String(this._date.getDate().valueOf()).padStart(2,"0");case"CURRENT_HOUR":return String(this._date.getHours().valueOf()).padStart(2,"0");case"CURRENT_MINUTE":return String(this._date.getMinutes().valueOf()).padStart(2,"0");case"CURRENT_SECOND":return String(this._date.getSeconds().valueOf()).padStart(2,"0");case"CURRENT_MILLISECOND":return String(this._date.getMilliseconds().valueOf()).padStart(3,"0");case"CURRENT_DAY_NAME":return a.dayNames[this._date.getDay()];case"CURRENT_DAY_NAME_SHORT":return a.dayNamesShort[this._date.getDay()];case"CURRENT_MONTH_NAME":return a.monthNames[this._date.getMonth()];case"CURRENT_MONTH_NAME_SHORT":return a.monthNamesShort[this._date.getMonth()];case"CURRENT_SECONDS_UNIX":return String(Math.floor(this._date.getTime()/1e3));case"CURRENT_MILLISECONDS_UNIX":return String(this._date.getTime());case"CURRENT_TIMEZONE_OFFSET":{let t=this._date.getTimezoneOffset(),o=t>0?"-":"+",n=Math.trunc(Math.abs(t/60)),r=n<10?"0"+n:n,s=Math.abs(t)-n*60,l=s<10?"0"+s:s;return o+r+":"+l}case"CURRENT_TIMEZONE_NAME":return this._timezoneName??=Intl.DateTimeFormat().resolvedOptions().timeZone}}},f9e=class{constructor(i){this._workspaceService=i}resolve(i){if(!this._workspaceService)return;let e=pf(this._workspaceService.getWorkspace());if(!u4(e)){if(i.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(e);if(i.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(e)}}_resolveWorkspaceName(i){if(Pg(i))return Jo(i.uri.path);let e=Jo(i.configPath.path);return e.endsWith(OT)&&(e=e.substr(0,e.length-OT.length-1)),e}_resoveWorkspacePath(i){if(Pg(i))return dm(i.uri.fsPath);let e=Jo(i.configPath.path),t=i.configPath.fsPath;return t.endsWith(e)&&(t=t.substr(0,t.length-e.length-1)),t?dm(t):"/"}},v9e=class{resolve(i){let{name:e}=i;if(e==="RANDOM")return Math.random().toString().slice(-6);if(e==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(e==="UUID")return ht()}};var x_t=class a{constructor(i,e,t){this._editor=i;this._snippet=e;this._snippetLineLeadingWhitespace=t;this._offset=-1;this._nestingLevel=1;this._placeholderGroups=Lf(e.placeholders,jk.compareByIndex),this._placeholderGroupsIdx=-1}static{this._decor={active:So.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:So.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:So.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:So.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})}}initialize(i){this._offset=i.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;let i=this._editor.getModel();this._editor.changeDecorations(e=>{for(let t of this._snippet.placeholders){let o=this._snippet.offset(t),n=this._snippet.fullLen(t),r=G.fromPositions(i.getPositionAt(this._offset+o),i.getPositionAt(this._offset+o+n)),s=t.isFinalTabstop?a._decor.inactiveFinal:a._decor.inactive,l=e.addDecoration(r,s);this._placeholderDecorations.set(t,l)}})}move(i){if(!this._editor.hasModel())return[];this._initDecorations();let e=this._editor.getModel();if(this._placeholderGroupsIdx>=0){let n=[];for(let r of this._placeholderGroups[this._placeholderGroupsIdx])if(r.transform){let s=this._placeholderDecorations.get(r),l=s?e.getDecorationRange(s):null;if(l){let c=e.getValueInRange(l),u=r.transform.resolve(c).split(/\r\n|\r|\n/);for(let p=1;p<u.length;p++)u[p]=e.normalizeIndentation(this._snippetLineLeadingWhitespace+u[p]);n.push(Qn.replace(l,u.join(e.getEOL())))}}n.length>0&&this._editor.executeEdits("snippet.placeholderTransform",n)}let t=!1;i===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,t=!0):i===!1&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,t=!0);let o=e.changeDecorations(n=>{let r=new Set,s=[];for(let l of this._placeholderGroups[this._placeholderGroupsIdx]){let c=this._placeholderDecorations.get(l),u=c?e.getDecorationRange(c):null;if(t=t&&this._hasPlaceholderBeenCollapsed(l),!(!c||!u)){s.push(new ei(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn)),n.changeDecorationOptions(c,l.isFinalTabstop?a._decor.activeFinal:a._decor.active),r.add(l);for(let p of this._snippet.enclosingPlaceholders(l)){let h=this._placeholderDecorations.get(p);h&&(n.changeDecorationOptions(h,p.isFinalTabstop?a._decor.activeFinal:a._decor.active),r.add(p))}}}for(let[l,c]of this._placeholderDecorations)r.has(l)||n.changeDecorationOptions(c,l.isFinalTabstop?a._decor.inactiveFinal:a._decor.inactive);return s});return t?this.move(i):o??[]}_hasPlaceholderBeenCollapsed(i){let e=this._editor.getModel(),t=i;for(;t;){if(t instanceof jk){let o=this._placeholderDecorations.get(t),n=o?e.getDecorationRange(o):null;if((!n||n.isEmpty())&&t.toString().length>0)return!0}t=t.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){let[i]=this._snippet.placeholders;if(i.isFinalTabstop&&this._snippet.rightMostDescendant===i)return!0}return!1}computePossibleSelections(){let i=new Map;for(let e of this._placeholderGroups){let t;for(let o of e){if(o.isFinalTabstop)break;t||(t=[],i.set(o.index,t));let n=this._placeholderDecorations.get(o),r=this._editor.getModel().getDecorationRange(n);if(!r){i.delete(o.index);break}t.push(r)}}return i}get activeChoice(){if(!this._placeholderDecorations)return;let i=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!i?.choice)return;let e=this._placeholderDecorations.get(i);if(!e)return;let t=this._editor.getModel().getDecorationRange(e);if(t)return{range:t,choice:i.choice}}get hasChoice(){let i=!1;return this._snippet.walk(e=>(i=e instanceof Gde,!i)),i}get activePlaceholderCount(){return this._placeholderGroupsIdx<0?0:this._placeholderGroups[this._placeholderGroupsIdx].length}merge(i){let e=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(t=>{for(let o of this._placeholderGroups[this._placeholderGroupsIdx]){let n=i.shift();console.assert(n._offset!==-1),console.assert(!n._placeholderDecorations);let r=n._snippet.placeholderInfo.last.index;for(let l of n._snippet.placeholderInfo.all)l.isFinalTabstop?l.index=o.index+(r+1)/this._nestingLevel:l.index=o.index+l.index/this._nestingLevel;this._snippet.replace(o,n._snippet.children);let s=this._placeholderDecorations.get(o);t.removeDecoration(s),this._placeholderDecorations.delete(o);for(let l of n._snippet.placeholders){let c=n._snippet.offset(l),u=n._snippet.fullLen(l),p=G.fromPositions(e.getPositionAt(n._offset+c),e.getPositionAt(n._offset+c+u)),h=t.addDecoration(p,a._decor.inactive);this._placeholderDecorations.set(l,h)}}this._renormalizePlaceholderIndices(),this._placeholderGroups=Lf(this._snippet.placeholders,jk.compareByIndex)})}_renormalizePlaceholderIndices(){let i=this._snippet.placeholders,e=new Set;for(let n of i)n.isFinalTabstop||e.add(n.index);let t=[...e].sort((n,r)=>n-r),o=new Map;for(let n=0;n<t.length;n++)o.set(t[n],n+1);for(let n of i)n.isFinalTabstop||(n.index=o.get(n.index));this._nestingLevel=1}getEnclosingRange(){let i,e=this._editor.getModel();for(let t of this._placeholderDecorations.values()){let o=e.getDecorationRange(t)??void 0;i?i=i.plusRange(o):i=o}return i}},Gio={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},Ex=class{constructor(i,e,t=Gio,o){this._editor=i;this._template=e;this._options=t;this._languageConfigurationService=o;this._templateMerges=[];this._snippets=[]}static adjustWhitespace(i,e,t,o,n){let r=i.getLineContent(e.lineNumber),s=Ul(r,0,e.column-1),l;return o.walk(c=>{if(!(c instanceof VS)||c.parent instanceof Gde||n&&!n.has(c))return!0;let u=c.value.split(/\r\n|\r|\n/);if(t){let h=o.offset(c);if(h===0)u[0]=i.normalizeIndentation(u[0]);else{l=l??o.toString();let g=l.charCodeAt(h-1);(g===10||g===13)&&(u[0]=i.normalizeIndentation(s+u[0]))}for(let g=1;g<u.length;g++)u[g]=i.normalizeIndentation(s+u[g])}let p=u.join(i.getEOL());return p!==c.value&&(c.parent.replace(c,[new VS(p)]),l=void 0),!0}),s}static adjustSelection(i,e,t,o){if(t!==0||o!==0){let{positionLineNumber:n,positionColumn:r}=e,s=r-t,l=r+o,c=i.validateRange({startLineNumber:n,startColumn:s,endLineNumber:n,endColumn:l});e=ei.createWithDirection(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn,e.getDirection())}return e}static createEditsAndSnippetsFromSelections(i,e,t,o,n,r,s,l,c){let u=[],p=[];if(!i.hasModel())return{edits:u,snippets:p};let h=i.getModel(),g=i.invokeWithinContext(x=>x.get(Ae)),f=i.invokeWithinContext(x=>new m9e(x.get(nt),h)),v=()=>s,b=h.getValueInRange(Ex.adjustSelection(h,i.getSelection(),t,0)),S=h.getValueInRange(Ex.adjustSelection(h,i.getSelection(),0,o)),y=h.getLineFirstNonWhitespaceColumn(i.getSelection().positionLineNumber),w=i.getSelections().map((x,E)=>({selection:x,idx:E})).sort((x,E)=>G.compareRangesUsingStarts(x.selection,E.selection));for(let{selection:x,idx:E}of w){let M=Ex.adjustSelection(h,x,t,0),N=Ex.adjustSelection(h,x,0,o);b!==h.getValueInRange(M)&&(M=x),S!==h.getValueInRange(N)&&(N=x);let V=x.setStartPosition(M.startLineNumber,M.startColumn).setEndPosition(N.endLineNumber,N.endColumn),H=new Og().parse(e,!0,n),K=V.getStartPosition(),j=Ex.adjustWhitespace(h,K,r||E>0&&y!==h.getLineFirstNonWhitespaceColumn(x.positionLineNumber),H);H.resolveVariables(new u9e([f,new h9e(v,E,w.length,i.getOption(88)==="spread"),new p9e(h,x,E,l),new Lue(h,x,c),new g9e,new f9e(g),new v9e])),u[E]=Qn.replace(V,H.toString()),u[E].identifier={major:E,minor:0},u[E]._isTracked=!0,p[E]=new x_t(i,H,j)}return{edits:u,snippets:p}}static createEditsAndSnippetsFromEdits(i,e,t,o,n,r,s){if(!i.hasModel()||e.length===0)return{edits:[],snippets:[]};let l=[],c=i.getModel(),u=new Og,p=new oEe,h=i.invokeWithinContext(x=>new m9e(x.get(nt),c)),g=new g9e,f=new f9e(i.invokeWithinContext(x=>x.get(Ae))),v=new v9e,b=()=>n,S=i.getOption(88)==="spread",y=e.map((x,E)=>({edit:x,idx:E})).sort((x,E)=>G.compareRangesUsingStarts(x.edit.range,E.edit.range)),w=0;for(let x=0;x<y.length;x++){let{edit:{range:E,template:M,keepWhitespace:N},idx:V}=y[x];if(x>0){let Se=y[x-1].edit.range,Re=G.fromPositions(Se.getEndPosition(),E.getStartPosition()),xe=new VS(c.getValueInRange(Re));p.appendChild(xe),w+=xe.value.length}let H=new Set;p.walk(Se=>(Se instanceof HK&&H.add(Se),!0));let K=u.parseFragment(M,p);Ex.adjustWhitespace(c,E.getStartPosition(),N!==void 0?!N:o,p,new Set(K));let j=ei.fromRange(E,0),J=new u9e([h,new h9e(b,V,y.length,S),new p9e(c,j,V,r),new Lue(c,j,s),g,f,v]);p.walk(Se=>(Se instanceof HK&&!H.has(Se)&&Se.resolve(J),!0));let se=p.toString(),ae=se.slice(w);w=se.length;let ce=Qn.replace(E,ae);ce.identifier={major:x,minor:0},ce._isTracked=!0,l.push(ce)}return u.ensureFinalTabstop(p,t,!0),{edits:l,snippets:[new x_t(i,p,"")]}}dispose(){je(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(i){if(!this._editor.hasModel())return;let{edits:e,snippets:t}=typeof this._template=="string"?Ex.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):Ex.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=t,this._editor.executeEdits(i??sd.snippet(),e,o=>{let n=o.filter(r=>!!r.identifier);for(let r=0;r<t.length;r++)t[r].initialize(n[r].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):n.map(r=>ei.fromPositions(r.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(i,e=Gio){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,i]);let{edits:t,snippets:o}=Ex.createEditsAndSnippetsFromSelections(this._editor,i,e.overwriteBefore,e.overwriteAfter,!0,e.adjustWhitespace,e.clipboardText,e.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",t,n=>{let r=n.filter(c=>!!c.identifier);for(let c=0;c<o.length;c++)o[c].initialize(r[c].textChange);let s=o[0].isTrivialSnippet,l=o.length===this._snippets.reduce((c,u)=>c+u.activePlaceholderCount,0);if(!s&&l){for(let c of this._snippets)c.merge(o);console.assert(o.length===0)}return this._snippets[0].hasPlaceholder&&!s&&l?this._move(void 0):r.map(c=>ei.fromPositions(c.range.getEndPosition()))})}next(){let i=this._move(!0);i.length>0&&(this._editor.setSelections(i),this._editor.revealPositionInCenterIfOutsideViewport(i[0].getPosition()))}prev(){let i=this._move(!1);i.length>0&&(this._editor.setSelections(i),this._editor.revealPositionInCenterIfOutsideViewport(i[0].getPosition()))}_move(i){let e=[];for(let t of this._snippets){let o=t.move(i);e.push(...o)}return e}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;let i=this._editor.getSelections();if(i.length<this._snippets.length)return!1;let e=new Map;for(let t of this._snippets){let o=t.computePossibleSelections();if(e.size===0)for(let[n,r]of o){r.sort(G.compareRangesUsingStarts);for(let s of i)if(r[0].containsRange(s)){e.set(n,[]);break}}if(e.size===0)return!1;e.forEach((n,r)=>{n.push(...o.get(r))})}i.sort(G.compareRangesUsingStarts);for(let[t,o]of e){if(o.length!==i.length){e.delete(t);continue}o.sort(G.compareRangesUsingStarts);for(let n=0;n<o.length;n++)if(!o[n].containsRange(i[n])){e.delete(t);continue}}return e.size>0}getEnclosingRange(){let i;for(let e of this._snippets){let t=e.getEnclosingRange();i?i=i.plusRange(t):i=t}return i}};Ex=I([m(3,Us)],Ex);var k_t={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},ss=class{constructor(i,e,t,o,n){this._editor=i;this._logService=e;this._languageFeaturesService=t;this._languageConfigurationService=n;this._inSnippetObservable=De(this,!1);this._snippetListener=new O;this._modelVersionId=-1;this._inSnippet=ss.InSnippetMode.bindTo(o),this._hasNextTabstop=ss.HasNextTabstop.bindTo(o),this._hasPrevTabstop=ss.HasPrevTabstop.bindTo(o),this._inSnippetChoice=ss.InSnippetChoice.bindTo(o)}static{this.ID="snippetController2"}static get(i){return i.getContribution(ss.ID)}static{this.InSnippetMode=new Y("inSnippetMode",!1,d(1580,null))}static{this.HasNextTabstop=new Y("hasNextTabstop",!1,d(1577,null))}static{this.HasPrevTabstop=new Y("hasPrevTabstop",!1,d(1578,null))}static{this.InSnippetChoice=new Y("inSnippetChoice",!1,d(1579,null))}dispose(){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._inSnippetChoice.reset(),this._session?.dispose(),this._snippetListener.dispose()}apply(i,e){try{this._doInsert(i,typeof e>"u"?k_t:{...k_t,...e})}catch(t){this.cancel(),this._logService.error(t),this._logService.error("snippet_error"),this._logService.error("insert_edits=",i),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}insert(i,e){try{this._doInsert(i,typeof e>"u"?k_t:{...k_t,...e})}catch(t){this.cancel(),this._logService.error(t),this._logService.error("snippet_error"),this._logService.error("insert_template=",i),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(i,e){if(this._editor.hasModel()){if(this._snippetListener.clear(),e.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof i!="string"&&this.cancel(),this._session?(To(typeof i=="string"),this._session.merge(i,e)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new Ex(this._editor,i,e,this._languageConfigurationService),this._session.insert(e.reason)),e.undoStopAfter&&this._editor.getModel().pushStackElement(),this._session?.hasChoice){let t={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(c,u)=>{if(!this._session||c!==this._editor.getModel()||!ye.equals(this._editor.getPosition(),u))return;let{activeChoice:p}=this._session;if(!p||p.choice.options.length===0)return;let h=c.getValueInRange(p.range),g=!!p.choice.options.find(v=>v.value===h),f=[];for(let v=0;v<p.choice.options.length;v++){let b=p.choice.options[v];f.push({kind:13,label:b.value,insertText:b.value,sortText:"a".repeat(v+1),range:p.range,filterText:g?`${h}_${b.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:d(1581,null)}})}return{suggestions:f}}},o=this._editor.getModel(),n,r=!1,s=()=>{n?.dispose(),r=!1},l=()=>{r||(n=this._languageFeaturesService.completionProvider.register({language:o.getLanguageId(),pattern:o.uri.fsPath,scheme:o.uri.scheme,exclusive:!0},t),this._snippetListener.add(n),r=!0)};this._choiceCompletions={provider:t,enable:l,disable:s}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(t=>t.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._inSnippetObservable.set(!0,void 0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0,this._inSnippetChoice.reset();return}let{activeChoice:i}=this._session;if(!i||!this._choiceCompletions){this._choiceCompletions?.disable(),this._currentChoice=void 0,this._inSnippetChoice.reset();return}this._inSnippetChoice.set(!0),this._currentChoice!==i.choice&&(this._currentChoice=i.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{g_t(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(i=!1){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._inSnippetChoice.reset(),this._snippetListener.clear(),this._currentChoice=void 0,this._session?.dispose(),this._session=void 0,this._modelVersionId=-1,i&&this._editor.setSelections([this._editor.getSelection()])}prev(){this._session?.prev(),this._updateState()}next(){this._session?.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}get isInSnippetObservable(){return this._inSnippetObservable}getSessionEnclosingRange(){if(this._session)return this._session.getEnclosingRange()}};ss=I([m(1,re),m(2,Jt),m(3,X),m(4,Us)],ss);Eo(ss.ID,ss,4);var E_t=od.bindToContribution(ss.get);ro(new E_t({id:"jumpToNextSnippetPlaceholder",precondition:C.and(ss.InSnippetMode,ss.HasNextTabstop),handler:a=>a.next(),kbOpts:{weight:130,kbExpr:me.textInputFocus,primary:2}}));ro(new E_t({id:"jumpToPrevSnippetPlaceholder",precondition:C.and(ss.InSnippetMode,ss.HasPrevTabstop),handler:a=>a.prev(),kbOpts:{weight:130,kbExpr:me.textInputFocus,primary:1026}}));xt.registerKeybindingRule({id:"jumpToPrevSnippetPlaceholder",weight:191,when:C.and(ss.InSnippetMode,ss.HasPrevTabstop,ss.InSnippetChoice,me.textInputFocus),primary:1026});ro(new E_t({id:"leaveSnippet",precondition:ss.InSnippetMode,handler:a=>a.cancel(!0),kbOpts:{weight:130,kbExpr:me.textInputFocus,primary:9,secondary:[1033]}}));ro(new E_t({id:"acceptSnippet",precondition:ss.InSnippetMode,handler:a=>a.finish()}));function Mue(a){return new jhi(a)}var jhi=class extends fCe{constructor(e){super();this._textModel=e}getOffset(e){return this._textModel.getOffsetAt(e)}getPosition(e){return this._textModel.getPositionAt(e)}};var i8o=[];function qio(){return i8o}function Qhi(a){return o8o(a).map(e=>e.getEndPosition())}function o8o(a){let i=fvt.createSortPermutation(a,Il(o=>o.range,G.compareRangesUsingStarts)),t=new lm(i.apply(a)).getNewRanges();return i.inverse().apply(t)}function $io(a,i){let e=Mue(i),t=i.getValue();return a.map(r=>e.getStringReplacement(r)).map(r=>r.removeCommonSuffixPrefix(t)).map(r=>e.getTextReplacement(r))}function jio(a,i){let e=De("result",[]),t=[];return i.add(ve(o=>{let n=a.read(o);Ki(r=>{if(n.length!==t.length){t.length=n.length;for(let s=0;s<t.length;s++)t[s]||(t[s]=De("item",n[s]));e.set([...t],r)}t.forEach((s,l)=>s.set(n[l],r))})})),e}var T_t=class{constructor(i){this._contextKeyService=i}bind(i,e){return cu(i,this._contextKeyService,e instanceof Function?e:t=>e.read(t))}};function Yhi(a,i){return new Promise(e=>{let t,o=setTimeout(()=>{t&&t.dispose(),e()},a);i&&(t=i.onCancellationRequested(()=>{clearTimeout(o),t&&t.dispose(),e()}))})}var b9e=class a{constructor(i,e=void 0){this.error=i;this.message=e}static message(i){return new a(void 0,i)}static is(i){return i instanceof a}logError(){this.message?console.error(`ErrorResult: ${this.message}`,this.error):console.error("ErrorResult: An unexpected error-case occurred, usually caused by invalid input.",this.error)}};var S9e=class a{constructor(i,e,t,o,n=Qio){this.startValue=i;this.endValue=e;this.durationMs=t;this.startTimeMs=o;this._interpolationFunction=n;i===e&&(this.durationMs=0)}static const(i){return new a(i,i,0,Date.now())}static startNow(i,e,t,o=Qio){return new a(i,e,t,Date.now(),o)}isFinished(i){return i>=this.startTimeMs+this.durationMs}getValue(i){let e=i-this.startTimeMs;return e>=this.durationMs?this.endValue:this._interpolationFunction(e,this.startValue,this.endValue-this.startValue,this.durationMs)}};function Qio(a,i,e,t){return a===t?i+e:e*(-Math.pow(2,-10*a/t)+1)+i}function Yio(a,i,e,t){return e*((a=a/t-1)*a*a+1)+i}var __t=class a{constructor(i){this._value=i}static const(i){return new a(S9e.const(i))}getValue(i){let e=Date.now();return this._value.isFinished(e)||rTe.instance.invalidateOnNextAnimationFrame(i),this._value.getValue(e)}isFinished(i){let e=Date.now(),t=this._value.isFinished(e);return t||rTe.instance.invalidateOnNextAnimationFrame(i),t}},rTe=class a{constructor(){this._counter=zc(this);this._isScheduled=!1}static{this.instance=new a}invalidateOnNextAnimationFrame(i){this._counter.read(i),this._isScheduled||(this._isScheduled=!0,zi().requestAnimationFrame(()=>{this._isScheduled=!1,this._update()}))}_update(){this._counter.trigger(void 0)}};var h2=class{constructor(i,e){this.lineNumber=i;this.parts=e;Wh(()=>Nw(e,(t,o)=>t.column<=o.column))}equals(i){return this.lineNumber===i.lineNumber&&this.parts.length===i.parts.length&&this.parts.every((e,t)=>e.equals(i.parts[t]))}render(i,e=!1){return new lm([...this.parts.map(t=>new ys(G.fromPositions(new ye(this.lineNumber,t.column)),e?`[${t.lines.map(o=>o.line).join(`
`)}]`:t.lines.map(o=>o.line).join(`
`)))]).applyToString(i)}renderForScreenReader(i){if(this.parts.length===0)return"";let e=this.parts[this.parts.length-1],t=i.substr(0,e.column-1);return new lm([...this.parts.map(n=>new ys(G.fromPositions(new ye(1,n.column)),n.lines.map(r=>r.line).join(`
`)))]).applyToString(t).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(i=>i.lines.length===0)}get lineCount(){return 1+this.parts.reduce((i,e)=>i+e.lines.length-1,0)}},AJ=class{constructor(i,e,t,o=[]){this.column=i;this.text=e;this.preview=t;this._inlineDecorations=o;this.lines=Hc(this.text).map((n,r)=>({line:n,lineDecorations:Wb.filter(this._inlineDecorations,r+1,1,n.length+1)}))}equals(i){return this.column===i.column&&this.lines.length===i.lines.length&&this.lines.every((e,t)=>e.line===i.lines[t].line&&Wb.equalsArr(e.lineDecorations,i.lines[t].lineDecorations))}},sTe=class{constructor(i,e,t,o=0){this.lineNumber=i;this.columnRange=e;this.text=t;this.additionalReservedLineCount=o;this.parts=[new AJ(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=Hc(this.text)}renderForScreenReader(i){return this.newLines.join(`
`)}render(i,e=!1){let t=this.columnRange.toRange(this.lineNumber);return e?new lm([new ys(G.fromPositions(t.getStartPosition()),"("),new ys(G.fromPositions(t.getEndPosition()),`)[${this.newLines.join(`
`)}]`)]).applyToString(i):new lm([new ys(t,this.newLines.join(`
`))]).applyToString(i)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(i=>i.lines.length===0)}equals(i){return this.lineNumber===i.lineNumber&&this.columnRange.equals(i.columnRange)&&this.newLines.length===i.newLines.length&&this.newLines.every((e,t)=>e===i.newLines[t])&&this.additionalReservedLineCount===i.additionalReservedLineCount}};function Xhi(a,i){return eo(a,i,Jhi)}function Jhi(a,i){return a===i?!0:!a||!i?!1:a instanceof h2&&i instanceof h2||a instanceof sTe&&i instanceof sTe?a.equals(i):!1}function UA(a,i,e){let t=e?a.range.intersectRanges(e):a.range;if(!t)return a;let o=a.text.replaceAll(`\r
`,`
`),n=i.getValueInRange(t,1),r=Af(n,o),s=Rc.ofText(n.substring(0,r)).addToPosition(a.range.getStartPosition()),l=o.substring(r),c=G.fromPositions(s,a.range.getEndPosition());return new ys(c,l)}function D_t(a,i){return a.text.startsWith(i.text)&&n8o(a.range,i.range)}function n8o(a,i){return i.getStartPosition().equals(a.getStartPosition())&&i.getEndPosition().isBeforeOrEqual(a.getEndPosition())}function Zhi(a,i,e,t,o=0){let n=UA(a,i);if(n.range.endLineNumber!==n.range.startLineNumber)return;let r=i.getLineContent(n.range.startLineNumber),s=Ul(r).length;if(n.range.startColumn-1<=s){let f=Ul(n.text).length,v=r.substring(n.range.startColumn-1,s),[b,S]=[n.range.getStartPosition(),n.range.getEndPosition()],y=b.column+v.length<=S.column?b.delta(0,v.length):S,w=G.fromPositions(y,S),x=n.text.startsWith(v)?n.text.substring(v.length):n.text.substring(f);n=new ys(w,x)}let c=i.getValueInRange(n.range),u=r8o(c,n.text);if(!u)return;let p=n.range.startLineNumber,h=new Array;if(e==="prefix"){let f=u.filter(v=>v.originalLength===0);if(f.length>1||f.length===1&&f[0].originalStart!==c.length)return}let g=n.text.length-o;for(let f of u){let v=n.range.startColumn+f.originalStart+f.originalLength;if(e==="subwordSmart"&&t&&t.lineNumber===n.range.startLineNumber&&v<t.column||f.originalLength>0)return;if(f.modifiedLength===0)continue;let b=f.modifiedStart+f.modifiedLength,S=Math.max(f.modifiedStart,Math.min(b,g)),y=n.text.substring(f.modifiedStart,S),w=n.text.substring(S,Math.max(f.modifiedStart,b));y.length>0&&h.push(new AJ(v,y,!1)),w.length>0&&h.push(new AJ(v,w,!0))}return new h2(p,h)}var R_t;function r8o(a,i){if(R_t?.originalValue===a&&R_t?.newValue===i)return R_t?.changes;{let e=Jio(a,i,!0);if(e){let t=Xio(e);if(t>0){let o=Jio(a,i,!1);o&&Xio(o)<t&&(e=o)}}return R_t={originalValue:a,newValue:i,changes:e},e}}function Xio(a){let i=0;for(let e of a)i+=e.originalLength;return i}function Jio(a,i,e){if(a.length>5e3||i.length>5e3)return;function t(c){let u=0;for(let p=0,h=c.length;p<h;p++){let g=c.charCodeAt(p);g>u&&(u=g)}return u}let o=Math.max(t(a),t(i));function n(c){if(c<0)throw new Error("unexpected");return o+c+1}function r(c){let u=0,p=0,h=new Int32Array(c.length);for(let g=0,f=c.length;g<f;g++)if(e&&c[g]==="("){let v=p*100+u;h[g]=n(2*v),u++}else if(e&&c[g]===")"){u=Math.max(u-1,0);let v=p*100+u;h[g]=n(2*v+1),u===0&&p++}else h[g]=c.charCodeAt(g);return h}let s=r(a),l=r(i);return new kA({getElements:()=>s},{getElements:()=>l}).ComputeDiff(!1).changes}function Zio(a,i){let e,t=!1,o=new kwe(new yp(a,void 0,i.update),(n,r)=>{t||(e=i.initial instanceof Function?i.initial():i.initial,t=!0);let s=i.update(n,e,r);return e=s,s},i.changeTracker,()=>{t&&(i.disposeFinal?.(e),t=!1)},i.equalityComparer??pv,(n,r,s)=>{if(!t)throw new ci("Can only set when there is a listener! This is to prevent leaks.");aF(r,l=>{e=n,o.setValue(n,l,s)})},Dl.ofCaller());return o}var egi=class{constructor(i,e){this._baseService=i;this._intercept=e}get telemetryLevel(){return this._baseService.telemetryLevel}get sessionId(){return this._baseService.sessionId}get machineId(){return this._baseService.machineId}get sqmId(){return this._baseService.sqmId}get devDeviceId(){return this._baseService.devDeviceId}get firstSessionDate(){return this._baseService.firstSessionDate}get msftInternal(){return this._baseService.msftInternal}get sendErrorTelemetry(){return this._baseService.sendErrorTelemetry}publicLog(i,e){this._intercept(i,e),this._baseService.publicLog(i,e)}publicLog2(i,e){this._intercept(i,e),this._baseService.publicLog2(i,e)}publicLogError(i,e){this._intercept(i,e),this._baseService.publicLogError(i,e)}publicLogError2(i,e){this._intercept(i,e),this._baseService.publicLogError2(i,e)}setExperimentProperty(i,e){this._baseService.setExperimentProperty(i,e)}setCommonProperty(i,e){this._baseService.setCommonProperty(i,e)}},g0=class extends egi{constructor(i,e){super(i,(t,o)=>{let n=!0;o&&tgi in o&&(n=!!o[tgi]),n&&e.getDataChannel("editTelemetry").sendData({eventName:t,data:o??{}})})}};g0=I([m(0,_e),m(1,MJ)],g0);var tgi=Symbol("shouldForwardToChannel");function aH(a){return{[tgi]:a}}function f0(a){if(!a)return!1;let i=a.toLowerCase();return i==="github.copilot"||i==="github.copilot-chat"}function L_t(a,i){a.publicLog2("inlineCompletion.endOfLife",i)}var s8o=new Set([";",",","=","+","-","*","/","{","}","(",")","[","]","<",">",":",".","!","?","&","|","^","%","@","#","~","`","\\","'",'"',"$"]);function a8o(a){return s8o.has(a)}function l8o(a){return/[a-zA-Z0-9_]/.test(a)}function c8o(a){return a===" "||a==="	"}function M_t(a){let i=a.split(/\r\n|\r|\n/);if(i.length>1)return{kind:"multiLine",lineCount:i.length};let e=a.length===1,t;e&&(a8o(a)?t="syntactical":l8o(a)?t="identifier":c8o(a)&&(t="whitespace"));let o=a.match(/[ \t]+/g)||[],n=o.some(u=>u.length>1),r=o.some(u=>u.includes("  ")||u.includes("		")),s=a.split(/\s+/).filter(u=>u.length>0),l=s.length===1&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s[0]),c=s.length>1;return{kind:"singleLine",isSingleCharacter:e,singleCharacterKind:t,isWord:l,isMultipleWords:c,isMultipleWhitespace:n,hasDuplicatedWhitespace:r}}var ogi=class{constructor(i){this.edits=i}toString(){return JSON.stringify({edits:this.edits})}};function ngi(a,i,e){if(a.replacements.length!==0)return new ogi(a.replacements.map(t=>d8o(t,i,e)))}function igi(a){return a.length===0?0:a.split(/\r\n|\r|\n/).length-1}function d8o(a,i,e){let t=a.replaceRange,o=a.newText,n=t.length,r=o.length,s=igi(o);switch(t.isEmpty?"insert":o.length===0?"delete":"replace"){case"insert":return{operation:"insert",properties:u8o(t.start,o,i,e),charactersInserted:r,charactersDeleted:0,linesInserted:s,linesDeleted:0};case"delete":{let c=i.getValue().substring(t.start,t.endExclusive);return{operation:"delete",properties:p8o(t.start,t.endExclusive,i),charactersInserted:0,charactersDeleted:n,linesInserted:0,linesDeleted:igi(c)}}case"replace":{let c=i.getValue().substring(t.start,t.endExclusive);return{operation:"replace",properties:m8o(c,o),charactersInserted:r,charactersDeleted:n,linesInserted:s,linesDeleted:igi(c)}}}}function u8o(a,i,e,t){let o=M_t(i),n=e.getPositionAt(a),r=e.getLineContent(n.lineNumber),s=r.length,l,c=r.trim().length===0,u=n.column>s,p=n.column===1;c?l="emptyLine":u?l="endOfLine":p?l="startOfLine":l="middleOfLine";let h;if(t){let g=t.lineNumber,f=n.lineNumber,v=t.column,b=n.column,S=g===f&&v===b,y=g===f&&b<v,w=g===f&&b>v,x=f<g?g-f:void 0,E=f>g?f-g:void 0;h={atCursor:S,beforeCursorOnSameLine:y,afterCursorOnSameLine:w,linesAbove:x,linesBelow:E}}return{textShape:o,locationShape:l,relativeToCursor:h}}function p8o(a,i,e){let t=e.getValue().substring(a,i),o=M_t(t),n=e.getPositionAt(a),r=e.getPositionAt(i),s=e.getLineContent(r.lineNumber),l=r.column>s.length,c=n.lineNumber===r.lineNumber&&n.column===1&&r.column>s.length;return{textShape:o,isAtEndOfLine:l,deletesEntireLineContent:c}}function m8o(a,i){let e=M_t(a),t=M_t(i),o=e.kind==="singleLine"&&e.isWord,n=t.kind==="singleLine"&&t.isWord,r=o&&n,s=i.length>a.length,l=i.length<a.length,c=e.kind==="singleLine"&&t.kind==="singleLine",u=e.kind==="singleLine"&&t.kind==="multiLine",p=e.kind==="multiLine"&&t.kind==="singleLine";return{isWordToWordReplacement:r,isAdditive:s,isSubtractive:l,isSingleLineToSingleLine:c,isSingleLineToMultiLine:u,isMultiLineToSingleLine:p}}function P_t(a,i,e,t){let o=UA(a,e),n=a.range;if(!n||i&&!i.getStartPosition().equals(n.getStartPosition())||t.lineNumber!==o.range.startLineNumber||o.isEmpty)return!1;let r=e.getValueInRange(o.range,1),s=o.text,l=Math.max(0,t.column-o.range.startColumn),c=s.substring(0,l),u=s.substring(l),p=r.substring(0,l),h=r.substring(l),g=e.getLineIndentColumn(o.range.startLineNumber);return o.range.startColumn<=g&&(p=p.trimStart(),p.length===0&&(h=h.trimStart()),c=c.trimStart(),c.length===0&&(u=u.trimStart())),c.startsWith(p)&&!!U8e(h,u)}function eoo(a,i){let e=new qxe,t=new jxe(e,c=>i.getLanguageConfiguration(c)),o=new $xe(new rgi([a]),t),n=b8e(o,[],void 0,!0),r="",s=a.getLineContent();function l(c,u){if(c.kind===2)if(l(c.openingBracket,u),u=_u(u,c.openingBracket.length),c.child&&(l(c.child,u),u=_u(u,c.child.length)),c.closingBracket)l(c.closingBracket,u),u=_u(u,c.closingBracket.length);else{let h=t.getSingleLanguageBracketTokens(c.openingBracket.languageId).findClosingTokenText(c.openingBracket.bracketIds);r+=h}else if(c.kind!==3){if(c.kind===0||c.kind===1)r+=s.substring(u,_u(u,c.length));else if(c.kind===4)for(let p of c.children)l(p,u),u=_u(u,p.length)}}return l(n,Ub),r}var rgi=class{constructor(i){this.lines=i;this.tokenization={getLineTokens:i=>this.lines[i-1]}}getValue(){return this.lines.map(i=>i.getLineContent()).join(`
`)}getLineCount(){return this.lines.length}getLineLength(i){return this.lines[i-1].getLineContent().length}};var A_t=class a{constructor(){this._nodes=new Set;this._outgoingEdges=new Map}static from(i,e){let t=new a;for(let o of i)t._nodes.add(o);for(let o of i){let n=e(o);if(n.length>0){let r=new Set;for(let s of n)r.add(s);t._outgoingEdges.set(o,r)}}return t}removeCycles(){let i=[],e=new Set,t=new Set,o=[],n=r=>{e.add(r),t.add(r);let s=this._outgoingEdges.get(r);if(s)for(let l of s)e.has(l)?t.has(l)&&(i.push(l),o.push({from:r,to:l})):n(l);t.delete(r)};for(let r of this._nodes)e.has(r)||n(r);for(let{from:r,to:s}of o){let l=this._outgoingEdges.get(r);l&&l.delete(s)}return{foundCycles:i}}getOutgoing(i){let e=this._outgoingEdges.get(i);return e?Array.from(e):[]}};var bM=class a{constructor(i,e=!1){this.event=i;this.alternativeAction=e}static create(i,e=!1){return new a(new Ln(Me(i),i),e)}};var Pue=class{constructor(i,e,t,o,n,r,s,l){this.cursorColumnDistance=i;this.cursorLineDistance=e;this.lineCountOriginal=t;this.lineCountModified=o;this.characterCountOriginal=n;this.characterCountModified=r;this.disjointReplacements=s;this.sameShapeReplacements=l;this.longDistanceHintVisible=void 0;this.longDistanceHintDistance=void 0}setLongDistanceViewData(i,e){this.longDistanceHintVisible=!0,this.longDistanceHintDistance=Math.abs(e-i)}getData(){return{cursorColumnDistance:this.cursorColumnDistance,cursorLineDistance:this.cursorLineDistance,lineCountOriginal:this.lineCountOriginal,lineCountModified:this.lineCountModified,characterCountOriginal:this.characterCountOriginal,characterCountModified:this.characterCountModified,disjointReplacements:this.disjointReplacements,sameShapeReplacements:this.sameShapeReplacements,longDistanceHintVisible:this.longDistanceHintVisible,longDistanceHintDistance:this.longDistanceHintDistance}}};function ooo(a,i,e,t,o,n){let r=Ayt("icr"),s=new qe,l,c={...t,requestUuid:r},u=g8o(i,e),p=W4i(a,S=>S.groupId),h=A_t.from(a,S=>S.yieldsToGroupIds?.flatMap(y=>p.get(y)??[])??[]),{foundCycles:g}=h.removeCycles();g.length>0&&vs(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${g.map(S=>S.toString?S.toString():""+S).join(" -> ")}`));let f=0,v=new xy(async S=>{try{if(f++,s.token.isCancellationRequested)return;let y=h.getOutgoing(S);for(let V of y){let H=await v.get(V);if(H)for(let K of H.inlineSuggestions.items){if(K.isInlineEdit||typeof K.insertText!="string"&&K.insertText!==void 0)return;if(K.insertText!==void 0){let j=new ys(G.lift(K.range)??u,K.insertText);if(P_t(j,void 0,e,i))return}}}let w,x=Date.now();try{w=await S.provideInlineCompletions(e,i,c,s.token)}catch(V){vs(V);return}let E=Date.now();if(!w)return;let M=[],N=new N_t(w,M,S);if(N.addRef(),agi(s.token,()=>N.removeRef(l)),s.token.isCancellationRequested)return;for(let V of w.items){let H=h8o(V,N,u,e,n,c,o,{startTime:x,endTime:E});if(b9e.is(H)){H.logError();continue}M.push(H)}return N}finally{f--}}),b=Fp.fromPromisesResolveOrder(a.map(S=>v.get(S))).filter(so);return{contextWithUuid:c,get didAllProvidersReturn(){return f===0},lists:b,cancelAndDispose:S=>{l===void 0&&(l=S,s.dispose(!0))}}}function agi(a,i){if(a.isCancellationRequested)return i(),k.None;{let e=a.onCancellationRequested(()=>{e.dispose(),i()});return{dispose:()=>e.dispose()}}}function h8o(a,i,e,t,o,n,r,s){let l,c=a.uri?A.revive(a.uri):void 0;if(a.jumpToPosition!==void 0)l={kind:"jumpTo",position:ye.lift(a.jumpToPosition),uri:c};else if(a.insertText!==void 0){let u,p,h=a.range?G.lift(a.range):e;if(typeof a.insertText=="string"){if(u=a.insertText,o&&a.completeBracketPairs){u=too(u,h.getStartPosition(),t,o);let g=u.length-a.insertText.length;g!==0&&(h=new G(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+g))}p=void 0}else if("snippet"in a.insertText){let g=a.insertText.snippet.length;if(o&&a.completeBracketPairs){a.insertText.snippet=too(a.insertText.snippet,h.getStartPosition(),t,o);let v=a.insertText.snippet.length-g;v!==0&&(h=new G(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+v))}let f=new Og().parse(a.insertText.snippet);f.children.length===1&&f.children[0]instanceof VS?(u=f.children[0].value,p=void 0):(u=f.toString(),p={snippet:a.insertText.snippet,range:h})}else bs(a.insertText);l={kind:"edit",range:h,insertText:u,snippetInfo:p,uri:c,alternativeAction:void 0}}else if(l=void 0,!a.hint)return b9e.message("Inline completion has no insertText, jumpToPosition nor hint.");return new I9e(l,a.hint,a.additionalTextEdits||qio(),a,i,n,a.isInlineEdit??!1,a.supportsRename??!1,r,s,a.correlationId)}var I9e=class a{constructor(i,e,t,o,n,r,s,l,c,u,p){this._action=i;this.hint=e;this.additionalTextEdits=t;this.sourceInlineCompletion=o;this.source=n;this.context=r;this.isInlineEdit=s;this.supportsRename=l;this._requestInfo=c;this._providerRequestInfo=u;this._correlationId=p;this._didShow=!1;this._timeUntilShown=void 0;this._timeUntilActuallyShown=void 0;this._showStartTime=void 0;this._shownDuration=0;this._showUncollapsedStartTime=void 0;this._showUncollapsedDuration=0;this._notShownReason=void 0;this._didReportEndOfLife=!1;this._lastSetEndOfLifeReason=void 0;this._isPreceeded=!1;this._partiallyAcceptedCount=0;this._partiallyAcceptedSinceOriginal={characters:0,ratio:0,count:0};this._renameInfo=void 0;this._editKind=void 0;this.performance=new sgi;this._viewData={editorType:c.editorType}}static createForTest(i,e){let t={insertText:i?.kind==="edit"?i.insertText:"",range:i?.kind==="edit"?i.range:void 0,isInlineEdit:!0},o={provideInlineCompletions:()=>({items:[]}),disposeInlineCompletions:()=>{}},n=new N_t({items:[t]},[],o),r={triggerKind:1,selectedSuggestionInfo:void 0,requestUuid:"test-"+Date.now(),earliestShownDateTime:0,includeInlineCompletions:!0,includeInlineEdits:!1,requestIssuedDateTime:Date.now()},s={startTime:Date.now(),sku:void 0,editorType:"textEditor",languageId:"plaintext",availableProviders:[],reason:"",typingInterval:0,typingIntervalCharacterCount:0},l={startTime:Date.now(),endTime:Date.now()};return new a(i,void 0,[],t,n,r,!0,!1,s,l,void 0)}get action(){return this._action}get showInlineEditMenu(){return this.sourceInlineCompletion.showInlineEditMenu??!1}get partialAccepts(){return this._partiallyAcceptedSinceOriginal}async reportInlineEditShown(i,e,t,o,n,r){if(this.updateShownDuration(t),this._didShow||this._didReportEndOfLife)return;this.addPerformanceMarker("shown"),this._didShow=!0,this._editKind=n,this._viewData.viewKind=t,this._viewData.renderData=o,this._timeUntilShown=r-this._requestInfo.startTime,this._timeUntilActuallyShown=Date.now()-this._requestInfo.startTime;let s=new Uy(o.lineCountModified,o.lineCountOriginal,o.characterCountModified,o.characterCountOriginal);this.source.provider.handleItemDidShow?.(this.source.inlineSuggestions,this.sourceInlineCompletion,e,s),this.sourceInlineCompletion.shownCommand&&await i.executeCommand(this.sourceInlineCompletion.shownCommand.id,...this.sourceInlineCompletion.shownCommand.arguments||[])}reportPartialAccept(i,e,t){this._partiallyAcceptedCount++,this._partiallyAcceptedSinceOriginal.characters+=t.characters,this._partiallyAcceptedSinceOriginal.ratio=Math.min(this._partiallyAcceptedSinceOriginal.ratio+(1-this._partiallyAcceptedSinceOriginal.ratio)*t.ratio,1),this._partiallyAcceptedSinceOriginal.count+=t.count,this.source.provider.handlePartialAccept?.(this.source.inlineSuggestions,this.sourceInlineCompletion,i,e)}reportEndOfLife(i){if(!this._didReportEndOfLife&&(this._didReportEndOfLife=!0,this.reportInlineEditHidden(),i||(i=this._lastSetEndOfLifeReason??{kind:2,userTypingDisagreed:!1,supersededBy:void 0}),i.kind===1&&!this._didShow&&(i={kind:2,userTypingDisagreed:!1,supersededBy:void 0}),i.kind===1&&this.source.provider.handleRejection&&this.source.provider.handleRejection(this.source.inlineSuggestions,this.sourceInlineCompletion),this.source.provider.handleEndOfLifetime)){let e={requestUuid:this.context.requestUuid,correlationId:this._correlationId,selectedSuggestionInfo:!!this.context.selectedSuggestionInfo,partiallyAccepted:this._partiallyAcceptedCount,partiallyAcceptedCountSinceOriginal:this._partiallyAcceptedSinceOriginal.count,partiallyAcceptedRatioSinceOriginal:this._partiallyAcceptedSinceOriginal.ratio,partiallyAcceptedCharactersSinceOriginal:this._partiallyAcceptedSinceOriginal.characters,shown:this._didShow,shownDuration:this._shownDuration,shownDurationUncollapsed:this._showUncollapsedDuration,editKind:this._editKind?.toString(),preceeded:this._isPreceeded,timeUntilShown:this._timeUntilShown,timeUntilActuallyShown:this._timeUntilActuallyShown,timeUntilProviderRequest:this._providerRequestInfo.startTime-this._requestInfo.startTime,timeUntilProviderResponse:this._providerRequestInfo.endTime-this._requestInfo.startTime,editorType:this._viewData.editorType,languageId:this._requestInfo.languageId,requestReason:this._requestInfo.reason,viewKind:this._viewData.viewKind,notShownReason:this._notShownReason,performanceMarkers:this.performance.toString(),renameCreated:this._renameInfo?.createdRename,renameDuration:this._renameInfo?.duration,renameTimedOut:this._renameInfo?.timedOut,renameDroppedOtherEdits:this._renameInfo?.droppedOtherEdits,renameDroppedRenameEdits:this._renameInfo?.droppedRenameEdits,typingInterval:this._requestInfo.typingInterval,typingIntervalCharacterCount:this._requestInfo.typingIntervalCharacterCount,skuPlan:this._requestInfo.sku?.plan,skuType:this._requestInfo.sku?.type,availableProviders:this._requestInfo.availableProviders.map(t=>t.toString()).join(","),...this._viewData.renderData?.getData()};this.source.provider.handleEndOfLifetime(this.source.inlineSuggestions,this.sourceInlineCompletion,i,e)}}setIsPreceeded(i){this._isPreceeded=!0,(this._partiallyAcceptedSinceOriginal.characters!==0||this._partiallyAcceptedSinceOriginal.ratio!==0||this._partiallyAcceptedSinceOriginal.count!==0)&&console.warn("Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded."),this._partiallyAcceptedSinceOriginal=i}setNotShownReason(i){this._notShownReason??=i}setEndOfLifeReason(i){this.reportInlineEditHidden(),this._lastSetEndOfLifeReason=i}updateShownDuration(i){let e=Date.now();this._showStartTime||(this._showStartTime=e);let t=i==="collapsed";!t&&this._showUncollapsedStartTime===void 0&&(this._showUncollapsedStartTime=e),t&&this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=e-this._showUncollapsedStartTime)}reportInlineEditHidden(){if(this._showStartTime===void 0)return;let i=Date.now();this._shownDuration+=i-this._showStartTime,this._showStartTime=void 0,this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=i-this._showUncollapsedStartTime,this._showUncollapsedStartTime=void 0)}setRenameProcessingInfo(i){if(this._renameInfo)throw new ci("Rename info has already been set.");this._renameInfo=i}withAction(i){return this._action=i,this}addPerformanceMarker(i){this.performance.mark(i)}},sgi=class{constructor(){this.markers=[];this.markers.push({name:"start",timeStamp:Date.now()})}mark(i){this.markers.push({name:i,timeStamp:Date.now()})}toString(){let i=[];for(let e=1;e<this.markers.length;e++){let t=this.markers[e].timeStamp-this.markers[e-1].timeStamp;i.push({[this.markers[e].name]:t})}return JSON.stringify(i)}};var N_t=class{constructor(i,e,t){this.inlineSuggestions=i;this.inlineSuggestionsData=e;this.provider=t;this.refCount=0}addRef(){this.refCount++}removeRef(i={kind:"other"}){if(this.refCount--,this.refCount===0){for(let e of this.inlineSuggestionsData)e.reportEndOfLife();this.provider.disposeInlineCompletions(this.inlineSuggestions,i)}}};function g8o(a,i){let e=i.getWordAtPosition(a),t=i.getLineMaxColumn(a.lineNumber);return e?new G(a.lineNumber,e.startColumn,a.lineNumber,t):G.fromPositions(a,a.with(void 0,t))}function too(a,i,e,t){let o=e.getLineContent(i.lineNumber),n=xd.replace(new gi(i.column-1,o.length),a),s=e.tokenization.tokenizeLinesAt(i.lineNumber,[n.replace(o)])?.[0].sliceZeroCopy(n.getRangeAfterReplace());return s?eoo(s,t):a}var lgi;(i=>{function a(e){return e?.command.id??void 0}i.toString=a})(lgi||={});var g2=class a extends qY{constructor(e){super();this._textModel=e;this._version=e.getVersionId()}static snapshot(e){return new a(e)}get uri(){return this._textModel.uri}get version(){return this._version}_assertValid(){this._textModel.getVersionId()!==this._version&&mt(new Error(`TextModel has changed: expected version ${this._version}, got ${this._textModel.getVersionId()}`))}targets(e){return this._textModel.uri.toString()===e.uri.toString()}getValueOfRange(e){return this._assertValid(),this._textModel.getValueInRange(e)}getLineLength(e){return this._assertValid(),this._textModel.getLineLength(e)}get length(){this._assertValid();let e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new Rc(e-1,t)}getEOL(){return this._assertValid(),this._textModel.getEOL()}getPositionAt(e){return this._assertValid(),this._textModel.getPositionAt(e)}getValueInRange(e){return this._assertValid(),this._textModel.getValueInRange(e)}getVersionId(){return this._version}dangerouslyGetUnderlyingModel(){return this._textModel}};var y9e;(i=>{function a(e,t,o=!0){return!e.isInlineEdit&&!e.action?.uri&&e.action?.kind==="edit"?cgi.create(e,t,e.action):dgi.create(e,t,o)}i.create=a})(y9e||={});function f8o(a){let i=a?.kind==="edit"?{...a,alternativeAction:lgi.toString(a.alternativeAction),target:a?.target.uri.toString()}:{...a,target:a?.target.uri.toString()};return JSON.stringify(i)}var F_t=class{constructor(i,e,t,o){this._data=i;this.identity=e;this.hint=t;this.originalTextRef=o}get source(){return this._data.source}get isFromExplicitRequest(){return this._data.context.triggerKind===1}get forwardStable(){return this.source.inlineSuggestions.enableForwardStability??!1}get targetRange(){if(this.hint)return this.hint.range;if(this.action?.kind==="edit")return this.action.textReplacement.range;if(this.action?.kind==="jumpTo")return G.fromPositions(this.action.position);throw new ci("InlineSuggestionItem: Either hint or action must be set")}get semanticId(){return this.hash}get gutterMenuLinkAction(){return this._sourceInlineCompletion.gutterMenuLinkAction}get command(){return this._sourceInlineCompletion.command}get supportsRename(){return this._data.supportsRename}get warning(){return this._sourceInlineCompletion.warning}get showInlineEditMenu(){return!!this._sourceInlineCompletion.showInlineEditMenu}get hash(){return f8o(this.action)}get shownCommand(){return this._sourceInlineCompletion.shownCommand}get requestUuid(){return this._data.context.requestUuid}get partialAccepts(){return this._data.partialAccepts}get _sourceInlineCompletion(){return this._data.sourceInlineCompletion}addRef(){this.identity.addRef(),this.source.addRef()}removeRef(){this.identity.removeRef(),this.source.removeRef()}reportInlineEditShown(i,e,t,o,n){let r=this.action?.kind==="edit"?this.action.textReplacement.text:"";this._data.reportInlineEditShown(i,r,e,t,this.computeEditKind(o),n)}reportPartialAccept(i,e,t){this._data.reportPartialAccept(i,e,t)}reportEndOfLife(i){this._data.reportEndOfLife(i)}setEndOfLifeReason(i){this._data.setEndOfLifeReason(i)}setIsPreceeded(i){this._data.setIsPreceeded(i.partialAccepts)}setNotShownReasonIfNotSet(i){this._data.setNotShownReason(i)}getSourceCompletion(){return this._sourceInlineCompletion}setRenameProcessingInfo(i){this._data.setRenameProcessingInfo(i)}withAction(i){return this._data.withAction(i)}addPerformanceMarker(i){this._data.addPerformanceMarker(i)}},W_t=class a{constructor(){this._onDispose=zc(this);this.onDispose=this._onDispose;this._jumpedTo=De(this,!1);this._refCount=0;this.id="InlineCompletionIdentity"+a.idCounter++}static{this.idCounter=0}get jumpedTo(){return this._jumpedTo}addRef(){this._refCount++}removeRef(){this._refCount--,this._refCount===0&&this._onDispose.trigger(void 0)}setJumpTo(i){this._jumpedTo.set(!0,i)}},V_t=class a{constructor(i,e,t){this.range=i;this.content=e;this.style=t}static create(i){return new a(G.lift(i.range),i.content,i.style)}withEdit(i,e){let t=new gi(e.getOffset(this.range.getStartPosition()),e.getOffset(this.range.getEndPosition())),o=zri([t],i)[0];if(!o)return;let n=e.getRange(o);return new a(n,this.content,this.style)}},cgi=class a extends F_t{constructor(e,t,o,n,r,s,l,c,u,p){super(l,c,u,p);this._edit=e;this._trimmedEdit=t;this._textEdit=o;this._originalRange=n;this.snippetInfo=r;this.additionalTextEdits=s;this.isInlineEdit=!1}static create(e,t,o){let n=new W_t,r=t.getTransformer(),s=o.insertText.replace(/\r\n|\r|\n/g,t.getEOL()),l=S8o(new xd(r.getOffsetRange(o.range),s),t),c=l.removeCommonSuffixAndPrefix(t.getValue()),u=r.getTextReplacement(l),p=e.hint?V_t.create(e.hint):void 0;return new a(l,c,u,u.range,o.snippetInfo,e.additionalTextEdits,e,n,p,t)}get action(){return{kind:"edit",textReplacement:this.getSingleTextEdit(),snippetInfo:this.snippetInfo,stringEdit:new Ad([this._trimmedEdit]),alternativeAction:void 0,target:this.originalTextRef}}get hash(){return JSON.stringify(this._trimmedEdit.toJson())}getSingleTextEdit(){return this._textEdit}withIdentity(e){return new a(this._edit,this._trimmedEdit,this._textEdit,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,e,this.hint,this.originalTextRef)}withEdit(e,t){if(!this.originalTextRef.targets(t))return this;let o=zri([this._edit.replaceRange],e);if(o.length===0)return;let n=new xd(o[0],this._textEdit.text),r=Mue(t),s=r.getTextReplacement(n),l=this.hint;if(l&&(l=l.withEdit(e,r),!l))return;let c=n.removeCommonSuffixAndPrefix(t.getValue());return new a(n,c,s,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,this.identity,l,this.originalTextRef)}canBeReused(e,t){let o=this._textEdit.range;return!!o&&o.containsPosition(t)&&this.isVisible(e,t)&&Rc.ofRange(o).isGreaterThanOrEqualTo(Rc.ofRange(this._originalRange))}isVisible(e,t){let o=this.getSingleTextEdit();return P_t(o,this._originalRange,e,t)}computeEditKind(e){return ngi(new Ad([this._edit]),e)}get editRange(){return this.getSingleTextEdit().range}get insertText(){return this.getSingleTextEdit().text}},dgi=class a extends F_t{constructor(e,t,o,n,r,s=!1,l,c){super(t,o,r,c);this._action=e;this._edits=n;this._lastChangePartOfInlineEdit=s;this._inlineEditModelVersion=l;this.snippetInfo=void 0;this.additionalTextEdits=[];this.isInlineEdit=!0}static createForTest(e,t,o){let n={kind:"edit",snippetInfo:void 0,insertText:o,range:t,uri:e.uri,alternativeAction:void 0};return a.create(I9e.createForTest(n,e.uri),e)}static create(e,t,o=!0){let n,r=[];if(e.action?.kind==="edit"){let c=o?v8o(t,e.action.range,e.action.insertText):b8o(t,e.action.range,e.action.insertText),u=lm.fromStringEdit(c,t),p=c.isEmpty()?new ys(new G(1,1,1,1),""):u.toReplacement(t);r=c.replacements.map(h=>{let g=G.fromPositions(t.getPositionAt(h.replaceRange.start),t.getTransformer().getPosition(h.replaceRange.endExclusive)),f=t.getValueInRange(g);return ugi.create(h,f)}),n={kind:"edit",snippetInfo:e.action.snippetInfo,stringEdit:c,textReplacement:p,alternativeAction:e.action.alternativeAction,target:t}}else if(e.action?.kind==="jumpTo")n={kind:"jumpTo",position:e.action.position,offset:t.getTransformer().getOffset(e.action.position),target:t};else if(n=void 0,!e.hint)throw new ci("InlineEditItem: action is undefined and no hint is provided");let s=new W_t,l=e.hint?V_t.create(e.hint):void 0;return new a(n,e,s,r,l,!1,t.getVersionId(),t)}get updatedEditModelVersion(){return this._inlineEditModelVersion}get action(){return this._action}withIdentity(e){return new a(this._action,this._data,e,this._edits,this.hint,this._lastChangePartOfInlineEdit,this._inlineEditModelVersion,this.originalTextRef)}canBeReused(e,t){return this._lastChangePartOfInlineEdit&&this.updatedEditModelVersion===e.getVersionId()}withEdit(e,t){return this.originalTextRef.targets(t)?this._applyTextModelChanges(e,this._edits,t):this}_applyTextModelChanges(e,t,o){let n=Mue(o),r=!1,s=this._inlineEditModelVersion,l,c=g2.snapshot(o);if(this.action?.kind==="edit"){if(t=t.map(f=>f.applyTextModelChanges(e)),t.some(f=>f.edit===void 0))return;let p=o.getVersionId();if(r=t.some(f=>f.lastChangeUpdatedEdit),r&&(s=p??-1),p===null||s+20<p||(t=t.filter(f=>!f.edit.isEmpty),t.length===0))return;let h=new Ad(t.map(f=>f.edit));l={kind:"edit",textReplacement:n.getTextEdit(h).toReplacement(new aM(o)),snippetInfo:this.snippetInfo,stringEdit:h,alternativeAction:this.action.alternativeAction,target:c}}else if(this.action?.kind==="jumpTo"){let p=this.action.offset,h=e.applyToOffsetOrUndefined(p);if(h===void 0)return;l={kind:"jumpTo",position:n.getPosition(h),offset:h,target:c}}else l=void 0;let u=this.hint;if(!(u&&(u=u.withEdit(e,n),!u)))return new a(l,this._data,this.identity,t,u,r,s,c)}computeEditKind(e){let t=this.action?.kind==="edit"?this.action.stringEdit:void 0;if(t)return ngi(t,e)}};function v8o(a,i,e){let t=a.getEOL(),o=a.getValueOfRange(i),n=e.replace(/\r\n|\r|\n/g,t),l=yF.getDefault().computeDiff(Hc(o),Hc(n),{ignoreTrimWhitespace:!1,computeMoves:!1,extendToSubwords:!0,maxComputationTimeMs:50}).changes.flatMap(h=>h.innerChanges??[]);function c(h,g){let f=Rc.fromPosition(g.getStartPosition());return Rc.ofRange(g).createRange(f.addToPosition(h))}let u=new _I(n);return new Ad(l.map(h=>{let g=c(i.getStartPosition(),h.originalRange),f=a.getTransformer().getOffsetRange(g),v=u.getValueOfRange(h.modifiedRange),b=new xd(f,v),S=a.getValueOfRange(g);return I8o(b,S,l.length,a)}))}function b8o(a,i,e){return new Ad([new xd(a.getTransformer().getOffsetRange(i),e)])}var ugi=class a{constructor(i,e,t,o,n=!1){this._edit=i;this._trimmedNewText=e;this._prefixLength=t;this._suffixLength=o;this._lastChangeUpdatedEdit=n}static create(i,e){let t=Af(i.newText,e),o=lx(i.newText,e),n=i.newText.substring(t,i.newText.length-o);return new a(i,n,t,o)}get edit(){return this._edit}get lastChangeUpdatedEdit(){return this._lastChangeUpdatedEdit}applyTextModelChanges(i){let e=this._clone();return e._applyTextModelChanges(i),e}_clone(){return new a(this._edit,this._trimmedNewText,this._prefixLength,this._suffixLength,this._lastChangeUpdatedEdit)}_applyTextModelChanges(i){if(this._lastChangeUpdatedEdit=!1,!this._edit)throw new ci("UpdatedInnerEdits: No edit to apply changes to");let e=this._applyChanges(this._edit,i);if(!e){this._edit=void 0;return}this._edit=e.edit,this._lastChangeUpdatedEdit=e.editHasChanged}_applyChanges(i,e){let t=i.replaceRange.start,o=i.replaceRange.endExclusive,n=i.newText,r=!1,s=this._prefixLength>0||this._suffixLength>0;for(let l=e.replacements.length-1;l>=0;l--){let c=e.replacements[l],u=c.newText.length>0&&c.replaceRange.isEmpty;if(u&&!s&&c.replaceRange.start===t&&n.startsWith(c.newText)){t+=c.newText.length,n=n.substring(c.newText.length),o+=c.newText.length,r=!0;continue}if(u&&s&&c.replaceRange.start===t+this._prefixLength&&this._trimmedNewText.startsWith(c.newText)){o+=c.newText.length,r=!0,this._prefixLength+=c.newText.length,this._trimmedNewText=this._trimmedNewText.substring(c.newText.length);continue}if(c.newText.length===0&&c.replaceRange.length>0&&c.replaceRange.start>=t+this._prefixLength&&c.replaceRange.endExclusive<=o-this._suffixLength){o-=c.replaceRange.length,r=!0;continue}if(c.equals(i)){r=!0,t=c.replaceRange.endExclusive,n="";continue}if(!(c.replaceRange.start>o)){if(c.replaceRange.endExclusive<t){t+=c.newText.length-c.replaceRange.length,o+=c.newText.length-c.replaceRange.length;continue}return}}return this._trimmedNewText.length===0&&t+this._prefixLength===o-this._suffixLength?{edit:new xd(new gi(t+this._prefixLength,t+this._prefixLength),""),editHasChanged:!0}:{edit:new xd(new gi(t,o),n),editHasChanged:r}}};function S8o(a,i){let e=i.getEOL();return a.replaceRange.isEmpty&&a.newText.includes(e)&&(a=noo(a,i)),a}function I8o(a,i,e,t){let o=t.getEOL();if(a.newText.endsWith(o)&&i.endsWith(o)&&(a=new xd(a.replaceRange.deltaEnd(-o.length),a.newText.slice(0,-o.length))),e===1&&a.replaceRange.isEmpty&&a.newText.includes(o)){let n=t.getTransformer().getPosition(a.replaceRange.start);t.getLineLength(n.lineNumber)!==0&&(a=noo(a,t))}if(e===1){let n=Af(i,a.newText),r=lx(i.slice(n),a.newText.slice(n));if(n+r===i.length)return new xd(a.replaceRange.deltaStart(n).deltaEnd(-r),a.newText.substring(n,a.newText.length-r));if(n+r===a.newText.length)return new xd(a.replaceRange.deltaStart(n).deltaEnd(-r),"")}return a}function noo(a,i){if(!a.replaceRange.isEmpty)throw new ci("Unexpected original range");if(a.replaceRange.start===0)return a;let e=i.getEOL(),t=i.getTransformer().getPosition(a.replaceRange.start),o=t.column,n=t.lineNumber;return o===1&&n>1&&a.newText.endsWith(e)&&!a.newText.startsWith(e)?new xd(a.replaceRange.delta(-1),e+a.newText.slice(0,-e.length)):a}var w8o=!1,Aue=new Y("renameInputVisible",!1,d(1571,null)),gNs=new Y("renameInputFocused",!1,d(1570,null)),aTe=class{constructor(i,e,t,o,n,r){this._editor=i;this._acceptKeybindings=e;this._themeService=t;this._keybindingService=o;this._logService=r;this.allowEditorOverflow=!0;this._disposables=new O;this._visibleContextKey=Aue.bindTo(n),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new On,this._inputWithButton=new mgi,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(s=>{s.hasChanged(59)&&this._updateFont()})),this._disposables.add(t.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new pgi(this._domNode,{fontInfo:this._editor.getOption(59),onFocusChange:i=>{this._inputWithButton.input.value=i,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{this._renameCandidateListView?.focusedCandidate!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??=this._beforeFirstInputFieldEditSW.elapsed(),this._renameCandidateProvidersCts?.token.isCancellationRequested===!1&&this._renameCandidateProvidersCts.cancel(),this._renameCandidateListView?.clearFocus()})),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(i){if(!this._domNode)return;let e=i.getColor(_F),t=i.getColor(SD);this._domNode.style.backgroundColor=String(i.getColor(qu)??""),this._domNode.style.boxShadow=e?` 0 0 8px 2px ${e}`:"",this._domNode.style.border=t?`1px solid ${t}`:"",this._domNode.style.color=String(i.getColor(IT)??"");let o=i.getColor(LI);this._inputWithButton.domNode.style.backgroundColor=String(i.getColor(Hf)??""),this._inputWithButton.input.style.backgroundColor=String(i.getColor(Hf)??""),this._inputWithButton.domNode.style.borderWidth=o?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=o?"solid":"none",this._inputWithButton.domNode.style.borderColor=o?.toString()??"none"}_updateFont(){if(this._domNode===void 0)return;To(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);let i=this._editor.getOption(59);this._label.style.fontSize=`${this._computeLabelFontSize(i.fontSize)}px`}_computeLabelFontSize(i){return i*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;let i=wh(this.getDomNode().ownerDocument.body),e=ur(this._editor.getDomNode()),t=this._getTopForPosition();this._nPxAvailableAbove=t+e.top,this._nPxAvailableBelow=i.height-this._nPxAvailableAbove;let o=this._editor.getOption(75),{totalHeight:n}=w9e.getLayoutInfo({lineHeight:o}),r=this._nPxAvailableBelow>n*6?[2,1]:[1,2];return{position:this._position,preference:r}}beforeRender(){let[i,e]=this._acceptKeybindings;return this._label.innerText=d(1568,null,this._keybindingService.lookupKeybinding(i)?.getLabel(),this._keybindingService.lookupKeybinding(e)?.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(i){if(i===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;To(this._renameCandidateListView),To(this._nPxAvailableAbove!==void 0),To(this._nPxAvailableBelow!==void 0);let e=Uh(this._inputWithButton.domNode),t=Uh(this._label),o;i===2?o=this._nPxAvailableBelow:o=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:o-t-e,width:Dc(this._inputWithButton.domNode)})}acceptInput(i){this._trace("invoking acceptInput"),this._currentAcceptInput?.(i)}cancelInput(i,e){this._currentCancelInput?.(i)}focusNextRenameSuggestion(){this._renameCandidateListView?.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){this._renameCandidateListView?.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(i,e,t,o,n){let{start:r,end:s}=this._getSelection(i,e);this._renameCts=n;let l=new O;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,o===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=o,this._requestRenameCandidates(e,!1),l.add($(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(e,!0))),l.add($(this._inputWithButton.button,ne.KEY_DOWN,u=>{let p=new mi(u);(p.equals(3)||p.equals(10))&&(p.stopPropagation(),p.preventDefault(),this._requestRenameCandidates(e,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",t),this._position=new ye(i.startLineNumber,i.startColumn),this._currentName=e,this._inputWithButton.input.value=e,this._inputWithButton.input.setAttribute("selectionStart",r.toString()),this._inputWithButton.input.setAttribute("selectionEnd",s.toString()),this._inputWithButton.input.size=Math.max((i.endColumn-i.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),l.add(ee(()=>{this._renameCts=void 0,n.dispose(!0)})),l.add(ee(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),l.add(ee(()=>this._candidates.clear()));let c=new Mo;return c.p.finally(()=>{l.dispose(),this._hide()}),this._currentCancelInput=u=>(this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),c.complete(u),!0),this._currentAcceptInput=u=>{this._trace("invoking _currentAcceptInput"),To(this._renameCandidateListView!==void 0);let p=this._renameCandidateListView.nCandidates,h,g,f=this._renameCandidateListView.focusedCandidate;if(f!==void 0?(this._trace("using new name from renameSuggestion"),h=f,g={k:"renameSuggestion"}):(this._trace("using new name from inputField"),h=this._inputWithButton.input.value,g=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),h===e||h.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),c.complete({newName:h,wantsPreview:t&&u,stats:{source:g,nRenameSuggestions:p,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},l.add(n.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),w8o||l.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),"editor.onDidBlurEditorWidget"))),this._show(),c.p}_requestRenameCandidates(i,e){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),To(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new qe;let t=e?0:1,o=this._requestRenameCandidatesOnce(t,this._renameCandidateProvidersCts.token);if(o.length===0){this._inputWithButton.setSparkleButton();return}e||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(o,i,this._renameCts.token)}}_getSelection(i,e){To(this._editor.hasModel());let t=this._editor.getSelection(),o=0,n=e.length;return!G.isEmpty(t)&&!G.spansMultipleLines(t)&&G.containsRange(i,t)&&(o=Math.max(0,t.startColumn-i.startColumn),n=Math.min(i.endColumn,t.endColumn)-i.startColumn),{start:o,end:n}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(i,e,t){let o=(...c)=>this._trace("_updateRenameCandidates",...c);o("start");let n=await Ea(Promise.allSettled(i),t);if(this._inputWithButton.setSparkleButton(),n===void 0){o("returning early - received updateRenameCandidates results - undefined");return}let r=n.flatMap(c=>c.status==="fulfilled"&&so(c.value)?c.value:[]);o(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);let s=jo(r,c=>c.newSymbolName);o(`distinct candidates - ${s.length} candidates.`);let l=s.filter(({newSymbolName:c})=>c.trim().length>0&&c!==this._inputWithButton.input.value&&c!==e&&!this._candidates.has(c));if(o(`valid distinct candidates - ${r.length} candidates.`),l.forEach(c=>this._candidates.add(c.newSymbolName)),l.length<1){o("returning early - no valid distinct candidates");return}o("setting candidates"),this._renameCandidateListView.setCandidates(l),o("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){let i=this._editor.getVisibleRanges(),e;return i.length>0?e=i[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),e=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(e)}_trace(...i){this._logService.trace("RenameWidget",...i)}};aTe=I([m(2,Pe),m(3,Le),m(4,X),m(5,re)],aTe);var pgi=class a{constructor(i,e){this._disposables=new O,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=e.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=e.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",i.appendChild(this._listContainer),this._listWidget=a._createListWidget(this._listContainer,this._candidateViewHeight,e.fontInfo),this._disposables.add(this._listWidget.onDidChangeFocus(t=>{t.elements.length===1&&e.onFocusChange(t.elements[0].newSymbolName)},this._disposables)),this._disposables.add(this._listWidget.onDidChangeSelection(t=>{t.elements.length===1&&e.onSelectionChange()},this._disposables)),this._disposables.add(this._listWidget.onDidBlur(t=>{this._listWidget.setFocus([])})),this._listWidget.style(WS({listInactiveFocusForeground:oK,listInactiveFocusBackground:nK}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:i,width:e}){this._availableHeight=i,this._minimumWidth=e}setCandidates(i){this._listWidget.splice(0,0,i);let e=this._pickListHeight(this._listWidget.length),t=this._pickListWidth(i);this._listWidget.layout(e,t),this._listContainer.style.height=`${e}px`,this._listContainer.style.width=`${t}px`,Er(d(1572,null,i.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;let i=this._listWidget.getSelectedElements()[0];if(i!==void 0)return i.newSymbolName;let e=this._listWidget.getFocusedElements()[0];if(e!==void 0)return e.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;let i=this._listWidget.getFocus();if(i.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(i[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;let i=this._listWidget.getFocus();if(i.length===0){this._listWidget.focusLast();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}else{if(i[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){let{totalHeight:i}=w9e.getLayoutInfo({lineHeight:this._lineHeight});return i}_pickListHeight(i){let e=this._candidateViewHeight*i;return Math.min(e,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(i){let e=Math.ceil(Math.max(...i.map(o=>o.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+e+10)}static _createListWidget(i,e,t){let o=new class{getTemplateId(r){return"candidate"}getHeight(r){return e}},n=new class{constructor(){this.templateId="candidate"}renderTemplate(r){return new w9e(r,t)}renderElement(r,s,l){l.populate(r)}disposeTemplate(r){r.dispose()}};return new Gc("NewSymbolNameCandidates",i,o,[n],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}},mgi=class{constructor(){this._buttonHoverContent="";this._disposables=new O;this._onDidInputChange=this._disposables.add(new T);this.onDidInputChange=this._onDidInputChange.event}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",d(1569,null)),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=d(1567,null),this._buttonCancelHoverText=d(1566,null),this._buttonHoverContent=this._buttonGenHoverText,this._disposables.add(sp().setupDelayedHover(this._buttonNode,()=>({content:this._buttonHoverContent,style:1}))),this._domNode.appendChild(this._buttonNode),this._disposables.add($(this.input,ne.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add($(this.input,ne.KEY_DOWN,i=>{let e=new mi(i);(e.keyCode===15||e.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add($(this.input,ne.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add($(this.input,ne.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add($(this.input,ne.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return To(this._inputNode),this._inputNode}get button(){return To(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=un(L.sparkle),St(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),this._buttonHoverContent=this._buttonGenHoverText,this.input.focus()}setStopButton(){this._buttonState="stop",this._stopIcon??=un(L.stopCircle),St(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),this._buttonHoverContent=this._buttonCancelHoverText,this.input.focus()}dispose(){this._disposables.dispose()}},w9e=class a{static{this._PADDING=2}constructor(i,e){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${e.lineHeight}px`,this._domNode.style.padding=`${a._PADDING}px`;let t=document.createElement("div");t.style.display="flex",t.style.alignItems="center",t.style.width=t.style.height=`${e.lineHeight*.8}px`,this._domNode.appendChild(t),this._icon=un(L.sparkle),this._icon.style.display="none",t.appendChild(this._icon),this._label=document.createElement("div"),ku(this._label,e),this._domNode.appendChild(this._label),i.appendChild(this._domNode)}populate(i){this._updateIcon(i),this._updateLabel(i)}_updateIcon(i){let e=!!i.tags?.includes(1);this._icon.style.display=e?"inherit":"none"}_updateLabel(i){this._label.innerText=i.newSymbolName}static getLayoutInfo({lineHeight:i}){return{totalHeight:i+a._PADDING*2}}dispose(){}};var lTe=class{constructor(i,e,t){this.model=i;this.position=e;this._providerRenameIdx=0;this._providers=t.ordered(i)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(i){let e=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){let o=this._providers[this._providerRenameIdx];if(!o.resolveRenameLocation)break;let n=await o.resolveRenameLocation(this.model,this.position,i);if(n){if(n.rejectReason){e.push(n.rejectReason);continue}return n}}this._providerRenameIdx=0;let t=this.model.getWordAtPosition(this.position);return t?{range:new G(this.position.lineNumber,t.startColumn,this.position.lineNumber,t.endColumn),text:t.word,rejectReason:e.length>0?e.join(`
`):void 0}:{range:G.fromPositions(this.position),text:"",rejectReason:e.length>0?e.join(`
`):void 0}}async provideRenameEdits(i,e){return this._provideRenameEdits(i,this._providerRenameIdx,[],e)}async _provideRenameEdits(i,e,t,o){let n=this._providers[e];if(!n)return{edits:[],rejectReason:t.join(`
`)};let r=await n.provideRenameEdits(this.model,this.position,i,o);if(r){if(r.rejectReason)return this._provideRenameEdits(i,e+1,t.concat(r.rejectReason),o)}else return this._provideRenameEdits(i,e+1,t.concat(d(1560,null)),o);return r}};function roo(a,i){return a.ordered(i).length>0}async function soo(a,i,e,t,o){return new lTe(i,e,a).provideRenameEdits(t,o??Ie.None)}async function ggi(a,i,e,t){let o=new lTe(i,e,a),n=await o.resolveRenameLocation(Ie.None);return n?.rejectReason?{edits:[],rejectReason:n.rejectReason}:o.provideRenameEdits(t,Ie.None)}var v0=class{constructor(i,e,t,o,n,r,s,l){this.editor=i;this._instaService=e;this._notificationService=t;this._bulkEditService=o;this._progressService=n;this._logService=r;this._configService=s;this._languageFeaturesService=l;this._disposableStore=new O;this._cts=new qe;this._renameWidget=this._disposableStore.add(this._instaService.createInstance(aTe,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}static{this.ID="editor.contrib.renameController"}static get(i){return i.getContribution(v0.ID)}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){let i=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new qe,!this.editor.hasModel()){i("editor has no model");return}let e=this.editor.getPosition(),t=new lTe(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!t.hasProvider()){i("skeleton has no provider");return}let o=new $k(this.editor,5,void 0,this._cts.token),n;try{i("resolving rename location");let f=t.resolveRenameLocation(o.token);this._progressService.showWhile(f,250),n=await f,i("resolved rename location")}catch(f){f instanceof qi?i("resolve rename location cancelled",JSON.stringify(f,null,"	")):(i("resolve rename location failed",f instanceof Error?f:JSON.stringify(f,null,"	")),(typeof f=="string"||yr(f))&&Xu.get(this.editor)?.showMessage(f||d(1565,null),e));return}finally{o.dispose()}if(!n){i("returning early - no loc");return}if(n.rejectReason){i(`returning early - rejected with reason: ${n.rejectReason}`,n.rejectReason),Xu.get(this.editor)?.showMessage(n.rejectReason,e);return}if(o.token.isCancellationRequested){i("returning early - cts1 cancelled");return}let r=new $k(this.editor,5,n.range,this._cts.token),s=this.editor.getModel(),l=this._languageFeaturesService.newSymbolNamesProvider.all(s),c=await Promise.all(l.map(async f=>[f,await f.supportsAutomaticNewSymbolNamesTriggerKind??!1])),u=(f,v)=>{let b=c.slice();return f===1&&(b=b.filter(([S,y])=>y)),b.map(([S])=>S.provideNewSymbolNames(s,n.range,f,v))};i("creating rename input field and awaiting its result");let p=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),h=await this._renameWidget.getInput(n.range,n.text,p,l.length>0?u:void 0,r);if(i("received response from rename input field"),typeof h=="boolean"){i(`returning early - rename input field response - ${h}`),h&&this.editor.focus(),r.dispose();return}this.editor.focus(),i("requesting rename edits");let g=Ea(t.provideRenameEdits(h.newName,r.token),r.token).then(async f=>{if(!f){i("returning early - no rename edits result");return}if(!this.editor.hasModel()){i("returning early - no model after rename edits are provided");return}if(f.rejectReason){i(`returning early - rejected with reason: ${f.rejectReason}`),this._notificationService.info(f.rejectReason);return}this.editor.setSelection(G.fromPositions(this.editor.getSelection().getPosition())),i("applying edits"),this._bulkEditService.apply(f,{editor:this.editor,showPreview:h.wantsPreview,label:d(1559,null,n?.text,h.newName),code:"undoredo.rename",quotableLabel:d(1561,null,n?.text,h.newName),respectAutoSaveConfig:!0,reason:sd.rename(n?.text,h.newName)}).then(v=>{i("edits applied"),v.ariaSummary&&cn(d(1555,null,n.text,h.newName,v.ariaSummary))}).catch(v=>{i(`error when applying edits ${JSON.stringify(v,null,"	")}`),this._notificationService.error(d(1563,null)),this._logService.error(v)})},f=>{i("error when providing rename edits",JSON.stringify(f,null,"	")),this._notificationService.error(d(1562,null)),this._logService.error(f)}).finally(()=>{r.dispose()});return i("returning rename operation"),this._progressService.showWhile(g,250),g}acceptRenameInput(i){this._renameWidget.acceptInput(i)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}};v0=I([m(1,F),m(2,Ne),m(3,Ka),m(4,Hd),m(5,re),m(6,Gn),m(7,Jt)],v0);var hgi=class extends Mi{constructor(){super({id:"editor.action.rename",label:P(1564,"Rename Symbol"),precondition:C.and(me.writable,me.hasRenameProvider),kbOpts:{kbExpr:me.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1},canTriggerInlineEdits:!0})}runCommand(i,e){let t=i.get(Qt),[o,n]=Array.isArray(e)&&e||[void 0,void 0];return A.isUri(o)&&ye.isIPosition(n)?t.openCodeEditor({resource:o},t.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(n),r.invokeWithinContext(s=>(this.reportTelemetry(s,r),this.run(s,r))))},mt):super.runCommand(i,e)}run(i,e){let t=i.get(re),o=v0.get(e);return o?(t.trace("[RenameAction] got controller, running..."),o.run()):(t.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}};Eo(v0.ID,v0,4);ri(hgi);var fgi=od.bindToContribution(v0.get);ro(new fgi({id:"acceptRenameInput",precondition:Aue,handler:a=>a.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:C.and(me.focus,C.not("isComposing")),primary:3}}));ro(new fgi({id:"acceptRenameInputWithPreview",precondition:C.and(Aue,C.has("config.editor.rename.enablePreview")),handler:a=>a.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:C.and(me.focus,C.not("isComposing")),primary:2051}}));ro(new fgi({id:"cancelRenameInput",precondition:Aue,handler:a=>a.cancelRenameInput(),kbOpts:{weight:199,kbExpr:me.focus,primary:9,secondary:[1033]}}));W(class extends z{constructor(){super({id:"focusNextRenameSuggestion",title:{...P(1557,"Focus Next Rename Suggestion")},precondition:Aue,keybinding:[{primary:18,weight:199}]})}run(i){let e=i.get(Qt).getFocusedCodeEditor();if(!e)return;let t=v0.get(e);t&&t.focusNextRenameSuggestion()}});W(class extends z{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...P(1558,"Focus Previous Rename Suggestion")},precondition:Aue,keybinding:[{primary:16,weight:199}]})}run(i){let e=i.get(Qt).getFocusedCodeEditor();if(!e)return;let t=v0.get(e);t&&t.focusPreviousRenameSuggestion()}});kI("_executeDocumentRenameProvider",function(a,i,e,...t){let[o]=t;To(typeof o=="string");let{renameProvider:n}=a.get(Jt);return ggi(n,i,e,o)});kI("_executePrepareRename",async function(a,i,e){let{renameProvider:t}=a.get(Jt),n=await new lTe(i,e,t).resolveRenameLocation(Ie.None);if(n?.rejectReason)throw new Error(n.rejectReason);return n});oe.as($t.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:6,description:d(1556,null),default:!0,type:"boolean"}}});var B_t=le("renameSymbolTrackerService");var H_t=(t=>(t.no="no",t.yes="yes",t.maybe="maybe",t))(H_t||{});(i=>{function a(e){switch(e){case"no":return"no";case"yes":return"yes";case"maybe":return"maybe";default:return"no"}}i.fromString=a})(H_t||={});var vgi=class{constructor(){}inferRename(i,e,t,o){let n=new G(e.startLineNumber,1,e.endLineNumber,i.getLineMaxColumn(e.endLineNumber)),r=e.startColumn-n.startColumn,s=n.endColumn-e.endColumn,l=i.getValueInRange(n),c=i.getValueInRange(new G(n.startLineNumber,n.startColumn,n.startLineNumber,n.startColumn+r))+t+i.getValueInRange(new G(n.endLineNumber,n.endColumn-s,n.endLineNumber,n.endColumn)),u=[],p=[],h,g,f,v=i.getOffsetAt(n.getStartPosition()),{changes:b}=new kA(new Dce(l),new Dce(c)).ComputeDiff(!0);if(b.length===0)return;let S=[];for(let x of b){if(S.length===0){S.push(x);continue}let E=S[S.length-1],M=x.originalStart-(E.originalStart+E.originalLength);if(M>0){let N=v+E.originalStart+E.originalLength,V=i.getPositionAt(N),H=i.getWordAtPosition(V);if(H){let K=i.getOffsetAt(new ye(V.lineNumber,H.startColumn)),j=i.getOffsetAt(new ye(V.lineNumber,H.endColumn)),J=N+M;if(K<=N&&J<=j&&K<=J&&J<=j){E.originalLength=x.originalStart+x.originalLength-E.originalStart,E.modifiedLength=x.modifiedStart+x.modifiedLength-E.modifiedStart;continue}}}S.push(x)}let y=0;for(let x of S){let E=l.substring(x.originalStart,x.originalStart+x.originalLength),M=c.substring(x.modifiedStart,x.modifiedStart+x.modifiedLength),N=v+x.originalStart,V=i.getPositionAt(N),H=N+x.originalLength,K=i.getPositionAt(H),j=G.fromPositions(V,K),J=M.length-x.originalLength;if(/\s/.test(E)){u.push(new ys(j,M)),y+=J;continue}if(E.length>0){o.lastIndex=0;let Re=o.exec(E);if(Re===null||Re.index!==0||Re[0].length!==E.length){u.push(new ys(j,M)),y+=J;continue}}if(/\s/.test(M)){u.push(new ys(j,M)),y+=J;continue}if(M.length>0){o.lastIndex=0;let Re=o.exec(M);if(Re===null||Re.index!==0||Re[0].length!==M.length){u.push(new ys(j,M)),y+=J;continue}}let se=i.getWordAtPosition(V);if(se===null){u.push(new ys(j,M)),y+=J;continue}let ae=x.originalStart+1,ce=x.originalLength===0&&x.modifiedLength>0,Se;if(ce&&ae===se.endColumn&&se.endColumn>se.startColumn?Se=this.getTokenAtPosition(i,new ye(V.lineNumber,se.startColumn)):Se=this.getTokenAtPosition(i,V),se.startColumn!==Se.range.startColumn||se.endColumn!==Se.range.endColumn){u.push(new ys(j,M)),y+=J;continue}if(Se.type===0){let Re=i.getValueInRange(Se.range);if(Re.length===0){u.push(new ys(j,M)),y+=J;continue}if(h===void 0)h=Re;else if(h!==Re){u.push(new ys(j,M)),y+=J;continue}let xe=i.getOffsetAt(Se.range.getStartPosition())-v+y,He=i.getOffsetAt(Se.range.getEndPosition())-v+y;if(Re=c.substring(xe,He+J),Re.length===0){u.push(new ys(j,M)),y+=J;continue}if(g===void 0)g=Re;else if(g!==Re){u.push(new ys(j,M)),y+=J;continue}f===void 0&&(f=Se.range.getStartPosition()),h!==void 0&&g!==void 0&&h.length>0&&g.length>0&&h!==g?p.push(new ys(Se.range,g)):p.push(new ys(j,M)),y+=J}else u.push(new ys(j,M)),y+=M.length-x.originalLength}if(h===void 0||g===void 0||f===void 0||h.length===0||g.length===0||h===g)return;o.lastIndex=0;let w=o.exec(h);if(!(w===null||w.index!==0||w[0].length!==h.length)&&(o.lastIndex=0,w=o.exec(g),!(w===null||w.index!==0||w[0].length!==g.length)))return{renames:{edits:p,position:f,oldName:h,newName:g},others:{edits:u}}}getTokenAtPosition(i,e){i.tokenization.tokenizeIfCheap(e.lineNumber);let t=i.tokenization.getLineTokens(e.lineNumber),o=t.findTokenIndexAtOffset(e.column-1);return{type:t.getStandardTokenType(o),range:new G(e.lineNumber,1+t.getStartOffset(o),e.lineNumber,1+t.getEndOffset(o))}}},C9e=class a{constructor(i,e){this.editor=i;this.versionId=e}static create(i,e){let t=i.getFocusedCodeEditor();if(t!==null&&t.getModel()===e)return new a(t,e.getVersionId())}equals(i){return i===void 0?!1:this.editor===i.editor&&this.versionId===i.versionId}},bgi=class{constructor(i,e,t,o,n,r,s,l,c){this._result=void 0;if(this._commandService=e,this._textModel=o,this._state=n,this._requestUuid=t,this._cancellationTokenSource=new qe,l===void 0||c===void 0){this._promise=soo(i.renameProvider,o,r,s,this._cancellationTokenSource.token);return}else this._promise=this.sendNesRenameRequest(o,r,c,s,l)}get requestUuid(){return this._requestUuid}isValid(i){return this._state.equals(C9e.create(i,this._textModel))}cancel(){this._cancellationTokenSource.cancel()}async getCount(){if(this._cancellationTokenSource.token.isCancellationRequested)return 0;let i=await this.getResult();return i===void 0||this._cancellationTokenSource.token.isCancellationRequested?0:i.edits.length}async getWorkspaceEdit(){return this.getResult()}async getResult(){if(!this._cancellationTokenSource.token.isCancellationRequested&&(this._result===void 0&&(this._result=await this._promise),!(this._result.rejectReason||this._cancellationTokenSource.token.isCancellationRequested)))return this._result}async sendNesRenameRequest(i,e,t,o,n){try{let r=await this._commandService.executeCommand("github.copilot.nes.postRename",i.uri,e,t,o,n);if(r===void 0)return{rejectReason:"Rename failed",edits:[]};let s=[];for(let l of r)for(let c of l.changes){let u=new G(c.range.start.line+1,c.range.start.character+1,c.range.end.line+1,c.range.end.character+1),p=new hl(l.file,new ys(u,c.newText??o));s.push(p)}return{edits:s}}catch{return{rejectReason:"Rename failed",edits:[]}}}},cTe=class extends k{constructor(e,t,o,n,r,s){super();this._commandService=e;this._languageFeaturesService=t;this._languageConfigurationService=o;this._renameSymbolTrackerService=r;this._codeEditorService=s;this._renameInferenceEngine=new vgi;this._renameRunnable=void 0;this._register(Ge.registerCommand(Lui,async(l,c,u)=>{if(!(u===void 0||!u.isValid(this._codeEditorService)))try{let p=await u.getWorkspaceEdit();if(p===void 0)return;n.apply(p,{reason:c})}finally{this._renameRunnable===u&&(this._renameRunnable=void 0)}}))}async proposeRenameRefactoring(e,t,o){if(!t.supportsRename||t.action?.kind!=="edit"||o.selectedSuggestionInfo||!roo(this._languageFeaturesService.renameProvider,e))return t;let n=C9e.create(this._codeEditorService,e);if(n===void 0)return t;let r=Date.now(),s=t.action.textReplacement,l=this._languageConfigurationService.getLanguageConfiguration(e.getLanguageId()),c=this._renameInferenceEngine.inferRename(e,s.range,s.text,l.wordDefinition);if(c===void 0||c.renames.edits.length===0)return t;let{oldName:u,newName:p,position:h,edits:g}=c.renames,f=this._renameSymbolTrackerService.trackedWord.get(),v;f!==void 0&&f.model===e&&f.originalWord===u&&f.currentWord===p&&(v=f.currentRange);let b=!1,S=await Uu(this.checkRenamePrecondition(t,e,h,u,p,v),100,()=>{b=!0}),y=this.isRenamePossible(t,S,n,e);if(t.setRenameProcessingInfo({createdRename:y,duration:Date.now()-r,timedOut:b,droppedOtherEdits:y?c.others.edits.length:void 0,droppedRenameEdits:y?g.length-1:void 0}),!y)return t;this._renameRunnable===void 0&&(this._renameRunnable=new bgi(this._languageFeaturesService,this._commandService,t.requestUuid,e,n,h,p,v,v!==void 0?u:void 0));let w=sd.inlineCompletionAccept({nes:t.isInlineEdit,requestUuid:t.requestUuid,providerId:t.source.provider.providerId,languageId:e.getLanguageId(),correlationId:t.getSourceCompletion().correlationId}),x={id:Lui,title:d(1384,null),arguments:[w,this._renameRunnable]},E={label:d(1384,null),icon:L.replaceAll,command:x,count:this._renameRunnable.getCount()},M={kind:"edit",range:g[0].range,insertText:g[0].text,snippetInfo:t.snippetInfo,alternativeAction:E,uri:e.uri},N=g2.snapshot(e);return y9e.create(t.withAction(M),N,!1)}async checkRenamePrecondition(e,t,o,n,r,s){let l={canRename:"no",timedOut:!1};try{let c=await this._commandService.executeCommand("github.copilot.nes.prepareRename",t.uri,o,n,r,e.requestUuid,s);if(c===void 0)return l;if(typeof c=="string"){let u=H_t.fromString(c);return u==="yes"||u==="maybe"?{canRename:u,oldName:n,onOldState:!1}:{canRename:u,timedOut:!1}}else return c}catch{return l}}isRenamePossible(e,t,o,n){return t===void 0||t.canRename==="no"||!o.equals(C9e.create(this._codeEditorService,n))?!1:this._renameRunnable===void 0?!0:this._renameRunnable.requestUuid===e.requestUuid?!1:(this._renameRunnable.cancel(),this._renameRunnable=void 0,!0)}};cTe=I([m(0,fe),m(1,Jt),m(2,Us),m(3,Ka),m(4,B_t),m(5,Qt)],cTe);var NJ=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._textModel=e;this._versionId=t;this._debounceValue=o;this._cursorPosition=n;this._languageConfigurationService=r;this._logService=s;this._configurationService=l;this._instantiationService=c;this._contextKeyService=u;this._textModelService=p;this._updateOperation=this._register(new ue);this._state=Zio(this,{initial:()=>({inlineCompletions:lH.createEmpty(),suggestWidgetInlineCompletions:lH.createEmpty()}),disposeFinal:e=>{e.inlineCompletions.dispose(),e.suggestWidgetInlineCompletions.dispose()},changeTracker:doi(()=>({versionId:this._versionId})),update:(e,t,o)=>{let n=Ad.compose(o.changes.map(r=>r.change?AX(r.change.changes):Ad.empty).filter(so));if(n.isEmpty())return t;try{return{inlineCompletions:t.inlineCompletions.createStateWithAppliedEdit(n,this._textModel),suggestWidgetInlineCompletions:t.suggestWidgetInlineCompletions.createStateWithAppliedEdit(n,this._textModel)}}finally{t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}}});this.inlineCompletions=this._state.map(this,e=>e.inlineCompletions);this.suggestWidgetInlineCompletions=this._state.map(this,e=>e.suggestWidgetInlineCompletions);this._completionsEnabled=void 0;this.clearOperationOnTextModelChange=ke(this,e=>{this._versionId.read(e),this._updateOperation.clear()});this._loadingCount=De(this,0);this.loading=this._loadingCount.map(this,e=>e>0);this._loggingEnabled=hr("editor.inlineSuggest.logFetch",!1,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._sendRequestData=hr("editor.inlineSuggest.emptyResponseInformation",!0,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._structuredFetchLogger=this._register(this._instantiationService.createInstance(PJ.cast(),"editor.inlineSuggest.logFetch.commandId")),this._renameProcessor=this._store.add(this._instantiationService.createInstance(cTe)),this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);let h=$i.defaultChatAgent?.completionsEnablementSetting??void 0;h&&(this._updateCompletionsEnablement(h),this._register(this._configurationService.onDidChangeConfiguration(g=>{g.affectsConfiguration(h)&&this._updateCompletionsEnablement(h)}))),this._state.recomputeInitiallyAndOnChange(this._store)}static{this._requestId=0}_updateCompletionsEnablement(e){let t=this._configurationService.getValue(e);Di(t)?this._completionsEnabled=t:this._completionsEnabled=void 0}_log(e){this._loggingEnabled.get()&&this._logService.info(zio(e)),this._structuredFetchLogger.log(e)}fetch(e,t,o,n,r,s,l){let c=this._cursorPosition.get(),u=new Sgi(c,o,this._textModel.getVersionId(),new Set(e)),p=o.selectedSuggestionInfo?this.suggestWidgetInlineCompletions.get():this.inlineCompletions.get();if(this._updateOperation.value?.request.satisfies(u))return this._updateOperation.value.promise;if(p?.request?.satisfies(u))return Promise.resolve(!0);let h=!!this._updateOperation.value;this._updateOperation.clear();let g=new qe,f=(async()=>{let b=new O;this._loadingCount.set(this._loadingCount.get()+1,void 0);let S=!1,y=()=>{S||(S=!0,this._loadingCount.set(this._loadingCount.get()-1,void 0))};b.add(new Dt(()=>y(),10*1e3)).schedule();let x=e.filter(M=>M.providerId),E=new Igi(o,l,x);try{let M=this._debounceValue.get(this._textModel),N=hvt(e.map(He=>He.debounceDelayMs),J4i(Hu))??M;if((h||r&&o.triggerKind===0)&&await Yhi(N,g.token),g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId)return E.setNoSuggestionReasonIfNotSet("canceled:beforeFetch"),!1;let H=NJ._requestId++;(this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get())&&this._log({sourceId:"InlineCompletions.fetch",kind:"start",requestId:H,modelUri:this._textModel.uri,modelVersion:this._textModel.getVersionId(),context:{triggerKind:o.triggerKind,suggestInfo:o.selectedSuggestionInfo?!0:void 0},time:Date.now(),provider:t});let K=new Date,j=ooo(e,this._cursorPosition.get(),this._textModel,o,l,this._languageConfigurationService);agi(g.token,()=>j.cancelAndDispose({kind:"tokenCancellation"}));let J=!1,se=!1,ae=[];for await(let He of j.lists)if(He){He.addRef(),b.add(ee(()=>He.removeRef(He.inlineSuggestionsData.length===0?{kind:"empty"}:{kind:"notTaken"})));for(let Ee of He.inlineSuggestionsData){if(se=!0,!o.includeInlineEdits&&(Ee.isInlineEdit||Ee.showInlineEditMenu)){Ee.setNotShownReason("notInlineEditRequested");continue}if(!o.includeInlineCompletions&&!(Ee.isInlineEdit||Ee.showInlineEditMenu)){Ee.setNotShownReason("notInlineCompletionRequested");continue}Ee.addPerformanceMarker("providerReturned");let Te=Ee.action?.uri,It,tt;if(Te&&Te.toString()!==this._textModel.uri.toString()){let mo=await this._textModelService.createModelReference(Te);It=mo.object.textEditorModel,tt=mo}else It=this._textModel,tt=void 0;let Oi=g2.snapshot(It),zt=y9e.create(Ee,Oi);if(tt){let mo=Zs(zt.identity.onDispose,()=>{tt?.dispose(),mo.dispose()})}Ee.addPerformanceMarker("itemCreated"),ae.push(zt),!zt.isInlineEdit&&!zt.showInlineEditMenu&&o.triggerKind===0&&zt.isVisible(this._textModel,this._cursorPosition.get())&&(J=!0)}if(J)break}ae.forEach(He=>He.addPerformanceMarker("providersResolved"));let ce=await Promise.all(ae.map(async He=>this._renameProcessor.proposeRenameRefactoring(this._textModel,He,o)));if(ce.forEach(He=>He.addPerformanceMarker("renameProcessed")),j.cancelAndDispose({kind:"lostRace"}),this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get()){let He=j.didAllProvidersReturn,Ee;(g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId)&&(Ee="canceled");let Te=ce.map(It=>{let tt=It.getSourceCompletion();if(tt.doNotLog)return;let Oi={insertText:tt.insertText,range:tt.range,additionalTextEdits:tt.additionalTextEdits,uri:tt.uri,command:tt.command,gutterMenuLinkAction:tt.gutterMenuLinkAction,shownCommand:tt.shownCommand,completeBracketPairs:tt.completeBracketPairs,isInlineEdit:tt.isInlineEdit,showInlineEditMenu:tt.showInlineEditMenu,showRange:tt.showRange,warning:tt.warning,hint:tt.hint,supportsRename:tt.supportsRename,correlationId:tt.correlationId,jumpToPosition:tt.jumpToPosition};return{...Dk(Oi,zt=>G.isIRange(zt)?G.lift(zt).toString():ye.isIPosition(zt)?ye.lift(zt).toString():_ce.is(zt)?{$commandId:zt.id}:zt),$providerId:It.source.provider.providerId?.toString()}}).filter(It=>It!==void 0);this._log({sourceId:"InlineCompletions.fetch",kind:"end",requestId:H,durationMs:Date.now()-K.getTime(),error:Ee,result:Te,time:Date.now(),didAllProvidersReturn:He})}if(E.setRequestUuid(j.contextWithUuid.requestUuid),se)E.setHasProducedSuggestion(),ce.length>0&&g.token.isCancellationRequested&&ce.forEach(He=>He.setNotShownReasonIfNotSet("canceled:whileAwaitingOtherProviders"));else if(g.token.isCancellationRequested)E.setNoSuggestionReasonIfNotSet("canceled:whileFetching");else{let He=this._contextKeyService.getContextKeyValue("completionsQuotaExceeded");E.setNoSuggestionReasonIfNotSet(He?"completionsQuotaExceeded":"noSuggestion")}let Se=o.earliestShownDateTime-Date.now();if(Se>0&&await Yhi(Se,g.token),ce.forEach(He=>He.addPerformanceMarker("minShowDelayPassed")),g.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==u.versionId||s.get()){let He=g.token.isCancellationRequested?"canceled:afterMinShowDelay":this._store.isDisposed?"canceled:disposed":this._textModel.getVersionId()!==u.versionId?"canceled:documentChanged":s.get()?"canceled:userJumped":"unknown";return ce.forEach(Ee=>Ee.setNotShownReasonIfNotSet(He)),!1}let Re=new Date;this._debounceValue.update(this._textModel,Re.getTime()-K.getTime());let xe=this._cursorPosition.get();this._updateOperation.clear(),Ki(He=>{let Ee=this._state.get();o.selectedSuggestionInfo?this._state.set({inlineCompletions:lH.createEmpty(),suggestWidgetInlineCompletions:Ee.suggestWidgetInlineCompletions.createStateWithAppliedResults(ce,u,this._textModel,xe,n)},He):this._state.set({inlineCompletions:Ee.inlineCompletions.createStateWithAppliedResults(ce,u,this._textModel,xe,n),suggestWidgetInlineCompletions:lH.createEmpty()},He),Ee.inlineCompletions.dispose(),Ee.suggestWidgetInlineCompletions.dispose()})}finally{b.dispose(),y(),this._sendInlineCompletionsRequestTelemetry(E)}return!0})(),v=new ygi(u,g,f);return this._updateOperation.value=v,f}clear(e){if(this._store.isDisposed)return;this._updateOperation.clear();let t=this._state.get();this._state.set({inlineCompletions:lH.createEmpty(),suggestWidgetInlineCompletions:lH.createEmpty()},e),t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}seedInlineCompletionsWithSuggestWidget(){let e=this.inlineCompletions.get(),t=this.suggestWidgetInlineCompletions.get();t&&Ki(o=>{if(!e||(t.request?.versionId??-1)>(e.request?.versionId??-1)){e?.dispose();let n=this._state.get();this._state.set({inlineCompletions:t.clone(),suggestWidgetInlineCompletions:lH.createEmpty()},o),n.inlineCompletions.dispose(),n.suggestWidgetInlineCompletions.dispose()}this.clearSuggestWidgetInlineCompletions(o)})}seedWithCompletion(e,t){let o=this._state.get();this._state.set({inlineCompletions:new lH([e],void 0),suggestWidgetInlineCompletions:lH.createEmpty()},t),o.inlineCompletions.dispose(),o.suggestWidgetInlineCompletions.dispose()}_sendInlineCompletionsRequestTelemetry(e){if(!this._sendRequestData.get()&&!this._contextKeyService.getContextKeyValue("isRunningUnificationExperiment")||e.requestUuid===void 0||e.hasProducedSuggestion||!UIt(this._completionsEnabled,this._textModel.getLanguageId())||!e.providers.some(n=>f0(n.providerId?.extensionId)))return;let t={opportunityId:e.requestUuid,noSuggestionReason:e.noSuggestionReason??"unknown",extensionId:"vscode-core",extensionVersion:"0.0.0",groupId:"empty",shown:!1,skuPlan:e.requestInfo.sku?.plan,skuType:e.requestInfo.sku?.type,editorType:e.requestInfo.editorType,requestReason:e.requestInfo.reason,typingInterval:e.requestInfo.typingInterval,typingIntervalCharacterCount:e.requestInfo.typingIntervalCharacterCount,languageId:e.requestInfo.languageId,selectedSuggestionInfo:!!e.context.selectedSuggestionInfo,availableProviders:e.providers.map(n=>n.providerId?.toString()).filter(so).join(","),...aH(e.providers.some(n=>f0(n.providerId?.extensionId))),timeUntilProviderRequest:void 0,timeUntilProviderResponse:void 0,viewKind:void 0,preceeded:void 0,superseded:void 0,reason:void 0,acceptedAlternativeAction:void 0,correlationId:void 0,shownDuration:void 0,shownDurationUncollapsed:void 0,timeUntilShown:void 0,partiallyAccepted:void 0,partiallyAcceptedCountSinceOriginal:void 0,partiallyAcceptedRatioSinceOriginal:void 0,partiallyAcceptedCharactersSinceOriginal:void 0,cursorColumnDistance:void 0,cursorLineDistance:void 0,lineCountOriginal:void 0,lineCountModified:void 0,characterCountOriginal:void 0,characterCountModified:void 0,disjointReplacements:void 0,sameShapeReplacements:void 0,longDistanceHintVisible:void 0,longDistanceHintDistance:void 0,notShownReason:void 0,renameCreated:!1,renameDuration:void 0,renameTimedOut:!1,renameDroppedOtherEdits:void 0,renameDroppedRenameEdits:void 0,performanceMarkers:void 0,editKind:void 0},o=this._instantiationService.createInstance(g0);L_t(o,t)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear()}cancelUpdate(){this._updateOperation.clear()}};NJ=I([m(4,Us),m(5,re),m(6,B),m(7,F),m(8,X),m(9,Bt)],NJ);var Sgi=class{constructor(i,e,t,o){this.position=i;this.context=e;this.versionId=t;this.providers=o}satisfies(i){return this.position.equals(i.position)&&Qii(this.context.selectedSuggestionInfo,i.context.selectedSuggestionInfo,vY())&&(i.context.triggerKind===0||this.context.triggerKind===1)&&this.versionId===i.versionId&&C8o(i.providers,this.providers)}get isExplicitRequest(){return this.context.triggerKind===1}},Igi=class{constructor(i,e,t){this.context=i;this.requestInfo=e;this.providers=t;this.hasProducedSuggestion=!1}setRequestUuid(i){this.requestUuid=i}setNoSuggestionReasonIfNotSet(i){this.noSuggestionReason??=i}setHasProducedSuggestion(){this.hasProducedSuggestion=!0}};function C8o(a,i){return[...a].every(e=>i.has(e))}var ygi=class{constructor(i,e,t){this.request=i;this.cancellationTokenSource=e;this.promise=t}dispose(){this.cancellationTokenSource.cancel()}},lH=class a extends k{constructor(e,t){super();this.inlineCompletions=e;this.request=t;for(let o of this.inlineCompletions)o.addRef();this._register({dispose:()=>{for(let o of this.inlineCompletions)o.removeRef()}})}static createEmpty(){return new a([],void 0)}_findById(e){return this.inlineCompletions.find(t=>t.identity===e)}_findByHash(e){return this.inlineCompletions.find(t=>t.hash===e)}createStateWithAppliedEdit(e,t){let o=this.inlineCompletions.map(n=>n.withEdit(e,t)).filter(so);return new a(o,this.request)}createStateWithAppliedResults(e,t,o,n,r){let s;if(r){let u=this._findById(r);if(u&&u.canBeReused(o,t.position)){s=u;let p=e.find(h=>h.hash===u.hash);p?e=k8o(p,e):e=[u,...e]}}let l=s?!s.isInlineEdit:e.some(u=>!u.isInlineEdit&&u.isVisible(o,n)),c=[];for(let u of e){let p=this._findByHash(u.hash),h;p&&p!==u?(h=u.withIdentity(p.identity),u.setIsPreceeded(p),p.setEndOfLifeReason({kind:2,userTypingDisagreed:!1,supersededBy:u.getSourceCompletion()})):h=u,l!==h.isInlineEdit&&c.push(h)}return c.sort(Il(u=>u.showInlineEditMenu,yvt)),c=x8o(c,u=>u.semanticId),new a(c,t)}clone(){return new a(this.inlineCompletions,this.request)}};function x8o(a,i){let e=new Set;return a.filter(t=>{let o=i(t);return e.has(o)?!1:(e.add(o),!0)})}function k8o(a,i){let e=i.indexOf(a);return e>-1?[a,...i.slice(0,e),...i.slice(e+1)]:i}var V4=le("IInlineCompletionsService"),aoo=new Y("inlineCompletions.snoozed",!1,d(192,null)),Nue=class extends k{constructor(e,t){super();this._contextKeyService=e;this._telemetryService=t;this._onDidChangeIsSnoozing=this._register(new T);this.onDidChangeIsSnoozing=this._onDidChangeIsSnoozing.event;this._snoozeTimeEnd=void 0;this._recentCompletionIds=[];this._timer=this._register(new Nl);let o=aoo.bindTo(this._contextKeyService);this._register(this.onDidChangeIsSnoozing(()=>o.set(this.isSnoozing())))}static{this.SNOOZE_DURATION=3e5}get snoozeTimeLeft(){return this._snoozeTimeEnd===void 0?0:Math.max(0,this._snoozeTimeEnd-Date.now())}snooze(e=Nue.SNOOZE_DURATION){this.setSnoozeDuration(e+this.snoozeTimeLeft)}setSnoozeDuration(e){if(e<0)throw new ci(`Invalid snooze duration: ${e}. Duration must be non-negative.`);if(e===0){this.cancelSnooze();return}let t=this.isSnoozing(),o=this.snoozeTimeLeft;this._snoozeTimeEnd=Date.now()+e,t||this._onDidChangeIsSnoozing.fire(!0),this._timer.cancelAndSet(()=>{if(!this.isSnoozing())this._onDidChangeIsSnoozing.fire(!1);else throw new ci("Snooze timer did not fire as expected")},this.snoozeTimeLeft+1),this._reportSnooze(e-o,e)}isSnoozing(){return this.snoozeTimeLeft>0}cancelSnooze(){this.isSnoozing()&&(this._reportSnooze(-this.snoozeTimeLeft,0),this._snoozeTimeEnd=void 0,this._timer.cancel(),this._onDidChangeIsSnoozing.fire(!1))}reportNewCompletion(e){this._lastCompletionId=e,this._recentCompletionIds.unshift(e),this._recentCompletionIds.length>5&&this._recentCompletionIds.pop()}_reportSnooze(e,t){let o=Math.round(e/1e3),n=Math.round(t/1e3);this._telemetryService.publicLog2("inlineCompletions.snooze",{deltaSeconds:o,totalSeconds:n,lastCompletionId:this._lastCompletionId,recentCompletionIds:this._recentCompletionIds})}};Nue=I([m(0,X),m(1,_e)],Nue);Ce(V4,Nue,1);var E8o="editor.action.inlineSuggest.snooze",T8o="editor.action.inlineSuggest.cancelSnooze",wgi="inlineCompletions.lastSnoozeDuration",U_t=class a extends z{static{this.ID=E8o}constructor(){super({id:a.ID,title:P(191,"Snooze Inline Suggestions"),precondition:C.true(),f1:!0})}async run(i,...e){let t=i.get($e),o=i.get(V4),n=i.get(de),r;e.length>0&&typeof e[0]=="number"&&(r=e[0]*6e4),r||(r=await this.getDurationFromUser(t,n)),r&&o.setSnoozeDuration(r)}async getDurationFromUser(i,e){let t=e.getNumber(wgi,0,3e5),o=[{label:d(195,null),id:"1",value:6e4},{label:d(197,null),id:"5",value:3e5},{label:d(193,null),id:"10",value:6e5},{label:d(194,null),id:"15",value:9e5},{label:d(196,null),id:"30",value:18e5},{label:d(198,null),id:"60",value:36e5}],n=o;if(t>0&&!o.some(s=>s.value===t)){let s=t/6e4,l={label:d(203,null,s),id:"last-custom",value:t,description:d(204,null)},c=o.findIndex(u=>u.value>t);c===-1?n=[...o,l]:n=[...o.slice(0,c),l,...o.slice(c)]}n.push({label:d(199,null),id:"custom",value:-1});let r=await i.pick(n,{placeHolder:d(205,null),activeItem:n.find(s=>s.value===t)});if(r)return r.id==="custom"?this.getCustomDurationFromUser(i,e):(e.store(wgi,r.value,0,0),r.value)}async getCustomDurationFromUser(i,e){let t=await i.input({placeHolder:d(200,null),prompt:d(201,null),validateInput:async o=>{let n=Number(o);if(isNaN(n)||n<=0||!Number.isFinite(n))return d(202,null)}});if(t){let o=Number(t)*6e4;return e.store(wgi,o,0,0),o}}},z_t=class a extends z{static{this.ID=T8o}constructor(){super({id:a.ID,title:P(190,"Cancel Snooze Inline Suggestions"),precondition:aoo,f1:!0})}async run(i){i.get(V4).cancelSnooze()}};var K_t=class a extends k{constructor(e){super();this._textModel=e;this._typingSessions=[];this._currentSession=null;this._lastChangeTime=0;this._cachedTypingIntervalResult=null;this._cacheInvalidated=!0;this._register(this._textModel.onDidChangeContent(t=>this._updateTypingSpeed(t)))}static{this.MAX_SESSION_GAP_MS=3e3}static{this.MIN_SESSION_DURATION_MS=1e3}static{this.SESSION_HISTORY_LIMIT=50}static{this.TYPING_SPEED_WINDOW_MS=3e5}static{this.MIN_CHARS_FOR_RELIABLE_SPEED=20}getTypingInterval(){return(this._cacheInvalidated||this._cachedTypingIntervalResult===null)&&(this._cachedTypingIntervalResult=this._calculateTypingInterval(),this._cacheInvalidated=!1),this._cachedTypingIntervalResult}_updateTypingSpeed(e){let t=Date.now();if(!this._isUserTyping(e)){this._finalizeCurrentSession();return}this._currentSession&&t-this._lastChangeTime>a.MAX_SESSION_GAP_MS&&this._finalizeCurrentSession(),this._currentSession||(this._currentSession={startTime:t,endTime:t,characterCount:0}),this._currentSession.endTime=t,this._currentSession.characterCount+=this._getActualCharacterCount(e),this._lastChangeTime=t,this._cacheInvalidated=!0}_getActualCharacterCount(e){let t=0;for(let o of e.changes)t+=Math.max(o.text.length,o.rangeLength);return t}_isUserTyping(e){if(!e.detailedReasons||e.detailedReasons.length===0)return!1;for(let t of e.detailedReasons)if(this._isUserTypingReason(t))return!0;return!1}_isUserTypingReason(e){if(e.metadata.isUndoing||e.metadata.isRedoing)return!1;if(e.metadata.source==="cursor"){let t=e.metadata.kind;return t==="type"||t==="compositionType"||t==="compositionEnd"}else return!1}_finalizeCurrentSession(){if(!this._currentSession)return;this._currentSession.endTime-this._currentSession.startTime>=a.MIN_SESSION_DURATION_MS&&this._currentSession.characterCount>0&&(this._typingSessions.push(this._currentSession),this._typingSessions.length>a.SESSION_HISTORY_LIMIT&&this._typingSessions.shift()),this._currentSession=null}_calculateTypingInterval(){if(this._currentSession){let e={...this._currentSession};if(e.endTime-e.startTime>=a.MIN_SESSION_DURATION_MS&&e.characterCount>0){let o=[...this._typingSessions,e];return this._calculateSpeedFromSessions(o)}}return this._calculateSpeedFromSessions(this._typingSessions)}_calculateSpeedFromSessions(e){if(e.length===0)return{averageInterval:0,characterCount:0};let t=[...e].sort((p,h)=>h.endTime-p.endTime),o=Date.now()-a.TYPING_SPEED_WINDOW_MS,n=t.filter(p=>p.endTime>o),r=t.splice(n.length),s=Fye(n.map(p=>p.characterCount));for(let p=0;p<r.length&&s<a.MIN_CHARS_FOR_RELIABLE_SPEED;p++)n.push(r[p]),s+=r[p].characterCount;let l=Fye(n.map(p=>p.endTime-p.startTime));if(l===0||s<=1)return{averageInterval:0,characterCount:s};let c=Math.max(1,s-1),u=l/c;return{averageInterval:Math.round(u),characterCount:s}}reset(){this._typingSessions.length=0,this._currentSession=null,this._lastChangeTime=0,this._cachedTypingIntervalResult=null,this._cacheInvalidated=!0}dispose(){this._finalizeCurrentSession(),super.dispose()}};var SM={copilotSettings:"settings/copilot/features",billingBudgets:"settings/billing/budgets?utm_source=vscode"},Nd=le("defaultAccountService");var loo;function G_t(a){return loo?.(a)??null}function coo(a){loo=a}var dTe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.textModel=e;this._selectedSuggestItem=t;this._textModelVersionId=o;this._positions=n;this._debounceValue=r;this._enabled=s;this._editor=l;this._instantiationService=c;this._commandService=u;this._languageConfigurationService=p;this._accessibilityService=h;this._languageFeaturesService=g;this._codeEditorService=f;this._inlineCompletionsService=v;this._isActive=De(this,!1);this._onlyRequestInlineEditsSignal=zc(this);this._forceUpdateExplicitlySignal=zc(this);this._noDelaySignal=zc(this);this._fetchSpecificProviderSignal=zc(this);this._selectedInlineCompletionId=De(this,void 0);this.primaryPosition=ke(this,e=>this._positions.read(e)[0]??new ye(1,1));this.allPositions=ke(this,e=>this._positions.read(e));this.sku=De(this,void 0);this._isAcceptingPartially=!1;this._appearedInsideViewport=ke(this,e=>{let t=this.state.read(e);return!t||!t.inlineSuggestion?!1:Egi(this._editor,t.inlineSuggestion,e)});this._onDidAccept=this._register(new T);this.onDidAccept=this._onDidAccept.event;this._lastShownInlineCompletionInfo=void 0;this._lastAcceptedInlineCompletionInfo=void 0;this._didUndoInlineEdits=Ewe({owner:this,changeTracker:{createChangeSummary:()=>({didUndo:!1}),handleChange:(e,t)=>(t.didUndo=e.didChange(this._textModelVersionId)&&!!e.change?.isUndoing,!0)}},(e,t)=>{let o=this._textModelVersionId.read(e);return o!==null&&this._lastAcceptedInlineCompletionInfo&&this._lastAcceptedInlineCompletionInfo.textModelVersionIdAfter===o-1&&this._lastAcceptedInlineCompletionInfo.inlineCompletion.isInlineEdit&&t.didUndo?(this._lastAcceptedInlineCompletionInfo=void 0,!0):!1});this._preserveCurrentCompletionReasons=new Set([1,0,2]);this.dontRefetchSignal=zc(this);this._fetchInlineCompletionsPromise=Ewe({owner:this,changeTracker:{createChangeSummary:()=>({dontRefetch:!1,preserveCurrentCompletion:!1,inlineCompletionTriggerKind:0,onlyRequestInlineEdits:!1,shouldDebounce:!0,provider:void 0,changeHint:void 0,textChange:!1,changeReason:""}),handleChange:(e,t)=>{if(e.didChange(this._textModelVersionId)){this._preserveCurrentCompletionReasons.has(this._getReason(e.change))&&(t.preserveCurrentCompletion=!0);let o=e.change?.detailedReasons??[];t.changeReason=o.length>0?o[0].getType():"",t.textChange=!0}else e.didChange(this._forceUpdateExplicitlySignal)?(t.preserveCurrentCompletion=!0,t.inlineCompletionTriggerKind=1):e.didChange(this.dontRefetchSignal)?t.dontRefetch=!0:e.didChange(this._onlyRequestInlineEditsSignal)?t.onlyRequestInlineEdits=!0:e.didChange(this._fetchSpecificProviderSignal)&&(t.provider=e.change?.provider,t.changeHint=e.change?.changeHint);return!0}}},(e,t)=>{if(this._source.clearOperationOnTextModelChange.read(e),this._noDelaySignal.read(e),this.dontRefetchSignal.read(e),this._onlyRequestInlineEditsSignal.read(e),this._forceUpdateExplicitlySignal.read(e),this._fetchSpecificProviderSignal.read(e),!((this._enabled.read(e)&&this._selectedSuggestItem.read(e)||this._isActive.read(e))&&(!this._inlineCompletionsService.isSnoozing()||t.inlineCompletionTriggerKind===1))){this._source.cancelUpdate();return}this._textModelVersionId.read(e);let n=this._source.suggestWidgetInlineCompletions.read(void 0),r=this._selectedSuggestItem.read(e);if(this._shouldShowOnSuggestConflict.read(void 0)&&(r=void 0),n&&!r&&this._source.seedInlineCompletionsWithSuggestWidget(),t.dontRefetch)return Promise.resolve(!0);if(this._didUndoInlineEdits.read(e)&&t.inlineCompletionTriggerKind!==1){Ki(b=>{this._source.clear(b)});return}let s="";t.provider?s+="providerOnDidChange":t.inlineCompletionTriggerKind===1&&(s+="explicit"),t.changeReason&&(s+=s.length>0?`:${t.changeReason}`:t.changeReason);let l=this._typing.getTypingInterval(),c={editorType:this.editorType,startTime:Date.now(),languageId:this.textModel.getLanguageId(),reason:s,typingInterval:l.averageInterval,typingIntervalCharacterCount:l.characterCount,availableProviders:[],sku:this.sku.read(void 0)},u={triggerKind:t.inlineCompletionTriggerKind,selectedSuggestionInfo:r?.toSelectedSuggestionInfo(),includeInlineCompletions:!t.onlyRequestInlineEdits,includeInlineEdits:this._inlineEditsEnabled.read(e),requestIssuedDateTime:c.startTime,earliestShownDateTime:c.startTime+(t.inlineCompletionTriggerKind===1||this.inAcceptFlow.read(void 0)?0:this._minShowDelay.read(void 0)),changeHint:t.changeHint};u.triggerKind===0&&t.textChange&&this.textModel.getAlternativeVersionId()===this._lastShownInlineCompletionInfo?.alternateTextModelVersionId&&(u={...u,includeInlineCompletions:!this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit,includeInlineEdits:this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit});let p=this.selectedInlineCompletion.read(void 0)??this._inlineSuggestionItems.read(void 0)?.inlineEdit,h=t.preserveCurrentCompletion||p?.forwardStable?p:void 0,g=this._jumpedToId.map(b=>!!b&&b===this._inlineSuggestionItems.read(void 0)?.inlineEdit?.semanticId),f=t.provider?{providers:[t.provider],label:"single:"+t.provider.providerId?.toString()}:{providers:this._languageFeaturesService.inlineCompletionsProvider.all(this.textModel),label:void 0},v=this.getAvailableProviders(f.providers);return c.availableProviders=v.map(b=>b.providerId).filter(so),this._source.fetch(v,f.label,u,h?.identity,t.shouldDebounce,g,c)});this._inlineSuggestionItems=Js({owner:this},e=>{let t=this._source.inlineCompletions.read(e);if(!t)return;let o=this.primaryPosition.read(e),n,r=[];for(let s of t.inlineCompletions)s.isInlineEdit?n=s:s.isVisible(this.textModel,o)&&r.push(s);return r.length!==0&&(n=void 0),{inlineCompletions:r,inlineEdit:n}});this._inlineCompletionItems=Js({owner:this,equalsFn:rF()},e=>this._inlineSuggestionItems.read(e)?.inlineCompletions??[]);this.selectedInlineCompletionIndex=ke(this,e=>{let t=this._selectedInlineCompletionId.read(e),o=this._inlineCompletionItems.read(e),n=this._selectedInlineCompletionId===void 0?-1:o.findIndex(r=>r.semanticId===t);return n===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):n});this.selectedInlineCompletion=ke(this,e=>{let t=this._inlineCompletionItems.read(e),o=this.selectedInlineCompletionIndex.read(e);return t[o]});this.activeCommands=Js({owner:this,equalsFn:rF()},e=>this.selectedInlineCompletion.read(e)?.source.inlineSuggestions.commands??[]);this.inlineCompletionsCount=ke(this,e=>{if(this.lastTriggerKind.read(e)===1)return this._inlineCompletionItems.read(e).length});this._hasVisiblePeekWidgets=ke(this,e=>this._editorObs.openedPeekWidgets.read(e)>0);this._shouldShowOnSuggestConflict=ke(this,e=>{let t=this._showOnSuggestConflict.read(e);if(t!=="never"&&!!this.selectedInlineCompletion.read(e)){let n=this._selectedSuggestItem.read(e);return n?t==="whenSuggestListIsIncomplete"?n.listIncomplete:!0:!1}return!1});this.state=Js({owner:this,equalsFn:(e,t)=>!e||!t?e===t:e.kind==="ghostText"&&t.kind==="ghostText"?Xhi(e.ghostTexts,t.ghostTexts)&&e.inlineSuggestion===t.inlineSuggestion&&e.suggestItem===t.suggestItem:e.kind==="inlineEdit"&&t.kind==="inlineEdit"?e.inlineSuggestion===t.inlineSuggestion:!1},e=>{let t=this.textModel;if(this._suppressInSnippetMode.read(e)&&this._isInSnippetMode.read(e))return;let o=this._inlineSuggestionItems.read(e),n=o?.inlineEdit;if(n){if(this._hasVisiblePeekWidgets.read(e))return;let s=this.primaryPosition.map(p=>vo.fromRangeInclusive(n.targetRange).addMargin(1,1).contains(p.lineNumber)),l=n.action?.kind==="edit"?n.action.stringEdit:void 0,c=l?lm.fromStringEdit(l,new aM(this.textModel)).replacements:[],u=(o.inlineEdit?.command?.id==="vscode.open"||o.inlineEdit?.command?.id==="_workbench.open")&&o.inlineEdit?.command.arguments?.length?A.from(o.inlineEdit?.command.arguments[0]):void 0;return n.originalTextRef.targets(this.textModel)||(u=n.originalTextRef.uri),{kind:"inlineEdit",inlineSuggestion:n,edits:c,cursorAtInlineEdit:s,nextEditUri:u}}let r=this._selectedSuggestItem.read(e);if(!this._shouldShowOnSuggestConflict.read(e)&&r){let s=UA(r.getSingleTextEdit(),t),l=this._computeAugmentation(s,e);if(!this._suggestPreviewEnabled.read(e)&&!l)return;let u=l?.edit??s,p=l?l.edit.text.length-s.text.length:0,h=this._suggestPreviewMode.read(e),g=this._positions.read(e),v=[u,...Cgi(this.textModel,g,u)].map((w,x)=>({edit:w,ghostText:w?Zhi(w,t,h,g[x],p):void 0})).filter(({edit:w,ghostText:x})=>w!==void 0&&x!==void 0),b=v.map(({edit:w})=>w),S=v.map(({ghostText:w})=>w),y=S[0]??new h2(u.range.endLineNumber,[]);return{kind:"ghostText",edits:b,primaryGhostText:y,ghostTexts:S,inlineSuggestion:l?.completion,suggestItem:r}}else{if(!this._isActive.read(e))return;let s=this.selectedInlineCompletion.read(e);if(!s)return;let l=s.getSingleTextEdit(),c=this._inlineSuggestMode.read(e),u=this._positions.read(e),h=[l,...Cgi(this.textModel,u,l)].map((v,b)=>({edit:v,ghostText:v?Zhi(v,t,c,u[b],0):void 0})).filter(({edit:v,ghostText:b})=>v!==void 0&&b!==void 0),g=h.map(({edit:v})=>v),f=h.map(({ghostText:v})=>v);return f[0]?{kind:"ghostText",edits:g,primaryGhostText:f[0],ghostTexts:f,inlineSuggestion:s,suggestItem:void 0}:void 0}});this.status=ke(this,e=>{if(this._source.loading.read(e))return"loading";let t=this.state.read(e);return t?.kind==="ghostText"?"ghostText":t?.kind==="inlineEdit"?"inlineEdit":"noSuggestion"});this.inlineCompletionState=ke(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!=="ghostText")&&!this._editorObs.inComposition.read(e))return t});this.inlineEditState=ke(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!=="inlineEdit"))return t});this.inlineEditAvailable=ke(this,e=>!!this.inlineEditState.read(e));this.warning=ke(this,e=>this.inlineCompletionState.read(e)?.inlineSuggestion?.warning);this.ghostTexts=Js({owner:this,equalsFn:Xhi},e=>{let t=this.inlineCompletionState.read(e);if(t)return t.ghostTexts});this.primaryGhostText=Js({owner:this,equalsFn:Jhi},e=>{let t=this.inlineCompletionState.read(e);if(t)return t?.primaryGhostText});this.showCollapsed=ke(this,e=>{let t=this.state.read(e);if(!t||t.kind!=="inlineEdit"||t.inlineSuggestion.hint||t.inlineSuggestion.action?.kind==="jumpTo")return!1;let o=t.inlineSuggestion.updatedEditModelVersion===this._textModelVersionId.read(e);return(this._inlineEditsShowCollapsedEnabled.read(e)||!o)&&this._jumpedToId.read(e)!==t.inlineSuggestion.semanticId&&!this._inAcceptFlow.read(e)});this._tabShouldIndent=ke(this,e=>{if(this._inAcceptFlow.read(e))return!1;function t(r){return r.startLineNumber!==r.endLineNumber}function o(r,s){let l=r.getLineIndentColumn(s),c=r.getLineLastNonWhitespaceColumn(s),u=Math.max(c,l);return new G(s,l,s,u)}return this._editorObs.selections.read(e)?.some(r=>r.isEmpty()?this.textModel.getLineLength(r.startLineNumber)===0:t(r)||r.containsRange(o(this.textModel,r.startLineNumber)))});this.tabShouldJumpToInlineEdit=ke(this,e=>{if(this._tabShouldIndent.read(e))return!1;let t=this.inlineEditState.read(e);return t?t.inlineSuggestion.action?.kind==="jumpTo"||this.showCollapsed.read(e)?!0:this._inAcceptFlow.read(e)&&this._appearedInsideViewport.read(e)?!1:!t.cursorAtInlineEdit.read(e):!1});this.tabShouldAcceptInlineEdit=ke(this,e=>{let t=this.inlineEditState.read(e);return!t||t.inlineSuggestion.action?.kind==="jumpTo"||this.showCollapsed.read(e)||this._tabShouldIndent.read(e)?!1:this._inAcceptFlow.read(e)&&this._appearedInsideViewport.read(e)||t.inlineSuggestion.targetRange.startLineNumber===this._editorObs.cursorLineNumber.read(e)||this._jumpedToId.read(e)===t.inlineSuggestion.semanticId?!0:t.cursorAtInlineEdit.read(e)});this._jumpedToId=De(this,void 0);this._inAcceptFlow=De(this,!1);this.inAcceptFlow=this._inAcceptFlow;this._source=this._register(this._instantiationService.createInstance(NJ,this.textModel,this._textModelVersionId,this._debounceValue,this.primaryPosition)),this.lastTriggerKind=this._source.inlineCompletions.map(this,M=>M?.request?.context.triggerKind),this._editorObs=Ds(this._editor);let S=this._editorObs.getOption(134);this._suggestPreviewEnabled=S.map(M=>M.preview),this._suggestPreviewMode=S.map(M=>M.previewMode);let y=this._editorObs.getOption(71);this._inlineSuggestMode=y.map(M=>M.mode),this._suppressedInlineCompletionGroupIds=y.map(M=>new Set(M.experimental.suppressInlineSuggestions.split(","))),this._inlineEditsEnabled=y.map(M=>!!M.edits.enabled),this._inlineEditsShowCollapsedEnabled=y.map(M=>M.edits.showCollapsed),this._triggerCommandOnProviderChange=y.map(M=>M.triggerCommandOnProviderChange),this._minShowDelay=y.map(M=>M.minShowDelay),this._showOnSuggestConflict=y.map(M=>M.experimental.showOnSuggestConflict),this._suppressInSnippetMode=y.map(M=>M.suppressInSnippetMode);let w=ss.get(this._editor);this._isInSnippetMode=w?.isInSnippetObservable??Fo(!1),b.getDefaultAccount().then(D8o(M=>this.sku.set(doo(M),void 0),this._store)),this._register(b.onDidChangeDefaultAccount(M=>this.sku.set(doo(M),void 0))),this._typing=this._register(new K_t(this.textModel)),this._register(this._inlineCompletionsService.onDidChangeIsSnoozing(M=>{M&&this.stop()}));{let M=this.textModel.uri.scheme===Q.vscodeNotebookCell,[N]=this._codeEditorService.listDiffEditors().filter(V=>V.getOriginalEditor().getId()===this._editor.getId()||V.getModifiedEditor().getId()===this._editor.getId());this.isInDiffEditor=!!N,this.editorType=M?"notebook":this.isInDiffEditor?"diffEditor":"textEditor"}this._register(bA(this.state,M=>{M&&M.inlineSuggestion&&this._inlineCompletionsService.reportNewCompletion(M.inlineSuggestion.requestUuid)})),this._register(bA(this._fetchInlineCompletionsPromise)),this._register(ve(M=>{this._editorObs.versionId.read(M),this._inAcceptFlow.set(!1,void 0)})),this._register(ve(M=>{this.state.map((V,H)=>!V||V.kind==="inlineEdit"&&!V.cursorAtInlineEdit.read(H)).read(M)&&this._jumpedToId.set(void 0,void 0)})),this._register(ve(M=>{let N=this.state.map(V=>V?.inlineSuggestion).read(M);N&&N.addPerformanceMarker("activeSuggestion")}));let x=this.inlineEditState.map(M=>M?.inlineSuggestion.semanticId);this._register(ve(M=>{x.read(M)&&(this._editor.pushUndoStop(),this._lastShownInlineCompletionInfo={alternateTextModelVersionId:this.textModel.getAlternativeVersionId(),inlineCompletion:this.state.get().inlineSuggestion})}));let E=vi(this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.all(e));Pb(this,E,(M,N)=>{M.onDidChangeInlineCompletions&&N.add(M.onDidChangeInlineCompletions(V=>{if(!this._enabled.get()||(this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor())!==this._editor)return;if(this._triggerCommandOnProviderChange.get()){this.trigger(void 0,{onlyFetchInlineEdits:!0});return}let K=this.state.get();K&&(K.inlineSuggestion||K.edits)&&K.inlineSuggestion?.source.provider!==M||Ki(j=>{this._fetchSpecificProviderSignal.trigger(j,{provider:M,changeHint:V??void 0}),this.trigger(j)})}))}).recomputeInitiallyAndOnChange(this._store),this._didUndoInlineEdits.recomputeInitiallyAndOnChange(this._store)}get isAcceptingPartially(){return this._isAcceptingPartially}get editor(){return this._editor}debugGetSelectedSuggestItem(){return this._selectedSuggestItem}getIndentationInfo(e){let t=!1,o=!0,n=this?.primaryGhostText.read(e);if(this?._selectedSuggestItem&&n&&n.parts.length>0){let{column:r,lines:s}=n.parts[0],l=s[0].line,c=this.textModel.getLineIndentColumn(n.lineNumber);if(r<=c){let p=Em(l);p===-1&&(p=l.length-1),t=p>0;let h=this.textModel.getOptions().tabSize;o=Ll.visibleColumnFromColumn(l,p+1,h)<h}}return{startsWithIndentation:t,startsWithIndentationLessThanTabSize:o}}_getReason(e){return e?.isUndoing?0:e?.isRedoing?1:this.isAcceptingPartially?2:3}getAvailableProviders(e){let t=this._suppressedInlineCompletionGroupIds.get(),o=e.filter(s=>!(s.groupId&&t.has(s.groupId))),n=new Set;for(let s of o)s.excludesGroupIds?.forEach(l=>n.add(l));let r=[];for(let s of o)s.groupId&&n.has(s.groupId)||r.push(s);return r}async trigger(e,t={}){aF(e,o=>{t.onlyFetchInlineEdits&&this._onlyRequestInlineEditsSignal.trigger(o),t.noDelay&&this._noDelaySignal.trigger(o),this._isActive.set(!0,o),t.explicit&&(this._inAcceptFlow.set(!0,o),this._forceUpdateExplicitlySignal.trigger(o)),t.provider&&this._fetchSpecificProviderSignal.trigger(o,{provider:t.provider,changeHint:t.changeHint})}),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e,t=!1){return this.trigger(e,{onlyFetchInlineEdits:t,explicit:!0})}stop(e="automatic",t){aF(t,o=>{if(e==="explicitCancel"){let n=this.state.get()?.inlineSuggestion;n&&n.reportEndOfLife({kind:1})}this._isActive.set(!1,o),this._source.clear(o)})}_computeAugmentation(e,t){let o=this.textModel,n=this._source.suggestWidgetInlineCompletions.read(t),r=n?n.inlineCompletions.filter(l=>!l.isInlineEdit):[this.selectedInlineCompletion.read(t)].filter(so);return iD(r,l=>{let c=l.getSingleTextEdit();return c=UA(c,o,G.fromPositions(c.range.getStartPosition(),e.range.getEndPosition())),D_t(c,e)?{completion:l,edit:c}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();let t=this._inlineCompletionItems.get()||[];if(t.length>0){let o=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[o].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}_getMetadata(e,t,o=void 0){return o?sd.inlineCompletionPartialAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,providerId:e.source.provider.providerId,languageId:t,type:o,correlationId:e.getSourceCompletion().correlationId}):sd.inlineCompletionAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,correlationId:e.getSourceCompletion().correlationId,providerId:e.source.provider.providerId,languageId:t})}async accept(e=this._editor,t=!1){if(e.getModel()!==this.textModel)throw new ci;let o,n=!1,r=this.state.get();if(r?.kind==="ghostText"){if(!r||r.primaryGhostText.isEmpty()||!r.inlineSuggestion)return;o=r.inlineSuggestion}else if(r?.kind==="inlineEdit")o=r.inlineSuggestion,n=!!r.nextEditUri;else return;o.addRef();try{let s=!1;if(e.pushUndoStop(),o.originalTextRef.targets(this.textModel)){if(!n){if(o.action?.kind==="edit"){let l=o.action;if(t&&l.alternativeAction){s=!0;let c=l.alternativeAction.command;await this._commandService.executeCommand(c.id,...c.arguments||[]).then(void 0,vs)}else if(l.snippetInfo){let c=ys.delete(l.textReplacement.range),u=o.additionalTextEdits.map(h=>new ys(G.lift(h.range),h.text??"")),p=lm.fromParallelReplacementsUnsorted([c,...u]);e.edit(p,this._getMetadata(o,this.textModel.getLanguageId())),e.setPosition(l.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),ss.get(e)?.insert(l.snippetInfo.snippet,{undoStopBefore:!1})}else{let c=r.edits,u=c;r.kind==="ghostText"&&(u=$io(c,this.textModel));let p=Qhi(u).map(f=>ei.fromPositions(f)),h=o.additionalTextEdits.map(f=>new ys(G.lift(f.range),f.text??"")),g=lm.fromParallelReplacementsUnsorted([...c,...h]);if(e.edit(g,this._getMetadata(o,this.textModel.getLanguageId())),o.hint===void 0&&e.setSelections(r.kind==="inlineEdit"?p.slice(-1):p,"inlineCompletionAccept"),r.kind==="inlineEdit"&&!this._accessibilityService.isMotionReduced()){let f=g.getNewRanges(),v=this._store.add(new xgi(e,f,()=>{this._store.delete(v)}))}}}}}else{let l=await this._codeEditorService.openCodeEditor({resource:o.originalTextRef.uri},this._editor);if(l){let u=G_t(l)?.model.get();l.focus(),u?.transplantCompletion(o),l.revealLineInCenter(o.targetRange.startLineNumber)}}this._onDidAccept.fire(),this.stop(),o.command&&await this._commandService.executeCommand(o.command.id,...o.command.arguments||[]).then(void 0,vs),s&&this.trigger(void 0),o.reportEndOfLife({kind:0,alternativeAction:t})}finally{o.removeRef(),this._inAcceptFlow.set(!0,void 0),this._lastAcceptedInlineCompletionInfo={textModelVersionIdAfter:this.textModel.getVersionId(),inlineCompletion:o}}}async acceptNextWord(){await this._acceptNext(this._editor,"word",(e,t)=>{let o=this.textModel.getLanguageIdAtPosition(e.lineNumber,e.column),n=this._languageConfigurationService.getLanguageConfiguration(o),r=new RegExp(n.wordDefinition.source,n.wordDefinition.flags.replace("g","")),s=t.match(r),l=0;s&&s.index!==void 0?s.index===0?l=s[0].length:l=s.index:l=t.length;let u=/\s+/g.exec(t);return u&&u.index!==void 0&&u.index+u[0].length<l&&(l=u.index+u[0].length),l},0)}async acceptNextLine(){await this._acceptNext(this._editor,"line",(e,t)=>{let o=t.match(/\n/);return o&&o.index!==void 0?o.index+1:t.length},1)}async _acceptNext(e,t,o,n){if(e.getModel()!==this.textModel)throw new ci;let r=this.inlineCompletionState.get();if(!r||r.primaryGhostText.isEmpty()||!r.inlineSuggestion)return;let s=r.primaryGhostText,l=r.inlineSuggestion;if(l.snippetInfo){await this.accept(e);return}let c=s.parts[0],u=new ye(s.lineNumber,c.column),p=c.text,h=o(u,p);if(h===p.length&&s.parts.length===1){this.accept(e);return}let g=p.substring(0,h),f=this._positions.get(),v=f[0];l.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();let w=G.fromPositions(v,u),x=e.getModel().getValueInRange(w)+g,E=new ys(w,x),M=[E,...Cgi(this.textModel,f,E)].filter(so),N=Qhi(M).map(V=>ei.fromPositions(V));e.edit(lm.fromParallelReplacementsUnsorted(M),this._getMetadata(l,t)),e.setSelections(N,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),0)}finally{this._isAcceptingPartially=!1}let b=G.fromPositions(l.editRange.getStartPosition(),Rc.ofText(g).addToPosition(u)),y=e.getModel().getValueInRange(b,1).length;l.reportPartialAccept(y,{kind:n,acceptedLength:y},{characters:h,ratio:h/p.length,count:1})}finally{l.removeRef()}}handleSuggestAccepted(e){let t=UA(e.getSingleTextEdit(),this.textModel),o=this._computeAugmentation(t,void 0);if(!o)return;let r=this.textModel.getValueInRange(o.completion.editRange,1).length+t.text.length;o.completion.reportPartialAccept(t.text.length,{kind:2,acceptedLength:r},{characters:t.text.length,count:1,ratio:1})}extractReproSample(){let e=this.textModel.getValue(),t=this.state.get()?.inlineSuggestion;return{documentValue:e,inlineCompletion:t?.getSourceCompletion()}}jump(){let e=this.inlineEditState.get();if(!e)return;let t=e.inlineSuggestion;if(!t.originalTextRef.targets(this.textModel)){this.accept(this._editor);return}t.addRef();try{Ki(o=>{t.action?.kind==="jumpTo"&&(this.stop(void 0,o),t.reportEndOfLife({kind:0,alternativeAction:!1})),this._jumpedToId.set(e.inlineSuggestion.semanticId,o),this.dontRefetchSignal.trigger(o);let n=e.inlineSuggestion.targetRange,r=n.getStartPosition();if(this._editor.setPosition(r,"inlineCompletions.jump"),n.isSingleLine()&&(e.inlineSuggestion.hint||e.inlineSuggestion.action?.kind==="edit"&&!e.inlineSuggestion.action.textReplacement.text.includes(`
`))||e.inlineSuggestion.action?.kind==="jumpTo")this._editor.revealPosition(r,0);else{let l=new G(n.startLineNumber-1,1,n.endLineNumber+1,1);this._editor.revealRange(l,0)}e.inlineSuggestion.identity.setJumpTo(o),this._editor.focus()})}finally{t.removeRef()}}async handleInlineSuggestionShown(e,t,o,n){await e.reportInlineEditShown(this._commandService,t,o,this.textModel,n)}transplantCompletion(e){e.addRef(),Ki(t=>{this._source.seedWithCompletion(e,t),this._isActive.set(!0,t),this._inAcceptFlow.set(!0,t),this.dontRefetchSignal.trigger(t)})}};dTe=I([m(7,F),m(8,fe),m(9,Us),m(10,Ai),m(11,Jt),m(12,Qt),m(13,V4),m(14,Nd)],dTe);function Cgi(a,i,e){if(i.length===1)return[];let t=new aM(a),o=t.getTransformer(),n=o.getOffset(i[0]),r=i.slice(1).map(h=>o.getOffset(h));e=e.removeCommonPrefixAndSuffix(t);let s=o.getStringReplacement(e),l=s.replaceRange.start-n,c=s.replaceRange.join(gi.emptyAt(n)),u=t.getValueOfOffsetRange(c);return r.map(h=>{let g=h+l,f=g+s.replaceRange.length,v=new gi(g,f),b=v.join(gi.emptyAt(h));if(t.getValueOfOffsetRange(b)!==u)return;let y=new xd(v,s.newText);return o.getTextReplacement(y)}).filter(so)}var xgi=class extends k{constructor(i,e,t){super(),t&&this._register({dispose:()=>t()}),this._register(Ds(i).setDecorations(Fo(e.map(n=>({range:n,options:{description:"animation",className:"edits-fadeout-decoration",zIndex:1}})))));let o=new __t(S9e.startNow(1,0,1e3,Yio));this._register(ve(n=>{let r=o.getValue(n);i.getContainerDomNode().style.setProperty("--animation-opacity",r.toString()),o.isFinished(n)&&this.dispose()}))}};function Egi(a,i,e=void 0){let t=i.targetRange;Ds(a).scrollTop.read(e);let o=a.getVisibleRanges();return o.length<1?!1:new G(o[0].startLineNumber,o[0].startColumn,o[o.length-1].endLineNumber,o[o.length-1].endColumn).containsRange(t)}function doo(a){if(a?.entitlementsData?.access_type_sku&&a?.entitlementsData?.copilot_plan)return{type:a.entitlementsData.access_type_sku,plan:a.entitlementsData.copilot_plan}}var kgi=class{constructor(i){this.handler=i=>this._cb?.(i);this._cb=i}dispose(){this._cb=void 0}};function D8o(a,i){let e=new kgi(a);return i.add(e),e.handler}var x9e=class{constructor(i){this.name=i}select(i,e,t){if(t.length===0)return 0;let o=t[0].score[0];for(let n=0;n<t.length;n++){let{score:r,completion:s}=t[n];if(r[0]!==o)break;if(s.preselect)return n}return 0}},q_t=class extends x9e{constructor(){super("first")}memorize(i,e,t){}toJSON(){}fromJSON(){}},Tgi=class extends x9e{constructor(){super("recentlyUsed");this._cache=new Ua(300,.66);this._seq=0}memorize(e,t,o){let n=`${e.getLanguageId()}/${o.textLabel}`;this._cache.set(n,{touch:this._seq++,type:o.completion.kind,insertText:o.completion.insertText})}select(e,t,o){if(o.length===0)return 0;let n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,o);let r=o[0].score[0],s=-1,l=-1,c=-1;for(let u=0;u<o.length&&o[u].score[0]===r;u++){let p=`${e.getLanguageId()}/${o[u].textLabel}`,h=this._cache.peek(p);if(h&&h.touch>c&&h.type===o[u].completion.kind&&h.insertText===o[u].completion.insertText&&(c=h.touch,l=u),o[u].completion.preselect&&s===-1)return s=u}return l!==-1?l:s!==-1?s:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();let t=0;for(let[o,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:Kz.fromString(n.type),this._cache.set(o,n);this._seq=this._cache.size}},_gi=class extends x9e{constructor(){super("recentlyUsedByPrefix");this._trie=Hp.forStrings();this._seq=0}memorize(e,t,o){let{word:n}=e.getWordUntilPosition(t),r=`${e.getLanguageId()}/${n}`;this._trie.set(r,{type:o.completion.kind,insertText:o.completion.insertText,touch:this._seq++})}select(e,t,o){let{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,o);let r=`${e.getLanguageId()}/${n}`,s=this._trie.get(r);if(s||(s=this._trie.findSubstr(r)),s)for(let l=0;l<o.length;l++){let{kind:c,insertText:u}=o[l].completion;if(c===s.type&&u===s.insertText)return l}return super.select(e,t,o)}toJSON(){let e=[];return this._trie.forEach((t,o)=>e.push([o,t])),e.sort((t,o)=>-(t[1].touch-o[1].touch)).forEach((t,o)=>t[1].touch=o),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(let[t,o]of e)o.type=typeof o.type=="number"?o.type:Kz.fromString(o.type),this._trie.set(t,o)}}},B4=class{constructor(i,e){this._storageService=i;this._configService=e;this._disposables=new O;this._persistSoon=new Dt(()=>this._saveState(),500),this._disposables.add(i.onWillSaveState(t=>{t.reason===1&&this._saveState()}))}static{this._strategyCtors=new Map([["recentlyUsedByPrefix",_gi],["recentlyUsed",Tgi],["first",q_t]])}static{this._storagePrefix="suggest/memories"}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(i,e,t){this._withStrategy(i,e).memorize(i,e,t),this._persistSoon.schedule()}select(i,e,t){return this._withStrategy(i,e).select(i,e,t)}_withStrategy(i,e){let t=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:i.getLanguageIdAtPosition(e.lineNumber,e.column),resource:i.uri});if(this._strategy?.name!==t){this._saveState();let o=B4._strategyCtors.get(t)||q_t;this._strategy=new o;try{let r=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,s=this._storageService.get(`${B4._storagePrefix}/${t}`,r);s&&this._strategy.fromJSON(JSON.parse(s))}catch{}}return this._strategy}_saveState(){if(this._strategy){let e=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,t=JSON.stringify(this._strategy);this._storageService.store(`${B4._storagePrefix}/${this._strategy.name}`,t,e,1)}}};B4=I([m(0,de),m(1,B)],B4);var uTe=le("ISuggestMemories");Ce(uTe,B4,1);var H4=class{constructor(i,e){this._editor=i;this._enabled=!1;this._ckAtEnd=H4.AtEnd.bindTo(e),this._configListener=this._editor.onDidChangeConfiguration(t=>t.hasChanged(139)&&this._update()),this._update()}static{this.AtEnd=new Y("atEndOfWord",!1,{type:"boolean",description:d(1669,null)})}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){let i=this._editor.getOption(139)==="on";if(this._enabled!==i)if(this._enabled=i,this._enabled){let e=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}let t=this._editor.getModel(),o=this._editor.getSelection(),n=t.getWordAtPosition(o.getStartPosition());if(!n){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(n.endColumn===o.getStartPosition().column&&o.getStartPosition().lineNumber===o.getEndPosition().lineNumber)};this._selectionListener=this._editor.onDidChangeCursorSelection(e),e()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};H4=I([m(1,X)],H4);var zA=class{constructor(i,e){this._editor=i;this._index=0;this._ckOtherSuggestions=zA.OtherSuggestions.bindTo(e)}static{this.OtherSuggestions=new Y("hasOtherSuggestions",!1)}dispose(){this.reset()}reset(){this._ckOtherSuggestions.reset(),this._listener?.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:i,index:e},t){if(i.items.length===0){this.reset();return}if(zA._moveIndex(!0,i,e)===e){this.reset();return}this._acceptNext=t,this._model=i,this._index=e,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(i,e,t){let o=t;for(let n=e.items.length;n>0&&(o=(o+e.items.length+(i?1:-1))%e.items.length,!(o===t||!e.items[o].completion.additionalTextEdits));n--);return o}next(){this._move(!0)}prev(){this._move(!1)}_move(i){if(this._model)try{this._ignore=!0,this._index=zA._moveIndex(i,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};zA=I([m(1,X)],zA);var pTe=class a{async provideSelectionRanges(i,e){let t=[];for(let o of e){let n=[];t.push(n);let r=new Map;await new Promise(s=>a._bracketsRightYield(s,0,i,o,r)),await new Promise(s=>a._bracketsLeftYield(s,0,i,o,r,n))}return t}static{this._maxDuration=30}static{this._maxRounds=2}static _bracketsRightYield(i,e,t,o,n){let r=new Map,s=Date.now();for(;;){if(e>=a._maxRounds){i();break}if(!o){i();break}let l=t.bracketPairs.findNextBracket(o);if(!l){i();break}if(Date.now()-s>a._maxDuration){setTimeout(()=>a._bracketsRightYield(i,e+1,t,o,n));break}if(l.bracketInfo.isOpeningBracket){let u=l.bracketInfo.bracketText,p=r.has(u)?r.get(u):0;r.set(u,p+1)}else{let u=l.bracketInfo.getOpeningBrackets()[0].bracketText,p=r.has(u)?r.get(u):0;if(p-=1,r.set(u,Math.max(0,p)),p<0){let h=n.get(u);h||(h=new ra,n.set(u,h)),h.push(l.range)}}o=l.range.getEndPosition()}}static _bracketsLeftYield(i,e,t,o,n,r){let s=new Map,l=Date.now();for(;;){if(e>=a._maxRounds&&n.size===0){i();break}if(!o){i();break}let c=t.bracketPairs.findPrevBracket(o);if(!c){i();break}if(Date.now()-l>a._maxDuration){setTimeout(()=>a._bracketsLeftYield(i,e+1,t,o,n,r));break}if(c.bracketInfo.isOpeningBracket){let p=c.bracketInfo.bracketText,h=s.has(p)?s.get(p):0;if(h-=1,s.set(p,Math.max(0,h)),h<0){let g=n.get(p);if(g){let f=g.shift();g.size===0&&n.delete(p);let v=G.fromPositions(c.range.getEndPosition(),f.getStartPosition()),b=G.fromPositions(c.range.getStartPosition(),f.getEndPosition());r.push({range:v}),r.push({range:b}),a._addBracketLeading(t,b,r)}}}else{let p=c.bracketInfo.getOpeningBrackets()[0].bracketText,h=s.has(p)?s.get(p):0;s.set(p,h+1)}o=c.range.getStartPosition()}}static _addBracketLeading(i,e,t){if(e.startLineNumber===e.endLineNumber)return;let o=e.startLineNumber,n=i.getLineFirstNonWhitespaceColumn(o);n!==0&&n!==e.startColumn&&(t.push({range:G.fromPositions(new ye(o,n),e.getEndPosition())}),t.push({range:G.fromPositions(new ye(o,1),e.getEndPosition())}));let r=o-1;if(r>0){let s=i.getLineFirstNonWhitespaceColumn(r);s===e.startColumn&&s!==i.getLineLastNonWhitespaceColumn(r)&&(t.push({range:G.fromPositions(new ye(r,s),e.getEndPosition())}),t.push({range:G.fromPositions(new ye(r,1),e.getEndPosition())}))}}};var mTe=class a{static{this.None=new class extends a{distance(){return 0}}}static async create(i,e){if(!e.getOption(134).localityBonus||!e.hasModel())return a.None;let t=e.getModel(),o=e.getPosition();if(!i.canComputeWordRanges(t.uri))return a.None;let[n]=await new pTe().provideSelectionRanges(t,[o]);if(n.length===0)return a.None;let r=await i.computeWordRanges(t.uri,n[0].range);if(!r)return a.None;let s=t.getWordUntilPosition(o);return delete r[s.word],new class extends a{distance(l,c){if(!o.equals(e.getPosition()))return 0;if(c.kind===17)return 2<<20;let u=typeof c.label=="string"?c.label:c.label.label,p=r[u];if(YO(p))return 2<<20;let h=Ek(p,G.fromPositions(l),G.compareRangesUsingStarts),g=h>=0?p[h]:p[Math.max(0,~h-1)],f=n.length;for(let v of n){if(!G.containsRange(v.range,g))break;f-=1}return f}}}};var k9e=class{constructor(i,e){this.leadingLineContent=i;this.characterCountDelta=e}};var hTe=class a{constructor(i,e,t,o,n,r,s=i4.default,l=void 0){this.clipboardText=l;this._snippetCompareFn=a._compareCompletionItems;this._items=i,this._column=e,this._wordDistance=o,this._options=n,this._refilterKind=1,this._lineContext=t,this._fuzzyScoreOptions=s,r==="top"?this._snippetCompareFn=a._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=a._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(i){(this._lineContext.leadingLineContent!==i.leadingLineContent||this._lineContext.characterCountDelta!==i.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<i.characterCountDelta&&this._filteredItems?2:1,this._lineContext=i)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();let i=new Set;for(let[e,t]of this.getItemsByProvider())t.length>0&&t[0].container.incomplete&&i.add(e);return i}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;let i=[],{leadingLineContent:e,characterCountDelta:t}=this._lineContext,o="",n="",r=this._refilterKind===1?this._items:this._filteredItems,s=[],l=!this._options.filterGraceful||r.length>2e3?eM:Hxt;for(let c=0;c<r.length;c++){let u=r[c];if(u.isInvalid)continue;let p=this._itemsByProvider.get(u.provider);p?p.push(u):this._itemsByProvider.set(u.provider,[u]);let h=u.position.column-u.editStart.column,g=h+t-(u.position.column-this._column);if(o.length!==g&&(o=g===0?"":e.slice(-g),n=o.toLowerCase()),u.word=o,g===0)u.score=Xv.Default;else{let f=0;for(;f<h;){let v=o.charCodeAt(f);if(v===32||v===9)f+=1;else break}if(f>=g)u.score=Xv.Default;else if(typeof u.completion.filterText=="string"){let v=l(o,n,f,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!v)continue;MS(u.completion.filterText,u.textLabel)===0?u.score=v:(u.score=AJi(o,n,f,u.textLabel,u.labelLow,0),u.score[0]=v[0])}else{let v=l(o,n,f,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!v)continue;u.score=v}}u.idx=c,u.distance=this._wordDistance.distance(u.position,u.completion),s.push(u),i.push(u.textLabel.length)}this._filteredItems=s.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:i.length?tY(i.length-.85,i,(c,u)=>c-u):0}}static _compareCompletionItems(i,e){return i.score[0]>e.score[0]?-1:i.score[0]<e.score[0]?1:i.distance<e.distance?-1:i.distance>e.distance?1:i.idx<e.idx?-1:i.idx>e.idx?1:0}static _compareCompletionItemsSnippetsDown(i,e){if(i.completion.kind!==e.completion.kind){if(i.completion.kind===28)return 1;if(e.completion.kind===28)return-1}return a._compareCompletionItems(i,e)}static _compareCompletionItemsSnippetsUp(i,e){if(i.completion.kind!==e.completion.kind){if(i.completion.kind===28)return-1;if(e.completion.kind===28)return 1}return a._compareCompletionItems(i,e)}};var U4=class{static shouldAutoTrigger(i){if(!i.hasModel())return!1;let e=i.getModel(),t=i.getPosition();e.tokenization.tokenizeIfCheap(t.lineNumber);let o=e.getWordAtPosition(t);return!(!o||o.endColumn!==t.column&&o.startColumn+1!==t.column||!isNaN(Number(o.word)))}constructor(i,e,t){this.leadingLineContent=i.getLineContent(e.lineNumber).substr(0,e.column-1),this.leadingWord=i.getWordUntilPosition(e),this.lineNumber=e.lineNumber,this.column=e.column,this.triggerOptions=t}};function R8o(a,i,e){if(!i.getContextKeyValue(Za.inlineSuggestionVisible.key))return!0;let t=i.getContextKeyValue(Za.suppressSuggestions.key);return t!==void 0?!t:!a.getOption(71).suppressSuggestions}function L8o(a,i,e){if(!i.getContextKeyValue("inlineSuggestionVisible"))return!0;let t=i.getContextKeyValue(Za.suppressSuggestions.key);return t!==void 0?!t:!a.getOption(71).suppressSuggestions}var f2=class{constructor(i,e,t,o,n,r,s,l,c){this._editor=i;this._editorWorkerService=e;this._clipboardService=t;this._telemetryService=o;this._logService=n;this._contextKeyService=r;this._configurationService=s;this._languageFeaturesService=l;this._envService=c;this._toDispose=new O;this._triggerCharacterListener=new O;this._triggerQuickSuggest=new Nl;this._triggerState=void 0;this._completionDisposables=new O;this._onDidCancel=new T;this._onDidTrigger=new T;this._onDidSuggest=new T;this.onDidCancel=this._onDidCancel.event;this.onDidTrigger=this._onDidTrigger.event;this.onDidSuggest=this._onDidSuggest.event;this._currentSelection=this._editor.getSelection()||new ei(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let u=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{u=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{u=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(p=>{u||this._onCursorChange(p)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!u&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){je(this._triggerCharacterListener),je([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._waitForInlineCompletions?.dispose(),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(104)||!this._editor.hasModel()||!this._editor.getOption(137))return;let i=new Map;for(let t of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(let o of t.triggerCharacters||[]){let n=i.get(o);if(!n){n=new Set;let r=Vio();r&&n.add(r),i.set(o,n)}n.add(t)}let e=t=>{if(!L8o(this._editor,this._contextKeyService,this._configurationService)||U4.shouldAutoTrigger(this._editor))return;if(!t){let r=this._editor.getPosition();t=this._editor.getModel().getLineContent(r.lineNumber).substr(0,r.column-1)}let o="";iF(t.charCodeAt(t.length-1))?Ip(t.charCodeAt(t.length-2))&&(o=t.substr(t.length-2)):o=t.charAt(t.length-1);let n=i.get(o);if(n){let r=new Map;if(this._completionModel)for(let[s,l]of this._completionModel.getItemsByProvider())n.has(s)||r.set(s,l);this.trigger({auto:!0,triggerKind:1,triggerCharacter:o,retrigger:!!this._completionModel,clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:n,providerItemsToReuse:r}})}};this._triggerCharacterListener.add(this._editor.onDidType(e)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>e()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(i=!1){this._triggerQuickSuggest.cancel(),this._waitForInlineCompletions?.dispose(),this._waitForInlineCompletions=void 0,this._triggerState!==void 0&&(this._requestToken?.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:i}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(i){if(!this._editor.hasModel())return;let e=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!i.selection.isEmpty()||i.reason!==0&&i.reason!==3||i.source!=="keyboard"&&i.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&i.reason===0?(e.containsRange(this._currentSelection)||e.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&i.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){m2.isAllOff(this._editor.getOption(102))||this._editor.getOption(134).snippetsPreventQuickSuggestions&&ss.get(this._editor)?.isInSnippet()||(this.cancel(),this._waitForInlineCompletions?.dispose(),this._waitForInlineCompletions=void 0,this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!U4.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;let i=this._editor.getModel(),e=this._editor.getPosition(),t=this._editor.getOption(102);if(m2.isAllOff(t))return;let o=!1;if(!m2.isAllOn(t)){i.tokenization.tokenizeIfCheap(e.lineNumber);let n=i.tokenization.getLineTokens(e.lineNumber),r=n.getStandardTokenType(n.findTokenIndexAtOffset(Math.max(e.column-1-1,0))),s=m2.valueFor(t,r);if(s==="off"||s==="inline")return;s==="offWhenInlineCompletions"&&(o=this._languageFeaturesService.inlineCompletionsProvider.has(i)&&this._editor.getOption(71).enabled)}R8o(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(i)&&(o?this._waitForInlineCompletionsAndTrigger(i,e):this.trigger({auto:!0}))},this._editor.getOption(103)))}_waitForInlineCompletionsAndTrigger(i,e){let t=i.getVersionId(),n=G_t(this._editor)?.model.get();if(!n){this.trigger({auto:!0});return}if(n.state.get()?.inlineSuggestion)return;let s=new O;this._waitForInlineCompletions=s;let l=c=>{if(s.dispose(),this._waitForInlineCompletions===s&&(this._waitForInlineCompletions=void 0),this._triggerState!==void 0||!c)return;let u=this._editor.getModel(),p=this._editor.getPosition();u===i&&u.getVersionId()===t&&p?.equals(e)&&this._editor.hasWidgetFocus()&&this.trigger({auto:!0})};Zo(()=>{l(!0),n.stop("automatic")},750,s),s.add(ve(c=>{let u=n.status.read(c),p=n.state.read(c);!p&&u==="loading"||l(!p)}))}_refilterCompletionItems(){To(this._editor.hasModel()),To(this._triggerState!==void 0);let i=this._editor.getModel(),e=this._editor.getPosition(),t=new U4(i,e,{...this._triggerState,refilter:!0});this._onNewContext(t)}trigger(i){if(!this._editor.hasModel())return;let e=this._editor.getModel(),t=new U4(e,this._editor.getPosition(),i);this.cancel(i.retrigger),this._triggerState=i,this._onDidTrigger.fire({auto:i.auto,shy:i.shy??!1,position:this._editor.getPosition()}),this._context=t;let o={triggerKind:i.triggerKind??0};i.triggerCharacter&&(o={triggerKind:1,triggerCharacter:i.triggerCharacter}),this._requestToken=new qe;let n=this._editor.getOption(128),r=1;switch(n){case"top":r=0;break;case"bottom":r=2;break}let{itemKind:s,showDeprecated:l}=f2.createSuggestFilter(this._editor),c=new F4(r,i.completionOptions?.kindFilter??s,i.completionOptions?.providerFilter,i.completionOptions?.providerItemsToReuse,l),u=mTe.create(this._editorWorkerService,this._editor),p=_ue(this._languageFeaturesService.completionProvider,e,this._editor.getPosition(),c,o,this._requestToken.token);Promise.all([p,u]).then(async([h,g])=>{if(this._requestToken?.dispose(),!this._editor.hasModel()){h.disposable.dispose();return}let f=i?.clipboardText;if(!f&&h.needsClipboard&&(f=await this._clipboardService.readText()),this._triggerState===void 0){h.disposable.dispose();return}let v=this._editor.getModel(),b=new U4(v,this._editor.getPosition(),i),S={...i4.default,firstMatchCanBeWeak:!this._editor.getOption(134).matchOnWordStartOnly};if(this._completionModel=new hTe(h.items,this._context.column,{leadingLineContent:b.leadingLineContent,characterCountDelta:b.column-this._context.column},g,this._editor.getOption(134),this._editor.getOption(128),S,f),this._completionDisposables.add(h.disposable),this._onNewContext(b),this._reportDurationsTelemetry(h.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(let y of h.items)y.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${y.provider._debugDisplayName}`,y.completion)}).catch(mt)}_reportDurationsTelemetry(i){Math.random()>1e-4||setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(i)}),this._logService.debug("suggest.durations.json",i)})}static createSuggestFilter(i){let e=new Set;i.getOption(128)==="none"&&e.add(28);let o=i.getOption(134);return o.showMethods||e.add(0),o.showFunctions||e.add(1),o.showConstructors||e.add(2),o.showFields||e.add(3),o.showVariables||e.add(4),o.showClasses||e.add(5),o.showStructs||e.add(6),o.showInterfaces||e.add(7),o.showModules||e.add(8),o.showProperties||e.add(9),o.showEvents||e.add(10),o.showOperators||e.add(11),o.showUnits||e.add(12),o.showValues||e.add(13),o.showConstants||e.add(14),o.showEnums||e.add(15),o.showEnumMembers||e.add(16),o.showKeywords||e.add(17),o.showWords||e.add(18),o.showColors||e.add(19),o.showFiles||e.add(20),o.showReferences||e.add(21),o.showColors||e.add(22),o.showFolders||e.add(23),o.showTypeParameters||e.add(24),o.showSnippets||e.add(28),o.showUsers||e.add(25),o.showIssues||e.add(26),{itemKind:e,showDeprecated:o.showDeprecated}}_onNewContext(i){if(this._context){if(i.lineNumber!==this._context.lineNumber){this.cancel();return}if(Ul(i.leadingLineContent)!==Ul(this._context.leadingLineContent)){this.cancel();return}if(i.column<this._context.column){i.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();return}if(this._completionModel){if(i.leadingWord.word.length!==0&&i.leadingWord.startColumn>this._context.leadingWord.startColumn){if(U4.shouldAutoTrigger(this._editor)&&this._context){let t=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:t}})}return}if(i.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&i.leadingWord.word.length!==0){let e=new Map,t=new Set;for(let[o,n]of this._completionModel.getItemsByProvider())n.length>0&&n[0].container.incomplete?t.add(o):e.set(o,n);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:t,providerItemsToReuse:e}})}else{let e=this._completionModel.lineContext,t=!1;if(this._completionModel.lineContext={leadingLineContent:i.leadingLineContent,characterCountDelta:i.column-this._context.column},this._completionModel.items.length===0){let o=U4.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(o&&this._context.leadingWord.endColumn<i.leadingWord.startColumn){this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});return}if(this._context.triggerOptions.auto){this.cancel();return}else if(this._completionModel.lineContext=e,t=this._completionModel.items.length>0,t&&i.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:i.triggerOptions,isFrozen:t})}}}}};f2=I([m(1,Qs),m(2,Bi),m(3,_e),m(4,re),m(5,X),m(6,B),m(7,Jt),m(8,ko)],f2);var $_t=class{constructor(i,e,t,o){this._disposables=new O;this._disposables.add(t.onDidSuggest(n=>{n.completionModel.items.length===0&&this.reset()})),this._disposables.add(t.onDidCancel(n=>{this.reset()})),this._disposables.add(e.onDidShow(()=>this._onItem(e.getFocusedItem()))),this._disposables.add(e.onDidFocus(this._onItem,this)),this._disposables.add(e.onDidHide(this.reset,this)),this._disposables.add(i.onWillType(n=>{if(this._active&&!e.isFrozen()&&t.state!==0){let r=n.charCodeAt(n.length-1);this._active.acceptCharacters.has(r)&&i.getOption(0)&&o(this._active.item)}}))}_onItem(i){if(!i||!Rr(i.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===i.item)return;let e=new p5;for(let t of i.item.completion.commitCharacters)t.length>0&&e.add(t.charCodeAt(0));this._active={acceptCharacters:e,item:i}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}};var j_t=class a{constructor(i,e){this._disposables=new O;this._lastOvertyped=[];this._locked=!1;this._disposables.add(i.onWillType(()=>{if(this._locked||!i.hasModel())return;let t=i.getSelections(),o=t.length,n=!1;for(let s=0;s<o;s++)if(!t[s].isEmpty()){n=!0;break}if(!n){this._lastOvertyped.length!==0&&(this._lastOvertyped.length=0);return}this._lastOvertyped=[];let r=i.getModel();for(let s=0;s<o;s++){let l=t[s];if(r.getValueLengthInRange(l)>a._maxSelectionLength)return;this._lastOvertyped[s]={value:r.getValueInRange(l),multiline:l.startLineNumber!==l.endLineNumber}}})),this._disposables.add(e.onDidTrigger(t=>{this._locked=!0})),this._disposables.add(e.onDidCancel(t=>{this._locked=!1}))}static{this._maxSelectionLength=51200}getLastOvertypedInfo(i){if(i>=0&&i<this._lastOvertyped.length)return this._lastOvertyped[i]}dispose(){this._disposables.dispose()}};var z4=class{constructor(i,e,t,o,n,r){this._menuId=e;this._menuService=n;this._contextKeyService=r;this._menuDisposables=new O;this.element=D(i,_(".suggest-status-bar"));let s=(l=>t?.showIconsNoKeybindings?l instanceof Do?o.createInstance(Cl,l,void 0):void 0:l instanceof Do?o.createInstance(Pkt,l,{useComma:!1}):void 0);this._leftActions=new oo(this.element,{actionViewItemProvider:s}),this._rightActions=new oo(this.element,{actionViewItemProvider:s}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){let i=this._menuService.createMenu(this._menuId,this._contextKeyService),e=()=>{let t=[],o=[];for(let[n,r]of i.getActions())n==="left"?t.push(...r):o.push(...r);this._leftActions.clear(),this._leftActions.push(t),this._rightActions.clear(),this._rightActions.push(o)};this._menuDisposables.add(i.onDidChange(()=>e())),this._menuDisposables.add(i)}hide(){this._menuDisposables.clear()}};z4=I([m(3,F),m(4,Yt),m(5,X)],z4);function E9e(a){return!!a&&!!(a.completion.documentation||a.completion.detail&&a.completion.detail!==a.completion.label)}var gTe=class{constructor(i,e,t){this._editor=i;this._themeService=e;this._markdownRendererService=t;this._onDidClose=new T;this.onDidClose=this._onDidClose.event;this._onDidChangeContents=new T;this.onDidChangeContents=this._onDidChangeContents.event;this._disposables=new O;this._renderDisposeable=new O;this._size=new di(330,0);this.domNode=_(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=_(".body"),this._scrollbar=new Ar(this._body,{alwaysConsumeMouseWheel:!0}),D(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=D(this._body,_(".header")),this._close=D(this._header,_("span"+q.asCSSSelector(L.close))),this._close.title=d(1665,null),this._close.role="button",this._close.tabIndex=-1,this._type=D(this._header,_("p.type")),this._docs=D(this._body,_("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(59)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose(),this._onDidClose.dispose(),this._onDidChangeContents.dispose()}_configureFont(){let i=this._editor.getOptions(),e=i.get(59),t=e.getMassagedFontFamily(),o=i.get(135)||e.fontSize,n=i.get(136)||e.lineHeight,r=e.fontWeight,s=`${o}px`,l=`${n}px`;this.domNode.style.fontSize=s,this.domNode.style.lineHeight=`${n/o}`,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=e.fontFeatureSettings,this._type.style.fontFamily=t,this._close.style.height=l,this._close.style.width=l}getLayoutInfo(){let i=this._editor.getOption(136)||this._editor.getOption(59).lineHeight,e=Uf(this._themeService.getColorTheme().type)?2:1,t=e*2;return{lineHeight:i,borderWidth:e,borderHeight:t,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=d(1666,null),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(i,e){this._renderDisposeable.clear();let{detail:t,documentation:o}=i.completion;if(e){let n="";n+=`score: ${i.score[0]}
`,n+=`prefix: ${i.word??"(no prefix)"}
`,n+=`word: ${i.completion.filterText?i.completion.filterText+" (filterText)":i.textLabel}
`,n+=`distance: ${i.distance} (localityBonus-setting)
`,n+=`index: ${i.idx}, based on ${i.completion.sortText&&`sortText: "${i.completion.sortText}"`||"label"}
`,n+=`commit_chars: ${i.completion.commitCharacters?.join("")}
`,o=new he().appendCodeblock("empty",n),t=`Provider: ${i.provider._debugDisplayName}`}if(!e&&!E9e(i)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),t){let n=t.length>1e5?`${t.substr(0,1e5)}\u2026`:t;this._type.textContent=n,this._type.title=n,Xo(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(n))}else St(this._type),this._type.title="",Wi(this._type),this.domNode.classList.add("no-type");if(St(this._docs),typeof o=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=o;else if(o){this._docs.classList.add("markdown-docs"),St(this._docs);let n=this._markdownRendererService.render(o,{context:this._editor,asyncRenderCallback:()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}});this._docs.appendChild(n.element),this._renderDisposeable.add(n)}this.domNode.classList.toggle("detail-and-doc",!!t&&!!o),this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=n=>{n.preventDefault(),n.stopPropagation()},this._close.onclick=n=>{n.preventDefault(),n.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(i,e){let t=new di(i,e);di.equals(t,this._size)||(this._size=t,PL(this.domNode,i,e)),this._scrollbar.scanDomNode()}scrollDown(i=8){this._body.scrollTop+=i}scrollUp(i=8){this._body.scrollTop-=i}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}focus(){this.domNode.focus()}};gTe=I([m(1,Pe),m(2,_n)],gTe);var Q_t=class{constructor(i,e){this.widget=i;this._editor=e;this.allowEditorOverflow=!0;this._disposables=new O;this._added=!1;this._preferAlignAtTop=!0;this._resizable=new uM,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(i.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let t,o,n=0,r=0;this._disposables.add(this._resizable.onDidWillResize(()=>{t=this._topLeft,o=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(s=>{if(t&&o){this.widget.layout(s.dimension.width,s.dimension.height);let l=!1;s.west&&(r=o.width-s.dimension.width,l=!0),s.north&&(n=o.height-s.dimension.height,l=!0),l&&this._applyTopLeft({top:t.top+n,left:t.left+r})}s.done&&(t=void 0,o=void 0,n=0,r=0,this._userSize=s.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(i=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),i&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(i,e){let t=i.getBoundingClientRect();this._anchorBox=t,this._preferAlignAtTop=e,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,e)}_placeAtAnchor(i,e,t){let o=wh(this.getDomNode().ownerDocument.body),n=this.widget.getLayoutInfo(),r=new di(220,2*n.lineHeight),s=i.top,l=(function(){let N=o.width-(i.left+i.width+n.borderWidth+n.horizontalPadding),V=-n.borderWidth+i.left+i.width,H=new di(N,o.height-i.top-n.borderHeight-n.verticalPadding),K=H.with(void 0,i.top+i.height-n.borderHeight-n.verticalPadding);return{top:s,left:V,fit:N-e.width,maxSizeTop:H,maxSizeBottom:K,minSize:r.with(Math.min(N,r.width))}})(),c=(function(){let N=i.left-n.borderWidth-n.horizontalPadding,V=Math.max(n.horizontalPadding,i.left-e.width-n.borderWidth),H=new di(N,o.height-i.top-n.borderHeight-n.verticalPadding),K=H.with(void 0,i.top+i.height-n.borderHeight-n.verticalPadding);return{top:s,left:V,fit:N-e.width,maxSizeTop:H,maxSizeBottom:K,minSize:r.with(Math.min(N,r.width))}})(),u=(function(){let N=i.left,V=-n.borderWidth+i.top+i.height,H=new di(i.width-n.borderHeight,o.height-i.top-i.height-n.verticalPadding);return{top:V,left:N,fit:H.height-e.height,maxSizeBottom:H,maxSizeTop:H,minSize:r.with(H.width)}})(),p=(function(){let N=i.left,V=new di(i.width-n.borderHeight,i.top-n.verticalPadding);return{top:Math.max(n.verticalPadding,i.top-e.height),left:N,fit:V.height-e.height,maxSizeTop:V,maxSizeBottom:V,minSize:r.with(V.width)}})(),g=[l,c,t?u:p],f=g.find(N=>N.fit>=0)??g.sort((N,V)=>V.fit-N.fit)[0],v=i.top+i.height-n.borderHeight,b,S=e.height,y=Math.max(f.maxSizeTop.height,f.maxSizeBottom.height);S>y&&(S=y);let w;t?S<=f.maxSizeTop.height?(b=!0,w=f.maxSizeTop):(b=!1,w=f.maxSizeBottom):S<=f.maxSizeBottom.height?(b=!1,w=f.maxSizeBottom):(b=!0,w=f.maxSizeTop);let{top:x,left:E}=f;f===p?x=i.top-S+n.borderWidth:!b&&S>i.height&&(x=v-S);let M=this._editor.getDomNode();if(M){let N=M.getBoundingClientRect();x-=N.top,E-=N.left}this._applyTopLeft({left:E,top:x}),f===p?this._resizable.enableSashes(!0,!1,!1,!0):this._resizable.enableSashes(!b,f===l,b,f!==l),this._resizable.minSize=f.minSize,this._resizable.maxSize=w,this._resizable.layout(S,Math.min(w.width,e.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(i){this._topLeft=i,this._editor.layoutOverlayWidget(this)}};var P8o=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Ia(a,i,e,t,o){if(q.isThemeIcon(o))return[`codicon-${o.id}`,"predefined-file-icon"];if(A.isUri(o))return[];let n=t===2?["rootfolder-icon"]:t===1?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===Q.data)r=e5.parseMetaData(e).get(e5.META_DATA_LABEL);else{let s=e.path.match(P8o);s?(r=Oue(s[2].toLowerCase()),s[1]&&n.push(`${Oue(s[1].toLowerCase())}-name-dir-icon`)):r=Oue(e.authority.toLowerCase())}if(t===2)n.push(`${r}-root-name-folder-icon`);else if(t===1)n.push(`${r}-name-folder-icon`);else{if(r){if(n.push(`${r}-name-file-icon`),n.push("name-file-icon"),r.length<=255){let l=r.split(".");for(let c=1;c<l.length;c++)n.push(`${l.slice(c).join(".")}-ext-file-icon`)}n.push("ext-file-icon")}let s=A8o(a,i,e);s&&n.push(`${Oue(s)}-lang-file-icon`)}}return n}function v2(a){return["file-icon",`${Oue(a)}-lang-file-icon`]}function A8o(a,i,e){if(!e)return null;let t=null;if(e.scheme===Q.data){let n=e5.parseMetaData(e).get(e5.META_DATA_MIME);n&&(t=i.getLanguageIdByMimeType(n))}else{let o=a.getModel(e);o&&(t=o.getLanguageId())}return t&&t!==es?t:i.guessLanguageIdByFilepathOrFirstLine(e)}function Oue(a){return a.replace(/[\s]/g,"/")}var N8o=Oe("suggest-more-info",L.chevronRight,d(1668,null)),O8o=new class T9e{static{this._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/}static{this._regexStrict=new RegExp(`^${T9e._regexRelaxed.source}$`,"i")}extract(i,e){if(i.textLabel.match(T9e._regexStrict))return e[0]=i.textLabel,!0;if(i.completion.detail&&i.completion.detail.match(T9e._regexStrict))return e[0]=i.completion.detail,!0;if(i.completion.documentation){let t=typeof i.completion.documentation=="string"?i.completion.documentation:i.completion.documentation.value,o=T9e._regexRelaxed.exec(t);if(o&&(o.index===0||o.index+o[0].length===t.length))return e[0]=o[0],!0}return!1}},fTe=class{constructor(i,e,t,o){this._editor=i;this._modelService=e;this._languageService=t;this._themeService=o;this._onDidToggleDetails=new T;this.onDidToggleDetails=this._onDidToggleDetails.event;this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(i){let e=new O,t=i;t.classList.add("show-file-icons");let o=D(i,_(".icon")),n=D(o,_("span.colorspan")),r=D(i,_(".contents")),s=D(r,_(".main")),l=D(s,_(".icon-label.codicon")),c=D(s,_("span.left")),u=D(s,_("span.right")),p=new ld(c,{supportHighlights:!0,supportIcons:!0});e.add(p);let h=D(c,_("span.signature-label")),g=D(c,_("span.qualifier-label")),f=D(u,_("span.details-label")),v=D(u,_("span.readMore"+q.asCSSSelector(N8o)));return v.title=d(1667,null),{root:t,left:c,right:u,icon:o,colorspan:n,iconLabel:p,iconContainer:l,parametersLabel:h,qualifierLabel:g,detailsLabel:f,readMore:v,disposables:e,configureFont:()=>{let S=this._editor.getOptions(),y=S.get(59),w=y.getMassagedFontFamily(),x=y.fontFeatureSettings,E=y.fontVariationSettings,M=S.get(135)||y.fontSize,N=S.get(136)||y.lineHeight,V=y.fontWeight,H=y.letterSpacing,K=`${M}px`,j=`${N}px`,J=`${H}px`;t.style.fontSize=K,t.style.fontWeight=V,t.style.letterSpacing=J,s.style.fontFamily=w,s.style.fontFeatureSettings=x,s.style.fontVariationSettings=E,s.style.lineHeight=j,o.style.height=j,o.style.width=j,v.style.height=j,v.style.width=j}}}renderElement(i,e,t){t.configureFont();let{completion:o}=i;t.colorspan.style.backgroundColor="";let n={labelEscapeNewLines:!0,matches:Wa(i.score)},r=[];if(o.kind===19&&O8o.extract(i,r))t.icon.className="icon customcolor",t.iconContainer.className="icon hide",t.colorspan.style.backgroundColor=r[0];else if(o.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){t.icon.className="icon hide",t.iconContainer.className="icon hide";let s=Ia(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),0),l=Ia(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),0);n.extraClasses=s.length>l.length?s:l}else o.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(t.icon.className="icon hide",t.iconContainer.className="icon hide",n.extraClasses=[Ia(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),1),Ia(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),1)].flat()):(t.icon.className="icon hide",t.iconContainer.className="",t.iconContainer.classList.add("suggest-icon",...q.asClassNameArray(Kz.toIcon(o.kind))));o.tags&&o.tags.indexOf(1)>=0&&(n.extraClasses=(n.extraClasses||[]).concat(["deprecated"]),n.matches=[]),t.iconLabel.setLabel(i.textLabel,void 0,n),typeof o.label=="string"?(t.parametersLabel.textContent="",t.detailsLabel.textContent=Dgi(o.detail||""),t.root.classList.add("string-label")):(t.parametersLabel.textContent=Dgi(o.label.detail||""),t.detailsLabel.textContent=Dgi(o.label.description||""),t.root.classList.remove("string-label")),this._editor.getOption(134).showInlineDetails?Xo(t.detailsLabel):Wi(t.detailsLabel),E9e(i)?(t.right.classList.add("can-expand-details"),Xo(t.readMore),t.readMore.onmousedown=s=>{s.stopPropagation(),s.preventDefault()},t.readMore.onclick=s=>{s.stopPropagation(),s.preventDefault(),this._onDidToggleDetails.fire()}):(t.right.classList.remove("can-expand-details"),Wi(t.readMore),t.readMore.onmousedown=null,t.readMore.onclick=null)}disposeTemplate(i){i.disposables.dispose()}};fTe=I([m(1,_t),m(2,Rt),m(3,Pe)],fTe);function Dgi(a){return a.replace(/\r\n|\r|\n/g,"")}te("editorSuggestWidget.background",qu,d(1649,null));te("editorSuggestWidget.border",bT,d(1650,null));var Mgi=te("editorSuggestWidget.foreground",Vd,d(1652,null));te("editorSuggestWidget.selectedForeground",oK,d(1655,null));te("editorSuggestWidget.selectedIconForeground",KCe,d(1656,null));var Pgi=te("editorSuggestWidget.selectedBackground",nK,d(1654,null));te("editorSuggestWidget.highlightForeground",aX,d(1653,null));te("editorSuggestWidget.focusHighlightForeground",oyt,d(1651,null));te("editorSuggestWidgetStatus.foreground",ni(Mgi,.5),d(1657,null));var Rgi=class{constructor(i,e){this._service=i;this._key=`suggestWidget.size/${e.getEditorType()}/${e instanceof Ed}`}restore(){let i=this._service.get(this._key,0)??"";try{let e=JSON.parse(i);if(di.is(e))return di.lift(e)}catch{}}store(i){this._service.store(this._key,JSON.stringify(i),0,1)}reset(){this._service.remove(this._key,0)}},cH=class{constructor(i,e,t,o,n){this.editor=i;this._storageService=e;this._state=0;this._isAuto=!1;this._pendingLayout=new ue;this._pendingShowDetails=new ue;this._ignoreFocusEvents=!1;this._forceRenderingAbove=!1;this._explainMode=!1;this._showTimeout=new Nl;this._disposables=new O;this._onDidSelect=new Ih;this._onDidFocus=new Ih;this._onDidHide=new T;this._onDidShow=new T;this.onDidSelect=this._onDidSelect.event;this.onDidFocus=this._onDidFocus.event;this.onDidHide=this._onDidHide.event;this.onDidShow=this._onDidShow.event;this._onDetailsKeydown=new T;this.onDetailsKeyDown=this._onDetailsKeydown.event;this.element=new uM,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Lgi(this,i),this._persistedSize=new Rgi(e,i);class r{constructor(f,v,b=!1,S=!1){this.persistedSize=f;this.currentSize=v;this.persistHeight=b;this.persistWidth=S}}let s;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),s=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(g=>{if(this._resize(g.dimension.width,g.dimension.height),s&&(s.persistHeight=s.persistHeight||!!g.north||!!g.south,s.persistWidth=s.persistWidth||!!g.east||!!g.west),!!g.done){if(s){let{itemHeight:f,defaultSize:v}=this.getLayoutInfo(),b=Math.round(f/2),{width:S,height:y}=this.element.size;(!s.persistHeight||Math.abs(s.currentSize.height-y)<=b)&&(y=s.persistedSize?.height??v.height),(!s.persistWidth||Math.abs(s.currentSize.width-S)<=b)&&(S=s.persistedSize?.width??v.width),this._persistedSize.store(new di(S,y))}this._contentWidget.unlockPreference(),s=void 0}})),this._messageElement=D(this.element.domNode,_(".message")),this._listElement=D(this.element.domNode,_(".tree"));let l=this._disposables.add(n.createInstance(gTe,this.editor));l.onDidClose(()=>this.toggleDetails(),this,this._disposables),this._details=new Q_t(l,this.editor);let c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(134).showIcons);c();let u=n.createInstance(fTe,this.editor);this._disposables.add(u),this._disposables.add(u.onDidToggleDetails(()=>this.toggleDetails())),this._list=new Gc("SuggestWidget",this._listElement,{getHeight:g=>this.getLayoutInfo().itemHeight,getTemplateId:g=>"suggestion"},[u],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>ii?"listitem":"option",getWidgetAriaLabel:()=>d(1662,null),getWidgetRole:()=>"listbox",getAriaLabel:g=>{let f=g.textLabel,v=Kz.toLabel(g.completion.kind);if(typeof g.completion.label!="string"){let{detail:w,description:x}=g.completion.label;w&&x?f=d(1661,null,f,w,x,v):w?f=d(1660,null,f,w,v):x&&(f=d(1659,null,f,x,v))}else f=d(1658,null,f,v);if(!g.isResolved||!this._isDetailsVisible())return f;let{documentation:b,detail:S}=g.completion,y=Wd("{0}{1}",S||"",b?typeof b=="string"?b:b.value:"");return d(1648,null,f,y)}}}),this._list.style(WS({listInactiveFocusBackground:Pgi,listInactiveFocusOutline:la})),this._status=n.createInstance(z4,this.element.domNode,sH,void 0);let p=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(134).showStatusBar);p(),this._disposables.add(this._list.onMouseDown(g=>this._onListMouseDownOrTap(g))),this._disposables.add(this._list.onTap(g=>this._onListMouseDownOrTap(g))),this._disposables.add(this._list.onDidChangeSelection(g=>this._onListSelection(g))),this._disposables.add(this._list.onDidChangeFocus(g=>this._onListFocus(g))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(g=>{g.hasChanged(134)&&(p(),c()),this._completionModel&&(g.hasChanged(59)||g.hasChanged(135)||g.hasChanged(136))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=ar.Visible.bindTo(t),this._ctxSuggestWidgetDetailsVisible=ar.DetailsVisible.bindTo(t),this._ctxSuggestWidgetMultipleSuggestions=ar.MultipleSuggestions.bindTo(t),this._ctxSuggestWidgetHasFocusedSuggestion=ar.HasFocusedSuggestion.bindTo(t),this._ctxSuggestWidgetDetailsFocused=ar.DetailsFocused.bindTo(t);let h=nr(this._details.widget.domNode);this._disposables.add(h),this._disposables.add(h.onDidFocus(()=>this._ctxSuggestWidgetDetailsFocused.set(!0))),this._disposables.add(h.onDidBlur(()=>this._ctxSuggestWidgetDetailsFocused.set(!1))),this._disposables.add(Yo(this._details.widget.domNode,"keydown",g=>{this._onDetailsKeydown.fire(g)})),this._disposables.add(this.editor.onMouseDown(g=>this._onEditorMouseDown(g)))}static{this.LOADING_MESSAGE=d(1663,null)}static{this.NO_SUGGESTIONS_MESSAGE=d(1664,null)}dispose(){this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),this._loadingTimeout?.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose(),this._onDidSelect.dispose(),this._onDidFocus.dispose(),this._onDidHide.dispose(),this._onDidShow.dispose(),this._onDetailsKeydown.dispose()}_onEditorMouseDown(i){this._details.widget.domNode.contains(i.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(i.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(i){typeof i.element>"u"||typeof i.index>"u"||(i.browserEvent.preventDefault(),i.browserEvent.stopPropagation(),this._select(i.element,i.index))}_onListSelection(i){i.elements.length&&this._select(i.elements[0],i.indexes[0])}_select(i,e){let t=this._completionModel;t&&(this._onDidSelect.fire({item:i,index:e,model:t}),this.editor.focus())}_onListFocus(i){if(this._ignoreFocusEvents)return;if(this._state===5&&this._setState(3),!i.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);let e=i.elements[0],t=i.indexes[0];e!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=e,this._list.reveal(t),this._currentSuggestionDetails=Hn(async o=>{let n=Zo(()=>{this._isDetailsVisible()&&this._showDetails(!0,!1)},250),r=o.onCancellationRequested(()=>n.dispose());try{return await e.resolve(o)}finally{n.dispose(),r.dispose()}}),this._currentSuggestionDetails.then(()=>{t>=this._list.length||e!==this._list.element(t)||(this._ignoreFocusEvents=!0,this._list.splice(t,1,[e]),this._list.setFocus([t]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this._showDetails(!1,!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:this._list.getElementID(t)}))}).catch(mt)),this._onDidFocus.fire({item:e,index:t,model:this._completionModel})}_setState(i){if(this._state!==i)switch(this._state=i,this.element.domNode.classList.toggle("frozen",i===4),this.element.domNode.classList.remove("message"),i){case 0:Wi(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=cH.LOADING_MESSAGE,Wi(this._listElement,this._status.element),Xo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Er(cH.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=cH.NO_SUGGESTIONS_MESSAGE,Wi(this._listElement,this._status.element),Xo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Er(cH.NO_SUGGESTIONS_MESSAGE);break;case 3:Wi(this._messageElement),Xo(this._listElement,this._status.element),this._show();break;case 4:Wi(this._messageElement),Xo(this._listElement,this._status.element),this._show();break;case 5:Wi(this._messageElement),Xo(this._listElement,this._status.element),this._details.show(),this._show(),this._details.widget.focus();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(i,e){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!i,this._isAuto||(this._loadingTimeout=Zo(()=>this._setState(1),e)))}showSuggestions(i,e,t,o,n){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout?.dispose(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==i&&(this._completionModel=i),t&&this._state!==2&&this._state!==0){this._setState(4);return}let r=this._completionModel.items.length,s=r===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(r>1),s){this._setState(o?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(t?4:3),this._list.reveal(e,0,e===0?0:this.getLayoutInfo().itemHeight*.33),this._list.setFocus(n?[]:[e])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=Cg(Me(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._list.setFocus(this._list.getFocus()),this._setState(3)):this._state===3&&(this._setState(5),this._isDetailsVisible()?this._details.widget.focus():this.toggleDetails(!0))}toggleDetails(i=!1){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(E9e(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this._showDetails(!1,i))}_showDetails(i,e){this._pendingShowDetails.value=Cg(Me(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let t=!1;i?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details"),e&&(this._details.widget.focus(),t=!0)),t||this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this._showDetails(!1,!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout?.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();let i=this._persistedSize.restore(),e=Math.ceil(this.getLayoutInfo().itemHeight*4.3);i&&i.height<e&&this._persistedSize.store(i.with(void 0,e))}isFrozen(){return this._state===4}_afterRender(i){if(i===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_layout(i){if(!this.editor.hasModel()||!this.editor.getDomNode())return;let e=wh(this.element.domNode.ownerDocument.body),t=this.getLayoutInfo();i||(i=t.defaultSize);let o=i.height,n=i.width;if(this._status.element.style.height=`${t.itemHeight}px`,this._state===2||this._state===1)o=t.itemHeight+t.borderHeight,n=t.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new di(n,o),this._contentWidget.setPreference(2);else{let r=e.width-t.borderHeight-2*t.horizontalPadding;n>r&&(n=r);let s=this._completionModel?this._completionModel.stats.pLabelLen*t.typicalHalfwidthCharacterWidth:n,l=t.statusBarHeight+this._list.contentHeight+t.borderHeight,c=t.itemHeight+t.statusBarHeight,u=ur(this.editor.getDomNode()),p=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),h=u.top+p.top+p.height,g=Math.min(e.height-h-t.verticalPadding,l),f=u.top+p.top-t.verticalPadding,v=Math.min(f,l),b=Math.min(Math.max(v,g)+t.borderHeight,l);o===this._cappedHeight?.capped&&(o=this._cappedHeight.wanted),o<c&&(o=c),o>b&&(o=b),o>g&&v>g||this._forceRenderingAbove&&f>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),b=v):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),b=g),this.element.preferredSize=new di(s,t.defaultSize.height),this.element.maxSize=new di(r,b),this.element.minSize=new di(220,c),this._cappedHeight=o===l?{wanted:this._cappedHeight?.wanted??i.height,capped:o}:void 0}this._resize(n,o)}_resize(i,e){let{width:t,height:o}=this.element.maxSize;i=Math.min(t,i),e=Math.min(o,e);let{statusBarHeight:n}=this.getLayoutInfo();this._list.layout(e-n,i),this._listElement.style.height=`${e-n}px`,this.element.layout(e,i),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,this._contentWidget.getPosition()?.preference[0]===2)}getLayoutInfo(){let i=this.editor.getOption(59),e=jn(this.editor.getOption(136)||i.lineHeight,8,1e3),t=!this.editor.getOption(134).showStatusBar||this._state===2||this._state===1?0:e,o=this._details.widget.getLayoutInfo().borderWidth,n=2*o;return{itemHeight:e,statusBarHeight:t,borderWidth:o,borderHeight:n,typicalHalfwidthCharacterWidth:i.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new di(430,t+12*e)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(i){this._storageService.store("expandSuggestionDocs",i,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};cH=I([m(1,de),m(2,X),m(3,Pe),m(4,F)],cH);var Lgi=class{constructor(i,e){this._widget=i;this._editor=e;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this._preferenceLocked=!1;this._added=!1;this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){let{height:i,width:e}=this._widget.element.size,{borderWidth:t,horizontalPadding:o}=this._widget.getLayoutInfo();return new di(e+2*t+o,i+2*t)}afterRender(i){this._widget._afterRender(i)}setPreference(i){this._preferenceLocked||(this._preference=i)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(i){this._position=i}};var F8o=!1,Agi=class{constructor(i,e){this._model=i;this._position=e;this._decorationOptions=So.register({description:"suggest-line-suffix",stickiness:1});if(i.getLineMaxColumn(e.lineNumber)!==e.column){let o=i.getOffsetAt(e),n=i.getPositionAt(o+1);i.changeDecorations(r=>{this._marker&&r.removeDecoration(this._marker),this._marker=r.addDecoration(G.fromPositions(e,n),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(i=>{i.removeDecoration(this._marker),this._marker=void 0})}delta(i){if(this._model.isDisposed()||this._position.lineNumber!==i.lineNumber)return 0;if(this._marker){let e=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(e.getStartPosition())-this._model.getOffsetAt(i)}else return this._model.getLineMaxColumn(i.lineNumber)-i.column}};var Sc=class{constructor(i,e,t,o,n,r,s){this._memoryService=e;this._commandService=t;this._contextKeyService=o;this._instantiationService=n;this._logService=r;this._telemetryService=s;this._lineSuffix=new ue;this._toDispose=new O;this._selectors=new Ngi(i=>i.priority);this._onWillInsertSuggestItem=new T;this._wantsForceRenderingAbove=!1;this.editor=i,this.model=n.createInstance(f2,this.editor),this._selectors.register({priority:0,select:(p,h,g)=>this._memoryService.select(p,h,g)});let l=ar.InsertMode.bindTo(o);l.set(i.getOption(134).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(i.getOption(134).insertMode))),this.widget=this._toDispose.add(new uF(Me(i.getDomNode()),()=>{let p=this._instantiationService.createInstance(cH,this.editor);this._toDispose.add(p),this._toDispose.add(p.onDidSelect(b=>this._insertSuggestion(b,0),this));let h=new $_t(this.editor,p,this.model,b=>this._insertSuggestion(b,2));this._toDispose.add(h);let g=ar.MakesTextEdit.bindTo(this._contextKeyService),f=ar.HasInsertAndReplaceRange.bindTo(this._contextKeyService),v=ar.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(ee(()=>{g.reset(),f.reset(),v.reset()})),this._toDispose.add(p.onDidFocus(({item:b})=>{let S=this.editor.getPosition(),y=b.editStart.column,w=S.column,x=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!b.completion.additionalTextEdits&&!(b.completion.insertTextRules&4)&&w-y===b.completion.insertText.length&&(x=this.editor.getModel().getValueInRange({startLineNumber:S.lineNumber,startColumn:y,endLineNumber:S.lineNumber,endColumn:w})!==b.completion.insertText),g.set(x),f.set(!ye.equals(b.editInsertEnd,b.editReplaceEnd)),v.set(!!b.provider.resolveCompletionItem||!!b.completion.documentation||b.completion.detail!==b.completion.label)})),this._wantsForceRenderingAbove&&p.forceRenderingAbove(),p})),this._overtypingCapturer=this._toDispose.add(new uF(Me(i.getDomNode()),()=>this._toDispose.add(new j_t(this.editor,this.model)))),this._alternatives=this._toDispose.add(new uF(Me(i.getDomNode()),()=>this._toDispose.add(new zA(this.editor,this._contextKeyService)))),this._toDispose.add(n.createInstance(H4,i)),this._toDispose.add(this.model.onDidTrigger(p=>{this.widget.value.showTriggered(p.auto,p.shy?250:50),this._lineSuffix.value=new Agi(this.editor.getModel(),p.position)})),this._toDispose.add(this.model.onDidSuggest(p=>{if(p.triggerOptions.shy)return;let h=-1;for(let f of this._selectors.itemsOrderedByPriorityDesc)if(h=f.select(this.editor.getModel(),this.editor.getPosition(),p.completionModel.items),h!==-1)break;if(h===-1&&(h=0),this.model.state===0)return;let g=!1;if(p.triggerOptions.auto){let f=this.editor.getOption(134);f.selectionMode==="never"||f.selectionMode==="always"?g=f.selectionMode==="never":f.selectionMode==="whenTriggerCharacter"?g=p.triggerOptions.triggerKind!==1:f.selectionMode==="whenQuickSuggestion"&&(g=p.triggerOptions.triggerKind===1&&!p.triggerOptions.refilter)}this.widget.value.showSuggestions(p.completionModel,h,p.isFrozen,p.triggerOptions.auto,g)})),this._toDispose.add(this.model.onDidCancel(p=>{p.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{F8o||(this.model.cancel(),this.model.clear())}));let c=ar.AcceptSuggestionsOnEnter.bindTo(o),u=()=>{let p=this.editor.getOption(1);c.set(p==="on"||p==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>u())),u()}static{this.ID="editor.contrib.suggestController"}static get(i){return i.getContribution(Sc.ID)}get onWillInsertSuggestItem(){return this._onWillInsertSuggestItem.event}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(i,e){if(!i||!i.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;let t=ss.get(this.editor);if(!t)return;this._onWillInsertSuggestItem.fire({item:i.item});let o=this.editor.getModel(),n=o.getAlternativeVersionId(),{item:r}=i,s=[],l=new qe;e&1||this.editor.pushUndoStop();let c=this.getOverwriteInfo(r,!!(e&8));this._memoryService.memorize(o,this.editor.getPosition(),r);let u=r.isResolved,p=-1,h=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();let f=Sx.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(v=>{let b=G.lift(v.range);if(b.startLineNumber===r.position.lineNumber&&b.startColumn>r.position.column){let S=this.editor.getPosition().column-r.position.column,y=S,w=G.spansMultipleLines(b)?0:S;b=new G(b.startLineNumber,b.startColumn+y,b.endLineNumber,b.endColumn+w)}return Qn.replaceMove(b,v.text)})),f.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!u){let f=new On,v,b=o.onDidChangeContent(x=>{if(x.isFlush){l.cancel(),b.dispose();return}for(let E of x.changes){let M=G.getEndPosition(E.range);(!v||ye.isBefore(M,v))&&(v=M)}}),S=e;e|=2;let y=!1,w=this.editor.onWillType(()=>{w.dispose(),y=!0,S&2||this.editor.pushUndoStop()});s.push(r.resolve(l.token).then(()=>{if(!r.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(v&&r.completion.additionalTextEdits.some(E=>ye.isBefore(v,G.getStartPosition(E.range))))return!1;y&&this.editor.pushUndoStop();let x=Sx.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(E=>Qn.replaceMove(G.lift(E.range),E.text))),x.restoreRelativeVerticalPositionOfCursor(this.editor),(y||!(S&2))&&this.editor.pushUndoStop(),!0}).then(x=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",f.elapsed(),x),h=x===!0?1:x===!1?0:-2}).finally(()=>{b.dispose(),w.dispose()}))}let{insertText:g}=r.completion;if(r.completion.insertTextRules&4||(g=Og.escape(g)),this.model.cancel(),t.insert(g,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:i.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value,reason:sd.suggest({providerId:zz.fromExtensionId(r.extensionId?.value)})}),e&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===Y_t.id)this.model.trigger({auto:!0,retrigger:!0});else{let f=new On;s.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(v=>{r.completion.extensionId?vs(v):mt(v)}).finally(()=>{p=f.elapsed()}))}e&4&&this._alternatives.value.set(i,f=>{for(l.cancel();o.canUndo();){n!==o.getAlternativeVersionId()&&o.undo(),this._insertSuggestion(f,3|(e&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(s).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,o,u,p,h,i.index,i.model.items),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(i,e,t,o,n,r,s){if(Math.random()>1e-4)return;let l=new Map;for(let h=0;h<Math.min(30,s.length);h++){let g=s[h].textLabel;l.has(g)?l.get(g).push(h):l.set(g,[h])}let c=l.get(i.textLabel),p=c&&c.length>1?c[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:i.extensionId?.value??"unknown",providerId:i.provider._debugDisplayName??"unknown",kind:i.completion.kind,basenameHash:Lr(Be(e.uri)).toString(16),languageId:e.getLanguageId(),fileExtension:Ts(e.uri),resolveInfo:i.provider.resolveCompletionItem?t?1:0:-1,resolveDuration:i.resolveDuration,commandDuration:o,additionalEditsAsync:n,index:r,firstIndex:p})}getOverwriteInfo(i,e){To(this.editor.hasModel());let t=this.editor.getOption(134).insertMode==="replace";e&&(t=!t);let o=i.position.column-i.editStart.column,n=(t?i.editReplaceEnd.column:i.editInsertEnd.column)-i.position.column,r=this.editor.getPosition().column-i.position.column,s=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:o+r,overwriteAfter:n+s}}_alertCompletionItem(i){if(Rr(i.completion.additionalTextEdits)){let e=d(1642,null,i.textLabel,i.completion.additionalTextEdits.length);cn(e)}}triggerSuggest(i,e,t){this.editor.hasModel()&&(this.model.trigger({auto:e??!1,completionOptions:{providerFilter:i,kindFilter:t?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(i){if(!this.editor.hasModel())return;let e=this.editor.getPosition(),t=()=>{e.equals(this.editor.getPosition())&&this._commandService.executeCommand(i.fallback)},o=n=>{if(n.completion.insertTextRules&4||n.completion.additionalTextEdits)return!0;let r=this.editor.getPosition(),s=n.editStart.column,l=r.column;return l-s!==n.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:s,endLineNumber:r.lineNumber,endColumn:l})!==n.completion.insertText};U.once(this.model.onDidTrigger)(n=>{let r=[];U.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{je(r),t()},void 0,r),this.model.onDidSuggest(({completionModel:s})=>{if(je(r),s.items.length===0){t();return}let l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),s.items),c=s.items[l];if(!o(c)){t();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:c,model:s},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(e,0),this.editor.focus()}acceptSelectedSuggestion(i,e){let t=this.widget.value.getFocusedItem(),o=0;i&&(o|=4),e&&(o|=8),this._insertSuggestion(t,o)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.isInitialized?this.widget.value.forceRenderingAbove():this._wantsForceRenderingAbove=!0}stopForceRenderingAbove(){this.widget.isInitialized?this.widget.value.stopForceRenderingAbove():this._wantsForceRenderingAbove=!1}registerSelector(i){return this._selectors.register(i)}};Sc=I([m(1,uTe),m(2,fe),m(3,X),m(4,F),m(5,re),m(6,_e)],Sc);var Ngi=class{constructor(i){this.prioritySelector=i;this._items=new Array}register(i){if(this._items.indexOf(i)!==-1)throw new Error("Value is already registered");return this._items.push(i),this._items.sort((e,t)=>this.prioritySelector(t)-this.prioritySelector(e)),{dispose:()=>{let e=this._items.indexOf(i);e>=0&&this._items.splice(e,1)}}}get itemsOrderedByPriorityDesc(){return this._items}},Y_t=class a extends Mi{static{this.id="editor.action.triggerSuggest"}constructor(){super({id:a.id,label:P(1647,"Trigger Suggest"),precondition:C.and(me.writable,me.hasCompletionItemProvider,ar.Visible.toNegated()),kbOpts:{kbExpr:me.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(i,e,t){let o=Sc.get(e);if(!o)return;let n;t&&typeof t=="object"&&t.auto===!0&&(n=!0),o.triggerSuggest(void 0,n,void 0)}};Eo(Sc.ID,Sc,2);ri(Y_t);var WD=190,iE=od.bindToContribution(Sc.get);ro(new iE({id:"acceptSelectedSuggestion",precondition:C.and(ar.Visible,ar.HasFocusedSuggestion),handler(a){a.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:C.and(ar.Visible,me.textInputFocus),weight:WD},{primary:3,kbExpr:C.and(ar.Visible,me.textInputFocus,ar.AcceptSuggestionsOnEnter,ar.MakesTextEdit),weight:WD}],menuOpts:[{menuId:sH,title:d(1640,null),group:"left",order:1,when:C.and(ar.HasFocusedSuggestion,ar.HasInsertAndReplaceRange.toNegated())},{menuId:sH,title:d(1640,null),group:"left",order:1,when:C.and(ar.HasFocusedSuggestion,ar.HasInsertAndReplaceRange,ar.InsertMode.isEqualTo("insert"))},{menuId:sH,title:d(1641,null),group:"left",order:1,when:C.and(ar.HasFocusedSuggestion,ar.HasInsertAndReplaceRange,ar.InsertMode.isEqualTo("replace"))}]}));ro(new iE({id:"acceptAlternativeSelectedSuggestion",precondition:C.and(ar.Visible,me.textInputFocus,ar.HasFocusedSuggestion),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:1027,secondary:[1026]},handler(a){a.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:sH,group:"left",order:2,when:C.and(ar.HasFocusedSuggestion,ar.HasInsertAndReplaceRange,ar.InsertMode.isEqualTo("insert")),title:d(1641,null)},{menuId:sH,group:"left",order:2,when:C.and(ar.HasFocusedSuggestion,ar.HasInsertAndReplaceRange,ar.InsertMode.isEqualTo("replace")),title:d(1640,null)}]}));Ge.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");ro(new iE({id:"hideSuggestWidget",precondition:ar.Visible,handler:a=>a.cancelSuggestWidget(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:9,secondary:[1033]}}));ro(new iE({id:"selectNextSuggestion",precondition:C.and(ar.Visible,C.or(ar.MultipleSuggestions,ar.HasFocusedSuggestion.negate())),handler:a=>a.selectNextSuggestion(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}},menuOpts:{menuId:sH,group:"left",order:0,when:ar.HasFocusedSuggestion.toNegated(),title:d(1645,null)}}));ro(new iE({id:"selectNextPageSuggestion",precondition:C.and(ar.Visible,C.or(ar.MultipleSuggestions,ar.HasFocusedSuggestion.negate())),handler:a=>a.selectNextPageSuggestion(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:12,secondary:[2060]}}));ro(new iE({id:"selectLastSuggestion",precondition:C.and(ar.Visible,C.or(ar.MultipleSuggestions,ar.HasFocusedSuggestion.negate())),handler:a=>a.selectLastSuggestion()}));ro(new iE({id:"selectPrevSuggestion",precondition:C.and(ar.Visible,C.or(ar.MultipleSuggestions,ar.HasFocusedSuggestion.negate())),handler:a=>a.selectPrevSuggestion(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));ro(new iE({id:"selectPrevPageSuggestion",precondition:C.and(ar.Visible,C.or(ar.MultipleSuggestions,ar.HasFocusedSuggestion.negate())),handler:a=>a.selectPrevPageSuggestion(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:11,secondary:[2059]}}));ro(new iE({id:"selectFirstSuggestion",precondition:C.and(ar.Visible,C.or(ar.MultipleSuggestions,ar.HasFocusedSuggestion.negate())),handler:a=>a.selectFirstSuggestion()}));ro(new iE({id:"focusSuggestion",precondition:C.and(ar.Visible,ar.HasFocusedSuggestion.negate()),handler:a=>a.focusSuggestion(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));ro(new iE({id:"focusAndAcceptSuggestion",precondition:C.and(ar.Visible,ar.HasFocusedSuggestion.negate()),handler:a=>{a.focusSuggestion(),a.acceptSelectedSuggestion(!0,!1)}}));ro(new iE({id:"toggleSuggestionDetails",precondition:C.and(ar.Visible,ar.HasFocusedSuggestion),handler:a=>a.toggleSuggestionDetails(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:sH,group:"right",order:1,when:C.and(ar.DetailsVisible,ar.CanResolve),title:d(1644,null)},{menuId:sH,group:"right",order:1,when:C.and(ar.DetailsVisible.toNegated(),ar.CanResolve),title:d(1643,null)}]}));ro(new iE({id:"toggleExplainMode",precondition:ar.Visible,handler:a=>a.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));ro(new iE({id:"toggleSuggestionFocus",precondition:ar.Visible,handler:a=>a.toggleSuggestionFocus(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:2570,mac:{primary:778}}}));ro(new iE({id:"insertBestCompletion",precondition:C.and(me.textInputFocus,C.equals("config.editor.tabCompletion","on"),H4.AtEnd,ar.Visible.toNegated(),zA.OtherSuggestions.toNegated(),ss.InSnippetMode.toNegated()),handler:(a,i)=>{a.triggerSuggestAndAcceptBest(Di(i)?{fallback:"tab",...i}:{fallback:"tab"})},kbOpts:{weight:WD,primary:2}}));ro(new iE({id:"insertNextSuggestion",precondition:C.and(me.textInputFocus,C.equals("config.editor.tabCompletion","on"),zA.OtherSuggestions,ar.Visible.toNegated(),ss.InSnippetMode.toNegated()),handler:a=>a.acceptNextSuggestion(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:2}}));ro(new iE({id:"insertPrevSuggestion",precondition:C.and(me.textInputFocus,C.equals("config.editor.tabCompletion","on"),zA.OtherSuggestions,ar.Visible.toNegated(),ss.InSnippetMode.toNegated()),handler:a=>a.acceptPrevSuggestion(),kbOpts:{weight:WD,kbExpr:me.textInputFocus,primary:1026}}));ro(new class extends od{constructor(){super({id:"suggestWidgetCopy",precondition:ar.DetailsFocused,kbOpts:{weight:WD+10,kbExpr:ar.DetailsFocused,primary:2081,win:{primary:2081,secondary:[2067]}}})}runEditorCommand(a,i){Me(i.getDomNode()).document.execCommand("copy")}});ri(class extends Mi{constructor(){super({id:"editor.action.resetSuggestSize",label:P(1646,"Reset Suggest Widget Size"),precondition:void 0})}run(a,i){Sc.get(i)?.resetWidgetSize()}});var Ogi=class extends k{constructor(e,t,o){super();this.editor=e;this.suggestControllerPreselector=t;this.onWillAccept=o;this.isSuggestWidgetVisible=!1;this.isShiftKeyPressed=!1;this._isActive=!1;this._currentSuggestItemInfo=void 0;this._onDidSelectedItemChange=this._register(new T);this.onDidSelectedItemChange=this._onDidSelectedItemChange.event;this._register(e.onKeyDown(r=>{r.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(r=>{r.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));let n=Sc.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(l,c,u)=>{let p=this.editor.getModel();if(!p)return-1;let h=this.suggestControllerPreselector(),g=h?UA(h,p):void 0;if(!g)return-1;let f=ye.lift(c),v=u.map((S,y)=>{let w=_9e.fromSuggestion(n,p,f,S,this.isShiftKeyPressed),x=UA(w.getSingleTextEdit(),p),E=D_t(g,x);return{index:y,valid:E,prefixLength:x.text.length,suggestItem:S}}).filter(S=>S&&S.valid&&S.prefixLength>0),b=j5e(v,Il(S=>S.prefixLength,Hu));return b?b.index:-1}}));let r=!1,s=()=>{r||(r=!0,this._register(n.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(n.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(n.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(U.once(n.model.onDidTrigger)(l=>{s()})),this._register(n.onWillInsertSuggestItem(l=>{let c=this.editor.getPosition(),u=this.editor.getModel();if(!c||!u)return;let p=_9e.fromSuggestion(n,u,c,l.item,this.isShiftKeyPressed);this.onWillAccept(p)}))}this.update(this._isActive)}get selectedItem(){return this._currentSuggestItemInfo}update(e){let t=this.getSuggestItemInfo();(this._isActive!==e||!W8o(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){let e=Sc.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;let t=this.editor.getOption(102);if(typeof t=="object"&&(t.other==="offWhenInlineCompletions"||t.comments==="offWhenInlineCompletions"||t.strings==="offWhenInlineCompletions"))return;let o=e.widget.value.getFocusedItem(),n=this.editor.getPosition(),r=this.editor.getModel();if(!(!o||!n||!r))return _9e.fromSuggestion(e,r,n,o.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){Sc.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){Sc.get(this.editor)?.forceRenderingAbove()}},_9e=class a{constructor(i,e,t,o,n){this.range=i;this.insertText=e;this.completionItemKind=t;this.isSnippetText=o;this.listIncomplete=n}static fromSuggestion(i,e,t,o,n){let{insertText:r}=o.completion,s=!1;if(o.completion.insertTextRules&4){let c=new Og().parse(r);c.children.length<100&&Ex.adjustWhitespace(e,t,!0,c),r=c.toString(),s=!0}let l=i.getOverwriteInfo(o,n);return new a(G.fromPositions(t.delta(0,-l.overwriteBefore),t.delta(0,Math.max(l.overwriteAfter,0))),r,o.completion.kind,s,o.container.incomplete??!1)}equals(i){return this.range.equalsRange(i.range)&&this.insertText===i.insertText&&this.completionItemKind===i.completionItemKind&&this.isSnippetText===i.isSnippetText}toSelectedSuggestionInfo(){return new wIt(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}getSingleTextEdit(){return new ys(this.range,this.insertText)}};function W8o(a,i){return a===i?!0:!a||!i?!1:a.equals(i)}var X_t=class extends k{constructor(e,t,o){super();this._editorObs=e;this._handleSuggestAccepted=t;this._suggestControllerPreselector=o;this._suggestWidgetAdaptor=this._register(new Ogi(this._editorObs.editor,()=>(this._editorObs.forceUpdate(),this._suggestControllerPreselector()),n=>this._editorObs.forceUpdate(r=>{this._handleSuggestAccepted(n)}))),this.selectedItem=vi(this,n=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(r=>n(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem)}stopForceRenderingAbove(){this._suggestWidgetAdaptor.stopForceRenderingAbove()}forceRenderingAbove(){this._suggestWidgetAdaptor.forceRenderingAbove()}};var Fue=class a{constructor(i,e){this.startColumn=i;this.endColumnExclusive=e;if(i>e)throw new ci(`startColumn ${i} cannot be after endColumnExclusive ${e}`)}static fromOffsetRange(i){return new a(i.start+1,i.endExclusive+1)}toRange(i){return new G(i,this.startColumn,i,this.endColumnExclusive)}equals(i){return this.startColumn===i.startColumn&&this.endColumnExclusive===i.endColumnExclusive}toZeroBasedOffsetRange(){return new gi(this.startColumn-1,this.endColumnExclusive-1)}};var J_t=class a{constructor(i,e){this.lineNumber=i;this.columnRange=e}static fromRange(i){if(i.endLineNumber===i.startLineNumber)return new a(i.startLineNumber,new Fue(i.startColumn,i.endColumn))}toRange(){return new G(this.lineNumber,this.columnRange.startColumn,this.lineNumber,this.columnRange.endColumnExclusive)}};var D9e=class a{constructor(i){this._tokenInfo=i}static fromLineTokens(i){let e=[];for(let t=0;t<i.getCount();t++)e.push(new Z_t(i.getTokenText(t),i.getMetadata(t)));return a.create(e)}static create(i){return new a(i)}toLineTokens(i){return Cd.createFromTextAndMetadata(this.map((e,t)=>({text:t.text,metadata:t.metadata})),i)}forEach(i){let e=0;for(let t of this._tokenInfo){let o=new gi(e,e+t.text.length);i(o,t),e+=t.text.length}}map(i){let e=[],t=0;for(let o of this._tokenInfo){let n=new gi(t,t+o.text.length);e.push(i(n,o)),t+=o.text.length}return e}slice(i){let e=[],t=0;for(let o of this._tokenInfo){let n=t,r=n+o.text.length;if(r>i.start){if(n>=i.endExclusive)break;let s=Math.max(0,i.start-n),l=Math.max(0,r-i.endExclusive);e.push(new Z_t(o.text.slice(s,o.text.length-l),o.metadata))}t+=o.text.length}return a.create(e)}append(i){let e=this._tokenInfo.concat(i._tokenInfo);return a.create(e)}},Z_t=class{constructor(i,e){this.text=i;this.metadata=e}};var eDt=class a{constructor(i=L.warning){this.icon=i}static from(i){if(i)return new a(i.icon)}},uoo=!0,hoo="ghost-text",b2=class extends k{constructor(e,t,o,n){super();this._editor=e;this._data=t;this._languageService=n;this._isDisposed=De(this,!1);this._warningState=ke(e=>{let t=this._data.read(e),o=t?.warning;if(!t||!o)return;let n=t.ghostText;return{lineNumber:n.lineNumber,position:new ye(n.lineNumber,n.parts[0].column),icon:o.icon}});this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this._nonWhitespaceCount=ke(this,e=>{let t=this._data.read(e);return t?t.ghostText.parts.map(r=>r.lines.map(s=>s.line).join("")).join("").replace(/\s/g,"").length:void 0});this._extraClassNames=ke(this,e=>{let t=this._extraClasses.slice();uoo&&this._warningState.read(e)&&t.push("warning");let o=this._nonWhitespaceCount.read(e);return this._highlightShortText&&o&&o<3?t.push("short-text"):this._useSyntaxHighlighting.read(e)&&t.push("syntax-highlighted"),t.map(r=>` ${r}`).join("")});this._state=ke(this,e=>{if(this._isDisposed.read(e))return;let t=this._data.read(e);if(!t)return;let o=this._editorObs.model.read(e);if(!o)return;let n=t.ghostText,r=n instanceof sTe?n.columnRange:void 0,s=this._useSyntaxHighlighting.read(e),l=this._extraClassNames.read(e),{inlineTexts:c,additionalLines:u,hiddenRange:p,additionalLinesOriginalSuffix:h}=V8o(n,o,hoo+l),g=o.getLineContent(n.lineNumber),f=new Ad(c.map(N=>xd.insert(N.column-1,N.text))),v=s?o.tokenization.tokenizeLinesAt(n.lineNumber,[f.apply(g),...u.map(N=>N.content)]):void 0,b=f.getNewRanges(),S=c.map((N,V)=>({...N,tokens:v?.[0]?.getTokensInRange(b[V])})),y=u.map((N,V)=>{let H=v?.[V+1]??Cd.createEmpty(N.content,this._languageService.languageIdCodec);if(V===u.length-1&&h){let j=D9e.fromLineTokens(o.tokenization.getLineTokens(h.lineNumber)).slice(h.columnRange.toZeroBasedOffsetRange());H=D9e.fromLineTokens(H).append(j).toLineTokens(H.languageIdCodec)}return new Vgi(H,N.decorations)}),w=this._editor.getSelection()?.getStartPosition().column,x=S.filter(N=>N.text!==""),E=x.length!==0,M=new Pue((E?x[0].column:1)-w,E?0:u.findIndex(N=>N.content!=="")+1,E?1:0,u.length+(E?1:0),0,Fye(x.map(N=>N.text.length))+Fye(y.map(N=>N.content.getTextLength())),x.length+(u.length>0?1:0),x.length>1&&y.length===0?x.every(N=>N.text===x[0].text):void 0);return{replacedRange:r,inlineTexts:S,additionalLines:y,hiddenRange:p,lineNumber:n.lineNumber,additionalReservedLineCount:this._minReservedLineCount.read(e),targetTextModel:o,syntaxHighlightingEnabled:s,telemetryViewData:M,handleInlineCompletionShown:t.handleInlineCompletionShown}});this._decorations=ke(this,e=>{let t=this._state.read(e);if(!t)return[];let o=[],n=this._extraClassNames.read(e);t.replacedRange&&o.push({range:t.replacedRange.toRange(t.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace"+n,description:"GhostTextReplacement"}}),t.hiddenRange&&o.push({range:t.hiddenRange.toRange(t.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(let r of t.inlineTexts){let s="";this._highlightShortText&&r.text.length<5&&(s+=" short-text"),o.push({range:G.fromPositions(new ye(t.lineNumber,r.column)),options:{description:"ghost-text-decoration",after:{content:r.text,tokens:r.tokens,inlineClassName:(r.preview?"ghost-text-decoration-preview":"ghost-text-decoration")+(this._isClickable?" clickable":"")+n+s+r.lineDecorations.map(l=>" "+l.className).join(" "),cursorStops:2,attachedData:new R9e(this)},showIfCollapsed:!0}})}return o});this.isHovered=ke(this,e=>this._isDisposed.read(e)?!1:this._isInlineTextHovered.read(e)||this._additionalLinesWidget.isHovered.read(e));this.height=ke(this,e=>this._editorObs.getOption(75).read(e)+(this._additionalLinesWidget.viewZoneHeight.read(e)??0));this._extraClasses=o.extraClasses??[],this._isClickable=o.isClickable??!1,this._shouldKeepCursorStable=o.shouldKeepCursorStable??!1,this._minReservedLineCount=o.minReservedLineCount??Fo(0),this._useSyntaxHighlighting=o.useSyntaxHighlighting??Fo(!0),this._highlightShortText=o.highlightShortSuggestions??!1,this._editorObs=Ds(this._editor),this._additionalLinesWidget=this._register(new Wgi(this._editor,Js({owner:this,equalsFn:_z(vY())},r=>{let s=this._state.read(r);return s?new Fgi(s.lineNumber,s.additionalLines,s.additionalReservedLineCount):void 0}),this._shouldKeepCursorStable,this._isClickable)),this._isInlineTextHovered=this._editorObs.isTargetHovered(r=>r.target.type===6&&r.target.detail.injectedText?.options.attachedData instanceof R9e&&r.target.detail.injectedText.options.attachedData.owner===this,this._store),this._register(ee(()=>{this._isDisposed.set(!0,void 0)})),this._register(this._editorObs.setDecorations(this._decorations)),this._isClickable&&(this._register(this._additionalLinesWidget.onDidClick(r=>this._onDidClick.fire(r))),this._register(this._editor.onMouseUp(r=>{if(r.target.type!==6)return;let s=r.target.detail.injectedText?.options.attachedData;s instanceof R9e&&s.owner===this&&this._onDidClick.fire(r.event)}))),this._register(ve(r=>{let s=this._state.read(r);s?.handleInlineCompletionShown(s.telemetryViewData)})),this._register(Rl((r,s)=>{if(uoo)return;let l=this._warningState.read(r);if(!l)return;let c=this._editorObs.getOption(75);s.add(this._editorObs.createContentWidget({position:Fo({position:new ye(l.lineNumber,Number.MAX_SAFE_INTEGER),preference:[0],positionAffinity:1}),allowEditorOverflow:!1,domNode:$o.div({class:"ghost-text-view-warning-widget",style:{width:c,height:c,marginLeft:4,color:"orange"},ref:u=>{u.ghostTextViewWarningWidgetData={range:G.fromPositions(l.position)}}},[$o.div({class:"ghost-text-view-warning-widget-icon",style:{width:"100%",height:"100%",display:"flex",alignContent:"center",alignItems:"center"}},[un(l.icon)])]).keepUpdated(s).element}))}))}static getWarningWidgetContext(e){let t=e.ghostTextViewWarningWidgetData;if(t)return t;if(e.parentElement)return this.getWarningWidgetContext(e.parentElement)}ownsViewZone(e){return this._additionalLinesWidget.viewZoneId===e}};b2=I([m(3,Rt)],b2);var R9e=class{constructor(i){this.owner=i}};function V8o(a,i,e){let t=[],o=[];function n(p,h){if(o.length>0){let g=o[o.length-1];h&&g.decorations.push(new Wb(g.content.length+1,g.content.length+1+p[0].line.length,h,0)),g.content+=p[0].line,p=p.slice(1)}for(let g of p)o.push({content:g.line,decorations:h?[new Wb(1,g.line.length+1,h,0),...g.lineDecorations]:[...g.lineDecorations]})}let r=i.getLineContent(a.lineNumber),s,l=0;for(let p of a.parts){let h=p.lines;s===void 0?(t.push({column:p.column,text:h[0].line,preview:p.preview,lineDecorations:h[0].lineDecorations}),h=h.slice(1)):n([{line:r.substring(l,p.column-1),lineDecorations:[]}],void 0),h.length>0&&(n(h,e),s===void 0&&p.column<=r.length&&(s=p.column)),l=p.column-1}let c;s!==void 0&&(c=new J_t(a.lineNumber,new Fue(l+1,r.length+1)));let u=s!==void 0?new Fue(s,r.length+1):void 0;return{inlineTexts:t,additionalLines:o,hiddenRange:u,additionalLinesOriginalSuffix:c}}var Fgi=class{constructor(i,e,t){this.lineNumber=i;this.additionalLines=e;this.minReservedLineCount=t}equals(i){return this.lineNumber!==i.lineNumber||this.minReservedLineCount!==i.minReservedLineCount?!1:eo(this.additionalLines,i.additionalLines,vY())}},Wgi=class extends k{constructor(e,t,o,n){super();this._editor=e;this._lines=t;this._shouldKeepCursorStable=o;this._isClickable=n;this._viewZoneHeight=De("viewZoneHeight",void 0),this.editorOptionsChanged=qr("editorOptionChanged",U.filter(this._editor.onDidChangeConfiguration,r=>r.hasChanged(40)||r.hasChanged(133)||r.hasChanged(113)||r.hasChanged(108)||r.hasChanged(60)||r.hasChanged(59)||r.hasChanged(75))),this._onDidClick=this._register(new T),this.onDidClick=this._onDidClick.event,this._viewZoneListener=this._register(new ue),this.isHovered=Ds(this._editor).isTargetHovered(r=>poo(r.target.element),this._store),this.hasBeenAccepted=!1,this._editor instanceof us&&this._shouldKeepCursorStable&&this._register(this._editor.onBeforeExecuteEdit(r=>this.hasBeenAccepted=r.source==="inlineSuggestion.accept")),this._register(ve(r=>{let s=this._lines.read(r);this.editorOptionsChanged.read(r),s?(this.hasBeenAccepted=!1,this.updateLines(s.lineNumber,s.additionalLines,s.minReservedLineCount)):this.clear()}))}get viewZoneId(){return this._viewZoneInfo?.viewZoneId}get viewZoneHeight(){return this._viewZoneHeight}dispose(){super.dispose(),this.clear()}clear(){this._viewZoneListener.clear(),this._editor.changeViewZones(e=>{this.removeActiveViewZone(e)})}updateLines(e,t,o){let n=this._editor.getModel();if(!n)return;let{tabSize:r}=n.getOptions();Ds(this._editor).transaction(s=>{this._editor.changeViewZones(l=>{let c=new O;this.removeActiveViewZone(l);let u=Math.max(t.length,o);if(u>0){let p=document.createElement("div");B8o(p,r,t,this._editor.getOptions(),this._isClickable),this._isClickable&&(c.add($(p,"mousedown",h=>{h.preventDefault()})),c.add($(p,"click",h=>{poo(h.target)&&this._onDidClick.fire(new Ln(Me(h),h))}))),this.addViewZone(l,e,u,p)}this._viewZoneListener.value=c})})}addViewZone(e,t,o,n){let r=e.addZone({afterLineNumber:t,heightInLines:o,domNode:n,afterColumnAffinity:1,onComputedHeight:s=>{this._viewZoneHeight.set(s,void 0)}});this.keepCursorStable(t,o),this._viewZoneInfo={viewZoneId:r,heightInLines:o,lineNumber:t}}removeActiveViewZone(e){this._viewZoneInfo&&(e.removeZone(this._viewZoneInfo.viewZoneId),this.hasBeenAccepted||this.keepCursorStable(this._viewZoneInfo.lineNumber,-this._viewZoneInfo.heightInLines),this._viewZoneInfo=void 0,this._viewZoneHeight.set(void 0,void 0))}keepCursorStable(e,t){if(!this._shouldKeepCursorStable)return;let o=this._editor.getSelection()?.getStartPosition()?.lineNumber;o!==void 0&&e<o&&this._editor.setScrollTop(this._editor.getScrollTop()+t*this._editor.getOption(75))}};function poo(a){return go(a)&&a.classList.contains(hoo)}var Vgi=class{constructor(i,e){this.content=i;this.decorations=e}equals(i){return this.content.equals(i.content)?Wb.equalsArr(this.decorations,i.decorations):!1}};function B8o(a,i,e,t,o){let n=t.get(40),r=t.get(133),s="none",l=t.get(108),c=t.get(60),u=t.get(59),p=t.get(75),h="suggest-preview-text";o&&(h+=" clickable");let g=new EI(1e4);g.appendString(`<div class="${h}">`);for(let b=0,S=e.length;b<S;b++){let y=e[b],w=y.content;g.appendString('<div class="view-line'),g.appendString('" style="top:'),g.appendString(String(b*p)),g.appendString('px;width:1000000px;">');let x=w.getLineContent(),E=xz(x),M=mA(x);NB(new KL(u.isMonospace&&!n,u.canUseHalfwidthRightwardsArrow,x,!1,E,M,0,w,y.decorations.slice(),i,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,r,s,l,c!==Mk.OFF,null,null,0),g),g.appendString("</div>")}g.appendString("</div>"),ku(a,u);let f=g.build(),v=moo?moo.createHTML(f):f;a.innerHTML=v}var moo=zf("editorGhostText",{createHTML:a=>a});var FJ=class a{constructor(i,e){this.width=i;this.height=e}static equals(i,e){return i.width===e.width&&i.height===e.height}add(i){return new a(this.width+i.width,this.height+i.height)}deltaX(i){return new a(this.width+i,this.height)}deltaY(i){return new a(this.width,this.height+i)}toString(){return`(${this.width},${this.height})`}subtract(i){return new a(this.width-i.width,this.height-i.height)}scale(i){return new a(this.width*i,this.height*i)}scaleWidth(i){return new a(this.width*i,this.height)}mapComponents(i){return new a(i(this.width),i(this.height))}isZero(){return this.width===0&&this.height===0}transpose(){return new a(this.height,this.width)}toDimension(){return{width:this.width,height:this.height}}};var ap=class a{constructor(i,e,t,o){this.left=i;this.top=e;this.right=t;this.bottom=o;if(i>t)throw new ci("Invalid arguments: Horizontally offset by "+(i-t));if(e>o)throw new ci("Invalid arguments: Vertically offset by "+(e-o))}static fromPoint(i){return new a(i.x,i.y,i.x,i.y)}static fromPoints(i,e){return new a(i.x,i.y,e.x,e.y)}static fromPointSize(i,e){return new a(i.x,i.y,i.x+e.x,i.y+e.y)}static fromLeftTopRightBottom(i,e,t,o){return new a(i,e,t,o)}static fromLeftTopWidthHeight(i,e,t,o){return new a(i,e,i+t,e+o)}static fromRanges(i,e){return new a(i.start,e.start,i.endExclusive,e.endExclusive)}static hull(i){let e=Number.MAX_SAFE_INTEGER,t=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;for(let r of i)e=Math.min(e,r.left),t=Math.min(t,r.top),o=Math.max(o,r.right),n=Math.max(n,r.bottom);return new a(e,t,o,n)}get width(){return this.right-this.left}get height(){return this.bottom-this.top}withMargin(i,e,t,o){let n,r,s,l;return e===void 0&&t===void 0&&o===void 0?n=r=s=l=i:t===void 0&&o===void 0?(n=r=e,s=l=i):(n=o,r=e,s=i,l=t),new a(this.left-n,this.top-s,this.right+r,this.bottom+l)}intersectVertical(i){let e=Math.max(this.top,i.start),t=Math.min(this.bottom,i.endExclusive);return new a(this.left,e,this.right,Math.max(e,t))}intersectHorizontal(i){let e=Math.max(this.left,i.start),t=Math.min(this.right,i.endExclusive);return new a(e,this.top,Math.max(e,t),this.bottom)}toString(){return`Rect{(${this.left},${this.top}), (${this.right},${this.bottom})}`}intersect(i){let e=Math.max(this.left,i.left),t=Math.min(this.right,i.right),o=Math.max(this.top,i.top),n=Math.min(this.bottom,i.bottom);if(!(e>t||o>n))return new a(e,o,t,n)}union(i){return new a(Math.min(this.left,i.left),Math.min(this.top,i.top),Math.max(this.right,i.right),Math.max(this.bottom,i.bottom))}containsRect(i){return this.left<=i.left&&this.top<=i.top&&this.right>=i.right&&this.bottom>=i.bottom}containsPoint(i){return this.left<=i.x&&this.top<=i.y&&this.right>=i.x&&this.bottom>=i.y}moveToBeContainedIn(i){let e=this.width,t=this.height,o=this.left,n=this.top;return o<i.left?o=i.left:o+e>i.right&&(o=i.right-e),n<i.top?n=i.top:n+t>i.bottom&&(n=i.bottom-t),new a(o,n,o+e,n+t)}withWidth(i){return new a(this.left,this.top,this.left+i,this.bottom)}withHeight(i){return new a(this.left,this.top,this.right,this.top+i)}withTop(i){return new a(this.left,i,this.right,this.bottom)}withLeft(i){return new a(i,this.top,this.right,this.bottom)}translateX(i){return new a(this.left+i,this.top,this.right+i,this.bottom)}translateY(i){return new a(this.left,this.top+i,this.right,this.bottom+i)}translate(i){return new a(this.left+i.x,this.top+i.y,this.right+i.x,this.bottom+i.y)}deltaRight(i){return new a(this.left,this.top,this.right+i,this.bottom)}deltaTop(i){return new a(this.left,this.top+i,this.right,this.bottom)}deltaLeft(i){return new a(this.left+i,this.top,this.right,this.bottom)}deltaBottom(i){return new a(this.left,this.top,this.right,this.bottom+i)}getLeftBottom(){return new Mg(this.left,this.bottom)}getRightBottom(){return new Mg(this.right,this.bottom)}getLeftTop(){return new Mg(this.left,this.top)}getRightTop(){return new Mg(this.right,this.top)}toStyles(){return{position:"absolute",left:`${this.left}px`,top:`${this.top}px`,width:`${this.width}px`,height:`${this.height}px`}}getHorizontalRange(){return new gi(this.left,this.right)}getVerticalRange(){return new gi(this.top,this.bottom)}withHorizontalRange(i){return new a(i.start,this.top,i.endExclusive,this.bottom)}withVerticalRange(i){return new a(this.left,i.start,this.right,i.endExclusive)}getSize(){return new FJ(this.width,this.height)}};var vTe=class a{constructor(i,e,t,o=null){this.startLineNumbers=i;this.endLineNumbers=e;this.lastLineRelativePosition=t;this.showEndForLine=o}equals(i){return!!i&&this.lastLineRelativePosition===i.lastLineRelativePosition&&this.showEndForLine===i.showEndForLine&&eo(this.startLineNumbers,i.startLineNumbers)&&eo(this.endLineNumbers,i.endLineNumbers)}static get Empty(){return new a([],[],0)}},goo=zf("stickyScrollViewLayer",{createHTML:a=>a}),Bgi="data-sticky-line-index",foo="data-sticky-is-line",H8o="data-sticky-is-line-number",voo="data-sticky-is-folding-icon",tDt=class extends k{constructor(e){super();this._foldingIconStore=this._register(new O);this._rootDomNode=document.createElement("div");this._lineNumbersDomNode=document.createElement("div");this._linesDomNodeScrollable=document.createElement("div");this._linesDomNode=document.createElement("div");this._renderedStickyLines=[];this._lineNumbers=[];this._lastLineRelativePosition=0;this._minContentWidthInPx=0;this._isOnGlyphMargin=!1;this._height=-1;this._onDidChangeStickyScrollHeight=this._register(new T);this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event;this._editor=e,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof Ed),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable),this._setHeight(0);let t=()=>{this._linesDomNode.style.left=this._editor.getOption(131).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(131)&&t()})),this._register(this._editor.onDidScrollChange(o=>{o.scrollLeftChanged&&t(),o.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),t(),this._register(this._editor.onDidLayoutChange(o=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get height(){return this._height}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,o){let n=!this._state&&!e,r=this._state&&this._state.equals(e);if(o===void 0&&(n||r))return;let s=this._findRenderingData(e),l=this._lineNumbers;this._lineNumbers=s.lineNumbers,this._lastLineRelativePosition=s.lastLineRelativePosition;let c=this._findIndexToRebuildFrom(l,this._lineNumbers,o);this._renderRootNode(this._lineNumbers,this._lastLineRelativePosition,t,c),this._state=e}_findRenderingData(e){if(!e)return{lineNumbers:[],lastLineRelativePosition:0};let t=[...e.startLineNumbers];e.showEndForLine!==null&&(t[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]);let o=0;for(let n=0;n<t.length;n++)o+=this._editor.getLineHeightForPosition(new ye(t[n],1));return o===0?{lineNumbers:[],lastLineRelativePosition:0}:{lineNumbers:t,lastLineRelativePosition:e.lastLineRelativePosition}}_findIndexToRebuildFrom(e,t,o){if(t.length===0)return 0;if(o!==void 0)return o;let n=t.findIndex(r=>!e.includes(r));return n===-1?0:n}_updateWidgetWidth(){let e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(let t of this._renderedStickyLines){let o=t.foldingIcon;o&&o.setVisible(e?!0:o.isCollapsed)}}async _renderRootNode(e,t,o,n){let r=this._editor._getViewModel();if(!r){this._clearWidget();return}if(e.length===0){this._clearWidget();return}let s=[],l=e[e.length-1],c=0;for(let p=0;p<this._renderedStickyLines.length;p++)if(p<n){let h=this._renderedStickyLines[p];s.push(this._updatePosition(h,c,h.lineNumber===l)),c+=h.height}else{let h=this._renderedStickyLines[p];h.lineNumberDomNode.remove(),h.lineDomNode.remove()}let u=this._editor.getLayoutInfo();for(let p=n;p<e.length;p++){let h=this._renderChildNode(r,p,e[p],c,l===e[p],o,u);c+=h.height,this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),s.push(h)}o&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin)),this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(p=>p.scrollWidth))+u.verticalScrollbarWidth,this._renderedStickyLines=s,this._setHeight(c+t),this._editor.layoutOverlayWidget(this)}_clearWidget(){for(let e=0;e<this._renderedStickyLines.length;e++){let t=this._renderedStickyLines[e];t.lineNumberDomNode.remove(),t.lineDomNode.remove()}this._setHeight(0)}_setHeight(e){this._height!==e&&(this._height=e,this._height===0?this._rootDomNode.style.display="none":(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${this._height}px`,this._linesDomNodeScrollable.style.height=`${this._height}px`,this._rootDomNode.style.height=`${this._height}px`),this._onDidChangeStickyScrollHeight.fire({height:this._height}))}_setFoldingHoverListeners(){this._foldingIconStore.clear(),this._editor.getOption(126)==="mouseover"&&(this._foldingIconStore.clear(),this._foldingIconStore.add($(this._lineNumbersDomNode,ne.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add($(this._lineNumbersDomNode,ne.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,o,n,r,s,l){let c=new Hgi(this._editor,e,l,s,this._isOnGlyphMargin,t,o);return this._updatePosition(c,n,r)}_updatePosition(e,t,o){let n=e.lineDomNode,r=e.lineNumberDomNode;if(o){n.style.zIndex="0",r.style.zIndex="0";let l=`${t+this._lastLineRelativePosition+(e.foldingIcon?.isCollapsed?1:0)}px`;n.style.top=l,r.style.top=l}else n.style.zIndex="1",r.style.zIndex="1",n.style.top=`${t}px`,r.style.top=`${t}px`;return e}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOrdinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._renderedStickyLines.length&&this._renderedStickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;let t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;let o=L5(t.characterMapping,e,0);return new ye(t.lineNumber,o)}getLineNumberFromChildDomNode(e){return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(e){let t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){let t=this._getAttributeValue(e,Bgi);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,foo)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,voo)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){let o=e.getAttribute(t);if(o!==null)return o;e=e.parentElement}}},Hgi=class{constructor(i,e,t,o,n,r,s){this.index=r;this.lineNumber=s;let l=e.coordinatesConverter.convertModelPositionToViewPosition(new ye(s,1)).lineNumber,c=e.getViewLineRenderingData(l),u=i.getOption(76),p=i.getOption(117).verticalScrollbarSize,h;try{h=Wb.filter(c.inlineDecorations,l,c.minColumn,c.maxColumn)}catch{h=[]}let g=i.getLineHeightForPosition(new ye(s,1)),f=e.getTextDirection(s),v=new KL(!0,!0,c.content,c.continuesWithWrappedLine,c.isBasicASCII,c.containsRTL,0,c.tokens,h,c.tabSize,c.startVisibleColumn,1,1,1,500,"none",!0,!0,null,f,p),b=new EI(2e3),S=NB(v,b);this.characterMapping=S.characterMapping;let y;goo?y=goo.createHTML(b.build()):y=b.build();let w=document.createElement("span");w.setAttribute(Bgi,String(r)),w.setAttribute(foo,""),w.setAttribute("role","listitem"),w.tabIndex=0,w.className="sticky-line-content",w.classList.add(`stickyLine${s}`),w.style.lineHeight=`${g}px`,w.innerHTML=y;let x=document.createElement("span");x.setAttribute(Bgi,String(r)),x.setAttribute(H8o,""),x.className="sticky-line-number",x.style.lineHeight=`${g}px`;let E=t.contentLeft;x.style.width=`${E}px`;let M=document.createElement("span");u.renderType===1||u.renderType===3&&s%10===0?M.innerText=s.toString():u.renderType===2&&(M.innerText=Math.abs(s-i.getPosition().lineNumber).toString()),M.className="sticky-line-number-inner",M.style.width=`${t.lineNumbersWidth}px`,M.style.paddingLeft=`${t.lineNumbersLeft}px`,x.appendChild(M),this.foldingIcon=this._renderFoldingIconForLine(i,o,s,g,n),this.foldingIcon&&(x.appendChild(this.foldingIcon.domNode),this.foldingIcon.domNode.style.left=`${t.lineNumbersWidth+t.lineNumbersLeft}px`,this.foldingIcon.domNode.style.lineHeight=`${g}px`),i.applyFontInfo(w),i.applyFontInfo(x),x.style.lineHeight=`${g}px`,w.style.lineHeight=`${g}px`,x.style.height=`${g}px`,w.style.height=`${g}px`,this.scrollWidth=w.scrollWidth,this.lineDomNode=w,this.lineNumberDomNode=x,this.height=g}_renderFoldingIconForLine(i,e,t,o,n){let r=i.getOption(126);if(!e||r==="never")return;let s=e.regions,l=s.findRange(t),c=s.getStartLineNumber(l);if(!(t===c))return;let p=s.isCollapsed(l),h=new Ugi(p,c,s.getEndLineNumber(l),o);return h.setVisible(n?!0:p||r==="always"),h.domNode.setAttribute(voo,""),h}},Ugi=class{constructor(i,e,t,o){this.isCollapsed=i;this.foldingStartLine=e;this.foldingEndLine=t;this.dimension=o;this.domNode=document.createElement("div"),this.domNode.style.width="26px",this.domNode.style.height=`${o}px`,this.domNode.style.lineHeight=`${o}px`,this.domNode.className=q.asClassName(i?Iue:Sue)}setVisible(i){this.domNode.style.cursor=i?"pointer":"default",this.domNode.style.opacity=i?"1":"0"}};var K4=class{constructor(i,e){this.startLineNumber=i;this.endLineNumber=e}},Wue=class{constructor(i,e,t){this.range=i;this.children=e;this.parent=t}},L9e=class{constructor(i,e,t,o){this.uri=i;this.version=e;this.element=t;this.outlineProviderId=o}};var bTe=class extends k{constructor(e,t,o,n){super();this._editor=e;this._modelProviders=[];this._modelPromise=null;this._updateScheduler=this._register(new rn(300));this._updateOperation=this._register(new O);switch(this._editor.getOption(131).defaultModel){case"outlineModel":this._modelProviders.push(new M9e(this._editor,n));case"foldingProviderModel":this._modelProviders.push(new A9e(this._editor,t,n));case"indentationModel":this._modelProviders.push(new P9e(this._editor,o));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(let t of this._modelProviders){let{statusPromise:o,modelPromise:n}=t.computeStickyModel(e);this._modelPromise=n;let r=await o;if(this._modelPromise!==n)return null;switch(r){case 2:return this._updateOperation.clear(),null;case 0:return t.stickyModel}}return null}).catch(t=>(mt(t),null))}};bTe=I([m(2,F),m(3,Jt)],bTe);var iDt=class extends k{constructor(e){super();this._editor=e;this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,1}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};let t=Hn(o=>this.createModelFromProvider(o));return{statusPromise:t.then(o=>this.isModelValid(o)?e.isCancellationRequested?2:(this._stickyModel=this.createStickyModel(e,o),0):this._invalid()).then(void 0,o=>(mt(o),2)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}},M9e=class extends iDt{constructor(e,t){super(e);this._languageFeaturesService=t}createModelFromProvider(e){return h0.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){let{stickyOutlineElement:o,providerID:n}=this._stickyModelFromOutlineModel(t,this._stickyModel?.outlineProviderId),r=this._editor.getModel();return new L9e(r.uri,r.getVersionId(),o,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let o;if(yt.first(e.children.values())instanceof pC){let l=yt.find(e.children.values(),c=>c.id===t);if(l)o=l.children;else{let c="",u=-1,p;for(let[h,g]of e.children.entries()){let f=this._findSumOfRangesOfGroup(g);f>u&&(p=g,u=f,c=g.id)}t=c,o=p.children}}else o=e.children;let n=[],r=Array.from(o.values()).sort((l,c)=>{let u=new K4(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber),p=new K4(c.symbol.range.startLineNumber,c.symbol.range.endLineNumber);return this._comparator(u,p)});for(let l of r)n.push(this._stickyModelFromOutlineElement(l,l.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new Wue(void 0,n,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){let o=[];for(let r of e.children.values())if(r.symbol.selectionRange.startLineNumber!==r.symbol.range.endLineNumber)if(r.symbol.selectionRange.startLineNumber!==t)o.push(this._stickyModelFromOutlineElement(r,r.symbol.selectionRange.startLineNumber));else for(let s of r.children.values())o.push(this._stickyModelFromOutlineElement(s,r.symbol.selectionRange.startLineNumber));o.sort((r,s)=>this._comparator(r.range,s.range));let n=new K4(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new Wue(n,o,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(let o of e.children.values())t+=this._findSumOfRangesOfGroup(o);return e instanceof Iv?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};M9e=I([m(1,Jt)],M9e);var oDt=class extends iDt{constructor(i){super(i),this._foldingLimitReporter=this._register(new X6e(i))}createStickyModel(i,e){let t=this._fromFoldingRegions(e),o=this._editor.getModel();return new L9e(o.uri,o.getVersionId(),t,void 0)}isModelValid(i){return i!==null}_fromFoldingRegions(i){let e=i.length,t=[],o=new Wue(void 0,[],void 0);for(let n=0;n<e;n++){let r=i.getParentIndex(n),s;r!==-1?s=t[r]:s=o;let l=new Wue(new K4(i.getStartLineNumber(n),i.getEndLineNumber(n)+1),[],s);s.children.push(l),t.push(l)}return o}},P9e=class extends oDt{constructor(e,t){super(e);this._languageConfigurationService=t;this.provider=this._register(new bue(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};P9e=I([m(1,Us)],P9e);var A9e=class extends oDt{constructor(e,t,o){super(e);this._languageFeaturesService=o;this.provider=this._register(new ue);this._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(()=>{this._updateProvider(e,t)})),this._updateProvider(e,t)}_updateProvider(e,t){let o=$f.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());o.length!==0&&(this.provider.value=new yue(e.getModel(),o,t,this._foldingLimitReporter,void 0))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider.value?.compute(e)??null}};A9e=I([m(2,Jt)],A9e);var zgi=class{constructor(i,e,t,o){this.startLineNumber=i;this.endLineNumber=e;this.top=t;this.height=o}},STe=class extends k{constructor(e,t,o){super();this._languageFeaturesService=t;this._languageConfigurationService=o;this._onDidChangeStickyScroll=this._register(new T);this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event;this._model=null;this._cts=null;this._stickyModelProvider=null;this._editor=e,this._sessionStore=this._register(new O),this._updateSoon=this._register(new Dt(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(131)&&this.readConfiguration()})),this.readConfiguration()}static{this.ID="store.contrib.stickyScrollController"}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(131).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(ee(()=>{this._stickyModelProvider?.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){return this._model?.version}updateStickyModelProvider(){this._stickyModelProvider?.dispose(),this._stickyModelProvider=null,this._editor.hasModel()&&(this._stickyModelProvider=new bTe(this._editor,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new qe,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}let t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}getCandidateStickyLinesIntersecting(e){if(!this._model?.element)return[];let t=[];return this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,0,-1),this.filterHiddenRanges(t)}getCandidateStickyLinesIntersectingFromStickyModel(e,t,o,n,r,s){let l=this._editor.getModel();if(!l||t.children.length===0)return;let c=s,u=[];for(let g=0;g<t.children.length;g++){let f=t.children[g];f.range&&u.push(f.range.startLineNumber)}let p=this.updateIndex(Ek(u,e.startLineNumber,(g,f)=>g-f)),h=this.updateIndex(Ek(u,e.endLineNumber,(g,f)=>g-f));for(let g=p;g<=h;g++){let f=t.children[g];if(!f||!f.range)continue;let{startLineNumber:v,endLineNumber:b}=f.range;if(b>v+1&&e.startLineNumber<=b+1&&v-1<=e.endLineNumber&&v!==c&&l.isValidRange(new G(v,1,b,1))){c=v;let S=this._editor.getLineHeightForPosition(new ye(v,1));o.push(new zgi(v,b-1,r,S)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,f,o,n+1,r+S,v)}}}filterHiddenRanges(e){let t=this._editor._getViewModel()?.getHiddenAreas();return t?e.filter(o=>!t.some(n=>o.startLineNumber>=n.startLineNumber&&o.endLineNumber<=n.endLineNumber+1)):e}updateIndex(e){return e===-1?0:e<0?-e-2:e}};STe=I([m(1,Jt),m(2,Us)],STe);var jy=class extends k{constructor(e,t,o,n,r,s,l){super();this._editor=e;this._contextMenuService=t;this._languageFeaturesService=o;this._instaService=n;this._contextKeyService=l;this._sessionStore=new O;this._maxStickyLines=Number.MAX_SAFE_INTEGER;this._candidateDefinitionsLength=-1;this._focusedStickyElementIndex=-1;this._enabled=!1;this._focused=!1;this._positionRevealed=!1;this._onMouseDown=!1;this._endLineNumbers=[];this._mouseTarget=null;this._onDidChangeStickyScrollHeight=this._register(new T);this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event;this._stickyScrollWidget=new tDt(this._editor),this._stickyLineCandidateProvider=new STe(this._editor,o,r),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=vTe.Empty;let c=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeLineHeight(p=>{p.changes.forEach(h=>{let g=h.lineNumber;this._widgetState.startLineNumbers.includes(g)&&this._renderStickyScroll(g)})})),this._register(this._editor.onDidChangeFont(p=>{p.changes.forEach(h=>{let g=h.lineNumber;this._widgetState.startLineNumbers.includes(g)&&this._renderStickyScroll(g)})})),this._register(this._editor.onDidChangeConfiguration(p=>{this._readConfigurationChange(p)})),this._register($(c,ne.CONTEXT_MENU,async p=>{this._onContextMenu(Me(c),p)})),this._stickyScrollFocusedContextKey=me.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=me.stickyScrollVisible.bindTo(this._contextKeyService);let u=this._register(nr(c));this._register(u.onDidBlur(p=>{this._positionRevealed===!1&&c.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(u.onDidFocus(p=>{this.focus()})),this._registerMouseListeners(),this._register($(c,ne.MOUSE_DOWN,p=>{this._onMouseDown=!0})),this._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight(p=>{this._onDidChangeStickyScrollHeight.fire(p)})),this._onDidResize(),this._readConfiguration()}static{this.ID="store.contrib.stickyScrollController"}get stickyScrollCandidateProvider(){return this._stickyLineCandidateProvider}get stickyScrollWidgetState(){return this._widgetState}get stickyScrollWidgetHeight(){return this._stickyScrollWidget.height}static get(e){return e.getContribution(jy.ID)}_disposeFocusStickyScrollStore(){this._stickyScrollFocusedContextKey.set(!1),this._focusDisposableStore?.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}isFocused(){return this._focused}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new O,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){let e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(G.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){let e=this._register(new O),t=this._register(new i0(this._editor,{extractLineNumberFromMouseEvent:r=>{let s=this._stickyScrollWidget.getEditorPositionFromNode(r.target.element);return s?s.lineNumber:0}})),o=r=>{if(!this._editor.hasModel()||r.target.type!==12||r.target.detail!==this._stickyScrollWidget.getId())return null;let s=r.target.element;if(!s||s.innerText!==s.innerHTML)return null;let l=this._stickyScrollWidget.getEditorPositionFromNode(s);return l?{range:new G(l.lineNumber,l.column,l.lineNumber,l.column+s.innerText.length),textElement:s}:null},n=this._stickyScrollWidget.getDomNode();this._register(Yo(n,ne.CLICK,r=>{if(r.ctrlKey||r.altKey||r.metaKey||!r.leftButton)return;if(r.shiftKey){let u=this._stickyScrollWidget.getLineIndexFromChildDomNode(r.target);if(u===null)return;let p=new ye(this._endLineNumbers[u],1);this._revealLineInCenterIfOutsideViewport(p);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(r.target)){let u=this._stickyScrollWidget.getLineNumberFromChildDomNode(r.target);this._toggleFoldingRegionForLine(u);return}if(!this._stickyScrollWidget.isInStickyLine(r.target))return;let c=this._stickyScrollWidget.getEditorPositionFromNode(r.target);if(!c){let u=this._stickyScrollWidget.getLineNumberFromChildDomNode(r.target);if(u===null)return;c=new ye(u,1)}this._revealPosition(c)})),this._register($(ut,ne.MOUSE_MOVE,r=>{this._mouseTarget=r.target,this._onMouseMoveOrKeyDown(r)})),this._register($(ut,ne.KEY_DOWN,r=>{this._onMouseMoveOrKeyDown(r)})),this._register($(ut,ne.KEY_UP,()=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([r,s])=>{let l=o(r);if(!l||!r.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}let{range:c,textElement:u}=l;if(!c.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=c,e.clear();else if(u.style.textDecoration==="underline")return;let p=new qe;e.add(ee(()=>p.dispose(!0)));let h;d0(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new ye(c.startLineNumber,c.startColumn+1),!1,p.token).then((g=>{if(!p.token.isCancellationRequested)if(g.length!==0){this._candidateDefinitionsLength=g.length;let f=u;h!==f?(e.clear(),h=f,h.style.textDecoration="underline",e.add(ee(()=>{h.style.textDecoration="none"}))):h||(h=f,h.style.textDecoration="underline",e.add(ee(()=>{h.style.textDecoration="none"})))}else e.clear()}))})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async r=>{if(r.target.type!==12||r.target.detail!==this._stickyScrollWidget.getId())return;let s=this._stickyScrollWidget.getEditorPositionFromNode(r.target.element);s&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:s.lineNumber,column:1})),this._instaService.invokeFunction(HTt,r,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){let o=new Ln(e,t);this._contextMenuService.showContextMenu({menuId:R.StickyScrollContext,getAnchor:()=>o,menuActionOptions:{renderShortTitle:!0}})}_onMouseMoveOrKeyDown(e){if(!e.shiftKey||!this._mouseTarget||!go(this._mouseTarget))return;let t=this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);t===null||this._showEndForLine===t||(this._showEndForLine=t,this._renderStickyScroll())}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;let t=this._stickyScrollWidget.getRenderedStickyLine(e),o=t?.foldingIcon;if(!o)return;Y6e(this._foldingModel,1,[e]),o.isCollapsed=!o.isCollapsed;let n=(o.isCollapsed?this._editor.getTopForLineNumber(o.foldingEndLine):this._editor.getTopForLineNumber(o.foldingStartLine))-this._editor.getOption(75)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){let e=this._editor.getOption(131);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._resetState(),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(o=>{o.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(o=>this._onTokensChange(o))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(76).renderType===2?this._cursorPositionListener||(this._cursorPositionListener=this._editor.onDidChangeCursorPosition(o=>{this._positionLineNumber!==o.position.lineNumber&&(this._positionLineNumber=o.position.lineNumber,this._showEndForLine=void 0,this._renderStickyScroll(0))}),this._sessionStore.add(this._cursorPositionListener)):this._cursorPositionListener&&(this._sessionStore.delete(this._cursorPositionListener),this._cursorPositionListener.dispose(),this._cursorPositionListener=void 0)}_readConfigurationChange(e){(e.hasChanged(131)||e.hasChanged(81)||e.hasChanged(75)||e.hasChanged(126)||e.hasChanged(76))&&this._readConfiguration(),(e.hasChanged(76)||e.hasChanged(52)||e.hasChanged(126))&&this._renderStickyScroll(0)}_needsUpdate(e){let t=this._stickyScrollWidget.getCurrentLines();for(let o of t)for(let n of e.ranges)if(o>=n.fromLineNumber&&o<=n.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){let t=this._editor.getLayoutInfo().height/this._editor.getOption(75);this._maxStickyLines=Math.round(t*.25),this._renderStickyScroll(0)}async _renderStickyScroll(e){let t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}let o=this._updateAndGetMinRebuildFromLine(e),n=this._stickyLineCandidateProvider.getVersionId();if(n===void 0||n===t.getVersionId())if(!this._focused)await this._updateState(o);else if(this._focusedStickyElementIndex===-1)await this._updateState(o),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{let s=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(o),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(s)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){let t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){this._minRebuildFromLine=void 0,this._foldingModel=await $f.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();let t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=vTe.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){let e=Math.min(this._maxStickyLines,this._editor.getOption(131).maxLineCount),t=this._editor.getScrollTop(),o=0,n=[],r=[],s=this._editor.getVisibleRanges();if(s.length!==0){let l=new K4(s[0].startLineNumber,s[s.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(l);for(let u of c){let p=u.startLineNumber,h=u.endLineNumber,g=u.top,f=g+u.height,v=this._editor.getTopForLineNumber(p)-t,b=this._editor.getBottomForLineNumber(h)-t;if(g>v&&g<=b&&(n.push(p),r.push(h+1),f>b&&(o=b-f)),n.length===e)break}}return this._endLineNumbers=r,new vTe(n,r,o,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};jy=I([m(1,Xe),m(2,Jt),m(3,F),m(4,Us),m(5,Gf),m(6,X)],jy);var VJ=te("inlineEdit.originalBackground",ni(df,.2),d(1409,null),!0),nDt=te("inlineEdit.modifiedBackground",ni(_g,.3),d(1405,null),!0),qKs=te("inlineEdit.originalChangedLineBackground",ni(df,.8),d(1411,null),!0),boo=te("inlineEdit.originalChangedTextBackground",ni(df,.8),d(1412,null),!0),Soo=te("inlineEdit.modifiedChangedLineBackground",{light:ni(A3e,.7),dark:ni(A3e,.7),hcDark:A3e,hcLight:A3e},d(1407,null),!0),Ioo=te("inlineEdit.modifiedChangedTextBackground",ni(_g,.7),d(1408,null),!0),BJ=te("inlineEdit.gutterIndicator.primaryForeground",Fk,d(1398,null)),b0=te("inlineEdit.gutterIndicator.primaryBorder",th,d(1397,null)),S2=te("inlineEdit.gutterIndicator.primaryBackground",{light:ni(b0,.5),dark:ni(b0,.4),hcDark:ni(b0,.4),hcLight:ni(b0,.5)},d(1396,null)),yoo=te("inlineEdit.gutterIndicator.secondaryForeground",rX,d(1401,null)),woo=te("inlineEdit.gutterIndicator.secondaryBorder",eK,d(1400,null)),yTe=te("inlineEdit.gutterIndicator.secondaryBackground",EF,d(1399,null)),Coo=te("inlineEdit.gutterIndicator.successfulForeground",Fk,d(1404,null)),Kgi=te("inlineEdit.gutterIndicator.successfulBorder",th,d(1403,null)),wTe=te("inlineEdit.gutterIndicator.successfulBackground",Kgi,d(1402,null)),xoo=te("inlineEdit.gutterIndicator.background",{hcDark:ni("tab.inactiveBackground",.5),hcLight:ni("tab.inactiveBackground",.5),dark:ni("tab.inactiveBackground",.5),light:"#5f5f5f18"},d(1395,null)),N9e=te("inlineEdit.originalBorder",{light:df,dark:df,hcDark:df,hcLight:df},d(1410,null)),O9e=te("inlineEdit.modifiedBorder",{light:Eu(_g,.6),dark:_g,hcDark:_g,hcLight:_g},d(1406,null)),U8o=te("inlineEdit.tabWillAcceptModifiedBorder",{light:Eu(O9e,0),dark:Eu(O9e,0),hcDark:Eu(O9e,0),hcLight:Eu(O9e,0)},d(1413,null)),z8o=te("inlineEdit.tabWillAcceptOriginalBorder",{light:Eu(N9e,0),dark:Eu(N9e,0),hcDark:Eu(N9e,0),hcLight:Eu(N9e,0)},d(1414,null));function G4(a){return a.map(i=>i==="accept"?U8o:O9e)}function HJ(a){return a.map(i=>i==="accept"?z8o:N9e)}function qb(a,i){let e;typeof a=="string"?e=WJ(a,i):e=a.map((o,n)=>WJ(o,i).read(n));let t=WJ(Bo,i);return e.map((o,n)=>o.makeOpaque(t.read(n)))}function VD(a){let i;switch(a){case"textEditor":i=Bo;break;case"diffEditor":i=Bo;break;case"notebook":i="notebook.cellEditorBackground";break;default:bs(a,"Not supported editor type yet")}return Tt(i)}function WJ(a,i){return Mb({owner:{observeColor:a},equalsFn:(e,t)=>e.equals(t),debugName:()=>`observeColor(${a})`},i.onDidColorThemeChange,()=>{let e=i.getColorTheme().getColor(a);if(!e)throw new ci(`Missing color: ${a}`);return e})}var $b=3;function KA(a,i,e){let t=a.model.read(e);if(!t)return 0;let o=0;for(let r=i.startLineNumber;r<i.endLineNumberExclusive;r++){let s=a.getWidthOfLine(r,e);o=Math.max(o,s)}let n=i.mapToLineArray(r=>t.getLineContent(r));return o<5&&n.some(r=>r.length>0)&&t.uri.scheme!=="file"&&console.log("unexpected width"),o}function Eoo(a,i,e){qr(a,a.editor.onDidChangeLineHeight).read(e);let t=a.model.read(e);if(!t)throw new ci("Model is required");let o=[];for(let n=i.startLineNumber;n<i.endLineNumberExclusive;n++){let r=a.getWidthOfLine(n,e);if(r===-1){let l=t.getLineMaxColumn(n),c=a.editor.getOption(59).typicalHalfwidthCharacterWidth;r=l*c}let s=a.editor.getLineHeightForPosition(new ye(n,1));o.push(new FJ(r,s))}return o}function Too(a,i,e){return a.layoutInfo.read(e),a.value.read(e),a.model.read(e)?(a.scrollTop.read(e),a.editor.getOffsetForColumn(i.lineNumber,i.column)):0}function CTe(a,i,e,t,o=void 0){let n=t.getModel();if(!n)return{prefixTrim:0,prefixLeftOffset:0};let r=a.map(h=>h.isSingleLine()?h.startColumn-1:0),s=i.mapToLineArray(h=>rke(n.getLineContent(h))),l=e.filter(h=>h!=="").map(h=>rke(h)),c=Math.min(...r,...s,...l),u;if(n.getLineIndentColumn(i.startLineNumber)>=c+1)Ds(t).scrollTop.read(o),u=t.getOffsetForColumn(i.startLineNumber,c+1);else if(e.length>0)u=F9e(e[0].slice(0,c),t,n);else return{prefixTrim:0,prefixLeftOffset:0};return{prefixTrim:c,prefixLeftOffset:u}}function F9e(a,i,e){let t=i.getOption(59).typicalHalfwidthCharacterWidth,o=e.getOptions().tabSize*t,n=a.split("	").length-1;return(a.length-n)*t+n*o}function xTe(a){let i=a.layoutInfoContentLeft,e=ke({name:"editor.validOverlay.width"},o=>{let n=a.layoutInfoMinimap.read(o).minimapLeft!==0,r=Math.max(0,a.layoutInfoWidth.read(o)-i.read(o));if(n){let s=a.layoutInfoMinimap.read(o).minimapWidth+a.layoutInfoVerticalScrollbarWidth.read(o);return Math.max(0,r-s)}return r}),t=ke({name:"editor.validOverlay.height"},o=>a.layoutInfoHeight.read(o)+a.contentHeight.read(o));return ke({name:"editor.validOverlay"},o=>ap.fromLeftTopWidthHeight(i.read(o),0,e.read(o),t.read(o)))}var koo=class a{constructor(i){this.scheme=i}static{this._modelId=0}getUniqueUri(){return A.from({scheme:this.scheme,path:new Date().toString()+String(a._modelId++)})}};function _oo(a,i){let e=[];for(let t of a){let o=i.mapRange(t.modifiedRange);e.push(new lf(t.originalRange,o))}return e}function kTe(...a){return a.filter(i=>typeof i=="string").join(" ")}function K8o(a,i){return new G(i.lineNumber,i.column+a.start,i.lineNumber,i.column+a.endExclusive)}function G8o(a,i){let e=0;e:for(let t=0,o=a.length;t<o;t++)switch(a.charCodeAt(t)){case 9:e+=i;break;case 32:e++;break;default:break e}return e-e%i}function q8o(a,i,e){let t=i-i%e,o=0;for(;o<a.length&&t!==0;o++)switch(a.charCodeAt(o)){case 9:t-=e;break;case 32:t--;break;default:throw new ci("Unexpected character found while calculating indent length")}return o}function Doo(a,i,e){let t=Hc(a),o=[],n=gvt(i.mapToLineArray(r=>G8o(t[r-1],e)),Hu);return i.forEach(r=>{let s=q8o(t[r-1],n,e);o.push(new ys(K8o(new gi(0,s),new ye(r,1)),""))}),new lm(o)}var Vue=class{constructor(){this._data=""}moveTo(i){return this._data+=`M ${i.x} ${i.y} `,this}lineTo(i){return this._data+=`L ${i.x} ${i.y} `,this}curveTo(i,e){return this._data+=`Q ${i.x} ${i.y} ${e.x} ${e.y} `,this}curveTo2(i,e,t){return this._data+=`C ${i.x} ${i.y} ${e.x} ${e.y} ${t.x} ${t.y} `,this}build(){return this._data}};function jT(a){let i=mv(void 0,(e,t)=>a.read(e)||t);return Js({debugName:()=>`${a.debugName}.mapOutFalsy`},e=>{if(i.read(e),!!a.read(e))return i})}function jb(a,i=Dl.ofCaller()){return{left:ke({name:"editor.validOverlay.left"},e=>a(e)?.left,i),top:ke({name:"editor.validOverlay.top"},e=>a(e)?.top,i),width:ke({name:"editor.validOverlay.width"},e=>{let t=a(e);if(t)return t.width},i),height:ke({name:"editor.validOverlay.height"},e=>{let t=a(e);if(t)return t.height},i)}}function Roo(a,i){let e=a.getContainerDomNode(),t=De("domRect",e.getBoundingClientRect());return i.add(a.onDidLayoutChange(o=>{t.set(e.getBoundingClientRect(),void 0)})),t}var ETe=class{constructor(i,e,t,o,n,r){this._editorObs=i;this._data=e;this._close=t;this._contextKeyService=o;this._keybindingService=n;this._commandService=r;this._inlineEditsShowCollapsed=this._editorObs.getOption(71).map(s=>s.edits.showCollapsed)}toDisposableLiveElement(){return this._createHoverContent().toDisposableLiveElement()}_createHoverContent(){let i=De("active",void 0),e=b=>({title:b.title,icon:b.icon,keybinding:typeof b.commandId=="string"?this._getKeybinding(b.commandArgs?void 0:b.commandId):ke(this,S=>typeof b.commandId=="string"?void 0:this._getKeybinding(b.commandArgs?void 0:b.commandId.read(S)).read(S)),isActive:i.map(S=>S===b.id),onHoverChange:S=>i.set(S?b.id:void 0,void 0),onAction:()=>{let S=typeof b.commandId=="string"?b.commandId:b.commandId.get();return this._close(!0,S),this._commandService.executeCommand(S,...b.commandArgs??[])}}),t=this._data.extensionCommands.map(b=>b.map((S,y)=>q4(e({id:S.command.id+"_"+y,title:S.command.title,icon:S.icon??L.symbolEvent,commandId:S.command.id,commandArgs:S.command.arguments})))),o=[];for(let b of t)b.length>0&&(o.push(Ggi()),o.push(...b));if(this._data.extensionCommandsOnly)return Loo(o.slice(1));let n=$8o(this._data.displayName),r=q4(e({id:"gotoAndAccept",title:d(1385,null),icon:L.check,commandId:qK})),s=q4(e({id:"reject",title:d(1386,null),icon:L.close,commandId:xEt})),l=this._data.alternativeAction?q4(e({id:"alternativeCommand",title:this._data.alternativeAction.command.title,icon:this._data.alternativeAction.icon,commandId:Zde})):void 0,u=!1?this._data.modelInfo?.models.map(b=>q4({title:b.name,icon:b.id===this._data.modelInfo?.currentModelId?L.check:L.circle,keybinding:Fo(void 0),isActive:i.map(S=>S==="model_"+b.id),onHoverChange:S=>i.set(S?"model_"+b.id:void 0,void 0),onAction:()=>{this._close(!0),this._data.setModelId?.(b.id)}}))??[]:[],p=this._inlineEditsShowCollapsed.map(b=>q4(e(b?{id:"showExpanded",title:d(1389,null),icon:L.expandAll,commandId:JQe}:{id:"showCollapsed",title:d(1388,null),icon:L.collapseAll,commandId:JQe}))),h=q4(e({id:"snooze",title:d(1390,null),icon:L.bellSlash,commandId:"editor.action.inlineSuggest.snooze"})),g=q4(e({id:"settings",title:d(1387,null),icon:L.gear,commandId:"workbench.action.openSettings",commandArgs:["@tag:nextEditSuggestions"]})),f=this._data.action?[this._data.action]:[],v=f.length>0?j8o(f.map(b=>({id:b.id,label:b.title+"...",enabled:!0,run:()=>this._commandService.executeCommand(b.id,...b.arguments??[]),class:void 0,tooltip:b.tooltip??b.title})),{hoverDelegate:rC}):void 0;return Loo([n,r,l,s,p,u.length?Ggi():void 0,...u,h,g,...o,v?Ggi():void 0,v])}_getKeybinding(i){return i?vi(this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(i)):Fo(void 0)}};ETe=I([m(3,X),m(4,Le),m(5,fe)],ETe);function Loo(a){return $o.div({class:"content",style:{margin:4,minWidth:180}},a)}function $8o(a){return $o.div({class:"header",style:{color:Tt(L3e),fontSize:"13px",fontWeight:"600",padding:"0 4px",lineHeight:28}},[a])}function q4(a){return ke({name:"inlineEdits.option"},i=>$o.div({class:["monaco-menu-option",a.isActive?.map(e=>e&&"active")],onmouseenter:()=>a.onHoverChange?.(!0),onmouseleave:()=>a.onHoverChange?.(!1),onclick:a.onAction,onkeydown:e=>{e.key==="Enter"&&a.onAction?.()},tabIndex:0,style:{borderRadius:3}},[$o.elem("span",{style:{fontSize:16,display:"flex"}},[q.isThemeIcon(a.icon)?un(a.icon):a.icon.map(e=>un(e))]),$o.elem("span",{},[a.title]),$o.div({style:{marginLeft:"auto"},ref:e=>{let t=i.store.add(new ah(e,Ao,{disableTitle:!0,...qk,keybindingLabelShadow:void 0,keybindingLabelForeground:Tt(L3e),keybindingLabelBackground:"transparent",keybindingLabelBorder:"transparent",keybindingLabelBottomBorder:void 0}));i.store.add(ve(o=>{t.set(a.keybinding.read(o))}))}})]))}function j8o(a,i){return ke({name:"inlineEdits.actionBar"},e=>$o.div({class:["action-widget-action-bar"],style:{padding:"3px 24px"}},[$o.div({ref:t=>{e.store.add(new oo(t,i)).push(a,{icon:!1,label:!0})}})]))}function Ggi(){return $o.div({id:"inline-edit-gutter-indicator-menu-separator",class:"menu-separator",style:{color:Tt(_7i),padding:"2px 0"}},$o.div({style:{borderBottom:`1px solid ${Tt(eK)}`}}))}var TTe=class{constructor(i,e,t,o,n){this.gutterMenuData=i;this.originalRange=e;this.model=t;this.altAction=o;this.customization=n}},_Te=class a{constructor(i,e,t,o,n,r,s=!1){this.action=i;this.displayName=e;this.extensionCommands=t;this.alternativeAction=o;this.modelInfo=n;this.setModelId=r;this.extensionCommandsOnly=s}static fromInlineSuggestion(i){let e=i.action?.kind==="edit"?i.action.alternativeAction:void 0,t=i.source.inlineSuggestions.commands??[];return new a(i.gutterMenuLinkAction,i.source.provider.displayName??d(1391,null),t.length>0?[t]:[],e,i.source.provider.modelInfo,i.source.provider.setModelId?.bind(i.source.provider))}},DTe=class a{constructor(i,e){this.accept=i;this.jump=e}static fromInlineCompletionModel(i){return new a(()=>i.accept(),()=>i.jump())}},qgi=16,Moo=2,UJ=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._editorObs=e;this._data=t;this._tabAction=o;this._verticalOffset=n;this._isHoveringOverInlineEdit=r;this._focusIsInMenu=s;this._hoverService=l;this._instantiationService=c;this._accessibilityService=u;this._themeService=p;this._userInteractionService=h;this._onDidCloseWithCommand=this._register(new T);this.onDidCloseWithCommand=this._onDidCloseWithCommand.event;this._modifierPressed=ke(this,e=>this._userInteractionService.readModifierKeyStatus(this._editorObs.editor.getDomNode(),e).shiftKey);this._gutterIndicatorStyles=ke(this,e=>{let t=this._tabAction.read(e),o=this._data.read(e)?.altAction,n=this._modifierPressed.read(e);switch(o&&n&&(t="inactive"),t){case"inactive":return{background:qb(yTe,this._themeService).read(e).toString(),foreground:qb(yoo,this._themeService).read(e).toString(),border:qb(woo,this._themeService).read(e).toString()};case"jump":return{background:qb(S2,this._themeService).read(e).toString(),foreground:qb(BJ,this._themeService).read(e).toString(),border:qb(b0,this._themeService).read(e).toString()};case"accept":return{background:qb(wTe,this._themeService).read(e).toString(),foreground:qb(Coo,this._themeService).read(e).toString(),border:qb(Kgi,this._themeService).read(e).toString()};default:bs(t)}});this._state=ke(this,e=>{let t=this._originalRangeObs.read(e);if(t)return{range:t,lineOffsetRange:this._editorObs.observeLineOffsetRange(t,e.store)}});this._lineNumberToRender=ke(this,e=>{if(this._verticalOffset.read(e)!==0)return"";let t=this._data.read(e)?.originalRange.startLineNumber,o=this._editorObs.getOption(76).read(e);if(t===void 0||o.renderType===0)return"";if(o.renderType===3){let n=this._editorObs.cursorPosition.read(e);return t%10===0||n&&n.lineNumber===t?t.toString():""}if(o.renderType===2){let n=this._editorObs.cursorPosition.read(e);if(!n)return"";let r=Math.abs(t-n.lineNumber);return r===0?t.toString():r.toString()}return o.renderType===4?o.renderFn?o.renderFn(t):"":t.toString()});this._availableWidthForIcon=ke(this,e=>{let t=this._editorObs.editor.getModel(),o=this._editorObs.editor,n=this._editorObs.layoutInfo.read(e),r=n.decorationsLeft+n.decorationsWidth-n.glyphMarginLeft;if(!t||r<=0)return()=>0;if(n.lineNumbersLeft===0)return()=>r;let s=this._editorObs.getOption(76).read(e);if(s.renderType===2||s.renderType===0)return()=>r;let l=o.getOption(59).typicalHalfwidthCharacterWidth,c=n.lineNumbersLeft+n.lineNumbersWidth,p=(t.getLineCount()+1).toString().length,h=[];for(let g=1;g<=p;g++){let f=10**(g-1),v=o.getTopForLineNumber(f),b=g*l,S=Math.min(r,Math.max(0,c-b-n.glyphMarginLeft));h.push({firstLineNumberWithDigitCount:f,topOfLineNumber:v,usableWidthLeftOfLineNumber:S})}return g=>{for(let f=h.length-1;f>=0;f--)if(g>=h[f].topOfLineNumber)return h[f].usableWidthLeftOfLineNumber;throw new ci("Could not find avilable width for icon")}});this._layout=ke(this,e=>{let t=this._state.read(e);if(!t)return;let o=this._editorObs.layoutInfo.read(e),n=this._editorObs.observeLineHeightForLine(t.range.map(ae=>ae.startLineNumber)).read(e),r=1,s=2,l=o.decorationsLeft+o.decorationsWidth-o.glyphMarginLeft-2*r,c=o.height-2*s,u=ap.fromLeftTopWidthHeight(r,s,l,c),p=u.withTop(this._stickyScrollHeight.read(e)),h=u.withTop(p.top+s),g=t.lineOffsetRange.read(e),f=ap.fromRanges(gi.fromTo(h.left,h.right),g),v=n,b=this._verticalOffset.read(e),S=f.withHeight(v).translateY(b),y=p.containsRect(S),w=this._data.read(e)?.customization?.icon,x=w?Fo(w):this._tabAction.map(ae=>ae==="accept"?L.keyboardTab:L.arrowRight),E=w?Fo(w):ke(this,ae=>{if(this._isHoveredOverIconDebounced.read(ae)||this._isHoveredOverInlineEditDebounced.read(ae))return L.check;if(this._tabAction.read(ae)==="accept")return L.keyboardTab;let ce=this._editorObs.cursorLineNumber.read(ae)??0,Se=t.range.read(ae).startLineNumber;return ce<=Se?L.keyboardTabAbove:L.keyboardTabBelow}),M=22,N=ae=>{let ce=this._availableWidthForIcon.read(void 0)(ae.bottom+this._editorObs.editor.getScrollTop())-r;return Math.max(Math.min(ce,M),qgi)};if(y){let ae=S,ce;o.lineNumbersWidth===0?ce=Math.max(0,Math.min(Math.max(o.lineNumbersLeft-u.left,0),ae.width-M)):ce=Math.max(o.lineNumbersLeft+o.lineNumbersWidth-u.left,0);let Se=ae.withWidth(ce),Re=qgi+Moo,xe=Math.min(ae.width-ce,M),He=ae.withWidth(Math.max(xe,Re)).translateX(ce),Ee=xe>=Re;return{gutterEditArea:f,icon:E,iconDirection:"right",iconRect:He,iconVisible:Ee,pillRect:ae,lineNumberRect:Se}}let V=u.intersect(f);if(V&&V.height>=v){let ae=S.moveToBeContainedIn(h).moveToBeContainedIn(V),ce=ae.withWidth(N(ae));return{gutterEditArea:f,icon:E,iconDirection:"right",iconRect:ce,pillRect:ce,iconVisible:!0}}let K=S.moveToBeContainedIn(u),j=K.withWidth(N(K)),J=j,se=j.top<S.top?"top":"bottom";return{gutterEditArea:f,icon:x,iconDirection:se,iconRect:J,pillRect:j,iconVisible:!0}});this._iconRef=$o.ref();this.isVisible=this._layout.map(e=>!!e);this._hoverVisible=De(this,!1);this.isHoverVisible=this._hoverVisible;this._isHoveredOverIcon=De(this,!1);this._isHoveredOverIconDebounced=vA(this._isHoveredOverIcon,100);this.isHoveredOverIcon=this._isHoveredOverIconDebounced;this._indicator=$o.div({class:"inline-edits-view-gutter-indicator",style:{position:"absolute",overflow:"visible"}},jT(this._layout).map(e=>e?[$o.div({style:{position:"absolute",background:Tt(xoo),borderRadius:`${$b}px`,...jb(t=>e.read(t).gutterEditArea)}}),$o.div({class:"icon",ref:this._iconRef,tabIndex:0,onclick:()=>{let o=this._layout.get()?.icon.get()===L.check,n=this._data.get();if(!n)throw new ci("Gutter indicator data not available");this._editorObs.editor.focus(),o?n.model.accept():n.model.jump()},onmouseenter:()=>{this._showHover()},style:{cursor:"pointer",zIndex:"20",position:"absolute",backgroundColor:this._gutterIndicatorStyles.map(t=>t.background),"--vscodeIconForeground":this._gutterIndicatorStyles.map(t=>t.foreground),border:this._gutterIndicatorStyles.map(t=>`1px solid ${t.border}`),boxSizing:"border-box",borderRadius:`${$b}px`,display:"flex",justifyContent:e.map(t=>t.iconDirection==="bottom"?"flex-start":"flex-end"),transition:this._modifierPressed.map(t=>t?"":"background-color 0.2s ease-in-out, width 0.2s ease-in-out"),...jb(t=>e.read(t).pillRect)}},[$o.div({className:"line-number",style:{lineHeight:e.map(t=>t.lineNumberRect?t.lineNumberRect.height:0),display:e.map(t=>t.lineNumberRect?"flex":"none"),alignItems:"center",justifyContent:"flex-end",width:e.map(t=>t.lineNumberRect?t.lineNumberRect.width:0),height:"100%",color:this._gutterIndicatorStyles.map(t=>t.foreground)}},this._lineNumberToRender),$o.div({style:{transform:e.map(t=>`rotate(${Q8o(t.iconDirection)}deg)`),transition:"rotate 0.2s ease-in-out, opacity 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",height:"100%",opacity:e.map(t=>t.iconVisible?"1":"0"),marginRight:e.map(t=>t.pillRect.width-t.iconRect.width-(t.lineNumberRect?.width??0)),width:e.map(t=>t.iconRect.width),position:"relative",right:e.map(t=>t.iconDirection==="top"?"1px":"0"),color:this._data.map(t=>t?.customization?.icon?.color?Tt(t.customization.icon.color.id):void 0)}},[e.map((t,o)=>Y8o(un(t.icon.read(o)),{fontSize:X8o(Math.min(t.iconRect.width-Moo,qgi))}))])])]:[]));this._originalRangeObs=jT(this._data.map(f=>f?.originalRange)),this._stickyScrollController=jy.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?vi(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Fo(0),this._isHoveredOverInlineEditDebounced=vA(this._isHoveringOverInlineEdit,100);let g=this._indicator.keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:g.element,position:Fo(null),allowEditorOverflow:!1,minContentWidthInPx:Fo(0)})),this._register(this._editorObs.editor.onMouseMove(f=>{if(this._state.get()===void 0)return;let S=this._iconRef.element.getBoundingClientRect(),y=ap.fromLeftTopWidthHeight(S.left,S.top,S.width,S.height),w=new Mg(f.event.posx,f.event.posy);this._isHoveredOverIcon.set(y.containsPoint(w),void 0)})),this._register(this._editorObs.editor.onDidScrollChange(()=>{this._isHoveredOverIcon.set(!1,void 0)})),this._register(Zs(this._isHoveredOverInlineEditDebounced,f=>{f&&this.triggerAnimation()})),this._register(ve(f=>{g.readEffect(f),g.element&&this._editorObs.editor.applyFontInfo(g.element)}))}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{outline:`2px solid ${this._gutterIndicatorStyles.map(t=>t.border).get()}`,outlineOffset:"-1px",offset:0},{outline:"2px solid transparent",outlineOffset:"10px",offset:1}],{duration:500}).finished}_showHover(){if(this._hoverVisible.get())return;let e=this._data.get();if(!e)throw new ci("Gutter indicator data not available");let t=new O,o=t.add(this._instantiationService.createInstance(ETe,this._editorObs,e.gutterMenuData,(s,l)=>{s&&this._editorObs.editor.focus(),l&&this._onDidCloseWithCommand.fire(l),r?.dispose()}).toDisposableLiveElement()),n=this._userInteractionService.createFocusTracker(o.element,t);t.add(ve(s=>{this._focusIsInMenu.set(n.read(s),void 0)})),t.add(ee(()=>this._focusIsInMenu.set(!1,void 0)));let r=this._hoverService.showInstantHover({target:this._iconRef.element,content:o.element});r?(this._hoverVisible.set(!0,void 0),t.add(this._editorObs.editor.onDidScrollChange(()=>r.dispose())),t.add(r.onDispose(()=>{this._hoverVisible.set(!1,void 0),t.dispose()}))):t.dispose()}};UJ=I([m(6,ot),m(7,F),m(8,Ai),m(9,Pe),m(10,ET)],UJ);function Q8o(a){switch(a){case"top":return 90;case"bottom":return-90;case"right":return 0}}function Y8o(a,i){for(let e in i)a.style[e]=i[e];return a}function X8o(a){return`${a}px`}var RTe=class extends k{constructor(e,t,o,n,r){super();this._model=e;this._indicator=t;this._collapsedView=o;this._storageService=n;this._configurationService=r;this._disposables=this._register(new ue);this._setupDone=De({name:"setupDone"},!1);this._activeCompletionId=ke(e=>{let t=this._model.read(e);if(!t||!this._setupDone.read(e))return;let o=this._indicator.read(e);if(!(!o||!o.isVisible.read(e)))return t.inlineEdit.inlineCompletion.identity.id});this._register(this._initializeDebugSetting()),this._disposables.value=this.setupNewUserExperience(),this._setupDone.set(!0,void 0)}setupNewUserExperience(){if(this.getNewUserType()==="active")return;let e=new O,t=!1,o=!1,n=0,r=0;return e.add(moi(this._activeCompletionId,async(s,l,c,u)=>{if(s===void 0)return;let p=this.getNewUserType();switch(p){case"firstTime":{(n++>=5||t)&&(p="secondTime",this.setNewUserType(p));break}case"secondTime":{r++>=3&&o&&(p="active",this.setNewUserType(p));break}}switch(p){case"firstTime":{for(let h=0;h<3&&!u.isCancellationRequested;h++)await this._indicator.get()?.triggerAnimation(),await Li(500);break}case"secondTime":{this._indicator.get()?.triggerAnimation();break}}})),e.add(ve(s=>{this._collapsedView.isVisible.read(s)&&this.getNewUserType()!=="active"&&this._collapsedView.triggerAnimation()})),e.add(ve(s=>{let l=this._indicator.read(s);l&&s.store.add(Zs(l.isHoveredOverIcon,async c=>{c&&(t=!0)}))})),e.add(ve(s=>{let l=this._model.read(s);l&&s.store.add(l.onDidAccept(()=>{o=!0}))})),e}getNewUserType(){return this._storageService.get("inlineEditsGutterIndicatorUserKind",-1,"firstTime")}setNewUserType(e){switch(e){case"firstTime":throw new ci("UserKind should not be set to first time");case"secondTime":break;case"active":this._disposables.clear();break}this._storageService.store("inlineEditsGutterIndicatorUserKind",e,-1,0)}_initializeDebugSetting(){let e="editor.inlineSuggest.edits.resetNewUserExperience";return this._configurationService.getValue(e)&&this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(e)&&this._configurationService.getValue(e)&&(this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._disposables.value=this.setupNewUserExperience())})}};RTe=I([m(3,de),m(4,B)],RTe);var rDt=class{constructor(i,e,t,o,n,r,s){this.originalText=i;this.action=e;this.edit=t;this.cursorPosition=o;this.multiCursorPositions=n;this.commands=r;this.inlineCompletion=s}get lineEdit(){return this.action?.kind==="jumpTo"?new mK(vo.ofLength(this.action.position.lineNumber,0),[]):this.action?.kind==="edit"?mK.fromSingleTextEdit(this.edit.toReplacement(this.originalText),this.originalText):new mK(new vo(1,1),[])}get originalLineRange(){return this.lineEdit.lineRange}get modifiedLineRange(){return this.lineEdit.toLineEdit().getNewLineRanges()[0]}get displayRange(){return this.originalText.lineRange.intersect(this.originalLineRange.join(vo.ofLength(this.originalLineRange.startLineNumber,this.lineEdit.newLines.length)))}};var sDt=class{constructor(i,e,t){this._model=i;this.inlineEdit=e;this.tabAction=t;this.editorType=this._model.editorType,this.displayLocation=this.inlineEdit.inlineCompletion.hint,this.inViewPort=ke(this,o=>Egi(this._model.editor,this.inlineEdit.inlineCompletion,o)),this.onDidAccept=this._model.onDidAccept}accept(i){this._model.accept(void 0,i)}handleInlineEditShownNextFrame(i,e){let t=this.inlineEdit.inlineCompletion,o=Date.now();t.addRef(),ox(()=>{this._model.handleInlineSuggestionShown(t,i,e,o),t.removeRef()})}};var LTe=class extends k{constructor(e,t,o){super();this._editor=e;this._edit=t;this._accessibilityService=o;this.onDidClick=U.None;this._iconRef=$o.ref();this.isHovered=Fo(!1);this._editorObs=Ds(this._editor);let r=this._edit.map(u=>u?.edit?.replacements[0]??null).map(u=>u?UA(u,this._editor.getModel()).range.getStartPosition():null),s=this._editorObs.observePosition(r,this._store),l=ke(u=>{let p=s.read(u);if(!p)return null;let h=this._editorObs.layoutInfoContentLeft.read(u),g=this._editorObs.scrollLeft.read(u);return new Mg(h+p.x-g,p.y)}),c=$o.div({class:"inline-edits-collapsed-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[[this.getCollapsedIndicator(l)]]).keepUpdated(this._store).element;this._register(this._editorObs.createOverlayWidget({domNode:c,position:Fo(null),allowEditorOverflow:!1,minContentWidthInPx:Fo(0)})),this.isVisible=this._edit.map((u,p)=>!!u&&l.read(p)!==null)}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{offset:0,transform:"translateY(-3px)"},{offset:.2,transform:"translateY(1px)"},{offset:.36,transform:"translateY(-1px)"},{offset:.52,transform:"translateY(1px)"},{offset:.68,transform:"translateY(-1px)"},{offset:.84,transform:"translateY(1px)"},{offset:1,transform:"translateY(0px)"}],{duration:2e3}).finished}getCollapsedIndicator(e){let t=this._editorObs.layoutInfoContentLeft,o=e.map((r,s)=>r?r.deltaX(-t.read(s)):null),n=this.createIconPath(o);return $o.svg({class:"collapsedView",ref:this._iconRef,style:{position:"absolute",...jb(r=>xTe(this._editorObs).read(r)),overflow:"hidden",pointerEvents:"none"}},[$o.svgElem("path",{class:"collapsedViewPath",d:n,fill:Tt(b0)})])}createIconPath(e){return e.map(r=>{if(!r)return new Vue().build();let s=r.deltaX(-6/2).deltaY(-1),l=s.deltaX(6),c=s.deltaY(1),u=l.deltaY(1),p=c.deltaX(6/2).deltaY(3);return new Vue().moveTo(s).lineTo(l).lineTo(u).lineTo(p).lineTo(c).lineTo(s).build()})}};LTe=I([m(2,Ai)],LTe);var aDt=14,$gi=0,$4=4,lDt=4,Poo=2,MTe=class extends k{constructor(e,t,o,n,r,s){super();this._editor=e;this._languageService=s;this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this._isHovered=De(this,!1);this.isHovered=this._isHovered;this._viewRef=$o.ref();this._editorObs=Ds(this._editor);let l=o.map((h,g)=>{let f;switch(h){case"inactive":f=yTe;break;case"jump":f=S2;break;case"accept":f=wTe;break}return{border:qb(f,r).read(g).toString(),background:VD(n.read(g))}}),c=t.map(h=>h?this.getState(h):void 0),u=c.map(h=>h?this.getRendering(h,l):void 0);this.minEditorScrollHeight=ke(this,h=>{let g=c.read(h);return g?g.rect.read(h).bottom+this._editor.getScrollTop():0});let p=$o.div({class:"inline-edits-custom-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[u]).keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:p.element,position:Fo(null),allowEditorOverflow:!1,minContentWidthInPx:mv(this,(h,g)=>{let f=c.read(h);if(!f)return g??0;let v=f.rect.map(b=>b.right).read(h)+this._editorObs.layoutInfoVerticalScrollbarWidth.read(h)+$4-this._editorObs.layoutInfoContentLeft.read(h);return Math.max(g??0,v)}).recomputeInitiallyAndOnChange(this._store)})),this._register(ve(h=>{if(!u.read(h)){this._isHovered.set(!1,void 0);return}this._isHovered.set(p.isHovered.read(h),void 0)}))}fitsInsideViewport(e,t,o){let n=this._editorObs.layoutInfoWidth.read(o),r=this._editorObs.layoutInfoContentLeft.read(o),s=this._editor.getLayoutInfo().verticalScrollbarWidth,l=this._editorObs.layoutInfoMinimap.read(o).minimapLeft!==0?this._editorObs.layoutInfoMinimap.read(o).minimapWidth:0,c=KA(this._editorObs,e,void 0),u=F9e(t,this._editor,this._editor.getModel()),p=$4+aDt;return c+u+p<n-r-s-l}getState(e){let t=ke(this,l=>{let c=e.range.startLineNumber,u=e.range.endLineNumber,p=e.range.startColumn,h=e.range.endColumn,g=this._editor.getModel()?.getLineCount()??0,f=KA(this._editorObs,new vo(c,c+1),l),v=c+1<=g?KA(this._editorObs,new vo(c+1,c+2),l):void 0,b=c-1>=1?KA(this._editorObs,new vo(c-1,c),l):void 0,S=this._editor.getOffsetForColumn(c,p),y=this._editor.getOffsetForColumn(u,h);return{lineWidth:f,lineWidthBelow:v,lineWidthAbove:b,startContentLeftOffset:S,endContentLeftOffset:y}}),o=e.range.startLineNumber,n=e.range.endLineNumber,r=this.fitsInsideViewport(new vo(o,n+1),e.content,void 0);return{rect:ke(this,l=>{let c=this._editorObs.getOption(59).read(l).typicalHalfwidthCharacterWidth,{lineWidth:u,lineWidthBelow:p,lineWidthAbove:h,startContentLeftOffset:g,endContentLeftOffset:f}=t.read(l),v=this._editorObs.layoutInfoContentLeft.read(l),b=this._editorObs.observeLineHeightForLine(o).recomputeInitiallyAndOnChange(l.store).read(l),S=this._editorObs.scrollTop.read(l),y=this._editorObs.scrollLeft.read(l),w;o===n&&f+5*c>=u&&r?w="end":p!==void 0&&p+aDt-lDt-$4<g?w="below":h!==void 0&&h+aDt-lDt-$4<g?w="above":w="end";let x,E,M=0,N=0;switch(w){case"end":{x=this._editorObs.editor.getTopForLineNumber(o),E=u,M=$4+aDt;break}case"below":{x=this._editorObs.editor.getTopForLineNumber(o+1),E=g,M=$4+lDt,N=$gi+Poo;break}case"above":{x=this._editorObs.editor.getTopForLineNumber(o-1),E=g,M=$4+lDt,N=-$gi+Poo;break}}return ap.fromLeftTopWidthHeight(v+E-y,x-S,c*e.content.length,b).withMargin($gi,$4).translateX(M).translateY(N)}),label:e.content,kind:e.style}}getRendering(e,t){let o=document.createElement("div"),n=this._editor.getModel().tokenization.tokenizeLinesAt(1,[e.label])?.[0],r;n&&e.kind===1?r=LB.fromLineTokens(n).toLineTokens(e.label,this._languageService.languageIdCodec):r=Cd.createEmpty(e.label,this._languageService.languageIdCodec);let s=oM(new AT([r]),NT.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],o,!0);o.style.width=`${s.minWidthInPx}px`;let l=e.rect.map(c=>c.withMargin(0,$4));return $o.div({class:"collapsedView",ref:this._viewRef,style:{position:"absolute",...jb(c=>l.read(c)),overflow:"hidden",boxSizing:"border-box",cursor:"pointer",border:t.map(c=>`1px solid ${c.border}`),borderRadius:`${$b}px`,backgroundColor:t.map(c=>c.background),display:"flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap"},onmousedown:c=>{c.preventDefault()},onclick:c=>{this._onDidClick.fire(bM.create(c))}},[o])}};MTe=I([m(4,Pe),m(5,Rt)],MTe);var Z8o=0,eQo=0,jgi=1,tQo=1,iQo=3,Qgi=$b,cDt=class extends k{constructor(e,t,o,n){super();this._editor=e;this._edit=t;this._uiState=o;this._tabAction=n;this.onDidClick=U.None;this._display=ke(this,e=>this._uiState.read(e)?"block":"none");this._editorMaxContentWidthInRange=ke(this,e=>{let t=this._originalDisplayRange.read(e);return t?(this._editorObs.versionId.read(e),mv(this,(o,n)=>{let r=KA(this._editorObs,t,o);return Math.max(r,n??0)})):Fo(0)}).map((e,t)=>e.read(t));this._maxPrefixTrim=ke(this,e=>{let t=this._uiState.read(e);return t?CTe(t.deletions,t.originalRange,[],this._editor):{prefixTrim:0,prefixLeftOffset:0}});this._editorLayoutInfo=ke(this,e=>{let t=this._edit.read(e);if(!t||!this._uiState.read(e))return null;let n=this._editorObs.layoutInfo.read(e),r=this._editorObs.scrollLeft.read(e),s=this._editorObs.getOption(59).map(f=>f.typicalHalfwidthCharacterWidth).read(e),l=n.contentLeft+Math.max(this._editorMaxContentWidthInRange.read(e),s)-r,c=t.originalLineRange,u=this._originalVerticalStartPosition.read(e)??this._editor.getTopForLineNumber(c.startLineNumber)-this._editorObs.scrollTop.read(e),p=this._originalVerticalEndPosition.read(e)??this._editor.getTopForLineNumber(c.endLineNumberExclusive)-this._editorObs.scrollTop.read(e),h=n.contentLeft+this._maxPrefixTrim.read(e).prefixLeftOffset-r;return l<=h?null:{codeRect:ap.fromLeftTopRightBottom(h,u,l,p).withMargin(eQo,Z8o),contentLeft:n.contentLeft}}).recomputeInitiallyAndOnChange(this._store);this._originalOverlay=$o.div({style:{pointerEvents:"none"}},ke(this,e=>{let t=jT(this._editorLayoutInfo).read(e);if(!t)return;let o=t.map(c=>ap.fromLeftTopRightBottom(c.contentLeft-Qgi-jgi,c.codeRect.top,c.contentLeft,c.codeRect.bottom)),n=ke(this,c=>{let u=t.read(c).codeRect,p=o.read(c);return u.intersectHorizontal(new gi(p.left,Number.MAX_SAFE_INTEGER))}),r=this._uiState.map(c=>c?.editorType==="diffEditor"?iQo:tQo).read(e),s=n.map(c=>c.withMargin(r,r)),l=VD(this._uiState.map(c=>c?.editorType??"textEditor").read(e));return[$o.div({class:"originalSeparatorDeletion",style:{...s.read(e).toStyles(),borderRadius:`${Qgi}px`,border:`${jgi+r}px solid ${l}`,boxSizing:"border-box"}}),$o.div({class:"originalOverlayDeletion",style:{...n.read(e).toStyles(),borderRadius:`${Qgi}px`,border:HJ(this._tabAction).map(c=>`${jgi}px solid ${Tt(c)}`),boxSizing:"border-box",backgroundColor:Tt(VJ)}}),$o.div({class:"originalOverlayHiderDeletion",style:{...o.read(e).toStyles(),backgroundColor:l}})]})).keepUpdated(this._store);this._nonOverflowView=$o.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._originalOverlay]]).keepUpdated(this._store);this.isHovered=Fo(!1);this._editorObs=Ds(this._editor);let r=ke(this,l=>{let c=this._edit.read(l);return c?new ye(c.originalLineRange.startLineNumber,1):null}),s=ke(this,l=>{let c=this._edit.read(l);return c?new ye(c.originalLineRange.endLineNumberExclusive,1):null});this._originalDisplayRange=this._uiState.map(l=>l?.originalRange),this._originalVerticalStartPosition=this._editorObs.observePosition(r,this._store).map(l=>l?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(s,this._store).map(l=>l?.y),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:Fo(null),allowEditorOverflow:!1,minContentWidthInPx:ke(this,l=>{let c=this._editorLayoutInfo.read(l);return c===null?0:c.codeRect.width})}))}};var W9e=1,oQo=1,nQo=3,Ygi=$b,PTe=class extends k{constructor(e,t,o,n,r){super();this._editor=e;this._input=t;this._tabAction=o;this._languageService=r;this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this._state=ke(this,e=>{let t=this._input.read(e);if(!t)return;let o=this._editor.getModel(),n=o.getEOL();if(t.startColumn===1&&t.lineNumber>1&&o.getLineLength(t.lineNumber)!==0&&t.text.endsWith(n)&&!t.text.startsWith(n)){let r=o.getLineLength(t.lineNumber-1)+1;return{lineNumber:t.lineNumber-1,column:r,text:n+t.text.slice(0,-n.length)}}return{lineNumber:t.lineNumber,column:t.startColumn,text:t.text}});this._trimVertically=ke(this,e=>{let t=this._state.read(e),o=t?.text;if(!o||o.trim()==="")return{topOffset:0,bottomOffset:0,linesTop:0,linesBottom:0};let n=this._editor.getLineHeightForPosition(new ye(t.lineNumber,1)),r=this._editor.getModel().getEOL(),s=0,l=0,c=0;for(;c<o.length&&o.startsWith(r,c);c+=r.length)s+=1;for(let u=o.length;u>c&&o.endsWith(r,u);u-=r.length)l+=1;return{topOffset:s*n,bottomOffset:l*n,linesTop:s,linesBottom:l}});this._maxPrefixTrim=ke(this,e=>{let t=this._state.read(e);if(!t)return{prefixLeftOffset:0,prefixTrim:0};let o=this._editor.getModel(),n=o.getEOL(),r=this._trimVertically.read(e),s=t.text.split(n),l=s.slice(r.linesTop,s.length-r.linesBottom);r.linesTop===0&&(l[0]=o.getLineContent(t.lineNumber)+l[0]);let c=new vo(t.lineNumber,t.lineNumber+(r.linesTop>0?0:1));return CTe([],c,l,this._editor)});this._ghostText=ke(e=>{let t=this._state.read(e),o=this._maxPrefixTrim.read(e);if(!t)return;let r=this._editor.getModel().getEOL(),l=t.text.split(r).map((c,u)=>new wT(new G(u+1,u===0?1:o.prefixTrim+1,u+1,c.length+1),"modified-background",0));return new h2(t.lineNumber,[new AJ(t.column,t.text,!1,l)])});this._display=ke(this,e=>this._state.read(e)?"block":"none");this._editorMaxContentWidthInRange=ke(this,e=>{let t=this._state.read(e);if(!t)return 0;this._editorObs.versionId.read(e);let o=this._editor.getModel(),n=o.getEOL(),r=t.text.startsWith(n)?"":o.getValueInRange(new G(t.lineNumber,1,t.lineNumber,t.column)),s=o.getValueInRange(new G(t.lineNumber,t.column,t.lineNumber,o.getLineLength(t.lineNumber)+1)),c=(r+t.text+s).split(n),u=NT.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),p=c.map(h=>{let g=o.tokenization.tokenizeLinesAt(t.lineNumber,[h])?.[0],f;return g?f=LB.fromLineTokens(g).toLineTokens(h,this._languageService.languageIdCodec):f=Cd.createEmpty(h,this._languageService.languageIdCodec),oM(new AT([f]),u,[],_("div"),!0).minWidthInPx});return Math.max(...p)});this.startLineOffset=this._trimVertically.map(e=>e.topOffset);this.originalLines=this._state.map(e=>e?new vo(e.lineNumber,Math.min(e.lineNumber+2,this._editor.getModel().getLineCount()+1)):void 0);this._overlayLayout=ke(this,e=>{this._ghostText.read(e);let t=this._state.read(e);if(!t)return null;this._editorObs.observePosition(De(this,new ye(t.lineNumber,t.column)),e.store).read(e);let o=this._editorObs.layoutInfo.read(e),n=this._editorObs.scrollLeft.read(e),r=this._editorObs.layoutInfoVerticalScrollbarWidth.read(e),s=o.contentLeft+this._editorMaxContentWidthInRange.read(e)-n,l=this._maxPrefixTrim.read(e).prefixLeftOffset??0,c=o.contentLeft+l-n;if(s<=c)return null;let{topOffset:u,bottomOffset:p}=this._trimVertically.read(e),h=this._editorObs.scrollTop.read(e),g=this._ghostTextView.height.read(e)-u-p,f=this._editor.getTopForLineNumber(t.lineNumber)-h+u,v=f+g,b=new ap(c,f,s,v);return{overlay:b,startsAtContentLeft:l===0,contentLeft:o.contentLeft,minContentWidthRequired:l+b.width+r}}).recomputeInitiallyAndOnChange(this._store);this._modifiedOverlay=$o.div({style:{pointerEvents:"none"}},ke(this,e=>{let t=jT(this._overlayLayout).read(e);if(!t)return;let o=t.map(c=>ap.fromLeftTopRightBottom(c.contentLeft-Ygi-W9e,c.overlay.top,c.contentLeft,c.overlay.bottom)).read(e),n=this._input.map(c=>c?.editorType==="diffEditor"?nQo:oQo).read(e),r=t.map(c=>c.overlay.withMargin(0,W9e,0,c.startsAtContentLeft?0:W9e).intersectHorizontal(new gi(o.left,Number.MAX_SAFE_INTEGER))),s=r.map(c=>c.withMargin(n,n)),l=VD(this._input.read(void 0)?.editorType??"textEditor");return[$o.div({class:"originalUnderlayInsertion",style:{...s.read(e).toStyles(),borderRadius:Ygi,border:`${W9e+n}px solid ${l}`,boxSizing:"border-box"}}),$o.div({class:"originalOverlayInsertion",style:{...r.read(e).toStyles(),borderRadius:Ygi,border:G4(this._tabAction).map(c=>`${W9e}px solid ${Tt(c)}`),boxSizing:"border-box",backgroundColor:Tt(nDt)}}),$o.div({class:"originalOverlayHiderInsertion",style:{...o.toStyles(),backgroundColor:l}})]})).keepUpdated(this._store);this._view=$o.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._modifiedOverlay]]).keepUpdated(this._store);this._editorObs=Ds(this._editor),this._ghostTextView=this._register(n.createInstance(b2,this._editor,ke(s=>{let l=this._ghostText.read(s);if(l)return{ghostText:l,handleInlineCompletionShown:c=>{},warning:void 0}}),{extraClasses:["inline-edit"],isClickable:!0,shouldKeepCursorStable:!0})),this.isHovered=this._ghostTextView.isHovered,this._register(this._ghostTextView.onDidClick(s=>{this._onDidClick.fire(new bM(s))})),this._register(this._editorObs.createOverlayWidget({domNode:this._view.element,position:Fo(null),allowEditorOverflow:!1,minContentWidthInPx:ke(this,s=>{let l=this._overlayLayout.read(s);return l===null?0:l.minContentWidthRequired})}))}};PTe=I([m(3,F),m(4,Rt)],PTe);var ATe=class extends k{constructor(e,t,o,n,r,s){super();this._editor=e;this._edit=t;this._editorType=o;this._tabAction=n;this._languageService=r;this._themeService=s;this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this._maxPrefixTrim=this._edit.map((l,c)=>l?CTe(l.replacements.flatMap(u=>[u.originalRange,u.modifiedRange]),l.originalRange,l.modifiedLines,this._editor.editor,c):void 0),this._modifiedLineElements=ke(this,l=>{let c=[],u=0,p=this._maxPrefixTrim.read(l),h=this._edit.read(l);if(!h||!p)return;let g=p.prefixTrim,f=rQo(h.replacements.map(S=>S.modifiedRange)).map(S=>new G(S.startLineNumber,S.startColumn-g,S.endLineNumber,S.endColumn-g)),v=this._editor.model.get(),b=h.modifiedRange.startLineNumber;for(let S=0;S<h.modifiedRange.length;S++){let y=document.createElement("div"),w=b+S,x=h.modifiedLines[S].slice(g),E=v.tokenization.tokenizeLinesAt(w,[x])?.[0],M;E?M=LB.fromLineTokens(E).toLineTokens(x,this._languageService.languageIdCodec):M=Cd.createEmpty(x,this._languageService.languageIdCodec);let N=[];for(let H of f.filter(K=>K.startLineNumber===w)){let K=Math.min(H.endColumn,x.length+1);N.push(new wT(new G(1,H.startColumn,1,K),"inlineCompletions-modified-bubble",0))}let V=oM(new AT([M]),NT.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),N,y,!0);this._editor.getOption(59).read(l),u=Math.max(u,V.minWidthInPx),c.push(y)}return{lines:c,requiredWidth:u}}),this._layout=ke(this,l=>{let c=this._modifiedLineElements.read(l),u=this._maxPrefixTrim.read(l),p=this._edit.read(l);if(!c||!u||!p)return;let{prefixLeftOffset:h}=u,{requiredWidth:g}=c,f=this._editor.observeLineHeightsForLineRange(p.originalRange).read(l),v=(()=>{let Re=f.slice(0,p.modifiedRange.length);for(;Re.length<p.modifiedRange.length;)Re.push(f[f.length-1]);return Re})(),b=this._editor.layoutInfoContentLeft.read(l),S=this._editor.layoutInfoVerticalScrollbarWidth.read(l),y=this._editor.scrollLeft.read(l),w=this._editor.scrollTop.read(l),x=b-y,E=this._editor.editor.getModel(),M=p.originalRange.mapToLineArray(Re=>this._editor.editor.getOffsetForColumn(Re,E.getLineMaxColumn(Re))-h),N=Math.max(...M,g),V=p.originalRange.startLineNumber,H=p.originalRange.endLineNumberExclusive-1,K=this._editor.editor.getTopForLineNumber(V)-w,j=this._editor.editor.getBottomForLineNumber(H)-w,J=ap.fromLeftTopWidthHeight(x+h,K,N,j-K),se=ap.fromLeftTopWidthHeight(J.left,J.bottom,J.width,v.reduce((Re,xe)=>Re+xe,0)),ae=ap.hull([J,se]),ce=ae.intersectVertical(new gi(J.bottom,Number.MAX_SAFE_INTEGER)),Se=new ap(ce.left,ce.top,ce.right,ce.bottom);return{originalLinesOverlay:J,modifiedLinesOverlay:se,background:ae,lowerBackground:ce,lowerText:Se,modifiedLineHeights:v,minContentWidthRequired:h+N+S}}),this._viewZoneInfo=ke(l=>{if(!this._editor.getOption(71).map(f=>f.edits.allowCodeShifting==="always").read(l))return;let u=this._layout.read(l),p=this._edit.read(l);if(!u||!p)return;let h=u.lowerBackground.height,g=p.originalRange.endLineNumberExclusive;return{height:h,lineNumber:g}}),this.minEditorScrollHeight=ke(this,l=>{let c=jT(this._layout).read(l);return!c||this._viewZoneInfo.read(l)!==void 0?0:c.read(l).lowerText.bottom+this._editor.editor.getScrollTop()}),this._div=$o.div({class:"line-replacement"},[ke(this,l=>{let c=jT(this._layout).read(l),u=this._modifiedLineElements.read(l);if(!c||!u)return[];let p=c.read(l),h=this._editor.layoutInfoContentLeft.read(l),g=this._editorType.read(l)==="diffEditor"?3:1;u.lines.forEach((S,y)=>{S.style.width=`${p.lowerText.width}px`,S.style.height=`${p.modifiedLineHeights[y]}px`,S.style.position="relative"});let f=G4(this._tabAction).read(l),v=HJ(this._tabAction).read(l),b=VD(this._editorType.read(l));return[$o.div({style:{position:"absolute",...jb(S=>xTe(this._editor).read(S)),overflow:"hidden",pointerEvents:"none"}},[$o.div({class:"borderAroundLineReplacement",style:{position:"absolute",...jb(S=>c.read(S).background.translateX(-h).withMargin(g)),borderRadius:`${$b}px`,border:`${g+1}px solid ${b}`,boxSizing:"border-box",pointerEvents:"none"}}),$o.div({class:"originalOverlayLineReplacement",style:{position:"absolute",...jb(S=>c.read(S).background.translateX(-h)),borderRadius:`${$b}px`,border:qb(v,this._themeService).map(S=>`1px solid ${S.toString()}`),pointerEvents:"none",boxSizing:"border-box",background:Tt(VJ)}}),$o.div({class:"modifiedOverlayLineReplacement",style:{position:"absolute",...jb(S=>c.read(S).lowerBackground.translateX(-h)),borderRadius:`0 0 ${$b}px ${$b}px`,background:b,boxShadow:`${Tt(Xz)} 0 6px 6px -6px`,border:`1px solid ${Tt(f)}`,boxSizing:"border-box",overflow:"hidden",cursor:"pointer",pointerEvents:"auto"},onmousedown:S=>{S.preventDefault()},onclick:S=>this._onDidClick.fire(bM.create(S))},[$o.div({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:Tt(Soo)}})]),$o.div({class:"modifiedLinesLineReplacement",style:{position:"absolute",boxSizing:"border-box",...jb(S=>c.read(S).lowerText.translateX(-h)),fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),pointerEvents:"none",whiteSpace:"nowrap",borderRadius:`0 0 ${$b}px ${$b}px`,overflow:"hidden"}},[...u.lines])])]})]).keepUpdated(this._store),this.isHovered=this._editor.isTargetHovered(l=>this._isMouseOverWidget(l),this._store),this._previousViewZoneInfo=void 0,this._register(ee(()=>this._editor.editor.changeViewZones(l=>this.removePreviousViewZone(l)))),this._register(Kle(this._viewZoneInfo,({lastValue:l,newValue:c})=>{l===c||l?.height===c?.height&&l?.lineNumber===c?.lineNumber||this._editor.editor.changeViewZones(u=>{this.removePreviousViewZone(u),c&&this.addViewZone(c,u)})})),this._register(this._editor.createOverlayWidget({domNode:this._div.element,minContentWidthInPx:ke(this,l=>this._layout.read(l)?.minContentWidthRequired??0),position:Fo({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_isMouseOverWidget(e){let t=this._layout.get();return!t||!(e.event instanceof zL)?!1:t.lowerBackground.containsPoint(new Mg(e.event.relativePos.x,e.event.relativePos.y))}removePreviousViewZone(e){if(!this._previousViewZoneInfo)return;e.removeZone(this._previousViewZoneInfo.id);let t=this._editor.cursorLineNumber.get();t!==null&&t>=this._previousViewZoneInfo.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()-this._previousViewZoneInfo.height),this._previousViewZoneInfo=void 0}addViewZone(e,t){let o=t.addZone({afterLineNumber:e.lineNumber-1,heightInPx:e.height,domNode:_("div")});this._previousViewZoneInfo={height:e.height,lineNumber:e.lineNumber,id:o};let n=this._editor.cursorLineNumber.get();n!==null&&n>=e.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()+e.height)}};ATe=I([m(4,Rt),m(5,Pe)],ATe);function rQo(a){let i=[];for(;a.length;){let e=a.shift();e.startLineNumber!==e.endLineNumber&&(a.push(new G(e.startLineNumber+1,1,e.endLineNumber,e.endColumn)),e=new G(e.startLineNumber,e.startColumn,e.startLineNumber,Number.MAX_SAFE_INTEGER)),i.push(e)}return i}function sQo(a,i){a.$$visualization=i}function V9e(a,i){if(Array.isArray(a)){let e={};a.forEach((t,o)=>{e[o.toString()]=t}),a=e}return sQo(a,new Xgi(a,i)),a}var Xgi=class{constructor(i,e){this._rects=i;this._elem=e}visualize(){let i=[];for(let e in this._rects){let t=new Jgi(this._rects[e],this._elem,e);i.push(t.visualize())}return{dispose:()=>{i.forEach(e=>e.dispose())}}}};var Jgi=class{constructor(i,e,t){this._rect=i;this._elem=e;this._name=t}visualize(){let i=document.createElement("div");i.style.position="fixed",i.style.border="1px solid red",i.style.boxSizing="border-box",i.style.pointerEvents="none",i.style.zIndex="100000";let e=document.createElement("div");e.textContent=this._name,e.style.position="absolute",e.style.top="-20px",e.style.left="0",e.style.color="red",e.style.fontSize="12px",e.style.backgroundColor="rgba(255, 255, 255, 0.7)",i.appendChild(e);let t=()=>{let n=this._elem.getBoundingClientRect();console.log(n),i.style.left=n.left+this._rect.left+"px",i.style.top=n.top+this._rect.top+"px",i.style.width=this._rect.width+"px",i.style.height=this._rect.height+"px"};document.body.appendChild(i),t();let o=new ResizeObserver(t);return o.observe(this._elem),{dispose:()=>{o.disconnect(),i.remove()}}}};function B9e(a,i){if(typeof a=="object"&&a&&"$$visualization"in a){let e=a.$$visualization;aQo(e.visualize(),i)}}function aQo(a,i){ke({name:"debugReadDisposable"},e=>{e.store.add(a)}).read(i)}function Aoo(a,i){let e={};for(let[r,s]of Object.entries(i))Array.isArray(s)?e[r]={min:0,rules:s}:e[r]={min:s.min??0,rules:s.rules??[{max:s.max,priority:s.priority,share:s.share}]};let t={},o=0;for(let[r,s]of Object.entries(e))t[r]=s.min,o+=s.min;if(o>a)return null;let n=a-o;for(;n>0;){let r=[];for(let[h,g]of Object.entries(e))for(let f=0;f<g.rules.length;f++){let v=g.rules[f],b=t[h],S=v.max??1/0;b<S&&r.push({partKey:h,ruleIndex:f,rule:v,priority:v.priority??0,share:v.share??1})}if(r.length===0)break;let s=Math.max(...r.map(h=>h.priority)),l=r.filter(h=>h.priority===s),c=l.reduce((h,g)=>h+g.share,0),u=0,p=[];for(let h of l){let g=h.rule,f=t[h.partKey],b=(g.max??1/0)-f,S=n*h.share/c,y=Math.min(S,b);p.push({partKey:h.partKey,ruleIndex:h.ruleIndex,amount:y}),u+=y}if(u===0)break;for(let h of p)t[h.partKey]+=h.amount;if(n-=u,n<1e-4)break}return t}var zJ=class extends k{constructor(e,t,o,n,r,s){super();this._editor=e;this._data=o;this._themeService=n;this._keybindingService=r;this._contextKeyService=s;this._styles=ke(this,e=>({background:qb(S2,this._themeService).read(e).toString(),foreground:qb(BJ,this._themeService).read(e).toString(),border:qb(b0,this._themeService).read(e).toString()}));this._pos=ke(this,e=>this._editor.observePosition(ke(t=>this._data.read(t)?.jumpToPosition||null),e.store)).flatten();this._layout=ke(this,e=>{let t=this._data.read(e);if(!t)return;let o=t.jumpToPosition,n=this._editor.observeLineHeightForLine(Fo(o.lineNumber)).read(e),r=this._editor.scrollLeft.read(e),s=this._pos.read(e);if(!s)return;let l=this._editor.layoutInfo.read(e);return{widgetRect:ap.fromLeftTopWidthHeight(s.x+l.contentLeft+2-r,s.y,100,n)}});this._blink=lQo([{value:!0,durationMs:600},{value:!1,durationMs:600}]);this._widget=$o.div({class:"inline-edit-jump-to-widget",style:{position:"absolute",display:this._layout.map(e=>e?"flex":"none"),alignItems:"center",cursor:"pointer",userSelect:"none",...jb(e=>this._layout.read(e)?.widgetRect)}},ke(e=>this._data.read(e)===void 0?[]:$o.div({style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 4px",height:"100%",backgroundColor:this._styles.map(t=>t.background),"--vscodeIconForeground":this._styles.map(t=>t.foreground),border:this._styles.map(t=>`1px solid ${t.border}`),borderRadius:"3px",boxSizing:"border-box",fontSize:"11px",color:this._styles.map(t=>t.foreground)}},[this._style==="cursor"?$o.elem("div",{style:{borderLeft:"2px solid",height:14,opacity:this._blink.map(t=>t?"0":"1")}}):[ke(()=>$o.elem("div",{},cQo(this._keybinding))),$o.elem("div",{style:{lineHeight:this._layout.map(t=>t?.widgetRect.height),marginTop:"-2px"}},["to jump"])]])));this._style=t.style,this._keybinding=this._getKeybinding(qK);let l=this._widget.keepUpdated(this._store);this._register(this._editor.createOverlayWidget({domNode:l.element,position:Fo(null),allowEditorOverflow:!1,minContentWidthInPx:Fo(0)})),this._register(this._editor.setDecorations(ke(c=>{let u=this._data.read(c);return u?[{range:G.fromPositions(u.jumpToPosition,u.jumpToPosition),options:{description:"inline-edit-jump-to-decoration",inlineClassNameAffectsLetterSpacing:!0,showIfCollapsed:!0,after:{content:this._style==="label"?"          ":"  "}}}]:[]})))}_getKeybinding(e,t=Dl.ofCaller()){return e?vi(this,this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e),t):Fo(void 0)}};zJ=I([m(3,Pe),m(4,Le),m(5,X)],zJ);function lQo(a,i=Dl.ofCaller()){let e=0;return vi(void 0,t=>{e=0;let o=new Dt(()=>{e=(e+1)%a.length,t(null),o.schedule(a[e].durationMs)},0);return o.schedule(0),o},()=>a[e].value,i)}function cQo(a){return ke(i=>$o.div({style:{},ref:e=>{let t=i.store.add(new ah(e,Ao,{disableTitle:!0,...qk,keybindingLabelShadow:void 0,keybindingLabelForeground:Tt(BJ),keybindingLabelBackground:"transparent",keybindingLabelBorder:Tt(BJ),keybindingLabelBottomBorder:void 0}));i.store.add(ve(o=>{t.set(a.read(o))}))}}))}var NTe=class extends k{constructor(e,t,o,n,r){super();this._previewTextModel=e;this._properties=t;this._parentEditor=o;this._tabAction=n;this._instantiationService=r;this._previewRef=$o.ref();this.element=$o.div({class:"preview",style:{},ref:this._previewRef});this._state=ke(this,e=>{let t=this._properties.read(e);if(!t)return;let o,n;t.nextCursorPosition!==null?(o="original",n=vo.ofLength(t.nextCursorPosition.lineNumber,1)):t.diff[0].innerChanges?.every(s=>s.modifiedRange.isEmpty())?(o="original",n=vo.ofLength(t.diff[0].original.startLineNumber,1)):(o="modified",n=vo.ofLength(t.diff[0].modified.startLineNumber,1));let r=o==="modified"?g2.snapshot(this._previewTextModel):t.target;return{mode:o,visibleLineRange:n,textModel:r,diff:t.diff}});this.updatePreviewEditorEffect=ke(this,e=>{this._previewEditorObs.model.read(e);let t=this._state.read(e)?.visibleLineRange;if(!t)return;let o=[];t.startLineNumber>1&&o.push(new G(1,1,t.startLineNumber-1,1)),t.endLineNumberExclusive<this._previewTextModel.getLineCount()+1&&o.push(new G(t.endLineNumberExclusive,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(o,void 0,!0)});this.horizontalContentRangeInPreviewEditorToShow=ke(this,e=>this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor,e));this.contentHeight=ke(this,e=>{let t=this._state.read(e);return t?this._previewEditorObs.observeLineHeightForLine(t.visibleLineRange.startLineNumber):Fo(null)}).flatten();this._editorDecorations=ke(this,e=>{let t=this._state.read(e);if(!t)return;let o={mode:"insertionInline",diff:t.diff},n=[],r=[],s=So.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),l=So.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),c=So.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),u=!0;for(let p of o.diff)if(p.modified.isEmpty||p.original.isEmpty)p.original.isEmpty||n.push({range:p.original.toInclusiveRange(),options:s}),p.modified.isEmpty||r.push({range:p.modified.toInclusiveRange(),options:l});else for(let h of p.innerChanges||[])p.original.contains(h.originalRange.startLineNumber)&&!(u&&h.originalRange.isEmpty())&&n.push({range:h.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:kTe("inlineCompletions-char-delete",h.originalRange.isEmpty()&&"empty"),zIndex:1}}),p.modified.contains(h.modifiedRange.startLineNumber)&&r.push({range:h.modifiedRange,options:c});return{originalDecorations:n,modifiedDecorations:r}});this.previewEditor=this._register(this._createPreviewEditor()),this._parentEditorObs=Ds(this._parentEditor),this._register(ve(l=>{let c=this._state.read(l)?.textModel||null;c&&this.previewEditor.setModel(c.dangerouslyGetUnderlyingModel())})),this._previewEditorObs=Ds(this.previewEditor),this._register(this._previewEditorObs.setDecorations(ke(l=>{let c=this._state.read(l),u=this._editorDecorations.read(l);return(c?.mode==="original"?u?.originalDecorations:u?.modifiedDecorations)??[]}))),!1&&this._register(this._instantiationService.createInstance(zJ,this._previewEditorObs,{style:"cursor"},ke(l=>{let c=this._properties.read(l);if(!(!c||!c.nextCursorPosition))return{jumpToPosition:c.nextCursorPosition}}))),this._register(ve(l=>{if(!this._properties.read(l))return;let c=this._parentEditorObs.cursorPosition.read(l);c&&this.previewEditor.setPosition(this._previewTextModel.validatePosition(c),"longDistanceHintPreview")})),this._register(ve(l=>{let c=this._state.read(l);if(!c)return;let u=c.visibleLineRange.startLineNumber.toString().length;this.previewEditor.updateOptions({lineNumbersMinChars:u+1})})),this._register(this._instantiationService.createInstance(UJ,this._previewEditorObs,ke(l=>{let c=this._state.read(l);if(!c)return;let u=this._properties.read(l);if(u)return new TTe(u.inlineSuggestInfo,vo.ofLength(c.visibleLineRange.startLineNumber,1),u.model,void 0)}),this._tabAction,Fo(0),Fo(!1),De(this,!1))),this.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store)}_createPreviewEditor(){return this._instantiationService.createInstance(Ed,this._previewRef.element,{glyphMargin:!1,lineNumbers:"on",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},editContext:!1,rulers:[],padding:{top:0,bottom:0},selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[Za.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._parentEditor)}_getHorizontalContentRangeInPreviewEditorToShow(e,t){let o=this._state.read(t);if(!o)return;let n=o.diff,r=this._properties.read(t)?.nextCursorPosition,s=o.visibleLineRange,l=this._previewEditorObs.layoutInfo.read(t),c=KA(this._previewEditorObs,s,t),u;if(r)u=G.fromPositions(r);else if(n[0].innerChanges)u=o.mode==="modified"?n[0].innerChanges[0].modifiedRange:n[0].innerChanges[0].originalRange;else return;let p=dQo(e.getModel(),u,5),h=this._previewEditorObs.getLeftOfPosition(p.getStartPosition(),t),g=this._previewEditorObs.getLeftOfPosition(p.getEndPosition(),t),f=jn(h,0,c),v=jn(g,f,c),b=e.getModel().getLineFirstNonWhitespaceColumn(p.startLineNumber),S=this._previewEditorObs.getLeftOfPosition(new ye(p.startLineNumber,b),t),y=new gi(f,v);return{indentationEnd:S,preferredRangeToReveal:y,maxEditorWidth:c+l.contentLeft,contentWidth:c,nonContentWidth:l.contentLeft}}layout(e,t){this.previewEditor.layout(e),this._previewEditorObs.editor.setScrollLeft(t)}};NTe=I([m(4,F)],NTe);function dQo(a,i,e){let t=i.getStartPosition(),o=i.getEndPosition(),n=a.getLineContent(t.lineNumber);function r(u){let p=n.charAt(u-1);return/[a-zA-Z0-9_]/.test(p)}function s(u){let p=n.charAt(u-1);return p===" "||p==="	"}let l=t.column;for(;l>1&&r(l)&&!s(l-1)&&t.column-l<e;)l--;let c=o.column-1;for(;c<=n.length&&r(c)&&!s(c+1)&&c-o.column<e;)c++;return new G(t.lineNumber,t.column,o.lineNumber,c+1)}function Noo(a,i){let e=a.start,t=a.endExclusive,o=Number.MAX_VALUE,n=0;for(let r of i){let s=n+r.width,l=Math.max(e,n),c=Math.min(t,s);l<c&&(o=Math.min(o,r.height)),n=s}return t>n||o===Number.MAX_VALUE?0:o}var H9e=class{constructor(i,e,t){this._lineRangeInfo=i;this.availableSpaceSizes=i.sizes.map((o,n)=>{let r=i.lineRange.startLineNumber+n,s=t(r);return new FJ(Math.max(0,e-o.width-s),o.height)}),this.availableSpaceHeightPrefixSums=pQo(this.availableSpaceSizes,o=>o.height),this.availableSpaceSizesTransposed=this.availableSpaceSizes.map(o=>o.transpose())}getWidgetVerticalOutline(i,e,t){let o=i-this._lineRangeInfo.lineRange.startLineNumber,n=this._lineRangeInfo.top+this.availableSpaceHeightPrefixSums[o],r=gi.ofStartAndLength(n,e),{previewEditorMargin:s,widgetPadding:l,widgetBorder:c,lowerBarHeight:u}=t;return r.withMargin(s+l+c).withMargin(0,u)}tryFindWidgetOutline(i,e,t,o){if(!(this._lineRangeInfo.lineRange.length<3))return uQo(this._lineRangeInfo.lineRange.addMargin(-1,-1),i,n=>{let r=this.getWidgetVerticalOutline(n,e,o),s=Noo(r.delta(-this._lineRangeInfo.top),this.availableSpaceSizesTransposed);return s<o.minWidgetWidth?void 0:{horizontalWidgetRange:gi.ofStartAndLength(t-s,s),verticalWidgetRange:r}})}};function Ooo(a,i,e,t,o){let n=[],r=a.startLineNumber,s=e,l=[];for(let c=0;c<i.length;c++){let u=a.startLineNumber+c,p=s+l.reduce((g,f)=>g+f.height,0),h=t.editor.getTopForLineNumber(u);c>0&&h!==p&&(n.push({lineRange:vo.ofLength(r,u-r),top:s,sizes:l}),r=u,s=h,l=[]),l.push(i[c])}return n.push({lineRange:vo.ofLength(r,a.endLineNumberExclusive-r),top:s,sizes:l}),ke({owner:"splitIntoContinuousLineRanges"},c=>t.observeTopForLineNumber(a.endLineNumberExclusive-1).read(c)).read(o),n}function uQo(a,i,e){for(let t=0;;t++){let o=i+t;if(o<=a.endLineNumberExclusive){let r=e(o);if(r!==void 0)return r}let n=i-t;if(n>=a.startLineNumber){let r=e(n);if(r!==void 0)return r}if(n<a.startLineNumber&&o>a.endLineNumberExclusive)return}}function pQo(a,i){let e=[0],t=0;for(let o of a)t+=i(o),e.push(t);return e}var mQo=6,Zgi={EMPTY_SPACE:425,OVERLAY:375},hQo=250,gQo={previewEditorMargin:2,widgetPadding:2,widgetBorder:1,lowerBarHeight:20,minWidgetWidth:hQo},OTe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._editor=e;this._viewState=t;this._previewTextModel=o;this._tabAction=n;this._instantiationService=r;this._themeService=s;this._keybindingService=l;this._modelService=c;this._languageService=u;this.onDidClick=U.None;this._viewWithElement=void 0;this._hintTextPosition=ke(this,e=>{let t=this._viewState.read(e);return t?new ye(t.hint.lineNumber,Number.MAX_SAFE_INTEGER):null});this._lineSizesAroundHintPosition=ke(this,e=>{let t=this._viewState.read(e),o=this._hintTextPosition.read(e);if(!t||!o)return[];let n=this._editorObs.model.read(e);if(!n)return[];let r=vo.ofLength(o.lineNumber,1).addMargin(5,5).intersect(vo.ofLength(1,n.getLineCount()));if(!r)return[];let s=Eoo(this._editorObs,r,e),l=this._editorObs.observeTopForLineNumber(r.startLineNumber).read(e);return Ooo(r,s,l,this._editorObs,e)});this._isVisibleDelayed=aoi(ke(this,e=>this._viewState.read(e)?.hint.isVisible),(e,t)=>e===!0&&t===!1?200:0);this._previewEditorLayoutInfo=ke(this,e=>{let t=this._viewState.read(e);if(!t||!this._isVisibleDelayed.read(e))return;let o=this._lineSizesAroundHintPosition.read(e);if(o.length===0)return;let n=this._editorObs.scrollTop.read(e),r=this._editorObs.scrollLeft.read(e),s=this._editorObs.layoutInfo.read(e),l=this._previewEditor.contentHeight.read(e),c=this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(e);if(!l||!c)return;let u=s.contentWidth-s.verticalScrollbarWidth,p=s.contentLeft+u;if(!this._editorObs.cursorLineNumber.read(e))return;let g=gQo,v=l+2,b,S,y=tt=>tt===t.hint.lineNumber?40:20;for(let tt of o){let Oi=new H9e(tt,u,y);if(S=Oi,!1){let mo=vQo(new Mg(p,tt.top-n),Oi.availableSpaceSizes,"right");B9e(V9e({...mo},this._editor.getDomNode()),e)}if(b=Oi.tryFindWidgetOutline(t.hint.lineNumber,v,p,g),b)break}let w="empty-space";if(!b){w="overlay";let tt=Math.min(s.width-s.contentLeft,Zgi.OVERLAY),Oi=S??new H9e(o[0],u,y);b={horizontalWidgetRange:gi.ofStartAndLength(p-tt,tt),verticalWidgetRange:Oi.getWidgetVerticalOutline(t.hint.lineNumber+2,v,g).delta(10)}}if(!b)return;let x=ap.fromRanges(b.horizontalWidgetRange,b.verticalWidgetRange).translateX(-r).translateY(-n);!1&&B9e(V9e({rectAvailableSpace:x},this._editor.getDomNode()),e);let{previewEditorMargin:M,widgetPadding:N,widgetBorder:V,lowerBarHeight:H}=g,K=Math.min(w==="overlay"?Zgi.OVERLAY:Zgi.EMPTY_SPACE,c.maxEditorWidth+M+N),j=Aoo(x.width,{spaceBefore:{min:0,max:10,priority:1},content:{min:50,rules:[{max:150,priority:2},{max:K,priority:1}]},spaceAfter:{min:10}});if(!j)return null;let J=fQo([j.spaceBefore,j.content,j.spaceAfter],x.left),se=x.withHorizontalRange(J[0]),ae=x.withHorizontalRange(J[1]),ce=x.withHorizontalRange(J[2]);!1&&B9e(V9e({spaceBeforeRect:se,widgetRect:ae,spaceAfterRect:ce},this._editor.getDomNode()),e);let Re=ae.withMargin(-N-V-M).withMargin(0,0,-H,0);!1&&B9e(V9e({previewEditorRect:Re},this._editor.getDomNode()),e);let He=Re.width-c.nonContentWidth,Ee=He*.8,Te=c.preferredRangeToReveal.intersect(gi.ofStartAndLength(c.preferredRangeToReveal.start,Ee))??c.preferredRangeToReveal,It=bQo(c.indentationEnd,He,Te);return{codeEditorSize:Re.getSize(),codeScrollLeft:r,contentLeft:s.contentLeft,widgetRect:ae,previewEditorMargin:M,widgetPadding:N,widgetBorder:V,lowerBarHeight:H,desiredPreviewEditorScrollLeft:It.newScrollPosition}});this._view=$o.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:ke(this,e=>this._previewEditorLayoutInfo.read(e)?"block":"none")}},[ke(this,e=>[this._widgetContent])]);this._widgetContent=ke(this,e=>$o.div({class:["inline-edits-long-distance-hint-widget","show-file-icons"],style:{position:"absolute",overflow:"hidden",cursor:"pointer",background:Tt(qu),padding:this._previewEditorLayoutInfo.map(t=>t?.widgetPadding),boxSizing:"border-box",borderRadius:mQo,border:ke(t=>`${this._previewEditorLayoutInfo.read(t)?.widgetBorder}px solid ${this._styles.read(t).border}`),display:"flex",flexDirection:"column",opacity:ke(t=>this._viewState.read(t)?.hint.isVisible?"1":"0"),transition:"opacity 200ms ease-in-out",...jb(t=>this._previewEditorLayoutInfo.read(t)?.widgetRect)},onmousedown:t=>{t.preventDefault()},onclick:()=>{this._viewState.read(void 0)?.model.jump()}},[$o.div({class:["editorContainer"],style:{overflow:"hidden",padding:this._previewEditorLayoutInfo.map(t=>t?.previewEditorMargin),background:this._styles.map(t=>t.background),pointerEvents:"none"}},[ke(this,t=>this._previewEditor.element)]),$o.div({class:"bar",style:{color:Tt(L3e),pointerEvents:"none",margin:"0 4px",height:this._previewEditorLayoutInfo.map(t=>t?.lowerBarHeight),display:"flex",justifyContent:"space-between",alignItems:"center"}},[ke(this,t=>{let o=[],n=this._viewState.read(t);if(!n)return o;let r=this._editorObs.model.read(t)?.uri,s=n.target.uri,l=s&&(!r||s.toString()!==r.toString());if(l){let g=Be(s),f=Ia(this._modelService,this._languageService,s,0);o.push($o.div({class:"target-file",style:{display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[$o.elem("span",{class:f,style:{flexShrink:"0",marginRight:"4px"}}),g]))}else{let g=this._originalOutlineSource.read(t),f=this._originalTargetLineNumber.read(t),v=g?.getAt(f,t).slice(0,1)??[],b=[];if(v.length>0)for(let S=0;S<v.length;S++){let y=v[S],w=Zm.toIcon(y.kind);b.push($o.div({class:"breadcrumb-item",style:{display:"flex",alignItems:"center",flex:"1 1 auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},[un(w),"\xA0",y.name,...S===v.length-1?[]:[un(L.chevronRight)]]))}o.push($o.div({class:"outline-elements",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},b))}let c=this._originalTargetLineNumber.read(t),u=l?L.arrowRight:n.hint.lineNumber<c?L.arrowDown:L.arrowUp,p=this._keybindingService.lookupKeybinding(CEt),h=l?"Go to file":"Go to suggestion";return p&&p.getLabel()==="Tab"&&(h=l?"Tab to open":"Tab to jump"),o.push($o.div({class:"go-to-label",style:{position:"relative",display:"flex",alignItems:"center",flex:"0 0 auto",paddingLeft:"6px"}},[h,"\xA0",un(u)])),o})])]));this._originalTargetLineNumber=ke(this,e=>{let t=this._viewState.read(e);return t?t.edit.action?.kind==="jumpTo"?t.edit.action.position.lineNumber:t.diff[0]?.original.startLineNumber??-1:-1});this._originalOutlineSource=Ry(this,e=>{let t=this._editorObs.model.read(e),o=ZF._breadcrumbsSourceFactory.read(e);return!t||!o?void 0:o(t,this._instantiationService)});this._styles=ke(p=>{let h=this._tabAction.read(p),g=WJ(bT,this._themeService).read(p),f=vi(this._themeService.onDidColorThemeChange,()=>{let b=this._themeService.getColorTheme();return b.type==="hcDark"||b.type==="hcLight"}).read(p),v;if(f)v=g;else{let b;switch(h){case"inactive":b=yTe;break;case"jump":b=S2;break;case"accept":b=wTe;break}v=qb(b,this._themeService).read(p)}return{border:v.toString(),background:VD(this._viewState.map(b=>b?.editorType??"textEditor").read(p))}}),this._editorObs=Ds(this._editor),this._previewEditor=this._register(this._instantiationService.createInstance(NTe,this._previewTextModel,ke(p=>{let h=this._viewState.read(p);if(h)return{diff:h.diff,model:h.model,inlineSuggestInfo:h.inlineSuggestInfo,nextCursorPosition:h.nextCursorPosition,target:h.target}}),this._editor,this._tabAction)),this._viewWithElement=this._view.keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._viewWithElement.element,position:Fo(null),allowEditorOverflow:!1,minContentWidthInPx:Fo(0)})),this._widgetContent.get().keepUpdated(this._store),this._register(ve(p=>{let h=this._previewEditorLayoutInfo.read(p);h&&this._previewEditor.layout(h.codeEditorSize.toDimension(),h.desiredPreviewEditorScrollLeft)})),this._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store)}get isHovered(){return this._widgetContent.get().didMouseMoveDuringHover}};OTe=I([m(4,F),m(5,Pe),m(6,Le),m(7,_t),m(8,Rt)],OTe);function fQo(a,i=0){let e=[],t=i;for(let o of a)e.push(new gi(t,t+o)),t+=o;return e}function vQo(a,i,e="left"){let t=[],o=0;for(let n of i)t.push(ap.fromLeftTopWidthHeight(a.x+(e==="left"?0:-n.width),a.y+o,n.width,n.height)),o+=n.height;return t}function bQo(a,i,e){let t=new gi(a,a+i);return t.containsRange(e)?{newScrollPosition:a}:e.length>i?{newScrollPosition:e.start}:e.endExclusive>t.endExclusive?{newScrollPosition:e.endExclusive-i}:e.start<t.start?{newScrollPosition:e.start}:{newScrollPosition:a}}var FTe=0,U9e=0,SQo=!1,dH=1,IQo=1,yQo=3,j4=$b,efi=20,Foo=12,Bue=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._edit=t;this._previewTextModel=o;this._uiState=n;this._tabAction=r;this._instantiationService=s;this._themeService=l;this._userInteractionService=c;this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this._editorObs=Ds(this._editor),this._display=ke(this,h=>this._uiState.read(h)?"block":"none"),this.previewRef=$o.ref();let u=this._uiState.map(h=>h?.editorType==="diffEditor"?yQo:IQo);this._editorContainer=$o.div({class:["editorContainer"],style:{position:"absolute",overflow:"hidden",cursor:"pointer"},onmousedown:h=>{h.preventDefault()},onclick:h=>{this._onDidClick.fire(bM.create(h))}},[$o.div({class:"preview",style:{pointerEvents:"none"},ref:this.previewRef})]).keepUpdated(this._store),this.isHovered=this._userInteractionService.createHoverTracker(this._editorContainer.element,this._store),this.previewEditor=this._register(this._instantiationService.createInstance(Ed,this.previewRef.element,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},editContext:!1,rulers:[],padding:{top:0,bottom:0},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[Za.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._editor)),this._previewEditorObs=Ds(this.previewEditor),this._activeViewZones=[],this._updatePreviewEditor=ke(this,h=>{this._editorContainer.readEffect(h),this._previewEditorObs.model.read(h),this._display.read(h),this._nonOverflowView&&(this._nonOverflowView.element.style.display=this._display.read(h));let g=this._uiState.read(h),f=this._edit.read(h);if(!g||!f)return;let v=f.originalLineRange,b=[];v.startLineNumber>1&&b.push(new G(1,1,v.startLineNumber-1,1)),v.startLineNumber+g.newTextLineCount<this._previewTextModel.getLineCount()+1&&b.push(new G(v.startLineNumber+g.newTextLineCount,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(b,void 0,!0);let S=[...this._activeViewZones];this._activeViewZones=[];let y=v.endLineNumberExclusive-v.startLineNumber-g.newTextLineCount;this.previewEditor.changeViewZones(w=>{S.forEach(x=>w.removeZone(x)),y>0&&this._activeViewZones.push(w.addZone({afterLineNumber:v.startLineNumber+g.newTextLineCount-1,heightInLines:y,showInHiddenAreas:!0,domNode:_("div.diagonal-fill.inline-edits-view-zone")}))})}),this._previewEditorWidth=ke(this,h=>{let g=this._edit.read(h);return g?(this._updatePreviewEditor.read(h),KA(this._previewEditorObs,g.modifiedLineRange,h)):0}),this._cursorPosIfTouchesEdit=ke(this,h=>{let g=this._editorObs.cursorPosition.read(h),f=this._edit.read(h);if(!(!f||!g))return f.modifiedLineRange.contains(g.lineNumber)?g:void 0}),this._originalStartPosition=ke(this,h=>{let g=this._edit.read(h);return g?new ye(g.originalLineRange.startLineNumber,1):null}),this._originalEndPosition=ke(this,h=>{let g=this._edit.read(h);return g?new ye(g.originalLineRange.endLineNumberExclusive,1):null}),this._originalVerticalStartPosition=this._editorObs.observePosition(this._originalStartPosition,this._store).map(h=>h?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(this._originalEndPosition,this._store).map(h=>h?.y),this._originalDisplayRange=this._edit.map(h=>h?.displayRange),this._editorMaxContentWidthInRange=ke(this,h=>{let g=this._originalDisplayRange.read(h);return g?(this._editorObs.versionId.read(h),mv(this,(f,v)=>{let b=KA(this._editorObs,g,f);return Math.max(b,v??0)})):Fo(0)}).map((h,g)=>h.read(g));let p=Roo(this._editor,this._store);this._previewEditorLayoutInfo=ke(this,h=>{let g=this._edit.read(h);if(!g||!this._uiState.read(h))return null;let v=g.originalLineRange,b=this._editorObs.scrollLeft.read(h),S=this._editorMaxContentWidthInRange.read(h),y=this._editorObs.layoutInfo.read(h),w=this._previewEditorWidth.read(h),x=y.contentWidth-y.verticalScrollbarWidth,E=p.read(h),M=y.contentLeft+y.contentWidth+E.left,N=Me(this._editor.getContainerDomNode()).innerWidth-M,V=Me(this._editor.getContainerDomNode()).innerWidth-E.right,H=Math.min(y.contentWidth*.3,w,100),K=0,j=K+N,J=this._cursorPosIfTouchesEdit.read(h),se=Math.max(x+b-K-Math.max(0,H-j),Math.min(J?Too(this._editorObs,J,h)+50:0,x+b)),ae=Math.min(S+efi,se),ce=S+efi+w+70,Se=se-ae,Re,xe;ae>b?(Re=0,xe=y.contentLeft+ae-b):(Re=b-ae,xe=y.contentLeft);let He=this._originalVerticalStartPosition.read(h)??this._editor.getTopForLineNumber(v.startLineNumber)-this._editorObs.scrollTop.read(h),Ee=this._originalVerticalEndPosition.read(h)??this._editor.getBottomForLineNumber(v.endLineNumberExclusive-1)-this._editorObs.scrollTop.read(h),Te=y.contentLeft-b,It=ap.fromLeftTopRightBottom(Te,He,xe,Ee),tt=It.height===0;tt||(It=It.withMargin(U9e,FTe));let zt=this._previewEditorObs.observeLineHeightsForLineRange(g.modifiedLineRange).read(h).reduce((Ko,Bn)=>Ko+Bn,0),mo=Ee-He,dn=Math.max(mo,zt),No=Se===0,_i=0,ln=Math.min(w+Foo,V+y.width-y.contentLeft-_i),Tn=ap.fromLeftTopWidthHeight(It.right+_i,He,ln,dn);return tt?Tn=Tn.withMargin(U9e,FTe).translateY(U9e):Tn=Tn.withMargin(U9e,FTe).translateX(FTe+dH),{codeRect:It,editRect:Tn,codeScrollLeft:b,contentLeft:y.contentLeft,isInsertion:tt,maxContentWidth:ce,shouldShowShadow:No,desiredPreviewEditorScrollLeft:Re,previewEditorWidth:ln}}),this._stickyScrollController=jy.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?vi(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Fo(0),this._shouldOverflow=ke(this,h=>{if(!SQo)return!1;let g=this._edit.read(h)?.originalLineRange;if(!g)return!1;let f=this._stickyScrollHeight.read(h);return!(this._editor.getTopForLineNumber(g.startLineNumber)-this._editorObs.scrollTop.read(h)<=f||this._editor.getTopForLineNumber(g.endLineNumberExclusive)-this._editorObs.scrollTop.read(h)>=this._editorObs.layoutInfo.read(h).height)}),this._originalBackgroundColor=vi(this,this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme().getColor(VJ)??Ue.transparent),this._editorBackgroundColor=this._uiState.map(h=>VD(h?.editorType??"textEditor")),this._backgroundSvg=$o.svg({transform:"translate(-0.5 -0.5)",style:{overflow:"visible",pointerEvents:"none",position:"absolute"}},[$o.svgElem("path",{class:"rightOfModifiedBackgroundCoverUp",d:ke(this,h=>{let g=this._previewEditorLayoutInfo.read(h);if(!(!g||this._originalBackgroundColor.read(h).isTransparent()))return new Vue().moveTo(g.codeRect.getRightTop()).lineTo(g.codeRect.getRightTop().deltaX(1e3)).lineTo(g.codeRect.getRightBottom().deltaX(1e3)).lineTo(g.codeRect.getRightBottom()).build()}),style:{fill:this._editorBackgroundColor}})]).keepUpdated(this._store),this._originalOverlay=$o.div({style:{pointerEvents:"none",display:this._previewEditorLayoutInfo.map(h=>h?.isInsertion?"none":"block")}},ke(this,h=>{let g=jT(this._previewEditorLayoutInfo).read(h);if(!g)return;let f=this._editorBackgroundColor.read(h),v=u.read(h),b=HJ(this._tabAction).map(K=>`${dH}px solid ${Tt(K)}`),S=`${dH+v}px solid ${f}`,y=g.read(h).codeScrollLeft!==0,w=g.map(K=>K.codeRect.bottom<K.editRect.bottom),x=j4*2+dH*2,E=g.map(K=>ap.fromLeftTopRightBottom(K.contentLeft-j4-dH,K.codeRect.top,K.contentLeft,K.codeRect.bottom+x)).read(h),M=new gi(E.left,Number.MAX_SAFE_INTEGER),N=g.map(K=>K.codeRect.intersectHorizontal(M)),V=N.map(K=>K.withMargin(v,0,v,v).intersectHorizontal(M)),H=N.map(K=>ap.fromLeftTopWidthHeight(K.right-x+dH,K.bottom-dH,x,x).intersectHorizontal(M));return[$o.div({class:"originalSeparatorSideBySide",style:{...V.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${j4}px 0 0 ${j4}px`,borderTop:S,borderBottom:S,borderLeft:y?"none":S}}),$o.div({class:"originalOverlaySideBySide",style:{...N.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${j4}px 0 0 ${j4}px`,borderTop:b,borderBottom:b,borderLeft:y?"none":b,backgroundColor:Tt(VJ)}}),$o.div({class:"originalCornerCutoutSideBySide",style:{pointerEvents:"none",display:w.map(K=>K?"block":"none"),...H.read(h).toStyles()}},[$o.div({class:"originalCornerCutoutBackground",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",backgroundColor:qb(VJ,this._themeService).map(K=>K.toString())}}),$o.div({class:"originalCornerCutoutBorder",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box",borderTop:b,borderRight:b,borderRadius:"0 100% 0 0",backgroundColor:f}})]),$o.div({class:"originalOverlaySideBySideHider",style:{...E.toStyles(),backgroundColor:f}})]})).keepUpdated(this._store),this._modifiedOverlay=$o.div({style:{pointerEvents:"none"}},ke(this,h=>{let g=jT(this._previewEditorLayoutInfo).read(h);if(!g)return;let f=g.map(N=>N.codeRect.bottom<N.editRect.bottom),v=this._editorBackgroundColor.read(h),b=u.read(h),S=f.map(N=>`0 ${j4}px ${j4}px ${N?j4:0}px`),y=qb(G4(this._tabAction),this._themeService).map(N=>`1px solid ${N.toString()}`),w=`${dH+b}px solid ${v}`,x=g.map(N=>N.editRect.withMargin(0,dH)),E=x.map(N=>N.withMargin(b,b,b,0)),M=ke(this,N=>{let V=x.read(N),H=g.read(N);return!H.isInsertion||H.contentLeft>=V.left?ap.fromLeftTopWidthHeight(V.left,V.top,0,0):new ap(H.contentLeft,V.top,V.left,V.top+dH*2)});return[$o.div({class:"modifiedInsertionSideBySide",style:{...M.read(h).toStyles(),backgroundColor:G4(this._tabAction).map(N=>Tt(N))}}),$o.div({class:"modifiedSeparatorSideBySide",style:{...E.read(h).toStyles(),borderRadius:S,borderTop:w,borderBottom:w,borderRight:w,boxSizing:"border-box"}}),$o.div({class:"modifiedOverlaySideBySide",style:{...x.read(h).toStyles(),borderRadius:S,border:y,boxSizing:"border-box",backgroundColor:Tt(nDt)}})]})).keepUpdated(this._store),this._nonOverflowView=$o.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[this._backgroundSvg,ke(this,h=>this._shouldOverflow.read(h)?[]:[this._editorContainer,this._originalOverlay,this._modifiedOverlay])]).keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:Fo(null),allowEditorOverflow:!1,minContentWidthInPx:ke(this,h=>{let g=this._previewEditorLayoutInfo.read(h)?.maxContentWidth;return g===void 0?0:g})})),this.previewEditor.setModel(this._previewTextModel),this._register(ve(h=>{let g=this._previewEditorLayoutInfo.read(h);if(!g)return;let f=g.editRect.withMargin(-U9e,-FTe);this.previewEditor.layout({height:f.height,width:g.previewEditorWidth+15}),this._editorContainer.element.style.top=`${f.top}px`,this._editorContainer.element.style.left=`${f.left}px`,this._editorContainer.element.style.width=`${g.previewEditorWidth+FTe}px`})),this._register(ve(h=>{let g=this._previewEditorLayoutInfo.read(h);g&&this._previewEditorObs.editor.setScrollLeft(g.desiredPreviewEditorScrollLeft)})),this._updatePreviewEditor.recomputeInitiallyAndOnChange(this._store)}static fitsInsideViewport(e,t,o,n){let r=Ds(e),s=r.layoutInfoWidth.read(n),l=r.layoutInfoContentLeft.read(n),c=e.getLayoutInfo().verticalScrollbarWidth,u=r.layoutInfoMinimap.read(n).minimapLeft!==0?r.layoutInfoMinimap.read(n).minimapWidth:0,p=KA(r,o.displayRange,void 0),h=o.lineEdit.newLines.reduce((v,b)=>Math.max(v,F9e(b,e,t)),0),g=efi,f=Foo+2*dH;return p+h+g+f<s-l-c-u}};Bue=I([m(5,F),m(6,Pe),m(7,ET)],Bue);var dDt=class{constructor(i,e,t){this.edit=i;this.editorType=e;this.alternativeAction=t}equals(i){return this.edit.equals(i.edit)&&this.alternativeAction===i.alternativeAction}},oE=1,Woo="word-replacement-view-overlay",Voo="word-replacement-view-widget",Boo="word-replacement-view-replacement",tfi="word-replacement-view-rename",Q4=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._viewData=t;this._tabAction=o;this._languageService=n;this._themeService=r;this._keybindingService=s;this._hoverService=l;this._userInteractionService=c;this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this._start=this._editor.observePosition(Fo(this._viewData.edit.range.getStartPosition()),this._store),this._end=this._editor.observePosition(Fo(this._viewData.edit.range.getEndPosition()),this._store),this._line=document.createElement("div"),this._primaryElement=De(this,null),this._secondaryElement=De(this,null),this.isHovered=ke(this,g=>{let f=this._primaryElement.read(g);return f?this._userInteractionService.createHoverTracker(f.element,g.store).read(g):!1}),this._renderTextEffect=ke(this,g=>{let f=this._editor.model.read(void 0);if(!f)return;let v=f.getLineContent(this._viewData.edit.range.startLineNumber),b=xd.replace(new gi(this._viewData.edit.range.startColumn-1,this._viewData.edit.range.endColumn-1),this._viewData.edit.text),S=b.replace(v),y=f.tokenization.tokenizeLinesAt(this._viewData.edit.range.startLineNumber,[S])?.[0],w;y?w=LB.fromLineTokens(y).slice(b.getRangeAfterReplace()).toLineTokens(this._viewData.edit.text,this._languageService.languageIdCodec):w=Cd.createEmpty(this._viewData.edit.text,this._languageService.languageIdCodec);let x=oM(new AT([w]),NT.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],this._line,!0);this._line.style.width=`${x.minWidthInPx}px`});let u=this._editor.observeLineHeightForPosition(this._viewData.edit.range.getStartPosition()),p=x4e(this._viewData.alternativeAction?.count??new Promise(g=>g(void 0))).map(g=>g.value),h=ke(this,g=>this._userInteractionService.readModifierKeyStatus(this._editor.editor.getDomNode(),g).shiftKey);this._layout=ke(this,g=>{this._renderTextEffect.read(g);let f=this._start.read(g),v=this._end.read(g);if(!f||!v||f.x>v.x||f.y>v.y)return;let b=u.read(g);if(b<=0)return;let S=this._editor.scrollLeft.read(g),y=this._editor.getOption(59).read(g).typicalHalfwidthCharacterWidth,w=3*y,x=4,E=new Mg(w,x),M;if(this._viewData.alternativeAction){let j=this._viewData.alternativeAction.label,J=p.read(g),se=h.read(g),ae=J!==void 0?J===1?d(1392,null,j):d(1393,null,j,J):j,ce=d(1394,null,"[shift]");M={label:J!==void 0&&se?ae:j,tooltip:ae?`${ae}
${ce}`:void 0,icon:void 0,count:J,keybinding:this._keybindingService.lookupKeybinding(Zde),active:h}}let N=ap.fromPoints(f,v).withHeight(b).translateX(-S),V=ap.fromPointSize(N.getLeftBottom().add(E),new Mg(this._viewData.edit.text.length*y,N.height)),H=V.withWidth(V.width+(M?M.label.length*y+8+4+12:0)),K=H.withLeft(N.left);return{alternativeAction:M,originalLine:N,codeLine:V,modifiedLine:H,lowerBackground:K,lineHeight:b}}),this.minEditorScrollHeight=ke(this,g=>{let f=jT(this._layout).read(g);return f?f.read(g).modifiedLine.bottom+oE+this._editor.editor.getScrollTop():0}),this._root=$o.div({class:"word-replacement"},[ke(this,g=>{let f=jT(this._layout).read(g);if(!f)return[];let v=HJ(this._tabAction).map(J=>Tt(J)).read(g),b=G4(this._tabAction).map(J=>Tt(J)).read(g);this._line.style.lineHeight=`${f.read(g).modifiedLine.height+2*oE}px`;let S=Fo(!1),y=f.map(J=>J.alternativeAction),w=ke(J=>(y.read(J)?.active.read(J)??!1)||S.read(J)),E=vi(this._themeService.onDidColorThemeChange,()=>{let J=this._themeService.getColorTheme();return J.type==="hcDark"||J.type==="hcLight"}).read(g)?WJ(Ei,this._themeService).read(g):null,M={borderColor:E?E.toString():b,backgroundColor:Tt(Ioo),color:"",opacity:"1"},N={borderColor:E?E.toString():Tt(b0),backgroundColor:Tt(S2),color:Tt(BJ),opacity:"1"},V={borderColor:E?E.toString():WJ(rX,this._themeService).map(J=>J.transparent(.2).toString()).read(g),backgroundColor:VD(this._viewData.editorType),color:"",opacity:"0.7"},H=VD(this._viewData.editorType),K=ke(this,J=>(w.read(J),M)),j=ke(this,J=>w.read(J)?N:V);return[$o.div({id:Woo,style:{position:"absolute",...jb(J=>xTe(this._editor).read(J)),overflow:"hidden",pointerEvents:"none"}},[$o.div({style:{position:"absolute",...jb(J=>f.read(J).lowerBackground.withMargin(oE,2*oE,oE,0)),background:H,cursor:"pointer",pointerEvents:"auto"},onmousedown:J=>this._mouseDown(J)}),$o.div({id:Voo,style:{position:"absolute",...jb(J=>f.read(J).modifiedLine.withMargin(oE,2*oE)),width:void 0,pointerEvents:"auto",boxSizing:"border-box",borderRadius:`${$b}px`,background:H,display:"flex",justifyContent:"left",outline:`2px solid ${H}`},onmousedown:J=>this._mouseDown(J)},[$o.div({id:Boo,style:{fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),width:jb(J=>f.read(J).codeLine.withMargin(oE,2*oE)).width,borderRadius:`${$b}px`,border:K.map(J=>`${oE}px solid ${J.borderColor}`),boxSizing:"border-box",padding:`${oE}px`,opacity:K.map(J=>J.opacity),background:K.map(J=>J.backgroundColor),display:"flex",justifyContent:"left",alignItems:"center",pointerEvents:"auto",cursor:"pointer"},obsRef:J=>{this._primaryElement.set(J,void 0)}},[this._line]),ke(this,J=>{let se=y.read(J);if(!se)return;let ae=document.createElement("div");return J.store.add(new ah(ae,Ao,{...HQe,disableTitle:!0})).set(se.keybinding),$o.div({id:tfi,style:{position:"relative",borderRadius:`${$b}px`,borderTop:`${oE}px solid`,borderRight:`${oE}px solid`,borderBottom:`${oE}px solid`,borderLeft:`${oE}px solid`,borderColor:j.map(Se=>Se.borderColor),opacity:j.map(Se=>Se.opacity),color:j.map(Se=>Se.color),display:"flex",justifyContent:"center",alignItems:"center",padding:"0 4px 0 1px",marginLeft:"4px",background:j.map(Se=>Se.backgroundColor),cursor:"pointer",textWrap:"nowrap"},class:"inline-edit-alternative-action-label",obsRef:Se=>{this._secondaryElement.set(Se,void 0)},ref:Se=>{se.tooltip&&J.store.add(this._hoverService.setupDelayedHoverAtMouse(Se,{content:se.tooltip,appearance:{compact:!0}}))}},[ae,_("div.inline-edit-alternative-action-label-separator"),se.icon?un(se.icon):void 0,se.label])})]),$o.div({style:{position:"absolute",...jb(J=>f.read(J).originalLine.withMargin(oE)),boxSizing:"border-box",borderRadius:`${$b}px`,border:`${oE}px solid ${v}`,background:Tt(boo),pointerEvents:"none"}},[]),$o.svg({width:11,height:14,viewBox:"0 0 11 14",fill:"none",style:{position:"absolute",left:f.map(J=>J.modifiedLine.left-16),top:f.map(J=>J.modifiedLine.top+Math.round((J.lineHeight-14-5)/2)),pointerEvents:"none"},onmousedown:J=>this._mouseDown(J)},[$o.svgElem("path",{d:"M1 0C1 2.98966 1 5.92087 1 8.49952C1 9.60409 1.89543 10.5 3 10.5H10.5",stroke:Tt(rX)}),$o.svgElem("path",{d:"M6 7.5L9.99999 10.49998L6 13.5",stroke:Tt(rX)})])])]})]).keepUpdated(this._store),this._register(this._editor.createOverlayWidget({domNode:this._root.element,minContentWidthInPx:Fo(0),position:Fo({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}static{this.MAX_LENGTH=100}_mouseDown(e){let t=wQo(e.target,new Set([Voo,Boo,tfi,Woo]));t&&(e.preventDefault(),this._onDidClick.fire(bM.create(e,t===tfi)))}};Q4=I([m(3,Rt),m(4,Pe),m(5,Le),m(6,ot),m(7,ET)],Q4);function wQo(a,i){let e=a;for(;e;){if(i.has(e.id))return e.id;e=e.parentElement}return null}var uDt=class extends k{constructor(e,t,o){super();this._originalEditor=e;this._state=t;this._modifiedTextModel=o;this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this.isHovered=Ds(this._originalEditor).isTargetHovered(r=>r.target.type===6&&r.target.detail.injectedText?.options.attachedData instanceof z9e&&r.target.detail.injectedText.options.attachedData.owner===this,this._store),this._tokenizationFinished=xQo(this._modifiedTextModel),this._decorations=ke(this,r=>{let s=this._state.read(r);if(!s)return;let l=s.modifiedText,c=s.mode==="insertionInline",u=s.diff.length===1&&s.diff[0].innerChanges?.length===1,p=!0,h=[],g=[],f=So.register({className:"inlineCompletions-line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),v=So.register({className:"inlineCompletions-line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),b=So.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),S=So.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),y=So.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),w=So.register({className:"inlineCompletions-char-insert diff-range-empty",description:"char-insert diff-range-empty"}),x=So.register({className:"inlineCompletions-original-lines",description:"inlineCompletions-original-lines",isWholeLine:!1,shouldFillLineOnLineBreak:!0}),E=s.mode!=="sideBySide"&&s.mode!=="deletion"&&s.mode!=="insertionInline"&&s.mode!=="lineReplacement",M=s.mode==="lineReplacement";for(let N of s.diff)if(E&&(N.original.isEmpty||h.push({range:N.original.toInclusiveRange(),options:v}),N.modified.isEmpty||g.push({range:N.modified.toInclusiveRange(),options:f})),N.modified.isEmpty||N.original.isEmpty)N.original.isEmpty||h.push({range:N.original.toInclusiveRange(),options:b}),N.modified.isEmpty||g.push({range:N.modified.toInclusiveRange(),options:S});else{let V=c&&Hoo(N);for(let H of N.innerChanges||[]){if(N.original.contains(H.originalRange.startLineNumber)&&!(M&&H.originalRange.isEmpty())){let K=this._originalEditor.getModel()?.getValueInRange(H.originalRange,1);h.push({range:H.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:kTe("inlineCompletions-char-delete",H.originalRange.isSingleLine()&&s.mode==="insertionInline"&&"single-line-inline",H.originalRange.isEmpty()&&"empty",(H.originalRange.isEmpty()&&u||s.mode==="deletion"&&K===`
`)&&p&&!V&&"diff-range-empty"),inlineClassName:V?kTe("strike-through","inlineCompletions"):null,zIndex:1}})}if(N.modified.contains(H.modifiedRange.startLineNumber)&&g.push({range:H.modifiedRange,options:H.modifiedRange.isEmpty()&&p&&!V&&u?w:y}),V){let K=l.getValueOfRange(H.modifiedRange),j=K.length>3?[{text:K.slice(0,1),extraClasses:["start"],offsetRange:new gi(H.modifiedRange.startColumn-1,H.modifiedRange.startColumn)},{text:K.slice(1,-1),extraClasses:[],offsetRange:new gi(H.modifiedRange.startColumn,H.modifiedRange.endColumn-2)},{text:K.slice(-1),extraClasses:["end"],offsetRange:new gi(H.modifiedRange.endColumn-2,H.modifiedRange.endColumn-1)}]:[{text:K,extraClasses:["start","end"],offsetRange:new gi(H.modifiedRange.startColumn-1,H.modifiedRange.endColumn)}];this._tokenizationFinished.read(r);let J=this._modifiedTextModel.tokenization.getLineTokens(H.modifiedRange.startLineNumber);for(let{text:se,extraClasses:ae,offsetRange:ce}of j)h.push({range:G.fromPositions(H.originalRange.getEndPosition()),options:{description:"inserted-text",before:{tokens:J.getTokensInRange(ce),content:se,inlineClassName:kTe("inlineCompletions-char-insert",H.modifiedRange.isSingleLine()&&s.mode==="insertionInline"&&"single-line-inline",...ae),cursorStops:3,attachedData:new z9e(this)},zIndex:2,showIfCollapsed:!0}})}}}if(s.editorType==="diffEditor")for(let N of s.diff)N.original.isEmpty||h.push({range:N.original.toExclusiveRange(),options:x});return{originalDecorations:h,modifiedDecorations:g}}),this._register(Ds(this._originalEditor).setDecorations(this._decorations.map(r=>r?.originalDecorations??[])));let n=this._state.map(r=>r?.modifiedCodeEditor);this._register(Rl((r,s)=>{let l=n.read(r);l&&s.add(Ds(l).setDecorations(this._decorations.map(c=>c?.modifiedDecorations??[])))})),this._register(this._originalEditor.onMouseUp(r=>{if(r.target.type!==6)return;let s=r.target.detail.injectedText?.options.attachedData;s instanceof z9e&&s.owner===this&&this._onDidClick.fire(new bM(r.event))}))}static supportsInlineDiffRendering(e){return Hoo(e)}},z9e=class{constructor(i){this.owner=i}};function Hoo(a){return a.innerChanges?a.innerChanges.every(i=>vQe(i.modifiedRange)&&vQe(i.originalRange)):!1}var CQo=0;function xQo(a){return vi(a.onDidChangeTokens,()=>CQo++)}var WTe=class extends k{constructor(e,t,o,n,r,s){super();this._editor=e;this._model=t;this._simpleModel=o;this._inlineSuggestInfo=n;this._showCollapsed=r;this._instantiationService=s;this._tabAction=ke(e=>this._model.read(e)?.tabAction.read(e)??"inactive");this.displayRange=ke(this,e=>{let t=this._uiState.read(e);if(t&&t.target.uri.toString()===this._editorObs.model.read(e)?.uri.toString()){if(t.state?.kind==="custom"){let o=t.state.displayLocation?.range;if(!o)throw new ci("custom view should have a range");return new vo(o.startLineNumber,o.endLineNumber)}return t.state?.kind==="insertionMultiLine"?this._insertion.originalLines.read(e):t.edit.displayRange}});this._currentInlineEditCache=void 0;this._uiState=ke(this,e=>{let t=this._model.read(e),o=this._editorObs.model.read(e);if(!t||!o||!this._constructorDone.read(e))return;let n=t.inlineEdit,r,s,l;n.edit?(s=lf.fromEdit(n.edit),l=new _I(n.edit.apply(n.originalText)),r=bCe(s,n.originalText,l)):(s=[],r=[],l=n.originalText);let c=this._determineRenderState(t,e,r,l);if(!c){mt(new Error(`unable to determine view: tried to render ${this._previousView?.view}`));return}let u=this._getLongDistanceHintState(t,e);if(u&&u.isVisible&&c.viewData.setLongDistanceViewData(u.lineNumber,n.lineEdit.lineRange.startLineNumber),c.kind==="sideBySide"){let g=Doo(l.getValue(),n.modifiedLineRange,o.getOptions().tabSize);l=new _I(g.applyToString(l.getValue())),s=_oo(s,g),r=bCe(s,n.originalText,l)}this._previewTextModel.setLanguage(o.getLanguageId());let p=this._previewTextModel.getValue();if(p!==l.getValue()){this._previewTextModel.setEOL(o.getEndOfLineSequence());let f=Ad.replace(new gi(0,p.length),l.getValue()).removeCommonSuffixPrefix(p),v=Mue(this._previewTextModel).getTextEdit(f);this._previewTextModel.edit(v)}this._showCollapsed.read(e)&&(c={kind:"collapsed",viewData:c.viewData}),t.handleInlineEditShownNextFrame(c.kind,c.viewData);let h=n.action?.kind==="jumpTo"?n.action.position:null;return{state:c,diff:r,edit:n,newText:l.getValue(),newTextLineCount:n.modifiedLineRange.length,editorType:t.editorType,longDistanceHint:u,nextCursorPosition:h,target:n.inlineCompletion.originalTextRef}});this.inlineEditsIsHovered=ke(this,e=>this._sideBySide.isHovered.read(e)||this._wordReplacementViews.read(e).some(t=>t.isHovered.read(e))||this._deletion.isHovered.read(e)||this._inlineDiffView.isHovered.read(e)||this._lineReplacementView.isHovered.read(e)||this._insertion.isHovered.read(e)||this._customView.isHovered.read(e)||this._longDistanceHint.map((t,o)=>t?.isHovered.read(o)??!1).read(e));this.gutterIndicatorOffset=ke(this,e=>this._uiState.read(e)?.state?.kind==="insertionMultiLine"?this._insertion.startLineOffset.read(e):0);this._editorObs=Ds(this._editor),this._constructorDone=De(this,!1),this._previewTextModel=this._register(this._instantiationService.createInstance(Tp,"",this._editor.getModel().getLanguageId(),{...Tp.DEFAULT_CREATION_OPTIONS,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},null)),this._sideBySide=this._register(this._instantiationService.createInstance(Bue,this._editor,this._model.map(p=>p?.inlineEdit),this._previewTextModel,this._uiState.map(p=>p&&p.state?.kind==="sideBySide"?{newTextLineCount:p.newTextLineCount,editorType:p.editorType}:void 0),this._tabAction)),this._deletion=this._register(this._instantiationService.createInstance(cDt,this._editor,this._model.map(p=>p?.inlineEdit),this._uiState.map(p=>p&&p.state?.kind==="deletion"?{originalRange:p.state.originalRange,deletions:p.state.deletions,editorType:p.editorType}:void 0),this._tabAction)),this._insertion=this._register(this._instantiationService.createInstance(PTe,this._editor,this._uiState.map(p=>p&&p.state?.kind==="insertionMultiLine"?{lineNumber:p.state.lineNumber,startColumn:p.state.column,text:p.state.text,editorType:p.editorType}:void 0),this._tabAction)),this._inlineCollapsedView=this._register(this._instantiationService.createInstance(LTe,this._editor,this._model.map((p,h)=>this._uiState.read(h)?.state?.kind==="collapsed"?p?.inlineEdit:void 0))),this._customView=this._register(this._instantiationService.createInstance(MTe,this._editor,this._model.map((p,h)=>this._uiState.read(h)?.state?.kind==="custom"?p?.displayLocation:void 0),this._tabAction,this._uiState.map(p=>p?.editorType??"textEditor"))),this._showLongDistanceHint=this._editorObs.getOption(71).map(this,p=>p.edits.showLongDistanceHint),this._longDistanceHint=ke(this,p=>{if(this._showLongDistanceHint.read(p))return p.store.add(this._instantiationService.createInstance(OTe,this._editor,this._uiState.map((h,g)=>h?.longDistanceHint?{hint:h.longDistanceHint,newTextLineCount:h.newTextLineCount,edit:h.edit,diff:h.diff,editorType:h.editorType,model:this._simpleModel.read(g),inlineSuggestInfo:this._inlineSuggestInfo.read(g),nextCursorPosition:h.nextCursorPosition,target:h.target}:void 0),this._previewTextModel,this._tabAction))}).recomputeInitiallyAndOnChange(this._store),this._inlineDiffViewState=ke(this,p=>{let h=this._uiState.read(p);if(!(!h||!h.state)&&!(h.state.kind==="wordReplacements"||h.state.kind==="insertionMultiLine"||h.state.kind==="collapsed"||h.state.kind==="custom"||h.state.kind==="jumpTo"))return{modifiedText:new _I(h.newText),diff:h.diff,mode:h.state.kind,modifiedCodeEditor:this._sideBySide.previewEditor,editorType:h.editorType}}),this._inlineDiffView=this._register(new uDt(this._editor,this._inlineDiffViewState,this._previewTextModel)),this._jumpToView=this._register(this._instantiationService.createInstance(zJ,this._editorObs,{style:"label"},ke(p=>{let h=this._uiState.read(p);if(h?.state?.kind==="jumpTo")return{jumpToPosition:h.state.position}})));let l=Js({equalsFn:Sbt.arrayC(Sbt.thisC())},p=>{let h=this._uiState.read(p);return h?.state?.kind==="wordReplacements"?h.state.replacements.map(g=>new dDt(g,h.editorType,h.state?.alternativeAction)):[]});this._wordReplacementViews=Pb(this,l,(p,h)=>h.add(this._instantiationService.createInstance(Q4,this._editorObs,p,this._tabAction))),this._lineReplacementView=this._register(this._instantiationService.createInstance(ATe,this._editorObs,this._uiState.map(p=>p?.state?.kind==="lineReplacement"?{originalRange:p.state.originalRange,modifiedRange:p.state.modifiedRange,modifiedLines:p.state.modifiedLines,replacements:p.state.replacements}:void 0),this._uiState.map(p=>p?.editorType??"textEditor"),this._tabAction)),this._useCodeShifting=this._editorObs.getOption(71).map(p=>p.edits.allowCodeShifting),this._renderSideBySide=this._editorObs.getOption(71).map(p=>p.edits.renderSideBySide),this._register(ve(p=>{let h=this._model.read(p);h&&p.store.add(U.any(this._sideBySide.onDidClick,this._lineReplacementView.onDidClick,this._insertion.onDidClick,...this._wordReplacementViews.read(p).map(g=>g.onDidClick),this._inlineDiffView.onDidClick,this._customView.onDidClick)(g=>{this._viewHasBeenShownLongerThan(350)&&(g.event.preventDefault(),h.accept(g.alternativeAction))}))})),this._wordReplacementViews.recomputeInitiallyAndOnChange(this._store);let c=ke(this,p=>Math.max(...this._wordReplacementViews.read(p).map(h=>h.minEditorScrollHeight.read(p)),this._lineReplacementView.minEditorScrollHeight.read(p),this._customView.minEditorScrollHeight.read(p))).recomputeInitiallyAndOnChange(this._store),u;this._register(ve(p=>{let h=c.read(p),g=this._editorObs.model.read(p);g&&this._editor.changeViewZones(f=>{let v=this._editor.getScrollHeight(),b=h-v+1;b!==0&&u!==void 0&&(f.removeZone(u),u=void 0),!(b<=0)&&(u=f.addZone({afterLineNumber:g.getLineCount(),heightInPx:b,domNode:_("div.minScrollHeightViewZone")}))})})),this._constructorDone.set(!0,void 0)}_getLongDistanceHintState(e,t){if(!e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t)&&e.inlineEdit.action!==void 0)return e.inlineEdit.originalText.uri.toString()!==this._editorObs.model.read(t)?.uri.toString()?{isVisible:!0,lineNumber:e.inlineEdit.cursorPosition.lineNumber}:(this._currentInlineEditCache?.inlineSuggestionIdentity!==e.inlineEdit.inlineCompletion.identity&&(this._currentInlineEditCache={inlineSuggestionIdentity:e.inlineEdit.inlineCompletion.identity,firstCursorLineNumber:e.inlineEdit.cursorPosition.lineNumber}),{lineNumber:this._currentInlineEditCache.firstCursorLineNumber,isVisible:!e.inViewPort.read(t)})}_getCacheId(e){return e.inlineEdit.inlineCompletion.identity.id}_determineView(e,t,o,n){let r=e.inlineEdit,s=this._previousView?.id===this._getCacheId(e)&&this._previousView?.uri.toString()===this._editorObs.model.get().uri.toString(),l=this._previousView?.editorWidth!==this._editorObs.layoutInfoWidth.read(t)&&(this._previousView?.view==="sideBySide"||this._previousView?.view==="lineReplacement");if(s&&!l)return this._previousView.view;let c=e.inlineEdit.inlineCompletion.action;if(c?.kind==="edit"&&c.alternativeAction)return"wordReplacements";let u=e.inlineEdit.inlineCompletion.originalTextRef.uri,p=this._editorObs.model.read(t)?.uri;if(p&&u.toString()!==p.toString())return"custom";if(e.displayLocation&&!e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t))return"custom";let h=r.originalLineRange.length,g=r.modifiedLineRange.length,f=o.flatMap(b=>b.innerChanges??[]),v=f.length===1;if(e.editorType!=="diffEditor"){if(v&&this._useCodeShifting.read(t)!=="never"&&qoo(o))return EQo(o,r.cursorPosition)?"insertionInline":"lineReplacement";if(zoo(f,r,n))return"deletion";if(Uoo(o)&&this._useCodeShifting.read(t)==="always")return"insertionMultiLine";if(f.every(S=>Rc.ofRange(S.originalRange).columnCount<Q4.MAX_LENGTH&&Rc.ofRange(S.modifiedRange).columnCount<Q4.MAX_LENGTH)&&v&&h===1&&g===1){let S=f.map(w=>n.getValueOfRange(w.modifiedRange)),y=f.map(w=>e.inlineEdit.originalText.getValueOfRange(w.originalRange));if(!S.some(w=>w.includes("	"))&&!y.some(w=>w.includes("	"))&&(!f.some(w=>w.originalRange.isEmpty())||!Koo(f.map(w=>new ys(w.originalRange,"")),r.originalText).some(w=>w.range.isEmpty()&&Rc.ofRange(w.range).columnCount<Q4.MAX_LENGTH)))return"wordReplacements"}}if(h>0&&g>0)return h===1&&g===1&&e.editorType!=="diffEditor"?"lineReplacement":this._renderSideBySide.read(t)!=="never"&&Bue.fitsInsideViewport(this._editor,this._previewTextModel,r,t)?"sideBySide":"lineReplacement";if(e.editorType==="diffEditor"){if(zoo(f,r,n))return"deletion";if(Uoo(o)&&this._useCodeShifting.read(t)==="always")return"insertionMultiLine"}return"sideBySide"}_determineRenderState(e,t,o,n){if(e.inlineEdit.action?.kind==="jumpTo")return{kind:"jumpTo",position:e.inlineEdit.action.position,viewData:Goo};let r=e.inlineEdit,s=this._determineView(e,t,o,n);if(this._willRenderAboveCursor(t,r,s))switch(s){case"lineReplacement":case"wordReplacements":s="sideBySide";break}this._previousView={id:this._getCacheId(e),view:s,editorWidth:this._editor.getLayoutInfo().width,timestamp:Date.now(),uri:this._editorObs.model.get().uri};let l=o.flatMap(g=>g.innerChanges??[]),c=this._editor.getModel(),u=l.map(g=>({originalRange:g.originalRange,modifiedRange:g.modifiedRange,original:r.originalText.getValueOfRange(g.originalRange),modified:n.getValueOfRange(g.modifiedRange)})),p=kQo(r,u,c);switch(s){case"insertionInline":return{kind:"insertionInline",viewData:p};case"sideBySide":return{kind:"sideBySide",viewData:p};case"collapsed":return{kind:"collapsed",viewData:p};case"custom":return{kind:"custom",displayLocation:e.displayLocation,viewData:p}}if(s==="deletion")return{kind:"deletion",originalRange:r.originalLineRange,deletions:l.map(g=>g.originalRange),viewData:p};if(s==="insertionMultiLine"){let g=l[0];return{kind:"insertionMultiLine",lineNumber:g.originalRange.startLineNumber,column:g.originalRange.startColumn,text:n.getValueOfRange(g.modifiedRange),viewData:p}}let h=u.map(g=>new ys(g.originalRange,g.modified));if(h.length!==0){if(s==="wordReplacements"){let g=TQo(h,r.originalText);return g.some(f=>f.range.isEmpty())&&(g=Koo(h,r.originalText)),{kind:"wordReplacements",replacements:g,alternativeAction:e.inlineEdit.action?.alternativeAction,viewData:p}}if(s==="lineReplacement")return{kind:"lineReplacement",originalRange:r.originalLineRange,modifiedRange:r.modifiedLineRange,modifiedLines:r.modifiedLineRange.mapToLineArray(g=>n.getLineAt(g)),replacements:l.map(g=>({originalRange:g.originalRange,modifiedRange:g.modifiedRange})),viewData:p}}}_willRenderAboveCursor(e,t,o){if(this._useCodeShifting.read(e)==="always")return!1;for(let r of t.multiCursorPositions)if(o==="wordReplacements"&&r.lineNumber===t.originalLineRange.startLineNumber+1||o==="lineReplacement"&&r.lineNumber>=t.originalLineRange.endLineNumberExclusive&&r.lineNumber<t.modifiedLineRange.endLineNumberExclusive+t.modifiedLineRange.length)return!0;return!1}_viewHasBeenShownLongerThan(e){let t=this._previousView?.timestamp;if(!t)throw new ci("viewHasBeenShownLongThan called before a view has been shown");return Date.now()-t>=e}};WTe=I([m(5,F)],WTe);var Goo=new Pue(-1,-1,-1,-1,-1,-1,-1,!0);function kQo(a,i,e){if(!a.edit)return Goo;let t=a.cursorPosition,o=i.length===0?!1:i[0].modified.startsWith(e.getEOL());return new Pue(a.edit.replacements.length===0?0:a.edit.replacements[0].range.getStartPosition().column-t.column,a.lineEdit.lineRange.startLineNumber-t.lineNumber+(o&&a.lineEdit.lineRange.startLineNumber>=t.lineNumber?1:0),a.lineEdit.lineRange.length,a.lineEdit.newLines.length,i.reduce((r,s)=>r+s.original.length,0),i.reduce((r,s)=>r+s.modified.length,0),i.length,i.every(r=>r.original===i[0].original&&r.modified===i[0].modified))}function qoo(a){return a.every(e=>e.innerChanges.every(t=>i(t)));function i(e){return!(!e.originalRange.isEmpty()||!(e.modifiedRange.startLineNumber===e.modifiedRange.endLineNumber))}}function EQo(a,i){if(!i||!qoo(a))return!1;let e=i;return a.every(o=>o.innerChanges.every(n=>t(n)));function t(o){let n=o.originalRange.getStartPosition();return!!(e.isBeforeOrEqual(n)||n.lineNumber<e.lineNumber)}}function Uoo(a){let i=a.flatMap(t=>t.innerChanges??[]);if(i.length!==1)return!1;let e=i[0];return!(!e.originalRange.isEmpty()||e.modifiedRange.startLineNumber===e.modifiedRange.endLineNumber)}function zoo(a,i,e){return a.map(o=>({original:i.originalText.getValueOfRange(o.originalRange),modified:e.getValueOfRange(o.modifiedRange)})).every(({original:o,modified:n})=>n.trim()===""&&o.length>0&&(o.length>n.length||o.trim()!==""))}function TQo(a,i){return $oo(a,i,e=>/^[a-zA-Z]$/.test(e))}function Koo(a,i){return $oo(a,i,e=>!/^\s$/.test(e))}function $oo(a,i,e){let t=[];a.sort((n,r)=>G.compareRangesUsingStarts(n.range,r.range));for(let n of a){let r=n.range.startColumn-1,s=n.range.endColumn-2,l="",c="",u=i.getLineAt(n.range.startLineNumber),p=i.getLineAt(n.range.endLineNumber);if(o(u[r]))for(;o(u[r-1]);)l=u[r-1]+l,r--;if(o(p[s])||s<r)for(;o(p[s+1]);)c+=p[s+1],s++;let h=new ys(new G(n.range.startLineNumber,r+1,n.range.endLineNumber,s+2),l+n.text+c);t.length>0&&G.areIntersectingOrTouching(t[t.length-1].range,h.range)&&(h=ys.joinReplacements([t.pop(),h],i)),t.push(h)}function o(n){return n===void 0?!1:e(n)}return t}var VTe=class extends k{constructor(e,t,o,n){super();this._editor=e;this._model=t;this._showCollapsed=o;this._inlineEdit=ke(this,e=>{let t=this._model.read(e);if(!t||!this._editor.getModel())return;let n=t.inlineEditState.read(e);if(!n)return;let r=n.inlineSuggestion.action,s;if(r?.kind==="edit"){let l=r.stringEdit,c=n.inlineSuggestion.originalTextRef.getTransformer(),u=l.replacements.map(p=>{let h=G.fromPositions(c.getPosition(p.replaceRange.start),c.getPosition(p.replaceRange.endExclusive));return new ys(h,p.newText)});s=new lm(u)}else s=void 0;return new rDt(n.inlineSuggestion.originalTextRef,r,s,t.primaryPosition.read(void 0),t.allPositions.read(void 0),n.inlineSuggestion.source.inlineSuggestions.commands??[],n.inlineSuggestion)});this._inlineEditModel=ke(this,e=>{let t=this._model.read(e);if(!t)return;let o=this._inlineEdit.read(e);if(!o)return;let n=ke(this,r=>{if(this._editorObs.isFocused.read(r)){if(t.tabShouldJumpToInlineEdit.read(r))return"jump";if(t.tabShouldAcceptInlineEdit.read(r))return"accept"}return"inactive"});return new sDt(t,o,n)});this._editorObs=Ds(this._editor),this.view=this._register(n.createInstance(WTe,this._editor,this._inlineEditModel,this._model.map(r=>r?DTe.fromInlineCompletionModel(r):void 0),this._inlineEdit.map(r=>r?_Te.fromInlineSuggestion(r.inlineCompletion):void 0),this._showCollapsed))}};VTe=I([m(3,F)],VTe);var BTe=class extends k{constructor(e,t,o,n){super();this._editor=e;this._model=t;this._focusIsInMenu=o;this._instantiationService=n;this._ghostTexts=ke(this,e=>this._model.read(e)?.ghostTexts.read(e)??[]);this._inlineEdit=ke(this,e=>this._model.read(e)?.inlineEditState.read(e)?.inlineSuggestion);this._everHadInlineEdit=mv(this,(e,t)=>t||!!this._inlineEdit.read(e)||!!this._model.read(e)?.inlineCompletionState.read(e)?.inlineSuggestion?.showInlineEditMenu);this._indicatorIsHoverVisible=De(this,void 0);this._showInlineEditCollapsed=ke(this,e=>(this._model.read(e)?.showCollapsed.read(e)??!1)&&!this._indicatorIsHoverVisible.read(e)?.read(e));this._inlineEditWidget=Ry(e=>{if(this._everHadInlineEdit.read(e))return this._instantiationService.createInstance(VTe,this._editor,this._model,this._showInlineEditCollapsed)});this._gutterIndicatorState=ke(e=>{let t=this._model.read(e);if(!t)return;let o=t.state.read(e);if(o?.kind==="ghostText"&&o.inlineSuggestion?.showInlineEditMenu)return{displayRange:vo.ofLength(o.primaryGhostText.lineNumber,1),tabAction:ke(this,n=>this._editorObs.isFocused.read(n)?"accept":"inactive"),gutterIndicatorOffset:Fo(_Qo(o.inlineSuggestion,this._editor)),inlineSuggestion:o.inlineSuggestion,model:t};if(o?.kind==="inlineEdit"){let n=this._inlineEditWidget.read(e)?.view;if(!n)return;let r=n.displayRange.read(e);return r?{displayRange:r,tabAction:ke(s=>{if(this._editorObs.isFocused.read(s)){if(t.tabShouldJumpToInlineEdit.read(s))return"jump";if(t.tabShouldAcceptInlineEdit.read(s))return"accept"}return"inactive"}),gutterIndicatorOffset:n.gutterIndicatorOffset,inlineSuggestion:o.inlineSuggestion,model:t}:void 0}else return});this._stablizedGhostTexts=jio(this._ghostTexts,this._store),this._editorObs=Ds(this._editor),this._ghostTextWidgets=Pb(this,this._stablizedGhostTexts,(r,s)=>s.add(this._createGhostText(r))).recomputeInitiallyAndOnChange(this._store),this._inlineEditWidget.recomputeInitiallyAndOnChange(this._store),this._fontFamily=this._editorObs.getOption(71).map(r=>r.fontFamily),this._register(R9i(ke(r=>`
.monaco-editor .ghost-text-decoration,
.monaco-editor .ghost-text-decoration-preview,
.monaco-editor .ghost-text {
	font-family: ${this._fontFamily.read(r)};
}`))),this._register(new hEe(this._editor,this._model,this._instantiationService)),this._indicator=this._register(this._instantiationService.createInstance(UJ,this._editorObs,ke(r=>{let s=this._gutterIndicatorState.read(r);if(s)return new TTe(_Te.fromInlineSuggestion(s.inlineSuggestion),s.displayRange,DTe.fromInlineCompletionModel(s.model),s.inlineSuggestion.action?.kind==="edit"?s.inlineSuggestion.action.alternativeAction:void 0)}),this._gutterIndicatorState.map((r,s)=>r?.tabAction?.read(s)??"inactive"),this._gutterIndicatorState.map((r,s)=>r?.gutterIndicatorOffset?.read(s)??0),this._inlineEditWidget.map((r,s)=>r?.view.inlineEditsIsHovered.read(s)??!1),this._focusIsInMenu)),this._indicatorIsHoverVisible.set(this._indicator.isHoverVisible,void 0),ke(r=>{let s=this._inlineEditWidget.read(r);if(s)return r.store.add(this._instantiationService.createInstance(RTe,s._inlineEditModel,Fo(this._indicator),s.view._inlineCollapsedView))}).recomputeInitiallyAndOnChange(this._store)}static{this.hot=TK(this)}_createGhostText(e){return this._instantiationService.createInstance(b2,this._editor,ke(t=>{let o=this._model.read(t),n=o?.inlineCompletionState.read(t)?.inlineSuggestion;return!o||!n?{ghostText:e.read(t),handleInlineCompletionShown:()=>{},warning:void 0}:{ghostText:e.read(t),handleInlineCompletionShown:r=>o.handleInlineSuggestionShown(n,"ghostText",r,Date.now()),warning:eDt.from(o?.warning.read(t))}}),{useSyntaxHighlighting:this._editorObs.getOption(71).map(t=>t.syntaxHighlightingEnabled),highlightShortSuggestions:!0})}shouldShowHoverAtViewZone(e){return this._ghostTextWidgets.get()[0]?.ownsViewZone(e)??!1}};BTe=I([m(3,F)],BTe);function _Qo(a,i){let e=a.getSingleTextEdit(),t=i.getModel();if(!t)return 0;let o=t.getEOL();if(e.range.isEmpty()&&e.text.startsWith(o)){let n=i.getLineHeightForPosition(e.range.getStartPosition());return DQo(e.text,o)*n}return 0}function DQo(a,i){if(!i.length)return 0;let e=0,t=0;for(;a.startsWith(i,t);)e++,t+=i.length;return e}coo(a=>cd.get(a));var cd=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editor=e;this._instantiationService=t;this._contextKeyService=o;this._configurationService=n;this._commandService=r;this._debounceService=s;this._languageFeaturesService=l;this._accessibilitySignalService=c;this._keybindingService=u;this._accessibilityService=p;this._enabled=ke(this,e=>this._enabledInConfig.read(e)&&(!this._isScreenReaderEnabled.read(e)||!this._editorDictationInProgress.read(e)));this._focusIsInMenu=De(this,!1);this._focusIsInEditorOrMenu=ke(this,e=>{let t=this._editorObs.isFocused.read(e),o=this._focusIsInMenu.read(e);return t||o});this._cursorIsInIndentation=ke(this,e=>{let t=this._editorObs.cursorPosition.read(e);if(t===null)return!1;let o=this._editorObs.model.read(e);if(!o)return!1;this._editorObs.versionId.read(e);let n=o.getLineIndentColumn(t.lineNumber);return t.column<=n});this.model=Ry(this,e=>{if(this._editorObs.isReadonly.read(e))return;let t=this._editorObs.model.read(e);return t?this._instantiationService.createInstance(dTe,t,this._suggestWidgetAdapter.selectedItem,this._editorObs.versionId,this._positions,this._debounceValue,this._enabled,this.editor):void 0});this._playAccessibilitySignal=zc(this);this._view=ke(e=>e.store.add(this._instantiationService.createInstance(BTe.hot.read(e),this.editor,this.model,this._focusIsInMenu)));this._editorObs=Ds(this.editor),this._positions=ke(this,b=>this._editorObs.selections.read(b)?.map(S=>S.getEndPosition())??[new ye(1,1)]),this._suggestWidgetAdapter=this._register(new X_t(this._editorObs,b=>this.model.get()?.handleSuggestAccepted(b),()=>this.model.get()?.selectedInlineCompletion.get()?.getSingleTextEdit())),this._enabledInConfig=vi(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).enabled),this._isScreenReaderEnabled=vi(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=vi(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model.recomputeInitiallyAndOnChange(this._store),this._hideInlineEditOnSelectionChange=this._editorObs.getOption(71).map(b=>!0),this._view.recomputeInitiallyAndOnChange(this._store),cd._instances.add(this),this._register(ee(()=>cd._instances.delete(this))),this._register(ve(b=>{let S=this.model.read(b);if(!S)return;let y=S.state.read(b);if(!y||!this._focusIsInEditorOrMenu.read(void 0))return;let w=y.kind==="inlineEdit"?y.nextEditUri:void 0;for(let x of cd._instances)x!==this&&(w&&ze(w,x.editor.getModel()?.uri)?x.model.read(void 0)?.trigger():x.reject())})),this._register(ve(b=>{let S=this.model.read(b),y=this.editor.getModel()?.uri;!S||!y||b.store.add(S.onDidAccept(()=>{for(let w of cd._instances){if(w===this)continue;let x=w.model.read(void 0)?.state.read(void 0);x?.kind==="inlineEdit"&&ze(x.nextEditUri,y)&&w.model.read(void 0)?.stop("automatic")}}))})),this._register(Zs(this._editorObs.onDidType,(b,S)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(Zs(this._editorObs.onDidPaste,(b,S)=>{this._enabled.get()&&this.model.get()?.trigger()}));let h=new Set([VL.Tab.id,VL.DeleteLeft.id,VL.DeleteRight.id,qK,"acceptSelectedSuggestion",Rue.ID,d9e.ID,zd.NextMatchFindAction,gue.ID,V6e.ID,B6e.ID,H6e.ID,...Hwe.getRegisteredCommands()]);this._register(this._commandService.onDidExecuteCommand(b=>{if(h.has(b.commandId)&&e.hasTextFocus()&&this._enabled.get()){let S=!1;b.commandId===qK&&(S=!0),this._editorObs.forceUpdate(y=>{this.model.get()?.trigger(y,{noDelay:S})})}})),this._register(Zs(this._editorObs.selections,(b,S,y)=>{if(y.some(w=>w.reason===3||w.source==="api")){if(!this._hideInlineEditOnSelectionChange.get()&&this.model.get()?.state.get()?.kind==="inlineEdit")return;let w=this.model.get();if(!w)return;w.state.get()?.kind==="ghostText"&&this.model.get()?.stop()}})),this._register(ve(b=>{let S=this._focusIsInEditorOrMenu.read(b),y=this.model.read(void 0);if(S){let w=y?.state.read(void 0);(!w||w.kind!=="inlineEdit"||!w.nextEditUri)&&Ki(x=>{for(let E of cd._instances)E!==this&&E.model.read(void 0)?.stop("automatic",x)});return}this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(71).keepOnBlur||dM.dropDownVisible||y&&(y.state.read(void 0)?.inlineSuggestion?.isFromExplicitRequest&&y.inlineEditAvailable.read(void 0)||Ki(w=>{y.stop("automatic",w)}))})),this._register(ve(b=>{let S=this.model.read(b)?.inlineCompletionState.read(b);S?.suggestItem?S.primaryGhostText.lineCount>=2&&this._suggestWidgetAdapter.forceRenderingAbove():this._suggestWidgetAdapter.stopForceRenderingAbove()})),this._register(ee(()=>{this._suggestWidgetAdapter.stopForceRenderingAbove()}));let g=mv(this,(b,S)=>{let w=this.model.read(b)?.state.read(b);return this._suggestWidgetAdapter.selectedItem.get()?S:w?.inlineSuggestion?.semanticId});this._register(Tbt(ke(b=>(this._playAccessibilitySignal.read(b),g.read(b),{})),async(b,S,y,w)=>{let x=this.model.get(),E=x?.state.get();if(!E||!x||(await Li(50,wz(w)),await yh(this._suggestWidgetAdapter.selectedItem,bn,()=>!1,wz(w)),x=this.model.get(),E=x?.state.get(),!E||!x))return;let M=E.kind==="ghostText"?x.textModel.getLineContent(E.primaryGhostText.lineNumber):"";this._accessibilitySignalService.playSignal(E.kind==="ghostText"?tn.inlineSuggestion:tn.nextEditSuggestion),this.editor.getOption(12)&&(E.kind==="ghostText"?this._provideScreenReaderUpdate(E.primaryGhostText.renderForScreenReader(M)):this._provideScreenReaderUpdate(""))})),this._register(this._configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")});let f=new T_t(this._contextKeyService);this._register(f.bind(Za.cursorInIndentation,this._cursorIsInIndentation)),this._register(f.bind(Za.hasSelection,b=>!this._editorObs.cursorSelection.read(b)?.isEmpty())),this._register(f.bind(Za.cursorAtInlineEdit,this.model.map((b,S)=>b?.inlineEditState?.read(S)?.cursorAtInlineEdit.read(S)))),this._register(f.bind(Za.tabShouldAcceptInlineEdit,this.model.map((b,S)=>!!b?.tabShouldAcceptInlineEdit.read(S)))),this._register(f.bind(Za.tabShouldJumpToInlineEdit,this.model.map((b,S)=>!!b?.tabShouldJumpToInlineEdit.read(S)))),this._register(f.bind(Za.inlineEditVisible,b=>this.model.read(b)?.inlineEditState.read(b)!==void 0)),this._register(f.bind(Za.inlineSuggestionHasIndentation,b=>this.model.read(b)?.getIndentationInfo(b)?.startsWithIndentation)),this._register(f.bind(Za.inlineSuggestionHasIndentationLessThanTabSize,b=>this.model.read(b)?.getIndentationInfo(b)?.startsWithIndentationLessThanTabSize)),this._register(f.bind(Za.suppressSuggestions,b=>{let y=this.model.read(b)?.inlineCompletionState.read(b);return y?.primaryGhostText&&y?.inlineSuggestion?y.inlineSuggestion.source.inlineSuggestions.suppressSuggestions:void 0})),this._register(f.bind(Za.inlineSuggestionAlternativeActionVisible,b=>{let w=this.model.read(b)?.inlineEditState.read(b)?.inlineSuggestion.action;return w&&w.kind==="edit"&&w.alternativeAction!==void 0})),this._register(f.bind(Za.inlineSuggestionVisible,b=>{let y=this.model.read(b)?.inlineCompletionState.read(b);return!!y?.inlineSuggestion&&y?.primaryGhostText!==void 0&&!y?.primaryGhostText.isEmpty()}));let v=ke(this,b=>{let w=this.model.read(b)?.inlineCompletionState.read(b)?.primaryGhostText;return!w||w.isEmpty()?void 0:new ye(w.lineNumber,w.parts[0].column)});this._register(f.bind(Za.cursorBeforeGhostText,b=>{let S=v.read(b);if(!S)return!1;let y=this._editorObs.cursorPosition.read(b);return y?S.equals(y):!1})),this._register(this._instantiationService.createInstance(nTe,this.editor))}static{this._instances=new Set}static{this.hot=TK(this)}static{this.ID="editor.contrib.inlineCompletionsController"}static getInFocusedEditorOrParent(e){let t=DEe(e);return t?cd.get(t):null}static get(e){return Lio(e.getContribution(cd.ID))}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){let t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),o=this._keybindingService.lookupKeybinding("editor.action.accessibleView"),n;!t&&o&&this.editor.getOption(169)&&(n=d(1377,null,o.getAriaLabel())),cn(n?e+", "+n:e)}shouldShowHoverAt(e){let t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(o=>e.containsPosition(new ye(t.lineNumber,o.column))):!1}shouldShowHoverAtViewZone(e){return this._view.get().shouldShowHoverAtViewZone(e)}reject(){Ki(e=>{let t=this.model.get();if(t&&(t.stop("explicitCancel",e),this._focusIsInEditorOrMenu.get()))for(let o of cd._instances)o!==this&&!o._focusIsInEditorOrMenu.get()&&o.model.get()?.stop("automatic",e)})}jump(){let e=this.model.get();e&&e.jump()}};cd=I([m(1,F),m(2,X),m(3,B),m(4,fe),m(5,Gf),m(6,Jt),m(7,br),m(8,Le),m(9,Ai)],cd);var pDt=class a extends Mi{static{this.ID=wEt}constructor(){super({id:a.ID,label:P(1355,"Show Next Inline Suggestion"),precondition:C.and(me.writable,Za.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(i,e){cd.get(e)?.model.get()?.next()}},mDt=class a extends Mi{static{this.ID=yEt}constructor(){super({id:a.ID,label:P(1356,"Show Previous Inline Suggestion"),precondition:C.and(me.writable,Za.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(i,e){cd.get(e)?.model.get()?.previous()}},ifi="vscode://schemas/inlineCompletionProviderIdArgs";function ofi(a){let i=[];return a.providerId&&(i.push(a.providerId.toStringWithoutVersion()),i.push(a.providerId.extensionId+":*")),i}var joo=Oio(Nio({showNoResultNotification:n9e(Ehi()),providerId:n9e(Fio(ifi,Mio())),explicit:n9e(Ehi()),changeHintData:n9e(Pio())}),Aio()),hDt=class extends Mi{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:P(1358,"Trigger Inline Suggestion"),precondition:me.writable,metadata:{description:d(1360,null),args:[{name:"args",description:d(1359,null),isOptional:!0,schema:joo.getJSONSchema()}]}})}async run(i,e,t){let o=i.get(Ne),n=i.get(Jt),r=cd.get(e),s=joo.validateOrThrow(t),l=s?.providerId?n.inlineCompletionsProvider.all(e.getModel()).find(c=>ofi(c).some(u=>u===s.providerId)):void 0;await Jii(async c=>{await r?.model.get()?.trigger(c,{provider:l,explicit:s?.explicit??!0,changeHint:s?.changeHintData?{data:s.changeHintData}:void 0}),r?.playAccessibilitySignal(c)}),s?.showNoResultNotification&&(r?.model.get()?.state.get()||o.notify({severity:ft.Info,message:d(1362,null)}))}},gDt=class extends Mi{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:P(1350,"Accept Next Word Of Inline Suggestion"),precondition:C.and(me.writable,Za.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:C.and(me.writable,Za.inlineSuggestionVisible,Za.cursorBeforeGhostText,Oa.negate())},menuOpts:[{menuId:R.InlineSuggestionToolbar,title:d(1346,null),group:"primary",order:2}]})}async run(i,e){await cd.get(e)?.model.get()?.acceptNextWord()}},fDt=class extends Mi{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:P(1349,"Accept Next Line Of Inline Suggestion"),precondition:C.and(me.writable,Za.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:R.InlineSuggestionToolbar,title:d(1345,null),group:"secondary",order:2}]})}async run(i,e){await cd.get(e)?.model.get()?.acceptNextLine()}},vDt=class extends Mi{constructor(){super({id:qK,label:P(1347,"Accept Inline Suggestion"),precondition:C.or(Za.inlineSuggestionVisible,Za.inlineEditVisible),menuOpts:[{menuId:R.InlineSuggestionToolbar,title:d(1344,null),group:"primary",order:2},{menuId:R.InlineEditsActions,title:d(1344,null),group:"primary",order:2}],kbOpts:[{primary:2,weight:200,kbExpr:C.or(C.and(Za.inlineSuggestionVisible,me.tabMovesFocus.toNegated(),ar.Visible.toNegated(),me.hoverFocused.toNegated(),Za.hasSelection.toNegated(),Za.inlineSuggestionHasIndentationLessThanTabSize),C.and(Za.inlineEditVisible,me.tabMovesFocus.toNegated(),ar.Visible.toNegated(),me.hoverFocused.toNegated(),Za.tabShouldAcceptInlineEdit))}]})}async run(i,e){let t=cd.getInFocusedEditorOrParent(i);t&&(t.model.get()?.accept(t.editor),t.editor.focus())}};xt.registerKeybindingRule({id:qK,weight:202,primary:2,when:C.and(Za.inInlineEditsPreviewEditor)});var bDt=class extends Mi{constructor(){super({id:Zde,label:P(1348,"Accept Inline Suggestion Alternative Action"),precondition:C.and(Za.inlineSuggestionAlternativeActionVisible,Za.inlineEditVisible),menuOpts:[],kbOpts:[{primary:1026,weight:203}]})}async run(i,e){let t=cd.getInFocusedEditorOrParent(i);t&&(t.model.get()?.accept(t.editor,!0),t.editor.focus())}};xt.registerKeybindingRule({id:Zde,weight:203,primary:1026,when:C.and(Za.inInlineEditsPreviewEditor)});var SDt=class extends Mi{constructor(){super({id:CEt,label:P(1354,"Jump to next inline edit"),precondition:Za.inlineEditVisible,menuOpts:[{menuId:R.InlineEditsActions,title:d(1361,null),group:"primary",order:1,when:Za.cursorAtInlineEdit.toNegated()}],kbOpts:{primary:2,weight:201,kbExpr:C.and(Za.inlineEditVisible,me.tabMovesFocus.toNegated(),ar.Visible.toNegated(),me.hoverFocused.toNegated(),Za.tabShouldJumpToInlineEdit)}})}async run(i,e){let t=cd.get(e);t&&t.jump()}},K9e=class a extends Mi{static{this.ID=xEt}constructor(){super({id:a.ID,label:P(1353,"Hide Inline Suggestion"),precondition:C.or(Za.inlineSuggestionVisible,Za.inlineEditVisible),kbOpts:{kbExpr:me.editorTextFocus,weight:190,primary:9},menuOpts:[{menuId:R.InlineEditsActions,title:d(1363,null),group:"primary",order:3}]})}async run(i,e){let t=cd.getInFocusedEditorOrParent(i);Ki(o=>{t?.model.get()?.stop("explicitCancel",o)}),t?.editor.focus()}},IDt=class a extends Mi{static{this.ID=JQe}constructor(){super({id:a.ID,label:P(1357,"Toggle Inline Suggestions Show Collapsed"),precondition:C.true()})}async run(i,e){let t=i.get(B),o=t.getValue("editor.inlineSuggest.edits.showCollapsed");t.updateValue("editor.inlineSuggest.edits.showCollapsed",!o)}};xt.registerKeybindingRule({id:K9e.ID,weight:-1,primary:9,secondary:[1033],when:C.and(Za.inInlineEditsPreviewEditor)});var yDt=class a extends z{static{this.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar"}constructor(){super({id:a.ID,title:d(1351,null),f1:!1,precondition:void 0,menu:[{id:R.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:C.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(i){let e=i.get(B),o=e.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";e.updateValue("editor.inlineSuggest.showToolbar",o)}},wDt=class extends Mi{constructor(){super({id:"editor.action.inlineSuggest.dev.extractRepro",label:d(1352,null),alias:"Developer: Inline Suggest Extract Repro",precondition:C.or(Za.inlineEditVisible,Za.inlineSuggestionVisible)})}async run(i,e){let t=i.get(Bi),n=cd.get(e)?.model.get();if(!n)return;let r=n.extractReproSample(),l=Hc(JSON.stringify({inlineCompletion:r.inlineCompletion},null,4)).map(u=>"// "+u).join(`
`),c=`${r.documentValue}

// <json>
${l}
// </json>
`;return await t.writeText(c),{reproCase:c}}};var nfi=class{constructor(i,e,t){this.owner=i;this.range=e;this.controller=t}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}},HTe=class{constructor(i,e,t,o,n){this._editor=i;this.accessibilityService=e;this._instantiationService=t;this._telemetryService=o;this._markdownRendererService=n;this.hoverOrdinal=4}suggestHoverAnchor(i){let e=cd.get(this._editor);if(!e)return null;let t=i.target;if(t.type===8){let o=t.detail;if(e.shouldShowHoverAtViewZone(o.viewZoneId))return new I4(1e3,this,G.fromPositions(this._editor.getModel().validatePosition(o.positionBefore||o.position)),i.event.posx,i.event.posy,!1)}if(t.type===7&&e.shouldShowHoverAt(t.range))return new I4(1e3,this,t.range,i.event.posx,i.event.posy,!1);if(t.type===6&&t.detail.mightBeForeignElement&&e.shouldShowHoverAt(t.range))return new I4(1e3,this,t.range,i.event.posx,i.event.posy,!1);if(t.type===9&&t.element){let o=b2.getWarningWidgetContext(t.element);if(o&&e.shouldShowHoverAt(o.range))return new I4(1e3,this,o.range,i.event.posx,i.event.posy,!1)}return null}computeSync(i,e){if(this._editor.getOption(71).showToolbar!=="onHover")return[];let t=cd.get(this._editor);return t&&t.shouldShowHoverAt(i.range)?[new nfi(this,i.range,t)]:[]}renderHoverParts(i,e){let t=new O,o=e[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(12)&&t.add(this.renderScreenReaderText(i,o));let n=o.controller.model.get(),r=document.createElement("div");i.fragment.appendChild(r),t.add(Rl((l,c)=>{let u=c.add(this._instantiationService.createInstance(dM.hot.read(l),this._editor,!1,Fo(null),n.selectedInlineCompletionIndex,n.inlineCompletionsCount,n.activeCommands,n.warning,()=>{i.onContentsChanged()}));r.replaceChildren(u.getDomNode())})),n.triggerExplicitly();let s={hoverPart:o,hoverElement:r,dispose(){t.dispose()}};return new Yk([s])}getAccessibleContent(i){return d(1378,null)}renderScreenReaderText(i,e){let t=new O,o=_,n=o("div.hover-row.markdown-hover"),r=D(n,o("div.hover-contents",{"aria-live":"assertive"})),s=l=>{let c=d(1379,null),u=t.add(this._markdownRendererService.render(new he().appendText(c).appendCodeblock("text",l),{context:this._editor,asyncRenderCallback:()=>{r.className="hover-contents code-hover-contents",i.onContentsChanged()}}));r.replaceChildren(u.element)};return t.add(ve(l=>{let c=e.controller.model.read(l)?.primaryGhostText.read(l);if(c){let u=this._editor.getModel().getLineContent(c.lineNumber);s(c.renderForScreenReader(u))}else Ii(r)})),i.fragment.appendChild(n),t}};HTe=I([m(1,Ai),m(2,F),m(3,_e),m(4,_n)],HTe);var Kd=le("accessibleViewService");var qp=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.id=e;this.options=t;this.provideContent=o;this.onClose=n;this.verbositySettingKey=r;this.onOpen=s;this.actions=l;this.provideNextContent=c;this.providePreviousContent=u;this.onDidChangeContent=p;this.onKeyDown=h;this.getSymbols=g;this.onDidRequestClearLastProvider=f}};function CDt(a){if(!a||typeof a!="object")return!1;let i=a;return!!i.id&&!!i.options&&typeof i.provideContent=="function"&&typeof i.onClose=="function"&&typeof i.verbositySettingKey=="string"}var KJ=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.id=e;this.options=t;this.provideContent=o;this.onClose=n;this.onOpen=r;this.provideNextContent=s;this.providePreviousContent=l;this.actions=c;this.onDidChangeContent=u}};var xDt=class{constructor(){this.type="view";this.priority=95;this.name="inline-completions";this.when=C.or(Za.inlineSuggestionVisible,Za.inlineEditVisible)}getProvider(i){let e=i.get(Qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=cd.get(t)?.model.get();if(o?.state.get())return new rfi(t,o)}},rfi=class extends k{constructor(e,t){super();this._editor=e;this._model=t;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this.id="inlineCompletions";this.verbositySettingKey="accessibility.verbosity.inlineCompletions";this.options={language:this._editor.getModel()?.getLanguageId()??void 0,type:"view"}}provideContent(){let e=this._model.state.get();if(!e)throw new Error("Inline completion is visible but state is not available");if(e.kind==="ghostText"){let t=this._model.textModel.getLineContent(e.primaryGhostText.lineNumber),o=e.primaryGhostText.renderForScreenReader(t);if(!o)throw new Error("Inline completion is visible but ghost text is not available");return t+o}else{let t=new aM(this._model.textModel);return q5.fromTextEdit(new lm(e.edits),t).humanReadablePatch(t.getLines())}}provideNextContent(){this._model.next().then((()=>this._onDidChangeContent.fire()))}providePreviousContent(){this._model.previous().then((()=>this._onDidChangeContent.fire()))}onClose(){this._model.stop(),this._editor.focus()}};Eo(cd.ID,p_t(cd.hot),3);ri(hDt);ri(pDt);ri(mDt);ri(gDt);ri(fDt);ri(vDt);ri(bDt);ri(IDt);ri(K9e);ri(SDt);W(yDt);ri(wDt);W(U_t);W(z_t);PD.register(HTe);_a.register(new xDt);var BD=class{constructor(i,e,t,o){this.textModelResolverService=e;this.languageService=t;this.languageFeaturesService=o;this.toUnhook=new O;this.toUnhookForKeyboard=new O;this.currentWordAtPosition=null;this.previousPromise=null;this.editor=i,this.linkDecorations=this.editor.createDecorationsCollection();let n=new i0(i);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown(([r,s])=>{this.startFindDefinitionFromMouse(r,s??void 0)})),this.toUnhook.add(n.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(s=>{mt(s)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(n.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static{this.ID="editor.contrib.gotodefinitionatposition"}static{this.MAX_SOURCE_PREVIEW_LINES=8}static get(i){return i.getContribution(BD.ID)}async startFindDefinitionFromCursor(i){await this.startFindDefinition(i),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(e=>{e&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(i,e){if(i.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(i,e)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}let t=i.target.position;this.startFindDefinition(t)}async startFindDefinition(i){this.toUnhookForKeyboard.clear();let e=i?this.editor.getModel()?.getWordAtPosition(i):null;if(!e){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===e.startColumn&&this.currentWordAtPosition.endColumn===e.endColumn&&this.currentWordAtPosition.word===e.word)return;this.currentWordAtPosition=e;let t=new BK(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Hn(r=>this.findDefinition(i,r));let o;try{o=await this.previousPromise}catch(r){mt(r);return}if(!o||!o.length||!t.validate(this.editor)){this.removeLinkDecorations();return}let n=o[0].originSelectionRange?G.lift(o[0].originSelectionRange):new G(i.lineNumber,e.startColumn,i.lineNumber,e.endColumn);if(o.length>1){let r=n;for(let{originSelectionRange:s}of o)s&&(r=G.plusRange(r,s));this.addDecoration(r,new he().appendText(d(1247,null,o.length)))}else{let r=o[0];return r.uri?this.textModelResolverService.createModelReference(r.uri).then(s=>{if(!s.object||!s.object.textEditorModel){s.dispose();return}let{object:{textEditorModel:l}}=s,{startLineNumber:c}=r.range;if(c<1||c>l.getLineCount()){s.dispose();return}let u=this.getPreviewValue(l,c,r),p=this.languageService.guessLanguageIdByFilepathOrFirstLine(l.uri);this.addDecoration(n,u?new he().appendCodeblock(p||"",u):void 0),s.dispose()}):void 0}}getPreviewValue(i,e,t){let o=t.range;return o.endLineNumber-o.startLineNumber>=BD.MAX_SOURCE_PREVIEW_LINES&&(o=this.getPreviewRangeBasedOnIndentation(i,e)),o=i.validateRange(o),this.stripIndentationFromPreviewRange(i,e,o)}stripIndentationFromPreviewRange(i,e,t){let n=i.getLineFirstNonWhitespaceColumn(e);for(let s=e+1;s<t.endLineNumber;s++){let l=i.getLineFirstNonWhitespaceColumn(s);n=Math.min(n,l)}return i.getValueInRange(t).replace(new RegExp(`^\\s{${n-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(i,e){let t=i.getLineFirstNonWhitespaceColumn(e),o=Math.min(i.getLineCount(),e+BD.MAX_SOURCE_PREVIEW_LINES),n=e+1;for(;n<o;n++){let r=i.getLineFirstNonWhitespaceColumn(n);if(t===r)break}return new G(e,1,n+1,1)}addDecoration(i,e){let t={range:i,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:e}};this.linkDecorations.set([t])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(i,e){return this.editor.hasModel()&&i.isLeftClick&&i.isNoneOrSingleMouseDown&&i.target.type===6&&!(i.target.detail.injectedText?.options instanceof kK)&&(i.hasTriggerModifier||(e?e.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(i,e){let t=this.editor.getModel();return t?d0(this.languageFeaturesService.definitionProvider,t,i,!1,e):Promise.resolve(null)}async gotoDefinition(i,e){return this.editor.setPosition(i),this.editor.invokeWithinContext(t=>{let o=!e&&this.editor.getOption(101)&&!this.isInPeekEditor(t);return new nH({openToSide:e,openInPeek:o,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)})}isInPeekEditor(i){let e=i.get(X);return Fg.inPeekEditor.getValue(e)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};BD=I([m(1,Bt),m(2,Rt),m(3,Jt)],BD);Eo(BD.ID,BD,2);var UTe=class extends k{constructor(e,t,o){super();this._editor=e;this._markerService=o;this._ctxHasDiagnostics=me.selectionHasDiagnostics.bindTo(t),this._store.add(this._editor.onDidChangeCursorSelection(()=>this._update())),this._store.add(this._editor.onDidChangeModel(()=>this._update())),this._store.add(this._markerService.onMarkerChanged(n=>{let r=this._editor.getModel();r&&n.some(s=>ze(s,r.uri))&&this._update()})),this._update()}static{this.ID="editor.contrib.markerSelectionStatus"}dispose(){this._ctxHasDiagnostics.reset(),super.dispose()}_update(){let e=this._editor.getModel(),t=this._editor.getSelection();if(!e||!t){this._ctxHasDiagnostics.reset();return}let n=this._markerService.read({resource:e.uri,severities:14}).some(r=>G.areIntersecting({startLineNumber:r.startLineNumber,startColumn:r.startColumn,endLineNumber:r.endLineNumber,endColumn:r.endColumn},t));this._ctxHasDiagnostics.set(n)}};UTe=I([m(1,X),m(2,ha)],UTe);Eo(UTe.ID,UTe,1);var sfi=class extends Mi{constructor(){super({id:"editor.action.debugEditorGpuRenderer",label:P(1269,"Developer: Debug Editor GPU Renderer"),precondition:C.true()})}async run(i,e){let t=i.get(F),n=await i.get($e).pick([{label:d(1270,null),id:"logTextureAtlasStats"},{label:d(1271,null),id:"saveTextureAtlas"},{label:d(1268,null),id:"drawGlyph"}],{canPickMany:!1});if(n)switch(n.id){case"logTextureAtlasStats":t.invokeFunction(r=>{let s=r.get(re),l=Pc.atlas;if(!Pc.atlas){s.error("No texture atlas found");return}let c=l.getStats();s.info(["Texture atlas stats",...c].join(`

`))});break;case"saveTextureAtlas":t.invokeFunction(async r=>{let s=r.get(Ae),l=r.get(ge),c=s.getWorkspace().folders;if(c.length>0){let u=Pc.atlas,p=[];for(let[h,g]of u.pages.entries())p.push(l.writeFile(A.joinPath(c[0].uri,`textureAtlasPage${h}_actual.png`),Ke.wrap(new Uint8Array(await(await g.source.convertToBlob()).arrayBuffer()))),l.writeFile(A.joinPath(c[0].uri,`textureAtlasPage${h}_usage.png`),Ke.wrap(new Uint8Array(await(await g.getUsagePreview()).arrayBuffer()))));await Promise.all(p)}});break;case"drawGlyph":t.invokeFunction(async r=>{let s=r.get(B),l=r.get(ge),c=r.get($e),p=r.get(Ae).getWorkspace().folders;if(p.length===0)return;let h=Pc.atlas,g=s.getValue("editor.fontFamily"),f=s.getValue("editor.fontSize"),v=new uK(f,g,zi().devicePixelRatio,Pc.decorationStyleCache),b=await c.input({prompt:"Enter a character to draw (prefix with 0x for code point))"});if(!b)return;let S=b.match(/0x(?<codePoint>[0-9a-f]+)/i)?.groups?.codePoint;S!==void 0&&(b=String.fromCodePoint(parseInt(S,16)));let y=0,x=h.getGlyph(v,b,y,0,0);if(!x)return;let E=h.pages[x.pageIndex].source.getContext("2d")?.getImageData(x.x,x.y,x.w,x.h);if(!E)return;let M=new OffscreenCanvas(E.width,E.height);VF(M.getContext("2d")).putImageData(E,0,0);let V=await M.convertToBlob({type:"image/png"}),H=A.joinPath(p[0].uri,`glyph_${b}_${y}_${f}px_${g.replaceAll(/[,\\\/\.'\s]/g,"_")}.png`);await l.writeFile(H,Ke.wrap(new Uint8Array(await V.arrayBuffer())))});break}}};ri(sfi);var Qoo=(t=>(t.NoAutoFocus="noAutoFocus",t.FocusIfVisible="focusIfVisible",t.AutoFocusImmediately="autoFocusImmediately",t))(Qoo||{}),kDt=class extends Mi{constructor(){super({id:IEt,label:P(1298,"Show or Focus Hover"),metadata:{description:P(1302,"Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:["noAutoFocus","focusIfVisible","autoFocusImmediately"],enumDescriptions:[d(1301,null),d(1300,null),d(1299,null)],default:"focusIfVisible"}}}}]},precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2087),weight:100}})}run(i,e,t){if(!e.hasModel())return;let o=ql.get(e);if(!o)return;let n=t?.focus,r="focusIfVisible";Object.values(Qoo).includes(n)?r=n:typeof n=="boolean"&&n&&(r="autoFocusImmediately");let s=c=>{let u=e.getPosition(),p=new G(u.lineNumber,u.column,u.lineNumber,u.column);o.showContentHover(p,1,2,c)},l=e.getOption(2)===2;o.isHoverVisible?r!=="noAutoFocus"?o.focus():s(l):s(l||r==="autoFocusImmediately")}},EDt=class extends Mi{constructor(){super({id:Zeo,label:P(1296,"Show Definition Preview Hover"),precondition:void 0,metadata:{description:P(1297,"Show the definition preview hover in the editor.")}})}run(i,e){let t=ql.get(e);if(!t)return;let o=e.getPosition();if(!o)return;let n=new G(o.lineNumber,o.column,o.lineNumber,o.column),r=BD.get(e);if(!r)return;r.startFindDefinitionFromCursor(o).then(()=>{t.showContentHover(n,1,2,!0)})}},TDt=class extends Mi{constructor(){super({id:eto,label:P(1283,"Hide Hover"),alias:"Hide Content Hover",precondition:void 0})}run(i,e){ql.get(e)?.hideContentHover()}},_Dt=class extends Mi{constructor(){super({id:tto,label:P(1294,"Scroll Up Hover"),precondition:me.hoverFocused,kbOpts:{kbExpr:me.hoverFocused,primary:16,weight:100},metadata:{description:P(1295,"Scroll up the editor hover.")}})}run(i,e){let t=ql.get(e);t&&t.scrollUp()}},DDt=class extends Mi{constructor(){super({id:ito,label:P(1288,"Scroll Down Hover"),precondition:me.hoverFocused,kbOpts:{kbExpr:me.hoverFocused,primary:18,weight:100},metadata:{description:P(1289,"Scroll down the editor hover.")}})}run(i,e){let t=ql.get(e);t&&t.scrollDown()}},RDt=class extends Mi{constructor(){super({id:oto,label:P(1290,"Scroll Left Hover"),precondition:me.hoverFocused,kbOpts:{kbExpr:me.hoverFocused,primary:15,weight:100},metadata:{description:P(1291,"Scroll left the editor hover.")}})}run(i,e){let t=ql.get(e);t&&t.scrollLeft()}},LDt=class extends Mi{constructor(){super({id:nto,label:P(1292,"Scroll Right Hover"),precondition:me.hoverFocused,kbOpts:{kbExpr:me.hoverFocused,primary:17,weight:100},metadata:{description:P(1293,"Scroll right the editor hover.")}})}run(i,e){let t=ql.get(e);t&&t.scrollRight()}},MDt=class extends Mi{constructor(){super({id:rto,label:P(1286,"Page Up Hover"),precondition:me.hoverFocused,kbOpts:{kbExpr:me.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:P(1287,"Page up the editor hover.")}})}run(i,e){let t=ql.get(e);t&&t.pageUp()}},PDt=class extends Mi{constructor(){super({id:sto,label:P(1284,"Page Down Hover"),precondition:me.hoverFocused,kbOpts:{kbExpr:me.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:P(1285,"Page down the editor hover.")}})}run(i,e){let t=ql.get(e);t&&t.pageDown()}},ADt=class extends Mi{constructor(){super({id:ato,label:P(1281,"Go To Top Hover"),precondition:me.hoverFocused,kbOpts:{kbExpr:me.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:P(1282,"Go to the top of the editor hover.")}})}run(i,e){let t=ql.get(e);t&&t.goToTop()}},NDt=class extends Mi{constructor(){super({id:lto,label:P(1279,"Go To Bottom Hover"),precondition:me.hoverFocused,kbOpts:{kbExpr:me.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:P(1280,"Go to the bottom of the editor hover.")}})}run(i,e){let t=ql.get(e);t&&t.goToBottom()}},ODt=class extends Mi{constructor(){super({id:KK,label:dto,alias:"Increase Hover Verbosity Level",precondition:me.hoverVisible})}run(i,e,t){let o=ql.get(e);if(!o)return;let n=t?.index!==void 0?t.index:o.focusedHoverPartIndex();o.updateHoverVerbosityLevel(0,n,t?.focus)}},FDt=class extends Mi{constructor(){super({id:GK,label:pto,alias:"Decrease Hover Verbosity Level",precondition:me.hoverVisible})}run(i,e,t){let o=ql.get(e);if(!o)return;let n=t?.index!==void 0?t.index:o.focusedHoverPartIndex();ql.get(e)?.updateHoverVerbosityLevel(1,n,t?.focus)}};var WDt=class{constructor(i){this._editor=i}computeSync(i){let e=r=>({value:r}),t=this._editor.getLineDecorations(i.lineNumber),o=[],n=i.laneOrLine==="lineNo";if(!t)return o;for(let r of t){let s=r.options.glyphMargin?.position??2;if(!n&&s!==i.laneOrLine)continue;let l=n?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!l||KB(l)||o.push(...Ec(l).map(e))}return o}};var Yoo=_,GJ=class extends k{constructor(e,t){super();this._markdownRendererService=t;this.allowEditorOverflow=!0;this._renderDisposeables=this._register(new O);this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new XX(!0)),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._hoverOperation=this._register(new fEe(this._editor,new WDt(this._editor))),this._register(this._hoverOperation.onResult(o=>this._withResult(o))),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(59)&&this._updateFont()})),this._register(Yo(this._hover.containerDomNode,"mouseleave",o=>{this._onMouseLeave(o)})),this._editor.addOverlayWidget(this)}static{this.ID="editor.contrib.modesGlyphHoverWidget"}dispose(){this._hoverComputerOptions=void 0,this._editor.removeOverlayWidget(this),super.dispose()}getId(){return GJ.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&this._hoverComputerOptions&&(this._hoverOperation.cancel(),this._hoverOperation.start(0,this._hoverComputerOptions))}showsOrWillShow(e){let t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._hoverComputerOptions&&this._hoverComputerOptions.lineNumber===e&&this._hoverComputerOptions.laneOrLine===t||(this._hoverOperation.cancel(),this.hide(),this._hoverComputerOptions={lineNumber:e,laneOrLine:t},this._hoverOperation.start(0,this._hoverComputerOptions))}hide(){this._hoverComputerOptions=void 0,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e.value,this._messages.length>0?this._renderMessages(e.options.lineNumber,e.options.laneOrLine,this._messages):this.hide()}_renderMessages(e,t,o){this._renderDisposeables.clear();let n=document.createDocumentFragment();for(let r of o){let s=Yoo("div.hover-row.markdown-hover"),l=D(s,Yoo("div.hover-contents")),c=this._renderDisposeables.add(this._markdownRendererService.render(r.value,{context:this._editor}));l.appendChild(c.element),n.appendChild(s)}this._updateContents(n),this._showAt(e,t)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e,t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));let o=this._editor.getLayoutInfo(),n=this._editor.getTopForLineNumber(e),r=this._editor.getScrollTop(),s=this._editor.getOption(75),l=this._hover.containerDomNode.clientHeight,c=n-r-(l-s)/2,u=o.glyphMarginLeft+o.glyphMarginWidth+(t==="lineNo"?o.lineNumbersWidth:0),h=o.height-l,g=Math.max(0,Math.min(Math.round(c),h));if(this._editor.getOption(51)){let v=this._editor.getDomNode();if(v){let b=ur(v);this._hover.containerDomNode.style.position="fixed",this._hover.containerDomNode.style.left=`${b.left+u}px`,this._hover.containerDomNode.style.top=`${b.top+g}px`}}else this._hover.containerDomNode.style.position="absolute",this._hover.containerDomNode.style.left=`${u}px`,this._hover.containerDomNode.style.top=`${g}px`;this._hover.containerDomNode.style.zIndex="11"}_onMouseLeave(e){let t=this._editor.getDomNode();(!t||!hJ(t,e.x,e.y))&&this.hide()}};GJ=I([m(1,_n)],GJ);var VDt=!1,jf=class extends k{constructor(e,t){super();this._editor=e;this._instantiationService=t;this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1;this._listenersStore=new O;this._hoverState={mouseDown:!1};this._reactToEditorMouseMoveRunner=this._register(new Dt(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static{this.ID="editor.contrib.marginHover"}static get(e){return e.getContribution(jf.ID)}_hookListeners(){let e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled!=="off"?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this.hideGlyphHover()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideGlyphHover()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnGlyphHoverWidget(e)&&this.hideGlyphHover()}_isMouseOnGlyphHoverWidget(e){let t=this._glyphWidget?.getDomNode();return t?hJ(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnGlyphHoverWidget(e))||VDt||this.hideGlyphHover()}_shouldNotRecomputeCurrentHoverWidget(e){let t=this._hoverSettings.sticky,o=this._isMouseOnGlyphHoverWidget(e);return t&&o}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){if(!e)return;if(!EEt(this._hoverSettings.enabled,this._editor.getOption(86),e)){if(VDt)return;this.hideGlyphHover();return}this._tryShowHoverWidget(e)||VDt||this.hideGlyphHover()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){if(this._editor.hasModel()){if(this._hoverSettings.enabled==="onKeyboardModifier"&&t6e(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._tryShowHoverWidget(this._mouseMoveEvent);return}eF(e.keyCode)||this.hideGlyphHover()}}hideGlyphHover(){VDt||this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(GJ,this._editor)),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};jf=I([m(1,F)],jf);var afi;(e=>(e.increaseVerbosity=d(1276,null,`<keybinding:${KK}>`),e.decreaseVerbosity=d(1275,null,`<keybinding:${GK}>`)))(afi||={});var BDt=class{constructor(){this.type="view";this.priority=95;this.name="hover";this.when=me.hoverFocused}getProvider(i){let e=i.get(Qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)throw new Error("No active or focused code editor");let o=ql.get(t);if(!o)return;let n=i.get(Le);return i.get(F).createInstance(lfi,n,t,o)}},HDt=class{constructor(){this.priority=100;this.name="hover";this.type="help";this.when=me.hoverVisible}getProvider(i){let e=i.get(Qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)throw new Error("No active or focused code editor");let o=ql.get(t);if(o)return i.get(F).createInstance(zDt,o)}},UDt=class extends k{constructor(e){super();this._hoverController=e;this.id="hover";this.verbositySettingKey="accessibility.verbosity.hover";this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._focusedHoverPartIndex=-1}onOpen(){this._hoverController&&(this._hoverController.shouldKeepOpenOnEditorMouseMoveOrLeave=!0,this._focusedHoverPartIndex=this._hoverController.focusedHoverPartIndex(),this._register(this._hoverController.onHoverContentsChanged(()=>{this._onDidChangeContent.fire()})))}onClose(){this._hoverController&&(this._focusedHoverPartIndex===-1?this._hoverController.focus():this._hoverController.focusHoverPartWithIndex(this._focusedHoverPartIndex),this._focusedHoverPartIndex=-1,this._hoverController.shouldKeepOpenOnEditorMouseMoveOrLeave=!1)}provideContentAtIndex(e,t){if(e!==-1){let o=this._hoverController.getAccessibleWidgetContentAtIndex(e);if(o===void 0)return"";let n=[];return t&&n.push(...this._descriptionsOfVerbosityActionsForIndex(e)),n.push(o),n.join(`
`)}else{let o=this._hoverController.getAccessibleWidgetContent();if(o===void 0)return"";let n=[];return n.push(o),n.join(`
`)}}_descriptionsOfVerbosityActionsForIndex(e){let t=[],o=this._descriptionOfVerbosityActionForIndex(0,e);o!==void 0&&t.push(o);let n=this._descriptionOfVerbosityActionForIndex(1,e);return n!==void 0&&t.push(n),t}_descriptionOfVerbosityActionForIndex(e,t){if(this._hoverController.doesHoverAtIndexSupportVerbosityAction(t,e))switch(e){case 0:return afi.increaseVerbosity;case 1:return afi.decreaseVerbosity}}},zDt=class extends UDt{constructor(e){super(e);this.options={type:"help"}}provideContent(){return this.provideContentAtIndex(this._focusedHoverPartIndex,!0)}},lfi=class extends UDt{constructor(e,t,o){super(o);this._keybindingService=e;this._editor=t;this.options={type:"view"};this._initializeOptions(this._editor,o)}provideContent(){return this.provideContentAtIndex(this._focusedHoverPartIndex,!1)}get actions(){let e=[];return e.push(this._getActionFor(this._editor,0)),e.push(this._getActionFor(this._editor,1)),e}_getActionFor(e,t){let o,n,r;switch(t){case 0:o=KK,n=cto,r=L.add;break;case 1:o=GK,n=uto,r=L.remove;break}let s=Qui(this._keybindingService,t),l=this._hoverController.doesHoverAtIndexSupportVerbosityAction(this._focusedHoverPartIndex,t);return new it(n,s,q.asClassName(r),l,()=>{e.getAction(o)?.run({index:this._focusedHoverPartIndex,focus:!1})})}_initializeOptions(e,t){let o=this._register(new zDt(t));this.options.language=e.getModel()?.getLanguageId(),this.options.customHelp=()=>o.provideContentAtIndex(this._focusedHoverPartIndex,!0)}},KDt=class{constructor(){this.type="view";this.priority=90;this.name="extension-hover"}getProvider(i){let t=i.get(qn).getContextViewElement(),o=t?.textContent??void 0,n=i.get(ot);if(!(t.classList.contains("accessible-view-container")||!o))return new qp("hover",{language:"typescript",type:"view"},()=>o,()=>{n.showAndFocusLastHover()},"accessibility.verbosity.hover")}};Eo(ql.ID,ql,2);Eo(jf.ID,jf,2);ri(kDt);ri(EDt);ri(TDt);ri(_Dt);ri(DDt);ri(RDt);ri(LDt);ri(MDt);ri(PDt);ri(ADt);ri(NDt);ri(ODt);ri(FDt);PD.register(t2);PD.register(zEe);Ge.registerCommand(XQe,a=>{a.get(B).updateValue("editor.hover.showLongLineWarning",!1)});hs((a,i)=>{let e=a.getColor(eK);e&&(i.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${e.transparent(.5)}; }`))});_a.register(new BDt);_a.register(new HDt);_a.register(new KDt);function cfi(a,i,e,t){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return[];let o=i.getLanguageConfiguration(a.getLanguageId()).indentRulesSupport;if(!o)return[];let n=new Sce(a,o,i);for(t=Math.min(t,a.getLineCount());e<=t&&n.shouldIgnore(e);)e++;if(e>t-1)return[];let{tabSize:r,indentSize:s,insertSpaces:l}=a.getOptions(),c=(v,b)=>(b=b||1,Fb.shiftIndent(v,v.length+b,r,s,l)),u=(v,b)=>(b=b||1,Fb.unshiftIndent(v,v.length+b,r,s,l)),p=[],h=a.getLineContent(e),g=Ul(h),f=g;n.shouldIncrease(e)?(f=c(f),g=c(g)):n.shouldIndentNextLine(e)&&(f=c(f)),e++;for(let v=e;v<=t;v++){if(RQo(a,v))continue;let b=a.getLineContent(v),S=Ul(b),y=f;n.shouldDecrease(v,y)&&(f=u(f),g=u(g)),S!==f&&p.push(Qn.replaceMove(new ei(v,1,v,S.length+1),qwe(f,s,l))),!n.shouldIgnore(v)&&(n.shouldIncrease(v,y)?(g=c(g),f=g):n.shouldIndentNextLine(v,y)?f=c(f):f=g)}return p}function RQo(a,i){return a.tokenization.isCheapToTokenize(i)?a.tokenization.getLineTokens(i).getStandardTokenType(0)===2:!1}var G9e=class a extends Mi{static{this.ID="editor.action.indentationToSpaces"}constructor(){super({id:a.ID,label:P(1327,"Convert Indentation to Spaces"),precondition:me.writable,metadata:{description:P(1328,"Convert the tab indentation to spaces.")}})}run(i,e){let t=e.getModel();if(!t)return;let o=t.getOptions(),n=e.getSelection();if(!n)return;let r=new mfi(n,o.tabSize);e.pushUndoStop(),e.executeCommands(this.id,[r]),e.pushUndoStop(),t.updateOptions({insertSpaces:!0})}},q9e=class a extends Mi{static{this.ID="editor.action.indentationToTabs"}constructor(){super({id:a.ID,label:P(1329,"Convert Indentation to Tabs"),precondition:me.writable,metadata:{description:P(1330,"Convert the spaces indentation to tabs.")}})}run(i,e){let t=e.getModel();if(!t)return;let o=t.getOptions(),n=e.getSelection();if(!n)return;let r=new hfi(n,o.tabSize);e.pushUndoStop(),e.executeCommands(this.id,[r]),e.pushUndoStop(),t.updateOptions({insertSpaces:!1})}},$9e=class extends Mi{constructor(e,t,o){super(o);this.insertSpaces=e;this.displaySizeOnly=t}run(e,t){let o=e.get($e),n=e.get(_t),r=t.getModel();if(!r)return;let s=n.getCreationOptions(r.getLanguageId(),r.uri,r.isForSimpleWidget),l=r.getOptions(),c=[1,2,3,4,5,6,7,8].map(p=>({id:p.toString(),label:p.toString(),description:p===s.tabSize&&p===l.tabSize?d(1318,null):p===s.tabSize?d(1320,null):p===l.tabSize?d(1319,null):void 0})),u=Math.min(r.getOptions().tabSize-1,7);setTimeout(()=>{o.pick(c,{placeHolder:d(1335,null),activeItem:c[u]}).then(p=>{if(p&&r&&!r.isDisposed()){let h=parseInt(p.label,10);this.displaySizeOnly?r.updateOptions({tabSize:h}):r.updateOptions({tabSize:h,indentSize:h,insertSpaces:this.insertSpaces})}})},50)}},j9e=class a extends $9e{static{this.ID="editor.action.indentUsingTabs"}constructor(){super(!1,!1,{id:a.ID,label:P(1333,"Indent Using Tabs"),precondition:void 0,metadata:{description:P(1334,"Use indentation with tabs.")}})}},Q9e=class a extends $9e{static{this.ID="editor.action.indentUsingSpaces"}constructor(){super(!0,!1,{id:a.ID,label:P(1331,"Indent Using Spaces"),precondition:void 0,metadata:{description:P(1332,"Use indentation with spaces.")}})}},Y9e=class a extends $9e{static{this.ID="editor.action.changeTabDisplaySize"}constructor(){super(!0,!0,{id:a.ID,label:P(1316,"Change Tab Display Size"),precondition:void 0,metadata:{description:P(1317,"Change the space size equivalent of the tab.")}})}},X9e=class a extends Mi{static{this.ID="editor.action.detectIndentation"}constructor(){super({id:a.ID,label:P(1321,"Detect Indentation from Content"),precondition:void 0,metadata:{description:P(1322,"Detect the indentation from content.")}})}run(i,e){let t=i.get(_t),o=e.getModel();if(!o)return;let n=t.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget);o.detectIndentation(n.insertSpaces,n.tabSize)}},dfi=class extends Mi{constructor(){super({id:"editor.action.reindentlines",label:P(1323,"Reindent Lines"),precondition:me.writable,metadata:{description:P(1324,"Reindent the lines of the editor.")},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(Us),o=e.getModel();if(!o)return;let n=cfi(o,t,1,o.getLineCount());n.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,n),e.pushUndoStop())}},ufi=class extends Mi{constructor(){super({id:"editor.action.reindentselectedlines",label:P(1325,"Reindent Selected Lines"),precondition:me.writable,metadata:{description:P(1326,"Reindent the selected lines of the editor.")},canTriggerInlineEdits:!0})}run(i,e){let t=i.get(Us),o=e.getModel();if(!o)return;let n=e.getSelections();if(n===null)return;let r=[];for(let s of n){let l=s.startLineNumber,c=s.endLineNumber;if(l!==c&&s.endColumn===1&&c--,l===1){if(l===c)continue}else l--;let u=cfi(o,t,l,c);r.push(...u)}r.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,r),e.pushUndoStop())}},pfi=class{constructor(i,e){this._initialSelection=e,this._edits=[],this._selectionId=null;for(let t of i)t.range&&typeof t.text=="string"&&this._edits.push(t)}getEditOperations(i,e){for(let o of this._edits)e.addEditOperation(G.lift(o.range),o.text);let t=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(t=!0,this._selectionId=e.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(t=!0,this._selectionId=e.trackSelection(this._initialSelection,!1))),t||(this._selectionId=e.trackSelection(this._initialSelection))}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}},zTe=class{constructor(i,e){this.editor=i;this._languageConfigurationService=e;this.callOnDispose=new O;this.callOnModel=new O;this.callOnDispose.add(i.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(i.onDidChangeModel(()=>this.update())),this.callOnDispose.add(i.onDidChangeModelLanguage(()=>this.update()))}static{this.ID="editor.contrib.autoIndentOnPaste"}update(){this.callOnModel.clear(),!(!this.editor.getOption(17)||this.editor.getOption(16)<4)&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:i})=>{this.trigger(i)}))}trigger(i){let e=this.editor.getSelections();if(e===null||e.length>1)return;let t=this.editor.getModel();if(!t||this.rangeContainsOnlyWhitespaceCharacters(t,i)||!this.editor.getOption(18)&&LQo(t,i)||!t.tokenization.isCheapToTokenize(i.getStartPosition().lineNumber))return;let n=this.editor.getOption(16),{tabSize:r,indentSize:s,insertSpaces:l}=t.getOptions(),c=[],u={shiftIndent:f=>Fb.shiftIndent(f,f.length+1,r,s,l),unshiftIndent:f=>Fb.unshiftIndent(f,f.length+1,r,s,l)},p=i.startLineNumber,h=t.getLineContent(p);if(!/\S/.test(h.substring(0,i.startColumn-1))){let f=wce(n,t,t.getLanguageId(),p,u,this._languageConfigurationService);if(f!==null){let v=Ul(h),b=tE(f,r),S=tE(v,r);if(b!==S){let y=Due(b,r,l);c.push({range:new G(p,1,p,v.length+1),text:y}),h=y+h.substring(v.length)}else{let y=$St(t,p,this._languageConfigurationService);if(y===0||y===8)return}}}let g=p;for(;p<i.endLineNumber;){if(!/\S/.test(t.getLineContent(p+1))){p++;continue}break}if(p!==i.endLineNumber){let v=wce(n,{tokenization:{getLineTokens:b=>t.tokenization.getLineTokens(b),getLanguageId:()=>t.getLanguageId(),getLanguageIdAtPosition:(b,S)=>t.getLanguageIdAtPosition(b,S)},getLineContent:b=>b===g?h:t.getLineContent(b)},t.getLanguageId(),p+1,u,this._languageConfigurationService);if(v!==null){let b=tE(v,r),S=tE(Ul(t.getLineContent(p+1)),r);if(b!==S){let y=b-S;for(let w=p+1;w<=i.endLineNumber;w++){let x=t.getLineContent(w),E=Ul(x),N=tE(E,r)+y,V=Due(N,r,l);V!==E&&c.push({range:new G(w,1,w,E.length+1),text:V})}}}}if(c.length>0){this.editor.pushUndoStop();let f=new pfi(c,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",f),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(i,e){let t=n=>n.trim().length===0,o=!0;if(e.startLineNumber===e.endLineNumber){let r=i.getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);o=t(r)}else for(let n=e.startLineNumber;n<=e.endLineNumber;n++){let r=i.getLineContent(n);if(n===e.startLineNumber){let s=r.substring(e.startColumn-1);o=t(s)}else if(n===e.endLineNumber){let s=r.substring(0,e.endColumn-1);o=t(s)}else o=i.getLineFirstNonWhitespaceColumn(n)===0;if(!o)break}return o}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};zTe=I([m(1,Us)],zTe);function LQo(a,i){let e=t=>_6i(a,t)===2;return e(i.getStartPosition())||e(i.getEndPosition())}function Xoo(a,i,e,t){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return;let o="";for(let r=0;r<e;r++)o+=" ";let n=new RegExp(o,"gi");for(let r=1,s=a.getLineCount();r<=s;r++){let l=a.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=a.getLineMaxColumn(r)),l===1)continue;let c=new G(r,1,r,l),u=a.getValueInRange(c),p=t?u.replace(/\t/ig,o):u.replace(n,"	");i.addEditOperation(c,p)}}var mfi=class{constructor(i,e){this.selection=i;this.tabSize=e;this.selectionId=null}getEditOperations(i,e){this.selectionId=e.trackSelection(this.selection),Xoo(i,e,this.tabSize,!0)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}},hfi=class{constructor(i,e){this.selection=i;this.tabSize=e;this.selectionId=null}getEditOperations(i,e){this.selectionId=e.trackSelection(this.selection),Xoo(i,e,this.tabSize,!1)}computeCursorState(i,e){return e.getTrackedSelection(this.selectionId)}};Eo(zTe.ID,zTe,2);ri(G9e);ri(q9e);ri(j9e);ri(Q9e);ri(Y9e);ri(X9e);ri(dfi);ri(ufi);Eo($T.ID,$T,1);PD.register(kJ);var GDt=class{constructor(i,e,t){this._editRange=i,this._originalSelection=e,this._text=t}getEditOperations(i,e){e.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(i,e){let o=e.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new ei(o.endLineNumber,Math.min(this._originalSelection.positionColumn,o.endColumn),o.endLineNumber,Math.min(this._originalSelection.positionColumn,o.endColumn)):new ei(o.endLineNumber,o.endColumn-this._text.length,o.endLineNumber,o.endColumn)}};var uH=class{static{this.ID="editor.contrib.inPlaceReplaceController"}static get(i){return i.getContribution(uH.ID)}static{this.DECORATION=So.register({description:"in-place-replace",className:"valueSetReplacement"})}constructor(i,e){this.editor=i,this.editorWorkerService=e,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(i,e){this.currentRequest?.cancel();let t=this.editor.getSelection(),o=this.editor.getModel();if(!o||!t)return;let n=t;if(n.startLineNumber!==n.endLineNumber)return;let r=new BK(this.editor,5),s=o.uri;return this.editorWorkerService.canNavigateValueSet(s)?(this.currentRequest=Hn(l=>this.editorWorkerService.navigateValueSet(s,n,e)),this.currentRequest.then(l=>{if(!l||!l.range||!l.value||!r.validate(this.editor))return;let c=G.lift(l.range),u=l.range,p=l.value.length-(n.endColumn-n.startColumn);u={startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.startColumn+l.value.length},p>1&&(n=new ei(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn+p-1));let h=new GDt(c,n,l.value);this.editor.pushUndoStop(),this.editor.executeCommand(i,h),this.editor.pushUndoStop(),this.decorations.set([{range:u,options:uH.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=Li(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(mt)}).catch(mt)):Promise.resolve(void 0)}};uH=I([m(1,Qs)],uH);var gfi=class extends Mi{constructor(){super({id:"editor.action.inPlaceReplace.up",label:P(1416,"Replace with Previous Value"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:3159,weight:100}})}run(i,e){let t=uH.get(e);return t?t.run(this.id,!1):Promise.resolve(void 0)}},ffi=class extends Mi{constructor(){super({id:"editor.action.inPlaceReplace.down",label:P(1415,"Replace with Next Value"),precondition:me.writable,kbOpts:{kbExpr:me.editorTextFocus,primary:3161,weight:100}})}run(i,e){let t=uH.get(e);return t?t.run(this.id,!0):Promise.resolve(void 0)}};Eo(uH.ID,uH,4);ri(gfi);ri(ffi);var qDt=class{constructor(i){this._selection=i,this._selectionId=null}getEditOperations(i,e){let t=MQo(i);t&&e.addEditOperation(t.range,t.text),this._selectionId=e.trackSelection(this._selection)}computeCursorState(i,e){return e.getTrackedSelection(this._selectionId)}};function MQo(a){let i=a.getLineCount(),e=a.getLineContent(i),t=Bv(e)===-1;if(!(!i||t))return Qn.insert(new ye(i,a.getLineMaxColumn(i)),a.getEOL())}var vfi=class a extends Mi{static{this.ID="editor.action.insertFinalNewLine"}constructor(){super({id:a.ID,label:P(1417,"Insert Final New Line"),precondition:me.writable})}run(i,e,t){let o=e.getSelection();if(o===null)return;let n=new qDt(o);e.pushUndoStop(),e.executeCommands(this.id,[n]),e.pushUndoStop()}};ri(vfi);var bfi=class extends Mi{constructor(){super({id:"expandLineSelection",label:P(1418,"Expand Line Selection"),precondition:void 0,kbOpts:{weight:0,kbExpr:me.textInputFocus,primary:2090}})}run(i,e,t){if(t=t||{},!e.hasModel())return;let o=e._getViewModel();o.model.pushStackElement(),o.setCursorStates(t.source,3,Wf.expandLineSelection(o,o.getCursorStates())),o.revealAllCursors(t.source,!0)}};ri(bfi);var Joo=new Y("LinkedEditingInputVisible",!1),PQo="linked-editing-decoration",pH=class extends k{constructor(e,t,o,n,r){super();this.languageConfigurationService=n;this._syncRangesToken=0;this._localToDispose=this._register(new O);this._editor=e,this._providers=o.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=Joo.bindTo(t),this._debounceInformation=r.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new O),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(s=>{(s.hasChanged(78)||s.hasChanged(106))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}static{this.ID="editor.contrib.linkedEditing"}static{this.DECORATION=So.register({description:"linked-editing",stickiness:0,className:PQo})}static get(e){return e.getContribution(pH.ID)}reinitialize(e){let t=this._editor.getModel(),o=t!==null&&(this._editor.getOption(78)||this._editor.getOption(106))&&this._providers.has(t);if(o===this._enabled&&!e||(this._enabled=o,this.clearRanges(),this._localToDispose.clear(),!o||t===null))return;this._localToDispose.add(U.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));let n=new rn(this._debounceInformation.get(t)),r=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},s=new rn(0),l=c=>{this._rangeSyncTriggerPromise=s.trigger(()=>this._syncRanges(c))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{r()})),this._localToDispose.add(this._editor.onDidChangeModelContent(c=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){let u=this._currentDecorations.getRange(0);if(u&&c.changes.every(p=>u.intersectRanges(p.range))){l(this._syncRangesToken);return}}r()})),this._localToDispose.add({dispose:()=>{n.dispose(),s.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;let t=this._editor.getModel(),o=this._currentDecorations.getRange(0);if(!o||o.startLineNumber!==o.endLineNumber)return this.clearRanges();let n=t.getValueInRange(o);if(this._currentWordPattern){let s=n.match(this._currentWordPattern);if((s?s[0].length:0)!==n.length)return this.clearRanges()}let r=[];for(let s=1,l=this._currentDecorations.length;s<l;s++){let c=this._currentDecorations.getRange(s);if(c)if(c.startLineNumber!==c.endLineNumber)r.push({range:c,text:n});else{let u=t.getValueInRange(c),p=n,h=c.startColumn,g=c.endColumn,f=Af(u,p);h+=f,u=u.substr(f),p=p.substr(f);let v=lx(u,p);g-=v,u=u.substr(0,u.length-v),p=p.substr(0,p.length-v),(h!==g||p.length!==0)&&r.push({range:new G(c.startLineNumber,h,c.endLineNumber,g),text:p})}}if(r.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;let s=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",r),this._editor._getViewModel().setPrevEditOperationType(s)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequestCts&&(this._currentRequestCts.cancel(),this._currentRequestCts=null,this._currentRequestPosition=null)}get currentUpdateTriggerPromise(){return this._rangeUpdateTriggerPromise||Promise.resolve()}get currentSyncTriggerPromise(){return this._rangeSyncTriggerPromise||Promise.resolve()}async updateRanges(e=!1){if(!this._editor.hasModel()){this.clearRanges();return}let t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}let o=this._editor.getModel(),n=o.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){let s=this._currentDecorations.getRange(0);if(s&&s.containsPosition(t))return}}this._currentRequestPosition?.equals(t)||this._currentDecorations.getRange(0)?.containsPosition(t)||this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=n;let r=this._currentRequestCts=new qe;try{let s=new On(!1),l=await Zoo(this._providers,o,t,r.token);if(this._debounceInformation.update(o,s.elapsed()),r!==this._currentRequestCts||(this._currentRequestCts=null,n!==o.getVersionId()))return;let c=[];l?.ranges&&(c=l.ranges),this._currentWordPattern=l?.wordPattern||this._languageWordPattern;let u=!1;for(let h=0,g=c.length;h<g;h++)if(G.containsPosition(c[h],t)){if(u=!0,h!==0){let f=c[h];c.splice(h,1),c.unshift(f)}break}if(!u){this.clearRanges();return}let p=c.map(h=>({range:h,options:pH.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(p),this._syncRangesToken++}catch(s){Yi(s)||mt(s),(this._currentRequestCts===r||!this._currentRequestCts)&&this.clearRanges()}}setDebounceDuration(e){this._debounceDuration=e}};pH=I([m(1,X),m(2,Jt),m(3,Us),m(4,Gf)],pH);var Sfi=class extends Mi{constructor(){super({id:"editor.action.linkedEditing",label:P(1451,"Start Linked Editing"),precondition:C.and(me.writable,me.hasRenameProvider),kbOpts:{kbExpr:me.editorTextFocus,primary:3132,weight:100}})}runCommand(i,e){let t=i.get(Qt),[o,n]=Array.isArray(e)&&e||[void 0,void 0];return A.isUri(o)&&ye.isIPosition(n)?t.openCodeEditor({resource:o},t.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(n),r.invokeWithinContext(s=>(this.reportTelemetry(s,r),this.run(s,r))))},mt):super.runCommand(i,e)}run(i,e){let t=pH.get(e);return t?Promise.resolve(t.updateRanges(!0)):Promise.resolve()}},AQo=od.bindToContribution(pH.get);ro(new AQo({id:"cancelLinkedEditingInput",precondition:Joo,handler:a=>a.clearRanges(),kbOpts:{kbExpr:me.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function Zoo(a,i,e,t){let o=a.ordered(i);return Ule(o.map(n=>async()=>{try{return await n.provideLinkedEditingRanges(i,e,t)}catch(r){vs(r);return}}),n=>!!n&&Rr(n?.ranges))}var nJs=te("editor.linkedEditingBackground",{dark:Ue.fromHex("#f00").transparent(.3),light:Ue.fromHex("#f00").transparent(.3),hcDark:Ue.fromHex("#f00").transparent(.3),hcLight:Ue.white},d(1450,null));kI("_executeLinkedEditingProvider",(a,i,e)=>{let{linkedEditingRangeProvider:t}=a.get(Jt);return Zoo(t,i,e,Ie.None)});Eo(pH.ID,pH,1);ri(Sfi);var Ifi=class{constructor(i,e){this._link=i,this._provider=e}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(i){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,i)).then(e=>(this._link=e||this._link,this._link.url?this.resolve(i):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}},$Dt=class a{constructor(i){this._disposables=new O;let e=[];for(let[t,o]of i){let n=t.links.map(r=>new Ifi(r,o));e=a._union(e,n),Sd(t)&&(this._disposables??=new O,this._disposables.add(t))}this.links=e}static{this.Empty=new a([])}dispose(){this._disposables?.dispose(),this.links.length=0}static _union(i,e){let t=[],o,n,r,s;for(o=0,r=0,n=i.length,s=e.length;o<n&&r<s;){let l=i[o],c=e[r];if(G.areIntersectingOrTouching(l.range,c.range)){o++;continue}G.compareRangesUsingStarts(l.range,c.range)<0?(t.push(l),o++):(t.push(c),r++)}for(;o<n;o++)t.push(i[o]);for(;r<s;r++)t.push(e[r]);return t}};async function yfi(a,i,e){let t=[],o=a.ordered(i).reverse().map(async(r,s)=>{try{let l=await r.provideLinks(i,e);l&&(t[s]=[l,r])}catch(l){vs(l)}});await Promise.all(o);let n=new $Dt(ui(t));return e.isCancellationRequested&&(n.dispose(),n=$Dt.Empty),n}Ge.registerCommand("_executeLinkProvider",async(a,...i)=>{let[e,t]=i;To(e instanceof A),typeof t!="number"&&(t=0);let{linkProvider:o}=a.get(Jt),n=a.get(_t).getModel(e);if(!n)return[];let r=await yfi(o,n,Ie.None);if(!r)return[];for(let l=0;l<Math.min(t,r.links.length);l++)await r.links[l].resolve(Ie.None);let s=r.links.slice(0);return r.dispose(),s});var nE=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.openerService=t;this.notificationService=o;this.languageFeaturesService=n;this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=r.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new Dt(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;let s=this._register(new i0(e));this._register(s.onMouseMoveOrRelevantKeyDown(([l,c])=>{this._onEditorMouseMove(l,c)})),this._register(s.onExecute(l=>{this.onEditorMouseUp(l)})),this._register(s.onCancel(l=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(l=>{l.hasChanged(79)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(l=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(l=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(l=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(l=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}static{this.ID="editor.linkDetector"}static get(e){return e.getContribution(nE.ID)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(79))return;let e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=Hn(t=>yfi(this.providers,e,t));try{let t=new On(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){mt(t)}finally{this.computePromise=null}}}updateDecorations(e){let t=this.editor.getOption(86)==="altKey",o=[],n=Object.keys(this.currentOccurrences);for(let s of n){let l=this.currentOccurrences[s];o.push(l.decorationId)}let r=[];if(e)for(let s of e)r.push(jDt.decoration(s,t));this.editor.changeDecorations(s=>{let l=s.deltaDecorations(o,r);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let c=0,u=l.length;c<u;c++){let p=new jDt(e[c],l[c]);this.currentOccurrences[p.decorationId]=p}})}_onEditorMouseMove(e,t){let o=this.editor.getOption(86)==="altKey";if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();let n=this.getLinkOccurrence(e.target.position);n&&this.editor.changeDecorations(r=>{n.activate(r,o),this.activeLinkDecorationId=n.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){let e=this.editor.getOption(86)==="altKey";if(this.activeLinkDecorationId){let t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(o=>{t.deactivate(o,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;let t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,o=!1){if(!this.openerService)return;let{link:n}=e;n.resolve(Ie.None).then(r=>{if(typeof r=="string"&&this.editor.hasModel()){let s=this.editor.getModel().uri;if(s.scheme===Q.file&&r.startsWith(`${Q.file}:`)){let l=A.parse(r);if(l.scheme===Q.file){let c=fB(l),u=null;c.startsWith("/./")||c.startsWith("\\.\\")?u=`.${c.substr(1)}`:(c.startsWith("//./")||c.startsWith("\\\\.\\"))&&(u=`.${c.substr(2)}`),u&&(r=Ve(s,u))}}}return this.openerService.open(r,{openToSide:t,fromUserGesture:o,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},r=>{let s=r instanceof Error?r.message:r;s==="invalid"?this.notificationService.warn(d(1452,null,n.url.toString())):s==="missing"?this.notificationService.warn(d(1460,null)):mt(r)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;let t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(let o of t){let n=this.currentOccurrences[o.id];if(n)return n}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink"))}stop(){this.computeLinks.cancel(),this.activeLinksList&&(this.activeLinksList?.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};nE=I([m(1,Je),m(2,Ne),m(3,Jt),m(4,Gf)],nE);var eno={general:So.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:So.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})},jDt=class a{static decoration(i,e){return{range:i.range,options:a._getOptions(i,e,!1)}}static _getOptions(i,e,t){let o={...t?eno.active:eno.general};return o.hoverMessage=NQo(i,e),o}constructor(i,e){this.link=i,this.decorationId=e}activate(i,e){i.changeDecorationOptions(this.decorationId,a._getOptions(this.link,e,!0))}deactivate(i,e){i.changeDecorationOptions(this.decorationId,a._getOptions(this.link,e,!1))}};function NQo(a,i){let e=a.url&&/^command:/i.test(a.url.toString()),t=a.tooltip?a.tooltip:e?d(1454,null):d(1455,null),o=i?et?d(1459,null):d(1458,null):et?d(1457,null):d(1456,null);if(a.url){let n="";if(/^command:/i.test(a.url.toString())){let s=a.url.toString().match(/^command:([^?#]+)/);if(s){let l=s[1];n=d(1461,null,l)}}return new he("",!0).appendLink(a.url.toString(!0).replace(/ /g,"%20"),t,n).appendMarkdown(` (${o})`)}else return new he().appendText(`${t} (${o})`)}var wfi=class extends Mi{constructor(){super({id:"editor.action.openLink",label:P(1453,"Open Link"),precondition:void 0})}run(i,e){let t=nE.get(e);if(!t||!e.hasModel())return;let o=e.getSelections();for(let n of o){let r=t.getLinkOccurrence(n.getEndPosition());r&&t.openLinkOccurrence(r,!1)}}};Eo(nE.ID,nE,1);ri(wfi);var QDt=class a extends k{constructor(e){super();this._editor=e;this._register(this._editor.onMouseDown(t=>{let o=this._editor.getOption(133);o>=0&&t.target.type===6&&t.target.position.column>=o&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}static{this.ID="editor.contrib.longLinesHelper"}static get(e){return e.getContribution(a.ID)}};Eo(QDt.ID,QDt,2);var J9e=class a extends k{constructor(e){super();this._editor=e;let t=Ds(this._editor),o=t.getOption(171);this._register(ve(n=>{if(!o.read(n))return;let r=t.domNode.read(n);if(!r)return;let s=n.store.add(IB("scrollingSession",void 0));n.store.add(this._editor.onMouseDown(c=>{if(s.read(void 0)){s.set(void 0,void 0);return}if(!c.event.middleButton)return;c.event.stopPropagation(),c.event.preventDefault();let p=new O,h=new Mg(c.event.posx,c.event.posy),f=OQo(Me(r),h,p).map(S=>S.subtract(h).withThreshold(5)),v=r.getBoundingClientRect(),b=new Mg(h.x-v.left,h.y-v.top);s.set({mouseDeltaAfterThreshold:f,initialMousePosInEditor:b,didScroll:!1,dispose:()=>p.dispose()},void 0),p.add(this._editor.onMouseUp(S=>{let y=s.read(void 0);y&&y.didScroll&&s.set(void 0,void 0)})),p.add(this._editor.onKeyDown(S=>{s.set(void 0,void 0)}))})),n.store.add(ve(c=>{let u=s.read(c);if(!u)return;let p=Date.now();c.store.add(ve(g=>{rTe.instance.invalidateOnNextAnimationFrame(g);let f=Date.now(),v=f-p;p=f;let b=u.mouseDeltaAfterThreshold.read(void 0),S=v/32,y=b.scale(S),w=new Mg(this._editor.getScrollLeft(),this._editor.getScrollTop());this._editor.setScrollPosition(FQo(w.add(y))),y.isZero()||(u.didScroll=!0)}));let h=ke(g=>{let f=u.mouseDeltaAfterThreshold.read(g),v="";return v+=f.y<0?"n":f.y>0?"s":"",v+=f.x<0?"w":f.x>0?"e":"",v});c.store.add(ve(g=>{r.setAttribute("data-scroll-direction",h.read(g))}))}));let l=n.store.add($o.div({class:["scroll-editor-on-middle-click-dot",s.map(c=>c?"":"hidden")],style:{left:s.map(c=>c?c.initialMousePosInEditor.x:0),top:s.map(c=>c?c.initialMousePosInEditor.y:0)}}).toDisposableLiveElement());n.store.add(l4(r,l.element)),n.store.add(ve(c=>{let u=s.read(c);r.classList.toggle("scroll-editor-on-middle-click-editor",!!u)}))}))}static{this.ID="editor.contrib.middleScroll"}static get(e){return e.getContribution(a.ID)}};function OQo(a,i,e){let t=De("pos",i);return e.add($(a,"mousemove",o=>{t.set(new Mg(o.pageX,o.pageY),void 0)})),t}function FQo(a){return{scrollLeft:a.x,scrollTop:a.y}}Eo(J9e.ID,J9e,2);var VQo=te("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},d(1741,null),!0);te("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},d(1743,null),!0);te("editor.wordHighlightTextBackground",VQo,d(1745,null),!0);var BQo=te("editor.wordHighlightBorder",{light:null,dark:null,hcDark:la,hcLight:la},d(1742,null));te("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:la,hcLight:la},d(1744,null));te("editor.wordHighlightTextBorder",BQo,d(1746,null));var HQo=te("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",d(1738,null),!0),UQo=te("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",d(1739,null),!0),zQo=te("editorOverviewRuler.wordHighlightTextForeground",NCe,d(1740,null),!0),KQo=So.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:_s(UQo),position:2},minimap:{color:_s(N3e),position:1}}),GQo=So.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:_s(zQo),position:2},minimap:{color:_s(N3e),position:1}}),qQo=So.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:_s(NCe),position:2},minimap:{color:_s(N3e),position:1}}),$Qo=So.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),jQo=So.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:_s(HQo),position:2},minimap:{color:_s(N3e),position:1}});function tno(a){return a===2?KQo:a===0?GQo:jQo}function ino(a){return a?$Qo:qQo}hs((a,i)=>{let e=a.getColor(ACe);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)});function QJ(a,i){let e=i.filter(t=>!a.find(o=>o.equals(t)));if(e.length>=1){let t=e.map(n=>`line ${n.viewState.position.lineNumber} column ${n.viewState.position.column}`).join(", "),o=e.length===1?d(1466,null,t):d(1467,null,t);Er(o)}}var Cfi=class extends Mi{constructor(){super({id:"editor.action.insertCursorAbove",label:P(1482,"Add Cursor Above"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"3_multi",title:d(1470,null),order:2}})}run(i,e,t){if(!e.hasModel())return;let o=!0;t&&t.logicalLine===!1&&(o=!1);let n=e._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();let r=n.getCursorStates();n.setCursorStates(t.source,3,Wf.addCursorUp(n,r,o)),n.revealTopMostCursor(t.source),QJ(r,n.getCursorStates())}},xfi=class extends Mi{constructor(){super({id:"editor.action.insertCursorBelow",label:P(1484,"Add Cursor Below"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"3_multi",title:d(1472,null),order:3}})}run(i,e,t){if(!e.hasModel())return;let o=!0;t&&t.logicalLine===!1&&(o=!1);let n=e._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();let r=n.getCursorStates();n.setCursorStates(t.source,3,Wf.addCursorDown(n,r,o)),n.revealBottomMostCursor(t.source),QJ(r,n.getCursorStates())}},kfi=class extends Mi{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:P(1483,"Add Cursors to Line Ends"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"3_multi",title:d(1471,null),order:4}})}getCursorsForSelection(i,e,t){if(!i.isEmpty()){for(let o=i.startLineNumber;o<i.endLineNumber;o++){let n=e.getLineMaxColumn(o);t.push(new ei(o,n,o,n))}i.endColumn>1&&t.push(new ei(i.endLineNumber,i.endColumn,i.endLineNumber,i.endColumn))}}run(i,e){if(!e.hasModel())return;let t=e.getModel(),o=e.getSelections(),n=e._getViewModel(),r=n.getCursorStates(),s=[];o.forEach(l=>this.getCursorsForSelection(l,t,s)),s.length>0&&e.setSelections(s),QJ(r,n.getCursorStates())}},Efi=class extends Mi{constructor(){super({id:"editor.action.addCursorsToBottom",label:P(1476,"Add Cursors to Bottom"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getSelections(),o=e.getModel().getLineCount(),n=[];for(let l=t[0].startLineNumber;l<=o;l++)n.push(new ei(l,t[0].startColumn,l,t[0].endColumn));let r=e._getViewModel(),s=r.getCursorStates();n.length>0&&e.setSelections(n),QJ(s,r.getCursorStates())}},Tfi=class extends Mi{constructor(){super({id:"editor.action.addCursorsToTop",label:P(1477,"Add Cursors to Top"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getSelections(),o=[];for(let s=t[0].startLineNumber;s>=1;s--)o.push(new ei(s,t[0].startColumn,s,t[0].endColumn));let n=e._getViewModel(),r=n.getCursorStates();o.length>0&&e.setSelections(o),QJ(r,n.getCursorStates())}},KTe=class{constructor(i,e,t){this.selections=i;this.revealRange=e;this.revealScrollType=t}},YDt=class a{constructor(i,e,t,o,n,r,s){this._editor=i;this.findController=e;this.isDisconnectedFromFindController=t;this.searchText=o;this.wholeWord=n;this.matchCase=r;this.currentMatch=s}static create(i,e){if(!i.hasModel())return null;let t=e.getState();if(!i.hasTextFocus()&&t.isRevealed&&t.searchString.length>0)return new a(i,e,!1,t.searchString,t.wholeWord,t.matchCase,null);let o=!1,n,r,s=i.getSelections();s.length===1&&s[0].isEmpty()?(o=!0,n=!0,r=!0):(n=t.wholeWord,r=t.matchCase);let l=i.getSelection(),c,u=null;if(l.isEmpty()){let p=i.getConfiguredWordAtPosition(l.getStartPosition());if(!p)return null;c=p.word,u=new ei(l.startLineNumber,p.startColumn,l.startLineNumber,p.endColumn)}else c=i.getModel().getValueInRange(l).replace(/\r\n/g,`
`);return new a(i,e,o,c,n,r,u)}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let i=this._getNextMatch();if(!i)return null;let e=this._editor.getSelections();return new KTe(e.concat(i),i,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let i=this._getNextMatch();if(!i)return null;let e=this._editor.getSelections();return new KTe(e.slice(0,e.length-1).concat(i),i,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let o=this.currentMatch;return this.currentMatch=null,o}this.findController.highlightFindOptions();let i=this._editor.getSelections(),e=i[i.length-1],t=this._editor.getModel().findNextMatch(this.searchText,e.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return t?new ei(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let i=this._getPreviousMatch();if(!i)return null;let e=this._editor.getSelections();return new KTe(e.concat(i),i,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let i=this._getPreviousMatch();if(!i)return null;let e=this._editor.getSelections();return new KTe(e.slice(0,e.length-1).concat(i),i,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let o=this.currentMatch;return this.currentMatch=null,o}this.findController.highlightFindOptions();let i=this._editor.getSelections(),e=i[i.length-1],t=this._editor.getModel().findPreviousMatch(this.searchText,e.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return t?new ei(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn):null}selectAll(i){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();let e=this._editor.getModel();return i?e.findMatches(this.searchText,i,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824):e.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824)}},$J=class a extends k{constructor(e){super();this._sessionDispose=this._register(new O);this._editor=e,this._ignoreSelectionChange=!1,this._session=null}static{this.ID="editor.contrib.multiCursorController"}static get(e){return e.getContribution(a.ID)}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){let t=YDt.create(this._editor,e);if(!t)return;this._session=t;let o={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(o.wholeWordOverride=1,o.matchCaseOverride=1,o.isRegexOverride=2),e.getState().change(o,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(n=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(n=>{(n.matchCase||n.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){let e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;let o=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return o?new ei(t.startLineNumber,o.startColumn,t.startLineNumber,o.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){let t=this._editor.getSelections();if(t.length>1){let n=e.getState().matchCase;if(!nno(this._editor.getModel(),t,n)){let s=this._editor.getModel(),l=[];for(let c=0,u=t.length;c<u;c++)l[c]=this._expandEmptyToWord(s,t[c]);this._editor.setSelections(l);return}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null,o=e.getState();if(o.isRevealed&&o.searchString.length>0&&o.isRegex){let n=this._editor.getModel();o.searchScope?t=n.findMatches(o.searchString,o.searchScope,o.isRegex,o.matchCase,o.wholeWord?this._editor.getOption(148):null,!1,1073741824):t=n.findMatches(o.searchString,!0,o.isRegex,o.matchCase,o.wholeWord?this._editor.getOption(148):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(o.searchScope)}if(t.length>0){let n=this._editor.getSelection();for(let r=0,s=t.length;r<s;r++){let l=t[r];if(l.range.intersectRanges(n)){t[r]=t[0],t[0]=l;break}}this._setSelections(t.map(r=>new ei(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn)))}}selectAllUsingSelections(e){e.length>0&&this._setSelections(e)}},jJ=class extends Mi{run(i,e){let t=$J.get(e);if(!t)return;let o=e._getViewModel();if(o){let n=o.getCursorStates(),r=Sv.get(e);if(r)this._run(t,r);else{let s=i.get(F).createInstance(Sv,e);this._run(t,s),s.dispose()}QJ(n,o.getCursorStates())}}},_fi=class extends jJ{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:P(1463,"Add Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:me.focus,primary:2082,weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"3_multi",title:d(1468,null),order:5}})}_run(i,e){i.addSelectionToNextFindMatch(e)}},Dfi=class extends jJ{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:P(1464,"Add Selection to Previous Find Match"),precondition:void 0,menuOpts:{menuId:R.MenubarSelectionMenu,group:"3_multi",title:d(1469,null),order:6}})}_run(i,e){i.addSelectionToPreviousFindMatch(e)}},Rfi=class extends jJ{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:P(1474,"Move Last Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:me.focus,primary:Gi(2089,2082),weight:100}})}_run(i,e){i.moveSelectionToNextFindMatch(e)}},Lfi=class extends jJ{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:P(1475,"Move Last Selection to Previous Find Match"),precondition:void 0})}_run(i,e){i.moveSelectionToPreviousFindMatch(e)}},Mfi=class extends jJ{constructor(){super({id:"editor.action.selectHighlights",label:P(1485,"Select All Occurrences of Find Match"),precondition:void 0,kbOpts:{kbExpr:me.focus,primary:3114,weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"3_multi",title:d(1473,null),order:7}})}_run(i,e){i.selectAll(e)}},Pfi=class extends jJ{constructor(){super({id:"editor.action.changeAll",label:P(1465,"Change All Occurrences"),precondition:C.and(me.writable,me.editorTextFocus),kbOpts:{kbExpr:me.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(i,e){i.selectAll(e)}},Afi=class{constructor(i,e,t,o,n){this._model=i;this._searchText=e;this._matchCase=t;this._wordSeparators=o;this._cachedFindMatches=null;this._modelVersionId=this._model.getVersionId(),n&&this._model===n._model&&this._searchText===n._searchText&&this._matchCase===n._matchCase&&this._wordSeparators===n._wordSeparators&&this._modelVersionId===n._modelVersionId&&(this._cachedFindMatches=n._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(i=>i.range),this._cachedFindMatches.sort(G.compareRangesUsingStarts)),this._cachedFindMatches}},qJ=class extends k{constructor(e,t){super();this._languageFeaturesService=t;this.editor=e,this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new Dt(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123)})),this._register(e.onDidChangeCursorSelection(n=>{this._isEnabled&&(n.selection.isEmpty()?n.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(n=>{this._setState(null)})),this._register(e.onDidChangeModelContent(n=>{this._isEnabled&&this.updateSoon.schedule()}));let o=Sv.get(e);o&&this._register(o.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}static{this.ID="editor.contrib.selectionHighlighter"}_update(){this._setState(qJ._createState(this.state,this._isEnabled,this._isEnabledMultiline,this._maxLength,this.editor))}static _createState(e,t,o,n,r){if(!t||!r.hasModel())return null;if(!o){let h=r.getSelection();if(h.startLineNumber!==h.endLineNumber)return null}let s=$J.get(r);if(!s)return null;let l=Sv.get(r);if(!l)return null;let c=s.getSession(l);if(!c){let h=r.getSelections();if(h.length>1){let f=l.getState().matchCase;if(!nno(r.getModel(),h,f))return null}c=YDt.create(r,l)}if(!c||c.currentMatch||/^[ \t]+$/.test(c.searchText)||n>0&&c.searchText.length>n)return null;let u=l.getState(),p=u.matchCase;if(u.isRevealed){let h=u.searchString;p||(h=h.toLowerCase());let g=c.searchText;if(p||(g=g.toLowerCase()),h===g&&c.matchCase===u.matchCase&&c.wholeWord===u.wholeWord&&!u.isRegex)return null}return new Afi(r.getModel(),c.searchText,c.matchCase,c.wholeWord?r.getOption(148):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;let t=this.editor.getModel();if(t.isTooLargeForTokenization())return;let o=this.state.findMatches(),n=this.editor.getSelections();n.sort(G.compareRangesUsingStarts);let r=[];for(let u=0,p=0,h=o.length,g=n.length;u<h;){let f=o[u];if(p>=g)r.push(f),u++;else{let v=G.compareRangesUsingStarts(f,n[p]);v<0?((n[p].isEmpty()||!G.areIntersecting(f,n[p]))&&r.push(f),u++):(v>0||u++,p++)}}let s=this.editor.getOption(90)!=="off",l=this._languageFeaturesService.documentHighlightProvider.has(t)&&s,c=r.map(u=>({range:u,options:ino(l)}));this._decorations.set(c)}dispose(){this._setState(null),super.dispose()}};qJ=I([m(1,Jt)],qJ);function nno(a,i,e){let t=ono(a,i[0],!e);for(let o=1,n=i.length;o<n;o++){let r=i[o];if(r.isEmpty())return!1;let s=ono(a,r,!e);if(t!==s)return!1}return!0}function ono(a,i,e){let t=a.getValueInRange(i);return e?t.toLowerCase():t}var Nfi=class extends Mi{constructor(){super({id:"editor.action.focusNextCursor",label:P(1478,"Focus Next Cursor"),metadata:{description:d(1479,null),args:[]},precondition:void 0})}run(i,e,t){if(!e.hasModel())return;let o=e._getViewModel();if(o.cursorConfig.readOnly)return;o.model.pushStackElement();let n=Array.from(o.getCursorStates()),r=n.shift();r&&(n.push(r),o.setCursorStates(t.source,3,n),o.revealPrimaryCursor(t.source,!0),QJ(n,o.getCursorStates()))}},Ofi=class extends Mi{constructor(){super({id:"editor.action.focusPreviousCursor",label:P(1480,"Focus Previous Cursor"),metadata:{description:d(1481,null),args:[]},precondition:void 0})}run(i,e,t){if(!e.hasModel())return;let o=e._getViewModel();if(o.cursorConfig.readOnly)return;o.model.pushStackElement();let n=Array.from(o.getCursorStates()),r=n.pop();r&&(n.unshift(r),o.setCursorStates(t.source,3,n),o.revealPrimaryCursor(t.source,!0),QJ(n,o.getCursorStates()))}};Eo($J.ID,$J,4);Eo(qJ.ID,qJ,1);ri(Cfi);ri(xfi);ri(kfi);ri(_fi);ri(Dfi);ri(Rfi);ri(Lfi);ri(Mfi);ri(Pfi);ri(Efi);ri(Tfi);ri(Nfi);ri(Ofi);var Y4={Visible:new Y("parameterHintsVisible",!1),MultipleSignatures:new Y("parameterHintsMultipleSignatures",!1)};async function Ffi(a,i,e,t,o){let n=a.ordered(i);for(let r of n)try{let s=await r.provideSignatureHelp(i,e,o,t);if(s)return s}catch(s){vs(s)}}Ge.registerCommand("_executeSignatureHelpProvider",async(a,...i)=>{let[e,t,o]=i;To(A.isUri(e)),To(ye.isIPosition(t)),To(typeof o=="string"||!o);let n=a.get(Jt),r=await a.get(Bt).createModelReference(e);try{let s=await Ffi(n.signatureHelpProvider,r.object.textEditorModel,ye.lift(t),{triggerKind:1,isRetrigger:!1,triggerCharacter:o},Ie.None);return s?(setTimeout(()=>s.dispose(),0),s.value):void 0}finally{r.dispose()}});var Hue;(o=>{let a;(l=>(l[l.Default=0]="Default",l[l.Active=1]="Active",l[l.Pending=2]="Pending"))(a=o.Type||={}),o.Default={type:0};class e{constructor(r,s){this.request=r;this.previouslyActiveHints=s;this.type=2}}o.Pending=e;class t{constructor(r){this.hints=r;this.type=1}}o.Active=t})(Hue||={});var XDt=class a extends k{constructor(e,t,o=a.DEFAULT_DELAY){super();this._onChangedHints=this._register(new T);this.onChangedHints=this._onChangedHints.event;this.triggerOnType=!1;this._state=Hue.Default;this._pendingTriggers=[];this._lastSignatureHelpResult=this._register(new ue);this.triggerChars=new p5;this.retriggerChars=new p5;this.triggerId=0;this.editor=e,this.providers=t,this.throttledDelayer=this._register(new rn(o)),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(n=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(n=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(n=>this.onCursorChange(n))),this._register(this.editor.onDidChangeModelContent(n=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(n=>this.onDidType(n))),this.onEditorConfigurationChange(),this.onModelChanged()}static{this.DEFAULT_DELAY=120}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=Hue.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){let o=this.editor.getModel();if(!o||!this.providers.has(o))return;let n=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(n),t).catch(mt)}next(){if(this.state.type!==1)return;let e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,o=t%e===e-1,n=this.editor.getOption(98).cycle;if((e<2||o)&&!n){this.cancel();return}this.updateActiveSignature(o&&n?0:t+1)}previous(){if(this.state.type!==1)return;let e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,o=t===0,n=this.editor.getOption(98).cycle;if((e<2||o)&&!n){this.cancel();return}this.updateActiveSignature(o&&n?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new Hue.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){let t=this.state.type===1||this.state.type===2,o=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;let n=this._pendingTriggers.reduce(QQo);this._pendingTriggers=[];let r={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:o};if(!this.editor.hasModel())return!1;let s=this.editor.getModel(),l=this.editor.getPosition();this.state=new Hue.Pending(Hn(c=>Ffi(this.providers,s,l,r,c)),o);try{let c=await this.state.request;return e!==this.triggerId?(c?.dispose(),!1):!c||!c.value.signatures||c.value.signatures.length===0?(c?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new Hue.Active(c.value),this._lastSignatureHelpResult.value=c,this._onChangedHints.fire(this.state.hints),!0)}catch(c){return e===this.triggerId&&(this.state=Hue.Default),mt(c),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();let e=this.editor.getModel();if(e)for(let t of this.providers.ordered(e)){for(let o of t.signatureHelpTriggerCharacters||[])if(o.length){let n=o.charCodeAt(0);this.triggerChars.add(n),this.retriggerChars.add(n)}for(let o of t.signatureHelpRetriggerCharacters||[])o.length&&this.retriggerChars.add(o.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;let t=e.length-1,o=e.charCodeAt(t);(this.triggerChars.has(o)||this.isTriggered&&this.retriggerChars.has(o))&&this.trigger({triggerKind:2,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:3})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:3})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(98).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};function QQo(a,i){switch(i.triggerKind){case 1:return i;case 3:return a;case 2:default:return i}}var IM=_,YQo=Oe("parameter-hints-next",L.chevronDown,d(1489,null)),XQo=Oe("parameter-hints-previous",L.chevronUp,d(1490,null)),YJ=class extends k{constructor(e,t,o,n){super();this.editor=e;this.model=t;this.markdownRendererService=n;this.renderDisposeables=this._register(new O);this.visible=!1;this.announcedLabel=null;this.allowEditorOverflow=!0;this.keyVisible=Y4.Visible.bindTo(o),this.keyMultipleSignatures=Y4.MultipleSignatures.bindTo(o)}static{this.ID="editor.widget.parameterHintsWidget"}createParameterHintDOMNodes(){let e=IM(".editor-widget.parameter-hints-widget"),t=D(e,IM(".phwrapper"));t.tabIndex=-1;let o=D(t,IM(".controls")),n=D(o,IM(".button"+q.asCSSSelector(XQo))),r=D(o,IM(".overloads")),s=D(o,IM(".button"+q.asCSSSelector(YQo)));this._register($(n,"click",g=>{Kt.stop(g),this.previous()})),this._register($(s,"click",g=>{Kt.stop(g),this.next()}));let l=IM(".body"),c=new Ar(l,{alwaysConsumeMouseWheel:!0});this._register(c),t.appendChild(c.getDomNode());let u=D(l,IM(".signature")),p=D(l,IM(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:u,overloads:r,docs:p,scrollbar:c},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(g=>{this.visible&&this.editor.layoutContentWidget(this)}));let h=()=>{if(!this.domNodes)return;let g=this.editor.getOption(59),f=this.domNodes.element;f.style.fontSize=`${g.fontSize}px`,f.style.lineHeight=`${g.lineHeight/g.fontSize}`,f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",g.fontFamily),f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",Ku.fontFamily)};h(),this._register(U.chain(this.editor.onDidChangeConfiguration.bind(this.editor),g=>g.filter(f=>f.hasChanged(59)))(h)),this._register(this.editor.onDidLayoutChange(g=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{this.domNodes?.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes?.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;let t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";let o=e.signatures[e.activeSignature];if(!o)return;let n=D(this.domNodes.signature,IM(".code")),r=o.parameters.length>0,s=o.activeParameter??e.activeParameter;if(r)this.renderParameters(n,o,s);else{let u=D(n,IM("span"));u.textContent=o.label}let l=o.parameters[s];if(l?.documentation){let u=IM("span.documentation");if(typeof l.documentation=="string")u.textContent=l.documentation;else{let p=this.renderMarkdownDocs(l.documentation);u.appendChild(p.element)}D(this.domNodes.docs,IM("p",{},u))}if(o.documentation!==void 0)if(typeof o.documentation=="string")D(this.domNodes.docs,IM("p",{},o.documentation));else{let u=this.renderMarkdownDocs(o.documentation);D(this.domNodes.docs,u.element)}let c=this.hasDocs(o,l);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,l){let u="",p=o.parameters[s];Array.isArray(p.label)?u=o.label.substring(p.label[0],p.label[1]):u=p.label,p.documentation&&(u+=typeof p.documentation=="string"?`, ${p.documentation}`:`, ${p.documentation.value}`),o.documentation&&(u+=typeof o.documentation=="string"?`, ${o.documentation}`:`, ${o.documentation.value}`),this.announcedLabel!==u&&(cn(d(1488,null,u)),this.announcedLabel=u)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){let t=this.renderDisposeables.add(this.markdownRendererService.render(e,{context:this.editor,asyncRenderCallback:()=>{this.domNodes?.scrollbar.scanDomNode()}}));return t.element.classList.add("markdown-docs"),t}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Ti(t.documentation).length>0||t&&typeof t.documentation=="object"&&Ti(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Ti(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Ti(e.documentation.value).length>0)}renderParameters(e,t,o){let[n,r]=this.getParameterLabelOffsets(t,o),s=document.createElement("span");s.textContent=t.label.substring(0,n);let l=document.createElement("span");l.textContent=t.label.substring(n,r),l.className="parameter active";let c=document.createElement("span");c.textContent=t.label.substring(r),D(e,s,l,c)}getParameterLabelOffsets(e,t){let o=e.parameters[t];if(o){if(Array.isArray(o.label))return o.label;if(o.label.length){let n=new RegExp(`(\\W|^)${Ss(o.label)}(?=\\W|$)`,"g");n.test(e.label);let r=n.lastIndex-o.label.length;return r>=0?[r,n.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return YJ.ID}updateMaxHeight(){if(!this.domNodes)return;let t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;let o=this.domNodes.element.getElementsByClassName("phwrapper");o.length&&(o[0].style.maxHeight=t)}};YJ=I([m(2,X),m(3,_n)],YJ);te("editorHoverWidget.highlightForeground",aX,d(1487,null));var S0=class extends k{static{this.ID="editor.controller.parameterHints"}static get(i){return i.getContribution(S0.ID)}constructor(i,e,t){super(),this.editor=i,this.model=this._register(new XDt(i,t.signatureHelpProvider)),this._register(this.model.onChangedHints(o=>{o?(this.widget.value.show(),this.widget.value.render(o)):this.widget.rawValue?.hide()})),this.widget=new uo(()=>this._register(e.createInstance(YJ,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){this.widget.rawValue?.previous()}next(){this.widget.rawValue?.next()}trigger(i){this.model.trigger(i,0)}};S0=I([m(1,F),m(2,Jt)],S0);var Wfi=class extends Mi{constructor(){super({id:"editor.action.triggerParameterHints",label:P(1486,"Trigger Parameter Hints"),precondition:me.hasSignatureHelpProvider,kbOpts:{kbExpr:me.editorTextFocus,primary:3082,weight:100}})}run(i,e){S0.get(e)?.trigger({triggerKind:1})}};Eo(S0.ID,S0,2);ri(Wfi);var Vfi=175,Bfi=od.bindToContribution(S0.get);ro(new Bfi({id:"closeParameterHints",precondition:Y4.Visible,handler:a=>a.cancel(),kbOpts:{weight:Vfi,kbExpr:me.focus,primary:9,secondary:[1033]}}));ro(new Bfi({id:"showPrevParameterHint",precondition:C.and(Y4.Visible,Y4.MultipleSignatures),handler:a=>a.previous(),kbOpts:{weight:Vfi,kbExpr:me.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));ro(new Bfi({id:"showNextParameterHint",precondition:C.and(Y4.Visible,Y4.MultipleSignatures),handler:a=>a.next(),kbOpts:{weight:Vfi,kbExpr:me.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var X4=class a extends k{constructor(e){super();this._editor=e;this._editorObs=Ds(this._editor),this._placeholderText=this._editorObs.getOption(100),this._state=Js({owner:this,equalsFn:cD},t=>{let o=this._placeholderText.read(t);if(o&&this._editorObs.valueIsEmpty.read(t))return{placeholder:o}}),this._shouldViewBeAlive=JQo(this,t=>this._state.read(t)?.placeholder!==void 0),this._view=ke(t=>{if(!this._shouldViewBeAlive.read(t))return;let o=st("div.editorPlaceholder");t.store.add(ve(n=>{let r=this._state.read(n),s=r?.placeholder!==void 0;o.root.style.display=s?"block":"none",o.root.innerText=r?.placeholder??""})),t.store.add(ve(n=>{let r=this._editorObs.layoutInfo.read(n);o.root.style.left=`${r.contentLeft}px`,o.root.style.width=r.contentWidth-r.verticalScrollbarWidth+"px",o.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),t.store.add(ve(n=>{o.root.style.fontFamily=this._editorObs.getOption(58).read(n),o.root.style.fontSize=this._editorObs.getOption(61).read(n)+"px",o.root.style.lineHeight=this._editorObs.getOption(75).read(n)+"px"})),t.store.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:Fo(0),position:Fo(null),domNode:o.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}static get(e){return e.getContribution(a.ID)}static{this.ID="editor.contrib.placeholderText"}};function JQo(a,i){return mv(a,(e,t)=>t===!0?!0:i(e))}function sno(a){return DT()?ano(a,Z9e):a()}var JDt=class{constructor(i){this.instantiationService=i}init(...i){}};function ano(a,i){return class extends i{constructor(){super(...arguments);this._autorun=void 0}init(...o){this._autorun=Rl((n,r)=>{let s=zk(a(),n);r.add(this.instantiationService.createInstance(s,...o))})}dispose(){this._autorun?.dispose()}}}var Z9e=class extends JDt{constructor(i){super(i),this.init()}};Z9e=I([m(0,F)],Z9e);function lno(a){return DT()?ano(a,e7e):a()}var e7e=class extends JDt{constructor(i,e){super(e),this.init(i)}};e7e=I([m(1,F)],e7e);Eo(X4.ID,lno(()=>X4),0);te("editor.placeholder.foreground",ZYi,d(1509,null));var GTe=class extends k{constructor(e,t,o){super();this.editor=e;this.languageConfigurationService=t;this.editorWorkerService=o;this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(81)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(n=>{let r=this.editor.getModel()?.getLanguageId();r&&n.affects(r)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(n=>{this.options&&!n.hasChanged(81)||(this.options=this.createOptions(e.getOption(81)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(n=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(n=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new Dt(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}static{this.ID="editor.sectionHeaderDetector"}createOptions(e){if(!e||!this.editor.hasModel())return;let t=this.editor.getModel().getLanguageId();if(!t)return;let o=this.languageConfigurationService.getLanguageConfiguration(t).comments,n=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!o&&!n?.markers))return{foldingRules:n,markSectionHeaderRegex:e.markSectionHeaderRegex,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){if(!this.editor.hasModel()||!this.options?.findMarkSectionHeaders&&!this.options?.findRegionSectionHeaders)return;let e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;let t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(o=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(o)})}updateDecorations(e){let t=this.editor.getModel();t&&(e=e.filter(r=>{if(!r.shouldBeInComments)return!0;let s=t.validateRange(r.range),l=t.tokenization.getLineTokens(s.startLineNumber),c=l.findTokenIndexAtOffset(s.startColumn-1),u=l.getStandardTokenType(c),p=t.getLanguageIdAtPosition(s.startLineNumber,s.startColumn);return l.getLanguageId(c)===p&&u===1}));let o=Object.values(this.currentOccurrences).map(r=>r.decorationId),n=e.map(r=>ZQo(r));this.editor.changeDecorations(r=>{let s=r.deltaDecorations(o,n);this.currentOccurrences={};for(let l=0,c=s.length;l<c;l++){let u={sectionHeader:e[l],decorationId:s[l]};this.currentOccurrences[u.decorationId]=u}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}};GTe=I([m(1,Us),m(2,Qs)],GTe);function ZQo(a){return{range:a.range,options:So.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:a.hasSeparatorLine?2:1,sectionHeaderText:a.text}})}}Eo(GTe.ID,GTe,1);var ZDt=class{constructor(i=5){this.timesPerSecond=i;this._lastRun=0,this._minimumTimeBetweenRuns=1e3/i}runIfNotLimited(i){let e=Date.now();e-this._lastRun>=this._minimumTimeBetweenRuns&&(this._lastRun=e,i())}};var eRt=class a{static create(i,e){return new a(i,new Hfi(e))}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._endLineNumber}constructor(i,e){this._startLineNumber=i,this._tokens=e,this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}toString(){return this._tokens.toString(this._startLineNumber)}_updateEndLineNumber(){this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}isEmpty(){return this._tokens.isEmpty()}getLineTokens(i){return this._startLineNumber<=i&&i<=this._endLineNumber?this._tokens.getLineTokens(i-this._startLineNumber):null}getRange(){let i=this._tokens.getRange();return i&&new G(this._startLineNumber+i.startLineNumber,i.startColumn,this._startLineNumber+i.endLineNumber,i.endColumn)}removeTokens(i){let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;this._startLineNumber+=this._tokens.removeTokens(e,i.startColumn-1,t,i.endColumn-1),this._updateEndLineNumber()}split(i){let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber,[o,n,r]=this._tokens.split(e,i.startColumn-1,t,i.endColumn-1);return[new a(this._startLineNumber,o),new a(this._startLineNumber+r,n)]}applyEdit(i,e){let[t,o,n]=NI(e);this.acceptEdit(i,t,o,n,e.length>0?e.charCodeAt(0):0)}acceptEdit(i,e,t,o,n){this._acceptDeleteRange(i),this._acceptInsertText(new ye(i.startLineNumber,i.startColumn),e,t,o,n),this._updateEndLineNumber()}_acceptDeleteRange(i){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return;let e=i.startLineNumber-this._startLineNumber,t=i.endLineNumber-this._startLineNumber;if(t<0){let n=t-e;this._startLineNumber-=n;return}let o=this._tokens.getMaxDeltaLine();if(!(e>=o+1)){if(e<0&&t>=o+1){this._startLineNumber=0,this._tokens.clear();return}if(e<0){let n=-e;this._startLineNumber-=n,this._tokens.acceptDeleteRange(i.startColumn-1,0,0,t,i.endColumn-1)}else this._tokens.acceptDeleteRange(0,e,i.startColumn-1,t,i.endColumn-1)}}_acceptInsertText(i,e,t,o,n){if(e===0&&t===0)return;let r=i.lineNumber-this._startLineNumber;if(r<0){this._startLineNumber+=e;return}let s=this._tokens.getMaxDeltaLine();r>=s+1||this._tokens.acceptInsertText(r,i.column-1,e,t,o,n)}reportIfInvalid(i){this._tokens.reportIfInvalid(i,this._startLineNumber)}},Hfi=class a{constructor(i){this._tokens=i,this._tokenCount=i.length/4}toString(i){let e=[];for(let t=0;t<this._tokenCount;t++)e.push(`(${this._getDeltaLine(t)+i},${this._getStartCharacter(t)}-${this._getEndCharacter(t)})`);return`[${e.join(",")}]`}getMaxDeltaLine(){let i=this._getTokenCount();return i===0?-1:this._getDeltaLine(i-1)}getRange(){let i=this._getTokenCount();if(i===0)return null;let e=this._getStartCharacter(0),t=this._getDeltaLine(i-1),o=this._getEndCharacter(i-1);return new G(0,e+1,t,o+1)}_getTokenCount(){return this._tokenCount}_getDeltaLine(i){return this._tokens[4*i]}_getStartCharacter(i){return this._tokens[4*i+1]}_getEndCharacter(i){return this._tokens[4*i+2]}isEmpty(){return this._getTokenCount()===0}getLineTokens(i){let e=0,t=this._getTokenCount()-1;for(;e<t;){let o=e+Math.floor((t-e)/2),n=this._getDeltaLine(o);if(n<i)e=o+1;else if(n>i)t=o-1;else{let r=o;for(;r>e&&this._getDeltaLine(r-1)===i;)r--;let s=o;for(;s<t&&this._getDeltaLine(s+1)===i;)s++;return new tRt(this._tokens.subarray(4*r,4*s+4))}}return this._getDeltaLine(e)===i?new tRt(this._tokens.subarray(4*e,4*e+4)):null}clear(){this._tokenCount=0}removeTokens(i,e,t,o){let n=this._tokens,r=this._tokenCount,s=0,l=!1,c=0;for(let u=0;u<r;u++){let p=4*u,h=n[p],g=n[p+1],f=n[p+2],v=n[p+3];if((h>i||h===i&&f>=e)&&(h<t||h===t&&g<=o))l=!0;else{if(s===0&&(c=h),l){let b=4*s;n[b]=h-c,n[b+1]=g,n[b+2]=f,n[b+3]=v}else c!==0&&(n[p]=h-c);s++}}return this._tokenCount=s,c}split(i,e,t,o){let n=this._tokens,r=this._tokenCount,s=[],l=[],c=s,u=0,p=0;for(let h=0;h<r;h++){let g=4*h,f=n[g],v=n[g+1],b=n[g+2],S=n[g+3];if(f>i||f===i&&b>=e){if(f<t||f===t&&v<=o)continue;c!==l&&(c=l,u=0,p=f)}c[u++]=f-p,c[u++]=v,c[u++]=b,c[u++]=S}return[new a(new Uint32Array(s)),new a(new Uint32Array(l)),p]}acceptDeleteRange(i,e,t,o,n){let r=this._tokens,s=this._tokenCount,l=o-e,c=0,u=!1;for(let p=0;p<s;p++){let h=4*p,g=r[h],f=r[h+1],v=r[h+2],b=r[h+3];if(g<e||g===e&&v<=t){c++;continue}else if(g===e&&f<t)g===o&&v>n?v-=n-t:v=t;else if(g===e&&f===t)if(g===o&&v>n)v-=n-t;else{u=!0;continue}else if(g<o||g===o&&f<n)if(g===o&&v>n)g=e,f=t,v=f+(v-n);else{u=!0;continue}else if(g>o){if(l===0&&!u){c=s;break}g-=l}else if(g===o&&f>=n)i&&g===0&&(f+=i,v+=i),g-=l,f-=n-t,v-=n-t;else throw new Error("Not possible!");let S=4*c;r[S]=g,r[S+1]=f,r[S+2]=v,r[S+3]=b,c++}this._tokenCount=c}acceptInsertText(i,e,t,o,n,r){let s=t===0&&o===1&&(r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122),l=this._tokens,c=this._tokenCount;for(let u=0;u<c;u++){let p=4*u,h=l[p],g=l[p+1],f=l[p+2];if(!(h<i||h===i&&f<e)){if(h===i&&f===e)if(s)f+=1;else continue;else if(h===i&&g<e&&e<f)t===0?f+=o:f=e;else{if(h===i&&g===e&&s)continue;if(h===i)if(h+=t,t===0)g+=o,f+=o;else{let v=f-g;g=n+(g-e),f=g+v}else h+=t}l[p]=h,l[p+1]=g,l[p+2]=f}}}static{this._rateLimiter=new ZDt(10/60)}reportIfInvalid(i,e){for(let t=0;t<this._tokenCount;t++){let o=this._getDeltaLine(t)+e;o<1?a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber < 1")}):o>i.getLineCount()?a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber > model.getLineCount()")}):this._getEndCharacter(t)>i.getLineLength(o)&&a._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: end character > model.getLineLength(lineNumber)")})}}},tRt=class{constructor(i){this._tokens=i}getCount(){return this._tokens.length/4}getStartCharacter(i){return this._tokens[4*i+1]}getEndCharacter(i){return this._tokens[4*i+2]}getMetadata(i){return this._tokens[4*i+3]}};var iRt=!1,qTe=class{constructor(i,e,t,o){this._legend=i;this._themeService=e;this._languageService=t;this._logService=o;this._hasWarnedOverlappingTokens=!1;this._hasWarnedInvalidLengthTokens=!1;this._hasWarnedInvalidEditStart=!1;this._hashTable=new zfi}getMetadata(i,e,t){let o=this._languageService.languageIdCodec.encodeLanguageId(t),n=this._hashTable.get(i,e,o),r;if(n)r=n.metadata,iRt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling [CACHED] ${i} / ${e}: foreground ${Vp.getForeground(r)}, fontStyle ${Vp.getFontStyle(r).toString(2)}`);else{let s=this._legend.tokenTypes[i],l=[];if(s){let c=e;for(let p=0;c>0&&p<this._legend.tokenModifiers.length;p++)c&1&&l.push(this._legend.tokenModifiers[p]),c=c>>1;iRt&&c>0&&this._logService.getLevel()===1&&(this._logService.trace(`SemanticTokensProviderStyling: unknown token modifier index: ${e.toString(2)} for legend: ${JSON.stringify(this._legend.tokenModifiers)}`),l.push("not-in-legend"));let u=this._themeService.getColorTheme().getTokenStyleMetadata(s,l,t);if(typeof u>"u")r=2147483647;else{if(r=0,typeof u.italic<"u"){let p=(u.italic?1:0)<<11;r|=p|1}if(typeof u.bold<"u"){let p=(u.bold?2:0)<<11;r|=p|2}if(typeof u.underline<"u"){let p=(u.underline?4:0)<<11;r|=p|4}if(typeof u.strikethrough<"u"){let p=(u.strikethrough?8:0)<<11;r|=p|8}if(u.foreground){let p=u.foreground<<15;r|=p|16}r===0&&(r=2147483647)}}else iRt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling: unknown token type index: ${i} for legend: ${JSON.stringify(this._legend.tokenTypes)}`),r=2147483647,s="not-in-legend";this._hashTable.add(i,e,o,r),iRt&&this._logService.getLevel()===1&&this._logService.trace(`SemanticTokensProviderStyling ${i} (${s}) / ${e} (${l.join(" ")}): foreground ${Vp.getForeground(r)}, fontStyle ${Vp.getFontStyle(r).toString(2)}`)}return r}warnOverlappingSemanticTokens(i,e){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${i}, column ${e}`))}warnInvalidLengthSemanticTokens(i,e){this._hasWarnedInvalidLengthTokens||(this._hasWarnedInvalidLengthTokens=!0,this._logService.warn(`Semantic token with invalid length detected at lineNumber ${i}, column ${e}`))}warnInvalidEditStart(i,e,t,o,n){this._hasWarnedInvalidEditStart||(this._hasWarnedInvalidEditStart=!0,this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${i}, resultId: ${e}) at edit #${t}: The provided start offset ${o} is outside the previous data (length ${n}).`))}};qTe=I([m(1,Pe),m(2,Rt),m(3,re)],qTe);function oRt(a,i,e){let t=a.data,o=a.data.length/5|0,n=Math.max(Math.ceil(o/1024),400),r=[],s=0,l=1,c=0;for(;s<o;){let u=s,p=Math.min(u+n,o);if(p<o){let y=p;for(;y-1>u&&t[5*y]===0;)y--;if(y-1===u){let w=p;for(;w+1<o&&t[5*w]===0;)w++;p=w}else p=y}let h=new Uint32Array((p-u)*4),g=0,f=0,v=0,b=0;for(;s<p;){let y=5*s,w=t[y],x=t[y+1],E=l+w|0,M=w===0?c+x|0:x,N=t[y+2],V=M+N|0,H=t[y+3],K=t[y+4];if(V<=M)i.warnInvalidLengthSemanticTokens(E,M+1);else if(v===E&&b>M)i.warnOverlappingSemanticTokens(E,M+1);else{let j=i.getMetadata(H,K,e);j!==2147483647&&(f===0&&(f=E),h[g]=E-f,h[g+1]=M,h[g+2]=V,h[g+3]=j,g+=4,v=E,b=V)}l=E,c=M,s++}g!==h.length&&(h=h.subarray(0,g));let S=eRt.create(f,h);r.push(S)}return r}var Ufi=class{constructor(i,e,t,o){this.tokenTypeIndex=i,this.tokenModifierSet=e,this.languageId=t,this.metadata=o,this.next=null}},zfi=class a{static{this._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143]}constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=a._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<a._SIZES.length?2/3*this._currentLength:0),this._elements=[],a._nullOutEntries(this._elements,this._currentLength)}static _nullOutEntries(i,e){for(let t=0;t<e;t++)i[t]=null}_hash2(i,e){return(i<<5)-i+e|0}_hashFunc(i,e,t){return this._hash2(this._hash2(i,e),t)%this._currentLength}get(i,e,t){let o=this._hashFunc(i,e,t),n=this._elements[o];for(;n;){if(n.tokenTypeIndex===i&&n.tokenModifierSet===e&&n.languageId===t)return n;n=n.next}return null}add(i,e,t,o){if(this._elementsCount++,this._growCount!==0&&this._elementsCount>=this._growCount){let n=this._elements;this._currentLengthIndex++,this._currentLength=a._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<a._SIZES.length?2/3*this._currentLength:0),this._elements=[],a._nullOutEntries(this._elements,this._currentLength);for(let r of n){let s=r;for(;s;){let l=s.next;s.next=null,this._add(s),s=l}}}this._add(new Ufi(i,e,t,o))}_add(i){let e=this._hashFunc(i.tokenTypeIndex,i.tokenModifierSet,i.languageId);i.next=this._elements[e],this._elements[e]=i}};var Uue=le("semanticTokensStylingService");function cno(a){for(let i=0,e=a.length;i<e;i+=4){let t=a[i+0],o=a[i+1],n=a[i+2],r=a[i+3];a[i+0]=r,a[i+1]=n,a[i+2]=o,a[i+3]=t}}function e6o(a){let i=new Uint8Array(a.buffer,a.byteOffset,a.length*4);return n4e()||cno(i),Ke.wrap(i)}function t6o(a){let i=a.buffer;if(n4e()||cno(i),i.byteOffset%4===0)return new Uint32Array(i.buffer,i.byteOffset,i.length/4);{let e=new Uint8Array(i.byteLength);return e.set(i),new Uint32Array(e.buffer,e.byteOffset,e.length/4)}}function Kfi(a){let i=new Uint32Array(i6o(a)),e=0;if(i[e++]=a.id,a.type==="full")i[e++]=1,i[e++]=a.data.length,i.set(a.data,e),e+=a.data.length;else{i[e++]=2,i[e++]=a.deltas.length;for(let t of a.deltas)i[e++]=t.start,i[e++]=t.deleteCount,t.data?(i[e++]=t.data.length,i.set(t.data,e),e+=t.data.length):i[e++]=0}return e6o(i)}function i6o(a){let i=0;if(i+=2,a.type==="full")i+=1+a.data.length;else{i+=1,i+=3*a.deltas.length;for(let e of a.deltas)e.data&&(i+=e.data.length)}return i}function Gfi(a){let i=t6o(a),e=0,t=i[e++];if(i[e++]===1){let s=i[e++],l=i.subarray(e,e+s);return e+=s,{id:t,type:"full",data:l}}let n=i[e++],r=[];for(let s=0;s<n;s++){let l=i[e++],c=i[e++],u=i[e++],p;u>0&&(p=i.subarray(e,e+u),e+=u),r[s]={start:l,deleteCount:c,data:p}}return{id:t,type:"delta",deltas:r}}function t7e(a){return a&&!!a.data}function jfi(a){return a&&Array.isArray(a.edits)}var qfi=class{constructor(i,e,t){this.provider=i;this.tokens=e;this.error=t}};function Qfi(a,i){return a.has(i)}function o6o(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:[]}async function Yfi(a,i,e,t,o){let n=o6o(a,i),r=await Promise.all(n.map(async s=>{let l,c=null;try{l=await s.provideDocumentSemanticTokens(i,s===e?t:null,o)}catch(u){c=u,l=null}return(!l||!t7e(l)&&!jfi(l))&&(l=null),new qfi(s,l,c)}));for(let s of r){if(s.error)throw s.error;if(s.tokens)return s}return r.length>0?r[0]:null}function n6o(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:null}var $fi=class{constructor(i,e){this.provider=i;this.tokens=e}};function dno(a,i){return a.has(i)}function uno(a,i){let e=a.orderedGroups(i);return e.length>0?e[0]:[]}async function nRt(a,i,e,t){let o=uno(a,i),n=await Promise.all(o.map(async r=>{let s;try{s=await r.provideDocumentRangeSemanticTokens(i,e,t)}catch(l){vs(l),s=null}return(!s||!t7e(s))&&(s=null),new $fi(r,s)}));for(let r of n)if(r.tokens)return r;return n.length>0?n[0]:null}Ge.registerCommand("_provideDocumentSemanticTokensLegend",async(a,...i)=>{let[e]=i;To(e instanceof A);let t=a.get(_t).getModel(e);if(!t)return;let{documentSemanticTokensProvider:o}=a.get(Jt),n=n6o(o,t);return n?n[0].getLegend():a.get(fe).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)});Ge.registerCommand("_provideDocumentSemanticTokens",async(a,...i)=>{let[e]=i;To(e instanceof A);let t=a.get(_t).getModel(e);if(!t)return;let{documentSemanticTokensProvider:o}=a.get(Jt);if(!Qfi(o,t))return a.get(fe).executeCommand("_provideDocumentRangeSemanticTokens",e,t.getFullModelRange());let n=await Yfi(o,t,null,null,Ie.None);if(!n)return;let{provider:r,tokens:s}=n;if(!s||!t7e(s))return;let l=Kfi({id:0,type:"full",data:s.data});return s.resultId&&r.releaseDocumentSemanticTokens(s.resultId),l});Ge.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(a,...i)=>{let[e,t]=i;To(e instanceof A);let o=a.get(_t).getModel(e);if(!o)return;let{documentRangeSemanticTokensProvider:n}=a.get(Jt),r=uno(n,o);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!t||!G.isIRange(t))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();let s=await nRt(n,o,G.lift(t),Ie.None);if(s)return s.provider.getLegend()});Ge.registerCommand("_provideDocumentRangeSemanticTokens",async(a,...i)=>{let[e,t]=i;To(e instanceof A),To(G.isIRange(t));let o=a.get(_t).getModel(e);if(!o)return;let{documentRangeSemanticTokensProvider:n}=a.get(Jt),r=await nRt(n,o,G.lift(t),Ie.None);if(!(!r||!r.tokens))return Kfi({id:0,type:"full",data:r.tokens.data})});var zue="editor.semanticHighlighting";function $Te(a,i,e){let t=e.getValue(zue,{overrideIdentifier:a.getLanguageId(),resource:a.uri})?.enabled;return typeof t=="boolean"?t:i.getColorTheme().semanticHighlighting}var i7e=class extends k{constructor(e,t,o,n,r,s){super();this._watchers=new dt;this._providerChangeListeners=this._register(new O);let l=s.documentSemanticTokensProvider,c=g=>{this._watchers.get(g.uri)?.dispose(),this._watchers.set(g.uri,new I0(g,e,o,r,s))},u=(g,f)=>{f.dispose(),this._watchers.delete(g.uri)},p=()=>{for(let g of t.getModels()){let f=this._watchers.get(g.uri);$Te(g,o,n)?f||c(g):f&&u(g,f)}},h=()=>{this._providerChangeListeners.clear();for(let g of l.allNoModel())typeof g.onDidChange=="function"&&this._providerChangeListeners.add(g.onDidChange(()=>{for(let f of this._watchers.values())f.handleProviderDidChange(g)}))};t.getModels().forEach(g=>{$Te(g,o,n)&&c(g)}),this._register(t.onModelAdded(g=>{$Te(g,o,n)&&c(g)})),this._register(t.onModelRemoved(g=>{let f=this._watchers.get(g.uri);f&&u(g,f)})),this._register(n.onDidChangeConfiguration(g=>{g.affectsConfiguration(zue)&&p()})),this._register(o.onDidColorThemeChange(p)),h(),this._register(l.onDidChange(()=>{h();for(let g of this._watchers.values())g.handleRegistryChange()}))}dispose(){je(this._watchers.values()),this._watchers.clear(),super.dispose()}};i7e=I([m(0,Uue),m(1,_t),m(2,Pe),m(3,B),m(4,Gf),m(5,Jt)],i7e);var I0=class extends k{constructor(e,t,o,n,r){super();this._semanticTokensStylingService=t;this._relevantProviders=new Set;this._isDisposed=!1,this._model=e,this._provider=r.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:I0.REQUEST_MIN_DELAY,max:I0.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Dt(()=>this._fetchDocumentSemanticTokensNow(),I0.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._providersChangedDuringRequest=!1,this._updateRelevantProviders(),this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(0)})),this._register(o.onDidColorThemeChange(s=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}static{this.REQUEST_MIN_DELAY=300}static{this.REQUEST_MAX_DELAY=2e3}handleRegistryChange(){this._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}handleProviderDidChange(e){if(this._relevantProviders.has(e)){if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}}_updateRelevantProviders(){this._relevantProviders=new Set(this._provider.all(this._model))}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!Qfi(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;let e=new qe,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,o=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=Yfi(this._provider,this._model,t,o,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;let r=[],s=this._model.onDidChangeContent(c=>{r.push(c)}),l=new On(!1);n.then(c=>{if(this._debounceInformation.update(this._model,l.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),!c)this._setDocumentSemanticTokens(null,null,null,r);else{let{provider:u,tokens:p}=c,h=this._semanticTokensStylingService.getStyling(u);this._setDocumentSemanticTokens(u,p||null,h,r)}},c=>{c&&(Yi(c)||typeof c.message=="string"&&c.message.indexOf("busy")!==-1)||mt(c),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),(r.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,o,n,r){r=Math.min(r,o.length-n,e.length-t);for(let s=0;s<r;s++)o[n+s]=e[t+s]}_setDocumentSemanticTokens(e,t,o,n){let r=this._currentDocumentResponse,s=()=>{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!o){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),s();return}if(jfi(t)){if(!r){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:r.data};else{let l=0;for(let g of t.edits)l+=(g.data?g.data.length:0)-g.deleteCount;let c=r.data,u=new Uint32Array(c.length+l),p=c.length,h=u.length;for(let g=t.edits.length-1;g>=0;g--){let f=t.edits[g];if(f.start>c.length){o.warnInvalidEditStart(r.resultId,t.resultId,g,f.start,c.length),this._model.tokenization.setSemanticTokens(null,!0);return}let v=p-(f.start+f.deleteCount);v>0&&(I0._copy(c,p-v,u,h-v,v),h-=v),f.data&&(I0._copy(f.data,0,u,h-f.data.length,f.data.length),h-=f.data.length),p=f.start}p>0&&I0._copy(c,0,u,0,p),t={resultId:t.resultId,data:u}}}if(t7e(t)){this._currentDocumentResponse=new Xfi(e,t.resultId,t.data);let l=oRt(t,o,this._model.getLanguageId());if(n.length>0)for(let c of n)for(let u of l)for(let p of c.changes)u.applyEdit(p.range,p.text);this._model.tokenization.setSemanticTokens(l,!0)}else this._model.tokenization.setSemanticTokens(null,!0);s()}};I0=I([m(1,Uue),m(2,Pe),m(3,Gf),m(4,Jt)],I0);var Xfi=class{constructor(i,e,t){this.provider=i;this.resultId=e;this.data=t}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}};Qk(i7e);var mH=class extends k{constructor(e,t,o,n,r,s){super();this._semanticTokensStylingService=t;this._themeService=o;this._configurationService=n;this._editor=e,this._provider=s.documentRangeSemanticTokensProvider,this._debounceInformation=r.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new Dt(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[],this._rangeProvidersChangeListeners=[];let l=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))},c=()=>{if(this._cleanupProviderListeners(),this._editor.hasModel()){let u=this._editor.getModel();for(let p of this._provider.all(u)){let h=p.onDidChange?.(()=>{this._cancelAll(),l()});h&&this._rangeProvidersChangeListeners.push(h)}}};this._register(this._editor.onDidScrollChange(()=>{l()})),this._register(this._editor.onDidChangeModel(()=>{c(),this._cancelAll(),l()})),this._register(this._editor.onDidChangeModelLanguage(()=>{c(),this._cancelAll(),l()})),this._register(this._editor.onDidChangeModelContent(u=>{this._cancelAll(),l()})),c(),this._register(this._provider.onDidChange(()=>{c(),this._cancelAll(),l()})),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(zue)&&(this._cancelAll(),l())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),l()})),l()}static{this.ID="editor.contrib.viewportSemanticTokens"}static get(e){return e.getContribution(mH.ID)}dispose(){this._cleanupProviderListeners(),super.dispose()}_cleanupProviderListeners(){je(this._rangeProvidersChangeListeners),this._rangeProvidersChangeListeners=[]}_cancelAll(){for(let e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,o=this._outstandingRequests.length;t<o;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;let e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!$Te(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!dno(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}let t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(o=>this._requestRange(e,o)))}_requestRange(e,t){let o=e.getVersionId(),n=Hn(s=>Promise.resolve(nRt(this._provider,e,t,s))),r=new On(!1);return n.then(s=>{if(this._debounceInformation.update(e,r.elapsed()),!s||!s.tokens||e.isDisposed()||e.getVersionId()!==o)return;let{provider:l,tokens:c}=s,u=this._semanticTokensStylingService.getStyling(l);e.tokenization.setPartialSemanticTokens(t,oRt(c,u,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}};mH=I([m(1,Uue),m(2,Pe),m(3,B),m(4,Gf),m(5,Jt)],mH);Eo(mH.ID,mH,1);var rRt=class{constructor(i=!0){this.selectSubwords=i}provideSelectionRanges(i,e){let t=[];for(let o of e){let n=[];t.push(n),this.selectSubwords&&this._addInWordRanges(n,i,o),this._addWordRanges(n,i,o),this._addWhitespaceLine(n,i,o),n.push({range:i.getFullModelRange()})}return t}_addInWordRanges(i,e,t){let o=e.getWordAtPosition(t);if(!o)return;let{word:n,startColumn:r}=o,s=t.column-r,l=s,c=s,u=0;for(;l>=0;l--){let p=n.charCodeAt(l);if(l!==s&&(p===95||p===45))break;if(Cz(p)&&sT(u))break;u=p}for(l+=1;c<n.length;c++){let p=n.charCodeAt(c);if(sT(p)&&Cz(u))break;if(p===95||p===45)break;u=p}l<c&&i.push({range:new G(t.lineNumber,r+l,t.lineNumber,r+c)})}_addWordRanges(i,e,t){let o=e.getWordAtPosition(t);o&&i.push({range:new G(t.lineNumber,o.startColumn,t.lineNumber,o.endColumn)})}_addWhitespaceLine(i,e,t){e.getLineLength(t.lineNumber)>0&&e.getLineFirstNonWhitespaceColumn(t.lineNumber)===0&&e.getLineLastNonWhitespaceColumn(t.lineNumber)===0&&i.push({range:new G(t.lineNumber,1,t.lineNumber,e.getLineMaxColumn(t.lineNumber))})}};var Jfi=class a{constructor(i,e){this.index=i;this.ranges=e}mov(i){let e=this.index+(i?1:-1);if(e<0||e>=this.ranges.length)return this;let t=new a(e,this.ranges);return t.ranges[e].equalsRange(this.ranges[this.index])?t.mov(i):t}},y0=class{constructor(i,e){this._editor=i;this._languageFeaturesService=e;this._ignoreSelection=!1}static{this.ID="editor.contrib.smartSelectController"}static get(i){return i.getContribution(y0.ID)}dispose(){this._selectionListener?.dispose()}async run(i){if(!this._editor.hasModel())return;let e=this._editor.getSelections(),t=this._editor.getModel();if(this._state||await pno(this._languageFeaturesService.selectionRangeProvider,t,e.map(n=>n.getPosition()),this._editor.getOption(129),Ie.None).then(n=>{if(!(!Rr(n)||n.length!==e.length)&&!(!this._editor.hasModel()||!eo(this._editor.getSelections(),e,(r,s)=>r.equalsSelection(s)))){for(let r=0;r<n.length;r++)n[r]=n[r].filter(s=>s.containsPosition(e[r].getStartPosition())&&s.containsPosition(e[r].getEndPosition())),n[r].unshift(e[r]);this._state=n.map(r=>new Jfi(0,r)),this._selectionListener?.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{this._ignoreSelection||(this._selectionListener?.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(n=>n.mov(i));let o=this._state.map(n=>ei.fromPositions(n.ranges[n.index].getStartPosition(),n.ranges[n.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(o)}finally{this._ignoreSelection=!1}}};y0=I([m(1,Jt)],y0);var sRt=class extends Mi{constructor(i,e){super(e),this._forward=i}async run(i,e){let t=y0.get(e);t&&await t.run(this._forward)}},Zfi=class extends sRt{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:P(1575,"Expand Selection"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"1_basic",title:d(1573,null),order:2}})}};Ge.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");var evi=class extends sRt{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:P(1576,"Shrink Selection"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:R.MenubarSelectionMenu,group:"1_basic",title:d(1574,null),order:3}})}};Eo(y0.ID,y0,4);ri(Zfi);ri(evi);async function pno(a,i,e,t,o){let n=a.all(i).concat(new rRt(t.selectSubwords));n.length===1&&n.unshift(new pTe);let r=[],s=[];for(let l of n)r.push(Promise.resolve(l.provideSelectionRanges(i,e,o)).then(c=>{if(Rr(c)&&c.length===e.length)for(let u=0;u<e.length;u++){s[u]||(s[u]=[]);for(let p of c[u])G.isIRange(p.range)&&G.containsPosition(p.range,e[u])&&s[u].push(G.lift(p.range))}},vs));return await Promise.all(r),s.map(l=>{if(l.length===0)return[];l.sort((h,g)=>ye.isBefore(h.getStartPosition(),g.getStartPosition())?1:ye.isBefore(g.getStartPosition(),h.getStartPosition())||ye.isBefore(h.getEndPosition(),g.getEndPosition())?-1:ye.isBefore(g.getEndPosition(),h.getEndPosition())?1:0);let c=[],u;for(let h of l)(!u||G.containsRange(h,u)&&!G.equalsRange(h,u))&&(c.push(h),u=h);if(!t.selectLeadingAndTrailingWhitespace)return c;let p=[c[0]];for(let h=1;h<c.length;h++){let g=c[h-1],f=c[h];if(f.startLineNumber!==g.startLineNumber||f.endLineNumber!==g.endLineNumber){let v=new G(g.startLineNumber,i.getLineFirstNonWhitespaceColumn(g.startLineNumber),g.endLineNumber,i.getLineLastNonWhitespaceColumn(g.endLineNumber));v.containsRange(g)&&!v.equalsRange(g)&&f.containsRange(v)&&!f.equalsRange(v)&&p.push(v);let b=new G(g.startLineNumber,1,g.endLineNumber,i.getLineMaxColumn(g.endLineNumber));b.containsRange(g)&&!b.equalsRange(v)&&f.containsRange(b)&&!f.equalsRange(b)&&p.push(b)}p.push(f)}return p})}Ge.registerCommand("_executeSelectionRangeProvider",async function(a,...i){let[e,t]=i;To(A.isUri(e)),To(rii(t,r=>ye.isIPosition(r)));let o=a.get(Jt).selectionRangeProvider,n=await a.get(Bt).createModelReference(e);try{return pno(o,n.object.textEditorModel,t.map(ye.lift),{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},Ie.None)}finally{n.dispose()}});var Fe=Object.freeze({View:P(1820,"View"),Help:P(1817,"Help"),Test:P(1819,"Test"),File:P(1816,"File"),Preferences:P(1818,"Preferences"),Developer:P(1815,"Developer")});var aRt=class extends yl{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...P(1629,"Toggle Editor Sticky Scroll"),mnemonicTitle:d(1624,null)},metadata:{description:P(1630,"Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:Fe.View,toggled:{condition:C.equals("config.editor.stickyScroll.enabled",!0),title:d(1628,null),mnemonicTitle:d(1623,null)},menu:[{id:R.CommandPalette},{id:R.MenubarAppearanceMenu,group:"4_editor",order:3},{id:R.StickyScrollContext}]})}async runEditorCommand(i,e){let t=i.get(B),o=!t.getValue("editor.stickyScroll.enabled"),n=jy.get(e)?.isFocused();t.updateValue("editor.stickyScroll.enabled",o),n&&e.focus()}},mRt=100,lRt=class extends yl{constructor(){super({id:"editor.action.focusStickyScroll",title:{...P(1620,"Focus Editor Sticky Scroll"),mnemonicTitle:d(1622,null)},precondition:C.and(C.has("config.editor.stickyScroll.enabled"),me.stickyScrollVisible),menu:[{id:R.CommandPalette}]})}runEditorCommand(i,e){jy.get(e)?.focus()}},cRt=class extends yl{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:P(1626,"Select the next editor sticky scroll line"),precondition:me.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:mRt,primary:18}})}runEditorCommand(i,e){jy.get(e)?.focusNext()}},dRt=class extends yl{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:P(1627,"Select the previous sticky scroll line"),precondition:me.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:mRt,primary:16}})}runEditorCommand(i,e){jy.get(e)?.focusPrevious()}},uRt=class extends yl{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:P(1621,"Go to the focused sticky scroll line"),precondition:me.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:mRt,primary:3}})}runEditorCommand(i,e){jy.get(e)?.goToFocused()}},pRt=class extends yl{constructor(){super({id:"editor.action.selectEditor",title:P(1625,"Select Editor"),precondition:me.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:mRt,primary:9}})}runEditorCommand(i,e){jy.get(e)?.selectEditor()}};Eo(jy.ID,jy,1);W(aRt);W(lRt);W(dRt);W(cRt);W(uRt);W(pRt);var tvi=class{constructor(i,e,t,o,n,r,s){this.range=i;this.insertText=e;this.filterText=t;this.additionalTextEdits=o;this.command=n;this.gutterMenuLinkAction=r;this.completion=s;this.doNotLog=!0}},o7e=class extends hz{constructor(e,t,o,n,r,s){super(r.disposable);this.model=e;this.line=t;this.word=o;this.completionModel=n;this._suggestMemoryService=s}canBeReused(e,t,o){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===o.startColumn&&this.word.endColumn<o.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){let e=[],{items:t}=this.completionModel,o=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},t),n=yt.slice(t,o),r=yt.slice(t,0,o),s=5;for(let l of yt.concat(n,r)){if(l.score===Xv.Default)continue;let c=new G(l.editStart.lineNumber,l.editStart.column,l.editInsertEnd.lineNumber,l.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),u=l.completion.insertTextRules&&l.completion.insertTextRules&4?{snippet:l.completion.insertText}:l.completion.insertText;e.push(new tvi(c,u,l.filterTextLow??l.labelLow,l.completion.additionalTextEdits,l.completion.command,l.completion.action,l)),s-->=0&&l.resolve(Ie.None)}return e}};o7e=I([m(5,uTe)],o7e);var n7e=class extends k{constructor(e,t,o,n){super();this._languageFeatureService=e;this._clipboardService=t;this._suggestMemoryService=o;this._editorService=n;this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,o,n){if(o.selectedSuggestionInfo)return;let r;for(let f of this._editorService.listCodeEditors())if(f.getModel()===e){r=f;break}if(!r)return;let s=r.getOption(102);if(m2.isAllOff(s))return;e.tokenization.tokenizeIfCheap(t.lineNumber);let l=e.tokenization.getLineTokens(t.lineNumber),c=l.getStandardTokenType(l.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(m2.valueFor(s,c)!=="inline")return;let u=e.getWordAtPosition(t),p;if(u?.word||(p=this._getTriggerCharacterInfo(e,t)),!u?.word&&!p||(u||(u=e.getWordUntilPosition(t)),u.endColumn!==t.column))return;let h,g=e.getValueInRange(new G(t.lineNumber,1,t.lineNumber,t.column));if(!p&&this._lastResult?.canBeReused(e,t.lineNumber,u)){let f=new k9e(g,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=f,this._lastResult.acquire(),h=this._lastResult}else{let f=await _ue(this._languageFeatureService.completionProvider,e,t,new F4(void 0,f2.createSuggestFilter(r).itemKind,p?.providers),p&&{triggerKind:1,triggerCharacter:p.ch},n),v;f.needsClipboard&&(v=await this._clipboardService.readText());let b=new hTe(f.items,t.column,new k9e(g,0),mTe.None,r.getOption(134),r.getOption(128),{boostFullMatch:!1,firstMatchCanBeWeak:!1},v);h=new o7e(e,t.lineNumber,u,b,f,this._suggestMemoryService)}return this._lastResult=h,h}handleItemDidShow(e,t){t.completion.resolve(Ie.None)}disposeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){let o=e.getValueInRange(G.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),n=new Set;for(let r of this._languageFeatureService.completionProvider.all(e))r.triggerCharacters?.includes(o)&&n.add(r);if(n.size!==0)return{providers:n,ch:o}}};n7e=I([m(0,Jt),m(1,Bi),m(2,uTe),m(3,Qt)],n7e);Qk(n7e);var ivi=class extends Mi{constructor(){super({id:"editor.action.forceRetokenize",label:P(1707,"Developer: Force Retokenize"),precondition:void 0})}run(i,e){if(!e.hasModel())return;let t=e.getModel();t.tokenization.resetTokenization();let o=new On;t.tokenization.forceTokenization(t.getLineCount()),o.stop(),console.log(`tokenization took ${o.elapsed()}`)}};ri(ivi);var r7e=class a extends z{static{this.ID="editor.action.toggleTabFocusMode"}constructor(){super({id:a.ID,title:P(1704,"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:P(1703,"Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){let e=!vD.getTabFocusMode();vD.setTabFocusMode(e),e?cn(d(1706,null)):cn(d(1705,null))}};W(r7e);var Bg=class extends k{constructor(e,t,o={},n,r){super();this._link=t;this._hoverService=n;this._enabled=!0;this.el=D(e,_("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=o.hoverDelegate??yi("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");let s=this._register(new Zn(this.el,"click")),l=this._register(new Zn(this.el,"keydown")),c=U.chain(l.event,h=>h.map(g=>new mi(g)).filter(g=>g.keyCode===3||g.keyCode===10)),u=this._register(new Zn(this.el,Vn.Tap)).event;this._register(ds.addTarget(this.el));let p=U.any(s.event,c,u);this._register(p(h=>{this.enabled&&(Kt.stop(h,!0),o?.opener?o.opener(this._link.href):r.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}set link(e){typeof e.label=="string"?this.el.textContent=e.label:(St(this.el),this.el.appendChild(e.label)),this.el.href=e.href,typeof e.tabIndex<"u"&&(this.el.tabIndex=e.tabIndex),this.setTooltip(e.title),this._link=e}setTooltip(e){!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};Bg=I([m(3,ot),m(4,Je)],Bg);var r6o=26,jTe=class extends k{constructor(e,t){super();this._editor=e;this.instantiationService=t;this.banner=this._register(this.instantiationService.createInstance(s7e))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{this.hide(),e.onClose?.()}}),this._editor.setBanner(this.banner.element,r6o)}};jTe=I([m(1,F)],jTe);var s7e=class extends k{constructor(e,t){super();this.instantiationService=e;this.markdownRendererService=t;this.element=_("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){let t=_("span");return t.innerText=e,t}return this.markdownRendererService.render(e).element}clear(){St(this.element)}show(e){St(this.element);let t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);let o=D(this.element,_("div.icon-container"));o.setAttribute("aria-hidden","true"),e.icon&&o.appendChild(_(`div${q.asCSSSelector(e.icon)}`));let n=D(this.element,_("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=D(this.element,_("div.message-actions-container")),e.actions)for(let s of e.actions)this._register(this.instantiationService.createInstance(Bg,this.messageActionsContainer,{...s,tabIndex:-1},{}));let r=D(this.element,_("div.action-container"));this.actionBar=this._register(new oo(r)),this.actionBar.push(this._register(new it("banner.close",d(1708,null),q.asClassName(MT),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};s7e=I([m(0,F),m(1,_n)],s7e);var yM=le("workspaceTrustEnablementService"),Or=le("workspaceTrustManagementService");var lp=le("workspaceTrustRequestService");var s6o=Oe("extensions-warning-message",L.warning,d(1732,null)),Kue=class extends k{constructor(e,t,o,n){super();this._editor=e;this._editorWorkerService=t;this._workspaceTrustService=o;this._highlighter=null;this._bannerClosed=!1;this._updateState=e=>{if(e&&e.hasMore){if(this._bannerClosed)return;let t=Math.max(e.ambiguousCharacterCount,e.nonBasicAsciiCharacterCount,e.invisibleCharacterCount),o;if(e.nonBasicAsciiCharacterCount>=t)o={message:d(1731,null),command:new d7e};else if(e.ambiguousCharacterCount>=t)o={message:d(1729,null),command:new Gue};else if(e.invisibleCharacterCount>=t)o={message:d(1730,null),command:new c7e};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:o.message,icon:s6o,actions:[{label:o.command.shortLabel,href:`command:${o.command.desc.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()};this._bannerController=this._register(n.createInstance(jTe,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(142),this._register(o.onDidChangeTrust(r=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(r=>{r.hasChanged(142)&&(this._options=e.getOption(142),this._updateHighlighter())})),this._updateHighlighter()}static{this.ID="editor.contrib.unicodeHighlighter"}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;let e=a6o(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(o=>o===!1))return;let t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(o=>o.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(o=>o==="_os"?nd.NumberFormat().value.resolvedOptions().locale:o==="_vscode"?Kr:o)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new a7e(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new nvi(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};Kue=I([m(1,Qs),m(2,Or),m(3,F)],Kue);function a6o(a,i){return{nonBasicASCII:i.nonBasicASCII===gD?!a:i.nonBasicASCII,ambiguousCharacters:i.ambiguousCharacters,invisibleCharacters:i.invisibleCharacters,includeComments:i.includeComments===gD?!a:i.includeComments,includeStrings:i.includeStrings===gD?!a:i.includeStrings,allowedCharacters:i.allowedCharacters,allowedLocales:i.allowedLocales}}var a7e=class extends k{constructor(e,t,o,n){super();this._editor=e;this._options=t;this._updateState=o;this._editorWorkerService=n;this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Dt(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}let e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);let o=[];if(!t.hasMore)for(let n of t.ranges)o.push({range:n,options:hRt.instance.getDecorationFromOptions(this._options)});this._decorations.set(o)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel();if(!B3e(t,e))return null;let o=t.getValueInRange(e.range);return{reason:hno(o,this._options),inComment:fyt(t,e),inString:vyt(t,e)}}};a7e=I([m(3,Qs)],a7e);var nvi=class extends k{constructor(e,t,o){super();this._editor=e;this._options=t;this._updateState=o;this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Dt(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}let e=this._editor.getVisibleRanges(),t=[],o={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(let n of e){let r=Lce.computeUnicodeHighlights(this._model,this._options,n);for(let s of r.ranges)o.ranges.push(s);o.ambiguousCharacterCount+=o.ambiguousCharacterCount,o.invisibleCharacterCount+=o.invisibleCharacterCount,o.nonBasicAsciiCharacterCount+=o.nonBasicAsciiCharacterCount,o.hasMore=o.hasMore||r.hasMore}if(!o.hasMore)for(let n of o.ranges)t.push({range:n,options:hRt.instance.getDecorationFromOptions(this._options)});this._updateState(o),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel(),o=t.getValueInRange(e.range);return B3e(t,e)?{reason:hno(o,this._options),inComment:fyt(t,e),inString:vyt(t,e)}:null}};var mno=d(1721,null),l7e=class{constructor(i,e){this._editor=i;this._markdownRendererService=e;this.hoverOrdinal=5}computeSync(i,e){if(!this._editor.hasModel()||i.type!==1)return[];let t=this._editor.getModel(),o=this._editor.getContribution(Kue.ID);if(!o)return[];let n=[],r=new Set,s=300;for(let l of e){let c=o.getDecorationInfo(l);if(!c)continue;let p=t.getValueInRange(l.range).codePointAt(0),h=ovi(p),g;switch(c.reason.kind){case 0:{xz(c.reason.confusableWith)?g=d(1718,null,h,ovi(c.reason.confusableWith.codePointAt(0))):g=d(1717,null,h,ovi(c.reason.confusableWith.codePointAt(0)));break}case 1:g=d(1719,null,h);break;case 2:g=d(1720,null,h);break}if(r.has(g))continue;r.add(g);let f={codePoint:p,reason:c.reason,inComment:c.inComment,inString:c.inString},v=d(1715,null),b=nc(gRt.ID,f),S=new he("",!0).appendMarkdown(g).appendText(" ").appendLink(b,v,mno);n.push(new UT(this,l.range,[S],!1,s++))}return n}renderHoverParts(i,e){return Ato(i,e,this._editor,this._markdownRendererService)}getAccessibleContent(i){return i.contents.map(e=>e.value).join(`
`)}};l7e=I([m(1,_n)],l7e);function rvi(a){return`U+${a.toString(16).padStart(4,"0")}`}function ovi(a){let i=`\`${rvi(a)}\``;return mB.isInvisibleCharacter(a)||(i+=` "${`${l6o(a)}`}"`),i}function l6o(a){return a===96?"`` ` ``":"`"+String.fromCodePoint(a)+"`"}function hno(a,i){return Lce.computeUnicodeHighlightReason(a,i)}var hRt=class a{constructor(){this.map=new Map}static{this.instance=new a}getDecorationFromOptions(i){return this.getDecoration(!i.includeComments,!i.includeStrings)}getDecoration(i,e){let t=`${i}${e}`,o=this.map.get(t);return o||(o=So.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:i,hideInStringTokens:e}),this.map.set(t,o)),o}},svi=class extends Mi{constructor(){super({id:Gue.ID,label:P(1709,"Disable highlighting of characters in comments"),precondition:void 0});this.shortLabel=d(1722,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingInComments"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Lk.includeComments,!1,2)}},avi=class extends Mi{constructor(){super({id:Gue.ID,label:P(1710,"Disable highlighting of characters in strings"),precondition:void 0});this.shortLabel=d(1723,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingInStrings"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Lk.includeStrings,!1,2)}},Gue=class a extends z{constructor(){super({id:a.ID,title:P(1711,"Disable highlighting of ambiguous characters"),precondition:void 0,f1:!1});this.shortLabel=d(1724,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Lk.ambiguousCharacters,!1,2)}},c7e=class a extends z{constructor(){super({id:a.ID,title:P(1712,"Disable highlighting of invisible characters"),precondition:void 0,f1:!1});this.shortLabel=d(1725,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Lk.invisibleCharacters,!1,2)}},d7e=class a extends z{constructor(){super({id:a.ID,title:P(1713,"Disable highlighting of non basic ASCII characters"),precondition:void 0,f1:!1});this.shortLabel=d(1726,null)}static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters"}async run(e,t){let o=e.get(B);o&&this.runAction(o)}async runAction(e){await e.updateValue(Lk.nonBasicASCII,!1,2)}},gRt=class a extends z{static{this.ID="editor.action.unicodeHighlight.showExcludeOptions"}constructor(){super({id:a.ID,title:P(1714,"Show Exclude Options"),precondition:void 0,f1:!1})}async run(i,e){let{codePoint:t,reason:o,inString:n,inComment:r}=e,s=String.fromCodePoint(t),l=i.get($e),c=i.get(B);function u(f){return mB.isInvisibleCharacter(f)?d(1728,null,rvi(f)):d(1727,null,`${rvi(f)} "${s}"`)}let p=[];if(o.kind===0)for(let f of o.notAmbiguousInLocales)p.push({label:d(1716,null,f),run:async()=>{d6o(c,[f])}});if(p.push({label:u(t),run:()=>c6o(c,[t])}),r){let f=new svi;p.push({label:f.label,run:async()=>f.runAction(c)})}else if(n){let f=new avi;p.push({label:f.label,run:async()=>f.runAction(c)})}function h(f){return typeof f.desc.title=="string"?f.desc.title:f.desc.title.value}if(o.kind===0){let f=new Gue;p.push({label:h(f),run:async()=>f.runAction(c)})}else if(o.kind===1){let f=new c7e;p.push({label:h(f),run:async()=>f.runAction(c)})}else if(o.kind===2){let f=new d7e;p.push({label:h(f),run:async()=>f.runAction(c)})}else u6o(o);let g=await l.pick(p,{title:mno});g&&await g.run()}};async function c6o(a,i){let e=a.getValue(Lk.allowedCharacters),t;typeof e=="object"&&e?t=e:t={};for(let o of i)t[String.fromCodePoint(o)]=!0;await a.updateValue(Lk.allowedCharacters,t,2)}async function d6o(a,i){let e=a.inspect(Lk.allowedLocales).user?.value,t;typeof e=="object"&&e?t=Object.assign({},e):t={};for(let o of i)t[o]=!0;await a.updateValue(Lk.allowedLocales,t,2)}function u6o(a){throw new Error(`Unexpected value: ${a}`)}W(Gue);W(c7e);W(d7e);W(gRt);Eo(Kue.ID,Kue,1);PD.register(l7e);var gno="ignoreUnusualLineTerminators";function p6o(a,i,e){a.setModelProperty(i.uri,gno,e)}function m6o(a,i){return a.getModelProperty(i.uri,gno)}var XJ=class extends k{constructor(e,t,o){super();this._editor=e;this._dialogService=t;this._codeEditorService=o;this._isPresentingDialog=!1;this._config=this._editor.getOption(143),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(143)&&(this._config=this._editor.getOption(143),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(n=>{n.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}static{this.ID="editor.contrib.unusualLineTerminatorsDetector"}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;let e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||m6o(this._codeEditorService,e)===!0||this._editor.getOption(104))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let o;try{this._isPresentingDialog=!0,o=await this._dialogService.confirm({title:d(1737,null),message:d(1736,null),detail:d(1733,null,Be(e.uri)),primaryButton:d(1734,null),cancelButton:d(1735,null)})}finally{this._isPresentingDialog=!1}if(!o.confirmed){p6o(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};XJ=I([m(1,ct),m(2,Qt)],XJ);Eo(XJ.ID,XJ,1);function dvi(){return Object.create(null)}var u7e="**",fno="/",fRt="[/\\\\]",vRt="[^/\\\\]",h6o=/\//g;function vno(a,i){switch(a){case 0:return"";case 1:return`${vRt}*?`;default:return`(?:${fRt}|${vRt}+${fRt}${i?`|${fRt}${vRt}+`:""})*?`}}function wM(a,i){if(!a)return[];let e=[],t=!1,o=!1,n="";for(let r of a){switch(r){case i:if(!t&&!o){e.push(n),n="";continue}break;case"{":t=!0;break;case"}":t=!1;break;case"[":o=!0;break;case"]":o=!1;break}n+=r}return n&&e.push(n),e}function yno(a){if(!a)return"";let i="",e=wM(a,fno);if(e.every(t=>t===u7e))i=".*";else{let t=!1;e.forEach((o,n)=>{if(o===u7e){if(t)return;i+=vno(2,n===e.length-1)}else{let r=!1,s="",l=!1,c="";for(let u of o){if(u!=="}"&&r){s+=u;continue}if(l&&(u!=="]"||!c)){let p;u==="-"?p=u:(u==="^"||u==="!")&&!c?p="^":u===fno?p="":p=Ss(u),c+=p;continue}switch(u){case"{":r=!0;continue;case"[":l=!0;continue;case"}":{let h=`(?:${wM(s,",").map(g=>yno(g)).join("|")})`;i+=h,r=!1,s="";break}case"]":{i+="["+c+"]",l=!1,c="";break}case"?":i+=vRt;continue;case"*":i+=vno(1);continue;default:i+=Ss(u)}}n<e.length-1&&(e[n+1]!==u7e||n+2<e.length)&&(i+=fRt)}t=o===u7e})}return i}var g6o=/^\*\*\/\*\.[\w\.-]+$/,f6o=/^\*\*\/([\w\.-]+)\/?$/,v6o=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,b6o=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,S6o=/^\*\*((\/[\w\.-]+)+)\/?$/,I6o=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,bno=new Ua(1e4),cvi=function(){return!1},hH=function(){return null};function uvi(a){return a===cvi||a===hH}function pvi(a,i){if(!a)return hH;let e;typeof a!="string"?e=a.pattern:e=a,e=e.trim();let t=i.ignoreCase??!1,o={...i,equals:t?xr:(l,c)=>l===c,endsWith:t?Jvt:(l,c)=>l.endsWith(c),isEqualOrParent:(l,c)=>Nle(l,c,i.ignoreCase??!Sn)},n=`${t?e.toLowerCase():e}_${!!i.trimForExclusions}_${t}`,r=bno.get(n);if(r)return Sno(r,a,o);let s;return g6o.test(e)?r=y6o(e.substring(4),e,o):(s=f6o.exec(lvi(e,o)))?r=w6o(s[1],e,o):(i.trimForExclusions?b6o:v6o).test(e)?r=C6o(e,o):(s=S6o.exec(lvi(e,o)))?r=Ino(s[1].substring(1),e,!0,o):(s=I6o.exec(lvi(e,o)))?r=Ino(s[1],e,!1,o):r=x6o(e,o),bno.set(n,r),Sno(r,a,o)}function Sno(a,i,e){if(typeof i=="string")return a;let t=function(o,n){return e.isEqualOrParent(o,i.base)?a(ax(o.substring(i.base.length),Cu),n):null};return t.allBasenames=a.allBasenames,t.allPaths=a.allPaths,t.basenames=a.basenames,t.patterns=a.patterns,t}function lvi(a,i){return i.trimForExclusions&&a.endsWith("/**")?a.substring(0,a.length-2):a}function y6o(a,i,e){return function(t,o){return typeof t=="string"&&e.endsWith(t,a)?i:null}}function w6o(a,i,e){let t=`/${a}`,o=`\\${a}`,n=function(s,l){return typeof s!="string"?null:l?e.equals(l,a)?i:null:e.equals(s,a)||e.endsWith(s,t)||e.endsWith(s,o)?i:null},r=[a];return n.basenames=r,n.patterns=[i],n.allBasenames=r,n}function C6o(a,i){let e=wno(a.slice(1,-1).split(",").map(s=>pvi(s,i)).filter(s=>s!==hH),a),t=e.length;if(!t)return hH;if(t===1)return e[0];let o=function(s,l){for(let c=0,u=e.length;c<u;c++)if(e[c](s,l))return a;return null},n=e.find(s=>!!s.allBasenames);n&&(o.allBasenames=n.allBasenames);let r=e.reduce((s,l)=>l.allPaths?s.concat(l.allPaths):s,[]);return r.length&&(o.allPaths=r),o}function Ino(a,i,e,t){let o=Cu===Vo.sep,n=o?a:a.replace(h6o,Cu),r=Cu+n,s=Vo.sep+a,l;return e?l=function(c,u){return typeof c=="string"&&(t.equals(c,n)||t.endsWith(c,r)||!o&&(t.equals(c,a)||t.endsWith(c,s)))?i:null}:l=function(c,u){return typeof c=="string"&&(t.equals(c,n)||!o&&t.equals(c,a))?i:null},l.allPaths=[(e?"*/":"./")+a],l}function x6o(a,i){try{let e=new RegExp(`^${yno(a)}$`,i.ignoreCase?"i":void 0);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?a:null}}catch{return hH}}function qd(a,i,e){return!a||typeof i!="string"?!1:Eh(a,e)(i)}function Eh(a,i={}){if(!a)return cvi;if(typeof a=="string"||GA(a)){let e=pvi(a,i);if(e===hH)return cvi;let t=function(o,n){return!!e(o,n)};return e.allBasenames&&(t.allBasenames=e.allBasenames),e.allPaths&&(t.allPaths=e.allPaths),t}return k6o(a,i)}function GA(a){let i=a;return i?typeof i.base=="string"&&typeof i.pattern=="string":!1}function k6o(a,i){let e=wno(Object.getOwnPropertyNames(a).map(s=>E6o(s,a[s],i)).filter(s=>s!==hH)),t=e.length;if(!t)return hH;if(!e.some(s=>!!s.requiresSiblings)){if(t===1)return e[0];let s=function(u,p){let h;for(let g=0,f=e.length;g<f;g++){let v=e[g](u,p);if(typeof v=="string")return v;aD(v)&&(h||(h=[]),h.push(v))}return h?(async()=>{for(let g of h){let f=await g;if(typeof f=="string")return f}return null})():null},l=e.find(u=>!!u.allBasenames);l&&(s.allBasenames=l.allBasenames);let c=e.reduce((u,p)=>p.allPaths?u.concat(p.allPaths):u,[]);return c.length&&(s.allPaths=c),s}let o=function(s,l,c){let u,p;for(let h=0,g=e.length;h<g;h++){let f=e[h];f.requiresSiblings&&c&&(l||(l=Jo(s)),u||(u=l.substring(0,l.length-km(s).length)));let v=f(s,l,u,c);if(typeof v=="string")return v;aD(v)&&(p||(p=[]),p.push(v))}return p?(async()=>{for(let h of p){let g=await h;if(typeof g=="string")return g}return null})():null},n=e.find(s=>!!s.allBasenames);n&&(o.allBasenames=n.allBasenames);let r=e.reduce((s,l)=>l.allPaths?s.concat(l.allPaths):s,[]);return r.length&&(o.allPaths=r),o}function E6o(a,i,e){if(i===!1)return hH;let t=pvi(a,e);if(t===hH)return hH;if(typeof i=="boolean")return t;if(i){let o=i.when;if(typeof o=="string"){let n=(r,s,l,c)=>{if(!c||!t(r,s))return null;let u=o.replace("$(basename)",()=>l),p=c(u);return aD(p)?p.then(h=>h?a:null):p?a:null};return n.requiresSiblings=!0,n}}return t}function wno(a,i){let e=a.filter(s=>!!s.basenames);if(e.length<2)return a;let t=e.reduce((s,l)=>{let c=l.basenames;return c?s.concat(c):s},[]),o;if(i){o=[];for(let s=0,l=t.length;s<l;s++)o.push(i)}else o=e.reduce((s,l)=>{let c=l.patterns;return c?s.concat(c):s},[]);let n=function(s,l){if(typeof s!="string")return null;if(!l){let u;for(u=s.length;u>0;u--){let p=s.charCodeAt(u-1);if(p===47||p===92)break}l=s.substring(u)}let c=t.indexOf(l);return c!==-1?o[c]:null};n.basenames=t,n.patterns=o,n.allBasenames=t;let r=a.filter(s=>!s.basenames);return r.push(n),r}function gH(a,i,e,t,o,n){if(Array.isArray(a)){let r=0;for(let s of a){let l=gH(s,i,e,t,o,n);if(l===10)return l;l>r&&(r=l)}return r}else{if(typeof a=="string")return t?a==="*"?5:a===e?10:0:0;if(a){let{language:r,pattern:s,scheme:l,hasAccessToAllModels:c,notebookType:u}=a;if(!t&&!c)return 0;u&&o&&(i=o);let p=0;if(l)if(l===i.scheme)p=10;else if(l==="*")p=5;else return 0;if(r)if(r===e)p=10;else if(r==="*")p=Math.max(p,5);else return 0;if(u)if(u===n)p=10;else if(u==="*"&&n!==void 0)p=Math.max(p,5);else return 0;if(s){let h;if(typeof s=="string"?h=s:h={...s,base:Vh(s.base)},h===i.fsPath||qd(h,i.fsPath))p=10;else return 0}return p}else return 0}}function mvi(a,i){if(typeof a=="string")i.add(a);else if(Array.isArray(a))for(let e of a)mvi(e,i);else{let e=a.language;e&&i.add(e)}}var bRt=class{constructor(){this.selector={language:"*"}}provideDocumentHighlights(i,e,t){if(i.isDisposed())return;let o=[],n=i.getWordAtPosition({lineNumber:e.lineNumber,column:e.column});return n?i.findMatches(n.word,!0,!1,!0,kB,!1).map(s=>({range:s.range,kind:0})):Promise.resolve(o)}provideMultiDocumentHighlights(i,e,t,o){if(i.isDisposed())return;let n=new dt,r=i.getWordAtPosition({lineNumber:e.lineNumber,column:e.column});if(!r)return Promise.resolve(n);for(let s of[i,...t]){if(s.isDisposed())continue;let c=s.findMatches(r.word,!0,!1,!0,kB,!1).map(u=>({range:u.range,kind:0}));c&&n.set(s.uri,c)}return n}},QTe=class extends k{constructor(i){super(),this._register(i.documentHighlightProvider.register("*",new bRt)),this._register(i.multiDocumentHighlightProvider.register("*",new bRt))}};QTe=I([m(0,Jt)],QTe);var Svi=new Y("hasWordHighlights",!1);function Cno(a,i,e,t){let o=a.ordered(i);return Ule(o.map(n=>()=>Promise.resolve(n.provideDocumentHighlights(i,e,t)).then(void 0,vs)),n=>n!=null).then(n=>{if(n){let r=new dt;return r.set(i.uri,n),r}return new dt})}function T6o(a,i,e,t,o){let n=a.ordered(i);return Ule(n.map(r=>()=>{let s=o.filter(l=>Pk(l)).filter(l=>gH(r.selector,l.uri,l.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(r.provideMultiDocumentHighlights(i,e,s,t)).then(void 0,vs)}),r=>r!=null)}var SRt=class{constructor(i,e,t){this._model=i;this._selection=e;this._wordSeparators=t;this._wordRange=this._getCurrentWordRange(i,e),this._result=null}get result(){return this._result||(this._result=Hn(i=>this._compute(this._model,this._selection,this._wordSeparators,i))),this._result}_getCurrentWordRange(i,e){let t=i.getWordAtPosition(e.getPosition());return t?new G(e.startLineNumber,t.startColumn,e.startLineNumber,t.endColumn):null}isValid(i,e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endColumn,s=this._getCurrentWordRange(i,e),l=!!(this._wordRange&&this._wordRange.equalsRange(s));for(let c=0,u=t.length;!l&&c<u;c++){let p=t.getRange(c);p&&p.startLineNumber===o&&p.startColumn<=n&&p.endColumn>=r&&(l=!0)}return l}cancel(){this.result.cancel()}},hvi=class extends SRt{constructor(i,e,t,o){super(i,e,t),this._providers=o}_compute(i,e,t,o){return Cno(this._providers,i,e.getPosition(),o).then(n=>n||new dt)}},gvi=class extends SRt{constructor(i,e,t,o,n){super(i,e,t),this._providers=o,this._otherModels=n}_compute(i,e,t,o){return T6o(this._providers,i,e.getPosition(),o,this._otherModels).then(n=>n||new dt)}};function _6o(a,i,e,t){return new hvi(i,e,t,a)}function D6o(a,i,e,t,o){return new gvi(i,e,t,a,o)}kI("_executeDocumentHighlights",async(a,i,e)=>{let t=a.get(Jt);return(await Cno(t.documentHighlightProvider,i,e,Ie.None))?.get(i.uri)});var $p=class{constructor(i,e,t,o,n,r,s,l){this.toUnhook=new O;this.workerRequestTokenId=0;this.workerRequestCompleted=!1;this.workerRequestValue=new dt;this.lastCursorPositionChangeTime=0;this.renderDecorationsTimer=void 0;this.runDelayer=this.toUnhook.add(new rn(50));this.editor=i,this.providers=e,this.multiDocumentProviders=t,this.codeEditorService=r,this.textModelService=n,this.configurationService=s,this.logService=l,this._hasWordHighlights=Svi.bindTo(o),this._ignorePositionChangeEvent=!1,this.occurrencesHighlightEnablement=this.editor.getOption(90),this.occurrencesHighlightDelay=this.configurationService.getValue("editor.occurrencesHighlightDelay"),this.model=this.editor.getModel(),this.toUnhook.add(i.onDidChangeCursorPosition(c=>{this._ignorePositionChangeEvent||this.occurrencesHighlightEnablement!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(c)}).catch(mt)})),this.toUnhook.add(i.onDidFocusEditorText(c=>{this.occurrencesHighlightEnablement!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}).catch(mt))})),this.toUnhook.add(i.onDidChangeModelContent(c=>{hc(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(i.onDidChangeModel(c=>{!c.newModelUrl&&c.oldModelUrl?this._stopSingular():$p.query&&this._run()})),this.toUnhook.add(i.onDidChangeConfiguration(c=>{let u=this.editor.getOption(90);if(this.occurrencesHighlightEnablement!==u)switch(this.occurrencesHighlightEnablement=u,u){case"off":this._stopAll();break;case"singleFile":this._stopAll($p.query?.modelInfo?.modelURI);break;case"multiFile":$p.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",u);break}})),this.toUnhook.add(this.configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("editor.occurrencesHighlightDelay")){let u=s.getValue("editor.occurrencesHighlightDelay");this.occurrencesHighlightDelay!==u&&(this.occurrencesHighlightDelay=u)}})),this.toUnhook.add(i.onDidBlurEditorWidget(()=>{let c=this.codeEditorService.getFocusedCodeEditor();c?c.getModel()?.uri.scheme===Q.vscodeNotebookCell&&this.editor.getModel()?.uri.scheme!==Q.vscodeNotebookCell&&this._stopAll():this._stopAll()})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=void 0,$p.query&&this._run()}static{this.storedDecorationIDs=new dt}static{this.query=null}hasDecorations(){return this.decorations.length>0}restore(i){this.occurrencesHighlightEnablement!=="off"&&(this.runDelayer.cancel(),this.runDelayer.trigger(()=>{this._run(!1,i)}).catch(mt))}trigger(){this.runDelayer.cancel(),this._run(!1,0)}stop(){this.occurrencesHighlightEnablement!=="off"&&this._stopAll()}_getSortedHighlights(){return this.decorations.getRanges().sort(G.compareRangesUsingStarts)}moveNext(){let i=this._getSortedHighlights(),t=(i.findIndex(n=>n.containsPosition(this.editor.getPosition()))+1)%i.length,o=i[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(o.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(o);let n=this._getWord();if(n){let r=this.editor.getModel().getLineContent(o.startLineNumber);cn(`${r}, ${t+1} of ${i.length} for '${n.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){let i=this._getSortedHighlights(),t=(i.findIndex(n=>n.containsPosition(this.editor.getPosition()))-1+i.length)%i.length,o=i[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(o.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(o);let n=this._getWord();if(n){let r=this.editor.getModel().getLineContent(o.startLineNumber);cn(`${r}, ${t+1} of ${i.length} for '${n.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;let i=$p.storedDecorationIDs.get(this.editor.getModel().uri);i&&(this.editor.removeDecorations(i),$p.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(i){let e=this.codeEditorService.listCodeEditors(),t=[];for(let o of e){if(!o.hasModel()||ze(o.getModel().uri,i))continue;let n=$p.storedDecorationIDs.get(o.getModel().uri);if(!n)continue;o.removeDecorations(n),t.push(o.getModel().uri);let r=US.get(o);r?.wordHighlighter&&r.wordHighlighter.decorations.length>0&&(r.wordHighlighter.decorations.clear(),r.wordHighlighter.workerRequest=null,r.wordHighlighter._hasWordHighlights.set(!1))}for(let o of t)$p.storedDecorationIDs.delete(o)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==Q.vscodeNotebookCell&&$p.query?.modelInfo?.modelURI.scheme!==Q.vscodeNotebookCell?($p.query=null,this._run()):$p.query?.modelInfo&&($p.query.modelInfo=null)),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(i){this._removeAllDecorations(i),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(i){if(this.occurrencesHighlightEnablement==="off"){this._stopAll();return}if(i.source!=="api"&&i.reason!==3){this._stopAll();return}this._run()}_getWord(){let i=this.editor.getSelection(),e=i.startLineNumber,t=i.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:e,column:t})}getOtherModelsToHighlight(i){if(!i)return[];if(i.uri.scheme===Q.vscodeNotebookCell){let n=[],r=this.codeEditorService.listCodeEditors();for(let s of r){let l=s.getModel();l&&l!==i&&l.uri.scheme===Q.vscodeNotebookCell&&n.push(l)}return n}let t=[],o=this.codeEditorService.listCodeEditors();for(let n of o){if(!Lc(n))continue;let r=n.getModel();r&&i===r.modified&&t.push(r.modified)}if(t.length)return t;if(this.occurrencesHighlightEnablement==="singleFile")return[];for(let n of o){let r=n.getModel();r&&r!==i&&t.push(r)}return t}async _run(i,e){if(this.editor.hasTextFocus()){let o=this.editor.getSelection();if(!o||o.startLineNumber!==o.endLineNumber){$p.query=null,this._stopAll();return}let n=o.startColumn,r=o.endColumn,s=this._getWord();if(!s||s.startColumn>n||s.endColumn<r){$p.query=null,this._stopAll();return}$p.query={modelInfo:{modelURI:this.model.uri,selection:o}}}else if(!$p.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),ze(this.editor.getModel().uri,$p.query.modelInfo?.modelURI)){if(!i){let s=this.decorations.getRanges();for(let l of s)if(l.containsPosition(this.editor.getPosition()))return}this._stopAll(i?this.model.uri:void 0);let o=++this.workerRequestTokenId;this.workerRequestCompleted=!1;let n=this.getOtherModelsToHighlight(this.editor.getModel());if(!$p.query||!$p.query.modelInfo)return;let r=await this.textModelService.createModelReference($p.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(r.object.textEditorModel,$p.query.modelInfo.selection,n),this.workerRequest?.result.then(s=>{o===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=s||[],this._beginRenderDecorations(e??this.occurrencesHighlightDelay))},mt)}catch(s){this.logService.error("Unexpected error during occurrence request. Log: ",s)}finally{r.dispose()}}else if(this.model.uri.scheme===Q.vscodeNotebookCell){let o=++this.workerRequestTokenId;if(this.workerRequestCompleted=!1,!$p.query||!$p.query.modelInfo)return;let n=await this.textModelService.createModelReference($p.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(n.object.textEditorModel,$p.query.modelInfo.selection,[this.model]),this.workerRequest?.result.then(r=>{o===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=r||[],this._beginRenderDecorations(e??this.occurrencesHighlightDelay))},mt)}catch(r){this.logService.error("Unexpected error during occurrence request. Log: ",r)}finally{n.dispose()}}}computeWithModel(i,e,t){return t.length?D6o(this.multiDocumentProviders,i,e,this.editor.getOption(148),t):_6o(this.providers,i,e,this.editor.getOption(148))}_beginRenderDecorations(i){let e=new Date().getTime(),t=this.lastCursorPositionChangeTime+i;e>=t?(this.renderDecorationsTimer=void 0,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},t-e)}renderDecorations(){this.renderDecorationsTimer=void 0;let i=this.codeEditorService.listCodeEditors();for(let e of i){let t=US.get(e);if(!t)continue;let o=[],n=e.getModel()?.uri;if(n&&this.workerRequestValue.has(n)){let r=$p.storedDecorationIDs.get(n),s=this.workerRequestValue.get(n);if(s)for(let c of s)c.range&&o.push({range:c.range,options:tno(c.kind)});let l=[];e.changeDecorations(c=>{l=c.deltaDecorations(r??[],o)}),$p.storedDecorationIDs=$p.storedDecorationIDs.set(n,l),o.length>0&&(t.wordHighlighter?.decorations.set(o),t.wordHighlighter?._hasWordHighlights.set(!0))}}this.workerRequest=null}dispose(){this._stopSingular(),this.toUnhook.dispose()}};$p=I([m(4,Bt),m(5,Qt),m(6,B),m(7,re)],$p);var US=class extends k{static{this.ID="editor.contrib.wordHighlighter"}static get(i){return i.getContribution(US.ID)}constructor(i,e,t,o,n,r,s){super(),this._wordHighlighter=null;let l=()=>{i.hasModel()&&!i.getModel().isTooLargeForTokenization()&&i.getModel().uri.scheme!==Q.accessibleView&&(this._wordHighlighter=new $p(i,t.documentHighlightProvider,t.multiDocumentHighlightProvider,e,n,o,r,s))};this._register(i.onDidChangeModel(c=>{this._wordHighlighter&&(!c.newModelUrl&&c.oldModelUrl?.scheme!==Q.vscodeNotebookCell&&this.wordHighlighter?.stop(),this._wordHighlighter.dispose(),this._wordHighlighter=null),l()})),l()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){this._wordHighlighter?.moveNext()}moveBack(){this._wordHighlighter?.moveBack()}restoreViewState(i){this._wordHighlighter&&i&&this._wordHighlighter.restore(250)}stopHighlighting(){this._wordHighlighter?.stop()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};US=I([m(1,X),m(2,Jt),m(3,Qt),m(4,Bt),m(5,B),m(6,re)],US);var IRt=class extends Mi{constructor(i,e){super(e),this._isNext=i}run(i,e){let t=US.get(e);t&&(this._isNext?t.moveNext():t.moveBack())}},fvi=class extends IRt{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:P(1747,"Go to Next Symbol Highlight"),precondition:Svi,kbOpts:{kbExpr:me.editorTextFocus,primary:65,weight:100}})}},vvi=class extends IRt{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:P(1748,"Go to Previous Symbol Highlight"),precondition:Svi,kbOpts:{kbExpr:me.editorTextFocus,primary:1089,weight:100}})}},bvi=class extends Mi{constructor(){super({id:"editor.action.wordHighlight.trigger",label:P(1749,"Trigger Symbol Highlight"),precondition:void 0,kbOpts:{kbExpr:me.editorTextFocus,primary:0,weight:100}})}run(i,e){let t=US.get(e);t&&t.restoreViewState(!0)}};Eo(US.ID,US,0);ri(fvi);ri(vvi);ri(bvi);Qk(QTe);var que=class extends od{constructor(i){super(i),this._inSelectionMode=i.inSelectionMode,this._wordNavigationType=i.wordNavigationType}runEditorCommand(i,e,t){if(!e.hasModel())return;let o=mx(e.getOption(148),e.getOption(147)),n=e.getModel(),r=e.getSelections(),s=r.length>1,l=r.map(c=>{let u=new ye(c.positionLineNumber,c.positionColumn),p=this._move(o,n,u,this._wordNavigationType,s);return this._moveTo(c,p,this._inSelectionMode)});if(n.pushStackElement(),e._getViewModel().setCursorStates("moveWordCommand",3,l.map(c=>aa.fromModelSelection(c))),l.length===1){let c=new ye(l[0].positionLineNumber,l[0].positionColumn);e.revealPosition(c,0)}}_moveTo(i,e,t){return t?new ei(i.selectionStartLineNumber,i.selectionStartColumn,e.lineNumber,e.column):new ei(e.lineNumber,e.column,e.lineNumber,e.column)}},I2=class extends que{_move(i,e,t,o,n){return fv.moveWordLeft(i,e,t,o,n)}},y2=class extends que{_move(i,e,t,o,n){return fv.moveWordRight(i,e,t,o)}},Ivi=class extends I2{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}},yvi=class extends I2{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}},wvi=class extends I2{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:C.and(me.textInputFocus,C.and(Oa,cC)?.negate()),primary:2063,mac:{primary:527},weight:100}})}},Cvi=class extends I2{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}},xvi=class extends I2{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}},kvi=class extends I2{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:C.and(me.textInputFocus,C.and(Oa,cC)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}},Evi=class extends I2{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(i,e,t,o,n){return super._move(mx(PS.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},Tvi=class extends I2{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(i,e,t,o,n){return super._move(mx(PS.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},_vi=class extends y2{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}},Dvi=class extends y2{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:C.and(me.textInputFocus,C.and(Oa,cC)?.negate()),primary:2065,mac:{primary:529},weight:100}})}},Rvi=class extends y2{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}},Lvi=class extends y2{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}},Mvi=class extends y2{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:C.and(me.textInputFocus,C.and(Oa,cC)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}},Pvi=class extends y2{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}},Avi=class extends y2{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(i,e,t,o,n){return super._move(mx(PS.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},Nvi=class extends y2{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(i,e,t,o,n){return super._move(mx(PS.wordSeparators.defaultValue,i.intlSegmenterLocales),e,t,o,n)}},$ue=class extends od{constructor(i){super({canTriggerInlineEdits:!0,...i}),this._whitespaceHeuristics=i.whitespaceHeuristics,this._wordNavigationType=i.wordNavigationType}runEditorCommand(i,e,t){let o=i?.get(Us);if(!e.hasModel()||!o)return;let n=mx(e.getOption(148),e.getOption(147)),r=e.getModel(),s=e.getSelections(),l=e.getOption(10),c=e.getOption(15),u=o.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),p=e._getViewModel(),h=s.map(g=>{let f=this._delete({wordSeparators:n,model:r,selection:g,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:e.getOption(13),autoClosingBrackets:l,autoClosingQuotes:c,autoClosingPairs:u,autoClosedCharacters:p.getCursorAutoClosedCharacters()},this._wordNavigationType);return new kg(f,"")});e.pushUndoStop(),e.executeCommands(this.id,h),e.pushUndoStop()}},p7e=class extends $ue{_delete(i,e){let t=fv.deleteWordLeft(i,e);return t||new G(1,1,1,1)}},m7e=class extends $ue{_delete(i,e){let t=fv.deleteWordRight(i,e);if(t)return t;let o=i.model.getLineCount(),n=i.model.getLineMaxColumn(o);return new G(o,n,o,n)}},Ovi=class extends p7e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:me.writable})}},Fvi=class extends p7e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:me.writable})}},Wvi=class extends p7e{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:me.writable,kbOpts:{kbExpr:me.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}},Vvi=class extends m7e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:me.writable})}},Bvi=class extends m7e{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:me.writable})}},Hvi=class extends m7e{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:me.writable,kbOpts:{kbExpr:me.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}},Uvi=class extends Mi{constructor(){super({id:"deleteInsideWord",precondition:me.writable,label:P(1750,"Delete Word"),metadata:{description:P(1752,"Delete the word at the cursor"),args:[{name:"args",schema:{type:"object",properties:{onlyWord:{type:"boolean",default:!1,description:d(1751,null)}}}}]}})}run(i,e,t){if(!e.hasModel())return;let o=!!(t&&typeof t=="object"&&t.onlyWord),n=mx(e.getOption(148),e.getOption(147)),r=e.getModel(),l=e.getSelections().map(c=>{let u=fv.deleteInsideWord(n,r,c,o);return new kg(u,"")});e.pushUndoStop(),e.executeCommands(this.id,l),e.pushUndoStop()}};ro(new Ivi);ro(new yvi);ro(new wvi);ro(new Cvi);ro(new xvi);ro(new kvi);ro(new _vi);ro(new Dvi);ro(new Rvi);ro(new Lvi);ro(new Mvi);ro(new Pvi);ro(new Evi);ro(new Tvi);ro(new Avi);ro(new Nvi);ro(new Ovi);ro(new Fvi);ro(new Wvi);ro(new Vvi);ro(new Bvi);ro(new Hvi);ri(Uvi);var zvi=class extends $ue{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:me.writable,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(i,e){let t=mce.deleteWordPartLeft(i);return t||new G(1,1,1,1)}},Kvi=class extends $ue{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:me.writable,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(i,e){let t=mce.deleteWordPartRight(i);if(t)return t;let o=i.model.getLineCount(),n=i.model.getLineMaxColumn(o);return new G(o,n,o,n)}},yRt=class extends que{_move(i,e,t,o,n){return mce.moveWordPartLeft(i,e,t,n)}},Gvi=class extends yRt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:783},weight:100}})}};Ge.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");var qvi=class extends yRt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}};Ge.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");var wRt=class extends que{_move(i,e,t,o,n){return mce.moveWordPartRight(i,e,t)}},$vi=class extends wRt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:785},weight:100}})}},jvi=class extends wRt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:me.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}};ro(new zvi);ro(new Kvi);ro(new Gvi);ro(new qvi);ro(new $vi);ro(new jvi);var CRt=class extends k{constructor(e){super();this.editor=e;this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}static{this.ID="editor.contrib.readOnlyMessageController"}_onDidAttemptReadOnlyEdit(){let e=Xu.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(105);t||(this.editor.isSimpleWidget?t=new he(d(1554,null)):t=new he(d(1553,null))),e.showMessage(t,this.editor.getPosition())}}};Eo(CRt.ID,CRt,2);var h7e=class extends k{constructor(e,t,o){super();this._textModel=e;this._languageFeaturesService=t;this._outlineModelService=o;this._currentModel=De(this,void 0);let n=qr("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),r=qr("_textModel.onDidChangeContent",U.debounce(s=>this._textModel.onDidChangeContent(s),()=>{},100));this._register(Rl(async(s,l)=>{n.read(s),r.read(s);let c=l.add(new akt),u=await this._outlineModelService.getOrCreate(this._textModel,c.token);l.isDisposed||this._currentModel.set(u,void 0)}))}getBreadcrumbItems(e,t){let o=this._currentModel.read(t);if(!o)return[];let n=o.asListOfDocumentSymbols().filter(r=>e.contains(r.range.startLineNumber)&&!e.contains(r.range.endLineNumber));return n.sort(wle(Il(r=>r.range.endLineNumber-r.range.startLineNumber,Hu))),n.map(r=>({name:r.name,kind:r.kind,startLineNumber:r.range.startLineNumber}))}getAt(e,t){let o=this._currentModel.read(t);if(!o)return[];let n=o.asListOfDocumentSymbols().filter(r=>new vo(r.range.startLineNumber,r.range.endLineNumber).contains(e));return n.length===0?[]:(n.sort(wle(Il(r=>r.range.endLineNumber-r.range.startLineNumber,Hu))),n.map(r=>({name:r.name,kind:r.kind,startLineNumber:r.range.startLineNumber})))}};h7e=I([m(1,Jt),m(2,kx)],h7e);ZF.setBreadcrumbsSourceFactory((a,i)=>i.createInstance(h7e,a));var fH=class extends k{static{this.ID="editor.contrib.floatingToolbar"}constructor(i,e,t,o){super();let n=this._register(Ds(i)),r=ke(l=>n.model.read(l)?.uri),s=this._register(e.createInstance(jue,R.EditorContent,i.contextKeyService,r));this._register(ve(l=>{s.hasActions.read(l)&&l.store.add(n.createOverlayWidget({allowEditorOverflow:!1,domNode:s.element,minContentWidthInPx:Fo(0),position:Fo({preference:1})}))}))}};fH=I([m(1,F),m(2,Le),m(3,Yt)],fH);var jue=class extends k{constructor(i,e,t,o,n,r){super();let s=this._register(r.createMenu(i,e)),l=vi(this,s.onDidChange,()=>s.getActions()),c=ke(u=>{let p=l.read(u),{primary:h}=xl(p,()=>!0);return h.filter(g=>g.id!==oi.ID)});this.hasActions=ke(u=>c.read(u).length>0),this.element=st("div.floating-menu-overlay-widget").root,this._register(ee(()=>this.element.remove())),this._register(ve(u=>{let p=c.read(u),h=p.length>0,g=h?p[0].id:void 0,f=p.length===1;if(this.element.classList.toggle("single-button",f),this.element.style.height=f?"28px":"26px",!h)return;let v=o.createInstance(pr,this.element,i,{actionViewItemProvider:(b,S)=>{if(b instanceof Do)return o.createInstance(class extends Cl{render(y){super.render(y),b.id===g&&this.element?.classList.add("primary")}updateLabel(){let y=n.lookupKeybinding(b.id),w=y?y.getLabel():void 0;this.options.label&&this.label&&(this.label.textContent=w?`${this._commandAction.label} (${w})`:this._commandAction.label)}},b,{...S,keybindingNotRenderedWithLabel:!0})},hiddenItemStrategy:0,menuOptions:{shouldForwardArgs:!0},telemetrySource:"editor.overlayToolbar",toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0}});u.store.add(v),u.store.add(ve(b=>{let S=t.read(b);v.context=S}))}))}};jue=I([m(3,F),m(4,Le),m(5,Yt)],jue);Eo(fH.ID,fH,1);var qc;(tt=>(tt.accessibilityHelpTitle=d(923,null),tt.openingDocs=d(952,null),tt.readonlyDiffEditor=d(958,null),tt.editableDiffEditor=d(940,null),tt.readonlyEditor=d(959,null),tt.editableEditor=d(941,null),tt.defaultWindowTitleIncludesEditorState=d(939,null),tt.defaultWindowTitleExcludingEditorState=d(938,null),tt.toolbar=d(971,null),tt.changeConfigToOnMac=d(928,null),tt.changeConfigToOnWinLinux=d(929,null),tt.auto_on=d(926,null),tt.auto_off=d(925,null),tt.screenReaderModeEnabled=d(961,null),tt.screenReaderModeDisabled=d(960,null),tt.tabFocusModeOnMsg=d(968,null,"<keybinding:editor.action.toggleTabFocusMode>"),tt.tabFocusModeOffMsg=d(967,null,"<keybinding:editor.action.toggleTabFocusMode>"),tt.stickScroll=d(965,null,"<keybinding:editor.action.focusStickyDebugConsole>"),tt.suggestActions=d(966,null,"<keybinding:editor.action.triggerSuggest>"),tt.acceptSuggestAction=d(922,null,"<keybinding:acceptSelectedSuggestion>"),tt.toggleSuggestionFocus=d(970,null,"<keybinding:focusSuggestion>","<keybinding:toggleSuggestionFocus>"),tt.codeFolding=d(933,null,"<keybinding:editor.toggleFold>"),tt.intellisense=d(949,null,"<keybinding:editor.action.triggerSuggest>"),tt.showOrFocusHover=d(963,null,"<keybinding:editor.action.showHover>"),tt.goToSymbol=d(946,null,"<keybinding:workbench.action.gotoSymbol>"),tt.showAccessibilityHelpAction=d(962,null),tt.listSignalSounds=d(951,null),tt.listAlerts=d(950,null),tt.announceCursorPosition=d(924,null,"<keybinding:editor.action.announceCursorPosition>"),tt.focusNotifications=d(943,null,"<keybinding:notifications.focusToasts>","<keybinding:notification.acceptPrimaryAction>"),tt.quickChat=d(953,null,"<keybinding:workbench.action.quickchat.toggle>"),tt.startInlineChat=d(964,null,"<keybinding:inlineChat.start>"),tt.startDebugging=d(934,null,"<keybinding:workbench.action.debug.start>"),tt.setBreakpoint=d(937,null,"<keybinding:editor.debug.action.toggleInlineBreakpoint>"),tt.addToWatch=d(935,null,"<keybinding:editor.debug.action.selectionToWatch>"),tt.debugExecuteSelection=d(936,null,"<keybinding:editor.debug.action.selectionToRepl>"),tt.chatEditorModification=d(931,null),tt.chatEditorRequestInProgress=d(932,null),tt.chatEditActions=d(930,null,"<keybinding:chatEditor.action.navigatePrevious>","<keybinding:chatEditor.action.navigateNext>","<keybinding:chatEditor.action.acceptHunk>","<keybinding:chatEditor.action.undoHunk>","<keybinding:chatEditor.action.toggleDiff>","<keybinding:chatEditor.action.acceptAllEdits>")))(qc||={});var L6o;(i=>i.inspectTokensAction=d(948,null))(L6o||={});var M6o;(e=>(e.gotoLineActionLabel=d(944,null),e.gotoOffsetActionLabel=d(945,null)))(M6o||={});var P6o;(i=>i.helpQuickAccessActionLabel=d(947,null))(P6o||={});var A6o;(e=>(e.quickCommandActionLabel=d(955,null),e.quickCommandHelp=d(954,null)))(A6o||={});var N6o;(e=>(e.quickOutlineActionLabel=d(956,null),e.quickOutlineByCategoryActionLabel=d(957,null)))(N6o||={});var O6o;(i=>i.editorViewAccessibleLabel=d(942,null))(O6o||={});var F6o;(i=>i.toggleHighContrast=d(969,null))(F6o||={});var W6o;(i=>i.bulkEditServiceSummary=d(927,null))(W6o||={});var to=le("lifecycleService");function xRt(a){switch(a){case 1:return"NewWindow";case 3:return"ReloadedWindow";case 4:return"ReopenedWindow"}}function xno(a){switch(a){case 1:return"Starting";case 2:return"Ready";case 3:return"Restored";case 4:return"Eventually"}}var kRt=le("editorPaneService");var Zi;(i=>i.Workbench="workbench.contributions.kind")(Zi||={});var vt=(o=>(o[o.BlockStartup=1]="BlockStartup",o[o.BlockRestore=2]="BlockRestore",o[o.AfterRestored=3]="AfterRestored",o[o.Eventually=4]="Eventually",o))(vt||{});function kno(a){let i=a;return!!i&&typeof i.editorTypeId=="string"}function V6o(a){switch(a){case 3:return vt.AfterRestored;case 4:return vt.Eventually}}function Eno(a){switch(a){case vt.BlockStartup:return 1;case vt.BlockRestore:return 2;case vt.AfterRestored:return 3;case vt.Eventually:return 4}}var Que=class a extends k{constructor(){super(...arguments);this.contributionsByPhase=new Map;this.contributionsByEditor=new Map;this.contributionsById=new Map;this.instancesById=new Map;this.instanceDisposables=this._register(new O);this.timingsByPhase=new Map;this.pendingRestoredContributions=new Mo;this.whenRestored=this.pendingRestoredContributions.p}static{this.INSTANCE=new a}static{this.BLOCK_BEFORE_RESTORE_WARN_THRESHOLD=20}static{this.BLOCK_AFTER_RESTORE_WARN_THRESHOLD=100}get timings(){return this.timingsByPhase}registerWorkbenchContribution2(e,t,o){let n={id:e,ctor:t};this.instantiationService&&this.lifecycleService&&this.logService&&this.environmentService&&this.editorPaneService&&(typeof o=="number"&&this.lifecycleService.phase>=o||typeof e=="string"&&kno(o)&&this.editorPaneService.didInstantiateEditorPane(o.editorTypeId))?this.safeCreateContribution(this.instantiationService,this.logService,this.environmentService,n,typeof o=="number"?Eno(o):this.lifecycleService.phase):(typeof o=="number"&&cB(this.contributionsByPhase,Eno(o),[]).push(n),typeof e=="string"&&(this.contributionsById.has(e)?console.error(`IWorkbenchContributionsRegistry#registerWorkbenchContribution(): Can't register multiple contributions with same id '${e}'`):this.contributionsById.set(e,n),kno(o)&&cB(this.contributionsByEditor,o.editorTypeId,[]).push(n)))}registerWorkbenchContribution(e,t){this.registerWorkbenchContribution2(void 0,e,V6o(t))}getWorkbenchContribution(e){if(this.instancesById.has(e))return this.instancesById.get(e);let t=this.instantiationService,o=this.lifecycleService,n=this.logService,r=this.environmentService;if(!t||!o||!n||!r)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): cannot be called before registry started`);let s=this.contributionsById.get(e);if(!s)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): contribution with that identifier is unknown.`);o.phase<3&&n.warn(`IWorkbenchContributionsRegistry#getContribution('${e}'): contribution instantiated before LifecyclePhase.Restored!`),this.safeCreateContribution(t,n,r,s,o.phase);let l=this.instancesById.get(e);if(!l)throw new Error(`IWorkbenchContributionsRegistry#getContribution('${e}'): failed to create contribution.`);return l}start(e){let t=this.instantiationService=e.get(F),o=this.lifecycleService=e.get(to),n=this.logService=e.get(re),r=this.environmentService=e.get(ko),s=this.editorPaneService=e.get(kRt);this._register(o.onDidShutdown(()=>{this.instanceDisposables.clear()}));for(let l of[1,2,3,4])this.instantiateByPhase(t,o,n,r,l);for(let l of this.contributionsByEditor.keys())s.didInstantiateEditorPane(l)&&this.onEditor(l,t,o,n,r);this._register(s.onWillInstantiateEditorPane(l=>this.onEditor(l.typeId,t,o,n,r)))}onEditor(e,t,o,n,r){let s=this.contributionsByEditor.get(e);if(s){this.contributionsByEditor.delete(e);for(let l of s)this.safeCreateContribution(t,n,r,l,o.phase)}}instantiateByPhase(e,t,o,n,r){t.phase>=r?this.doInstantiateByPhase(e,o,n,r):t.when(r).then(()=>this.doInstantiateByPhase(e,o,n,r))}async doInstantiateByPhase(e,t,o,n){let r=this.contributionsByPhase.get(n);if(r)switch(this.contributionsByPhase.delete(n),n){case 1:case 2:{Wo(`code/willCreateWorkbenchContributions/${n}`);for(let s of r)this.safeCreateContribution(e,t,o,s,n);Wo(`code/didCreateWorkbenchContributions/${n}`);break}case 3:case 4:{n===4&&await this.pendingRestoredContributions.p,this.doInstantiateWhenIdle(r,e,t,o,n);break}}}doInstantiateWhenIdle(e,t,o,n,r){Wo(`code/willCreateWorkbenchContributions/${r}`);let s=0,l=r===4?3e3:500,c=u=>{for(;s<e.length;){let p=e[s++];if(this.safeCreateContribution(t,o,n,p,r),u.timeRemaining()<1){TL(c,l);break}}s===e.length&&(Wo(`code/didCreateWorkbenchContributions/${r}`),r===3&&this.pendingRestoredContributions.complete())};TL(c,l)}safeCreateContribution(e,t,o,n,r){if(typeof n.id=="string"&&this.instancesById.has(n.id))return;let s=Date.now();try{typeof n.id=="string"&&Wo(`code/willCreateWorkbenchContribution/${r}/${n.id}`);let l=e.createInstance(n.ctor);typeof n.id=="string"&&(this.instancesById.set(n.id,l),this.contributionsById.delete(n.id)),Sd(l)&&this.instanceDisposables.add(l)}catch(l){t.error(`Unable to create workbench contribution '${n.id??n.ctor.name}'.`,l)}finally{typeof n.id=="string"&&Wo(`code/didCreateWorkbenchContribution/${r}/${n.id}`)}if(typeof n.id=="string"||!o.isBuilt){let l=Date.now()-s;if(l>(r<3?a.BLOCK_BEFORE_RESTORE_WARN_THRESHOLD:a.BLOCK_AFTER_RESTORE_WARN_THRESHOLD)&&t.warn(`Creation of workbench contribution '${n.id??n.ctor.name}' took ${l}ms.`),typeof n.id=="string"){let c=this.timingsByPhase.get(r);c||(c=[],this.timingsByPhase.set(r,c)),c.push([n.id,l])}}}},bt=Que.INSTANCE.registerWorkbenchContribution2.bind(Que.INSTANCE),ERt=Que.INSTANCE.getWorkbenchContribution.bind(Que.INSTANCE);oe.add(Zi.Workbench,Que.INSTANCE);var w2=(n=>(n.Extensions="Extensions",n.IntegratedTerminal="IntegratedTerminal",n.InteractiveSession="InteractiveSession",n.Telemetry="Telemetry",n.Update="Update",n))(w2||{}),Tno={Extensions:{name:{key:"extensionsConfigurationTitle",value:d(138,null)}},IntegratedTerminal:{name:{key:"terminalIntegratedConfigurationTitle",value:d(141,null)}},InteractiveSession:{name:{key:"interactiveSessionConfigurationTitle",value:d(139,null)}},Telemetry:{name:{key:"telemetryConfigurationTitle",value:d(140,null)}},Update:{name:{key:"updateConfigurationTitle",value:d(142,null)}}};var w0="^([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",Z4=new RegExp(w0),TRt="__web_extension",vH="skipWalkthrough",CM="skipPublisherTrust",bH="extensionInstallSource",_Rt="dependecyOrPackExtensionInstall",_no="clientTargetPlatform";function g7e(a){switch(a){case"win32-x64":return"Windows 64 bit";case"win32-arm64":return"Windows ARM";case"linux-x64":return"Linux 64 bit";case"linux-arm64":return"Linux ARM 64";case"linux-armhf":return"Linux ARM";case"alpine-x64":return"Alpine Linux 64 bit";case"alpine-arm64":return"Alpine ARM 64";case"darwin-x64":return"Mac";case"darwin-arm64":return"Mac Silicon";case"web":return"Web";case"universal":return"universal";case"unknown":return"unknown";case"undefined":return"undefined"}}function Dno(a){switch(a){case"win32-x64":return"win32-x64";case"win32-arm64":return"win32-arm64";case"linux-x64":return"linux-x64";case"linux-arm64":return"linux-arm64";case"linux-armhf":return"linux-armhf";case"alpine-x64":return"alpine-x64";case"alpine-arm64":return"alpine-arm64";case"darwin-x64":return"darwin-x64";case"darwin-arm64":return"darwin-arm64";case"web":return"web";case"universal":return"universal";default:return"unknown"}}function DRt(a,i){switch(a){case 3:return i==="x64"?"win32-x64":i==="arm64"?"win32-arm64":"unknown";case 2:return i==="x64"?"linux-x64":i==="arm64"?"linux-arm64":i==="arm"?"linux-armhf":"unknown";case"alpine":return i==="x64"?"alpine-x64":i==="arm64"?"alpine-arm64":"unknown";case 1:return i==="x64"?"darwin-x64":i==="arm64"?"darwin-arm64":"unknown";case 0:return"web"}}function YTe(a,i){return i==="web"&&!a.includes("web")}function Yue(a,i,e){return YTe(i,e)?!1:a==="undefined"||a==="universal"?!0:a==="unknown"?!1:a===e}function Rno(a){let i=a;return!!i&&typeof i=="object"&&typeof i.id=="string"&&(!i.uuid||typeof i.uuid=="string")}var ga=le("extensionGalleryService");var QT=class extends Error{constructor(e,t){super(e);this.code=t;this.name=t}};var qh=class extends Error{constructor(e,t){super(e);this.code=t;this.name=t}},xs=le("extensionManagementService"),JJ="extensionsIdentifiers/disabled",Qvi="extensionsIdentifiers/enabled",x2=le("IGlobalExtensionEnablementService"),XTe=le("IExtensionTipsService"),Mm=le("IAllowedExtensionsService");async function Yvi(a,i){let e;try{e=await i.resolve(a)}catch(t){if(t.fileOperationResult===1)return 0;throw t}return e.children?(await Promise.all(e.children.map(o=>Yvi(o.resource,i)))).reduce((o,n)=>o+n,0):e.size??0}var $h=P(2226,"Extensions"),Xvi=P(2243,"Preferences"),Xue="extensions.allowed",JTe="extensions.verifySignature",RRt="extensions.requestTimeout";oe.as($t.Configuration).registerConfiguration({id:"extensions",order:30,title:d(2242,null),type:"object",properties:{[Xue]:{type:"object",markdownDescription:d(2232,null),default:"*",defaultSnippets:[{body:{},description:d(2237,null)},{body:{"*":!0},description:d(2233,null)}],scope:1,policy:{name:"AllowedExtensions",category:"Extensions",minimumVersion:"1.96",localization:{description:{key:"extensions.allowed.policy",value:d(2238,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:d(2230,null),enumDescriptions:[d(2236,null),d(2234,null),d(2235,null)]},{type:"array",items:{type:"string"},description:d(2231,null)}]},"([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:["boolean","string"],enum:[!0,!1,"stable"],description:d(2225,null),enumDescriptions:[d(2241,null),d(2239,null),d(2240,null)]},"\\*":{type:"boolean",enum:[!0,!1],description:d(2227,null),enumDescriptions:[d(2229,null),d(2228,null)]}}}}});function f7e(a,i){return a?i?.capabilities.signing?.allPrivateRepositorySigned===!0:i?.capabilities.signing?.allPublicRepositorySigned===!0}var Ze=le("productService"),Lno="vscode://schemas/vscode-product";var Jvi=class{constructor(){this._generators=new Map;this._cache=new WeakMap}register(i,e){this._generators.set(i,e)}readActivationEvents(i){return this._cache.has(i)||this._cache.set(i,this._readActivationEvents(i)),this._cache.get(i)}createActivationEventsMap(i){let e=Object.create(null);for(let t of i){let o=this.readActivationEvents(t);o.length>0&&(e[hi.toKey(t.identifier)]=o)}return e}_readActivationEvents(i){if(typeof i.main>"u"&&typeof i.browser>"u")return[];let e=Array.isArray(i.activationEvents)?i.activationEvents.slice(0):[];for(let t=0;t<e.length;t++)e[t]==="onUri"&&(e[t]=`onUri:${hi.toKey(i.identifier)}`);if(!i.contributes)return e;for(let t in i.contributes){let o=this._generators.get(t);if(!o)continue;let n=i.contributes[t],r=Array.isArray(n)?n:[n];try{e.push(...o(r))}catch(s){mt(s)}}return e}},e3=new Jvi;var B6o={activeComment:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.activeComment.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",version:2},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"},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",version:4},chatHooks:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatHooks.d.ts",version:6},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",version:3},chatParticipantPrivate:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts",version:15},chatPromptFiles:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatPromptFiles.d.ts",version:2},chatProvider:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.chatProvider.d.ts",version:5},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",version:3},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"},customEditorPriority:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.customEditorPriority.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",version:4},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"},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",version:2},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",version:1},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",version:1},languageStatusText:{proposal:"https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatusText.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",version:1},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"},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"}},k2=Object.freeze(B6o);var obi=oe.as(Ta.JSONContribution),LRt=class{constructor(i,e,t){this._messageHandler=i,this._extension=e,this._extensionPointId=t}_msg(i,e){this._messageHandler({type:i,message:e,extensionId:this._extension.identifier,extensionPointId:this._extensionPointId})}error(i){this._msg(wt.Error,i)}warn(i){this._msg(wt.Warning,i)}info(i){this._msg(wt.Info,i)}},Zvi=class a{constructor(i,e){this.added=i;this.removed=e}static _toSet(i){let e=new HS;for(let t=0,o=i.length;t<o;t++)e.add(i[t].description.identifier);return e}static compute(i,e){if(!i||!i.length)return new a(e,[]);if(!e||!e.length)return new a([],i);let t=this._toSet(i),o=this._toSet(e),n=e.filter(s=>!t.has(s.description.identifier)),r=i.filter(s=>!o.has(s.description.identifier));return new a(n,r)}},ebi=class{constructor(i,e,t){this.name=i,this.defaultExtensionKind=e,this.canHandleResolver=t,this._handler=null,this._users=null,this._delta=null}setHandler(i){if(this._handler!==null)throw new Error("Handler already set!");return this._handler=i,this._handle(),{dispose:()=>{this._handler=null}}}acceptUsers(i){this._delta=Zvi.compute(this._users,i),this._users=i,this._handle()}_handle(){if(!(this._handler===null||this._users===null||this._delta===null))try{this._handler(this._users,this._delta)}catch(i){mt(i)}}},H6o={type:"string",enum:["ui","workspace"],enumDescriptions:[d(18970,null),d(19050,null)]},Mno="vscode://schemas/vscode-extensions",tbi={properties:{engines:{type:"object",description:d(19034,null),properties:{vscode:{type:"string",description:d(19035,null),default:"^1.105.0"}}},publisher:{description:d(19046,null),type:"string"},displayName:{description:d(19031,null),type:"string"},categories:{description:d(19025,null),type:"array",uniqueItems:!0,items:{oneOf:[{type:"string",enum:m0},{type:"string",const:"Languages",deprecationMessage:d(19026,null)}]}},galleryBanner:{type:"object",description:d(19038,null),properties:{color:{description:d(19039,null),type:"string"},theme:{description:d(19040,null),type:"string",enum:["dark","light"]}}},contributes:{description:d(19027,null),type:"object",properties:{},default:{}},preview:{type:"boolean",description:d(19044,null)},enableProposedApi:{type:"boolean",deprecationMessage:d(19033,null)},enabledApiProposals:{markdownDescription:d(19032,null),type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(k2).map(a=>a),markdownEnumDescriptions:Object.values(k2).map(a=>a.proposal)}},api:{markdownDescription:d(19005,null),type:"string",enum:["none"],enumDescriptions:[d(19006,null)]},activationEvents:{description:d(18971,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onWebviewPanel",description:d(19002,null),body:"onWebviewPanel:viewType"},{label:"onLanguage",description:d(18985,null),body:"onLanguage:${1:languageId}"},{label:"onCommand",description:d(18975,null),body:"onCommand:${2:commandId}"},{label:"onDebug",description:d(18977,null),body:"onDebug"},{label:"onDebugInitialConfigurations",description:d(18980,null),body:"onDebugInitialConfigurations"},{label:"onDebugDynamicConfigurations",description:d(18979,null),body:"onDebugDynamicConfigurations"},{label:"onDebugResolve",description:d(18981,null),body:"onDebugResolve:${6:type}"},{label:"onDebugAdapterProtocolTracker",description:d(18978,null),body:"onDebugAdapterProtocolTracker:${6:type}"},{label:"workspaceContains",description:d(19004,null),body:"workspaceContains:${4:filePattern}"},{label:"onStartupFinished",description:d(18993,null),body:"onStartupFinished"},{label:"onTaskType",description:d(18994,null),body:"onTaskType:${1:taskType}"},{label:"onFileSystem",description:d(18983,null),body:"onFileSystem:${1:scheme}"},{label:"onEditSession",description:d(18982,null),body:"onEditSession:${1:scheme}"},{label:"onSearch",description:d(18992,null),body:"onSearch:${7:scheme}"},{label:"onView",body:"onView:${5:viewId}",description:d(19000,null)},{label:"onUri",body:"onUri",description:d(18999,null)},{label:"onOpenExternalUri",body:"onOpenExternalUri",description:d(18990,null)},{label:"onCustomEditor",body:"onCustomEditor:${9:viewType}",description:d(18976,null)},{label:"onNotebook",body:"onNotebook:${1:type}",description:d(18989,null)},{label:"onAuthenticationRequest",body:"onAuthenticationRequest:${11:authenticationProviderId}",description:d(18972,null)},{label:"onRenderer",description:d(18991,null),body:"onRenderer:${11:rendererId}"},{label:"onTerminalProfile",body:"onTerminalProfile:${1:terminalId}",description:d(18996,null)},{label:"onTerminalQuickFixRequest",body:"onTerminalQuickFixRequest:${1:quickFixId}",description:d(18997,null)},{label:"onWalkthrough",body:"onWalkthrough:${1:walkthroughID}",description:d(19001,null)},{label:"onIssueReporterOpened",body:"onIssueReporterOpened",description:d(18984,null)},{label:"onChatParticipant",body:"onChatParticipant:${1:participantId}",description:d(18974,null)},{label:"onChatContextProvider",body:"onChatContextProvider:${1:contextProviderId}",description:d(18973,null)},{label:"onLanguageModelChatProvider",body:"onLanguageModelChatProvider:${1:vendor}",description:d(18986,null)},{label:"onLanguageModelTool",body:"onLanguageModelTool:${1:toolId}",description:d(18987,null)},{label:"onTerminal",body:"onTerminal:{1:shellType}",description:d(18995,null)},{label:"onTerminalShellIntegration",body:"onTerminalShellIntegration:${1:shellType}",description:d(18998,null)},{label:"onMcpCollection",description:d(18988,null),body:"onMcpCollection:${2:collectionId}"},{label:"*",description:d(19003,null),body:"*"}]}},badges:{type:"array",description:d(19007,null),items:{type:"object",required:["url","href","description"],properties:{url:{type:"string",description:d(19010,null)},href:{type:"string",description:d(19009,null)},description:{type:"string",description:d(19008,null)}}}},markdown:{type:"string",description:d(19043,null),enum:["github","standard"],default:"github"},qna:{default:"marketplace",description:d(19047,null),anyOf:[{type:["string","boolean"],enum:["marketplace",!1]},{type:"string"}]},extensionDependencies:{description:d(19037,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:w0}},extensionAffinity:{description:d(19036,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:w0}},extensionPack:{description:d(19028,null),type:"array",uniqueItems:!0,items:{type:"string",pattern:w0}},extensionKind:{description:d(18963,null),type:"array",items:H6o,default:["workspace"],defaultSnippets:[{body:["ui"],description:d(18965,null)},{body:["workspace"],description:d(18967,null)},{body:["ui","workspace"],description:d(18966,null)},{body:["workspace","ui"],description:d(18968,null)},{body:[],description:d(18964,null)}]},capabilities:{description:d(19011,null),type:"object",properties:{virtualWorkspaces:{description:d(19019,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:d(19021,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[d(19023,null),d(19024,null),d(19022,null)]},description:{type:"string",markdownDescription:d(19020,null)}}},untrustedWorkspaces:{description:d(19012,null),type:"object",required:["supported"],defaultSnippets:[{body:{supported:"${1:limited}",description:"${2}"}}],properties:{supported:{markdownDescription:d(19015,null),type:["string","boolean"],enum:["limited",!0,!1],enumDescriptions:[d(19017,null),d(19018,null),d(19016,null)]},restrictedConfigurations:{description:d(19014,null),type:"array",items:{type:"string"}},description:{type:"string",markdownDescription:d(19013,null)}}}}},sponsor:{description:d(19029,null),type:"object",defaultSnippets:[{body:{url:"${1:https:}"}}],properties:{url:{description:d(19030,null),type:"string"}}},scripts:{type:"object",properties:{"vscode:prepublish":{description:d(19048,null),type:"string"},"vscode:uninstall":{description:d(19049,null),type:"string"}}},icon:{type:"string",description:d(19041,null)},l10n:{type:"string",description:d(19042,null)},pricing:{type:"string",markdownDescription:d(19045,null),enum:["Free","Trial"],default:"Free"}}},ibi=class{constructor(){this._extensionPoints=new Map}registerExtensionPoint(i){if(this._extensionPoints.has(i.extensionPoint))throw new Error("Duplicate extension point: "+i.extensionPoint);let e=new ebi(i.extensionPoint,i.defaultExtensionKind,i.canHandleResolver);return this._extensionPoints.set(i.extensionPoint,e),i.activationEventsGenerator&&e3.register(i.extensionPoint,i.activationEventsGenerator),tbi.properties.contributes.properties[i.extensionPoint]=i.jsonSchema,obi.registerSchema(Mno,tbi),e}getExtensionPoints(){return Array.from(this._extensionPoints.values())}},Pno={ExtensionsRegistry:"ExtensionsRegistry"};oe.add(Pno.ExtensionsRegistry,new ibi);var zn=oe.as(Pno.ExtensionsRegistry);obi.registerSchema(Mno,tbi);obi.registerSchema(Lno,{properties:{extensionEnabledApiProposals:{description:d(18969,null),type:"object",properties:{},additionalProperties:{anyOf:[{type:"array",uniqueItems:!0,items:{type:"string",enum:Object.keys(k2),markdownEnumDescriptions:Object.values(k2).map(a=>a.proposal)}}]}}}});var qs;(i=>i.ExtensionFeaturesRegistry="workbench.registry.extensionFeatures")(qs||={});var Qy=le("IExtensionFeaturesManagementService"),nbi=class{constructor(){this.extensionFeatures=new Map}registerExtensionFeature(i){if(this.extensionFeatures.has(i.id))throw new Error(`Extension feature with id '${i.id}' already exists`);return this.extensionFeatures.set(i.id,i),{dispose:()=>this.extensionFeatures.delete(i.id)}}getExtensionFeature(i){return this.extensionFeatures.get(i)}getExtensionFeatures(){return Array.from(this.extensionFeatures.values())}};oe.add(qs.ExtensionFeaturesRegistry,new nbi);var Ano=zn.registerExtensionPoint({extensionPoint:"jsonValidation",defaultExtensionKind:["workspace","web"],jsonSchema:{description:d(4121,null),type:"array",defaultSnippets:[{body:[{fileMatch:"${1:file.json}",url:"${2:url}"}]}],items:{type:"object",defaultSnippets:[{body:{fileMatch:"${1:file.json}",url:"${2:url}"}}],properties:{fileMatch:{type:["string","array"],description:d(4122,null),items:{type:["string"]}},url:{description:d(4123,null),type:"string"}}}}}),MRt=class{constructor(){Ano.setHandler(i=>{for(let e of i){let t=e.value,o=e.collector,n=e.description.extensionLocation;if(!t||!Array.isArray(t)){o.error(d(4126,null));return}t.forEach(r=>{if(!We(r.fileMatch)&&!(Array.isArray(r.fileMatch)&&r.fileMatch.every(We))){o.error(d(4125,null));return}let s=r.url;if(!We(s)){o.error(d(4128,null));return}if(s.startsWith("./"))try{let l=Ve(n,s);Yr(l,n)||o.warn(d(4127,null,Ano.name,l.toString(),n.path))}catch(l){o.error(d(4129,null,l.message))}else if(!/^[^:/?#]+:\/\//.test(s)){o.error(d(4130,null));return}})}})}},rbi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.jsonValidation}render(e){let t=e.contributes?.jsonValidation||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(4124,null),d(4132,null)],n=t.map(r=>[new he().appendMarkdown(`\`${Array.isArray(r.fileMatch)?r.fileMatch.join(", "):r.fileMatch}\``),r.url]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"jsonValidation",label:d(4131,null),access:{canToggle:!1},renderer:new Vt(rbi)});var sbi=oe.as(Fce.ColorContribution),PRt=sbi.getColorReferenceSchema(),Nno="^\\w+[.\\w+]*$",U6o=zn.registerExtensionPoint({extensionPoint:"colors",jsonSchema:{description:d(19335,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(19337,null),pattern:Nno,patternErrorMessage:d(19338,null)},description:{type:"string",description:d(19336,null)},defaults:{type:"object",properties:{light:{description:d(19342,null),type:"string",anyOf:[PRt,{type:"string",format:"color-hex"}]},dark:{description:d(19339,null),type:"string",anyOf:[PRt,{type:"string",format:"color-hex"}]},highContrast:{description:d(19340,null),type:"string",anyOf:[PRt,{type:"string",format:"color-hex"}]},highContrastLight:{description:d(19341,null),type:"string",anyOf:[PRt,{type:"string",format:"color-hex"}]}},required:["light","dark"]}}}}}),ARt=class{constructor(){U6o.setHandler((i,e)=>{for(let t of e.added){let o=t.value,n=t.collector;if(!o||!Array.isArray(o)){n.error(d(19348,null));return}let r=(s,l)=>s.length>0?s[0]==="#"?Ue.Format.CSS.parseHex(s):s:(n.error(d(19349,null,l)),Ue.red);for(let s of o){if(typeof s.id!="string"||s.id.length===0){n.error(d(19354,null));return}if(!s.id.match(Nno)){n.error(d(19355,null));return}if(typeof s.description!="string"||s.id.length===0){n.error(d(19353,null));return}let l=s.defaults;if(!l||typeof l!="object"||typeof l.light!="string"||typeof l.dark!="string"){n.error(d(19350,null));return}if(l.highContrast&&typeof l.highContrast!="string"){n.error(d(19351,null));return}if(l.highContrastLight&&typeof l.highContrastLight!="string"){n.error(d(19352,null));return}sbi.registerColor(s.id,{light:r(l.light,"configuration.colors.defaults.light"),dark:r(l.dark,"configuration.colors.defaults.dark"),hcDark:r(l.highContrast??l.dark,"configuration.colors.defaults.highContrast"),hcLight:r(l.highContrastLight??l.light,"configuration.colors.defaults.highContrastLight")},s.description)}}for(let t of e.removed){let o=t.value;for(let n of o)sbi.deregisterColor(n.id)}})}},abi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.colors}render(e){let t=e.contributes?.colors||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(19347,null),d(19346,null),d(19343,null),d(19345,null),d(19344,null)],n=s=>s[0]==="#"?Ue.fromHex(s):void 0,r=t.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[new he().appendMarkdown(`\`${s.id}\``),s.description,n(s.defaults.dark)??new he().appendMarkdown(`\`${s.defaults.dark}\``),n(s.defaults.light)??new he().appendMarkdown(`\`${s.defaults.light}\``),n(s.defaults.highContrast)??new he().appendMarkdown(`\`${s.defaults.highContrast}\``)]);return{data:{headers:o,rows:r},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"colors",label:d(19334,null),access:{canToggle:!1},renderer:new Vt(abi)});var v7e=oe.as(pdi.IconContribution),z6o=v7e.getIconReferenceSchema(),Ono=`^${q.iconNameSegment}(-${q.iconNameSegment})+$`,K6o=zn.registerExtensionPoint({extensionPoint:"icons",jsonSchema:{description:d(19423,null),type:"object",propertyNames:{pattern:Ono,description:d(19421,null),patternErrorMessage:d(19422,null)},additionalProperties:{type:"object",properties:{description:{type:"string",description:d(19420,null)},default:{anyOf:[z6o,{type:"object",properties:{fontPath:{description:d(19419,null),type:"string"},fontCharacter:{description:d(19418,null),type:"string"}},required:["fontPath","fontCharacter"],defaultSnippets:[{body:{fontPath:"${1:myiconfont.woff}",fontCharacter:"${2:\\\\E001}"}}]}],description:d(19417,null)}},required:["description","default"],defaultSnippets:[{body:{description:"${1:my icon}",default:{fontPath:"${2:myiconfont.woff}",fontCharacter:"${3:\\\\E001}"}}}]},defaultSnippets:[{body:{"${1:my-icon-id}":{description:"${2:my icon}",default:{fontPath:"${3:myiconfont.woff}",fontCharacter:"${4:\\\\E001}"}}}}]}}),NRt=class{constructor(){K6o.setHandler((i,e)=>{for(let t of e.added){let o=t.value,n=t.collector;if(!o||typeof o!="object"){n.error(d(19424,null));return}for(let r in o){if(!r.match(Ono)){n.error(d(19429,null));return}let s=o[r];if(typeof s.description!="string"||s.description.length===0){n.error(d(19428,null));return}let l=s.default;if(typeof l=="string")v7e.registerIcon(r,{id:l},s.description);else if(typeof l=="object"&&typeof l.fontPath=="string"&&typeof l.fontCharacter=="string"){let c=km(l.fontPath).substring(1),u=G6o[c];if(!u){n.warn(d(19426,null,c));return}let p=t.description.extensionLocation,h=Ve(p,l.fontPath),g=q6o(t.description,l.fontPath),f=v7e.registerIconFont(g,{src:[{location:h,format:u}]});if(!Yr(h,p)){n.warn(d(19427,null,h.path,p.path));return}v7e.registerIcon(r,{fontCharacter:l.fontCharacter,font:{id:g,definition:f}},s.description)}else n.error(d(19425,null))}}for(let t of e.removed){let o=t.value;for(let n in o)v7e.deregisterIcon(n)}})}},G6o={ttf:"truetype",woff:"woff",woff2:"woff2"};function q6o(a,i){return Vo.join(a.identifier.value,i)}var $6o="*",Vno=":",Bno=".",ORt="\\w+[-_\\w+]*",t3=`^${ORt}$`,j6o=`^(${ORt}|\\*)(\\${Bno}${ORt})*(${Vno}${ORt})?$`,Q6o="^(\\s*(italic|bold|underline|strikethrough))*\\s*$",qA=class{constructor(i,e,t,o,n){this.foreground=i;this.bold=e;this.underline=t;this.strikethrough=o;this.italic=n}};(r=>{function a(s){return{_foreground:s.foreground===void 0?null:Ue.Format.CSS.formatHexA(s.foreground,!0),_bold:s.bold===void 0?null:s.bold,_underline:s.underline===void 0?null:s.underline,_italic:s.italic===void 0?null:s.italic,_strikethrough:s.strikethrough===void 0?null:s.strikethrough}}r.toJSONObject=a;function i(s){if(s){let l=u=>typeof u=="boolean"?u:void 0,c=u=>typeof u=="string"?Ue.fromHex(u):void 0;return new r(c(s._foreground),l(s._bold),l(s._underline),l(s._strikethrough),l(s._italic))}}r.fromJSONObject=i;function e(s,l){return s===l?!0:s!==void 0&&l!==void 0&&(s.foreground instanceof Ue?s.foreground.equals(l.foreground):l.foreground===void 0)&&s.bold===l.bold&&s.underline===l.underline&&s.strikethrough===l.strikethrough&&s.italic===l.italic}r.equals=e;function t(s){return s instanceof r}r.is=t;function o(s){return new r(s.foreground,s.bold,s.underline,s.strikethrough,s.italic)}r.fromData=o;function n(s,l,c,u,p,h){let g;if(s!==void 0&&(g=Ue.fromHex(s)),l!==void 0){c=h=u=p=!1;let f=/italic|bold|underline|strikethrough/g,v;for(;v=f.exec(l);)switch(v[0]){case"bold":c=!0;break;case"italic":h=!0;break;case"underline":u=!0;break;case"strikethrough":p=!0;break}}return new r(g,c,u,p,h)}r.fromSettings=n})(qA||={});var ZTe;(o=>{function a(n,r){if(r&&typeof r._selector=="string"&&r._style){let s=qA.fromJSONObject(r._style);if(s)try{return{selector:n.parseTokenSelector(r._selector),style:s}}catch{}}}o.fromJSONObject=a;function i(n){return{_selector:n.selector.id,_style:qA.toJSONObject(n.style)}}o.toJSONObject=i;function e(n,r){return n===r?!0:n!==void 0&&r!==void 0&&n.selector&&r.selector&&n.selector.id===r.selector.id&&qA.equals(n.style,r.style)}o.equals=e;function t(n){return n&&n.selector&&typeof n.selector.id=="string"&&qA.is(n.style)}o.is=t})(ZTe||={});var Y6o={TokenClassificationContribution:"base.contributions.tokenClassification"},cbi=class extends k{constructor(){super();this._onDidChangeSchema=this._register(new T);this.onDidChangeSchema=this._onDidChangeSchema.event;this.currentTypeNumber=0;this.currentModifierBit=1;this.tokenStylingDefaultRules=[];this.tokenStylingSchema={type:"object",properties:{},patternProperties:{[j6o]:lbi()},additionalProperties:!1,definitions:{style:{type:"object",description:d(2917,null),properties:{foreground:{type:"string",description:d(2915,null),format:"color-hex",default:"#ff0000"},background:{type:"string",deprecationMessage:d(2911,null)},fontStyle:{type:"string",description:d(2913,null),pattern:Q6o,patternErrorMessage:d(2910,null),defaultSnippets:[{label:d(2914,null),bodyText:'""'},{body:"italic"},{body:"bold"},{body:"underline"},{body:"strikethrough"},{body:"italic bold"},{body:"italic underline"},{body:"italic strikethrough"},{body:"bold underline"},{body:"bold strikethrough"},{body:"underline strikethrough"},{body:"italic bold underline"},{body:"italic bold strikethrough"},{body:"italic underline strikethrough"},{body:"bold underline strikethrough"},{body:"italic bold underline strikethrough"}]},bold:{type:"boolean",description:d(2912,null)},italic:{type:"boolean",description:d(2916,null)},underline:{type:"boolean",description:d(2919,null)},strikethrough:{type:"boolean",description:d(2918,null)}},defaultSnippets:[{body:{foreground:"${1:#FF0000}",fontStyle:"${2:bold}"}}]}}};this.tokenTypeById=Object.create(null),this.tokenModifierById=Object.create(null),this.typeHierarchy=Object.create(null)}registerTokenType(e,t,o,n){if(!e.match(t3))throw new Error("Invalid token type id.");if(o&&!o.match(t3))throw new Error("Invalid token super type id.");let s={num:this.currentTypeNumber++,id:e,superType:o,description:t,deprecationMessage:n};this.tokenTypeById[e]=s;let l=lbi(t,n);this.tokenStylingSchema.properties[e]=l,this.typeHierarchy=Object.create(null)}registerTokenModifier(e,t,o){if(!e.match(t3))throw new Error("Invalid token modifier id.");let n=this.currentModifierBit;this.currentModifierBit=this.currentModifierBit*2;let r={num:n,id:e,description:t,deprecationMessage:o};this.tokenModifierById[e]=r,this.tokenStylingSchema.properties[`*.${e}`]=lbi(t,o)}parseTokenSelector(e,t){let o=FRt(e,t);return o.type?{match:(n,r,s)=>{let l=0;if(o.language!==void 0){if(o.language!==s)return-1;l+=10}if(o.type!==$6o){let u=this.getTypeHierarchy(n).indexOf(o.type);if(u===-1)return-1;l+=100-u}for(let c of o.modifiers)if(r.indexOf(c)===-1)return-1;return l+o.modifiers.length*100},id:`${[o.type,...o.modifiers.sort()].join(".")}${o.language!==void 0?":"+o.language:""}`}:{match:()=>-1,id:"$invalid"}}registerTokenStyleDefault(e,t){this.tokenStylingDefaultRules.push({selector:e,defaults:t})}deregisterTokenStyleDefault(e){let t=e.id;this.tokenStylingDefaultRules=this.tokenStylingDefaultRules.filter(o=>o.selector.id!==t)}deregisterTokenType(e){delete this.tokenTypeById[e],delete this.tokenStylingSchema.properties[e],this.typeHierarchy=Object.create(null)}deregisterTokenModifier(e){delete this.tokenModifierById[e],delete this.tokenStylingSchema.properties[`*.${e}`]}getTokenTypes(){return Object.keys(this.tokenTypeById).map(e=>this.tokenTypeById[e])}getTokenModifiers(){return Object.keys(this.tokenModifierById).map(e=>this.tokenModifierById[e])}getTokenStylingSchema(){return this.tokenStylingSchema}getTokenStylingDefaultRules(){return this.tokenStylingDefaultRules}getTypeHierarchy(e){let t=this.typeHierarchy[e];if(!t){this.typeHierarchy[e]=t=[e];let o=this.tokenTypeById[e];for(;o&&o.superType;)t.push(o.superType),o=this.tokenTypeById[o.superType]}return t}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.tokenTypeById).sort(e).map(t=>`- \`${t}\`: ${this.tokenTypeById[t].description}`).join(`
`)}},Fno=Vno.charCodeAt(0),X6o=Bno.charCodeAt(0);function FRt(a,i){let e=a.length,t=i,o=[];for(let r=e-1;r>=0;r--){let s=a.charCodeAt(r);if(s===Fno||s===X6o){let l=a.substring(r+1,e);e=r,s===Fno?t=l:o.push(l)}}return{type:a.substring(0,e),modifiers:o,language:t}}var WRt=J6o();oe.add(Y6o.TokenClassificationContribution,WRt);function J6o(){let a=new cbi;function i(t,o,n=[],r,s){return a.registerTokenType(t,o,r,s),n&&e(t,n),t}function e(t,o){try{let n=a.parseTokenSelector(t);a.registerTokenStyleDefault(n,{scopesToProbe:o})}catch(n){console.log(n)}}return i("comment",d(2887,null),[["comment"]]),i("string",d(2921,null),[["string"]]),i("keyword",d(2897,null),[["keyword.control"]]),i("number",d(2904,null),[["constant.numeric"]]),i("regexp",d(2909,null),[["constant.regexp"]]),i("operator",d(2905,null),[["keyword.operator"]]),i("namespace",d(2903,null),[["entity.name.namespace"]]),i("type",d(2923,null),[["entity.name.type"],["support.type"]]),i("struct",d(2922,null),[["entity.name.type.struct"]]),i("class",d(2886,null),[["entity.name.type.class"],["support.class"]]),i("interface",d(2896,null),[["entity.name.type.interface"]]),i("enum",d(2892,null),[["entity.name.type.enum"]]),i("typeParameter",d(2924,null),[["entity.name.type.parameter"]]),i("function",d(2895,null),[["entity.name.function"],["support.function"]]),i("member",d(2900,null),[],"method","Deprecated use `method` instead"),i("method",d(2901,null),[["entity.name.function.member"],["support.function"]]),i("macro",d(2899,null),[["entity.name.function.preprocessor"]]),i("variable",d(2925,null),[["variable.other.readwrite"],["entity.name.variable"]]),i("parameter",d(2906,null),[["variable.parameter"]]),i("property",d(2907,null),[["variable.other.property"]]),i("enumMember",d(2893,null),[["variable.other.enummember"]]),i("event",d(2894,null),[["variable.other.event"]]),i("decorator",d(2889,null),[["entity.name.decorator"],["entity.name.function"]]),i("label",d(2898,null),void 0),a.registerTokenModifier("declaration",d(2888,null),void 0),a.registerTokenModifier("documentation",d(2891,null),void 0),a.registerTokenModifier("static",d(2920,null),void 0),a.registerTokenModifier("abstract",d(2884,null),void 0),a.registerTokenModifier("deprecated",d(2890,null),void 0),a.registerTokenModifier("modification",d(2902,null),void 0),a.registerTokenModifier("async",d(2885,null),void 0),a.registerTokenModifier("readonly",d(2908,null),void 0),e("variable.readonly",[["variable.other.constant"]]),e("property.readonly",[["variable.other.constant.property"]]),e("type.defaultLibrary",[["support.type"]]),e("class.defaultLibrary",[["support.class"]]),e("interface.defaultLibrary",[["support.class"]]),e("variable.defaultLibrary",[["support.variable"],["support.other.variable"]]),e("variable.defaultLibrary.readonly",[["support.constant"]]),e("property.defaultLibrary",[["support.variable.property"]]),e("property.defaultLibrary.readonly",[["support.constant.property"]]),e("function.defaultLibrary",[["support.function"]]),e("member.defaultLibrary",[["support.function"]]),a}function VRt(){return WRt}function lbi(a,i){return{description:a,deprecationMessage:i,defaultSnippets:[{body:"${1:#ff0000}"}],anyOf:[{type:"string",format:"color-hex"},{$ref:"#/definitions/style"}]}}var e_e="vscode://schemas/token-styling",Hno=oe.as(Ta.JSONContribution);Hno.registerSchema(e_e,WRt.getTokenStylingSchema());var Wno=new Dt(()=>Hno.notifySchemaChanged(e_e),200);WRt.onDidChangeSchema(()=>{Wno.isScheduled()||Wno.schedule()});var eZ=VRt(),Z6o=zn.registerExtensionPoint({extensionPoint:"semanticTokenTypes",jsonSchema:{description:d(19498,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(19499,null),pattern:t3,patternErrorMessage:d(19500,null)},superType:{type:"string",description:d(19501,null),pattern:t3,patternErrorMessage:d(19502,null)},description:{type:"string",description:d(19490,null)}}}}}),e9o=zn.registerExtensionPoint({extensionPoint:"semanticTokenModifiers",jsonSchema:{description:d(19491,null),type:"array",items:{type:"object",properties:{id:{type:"string",description:d(19493,null),pattern:t3,patternErrorMessage:d(19494,null)},description:{description:d(19492,null)}}}}}),t9o=zn.registerExtensionPoint({extensionPoint:"semanticTokenScopes",jsonSchema:{description:d(19495,null),type:"array",items:{type:"object",properties:{language:{description:d(19496,null),type:"string"},scopes:{description:d(19497,null),type:"object",additionalProperties:{type:"array",items:{type:"string"}}}}}}}),BRt=class{constructor(){function i(e,t,o){if(typeof e.id!="string"||e.id.length===0)return o.error(d(19504,null,t)),!1;if(!e.id.match(t3))return o.error(d(19505,null,t)),!1;let n=e.superType;return n&&!n.match(t3)?(o.error(d(19513,null,t)),!1):typeof e.description!="string"||e.id.length===0?(o.error(d(19503,null,t)),!1):!0}Z6o.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(19512,null));return}for(let s of n)i(s,"semanticTokenType",r)&&eZ.registerTokenType(s.id,s.description,s.superType)}for(let o of t.removed){let n=o.value;for(let r of n)eZ.deregisterTokenType(r.id)}}),e9o.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(19506,null));return}for(let s of n)i(s,"semanticTokenModifier",r)&&eZ.registerTokenModifier(s.id,s.description)}for(let o of t.removed){let n=o.value;for(let r of n)eZ.deregisterTokenModifier(r.id)}}),t9o.setHandler((e,t)=>{for(let o of t.added){let n=o.value,r=o.collector;if(!n||!Array.isArray(n)){r.error(d(19507,null));return}for(let s of n){if(s.language&&typeof s.language!="string"){r.error(d(19508,null));continue}if(!s.scopes||typeof s.scopes!="object"){r.error(d(19509,null));continue}for(let l in s.scopes){let c=s.scopes[l];if(!Array.isArray(c)||c.some(u=>typeof u!="string")){r.error(d(19511,null));continue}try{let u=eZ.parseTokenSelector(l,s.language);eZ.registerTokenStyleDefault(u,{scopesToProbe:c.map(p=>p.split(" "))})}catch{r.error(d(19510,null,l))}}}}for(let o of t.removed){let n=o.value;for(let r of n)for(let s in r.scopes){let l=r.scopes[s];try{let c=eZ.parseTokenSelector(s,r.language);eZ.registerTokenStyleDefault(c,{scopesToProbe:l.map(u=>u.split(" "))})}catch{}}}})}};var URt;(i=>i.DEFAULT={allowTrailingComma:!0})(URt||={});function Jue(a,i=!1){let e=0,t=a.length,o="",n=0,r=16,s=0;function l(v){let b=0,S=0;for(;b<v;){let y=a.charCodeAt(e);if(y>=48&&y<=57)S=S*16+y-48;else if(y>=65&&y<=70)S=S*16+y-65+10;else if(y>=97&&y<=102)S=S*16+y-97+10;else break;e++,b++}return b<v&&(S=-1),S}function c(v){e=v,o="",n=0,r=16,s=0}function u(){let v=e;if(a.charCodeAt(e)===48)e++;else for(e++;e<a.length&&t_e(a.charCodeAt(e));)e++;if(e<a.length&&a.charCodeAt(e)===46)if(e++,e<a.length&&t_e(a.charCodeAt(e)))for(e++;e<a.length&&t_e(a.charCodeAt(e));)e++;else return s=3,a.substring(v,e);let b=e;if(e<a.length&&(a.charCodeAt(e)===69||a.charCodeAt(e)===101))if(e++,(e<a.length&&a.charCodeAt(e)===43||a.charCodeAt(e)===45)&&e++,e<a.length&&t_e(a.charCodeAt(e))){for(e++;e<a.length&&t_e(a.charCodeAt(e));)e++;b=e}else s=3;return a.substring(v,b)}function p(){let v="",b=e;for(;;){if(e>=t){v+=a.substring(b,e),s=2;break}let S=a.charCodeAt(e);if(S===34){v+=a.substring(b,e),e++;break}if(S===92){if(v+=a.substring(b,e),e++,e>=t){s=2;break}switch(a.charCodeAt(e++)){case 34:v+='"';break;case 92:v+="\\";break;case 47:v+="/";break;case 98:v+="\b";break;case 102:v+="\f";break;case 110:v+=`
`;break;case 114:v+="\r";break;case 116:v+="	";break;case 117:{let w=l(4);w>=0?v+=String.fromCharCode(w):s=4;break}default:s=5}b=e;continue}if(S>=0&&S<=31)if(HRt(S)){v+=a.substring(b,e),s=2;break}else s=6;e++}return v}function h(){if(o="",s=0,n=e,e>=t)return n=t,r=17;let v=a.charCodeAt(e);if(dbi(v)){do e++,o+=String.fromCharCode(v),v=a.charCodeAt(e);while(dbi(v));return r=15}if(HRt(v))return e++,o+=String.fromCharCode(v),v===13&&a.charCodeAt(e)===10&&(e++,o+=`
`),r=14;switch(v){case 123:return e++,r=1;case 125:return e++,r=2;case 91:return e++,r=3;case 93:return e++,r=4;case 58:return e++,r=6;case 44:return e++,r=5;case 34:return e++,o=p(),r=10;case 47:{let b=e-1;if(a.charCodeAt(e+1)===47){for(e+=2;e<t&&!HRt(a.charCodeAt(e));)e++;return o=a.substring(b,e),r=12}if(a.charCodeAt(e+1)===42){e+=2;let S=t-1,y=!1;for(;e<S;){if(a.charCodeAt(e)===42&&a.charCodeAt(e+1)===47){e+=2,y=!0;break}e++}return y||(e++,s=1),o=a.substring(b,e),r=13}return o+=String.fromCharCode(v),e++,r=16}case 45:if(o+=String.fromCharCode(v),e++,e===t||!t_e(a.charCodeAt(e)))return r=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=u(),r=11;default:for(;e<t&&g(v);)e++,v=a.charCodeAt(e);if(n!==e){switch(o=a.substring(n,e),o){case"true":return r=8;case"false":return r=9;case"null":return r=7}return r=16}return o+=String.fromCharCode(v),e++,r=16}}function g(v){if(dbi(v)||HRt(v))return!1;switch(v){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function f(){let v;do v=h();while(v>=12&&v<=15);return v}return{setPosition:c,getPosition:()=>e,scan:i?f:h,getToken:()=>r,getTokenValue:()=>o,getTokenOffset:()=>n,getTokenLength:()=>e-n,getTokenError:()=>s}}function dbi(a){return a===32||a===9||a===11||a===12||a===160||a===5760||a>=8192&&a<=8203||a===8239||a===8287||a===12288||a===65279}function HRt(a){return a===10||a===13||a===8232||a===8233}function t_e(a){return a>=48&&a<=57}function Uno(a,i){let e=[],t=new Object,o,n={value:{},offset:0,length:0,type:"object",parent:void 0},r=!1;function s(l,c,u,p){n.value=l,n.offset=c,n.length=u,n.type=p,n.colonOffset=void 0,o=n}try{rE(a,{onObjectBegin:(l,c)=>{if(i<=l)throw t;o=void 0,r=i>l,e.push("")},onObjectProperty:(l,c,u)=>{if(i<c||(s(l,c,u,"property"),e[e.length-1]=l,i<=c+u))throw t},onObjectEnd:(l,c)=>{if(i<=l)throw t;o=void 0,e.pop()},onArrayBegin:(l,c)=>{if(i<=l)throw t;o=void 0,e.push(0)},onArrayEnd:(l,c)=>{if(i<=l)throw t;o=void 0,e.pop()},onLiteralValue:(l,c,u)=>{if(i<c||(s(l,c,u,sE(l)),i<=c+u))throw t},onSeparator:(l,c,u)=>{if(i<=c)throw t;if(l===":"&&o&&o.type==="property")o.colonOffset=c,r=!1,o=void 0;else if(l===","){let p=e[e.length-1];typeof p=="number"?e[e.length-1]=p+1:(r=!0,e[e.length-1]=""),o=void 0}}})}catch(l){if(l!==t)throw l}return{path:e,previousNode:o,isAtPropertyKey:r,matches:l=>{let c=0;for(let u=0;c<l.length&&u<e.length;u++)if(l[c]===e[u]||l[c]==="*")c++;else if(l[c]!=="**")return!1;return c===l.length}}}function is(a,i=[],e=URt.DEFAULT){let t=null,o=[],n=[];function r(l){Array.isArray(o)?o.push(l):t!==null&&(o[t]=l)}return rE(a,{onObjectBegin:()=>{let l={};r(l),n.push(o),o=l,t=null},onObjectProperty:l=>{t=l},onObjectEnd:()=>{o=n.pop()},onArrayBegin:()=>{let l=[];r(l),n.push(o),o=l,t=null},onArrayEnd:()=>{o=n.pop()},onLiteralValue:r,onError:(l,c,u)=>{i.push({error:l,offset:c,length:u})}},e),o[0]}function xM(a,i=[],e=URt.DEFAULT){let t={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(l){t.type==="property"&&(t.length=l-t.offset,t=t.parent)}function n(l){return t.children.push(l),l}rE(a,{onObjectBegin:l=>{t=n({type:"object",offset:l,length:-1,parent:t,children:[]})},onObjectProperty:(l,c,u)=>{t=n({type:"property",offset:c,length:-1,parent:t,children:[]}),t.children.push({type:"string",value:l,offset:c,length:u,parent:t})},onObjectEnd:(l,c)=>{t.length=l+c-t.offset,t=t.parent,o(l+c)},onArrayBegin:(l,c)=>{t=n({type:"array",offset:l,length:-1,parent:t,children:[]})},onArrayEnd:(l,c)=>{t.length=l+c-t.offset,t=t.parent,o(l+c)},onLiteralValue:(l,c,u)=>{n({type:sE(l),offset:c,length:u,parent:t,value:l}),o(c+u)},onSeparator:(l,c,u)=>{t.type==="property"&&(l===":"?t.colonOffset=c:l===","&&o(c))},onError:(l,c,u)=>{i.push({error:l,offset:c,length:u})}},e);let s=t.children[0];return s&&delete s.parent,s}function Tx(a,i){if(!a)return;let e=a;for(let t of i)if(typeof t=="string"){if(e.type!=="object"||!Array.isArray(e.children))return;let o=!1;for(let n of e.children)if(Array.isArray(n.children)&&n.children[0].value===t){e=n.children[1],o=!0;break}if(!o)return}else{let o=t;if(e.type!=="array"||o<0||!Array.isArray(e.children)||o>=e.children.length)return;e=e.children[o]}return e}function ubi(a){if(!a.parent||!a.parent.children)return[];let i=ubi(a.parent);if(a.parent.type==="property"){let e=a.parent.children[0].value;i.push(e)}else if(a.parent.type==="array"){let e=a.parent.children.indexOf(a);e!==-1&&i.push(e)}return i}function i9o(a,i,e=!1){return i>=a.offset&&i<a.offset+a.length||e&&i===a.offset+a.length}function pbi(a,i,e=!1){if(i9o(a,i,e)){let t=a.children;if(Array.isArray(t))for(let o=0;o<t.length&&t[o].offset<=i;o++){let n=pbi(t[o],i,e);if(n)return n}return a}}function rE(a,i,e=URt.DEFAULT){let t=Jue(a,!1);function o(H){return H?()=>H(t.getTokenOffset(),t.getTokenLength()):()=>!0}function n(H){return H?K=>H(K,t.getTokenOffset(),t.getTokenLength()):()=>!0}let r=o(i.onObjectBegin),s=n(i.onObjectProperty),l=o(i.onObjectEnd),c=o(i.onArrayBegin),u=o(i.onArrayEnd),p=n(i.onLiteralValue),h=n(i.onSeparator),g=o(i.onComment),f=n(i.onError),v=e&&e.disallowComments,b=e&&e.allowTrailingComma;function S(){for(;;){let H=t.scan();switch(t.getTokenError()){case 4:y(14);break;case 5:y(15);break;case 3:y(13);break;case 1:v||y(11);break;case 2:y(12);break;case 6:y(16);break}switch(H){case 12:case 13:v?y(10):g();break;case 16:y(1);break;case 15:case 14:break;default:return H}}}function y(H,K=[],j=[]){if(f(H),K.length+j.length>0){let J=t.getToken();for(;J!==17;){if(K.indexOf(J)!==-1){S();break}else if(j.indexOf(J)!==-1)break;J=S()}}}function w(H){let K=t.getTokenValue();return H?p(K):s(K),S(),!0}function x(){switch(t.getToken()){case 11:{let H=0;try{H=JSON.parse(t.getTokenValue()),typeof H!="number"&&(y(2),H=0)}catch{y(2)}p(H);break}case 7:p(null);break;case 8:p(!0);break;case 9:p(!1);break;default:return!1}return S(),!0}function E(){return t.getToken()!==10?(y(3,[],[2,5]),!1):(w(!1),t.getToken()===6?(h(":"),S(),V()||y(4,[],[2,5])):y(5,[],[2,5]),!0)}function M(){r(),S();let H=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(H||y(4,[],[]),h(","),S(),t.getToken()===2&&b)break}else H&&y(6,[],[]);E()||y(4,[],[2,5]),H=!0}return l(),t.getToken()!==2?y(7,[2],[]):S(),!0}function N(){c(),S();let H=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(H||y(4,[],[]),h(","),S(),t.getToken()===4&&b)break}else H&&y(6,[],[]);V()||y(4,[],[4,5]),H=!0}return u(),t.getToken()!==4?y(8,[4],[]):S(),!0}function V(){switch(t.getToken()){case 3:return N();case 1:return M();case 10:return w(!0);default:return x()}}return S(),t.getToken()===17?e.allowEmptyContent?!0:(y(4,[],[]),!1):V()?(t.getToken()!==17&&y(9,[],[]),!0):(y(4,[],[]),!1)}function sE(a){switch(typeof a){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(a){if(Array.isArray(a))return"array"}else return"null";return"object"}default:return"null"}}function o9o(a){if(xm===2&&/^penguin(\.|$)/i.test(a))return"chromebook"}function zno(a,i,e,t,o,n,r,s,l,c,u){let p=Object.create(null);p["common.machineId"]=n,p["common.sqmId"]=r,p["common.devDeviceId"]=s,p.sessionID=ht()+Date.now(),p.commitHash=t,p.version=o,p["common.releaseDate"]=c,p["common.platformVersion"]=(a||"").replace(/^(\d+)(\.\d+)?(\.\d+)?(.*)/,"$1$2$3"),p["common.platform"]=oD(xm),p["common.nodePlatform"]=XO,p["common.nodeArch"]=e,p["common.product"]=u||"desktop",l&&(p["common.msftInternal"]=l);let h=0,g=Date.now();Object.defineProperties(p,{timestamp:{get:()=>new Date,enumerable:!0},"common.timesincesessionstart":{get:()=>Date.now()-g,enumerable:!0},"common.sequence":{get:()=>h++,enumerable:!0}}),Uye&&(p["common.snap"]="true");let f=o9o(i);return f&&(p["common.platformDetail"]=f),p}function Kno(a){let i=Sp.USERDNSDOMAIN;if(!i)return!1;let e=i.toLowerCase();return a.some(t=>e===t)}var lh=class{constructor(i){this.value=i;this.isTrustedTelemetryValue=!0}},mbi=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(){}},qno=new mbi;var Zue="telemetry",zRt={id:Zue,name:d(2570,null)};function EM(a,i){return!i.isBuilt&&!i.disableTelemetry?!0:!(i.disableTelemetry||!a.enableTelemetry)}function i_e(a,i){return i.extensionTestsLocationURI?!0:!(i.isBuilt||i.disableTelemetry||a.enableTelemetry&&a.aiConfig?.ariaKey)}function Yy(a){let i=a.getValue(dT),e=a.getValue(DY);if(a.getValue(xB)===!1||e===!1)return 0;switch(i??"all"){case"all":return 3;case"error":return 2;case"crash":return 1;case"off":return 0}}function KRt(a,i){if(!a)return"none";let e=Gb(a),t=i?.remoteExtensionTips;if(t&&Object.prototype.hasOwnProperty.call(t,e))return e;let o=i?.virtualWorkspaceExtensionTips;return o&&Object.prototype.hasOwnProperty.call(o,e)?e:"other"}function $no(a,i){let e=a.msftInternalDomains||[],t=i.getValue("telemetry.internalTesting");return Kno(e)||t}function jno(a){return[a.appRoot,a.extensionsPath,a.userHome.fsPath,a.tmpDir.fsPath,a.userDataPath]}function n9o(a,i){if(!a||!a.includes("/")&&!a.includes("\\"))return a;let e=a,t=[];for(let l of i)for(;;){let c=l.exec(a);if(!c)break;t.push([c.index,l.lastIndex])}let o=/(?:^|[\\\/])((node_modules|node_modules\.asar)[\\\/].*)$/,n=/^(.*?)((?:\.vscode(?:-[a-z]+)*|resources[\\\/]app)[\\\/]extensions[\\\/].*)$/i,r=/(file:\/\/)?([a-zA-Z]:(\\\\|\\|\/)|(\\\\|\\|\/))?([\w\-\._@]+(\\\\|\\|\/))+[\w\-\._@]*/g,s=0;for(e="";;){let l=r.exec(a);if(!l)break;if(!t.some(([u,p])=>l.index<p&&u<r.lastIndex)){let u=n.exec(l[0]);if(u)e+=a.substring(s,l.index)+"<REDACTED: user-file-path>/"+u[2];else{let p=o.exec(l[0]);p?e+=a.substring(s,l.index)+"<REDACTED: user-file-path>/"+p[1]:e+=a.substring(s,l.index)+"<REDACTED: user-file-path>"}s=r.lastIndex}}return s<a.length&&(e+=a.substr(s)),e}function r9o(a){if(!a)return a;let i=[{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,}/}];for(let e of i)if(e.regex.test(a))return`<REDACTED: ${e.label}>`;return a}function Qno(a,i){return a?Dk(a,e=>{if(e instanceof lh||Object.hasOwnProperty.call(e,"isTrustedTelemetryValue"))return e.value;if(typeof e=="string"){let t=e.replaceAll("%20"," ");t=n9o(t,i);for(let o of i)t=t.replace(o,"");return t=r9o(t),t}}):{}}function Ht(a,i){return a.uuid&&i.uuid?a.uuid===i.uuid:a.id===i.id?!0:MS(a.id,i.id)===0}var s9o=/^([^.]+\..+)-(\d+\.\d+\.\d+)(-(.+))?$/,GRt=class a{constructor(i,e,t="undefined"){this.identifier=i;this.version=e;this.targetPlatform=t;this.id=i.id}static create(i){let e=i.manifest?i.manifest.version:i.version,t=i.manifest?i.targetPlatform:i.properties.targetPlatform;return new a(i.identifier,e,t)}static parse(i){let e=s9o.exec(i);return e&&e[1]&&e[2]?new a({id:e[1]},e[2],e[4]||void 0):null}toString(){return`${this.id}-${this.version}${this.targetPlatform!=="undefined"?`-${this.targetPlatform}`:""}`}equals(i){return i instanceof a?Ht(this,i)&&this.version===i.version&&this.targetPlatform===i.targetPlatform:!1}},a9o=/^([^.]+\..+)@((prerelease)|(\d+\.\d+\.\d+(-.*)?))$/;function b7e(a){let i=a9o.exec(a);return i&&i[1]?[epe(i[1]),i[2]]:[epe(a),void 0]}function zS(a,i){return`${a}.${i}`}function epe(a){return a.toLowerCase()}function gf(a,i){return epe(zS(a??d_t,i))}function hbi(a,i){let e=[],t=o=>{for(let n of e)if(n.some(r=>Ht(i(r),i(o))))return n;return null};for(let o of a){let n=t(o);n?n.push(o):e.push([o])}return e}function qRt(a){return{id:a.identifier.id,name:a.manifest.name,galleryId:null,publisherId:a.publisherId,publisherName:a.manifest.publisher,publisherDisplayName:a.publisherDisplayName,dependencies:a.manifest.extensionDependencies&&a.manifest.extensionDependencies.length>0}}function tpe(a){return{id:new lh(a.identifier.id),name:new lh(a.name),extensionVersion:a.version,galleryId:a.identifier.uuid,publisherId:a.publisherId,publisherName:a.publisher,publisherDisplayName:a.publisherDisplayName,isPreReleaseVersion:a.properties.isPreReleaseVersion,dependencies:!!(a.properties.dependencies&&a.properties.dependencies.length>0),isSigned:a.isSigned,...a.telemetryData}}var Yno=new hi("pprice.better-merge");function ipe(a,i){let e=[],t=i.manifest.extensionDependencies?.slice(0)??[];for(;t.length;){let o=t.shift();if(o&&e.every(n=>!Ht(n.identifier,{id:o}))){let n=a.filter(r=>Ht(r.identifier,{id:o}));n.length===1&&(e.push(n[0]),t.push(...n[0].manifest.extensionDependencies?.slice(0)??[]))}}return e}async function l9o(a,i){if(!Sn)return!1;let e;try{e=(await a.readFile(A.file("/etc/os-release"))).value.toString()}catch{try{e=(await a.readFile(A.file("/usr/lib/os-release"))).value.toString()}catch(o){i.debug("Error while getting the os-release file.",Dn(o))}}return!!e&&(e.match(/^ID=([^\u001b\r\n]*)/m)||[])[1]==="alpine"}async function $Rt(a,i){let e=await l9o(a,i),t=DRt(e?"alpine":xm,jye);return i.debug("ComputeTargetPlatform:",t),t}function jRt(a,i){return gbi(a,i)!==void 0}function gbi(a,i){return i.find(({extensionOrPublisher:e})=>We(e)?MS(a.id.split(".")[0],e)===0:Ht(a,e))}var o_e=Object.freeze({identifier:new hi("nullExtensionDescription"),name:"Null Extension Description",version:"0.0.0",publisher:"vscode",engines:{vscode:""},extensionLocation:A.parse("void:location"),isBuiltin:!1,targetPlatform:"undefined",isUserBuiltin:!1,isUnderDevelopment:!1,preRelease:!1}),XRt="extensions.webWorker",lt=le("extensionService");var ope=class{get versionId(){return this._versionId}get allExtensions(){return this._allExtensions}get myExtensions(){return this._myExtensions}constructor(i,e,t){this._versionId=i,this._allExtensions=e.slice(0),this._myExtensions=t.slice(0),this._myActivationEvents=null}toSnapshot(){return{versionId:this._versionId,allExtensions:this._allExtensions,myExtensions:this._myExtensions,activationEvents:e3.createActivationEventsMap(this._allExtensions)}}set(i,e,t){if(this._versionId>i)throw new Error(`ExtensionHostExtensions: invalid versionId ${i} (current: ${this._versionId})`);let o=[],n=[],r=[],s=[],l=Xno(this._allExtensions),c=Xno(e),u=(v,b)=>v.extensionLocation.toString()===b.extensionLocation.toString()||v.isBuiltin===b.isBuiltin||v.isUserBuiltin===b.isUserBuiltin||v.isUnderDevelopment===b.isUnderDevelopment;for(let v of this._allExtensions){let b=c.get(v.identifier);if(!b){o.push(v.identifier),l.delete(v.identifier);continue}if(!u(v,b)){o.push(v.identifier),l.delete(v.identifier);continue}}for(let v of e){let b=l.get(v.identifier);if(!b){n.push(v);continue}if(!u(b,v)){o.push(b.identifier),l.delete(b.identifier);continue}}let p=new HS(this._myExtensions),h=new HS(t);for(let v of this._myExtensions)h.has(v)||r.push(v);for(let v of t)p.has(v)||s.push(v);let g=e3.createActivationEventsMap(n),f={versionId:i,toRemove:o,toAdd:n,addActivationEvents:g,myToRemove:r,myToAdd:s};return this.delta(f),f}delta(i){if(this._versionId>=i.versionId)return null;let{toRemove:e,toAdd:t,myToRemove:o,myToAdd:n}=i,r=new HS(e),s=new HS(o);for(let l=0;l<this._allExtensions.length;l++)r.has(this._allExtensions[l].identifier)&&(this._allExtensions.splice(l,1),l--);for(let l=0;l<this._myExtensions.length;l++)s.has(this._myExtensions[l])&&(this._myExtensions.splice(l,1),l--);for(let l of t)this._allExtensions.push(l);for(let l of n)this._myExtensions.push(l);return this._myActivationEvents=null,i}containsExtension(i){for(let e of this._myExtensions)if(hi.equals(e,i))return!0;return!1}containsActivationEvent(i){return this._myActivationEvents||(this._myActivationEvents=this._readMyActivationEvents()),this._myActivationEvents.has(i)}_readMyActivationEvents(){let i=new Set;for(let e of this._allExtensions){if(!this.containsExtension(e.identifier))continue;let t=e3.readActivationEvents(e);for(let o of t)i.add(o)}return i}};function Xno(a){let i=new uu;for(let e of a)i.set(e.identifier,e);return i}function Va(a,i){return!!a.enabledApiProposals}function S7e(a,i){if(!Va(a,i))throw new Error(`Extension '${a.identifier.value}' CANNOT use API proposal: ${i}.
Its package.json#enabledApiProposals-property declares: ${a.enabledApiProposals?.join(", ")??"[]"} but NOT ${i}.
 The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api ${a.identifier.value}`)}var QRt=class{constructor(i,e,t,o){this.codeLoadingTime=i;this.activateCallTime=e;this.activateResolvedTime=t;this.activationReason=o}},YRt=class{constructor(i,e){this.description=i,this.value=e}};function YT(a){return{type:a.isBuiltin?0:1,isBuiltin:a.isBuiltin||a.isUserBuiltin,identifier:{id:gf(a.publisher,a.name),uuid:a.uuid},manifest:a,location:a.extensionLocation,targetPlatform:a.targetPlatform,validations:[],isValid:!0,preRelease:a.preRelease,publisherDisplayName:a.publisherDisplayName}}function C0(a,i){let e=zS(a.manifest.publisher,a.manifest.name);return{id:e,identifier:new hi(e),isBuiltin:a.type===0,isUserBuiltin:a.type===1&&a.isBuiltin,isUnderDevelopment:!!i,extensionLocation:a.location,uuid:a.identifier.uuid,targetPlatform:a.targetPlatform,publisherDisplayName:a.publisherDisplayName,preRelease:a.preRelease,...a.manifest}}function x0(a){switch(a){case 1:return d(123,null);case 2:return d(122,null);case 3:return d(124,null);case 4:return d(125,null);case 5:return d(119,null);case 6:return d(120,null);case 7:return d(117,null);case 8:return d(118,null);case 9:return d(121,null);default:return""}}async function k0(a,i,e){let t=e&&e.get("storage.serviceMachineId",-1)||null;if(t)return t;try{let n=(await i.readFile(a.serviceMachineIdResource)).value.toString();t=Pyt(n)?n:null}catch{t=null}if(!t){t=ht();try{await i.writeFile(a.serviceMachineIdResource,Ke.fromString(t))}catch{}}return e?.store("storage.serviceMachineId",t,-1,1),t}var tb=le("IExtensionGalleryManifestService");function jA(a,i){let[e,t]=i.split("/");for(let o of a.resources){let[n,r]=o.type.split("/");if(n===e){if(!t||r===t)return o.id;break}}}var I7e="extensions.gallery.serviceUrl";var c9o="/web-extension-resource/",aE=le("extensionResourceLoaderService");var JRt=class extends k{constructor(e,t,o,n,r,s,l){super();this._fileService=e;this._storageService=t;this._productService=o;this._environmentService=n;this._configurationService=r;this._extensionGalleryManifestService=s;this._logService=l;this._initPromise=this._init()}async _init(){try{let e=await this._extensionGalleryManifestService.getExtensionGalleryManifest();this.resolve(e),this._register(this._extensionGalleryManifestService.onDidChangeExtensionGalleryManifest(()=>this.resolve(e)))}catch(e){this._logService.error(e)}}resolve(e){this._extensionGalleryResourceUrlTemplate=e?jA(e,"ExtensionResourceUriTemplate"):void 0,this._extensionGalleryAuthority=this._extensionGalleryResourceUrlTemplate?this._getExtensionGalleryAuthority(A.parse(this._extensionGalleryResourceUrlTemplate)):void 0}async supportsExtensionGalleryResources(){return await this._initPromise,this._extensionGalleryResourceUrlTemplate!==void 0}async getExtensionGalleryResourceURL({publisher:e,name:t,version:o,targetPlatform:n},r){if(await this._initPromise,this._extensionGalleryResourceUrlTemplate){let s=A.parse(rD(this._extensionGalleryResourceUrlTemplate,{publisher:e,name:t,version:n!==void 0&&n!=="undefined"&&n!=="unknown"&&n!=="universal"?`${o}+${n}`:o,path:"extension"}));return this._isWebExtensionResourceEndPoint(s)?s.with({scheme:xL.getPreferredWebSchema()}):s}}async isExtensionGalleryResource(e){return await this._initPromise,!!this._extensionGalleryAuthority&&this._extensionGalleryAuthority===this._getExtensionGalleryAuthority(e)}async getExtensionGalleryRequestHeaders(){let e={"X-Client-Name":`${this._productService.applicationName}${Ft?"-web":""}`,"X-Client-Version":this._productService.version};return EM(this._productService,this._environmentService)&&Yy(this._configurationService)===3&&(e["X-Machine-Id"]=await this._getServiceMachineId()),this._productService.commit&&(e["X-Client-Commit"]=this._productService.commit),e}_getServiceMachineId(){return this._serviceMachineIdPromise||(this._serviceMachineIdPromise=k0(this._environmentService,this._fileService,this._storageService)),this._serviceMachineIdPromise}_getExtensionGalleryAuthority(e){if(this._isWebExtensionResourceEndPoint(e))return e.authority;let t=e.authority.indexOf(".");return t!==-1?e.authority.substring(t+1):void 0}_isWebExtensionResourceEndPoint(e){let t=e.path,o=xL.getServerRootPath();return t.startsWith(o)&&t.startsWith(c9o,o.length)}};function Jno(a){if(!Array.isArray(a))return!1;for(let i=0,e=a.length;i<e;i++)if(typeof a[i]!="string")return!1;return!0}function y7e(a){return Jno(a)&&a.length===2}var tZ=class extends k{constructor(e,t,o,n){super();this._languageService=e;this._extensionResourceLoaderService=t;this._extensionService=o;this._languageConfigurationService=n;this._done=new Map;this._register(this._languageService.onDidRequestBasicLanguageFeatures(async r=>{this._extensionService.whenInstalledExtensionsRegistered().then(()=>{this._loadConfigurationsForMode(r)})})),this._register(this._languageService.onDidChange(()=>{for(let[r]of this._done)this._loadConfigurationsForMode(r)}))}async _loadConfigurationsForMode(e){let t=this._languageService.getConfigurationFiles(e),o=Lr(t.map(r=>r.toString()));if(this._done.get(e)===o)return;this._done.set(e,o);let n=await Promise.all(t.map(r=>this._readConfigFile(r)));for(let r of n)this._handleConfig(e,r)}async _readConfigFile(e){try{let t=await this._extensionResourceLoaderService.readExtensionResource(e),o=[],n=is(t,o);return o.length&&console.error(d(10160,null,e.toString(),o.map(r=>`[${r.offset}, ${r.length}] ${x0(r.error)}`).join(`
`))),sE(n)!=="object"&&(console.error(d(10159,null,e.toString())),n={}),n}catch(t){return console.error(t),{}}}static _extractValidCommentRule(e,t){let o=t.comments;if(typeof o>"u")return;if(!Di(o)){console.warn(`[${e}]: language configuration: expected \`comments\` to be an object.`);return}let n;if(typeof o.lineComment<"u")if(typeof o.lineComment=="string")n=n||{},n.lineComment=o.lineComment;else if(Di(o.lineComment)){let r=o.lineComment;typeof r.comment=="string"?(n=n||{},n.lineComment={comment:r.comment,noIndent:r.noIndent}):console.warn(`[${e}]: language configuration: expected \`comments.lineComment.comment\` to be a string.`)}else console.warn(`[${e}]: language configuration: expected \`comments.lineComment\` to be a string or an object with comment property.`);return typeof o.blockComment<"u"&&(y7e(o.blockComment)?(n=n||{},n.blockComment=o.blockComment):console.warn(`[${e}]: language configuration: expected \`comments.blockComment\` to be an array of two strings.`)),n}static _extractValidBrackets(e,t){let o=t.brackets;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`brackets\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!y7e(l)){console.warn(`[${e}]: language configuration: expected \`brackets[${r}]\` to be an array of two strings.`);continue}n=n||[],n.push(l)}return n}static _extractValidAutoClosingPairs(e,t){let o=t.autoClosingPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(Array.isArray(l)){if(!y7e(l)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}]\` to be an array of two strings or an object.`);continue}n=n||[],n.push({open:l[0],close:l[1]})}else{if(!Di(l)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}]\` to be an array of two strings or an object.`);continue}if(typeof l.open!="string"){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].open\` to be a string.`);continue}if(typeof l.close!="string"){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].close\` to be a string.`);continue}if(typeof l.notIn<"u"&&!Jno(l.notIn)){console.warn(`[${e}]: language configuration: expected \`autoClosingPairs[${r}].notIn\` to be a string array.`);continue}n=n||[],n.push({open:l.open,close:l.close,notIn:l.notIn})}}return n}static _extractValidSurroundingPairs(e,t){let o=t.surroundingPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(Array.isArray(l)){if(!y7e(l)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}]\` to be an array of two strings or an object.`);continue}n=n||[],n.push({open:l[0],close:l[1]})}else{if(!Di(l)){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}]\` to be an array of two strings or an object.`);continue}if(typeof l.open!="string"){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}].open\` to be a string.`);continue}if(typeof l.close!="string"){console.warn(`[${e}]: language configuration: expected \`surroundingPairs[${r}].close\` to be a string.`);continue}n=n||[],n.push({open:l.open,close:l.close})}}return n}static _extractValidColorizedBracketPairs(e,t){let o=t.colorizedBracketPairs;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`colorizedBracketPairs\` to be an array.`);return}let n=[];for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!y7e(l)){console.warn(`[${e}]: language configuration: expected \`colorizedBracketPairs[${r}]\` to be an array of two strings.`);continue}n.push([l[0],l[1]])}return n}static _extractValidOnEnterRules(e,t){let o=t.onEnterRules;if(typeof o>"u")return;if(!Array.isArray(o)){console.warn(`[${e}]: language configuration: expected \`onEnterRules\` to be an array.`);return}let n;for(let r=0,s=o.length;r<s;r++){let l=o[r];if(!Di(l)){console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}]\` to be an object.`);continue}if(!Di(l.action)){console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action\` to be an object.`);continue}let c;if(l.action.indent==="none")c=0;else if(l.action.indent==="indent")c=1;else if(l.action.indent==="indentOutdent")c=2;else if(l.action.indent==="outdent")c=3;else{console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.indent\` to be 'none', 'indent', 'indentOutdent' or 'outdent'.`);continue}let u={indentAction:c};l.action.appendText&&(typeof l.action.appendText=="string"?u.appendText=l.action.appendText:console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.appendText\` to be undefined or a string.`)),l.action.removeText&&(typeof l.action.removeText=="number"?u.removeText=l.action.removeText:console.warn(`[${e}]: language configuration: expected \`onEnterRules[${r}].action.removeText\` to be undefined or a number.`));let p=this._parseRegex(e,`onEnterRules[${r}].beforeText`,l.beforeText);if(!p)continue;let h={beforeText:p,action:u};if(l.afterText){let g=this._parseRegex(e,`onEnterRules[${r}].afterText`,l.afterText);g&&(h.afterText=g)}if(l.previousLineText){let g=this._parseRegex(e,`onEnterRules[${r}].previousLineText`,l.previousLineText);g&&(h.previousLineText=g)}n=n||[],n.push(h)}return n}static extractValidConfig(e,t){let o=this._extractValidCommentRule(e,t),n=this._extractValidBrackets(e,t),r=this._extractValidAutoClosingPairs(e,t),s=this._extractValidSurroundingPairs(e,t),l=this._extractValidColorizedBracketPairs(e,t),c=typeof t.autoCloseBefore=="string"?t.autoCloseBefore:void 0,u=t.wordPattern?this._parseRegex(e,"wordPattern",t.wordPattern):void 0,p=t.indentationRules?this._mapIndentationRules(e,t.indentationRules):void 0,h;if(t.folding){let v=t.folding.markers,b=v&&v.start?this._parseRegex(e,"folding.markers.start",v.start):void 0,S=v&&v.end?this._parseRegex(e,"folding.markers.end",v.end):void 0,y=b&&S?{start:b,end:S}:void 0;h={offSide:t.folding.offSide,markers:y}}let g=this._extractValidOnEnterRules(e,t);return{comments:o,brackets:n,wordPattern:u,indentationRules:p,onEnterRules:g,autoClosingPairs:r,surroundingPairs:s,colorizedBracketPairs:l,autoCloseBefore:c,folding:h,__electricCharacterSupport:void 0}}_handleConfig(e,t){let o=tZ.extractValidConfig(e,t);this._languageConfigurationService.register(e,o,50)}static _parseRegex(e,t,o){if(typeof o=="string")try{return new RegExp(o,"")}catch(n){console.warn(`[${e}]: Invalid regular expression in \`${t}\`: `,n);return}if(Di(o)){if(typeof o.pattern!="string"){console.warn(`[${e}]: language configuration: expected \`${t}.pattern\` to be a string.`);return}if(typeof o.flags<"u"&&typeof o.flags!="string"){console.warn(`[${e}]: language configuration: expected \`${t}.flags\` to be a string.`);return}try{return new RegExp(o.pattern,o.flags)}catch(n){console.warn(`[${e}]: Invalid regular expression in \`${t}\`: `,n);return}}console.warn(`[${e}]: language configuration: expected \`${t}\` to be a string or an object.`)}static _mapIndentationRules(e,t){let o=this._parseRegex(e,"indentationRules.increaseIndentPattern",t.increaseIndentPattern);if(!o)return;let n=this._parseRegex(e,"indentationRules.decreaseIndentPattern",t.decreaseIndentPattern);if(!n)return;let r={increaseIndentPattern:o,decreaseIndentPattern:n};return t.indentNextLinePattern&&(r.indentNextLinePattern=this._parseRegex(e,"indentationRules.indentNextLinePattern",t.indentNextLinePattern)),t.unIndentedLinePattern&&(r.unIndentedLinePattern=this._parseRegex(e,"indentationRules.unIndentedLinePattern",t.unIndentedLinePattern)),r}};tZ=I([m(0,Rt),m(1,aE),m(2,lt),m(3,Us)],tZ);var d9o="vscode://schemas/language-configuration",u9o={allowComments:!0,allowTrailingCommas:!0,default:{comments:{blockComment:["/*","*/"],lineComment:"//"},brackets:[["(",")"],["[","]"],["{","}"]],autoClosingPairs:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[["(",")"],["[","]"],["{","}"]]},definitions:{openBracket:{type:"string",description:d(10217,null)},closeBracket:{type:"string",description:d(10168,null)},bracketPair:{type:"array",items:[{$ref:"#/definitions/openBracket"},{$ref:"#/definitions/closeBracket"}]}},properties:{comments:{default:{blockComment:["/*","*/"],lineComment:{comment:"//",noIndent:!1}},description:d(10170,null),type:"object",properties:{blockComment:{type:"array",description:d(10166,null),items:[{type:"string",description:d(10164,null)},{type:"string",description:d(10165,null)}]},lineComment:{type:"object",description:d(10195,null),properties:{comment:{type:"string",description:d(10193,null)},noIndent:{type:"boolean",description:d(10194,null),default:!1}},required:["comment"],additionalProperties:!1}}},brackets:{default:[["(",")"],["[","]"],["{","}"]],markdownDescription:d(10167,null,"`colorizedBracketPairs`"),type:"array",items:{$ref:"#/definitions/bracketPair"}},colorizedBracketPairs:{default:[["(",")"],["[","]"],["{","}"]],markdownDescription:d(10169,null,"`brackets`"),type:"array",items:{$ref:"#/definitions/bracketPair"}},autoClosingPairs:{default:[["(",")"],["[","]"],["{","}"]],description:d(10162,null),type:"array",items:{oneOf:[{$ref:"#/definitions/bracketPair"},{type:"object",properties:{open:{$ref:"#/definitions/openBracket"},close:{$ref:"#/definitions/closeBracket"},notIn:{type:"array",description:d(10163,null),items:{enum:["string","comment"]}}}}]}},autoCloseBefore:{default:`;:.,=}])> 
	`,description:d(10161,null),type:"string"},surroundingPairs:{default:[["(",")"],["[","]"],["{","}"]],description:d(10218,null),type:"array",items:{oneOf:[{$ref:"#/definitions/bracketPair"},{type:"object",properties:{open:{$ref:"#/definitions/openBracket"},close:{$ref:"#/definitions/closeBracket"}}}]}},wordPattern:{default:"",description:d(10219,null),type:["string","object"],properties:{pattern:{type:"string",description:d(10222,null),default:""},flags:{type:"string",description:d(10220,null),default:"g",pattern:"^([gimuy]+)$",patternErrorMessage:d(10221,null)}}},indentationRules:{default:{increaseIndentPattern:"",decreaseIndentPattern:""},description:d(10176,null),type:"object",properties:{increaseIndentPattern:{type:["string","object"],description:d(10181,null),properties:{pattern:{type:"string",description:d(10184,null),default:""},flags:{type:"string",description:d(10183,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(10182,null)}}},decreaseIndentPattern:{type:["string","object"],description:d(10177,null),properties:{pattern:{type:"string",description:d(10180,null),default:""},flags:{type:"string",description:d(10179,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(10178,null)}}},indentNextLinePattern:{type:["string","object"],description:d(10185,null),properties:{pattern:{type:"string",description:d(10188,null),default:""},flags:{type:"string",description:d(10187,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(10186,null)}}},unIndentedLinePattern:{type:["string","object"],description:d(10189,null),properties:{pattern:{type:"string",description:d(10192,null),default:""},flags:{type:"string",description:d(10191,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(10190,null)}}}}},folding:{type:"object",description:d(10171,null),properties:{offSide:{type:"boolean",description:d(10175,null)},markers:{type:"object",description:d(10172,null),properties:{start:{type:"string",description:d(10174,null)},end:{type:"string",description:d(10173,null)}}}}},onEnterRules:{type:"array",description:d(10196,null),items:{type:"object",description:d(10196,null),required:["beforeText","action"],properties:{beforeText:{type:["string","object"],description:d(10209,null),properties:{pattern:{type:"string",description:d(10212,null),default:""},flags:{type:"string",description:d(10211,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(10210,null)}}},afterText:{type:["string","object"],description:d(10205,null),properties:{pattern:{type:"string",description:d(10208,null),default:""},flags:{type:"string",description:d(10207,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(10206,null)}}},previousLineText:{type:["string","object"],description:d(10213,null),properties:{pattern:{type:"string",description:d(10216,null),default:""},flags:{type:"string",description:d(10215,null),default:"",pattern:"^([gimuy]+)$",patternErrorMessage:d(10214,null)}}},action:{type:["string","object"],description:d(10197,null),required:["indent"],default:{indent:"indent"},properties:{indent:{type:"string",description:d(10199,null),default:"indent",enum:["none","indent","indentOutdent","outdent"],markdownEnumDescriptions:[d(10202,null),d(10200,null),d(10201,null),d(10203,null)]},appendText:{type:"string",description:d(10198,null),default:""},removeText:{type:"number",description:d(10204,null),default:0}}}}}}}},p9o=oe.as(Ta.JSONContribution);p9o.registerSchema(d9o,u9o);var Fr=le("statusbarService");function npe(a){let i=a;return typeof i?.location?.id=="string"&&typeof i.alignment=="number"}function Zno(a){let i=a;return(typeof i?.primary=="number"||npe(i?.primary))&&typeof i?.secondary=="number"}var i3={id:"statusBar.entry.showTooltip",title:""},ero=["standard","warning","error","prominent","remote","offline"];function tro(a){let i=a;return!!i?.content&&Array.isArray(i?.commands)}var dd=le("remoteAuthorityResolverService");var eLt=class{constructor(i){this.id=i;this.type=1}toString(){return`Managed(${this.id})`}},tLt=class{constructor(i,e){this.host=i;this.port=e;this.type=0}toString(){return`WebSocket(${this.host}:${this.port})`}};var mC=class a extends ka{static isNotAvailable(i){return i instanceof a&&i._code==="NotAvailable"}static isTemporarilyNotAvailable(i){return i instanceof a&&i._code==="TemporarilyNotAvailable"}static isNoResolverFound(i){return i instanceof a&&i._code==="NoResolverFound"}static isInvalidAuthority(i){return i instanceof a&&i._code==="InvalidAuthority"}static isHandled(i){return i instanceof a&&i.isHandled}constructor(i,e="Unknown",t){super(i),this._message=i,this._code=e,this._detail=t,this.isHandled=e==="NotAvailable"&&t===!0,Object.setPrototypeOf(this,a.prototype)}};function E2(a){let i=a.indexOf("+");return i===-1?a:a.substring(0,i)}function Dr(a){return Object.assign(a,{apply:function(...e){if(e.length===0)return Reflect.construct(a,[]);{let t=e.length===1?[]:e[1];return Reflect.construct(a,t,e[0].constructor)}},call:function(...e){if(e.length===0)return Reflect.construct(a,[]);{let[t,...o]=e;return Reflect.construct(a,o,t.constructor)}}})}var hC,lE=class{constructor(i,e=!1){Aye(this,hC);z5e(this,hC,new he(i,{supportThemeIcons:e}))}static isMarkdownString(i){return i instanceof lE?!0:!i||typeof i!="object"?!1:i.appendCodeblock&&i.appendMarkdown&&i.appendText&&i.value!==void 0}get value(){return cv(this,hC).value}set value(i){cv(this,hC).value=i}get isTrusted(){return cv(this,hC).isTrusted}set isTrusted(i){cv(this,hC).isTrusted=i}get supportThemeIcons(){return cv(this,hC).supportThemeIcons}set supportThemeIcons(i){cv(this,hC).supportThemeIcons=i}get supportHtml(){return cv(this,hC).supportHtml}set supportHtml(i){cv(this,hC).supportHtml=i}get supportAlertSyntax(){return cv(this,hC).supportAlertSyntax}set supportAlertSyntax(i){cv(this,hC).supportAlertSyntax=i}get baseUri(){return cv(this,hC).baseUri}set baseUri(i){cv(this,hC).baseUri=i}appendText(i){return cv(this,hC).appendText(i),this}appendMarkdown(i){return cv(this,hC).appendMarkdown(i),this}appendCodeblock(i,e){return cv(this,hC).appendCodeblock(e??"",i),this}};hC=new WeakMap,lE=I([Dr],lE);var Oc=class{static Min(...i){if(i.length===0)throw new TypeError;let e=i[0];for(let t=1;t<i.length;t++){let o=i[t];o.isBefore(e)&&(e=o)}return e}static Max(...i){if(i.length===0)throw new TypeError;let e=i[0];for(let t=1;t<i.length;t++){let o=i[t];o.isAfter(e)&&(e=o)}return e}static isPosition(i){if(!i)return!1;if(i instanceof Oc)return!0;let{line:e,character:t}=i;return typeof e=="number"&&typeof t=="number"}static of(i){if(i instanceof Oc)return i;if(this.isPosition(i))return new Oc(i.line,i.character);throw new Error("Invalid argument, is NOT a position-like object")}get line(){return this._line}get character(){return this._character}constructor(i,e){if(i<0)throw ls("line must be non-negative");if(e<0)throw ls("character must be non-negative");this._line=i,this._character=e}isBefore(i){return this._line<i._line?!0:i._line<this._line?!1:this._character<i._character}isBeforeOrEqual(i){return this._line<i._line?!0:i._line<this._line?!1:this._character<=i._character}isAfter(i){return!this.isBeforeOrEqual(i)}isAfterOrEqual(i){return!this.isBefore(i)}isEqual(i){return this._line===i._line&&this._character===i._character}compareTo(i){return this._line<i._line?-1:this._line>i.line?1:this._character<i._character?-1:this._character>i._character?1:0}translate(i,e=0){if(i===null||e===null)throw ls();let t;return typeof i>"u"?t=0:typeof i=="number"?t=i:(t=typeof i.lineDelta=="number"?i.lineDelta:0,e=typeof i.characterDelta=="number"?i.characterDelta:0),t===0&&e===0?this:new Oc(this.line+t,this.character+e)}with(i,e=this.character){if(i===null||e===null)throw ls();let t;return typeof i>"u"?t=this.line:typeof i=="number"?t=i:(t=typeof i.line=="number"?i.line:this.line,e=typeof i.character=="number"?i.character:this.character),t===this.line&&e===this.character?this:new Oc(t,e)}toJSON(){return{line:this.line,character:this.character}}[Symbol.for("debug.description")](){return`(${this.line}:${this.character})`}};Oc=I([Dr],Oc);var Td=class{static isRange(i){return i instanceof Td?!0:!i||typeof i!="object"?!1:Oc.isPosition(i.start)&&Oc.isPosition(i.end)}static of(i){if(i instanceof Td)return i;if(this.isRange(i))return new Td(i.start,i.end);throw new Error("Invalid argument, is NOT a range-like object")}get start(){return this._start}get end(){return this._end}constructor(i,e,t,o){let n,r;if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof o=="number"?(n=new Oc(i,e),r=new Oc(t,o)):Oc.isPosition(i)&&Oc.isPosition(e)&&(n=Oc.of(i),r=Oc.of(e)),!n||!r)throw new Error("Invalid arguments");n.isBefore(r)?(this._start=n,this._end=r):(this._start=r,this._end=n)}contains(i){return Td.isRange(i)?this.contains(i.start)&&this.contains(i.end):Oc.isPosition(i)?!(Oc.of(i).isBefore(this._start)||this._end.isBefore(i)):!1}isEqual(i){return this._start.isEqual(i._start)&&this._end.isEqual(i._end)}intersection(i){let e=Oc.Max(i.start,this._start),t=Oc.Min(i.end,this._end);if(!e.isAfter(t))return new Td(e,t)}union(i){if(this.contains(i))return this;if(i.contains(this))return i;let e=Oc.Min(i.start,this._start),t=Oc.Max(i.end,this.end);return new Td(e,t)}get isEmpty(){return this._start.isEqual(this._end)}get isSingleLine(){return this._start.line===this._end.line}with(i,e=this.end){if(i===null||e===null)throw ls();let t;return i?Oc.isPosition(i)?t=i:(t=i.start||this.start,e=i.end||this.end):t=this.start,t.isEqual(this._start)&&e.isEqual(this.end)?this:new Td(t,e)}toJSON(){return[this.start,this.end]}[Symbol.for("debug.description")](){return fbi(this)}};Td=I([Dr],Td);function fbi(a){return a.isEmpty?`[${a.start.line}:${a.start.character})`:`[${a.start.line}:${a.start.character} -> ${a.end.line}:${a.end.character})`}var Pm=class{constructor(i){this.value=i}append(i){return new Pm(this.value?this.value+Pm.sep+i:i)}intersects(i){return this.contains(i)||i.contains(this)}contains(i){return this.value===i.value||i.value.startsWith(this.value+Pm.sep)}};Pm.sep=".",Pm=I([Dr],Pm);Pm.Empty=new Pm("");Pm.QuickFix=Pm.Empty.append("quickfix");Pm.Refactor=Pm.Empty.append("refactor");Pm.RefactorExtract=Pm.Refactor.append("extract");Pm.RefactorInline=Pm.Refactor.append("inline");Pm.RefactorMove=Pm.Refactor.append("move");Pm.RefactorRewrite=Pm.Refactor.append("rewrite");Pm.Source=Pm.Empty.append("source");Pm.SourceOrganizeImports=Pm.Source.append("organizeImports");Pm.SourceFixAll=Pm.Source.append("fixAll");Pm.Notebook=Pm.Empty.append("notebook");var iLt=(o=>(o[o.Hint=3]="Hint",o[o.Information=2]="Information",o[o.Warning=1]="Warning",o[o.Error=0]="Error",o))(iLt||{}),iZ=class{static is(i){return i?typeof i.message=="string"&&i.location&&Td.isRange(i.location.range)&&A.isUri(i.location.uri):!1}constructor(i,e){this.location=i,this.message=e}static isEqual(i,e){return i===e?!0:!i||!e?!1:i.message===e.message&&i.location.range.isEqual(e.location.range)&&i.location.uri.toString()===e.location.uri.toString()}};iZ=I([Dr],iZ);var rpe=class{constructor(i,e,t=0){if(!Td.isRange(i))throw new TypeError("range must be set");if(!e)throw new TypeError("message must be set");this.range=i,this.message=e,this.severity=t}toJSON(){return{severity:iLt[this.severity],message:this.message,range:this.range,source:this.source,code:this.code}}static isEqual(i,e){return i===e?!0:!i||!e?!1:i.message===e.message&&i.severity===e.severity&&i.code===e.code&&i.severity===e.severity&&i.source===e.source&&i.range.isEqual(e.range)&&eo(i.tags,e.tags)&&eo(i.relatedInformation,e.relatedInformation,iZ.isEqual)}};rpe=I([Dr],rpe);var UD=class{static isLocation(i){return i instanceof UD?!0:i?Td.isRange(i.range)&&A.isUri(i.uri):!1}constructor(i,e){if(this.uri=i,e)if(Td.isRange(e))this.range=Td.of(e);else if(Oc.isPosition(e))this.range=new Td(e,e);else throw new Error("Illegal argument")}toJSON(){return{uri:this.uri,range:this.range}}};UD=I([Dr],UD);var o3=class a{static isNotebookRange(i){return i instanceof a?!0:i?typeof i.start=="number"&&typeof i.end=="number":!1}get start(){return this._start}get end(){return this._end}get isEmpty(){return this._start===this._end}constructor(i,e){if(i<0)throw ls("start must be positive");if(e<0)throw ls("end must be positive");i<=e?(this._start=i,this._end=e):(this._start=e,this._end=i)}with(i){let e=this._start,t=this._end;return i.start!==void 0&&(e=i.start),i.end!==void 0&&(t=i.end),e===this._start&&t===this._end?this:new a(e,t)}},n_e=class a{static validate(i){if(typeof i.kind!="number")throw new Error("NotebookCellData MUST have 'kind' property");if(typeof i.value!="string")throw new Error("NotebookCellData MUST have 'value' property");if(typeof i.languageId!="string")throw new Error("NotebookCellData MUST have 'languageId' property")}static isNotebookCellDataArray(i){return Array.isArray(i)&&i.every(e=>a.isNotebookCellData(e))}static isNotebookCellData(i){return!0}constructor(i,e,t,o,n,r,s){this.kind=i,this.value=e,this.languageId=t,this.mime=o,this.outputs=n??[],this.metadata=r,this.executionSummary=s,a.validate(this)}},w7e=class{constructor(i){this.cells=i}},TM=class{static isNotebookCellEdit(i){return i instanceof TM?!0:i?o3.isNotebookRange(i)&&Array.isArray(i.newCells):!1}static replaceCells(i,e){return new TM(i,e)}static insertCells(i,e){return new TM(new o3(i,i),e)}static deleteCells(i){return new TM(i,[])}static updateCellMetadata(i,e){let t=new TM(new o3(i,i),[]);return t.newCellMetadata=e,t}static updateNotebookMetadata(i){let e=new TM(new o3(0,0),[]);return e.newNotebookMetadata=i,e}constructor(i,e){this.range=i,this.newCells=e}};TM=I([Dr],TM);var C7e=class a{constructor(i,e){this.data=i;this.mime=e;let t=Jni(e,!0);if(!t)throw new Error(`INVALID mime type: ${e}. Must be in the format "type/subtype[;optionalparameter]"`);this.mime=t}static isNotebookCellOutputItem(i){return i instanceof a?!0:i?typeof i.mime=="string"&&i.data instanceof Uint8Array:!1}static error(i){let e={name:i.name,message:i.message,stack:i.stack};return a.json(e,"application/vnd.code.notebook.error")}static stdout(i){return a.text(i,"application/vnd.code.notebook.stdout")}static stderr(i){return a.text(i,"application/vnd.code.notebook.stderr")}static bytes(i,e="application/octet-stream"){return new a(i,e)}static $a=new TextEncoder;static text(i,e=cr.text){let t=a.$a.encode(String(i));return new a(t,e)}static json(i,e="text/x-json"){let t=JSON.stringify(i,void 0,"	");return a.text(t,e)}},x7e=class a{static isNotebookCellOutput(i){return i instanceof a?!0:!i||typeof i!="object"?!1:typeof i.id=="string"&&Array.isArray(i.items)}static ensureUniqueMimeTypes(i,e=!1){let t=new Set,o=new Set;for(let n=0;n<i.length;n++){let r=i[n],s=Jni(r.mime);if(!t.has(s)||FL(s)){t.add(s);continue}o.add(n),e&&console.warn(`DUPLICATED mime type '${r.mime}' will be dropped`)}return o.size===0?i:i.filter((n,r)=>!o.has(r))}constructor(i,e,t){this.items=a.ensureUniqueMimeTypes(i,!0),typeof e=="string"?(this.id=e,this.metadata=t):(this.id=ht(),this.metadata=e??t)}};var n3=class extends Td{static isSelection(i){return i instanceof n3?!0:!i||typeof i!="object"?!1:Td.isRange(i)&&Oc.isPosition(i.anchor)&&Oc.isPosition(i.active)&&typeof i.isReversed=="boolean"}get anchor(){return this._anchor}get active(){return this._active}constructor(i,e,t,o){let n,r;if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof o=="number"?(n=new Oc(i,e),r=new Oc(t,o)):Oc.isPosition(i)&&Oc.isPosition(e)&&(n=Oc.of(i),r=Oc.of(e)),!n||!r)throw new Error("Invalid arguments");super(n,r),this._anchor=n,this._active=r}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 m9o(this)}};n3=I([Dr],n3);function m9o(a){let i=fbi(a);return a.isEmpty||(a.active.isEqual(a.start)?i=`|${i}`:i=`${i}|`),i}var XT=class{constructor(i){this._tabstop=1;this.value=i||""}static isSnippetString(i){return i instanceof XT?!0:!i||typeof i!="object"?!1:typeof i.value=="string"}static _escape(i){return i.replace(/\$|}|\\/g,"\\$&")}appendText(i){return this.value+=XT._escape(i),this}appendTabstop(i=this._tabstop++){return this.value+="$",this.value+=i,this}appendPlaceholder(i,e=this._tabstop++){if(typeof i=="function"){let t=new XT;t._tabstop=this._tabstop,i(t),this._tabstop=t._tabstop,i=t.value}else i=XT._escape(i);return this.value+="${",this.value+=e,this.value+=":",this.value+=i,this.value+="}",this}appendChoice(i,e=this._tabstop++){let t=i.map(o=>o.replaceAll(/[|\\,]/g,"\\$&")).join(",");return this.value+="${",this.value+=e,this.value+="|",this.value+=t,this.value+="|}",this}appendVariable(i,e){if(typeof e=="function"){let t=new XT;t._tabstop=this._tabstop,e(t),this._tabstop=t._tabstop,e=t.value}else typeof e=="string"&&(e=e.replace(/\$|}/g,"\\$&"));return this.value+="${",this.value+=i,e&&(this.value+=":",this.value+=e),this.value+="}",this}};XT=I([Dr],XT);var spe=class a{static isSnippetTextEdit(i){return i instanceof a?!0:i?Td.isRange(i.range)&&XT.isSnippetString(i.snippet):!1}static replace(i,e){return new a(i,e)}static insert(i,e){return a.replace(new Td(i,i),e)}constructor(i,e){this.range=i,this.snippet=e}};var oLt=(K=>(K[K.File=0]="File",K[K.Module=1]="Module",K[K.Namespace=2]="Namespace",K[K.Package=3]="Package",K[K.Class=4]="Class",K[K.Method=5]="Method",K[K.Property=6]="Property",K[K.Field=7]="Field",K[K.Constructor=8]="Constructor",K[K.Enum=9]="Enum",K[K.Interface=10]="Interface",K[K.Function=11]="Function",K[K.Variable=12]="Variable",K[K.Constant=13]="Constant",K[K.String=14]="String",K[K.Number=15]="Number",K[K.Boolean=16]="Boolean",K[K.Array=17]="Array",K[K.Object=18]="Object",K[K.Key=19]="Key",K[K.Null=20]="Null",K[K.EnumMember=21]="EnumMember",K[K.Struct=22]="Struct",K[K.Event=23]="Event",K[K.Operator=24]="Operator",K[K.TypeParameter=25]="TypeParameter",K))(oLt||{});var r3=class{static validate(i){if(!i.name)throw new Error("name must not be falsy")}constructor(i,e,t,o,n){this.name=i,this.kind=e,this.containerName=n,typeof t=="string"&&(this.containerName=t),o instanceof UD?this.location=o:t instanceof Td&&(this.location=new UD(o,t)),r3.validate(this)}toJSON(){return{name:this.name,kind:oLt[this.kind],location:this.location,containerName:this.containerName}}};r3=I([Dr],r3);var cE=class{static isTextEdit(i){return i instanceof cE?!0:!i||typeof i!="object"?!1:Td.isRange(i)&&typeof i.newText=="string"}static replace(i,e){return new cE(i,e)}static insert(i,e){return cE.replace(new Td(i,i),e)}static delete(i){return cE.replace(i,"")}static setEndOfLine(i){let e=new cE(new Td(new Oc(0,0),new Oc(0,0)),"");return e.newEol=i,e}get range(){return this._range}set range(i){if(i&&!Td.isRange(i))throw ls("range");this._range=i}get newText(){return this._newText||""}set newText(i){if(i&&typeof i!="string")throw ls("newText");this._newText=i}get newEol(){return this._newEol}set newEol(i){if(i&&typeof i!="number")throw ls("newEol");this._newEol=i}constructor(i,e){this._range=i,this._newText=e}toJSON(){return{range:this.range,newText:this.newText,newEol:this._newEol}}};cE=I([Dr],cE);var s3=le("notebookDocumentService"),vbi=["W","X","Y","Z","a","b","c","d","e","f"],h9o=new RegExp(`^[${vbi.join("")}]+`),iro=7;function r_e(a){if(a.scheme!==Q.vscodeNotebookCell)return;let i=a.fragment.indexOf("s");if(i<0)return;let e=parseInt(a.fragment.substring(0,i).replace(h9o,""),iro),t=Ws(a.fragment.substring(i+1)).toString();if(!isNaN(e))return{handle:e,notebook:a.with({scheme:t,fragment:null})}}function oro(a,i){let e=i.toString(iro),o=`${e.length<vbi.length?vbi[e.length-1]:"z"}${e}s${gc(Ke.fromString(a.scheme),!0,!0)}`;return a.with({scheme:Q.vscodeNotebookCell,fragment:o})}function nro(a){if(a.scheme!==Q.vscodeNotebookMetadata)return;let i=Ws(a.fragment).toString();return a.with({scheme:i,fragment:null})}function rro(a){let i=`${gc(Ke.fromString(a.scheme),!0,!0)}`;return a.with({scheme:Q.vscodeNotebookMetadata,fragment:i})}function k7e(a){if(a.scheme!==Q.vscodeNotebookCellOutput)return;let i=new URLSearchParams(a.query),e=i.get("openIn");if(!e)return;let t=i.get("outputId")??void 0,o=r_e(a.with({scheme:Q.vscodeNotebookCell,query:null})),n=i.get("outputIndex")?parseInt(i.get("outputIndex")||"",10):void 0,r=o?o.notebook:a.with({scheme:i.get("notebookScheme")||Q.file,fragment:null,query:null}),s=i.get("cellIndex")?parseInt(i.get("cellIndex")||"",10):void 0;return{notebook:r,openIn:e,outputId:t,outputIndex:n,cellHandle:o?.handle,cellFragment:a.fragment,cellIndex:s}}var bbi=class{constructor(){this._documents=new dt}getNotebook(i){if(i.scheme===Q.vscodeNotebookCell){let e=r_e(i);if(e){let t=this._documents.get(e.notebook);if(t)return t}}if(i.scheme===Q.vscodeNotebookCellOutput){let e=k7e(i);if(e){let t=this._documents.get(e.notebook);if(t)return t}}return this._documents.get(i)}addNotebookDocument(i){this._documents.set(i.uri,i)}removeNotebookDocument(i){this._documents.delete(i.uri)}};Ce(s3,bbi,1);var _M="workbench.editor.notebook",oZ="workbench.editor.notebookTextDiffEditor",sro="workbench.editor.notebookMultiTextDiffEditor",nZ="workbench.editor.interactive",s_e="workbench.editor.repl",aro="workbench.editor.notebookOutputEditor";var Ibi=["application/json","application/javascript","text/html","image/svg+xml",cr.latex,cr.markdown,"image/png","image/jpeg",cr.text],lro=[cr.latex,cr.markdown,"application/json","text/html","image/svg+xml","image/png","image/jpeg",cr.text],cro=new Map([["ms-toolsai.jupyter",new Set(["jupyter-notebook","interactive"])],["ms-toolsai.jupyter-renderers",new Set(["jupyter-notebook","interactive"])]]),T2="_notAvailable";var E7e;(t=>{t.scheme=Q.vscodeNotebookMetadata;function i(o){return rro(o)}t.generate=i;function e(o){return nro(o)}t.parse=e})(E7e||={});var sn;(c=>{c.scheme=Q.vscodeNotebookCell;function i(u,p){return oro(u,p)}c.generate=i;function e(u){return r_e(u)}c.parse=e;function t(u,p){return u.with({scheme:Q.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"editor",outputId:p??"",notebookScheme:u.scheme!==Q.file?u.scheme:""}).toString()})}c.generateCellOutputUriWithId=t;function o(u,p,h){return u.with({scheme:Q.vscodeNotebookCellOutput,fragment:p.fragment,query:new URLSearchParams({openIn:"notebook",outputIndex:String(h)}).toString()})}c.generateCellOutputUriWithIndex=o;function n(u,p,h,g,f){return u.with({scheme:Q.vscodeNotebookCellOutput,query:new URLSearchParams({openIn:"notebookOutputEditor",notebook:u.toString(),cellIndex:String(h),outputId:g,outputIndex:String(f)}).toString()})}c.generateOutputEditorUri=n;function r(u){return k7e(u)}c.parseCellOutputUri=r;function s(u,p,h){return c.generate(u,p).with({scheme:h})}c.generateCellPropertyUri=s;function l(u,p){if(u.scheme===p)return c.parse(u.with({scheme:c.scheme}))}c.parseCellPropertyUri=l})(sn||={});var nLt=a=>ii?a.replace(/\//g,"\\"):a,sLt=class{constructor(i=[],e=Ibi){this.defaultOrder=e;this.order=[...new Set(i)].map(t=>({pattern:t,matches:Eh(nLt(t),{ignoreCase:!0})}))}sort(i){let e=new Map(yt.map(i,o=>[o,nLt(o)])),t=[];for(let{matches:o}of this.order)for(let[n,r]of e)if(o(r)){t.push(n),e.delete(n);break}return e.size&&(t=t.concat([...e.keys()].sort((o,n)=>this.defaultOrder.indexOf(o)-this.defaultOrder.indexOf(n)))),t}prioritize(i,e){let t=this.findIndex(i);if(t===-1){this.order.unshift({pattern:i,matches:Eh(nLt(i),{ignoreCase:!0})});return}let o=new Set(e.map(r=>this.findIndex(r,t)));o.delete(-1);let n=Array.from(o).sort();this.order.splice(t+1,0,...n.map(r=>this.order[r]));for(let r=n.length-1;r>=0;r--)this.order.splice(n[r],1)}toArray(){return this.order.map(i=>i.pattern)}findIndex(i,e=this.order.length){let t=nLt(i);for(let o=0;o<e;o++)if(this.order[o].matches(t))return o;return-1}};function T7e(a,i,e,t=(o,n)=>o===n){let o=[];function n(l,c,u){if(c===0&&u.length===0)return;let p=o[o.length-1];p&&p.start+p.deleteCount===l?(p.deleteCount+=c,p.toInsert.push(...u)):o.push({start:l,deleteCount:c,toInsert:u})}let r=0,s=0;for(;;){if(r===a.length){n(r,0,i.slice(s));break}if(s===i.length){n(r,a.length-r,[]);break}let l=a[r],c=i[s];if(t(l,c)){r+=1,s+=1;continue}e(c)?(n(r,1,[]),r+=1):(n(r,0,[c]),s+=1)}return o}var ape=new Y("notebookEditorCursorAtBoundary","none"),lpe=new Y("notebookEditorCursorAtLineBoundary","none");function aLt(a){let i=a;return!!((typeof i.include=="string"||GA(i.include))&&(typeof i.exclude=="string"||GA(i.exclude)))}var Ct={displayOrder:"notebook.displayOrder",cellToolbarLocation:"notebook.cellToolbarLocation",cellToolbarVisibility:"notebook.cellToolbarVisibility",showCellStatusBar:"notebook.showCellStatusBar",cellExecutionTimeVerbosity:"notebook.cellExecutionTimeVerbosity",textDiffEditorPreview:"notebook.diff.enablePreview",diffOverviewRuler:"notebook.diff.overviewRuler",experimentalInsertToolbarAlignment:"notebook.experimental.insertToolbarAlignment",compactView:"notebook.compactView",focusIndicator:"notebook.cellFocusIndicator",insertToolbarLocation:"notebook.insertToolbarLocation",globalToolbar:"notebook.globalToolbar",stickyScrollEnabled:"notebook.stickyScroll.enabled",stickyScrollMode:"notebook.stickyScroll.mode",undoRedoPerCell:"notebook.undoRedoPerCell",consolidatedOutputButton:"notebook.consolidatedOutputButton",openOutputInPreviewEditor:"notebook.output.openInPreviewEditor.enabled",showFoldingControls:"notebook.showFoldingControls",dragAndDropEnabled:"notebook.dragAndDropEnabled",cellEditorOptionsCustomizations:"notebook.editorOptionsCustomizations",consolidatedRunButton:"notebook.consolidatedRunButton",openGettingStarted:"notebook.experimental.openGettingStarted",globalToolbarShowLabel:"notebook.globalToolbarShowLabel",markupFontSize:"notebook.markup.fontSize",markdownLineHeight:"notebook.markdown.lineHeight",interactiveWindowCollapseCodeCells:"interactiveWindow.collapseCellInputCode",outputScrollingDeprecated:"notebook.experimental.outputScrolling",outputScrolling:"notebook.output.scrolling",textOutputLineLimit:"notebook.output.textLineLimit",LinkifyOutputFilePaths:"notebook.output.linkifyFilePaths",minimalErrorRendering:"notebook.output.minimalErrorRendering",formatOnSave:"notebook.formatOnSave.enabled",insertFinalNewline:"notebook.insertFinalNewline",defaultFormatter:"notebook.defaultFormatter",formatOnCellExecution:"notebook.formatOnCellExecution",codeActionsOnSave:"notebook.codeActionsOnSave",outputWordWrap:"notebook.output.wordWrap",outputLineHeightDeprecated:"notebook.outputLineHeight",outputLineHeight:"notebook.output.lineHeight",outputFontSizeDeprecated:"notebook.outputFontSize",outputFontSize:"notebook.output.fontSize",outputFontFamilyDeprecated:"notebook.outputFontFamily",outputFontFamily:"notebook.output.fontFamily",findFilters:"notebook.find.filters",logging:"notebook.logging",confirmDeleteRunningCell:"notebook.confirmDeleteRunningCell",remoteSaving:"notebook.experimental.remoteSave",gotoSymbolsAllSymbols:"notebook.gotoSymbols.showAllSymbols",outlineShowMarkdownHeadersOnly:"notebook.outline.showMarkdownHeadersOnly",outlineShowCodeCells:"notebook.outline.showCodeCells",outlineShowCodeCellSymbols:"notebook.outline.showCodeCellSymbols",breadcrumbsShowCodeCells:"notebook.breadcrumbs.showCodeCells",scrollToRevealCell:"notebook.scrolling.revealNextCellOnExecute",cellChat:"notebook.experimental.cellChat",cellGenerate:"notebook.experimental.generate",notebookVariablesView:"notebook.variablesView",notebookInlineValues:"notebook.inlineValues",InteractiveWindowPromptToSave:"interactiveWindow.promptToSaveOnClose",cellFailureDiagnostics:"notebook.cellFailureDiagnostics",outputBackupSizeLimit:"notebook.backup.sizeLimit",multiCursor:"notebook.multiCursor.enabled",markupFontFamily:"notebook.markup.fontFamily"};var E0=class a{static{this._prefix="notebook/"}static create(i,e){return`${a._prefix}${i}/${e??i}`}static parse(i){if(i.startsWith(a._prefix)){let e=i.substring(a._prefix.length).split("/");if(e.length===2)return{notebookType:e[0],viewType:e[1]}}}},g9o=new TextDecoder;function dro(a){let i=[],e=!1;for(let r of a)(i.length===0||e)&&(i.push(r),e=!0);let t=v9o(i),o=Ke.concat(i.map(r=>Ke.wrap(r))),n=w9o(o);return t=t||n.byteLength!==o.byteLength,{data:n,didCompression:t}}var rLt="\x1B[A",Sbi=rLt.split("").map(a=>a.charCodeAt(0)),f9o=10;function v9o(a){let i=!1;return a.forEach((e,t)=>{if(t===0||e.length<rLt.length)return;let o=a[t-1],n=e.subarray(0,rLt.length);if(n[0]===Sbi[0]&&n[1]===Sbi[1]&&n[2]===Sbi[2]){let r=o.lastIndexOf(f9o);if(r===-1)return;i=!0,a[t-1]=o.subarray(0,r),a[t]=e.subarray(rLt.length)}}),i}function b9o(a){let i=a;do a=i,i=a.replace(/[^\n]\x08/gm,"");while(i.length<a.length);return a}function S9o(a){for(a=a.replace(/\r+\n/gm,`
`);a.search(/\r[^$]/g)>-1;){let i=a.match(/^(.*)\r+/m)[1],e=a.match(/\r+(.*)$/m)[1];e=e+i.slice(e.length,i.length),a=a.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,e)}return a}var I9o=8,y9o=13;function w9o(a){return!a.buffer.includes(I9o)&&!a.buffer.includes(y9o)?a:Ke.fromString(S9o(b9o(g9o.decode(a.buffer))))}var rZ=class{constructor(){this._edits=[]}_allEntries(){return this._edits}renameFile(i,e,t,o){this._edits.push({_type:1,from:i,to:e,options:t,metadata:o})}createFile(i,e,t){this._edits.push({_type:1,from:void 0,to:i,options:e,metadata:t})}deleteFile(i,e,t){this._edits.push({_type:1,from:i,to:void 0,options:e,metadata:t})}replaceNotebookMetadata(i,e,t){this._edits.push({_type:3,metadata:t,uri:i,edit:{editType:5,metadata:e}})}replaceNotebookCells(i,e,t,o){let n=e.start,r=e.end;(n!==r||t.length>0)&&this._edits.push({_type:5,uri:i,index:n,count:r-n,cells:t,metadata:o})}replaceNotebookCellMetadata(i,e,t,o){this._edits.push({_type:3,metadata:o,uri:i,edit:{editType:3,index:e,metadata:t}})}replace(i,e,t,o){this._edits.push({_type:2,uri:i,edit:new cE(e,t),metadata:o})}insert(i,e,t,o){this.replace(i,new Td(e,e),t,o)}delete(i,e,t){this.replace(i,e,"",t)}has(i){return this._edits.some(e=>e._type===2&&e.uri.toString()===i.toString())}set(i,e){if(e)for(let t of e){if(!t)continue;let o,n;Array.isArray(t)?(o=t[0],n=t[1]):o=t,TM.isNotebookCellEdit(o)?o.newCellMetadata?this.replaceNotebookCellMetadata(i,o.range.start,o.newCellMetadata,n):o.newNotebookMetadata?this.replaceNotebookMetadata(i,o.newNotebookMetadata,n):this.replaceNotebookCells(i,o.range,o.newCells,n):spe.isSnippetTextEdit(o)?this._edits.push({_type:6,uri:i,range:o.range,edit:o.snippet,metadata:n,keepWhitespace:o.keepWhitespace}):this._edits.push({_type:2,uri:i,edit:o,metadata:n})}else{for(let t=0;t<this._edits.length;t++){let o=this._edits[t];switch(o._type){case 2:case 6:case 3:case 5:o.uri.toString()===i.toString()&&(this._edits[t]=void 0);break}}Wj(this._edits)}}get(i){let e=[];for(let t of this._edits)t._type===2&&t.uri.toString()===i.toString()&&e.push(t.edit);return e}entries(){let i=new dt;for(let e of this._edits)if(e._type===2){let t=i.get(e.uri);t||(t=[e.uri,[]],i.set(e.uri,t)),t[1].push(e.edit)}return[...i.values()]}get size(){return this.entries().length}toJSON(){return this.entries()}};rZ=I([Dr],rZ);var ppe,sZ=class{constructor(i){Aye(this,ppe);z5e(this,ppe,i)}static from(...i){let e=i;return new sZ(function(){if(e){for(let t of e)t&&typeof t.dispose=="function"&&t.dispose();e=void 0}})}dispose(){typeof cv(this,ppe)=="function"&&(cv(this,ppe).call(this),z5e(this,ppe,void 0))}};ppe=new WeakMap,sZ=I([Dr],sZ);var D7e=class{constructor(i,e){if(!i)throw new Error("Illegal argument, contents must be defined");Array.isArray(i)?this.contents=i:this.contents=[i],this.range=e}};D7e=I([Dr],D7e);var a_e=class extends D7e{constructor(i,e,t,o){super(i,e),this.canIncreaseVerbosity=t,this.canDecreaseVerbosity=o}};a_e=I([Dr],a_e);var mro=(t=>(t[t.Text=0]="Text",t[t.Read=1]="Read",t[t.Write=2]="Write",t))(mro||{}),l_e=class{constructor(i,e=0){this.range=i,this.kind=e}toJSON(){return{range:this.range,kind:mro[this.kind]}}};l_e=I([Dr],l_e);var c_e=class{constructor(i,e){this.uri=i,this.highlights=e}toJSON(){return{uri:this.uri,highlights:this.highlights.map(i=>i.toJSON())}}};c_e=I([Dr],c_e);var l3=class{static validate(i){if(!i.name)throw new Error("name must not be falsy");if(!i.range.contains(i.selectionRange))throw new Error("selectionRange must be contained in fullRange");i.children?.forEach(l3.validate)}constructor(i,e,t,o,n){this.name=i,this.detail=e,this.kind=t,this.range=o,this.selectionRange=n,this.children=[],l3.validate(this)}};l3=I([Dr],l3);var lLt=class{constructor(i,e){this.title=i,this.kind=e}};lLt=I([Dr],lLt);var d_e=class{constructor(i,e){if(this.range=i,this.parent=e,e&&!e.range.contains(this.range))throw new Error("Invalid argument: parent must contain this range")}};d_e=I([Dr],d_e);var RLt=class{constructor(i,e,t,o,n,r){this.kind=i,this.name=e,this.detail=t,this.uri=o,this.range=n,this.selectionRange=r}},LLt=class{constructor(i,e){this.fromRanges=e,this.from=i}},MLt=class{constructor(i,e){this.fromRanges=e,this.to=i}};var cLt=class{constructor(i,e){this.range=i,this.command=e}get isResolved(){return!!this.command}};cLt=I([Dr],cLt);var dLt=class{constructor(i,e){this.label=i,this.documentation=e}};dLt=I([Dr],dLt);var uLt=class{constructor(i,e){this.label=i,this.documentation=e,this.parameters=[]}};uLt=I([Dr],uLt);var pLt=class{constructor(){this.activeSignature=0;this.activeParameter=0;this.signatures=[]}};pLt=I([Dr],pLt);var u_e=class{constructor(i){this.value=i}};u_e=I([Dr],u_e);var p_e=class{constructor(i,e,t){this.position=i,this.label=e,this.kind=t}};p_e=I([Dr],p_e);var wbi=(j=>(j[j.Text=0]="Text",j[j.Method=1]="Method",j[j.Function=2]="Function",j[j.Constructor=3]="Constructor",j[j.Field=4]="Field",j[j.Variable=5]="Variable",j[j.Class=6]="Class",j[j.Interface=7]="Interface",j[j.Module=8]="Module",j[j.Property=9]="Property",j[j.Unit=10]="Unit",j[j.Value=11]="Value",j[j.Enum=12]="Enum",j[j.Keyword=13]="Keyword",j[j.Snippet=14]="Snippet",j[j.Color=15]="Color",j[j.File=16]="File",j[j.Reference=17]="Reference",j[j.Folder=18]="Folder",j[j.EnumMember=19]="EnumMember",j[j.Constant=20]="Constant",j[j.Struct=21]="Struct",j[j.Event=22]="Event",j[j.Operator=23]="Operator",j[j.TypeParameter=24]="TypeParameter",j[j.User=25]="User",j[j.Issue=26]="Issue",j))(wbi||{});var m_e=class{constructor(i,e){this.label=i,this.kind=e}toJSON(){return{label:this.label,kind:this.kind&&wbi[this.kind],detail:this.detail,documentation:this.documentation,sortText:this.sortText,filterText:this.filterText,preselect:this.preselect,insertText:this.insertText,textEdit:this.textEdit}}};m_e=I([Dr],m_e);var mLt=class{constructor(i=[],e=!1){this.items=i,this.isIncomplete=e}};mLt=I([Dr],mLt);var hLt=class{constructor(i,e,t){this.insertText=i,this.range=e,this.command=t}};hLt=I([Dr],hLt);var gLt=class{constructor(i){this.commands=void 0;this.suppressSuggestions=void 0;this.items=i}};gLt=I([Dr],gLt);function hro(a,i){return`${hi.toKey(a)}.${i}`}var Cbi=(t=>(t[t.Keyboard=1]="Keyboard",t[t.Mouse=2]="Mouse",t[t.Command=3]="Command",t))(Cbi||{});(i=>{function a(e){switch(e){case"keyboard":return 1;case"mouse":return 2;case"api":case"code.jump":case"code.navigation":return 3}}i.fromValue=a})(Cbi||={});var xbi=(o=>(o[o.Other=0]="Other",o[o.Comment=1]="Comment",o[o.String=2]="String",o[o.RegEx=3]="RegEx",o))(xbi||{});(i=>{function a(e){switch(e){case 0:return"other";case 1:return"comment";case 2:return"string";case 3:return"regex"}return"other"}i.toString=a})(xbi||={});var h_e=class{constructor(i,e){if(e&&!A.isUri(e))throw ls("target");if(!Td.isRange(i)||i.isEmpty)throw ls("range");this.range=i,this.target=e}};h_e=I([Dr],h_e);var cpe=class{constructor(i,e,t,o){this.red=i,this.green=e,this.blue=t,this.alpha=o}};cpe=I([Dr],cpe);var fLt=class{constructor(i,e){if(e&&!(e instanceof cpe))throw ls("color");if(!Td.isRange(i)||i.isEmpty)throw ls("range");this.range=i,this.color=e}};fLt=I([Dr],fLt);var g_e=class{constructor(i){if(!i||typeof i!="string")throw ls("label");this.label=i}};g_e=I([Dr],g_e);var dE=class{constructor(i,e){this.label=e;if(typeof i!="string")throw ls("name");if(typeof e!="string")throw ls("name");this._id=i}static from(i){switch(i){case"clean":return dE.Clean;case"build":return dE.Build;case"rebuild":return dE.Rebuild;case"test":return dE.Test;default:return}}get id(){return this._id}};dE.Clean=new dE("clean","Clean"),dE.Build=new dE("build","Build"),dE.Rebuild=new dE("rebuild","Rebuild"),dE.Test=new dE("test","Test"),dE=I([Dr],dE);function gro(a){let i="";for(let e=0;e<a.length;e++)i+=a[e].replace(/,/g,",,")+",";return i}var R7e=class{constructor(i,e,t){if(typeof i!="string")throw ls("process");this._args=[],this._process=i,e!==void 0&&(Array.isArray(e)?(this._args=e,this._options=t):this._options=e)}get process(){return this._process}set process(i){if(typeof i!="string")throw ls("process");this._process=i}get args(){return this._args}set args(i){Array.isArray(i)||(i=[]),this._args=i}get options(){return this._options}set options(i){this._options=i}computeId(){let i=[];if(i.push("process"),this._process!==void 0&&i.push(this._process),this._args&&this._args.length>0)for(let e of this._args)i.push(e);return gro(i)}};R7e=I([Dr],R7e);var L7e=class{constructor(i,e,t){this._args=[];if(Array.isArray(e)){if(!i)throw ls("command can't be undefined or null");if(typeof i!="string"&&typeof i.value!="string")throw ls("command");this._command=i,e&&(this._args=e),this._options=t}else{if(typeof i!="string")throw ls("commandLine");this._commandLine=i,this._options=e}}get commandLine(){return this._commandLine}set commandLine(i){if(typeof i!="string")throw ls("commandLine");this._commandLine=i}get command(){return this._command?this._command:""}set command(i){if(typeof i!="string"&&typeof i.value!="string")throw ls("command");this._command=i}get args(){return this._args}set args(i){this._args=i||[]}get options(){return this._options}set options(i){this._options=i}computeId(){let i=[];if(i.push("shell"),this._commandLine!==void 0&&i.push(this._commandLine),this._command!==void 0&&i.push(typeof this._command=="string"?this._command:this._command.value),this._args&&this._args.length>0)for(let e of this._args)i.push(typeof e=="string"?e:e.value);return gro(i)}};L7e=I([Dr],L7e);var ybi=class{constructor(i){this._callback=i}computeId(){return"customExecution"+ht()}set callback(i){this._callback=i}get callback(){return this._callback}},uE=class{constructor(i,e,t,o,n,r){this.__deprecated=!1;this._definition=this.definition=i;let s;typeof e=="string"?(this._name=this.name=e,this._source=this.source=t,this.execution=o,s=n,this.__deprecated=!0):e===1||e===2?(this.target=e,this._name=this.name=t,this._source=this.source=o,this.execution=n,s=r):(this.target=e,this._name=this.name=t,this._source=this.source=o,this.execution=n,s=r),typeof s=="string"?(this._problemMatchers=[s],this._hasDefinedMatchers=!0):Array.isArray(s)?(this._problemMatchers=s,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(i){this.__id=i}get _deprecated(){return this.__deprecated}clear(){this.__id!==void 0&&(this.__id=void 0,this._scope=void 0,this.computeDefinitionBasedOnExecution())}computeDefinitionBasedOnExecution(){this._execution instanceof R7e?this._definition={type:uE.ProcessType,id:this._execution.computeId()}:this._execution instanceof L7e?this._definition={type:uE.ShellType,id:this._execution.computeId()}:this._execution instanceof ybi?this._definition={type:uE.ExtensionCallbackType,id:this._execution.computeId()}:this._definition={type:uE.EmptyType,id:ht()}}get definition(){return this._definition}set definition(i){if(i==null)throw ls("Kind can't be undefined or null");this.clear(),this._definition=i}get scope(){return this._scope}set target(i){this.clear(),this._scope=i}get name(){return this._name}set name(i){if(typeof i!="string")throw ls("name");this.clear(),this._name=i}get execution(){return this._execution}set execution(i){i===null&&(i=void 0),this.clear(),this._execution=i;let e=this._definition.type;(uE.EmptyType===e||uE.ProcessType===e||uE.ShellType===e||uE.ExtensionCallbackType===e)&&this.computeDefinitionBasedOnExecution()}get problemMatchers(){return this._problemMatchers}set problemMatchers(i){if(Array.isArray(i))this.clear(),this._problemMatchers=i,this._hasDefinedMatchers=!0;else{this.clear(),this._problemMatchers=[],this._hasDefinedMatchers=!1;return}}get hasDefinedMatchers(){return this._hasDefinedMatchers}get isBackground(){return this._isBackground}set isBackground(i){i!==!0&&i!==!1&&(i=!1),this.clear(),this._isBackground=i}get source(){return this._source}set source(i){if(typeof i!="string"||i.length===0)throw ls("source must be a string of length > 0");this.clear(),this._source=i}get group(){return this._group}set group(i){i===null&&(i=void 0),this.clear(),this._group=i}get detail(){return this._detail}set detail(i){i===null&&(i=void 0),this._detail=i}get presentationOptions(){return this._presentationOptions}set presentationOptions(i){i==null&&(i=Object.create(null)),this.clear(),this._presentationOptions=i}get runOptions(){return this._runOptions}set runOptions(i){i==null&&(i=Object.create(null)),this.clear(),this._runOptions=i}};uE.ExtensionCallbackType="customExecution",uE.ProcessType="process",uE.ShellType="shell",uE.EmptyType="$empty",uE=I([Dr],uE);var _9o;(i=>{function a(e){let t=e;return on(t.value)?t.tooltip&&!We(t.tooltip)?(console.log("INVALID view badge, invalid tooltip",t.tooltip),!1):!0:(console.log("INVALID view badge, invalid value",t.value),!1)}i.isViewBadge=a})(_9o||={});var f_e=class{constructor(i,e=0){this.collapsibleState=e;A.isUri(i)?this.resourceUri=i:this.label=i}static isTreeItem(i,e){let t=i;if(t.checkboxState!==void 0){let o=on(t.checkboxState)?t.checkboxState:Di(t.checkboxState)&&on(t.checkboxState.state)?t.checkboxState.state:void 0,n=!on(t.checkboxState)&&Di(t.checkboxState)?t.checkboxState.tooltip:void 0;if(o===void 0||o!==1&&o!==0||n!==void 0&&!We(n))return console.log("INVALID tree item, invalid checkboxState",t.checkboxState),!1}if(i instanceof f_e)return!0;if(t.label!==void 0&&!We(t.label)&&!t.label?.label)return console.log("INVALID tree item, invalid label",t.label),!1;if(t.id!==void 0&&!We(t.id))return console.log("INVALID tree item, invalid id",t.id),!1;if(t.iconPath!==void 0&&!We(t.iconPath)&&!A.isUri(t.iconPath)&&(!t.iconPath||!We(t.iconPath.id))){let o=t.iconPath;if(!o||!We(o.light)&&!A.isUri(o.light)&&!We(o.dark)&&!A.isUri(o.dark))return console.log("INVALID tree item, invalid iconPath",t.iconPath),!1}return t.description!==void 0&&!We(t.description)&&typeof t.description!="boolean"?(console.log("INVALID tree item, invalid description",t.description),!1):t.resourceUri!==void 0&&!A.isUri(t.resourceUri)?(console.log("INVALID tree item, invalid resourceUri",t.resourceUri),!1):t.tooltip!==void 0&&!We(t.tooltip)&&!(t.tooltip instanceof lE)?(console.log("INVALID tree item, invalid tooltip",t.tooltip),!1):t.command!==void 0&&!t.command.command?(console.log("INVALID tree item, invalid command",t.command),!1):t.collapsibleState!==void 0&&t.collapsibleState<0&&t.collapsibleState>2?(console.log("INVALID tree item, invalid collapsibleState",t.collapsibleState),!1):t.contextValue!==void 0&&!We(t.contextValue)?(console.log("INVALID tree item, invalid contextValue",t.contextValue),!1):t.accessibilityInformation!==void 0&&!t.accessibilityInformation?.label?(console.log("INVALID tree item, invalid accessibilityInformation",t.accessibilityInformation),!1):!0}};f_e=I([Dr],f_e);var M7e=class{constructor(i){this.value=i}async asString(){return typeof this.value=="string"?this.value:JSON.stringify(this.value)}asFile(){}};M7e=I([Dr],M7e);var C_e=class extends M7e{},PLt=class extends C_e{$b;constructor(i){super(""),this.$b=i}asFile(){return this.$b}},ALt=class{constructor(i,e,t,o){this.name=i,this.uri=e,this._itemId=t,this._getData=o}data(){return this._getData()}},a3,mpe,P7e,v_e=class{constructor(i){Aye(this,mpe);Aye(this,a3,new Map);for(let[e,t]of i??[]){let o=cv(this,a3).get(K5e(this,mpe,P7e).call(this,e));o?o.push(t):cv(this,a3).set(K5e(this,mpe,P7e).call(this,e),[t])}}get(i){return cv(this,a3).get(K5e(this,mpe,P7e).call(this,i))?.[0]}set(i,e){cv(this,a3).set(K5e(this,mpe,P7e).call(this,i),[e])}forEach(i,e){for(let[t,o]of cv(this,a3))for(let n of o)i.call(e,n,t,this)}*[Symbol.iterator](){for(let[i,e]of cv(this,a3))for(let t of e)yield[i,t]}};a3=new WeakMap,mpe=new WeakSet,P7e=function(i){return i.toLowerCase()},v_e=I([Dr],v_e);var vLt=class{constructor(i,e,t){this.insertText=i,this.title=e,this.kind=t}};vLt=I([Dr],vLt);var cZ=class a{constructor(i){this.value=i}static{this.sep="."}append(...i){return new a((this.value?[this.value,...i]:i).join(a.sep))}intersects(i){return this.contains(i)||i.contains(this)}contains(i){return this.value===i.value||i.value.startsWith(this.value+a.sep)}};cZ.Empty=new cZ("");cZ.Text=new cZ("text");cZ.TextUpdateImports=cZ.Text.append("updateImports");var c3=class{constructor(i,e){this.id=i,this.color=e}static isThemeIcon(i){return typeof i.id!="string"?(console.log("INVALID ThemeIcon, invalid id",i.id),!1):!0}};c3=I([Dr],c3);c3.File=new c3("file");c3.Folder=new c3("folder");var bLt=class{constructor(i){this.id=i}};bLt=I([Dr],bLt);var aZ=class{get base(){return this._base}set base(i){this._base=i,this._baseUri=A.file(i)}get baseUri(){return this._baseUri}set baseUri(i){this._baseUri=i,this._base=i.fsPath}constructor(i,e){if(typeof i!="string"&&(!i||!A.isUri(i)&&!A.isUri(i.uri)))throw ls("base");if(typeof e!="string")throw ls("pattern");typeof i=="string"?this.baseUri=A.file(i):A.isUri(i)?this.baseUri=i:this.baseUri=i.uri,this.pattern=e}toJSON(){return{pattern:this.pattern,base:this.base,baseUri:this.baseUri.toJSON()}}};aZ=I([Dr],aZ);var D9o=new WeakMap;var dpe=class{constructor(i,e,t,o,n){this.enabled=typeof i=="boolean"?i:!0,typeof e=="string"&&(this.condition=e),typeof t=="string"&&(this.hitCondition=t),typeof o=="string"&&(this.logMessage=o),typeof n=="string"&&(this.mode=n)}get id(){return this._id||(this._id=D9o.get(this)??ht()),this._id}};dpe=I([Dr],dpe);var SLt=class extends dpe{constructor(i,e,t,o,n,r){if(super(e,t,o,n,r),i===null)throw ls("location");this.location=i}};SLt=I([Dr],SLt);var ILt=class extends dpe{constructor(i,e,t,o,n,r){super(e,t,o,n,r),this.functionName=i}};ILt=I([Dr],ILt);var yLt=class extends dpe{constructor(i,e,t,o,n,r,s,l){if(super(o,n,r,s,l),!e)throw ls("dataId");this.label=i,this.dataId=e,this.canPersist=t}};yLt=I([Dr],yLt);var wLt=class{constructor(i,e,t){this.command=i,this.args=e||[],this.options=t}};wLt=I([Dr],wLt);var CLt=class{constructor(i,e){this.port=i,this.host=e}};CLt=I([Dr],CLt);var xLt=class{constructor(i){this.path=i}};xLt=I([Dr],xLt);var kLt=class{constructor(i){this.implementation=i}};kLt=I([Dr],kLt);var b_e=class{constructor(i,e){this.range=i,this.expression=e}};b_e=I([Dr],b_e);var S_e=class{constructor(i,e){this.range=i,this.text=e}};S_e=I([Dr],S_e);var I_e=class{constructor(i,e,t=!0){this.range=i,this.variableName=e,this.caseSensitiveLookup=t}};I_e=I([Dr],I_e);var y_e=class{constructor(i,e){this.range=i,this.expression=e}};y_e=I([Dr],y_e);var w_e=class{constructor(i,e){this.frameId=i,this.stoppedLocation=e}};w_e=I([Dr],w_e);var _x=class extends Error{static FileExists(i){return new _x(i,"EntryExists",_x.FileExists)}static FileNotFound(i){return new _x(i,"EntryNotFound",_x.FileNotFound)}static FileNotADirectory(i){return new _x(i,"EntryNotADirectory",_x.FileNotADirectory)}static FileIsADirectory(i){return new _x(i,"EntryIsADirectory",_x.FileIsADirectory)}static NoPermissions(i){return new _x(i,"NoPermissions",_x.NoPermissions)}static Unavailable(i){return new _x(i,"Unavailable",_x.Unavailable)}constructor(i,e="Unknown",t){super(A.isUri(i)?i.toString(!0):i),this.code=t?.name??"Unknown",Osi(this,e),Object.setPrototypeOf(this,_x.prototype),typeof Error.captureStackTrace=="function"&&typeof t=="function"&&Error.captureStackTrace(this,t)}};_x=I([Dr],_x);var ELt=class{constructor(i,e,t){this.start=i,this.end=e,this.kind=t}};ELt=I([Dr],ELt);var _7e=class{constructor(){}};_7e.Back={iconPath:new c3("arrow-left")},_7e=I([Dr],_7e);var TLt=class{constructor(i){this.kind=i}};TLt=I([Dr],TLt);var NLt=class{constructor(i,e=[]){this.uri=i;this.provides=Ec(e)}};var _Lt=class{constructor(i,e){this.label=i;this.timestamp=e}};_Lt=I([Dr],_Lt);var DLt=class{constructor(i=void 0,e=void 0,t=void 0,o=!1,n=!0){this.include=i;this.exclude=e;this.profile=t;this.continuous=o;this.preserveFocus=n}};DLt=I([Dr],DLt);var lZ=class{constructor(i){this.message=i}static diff(i,e,t){let o=new lZ(i);return o.expectedOutput=e,o.actualOutput=t,o}};lZ=I([Dr],lZ);var upe=class{constructor(i){this.id=i}};upe=I([Dr],upe);var A7e=class{constructor(i,e){this.covered=i;this.total=e;Z7e(this)}};function Z7e(a){if(a){if(a.covered>a.total)throw new Error(`The total number of covered items (${a.covered}) cannot be greater than the total (${a.total})`);if(a.total<0)throw new Error(`The number of covered items (${a.total}) cannot be negative`)}}var OLt=class a{constructor(i,e,t,o,n=[]){this.uri=i;this.statementCoverage=e;this.branchCoverage=t;this.declarationCoverage=o;this.includesTests=n}static fromDetails(i,e){let t=new A7e(0,0),o=new A7e(0,0),n=new A7e(0,0);for(let s of e)if("branches"in s){t.total+=1,t.covered+=s.executed?1:0;for(let l of s.branches)o.total+=1,o.covered+=l.executed?1:0}else n.total+=1,n.covered+=s.executed?1:0;let r=new a(i,t,o.total>0?o:void 0,n.total>0?n:void 0);return r.detailedCoverage=e,r}},FLt=class{constructor(i,e,t=[]){this.executed=i;this.location=e;this.branches=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}},WLt=class{constructor(i,e,t){this.executed=i;this.location=e;this.label=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}},VLt=class{constructor(i,e,t){this.name=i;this.executed=e;this.location=t}get executionCount(){return+this.executed}set executionCount(i){this.executed=i}};var BLt=class{constructor(i,e,t,o,n,r){this.kind=i,this.name=e,this.detail=t,this.uri=o,this.range=n,this.selectionRange=r}};var N7e=class{constructor(i){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new lE(i):i}},O7e=class{constructor(i,e){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new lE(i):i,this.vulnerabilities=e}},HLt=class{constructor(i,e,t,o){this.title=i,this.message=e,this.data=t,this.buttons=o}},F7e=class{constructor(i,e){this.value=i,this.baseUri=e}},W7e=class{constructor(i,e,t){this.value=i,this.title=e,this.readOnly=t}};var ULt=class{constructor(i,e,t,o){this.description=i,this.agentName=e,this.prompt=t,this.result=o}};var V7e=class{constructor(i,e){this.value=i,this.value2=i,this.title=e}},B7e=class{constructor(i){this.value=i}};var H7e=class{constructor(i,e,t){this.value=i,this.id=e,this.metadata=t}},U7e=class{constructor(i,e,t,o){this.hookType=i,this.stopReason=e,this.systemMessage=t,this.metadata=o}},z7e=class{constructor(i){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new lE(i):i}},K7e=class{constructor(i){if(typeof i!="string"&&i.isTrusted===!0)throw new Error("The boolean form of MarkdownString.isTrusted is NOT supported for chat participants.");this.value=typeof i=="string"?new lE(i):i}},G7e=class{constructor(i){this.value=i}},q7e=class{constructor(i,e,t){this.value=i,this.iconPath=e,this.options=t}},$7e=class{constructor(i,e,t){this.value=i,this.isEdit=e,this.undoStopId=t}},zLt=class{constructor(i,e,t){this.value=i,this.license=e,this.snippet=t}},j7e=class{constructor(i,e){this.uri=i;this.range=e}},KLt=class{constructor(i){this.extensions=i}},GLt=class{constructor(i,e,t,o,n){this.title=e;this.description=t;this.author=o;this.linkTag=n;jm(i)?(this.uri=i,this.command={title:"Open Pull Request",command:"vscode.open",arguments:[i]}):this.command=i}toJSON(){return{$mid:26,uri:this.uri,title:this.title,description:this.description,author:this.author}}};var qLt=class{constructor(i,e,t,o){this.id=i,this.type=e,this.title=t,this.message=o?.message,this.options=o?.options,this.defaultValue=o?.defaultValue,this.allowFreeformInput=o?.allowFreeformInput}},Q7e=class{constructor(i,e=!0){this.questions=i,this.allowSkip=e}},Y7e=class{constructor(i,e){this.uri=i,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},$Lt=class{constructor(i,e){this.uri=i,e===!0?(this.isDone=!0,this.edits=[]):this.edits=Array.isArray(e)?e:[e]}},jLt=class{constructor(i){this.edits=i}};var X7e=class{constructor(i,e,t){this.toolName=i,this.toolCallId=e,this.errorMessage=t}};var pro=class a{constructor(i){this.id=i}static{this.Agent=new a("agent")}static{this.Skill=new a("skill")}static{this.Instructions=new a("instructions")}static{this.Prompt=new a("prompt")}static{this.Hook=new a("hook")}static{this.Plugins=new a("plugins")}};var QLt=class{constructor(i,e,t){this.mimeType=i,this.data=e,this.reference=t}},YLt=class{constructor(i){this.diagnostics=i}};var hpe=class{constructor(i,e,t){this.callId=i,this.content=e,this.isError=t??!1}};var XLt=class a{constructor(i,e,t){this._content=[];this.role=i,this.content=e,this.name=t}static User(i,e){return new a(1,i,e)}static Assistant(i,e){return new a(2,i,e)}set content(i){typeof i=="string"?this._content=[new KI(i)]:this._content=i}get content(){return this._content}},JLt=class a{constructor(i,e,t){this._content=[];this.role=i,this.content=e,this.name=t}static User(i,e){return new a(1,i,e)}static Assistant(i,e){return new a(2,i,e)}set content(i){typeof i=="string"?this._content=[new KI(i)]:this._content=i}get content(){return this._content}set content2(i){i&&(this.content=i.map(e=>typeof e=="string"?new KI(e):e))}get content2(){return this.content.map(i=>i instanceof KI?i.value:i)}},gpe=class{constructor(i,e,t){this.callId=i,this.name=e,this.input=t}};var KI=class{constructor(i,e){this.value=i,e=e}toJSON(){return{$mid:21,value:this.value,audience:this.audience}}},JT=class a{constructor(i,e,t){this.mimeType=e,this.data=i,this.audience=t}static image(i,e){return new a(i,e)}static json(i,e="text/x-json"){let t=JSON.stringify(i,void 0,"	");return new a(Ke.fromString(t).buffer,e)}static text(i,e=cr.text){return new a(Ke.fromString(i).buffer,e)}toJSON(){return{$mid:24,mimeType:this.mimeType,data:gc(Ke.wrap(this.data)),audience:this.audience}}};var x_e=class{constructor(i,e,t){this.value=i,this.id=e,this.metadata=t}toJSON(){return{$mid:22,value:this.value,id:this.id,metadata:this.metadata}}},_2=class{constructor(i){this.value=i}toJSON(){return{$mid:23,value:this.value}}};var ZLt=class a extends Error{static $c="LanguageModelError";static NotFound(i){return new a(i,a.NotFound.name)}static NoPermissions(i){return new a(i,a.NoPermissions.name)}static Blocked(i){return new a(i,a.Blocked.name)}static tryDeserialize(i){if(i.name===a.$c)return new a(i.message,i.code,i.cause)}constructor(i,e,t){super(i,{cause:t}),this.name=a.$c,this.code=e??""}},J7e=class{constructor(i){this.content=i}toJSON(){return{$mid:20,content:this.content}}};var eMt=class{constructor(i,e){this.id=i;this.label=e}},tMt=class{constructor(i,e,t){this.label=i;this.name=e;this.instructions=t}};var iMt=class{constructor(i,e,t,o={},n,r){this.label=i;this.command=e;this.args=t;this.env=o;this.version=n;this.metadata=r}},oMt=class{constructor(i,e,t={},o,n,r){this.label=i;this.uri=e;this.headers=t;this.version=o;this.metadata=n;this.authentication=r}};function _0(a){switch(a.type){case"light":return Ue.fromHex("#F3F3F3");case"hcLight":return Ue.fromHex("#FFFFFF");case"hcDark":return Ue.fromHex("#000000");default:return Ue.fromHex("#252526")}}var cMt=te("tab.activeBackground",Bo,d(5679,null)),Sro=te("tab.unfocusedActiveBackground",cMt,d(5699,null)),kbi=te("tab.inactiveBackground",{dark:"#2D2D2D",light:"#ECECEC",hcDark:null,hcLight:null},d(5691,null)),Iro=te("tab.unfocusedInactiveBackground",kbi,d(5704,null)),IH=te("tab.activeForeground",{dark:Ue.white,light:"#333333",hcDark:Ue.white,hcLight:"#292929"},d(5682,null)),vro=te("tab.inactiveForeground",{dark:ni(IH,.5),light:ni(IH,.7),hcDark:Ue.white,hcLight:"#292929"},d(5692,null)),yro=te("tab.unfocusedActiveForeground",{dark:ni(IH,.5),light:ni(IH,.7),hcDark:Ue.white,hcLight:"#292929"},d(5700,null)),Xga=te("tab.unfocusedInactiveForeground",{dark:ni(vro,.5),light:ni(vro,.5),hcDark:Ue.white,hcLight:"#292929"},d(5705,null)),rMt=te("tab.hoverBackground",null,d(5688,null)),wro=te("tab.unfocusedHoverBackground",{dark:ni(rMt,.5),light:ni(rMt,.7),hcDark:null,hcLight:null},d(5701,null)),sMt=te("tab.hoverForeground",null,d(5690,null)),Cro=te("tab.unfocusedHoverForeground",{dark:ni(sMt,.5),light:ni(sMt,.5),hcDark:null,hcLight:null},d(5703,null)),tYe=te("tab.border",{dark:"#252526",light:"#F3F3F3",hcDark:Ei,hcLight:Ei},d(5686,null)),xro=te("tab.lastPinnedBorder",{dark:VCe,light:VCe,hcDark:Ei,hcLight:Ei},d(5594,null)),k_e=te("tab.activeBorder",null,d(5680,null)),kro=te("tab.unfocusedActiveBorder",{dark:ni(k_e,.5),light:ni(k_e,.7),hcDark:null,hcLight:null},d(5684,null)),eYe=te("tab.activeBorderTop",{dark:null,light:null,hcDark:null,hcLight:"#B5200D"},d(5681,null)),Ero=te("tab.unfocusedActiveBorderTop",{dark:ni(eYe,.5),light:ni(eYe,.7),hcDark:null,hcLight:"#B5200D"},d(5685,null)),Tro=te("tab.selectedBorderTop",eYe,d(5697,null)),Jga=te("tab.selectedBackground",cMt,d(5696,null)),Zga=te("tab.selectedForeground",IH,d(5698,null)),aMt=te("tab.hoverBorder",null,d(5689,null)),_ro=te("tab.unfocusedHoverBorder",{dark:ni(aMt,.5),light:ni(aMt,.7),hcDark:null,hcLight:Ei},d(5702,null)),efa=te("tab.dragAndDropBorder",{dark:IH,light:IH,hcDark:la,hcLight:la},d(5687,null)),E_e=te("tab.activeModifiedBorder",{dark:"#3399CC",light:"#33AAEE",hcDark:null,hcLight:Ei},d(5683,null)),lMt=te("tab.inactiveModifiedBorder",{dark:ni(E_e,.5),light:ni(E_e,.5),hcDark:Ue.white,hcLight:Ei},d(5693,null)),Dro=te("tab.unfocusedActiveModifiedBorder",{dark:ni(E_e,.5),light:ni(E_e,.7),hcDark:Ue.white,hcLight:Ei},d(5711,null)),Rro=te("tab.unfocusedInactiveModifiedBorder",{dark:ni(lMt,.5),light:ni(lMt,.5),hcDark:Ue.white,hcLight:Ei},d(5712,null)),iYe=te("editorPane.background",Bo,d(5590,null)),Lro=te("editorGroup.emptyBackground",null,d(5587,null)),tfa=te("editorGroup.focusedEmptyBorder",{dark:null,light:null,hcDark:Kc,hcLight:Kc},d(5588,null)),dMt=te("editorGroupHeader.tabsBackground",{dark:"#252526",light:"#F3F3F3",hcDark:null,hcLight:null},d(5694,null)),Mro=te("editorGroupHeader.tabsBorder",null,d(5695,null)),Pro=te("editorGroupHeader.noTabsBackground",Bo,d(5589,null)),Aro=te("editorGroupHeader.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(5591,null)),uMt=te("editorGroup.border",{dark:"#444444",light:"#E7E7E7",hcDark:Ei,hcLight:Ei},d(5586,null)),ZT=te("editorGroup.dropBackground",{dark:Ue.fromHex("#53595D").transparent(.5),light:Ue.fromHex("#2677CB").transparent(.18),hcDark:null,hcLight:Ue.fromHex("#0F4A85").transparent(.5)},d(5582,null)),Nro=te("editorGroup.dropIntoPromptForeground",vT,d(5585,null)),Oro=te("editorGroup.dropIntoPromptBackground",qu,d(5583,null)),Fro=te("editorGroup.dropIntoPromptBorder",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(5584,null)),Wro=te("sideBySideEditor.horizontalBorder",uMt,d(5645,null)),Vro=te("sideBySideEditor.verticalBorder",uMt,d(5646,null)),R9o=te("outputView.background",null,d(5609,null));te("outputViewStickyScroll.background",R9o,d(5610,null));var ifa=te("banner.background",{dark:Kw,light:Eu(Kw,.3),hcDark:Kw,hcLight:Kw},d(5570,null)),ofa=te("banner.foreground",ID,d(5571,null)),nfa=te("banner.iconForeground",eh,d(5572,null)),DM=te("statusBar.foreground",{dark:"#FFFFFF",light:"#FFFFFF",hcDark:"#FFFFFF",hcLight:Vd},d(5654,null)),Bro=te("statusBar.noFolderForeground",DM,d(5666,null)),pMt=te("statusBar.background",{dark:"#007ACC",light:"#007ACC",hcDark:null,hcLight:null},d(5647,null)),mMt=te("statusBar.noFolderBackground",{dark:"#68217A",light:"#68217A",hcDark:null,hcLight:null},d(5664,null)),fpe=te("statusBar.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(5648,null)),Hro=te("statusBar.focusBorder",{dark:DM,light:DM,hcDark:null,hcLight:DM},d(5653,null)),Uro=te("statusBar.noFolderBorder",fpe,d(5665,null)),rfa=te("statusBarItem.activeBackground",{dark:Ue.white.transparent(.18),light:Ue.white.transparent(.18),hcDark:Ue.white.transparent(.18),hcLight:Ue.black.transparent(.18)},d(5655,null)),zro=te("statusBarItem.focusBorder",{dark:DM,light:DM,hcDark:null,hcLight:la},d(5657,null)),SH=te("statusBarItem.hoverBackground",{dark:Ue.white.transparent(.12),light:Ue.black.transparent(.12),hcDark:Ue.black,hcLight:Ue.white},d(5658,null)),oYe=te("statusBarItem.hoverForeground",DM,d(5659,null)),Kro=te("statusBarItem.compactHoverBackground",{dark:Ue.white.transparent(.12),light:Ue.black.transparent(.12),hcDark:Ue.black,hcLight:Ue.white},d(5656,null)),sfa=te("statusBarItem.prominentForeground",DM,d(5670,null)),afa=te("statusBarItem.prominentBackground",Ue.black.transparent(.5),d(5669,null)),lfa=te("statusBarItem.prominentHoverForeground",oYe,d(5672,null)),cfa=te("statusBarItem.prominentHoverBackground",SH,d(5671,null)),Ebi=te("statusBarItem.errorBackground",{dark:Eu(Hce,.4),light:Eu(Hce,.4),hcDark:null,hcLight:"#B5200D"},d(5649,null)),dfa=te("statusBarItem.errorForeground",Ue.white,d(5650,null)),ufa=te("statusBarItem.errorHoverForeground",oYe,d(5652,null)),pfa=te("statusBarItem.errorHoverBackground",SH,d(5651,null)),Gro=te("statusBarItem.warningBackground",{dark:Eu(Tg,.4),light:Eu(Tg,.4),hcDark:null,hcLight:"#895503"},d(5675,null)),mfa=te("statusBarItem.warningForeground",Ue.white,d(5676,null)),hfa=te("statusBarItem.warningHoverForeground",oYe,d(5678,null)),gfa=te("statusBarItem.warningHoverBackground",SH,d(5677,null)),hMt=te("activityBar.background",{dark:"#333333",light:"#2C2C2C",hcDark:"#000000",hcLight:"#FFFFFF"},d(5557,null)),D2=te("activityBar.foreground",{dark:Ue.white,light:Ue.white,hcDark:Ue.white,hcLight:Vd},d(5562,null)),qro=te("activityBar.inactiveForeground",{dark:ni(D2,.4),light:ni(D2,.4),hcDark:Ue.white,hcLight:Vd},d(5563,null)),gMt=te("activityBar.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(5560,null)),Tbi=te("activityBar.activeBorder",{dark:D2,light:D2,hcDark:Ei,hcLight:Ei},d(5555,null)),$ro=te("activityBar.activeFocusBorder",{dark:null,light:null,hcDark:null,hcLight:"#B5200D"},d(5556,null)),_bi=te("activityBar.activeBackground",null,d(5554,null)),jro=te("activityBar.dropBorder",{dark:D2,light:D2,hcDark:null,hcLight:null},d(5561,null)),zD=te("activityBarBadge.background",{dark:"#007ACC",light:"#007ACC",hcDark:"#000000",hcLight:"#0F4A85"},d(5558,null)),KD=te("activityBarBadge.foreground",Ue.white,d(5559,null)),d3=te("activityBarTop.foreground",{dark:"#E7E7E7",light:"#424242",hcDark:Ue.white,hcLight:Vd},d(5564,null)),fMt=te("activityBarTop.activeBorder",{dark:d3,light:d3,hcDark:Ei,hcLight:"#B5200D"},d(5566,null)),ffa=te("activityBarTop.activeBackground",null,d(5565,null)),vMt=te("activityBarTop.inactiveForeground",{dark:ni(d3,.6),light:ni(d3,.75),hcDark:Ue.white,hcLight:Vd},d(5569,null)),bMt=te("activityBarTop.dropBorder",d3,d(5568,null)),vfa=te("activityBarTop.background",null,d(5567,null)),GI=te("panel.background",Bo,d(5613,null)),ob=te("panel.border",{dark:Ue.fromHex("#808080").transparent(.35),light:Ue.fromHex("#808080").transparent(.35),hcDark:Ei,hcLight:Ei},d(5614,null)),Qro=te("panelTitle.border",{dark:null,light:null,hcDark:ob,hcLight:ob},d(5628,null)),u3=te("panelTitle.activeForeground",{dark:"#E7E7E7",light:"#424242",hcDark:Ue.white,hcLight:Vd},d(5612,null)),SMt=te("panelTitle.inactiveForeground",{dark:ni(u3,.6),light:ni(u3,.75),hcDark:Ue.white,hcLight:Vd},d(5616,null)),IMt=te("panelTitle.activeBorder",{dark:u3,light:u3,hcDark:Ei,hcLight:"#B5200D"},d(5611,null)),Yro=te("panelTitleBadge.background",zD,d(5626,null)),Xro=te("panelTitleBadge.foreground",KD,d(5627,null)),bfa=te("panelInput.border",{dark:LI,light:Ue.fromHex("#ddd"),hcDark:LI,hcLight:LI},d(5617,null)),yMt=te("panel.dropBorder",u3,d(5615,null)),nYe=te("panelSection.dropBackground",ZT,d(5619,null)),Jro=te("panelSectionHeader.background",{dark:Ue.fromHex("#808080").transparent(.2),light:Ue.fromHex("#808080").transparent(.2),hcDark:null,hcLight:null},d(5620,null)),Zro=te("panelSectionHeader.foreground",null,d(5622,null)),eso=te("panelSectionHeader.border",Ei,d(5621,null)),wMt=te("panelSection.border",ob,d(5618,null)),tso=te("panelStickyScroll.background",GI,d(5623,null)),iso=te("panelStickyScroll.border",null,d(5624,null)),oso=te("panelStickyScroll.shadow",Xz,d(5625,null)),Sfa=te("browser.border",tYe,d(5573,null)),Ifa=te("profileBadge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:Ue.white,hcLight:Ue.black},d(5629,null)),yfa=te("profileBadge.foreground",{dark:Ue.white,light:"#333333",hcDark:Ue.black,hcLight:Ue.white},d(5630,null)),nso=te("statusBarItem.remoteBackground",zD,d(5662,null)),L9o=te("statusBarItem.remoteForeground",KD,d(5663,null)),wfa=te("statusBarItem.remoteHoverForeground",oYe,d(5674,null)),Cfa=te("statusBarItem.remoteHoverBackground",{dark:SH,light:SH,hcDark:SH,hcLight:null},d(5673,null)),xfa=te("statusBarItem.offlineBackground","#6c1717",d(5660,null)),kfa=te("statusBarItem.offlineForeground",L9o,d(5661,null)),Efa=te("statusBarItem.offlineHoverForeground",oYe,d(5668,null)),Tfa=te("statusBarItem.offlineHoverBackground",{dark:SH,light:SH,hcDark:SH,hcLight:null},d(5667,null)),rso=te("extensionBadge.remoteBackground",zD,d(5592,null)),sso=te("extensionBadge.remoteForeground",KD,d(5593,null)),ch=te("sideBar.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#000000",hcLight:"#FFFFFF"},d(5632,null)),QA=te("sideBar.foreground",null,d(5635,null)),R2=te("sideBar.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(5633,null)),_fa=te("sideBarTitle.background",ch,d(5642,null)),aso=te("sideBarTitle.foreground",QA,d(5644,null)),CMt=te("sideBarTitle.border",{dark:null,light:null,hcDark:R2,hcLight:R2},d(5643,null)),p3=te("sideBar.dropBackground",ZT,d(5634,null)),lso=te("sideBarSectionHeader.background",{dark:Ue.fromHex("#808080").transparent(.2),light:Ue.fromHex("#808080").transparent(.2),hcDark:null,hcLight:null},d(5636,null)),cso=te("sideBarSectionHeader.foreground",QA,d(5638,null)),Dbi=te("sideBarSectionHeader.border",Ei,d(5637,null)),Dfa=te("sideBarActivityBarTop.border",Dbi,d(5631,null)),dso=te("sideBarStickyScroll.background",ch,d(5639,null)),uso=te("sideBarStickyScroll.border",null,d(5640,null)),pso=te("sideBarStickyScroll.shadow",Xz,d(5641,null)),T0=te("titleBar.activeForeground",{dark:"#CCCCCC",light:"#333333",hcDark:"#FFFFFF",hcLight:"#292929"},d(5707,null)),xMt=te("titleBar.inactiveForeground",{dark:ni(T0,.6),light:ni(T0,.6),hcDark:null,hcLight:"#292929"},d(5710,null)),uZ=te("titleBar.activeBackground",{dark:"#3C3C3C",light:"#DDDDDD",hcDark:"#000000",hcLight:"#FFFFFF"},d(5706,null)),mso=te("titleBar.inactiveBackground",{dark:ni(uZ,.6),light:ni(uZ,.6),hcDark:null,hcLight:null},d(5709,null)),kMt=te("titleBar.border",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(5708,null)),M9o=te("menubar.selectionForeground",T0,d(5597,null)),bro=te("menubar.selectionBackground",{dark:x5,light:x5,hcDark:null,hcLight:null},d(5595,null)),Rfa=te("menubar.selectionBorder",{dark:null,light:null,hcDark:la,hcLight:la},d(5596,null)),Lfa=te("commandCenter.foreground",T0,d(5579,null),!1),Mfa=te("commandCenter.activeForeground",M9o,d(5576,null),!1),Pfa=te("commandCenter.inactiveForeground",xMt,d(5581,null),!1),hso=te("commandCenter.background",{dark:Ue.white.transparent(.05),hcDark:null,light:Ue.black.transparent(.05),hcLight:null},d(5577,null),!1),Afa=te("commandCenter.activeBackground",{dark:Ue.white.transparent(.08),hcDark:bro,light:Ue.black.transparent(.08),hcLight:bro},d(5574,null),!1),Nfa=te("commandCenter.border",{dark:ni(T0,.2),hcDark:Ei,light:ni(T0,.2),hcLight:Ei},d(5578,null),!1),Ofa=te("commandCenter.activeBorder",{dark:ni(T0,.3),hcDark:T0,light:ni(T0,.3),hcLight:T0},d(5575,null),!1),Ffa=te("commandCenter.inactiveBorder",ni(xMt,.25),d(5580,null),!1),gso=te("notificationCenter.border",{dark:SD,light:SD,hcDark:Ei,hcLight:Ei},d(5598,null)),fso=te("notificationToast.border",{dark:SD,light:SD,hcDark:Ei,hcLight:Ei},d(5608,null)),Wfa=te("notifications.foreground",vT,d(5604,null)),dZ=te("notifications.background",qu,d(5601,null)),Vfa=te("notificationLink.foreground",AS,d(5606,null)),vso=te("notificationCenterHeader.foreground",null,d(5600,null)),Rbi=te("notificationCenterHeader.background",{dark:Bf(dZ,.3),light:Eu(dZ,.05),hcDark:dZ,hcLight:dZ},d(5599,null)),Bfa=te("notifications.border",Rbi,d(5602,null)),Hfa=te("notificationsErrorIcon.foreground",$v,d(5603,null)),Ufa=te("notificationsWarningIcon.foreground",Tg,d(5607,null)),zfa=te("notificationsInfoIcon.foreground",eh,d(5605,null)),T_e=te("window.activeBorder",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(5713,null)),__e=te("window.inactiveBorder",{dark:null,light:null,hcDark:Ei,hcLight:Ei},d(5714,null));var EMt=le("IExtensionStatusBarItemService");var rYe=class{constructor(i){this._statusbarService=i;this._entries=new Map;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}dispose(){this._entries.forEach(i=>i.accessor.dispose()),this._entries.clear(),this._onDidChange.dispose()}setOrUpdateEntry(i,e,t,o,n,r,s,l,c,u,p,h){let g,f;if(h)g=h.label,f=h.role;else if(g=AK(n),typeof r=="string"||yr(r)){let w=typeof r=="string"?r:r.value;g+=`, ${w}`}let v;switch(c?.id){case Ebi:case Gro:v=c.id===Ebi?"error":"warning",l=void 0,c=void 0}let b={name:o,text:n,tooltip:r,command:s,color:l,backgroundColor:c,ariaLabel:g,role:f,kind:v,extensionId:t};typeof p>"u"&&(p=0);let S=u?0:1,y=this._entries.get(i);if(y&&(S=y.alignment,p=y.priority),y)return y.accessor.update(b),y.entry=b,1;{let w;typeof t=="string"?w={primary:p,secondary:Lr(t)}:w=p;let x=this._statusbarService.addEntry(b,e,S,w);return this._entries.set(i,{accessor:x,entry:b,alignment:S,priority:p,disposable:ee(()=>{x.dispose(),this._entries.delete(i),this._onDidChange.fire({removed:i})})}),this._onDidChange.fire({added:[i,{entry:b,alignment:S,priority:p}]}),0}}unsetEntry(i){this._entries.get(i)?.disposable.dispose(),this._entries.delete(i)}getEntries(){return this._entries.entries()}};rYe=I([m(0,Fr)],rYe);Ce(EMt,rYe,1);function A9o(a){let i=a;return typeof i.id=="string"&&i.id.length>0&&typeof i.name=="string"&&typeof i.text=="string"&&(i.alignment==="left"||i.alignment==="right")&&(i.command===void 0||typeof i.command=="string")&&(i.tooltip===void 0||typeof i.tooltip=="string")&&(i.priority===void 0||typeof i.priority=="number")&&(i.accessibilityInformation===void 0||JQi(i.accessibilityInformation))}var bso={type:"object",required:["id","text","alignment","name"],properties:{id:{type:"string",markdownDescription:d(3978,null)},name:{type:"string",description:d(3980,null)},text:{type:"string",description:d(3982,null,"$(globe)")},tooltip:{type:"string",description:d(3983,null)},command:{type:"string",description:d(3977,null)},alignment:{type:"string",enum:["left","right"],description:d(3976,null)},priority:{type:"number",description:d(3981,null)},accessibilityInformation:{type:"object",description:d(3973,null),required:["label"],properties:{role:{type:"string",description:d(3975,null)},label:{type:"string",description:d(3974,null)}}}}},N9o={description:d(3984,null),oneOf:[bso,{type:"array",items:bso}]},Sso=zn.registerExtensionPoint({extensionPoint:"statusBarItems",jsonSchema:N9o}),D_e=class{constructor(i){let e=new O;Sso.setHandler(t=>{e.clear();for(let o of t){if(!Va(o.description,"contribStatusBarItems")){o.collector.error(`The ${Sso.name} is proposed API`);continue}let{value:n,collector:r}=o;for(let s of yt.wrap(n)){if(!A9o(s)){r.error(d(3979,null));continue}let l=hro(o.description.identifier,s.id);i.setOrUpdateEntry(l,l,hi.toKey(o.description.identifier),s.name??o.description.displayName??o.description.name,s.text,s.tooltip,s.command?{id:s.command,title:s.name}:void 0,void 0,void 0,s.alignment==="left",s.priority,s.accessibilityInformation)===0&&e.add(ee(()=>i.unsetEntry(l)))}}})}};D_e=I([m(0,EMt)],D_e);var vpe=/^([^.]+\..+)[:=](.+)$/,Zu=class{constructor(i,e,t){this._args=i;this.paths=e;this.productService=t}get appRoot(){return yd(In.asFileUri("").fsPath)}get userHome(){return A.file(this.paths.homeDir)}get userDataPath(){return this.paths.userDataDir}get appSettingsHome(){return A.file(td(this.userDataPath,"User"))}get tmpDir(){return A.file(this.paths.tmpDir)}get cacheHome(){return A.file(this.userDataPath)}get stateResource(){return Ve(this.appSettingsHome,"globalStorage","storage.json")}get userRoamingDataHome(){return this.appSettingsHome.with({scheme:Q.vscodeUserData})}get userDataSyncHome(){return Ve(this.appSettingsHome,"sync")}get logsHome(){if(!this.args.logsPath){let i=ISt(new Date).replace(/-|:|\.\d+Z$/g,"");this.args.logsPath=td(this.userDataPath,"logs",i)}return A.file(this.args.logsPath)}get sync(){return this.args.sync}get workspaceStorageHome(){return Ve(this.appSettingsHome,"workspaceStorage")}get localHistoryHome(){return Ve(this.appSettingsHome,"History")}get keyboardLayoutResource(){return Ve(this.userRoamingDataHome,"keyboardLayout.json")}get argvResource(){let i=Sp.VSCODE_PORTABLE;return i?A.file(td(i,"argv.json")):Ve(this.userHome,this.productService.dataFolderName,"argv.json")}get isExtensionDevelopment(){return!!this.args.extensionDevelopmentPath}get untitledWorkspacesHome(){return A.file(td(this.userDataPath,"Workspaces"))}get builtinExtensionsPath(){let i=this.args["builtin-extensions-dir"];return i?uA(i):Vh(td(In.asFileUri("").fsPath,"..","extensions"))}get extensionsDownloadLocation(){let i=this.args["extensions-download-dir"];return i?A.file(uA(i)):A.file(td(this.userDataPath,"CachedExtensionVSIXs"))}get extensionsPath(){let i=this.args["extensions-dir"];if(i)return uA(i);let e=Sp.VSCODE_EXTENSIONS;if(e)return e;let t=Sp.VSCODE_PORTABLE;return t?td(t,"extensions"):Ve(this.userHome,this.productService.dataFolderName,"extensions").fsPath}get appSharedDataHome(){let i=this.args["shared-data-dir"];if(i)return A.file(uA(i));let e=Sp.VSCODE_PORTABLE;return e?A.file(td(e,"shared-data")):Ve(this.userHome,this.productService.sharedDataFolderName)}get extensionDevelopmentLocationURI(){let i=this.args.extensionDevelopmentPath;if(Array.isArray(i))return i.map(e=>/^[^:/?#]+?:\/\//.test(e)?A.parse(e):A.file(Vh(e)))}get extensionDevelopmentKind(){return this.args.extensionDevelopmentKind?.map(i=>i==="ui"||i==="workspace"||i==="web"?i:"workspace")}get extensionTestsLocationURI(){let i=this.args.extensionTestsPath;if(i)return/^[^:/?#]+?:\/\//.test(i)?A.parse(i):A.file(Vh(i))}get disableExtensions(){if(this.args["disable-extensions"])return!0;let i=this.args["disable-extension"];if(i){if(typeof i=="string")return[i];if(Array.isArray(i)&&i.length>0)return i}return!1}get skipBuiltinExtensions(){let i=Sp.VSCODE_SKIP_BUILTIN_EXTENSIONS;return i?i.split(",").map(e=>e.trim()).filter(e=>e):[]}get debugExtensionHost(){return O9o(this.args,this.isBuilt)}get debugRenderer(){return!!this.args.debugRenderer}get isBuilt(){return!Sp.VSCODE_DEV}get verbose(){return!!this.args.verbose}get logLevel(){return this.args.log?.find(i=>!vpe.test(i))}get extensionLogLevel(){let i=[];for(let e of this.args.log||[]){let t=vpe.exec(e);t?.[1]&&t[2]&&i.push([t[1],t[2]])}return i.length?i:void 0}get serviceMachineIdResource(){return Ve(A.file(this.userDataPath),"machineid")}get crashReporterId(){return this.args["crash-reporter-id"]}get crashReporterDirectory(){return this.args["crash-reporter-directory"]}get disableTelemetry(){return!!this.args["disable-telemetry"]}get disableExperiments(){return!!this.args["disable-experiments"]}get disableWorkspaceTrust(){return!!this.args["disable-workspace-trust"]}get useInMemorySecretStorage(){return!!this.args["use-inmemory-secretstorage"]}get policyFile(){if(this.args["__enable-file-policy"]){let i=Sp.VSCODE_PORTABLE;return i?A.file(td(i,"policy.json")):Ve(this.userHome,this.productService.dataFolderName,"policy.json")}}get agentSessionsWorkspace(){return Ve(this.appSettingsHome,"agent-sessions.code-workspace")}get editSessionId(){return this.args.editSessionId}get exportPolicyData(){return this.args["export-policy-data"]}get exportDefaultKeybindings(){return this.args["export-default-keybindings"]}get continueOn(){return this.args.continueOn}set continueOn(i){this.args.continueOn=i}get args(){return this._args}};I([bi],Zu.prototype,"appRoot",1),I([bi],Zu.prototype,"userHome",1),I([bi],Zu.prototype,"userDataPath",1),I([bi],Zu.prototype,"appSettingsHome",1),I([bi],Zu.prototype,"tmpDir",1),I([bi],Zu.prototype,"cacheHome",1),I([bi],Zu.prototype,"stateResource",1),I([bi],Zu.prototype,"userRoamingDataHome",1),I([bi],Zu.prototype,"userDataSyncHome",1),I([bi],Zu.prototype,"sync",1),I([bi],Zu.prototype,"workspaceStorageHome",1),I([bi],Zu.prototype,"localHistoryHome",1),I([bi],Zu.prototype,"keyboardLayoutResource",1),I([bi],Zu.prototype,"argvResource",1),I([bi],Zu.prototype,"isExtensionDevelopment",1),I([bi],Zu.prototype,"untitledWorkspacesHome",1),I([bi],Zu.prototype,"builtinExtensionsPath",1),I([bi],Zu.prototype,"extensionsDownloadLocation",1),I([bi],Zu.prototype,"extensionsPath",1),I([bi],Zu.prototype,"appSharedDataHome",1),I([bi],Zu.prototype,"extensionDevelopmentLocationURI",1),I([bi],Zu.prototype,"extensionDevelopmentKind",1),I([bi],Zu.prototype,"extensionTestsLocationURI",1),I([bi],Zu.prototype,"debugExtensionHost",1),I([bi],Zu.prototype,"logLevel",1),I([bi],Zu.prototype,"extensionLogLevel",1),I([bi],Zu.prototype,"serviceMachineIdResource",1),I([bi],Zu.prototype,"disableTelemetry",1),I([bi],Zu.prototype,"disableExperiments",1),I([bi],Zu.prototype,"disableWorkspaceTrust",1),I([bi],Zu.prototype,"useInMemorySecretStorage",1),I([bi],Zu.prototype,"policyFile",1),I([bi],Zu.prototype,"agentSessionsWorkspace",1);function O9o(a,i){return F9o(a["inspect-extensions"],a["inspect-brk-extensions"],5870,i,a.debugId,a.extensionEnvironment)}function F9o(a,i,e,t,o,n){let s=Number(i||a)||(t?null:e),l=s?!!i:!1,c;if(n)try{c=JSON.parse(n)}catch{}return{port:s,break:l,debugId:o,env:c}}var Od=ko,Ic=class{constructor(i,e,t,o){this.workspaceId=i;this.logsHome=e;this.options=t;this.productService=o;this.extensionHostDebugEnvironment=void 0;if(t.workspaceProvider&&Array.isArray(t.workspaceProvider.payload))try{this.payload=new Map(t.workspaceProvider.payload)}catch(n){mt(n)}}get remoteAuthority(){return this.options.remoteAuthority}get expectsResolverExtension(){return!!this.options.remoteAuthority?.includes("+")&&!this.options.webSocketFactory}get isBuilt(){return!!this.productService.commit}get logLevel(){let i=this.payload?.get("logLevel");return i?i.split(",").find(e=>!vpe.test(e)):this.options.developmentOptions?.logLevel!==void 0?ux(this.options.developmentOptions?.logLevel):void 0}get extensionLogLevel(){let i=this.payload?.get("logLevel");if(i){let e=[];for(let t of i.split(",")){let o=vpe.exec(t);o?.[1]&&o[2]&&e.push([o[1],o[2]])}return e.length?e:void 0}return this.options.developmentOptions?.extensionLogLevel!==void 0?this.options.developmentOptions?.extensionLogLevel.map(([e,t])=>[e,ux(t)]):void 0}get profDurationMarkers(){let i=this.payload?.get("profDurationMarkers");if(i){let e=[];for(let t of i.split(","))e.push(t);return e.length===2?e:void 0}}get windowLogsPath(){return this.logsHome}get logFile(){return Ve(this.windowLogsPath,"window.log")}get userRoamingDataHome(){return A.file("/User").with({scheme:Q.vscodeUserData})}get argvResource(){return Ve(this.userRoamingDataHome,"argv.json")}get cacheHome(){return Ve(this.userRoamingDataHome,"caches")}get workspaceStorageHome(){return Ve(this.userRoamingDataHome,"workspaceStorage")}get appSharedDataHome(){return Ve(this.userRoamingDataHome,"sharedData")}get localHistoryHome(){return Ve(this.userRoamingDataHome,"History")}get stateResource(){return Ve(this.userRoamingDataHome,"State","storage.json")}get userDataSyncHome(){return Ve(this.userRoamingDataHome,"sync",this.workspaceId)}get sync(){}get keyboardLayoutResource(){return Ve(this.userRoamingDataHome,"keyboardLayout.json")}get untitledWorkspacesHome(){return Ve(this.userRoamingDataHome,"Workspaces")}get serviceMachineIdResource(){return Ve(this.userRoamingDataHome,"machineid")}get extHostLogsPath(){return Ve(this.logsHome,"exthost")}get debugExtensionHost(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.params}get isExtensionDevelopment(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.isExtensionDevelopment}get extensionDevelopmentLocationURI(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionDevelopmentLocationURI}get extensionDevelopmentLocationKind(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionDevelopmentKind}get extensionTestsLocationURI(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionTestsLocationURI}get extensionEnabledProposedApi(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.extensionEnabledProposedApi}get debugRenderer(){return this.extensionHostDebugEnvironment||(this.extensionHostDebugEnvironment=this.resolveExtensionHostDebugEnvironment()),this.extensionHostDebugEnvironment.debugRenderer}get enableSmokeTestDriver(){return this.options.developmentOptions?.enableSmokeTestDriver}get disableExtensions(){return this.payload?.get("disableExtensions")==="true"}get enableExtensions(){return this.options.enabledExtensions}get webviewExternalEndpoint(){let i=this.options.webviewEndpoint||this.productService.webviewContentExternalBaseUrlTemplate||"https://{{uuid}}.vscode-cdn.net/{{quality}}/{{commit}}/out/vs/workbench/contrib/webview/browser/pre/",e=this.payload?.get("webviewExternalEndpointCommit");return i.replace("{{commit}}",e??this.productService.commit??"ef65ac1ba57f57f2a3961bfe94aa20481caca4c6").replace("{{quality}}",(e?"insider":this.productService.quality)??"insider")}get extensionTelemetryLogResource(){return Ve(this.logsHome,"extensionTelemetry.log")}get disableTelemetry(){return!1}get disableExperiments(){return!1}get verbose(){return this.payload?.get("verbose")==="true"}get logExtensionHostCommunication(){return this.payload?.get("logExtensionHostCommunication")==="true"}get skipReleaseNotes(){return this.payload?.get("skipReleaseNotes")==="true"}get skipWelcome(){return this.payload?.get("skipWelcome")==="true"}get disableWorkspaceTrust(){return!this.options.enableWorkspaceTrust}get isSessionsWindow(){return this.payload?.get("isSessionsWindow")==="true"}get profile(){return this.payload?.get("profile")}get editSessionId(){return this.options.editSessionId}resolveExtensionHostDebugEnvironment(){let i={params:{port:null,break:!1},debugRenderer:!1,isExtensionDevelopment:!1,extensionDevelopmentLocationURI:void 0,extensionDevelopmentKind:void 0};if(this.payload)for(let[t,o]of this.payload)switch(t){case"extensionDevelopmentPath":i.extensionDevelopmentLocationURI||(i.extensionDevelopmentLocationURI=[]),i.extensionDevelopmentLocationURI.push(A.parse(o)),i.isExtensionDevelopment=!0;break;case"extensionDevelopmentKind":i.extensionDevelopmentKind=[o];break;case"extensionTestsPath":i.extensionTestsLocationURI=A.parse(o);break;case"debugRenderer":i.debugRenderer=o==="true";break;case"debugId":i.params.debugId=o;break;case"inspect-brk-extensions":i.params.port=parseInt(o),i.params.break=!0;break;case"inspect-extensions":i.params.port=parseInt(o);break;case"extensionEnvironment":try{i.params.env=JSON.parse(o)}catch(n){mt(n)}break;case"enableProposedApi":i.extensionEnabledProposedApi=[];break}let e=this.options.developmentOptions;return e&&!i.isExtensionDevelopment&&(e.extensions?.length&&(i.extensionDevelopmentLocationURI=e.extensions.map(t=>A.revive(t)),i.isExtensionDevelopment=!0),e.extensionTestsPath&&(i.extensionTestsLocationURI=A.revive(e.extensionTestsPath))),i}get filesToOpenOrCreate(){if(this.payload){let i=this.payload.get("openFile");if(i){let e=A.parse(i);if(this.payload.has("gotoLineMode")){let t=r8i(e.path);return[{fileUri:e.with({path:t.path}),options:{selection:bn(t.line)?void 0:{startLineNumber:t.line,startColumn:t.column||1}}}]}return[{fileUri:e}]}}}get filesToDiff(){if(this.payload){let i=this.payload.get("diffFilePrimary"),e=this.payload.get("diffFileSecondary");if(i&&e)return[{fileUri:A.parse(e)},{fileUri:A.parse(i)}]}}get filesToMerge(){if(this.payload){let i=this.payload.get("mergeFile1"),e=this.payload.get("mergeFile2"),t=this.payload.get("mergeFileBase"),o=this.payload.get("mergeFileResult");if(i&&e&&t&&o)return[{fileUri:A.parse(i)},{fileUri:A.parse(e)},{fileUri:A.parse(t)},{fileUri:A.parse(o)}]}}};I([bi],Ic.prototype,"remoteAuthority",1),I([bi],Ic.prototype,"expectsResolverExtension",1),I([bi],Ic.prototype,"isBuilt",1),I([bi],Ic.prototype,"logLevel",1),I([bi],Ic.prototype,"windowLogsPath",1),I([bi],Ic.prototype,"logFile",1),I([bi],Ic.prototype,"userRoamingDataHome",1),I([bi],Ic.prototype,"argvResource",1),I([bi],Ic.prototype,"cacheHome",1),I([bi],Ic.prototype,"workspaceStorageHome",1),I([bi],Ic.prototype,"appSharedDataHome",1),I([bi],Ic.prototype,"localHistoryHome",1),I([bi],Ic.prototype,"stateResource",1),I([bi],Ic.prototype,"userDataSyncHome",1),I([bi],Ic.prototype,"sync",1),I([bi],Ic.prototype,"keyboardLayoutResource",1),I([bi],Ic.prototype,"untitledWorkspacesHome",1),I([bi],Ic.prototype,"serviceMachineIdResource",1),I([bi],Ic.prototype,"extHostLogsPath",1),I([bi],Ic.prototype,"debugExtensionHost",1),I([bi],Ic.prototype,"isExtensionDevelopment",1),I([bi],Ic.prototype,"extensionDevelopmentLocationURI",1),I([bi],Ic.prototype,"extensionDevelopmentLocationKind",1),I([bi],Ic.prototype,"extensionTestsLocationURI",1),I([bi],Ic.prototype,"extensionEnabledProposedApi",1),I([bi],Ic.prototype,"debugRenderer",1),I([bi],Ic.prototype,"enableSmokeTestDriver",1),I([bi],Ic.prototype,"disableExtensions",1),I([bi],Ic.prototype,"enableExtensions",1),I([bi],Ic.prototype,"webviewExternalEndpoint",1),I([bi],Ic.prototype,"extensionTelemetryLogResource",1),I([bi],Ic.prototype,"disableTelemetry",1),I([bi],Ic.prototype,"disableExperiments",1),I([bi],Ic.prototype,"verbose",1),I([bi],Ic.prototype,"logExtensionHostCommunication",1),I([bi],Ic.prototype,"skipReleaseNotes",1),I([bi],Ic.prototype,"skipWelcome",1),I([bi],Ic.prototype,"disableWorkspaceTrust",1),I([bi],Ic.prototype,"isSessionsWindow",1),I([bi],Ic.prototype,"profile",1),I([bi],Ic.prototype,"editSessionId",1),I([bi],Ic.prototype,"filesToOpenOrCreate",1),I([bi],Ic.prototype,"filesToDiff",1),I([bi],Ic.prototype,"filesToMerge",1);var ep=Pe,Iso="[",yso="]",sYe="*",wso=/\[(.+?)\]/g;var fl;(r=>(r.COLOR_THEME_DARK="Dark 2026",r.COLOR_THEME_LIGHT="Light 2026",r.COLOR_THEME_HC_DARK="Default High Contrast",r.COLOR_THEME_HC_LIGHT="Default High Contrast Light",r.FILE_ICON_THEME="vs-seti",r.PRODUCT_ICON_THEME="Default"))(fl||={});function aYe(a){switch(a){case"Default Dark Modern":return"Dark Modern";case"Default Light Modern":return"Light Modern";case"Default Dark+":return"Dark+";case"Default Light+":return"Light+";case"Experimental Dark":case"VS Code Dark":return fl.COLOR_THEME_DARK;case"Experimental Light":case"VS Code Light":return fl.COLOR_THEME_LIGHT}return a}var Cso={"actionBar.toggledBackground":"#383a49","activityBar.activeBorder":"#0078D4","activityBar.background":"#181818","activityBar.border":"#2B2B2B","activityBar.foreground":"#D7D7D7","activityBar.inactiveForeground":"#868686","activityBarBadge.background":"#0078D4","activityBarBadge.foreground":"#FFFFFF","badge.background":"#616161","badge.foreground":"#F8F8F8","button.background":"#0078D4","button.border":"#FFFFFF12","button.foreground":"#FFFFFF","button.hoverBackground":"#026EC1","button.secondaryBackground":"#313131","button.secondaryForeground":"#CCCCCC","button.secondaryHoverBackground":"#3C3C3C","chat.slashCommandBackground":"#26477866","chat.slashCommandForeground":"#85B6FF","chat.editedFileForeground":"#E2C08D","checkbox.background":"#313131","checkbox.border":"#3C3C3C","debugToolBar.background":"#181818",descriptionForeground:"#9D9D9D","dropdown.background":"#313131","dropdown.border":"#3C3C3C","dropdown.foreground":"#CCCCCC","dropdown.listBackground":"#1F1F1F","editor.background":"#1F1F1F","editor.findMatchBackground":"#9E6A03","editor.foreground":"#CCCCCC","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorGroup.border":"#FFFFFF17","editorGroupHeader.tabsBackground":"#181818","editorGroupHeader.tabsBorder":"#2B2B2B","editorGutter.addedBackground":"#2EA043","editorGutter.deletedBackground":"#F85149","editorGutter.modifiedBackground":"#0078D4","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","editorLineNumber.activeForeground":"#CCCCCC","editorLineNumber.foreground":"#6E7681","editorOverviewRuler.border":"#010409","editorWidget.background":"#202020",errorForeground:"#F85149",focusBorder:"#0078D4",foreground:"#CCCCCC","icon.foreground":"#CCCCCC","input.background":"#313131","input.border":"#3C3C3C","input.foreground":"#CCCCCC","input.placeholderForeground":"#989898","inputOption.activeBackground":"#2489DB82","inputOption.activeBorder":"#2488DB","keybindingLabel.foreground":"#CCCCCC","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#1F1F1F","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","notificationCenterHeader.background":"#1F1F1F","notificationCenterHeader.foreground":"#CCCCCC","notifications.background":"#1F1F1F","notifications.border":"#2B2B2B","notifications.foreground":"#CCCCCC","panel.background":"#181818","panel.border":"#2B2B2B","panelInput.border":"#2B2B2B","panelTitle.activeBorder":"#0078D4","panelTitle.activeForeground":"#CCCCCC","panelTitle.inactiveForeground":"#9D9D9D","peekViewEditor.background":"#1F1F1F","peekViewEditor.matchHighlightBackground":"#BB800966","peekViewResult.background":"#1F1F1F","peekViewResult.matchHighlightBackground":"#BB800966","pickerGroup.border":"#3C3C3C","ports.iconRunningProcessForeground":"#369432","progressBar.background":"#0078D4","quickInput.background":"#222222","quickInput.foreground":"#CCCCCC","settings.dropdownBackground":"#313131","settings.dropdownBorder":"#3C3C3C","settings.headerForeground":"#FFFFFF","settings.modifiedItemIndicator":"#BB800966","sideBar.background":"#181818","sideBar.border":"#2B2B2B","sideBar.foreground":"#CCCCCC","sideBarSectionHeader.background":"#181818","sideBarSectionHeader.border":"#2B2B2B","sideBarSectionHeader.foreground":"#CCCCCC","sideBarTitle.foreground":"#CCCCCC","statusBar.background":"#181818","statusBar.border":"#2B2B2B","statusBar.debuggingBackground":"#0078D4","statusBar.debuggingForeground":"#FFFFFF","statusBar.focusBorder":"#0078D4","statusBar.foreground":"#CCCCCC","statusBar.noFolderBackground":"#1F1F1F","statusBarItem.focusBorder":"#0078D4","statusBarItem.prominentBackground":"#6E768166","statusBarItem.remoteBackground":"#0078D4","statusBarItem.remoteForeground":"#FFFFFF","tab.activeBackground":"#1F1F1F","tab.activeBorder":"#1F1F1F","tab.activeBorderTop":"#0078D4","tab.activeForeground":"#FFFFFF","tab.border":"#2B2B2B","tab.hoverBackground":"#1F1F1F","tab.inactiveBackground":"#181818","tab.inactiveForeground":"#9D9D9D","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedBorderTop":"#6caddf","tab.selectedForeground":"#ffffffa0","tab.unfocusedActiveBorder":"#1F1F1F","tab.unfocusedActiveBorderTop":"#2B2B2B","tab.unfocusedHoverBackground":"#1F1F1F","terminal.foreground":"#CCCCCC","terminal.inactiveSelectionBackground":"#3A3D41","terminal.tab.activeBorder":"#0078D4","textBlockQuote.background":"#2B2B2B","textBlockQuote.border":"#616161","textCodeBlock.background":"#2B2B2B","textLink.activeForeground":"#4daafc","textLink.foreground":"#4daafc","textPreformat.background":"#3C3C3C","textPreformat.foreground":"#D0D0D0","textSeparator.foreground":"#21262D","titleBar.activeBackground":"#181818","titleBar.activeForeground":"#CCCCCC","titleBar.border":"#2B2B2B","titleBar.inactiveBackground":"#1F1F1F","titleBar.inactiveForeground":"#9D9D9D","welcomePage.progress.foreground":"#0078D4","welcomePage.tileBackground":"#2B2B2B","widget.border":"#313131"},xso={"actionBar.toggledBackground":"#dddddd","activityBar.activeBorder":"#005FB8","activityBar.background":"#F8F8F8","activityBar.border":"#E5E5E5","activityBar.foreground":"#1F1F1F","activityBar.inactiveForeground":"#616161","activityBarBadge.background":"#005FB8","activityBarBadge.foreground":"#FFFFFF","badge.background":"#CCCCCC","badge.foreground":"#3B3B3B","button.background":"#005FB8","button.border":"#0000001a","button.foreground":"#FFFFFF","button.hoverBackground":"#0258A8","button.secondaryBackground":"#E5E5E5","button.secondaryForeground":"#3B3B3B","button.secondaryHoverBackground":"#CCCCCC","chat.slashCommandBackground":"#ADCEFF7A","chat.slashCommandForeground":"#26569E","chat.editedFileForeground":"#895503","checkbox.background":"#F8F8F8","checkbox.border":"#CECECE",descriptionForeground:"#3B3B3B","diffEditor.unchangedRegionBackground":"#f8f8f8","dropdown.background":"#FFFFFF","dropdown.border":"#CECECE","dropdown.foreground":"#3B3B3B","dropdown.listBackground":"#FFFFFF","editor.background":"#FFFFFF","editor.foreground":"#3B3B3B","editor.inactiveSelectionBackground":"#E5EBF1","editor.selectionHighlightBackground":"#ADD6FF80","editorGroup.border":"#E5E5E5","editorGroupHeader.tabsBackground":"#F8F8F8","editorGroupHeader.tabsBorder":"#E5E5E5","editorGutter.addedBackground":"#2EA043","editorGutter.deletedBackground":"#F85149","editorGutter.modifiedBackground":"#005FB8","editorIndentGuide.activeBackground1":"#939393","editorIndentGuide.background1":"#D3D3D3","editorLineNumber.activeForeground":"#171184","editorLineNumber.foreground":"#6E7681","editorOverviewRuler.border":"#E5E5E5","editorSuggestWidget.background":"#F8F8F8","editorWidget.background":"#F8F8F8",errorForeground:"#F85149",focusBorder:"#005FB8",foreground:"#3B3B3B","icon.foreground":"#3B3B3B","input.background":"#FFFFFF","input.border":"#CECECE","input.foreground":"#3B3B3B","input.placeholderForeground":"#767676","inputOption.activeBackground":"#BED6ED","inputOption.activeBorder":"#005FB8","inputOption.activeForeground":"#000000","keybindingLabel.foreground":"#3B3B3B","list.activeSelectionBackground":"#E8E8E8","list.activeSelectionForeground":"#000000","list.activeSelectionIconForeground":"#000000","list.focusAndSelectionOutline":"#005FB8","list.hoverBackground":"#F2F2F2","menu.border":"#CECECE","menu.selectionBackground":"#005FB8","menu.selectionForeground":"#ffffff","notebook.cellBorderColor":"#E5E5E5","notebook.selectedCellBackground":"#C8DDF150","notificationCenterHeader.background":"#FFFFFF","notificationCenterHeader.foreground":"#3B3B3B","notifications.background":"#FFFFFF","notifications.border":"#E5E5E5","notifications.foreground":"#3B3B3B","panel.background":"#F8F8F8","panel.border":"#E5E5E5","panelInput.border":"#E5E5E5","panelTitle.activeBorder":"#005FB8","panelTitle.activeForeground":"#3B3B3B","panelTitle.inactiveForeground":"#3B3B3B","peekViewEditor.matchHighlightBackground":"#BB800966","peekViewResult.background":"#FFFFFF","peekViewResult.matchHighlightBackground":"#BB800966","pickerGroup.border":"#E5E5E5","pickerGroup.foreground":"#8B949E","ports.iconRunningProcessForeground":"#369432","progressBar.background":"#005FB8","quickInput.background":"#F8F8F8","quickInput.foreground":"#3B3B3B","searchEditor.textInputBorder":"#CECECE","settings.dropdownBackground":"#FFFFFF","settings.dropdownBorder":"#CECECE","settings.headerForeground":"#1F1F1F","settings.modifiedItemIndicator":"#BB800966","settings.numberInputBorder":"#CECECE","settings.textInputBorder":"#CECECE","sideBar.background":"#F8F8F8","sideBar.border":"#E5E5E5","sideBar.foreground":"#3B3B3B","sideBarSectionHeader.background":"#F8F8F8","sideBarSectionHeader.border":"#E5E5E5","sideBarSectionHeader.foreground":"#3B3B3B","sideBarTitle.foreground":"#3B3B3B","statusBar.background":"#F8F8F8","statusBar.border":"#E5E5E5","statusBar.debuggingBackground":"#FD716C","statusBar.debuggingForeground":"#000000","statusBar.focusBorder":"#005FB8","statusBar.foreground":"#3B3B3B","statusBar.noFolderBackground":"#F8F8F8","statusBarItem.compactHoverBackground":"#CCCCCC","statusBarItem.errorBackground":"#C72E0F","statusBarItem.focusBorder":"#005FB8","statusBarItem.hoverBackground":"#B8B8B850","statusBarItem.prominentBackground":"#6E768166","statusBarItem.remoteBackground":"#005FB8","statusBarItem.remoteForeground":"#FFFFFF","tab.activeBackground":"#FFFFFF","tab.activeBorder":"#F8F8F8","tab.activeBorderTop":"#005FB8","tab.activeForeground":"#3B3B3B","tab.border":"#E5E5E5","tab.hoverBackground":"#FFFFFF","tab.inactiveBackground":"#F8F8F8","tab.inactiveForeground":"#868686","tab.lastPinnedBorder":"#D4D4D4","tab.selectedBackground":"#ffffffa5","tab.selectedBorderTop":"#68a3da","tab.selectedForeground":"#333333b3","tab.unfocusedActiveBorder":"#F8F8F8","tab.unfocusedActiveBorderTop":"#E5E5E5","tab.unfocusedHoverBackground":"#F8F8F8","terminal.foreground":"#3B3B3B","terminal.inactiveSelectionBackground":"#E5EBF1","terminal.tab.activeBorder":"#005FB8","terminalCursor.foreground":"#005FB8","textBlockQuote.background":"#F8F8F8","textBlockQuote.border":"#E5E5E5","textCodeBlock.background":"#F8F8F8","textLink.activeForeground":"#005FB8","textLink.foreground":"#005FB8","textPreformat.background":"#0000001F","textPreformat.foreground":"#3B3B3B","textSeparator.foreground":"#21262D","titleBar.activeBackground":"#F8F8F8","titleBar.activeForeground":"#1E1E1E","titleBar.border":"#E5E5E5","titleBar.inactiveBackground":"#F8F8F8","titleBar.inactiveForeground":"#8B949E","welcomePage.tileBackground":"#F3F3F3","widget.border":"#E5E5E5"},e_;(t=>{function a(o){return o&&{_extensionId:o.extensionId,_extensionIsBuiltin:o.extensionIsBuiltin,_extensionName:o.extensionName,_extensionPublisher:o.extensionPublisher}}t.toJSONObject=a;function i(o){if(o&&We(o._extensionId)&&Xa(o._extensionIsBuiltin)&&We(o._extensionName)&&We(o._extensionPublisher))return{extensionId:o._extensionId,extensionIsBuiltin:o._extensionIsBuiltin,extensionName:o._extensionName,extensionPublisher:o._extensionPublisher}}t.fromJSONObject=i;function e(o,n,r=!1){return{extensionPublisher:o,extensionId:`${o}.${n}`,extensionName:n,extensionIsBuiltin:r}}t.fromName=e})(e_||={});var Lbi="workbench.contrib.css.cache",kso=zn.registerExtensionPoint({extensionPoint:"css",jsonSchema:{description:d(19311,null),type:"array",items:{type:"object",properties:{path:{description:d(19312,null),type:"string"}},required:["path"]},defaultSnippets:[{body:[{path:"${1:styles.css}"}]}]}}),Mbi=class{constructor(i,e,t){this.fileService=i;this.environmentService=e;this.onUpdate=t;this.watchedLocations=new Map}watch(i){let e=i.toString();if(this.watchedLocations.has(e)||!this.environmentService.isExtensionDevelopment)return;let t=new O;t.add(this.fileService.watch(i)),t.add(this.fileService.onDidFilesChange(o=>{o.contains(i,0)&&this.onUpdate(i)})),this.watchedLocations.set(e,{uri:i,disposables:t})}unwatch(i){let e=i.toString(),t=this.watchedLocations.get(e);t&&(t.disposables.dispose(),this.watchedLocations.delete(e))}dispose(){for(let i of this.watchedLocations.values())i.disposables.dispose();this.watchedLocations.clear()}},R_e=class{constructor(i,e,t,o){this.themeService=t;this.storageService=o;this.disposables=new O;this.stylesheetsByExtension=new Map;this.pendingExtensions=new Map;this.watcher=this.disposables.add(new Mbi(i,e,n=>this.reloadStylesheet(n))),this.disposables.add(ee(()=>{for(let n of this.stylesheetsByExtension.values())for(let r of n)r.disposables.dispose();this.stylesheetsByExtension.clear()})),this.applyCachedCSS(),this.disposables.add(this.themeService.onDidColorThemeChange(()=>this.onThemeChange())),this.disposables.add(this.themeService.onDidFileIconThemeChange(()=>this.onThemeChange())),this.disposables.add(this.themeService.onDidProductIconThemeChange(()=>this.onThemeChange())),kso.setHandler((n,r)=>{for(let s of r.removed){let l=s.description.identifier.value;this.pendingExtensions.delete(l),this.removeStylesheets(l),this.clearCacheForExtension(l)}for(let s of r.added){if(!Va(s.description,"css")){s.collector.error(`The '${kso.name}' contribution point is proposed API.`);continue}let l=s.value,c=s.collector;if(!l||!Array.isArray(l)){c.error(d(19313,null));continue}let u=s.description.identifier.value;this.pendingExtensions.set(u,s),this.isExtensionThemeActive(u)?this.activateExtensionCSS(s):this.stylesheetsByExtension.has(u)&&(this.removeStylesheets(u),this.clearCacheForExtension(u))}})}isExtensionThemeActive(i){let e=this.themeService.getColorTheme(),t=this.themeService.getFileIconTheme(),o=this.themeService.getProductIconTheme();return!!(e.extensionData&&hi.equals(e.extensionData.extensionId,i))||!!(t.extensionData&&hi.equals(t.extensionData.extensionId,i))||!!(o.extensionData&&hi.equals(o.extensionData.extensionId,i))}onThemeChange(){for(let[i,e]of this.pendingExtensions)!this.stylesheetsByExtension.has(i)&&this.isExtensionThemeActive(i)&&this.activateExtensionCSS(e);for(let i of this.stylesheetsByExtension.keys())this.isExtensionThemeActive(i)||(this.removeStylesheets(i),this.clearCacheForExtension(i))}activateExtensionCSS(i){let e=i.description.identifier.value;if(this.stylesheetsByExtension.has(e))return;let t=i.description.extensionLocation,o=i.value,n=i.collector,r=[],s=[];for(let l of o){if(!l.path||typeof l.path!="string"){n.error(d(19314,null));continue}let c=Ve(t,l.path);if(!Yr(c,t)){n.warn(d(19315,null,c.path,t.path));continue}let u=new O,p=this.createCSSLinkElement(c,e,u);r.push({uri:c,element:p,disposables:u}),s.push(c.toString()),this.watcher.watch(c)}r.length>0&&(this.stylesheetsByExtension.set(e,r),this.cacheExtensionCSS(e,s))}removeStylesheets(i){let e=this.stylesheetsByExtension.get(i);if(e){for(let t of e)this.watcher.unwatch(t.uri),t.disposables.dispose();this.stylesheetsByExtension.delete(i)}}applyCachedCSS(){let i=this.getCachedCSS();if(!i)return;if(!this.isExtensionThemeActive(i.extensionId)){this.clearCacheForExtension(i.extensionId);return}let e=[];for(let t of i.cssLocations){let o=A.parse(t),n=new O,r=this.createCSSLinkElement(o,i.extensionId,n);e.push({uri:o,element:r,disposables:n}),this.watcher.watch(o)}e.length>0&&this.stylesheetsByExtension.set(i.extensionId,e)}getCachedCSS(){let i=this.storageService.get(Lbi,0);if(i)try{return JSON.parse(i)}catch{return}}cacheExtensionCSS(i,e){let t={extensionId:i,cssLocations:e};this.storageService.store(Lbi,JSON.stringify(t),0,1)}clearCacheForExtension(i){let e=this.getCachedCSS();e&&hi.equals(e.extensionId,i)&&this.storageService.remove(Lbi,0)}createCSSLinkElement(i,e,t){let o=Fbt();return o.rel="stylesheet",o.type="text/css",o.className=`extension-contributed-css ${e}`,o.href=In.uriToBrowserUri(i).toString(!0),t.add(ee(()=>o.remove())),o}reloadStylesheet(i){let e=i.toString();for(let t of this.stylesheetsByExtension.values())for(let o of t)if(o.uri.toString()===e){let n=In.uriToBrowserUri(i);o.element.href=n.with({query:`v=${Date.now()}`}).toString(!0)}}dispose(){this.disposables.dispose()}};R_e=I([m(0,ge),m(1,Od),m(2,ep),m(3,de)],R_e);var lYe=class a{constructor(i){this._proxyIdentifierBrand=void 0;this.sid=i,this.nid=++a.count}static{this.count=0}},Eso=[];function Ji(a){let i=new lYe(a);return Eso[i.nid]=i,i}function cYe(a){return Eso[a].sid}var Hg=class{constructor(i){this.value=i}};var Tso=class a{static{this._n=0}static mixin(i){return i._id=a._n++,i}};var Xi={MainThreadAuthentication:Ji("MainThreadAuthentication"),MainThreadBulkEdits:Ji("MainThreadBulkEdits"),MainThreadLanguageModels:Ji("MainThreadLanguageModels"),MainThreadEmbeddings:Ji("MainThreadEmbeddings"),MainThreadChatAgents2:Ji("MainThreadChatAgents2"),MainThreadCodeMapper:Ji("MainThreadCodeMapper"),MainThreadLanguageModelTools:Ji("MainThreadChatSkills"),MainThreadGitExtension:Ji("MainThreadGitExtension"),MainThreadClipboard:Ji("MainThreadClipboard"),MainThreadCommands:Ji("MainThreadCommands"),MainThreadComments:Ji("MainThreadComments"),MainThreadConfiguration:Ji("MainThreadConfiguration"),MainThreadConsole:Ji("MainThreadConsole"),MainThreadDebugService:Ji("MainThreadDebugService"),MainThreadDecorations:Ji("MainThreadDecorations"),MainThreadDiagnostics:Ji("MainThreadDiagnostics"),MainThreadDialogs:Ji("MainThreadDiaglogs"),MainThreadDocuments:Ji("MainThreadDocuments"),MainThreadDocumentContentProviders:Ji("MainThreadDocumentContentProviders"),MainThreadTextEditors:Ji("MainThreadTextEditors"),MainThreadEditorInsets:Ji("MainThreadEditorInsets"),MainThreadEditorTabs:Ji("MainThreadEditorTabs"),MainThreadErrors:Ji("MainThreadErrors"),MainThreadTreeViews:Ji("MainThreadTreeViews"),MainThreadDownloadService:Ji("MainThreadDownloadService"),MainThreadLanguageFeatures:Ji("MainThreadLanguageFeatures"),MainThreadLanguages:Ji("MainThreadLanguages"),MainThreadLogger:Ji("MainThreadLogger"),MainThreadMessageService:Ji("MainThreadMessageService"),MainThreadOutputService:Ji("MainThreadOutputService"),MainThreadProgress:Ji("MainThreadProgress"),MainThreadQuickDiff:Ji("MainThreadQuickDiff"),MainThreadDocumentDiff:Ji("MainThreadDocumentDiff"),MainThreadQuickOpen:Ji("MainThreadQuickOpen"),MainThreadStatusBar:Ji("MainThreadStatusBar"),MainThreadSecretState:Ji("MainThreadSecretState"),MainThreadStorage:Ji("MainThreadStorage"),MainThreadSpeech:Ji("MainThreadSpeechProvider"),MainThreadTelemetry:Ji("MainThreadTelemetry"),MainThreadMeteredConnection:Ji("MainThreadMeteredConnection"),MainThreadTerminalService:Ji("MainThreadTerminalService"),MainThreadTerminalShellIntegration:Ji("MainThreadTerminalShellIntegration"),MainThreadWebviews:Ji("MainThreadWebviews"),MainThreadWebviewPanels:Ji("MainThreadWebviewPanels"),MainThreadWebviewViews:Ji("MainThreadWebviewViews"),MainThreadCustomEditors:Ji("MainThreadCustomEditors"),MainThreadUrls:Ji("MainThreadUrls"),MainThreadUriOpeners:Ji("MainThreadUriOpeners"),MainThreadProfileContentHandlers:Ji("MainThreadProfileContentHandlers"),MainThreadWorkspace:Ji("MainThreadWorkspace"),MainThreadFileSystem:Ji("MainThreadFileSystem"),MainThreadFileSystemEventService:Ji("MainThreadFileSystemEventService"),MainThreadExtensionService:Ji("MainThreadExtensionService"),MainThreadSCM:Ji("MainThreadSCM"),MainThreadSearch:Ji("MainThreadSearch"),MainThreadShare:Ji("MainThreadShare"),MainThreadTask:Ji("MainThreadTask"),MainThreadWindow:Ji("MainThreadWindow"),MainThreadPower:Ji("MainThreadPower"),MainThreadLabelService:Ji("MainThreadLabelService"),MainThreadNotebook:Ji("MainThreadNotebook"),MainThreadNotebookDocuments:Ji("MainThreadNotebookDocumentsShape"),MainThreadNotebookEditors:Ji("MainThreadNotebookEditorsShape"),MainThreadNotebookKernels:Ji("MainThreadNotebookKernels"),MainThreadNotebookRenderers:Ji("MainThreadNotebookRenderers"),MainThreadInteractive:Ji("MainThreadInteractive"),MainThreadTheming:Ji("MainThreadTheming"),MainThreadTunnelService:Ji("MainThreadTunnelService"),MainThreadManagedSockets:Ji("MainThreadManagedSockets"),MainThreadTimeline:Ji("MainThreadTimeline"),MainThreadTesting:Ji("MainThreadTesting"),MainThreadLocalization:Ji("MainThreadLocalizationShape"),MainThreadMcp:Ji("MainThreadMcpShape"),MainThreadAiRelatedInformation:Ji("MainThreadAiRelatedInformation"),MainThreadAiEmbeddingVector:Ji("MainThreadAiEmbeddingVector"),MainThreadChatStatus:Ji("MainThreadChatStatus"),MainThreadChatInputNotification:Ji("MainThreadChatInputNotification"),MainThreadAiSettingsSearch:Ji("MainThreadAiSettingsSearch"),MainThreadDataChannels:Ji("MainThreadDataChannels"),MainThreadChatSessions:Ji("MainThreadChatSessions"),MainThreadChatOutputRenderer:Ji("MainThreadChatOutputRenderer"),MainThreadChatContext:Ji("MainThreadChatContext"),MainThreadChatDebug:Ji("MainThreadChatDebug"),MainThreadBrowsers:Ji("MainThreadBrowsers")},ao={ExtHostCodeMapper:Ji("ExtHostCodeMapper"),ExtHostCommands:Ji("ExtHostCommands"),ExtHostConfiguration:Ji("ExtHostConfiguration"),ExtHostDiagnostics:Ji("ExtHostDiagnostics"),ExtHostDebugService:Ji("ExtHostDebugService"),ExtHostDecorations:Ji("ExtHostDecorations"),ExtHostDocumentsAndEditors:Ji("ExtHostDocumentsAndEditors"),ExtHostDocuments:Ji("ExtHostDocuments"),ExtHostDocumentContentProviders:Ji("ExtHostDocumentContentProviders"),ExtHostDocumentSaveParticipant:Ji("ExtHostDocumentSaveParticipant"),ExtHostEditors:Ji("ExtHostEditors"),ExtHostTreeViews:Ji("ExtHostTreeViews"),ExtHostFileSystem:Ji("ExtHostFileSystem"),ExtHostFileSystemInfo:Ji("ExtHostFileSystemInfo"),ExtHostFileSystemEventService:Ji("ExtHostFileSystemEventService"),ExtHostLanguages:Ji("ExtHostLanguages"),ExtHostLanguageFeatures:Ji("ExtHostLanguageFeatures"),ExtHostQuickOpen:Ji("ExtHostQuickOpen"),ExtHostQuickDiff:Ji("ExtHostQuickDiff"),ExtHostStatusBar:Ji("ExtHostStatusBar"),ExtHostShare:Ji("ExtHostShare"),ExtHostExtensionService:Ji("ExtHostExtensionService"),ExtHostLogLevelServiceShape:Ji("ExtHostLogLevelServiceShape"),ExtHostTerminalService:Ji("ExtHostTerminalService"),ExtHostTerminalShellIntegration:Ji("ExtHostTerminalShellIntegration"),ExtHostSCM:Ji("ExtHostSCM"),ExtHostSearch:Ji("ExtHostSearch"),ExtHostTask:Ji("ExtHostTask"),ExtHostWorkspace:Ji("ExtHostWorkspace"),ExtHostWindow:Ji("ExtHostWindow"),ExtHostPower:Ji("ExtHostPower"),ExtHostWebviews:Ji("ExtHostWebviews"),ExtHostWebviewPanels:Ji("ExtHostWebviewPanels"),ExtHostCustomEditors:Ji("ExtHostCustomEditors"),ExtHostWebviewViews:Ji("ExtHostWebviewViews"),ExtHostEditorInsets:Ji("ExtHostEditorInsets"),ExtHostEditorTabs:Ji("ExtHostEditorTabs"),ExtHostProgress:Ji("ExtHostProgress"),ExtHostComments:Ji("ExtHostComments"),ExtHostSecretState:Ji("ExtHostSecretState"),ExtHostStorage:Ji("ExtHostStorage"),ExtHostUrls:Ji("ExtHostUrls"),ExtHostUriOpeners:Ji("ExtHostUriOpeners"),ExtHostChatOutputRenderer:Ji("ExtHostChatOutputRenderer"),ExtHostProfileContentHandlers:Ji("ExtHostProfileContentHandlers"),ExtHostOutputService:Ji("ExtHostOutputService"),ExtHostLabelService:Ji("ExtHostLabelService"),ExtHostNotebook:Ji("ExtHostNotebook"),ExtHostNotebookDocuments:Ji("ExtHostNotebookDocuments"),ExtHostNotebookEditors:Ji("ExtHostNotebookEditors"),ExtHostNotebookKernels:Ji("ExtHostNotebookKernels"),ExtHostNotebookRenderers:Ji("ExtHostNotebookRenderers"),ExtHostNotebookDocumentSaveParticipant:Ji("ExtHostNotebookDocumentSaveParticipant"),ExtHostInteractive:Ji("ExtHostInteractive"),ExtHostChatAgents2:Ji("ExtHostChatAgents"),ExtHostLanguageModelTools:Ji("ExtHostChatSkills"),ExtHostChatProvider:Ji("ExtHostChatProvider"),ExtHostChatContext:Ji("ExtHostChatContext"),ExtHostChatDebug:Ji("ExtHostChatDebug"),ExtHostSpeech:Ji("ExtHostSpeech"),ExtHostEmbeddings:Ji("ExtHostEmbeddings"),ExtHostAiRelatedInformation:Ji("ExtHostAiRelatedInformation"),ExtHostAiEmbeddingVector:Ji("ExtHostAiEmbeddingVector"),ExtHostAiSettingsSearch:Ji("ExtHostAiSettingsSearch"),ExtHostTheming:Ji("ExtHostTheming"),ExtHostTunnelService:Ji("ExtHostTunnelService"),ExtHostManagedSockets:Ji("ExtHostManagedSockets"),ExtHostAuthentication:Ji("ExtHostAuthentication"),ExtHostTimeline:Ji("ExtHostTimeline"),ExtHostTesting:Ji("ExtHostTesting"),ExtHostTelemetry:Ji("ExtHostTelemetry"),ExtHostMeteredConnection:Ji("ExtHostMeteredConnection"),ExtHostLocalization:Ji("ExtHostLocalization"),ExtHostMcp:Ji("ExtHostMcp"),ExtHostDataChannels:Ji("ExtHostDataChannels"),ExtHostChatSessions:Ji("ExtHostChatSessions"),ExtHostGitExtension:Ji("ExtHostGitExtension"),ExtHostBrowsers:Ji("ExtHostBrowsers")};function fo(a){return function(i){M_e.INSTANCE.registerNamedCustomer(a,i)}}function RM(a){M_e.INSTANCE.registerCustomer(a)}var TMt;(e=>{function a(){return M_e.INSTANCE.getNamedCustomers()}e.getNamedCustomers=a;function i(){return M_e.INSTANCE.getCustomers()}e.getCustomers=i})(TMt||={});var M_e=class a{static{this.INSTANCE=new a}constructor(){this._namedCustomers=[],this._customers=[]}registerNamedCustomer(i,e){let t=[i,e];this._namedCustomers.push(t)}getNamedCustomers(){return this._namedCustomers}registerCustomer(i){this._customers.push(i)}getCustomers(){return this._customers}};function pZ(a){return a.tags.find(i=>i.startsWith("lp-"))?.split("lp-")[1]}var m3=le("languagePackService"),_Mt=class extends k{constructor(e){super();this.extensionGalleryService=e}async getAvailableLanguages(){let e=new qe;setTimeout(()=>e.cancel(),1e3);let t;try{t=await this.extensionGalleryService.query({text:'category:"language packs"',pageSize:20},e.token)}catch{return[]}let n=t.firstPage.filter(r=>r.properties.localizedLanguages?.length&&r.tags.some(s=>s.startsWith("lp-"))).map(r=>{let s=r.properties.localizedLanguages?.[0],l=pZ(r);return{...this.createQuickPickItem(l,s,r),extensionId:r.identifier.id,galleryExtension:r}});return n.push(this.createQuickPickItem("en","English")),n}createQuickPickItem(e,t,o){let n=t??e,r;if(n!==e&&(r=`(${e})`),e.toLowerCase()===Kr.toLowerCase()&&(r??="",r+=d(2374,null)),o?.installCount){r??="";let s=o.installCount,l;s>1e6?l=`${Math.floor(s/1e5)/10}M`:s>1e3?l=`${Math.floor(s/1e3)}K`:l=String(s),r+=` $(cloud-download) ${l}`}return{id:e,label:n,description:r}}};_Mt=I([m(0,ga)],_Mt);var DMt=class extends k{constructor(e,t,o){super();this.fileService=t;this.languagePackService=o}async $fetchBuiltInBundleUri(e,t){try{return await this.languagePackService.getBuiltInExtensionTranslationsUri(e,t)}catch{return}}async $fetchBundleContents(e){return(await this.fileService.readFile(A.revive(e))).value.toString()}};DMt=I([fo(Xi.MainThreadLocalization),m(1,ge),m(2,m3)],DMt);var en={EditorPane:"workbench.contributions.editors",EditorFactory:"workbench.contributions.editor.inputFactories"},Da={id:"default",displayName:d(5550,null),providerDisplayName:d(5547,null)},_so="workbench.editor.sidebysideEditor",hZ="workbench.editors.textDiffEditor",RMt="workbench.editors.binaryResourceDiffEditor";function bpe(a){let i=a;return!!i&&typeof i.getSelection=="function"&&!!i.onDidChangeSelection}function LMt(a){let i=a;return!!i&&typeof i.getScrollPosition=="function"&&typeof i.setScrollPosition=="function"&&!!i.onDidChangeScroll}function h3(a,i,e){for(let t of e.visibleEditorPanes)if(t.group.id===i&&a.matches(t.input))return t.getViewState()}function zg(a){if(ya(a))return!1;let i=a;return A.isUri(i?.resource)}function Ug(a){if(ya(a))return!1;let i=a;return i?.original!==void 0&&i.modified!==void 0}function mZ(a){if(ya(a))return!1;let i=a;return!i||i.resources&&!Array.isArray(i.resources)?!1:!!i.resources||!!i.multiDiffSource}function GD(a){if(ya(a)||Ug(a))return!1;let i=a;return i?.primary!==void 0&&i.secondary!==void 0}function P_e(a){if(ya(a))return!1;let i=a;return i?i.resource===void 0||i.resource.scheme===Q.untitled||i.forceUntitled===!0:!1}function Xy(a){if(ya(a))return!1;let i=a;return A.isUri(i?.base?.resource)&&A.isUri(i?.input1?.resource)&&A.isUri(i?.input2?.resource)&&A.isUri(i?.result?.resource)}var Pbi=class{constructor(){this.mapIdToSaveSource=new Map}registerSource(i,e){let t=this.mapIdToSaveSource.get(i);return t||(t={source:i,label:e},this.mapIdToSaveSource.set(i,t)),t.source}getSourceLabel(i){return this.mapIdToSaveSource.get(i)?.label??i}},Qh=new Pbi;var dYe=class extends k{};function ya(a){return a instanceof dYe}function W9o(a){let i=a;return A.isUri(i?.preferredResource)}function Obi(a){let i=a;return ya(i?.primary)&&ya(i?.secondary)}function qD(a){let i=a;return ya(i?.modified)&&ya(i?.original)}function A_e(a,i,e,t,o){return b3(t,[li({id:"workbench.action.openLargeFile",label:d(5549,null),run:()=>{let n={...e,limits:{size:Number.MAX_VALUE}};a.openEditor(i,n)}}),li({id:"workbench.action.configureEditorLargeFileConfirmation",label:d(5548,null),run:()=>o.openUserSettings({query:"workbench.editorLargeFileConfirmation"})})],{forceMessage:!0,forceSeverity:wt.Warning})}function D0(a){return ya(a?.editor)}function g3(a){let i=a;return D0(a)&&i?.group!==void 0}function uYe(a){let i=a;return typeof i?.groupId=="number"&&ya(i.editor)}function Spe(a){return typeof a?.groupId=="number"}var Abi=class{getOriginalUri(i,e){if(!i)return;if(Xy(i))return po.getOriginalUri(i.result,e);if(e?.supportSideBySide){let{primary:o,secondary:n}=this.getSideEditors(i);if(o&&n){if(e?.supportSideBySide===3)return{primary:this.getOriginalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getOriginalUri(n,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getOriginalUri(o,{filterByScheme:e.filterByScheme})??this.getOriginalUri(n,{filterByScheme:e.filterByScheme});i=e.supportSideBySide===1?o:n}}if(Ug(i)||mZ(i)||GD(i)||Xy(i))return;let t=W9o(i)?i.preferredResource:i.resource;return!t||!e?.filterByScheme?t:this.filterUri(t,e.filterByScheme)}getSideEditors(i){return Obi(i)||GD(i)?{primary:i.primary,secondary:i.secondary}:qD(i)||Ug(i)?{primary:i.modified,secondary:i.original}:{primary:void 0,secondary:void 0}}getCanonicalUri(i,e){if(!i)return;if(Xy(i))return po.getCanonicalUri(i.result,e);if(e?.supportSideBySide){let{primary:o,secondary:n}=this.getSideEditors(i);if(o&&n){if(e?.supportSideBySide===3)return{primary:this.getCanonicalUri(o,{filterByScheme:e.filterByScheme}),secondary:this.getCanonicalUri(n,{filterByScheme:e.filterByScheme})};if(e?.supportSideBySide===4)return this.getCanonicalUri(o,{filterByScheme:e.filterByScheme})??this.getCanonicalUri(n,{filterByScheme:e.filterByScheme});i=e.supportSideBySide===1?o:n}}if(Ug(i)||mZ(i)||GD(i)||Xy(i))return;let t=i.resource;return!t||!e?.filterByScheme?t:this.filterUri(t,e.filterByScheme)}filterUri(i,e){if(Array.isArray(e)){if(e.some(t=>i.scheme===t))return i}else if(e===i.scheme)return i}};function N_e(a,i,e,t){if(!a.isSticky(i))return!1;switch(t.preventPinnedEditorClose){case"keyboardAndMouse":return e===2||e===1;case"mouse":return e===2;case"keyboard":return e===1}return!1}var po=new Abi;var Nbi=class{constructor(){this.editorSerializerConstructors=new Map;this.editorSerializerInstances=new Map}start(i){let e=this.instantiationService=i.get(F);for(let[t,o]of this.editorSerializerConstructors)this.createEditorSerializer(t,o,e);this.editorSerializerConstructors.clear()}createEditorSerializer(i,e,t){let o=t.createInstance(e);this.editorSerializerInstances.set(i,o)}registerFileEditorFactory(i){if(this.fileEditorFactory)throw new Error("Can only register one file editor factory.");this.fileEditorFactory=i}getFileEditorFactory(){return Ti(this.fileEditorFactory)}registerEditorSerializer(i,e){if(this.editorSerializerConstructors.has(i)||this.editorSerializerInstances.has(i))throw new Error(`A editor serializer with type ID '${i}' was already registered.`);return this.instantiationService?this.createEditorSerializer(i,e,this.instantiationService):this.editorSerializerConstructors.set(i,e),ee(()=>{this.editorSerializerConstructors.delete(i),this.editorSerializerInstances.delete(i)})}getEditorSerializer(i){return this.editorSerializerInstances.get(typeof i=="string"?i:i.typeId)}};oe.add(en.EditorFactory,new Nbi);async function O_e(a,i,e){return a?.length?await Promise.all(a.map(async t=>{let o=A.revive(t.fileUri);if(!o){e.info("Cannot resolve the path because it is not valid.",t);return}if(!await i.canHandleResource(o)){e.info("Cannot resolve the path because it cannot be handled",t);return}let r=t.exists,s=t.type;if(typeof r!="boolean"||typeof s!="number")try{s=(await i.stat(o)).isDirectory?2:0,r=!0}catch(c){e.error(c),r=!1}if(!r&&t.openOnlyIfExists){e.info("Cannot resolve the path because it does not exist",t);return}if(s===2){e.info("Cannot resolve the path because it is a directory",t);return}let l={...t.options,pinned:!0};return r?{resource:o,options:l}:{resource:o,options:l,forceUntitled:!0}})):[]}function f3(a){let i=a;if(!i)return!1;let e=i;if(e.modified)return f3(e.modified);let t=i;return!!(t.contributionsState&&t.viewState&&Array.isArray(t.cursorState))}function v3(a){return RY(a)}function b3(a,i,e){let t=Rz(a,i);return t.forceMessage=e?.forceMessage,t.forceSeverity=e?.forceSeverity,t.allowDialog=e?.allowDialog,t}var kn=le("notebookService"),LM=class{constructor(i,e,t){this.viewType=i;this.serializer=e;this.extensionData=t}};var Yh=le("INotebookModelResolverService");var Ls=class extends dYe{constructor(){super(...arguments);this._onDidChangeDirty=this._register(new T);this._onDidChangeLabel=this._register(new T);this._onDidChangeCapabilities=this._register(new T);this._onWillDispose=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this.onDidChangeLabel=this._onDidChangeLabel.event;this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this.onWillDispose=this._onWillDispose.event}get editorId(){}get capabilities(){return 2}hasCapability(e){return e===0?this.capabilities===0:(this.capabilities&e)!==0}isReadonly(){return this.hasCapability(2)}getName(){return`Editor ${this.typeId}`}getDescription(e){}getTitle(e){return this.getName()}getLabelExtraClasses(){return[]}getAriaLabel(){return this.getTitle(0)}getIcon(){}getTelemetryDescriptor(){return{typeId:this.typeId}}isDirty(){return!1}isModified(){return this.isDirty()}isSaving(){return!1}async resolve(){return null}async save(e,t){return this}async saveAs(e,t){return this}async revert(e,t){}async rename(e,t){}copy(){return this}canMove(e,t){return!0}canReopen(){return!0}matches(e){if(ya(e))return this===e;let t=e.options?.override;return this.editorId!==t&&t!==void 0&&this.editorId!==void 0?!1:ze(this.resource,po.getCanonicalUri(e))}prefersEditorPane(e){return e.at(0)}toUntyped(e){}isDisposed(){return this._store.isDisposed}dispose(){this.isDisposed()||this._onWillDispose.fire(),super.dispose()}};var qI=class extends k{constructor(e,t,o,n){super();this.getExpression=e;this.shouldUpdate=t;this.contextService=o;this.configurationService=n;this._onExpressionChange=this._register(new T);this.onExpressionChange=this._onExpressionChange.event;this.mapFolderToParsedExpression=new Map;this.mapFolderToConfiguredExpression=new Map;this.updateExpressions(!1),this.registerListeners()}static{this.NO_FOLDER=null}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{this.shouldUpdate(e)&&this.updateExpressions(!0)})),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.updateExpressions(!0)))}updateExpressions(e){let t=!1;for(let s of this.contextService.getWorkspace().folders){let l=s.uri.toString(),c=this.doGetExpression(s.uri),u=this.mapFolderToConfiguredExpression.get(l);c?(!u||!Qi(u.expression,c.expression))&&(t=!0,this.mapFolderToParsedExpression.set(l,Eh(c.expression)),this.mapFolderToConfiguredExpression.set(l,c)):u&&(t=!0,this.mapFolderToParsedExpression.delete(l),this.mapFolderToConfiguredExpression.delete(l))}let o=new xn(this.contextService.getWorkspace().folders.map(s=>s.uri));for(let[s]of this.mapFolderToConfiguredExpression)s!==qI.NO_FOLDER&&(o.has(A.parse(s))||(this.mapFolderToParsedExpression.delete(s),this.mapFolderToConfiguredExpression.delete(s),t=!0));let n=this.doGetExpression(void 0),r=this.mapFolderToConfiguredExpression.get(qI.NO_FOLDER);n?(!r||!Qi(r.expression,n.expression))&&(t=!0,this.mapFolderToParsedExpression.set(qI.NO_FOLDER,Eh(n.expression)),this.mapFolderToConfiguredExpression.set(qI.NO_FOLDER,n)):r&&(t=!0,this.mapFolderToParsedExpression.delete(qI.NO_FOLDER),this.mapFolderToConfiguredExpression.delete(qI.NO_FOLDER)),e&&t&&this._onExpressionChange.fire()}doGetExpression(e){let t=this.getExpression(e);if(!t)return;let o=Object.keys(t);if(o.length===0)return;let n=!1,r=Object.create(null);for(let s of o){n||(n=Jl(s));let l=s,c=n8i(l,!0);if(c){let u=c.toLowerCase();c!==c.toLowerCase()&&(l=`${u}${l.substring(1)}`)}r[l]=t[s]}return{expression:r,hasAbsolutePath:n}}matches(e,t){if(this.mapFolderToParsedExpression.size===0)return!1;let o=this.contextService.getWorkspaceFolder(e),n,r;if(o&&this.mapFolderToParsedExpression.has(o.uri.toString())?(n=this.mapFolderToParsedExpression.get(o.uri.toString()),r=this.mapFolderToConfiguredExpression.get(o.uri.toString())):(n=this.mapFolderToParsedExpression.get(qI.NO_FOLDER),r=this.mapFolderToConfiguredExpression.get(qI.NO_FOLDER)),!n)return!1;let s;return o?s=lu(o.uri,e):s=this.uriToPath(e),typeof s=="string"&&n(s,void 0,t)?!0:s!==this.uriToPath(e)&&r?.hasAbsolutePath?!!n(this.uriToPath(e),void 0,t):!1}uriToPath(e){return e.scheme===Q.file?e.fsPath:e.path}};qI=I([m(2,Ae),m(3,B)],qI);var pYe=new Y("autoSaveAfterShortDelayContext",!1,!0);var fr=le("filesConfigurationService"),$D=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=t;this.contextService=o;this.environmentService=n;this.uriIdentityService=r;this.fileService=s;this.markerService=l;this.textResourceConfigurationService=c;this._onDidChangeAutoSaveConfiguration=this._register(new T);this.onDidChangeAutoSaveConfiguration=this._onDidChangeAutoSaveConfiguration.event;this._onDidChangeAutoSaveDisabled=this._register(new T);this.onDidChangeAutoSaveDisabled=this._onDidChangeAutoSaveDisabled.event;this._onDidChangeFilesAssociation=this._register(new T);this.onDidChangeFilesAssociation=this._onDidChangeFilesAssociation.event;this._onDidChangeReadonly=this._register(new T);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.autoSaveConfigurationCache=new Ua(1e3);this.autoSaveAfterShortDelayOverrides=new dt;this.autoSaveDisabledOverrides=new dt;this.readonlyIncludeMatcher=this._register(new i5(()=>this.createReadonlyMatcher(Kyt)));this.readonlyExcludeMatcher=this._register(new i5(()=>this.createReadonlyMatcher(Gyt)));this.sessionReadonlyOverrides=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.autoSaveAfterShortDelayContext=pYe.bindTo(e);let u=t.getValue();this.currentGlobalAutoSaveConfiguration=this.computeAutoSaveConfiguration(void 0,u.files),this.currentFilesAssociationConfiguration=u?.files?.associations,this.currentHotExitConfiguration=u?.files?.hotExit||PI.ON_EXIT,this.onFilesConfigurationChange(u,!1),this.registerListeners()}static{this.DEFAULT_AUTO_SAVE_MODE=Ft?Qv.AFTER_DELAY:Qv.OFF}static{this.DEFAULT_AUTO_SAVE_DELAY=1e3}static{this.READONLY_MESSAGES={providerReadonly:{value:d(19085,null),isTrusted:!0},sessionReadonly:{value:d(19086,null,"workbench.action.files.setActiveEditorWriteableInSession"),isTrusted:!0},configuredReadonly:{value:d(19082,null,`workbench.action.openSettings?${encodeURIComponent('["files.readonly"]')}`,"workbench.action.files.toggleActiveEditorReadonlyInSession"),isTrusted:!0},fileLocked:{value:d(19083,null,"workbench.action.files.setActiveEditorWriteableInSession"),isTrusted:!0},fileReadonly:{value:d(19084,null),isTrusted:!0}}}createReadonlyMatcher(e){let t=this._register(new qI(o=>this.configurationService.getValue(e,{resource:o}),o=>o.affectsConfiguration(e),this.contextService,this.configurationService));return this._register(t.onExpressionChange(()=>this._onDidChangeReadonly.fire())),t}isReadonly(e,t){let o=this.fileService.getProvider(e.scheme);if(o&&IYi(o))return o.readOnlyMessage??$D.READONLY_MESSAGES.providerReadonly;let n=this.sessionReadonlyOverrides.get(e);return typeof n=="boolean"?n===!0?$D.READONLY_MESSAGES.sessionReadonly:!1:this.uriIdentityService.extUri.isEqualOrParent(e,this.environmentService.userRoamingDataHome)||this.uriIdentityService.extUri.isEqual(e,this.contextService.getWorkspace().configuration??void 0)?!1:this.readonlyIncludeMatcher.value.matches(e)?this.readonlyExcludeMatcher.value.matches(e)?!1:$D.READONLY_MESSAGES.configuredReadonly:this.configuredReadonlyFromPermissions&&t?.locked?$D.READONLY_MESSAGES.fileLocked:t?.readonly?$D.READONLY_MESSAGES.fileReadonly:!1}async updateReadonly(e,t){if(Array.isArray(e)){for(let o of e)this.applyReadonly(o,t);e.length>0&&this._onDidChangeReadonly.fire();return}if(t==="toggle"){let o;try{o=await this.fileService.resolve(e,{resolveMetadata:!0})}catch{}t=!this.isReadonly(e,o)}this.applyReadonly(e,t),this._onDidChangeReadonly.fire()}applyReadonly(e,t){t==="reset"?this.sessionReadonlyOverrides.delete(e):this.sessionReadonlyOverrides.set(e,t)}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("files")&&this.onFilesConfigurationChange(this.configurationService.getValue(),!0)}))}onFilesConfigurationChange(e,t){this.currentGlobalAutoSaveConfiguration=this.computeAutoSaveConfiguration(void 0,e.files),this.autoSaveConfigurationCache.clear(),this.autoSaveAfterShortDelayContext.set(this.getAutoSaveMode(void 0).mode===1),t&&this._onDidChangeAutoSaveConfiguration.fire();let o=e?.files?.associations;Qi(this.currentFilesAssociationConfiguration,o)||(this.currentFilesAssociationConfiguration=o,t&&this._onDidChangeFilesAssociation.fire());let n=e?.files?.hotExit;n===PI.OFF||n===PI.ON_EXIT_AND_WINDOW_CLOSE?this.currentHotExitConfiguration=n:this.currentHotExitConfiguration=PI.ON_EXIT;let r=!!e?.files?.readonlyFromPermissions;r!==!!this.configuredReadonlyFromPermissions&&(this.configuredReadonlyFromPermissions=r,t&&this._onDidChangeReadonly.fire())}getAutoSaveConfiguration(e){let t=this.toResource(e);if(t){let o=this.autoSaveConfigurationCache.get(t);return o||(o=this.computeAutoSaveConfiguration(t,this.textResourceConfigurationService.getValue(t,"files")),this.autoSaveConfigurationCache.set(t,o)),o}return this.currentGlobalAutoSaveConfiguration}computeAutoSaveConfiguration(e,t){let o,n,r,s,l,c;switch(t?.autoSave??$D.DEFAULT_AUTO_SAVE_MODE){case Qv.AFTER_DELAY:{o="afterDelay",n=typeof t?.autoSaveDelay=="number"&&t.autoSaveDelay>=0?t.autoSaveDelay:$D.DEFAULT_AUTO_SAVE_DELAY,c=n<=$D.DEFAULT_AUTO_SAVE_DELAY;break}case Qv.ON_FOCUS_CHANGE:o="onFocusChange";break;case Qv.ON_WINDOW_CHANGE:o="onWindowChange";break}return t?.autoSaveWorkspaceFilesOnly===!0&&(r=!0,e&&!this.contextService.isInsideWorkspace(e)&&(l=!0,c=void 0)),t?.autoSaveWhenNoErrors===!0&&(s=!0,c=void 0),{autoSave:o,autoSaveDelay:n,autoSaveWorkspaceFilesOnly:r,autoSaveWhenNoErrors:s,isOutOfWorkspace:l,isShortAutoSaveDelay:c}}toResource(e){return e instanceof Ls?po.getOriginalUri(e,{supportSideBySide:1}):e}hasShortAutoSaveDelay(e){let t=this.toResource(e);return t&&this.autoSaveAfterShortDelayOverrides.has(t)?!0:this.getAutoSaveConfiguration(t).isShortAutoSaveDelay?!t||!this.autoSaveDisabledOverrides.has(t):!1}getAutoSaveMode(e,t){let o=this.toResource(e);if(o&&this.autoSaveAfterShortDelayOverrides.has(o))return{mode:1};if(o&&this.autoSaveDisabledOverrides.has(o))return{mode:0,reason:4};let n=this.getAutoSaveConfiguration(o);if(typeof n.autoSave>"u")return{mode:0,reason:1};if(typeof t=="number"&&(n.autoSave==="afterDelay"&&t!==2||n.autoSave==="onFocusChange"&&t!==3&&t!==4||n.autoSave==="onWindowChange"&&t!==4))return{mode:0,reason:1};if(o){if(n.autoSaveWorkspaceFilesOnly&&n.isOutOfWorkspace)return{mode:0,reason:2};if(n.autoSaveWhenNoErrors&&this.markerService.read({resource:o,take:1,severities:8}).length>0)return{mode:0,reason:3}}switch(n.autoSave){case"afterDelay":return typeof n.autoSaveDelay=="number"&&n.autoSaveDelay<=$D.DEFAULT_AUTO_SAVE_DELAY?{mode:n.autoSaveWhenNoErrors?2:1}:{mode:2};case"onFocusChange":return{mode:3};case"onWindowChange":return{mode:4}}}async toggleAutoSave(){let e=this.configurationService.getValue("files.autoSave"),t;return[Qv.AFTER_DELAY,Qv.ON_FOCUS_CHANGE,Qv.ON_WINDOW_CHANGE].some(o=>o===e)?t=Qv.OFF:t=Qv.AFTER_DELAY,this.configurationService.updateValue("files.autoSave",t)}enableAutoSaveAfterShortDelay(e){let t=this.toResource(e);if(!t)return k.None;let o=this.autoSaveAfterShortDelayOverrides.get(t)??0;return this.autoSaveAfterShortDelayOverrides.set(t,o+1),ee(()=>{let n=this.autoSaveAfterShortDelayOverrides.get(t)??0;n<=1?this.autoSaveAfterShortDelayOverrides.delete(t):this.autoSaveAfterShortDelayOverrides.set(t,n-1)})}disableAutoSave(e){let t=this.toResource(e);if(!t)return k.None;let o=this.autoSaveDisabledOverrides.get(t)??0;return this.autoSaveDisabledOverrides.set(t,o+1),o===0&&this._onDidChangeAutoSaveDisabled.fire(t),ee(()=>{let n=this.autoSaveDisabledOverrides.get(t)??0;n<=1?(this.autoSaveDisabledOverrides.delete(t),this._onDidChangeAutoSaveDisabled.fire(t)):this.autoSaveDisabledOverrides.set(t,n-1)})}get isHotExitEnabled(){return this.contextService.getWorkspace().transient?!1:this.currentHotExitConfiguration!==PI.OFF}get hotExitConfiguration(){return this.currentHotExitConfiguration}preventSaveConflicts(e,t){return this.configurationService.getValue("files.saveConflictResolution",{resource:e,overrideIdentifier:t})!=="overwriteFileOnDisk"}};$D=I([m(0,X),m(1,B),m(2,Ae),m(3,ko),m(4,gt),m(5,ge),m(6,ha),m(7,Gn)],$D);Ce(fr,$D,0);var XA=class extends k{constructor(e,t){super();this.configurationService=e;this.workspaceContextService=t;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.patterns=[];this.enabled=!0;this.cache=new Cvt(1e3);this._templateRegexValidation=/[a-zA-Z0-9]/;this._parsedTemplateExpression=/\$\{(dirname|filename|extname|extname\((?<extnameN>[-+]?\d+)\)|dirname\((?<dirnameN>[-+]?\d+)\))\}/g;this._filenameCaptureExpression=/(?<filename>^\.*[^.]*)/;this.storeEnablementState(),this.storeCustomPatterns(),this.registerListeners()}static{this.SETTING_ID_PATTERNS="workbench.editor.customLabels.patterns"}static{this.SETTING_ID_ENABLED="workbench.editor.customLabels.enabled"}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration(XA.SETTING_ID_ENABLED)){let t=this.enabled;this.storeEnablementState(),t!==this.enabled&&this.patterns.length>0&&this._onDidChange.fire()}else e.affectsConfiguration(XA.SETTING_ID_PATTERNS)&&(this.cache.clear(),this.storeCustomPatterns(),this._onDidChange.fire())}))}storeEnablementState(){this.enabled=this.configurationService.getValue(XA.SETTING_ID_ENABLED)}storeCustomPatterns(){this.patterns=[];let e=this.configurationService.getValue(XA.SETTING_ID_PATTERNS);for(let t in e){let o=e[t];if(!this._templateRegexValidation.test(o))continue;let n=Jl(t),r=Eh(t,{ignoreCase:!0});this.patterns.push({pattern:t,template:o,isAbsolutePath:n,parsedPattern:r})}this.patterns.sort((t,o)=>this.patternWeight(o.pattern)-this.patternWeight(t.pattern))}patternWeight(e){let t=0;for(let o of e.split("/"))o==="**"?t+=1:o==="*"?t+=10:o.includes("*")||o.includes("?")?t+=50:o!==""&&(t+=100);return t}getName(e){if(!this.enabled||this.patterns.length===0)return;let t=e.toString(),o=this.cache.get(t);if(o!==void 0)return o??void 0;let n=this.applyPatterns(e);return this.cache.set(t,n??null),n}applyPatterns(e){let t=this.workspaceContextService.getWorkspaceFolder(e),o;for(let n of this.patterns){let r;if(t&&!n.isAbsolutePath?(o||(o=lu(ai(t.uri),e)??e.path),r=o):r=e.path,n.parsedPattern(r))return this.applyTemplate(n.template,e,r)}}applyTemplate(e,t,o){let n;return e.replace(this._parsedTemplateExpression,(r,s,...l)=>{n=n??jj(t.path);let{dirnameN:c="0",extnameN:u="0"}=l.pop();if(s==="filename"){let{filename:p}=this._filenameCaptureExpression.exec(n.base)?.groups??{};if(p)return p}else if(s==="extname"){let p=this.getExtnames(n.base);if(p)return p}else if(s.startsWith("extname")){let p=parseInt(u),h=this.getNthExtname(n.base,p);if(h)return h}else if(s.startsWith("dirname")){let p=parseInt(c),h=this.getNthDirname(yd(o),p);if(h)return h}return r})}removeLeadingDot(e){let t=e;for(;t.startsWith(".");)t=t.slice(1);return t}getNthDirname(e,t){e=e.startsWith("/")?e.slice(1):e;let o=e.split("/");return this.getNthFragment(o,t)}getExtnames(e){return this.removeLeadingDot(e).split(".").slice(1).join(".")}getNthExtname(e,t){let o=this.removeLeadingDot(e).split(".");return o.shift(),this.getNthFragment(o,t)}getNthFragment(e,t){let o=e.length,n;t<0?n=Math.abs(t)-1:n=o-t-1;let r=e[n];if(!(r===void 0||r===""))return r}};XA=I([m(0,B),m(1,Ae)],XA);var nb=le("ICustomEditorLabelService");Ce(nb,XA,1);var gZ=class extends Ls{constructor(e,t,o,n,r,s,l){super();this.resource=e;this.labelService=o;this.fileService=n;this.filesConfigurationService=r;this.textResourceConfigurationService=s;this.customEditorLabelService=l;this._name=void 0;this._shortDescription=void 0;this._mediumDescription=void 0;this._longDescription=void 0;this._shortTitle=void 0;this._mediumTitle=void 0;this._longTitle=void 0;this._preferredResource=t||e,this.registerListeners()}get capabilities(){let e=32;return this.fileService.hasProvider(this.resource)?this.filesConfigurationService.isReadonly(this.resource)&&(e|=2):e|=4,e&2||(e|=128),e}get preferredResource(){return this._preferredResource}registerListeners(){this._register(this.labelService.onDidChangeFormatters(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onLabelEvent(e.scheme))),this._register(this.customEditorLabelService.onDidChange(()=>this.updateLabel())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire()))}onLabelEvent(e){e===this._preferredResource.scheme&&this.updateLabel()}updateLabel(){this._name=void 0,this._shortDescription=void 0,this._mediumDescription=void 0,this._longDescription=void 0,this._shortTitle=void 0,this._mediumTitle=void 0,this._longTitle=void 0,this._onDidChangeLabel.fire()}setPreferredResource(e){ze(e,this._preferredResource)||(this._preferredResource=e,this.updateLabel())}getName(){return typeof this._name!="string"&&(this._name=this.customEditorLabelService.getName(this._preferredResource)??this.labelService.getUriBasenameLabel(this._preferredResource)),this._name}getDescription(e=1){switch(e){case 0:return this.shortDescription;case 2:return this.longDescription;case 1:default:return this.mediumDescription}}get shortDescription(){return typeof this._shortDescription!="string"&&(this._shortDescription=this.labelService.getUriBasenameLabel(ai(this._preferredResource))),this._shortDescription}get mediumDescription(){return typeof this._mediumDescription!="string"&&(this._mediumDescription=this.labelService.getUriLabel(ai(this._preferredResource),{relative:!0})),this._mediumDescription}get longDescription(){return typeof this._longDescription!="string"&&(this._longDescription=this.labelService.getUriLabel(ai(this._preferredResource))),this._longDescription}get shortTitle(){return typeof this._shortTitle!="string"&&(this._shortTitle=this.getName()),this._shortTitle}get mediumTitle(){return typeof this._mediumTitle!="string"&&(this._mediumTitle=this.labelService.getUriLabel(this._preferredResource,{relative:!0})),this._mediumTitle}get longTitle(){return typeof this._longTitle!="string"&&(this._longTitle=this.labelService.getUriLabel(this._preferredResource)),this._longTitle}getTitle(e){switch(e){case 0:return this.shortTitle;case 2:return this.longTitle;default:case 1:return this.mediumTitle}}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource)}ensureLimits(e){if(e?.limits)return e.limits;let t=qyt(this.resource),o,n=this.textResourceConfigurationService.inspect(this.resource,null,"workbench.editorLargeFileConfirmation");return m5(n)&&(o=n.value*Ml.MB),{size:o??t}}};gZ=I([m(2,nt),m(3,ge),m(4,fr),m(5,Gn),m(6,nb)],gZ);var kt=le("editorGroupsService");function Fbi(a){let i=a;return ya(i?.editor)&&ya(i?.replacement)}function Ipe(a){let i=a;return!!i&&typeof i.id=="number"&&Array.isArray(i.editors)}function Zy(a){return a.getValue("workbench.editor.openSideBySideDirection")==="down"?1:3}var ie=le("editorService"),tr=-1,En=-2,ff=-3,MM=-4;function Dso(a){return typeof a=="number"||Ipe(a)}var Mt=ko;function ype(a){return a.scheme!==Q.file&&a.scheme!==Q.vscodeRemote}function PM(a){if(a.folders.length)return a.folders.every(i=>ype(i.uri))?a.folders[0].uri:void 0;if(a.configuration&&ype(a.configuration))return a.configuration}function MMt(a){return PM(a)?.scheme}function Rso(a){return PM(a)?.authority}function R0(a){return PM(a)!==void 0}var bo=le("remoteAgentService"),L0=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(a){let i=1/0;for(let t=0;t<this.maxSampleCount;t++){let o=await a.getRoundTripTime();if(o===void 0)return;i=Math.min(i,o/2),await Li(this.sampleDelay)}this.average.push(i),this.average.length>this.maxAverageCount&&this.average.shift();let e;return this.initial.length<this.maxInitialCount?this.initial.push(i):e=this.initial.reduce((t,o)=>t+o,0)/this.initial.length,this.lastMeasurement={initial:e,current:i,average:this.average.reduce((t,o)=>t+o,0)/this.average.length,high:typeof e>"u"?!1:i>this.highLatencyMaxThreshold||i>this.highLatencyMinThreshold&&i>e*this.highLatencyMultiple},this.lastMeasurement}};var Pn=le("pathService"),fZ=class{constructor(i,e,t,o){this.localUserHome=i;this.remoteAgentService=e;this.environmentService=t;this.contextService=o;this.resolveOS=(async()=>(await this.remoteAgentService.getEnvironment())?.os||Ao)(),this.resolveUserHome=(async()=>{let n=await this.remoteAgentService.getEnvironment();return this.maybeUnresolvedUserHome=n?.userHome??i})()}hasValidBasename(i,e,t){return typeof e=="string"||typeof e>"u"?this.resolveOS.then(o=>this.doHasValidBasename(i,o,e)):this.doHasValidBasename(i,e,t)}doHasValidBasename(i,e,t){return i.scheme===Q.file||i.scheme===Q.vscodeRemote?Ez(t??Be(i),e===1):!0}get defaultUriScheme(){return fZ.findDefaultUriScheme(this.environmentService,this.contextService)}static findDefaultUriScheme(i,e){if(i.remoteAuthority)return Q.vscodeRemote;let t=MMt(e.getWorkspace());if(t)return t;let o=e.getWorkspace().folders[0];if(o)return o.uri.scheme;let n=e.getWorkspace().configuration;return n?n.scheme:Q.file}userHome(i){return i?.preferLocal?this.localUserHome:this.resolveUserHome}get resolvedUserHome(){return this.maybeUnresolvedUserHome}get path(){return this.resolveOS.then(i=>i===1?Gs:Vo)}async fileURI(i){let e="";if(await this.resolveOS===1&&(i=i.replace(/\\/g,"/")),i[0]==="/"&&i[1]==="/"){let o=i.indexOf("/",2);o===-1?(e=i.substring(2),i="/"):(e=i.substring(2,o),i=i.substring(o)||"/")}return A.from({scheme:Q.file,authority:e,path:i,query:"",fragment:""})}};fZ=I([m(1,bo),m(2,Mt),m(3,Ae)],fZ);var Ga=class extends gZ{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,t,c,u,p,f,v);this.viewType=o;this.options=n;this._notebookService=r;this._notebookModelResolverService=s;this._fileDialogService=l;this.environmentService=b;this.pathService=S;this.editorModelReference=null;this._defaultDirtyState=!1;this._defaultDirtyState=!!n.startDirty,this._sideLoadedListener=r.onDidAddNotebookDocument(y=>{y.viewType===this.viewType&&y.uri.toString()===this.resource.toString()&&this.resolve().catch(mt)}),this._register(h.onWillStop(y=>{if(!y.auto&&!this.isDirty())return;let w=y.auto?d(13980,null,this.getName()):d(13981,null,this.getName());y.veto((async()=>{let x=g.findEditors(this);return y.auto?!0:!(x.length>0&&(await g.save(x[0])).success)})(),w)}))}static getOrCreate(e,t,o,n,r={}){let s=e.createInstance(Ga,t,o,n,r);return o&&s.setPreferredResource(o),s}static{this.ID="workbench.input.notebook"}dispose(){this._sideLoadedListener.dispose(),this.editorModelReference?.dispose(),this.editorModelReference=null,super.dispose()}get typeId(){return Ga.ID}get editorId(){return this.viewType}get capabilities(){let e=0;return this.resource.scheme===Q.untitled&&(e|=4),this.editorModelReference?this.editorModelReference.object.isReadonly()&&(e|=2):this.filesConfigurationService.isReadonly(this.resource)&&(e|=2),e&2||(e|=128),e}getDescription(e=1){if(!this.hasCapability(4)||this.editorModelReference?.object.hasAssociatedFilePath())return super.getDescription(e)}isReadonly(){return this.editorModelReference?this.editorModelReference.object.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}isDirty(){return this.editorModelReference?this.editorModelReference.object.isDirty():this._defaultDirtyState}isSaving(){let e=this.editorModelReference?.object;return!e||!e.isDirty()||e.hasErrorState||this.hasCapability(4)?!1:this.filesConfigurationService.hasShortAutoSaveDelay(this)}async save(e,t){if(this.editorModelReference)return this.hasCapability(4)?this.saveAs(e,t):(await this.editorModelReference.object.save(t),this)}async saveAs(e,t){if(!this.editorModelReference)return;let o=this._notebookService.getContributedNotebookType(this.viewType);if(!o)return;let n=this.hasCapability(4)?await this._suggestName(o):this.editorModelReference.object.resource,r;if(this.editorModelReference.object.hasAssociatedFilePath())r=n;else if(r=await this._fileDialogService.pickFileToSave(n,t?.availableFileSystems),!r)return;if(!o.matches(r)){let s=o.selectors.map(l=>typeof l=="string"?l:GA(l)?`${l} (base ${l.base})`:l.exclude?`${l.include} (exclude: ${l.exclude})`:`${l.include}`).join(", ");throw new Error(`File name ${r} is not supported by ${o.providerDisplayName}.

Please make sure the file name matches following patterns:
${s}`)}return await this.editorModelReference.object.saveAs(r)}async _suggestName(e){let t=await this.ensureAbsolutePath(this.ensureProviderExtension(e)),o=this.environmentService.remoteAuthority;return Nf(t,o,this.pathService.defaultUriScheme)}async ensureAbsolutePath(e){if(e.scheme!==Q.untitled||Jl(e.path))return e;let t=await this._fileDialogService.defaultFilePath();return A.joinPath(t,e.path)}ensureProviderExtension(e){let t=e.selectors[0],o=t&&typeof t=="string"?t:void 0;if(!o&&t){let r=t.include;typeof r=="string"&&(o=r)}let n=this.resource;if(o){let r=/^\*\.([A-Za-z_-]*)$/.exec(o);if(r&&r.length>1){let s=r[1];if(!n.path.endsWith(s))return n.with({path:n.path+"."+s})}}return n}async rename(e,t){if(this.editorModelReference)return{editor:{resource:t},options:{override:this.viewType}}}async revert(e,t){this.editorModelReference&&this.editorModelReference.object.isDirty()&&await this.editorModelReference.object.revert(t)}async resolve(e,t){if(!await this._notebookService.canResolve(this.viewType))return null;if(t?.mark("extensionActivated"),this._sideLoadedListener.dispose(),this.editorModelReference)this.editorModelReference.object.load({limits:this.ensureLimits(e)});else{let o=!!(this.capabilities&512),n=await this._notebookModelResolverService.resolve(this.resource,this.viewType,{limits:this.ensureLimits(e),scratchpad:o,viewType:this.editorId});if(this.editorModelReference)return n.dispose(),this.editorModelReference.object;if(this.editorModelReference=n,this.isDisposed())return this.editorModelReference.dispose(),this.editorModelReference=null,null;this._register(this.editorModelReference.object.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.editorModelReference.object.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this._register(this.editorModelReference.object.onDidRevertUntitled(()=>this.dispose())),this.editorModelReference.object.isDirty()&&this._onDidChangeDirty.fire()}if(this.options._backupId){let o=await this._notebookService.withNotebookDataProvider(this.editorModelReference.object.notebook.viewType);if(!(o instanceof LM))throw new Error("CANNOT open file notebook with this provider");let n=await o.serializer.dataToNotebook(Ke.fromString(JSON.stringify({__webview_backup:this.options._backupId})));this.editorModelReference.object.notebook.applyEdits([{editType:1,index:0,count:this.editorModelReference.object.notebook.length,cells:n.cells}],!0,void 0,()=>{},void 0,!1),this.options._workingCopy&&(this.options._backupId=void 0,this.options._workingCopy=void 0,this.options.startDirty=void 0)}return this.editorModelReference.object}toUntyped(){return{resource:this.resource,options:{override:this.viewType}}}matches(e){return super.matches(e)?!0:e instanceof Ga?this.viewType===e.viewType&&ze(this.resource,e.resource):zg(e)&&e.resource.scheme===sn.scheme?ze(this.resource,sn.parse(e.resource)?.notebook):!1}};Ga=I([m(4,kn),m(5,Yh),m(6,nn),m(7,nt),m(8,ge),m(9,fr),m(10,lt),m(11,ie),m(12,Gn),m(13,nb),m(14,Mt),m(15,Pn)],Ga);function S3(a){return!!a&&typeof a=="object"&&Array.isArray(a.editorInputs)&&a.editorInputs.every(i=>i instanceof Ga)}function mYe(a){return!!a&&typeof a=="object"&&a.typeId===Ga.ID}function Wbi(a){return!a||typeof a!="object"?!1:typeof a.start=="number"&&typeof a.end=="number"}function wpe(a){a.sort((e,t)=>e-t);let i=a.shift();return i===void 0?[]:a.reduce(function(e,t){return t<=e[0][1]?e[0][1]=t+1:e.unshift([t,t+1]),e},[[i,i+1]]).reverse().map(e=>({start:e[0],end:e[1]}))}function yv(a){return a.reduce((e,t)=>{for(let o=t.start;o<t.end;o++)e.push(o);return e},[])}function M0(a){let i=a.sort((o,n)=>o.start-n.start),e=i[0];if(!e)return[];let t=i.reduce((o,n)=>{let r=o[o.length-1];return r.end>=n.start?r.end=Math.max(r.end,n.end):o.push(n),o},[e]);return t.length>1?t.filter(o=>!(o.start===o.end&&o.start===0)):t}function hYe(a,i){if(a=M0(a),i=M0(i),a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(a[e].start!==i[e].start||a[e].end!==i[e].end)return!1;return!0}function PMt(a,i){return i.start>=a.start&&i.end<=a.end}var F_e="notebook.cell.expandCellInput",Lso="notebook.cell.execute",gYe="notebook.cell.detectLanguage",AMt="notebook.cell.changeLanguage",Vbi="notebook.cell.quitEdit",NMt="notebook.cell.expandCellOutput",Bbi="jupyter-notebook",W_e="ms-toolsai.jupyter",Mso=new Map([[Bbi,W_e]]),OMt=new Map;OMt.set(Bbi,new Map);OMt.get(Bbi)?.set("python",{extensionIds:["ms-python.python",W_e],displayName:"Python + Jupyter"});function Pso(a){return!!a&&typeof a.handle=="number"}function lr(a){if(!a)return;if(a.getId()===_M)return a.getControl();if(a.getId()===oZ)return a.getControl().inlineNotebookEditor;let i=a.input;if(i&&S3(i))return a.getControl()?.notebookEditor}function vZ(a,i){let e=yv(i),t=[];return e.forEach(o=>{if(!a.cellAt(o))return;let r=a.getViewIndexByModelIndex(o);if(r<0)return;let s=r+1,l=a.getCellRangeFromViewRange(r,s);l&&t.push(l)}),M0(t)}function fYe(a,i){let e=[];return M0(i).forEach(t=>{e.push(...a.getCellsInRange(t))}),e}var rb=class a extends sJ{constructor(e,t,o=void 0,n){super(n);this.resource=e;this.cellEdit=t;this.notebookVersionId=o}static is(e){return e instanceof a?!0:A.isUri(e.resource)&&Di(e.cellEdit)}static lift(e){return e instanceof a?e:new a(e.resource,e.cellEdit,e.notebookVersionId,e.metadata)}},V_e=class{constructor(i,e,t,o,n,r,s){this._undoRedoGroup=i;this._progress=t;this._token=o;this._edits=n;this._editorService=r;this._notebookModelService=s;this._edits=this._edits.map(l=>{if(l.resource.scheme===sn.scheme){let c=sn.parse(l.resource)?.notebook;if(!c)throw new Error(`Invalid notebook URI: ${l.resource}`);return new rb(c,l.cellEdit,l.notebookVersionId,l.metadata)}else return l})}async apply(){let i=[],e=Lf(this._edits,(t,o)=>oc(t.resource.toString(),o.resource.toString()));for(let t of e){if(this._token.isCancellationRequested)break;let[o]=t,n=await this._notebookModelService.resolve(o.resource);if(typeof o.notebookVersionId=="number"&&n.object.notebook.versionId!==o.notebookVersionId)throw n.dispose(),new Error(`Notebook '${o.resource}' has changed in the meantime`);let r=t.map(u=>u.cellEdit),s=!n.object.isReadonly(),l=lr(this._editorService.activeEditorPane),c=l?.textModel?.uri.toString()===n.object.notebook.uri.toString()?{kind:1,focus:l.getFocus(),selections:l.getSelections()}:void 0;n.object.notebook.applyEdits(r,!0,c,()=>{},this._undoRedoGroup,s),n.dispose(),this._progress.report(void 0),i.push(o.resource)}return i}};V_e=I([m(5,ie),m(6,Yh)],V_e);var FMt=class{constructor(i,e,t,o){this._bulkEditService=e;this._logService=t;this._uriIdentService=o}dispose(){}$tryApplyWorkspaceEdit(i,e,t){let o=yH(i.value,this._uriIdentService);return this._bulkEditService.apply(o,{undoRedoGroupId:e,respectAutoSaveConfig:t}).then(n=>n.isApplied,n=>(this._logService.warn(`IGNORING workspace edit: ${n}`),!1))}};FMt=I([fo(Xi.MainThreadBulkEdits),m(1,Ka),m(2,re),m(3,gt)],FMt);function yH(a,i,e){if(!a||!a.edits)return a;let t=er(a);for(let o of t.edits){if(hl.is(o)&&(o.resource=i.asCanonicalUri(o.resource)),Yu.is(o)){if(o.options){let n=o.options?.contents;if(n)if(n.type==="base64")o.options.contents=Promise.resolve(Ws(n.value));else if(e)o.options.contents=e(n.id);else throw new Error("Could not revive data transfer file")}o.newResource=o.newResource&&i.asCanonicalUri(o.newResource),o.oldResource=o.oldResource&&i.asCanonicalUri(o.oldResource)}if(rb.is(o)){o.resource=i.asCanonicalUri(o.resource);let n=o.cellEdit;n.editType===1&&(o.cellEdit={...n,cells:n.cells.map(r=>({...r,outputs:r.outputs.map(s=>({...s,outputs:s.items.map(l=>({mime:l.mime,data:l.valueBytes}))}))}))})}}return a}async function JA(a,i){let e=i==="image/gif";return typeof a=="string"&&(a=Hbi(a)),new Promise((t,o)=>{let n=new Blob([a],{type:i}),r=new Image,s=URL.createObjectURL(n);r.src=s,r.onload=()=>{URL.revokeObjectURL(s);let{width:l,height:c}=r;if((l<=768||c<=768)&&!e){t(a);return}if(l>2048||c>2048){let g=2048/Math.max(l,c);l=Math.round(l*g),c=Math.round(c*g)}let u=768/Math.min(l,c);l=Math.round(l*u),c=Math.round(c*u);let p=document.createElement("canvas");p.width=l,p.height=c;let h=p.getContext("2d");if(h){h.drawImage(r,0,0,l,c);let f=i&&["image/jpeg","image/jpg"].includes(i)?"image/jpeg":"image/png";p.toBlob(v=>{if(v){let b=new FileReader;b.onload=()=>{t(new Uint8Array(b.result))},b.onerror=S=>o(S),b.readAsArrayBuffer(v)}else o(new Error("Failed to create blob from canvas"))},f)}else o(new Error("Failed to get canvas context"))},r.onerror=l=>{URL.revokeObjectURL(s),o(l)}})}function Hbi(a){let i=a.includes(",")?a.split(",")[1]:a;return V9o(i)?Ws(i).buffer:new TextEncoder().encode(a)}function V9o(a){return/^[A-Za-z0-9+/]*={0,2}$/.test(a)&&(()=>{try{return atob(a),!0}catch{return!1}})()}async function Aso(a,i,e,t){await a.exists(i)||await a.createFolder(i);let n=t.split("/")[1]||"png",r=`image-${Date.now()}.${n}`,s=Ve(i,r),l=Ke.wrap(e);return await a.writeFile(s,l),s}async function Nso(a,i,e){if(!await a.exists(e))return;let o=10080*60*1e3,n=await a.resolve(e);n.children&&await Promise.all(n.children.map(async r=>{try{let s=B9o(r.name);s&&Date.now()-s>o&&await a.del(r.resource)}catch(s){i.error("Failed to clean up old images",s)}}))}function B9o(a){let i=a.match(/image-(\d+)\./);if(i)return parseInt(i[1],10)}Ge.registerCommand("_chat.resizeImage",async(a,i,e)=>(i instanceof Ke&&(i=i.buffer),JA(i,e)));var H_e=le("languageModelIgnoredFilesService"),WMt=class{constructor(){this._providers=new Set}async fileIsIgnored(i,e){let t=this._providers.values().next().value;return t?t.isFileIgnored(i,e):!1}registerIgnoredFileProvider(i){return this._providers.add(i),ee(()=>{this._providers.delete(i)})}};var Ra=le("requestService"),Wso="NO_FETCH_TELEMETRY",zbi=class{constructor(i){this.original=i}toJSON(){if(!this.headers){let i=Object.create(null);for(let e in this.original)e.toLowerCase()==="authorization"||e.toLowerCase()==="proxy-authorization"?i[e]="*****":i[e]=this.original[e];this.headers=i}return this.headers}},VMt=class extends k{constructor(e){super();this.logService=e;this.counter=0;this._onDidCompleteRequest=this._register(new T);this.onDidCompleteRequest=this._onDidCompleteRequest.event}async logAndRequest(e,t){let o=`#${++this.counter}: ${e.url}`;this.logService.trace(`${o} - begin`,e.type,new zbi(e.headers??{}));let n=Date.now();try{let r=await t();return this.logService.trace(`${o} - end`,e.type,r.res.statusCode,r.res.headers),this._onDidCompleteRequest.fire({callSite:e.callSite,latency:Date.now()-n,statusCode:r.res.statusCode}),r}catch(r){throw this.logService.error(`${o} - error`,e.type,Dn(r)),r}}};function pE(a){return a.res.statusCode&&a.res.statusCode>=200&&a.res.statusCode<300||a.res.statusCode===1223}function Cpe(a){return!!a.res.statusCode&&a.res.statusCode>=400&&a.res.statusCode<500}function Vso(a){return!!a.res.statusCode&&a.res.statusCode>=500&&a.res.statusCode<600}function BMt(a){return a.res.statusCode===204}async function jD(a){return BMt(a)?null:(await yI(a.stream)).toString()}async function gC(a){if(!pE(a))throw new Error("Server returned "+a.res.statusCode);return jD(a)}async function Th(a){if(!pE(a))throw new Error("Server returned "+a.res.statusCode);if(BMt(a))return null;let e=(await yI(a.stream)).toString();try{return JSON.parse(e)}catch(t){throw t.message+=`:
`+e,t}}function Kbi(a,i){Bso(a,i)}var Gbi=["http.proxy","http.proxyStrictSSL","http.proxyKerberosServicePrincipal","http.noProxy","http.proxyAuthorization","http.proxySupport","http.systemCertificates","http.systemCertificatesNode","http.experimental.systemCertificatesV2","http.fetchAdditionalSupport","http.experimental.networkInterfaceCheckInterval"],H9o=!1,Ubi=[],Oso,Fso;function Bso(a=!0,i=!0){if(Oso===a&&Fso===i)return;Oso=a,Fso=i;let e=oe.as($t.Configuration),t=Ubi;Ubi=[{id:"http",order:15,title:d(2530,null),type:"object",scope:2,properties:{"http.useLocalProxyConfiguration":{type:"boolean",default:i,markdownDescription:d(2545,null),restricted:!0}}},{id:"http",order:15,title:d(2530,null),type:"object",scope:1,properties:{"http.electronFetch":{type:"boolean",default:!1,description:d(2528,null),restricted:!0}}},{id:"http",order:15,title:d(2530,null),type:"object",scope:a?1:2,properties:{"http.proxy":{type:"string",pattern:"^(https?|socks|socks4a?|socks5h?)://([^:]*(:[^@]*)?@)?([^:]+|\\[[:0-9a-fA-F]+\\])(:\\d+)?/?$|^$",markdownDescription:d(2533,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyStrictSSL":{type:"boolean",default:!0,markdownDescription:d(2541,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyKerberosServicePrincipal":{type:"string",markdownDescription:d(2535,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.noProxy":{type:"array",items:{type:"string"},markdownDescription:d(2532,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxyAuthorization":{type:["null","string"],default:null,markdownDescription:d(2534,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.proxySupport":{type:"string",enum:["off","on","fallback","override"],enumDescriptions:[d(2538,null),d(2539,null),d(2537,null),d(2540,null)],default:"override",markdownDescription:d(2536,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificates":{type:"boolean",default:!0,markdownDescription:d(2542,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.systemCertificatesNode":{type:"boolean",tags:["experimental"],default:H9o,markdownDescription:d(2543,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}},"http.experimental.systemCertificatesV2":{type:"boolean",tags:["experimental"],default:!1,markdownDescription:d(2544,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0},"http.fetchAdditionalSupport":{type:"boolean",default:!0,markdownDescription:d(2529,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.webSocketAdditionalSupport":{type:"boolean",default:!0,markdownDescription:d(2546,null,"`#http.useLocalProxyConfiguration#`","`#http.proxySupport#`","`#http.systemCertificates#`"),restricted:!0},"http.experimental.networkInterfaceCheckInterval":{type:"number",default:300,minimum:-1,tags:["experimental"],markdownDescription:d(2531,null,"`#http.useLocalProxyConfiguration#`"),restricted:!0,experiment:{mode:"auto"}}}}],e.updateConfigurations({add:Ubi,remove:t})}Bso();var U_e=le("encryptionService"),xCa=le("encryptionMainService");function Hso(a){return a==="kwallet"||a==="kwallet5"||a==="kwallet6"}function Uso(a){return a==="gnome_any"||a==="gnome_libsecret"||a==="gnome_keyring"}var vYe="secret://";function qbi(a){return`${vYe}${a}`}async function U9o(a,i,e,t){let o=qbi(a);t?.trace("[secrets] getting secret for key:",o);let n=i(o);if(!n){t?.trace("[secrets] no secret found for key:",o);return}t?.trace("[secrets] decrypting secret for key:",o);let r=await e(n);return t?.trace("[secrets] decrypted secret for key:",o),r}async function z9o(a,i,e,t,o){o?.trace("[secrets] encrypting secret for key:",a);let n=await t(i),r=qbi(a);o?.trace("[secrets] storing encrypted secret for key:",r),e(r,n),o?.trace("[secrets] stored encrypted secret for key:",r)}var K9o=['{"extensionId":"vscode.github-authentication","key":"github.auth"}'],fC=le("secretStorageService"),z_e=class extends k{constructor(e,t,o,n){super();this._useInMemoryStorage=e;this._storageService=t;this._encryptionService=o;this._logService=n;this.onDidChangeSecretEmitter=this._register(new T);this.onDidChangeSecret=this.onDidChangeSecretEmitter.event;this._sequencer=new II;this._type="unknown";this._onDidChangeValueDisposable=this._register(new O);this._lazyStorageService=new uo(()=>this.initialize())}useSharedStorage(e){return ii&&K9o.includes(e)}get type(){return this._type}get resolvedStorageService(){return this._lazyStorageService.value}get(e){return this._sequencer.queue(e,async()=>{let t=await this.resolvedStorageService;try{return await U9o(e,o=>this.getValueFromStorage(e,o,t),this._type==="in-memory"?o=>Promise.resolve(o):o=>this._encryptionService.decrypt(o),this._logService)}catch(o){this._logService.error(o),this.delete(e);return}})}set(e,t){return this._sequencer.queue(e,async()=>{let o=await this.resolvedStorageService;try{await z9o(e,t,(n,r)=>this.setValueInStorage(e,n,r,o),this._type==="in-memory"?n=>Promise.resolve(n):n=>this._encryptionService.encrypt(n),this._logService)}catch(n){throw this._logService.error(n),n}})}delete(e){return this._sequencer.queue(e,async()=>{let t=await this.resolvedStorageService,o=qbi(e);this._logService.trace("[secrets] deleting secret for key:",o);let n=this.useSharedStorage(e)?-2:-1;t.remove(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 t=e.keys(-1,1);return this._logService.trace("[secrets] fetched keys of all secrets"),t.filter(o=>o.startsWith(vYe)).map(o=>o.slice(vYe.length))})}getValueFromStorage(e,t,o){return this.useSharedStorage(e)?(this._logService.trace(`[SecretStorageService] Fetching value for cross-app shared secret: ${t}`),o.get(t,-2)):o.get(t,-1)}setValueInStorage(e,t,o,n){if(this.useSharedStorage(e)){this._logService.trace(`[SecretStorageService] Setting value for cross-app shared secret: ${t}`),n.store(t,o,-2,1);return}n.store(t,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 kkt)}return this._onDidChangeValueDisposable.clear(),this._onDidChangeValueDisposable.add(U.any(e.onDidChangeValue(-1,void 0,this._onDidChangeValueDisposable),e.onDidChangeValue(-2,void 0,this._onDidChangeValueDisposable))(t=>{this.onDidChangeValue(t.key)})),e}reinitialize(){this._lazyStorageService=new uo(()=>this.initialize())}onDidChangeValue(e){if(!e.startsWith(vYe))return;let t=e.slice(vYe.length);this._logService.trace(`[SecretStorageService] Notifying change in value for secret: ${t}`),this.onDidChangeSecretEmitter.fire(t)}};z_e=I([m(1,de),m(2,U_e),m(3,re)],z_e);var el=new Y("workbenchState",void 0,{type:"string",description:d(5545,null)}),i_=new Y("workspaceFolderCount",0,d(5546,null)),P0=new Y("openFolderWorkspaceSupport",!0,!0),QD=new Y("enterMultiRootWorkspaceSupport",!0,!0),SZ=new Y("emptyWorkspaceSupport",!0,!0),bYe=new Y("dirtyWorkingCopies",!1,d(5488,null)),Qb=new Y("remoteName","",d(5523,null)),AM=new Y("virtualWorkspace","",d(5544,null)),HMt=new Y("temporaryWorkspace",!1,d(5538,null)),qo=new Y("isSessionsWindow",!1,d(5509,null)),UMt=new Y("hasWebFileSystemAccess",!1,!0),zso=new Y("embedderIdentifier",void 0,d(5498,null)),zMt=new Y("inAutomation",!1,d(5501,null)),ZA=new Y("isFullscreen",!1,d(5507,null)),ew=new Y("isAuxiliaryWindowFocusedContext",!1,d(5504,null)),SYe=new Y("isWindowAlwaysOnTop",!1,d(5511,null)),Qf=new Y("isAuxiliaryWindow",!1,d(5503,null)),xpe=new Y("activeEditorIsDirty",!1,d(5476,null)),K_e=new Y("activeEditorIsNotPreview",!1,d(5479,null)),KMt=new Y("activeEditorIsFirstInGroup",!1,d(5477,null)),kpe=new Y("activeEditorIsLastInGroup",!1,d(5478,null)),NM=new Y("activeEditorIsPinned",!1,d(5480,null)),Kso=new Y("activeEditorIsReadonly",!1,d(5481,null)),G_e=new Y("activeCompareEditorCanSwap",!1,d(5465,null)),GMt=new Y("activeEditorCanToggleReadonly",!0,d(5471,null)),qMt=new Y("activeEditorCanRevert",!1,d(5470,null)),wH=new Y("activeEditorCanSplitInGroup",!0),Tr=new Y("activeEditor",null,{type:"string",description:d(5468,null)}),A0=new Y("activeEditorAvailableEditorIds","",d(5469,null)),IYe=new Y("textCompareEditorVisible",!1,d(5540,null)),GS=new Y("textCompareEditorActive",!1,d(5539,null)),Dx=new Y("sideBySideEditorActive",!1,d(5535,null)),Epe=new Y("activeCustomEditorDiffCanToggleLayout",!1,d(5466,null)),$Mt=new Y("activeCustomEditorTextDiff",!1,d(5467,null)),jMt=new Y("groupEditorsCount",0,d(5500,null)),Gso=new Y("isTopRightEditorGroup",!1,d(5510,null)),Tpe=new Y("activeEditorGroupEmpty",!1,d(5472,null)),qso=new Y("activeEditorGroupIndex",0,d(5473,null)),$so=new Y("activeEditorGroupLast",!1,d(5474,null)),o_=new Y("activeEditorGroupLocked",!1,d(5475,null)),qS=new Y("multipleEditorGroups",!1,d(5513,null)),jso=qS.toNegated(),I3=new Y("multipleEditorsSelectedInGroup",!1,d(5514,null)),QMt=new Y("twoEditorsSelectedInGroup",!1,d(5543,null)),YMt=new Y("SelectedEditorsInGroupFileOrUntitledResourceContextKey",!0,d(5532,null)),y3=new Y("editorPartMultipleEditorGroups",!1,d(5496,null)),jCa=y3.toNegated(),CH=new Y("editorPartMaximizedEditorGroup",!1,d(5490,null)),vC=new Y("editorPartModal",!1,d(5491,null)),XMt=new Y("editorPartModalMaximized",!1,d(5492,null)),_pe=new Y("editorPartModalNavigation",!1,d(5493,null)),JMt=new Y("editorPartModalSidebar",!1,d(5494,null)),Qso=new Y("editorPartModalSidebarVisible",!1,d(5495,null)),ZMt=new Y("editorIsOpen",!1,d(5489,null)),Yf=new Y("inZenMode",!1,d(5502,null)),yYe=new Y("isCenteredLayout",!1,d(5508,null)),Dpe=new Y("splitEditorsVertically",!1,d(5536,null)),ePt=new Y("mainEditorAreaVisible",!0,d(5512,null)),L2=new Y("editorTabsVisible",!0,d(5497,null)),eN=new Y("sideBarVisible",!1,d(5534,null)),xH=new Y("sideBarFocus",!1,d(5533,null)),Yso=new Y("activeViewlet","",d(5483,null)),IZ=new Y("statusBarFocused",!1,d(5537,null)),yZ=new Y("titleBarStyle","custom",d(5541,null)),w3=new Y("titleBarVisible",!1,d(5542,null)),N0=new Y("isCompactTitleBar",!1,d(5505,null)),wYe=new Y("bannerFocused",!1,d(5487,null)),YD=new Y("notificationFocus",!0,d(5516,null)),CYe=new Y("notificationCenterVisible",!1,d(5515,null)),kH=new Y("notificationToastsVisible",!1,d(5517,null)),Xso=new Y("activeAuxiliary","",d(5464,null)),Jso=new Y("auxiliaryBarFocus",!1,d(5484,null)),tN=new Y("auxiliaryBarVisible",!1,d(5486,null)),M2=new Y("auxiliaryBarMaximized",!1,d(5485,null)),Zso=new Y("activePanel","",d(5482,null)),Rpe=new Y("panelFocus",!1,d(5519,null)),wZ=new Y("panelPosition","bottom",d(5521,null)),EH=new Y("panelAlignment","center",d(5518,null)),CZ=new Y("panelVisible",!1,d(5522,null)),tPt=new Y("panelMaximized",!1,d(5520,null)),rc=new Y("focusedView","",d(5499,null));function xYe(a){return`view.${a}.visible`}var t_=class{constructor(i,e,t,o){this._contextKeyService=i;this._fileService=e;this._languageService=t;this._modelService=o;this._schemeKey=t_.Scheme.bindTo(this._contextKeyService),this._filenameKey=t_.Filename.bindTo(this._contextKeyService),this._dirnameKey=t_.Dirname.bindTo(this._contextKeyService),this._pathKey=t_.Path.bindTo(this._contextKeyService),this._langIdKey=t_.LangId.bindTo(this._contextKeyService),this._resourceKey=t_.Resource.bindTo(this._contextKeyService),this._extensionKey=t_.Extension.bindTo(this._contextKeyService),this._hasResource=t_.HasResource.bindTo(this._contextKeyService),this._isFileSystemResource=t_.IsFileSystemResource.bindTo(this._contextKeyService)}static{this.Scheme=new Y("resourceScheme",void 0,{type:"string",description:d(5530,null)})}static{this.Filename=new Y("resourceFilename",void 0,{type:"string",description:d(5527,null)})}static{this.Dirname=new Y("resourceDirname",void 0,{type:"string",description:d(5525,null)})}static{this.Path=new Y("resourcePath",void 0,{type:"string",description:d(5529,null)})}static{this.LangId=new Y("resourceLangId",void 0,{type:"string",description:d(5528,null)})}static{this.Resource=new Y("resource",void 0,{type:"URI",description:d(5524,null)})}static{this.Extension=new Y("resourceExtname",void 0,{type:"string",description:d(5526,null)})}static{this.HasResource=new Y("resourceSet",void 0,{type:"boolean",description:d(5531,null)})}static{this.IsFileSystemResource=new Y("isFileSystemResource",void 0,{type:"boolean",description:d(5506,null)})}_setLangId(){let i=this.get();if(!i){this._langIdKey.set(null);return}let e=this._modelService.getModel(i)?.getLanguageId()??this._languageService.guessLanguageIdByFilepathOrFirstLine(i);this._langIdKey.set(e)}set(i){i=i??void 0,!ze(this._value,i)&&(this._value=i,this._contextKeyService.bufferChangeEvents(()=>{this._resourceKey.set(i?i.toString():null),this._schemeKey.set(i?i.scheme:null),this._filenameKey.set(i?Be(i):null),this._dirnameKey.set(i?this.uriToPath(ai(i)):null),this._pathKey.set(i?this.uriToPath(i):null),this._setLangId(),this._extensionKey.set(i?Ts(i):null),this._hasResource.set(!!i),this._isFileSystemResource.set(i?this._fileService.hasProvider(i):!1)}))}uriToPath(i){return i.scheme===Q.file?i.fsPath:i.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}};t_=I([m(0,X),m(1,ge),m(2,Rt),m(3,_t)],t_);var Ho=class extends t_{constructor(e,t,o,n){super(e,t,o,n);this._disposables=new O;this._disposables.add(t.onDidChangeFileSystemProviderRegistrations(()=>{let r=this.get();this._isFileSystemResource.set(!!(r&&t.hasProvider(r)))})),this._disposables.add(n.onModelAdded(r=>{ze(r.uri,this.get())&&this._setLangId()})),this._disposables.add(n.onModelLanguageChanged(r=>{ze(r.model.uri,this.get())&&this._setLangId()}))}dispose(){this._disposables.dispose()}};Ho=I([m(0,X),m(1,ge),m(2,Rt),m(3,_t)],Ho);var bZ=class extends t_{};function iPt(a,i,e){if(!i){a.set("");return}let t=$bi(i,e);a.set(t.join(","))}function $bi(a,i){if(a.resource?.scheme===Q.untitled&&a.editorId!==Da.id)return[];if(qD(a)){let e=$bi(a.original,i),t=new Set($bi(a.modified,i));return e.filter(o=>t.has(o))}return a.resource?i.getEditors(a.resource).map(e=>e.id):[]}var iN="__";function Lpe(a){return typeof a=="object"&&a!==null&&"wwwAuthenticate"in a&&typeof a.wwwAuthenticate=="string"}var ks=le("IAuthenticationService");var xZ=le("IAuthenticationExtensionsService");var Xn;(s=>(s.Setup={hidden:new Y("chatSetupHidden",!1,!0),installed:new Y("chatSetupInstalled",!1,!0),disabled:new Y("chatSetupDisabled",!1,!0),disabledInWorkspace:new Y("chatSetupDisabledInWorkspace",!1,!0),untrusted:new Y("chatSetupUntrusted",!1,!0),later:new Y("chatSetupLater",!1,!0),registered:new Y("chatSetupRegistered",!1,!0),completed:new Y("chatSetupCompleted",!1,!0)},s.Entitlement={signedOut:new Y("chatEntitlementSignedOut",!1,!0),canSignUp:new Y("chatPlanCanSignUp",!1,!0),planFree:new Y("chatPlanFree",!1,!0),planPro:new Y("chatPlanPro",!1,!0),planEdu:new Y("chatPlanEdu",!1,!0),planProPlus:new Y("chatPlanProPlus",!1,!0),planMax:new Y("chatPlanMax",!1,!0),planBusiness:new Y("chatPlanBusiness",!1,!0),planEnterprise:new Y("chatPlanEnterprise",!1,!0),organisations:new Y("chatEntitlementOrganisations",void 0,!0),internal:new Y("chatEntitlementInternal",!1,!0),sku:new Y("chatEntitlementSku",void 0,!0)},s.chatQuotaExceeded=new Y("chatQuotaExceeded",!1,!0),s.completionsQuotaExceeded=new Y("completionsQuotaExceeded",!1,!0),s.chatAnonymous=new Y("chatAnonymous",!1,!0),s.clientByokEnabled=new Y("github.copilot.clientByokEnabled",!0,!0),s.hasByokModels=new Y("github.copilot.hasByokModels",!1,!0)))(Xn||={});var dr=le("chatEntitlementService");function O0(a){return a===10||a===6||a===7||a===11||a===8||a===9}function nPt(a){switch(a){case 10:return d(18700,null);case 6:return d(18704,null);case 7:return d(18705,null);case 11:return d(18703,null);case 8:return d(18699,null);case 9:return d(18701,null);default:return d(18702,null)}}var oPt={upgradePlanUrl:$i.defaultChatAgent?.upgradePlanUrl??"",providerUriSetting:$i.defaultChatAgent?.providerUriSetting??"",entitlementSignupLimitedUrl:$i.defaultChatAgent?.entitlementSignupLimitedUrl??"",chatQuotaExceededContext:$i.defaultChatAgent?.chatQuotaExceededContext??"",completionsQuotaExceededContext:$i.defaultChatAgent?.completionsQuotaExceededContext??""},eao="chat.allowAnonymousAccess";function jbi(a,i,e){return!(a.getValue(eao)!==!0||i!==1||e.hidden||e.disabledInWorkspace)}function tao(a,i,e){e.publicLog2("chatEntitlements",{chatHidden:!!a.hidden,chatDisabled:!!a.disabled,chatEntitlement:a.entitlement,chatRegistered:!!a.registered,chatAnonymous:jbi(i,a.entitlement,a)})}var C3=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.contextKeyService=n;this.configurationService=r;this.telemetryService=s;this.logService=l;this.storageService=c;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:oPt.chatQuotaExceededContext,completionsQuotaExceeded:oPt.completionsQuotaExceededContext};this._onDidChangeAnonymous=this._register(new T);this.onDidChangeAnonymous=this._onDidChangeAnonymous.event;this.anonymousObs=vi(this.onDidChangeAnonymous,()=>this.anonymous);let u=this.storageService.getBoolean(C3.CACHED_UBB_STORAGE_KEY,0);if(this._quotas=u!==void 0?{usageBasedBilling:u}:{},this.chatQuotaExceededContextKey=Xn.chatQuotaExceeded.bindTo(this.contextKeyService),this.completionsQuotaExceededContextKey=Xn.completionsQuotaExceeded.bindTo(this.contextKeyService),this.anonymousContextKey=Xn.chatAnonymous.bindTo(this.contextKeyService),this.anonymousContextKey.set(this.anonymous),this.contextKeyService.getContextKeyValue(Xn.clientByokEnabled.key)===void 0&&Xn.clientByokEnabled.bindTo(this.contextKeyService),this.onDidChangeEntitlement=U.map(U.filter(this.contextKeyService.onDidChangeContext,h=>h.affectsSome(new Set([Xn.Entitlement.planEdu.key,Xn.Entitlement.planPro.key,Xn.Entitlement.planBusiness.key,Xn.Entitlement.planEnterprise.key,Xn.Entitlement.planProPlus.key,Xn.Entitlement.planMax.key,Xn.Entitlement.planFree.key,Xn.Entitlement.canSignUp.key,Xn.Entitlement.signedOut.key,Xn.Entitlement.organisations.key,Xn.Entitlement.internal.key,Xn.Entitlement.sku.key])),this._store),()=>{},this._store),this.entitlementObs=vi(this.onDidChangeEntitlement,()=>this.entitlement),this.onDidChangeSentiment=U.map(U.filter(this.contextKeyService.onDidChangeContext,h=>h.affectsSome(new Set([Xn.Setup.completed.key,Xn.Setup.hidden.key,Xn.Setup.disabled.key,Xn.Setup.untrusted.key,Xn.Setup.installed.key,Xn.Setup.later.key,Xn.Setup.registered.key])),this._store),()=>{},this._store),this.sentimentObs=vi(this.onDidChangeSentiment,()=>this.sentiment),Ft&&!o.remoteAuthority&&!o.isSessionsWindow){Xn.Setup.hidden.bindTo(this.contextKeyService).set(!0);return}if(!t.defaultChatAgent)return;let p=this.context=new uo(()=>this._register(e.createInstance(oN)));this.requests=new uo(()=>this._register(e.createInstance(kYe,p.value,{clearQuotas:()=>this.clearQuotas(),acceptQuotas:h=>this.acceptQuotas(h)}))),this.registerListeners()}static{this.CACHED_UBB_STORAGE_KEY="chat.usageBasedBilling"}get entitlement(){return this.contextKeyService.getContextKeyValue(Xn.Entitlement.planEdu.key)===!0?10:this.contextKeyService.getContextKeyValue(Xn.Entitlement.planPro.key)===!0?6:this.contextKeyService.getContextKeyValue(Xn.Entitlement.planBusiness.key)===!0?8:this.contextKeyService.getContextKeyValue(Xn.Entitlement.planEnterprise.key)===!0?9:this.contextKeyService.getContextKeyValue(Xn.Entitlement.planProPlus.key)===!0?7:this.contextKeyService.getContextKeyValue(Xn.Entitlement.planMax.key)===!0?11:this.contextKeyService.getContextKeyValue(Xn.Entitlement.planFree.key)===!0?5:this.contextKeyService.getContextKeyValue(Xn.Entitlement.canSignUp.key)===!0?3:this.contextKeyService.getContextKeyValue(Xn.Entitlement.signedOut.key)===!0?1:2}get isInternal(){return this.contextKeyService.getContextKeyValue(Xn.Entitlement.internal.key)===!0}get organisations(){return this.contextKeyService.getContextKeyValue(Xn.Entitlement.organisations.key)}get sku(){return this.contextKeyService.getContextKeyValue(Xn.Entitlement.sku.key)}get copilotTrackingId(){return this.context?.value.state.copilotTrackingId}get previewFeaturesDisabled(){return this.contextKeyService.getContextKeyValue("github.copilot.previewFeaturesDisabled")===!0}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]),t=this._register(new ue);this._register(this.contextKeyService.onDidChangeContext(r=>{r.affectsSome(e)&&(t.value&&t.value.cancel(),t.value=new qe,this.update(t.value.token))}));let o=this.anonymous,n=()=>{let r=this.anonymous;r!==o&&(o=r,this.anonymousContextKey.set(r),this.context?.hasValue&&tao(this.context.value.state,this.configurationService,this.telemetryService),this._onDidChangeAnonymous.fire())};this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(eao)&&n()})),this._register(this.onDidChangeEntitlement(()=>n())),this._register(this.onDidChangeSentiment(()=>n()))}acceptQuotas(e){let t=this._quotas;this._quotas=e,this.updateContextKeys(),t.usageBasedBilling!==e.usageBasedBilling&&(e.usageBasedBilling!==void 0?this.storageService.store(C3.CACHED_UBB_STORAGE_KEY,e.usageBasedBilling,0,1):this.storageService.remove(C3.CACHED_UBB_STORAGE_KEY,0)),this.logService.getLevel()===1&&this.logService.trace(`[chat entitlement]: acceptQuotas: ${JSON.stringify(e)}`);let{changed:o}=this.compareQuotas(t.chat,e.chat),{changed:n}=this.compareQuotas(t.completions,e.completions),{changed:r}=this.compareQuotas(t.premiumChat,e.premiumChat);(o.exceeded||n.exceeded||r.exceeded)&&this._onDidChangeQuotaExceeded.fire(),(o.remaining||n.remaining||r.remaining||t.usageBasedBilling!==e.usageBasedBilling)&&this._onDidChangeQuotaRemaining.fire(),t.usageBasedBilling!==e.usageBasedBilling&&this._onDidChangeUsageBasedBilling.fire(),t.additionalUsageEnabled!==void 0&&e.additionalUsageEnabled!==void 0&&t.additionalUsageEnabled!==e.additionalUsageEnabled&&this.telemetryService.publicLog2("chatAdditionalSpendConfiguration",{enabled:e.additionalUsageEnabled??!1,entitlement:this.entitlement}),e.additionalUsageEnabled&&e.premiumChat?.percentRemaining===0&&t.premiumChat?.percentRemaining!==void 0&&t.premiumChat.percentRemaining>0&&this.telemetryService.publicLog2("chatAdditionalSpendActive",{entitlement:this.entitlement,additionalUsageCount:e.additionalUsageCount??0})}compareQuotas(e,t){return{changed:{exceeded:e?.percentRemaining===0!=(t?.percentRemaining===0),remaining:e?.percentRemaining!==t?.percentRemaining||e?.usageBasedBilling!==t?.usageBasedBilling}}}clearQuotas(){this.acceptQuotas({})}updateContextKeys(){let e=this._quotas.chat?.percentRemaining===0,t=this._quotas.premiumChat?.unlimited?this._quotas.premiumChat.hasQuota===!1:this._quotas.premiumChat?.percentRemaining===0,o=this._quotas.additionalUsageEnabled??!1;this.chatQuotaExceededContextKey.set(e||t&&!o),this.completionsQuotaExceededContextKey.set(this._quotas.completions?.percentRemaining===0)}get sentiment(){return{completed:this.contextKeyService.getContextKeyValue(Xn.Setup.completed.key)===!0,installed:this.contextKeyService.getContextKeyValue(Xn.Setup.installed.key)===!0,hidden:this.contextKeyService.getContextKeyValue(Xn.Setup.hidden.key)===!0,disabledInWorkspace:this.contextKeyService.getContextKeyValue(Xn.Setup.disabledInWorkspace.key)===!0,disabled:this.contextKeyService.getContextKeyValue(Xn.Setup.disabled.key)===!0,untrusted:this.contextKeyService.getContextKeyValue(Xn.Setup.untrusted.key)===!0,later:this.contextKeyService.getContextKeyValue(Xn.Setup.later.key)===!0,registered:this.contextKeyService.getContextKeyValue(Xn.Setup.registered.key)===!0}}get anonymous(){return jbi(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):Xn.Setup.hidden.bindTo(this.contextKeyService).set(e)}async update(e){await this.requests?.value.forceResolveEntitlement(e)}};C3=I([m(0,F),m(1,Ze),m(2,Mt),m(3,X),m(4,B),m(5,_e),m(6,re),m(7,de)],C3);function G9o(a){let i={resetDate:a.quota_reset_date_utc??a.quota_reset_date??a.limited_user_reset_date,resetDateHasTime:typeof a.quota_reset_date_utc=="string",usageBasedBilling:a.token_based_billing,canUpgradePlan:a.can_upgrade_plan};if(a.monthly_quotas?.chat&&typeof a.limited_user_quotas?.chat=="number"&&(i.chat={percentRemaining:Math.min(100,Math.max(0,a.limited_user_quotas.chat/a.monthly_quotas.chat*100)),unlimited:!1}),a.monthly_quotas?.completions&&typeof a.limited_user_quotas?.completions=="number"&&(i.completions={percentRemaining:Math.min(100,Math.max(0,a.limited_user_quotas.completions/a.monthly_quotas.completions*100)),unlimited:!1}),a.quota_snapshots){for(let t of["chat","completions","premium_interactions"]){let o=a.quota_snapshots[t];if(!o)continue;let n=o.entitlement!==void 0?Number(o.entitlement):void 0;if(!o.unlimited&&n===0)continue;let r={percentRemaining:Math.min(100,Math.max(0,o.percent_remaining)),unlimited:o.unlimited,hasQuota:o.has_quota,usageBasedBilling:a.token_based_billing,resetAt:o.quota_reset_at||void 0,entitlement:n!==void 0&&Number.isSafeInteger(n)&&n>=0?n:void 0};switch(t){case"chat":i.chat=r;break;case"completions":i.completions=r;break;case"premium_interactions":i.premiumChat=r;break}}let e=a.quota_snapshots.premium_interactions;i.additionalUsageEnabled=e?.overage_permitted??!1,i.additionalUsageCount=e?.overage_count??0}return i}var kYe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.context=e;this.chatQuotasAccessor=t;this.telemetryService=o;this.logService=n;this.requestService=r;this.dialogService=s;this.openerService=l;this.lifecycleService=c;this.defaultAccountService=u;this.authenticationService=p;this.pendingResolveCts=new qe;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 qe,t=await this.defaultAccountService.getDefaultAccount();if(e.token.isCancellationRequested)return;let o;t?this.state.entitlement===1&&(o={entitlement:2}):o={entitlement:1},o&&this.update(o),t&&await this.resolveEntitlement(t,e.token)}async resolveEntitlement(e,t){let o=await this.doResolveEntitlement(e,t);return typeof o?.entitlement=="number"&&!t.isCancellationRequested&&this.update(o),o}async doResolveEntitlement(e,t){if(t.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 n;o.access_type_sku==="free_limited_copilot"?n=5:o.access_type_sku==="free_educational_quota"?n=10:o.can_signup_for_limited?n=3:o.copilot_plan==="individual_edu"?n=10:o.copilot_plan==="individual"?n=6:o.copilot_plan==="individual_pro"?n=7:o.copilot_plan==="individual_max"?n=11:o.copilot_plan==="business"?n=8:o.copilot_plan==="enterprise"?n=9:n=4;let r={entitlement:n,organisations:o.organization_login_list,quotas:this.toQuotas(o),sku:o.access_type_sku,copilotTrackingId:o.analytics_tracking_id};return this.logService.trace(`[chat entitlement]: resolved to ${r.entitlement}, quotas: ${JSON.stringify(r.quotas)}`),this.telemetryService.publicLog2("chatInstallEntitlement",{entitlement:r.entitlement,tid:o.analytics_tracking_id,sku:r.sku,quotaChat:r.quotas?.chat?.percentRemaining,quotaPremiumChat:r.quotas?.premiumChat?.percentRemaining,quotaCompletions:r.quotas?.completions?.percentRemaining,quotaResetDate:r.quotas?.resetDate,usageBasedBilling:r.quotas?.usageBasedBilling,additionalUsageEnabled:r.quotas?.additionalUsageEnabled,additionalUsageCount:r.quotas?.additionalUsageCount}),r}toQuotas(e){return G9o(e)}async request(e,t,o,n,r,s){let l;for(let c of n){if(r.isCancellationRequested)return l;try{let u=await this.requestService.request({type:t,url:e,data:t==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${c.accessToken}`},callSite:s},r),p=u.res.statusCode;if(p&&p!==200){l=u;continue}return u}catch(u){r.isCancellationRequested||this.logService.error(`[chat entitlement] request: error ${u}`)}}return l}update(e){this.state=e,this.context.update({entitlement:this.state.entitlement,organisations:this.state.organisations,sku:this.state.sku,copilotTrackingId:this.state.copilotTrackingId}),e.quotas&&this.chatQuotasAccessor.acceptQuotas(e.quotas)}async forceResolveEntitlement(e=Ie.None){let t=await this.defaultAccountService.refresh({forceRefresh:!0});if(t)return this.resolveEntitlement(t,e)}async signUpFree(){let e=await this.getSessions();if(e.length!==0)return this.doSignUpFree(e)}async doSignUpFree(e){let t={restricted_telemetry:this.telemetryService.telemetryLevel===0?"disabled":"enabled",public_code_suggestions:"enabled"},o=await this.request(oPt.entitlementSignupLimitedUrl,"POST",t,e,Ie.None,"chatEntitlementService.signUpFree");if(!o)return await this.onUnknownSignUpError(d(18709,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 jD(o);if(l){let c=JSON.parse(l);if(typeof c.message=="string"&&c.message)return this.onUnprocessableSignUpError(`[chat entitlement] sign-up: unprocessable entity (${c.message})`,c.message),{errorCode:o.res.statusCode}}}catch{}return await this.onUnknownSignUpError(d(18710,null,o.res.statusCode),`[chat entitlement] sign-up: unexpected status code ${o.res.statusCode}`)?this.doSignUpFree(e):{errorCode:o.res.statusCode}}let n=null;try{n=await jD(o)}catch{}if(!n)return await this.onUnknownSignUpError(d(18708,null),"[chat entitlement] sign-up: response has no content")?this.doSignUpFree(e):{errorCode:2};let r;try{r=JSON.parse(n),this.logService.trace(`[chat entitlement] sign-up: response is ${n}`)}catch(s){return await this.onUnknownSignUpError(d(18707,null),`[chat entitlement] sign-up: error parsing response (${s})`)?this.doSignUpFree(e):{errorCode:3}}return this.update({entitlement:5}),!!r?.subscribed}async getSessions(){let e=await this.defaultAccountService.getDefaultAccount();if(e){let o=(await this.authenticationService.getSessions(e.authenticationProvider.id)).filter(n=>n.id===e.sessionId);if(o.length)return o}return[...await this.authenticationService.getSessions(this.defaultAccountService.getDefaultAccountAuthenticationProvider().id)]}async onUnknownSignUpError(e,t){if(this.logService.error(t),!this.lifecycleService.willShutdown){let{confirmed:o}=await this.dialogService.confirm({type:wt.Error,message:d(18711,null),detail:e,primaryButton:d(18706,null)});return o}return!1}onUnprocessableSignUpError(e,t){this.logService.error(e),this.lifecycleService.willShutdown||this.dialogService.prompt({type:wt.Error,message:d(18712,null),detail:t,buttons:[{label:d(18698,null),run:()=>{}},{label:d(18697,null),run:()=>this.openerService.open(A.parse(oPt.upgradePlanUrl))}]})}async signIn(e){let t=await this.defaultAccountService.signIn({additionalScopes:e?.additionalScopes,extraAuthorizeParameters:{get_started_with:"copilot-vscode"},provider:e?.useSocialProvider});if(!t)return{};let o=await this.doResolveEntitlement(t,Ie.None);return{defaultAccount:t,entitlements:o}}dispose(){this.pendingResolveCts.dispose(!0),super.dispose()}};kYe=I([m(2,_e),m(3,re),m(4,Ra),m(5,ct),m(6,Je),m(7,to),m(8,Nd),m(9,ks)],kYe);var oN=class extends k{constructor(e,t,o,n,r){super();this.storageService=t;this.logService=o;this.configurationService=n;this.telemetryService=r;this.suspendedState=void 0;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.updateBarrier=void 0;this._forceHidden=!1;this.canSignUpContextKey=Xn.Entitlement.canSignUp.bindTo(e),this.signedOutContextKey=Xn.Entitlement.signedOut.bindTo(e),this.freeContextKey=Xn.Entitlement.planFree.bindTo(e),this.eduContextKey=Xn.Entitlement.planEdu.bindTo(e),this.proContextKey=Xn.Entitlement.planPro.bindTo(e),this.proPlusContextKey=Xn.Entitlement.planProPlus.bindTo(e),this.maxContextKey=Xn.Entitlement.planMax.bindTo(e),this.businessContextKey=Xn.Entitlement.planBusiness.bindTo(e),this.enterpriseContextKey=Xn.Entitlement.planEnterprise.bindTo(e),this.organisationsContextKey=Xn.Entitlement.organisations.bindTo(e),this.isInternalContextKey=Xn.Entitlement.internal.bindTo(e),this.skuContextKey=Xn.Entitlement.sku.bindTo(e),this.completedContext=Xn.Setup.completed.bindTo(e),this.hiddenContext=Xn.Setup.hidden.bindTo(e),this.disabledInWorkspaceContext=Xn.Setup.disabledInWorkspace.bindTo(e),this.laterContext=Xn.Setup.later.bindTo(e),this.installedContext=Xn.Setup.installed.bindTo(e),this.disabledContext=Xn.Setup.disabled.bindTo(e),this.untrustedContext=Xn.Setup.untrusted.bindTo(e),this.registeredContext=Xn.Setup.registered.bindTo(e),this._state=this.storageService.getObject(oN.CHAT_ENTITLEMENT_CONTEXT_STORAGE_KEY,0)??{entitlement:1,organisations:void 0,sku:void 0,copilotTrackingId:void 0},this.storageService.getBoolean(oN.CHAT_ENTITLEMENT_CONTEXT_MIGRATED_STORAGE_KEY,0)===!0||(this.storageService.store(oN.CHAT_ENTITLEMENT_CONTEXT_MIGRATED_STORAGE_KEY,!0,0,1),this._state.installed&&!this._state.completed&&(this._state.completed=!0,this.storageService.store(oN.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"}static{this.CHAT_DISABLED_CONFIGURATION_KEY="chat.disableAIFeatures"}get state(){return this.withConfiguration(this.suspendedState??this._state)}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(oN.CHAT_DISABLED_CONFIGURATION_KEY)&&this.updateContext()}))}withConfiguration(e){return this._forceHidden||this.configurationService.getValue(oN.CHAT_DISABLED_CONFIGURATION_KEY)===!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 t=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.sku=e.sku,this._state.copilotTrackingId=e.copilotTrackingId,this._state.entitlement===5||O0(this._state.entitlement)?this._state.registered=!0:this._state.entitlement===3&&(this._state.registered=!1)),jbi(this.configurationService,this._state.entitlement,this._state)&&(this._state.sku="no_auth_limited_copilot"),t!==JSON.stringify(this._state))return this.storageService.store(oN.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(!!e.organisations?.some(t=>t==="github"||t==="microsoft"||t==="ms-copilot"||t==="MicrosoftCopilot")),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)}`),tao(e,this.configurationService,this.telemetryService),this._onDidChange.fire()}suspend(){this.suspendedState={...this._state},this.updateBarrier=new ip}resume(){this.suspendedState=void 0,this.updateBarrier?.open(),this.updateBarrier=void 0}};oN=I([m(0,X),m(1,de),m(2,re),m(3,B),m(4,_e)],oN);Ce(dr,C3,0);function iao(a){if(a.restrictedValue!==void 0)return a.restrictedValue;switch(a.type){case"boolean":return!1;case"number":return 0;case"string":return""}}var q_e=le("policy"),kZ=class extends k{constructor(){super(...arguments);this.policyDefinitions={};this.policies=new Map;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event}async updatePolicyDefinitions(e){let t=Object.keys(this.policyDefinitions).length;return this.policyDefinitions={...e,...this.policyDefinitions},t!==Object.keys(this.policyDefinitions).length&&await this._updatePolicyDefinitions(this.policyDefinitions),yt.reduce(this.policies.entries(),(o,[n,r])=>({...o,[n]:r}),{})}getPolicyValue(e){return this.policies.get(e)}serialize(){return yt.reduce(Object.entries(this.policyDefinitions),(e,[t,o])=>({...e,[t]:{definition:o,value:this.policies.get(t)}}),{})}},rPt=class{constructor(){this.onDidChange=U.None;this.policyDefinitions={}}async updatePolicyDefinitions(){return{}}getPolicyValue(){}serialize(){}};var EYe="ChatApprovedAccountOrganizations";var sPt=new Y("chatAccountPolicyGateActive",!1,{type:"boolean",description:d(19178,null)}),j_e=le("accountPolicyGateService"),$_e=class extends kZ{constructor(e,t,o){super();this.logService=e;this.defaultAccountService=t;this._gateInfo={state:"inactive"};this._onDidChangeGateInfo=this._register(new T);this.onDidChangeGateInfo=this._onDidChangeGateInfo.event;this.managedPolicyReader=o,this._updatePolicyDefinitions(this.policyDefinitions),this._register(this.defaultAccountService.onDidChangePolicyData(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})),this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})),this.managedPolicyReader&&this._register(this.managedPolicyReader.onDidChange(n=>{n.includes(EYe)&&this._updatePolicyDefinitions(this.policyDefinitions)})),this.defaultAccountService.getDefaultAccount().then(()=>{this._updatePolicyDefinitions(this.policyDefinitions)})}get gateInfo(){return this._gateInfo}async _updatePolicyDefinitions(e){this.logService.trace(`AccountPolicyService#_updatePolicyDefinitions: Got ${Object.keys(e).length} policy definitions`);let t=[],o=this.defaultAccountService.policyData,n=this._gateInfo;this._gateInfo=this.computeGateInfo();let r=n.approvedOrganizations?.join(`
`)??"",s=this._gateInfo.approvedOrganizations?.join(`
`)??"",l=n.state!==this._gateInfo.state||n.reason!==this._gateInfo.reason||r!==s,c=this._gateInfo.state==="restricted"&&this._gateInfo.reason!=="policyNotResolved";for(let u in e){let p=e[u],h;c&&(p.value!==void 0||p.restrictedValue!==void 0)?h=iao(p):o&&p.value&&(h=p.value(o)),h!==void 0?this.policies.get(u)!==h&&(this.policies.set(u,h),t.push(u)):this.policies.delete(u)&&t.push(u)}t.length&&this._onDidChange.fire(t),l&&this._onDidChangeGateInfo.fire(this._gateInfo)}computeGateInfo(){if(!this.managedPolicyReader)return{state:"inactive"};let e=this.managedPolicyReader.getPolicyValue(EYe),t=q9o(e);if(t.length===0)return{state:"inactive"};let o=this.defaultAccountService.currentDefaultAccount;if(!o)return{state:"restricted",reason:"noAccount",approvedOrganizations:t};let n=this.defaultAccountService.getDefaultAccountAuthenticationProvider();return o.authenticationProvider.id!==n.id?{state:"restricted",reason:"wrongProvider",approvedOrganizations:t}:!t.includes("*")&&!(o.entitlementsData?.organization_login_list??[]).map(l=>l.toLowerCase()).some(l=>t.includes(l))?{state:"restricted",reason:"orgNotApproved",approvedOrganizations:t}:this.defaultAccountService.policyData===null?{state:"restricted",reason:"policyNotResolved",approvedOrganizations:t}:{state:"satisfied",approvedOrganizations:t}}};$_e=I([m(0,re),m(1,Nd)],$_e);function q9o(a){let i=a;if(typeof i=="string")try{i=JSON.parse(i)}catch{}return Array.isArray(i)?i.filter(e=>typeof e=="string").map(e=>e.trim().toLowerCase()).filter(e=>e.length>0):[]}var _d;(s=>(s.CopilotCLI="copilotcli",s.CopilotCloud="copilot-cloud-agent",s.Local="local",s.ClaudeCode="claude-code",s.Codex="openai-codex",s.Growth="copilot-growth",s.AgentHostCopilot="agent-host-copilot"))(_d||={});function x3(a){return a===_d.AgentHostCopilot||a.startsWith("agent-host-")||a.startsWith("remote-")}var kl=_d.Local,k3;(o=>{function a(n){return new Map(Object.entries(n))}o.fromRecord=a;function i(n){let r=Object.create(null),s=t(n);for(let[l,c]of s)r[l]=c;return r}o.toRecord=i;function e(n){if(!n)return;let r=t(n);return Array.from(r,([s,l])=>({optionId:s,value:typeof l=="string"?l:l.id}))}o.toStrValueArray=e;function t(n){return n instanceof Map?n:Object.entries(n)}})(k3||={});var Ms=le("chatSessionsService");function Rx(a){return a===2||a===3}function oao(a){let i=a;return i&&i.uri instanceof A&&typeof i.insertions=="number"&&typeof i.deletions=="number"}var wc=(t=>(t.Ask="ask",t.Edit="edit",t.Agent="agent",t))(wc||{}),TH=(t=>(t.Default="default",t.AutoApprove="autoApprove",t.Autopilot="autopilot",t))(TH||{}),$9o=new Set(Object.values(TH));function nao(a){return $9o.has(a)}function Mpe(a){return a==="autoApprove"||a==="autopilot"}var Ps=(o=>(o.Chat="panel",o.Terminal="terminal",o.Notebook="notebook",o.EditorInline="editor",o))(Ps||{});(i=>{function a(e){switch(e){case"panel":return"panel";case"terminal":return"terminal";case"notebook":return"notebook";case"editor":return"editor"}return"panel"}i.fromRaw=a})(Ps||={});var j9o=new Set([Q.vscodeChatEditor,Q.walkThrough,Q.vscodeLocalChatSession,Q.vscodeSettings,Q.webviewPanel,Q.vscodeUserData,Q.extension,"ccreq","openai-codex"]);function Q_e(a,i){let e=a.get(Ms);return!(j9o.has(i)||e.getContentProviderSchemes().includes(i))}var TYe="workbench.action.chat.manage",Y_e="workbench.action.openWorkspaceInAgentsWindow",rao="workbench.action.openAgentsWindow",_Ye=C.and(Xn.Setup.hidden.negate(),Xn.Setup.disabledInWorkspace.negate(),qo.negate(),C.has("config.chat.agent.enabled"),Qf.negate()),sao=30;var X_e=new Y("inModelsEditor",!1),aPt=new Y("inModelsSearch",!1),EZ="General Purpose";var Z;($n=>{$n.responseVote=new Y("chatSessionResponseVote","",{type:"string",description:d(9317,null)}),$n.responseDetectedAgentCommand=new Y("chatSessionResponseDetectedAgentOrCommand",!1,{type:"boolean",description:d(9295,null)}),$n.responseSupportsIssueReporting=new Y("chatResponseSupportsIssueReporting",!1,{type:"boolean",description:d(9286,null)}),$n.responseIsFiltered=new Y("chatSessionResponseFiltered",!1,{type:"boolean",description:d(9285,null)}),$n.responseHasError=new Y("chatSessionResponseError",!1,{type:"boolean",description:d(9284,null)}),$n.requestInProgress=new Y("chatSessionRequestInProgress",!1,{type:"boolean",description:d(9316,null)}),$n.hasActiveRequest=new Y("chatSessionHasActiveRequest",!1,{type:"boolean",description:d(9287,null)}),$n.currentlyEditing=new Y("chatSessionCurrentlyEditing",!1,{type:"boolean",description:d(9314,null)}),$n.currentlyEditingInput=new Y("chatSessionCurrentlyEditingInput",!1,{type:"boolean",description:d(9315,null)});let c;(Mye=>(Mye.Sent="s",Mye.Queue="q",Mye.Steer="st"))(c=$n.EditingRequestType||={}),$n.editingRequestType=new Y("chatEditingSentRequest",void 0,{type:"string",description:d(9257,null)}),$n.isResponse=new Y("chatResponse",!1,{type:"boolean",description:d(9283,null)}),$n.isRequest=new Y("chatRequest",!1,{type:"boolean",description:d(9281,null)}),$n.isFirstRequest=new Y("chatFirstRequest",!1,{type:"boolean",description:d(9259,null)}),$n.isPendingRequest=new Y("chatRequestIsPending",!1,{type:"boolean",description:d(9282,null)}),$n.itemId=new Y("chatItemId","",{type:"string",description:d(9268,null)}),$n.lastItemId=new Y("chatLastItemId",[],{type:"string",description:d(9269,null)}),$n.editApplied=new Y("chatEditApplied",!1,{type:"boolean",description:d(9251,null)}),$n.inputHasText=new Y("chatInputHasText",!1,{type:"boolean",description:d(9313,null)}),$n.inputHasFocus=new Y("chatInputHasFocus",!1,{type:"boolean",description:d(9312,null)}),$n.inChatInput=new Y("inChatInput",!1,{type:"boolean",description:d(9310,null)}),$n.inChatSession=new Y("inChat",!1,{type:"boolean",description:d(9304,null)}),$n.inChatQuestionCarousel=new Y("inChatQuestionCarousel",!1,{type:"boolean",description:d(9306,null)}),$n.chatQuestionCarouselHasTerminal=new Y("chatQuestionCarouselHasTerminal",!1,{type:"boolean",description:d(9279,null)}),$n.inChatEditor=new Y("inChatEditor",!1,{type:"boolean",description:d(9305,null)}),$n.inChatTodoList=new Y("inChatTodoList",!1,{type:"boolean",description:d(9309,null)}),$n.inChatTip=new Y("inChatTip",!1,{type:"boolean",description:d(9308,null)}),$n.multipleChatTips=new Y("multipleChatTips",!1,{type:"boolean",description:d(9320,null)}),$n.inChatTerminalToolOutput=new Y("inChatTerminalToolOutput",!1,{type:"boolean",description:d(9307,null)}),$n.chatModeKind=new Y("chatAgentKind","ask",{type:"string",description:d(9236,null)}),$n.chatPermissionLevel=new Y("chatPermissionLevel","default",{type:"string",description:d(9278,null)}),$n.chatModeName=new Y("chatModeName","",{type:"string",description:d(9272,null)}),$n.chatModelId=new Y("chatModelId","",{type:"string",description:d(9270,null)}),$n.supported=C.or(Mu.negate(),Qb.notEqualsTo(""),C.has("config.chat.experimental.serverlessWebEnabled")),$n.enabled=new Y("chatIsEnabled",!1,{type:"boolean",description:d(9266,null)}),$n.accountPolicyGateActive=sPt,$n.lockedToCodingAgent=new Y("lockedToCodingAgent",!1,{type:"boolean",description:d(9319,null)}),$n.lockedCodingAgentId=new Y("lockedCodingAgentId","",{type:"string",description:d(9318,null)}),$n.chatSessionHasCustomAgentTarget=new Y("chatSessionHasCustomAgentTarget",!1,{type:"boolean",description:d(9288,null)}),$n.chatSessionHasTargetedModels=new Y("chatSessionHasTargetedModels",!1,{type:"boolean",description:d(9292,null)}),$n.agentSupportsAttachments=new Y("agentSupportsAttachments",!1,{type:"boolean",description:d(9248,null)}),$n.withinEditSessionDiff=new Y("withinEditSessionDiff",!1,{type:"boolean",description:d(9322,null)}),$n.filePartOfEditSession=new Y("filePartOfEditSession",!1,{type:"boolean",description:d(9301,null)}),$n.extensionParticipantRegistered=new Y("chatPanelExtensionParticipantRegistered",!1,{type:"boolean",description:d(9275,null)}),$n.panelParticipantRegistered=new Y("chatPanelParticipantRegistered",!1,{type:"boolean",description:d(9277,null)}),$n.chatEditingCanUndo=new Y("chatEditingCanUndo",!1,{type:"boolean",description:d(9253,null)}),$n.chatEditingCanRedo=new Y("chatEditingCanRedo",!1,{type:"boolean",description:d(9252,null)}),$n.languageModelsAreUserSelectable=new Y("chatModelsAreUserSelectable",!1,{type:"boolean",description:d(9271,null)}),$n.nonCopilotLanguageModelsAreUserSelectable=new Y("chatNonCopilotModelsAreUserSelectable",!1,{type:"boolean",description:d(9274,null)}),$n.chatSessionHasModels=new Y("chatSessionHasModels",!1,{type:"boolean",description:d(9291,null)}),$n.chatSessionOptionsValid=new Y("chatSessionOptionsValid",!0,{type:"boolean",description:d(9294,null)}),$n.extensionInvalid=new Y("chatExtensionInvalid",!1,{type:"boolean",description:d(9258,null)}),$n.inputCursorAtTop=new Y("chatCursorAtTop",!1),$n.inputHasAgent=new Y("chatInputHasAgent",!1),$n.location=new Y("chatLocation",void 0),$n.inQuickChat=new Y("quickChatHasFocus",!1,{type:"boolean",description:d(9311,null)}),$n.inAgentSessionsWelcome=new Y("inAgentSessionsWelcome",!1,{type:"boolean",description:d(9303,null)}),$n.chatSessionType=new Y("chatSessionType","",{type:"string",description:d(9298,null)}),$n.hasFileAttachments=new Y("chatHasFileAttachments",!1,{type:"boolean",description:d(9263,null)}),$n.chatSessionIsEmpty=new Y("chatSessionIsEmpty",!0,{type:"boolean",description:d(9293,null)}),$n.hasPendingRequests=new Y("chatHasPendingRequests",!1,{type:"boolean",description:d(9264,null)}),$n.chatSessionHasDebugData=new Y("chatSessionHasDebugData",!1,{type:"boolean",description:d(9289,null)}),$n.chatSessionHasDebugTools=new Y("chatSessionHasDebugTools",!1,{type:"boolean",description:d(9290,null)}),$n.remoteJobCreating=new Y("chatRemoteJobCreating",!1,{type:"boolean",description:d(9280,null)}),$n.hasRemoteCodingAgent=new Y("hasRemoteCodingAgent",!1,d(9302,null)),$n.hasCanDelegateProviders=new Y("chatHasCanDelegateProviders",!1,{type:"boolean",description:d(9262,null)}),$n.enableRemoteCodingAgentPromptFileOverlay=new Y("enableRemoteCodingAgentPromptFileOverlay",!1,d(9300,null)),$n.skipChatRequestInProgressMessage=new Y("chatSkipRequestInProgressMessage",!1,{type:"boolean",description:d(9299,null)}),$n.Setup=Xn.Setup,$n.Entitlement=Xn.Entitlement,$n.chatQuotaExceeded=Xn.chatQuotaExceeded,$n.completionsQuotaExceeded=Xn.completionsQuotaExceeded,$n.Editing={hasToolConfirmation:new Y("chatHasToolConfirmation",!1,{type:"boolean",description:d(9256,null)}),hasElicitationRequest:new Y("chatHasElicitationRequest",!1,{type:"boolean",description:d(9254,null)}),hasQuestionCarousel:new Y("chatHasQuestionCarousel",!1,{type:"boolean",description:d(9255,null)})},$n.Tools={toolsCount:new Y("toolsCount",0,{type:"number",description:d(9321,null)})},$n.foregroundSessionCount=new Y("chatForegroundSessionCount",0,{type:"number",description:d(9260,null)}),$n.Modes={hasCustomChatModes:new Y("chatHasCustomAgents",!1,{type:"boolean",description:d(9261,null)}),agentModeDisabledByPolicy:new Y("chatAgentModeDisabledByPolicy",!1,{type:"boolean",description:d(9249,null)})},$n.panelLocation=new Y("chatPanelLocation",void 0,{type:"number",description:d(9276,null)}),$n.agentSessionsViewerFocused=new Y("agentSessionsViewerFocused",!0,{type:"boolean",description:d(9243,null)}),$n.agentSessionsViewerOrientation=new Y("agentSessionsViewerOrientation",void 0,{type:"number",description:d(9244,null)}),$n.agentSessionsViewerPosition=new Y("agentSessionsViewerPosition",void 0,{type:"number",description:d(9245,null)}),$n.agentSessionsViewerVisible=new Y("agentSessionsViewerVisible",void 0,{type:"boolean",description:d(9246,null)}),$n.agentSessionType=new Y("chatSessionType","",{type:"string",description:d(9247,null)}),$n.chatSessionSupportsDelegation=new Y("chatSessionSupportsDelegation",!0,{type:"boolean",description:d(9296,null)}),$n.chatSessionSupportsFork=new Y("chatSessionSupportsFork",!1,{type:"boolean",description:d(9297,null)}),$n.agentSessionSection=new Y("agentSessionSection","",{type:"string",description:d(9242,null)}),$n.isArchivedAgentSession=new Y("agentSessionIsArchived",!1,{type:"boolean",description:d(9239,null)}),$n.isPinnedAgentSession=new Y("agentSessionIsPinned",!1,{type:"boolean",description:d(9240,null)}),$n.isReadAgentSession=new Y("agentSessionIsRead",!1,{type:"boolean",description:d(9241,null)}),$n.hasMultipleAgentSessionsSelected=new Y("agentSessionHasMultipleSelected",!1,{type:"boolean",description:d(9238,null)}),$n.hasAgentSessionChanges=new Y("agentSessionHasChanges",!1,{type:"boolean",description:d(9237,null)}),$n.isKatexMathElement=new Y("chatIsKatexMathElement",!1,{type:"boolean",description:d(9267,null)}),$n.hasUsedCreateSlashCommands=new Y("chatHasUsedCreateSlashCommands",!1,{type:"boolean",description:d(9265,null)}),$n.contextUsageHasBeenOpened=new Y("chatContextUsageHasBeenOpened",!1,{type:"boolean",description:d(9250,null)}),$n.newChatButtonExperimentIcon=new Y("chatNewChatButtonExperimentIcon","",{type:"string",description:d(9273,null)})})(Z||={});var Lx;(e=>(e.inEditingMode=C.or(Z.chatModeKind.isEqualTo("edit"),Z.chatModeKind.isEqualTo("agent")),e.isAgentHostSession=C.or(C.regex(Z.lockedCodingAgentId.key,/^agent-host-/),C.regex(Z.lockedCodingAgentId.key,/^remote-/))))(Lx||={});var _H=le("ILanguageModelsConfigurationService");var RYe="copilot";var Mx;(t=>{function a(o){return(typeof o.capabilities?.agentMode>"u"||o.capabilities.agentMode)&&!!o.capabilities?.toolCalling}t.suitableForAgentMode=a;function i(o){return`${o.name} (${o.vendor})`}t.asQualifiedName=i;function e(o,n){return n.vendor===RYe&&o===n.name?!0:o===i(n)}t.matchesQualifiedName=e})(Mx||={});function dao(a){if(typeof a!="object"||a===null)return!1;let i=a;return(i.name===void 0||typeof i.name=="string")&&(i.id===void 0||typeof i.id=="string")&&(i.vendor===void 0||typeof i.vendor=="string")&&(i.version===void 0||typeof i.version=="string")&&(i.family===void 0||typeof i.family=="string")&&(i.tokens===void 0||typeof i.tokens=="number")&&(i.extension===void 0||typeof i.extension=="object")}var Gr=le("ILanguageModelsService"),aao={type:"object",required:["vendor","displayName"],properties:{vendor:{type:"string",description:d(9365,null)},displayName:{type:"string",description:d(9361,null)},configuration:{type:"object",description:d(9359,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:d(9360,null)}}}},additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#",properties:{secret:{type:"boolean",description:d(9360,null)}}}}}]},managementCommand:{type:"string",description:d(9363,null),deprecated:!0,deprecationMessage:d(9364,null)},when:{type:"string",description:d(9367,null)}}},Q9o=zn.registerExtensionPoint({extensionPoint:"languageModelChatProviders",jsonSchema:{description:d(9358,null),oneOf:[aao,{type:"array",items:aao}]},activationEventsGenerator:function*(a){for(let i of a)yield`onLanguageModelChatProvider:${i.vendor}`}}),lao="chatModelRecentlyUsed",cao="chatModelPinned",DYe="copilot/auto",Qbi="chat.participantNameRegistry",Ybi="chat.modelsControl",E3=class{constructor(i,e,t,o,n,r,s,l,c){this._extensionService=i;this._logService=e;this._storageService=t;this._contextKeyService=o;this._languageModelsConfigurationService=n;this._quickInputService=r;this._secretStorageService=s;this._productService=l;this._requestService=c;this._store=new O;this._providers=new Map;this._vendors=new Map;this._onDidChangeLanguageModelVendors=this._store.add(new T);this.onDidChangeLanguageModelVendors=this._onDidChangeLanguageModelVendors.event;this._modelsGroups=new Map;this._modelCache=new Map;this._resolveLMSequencer=new II;this._modelConfigurations=new Map;this._onLanguageModelChange=this._store.add(new T);this.onDidChangeLanguageModels=this._onLanguageModelChange.event;this._recentlyUsedModelIds=[];this._pinnedModelIds=[];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._modelsControlManifest={free:{},paid:{}};this._chatControlDisposed=!1;this._restrictedChatParticipants=De(this,Object.create(null));this.restrictedChatParticipants=this._restrictedChatParticipants;this._hasUserSelectableModels=Z.languageModelsAreUserSelectable.bindTo(o),this._hasNonCopilotUserSelectableModels=Z.nonCopilotLanguageModelsAreUserSelectable.bindTo(o),this._recentlyUsedModelIds=this._readRecentlyUsedModels(),this._pinnedModelIds=this._readPinnedModels(),this._initChatControlData(),this._store.add(this.onDidChangeLanguageModels(()=>{let u=!1,p=!1;for(let h of this._modelCache.values())if(h.isUserSelectable!==!1&&(u=!0,h.vendor!==RYe)){p=!0;break}this._hasUserSelectableModels.set(u),this._hasNonCopilotUserSelectableModels.set(p),this._refreshModelsControlManifest()})),this._store.add(this._languageModelsConfigurationService.onDidChangeLanguageModelGroups(u=>this._onDidChangeLanguageModelGroups(u))),this._store.add(Q9o.setHandler((u,{added:p,removed:h})=>{let g=[],f=[];for(let v of p)for(let b of yt.wrap(v.value)){if(this._vendors.has(b.vendor)){v.collector.error(d(9366,null,b.vendor));continue}if(_c(b.vendor)){v.collector.error(d(9362,null));continue}if(b.vendor.trim()!==b.vendor){v.collector.error(d(9368,null));continue}g.push(b)}for(let v of h)for(let b of yt.wrap(v.value))f.push(b);this.deltaLanguageModelChatProviderDescriptors(g,f)}))}static{this.SECRET_KEY_PREFIX="chat.lm.secret."}static{this.SECRET_INPUT="${input:{0}}"}deltaLanguageModelChatProviderDescriptors(i,e){let t=[],o=[];for(let n of i){if(this._vendors.has(n.vendor)){this._logService.error(`The vendor '${n.vendor}' is already registered and cannot be registered twice`);continue}if(_c(n.vendor)){this._logService.error("The vendor field cannot be empty.");continue}if(n.vendor.trim()!==n.vendor){this._logService.error("The vendor field cannot start or end with whitespace.");continue}let r={vendor:n.vendor,displayName:n.displayName,configuration:n.configuration,managementCommand:n.managementCommand,when:n.when,isDefault:n.vendor===RYe};this._vendors.set(n.vendor,r),t.push(n.vendor)}for(let n of e)this._vendors.delete(n.vendor),this._providers.delete(n.vendor),this._clearModelCache(n.vendor),this._modelsGroups.delete(n.vendor),o.push(n.vendor);for(let[n,r]of this._providers)this._vendors.has(n)||this._providers.delete(n);if((t.length>0||o.length>0)&&(this._onDidChangeLanguageModelVendors.fire([...t,...o]),o.length>0))for(let n of o)this._onLanguageModelChange.fire(n)}async _onDidChangeLanguageModelGroups(i){let e=new Set(i.map(t=>t.vendor));await Promise.all(Array.from(e).map(t=>this._resolveAllLanguageModels(t,!0)))}getVendors(){return Array.from(this._vendors.values()).filter(i=>{if(!i.when)return!0;let e=C.deserialize(i.when);return e?this._contextKeyService.contextMatchesRules(e):!1})}getLanguageModelIds(){return Array.from(this._modelCache.keys())}lookupLanguageModel(i){return this._modelCache.get(i)}lookupLanguageModelByQualifiedName(i){for(let[e,t]of this._modelCache.entries())if(Mx.matchesQualifiedName(i,t))return{metadata:t,identifier:e}}async _resolveAllLanguageModels(i,e){let t=this._vendors.get(i);if(!t)return;let o=this._providers.get(i);if(o||(await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${i}`),o=this._providers.get(i)),!o){this._logService.warn(`[LM] No provider registered for vendor ${i}`);return}return this._resolveLMSequencer.queue(i,async()=>{let n=[],r=[];try{let h=await o.provideLanguageModelChatInfo({silent:e},Ie.None);if(h.length){n.push(...h);let g=[];for(let f of h)t.isDefault?f.metadata.isUserSelectable!==!1?g.push(f.identifier):this._logService.trace(`[LM] Skipping model ${f.identifier} from model picker as it is not user selectable.`):g.push(f.identifier);r.push({modelIdentifiers:g})}}catch(h){r.push({modelIdentifiers:[],status:{message:Dn(h),severity:wt.Error}})}let s=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),l=new Map;for(let h of s){if(h.vendor!==i)continue;if(!t.configuration&&n.length>0){if(h.settings)for(let f of n){let v=h.settings[f.metadata.id];v&&l.set(f.identifier,{...v})}r.push({group:h,modelIdentifiers:[]});continue}let g=await this._resolveConfiguration(h,t.configuration);try{let f=await o.provideLanguageModelChatInfo({group:h.name,silent:e,configuration:g},Ie.None);if(f.length){for(let v=0;v<f.length;v++)f[v].metadata.detail||(f[v]={...f[v],metadata:{...f[v].metadata,detail:h.name}});n.push(...f),r.push({group:h,modelIdentifiers:f.map(v=>v.identifier)})}if(h.settings)for(let v of f){let b=h.settings[v.metadata.id];b&&l.set(v.identifier,{...b})}}catch(f){r.push({group:h,modelIdentifiers:[],status:{message:Dn(f),severity:wt.Error}})}}let c=this._modelsGroups.get(i)??[];this._modelsGroups.set(i,r);let u=this._clearModelCache(i),p=!1;for(let h of n){if(this._modelCache.has(h.identifier)){this._logService.warn(`[LM] Model ${h.identifier} is already registered. Skipping.`);continue}this._modelCache.set(h.identifier,h.metadata),p=p||!Qi(u.get(h.identifier),h.metadata),u.delete(h.identifier)}this._logService.trace(`[LM] Resolved language models for vendor ${i}`,n),p=p||u.size>0,p||(p=this._hasGroupStructureChanged(c,r)),this._clearModelConfigurations(i);for(let[h,g]of l)this._modelCache.has(h)&&this._modelConfigurations.set(h,g);p?this._onLanguageModelChange.fire(i):this._logService.trace(`[LM] No changes in language models for vendor ${i}`)})}_hasGroupStructureChanged(i,e){if(i.length!==e.length)return!0;for(let t=0;t<i.length;t++){let o=i[t],n=e[t];if(o.group?.name!==n.group?.name||o.group?.vendor!==n.group?.vendor||o.status?.message!==n.status?.message||o.status?.severity!==n.status?.severity||o.modelIdentifiers.length!==n.modelIdentifiers.length)return!0}return!1}getLanguageModelGroups(i){return this._modelsGroups.get(i)??[]}hasResolvedVendor(i){return this._modelsGroups.has(i)}async selectLanguageModels(i){if(i.vendor)await this._resolveAllLanguageModels(i.vendor,!0);else{let t=Array.from(this._vendors.keys());await Promise.all(t.map(o=>this._resolveAllLanguageModels(o,!0)))}let e=[];for(let[t,o]of this._modelCache)(i.vendor===void 0||o.vendor===i.vendor)&&(i.family===void 0||o.family===i.family)&&(i.version===void 0||o.version===i.version)&&(i.id===void 0||o.id===i.id)&&e.push(t);return this._logService.trace("[LM] selected language models",i,e),e}registerLanguageModelProvider(i,e){if(this._logService.trace("[LM] registering language model provider",i,e),!this._vendors.has(i))throw new Error(`Chat model provider uses UNKNOWN vendor ${i}.`);if(this._providers.has(i))throw new Error(`Chat model provider for vendor ${i} is already registered.`);this._providers.set(i,e);let t=e.onDidChange(()=>{this._resolveAllLanguageModels(i,!0)});return ee(()=>{this._logService.trace("[LM] UNregistered language model provider",i),this._clearModelCache(i),this._modelsGroups.delete(i),this._providers.delete(i),t.dispose()})}async sendChatRequest(i,e,t,o,n){let r=this._modelCache.get(i),s=this._providers.get(r?.vendor||"");if(!s)throw new Error(`Chat provider for model ${i} is not registered.`);let l=this.getModelConfiguration(i),c=l?{...o,configuration:{...l,...o.configuration}}:o;return s.sendChatRequest(i,t,e,c,n)}_resolveModelConfigurationWithDefaults(i,e){let t=this._modelConfigurations.get(i),o=e?.configurationSchema;if(!o?.properties&&!t)return;let n={};if(o?.properties)for(let[r,s]of Object.entries(o.properties))s.default!==void 0&&(n[r]=s.default);if(!(!t&&Object.keys(n).length===0))return{...n,...t}}computeTokenLength(i,e,t){let o=this._modelCache.get(i);if(!o)throw new Error(`Chat model ${i} could not be found.`);let n=this._providers.get(o.vendor);if(!n)throw new Error(`Chat provider for model ${i} is not registered.`);return n.provideTokenCount(i,e,t)}getModelConfiguration(i){let e=this._modelCache.get(i);return this._resolveModelConfigurationWithDefaults(i,e)}async setModelConfiguration(i,e){let t=this._modelCache.get(i);if(!t)return;let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),n;n=o.find(c=>c.vendor===t.vendor&&c.settings?.[t.id]!==void 0),n||(n=o.find(c=>c.vendor===t.vendor));let s={...this._modelConfigurations.get(i)??{},...e},l=t.configurationSchema;if(l?.properties)for(let[c,u]of Object.entries(s)){let p=l.properties[c];p?.default!==void 0&&p.default===u&&delete s[c]}if(n){let c=n.settings??{},u;Object.keys(s).length===0?(u={...c},delete u[t.id]):u={...c,[t.id]:s};let p={...n,settings:Object.keys(u).length>0?u:void 0};!p.settings&&Object.keys(p).filter(h=>h!=="name"&&h!=="vendor"&&h!=="range"&&h!=="settings").length===0?await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(n):await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(n,p)}else if(Object.keys(s).length>0){let c=this._vendors.get(t.vendor);if(!c)return;let u={name:c.displayName,vendor:t.vendor,settings:{[t.id]:s}};await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(u)}Object.keys(s).length>0?this._modelConfigurations.set(i,s):this._modelConfigurations.delete(i),this._onLanguageModelChange.fire(t.vendor)}getModelConfigurationActions(i){let t=this._modelCache.get(i)?.configurationSchema;if(!t?.properties)return[];let o=[],n=this._modelConfigurations.get(i)??{};for(let[r,s]of Object.entries(t.properties)){if(!s.enum||!Array.isArray(s.enum)||s.enum.length<2)continue;let l=n[r]??s.default,c=(typeof s.title=="string"?s.title:void 0)??r.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,f=>f.toUpperCase()),u=s.default,p=s.enumItemLabels,h=s.enumDescriptions,g=s.enum.map((f,v)=>{let b=p?.[v]??String(f),S=f===u?d(9354,null,b):b,y=h?.[v]??"";return{id:`configureModel.${r}.${f}`,label:S,class:void 0,enabled:!0,tooltip:y,checked:l===f,run:()=>this.setModelConfiguration(i,{[r]:f})}});o.push(new sa(`configureModel.${r}`,c,g))}return o}async configureLanguageModelsProviderGroup(i,e){let t=this.getVendors().find(({vendor:l})=>l===i);if(!t)throw new Error(`Vendor ${i} not found.`);if(t.managementCommand){await this._resolveAllLanguageModels(t.vendor,!1);return}let o=this._languageModelsConfigurationService.getLanguageModelsProviderGroups(),n=o.find(l=>l.vendor===i&&l.name===e),r=await this.promptForName(o,t,n);if(!r)return;let s=n?await this._resolveConfiguration(n,t.configuration):void 0;try{let l=t.configuration?await this.promptForConfiguration(r,t.configuration,s):void 0;if(t.configuration&&!l)return;let c=await this._resolveLanguageModelProviderGroup(r,i,l,t.configuration),u=n?await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(n,c):await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(c);if(t.configuration&&this.requireConfiguring(t.configuration)){let p=this.getSnippetForFirstUnconfiguredProperty(l??{},t.configuration);await this._languageModelsConfigurationService.configureLanguageModels({group:u,snippet:p})}}catch(l){if(Yi(l))return;throw l}}async configureModel(i){let e=this._modelCache.get(i);if(!e||!e.configurationSchema)return;let t=this._modelsGroups.get(e.vendor),o;if(t){for(let r of t)if(r.modelIdentifiers.includes(i)&&r.group){o=r.group;break}}if(!o){let r=this.getVendors().find(c=>c.vendor===e.vendor);if(!r)return;let l={name:r.displayName,vendor:e.vendor,settings:{[e.id]:{}}};o=await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(l),await this._resolveAllLanguageModels(e.vendor,!0)}let n=this._getModelConfigurationSnippet(e.id,e.configurationSchema);await this._languageModelsConfigurationService.configureLanguageModels({group:o,snippet:n})}_getModelConfigurationSnippet(i,e){let t=[];if(e.properties)for(let[n,r]of Object.entries(e.properties))if(r.defaultSnippets?.[0]){let s=r.defaultSnippets[0],l=s.bodyText??JSON.stringify(s.body,null,"			");l=l.replace(/"(\^[^"]*)"/g,(c,u)=>u.substring(1)),t.push(`			"${n}": ${l}`)}else r.default!==void 0?t.push(`			"${n}": ${JSON.stringify(r.default)}`):t.push(`			"${n}": \${${n}}`);let o=t.length>0?`{
${t.join(`,
`)}
		}`:`{
			$0
		}`;return`"settings": {
		"${i}": ${o}
	}`}async addLanguageModelsProviderGroup(i,e,t){let o=this.getVendors().find(({vendor:r})=>r===e);if(!o)throw new Error(`Vendor ${e} not found.`);let n=await this._resolveLanguageModelProviderGroup(i,e,t,o.configuration);await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(n)}async removeLanguageModelsProviderGroup(i,e){let t=this.getVendors().find(({vendor:r})=>r===i);if(!t)throw new Error(`Vendor ${i} not found.`);let n=this._languageModelsConfigurationService.getLanguageModelsProviderGroups().find(r=>r.vendor===i&&r.name===e);if(!n)throw new Error(`Language model provider group ${e} for vendor ${i} not found.`);await this._deleteSecretsInConfiguration(n,t.configuration),await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(n)}requireConfiguring(i){if(i.additionalProperties)return!0;if(!i.properties)return!1;for(let e of Object.keys(i.properties))if(!this.canPromptForProperty(i.properties[e]))return!0;return!1}getSnippetForFirstUnconfiguredProperty(i,e){if(e.properties){for(let t of Object.keys(e.properties))if(i[t]===void 0){let o=e.properties[t];if(o&&typeof o!="boolean"&&o.defaultSnippets?.[0]){let n=o.defaultSnippets[0],r=n.bodyText??JSON.stringify(n.body,null,"	");return r=r.replace(/"(\^[^"]*)"/g,(s,l)=>l.substring(1)),`"${t}": ${r}`}}}}async promptForName(i,e,t){let o=t?.name;if(!o){o=e.displayName;let s=1;for(;i.some(l=>l.vendor===e.vendor&&l.name===o);)s++,o=`${e.displayName} ${s}`}let n,r=new O;try{await new Promise(s=>{let l=r.add(this._quickInputService.createInputBox());l.title=d(9350,null),l.placeholder=d(9353,null),l.value=o,l.ignoreFocusOut=!0,r.add(l.onDidChangeValue(c=>{if(!c){l.validationMessage=d(9351,null),l.severity=wt.Error;return}if(!t&&i.some(u=>u.name===c)){l.validationMessage=d(9355,null),l.severity=wt.Error;return}l.validationMessage=void 0,l.severity=wt.Ignore})),r.add(l.onDidAccept(async()=>{n=l.value,l.hide()})),r.add(l.onDidHide(()=>s())),l.show()})}finally{r.dispose()}return n}async promptForConfiguration(i,e,t){if(!e.properties)return;let o=t?{...t}:{};for(let n of Object.keys(e.properties)){let r=e.properties[n],s=!!e.required?.includes(n),l=await this.promptForValue(i,n,r,s,t);l!==void 0&&(o[n]=l)}return o}async promptForValue(i,e,t,o,n){if(!t||!this.canPromptForProperty(t))return;if(t.type==="array"&&t.items&&!Array.isArray(t.items)&&t.items.enum){let s=await this.promptForArray(i,e,t);return s===void 0?void 0:s}if(t.type==="string"&&Array.isArray(t.enum)&&t.enum.length>0)return this.promptForEnum(i,e,t,n);let r=await this.promptForInput(i,e,t,o,n);if(r!==void 0)return r}canPromptForProperty(i){return!i||typeof i=="boolean"?!1:!!(i.type==="array"&&i.items&&!Array.isArray(i.items)&&i.items.enum||i.type==="string"||i.type==="number"||i.type==="integer"||i.type==="boolean")}getDescriptionPlaintext(i){if(i.description)return i.description;let e=i.markdownDescription;if(e)return e.replace(/`([^`]+)`/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1")}async promptForArray(i,e,t){if(!t.items||Array.isArray(t.items)||!t.items.enum)return;let o=t.items.enum,n=new O;try{return await new Promise(r=>{let s=n.add(this._quickInputService.createQuickPick());s.title=`${i}: ${t.title??e}`,s.items=o.map(l=>({label:l})),s.placeholder=this.getDescriptionPlaintext(t)??d(9356,null,e),s.canSelectMany=!0,s.ignoreFocusOut=!0,n.add(s.onDidAccept(()=>{r(s.selectedItems.map(l=>l.label)),s.hide()})),n.add(s.onDidHide(()=>{r(void 0)})),s.show()})}finally{n.dispose()}}async promptForEnum(i,e,t,o){let n=t.enum;if(!Array.isArray(n)||n.length===0)return;let r=t.enumDescriptions,s=o?.[e]!==void 0?String(o[e]):t.default!==void 0?String(t.default):void 0,l=n.map((u,p)=>({label:String(u),description:r?.[p],id:String(u)})),c=new O;try{return await new Promise(u=>{let p=c.add(this._quickInputService.createQuickPick());if(p.title=`${i}: ${t.title??e}`,p.items=l,p.placeholder=this.getDescriptionPlaintext(t)??d(9356,null,e),p.ignoreFocusOut=!0,s!==void 0){let h=l.find(g=>g.id===s);h&&(p.activeItems=[h])}c.add(p.onDidAccept(()=>{let h=p.selectedItems[0];u(h?.id),p.hide()})),c.add(p.onDidHide(()=>{u(void 0)})),p.show()})}finally{c.dispose()}}async promptForInput(i,e,t,o,n){let r=new O;try{let s=c=>{if(!c&&o)return d(9357,null)},l=await new Promise((c,u)=>{let p=r.add(this._quickInputService.createInputBox());p.title=`${i}: ${t.title??e}`,p.placeholder=d(9352,null,e),p.password=!!t.secret,p.ignoreFocusOut=!0,n?.[e]?p.value=String(n?.[e]):t.default&&(p.value=String(t.default));let h=this.getDescriptionPlaintext(t);h&&(p.prompt=h),r.add(p.onDidChangeValue(g=>{let f=s(g);f?(p.validationMessage=f,p.severity=wt.Error):(p.validationMessage=void 0,p.severity=wt.Ignore)})),r.add(p.onDidAccept(()=>{let g=s(p.value);if(g){p.validationMessage=g,p.severity=wt.Error;return}c(p.value),p.hide()})),r.add(p.onDidHide(g=>{g.reason===2?u(new qi):c(void 0)})),p.show()});return l?t.type==="number"||t.type==="integer"?Number(l):t.type==="boolean"?l==="true":l:void 0}finally{r.dispose()}}encodeSecretKey(i){return Wd(E3.SECRET_INPUT,i)}decodeSecretKey(i){if(We(i))return i.substring(i.indexOf(":")+1,i.length-1)}_clearModelCache(i){let e=new Map;for(let[t,o]of this._modelCache.entries())o.vendor===i&&(e.set(t,o),this._modelCache.delete(t));return e}_clearModelConfigurations(i){for(let[e]of this._modelConfigurations)(this._modelCache.get(e)?.vendor===i||e.startsWith(`${i}/`))&&this._modelConfigurations.delete(e)}async _resolveConfiguration(i,e){if(!e)return{};let t={};for(let o in i){if(o==="vendor"||o==="name"||o==="range"||o==="settings")continue;let n=i[o];if(e.properties?.[o]?.secret){let r=this.decodeSecretKey(n);n=r?await this._secretStorageService.get(r):void 0}t[o]=n}return t}async _resolveLanguageModelProviderGroup(i,e,t,o){if(!o)return{name:i,vendor:e};let n={};for(let r in t){let s=t[r];if(o.properties?.[r]?.secret&&We(s)){let l=`${E3.SECRET_KEY_PREFIX}${Lr(ht()).toString(16)}`;await this._secretStorageService.set(l,s),s=this.encodeSecretKey(l)}n[r]=s}return{name:i,vendor:e,...n}}async _deleteSecretsInConfiguration(i,e){if(!e)return;let{vendor:t,name:o,range:n,...r}=i;for(let s in r){let l=i[s];if(e.properties?.[s]?.secret){let c=this.decodeSecretKey(l);c&&await this._secretStorageService.delete(c)}}}async migrateLanguageModelsProviderGroup(i){let{vendor:e,name:t,...o}=i;if(!this._vendors.get(e))throw new Error(`Vendor ${e} not found.`);await this._extensionService.activateByEvent(`onLanguageModelChatProvider:${e}`);let n=this._providers.get(e);if(!n)throw new Error(`Chat model provider for vendor ${e} is not registered.`);await n.provideLanguageModelChatInfo({group:t,silent:!1,configuration:o},Ie.None),await this.addLanguageModelsProviderGroup(t,e,o)}_readRecentlyUsedModels(){return this._storageService.getObject(lao,0,[])}_saveRecentlyUsedModels(){this._storageService.store(lao,this._recentlyUsedModelIds,0,0)}getRecentlyUsedModelIds(){return this._recentlyUsedModelIds.filter(i=>this._modelCache.has(i)&&i!==DYe).slice(0,4)}addToRecentlyUsedList(i){if(i===DYe)return;let e=this._recentlyUsedModelIds.indexOf(i);e!==-1&&this._recentlyUsedModelIds.splice(e,1),this._recentlyUsedModelIds.unshift(i),this._recentlyUsedModelIds.length>20&&(this._recentlyUsedModelIds.length=20),this._saveRecentlyUsedModels()}clearRecentlyUsedList(){this._recentlyUsedModelIds=[],this._saveRecentlyUsedModels()}_readPinnedModels(){return this._storageService.getObject(cao,0,[])}_savePinnedModels(){this._storageService.store(cao,this._pinnedModelIds,0,0)}getPinnedModelIds(){return this._pinnedModelIds.filter(i=>i!==DYe&&this._modelCache.has(i))}pinModel(i){i===DYe||this._pinnedModelIds.includes(i)||(this._pinnedModelIds.push(i),this._savePinnedModels(),this._onDidChangePinnedModels.fire())}unpinModel(i){let e=this._pinnedModelIds.indexOf(i);e!==-1&&(this._pinnedModelIds.splice(e,1),this._savePinnedModels(),this._onDidChangePinnedModels.fire())}isModelPinned(i){return i!==DYe&&this._pinnedModelIds.includes(i)}getModelsControlManifest(){return this._modelsControlManifest}_setModelsControlManifest(i){this._modelsControlRawResponse=i,this._refreshModelsControlManifest()}_refreshModelsControlManifest(){let i=this._modelsControlRawResponse,e={},t={};if(i?.free){let o=Array.isArray(i.free)?i.free:Object.values(i.free);for(let n of o)!n||!Di(n)||(e[n.id]={label:n.label,featured:n.featured,exists:this._modelCache.has(`copilot/${n.id}`)})}if(i?.paid){let o=Array.isArray(i.paid)?i.paid:Object.values(i.paid);for(let n of o)!n||!Di(n)||(t[n.id]={label:n.label,featured:n.featured,minVSCodeVersion:n.minVSCodeVersion,exists:this._modelCache.has(`copilot/${n.id}`)})}this._modelsControlManifest={free:e,paid:t},this._onDidChangeModelsControlManifest.fire(this._modelsControlManifest)}_initChatControlData(){if(this._chatControlUrl=this._productService.chatParticipantRegistry,!this._chatControlUrl)return;let i=this._storageService.get(Qbi,-1);try{this._restrictedChatParticipants.set(JSON.parse(i??"{}"),void 0)}catch{this._storageService.remove(Qbi,-1)}let e=this._storageService.get(Ybi,-1);try{let t=JSON.parse(e??"{}");Di(t)&&this._setModelsControlManifest(t)}catch{this._storageService.remove(Ybi,-1)}this._refreshChatControlData()}_refreshChatControlData(){this._chatControlDisposed||this._fetchChatControlData().catch(i=>this._logService.warn("Failed to fetch chat control data",i)).then(()=>Li(300*1e3)).then(()=>this._refreshChatControlData())}async _fetchChatControlData(){this._logService.trace("[LM] Fetching chat control data from",this._chatControlUrl);let i;try{i=await this._requestService.request({type:"GET",url:this._chatControlUrl,callSite:"languageModels.fetchChatControlData"},Ie.None)}catch(o){this._logService.warn("[LM] Failed to request chat control data",Dn(o));return}if(i.res.statusCode!==200){this._logService.warn(`[LM] Chat control data request failed with status ${i.res.statusCode}`);return}let e;try{e=await Th(i)}catch(o){this._logService.warn("[LM] Failed to parse chat control response",Dn(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 t=e.restrictedChatParticipants;this._restrictedChatParticipants.set(t,void 0),this._storageService.store(Qbi,JSON.stringify(t),-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(Ybi,JSON.stringify(e.models),-1,1))}dispose(){this._chatControlDisposed=!0,this._store.dispose(),this._providers.clear()}};E3=I([m(0,lt),m(1,re),m(2,de),m(3,X),m(4,_H),m(5,$e),m(6,fC),m(7,Ze),m(8,Ra)],E3);var mE=le("IAuthenticationAccessService"),LYe=class extends k{constructor(e,t){super();this._storageService=e;this._productService=t;this._onDidChangeExtensionSessionAccess=this._register(new T);this.onDidChangeExtensionSessionAccess=this._onDidChangeExtensionSessionAccess.event}isAccessAllowed(e,t,o){let n=this._productService.trustedExtensionAuthAccess,r=hi.toKey(o);if(Array.isArray(n)){if(n.includes(r))return!0}else if(n?.[e]?.includes(r))return!0;let l=this.readAllowedExtensions(e,t).find(c=>c.id===r);if(l)return l.allowed!==void 0?l.allowed:!0}readAllowedExtensions(e,t){let o=[];try{let s=this._storageService.get(`${e}-${t}`,-1);s&&(o=JSON.parse(s))}catch{}let n=this._productService.trustedExtensionAuthAccess,r=Array.isArray(n)?n:typeof n=="object"?n[e]??[]:[];for(let s of r){let l=hi.toKey(s),c=o.find(u=>u.id===l);c?(c.allowed=!0,c.trusted=!0):o.push({id:l,name:s,allowed:!0,trusted:!0})}return o}updateAllowedExtensions(e,t,o){let n=this.readAllowedExtensions(e,t);for(let s of o){let l=hi.toKey(s.id),c=n.findIndex(u=>u.id===l);c===-1?n.push({...s,id:l}):(n[c].allowed=s.allowed,s.name&&s.name!==l&&n[c].name!==s.name&&(n[c].name=s.name))}let r=n.filter(s=>!s.trusted);this._storageService.store(`${e}-${t}`,JSON.stringify(r),-1,0),this._onDidChangeExtensionSessionAccess.fire({providerId:e,accountName:t})}removeAllowedExtensions(e,t){this._storageService.remove(`${e}-${t}`,-1),this._onDidChangeExtensionSessionAccess.fire({providerId:e,accountName:t})}};LYe=I([m(0,de),m(1,Ze)],LYe);Ce(mE,LYe,1);var lPt=class{constructor(i,e,t,o,n,r,s){this._chatProviderService=e;this._logService=t;this._authenticationService=o;this._authenticationAccessService=n;this._extensionService=r;this._ignoredFilesService=s;this._store=new O;this._providerRegistrations=new Ot;this._lmProviderChange=new T;this._pendingProgress=new Map;this._ignoredFileProviderRegistrations=new Ot;this._proxy=i.getProxy(ao.ExtHostChatProvider)}dispose(){this._lmProviderChange.dispose(),this._providerRegistrations.dispose(),this._ignoredFileProviderRegistrations.dispose(),this._store.dispose()}$registerLanguageModelProvider(i){let e=new O;try{e.add(this._chatProviderService.registerLanguageModelProvider(i,{onDidChange:U.filter(this._lmProviderChange.event,t=>t.vendor===i,e),provideLanguageModelChatInfo:async(t,o)=>{let n=await this._proxy.$provideLanguageModelChatInfo(i,t,o);return n.forEach(r=>{r.metadata.auth&&e.add(this._registerAuthenticationProvider(r.metadata.extension,r.metadata.auth))}),n},sendChatRequest:async(t,o,n,r,s)=>{let l=Math.random()*1e6|0,c=new Mo,u=new dbt;try{this._pendingProgress.set(l,{defer:c,stream:u}),await Promise.all(o.flatMap(p=>p.content).filter(p=>p.type==="image_url").map(async p=>{p.value.data=Ke.wrap(await JA(p.value.data.buffer))})),await this._proxy.$startChatRequest(t,l,n,new Hg(o),r,s)}catch(p){throw this._pendingProgress.delete(l),p}return{result:c.p,stream:u.asyncIterable}},provideTokenCount:(t,o,n)=>this._proxy.$provideTokenLength(t,o,n)})),this._providerRegistrations.set(i,e)}catch(t){throw e.dispose(),t}}$onLMProviderChange(i){this._lmProviderChange.fire({vendor:i})}async $reportResponsePart(i,e){let t=this._pendingProgress.get(i);this._logService.trace("[LM] report response PART",!!t,i,e),t&&t.stream.emitOne(e.value)}async $reportResponseDone(i,e){let t=this._pendingProgress.get(i);if(this._logService.trace("[LM] report response DONE",!!t,i,e),t)if(this._pendingProgress.delete(i),e){let o=ZLt.tryDeserialize(e)??eY(e);t.stream.reject(o),t.defer.error(o)}else t.stream.resolve(),t.defer.complete(void 0)}$unregisterProvider(i){this._providerRegistrations.deleteAndDispose(i)}$selectChatModels(i){return this._chatProviderService.selectLanguageModels(i)}async $tryStartChatRequest(i,e,t,o,n,r){this._logService.trace("[CHAT] request STARTED",i.value,t);let s;try{s=await this._chatProviderService.sendChatRequest(e,i,o.value,n,r)}catch(c){throw this._logService.error("[CHAT] request FAILED",i.value,t,c),c}let l=(async()=>{try{for await(let c of s.stream)this._logService.trace("[CHAT] request PART",i.value,t,c),await this._proxy.$acceptResponsePart(t,new Hg(c));this._logService.trace("[CHAT] request DONE",i.value,t)}catch(c){this._logService.error("[CHAT] extension request ERRORED in STREAM",Mn(c,!0),i.value,t),this._proxy.$acceptResponseDone(t,Aj(c))}})();Promise.allSettled([s.result,l]).then(()=>{this._logService.debug("[CHAT] extension request DONE",i.value,t),this._proxy.$acceptResponseDone(t,void 0)},c=>{this._logService.error("[CHAT] extension request ERRORED",Mn(c,!0),i.value,t),this._proxy.$acceptResponseDone(t,Aj(c))})}$countTokens(i,e,t){return this._chatProviderService.computeTokenLength(i,e,t)}_registerAuthenticationProvider(i,e){let t=iN+i.value;if(this._authenticationService.getProviderIds().includes(t))return k.None;let o=e.accountLabel??d(3943,null),n=new O,r=new Xbi(t,e.providerLabel,o);return this._authenticationService.registerAuthenticationProvider(t,r),n.add(ee(()=>{this._authenticationService.unregisterAuthenticationProvider(t),r.dispose()})),n.add(this._authenticationAccessService.onDidChangeExtensionSessionAccess(async s=>{let l=this._authenticationAccessService.readAllowedExtensions(t,o),c=[];for(let u of l){let p=await this._extensionService.getExtension(u.id);p&&c.push({from:p.identifier,to:i,enabled:u.allowed??!0})}this._proxy.$updateModelAccesslist(c)})),n}$fileIsIgnored(i,e){return this._ignoredFilesService.fileIsIgnored(A.revive(i),e)}$registerFileIgnoreProvider(i){this._ignoredFileProviderRegistrations.set(i,this._ignoredFilesService.registerIgnoredFileProvider({isFileIgnored:async(e,t)=>this._proxy.$isFileIgnored(i,e,t)}))}$unregisterFileIgnoreProvider(i){this._ignoredFileProviderRegistrations.deleteAndDispose(i)}};lPt=I([fo(Xi.MainThreadLanguageModels),m(1,Gr),m(2,re),m(3,ks),m(4,mE),m(5,lt),m(6,H_e)],lPt);var Xbi=class{constructor(i,e,t){this.id=i;this.label=e;this._accountLabel=t;this.supportsMultipleAccounts=!1;this._onDidChangeSessions=new T;this.onDidChangeSessions=this._onDidChangeSessions.event}async getSessions(i){return i===void 0&&!this._session?[]:this._session?[this._session]:[await this.createSession(i||[])]}async createSession(i){return this._session=this._createFakeSession(i),this._onDidChangeSessions.fire({added:[this._session],changed:[],removed:[]}),this._session}removeSession(i){return this._session&&(this._onDidChangeSessions.fire({added:[],changed:[],removed:[this._session]}),this._session=void 0),Promise.resolve()}confirmation(i,e){return d(3942,null,i,this.label)}_createFakeSession(i){return{id:"fake-session",account:{id:this.id,label:this._accountLabel},accessToken:"fake-access-token",scopes:i}}dispose(){this._onDidChangeSessions.dispose()}};var Z_e="copilot";var Lt=le("chatWidgetService"),XD=Symbol("ChatViewPaneTarget"),JD=le("quickChatService"),F0=le("chatAccessibilityService");function tw(a){return typeof a.viewId=="string"}function Ppe(a){return!tw(a)}var TZ=le("chatCodeBlockContextProviderService"),Xr=`workbench.panel.chat.view.${Z_e}`,T3="workbench.panel.chat",cPt=new Y("hasInstalledAgentPlugins",!1),_Z="workbench.views.agentPlugins.installed";var Br;(r=>{r.scheme=Q.vscodeLocalChatSession;function i(s){let l=gc(Ke.wrap(new TextEncoder().encode(s)),!1,!0);return A.from({scheme:r.scheme,authority:kl,path:"/"+l})}r.forSession=i;function e(){let s=Math.floor(Math.random()*1e9);return i(`chat-${s}`)}r.getNewSessionUri=e;function t(s){let l=n(s);return l?.chatSessionType===kl?l.sessionId:void 0}r.parseLocalSessionId=t;function o(s){return!!t(s)}r.isLocalSession=o;function n(s){if(s.scheme!==r.scheme||!s.authority)return;let l=s.path.split("/");if(l.length!==2)return;let c=s.authority,u=Ws(l[1]);return{chatSessionType:c,sessionId:new TextDecoder().decode(u.buffer)}}})(Br||={});function jp(a){let i=Br.parseLocalSessionId(a);return i||a.toString()}function yn(a){return a.scheme===Q.vscodeChatEditor?kl:a.scheme===Br.scheme?a.authority||kl:a.scheme}function ZD(a){return a.path.startsWith("/untitled-")}var zo=(s=>(s[s.Local=_d.Local]="Local",s[s.Background=_d.CopilotCLI]="Background",s[s.Cloud=_d.CopilotCloud]="Cloud",s[s.Claude=_d.ClaudeCode]="Claude",s[s.Codex=_d.Codex]="Codex",s[s.Growth=_d.Growth]="Growth",s[s.AgentHostCopilot=_d.AgentHostCopilot]="AgentHostCopilot",s))(zo||{});function uao(a){return a===zo.Local||a===zo.Background||a===zo.Cloud||a===zo.Claude}function Kg(a){let i=A.isUri(a)?yn(a):a;switch(i){case zo.Local:case zo.Background:case zo.Cloud:case zo.Claude:case zo.Codex:case zo.AgentHostCopilot:return i;default:return}}function sb(a){switch(a){case zo.Local:return d(6762,null);case zo.Background:return d(6760,null);case zo.Cloud:return d(6761,null);case zo.Claude:return"Claude";case zo.Codex:return"Codex";case zo.Growth:return"Growth";case zo.AgentHostCopilot:return"Copilot CLI [Local]";default:return a}}function n_(a){switch(a){case zo.Local:return L.vm;case zo.Background:return L.copilot;case zo.Cloud:return L.cloud;case zo.Codex:return L.openai;case zo.Claude:return L.claude;case zo.Growth:return L.lightbulb;case zo.AgentHostCopilot:return L.vscodeInsiders;default:return L.extensions}}function MYe(a){return a.quality==="stable"?L.vscode:L.vscodeInsiders}function dPt(a){switch(a){case zo.Local:case zo.Background:case zo.Cloud:case zo.AgentHostCopilot:return!0;case zo.Claude:case zo.Codex:case zo.Growth:return!1;default:return!1}}function uPt(a){switch(a){case zo.Local:case zo.Background:case zo.Cloud:return!0;case zo.Claude:case zo.Codex:case zo.Growth:case zo.AgentHostCopilot:return!1;default:return!1}}function Jbi(a){switch(a){case zo.Local:return d(6759,null);case zo.Background:return d(6754,null);case zo.Cloud:return d(6756,null);case zo.Claude:return d(6755,null);case zo.Codex:return d(6757,null);case zo.Growth:return d(6758,null);case zo.AgentHostCopilot:return"Run a Copilot SDK agent in a dedicated process.";default:return""}}var iTa=te("agentSessionReadIndicator.foreground",{dark:ni(xo,.2),light:ni(xo,.2),hcDark:null,hcLight:null},d(6751,null)),oTa=te("agentSessionSelectedBadge.border",{dark:ni(ID,.3),light:ni(ID,.3),hcDark:xo,hcLight:xo},d(6752,null)),nTa=te("agentSessionSelectedUnfocusedBadge.border",{dark:ni(xo,.3),light:ni(xo,.3),hcDark:xo,hcLight:xo},d(6753,null)),eDe="agentSession.rename",tDe="agentSession.delete";var eSi="chat-dynamic-variable",ab=class extends k{constructor(e,t){super();this.widget=e;this.labelService=t;this._variables=[];this.decorationData=[];this._editorListener=this._register(new ue);this._subscribeToEditor(),this._register(e.onDidChangeActiveInputEditor(()=>{this._subscribeToEditor(),this.updateDecorations()}))}static{this.ID="chatDynamicVariableModel"}get variables(){return[...this._variables]}get id(){return ab.ID}_subscribeToEditor(){this._editorListener.value=this.widget.inputEditor.onDidChangeModelContent(e=>{let t=[],o=!1;this._variables=ui(this._variables.map((n,r)=>{let s=this.widget.inputEditor.getModel();if(!s)return t.push(n),null;let l=this.decorationData[r];if(!l)return t.push(n),null;let c=s.getDecorationRange(l.id);return c?s.getValueInRange(c)!==l.text?(this.widget.inputEditor.executeEdits(this.id,[{range:c,text:""}]),this.widget.refreshParsedInput(),t.push(n),null):c.equalsRange(n.range)?n:(o=!0,{...n,range:c}):(t.push(n),null)})),je(t.filter(Sd)),(o||t.length>0)&&this.widget.refreshParsedInput(),this.updateDecorations()})}getInputState(e){e[ab.ID]=this.variables}setInputState(e){let t=e[ab.ID];Array.isArray(t)||(t=[]),this.disposeVariables(),this._variables=[];for(let o of t)X9o(o)&&this.addReference(o)}addReference(e){Zbi(e.range)&&(this._variables.push(e),this.updateDecorations(),this.widget.refreshParsedInput())}updateDecorations(){let e=this.widget.inputEditor.getModel();if(!e){this.decorationData=[];return}let t=this._variables.filter(n=>Zbi(n.range)),o=this.widget.inputEditor.setDecorationsByType("chat",eSi,t.map(n=>({range:n.range,hoverMessage:this.getHoverForReference(n)})));this._variables=t.slice(0,o.length),this.decorationData=[];for(let n=0;n<o.length;n++)this.decorationData.push({id:o[n],text:e.getValueInRange(this._variables[n].range)})}getHoverForReference(e){let t=e.data;if(A.isUri(t))return new he(this.labelService.getUriLabel(t,{relative:!0}));if(Bp(t)){let o=e.fullName?` ${e.fullName}`:"",n=`#${t.range.startLineNumber}-${t.range.endLineNumber}`;return new he(o+this.labelService.getUriLabel(t.uri,{relative:!0})+n)}else return}disposeVariables(){for(let e of this._variables)Sd(e)&&e.dispose()}dispose(){this.disposeVariables(),super.dispose()}};ab=I([m(1,nt)],ab);function X9o(a){return a&&typeof a.id=="string"&&G.isIRange(a.range)&&Zbi(a.range)&&"data"in a}function Zbi(a){return!(a.startLineNumber<1||a.endLineNumber<1||a.startColumn<1||a.endColumn<1||a.startLineNumber>a.endLineNumber||a.startLineNumber===a.endLineNumber&&a.startColumn>=a.endColumn)}function J9o(a){return"widget"in a&&"range"in a&&"variableData"in a}var PYe=class a extends z{static{this.ID="workbench.action.chat.addDynamicVariable"}constructor(){super({id:a.ID,title:""})}async run(i,...e){let t=e[0];if(!J9o(t))return;let o=t.range,n=t.variableData,r=()=>{t.widget.inputEditor.executeEdits("chatInsertDynamicVariableWithArguments",[{range:t.range,text:""}])};if(t.command){let l=await i.get(fe).executeCommand(t.command.id,...t.command.arguments??[]);if(!l){r();return}let c=":"+l,u=new G(o.startLineNumber,o.endColumn,o.endLineNumber,o.endColumn+c.length);if(o=new G(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn+c.length),!t.widget.inputEditor.executeEdits("chatInsertDynamicVariableWithArguments",[{range:u,text:c+" "}])){r();return}}t.widget.getContrib(ab.ID)?.addReference({id:t.id,range:o,isFile:!0,data:n})}};W(PYe);var pao="code/chat/",pPt=new Map,W0={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 V0(a,i){let e=jp(a),t=`${pao}${e}/${i}`,o=pPt.get(e);o||(o=new Set,pPt.set(e,o)),o.add(t),Wo(t)}function tSi(a){let i=jp(a),e=pPt.get(i);if(e){for(let t of e)neo(t);pPt.delete(i)}}var iSi={WillWaitForActivation:"willWaitForActivation",DidWaitForActivation:"didWaitForActivation"};function oSi(a){Wo(`${pao}${a}`)}var gr=le("chatAgentService"),iDe=class extends k{constructor(e,t){super();this.contextKeyService=e;this.configurationService=t;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=Z.enabled.bindTo(this.contextKeyService),this._extensionAgentRegistered=Z.extensionParticipantRegistered.bindTo(this.contextKeyService),this._defaultAgentRegistered=Z.panelParticipantRegistered.bindTo(this.contextKeyService),this._register(e.onDidChangeContext(o=>{o.affectsSome(this._agentsContextKeys)&&this._updateContextKeys()}))}static{this.AGENT_LEADER="@"}registerAgent(e,t){if(this.getAgent(e))throw new Error(`Agent already registered: ${JSON.stringify(e)}`);let n=this,r=t.slashCommands;t={...t,get slashCommands(){return r.filter(l=>!l.when||n.contextKeyService.contextMatchesRules(C.deserialize(l.when)))}};let s={data:t};return this._agents.set(e,s),this._updateAgentsContextKeys(),this._updateContextKeys(),this._onDidChangeAgents.fire(void 0),ee(()=>{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 t=C.deserialize(e.data.when);for(let o of t?.keys()||[])this._agentsContextKeys.add(o)}}_updateContextKeys(){let e=!1,t=!1,o=!1;for(let n of this.getAgents())n.isDefault&&(n.isCore||(e=!0),n.id==="chat.setup"||n.id==="github.copilot.editsAgent"?o=!0:t=!0);this._defaultAgentRegistered.set(t),this._extensionAgentRegistered.set(e),o!==this._hasToolsAgent&&(this._hasToolsAgent=o,this._onDidChangeAgents.fire(this.getDefaultAgent("panel","agent")))}registerAgentImplementation(e,t){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=t,this._onDidChangeAgents.fire(new oDe(o.data,t)),ee(()=>{o.impl=void 0,this._onDidChangeAgents.fire(void 0),o.data.isDefault&&this._hasDefaultAgent.set(yt.some(this._agents.values(),n=>n.data.isDefault&&!!n.impl))})}registerDynamicAgent(e,t){e.isDynamic=!0;let o={data:e,impl:t};return this._agents.set(e.id,o),this._onDidChangeAgents.fire(new oDe(e,t)),ee(()=>{this._agents.delete(e.id),this._onDidChangeAgents.fire(void 0)})}registerAgentCompletionProvider(e,t){return this._agentCompletionProviders.set(e,t),{dispose:()=>{this._agentCompletionProviders.delete(e)}}}async getAgentCompletionItems(e,t,o){return await this._agentCompletionProviders.get(e)?.(t,o)??[]}updateAgent(e,t){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,...t},this._onDidChangeAgents.fire(new oDe(o.data,o.impl))}getDefaultAgent(e,t="ask"){return this._preferExtensionAgent(this.getActivatedAgents().filter(o=>t&&!o.modes.includes(t)?!1:!!o.isDefault&&o.locations.includes(e)))}get hasToolsAgent(){return!!this.configurationService.getValue("chat.agent.enabled")}getContributedDefaultAgent(e){return this._preferExtensionAgent(this.getAgents().filter(t=>!!t.isDefault&&t.locations.includes(e)))}_preferExtensionAgent(e){return wu(e,t=>!t.isCore)??e.at(-1)}getAgent(e,t=!1){if(!(!this._agentIsEnabled(e)&&!t))return this._agents.get(e)?.data}_agentIsEnabled(e){let t=typeof e=="string"?this._agents.get(e):e;return!t?.data.when||this.contextKeyService.contextMatchesRules(C.deserialize(t.data.when))}getAgentByFullyQualifiedId(e){let t=yt.find(this._agents.values(),o=>_3(o.data)===e)?.data;if(!(t&&!this._agentIsEnabled(t.id)))return t}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 oDe(e.data,e.impl))}getAgentsByName(e){return this._preferExtensionAgents(this.getAgents().filter(t=>t.name===e))}_preferExtensionAgents(e){let t=e.filter(o=>!o.isCore);return t.length>0?t:e}agentHasDupeName(e){let t=this.getAgent(e);return t?this.getAgentsByName(t.name).filter(o=>o.extensionId.value!==t.extensionId.value).length>0:!1}async invokeAgent(e,t,o,n,r){V0(t.sessionResource,W0.AgentWillInvoke);let s=this._agents.get(e);if(!s?.impl)throw new Error(`No activated agent with id "${e}"`);this._onWillInvokeAgent.fire({agentId:e,request:t});let l=await s.impl.invoke(t,o,n,r);return V0(t.sessionResource,W0.AgentDidInvoke),l}setRequestTools(e,t,o){let n=this._agents.get(e);n?.impl&&n.impl.setRequestTools?.(t,o)}setYieldRequested(e,t,o){let n=this._agents.get(e);n?.impl&&n.impl.setYieldRequested?.(t,o)}async getFollowups(e,t,o,n,r){let s=this._agents.get(e);return s?.impl?.provideFollowups?s.impl.provideFollowups(t,o,n,r):[]}async getChatTitle(e,t,o){let n=this._agents.get(e);if(n?.impl?.provideChatTitle)return n.impl.provideChatTitle(t,o)}async getChatSummary(e,t,o){let n=this._agents.get(e);if(n?.impl?.provideChatSummary)return n.impl.provideChatSummary(t,o)}registerChatParticipantDetectionProvider(e,t){return this._chatParticipantDetectionProviders.set(e,t),ee(()=>{this._chatParticipantDetectionProviders.delete(e)})}hasChatParticipantDetectionProviders(){return this._chatParticipantDetectionProviders.size>0}async detectAgentOrCommand(e,t,o,n){let r=yt.first(this._chatParticipantDetectionProviders.values());if(!r)return;let s=this.getAgents().reduce((p,h)=>{if(h.locations.includes(o.location)){p.push({participant:h.id,disambiguation:h.disambiguation??[]});for(let g of h.slashCommands)p.push({participant:h.id,command:g.name,disambiguation:g.disambiguation??[]})}return p},[]),l=await r.provideParticipantDetection(e,t,{...o,participants:s},n);if(!l)return;let c=this.getAgent(l.participant);if(!c)return;if(!l.command)return{agent:c};let u=c?.slashCommands.find(p=>p.name===l.command);if(u)return{agent:c,command:u}}};iDe=I([m(0,X),m(1,B)],iDe);var oDe=class{constructor(i,e){this.data=i;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(i,e,t,o){return this.impl.invoke(i,e,t,o)}setRequestTools(i,e){this.impl.setRequestTools?.(i,e)}setYieldRequested(i,e){this.impl.setYieldRequested?.(i,e)}async provideFollowups(i,e,t,o){return this.impl.provideFollowups?this.impl.provideFollowups(i,e,t,o):[]}toJSON(){return this.data}},P2=le("chatAgentNameService"),nDe=class{constructor(i){this.languageModelsService=i}getAgentNameRestriction(i){if(i.isCore)return!0;let e=this.checkAgentNameRestriction(i.name,i).get(),t=!i.fullName||this.checkAgentNameRestriction(i.fullName.replace(/\s/g,""),i).get();return e&&t}checkAgentNameRestriction(i,e){return this.languageModelsService.restrictedChatParticipants.map(o=>o[i.toLowerCase()]).map(o=>o?o.some(n=>xr(n,n.includes(".")?e.extensionId.value:e.extensionPublisherId)):!0)}};nDe=I([m(0,Gr)],nDe);function _3(a){return`${a.extensionId.value}.${a.id}`}function Z9o(a){return a.name!==void 0}function mPt(a){let i=Z9o(a)?a:{...a,name:a.id};return i.extensionPublisherId||(i.extensionPublisherId=a.extensionPublisher??""),i.extensionDisplayName||(i.extensionDisplayName=""),i.extensionId||(i.extensionId=new hi("")),er(i)}function nSi(){return{applyingInstructionsCount:0,referencedInstructionsCount:0,agentInstructionsCount:0,listedInstructionsCount:0,totalInstructionsCount:0,claudeRulesCount:0,claudeMdCount:0,claudeAgentsCount:0}}function rSi(){return{debugDetails:[],durationInMillis:0}}var mao="onCustomAgentProvider",hao="onInstructionsProvider",gao="onPromptFileProvider",fao="onSkillProvider";function lb(a,i){return a===void 0||i===void 0||a.includes(i)}var jr=le("IPromptsService");function vao(a){if(typeof a!="object"||a===null)return!1;let i=a;return typeof i.userInvocable=="boolean"&&typeof i.agentInvocable=="boolean"}var DZ="https://aka.ms/vscode-ghcp-prompt-snippets",hPt="https://aka.ms/vscode-ghcp-custom-instructions",AYe="https://aka.ms/vscode-ghcp-custom-chat-modes",gPt="https://aka.ms/vscode-agent-skills",fPt="https://aka.ms/vscode-chat-hooks",r_="prompt",NYe="instructions",OYe="chatagent",sSi="skill",A2=[r_,NYe,OYe,sSi];var OM="github.copilot.chat.agentDebugLog.fileLogging.enabled",aSi="troubleshoot",bao="copilot-skill",vPt="troubleshoot/SKILL.md";function Sao(a){switch(a){case"prompt":return r_;case"instructions":return NYe;case"agent":return OYe;case"skill":return sSi;case"hook":return"jsonc";default:throw new Error(`Unknown prompt type: ${a}`)}}function bC(a){switch(a){case r_:return"prompt";case NYe:return"instructions";case OYe:return"agent";case sSi:return"skill";default:return}}var Zl=(n=>(n.instructions="instructions",n.prompt="prompt",n.agent="agent",n.skill="skill",n.hook="hook",n))(Zl||{});function Iao(a){return Object.values(Zl).includes(a)}function bPt(a){switch(a){case"agents-workspace":return d(9751,null);case"agents-personal":return d(9750,null);case"github-workspace":return d(9758,null);case"copilot-personal":return d(9757,null);case"claude-workspace":return d(9753,null);case"claude-workspace-local":return d(9754,null);case"claude-personal":return d(9752,null);case"user-data":return d(9759,null);case"config-workspace":return d(9756,null);case"config-personal":return d(9755,null);default:return}}var e7o=20,t7o=10;function Ape(a){if(!a)return;let i=a.family.toLowerCase();if(i.startsWith("gemini"))return t7o;if(i.startsWith("claude")||i.startsWith("anthropic"))return e7o}var nN;(n=>{n.icon=L.error;function i(r){return{filterUri:r.resource,owner:r.owner,problemMessage:r.message,filterRange:{startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,startColumn:r.startColumn,endColumn:r.endColumn}}}n.fromMarker=i;function e(r){return{id:t(r),name:o(r),icon:n.icon,value:r,kind:"diagnostic",...r}}n.toEntry=e;function t(r){return[r.filterUri,r.owner,r.filterSeverity,r.filterRange?.startLineNumber,r.filterRange?.startColumn].join(":")}n.id=t;function o(r){let s;if((p=>(p[p.MaxChars=30]="MaxChars",p[p.MaxSpaceLookback=10]="MaxSpaceLookback"))(s||={}),r.problemMessage){if(r.problemMessage.length<30)return r.problemMessage;let c=r.problemMessage.lastIndexOf(" ",30);return c===-1||c+10<30?r.problemMessage.substring(0,30)+"\u2026":r.problemMessage.substring(0,c)+"\u2026"}let l=d(9323,null);return r.filterUri&&(l=d(9324,null,Be(r.filterUri))),l}n.label=o})(nN||={});function SPt(a){return a.kind==="browserView"}var eR;(t=>{function a(o){return A.isUri(o.value)?o.value:Bp(o.value)?o.value.uri:void 0}t.toUri=a;function i(o){if(o.value instanceof Uint8Array){let n={...o};return n.value={$base64:gc(Ke.wrap(o.value))},n}return o}t.toExport=i;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 n={...o};return n.value=Ws(o.value.$base64).buffer,n}return o}t.fromExport=e})(eR||={});function IPt(a){return a.kind==="implicit"}function N2(a){return a.kind==="string"}function yao(a){return a.kind==="terminalCommand"}function wao(a){return a.kind==="agentFeedback"}function yPt(a){return a.kind==="paste"}function rDe(a){return a.kind==="workspace"}function SC(a){return a.kind==="image"}function wPt(a){return a.kind==="notebookOutput"}function CPt(a){return a.kind==="element"}function tR(a){return a.kind==="promptFile"}function B0(a){return a.kind==="promptText"}function xPt(a){return a.kind==="scmHistoryItem"}function kPt(a){return a.kind==="scmHistoryItemChange"}function EPt(a){return a.kind==="scmHistoryItemChangeRange"}function hE(a){let i=a;return typeof i=="object"&&i!==null&&(typeof i.value=="string"||typeof i.value>"u")&&(typeof i.name=="string"||typeof i.name>"u")&&(i.resourceUri===void 0||A.isUri(i.resourceUri))&&(typeof i.name=="string"||A.isUri(i.resourceUri))&&(i.icon===void 0||q.isThemeIcon(i.icon))&&A.isUri(i.uri)&&typeof i.handle=="number"}function H0(a,i,e,t=!1,o){return{id:`${i}__${a.toString()}`,name:`prompt:${Be(a)}`,value:a,kind:"promptFile",modelDescription:"Prompt instructions file",isRoot:i!=="vscode.instructions.file.reference",originLabel:e,toolReferences:o,automaticallyAdded:t}}function Cao(a,i=!1,e){return{id:"vscode.customizations.index",name:"prompt:customizationsIndex",value:a,kind:"promptText",modelDescription:"Chat customizations index",automaticallyAdded:i,toolReferences:e}}function Npe(a,i){return{kind:"tool",id:a.id,icon:q.isThemeIcon(a.icon)?a.icon:void 0,name:a.displayName,value:void 0,range:i}}function TPt(a,i){return{kind:"toolset",id:a.id,icon:a.icon,name:a.referenceName,value:Array.from(a.getTools()).map(e=>Npe(e)),range:i}}var DH=class{constructor(i){this._ids=new Set;this._entries=[];i&&this.add(...i)}add(...i){for(let e of i)this._ids.has(e.id)||(this._ids.add(e.id),this._entries.push(e))}insertFirst(i){this._ids.has(i.id)||(this._ids.add(i.id),this._entries.unshift(i))}remove(i){this._ids.delete(i.id),this._entries=this._entries.filter(e=>e.id!==i.id)}has(i){return this._ids.has(i.id)}asArray(){return this._entries.slice(0)}get length(){return this._entries.length}};var lSi;(i=>{function a(e,t){return e.text===t.text&&jii(e.parts,t.parts,(o,n)=>o.kind===n.kind&&gi.equals(o.range,n.range)&&G.equalsRange(o.editorRange,n.editorRange)&&o.text===n.text)}i.equals=a})(lSi||={});function DPt(a){let i=a.parts.map(t=>t.promptText).join("").trimStart(),e=a.text.length-i.length;return{message:i,diff:e}}var Yb=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.text=t;this.kind=a.Kind}static{this.Kind="text"}get promptText(){return this.text}},dp="#",pd="@",cp="/",_Pt=class a{constructor(i,e,t,o,n){this.range=i;this.editorRange=e;this.variableName=t;this.variableArg=o;this.variableId=n;this.kind=a.Kind}static{this.Kind="var"}get text(){let i=this.variableArg?`:${this.variableArg}`:"";return`${dp}${this.variableName}${i}`}get promptText(){return this.text}},iw=class a{constructor(i,e,t,o,n,r){this.range=i;this.editorRange=e;this.toolName=t;this.toolId=o;this.displayName=n;this.icon=r;this.kind=a.Kind}static{this.Kind="tool"}get text(){return`${dp}${this.toolName}`}get promptText(){return this.text}toVariableEntry(){return{kind:"tool",id:this.toolId,name:this.toolName,range:this.range,value:void 0,icon:q.isThemeIcon(this.icon)?this.icon:void 0,fullName:this.displayName}}},U0=class a{constructor(i,e,t,o,n,r){this.range=i;this.editorRange=e;this.id=t;this.name=o;this.icon=n;this.tools=r;this.kind=a.Kind}static{this.Kind="toolset"}get text(){return`${dp}${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}}},Qp=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.agent=t;this.kind=a.Kind}static{this.Kind="agent"}get text(){return`${pd}${this.agent.name}`}get promptText(){return""}},cb=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.command=t;this.kind=a.Kind}static{this.Kind="subcommand"}get text(){return`${cp}${this.command.name}`}get promptText(){return""}},gE=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.slashCommand=t;this.kind=a.Kind}static{this.Kind="slash"}get text(){return`${cp}${this.slashCommand.command}`}get promptText(){return`${cp}${this.slashCommand.command}`}},iR=class a{constructor(i,e,t){this.range=i;this.editorRange=e;this.name=t;this.kind=a.Kind}static{this.Kind="prompt"}get text(){return`${cp}${this.name}`}get promptText(){return`${cp}${this.name}`}},FM=class a{constructor(i,e,t,o,n,r,s,l,c,u,p){this.range=i;this.editorRange=e;this.text=t;this.id=o;this.modelDescription=n;this.data=r;this.fullName=s;this.icon=l;this.isFile=c;this.isDirectory=u;this._meta=p;this.kind=a.Kind}static{this.Kind="dynamic"}get referenceText(){return this.text.replace(dp,"")}get promptText(){return this.text}toVariableEntry(){return this.id==="vscode.problems"?nN.toEntry(this.data.filter):{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 xao(a){return{text:a.text,parts:a.parts.map(i=>{if(i.kind===Yb.Kind)return new Yb(new gi(i.range.start,i.range.endExclusive),i.editorRange,i.text);if(i.kind===_Pt.Kind)return new _Pt(new gi(i.range.start,i.range.endExclusive),i.editorRange,i.variableName,i.variableArg,i.variableId||"");if(i.kind===iw.Kind)return new iw(new gi(i.range.start,i.range.endExclusive),i.editorRange,i.toolName,i.toolId,i.displayName,i.icon);if(i.kind===U0.Kind)return new U0(new gi(i.range.start,i.range.endExclusive),i.editorRange,i.id,i.name,i.icon,i.tools??[]);if(i.kind===Qp.Kind){let e=i.agent;return e=mPt(e),new Qp(new gi(i.range.start,i.range.endExclusive),i.editorRange,e)}else{if(i.kind===cb.Kind)return new cb(new gi(i.range.start,i.range.endExclusive),i.editorRange,i.command);if(i.kind===gE.Kind)return new gE(new gi(i.range.start,i.range.endExclusive),i.editorRange,i.slashCommand);if(i.kind===iR.Kind)return new iR(new gi(i.range.start,i.range.endExclusive),i.editorRange,i.name);if(i.kind===FM.Kind)return new FM(new gi(i.range.start,i.range.endExclusive),i.editorRange,i.text,i.id,i.modelDescription,er(i.data),i.fullName,i.icon,i.isFile,i.isDirectory,i._meta);throw new Error(`Unknown chat request part: ${i.kind}`)}})}}function kao(a){let i=a.parts.find(t=>t instanceof Qp),e=a.parts.find(t=>t instanceof cb);return{agentPart:i,commandPart:e}}function RPt(a,i,e,t=null,o=null){let n="";if(t&&t!==a.getDefaultAgent(i)?.id){let r=a.getAgent(t);if(!r)return;n+=`${pd}${r.name} `,o&&(n+=`${cp}${o} `)}return n+e}var LPt=le("IChatVariablesService");var rN=le("chatSlashCommandService"),sDe=class extends k{constructor(e){super();this._extensionService=e;this._commands=new Map;this._onDidChangeCommands=this._register(new T);this.onDidChangeCommands=this._onDidChangeCommands.event}dispose(){super.dispose(),this._commands.clear()}getSessionScopedCommands(e){return this._commands.get(e)??[]}commandsOverlap(e,t){return e.sessionTypes===void 0||t.sessionTypes===void 0?!0:e.sessionTypes.some(o=>t.sessionTypes?.includes(o))}getCommand(e,t){return this.getSessionScopedCommands(e).find(o=>lb(o.data.sessionTypes,t))}registerSlashCommand(e,t){let o=this.getSessionScopedCommands(e.command);if(o.some(r=>this.commandsOverlap(r.data,e)))throw new Error(`Already registered a command with id ${e.command}`);let n={data:e,command:t};return o.push(n),this._commands.set(e.command,o),this._onDidChangeCommands.fire(),ee(()=>{let r=this._commands.get(e.command);if(!r)return;let s=r.indexOf(n);s!==-1&&(r.splice(s,1),r.length===0&&this._commands.delete(e.command),this._onDidChangeCommands.fire())})}getCommands(e,t){return Array.from(this._commands.values()).flatMap(o=>o.map(n=>n.data)).filter(o=>o.locations.includes(e)&&(!o.modes||o.modes.includes(t)))}hasCommand(e,t){return!!this.getCommand(e,t)}async executeCommand(e,t,o,n,r,s,l,c){let u=this.getCommand(e,yn(s));if(!u)throw new Error(`No command with id ${e} NOT registered`);if(u.command||await this._extensionService.activateByEvent(`onSlash:${e}`),!u.command)throw new Error(`No command with id ${e} NOT resolved`);return await u.command(t,o,n,r,s,l,c)}};sDe=I([m(0,lt)],sDe);function Eao(a){let i=[];return Tao(a.node,i),i.join("")}function Tao(a,i){if(a.type===2)a.lineBreakBefore&&i.push(`
`),typeof a.text=="string"&&i.push(a.text);else if(a.ctor===3)i.push("<image>");else if(a.ctor===1||a.ctor===2)for(let e of a.children)Tao(e,i)}function cSi(a,i){return!a.models||a.models.length===0||!i?!0:a.models.some(e=>(!e.id||e.id===i.id)&&(!e.vendor||e.vendor===i.vendor)&&(!e.family||e.family===i.family)&&(!e.version||e.version===i.version))}var wn;(n=>{n.Internal={type:"internal",label:"Built-In"},n.External={type:"external",label:"External"};function e(r){switch(r.type){case"extension":return`extension:${r.extensionId.value}`;case"mcp":return`mcp:${r.collectionId}:${r.definitionId}`;case"user":return`user:${r.file.toString()}`;case"internal":return"internal";case"external":return"external"}}n.toKey=e;function t(r,s){return e(r)===e(s)}n.equals=t;function o(r){return r.type==="internal"?{ordinal:1,label:d(9852,null)}:r.type==="mcp"?{ordinal:2,label:r.label}:r.type==="user"?{ordinal:0,label:d(9854,null)}:{ordinal:3,label:r.label}}n.classify=o})(wn||={});function oR(a){return typeof a=="object"&&typeof a?.input=="string"&&(typeof a?.output=="string"||Array.isArray(a?.output))}function RH(a){return typeof a=="object"&&typeof a?.output=="object"&&typeof a?.output?.mimeType=="string"&&a?.output?.type==="data"}function MPt(a){return a.map(i=>{switch(i.kind){case"promptTsx":return WYe(i);case"text":return i.value;case"data":return d(9853,null,Ml.formatSize(i.value.data.byteLength),i.value.mimeType||"unknown")}}).join(", ")}function _ao(a){return a.content.some(i=>i.kind==="data")}function WYe(a){return Eao(a.value)}function _h(a){return!!a&&a.getTools!==void 0}var aDe=class{constructor(i,e,t,o,n,r,s){this.id=i;this.referenceName=e;this.icon=t;this.source=o;this.description=n;this.legacyFullNames=r;this._contextKeyService=s;this._tools=new SY;this._toolSets=new SY;this.isHomogenous=ke(l=>!yt.some(this._tools.observable.read(l),c=>!wn.equals(c.source,this.source))&&!yt.some(this._toolSets.observable.read(l),c=>!wn.equals(c.source,this.source)))}addTool(i,e){return this._tools.add(i,e),ee(()=>{this._tools.delete(i)})}addToolSet(i,e){return i===this?k.None:(this._toolSets.add(i,e),ee(()=>{this._toolSets.delete(i)}))}getTools(i){return yt.concat(yt.filter(this._tools.observable.read(i),e=>this._contextKeyService.contextMatchesRules(e.when)),...yt.map(this._toolSets.observable.read(i),e=>e.getTools(i)))}},FYe=class{constructor(i,e,t){this._toolSet=i;this.model=e;this.toolFilter=t}get id(){return this._toolSet.id}get referenceName(){return this._toolSet.referenceName}get icon(){return this._toolSet.icon}get source(){return this._toolSet.source}get description(){return this._toolSet.description}get legacyFullNames(){return this._toolSet.legacyFullNames}getTools(i){return yt.filter(this._toolSet.getTools(i),e=>cSi(e,this.model)&&(!this.toolFilter||this.toolFilter(e)))}},Wn=le("ILanguageModelToolsService");function VYe(a){return typeof a!="string"&&(a=a.id),A.from({scheme:Q.vscode,authority:"schemas",path:`/lm/tool/${a}`})}var Am;(s=>(s.execute="execute",s.edit="edit",s.search="search",s.agent="agent",s.read="read",s.web="web",s.todo="todo"))(Am||={});var D3;(e=>(e.runSubagent="runSubagent",e.vscode="vscode"))(D3||={});var dSi=/^@([\w_\-\.]+)(?=(\s|$|\b))/i,uSi=/^#([\w_\-]+)(:\d+)?(?=(\s|$|\b))/i,BYe=/^\/([\p{L}\d_\-\.:]+)(?=(\s|$|\b))/iu,nR=class{constructor(i,e,t,o){this.agentService=i;this.variableService=e;this.slashCommandService=t;this.promptsService=o}parseChatRequest(i,e,t="panel",o={}){let n=this.variableService.getDynamicVariables(i),r=this.variableService.getSelectedToolAndToolSets(i);return o.sessionType||(o={...o,sessionType:yn(i)}),this.parseChatRequestWithReferences(n,r,e,t,o)}parseChatRequestWithReferences(i,e,t,o="panel",n){let r=[],s=new Map,l=new Map;for(let[g,f]of e)f&&(_h(g)?l.set(g.referenceName,g):s.set(g.toolReferenceName??g.displayName,g));let c=1,u=1;for(let g=0;g<t.length;g++){let f=t.charAt(g-1),v=t.charAt(g),b;if((f.match(/\s/)||g===0)&&(v===dp?b=this.tryToParseVariable(t.slice(g),g,new ye(c,u),r,s,l):v===pd?b=this.tryToParseAgent(t.slice(g),t,g,new ye(c,u),r,o,n):v===cp&&(b=this.tryToParseSlashCommand(t.slice(g),t,g,new ye(c,u),r,o,n)),b||(b=this.tryToParseDynamicVariable(t.slice(g),g,new ye(c,u),i))),b){if(g!==0){let S=r.at(-1),y=S?.range.endExclusive??0,w=S?.editorRange.endLineNumber??1,x=S?.editorRange.endColumn??1;r.push(new Yb(new gi(y,g),new G(w,x,c,u),t.slice(y,g)))}r.push(b)}v===`
`?(c++,u=1):u++}let p=r.at(-1),h=p?.range.endExclusive??0;return h<t.length&&r.push(new Yb(new gi(h,t.length),new G(p?.editorRange.endLineNumber??1,p?.editorRange.endColumn??1,c,u),t.slice(h,t.length))),{parts:r,text:t}}tryToParseAgent(i,e,t,o,n,r,s){let l=i.match(dSi);if(!l)return;let[c,u]=l,p=new gi(t,t+c.length),h=new G(o.lineNumber,o.column,o.lineNumber,o.column+c.length),g=this.agentService.getAgentsByName(u);if(!g.length){let y=this.agentService.getAgentByFullyQualifiedId(u);y&&(g=[y])}let f=g.length>1&&s?.selectedAgent?s.selectedAgent:g.find(y=>y.locations.includes(r));if(!f||s?.mode&&!f.modes.includes(s.mode)||n.some(y=>y instanceof Qp)||n.some(y=>y instanceof Yb&&y.text.trim()!==""||!(y instanceof Qp)))return;let b=n.at(-1)?.range.endExclusive??0;if(e.slice(b,t).trim()==="")return new Qp(p,h,f)}tryToParseVariable(i,e,t,o,n,r){let s=i.match(uSi);if(!s)return;let[l,c]=s,u=new gi(e,e+l.length),p=new G(t.lineNumber,t.column,t.lineNumber,t.column+l.length),h=n.get(c);if(h)return new iw(u,p,c,h.id,h.displayName,h.icon);let g=r.get(c);if(g){let f=Array.from(g.getTools()).map(v=>new iw(u,p,v.toolReferenceName??v.displayName,v.id,v.displayName,v.icon).toVariableEntry());return new U0(u,p,g.id,g.referenceName,g.icon,f)}}tryToParseSlashCommand(i,e,t,o,n,r,s){let l=i.match(BYe);if(!l||n.some(x=>!(x instanceof Qp)&&!(x instanceof Yb&&x.text.trim()==="")))return;let u=n.at(-1)?.range.endExclusive??0;if(e.slice(u,t).trim()!=="")return;let[h,g]=l,f=new gi(t,t+h.length),v=new G(o.lineNumber,o.column,o.lineNumber,o.column+h.length),b=n.find(x=>x instanceof Qp)?.agent??(s?.forcedAgent?s.forcedAgent:void 0);if(b){let x=b.slashCommands.find(E=>E.name===g);if(x)return new cb(f,v,x)}let S=s?.attachmentCapabilities??b?.capabilities,w=this.slashCommandService.getCommands(r,s?.mode??"ask").find(x=>x.command===g&&lb(x.sessionTypes,s?.sessionType));if(!b||w?.silent||S?.supportsPromptAttachments){if(w)return new gE(f,v,w);{let M=this.agentService.getDefaultAgent(r,s?.mode)?.slashCommands.find(N=>N.name===g);if(M)return new cb(f,v,M)}if(this.promptsService.isValidSlashCommandName(g))return new iR(f,v,g)}}tryToParseDynamicVariable(i,e,t,o){let n=o.find(r=>r.range.startLineNumber===t.lineNumber&&r.range.startColumn===t.column);if(n){let r=n.range.endColumn-n.range.startColumn,s=i.substring(0,r),l=new gi(e,e+r);return new FM(l,n.range,s,n.id,n.modelDescription,n.data,n.fullName,n.icon,n.isFile,n.isDirectory,n._meta)}}};nR=I([m(0,gr),m(1,LPt),m(2,rN),m(3,jr)],nR);function O2(a){if(!a.viewModel||!a.supportsFileReferences)return[];let i=a.getContrib(ab.ID);if(!i)return[];if(a.viewModel.editing&&i.variables.length>0)return i.variables;if(a.input.attachmentModel.attachments.length>0&&a.viewModel.editing){let e=[],t=a.inputEditor.getModel(),o=t?.getValueLength()??0;for(let n of a.input.attachmentModel.attachments)if(n.range){if(n.range.start>=n.range.endExclusive||n.range.start<0||n.range.endExclusive>o||!t)continue;let r=t.getPositionAt(n.range.start),s=t.getPositionAt(n.range.endExclusive),l={id:n.id,fullName:n.name,modelDescription:n.modelDescription,range:new G(r.lineNumber,r.column,s.lineNumber,s.column),icon:n.icon,isFile:n.kind==="file",isDirectory:n.kind==="directory",data:n.value};e.push(l)}return e.length>0?e:i.variables}return i.variables}function RZ(a){return a.input.selectedToolsModel.entriesMap.get()}var lDe=class{constructor(i){this.chatWidgetService=i}getDynamicVariables(i){let e=this.chatWidgetService.getWidgetBySessionResource(i);return e?O2(e):[]}getSelectedToolAndToolSets(i){let e=this.chatWidgetService.getWidgetBySessionResource(i);return e?RZ(e):new Map}};lDe=I([m(0,Lt)],lDe);function i7o(a){return!!a&&typeof a=="object"&&"uri"in a&&a.uri instanceof A&&"version"in a&&typeof a.version=="number"&&"ranges"in a&&Array.isArray(a.ranges)&&a.ranges.every(G.isIRange)}function Dao(a){return!!a&&typeof a=="object"&&"documents"in a&&Array.isArray(a.documents)&&a.documents.every(i7o)}function cDe(a){return!!a&&typeof a=="object"&&"command"in a&&"language"in a}var pi;(h=>{let a;(w=>(w[w.Streaming=0]="Streaming",w[w.WaitingForConfirmation=1]="WaitingForConfirmation",w[w.Executing=2]="Executing",w[w.WaitingForPostApproval=3]="WaitingForPostApproval",w[w.Completed=4]="Completed",w[w.Cancelled=5]="Cancelled"))(a=h.StateKind||={});function i(g,f){if(g.kind==="toolInvocationSerialized")return g.isConfirmed===void 0||typeof g.isConfirmed=="boolean"?{type:g.isConfirmed?4:0}:g.isConfirmed;let v=g.state.read(f);if(!(v.type===0||v.type===1))return v.type===5?{type:v.reason}:v.confirmed}h.executionConfirmedOrDenied=i;function e(g,f){let v=i(g);if(v)return Promise.resolve(v);let b=new O;return new Promise(S=>{f&&b.add(f.onCancellationRequested(()=>{S({type:0})})),b.add(ve(y=>{let w=i(g,y);w&&(b.dispose(),S(w))}))}).finally(()=>{b.dispose()})}h.awaitConfirmation=e;function t(g,f){let v=g.state.read(f);if(v.type===4)return v.postConfirmed||{type:1};if(v.type===5)return{type:v.reason}}function o(g,f){let v=g?.state.get();return v?.type===1||v?.type===3?(v.confirm(f),!0):!1}h.confirmWith=o;function n(g,f){let v=t(g);if(v)return Promise.resolve(v);let b=new O;return new Promise(S=>{f&&b.add(f.onCancellationRequested(()=>{S({type:0})})),b.add(ve(y=>{let w=t(g,y);w&&(b.dispose(),S(w))}))}).finally(()=>{b.dispose()})}h.awaitPostConfirmation=n;function r(g,f){if(g.kind==="toolInvocationSerialized")return g.resultDetails;let v=g.state.read(f);if(v.type===4||v.type===3)return v.resultDetails}h.resultDetails=r;function s(g,f){if(g.kind==="toolInvocationSerialized")return!0;let v=g.state.read(f);return v.type===4||v.type===5}h.isComplete=s;function l(g,f){return!!(g.presentation==="hidden"||g.presentation==="hiddenAfterComplete"&&s(g,f))}h.isEffectivelyHidden=l;function c(g,f){return g.kind==="toolInvocationSerialized"?!1:g.state.read(f).type===0}h.isStreaming=c;function u(g,f){if(g.kind==="toolInvocationSerialized")return;let v=g.state.read(f);if(v.type!==0)return v.parameters}h.getParameters=u;function p(g,f){if(g.kind==="toolInvocationSerialized")return;let v=g.state.read(f);if(v.type!==0)return v.confirmationMessages}h.getConfirmationMessages=p})(pi||={});var PPt=class{constructor(i){this.state=i;this.kind="mcpServersStarting";this.didStartServerIds=[]}get isEmpty(){let i=this.state.get();return!i.working&&i.serversRequiringInteraction.length===0}wait(){return new Promise(i=>{uD(e=>{let t=this.state.read(e);t.working||(e.dispose(),i(t))})})}toJSON(){return{kind:"mcpServersStarting",didStartServerIds:this.didStartServerIds}}};function Rao(a){return!!a&&a.kind==="reply"&&typeof a.message=="string"&&typeof a.agentId=="string"}function Lao(a){return yo(a,{created:!0})?a:{created:a.startTime,lastRequestStarted:a.startTime,lastRequestEnded:a.endTime}}var R3;(o=>{function a(n){return n.kind==="sent"}o.isSent=a;function i(n){return n.kind==="rejected"}o.isRejected=i;function e(n){return n.kind==="queued"}o.isQueued=e;function t(n){if(n.kind!=="sent")throw new Error(`Expected ChatSendResult to be 'sent', but was '${n.kind}'`)}o.assertSent=t})(R3||={});var si=le("IChatService"),Ope="accessibility.voice.keywordActivation",HYe="chat.stopCancellationNoop",F2="chat.pendingRequestChange";var UYe=(t=>(t[t.Output=1]="Output",t[t.OutputItems=2]="OutputItems",t[t.ExecutionState=3]="ExecutionState",t))(UYe||{}),LZ=le("INotebookExecutionService");var $I;(h=>{function a(g){return{mime:g.mime,valueBytes:g.data}}h.toNotebookOutputItemDto=a;function i(g){return{outputId:g.outputId,metadata:g.metadata,items:g.outputs.map(a)}}h.toNotebookOutputDto=i;function e(g){return{cellKind:g.cellKind,language:g.language,mime:g.mime,source:g.source,internalMetadata:g.internalMetadata,metadata:g.metadata,outputs:g.outputs.map(i)}}h.toNotebookCellDataDto=e;function t(g){return{metadata:g.metadata,cells:g.cells.map(e)}}h.toNotebookDataDto=t;function o(g){return{mime:g.mime,data:g.valueBytes}}h.fromNotebookOutputItemDto=o;function n(g){return{outputId:g.outputId,metadata:g.metadata,outputs:g.items.map(o)}}h.fromNotebookOutputDto=n;function r(g){return{cellKind:g.cellKind,language:g.language,mime:g.mime,source:g.source,outputs:g.outputs.map(n),metadata:g.metadata,internalMetadata:g.internalMetadata}}h.fromNotebookCellDataDto=r;function s(g){return{metadata:g.metadata,cells:g.cells.map(r)}}h.fromNotebookDataDto=s;function l(g){return{handle:g.handle,uri:g.uri,source:g.textBuffer.getLinesContent(),eol:g.textBuffer.getEOL(),language:g.language,cellKind:g.cellKind,outputs:g.outputs.map(i),metadata:g.metadata,internalMetadata:g.internalMetadata}}h.toNotebookCellDto=l;function c(g){return g.editType===1?{editType:g.editType,cellHandle:g.cellHandle,append:g.append,outputs:g.outputs.map(n)}:g.editType===2?{editType:g.editType,append:g.append,outputId:g.outputId,items:g.items.map(o)}:g}h.fromCellExecuteUpdateDto=c;function u(g){return g}h.fromCellExecuteCompleteDto=u;function p(g){return g.editType===1?{editType:g.editType,index:g.index,count:g.count,cells:g.cells.map(r)}:g}h.fromCellEditOperationDto=p})($I||={});var WM=le("aiCustomizationWorkspaceService"),sc="builtin",pn={Agents:"agents",Skills:"skills",Instructions:"instructions",Prompts:"prompts",Hooks:"hooks",McpServers:"mcpServers",Plugins:"plugins",Models:"models"};function APt(a,i){let e=new Set(i.sources);return a.filter(t=>e.has(t.storage)?t.storage==="user"&&i.includedUserFileRoots?i.includedUserFileRoots.some(o=>Yr(t.uri,o)):!0:!1)}var KYe=".prompt.md",GYe=".instructions.md",V2=".chatmode.md",MZ=".agent.md",LH="SKILL.md";function NPt(a){return MS(a,LH)===0}var OPt=/^[a-z0-9-]+$/,dDe="AGENTS.md",Mao="CLAUDE.md",Pao="CLAUDE.local.md",qYe=".claude",FPt="copilot-instructions.md",Aao=".github",$Ye=".github/prompts",mSi=".github/instructions",WPt=".github/chatmodes",B2=".github/agents",W2=".claude/agents",VPt="~/.copilot/agents",pSi=".claude/rules";var jYe=[{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"}],BPt=[{path:mSi,source:"github-workspace",storage:"local"},{path:pSi,source:"claude-workspace",storage:"local"},{path:"~/.copilot/instructions",source:"copilot-personal",storage:"user"},{path:"~/"+pSi,source:"claude-personal",storage:"user"}],o7o=[{path:$Ye,source:"github-workspace",storage:"local"}],n7o=[{path:B2,source:"github-workspace",storage:"local"},{path:W2,source:"claude-workspace",storage:"local"},{path:VPt,source:"copilot-personal",storage:"user"},{path:"~/"+W2,source:"claude-personal",storage:"user"}],QYe=[{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 Nao(a){let i=ai(a).path;return i.endsWith("/"+B2)||i.endsWith("/"+W2)||r7o(a)}function HPt(a){return ai(a).path.endsWith("/"+W2)}function r7o(a){return ai(a).path.endsWith(VPt.substring(1))}function H2(a){return a.path.includes("/"+pSi+"/")}function hSi(a){let i=Be(a);if(i.endsWith(KYe))return"prompt";if(i.endsWith(GYe)||i===FPt)return"instructions";if(i.endsWith(V2)||i.endsWith(MZ))return"agent";if(NPt(i))return"skill";if(i.endsWith(".md")&&i!=="README.md"&&Nao(a))return"agent";if(i.endsWith(".md")&&i!=="README.md"&&H2(a))return"instructions";if(i.toLowerCase().endsWith(".json"))return"hook"}function gSi(a){return hSi(a)!==void 0}function UPt(a){switch(a){case"instructions":return GYe;case"prompt":return KYe;case"agent":return MZ;case"skill":return LH;case"hook":return".json";default:throw new Error("Unknown prompt type")}}function uDe(a){switch(a){case"instructions":return BPt;case"prompt":return o7o;case"agent":return n7o;case"skill":return jYe;case"hook":return QYe;default:throw new Error("Unknown prompt type")}}function PZ(a){return Be(ai(a))}function Xb(a){let i=Be(a),e=[KYe,GYe,V2,MZ];for(let t of e)if(i.endsWith(t))return Be(a,t);return i===FPt?Be(a,".md"):NPt(i)?PZ(a):i.endsWith(".md")&&i!=="README.md"&&Nao(a)?Be(a,".md"):i.endsWith(".md")&&i!=="README.md"&&H2(a)?Be(a,".md"):Be(a)}var gn=le("IUserDataProfileService"),s_=le("IUserDataProfileManagementService");var YYe="profile";function Oao(a,i){return A.from({scheme:i.urlProtocol,authority:YYe,path:a.startsWith("/")?a:`/${a}`})}var fSi="profile-";function pDe(a){return a.authority===YYe||new RegExp(`^${fSi}`).test(a.authority)}var MH=le("IUserDataProfileImportExportService"),Fao=Oe("defaultProfile-icon",L.settings,d(19573,null)),vSi=P(19575,"Profiles"),z0={...vSi},XYe="code-profile",JYe=[{name:d(19574,null),extensions:[XYe]}],ZYe=new Y("currentProfile",""),L3=new Y("hasProfiles",!1);var El;(E=>{E.PROMPT_LOCATIONS_KEY="chat.promptFilesLocations",E.INSTRUCTIONS_LOCATION_KEY="chat.instructionsFilesLocations",E.MODE_LOCATION_KEY="chat.modeFilesLocations",E.AGENTS_LOCATION_KEY="chat.agentFilesLocations",E.SKILLS_LOCATION_KEY="chat.agentSkillsLocations",E.HOOKS_LOCATION_KEY="chat.hookFilesLocations",E.PROMPT_FILES_SUGGEST_KEY="chat.promptFilesRecommendations",E.USE_COPILOT_INSTRUCTION_FILES="github.copilot.chat.codeGeneration.useInstructionFiles",E.USE_AGENT_MD="chat.useAgentsMdFile",E.USE_NESTED_AGENT_MD="chat.useNestedAgentsMdFiles",E.USE_CLAUDE_MD="chat.useClaudeMdFile",E.USE_AGENT_SKILLS="chat.useAgentSkills",E.USE_CHAT_HOOKS="chat.useHooks",E.USE_CLAUDE_HOOKS="chat.useClaudeHooks",E.USE_SKILL_ADHERENCE_PROMPT="chat.experimental.useSkillAdherencePrompt",E.INCLUDE_APPLYING_INSTRUCTIONS="chat.includeApplyingInstructions",E.INCLUDE_REFERENCED_INSTRUCTIONS="chat.includeReferencedInstructions",E.USE_CUSTOMIZATIONS_IN_PARENT_REPOS="chat.useCustomizationsInParentRepositories";function y(M,N){let V=bSi(N),H=M.getValue(V);if(!(H==null||Array.isArray(H))&&typeof H=="object"){let K={};for(let[j,J]of Object.entries(H)){let se=j.trim(),ae=Wao(J);ae!==void 0&&se&&(K[se]=ae)}return K}}E.getLocationsValue=y;function w(M,N){let V=y(M,N),H=uDe(N);if(V&&typeof V=="object"){let K=[],j=new Set(H.map(J=>J.path));for(let J of H)V[J.path]!==!1&&K.push(J);for(let[J,se]of Object.entries(V)){if(se===!1||j.has(J))continue;let ae=eXe(J)?"user":"local";K.push({path:J,source:ae==="local"?"config-workspace":"config-personal",storage:ae})}return K}return[]}E.promptSourceFolders=w;function x(M,N){let V=M.getValue(E.PROMPT_FILES_SUGGEST_KEY,{resource:N});if(!V||typeof V!="object"||Array.isArray(V))return;let H={};for(let[K,j]of Object.entries(V)){let J=K.trim();if(!J)continue;if(typeof j=="boolean"){H[J]=j;continue}if(typeof j=="string"){let ae=j.trim();ae&&(H[J]=ae);continue}let se=Wao(j);se!==void 0&&(H[J]=se)}return Object.keys(H).length>0?H:void 0}E.getPromptFilesRecommendationsValue=x})(El||={});function bSi(a){switch(a){case"instructions":return El.INSTRUCTIONS_LOCATION_KEY;case"prompt":return El.PROMPT_LOCATIONS_KEY;case"agent":return El.AGENTS_LOCATION_KEY;case"skill":return El.SKILLS_LOCATION_KEY;case"hook":return El.HOOKS_LOCATION_KEY;default:throw new Error("Unknown prompt type")}}function Wao(a){if(typeof a=="boolean")return a;if(typeof a=="string"){let i=a.trim().toLowerCase();return i==="true"?!0:i==="false"?!1:void 0}}function eXe(a){return a.startsWith("~/")}var SSi="workbench.view.search";var ow="workbench.view.search",U2="search-result",GPt="search.exclude",M3=2e4,Bao="\u27EA ",Hao=" characters skipped \u27EB",s7o=(Bao.length+Hao.length+5)*2,Gg=le("searchService");function K0(a){return!!a.rangeLocations&&!!a.previewText}function ISi(a){return!!a.resource}function qPt(a){return!!a.keyword}function ySi(a){return!!a.message}var zPt=class{constructor(i){this.resource=i;this.results=[]}},AZ=class{constructor(i,e,t,o){this.rangeLocations=[];this.webviewIndex=o;let n=Array.isArray(e)?e:[e];if(t&&t.matchLines===1&&a7o(n)){i=X3i(i,t.matchLines);let r="",s=0,l=0,c=Math.floor(t.charsPerLine/5);for(let u of n){let p=Math.max(u.startColumn-c,0),h=u.startColumn+t.charsPerLine;if(p>l+c+s7o){let g=Bao+(p-l)+Hao;r+=g+i.slice(p,h),s+=p-(l+g.length)}else r+=i.slice(l,h);l=h,this.rangeLocations.push({source:u,preview:new iXe(0,u.startColumn-s,u.endColumn-s)})}this.previewText=r}else{let r=Array.isArray(e)?e[0].startLineNumber:e.startLineNumber,s=j4i(e,l=>({preview:new KPt(l.startLineNumber-r,l.startColumn,l.endLineNumber-r,l.endColumn),source:l}));this.rangeLocations=Array.isArray(s)?s:[s],this.previewText=i}}};function a7o(a){let i=a[0].startLineNumber;for(let e of a)if(e.startLineNumber!==i||e.endLineNumber!==i)return!1;return!0}var KPt=class{constructor(i,e,t,o){this.startLineNumber=i,this.startColumn=e,this.endLineNumber=t,this.endColumn=o}},iXe=class extends KPt{constructor(i,e,t){super(i,e,i,t)}};function PH(a,i=!0){let e=a&&a.files&&a.files.exclude,t=i&&a&&a.search&&a.search.exclude;if(!e&&!t)return;if(!e||!t)return e||t||void 0;let o=Object.create(null);return o=Cp(o,io(e)),o=Cp(o,io(t),!0),o}function Fpe(a,i){let e=a.ignoreGlobCase?{ignoreCase:!0}:void 0;return a.excludePattern&&qd(a.excludePattern,i,e)?!1:a.includePattern||a.usingSearchPaths?a.includePattern&&qd(a.includePattern,i,e)?!0:a.usingSearchPaths?!!a.folderQueries&&a.folderQueries.some(t=>{let o=t.folder.fsPath;if(Nle(i,o,a.ignoreGlobCase)){let n=pA(o,i);return!t.includePattern||!!qd(t.includePattern,n,e)}else return!1}):!1:!0}var tXe=class extends Error{constructor(e,t){super(e);this.code=t}};function Uao(a){let i=a.message;if(Yi(a))return new tXe(i,7);try{let e=JSON.parse(i);return new tXe(e.message,e.code)}catch{return new tXe(i,6)}}var IC="vscode-agent-host";function $S(a,i){if(i==="local"&&a.scheme===Q.file)return a;let e=a.authority||"";return A.from({scheme:IC,authority:i,path:`/${a.scheme}/${e||"-"}${a.path}`})}function NZ(a){if(a.scheme!==IC)return a;let i=a.path,e=i.indexOf("/",1);if(e===-1)return A.from({scheme:"file",path:i});let t=i.substring(1,e),o=i.indexOf("/",e+1);if(o===-1){let s=i.substring(e+1);return A.from({scheme:t,authority:s,path:"/"})}let n=i.substring(e+1,o);n==="-"&&(n="");let r=i.substring(o);return A.from({scheme:t,authority:n||void 0,path:r})}function db(a){return a.startsWith("ws://")?a.slice(5):a}function VM(a){let i=db(a);return/^[a-zA-Z0-9]+$/.test(i)?i:/^[a-zA-Z0-9.:\-]+$/.test(i)?i.replaceAll(":","__"):`b64-${gc(Ke.fromString(i),!1,!0)}`}var mDe={scheme:IC,formatting:{label:"${path}",separator:"/",stripPathSegments:2}};var l7o=5,hDe=class{constructor(i,e,t,o,n,r,s,l,c){this.fileService=i;this.configService=e;this.workspaceService=t;this.environmentService=o;this.searchService=n;this.userDataService=r;this.logService=s;this.pathService=l;this.workspaceTrustManagementService=c;let u=this.userDataService.currentProfile.promptsHome;this.userDataFolder={uri:u,searchRoot:u,filePattern:void 0,source:"user-data",storage:"user",displayPath:d(9763,null),isDefault:!0}}getWorkspaceFolders(){return this.workspaceService.getWorkspace().folders.filter(i=>i.uri.scheme!==IC)}getWorkspaceFolder(i){return this.workspaceService.getWorkspaceFolder(i)??void 0}onDidChangeWorkspaceFolders(){return U.map(this.workspaceService.onDidChangeWorkspaceFolders,()=>{})}getPromptSourceFolders(i){return El.promptSourceFolders(this.configService,i)}getDefaultSourceFolders(i){return uDe(i)}async getWorkspaceFolderRoots(i,e){let t=this.getWorkspaceFolders();if(i){let o=new xn,n=await this.pathService.userHome();for(let r of t){o.add(r.uri);let s=await this.findParentRepoFolders(r.uri,n,o,e);for(let l of s)o.add(l)}return[...o]}return t.map(o=>o.uri)}async findParentRepoFolders(i,e,t,o){let n=[],r=i;for(;;){try{if(await this.fileService.exists(Ve(r,".git")))return(await this.workspaceTrustManagementService.getUriTrustInfo(r)).trusted?(n.push(r),n):(o?.logInfo(`Repository root found at ${r.toString()}, but it is not trusted. Skipping parent folder inclusion for this workspace folder.`),[])}catch(l){let c=l instanceof Error?l.message:String(l);return o?.logInfo(`No repository root found for folder ${i.toString()}. Error accessing ${Ve(r,".git")}: ${c}.`),[]}n.push(r);let s=ai(r);if(ze(r,s)||r.path==="/"||ze(e,s)||t.has(s))break;r=s}return o?.logInfo(`No repository root found for folder ${i.toString()}.`),[]}async listFiles(i,e,t){if(e!=="user"&&e!=="local")throw new Error(`Unsupported prompt file storage: ${e}`);let o=this.getPromptSourceFolders(i),n=await this.toAbsoluteLocations(i,o.filter(s=>s.storage===e));e==="user"&&(i==="agent"||i==="instructions"||i==="prompt")&&n.push(this.userDataFolder);let r=new xn;for(let{searchRoot:s,filePattern:l}of n){let c=l===void 0?await this.resolveFilesAtLocation(s,i,t):await this.searchFilesInLocation(s,l,t);for(let u of c)hSi(u)===i&&r.add(u);if(t.isCancellationRequested)return[]}return[...r]}createFilesUpdatedEvent(i){let e=new O,t=e.add(new T),o=e.add(new qe).token,n=e.add(new O),r=bSi(i),s=this.userDataService.currentProfile.promptsHome,l=[],c=()=>{n.clear();for(let p of l)if(!this.getWorkspaceFolder(p.searchRoot)){let h=p.filePattern!==void 0||i==="instructions";n.add(this.fileService.watch(p.searchRoot,{recursive:h,excludes:[]}))}},u=async()=>{try{let p=this.getPromptSourceFolders(i);if(l=await this.toAbsoluteLocations(i,p,void 0),o.isCancellationRequested)return;c()}catch(p){this.logService.error("Error updating prompt file watchers after config change:",p)}};return e.add(this.configService.onDidChangeConfiguration(p=>{(p.affectsConfiguration(r)||p.affectsConfiguration(El.USE_CUSTOMIZATIONS_IN_PARENT_REPOS))&&(u(),t.fire())})),e.add(this.onDidChangeWorkspaceFolders()(()=>{u(),t.fire()})),e.add(this.workspaceTrustManagementService.onDidChangeTrustedFolders(()=>{u(),t.fire()})),e.add(this.fileService.onDidFilesChange(p=>{if(p.affects(s)){t.fire();return}if(l.some(h=>p.affects(h.searchRoot))){t.fire();return}})),e.add(this.fileService.watch(s)),u(),{event:t.event,dispose:()=>e.dispose()}}async getHookSourceFolders(){let e=this.getPromptSourceFolders("hook").filter(r=>!r.path.startsWith(".claude/")&&!r.path.includes("/.claude/")),t=await this.toAbsoluteLocations("hook",e),o=new xn,n=[];for(let r of t)o.has(r.searchRoot)||(o.add(r.searchRoot),n.push({...r,uri:r.searchRoot,filePattern:void 0}));return n}async getConfigBasedSourceFolders(i){let e=this.getPromptSourceFolders(i),t=await this.toAbsoluteLocations(i,e);if(i!=="prompt"&&i!=="instructions")return t.map(n=>n.uri);let o=new xn;for(let n of t){let r=n.uri,s=Be(r),l=["*.md",`*${UPt(i)}`];for(let c of l)if(s===c){r=ai(r);continue}s==="*"&&(r=ai(r)),Kao(r.path)!==!0&&o.add(r)}return[...o]}async getResolvedSourceFolders(i){let e=await this.getLocalStorageFolders(i),t=e.filter(n=>n.storage==="local"),o=e.filter(n=>n.storage==="user");return this.dedupeSourceFolders([...t,...o])}async getSourceFoldersInDiscoveryOrder(i){let e=await this.getLocalStorageFolders(i),t=e.filter(n=>n.storage==="user"),o=e.filter(n=>n.storage==="local");return this.dedupeSourceFolders([...t,...o])}async getLocalStorageFolders(i){let e=this.getPromptSourceFolders(i),t=this.getDefaultSourceFolders(i),o=[...t,...e.filter(r=>!t.some(s=>s.path===r.path))],n=await this.toAbsoluteLocations(i,o,t);return(i==="agent"||i==="instructions"||i==="prompt")&&n.push(this.userDataFolder),n}dedupeSourceFolders(i){let e=new xn,t=[];for(let o of i)e.has(o.uri)||(e.add(o.uri),t.push(o));return t}async toAbsoluteLocations(i,e,t){let o=[],n=new xn,r=await this.pathService.userHome(),s=await this.getWorkspaceFolderRoots(this.configService.getValue(El.USE_CUSTOMIZATIONS_IN_PARENT_REPOS)===!0),l=new Set(t?.map(u=>u.path)),c=e.filter(u=>{if(i==="instructions"||i==="prompt"){let h=u.path;return zao(h)&&(i==="prompt"?this.logService.warn(`[Deprecated] Glob patterns (* and **) in prompt file locations are deprecated: "${h}". Consider using explicit paths instead.`):i==="instructions"&&this.logService.info(`Glob patterns (* and **) detected in instruction file location: "${h}". Consider using explicit paths for better performance.`)),!0}let p=u.path;return d7o(p)?!0:(this.logService.warn(`Skipping invalid path (glob patterns and absolute paths not supported): ${p}`),!1)});for(let u of c){let p=u.path,h=l?.has(p);try{if(eXe(p)){let g=Ve(r,p.substring(2));if(!n.has(g)){n.add(g);let{searchRoot:f,filePattern:v}=wSi(i,g);o.push({uri:g,searchRoot:f,filePattern:v,source:u.source,storage:u.storage,displayPath:p,isDefault:h})}continue}if(Jl(p)){let g=A.file(p),f=this.environmentService.remoteAuthority;if(f&&(g=g.with({scheme:Q.vscodeRemote,authority:f})),!n.has(g)){n.add(g);let{searchRoot:v,filePattern:b}=wSi(i,g);o.push({uri:g,searchRoot:v,filePattern:b,source:u.source,storage:u.storage,displayPath:p,isDefault:h})}}else for(let g of s){let f=Ve(g,p);if(!n.has(f)){n.add(f);let{searchRoot:v,filePattern:b}=wSi(i,f);o.push({uri:f,searchRoot:v,filePattern:b,source:u.source,storage:u.storage,displayPath:p,isDefault:h})}}}catch(g){this.logService.error(`Failed to resolve prompt file location: ${p}`,g)}}return o}async resolveFilesAtLocation(i,e,t,o=0){if(e==="skill")return this.findAgentSkillsInFolder(i,t);let n=o===0&&this.getWorkspaceFolders().some(s=>ze(s.uri,i)),r=e==="instructions"&&!n&&!zao(i.path)&&o<l7o;try{let s=await this.fileService.resolve(i);if(t.isCancellationRequested)return[];if(s.isFile)return[s.resource];if(s.isDirectory&&s.children){let l=[];for(let c of s.children)if(c.isFile)l.push(c.resource);else if(r&&c.isDirectory){let u=await this.resolveFilesAtLocation(c.resource,e,t,o+1);l.push(...u)}return l}}catch(s){s instanceof ua&&s.fileOperationResult===1||this.logService.error(`Failed to resolve files at location: ${i.toString()}`,s)}return[]}async searchFilesInLocation(i,e,t){if(!this.searchService.schemeHasFileSearchProvider(i.scheme))return this.logService.warn(`[PromptFilesLocator] No FileSearchProvider available for scheme '${i.scheme}'. Cannot search for pattern '${e}' in ${i.toString()}`),[];let o=this.configService.getValue("explorer.excludeGitIgnore"),n=this.getWorkspaceFolder(i),r=l=>PH(this.configService.getValue({resource:l}))||{},s={folderQueries:[{folder:i,disregardIgnoreFiles:o}],type:1,shouldGlobMatchFilePattern:!0,excludePattern:n?r(n.uri):void 0,ignoreGlobCase:!0,sortByScore:!0,filePattern:e};try{let l=await this.searchService.fileSearch(s,t);return t.isCancellationRequested?[]:l.results.map(c=>c.resource)}catch(l){if(!Yi(l))throw l}return[]}async findAgentMDsInWorkspace(i){return(await Promise.all(this.getWorkspaceFolders().map(t=>this.findAgentMDsInFolder(t.uri,i)))).flat(1)}async findAgentMDsInFolder(i,e){if(this.searchService.schemeHasFileSearchProvider(i.scheme)){let t=this.configService.getValue("explorer.excludeGitIgnore"),o=r=>PH(this.configService.getValue({resource:r}))||{},n={folderQueries:[{folder:i,disregardIgnoreFiles:t}],type:1,shouldGlobMatchFilePattern:!0,excludePattern:o(i),filePattern:"**/AGENTS.md",ignoreGlobCase:!0};try{let r=await this.searchService.fileSearch(n,e);if(e.isCancellationRequested)return[];let s=[];for(let l of r.results)s.push({uri:l.resource,realPath:void 0,type:"agentsMd"});return s}catch(r){if(!Yi(r))throw r}return[]}else return this.findAgentMDsUsingFileService(i,e)}async findAgentMDsUsingFileService(i,e){let t=[],o="agents.md",n=async r=>{if(!e.isCancellationRequested)try{let s=await this.fileService.resolve(r);if(s.isFile&&s.name.toLowerCase()===o){let l=s.isSymbolicLink?await this.fileService.realpath(s.resource):void 0;t.push({uri:s.resource,realPath:l,type:"agentsMd"})}else if(s.isDirectory&&s.children)for(let l of s.children)await n(l.resource)}catch(s){this.logService.trace(`[PromptFilesLocator] Error traversing ${r.toString()}: ${s}`)}};return await n(i),t}async findFilesInRoots(i,e,t,o,n=[]){let r=i.map(l=>({resource:e!==void 0?Ve(l,e):l})),s=await this.fileService.resolveAll(r);if(o.isCancellationRequested)return n;for(let l of s)if(l.success&&l.stat?.children){for(let c of l.stat.children)if(c.isFile){let u=t.find(p=>xr(p.fileName,c.name));if(u){let p=c.isSymbolicLink?await this.fileService.realpath(c.resource):void 0;n.push({uri:c.resource,realPath:p,type:u.type})}}}return n}getAgentFileURIFromModeFile(i){if(i.path.endsWith(V2)){let e,t=this.getWorkspaceFolder(i);return t?e=Ve(t.uri,B2,Xb(i)+MZ):Yr(i,this.userDataService.currentProfile.promptsHome)&&(e=Ve(this.userDataService.currentProfile.promptsHome,Xb(i)+MZ)),e}}async findAgentSkillsInFolder(i,e){try{let t=[],o=await this.fileService.resolve(i);if(o.isDirectory&&o.children)for(let n of o.children)try{if(e.isCancellationRequested)return[];if(n.isDirectory){let r=Ve(n.resource,LH),s=await this.fileService.resolve(r);s.isFile&&t.push(s.resource)}}catch{}return t}catch(t){return Yi(t)||this.logService.trace(`[PromptFilesLocator] Error searching for skills in ${i.toString()}: ${t}`),[]}}async findAgentSkills(i){let e=this.getPromptSourceFolders("skill"),t=await this.toAbsoluteLocations("skill",e),o=[];for(let{uri:n,source:r,storage:s}of t){if(i.isCancellationRequested)return[];let l=await this.findAgentSkillsInFolder(n,i);for(let c of l)o.push({uri:c,source:r,storage:s,type:"skill"})}return o}};hDe=I([m(0,ge),m(1,B),m(2,Ae),m(3,Mt),m(4,Gg),m(5,gn),m(6,re),m(7,Pn),m(8,Or)],hDe);function zao(a){return a.includes("*")}function Kao(a){let i=!1,e=0,t=!1,o=0,n;for(let r of a){if(n==="\\"){n=r;continue}if(r==="*"||r==="?")return!0;if(r==="["){i=!0,e++,n=r;continue}if(r==="]"){i=!0,e--,n=r;continue}if(r==="{"){t=!0,o++;continue}if(r==="}"){t=!0,o--,n=r;continue}n=r}return!!(i&&e===0||t&&o===0)}function wSi(a,i){if(a!=="instructions"&&a!=="prompt")return{searchRoot:i};let e=i.path.split("/"),t=0;for(;t<e.length&&Kao(e[t])===!1;)t++;if(t===e.length)return{searchRoot:i};let o=i.with({path:e.slice(0,t).join("/")});return t===e.length-1&&e[t]==="*"||e[t]===""?{searchRoot:o}:{searchRoot:o,filePattern:e.slice(t).join("/")}}var Wpe="^(?![A-Za-z]:[\\\\/])(?!/)(?!~(?!/))(?!.*\\\\)(?!.*[*?\\[\\]{}]).*\\S.*$",c7o=new RegExp(Wpe);function d7o(a){return c7o.test(a)}function Gao(a,i=[],e={}){let o=new xSi(a).scan();return new kSi(o,a,i,e).parse()}function jI(a,i,e,t){return{type:a,startOffset:i,endOffset:e,rawValue:t?.rawValue??"",value:t?.value??"",format:t?.format??"none",indent:t?.indent??0}}var xSi=class{constructor(i){this.input=i;this.pos=0;this.tokens=[];this.flowDepth=0;this.seenBlockColon=!1;this.seenDocumentStart=0}scan(i=1){for(;this.pos<this.input.length&&(this.scanLine(),!(this.seenDocumentStart>i)););return this.tokens.push(jI(13,this.pos,this.pos)),this.tokens}scanLine(){if(this.seenBlockColon=!1,this.peekChar()===`
`){this.tokens.push(jI(8,this.pos,this.pos+1)),this.pos++;return}if(this.peekChar()==="\r"){let t=this.pos+(this.input[this.pos+1]===`
`?2:1);this.tokens.push(jI(8,this.pos,t)),this.pos=t;return}let i=this.pos,e=0;for(;this.pos<this.input.length&&(this.input[this.pos]===" "||this.input[this.pos]==="	");)e++,this.pos++;if(e>0&&this.tokens.push(jI(9,i,this.pos,{indent:e})),this.pos>=this.input.length||this.peekChar()===`
`||this.peekChar()==="\r"){if(this.pos<this.input.length){let t=this.pos,o=this.peekChar()==="\r"&&this.input[this.pos+1]===`
`?this.pos+2:this.pos+1;this.tokens.push(jI(8,t,o)),this.pos=o}return}if(e===0&&this.input.length-this.pos>=3){let t=this.input[this.pos],o=this.input[this.pos+1],n=this.input[this.pos+2],r=this.input[this.pos+3],s=r===void 0||r===" "||r==="	"||r===`
`||r==="\r";if(t==="-"&&o==="-"&&n==="-"&&s){this.tokens.push(jI(11,this.pos,this.pos+3)),this.pos+=3,this.scanLineContent(),this.scanNewline(),this.seenDocumentStart++;return}if(t==="."&&o==="."&&n==="."&&s){this.tokens.push(jI(12,this.pos,this.pos+3)),this.pos+=3,this.scanLineContent(),this.scanNewline();return}}if(this.peekChar()==="#"){this.scanComment(),this.scanNewline();return}if(this.peekChar()==="%"){for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.scanNewline();return}this.scanLineContent(),this.scanNewline()}scanLineContent(){for(;this.pos<this.input.length&&this.peekChar()!==`
`&&this.peekChar()!=="\r"&&(this.skipInlineWhitespace(),!(this.pos>=this.input.length||this.peekChar()===`
`||this.peekChar()==="\r"));){let i=this.peekChar();if(i==="#"){this.scanComment();break}else if(i==="{")this.flowDepth++,this.tokens.push(jI(4,this.pos,this.pos+1)),this.pos++;else if(i==="}"&&this.flowDepth>0)this.flowDepth--,this.tokens.push(jI(5,this.pos,this.pos+1)),this.pos++;else if(i==="[")this.flowDepth++,this.tokens.push(jI(6,this.pos,this.pos+1)),this.pos++;else if(i==="]"&&this.flowDepth>0)this.flowDepth--,this.tokens.push(jI(7,this.pos,this.pos+1)),this.pos++;else if(i===","&&this.flowDepth>0)this.tokens.push(jI(3,this.pos,this.pos+1)),this.pos++;else if(i==="-"&&this.isBlockDash())this.tokens.push(jI(2,this.pos,this.pos+1)),this.pos++;else if(i===":"&&this.isBlockColon())this.tokens.push(jI(1,this.pos,this.pos+1)),this.pos++,this.flowDepth===0&&(this.seenBlockColon=!0);else if(i===":"&&this.flowDepth>0&&this.lastTokenIsJsonLike())this.tokens.push(jI(1,this.pos,this.pos+1)),this.pos++;else if(i==="'"||i==='"')this.scanQuotedScalar(i);else if((i==="|"||i===">")&&this.flowDepth===0&&this.isBlockScalarStart()){this.scanBlockScalar(i);break}else this.scanUnquotedScalar()}}isBlockDash(){let i=this.input[this.pos+1];return i===void 0||i===" "||i==="	"||i===`
`||i==="\r"}isBlockColon(){if(this.seenBlockColon&&this.flowDepth===0)return!1;let i=this.input[this.pos+1];return i===void 0||i===" "||i==="	"||i===`
`||i==="\r"||this.flowDepth>0&&(i===","||i==="}"||i==="]")}lastTokenIsJsonLike(){for(let i=this.tokens.length-1;i>=0;i--){let e=this.tokens[i];if(!(e.type===8||e.type===9||e.type===10))return e.type===0&&e.format!=="none"||e.type===5||e.type===7}return!1}scanQuotedScalar(i){let e=this.pos;this.pos++;let t="",o=0;for(;this.pos<this.input.length;){let r=this.input[this.pos];if(r===i){if(i==="'"&&this.input[this.pos+1]==="'"){t+="'",this.pos+=2,o=0;continue}this.pos++;let s=this.input.substring(e,this.pos);this.tokens.push(jI(0,e,this.pos,{rawValue:s,value:t,format:i==="'"?"single":"double"}));return}if(i==='"'&&r==="\\"){let s=this.input[this.pos+1];if(s===`
`||s==="\r"){this.pos++,this.consumeNewline(),this.skipInlineWhitespace(),o=0;continue}switch(s){case"n":t+=`
`;break;case"t":t+="	";break;case"\\":t+="\\";break;case'"':t+='"';break;case"/":t+="/";break;case"r":t+="\r";break;case"0":t+="\0";break;case"a":t+="\x07";break;case"b":t+="\b";break;case"e":t+="\x1B";break;case"v":t+="\v";break;case"f":t+="\f";break;case" ":t+=" ";break;case"_":t+="\xA0";break;case"x":{let l=this.input.substring(this.pos+2,this.pos+4),c=parseInt(l,16);l.length===2&&!isNaN(c)?(t+=String.fromCharCode(c),this.pos+=4):(t+="\\x",this.pos+=2),o=0;continue}case"u":{let l=this.input.substring(this.pos+2,this.pos+6),c=parseInt(l,16);l.length===4&&!isNaN(c)?(t+=String.fromCodePoint(c),this.pos+=6):(t+="\\u",this.pos+=2),o=0;continue}case"U":{let l=this.input.substring(this.pos+2,this.pos+10),c=parseInt(l,16);l.length===8&&!isNaN(c)?(t+=String.fromCodePoint(c),this.pos+=10):(t+="\\U",this.pos+=2),o=0;continue}default:t+="\\"+(s??"");break}this.pos+=2,o=0;continue}if(r===`
`||r==="\r"){o>0&&(t=t.substring(0,t.length-o)),o=0,this.consumeNewline();let s=0;for(;this.pos<this.input.length;){this.skipInlineWhitespace();let l=this.input[this.pos];if(l===`
`||l==="\r")s++,this.consumeNewline();else break}s>0?t+=`
`.repeat(s):t+=" ";continue}r===" "||r==="	"?o++:o=0,t+=r,this.pos++}let n=this.input.substring(e,this.pos);this.tokens.push(jI(0,e,this.pos,{rawValue:n,value:t,format:i==="'"?"single":"double"}))}scanUnquotedScalar(){let i=this.pos,e=this.pos;for(;this.pos<this.input.length;){let o=this.input[this.pos];if(o===`
`||o==="\r"||this.flowDepth>0&&(o===","||o==="}"||o==="]")||this.flowDepth>0&&(o==="{"||o==="[")||o===":"&&this.isBlockColon()||o==="#"&&this.pos>i&&(this.input[this.pos-1]===" "||this.input[this.pos-1]==="	"))break;this.pos++,o!==" "&&o!=="	"&&(e=this.pos)}let t=this.input.substring(i,e);this.tokens.push(jI(0,i,e,{rawValue:t,value:t,format:"none"}))}isBlockScalarStart(){let i=this.pos+1;for(;i<this.input.length;){let t=this.input[i];if(t>="1"&&t<="9"){i++;continue}if(t==="+"||t==="-"){i++;continue}break}for(;i<this.input.length&&(this.input[i]===" "||this.input[i]==="	");)i++;if(i>=this.input.length)return!0;let e=this.input[i];return e===`
`||e==="\r"||e==="#"}scanBlockScalar(i){let e=this.pos;this.pos++;let t=0,o="clip";for(let h=0;h<2;h++)if(this.pos<this.input.length){let g=this.input[this.pos];g>="1"&&g<="9"&&t===0?(t=parseInt(g,10),this.pos++):g==="-"&&o==="clip"?(o="strip",this.pos++):g==="+"&&o==="clip"&&(o="keep",this.pos++)}for(;this.pos<this.input.length&&(this.input[this.pos]===" "||this.input[this.pos]==="	");)this.pos++;if(this.pos<this.input.length&&this.input[this.pos]==="#")for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.consumeNewline();let n=this.getParentBlockIndent(e),r=t>0?n+t:0,s=[],l=0;for(;this.pos<this.input.length;){let h=this.pos,g=0;for(;this.pos<this.input.length&&this.input[this.pos]===" ";)g++,this.pos++;if(this.pos>=this.input.length||this.input[this.pos]===`
`||this.input[this.pos]==="\r"){if(r>0&&g>=r){let b=this.input.substring(h+r,this.pos);s.push(b),b===""?l++:l=0}else s.push(""),l++;this.consumeNewline();continue}if(g===0&&this.input.length-this.pos>=3){let b=this.input[this.pos],S=this.input[this.pos+1],y=this.input[this.pos+2],w=this.input[this.pos+3],x=w===void 0||w===" "||w==="	"||w===`
`||w==="\r";if(b==="-"&&S==="-"&&y==="-"&&x||b==="."&&S==="."&&y==="."&&x){this.pos=h;break}}if(r===0){if(g<=n){this.pos=h;break}r=g}if(g<r){this.pos=h;break}let f=h+r;for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;let v=this.input.substring(f,this.pos);s.push(v),l=0,this.consumeNewline()}let c;if(i==="|")c=s.join(`
`);else{c="";let h=!1,g=!1,f=!1;for(let v=0;v<s.length;v++){let b=s[v],S=b.length>0&&(b[0]===" "||b[0]==="	");b===""?(c+=`
`,g=!0):v===0?(c=b,h=S,f=!0):g?((h||S)&&f?c+=`
`+b:c+=b,h=S,g=!1,f=!0):S||h?(c+=`
`+b,h=S,f=!0):(c+=" "+b,h=!1,f=!0)}}if(l>0){let h=c.length;for(;h>0&&c[h-1]===`
`;)h--;c=c.substring(0,h)}let u=s.some(h=>h!=="");switch(o){case"clip":u&&(c+=`
`);break;case"keep":u?c+=`
`.repeat(l+1):c=`
`.repeat(l);break;case"strip":break}let p=this.input.substring(e,this.pos);this.tokens.push(jI(0,e,this.pos,{rawValue:p,value:c,format:i==="|"?"literal":"folded"}))}getParentBlockIndent(i){for(let e=this.tokens.length-1;e>=0;e--){let t=this.tokens[e];if(!(t.type===8||t.type===10||t.type===9)){if(t.type===1){for(let o=e-1;o>=0;o--){let n=this.tokens[o];if(!(n.type===8||n.type===10||n.type===9))return this.getColumnAt(n.startOffset)}return 0}if(t.type===2)return this.getColumnAt(t.startOffset);if(t.type===11)return-1;break}}return 0}getColumnAt(i){let e=0,t=i-1;for(;t>=0&&this.input[t]!==`
`&&this.input[t]!=="\r";)e++,t--;return e}scanComment(){let i=this.pos;for(;this.pos<this.input.length&&this.input[this.pos]!==`
`&&this.input[this.pos]!=="\r";)this.pos++;this.tokens.push(jI(10,i,this.pos,{rawValue:this.input.substring(i,this.pos),value:this.input.substring(i,this.pos)}))}scanNewline(){let i=this.pos;this.consumeNewline()&&this.tokens.push(jI(8,i,this.pos))}skipInlineWhitespace(){for(;this.pos<this.input.length;){let i=this.input[this.pos];if(i===" "||i==="	")this.pos++;else break}}consumeNewline(){return this.pos>=this.input.length?!1:this.input[this.pos]==="\r"&&this.input[this.pos+1]===`
`?(this.pos+=2,!0):this.input[this.pos]===`
`||this.input[this.pos]==="\r"?(this.pos++,!0):!1}peekChar(){return this.input[this.pos]}},kSi=class{constructor(i,e,t,o){this.tokens=i;this.input=e;this.errors=t;this.options=o;this.pos=0}parse(){return this.skipNewlinesAndComments(),this.currentToken().type===11&&(this.advance(),this.skipNewlinesAndComments()),this.currentToken().type===13||this.currentToken().type===12?void 0:this.parseValue(-1)}currentToken(){return this.tokens[this.pos]}peek(i=0){return this.tokens[Math.min(this.pos+i,this.tokens.length-1)]}advance(){let i=this.tokens[this.pos];return i.type!==13&&this.pos++,i}expect(i){let e=this.currentToken();return e.type===i?this.advance():e}emitError(i,e,t,o){this.errors.push({message:i,startOffset:e,endOffset:t,code:o})}skipNewlinesAndComments(){for(;this.currentToken().type===8||this.currentToken().type===10||this.currentToken().type===9&&this.isFollowedByNewlineOrComment();)this.advance()}isFollowedByNewlineOrComment(){let i=this.peek(1);return i.type===8||i.type===10||i.type===13}currentIndent(){return this.currentToken().type===9?this.currentToken().indent:0}parseValue(i){this.skipNewlinesAndComments();let e=this.currentToken(),t=e.type===9?this.peek(1):e;if(t.type===4||t.type===6)return e.type===9&&this.advance(),t.type===4?this.parseFlowMap():this.parseFlowSeq();let o=this.currentIndent();if(this.peekPastIndent().type===2)return this.parseBlockSequence(o);if(this.looksLikeMapping())return this.parseBlockMapping(o);if(e.type===0||e.type===9)return this.parseScalar(i)}peekPastIndent(){return this.currentToken().type===9?this.peek(1):this.currentToken()}looksLikeMapping(){let i=0;return this.peek(i).type===9&&i++,this.peek(i).type===0&&(i++,this.peek(i).type===1)}parseScalar(i=-1){this.currentToken().type===9&&this.advance();let e=this.expect(0);return e.format!=="none"?this.scalarFromToken(e):this.parsePlainMultiline(e,i)}parsePlainMultiline(i,e){let t=i.value,o=i.endOffset;for(;;){let n=this.pos,r=0,s=!1;for(;this.pos<this.tokens.length;){let c=this.currentToken();if(c.type===10)break;if(c.type===8){this.advance();let u=this.currentToken();if(u.type===8){r++;continue}if(u.type===9){let p=this.peek(1);if(p.type===8||p.type===13){r++,this.advance();continue}if(p.type===10)break;if(u.indent>e){s=!0;break}else break}if(u.type===13||u.type===11||u.type===12)break;if(e<0){s=!0;break}break}if(c.type===9)break;break}if(!s){this.pos=n;break}if(this.currentToken().type===9&&this.advance(),this.currentToken().type!==0){if(this.currentToken().type===2){let c=this.advance(),u="-";if(this.currentToken().type===0){let p=this.advance();u="- "+p.value,o=p.endOffset}else o=c.endOffset;r>0?t+=`
`.repeat(r):t+=" ",t+=u;continue}this.pos=n;break}if(this.peek(1).type===1){this.pos=n;break}let l=this.advance();r>0?t+=`
`.repeat(r):t+=" ",t+=l.value,o=l.endOffset}return{type:"scalar",value:t,rawValue:this.input.substring(i.startOffset,o),startOffset:i.startOffset,endOffset:o,format:"none"}}parseBlockMapping(i,e=!1){let t=this.currentToken().startOffset,o=[],n=new Set;if(e){let s=this.parseMappingEntry(i);s&&(n.add(s.key.value),o.push(s))}for(;this.currentToken().type!==13&&(this.skipNewlinesAndComments(),this.currentToken().type!==13);){let s=this.currentIndent();if(s<i)break;if(s!==i)if(s>i)this.emitError(d(150,null,i,s),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-indentation");else break;if(!this.looksLikeMapping())break;let l=this.parseMappingEntry(i);if(!l)break;!this.options.allowDuplicateKeys&&n.has(l.key.value)&&this.emitError(d(143,null,l.key.value),l.key.startOffset,l.key.endOffset,"duplicate-key"),n.add(l.key.value),o.push(l)}let r=o.length>0?o[o.length-1].value.endOffset:t;return{type:"map",properties:o,style:"block",startOffset:t,endOffset:r}}parseMappingEntry(i){this.currentToken().type===9&&this.advance();let e=this.expect(0),t=this.scalarFromToken(e),o=this.expect(1);if(o.type!==1){this.emitError(d(144,null),o.startOffset,o.endOffset,"expected-colon");return}let n=this.parseMappingValue(i,o);return{key:t,value:n}}parseMappingValue(i,e){let t=this.currentToken();if(t.type===4)return this.parseFlowMap();if(t.type===6)return this.parseFlowSeq();if(t.type===0){this.currentToken().type===9&&this.advance();let r=this.advance();return r.format!=="none"?this.scalarFromToken(r):this.parsePlainMultiline(r,i)}if(this.skipNewlinesAndComments(),this.currentToken().type===13)return this.emitError(d(149,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset);let n=this.currentIndent();return n===i&&this.peekPastIndent().type===2?this.parseValue(i)??this.makeEmptyScalar(e.endOffset):n<=i?(this.emitError(d(149,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.parseValue(i)??this.makeEmptyScalar(e.endOffset)}parseBlockSequence(i){let e=[],t=this.currentToken().startOffset,o=t,n=!0;for(;this.currentToken().type!==13&&(this.skipNewlinesAndComments(),this.currentToken().type!==13);){let r;if(n&&this.currentToken().type===2?r=this.currentToken().startOffset-this.getLineStart(this.currentToken().startOffset):r=this.currentIndent(),n=!1,r<i)break;if(r!==i)if(r>i)this.emitError(d(150,null,i,r),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-indentation");else break;if(this.peekPastIndent().type!==2)break;this.currentToken().type===9&&this.advance();let l=this.advance(),c=this.parseSequenceItemValue(i,l);e.push(c),o=c.endOffset}return{type:"sequence",items:e,style:"block",startOffset:t,endOffset:o}}parseSequenceItemValue(i,e){let t=this.currentToken();if(t.type===10&&this.advance(),t.type===4)return this.parseFlowMap();if(t.type===6)return this.parseFlowSeq();if(t.type===2){let n=t.startOffset-this.getLineStart(t.startOffset);return this.parseBlockSequence(n)}if(t.type===0){if(this.peek(1).type===1){let n=t.startOffset-this.getLineStart(t.startOffset);return this.parseBlockMapping(n,!0)}return this.parseScalar(i)}return this.skipNewlinesAndComments(),this.currentToken().type===13?(this.emitError(d(148,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.currentIndent()<=i?(this.emitError(d(148,null),e.startOffset,e.endOffset,"missing-value"),this.makeEmptyScalar(e.endOffset)):this.parseValue(i)??this.makeEmptyScalar(e.endOffset)}getLineStart(i){let e=i-1;for(;e>=0&&this.input[e]!==`
`&&this.input[e]!=="\r";)e--;return e+1}parseFlowMap(){let i=this.advance(),e=[];for(this.skipFlowWhitespace();this.currentToken().type!==5&&this.currentToken().type!==13;){let o;if(this.currentToken().type===0)o=this.parseFlowScalar();else{this.emitError(d(147,null),this.currentToken().startOffset,this.currentToken().endOffset,"expected-key");break}this.skipFlowWhitespace();let n;this.currentToken().type===1?(this.advance(),this.skipFlowWhitespace(),n=this.parseFlowValue()):n=this.makeEmptyScalar(o.endOffset),e.push({key:o,value:n}),this.skipFlowWhitespace(),this.currentToken().type===3&&(this.advance(),this.skipFlowWhitespace())}let t=this.currentToken();return t.type===5?this.advance():this.emitError(d(145,null),t.startOffset,t.endOffset,"expected-flow-map-end"),{type:"map",properties:e,style:"flow",startOffset:i.startOffset,endOffset:t.type===5?t.endOffset:t.startOffset}}parseFlowSeq(){let i=this.advance(),e=[];for(this.skipFlowWhitespace();this.currentToken().type!==7&&this.currentToken().type!==13;){let o;if(this.currentToken().type===4)o=this.parseFlowMap();else if(this.currentToken().type===6)o=this.parseFlowSeq();else if(this.currentToken().type===0)o=this.parseFlowScalar();else{this.emitError(d(151,null),this.currentToken().startOffset,this.currentToken().endOffset,"unexpected-token"),this.advance();continue}e.push(o),this.skipFlowWhitespace(),this.currentToken().type===3&&(this.advance(),this.skipFlowWhitespace())}let t=this.currentToken();return t.type===7?this.advance():this.emitError(d(146,null),t.startOffset,t.endOffset,"expected-flow-seq-end"),{type:"sequence",items:e,style:"flow",startOffset:i.startOffset,endOffset:t.type===7?t.endOffset:t.startOffset}}parseFlowScalar(){let i=this.advance();if(i.format!=="none")return this.scalarFromToken(i);let e=i.value,t=i.endOffset;for(;;){let o=!1,n=this.pos;for(;n<this.tokens.length;){let s=this.tokens[n];if(s.type===8)o=!0,n++;else if(s.type===9||s.type===10)n++;else break}if(!o||n>=this.tokens.length)break;let r=this.tokens[n];if(r.type===0&&r.format==="none")this.pos=n+1,e+=" "+r.value,t=r.endOffset;else break}return{type:"scalar",value:e,rawValue:this.input.substring(i.startOffset,t),startOffset:i.startOffset,endOffset:t,format:"none"}}parseFlowValue(){return this.currentToken().type===4?this.parseFlowMap():this.currentToken().type===6?this.parseFlowSeq():this.currentToken().type===0?this.parseFlowScalar():this.makeEmptyScalar(this.currentToken().startOffset)}skipFlowWhitespace(){for(;;){let i=this.currentToken().type;if(i===8||i===9||i===10)this.advance();else break}}scalarFromToken(i){return{type:"scalar",value:i.value,rawValue:i.rawValue,startOffset:i.startOffset,endOffset:i.endOffset,format:i.format}}makeEmptyScalar(i){return{type:"scalar",value:"",rawValue:"",startOffset:i,endOffset:i,format:"none"}}};var z2=class{constructor(){}parse(i,e){let t=K3i(e);if(t.length===0)return new $Pt(i,void 0,void 0);let o,n,r=0;if(t[0].match(/^---[\s\r\n]*$/)){let s=t.findIndex((c,u)=>u>0&&c.match(/^---[\s\r\n]*$/));s===-1?(s=t.length,r=t.length):r=s+1;let l=new G(2,1,s+1,1);o=new TSi(l,i,t)}if(r<t.length){let s=new G(r+1,1,t.length+1,1);n=new _Si(s,t,i)}return new $Pt(i,o,n)}},$Pt=class{constructor(i,e,t){this.uri=i;this.header=e;this.body=t}},no;(M=>(M.name="name",M.description="description",M.agent="agent",M.mode="mode",M.model="model",M.applyTo="applyTo",M.paths="paths",M.tools="tools",M.handOffs="handoffs",M.advancedOptions="advancedOptions",M.argumentHint="argument-hint",M.excludeAgent="excludeAgent",M.target="target",M.infer="infer",M.license="license",M.compatibility="compatibility",M.metadata="metadata",M.agents="agents",M.userInvocable="user-invocable",M.disableModelInvocation="disable-model-invocation",M.hooks="hooks",M.context="context"))(no||={});var TSi=class{constructor(i,e,t){this.range=i;this.uri=e;this.linesWithEOL=t}get _parsedHeader(){if(this._parsed===void 0){let i=[],e=this.linesWithEOL.slice(this.range.startLineNumber-1,this.range.endLineNumber-1).join(""),t=Gao(e,i),o=new TA(e),n=({startOffset:c,endOffset:u})=>{let p=o.getPosition(c),h=o.getPosition(u),g=this.range.startLineNumber-1;return new G(p.lineNumber+g,p.column,h.lineNumber+g,h.column)},r=c=>{switch(c.type){case"scalar":return{type:"scalar",value:c.value,range:n(c),format:c.format};case"sequence":return{type:"sequence",items:c.items.map(u=>r(u)),range:n(c)};case"map":return{type:"map",properties:c.properties.map(p=>({key:r(p.key),value:r(p.value)})),range:n(c)}}},s=[],l=i.map(c=>({message:c.message,range:n(c),code:c.code}));if(t)if(t.type!=="map")l.push({message:"Invalid header, expecting <key: value> pairs",range:this.range,code:"INVALID_YAML"});else for(let c of t.properties)s.push({key:c.key.value,range:n({startOffset:c.key.startOffset,endOffset:c.value.endOffset}),value:r(c.value)});this._parsed={node:t,attributes:s,errors:l}}return this._parsed}get attributes(){return this._parsedHeader.attributes}getAttribute(i){return this._parsedHeader.attributes.find(e=>e.key===i)}get errors(){return this._parsedHeader.errors}getStringAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e?.value.type==="scalar")return e.value.value}get name(){return this.getStringAttribute(no.name)}get description(){return this.getStringAttribute(no.description)}get agent(){return this.getStringAttribute(no.agent)??this.getStringAttribute(no.mode)}get model(){return this.getStringOrStringArrayAttribute(no.model)}get applyTo(){return this.getStringAttribute(no.applyTo)}get paths(){return this.getStringOrStringArrayAttribute(no.paths)}get argumentHint(){return this.getStringAttribute(no.argumentHint)}get target(){return this.getStringAttribute(no.target)}get infer(){return this.getBooleanAttribute(no.infer)}get tools(){let i=this._parsedHeader.attributes.find(t=>t.key===no.tools);if(!i)return;let e=i.value;if(e.type==="scalar"&&(e=AH(e)),e.type==="sequence"){let t=[];for(let o of e.items)o.type==="scalar"&&o.value&&t.push(o.value);return t}}get handOffs(){let i=this._parsedHeader.attributes.find(e=>e.key===no.handOffs);if(i&&i.value.type==="sequence"){let e=[];for(let t of i.value.items)if(t.type==="map"){let o,n,r,s,l,c;for(let u of t.properties)u.key.value==="agent"&&u.value.type==="scalar"?o=u.value.value:u.key.value==="label"&&u.value.type==="scalar"?n=u.value.value:u.key.value==="prompt"&&u.value.type==="scalar"?r=u.value.value:u.key.value==="send"&&u.value.type==="scalar"?s=ESi(u.value):u.key.value==="showContinueOn"&&u.value.type==="scalar"?l=ESi(u.value):u.key.value==="model"&&u.value.type==="scalar"&&(c=u.value.value);if(o&&n?.trim()&&r!==void 0){let u={agent:o,label:n,prompt:r,...s!==void 0?{send:s}:{},...l!==void 0?{showContinueOn:l}:{},...c!==void 0?{model:c}:{}};e.push(u)}}return e}}getStringArrayAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e&&e.value.type==="sequence"){let t=[];for(let o of e.value.items)o.type==="scalar"&&o.value&&t.push(o.value);return t}}getStringOrStringArrayAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e){if(e.value.type==="scalar")return[e.value.value];if(e.value.type==="sequence"){let t=[];for(let o of e.value.items)o.type==="scalar"&&t.push(o.value);return t}}}get agents(){return this.getStringArrayAttribute(no.agents)}get userInvocable(){return this.getBooleanAttribute(no.userInvocable)}get disableModelInvocation(){return this.getBooleanAttribute(no.disableModelInvocation)}get context(){return this.getStringAttribute(no.context)}get hooksRaw(){let i=this._parsedHeader.attributes.find(e=>e.key===no.hooks);if(i?.value.type==="map")return i.value}getBooleanAttribute(i){let e=this._parsedHeader.attributes.find(t=>t.key===i);if(e?.value.type==="scalar")return ESi(e.value)}};function ESi(a){if(a.value==="true")return!0;if(a.value==="false")return!1}var _Si=class{constructor(i,e,t){this.range=i;this.linesWithEOL=e;this.uri=t}get fileReferences(){return this.getParsedBody().fileReferences}get variableReferences(){return this.getParsedBody().variableReferences}get offset(){return this.getParsedBody().bodyOffset}getParsedBody(){if(this._parsed===void 0){let i=[],e=[],t=[],o=yt.reduce(yt.slice(this.linesWithEOL,0,this.range.startLineNumber-1),(l,c)=>c.length+l,0),n=!1,r,s=0;for(let l=this.range.startLineNumber-1,c=o;l<this.range.endLineNumber-1;l++){let u=this.linesWithEOL[l],p=u.trimStart(),h=/^(?<fence>(`{3,}|~{3,}))/u.exec(p);if(h){let y=h.groups.fence,w=y[0],x=y.length,E=p.slice(y.length);if(!n){n=!0,r=w,s=x,c+=u.length;continue}if(r===w&&x>=s&&/^\s*$/.test(E)){n=!1,r=void 0,s=0,c+=u.length;continue}}if(n){c+=u.length;continue}let g=[];for(let y of u.matchAll(/`[^`]+`/g))g.push({start:y.index,end:y.index+y[0].length});let f=y=>g.some(w=>y>=w.start&&y<w.end),v=u.matchAll(/\[(.*?)\]\((.+?)\)/g);for(let y of v){if(y.index>0&&u[y.index-1]==="!"||f(y.index))continue;let w=y.index+y[0].length-1,x=y.index+y[0].length-y[2].length-1,E=new G(l+1,x+1,l+1,w+1);e.push({content:y[2],range:E,isMarkdownLink:!0}),i.push(new G(l+1,y.index+1,l+1,y.index+y[0].length+1))}let b=/#file:(?<filePath>[^\s#]+)|#tool:(?<toolName>[\w_\-\.\/]+)/gi,S=u.matchAll(b);for(let y of S){let w=y[0],x=new G(l+1,y.index+1,l+1,y.index+w.length+1);if(i.some(H=>G.areIntersectingOrTouching(H,x))||f(y.index))continue;let E=y.groups?.filePath||y.groups?.toolName;if(!E)continue;let M=y.index+w.length-E.length,N=y.index+w.length,V=new G(l+1,M+1,l+1,N+1);y.groups?.filePath?e.push({content:y.groups?.filePath,range:V,isMarkdownLink:!1}):y.groups?.toolName&&t.push({name:y.groups?.toolName,range:V,offset:c+y.index,fullLength:w.length})}c+=u.length}this._parsed={fileReferences:e.sort((l,c)=>G.compareRangesUsingStarts(l.range,c.range)),variableReferences:t,bodyOffset:o}}return this._parsed}getContent(){return this.linesWithEOL.slice(this.range.startLineNumber-1,this.range.endLineNumber-1).join("")}resolveFilePath(i){try{if(i.startsWith("/"))return this.uri.with({path:i});if(i.match(/^[a-zA-Z]+:\//))return A.parse(i);{let e=ai(this.uri);return Ve(e,i)}}catch{return}}};function AH(a){let i=[],e=a.value,t=a.range.getStartPosition(),o=0,n=r=>r===" "||r==="	";for(;o<e.length;){for(;o<e.length&&n(e[o]);)o++;if(o>=e.length)break;let r=o,s="",l,c,u=e[o];if(u==='"'||u==="'"){let p=u;for(o++;o<e.length&&e[o]!==p;)s+=e[o],o++;l=o+1,o<e.length&&o++,c=p==='"'?"double":"single"}else{let p=o;for(;o<e.length&&e[o]!==",";)s+=e[o],o++;s=s.trimEnd(),l=p+s.length,c="none"}for(i.push({type:"scalar",value:s,range:new G(t.lineNumber,t.column+r,t.lineNumber,t.column+l),format:c});o<e.length&&n(e[o]);)o++;o<e.length&&e[o]===","&&o++}return{type:"sequence",items:i,range:a.range}}function qao(a,i){return i?a?.paths?.join(", ")??"**":a?.applyTo}var fE=(u=>(u.SessionStart="SessionStart",u.SessionEnd="SessionEnd",u.UserPromptSubmit="UserPromptSubmit",u.PreToolUse="PreToolUse",u.PostToolUse="PostToolUse",u.PreCompact="PreCompact",u.SubagentStart="SubagentStart",u.SubagentStop="SubagentStop",u.Stop="Stop",u.ErrorOccurred="ErrorOccurred",u))(fE||{}),qg={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(fE).map(a=>[a,a]))},yC={SessionStart:{label:d(9462,null),description:d(9461,null)},UserPromptSubmit:{label:d(9470,null),description:d(9469,null)},PreToolUse:{label:d(9458,null),description:d(9457,null)},PostToolUse:{label:d(9454,null),description:d(9453,null)},PreCompact:{label:d(9456,null),description:d(9455,null)},SubagentStart:{label:d(9466,null),description:d(9465,null)},SubagentStop:{label:d(9468,null),description:d(9467,null)},Stop:{label:d(9464,null),description:d(9463,null)},SessionEnd:{label:d(9460,null),description:d(9459,null)},ErrorOccurred:{label:d(9452,null),description:d(9451,null)}};function jPt(a,i){if(!a)return i;let e={...a};for(let t of Object.values(fE)){let o=a[t],n=i[t];n&&n.length>0&&(e[t]=o?[...o,...n]:n)}return e}var Px={type:d(9444,null),command:d(9435,null),windows:d(9445,null),linux:d(9439,null),osx:d(9440,null),bash:d(9433,null),powershell:d(9441,null),cwd:d(9437,null),env:d(9438,null),timeout:d(9442,null),timeoutSec:d(9443,null)},u7o={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["command"]},{required:["windows"]},{required:["linux"]},{required:["osx"]},{required:["bash"]},{required:["powershell"]}],errorMessage:d(9436,null),properties:{type:{type:"string",enum:["command"],description:Px.type},command:{type:"string",description:Px.command},windows:{type:"string",description:Px.windows},linux:{type:"string",description:Px.linux},osx:{type:"string",description:Px.osx},cwd:{type:"string",description:Px.cwd},env:{type:"object",additionalProperties:{type:"string"},description:Px.env},timeout:{type:"number",default:30,description:Px.timeout}}},p7o={type:"array",items:u7o};function Qao(a,i){return Object.fromEntries(Object.entries(qg[a]).map(([e,t])=>[e,{...i,description:yC[t]?.description}]))}var m7o=Qao("vscode",p7o),h7o={type:"object",additionalProperties:!0,required:["type"],anyOf:[{required:["bash"]},{required:["powershell"]}],errorMessage:d(9434,null),properties:{type:{type:"string",enum:["command"],description:Px.type},bash:{type:"string",description:Px.bash},powershell:{type:"string",description:Px.powershell},cwd:{type:"string",description:Px.cwd},env:{type:"object",additionalProperties:{type:"string"},description:Px.env},timeoutSec:{type:"number",default:10,description:Px.timeoutSec}}},g7o={type:"array",items:h7o},f7o=Qao("github-copilot",g7o),Yao={$schema:"http://json-schema.org/draft-07/schema#",type:"object",description:d(9446,null),additionalProperties:!0,required:["hooks"],properties:{hooks:{type:"object",description:d(9447,null),additionalProperties:!0}},if:{required:["version"],properties:{version:{type:"number"}}},then:{properties:{version:{type:"number",description:d(9450,null)},hooks:{properties:f7o}}},else:{properties:{hooks:{properties:m7o}}},defaultSnippets:[{label:d(9448,null),description:d(9449,null),body:{hooks:{SessionStart:[{type:"command",command:'${1:echo "Session started" >> session.log}'}],PreToolUse:[{type:"command",command:"${2:./scripts/validate.sh}",timeout:15}]}}}]},RSi="vscode://schemas/hooks";function oXe(a){if(Object.values(fE).includes(a))return a}function v7o(a){if(a.type!=="command")return;let i=typeof a.command=="string"&&a.command.length>0,e=typeof a.bash=="string"&&a.bash.length>0,t=typeof a.powershell=="string"&&a.powershell.length>0,o=typeof a.windows=="string"&&a.windows.length>0,n=typeof a.linux=="string"&&a.linux.length>0,r=typeof a.osx=="string"&&a.osx.length>0,s=o?a.windows:t?a.powershell:void 0,l=n?a.linux:e?a.bash:void 0,c=r?a.osx:e?a.bash:void 0,u=o?"windows":t?"powershell":void 0,p=n?"linux":e?"bash":void 0,h=r?"osx":e?"bash":void 0;return{...i&&{command:a.command},...s&&{windows:s},...l&&{linux:l},...c&&{osx:c},...u&&{windowsSource:u},...p&&{linuxSource:p},...h&&{osxSource:h},...typeof a.cwd=="string"&&{cwd:a.cwd},...typeof a.env=="object"&&a.env!==null&&{env:a.env},...typeof a.timeout!="number"&&typeof a.timeoutSec=="number"&&{timeout:a.timeoutSec},...typeof a.timeout=="number"&&{timeout:a.timeout}}}function LSi(a,i){return i===1&&a.windows?a.windows:i===2&&a.osx?a.osx:i===3&&a.linux?a.linux:a.command}function Xao(a,i){let e=a;return i===1&&a.windows?e.windowsSource??"windows":i===2&&a.osx?e.osxSource??"osx":i===3&&a.linux?e.linuxSource??"linux":"command"}function G0(a,i){let e=LSi(a,i);return e||""}function $ao(a,i,e){let t=v7o(a);if(!t)return;let o;if(t.cwd){let n=aK(t.cwd,e);Jl(n)?o=A.file(n):i&&(o=Ve(i,n))}else o=i;return{type:"command",...t.command&&{command:t.command},...t.windows&&{windows:t.windows},...t.linux&&{linux:t.linux},...t.osx&&{osx:t.osx},...t.windowsSource&&{windowsSource:t.windowsSource},...t.linuxSource&&{linuxSource:t.linuxSource},...t.osxSource&&{osxSource:t.osxSource},...o&&{cwd:o},...t.env&&{env:t.env},...t.timeout!==void 0&&{timeout:t.timeout}}}function nXe(a,i,e){if(!a||typeof a!="object")return[];let t=a,o=[],n=t.hooks;if(n!==void 0&&Array.isArray(n))for(let r of n){if(!r||typeof r!="object")continue;let s=jao(r),l=$ao(s,i,e);l&&o.push(l)}else{let r=jao(t),s=$ao(r,i,e);s&&o.push(s)}return o}function jao(a){return a.type===void 0||a.type==="command"?{...a,type:"command"}:a}function DSi(a){switch(a.type){case"scalar":return a.value;case"sequence":return a.items.map(DSi);case"map":{let i={};for(let e of a.properties)i[e.key.value]=DSi(e.value);return i}}}function Jao(a,i,e,t="undefined"){let o={},n=qg[t]??qg.undefined;for(let r of a.properties){let s=r.key.value,l=n[s]??oXe(s);if(!l||r.value.type!=="sequence")continue;let c=[];for(let u of r.value.items){let p=DSi(u),h=nXe(p,i,e);c.push(...h)}c.length>0&&(o[l]||(o[l]=[]),o[l].push(...c))}return o}var QPt;function b7o(){if(!QPt){QPt=new Map;for(let[a,i]of Object.entries(qg.claude))QPt.set(i,a)}return QPt}function MSi(a){return qg.claude[a]}function PSi(a){return b7o().get(a)}function ASi(a,i,e){let t=new Map;if(!a||typeof a!="object")return{hooks:t,disabledAllHooks:!1};let o=a;if(o.disableAllHooks===!0)return{hooks:t,disabledAllHooks:!0};let n=o.hooks;if(!n||typeof n!="object")return{hooks:t,disabledAllHooks:!1};let r=n;for(let s of Object.keys(r)){let l=MSi(s)??oXe(s);if(!l)continue;let c=r[s];if(!Array.isArray(c))continue;let u=[];for(let p of c){let h=nXe(p,i,e);u.push(...h)}if(u.length>0){let p=t.get(l);p?p.hooks.push(...u):t.set(l,{hooks:u,originalId:s})}}return{hooks:t,disabledAllHooks:!1}}var Zao=qg["github-copilot"],YPt;function S7o(){if(!YPt){YPt=new Map;for(let[a,i]of Object.entries(Zao))YPt.set(i,a)}return YPt}function rXe(a){return Zao[a]}function NSi(a){return S7o().get(a)}function sXe(a){let i=Jo(a.path).toLowerCase(),e=yd(a.path);return(i==="settings.json"||i==="settings.local.json")&&e.endsWith(".claude")?"claude":"copilot"}function elo(a,i,e){let t=new Map;if(!a||typeof a!="object")return t;let n=a.hooks;if(!n||typeof n!="object")return t;let r=n;for(let s of Object.keys(r)){let l=rXe(s)??oXe(s);if(!l)continue;let c=r[s];if(!Array.isArray(c))continue;let u=[];for(let p of c){let h=nXe(p,i,e);u.push(...h)}u.length>0&&t.set(l,{hooks:u,originalId:s})}return t}function gDe(a,i,e,t){let o=sXe(a),n,r=!1;if(o==="claude"){let s=ASi(i,e,t);n=s.hooks,r=s.disabledAllHooks}else n=elo(i,e,t);return{format:o,hooks:n,disabledAllHooks:r}}function tlo(a,i,e,t){let o=sXe(a),n;switch(o){case"claude":{if(i&&typeof i=="object"){let{disableAllHooks:r,...s}=i;n=ASi(s,e,t).hooks}else n=new Map;break}default:n=elo(i,e,t);break}return{format:o,hooks:n,disabledAllHooks:!0}}function OSi(a){let i={type:"command",command:""};return a==="claude"?{matcher:"",hooks:[i]}:i}var A3;(e=>(e.mcpServers="mcp-servers",e.github="github"))(A3||={});var cXe;(i=>i.disallowedTools="disallowedTools")(cXe||={});function JPt(a){return a==="vscode"||a==="github-copilot"||a==="claude"||a==="undefined"}var lXe=[{name:"true"},{name:"false"}],I7o=[{name:"vscode"},{name:"github-copilot"}],ilo={[no.name]:{type:"scalar",description:d(9542,null)},[no.description]:{type:"scalar",description:d(9540,null)},[no.argumentHint]:{type:"scalar",description:d(9539,null)},[no.model]:{type:"scalar | sequence",description:d(9541,null)},[no.tools]:{type:"scalar | sequence",description:d(9543,null),defaults:["[]","['search', 'edit', 'web']"]},[no.agent]:{type:"scalar",description:d(9538,null)},[no.mode]:{type:"scalar",description:d(9538,null)}},olo={[no.name]:{type:"scalar",description:d(9537,null)},[no.description]:{type:"scalar",description:d(9535,null)},[no.applyTo]:{type:"scalar",description:d(9534,null),defaults:["'**'","'**/*.ts, **/*.js'","'**/*.php'","'**/*.py'"]},[no.excludeAgent]:{type:"scalar | sequence",description:d(9536,null)}},nlo={[no.name]:{type:"scalar",description:d(9530,null)},[no.description]:{type:"scalar",description:d(9523,null)},[no.argumentHint]:{type:"scalar",description:d(9522,null)},[no.model]:{type:"scalar | sequence",description:d(9529,null)},[no.tools]:{type:"scalar | sequence",description:d(9532,null),defaults:["[]","[search, edit, web]"]},[no.handOffs]:{type:"sequence",description:d(9526,null)},[no.target]:{type:"scalar",description:d(9531,null),enums:I7o},[no.infer]:{type:"scalar",description:d(9528,null),enums:lXe},[no.agents]:{type:"sequence",description:d(9521,null),defaults:['["*"]']},[no.userInvocable]:{type:"scalar",description:d(9533,null),enums:lXe},[no.disableModelInvocation]:{type:"scalar",description:d(9524,null),enums:lXe},[no.advancedOptions]:{type:"map",description:d(9520,null)},[A3.github]:{type:"map",description:d(9525,null)},[no.hooks]:{type:"map",description:d(9527,null)}},rlo={[no.name]:{type:"scalar",description:d(9552,null)},[no.description]:{type:"scalar",description:d(9548,null)},[no.argumentHint]:{type:"scalar",description:d(9544,null)},[no.userInvocable]:{type:"scalar",description:d(9553,null),enums:lXe},[no.disableModelInvocation]:{type:"scalar",description:d(9549,null),enums:lXe},[no.license]:{type:"scalar | map",description:d(9550,null)},[no.compatibility]:{type:"scalar | map",description:d(9545,null)},[no.metadata]:{type:"map",description:d(9551,null)},[no.context]:{type:"scalar",description:d(9546,null),enums:[{name:"fork",description:d(9547,null)}]}},aXe={prompt:Object.keys(ilo),instructions:Object.keys(olo),agent:Object.keys(nlo),skill:Object.keys(rlo),hook:[]},y7o=[no.name,no.description,no.tools,no.target,A3.mcpServers,A3.github,no.infer],w7o={prompt:aXe.prompt.filter(a=>!XPt(a)),instructions:aXe.instructions.filter(a=>!XPt(a)),agent:aXe.agent.filter(a=>!XPt(a)),skill:aXe.skill.filter(a=>!XPt(a)),hook:[]};function FSi(a,i,e){return e==="claude"?a==="instructions"?Object.keys(dlo):Object.keys(clo):e==="github-copilot"&&a==="agent"?y7o:i?aXe[a]:w7o[a]}function XPt(a){return a===no.advancedOptions||a===no.excludeAgent||a===no.mode||a===no.infer}function FZ(a,i,e){switch(i){case"instructions":return e==="claude"?dlo[a]:olo[a];case"skill":return rlo[a];case"agent":return e==="claude"?clo[a]:nlo[a];case"prompt":return ilo[a];default:return}}var slo=[{name:Am.execute,description:d(9517,null)},{name:Am.read,description:d(9518,null)},{name:Am.edit,description:d(9516,null)},{name:Am.search,description:d(9519,null)},{name:Am.agent,description:d(9515,null)}],OZ=[{name:"Bash",description:d(9489,null),toolEquivalent:[Am.execute]},{name:"Edit",description:d(9490,null),toolEquivalent:["edit/editNotebook","edit/editFiles"]},{name:"Glob",description:d(9491,null),toolEquivalent:["search/fileSearch"]},{name:"Grep",description:d(9492,null),toolEquivalent:["search/textSearch"]},{name:"Read",description:d(9508,null),toolEquivalent:["read/readFile","read/getNotebookSummary"]},{name:"Write",description:d(9514,null),toolEquivalent:["edit/createDirectory","edit/createFile","edit/createJupyterNotebook"]},{name:"WebFetch",description:d(9512,null),toolEquivalent:[Am.web]},{name:"WebSearch",description:d(9513,null),toolEquivalent:[Am.web]},{name:"Task",description:d(9511,null),toolEquivalent:[Am.agent]},{name:"Skill",description:d(9509,null),toolEquivalent:[]},{name:"LSP",description:d(9495,null),toolEquivalent:[]},{name:"NotebookEdit",description:d(9500,null),toolEquivalent:["edit/editNotebook"]},{name:"AskUserQuestion",description:d(9488,null),toolEquivalent:["vscode/askQuestions"]},{name:"MCPSearch",description:d(9496,null),toolEquivalent:[]}],ZPt=[{name:"sonnet",description:d(9510,null),modelEquivalent:"Claude Sonnet 4.5 (copilot)"},{name:"opus",description:d(9501,null),modelEquivalent:"Claude Opus 4.6 (copilot)"},{name:"haiku",description:d(9493,null),modelEquivalent:"Claude Haiku 4.5 (copilot)"},{name:"inherit",description:d(9494,null),modelEquivalent:void 0}];function alo(a){let i=[];for(let e of a){let t=ZPt.find(o=>o.name===e);t&&t.modelEquivalent&&i.push(t.modelEquivalent)}return i}function llo(a){let i=[];for(let e of a){let t=OZ.find(o=>o.name===e);t&&i.push(...t.toolEquivalent)}return i}var clo={name:{type:"scalar",description:d(9482,null)},description:{type:"scalar",description:d(9476,null)},tools:{type:"sequence",description:d(9487,null),defaults:["Read, Edit, Bash"],items:OZ},disallowedTools:{type:"sequence",description:d(9477,null),defaults:["Write, Edit, Bash"],items:OZ},model:{type:"scalar",description:d(9481,null),defaults:["sonnet","opus","haiku","inherit"],enums:ZPt},permissionMode:{type:"scalar",description:d(9483,null),defaults:["default","acceptEdits","dontAsk","bypassPermissions","plan"],enums:[{name:"default",description:d(9504,null)},{name:"acceptEdits",description:d(9502,null)},{name:"plan",description:d(9507,null)},{name:"delegate",description:d(9505,null)},{name:"dontAsk",description:d(9506,null)},{name:"bypassPermissions",description:d(9503,null)}]},skills:{type:"sequence",description:d(9486,null)},mcpServers:{type:"sequence",description:d(9479,null)},hooks:{type:"object",description:d(9478,null)},memory:{type:"scalar",description:d(9480,null),defaults:["user","project","local"],enums:[{name:"user",description:d(9499,null)},{name:"project",description:d(9498,null)},{name:"local",description:d(9497,null)}]}},dlo={description:{type:"scalar",description:d(9484,null)},paths:{type:"sequence",description:d(9485,null)}};function WZ(a){return a==="vscode"||a==="undefined"}function Ax(a,i){let e=i instanceof A?i:i.uri;if(a==="agent"){if(ai(e).path.endsWith(`/${W2}`))return"claude";if(!(i instanceof A)){let o=i.target;if(o==="github-copilot"||o==="vscode")return o}return"undefined"}else if(a==="instructions"&&H2(e))return"claude";return"undefined"}var mm=le("agentPluginService");function fDe(a,i){let e=Be(a.uri),t=ulo(e),o=ulo(i);return o.startsWith(`${t}:`)?o:t===o?t:`${t}:${o}`}function ulo(a){return a.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_.:-]/g,"-").replace(/-+/g,"-").replace(/^[-:.]+|[-:.]+$/g,"")}var WSi=class{constructor(){this._discovery=[]}register(i){this._discovery.push(i)}getAll(){return this._discovery}},Vpe=new WSi;function sN(a){return(i,e,t)=>new dXe(a,i,e,t)}var dXe=class extends gA{constructor(e,t,o,n){let r=()=>{let c=n.get(e.key,t);if(c!==void 0)try{return e.fromStorage(c)}catch{return e.defaultValue}return e.defaultValue},s=r();super(new yp(void 0,`storage/${e.key}`,void 0),s,pv,Dl.ofCaller());this.opts=e;this.storageScope=t;this.storageTarget=o;this.storageService=n;this._store=new O;this._noStorageUpdateNeeded=!1;let l=n.onDidChangeValue(t,e.key,this._store);this._store.add(l(c=>{if(c.external&&c.key===e.key){this._noStorageUpdateNeeded=!0;try{this.set(r(),void 0)}finally{this._noStorageUpdateNeeded=!1}}}))}_setValue(e){if(super._setValue(e),this._noStorageUpdateNeeded)return;let t=this.opts.toStorage(this.get());this.storageService.store(this.opts.key,t,this.storageScope,this.storageTarget)}dispose(){this._store.dispose()}};dXe=I([m(3,de)],dXe);function Xf(a){return a===2||a===3}function sR(a){return!Xf(a)}function C7o(a){return JSON.stringify([...a])}function x7o(a){let i=JSON.parse(a);return new Map(Array.isArray(i)?i:[])}var VZ=class extends k{constructor(i,e){super();let t=sN({key:i,defaultValue:new Map,toStorage:C7o,fromStorage:x7o});this._profileState=this._register(t(0,1,e)),this._workspaceState=this._register(t(1,1,e))}readEnabled(i,e){let t=this._workspaceState.read(e);if(t.has(i))return t.get(i)?3:1;let o=this._profileState.read(e);return o.has(i)?o.get(i)?2:0:2}setEnabled(i,e,t){switch(e){case 2:{this._deleteFromMap(this._profileState,i,t),this._deleteFromMap(this._workspaceState,i,t);break}case 0:{this._setInMap(this._profileState,i,!1,t),this._deleteFromMap(this._workspaceState,i,t);break}case 3:{this._setInMap(this._workspaceState,i,!0,t);break}case 1:{this._setInMap(this._workspaceState,i,!1,t);break}}}remove(i){this._deleteFromMap(this._profileState,i),this._deleteFromMap(this._workspaceState,i)}_setInMap(i,e,t,o){let n=i.get();if(n.get(e)===t)return;let r=new Map(n);r.set(e,t),i.set(r,o)}_deleteFromMap(i,e,t){let o=i.get();if(!o.has(e))return;let n=new Map(o);n.delete(e),i.set(n,t)}};VZ=I([m(1,de)],VZ);var k7o=["prompt","instructions","agent","skill","hook"],vDe=class extends k{constructor(e,t,o,n,r,s){super();this.logger=e;this.fileService=t;this.modelService=o;this.extensionService=n;this.filesConfigService=r;this.contextKeyService=s;this.contributedFiles={prompt:new dt,instructions:new dt,agent:new dt,skill:new dt,hook:new dt};this._promptFileProviders=[];this._contributedWhenKeys=new Set;this._contributedWhenClauses=new Map;this._providerWhenClauses=new Map;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._pendingReadonlyUris=[];this._pendingReadonlyFlush=!1;this._register(this.contextKeyService.onDidChangeContext(l=>{if(l.affectsSome(this._contributedWhenKeys))for(let c of k7o)this._onDidChange.fire({type:c})}))}async getExtensionPromptFiles(e,t){await this.extensionService.whenInstalledExtensionsRegistered();let n=(await Promise.allSettled(this.contributedFiles[e].values())).filter(l=>l.status==="fulfilled").map(l=>l.value),r=this._getProviderActivationEvent(e),s=r?await this._listFromProviders(e,r,t):[];return[...n,...s].filter(l=>{if(!l.when)return!0;let c=C.deserialize(l.when);return c?this.contextKeyService.contextMatchesRules(c):(this.logger.warn(`[getExtensionPromptFiles] Ignoring contributed prompt file with invalid when clause: ${l.when}`),!1)})}registerContributedFile(e,t,o,n,r,s,l){let c=this.contributedFiles[e];if(c.has(t))return k.None;let u=(async()=>{if(e==="skill")try{let p=await this._validateAndSanitizeSkillFile(t,Ie.None);n=p.name,r=p.description}catch(p){let h=p instanceof Error?p.message:String(p);throw this.logger.error(`[registerContributedFile] Extension '${o.identifier.value}' failed to validate skill file: ${t}`,h),p}return{uri:t,name:n,description:r,when:s,sessionTypes:l,storage:"extension",type:e,extension:o,source:"extension-contribution"}})();return c.set(t,u),this._enqueueReadonlyUpdate(t),s&&(this._contributedWhenClauses.set(`${e}/${t.toString()}`,s),this._updateContributedWhenKeys()),this._onDidChange.fire({type:e}),{dispose:()=>{c.delete(t),s&&(this._contributedWhenClauses.delete(`${e}/${t.toString()}`),this._updateContributedWhenKeys()),this._onDidChange.fire({type:e})}}}registerPromptFileProvider(e,t,o){let n={extension:e,type:t,...o};this._promptFileProviders.push(n);let r=new O;return o.onDidChangePromptFiles&&r.add(o.onDidChangePromptFiles(()=>{this._onDidChange.fire({type:t})})),this._onDidChange.fire({type:t}),r.add({dispose:()=>{let s=this._promptFileProviders.findIndex(l=>l===n);s>=0&&(this._promptFileProviders.splice(s,1),this._providerWhenClauses.delete(n),this._updateContributedWhenKeys(),this._onDidChange.fire({type:t}))}}),r}async _listFromProviders(e,t,o){let n=[],r=[];await this.extensionService.activateByEvent(t);let s=this._promptFileProviders.filter(l=>l.type===e);if(s.length===0)return n;for(let l of s)try{let c=await l.providePromptFiles({},o);if(this._providerWhenClauses.set(l,c?.flatMap(u=>u.when?[u.when]:[])??[]),this._updateContributedWhenKeys(),!c||o.isCancellationRequested)continue;for(let u of c)r.push(u.uri),n.push({uri:u.uri,storage:"extension",type:e,extension:l.extension,source:"extension-api",name:u.name,description:u.description,when:u.when,sessionTypes:u.sessionTypes})}catch(c){this.logger.error(`[listFromProviders] Failed to get ${e} files from provider`,c instanceof Error?c.message:String(c))}return this.filesConfigService.updateReadonly(r,!0),n}_getProviderActivationEvent(e){switch(e){case"agent":return mao;case"instructions":return hao;case"prompt":return gao;case"skill":return fao;case"hook":return}}_enqueueReadonlyUpdate(e){this._pendingReadonlyUris.push(e),this._pendingReadonlyFlush||(this._pendingReadonlyFlush=!0,queueMicrotask(()=>{let t=this._pendingReadonlyUris;this._pendingReadonlyUris=[],this._pendingReadonlyFlush=!1,this.filesConfigService.updateReadonly(t,!0)}))}_updateContributedWhenKeys(){this._contributedWhenKeys.clear();for(let e of this._contributedWhenClauses.values()){let t=C.deserialize(e);for(let o of t?.keys()??[])this._contributedWhenKeys.add(o)}for(let e of this._providerWhenClauses.values())for(let t of e){let o=C.deserialize(t);for(let n of o?.keys()??[])this._contributedWhenKeys.add(n)}}async _validateAndSanitizeSkillFile(e,t){let o=await this._parsePromptFile(e,t),n=PZ(e),r=o.header?.name;r||(this.logger.debug(`[validateAndSanitizeSkillFile] Agent skill file missing name attribute, using folder name "${n}": ${e}`),r=n);let s=o.header?.description,l=this._truncateAgentSkillName(r,e);l!==n&&(this.logger.debug(`[validateAndSanitizeSkillFile] Agent skill name "${l}" does not match folder name "${n}", using folder name: ${e}`),l=n);let c=s?this._truncateAgentSkillDescription(s,e):void 0;return{name:l,description:c}}async _parsePromptFile(e,t){let o=this.modelService.getModel(e);if(o)return new z2().parse(e,o.getValue());let n=await this.fileService.readFile(e);if(t.isCancellationRequested)throw new qi;return new z2().parse(e,n.value.toString())}_sanitizeAgentSkillText(e){return e.replace(/<[^>]+>/g,"")}_truncateAgentSkillName(e,t){let n=this._sanitizeAgentSkillText(e);return n!==e&&this.logger.debug(`[findAgentSkills] Agent skill name contains XML tags, removed: ${t}`),n.length>64?(this.logger.debug(`[findAgentSkills] Agent skill name exceeds 64 characters, truncated: ${t}`),n.substring(0,64)):n}_truncateAgentSkillDescription(e,t){let n=this._sanitizeAgentSkillText(e);return n!==e&&this.logger.debug(`[findAgentSkills] Agent skill description contains XML tags, removed: ${t}`),n.length>1024?(this.logger.debug(`[findAgentSkills] Agent skill description exceeds 1024 characters, truncated: ${t}`),n.substring(0,1024)):n}};vDe=I([m(0,re),m(1,ge),m(2,_t),m(3,lt),m(4,fr),m(5,X)],vDe);var bDe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.logger=e;this.labelService=t;this.modelService=o;this.instantiationService=n;this.userDataService=r;this.configurationService=s;this.fileService=l;this.storageService=c;this.telemetryService=u;this.workspaceService=p;this.pathService=h;this.agentPluginService=g;this.workspaceTrustService=f;this.cachedParsedPromptFromModels=new dt;this.cachedFileLocations={};this.fileLocatorEvents={};this._onDidPluginPromptFilesChange=this._register(new T);this._onDidPluginHooksChange=this._register(new T);this._pluginPromptFilesByType=new Map;this.disabledPromptsStorageKeyPrefix="chat.disabledPromptFiles.";this.fileLocator=this.createPromptFilesLocator(),this._register(this.modelService.onModelRemoved(S=>{this.cachedParsedPromptFromModels.delete(S.uri)})),this.extensionPromptFiles=this._register(this.instantiationService.createInstance(vDe));let v=this.extensionPromptFiles.onDidChange;this._register(v(S=>{this.cachedFileLocations[S.type]=void 0}));let b=this._register(new VSi(this.modelService)).onDidPromptChange;this.cachedCustomAgents=this._register(new Bpe(S=>this.computeAgentDiscoveryInfo(S),()=>U.any(this.getFileLocatorEvent("agent"),U.filter(b,S=>S.promptType==="agent"),U.filter(this.configurationService.onDidChangeConfiguration,S=>S.affectsConfiguration(El.USE_CHAT_HOOKS)),U.filter(v,S=>S.type==="agent"),U.filter(this._onDidPluginPromptFilesChange.event,S=>S==="agent"),this.workspaceTrustService.onDidChangeTrust))),this.cachedSlashCommands=this._register(new Bpe(S=>this.computeSlashCommandDiscoveryInfo(S),()=>U.any(this.getFileLocatorEvent("prompt"),this.getFileLocatorEvent("skill"),U.filter(b,S=>S.promptType==="prompt"),U.filter(b,S=>S.promptType==="skill"),U.filter(v,S=>S.type==="prompt"||S.type==="skill"),U.filter(this._onDidPluginPromptFilesChange.event,S=>S==="prompt"||S==="skill")))),this.cachedSkills=this._register(new Bpe(S=>this.computeSkillDiscovery(S),()=>U.any(this.getFileLocatorEvent("skill"),U.filter(b,S=>S.promptType==="skill"),U.filter(v,S=>S.type==="skill"),U.filter(this._onDidPluginPromptFilesChange.event,S=>S==="skill")))),this.cachedHooks=this._register(new Bpe(S=>this.computeHooks(S),()=>U.any(this.getFileLocatorEvent("hook"),U.filter(this.configurationService.onDidChangeConfiguration,S=>S.affectsConfiguration(El.USE_CHAT_HOOKS)||S.affectsConfiguration(El.USE_CLAUDE_HOOKS)),this._onDidPluginHooksChange.event,this.workspaceTrustService.onDidChangeTrust))),this.cachedInstructions=this._register(new Bpe(S=>this.computeInstructionFiles(S),()=>U.any(this.getFileLocatorEvent("instructions"),U.filter(v,S=>S.type==="instructions"),U.filter(this._onDidPluginPromptFilesChange.event,S=>S==="instructions")))),this._register(this.watchPluginPromptFilesForType("prompt",(S,y)=>S.commands.read(y))),this._register(this.watchPluginPromptFilesForType("skill",(S,y)=>S.skills.read(y))),this._register(this.watchPluginPromptFilesForType("agent",(S,y)=>S.agents.read(y))),this._register(this.watchPluginPromptFilesForType("instructions",(S,y)=>S.instructions.read(y))),this._register(ve(S=>{let y=this.agentPluginService.plugins.read(S),w=[];for(let x of y)if(Xf(x.enablement.read(S)))for(let E of x.hooks.read(S))w.push({uri:E.uri,storage:"plugin",type:"hook",name:fDe(x,E.originalId),pluginUri:x.uri,source:"plugin"});this._pluginPromptFilesByType.set("hook",w),this.cachedFileLocations.hook=void 0,this._onDidPluginHooksChange.fire()}))}watchPluginPromptFilesForType(e,t){return ve(o=>{let n=this.agentPluginService.plugins.read(o),r=[];for(let s of n)if(Xf(s.enablement.read(o)))for(let l of t(s,o))r.push({uri:l.uri,storage:"plugin",type:e,name:fDe(s,l.name),pluginUri:s.uri,source:"plugin"});r.sort((s,l)=>`${s.name??""}|${s.uri.toString()}`.localeCompare(`${l.name??""}|${l.uri.toString()}`)),this._pluginPromptFilesByType.set(e,r),this.cachedFileLocations[e]=void 0,this._onDidPluginPromptFilesChange.fire(e)})}createPromptFilesLocator(){return this.instantiationService.createInstance(hDe)}getFileLocatorEvent(e){let t=this.fileLocatorEvents[e];return t||(t=this.fileLocatorEvents[e]=this._register(this.fileLocator.createFilesUpdatedEvent(e)).event,this._register(t(()=>{this.cachedFileLocations[e]=void 0}))),t}getParsedPromptFile(e){let t=this.cachedParsedPromptFromModels.get(e.uri);if(t&&t[0]===e.getVersionId())return t[1];let o=new z2().parse(e.uri,e.getValue());return(!t||t[0]<e.getVersionId())&&this.cachedParsedPromptFromModels.set(e.uri,[e.getVersionId(),o]),o}async listPromptFiles(e,t){let o=this.cachedFileLocations[e];return o||(o=this.computeListPromptFiles(e,t),this.fileLocatorEvents[e]&&(this.cachedFileLocations[e]=o),o)}async computeListPromptFiles(e,t){return(await Promise.all([this.fileLocator.listFiles(e,"user",t).then(n=>n.map(r=>({uri:r,storage:"user",type:e}))),this.fileLocator.listFiles(e,"local",t).then(n=>n.map(r=>({uri:r,storage:"local",type:e}))),this.getExtensionPromptFiles(e,t),this._pluginPromptFilesByType.get(e)??[]])).flat()}async _collectSourceFolderDiagnostics(e){return(await this.fileLocator.getSourceFoldersInDiscoveryOrder(e)).map(o=>({uri:o.uri,storage:o.storage}))}registerPromptFileProvider(e,t,o){return this.extensionPromptFiles.registerPromptFileProvider(e,t,o)}async listPromptFilesForStorage(e,t,o){let n;switch(t){case"extension":n=await this.getExtensionPromptFiles(e,o);break;case"local":n=await this.fileLocator.listFiles(e,"local",o).then(r=>r.map(s=>({uri:s,storage:"local",type:e})));break;case"user":n=await this.fileLocator.listFiles(e,"user",o).then(r=>r.map(s=>({uri:s,storage:"user",type:e})));break;case"plugin":n=this._pluginPromptFilesByType.get(e)??[];break;default:throw new Error(`[listPromptFilesForStorage] Unsupported prompt storage type: ${t}`)}return n}getExtensionPromptFiles(e,t){return this.extensionPromptFiles.getExtensionPromptFiles(e,t)}async getSourceFolders(e){let t=[];if(e==="hook"){let o=await this.fileLocator.getHookSourceFolders();for(let n of o)t.push({uri:n.uri,storage:n.storage,type:e,source:n.source})}else for(let o of await this.fileLocator.getConfigBasedSourceFolders(e))t.push({uri:o,storage:"local",type:e});if(e!=="skill"&&e!=="hook"){let o=this.userDataService.currentProfile.promptsHome;t.push({uri:o,storage:"user",type:e})}return t}async getResolvedSourceFolders(e){return this.fileLocator.getResolvedSourceFolders(e)}get onDidChangeSlashCommands(){return this.cachedSlashCommands.onDidChangePromise}async getPromptSlashCommands(e){let t=await this.cachedSlashCommands.get(e);return this.slashCommandsFromDiscoveryInfo(t)}async computeSlashCommandDiscoveryInfo(e){let t=On.create(!0),o=await this.listPromptFiles("prompt",e),n=this.configurationService.getValue(El.USE_AGENT_SKILLS),r=n?await this.listPromptFiles("skill",e):[],s=this.getDisabledPromptFiles("skill"),l=[...o,...r.filter(g=>!s.has(g.uri))],u=await Promise.all(l.map(async g=>{try{let f=await this.parseNew(g.uri,e),v;g.type==="skill"?v=PZ(g.uri):v=f?.header?.name??g.name??Xb(g.uri);let b=g.source==="plugin"&&g.pluginUri?fDe({uri:g.pluginUri},v):v,S=f?.header?.description??g.description,y=f?.header?.argumentHint,w=f?.header?.userInvocable;return{status:"loaded",promptPath:this.withPromptPathMetadata(g,b,S),argumentHint:y,userInvocable:w}}catch(f){return this.logger.error(`[computeSlashCommandDiscoveryInfo] Failed to parse prompt file for slash command: ${g.uri}`,f instanceof Error?f.message:String(f)),{status:"skipped",skipReason:"parse-error",errorMessage:f instanceof Error?f.message:String(f),promptPath:g}}})),h=[...await this._collectSourceFolderDiagnostics("prompt")];if(n){let g=await this._collectSourceFolderDiagnostics("skill");h.push(...g)}return{type:"prompt",files:u,sourceFolders:h,durationInMillis:t.elapsed()}}slashCommandsFromDiscoveryInfo(e){let t=[],o=new xn;for(let n of e.files)n.status==="loaded"&&(t.push(this.asChatPromptSlashCommand(n.argumentHint,n.userInvocable,n.promptPath)),o.add(n.promptPath.uri));for(let n of this.modelService.getModels())if(n.getLanguageId()===r_&&n.uri.scheme===Q.untitled&&!o.has(n.uri)){let r=this.getParsedPromptFile(n),s=r?.header?.name??Xb(n.uri),l=r?.header?.description;t.push(this.asChatPromptSlashCommand(r?.header?.argumentHint,r?.header?.userInvocable,{uri:n.uri,storage:"local",type:"prompt",name:s,description:l}))}return t}isValidSlashCommandName(e){return e.match(/^[\p{L}\d_\-\.:]+$/u)!==null}async resolvePromptSlashCommand(e,t,o){let r=(await this.getPromptSlashCommands(o)).find(s=>s.name===e&&lb(s.sessionTypes,t));if(r)return{...r,parsedPromptFile:await this.parseNew(r.uri,o)}}asChatPromptSlashCommand(e,t,o){let n=o.name??Xb(o.uri);return n=n.replace(/[^\p{L}\d_\-\.:]+/gu,"-"),{uri:o.uri,name:n,source:o.source,storage:o.storage,type:o.type,extension:o.extension,pluginUri:o.pluginUri,description:o.description,argumentHint:e,userInvocable:t??!0,sessionTypes:o.sessionTypes}}async getPromptSlashCommandName(e,t){let n=(await this.getPromptSlashCommands(t)).find(r=>ze(r.uri,e));return n?n.name:Xb(e)}get onDidChangeCustomAgents(){return this.cachedCustomAgents.onDidChangePromise}get onDidChangeInstructions(){return this.cachedInstructions.onDidChangePromise}async getCustomAgents(e){let t=await this.cachedCustomAgents.get(e);return this.agentsFromDiscoveryInfo(t)}agentsFromDiscoveryInfo(e){let t=[];for(let o of e.files)o.agent&&t.push(o.agent);return t}async computeAgentDiscoveryInfo(e){let t=On.create(!0),o=await this.listPromptFiles("agent",e),n=this.getDisabledPromptFiles("agent"),r=this.configurationService.getValue(El.USE_CHAT_HOOKS),s=this.workspaceTrustService.isWorkspaceTrusted(),l=await this.pathService.userHome(),c=l.scheme===Q.file?l.fsPath:l.path,u=this.workspaceService.getWorkspace().folders[0],p=await Promise.all(o.map(async g=>{let f=g.uri,v=!n.has(f);try{let b=await this.parseNew(f,e),S,y=b.header?.hooksRaw;if(r&&s&&y){let V=(this.workspaceService.getWorkspaceFolder(f)??u)?.uri,H=Ax("agent",b.header??g.uri);S=Jao(y,V,c,H)}let w={sessionTypes:g.sessionTypes,hooks:S,name:g.name,description:g.description,source:plo.fromPromptPath(g),enabled:v},x=eAt.fromParsedPromptFile(b,w);return{status:v?"loaded":"skipped",skipReason:v?void 0:"disabled",promptPath:this.withPromptPathMetadata(g,x.name,x.description),agent:x}}catch(b){let S=b instanceof Error?b:new Error(String(b));return S instanceof ua&&S.fileOperationResult===1?this.logger.warn(`[computeAgentDiscoveryInfo] Skipping agent file that does not exist: ${f}`,S.message):this.logger.error(`[computeAgentDiscoveryInfo] Failed to parse agent file: ${f}`,S),{status:"skipped",skipReason:"parse-error",errorMessage:S.message,promptPath:g}}})),h=await this._collectSourceFolderDiagnostics("agent");return{type:"agent",files:p,sourceFolders:h,durationInMillis:t.elapsed()}}async parseNew(e,t){let o=this.modelService.getModel(e);if(o)return this.getParsedPromptFile(o);let n=await this.fileService.readFile(e);if(t.isCancellationRequested)throw new qi;return new z2().parse(e,n.value.toString())}registerContributedFile(e,t,o,n,r,s,l){return this.extensionPromptFiles.registerContributedFile(e,t,o,n,r,s,l)}getPromptLocationLabel(e){switch(e.storage){case"local":return this.labelService.getUriLabel(ai(e.uri),{relative:!0});case"user":return d(9762,null);case"extension":return d(9760,null,e.extension.displayName??e.extension.id);case"plugin":return d(9761,null);default:bs(e,"Unknown prompt storage type")}}async listNestedAgentMDs(e){return this.configurationService.getValue(El.USE_AGENT_MD)?this.configurationService.getValue(El.USE_NESTED_AGENT_MD)?await this.fileLocator.findAgentMDsInWorkspace(e):[]:[]}async listAgentInstructions(e,t){let o=[],n=[],r=this.configurationService.getValue(El.USE_CUSTOMIZATIONS_IN_PARENT_REPOS)===!0,s=await this.fileLocator.getWorkspaceFolderRoots(r,t),l=[];if(this.configurationService.getValue(El.USE_AGENT_MD)?l.push({fileName:dDe,type:"agentsMd"}):t?.logInfo("Agent MD files are disabled via configuration."),!this.configurationService.getValue(El.USE_CLAUDE_MD))t?.logInfo("Claude MD files are disabled via configuration.");else{let b={fileName:Mao,type:"claudeMd"};l.push(b),l.push({fileName:Pao,type:"claudeMd"}),n.push(this.fileLocator.findFilesInRoots(s,qYe,[b],e,o)),n.push(this.fileLocator.findFilesInRoots([await this.pathService.userHome()],qYe,[b],e,o))}if(!this.configurationService.getValue(El.USE_COPILOT_INSTRUCTION_FILES))t?.logInfo("Copilot instructions files are disabled via configuration.");else{let b=[{fileName:FPt,type:"copilotInstructionsMd"}];n.push(this.fileLocator.findFilesInRoots(s,Aao,b,e,o))}if(n.push(this.fileLocator.findFilesInRoots(s,void 0,l,e,o)),await Promise.all(n),e.isCancellationRequested)return[];let h=new xn,g=[],f=[],v=b=>(b.realPath?g.push(b):(f.push(b),h.add(b.uri)),!0);o.forEach(v);for(let b of g)h.has(b.realPath)?t?.logInfo(`Skipping symlinked agent instructions file ${b.uri} as target already included: ${b.realPath}`):(f.push(b),h.add(b.realPath));return f.sort((b,S)=>b.uri.toString().localeCompare(S.uri.toString()))}getAgentFileURIFromModeFile(e){return this.fileLocator.getAgentFileURIFromModeFile(e)}getDisabledPromptFiles(e){let t=this.disabledPromptsStorageKeyPrefix+e,o=this.storageService.get(t,0,"[]"),n=new xn;try{let r=JSON.parse(o);if(Array.isArray(r))for(let s of r)try{n.add(A.revive(s))}catch{}}catch{}return n}setDisabledPromptFiles(e,t){let o=Array.from(t).map(n=>n.toJSON());this.storageService.store(this.disabledPromptsStorageKeyPrefix+e,JSON.stringify(o),0,0),e==="agent"?this.cachedCustomAgents.refresh():e==="skill"&&(this.cachedSkills.refresh(),this.cachedSlashCommands.refresh())}sanitizeAgentSkillText(e){return e.replace(/<[^>]+>/g,"")}truncateAgentSkillName(e,t){let n=this.sanitizeAgentSkillText(e);return n!==e&&this.logger.debug(`[findAgentSkills] Agent skill name contains XML tags, removed: ${t}`),n.length>64?(this.logger.debug(`[findAgentSkills] Agent skill name exceeds 64 characters, truncated: ${t}`),n.substring(0,64)):n}truncateAgentSkillDescription(e,t){if(!e)return;let o=1024,n=this.sanitizeAgentSkillText(e);return n!==e&&this.logger.debug(`[findAgentSkills] Agent skill description contains XML tags, removed: ${t}`),n.length>o?(this.logger.debug(`[findAgentSkills] Agent skill description exceeds ${o} characters, truncated: ${t}`),n.substring(0,o)):n}get onDidChangeSkills(){return this.cachedSkills.onDidChangePromise}get onDidChangeHooks(){return this.cachedHooks.onDidChangePromise}async findAgentSkills(e){if(!this.configurationService.getValue(El.USE_AGENT_SKILLS))return;let o=await this.cachedSkills.get(e);return this.skillsFromDiscoveryInfo(o)}skillsFromDiscoveryInfo(e){let t=[];for(let o of e.files)if(o.status==="loaded"&&o.promptPath.name){let n=this.truncateAgentSkillDescription(o.promptPath.description,o.promptPath.uri);t.push({uri:o.promptPath.uri,storage:o.promptPath.storage,name:o.promptPath.name,description:n,disableModelInvocation:o.disableModelInvocation??!1,userInvocable:o.userInvocable??!0,pluginUri:o.promptPath.pluginUri,extension:o.promptPath.extension,sessionTypes:o.promptPath.sessionTypes})}return t}async computeSkillDiscovery(e){let t=On.create(!0),o=await this.computeSkillDiscoveryInfo(e),n=await this._collectSourceFolderDiagnostics("skill"),r=new Map;for(let g of o)if(g.status==="loaded"&&g.promptPath.name){let f=g.promptPath.source;f&&r.set(f,(r.get(f)||0)+1)}let s=0,l=0,c=0,u=0,p=0;for(let g of o)if(g.status==="skipped")switch(g.skipReason){case"missing-name":s++;break;case"missing-description":l++;break;case"duplicate-name":c++;break;case"name-mismatch":p++;break;case"parse-error":u++;break}let h=o.filter(g=>g.status==="loaded"&&g.promptPath.name).length;return this.telemetryService.publicLog2("agentSkillsFound",{totalSkillsFound:h,claudePersonal:r.get("claude-personal")??0,claudeWorkspace:r.get("claude-workspace")??0,copilotPersonal:r.get("copilot-personal")??0,githubWorkspace:r.get("github-workspace")??0,agentsPersonal:r.get("agents-personal")??0,agentsWorkspace:r.get("agents-workspace")??0,configWorkspace:r.get("config-workspace")??0,configPersonal:r.get("config-personal")??0,extensionContribution:r.get("extension-contribution")??0,extensionAPI:r.get("extension-api")??0,plugin:r.get("plugin")??0,skippedDuplicateName:c,skippedMissingName:s,skippedMissingDescription:l,skippedNameMismatch:p,skippedParseFailed:u}),{type:"skill",files:o,sourceFolders:n,durationInMillis:t.elapsed()}}async getHooks(e){return(await this.cachedHooks.get(e)).hooksInfo}async getDiscoveryInfo(e,t){switch(e){case"instructions":return this.cachedInstructions.get(t);case"prompt":return this.cachedSlashCommands.get(t);case"agent":return this.cachedCustomAgents.get(t);case"skill":return this.cachedSkills.get(t);case"hook":return this.cachedHooks.get(t)}}async getInstructionFiles(e){let t=await this.cachedInstructions.get(e);return this.instructionsFromDiscoveryInfo(t)}instructionsFromDiscoveryInfo(e){let t=[];for(let o of e.files)o.status==="loaded"&&o.promptPath.name&&t.push({uri:o.promptPath.uri,storage:o.promptPath.storage,extension:o.promptPath.extension,pluginUri:o.promptPath.pluginUri,source:o.promptPath.source,name:o.promptPath.name,description:o.promptPath.description,pattern:o.pattern,sessionTypes:o.promptPath.sessionTypes});return t}withPromptPathMetadata(e,t,o){return{...e,name:t,description:o}}async computeInstructionFiles(e){return await this.getInstructionsDiscoveryInfo(e)}async computeHooks(e){let t=On.create(!0),o=this.configurationService.getValue(El.USE_CHAT_HOOKS);if(!o||!this.workspaceTrustService.isWorkspaceTrusted()){let S=await this.listPromptFiles("hook",e),y=o?"workspace-untrusted":"disabled",w=S.map(E=>({status:"skipped",skipReason:y,promptPath:this.withPromptPathMetadata(E,Be(E.uri),E.description)})),x=await this._collectSourceFolderDiagnostics("hook");return{type:"hook",files:w,sourceFolders:x,hooksInfo:void 0,durationInMillis:t.elapsed()}}let n=this.configurationService.getValue(El.USE_CLAUDE_HOOKS),r=await this.listPromptFiles("hook",e);this.logger.trace(`[PromptsService] Found ${r.length} hook file(s).`);let s=await this.pathService.userHome(),l=s.scheme===Q.file?s.fsPath:s.path,c=this.workspaceService.getWorkspace().folders[0],u=await Promise.all(r.map(async S=>{let y=Be(S.uri);if(S.storage==="plugin")return{file:{status:"loaded",promptPath:this.withPromptPathMetadata(S,y,S.description)}};try{let w=await this.fileService.readFile(S.uri),x=is(w.value.toString());if(!x||typeof x!="object")return{file:{status:"skipped",skipReason:"parse-error",errorMessage:"Invalid hooks file: must be a JSON object",promptPath:this.withPromptPathMetadata(S,y,S.description)}};let M=(this.workspaceService.getWorkspaceFolder(S.uri)??c)?.uri,{format:N,hooks:V,disabledAllHooks:H}=gDe(S.uri,x,M,l);if(H)return this.logger.trace(`[PromptsService] Skipping hook file with disableAllHooks: ${S.uri}`),{file:{status:"skipped",skipReason:"all-hooks-disabled",promptPath:this.withPromptPathMetadata(S,y,S.description)}};if(N==="claude"&&n===!1){let j=[...V.values()].some(({hooks:J})=>J.length>0);return this.logger.trace(`[PromptsService] Skipping Claude hook file (disabled via setting): ${S.uri}`),{file:{status:"skipped",skipReason:"claude-hooks-disabled",promptPath:this.withPromptPathMetadata(S,y,S.description)},hasDisabledClaudeHooks:j}}let K=new Map;for(let[j,{hooks:J}]of V)for(let se of J){let ae=K.get(j);ae||(ae=[],K.set(j,ae)),ae.push(se),this.logger.trace(`[PromptsService] Collected ${j} hook from ${S.uri} (format: ${N})`)}return{file:{status:"loaded",promptPath:this.withPromptPathMetadata(S,y,S.description)},hooks:K,sourceUri:S.uri}}catch(w){let x=w instanceof Error?w.message:String(w);return this.logger.warn(`[PromptsService] Failed to parse hook file: ${S.uri}`,w),{file:{status:"skipped",skipReason:"parse-error",errorMessage:x,promptPath:this.withPromptPathMetadata(S,y,S.description)}}}})),p=[],h=!1,g=new Map;for(let{file:S,hooks:y,sourceUri:w,hasDisabledClaudeHooks:x}of u)if(S&&p.push(S),x&&(h=!0),y&&w)for(let[E,M]of y){let N=g.get(E);N||(N=[],g.set(E,N));for(let V of M)N.push({...V,sourceUri:w})}let f=this.agentPluginService.plugins.get();for(let S of f)if(Xf(S.enablement.get()))for(let y of S.hooks.get()){let w=g.get(y.type);w||(w=[],g.set(y.type,w));for(let x of y.hooks)w.push({...x,sourceUri:y.uri})}let v=await this._collectSourceFolderDiagnostics("hook");if(g.size===0)return this.logger.trace("[PromptsService] No valid hooks collected."),{type:"hook",files:p,sourceFolders:v,hooksInfo:void 0,durationInMillis:t.elapsed()};let b=Object.fromEntries(g);return this.logger.trace(`[PromptsService] Collected hooks: ${JSON.stringify(Object.keys(b))}`),{type:"hook",files:p,sourceFolders:v,hooksInfo:{hooks:b,hasDisabledClaudeHooks:h},durationInMillis:t.elapsed()}}async computeSkillDiscoveryInfo(e){let t=[],o=new Set,n=new Map,r=[],s=await this.fileLocator.findAgentSkills(e),l=await this.getExtensionPromptFiles("skill",e),c=this._pluginPromptFilesByType.get("skill")??[];r.push(...s,...l,...c);let u=p=>p.storage==="local"?0:p.storage==="user"?1:p.storage==="plugin"?2:p.source==="extension-api"?3:p.source==="extension-contribution"?4:5;r.sort((p,h)=>u(p)-u(h));for(let p of r){let h=p.uri,g=p;try{let f=await this.parseNew(h,e),v=PZ(h),b=f.header?.name,S=f.header?.description;b||(this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill file missing name attribute, using folder name "${v}": ${h}`),b=v);let y=this.truncateAgentSkillName(b,h);if(y!==v&&(this.logger.debug(`[computeSkillDiscoveryInfo] Agent skill name "${y}" does not match folder name "${v}", using folder name: ${h}`),y=v),o.has(y)){this.logger.debug(`[computeSkillDiscoveryInfo] Skipping duplicate agent skill name: ${y} at ${h}`),t.push({status:"skipped",skipReason:"duplicate-name",duplicateOf:n.get(y),promptPath:this.withPromptPathMetadata(g,y,S)});continue}o.add(y),n.set(y,h);let w=f.header?.disableModelInvocation===!0,x=f.header?.userInvocable!==!1;t.push({status:"loaded",promptPath:this.withPromptPathMetadata(g,y,S),disableModelInvocation:w,userInvocable:x})}catch(f){let v=f instanceof Error?f.message:String(f);this.logger.error(`[computeSkillDiscoveryInfo] Failed to validate Agent skill file: ${h}`,v),t.push({status:"skipped",skipReason:"parse-error",errorMessage:v,promptPath:g})}}return t}async getInstructionsDiscoveryInfo(e){let t=On.create(!0),o=[],n=await this.listPromptFiles("instructions",e);for(let s of n){let l=s.uri;try{let c=await this.parseNew(l,e),u=c?.header?.name??s.name??Xb(l),p=c?.header?.description??s.description,h=qao(c.header,H2(l));o.push({status:"loaded",pattern:h,promptPath:this.withPromptPathMetadata(s,u,p)})}catch(c){o.push({status:"skipped",skipReason:"parse-error",errorMessage:c instanceof Error?c.message:String(c),promptPath:s})}}let r=await this._collectSourceFolderDiagnostics("instructions");return{type:"instructions",files:o,sourceFolders:r,durationInMillis:t.elapsed()}}};bDe=I([m(0,re),m(1,nt),m(2,_t),m(3,F),m(4,gn),m(5,B),m(6,ge),m(7,de),m(8,_e),m(9,Ae),m(10,Pn),m(11,mm),m(12,Or)],bDe);var Bpe=class extends k{constructor(e,t,o=0){super();this.computeFn=e;this.getEvent=t;this.delay=o;this.cachedPromise=void 0;this.onDidUpdatePromiseEmitter=this._register(new T);let n=this._register(new rn(this.delay));this._register(this.getEvent()(()=>{this.cachedPromise=void 0,n.trigger(()=>this.onDidUpdatePromiseEmitter.fire())}))}get onDidChangePromise(){return this.onDidUpdatePromiseEmitter.event}get(e){if(this.cachedPromise!==void 0)return this.cachedPromise;let t=this.computeFn(e).catch(o=>{throw this.cachedPromise===t&&(this.cachedPromise=void 0),o});return this.cachedPromise=t,t}refresh(){this.cachedPromise=void 0,this.onDidUpdatePromiseEmitter?.fire()}},VSi=class extends k{constructor(e){super();this.listeners=new dt;this.onDidPromptModelChange=this._register(new T);let t=n=>{let r=bC(n.getLanguageId());return r!==void 0&&this.listeners.set(n.uri,n.onDidChangeContent(()=>this.onDidPromptModelChange.fire({uri:n.uri,promptType:r}))),r},o=(n,r)=>{let s=bC(n);return s!==void 0&&(this.listeners.get(r)?.dispose(),this.listeners.delete(r)),s};this._register(e.onModelAdded(n=>t(n))),this._register(e.onModelLanguageChanged(n=>{let r=o(n.oldLanguageId,n.model.uri),s=t(n.model);r!==s&&(r&&this.onDidPromptModelChange.fire({uri:n.model.uri,promptType:r}),s&&this.onDidPromptModelChange.fire({uri:n.model.uri,promptType:s}))})),this._register(e.onModelRemoved(n=>o(n.getLanguageId(),n.uri)))}get onDidPromptChange(){return this.onDidPromptModelChange.event}dispose(){super.dispose(),this.listeners.forEach(e=>e.dispose()),this.listeners.clear()}},eAt;(i=>{function a(e,t){let o=e.uri,{hooks:n,sessionTypes:r,enabled:s}=t,l;if(e.header){let E=e.header.getAttribute(no.advancedOptions);if(E&&E.value.type==="map"){l={};for(let[M,N]of Object.entries(E.value))N.type==="scalar"&&(l[M]=N)}}let c=[];if(e.body){let E=e.body.offset,M=e.body.variableReferences;for(let N=M.length-1;N>=0;N--){let{name:V,offset:H,fullLength:K}=M[N],j=new gi(H-E,H-E+K);c.push({name:V,range:j})}}let u={content:e.body?.getContent()??"",toolReferences:c,metadata:l},p=e.header?.name??t.name??Xb(o),h=e.header?.description??t.description,g=Ax("agent",e.header??o),f=t.source;if(!e.header)return{uri:o,name:p,agentInstructions:u,source:f,target:g,visibility:{userInvocable:!0,agentInvocable:!0},sessionTypes:r,hooks:n,enabled:s};let v={userInvocable:e.header.userInvocable!==!1,agentInvocable:e.header.infer!==void 0?e.header.infer===!0:e.header.disableModelInvocation!==!0},b=e.header.model;g==="claude"&&b&&(b=alo(b));let{tools:S,handOffs:y,argumentHint:w,agents:x}=e.header;return g==="claude"&&S&&(S=llo(S)),{uri:o,name:p,description:h,model:b,tools:S,handOffs:y,argumentHint:w,target:g,visibility:v,agents:x,agentInstructions:u,source:f,sessionTypes:r,hooks:n,enabled:s}}i.fromParsedPromptFile=a})(eAt||={});var plo;(i=>{function a(e){return e.storage==="extension"?{storage:"extension",extensionId:e.extension.identifier}:e.storage==="plugin"?{storage:"plugin",pluginUri:e.pluginUri}:{storage:e.storage}}i.fromPromptPath=a})(plo||={});var dh=le("customizationHarnessService");function iAt(a){return a.type==="plugin"||a.type===pn.Plugins}var mlo={sources:[]},T7o={id:"",label:"",icon:L.sparkle,getStorageSourceFilter:()=>({sources:[]})},RAa={sources:["local","user","plugin"]};function _7o(a){return["local","user","plugin",...a]}function hlo(a){let i={sources:_7o(a)};return{id:_d.Local,label:d(9346,null),icon:q.fromId(L.vm.id),supportsTroubleshoot:!0,sectionOverrides:new Map([[pn.Instructions,{rootFileShortcuts:[dDe]}]]),getStorageSourceFilter:()=>i}}function SDe(a,i){return i.some(e=>a.includes(`/${e}/`)||a.endsWith(`/${e}`))}function BSi(a,i){let e=a.substring(a.lastIndexOf("/")+1);return i.some(t=>t.endsWith("/")?a.includes(`/${t}`)||a.startsWith(t):e===t)}var tAt=class{constructor(i,e,t){this.promptsService=t;this._onDidChangeSlashCommands=new T;this.onDidChangeSlashCommands=this._onDidChangeSlashCommands.event;this._onDidChangeCustomAgents=new T;this.onDidChangeCustomAgents=this._onDidChangeCustomAgents.event;this._providerListeners=[];this._isDisposed=!1;this._externalHarnesses=[];this._staticHarnesses=i,this.promptsService=t,this._activeHarness=De(this,e),this.activeHarness=this._activeHarness,this._availableHarnesses=De(this,[...this._staticHarnesses]),this.availableHarnesses=this._availableHarnesses,this._rebindProviderListeners()}_getAllHarnesses(){let i=new Set(this._externalHarnesses.map(e=>e.id));return[...this._staticHarnesses.filter(e=>!i.has(e.id)),...this._externalHarnesses]}_refreshAvailableHarnesses(){this._isDisposed||(this._availableHarnesses.set(this._getAllHarnesses(),void 0),this._rebindProviderListeners())}_rebindProviderListeners(){for(let i of this._providerListeners)i.dispose();this._providerListeners.length=0;for(let i of this._getAllHarnesses()){let e=i.itemProvider;e?(this._providerListeners.push(e.onDidChange(()=>this._onDidChangeSlashCommands.fire({sessionType:i.id}))),this._providerListeners.push(e.onDidChange(()=>this._onDidChangeCustomAgents.fire({sessionType:i.id})))):(this._providerListeners.push(this.promptsService.onDidChangeSlashCommands(()=>this._onDidChangeSlashCommands.fire({sessionType:i.id}))),this._providerListeners.push(this.promptsService.onDidChangeCustomAgents(()=>this._onDidChangeCustomAgents.fire({sessionType:i.id}))))}}dispose(){this._isDisposed=!0;for(let i of this._providerListeners)i.dispose();this._providerListeners.length=0,this._onDidChangeSlashCommands.dispose(),this._onDidChangeCustomAgents.dispose()}registerExternalHarness(i){return this._externalHarnesses.push(i),this._refreshAvailableHarnesses(),{dispose:()=>{if(this._isDisposed)return;let e=this._externalHarnesses.indexOf(i);if(e>=0&&(this._externalHarnesses.splice(e,1),this._refreshAvailableHarnesses(),this._activeHarness.get()===i.id)){let t=this._getAllHarnesses();!t.some(o=>o.id===i.id)&&t.length>0&&this._activeHarness.set(t[0].id,void 0)}}}}findHarnessById(i){return this._getAllHarnesses().find(e=>e.id===i)}setActiveHarness(i){this.findHarnessById(i)&&this._activeHarness.set(i,void 0)}getStorageSourceFilter(i){let e=this._activeHarness.get(),t=this._getAllHarnesses();return t.length===0?mlo:(t.find(n=>n.id===e)??t[0])?.getStorageSourceFilter(i)??mlo}getActiveDescriptor(){let i=this._activeHarness.get(),e=this._getAllHarnesses();return e.length===0?T7o:e.find(t=>t.id===i)??e[0]}async getSlashCommands(i,e){let t=this.findHarnessById(i);if(!t||!t.itemProvider)return(await this.promptsService.getPromptSlashCommands(e)).filter(s=>lb(s.sessionTypes,i));let o=await t.itemProvider.provideChatSessionCustomizations(e);if(!o)return[];let n=[];for(let r of o)if(r.enabled!==!1&&(r.type==="prompt"||r.type==="skill")){let s=r.storage,l=s!==void 0&&s!==sc?s:"local";n.push({uri:r.uri,type:r.type,name:r.pluginUri?fDe({uri:r.pluginUri},r.name):r.name,description:r.description,userInvocable:r.userInvocable??!0,storage:l,sessionTypes:[i]})}return n}async getCustomAgents(i,e){let t=this.findHarnessById(i);if(!t||!t.itemProvider)return(await this.promptsService.getCustomAgents(e)).filter(l=>lb(l.sessionTypes,i));let o=await t.itemProvider.provideChatSessionCustomizations(e);if(!o)return[];let n=s=>s.storage==="extension"&&s.extensionId?{storage:"extension",extensionId:new hi(s.extensionId)}:s.storage==="plugin"&&s.pluginUri?{storage:"plugin",pluginUri:s.pluginUri}:s.storage==="user"?{storage:"user"}:{storage:"local"},r=[];for(let s of o)if(s.type==="agent"){let l=await this.promptsService.parseNew(s.uri,e),c={name:s.name,description:s.description,sessionTypes:[i],hooks:void 0,source:n(s),type:"agent",enabled:s.enabled!==!1};r.push(eAt.fromParsedPromptFile(l,c))}return r}async resolvePromptSlashCommand(i,e,t){let n=(await this.getSlashCommands(e,t)).find(r=>r.name===i);if(n){let r=await this.promptsService.parseNew(n.uri,t);return{...n,userInvocable:r.header?.userInvocable??n.userInvocable,parsedPromptFile:r}}}};var HSi=class{constructor(i){this.content=i;this.kind="progressTask";this.deferred=new Mo;this._onDidAddProgress=new T;this.progress=[]}get onDidAddProgress(){return this._onDidAddProgress.event}task(){return this.deferred.p}isSettled(){return this.deferred.isSettled}complete(i){this.deferred.complete(i)}add(i){this.progress.push(i),this._onDidAddProgress.fire(i)}toJSON(){return{kind:"progressTaskSerialized",content:this.content,progress:this.progress}}},oAt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this._chatAgentService=t;this._chatSessionService=o;this._chatService=n;this._languageFeaturesService=r;this._chatWidgetService=s;this._instantiationService=l;this._logService=c;this._extensionService=u;this._uriIdentityService=p;this._promptsService=h;this._languageModelToolsService=g;this._customizationHarnessService=f;this._telemetryService=v;this._agentPluginService=b;this._environmentService=S;this._agents=this._register(new Ot);this._agentCompletionProviders=this._register(new Ot);this._agentIdsToCompletionProviders=this._register(new Ot);this._chatParticipantDetectionProviders=this._register(new Ot);this._promptFileProviders=this._register(new Ot);this._promptFileProviderEmitters=this._register(new Ot);this._promptFileContentRegistrations=this._register(new Ot);this._customizationProviders=this._register(new Ot);this._customizationProviderEmitters=this._register(new Ot);this._pendingProgress=new Map;this._activeTasks=new Map;this._unresolvedAnchors=new Map;this._proxy=e.getProxy(ao.ExtHostChatAgents2),this._register(this._chatService.onDidDisposeSession(y=>{for(let w of y.sessionResources)this._proxy.$releaseSession(w)})),this._register(this._chatService.onDidPerformUserAction(y=>{if(typeof y.agentId=="string"){for(let[w,x]of this._agents)if(x.id===y.agentId){y.action.kind==="vote"?this._proxy.$acceptFeedback(w,y.result??{},y.action):this._proxy.$acceptAction(w,y.result||{},y);break}}})),this._register(this._chatService.onDidReceiveQuestionCarouselAnswer(y=>{this._proxy.$handleQuestionCarouselAnswer(y.requestId,y.resolveId,y.answers)})),this._register(this._chatWidgetService.onDidChangeFocusedSession(()=>{this._acceptActiveChatSession(this._chatWidgetService.lastFocusedWidget)})),this._acceptActiveChatSession(this._chatWidgetService.lastFocusedWidget),this._register(this._promptsService.onDidChangeCustomAgents(()=>{this._proxy.$onDidChangeCustomAgents()})),this._register(this._promptsService.onDidChangeInstructions(()=>{this._proxy.$onDidChangeInstructions()})),this._register(this._promptsService.onDidChangeSkills(()=>{this._proxy.$onDidChangeSkills()})),this._register(this._promptsService.onDidChangeSlashCommands(()=>{this._proxy.$onDidChangeSlashCommands()})),this._register(this._promptsService.onDidChangeHooks(()=>{this._proxy.$onDidChangeHooks()})),this._register(ve(y=>{this._agentPluginService.plugins.read(y),this._proxy.$onDidChangePlugins()}))}_acceptActiveChatSession(e){let t=e?.viewModel?.sessionResource,o=t&&Kg(t)===zo.Local;this._proxy.$acceptActiveChatSession(o?t:void 0)}_toChatResourceSource(e){switch(e){case"local":return"local";case"user":return"user";case"extension":return"extension";case"plugin":return"plugin"}}_toCustomAgentDto(e){return{uri:e.uri,name:e.name,description:e.description,source:this._toChatResourceSource(e.source.storage),extensionId:e.source.storage==="extension"?e.source.extensionId.value:void 0,pluginUri:e.source.storage==="plugin"?e.source.pluginUri:void 0,sessionTypes:e.sessionTypes,argumentHint:e.argumentHint,tools:e.tools,model:e.model,userInvocable:e.visibility.userInvocable,disableModelInvocation:!e.visibility.agentInvocable,enabled:e.enabled}}_toInstructionDto(e){return{uri:e.uri,name:e.name,description:e.description,source:this._toChatResourceSource(e.storage),extensionId:e.extension?.identifier.value,pluginUri:e.pluginUri,sessionTypes:e.sessionTypes,pattern:e.pattern}}_toSkillDto(e){return{uri:e.uri,name:e.name,description:e.description,source:this._toChatResourceSource(e.storage),extensionId:e.extension?.identifier.value,pluginUri:e.pluginUri,sessionTypes:e.sessionTypes,userInvocable:e.userInvocable,disableModelInvocation:e.disableModelInvocation}}_toSlashCommandDto(e){return{uri:e.uri,name:e.name,description:e.description,source:this._toChatResourceSource(e.storage),extensionId:e.extension?.identifier.value,pluginUri:e.pluginUri,sessionTypes:e.sessionTypes,argumentHint:e.argumentHint,userInvocable:e.userInvocable}}_toHookDto(e){return{uri:e.uri,sessionTypes:e.sessionTypes,source:this._toChatResourceSource(e.storage),extensionId:e.extension?.identifier.value,pluginUri:e.pluginUri}}_toPluginDto(e){return{uri:e.uri}}async $provideCustomAgents(e){return(await this._promptsService.getCustomAgents(e)).map(o=>this._toCustomAgentDto(o))}async $provideInstructions(e){return(await this._promptsService.getInstructionFiles(e)).map(o=>this._toInstructionDto(o))}async $provideSkills(e){return(await this._promptsService.findAgentSkills(e)??[]).map(o=>this._toSkillDto(o))}async $provideSlashCommands(e){return(await this._promptsService.getPromptSlashCommands(e)).map(o=>this._toSlashCommandDto(o))}async $provideHooks(e){return(await this._promptsService.listPromptFiles("hook",e)).map(o=>this._toHookDto(o))}async $providePlugins(e){return this._agentPluginService.plugins.get().map(o=>this._toPluginDto(o))}$unregisterAgent(e){this._agents.deleteAndDispose(e)}async $transferActiveChatSession(e){let o=this._chatWidgetService.lastFocusedWidget?.viewModel?.model;if(!o){this._logService.error("MainThreadChat#$transferActiveChatSession: No active chat session found");return}await this._chatService.transferChatSession(o.sessionResource,A.revive(e))}async $registerAgent(e,t,o,n,r){await this._extensionService.whenInstalledExtensionsRegistered();let s=this._chatAgentService.getAgent(o,!0),l=this._chatSessionService.getAllChatSessionContributions().find(p=>p.type===o||p.alternativeIds?.includes(o));if(!s&&!l&&!r)throw this._chatAgentService.getAgentsByName(o).length?new Error(`chatParticipant must be declared with an ID in package.json. The "id" property may be missing! "${o}"`):new Error(`chatParticipant must be declared in package.json: ${o}`);let c={invoke:async(p,h,g,f)=>{let v=this._chatService.getSession(p.sessionResource);this._pendingProgress.set(p.requestId,{progress:h,chatSession:v});try{let b=p.sessionResource,S={chatSessionResource:b,isUntitled:ZD(b),initialSessionOptions:k3.toStrValueArray(this._chatSessionService.getSessionOptions(b))},y=await this._proxy.$invokeAgent(e,p,{history:g,chatSessionContext:S},f);if(y?.errorCallstack&&!y.errorDetails?.isRateLimited&&!y.errorDetails?.isQuotaExceeded&&!y.errorDetails?.isExpectedError&&this._telemetryService.publicLogError2("chatAgentError",{callstack:y.errorCallstack,msg:y.errorDetails?.message??"",errorName:y.errorName??"",agent:o,agentExtensionId:t.value}),y){let{errorCallstack:w,errorName:x,...E}=y;return E}return{}}finally{this._pendingProgress.delete(p.requestId)}},setRequestTools:(p,h)=>{this._proxy.$setRequestTools(p,h)},setYieldRequested:(p,h)=>{this._proxy.$setYieldRequested(p,h)},provideFollowups:async(p,h,g,f)=>this._agents.get(e)?.hasFollowups?this._proxy.$provideFollowups(p,e,h,{history:g},f):[],provideChatTitle:(p,h)=>this._proxy.$provideChatTitle(e,p,h),provideChatSummary:(p,h)=>this._proxy.$provideChatSummary(e,p,h)};if(l?.alternativeIds?.includes(o))return;let u;if(!s&&r){let p=this._extensionService.extensions.find(h=>hi.equals(h.identifier,t));u=this._chatAgentService.registerDynamicAgent({id:o,name:r.name,description:r.description,extensionId:t,extensionVersion:p?.version,extensionDisplayName:p?.displayName??t.value,extensionPublisherId:p?.publisher??"",publisherDisplayName:r.publisherName,fullName:r.fullName,metadata:er(n),slashCommands:[],disambiguation:[],locations:["panel"],modes:["ask","agent","edit"]},c)}else u=this._chatAgentService.registerAgentImplementation(o,c);this._agents.set(e,{id:o,extensionId:t,dispose:()=>u.dispose(),hasFollowups:n.hasFollowups})}async $updateAgent(e,t){await this._extensionService.whenInstalledExtensionsRegistered();let o=this._agents.get(e);if(!o){this._logService.error(`MainThreadChatAgents2#$updateAgent: No agent with handle ${e} registered`);return}o.hasFollowups=t.hasFollowups,this._chatAgentService.updateAgent(o.id,er(t))}async $handleProgressChunk(e,t){let o=this._pendingProgress.get(e);if(!o){this._logService.warn(`MainThreadChatAgents2#$handleProgressChunk: No pending progress for requestId ${e}`);return}let{progress:n,chatSession:r}=o,s=[],l=r?.getRequests().find(c=>c.id===e)?.response;for(let c of t){let[u,p]=Array.isArray(c)?c:[c];if(u.kind==="externalEdits"){if(r?.editingSession&&p!==void 0&&l){let g=u.start?await r.editingSession.startExternalEdits(l,p,er(u.resources),u.undoStopId):await r.editingSession.stopExternalEdits(l,p);s.push(...g)}continue}if(u.kind==="beginToolInvocation"){this._languageModelToolsService.beginToolCall({toolCallId:u.toolCallId,toolId:u.toolName,chatRequestId:e,sessionResource:r?.sessionResource,subagentInvocationId:u.subagentInvocationId});continue}if(u.kind==="updateToolInvocation"){this._languageModelToolsService.updateToolStream(u.toolCallId,u.streamData?.partialInput,Ie.None);continue}if(u.kind==="usage"){l&&l.setUsage({kind:"usage",promptTokens:u.promptTokens,completionTokens:u.completionTokens,outputBuffer:u.outputBuffer,promptTokenDetails:u.promptTokenDetails});continue}let h=u.kind==="notebookEdit"?glo.fromChatEdit(u):er(u);if((h.kind==="notebookEdit"||h.kind==="textEdit"||h.kind==="codeblockUri")&&(h.uri=this._uriIdentityService.asCanonicalUri(h.uri)),p!==void 0){if(h.kind==="progressTask"){let f=`${e}_${p}`,v=new HSi(h.content);this._activeTasks.set(f,v),s.push(v)}else if(p!==void 0){let g=`${e}_${p}`,f=this._activeTasks.get(g);switch(h.kind){case"progressTaskResult":f&&h.content?(f.complete(h.content.value),this._activeTasks.delete(g)):f?.complete(void 0);break;case"warning":case"reference":f?.add(h);break}}continue}h.kind==="inlineReference"&&h.resolveId&&l&&(this._unresolvedAnchors.has(e)||this._unresolvedAnchors.set(e,new Map),this._unresolvedAnchors.get(e)?.set(h.resolveId,{response:l})),s.push(h)}n(s)}$handleAnchorResolve(e,t,o){let n=this._unresolvedAnchors.get(e);if(!n)return;let r=n.get(t);if(r&&(n.delete(t),n.size===0&&this._unresolvedAnchors.delete(e),o)){let s=er(o);r.response.resolveInlineReference(t,s)}}$registerAgentCompletionsProvider(e,t,o){let n=async(r,s)=>(await this._proxy.$invokeCompletionProvider(e,r,s)).map(c=>({...c,icon:c.icon?q.fromId(c.icon):void 0}));this._agentIdsToCompletionProviders.set(t,this._chatAgentService.registerAgentCompletionProvider(t,n)),this._agentCompletionProviders.set(e,this._languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentCompletions:"+e,triggerCharacters:o,provideCompletionItems:async(r,s,l,c)=>{let u=this._chatWidgetService.getWidgetByInputUri(r.uri);if(!u||!u.viewModel)return;let p=o.map(E=>Ss(E)).join(""),h=new RegExp(`[${p}]\\S*`,"g"),g=Rk(s.column,h,r.getLineContent(s.lineNumber),0)?.word??"";if(g&&!o.some(E=>g.startsWith(E)))return;let f={sessionType:yn(u.viewModel.model.sessionResource)},b=this._instantiationService.createInstance(nR).parseChatRequestWithReferences(O2(u),RZ(u),r.getValue(),"panel",f).parts.find(E=>E instanceof Qp),S=this._agents.get(e)?.id;if(b?.agent.id!==S)return;let y=D7o(r,s,h);return y?{suggestions:(await n(g,c)).map(E=>{let M=E.insertText??(typeof E.label=="string"?E.label:E.label.label),N=new G(y.insert.startLineNumber,y.insert.startColumn,y.insert.endLineNumber,y.insert.startColumn+M.length);return{label:E.label,range:y,insertText:M+" ",kind:18,detail:E.detail,documentation:E.documentation,command:{id:PYe.ID,title:"",arguments:[{id:E.id,widget:u,range:N,variableData:er(E.value),command:E.command}]}}})}:null}}))}$unregisterAgentCompletionsProvider(e,t){this._agentCompletionProviders.deleteAndDispose(e),this._agentIdsToCompletionProviders.deleteAndDispose(t)}$registerChatParticipantDetectionProvider(e){this._chatParticipantDetectionProviders.set(e,this._chatAgentService.registerChatParticipantDetectionProvider(e,{provideParticipantDetection:async(t,o,n,r)=>await this._proxy.$detectChatParticipant(e,t,{history:o},n,r)}))}$unregisterChatParticipantDetectionProvider(e){this._chatParticipantDetectionProviders.deleteAndDispose(e)}async $registerPromptFileProvider(e,t,o){let n=await this._extensionService.getExtension(o.value);if(!n){this._logService.error(`[MainThreadChatAgents2] Could not find extension for prompt file provider: ${o.value}`);return}if(!Iao(t)){this._logService.error(`[MainThreadChatAgents2] Invalid contribution type: ${t}`);return}let r=new T;this._promptFileProviderEmitters.set(e,r);let s=new Ot;this._promptFileContentRegistrations.set(e,s);let l=this._promptsService.registerPromptFileProvider(n,t,{onDidChangePromptFiles:r.event,providePromptFiles:async(c,u)=>{let p=await this._proxy.$providePromptFiles(e,t,c,u);if(p)return p.map(h=>({uri:A.revive(h.uri)}))}});this._promptFileProviders.set(e,l)}$unregisterPromptFileProvider(e){this._promptFileProviders.deleteAndDispose(e),this._promptFileProviderEmitters.deleteAndDispose(e),this._promptFileContentRegistrations.deleteAndDispose(e)}$onDidChangePromptFiles(e){let t=this._promptFileProviderEmitters.get(e);t&&t.fire()}async $registerChatSessionCustomizationProvider(e,t,o,n){if(this._environmentService.isSessionsWindow&&!this._chatSessionService.getContentProviderSchemes().includes(t))return;if(!await this._extensionService.getExtension(n.value)){this._logService.error(`[MainThreadChatAgents2] Could not find extension for customization provider: ${n.value}`);return}let s=new T;this._customizationProviderEmitters.set(e,s);let l={onDidChange:s.event,provideChatSessionCustomizations:async g=>{let f=await this._proxy.$provideChatSessionCustomizations(e,g);if(f)return f.map(v=>({uri:A.revive(v.uri),type:v.type,name:v.name,description:v.description,groupKey:v.groupKey,badge:v.badge,badgeTooltip:v.badgeTooltip,extensionId:v.extensionId,pluginUri:v.pluginUri?A.revive(v.pluginUri):void 0,userInvocable:v.userInvocable}))}},c={agent:pn.Agents,skill:pn.Skills,instructions:pn.Instructions,prompt:pn.Prompts,hook:pn.Hooks,plugins:pn.Plugins},u;if(o.supportedTypes){let g=new Set;for(let f of o.supportedTypes){let v=c[f];v&&g.add(v)}u=Object.values(c).filter(f=>!g.has(f))}let p={id:t,label:o.label,icon:o.iconId?q.fromId(o.iconId):q.fromId(L.extensions.id),hiddenSections:u,getStorageSourceFilter:()=>({sources:["local","user","plugin","extension",sc]}),itemProvider:l},h=this._customizationHarnessService.registerExternalHarness(p);this._customizationProviders.set(e,h)}$unregisterChatSessionCustomizationProvider(e){this._customizationProviders.deleteAndDispose(e),this._customizationProviderEmitters.deleteAndDispose(e)}$onDidChangeCustomizations(e){let t=this._customizationProviderEmitters.get(e);t&&t.fire()}};oAt=I([fo(Xi.MainThreadChatAgents2),m(1,gr),m(2,Ms),m(3,si),m(4,Jt),m(5,Lt),m(6,F),m(7,re),m(8,lt),m(9,gt),m(10,jr),m(11,Wn),m(12,dh),m(13,_e),m(14,mm),m(15,Mt)],oAt);function D7o(a,i,e){let t=Rk(i.column,e,a.getLineContent(i.lineNumber),0);if(!t&&a.getWordUntilPosition(i).word)return;let o,n;return t?(o=new G(i.lineNumber,t.startColumn,i.lineNumber,i.column),n=new G(i.lineNumber,t.startColumn,i.lineNumber,t.endColumn)):o=n=G.fromPositions(i),{insert:o,replace:n}}var glo;(i=>{function a(e){return{kind:"notebookEdit",uri:A.revive(e.uri),done:e.done,edits:e.edits.map($I.fromCellEditOperationDto)}}i.fromChatEdit=a})(glo||={});var BZ=le("codeMapperService"),nAt=class{constructor(){this.providers=[]}registerCodeMapperProvider(i,e){return this.providers.push(e),{dispose:()=>{let t=this.providers.indexOf(e);t>=0&&this.providers.splice(t,1)}}}async mapCode(i,e,t){for(let o of this.providers){let n=await o.mapCode(i,e,t);return t.isCancellationRequested?void 0:n}}};var Hpe=class extends k{constructor(e,t){super();this.codeMapperService=t;this.providers=this._register(new Ot);this._responseMap=new Map;this._proxy=e.getProxy(ao.ExtHostCodeMapper)}$registerCodeMapperProvider(e,t){let o={displayName:t,mapCode:async(r,s,l)=>{let c=String(Hpe._requestHandlePool++);this._responseMap.set(c,s);let u={requestId:c,codeBlocks:r.codeBlocks,chatRequestId:r.chatRequestId,chatRequestModel:r.chatRequestModel,chatSessionResource:r.chatSessionResource,location:r.location};try{return await this._proxy.$mapCode(e,u,l).then(p=>p??void 0)}finally{this._responseMap.delete(c)}}},n=this.codeMapperService.registerCodeMapperProvider(e,o);this.providers.set(e,n)}$unregisterCodeMapperProvider(e){this.providers.deleteAndDispose(e)}$handleProgress(e,t){let o=this._responseMap.get(e);if(o){let n=t.edits,r=A.revive(t.uri);n.length?n.every(hT.isTextEdit)?o.textEdit(r,n):o.notebookEdit(r,n.map($I.fromCellEditOperationDto)):o.textEdit(r,[])}return Promise.resolve()}};Hpe._requestHandlePool=0,Hpe=I([fo(Xi.MainThreadCodeMapper),m(1,BZ)],Hpe);var USi="vscode://schemas/toolsParameters",R7o={definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},defaultSnippets:[{body:{type:"object",properties:{"${1:paramName}":{type:"string",description:"${2:description}"}}}}]},L7o=oe.as(Ta.JSONContribution);L7o.registerSchema(USi,R7o);var vlo=zn.registerExtensionPoint({extensionPoint:"languageModelTools",activationEventsGenerator:function*(a){for(let i of a)yield`onLanguageModelTool:${i.name}`},jsonSchema:{description:d(9850,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"${1}",modelDescription:"${2}",inputSchema:{type:"object",properties:{"${3:name}":{type:"string",description:"${4:description}"}}}}}],required:["name","displayName","modelDescription"],properties:{name:{description:d(9838,null),type:"string",pattern:"^(?!copilot_|vscode_)[\\w-]+$"},toolReferenceName:{markdownDescription:d(9839,null,"`canBeReferencedInPrompt`"),type:"string",pattern:"^[\\w-]+$"},displayName:{description:d(9836,null),type:"string"},userDescription:{description:d(9849,null),type:"string"},modelDescription:{description:d(9837,null),type:"string"},inputSchema:{description:d(9834,null),$ref:USi},canBeReferencedInPrompt:{markdownDescription:d(9825,null,"`ChatRequest#toolReferences`"),type:"boolean"},icon:{markdownDescription:d(9828,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(9830,null),type:"string"},dark:{description:d(9829,null),type:"string"}}}]},when:{markdownDescription:d(9826,null),type:"string"},tags:{description:d(9848,null),type:"array",items:{type:"string",pattern:"^(?!copilot_|vscode_)"}}}}}}),M7o=zn.registerExtensionPoint({extensionPoint:"languageModelToolSets",deps:[vlo],jsonSchema:{description:d(9851,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"${1}",description:"${2}",tools:["${3}"]}}],required:["name","description","tools"],properties:{name:{description:d(9843,null),type:"string",pattern:"^[\\w-]+$"},description:{description:d(9841,null),type:"string"},icon:{markdownDescription:d(9842,null,"`$(zap)`"),type:"string"},tools:{markdownDescription:d(9844,null),type:"array",minItems:1,items:{type:"string"}}}}}});function flo(a,i){return`${a.value}/${i}`}function uXe(a,i){return`toolset:${a.value}/${i}`}var Upe=class{constructor(i,e){this._registrationDisposables=new Ot;vlo.setHandler((t,o)=>{for(let n of o.added)for(let r of n.value){if(!r.name||!r.modelDescription||!r.displayName){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool without name, modelDescription, and displayName: ${JSON.stringify(r)}`);continue}if(!r.name.match(/^[\w-]+$/)){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with invalid id: ${r.name}. The id must match /^[\\w-]+$/.`);continue}if(r.canBeReferencedInPrompt&&!r.toolReferenceName){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with 'canBeReferencedInPrompt' set without a 'toolReferenceName': ${JSON.stringify(r)}`);continue}if((r.name.startsWith("copilot_")||r.name.startsWith("vscode_"))&&!Va(n.description,"chatParticipantPrivate")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with name starting with "vscode_" or "copilot_"`);continue}if(r.tags?.some(h=>h.startsWith("copilot_")||h.startsWith("vscode_"))&&!Va(n.description,"chatParticipantPrivate")&&n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register tool with tags starting with "vscode_" or "copilot_"`),r.legacyToolReferenceFullNames&&!Va(n.description,"chatParticipantPrivate")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT use 'legacyToolReferenceFullNames' without the 'chatParticipantPrivate' API proposal enabled`);continue}let s=r.icon,l;typeof s=="string"?l=q.fromString(s)??{dark:Ve(n.description.extensionLocation,s),light:Ve(n.description.extensionLocation,s)}:s&&(l={dark:Ve(n.description.extensionLocation,s.dark),light:Ve(n.description.extensionLocation,s.light)});let c=i.defaultChatAgent?.chatExtensionId?hi.equals(n.description.identifier,i.defaultChatAgent.chatExtensionId):Va(n.description,"chatParticipantPrivate"),u=c?wn.Internal:{type:"extension",label:n.description.displayName??n.description.name,extensionId:n.description.identifier},p={...r,source:u,inputSchema:r.inputSchema,id:r.name,icon:l,when:r.when?C.deserialize(r.when):void 0,alwaysDisplayInputOutput:!c};try{let h=e.registerToolData(p);this._registrationDisposables.set(flo(n.description.identifier,r.name),h)}catch(h){n.collector.error(`Failed to register tool '${r.name}': ${h}`)}}for(let n of o.removed)for(let r of n.value)this._registrationDisposables.deleteAndDispose(flo(n.description.identifier,r.name))}),M7o.setHandler((t,o)=>{for(let n of o.added){if(!Va(n.description,"contribLanguageModelToolSets")){n.collector.error(`Extension '${n.description.identifier.value}' CANNOT register language model tools because the 'contribLanguageModelToolSets' API proposal is not enabled.`);continue}let r=i.defaultChatAgent?.chatExtensionId?hi.equals(n.description.identifier,i.defaultChatAgent.chatExtensionId):Va(n.description,"chatParticipantPrivate"),s=r?wn.Internal:{type:"extension",label:n.description.displayName??n.description.name,extensionId:n.description.identifier};for(let l of n.value){if(_c(l.name)){n.collector.error(`Tool set '${l.name}' CANNOT have an empty name`);continue}if(l.legacyFullNames&&!Va(n.description,"contribLanguageModelToolSets")){n.collector.error(`Tool set '${l.name}' CANNOT use 'legacyFullNames' without the 'contribLanguageModelToolSets' API proposal enabled`);continue}if(YO(l.tools)){n.collector.error(`Tool set '${l.name}' CANNOT have an empty tools array`);continue}let c=[],u=[],p=[];for(let S of l.tools){let y=e.getToolByName(S);if(y){c.push(y);continue}let w=e.getToolSetByName(S);if(w){u.push(w);continue}p.push(S)}if(u.length===0&&c.length===0){n.collector.error(`Tool set '${l.name}' CANNOT have an empty tools array (none of the tools were found)`);continue}let h=new O,g=l.referenceName??l.name,f=e.getToolSetByName(g),v=r&&f?.source===wn.Internal,b;if(v?b=f:b=e.createToolSet(s,uXe(n.description.identifier,l.name),g,{icon:l.icon?q.fromString(l.icon):void 0,description:l.description,legacyFullNames:l.legacyFullNames}),Ki(S=>{v||h.add(b),c.forEach(y=>h.add(b.addTool(y,S))),u.forEach(y=>h.add(b.addToolSet(y,S)))}),p.length>0){let S=new Set(p),y=h.add(e.onDidChangeTools(()=>{for(let w of S){let x=e.getToolByName(w);if(x)h.add(b.addTool(x)),S.delete(w);else{let E=e.getToolSetByName(w);E&&(h.add(b.addToolSet(E)),S.delete(w))}}S.size===0&&h.delete(y)}))}this._registrationDisposables.set(uXe(n.description.identifier,l.name),h)}}for(let n of o.removed)for(let r of n.value)this._registrationDisposables.deleteAndDispose(uXe(n.description.identifier,r.name))})}static{this.ID="workbench.contrib.toolsExtensionPointHandler"}};Upe=I([m(0,Ze),m(1,Wn)],Upe);var zSi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languageModelTools}render(e){let t=e.contributes?.languageModelTools??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(9847,null),d(9846,null),d(9845,null)],n=t.map(r=>[new he(`\`${r.name}\``),r.displayName,r.userDescription??r.modelDescription]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languageModelTools",label:d(9831,null),access:{canToggle:!1},renderer:new Vt(zSi)});var KSi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languageModelToolSets}render(e){let t=e.contributes?.languageModelToolSets??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(9833,null),d(9835,null),d(9840,null),d(9827,null)],n=t.map(r=>[new he(`\`${r.name}\``),r.referenceName?new he(`\`#${r.referenceName}\``):"none",r.tools.join(", "),r.description]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languageModelToolSets",label:d(9832,null),access:{canToggle:!1},renderer:new Vt(KSi)});var rAt=class extends k{constructor(e,t,o,n){super();this._languageModelToolsService=t;this._logService=o;this._productService=n;this._tools=this._register(new Ot);this._runningToolCalls=new Map;this._proxy=e.getProxy(ao.ExtHostLanguageModelTools),this._register(this._languageModelToolsService.onDidChangeTools(r=>this._proxy.$onDidChangeTools(this.getToolDtos())))}getToolDtos(){return Array.from(this._languageModelToolsService.getAllToolsIncludingDisabled()).map(e=>({id:e.id,displayName:e.displayName,toolReferenceName:e.toolReferenceName,legacyToolReferenceFullNames:e.legacyToolReferenceFullNames,fullReferenceName:e.source.type==="mcp"?this._languageModelToolsService.getFullReferenceName(e):void 0,tags:e.tags,userDescription:e.userDescription,modelDescription:e.modelDescription,inputSchema:e.inputSchema,source:e.source}))}async $getTools(){return this.getToolDtos()}async $invokeTool(e,t){let o=await this._languageModelToolsService.invokeTool(er(e),(r,s)=>this._proxy.$countTokensForInvocation(e.callId,r,s),t??Ie.None),n={content:o.content,toolMetadata:o.toolMetadata,toolResultError:o.toolResultError};return _ao(o)?new Hg(n):n}$acceptToolProgress(e,t){this._runningToolCalls.get(e)?.progress.report(t)}$countTokensForInvocation(e,t,o){let n=this._runningToolCalls.get(e);if(!n)throw new Error(`Tool invocation call ${e} not found`);return n.countTokens(t,o)}$registerTool(e,t){let o=this._languageModelToolsService.registerToolImplementation(e,{invoke:async(n,r,s,l)=>{try{this._runningToolCalls.set(n.callId,{countTokens:r,progress:s});let c=await this._proxy.$invokeTool(n,l),u=c instanceof Hg?c.value:c;return er(u)}finally{this._runningToolCalls.delete(n.callId)}},prepareToolInvocation:(n,r)=>this._proxy.$prepareToolInvocation(e,n,r),handleToolStream:t?(n,r)=>this._proxy.$handleToolStream(e,n,r):void 0});this._tools.set(e,o)}$registerToolWithDefinition(e,t,o){let n;if(t.icon)if(q.isThemeIcon(t.icon))n=t.icon;else if(typeof t.icon=="object"&&t.icon!==null&&jm(t.icon))n={dark:A.revive(t.icon)};else{let p=t.icon;n={dark:A.revive(p.dark),light:p.light?A.revive(p.light):void 0}}let s=(this._productService.defaultChatAgent?.chatExtensionId?hi.equals(e,this._productService.defaultChatAgent.chatExtensionId):!1)?wn.Internal:er(t.source),l={id:t.id,displayName:t.displayName,toolReferenceName:t.toolReferenceName,legacyToolReferenceFullNames:t.legacyToolReferenceFullNames,tags:t.tags,userDescription:t.userDescription,modelDescription:t.modelDescription,inputSchema:t.inputSchema,source:s,icon:n,models:t.models,canBeReferencedInPrompt:!!t.userDescription&&!t.toolSet},c=t.id,u=new O;if(u.add(this._languageModelToolsService.registerTool(l,{invoke:async(p,h,g,f)=>{try{this._runningToolCalls.set(p.callId,{countTokens:h,progress:g});let v=await this._proxy.$invokeTool(p,f),b=v instanceof Hg?v.value:v;return er(b)}finally{this._runningToolCalls.delete(p.callId)}},handleToolStream:o?(p,h)=>this._proxy.$handleToolStream(c,p,h):void 0,prepareToolInvocation:(p,h)=>this._proxy.$prepareToolInvocation(c,p,h)})),t.toolSet){let p=this._languageModelToolsService.getToolSet(uXe(e,t.toolSet))||this._languageModelToolsService.getToolSet(t.toolSet);!p||!(p instanceof aDe)?this._logService.warn(`ToolSet ${t.toolSet} not found for tool ${t.id} from extension ${e.value}`):u.add(p.addTool(l))}this._tools.set(c,u)}$unregisterTool(e){this._tools.deleteAndDispose(e)}};rAt=I([fo(Xi.MainThreadLanguageModelTools),m(1,Wn),m(2,re),m(3,Ze)],rAt);var blo=le("embeddingsService"),GSi=class{constructor(){this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this.providers=new Map}get allProviders(){return this.providers.keys()}registerProvider(i,e){return this.providers.set(i,e),this._onDidChange.fire(),{dispose:()=>{this.providers.delete(i),this._onDidChange.fire()}}}computeEmbeddings(i,e,t){let o=this.providers.get(i);return o?o.provideEmbeddings(e,t):Promise.reject(new Error(`No embeddings provider registered with id: ${i}`))}};Ce(blo,GSi,1);var sAt=class{constructor(i,e){this.embeddingsService=e;this._store=new O;this._providers=this._store.add(new Ot);this._proxy=i.getProxy(ao.ExtHostEmbeddings),this._store.add(e.onDidChange((()=>{this._proxy.$acceptEmbeddingModels(Array.from(e.allProviders))})))}dispose(){this._store.dispose()}$registerEmbeddingProvider(i,e){let t=this.embeddingsService.registerProvider(e,{provideEmbeddings:(o,n)=>this._proxy.$provideEmbeddings(i,o,n)});this._providers.set(i,t)}$unregisterEmbeddingProvider(i){this._providers.deleteAndDispose(i)}$computeEmbeddings(i,e,t){return this.embeddingsService.computeEmbeddings(i,e,t)}};sAt=I([fo(Xi.MainThreadEmbeddings),m(1,blo)],sAt);var qSi=class{constructor(){this.buffers=[]}add(i){let e=this.buffers.indexOf(i);return e<0&&(e=this.buffers.length,this.buffers.push(i)),e}};function Slo(a,i){if(i.serializeBuffersForPostMessage){let e=new qSi,o=JSON.stringify(a,(r,s)=>{if(s instanceof ArrayBuffer)return{$$vscode_array_buffer_reference$$:!0,index:e.add(s)};if(ArrayBuffer.isView(s)){let l=P7o(s);if(l)return{$$vscode_array_buffer_reference$$:!0,index:e.add(s.buffer),view:{type:l,byteLength:s.byteLength,byteOffset:s.byteOffset}}}return s}),n=e.buffers.map(r=>{let s=new Uint8Array(r);return Ke.wrap(s)});return{message:o,buffers:n}}else return{message:JSON.stringify(a),buffers:[]}}function P7o(a){switch(a.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 Ilo(a,i){let e=i.map(n=>{let r=new ArrayBuffer(n.byteLength);return new Uint8Array(r).set(n.buffer),r}),t=i.length?(n,r)=>{if(r&&typeof r=="object"&&r.$$vscode_array_buffer_reference$$){let s=r,{index:l}=s,c=e[l];if(s.view)switch(s.view.type){case 1:return new Int8Array(c,s.view.byteOffset,s.view.byteLength/Int8Array.BYTES_PER_ELEMENT);case 2:return new Uint8Array(c,s.view.byteOffset,s.view.byteLength/Uint8Array.BYTES_PER_ELEMENT);case 3:return new Uint8ClampedArray(c,s.view.byteOffset,s.view.byteLength/Uint8ClampedArray.BYTES_PER_ELEMENT);case 4:return new Int16Array(c,s.view.byteOffset,s.view.byteLength/Int16Array.BYTES_PER_ELEMENT);case 5:return new Uint16Array(c,s.view.byteOffset,s.view.byteLength/Uint16Array.BYTES_PER_ELEMENT);case 6:return new Int32Array(c,s.view.byteOffset,s.view.byteLength/Int32Array.BYTES_PER_ELEMENT);case 7:return new Uint32Array(c,s.view.byteOffset,s.view.byteLength/Uint32Array.BYTES_PER_ELEMENT);case 8:return new Float32Array(c,s.view.byteOffset,s.view.byteLength/Float32Array.BYTES_PER_ELEMENT);case 9:return new Float64Array(c,s.view.byteOffset,s.view.byteLength/Float64Array.BYTES_PER_ELEMENT);case 10:return new BigInt64Array(c,s.view.byteOffset,s.view.byteLength/BigInt64Array.BYTES_PER_ELEMENT);case 11:return new BigUint64Array(c,s.view.byteOffset,s.view.byteLength/BigUint64Array.BYTES_PER_ELEMENT);default:throw new Error("Unknown array buffer view type")}return c}return r}:void 0;return{message:JSON.parse(a,t),arrayBuffers:e}}var HZ=class extends k{constructor(e,t,o){super();this._openerService=t;this._productService=o;this._webviews=new Map;this._proxy=e.getProxy(ao.ExtHostWebviews)}static{this.standardSupportedLinkSchemes=new Set([Q.http,Q.https,Q.mailto,Q.vscode,"vscode-insider"])}addWebview(e,t,o){if(this._webviews.has(e))throw new Error("Webview already registered");this._webviews.set(e,t),this.hookupWebviewEventDelegate(e,t,o)}$setHtml(e,t){this.tryGetWebview(e)?.setHtml(t)}$setOptions(e,t){let o=this.tryGetWebview(e);o&&(o.contentOptions=IDe(t))}async $postMessage(e,t,...o){let n=this.tryGetWebview(e);if(!n)return!1;let{message:r,arrayBuffers:s}=Ilo(t,o);return n.postMessage(r,s)}hookupWebviewEventDelegate(e,t,o){let n=new O;n.add(t.onDidClickLink(r=>this.onDidClickLink(e,r))),n.add(t.onMessage(r=>{let s=Slo(r.message,o);this._proxy.$onMessage(e,s.message,new Hg(s.buffers))})),n.add(t.onMissingCsp(r=>this._proxy.$onMissingCsp(e,r.value))),n.add(t.onDidDispose(()=>{n.dispose(),this._webviews.delete(e)}))}onDidClickLink(e,t){let o=this.getWebview(e);this.isSupportedLink(o,A.parse(t))&&this._openerService.open(t,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:Array.isArray(o.contentOptions.enableCommandUris)||o.contentOptions.enableCommandUris===!0,fromWorkspace:!0})}isSupportedLink(e,t){return HZ.standardSupportedLinkSchemes.has(t.scheme)||!Ft&&this._productService.urlProtocol===t.scheme?!0:t.scheme===Q.command?Array.isArray(e.contentOptions.enableCommandUris)?e.contentOptions.enableCommandUris.includes(t.path):e.contentOptions.enableCommandUris===!0:!1}tryGetWebview(e){return this._webviews.get(e)}getWebview(e){let t=this.tryGetWebview(e);if(!t)throw new Error(`Unknown webview handle:${e}`);return t}getWebviewResolvedFailedContent(e){return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none';">
			</head>
			<body>${d(3967,null,Cr(e))}</body>
		</html>`}};HZ=I([m(1,Je),m(2,Ze)],HZ);function zpe(a){return{id:a.id,location:A.revive(a.location)}}function IDe(a){return{allowScripts:a.enableScripts,allowForms:a.enableForms,enableCommandUris:a.enableCommandUris,localResourceRoots:Array.isArray(a.localResourceRoots)?a.localResourceRoots.map(i=>A.revive(i)):void 0,portMapping:a.portMapping}}var $l=class a{constructor(i,e){this.storageService=e;this.id=a.COMMON_PREFIX+i}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(i,e){switch(i){case 1:{let t=a.workspaceMementos.get(this.id);return t||(t=new yDe(this.id,i,e,this.storageService),a.workspaceMementos.set(this.id,t)),t.getMemento()}case 0:{let t=a.profileMementos.get(this.id);return t||(t=new yDe(this.id,i,e,this.storageService),a.profileMementos.set(this.id,t)),t.getMemento()}case-1:{let t=a.applicationMementos.get(this.id);return t||(t=new yDe(this.id,i,e,this.storageService),a.applicationMementos.set(this.id,t)),t.getMemento()}case-2:{let t=a.applicationSharedMementos.get(this.id);return t||(t=new yDe(this.id,i,e,this.storageService),a.applicationSharedMementos.set(this.id,t)),t.getMemento()}}}onDidChangeValue(i,e){return this.storageService.onDidChangeValue(i,this.id,e)}saveMemento(){a.workspaceMementos.get(this.id)?.save(),a.profileMementos.get(this.id)?.save(),a.applicationMementos.get(this.id)?.save(),a.applicationSharedMementos.get(this.id)?.save()}reloadMemento(i){let e;switch(i){case-2:e=a.applicationSharedMementos.get(this.id);break;case-1:e=a.applicationMementos.get(this.id);break;case 0:e=a.profileMementos.get(this.id);break;case 1:e=a.workspaceMementos.get(this.id);break}e?.reload()}static clear(i){switch(i){case 1:a.workspaceMementos.clear();break;case 0:a.profileMementos.clear();break;case-1:a.applicationMementos.clear();break;case-2:a.applicationSharedMementos.clear();break}}},yDe=class{constructor(i,e,t,o){this.id=i;this.scope=e;this.target=t;this.storageService=o;this.mementoObj=this.doLoad()}doLoad(){try{return this.storageService.getObject(this.id,this.scope,{})}catch(i){mt(`[memento]: failed to parse contents: ${i} (id: ${this.id}, scope: ${this.scope}, contents: ${this.storageService.get(this.id,this.scope)})`)}return{}}getMemento(){return this.mementoObj}reload(){for(let i of Object.getOwnPropertyNames(this.mementoObj))delete this.mementoObj[i];Object.assign(this.mementoObj,this.doLoad())}save(){dv(this.mementoObj)?this.storageService.remove(this.id,this.scope):this.storageService.store(this.id,this.mementoObj,this.scope,this.target)}};var aAt=new Y("webviewFindWidgetVisible",!1),K2=new Y("webviewFindWidgetFocused",!1),lAt=new Y("webviewFindWidgetEnabled",!1),Pu=le("webviewService");function ylo(a,i){return a.allowMultipleAPIAcquire===i.allowMultipleAPIAcquire&&a.allowScripts===i.allowScripts&&a.allowForms===i.allowForms&&eo(a.localResourceRoots,i.localResourceRoots,ze)&&eo(a.portMapping,i.portMapping,(e,t)=>e.extensionHostPort===t.extensionHostPort&&e.webviewPort===t.webviewPort)&&A7o(a,i)}function A7o(a,i){return a.enableCommandUris===i.enableCommandUris?!0:Array.isArray(a.enableCommandUris)&&Array.isArray(i.enableCommandUris)?eo(a.enableCommandUris,i.enableCommandUris):!1}var N3=class{constructor(i,e){this._memento=new $l(i,e),this._state=this._memento.getMemento(-1,1)}getOrigin(i,e){let t=this._getKey(i,e),o=this._state[t];if(o&&typeof o=="string")return o;let n=ht();return this._state[t]=n,this._memento.saveMemento(),n}_getKey(i,e){return JSON.stringify({viewType:i,key:e})}};N3=I([m(1,de)],N3);var q0=class{constructor(i,e){this._store=new N3(i,e)}getOrigin(i,e){return this._store.getOrigin(i,e.value)}};q0=I([m(1,de)],q0);var $Si=class{constructor(i,e,t,o){this.editor=i;this.line=e;this.height=t;this.webview=o;this.domNode=document.createElement("div"),this.domNode.style.zIndex="10",this.afterLineNumber=e,this.afterColumn=1,this.heightInLines=t,i.changeViewZones(n=>this._id=n.addZone(this)),o.mountTo(this.domNode,Me(i.getDomNode()))}dispose(){this.editor.changeViewZones(i=>this._id&&i.removeZone(this._id))}},cAt=class{constructor(i,e,t){this._editorService=e;this._webviewService=t;this._disposables=new O;this._insets=new Map;this._proxy=i.getProxy(ao.ExtHostEditorInsets)}dispose(){this._disposables.dispose()}async $createEditorInset(i,e,t,o,n,r,s,l){let c;e=e.substr(0,e.indexOf(","));for(let f of this._editorService.listCodeEditors())if(f.getId()===e&&f.hasModel()&&ze(f.getModel().uri,A.revive(t))){c=f;break}if(!c){setTimeout(()=>this._proxy.$onDidDispose(i));return}let u=new O,p=this._webviewService.createWebviewElement({title:void 0,options:{enableFindWidget:!1},contentOptions:IDe(r),extension:{id:s,location:A.revive(l)}}),h=new $Si(c,o,n,p),g=()=>{u.dispose(),this._proxy.$onDidDispose(i),this._insets.delete(i)};u.add(c.onDidChangeModel(g)),u.add(c.onDidDispose(g)),u.add(h),u.add(p),u.add(p.onMessage(f=>this._proxy.$onDidReceiveMessage(i,f.message))),this._insets.set(i,h)}$disposeEditorInset(i){let e=this.getInset(i);this._insets.delete(i),e.dispose()}$setHtml(i,e){this.getInset(i).webview.setHtml(e)}$setOptions(i,e){let t=this.getInset(i);t.webview.contentOptions=IDe(e)}async $postMessage(i,e){return this.getInset(i).webview.postMessage(e),!0}getInset(i){let e=this._insets.get(i);if(!e)throw new Error("Unknown inset");return e}};cAt=I([fo(Xi.MainThreadEditorInsets),m(1,Qt),m(2,Pu)],cAt);var dAt={},pu={exports:dAt};(function(a,i){if(typeof dAt=="object"&&typeof pu=="object")pu.exports=i();else if(typeof define=="function"&&define.amd)define([],i);else{var e=i();for(var t in e)(typeof dAt=="object"?dAt:a)[t]=e[t]}})(typeof self<"u"?self:void 0,(function(){return(function(a){var i={};function e(t){if(i[t])return i[t].exports;var o=i[t]={i:t,l:!1,exports:{}};return a[t].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=a,e.c=i,e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:n})},e.r=function(t){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,o){if(1&o&&(t=e(t)),8&o||4&o&&typeof t=="object"&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&o&&typeof t!="string")for(var r in t)e.d(n,r,function(s){return t[s]}.bind(null,r));return n},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},e.p="",e(e.s=0)})([function(a,i,e){(function(t){var o;i=a.exports=Bn,o=typeof t=="object"&&t.env&&t.env.NODE_DEBUG&&/\bsemver\b/i.test(t.env.NODE_DEBUG)?function(){var jt=Array.prototype.slice.call(arguments,0);jt.unshift("SEMVER"),console.log.apply(console,jt)}:function(){},i.SEMVER_SPEC_VERSION="2.0.0";var n=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,s=i.re=[],l=i.src=[],c=0,u=c++;l[u]="0|[1-9]\\d*";var p=c++;l[p]="[0-9]+";var h=c++;l[h]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var g=c++;l[g]="("+l[u]+")\\.("+l[u]+")\\.("+l[u]+")";var f=c++;l[f]="("+l[p]+")\\.("+l[p]+")\\.("+l[p]+")";var v=c++;l[v]="(?:"+l[u]+"|"+l[h]+")";var b=c++;l[b]="(?:"+l[p]+"|"+l[h]+")";var S=c++;l[S]="(?:-("+l[v]+"(?:\\."+l[v]+")*))";var y=c++;l[y]="(?:-?("+l[b]+"(?:\\."+l[b]+")*))";var w=c++;l[w]="[0-9A-Za-z-]+";var x=c++;l[x]="(?:\\+("+l[w]+"(?:\\."+l[w]+")*))";var E=c++,M="v?"+l[g]+l[S]+"?"+l[x]+"?";l[E]="^"+M+"$";var N="[v=\\s]*"+l[f]+l[y]+"?"+l[x]+"?",V=c++;l[V]="^"+N+"$";var H=c++;l[H]="((?:<|>)?=?)";var K=c++;l[K]=l[p]+"|x|X|\\*";var j=c++;l[j]=l[u]+"|x|X|\\*";var J=c++;l[J]="[v=\\s]*("+l[j]+")(?:\\.("+l[j]+")(?:\\.("+l[j]+")(?:"+l[S]+")?"+l[x]+"?)?)?";var se=c++;l[se]="[v=\\s]*("+l[K]+")(?:\\.("+l[K]+")(?:\\.("+l[K]+")(?:"+l[y]+")?"+l[x]+"?)?)?";var ae=c++;l[ae]="^"+l[H]+"\\s*"+l[J]+"$";var ce=c++;l[ce]="^"+l[H]+"\\s*"+l[se]+"$";var Se=c++;l[Se]="(?:^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])";var Re=c++;l[Re]="(?:~>?)";var xe=c++;l[xe]="(\\s*)"+l[Re]+"\\s+",s[xe]=new RegExp(l[xe],"g");var He=c++;l[He]="^"+l[Re]+l[J]+"$";var Ee=c++;l[Ee]="^"+l[Re]+l[se]+"$";var Te=c++;l[Te]="(?:\\^)";var It=c++;l[It]="(\\s*)"+l[Te]+"\\s+",s[It]=new RegExp(l[It],"g");var tt=c++;l[tt]="^"+l[Te]+l[J]+"$";var Oi=c++;l[Oi]="^"+l[Te]+l[se]+"$";var zt=c++;l[zt]="^"+l[H]+"\\s*("+N+")$|^$";var mo=c++;l[mo]="^"+l[H]+"\\s*("+M+")$|^$";var dn=c++;l[dn]="(\\s*)"+l[H]+"\\s*("+N+"|"+l[J]+")",s[dn]=new RegExp(l[dn],"g");var No=c++;l[No]="^\\s*("+l[J]+")\\s+-\\s+("+l[J]+")\\s*$";var _i=c++;l[_i]="^\\s*("+l[se]+")\\s+-\\s+("+l[se]+")\\s*$";var ln=c++;l[ln]="(<|>)?=?\\s*\\*";for(var Tn=0;Tn<35;Tn++)o(Tn,l[Tn]),s[Tn]||(s[Tn]=new RegExp(l[Tn]));function Ko(jt,Fi){if(jt instanceof Bn)return jt;if(typeof jt!="string"||jt.length>n||!(Fi?s[V]:s[E]).test(jt))return null;try{return new Bn(jt,Fi)}catch{return null}}function Bn(jt,Fi){if(jt instanceof Bn){if(jt.loose===Fi)return jt;jt=jt.version}else if(typeof jt!="string")throw new TypeError("Invalid Version: "+jt);if(jt.length>n)throw new TypeError("version is longer than "+n+" characters");if(!(this instanceof Bn))return new Bn(jt,Fi);o("SemVer",jt,Fi),this.loose=Fi;var lo=jt.trim().match(Fi?s[V]:s[E]);if(!lo)throw new TypeError("Invalid Version: "+jt);if(this.raw=jt,this.major=+lo[1],this.minor=+lo[2],this.patch=+lo[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");lo[4]?this.prerelease=lo[4].split(".").map((function(rs){if(/^[0-9]+$/.test(rs)){var Pa=+rs;if(Pa>=0&&Pa<r)return Pa}return rs})):this.prerelease=[],this.build=lo[5]?lo[5].split("."):[],this.format()}i.parse=Ko,i.valid=function(jt,Fi){var lo=Ko(jt,Fi);return lo?lo.version:null},i.clean=function(jt,Fi){var lo=Ko(jt.trim().replace(/^[=v]+/,""),Fi);return lo?lo.version:null},i.SemVer=Bn,Bn.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},Bn.prototype.toString=function(){return this.version},Bn.prototype.compare=function(jt){return o("SemVer.compare",this.version,this.loose,jt),jt instanceof Bn||(jt=new Bn(jt,this.loose)),this.compareMain(jt)||this.comparePre(jt)},Bn.prototype.compareMain=function(jt){return jt instanceof Bn||(jt=new Bn(jt,this.loose)),va(this.major,jt.major)||va(this.minor,jt.minor)||va(this.patch,jt.patch)},Bn.prototype.comparePre=function(jt){if(jt instanceof Bn||(jt=new Bn(jt,this.loose)),this.prerelease.length&&!jt.prerelease.length)return-1;if(!this.prerelease.length&&jt.prerelease.length)return 1;if(!this.prerelease.length&&!jt.prerelease.length)return 0;var Fi=0;do{var lo=this.prerelease[Fi],rs=jt.prerelease[Fi];if(o("prerelease compare",Fi,lo,rs),lo===void 0&&rs===void 0)return 0;if(rs===void 0)return 1;if(lo===void 0)return-1;if(lo!==rs)return va(lo,rs)}while(++Fi)},Bn.prototype.inc=function(jt,Fi){switch(jt){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",Fi);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",Fi);break;case"prepatch":this.prerelease.length=0,this.inc("patch",Fi),this.inc("pre",Fi);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",Fi),this.inc("pre",Fi);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 lo=this.prerelease.length;--lo>=0;)typeof this.prerelease[lo]=="number"&&(this.prerelease[lo]++,lo=-2);lo===-1&&this.prerelease.push(0)}Fi&&(this.prerelease[0]===Fi?isNaN(this.prerelease[1])&&(this.prerelease=[Fi,0]):this.prerelease=[Fi,0]);break;default:throw new Error("invalid increment argument: "+jt)}return this.format(),this.raw=this.version,this},i.inc=function(jt,Fi,lo,rs){typeof lo=="string"&&(rs=lo,lo=void 0);try{return new Bn(jt,lo).inc(Fi,rs).version}catch{return null}},i.diff=function(jt,Fi){if(su(jt,Fi))return null;var lo=Ko(jt),rs=Ko(Fi);if(lo.prerelease.length||rs.prerelease.length){for(var Pa in lo)if((Pa==="major"||Pa==="minor"||Pa==="patch")&&lo[Pa]!==rs[Pa])return"pre"+Pa;return"prerelease"}for(var Pa in lo)if((Pa==="major"||Pa==="minor"||Pa==="patch")&&lo[Pa]!==rs[Pa])return Pa},i.compareIdentifiers=va;var Mr=/^[0-9]+$/;function va(jt,Fi){var lo=Mr.test(jt),rs=Mr.test(Fi);return lo&&rs&&(jt=+jt,Fi=+Fi),lo&&!rs?-1:rs&&!lo?1:jt<Fi?-1:jt>Fi?1:0}function $s(jt,Fi,lo){return new Bn(jt,lo).compare(new Bn(Fi,lo))}function _l(jt,Fi,lo){return $s(jt,Fi,lo)>0}function mc(jt,Fi,lo){return $s(jt,Fi,lo)<0}function su(jt,Fi,lo){return $s(jt,Fi,lo)===0}function yu(jt,Fi,lo){return $s(jt,Fi,lo)!==0}function sr(jt,Fi,lo){return $s(jt,Fi,lo)>=0}function Lo(jt,Fi,lo){return $s(jt,Fi,lo)<=0}function kc(jt,Fi,lo,rs){var Pa;switch(Fi){case"===":typeof jt=="object"&&(jt=jt.version),typeof lo=="object"&&(lo=lo.version),Pa=jt===lo;break;case"!==":typeof jt=="object"&&(jt=jt.version),typeof lo=="object"&&(lo=lo.version),Pa=jt!==lo;break;case"":case"=":case"==":Pa=su(jt,lo,rs);break;case"!=":Pa=yu(jt,lo,rs);break;case">":Pa=_l(jt,lo,rs);break;case">=":Pa=sr(jt,lo,rs);break;case"<":Pa=mc(jt,lo,rs);break;case"<=":Pa=Lo(jt,lo,rs);break;default:throw new TypeError("Invalid operator: "+Fi)}return Pa}function Cn(jt,Fi){if(jt instanceof Cn){if(jt.loose===Fi)return jt;jt=jt.value}if(!(this instanceof Cn))return new Cn(jt,Fi);o("comparator",jt,Fi),this.loose=Fi,this.parse(jt),this.semver===xa?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}i.rcompareIdentifiers=function(jt,Fi){return va(Fi,jt)},i.major=function(jt,Fi){return new Bn(jt,Fi).major},i.minor=function(jt,Fi){return new Bn(jt,Fi).minor},i.patch=function(jt,Fi){return new Bn(jt,Fi).patch},i.compare=$s,i.compareLoose=function(jt,Fi){return $s(jt,Fi,!0)},i.rcompare=function(jt,Fi,lo){return $s(Fi,jt,lo)},i.sort=function(jt,Fi){return jt.sort((function(lo,rs){return i.compare(lo,rs,Fi)}))},i.rsort=function(jt,Fi){return jt.sort((function(lo,rs){return i.rcompare(lo,rs,Fi)}))},i.gt=_l,i.lt=mc,i.eq=su,i.neq=yu,i.gte=sr,i.lte=Lo,i.cmp=kc,i.Comparator=Cn;var xa={};function Os(jt,Fi){if(jt instanceof Os)return jt.loose===Fi?jt:new Os(jt.raw,Fi);if(jt instanceof Cn)return new Os(jt.value,Fi);if(!(this instanceof Os))return new Os(jt,Fi);if(this.loose=Fi,this.raw=jt,this.set=jt.split(/\s*\|\|\s*/).map((function(lo){return this.parseRange(lo.trim())}),this).filter((function(lo){return lo.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+jt);this.format()}function rl(jt){return!jt||jt.toLowerCase()==="x"||jt==="*"}function js(jt,Fi,lo,rs,Pa,Df,_o,mn,Wt,Ye,we,Qe,Pt){return((Fi=rl(lo)?"":rl(rs)?">="+lo+".0.0":rl(Pa)?">="+lo+"."+rs+".0":">="+Fi)+" "+(mn=rl(Wt)?"":rl(Ye)?"<"+(+Wt+1)+".0.0":rl(we)?"<"+Wt+"."+(+Ye+1)+".0":Qe?"<="+Wt+"."+Ye+"."+we+"-"+Qe:"<="+mn)).trim()}function Fh(jt,Fi){for(var lo=0;lo<jt.length;lo++)if(!jt[lo].test(Fi))return!1;if(Fi.prerelease.length){for(lo=0;lo<jt.length;lo++)if(o(jt[lo].semver),jt[lo].semver!==xa&&jt[lo].semver.prerelease.length>0){var rs=jt[lo].semver;if(rs.major===Fi.major&&rs.minor===Fi.minor&&rs.patch===Fi.patch)return!0}return!1}return!0}function Cm(jt,Fi,lo){try{Fi=new Os(Fi,lo)}catch{return!1}return Fi.test(jt)}function TS(jt,Fi,lo,rs){var Pa,Df,_o,mn,Wt;switch(jt=new Bn(jt,rs),Fi=new Os(Fi,rs),lo){case">":Pa=_l,Df=Lo,_o=mc,mn=">",Wt=">=";break;case"<":Pa=mc,Df=sr,_o=_l,mn="<",Wt="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Cm(jt,Fi,rs))return!1;for(var Ye=0;Ye<Fi.set.length;++Ye){var we=Fi.set[Ye],Qe=null,Pt=null;if(we.forEach((function(qt){qt.semver===xa&&(qt=new Cn(">=0.0.0")),Qe=Qe||qt,Pt=Pt||qt,Pa(qt.semver,Qe.semver,rs)?Qe=qt:_o(qt.semver,Pt.semver,rs)&&(Pt=qt)})),Qe.operator===mn||Qe.operator===Wt||(!Pt.operator||Pt.operator===mn)&&Df(jt,Pt.semver)||Pt.operator===Wt&&_o(jt,Pt.semver))return!1}return!0}Cn.prototype.parse=function(jt){var Fi=this.loose?s[zt]:s[mo],lo=jt.match(Fi);if(!lo)throw new TypeError("Invalid comparator: "+jt);this.operator=lo[1],this.operator==="="&&(this.operator=""),lo[2]?this.semver=new Bn(lo[2],this.loose):this.semver=xa},Cn.prototype.toString=function(){return this.value},Cn.prototype.test=function(jt){return o("Comparator.test",jt,this.loose),this.semver===xa||(typeof jt=="string"&&(jt=new Bn(jt,this.loose)),kc(jt,this.operator,this.semver,this.loose))},Cn.prototype.intersects=function(jt,Fi){if(!(jt instanceof Cn))throw new TypeError("a Comparator is required");var lo;if(this.operator==="")return lo=new Os(jt.value,Fi),Cm(this.value,lo,Fi);if(jt.operator==="")return lo=new Os(this.value,Fi),Cm(jt.semver,lo,Fi);var rs=!(this.operator!==">="&&this.operator!==">"||jt.operator!==">="&&jt.operator!==">"),Pa=!(this.operator!=="<="&&this.operator!=="<"||jt.operator!=="<="&&jt.operator!=="<"),Df=this.semver.version===jt.semver.version,_o=!(this.operator!==">="&&this.operator!=="<="||jt.operator!==">="&&jt.operator!=="<="),mn=kc(this.semver,"<",jt.semver,Fi)&&(this.operator===">="||this.operator===">")&&(jt.operator==="<="||jt.operator==="<"),Wt=kc(this.semver,">",jt.semver,Fi)&&(this.operator==="<="||this.operator==="<")&&(jt.operator===">="||jt.operator===">");return rs||Pa||Df&&_o||mn||Wt},i.Range=Os,Os.prototype.format=function(){return this.range=this.set.map((function(jt){return jt.join(" ").trim()})).join("||").trim(),this.range},Os.prototype.toString=function(){return this.range},Os.prototype.parseRange=function(jt){var Fi=this.loose;jt=jt.trim(),o("range",jt,Fi);var lo=Fi?s[_i]:s[No];jt=jt.replace(lo,js),o("hyphen replace",jt),jt=jt.replace(s[dn],"$1$2$3"),o("comparator trim",jt,s[dn]),jt=(jt=(jt=jt.replace(s[xe],"$1~")).replace(s[It],"$1^")).split(/\s+/).join(" ");var rs=Fi?s[zt]:s[mo],Pa=jt.split(" ").map((function(Df){return(function(_o,mn){return o("comp",_o),_o=(function(Wt,Ye){return Wt.trim().split(/\s+/).map((function(we){return(function(Qe,Pt){o("caret",Qe,Pt);var qt=Pt?s[Oi]:s[tt];return Qe.replace(qt,(function(Oo,ho,zr,Fs,as){var Ha;return o("caret",Qe,Oo,ho,zr,Fs,as),rl(ho)?Ha="":rl(zr)?Ha=">="+ho+".0.0 <"+(+ho+1)+".0.0":rl(Fs)?Ha=ho==="0"?">="+ho+"."+zr+".0 <"+ho+"."+(+zr+1)+".0":">="+ho+"."+zr+".0 <"+(+ho+1)+".0.0":as?(o("replaceCaret pr",as),as.charAt(0)!=="-"&&(as="-"+as),Ha=ho==="0"?zr==="0"?">="+ho+"."+zr+"."+Fs+as+" <"+ho+"."+zr+"."+(+Fs+1):">="+ho+"."+zr+"."+Fs+as+" <"+ho+"."+(+zr+1)+".0":">="+ho+"."+zr+"."+Fs+as+" <"+(+ho+1)+".0.0"):(o("no pr"),Ha=ho==="0"?zr==="0"?">="+ho+"."+zr+"."+Fs+" <"+ho+"."+zr+"."+(+Fs+1):">="+ho+"."+zr+"."+Fs+" <"+ho+"."+(+zr+1)+".0":">="+ho+"."+zr+"."+Fs+" <"+(+ho+1)+".0.0"),o("caret return",Ha),Ha}))})(we,Ye)})).join(" ")})(_o,mn),o("caret",_o),_o=(function(Wt,Ye){return Wt.trim().split(/\s+/).map((function(we){return(function(Qe,Pt){var qt=Pt?s[Ee]:s[He];return Qe.replace(qt,(function(Oo,ho,zr,Fs,as){var Ha;return o("tilde",Qe,Oo,ho,zr,Fs,as),rl(ho)?Ha="":rl(zr)?Ha=">="+ho+".0.0 <"+(+ho+1)+".0.0":rl(Fs)?Ha=">="+ho+"."+zr+".0 <"+ho+"."+(+zr+1)+".0":as?(o("replaceTilde pr",as),as.charAt(0)!=="-"&&(as="-"+as),Ha=">="+ho+"."+zr+"."+Fs+as+" <"+ho+"."+(+zr+1)+".0"):Ha=">="+ho+"."+zr+"."+Fs+" <"+ho+"."+(+zr+1)+".0",o("tilde return",Ha),Ha}))})(we,Ye)})).join(" ")})(_o,mn),o("tildes",_o),_o=(function(Wt,Ye){return o("replaceXRanges",Wt,Ye),Wt.split(/\s+/).map((function(we){return(function(Qe,Pt){Qe=Qe.trim();var qt=Pt?s[ce]:s[ae];return Qe.replace(qt,(function(Oo,ho,zr,Fs,as,Ha){o("xRange",Qe,Oo,ho,zr,Fs,as,Ha);var Zr=rl(zr),Sl=Zr||rl(Fs),au=Sl||rl(as);return ho==="="&&au&&(ho=""),Zr?Oo=ho===">"||ho==="<"?"<0.0.0":"*":ho&&au?(Sl&&(Fs=0),au&&(as=0),ho===">"?(ho=">=",Sl?(zr=+zr+1,Fs=0,as=0):au&&(Fs=+Fs+1,as=0)):ho==="<="&&(ho="<",Sl?zr=+zr+1:Fs=+Fs+1),Oo=ho+zr+"."+Fs+"."+as):Sl?Oo=">="+zr+".0.0 <"+(+zr+1)+".0.0":au&&(Oo=">="+zr+"."+Fs+".0 <"+zr+"."+(+Fs+1)+".0"),o("xRange return",Oo),Oo}))})(we,Ye)})).join(" ")})(_o,mn),o("xrange",_o),_o=(function(Wt,Ye){return o("replaceStars",Wt,Ye),Wt.trim().replace(s[ln],"")})(_o,mn),o("stars",_o),_o})(Df,Fi)})).join(" ").split(/\s+/);return this.loose&&(Pa=Pa.filter((function(Df){return!!Df.match(rs)}))),Pa=Pa.map((function(Df){return new Cn(Df,Fi)}))},Os.prototype.intersects=function(jt,Fi){if(!(jt instanceof Os))throw new TypeError("a Range is required");return this.set.some((function(lo){return lo.every((function(rs){return jt.set.some((function(Pa){return Pa.every((function(Df){return rs.intersects(Df,Fi)}))}))}))}))},i.toComparators=function(jt,Fi){return new Os(jt,Fi).set.map((function(lo){return lo.map((function(rs){return rs.value})).join(" ").trim().split(" ")}))},Os.prototype.test=function(jt){if(!jt)return!1;typeof jt=="string"&&(jt=new Bn(jt,this.loose));for(var Fi=0;Fi<this.set.length;Fi++)if(Fh(this.set[Fi],jt))return!0;return!1},i.satisfies=Cm,i.maxSatisfying=function(jt,Fi,lo){var rs=null,Pa=null;try{var Df=new Os(Fi,lo)}catch{return null}return jt.forEach((function(_o){Df.test(_o)&&(rs&&Pa.compare(_o)!==-1||(Pa=new Bn(rs=_o,lo)))})),rs},i.minSatisfying=function(jt,Fi,lo){var rs=null,Pa=null;try{var Df=new Os(Fi,lo)}catch{return null}return jt.forEach((function(_o){Df.test(_o)&&(rs&&Pa.compare(_o)!==1||(Pa=new Bn(rs=_o,lo)))})),rs},i.validRange=function(jt,Fi){try{return new Os(jt,Fi).range||"*"}catch{return null}},i.ltr=function(jt,Fi,lo){return TS(jt,Fi,"<",lo)},i.gtr=function(jt,Fi,lo){return TS(jt,Fi,">",lo)},i.outside=TS,i.prerelease=function(jt,Fi){var lo=Ko(jt,Fi);return lo&&lo.prerelease.length?lo.prerelease:null},i.intersects=function(jt,Fi,lo){return jt=new Os(jt,lo),Fi=new Os(Fi,lo),jt.intersects(Fi)},i.coerce=function(jt){if(jt instanceof Bn)return jt;if(typeof jt!="string")return null;var Fi=jt.match(s[Se]);return Fi==null?null:Ko((Fi[1]||"0")+"."+(Fi[2]||"0")+"."+(Fi[3]||"0"))}}).call(this,e(1))},function(a,i){var e,t,o=a.exports={};function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function s(b){if(e===setTimeout)return setTimeout(b,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(b,0);try{return e(b,0)}catch{try{return e.call(null,b,0)}catch{return e.call(this,b,0)}}}(function(){try{e=typeof setTimeout=="function"?setTimeout:n}catch{e=n}try{t=typeof clearTimeout=="function"?clearTimeout:r}catch{t=r}})();var l,c=[],u=!1,p=-1;function h(){u&&l&&(u=!1,l.length?c=l.concat(c):p=-1,c.length&&g())}function g(){if(!u){var b=s(h);u=!0;for(var S=c.length;S;){for(l=c,c=[];++p<S;)l&&l[p].run();p=-1,S=c.length}l=null,u=!1,(function(y){if(t===clearTimeout)return clearTimeout(y);if((t===r||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(y);try{t(y)}catch{try{return t.call(null,y)}catch{return t.call(this,y)}}})(b)}}function f(b,S){this.fun=b,this.array=S}function v(){}o.nextTick=function(b){var S=new Array(arguments.length-1);if(arguments.length>1)for(var y=1;y<arguments.length;y++)S[y-1]=arguments[y];c.push(new f(b,S)),c.length!==1||u||s(g)},f.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=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(b){return[]},o.binding=function(b){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(b){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}}])}));var X0a=pu.exports.SEMVER_SPEC_VERSION,J0a=pu.exports.parse,wDe=pu.exports.valid,wlo=pu.exports.coerce,Z0a=pu.exports.clean,eWa=pu.exports.inc,tWa=pu.exports.major,iWa=pu.exports.minor,oWa=pu.exports.patch,nWa=pu.exports.prerelease,BM=pu.exports.gt,uAt=pu.exports.gte,Clo=pu.exports.lt,xlo=pu.exports.lte,pAt=pu.exports.eq,rWa=pu.exports.neq,sWa=pu.exports.cmp,aWa=pu.exports.compare,lWa=pu.exports.rcompare,cWa=pu.exports.compareIdentifiers,dWa=pu.exports.rcompareIdentifiers,uWa=pu.exports.compareBuild,pWa=pu.exports.sort,mWa=pu.exports.rsort,hWa=pu.exports.diff,gWa=pu.exports.validRange,pXe=pu.exports.satisfies,fWa=pu.exports.maxSatisfying,vWa=pu.exports.minSatisfying,bWa=pu.exports.minVersion,SWa=pu.exports.gtr,IWa=pu.exports.ltr,yWa=pu.exports.outside,wWa=pu.exports.intersects,CWa=pu.exports.SemVer,xWa=pu.exports.Comparator,kWa=pu.exports.Range;var N7o=a=>d(2262,null,a),klo=d(2275,null,"ms-dotnettools.csharp"),CDe=class{constructor(i,e,t,o,n){this.extensionsForceVersionByQuality=i;this.logger=e;this.extensionManagementService=t;this.extensionGalleryService=o;this.productService=n;this.extensionsForceVersionByQuality=this.extensionsForceVersionByQuality.map(r=>r.toLowerCase())}get location(){}async listExtensions(i,e,t){let o=await this.extensionManagementService.getInstalled(1,t),n=m0.map(s=>s.toLowerCase());if(e&&e!==""){if(n.indexOf(e.toLowerCase())<0){this.logger.info("Invalid category please enter a valid category. To list valid categories run --category without a category specified");return}o=o.filter(s=>s.manifest.categories?s.manifest.categories.map(c=>c.toLowerCase()).indexOf(e.toLowerCase())>-1:!1)}else if(e===""){this.logger.info("Possible Categories: "),n.forEach(s=>{this.logger.info(s)});return}this.location&&this.logger.info(d(2261,null,this.location)),o=o.sort((s,l)=>s.identifier.id.localeCompare(l.identifier.id));let r;for(let s of o)r!==s.identifier.id&&(r=s.identifier.id,this.logger.info(i?`${r}@${s.manifest.version}`:r))}async installExtensions(i,e,t,o){let n=[];try{i.length&&this.logger.info(this.location?d(2260,null,this.location):d(2259,null));let r=[],s=[],l=(u,p,h)=>{this.extensionsForceVersionByQuality?.some(g=>g===u.toLowerCase())&&(p=this.productService.quality!=="stable"?"prerelease":void 0),s.push({id:u,version:p!=="prerelease"?p:void 0,installOptions:{...t,isBuiltin:h,installPreReleaseVersion:p==="prerelease"||t.installPreReleaseVersion}})};for(let u of i)if(u instanceof A)r.push({vsix:u,installOptions:t});else{let[p,h]=b7e(u);l(p,h,!1)}for(let u of e)if(u instanceof A)r.push({vsix:u,installOptions:{...t,isBuiltin:!0,donotIncludePackAndDependencies:!0}});else{let[p,h]=b7e(u);l(p,h,!0)}let c=await this.extensionManagementService.getInstalled(void 0,t.profileLocation);if(r.length&&await Promise.all(r.map(async({vsix:u,installOptions:p})=>{try{await this.installVSIX(u,p,o,c)}catch(h){this.logger.error(h),n.push(u.toString())}})),s.length){let u=await this.installGalleryExtensions(s,c,o);n.push(...u)}}catch(r){throw this.logger.error(d(2249,null,Dn(r))),r}if(n.length)throw new Error(d(2254,null,n.join(", ")))}async updateExtensions(i){let e=await this.extensionManagementService.getInstalled(1,i),t=[];for(let s of e)s.identifier.uuid&&t.push({...s.identifier,preRelease:s.preRelease});this.logger.trace(d(2273,null,t.length));let o=await this.extensionGalleryService.getExtensions(t,{compatible:!0},Ie.None),n=[];for(let s of o)for(let l of e)Ht(l.identifier,s.identifier)&&BM(s.version,l.manifest.version)&&n.push({extension:s,options:{operation:3,installPreReleaseVersion:l.preRelease,profileLocation:i,isApplicationScoped:l.isApplicationScoped}});if(!n.length){this.logger.info(d(2272,null));return}this.logger.info(d(2271,null,n.map(s=>s.extension.identifier.id).join(", ")));let r=await this.extensionManagementService.installGalleryExtensions(n);for(let s of r)s.error?this.logger.error(d(2251,null,s.identifier.id,Dn(s.error))):this.logger.info(d(2268,null,s.identifier.id,s.local?.manifest.version))}async installGalleryExtensions(i,e,t){if(i=i.filter(s=>{let{id:l,version:c,installOptions:u}=s,p=e.find(h=>Ht(h.identifier,{id:l}));if(p){let h=this.validateBuiltinExtensionEnabledWithAutoUpdates(p);if(h)return this.logger.info(h),!1;if(!t&&(!c||c==="prerelease"&&p.preRelease))return this.logger.info(d(2245,null,l,p.manifest.version,l)),!1;if(c&&p.manifest.version===c)return this.logger.info(d(2244,null,`${l}@${c}`)),!1;p.preRelease&&c!=="prerelease"&&(u.preRelease=!1)}return!0}),!i.length)return[];let o=[],n=[],r=await this.getGalleryExtensions(i);if(await Promise.all(i.map(async({id:s,version:l,installOptions:c})=>{let u=r.get(s.toLowerCase());if(!u){this.logger.error(`${N7o(l?`${s}@${l}`:s)}
${klo}`),o.push(s);return}try{let h=await this.extensionGalleryService.getManifest(u,Ie.None);if(h&&!this.validateExtensionKind(h))return}catch(h){this.logger.error(h.message||h.stack||h),o.push(s);return}let p=e.find(h=>Ht(h.identifier,u.identifier));if(p){if(u.version===p.manifest.version){this.logger.info(d(2244,null,l?`${s}@${l}`:s));return}this.logger.info(d(2274,null,s,u.version))}c.isBuiltin?this.logger.info(l?d(2257,null,s,l):d(2256,null,s)):this.logger.info(l?d(2258,null,s,l):d(2255,null,s)),n.push({extension:u,options:{...c,installGivenVersion:!!l,isApplicationScoped:c.isApplicationScoped||p?.isApplicationScoped}})})),n.length){let s=await this.extensionManagementService.installGalleryExtensions(n);for(let l of s)l.error?(this.logger.error(d(2250,null,l.identifier.id,Dn(l.error))),o.push(l.identifier.id)):this.logger.info(d(2265,null,l.identifier.id,l.local?.manifest.version))}return o}async installVSIX(i,e,t,o){let n=await this.extensionManagementService.getManifest(i);if(!n)throw new Error("Invalid vsix");if(await this.validateVSIX(n,t,e.profileLocation,o))try{await this.extensionManagementService.install(i,{...e,installGivenVersion:!0}),this.logger.info(d(2269,null,Be(i)))}catch(s){if(Yi(s))this.logger.info(d(2248,null,Be(i)));else throw s}}async getGalleryExtensions(i){let e=new Map,t=i.some(r=>r.installOptions.installPreReleaseVersion),o=await this.extensionManagementService.getTargetPlatform(),n=[];for(let r of i)Z4.test(r.id)&&n.push({...r,preRelease:t});if(n.length){let r=await this.extensionGalleryService.getExtensions(n,{targetPlatform:o},Ie.None);for(let s of r)e.set(s.identifier.id.toLowerCase(),s)}return e}validateExtensionKind(i){return!0}async validateVSIX(i,e,t,o){let n={id:gf(i.publisher,i.name)},r=o.find(s=>Ht(n,s.identifier));if(r){let s=this.validateBuiltinExtensionEnabledWithAutoUpdates(r);if(s)return this.logger.info(s),!1;if(!e&&BM(r.manifest.version,i.version))return this.logger.info(d(2252,null,r.identifier.id,r.manifest.version,i.version)),!1}return this.validateExtensionKind(i)}async uninstallExtensions(i,e,t){let o=async r=>{if(r instanceof A){let s=await this.extensionManagementService.getManifest(r);return zS(s.publisher,s.name)}return r},n=[];for(let r of i){let s=await o(r),c=(await this.extensionManagementService.getInstalled(void 0,t)).filter(u=>Ht(u.identifier,{id:s}));if(!c.length)throw new Error(`${this.notInstalled(s)}
${klo}`);if(c.some(u=>u.type===0)){this.logger.info(d(2246,null,s));return}if(!e&&c.some(u=>u.isBuiltin)){this.logger.info(d(2253,null,s));return}this.logger.info(d(2270,null,s));for(let u of c)await this.extensionManagementService.uninstall(u,{profileLocation:t}),n.push(u);this.location?this.logger.info(d(2267,null,s,this.location)):this.logger.info(d(2266,null,s))}}async locateExtension(i){let e=await this.extensionManagementService.getInstalled();i.forEach(t=>{e.forEach(o=>{if(o.identifier.id===t&&o.location.scheme===Q.file){this.logger.info(o.location.fsPath);return}})})}notInstalled(i){return this.location?d(2264,null,i,this.location):d(2263,null,i)}validateBuiltinExtensionEnabledWithAutoUpdates(i){if(i.isBuiltin&&this.productService.builtInExtensionsEnabledWithAutoUpdates.some(e=>e.toLowerCase()===i.identifier.id.toLowerCase())&&!i.forceAutoUpdate)return d(2247,null,i.identifier.id,this.productService.quality)}};CDe=I([m(2,xs),m(3,ga),m(4,Ze)],CDe);var O7o=xs;var $c=le("extensionManagementServerService"),Dd=O7o;var As=le("extensionEnablementService"),oVa=le("IWebExtensionsScannerService");var gXe="security.workspace.trust.enabled",XSi="security.workspace.trust.startupPrompt",JSi="security.workspace.trust.banner",hXe="security.workspace.trust.untrustedFiles",mAt="security.workspace.trust.emptyWindow",hAt="extensions.supportUntrustedWorkspaces",F7o="content.trust.model.key",jSi=class{constructor(i,e,t){this.originalWorkspace=i;this.canonicalFolderUris=e;this.canonicalConfiguration=t}get folders(){return this.originalWorkspace.folders.map((i,e)=>({index:i.index,name:i.name,toResource:i.toResource,uri:this.canonicalFolderUris[e]}))}get transient(){return this.originalWorkspace.transient}get configuration(){return this.canonicalConfiguration??this.originalWorkspace.configuration}get id(){return this.originalWorkspace.id}},xDe=class extends k{constructor(e,t){super();this.configurationService=e;this.environmentService=t}isWorkspaceTrustEnabled(){return this.environmentService.disableWorkspaceTrust?!1:!!this.configurationService.getValue(gXe)}};xDe=I([m(0,B),m(1,Mt)],xDe);var kDe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=e;this.remoteAuthorityResolverService=t;this.storageService=o;this.uriIdentityService=n;this.environmentService=r;this.workspaceService=s;this.workspaceTrustEnablementService=l;this.fileService=c;this.storageKey=F7o;this._onDidChangeTrust=this._register(new T);this.onDidChangeTrust=this._onDidChangeTrust.event;this._onDidChangeTrustedFolders=this._register(new T);this.onDidChangeTrustedFolders=this._onDidChangeTrustedFolders.event;this._canonicalStartupFiles=[];this._canonicalUrisResolved=!1,this._canonicalWorkspace=this.workspaceService.getWorkspace(),{promise:this._workspaceResolvedPromise,resolve:this._workspaceResolvedPromiseResolve}=Ey(),{promise:this._workspaceTrustInitializedPromise,resolve:this._workspaceTrustInitializedPromiseResolve}=Ey(),this._storedTrustState=new YSi(Ft&&this.isEmptyWorkspace()?void 0:this.storageService),this._trustTransitionManager=this._register(new QSi),this._trustStateInfo=this.loadTrustInfo(),this._isTrusted=this.calculateWorkspaceTrust(),this.initializeWorkspaceTrust(),this.registerListeners()}initializeWorkspaceTrust(){this.resolveCanonicalUris().then(async()=>{this._canonicalUrisResolved=!0,await this.updateWorkspaceTrust()}).finally(()=>{this._workspaceResolvedPromiseResolve(),this.environmentService.remoteAuthority||this._workspaceTrustInitializedPromiseResolve()}),this.environmentService.remoteAuthority&&this.remoteAuthorityResolverService.resolveAuthority(this.environmentService.remoteAuthority).then(async e=>{this._remoteAuthority=e,await this.fileService.activateProvider(Q.vscodeRemote),await this.updateWorkspaceTrust()}).finally(()=>{this._workspaceTrustInitializedPromiseResolve()}),this.isEmptyWorkspace()&&this._workspaceTrustInitializedPromise.then(()=>{this._storedTrustState.isEmptyWorkspaceTrusted===void 0&&(this._storedTrustState.isEmptyWorkspaceTrusted=this.isWorkspaceTrusted())})}registerListeners(){this._register(this.workspaceService.onDidChangeWorkspaceFolders(async()=>await this.updateWorkspaceTrust())),this._register(this.storageService.onDidChangeValue(-2,this.storageKey,this._store)(async()=>{JSON.stringify(this._trustStateInfo)!==JSON.stringify(this.loadTrustInfo())&&(this._trustStateInfo=this.loadTrustInfo(),this._onDidChangeTrustedFolders.fire(),await this.updateWorkspaceTrust())}))}async getCanonicalUri(e){let t=e;if(this.environmentService.remoteAuthority&&e.scheme===Q.vscodeRemote)t=await this.remoteAuthorityResolverService.getCanonicalURI(e);else if(e.scheme==="vscode-vfs"){let o=e.authority.indexOf("+");o!==-1&&(t=e.with({authority:e.authority.substr(0,o)}))}return t.with({query:null,fragment:null})}async resolveCanonicalUris(){let e=[];if(this.environmentService.filesToOpenOrCreate&&e.push(...this.environmentService.filesToOpenOrCreate),this.environmentService.filesToDiff&&e.push(...this.environmentService.filesToDiff),this.environmentService.filesToMerge&&e.push(...this.environmentService.filesToMerge),e.length){let r=e.filter(l=>!!l.fileUri).map(l=>l.fileUri),s=await Promise.all(r.map(l=>this.getCanonicalUri(l)));this._canonicalStartupFiles.push(...s.filter(l=>this._canonicalStartupFiles.every(c=>!this.uriIdentityService.extUri.isEqual(l,c))))}let t=this.workspaceService.getWorkspace().folders.map(r=>r.uri),o=await Promise.all(t.map(r=>this.getCanonicalUri(r))),n=this.workspaceService.getWorkspace().configuration;n&&Fde(n,this.environmentService)&&(n=await this.getCanonicalUri(n)),this._canonicalWorkspace=new jSi(this.workspaceService.getWorkspace(),o,n)}loadTrustInfo(){let e=this.storageService.get(this.storageKey,-2),t;try{e&&(t=JSON.parse(e))}catch{}return t||(t={uriTrustInfo:[]}),t.uriTrustInfo||(t.uriTrustInfo=[]),t.uriTrustInfo=t.uriTrustInfo.map(o=>({uri:A.revive(o.uri),trusted:o.trusted})),t.uriTrustInfo=t.uriTrustInfo.filter(o=>o.trusted),t}async saveTrustInfo(){this.storageService.store(this.storageKey,JSON.stringify(this._trustStateInfo),-2,1),this._onDidChangeTrustedFolders.fire(),await this.updateWorkspaceTrust()}getWorkspaceUris(){let e=this._canonicalWorkspace.folders.map(o=>o.uri),t=this._canonicalWorkspace.configuration;return t&&Fde(t,this.environmentService)&&e.push(t),e}calculateWorkspaceTrust(){return this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()?this._canonicalUrisResolved?this.environmentService.remoteAuthority&&this._remoteAuthority?.options?.isTrusted?this._remoteAuthority.options.isTrusted:this.isEmptyWorkspace()?this._storedTrustState.isEmptyWorkspaceTrusted!==void 0?this._storedTrustState.isEmptyWorkspaceTrusted:this._canonicalStartupFiles.length?this.getUrisTrust(this._canonicalStartupFiles):!!this.configurationService.getValue(mAt):this.getUrisTrust(this.getWorkspaceUris()):!1:!0}async updateWorkspaceTrust(e){this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&(e===void 0&&(await this.resolveCanonicalUris(),e=this.calculateWorkspaceTrust()),this.isWorkspaceTrusted()!==e&&(this.isTrusted=e,await this._trustTransitionManager.participate(e),this._onDidChangeTrust.fire(e)))}getUrisTrust(e){let t=!0;for(let o of e){let{trusted:n}=this.doGetUriTrustInfo(o);if(!n)return t=n,t}return t}doGetUriTrustInfo(e){if(!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled())return{trusted:!0,uri:e};if(this.uriIdentityService.extUri.isEqual(e,this.environmentService.agentSessionsWorkspace))return{trusted:!0,uri:e};if(this.isTrustedVirtualResource(e))return{trusted:!0,uri:e};if(this.isTrustedByRemote(e))return{trusted:!0,uri:e};let t=!1,o=-1,n=e;for(let r of this._trustStateInfo.uriTrustInfo)if(this.uriIdentityService.extUri.isEqualOrParent(e,r.uri)){let s=r.uri.fsPath;s.length>o&&(o=s.length,t=r.trusted,n=r.uri)}return{trusted:t,uri:n}}async doSetUrisTrust(e,t){let o=!1;for(let n of e)if(t){if(this.isTrustedVirtualResource(n)||this.isTrustedByRemote(n))continue;this._trustStateInfo.uriTrustInfo.find(s=>this.uriIdentityService.extUri.isEqual(s.uri,n))||(this._trustStateInfo.uriTrustInfo.push({uri:n,trusted:!0}),o=!0)}else{let r=this._trustStateInfo.uriTrustInfo.length;this._trustStateInfo.uriTrustInfo=this._trustStateInfo.uriTrustInfo.filter(s=>!this.uriIdentityService.extUri.isEqual(s.uri,n)),r!==this._trustStateInfo.uriTrustInfo.length&&(o=!0)}o&&await this.saveTrustInfo()}isEmptyWorkspace(){if(this.workspaceService.getWorkbenchState()===1)return!0;let e=this.workspaceService.getWorkspace();return e?tC(this.workspaceService.getWorkspace())&&e.folders.length===0:!1}isTrustedVirtualResource(e){return ype(e)&&e.scheme!=="vscode-vfs"}isTrustedByRemote(e){return!this.environmentService.remoteAuthority||!this._remoteAuthority?!1:vB(N4(e),this._remoteAuthority.authority.authority)&&!!this._remoteAuthority.options?.isTrusted}set isTrusted(e){this._isTrusted=e,e||(this._storedTrustState.acceptsOutOfWorkspaceFiles=!1),this.isEmptyWorkspace()&&(this._storedTrustState.isEmptyWorkspaceTrusted=e)}get workspaceResolved(){return this._workspaceResolvedPromise}get workspaceTrustInitialized(){return this._workspaceTrustInitializedPromise}get acceptsOutOfWorkspaceFiles(){return this._storedTrustState.acceptsOutOfWorkspaceFiles}set acceptsOutOfWorkspaceFiles(e){this._storedTrustState.acceptsOutOfWorkspaceFiles=e}isWorkspaceTrusted(){return this._isTrusted}isWorkspaceTrustForced(){return!!(this.environmentService.remoteAuthority&&this._remoteAuthority?.options?.isTrusted!==void 0||this.getWorkspaceUris().filter(t=>!this.isTrustedVirtualResource(t)).length===0)}canSetParentFolderTrust(){let e=pf(this._canonicalWorkspace);if(!Pg(e)||e.uri.scheme!==Q.file&&e.uri.scheme!==Q.vscodeRemote)return!1;let t=this.uriIdentityService.extUri.dirname(e.uri);return!this.uriIdentityService.extUri.isEqual(e.uri,t)}async setParentFolderTrust(e){if(this.canSetParentFolderTrust()){let t=pf(this._canonicalWorkspace).uri,o=this.uriIdentityService.extUri.dirname(t);await this.setUrisTrust([o],e)}}canSetWorkspaceTrust(){if(this.environmentService.remoteAuthority&&(!this._remoteAuthority||this._remoteAuthority.options?.isTrusted!==void 0))return!1;if(this.isEmptyWorkspace())return!0;if(this.getWorkspaceUris().filter(n=>!this.isTrustedVirtualResource(n)).length===0)return!1;if(!this.isWorkspaceTrusted())return!0;let t=pf(this._canonicalWorkspace);if(!Pg(t)||t.uri.scheme!==Q.file&&t.uri.scheme!=="vscode-vfs")return!1;let o=this.doGetUriTrustInfo(t.uri);if(!o.trusted||!this.uriIdentityService.extUri.isEqual(t.uri,o.uri))return!1;if(this.canSetParentFolderTrust()){let n=this.uriIdentityService.extUri.dirname(t.uri);if(this.doGetUriTrustInfo(n).trusted)return!1}return!0}async setWorkspaceTrust(e){if(this.isEmptyWorkspace()){await this.updateWorkspaceTrust(e);return}let t=this.getWorkspaceUris();await this.setUrisTrust(t,e)}async getUriTrustInfo(e){return this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()?this.isTrustedByRemote(e)?{trusted:!0,uri:e}:this.doGetUriTrustInfo(await this.getCanonicalUri(e)):{trusted:!0,uri:e}}async setUrisTrust(e,t){this.doSetUrisTrust(await Promise.all(e.map(o=>this.getCanonicalUri(o))),t)}getTrustedUris(){return this._trustStateInfo.uriTrustInfo.map(e=>e.uri)}async setTrustedUris(e){this._trustStateInfo.uriTrustInfo=[];for(let t of e){let o=await this.getCanonicalUri(t),n=this.uriIdentityService.extUri.removeTrailingPathSeparator(o),r=!1;for(let s of this._trustStateInfo.uriTrustInfo)if(this.uriIdentityService.extUri.isEqual(s.uri,n)){r=!0;break}r||this._trustStateInfo.uriTrustInfo.push({trusted:!0,uri:n})}await this.saveTrustInfo()}addWorkspaceTrustTransitionParticipant(e){return this._trustTransitionManager.addWorkspaceTrustTransitionParticipant(e)}};kDe=I([m(0,B),m(1,dd),m(2,de),m(3,gt),m(4,Mt),m(5,Ae),m(6,yM),m(7,ge)],kDe);var mXe=class extends k{constructor(e,t){super();this.configurationService=e;this.workspaceTrustManagementService=t;this._resourcesTrustRequestPromises=new dt;this._resourcesTrustRequestResolvers=new dt;this._onDidInitiateOpenFilesTrustRequest=this._register(new T);this.onDidInitiateOpenFilesTrustRequest=this._onDidInitiateOpenFilesTrustRequest.event;this._onDidInitiateResourcesTrustRequest=this._register(new T);this.onDidInitiateResourcesTrustRequest=this._onDidInitiateResourcesTrustRequest.event;this._onDidInitiateWorkspaceTrustRequest=this._register(new T);this.onDidInitiateWorkspaceTrustRequest=this._onDidInitiateWorkspaceTrustRequest.event;this._onDidInitiateWorkspaceTrustRequestOnStartup=this._register(new T);this.onDidInitiateWorkspaceTrustRequestOnStartup=this._onDidInitiateWorkspaceTrustRequestOnStartup.event}get untrustedFilesSetting(){return this.configurationService.getValue(hXe)}set untrustedFilesSetting(e){this.configurationService.updateValue(hXe,e)}async completeOpenFilesTrustRequest(e,t){this._openFilesTrustRequestResolver&&(e===1&&(this.workspaceTrustManagementService.acceptsOutOfWorkspaceFiles=!0),t&&(e===1&&(this.untrustedFilesSetting="open"),e===2&&(this.untrustedFilesSetting="newWindow")),this._openFilesTrustRequestResolver(e),this._openFilesTrustRequestResolver=void 0,this._openFilesTrustRequestPromise=void 0)}async requestOpenFilesTrust(e){if(!this.workspaceTrustManagementService.isWorkspaceTrusted())return 1;if((await Promise.all(e.map(o=>this.workspaceTrustManagementService.getUriTrustInfo(o)))).map(o=>o.trusted).every(o=>o))return 1;if(this.untrustedFilesSetting!=="prompt"){if(this.untrustedFilesSetting==="newWindow")return 2;if(this.untrustedFilesSetting==="open")return 1}if(this.workspaceTrustManagementService.acceptsOutOfWorkspaceFiles)return 1;if(!this._openFilesTrustRequestPromise)this._openFilesTrustRequestPromise=new Promise(o=>{this._openFilesTrustRequestResolver=o});else return this._openFilesTrustRequestPromise;return this._onDidInitiateOpenFilesTrustRequest.fire(),this._openFilesTrustRequestPromise}async completeResourcesTrustRequest(e,t){let o=this._resourcesTrustRequestResolvers.get(e);if(!o)return;let n=t===1;await this.workspaceTrustManagementService.setUrisTrust([e],n),o(n),this._resourcesTrustRequestResolvers.delete(e),this._resourcesTrustRequestPromises.delete(e)}async requestResourcesTrust(e){if((await this.workspaceTrustManagementService.getUriTrustInfo(e.uri)).trusted)return!0;let o=this._resourcesTrustRequestPromises.get(e.uri);if(o)return o;let n=new Promise(r=>{this._resourcesTrustRequestResolvers.set(e.uri,r)});return this._resourcesTrustRequestPromises.set(e.uri,n),this._onDidInitiateResourcesTrustRequest.fire(e),n}resolveWorkspaceTrustRequest(e){this._workspaceTrustRequestResolver&&(this._workspaceTrustRequestResolver(e??this.workspaceTrustManagementService.isWorkspaceTrusted()),this._workspaceTrustRequestResolver=void 0,this._workspaceTrustRequestPromise=void 0)}cancelWorkspaceTrustRequest(){this._workspaceTrustRequestResolver&&(this._workspaceTrustRequestResolver(void 0),this._workspaceTrustRequestResolver=void 0,this._workspaceTrustRequestPromise=void 0)}async completeWorkspaceTrustRequest(e){if(e===void 0||e===this.workspaceTrustManagementService.isWorkspaceTrusted()){this.resolveWorkspaceTrustRequest(e);return}U.once(this.workspaceTrustManagementService.onDidChangeTrust)(t=>this.resolveWorkspaceTrustRequest(t)),await this.workspaceTrustManagementService.setWorkspaceTrust(e)}async requestWorkspaceTrust(e){if(this.workspaceTrustManagementService.isWorkspaceTrusted())return this.workspaceTrustManagementService.isWorkspaceTrusted();if(!this._workspaceTrustRequestPromise)this._workspaceTrustRequestPromise=new Promise(t=>{this._workspaceTrustRequestResolver=t});else return this._workspaceTrustRequestPromise;return this._onDidInitiateWorkspaceTrustRequest.fire(e),this._workspaceTrustRequestPromise}requestWorkspaceTrustOnStartup(){this._workspaceTrustRequestPromise||(this._workspaceTrustRequestPromise=new Promise(e=>{this._workspaceTrustRequestResolver=e})),this._onDidInitiateWorkspaceTrustRequestOnStartup.fire()}};mXe=I([m(0,B),m(1,Or)],mXe);var QSi=class extends k{constructor(){super(...arguments);this.participants=new ra}addWorkspaceTrustTransitionParticipant(e){let t=this.participants.push(e);return ee(()=>t())}async participate(e){for(let t of this.participants)await t.participate(e)}dispose(){this.participants.clear(),super.dispose()}},YSi=class{constructor(i){this._acceptsOutOfWorkspaceFilesKey="acceptsOutOfWorkspaceFiles";this._isEmptyWorkspaceTrustedKey="isEmptyWorkspaceTrusted";i?(this._memento=new $l("workspaceTrust",i),this._mementoObject=this._memento.getMemento(1,1)):this._mementoObject={}}get acceptsOutOfWorkspaceFiles(){return this._mementoObject[this._acceptsOutOfWorkspaceFilesKey]??!1}set acceptsOutOfWorkspaceFiles(i){this._mementoObject[this._acceptsOutOfWorkspaceFilesKey]=i,this._memento?.saveMemento()}get isEmptyWorkspaceTrusted(){return this._mementoObject[this._isEmptyWorkspaceTrustedKey]}set isEmptyWorkspaceTrusted(i){this._mementoObject[this._isEmptyWorkspaceTrustedKey]=i,this._memento?.saveMemento()}};Ce(lp,mXe,1);var hm=le("extensionManifestPropertiesService"),ZSi="extensions.supportAgentsWindow",W7o=new Set(["themes","iconThemes","productIconThemes","colors","keybindings","jsonValidation","localizations","grammars","languages"]),fXe=class extends k{constructor(e,t,o,n){super();this.productService=e;this.configurationService=t;this.workspaceTrustEnablementService=o;this.logService=n;this._extensionPointExtensionKindsMap=null;this._productExtensionKindsMap=null;this._configuredExtensionKindsMap=null;this._productVirtualWorkspaceSupportMap=null;this._configuredVirtualWorkspaceSupportMap=null;this._configuredSessionsWindowSupportMap=null;this._configuredExtensionWorkspaceTrustRequestMap=new uu;let r=t.inspect(hAt).userValue||{};for(let s of Object.keys(r))this._configuredExtensionWorkspaceTrustRequestMap.set(s,r[s]);if(this._productExtensionWorkspaceTrustRequestMap=new Map,e.extensionUntrustedWorkspaceSupport)for(let s of Object.keys(e.extensionUntrustedWorkspaceSupport))this._productExtensionWorkspaceTrustRequestMap.set(s,e.extensionUntrustedWorkspaceSupport[s])}canExecuteOnSessionsWindow(e){let t=this.getConfiguredSessionsWindowSupport(e);return t!==void 0?t:e.main||e.browser?!1:Object.keys(e.contributes||{}).every(n=>W7o.has(n))}prefersExecuteOnUI(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="ui"}prefersExecuteOnWorkspace(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="workspace"}prefersExecuteOnWeb(e){let t=this.getExtensionKind(e);return t.length>0&&t[0]==="web"}canExecuteOnUI(e){return this.getExtensionKind(e).some(o=>o==="ui")}canExecuteOnWorkspace(e){return this.getExtensionKind(e).some(o=>o==="workspace")}canExecuteOnWeb(e){return this.getExtensionKind(e).some(o=>o==="web")}getExtensionKind(e){let t=this.deduceExtensionKind(e),o=this.getConfiguredExtensionKind(e);if(o&&o.length>0){let n=[];for(let r of o)r!=="-web"&&n.push(r);return o.includes("-web")&&!n.length&&(n.push("ui"),n.push("workspace")),Ft&&!o.includes("-web")&&!o.includes("web")&&t.includes("web")&&n.push("web"),n}return t}getUserConfiguredExtensionKind(e){if(this._configuredExtensionKindsMap===null){let o=new uu,n=this.configurationService.getValue("remote.extensionKind")||{};for(let r of Object.keys(n))o.set(r,n[r]);this._configuredExtensionKindsMap=o}let t=this._configuredExtensionKindsMap.get(e.id);return t?this.toArray(t):void 0}getExtensionUntrustedWorkspaceSupportType(e){if(!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()||!e.main)return!0;let t=this.getConfiguredExtensionWorkspaceTrustRequest(e),o=this.getProductExtensionWorkspaceTrustRequest(e);return t!==void 0?t:o?.override!==void 0?o.override:e.capabilities?.untrustedWorkspaces?.supported!==void 0?e.capabilities.untrustedWorkspaces.supported:o?.default!==void 0?o.default:!1}getExtensionVirtualWorkspaceSupportType(e){let t=this.getConfiguredVirtualWorkspaceSupport(e);if(t!==void 0)return t;let o=this.getProductVirtualWorkspaceSupport(e);if(o?.override!==void 0)return o.override;let n=e.capabilities?.virtualWorkspaces;if(Xa(n))return n;if(n){let r=n.supported;if(Xa(r)||r==="limited")return r}return o?.default!==void 0?o.default:!0}deduceExtensionKind(e){if(e.main)return e.browser?Ft?["workspace","web"]:["workspace"]:["workspace"];if(e.browser)return["web"];let t=[...Tio];if((Rr(e.extensionPack)||Rr(e.extensionDependencies))&&(t=Ft?["workspace","web"]:["workspace"]),e.contributes)for(let o of Object.keys(e.contributes)){let n=this.getSupportedExtensionKindsForExtensionPoint(o);n.length&&(t=t.filter(r=>n.includes(r)))}return t.length||this.logService.warn("Cannot deduce extensionKind for extension",gf(e.publisher,e.name)),t}getSupportedExtensionKindsForExtensionPoint(e){if(this._extensionPointExtensionKindsMap===null){let o=new Map;zn.getExtensionPoints().forEach(n=>o.set(n.name,n.defaultExtensionKind||[])),this._extensionPointExtensionKindsMap=o}let t=this._extensionPointExtensionKindsMap.get(e);return t||(t=this.productService.extensionPointExtensionKind?this.productService.extensionPointExtensionKind[e]:void 0,t)?t:Ft?["workspace","web"]:["workspace"]}getConfiguredExtensionKind(e){let t={id:gf(e.publisher,e.name)},o=this.getUserConfiguredExtensionKind(t);return typeof o<"u"?this.toArray(o):(o=this.getProductExtensionKind(e),typeof o<"u"?o:(o=e.extensionKind,typeof o<"u"?(o=this.toArray(o),o.filter(n=>["ui","workspace"].includes(n))):null))}getProductExtensionKind(e){if(this._productExtensionKindsMap===null){let o=new uu;if(this.productService.extensionKind)for(let n of Object.keys(this.productService.extensionKind))o.set(n,this.productService.extensionKind[n]);this._productExtensionKindsMap=o}let t=gf(e.publisher,e.name);return this._productExtensionKindsMap.get(t)}getProductVirtualWorkspaceSupport(e){if(this._productVirtualWorkspaceSupportMap===null){let o=new uu;if(this.productService.extensionVirtualWorkspacesSupport)for(let n of Object.keys(this.productService.extensionVirtualWorkspacesSupport))o.set(n,this.productService.extensionVirtualWorkspacesSupport[n]);this._productVirtualWorkspaceSupportMap=o}let t=gf(e.publisher,e.name);return this._productVirtualWorkspaceSupportMap.get(t)}getConfiguredVirtualWorkspaceSupport(e){if(this._configuredVirtualWorkspaceSupportMap===null){let o=new uu,n=this.configurationService.getValue("extensions.supportVirtualWorkspaces")||{};for(let r of Object.keys(n))n[r]!==void 0&&o.set(r,n[r]);this._configuredVirtualWorkspaceSupportMap=o}let t=gf(e.publisher,e.name);return this._configuredVirtualWorkspaceSupportMap.get(t)}getConfiguredSessionsWindowSupport(e){if(this._configuredSessionsWindowSupportMap===null){let o=new uu,n=this.configurationService.getValue(ZSi)||{};for(let r of Object.keys(n))n[r]!==void 0&&o.set(r,n[r]);this._configuredSessionsWindowSupportMap=o}let t=gf(e.publisher,e.name);return this._configuredSessionsWindowSupportMap.get(t)}getConfiguredExtensionWorkspaceTrustRequest(e){let t=gf(e.publisher,e.name),o=this._configuredExtensionWorkspaceTrustRequestMap.get(t);if(o&&(o.version===void 0||o.version===e.version))return o.supported}getProductExtensionWorkspaceTrustRequest(e){let t=gf(e.publisher,e.name);return this._productExtensionWorkspaceTrustRequestMap.get(t)}toArray(e){return Array.isArray(e)?e:e==="ui"?["ui","workspace"]:[e]}};fXe=I([m(0,Ze),m(1,B),m(2,yM),m(3,re)],fXe);Ce(hm,fXe,1);Ge.registerCommand("_remoteCLI.openExternal",function(a,i){return a.get(Je).open(We(i)?i:A.revive(i),{openExternal:!0,allowTunneling:!0})});Ge.registerCommand("_remoteCLI.windowOpen",function(a,i,e){let t=a.get(fe);return i.length?t.executeCommand("_files.windowOpen",i,e):t.executeCommand("_files.newWindow",e)});Ge.registerCommand("_remoteCLI.getSystemStatus",function(a){return a.get(fe).executeCommand("_issues.getSystemStatus")});Ge.registerCommand("_remoteCLI.manageExtensions",async function(a,i){let e=a.get(F),o=a.get($c).remoteExtensionManagementServer?.extensionManagementService;if(!o)return;let n=[],r=new class extends Vwe{log(l,c){n.push(c)}},s=e.createChild(new Po([xs,o]));try{let l=s.createInstance(vXe,r);if(i.list)await l.listExtensions(!!i.list.showVersions,i.list.category,void 0);else{let c=u=>u.map(p=>We(p)?p:A.revive(p));if(Array.isArray(i.install)&&i.install.length)try{await l.installExtensions(c(i.install),[],{isMachineScoped:!0},!!i.force)}catch(u){n.push(u.message)}if(Array.isArray(i.uninstall)&&i.uninstall.length)try{await l.uninstallExtensions(c(i.uninstall),!!i.force,void 0)}catch(u){n.push(u.message)}}return n.join(`
`)}finally{s.dispose()}});var vXe=class extends CDe{constructor(e,t,o,n,r,s,l){super([],e,t,o,l);this._extensionManifestPropertiesService=s;let c=r.remoteAuthority;this._location=c?n.getHostLabel(Q.vscodeRemote,c):void 0}get location(){return this._location}validateExtensionKind(e){return!this._extensionManifestPropertiesService.canExecuteOnWorkspace(e)&&!(Ft&&this._extensionManifestPropertiesService.canExecuteOnWeb(e))?(this.logger.info(d(3908,null,zS(e.publisher,e.name))),!1):!0}};vXe=I([m(1,xs),m(2,ga),m(3,nt),m(4,Mt),m(5,hm),m(6,Ze)],vXe);var gAt=class{constructor(i,e,t){this._clipboardService=e;this._logService=t}dispose(){}$readText(){return this._logService.trace("MainThreadClipboard#readText"),this._clipboardService.readText()}$writeText(i){return this._logService.trace("MainThreadClipboard#writeText with text.length : ",i.length),this._clipboardService.writeText(i)}};gAt=I([fo(Xi.MainThreadClipboard),m(1,Bi),m(2,re)],gAt);var fAt=class{constructor(i,e,t){this._commandService=e;this._extensionService=t;this._commandRegistrations=new Ot;this._proxy=i.getProxy(ao.ExtHostCommands),this._generateCommandsDocumentationRegistration=Ge.registerCommand("_generateCommandsDocumentation",()=>this._generateCommandsDocumentation())}dispose(){this._commandRegistrations.dispose(),this._generateCommandsDocumentationRegistration.dispose()}async _generateCommandsDocumentation(){let i=await this._proxy.$getContributedCommandMetadata(),e=Ge.getCommands();for(let[o,n]of e)n.metadata&&(i[o]=n.metadata);let t=[];for(let o in i)t.push("`"+o+"` - "+V7o(i[o]));console.log(t.join(`
`))}$registerCommand(i){this._commandRegistrations.set(i,Ge.registerCommand(i,(e,...t)=>this._proxy.$executeContributedCommand(i,...t).then(o=>er(o))))}$unregisterCommand(i){this._commandRegistrations.deleteAndDispose(i)}$fireCommandActivationEvent(i){let e=`onCommand:${i}`;this._extensionService.activationEventIsDone(e)||this._extensionService.activateByEvent(e)}async $executeCommand(i,e,t){e instanceof Hg&&(e=e.value);for(let o=0;o<e.length;o++)e[o]=er(e[o]);if(t&&e.length>0&&!Ge.getCommand(i))throw await this._extensionService.activateByEvent(`onCommand:${i}`),new Error("$executeCommand:retry");return this._commandService.executeCommand(i,...e)}$getCommands(){return Promise.resolve([...Ge.getCommands().keys()])}};fAt=I([fo(Xi.MainThreadCommands),m(1,fe),m(2,lt)],fAt);function V7o(a){if(typeof a=="string")return a;{let e=[We(a.description)?a.description:a.description.original];if(e.push(`

`),a.args)for(let t of a.args)e.push(`* _${t.name}_ - ${t.description||""}
`);return a.returns&&e.push(`* _(returns)_ - ${a.returns}`),e.push(`

`),e.join("")}}var vAt=class{constructor(i,e,t,o){this._workspaceContextService=e;this.configurationService=t;this._environmentService=o;let n=i.getProxy(ao.ExtHostConfiguration);n.$initializeConfiguration(this._getConfigurationData()),this._configurationListener=t.onDidChangeConfiguration(r=>{n.$acceptConfigurationChanged(this._getConfigurationData(),r.change)})}_getConfigurationData(){let i={...this.configurationService.getConfigurationData(),configurationScopes:[]};return(!this._environmentService.isBuilt||this._environmentService.isExtensionDevelopment)&&(i.configurationScopes=x6i()),i}dispose(){this._configurationListener.dispose()}$updateConfigurationOption(i,e,t,o,n){return o={resource:o?.resource?A.revive(o.resource):void 0,overrideIdentifier:o?.overrideIdentifier},this.writeConfiguration(i,e,t,o,n)}$removeConfigurationOption(i,e,t,o){return t={resource:t?.resource?A.revive(t.resource):void 0,overrideIdentifier:t?.overrideIdentifier},this.writeConfiguration(i,e,void 0,t,o)}writeConfiguration(i,e,t,o,n){i=i??this.deriveConfigurationTarget(e,o);let r=this.configurationService.inspect(e,o);switch(i){case 8:return this._updateValue(e,t,i,r?.memory?.override,o,n);case 6:return this._updateValue(e,t,i,r?.workspaceFolder?.override,o,n);case 5:return this._updateValue(e,t,i,r?.workspace?.override,o,n);case 4:return this._updateValue(e,t,i,r?.userRemote?.override,o,n);default:return this._updateValue(e,t,i,r?.userLocal?.override,o,n)}}_updateValue(i,e,t,o,n,r){return n=r===!0?n:r===!1?{resource:n.resource}:n.overrideIdentifier&&o!==void 0?n:{resource:n.resource},this.configurationService.updateValue(i,e,n,t,{donotNotifyError:!0})}deriveConfigurationTarget(i,e){if(e.resource&&this._workspaceContextService.getWorkbenchState()===3){let t=oe.as($t.Configuration).getConfigurationProperties();if(t[i]&&(t[i].scope===5||t[i].scope===6))return 6}return 5}};vAt=I([fo(Xi.MainThreadConfiguration),m(1,Ae),m(2,B),m(3,ko)],vAt);function bAt(a){let i=[],e;try{let t=JSON.parse(a.arguments),o=t[t.length-1];o&&o.__$stack&&(t.pop(),e=o.__$stack),i.push(...t)}catch{i.push("Unable to log remote console arguments",a.arguments)}return{args:i,stack:e}}function B7o(a){if(!a)return a;let i=a.indexOf(`
`);return i===-1?a:a.substring(0,i)}function eIi(a,i){let{args:e,stack:t}=bAt(a),o=typeof e[0]=="string"&&e.length===1,n=B7o(t);n&&(n=`(${n.trim()})`);let r=[];if(typeof e[0]=="string"?n&&o?r=[`%c[${i}] %c${e[0]} %c${n}`,EDe("blue"),EDe(""),EDe("grey")]:r=[`%c[${i}] %c${e[0]}`,EDe("blue"),EDe(""),...e.slice(1)]:r=[`%c[${i}]%`,EDe("blue"),...e],n&&!o&&r.push(n),typeof console[a.severity]!="function")throw new Error("Unknown console method");console[a.severity].apply(console,r)}function EDe(a){return`color: ${a}`}function Tlo(a,i,e=null){let t=bAt(i).args,o=t.shift();if(typeof o=="string")switch(i.severity||(i.severity="info"),e&&(/^\[/.test(e)||(e=`[${e}]`),/ $/.test(e)||(e=`${e} `),o=e+o),i.severity){case"log":case"info":a.info(o,...t);break;case"warn":a.warn(o,...t);break;case"error":a.error(o,...t);break}}function _lo(a,i,e){let t=bAt(i).args,o=t.shift();typeof o!="string"||i.severity!=="error"||(/^\[/.test(e)||(e=`[${e}]`),/ $/.test(e)||(e=`${e} `),a.error(e+o,...t))}function $0(a){let i=a.isExtensionDevelopment,e=!0,t=a.extensionDevelopmentLocationURI;if(t)for(let s of t)s.scheme!==Q.file&&(e=!1);let o=e&&typeof a.debugExtensionHost.port=="number",n=e&&!!a.debugExtensionHost.break,r=i&&!!a.extensionTestsLocationURI&&!a.debugExtensionHost.debugId;return{isExtensionDevHost:i,isExtensionDevDebug:o,isExtensionDevDebugBrk:n,isExtensionDevTestFromCli:r}}var SAt=class{constructor(i,e,t){this._environmentService=e;this._logService=t;let o=$0(this._environmentService),n=!this._environmentService.isBuilt&&rSt;this._logAllExtensionHostConsole=o.isExtensionDevTestFromCli||n,this._logExtensionHostConsoleToLocalConsole=!o.isExtensionDevTestFromCli&&!n}dispose(){}$logExtensionHostMessage(i){this._logAllExtensionHostConsole?(Tlo(this._logService,i),this._logExtensionHostConsoleToLocalConsole&&eIi(i,"Extension Host")):(_lo(this._logService,i,"Extension Host"),eIi(i,"Extension Host"))}};SAt=I([fo(Xi.MainThreadConsole),m(1,ko),m(2,re)],SAt);var $g="workbench.view.debug",q2="workbench.debug.variablesView",vE="workbench.debug.watchExpressionsView",O3="workbench.debug.callStackView",Kpe="workbench.debug.loadedScriptsView",bE="workbench.debug.breakPointsView",IAt="workbench.debug.disassemblyView",yAt="workbench.panel.repl",$d="workbench.panel.repl.view",TDe=new Y("debugType",void 0,{type:"string",description:d(11048,null)}),Dlo=new Y("debugConfigurationType",void 0,{type:"string",description:d(11039,null)}),ca=new Y("debugState","inactive",{type:"string",description:d(11047,null)}),tIi="debugUx",aN=new Y(tIi,"default",{type:"string",description:d(11049,null)}),wAt=new Y("hasDebugged",!1,{type:"boolean",description:d(11057,null)}),vl=new Y("inDebugMode",!1,{type:"boolean",description:d(11059,null)}),j0=new Y("inDebugRepl",!1,{type:"boolean",description:d(11060,null)}),bXe=new Y("breakpointWidgetVisible",!1,{type:"boolean",description:d(11029,null)}),iIi=new Y("inBreakpointWidget",!1,{type:"boolean",description:d(11058,null)}),_De=new Y("breakpointsFocused",!0,{type:"boolean",description:d(11027,null)}),SXe=new Y("watchExpressionsFocused",!0,{type:"boolean",description:d(11085,null)}),IXe=new Y("watchExpressionsExist",!1,{type:"boolean",description:d(11084,null)}),CAt=new Y("variablesFocused",!0,{type:"boolean",description:d(11081,null)}),UZ=new Y("expressionSelected",!1,{type:"boolean",description:d(11053,null)}),xAt=new Y("breakpointInputFocused",!1,{type:"boolean",description:d(11023,null)}),ub=new Y("callStackItemType",void 0,{type:"string",description:d(11035,null)}),kAt=new Y("callStackSessionIsAttach",!1,{type:"boolean",description:d(11037,null)}),zZ=new Y("callStackItemStopped",!1,{type:"boolean",description:d(11034,null)}),oIi=new Y("callStackSessionHasOneThread",!1,{type:"boolean",description:d(11036,null)}),Rlo=new Y("callStackFocused",!0,{type:"boolean",description:d(11033,null)}),$2=new Y("watchItemType",void 0,{type:"string",description:d(11086,null)}),KZ=new Y("canViewMemory",void 0,{type:"boolean",description:d(11038,null)}),lR=new Y("breakpointItemType",void 0,{type:"string",description:d(11025,null)}),nIi=new Y("breakpointItemBytes",void 0,{type:"boolean",description:d(11024,null)}),rIi=new Y("breakpointHasModes",!1,{type:"boolean",description:d(11022,null)}),EAt=new Y("breakpointSupportsCondition",!1,{type:"boolean",description:d(11028,null)}),yXe=new Y("loadedScriptsSupported",!1,{type:"boolean",description:d(11065,null)}),Llo=new Y("loadedScriptsItemType",void 0,{type:"string",description:d(11064,null)}),Nx=new Y("focusedSessionIsAttach",!1,{type:"boolean",description:d(11054,null)}),j2=new Y("focusedSessionIsNoDebug",!1,{type:"boolean",description:d(11055,null)}),wXe=new Y("stepBackSupported",!1,{type:"boolean",description:d(11070,null)}),TAt=new Y("restartFrameSupported",!1,{type:"boolean",description:d(11068,null)}),_At=new Y("stackFrameSupportsRestart",!1,{type:"boolean",description:d(11069,null)}),Gpe=new Y("jumpToCursorSupported",!1,{type:"boolean",description:d(11062,null)}),GZ=new Y("stepIntoTargetsSupported",!1,{type:"boolean",description:d(11071,null)}),F3=new Y("breakpointsExist",!1,{type:"boolean",description:d(11026,null)}),qa=new Y("debuggersAvailable",!1,{type:"boolean",description:d(11042,null)}),DAt=new Y("debugExtensionAvailable",!0,{type:"boolean",description:d(11040,null)}),Mlo=new Y("debugProtocolVariableMenuContext",void 0,{type:"string",description:d(11043,null)}),CXe=new Y("debugSetVariableSupported",!1,{type:"boolean",description:d(11046,null)}),DDe=new Y("debugSetDataBreakpointAddressSupported",!1,{type:"boolean",description:d(11044,null)}),xXe=new Y("debugSetExpressionSupported",!1,{type:"boolean",description:d(11045,null)}),Q2=new Y("breakWhenValueChangesSupported",!1,{type:"boolean",description:d(11030,null)}),qZ=new Y("breakWhenValueIsAccessedSupported",!1,{type:"boolean",description:d(11031,null)}),$Z=new Y("breakWhenValueIsReadSupported",!1,{type:"boolean",description:d(11032,null)}),lN=new Y("terminateDebuggeeSupported",!1,{type:"boolean",description:d(11073,null)}),jZ=new Y("suspendDebuggeeSupported",!1,{type:"boolean",description:d(11072,null)}),kXe=new Y("terminateThreadsSupported",!1,{type:"boolean",description:d(11074,null)}),NH=new Y("variableEvaluateNamePresent",!1,{type:"boolean",description:d(11075,null)}),qpe=new Y("variableIsReadonly",!1,{type:"boolean",description:d(11078,null)}),RDe=new Y("variableValue",!1,{type:"string",description:d(11083,null)}),QZ=new Y("variableType",!1,{type:"string",description:d(11082,null)}),Plo=new Y("variableInterfaces",!1,{type:"array",description:d(11077,null)}),RAt=new Y("variableName",!1,{type:"string",description:d(11080,null)}),Alo=new Y("variableLanguage",!1,{type:"string",description:d(11079,null)}),Nlo=new Y("variableExtensionId",!1,{type:"string",description:d(11076,null)}),LAt=new Y("exceptionWidgetVisible",!1,{type:"boolean",description:d(11052,null)}),sIi=new Y("multiSessionRepl",!1,{type:"boolean",description:d(11067,null)}),MAt=new Y("multiSessionDebug",!1,{type:"boolean",description:d(11066,null)}),LDe=new Y("disassembleRequestSupported",!1,{type:"boolean",description:d(11050,null)}),Y2=new Y("disassemblyViewFocus",!1,{type:"boolean",description:d(11051,null)}),PAt=new Y("languageSupportsDisassembleRequest",!1,{type:"boolean",description:d(11063,null)}),AAt=new Y("focusedStackFrameHasInstructionReference",!1,{type:"boolean",description:d(11056,null)}),NAt=a=>d(11041,null,a),OH="editor.contrib.debug",cN="editor.contrib.breakpoint",Ox="debug",OAt={enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart"],default:"openOnFirstSessionStart",description:d(11061,null)};function HM(a){switch(a){case 1:return"initializing";case 2:return"stopped";case 3:return"running";default:return"inactive"}}var $pe="vscode-debug-memory";function X2(a){let i=a.presentationHint??a.source.presentationHint;return i==="deemphasize"||i==="subtle"}function Olo(a){return"type"in a&&"request"in a}var Hi=le("debugService");var H7o;(e=>(e.deserialize=t=>t,e.serialize=t=>t))(H7o||={});var aIi;(e=>(e.deserialize=t=>({id:t.id,name:t.name,iconPath:t.iconPath&&{light:A.revive(t.iconPath.light),dark:A.revive(t.iconPath.dark)},iconClass:t.iconClass,visualization:t.visualization}),e.serialize=t=>t))(aIi||={});var FAt=class{constructor(){this.pendingRequests=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(i){this.messageCallback&&this._onError.fire(new Error("attempt to set more than one 'Message' callback")),this.messageCallback=i}onEvent(i){this.eventCallback&&this._onError.fire(new Error("attempt to set more than one 'Event' callback")),this.eventCallback=i}onRequest(i){this.requestCallback&&this._onError.fire(new Error("attempt to set more than one 'Request' callback")),this.requestCallback=i}sendResponse(i){i.seq>0?this._onError.fire(new Error(`attempt to send more than one response for command ${i.command}`)):this.internalSend("response",i)}sendRequest(i,e,t,o){let n={command:i};if(e&&Object.keys(e).length>0&&(n.arguments=e),this.internalSend("request",n),typeof o=="number"){let r=setTimeout(()=>{clearTimeout(r);let s=this.pendingRequests.get(n.seq);if(s){this.pendingRequests.delete(n.seq);let l={type:"response",seq:0,request_seq:n.seq,success:!1,command:i,message:d(11021,null,o,i)};s(l)}},o)}return t&&this.pendingRequests.set(n.seq,t),n.seq}acceptMessage(i){this.messageCallback?this.messageCallback(i):(this.queue.push(i),this.queue.length===1&&this.processQueue())}needsTaskBoundaryBetween(i,e){return i.type!=="event"||e.type!=="event"}async processQueue(){let i;for(;this.queue.length;){if((!i||this.needsTaskBoundaryBetween(this.queue[0],i))&&await Li(0),i=this.queue.shift(),!i)return;switch(i.type){case"event":this.eventCallback?.(i);break;case"request":this.requestCallback?.(i);break;case"response":{let e=i,t=this.pendingRequests.get(e.request_seq);t&&(this.pendingRequests.delete(e.request_seq),t(e));break}}}}internalSend(i,e){e.type=i,e.seq=this.sequence++,this.sendMessage(e)}async cancelPendingRequests(){if(this.pendingRequests.size===0)return Promise.resolve();let i=new Map;this.pendingRequests.forEach((e,t)=>i.set(t,e)),await Li(500),i.forEach((e,t)=>{e({type:"response",seq:0,request_seq:t,success:!1,command:"canceled",message:"canceled"}),this.pendingRequests.delete(t)})}getPendingRequestIds(){return Array.from(this.pendingRequests.keys())}dispose(){this._onError.dispose(),this._onExit.dispose(),this.queue=[]}};var U7o=/{([^}]+)}/g;function Wlo(a,i,e){return a.replace(U7o,function(t,o){return i&&o.length>0&&o[0]!=="_"?t:e&&e.hasOwnProperty(o)?e[o]:t})}function Vlo(a){let i={};for(let e of Object.keys(a))e.startsWith("!")||(i[e]=a[e]);return i}function jpe(a){return a.configuration.request==="attach"&&!EXe(a)&&(!a.parentSession||jpe(a.parentSession))}function EXe(a){let i=a.configuration.type;if(i)return i==="vslsShare"&&(i=a.configuration.adapterProxy?.configuration?.type||i),xr(i,"extensionhost")||xr(i,"pwa-extensionhost")?a:a.parentSession?EXe(a.parentSession):void 0}function Blo(a){return a.type&&(a.label||a.program||a.runtime)}function z7o(a,i,e){let t,o=0,n=/([^()\[\]{}<>\s+\-/%~#^;=|,`!]|\->)+/g,r=null;for(;r=n.exec(a);){let s=r.index+1,l=s+r[0].length;if(s<=i&&l>=e){t=r[0],o=s;break}}if(t){let s=t.match(/^\.\.\.(.+)/);s&&(t=s[1],o+=3)}if(t){let s=/(\w|\p{L})+/gu,l=null;for(;(l=s.exec(t))&&!(l.index+1+o+l[0].length>=e););l&&(t=t.substring(0,s.lastIndex))}return t?{start:o,end:o+t.length-1}:{start:0,end:0}}async function WAt(a,i,e,t){if(a.evaluatableExpressionProvider.has(i)){let o=a.evaluatableExpressionProvider.ordered(i),n=ui(await Promise.all(o.map(async r=>{try{return await r.provideEvaluatableExpression(i,e,t??Ie.None)}catch{return}})));if(n.length>0){let r=n[0].expression,s=n[0].range;return r||(r=i.getLineContent(e.lineNumber).substring(s.startColumn-1,s.endColumn-1)),{range:s,matchingExpression:r}}}else{let o=i.getLineContent(e.lineNumber),{start:n,end:r}=z7o(o,e.column,e.column),s=o.substring(n-1,r);return{matchingExpression:s,range:new G(e.lineNumber,n,e.lineNumber,n+s.length)}}return null}var K7o=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/;function YZ(a){return!!(a&&a.match(K7o))}function Hlo(a){if(typeof a.path=="string"&&!(typeof a.sourceReference=="number"&&a.sourceReference>0)){if(YZ(a.path))return A.parse(a.path);if(Jl(a.path))return A.file(a.path)}return a.path}function Ulo(a){if(typeof a.path=="object"){let i=A.revive(a.path);if(i)return i.scheme===Q.file?i.fsPath:i.toString()}return a.path}function zlo(a,i){let e=i?Hlo:Ulo,t=io(a);return Glo(t,(o,n)=>{o&&n&&(n.path=e(n))}),t}function Klo(a,i){let e=i?Hlo:Ulo,t=io(a);return Glo(t,(o,n)=>{!o&&n&&(n.path=e(n))}),t}function Glo(a,i){switch(a.type){case"event":{let e=a;switch(e.event){case"output":i(!1,e.body.source);break;case"loadedSource":i(!1,e.body.source);break;case"breakpoint":i(!1,e.body.breakpoint.source);break;default:break}break}case"request":{let e=a;switch(e.command){case"setBreakpoints":i(!0,e.arguments.source);break;case"breakpointLocations":i(!0,e.arguments.source);break;case"source":i(!0,e.arguments.source);break;case"gotoTargets":i(!0,e.arguments.source);break;case"launchVSCode":e.arguments.args.forEach(t=>i(!1,t));break;default:break}break}case"response":{let e=a;if(e.success&&e.body)switch(e.command){case"stackTrace":e.body.stackFrames.forEach(t=>i(!1,t.source));break;case"loadedSources":e.body.sources.forEach(t=>i(!1,t));break;case"scopes":e.body.scopes.forEach(t=>i(!1,t.source));break;case"setFunctionBreakpoints":e.body.breakpoints.forEach(t=>i(!1,t.source));break;case"setBreakpoints":e.body.breakpoints.forEach(t=>i(!1,t.source));break;case"disassemble":e.body?.instructions.forEach(o=>i(!1,o.location));break;case"locations":i(!1,e.body?.source);break;default:break}break}}}function lIi(a){return a.filter(i=>!i.presentation?.hidden).sort((i,e)=>i.presentation?e.presentation?i.presentation.group?e.presentation.group?i.presentation.group!==e.presentation.group?i.presentation.group.localeCompare(e.presentation.group):Flo(i.presentation.order,e.presentation.order):-1:e.presentation.group?1:Flo(i.presentation.order,e.presentation.order):-1:e.presentation?1:0)}function Flo(a,i){return typeof a!="number"?typeof i!="number"?0:1:typeof i!="number"?-1:a-i}async function TXe(a,i){let e=a.getValue("debug.saveBeforeStart",{overrideIdentifier:i.activeTextEditorLanguageId});if(e!=="none"&&(await i.saveAll(),e==="allEditorsInActiveGroup")){let t=i.activeEditorPane;t&&t.input.resource?.scheme===Q.untitled&&await i.save({editor:t.input,groupId:t.group.id})}await a.reloadConfiguration()}var qlo=(a,i)=>!a||!i?a===i:a.name===i.name&&a.path===i.path&&a.sourceReference===i.sourceReference;function VAt(a,i){let e=i.filter(t=>t.parentSession===a);if(e.length>0){let t=e.find(o=>o.state===2);return t||e[0]}return a}function G7o(a,i){switch(i){case 1:return a.windows;case 2:return a.osx;case 3:return a.linux}}function cIi(a,i=Ao){let e=G7o(a,i);return e?{...a,...e,presentation:e.presentation?{...a.presentation,...e.presentation}:a.presentation}:a}function BAt(a,i,e=[]){let t=i.getSession(),o=[[Mlo.key,i.variableMenuContext||""],[NH.key,!!i.evaluateName],[KZ.key,!!t?.capabilities.supportsReadMemoryRequest&&i.memoryReference!==void 0],[qpe.key,!!i.presentationHint?.attributes?.includes("readOnly")||i.presentationHint?.lazy],[QZ.key,i.type],[TDe.key,t?.configuration.type],...e];return a.createOverlay(o)}var HAt=d(11154,null),J2=class{constructor(i,e,t,o){let n;i?(this.raw=i,n=this.raw.path||this.raw.name||"",this.available=!0):(this.raw={name:HAt},this.available=!1,n=`${Ox}:${HAt}`),this.uri=_Xe(this.raw,n,e,t,o)}get name(){return this.raw.name||sl(this.uri)}get origin(){return this.raw.origin}get presentationHint(){return this.raw.presentationHint}get reference(){return this.raw.sourceReference}get inMemory(){return this.uri.scheme===Ox}openInEditor(i,e,t,o,n){return this.available?i.openEditor({resource:this.uri,description:this.origin,options:{preserveFocus:t,selection:e,revealIfOpened:!0,selectionRevealType:1,pinned:n}},o?En:tr):Promise.resolve(void 0)}static getEncodedDebugData(i){let e,t,o;switch(i.scheme){case Q.file:e=Vh(i.fsPath);break;case Ox:if(e=i.path,i.query){let n=i.query.split("&");for(let r of n){let s=r.split("=");if(s.length===2)switch(s[0]){case"session":o=s[1];break;case"ref":t=parseInt(s[1]);break}}}break;default:e=i.toString();break}return{name:sl(i),path:e,sourceReference:t,sessionId:o}}};function _Xe(a,i,e,t,o){let n=r=>typeof a.sourceReference=="number"&&a.sourceReference>0?A.from({scheme:Ox,path:r?.replace(/^\/+/g,"/"),query:`session=${e}&ref=${a.sourceReference}`}):r&&YZ(r)?t.asCanonicalUri(A.parse(r)):r&&Jl(r)?t.asCanonicalUri(A.file(r)):t.asCanonicalUri(A.from({scheme:Ox,path:r,query:`session=${e}`}));try{return n(i)}catch{return o.error("Invalid path from debug adapter: "+i),n("/invalidDebugSource")}}var q7o=Oe("disassembly-editor-label-icon",L.debug,d(11155,null)),UM=class a extends Ls{constructor(){super(...arguments);this.resource=void 0}static{this.ID="debug.disassemblyView.input"}get typeId(){return a.ID}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}getName(){return d(11156,null)}getIcon(){return q7o}matches(e){return e instanceof a}};var Uo=le("textFileService");var UAt=class extends ua{constructor(e,t,o){super(e,10);this.textFileOperationResult=t;this.options=o}static isTextFileOperationError(e){return e instanceof Error&&!mr(e.textFileOperationResult)}};function DXe(a){let i=a;return kvt(i.setEncoding,i.getEncoding,i.save,i.revert,i.isDirty,i.getLanguageId)}function MDe(a){let i=!1;return{read(){return i?null:(i=!0,a)}}}function $lo(a){if(!(typeof a>"u"))return typeof a=="string"?Ke.fromString(a):{read:()=>{let i=a.read();return typeof i=="string"?Ke.fromString(i):null}}}var dN=class a{constructor(i,e,t,o,n=0,r=0,s=void 0,l=0,c=void 0,u=void 0){this.session=i;this.threadId=e;this._reference=t;this.id=o;this.namedVariables=n;this.indexedVariables=r;this.memoryReference=s;this.startOfVariables=l;this.presentationHint=c;this.valueLocationReference=u;this.valueChanged=!1;this._value=""}static{this.allValues=new Map}static{this.BASE_CHUNK_SIZE=100}get reference(){return this._reference}set reference(i){this._reference=i,this.children=void 0}async evaluateLazy(){if(typeof this.reference>"u")return;let i=await this.session.variables(this.reference,this.threadId,void 0,void 0,void 0);if(!i||!i.body||!i.body.variables||i.body.variables.length!==1)return;let e=i.body.variables[0];this.reference=e.variablesReference,this._value=e.value,this.namedVariables=e.namedVariables,this.indexedVariables=e.indexedVariables,this.memoryReference=e.memoryReference,this.presentationHint=e.presentationHint,this.valueLocationReference=e.valueLocationReference,this.adoptLazyResponse(e)}adoptLazyResponse(i){}getChildren(){return this.children||(this.children=this.doGetChildren()),this.children}async doGetChildren(){if(!this.hasChildren)return[];if(!this.getChildrenInChunks)return this.fetchVariables(void 0,void 0,void 0);let i=this.namedVariables?await this.fetchVariables(void 0,void 0,"named"):[],e=a.BASE_CHUNK_SIZE;for(;this.indexedVariables&&this.indexedVariables>e*a.BASE_CHUNK_SIZE;)e*=a.BASE_CHUNK_SIZE;if(this.indexedVariables&&this.indexedVariables>e){let o=Math.ceil(this.indexedVariables/e);for(let n=0;n<o;n++){let r=(this.startOfVariables||0)+n*e,s=Math.min(e,this.indexedVariables-n*e);i.push(new ac(this.session,this.threadId,this,this.reference,`[${r}..${r+s-1}]`,"","",void 0,s,void 0,{kind:"virtual"},void 0,void 0,!0,r))}return i}let t=await this.fetchVariables(this.startOfVariables,this.indexedVariables,"indexed");return i.concat(t)}getId(){return this.id}getSession(){return this.session}get value(){return this._value}get hasChildren(){return!!this.reference&&this.reference>0&&!this.presentationHint?.lazy}async fetchVariables(i,e,t){try{let o=await this.session.variables(this.reference||0,this.threadId,t,i,e);if(!o||!o.body||!o.body.variables)return[];let n=new Map,r=o.body.variables.filter(s=>!!s).map(s=>{if(We(s.value)&&We(s.name)&&typeof s.variablesReference=="number"){let l=n.get(s.name)||0,c=l>0?l.toString():"";return n.set(s.name,l+1),new ac(this.session,this.threadId,this,s.variablesReference,s.name,s.evaluateName,s.value,s.namedVariables,s.indexedVariables,s.memoryReference,s.presentationHint,s.type,s.__vscodeVariableMenuContext,!0,0,c,s.declarationLocationReference,s.valueLocationReference)}return new ac(this.session,this.threadId,this,0,"",void 0,d(11105,null),0,0,void 0,{kind:"virtual"},void 0,void 0,!1)});return this.session.autoExpandLazyVariables&&await Promise.all(r.map(s=>s.presentationHint?.lazy&&s.evaluateLazy())),r}catch(o){return[new ac(this.session,this.threadId,this,0,"",void 0,o.message,0,0,void 0,{kind:"virtual"},void 0,void 0,!1)]}}get getChildrenInChunks(){return!!this.indexedVariables}set value(i){this._value=i,this.valueChanged=!!a.allValues.get(this.getId())&&a.allValues.get(this.getId())!==Fd.DEFAULT_VALUE&&a.allValues.get(this.getId())!==i,a.allValues.set(this.getId(),i)}toString(){return this.value}async evaluateExpression(i,e,t,o,n=!1,r){if(!e||!t&&o!=="repl")return this.value=o==="repl"?d(11110,null):Fd.DEFAULT_VALUE,this.reference=0,!1;this.session=e;try{let s=await e.evaluate(i,t?t.frameId:void 0,o,r);return s&&s.body?(this.value=s.body.result||"",this.reference=s.body.variablesReference,this.namedVariables=s.body.namedVariables,this.indexedVariables=s.body.indexedVariables,this.memoryReference=s.body.memoryReference,this.type=s.body.type||this.type,this.presentationHint=s.body.presentationHint,this.valueLocationReference=s.body.valueLocationReference,!n&&s.body.presentationHint?.lazy&&await this.evaluateLazy(),!0):!1}catch(s){return this.value=s.message||"",this.reference=0,this.memoryReference=void 0,!1}}};function dIi(a,i){i&&i.body&&(a.value=i.body.value||"",a.type=i.body.type||a.type,a.reference=i.body.variablesReference,a.namedVariables=i.body.namedVariables,a.indexedVariables=i.body.indexedVariables,a.memoryReference=i.body.memoryReference,a.valueLocationReference=i.body.valueLocationReference)}var zM=class{constructor(i,e,t,o,n){this.session=i;this.visualizer=e;this.treeId=t;this.treeItem=o;this.original=n;this.id=ht()}evaluateLazy(){return Promise.resolve()}getChildren(){return this.visualizer.getVisualizedChildren(this.session,this.treeId,this.treeItem.id)}getId(){return this.id}get name(){return this.treeItem.label}get value(){return this.treeItem.description||""}get hasChildren(){return this.treeItem.collapsibleState!==0}getSession(){return this.session}async edit(i){try{return await this.visualizer.editTreeItem(this.treeId,this.treeItem,i),!0}catch(e){return this.errorMessage=e.message,!1}}},Fd=class a extends dN{constructor(e,t=ht()){super(void 0,void 0,0,t);this.name=e;this._onDidChangeValue=new T;this.onDidChangeValue=this._onDidChangeValue.event;this.available=!1,e&&(this.value=a.DEFAULT_VALUE)}static{this.DEFAULT_VALUE=d(11106,null)}async evaluate(e,t,o,n,r){let s=this.value===a.DEFAULT_VALUE;this.available=await this.evaluateExpression(this.name,e,t,o,n,r),(s||this.valueChanged)&&this._onDidChangeValue.fire(this)}toString(){return`${this.name}
${this.value}`}toJSON(){return{sessionId:this.getSession()?.getId(),variable:this.toDebugProtocolObject()}}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,memoryReference:this.memoryReference,value:this.value,type:this.type,evaluateName:this.name}}async setExpression(e,t){if(!this.session)return;let o=await this.session.setExpression(t.frameId,this.name,e);dIi(this,o)}},ac=class extends dN{constructor(e,t,o,n,r,s,l,c,u,p,h,g=void 0,f=void 0,v=!0,b=0,S="",y=void 0,w=void 0){super(e,t,n,`variable:${o.getId()}:${r}:${S}`,c,u,p,b,h,w);this.parent=o;this.name=r;this.evaluateName=s;this.variableMenuContext=f;this.available=v;this.declarationLocationReference=y;this.value=l||"",this.type=g}getThreadId(){return this.threadId}async setVariable(e,t){if(this.session)try{if(this.session.capabilities.supportsSetExpression&&!this.session.capabilities.supportsSetVariable&&this.evaluateName)return this.setExpression(e,t);let o=await this.session.setVariable(this.parent.reference,this.name,e);dIi(this,o)}catch(o){this.errorMessage=o.message}}async setExpression(e,t){if(!this.session||!this.evaluateName)return;let o=await this.session.setExpression(t.frameId,this.evaluateName,e);dIi(this,o)}toString(){return this.name?`${this.name}: ${this.value}`:this.value}toJSON(){return{sessionId:this.getSession()?.getId(),container:this.parent instanceof Fd?{expression:this.parent.name}:this.parent.toDebugProtocolObject(),variable:this.toDebugProtocolObject()}}adoptLazyResponse(e){this.evaluateName=e.evaluateName}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,memoryReference:this.memoryReference,value:this.value,type:this.type,evaluateName:this.evaluateName}}},Z2=class extends dN{constructor(e,t,o,n,r,s,l,c){super(e.thread.session,e.thread.threadId,n,`scope:${o}:${t}`,s,l);this.stackFrame=e;this.name=o;this.expensive=r;this.range=c}get childrenHaveBeenLoaded(){return!!this.children}toString(){return this.name}toDebugProtocolObject(){return{name:this.name,variablesReference:this.reference||0,expensive:this.expensive}}},LXe=class extends Z2{constructor(i,e,t){super(i,e,t,0,!1)}toString(){return this.name}},a_=class{constructor(i,e,t,o,n,r,s,l,c){this.thread=i;this.frameId=e;this.source=t;this.name=o;this.presentationHint=n;this.range=r;this.index=s;this.canRestart=l;this.instructionPointerReference=c}getId(){return`stackframe:${this.thread.getId()}:${this.index}:${this.source.name}`}getScopes(){return this.scopes||(this.scopes=this.thread.session.scopes(this.frameId,this.thread.threadId).then(i=>{if(!i||!i.body||!i.body.scopes)return[];let e=new Set;return i.body.scopes.map(t=>{let o=0;do o=xwe(`${t.name}:${t.line}:${t.column}`,o);while(e.has(o));return e.add(o),new Z2(this,o,t.name,t.variablesReference,t.expensive,t.namedVariables,t.indexedVariables,t.line&&t.column&&t.endLine&&t.endColumn?new G(t.line,t.column,t.endLine,t.endColumn):void 0)})},i=>[new LXe(this,0,i.message)])),this.scopes}async getMostSpecificScopes(i){let t=(await this.getScopes()).filter(r=>!r.expensive);if(!t.some(r=>!!r.range))return t;let n=t.filter(r=>r.range&&G.containsRange(r.range,i)).sort((r,s)=>r.range.endLineNumber-r.range.startLineNumber-(s.range.endLineNumber-s.range.startLineNumber));return n.length?n:t}restart(){return this.thread.session.restartFrame(this.frameId,this.thread.threadId)}forgetScopes(){this.scopes=void 0}toString(){let i=typeof this.range.startLineNumber=="number"?`:${this.range.startLineNumber}`:"",e=`${this.source.inMemory?this.source.name:this.source.uri.fsPath}${i}`;return e===HAt?this.name:`${this.name} (${e})`}async openInEditor(i,e,t,o){let n=this.thread.stoppedDetails?.reason;if(this.instructionPointerReference&&(n==="instruction breakpoint"&&!e||n==="step"&&this.thread.lastSteppingGranularity==="instruction"&&!e||i.activeEditor instanceof UM))return i.openEditor(UM.instance,{pinned:!0,revealIfOpened:!0,preserveFocus:e});if(this.source.available)return this.source.openInEditor(i,this.range,e,t,o)}equals(i){return this.name===i.name&&i.thread===this.thread&&this.frameId===i.frameId&&i.source===this.source&&G.equalsRange(this.range,i.range)}},Q7o=["breakpoint","step","function breakpoint"],uN=class{constructor(i,e,t){this.session=i;this.name=e;this.threadId=t;this.callStackCancellationTokens=[];this.reachedEndOfCallStack=!1;this.callStack=[],this.staleCallStack=[],this.stopped=!1}getId(){return`thread:${this.session.getId()}:${this.threadId}`}clearCallStack(){this.callStack.length&&(this.staleCallStack=this.callStack),this.callStack=[],this.callStackCancellationTokens.forEach(i=>i.dispose(!0)),this.callStackCancellationTokens=[]}getCallStack(){return this.callStack}getStaleCallStack(){return this.staleCallStack}getTopStackFrame(){let i=this.getCallStack(),e=this.stoppedDetails?.reason;return i.find(o=>!!((e==="instruction breakpoint"||e==="step"&&this.lastSteppingGranularity==="instruction")&&o.instructionPointerReference||o.source&&o.source.available&&(Q7o.includes(e)||!X2(o))))}get stateLabel(){return this.stoppedDetails?this.stoppedDetails.description||(this.stoppedDetails.reason?d(11108,null,this.stoppedDetails.reason):d(11107,null)):d(11109,null)}async fetchCallStack(i=20){if(this.stopped){let e=this.callStack.length,t=await this.getCallStackImpl(e,i);this.reachedEndOfCallStack=t.length<i,e<this.callStack.length&&this.callStack.splice(e,this.callStack.length-e),this.callStack=this.callStack.concat(t||[]),typeof this.stoppedDetails?.totalFrames=="number"&&this.stoppedDetails.totalFrames===this.callStack.length&&(this.reachedEndOfCallStack=!0)}}async getCallStackImpl(i,e){try{let t=new qe;this.callStackCancellationTokens.push(t);let o=await this.session.stackTrace(this.threadId,i,e,t.token);return!o||!o.body||t.token.isCancellationRequested?[]:(this.stoppedDetails&&(this.stoppedDetails.totalFrames=o.body.totalFrames),o.body.stackFrames.map((n,r)=>{let s=this.session.getSource(n.source);return new a_(this,n.id,s,n.name,n.presentationHint,new G(n.line,n.column,n.endLine||n.line,n.endColumn||n.column),i+r,typeof n.canRestart=="boolean"?n.canRestart:!0,n.instructionPointerReference)}))}catch(t){return this.stoppedDetails&&(this.stoppedDetails.framesErrorMessage=t.message),[]}}get exceptionInfo(){return this.stoppedDetails&&this.stoppedDetails.reason==="exception"?this.session.capabilities.supportsExceptionInfoRequest?this.session.exceptionInfo(this.threadId):Promise.resolve({description:this.stoppedDetails.text,breakMode:null}):Promise.resolve(void 0)}next(i){return this.session.next(this.threadId,i)}stepIn(i){return this.session.stepIn(this.threadId,void 0,i)}stepOut(i){return this.session.stepOut(this.threadId,i)}stepBack(i){return this.session.stepBack(this.threadId,i)}continue(){return this.session.continue(this.threadId)}pause(){return this.session.pause(this.threadId)}terminate(){return this.session.terminateThreads([this.threadId])}reverseContinue(){return this.session.reverseContinue(this.threadId)}},jlo=(a,i,e,t="memory")=>A.from({scheme:$pe,authority:a,path:"/"+encodeURIComponent(i)+`/${encodeURIComponent(t)}.bin`,query:e?`?range=${e.fromOffset}:${e.toOffset}`:void 0}),zAt=class extends k{constructor(e,t){super();this.memoryReference=e;this.session=t;this.invalidateEmitter=this._register(new T);this.onDidInvalidate=this.invalidateEmitter.event;this.writable=!!this.session.capabilities.supportsWriteMemoryRequest,this._register(t.onDidInvalidateMemory(o=>{o.body.memoryReference===e&&this.invalidate(o.body.offset,o.body.count-o.body.offset)}))}async read(e,t){let o=t-e,n=e,r=await this.session.readMemory(this.memoryReference,n,o);if(r===void 0||!r.body?.data)return[{type:1,offset:n,length:o}];let s;try{s=Ws(r.body.data)}catch{return[{type:2,offset:n,length:o,error:"Invalid base64 data from debug adapter"}]}let l=r.body.unreadableBytes||0,c=o-l;if(s.byteLength<c){let u=Ke.alloc(c-s.byteLength);u.buffer.fill(0),s=Ke.concat([s,u],c)}else s.byteLength>c&&(s=s.slice(0,c));return l?[{type:0,offset:n,length:c,data:s},{type:1,offset:n+c,length:l}]:[{type:0,offset:n,length:o,data:s}]}async write(e,t){let n=(await this.session.writeMemory(this.memoryReference,e,gc(t),!0))?.body?.bytesWritten??t.byteLength;return this.invalidate(e,e+n),n}dispose(){super.dispose()}invalidate(e,t){this.invalidateEmitter.fire({fromOffset:e,toOffset:t})}},uIi=class{constructor(i,e){this.enabled=i;this.id=e}getId(){return this.id}};function RXe(a,i){return Cp({supportsConditionalBreakpoints:!!i.supportsConditionalBreakpoints,supportsHitConditionalBreakpoints:!!i.supportsHitConditionalBreakpoints,supportsLogPoints:!!i.supportsLogPoints,supportsFunctionBreakpoints:!!i.supportsFunctionBreakpoints,supportsDataBreakpoints:!!i.supportsDataBreakpoints,supportsInstructionBreakpoints:!!i.supportsInstructionBreakpoints},a)}var Qpe=class extends uIi{constructor(e,t){super(t.enabled??!0,e);this.sessionData=new Map;this.condition=t.condition,this.hitCondition=t.hitCondition,this.logMessage=t.logMessage,this.mode=t.mode,this.modeLabel=t.modeLabel}setSessionData(e,t){t?(t.sessionId=e,this.sessionData.set(e,t)):this.sessionData.delete(e);let o=Array.from(this.sessionData.values()),n=jo(o.filter(r=>r.verified),r=>`${r.line}:${r.column}`);n.length?this.data=n.length===1?n[0]:void 0:this.data=o.length?o[0]:void 0}get message(){if(this.data)return this.data.message}get verified(){return this.data?this.data.verified:!0}get sessionsThatVerified(){let e=[];for(let[t,o]of this.sessionData)o.verified&&e.push(t);return e}getIdFromAdapter(e){let t=this.sessionData.get(e);return t?t.id:void 0}getDebugProtocolBreakpoint(e){let t=this.sessionData.get(e);if(t)return{id:t.id,verified:t.verified,message:t.message,source:t.source,line:t.line,column:t.column,endLine:t.endLine,endColumn:t.endColumn,instructionReference:t.instructionReference,offset:t.offset}}toJSON(){return{id:this.getId(),enabled:this.enabled,condition:this.condition,hitCondition:this.hitCondition,logMessage:this.logMessage,mode:this.mode,modeLabel:this.modeLabel}}},pb=class extends Qpe{constructor(e,t,o,n,r=ht()){super(r,e);this.textFileService=t;this.uriIdentityService=o;this.logService=n;this._uri=e.uri,this._lineNumber=e.lineNumber,this._column=e.column,this._adapterData=e.adapterData,this.triggeredBy=e.triggeredBy}toDAP(){return{line:this.sessionAgnosticData.lineNumber,column:this.sessionAgnosticData.column,condition:this.condition,hitCondition:this.hitCondition,logMessage:this.logMessage,mode:this.mode}}get originalUri(){return this._uri}get lineNumber(){return this.verified&&this.data&&typeof this.data.line=="number"?this.data.line:this._lineNumber}get verified(){return this.data?this.data.verified&&!this.textFileService.isDirty(this._uri):!0}get pending(){return this.data?!1:this.triggeredBy!==void 0}get uri(){return this.verified&&this.data&&this.data.source?_Xe(this.data.source,this.data.source.path,this.data.sessionId,this.uriIdentityService,this.logService):this._uri}get column(){return this.verified&&this.data&&typeof this.data.column=="number"?this.data.column:this._column}get message(){return this.textFileService.isDirty(this.uri)?d(11104,null):super.message}get adapterData(){return this.data&&this.data.source&&this.data.source.adapterData?this.data.source.adapterData:this._adapterData}get endLineNumber(){return this.verified&&this.data?this.data.endLine:void 0}get endColumn(){return this.verified&&this.data?this.data.endColumn:void 0}get sessionAgnosticData(){return{lineNumber:this._lineNumber,column:this._column}}get supported(){return this.data?!(this.logMessage&&!this.data.supportsLogPoints||this.condition&&!this.data.supportsConditionalBreakpoints||this.hitCondition&&!this.data.supportsHitConditionalBreakpoints):!0}setSessionData(e,t){super.setSessionData(e,t),this._adapterData||(this._adapterData=this.adapterData)}toJSON(){return{...super.toJSON(),uri:this._uri,lineNumber:this._lineNumber,column:this._column,adapterData:this.adapterData,triggeredBy:this.triggeredBy}}toString(){return`${sl(this.uri)} ${this.lineNumber}`}setSessionDidTrigger(e,t=!0){t?(this.sessionsDidTrigger??=new Set,this.sessionsDidTrigger.add(e)):this.sessionsDidTrigger?.delete(e)}getSessionDidTrigger(e){return!!this.sessionsDidTrigger?.has(e)}update(e){e.hasOwnProperty("lineNumber")&&!mr(e.lineNumber)&&(this._lineNumber=e.lineNumber),e.hasOwnProperty("column")&&(this._column=e.column),e.hasOwnProperty("condition")&&(this.condition=e.condition),e.hasOwnProperty("hitCondition")&&(this.hitCondition=e.hitCondition),e.hasOwnProperty("logMessage")&&(this.logMessage=e.logMessage),e.hasOwnProperty("mode")&&(this.mode=e.mode,this.modeLabel=e.modeLabel),e.hasOwnProperty("triggeredBy")&&(this.triggeredBy=e.triggeredBy,this.sessionsDidTrigger=void 0)}},QI=class extends Qpe{constructor(i,e=ht()){super(e,i),this.name=i.name}toDAP(){return{name:this.name,condition:this.condition,hitCondition:this.hitCondition}}toJSON(){return{...super.toJSON(),name:this.name}}get supported(){return this.data?this.data.supportsFunctionBreakpoints:!0}toString(){return this.name}},rw=class extends Qpe{constructor(e,t=ht()){super(t,e);this.sessionDataIdForAddr=new WeakMap;this.description=e.description,"dataId"in e&&(e.src={type:0,dataId:e.dataId}),this.src=e.src,this.canPersist=e.canPersist,this.accessTypes=e.accessTypes,this.accessType=e.accessType,e.initialSessionData&&this.sessionDataIdForAddr.set(e.initialSessionData.session,e.initialSessionData.dataId)}async toDAP(e){let t;if(this.src.type===0)t=this.src.dataId;else{let o=this.sessionDataIdForAddr.get(e);if(!o){if(o=(await e.dataBytesBreakpointInfo(this.src.address,this.src.bytes))?.dataId,!o)return;this.sessionDataIdForAddr.set(e,o)}t=o}return{dataId:t,accessType:this.accessType,condition:this.condition,hitCondition:this.hitCondition}}toJSON(){return{...super.toJSON(),description:this.description,src:this.src,accessTypes:this.accessTypes,accessType:this.accessType,canPersist:this.canPersist}}get supported(){return this.data?this.data.supportsDataBreakpoints:!0}toString(){return this.description}},pN=class extends Qpe{constructor(e,t=ht()){super(t,e);this.supportedSessions=new Set;this.fallback=!1;this.filter=e.filter,this.label=e.label,this.supportsCondition=e.supportsCondition,this.description=e.description,this.conditionDescription=e.conditionDescription,this.fallback=e.fallback||!1}toJSON(){return{...super.toJSON(),filter:this.filter,label:this.label,enabled:this.enabled,supportsCondition:this.supportsCondition,conditionDescription:this.conditionDescription,condition:this.condition,fallback:this.fallback,description:this.description}}setSupportedSession(e,t){t?this.supportedSessions.add(e):this.supportedSessions.delete(e)}setFallback(e){this.fallback=e}get supported(){return!0}isSupportedSession(e){return e?this.supportedSessions.has(e):this.fallback}matches(e){return this.filter===e.filter&&this.label===e.label&&this.supportsCondition===!!e.supportsCondition&&this.conditionDescription===e.conditionDescription&&this.description===e.description}toString(){return this.label}},YI=class extends Qpe{constructor(i,e=ht()){super(e,i),this.instructionReference=i.instructionReference,this.offset=i.offset,this.canPersist=i.canPersist,this.address=i.address}toDAP(){return{instructionReference:this.instructionReference,condition:this.condition,hitCondition:this.hitCondition,mode:this.mode,offset:this.offset}}toJSON(){return{...super.toJSON(),instructionReference:this.instructionReference,offset:this.offset,canPersist:this.canPersist,address:this.address}}get supported(){return this.data?this.data.supportsInstructionBreakpoints:!0}toString(){return this.instructionReference}},XZ=class{constructor(i,e){this.sessionId=i;this.threadId=e}getId(){return`${this.sessionId}:${this.threadId}`}},PDe=class extends k{constructor(e,t,o,n){super();this.textFileService=t;this.uriIdentityService=o;this.logService=n;this.schedulers=new Map;this.breakpointsActivated=!0;this._onDidChangeBreakpoints=this._register(new T);this._onDidChangeCallStack=this._register(new T);this._onDidChangeCallStackFire=this._register(new Dt(()=>{this._onDidChangeCallStack.fire(void 0)},100));this._onDidChangeWatchExpressions=this._register(new T);this._onDidChangeWatchExpressionValue=this._register(new T);this._breakpointModes=new Map;this._register(ve(r=>{this.breakpoints=e.breakpoints.read(r),this.functionBreakpoints=e.functionBreakpoints.read(r),this.exceptionBreakpoints=e.exceptionBreakpoints.read(r),this.dataBreakpoints=e.dataBreakpoints.read(r),this._onDidChangeBreakpoints.fire(void 0)})),this._register(ve(r=>{this.watchExpressions=e.watchExpressions.read(r),this._onDidChangeWatchExpressions.fire(void 0)})),this._register(E3i(()=>new Set(this.watchExpressions),this.onDidChangeWatchExpressions,r=>r.onDidChangeValue(s=>this._onDidChangeWatchExpressionValue.fire(s)))),this.instructionBreakpoints=[],this.sessions=[]}getId(){return"root"}getSession(e,t=!1){if(e)return this.getSessions(t).find(o=>o.getId()===e)}getSessions(e=!1){return this.sessions.filter(t=>e||t.state!==0)}addSession(e){this.sessions=this.sessions.filter(n=>n.getId()===e.getId()?!1:n.state===0&&n.configuration.name===e.configuration.name?(n.dispose(),!1):!0);let t=1;for(;this.sessions.some(n=>n.getLabel()===e.getLabel());)e.setName(`${e.configuration.name} ${++t}`);let o=-1;e.parentSession&&(o=this.sessions.findLastIndex(n=>n.parentSession===e.parentSession||n===e.parentSession)),o>=0?this.sessions.splice(o+1,0,e):this.sessions.push(e),this._onDidChangeCallStack.fire(void 0)}get onDidChangeBreakpoints(){return this._onDidChangeBreakpoints.event}get onDidChangeCallStack(){return this._onDidChangeCallStack.event}get onDidChangeWatchExpressions(){return this._onDidChangeWatchExpressions.event}get onDidChangeWatchExpressionValue(){return this._onDidChangeWatchExpressionValue.event}rawUpdate(e){let t=this.sessions.find(o=>o.getId()===e.sessionId);t&&(t.rawUpdate(e),this._onDidChangeCallStack.fire(void 0))}clearThreads(e,t,o=void 0){let n=this.sessions.find(r=>r.getId()===e);if(n){let r;if(o===void 0)r=n.getAllThreads();else{let s=n.getThread(o);r=s!==void 0?[s]:[]}for(let s of r){let l=s.getId(),c=this.schedulers.get(l);c!==void 0&&(c.scheduler.dispose(),c.completeDeferred.complete(),this.schedulers.delete(l))}n.clearThreads(t,o),this._onDidChangeCallStackFire.isScheduled()||this._onDidChangeCallStackFire.schedule()}}async fetchCallstack(e,t){if(e.reachedEndOfCallStack)return;let o=e.stoppedDetails?.totalFrames,n=typeof o=="number"?o-e.getCallStack().length:void 0;(!t||n&&t>n)&&(t=n),t&&t>0&&(await e.fetchCallStack(t),this._onDidChangeCallStack.fire())}refreshTopOfCallstack(e,t=!0){if(e.session.capabilities.supportsDelayedStackTraceLoading){let n=Promise.resolve(),r=new Promise((s,l)=>{n=e.fetchCallStack(1).then(()=>{if(!t){s(),this._onDidChangeCallStack.fire();return}if(!this.schedulers.has(e.getId())){let u=new Mo;this.schedulers.set(e.getId(),{completeDeferred:u,scheduler:new Dt(()=>{e.fetchCallStack(19).then(()=>{let p=e.getStaleCallStack(),h=e.getCallStack(),g=p.length!==h.length;for(let f=1;f<p.length&&!g;f++)g=!p[f].equals(h[f]);g&&this._onDidChangeCallStack.fire()}).finally(()=>{u.complete(),this.schedulers.delete(e.getId())})},420)})}let c=this.schedulers.get(e.getId());c.scheduler.schedule(),c.completeDeferred.p.then(s,l),this._onDidChangeCallStack.fire()})});return{topCallStack:n,wholeCallStack:r}}let o=e.fetchCallStack();return{wholeCallStack:o,topCallStack:o}}getBreakpoints(e){if(e){let t=e.uri?.toString(),o=e.originalUri?.toString();return this.breakpoints.filter(n=>!(t&&n.uri.toString()!==t||o&&n.originalUri.toString()!==o||e.lineNumber&&n.lineNumber!==e.lineNumber||e.column&&n.column!==e.column||e.enabledOnly&&(!this.breakpointsActivated||!n.enabled)||e.triggeredOnly&&n.triggeredBy===void 0))}return this.breakpoints}getFunctionBreakpoints(){return this.functionBreakpoints}getDataBreakpoints(){return this.dataBreakpoints}getExceptionBreakpoints(){return this.exceptionBreakpoints}getExceptionBreakpointsForSession(e){return this.exceptionBreakpoints.filter(t=>t.isSupportedSession(e))}getInstructionBreakpoints(){return this.instructionBreakpoints}setExceptionBreakpointsForSession(e,t){if(!t)return;let o=!1;t.forEach(n=>{let r=this.exceptionBreakpoints.filter(s=>s.matches(n)).pop();r||(o=!0,r=new pN({filter:n.filter,label:n.label,enabled:!!n.default,supportsCondition:!!n.supportsCondition,description:n.description,conditionDescription:n.conditionDescription}),this.exceptionBreakpoints.push(r)),r.setSupportedSession(e,!0)}),o&&this._onDidChangeBreakpoints.fire(void 0)}removeExceptionBreakpointsForSession(e){this.exceptionBreakpoints.forEach(t=>t.setSupportedSession(e,!1))}setExceptionBreakpointFallbackSession(e){this.exceptionBreakpoints.forEach(t=>t.setFallback(t.isSupportedSession(e)))}setExceptionBreakpointCondition(e,t){e.condition=t,this._onDidChangeBreakpoints.fire(void 0)}areBreakpointsActivated(){return this.breakpointsActivated}setBreakpointsActivated(e){this.breakpointsActivated=e,this._onDidChangeBreakpoints.fire(void 0)}addBreakpoints(e,t,o=!0){let n=t.map(r=>new pb({uri:e,lineNumber:r.lineNumber,column:r.column,enabled:r.enabled??!0,condition:r.condition,hitCondition:r.hitCondition,logMessage:r.logMessage,triggeredBy:r.triggeredBy,adapterData:void 0,mode:r.mode,modeLabel:r.modeLabel},this.textFileService,this.uriIdentityService,this.logService,r.id));return this.breakpoints=this.breakpoints.concat(n),this.breakpointsActivated=!0,this.sortAndDeDup(),o&&this._onDidChangeBreakpoints.fire({added:n,sessionOnly:!1}),n}removeBreakpoints(e){this.breakpoints=this.breakpoints.filter(t=>!e.some(o=>o.getId()===t.getId())),this._onDidChangeBreakpoints.fire({removed:e,sessionOnly:!1})}updateBreakpoints(e){let t=[];this.breakpoints.forEach(o=>{let n=e.get(o.getId());n&&(o.update(n),t.push(o))}),this.sortAndDeDup(),this._onDidChangeBreakpoints.fire({changed:t,sessionOnly:!1})}setBreakpointSessionData(e,t,o){this.breakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,RXe(r,t))}}),this.functionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,RXe(r,t))}}),this.dataBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,RXe(r,t))}}),this.exceptionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,RXe(r,t))}}),this.instructionBreakpoints.forEach(n=>{if(!o)n.setSessionData(e,void 0);else{let r=o.get(n.getId());r&&n.setSessionData(e,RXe(r,t))}}),this._onDidChangeBreakpoints.fire({sessionOnly:!0})}getDebugProtocolBreakpoint(e,t){let o=this.breakpoints.find(n=>n.getId()===e);if(o)return o.getDebugProtocolBreakpoint(t)}getBreakpointModes(e){return[...this._breakpointModes.values()].filter(t=>t.appliesTo.includes(e))}registerBreakpointModes(e,t){for(let o of t){let n=`${o.mode}/${o.label}`,r=this._breakpointModes.get(n);if(r)for(let s of o.appliesTo)r.appliesTo.includes(s)||r.appliesTo.push(s);else{let s=[...this._breakpointModes.values()].find(l=>l!==r&&l.label===o.label);s&&(s.label=`${s.label} (${s.firstFromDebugType})`),this._breakpointModes.set(n,{mode:o.mode,label:s?`${o.label} (${e})`:o.label,firstFromDebugType:e,description:o.description,appliesTo:o.appliesTo.slice()})}}}sortAndDeDup(){this.breakpoints=this.breakpoints.sort((e,t)=>e.uri.toString()!==t.uri.toString()?sl(e.uri).localeCompare(sl(t.uri)):e.lineNumber===t.lineNumber?e.column&&t.column?e.column-t.column:1:e.lineNumber-t.lineNumber),this.breakpoints=jo(this.breakpoints,e=>`${e.uri.toString()}:${e.lineNumber}:${e.column}`)}setEnablement(e,t){if(e instanceof pb||e instanceof QI||e instanceof pN||e instanceof rw||e instanceof YI){let o=[];e.enabled!==t&&(e instanceof pb||e instanceof QI||e instanceof rw||e instanceof YI)&&o.push(e),e.enabled=t,t&&(this.breakpointsActivated=!0),this._onDidChangeBreakpoints.fire({changed:o,sessionOnly:!1})}}enableOrDisableAllBreakpoints(e){let t=[];this.breakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.functionBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.dataBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),this.instructionBreakpoints.forEach(o=>{o.enabled!==e&&t.push(o),o.enabled=e}),e&&(this.breakpointsActivated=!0),this._onDidChangeBreakpoints.fire({changed:t,sessionOnly:!1})}addFunctionBreakpoint(e,t){let o=new QI(e,t);return this.functionBreakpoints.push(o),this._onDidChangeBreakpoints.fire({added:[o],sessionOnly:!1}),o}updateFunctionBreakpoint(e,t){let o=this.functionBreakpoints.find(n=>n.getId()===e);o&&(typeof t.name=="string"&&(o.name=t.name),typeof t.condition=="string"&&(o.condition=t.condition),typeof t.hitCondition=="string"&&(o.hitCondition=t.hitCondition),this._onDidChangeBreakpoints.fire({changed:[o],sessionOnly:!1}))}removeFunctionBreakpoints(e){let t;e?(t=this.functionBreakpoints.filter(o=>o.getId()===e),this.functionBreakpoints=this.functionBreakpoints.filter(o=>o.getId()!==e)):(t=this.functionBreakpoints,this.functionBreakpoints=[]),this._onDidChangeBreakpoints.fire({removed:t,sessionOnly:!1})}addDataBreakpoint(e,t){let o=new rw(e,t);this.dataBreakpoints.push(o),this._onDidChangeBreakpoints.fire({added:[o],sessionOnly:!1})}updateDataBreakpoint(e,t){let o=this.dataBreakpoints.find(n=>n.getId()===e);o&&(typeof t.condition=="string"&&(o.condition=t.condition),typeof t.hitCondition=="string"&&(o.hitCondition=t.hitCondition),this._onDidChangeBreakpoints.fire({changed:[o],sessionOnly:!1}))}removeDataBreakpoints(e){let t;e?(t=this.dataBreakpoints.filter(o=>o.getId()===e),this.dataBreakpoints=this.dataBreakpoints.filter(o=>o.getId()!==e)):(t=this.dataBreakpoints,this.dataBreakpoints=[]),this._onDidChangeBreakpoints.fire({removed:t,sessionOnly:!1})}addInstructionBreakpoint(e){let t=new YI(e);this.instructionBreakpoints.push(t),this._onDidChangeBreakpoints.fire({added:[t],sessionOnly:!0})}removeInstructionBreakpoints(e,t,o){let n=[];if(o!==void 0)for(let r=0;r<this.instructionBreakpoints.length;r++){let s=this.instructionBreakpoints[r];s.address===o&&(n.push(s),this.instructionBreakpoints.splice(r--,1))}else if(e)for(let r=0;r<this.instructionBreakpoints.length;r++){let s=this.instructionBreakpoints[r];s.instructionReference===e&&(t===void 0||s.offset===t)&&(n.push(s),this.instructionBreakpoints.splice(r--,1))}else n=this.instructionBreakpoints,this.instructionBreakpoints=[];this._onDidChangeBreakpoints.fire({removed:n,sessionOnly:!1})}getWatchExpressions(){return this.watchExpressions}addWatchExpression(e){let t=new Fd(e||"");return this.watchExpressions.push(t),this._onDidChangeWatchExpressions.fire(t),t}renameWatchExpression(e,t){let o=this.watchExpressions.filter(n=>n.getId()===e);o.length===1&&(o[0].name=t,this._onDidChangeWatchExpressions.fire(o[0]))}removeWatchExpressions(e=null){this.watchExpressions=e?this.watchExpressions.filter(t=>t.getId()!==e):[],this._onDidChangeWatchExpressions.fire(void 0)}moveWatchExpression(e,t){let o=this.watchExpressions.find(n=>n.getId()===e);o&&(this.watchExpressions=this.watchExpressions.filter(n=>n.getId()!==e),this.watchExpressions=this.watchExpressions.slice(0,t).concat(o,this.watchExpressions.slice(t)),this._onDidChangeWatchExpressions.fire(void 0))}sourceIsNotAvailable(e){this.sessions.forEach(t=>{let o=t.getSourceForUri(e);o&&(o.available=!1)}),this._onDidChangeCallStack.fire(void 0)}};PDe=I([m(1,Uo),m(2,gt),m(3,re)],PDe);var JZ=le("debugVisualizerService"),mIi=class{constructor(i,e){this.handle=i;this.viz=e}get name(){return this.viz.name}get iconPath(){return this.viz.iconPath}get iconClass(){return this.viz.iconClass}async resolve(i){return this.viz.visualization??=await this.handle.resolveDebugVisualizer(this.viz,i)}async execute(){await this.handle.executeDebugVisualizerCommand(this.viz.id)}},Qlo={object:[],dispose:()=>{}},ADe=class{constructor(i,e,t){this.contextKeyService=i;this.extensionService=e;this.logService=t;this.handles=new Map;this.trees=new Map;this.didActivate=new Map;this.registrations=[];Y7o.setHandler((o,{added:n,removed:r})=>{this.registrations=this.registrations.filter(s=>!r.some(l=>hi.equals(l.description.identifier,s.extensionId))),n.forEach(s=>this.processExtensionRegistration(s.description))})}async getApplicableFor(i,e){if(!(i instanceof ac))return Qlo;let t=i.getThreadId();if(t===void 0)return Qlo;let o=this.getVariableContext(t,i),n=BAt(this.contextKeyService,i,[[RAt.key,i.name],[RDe.key,i.value],[QZ.key,i.type]]),r=await Promise.all(this.registrations.map(async l=>{if(!n.contextMatchesRules(l.expr))return;let c=this.didActivate.get(l.id);if(c||(c=this.extensionService.activateByEvent(`onDebugVisualizer:${l.id}`),this.didActivate.set(l.id,c)),await c,e.isCancellationRequested)return;let u=this.handles.get(Ylo(l.extensionId,l.id));return u&&{handle:u,result:await u.provideDebugVisualizers(o,e)}})),s={object:r.filter(so).flatMap(l=>l.result.map(c=>new mIi(l.handle,c))),dispose:()=>{for(let l of r)l?.handle.disposeDebugVisualizers(l.result.map(c=>c.id))}};return e.isCancellationRequested&&s.dispose(),s}register(i){let e=Ylo(i.extensionId,i.id);return this.handles.set(e,i),ee(()=>this.handles.delete(e))}registerTree(i,e){return this.trees.set(i,e),ee(()=>this.trees.delete(i))}async getVisualizedNodeFor(i,e){if(!(e instanceof ac))return;let t=e.getThreadId();if(t===void 0)return;let o=this.trees.get(i);if(o)try{let n=await o.getTreeItem(this.getVariableContext(t,e));return n?new zM(e.getSession(),this,i,n,e):void 0}catch(n){this.logService.warn("Failed to get visualized node",n);return}}async getVisualizedChildren(i,e,t){return(await this.trees.get(e)?.getChildren(t)||[]).map(r=>new zM(i,this,e,r,void 0))}async editTreeItem(i,e,t){let o=await this.trees.get(i)?.editItem?.(e.id,t);o&&Object.assign(e,o)}getVariableContext(i,e){let t={sessionId:e.getSession()?.getId()||"",containerId:e.parent instanceof ac?e.reference:void 0,threadId:i,variable:{name:e.name,value:e.value,type:e.type,evaluateName:e.evaluateName,variablesReference:e.reference||0,indexedVariables:e.indexedVariables,memoryReference:e.memoryReference,namedVariables:e.namedVariables,presentationHint:e.presentationHint}};for(let o=e;o instanceof ac;o=o.parent)o.parent instanceof Z2&&(t.frameId=o.parent.stackFrame.frameId);return t}processExtensionRegistration(i){let e=i.contributes?.debugVisualizers;if(e instanceof Array)for(let{when:t,id:o}of e)try{let n=C.deserialize(t);n&&this.registrations.push({expr:n,id:o,extensionId:i.identifier})}catch(n){this.logService.error(`Error processing debug visualizer registration from extension '${i.identifier.value}'`,n)}}};ADe=I([m(0,X),m(1,lt),m(2,re)],ADe);var Ylo=(a,i)=>`${hi.toKey(a)}\0${i}`,Y7o=zn.registerExtensionPoint({extensionPoint:"debugVisualizers",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string",description:"Name of the debug visualizer"},when:{type:"string",description:"Condition when the debug visualizer is applicable"}},required:["id","when"]}},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onDebugVisualizer:${i.id}`)}});var KAt=class{constructor(i,e,t){this.debugService=e;this.visualizerService=t;this._toDispose=new O;this._debugAdaptersHandleCounter=1;this._visualizerHandles=new Map;this._visualizerTreeHandles=new Map;this._proxy=i.getProxy(ao.ExtHostDebugService);let o=new Ot;this._toDispose.add(o),this._toDispose.add(e.onDidNewSession(r=>{this._proxy.$acceptDebugSessionStarted(this.getSessionDto(r)),o.get(r)?.add(r.onDidChangeName(l=>{this._proxy.$acceptDebugSessionNameChanged(this.getSessionDto(r),l)}))})),this._toDispose.add(e.onWillNewSession(r=>{let s=o.get(r);s||(s=new O,o.set(r,s)),s.add(r.onDidCustomEvent(l=>this._proxy.$acceptDebugSessionCustomEvent(this.getSessionDto(r),l)))})),this._toDispose.add(e.onDidEndSession(({session:r,restart:s})=>{this._proxy.$acceptDebugSessionTerminated(this.getSessionDto(r)),this._extHostKnownSessions.delete(r.getId()),s||o.deleteAndDispose(r);for(let[l,c]of this._debugAdapters)c.session===r&&this._debugAdapters.delete(l)})),this._toDispose.add(e.getViewModel().onDidFocusSession(r=>{this._proxy.$acceptDebugSessionActiveChanged(this.getSessionDto(r))})),this._toDispose.add(ee(()=>{for(let[r,s]of this._debugAdapters)s.fireError(r,new Error("Extension host shut down"))})),this._debugAdapters=new Map,this._debugConfigurationProviders=new Map,this._debugAdapterDescriptorFactories=new Map,this._extHostKnownSessions=new Set;let n=this.debugService.getViewModel();this._toDispose.add(U.any(n.onDidFocusStackFrame,n.onDidFocusThread)(()=>{let r=n.focusedStackFrame,s=n.focusedThread;r?this._proxy.$acceptStackFrameFocus({kind:"stackFrame",threadId:r.thread.threadId,frameId:r.frameId,sessionId:r.thread.session.getId()}):s?this._proxy.$acceptStackFrameFocus({kind:"thread",threadId:s.threadId,sessionId:s.session.getId()}):this._proxy.$acceptStackFrameFocus(void 0)})),this.sendBreakpointsAndListen()}$registerDebugVisualizerTree(i,e){this._visualizerTreeHandles.set(i,this.visualizerService.registerTree(i,{disposeItem:t=>this._proxy.$disposeVisualizedTree(t),getChildren:t=>this._proxy.$getVisualizerTreeItemChildren(i,t),getTreeItem:t=>this._proxy.$getVisualizerTreeItem(i,t),editItem:e?((t,o)=>this._proxy.$editVisualizerTreeItem(t,o)):void 0}))}$unregisterDebugVisualizerTree(i){this._visualizerTreeHandles.get(i)?.dispose(),this._visualizerTreeHandles.delete(i)}$registerDebugVisualizer(i,e){let t=this.visualizerService.register({extensionId:new hi(i),id:e,disposeDebugVisualizers:o=>this._proxy.$disposeDebugVisualizers(o),executeDebugVisualizerCommand:o=>this._proxy.$executeDebugVisualizerCommand(o),provideDebugVisualizers:(o,n)=>this._proxy.$provideDebugVisualizers(i,e,o,n).then(r=>r.map(aIi.deserialize)),resolveDebugVisualizer:(o,n)=>this._proxy.$resolveDebugVisualizer(o.id,n)});this._visualizerHandles.set(`${i}/${e}`,t)}$unregisterDebugVisualizer(i,e){let t=`${i}/${e}`;this._visualizerHandles.get(t)?.dispose(),this._visualizerHandles.delete(t)}sendBreakpointsAndListen(){this._toDispose.add(this.debugService.getModel().onDidChangeBreakpoints(o=>{if(o&&!o.sessionOnly){let n={};o.added&&(n.added=this.convertToDto(o.added)),o.removed&&(n.removed=o.removed.map(r=>r.getId())),o.changed&&(n.changed=this.convertToDto(o.changed)),(n.added||n.removed||n.changed)&&this._proxy.$acceptBreakpointsDelta(n)}}));let i=this.debugService.getModel().getBreakpoints(),e=this.debugService.getModel().getFunctionBreakpoints(),t=this.debugService.getModel().getDataBreakpoints();(i.length>0||e.length>0)&&this._proxy.$acceptBreakpointsDelta({added:this.convertToDto(i).concat(this.convertToDto(e)).concat(this.convertToDto(t))})}dispose(){this._toDispose.dispose()}createDebugAdapter(i){let e=this._debugAdaptersHandleCounter++,t=new hIi(this,e,this._proxy,i);return this._debugAdapters.set(e,t),t}substituteVariables(i,e){return Promise.resolve(this._proxy.$substituteVariables(i?i.uri:void 0,e))}runInTerminal(i,e){return this._proxy.$runInTerminal(i,e)}$registerDebugTypes(i){this._toDispose.add(this.debugService.getAdapterManager().registerDebugAdapterFactory(i,this))}$registerBreakpoints(i){for(let e of i)if(e.type==="sourceMulti"){let t=e.lines.map(o=>({id:o.id,enabled:o.enabled,lineNumber:o.line+1,column:o.character>0?o.character+1:void 0,condition:o.condition,hitCondition:o.hitCondition,logMessage:o.logMessage,mode:o.mode}));this.debugService.addBreakpoints(A.revive(e.uri),t)}else e.type==="function"?this.debugService.addFunctionBreakpoint({name:e.functionName,mode:e.mode,condition:e.condition,hitCondition:e.hitCondition,enabled:e.enabled,logMessage:e.logMessage},e.id):e.type==="data"&&this.debugService.addDataBreakpoint({description:e.label,src:{type:0,dataId:e.dataId},canPersist:e.canPersist,accessTypes:e.accessTypes,accessType:e.accessType,mode:e.mode});return Promise.resolve()}$unregisterBreakpoints(i,e,t){return i.forEach(o=>this.debugService.removeBreakpoints(o)),e.forEach(o=>this.debugService.removeFunctionBreakpoints(o)),t.forEach(o=>this.debugService.removeDataBreakpoints(o)),Promise.resolve()}$registerDebugConfigurationProvider(i,e,t,o,n,r){let s={type:i,triggerKind:e};return t&&(s.provideDebugConfigurations=(l,c)=>this._proxy.$provideDebugConfigurations(r,l,c)),o&&(s.resolveDebugConfiguration=(l,c,u)=>this._proxy.$resolveDebugConfiguration(r,l,c,u)),n&&(s.resolveDebugConfigurationWithSubstitutedVariables=(l,c,u)=>this._proxy.$resolveDebugConfigurationWithSubstitutedVariables(r,l,c,u)),this._debugConfigurationProviders.set(r,s),this._toDispose.add(this.debugService.getConfigurationManager().registerDebugConfigurationProvider(s)),Promise.resolve(void 0)}$unregisterDebugConfigurationProvider(i){let e=this._debugConfigurationProviders.get(i);e&&(this._debugConfigurationProviders.delete(i),this.debugService.getConfigurationManager().unregisterDebugConfigurationProvider(e))}$registerDebugAdapterDescriptorFactory(i,e){let t={type:i,createDebugAdapterDescriptor:o=>Promise.resolve(this._proxy.$provideDebugAdapter(e,this.getSessionDto(o)))};return this._debugAdapterDescriptorFactories.set(e,t),this._toDispose.add(this.debugService.getAdapterManager().registerDebugAdapterDescriptorFactory(t)),Promise.resolve(void 0)}$unregisterDebugAdapterDescriptorFactory(i){let e=this._debugAdapterDescriptorFactories.get(i);e&&(this._debugAdapterDescriptorFactories.delete(i),this.debugService.getAdapterManager().unregisterDebugAdapterDescriptorFactory(e))}getSession(i){if(i)return this.debugService.getModel().getSession(i,!0)}async $startDebugging(i,e,t){let o=i?A.revive(i):void 0,n=this.debugService.getConfigurationManager().getLaunch(o),r=this.getSession(t.parentSessionID),s=typeof t.suppressSaveBeforeStart=="boolean"?!t.suppressSaveBeforeStart:void 0,l={noDebug:t.noDebug,parentSession:r,lifecycleManagedByParent:t.lifecycleManagedByParent,repl:t.repl,compact:t.compact,compoundRoot:r?.compoundRoot,saveBeforeRestart:s,testRun:t.testRun,suppressDebugStatusbar:t.suppressDebugStatusbar,suppressDebugToolbar:t.suppressDebugToolbar,suppressDebugView:t.suppressDebugView};try{return this.debugService.startDebugging(n,e,l,s)}catch(c){throw new ka(c&&c.message?c.message:"cannot start debugging")}}$setDebugSessionName(i,e){this.debugService.getModel().getSession(i)?.setName(e)}$customDebugAdapterRequest(i,e,t){let o=this.debugService.getModel().getSession(i,!0);return o?o.customRequest(e,t).then(n=>n&&n.success?n.body:Promise.reject(new ka(n?n.message:"custom request failed"))):Promise.reject(new ka("debug session not found"))}$getDebugProtocolBreakpoint(i,e){let t=this.debugService.getModel().getSession(i,!0);return t?Promise.resolve(t.getDebugProtocolBreakpoint(e)):Promise.reject(new ka("debug session not found"))}$stopDebugging(i){if(i){let e=this.debugService.getModel().getSession(i,!0);if(e)return this.debugService.stopSession(e,jpe(e))}else return this.debugService.stopSession(void 0);return Promise.reject(new ka("debug session not found"))}$appendDebugConsole(i){this.debugService.getViewModel().focusedSession?.appendToRepl({output:i,sev:wt.Warning})}$acceptDAMessage(i,e){this.getDebugAdapter(i).acceptMessage(Klo(e,!1))}$acceptDAError(i,e,t,o){this._debugAdapters.get(i)?.fireError(i,new Error(`${e}: ${t}
${o}`))}$acceptDAExit(i,e,t){this._debugAdapters.get(i)?.fireExit(i,e,t)}getDebugAdapter(i){let e=this._debugAdapters.get(i);if(!e)throw new Error("Invalid debug adapter");return e}$sessionCached(i){this._extHostKnownSessions.add(i)}getSessionDto(i){if(i){let e=i.getId();return this._extHostKnownSessions.has(e)?e:{id:e,type:i.configuration.type,name:i.name,folderUri:i.root?i.root.uri:void 0,configuration:i.configuration,parent:i.parentSession?.getId()}}}convertToDto(i){return i.map(e=>{if("name"in e){let t=e;return{type:"function",id:t.getId(),enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,functionName:t.name}}else if("src"in e){let t=e;return{type:"data",id:t.getId(),dataId:t.src.type===0?t.src.dataId:t.src.address,enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,accessType:t.accessType,label:t.description,canPersist:t.canPersist}}else if("uri"in e){let t=e;return{type:"source",id:t.getId(),enabled:t.enabled,condition:t.condition,hitCondition:t.hitCondition,logMessage:t.logMessage,uri:t.uri,line:t.lineNumber>0?t.lineNumber-1:0,character:typeof t.column=="number"&&t.column>0?t.column-1:0}}else return}).filter(so)}};KAt=I([fo(Xi.MainThreadDebugService),m(1,Hi),m(2,JZ)],KAt);var hIi=class extends FAt{constructor(e,t,o,n){super();this._ds=e;this._handle=t;this._proxy=o;this.session=n}fireError(e,t){this._onError.fire(t)}fireExit(e,t,o){this._onExit.fire(t)}startSession(){return Promise.resolve(this._proxy.$startDASession(this._handle,this._ds.getSessionDto(this.session)))}sendMessage(e){this._proxy.$sendDAMessage(this._handle,zlo(e,!0))}async stopSession(){return await this.cancelPendingRequests(),Promise.resolve(this._proxy.$stopDASession(this._handle))}};var mb=le("IFileDecorationsService");var gIi=class{constructor(i,e){this._proxy=i;this._handle=e;this._idPool=0;this._requests=new Map;this._resolver=new Map}enqueue(i,e){let t=++this._idPool,o=new Mo;this._requests.set(t,{id:t,uri:i}),this._resolver.set(t,o),this._processQueue();let n=e.onCancellationRequested(()=>{this._requests.delete(t),this._resolver.delete(t),o.error(new qi)});return o.p.finally(()=>n.dispose())}_processQueue(){this._timer===void 0&&(this._timer=setTimeout(()=>{let i=this._requests,e=this._resolver;this._proxy.$provideDecorations(this._handle,[...i.values()],Ie.None).then(t=>{for(let[o,n]of e)n.complete(t[o])}),this._requests=new Map,this._resolver=new Map,this._timer=void 0},0))}},GAt=class{constructor(i,e){this._decorationsService=e;this._provider=new Map;this._proxy=i.getProxy(ao.ExtHostDecorations)}dispose(){this._provider.forEach(i=>je(i)),this._provider.clear()}$registerDecorationProvider(i,e){let t=new T,o=new gIi(this._proxy,i),n=this._decorationsService.registerDecorationsProvider({label:e,onDidChange:t.event,provideDecorations:async(r,s)=>{let l=await o.enqueue(r,s);if(!l)return;let[c,u,p,h]=l;return{weight:10,bubble:c??!1,color:h?.id,tooltip:u,letter:p}}});this._provider.set(i,[t,n])}$onDidChange(i,e){let t=this._provider.get(i);if(t){let[o]=t;o.fire(e&&e.map(n=>A.revive(n)))}}$unregisterDecorationProvider(i){let e=this._provider.get(i);e&&(je(e),this._provider.delete(i))}};GAt=I([fo(Xi.MainThreadDecorations),m(1,mb)],GAt);var Ype=class{constructor(i,e,t){this._markerService=e;this._uriIdentService=t;this._activeOwners=new Set;this._proxy=i.getProxy(ao.ExtHostDiagnostics),this._markerListener=this._markerService.onMarkerChanged(this._forwardMarkers,this),this.extHostId=`extHost${Ype.ExtHostCounter++}`}dispose(){this._markerListener.dispose();for(let i of this._activeOwners){let e=new dt;for(let t of this._markerService.read({owner:i})){let o=e.get(t.resource);o===void 0&&(o=[],e.set(t.resource,o)),t.origin!==this.extHostId&&o.push(t)}for(let[t,o]of e.entries())this._markerService.changeOne(i,t,o)}this._activeOwners.clear()}_forwardMarkers(i){let e=[];for(let t of i){let o=this._markerService.read({resource:t,ignoreResourceFilters:!0});if(o.length===0)e.push([t,[]]);else{let n=o.filter(r=>r?.origin!==this.extHostId);n.length>0&&e.push([t,n])}}e.length>0&&this._proxy.$acceptMarkersChange(e)}$changeMany(i,e){for(let t of e){let[o,n]=t;if(n)for(let r of n){if(r.relatedInformation)for(let s of r.relatedInformation)s.resource=A.revive(s.resource);r.code&&typeof r.code!="string"&&(r.code.target=A.revive(r.code.target)),r.origin===void 0&&(r.origin=this.extHostId)}this._markerService.changeOne(i,this._uriIdentService.asCanonicalUri(A.revive(o)),n)}this._activeOwners.add(i)}$clear(i){this._markerService.changeAll(i,[]),this._activeOwners.delete(i)}};Ype.ExtHostCounter=1,Ype=I([fo(Xi.MainThreadDiagnostics),m(1,ha),m(2,gt)],Ype);var Xpe=class{constructor(i,e){this._fileDialogService=e}dispose(){}async $showOpenDialog(i){let e=Xpe._convertOpenOptions(i);return e.defaultUri||(e.defaultUri=await this._fileDialogService.defaultFilePath()),Promise.resolve(this._fileDialogService.showOpenDialog(e))}async $showSaveDialog(i){let e=Xpe._convertSaveOptions(i);return e.defaultUri||(e.defaultUri=await this._fileDialogService.defaultFilePath()),Promise.resolve(this._fileDialogService.showSaveDialog(e))}static _convertOpenOptions(i){let e={openLabel:i?.openLabel||void 0,canSelectFiles:i?.canSelectFiles||!i?.canSelectFiles&&!i?.canSelectFolders,canSelectFolders:i?.canSelectFolders,canSelectMany:i?.canSelectMany,defaultUri:i?.defaultUri?A.revive(i.defaultUri):void 0,title:i?.title||void 0,availableFileSystems:[]};if(i?.filters){e.filters=[];for(let[t,o]of Object.entries(i.filters))e.filters.push({name:t,extensions:o})}return e}static _convertSaveOptions(i){let e={defaultUri:i?.defaultUri?A.revive(i.defaultUri):void 0,saveLabel:i?.saveLabel||void 0,title:i?.title||void 0};if(i?.filters){e.filters=[];for(let[t,o]of Object.entries(i.filters))e.filters.push({name:t,extensions:o})}return e}};Xpe=I([fo(Xi.MainThreadDialogs),m(1,nn)],Xpe);var qAt=class{constructor(i,e,t,o,n){this._textModelResolverService=e;this._languageService=t;this._modelService=o;this._editorWorkerService=n;this._resourceContentProvider=new Ot;this._pendingUpdate=new Map;this._proxy=i.getProxy(ao.ExtHostDocumentContentProviders)}dispose(){this._resourceContentProvider.dispose(),je(this._pendingUpdate.values())}$registerTextContentProvider(i,e){let t=this._textModelResolverService.registerTextModelContentProvider(e,{provideTextContent:o=>this._proxy.$provideTextDocumentContent(i,o).then(n=>{if(typeof n=="string"){let r=n.substr(0,1+n.search(/\r?\n/)),s=this._languageService.createByFilepathOrFirstLine(o,r);return this._modelService.createModel(n,s,o)}return null})});this._resourceContentProvider.set(i,t)}$unregisterTextContentProvider(i){this._resourceContentProvider.deleteAndDispose(i)}async $onVirtualDocumentChange(i,e){let t=this._modelService.getModel(A.revive(i));if(!t)return;this._pendingUpdate.get(t.id)?.cancel();let n=new qe;this._pendingUpdate.set(t.id,n);try{let r=await this._editorWorkerService.computeMoreMinimalEdits(t.uri,[{text:e,range:t.getFullModelRange()}]);if(this._pendingUpdate.delete(t.id),n.token.isCancellationRequested||t.isDisposed())return;r&&r.length>0&&t.applyEdits(r.map(s=>Qn.replace(G.lift(s.range),s.text)))}catch(r){mt(r)}}};qAt=I([fo(Xi.MainThreadDocumentContentProviders),m(1,Bt),m(2,Rt),m(3,_t),m(4,Qs)],qAt);var $a=le("workingCopyService"),fIi=class extends Error{constructor(i,e){super(i),this.name="WorkingCopyLeakError",this.stack=e}},vIi=class a extends k{constructor(){super(...arguments);this._onDidRegister=this._register(new T);this.onDidRegister=this._onDidRegister.event;this._onDidUnregister=this._register(new T);this.onDidUnregister=this._onDidUnregister.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._workingCopies=new Set;this.mapResourceToWorkingCopies=new dt;this.mapWorkingCopyToListeners=this._register(new Ot);this.mapLeakToCounter=new Map}get workingCopies(){return Array.from(this._workingCopies.values())}registerWorkingCopy(e){let t=this.mapResourceToWorkingCopies.get(e.resource);if(t?.has(e.typeId))throw new Error(`Cannot register more than one working copy with the same resource ${e.resource.toString()} and type ${e.typeId}.`);this._workingCopies.add(e),t||(t=new Map,this.mapResourceToWorkingCopies.set(e.resource,t)),t.set(e.typeId,e);let o=new O;o.add(e.onDidChangeContent(()=>this._onDidChangeContent.fire(e))),o.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),o.add(e.onDidSave(r=>this._onDidSave.fire({workingCopy:e,...r}))),this.mapWorkingCopyToListeners.set(e,o),this._onDidRegister.fire(e),e.isDirty()&&this._onDidChangeDirty.fire(e);let n=this.trackLeaks(e);return ee(()=>{n&&this.untrackLeaks(n),this.unregisterWorkingCopy(e),this._onDidUnregister.fire(e)})}unregisterWorkingCopy(e){this._workingCopies.delete(e);let t=this.mapResourceToWorkingCopies.get(e.resource);t?.delete(e.typeId)&&t.size===0&&this.mapResourceToWorkingCopies.delete(e.resource),e.isDirty()&&this._onDidChangeDirty.fire(e),this.mapWorkingCopyToListeners.deleteAndDispose(e)}has(e){return A.isUri(e)?this.mapResourceToWorkingCopies.has(e):this.mapResourceToWorkingCopies.get(e.resource)?.has(e.typeId)??!1}get(e){return this.mapResourceToWorkingCopies.get(e.resource)?.get(e.typeId)}getAll(e){let t=this.mapResourceToWorkingCopies.get(e);if(t)return Array.from(t.values())}static{this.LEAK_TRACKING_THRESHOLD=256}static{this.LEAK_REPORTING_THRESHOLD=2*a.LEAK_TRACKING_THRESHOLD}static{this.LEAK_REPORTED=!1}trackLeaks(e){if(a.LEAK_REPORTED||this._workingCopies.size<a.LEAK_TRACKING_THRESHOLD)return;let t=`${e.resource.scheme}#${e.typeId||"<no typeId>"}
${new Error().stack?.split(`
`).slice(2).join(`
`)??""}`,o=(this.mapLeakToCounter.get(t)??0)+1;if(this.mapLeakToCounter.set(t,o),this._workingCopies.size>a.LEAK_REPORTING_THRESHOLD){a.LEAK_REPORTED=!0;let[n,r]=Array.from(this.mapLeakToCounter.entries()).reduce(([l,c],[u,p])=>p>c?[u,p]:[l,c]),s=`Potential working copy LEAK detected, having ${this._workingCopies.size} working copies already. Most frequent owner (${r})`;mt(new fIi(s,n))}return t}untrackLeaks(e){let t=(this.mapLeakToCounter.get(e)??1)-1;this.mapLeakToCounter.set(e,t),t===0&&this.mapLeakToCounter.delete(e)}get hasDirty(){for(let e of this._workingCopies)if(e.isDirty())return!0;return!1}get dirtyCount(){let e=0;for(let t of this._workingCopies)t.isDirty()&&e++;return e}get dirtyWorkingCopies(){return this.workingCopies.filter(e=>e.isDirty())}get modifiedCount(){let e=0;for(let t of this._workingCopies)t.isModified()&&e++;return e}get modifiedWorkingCopies(){return this.workingCopies.filter(e=>e.isModified())}isDirty(e,t){let o=this.mapResourceToWorkingCopies.get(e);if(o){if(typeof t=="string")return o.get(t)?.isDirty()??!1;for(let[,n]of o)if(n.isDirty())return!0}return!1}};Ce($a,vIi,1);var NDe=class extends k{constructor(e,t){super();this.logService=e;this.configurationService=t;this.participants=new ra}addFileOperationParticipant(e){let t=this.participants.push(e);return ee(()=>t())}async participate(e,t,o,n){let r=this.configurationService.getValue("files.participants.timeout");if(!(typeof r!="number"||r<=0))for(let s of this.participants)try{await s.participate(e,t,o,r,n)}catch(l){this.logService.warn(l)}}dispose(){this.participants.clear(),super.dispose()}};NDe=I([m(0,re),m(1,B)],NDe);var ODe=class extends k{constructor(e,t){super();this.logService=e;this.progressService=t;this.saveParticipants=new ra}get length(){return this.saveParticipants.size}addSaveParticipant(e){let t=this.saveParticipants.push(e);return ee(()=>t())}async participate(e,t,o,n){let r=new qe(n);e.model?.pushStackElement(),o.report({message:d(19661,null)});let s=!1;if(await this.progressService.withProgress({priority:3,location:15,cancellable:d(19662,null),delay:e.isDirty()?5e3:3e3},async l=>{let c=Array.from(this.saveParticipants).sort((u,p)=>{let h=u.ordinal??0,g=p.ordinal??0;return h-g});for(let u of c){if(r.token.isCancellationRequested||e.isDisposed())break;try{let p=u.participate(e,t,l,r.token);await Ea(p,r.token)}catch(p){Yi(p)?r.token.isCancellationRequested||(r.cancel(),s=!0):this.logService.error(p)}}},()=>{r.cancel()}),e.model?.pushStackElement(),r.dispose(),s)throw new qi}dispose(){this.saveParticipants.clear(),super.dispose()}};ODe=I([m(0,re),m(1,Go)],ODe);var gm=le("workingCopyFileService"),MXe=class extends k{constructor(e,t,o,n){super();this.fileService=e;this.workingCopyService=t;this.uriIdentityService=n;this._onWillRunWorkingCopyFileOperation=this._register(new sY);this.onWillRunWorkingCopyFileOperation=this._onWillRunWorkingCopyFileOperation.event;this._onDidFailWorkingCopyFileOperation=this._register(new sY);this.onDidFailWorkingCopyFileOperation=this._onDidFailWorkingCopyFileOperation.event;this._onDidRunWorkingCopyFileOperation=this._register(new sY);this.onDidRunWorkingCopyFileOperation=this._onDidRunWorkingCopyFileOperation.event;this.correlationIds=0;this.workingCopyProviders=[];this.fileOperationParticipants=this._register(o.createInstance(NDe)),this.saveParticipants=this._register(o.createInstance(ODe)),this._register(this.registerWorkingCopyProvider(r=>this.workingCopyService.workingCopies.filter(s=>this.fileService.hasProvider(r)?this.uriIdentityService.extUri.isEqualOrParent(s.resource,r):this.uriIdentityService.extUri.isEqual(s.resource,r))))}create(e,t,o){return this.doCreateFileOrFolder(e,!0,t,o)}createFolder(e,t,o){return this.doCreateFileOrFolder(e,!1,t,o)}async doCreateFileOrFolder(e,t,o,n){if(e.length===0)return[];if(t){let u=(await vn.settled(e.map(p=>this.fileService.canCreateFile(p.resource,{overwrite:p.overwrite})))).find(p=>p instanceof Error);if(u instanceof Error)throw u}let r=e.map(c=>({target:c.resource}));await this.runFileOperationParticipants(r,0,n,o);let s={correlationId:this.correlationIds++,operation:0,files:r};await this._onWillRunWorkingCopyFileOperation.fireAsync(s,Ie.None);let l;try{t?l=await vn.settled(e.map(c=>this.fileService.createFile(c.resource,c.contents,{overwrite:c.overwrite}))):l=await vn.settled(e.map(c=>this.fileService.createFolder(c.resource)))}catch(c){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(s,Ie.None),c}return await this._onDidRunWorkingCopyFileOperation.fireAsync(s,Ie.None),l}async move(e,t,o){return this.doMoveOrCopy(e,!0,t,o)}async copy(e,t,o){return this.doMoveOrCopy(e,!1,t,o)}async doMoveOrCopy(e,t,o,n){let r=[];for(let{file:{source:c,target:u},overwrite:p}of e){let h=await(t?this.fileService.canMove(c,u,p):this.fileService.canCopy(c,u,p));if(h instanceof Error)throw h}let s=e.map(c=>c.file);await this.runFileOperationParticipants(s,t?2:3,n,o);let l={correlationId:this.correlationIds++,operation:t?2:3,files:s};await this._onWillRunWorkingCopyFileOperation.fireAsync(l,Ie.None);try{for(let{file:{source:c,target:u},overwrite:p}of e){if(!this.uriIdentityService.extUri.isEqual(c,u)){let h=t?[...this.getDirty(c),...this.getDirty(u)]:this.getDirty(u);await vn.settled(h.map(g=>g.revert({soft:!0})))}t?r.push(await this.fileService.move(c,u,p)):r.push(await this.fileService.copy(c,u,p))}}catch(c){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(l,Ie.None),c}return await this._onDidRunWorkingCopyFileOperation.fireAsync(l,Ie.None),r}async delete(e,t,o){for(let s of e){let l=await this.fileService.canDelete(s.resource,{recursive:s.recursive,useTrash:s.useTrash});if(l instanceof Error)throw l}let n=e.map(s=>({target:s.resource}));await this.runFileOperationParticipants(n,1,o,t);let r={correlationId:this.correlationIds++,operation:1,files:n};await this._onWillRunWorkingCopyFileOperation.fireAsync(r,Ie.None);for(let s of e){let l=this.getDirty(s.resource);await vn.settled(l.map(c=>c.revert({soft:!0})))}try{for(let s of e)await this.fileService.del(s.resource,{recursive:s.recursive,useTrash:s.useTrash})}catch(s){throw await this._onDidFailWorkingCopyFileOperation.fireAsync(r,Ie.None),s}await this._onDidRunWorkingCopyFileOperation.fireAsync(r,Ie.None)}addFileOperationParticipant(e){return this.fileOperationParticipants.addFileOperationParticipant(e)}runFileOperationParticipants(e,t,o,n){return this.fileOperationParticipants.participate(e,t,o,n)}get hasSaveParticipants(){return this.saveParticipants.length>0}addSaveParticipant(e){return this.saveParticipants.addSaveParticipant(e)}runSaveParticipants(e,t,o,n){return this.saveParticipants.participate(e,t,o,n)}registerWorkingCopyProvider(e){let t=vg(this.workingCopyProviders,e);return ee(t)}getDirty(e){let t=new Set;for(let o of this.workingCopyProviders)for(let n of o(e))n.isDirty()&&t.add(n);return Array.from(t)}};MXe=I([m(0,ge),m(1,$a),m(2,F),m(3,gt)],MXe);Ce(gm,MXe,1);var PXe=class{constructor(i,e=1e3*60*3,t=1024*1024*80,o=50){this._extUri=i;this._maxAge=e;this._maxLength=t;this._maxSize=o;this._data=new Array;this._length=0}dispose(){this._data=je(this._data)}remove(i){for(let e of[...this._data])this._extUri.isEqualOrParent(e.uri,i)&&e.dispose()}add(i,e,t=0){let o=()=>{let s=this._data.indexOf(r);s>=0&&(this._length-=t,e.dispose(),clearTimeout(n),this._data.splice(s,1))},n=setTimeout(o,this._maxAge),r={uri:i,length:t,dispose:o};this._data.push(r),this._length+=t,this._cleanup()}_cleanup(){for(;this._length>this._maxLength;)this._data[0].dispose();let i=Math.ceil(this._maxSize*1.2);this._data.length>=i&&je(this._data.slice(0,i-this._maxSize))}},bIi=class extends k{constructor(e,t,o,n){super();this._model=e;this._onIsCaughtUpWithContentChanges=t;this._proxy=o;this._textFileService=n;this._knownVersionId=this._model.getVersionId(),this._store.add(this._model.onDidChangeContent(r=>{this._knownVersionId=r.versionId,r.detailedReasonsChangeLengths.length!==1&&mt(new Error(`Unexpected reasons: ${r.detailedReasons.map(l=>l.toString())}`));let s={changes:r.changes,isEolChange:r.isEolChange,isUndoing:r.isUndoing,isRedoing:r.isRedoing,isFlush:r.isFlush,eol:r.eol,versionId:r.versionId,detailedReason:r.detailedReasons[0].metadata};this._proxy.$acceptModelChanged(this._model.uri,s,this._textFileService.isDirty(this._model.uri)),this.isCaughtUpWithContentChanges()&&this._onIsCaughtUpWithContentChanges.fire(this._model.uri)}))}isCaughtUpWithContentChanges(){return this._model.getVersionId()===this._knownVersionId}},FDe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._modelService=t;this._textFileService=o;this._fileService=n;this._textModelResolverService=r;this._environmentService=s;this._uriIdentityService=l;this._pathService=u;this._onIsCaughtUpWithContentChanges=this._store.add(new T);this.onIsCaughtUpWithContentChanges=this._onIsCaughtUpWithContentChanges.event;this._modelTrackers=new dt;this._modelReferenceCollection=this._store.add(new PXe(l.extUri)),this._proxy=e.getProxy(ao.ExtHostDocuments),this._store.add(t.onModelLanguageChanged(this._onModelModeChanged,this)),this._store.add(o.files.onDidSave(p=>{this._shouldHandleFileEvent(p.model.resource)&&this._proxy.$acceptModelSaved(p.model.resource)})),this._store.add(o.files.onDidChangeDirty(p=>{this._shouldHandleFileEvent(p.resource)&&this._proxy.$acceptDirtyStateChanged(p.resource,p.isDirty())})),this._store.add(U.any(o.files.onDidChangeEncoding,o.untitled.onDidChangeEncoding)(p=>{if(this._shouldHandleFileEvent(p.resource)){let h=p.getEncoding();h&&this._proxy.$acceptEncodingChanged(p.resource,h)}})),this._store.add(c.onDidRunWorkingCopyFileOperation(p=>{let h=p.operation===2;if(h||p.operation===1)for(let g of p.files){let f=h?g.source:g.target;f&&this._modelReferenceCollection.remove(f)}}))}dispose(){je(this._modelTrackers.values()),this._modelTrackers.clear(),super.dispose()}isCaughtUpWithContentChanges(e){let t=this._modelTrackers.get(e);return t?t.isCaughtUpWithContentChanges():!0}_shouldHandleFileEvent(e){let t=this._modelService.getModel(e);return!!t&&Pk(t)}handleModelAdded(e){Pk(e)&&this._modelTrackers.set(e.uri,new bIi(e,this._onIsCaughtUpWithContentChanges,this._proxy,this._textFileService))}_onModelModeChanged(e){let{model:t}=e;this._modelTrackers.has(t.uri)&&this._proxy.$acceptModelLanguageChanged(t.uri,t.getLanguageId())}handleModelRemoved(e){this._modelTrackers.has(e)&&(this._modelTrackers.get(e).dispose(),this._modelTrackers.delete(e))}async $trySaveDocument(e){return!!await this._textFileService.save(A.revive(e))}async $tryOpenDocument(e,t){let o=A.revive(e);if(!o.scheme||!(o.fsPath||o.authority))throw new ka("Invalid uri. Scheme and authority or path must be set.");let n=this._uriIdentityService.asCanonicalUri(o),r;switch(n.scheme){case Q.untitled:r=this._handleUntitledScheme(n,t);break;case Q.file:default:r=this._handleAsResourceInput(n,t);break}let s;try{s=await r}catch(l){throw new ka(`cannot open ${n.toString()}. Detail: ${Mn(l)}`)}if(s)if(Jn.isEqual(s,n)){if(this._modelTrackers.has(n))return n;throw new ka(`cannot open ${n.toString()}. Detail: Files above 50MB cannot be synchronized with extensions.`)}else throw new ka(`cannot open ${n.toString()}. Detail: Actual document opened as ${s.toString()}`);else throw new ka(`cannot open ${n.toString()}`)}$tryCreateDocument(e){return this._doCreateUntitled(void 0,e)}async _handleAsResourceInput(e,t){if(t?.encoding){let n=await this._textFileService.files.resolve(e,{encoding:t.encoding,reason:2});if(n.isDirty())throw new ka("Cannot re-open a dirty text document with different encoding. Save it first.");await n.setEncoding(t.encoding,1)}let o=await this._textModelResolverService.createModelReference(e);return this._modelReferenceCollection.add(e,o,o.object.textEditorModel.getValueLength()),o.object.textEditorModel.uri}async _handleUntitledScheme(e,t){let o=Nf(e,this._environmentService.remoteAuthority,this._pathService.defaultUriScheme);return await this._fileService.exists(o)?Promise.reject(new Error("file already exists")):await this._doCreateUntitled(e.path?e:void 0,t)}async _doCreateUntitled(e,t){let o=this._textFileService.untitled.create({associatedResource:e,languageId:t?.language,initialValue:t?.content,encoding:t?.encoding});t?.encoding&&await o.setEncoding(t.encoding);let n=o.resource,r=await this._textModelResolverService.createModelReference(n);if(!this._modelTrackers.has(n))throw r.dispose(),new Error(`expected URI ${n.toString()} to have come to LIFE`);return this._modelReferenceCollection.add(n,r,r.object.textEditorModel.getValueLength()),U.once(o.onDidRevert)(()=>this._modelReferenceCollection.remove(n)),this._proxy.$acceptDirtyStateChanged(n,!0),n}};FDe=I([m(1,_t),m(2,Uo),m(3,ge),m(4,Bt),m(5,Mt),m(6,gt),m(7,gm),m(8,Pn)],FDe);var $At=class a{constructor(i,e,t){this.selections=i;this.options=e;this.visibleRanges=t}static readFromEditor(i,e,t){let o=a._readSelectionsFromCodeEditor(i,t),n=a._readOptionsFromCodeEditor(i,e,t),r=a._readVisibleRangesFromCodeEditor(i,t);return new a(o,n,r)}static _readSelectionsFromCodeEditor(i,e){let t=null;return e&&(t=e.getSelections()),!t&&i&&(t=i.selections),t||(t=[new ei(1,1,1,1)]),t}static _readOptionsFromCodeEditor(i,e,t){if(e.isDisposed()){if(i)return i.options;throw new Error("No valid properties")}let o,n;if(t){let s=t.getOptions(),l=s.get(76);o=s.get(34),n=l.renderType}else i?(o=i.options.cursorStyle,n=i.options.lineNumbers):(o=1,n=1);let r=e.getOptions();return{insertSpaces:r.insertSpaces,tabSize:r.tabSize,indentSize:r.indentSize,originalIndentSize:r.originalIndentSize,cursorStyle:o,lineNumbers:n}}static _readVisibleRangesFromCodeEditor(i,e){return e?e.getVisibleRanges():[]}generateDelta(i,e){let t={options:null,selections:null,visibleRanges:null};return(!i||!a._selectionsEqual(i.selections,this.selections))&&(t.selections={selections:this.selections,source:e??void 0}),(!i||!a._optionsEqual(i.options,this.options))&&(t.options=this.options),(!i||!a._rangesEqual(i.visibleRanges,this.visibleRanges))&&(t.visibleRanges=this.visibleRanges),t.selections||t.options||t.visibleRanges?t:null}static _selectionsEqual(i,e){return eo(i,e,(t,o)=>t.equalsSelection(o))}static _rangesEqual(i,e){return eo(i,e,(t,o)=>t.equalsRange(o))}static _optionsEqual(i,e){return i&&!e||!i&&e?!1:!i&&!e?!0:i.tabSize===e.tabSize&&i.indentSize===e.indentSize&&i.insertSpaces===e.insertSpaces&&i.cursorStyle===e.cursorStyle&&i.lineNumbers===e.lineNumbers}},jAt=class{constructor(i,e,t,o,n,r,s){this._modelListeners=new O;this._codeEditorListeners=new O;this._id=i,this._model=e,this._codeEditor=null,this._properties=null,this._focusTracker=o,this._mainThreadDocuments=n,this._modelService=r,this._clipboardService=s,this._onPropertiesChanged=new T,this._modelListeners.add(this._model.onDidChangeOptions(l=>{this._updatePropertiesNow(null)})),this.setCodeEditor(t),this._updatePropertiesNow(null)}dispose(){this._modelListeners.dispose(),this._onPropertiesChanged.dispose(),this._codeEditor=null,this._codeEditorListeners.dispose()}_updatePropertiesNow(i){this._setProperties($At.readFromEditor(this._properties,this._model,this._codeEditor),i)}_setProperties(i,e){let t=i.generateDelta(this._properties,e);this._properties=i,t&&this._onPropertiesChanged.fire(t)}getId(){return this._id}getModel(){return this._model}getCodeEditor(){return this._codeEditor}hasCodeEditor(i){return this._codeEditor===i}setCodeEditor(i){if(!this.hasCodeEditor(i)&&(this._codeEditorListeners.clear(),this._codeEditor=i,this._codeEditor)){this._codeEditorListeners.add(this._codeEditor.onDidChangeModel(()=>{this.setCodeEditor(null)})),this._codeEditorListeners.add(this._codeEditor.onDidFocusEditorWidget(()=>{this._focusTracker.onGainedFocus()})),this._codeEditorListeners.add(this._codeEditor.onDidBlurEditorWidget(()=>{this._focusTracker.onLostFocus()}));let e=null;this._codeEditorListeners.add(this._mainThreadDocuments.onIsCaughtUpWithContentChanges(n=>{if(n.toString()===this._model.uri.toString()){let r=e;e=null,this._updatePropertiesNow(r)}}));let t=()=>this._codeEditor&&this._codeEditor.getModel()===this._model,o=n=>{this._mainThreadDocuments.isCaughtUpWithContentChanges(this._model.uri)?(e=null,this._updatePropertiesNow(n)):e=n};this._codeEditorListeners.add(this._codeEditor.onDidChangeCursorSelection(n=>{t()&&o(n.source)})),this._codeEditorListeners.add(this._codeEditor.onDidChangeConfiguration(n=>{t()&&o(null)})),this._codeEditorListeners.add(this._codeEditor.onDidLayoutChange(()=>{t()&&o(null)})),this._codeEditorListeners.add(this._codeEditor.onDidScrollChange(()=>{t()&&o(null)})),this._updatePropertiesNow(null)}}isVisible(){return!!this._codeEditor}getProperties(){return this._properties}get onPropertiesChanged(){return this._onPropertiesChanged.event}setSelections(i){if(this._codeEditor){this._codeEditor.setSelections(i);return}let e=i.map(ei.liftSelection);this._setProperties(new $At(e,this._properties.options,this._properties.visibleRanges),null)}_setIndentConfiguration(i){let e=this._modelService.getCreationOptions(this._model.getLanguageId(),this._model.uri,this._model.isForSimpleWidget);if(i.tabSize==="auto"||i.insertSpaces==="auto"){let o=e.insertSpaces,n=e.tabSize;i.insertSpaces!=="auto"&&typeof i.insertSpaces<"u"&&(o=i.insertSpaces),i.tabSize!=="auto"&&typeof i.tabSize<"u"&&(n=i.tabSize),this._model.detectIndentation(o,n);return}let t={};typeof i.insertSpaces<"u"&&(t.insertSpaces=i.insertSpaces),typeof i.tabSize<"u"&&(t.tabSize=i.tabSize),typeof i.indentSize<"u"&&(t.indentSize=i.indentSize),this._model.updateOptions(t)}setConfiguration(i){if(this._setIndentConfiguration(i),!!this._codeEditor){if(i.cursorStyle){let e=t6i(i.cursorStyle);this._codeEditor.updateOptions({cursorStyle:e})}if(typeof i.lineNumbers<"u"){let e;switch(i.lineNumbers){case 1:e="on";break;case 2:e="relative";break;case 3:e="interval";break;default:e="off"}this._codeEditor.updateOptions({lineNumbers:e})}}}setDecorations(i,e){this._codeEditor&&this._codeEditor.setDecorationsByType("exthost-api",i,e)}setDecorationsFast(i,e){if(!this._codeEditor)return;let t=[];for(let o=0,n=Math.floor(e.length/4);o<n;o++)t[o]=new G(e[4*o],e[4*o+1],e[4*o+2],e[4*o+3]);this._codeEditor.setDecorationsByTypeFast(i,t)}revealRange(i,e){if(this._codeEditor)switch(e){case 0:this._codeEditor.revealRange(i,0);break;case 1:this._codeEditor.revealRangeInCenter(i,0);break;case 2:this._codeEditor.revealRangeInCenterIfOutsideViewport(i,0);break;case 3:this._codeEditor.revealRangeAtTop(i,0);break;default:console.warn(`Unknown revealType: ${e}`);break}}isFocused(){return this._codeEditor?this._codeEditor.hasTextFocus():!1}matches(i){return i?i.getControl()===this._codeEditor:!1}applyEdits(i,e,t){if(this._model.getVersionId()!==i||!this._codeEditor)return!1;typeof t.setEndOfLine<"u"&&this._model.pushEOL(t.setEndOfLine);let o=e.map(n=>({range:G.lift(n.range),text:n.text,forceMoveMarkers:n.forceMoveMarkers}));return t.undoStopBefore&&this._codeEditor.pushUndoStop(),this._codeEditor.executeEdits("MainThreadTextEditor",o),t.undoStopAfter&&this._codeEditor.pushUndoStop(),!0}async insertSnippet(i,e,t,o){if(!this._codeEditor||!this._codeEditor.hasModel())return!1;let n;if(Og.guessNeedsClipboard(e)){let c=new BK(this._codeEditor,5);if(n=await this._clipboardService.readText(),!c.validate(this._codeEditor))return!1}if(this._codeEditor.getModel().getVersionId()!==i)return!1;let s=ss.get(this._codeEditor);if(!s)return!1;this._codeEditor.focus();let l=t.map(c=>({range:G.lift(c),template:e}));return s.apply(l,{overwriteBefore:0,overwriteAfter:0,undoStopBefore:o.undoStopBefore,undoStopAfter:o.undoStopAfter,adjustWhitespace:!o.keepWhitespace,clipboardText:n}),!0}};function SE(a,i,e=tr){if(e===tr||e===En||e===ff||e===MM)return e;let t=a.getGroups(2)[e];if(!t&&e<9){for(let o=0;o<=e;o++){let n=a.getGroups(2);n[o]||a.addGroup(n[o-1],Zy(i))}t=a.getGroups(2)[e]}return t?.id??En}function Fx(a,i){let e=typeof i=="number"?a.getGroup(i):i;return a.getGroups(2).indexOf(e??a.activeGroup)}var l_=le("quickDiff"),AXe=te("editorGutter.modifiedBackground",{dark:"#1B81A8",light:"#2090D3",hcDark:"#1B81A8",hcLight:"#2090D3"},d(14992,null));te("editorGutter.modifiedSecondaryBackground",{dark:Eu(AXe,.5),light:Bf(AXe,.7),hcDark:"#1B81A8",hcLight:"#2090D3"},d(14993,null));var NXe=te("editorGutter.addedBackground",{dark:"#487E02",light:"#48985D",hcDark:"#487E02",hcLight:"#48985D"},d(14986,null));te("editorGutter.addedSecondaryBackground",{dark:Eu(NXe,.5),light:Bf(NXe,.7),hcDark:"#487E02",hcLight:"#48985D"},d(14987,null));var OXe=te("editorGutter.deletedBackground",$v,d(14988,null));te("editorGutter.deletedSecondaryBackground",{dark:Eu(OXe,.4),light:Bf(OXe,.3),hcDark:"#F48771",hcLight:"#B5200D"},d(14989,null));var WDe=te("minimapGutter.modifiedBackground",AXe,d(14996,null)),VDe=te("minimapGutter.addedBackground",NXe,d(14994,null)),BDe=te("minimapGutter.deletedBackground",OXe,d(14995,null)),ZZ=te("editorOverviewRuler.modifiedForeground",ni(AXe,.6),d(14999,null)),eee=te("editorOverviewRuler.addedForeground",ni(NXe,.6),d(14997,null)),tee=te("editorOverviewRuler.deletedForeground",ni(OXe,.6),d(14998,null)),oqa=te("editorGutter.itemGlyphForeground",{dark:Vd,light:Vd,hcDark:Ue.black,hcLight:Ue.white},d(14991,null)),nqa=te("editorGutter.itemBackground",{dark:w5(bv,Bo),light:Eu(w5(bv,Bo),.05),hcDark:Ue.white,hcLight:Ue.black},d(14990,null));function FXe(a){return a.originalEndLineNumber===0?1:a.modifiedEndLineNumber===0?2:0}function Xlo(a,i){switch(i){case 0:return a.getColor(AXe);case 1:return a.getColor(NXe);case 2:return a.getColor(OXe)}}function QAt(a,i){let e=a.modifiedStartLineNumber-i.modifiedStartLineNumber;return e!==0||(e=a.modifiedEndLineNumber-i.modifiedEndLineNumber,e!==0)||(e=a.originalStartLineNumber-i.originalStartLineNumber,e!==0)?e:a.originalEndLineNumber-i.originalEndLineNumber}function Jlo(a){let i=a.modifiedEndLineNumber-a.modifiedStartLineNumber+1,e=a.originalEndLineNumber-a.originalStartLineNumber+1;return a.originalEndLineNumber===0?i:a.modifiedEndLineNumber===0?e:i+e}function WXe(a){return a.modifiedEndLineNumber===0?a.modifiedStartLineNumber===0?1:a.modifiedStartLineNumber:a.modifiedEndLineNumber}function Zlo(a,i){return a===1&&i.modifiedStartLineNumber===0&&i.modifiedEndLineNumber===0?!0:a>=i.modifiedStartLineNumber&&a<=(i.modifiedEndLineNumber||i.modifiedStartLineNumber)}var Jpe="workbench.view.scm",wv="workbench.scm",YAt="workbench.scm.repositories",mN="workbench.scm.history";var lc=le("scm");var Au=le("scmView");var mu=le("chatEditingService");function iee(a){return new Promise(i=>{uD(e=>{a.state.read(e)!==0&&(e.dispose(),i())})})}function oee(a,i){return{originalURI:a,modifiedURI:i,added:0,removed:0,quitEarly:!1,identical:!1,isFinal:!1,isBusy:!1}}var eG="chat-editing-multi-diff-source",tG=new Y("chatEditingWidgetFileState",void 0,d(9348,null)),eco=new Y("chatEditingAgentSupportsReadonlyReferences",void 0,d(9347,null)),VXe=new Y("decidedChatEditingResource",[]),HDe=new Y("chatEditingResource",void 0),XAt=new Y("inChatEditingSession",void 0),dR=new Y("hasUndecidedChatEditingResource",!1),BXe=new Y("hasAppliedChatEdits",!1),W3=new Y("applyingChatEditsFailed",!1);function tco(a){return typeof a=="object"&&!!a&&yo(a,{sessionResource:!0})}function JAt(a,i){return A.from({scheme:eG,authority:o5(Ke.fromString(a.chatSessionResource.toString())),query:i?"previous":void 0})}function HXe(a){let i=A.parse(wwe(a.authority).toString()),e=a.query==="previous";return{chatSessionResource:i,showPreviousChanges:e}}var Q0=le("IQuickDiffModelService"),X7o={algorithm:"advanced",maxComputationTimeMs:1e3},UXe=class extends ix{constructor(e){super();this._instantiationService=e}createReferencedObject(e,t,o){return this._instantiationService.createInstance(zXe,t,o)}destroyReferencedObject(e,t){t.dispose()}};UXe=I([m(0,F)],UXe);var UDe=class{constructor(i,e,t){this.instantiationService=i;this.textFileService=e;this.uriIdentityService=t;this._references=this.instantiationService.createInstance(UXe)}createQuickDiffModelReference(i,e=X7o){let t=this.textFileService.files.get(i);if(t?.isResolved())return i=this.uriIdentityService.asCanonicalUri(i).with({query:JSON.stringify(e)}),this._references.acquire(i.toString(),t,e)}};UDe=I([m(0,F),m(1,Uo),m(2,gt)],UDe);var zXe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.options=t;this.scmService=o;this.quickDiffService=n;this.editorWorkerService=r;this.configurationService=s;this.textModelResolverService=l;this._chatEditingService=c;this.progressService=u;this.environmentService=p;this._originalEditorModels=new dt;this._originalEditorModelsDisposables=this._register(new O);this._disposed=!1;this._quickDiffs=[];this._diffDelayer=this._register(new Aa(200));this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._allChanges=[];this._changes=[];this._quickDiffChanges=new Map;this._repositoryDisposables=new Ot;this._model=e,this._register(e.textEditorModel.onDidChangeContent(()=>this.triggerDiff())),this._register(U.filter(s.onDidChangeConfiguration,h=>h.affectsConfiguration("scm.diffDecorationsIgnoreTrimWhitespace")||h.affectsConfiguration("diffEditor.ignoreTrimWhitespace"))(this.triggerDiff,this)),this._register(o.onDidAddRepository(this.onDidAddRepository,this));for(let h of o.repositories)this.onDidAddRepository(h);this._register(this._model.onDidChangeEncoding(()=>{this._diffDelayer.cancel(),this._quickDiffs=[],this._originalEditorModels.clear(),this._quickDiffsPromise=void 0,this.setChanges([],[],new Map),this.triggerDiff()})),this._register(this.quickDiffService.onDidChangeQuickDiffProviders(()=>this.triggerDiff())),this._register(ve(h=>{for(let g of this._chatEditingService.editingSessionsObs.read(h))h.store.add(ve(f=>{for(let v of g.entries.read(f))v.state.read(f);this.triggerDiff()}))})),this.triggerDiff()}get originalTextModels(){return yt.map(this._originalEditorModels.values(),e=>e.textEditorModel)}get allChanges(){return this._allChanges}get changes(){return this._changes}get quickDiffChanges(){return this._quickDiffChanges}get quickDiffs(){return this._quickDiffs}getQuickDiffResults(){return this._quickDiffs.map(e=>{let t=this.allChanges.filter(o=>o.providerId===e.id);return{providerId:e.id,providerKind:e.kind,original:e.originalResource,modified:this._model.resource,changes:t.map(o=>o.change),changes2:t.map(o=>o.change2)}})}getDiffEditorModel(e){let t=this._originalEditorModels.get(e);return t?{modified:this._model.textEditorModel,original:t.textEditorModel}:void 0}onDidAddRepository(e){let t=new O;t.add(e.provider.onDidChangeResources(this.triggerDiff,this));let o=U.filter(this.scmService.onDidRemoveRepository,n=>n===e);t.add(o(()=>this._repositoryDisposables.deleteAndDispose(e))),this._repositoryDisposables.set(e,t),this.triggerDiff()}triggerDiff(){this._diffDelayer&&this._diffDelayer.trigger(async()=>{let e=await this.diff(),t=Array.from(this._originalEditorModels.values());!e||this._disposed||this._model.isDisposed()||t.some(o=>o.isDisposed())||this.setChanges(e.allChanges,e.changes,e.mapChanges)}).catch(e=>mt(e))}setChanges(e,t,o){let n=Q5e(this.changes,t,(r,s)=>QAt(r.change,s.change));this._allChanges=e,this._changes=t,this._quickDiffChanges=o,this._onDidChange.fire({changes:t,diff:n})}diff(){let e=this.environmentService.isSessionsWindow?10:3;return this.progressService.withProgress({location:e,delay:250},async()=>{let t=await this.getQuickDiffsPromise();if(this._disposed||this._model.isDisposed()||t.length===0)return Promise.resolve({allChanges:[],changes:[],mapChanges:new Map});let o=t.filter(g=>this.editorWorkerService.canComputeDirtyDiff(g.originalResource,this._model.resource));if(o.length===0)return Promise.resolve({allChanges:[],changes:[],mapChanges:new Map});let n=o.find(g=>g.kind==="primary"),r=this.configurationService.getValue("scm.diffDecorationsIgnoreTrimWhitespace"),s=r==="inherit"?this.configurationService.getValue("diffEditor.ignoreTrimWhitespace"):r!=="false",l=[],c=[];for(let g of o){let f=await this._diff(g.originalResource,this._model.resource,s);if(f.changes&&f.changes2&&f.changes.length===f.changes2.length)for(let v=0;v<f.changes.length;v++){let b=f.changes2[v];if(n&&g.kind==="secondary"){let S=l.find(y=>y.change2.modified.equals(b.modified)&&y.change2.original.length===b.original.length);if(S){let w=this._originalEditorModels.get(n.originalResource)?.textEditorModel?.getValueInRange(S.change2.toRangeMapping().originalRange),E=this._originalEditorModels.get(g.originalResource)?.textEditorModel?.getValueInRange(b.toRangeMapping().originalRange);if(w===E){c.push({providerId:g.id,original:g.originalResource,modified:this._model.resource,change:f.changes[v],change2:f.changes2[v]});continue}}}l.push({providerId:g.id,original:g.originalResource,modified:this._model.resource,change:f.changes[v],change2:f.changes2[v]})}}let u=l.sort((g,f)=>QAt(g.change,f.change)),p=[...l,...c].sort((g,f)=>QAt(g.change,f.change)),h=new Map;for(let g=0;g<u.length;g++){let f=u[g].providerId;h.has(f)||h.set(f,[]),h.get(f).push(g)}return{allChanges:p,changes:u,mapChanges:h}})}async _diff(e,t,o){let n=this.options.maxComputationTimeMs??Number.MAX_SAFE_INTEGER,r=await this.editorWorkerService.computeDiff(e,t,{computeMoves:!1,ignoreTrimWhitespace:o,maxComputationTimeMs:n},this.options.algorithm);return{changes:r?Fdi(Pde.fromDiffResult(r)):null,changes2:r?.changes??null}}getQuickDiffsPromise(){return this._quickDiffsPromise?this._quickDiffsPromise:(this._quickDiffsPromise=this.getOriginalResource().then(async e=>this._disposed?[]:e.length===0?(this._quickDiffs=[],this._originalEditorModels.clear(),[]):eo(this._quickDiffs,e,(t,o)=>t.id===o.id&&t.originalResource.toString()===o.originalResource.toString()&&this.quickDiffService.isQuickDiffProviderVisible(t.id)===this.quickDiffService.isQuickDiffProviderVisible(o.id))?e:(this._quickDiffs=e,this._originalEditorModels.clear(),this._originalEditorModelsDisposables.clear(),(await Promise.all(e.map(async t=>{try{let o=await this.textModelResolverService.createModelReference(t.originalResource);if(this._disposed)return o.dispose(),[];if(this._originalEditorModels.set(t.originalResource,o.object),DXe(o.object)&&!o.object.isDirty()){let n=this._model.getEncoding();n&&o.object.setEncoding(n,1)}return this._originalEditorModelsDisposables.add(o),this._originalEditorModelsDisposables.add(o.object.textEditorModel.onDidChangeContent(()=>this.triggerDiff())),t}catch{return[]}}))).flat())),this._quickDiffsPromise.finally(()=>{this._quickDiffsPromise=void 0}))}async getOriginalResource(){if(this._disposed)return Promise.resolve([]);let e=this._model.resource;if(this._chatEditingService.editingSessionsObs.get().some(n=>n.getEntry(e)?.state.get()===0))return Promise.resolve([]);let o=this._model.textEditorModel?Pk(this._model.textEditorModel):void 0;return this.quickDiffService.getQuickDiffs(e,this._model.getLanguageId(),o)}findNextClosestChange(e,t=!0,o){let n=new Set(this.quickDiffs.filter(r=>this.quickDiffService.isQuickDiffProviderVisible(r.id)).map(r=>r.id));for(let r=0;r<this.changes.length;r++){if(o&&this.changes[r].providerId!==o||!n.has(this.changes[r].providerId))continue;let s=this.changes[r].change;if(t){if(WXe(s)>=e)return r}else if(s.modifiedStartLineNumber>e)return r}return 0}findPreviousClosestChange(e,t=!0,o){let n=new Set(this.quickDiffs.filter(r=>this.quickDiffService.isQuickDiffProviderVisible(r.id)).map(r=>r.id));for(let r=this.changes.length-1;r>=0;r--){if(o&&this.changes[r].providerId!==o||!n.has(this.changes[r].providerId))continue;let s=this.changes[r].change;if(t){if(s.modifiedStartLineNumber<=e)return r}else if(WXe(s)<e)return r}return this.changes.length-1}dispose(){this._disposed=!0,this._quickDiffs=[],this._diffDelayer.cancel(),this._originalEditorModels.clear(),this._repositoryDisposables.dispose(),super.dispose()}};zXe=I([m(2,lc),m(3,l_),m(4,Qs),m(5,B),m(6,Bt),m(7,mu),m(8,Go),m(9,Mt)],zXe);var nee=class{constructor(i,e,t,o,n,r,s,l){this._editorLocator=i;this._codeEditorService=t;this._editorService=o;this._editorGroupService=n;this._configurationService=r;this._quickDiffModelService=s;this._uriIdentityService=l;this._toDispose=new O;this._instanceId=String(++nee.INSTANCE_COUNT),this._proxy=e.getProxy(ao.ExtHostEditors),this._textEditorsListenersMap=Object.create(null),this._editorPositionData=null,this._toDispose.add(this._editorService.onDidVisibleEditorsChange(()=>this._updateActiveAndVisibleTextEditors())),this._toDispose.add(this._editorGroupService.onDidRemoveGroup(()=>this._updateActiveAndVisibleTextEditors())),this._toDispose.add(this._editorGroupService.onDidMoveGroup(()=>this._updateActiveAndVisibleTextEditors())),this._registeredDecorationTypes=Object.create(null)}static{this.INSTANCE_COUNT=0}dispose(){Object.keys(this._textEditorsListenersMap).forEach(i=>{je(this._textEditorsListenersMap[i])}),this._textEditorsListenersMap=Object.create(null),this._toDispose.dispose();for(let i in this._registeredDecorationTypes)this._codeEditorService.removeDecorationType(i);this._registeredDecorationTypes=Object.create(null)}handleTextEditorAdded(i){let e=i.getId(),t=[];t.push(i.onPropertiesChanged(n=>{this._proxy.$acceptEditorPropertiesChanged(e,n)}));let o=this._getTextEditorDiffInformation(i,t);t.push(ve(n=>{let r=o.read(n);this._proxy.$acceptEditorDiffInformation(e,r)})),this._textEditorsListenersMap[e]=t}handleTextEditorRemoved(i){je(this._textEditorsListenersMap[i]),delete this._textEditorsListenersMap[i]}_updateActiveAndVisibleTextEditors(){let i=this._getTextEditorPositionData();Qi(this._editorPositionData,i)||(this._editorPositionData=i,this._proxy.$acceptEditorPositionData(this._editorPositionData))}_getTextEditorPositionData(){let i=Object.create(null);for(let e of this._editorService.visibleEditorPanes){let t=this._editorLocator.findTextEditorIdFor(e);t&&(i[t]=Fx(this._editorGroupService,e.group))}return i}_getTextEditorDiffInformation(i,e){let t=i.getCodeEditor();if(!t)return Fo(void 0);let[o]=this._codeEditorService.listDiffEditors().filter(s=>s.getOriginalEditor().getId()===t.getId()||s.getModifiedEditor().getId()===t.getId()),n=o?vi(this,o.onDidChangeModel,()=>o.getModel()):vi(this,t.onDidChangeModel,()=>t.getModel()),r=ke(s=>{let l=n.read(s);if(!l)return Fo(void 0);if(VY(l)){let p=this._quickDiffModelService.createQuickDiffModelReference(l.uri);return p?(e.push(p),vi(this,p.object.onDidChange,()=>p.object.getQuickDiffResults().map(h=>({original:h.original,modified:h.modified,changes:h.changes2})))):Fo(void 0)}let c=this._configurationService.getValue("diffEditor.diffAlgorithm"),u=this._quickDiffModelService.createQuickDiffModelReference(l.modified.uri,{algorithm:c});return u?(e.push(u),vi(U.any(u.object.onDidChange,o.onDidUpdateDiff),()=>{let p=o.getDiffComputationResult()?.changes2??[],h=[{original:l.original.uri,modified:l.modified.uri,changes:p.map(f=>f)}],g=u.object.getQuickDiffResults().filter(f=>f.providerKind!=="primary").map(f=>({original:f.original,modified:f.modified,changes:f.changes2}));return h.concat(g)})):Fo(void 0)});return Js({owner:this,equalsFn:(s,l)=>eo(s,l,(c,u)=>N6i(this._uriIdentityService,c,u))},s=>{let l=n.read(s),c=r.read(s).read(s);if(!l||!c)return;let u=VY(l)?l.getVersionId():l.modified.getVersionId();return c.map(p=>{let h=p.changes.map(g=>[g.original.startLineNumber,g.original.endLineNumberExclusive,g.modified.startLineNumber,g.modified.endLineNumberExclusive]);return{documentVersion:u,original:p.original,modified:p.modified,changes:h}})})}async $tryShowTextDocument(i,e){let t=A.revive(i),o={preserveFocus:e.preserveFocus,pinned:e.pinned,selection:e.selection,activation:e.preserveFocus?2:void 0,override:1},n={resource:t,options:o},r=await this._editorService.openEditor(n,SE(this._editorGroupService,this._configurationService,e.position));if(!r)return;let s=r.getControl(),l=da(s);return l?this._editorLocator.getIdOfCodeEditor(l):void 0}async $tryShowEditor(i,e){let t=this._editorLocator.getEditor(i);if(t){let o=t.getModel();await this._editorService.openEditor({resource:o.uri,options:{preserveFocus:!1}},SE(this._editorGroupService,this._configurationService,e));return}}async $tryHideEditor(i){let e=this._editorLocator.getEditor(i);if(e){let t=this._editorService.visibleEditorPanes;for(let o of t)if(e.matches(o)){await o.group.closeEditor(o.input);return}}}$trySetSelections(i,e){let t=this._editorLocator.getEditor(i);return t?(t.setSelections(e),Promise.resolve(void 0)):Promise.reject(ls(`TextEditor(${i})`))}$trySetDecorations(i,e,t){e=`${this._instanceId}-${e}`;let o=this._editorLocator.getEditor(i);return o?(o.setDecorations(e,t),Promise.resolve(void 0)):Promise.reject(ls(`TextEditor(${i})`))}$trySetDecorationsFast(i,e,t){e=`${this._instanceId}-${e}`;let o=this._editorLocator.getEditor(i);return o?(o.setDecorationsFast(e,t),Promise.resolve(void 0)):Promise.reject(ls(`TextEditor(${i})`))}$tryRevealRange(i,e,t){let o=this._editorLocator.getEditor(i);return o?(o.revealRange(e,t),Promise.resolve()):Promise.reject(ls(`TextEditor(${i})`))}$trySetOptions(i,e){let t=this._editorLocator.getEditor(i);return t?(t.setConfiguration(e),Promise.resolve(void 0)):Promise.reject(ls(`TextEditor(${i})`))}$tryApplyEdits(i,e,t,o){let n=this._editorLocator.getEditor(i);return n?Promise.resolve(n.applyEdits(e,t,o)):Promise.reject(ls(`TextEditor(${i})`))}$tryInsertSnippet(i,e,t,o,n){let r=this._editorLocator.getEditor(i);return r?Promise.resolve(r.insertSnippet(e,t,o,n)):Promise.reject(ls(`TextEditor(${i})`))}$registerTextEditorDecorationType(i,e,t){e=`${this._instanceId}-${e}`,this._registeredDecorationTypes[e]=!0,this._codeEditorService.registerDecorationType(`exthost-api-${i}`,e,t)}$removeTextEditorDecorationType(i){i=`${this._instanceId}-${i}`,delete this._registeredDecorationTypes[i],this._codeEditorService.removeDecorationType(i)}$getDiffInformation(i){let e=this._editorLocator.getEditor(i);if(!e)return Promise.reject(new Error("No such TextEditor"));let t=e.getCodeEditor();if(!t)return Promise.reject(new Error("No such CodeEditor"));let o=t.getId(),n=this._codeEditorService.listDiffEditors(),[r]=n.filter(l=>l.getOriginalEditor().getId()===o||l.getModifiedEditor().getId()===o);if(r)return Promise.resolve(r.getLineChanges()||[]);if(!t.hasModel())return Promise.resolve([]);let s=this._quickDiffModelService.createQuickDiffModelReference(t.getModel().uri);if(!s)return Promise.resolve([]);try{let l=s.object.quickDiffs.find(u=>u.kind==="primary"),c=s.object.changes.filter(u=>u.providerId===l?.id);return Promise.resolve(c.map(u=>u.change)??[])}finally{s.dispose()}}};nee=I([m(2,Qt),m(3,ie),m(4,kt),m(5,B),m(6,Q0),m(7,gt)],nee);Ge.registerCommand("_workbench.revertAllDirty",async function(a){if(!a.get(ko).extensionTestsLocationURI)throw new Error("Command is only available when running extension tests.");let e=a.get($a);for(let t of e.dirtyWorkingCopies)await t.revert({soft:!0})});var os=class a{constructor(i,e,t){this.ctor=i;this.typeId=e;this.name=t}static{this.instantiatedEditorPanes=new Set}static didInstantiateEditorPane(i){return a.instantiatedEditorPanes.has(i)}static{this._onWillInstantiateEditorPane=new T}static{this.onWillInstantiateEditorPane=a._onWillInstantiateEditorPane.event}static create(i,e,t){return new a(i,e,t)}instantiate(i,e){a._onWillInstantiateEditorPane.fire({typeId:this.typeId});let t=i.createInstance(this.ctor,e);return a.instantiatedEditorPanes.add(this.typeId),t}describes(i){return i.getId()===this.typeId}},yIi=class{constructor(){this.mapEditorPanesToEditors=new Map}registerEditorPane(i,e){return this.mapEditorPanesToEditors.set(i,e),ee(()=>{this.mapEditorPanesToEditors.delete(i)})}getEditorPane(i){let e=this.findEditorPaneDescriptors(i);if(e.length!==0)return e.length===1?e[0]:i.prefersEditorPane(e)}findEditorPaneDescriptors(i,e){let t=[];for(let o of this.mapEditorPanesToEditors.keys()){let n=this.mapEditorPanesToEditors.get(o)||[];for(let r of n){let s=r.ctor;if(!e&&i.constructor===s){t.push(o);break}else if(e&&i instanceof s){t.push(o);break}}}return!e&&t.length===0?this.findEditorPaneDescriptors(i,!0):t}getEditorPaneByType(i){return yt.find(this.mapEditorPanesToEditors.keys(),e=>e.typeId===i)}getEditorPanes(){return Array.from(this.mapEditorPanesToEditors.keys())}getEditors(){let i=[];for(let e of this.mapEditorPanesToEditors.keys()){let t=this.mapEditorPanesToEditors.get(e);t&&i.push(...t.map(o=>o.ctor))}return i}};oe.add(en.EditorPane,new yIi);function ico(a,i){let e=a.get(ie),t=a.get(gt),o=a.get($a);return new Promise(n=>{let r=[...i],s=e.onDidCloseEditor(async l=>{if(l.context===2)return;let c=po.getOriginalUri(l.editor,{supportSideBySide:1}),u=po.getOriginalUri(l.editor,{supportSideBySide:2});if(l.context===1){let p=po.getOriginalUri(e.activeEditor,{supportSideBySide:1}),h=po.getOriginalUri(e.activeEditor,{supportSideBySide:2});t.extUri.isEqual(c,p)&&(c=void 0),t.extUri.isEqual(u,h)&&(u=void 0)}if(r=r.filter(p=>!(t.extUri.isEqual(p,c)||t.extUri.isEqual(p,u)||l.context!==1&&(c?.scheme===Q.untitled&&t.extUri.isEqual(p,c.with({scheme:p.scheme}))||u?.scheme===Q.untitled&&t.extUri.isEqual(p,u.with({scheme:p.scheme}))))),r.length===0){let p=i.filter(h=>o.isDirty(h));return p.length>0&&await vn.settled(p.map(async h=>await new Promise(g=>{if(!o.isDirty(h))return g();let f=o.onDidChangeDirty(v=>{if(!v.isDirty()&&t.extUri.isEqual(h,v.resource))return f.dispose(),g()})}))),s.dispose(),n()}})})}function ree(a,i,e,t){let o=a.getAriaLabel();return e&&!e.isPinned(a)&&(o=d(4403,null,o)),e?.isSticky(i??a)&&(o=d(4402,null,o)),e&&typeof t=="number"&&t>1&&(o=`${o}, ${e.ariaLabel}`),o}var V3=class extends ju{constructor(e,t,o){super(t);this.id=e;this.memento=new $l(this.id,o),this._register(o.onWillSaveState(()=>{this.saveState(),this.memento.saveMemento()}))}getId(){return this.id}getMemento(e,t){return this.memento.getMemento(e,t)}reloadMemento(e){this.memento.reloadMemento(e)}onDidChangeMementoValue(e,t){return this.memento.onDidChangeValue(e,t)}saveState(){}};var zDe=class extends V3{constructor(e,t,o,n){super(e,o,n);this.telemetryService=t;this._onTitleAreaUpdate=this._register(new T);this.onTitleAreaUpdate=this._onTitleAreaUpdate.event;this._hasFocus=!1;this.visible=!1}get onDidFocus(){return this._onDidFocus||(this._onDidFocus=this.registerFocusTrackEvents().onDidFocus),this._onDidFocus.event}get onDidBlur(){return this._onDidBlur||(this._onDidBlur=this.registerFocusTrackEvents().onDidBlur),this._onDidBlur.event}hasFocus(){return this._hasFocus}registerFocusTrackEvents(){let e=Ti(this.getContainer()),t=this._register(nr(e)),o=this._onDidFocus=this._register(new T);this._register(t.onDidFocus(()=>{this._hasFocus=!0,o.fire()}));let n=this._onDidBlur=this._register(new T);return this._register(t.onDidBlur(()=>{this._hasFocus=!1,n.fire()})),{onDidFocus:o,onDidBlur:n}}getTitle(){}create(e){this.parent=e}getContainer(){return this.parent}setVisible(e){this.visible!==!!e&&(this.visible=e)}focus(){}getMenuIds(){return[]}getActions(){return[]}getSecondaryActions(){return[]}getContextMenuActions(){return[]}getActionViewItem(e,t){}getActionsContext(){return null}getActionRunner(){return this.actionRunner||(this.actionRunner=this._register(new cs)),this.actionRunner}updateTitleArea(){this._onTitleAreaUpdate.fire()}isVisible(){return this.visible}getControl(){}},eNt=class{constructor(i,e,t,o,n,r){this.ctor=i;this.id=e;this.name=t;this.cssClass=o;this.order=n;this.requestedIndex=r}instantiate(i){return i.createInstance(this.ctor)}},tNt=class extends k{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.composites=[]}registerComposite(e){this.compositeById(e.id)||(this.composites.push(e),this._onDidRegister.fire(e))}deregisterComposite(e){let t=this.compositeById(e);t&&(this.composites.splice(this.composites.indexOf(t),1),this._onDidDeregister.fire(t))}getComposite(e){return this.compositeById(e)}getComposites(){return this.composites.slice(0)}compositeById(e){return this.composites.find(t=>t.id===e)}};var Zpe=class{constructor(i){this.defaultValue=i}verify(i){return this.isType(i)?i:this.defaultValue}},Nm=class extends Zpe{isType(i){return typeof i=="boolean"}},KDe=class extends Zpe{isType(i){return typeof i=="number"}},iNt=class extends Zpe{isType(i){return i instanceof Set}},Wx=class extends Zpe{constructor(i,e){super(i),this.allowedValues=e}isType(i){return this.allowedValues.includes(i)}},KXe=class extends Zpe{constructor(e,t){super(e);this.verifier=t}verify(e){return this.isType(e)?CIi(this.verifier,e):this.defaultValue}isType(e){return Di(e)}};function CIi(a,i){let e=Object.create(null);for(let t in a)if(Object.hasOwnProperty.call(a,t)){let o=a[t];e[t]=o.verify(i[t])}return e}var c_=new di(220,70),B3=new di(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),bl={showTabs:"multiple",highlightModifiedTabs:!1,tabActionLocation:"right",tabActionCloseVisibility:!0,tabActionUnpinVisibility:!0,showTabIndex:!1,alwaysShowEditorActions:!1,tabSizing:"fit",tabSizingFixedMinWidth:50,tabSizingFixedMaxWidth:160,pinnedTabSizing:"normal",pinnedTabsOnSeparateRow:!1,tabHeight:"default",preventPinnedEditorClose:"keyboardAndMouse",titleScrollbarSizing:"default",titleScrollbarVisibility:"auto",focusRecentEditorAfterClose:!0,showIcons:!0,hasIcons:!0,enablePreview:!0,openPositioning:"right",openSideBySideDirection:"right",closeEmptyGroups:!0,labelFormat:"default",splitSizing:"auto",splitOnDragAndDrop:!0,allowDropIntoGroup:!0,dragToOpenWindow:!0,centeredLayoutFixedWidth:!1,doubleClickTabToToggleEditorGroupSizes:"expand",editorActionsLocation:"default",wrapTabs:!1,enablePreviewFromQuickOpen:!1,scrollToSwitchTabs:!1,enablePreviewFromCodeNavigation:!1,closeOnFileDelete:!1,swipeToNavigate:!1,mouseBackForwardToNavigate:!0,restoreViewState:!0,splitInGroupLayout:"horizontal",revealIfOpen:!1,get limit(){return{enabled:!1,value:10,perEditorGroup:!1,excludeDirty:!1}},get decorations(){return{badges:!0,colors:!0}},get autoLockGroups(){return new Set}};function oco(a){return a.affectsConfiguration("workbench.editor")||a.affectsConfiguration("workbench.iconTheme")||a.affectsConfiguration("window.density")}function xIi(a,i){let e={...bl,hasIcons:i.getFileIconTheme().hasFileIcons},t=a.getValue();if(t?.workbench?.editor)if(Object.assign(e,t.workbench.editor),Di(t.workbench.editor.autoLockGroups)){e.autoLockGroups=bl.autoLockGroups;for(let[n,r]of Object.entries(t.workbench.editor.autoLockGroups))r===!0&&e.autoLockGroups.add(n)}else e.autoLockGroups=bl.autoLockGroups;let o=a.getValue();return o?.window?.density?.editorTabHeight&&(e.tabHeight=o.window.density.editorTabHeight),J7o(e)}function J7o(a){return typeof a.showTabs=="boolean"&&(a.showTabs=a.showTabs?"multiple":"single"),CIi({wrapTabs:new Nm(bl.wrapTabs),scrollToSwitchTabs:new Nm(bl.scrollToSwitchTabs),highlightModifiedTabs:new Nm(bl.highlightModifiedTabs),tabActionCloseVisibility:new Nm(bl.tabActionCloseVisibility),tabActionUnpinVisibility:new Nm(bl.tabActionUnpinVisibility),showTabIndex:new Nm(bl.showTabIndex),alwaysShowEditorActions:new Nm(bl.alwaysShowEditorActions),pinnedTabsOnSeparateRow:new Nm(bl.pinnedTabsOnSeparateRow),focusRecentEditorAfterClose:new Nm(bl.focusRecentEditorAfterClose),showIcons:new Nm(bl.showIcons),enablePreview:new Nm(bl.enablePreview),enablePreviewFromQuickOpen:new Nm(bl.enablePreviewFromQuickOpen),enablePreviewFromCodeNavigation:new Nm(bl.enablePreviewFromCodeNavigation),closeOnFileDelete:new Nm(bl.closeOnFileDelete),closeEmptyGroups:new Nm(bl.closeEmptyGroups),revealIfOpen:new Nm(bl.revealIfOpen),swipeToNavigate:new Nm(bl.swipeToNavigate),mouseBackForwardToNavigate:new Nm(bl.mouseBackForwardToNavigate),restoreViewState:new Nm(bl.restoreViewState),splitOnDragAndDrop:new Nm(bl.splitOnDragAndDrop),allowDropIntoGroup:new Nm(bl.allowDropIntoGroup),dragToOpenWindow:new Nm(bl.dragToOpenWindow),centeredLayoutFixedWidth:new Nm(bl.centeredLayoutFixedWidth),hasIcons:new Nm(bl.hasIcons),tabSizingFixedMinWidth:new KDe(bl.tabSizingFixedMinWidth),tabSizingFixedMaxWidth:new KDe(bl.tabSizingFixedMaxWidth),showTabs:new Wx(bl.showTabs,["multiple","single","none"]),tabActionLocation:new Wx(bl.tabActionLocation,["left","right"]),tabSizing:new Wx(bl.tabSizing,["fit","shrink","fixed"]),pinnedTabSizing:new Wx(bl.pinnedTabSizing,["normal","compact","shrink"]),tabHeight:new Wx(bl.tabHeight,["default","compact"]),preventPinnedEditorClose:new Wx(bl.preventPinnedEditorClose,["keyboardAndMouse","keyboard","mouse","never"]),titleScrollbarSizing:new Wx(bl.titleScrollbarSizing,["default","large"]),titleScrollbarVisibility:new Wx(bl.titleScrollbarVisibility,["auto","visible","hidden"]),openPositioning:new Wx(bl.openPositioning,["left","right","first","last"]),openSideBySideDirection:new Wx(bl.openSideBySideDirection,["right","down"]),labelFormat:new Wx(bl.labelFormat,["default","short","medium","long"]),splitInGroupLayout:new Wx(bl.splitInGroupLayout,["vertical","horizontal"]),splitSizing:new Wx(bl.splitSizing,["distribute","split","auto"]),doubleClickTabToToggleEditorGroupSizes:new Wx(bl.doubleClickTabToToggleEditorGroupSizes,["maximize","expand","off"]),editorActionsLocation:new Wx(bl.editorActionsLocation,["default","titleBar","hidden"]),autoLockGroups:new iNt(bl.autoLockGroups),limit:new KXe(bl.limit,{enabled:new Nm(bl.limit.enabled),value:new KDe(bl.limit.value),perEditorGroup:new Nm(bl.limit.perEditorGroup),excludeDirty:new Nm(bl.limit.excludeDirty)}),decorations:new KXe(bl.decorations,{badges:new Nm(bl.decorations.badges),colors:new Nm(bl.decorations.colors)})},a)}function kIi(a,i,e){return!i||!a.activeEditor||i.matches(a.activeEditor)?{...e,viewState:a.activeEditorPane?.getViewState()}:e||Object.create(null)}function see(a,i,e){if(i.length===0)return[];let t=[],o,n=[];for(let s of i)!o&&a.isActive(s)?o=s:n.push(s);o||(o=n.shift()),n.sort((s,l)=>a.getIndexOfEditor(l)-a.getIndexOfEditor(s));let r=ui([o,...n]);for(let s=0;s<r.length;s++){let l=r[s];t.push({editor:l,options:{pinned:!0,sticky:a.isSticky(l),inactive:s>0,preserveFocus:e}})}return t}var zs=class a extends zDe{constructor(e,t,o,n,r){super(e,o,n,r);this.group=t;this.onDidChangeSizeConstraints=U.None;this._onDidChangeControl=this._register(new T);this.onDidChangeControl=this._onDidChangeControl.event}static{this.EDITOR_MEMENTOS=new Map}get minimumWidth(){return c_.width}get maximumWidth(){return B3.width}get minimumHeight(){return c_.height}get maximumHeight(){return B3.height}get input(){return this._input}get options(){return this._options}get window(){return gv(this.group.windowId,!0).window}get scopedContextKeyService(){}create(e){super.create(e),this.createEditor(e)}async setInput(e,t,o,n){this._input=e,this._options=t}clearInput(){this._input=void 0,this._options=void 0}setOptions(e){this._options=e}setVisible(e){super.setVisible(e),this.setEditorVisible(e)}setEditorVisible(e){}setBoundarySashes(e){}getEditorMemento(e,t,o,n=10){let r=`${this.getId()}${o}`,s=a.EDITOR_MEMENTOS.get(r);return s||(s=this._register(new EIi(this.getId(),o,this.getMemento(1,1),n,e,t)),a.EDITOR_MEMENTOS.set(r,s)),s}getViewState(){}saveState(){for(let[,e]of a.EDITOR_MEMENTOS)e.id===this.getId()&&e.saveState();super.saveState()}dispose(){this._input=void 0,this._options=void 0,super.dispose()}},EIi=class a extends k{constructor(e,t,o,n,r,s){super();this.id=e;this.key=t;this.memento=o;this.limit=n;this.editorGroupService=r;this.configurationService=s;this.cleanedUp=!1;this.shareEditorState=!1;this.updateConfiguration(void 0),this.registerListeners()}static{this.SHARED_EDITOR_STATE=-1}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e)))}updateConfiguration(e){(!e||e.affectsConfiguration(void 0,"workbench.editor.sharedViewState"))&&(this.shareEditorState=this.configurationService.getValue(void 0,"workbench.editor.sharedViewState")===!0)}saveEditorState(e,t,o){let n=this.doGetResource(t);if(!n||!e)return;let r=this.doLoad(),s=r.get(n.toString());s||(s=Object.create(null),r.set(n.toString(),s)),s[e.id]=o,this.shareEditorState&&(s[a.SHARED_EDITOR_STATE]=o),ya(t)&&this.clearEditorStateOnDispose(n,t)}loadEditorState(e,t){let o=this.doGetResource(t);if(!o||!e)return;let r=this.doLoad().get(o.toString());if(r){let s=r[e.id];if(s)return s;if(this.shareEditorState)return r[a.SHARED_EDITOR_STATE]}}clearEditorState(e,t){ya(e)&&this.editorDisposables?.delete(e);let o=this.doGetResource(e);if(o){let n=this.doLoad();if(t){let r=n.get(o.toString());r&&(delete r[t.id],dv(r)&&n.delete(o.toString()))}else n.delete(o.toString())}}clearEditorStateOnDispose(e,t){this.editorDisposables||(this.editorDisposables=new Map),this.editorDisposables.has(t)||this.editorDisposables.set(t,U.once(t.onWillDispose)(()=>{this.clearEditorState(e),this.editorDisposables?.delete(t)}))}moveEditorState(e,t,o){let n=this.doLoad(),r=[...n.keys()];for(let s of r){let l=A.parse(s);if(!o.isEqualOrParent(l,e))continue;let c;if(ze(e,l))c=t;else{let p=mwe(l.path,e.path);c=Ve(t,l.path.substr(p+e.path.length+1))}let u=n.get(s,0);u&&(n.delete(s),n.set(c.toString(),u))}}doGetResource(e){return ya(e)?e.resource:e}doLoad(){if(!this.cache){this.cache=new Ua(this.limit);let e=this.memento[this.key];Array.isArray(e)&&this.cache.fromJSON(e)}return this.cache}saveState(){let e=this.doLoad();this.cleanedUp||(this.cleanUp(),this.cleanedUp=!0),this.memento[this.key]=e.toJSON()}cleanUp(){let e=this.doLoad(),t=[...e.entries()];for(let[o,n]of t)for(let r of Object.keys(n)){let s=Number(r);s===a.SHARED_EDITOR_STATE&&this.shareEditorState||this.editorGroupService.getGroup(s)||(delete n[s],dv(n)&&e.delete(o))}}};var Y0=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,n,c,s);this.instantiationService=r;this.textResourceConfigurationService=l;this.editorService=u;this.editorGroupService=p;this.groupListener=this._register(new ue);this.viewState=this.getEditorMemento(p,l,o,100)}setEditorVisible(e){this.groupListener.value=this.group.onWillCloseEditor(t=>this.onWillCloseEditor(t)),super.setEditorVisible(e)}onWillCloseEditor(e){let t=e.editor;t===this.input&&this.updateEditorViewState(t)}clearInput(){this.updateEditorViewState(this.input),super.clearInput()}saveState(){this.updateEditorViewState(this.input),super.saveState()}updateEditorViewState(e){if(!e||!this.tracksEditorViewState(e))return;let t=this.toEditorViewStateResource(e);t&&(this.tracksDisposedEditorViewState()||(this.editorViewStateDisposables||(this.editorViewStateDisposables=this._register(new Ot)),this.editorViewStateDisposables.has(e)||this.editorViewStateDisposables.set(e,U.once(e.onWillDispose)(()=>{this.clearEditorViewState(t,this.group),this.editorViewStateDisposables?.deleteAndDispose(e)}))),e.isDisposed()&&!this.tracksDisposedEditorViewState()||!this.shouldRestoreEditorViewState(e)&&!this.group.contains(e)?(this.clearEditorViewState(t,this.group),this.editorViewStateDisposables?.deleteAndDispose(e)):e.isDisposed()||this.saveEditorViewState(t))}shouldRestoreEditorViewState(e,t){return t?.newInGroup?this.textResourceConfigurationService.getValue(po.getOriginalUri(e,{supportSideBySide:1}),"workbench.editor.restoreViewState")!==!1:!0}getViewState(){let e=this.input;if(!e||!this.tracksEditorViewState(e))return;let t=this.toEditorViewStateResource(e);if(t)return this.computeEditorViewState(t)}saveEditorViewState(e){let t=this.computeEditorViewState(e);t&&this.viewState.saveEditorState(this.group,e,t)}loadEditorViewState(e,t){if(!e||!this.tracksEditorViewState(e)||!this.shouldRestoreEditorViewState(e,t))return;let o=this.toEditorViewStateResource(e);if(o)return this.viewState.loadEditorState(this.group,o)}moveEditorViewState(e,t,o){return this.viewState.moveEditorState(e,t,o)}clearEditorViewState(e,t){this.viewState.clearEditorState(e,t)}tracksDisposedEditorViewState(){return!1}};Y0=I([m(3,_e),m(4,F),m(5,de),m(6,Gn),m(7,Pe),m(8,ie),m(9,kt)],Y0);var KM=class extends Y0{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,KM.VIEW_STATE_PREFERENCE_KEY,o,n,r,s,l,c,u);this.fileService=p;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new T);this.onDidChangeScroll=this._onDidChangeScroll.event;this.inputListener=this._register(new ue);this._register(this.textResourceConfigurationService.onDidChangeConfiguration(h=>this.handleConfigurationChangeEvent(h))),this._register(U.any(this.editorGroupService.onDidAddGroup,this.editorGroupService.onDidRemoveGroup)(()=>{let h=this.computeAriaLabel();this.editorContainer?.setAttribute("aria-label",h),this.updateEditorControlOptions({ariaLabel:h})})),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(h=>this.onDidChangeFileSystemProvider(h.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(h=>this.onDidChangeFileSystemProvider(h.scheme)))}static{this.VIEW_STATE_PREFERENCE_KEY="textEditorViewState"}handleConfigurationChangeEvent(e){let t=this.getActiveResource();this.shouldHandleConfigurationChangeEvent(e,t)&&(this.isVisible()?this.updateEditorConfiguration(t):this.hasPendingConfigurationChange=!0)}shouldHandleConfigurationChangeEvent(e,t){return e.affectsConfiguration(t,"editor")||e.affectsConfiguration(t,"problems.visibility")}consumePendingConfigurationChangeEvent(){this.hasPendingConfigurationChange&&(this.updateEditorConfiguration(),this.hasPendingConfigurationChange=!1)}computeConfiguration(e){let t=Di(e.editor)?io(e.editor):Object.create(null);return Object.assign(t,this.getConfigurationOverrides(e)),t.ariaLabel=this.computeAriaLabel(),t}computeAriaLabel(){return this.input?ree(this.input,void 0,this.group,this.editorGroupService.count):d(4962,null)}onDidChangeFileSystemProvider(e){this.input&&this.getActiveResource()?.scheme===e&&this.updateReadonly(this.input)}onDidChangeInputCapabilities(e){this.input===e&&this.updateReadonly(e)}updateReadonly(e){this.updateEditorControlOptions({...this.getReadonlyConfiguration(e.isReadonly())})}getReadonlyConfiguration(e){return{readOnly:!!e,readOnlyMessage:typeof e!="boolean"?e:void 0}}getConfigurationOverrides(e){return{overviewRulerLanes:3,lineNumbersMinChars:3,fixedOverflowWidgets:!0,...this.getReadonlyConfiguration(this.input?.isReadonly()),renderValidationDecorations:e.problems?.visibility!==!1?"on":"off"}}createEditor(e){this.editorContainer=e,this.createEditorControl(e,this.computeConfiguration(this.textResourceConfigurationService.getValue(this.getActiveResource()))),this.registerCodeEditorListeners()}registerCodeEditorListeners(){let e=this.getMainControl();e&&(this._register(e.onDidChangeModelLanguage(()=>this.updateEditorConfiguration())),this._register(e.onDidChangeModel(()=>this.updateEditorConfiguration())),this._register(e.onDidChangeCursorPosition(t=>this._onDidChangeSelection.fire({reason:this.toEditorPaneSelectionChangeReason(t)}))),this._register(e.onDidChangeModelContent(()=>this._onDidChangeSelection.fire({reason:3}))),this._register(e.onDidScrollChange(()=>this._onDidChangeScroll.fire())))}toEditorPaneSelectionChangeReason(e){switch(e.source){case"api":return 1;case"code.navigation":return 4;case"code.jump":return 5;default:return 2}}getSelection(){let e=this.getMainControl();if(e){let t=e.getSelection();if(t)return new TIi(t)}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.inputListener.value=e.onDidChangeCapabilities(()=>this.onDidChangeInputCapabilities(e)),this.updateEditorConfiguration(),Ti(this.editorContainer).setAttribute("aria-label",this.computeAriaLabel())}clearInput(){this.inputListener.clear(),super.clearInput()}getScrollPosition(){let e=this.getMainControl();if(!e)throw new Error("Control has not yet been initialized");return{scrollTop:e.getScrollTop()-e.getTopForLineNumber(1),scrollLeft:e.getScrollLeft()}}setScrollPosition(e){let t=this.getMainControl();if(!t)throw new Error("Control has not yet been initialized");t.setScrollTop(e.scrollTop),e.scrollLeft&&t.setScrollLeft(e.scrollLeft)}setEditorVisible(e){e&&this.consumePendingConfigurationChangeEvent(),super.setEditorVisible(e)}toEditorViewStateResource(e){return e.resource}updateEditorConfiguration(e=this.getActiveResource()){let t;if(e&&(t=this.textResourceConfigurationService.getValue(e)),!t)return;let o=this.computeConfiguration(t),n=o;this.lastAppliedEditorOptions&&(n=q4e(this.lastAppliedEditorOptions,n)),Object.keys(n).length>0&&(this.lastAppliedEditorOptions=o,this.updateEditorControlOptions(n))}getActiveResource(){let e=this.getMainControl();if(e){let t=e.getModel();if(t)return t.uri}if(this.input)return this.input.resource}dispose(){this.lastAppliedEditorOptions=void 0,super.dispose()}};KM=I([m(2,_e),m(3,F),m(4,de),m(5,Gn),m(6,Pe),m(7,ie),m(8,kt),m(9,ge)],KM);var TIi=class a{constructor(i){this.textSelection=i}static{this.TEXT_EDITOR_SELECTION_THRESHOLD=10}compare(i){if(!(i instanceof a))return 3;let e=Math.min(this.textSelection.selectionStartLineNumber,this.textSelection.positionLineNumber),t=Math.min(i.textSelection.selectionStartLineNumber,i.textSelection.positionLineNumber);return e===t?1:Math.abs(e-t)<a.TEXT_EDITOR_SELECTION_THRESHOLD?2:3}restore(i){return{...i,selection:this.textSelection,selectionRevealType:1}}log(){return`line: ${this.textSelection.startLineNumber}-${this.textSelection.endLineNumber}, col:  ${this.textSelection.startColumn}-${this.textSelection.endColumn}`}};var Es=le("paneCompositePartService");var qXe="views",$Xe=d(5718,null),GDe=Oe("default-view-icon",L.window,d(5715,null)),Kn;(e=>(e.ViewContainersRegistry="workbench.registry.view.containers",e.ViewsRegistry="workbench.registry.view"))(Kn||={});function wC(a){switch(a){case 0:return"sidebar";case 1:return"panel";case 2:return"auxiliarybar";case 3:return"chatbar"}}var _Ii=class extends k{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,t,o){let n=this.get(e.id);if(n)return n;let r=e;return r.openCommandActionDescriptor=o?.doNotRegisterOpenCommand?void 0:r.openCommandActionDescriptor??{id:r.id},cB(this.viewContainers,t,[]).push(r),o?.isDefault&&this.defaultViewContainers.push(r),this._onDidRegister.fire({viewContainer:r,viewContainerLocation:t}),r}deregisterViewContainer(e){for(let t of this.viewContainers.keys()){let o=this.viewContainers.get(t),n=o?.indexOf(e);if(n!==-1){o?.splice(n,1),o.length===0&&this.viewContainers.delete(t),this._onDidDeregister.fire({viewContainer:e,viewContainerLocation:t});return}}}get(e){return this.all.filter(t=>t.id===e)[0]}getViewContainers(e){return[...this.viewContainers.get(e)||[]]}getViewContainerLocation(e){return[...this.viewContainers.keys()].filter(t=>this.getViewContainers(t).filter(o=>o?.id===e.id).length>0)[0]}getDefaultViewContainers(e){return this.defaultViewContainers.filter(t=>this.getViewContainerLocation(t)===e)}};oe.add(Kn.ViewContainersRegistry,new _Ii);function Z7o(a,i){let e=a.group??"9_more",t=i.group??"9_more";return e!==t?e.localeCompare(t):(a.order??5)-(i.order??5)}var DIi=class extends k{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 pz}registerViews(e,t){this.registerViews2([{views:e,viewContainer:t}])}registerViews2(e){e.forEach(({views:t,viewContainer:o})=>this.addViews(t,o)),this._onViewsRegistered.fire(e)}deregisterViews(e,t){let o=this.removeViews(e,t);o.length&&this._onViewsDeregistered.fire({views:o,viewContainer:t})}moveViews(e,t){for(let o of this._views.keys())if(o!==t){let n=this.removeViews(e,o);n.length&&(this.addViews(n,t),this._onDidChangeContainer.fire({views:n,from:o,to:t}))}}getViews(e){return this._views.get(e)||[]}getView(e){for(let t of this._viewContainers){let o=(this._views.get(t)||[]).filter(n=>n.id===e)[0];if(o)return o}return null}getViewContainer(e){for(let t of this._viewContainers)if((this._views.get(t)||[]).filter(n=>n.id===e)[0])return t;return null}registerViewWelcomeContent(e,t){return this._viewWelcomeContents.add(e,t),this._onDidChangeViewWelcomeContent.fire(e),ee(()=>{this._viewWelcomeContents.delete(e,t),this._onDidChangeViewWelcomeContent.fire(e)})}registerViewWelcomeContent2(e,t){let o=new Map;for(let[n,r]of t)this._viewWelcomeContents.add(e,r),o.set(n,ee(()=>{this._viewWelcomeContents.delete(e,r),this._onDidChangeViewWelcomeContent.fire(e)}));return this._onDidChangeViewWelcomeContent.fire(e),o}getViewWelcomeContent(e){let t=[];return this._viewWelcomeContents.forEach(e,o=>t.push(o)),t.sort(Z7o)}addViews(e,t){let o=this._views.get(t);o||(o=[],this._views.set(t,o),this._viewContainers.push(t));for(let n of e){if(this.getView(n.id)!==null)throw new Error(d(5716,null,n.id));o.push(n)}}removeViews(e,t){let o=this._views.get(t);if(!o)return[];let n=[],r=[];for(let s of o)e.includes(s)?n.push(s):r.push(s);return n.length&&(r.length?this._views.set(t,r):(this._views.delete(t),this._viewContainers.splice(this._viewContainers.indexOf(t),1))),n}};oe.add(Kn.ViewsRegistry,new DIi);var ji=le("viewDescriptorService");var H3=class{constructor(i,e){this.resolved=!1;this._hasResolve=!1;Cp(this,i),this._hasResolve=!!e,this.resolve=async t=>{if(e&&!this.resolved){let o=await e(t);o&&(this.tooltip=this.tooltip??o.tooltip,this.command=this.command??o.command)}t.isCancellationRequested||(this.resolved=!0)}}get hasResolve(){return this._hasResolve}resetResolve(){this.resolved=!1}asTreeItem(){return{handle:this.handle,parentHandle:this.parentHandle,collapsibleState:this.collapsibleState,label:this.label,description:this.description,icon:this.icon,iconDark:this.iconDark,themeIcon:this.themeIcon,resourceUri:this.resourceUri,tooltip:this.tooltip,contextValue:this.contextValue,command:this.command,children:this.children,accessibilityInformation:this.accessibilityInformation}}},rNt=class extends Error{constructor(e){super(d(5717,null,e));this.name="NoTreeViewError"}static is(e){return!!e&&e.name==="NoTreeViewError"}};var RIi=class{constructor(i){this.editor=i;this.id=`${i.getId()},${i.getModel().id}`}},YXe=class{constructor(i,e,t,o,n,r){this.removedDocuments=i;this.addedDocuments=e;this.removedEditors=t;this.addedEditors=o;this.oldActiveEditor=n;this.newActiveEditor=r;this.isEmpty=this.removedDocuments.length===0&&this.addedDocuments.length===0&&this.removedEditors.length===0&&this.addedEditors.length===0&&n===r}toString(){let i=`DocumentAndEditorStateDelta
`;return i+=`	Removed Documents: [${this.removedDocuments.map(e=>e.uri.toString(!0)).join(", ")}]
`,i+=`	Added Documents: [${this.addedDocuments.map(e=>e.uri.toString(!0)).join(", ")}]
`,i+=`	Removed Editors: [${this.removedEditors.map(e=>e.id).join(", ")}]
`,i+=`	Added Editors: [${this.addedEditors.map(e=>e.id).join(", ")}]
`,i+=`	New Active Editor: ${this.newActiveEditor}
`,i}},QXe=class{constructor(i,e,t){this.documents=i;this.textEditors=e;this.activeEditor=t}static compute(i,e){if(!i)return new YXe([],[...e.documents.values()],[],[...e.textEditors.values()],void 0,e.activeEditor);let t=cz(i.documents,e.documents),o=q5e(i.textEditors,e.textEditors),n=i.activeEditor!==e.activeEditor?i.activeEditor:void 0,r=i.activeEditor!==e.activeEditor?e.activeEditor:void 0;return new YXe(t.removed,t.added,o.removed,o.added,n,r)}};var jXe=class{constructor(i,e,t,o,n){this._onDidChangeState=i;this._modelService=e;this._codeEditorService=t;this._editorService=o;this._paneCompositeService=n;this._toDispose=new O;this._toDisposeOnEditorRemove=new Ot;this._activeEditorOrder=0;this._modelService.onModelAdded(this._updateStateOnModelAdd,this,this._toDispose),this._modelService.onModelRemoved(r=>this._updateState(),this,this._toDispose),this._editorService.onDidActiveEditorChange(r=>this._updateState(),this,this._toDispose),this._codeEditorService.onCodeEditorAdd(this._onDidAddEditor,this,this._toDispose),this._codeEditorService.onCodeEditorRemove(this._onDidRemoveEditor,this,this._toDispose),this._codeEditorService.listCodeEditors().forEach(this._onDidAddEditor,this),U.filter(this._paneCompositeService.onDidPaneCompositeOpen,r=>r.viewContainerLocation===1)(r=>this._activeEditorOrder=1,void 0,this._toDispose),U.filter(this._paneCompositeService.onDidPaneCompositeClose,r=>r.viewContainerLocation===1)(r=>this._activeEditorOrder=0,void 0,this._toDispose),this._editorService.onDidVisibleEditorsChange(r=>this._activeEditorOrder=0,void 0,this._toDispose),this._updateState()}dispose(){this._toDispose.dispose(),this._toDisposeOnEditorRemove.dispose()}_onDidAddEditor(i){this._toDisposeOnEditorRemove.set(i.getId(),Fn(i.onDidChangeModel(()=>this._updateState()),i.onDidFocusEditorText(()=>this._updateState()),i.onDidFocusEditorWidget(()=>this._updateState(i)))),this._updateState()}_onDidRemoveEditor(i){let e=i.getId();this._toDisposeOnEditorRemove.has(e)&&(this._toDisposeOnEditorRemove.deleteAndDispose(e),this._updateState())}_updateStateOnModelAdd(i){if(Pk(i)){if(!this._currentState){this._updateState();return}this._currentState=new QXe(this._currentState.documents.add(i),this._currentState.textEditors,this._currentState.activeEditor),this._onDidChangeState(new YXe([],[i],[],[],void 0,void 0))}}_updateState(i){let e=new Set;for(let s of this._modelService.getModels())Pk(s)&&e.add(s);let t=new Map,o=null;for(let s of this._codeEditorService.listCodeEditors()){if(s.isSimpleWidget)continue;let l=s.getModel();if(s.hasModel()&&l&&Pk(l)&&!l.isDisposed()&&this._modelService.getModel(l.uri)){let c=new RIi(s);t.set(c.id,c),(s.hasTextFocus()||i===s&&s.hasWidgetFocus())&&(o=c.id)}}if(!o){let s;if(this._activeEditorOrder===0?s=this._getActiveEditorFromEditorPart()||this._getActiveEditorFromPanel():s=this._getActiveEditorFromPanel()||this._getActiveEditorFromEditorPart(),s)for(let l of t.values())s===l.editor&&(o=l.id)}let n=new QXe(e,t,o),r=QXe.compute(this._currentState,n);r.isEmpty||(this._currentState=n,this._onDidChangeState(r))}_getActiveEditorFromPanel(){let i=this._paneCompositeService.getActivePaneComposite(1);if(i instanceof KM){let e=i.getControl();if(fn(e))return e}}_getActiveEditorFromEditorPart(){let i=this._editorService.activeTextEditorControl;return Lc(i)&&(i=i.getModifiedEditor()),i}};jXe=I([m(1,_t),m(2,Qt),m(3,ie),m(4,Es)],jXe);var sNt=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this._modelService=e;this._textFileService=t;this._editorService=o;this._editorGroupService=l;this._clipboardService=g;this._toDispose=new O;this._textEditors=new Map;this._proxy=i.getProxy(ao.ExtHostDocumentsAndEditors),this._mainThreadDocuments=this._toDispose.add(new FDe(i,this._modelService,this._textFileService,r,s,u,h,p,f)),i.set(Xi.MainThreadDocuments,this._mainThreadDocuments),this._mainThreadEditors=this._toDispose.add(new nee(this,i,n,this._editorService,this._editorGroupService,v,b,h)),i.set(Xi.MainThreadTextEditors,this._mainThreadEditors),this._toDispose.add(new jXe(S=>this._onDelta(S),e,n,this._editorService,c))}dispose(){this._toDispose.dispose()}_onDelta(i){let e=[],t=[],o=i.removedDocuments.map(s=>s.uri);for(let s of i.addedEditors){let l=new jAt(s.id,s.editor.getModel(),s.editor,{onGainedFocus(){},onLostFocus(){}},this._mainThreadDocuments,this._modelService,this._clipboardService);this._textEditors.set(s.id,l),t.push(l)}for(let{id:s}of i.removedEditors){let l=this._textEditors.get(s);l&&(l.dispose(),this._textEditors.delete(s),e.push(s))}let n=Object.create(null),r=!0;i.newActiveEditor!==void 0&&(r=!1,n.newActiveEditor=i.newActiveEditor),o.length>0&&(r=!1,n.removedDocuments=o),e.length>0&&(r=!1,n.removedEditors=e),i.addedDocuments.length>0&&(r=!1,n.addedDocuments=i.addedDocuments.map(s=>this._toModelAddData(s))),i.addedEditors.length>0&&(r=!1,n.addedEditors=t.map(s=>this._toTextEditorAddData(s))),r||(this._proxy.$acceptDocumentsAndEditorsDelta(n),o.forEach(this._mainThreadDocuments.handleModelRemoved,this._mainThreadDocuments),i.addedDocuments.forEach(this._mainThreadDocuments.handleModelAdded,this._mainThreadDocuments),e.forEach(this._mainThreadEditors.handleTextEditorRemoved,this._mainThreadEditors),t.forEach(this._mainThreadEditors.handleTextEditorAdded,this._mainThreadEditors))}_toModelAddData(i){return{uri:i.uri,versionId:i.getVersionId(),lines:i.getLinesContent(),EOL:i.getEOL(),languageId:i.getLanguageId(),isDirty:this._textFileService.isDirty(i.uri),encoding:this._textFileService.getEncoding(i.uri)}}_toTextEditorAddData(i){let e=i.getProperties();return{id:i.getId(),documentUri:i.getModel().uri,options:e.options,selections:e.selections,visibleRanges:e.visibleRanges,editorPosition:this._findEditorPosition(i)}}_findEditorPosition(i){for(let e of this._editorService.visibleEditorPanes)if(i.matches(e))return Fx(this._editorGroupService,e.group)}findTextEditorIdFor(i){for(let[e,t]of this._textEditors)if(t.matches(i))return e}getIdOfCodeEditor(i){for(let[e,t]of this._textEditors)if(t.getCodeEditor()===i)return e}getEditor(i){return this._textEditors.get(i)}};sNt=I([RM,m(1,_t),m(2,Uo),m(3,ie),m(4,Qt),m(5,ge),m(6,Bt),m(7,kt),m(8,Es),m(9,Mt),m(10,gm),m(11,gt),m(12,Bi),m(13,Pn),m(14,B),m(15,Q0)],sNt);var ja=class extends Ls{constructor(e,t,o,n,r){super();this.preferredName=e;this.preferredDescription=t;this.secondary=o;this.primary=n;this.editorService=r;this.hasIdenticalSides=this.primary.matches(this.secondary),this.registerListeners()}static{this.ID="workbench.editorinputs.sidebysideEditorInput"}get typeId(){return ja.ID}get capabilities(){let e=this.primary.capabilities;return e&=-33,this.secondary.hasCapability(16)&&(e|=16),this.secondary.hasCapability(8)&&(e|=8),this.secondary.hasCapability(1024)&&(e|=1024),e|=256,e}get resource(){if(this.hasIdenticalSides)return this.primary.resource}registerListeners(){this._register(U.once(U.any(this.primary.onWillDispose,this.secondary.onWillDispose))(()=>{this.isDisposed()||this.dispose()})),this._register(this.primary.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.primary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire())),this._register(this.secondary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire())),this._register(this.primary.onDidChangeLabel(()=>this._onDidChangeLabel.fire())),this._register(this.secondary.onDidChangeLabel(()=>this._onDidChangeLabel.fire()))}getName(){let e=this.getPreferredName();return e||(this.hasIdenticalSides?this.primary.getName():d(5552,null,this.secondary.getName(),this.primary.getName()))}getPreferredName(){return this.preferredName}getDescription(e){let t=this.getPreferredDescription();return t||(this.hasIdenticalSides?this.primary.getDescription(e):super.getDescription(e))}getPreferredDescription(){return this.preferredDescription}getTitle(e){let t;this.hasIdenticalSides?t=this.primary.getTitle(e)??this.getName():t=super.getTitle(e);let o=this.getPreferredTitle();return o&&(t=`${o} (${t})`),t}getPreferredTitle(){if(this.preferredName&&this.preferredDescription)return`${this.preferredName} ${this.preferredDescription}`;if(this.preferredName||this.preferredDescription)return this.preferredName??this.preferredDescription}getLabelExtraClasses(){return this.hasIdenticalSides?this.primary.getLabelExtraClasses():super.getLabelExtraClasses()}getAriaLabel(){return this.hasIdenticalSides?this.primary.getAriaLabel():super.getAriaLabel()}getTelemetryDescriptor(){return{...this.primary.getTelemetryDescriptor(),...super.getTelemetryDescriptor()}}isDirty(){return this.primary.isDirty()}isSaving(){return this.primary.isSaving()}async save(e,t){let o=await this.primary.save(e,t);return this.saveResultToEditor(o)}async saveAs(e,t){let o=await this.primary.saveAs(e,t);return this.saveResultToEditor(o)}saveResultToEditor(e){if(!e||!this.hasIdenticalSides)return e;if(this.primary.matches(e))return this;if(e instanceof Ls)return new ja(this.preferredName,this.preferredDescription,e,e,this.editorService);if(!Ug(e)&&!mZ(e)&&!GD(e)&&!Xy(e))return{primary:e,secondary:e,label:this.preferredName,description:this.preferredDescription}}revert(e,t){return this.primary.revert(e,t)}async rename(e,t){if(!this.hasIdenticalSides)return;let o=await this.primary.rename(e,t);if(o){if(ya(o.editor))return{editor:new ja(this.preferredName,this.preferredDescription,o.editor,o.editor,this.editorService),options:{...o.options,viewState:h3(this,e,this.editorService)}};if(zg(o.editor))return{editor:{label:this.preferredName,description:this.preferredDescription,primary:o.editor,secondary:o.editor,options:{...o.options,viewState:h3(this,e,this.editorService)}}}}}isReadonly(){return this.primary.isReadonly()}toUntyped(e){let t=this.primary.toUntyped(e),o=this.secondary.toUntyped(e);if(t&&o&&!Ug(t)&&!Ug(o)&&!mZ(t)&&!mZ(o)&&!GD(t)&&!GD(o)&&!Xy(t)&&!Xy(o)){let n={label:this.preferredName,description:this.preferredDescription,primary:t,secondary:o};return typeof e?.preserveViewState=="number"&&(n.options={viewState:h3(this,e.preserveViewState,this.editorService)}),n}}matches(e){return this===e?!0:qD(e)||Ug(e)?!1:e instanceof ja?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):GD(e)?this.primary.matches(e.primary)&&this.secondary.matches(e.secondary):!1}};ja=I([m(4,ie)],ja);var XXe=class{canSerialize(i){let e=i;if(e.primary&&e.secondary){let[t,o]=this.getSerializers(e.secondary.typeId,e.primary.typeId);return!!(t?.canSerialize(e.secondary)&&o?.canSerialize(e.primary))}return!1}serialize(i){let e=i;if(e.primary&&e.secondary){let[t,o]=this.getSerializers(e.secondary.typeId,e.primary.typeId);if(o&&t){let n=o.serialize(e.primary),r=t.serialize(e.secondary);if(n&&r){let s={name:e.getPreferredName(),description:e.getPreferredDescription(),primarySerialized:n,secondarySerialized:r,primaryTypeId:e.primary.typeId,secondaryTypeId:e.secondary.typeId};return JSON.stringify(s)}}}}deserialize(i,e){let t=JSON.parse(e),[o,n]=this.getSerializers(t.secondaryTypeId,t.primaryTypeId);if(n&&o){let r=n.deserialize(i,t.primarySerialized),s=o.deserialize(i,t.secondarySerialized);if(r instanceof Ls&&s instanceof Ls)return this.createEditorInput(i,t.name,t.description,s,r)}}getSerializers(i,e){let t=oe.as(en.EditorFactory);return[t.getEditorSerializer(i),t.getEditorSerializer(e)]}},aNt=class extends XXe{createEditorInput(i,e,t,o,n){return i.createInstance(ja,e,t,o,n)}};var Zh=class extends k{constructor(){super(...arguments);this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this.resolved=!1}async resolve(){this.resolved=!0}isResolved(){return this.resolved}isDisposed(){return this._store.isDisposed}dispose(){this._onWillDispose.fire(),super.dispose()}};var jS=le("ILanguageDetectionService"),JXe="languageDetection",nco="automaticlanguagedetection.likelywrong",rco="automaticlanguagedetection.stats";var CC=class extends Zh{constructor(e,t,o,n,r){super();this.modelService=e;this.languageService=t;this.languageDetectionService=o;this.accessibilityService=n;this.textEditorModelHandle=void 0;this.modelDisposeListener=this._register(new ue);this.autoDetectLanguageThrottler=this._register(new Aa(CC.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY));this._blockLanguageChangeListener=!1;this._languageChangeSource=void 0;r&&this.handleExistingModel(r)}static{this.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY=600}handleExistingModel(e){let t=this.modelService.getModel(e);if(!t)throw new Error(`Document with resource ${e.toString(!0)} does not exist`);this.textEditorModelHandle=e,this.registerModelDisposeListener(t)}registerModelDisposeListener(e){this.modelDisposeListener.value=e.onWillDispose(()=>{this.textEditorModelHandle=void 0,this.dispose()})}get textEditorModel(){return this.textEditorModelHandle?this.modelService.getModel(this.textEditorModelHandle):null}isReadonly(){return!0}get languageChangeSource(){return this._languageChangeSource}get hasLanguageSetExplicitly(){return typeof this._languageChangeSource=="string"}setLanguageId(e,t){this._languageChangeSource="user",this.setLanguageIdInternal(e,t)}setLanguageIdInternal(e,t){if(this.isResolved()&&!(!e||e===this.textEditorModel.getLanguageId())){this._blockLanguageChangeListener=!0;try{this.textEditorModel.setLanguage(this.languageService.createById(e),t)}finally{this._blockLanguageChangeListener=!1}}}installModelListeners(e){let t=this._register(e.onDidChangeLanguage(o=>{o.source===JXe||this._blockLanguageChangeListener||(this._languageChangeSource="api",t.dispose())}))}getLanguageId(){return this.textEditorModel?.getLanguageId()}autoDetectLanguage(){return this.autoDetectLanguageThrottler.trigger(()=>this.doAutoDetectLanguage())}async doAutoDetectLanguage(){if(this.hasLanguageSetExplicitly||!this.textEditorModelHandle||!this.languageDetectionService.isEnabledForLanguage(this.getLanguageId()??es))return;let e=await this.languageDetectionService.detectLanguage(this.textEditorModelHandle),t=this.getLanguageId();if(e&&e!==t&&!this.isDisposed()){this.setLanguageIdInternal(e,JXe);let o=this.languageService.getLanguageName(e);this.accessibilityService.alert(d(5553,null,o??e))}}createTextEditorModel(e,t,o){let n=this.getFirstLineText(e),r=this.getOrCreateLanguage(t,this.languageService,o,n);return this.doCreateTextEditorModel(e,r,t)}doCreateTextEditorModel(e,t,o){let n=o&&this.modelService.getModel(o);return n?this.updateTextEditorModel(e,t.languageId):(n=this.modelService.createModel(e,t,o),this.createdEditorModel=!0,this.registerModelDisposeListener(n)),this.textEditorModelHandle=n.uri,n}getFirstLineText(e){let t=e;return typeof t.getFirstLineText=="function"?t.getFirstLineText(1e3):e.getLineContent(1).substr(0,1e3)}getOrCreateLanguage(e,t,o,n){return!o||o===es?t.createByFilepathOrFirstLine(e??null,n):t.createById(o)}updateTextEditorModel(e,t,o){this.isResolved()&&(e&&this.modelService.updateModel(this.textEditorModel,e,o),t&&t!==es&&this.textEditorModel.getLanguageId()!==t&&this.textEditorModel.setLanguage(this.languageService.createById(t)))}createSnapshot(){return this.textEditorModel?this.textEditorModel.createSnapshot(!0):null}isResolved(){return!!this.textEditorModelHandle}dispose(){this.modelDisposeListener.dispose(),this.textEditorModelHandle&&this.createdEditorModel&&this.modelService.destroyModel(this.textEditorModelHandle),this.textEditorModelHandle=void 0,this.createdEditorModel=!1,super.dispose()}};CC=I([m(0,_t),m(1,Rt),m(2,jS),m(3,Ai)],CC);var qDe=class extends Zh{get originalModel(){return this._originalModel}get modifiedModel(){return this._modifiedModel}constructor(i,e){super(),this._originalModel=i,this._modifiedModel=e}async resolve(){await Promise.all([this._originalModel?.resolve(),this._modifiedModel?.resolve()])}isResolved(){return!!(this._originalModel?.isResolved()&&this._modifiedModel?.isResolved())}dispose(){super.dispose()}};var $De=class extends qDe{constructor(e,t){super(e,t);this._textDiffEditorModel=void 0;this._originalModel=e,this._modifiedModel=t,this.updateTextDiffEditorModel()}get originalModel(){return this._originalModel}get modifiedModel(){return this._modifiedModel}get textDiffEditorModel(){return this._textDiffEditorModel}async resolve(){await super.resolve(),this.updateTextDiffEditorModel()}updateTextDiffEditorModel(){this.originalModel?.isResolved()&&this.modifiedModel?.isResolved()&&(this._textDiffEditorModel?(this._textDiffEditorModel.original=this.originalModel.textEditorModel,this._textDiffEditorModel.modified=this.modifiedModel.textEditorModel):this._textDiffEditorModel={original:this.originalModel.textEditorModel,modified:this.modifiedModel.textEditorModel})}isResolved(){return!!this._textDiffEditorModel}isReadonly(){return!!this.modifiedModel&&this.modifiedModel.isReadonly()}dispose(){this._textDiffEditorModel=void 0,super.dispose()}};var Ba=class extends ja{constructor(e,t,o,n,r,s){super(e,t,o,n,s);this.original=o;this.modified=n;this.forceOpenAsBinary=r;this.cachedModel=void 0;this.labels=this.computeLabels()}static{this.ID="workbench.editors.diffEditorInput"}get typeId(){return Ba.ID}get editorId(){return this.modified.editorId===this.original.editorId?this.modified.editorId:void 0}get capabilities(){let e=super.capabilities;return this.labels.forceDescription&&(e|=64),e}computeLabels(){let e,t=!1;if(this.preferredName)e=this.preferredName;else{let p=this.original.getName(),h=this.modified.getName();e=d(5551,null,p,h),t=p===h}let o,n,r;if(this.preferredDescription)o=this.preferredDescription,n=this.preferredDescription,r=this.preferredDescription;else{o=this.computeLabel(this.original.getDescription(0),this.modified.getDescription(0)),r=this.computeLabel(this.original.getDescription(2),this.modified.getDescription(2));let p=this.original.getDescription(1),h=this.modified.getDescription(1);if(typeof p=="string"&&typeof h=="string"&&(p||h)){let[g,f]=rxe([p,h]);n=this.computeLabel(g,f)}}let s=this.computeLabel(this.original.getTitle(0)??this.original.getName(),this.modified.getTitle(0)??this.modified.getName()," \u2194 "),l=this.computeLabel(this.original.getTitle(1)??this.original.getName(),this.modified.getTitle(1)??this.modified.getName()," \u2194 "),c=this.computeLabel(this.original.getTitle(2)??this.original.getName(),this.modified.getTitle(2)??this.modified.getName()," \u2194 "),u=this.getPreferredTitle();return u&&(s=`${u} (${s})`,l=`${u} (${l})`,c=`${u} (${c})`),{name:e,shortDescription:o,mediumDescription:n,longDescription:r,forceDescription:t,shortTitle:s,mediumTitle:l,longTitle:c}}computeLabel(e,t,o=" - "){if(!(!e||!t))return e===t?t:`${e}${o}${t}`}getName(){return this.labels.name}getDescription(e=1){switch(e){case 0:return this.labels.shortDescription;case 2:return this.labels.longDescription;case 1:default:return this.labels.mediumDescription}}getTitle(e){switch(e){case 0:return this.labels.shortTitle;case 2:return this.labels.longTitle;default:case 1:return this.labels.mediumTitle}}async resolve(){let e=await this.createModel();return this.cachedModel?.dispose(),this.cachedModel=e,this.cachedModel}prefersEditorPane(e){return this.forceOpenAsBinary?e.find(t=>t.typeId===RMt):e.find(t=>t.typeId===hZ)}async createModel(){let[e,t]=await Promise.all([this.original.resolve(),this.modified.resolve()]);return t instanceof CC&&e instanceof CC?new $De(e,t):new qDe(bri(e)?e:void 0,bri(t)?t:void 0)}toUntyped(e){let t=super.toUntyped(e);if(t)return{...t,modified:t.primary,original:t.secondary}}matches(e){return this===e?!0:e instanceof Ba?this.modified.matches(e.modified)&&this.original.matches(e.original)&&e.forceOpenAsBinary===this.forceOpenAsBinary:Ug(e)?this.modified.matches(e.modified)&&this.original.matches(e.original):!1}dispose(){this.cachedModel&&(this.cachedModel.dispose(),this.cachedModel=void 0),super.dispose()}};Ba=I([m(5,ie)],Ba);var lNt=class extends XXe{createEditorInput(i,e,t,o,n){return i.createInstance(Ba,e,t,o,n,void 0)}};var LIi={LEFT:"left",RIGHT:"right",FIRST:"first",LAST:"last"};function ZXe(a){let i=a;return!!(i&&typeof i=="object"&&Array.isArray(i.editors)&&Array.isArray(i.mru))}function sco(a){let i=a;return i.kind===5&&i.editorIndex!==void 0}function aco(a){let i=a;return i.kind===7&&i.editorIndex!==void 0&&i.oldEditorIndex!==void 0}function lco(a){let i=a;return i.kind===6&&i.editorIndex!==void 0&&i.context!==void 0&&i.sticky!==void 0}var gN=class extends k{constructor(e,t,o){super();this.instantiationService=t;this.configurationService=o;this._onDidModelChange=this._register(new T({leakWarningThreshold:500,leakWarningName:"EditorGroupModel._onDidModelChange"}));this.onDidModelChange=this._onDidModelChange.event;this.editors=[];this.mru=[];this.editorListeners=new Set;this.locked=!1;this.selection=[];this.preview=null;this.sticky=-1;this.transient=new Set;ZXe(e)?this._id=this.deserialize(e):this._id=gN.IDS++,this.onConfigurationUpdated(),this.registerListeners()}static{this.IDS=0}get id(){return this._id}get active(){return this.selection[0]??null}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onConfigurationUpdated(e){e&&!e.affectsConfiguration("workbench.editor.openPositioning")&&!e.affectsConfiguration("workbench.editor.focusRecentEditorAfterClose")||(this.editorOpenPositioning=this.configurationService.getValue("workbench.editor.openPositioning"),this.focusRecentEditorAfterClose=this.configurationService.getValue("workbench.editor.focusRecentEditorAfterClose"))}get count(){return this.editors.length}get stickyCount(){return this.sticky+1}getEditors(e,t){let o=e===0?this.mru.slice(0):this.editors.slice(0);return t?.excludeSticky?e===0?o.filter(n=>!this.isSticky(n)):o.slice(this.sticky+1):o}getEditorByIndex(e){return this.editors[e]}get activeEditor(){return this.active}isActive(e){return this.matches(this.active,e)}get previewEditor(){return this.preview}openEditor(e,t){let o=t?.sticky||typeof t?.index=="number"&&this.isSticky(t.index),n=t?.pinned||t?.sticky,r=!!t?.transient,s=t?.active||!this.activeEditor||!n&&this.preview===this.activeEditor,l=this.findEditor(e,t);if(l){let[c,u]=l;return this.doSetTransient(c,u,r===!1?!1:this.isTransient(c)),n&&this.doPin(c,u),this.setSelection(s?c:this.activeEditor,t?.inactiveSelection??[]),t&&typeof t.index=="number"&&this.moveEditor(c,t.index),o&&this.doStick(c,this.indexOf(c)),{editor:c,isNew:!1}}else{let c=e,u=this.indexOf(this.active),p;if(t&&typeof t.index=="number"?p=t.index:this.editorOpenPositioning===LIi.FIRST?(p=0,!o&&this.isSticky(p)&&(p=this.sticky+1)):this.editorOpenPositioning===LIi.LAST?p=this.editors.length:(this.editorOpenPositioning===LIi.LEFT?u===0||!this.editors.length?p=0:p=u:p=u+1,!o&&this.isSticky(p)&&(p=this.sticky+1)),o&&(this.sticky++,this.isSticky(p)||(p=this.sticky)),(n||!this.preview)&&this.splice(p,!1,c),r&&this.doSetTransient(c,p,!0),!n){if(this.preview){let g=this.indexOf(this.preview);p>g&&p--,this.replaceEditor(this.preview,c,p,!s)}this.preview=c}this.registerEditorListeners(c);let h={kind:5,editor:c,editorIndex:p};return this._onDidModelChange.fire(h),this.setSelection(s?c:this.activeEditor,t?.inactiveSelection??[]),{editor:c,isNew:!0}}}registerEditorListeners(e){let t=new O;this.editorListeners.add(t),t.add(U.once(e.onWillDispose)(()=>{let o=this.editors.indexOf(e);if(o>=0){let n={kind:15,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}})),t.add(e.onDidChangeDirty(()=>{let o={kind:14,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(e.onDidChangeLabel(()=>{let o={kind:9,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(e.onDidChangeCapabilities(()=>{let o={kind:10,editor:e,editorIndex:this.editors.indexOf(e)};this._onDidModelChange.fire(o)})),t.add(this.onDidModelChange(o=>{o.kind===6&&o.editor?.matches(e)&&(je(t),this.editorListeners.delete(t))}))}replaceEditor(e,t,o,n=!0){let r=this.doCloseEditor(e,1,n);if(this.splice(o,!1,t),r){let s={kind:6,...r};this._onDidModelChange.fire(s)}}closeEditor(e,t=0,o=!0){let n=this.doCloseEditor(e,t,o);if(n){let r={kind:6,...n};return this._onDidModelChange.fire(r),n}}doCloseEditor(e,t,o){let n=this.indexOf(e);if(n===-1)return;let r=this.editors[n],s=this.isSticky(n),l=this.active===r;if(o&&l)if(this.mru.length>1){let c;this.focusRecentEditorAfterClose?c=this.mru[1]:n===this.editors.length-1?c=this.editors[n-1]:c=this.editors[n+1];let u=this.selection.filter(p=>p!==r&&p!==c);this.doSetSelection(c,this.editors.indexOf(c),u)}else this.doSetSelection(null,void 0,[]);else if(!l&&this.doIsSelected(r)){let c=this.selection.filter(u=>u!==r&&u!==this.activeEditor);this.doSetSelection(this.activeEditor,this.indexOf(this.activeEditor),c)}return this.preview===r&&(this.preview=null),this.transient.delete(r),this.splice(n,!0),{editor:r,sticky:s,editorIndex:n,context:t}}moveEditor(e,t){t>=this.editors.length?t=this.editors.length-1:t<0&&(t=0);let o=this.indexOf(e);if(o<0||t===o)return;let n=this.editors[o],r=this.sticky;this.isSticky(o)&&t>this.sticky?this.sticky--:!this.isSticky(o)&&t<=this.sticky&&this.sticky++,this.editors.splice(o,1),this.editors.splice(t,0,n);let s={kind:7,editor:n,oldEditorIndex:o,editorIndex:t};if(this._onDidModelChange.fire(s),r!==this.sticky){let l={kind:13,editor:n,editorIndex:t};this._onDidModelChange.fire(l)}return n}setActive(e){let t;return e?t=this.setEditorActive(e):this.setGroupActive(),t}setGroupActive(){this._onDidModelChange.fire({kind:0})}setEditorActive(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doSetSelection(o,n,[]),o}get selectedEditors(){return this.editors.filter(e=>this.doIsSelected(e))}isSelected(e){let t;return typeof e=="number"?t=this.editors[e]:t=this.findEditor(e)?.[0],!!t&&this.doIsSelected(t)}doIsSelected(e){return this.selection.includes(e)}setSelection(e,t){let o=this.findEditor(e);if(!o)return;let[n,r]=o,s=new Set;for(let l of t){let c=this.findEditor(l);if(!c)return;let[u]=c;u!==n&&s.add(u)}this.doSetSelection(n,r,Array.from(s))}doSetSelection(e,t,o){let n=this.activeEditor,r=this.selection,s;e?s=[e,...o]:s=[],this.selection=s;let l=e&&typeof t=="number"&&n!==e;if(l){let c=this.indexOf(e,this.mru);this.mru.splice(c,1),this.mru.unshift(e);let u={kind:8,editor:e,editorIndex:t};this._onDidModelChange.fire(u)}if(l||r.length!==s.length||r.some(c=>!s.includes(c))){let c={kind:4};this._onDidModelChange.fire(c)}}setIndex(e){this._onDidModelChange.fire({kind:1})}setLabel(e){this._onDidModelChange.fire({kind:2})}pin(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doPin(o,n),o}doPin(e,t){if(this.isPinned(e))return;this.setTransient(e,!1),this.preview=null;let o={kind:11,editor:e,editorIndex:t};this._onDidModelChange.fire(o)}unpin(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doUnpin(o,n),o}doUnpin(e,t){if(!this.isPinned(e))return;let o=this.preview;this.preview=e;let n={kind:11,editor:e,editorIndex:t};this._onDidModelChange.fire(n),o&&this.closeEditor(o,3)}isPinned(e){let t;return typeof e=="number"?t=this.editors[e]:t=e,!this.matches(this.preview,t)}stick(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doStick(o,n),o}doStick(e,t){if(this.isSticky(t))return;this.pin(e);let o=this.sticky+1;this.moveEditor(e,o),this.sticky++;let n={kind:13,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}unstick(e){let t=this.findEditor(e);if(!t)return;let[o,n]=t;return this.doUnstick(o,n),o}doUnstick(e,t){if(!this.isSticky(t))return;let o=this.sticky;this.moveEditor(e,o),this.sticky--;let n={kind:13,editor:e,editorIndex:o};this._onDidModelChange.fire(n)}isSticky(e){if(this.sticky<0)return!1;let t;return typeof e=="number"?t=e:t=this.indexOf(e),t<0?!1:t<=this.sticky}setTransient(e,t){if(!t&&this.transient.size===0)return;let o=this.findEditor(e);if(!o)return;let[n,r]=o;return this.doSetTransient(n,r,t),n}doSetTransient(e,t,o){if(o){if(this.transient.has(e))return;this.transient.add(e)}else{if(!this.transient.has(e))return;this.transient.delete(e)}let n={kind:12,editor:e,editorIndex:t};this._onDidModelChange.fire(n)}isTransient(e){if(this.transient.size===0)return!1;let t;return typeof e=="number"?t=this.editors[e]:t=this.findEditor(e)?.[0],!!t&&this.transient.has(t)}splice(e,t,o){let n=this.editors[e];if(t&&this.isSticky(e)&&this.sticky--,o?this.editors.splice(e,t?1:0,o):this.editors.splice(e,t?1:0),!t&&o)this.mru.length===0?this.mru.push(o):this.mru.splice(1,0,o);else{let r=this.indexOf(n,this.mru);t&&!o?this.mru.splice(r,1):t&&o&&this.mru.splice(r,1,o)}}indexOf(e,t=this.editors,o){let n=-1;if(!e)return n;for(let r=0;r<t.length;r++){let s=t[r];if(this.matches(s,e,o))if(o?.supportSideBySide&&s instanceof ja&&!(e instanceof ja))n=r;else{n=r;break}}return n}findEditor(e,t){let o=this.indexOf(e,this.editors,t);if(o!==-1)return[this.editors[o],o]}isFirst(e,t=this.editors){return this.matches(t[0],e)}isLast(e,t=this.editors){return this.matches(t[t.length-1],e)}contains(e,t){return this.indexOf(e,this.editors,t)!==-1}matches(e,t,o){if(!e||!t)return!1;if(o?.supportSideBySide&&e instanceof ja&&!(t instanceof ja))switch(o.supportSideBySide){case 4:if(this.matches(e.primary,t,o)||this.matches(e.secondary,t,o))return!0;break;case 3:if(this.matches(e.primary,t,o)&&this.matches(e.secondary,t,o))return!0;break}let n=e===t;return o?.strictEquals?n:n||e.matches(t)}get isLocked(){return this.locked}lock(e){this.isLocked!==e&&(this.locked=e,this._onDidModelChange.fire({kind:3}))}clone(){let e=this.instantiationService.createInstance(gN,void 0);e.editors=this.editors.slice(0),e.mru=this.mru.slice(0),e.preview=this.preview,e.selection=this.selection.slice(0),e.sticky=this.sticky;for(let t of e.editors)e.registerEditorListeners(t);return e}serialize(){let e=oe.as(en.EditorFactory),t=[],o=[],n,r=this.sticky;for(let l=0;l<this.editors.length;l++){let c=this.editors[l],u=!1,p=e.getEditorSerializer(c);if(p){let h=p.canSerialize(c)?p.serialize(c):void 0;typeof h=="string"?(u=!0,o.push({id:c.typeId,value:h}),t.push(c),this.preview===c&&(n=t.length-1)):u=!1}!u&&this.isSticky(l)&&r--}let s=this.mru.map(l=>this.indexOf(l,t)).filter(l=>l>=0);return{id:this.id,locked:this.locked?!0:void 0,editors:o,mru:s,preview:n,sticky:r>=0?r:void 0}}deserialize(e){let t=oe.as(en.EditorFactory);return typeof e.id=="number"?(this._id=e.id,gN.IDS=Math.max(e.id+1,gN.IDS)):this._id=gN.IDS++,e.locked&&(this.locked=!0),this.editors=ui(e.editors.map((o,n)=>{let r,s=t.getEditorSerializer(o.id);if(s){let l=s.deserialize(this.instantiationService,o.value);l instanceof Ls&&(r=l,this.registerEditorListeners(r))}return!r&&typeof e.sticky=="number"&&n<=e.sticky&&e.sticky--,r})),this.mru=ui(e.mru.map(o=>this.editors[o])),this.selection=this.mru.length>0?[this.mru[0]]:[],typeof e.preview=="number"&&(this.preview=this.editors[e.preview]),typeof e.sticky=="number"&&(this.sticky=e.sticky),this._id}dispose(){je(Array.from(this.editorListeners)),this.editorListeners.clear(),this.transient.clear(),super.dispose()}};gN=I([m(1,F),m(2,B)],gN);var aee=class extends CC{constructor(i,e,t,o,n){super(t,e,o,n,i)}dispose(){this.textEditorModelHandle&&this.modelService.destroyModel(this.textEditorModelHandle),super.dispose()}};aee=I([m(1,Rt),m(2,_t),m(3,jS),m(4,Ai)],aee);var IE=class extends gZ{constructor(e,t,o,n,r,s,l,c,u){super(e,t,r,s,l,c,u);this.editorService=o;this.textFileService=n}save(e,t){return this.resource.scheme!==Q.untitled&&!this.fileService.hasProvider(this.resource)?this.saveAs(e,t):this.doSave(t,!1,e)}saveAs(e,t){return this.doSave(t,!0,e)}async doSave(e,t,o){let n;if(t?n=await this.textFileService.saveAs(this.resource,void 0,{...e,suggestedTarget:this.preferredResource}):n=await this.textFileService.save(this.resource,e),!!n)return{resource:n}}async revert(e,t){await this.textFileService.revert(this.resource,t)}};IE=I([m(2,ie),m(3,Uo),m(4,nt),m(5,ge),m(6,fr),m(7,Gn),m(8,nb)],IE);var Vx=class extends IE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,void 0,c,l,p,u,h,g,f);this.name=t;this.description=o;this.preferredLanguageId=n;this.preferredContents=r;this.textModelService=s;this.cachedModel=void 0;this.modelReference=void 0}static{this.ID="workbench.editors.resourceEditorInput"}get typeId(){return Vx.ID}get editorId(){return Da.id}getName(){return this.name||super.getName()}setName(e){this.name!==e&&(this.name=e,this._onDidChangeLabel.fire())}getDescription(){return this.description}setDescription(e){this.description!==e&&(this.description=e,this._onDidChangeLabel.fire())}setLanguageId(e,t){this.setPreferredLanguageId(e),this.cachedModel?.setLanguageId(e,t)}setPreferredLanguageId(e){this.preferredLanguageId=e}setPreferredContents(e){this.preferredContents=e}async resolve(){let e=this.preferredContents,t=this.preferredLanguageId;this.preferredContents=void 0,this.preferredLanguageId=void 0,this.modelReference||(this.modelReference=this.textModelService.createModelReference(this.resource));let o=await this.modelReference,n=o.object;if(!(n instanceof aee))throw o.dispose(),this.modelReference=void 0,new Error(`Unexpected model for TextResourceEditorInput: ${this.resource}`);return this.cachedModel=n,(typeof e=="string"||typeof t=="string")&&n.updateTextEditorModel(typeof e=="string"?t4(e):void 0,t),n}matches(e){return this===e?!0:e instanceof Vx?ze(e.resource,this.resource):zg(e)?super.matches(e):!1}dispose(){this.modelReference&&(this.modelReference.then(e=>e.dispose()),this.modelReference=void 0),this.cachedModel=void 0,super.dispose()}};Vx=I([m(5,Bt),m(6,Uo),m(7,ie),m(8,ge),m(9,nt),m(10,fr),m(11,Gn),m(12,nb)],Vx);var tYo=Oe("chat-editor-label-icon",L.chatSparkle,d(9219,null)),tl=class extends Ls{constructor(e,t,o,n,r,s){super();this.resource=e;this.options=t;this.chatService=o;this.dialogService=n;this.chatSessionsService=r;this.instantiationService=s;this.didTransferOutEditingSession=!1;this.modelRef=this._register(new ue);this._modelChangeListener=this._register(new ue);this.closeHandler=this;if(e.scheme===Q.vscodeChatEditor){let l=PIi.parse(e);if(!l||typeof l!="number")throw new Error("Invalid chat URI")}else if(e.scheme===Q.vscodeLocalChatSession){if(!Br.parseLocalSessionId(e))throw new Error("Invalid local chat session URI");this._sessionResource=e}else this._sessionResource=e}static{this.TypeID="workbench.input.chatSession"}static{this.EditorID="workbench.editor.chatSession"}get sessionResource(){return this._sessionResource}get model(){return this.modelRef.value?.object}static getNewEditorUri(){return PIi.getNewEditorUri()}showConfirm(){return!!(this.model&&cco(this.model))}transferOutEditingSession(){return this.didTransferOutEditingSession=!0,this.model?.editingSession}async confirm(e){if(!this.model?.editingSession||this.didTransferOutEditingSession||this.getSessionType()!==kl)return 0;let t=d(9218,null),o=d(9215,null);return await eJe(this.model,this.dialogService,{titleOverride:t,messageOverride:o})?0:2}get editorId(){return tl.EditorID}get capabilities(){return super.capabilities|1024|128}copy(){return this.instantiationService.createInstance(tl,tl.getNewEditorUri(),{})}matches(e){return e instanceof tl?ze(this.sessionResource,e.sessionResource):!1}get typeId(){return tl.TypeID}getName(){if(this.model?.title)return this.model.hasCustomTitle?this.model.title:tF(this.model.title,sao);if(this._sessionResource){let e=this.chatService.getSession(this._sessionResource);if(e?.title)return e.title;let t=this.chatService.getSessionTitle(this._sessionResource);if(t&&t.trim())return t}return this.options.title?.preferred?this.options.title.preferred:this.options.title?.fallback??d(9220,null)}getTitle(e){let t=this.getName();if(e===2){let o=this.getSessionTypeDisplayName();if(o)return`${t} | ${o}`}return t}getSessionTypeDisplayName(){let e=this.getSessionType();return e===kl?void 0:this.chatSessionsService.getAllChatSessionContributions().find(n=>n.type===e)?.displayName}getIcon(){let e=this.resolveIcon();return e?(this.cachedIcon=e,e):tYo}resolveIcon(){let e=this.getSessionType();if(e!==kl)return this.chatSessionsService.getChatSessionContribution(e)?.icon}getSessionType(){return yn(this.resource)}async resolve(){let o=new URLSearchParams(this.resource.query).get("chatSessionType")??this.resource.authority;if(this._sessionResource?(this.modelRef.value=await this.chatService.acquireOrLoadSession(this._sessionResource,"panel",Ie.None,"ChatEditorInput#resolve"),!this.model&&Br.parseLocalSessionId(this._sessionResource)&&(this.modelRef.value=this.chatService.startNewLocalSession("panel",{canUseTools:!0,debugOwner:"ChatEditorInput#resolveNewLocalSession"}))):this.options.target?this.options.target.data&&(this.modelRef.value=this.chatService.loadSessionFromData(this.options.target.data,"ChatEditorInput#resolveImportedData")):this.modelRef.value=this.chatService.startNewLocalSession("panel",{canUseTools:!o,debugOwner:"ChatEditorInput#resolveUntitled"}),!this.model||this.isDisposed())return null;this._sessionResource=this.model.sessionResource,this._trackModelChanges();let n=this.resolveIcon();return n&&(!this.cachedIcon||!this.iconsEqual(this.cachedIcon,n))&&(this.cachedIcon=n),this._onDidChangeLabel.fire(),this._register(new MIi(this.model))}updateModel(e){this._sessionResource=e.sessionResource,this.modelRef.value=this.chatService.acquireExistingSession(e.sessionResource,"ChatEditorInput#updateModel"),this._trackModelChanges(),this.cachedIcon=void 0,this._onDidChangeLabel.fire()}_trackModelChanges(){this.model&&(this._modelChangeListener.value=this.model.onDidChange(()=>{this.cachedIcon=void 0,this._onDidChangeLabel.fire()}))}iconsEqual(e,t){return q.isThemeIcon(e)&&q.isThemeIcon(t)?e.id===t.id:e instanceof A&&t instanceof A?e.toString()===t.toString():!1}};tl=I([m(2,si),m(3,ct),m(4,Ms),m(5,F)],tl);var MIi=class extends k{constructor(e){super();this.model=e;this._isResolved=!1}async resolve(){this._isResolved=!0}isResolved(){return this._isResolved}isDisposed(){return this._store.isDisposed}},PIi;(t=>{let a=Q.vscodeChatEditor;function i(){let o=Math.floor(Math.random()*1e9);return A.from({scheme:a,path:`chat-${o}`})}t.getNewEditorUri=i;function e(o){if(o.scheme!==a)return;let r=o.path.match(/chat-(\d+)/)?.[1];if(typeof r!="string")return;let s=parseInt(r);if(!isNaN(s))return s}t.parse=e})(PIi||={});var cNt=class{canSerialize(i){return i instanceof tl&&!!i.sessionResource}serialize(i){if(!this.canSerialize(i))return;let e={options:i.options,sessionResource:i.sessionResource,resource:i.resource};return JSON.stringify(e)}deserialize(i,e){try{let t=er(JSON.parse(e));if(t.sessionResource){let n=A.revive(t.sessionResource);return i.createInstance(tl,n,t.options)}let o=A.revive(t.resource);return o.scheme===Q.vscodeChatEditor&&t.sessionId&&(o=Br.forSession(t.sessionId)),i.createInstance(tl,o,t.options)}catch{return}}};async function eJe(a,i,e){let t=cco(a,e);if(!t)return!0;let o=d(9216,null),n=d(9217,null),r=e?.messageOverride??o,s=e?.titleOverride??n,{result:l}=await i.prompt({title:s,message:r+" "+d(9214,null,t),type:"info",cancelButton:!0,buttons:[{label:d(9212,null),run:async()=>(await a.editingSession.accept(),!0)},{label:d(9213,null),run:async()=>(await a.editingSession.reject(),!0)}]});return!!l}function cco(a,i){return!a.editingSession||a.willKeepAlive&&!i?.isArchiveAction?0:a.editingSession.entries.get().filter(o=>o.state.get()===0).length}var uNt=Object.freeze({id:"application",order:100,title:d(5455,null),type:"object"}),jd=Object.freeze({id:"workbench",order:7,title:d(5463,null),type:"object"}),tJe=Object.freeze({id:"security",scope:1,title:d(5461,null),type:"object",order:7}),pNt=Object.freeze({id:"problems",title:d(5457,null),type:"object",order:101}),NIi=Object.freeze({id:"window",order:8,title:d(5462,null),type:"object"}),fm={ConfigurationMigration:"base.contributions.configuration.migration"},AIi=class{constructor(){this.migrations=[];this._onDidRegisterConfigurationMigrations=new T;this.onDidRegisterConfigurationMigration=this._onDidRegisterConfigurationMigrations.event}registerConfigurationMigrations(i){this.migrations.push(...i)}},dNt=new AIi;oe.add(fm.ConfigurationMigration,dNt);var tme=class extends k{constructor(e,t){super();this.configurationService=e;this.workspaceService=t;this._register(this.workspaceService.onDidChangeWorkspaceFolders(async o=>{for(let n of o.added)await this.migrateConfigurationsForFolder(n,dNt.migrations)})),this.migrateConfigurations(dNt.migrations),this._register(dNt.onDidRegisterConfigurationMigration(o=>this.migrateConfigurations(o)))}static{this.ID="workbench.contrib.configurationMigration"}async migrateConfigurations(e){await this.migrateConfigurationsForFolder(void 0,e);for(let t of this.workspaceService.getWorkspace().folders)await this.migrateConfigurationsForFolder(t,e)}async migrateConfigurationsForFolder(e,t){await Promise.all([t.map(o=>this.migrateConfigurationsForFolderAndOverride(o,e?.uri))])}async migrateConfigurationsForFolderAndOverride(e,t){let o=this.configurationService.inspect(e.key,{resource:t}),n=this.workspaceService.getWorkbenchState()===3?[["user",2],["userLocal",3],["userRemote",4],["workspace",5],["workspaceFolder",6]]:[["user",2],["userLocal",3],["userRemote",4],["workspace",5]];for(let[r,s]of n){let l=o[r];if(!l)continue;let c=[];if(l.value!==void 0){let u=await this.runMigration(e,r,l.value,t,void 0);for(let p of u??[])c.push([p,[]])}for(let{identifiers:u,value:p}of l.overrides??[])if(p!==void 0){let h=await this.runMigration(e,r,p,t,u);for(let g of h??[])c.push([g,u])}c.length&&await Promise.allSettled(c.map(async([[u,p],h])=>this.configurationService.updateValue(u,p.value,{resource:t,overrideIdentifiers:h},s)))}}async runMigration(e,t,o,n,r){let s=c=>{let p=this.configurationService.inspect(c,{resource:n})[t];if(p)return r?p.overrides?.find(({identifiers:h})=>Qi(h,r))?.value:p.value},l=await e.migrateFn(o,s);return Array.isArray(l)?l:[[e.key,l]]}};tme=I([m(0,B),m(1,Ae)],tme);var z3=class extends k{constructor(e){super();this.remoteAgentService=e;this._ready=new Mo;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(!ii&&(await this.remoteAgentService.getEnvironment())?.os!==1)return;oe.as($t.Configuration).registerConfiguration({...tJe,properties:{"security.allowedUNCHosts":{type:"array",items:{type:"string",pattern:"^[^\\\\]+$",patternErrorMessage:d(5459,null)},default:[],markdownDescription:d(5458,null),scope:3},"security.restrictUNCAccess":{type:"boolean",default:!0,markdownDescription:d(5460,null),scope:3}}})}};z3=I([m(0,bo)],z3);var fN="window.newWindowProfile",ime=class extends k{constructor(e,t){super();this.userDataProfilesService=e;this.configurationService=t;this.registerNewWindowProfileConfiguration(),this._register(this.userDataProfilesService.onDidChangeProfiles(o=>this.registerNewWindowProfileConfiguration())),this.setNewWindowProfile(),this.checkAndResetNewWindowProfileConfig(),this._register(t.onDidChangeConfiguration(o=>{o.source!==7&&o.affectsConfiguration(fN)&&this.setNewWindowProfile()})),this._register(this.userDataProfilesService.onDidChangeProfiles(()=>this.checkAndResetNewWindowProfileConfig()))}static{this.ID="workbench.contrib.dynamicWindowConfiguration"}registerNewWindowProfileConfiguration(){let e=oe.as($t.Configuration),t={...NIi,properties:{[fN]:{type:["string","null"],default:null,enum:[...this.userDataProfilesService.profiles.map(o=>o.name),null],enumItemLabels:[...this.userDataProfilesService.profiles.map(()=>""),d(5454,null)],description:d(5456,null),scope:1}}};this.configurationNode?e.updateConfigurations({add:[t],remove:[this.configurationNode]}):e.registerConfiguration(t),this.configurationNode=t}setNewWindowProfile(){let e=this.configurationService.getValue(fN);this.newWindowProfile=e?this.userDataProfilesService.profiles.find(t=>t.name===e):void 0}checkAndResetNewWindowProfileConfig(){let e=this.configurationService.getValue(fN);if(!e)return;let t=this.newWindowProfile?this.userDataProfilesService.profiles.find(o=>o.id===this.newWindowProfile.id):void 0;e!==t?.name&&this.configurationService.updateValue(fN,t?.name)}};ime=I([m(0,hn),m(1,B)],ime);var il=le("editorResolverService"),iG="workbench.editorAssociations",lee="workbench.diffEditorAssociations",OIi=Object.freeze({"*.md":"vscode.markdown.preview.editor"}),iYo=oe.as($t.Configuration),oYo={...jd,properties:{[iG]:{type:"object",markdownDescription:d(18843,null),additionalProperties:{type:"string"},agentsWindow:{default:OIi}},[lee]:{type:"object",markdownDescription:d(18842,null),additionalProperties:{type:"string"}}}};iYo.registerConfiguration(oYo);function ome(a){return typeof a!="string"?a:{editor:a,diff:a,merge:a}}function GM(a){switch(a){case"exclusive":return 5;case"default":return 4;case"builtin":return 3;default:return 1}}function cee(a,i){if(new Set([Q.extension,Q.webviewPanel,Q.vscodeWorkspaceTrust,Q.vscodeSettings]).has(i.scheme))return!1;let o=typeof a=="string"&&a.indexOf(Vo.sep)>=0?`${i.scheme}:${i.path}`:Be(i);return qd(a,o,{ignoreCase:!0})}var FH=le("customEditorService"),dco=new Y("activeCustomEditorId","",{type:"string",description:d(10380,null)}),uco=new Y("focusedCustomEditorIsEditable",!1);var iJe=class{constructor(i){this.id=i.id,this.displayName=i.displayName,this.providerDisplayName=i.providerDisplayName,this.priority=i.priority,this.selector=i.selector}matches(i){return this.selector.some(e=>e.filenamePattern&&cee(e.filenamePattern,i))}},jDe=class{constructor(i){this.allEditors=jo(i,e=>e.id)}get length(){return this.allEditors.length}get defaultEditor(){return this.allEditors.find(i=>{switch(i.priority.editor){case"default":case"builtin":return this.allEditors.every(e=>e===i||nYo(e,i));default:return!1}})}get bestAvailableEditor(){return Array.from(this.allEditors).sort((e,t)=>GM(e.priority.editor)-GM(t.priority.editor))[0]}};function nYo(a,i){return GM(a.priority.editor)<GM(i.priority.editor)}var dee=class extends k{constructor(i,e){super();let t=()=>{e()?.windowDidDragStart()},o=()=>{e()?.windowDidDragEnd()};this._register($(i,ne.DRAG_START,()=>{t()})),this._register($(i,ne.DRAG_END,o)),this._register($(i,ne.MOUSE_MOVE,n=>{n.buttons===0&&o()})),this._register($(i,ne.DRAG,n=>{n.shiftKey?o():t()})),this._register($(i,ne.DRAG_OVER,n=>{n.shiftKey?o():t()}))}};var up=class extends Ls{constructor(e,t,o){super();this._themeService=o;this._resourceId=ht();this._hasTransfered=!1;this.viewType=e.viewType,this.providerId=e.providedId,this._webviewTitle=e.name,this._iconPath=e.iconPath,this._webview=t,this._register(o.onDidColorThemeChange(()=>{this._onDidChangeLabel.fire()}))}static{this.typeId="workbench.editors.webviewInput"}get typeId(){return up.typeId}get editorId(){return this.viewType}get capabilities(){return 138}get resource(){return A.from({scheme:Q.webviewPanel,path:`webview-panel/webview-${this.providerId}-${this._resourceId}`})}dispose(){this.isDisposed()||this._hasTransfered||this._webview?.dispose(),super.dispose()}getName(){return this._webviewTitle}getTitle(e){return this.getName()}getDescription(){}setWebviewTitle(e){this._webviewTitle=e,this.webview.setTitle(e),this._onDidChangeLabel.fire()}getWebviewTitle(){return this._webviewTitle}get webview(){return this._webview}get extension(){return this.webview.extension}getIcon(){if(this._iconPath)return q.isThemeIcon(this._iconPath)?this._iconPath:cm(this._themeService.getColorTheme().type)?this._iconPath.dark:this._iconPath.light??this._iconPath.dark}get iconPath(){return this._iconPath}set iconPath(e){this._iconPath=e,this._onDidChangeLabel.fire()}matches(e){return super.matches(e)||e===this}get group(){return this._group}updateGroup(e){this._group=e}transfer(e){if(!this._hasTransfered)return this._hasTransfered=!0,e._webview=this._webview,e}claim(e,t,o){return this._webview.claim(e,t,o)}};up=I([m(2,Pe)],up);var ti=le("hostService");var wi=Kl;function eg(a){return a===2||a===3}function Bx(a){switch(a){case 0:return"left";case 1:return"right";case 2:return"bottom";case 3:return"top";default:return"bottom"}}var rYo={[Bx(0)]:0,[Bx(1)]:1,[Bx(2)]:2,[Bx(3)]:3};function nme(a){return rYo[a]}function FIi(a){switch(a){case 0:return"always";case 1:return"never";case 2:return"preserve";default:return"preserve"}}var sYo={[FIi(0)]:0,[FIi(1)]:1,[FIi(2)]:2};function mco(a){return sYo[a]}function hco(a){return a==="workbench.parts.editor"||a==="workbench.parts.statusbar"||a==="workbench.parts.titlebar"}function WH(a,i,e){if(!JF(a))return!1;let t=rx(i),o=yx(a);if(!Ft){let r=a.getValue("window.customTitleBarVisibility");if(r==="never"&&o||r==="windowed"&&t)return!1}if(!aYo(a))return!0;if(o&&XF(a))return!1;if(et&&Qr)return!t;if(Qr&&!t||_le()&&!t)return!0;switch(fI(i)?"hidden":sM(a)){case"classic":return!t||!!e;case"compact":case"hidden":return!1;case"toggle":return!!e;case"visible":return!0;default:return Ft?!1:!t||!!e}}function aYo(a){if(a.getValue("window.commandCenter"))return!1;let i=a.getValue("workbench.activityBar.location");if(i==="top"||i==="bottom")return!1;let e=a.getValue("workbench.editor.editorActionsLocation"),t=a.getValue("workbench.editor.showTabs");return!(e==="titleBar"||e==="default"&&t==="none"||a.getValue("workbench.layoutControl.enabled"))}var gco=new Y("activeWebviewPanelId","",{type:"string",description:d(17834,null)}),qM=class extends zs{constructor(e,t,o,n,r,s,l,c,u){super(qM.ID,e,t,o,n);this._editorGroupsService=r;this._editorService=s;this._workbenchLayoutService=l;this._hostService=c;this._contextKeyService=u;this._visible=!1;this._isDisposed=!1;this._webviewVisibleDisposables=this._register(new O);this._onFocusWindowHandler=this._register(new ue);this._onDidFocusWebview=this._register(new T);this._scopedContextKeyService=this._register(new ue)}static{this.ID="WebviewEditor"}get onDidFocus(){return this._onDidFocusWebview.event}get webview(){return this.input instanceof up?this.input.webview:void 0}get scopedContextKeyService(){return this._scopedContextKeyService.value}createEditor(e){let t=document.createElement("div");this._element=t,this._element.id=`webview-editor-element-${ht()}`,e.appendChild(t),this._scopedContextKeyService.value=this._register(this._contextKeyService.createScoped(t))}dispose(){this._isDisposed=!0,this._element?.remove(),this._element=void 0,super.dispose()}layout(e){this.setEditorVisible(e.width>0&&e.height>0)}focus(){super.focus(),!this._onFocusWindowHandler.value&&!Ft&&(this._onFocusWindowHandler.value=this._hostService.onDidChangeFocus(e=>{e&&this._editorService.activeEditorPane===this&&this._workbenchLayoutService.hasFocus("workbench.parts.editor")&&this.focus()})),this.webview?.focus()}setEditorVisible(e){e!==this._visible&&(this._visible=e,this.input instanceof up&&this.webview&&(e?this.claimWebview(this.input):this.webview.release(this)),super.setEditorVisible(e))}clearInput(){this.webview&&(this.webview.release(this),this._webviewVisibleDisposables.clear()),super.clearInput()}async setInput(e,t,o,n){if(this.input&&e.matches(this.input))return;let r=e instanceof up&&e.webview===this.webview;this.webview&&!r&&this.webview.release(this),await super.setInput(e,t,o,n),await e.resolve(),!(n.isCancellationRequested||this._isDisposed)&&e instanceof up&&(e.updateGroup(this.group.id),r||this.claimWebview(e))}claimWebview(e){e.claim(this,this.window,this.scopedContextKeyService),this._element&&(this._element.setAttribute("aria-flowto",e.webview.container.id),AL(e.webview.container,this._element));let t=this._editorGroupsService.activeModalEditorPart?.modalElement,o=go(t)&&this._element&&t.contains(this._element);this._clippingContainer=o?void 0:this._workbenchLayoutService.getContainer(this.window,"workbench.parts.editor"),this._webviewVisibleDisposables.clear(),this._webviewVisibleDisposables.add(this._editorGroupsService.createEditorDropTarget(e.webview.container,{containsGroup:n=>this.group.id===n.id})),this._webviewVisibleDisposables.add(new dee(this.window,()=>this.webview)),this.setWebviewAnchorElement(e.webview),this._webviewVisibleDisposables.add(this.trackFocus(e.webview))}setWebviewAnchorElement(e){this._element?.isConnected&&e.setAnchorElement(this._element.parentElement,this._clippingContainer)}trackFocus(e){let t=new O,o=nr(e.container);return t.add(o),t.add(o.onDidFocus(()=>this._onDidFocusWebview.fire())),t.add(e.onDidFocus(()=>this._onDidFocusWebview.fire())),t}};qM=I([m(1,_e),m(2,Pe),m(3,de),m(4,kt),m(5,ie),m(6,wi),m(7,ti),m(8,X)],qM);var Hx=le("webviewEditorService");function hNt(a,i){return a.canResolve(i)}var X0=class extends up{constructor(e,t,o,n){super(e,t,o);this._webviewWorkbenchService=n;this._resolved=!1}dispose(){super.dispose(),this._resolvePromise?.cancel(),this._resolvePromise=void 0}async resolve(){if(!this._resolved){this._resolved=!0,this._resolvePromise=Hn(e=>this._webviewWorkbenchService.resolveWebview(this,e));try{await this._resolvePromise}catch(e){if(!Yi(e))throw e}}return super.resolve()}transfer(e){if(super.transfer(e))return e._resolved=this._resolved,e}};I([bi],X0.prototype,"resolve",1),X0=I([m(2,Pe),m(3,Hx)],X0);var WIi=class{constructor(){this._awaitingRevival=[]}enqueueForRestoration(i,e){let t=new Mo,o=()=>{let r=this._awaitingRevival.findIndex(s=>i===s.input);r>=0&&this._awaitingRevival.splice(r,1)},n=Fn(i.webview.onDidDispose(o),e.onCancellationRequested(()=>{o(),t.cancel()}));return this._awaitingRevival.push({input:i,promise:t,disposable:n}),t.p}reviveFor(i,e){let t=this._awaitingRevival.filter(({input:o})=>hNt(i,o));this._awaitingRevival=this._awaitingRevival.filter(({input:o})=>!hNt(i,o));for(let{input:o,promise:n,disposable:r}of t)i.resolveWebview(o,e).then(s=>n.complete(s),s=>n.error(s)).finally(()=>{r.dispose()})}},QDe=class extends k{constructor(e,t,o,n){super();this._editorService=t;this._instantiationService=o;this._webviewService=n;this._revivers=new Set;this._revivalPool=new WIi;this._onDidChangeActiveWebviewEditor=this._register(new T);this.onDidChangeActiveWebviewEditor=this._onDidChangeActiveWebviewEditor.event;this._register(e.registerContextKeyProvider({contextKey:gco,getGroupContextKeyValue:r=>this.getWebviewId(r.activeEditor)})),this._register(t.onDidActiveEditorChange(()=>{this.updateActiveWebview()})),this._register(n.onDidChangeActiveWebview(()=>{this.updateActiveWebview()})),this.updateActiveWebview()}getWebviewId(e){let t;return e instanceof up?t=e:e instanceof Ba&&(e.primary instanceof up?t=e.primary:e.secondary instanceof up&&(t=e.secondary)),t?.webview.providedViewType??""}updateActiveWebview(){let e=this._editorService.activeEditor,t;e instanceof up?t=e:e instanceof Ba&&(e.primary instanceof up&&e.primary.webview===this._webviewService.activeWebview?t=e.primary:e.secondary instanceof up&&e.secondary.webview===this._webviewService.activeWebview&&(t=e.secondary)),t!==this._activeWebview&&(this._activeWebview=t,this._onDidChangeActiveWebviewEditor.fire(t))}openWebview(e,t,o,n,r){let s=this._webviewService.createWebviewOverlay(e),l=this._instantiationService.createInstance(up,{viewType:t,name:o,providedId:e.providedViewType,iconPath:n},s);return this._editorService.openEditor(l,{pinned:!0,preserveFocus:r.preserveFocus,activation:r.preserveFocus?2:void 0},r.group),l}revealWebview(e,t,o){let n=this.findTopLevelEditorForWebview(e);this._editorService.openEditor(n,{preserveFocus:o,activation:o?2:void 0},t)}findTopLevelEditorForWebview(e){for(let t of this._editorService.editors)if(t===e||t instanceof Ba&&(e===t.primary||e===t.secondary))return t;return e}openRevivedWebview(e){let t=this._webviewService.createWebviewOverlay(e.webviewInitInfo);t.state=e.state;let o=this._instantiationService.createInstance(X0,{viewType:e.viewType,providedId:e.webviewInitInfo.providedViewType,name:e.title,iconPath:e.iconPath},t);return o.iconPath=e.iconPath,typeof e.group=="number"&&o.updateGroup(e.group),o}registerResolver(e){this._revivers.add(e);let t=new qe;return this._revivalPool.reviveFor(e,t.token),ee(()=>{this._revivers.delete(e),t.dispose(!0)})}shouldPersist(e){return e instanceof X0?!0:yt.some(this._revivers.values(),t=>hNt(t,e))}async tryRevive(e,t){for(let o of this._revivers.values())if(hNt(o,e))return await o.resolveWebview(e,t),!0;return!1}async resolveWebview(e,t){if(!await this.tryRevive(e,t)&&!t.isCancellationRequested)return this._revivalPool.enqueueForRestoration(e,t)}};QDe=I([m(0,kt),m(1,ie),m(2,F),m(3,Pu)],QDe);var Om=le("workingCopyBackupService");var vN="";var oG=!1,BIi=class{constructor(i,e,t){this.id=i;this.dependencies=e;this.callback=t}};var HIi=class a{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 a}_initialize(){if(this._state===1){if(globalThis.define){this._state=3;return}}else return;this._state=2,globalThis.define=(i,e,t)=>{typeof i!="string"&&(t=e,e=i,i=null),(typeof e!="object"||!Array.isArray(e))&&(t=e,e=null),this._defineCalls.push(new BIi(i,e,t))},globalThis.define.amd=!0,this._isRenderer?this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??window.trustedTypes?.createPolicy("amdLoader",{createScriptURL(i){if(i.startsWith(window.location.origin)||i.startsWith(`${Q.vscodeFileResource}://${Rii}`))return i;throw new Error(`[trusted_script_src] Invalid script url: ${i}`)}}):this._isWebWorker&&(this._amdPolicy=globalThis._VSCODE_WEB_PACKAGE_TTP??globalThis.trustedTypes?.createPolicy("amdLoader",{createScriptURL(i){return i}}))}async load(i){if(this._initialize(),this._state===3)return new Promise(r=>{let s=ht();globalThis.define(s,[i],function(l){r(l)})});let e=await(this._isWebWorker?this._workerLoadScript(i):this._isRenderer?this._rendererLoadScript(i):this._nodeJSLoadScript(i));if(!e){console.warn(`Did not receive a define call from script ${i}`);return}let t={},o=[],n=[];if(Array.isArray(e.dependencies))for(let r of e.dependencies)r==="exports"?o.push(t):n.push(r);if(n.length>0)throw new Error(`Cannot resolve dependencies for script ${i}. The dependencies are: ${n.join(", ")}`);return typeof e.callback=="function"?e.callback(...o)??t:e.callback}_rendererLoadScript(i){return new Promise((e,t)=>{let o=document.createElement("script");o.setAttribute("async","async"),o.setAttribute("type","text/javascript");let n=()=>{o.removeEventListener("load",r),o.removeEventListener("error",s)},r=l=>{n(),e(this._defineCalls.pop())},s=l=>{n(),t(l)};o.addEventListener("load",r),o.addEventListener("error",s),this._amdPolicy&&(i=this._amdPolicy.createScriptURL(i)),o.setAttribute("src",i),window.document.getElementsByTagName("head")[0].appendChild(o)})}async _workerLoadScript(i){return this._amdPolicy&&(i=this._amdPolicy.createScriptURL(i)),await import(i),this._defineCalls.pop()}async _nodeJSLoadScript(i){try{let e=(await import("fs")).default,t=(await import("vm")).default,o=(await import("module")).default,n=A.parse(i).fsPath,r=e.readFileSync(n).toString(),s=o.wrap(r.replace(/^#!.*/,""));return new t.Script(s).runInThisContext().apply(),this._defineCalls.pop()}catch(e){throw e}}},VIi=new Map;async function vf(a,i,e){e===void 0&&(e=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit);let t=i?`${a}/${i}`:a;if(VIi.has(t))return VIi.get(t);let o;if(/^\w[\w\d+.-]*:\/\//.test(t))o=t;else{let l=`${oG&&e&&!Ft?hY:nF}/${t}`;o=In.asBrowserUri(l).toString(!0)}let n=HIi.INSTANCE.load(o);return VIi.set(t,n),n}function gNt(a,i){let t=!!(globalThis._VSCODE_PRODUCT_JSON??globalThis.vscode?.context?.configuration()?.product)?.commit,o=oG&&t&&!Ft,n=`${a}/${i}`,s=`${o?hY:nF}/${n}`;return In.asBrowserUri(s).toString(!0)}var Jb="utf8",VH="utf8bom",K3="utf16be",G3="utf16le";var fNt=[254,255],UIi=[255,254],oJe=[239,187,191],lYo=512,cYo=512,dYo=512*8,uYo=512*128;var zIi=class extends Error{constructor(e,t){super(e);this.decodeStreamErrorKind=t}},KIi=class a{constructor(i){this.iconvLiteDecoder=i}static async create(i){let e;if(i!==Jb)e=(await vf("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getDecoder(GIi(i));else{let t=new TextDecoder;e={write(o){return t.decode(o,{stream:!0})},end(){return t.decode()}}}return new a(e)}write(i){return this.iconvLiteDecoder.write(i)}end(){return this.iconvLiteDecoder.end()}};function fco(a,i){let e=i.minBytesRequiredForDetection??(i.guessEncoding?dYo:cYo);return new Promise((t,o)=>{let n=Ty(p=>p.join("")),r=[],s=0,l,c=new qe,u=async()=>{try{let p=await YDe({buffer:Ke.concat(r),bytesRead:s},i.guessEncoding,i.candidateGuessEncodings);if(p.seemsBinary&&i.acceptTextOnly)throw new zIi("Stream is binary but only text is accepted for decoding",1);p.encoding=await i.overwriteEncoding(p.encoding),l=await KIi.create(p.encoding);let h=l.write(Ke.concat(r).buffer);n.write(h),r.length=0,s=0,t({stream:n,detected:p})}catch(p){c.cancel(),n.destroy(),o(p)}};_L(a,{onData:async p=>{l?n.write(l.write(p.buffer)):(r.push(p),s+=p.byteLength,s>=e&&(a.pause(),await u(),setTimeout(()=>a.resume())))},onError:p=>n.error(p),onEnd:async()=>{l||await u(),n.end(l?.end())}},c.token)})}async function vco(a,i,e){let o=(await vf("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).getEncoder(GIi(i),e),n=!1,r=!1;return{read(){if(r)return null;let s=a.read();if(typeof s!="string"){if(r=!0,!n&&e?.addBOM)switch(i){case Jb:case VH:return Ke.wrap(Uint8Array.from(oJe));case K3:return Ke.wrap(Uint8Array.from(fNt));case G3:return Ke.wrap(Uint8Array.from(UIi))}let l=o.end();return l&&l.length>0?(n=!0,Ke.wrap(l)):null}return n=!0,Ke.wrap(o.write(s))}}}async function bco(a){return(await vf("@vscode/iconv-lite-umd","lib/iconv-lite-umd.js")).encodingExists(GIi(a))}function GIi(a){return a===VH||a===null?Jb:a}function pYo(a,i){if(!a||i<fNt.length)return null;let e=a.readUInt8(0),t=a.readUInt8(1);if(e===fNt[0]&&t===fNt[1])return K3;if(e===UIi[0]&&t===UIi[1])return G3;if(i<oJe.length)return null;let o=a.readUInt8(2);return e===oJe[0]&&t===oJe[1]&&o===oJe[2]?VH:null}var mYo=["ascii","utf-16","utf-32"];async function hYo(a,i){let e=await vf("jschardet","dist/jschardet.min.js"),t=a.slice(0,uYo),o=bYo(t.buffer);i&&(i=ui(i.map(s=>vYo(s))),i.length===0&&(i=void 0));let n;try{n=e.detect(o,i?{detectEncodings:i}:void 0)}catch{return null}if(!n?.encoding)return null;let r=n.encoding.toLowerCase();return 0<=mYo.indexOf(r)?null:fYo(n.encoding)}var gYo={ibm866:"cp866",big5:"cp950"};function Sco(a){return a.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}function fYo(a){let i=Sco(a);return gYo[i]||i}function vYo(a){let i=Sco(a),e=nJe[i];return e?e.guessableName:void 0}function bYo(a){let i="";for(let e=0;e<a.length;e++)i+=String.fromCharCode(a[e]);return i}function YDe({buffer:a,bytesRead:i},e,t){let o=pYo(a,i),n=!1;if(o!==K3&&o!==G3&&a){let r=!0,s=!0,l=!1;for(let c=0;c<i&&c<lYo;c++){let u=c%2===1,p=a.readUInt8(c)===0;if(p&&(l=!0),r&&(u&&!p||!u&&p)&&(r=!1),s&&(u&&p||!u&&!p)&&(s=!1),p&&!r&&!s)break}l&&(r?o=G3:s?o=K3:n=!0)}return e&&!n&&!o&&a?hYo(a.slice(0,i),t).then(r=>({seemsBinary:!1,encoding:r})):{seemsBinary:n,encoding:o}}var kC={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}},nJe=(()=>{let a={};for(let i in kC)kC[i].guessableName&&(a[i]=kC[i]);return a})();var uR=class extends CC{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(l,s,v,b);this.resource=e;this.hasAssociatedFilePath=t;this.initialValue=o;this.preferredLanguageId=n;this.preferredEncoding=r;this.workingCopyBackupService=c;this.textResourceConfigurationService=u;this.workingCopyService=p;this.textFileService=h;this.labelService=g;this.editorService=f;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeName=this._register(new T);this.onDidChangeName=this._onDidChangeName.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeEncoding=this._register(new T);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new T);this.onDidRevert=this._onDidRevert.event;this.typeId=vN;this.capabilities=2;this.configuredLabelFormat="content";this.cachedModelFirstLineWords=void 0;this.ignoreDirtyOnModelContentChange=!1;this.dirty=this.hasAssociatedFilePath||!!this.initialValue,this._register(this.workingCopyService.registerWorkingCopy(this)),n&&this.setLanguageId(n),this.onConfigurationChange(void 0,!1),this.registerListeners()}static{this.FIRST_LINE_NAME_MAX_LENGTH=40}static{this.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH=this.FIRST_LINE_NAME_MAX_LENGTH*10}static{this.ACTIVE_EDITOR_LANGUAGE_ID="${activeEditorLanguage}"}get name(){return this.configuredLabelFormat==="content"&&!this.hasAssociatedFilePath&&this.cachedModelFirstLineWords?this.cachedModelFirstLineWords:this.labelService.getUriBasenameLabel(this.resource)}registerListeners(){this._register(this.textResourceConfigurationService.onDidChangeConfiguration(e=>this.onConfigurationChange(e,!0)))}onConfigurationChange(e,t){if(!e||e.affectsConfiguration(this.resource,"files.encoding")){let o=this.textResourceConfigurationService.getValue(this.resource,"files.encoding");this.configuredEncoding!==o&&typeof o=="string"&&(this.configuredEncoding=o,t&&!this.preferredEncoding&&this._onDidChangeEncoding.fire())}if(!e||e.affectsConfiguration(this.resource,"workbench.editor.untitled.labelFormat")){let o=this.textResourceConfigurationService.getValue(this.resource,"workbench.editor.untitled.labelFormat");this.configuredLabelFormat!==o&&(o==="content"||o==="name")&&(this.configuredLabelFormat=o,t&&this._onDidChangeName.fire())}}setLanguageId(e,t){let o=e===uR.ACTIVE_EDITOR_LANGUAGE_ID?this.editorService.activeTextEditorLanguageId:e;this.preferredLanguageId=o,o&&super.setLanguageId(o,t)}getLanguageId(){return this.textEditorModel?this.textEditorModel.getLanguageId():this.preferredLanguageId}getEncoding(){return this.preferredEncoding||this.configuredEncoding}async setEncoding(e){let t=this.getEncoding();this.preferredEncoding=e,t!==this.preferredEncoding&&this._onDidChangeEncoding.fire()}isDirty(){return this.dirty}isModified(){return this.isDirty()}setDirty(e){this.dirty!==e&&(this.dirty=e,this._onDidChangeDirty.fire())}async save(e){let t=await this.textFileService.save(this.resource,e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),!!t}async revert(){this.ignoreDirtyOnModelContentChange=!0;try{this.updateTextEditorModel(t4(""))}finally{this.ignoreDirtyOnModelContentChange=!1}this.setDirty(!1),this._onDidRevert.fire()}async backup(e){let t;return this.isResolved()?t=await this.textFileService.getEncodedReadable(this.resource,this.createSnapshot()??void 0,{encoding:Jb}):typeof this.initialValue=="string"&&(t=Iwe(Ke.fromString(this.initialValue))),{content:t}}async resolve(){let e=!1,t=!1;if(this.textEditorModel)this.updateTextEditorModel(void 0,this.preferredLanguageId);else{let n,r=await this.workingCopyBackupService.resolve(this);r?(n=r.value,t=!0):n=lD(Ke.fromString(this.initialValue||""));let s=await OX(await this.textFileService.getDecodedStream(this.resource,n,{encoding:Jb}));this.createTextEditorModel(s,this.resource,this.preferredLanguageId),e=!0}let o=Ti(this.textEditorModel);return this.installModelListeners(o),e&&((t||this.initialValue)&&this.updateNameFromFirstLine(o),this.setDirty(this.hasAssociatedFilePath||!!t||!!this.initialValue),(t||this.initialValue)&&this._onDidChangeContent.fire()),super.resolve()}isResolved(){return!!this.textEditorModelHandle}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t))),this._register(e.onDidChangeLanguage(()=>this.onConfigurationChange(void 0,!0))),super.installModelListeners(e)}onModelContentChanged(e,t){this.ignoreDirtyOnModelContentChange||(!this.hasAssociatedFilePath&&e.getLineCount()===1&&e.getLineLength(1)===0?this.setDirty(!1):this.setDirty(!0)),t.changes.some(o=>(o.range.startLineNumber===1||o.range.endLineNumber===1)&&o.range.startColumn<=uR.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH)&&this.updateNameFromFirstLine(e),this._onDidChangeContent.fire(),this.autoDetectLanguage()}updateNameFromFirstLine(e){if(this.hasAssociatedFilePath)return;let t,o=e.getValueInRange({startLineNumber:1,endLineNumber:1,startColumn:1,endColumn:uR.FIRST_LINE_NAME_CANDIDATE_MAX_LENGTH+1}).trim().replace(/\s+/g," ").replace(/\u202E/g,"");o=o.substr(0,ebt(o,uR.FIRST_LINE_NAME_MAX_LENGTH)[0]),o&&c5().exec(o)&&(t=o),t!==this.cachedModelFirstLineWords&&(this.cachedModelFirstLineWords=t,this._onDidChangeName.fire())}isReadonly(){return!1}};uR=I([m(5,Rt),m(6,_t),m(7,Om),m(8,Gn),m(9,$a),m(10,Uo),m(11,nt),m(12,ie),m(13,jS),m(14,Ai)],uR);var yE=le("untitledTextEditorService"),rme=class extends k{constructor(e,t){super();this.instantiationService=e;this.configurationService=t;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeEncoding=this._register(new T);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidCreate=this._register(new T);this.onDidCreate=this._onDidCreate.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this._onDidChangeLabel=this._register(new T);this.onDidChangeLabel=this._onDidChangeLabel.event;this.mapResourceToModel=this._register(new bI)}static{this.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX=/Untitled-\d+/}get(e){return this.mapResourceToModel.get(e)}getValue(e){return this.get(e)?.textEditorModel?.getValue()}async resolve(e){let t=this.doCreateOrGet(e);return await t.resolve(),t}create(e){return this.doCreateOrGet(e)}doCreateOrGet(e=Object.create(null)){let t=this.massageOptions(e);return t.untitledResource&&this.mapResourceToModel.has(t.untitledResource)?this.mapResourceToModel.get(t.untitledResource):this.doCreate(t)}massageOptions(e){let t=Object.create(null);if(e.associatedResource?(t.untitledResource=A.from({scheme:Q.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):e.untitledResource?.scheme===Q.untitled&&(t.untitledResource=e.untitledResource),e.languageId)t.languageId=e.languageId;else if(!t.associatedResource){let o=this.configurationService.getValue();o.files?.defaultLanguage&&(t.languageId=o.files.defaultLanguage)}return t.encoding=e.encoding,t.initialValue=e.initialValue,t}doCreate(e){let t=e.untitledResource;if(!t){let n=1;do t=A.from({scheme:Q.untitled,path:`Untitled-${n}`}),n++;while(this.mapResourceToModel.has(t))}let o=this.instantiationService.createInstance(uR,t,!!e.associatedResource,e.initialValue,e.languageId,e.encoding);return this.registerModel(o),o}registerModel(e){let t=new O;t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeName(()=>this._onDidChangeLabel.fire(e))),t.add(e.onDidChangeEncoding(()=>this._onDidChangeEncoding.fire(e))),t.add(e.onWillDispose(()=>this._onWillDispose.fire(e))),U.once(e.onWillDispose)(()=>{this.mapResourceToModel.deleteAndLeak(e.resource),t.dispose()}),this.mapResourceToModel.set(e.resource,e),this._onDidCreate.fire(e),e.isDirty()&&this._onDidChangeDirty.fire(e)}isUntitledWithAssociatedResource(e){return e.scheme===Q.untitled&&e.path.length>1&&!rme.UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX.test(e.path)}canDispose(e){return e.isDisposed()?!0:this.doCanDispose(e)}async doCanDispose(e){return e.isDirty()?(await U.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};rme=I([m(0,F),m(1,B)],rme);Ce(yE,rme,1);var pp=class extends X0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super({providedId:e.viewType,viewType:e.viewType,name:e.preferredName??"",iconPath:e.iconPath},t,n,r);this.instantiationService=s;this.labelService=l;this.customEditorService=c;this.fileDialogService=u;this.undoRedoService=p;this.fileService=h;this.filesConfigurationService=g;this.editorGroupsService=f;this.layoutService=v;this.customEditorLabelService=b;this._editorName=void 0;this._shortDescription=void 0;this._mediumDescription=void 0;this._longDescription=void 0;this._shortTitle=void 0;this._mediumTitle=void 0;this._longTitle=void 0;this._editorResource=e.resource,this.oldResource=o.oldResource,this._defaultDirtyState=o.startsDirty,this._backupId=o.backupId,this._untitledDocumentData=o.untitledDocumentData,this.registerListeners()}static create(e,t,o,n){return e.invokeFunction(r=>{let c=r.get(yE).get(t.resource)?.textEditorModel?.getValue(),u=c?Ke.fromString(c):void 0,p=r.get(Pu).createWebviewOverlay({providedViewType:t.viewType,title:t.webviewTitle,options:{customClasses:n?.customClasses},contentOptions:{},extension:void 0}),h=e.createInstance(pp,t,p,{untitledDocumentData:u,oldResource:n?.oldResource});return typeof o<"u"&&h.updateGroup(o),h})}static{this.typeId="workbench.editors.webviewEditor"}get resource(){return this._editorResource}registerListeners(){this._register(this.labelService.onDidChangeFormatters(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onLabelEvent(e.scheme))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onLabelEvent(e.scheme))),this._register(this.customEditorLabelService.onDidChange(()=>this.updateLabel())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire()))}onLabelEvent(e){e===this.resource.scheme&&this.updateLabel()}updateLabel(){this._editorName=void 0,this._shortDescription=void 0,this._mediumDescription=void 0,this._longDescription=void 0,this._shortTitle=void 0,this._mediumTitle=void 0,this._longTitle=void 0,this._onDidChangeLabel.fire()}get typeId(){return pp.typeId}get editorId(){return this.viewType}get capabilities(){let e=0;return e|=128,this.customEditorService.getCustomEditorCapabilities(this.viewType)?.supportsMultipleEditorsPerDocument||(e|=8),this.isReadonly()&&(e|=2),this.resource.scheme===Q.untitled&&(e|=4),e}getName(){let e=this.getWebviewTitle();return e||(this._editorName??=this.customEditorLabelService.getName(this.resource)??Jo(this.labelService.getUriLabel(this.resource)),this._editorName)}getDescription(e=1){switch(e){case 0:return this.shortDescription;case 2:return this.longDescription;case 1:default:return this.mediumDescription}}get shortDescription(){return this._shortDescription??=this.labelService.getUriBasenameLabel(ai(this.resource)),this._shortDescription}get mediumDescription(){return this._mediumDescription??=this.labelService.getUriLabel(ai(this.resource),{relative:!0}),this._mediumDescription}get longDescription(){return this._longDescription??=this.labelService.getUriLabel(ai(this.resource)),this._longDescription}get shortTitle(){return this._shortTitle??=this.getName(),this._shortTitle}get mediumTitle(){return this._mediumTitle??=this.labelService.getUriLabel(this.resource,{relative:!0}),this._mediumTitle}get longTitle(){return this._longTitle??=this.labelService.getUriLabel(this.resource),this._longTitle}getTitle(e){let t=this.getWebviewTitle();if(t)return t;switch(e){case 0:return this.shortTitle;case 2:return this.longTitle;default:case 1:return this.mediumTitle}}matches(e){return super.matches(e)?!0:this===e||e instanceof pp&&this.viewType===e.viewType&&ze(this.resource,e.resource)}copy(){return pp.create(this.instantiationService,{resource:this.resource,viewType:this.viewType,webviewTitle:this.getWebviewTitle(),preferredName:void 0,iconPath:this.iconPath},this.group,this.webview.options)}isReadonly(){return this._modelRef?this._modelRef.object.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}isDirty(){return this._modelRef?this._modelRef.object.isDirty():!!this._defaultDirtyState}async save(e,t){if(!this._modelRef)return;let o=await this._modelRef.object.saveCustomEditor(t);if(o)return ze(o,this.resource)?this:{resource:o}}async saveAs(e,t){if(!this._modelRef)return;let o=this._editorResource,n=await this.fileDialogService.pickFileToSave(o,t?.availableFileSystems);if(n&&await this._modelRef.object.saveCustomEditorAs(this._editorResource,n,t))return(await this.rename(e,n))?.editor}async revert(e,t){if(this._modelRef)return this._modelRef.object.revert(t);this._defaultDirtyState=!1,this._onDidChangeDirty.fire()}async resolve(){if(await super.resolve(),this.isDisposed())return null;if(!this._modelRef){let e=this.capabilities;this._modelRef=this._register(Ti(await this.customEditorService.models.tryRetain(this.resource,this.viewType))),this._register(this._modelRef.object.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this._modelRef.object.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this._untitledDocumentData&&(this._defaultDirtyState=!0),this.isDirty()&&this._onDidChangeDirty.fire(),this.capabilities!==e&&this._onDidChangeCapabilities.fire()}return null}async rename(e,t){return{editor:{resource:t}}}undo(){return Ti(this._modelRef),this.undoRedoService.undo(this.resource)}redo(){return Ti(this._modelRef),this.undoRedoService.redo(this.resource)}onMove(e){this._moveHandler=e}transfer(e){if(super.transfer(e))return e._moveHandler=this._moveHandler,this._moveHandler=void 0,e}get backupId(){return this._modelRef?this._modelRef.object.backupId:this._backupId}get untitledDocumentData(){return this._untitledDocumentData}toUntyped(){return{resource:this.resource,options:{override:this.viewType}}}claim(e,t,o){if(this.doCanMove(t.vscodeWindowId)!==!0)throw b3(d(10377,null),[li({id:"openInOriginalWindow",label:d(10378,null),run:async()=>{let n=this.editorGroupsService.getPart(this.layoutService.getContainer(Me(this.webview.container).window));this.editorGroupsService.getPart(this.layoutService.getContainer(t.window)).activeGroup.moveEditor(this,n.activeGroup)}})],{forceMessage:!0});return super.claim(e,t,o)}canMove(e,t){let o=this.editorGroupsService.getGroup(t);if(o){let n=this.doCanMove(o.windowId);if(typeof n=="string")return n}return super.canMove(e,t)}doCanMove(e){return this.isModified()&&this._modelRef?.object.canHotExit===!1&&Me(this.webview.container).vscodeWindowId!==e?d(10376,null,this.getName()):!0}};pp=I([m(3,Pe),m(4,Hx),m(5,F),m(6,nt),m(7,FH),m(8,nn),m(9,wl),m(10,ge),m(11,fr),m(12,kt),m(13,wi),m(14,nb)],pp);var XDe=le("IInteractiveDocumentService"),vNt=class extends k{constructor(){super();this._onWillAddInteractiveDocument=this._register(new T);this.onWillAddInteractiveDocument=this._onWillAddInteractiveDocument.event;this._onWillRemoveInteractiveDocument=this._register(new T);this.onWillRemoveInteractiveDocument=this._onWillRemoveInteractiveDocument.event}willCreateInteractiveDocument(e,t,o){this._onWillAddInteractiveDocument.fire({notebookUri:e,inputUri:t,languageId:o})}willRemoveInteractiveDocument(e,t){this._onWillRemoveInteractiveDocument.fire({notebookUri:e,inputUri:t})}};var Z0=le("IInteractiveHistoryService"),bNt=class extends k{constructor(){super(),this._history=new dt}matchesCurrent(i,e){let t=this._history.get(i);return t?t.current()===e:!1}addToHistory(i,e){let t=this._history.get(i);if(!t){this._history.set(i,new E4([e],50));return}t.resetCursor(),t.add(e)}getPreviousValue(i){return this._history.get(i)?.previous()??null}getNextValue(i){return this._history.get(i)?.next()??null}replaceLast(i,e){let t=this._history.get(i);if(t)t.replaceLast(e),t.resetCursor();else{this._history.set(i,new E4([e],50));return}}clearHistory(i){this._history.delete(i)}has(i){return!!this._history.has(i)}};var Jf=class extends Ls{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Ga.getOrCreate(r,e,void 0,"interactive",{});super();this._notebookService=u;this._fileDialogService=p;this.isScratchpad=h.getValue(Ct.InteractiveWindowPromptToSave)!==!0,this._notebookEditorInput=g,this._register(this._notebookEditorInput),this.name=o??Jf.windowNames[e.path]??Jo(e.path,km(e.path)),this._initLanguage=n,this._resource=e,this._inputResource=t,this._inputResolver=null,this._editorModelReference=null,this._inputModelRef=null,this._textModelService=s,this._interactiveDocumentService=l,this._historyService=c,this._registerListeners()}static create(e,t,o,n,r){return e.createInstance(Jf,t,o,n,r)}static{this.windowNames={}}static setName(e,t){t&&(this.windowNames[e.path]=t)}static{this.ID="workbench.input.interactive"}get editorId(){return"interactive"}get typeId(){return Jf.ID}get language(){return this._inputModelRef?.object.textEditorModel.getLanguageId()??this._initLanguage}get notebookEditorInput(){return this._notebookEditorInput}get editorInputs(){return[this._notebookEditorInput]}get resource(){return this._resource}get inputResource(){return this._inputResource}get primary(){return this._notebookEditorInput}_registerListeners(){let e=U.once(this.primary.onWillDispose);this._register(e(()=>{this.isDisposed()||this.dispose()})),this._register(this.primary.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(this.primary.onDidChangeLabel(()=>this._onDidChangeLabel.fire())),this._register(this.primary.onDidChangeCapabilities(()=>this._onDidChangeCapabilities.fire()))}get capabilities(){let e=this.isScratchpad?512:0;return 6|e}async _resolveEditorModel(){return this._editorModelReference||(this._editorModelReference=await this._notebookEditorInput.resolve()),this._editorModelReference}async resolve(){return this._editorModelReference?this._editorModelReference:this._inputResolver?this._inputResolver:(this._inputResolver=this._resolveEditorModel(),this._inputResolver)}async resolveInput(e){if(this._inputModelRef)return this._inputModelRef.object.textEditorModel;let t=e??this._initLanguage??es;return this._interactiveDocumentService.willCreateInteractiveDocument(this.resource,this.inputResource,t),this._inputModelRef=await this._textModelService.createModelReference(this.inputResource),this._inputModelRef.object.textEditorModel}async save(e,t){if(this._editorModelReference)return this.hasCapability(4)?this.saveAs(e,t):(await this._editorModelReference.save(t),this)}async saveAs(e,t){if(!this._editorModelReference||!this._notebookService.getContributedNotebookType("interactive"))return;let n=this.getName()+".ipynb",r=Ve(await this._fileDialogService.defaultFilePath(),n),s=await this._fileDialogService.pickFileToSave(r,t?.availableFileSystems);if(!s)return;let l=await this._editorModelReference.saveAs(s);return l&&"resource"in l&&l.resource&&this._notebookService.getNotebookTextModel(l.resource)?.dispose(),l}matches(e){return super.matches(e)?!0:e instanceof Jf?ze(this.resource,e.resource)&&ze(this.inputResource,e.inputResource):!1}getName(){return this.name}isDirty(){return this.isScratchpad?!1:this._editorModelReference?.isDirty()??!1}isModified(){return this._editorModelReference?.isModified()??!1}async revert(e,t){this._editorModelReference&&this._editorModelReference.isDirty()&&await this._editorModelReference.revert(t)}dispose(){this._editorModelReference?.revert({soft:!0}),this._notebookEditorInput?.dispose(),this._editorModelReference?.dispose(),this._editorModelReference=null,this._interactiveDocumentService.willRemoveInteractiveDocument(this.resource,this.inputResource),this._inputModelRef?.dispose(),this._inputModelRef=null,super.dispose()}get historyService(){return this._historyService}};Jf=I([m(4,F),m(5,Bt),m(6,XDe),m(7,Z0),m(8,kn),m(9,nn),m(10,B)],Jf);var jg=class a extends vo{static fromLineNumbers(i,e){return a.fromLength(i,e-i)}static fromLength(i,e){return new a(i,i+e)}join(i){return a.fromLineNumbers(Math.min(this.startLineNumber,i.startLineNumber),Math.max(this.endLineNumberExclusive,i.endLineNumberExclusive))}isAfter(i){return this.startLineNumber>=i.endLineNumberExclusive}isBefore(i){return i.startLineNumber>=this.endLineNumberExclusive}delta(i){return a.fromLength(this.startLineNumber+i,this.length)}deltaEnd(i){return a.fromLength(this.startLineNumber,this.length+i)}deltaStart(i){return a.fromLength(this.startLineNumber+i,this.length-i)}getLines(i){let e=new Array(this.length);for(let t=0;t<this.length;t++)e[t]=i.getLineContent(this.startLineNumber+t);return e}toInclusiveRangeOrEmpty(){return this.isEmpty?new G(this.startLineNumber,1,this.startLineNumber,1):new G(this.startLineNumber,1,this.endLineNumberExclusive-1,1073741824)}};var Ico={start:"<<<<<<<",end:">>>>>>>"};var nG=class{constructor(i,e){this.range=i;this.newLines=e}equals(i){return this.range.equals(i.range)&&eo(this.newLines,i.newLines)}toEdits(i){return new qIi([this]).toEdits(i)}},SNt=class{constructor(i,e){this.range=i;this.newText=e}equals(i){return G.equalsRange(this.range,i.range)&&this.newText===i.newText}},qIi=class{constructor(i){this.edits=i}toEdits(i){return this.edits.map(e=>e.range.endLineNumberExclusive<=i?{range:new G(e.range.startLineNumber,1,e.range.endLineNumberExclusive,1),text:e.newLines.map(t=>t+`
`).join("")}:e.range.startLineNumber===1?{range:new G(1,1,i,Number.MAX_SAFE_INTEGER),text:e.newLines.join(`
`)}:{range:new G(e.range.startLineNumber-1,Number.MAX_SAFE_INTEGER,i,Number.MAX_SAFE_INTEGER),text:e.newLines.map(t=>`
`+t).join("")})}};function yco(a,i){return!(i.lineNumber<a.startLineNumber||i.lineNumber>a.endLineNumber||i.lineNumber===a.startLineNumber&&i.column<a.startColumn||i.lineNumber===a.endLineNumber&&i.column>=a.endColumn)}function rJe(a){return a.startLineNumber===a.endLineNumber?new Rc(0,a.endColumn-a.startColumn):new Rc(a.endLineNumber-a.startLineNumber,a.endColumn-1)}function INt(a,i){return a.lineNumber===i.lineNumber?new Rc(0,i.column-a.column):new Rc(i.lineNumber-a.lineNumber,i.column-1)}function sJe(a,i){return i.lineCount===0?new ye(a.lineNumber,a.column+i.columnCount):new ye(a.lineNumber+i.lineCount,i.columnCount+1)}function $Ii(a,i){return a.endLineNumber<i.startLineNumber||a.endLineNumber===i.startLineNumber&&a.endColumn<=i.startColumn}var bN=class a{constructor(i,e){this.inputRange=i;this.outputRange=e}static join(i){return i.reduce((e,t)=>e?e.join(t):t,void 0)}extendInputRange(i){if(!i.containsRange(this.inputRange))throw new ci;let e=i.startLineNumber-this.inputRange.startLineNumber,t=i.endLineNumberExclusive-this.inputRange.endLineNumberExclusive;return new a(i,jg.fromLength(this.outputRange.startLineNumber+e,this.outputRange.length-e+t))}join(i){return new a(this.inputRange.join(i.inputRange),this.outputRange.join(i.outputRange))}get resultingDeltaFromOriginalToModified(){return this.outputRange.endLineNumberExclusive-this.inputRange.endLineNumberExclusive}toString(){return`${this.inputRange.toString()} -> ${this.outputRange.toString()}`}addOutputLineDelta(i){return new a(this.inputRange,this.outputRange.delta(i))}addInputLineDelta(i){return new a(this.inputRange.delta(i),this.outputRange)}reverse(){return new a(this.outputRange,this.inputRange)}},eW=class a{constructor(i,e){this.lineRangeMappings=i;this.inputLineCount=e;Wh(()=>Nw(i,(t,o)=>t.inputRange.isBefore(o.inputRange)&&t.outputRange.isBefore(o.outputRange)&&o.inputRange.startLineNumber-t.inputRange.endLineNumberExclusive===o.outputRange.startLineNumber-t.outputRange.endLineNumberExclusive))}static betweenOutputs(i,e,t){let n=aJe.compute(i,e).map(r=>new bN(r.output1Range,r.output2Range));return new a(n,t)}project(i){let e=wu(this.lineRangeMappings,n=>n.inputRange.startLineNumber<=i);if(!e)return new bN(jg.fromLength(i,1),jg.fromLength(i,1));if(e.inputRange.contains(i))return e;let t=jg.fromLength(i,1),o=jg.fromLength(i+e.outputRange.endLineNumberExclusive-e.inputRange.endLineNumberExclusive,1);return new bN(t,o)}get outputLineCount(){let i=this.lineRangeMappings.at(-1),e=i?i.outputRange.endLineNumberExclusive-i.inputRange.endLineNumberExclusive:0;return this.inputLineCount+e}reverse(){return new a(this.lineRangeMappings.map(i=>i.reverse()),this.outputLineCount)}},aJe=class a{constructor(i,e,t,o,n){this.inputRange=i;this.output1Range=e;this.output1LineMappings=t;this.output2Range=o;this.output2LineMappings=n}static compute(i,e){let t=Il(u=>u.inputRange.startLineNumber,Hu),o=bvt(i.map(u=>({source:0,diff:u})),e.map(u=>({source:1,diff:u}))).sort(Il(u=>u.diff,t)),n=[new Array,new Array],r=[0,0],s=new Array;function l(u){let p=bN.join(n[0])||new bN(u,u.delta(r[0])),h=bN.join(n[1])||new bN(u,u.delta(r[1]));s.push(new a(c,p.extendInputRange(c).outputRange,n[0],h.extendInputRange(c).outputRange,n[1])),n[0]=[],n[1]=[]}let c;for(let u of o){let p=u.diff.inputRange;c&&!c.intersectsOrTouches(p)&&(l(c),c=void 0),r[u.source]=u.diff.resultingDeltaFromOriginalToModified,c=c?c.join(p):p,n[u.source].push(u.diff)}return c&&l(c),s}toString(){return`${this.output1Range} <- ${this.inputRange} -> ${this.output2Range}`}},q3=class a extends bN{constructor(e,t,o,n,r){super(e,o);this.inputTextModel=t;this.outputTextModel=n;this.rangeMappings=r||[new BH(this.inputRange.toExclusiveRange(),this.outputRange.toExclusiveRange())]}static join(e){return e.reduce((t,o)=>t?t.join(o):o,void 0)}addOutputLineDelta(e){return new a(this.inputRange,this.inputTextModel,this.outputRange.delta(e),this.outputTextModel,this.rangeMappings.map(t=>t.addOutputLineDelta(e)))}addInputLineDelta(e){return new a(this.inputRange.delta(e),this.inputTextModel,this.outputRange,this.outputTextModel,this.rangeMappings.map(t=>t.addInputLineDelta(e)))}join(e){return new a(this.inputRange.join(e.inputRange),this.inputTextModel,this.outputRange.join(e.outputRange),this.outputTextModel)}getLineEdit(){return new nG(this.inputRange,this.getOutputLines())}getReverseLineEdit(){return new nG(this.outputRange,this.getInputLines())}getOutputLines(){return this.outputRange.getLines(this.outputTextModel)}getInputLines(){return this.inputRange.getLines(this.inputTextModel)}},BH=class a{constructor(i,e){this.inputRange=i;this.outputRange=e}toString(){function i(e){return`[${e.startLineNumber}:${e.startColumn}, ${e.endLineNumber}:${e.endColumn})`}return`${i(this.inputRange)} -> ${i(this.outputRange)}`}addOutputLineDelta(i){return new a(this.inputRange,new G(this.outputRange.startLineNumber+i,this.outputRange.startColumn,this.outputRange.endLineNumber+i,this.outputRange.endColumn))}addInputLineDelta(i){return new a(new G(this.inputRange.startLineNumber+i,this.inputRange.startColumn,this.inputRange.endLineNumber+i,this.inputRange.endColumn),this.outputRange)}reverse(){return new a(this.outputRange,this.inputRange)}},sme=class a{constructor(i,e){this.rangeMappings=i;this.inputLineCount=e;Wh(()=>Nw(i,(t,o)=>$Ii(t.inputRange,o.inputRange)&&$Ii(t.outputRange,o.outputRange)))}project(i){let e=wu(this.rangeMappings,n=>n.inputRange.getStartPosition().isBeforeOrEqual(i));if(!e)return new BH(G.fromPositions(i,i),G.fromPositions(i,i));if(yco(e.inputRange,i))return e;let t=INt(e.inputRange.getEndPosition(),i),o=sJe(e.outputRange.getEndPosition(),t);return new BH(G.fromPositions(i),G.fromPositions(o))}projectRange(i){let e=this.project(i.getStartPosition()),t=this.project(i.getEndPosition());return new BH(e.inputRange.plusRange(t.inputRange),e.outputRange.plusRange(t.outputRange))}get outputLineCount(){let i=this.rangeMappings.at(-1),e=i?i.outputRange.endLineNumber-i.inputRange.endLineNumber:0;return this.inputLineCount+e}reverse(){return new a(this.rangeMappings.map(i=>i.reverse()),this.outputLineCount)}};var ame=class{constructor(i,e){this.editorWorkerService=i;this.configurationService=e;this.mergeAlgorithm=hr("mergeEditor.diffAlgorithm","advanced",this.configurationService).map(t=>t==="smart"?"legacy":t==="experimental"?"advanced":t)}async computeDiff(i,e,t){let o=this.mergeAlgorithm.read(t),n=i.getVersionId(),r=e.getVersionId(),s=await this.editorWorkerService.computeDiff(i.uri,e.uri,{ignoreTrimWhitespace:!1,maxComputationTimeMs:0,computeMoves:!1},o);if(!s)throw new Error("Diff computation failed");if(i.isDisposed()||e.isDisposed())return{diffs:null};let l=s.changes.map(p=>new q3(wco(p.original),i,wco(p.modified),e,p.innerChanges?.map(h=>SYo(h)))),c=i.getVersionId(),u=e.getVersionId();return n!==c||r!==u?{diffs:null}:(Wh(()=>l.length===0||l[0].inputRange.startLineNumber===l[0].outputRange.startLineNumber&&Nw(l,(p,h)=>h.inputRange.startLineNumber-p.inputRange.endLineNumberExclusive===h.outputRange.startLineNumber-p.outputRange.endLineNumberExclusive&&p.inputRange.endLineNumberExclusive<h.inputRange.startLineNumber&&p.outputRange.endLineNumberExclusive<h.outputRange.startLineNumber)),{diffs:l})}};ame=I([m(0,Qs),m(1,B)],ame);function wco(a){return jg.fromLength(a.startLineNumber,a.length)}function SYo(a){return new BH(a.originalRange,a.modifiedRange)}var uee=class{constructor(){this._isOccupied=!1}runExclusivelyOrSkip(i){if(!this._isOccupied){this._isOccupied=!0;try{i()}finally{this._isOccupied=!1}}}runExclusivelyOrThrow(i){if(this._isOccupied)throw new ci("ReentrancyBarrier: reentrant call detected!");this._isOccupied=!0;try{i()}finally{this._isOccupied=!1}}get isOccupied(){return this._isOccupied}makeExclusiveOrSkip(i){return((...e)=>{if(!this._isOccupied){this._isOccupied=!0;try{return i(...e)}finally{this._isOccupied=!1}}})}};var JDe=class extends k{constructor(e,t,o){super();this.baseTextModel=e;this.textModel=t;this.diffComputer=o;this._recomputeCount=0;this._state=De(this,1);this._diffs=De(this,[]);this._barrier=new uee;this._isDisposed=!1;this._isInitializing=!0;let n=zc("recompute");this._register(ve(r=>{n.read(r),this._recompute(r)})),this._register(e.onDidChangeContent(this._barrier.makeExclusiveOrSkip(()=>{n.trigger(void 0)}))),this._register(t.onDidChangeContent(this._barrier.makeExclusiveOrSkip(()=>{n.trigger(void 0)}))),this._register(ee(()=>{this._isDisposed=!0}))}get isApplyingChange(){return this._barrier.isOccupied}get state(){return this._state}get diffs(){return this._diffs}_recompute(e){this._recomputeCount++;let t=this._recomputeCount;this._state.get()===1&&(this._isInitializing=!0),Ki(n=>{this._state.set(this._isInitializing?1:3,n,0)}),this.diffComputer.computeDiff(this.baseTextModel,this.textModel,e).then(n=>{this._isDisposed||t===this._recomputeCount&&Ki(r=>{n.diffs?(this._state.set(2,r,1),this._diffs.set(n.diffs,r,1)):this._state.set(4,r,1),this._isInitializing=!1})})}ensureUpToDate(){if(this.state.get()!==2)throw new ci("Cannot remove diffs when the model is not up to date")}removeDiffs(e,t,o){this.ensureUpToDate(),e.sort(Il(u=>u.inputRange.startLineNumber,Hu)),e.reverse();let n=this._diffs.get(),r=new Set(e);if(r.size!==e.length)throw new ci;let s=new Set(n);for(let u of e)if(!s.has(u))throw new ci;for(let u of e)this._barrier.runExclusivelyOrThrow(()=>{let p=u.getReverseLineEdit().toEdits(this.textModel.getLineCount());this.textModel.pushEditOperations(null,p,()=>null,o)});let l=0,c=[];for(let u of n)r.has(u)?l+=u.inputRange.length-u.outputRange.length:c.push(l!==0?u.addOutputLineDelta(l):u);this._diffs.set(c,t,0)}applyEditRelativeToOriginal(e,t,o){this.ensureUpToDate();let n=new q3(e.range,this.baseTextModel,jg.fromLength(e.range.startLineNumber,e.newLines.length),this.textModel),r=!1,s=0,l=new Array;for(let c of this.diffs.get()){if(c.inputRange.intersectsOrTouches(e.range))throw new ci("Edit must be conflict free.");c.inputRange.isAfter(e.range)?(r||(r=!0,l.push(n.addOutputLineDelta(s))),l.push(c.addOutputLineDelta(e.newLines.length-e.range.length))):l.push(c),r||(s+=c.outputRange.length-c.inputRange.length)}r||(r=!0,l.push(n.addOutputLineDelta(s))),this._barrier.runExclusivelyOrThrow(()=>{let c=new nG(e.range.delta(s),e.newLines).toEdits(this.textModel.getLineCount());this.textModel.pushEditOperations(null,c,()=>null,o)}),this._diffs.set(l,t,0)}findTouchingDiffs(e){return this.diffs.get().filter(t=>t.inputRange.intersectsOrTouches(e))}getResultLine(e,t){let o=0,n=t?this.diffs.read(t):this.diffs.get();for(let r of n){if(r.inputRange.contains(e)||r.inputRange.endLineNumberExclusive===e)return r;if(r.inputRange.endLineNumberExclusive<e)o=r.resultingDeltaFromOriginalToModified;else break}return e+o}getResultLineRange(e,t){let o=this.getResultLine(e.startLineNumber,t);typeof o!="number"&&(o=o.outputRange.startLineNumber);let n=this.getResultLine(e.endLineNumberExclusive,t);return typeof n!="number"&&(n=n.outputRange.endLineNumberExclusive),jg.fromLineNumbers(o,n)}};function Cco(a,i){Object.entries(i).forEach(([e,t])=>{a.style.setProperty(e,IYo(t))})}function IYo(a){return typeof a=="number"?`${a}px`:a}function eRe(a,i){let e=new O,t=[];return e.add(dD({debugName:()=>`Apply decorations from ${i.debugName}`},o=>{let n=i.read(o);a.changeDecorations(r=>{t=r.deltaDecorations(t,n)})})),e.add({dispose:()=>{a.changeDecorations(o=>{t=o.deltaDecorations(t,[])})}}),e}function*xco(a,i,e){let t=new nT(i);for(let o of a){t.takeWhile(r=>tx.isGreaterThan(e(o,r)));let n=t.takeWhile(r=>tx.isNeitherLessOrGreaterThan(e(o,r)));yield{left:o,rights:n||[]}}}function*yNt(a,i,e){let t=new nT(i);for(let o of a){let n=t.takeWhile(s=>tx.isGreaterThan(e(o,s)));n&&(yield{rights:n});let r=t.takeWhile(s=>tx.isNeitherLessOrGreaterThan(e(o,s)));yield{left:o,rights:r||[]}}}function wNt(a,i){return Object.assign(a,i)}function CNt(a,i){let e={};for(let t in a)e[t]=a[t];for(let t in i){let o=i[t];typeof e[t]=="object"&&o&&typeof o=="object"?e[t]=CNt(e[t],o):e[t]=o}return e}var ZDe=class{constructor(i,e){this.key=i;this.storageService=e;this.hasValue=!1;this.value=void 0}get(){if(!this.hasValue){let i=this.storageService.get(this.key,0);if(i!==void 0)try{this.value=JSON.parse(i)}catch(e){mt(e)}this.hasValue=!0}return this.value}set(i){this.value=i,this.storageService.store(this.key,JSON.stringify(this.value),0,0)}};ZDe=I([m(1,de)],ZDe);var xNt=class a{constructor(i,e,t,o,n,r,s,l){this.baseRange=i;this.baseTextModel=e;this.input1Range=t;this.input1TextModel=o;this.input1Diffs=n;this.input2Range=r;this.input2TextModel=s;this.input2Diffs=l;if(this.input1CombinedDiff=q3.join(this.input1Diffs),this.input2CombinedDiff=q3.join(this.input2Diffs),this.isEqualChange=eo(this.input1Diffs,this.input2Diffs,(c,u)=>c.getLineEdit().equals(u.getLineEdit())),this.smartInput1LineRangeEdit=null,this.smartInput2LineRangeEdit=null,this.dumbInput1LineRangeEdit=null,this.dumbInput2LineRangeEdit=null,this.input1Diffs.length===0&&this.input2Diffs.length===0)throw new ci("must have at least one diff")}static fromDiffs(i,e,t,o,n){return aJe.compute(i,e).map(s=>new a(s.inputRange,t,s.output1Range,o,s.output1LineMappings,s.output2Range,n,s.output2LineMappings))}getInputRange(i){return i===1?this.input1Range:this.input2Range}getInputCombinedDiff(i){return i===1?this.input1CombinedDiff:this.input2CombinedDiff}getInputDiffs(i){return i===1?this.input1Diffs:this.input2Diffs}get isConflicting(){return this.input1Diffs.length>0&&this.input2Diffs.length>0}get canBeCombined(){return this.smartCombineInputs(1)!==void 0}get isOrderRelevant(){let i=this.smartCombineInputs(1),e=this.smartCombineInputs(2);return!i||!e?!1:!i.equals(e)}getEditForBase(i){let e=[];if(i.includesInput1&&this.input1CombinedDiff&&e.push({diff:this.input1CombinedDiff,inputNumber:1}),i.includesInput2&&this.input2CombinedDiff&&e.push({diff:this.input2CombinedDiff,inputNumber:2}),e.length===0)return{edit:void 0,effectiveState:QS.base};if(e.length===1)return{edit:e[0].diff.getLineEdit(),effectiveState:QS.base.withInputValue(e[0].inputNumber,!0,!1)};if(i.kind!==3)throw new ci;let t=i.smartCombination?this.smartCombineInputs(i.firstInput):this.dumbCombineInputs(i.firstInput);return t?{edit:t,effectiveState:i}:{edit:e[jIi(i.firstInput)-1].diff.getLineEdit(),effectiveState:QS.base.withInputValue(jIi(i.firstInput),!0,!1)}}smartCombineInputs(i){if(i===1&&this.smartInput1LineRangeEdit!==null)return this.smartInput1LineRangeEdit;if(i===2&&this.smartInput2LineRangeEdit!==null)return this.smartInput2LineRangeEdit;let t=bvt(this.input1Diffs.flatMap(n=>n.rangeMappings.map(r=>({diff:r,input:1}))),this.input2Diffs.flatMap(n=>n.rangeMappings.map(r=>({diff:r,input:2})))).sort(Ivt(Il(n=>n.diff.inputRange,G.compareRangesUsingStarts),Il(n=>n.input===i?1:2,Hu))).map(n=>{let r=n.input===1?this.input1TextModel:this.input2TextModel;return new SNt(n.diff.inputRange,r.getValueInRange(n.diff.outputRange))}),o=yYo(this.baseRange,t,this.baseTextModel);return i===1?this.smartInput1LineRangeEdit=o:this.smartInput2LineRangeEdit=o,o}dumbCombineInputs(i){if(i===1&&this.dumbInput1LineRangeEdit!==null)return this.dumbInput1LineRangeEdit;if(i===2&&this.dumbInput2LineRangeEdit!==null)return this.dumbInput2LineRangeEdit;let e=this.input1Range.getLines(this.input1TextModel),t=this.input2Range.getLines(this.input2TextModel);i===2&&([e,t]=[t,e]);let o=new nG(this.baseRange,e.concat(t));return i===1?this.dumbInput1LineRangeEdit=o:this.dumbInput2LineRangeEdit=o,o}};function yYo(a,i,e){let t="",o=a.startLineNumber>1,n=o?new ye(a.startLineNumber-1,e.getLineMaxColumn(a.startLineNumber-1)):new ye(a.startLineNumber,1);for(let u of i){let p=u.range.getStartPosition();if(!n.isBeforeOrEqual(p))return;let h=e.getValueInRange(G.fromPositions(n,p));p.lineNumber>e.getLineCount()&&(h+=`
`),t+=h,t+=u.newText,n=u.range.getEndPosition()}let r=a.endLineNumberExclusive<=e.getLineCount(),s=r?new ye(a.endLineNumberExclusive,1):new ye(a.endLineNumberExclusive-1,1073741824),l=e.getValueInRange(G.fromPositions(n,s));t+=l;let c=Hc(t);if(o){if(c[0]!=="")return;c.shift()}if(r){if(c[c.length-1]!=="")return;c.pop()}return new nG(a,c)}function jIi(a){return a===1?2:1}var lme=class{constructor(){}get includesInput1(){return!1}get includesInput2(){return!1}includesInput(i){return i===1?this.includesInput1:this.includesInput2}isInputIncluded(i){return i===1?this.includesInput1:this.includesInput2}toggle(i){return this.withInputValue(i,!this.includesInput(i),!0)}getInput(i){return this.isInputIncluded(i)?1:0}},lJe=class extends lme{get kind(){return 0}toString(){return"base"}swap(){return this}withInputValue(i,e,t=!1){return i===1?e?new tRe:this:e?new cme:this}equals(i){return i.kind===0}},tRe=class extends lme{get kind(){return 1}get includesInput1(){return!0}toString(){return"1\u2713"}swap(){return new cme}withInputValue(i,e,t=!1){return i===1?e?this:new lJe:e?new kNt(1,t):new cme}equals(i){return i.kind===1}},cme=class a extends lme{get kind(){return 2}get includesInput2(){return!0}toString(){return"2\u2713"}swap(){return new tRe}withInputValue(i,e,t=!1){return i===2?e?this:new lJe:e?new kNt(2,t):new a}equals(i){return i.kind===2}},kNt=class a extends lme{constructor(e,t){super();this.firstInput=e;this.smartCombination=t}get kind(){return 3}get includesInput1(){return!0}get includesInput2(){return!0}toString(){return"2\u2713"}swap(){return new a(jIi(this.firstInput),this.smartCombination)}withInputValue(e,t,o=!1){return t?this:e===1?new cme:new tRe}equals(e){return e.kind===3&&this.firstInput===e.firstInput&&this.smartCombination===e.smartCombination}getInput(e){return e===this.firstInput?1:2}},QIi=class extends lme{get kind(){return 4}toString(){return"unrecognized"}swap(){return this}withInputValue(i,e,t=!1){return e?i===1?new tRe:new cme:this}equals(i){return i.kind===4}},QS;(e=>(e.base=new lJe,e.unrecognized=new QIi))(QS||={});var dme=class extends Zh{constructor(e,t,o,n,r,s,l,c,u){super();this.base=e;this.input1=t;this.input2=o;this.resultTextModel=n;this.diffComputer=r;this.options=s;this.telemetry=l;this.languageService=c;this.undoRedoService=u;this.input1TextModelDiffs=this._register(new JDe(this.base,this.input1.textModel,this.diffComputer)),this.input2TextModelDiffs=this._register(new JDe(this.base,this.input2.textModel,this.diffComputer)),this.resultTextModelDiffs=this._register(new JDe(this.base,this.resultTextModel,this.diffComputer)),this.modifiedBaseRanges=ke(this,h=>{let g=this.input1TextModelDiffs.diffs.read(h),f=this.input2TextModelDiffs.diffs.read(h);return xNt.fromDiffs(g,f,this.base,this.input1.textModel,this.input2.textModel)}),this.modifiedBaseRangeResultStates=ke(this,h=>new Map(this.modifiedBaseRanges.read(h).map(f=>[f,new ENt(f)]))),this.resultSnapshot=this.resultTextModel.createSnapshot(),this.baseInput1Diffs=this.input1TextModelDiffs.diffs,this.baseInput2Diffs=this.input2TextModelDiffs.diffs,this.baseResultDiffs=this.resultTextModelDiffs.diffs,this.input1ResultMapping=ke(this,h=>this.getInputResultMapping(this.baseInput1Diffs.read(h),this.baseResultDiffs.read(h),this.input1.textModel.getLineCount())),this.resultInput1Mapping=ke(this,h=>this.input1ResultMapping.read(h).reverse()),this.input2ResultMapping=ke(this,h=>this.getInputResultMapping(this.baseInput2Diffs.read(h),this.baseResultDiffs.read(h),this.input2.textModel.getLineCount())),this.resultInput2Mapping=ke(this,h=>this.input2ResultMapping.read(h).reverse()),this.baseResultMapping=ke(this,h=>{let g=new eW(this.baseResultDiffs.read(h),-1);return new eW(g.lineRangeMappings.map(f=>f.inputRange.isEmpty||f.outputRange.isEmpty?new bN(f.inputRange.deltaStart(-1),f.outputRange.deltaStart(-1)):f),g.inputLineCount)}),this.resultBaseMapping=ke(this,h=>this.baseResultMapping.read(h).reverse()),this.diffComputingState=ke(this,h=>{let g=[this.input1TextModelDiffs,this.input2TextModelDiffs,this.resultTextModelDiffs].map(f=>f.state.read(h));return g.some(f=>f===1)?1:g.some(f=>f===3)?3:2}),this.inputDiffComputingState=ke(this,h=>{let g=[this.input1TextModelDiffs,this.input2TextModelDiffs].map(f=>f.state.read(h));return g.some(f=>f===1)?1:g.some(f=>f===3)?3:2}),this.isUpToDate=ke(this,h=>this.diffComputingState.read(h)===2),this.firstRun=!0,this.unhandledConflictsCount=ke(this,h=>{let g=this.modifiedBaseRangeResultStates.read(h),f=0;for(let[v,b]of g)b.handled.read(h)||f++;return f}),this.hasUnhandledConflicts=this.unhandledConflictsCount.map(h=>h>0),this._register(Dz(this.modifiedBaseRangeResultStates)),this._register(Dz(this.input1ResultMapping)),this._register(Dz(this.input2ResultMapping));let p=this.initialize();this.onInitialized=yh(this.diffComputingState,h=>h===2).then(async()=>{await p}),p.then(()=>{let h=!0;this._register(fA({changeTracker:{createChangeSummary:()=>{},handleChange:g=>(g.didChange(this.modifiedBaseRangeResultStates)&&(h=!0),g.didChange(this.resultTextModelDiffs.diffs)?g.change===1:!0)}},g=>{let f=this.modifiedBaseRangeResultStates.read(g);if(!this.isUpToDate.read(g))return;let v=this.resultTextModelDiffs.diffs.read(g);Ki(b=>{if(this.updateBaseRangeAcceptedState(v,f,b),h){h=!1;for(let[S,y]of f){let w=y.accepted.read(void 0),x=!(w.kind===0||w.kind===4);y.handledInput1.set(x,b),y.handledInput2.set(x,b)}}})}))})}async initialize(){this.options.resetResult&&await this.reset()}async reset(){await yh(this.inputDiffComputingState,t=>t===2);let e=this.modifiedBaseRangeResultStates.get();Ki(t=>{for(let[o,n]of e){let r,s=!1;o.input1Diffs.length===0?(r=QS.base.withInputValue(2,!0),s=!0):o.input2Diffs.length===0?(r=QS.base.withInputValue(1,!0),s=!0):o.isEqualChange?(r=QS.base.withInputValue(1,!0),s=!0):(r=QS.base,s=!1),n.accepted.set(r,t),n.computedFromDiffing=!1,n.previousNonDiffingState=void 0,n.handledInput1.set(s,t),n.handledInput2.set(s,t)}this.resultTextModel.pushEditOperations(null,[{range:new G(1,1,Number.MAX_SAFE_INTEGER,1),text:this.computeAutoMergedResult()}],()=>null)})}computeAutoMergedResult(){let e=this.modifiedBaseRanges.get(),t=this.base.getLinesContent(),o=this.input1.textModel.getLinesContent(),n=this.input2.textModel.getLinesContent(),r=[];function s(c,u){for(let p=u.startLineNumber;p<u.endLineNumberExclusive;p++)r.push(c[p-1])}let l=1;for(let c of e)s(t,jg.fromLineNumbers(l,c.baseRange.startLineNumber)),l=c.baseRange.endLineNumberExclusive,c.input1Diffs.length===0?s(n,c.input2Range):c.input2Diffs.length===0||c.isEqualChange?s(o,c.input1Range):s(t,c.baseRange);return s(t,jg.fromLineNumbers(l,t.length+1)),r.join(this.resultTextModel.getEOL())}hasBaseRange(e){return this.modifiedBaseRangeResultStates.get().has(e)}get isApplyingEditInResult(){return this.resultTextModelDiffs.isApplyingChange}getInputResultMapping(e,t,o){let n=eW.betweenOutputs(e,t,o);return new eW(n.lineRangeMappings.map(r=>r.inputRange.isEmpty||r.outputRange.isEmpty?new bN(r.inputRange.deltaStart(-1),r.outputRange.deltaStart(-1)):r),n.inputLineCount)}translateInputRangeToBase(e,t){let o=e===1?this.baseInput1Diffs.get():this.baseInput2Diffs.get();return new sme(o.flatMap(r=>r.rangeMappings),0).reverse().projectRange(t).outputRange}translateBaseRangeToInput(e,t){let o=e===1?this.baseInput1Diffs.get():this.baseInput2Diffs.get();return new sme(o.flatMap(r=>r.rangeMappings),0).projectRange(t).outputRange}getLineRangeInResult(e,t){return this.resultTextModelDiffs.getResultLineRange(e,t)}translateResultRangeToBase(e){return new sme(this.baseResultDiffs.get().flatMap(o=>o.rangeMappings),0).reverse().projectRange(e).outputRange}translateBaseRangeToResult(e){return new sme(this.baseResultDiffs.get().flatMap(o=>o.rangeMappings),0).projectRange(e).outputRange}findModifiedBaseRangesInRange(e){return this.modifiedBaseRanges.get().filter(t=>t.baseRange.intersectsOrTouches(e))}updateBaseRangeAcceptedState(e,t,o){let n=xco(t,e,(r,s)=>r[0].baseRange.intersectsOrTouches(s.inputRange)?tx.neitherLessOrGreaterThan:jg.compareByStart(r[0].baseRange,s.inputRange));for(let r of n){let s=this.computeState(r.left[0],r.rights),l=r.left[1],c=l.accepted.get();c.equals(s)||(!this.firstRun&&!l.computedFromDiffing&&(l.computedFromDiffing=!0,l.previousNonDiffingState=c),l.accepted.set(s,o))}this.firstRun&&(this.firstRun=!1)}computeState(e,t){if(t.length===0)return QS.base;let o=t.map(s=>s.getLineEdit());function n(s){return eo(o,s.map(l=>l.getLineEdit()),(l,c)=>l.equals(c))}if(n(e.input1Diffs))return QS.base.withInputValue(1,!0);if(n(e.input2Diffs))return QS.base.withInputValue(2,!0);let r=[QS.base.withInputValue(1,!0).withInputValue(2,!0,!0),QS.base.withInputValue(2,!0).withInputValue(1,!0,!0),QS.base.withInputValue(1,!0).withInputValue(2,!0,!1),QS.base.withInputValue(2,!0).withInputValue(1,!0,!1)];for(let s of r){let{edit:l}=e.getEditForBase(s);if(l){let u=this.resultTextModelDiffs.getResultLineRange(e.baseRange).getLines(this.resultTextModel);if(eo(l.newLines,u,(p,h)=>p===h))return s}}return QS.unrecognized}getState(e){let t=this.modifiedBaseRangeResultStates.get().get(e);if(!t)throw new ci("object must be from this instance");return t.accepted}setState(e,t,o,n,r=!1){if(!this.isUpToDate.get())throw new ci("Cannot set state while updating");let s=this.modifiedBaseRangeResultStates.get().get(e);if(!s)throw new ci("object must be from this instance");let l=this.resultTextModelDiffs.findTouchingDiffs(e.baseRange),c=new DX;l&&this.resultTextModelDiffs.removeDiffs(l,n,c);let{edit:u,effectiveState:p}=e.getEditForBase(t);s.accepted.set(p,n),s.previousNonDiffingState=void 0,s.computedFromDiffing=!1;let h=s.handledInput1.get(),g=s.handledInput2.get();(!h||!g)&&this.undoRedoService.pushElement(new YIi(this.resultTextModel.uri,new WeakRef(this),new WeakRef(s),h,g),c),u&&(this.resultTextModel.pushStackElement(),this.resultTextModelDiffs.applyEditRelativeToOriginal(u,n,c),this.resultTextModel.pushStackElement()),s.handledInput1.set(!0,n),s.handledInput2.set(!0,n)}resetDirtyConflictsToBase(){Ki(e=>{this.resultTextModel.pushStackElement();for(let t of this.modifiedBaseRanges.get())this.getState(t).get().kind===4&&this.setState(t,QS.base,!1,e,!1);this.resultTextModel.pushStackElement()})}isHandled(e){return this.modifiedBaseRangeResultStates.get().get(e).handled}isInputHandled(e,t){let o=this.modifiedBaseRangeResultStates.get().get(e);return t===1?o.handledInput1:o.handledInput2}setInputHandled(e,t,o,n){let r=this.modifiedBaseRangeResultStates.get().get(e);if(r.handled.get()===o)return;let s=new WeakRef(ENt),l=new WeakRef(this);this.undoRedoService.pushElement({type:0,resource:this.resultTextModel.uri,code:"setInputHandled",label:d(13362,null),redo(){let c=l.deref(),u=s.deref();c&&!c.isDisposed()&&u&&Ki(p=>{t===1?r.handledInput1.set(o,p):r.handledInput2.set(o,p)})},undo(){let c=l.deref(),u=s.deref();c&&!c.isDisposed()&&u&&Ki(p=>{t===1?r.handledInput1.set(!o,p):r.handledInput2.set(!o,p)})}}),t===1?r.handledInput1.set(o,n):r.handledInput2.set(o,n)}setHandled(e,t,o){let n=this.modifiedBaseRangeResultStates.get().get(e);n.handled.get()!==t&&(n.handledInput1.set(t,o),n.handledInput2.set(t,o))}setLanguageId(e,t){let o=this.languageService.createById(e);this.base.setLanguage(o,t),this.input1.textModel.setLanguage(o,t),this.input2.textModel.setLanguage(o,t),this.resultTextModel.setLanguage(o,t)}getInitialResultValue(){let e=[];for(;;){let t=this.resultSnapshot.read();if(t===null)break;e.push(t)}return e.join()}async getResultValueWithConflictMarkers(){if(await yh(this.diffComputingState,c=>c===2),this.unhandledConflictsCount.get()===0)return this.resultTextModel.getValue();let e=this.resultTextModel.getLinesContent(),t=this.input1.textModel.getLinesContent(),o=this.input2.textModel.getLinesContent(),n=this.modifiedBaseRangeResultStates.get(),r=[];function s(c,u){for(let p=u.startLineNumber;p<u.endLineNumberExclusive;p++)r.push(c[p-1])}let l=1;for(let[c,u]of n){if(u.handled.get())continue;let p=this.resultTextModelDiffs.getResultLineRange(c.baseRange);s(e,jg.fromLineNumbers(l,Math.max(l,p.startLineNumber))),l=p.endLineNumberExclusive,r.push("<<<<<<<"),u.accepted.get().kind===4?s(e,p):s(t,c.input1Range),r.push("======="),s(o,c.input2Range),r.push(">>>>>>>")}return s(e,jg.fromLineNumbers(l,e.length+1)),r.join(`
`)}get conflictCount(){return pR(this.modifiedBaseRanges.get(),e=>e.isConflicting)}get combinableConflictCount(){return pR(this.modifiedBaseRanges.get(),e=>e.isConflicting&&e.canBeCombined)}get conflictsResolvedWithBase(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===0)}get conflictsResolvedWithInput1(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===1)}get conflictsResolvedWithInput2(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===2)}get conflictsResolvedWithSmartCombination(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===3&&o.smartCombination})}get manuallySolvedConflictCountThatEqualNone(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>e.isConflicting&&t.accepted.get().kind===4)}get manuallySolvedConflictCountThatEqualSmartCombine(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===3&&o.smartCombination})}get manuallySolvedConflictCountThatEqualInput1(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===1})}get manuallySolvedConflictCountThatEqualInput2(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&t.computedFromDiffing&&o.kind===2})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBase(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===0})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===1})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===2})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===3&&!t.previousNonDiffingState?.smartCombination})}get manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart(){return pR(this.modifiedBaseRangeResultStates.get().entries(),([e,t])=>{let o=t.accepted.get();return e.isConflicting&&o.kind===4&&t.previousNonDiffingState?.kind===3&&t.previousNonDiffingState?.smartCombination})}};dme=I([m(7,Rt),m(8,wl)],dme);function pR(a,i){let e=0;for(let t of a)i(t)&&e++;return e}var ENt=class{constructor(i){this.baseRange=i;this.accepted=De(`BaseRangeState${this.baseRange.baseRange}`,QS.base),this.handledInput1=De(`BaseRangeHandledState${this.baseRange.baseRange}.Input1`,!1),this.handledInput2=De(`BaseRangeHandledState${this.baseRange.baseRange}.Input2`,!1),this.computedFromDiffing=!1,this.previousNonDiffingState=void 0,this.handled=ke(this,e=>this.handledInput1.read(e)&&this.handledInput2.read(e))}};var YIi=class{constructor(i,e,t,o,n){this.resource=i;this.mergeEditorModelRef=e;this.stateRef=t;this.input1Handled=o;this.input2Handled=n;this.code="undoMarkAsHandled";this.label=d(13363,null);this.type=0}redo(){let i=this.mergeEditorModelRef.deref();if(!i||i.isDisposed())return;let e=this.stateRef.deref();e&&Ki(t=>{e.handledInput1.set(!0,t),e.handledInput2.set(!0,t)})}undo(){let i=this.mergeEditorModelRef.deref();if(!i||i.isDisposed())return;let e=this.stateRef.deref();e&&Ki(t=>{e.handledInput1.set(this.input1Handled,t),e.handledInput2.set(this.input2Handled,t)})}};var vm=new Y("isMergeEditor",!1,{type:"boolean",description:d(13417,null)}),TNt=new Y("isMergeResultEditor",!1,{type:"boolean",description:d(13418,null)}),pee=new Y("mergeEditorLayout","mixed",{type:"string",description:d(13416,null)}),iRe=new Y("mergeEditorShowBase",!1,{type:"boolean",description:d(13420,null)}),cJe=new Y("mergeEditorShowBaseAtTop",!1,{type:"boolean",description:d(13421,null)}),_Nt=new Y("mergeEditorShowNonConflictingChanges",!1,{type:"boolean",description:d(13422,null)}),DNt=new Y("mergeEditorBaseUri","",{type:"string",description:d(13415,null)}),Eco=new Y("mergeEditorResultUri","",{type:"string",description:d(13419,null)}),dJe="mergeEditorCloseWithConflicts";var oRe=class{constructor(i,e,t,o){this._mergeEditorTelemetry=i;this._instantiationService=e;this._textModelService=t;this._modelService=o}async createInputModel(i){let e=new O,[t,o,n,r]=await Promise.all([this._textModelService.createModelReference(i.base),this._textModelService.createModelReference(i.result),RNt(i.input1,this._textModelService,e),RNt(i.input2,this._textModelService,e)]);e.add(t),e.add(o);let s=o.object.textEditorModel.uri.with({scheme:"merge-result"}),l=this._modelService.createModel("",{languageId:o.object.textEditorModel.getLanguageId(),onDidChange:U.None},s);e.add(l);let c=this._instantiationService.createInstance(ame),u=this._instantiationService.createInstance(dme,t.object.textEditorModel,n,r,l,c,{resetResult:!0},this._mergeEditorTelemetry);return e.add(u),await u.onInitialized,this._instantiationService.createInstance(uJe,u,e,o.object,i.result)}};oRe=I([m(1,F),m(2,Bt),m(3,_t)],oRe);var uJe=class extends Zh{constructor(e,t,o,n,r,s,l){super();this.model=e;this.disposable=t;this.result=o;this.resultUri=n;this.textFileService=r;this.dialogService=s;this.editorService=l;this.savedAltVersionId=De(this,this.model.resultTextModel.getAlternativeVersionId()),this.altVersionId=vi(this,c=>this.model.resultTextModel.onDidChangeContent(c),()=>this.model.resultTextModel.getAlternativeVersionId()),this.isDirty=ke(this,c=>this.altVersionId.read(c)!==this.savedAltVersionId.read(c)),this.finished=!1}dispose(){this.disposable.dispose(),super.dispose()}async accept(){let e=await this.model.resultTextModel.getValue();this.result.textEditorModel.setValue(e),this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(),void 0),await this.textFileService.save(this.result.textEditorModel.uri),this.finished=!0}async _discard(){await this.textFileService.revert(this.model.resultTextModel.uri),this.savedAltVersionId.set(this.model.resultTextModel.getAlternativeVersionId(),void 0),this.finished=!0}shouldConfirmClose(){return!0}async confirmClose(e){Wh(()=>e.some(n=>n===this));let t=e.some(n=>n.isDirty.get()),o;if(t){let n=e.length>1,r=n?d(13339,null,e.length):d(13338,null,Be(e[0].model.resultTextModel.uri)),s=e.some(c=>c.model.hasUnhandledConflicts.get()),l=[{label:s?d(13344,null):d(13341,null),run:()=>0},{label:d(13336,null),run:()=>1}];o=(await this.dialogService.prompt({type:wt.Info,message:r,detail:s?n?d(13335,null):d(13333,null):n?d(13334,null):d(13332,null),buttons:l,cancelButton:{run:()=>2}})).result}else o=1;return o===0?await Promise.all(e.map(n=>n.accept())):o===1&&await Promise.all(e.map(n=>n._discard())),o}async save(e){this.finished||(async()=>{let{confirmed:t}=await this.dialogService.confirm({message:d(13343,null),detail:d(13342,null),primaryButton:d(13331,null)});if(t){await this.accept();let o=this.editorService.findEditors(this.resultUri).filter(n=>n.editor.typeId==="mergeEditor.Input");await this.editorService.closeEditors(o)}})()}async revert(e){}};uJe=I([m(4,Uo),m(5,ct),m(6,ie)],uJe);var mee=class{constructor(i,e,t,o,n,r){this._mergeEditorTelemetry=i;this._instantiationService=e;this._textModelService=t;this.textFileService=o;this._modelService=n;this._languageService=r}static{this.FILE_SAVED_SOURCE=Qh.registerSource("merge-editor.source",d(13337,null))}async createInputModel(i){let e=new O,[t,o,n,r]=await Promise.all([this._textModelService.createModelReference(i.base).then(g=>({object:g.object.textEditorModel,dispose:()=>g.dispose()})).catch(g=>{mt(g),console.error(g)}),this._textModelService.createModelReference(i.result),RNt(i.input1,this._textModelService,e),RNt(i.input2,this._textModelService,e)]);if(t===void 0){let g=this._modelService.createModel("",this._languageService.createById(o.object.getLanguageId()));t={dispose:()=>{g.dispose()},object:g}}e.add(t),e.add(o);let s=this.textFileService.files.models.find(g=>g.resource.toString()===o.object.textEditorModel.uri.toString());if(!s)throw new ci;await s.save({source:mee.FILE_SAVED_SOURCE});let u=s.textEditorModel.getLinesContent().some(g=>g.startsWith(Ico.start)),p=this._instantiationService.createInstance(ame),h=this._instantiationService.createInstance(dme,t.object,n,r,o.object.textEditorModel,p,{resetResult:u},this._mergeEditorTelemetry);return e.add(h),await h.onInitialized,this._instantiationService.createInstance(pJe,h,e,s,this._mergeEditorTelemetry)}};mee=I([m(1,F),m(2,Bt),m(3,Uo),m(4,_t),m(5,Rt)],mee);var pJe=class extends Zh{constructor(e,t,o,n,r,s){super();this.model=e;this.disposableStore=t;this.resultTextFileModel=o;this.telemetry=n;this._dialogService=r;this._storageService=s;this.isDirty=vi(this,U.any(this.resultTextFileModel.onDidChangeDirty,this.resultTextFileModel.onDidSaveError),()=>this.resultTextFileModel.isDirty()),this.reported=!1,this.dateTimeOpened=new Date}dispose(){this.disposableStore.dispose(),super.dispose(),this.reportClose(!1)}reportClose(e){if(!this.reported){let t=this.model.unhandledConflictsCount.get(),o=new Date().getTime()-this.dateTimeOpened.getTime();this.telemetry.reportMergeEditorClosed({durationOpenedSecs:o/1e3,remainingConflictCount:t,accepted:e,conflictCount:this.model.conflictCount,combinableConflictCount:this.model.combinableConflictCount,conflictsResolvedWithBase:this.model.conflictsResolvedWithBase,conflictsResolvedWithInput1:this.model.conflictsResolvedWithInput1,conflictsResolvedWithInput2:this.model.conflictsResolvedWithInput2,conflictsResolvedWithSmartCombination:this.model.conflictsResolvedWithSmartCombination,manuallySolvedConflictCountThatEqualNone:this.model.manuallySolvedConflictCountThatEqualNone,manuallySolvedConflictCountThatEqualSmartCombine:this.model.manuallySolvedConflictCountThatEqualSmartCombine,manuallySolvedConflictCountThatEqualInput1:this.model.manuallySolvedConflictCountThatEqualInput1,manuallySolvedConflictCountThatEqualInput2:this.model.manuallySolvedConflictCountThatEqualInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBase:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart:this.model.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart}),this.reported=!0}}async accept(){this.reportClose(!0),await this.resultTextFileModel.save()}get resultUri(){return this.resultTextFileModel.resource}async save(e){await this.resultTextFileModel.save(e)}async revert(e){await this.resultTextFileModel.revert(e)}shouldConfirmClose(){return!0}async confirmClose(e){let t=e.length>1,o=e.some(r=>r.isDirty.get()),n=e.some(r=>r.model.hasUnhandledConflicts.get());if(o){let r=t?d(13356,null,e.length):d(13354,null,Be(e[0].resultUri)),{result:s}=await this._dialogService.prompt({type:wt.Info,message:r,detail:n?t?d(13351,null):d(13348,null):t?d(13350,null):d(13347,null),buttons:[{label:n?d(13359,null):d(13358,null),run:()=>0},{label:d(13353,null),run:()=>1}],cancelButton:{run:()=>2}});return s}else if(n&&!this._storageService.getBoolean(dJe,0,!1)){let{confirmed:r,checkboxChecked:s}=await this._dialogService.confirm({message:t?d(13357,null,e.length):d(13355,null,Be(e[0].resultUri)),detail:n?t?d(13352,null):d(13349,null):void 0,primaryButton:n?d(13346,null):d(13345,null),checkbox:{label:d(13340,null)}});return s&&this._storageService.store(dJe,!0,0,0),r?0:2}else return 0}};pJe=I([m(4,ct),m(5,de)],pJe);async function RNt(a,i,e){let t=await i.createModelReference(a.uri);return e.add(t),{textModel:t.object.textEditorModel,title:a.title,description:a.description,detail:a.detail}}var nRe=class{constructor(i){this.telemetryService=i}reportMergeEditorOpened(i){this.telemetryService.publicLog2("mergeEditor.opened",{conflictCount:i.conflictCount,combinableConflictCount:i.combinableConflictCount,baseVisible:i.baseVisible,isColumnView:i.isColumnView,baseTop:i.baseTop})}reportLayoutChange(i){this.telemetryService.publicLog2("mergeEditor.layoutChanged",{baseVisible:i.baseVisible,isColumnView:i.isColumnView,baseTop:i.baseTop})}reportMergeEditorClosed(i){this.telemetryService.publicLog2("mergeEditor.closed",{conflictCount:i.conflictCount,combinableConflictCount:i.combinableConflictCount,durationOpenedSecs:i.durationOpenedSecs,remainingConflictCount:i.remainingConflictCount,accepted:i.accepted,conflictsResolvedWithBase:i.conflictsResolvedWithBase,conflictsResolvedWithInput1:i.conflictsResolvedWithInput1,conflictsResolvedWithInput2:i.conflictsResolvedWithInput2,conflictsResolvedWithSmartCombination:i.conflictsResolvedWithSmartCombination,manuallySolvedConflictCountThatEqualNone:i.manuallySolvedConflictCountThatEqualNone,manuallySolvedConflictCountThatEqualSmartCombine:i.manuallySolvedConflictCountThatEqualSmartCombine,manuallySolvedConflictCountThatEqualInput1:i.manuallySolvedConflictCountThatEqualInput1,manuallySolvedConflictCountThatEqualInput2:i.manuallySolvedConflictCountThatEqualInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBase:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBase,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput1,manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithInput2,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothNonSmart,manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart:i.manuallySolvedConflictCountThatEqualNoneAndStartedWithBothSmart})}reportAcceptInvoked(i,e){this.telemetryService.publicLog2("mergeEditor.action.accept",{otherAccepted:e,isInput1:i===1})}reportSmartCombinationInvoked(i){this.telemetryService.publicLog2("mergeEditor.action.smartCombination",{otherAccepted:i})}reportRemoveInvoked(i,e){this.telemetryService.publicLog2("mergeEditor.action.remove",{otherAccepted:e,isInput1:i===1})}reportResetToBaseInvoked(){this.telemetryService.publicLog2("mergeEditor.action.resetToBase",{})}reportNavigationToNextConflict(){this.telemetryService.publicLog2("mergeEditor.action.goToNextConflict",{})}reportNavigationToPreviousConflict(){this.telemetryService.publicLog2("mergeEditor.action.goToPreviousConflict",{})}reportConflictCounterClicked(){this.telemetryService.publicLog2("mergeEditor.action.conflictCounterClicked",{})}};nRe=I([m(0,_e)],nRe);var $3=class{constructor(i,e,t,o){this.uri=i;this.title=e;this.detail=t;this.description=o}},Zb=class extends IE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(n,void 0,s,l,c,u,h,g,f);this.base=e;this.input1=t;this.input2=o;this.result=n;this._instaService=r;this.configurationService=p;this.logService=v;this._focusedEditor="result",this.closeHandler={showConfirm:()=>this._inputModel?.shouldConfirmClose()??!1,confirm:async b=>{Wh(()=>b.every(y=>y.editor instanceof Zb));let S=b.map(y=>y.editor._inputModel).filter(so);return await this._inputModel.confirmClose(S)}},this.mergeEditorModeFactory=this._instaService.createInstance(this.useWorkingCopy?oRe:mee,this._instaService.createInstance(nRe))}static{this.ID="mergeEditor.Input"}get useWorkingCopy(){return this.configurationService.getValue("mergeEditor.useWorkingCopy")??!1}dispose(){super.dispose()}get typeId(){return Zb.ID}get editorId(){return Da.id}get capabilities(){let e=super.capabilities|256;return this.useWorkingCopy&&(e|=4),e}getName(){return d(13330,null,super.getName())}async resolve(){if(!this._inputModel){let e=this._register(await this.mergeEditorModeFactory.createInputModel({base:this.base,input1:this.input1,input2:this.input2,result:this.result}));this._inputModel=e,this._register(ve(t=>{e.isDirty.read(t),this._onDidChangeDirty.fire()})),await this._inputModel.model.onInitialized}return this._inputModel}async accept(){await this._inputModel?.accept()}async save(e,t){await this._inputModel?.save(t)}toUntyped(){return{input1:{resource:this.input1.uri,label:this.input1.title,description:this.input1.description,detail:this.input1.detail},input2:{resource:this.input2.uri,label:this.input2.title,description:this.input2.description,detail:this.input2.detail},base:{resource:this.base},result:{resource:this.result},options:{override:this.typeId}}}matches(e){return this===e?!0:e instanceof Zb?ze(this.base,e.base)&&ze(this.input1.uri,e.input1.uri)&&ze(this.input2.uri,e.input2.uri)&&ze(this.result,e.result):Xy(e)?(this.editorId===e.options?.override||e.options?.override===void 0)&&ze(this.base,e.base.resource)&&ze(this.input1.uri,e.input1.resource)&&ze(this.input2.uri,e.input2.resource)&&ze(this.result,e.result.resource):!1}async revert(e,t){return this._inputModel?.revert(t)}isDirty(){return this._inputModel?.isDirty.get()??!1}setLanguageId(e,t){this._inputModel?.model.setLanguageId(e,t)}updateFocusedEditor(e){this._focusedEditor!==e&&(this._focusedEditor=e,this.logService.trace("alertFocusedEditor",e),wYo(e))}};Zb=I([m(4,F),m(5,ie),m(6,Uo),m(7,nt),m(8,ge),m(9,B),m(10,fr),m(11,Gn),m(12,nb),m(13,re)],Zb);function wYo(a){switch(a){case"input1":cn(d(13327,null));break;case"input2":cn(d(13328,null));break;case"result":cn(d(13329,null));break}}var rRe=class extends k{constructor(e,t){super();this.model=e;this._instantiationService=t;this._documentsArr=ke(this,e=>{let t=this._documents.read(e);return t==="loading"?[]:t});this.focusedDiffItem=ke(this,e=>this.items.read(e).find(t=>t.isFocused.read(e)));this.activeDiffItem=k4e(this,(e,t)=>this.focusedDiffItem.read(e)??(t&&this.items.read(e).indexOf(t)!==-1)?t:void 0);this._documents=qle(this.model,this.model.documents);let o=Pb(this,this._documentsArr,(r,s)=>s.add(qF.create(this._instantiationService.createInstance(mJe,r,this)))).recomputeInitiallyAndOnChange(this._store);this._waitForNewDiffs=ke(this,r=>{let s=o.read(r),l=s.filter(c=>!c.object.waitForInitialDiffOr1s.promiseResult.read(void 0));return l.length===0?Uc.resolved(s):new Uc(Promise.all(l.map(c=>c.object.waitForInitialDiffOr1s.promise)).then(()=>s))});let n=new w4e(this._waitForNewDiffs,[],this._store);this.items=ke(this,r=>n.lastResolved.read(r).map(l=>r.store.add(l.createNewRef(l)).object)),this.isLoading=ke(this,r=>this._documents.read(r)==="loading"||n.isResolving.read(r))}async waitForDiffOr1s(){this._documents.get()==="loading"&&await yh(this._documents,e=>e!=="loading"),await this._waitForNewDiffs.get().promise}collapseAll(){Ki(e=>{for(let t of this.items.get())t.collapsed.set(!0,e)})}expandAll(){Ki(e=>{for(let t of this.items.get())t.collapsed.set(!1,e)})}get contextKeys(){return this.model.contextKeys}},mJe=class extends k{constructor(e,t,o,n){super();this._editorViewModel=t;this._instantiationService=o;this._modelService=n;this.collapsed=De(this,!1);this.lastTemplateData=De(this,{contentHeight:500,selections:void 0});this.isActive=ke(this,e=>this._editorViewModel.activeDiffItem.read(e)===this);this._isFocusedSource=De(this,Fo(!1));this.isFocused=ke(this,e=>this._isFocusedSource.read(e).read(e));this.isAlive=De(this,!0);this._register(ee(()=>{this.isAlive.set(!1,void 0)})),this._documentDiffItemRef=this._register(e.createNewRef(this));function r(p){return{...p,hideUnchangedRegions:{enabled:!0}}}let s=this._instantiationService.createInstance(YX,r(this.documentDiffItem.options||{}));this.documentDiffItem.onOptionsDidChange&&this._register(this.documentDiffItem.onOptionsDidChange(()=>{s.updateOptions(r(this.documentDiffItem.options||{}))}));let l=new O,c=this.documentDiffItem.original??l.add(this._modelService.createModel("",null)),u=this.documentDiffItem.modified??l.add(this._modelService.createModel("",null));l.add(this._documentDiffItemRef.createNewRef(this)),this.diffEditorViewModelRef=this._register(qF.createWithDisposable(this._instantiationService.createInstance($X,{original:c,modified:u},s),l,this)),this.waitForInitialDiffOr1s=new Uc(Promise.race([this.diffEditorViewModel.waitForDiff().catch(bwe),Li(1e3,wz(this._store)).catch(bwe)]))}get diffEditorViewModel(){return this.diffEditorViewModelRef.object}get originalUri(){return this.documentDiffItem.original?.uri}get modifiedUri(){return this.documentDiffItem.modified?.uri}setIsFocused(e,t){this._isFocusedSource.set(e,t)}get documentDiffItem(){return this._documentDiffItemRef.object}getKey(){return JSON.stringify([this.originalUri?.toString(),this.modifiedUri?.toString()])}};mJe=I([m(2,F),m(3,_t)],mJe);var Tco=Oe("multi-diff-editor-label-icon",L.diffMultiple,d(13444,null));var rG=le("multiDiffSourceResolverService"),wE=class{constructor(i,e,t,o,n){this.originalUri=i;this.modifiedUri=e;this.goToFileUri=t;this.goToFileEditorTitle=o;this.contextKeys=n;if(!i&&!e)throw new ci("Invalid arguments")}getKey(){return JSON.stringify([this.modifiedUri?.toString(),this.originalUri?.toString()])}},LNt=class{constructor(){this._resolvers=new Set}registerResolver(i){if(this._resolvers.has(i))throw new ci("Duplicate resolver");return this._resolvers.add(i),ee(()=>this._resolvers.delete(i))}resolve(i){for(let e of this._resolvers)if(e.canHandleUri(i))return e.resolveDiffSource(i);return Promise.resolve(void 0)}};var Ou=class extends Ls{constructor(e,t,o,n=!1,r,s,l,c,u){super();this.multiDiffSource=e;this.label=t;this.initialResources=o;this.isTransient=n;this._textModelService=r;this._textResourceConfigurationService=s;this._instantiationService=l;this._multiDiffSourceResolverService=c;this._textFileService=u;this._name="",this._viewModel=new cbt(async()=>{let p=await this._createModel();this._register(p);let h=new rRe(p,this._instantiationService);return this._register(h),await Uu(h.waitForDiffOr1s(),1e3),h}),this._resolvedSource=new C4e(async()=>{let p=this.initialResources?{resources:ewe.const(this.initialResources)}:await this._multiDiffSourceResolverService.resolve(this.multiDiffSource);return{source:p,resources:p?qle(this,p.resources):Fo([])}}),this.resources=ke(this,p=>this._resolvedSource.cachedPromiseResult.read(p)?.data?.resources.read(p)),this.textFileServiceOnDidChange=new XIi(this._textFileService.files.onDidChangeDirty,p=>p.resource.toString(),p=>p.toString()),this._isDirtyObservables=Pb(this,this.resources.map(p=>p??[]),p=>{let h=p.modifiedUri?_co(this.textFileServiceOnDidChange,this._textFileService,p.modifiedUri):Fo(!1),g=p.originalUri?_co(this.textFileServiceOnDidChange,this._textFileService,p.originalUri):Fo(!1);return ke(f=>h.read(f)||g.read(f))},p=>p.getKey()),this._isDirtyObservable=ke(this,p=>this._isDirtyObservables.read(p).some(h=>h.read(p))).keepObserved(this._store),this.onDidChangeDirty=U.fromObservableLight(this._isDirtyObservable),this.closeHandler={async confirm(){return 1},showConfirm(){return!1}},this._register(ve(p=>{let h=this.resources.read(p),g=this.label??d(13446,null);h&&h.length===1?this._name=d(13448,null,g):h?this._name=d(13447,null,g,h.length):this._name=g,this._onDidChangeLabel.fire()}))}static fromResourceMultiDiffEditorInput(e,t){if(!e.multiDiffSource&&!e.resources)throw new ci("MultiDiffEditorInput requires either multiDiffSource or resources");let o=e.multiDiffSource??A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`);return t.createInstance(Ou,o,e.label,e.resources?.map(n=>new wE(n.original.resource,n.modified.resource,n.goToFileResource)),e.isTransient??!1)}static fromSerialized(e,t){return t.createInstance(Ou,A.parse(e.multiDiffSourceUri),e.label,e.resources?.map(o=>new wE(o.originalUri?A.parse(o.originalUri):void 0,o.modifiedUri?A.parse(o.modifiedUri):void 0,o.goToFileUri?A.parse(o.goToFileUri):void 0)),!1)}static{this.ID="workbench.input.multiDiffEditor"}get resource(){return this.multiDiffSource}get capabilities(){return 2}get typeId(){return Ou.ID}getName(){return this._name}get editorId(){return Da.id}getIcon(){return Tco}serialize(){return{label:this.label,multiDiffSourceUri:this.multiDiffSource.toString(),resources:this.initialResources?.map(e=>({originalUri:e.originalUri?.toString(),modifiedUri:e.modifiedUri?.toString(),goToFileUri:e.goToFileUri?.toString()}))}}setLanguageId(e,t){let n=this._viewModel.requireValue().activeDiffItem.get()?.documentDiffItem;if(!n)return;let r=n.modified??n.original;r&&r.setLanguage(e,t)}async getViewModel(){return this._viewModel.getPromise()}async _createModel(){let e=await this._resolvedSource.getPromise(),t=this._textResourceConfigurationService,o=Pb(this,e.resources,async(c,u)=>{let p,h,g=new O;try{[p,h]=await Promise.all([c.originalUri?this._textModelService.createModelReference(c.originalUri):void 0,c.modifiedUri?this._textModelService.createModelReference(c.modifiedUri):void 0]),p&&g.add(p),h&&g.add(h)}catch(b){console.error(b),mt(b);return}let f=c.modifiedUri??c.originalUri,v={multiDiffEditorItem:c,original:p?.object.textEditorModel,modified:h?.object.textEditorModel,contextKeys:c.contextKeys,get options(){return{...CYo(h?.object.isReadonly()??!0),...xYo(t.getValue(f))}},onOptionsDidChange:b=>this._textResourceConfigurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration(f,"editor")||S.affectsConfiguration(f,"diffEditor"))&&b()})};return u.add(qF.createOfNonDisposable(v,g,this))},c=>JSON.stringify([c.modifiedUri?.toString(),c.originalUri?.toString()])),n=De("documents","loading"),r=ke(async c=>{let u=o.read(c),h=(await Promise.all(u)).filter(so);n.set(h,void 0)}),s=bA(r);return await r.get(),{dispose:()=>s.dispose(),documents:new cF(n),contextKeys:e.source?.contextKeys}}matches(e){return super.matches(e)?!0:e instanceof Ou?this.multiDiffSource.toString()===e.multiDiffSource.toString():!1}isDirty(){return this._isDirtyObservable.get()}async save(e,t){return await this.doSaveOrRevert("save",e,t),this}revert(e,t){return this.doSaveOrRevert("revert",e,t)}async doSaveOrRevert(e,t,o){let n=this._viewModel.currentValue?.items.get();n&&await Promise.all(n.map(async r=>{let s=r.diffEditorViewModel.model,l=s.original.uri.scheme!==Q.untitled&&this._textFileService.isDirty(s.original.uri);await Promise.all([l?e==="save"?this._textFileService.save(s.original.uri,o):this._textFileService.revert(s.original.uri,o):Promise.resolve(),e==="save"?this._textFileService.save(s.modified.uri,o):this._textFileService.revert(s.modified.uri,o)])}))}};Ou=I([m(4,Bt),m(5,Gn),m(6,F),m(7,rG),m(8,Uo)],Ou);var XIi=class{constructor(i,e,t){this._event=i;this._getEventArgsKey=e;this._keyToString=t;this._count=0;this._buckets=new Map;this._handleEventChange=i=>{let e=this._getEventArgsKey(i),t=this._buckets.get(e);if(t)for(let o of t)o(i)}}filteredEvent(i){return e=>{let t=this._keyToString(i),o=this._buckets.get(t);return o||(o=new Set,this._buckets.set(t,o)),o.add(e),this._count++,this._count===1&&(this._eventSubscription=this._event(this._handleEventChange)),{dispose:()=>{o.delete(e),o.size===0&&this._buckets.delete(t),this._count--,this._count===0&&(this._eventSubscription?.dispose(),this._eventSubscription=void 0)}}}}};function _co(a,i,e){return vi(a.filteredEvent(e),()=>i.isDirty(e))}function CYo(a){return{readOnly:!!a,readOnlyMessage:typeof a!="boolean"?a:void 0}}function xYo(a){let i=io(a.editor);if(Di(a.diffEditor)){let e=io(a.diffEditor);e.diffCodeLens=e.codeLens,delete e.codeLens,e.diffWordWrap=e.wordWrap,delete e.wordWrap,Object.assign(i,e)}return i}var ume=class extends k{static{this.ID="workbench.contrib.multiDiffEditorResolver"}constructor(i,e){super(),this._register(i.registerEditor("*",{id:Da.id,label:Da.displayName,detail:Da.providerDisplayName,priority:"builtin"},{},{createMultiDiffEditorInput:t=>({editor:Ou.fromResourceMultiDiffEditorInput(t,e)})}))}};ume=I([m(0,il),m(1,F)],ume);var MNt=class{canSerialize(i){return i instanceof Ou&&!i.isTransient}serialize(i){if(this.canSerialize(i))return JSON.stringify(i.serialize())}deserialize(i,e){try{let t=Dm(e);return Ou.fromSerialized(t,i)}catch(t){mt(t);return}}};var an=le("terminalService"),mp=le("terminalConfigurationService"),hb=le("terminalEditorService"),hee=le("terminalEditingService"),Cc=le("terminalGroupService"),uh=le("terminalInstanceService"),tg=le("terminalChatService");var $M=a=>!on(a.instanceId),pme=class extends MouseEvent{},sG="terminalEditor";var Dco=["workbench.action.terminal.focusAccessibleBuffer"];var Rco={"terminal.integrated.accessibleViewPreserveCursorPosition":{markdownDescription:d(16402,null),type:"boolean",default:!1},"terminal.integrated.accessibleViewFocusOnCommandExecution":{markdownDescription:d(16401,null),type:"boolean",default:!1}};var Lco={"terminal.integrated.autoReplies":{markdownDescription:d(16403,null,'`"Terminate batch job (Y/N)": "Y\\r"`','`"\\r"`'),type:"object",additionalProperties:{oneOf:[{type:"string",description:d(16404,null)},{type:"null"}]},restricted:!0,default:{}}};var Mco=R.for("terminalChatWidget"),tW=R.for("terminalChatWidget.status"),Bel=R.for("terminalChatWidget.toolbar"),kYo=R.for("chatTerminalToolProgress");var ol;(v=>(v.focused=new Y("terminalChatFocus",!1,d(16406,null)),v.visible=new Y("terminalChatVisible",!1,d(16411,null)),v.requestActive=new Y("terminalChatActiveRequest",!1,d(16408,null)),v.inputHasText=new Y("terminalChatInputHasText",!1,d(16407,null)),v.responseContainsCodeBlock=new Y("terminalChatResponseContainsCodeBlock",!1,d(16409,null)),v.responseContainsMultipleCodeBlocks=new Y("terminalChatResponseContainsMultipleCodeBlocks",!1,d(16410,null)),v.hasChatAgent=new Y("terminalChatAgentRegistered",!1,d(16405,null)),v.hasChatTerminals=new Y("hasChatTerminals",!1,d(16412,null)),v.hasHiddenChatTerminals=new Y("hasHiddenChatTerminals",!1,d(16413,null)),v.chatToolHasInstance=new Y("chatTerminalToolHasInstance",!1),v.chatToolCanContinueInBackground=new Y("chatTerminalToolCanContinueInBackground",!1),v.chatToolHasOutput=new Y("chatTerminalToolHasOutput",!1),v.chatToolUsesCollapsible=new Y("chatTerminalToolUsesCollapsible",!1),v.chatToolIsHiddenTerminal=new Y("chatTerminalToolIsHiddenTerminal",!1),v.chatToolOutputExpanded=new Y("chatTerminalToolOutputExpanded",!1)))(ol||={});var Kel=le("ptyService");var HH={Backend:"workbench.contributions.terminal.processBackend"},JIi=class{constructor(){this._backends=new Map}get backends(){return this._backends}registerTerminalBackend(i){let e=this._sanitizeRemoteAuthority(i.remoteAuthority);if(this._backends.has(e))throw new Error(`A terminal backend with remote authority '${e}' was already registered.`);this._backends.set(e,i)}getTerminalBackend(i){return this._backends.get(this._sanitizeRemoteAuthority(i))}_sanitizeRemoteAuthority(i){return i?.toLowerCase()??""}};oe.add(HH.Backend,new JIi);var PNt=le("localPtyService"),wa=le("terminalLogService");var Pco={"terminal.integrated.initialHint":{restricted:!0,markdownDescription:d(16754,null,"`#terminal.integrated.sendKeybindingsToShell#`"),type:"boolean",default:!0,agentsWindow:{default:!1}},"terminal.integrated.initialHintCopilotCli":{restricted:!0,markdownDescription:d(16755,null,"`copilot`"),type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"}}};function ANt(a,i){let e=[{name:null,description:d(2605,null)}];return e.push(...a.map(t=>({name:t.profileName,description:EYo(t)}))),i&&e.push(...i.map(t=>({name:t.title,description:TYo(t)}))),{values:e.map(t=>t.name),markdownDescriptions:e.map(t=>t.description)}}function EYo(a){let i=`$(${q.isThemeIcon(a.icon)?a.icon.id:a.icon?a.icon:L.terminal.id}) ${a.profileName}
- path: ${a.path}`;return a.args&&(We(a.args)?i+=`
- args: "${a.args}"`:i+=`
- args: [${a.args.length===0?"":`'${a.args.join("','")}'`}]`),a.overrideName!==void 0&&(i+=`
- overrideName: ${a.overrideName}`),a.color&&(i+=`
- color: ${a.color}`),a.env&&(i+=`
- env: ${JSON.stringify(a.env)}`),i}function TYo(a){return`$(${q.isThemeIcon(a.icon)?a.icon.id:a.icon?a.icon:L.terminal.id}) ${a.title}
- extensionIdentifier: ${a.extensionIdentifier}`}function Aco(a,i){if(!a&&!i)return!0;if(We(a)&&We(i))return a===i;if(Array.isArray(a)&&Array.isArray(i)){if(a.length!==i.length)return!1;for(let e=0;e<a.length;e++)if(a[e]!==i[e])return!1;return!0}return!1}function Nco(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;if(q.isThemeIcon(a)&&q.isThemeIcon(i))return a.id===i.id&&a.color===i.color;if(Di(a)&&!A.isUri(a)&&!q.isThemeIcon(a)&&Di(i)&&!A.isUri(i)&&!q.isThemeIcon(i)){let e=a,t=i;if((A.isUri(e.light)||jm(e.light))&&(A.isUri(e.dark)||jm(e.dark))&&(A.isUri(t.light)||jm(t.light))&&(A.isUri(t.dark)||jm(t.dark)))return e.light.path===t.light.path&&e.dark.path===t.dark.path}if(A.isUri(a)&&A.isUri(i)||jm(a)||jm(i)){let e=a,t=i;return e.path===t.path&&e.scheme===t.scheme}return!1}var iyi={type:["string","null"],enum:["terminal.ansiBlack","terminal.ansiRed","terminal.ansiGreen","terminal.ansiYellow","terminal.ansiBlue","terminal.ansiMagenta","terminal.ansiCyan","terminal.ansiWhite"],default:null},oyi={type:"string",enum:Array.from(l5(),a=>a.id),markdownEnumDescriptions:Array.from(l5(),a=>`$(${a.id})`)},gee={args:{description:d(2589,null),type:"array",items:{type:"string"}},icon:{description:d(2592,null),...oyi},color:{description:d(2590,null),...iyi},env:{markdownDescription:d(2591,null),type:"object",additionalProperties:{type:["string","null"]},default:{}}},ZIi={type:"object",required:["path"],properties:{path:{description:d(2600,null),type:["string","array"],items:{type:"string"}},overrideName:{description:d(2599,null),type:"boolean"},...gee}},sRe={type:"object",required:["path"],properties:{path:{description:d(2587,null),type:["string"],items:{type:"string"}},...gee}};function eyi(a){let i=a===2?"linux":a===1?"osx":"windows";return d(2584,null,oD(a),'```json\n"terminal.integrated.profile.'+i+'": {\n  "bash": null\n}\n```',"[","](https://code.visualstudio.com/docs/terminal/profiles)")}var _Yo={id:"terminal",order:100,title:d(2588,null),type:"object",properties:{"terminal.integrated.automationProfile.linux":{restricted:!0,markdownDescription:d(2575,null),type:["object","null"],default:null,anyOf:[{type:"null"},sRe],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.osx":{restricted:!0,markdownDescription:d(2576,null),type:["object","null"],default:null,anyOf:[{type:"null"},sRe],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.automationProfile.windows":{restricted:!0,markdownDescription:d(2577,null,"`terminal.integrated.automationShell.windows`"),type:["object","null"],default:null,anyOf:[{type:"null"},sRe],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.agentHostProfile.linux":{restricted:!0,markdownDescription:d(2572,null,"`#terminal.integrated.profiles.linux#`","`#terminal.integrated.defaultProfile.linux#`"),type:["string","object","null"],default:null,anyOf:[{type:"null"},{type:"string"},sRe],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.agentHostProfile.osx":{restricted:!0,markdownDescription:d(2573,null,"`#terminal.integrated.profiles.osx#`","`#terminal.integrated.defaultProfile.osx#`"),type:["string","object","null"],default:null,anyOf:[{type:"null"},{type:"string"},sRe],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.agentHostProfile.windows":{restricted:!0,markdownDescription:d(2574,null,"`#terminal.integrated.profiles.windows#`","`#terminal.integrated.defaultProfile.windows#`"),type:["string","object","null"],default:null,anyOf:[{type:"null"},{type:"string"},sRe],defaultSnippets:[{body:{path:"${1}",icon:"${2}"}}]},"terminal.integrated.profiles.windows":{restricted:!0,markdownDescription:eyi(3),type:"object",default:{PowerShell:{source:"PowerShell",icon:L.terminalPowershell.id},"Command Prompt":{path:["${env:windir}\\Sysnative\\cmd.exe","${env:windir}\\System32\\cmd.exe"],args:[],icon:L.terminalCmd.id},"Git Bash":{source:"Git Bash",icon:L.terminalGitBash.id}},additionalProperties:{anyOf:[{type:"object",required:["source"],properties:{source:{description:d(2604,null),enum:["PowerShell","Git Bash"]},...gee}},{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2602,null),type:"string"},id:{description:d(2601,null),type:"string"},title:{description:d(2603,null),type:"string"},...gee}},{type:"null"},ZIi]}},"terminal.integrated.profiles.osx":{restricted:!0,markdownDescription:eyi(1),type:"object",default:{bash:{path:"bash",args:["-l"],icon:L.terminalBash.id},zsh:{path:"zsh",args:["-l"]},fish:{path:"fish",args:["-l"]},tmux:{path:"tmux",icon:L.terminalTmux.id},pwsh:{path:"pwsh",icon:L.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2597,null),type:"string"},id:{description:d(2596,null),type:"string"},title:{description:d(2598,null),type:"string"},...gee}},{type:"null"},ZIi]}},"terminal.integrated.profiles.linux":{restricted:!0,markdownDescription:eyi(2),type:"object",default:{bash:{path:"bash",icon:L.terminalBash.id},zsh:{path:"zsh"},fish:{path:"fish"},tmux:{path:"tmux",icon:L.terminalTmux.id},pwsh:{path:"pwsh",icon:L.terminalPowershell.id}},additionalProperties:{anyOf:[{type:"object",required:["extensionIdentifier","id","title"],properties:{extensionIdentifier:{description:d(2594,null),type:"string"},id:{description:d(2593,null),type:"string"},title:{description:d(2595,null),type:"string"},...gee}},{type:"null"},ZIi]}},"terminal.integrated.useWslProfiles":{description:d(2586,null),type:"boolean",default:!0},"terminal.integrated.inheritEnv":{scope:1,description:d(2582,null),type:"boolean",default:!0},"terminal.integrated.persistentSessionScrollback":{scope:1,markdownDescription:d(2583,null),type:"number",default:100},"terminal.integrated.showLinkHover":{scope:1,description:d(2585,null),type:"boolean",default:!0},"terminal.integrated.ignoreProcessNames":{markdownDescription:d(2578,null,"`#terminal.integrated.confirmOnKill#`"),type:"array",items:{type:"string",uniqueItems:!0},default:["starship","oh-my-posh","bash","zsh"]}}};function Oco(){oe.as($t.Configuration).registerConfiguration(_Yo),nyi()}var tyi;function nyi(a,i){let e=oe.as($t.Configuration),t;a&&(t=ANt(a?.profiles,i));let o=tyi;tyi={id:"terminal",order:100,title:d(2588,null),type:"object",properties:{"terminal.integrated.defaultProfile.linux":{restricted:!0,markdownDescription:d(2579,null),type:["string","null"],default:null,enum:a?.os===3?t?.values:void 0,markdownEnumDescriptions:a?.os===3?t?.markdownDescriptions:void 0},"terminal.integrated.defaultProfile.osx":{restricted:!0,markdownDescription:d(2580,null),type:["string","null"],default:null,enum:a?.os===2?t?.values:void 0,markdownEnumDescriptions:a?.os===2?t?.markdownDescriptions:void 0},"terminal.integrated.defaultProfile.windows":{restricted:!0,markdownDescription:d(2581,null),type:["string","null"],default:null,enum:a?.os===1?t?.values:void 0,markdownEnumDescriptions:a?.os===1?t?.markdownDescriptions:void 0}}},e.updateConfigurations({add:[tyi],remove:o?[o]:[]})}var Fco={type:"boolean",enum:[!0,!1],enumDescriptions:[d(16633,null),d(16627,null)],description:d(16628,null)},ryi={type:"object",required:["path"],properties:{path:{description:d(16660,null),type:"string"},...gee}},aRe={"chat.tools.terminal.enableAutoApprove":{description:d(16634,null),type:"boolean",default:!0,policy:{name:"ChatToolsTerminalEnableAutoApprove",category:"IntegratedTerminal",minimumVersion:"1.104",localization:{description:{key:"autoApproveMode.description",value:d(16634,null)}}},agentsWindow:{default:!0}},"chat.tools.terminal.autoApprove":{markdownDescription:[d(16624,null,"`/`","`i`"),d(16626,null,"`true`","`false`","`null`"),d(16625,null,"`foo && bar`","`foo`","`bar`","`true`","`false`","`<(foo)`"),d(16611,null,"`{ approve: false, matchCommandLine: true }`"),d(16609,null,"`#chat.tools.terminal.ignoreDefaultAutoApproveRules#`","`true`"),[d(16622,null),`|${d(16623,null)}|${d(16613,null)}|`,"|---|---|",'| `"mkdir": true` | '+d(16614,null,"`mkdir`"),'| `"npm run build": true` | '+d(16615,null,"`npm run build`"),'| `"bin/test.sh": true` | '+d(16612,null,"`bin/test.sh`","`bin\\test.sh`","`./bin/test.sh`"),'| `"/^git (status\\|show\\\\b.*)$/": true` | '+d(16619,null,"`git status`","`git show`"),'| `"/^Get-ChildItem\\\\b/i": true` | '+d(16618,null,"`Get-ChildItem`"),'| `"/.*/": true` | '+d(16617,null),'| `"rm": false` | '+d(16620,null,"`rm`"),'| `"/\\\\.ps1/i": { approve: false, matchCommandLine: true }` | '+d(16616,null,'`".ps1"`'),'| `"rm": null` | '+d(16621,null,"`false`","`rm`")].join(`
`)].join(`

`),type:"object",additionalProperties:{anyOf:[Fco,{type:"object",properties:{approve:Fco,matchCommandLine:{type:"boolean",enum:[!0,!1],enumDescriptions:[d(16631,null),d(16630,null)],description:d(16629,null)}},required:["approve"]},{type:"null",description:d(16632,null)}]},default:{cd:!0,echo:!0,ls:!0,dir:!0,pwd:!0,cat:!0,head:!0,tail:!0,findstr:!0,wc:!0,tr:!0,cut:!0,cmp:!0,which:!0,basename:!0,dirname:!0,realpath:!0,readlink:!0,stat:!0,file:!0,od:!0,du:!0,df:!0,sleep:!0,nl:!0,grep:!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+status\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+log\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+log\\b.*\\s--output(=|\\s|$)/":!1,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+show\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+diff\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+ls-files\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+grep\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+branch\\b/":!0,"/^git(\\s+(-C\\s+\\S+|--no-pager))*\\s+branch\\b.*\\s-(d|D|m|M|-delete|-force)\\b/":!1,"/^docker\\s+(ps|images|info|version|inspect|logs|top|stats|port|diff|search|events)\\b/":!0,"/^docker\\s+(container|image|network|volume|context|system)\\s+(ls|ps|inspect|history|show|df|info)\\b/":!0,"/^docker\\s+compose\\s+(ps|ls|top|logs|images|config|version|port|events)\\b/":!0,"Get-ChildItem":!0,"Get-Content":!0,"Get-Date":!0,"Get-Random":!0,"Get-Location":!0,"Set-Location":!0,"Write-Host":!0,"Write-Output":!0,"Out-String":!0,"Split-Path":!0,"Join-Path":!0,"Start-Sleep":!0,"Where-Object":!0,"/^Select-[a-z0-9]/i":!0,"/^Measure-[a-z0-9]/i":!0,"/^Compare-[a-z0-9]/i":!0,"/^Format-[a-z0-9]/i":!0,"/^Sort-[a-z0-9]/i":!0,"/^npm\\s+(ls|list|outdated|view|info|show|explain|why|root|prefix|bin|search|doctor|fund|repo|bugs|docs|home|help(-search)?)\\b/":!0,"/^npm\\s+config\\s+(list|get)\\b/":!0,"/^npm\\s+pkg\\s+get\\b/":!0,"/^npm\\s+audit$/":!0,"/^npm\\s+cache\\s+verify\\b/":!0,"/^yarn\\s+(list|outdated|info|why|bin|help|versions)\\b/":!0,"/^yarn\\s+licenses\\b/":!0,"/^yarn\\s+audit\\b(?!.*\\bfix\\b)/":!0,"/^yarn\\s+config\\s+(list|get)\\b/":!0,"/^yarn\\s+cache\\s+dir\\b/":!0,"/^pnpm\\s+(ls|list|outdated|why|root|bin|doctor)\\b/":!0,"/^pnpm\\s+licenses\\b/":!0,"/^pnpm\\s+audit\\b(?!.*\\bfix\\b)/":!0,"/^pnpm\\s+config\\s+(list|get)\\b/":!0,"npm ci":!0,"/^yarn\\s+install\\s+--frozen-lockfile\\b/":!0,"/^pnpm\\s+install\\s+--frozen-lockfile\\b/":!0,column:!0,"/^column\\b.*\\s-c\\s+[0-9]{4,}/":!1,date:!0,"/^date\\b.*\\s(-s|--set)\\b/":!1,find:!0,"/^find\\b.*\\s-(delete|exec|execdir|fprint|fprintf|fls|ok|okdir)\\b/":!1,rg:!0,"/^rg\\b.*\\s(--pre|--hostname-bin)\\b/":!1,sed:!0,"/^sed\\b.*\\s(-[a-zA-Z]*(e|f)[a-zA-Z]*|--expression|--file)\\b/":!1,"/^sed\\b.*s\\/.*\\/.*\\/[ew]/":!1,"/^sed\\b.*;W/":!1,sort:!0,"/^sort\\b.*\\s-(o|S)\\b/":!1,tree:!0,"/^tree\\b.*\\s-o\\b/":!1,"/^xxd$/":!0,"/^xxd\\b(\\s+-\\S+)*\\s+[^-\\s]\\S*$/":!0,rm:!1,rmdir:!1,del:!1,"Remove-Item":!1,ri:!1,rd:!1,erase:!1,dd:!1,kill:!1,ps:!1,top:!1,"Stop-Process":!1,spps:!1,taskkill:!1,"taskkill.exe":!1,curl:!1,wget:!1,"Invoke-RestMethod":!1,"Invoke-WebRequest":!1,irm:!1,iwr:!1,chmod:!1,chown:!1,"Set-ItemProperty":!1,sp:!1,"Set-Acl":!1,jq:!1,xargs:!1,eval:!1,"Invoke-Expression":!1,iex:!1}},"chat.tools.terminal.ignoreDefaultAutoApproveRules":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(16646,null,"`#chat.tools.terminal.autoApprove#`")},"chat.tools.terminal.autoApproveWorkspaceNpmScripts":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],markdownDescription:d(16635,null)},"chat.tools.terminal.blockDetectedFileWrites":{type:"string",enum:["never","outsideWorkspace","all"],enumDescriptions:[d(16640,null),d(16641,null),d(16638,null)],default:"outsideWorkspace",tags:["experimental"],markdownDescription:d(16639,null)},"chat.tools.terminal.shellIntegrationTimeout":{markdownDescription:d(16657,null,"`#terminal.integrated.shellIntegration.enabled#`"),type:"integer",minimum:-1,maximum:6e4,default:-1,markdownDeprecationMessage:d(16656,null,"`#terminal.integrated.shellIntegration.timeout#`")},"chat.tools.terminal.idlePollInterval":{markdownDescription:d(16644,null),type:"integer",minimum:50,maximum:1e4,default:1e3},"chat.tools.terminal.terminalProfile.linux":{restricted:!0,markdownDescription:d(16658,null),type:["object","null"],default:null,anyOf:[{type:"null"},ryi],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.terminalProfile.osx":{restricted:!0,markdownDescription:d(16659,null),type:["object","null"],default:null,anyOf:[{type:"null"},ryi],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.terminalProfile.windows":{restricted:!0,markdownDescription:d(16661,null),type:["object","null"],default:null,anyOf:[{type:"null"},ryi],defaultSnippets:[{body:{path:"${1}"}}]},"chat.tools.terminal.outputLocation":{markdownDescription:d(16649,null),type:"string",enum:["terminal","chat"],enumDescriptions:[d(16650,null),d(16648,null)],default:"chat",tags:["experimental"],experiment:{mode:"auto"}},"chat.agent.sandbox.enabled":{markdownDescription:d(16592,null),type:"string",enum:["off","on","allowNetwork"],enumDescriptions:[d(16594,null),d(16595,null),d(16593,null)],default:"off",tags:["preview"],restricted:!0,experiment:{mode:"auto"},policy:{name:"ChatAgentSandboxEnabled",category:"IntegratedTerminal",minimumVersion:"1.116",localization:{description:{key:"agentSandbox.enabledSetting",value:d(16592,null)},enumDescriptions:[{key:"agentSandbox.enabledSetting.offDescription",value:d(16594,null)},{key:"agentSandbox.enabledSetting.onDescription",value:d(16595,null)},{key:"agentSandbox.enabledSetting.allowNetworkDescription",value:d(16593,null)}]}}},"chat.agent.sandbox.allowUnsandboxedCommands":{markdownDescription:d(16589,null,"`#chat.agent.sandbox.enabled#`"),type:"boolean",default:!0,tags:["preview"],restricted:!0,policy:{name:"ChatAgentSandboxAllowUnsandboxedCommands",category:"IntegratedTerminal",minimumVersion:"1.116",localization:{description:{key:"agentSandbox.allowUnsandboxedCommands",value:d(16589,null,"`#chat.agent.sandbox.enabled#`")}}}},"chat.agent.sandbox.autoApproveUnsandboxedCommands":{markdownDescription:d(16590,null,"`#chat.agent.sandbox.enabled#`","`#chat.agent.sandbox.allowUnsandboxedCommands#`"),type:"boolean",default:!1,tags:["preview"],restricted:!0,policy:{name:"ChatAgentSandboxAutoApproveUnsandboxedCommands",category:"IntegratedTerminal",minimumVersion:"1.116",localization:{description:{key:"agentSandbox.autoApproveUnsandboxedCommands",value:d(16590,null,"`#chat.agent.sandbox.enabled#`","`#chat.agent.sandbox.allowUnsandboxedCommands#`")}}}},"chat.agent.sandbox.allowAutoApprove":{markdownDescription:d(16588,null,"`#chat.agent.sandbox.enabled#`"),type:"boolean",default:!0,tags:["preview"],restricted:!0,policy:{name:"ChatAgentSandboxAllowAutoApprove",category:"IntegratedTerminal",minimumVersion:"1.116",localization:{description:{key:"agentSandbox.allowAutoApprove",value:d(16588,null,"`#chat.agent.sandbox.enabled#`")}}}},"chat.agent.sandbox.fileSystem.linux":{markdownDescription:d(16598,null,"`#chat.agent.sandbox.enabled#`"),type:"object",properties:{denyRead:{type:"array",description:d(16601,null),items:{type:"string"},default:[]},allowRead:{type:"array",description:d(16599,null),items:{type:"string"},default:[]},allowWrite:{type:"array",description:d(16600,null),items:{type:"string"},default:[]},denyWrite:{type:"array",description:d(16602,null),items:{type:"string"},default:[]}},default:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},tags:["preview"],restricted:!0},"chat.agent.sandbox.fileSystem.mac":{markdownDescription:d(16603,null,"`#chat.agent.sandbox.enabled#`"),type:"object",properties:{denyRead:{type:"array",description:d(16606,null),items:{type:"string"},default:[]},allowRead:{type:"array",description:d(16604,null),items:{type:"string"},default:[]},allowWrite:{type:"array",description:d(16605,null),items:{type:"string"},default:[]},denyWrite:{type:"array",description:d(16607,null),items:{type:"string"},default:[]}},default:{denyRead:[],allowRead:[],allowWrite:[],denyWrite:[]},tags:["preview"],restricted:!0},"chat.agent.sandbox.advanced.runtime":{included:!1,markdownDescription:d(16608,null,"`#chat.agent.sandbox.enabled#`"),type:"object",default:{},additionalProperties:!0,tags:["preview"],restricted:!0},"chat.tools.terminal.preventShellHistory":{type:"boolean",default:!0,markdownDescription:[d(16651,null),`- \`bash\`: ${d(16652,null)}`,`- \`zsh\`: ${d(16655,null)}`,`- \`fish\`: ${d(16653,null)}`,`- \`pwsh\`: ${d(16654,null)}`].join(`
`)},"chat.tools.terminal.enforceTimeoutFromModel":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],experiment:{mode:"auto"},markdownDescription:d(16643,null)},"chat.tools.terminal.idleSilenceTimeoutMs":{restricted:!0,type:"number",default:6e4,minimum:0,tags:["experimental"],experiment:{mode:"auto"},markdownDescription:d(16645,null,"`0`")},"chat.tools.terminal.detachBackgroundProcesses":{included:!1,restricted:!0,type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(16642,null)},"chat.tools.terminal.backgroundNotifications":{restricted:!0,type:"boolean",default:!0,tags:["experimental"],deprecated:!0,markdownDeprecationMessage:d(16636,null),markdownDescription:d(16637,null)},"chat.tools.terminal.outputDeltas":{restricted:!0,type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"},markdownDescription:d(16647,null)}};for(let a of["chat.agent.terminal.allowList","chat.agent.terminal.denyList","github.copilot.chat.agent.terminal.allowList","github.copilot.chat.agent.terminal.denyList","chat.agent.terminal.autoApprove"])aRe[a]={deprecated:!0,markdownDeprecationMessage:d(16610,null,"`#chat.tools.terminal.autoApprove#`")};aRe["chat.agent.sandboxFileSystem.linux"]={type:"object",deprecated:!0,markdownDeprecationMessage:d(16596,null,"`#chat.agent.sandbox.fileSystem.linux#`")};aRe["chat.agent.sandboxFileSystem.mac"]={type:"object",deprecated:!0,markdownDeprecationMessage:d(16597,null,"`#chat.agent.sandbox.fileSystem.mac#`")};aRe["chat.agent.sandbox"]={type:"boolean",deprecated:!0,included:!1,markdownDeprecationMessage:d(16591,null,"`#chat.agent.sandbox.enabled#`")};var Vco="terminal.integrated.shellIntegration",Bco={"terminal.integrated.shellIntegration.showCommandGuide":{restricted:!0,markdownDescription:d(16680,null),type:"boolean",default:!0}};var Hco=["workbench.action.terminal.focusFind","workbench.action.terminal.hideFind","workbench.action.terminal.findNext","workbench.action.terminal.findPrevious","workbench.action.terminal.toggleFindRegex","workbench.action.terminal.toggleFindWholeWord","workbench.action.terminal.toggleFindCaseSensitive","workbench.action.terminal.searchWorkspace"];var Uco=["workbench.action.terminal.goToRecentDirectory","workbench.action.terminal.runRecentCommand"];var zco={"terminal.integrated.shellIntegration.history":{restricted:!0,markdownDescription:d(16741,null),type:"number",default:100}};var Kco={"terminal.integrated.enableNotifications":{description:d(16782,null),type:"boolean",default:!0}};var Gco={"terminal.integrated.stickyScroll.enabled":{markdownDescription:d(16826,null,"https://code.visualstudio.com/docs/terminal/shell-integration","`#terminal.integrated.shellIntegration.enabled#`"),type:"boolean",default:!0},"terminal.integrated.stickyScroll.maxLineCount":{markdownDescription:d(16828,null),type:"number",default:5,minimum:1,maximum:10},"terminal.integrated.stickyScroll.ignoredCommands":{markdownDescription:d(16827,null),type:"array",items:{type:"string"},default:["clear","cls","clear-host","copilot","claude","codex","gemini"]}};var qco=["workbench.action.terminal.selectPrevSuggestion","workbench.action.terminal.selectPrevPageSuggestion","workbench.action.terminal.selectNextSuggestion","workbench.action.terminal.selectNextPageSuggestion","workbench.action.terminal.acceptSelectedSuggestion","workbench.action.terminal.acceptSelectedSuggestionEnter","workbench.action.terminal.hideSuggestWidget","workbench.action.terminal.triggerSuggest","workbench.action.terminal.suggestToggleDetails","workbench.action.terminal.suggestToggleDetailsFocus"];var DYo=["exe","bat","cmd","com","msi","ps1","vbs","js","jar","py","rb","pl","sh"],aG="terminal.integrated.suggest";function ayi(a){return typeof a=="boolean"?a?{commands:"on",arguments:"on",unknown:"off"}:{commands:"off",arguments:"off",unknown:"off"}:a}var $co={"terminal.integrated.suggest.enabled":{restricted:!0,markdownDescription:d(16917,null,"Windows PowerShell, PowerShell v7+, zsh, bash, fish","`#terminal.integrated.shellIntegration.enabled#`"),type:"boolean",default:!0},"terminal.integrated.suggest.providers":{restricted:!0,markdownDescription:d(16925,null),type:"object",properties:{}},"terminal.integrated.suggest.quickSuggestions":{restricted:!0,markdownDescription:d(16927,null,"`#terminal.integrated.suggest.suggestOnTriggerCharacters#`"),type:"object",properties:{commands:{description:d(16929,null),type:"string",enum:["on","off"]},arguments:{description:d(16928,null),type:"string",enum:["on","off"]},unknown:{description:d(16930,null),type:"string",enum:["on","off"]}},additionalProperties:!1,default:{commands:"off",arguments:"off",unknown:"off"}},"terminal.integrated.suggest.suggestOnTriggerCharacters":{restricted:!0,markdownDescription:d(16933,null),type:"boolean",default:!1},"terminal.integrated.suggest.runOnEnter":{restricted:!0,markdownDescription:d(16931,null),enum:["never","exactMatch","exactMatchIgnoreExtension","always"],markdownEnumDescriptions:[d(16912,null),d(16910,null),d(16911,null),d(16909,null)],default:"never"},"terminal.integrated.suggest.selectionMode":{markdownDescription:d(16935,null),type:"string",enum:["partial","always","never"],markdownEnumDescriptions:[d(16938,null),d(16936,null),d(16937,null)],default:"partial"},"terminal.integrated.suggest.windowsExecutableExtensions":{restricted:!0,markdownDescription:d(16940,null,DYo.sort().map(a=>`- ${a}`).join(`
`)),type:"object",default:{}},"terminal.integrated.suggest.showStatusBar":{restricted:!0,markdownDescription:d(16932,null),type:"boolean",default:!0},"terminal.integrated.suggest.cdPath":{restricted:!0,markdownDescription:d(16913,null),type:"string",enum:["off","relative","absolute"],markdownEnumDescriptions:[d(16915,null),d(16916,null),d(16914,null)],default:"absolute"},"terminal.integrated.suggest.inlineSuggestion":{restricted:!0,markdownDescription:d(16918,null),type:"string",enum:["off","alwaysOnTopExceptExactMatch","alwaysOnTop"],markdownEnumDescriptions:[d(16921,null),d(16920,null),d(16919,null)],default:"alwaysOnTop"},"terminal.integrated.suggest.upArrowNavigatesHistory":{restricted:!0,markdownDescription:d(16934,null),type:"boolean",default:!0},"terminal.integrated.suggest.insertTrailingSpace":{restricted:!0,markdownDescription:d(16922,null),type:"boolean",default:!1}},syi;function lyi(a){let i=syi;a??=new Map,a.has("lsp")||a.set("lsp",{id:"lsp",description:d(16923,null)});let e={};for(let n of Array.from(a.keys()).sort())e[n]={type:"boolean",default:n!=="lsp",description:a.get(n)?.description??d(16924,null,n)};let t={};for(let n in e)t[n]=e[n].default;syi={id:"terminalSuggestProviders",order:100,title:d(16939,null),type:"object",properties:{"terminal.integrated.suggest.providers":{restricted:!0,markdownDescription:d(16926,null),type:"object",properties:e,default:t,tags:["preview"],additionalProperties:!1}}},oe.as($t.Configuration).updateConfigurations({add:[syi],remove:i?[i]:[]})}lyi();var cyi=["vim","vi","nano","tmux"];var jco={"terminal.integrated.localEchoLatencyThreshold":{description:d(16946,null),type:"integer",minimum:-1,default:30,tags:["preview"]},"terminal.integrated.localEchoEnabled":{markdownDescription:d(16941,null,"`#terminal.integrated.localEchoLatencyThreshold#`"),type:"string",enum:["on","off","auto"],enumDescriptions:[d(16944,null),d(16943,null),d(16942,null)],default:"off",tags:["preview"]},"terminal.integrated.localEchoExcludePrograms":{description:d(16945,null),type:"array",items:{type:"string",uniqueItems:!0},default:cyi,tags:["preview"]},"terminal.integrated.localEchoStyle":{description:d(16947,null),default:"dim",anyOf:[{enum:["bold","dim","italic","underlined","inverted","#ff0000"]},{type:"string",format:"color-hex"}],tags:["preview"]}};var Qco={"terminal.integrated.mouseWheelZoom":{markdownDescription:et?d(16963,null):d(16962,null),type:"boolean",default:!1}};var aw=(c=>(c[c.A11yFocusAccessibleBuffer="workbench.action.terminal.focusAccessibleBuffer"]="A11yFocusAccessibleBuffer",c[c.DeveloperRestartPtyHost="workbench.action.terminal.restartPtyHost"]="DeveloperRestartPtyHost",c[c.OpenTerminalSettingsLink="workbench.action.terminal.chat.openTerminalSettingsLink"]="OpenTerminalSettingsLink",c[c.DisableSessionAutoApproval="workbench.action.terminal.chat.disableSessionAutoApproval"]="DisableSessionAutoApproval",c[c.FocusMostRecentChatTerminalOutput="workbench.action.terminal.chat.focusMostRecentChatTerminalOutput"]="FocusMostRecentChatTerminalOutput",c[c.FocusMostRecentChatTerminal="workbench.action.terminal.chat.focusMostRecentChatTerminal"]="FocusMostRecentChatTerminal",c[c.ToggleChatTerminalOutput="workbench.action.terminal.chat.toggleChatTerminalOutput"]="ToggleChatTerminalOutput",c[c.FocusChatInstanceAction="workbench.action.terminal.chat.focusChatInstance"]="FocusChatInstanceAction",c[c.ContinueInBackground="workbench.action.terminal.chat.continueInBackground"]="ContinueInBackground",c))(aw||{}),Yp=(v=>(v[v.StickyScrollEnabled="terminal.integrated.stickyScroll.enabled"]="StickyScrollEnabled",v[v.SuggestEnabled="terminal.integrated.suggest.enabled"]="SuggestEnabled",v[v.AutoApprove="chat.tools.terminal.autoApprove"]="AutoApprove",v[v.EnableAutoApprove="chat.tools.terminal.enableAutoApprove"]="EnableAutoApprove",v[v.ShellIntegrationTimeout="chat.tools.terminal.shellIntegrationTimeout"]="ShellIntegrationTimeout",v[v.OutputLocation="chat.tools.terminal.outputLocation"]="OutputLocation",v[v.AgentSandboxEnabled="chat.agent.sandbox.enabled"]="AgentSandboxEnabled",v[v.AgentSandboxAllowUnsandboxedCommands="chat.agent.sandbox.allowUnsandboxedCommands"]="AgentSandboxAllowUnsandboxedCommands",v[v.AgentSandboxAutoApproveUnsandboxedCommands="chat.agent.sandbox.autoApproveUnsandboxedCommands"]="AgentSandboxAutoApproveUnsandboxedCommands",v[v.AgentSandboxAllowAutoApprove="chat.agent.sandbox.allowAutoApprove"]="AgentSandboxAllowAutoApprove",v[v.DeprecatedAgentSandboxEnabled="chat.agent.sandbox"]="DeprecatedAgentSandboxEnabled",v[v.DeprecatedAgentSandboxLinuxFileSystem="chat.agent.sandboxFileSystem.linux"]="DeprecatedAgentSandboxLinuxFileSystem",v[v.DeprecatedAgentSandboxMacFileSystem="chat.agent.sandboxFileSystem.mac"]="DeprecatedAgentSandboxMacFileSystem",v[v.AgentSandboxLinuxFileSystem="chat.agent.sandbox.fileSystem.linux"]="AgentSandboxLinuxFileSystem",v[v.AgentSandboxMacFileSystem="chat.agent.sandbox.fileSystem.mac"]="AgentSandboxMacFileSystem",v))(Yp||{}),mme=(e=>(e[e.ChatHasTerminals="hasChatTerminals"]="ChatHasTerminals",e[e.ChatHasHiddenTerminals="hasHiddenChatTerminals"]="ChatHasHiddenTerminals",e))(mme||{}),Xco={...Rco,...Lco,...aRe,...Pco,...Bco,...zco,...Kco,...Gco,...$co,...jco,...Qco},Jco=[...Dco,...Hco,...Uco,...qco];var Fc="terminal";var gb="terminal.integrated",NNt=0,Zco=-5,ONt=Sn?1.1:1,fJe=1,vJe=1e3,edo="normal",tdo="bold",uyi=["normal","bold","100","200","300","400","500","600","700","800","900"],ig=le("terminalProfileResolverService"),fb=le("terminalProfileService"),ido=a=>typeof a.write=="function";var bJe=["workbench.action.terminal.clearSelection","workbench.action.terminal.clear","workbench.action.terminal.copyAndClearSelection","workbench.action.terminal.copySelection","workbench.action.terminal.copySelectionAsHtml","workbench.action.terminal.copyLastCommand","workbench.action.terminal.copyLastCommandOutput","workbench.action.terminal.copyLastCommandAndLastCommandOutput","workbench.action.terminal.deleteToLineStart","workbench.action.terminal.deleteWordLeft","workbench.action.terminal.deleteWordRight","workbench.action.terminal.focusNextPane","workbench.action.terminal.focusNext","workbench.action.terminal.focusPreviousPane","workbench.action.terminal.focusPrevious","workbench.action.terminal.focus","workbench.action.terminal.sizeToContentWidth","workbench.action.terminal.kill","workbench.action.terminal.killEditor","workbench.action.terminal.moveToEditor","workbench.action.terminal.moveToLineEnd","workbench.action.terminal.moveToLineStart","workbench.action.terminal.moveToTerminalPanel","workbench.action.terminal.newInActiveWorkspace","workbench.action.terminal.new","workbench.action.terminal.newInNewWindow","workbench.action.terminal.paste","workbench.action.terminal.pastePwsh","workbench.action.terminal.pasteSelection","workbench.action.terminal.resizePaneDown","workbench.action.terminal.resizePaneLeft","workbench.action.terminal.resizePaneRight","workbench.action.terminal.resizePaneUp","workbench.action.terminal.runActiveFile","workbench.action.terminal.runSelectedText","workbench.action.terminal.scrollDown","workbench.action.terminal.scrollDownPage","workbench.action.terminal.scrollToBottom","workbench.action.terminal.scrollToNextCommand","workbench.action.terminal.scrollToPreviousCommand","workbench.action.terminal.scrollToTop","workbench.action.terminal.scrollUp","workbench.action.terminal.scrollUpPage","workbench.action.terminal.sendSequence","workbench.action.terminal.selectAll","workbench.action.terminal.selectToNextCommand","workbench.action.terminal.selectToNextLine","workbench.action.terminal.selectToPreviousCommand","workbench.action.terminal.selectToPreviousLine","workbench.action.terminal.splitInActiveWorkspace","workbench.action.terminal.split","workbench.action.terminal.toggleTerminal","workbench.action.terminal.focusHover","editor.action.accessibilityHelp","workbench.action.terminal.stopVoice","workbench.action.terminal.sendSignal","workbench.action.tasks.rerunForActiveTerminal","editor.action.toggleTabFocusMode","notifications.hideList","notifications.hideToasts","workbench.action.closeQuickOpen","workbench.action.quickOpen","workbench.action.quickOpenPreviousEditor","workbench.action.showCommands","workbench.action.tasks.build","workbench.action.tasks.restartTask","workbench.action.tasks.runTask","workbench.action.tasks.reRunTask","workbench.action.tasks.showLog","workbench.action.tasks.showTasks","workbench.action.tasks.terminate","workbench.action.tasks.test","workbench.action.toggleFullScreen","workbench.action.terminal.focusAtIndex1","workbench.action.terminal.focusAtIndex2","workbench.action.terminal.focusAtIndex3","workbench.action.terminal.focusAtIndex4","workbench.action.terminal.focusAtIndex5","workbench.action.terminal.focusAtIndex6","workbench.action.terminal.focusAtIndex7","workbench.action.terminal.focusAtIndex8","workbench.action.terminal.focusAtIndex9","workbench.action.focusSecondEditorGroup","workbench.action.focusThirdEditorGroup","workbench.action.focusFourthEditorGroup","workbench.action.focusFifthEditorGroup","workbench.action.focusSixthEditorGroup","workbench.action.focusSeventhEditorGroup","workbench.action.focusEighthEditorGroup","workbench.action.focusNextPart","workbench.action.focusPreviousPart","workbench.action.nextPanelView","workbench.action.previousPanelView","workbench.action.nextSideBarView","workbench.action.previousSideBarView","workbench.action.debug.disconnect","workbench.action.debug.start","workbench.action.debug.stop","workbench.action.debug.run","workbench.action.debug.restart","workbench.action.debug.continue","workbench.action.debug.pause","workbench.action.debug.stepInto","workbench.action.debug.stepOut","workbench.action.debug.stepOver","workbench.action.nextEditor","workbench.action.previousEditor","workbench.action.nextEditorInGroup","workbench.action.previousEditorInGroup","workbench.action.openNextRecentlyUsedEditor","workbench.action.openPreviousRecentlyUsedEditor","workbench.action.openNextRecentlyUsedEditorInGroup","workbench.action.openPreviousRecentlyUsedEditorInGroup","workbench.action.quickOpenPreviousRecentlyUsedEditor","workbench.action.quickOpenLeastRecentlyUsedEditor","workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup","workbench.action.quickOpenLeastRecentlyUsedEditorInGroup","workbench.action.focusActiveEditorGroup","workbench.action.focusFirstEditorGroup","workbench.action.focusLastEditorGroup","workbench.action.firstEditorInGroup","workbench.action.lastEditorInGroup","workbench.action.navigateUp","workbench.action.navigateDown","workbench.action.navigateRight","workbench.action.navigateLeft","workbench.action.togglePanel","workbench.action.quickOpenView","workbench.action.toggleMaximizedPanel","workbench.action.zoomIn","workbench.action.zoomOut","workbench.action.zoomReset","notification.acceptPrimaryAction","runCommands","workbench.action.terminal.chat.start","workbench.action.terminal.chat.close","workbench.action.terminal.chat.discard","workbench.action.terminal.chat.makeRequest","workbench.action.terminal.chat.cancel","workbench.action.terminal.chat.feedbackHelpful","workbench.action.terminal.chat.feedbackUnhelpful","workbench.action.terminal.chat.feedbackReportIssue","workbench.action.terminal.chat.runCommand","workbench.action.terminal.chat.insertCommand","workbench.action.terminal.chat.viewInChat",...Jco],odo={extensionPoint:"terminal",defaultExtensionKind:["workspace"],activationEventsGenerator:function*(a){for(let i of a)for(let e of i.profiles??[])yield`onTerminalProfile:${e.id}`},jsonSchema:{description:d(16132,null),type:"object",properties:{profiles:{type:"array",description:d(16135,null),items:{type:"object",required:["id","title"],defaultSnippets:[{body:{id:"$1",title:"$2"}}],properties:{id:{description:d(16136,null),type:"string"},title:{description:d(16137,null),type:"string"},icon:{description:d(16139,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(16141,null),type:"string"},dark:{description:d(16140,null),type:"string"}}}]},titleTemplate:{description:d(16138,null),type:"string"}}}},completionProviders:{type:"array",description:d(16133,null),items:{type:"object",required:["id"],defaultSnippets:[{body:{id:"$1",description:"$2"}}],properties:{description:{description:d(16134,null),type:"string"}}}}}}};var YS=[],fee=te("terminal.background",null,d(16143,null)),ndo=te("terminal.foreground",{light:"#333333",dark:"#CCCCCC",hcDark:"#FFFFFF",hcLight:"#292929"},d(16150,null)),rdo=te("terminalCursor.foreground",null,d(16160,null)),sdo=te("terminalCursor.background",null,d(16159,null)),cRe=te("terminal.selectionBackground",qv,d(16153,null)),ado=te("terminal.inactiveSelectionBackground",{light:ni(cRe,.5),dark:ni(cRe,.5),hcDark:ni(cRe,.7),hcLight:ni(cRe,.5)},d(16152,null)),ldo=te("terminal.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:"#ffffff"},d(16154,null)),cdo=te("terminalCommandDecoration.defaultBackground",{light:"#00000040",dark:"#ffffff40",hcDark:"#ffffff80",hcLight:"#00000040"},d(16156,null)),ddo=te("terminalCommandDecoration.successBackground",{dark:"#1B81A8",light:"#2090D3",hcDark:"#1B81A8",hcLight:"#007100"},d(16158,null)),udo=te("terminalCommandDecoration.errorBackground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F14C4C",hcLight:"#B5200D"},d(16157,null)),WNt=te("terminalOverviewRuler.cursorForeground","#A0A0A0CC",d(16163,null)),wil=te("terminal.border",ob,d(16144,null)),pdo=te("terminalOverviewRuler.border",dwt,d(16162,null)),mdo=te("terminal.findMatchBackground",{dark:Uce,light:Uce,hcDark:null,hcLight:"#0F4A85"},d(16146,null),!0),Cil=te("terminal.hoverHighlightBackground",ni(qIt,.5),d(16151,null)),hdo=te("terminal.findMatchBorder",{dark:null,light:null,hcDark:"#f38518",hcLight:"#0F4A85"},d(16147,null)),gdo=te("terminal.findMatchHighlightBackground",{dark:NS,light:NS,hcDark:null,hcLight:null},d(16148,null),!0),fdo=te("terminal.findMatchHighlightBorder",{dark:null,light:null,hcDark:"#f38518",hcLight:"#0F4A85"},d(16149,null)),vdo=te("terminalOverviewRuler.findMatchForeground",{dark:DF,light:DF,hcDark:"#f38518",hcLight:"#0F4A85"},d(16164,null)),xil=te("terminal.dropBackground",ZT,d(16145,null),!0),kil=te("terminal.tab.activeBorder",k_e,d(16155,null)),Eil=te("terminal.initialHintForeground",{dark:"#ffffff56",light:"#0007",hcDark:null,hcLight:null},d(16161,null)),FNt={"terminal.ansiBlack":{index:0,defaults:{light:"#000000",dark:"#000000",hcDark:"#000000",hcLight:"#292929"}},"terminal.ansiRed":{index:1,defaults:{light:"#cd3131",dark:"#cd3131",hcDark:"#cd0000",hcLight:"#cd3131"}},"terminal.ansiGreen":{index:2,defaults:{light:"#107C10",dark:"#0DBC79",hcDark:"#00cd00",hcLight:"#136C13"}},"terminal.ansiYellow":{index:3,defaults:{light:"#949800",dark:"#e5e510",hcDark:"#cdcd00",hcLight:"#949800"}},"terminal.ansiBlue":{index:4,defaults:{light:"#0451a5",dark:"#2472c8",hcDark:"#0000ee",hcLight:"#0451a5"}},"terminal.ansiMagenta":{index:5,defaults:{light:"#bc05bc",dark:"#bc3fbc",hcDark:"#cd00cd",hcLight:"#bc05bc"}},"terminal.ansiCyan":{index:6,defaults:{light:"#0598bc",dark:"#11a8cd",hcDark:"#00cdcd",hcLight:"#0598bc"}},"terminal.ansiWhite":{index:7,defaults:{light:"#555555",dark:"#e5e5e5",hcDark:"#e5e5e5",hcLight:"#555555"}},"terminal.ansiBrightBlack":{index:8,defaults:{light:"#666666",dark:"#666666",hcDark:"#7f7f7f",hcLight:"#666666"}},"terminal.ansiBrightRed":{index:9,defaults:{light:"#cd3131",dark:"#f14c4c",hcDark:"#ff0000",hcLight:"#cd3131"}},"terminal.ansiBrightGreen":{index:10,defaults:{light:"#14CE14",dark:"#23d18b",hcDark:"#00ff00",hcLight:"#00bc00"}},"terminal.ansiBrightYellow":{index:11,defaults:{light:"#b5ba00",dark:"#f5f543",hcDark:"#ffff00",hcLight:"#b5ba00"}},"terminal.ansiBrightBlue":{index:12,defaults:{light:"#0451a5",dark:"#3b8eea",hcDark:"#5c5cff",hcLight:"#0451a5"}},"terminal.ansiBrightMagenta":{index:13,defaults:{light:"#bc05bc",dark:"#d670d6",hcDark:"#ff00ff",hcLight:"#bc05bc"}},"terminal.ansiBrightCyan":{index:14,defaults:{light:"#0598bc",dark:"#29b8db",hcDark:"#00ffff",hcLight:"#0598bc"}},"terminal.ansiBrightWhite":{index:15,defaults:{light:"#a5a5a5",dark:"#e5e5e5",hcDark:"#ffffff",hcLight:"#a5a5a5"}}};function bdo(){for(let a in FNt){let i=FNt[a],e=a.substring(13);YS[i.index]=te(a,i.defaults,d(16142,null,e))}}function lw(a){let i;if(We(a)?i=a:a.color?i=a.color.replace(/\./g,"_"):q.isThemeIcon(a.icon)&&a.icon.color&&(i=a.icon.color.id.replace(/\./g,"_")),i)return`terminal-icon-${i.replace(/\./g,"_")}`}function VNt(a){let i=[];for(let e in FNt)a.getColor(e)&&!e.toLowerCase().includes("bright")&&i.push(e);return i}function dRe(a){let i=new O,e=VNt(a),t=Pr(void 0,void 0,i),o="";for(let n of e){let r=lw(n),s=a.getColor(n);s&&(o+=`.monaco-workbench .${r} .codicon:first-child:not(.codicon-split-horizontal):not(.codicon-trashcan):not(.file-icon){ color: ${s} !important; }`)}return t.textContent=o,i}function Sdo(a,i){let e=VNt(a),t="";for(let o of e){let n=lw(o),r=a.getColor(o);r&&(i?t+=`.monaco-workbench .show-file-icons .predefined-file-icon.terminal-tab.${n}::before,.monaco-workbench .show-file-icons .file-icon.terminal-tab.${n}::before{ color: ${r} !important; }`:t+=`.monaco-workbench .${n} .codicon:first-child:not(.codicon-split-horizontal):not(.codicon-trashcan):not(.file-icon){ color: ${r} !important; }`)}return t}function mR(a,i,e){let t=a.icon;if(!t)return;let o=[],n;if(e){if(We(t)&&(t.startsWith("$(")||Zw().getIcon(t)))return o;We(t)&&(n=A.parse(t))}if(A.isUri(t)?n=t:!q.isThemeIcon(t)&&!We(t)&&(n=cm(i)?t.dark:t.light),n instanceof A){let s=`terminal-uri-icon-${Lr(n.path).toString(36)}`;o.push(s),o.push("terminal-uri-icon")}return o}function vee(a,i){return We(i.icon)?i.icon:q.isThemeIcon(i.icon)?i.icon.id:a.get(ig).getDefaultIcon().id}var pt;(xe=>(xe.isOpen=new Y("terminalIsOpen",!1,!0),xe.focus=new Y("terminalFocus",!1,d(16334,null)),xe.focusInAny=new Y("terminalFocusInAny",!1,d(16335,null)),xe.editorFocus=new Y("terminalEditorFocus",!1,d(16333,null)),xe.count=new Y("terminalCount",0,d(16332,null)),xe.groupCount=new Y("terminalGroupCount",0,!0),xe.tabsNarrow=new Y("isTerminalTabsNarrow",!1,!0),xe.terminalHasFixedWidth=new Y("terminalHasFixedWidth",!1,!0),xe.tabsFocus=new Y("terminalTabsFocus",!1,d(16340,null)),xe.webExtensionContributedProfile=new Y("terminalWebExtensionContributedProfile",!1,!0),xe.terminalHasBeenCreated=new Y("terminalHasBeenCreated",!1,!0),xe.terminalEditorActive=new Y("terminalEditorActive",!1,!0),xe.tabsMouse=new Y("terminalTabsMouse",!1,!0),xe.shellType=new Y("terminalShellType",void 0,{type:"string",description:d(16338,null)}),xe.altBufferActive=new Y("terminalAltBufferActive",!1,d(16331,null)),xe.suggestWidgetVisible=new Y("terminalSuggestWidgetVisible",!1,d(16339,null)),xe.notFocus=xe.focus.toNegated(),xe.viewShowing=new Y("terminalViewShowing",!1,d(16344,null)),xe.textSelected=new Y("terminalTextSelected",!1,d(16342,null)),xe.textSelectedInFocused=new Y("terminalTextSelectedInFocused",!1,d(16343,null)),xe.notTextSelected=xe.textSelected.toNegated(),xe.findVisible=new Y("terminalFindVisible",!1,!0),xe.notFindVisible=xe.findVisible.toNegated(),xe.findInputFocus=new Y("terminalFindInputFocused",!1,!0),xe.findFocus=new Y("terminalFindFocused",!1,!0),xe.notFindFocus=xe.findInputFocus.toNegated(),xe.processSupported=new Y("terminalProcessSupported",!1,d(16336,null)),xe.tabsSingularSelection=new Y("terminalTabsSingularSelection",!1,d(16341,null)),xe.splitTerminalTabFocused=new Y("terminalSplitTerminal",!1,d(16329,null)),xe.splitTerminalActive=new Y("terminalSplitPaneActive",!1,d(16330,null)),xe.inTerminalRunCommandPicker=new Y("inTerminalRunCommandPicker",!1,d(16328,null)),xe.terminalShellIntegrationEnabled=new Y("terminalShellIntegrationEnabled",!1,d(16337,null)),xe.terminalDictationInProgress=new Y("terminalDictationInProgress",!1),xe.shouldShowViewInlineActions=C.and(C.equals("view",Fc),C.notEquals("config.terminal.integrated.tabs.hideCondition","never"),C.not(mme.ChatHasHiddenTerminals),C.or(C.not("config.terminal.integrated.tabs.enabled"),C.and(C.equals("config.terminal.integrated.tabs.showActions","singleTerminal"),C.equals("terminalGroupCount",1)),C.and(C.equals("config.terminal.integrated.tabs.showActions","singleTerminalOrNarrow"),C.or(C.equals("terminalGroupCount",1),C.has("isTerminalTabsNarrow"))),C.and(C.equals("config.terminal.integrated.tabs.showActions","singleGroup"),C.equals("terminalGroupCount",1)),C.equals("config.terminal.integrated.tabs.showActions","always")))))(pt||={});var Zf=class extends Ls{constructor(e,t,o,n,r,s,l,c,u){super();this.resource=e;this._terminalInstance=t;this._themeService=o;this._terminalInstanceService=n;this._instantiationService=r;this._configurationService=s;this._lifecycleService=l;this._contextKeyService=c;this._dialogService=u;this.closeHandler=this;this._isDetached=!1;this._isShuttingDown=!1;this._isReverted=!1;this._onDidRequestAttach=this._register(new T);this.onDidRequestAttach=this._onDidRequestAttach.event;this._terminalEditorFocusContextKey=pt.editorFocus.bindTo(c),t&&this._setupInstanceListeners()}static{this.ID="workbench.editors.terminal"}setGroup(e){this._group=e,e?.scopedContextKeyService&&this._terminalInstance?.setParentContextKeyService(e.scopedContextKeyService)}get group(){return this._group}get typeId(){return Zf.ID}get editorId(){return sG}get capabilities(){return 1218}setTerminalInstance(e){if(this._terminalInstance)throw new Error("cannot set instance that has already been set");this._terminalInstance=e,this._setupInstanceListeners()}copy(){let e=this._terminalInstanceService.createInstance(this._copyLaunchConfig||{},2);return e.focusWhenReady(),this._copyLaunchConfig=void 0,this._instantiationService.createInstance(Zf,e.resource,e)}setCopyLaunchConfig(e){this._copyLaunchConfig=e}get terminalInstance(){return this._isDetached?void 0:this._terminalInstance}showConfirm(){if(this._isReverted)return!1;let e=this._configurationService.getValue("terminal.integrated.confirmOnKill");return(e==="editor"||e==="always")&&this._terminalInstance?.hasChildProcesses||!1}async confirm(e){let{confirmed:t}=await this._dialogService.confirm({type:wt.Warning,message:d(15990,null),primaryButton:d(15988,null),detail:e.length>1?e.map(o=>o.editor.getName()).join(`
`)+`

`+d(15991,null):d(15989,null)});return t?1:2}async revert(){this._isReverted=!0}_setupInstanceListeners(){let e=this._terminalInstance;if(!e)return;let t=e.onDidFocus(()=>this._terminalEditorFocusContextKey.set(!0)),o=e.onDidBlur(()=>this._terminalEditorFocusContextKey.reset()),n=[e.onExit(r=>{e.waitOnExit||this.dispose()}),e.onDisposed(()=>this.dispose()),e.onTitleChanged(()=>this._onDidChangeLabel.fire()),e.onIconChanged(()=>this._onDidChangeLabel.fire()),t,o,e.statusList.onDidChangePrimaryStatus(()=>this._onDidChangeLabel.fire())];this._register(ee(()=>{!this._isDetached&&!this._isShuttingDown&&e.dispose(3),je(n),je([t,o])})),this._register(this._lifecycleService.onWillShutdown(r=>{this._isShuttingDown=!0,je(n),this._configurationService.getValue("terminal.integrated.enablePersistentSessions")&&r.reason===3?e.detachProcessAndDispose(1):e.dispose(1)}))}getName(){return this._terminalInstance?.title||this.resource.fragment}getIcon(){if(!(!this._terminalInstance||!q.isThemeIcon(this._terminalInstance.icon)))return this._terminalInstance.icon}getLabelExtraClasses(){if(!this._terminalInstance)return[];let e=["terminal-tab","predefined-file-icon"],t=lw(this._terminalInstance);t&&e.push(t);let o=mR(this._terminalInstance,this._themeService.getColorTheme().type);return o&&e.push(...o),e}detachInstance(){this._isShuttingDown||(this._terminalInstance?.detachFromElement(),this._terminalInstance?.setParentContextKeyService(this._contextKeyService),this._isDetached=!0)}getDescription(){return this._terminalInstance?.description}toUntyped(){return{resource:this.resource,options:{override:sG,pinned:!0,forceReload:!0}}}canReopen(){return!1}};Zf=I([m(2,Pe),m(3,uh),m(4,F),m(5,B),m(6,to),m(7,X),m(8,ct)],Zf);var BNt=class{constructor(i,e,t,o,n){this._editorGroupsService=e;this._configurationService=t;this._logService=o;this._dispoables=new O;this._tabGroupModel=[];this._groupLookup=new Map;this._tabInfoLookup=new Map;this._multiDiffEditorInputListeners=new Ot;this._proxy=i.getProxy(ao.ExtHostEditorTabs),this._dispoables.add(n.onDidEditorsChange(r=>{try{this._updateTabsModel(r)}catch{this._logService.error("Failed to update model, rebuilding"),this._createTabsModel()}})),this._dispoables.add(this._multiDiffEditorInputListeners),this._dispoables.add(this._editorGroupsService.onDidAddGroup(()=>this._createTabsModel())),this._dispoables.add(this._editorGroupsService.onDidRemoveGroup(()=>this._createTabsModel())),this._editorGroupsService.whenReady.then(()=>this._createTabsModel())}dispose(){this._groupLookup.clear(),this._tabInfoLookup.clear(),this._dispoables.dispose()}_buildTabObject(i,e,t){let o=e.editorId;return{id:this._generateTabId(e,i.id),label:e.getName(),editorId:o,input:this._editorInputToDto(e),isPinned:i.isSticky(t),isPreview:!i.isPinned(t),isActive:i.isActive(e),isDirty:e.isDirty()}}_editorInputToDto(i){if(i instanceof Zb)return{kind:3,base:i.base,input1:i.input1.uri,input2:i.input2.uri,result:i.resource};if(i instanceof IE)return{kind:1,uri:i.resource};if(i instanceof ja&&!(i instanceof Ba)){let e=i.primary.resource,t=i.secondary.resource;return i.primary instanceof IE&&i.secondary instanceof IE&&ze(e,t)&&e&&t?{kind:1,uri:e}:{kind:0}}if(i instanceof Ga)return{kind:4,notebookType:i.viewType,uri:i.resource};if(i instanceof pp)return{kind:6,viewType:i.viewType,uri:i.resource};if(i instanceof up)return{kind:7,viewType:i.viewType};if(i instanceof Zf)return{kind:8};if(i instanceof Ba){if(i.modified instanceof IE&&i.original instanceof IE)return{kind:2,modified:i.modified.resource,original:i.original.resource};if(i.modified instanceof Ga&&i.original instanceof Ga)return{kind:5,notebookType:i.original.viewType,modified:i.modified.resource,original:i.original.resource}}if(i instanceof Jf)return{kind:9,uri:i.resource,inputBoxUri:i.inputResource};if(i instanceof tl)return{kind:10};if(i instanceof Ou){let e=[];for(let t of i?.resources.get()??[])t.originalUri&&t.modifiedUri&&e.push({kind:2,original:t.originalUri,modified:t.modifiedUri});return{kind:11,diffEditors:e}}return{kind:0}}_generateTabId(i,e){let t,o=po.getCanonicalUri(i,{supportSideBySide:3});return o instanceof A?t=o.toString():t=`${o?.primary?.toString()}-${o?.secondary?.toString()}`,`${e}~${i.editorId}-${i.typeId}-${t} `}_onDidGroupActivate(){let i=this._editorGroupsService.activeGroup.id,e=this._groupLookup.get(i);e&&(e.isActive=!0,this._proxy.$acceptTabGroupUpdate(e))}_onDidTabLabelChange(i,e,t){let o=this._generateTabId(e,i),n=this._tabInfoLookup.get(o);n?(n.tab.label=e.getName(),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:n.tab,kind:2})):(this._logService.error("Invalid model for label change, rebuilding"),this._createTabsModel())}_onDidTabOpen(i,e,t){let o=this._editorGroupsService.getGroup(i),n=this._groupLookup.get(i)!==void 0;if(!o||!n){this._createTabsModel();return}let r=this._groupLookup.get(i)?.tabs;if(!r)return;let s=this._buildTabObject(o,e,t);r.splice(t,0,s);let l=this._generateTabId(e,i);this._tabInfoLookup.set(l,{group:o,editorInput:e,tab:s}),e instanceof Ou&&this._multiDiffEditorInputListeners.set(e,U.fromObservableLight(e.resources)(()=>{let c=this._tabInfoLookup.get(l);c&&(c.tab=this._buildTabObject(o,e,t),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:c.tab,kind:2}))})),this._proxy.$acceptTabOperation({groupId:i,index:t,tabDto:s,kind:0})}_onDidTabClose(i,e){let t=this._editorGroupsService.getGroup(i),o=this._groupLookup.get(i)?.tabs;if(!t||!o){this._createTabsModel();return}let n=o.splice(e,1);n.length!==0&&(this._tabInfoLookup.delete(n[0]?.id??""),n[0]?.input instanceof Ou&&this._multiDiffEditorInputListeners.deleteAndDispose(n[0]?.input),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:n[0],kind:1}))}_onDidTabActiveChange(i,e){let t=this._groupLookup.get(i)?.tabs;if(!t)return;let o=t[e];o.isActive=!0,this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:o,kind:2})}_onDidTabDirty(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o);if(!n){this._logService.error("Invalid model for dirty change, rebuilding"),this._createTabsModel();return}n.tab.isDirty=t.isDirty(),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:n.tab,kind:2})}_onDidTabPinChange(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o),r=n?.group,s=n?.tab;if(!r||!s){this._logService.error("Invalid model for sticky change, rebuilding"),this._createTabsModel();return}s.isPinned=r.isSticky(e),this._proxy.$acceptTabOperation({groupId:i,index:e,tabDto:s,kind:2})}_onDidTabPreviewChange(i,e,t){let o=this._generateTabId(t,i),n=this._tabInfoLookup.get(o),r=n?.group,s=n?.tab;if(!r||!s){this._logService.error("Invalid model for sticky change, rebuilding"),this._createTabsModel();return}s.isPreview=!r.isPinned(e),this._proxy.$acceptTabOperation({kind:2,groupId:i,tabDto:s,index:e})}_onDidTabMove(i,e,t,o){let n=this._groupLookup.get(i)?.tabs;if(!n){this._logService.error("Invalid model for move change, rebuilding"),this._createTabsModel();return}let r=n.splice(t,1);r.length!==0&&(n.splice(e,0,r[0]),this._proxy.$acceptTabOperation({kind:3,groupId:i,tabDto:r[0],index:e,oldIndex:t}))}_createTabsModel(){if(this._editorGroupsService.groups.length===0)return;this._tabGroupModel=[],this._groupLookup.clear(),this._tabInfoLookup.clear();let i=[];for(let e of this._editorGroupsService.groups){let t={groupId:e.id,isActive:e.id===this._editorGroupsService.activeGroup.id,viewColumn:Fx(this._editorGroupsService,e),tabs:[]};e.editors.forEach((o,n)=>{let r=this._buildTabObject(e,o,n);i.push(r),this._tabInfoLookup.set(this._generateTabId(o,e.id),{group:e,tab:r,editorInput:o})}),t.tabs=i,this._tabGroupModel.push(t),this._groupLookup.set(e.id,t),i=[]}this._proxy.$acceptEditorTabModel(this._tabGroupModel)}_updateTabsModel(i){let e=i.event,t=i.groupId;switch(e.kind){case 0:if(t===this._editorGroupsService.activeGroup.id){this._onDidGroupActivate();break}else return;case 9:if(e.editor!==void 0&&e.editorIndex!==void 0){this._onDidTabLabelChange(t,e.editor,e.editorIndex);break}case 5:if(e.editor!==void 0&&e.editorIndex!==void 0){this._onDidTabOpen(t,e.editor,e.editorIndex);break}case 6:if(e.editorIndex!==void 0){this._onDidTabClose(t,e.editorIndex);break}case 8:if(e.editorIndex!==void 0){this._onDidTabActiveChange(t,e.editorIndex);break}case 14:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabDirty(t,e.editorIndex,e.editor);break}case 13:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabPinChange(t,e.editorIndex,e.editor);break}case 11:if(e.editorIndex!==void 0&&e.editor!==void 0){this._onDidTabPreviewChange(t,e.editorIndex,e.editor);break}case 12:break;case 7:if(aco(e)&&e.editor&&e.editorIndex!==void 0&&e.oldEditorIndex!==void 0){this._onDidTabMove(t,e.editorIndex,e.oldEditorIndex,e.editor);break}default:this._createTabsModel()}}$moveTab(i,e,t,o){let n=SE(this._editorGroupsService,this._configurationService,t),r=this._tabInfoLookup.get(i);if(!r?.tab)throw new Error(`Attempted to close tab with id ${i} which does not exist`);let l,c=this._editorGroupsService.getGroup(r.group.id);if(!c)return;if(this._groupLookup.get(n)===void 0){let p=3;t===En&&(p=Zy(this._configurationService)),l=this._editorGroupsService.addGroup(this._editorGroupsService.groups[this._editorGroupsService.groups.length-1],p)}else l=this._editorGroupsService.getGroup(n);if(!l)return;(e<0||e>l.editors.length)&&(e=l.editors.length);let u=r?.editorInput;u&&c.moveEditor(u,l,{index:e,preserveFocus:o})}async $closeTab(i,e){let t=new Map;for(let n of i){let r=this._tabInfoLookup.get(n),s=r?.tab,l=r?.group,c=r?.editorInput;if(!l||!s||!r||!c)continue;let u=t.get(l);u?u.push(c):t.set(l,[c])}let o=[];for(let[n,r]of t)o.push(await n.closeEditors(r,{preserveFocus:e}));return o.every(n=>n)}async $closeGroup(i,e){let t=[];for(let o of i){let n=this._editorGroupsService.getGroup(o);n&&(t.push(await n.closeAllEditors()),n.count===0&&this._editorGroupsService.getGroup(n.id)&&this._editorGroupsService.removeGroup(n))}return t.every(o=>o)}};BNt=I([fo(Xi.MainThreadEditorTabs),m(1,kt),m(2,B),m(3,re),m(4,ie)],BNt);var HNt=class{dispose(){}$onUnexpectedError(i){i?.$isError&&(i=eY(i)),mt(i)}};HNt=I([fo(Xi.MainThreadErrors)],HNt);var Rh="workbench.view.extensions",Q3=P(11891,"Extensions");var Ui=le("extensionsWorkbenchService");var JI="extensions.autoUpdate",yJe="extensions.autoCheckUpdates",Ido="extensions.closeExtensionDetailsOnViewChange",UH="extensions.autoRestart",bee=class extends k{constructor(e,t){super();this.containers=e;this._register(t.onChange(this.update,this))}set extension(e){this.containers.forEach(t=>t.extension=e)}update(e){for(let t of this.containers)e&&t.extension?Ht(t.extension.identifier,e.identifier)&&(t.extension.server&&e.server&&t.extension.server!==e.server?t.updateWhenCounterExtensionChanges&&t.update():t.extension=e):t.update()}};bee=I([m(1,Ui)],bee);var uRe="workbench.views.extensions.workspaceRecommendations",UNt="workbench.views.extensions.searchOutdated",zNt="workbench.extensions.action.toggleIgnoreExtension",KNt="workbench.extensions.action.installVSIX",wJe="workbench.extensions.command.installFromVSIX",zH="workbench.extensions.action.listWorkspaceUnsupportedExtensions",zx=new Y("defaultExtensionViews",!0),GNt=new Y("hasOutdatedExtensions",!1),og=new Y("hasGallery",!1),See=new Y("extensionsGalleryStatus","unavailable"),ydo=new Y("extensionResultListFocused ",!0),CJe=new Y("searchMcpServers",!1),qNt=new Y("searchAgentPlugins",!1),pRe="_theme_",Iee="0_install",xJe="0_update",kJe=new R("extensionsSearchActionsMenu"),Qg=new R("extensionsFilterSubMenu");function SN(a){if(a===null)return"None";switch(a){case 1:return"LocalProcess";case 2:return"LocalWebWorker";case 3:return"Remote"}}function Cdo(a){switch(a){case 0:return"None";case 1:return"Local";case 2:return"Remote"}}function xdo(a,i,e,t){let o=wdo(a,e),n=wdo(i,e),r=new Map,s=c=>{if(r.has(c.key))return;let u=o.get(c.key)||null,p=n.get(c.key)||null,h=new myi(u,p);r.set(h.key,h)};o.forEach(c=>s(c)),n.forEach(c=>s(c));let l=new Map;return r.forEach(c=>{let u=!!c.local,p=!!c.remote,h=!!(c.local&&c.local.isUnderDevelopment),g=!!(c.remote&&c.remote.isUnderDevelopment),f=0;h&&!g?f=1:g&&!h&&(f=2),l.set(c.key,t(c.identifier,c.kind,u,p,f))}),l}function wdo(a,i){let e=new Map;return a.forEach(t=>{let o=new pyi(t,i(t));e.set(o.key,o)}),e}var pyi=class{constructor(i,e){this.desc=i;this.kind=e}get key(){return hi.toKey(this.desc.identifier)}get isUnderDevelopment(){return this.desc.isUnderDevelopment}},myi=class{constructor(i,e){this.local=i;this.remote=e}get key(){return this.local?this.local.key:this.remote.key}get identifier(){return this.local?this.local.desc.identifier:this.remote.desc.identifier}get kind(){return this.local?this.local.kind:this.remote.kind}};var kdo={Uninitialized:{type:"uninitialized"},Disabled:a=>({type:"disabled",reason:a}),Idle:(a,i,e)=>({type:"idle",updateType:a,error:i,notAvailable:e}),CheckingForUpdates:a=>({type:"checking for updates",explicit:a}),AvailableForDownload:(a,i)=>({type:"available for download",update:a,canInstall:i}),Downloading:(a,i,e,t,o,n)=>({type:"downloading",update:a,explicit:i,overwrite:e,downloadedBytes:t,totalBytes:o,startTime:n}),Downloaded:(a,i,e)=>({type:"downloaded",update:a,explicit:i,overwrite:e}),Updating:(a,i,e,t)=>({type:"updating",update:a,explicit:i,currentProgress:e,maxProgress:t}),Ready:(a,i,e)=>({type:"ready",update:a,explicit:i,overwrite:e}),Overwriting:(a,i)=>({type:"overwriting",update:a,explicit:i}),Restarting:a=>({type:"restarting",update:a})},Lp=le("updateService");var $Nt=class a{static{this._workerIdPool=0}createWorkerClient(i){let e,t=++a._workerIdPool;return i instanceof Worker||PYo(i)?e=Promise.resolve(i):e=this._createWorker(i),new SIt(new hyi(e,t))}_createWorker(i){let e=this.getWorkerUrl(i),t=LYo(i.label,e,this._getWorkerLoadingFailedErrorMessage(i)),o=new Worker(jNt?jNt.createScriptURL(t):t,{name:i.label,type:"module"});return MYo(o)}_getWorkerLoadingFailedErrorMessage(i){}getWorkerUrl(i){if(!i.esmModuleLocation)throw new Error("Missing esmModuleLocation in WebWorkerDescriptor");return(typeof i.esmModuleLocation=="function"?i.esmModuleLocation():i.esmModuleLocation).toString(!0)}},jNt=(()=>{let a=globalThis;return typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&a.workerttPolicy!==void 0?a.workerttPolicy:zf("defaultWorkerFactory",{createScriptURL:i=>i})})();function Edo(a,i){if(!a.startsWith("blob:"))throw new URIError("Not a blob-url: "+a);return new Worker(jNt?jNt.createScriptURL(a):a,{...i,type:"module"})}function LYo(a,i,e){if(!(/^((http:)|(https:)|(file:))/.test(i)&&i.substring(0,globalThis.origin.length)!==globalThis.origin)){let o=i.lastIndexOf("?"),n=i.lastIndexOf("#",o),r=o>0?new URLSearchParams(i.substring(o+1,~n?n:void 0)):new URLSearchParams;Fle.addSearchParam(r,!0,!0),r.toString()?i=`${i}?${r.toString()}#${a}`:i=`${i}#${a}`}let t=new Blob([ui([`/*${a}*/`,`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(G5e())};`,`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(ble())};`,`globalThis._VSCODE_FILE_ROOT = ${JSON.stringify(globalThis._VSCODE_FILE_ROOT)};`,"const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });","globalThis.workerttPolicy = ttPolicy;",e?"try {":"",`await import(ttPolicy?.createScriptURL(${JSON.stringify(i)}) ?? ${JSON.stringify(i)});`,e?`} catch (err) { console.error(${JSON.stringify(e)}, err); throw err; }`:"","globalThis.postMessage({ type: 'vscode-worker-ready' });",`/*${a}*/`]).join("")],{type:"application/javascript"});return URL.createObjectURL(t)}function MYo(a){return new Promise((i,e)=>{a.onmessage=function(t){t.data.type==="vscode-worker-ready"&&(a.onmessage=null,i(a))},a.onerror=e})}function PYo(a){return!!a&&typeof a.then=="function"}var hyi=class extends k{constructor(e,t){super();this._onMessage=this._register(new T);this.onMessage=this._onMessage.event;this._onError=this._register(new T);this.onError=this._onError.event;this.id=t,this.worker=e,this.postMessage("-please-ignore-",[]);let o=n=>{this._onError.fire(n)};this.worker.then(n=>{n.onmessage=r=>{this._onMessage.fire(r.data)},n.onmessageerror=r=>{this._onError.fire(r)},typeof n.addEventListener=="function"&&n.addEventListener("error",o)}),this._register(ee(()=>{this.worker?.then(n=>{n.onmessage=null,n.onmessageerror=null,n.removeEventListener("error",o),n.terminate()}),this.worker=null}))}getId(){return this.id}postMessage(e,t){this.worker?.then(o=>{try{o.postMessage(e,t)}catch(n){mt(n),mt(new Error("FAILED to post message to worker",{cause:n}))}})}};var Kx=le("timerService"),gyi=class{constructor(){this._entries=[]}setMarks(i,e){this._entries.push([i,e])}getDuration(i,e){let t=this._findEntry(i);if(!t)return 0;let o=this._findEntry(e);return o?o.startTime-t.startTime:0}getStartTime(i){let e=this._findEntry(i);return e?e.startTime:-1}_findEntry(i){for(let[,e]of this._entries)for(let t=e.length-1;t>=0;t--)if(e[t].name===i)return e[t]}getEntries(){return this._entries.slice(0)}},mRe=class{constructor(i,e,t,o,n,r,s,l,c){this._lifecycleService=i;this._contextService=e;this._extensionService=t;this._updateService=o;this._paneCompositeService=n;this._editorService=r;this._accessibilityService=s;this._telemetryService=l;this._barrier=new ip;this._marks=new gyi;this._rndValueShouldSendTelemetry=Math.random()<.03;Promise.all([this._extensionService.whenInstalledExtensionsRegistered(),i.when(3),c.whenRestored,Promise.all(Array.from(oe.as(HH.Backend).backends.values()).map(u=>u.whenReady))]).then(()=>(this.setPerformanceMarks("renderer",reo()),this._computeStartupMetrics())).then(u=>{this._startupMetrics=u,this._reportStartupTimes(u),this._barrier.open()}),this.perfBaseline=this._barrier.wait().then(()=>this._lifecycleService.when(4)).then(()=>Li(this._startupMetrics.timers.ellapsedRequire)).then(()=>{let u=(function(){let f=!1;function v(y){return f?0:(performance.now()-b>=1e3&&(f=!0),y<=2?y:v(y-1)+v(y-2))}let b=performance.now();v(24);let S=Math.round(performance.now()-b);self.postMessage({value:f?-1:S})}).toString(),p=new Blob([`(${u})();`],{type:"application/javascript"}),h=URL.createObjectURL(p),g=Edo(h,{name:"perfBaseline"});return new Promise(f=>{g.onmessage=v=>f(v.data.value)}).finally(()=>{g.terminate(),URL.revokeObjectURL(h)})})}whenReady(){return this._barrier.wait()}get startupMetrics(){if(!this._startupMetrics)throw new Error("illegal state, MUST NOT access startupMetrics before whenReady has resolved");return this._startupMetrics}setPerformanceMarks(i,e){let t=e.filter(o=>o.name.startsWith("code/"));this._marks.setMarks(i,t),this._reportPerformanceMarks(i,t)}getPerformanceMarks(){return this._marks.getEntries()}getDuration(i,e){return this._marks.getDuration(i,e)}getStartTime(i){return this._marks.getStartTime(i)}_reportStartupTimes(i){this._telemetryService.publicLog("startupTimeVaried",i)}_shouldReportPerfMarks(){return this._rndValueShouldSendTelemetry}_reportPerformanceMarks(i,e){if(this._shouldReportPerfMarks())for(let t of e)this._telemetryService.publicLog2("startup.timer.mark",{source:i,name:new lh(t.name),startTime:t.startTime})}async _computeStartupMetrics(){let i=this._isInitialStartup(),e;Ft?e="code/timeOrigin":e=i?"code/didStartMain":"code/willOpenNewWindow";let t=this._paneCompositeService.getActivePaneComposite(0),o=this._paneCompositeService.getActivePaneComposite(2),n=this._paneCompositeService.getActivePaneComposite(1),r={ellapsed:this._marks.getDuration(e,"code/didStartWorkbench"),isLatestVersion:!!await this._updateService.isLatestVersion(),didUseCachedData:this._didUseCachedData(),windowKind:this._lifecycleService.startupKind,windowCount:await this._getWindowCount(),viewletId:t?.getId(),auxiliaryViewletId:o?.getId(),editorIds:this._editorService.visibleEditors.map(s=>s.typeId),panelId:n?n.getId():void 0,timers:{ellapsedAppReady:i?this._marks.getDuration("code/didStartMain","code/mainAppReady"):void 0,ellapsedNlsGeneration:i?this._marks.getDuration("code/willGenerateNls","code/didGenerateNls"):void 0,ellapsedLoadMainBundle:i?this._marks.getDuration("code/willLoadMainBundle","code/didLoadMainBundle"):void 0,ellapsedRunMainBundle:i?this._marks.getDuration("code/didStartMain","code/didRunMainBundle"):void 0,ellapsedCrashReporter:i?this._marks.getDuration("code/willStartCrashReporter","code/didStartCrashReporter"):void 0,ellapsedMainServer:i?this._marks.getDuration("code/willStartMainServer","code/didStartMainServer"):void 0,ellapsedWindowCreate:i?this._marks.getDuration("code/willCreateCodeWindow","code/didCreateCodeWindow"):void 0,ellapsedWindowRestoreState:i?this._marks.getDuration("code/willRestoreCodeWindowState","code/didRestoreCodeWindowState"):void 0,ellapsedBrowserWindowCreate:i?this._marks.getDuration("code/willCreateCodeBrowserWindow","code/didCreateCodeBrowserWindow"):void 0,ellapsedWindowMaximize:i?this._marks.getDuration("code/willMaximizeCodeWindow","code/didMaximizeCodeWindow"):void 0,ellapsedWindowLoad:i?this._marks.getDuration("code/mainAppReady","code/willOpenNewWindow"):void 0,ellapsedWindowLoadToRequire:this._marks.getDuration("code/willOpenNewWindow","code/willLoadWorkbenchMain"),ellapsedRequire:this._marks.getDuration("code/willLoadWorkbenchMain","code/didLoadWorkbenchMain"),ellapsedWaitForWindowConfig:this._marks.getDuration("code/willWaitForWindowConfig","code/didWaitForWindowConfig"),ellapsedStorageInit:this._marks.getDuration("code/willInitStorage","code/didInitStorage"),ellapsedSharedProcesConnected:this._marks.getDuration("code/willConnectSharedProcess","code/didConnectSharedProcess"),ellapsedWorkspaceServiceInit:this._marks.getDuration("code/willInitWorkspaceService","code/didInitWorkspaceService"),ellapsedRequiredUserDataInit:this._marks.getDuration("code/willInitRequiredUserData","code/didInitRequiredUserData"),ellapsedOtherUserDataInit:this._marks.getDuration("code/willInitOtherUserData","code/didInitOtherUserData"),ellapsedExtensions:this._marks.getDuration("code/willLoadExtensions","code/didLoadExtensions"),ellapsedEditorRestore:this._marks.getDuration("code/willRestoreEditors","code/didRestoreEditors"),ellapsedViewletRestore:this._marks.getDuration("code/willRestoreViewlet","code/didRestoreViewlet"),ellapsedAuxiliaryViewletRestore:this._marks.getDuration("code/willRestoreAuxiliaryBar","code/didRestoreAuxiliaryBar"),ellapsedPanelRestore:this._marks.getDuration("code/willRestorePanel","code/didRestorePanel"),ellapsedWorkbenchContributions:this._marks.getDuration("code/willCreateWorkbenchContributions/1","code/didCreateWorkbenchContributions/2"),ellapsedWorkbench:this._marks.getDuration("code/willStartWorkbench","code/didStartWorkbench"),ellapsedExtensionsReady:this._marks.getDuration(e,"code/didLoadExtensions"),ellapsedRenderer:this._marks.getDuration("code/didStartRenderer","code/didStartWorkbench")},platform:void 0,release:void 0,arch:void 0,totalmem:void 0,freemem:void 0,meminfo:void 0,cpus:void 0,loadavg:void 0,isVMLikelyhood:void 0,initialStartup:i,hasAccessibilitySupport:this._accessibilityService.isScreenReaderOptimized(),emptyWorkbench:this._contextService.getWorkbenchState()===1};return await this._extendStartupInfo(r),r}};mRe=I([m(0,to),m(1,Ae),m(2,lt),m(3,Lp),m(4,Es),m(5,ie),m(6,Ai),m(7,_e),m(8,wi)],mRe);var QNt=class{constructor(i,e,t,o,n,r,s,l,c){this._extensionService=e;this._notificationService=t;this._extensionsWorkbenchService=o;this._hostService=n;this._extensionEnablementService=r;this._timerService=s;this._commandService=l;this._environmentService=c;this._extensionHostKind=i.extensionHostKind;let u=i;this._internalExtensionService=u.internalExtensionService,u._setExtensionHostProxy(new fyi(i.getProxy(ao.ExtHostExtensionService))),u._setAllMainProxyIdentifiers(Object.keys(Xi).map(p=>Xi[p]))}dispose(){}$getExtension(i){return this._extensionService.getExtension(i)}$activateExtension(i,e){return this._internalExtensionService._activateById(i,e)}async $onWillActivateExtension(i){this._internalExtensionService._onWillActivateExtension(i)}$onDidActivateExtension(i,e,t,o,n){this._internalExtensionService._onDidActivateExtension(i,e,t,o,n)}$onExtensionRuntimeError(i,e){let t=eY(e);this._internalExtensionService._onExtensionRuntimeError(i,t),console.error(`[${i.value}]${t.message}`),console.error(t.stack)}async $onExtensionActivationError(i,e,t){let o=eY(e);if(this._internalExtensionService._onDidActivateExtensionError(i,o),t){let r=await this._extensionService.getExtension(i.value);if(r){let l=(await this._extensionsWorkbenchService.queryLocal()).find(c=>Ht(c.identifier,{id:t.dependency}));if(l?.local){await this._handleMissingInstalledDependency(r,l.local);return}else{await this._handleMissingNotInstalledDependency(r,t.dependency);return}}}if(!this._environmentService.isBuilt||this._environmentService.isExtensionDevelopment){this._notificationService.error(o);return}console.error(o.message)}async _handleMissingInstalledDependency(i,e){let t=i.displayName||i.name;if(this._extensionEnablementService.isEnabled(e))this._notificationService.notify({severity:wt.Error,message:d(3920,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[li({id:"reload",label:d(3919,null),run:()=>this._hostService.reload()})]}});else{let o=this._extensionEnablementService.getEnablementState(e);o===5?this._notificationService.notify({severity:wt.Error,message:d(3918,null,t,e.manifest.displayName||e.manifest.name)}):o===0?this._notificationService.notify({severity:wt.Error,message:d(3921,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[li({id:"manageWorkspaceTrust",label:d(3917,null),run:()=>this._commandService.executeCommand("workbench.trust.manage")})]}}):this._extensionEnablementService.canChangeEnablement(e)?this._notificationService.notify({severity:wt.Error,message:d(3913,null,t,e.manifest.displayName||e.manifest.name),actions:{primary:[li({id:"enable",label:d(3915,null),enabled:!0,run:()=>this._extensionEnablementService.setEnablement([e],o===10?12:13).then(()=>this._hostService.reload(),n=>this._notificationService.error(n))})]}}):this._notificationService.notify({severity:wt.Error,message:d(3914,null,t,e.manifest.displayName||e.manifest.name)})}}async _handleMissingNotInstalledDependency(i,e){let t=i.displayName||i.name,o=null;try{o=(await this._extensionsWorkbenchService.getExtensions([{id:e}],Ie.None))[0]}catch{}o?this._notificationService.notify({severity:wt.Error,message:d(3922,null,t,o.displayName,o.publisherDisplayName),actions:{primary:[li({id:"install",label:d(3916,null),run:()=>this._extensionsWorkbenchService.install(o).then(()=>this._hostService.reload(),n=>this._notificationService.error(n))})]}}):this._notificationService.error(d(3923,null,t,e))}async $setPerformanceMarks(i){this._extensionHostKind===1?this._timerService.setPerformanceMarks("localExtHost",i):this._extensionHostKind===2?this._timerService.setPerformanceMarks("workerExtHost",i):this._timerService.setPerformanceMarks("remoteExtHost",i)}async $asBrowserUri(i){return In.uriToBrowserUri(A.revive(i))}};QNt=I([fo(Xi.MainThreadExtensionService),m(1,lt),m(2,Ne),m(3,Ui),m(4,ti),m(5,As),m(6,Kx),m(7,fe),m(8,Mt)],QNt);var fyi=class{constructor(i){this._actual=i}async resolveAuthority(i,e){return AYo(await this._actual.$resolveAuthority(i,e))}async getCanonicalURI(i,e){let t=await this._actual.$getCanonicalURI(i,e);return t&&A.revive(t)}startExtensionHost(i){return this._actual.$startExtensionHost(i)}extensionTestsExecute(){return this._actual.$extensionTestsExecute()}activateByEvent(i,e){return this._actual.$activateByEvent(i,e)}activate(i,e){return this._actual.$activate(i,e)}setRemoteEnvironment(i){return this._actual.$setRemoteEnvironment(i)}updateRemoteConnectionData(i){return this._actual.$updateRemoteConnectionData(i)}deltaExtensions(i){return this._actual.$deltaExtensions(i)}test_latency(i){return this._actual.$test_latency(i)}test_up(i){return this._actual.$test_up(i)}test_down(i){return this._actual.$test_down(i)}};function AYo(a){return a.type==="ok"?{type:"ok",value:{...a.value,authority:NYo(a.value.authority)}}:a}function NYo(a){return{...a,connectTo:OYo(a.connectTo)}}function OYo(a){return a.type===0?new tLt(a.host,a.port):new eLt(a.id)}var hR=class{constructor(i,e){this._fileService=e;this._fileProvider=new Ot;this._disposables=new O;this._proxy=i.getProxy(ao.ExtHostFileSystem);let t=i.getProxy(ao.ExtHostFileSystemInfo);for(let o of e.listCapabilities())t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.capabilities);this._disposables.add(e.onDidChangeFileSystemProviderRegistrations(o=>t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.provider?.capabilities??null))),this._disposables.add(e.onDidChangeFileSystemProviderCapabilities(o=>t.$acceptProviderInfos(A.from({scheme:o.scheme,path:"/dummy"}),o.provider.capabilities)))}dispose(){this._disposables.dispose(),this._fileProvider.dispose()}async $registerFileSystemProvider(i,e,t,o){this._fileProvider.set(i,new vyi(this._fileService,e,t,o,i,this._proxy))}$unregisterProvider(i){this._fileProvider.deleteAndDispose(i)}$onFileSystemChange(i,e){let t=this._fileProvider.get(i);if(!t)throw new Error("Unknown file provider");t.$onFileSystemChange(e)}async $stat(i){try{let e=await this._fileService.stat(A.revive(i));return{ctime:e.ctime,mtime:e.mtime,size:e.size,permissions:e.readonly?1:void 0,type:hR._asFileType(e)}}catch(e){return hR._handleError(e)}}async $readdir(i){try{let e=await this._fileService.resolve(A.revive(i),{resolveMetadata:!1});if(!e.isDirectory){let t=new Error(e.name);throw t.name="EntryNotADirectory",t}return e.children?e.children.map(t=>[t.name,hR._asFileType(t)]):[]}catch(e){return hR._handleError(e)}}static _asFileType(i){let e=0;return i.isFile?e+=1:i.isDirectory&&(e+=2),i.isSymbolicLink&&(e+=64),e}async $readFile(i){try{return(await this._fileService.readFile(A.revive(i))).value}catch(e){return hR._handleError(e)}}async $writeFile(i,e){try{await this._fileService.writeFile(A.revive(i),e)}catch(t){return hR._handleError(t)}}async $rename(i,e,t){try{await this._fileService.move(A.revive(i),A.revive(e),t.overwrite)}catch(o){return hR._handleError(o)}}async $copy(i,e,t){try{await this._fileService.copy(A.revive(i),A.revive(e),t.overwrite)}catch(o){return hR._handleError(o)}}async $mkdir(i){try{await this._fileService.createFolder(A.revive(i))}catch(e){return hR._handleError(e)}}async $delete(i,e){try{return await this._fileService.del(A.revive(i),e)}catch(t){return hR._handleError(t)}}static _handleError(i){if(i instanceof ua)switch(i.fileOperationResult){case 1:i.name="EntryNotFound";break;case 0:i.name="EntryIsADirectory";break;case 6:i.name="NoPermissions";break;case 4:i.name="EntryExists";break}else if(i instanceof Error){let e=O5(i);e!=="Unknown"&&(i.name=e)}throw i}$ensureActivation(i){return this._fileService.activateProvider(i)}};hR=I([fo(Xi.MainThreadFileSystem),m(1,ge)],hR);var vyi=class a{constructor(i,e,t,o,n,r){this.readOnlyMessage=o;this._handle=n;this._proxy=r;this._onDidChange=new T;this.onDidChangeFile=this._onDidChange.event;this.onDidChangeCapabilities=U.None;this.capabilities=t,this._registration=i.registerProvider(e,this)}dispose(){this._registration.dispose(),this._onDidChange.dispose()}watch(i,e){let t=Math.random();return this._proxy.$watch(this._handle,t,i,e),ee(()=>{this._proxy.$unwatch(this._handle,t)})}$onFileSystemChange(i){this._onDidChange.fire(i.map(a._createFileChange))}static _createFileChange(i){return{resource:A.revive(i.resource),type:i.type}}async stat(i){try{return await this._proxy.$stat(this._handle,i)}catch(e){throw e}}async readFile(i){return(await this._proxy.$readFile(this._handle,i)).buffer}writeFile(i,e,t){return this._proxy.$writeFile(this._handle,i,Ke.wrap(e),t)}delete(i,e){return this._proxy.$delete(this._handle,i,e)}mkdir(i){return this._proxy.$mkdir(this._handle,i)}readdir(i){return this._proxy.$readdir(this._handle,i)}rename(i,e,t){return this._proxy.$rename(this._handle,i,e,t)}copy(i,e,t){return this._proxy.$copy(this._handle,i,e,t)}open(i,e){return this._proxy.$open(this._handle,i,e)}close(i){return this._proxy.$close(this._handle,i)}async read(i,e,t,o,n){let r=await this._proxy.$read(this._handle,i,e,n);return t.set(r.buffer,o),r.byteLength}write(i,e,t,o,n){return this._proxy.$write(this._handle,i,e,Ke.wrap(t).slice(o,o+n))}};var X3=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._fileService=e;this._logService=p;this._listener=new O;this._watches=new Ot;this._proxy=i.getProxy(ao.ExtHostFileSystemEventService),this._listener.add(e.onDidFilesChange(f=>{this._proxy.$onFileEvent({created:f.rawAdded,changed:f.rawUpdated,deleted:f.rawDeleted})}));let h=this,g=new class{async participate(f,v,b,S,y){if(b?.isUndoing)return;let w=new qe(y),x=setTimeout(()=>w.cancel(),S),E=await n.withProgress({location:15,title:this._progressLabel(v),cancellable:!0,delay:Math.min(S/2,3e3)},()=>{let V=h._proxy.$onWillRunFileOperation(v,f,S,w.token);return Ea(V,w.token)},()=>{w.cancel()}).finally(()=>{w.dispose(),clearTimeout(x)});if(!E||E.edit.edits.length===0)return;let M=E.edit.edits.some(V=>V.metadata?.needsConfirmation),N=s.getBoolean(X3.MementoKeyAdditionalEdits,0);if(c.extensionTestsLocationURI&&(N=!1),N===void 0){let V;if(E.extensionNames.length===1?v===0?V=d(3926,null,E.extensionNames[0]):v===3?V=d(3925,null,E.extensionNames[0]):v===2?V=d(3928,null,E.extensionNames[0]):V=d(3927,null,E.extensionNames[0]):v===0?V=d(3930,null,E.extensionNames.length):v===3?V=d(3929,null,E.extensionNames.length):v===2?V=d(3932,null,E.extensionNames.length):V=d(3931,null,E.extensionNames.length),M){let{confirmed:H}=await r.confirm({type:wt.Info,message:V,primaryButton:d(3941,null),cancelButton:d(3933,null)});if(N=!0,!H)return}else{let H;(ce=>(ce[ce.OK=0]="OK",ce[ce.Preview=1]="Preview",ce[ce.Cancel=2]="Cancel"))(H||={});let{result:K,checkboxChecked:j}=await r.prompt({type:wt.Info,message:V,buttons:[{label:d(3940,null),run:()=>0},{label:d(3941,null),run:()=>1}],cancelButton:{label:d(3933,null),run:()=>2},checkbox:{label:d(3924,null)}});if(K===2)return;N=K===1,j&&s.store(X3.MementoKeyAdditionalEdits,N,0,0)}}l.info("[onWill-handler] applying additional workspace edit from extensions",E.extensionNames),await o.apply(yH(E.edit,u),{undoRedoGroupId:b?.undoRedoGroupId,showPreview:N})}_progressLabel(f){switch(f){case 0:return d(3936,null);case 2:return d(3938,null);case 3:return d(3935,null);case 1:return d(3937,null);case 4:return d(3939,null)}}};this._listener.add(t.addFileOperationParticipant(g)),this._listener.add(t.onDidRunWorkingCopyFileOperation(f=>this._proxy.$onDidRunFileOperation(f.operation,f.files)))}async $watch(i,e,t,o,n){let r=A.revive(t);await this._fileService.canHandleResource(r)||this._logService.warn(`MainThreadFileSystemEventService#$watch(): cannot watch resource as its scheme is not handled by the file service (extension: ${i}, path: ${r.toString(!0)})`);let l={...o};if(l.recursive)try{(await this._fileService.stat(r)).isDirectory||(l.recursive=!1)}catch{}if(n&&!l.recursive){this._logService.trace(`MainThreadFileSystemEventService#$watch(): request to start watching correlated (extension: ${i}, path: ${r.toString(!0)}, recursive: ${l.recursive}, session: ${e}, excludes: ${JSON.stringify(l.excludes)}, includes: ${JSON.stringify(l.includes)})`);let c=new O,u=c.add(this._fileService.createWatcher(r,{...l,recursive:!1}));c.add(u.onDidChange(p=>{this._proxy.$onFileEvent({session:e,created:p.rawAdded,changed:p.rawUpdated,deleted:p.rawDeleted})})),this._watches.set(e,c)}else{this._logService.trace(`MainThreadFileSystemEventService#$watch(): request to start watching uncorrelated (extension: ${i}, path: ${r.toString(!0)}, recursive: ${l.recursive}, session: ${e}, excludes: ${JSON.stringify(l.excludes)}, includes: ${JSON.stringify(l.includes)})`);let c=this._fileService.watch(r,l);this._watches.set(e,c)}}$unwatch(i){this._watches.has(i)&&(this._logService.trace(`MainThreadFileSystemEventService#$unwatch(): request to stop watching (session: ${i})`),this._watches.deleteAndDispose(i))}dispose(){this._listener.dispose(),this._watches.dispose()}};X3.MementoKeyAdditionalEdits="file.particpants.additionalEdits",X3=I([fo(Xi.MainThreadFileSystemEventService),m(1,ge),m(2,gm),m(3,Ka),m(4,Go),m(5,ct),m(6,de),m(7,re),m(8,ko),m(9,gt),m(10,re)],X3);W(class extends z{constructor(){super({id:"files.participants.resetChoice",title:{value:d(3934,null),original:"Reset choice for 'File operation needs preview'"},f1:!0})}run(i){i.get(de).remove(X3.MementoKeyAdditionalEdits,0)}});var d_=Symbol("unset"),IN=class{constructor(){this.root=new _Je;this._size=0}get size(){return this._size}get nodes(){return this.root.children?.values()||yt.empty()}get entries(){return this.root.children?.entries()||yt.empty()}insert(i,e,t){this.opNode(i,o=>o._value=e,t)}mutate(i,e){this.opNode(i,t=>t._value=e(t._value===d_?void 0:t._value))}mutatePath(i,e){this.opNode(i,()=>{},t=>e(t))}delete(i){let e=this.getPathToKey(i);if(!e)return;let t=e.length-1,o=e[t].node._value;if(o!==d_){for(this._size--,e[t].node._value=d_;t>0;t--){let{node:n,part:r}=e[t];if(n.children?.size||n._value!==d_)break;e[t-1].node.children.delete(r)}return o}}*deleteRecursive(i){let e=this.getPathToKey(i);if(!e)return;let t=e[e.length-1].node;for(let o=e.length-1;o>0;o--){let n=e[o-1];if(n.node.children.delete(e[o].part),n.node.children.size>0||n.node._value!==d_)break}for(let o of Tdo(t))o._value!==d_&&(this._size--,yield o._value);t===this.root&&(this.root._value=d_,this.root.children=void 0)}find(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return;e=o}return e._value===d_?void 0:e._value}hasKeyOrParent(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;if(o._value!==d_)return!0;e=o}return!1}hasKeyOrChildren(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;e=o}return!0}hasKey(i){let e=this.root;for(let t of i){let o=e.children?.get(t);if(!o)return!1;e=o}return e._value!==d_}getPathToKey(i){let e=[{part:"",node:this.root}],t=0;for(let o of i){let n=e[t].node.children?.get(o);if(!n)return;e.push({part:o,node:n}),t++}return e}opNode(i,e,t){let o=this.root;for(let s of i){if(o.children)if(o.children.has(s))o=o.children.get(s);else{let l=new _Je;o.children.set(s,l),o=l}else{let l=new _Je;o.children=new Map([[s,l]]),o=l}t?.(o)}let n=o._value===d_?0:1;e(o);let r=o._value===d_?0:1;this._size+=r-n}*values(){for(let{_value:i}of Tdo(this.root))i!==d_&&(yield i)}};function*Tdo(a){let i=[a];for(;i.length>0;){let e=i.pop();if(yield e,e.children)for(let t of e.children.values())i.push(t)}}var _Je=class{constructor(){this._value=d_}get value(){return this._value===d_?void 0:this._value}set value(i){this._value=i===void 0?d_:i}};var KH=le("IMcpGalleryManifestService");function J3(a,i){let[e,t]=i.split("/");for(let o of a.resources){let[n,r]=o.type.split("/");if(n===e){if(!t||r===t)return o.id;break}}}var vb;(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))(vb||={});var _do="ext.";function RJe(a,i){return hi.toKey(a)+"/"+i}var byi;(i=>{function a(e,t){return e.id===t.id&&e.remoteAuthority===t.remoteAuthority&&e.label===t.label&&e.trustBehavior===t.trustBehavior&&Qi(e.sandbox,t.sandbox)}i.equals=a})(byi||={});var GH;(t=>{function a(o){return o}t.toSerialized=a;function i(o){return{id:o.id,label:o.label,cacheNonce:o.cacheNonce,staticMetadata:o.staticMetadata,launch:yN.fromSerialized(o.launch),sandboxEnabled:o.sandboxEnabled,variableReplacement:o.variableReplacement?Ddo.fromSerialized(o.variableReplacement):void 0}}t.fromSerialized=i;function e(o,n){return o.id===n.id&&o.label===n.label&&o.cacheNonce===n.cacheNonce&&eo(o.roots,n.roots,(r,s)=>r.toString()===s.toString())&&Qi(o.launch,n.launch)&&Qi(o.presentation,n.presentation)&&Qi(o.variableReplacement,n.variableReplacement)&&Qi(o.devMode,n.devMode)&&o.sandboxEnabled===n.sandboxEnabled}t.equals=e})(GH||={});var Ddo;(e=>{function a(t){return t}e.toSerialized=a;function i(t){return{section:t.section,folder:t.folder?{...t.folder,uri:A.revive(t.folder.uri)}:void 0,target:t.target}}e.fromSerialized=i})(Ddo||={});var hRe;(i=>i.Empty={working:!1,starting:[],serversRequiringInteraction:[]})(hRe||={});var Vs=le("IMcpService"),wee=class{constructor(){this.participants=new s5}},TC;(i=>{let a;(r=>(r[r.Trusted=0]="Trusted",r[r.TrustedOnNonce=1]="TrustedOnNonce",r[r.Untrusted=2]="Untrusted",r[r.Unknown=3]="Unknown"))(a=i.Kind||={})})(TC||={});var gRe=a=>a.template!==void 0;var Syi=a=>a.replace(/[^a-z0-9_.-]/gi,"_"),Rdo=a=>"/mcp."+Syi(a.label);var yN;(t=>{function a(o){return o}t.toSerialized=a;function i(o){switch(o.type){case 2:return{type:o.type,uri:A.revive(o.uri),headers:o.headers,oauth:o.oauth,authentication:o.authentication};case 1:return{type:o.type,cwd:o.cwd,command:o.command,args:o.args,env:o.env,envFile:o.envFile,sandbox:o.sandbox}}}t.fromSerialized=i;async function e(o){let n=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(JSON.stringify(o)));return o5(Ke.wrap(new Uint8Array(n)))}t.hash=e})(yN||={});var Sr;(n=>{let a;(u=>(u[u.Stopped=0]="Stopped",u[u.Starting=1]="Starting",u[u.Running=2]="Running",u[u.Error=3]="Error"))(a=n.Kind||={}),n.toString=r=>{switch(r.state){case 0:return d(13281,null);case 1:return d(13280,null);case 2:return d(13279,null);case 3:return d(13278,null,r.message);default:bs(r)}},n.toKindString=r=>{switch(r){case 0:return"stopped";case 1:return"starting";case 2:return"running";case 3:return"error";default:bs(r)}},n.canBeStarted=r=>r===3||r===0,n.isRunning=r=>!(0,n.canBeStarted)(r.state)})(Sr||={});var Cee=class extends Error{constructor(e,t,o){super(`MPC ${t}: ${e}`);this.code=t;this.data=o}},DJe=class extends Error{},EC=class a extends Error{constructor(e){super(`${a.prefix}${e}`);this.reason=e}static{this.prefix="User interaction required: "}static is(e){return e.message.startsWith(this.prefix)}};var bf=le("IMcpWorkbenchService"),yee=class extends k{constructor(e,t){super();this.containers=e;this._register(t.onChange(this.update,this))}set mcpServer(e){this.containers.forEach(t=>t.mcpServer=e)}update(e){for(let t of this.containers)e&&t.mcpServer?e.id===t.mcpServer.id&&(t.mcpServer=e):t.update()}};yee=I([m(1,bf)],yee);var hme=new Y("mcpServersGalleryStatus","unavailable"),xee=new Y("hasInstalledMcpServers",!0),fRe="workbench.views.mcp.installed",_C;(o=>{o.scheme="mcp-resource";let i="dylo78gyp";function e(n,r){return typeof r=="string"&&(r=A.parse(r)),r.with({scheme:o.scheme,authority:o5(Ke.fromString(n.id)),path:["",r.scheme,r.authority||i].join("/")+r.path})}o.fromServer=e;function t(n){if(typeof n=="string"&&(n=A.parse(n)),n.scheme!==o.scheme)throw new Error(`Invalid MCP resource URI: ${n.toString()}`);let r=n.path.split("/");if(r.length<3)throw new Error(`Invalid MCP resource URI: ${n.toString()}`);let[,s,l,...c]=r,u=new URL(`${s}://${l.toLowerCase()===i?"":l}`);return u.pathname=c.length?"/"+c.join("/"):"",u.search=n.query,u.hash=n.fragment,{definitionId:wwe(n.authority).toString(),resourceURL:u}}o.toServer=t})(_C||={});var Z3=le("IMcpServerSampling"),eS=class a extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}static methodNotFound(e){return new a(vb.METHOD_NOT_FOUND,`Method not found: ${e}`)}static notAllowed(){return new a(-32e3,"The user has denied permission to call this method.")}static unknown(e){let t=new a(vb.INTERNAL_ERROR,`Unknown error: ${e.stack}`);return t.cause=e,t}};var LJe=le("IMcpElicitationService"),Ldo="application/vnd.code.resource-link";var ns=class a{constructor(i,e=i.length){this.path=i;this.viewEnd=e;if(i.length===0||e<1)throw new Error("cannot create test with empty path")}static fromExtHostTestItem(i,e,t=i.parent){if(i._isRoot)return new a([e]);let o=[i.id];for(let n=t;n&&n.id!==e;n=n.parent)o.push(n.id);return o.push(e),new a(o.reverse())}static isRoot(i){return!i.includes("\0")}static root(i){let e=i.indexOf("\0");return e===-1?i:i.slice(0,e)}static fromString(i){return new a(i.split("\0"))}static join(i,e){return new a([...i.path,e])}static split(i){return i.split("\0")}static joinToString(i,e){return i.toString()+"\0"+e}static parentId(i){let e=i.lastIndexOf("\0");return e===-1?void 0:i.slice(0,e)}static localId(i){let e=i.lastIndexOf("\0");return e===-1?i:i.slice(e+1)}static isChild(i,e){return e[i.length]==="\0"&&e.startsWith(i)}static compare(i,e){return i===e?0:a.isChild(i,e)?2:a.isChild(e,i)?3:1}static getLengthOfCommonPrefix(i,e){if(i===0)return 0;let t=0;for(;t<i-1;){for(let o=1;o<i;o++){let n=e(o-1),r=e(o);if(n.path[t]!==r.path[t])return t}t++}return t}get rootId(){return new a(this.path,1)}get parentId(){return this.viewEnd>1?new a(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 i=1;i<=this.viewEnd;i++)yield new a(this.path,i)}*idsToRoot(){for(let i=this.viewEnd;i>0;i--)yield new a(this.path,i)}compare(i){if(typeof i=="string")return a.compare(this.toString(),i);for(let e=0;e<i.viewEnd&&e<this.viewEnd;e++)if(i.path[e]!==this.path[e])return 1;return i.viewEnd>this.viewEnd?2:i.viewEnd<this.viewEnd?3:0}toJSON(){return this.toString()}toString(){if(!this.stringifed){this.stringifed=this.path[0];for(let i=1;i<this.viewEnd;i++)this.stringifed+="\0",this.stringifed+=this.path[i]}return this.stringifed}};var eOt={0:"unset",1:"queued",2:"running",3:"passed",4:"failed",5:"skipped",6:"errored"};var Eyi={2:d(17344,null),4:d(17343,null),8:d(17342,null)},Mdo=[2,4,8,16,32,64];var MJe;(e=>(e.serialize=t=>({range:t.range.toJSON(),uri:t.uri.toJSON()}),e.deserialize=(t,o)=>({range:G.lift(o.range),uri:t.asCanonicalUri(A.revive(o.uri))})))(MJe||={});var Iyi;(e=>(e.serialize=t=>({label:t.label,uri:t.uri?.toJSON(),position:t.position?.toJSON()}),e.deserialize=(t,o)=>({label:o.label,uri:o.uri?t.asCanonicalUri(A.revive(o.uri)):void 0,position:o.position?ye.lift(o.position):void 0})))(Iyi||={});var yyi;(e=>(e.serialize=t=>({message:t.message,type:0,expected:t.expected,actual:t.actual,contextValue:t.contextValue,location:t.location&&MJe.serialize(t.location),stackTrace:t.stackTrace?.map(Iyi.serialize)}),e.deserialize=(t,o)=>({message:o.message,type:0,expected:o.expected,actual:o.actual,contextValue:o.contextValue,location:o.location&&MJe.deserialize(t,o.location),stackTrace:o.stackTrace&&o.stackTrace.map(n=>Iyi.deserialize(t,n))})))(yyi||={});var AJe=(a,i)=>`${i?"s":"e"}${a}`,wyi;(e=>(e.serialize=t=>({message:t.message,type:1,offset:t.offset,length:t.length,location:t.location&&MJe.serialize(t.location)}),e.deserialize=(t,o)=>({message:o.message,type:1,offset:o.offset,length:o.length,location:o.location&&MJe.deserialize(t,o.location)})))(wyi||={});var oW;(t=>(t.serialize=o=>o.type===0?yyi.serialize(o):wyi.serialize(o),t.deserialize=(o,n)=>n.type===0?yyi.deserialize(o,n):wyi.deserialize(o,n),t.isDiffable=o=>o.type===0&&o.actual!==void 0&&o.expected!==void 0))(oW||={});var XNt;(t=>(t.serializeWithoutMessages=o=>({state:o.state,duration:o.duration,messages:[]}),t.serialize=o=>({state:o.state,duration:o.duration,messages:o.messages.map(oW.serialize)}),t.deserialize=(o,n)=>({state:n.state,duration:n.duration,messages:n.messages.map(r=>oW.deserialize(o,r))})))(XNt||={});var Pdo="\0",vRe=(a,i)=>a+Pdo+i,tOt=a=>{let i=a.indexOf(Pdo);return{ctrlId:a.slice(0,i),tagId:a.slice(i+1)}},PJe;(e=>(e.serialize=t=>({extId:t.extId,label:t.label,tags:t.tags,busy:t.busy,children:void 0,uri:t.uri?.toJSON(),range:t.range?.toJSON()||null,description:t.description,error:t.error,sortText:t.sortText}),e.deserialize=(t,o)=>({extId:o.extId,label:o.label,tags:o.tags,busy:o.busy,children:void 0,uri:o.uri?t.asCanonicalUri(A.revive(o.uri)):void 0,range:o.range?G.lift(o.range):null,description:o.description,error:o.error,sortText:o.sortText})))(PJe||={});var QM;(e=>(e.serialize=t=>({expand:t.expand,item:PJe.serialize(t.item)}),e.deserialize=(t,o)=>({controllerId:ns.root(o.item.extId),expand:o.expand,item:PJe.deserialize(t,o.item)})))(QM||={});var JNt;(e=>(e.serialize=t=>{let o;return t.item&&(o={},t.item.label!==void 0&&(o.label=t.item.label),t.item.tags!==void 0&&(o.tags=t.item.tags),t.item.busy!==void 0&&(o.busy=t.item.busy),t.item.uri!==void 0&&(o.uri=t.item.uri?.toJSON()),t.item.range!==void 0&&(o.range=t.item.range?.toJSON()),t.item.description!==void 0&&(o.description=t.item.description),t.item.error!==void 0&&(o.error=t.item.error),t.item.sortText!==void 0&&(o.sortText=t.item.sortText)),{extId:t.extId,expand:t.expand,item:o}},e.deserialize=t=>{let o;return t.item&&(o={},t.item.label!==void 0&&(o.label=t.item.label),t.item.tags!==void 0&&(o.tags=t.item.tags),t.item.busy!==void 0&&(o.busy=t.item.busy),t.item.range!==void 0&&(o.range=t.item.range?G.lift(t.item.range):null),t.item.description!==void 0&&(o.description=t.item.description),t.item.error!==void 0&&(o.error=t.item.error),t.item.sortText!==void 0&&(o.sortText=t.item.sortText)),{extId:t.extId,expand:t.expand,item:o}}))(JNt||={});var bRe=(a,i)=>{i.expand!==void 0&&(a.expand=i.expand),i.item!==void 0&&(a.item=a.item?Object.assign(a.item,i.item):i.item)},NJe;(t=>(t.serializeWithoutMessages=o=>({...QM.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(XNt.serializeWithoutMessages)}),t.serialize=o=>({...QM.serialize(o),ownComputedState:o.ownComputedState,computedState:o.computedState,tasks:o.tasks.map(XNt.serialize)}),t.deserialize=(o,n)=>({...QM.deserialize(o,n),ownComputedState:n.ownComputedState,computedState:n.computedState,tasks:n.tasks.map(r=>XNt.deserialize(o,r)),retired:!0})))(NJe||={});var Tyi;(e=>(e.empty=()=>({covered:0,total:0}),e.sum=(t,o)=>{t.covered+=o.covered,t.total+=o.total}))(Tyi||={});var _yi;(t=>(t.serialize=o=>({id:o.id,statement:o.statement,branch:o.branch,declaration:o.declaration,testIds:o.testIds,uri:o.uri.toJSON()}),t.deserialize=(o,n)=>({id:n.id,statement:n.statement,branch:n.branch,declaration:n.declaration,testIds:n.testIds,uri:o.asCanonicalUri(A.revive(n.uri))}),t.empty=(o,n)=>({id:o,uri:n,statement:Tyi.empty()})))(_yi||={});function Dyi(a){return{...a,location:a.location?.toJSON()}}function Ryi(a){return a.location=a.location?ye.isIPosition(a.location)?ye.lift(a.location):G.lift(a.location):void 0,a}var Lyi;(e=>(e.serialize=t=>t.type===0?xyi.serialize(t):kyi.serialize(t),e.deserialize=t=>t.type===0?xyi.deserialize(t):kyi.deserialize(t)))(Lyi||={});var Cyi;(e=>(e.serialize=Dyi,e.deserialize=Ryi))(Cyi||={});var xyi;(e=>(e.serialize=Dyi,e.deserialize=Ryi))(xyi||={});var kyi;(e=>(e.serialize=t=>({...Dyi(t),branches:t.branches?.map(Cyi.serialize)}),e.deserialize=t=>({...Ryi(t),branches:t.branches?.map(Cyi.deserialize)})))(kyi||={});var iOt;(e=>(e.deserialize=(t,o)=>o.op===0?{op:o.op,item:QM.deserialize(t,o.item)}:o.op===1?{op:o.op,item:JNt.deserialize(o.item)}:o.op===2?{op:o.op,uri:t.asCanonicalUri(A.revive(o.uri)),docv:o.docv}:o,e.serialize=t=>t.op===0?{op:t.op,item:QM.serialize(t.item)}:t.op===1?{op:t.op,item:JNt.serialize(t.item)}:t))(iOt||={});var ZNt=class{constructor(i){this.uriIdentity=i;this._tags=new Map;this.items=new Map;this.roots=new Set;this.busyControllerCount=0;this.pendingRootCount=0;this.tags=this._tags}apply(i){let e=this.createChangeCollector();for(let t of i)switch(t.op){case 0:this.add(QM.deserialize(this.uriIdentity,t.item),e);break;case 1:this.update(JNt.deserialize(t.item),e);break;case 3:this.remove(t.itemId,e);break;case 5:this.retireTest(t.itemId);break;case 4:this.updatePendingRoots(t.amount);break;case 6:this._tags.set(t.tag.id,t.tag);break;case 7:this._tags.delete(t.id);break}e.complete?.()}add(i,e){let t=ns.parentId(i.item.extId)?.toString(),o;if(!t)o=this.createItem(i),this.roots.add(o),this.items.set(i.item.extId,o);else if(this.items.has(t)){let n=this.items.get(t);n.children.add(i.item.extId),o=this.createItem(i,n),this.items.set(i.item.extId,o)}else{console.error(`Test with unknown parent ID: ${JSON.stringify(i)}`);return}return e.add?.(o),i.expand===2&&this.busyControllerCount++,o}update(i,e){let t=this.items.get(i.extId);if(t)return i.expand!==void 0&&(t.expand===2&&this.busyControllerCount--,i.expand===2&&this.busyControllerCount++),bRe(t,i),e.update?.(t),t}remove(i,e){let t=this.items.get(i);if(!t)return;let o=ns.parentId(t.item.extId)?.toString();o?this.items.get(o).children.delete(t.item.extId):this.roots.delete(t);let n=[[i]];for(;n.length;)for(let r of n.pop()){let s=this.items.get(r);s&&(n.push(s.children),this.items.delete(r),e.remove?.(s,s!==t),s.expand===2&&this.busyControllerCount--)}}retireTest(i){}updatePendingRoots(i){this.pendingRootCount+=i}createChangeCollector(){return{}}};var SRe=le("IAiSettingsSearchService");var OJe=(a,i)=>a===i,FYo={range:(a,i)=>a===i?!0:!a||!i?!1:a.equalsRange(i),busy:OJe,label:OJe,description:OJe,error:OJe,sortText:OJe,tags:(a,i)=>!(a.length!==i.length||a.some(e=>!i.includes(e)))},Bal=Object.entries(FYo);var oOt=class extends Error{constructor(i){super(`TestItem with ID "${i}" is invalid. Make sure to create it from the createTestItem method.`)}};var WYo=new WeakMap;var Ado=a=>{let i=WYo.get(a);if(!i)throw new oOt(a?.id||"<unknown>");return i};var UYo;(e=>{function a(t){let{selectionStartLineNumber:o,selectionStartColumn:n,positionLineNumber:r,positionColumn:s}=t,l=new Oc(o-1,n-1),c=new Oc(r-1,s-1);return new n3(l,c)}e.to=a;function i(t){let{anchor:o,active:n}=t;return{selectionStartLineNumber:o.line+1,selectionStartColumn:o.character+1,positionLineNumber:n.line+1,positionColumn:n.character+1}}e.from=i})(UYo||={});var oa;(e=>{function a(t){if(!t)return;let{start:o,end:n}=t;return{startLineNumber:o.line+1,startColumn:o.character+1,endLineNumber:n.line+1,endColumn:n.character+1}}e.from=a;function i(t){if(!t)return;let{startLineNumber:o,startColumn:n,endLineNumber:r,endColumn:s}=t;return new Td(o-1,n-1,r-1,s-1)}e.to=i})(oa||={});var e8;(e=>{function a(t){return{uri:t.uri,range:oa.from(t.range)}}e.from=a;function i(t){return new UD(A.revive(t.uri),oa.to(t.range))}e.to=i})(e8||={});var zYo;(i=>{function a(e){switch(e){case 1:return 1;case 0:return 0;case 3:return 3;case 2:return 2}}i.to=a})(zYo||={});var WJe;(e=>{function a(t){return new Oc(t.lineNumber-1,t.column-1)}e.to=a;function i(t){return{lineNumber:t.line+1,column:t.character+1}}e.from=i})(WJe||={});var KYo;(t=>{function a(o,n,r){return ui(Ec(o).map(s=>i(s,n,r)))}t.from=a;function i(o,n,r){if(typeof o=="string")return{$serialized:!0,language:o,isBuiltin:r?.isBuiltin};if(o)return{$serialized:!0,language:o.language,scheme:e(o.scheme,n),pattern:lG.from(o.pattern)??void 0,exclusive:o.exclusive,notebookType:o.notebookType,isBuiltin:r?.isBuiltin}}function e(o,n){return n&&typeof o=="string"?n.transformOutgoingScheme(o):o}})(KYo||={});var Myi;(e=>{function a(t){switch(t){case 1:return 1;case 2:return 2}}e.from=a;function i(t){switch(t){case 1:return 1;case 2:return 2;default:return}}e.to=i})(Myi||={});var GYo;(e=>{function a(t){let o;return t.code&&(We(t.code)||on(t.code)?o=String(t.code):o={value:String(t.code.value),target:t.code.target}),{...oa.from(t.range),message:t.message,source:t.source,code:o,severity:rOt.from(t.severity),relatedInformation:t.relatedInformation&&t.relatedInformation.map(Pyi.from),tags:Array.isArray(t.tags)?ui(t.tags.map(Myi.from)):void 0}}e.from=a;function i(t){let o=new rpe(oa.to(t),t.message,rOt.to(t.severity));return o.source=t.source,o.code=We(t.code)?t.code:t.code?.value,o.relatedInformation=t.relatedInformation&&t.relatedInformation.map(Pyi.to),o.tags=t.tags&&ui(t.tags.map(Myi.to)),o}e.to=i})(GYo||={});var Pyi;(e=>{function a(t){return{...oa.from(t.location.range),message:t.message,resource:t.location.uri}}e.from=a;function i(t){return new iZ(new UD(t.resource,oa.to(t)),t.message)}e.to=i})(Pyi||={});var rOt;(e=>{function a(t){switch(t){case 0:return 8;case 1:return 4;case 2:return 2;case 3:return 1}return 8}e.from=a;function i(t){switch(t){case 2:return 2;case 4:return 1;case 8:return 0;case 1:return 3;default:return 0}}e.to=i})(rOt||={});var qYo;(e=>{function a(t){return typeof t=="number"&&t>=1?t-1:t===-2?En:tr}e.from=a;function i(t){if(typeof t=="number"&&t>=0)return t+1;throw new Error("invalid 'EditorGroupColumn'")}e.to=i})(qYo||={});var hp;(r=>{function a(s){return s.map(r.from)}r.fromMany=a;function i(s){return s&&typeof s=="object"&&typeof s.language=="string"&&typeof s.value=="string"}function e(s){let l;if(i(s)){let{language:p,value:h}=s;l={value:"```"+p+`
`+h+"\n```\n"}}else lE.isMarkdownString(s)?l={value:s.value,isTrusted:s.isTrusted,supportThemeIcons:s.supportThemeIcons,supportHtml:s.supportHtml,supportAlertSyntax:s.supportAlertSyntax,baseUri:s.baseUri}:typeof s=="string"?l={value:s}:l={value:""};let c=Object.create(null);l.uris=c;let u=({href:p})=>{try{let h=A.parse(p,!0);h=h.with({query:t(h.query,c)}),c[p]=h}catch{}return""};return zl.walkTokens(zl.lexer(l.value),p=>{p.type==="link"?u({href:p.href}):p.type==="image"&&typeof p.href=="string"&&u(Qxt(p.href))}),l}r.from=e;function t(s,l){if(!s)return s;let c;try{c=Dm(s)}catch{}if(!c)return s;let u=!1;return c=Dk(c,p=>{if(A.isUri(p)){let h=`__uri_${Math.random().toString(16).slice(2,8)}`;return l[h]=p,u=!0,h}else return}),u?JSON.stringify(c):s}function o(s){let l=new lE(s.value,s.supportThemeIcons);return l.isTrusted=s.isTrusted,l.supportHtml=s.supportHtml,l.supportAlertSyntax=s.supportAlertSyntax,l.baseUri=s.baseUri?A.from(s.baseUri):void 0,l}r.to=o;function n(s){if(s)return typeof s=="string"?s:r.from(s)}r.fromStrict=n})(hp||={});function Jyi(a){return typeof a>"u"?a:typeof a=="string"?A.file(a):a}var VJe;(i=>{function a(e){return typeof e>"u"?e:{contentText:e.contentText,contentIconPath:e.contentIconPath?Jyi(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}}i.from=a})(VJe||={});var Ayi;(i=>{function a(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?Jyi(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?VJe.from(e.before):void 0,after:e.after?VJe.from(e.after):void 0}}i.from=a})(Ayi||={});var Ndo;(i=>{function a(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}}i.from=a})(Ndo||={});var $Yo;(i=>{function a(e){return{isWholeLine:e.isWholeLine,rangeBehavior:e.rangeBehavior?Ndo.from(e.rangeBehavior):void 0,overviewRulerLane:e.overviewRulerLane,light:e.light?Ayi.from(e.light):void 0,dark:e.dark?Ayi.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?Jyi(e.gutterIconPath):void 0,gutterIconSize:e.gutterIconSize,overviewRulerColor:e.overviewRulerColor,before:e.before?VJe.from(e.before):void 0,after:e.after?VJe.from(e.after):void 0}}i.from=a})($Yo||={});var cG;(e=>{function a(t){return{text:t.newText,eol:t.newEol&&Vyi.from(t.newEol),range:oa.from(t.range)}}e.from=a;function i(t){let o=new cE(oa.to(t.range),t.text);return o.newEol=typeof t.eol>"u"?void 0:Vyi.to(t.eol),o}e.to=i})(cG||={});var jYo;(e=>{function a(t,o){let n={edits:[]};if(t instanceof rZ){let r=new xn;for(let s of t._allEntries())s._type===1&&A.isUri(s.to)&&s.from===void 0&&r.add(s.to);for(let s of t._allEntries())if(s._type===1){let l;s.options?.contents&&(ArrayBuffer.isView(s.options.contents)?l={type:"base64",value:gc(Ke.wrap(s.options.contents))}:l={type:"dataTransferItem",id:s.options.contents._itemId}),n.edits.push({oldResource:s.from,newResource:s.to,options:{...s.options,contents:l},metadata:s.metadata})}else s._type===2?n.edits.push({resource:s.uri,textEdit:cG.from(s.edit),versionId:r.has(s.uri)?void 0:o?.getTextDocumentVersion(s.uri),metadata:s.metadata}):s._type===6?n.edits.push({resource:s.uri,textEdit:{range:oa.from(s.range),text:s.edit.value,insertAsSnippet:!0,keepWhitespace:s.keepWhitespace},versionId:r.has(s.uri)?void 0:o?.getTextDocumentVersion(s.uri),metadata:s.metadata}):s._type===3?n.edits.push({metadata:s.metadata,resource:s.uri,cellEdit:s.edit,notebookVersionId:o?.getNotebookDocumentVersion(s.uri)}):s._type===5&&n.edits.push({metadata:s.metadata,resource:s.uri,notebookVersionId:o?.getNotebookDocumentVersion(s.uri),cellEdit:{editType:1,index:s.index,count:s.count,cells:s.cells.map(HJe.from)}})}return n}e.from=a;function i(t){let o=new rZ,n=new dt;for(let r of t.edits)if(r.textEdit){let s=r,l=A.revive(s.resource),c=oa.to(s.textEdit.range),u=s.textEdit.text,p=s.textEdit.insertAsSnippet,h;p?h=spe.replace(c,new XT(u)):h=cE.replace(c,u);let g=n.get(l);g?g.push(h):n.set(l,[h])}else o.renameFile(A.revive(r.oldResource),A.revive(r.newResource),r.options);for(let[r,s]of n)o.set(r,s);return o}e.to=i})(jYo||={});var t8;(t=>{let a=Object.create(null);a[0]=0,a[1]=1,a[2]=2,a[3]=3,a[4]=4,a[5]=5,a[6]=6,a[7]=7,a[8]=8,a[9]=9,a[10]=10,a[11]=11,a[12]=12,a[13]=13,a[14]=14,a[15]=15,a[16]=16,a[17]=17,a[18]=18,a[19]=19,a[20]=20,a[21]=21,a[22]=22,a[23]=23,a[24]=24,a[25]=25;function i(o){return typeof a[o]=="number"?a[o]:6}t.from=i;function e(o){for(let n in a)if(a[n]===o)return Number(n);return 6}t.to=e})(t8||={});var gme;(e=>{function a(t){if(t===1)return 1}e.from=a;function i(t){if(t===1)return 1}e.to=i})(gme||={});var Nyi;(e=>{function a(t){return{name:t.name,kind:t8.from(t.kind),tags:t.tags&&t.tags.map(gme.from),containerName:t.containerName,location:BJe.from(t.location)}}e.from=a;function i(t){let o=new r3(t.name,t8.to(t.kind),t.containerName,BJe.to(t.location));return o.tags=t.tags&&t.tags.map(gme.to),o}e.to=i})(Nyi||={});var QYo;(e=>{function a(t){let o={name:t.name||"!!MISSING: name!!",detail:t.detail,range:oa.from(t.range),selectionRange:oa.from(t.selectionRange),kind:t8.from(t.kind),tags:t.tags?.map(gme.from)??[]};return t.children&&(o.children=t.children.map(a)),o}e.from=a;function i(t){let o=new l3(t.name,t.detail,t8.to(t.kind),oa.to(t.range),oa.to(t.selectionRange));return Rr(t.tags)&&(o.tags=t.tags.map(gme.to)),t.children&&(o.children=t.children.map(i)),o}e.to=i})(QYo||={});var Zyi;(e=>{function a(t){let o=new RLt(t8.to(t.kind),t.name,t.detail||"",A.revive(t.uri),oa.to(t.range),oa.to(t.selectionRange));return o._sessionId=t._sessionId,o._itemId=t._itemId,o}e.to=a;function i(t,o,n){if(o=o??t._sessionId,n=n??t._itemId,o===void 0||n===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:n,name:t.name,detail:t.detail,kind:t8.from(t.kind),uri:t.uri,range:oa.from(t.range),selectionRange:oa.from(t.selectionRange),tags:t.tags?.map(gme.from)}}e.from=i})(Zyi||={});var YYo;(i=>{function a(e){return new LLt(Zyi.to(e.from),e.fromRanges.map(t=>oa.to(t)))}i.to=a})(YYo||={});var XYo;(i=>{function a(e){return new MLt(Zyi.to(e.to),e.fromRanges.map(t=>oa.to(t)))}i.to=a})(XYo||={});var BJe;(e=>{function a(t){return{range:t.range&&oa.from(t.range),uri:t.uri}}e.from=a;function i(t){return new UD(A.revive(t.uri),oa.to(t.range))}e.to=i})(BJe||={});var JYo;(e=>{function a(t){let o=t,n=t;return{originSelectionRange:o.originSelectionRange?oa.from(o.originSelectionRange):void 0,uri:o.targetUri?o.targetUri:n.uri,range:oa.from(o.targetRange?o.targetRange:n.range),targetSelectionRange:o.targetSelectionRange?oa.from(o.targetSelectionRange):void 0}}e.from=a;function i(t){return{targetUri:A.revive(t.uri),targetRange:oa.to(t.range),targetSelectionRange:t.targetSelectionRange?oa.to(t.targetSelectionRange):void 0,originSelectionRange:t.originSelectionRange?oa.to(t.originSelectionRange):void 0}}e.to=i})(JYo||={});var ZYo;(e=>{function a(t){return{range:oa.from(t.range),contents:hp.fromMany(t.contents),canIncreaseVerbosity:t.canIncreaseVerbosity,canDecreaseVerbosity:t.canDecreaseVerbosity}}e.from=a;function i(t){let o=t.contents.map(hp.to),n=oa.to(t.range),r=t.canIncreaseVerbosity,s=t.canDecreaseVerbosity;return new a_e(o,n,r,s)}e.to=i})(ZYo||={});var eXo;(e=>{function a(t){return{range:oa.from(t.range),expression:t.expression}}e.from=a;function i(t){return new b_e(oa.to(t.range),t.expression)}e.to=i})(eXo||={});var tXo;(e=>{function a(t){if(t instanceof S_e)return{type:"text",range:oa.from(t.range),text:t.text};if(t instanceof I_e)return{type:"variable",range:oa.from(t.range),variableName:t.variableName,caseSensitiveLookup:t.caseSensitiveLookup};if(t instanceof y_e)return{type:"expression",range:oa.from(t.range),expression:t.expression};throw new Error("Unknown 'InlineValue' type")}e.from=a;function i(t){switch(t.type){case"text":return{range:oa.to(t.range),text:t.text};case"variable":return{range:oa.to(t.range),variableName:t.variableName,caseSensitiveLookup:t.caseSensitiveLookup};case"expression":return{range:oa.to(t.range),expression:t.expression}}}e.to=i})(tXo||={});var iXo;(e=>{function a(t){return{frameId:t.frameId,stoppedLocation:oa.from(t.stoppedLocation)}}e.from=a;function i(t){return new w_e(t.frameId,oa.to(t.stoppedLocation))}e.to=i})(iXo||={});var Oyi;(e=>{function a(t){return{range:oa.from(t.range),kind:t.kind}}e.from=a;function i(t){return new l_e(oa.to(t.range),t.kind)}e.to=i})(Oyi||={});var oXo;(e=>{function a(t){return{uri:t.uri,highlights:t.highlights.map(Oyi.from)}}e.from=a;function i(t){return new c_e(A.revive(t.uri),t.highlights.map(Oyi.to))}e.to=i})(oXo||={});var Odo;(i=>{function a(e){switch(e){case 1:return 1;case 2:return 2;case 0:default:return 0}}i.to=a})(Odo||={});var nXo;(i=>{function a(e){return{triggerKind:Odo.to(e.triggerKind),triggerCharacter:e.triggerCharacter}}i.to=a})(nXo||={});var Fdo;(e=>{function a(t){if(t===1)return 1}e.from=a;function i(t){if(t===1)return 1}e.to=i})(Fdo||={});var rXo;(i=>{function a(e,t,o){return"icon"in e&&"command"in e?{command:t.toInternal(e.command,o),icon:vuo.fromThemeIcon(e.icon)}:{command:t.toInternal(e,o)}}i.from=a})(rXo||={});var Wdo;(o=>{let a=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 i(n){return a.get(n)??9}o.from=i;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 t(n){return e.get(n)??9}o.to=t})(Wdo||={});var sXo;(i=>{function a(e,t){let o=new m_e(e.label);return o.insertText=e.insertText,o.kind=Wdo.to(e.kind),o.tags=e.tags?.map(Fdo.to),o.detail=e.detail,o.documentation=yr(e.documentation)?hp.to(e.documentation):e.documentation,o.sortText=e.sortText,o.filterText=e.filterText,o.preselect=e.preselect,o.commitCharacters=e.commitCharacters,G.isIRange(e.range)?o.range=oa.to(e.range):typeof e.range=="object"&&(o.range={inserting:oa.to(e.range.insert),replacing:oa.to(e.range.replace)}),o.keepWhitespace=typeof e.insertTextRules>"u"?!1:!!(e.insertTextRules&1),typeof e.insertTextRules<"u"&&e.insertTextRules&4?o.insertText=new XT(e.insertText):(o.insertText=e.insertText,o.textEdit=o.range instanceof Td?new cE(o.range,o.insertText):void 0),e.additionalTextEdits&&e.additionalTextEdits.length>0&&(o.additionalTextEdits=e.additionalTextEdits.map(n=>cG.to(n))),o.command=t&&e.command?t.fromInternal(e.command):void 0,o}i.to=a})(sXo||={});var Fyi;(e=>{function a(t){if(typeof t.label!="string"&&!Array.isArray(t.label))throw new TypeError("Invalid label");return{label:t.label,documentation:hp.fromStrict(t.documentation)}}e.from=a;function i(t){return{label:t.label,documentation:yr(t.documentation)?hp.to(t.documentation):t.documentation}}e.to=i})(Fyi||={});var Wyi;(e=>{function a(t){return{label:t.label,documentation:hp.fromStrict(t.documentation),parameters:Array.isArray(t.parameters)?t.parameters.map(Fyi.from):[],activeParameter:t.activeParameter}}e.from=a;function i(t){return{label:t.label,documentation:yr(t.documentation)?hp.to(t.documentation):t.documentation,parameters:Array.isArray(t.parameters)?t.parameters.map(Fyi.to):[],activeParameter:t.activeParameter}}e.to=i})(Wyi||={});var aXo;(e=>{function a(t){return{activeSignature:t.activeSignature,activeParameter:t.activeParameter,signatures:Array.isArray(t.signatures)?t.signatures.map(Wyi.from):[]}}e.from=a;function i(t){return{activeSignature:t.activeSignature,activeParameter:t.activeParameter,signatures:Array.isArray(t.signatures)?t.signatures.map(Wyi.to):[]}}e.to=i})(aXo||={});var lXo;(i=>{function a(e,t){let o=new p_e(WJe.to(t.position),typeof t.label=="string"?t.label:t.label.map(Vdo.to.bind(void 0,e)),t.kind&&Bdo.to(t.kind));return o.textEdits=t.textEdits&&t.textEdits.map(cG.to),o.tooltip=yr(t.tooltip)?hp.to(t.tooltip):t.tooltip,o.paddingLeft=t.paddingLeft,o.paddingRight=t.paddingRight,o}i.to=a})(lXo||={});var Vdo;(i=>{function a(e,t){let o=new u_e(t.label);return o.tooltip=yr(t.tooltip)?hp.to(t.tooltip):t.tooltip,_ce.is(t.command)&&(o.command=e.fromInternal(t.command)),t.location&&(o.location=BJe.to(t.location)),o}i.to=a})(Vdo||={});var Bdo;(e=>{function a(t){return t}e.from=a;function i(t){return t}e.to=i})(Bdo||={});var cXo;(e=>{function a(t){return{range:oa.from(t.range),url:t.target,tooltip:t.tooltip}}e.from=a;function i(t){let o;if(t.url)try{o=typeof t.url=="string"?A.parse(t.url,!0):A.revive(t.url)}catch{}let n=new h_e(oa.to(t.range),o);return n.tooltip=t.tooltip,n}e.to=i})(cXo||={});var dXo;(e=>{function a(t){let o=new g_e(t.label);return t.textEdit&&(o.textEdit=cG.to(t.textEdit)),t.additionalTextEdits&&(o.additionalTextEdits=t.additionalTextEdits.map(n=>cG.to(n))),o}e.to=a;function i(t){return{label:t.label,textEdit:t.textEdit?cG.from(t.textEdit):void 0,additionalTextEdits:t.additionalTextEdits?t.additionalTextEdits.map(o=>cG.from(o)):void 0}}e.from=i})(dXo||={});var uXo;(e=>{function a(t){return new cpe(t[0],t[1],t[2],t[3])}e.to=a;function i(t){return[t.red,t.green,t.blue,t.alpha]}e.from=i})(uXo||={});var pXo;(e=>{function a(t){return{range:oa.from(t.range)}}e.from=a;function i(t){return new d_e(oa.to(t.range))}e.to=i})(pXo||={});var mXo;(i=>{function a(e){switch(e){case 2:return 2;case 1:return 1;case 3:case 4:return 3}}i.to=a})(mXo||={});var hXo;(e=>{function a(t){switch(t){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.from=a;function i(t){switch(t){case 0:return 0;case 2:return 2;case 3:return 3;case 1:default:return 1}}e.to=i})(hXo||={});var Vyi;(e=>{function a(t){if(t===2)return 1;if(t===1)return 0}e.from=a;function i(t){if(t===1)return 2;if(t===0)return 1}e.to=i})(Vyi||={});var gXo;(i=>{function a(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'")}i.from=a})(gXo||={});var fXo;(e=>{function a(t){let o={start:t.start+1,end:t.end+1};return t.kind&&(o.kind=Byi.from(t.kind)),o}e.from=a;function i(t){let o={start:t.start-1,end:t.end-1};return t.kind&&(o.kind=Byi.to(t.kind)),o}e.to=i})(fXo||={});var Byi;(e=>{function a(t){if(t)switch(t){case 1:return gT.Comment;case 2:return gT.Imports;case 3:return gT.Region}}e.from=a;function i(t){if(t)switch(t.value){case gT.Comment.value:return 1;case gT.Imports.value:return 2;case gT.Region.value:return 3}}e.to=i})(Byi||={});var vXo;(i=>{function a(e){if(e)return{pinned:typeof e.preview=="boolean"?!e.preview:void 0,inactive:e.background,preserveFocus:e.preserveFocus,selection:typeof e.selection=="object"?oa.from(e.selection):void 0,override:typeof e.override=="boolean"?Da.id:void 0}}i.from=a})(vXo||={});var lG;(o=>{function a(n){return n instanceof aZ?n.toJSON():typeof n=="string"?n:i(n)||e(n)?new aZ(n.baseUri??n.base,n.pattern).toJSON():n}o.from=a;function i(n){let r=n;return r?A.isUri(r.baseUri)&&typeof r.pattern=="string":!1}function e(n){let r=n;return r?typeof r.base=="string"&&typeof r.pattern=="string":!1}function t(n){return typeof n=="string"?n:new aZ(A.revive(n.baseUri),n.pattern)}o.to=t})(lG||={});var bXo;(i=>{function a(e){if(e){if(Array.isArray(e))return e.map(a);if(typeof e=="string")return e;{let t=e;return{language:t.language,scheme:t.scheme,pattern:lG.from(t.pattern)??void 0,exclusive:t.exclusive,notebookType:t.notebookType}}}else return}i.from=a})(bXo||={});var SXo;(e=>{function a(t){return{start:t.start,end:t.end}}e.from=a;function i(t){return new o3(t.start,t.end)}e.to=i})(SXo||={});var Hyi;(e=>{function a(t){return{timing:typeof t.runStartTime=="number"&&typeof t.runEndTime=="number"?{startTime:t.runStartTime,endTime:t.runEndTime}:void 0,executionOrder:t.executionOrder,success:t.lastRunSuccess}}e.to=a;function i(t){return{lastRunSuccess:t.success,runStartTime:t.timing?.startTime,runEndTime:t.timing?.endTime,executionOrder:t.executionOrder}}e.from=i})(Hyi||={});var Uyi;(e=>{function a(t){switch(t){case 1:return 1;case 2:default:return 2}}e.from=a;function i(t){switch(t){case 1:return 1;case 2:default:return 2}}e.to=i})(Uyi||={});var IXo;(e=>{function a(t){let o={metadata:t.metadata??Object.create(null),cells:[]};for(let n of t.cells)n_e.validate(n),o.cells.push(HJe.from(n));return o}e.from=a;function i(t){let o=new w7e(t.cells.map(HJe.to));return dv(t.metadata)||(o.metadata=t.metadata),o}e.to=i})(IXo||={});var HJe;(e=>{function a(t){return{cellKind:Uyi.from(t.kind),language:t.languageId,mime:t.mime,source:t.value,metadata:t.metadata,internalMetadata:Hyi.from(t.executionSummary??{}),outputs:t.outputs?t.outputs.map(Kyi.from):[]}}e.from=a;function i(t){return new n_e(Uyi.to(t.cellKind),t.source,t.language,t.mime,t.outputs?t.outputs.map(Kyi.to):void 0,t.metadata,t.internalMetadata?Hyi.to(t.internalMetadata):void 0)}e.to=i})(HJe||={});var zyi;(e=>{function a(t){return{mime:t.mime,valueBytes:Ke.wrap(t.data)}}e.from=a;function i(t){return new C7e(t.valueBytes.buffer,t.mime)}e.to=i})(zyi||={});var Kyi;(e=>{function a(t){return{outputId:t.id,items:t.items.map(zyi.from),metadata:t.metadata}}e.from=a;function i(t){let o=t.items.map(zyi.to);return new x7e(o,t.outputId,t.metadata)}e.to=i})(Kyi||={});var yXo;(t=>{function a(o){return e(o)?{include:lG.from(o.include)??void 0,exclude:lG.from(o.exclude)??void 0}:lG.from(o)??void 0}t.from=a;function i(o){return e(o)?{include:lG.to(o.include),exclude:lG.to(o.exclude)}:lG.to(o)}t.to=i;function e(o){let n=o;return n?!mr(n.include)&&!mr(n.exclude):!1}})(yXo||={});var wXo;(i=>{function a(e,t,o){let n=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{alignment:e.alignment===1?1:2,command:t.toInternal(n,o),text:e.text,tooltip:e.tooltip,accessibilityInformation:e.accessibilityInformation,priority:e.priority}}i.from=a})(wXo||={});var CXo;(i=>{function a(e,t,o){let n=typeof e.command=="string"?{title:"",command:e.command}:e.command;return{command:t.toInternal(n,o),label:e.label,description:e.description,detail:e.detail,documentation:e.documentation}}i.from=a})(CXo||={});var xXo;(i=>{function a(e){return{transientOutputs:e?.transientOutputs??!1,transientCellMetadata:e?.transientCellMetadata??{},transientDocumentMetadata:e?.transientDocumentMetadata??{},cellContentMetadata:e?.cellContentMetadata??{}}}i.from=a})(xXo||={});var kXo;(e=>{function a(t){return{uri:t.uri,provides:t.provides}}e.from=a;function i(t){return new NLt(A.revive(t.uri),t.provides)}e.to=i})(kXo||={});var Hdo;(e=>{function a(t){return{message:hp.fromStrict(t.message)||"",type:0,expected:t.expectedOutput,actual:t.actualOutput,contextValue:t.contextValue,location:t.location&&{range:oa.from(t.location.range),uri:t.location.uri},stackTrace:t.stackTrace?.map(o=>({label:o.label,position:o.position&&WJe.from(o.position),uri:o.uri&&A.revive(o.uri).toJSON()}))}}e.from=a;function i(t){let o=new lZ(typeof t.message=="string"?t.message:hp.to(t.message));return o.actualOutput=t.actual,o.expectedOutput=t.expected,o.contextValue=t.contextValue,o.location=t.location?BJe.to(t.location):void 0,o}e.to=i})(Hdo||={});var UJe;(e=>(e.namespace=vRe,e.denamespace=tOt))(UJe||={});var EXo;(i=>{function a(e){return{controllerId:e.controllerId,profileId:e.profileId,group:Udo.from(e.kind)}}i.from=a})(EXo||={});var Udo;(e=>{let a={3:8,2:4,1:2};function i(t){return a.hasOwnProperty(t)?a[t]:2}e.from=i})(Udo||={});var zdo;(e=>{function a(t){let o=Ado(t).controllerId;return{extId:ns.fromExtHostTestItem(t,o).toString(),label:t.label,uri:A.revive(t.uri),busy:t.busy,tags:t.tags.map(n=>UJe.namespace(o,n.id)),range:G.lift(oa.from(t.range)),description:t.description||null,sortText:t.sortText||null,error:t.error&&hp.fromStrict(t.error)||null}}e.from=a;function i(t){return{parent:void 0,error:void 0,id:ns.fromString(t.extId).localId,label:t.label,uri:A.revive(t.uri),tags:(t.tags||[]).map(o=>{let{tagId:n}=UJe.denamespace(o);return new upe(n)}),children:{add:()=>{},delete:()=>{},forEach:()=>{},*[Symbol.iterator](){},get:()=>{},replace:()=>{},size:0},range:oa.to(t.range||void 0),canResolveChildren:!1,busy:t.busy,description:t.description||void 0,sortText:t.sortText||void 0}}e.toPlain=i})(zdo||={});(e=>{function a(t){return{id:t.id}}e.from=a;function i(t){return new upe(t.id)}e.to=i})(UJe||={});var TXo;(e=>{let a=(t,o)=>{let n=t.value;if(!n)return;let r={...zdo.toPlain(n.item),parent:o,taskStates:n.tasks.map(s=>({state:s.state,duration:s.duration,messages:s.messages.filter(l=>l.type===0).map(Hdo.to)})),children:[]};if(t.children)for(let s of t.children.values()){let l=a(s,r);l&&r.children.push(l)}return r};function i(t){let o=new IN;for(let s of t.items)o.insert(ns.fromString(s.item.extId).path,s);let n=[o.nodes],r=[];for(;n.length;)for(let s of n.pop())s.value?r.push(s):s.children&&n.push(s.children.values());return{completedAt:t.completedAt,results:r.map(s=>a(s)).filter(so)}}e.to=i})(TXo||={});var _Xo;(r=>{function a(s){return{covered:s.covered,total:s.total}}function i(s){return"line"in s?WJe.from(s):oa.from(s)}function e(s){if(s)return"endLineNumber"in s?oa.to(s):WJe.to(s)}function t(s){if(s.type===1){let l=[];if(s.branches)for(let c of s.branches)l.push({executed:c.count,location:e(c.location),label:c.label});return new FLt(s.count,e(s.location),s.branches?.map(c=>new WLt(c.count,e(c.location),c.label)))}else return new VLt(s.name,s.count,e(s.location))}r.to=t;function o(s){if(typeof s.executed=="number"&&s.executed<0)throw new Error(`Invalid coverage count ${s.executed}`);return"branches"in s?{count:s.executed,location:i(s.location),type:1,branches:s.branches.length?s.branches.map(l=>({count:l.executed,location:l.location&&i(l.location),label:l.label})):void 0}:{type:0,name:s.name,count:s.executed,location:i(s.location)}}r.fromDetails=o;function n(s,l,c){return Z7e(c.statementCoverage),Z7e(c.branchCoverage),Z7e(c.declarationCoverage),{id:l,uri:c.uri,statement:a(c.statementCoverage),branch:c.branchCoverage&&a(c.branchCoverage),declaration:c.declarationCoverage&&a(c.declarationCoverage),testIds:c instanceof OLt&&c.includesTests.length?c.includesTests.map(u=>ns.fromExtHostTestItem(u,s).toString()):void 0}}r.fromFile=n})(_Xo||={});var DXo;(i=>{function a(e){switch(e){case 1:return 1;case 2:return 2}}i.to=a})(DXo||={});var RXo;(e=>{function a(t){let o=new BLt(t8.to(t.kind),t.name,t.detail||"",A.revive(t.uri),oa.to(t.range),oa.to(t.selectionRange));return o._sessionId=t._sessionId,o._itemId=t._itemId,o}e.to=a;function i(t,o,n){if(o=o??t._sessionId,n=n??t._itemId,o===void 0||n===void 0)throw new Error("invalid item");return{_sessionId:o,_itemId:n,kind:t8.from(t.kind),name:t.name,detail:t.detail??"",uri:t.uri,range:oa.from(t.range),selectionRange:oa.from(t.selectionRange),tags:t.tags?.map(gme.from)}}e.from=i})(RXo||={});var LXo;(i=>{function a(e){if(e)return{value:e.value,tooltip:e.tooltip}}i.from=a})(LXo||={});var nOt;(o=>{function a(n,r,s){let l=r.fileData;return l?new PLt(new ALt(l.name,A.revive(l.uri),l.id,bd(()=>s(l.id)))):n===cr.uriList&&r.uriListData?new C_e(t(r.uriListData)):new C_e(r.asString)}o.to=a;async function i(n,r,s=ht()){let l=await r.asString();if(n===cr.uriList)return{id:s,asString:l,fileData:void 0,uriListData:e(l)};let c=r.asFile();return{id:s,asString:l,fileData:c?{name:c.name,uri:c.uri,id:c._itemId??c.id}:void 0}}o.from=i;function e(n){return $w.split(n).map(r=>{if(r.startsWith("#"))return r;try{return A.parse(r)}catch{}return r})}function t(n){return $w.create(n.map(r=>typeof r=="string"?r:A.revive(r)))}})(nOt||={});var fme;(t=>{function a(o,n){let r=o.items.map(([s,l])=>[s,nOt.to(s,l,n)]);return new v_e(r)}t.toDataTransfer=a;async function i(o){return{items:await Promise.all(Array.from(o,async([r,s])=>[r,await nOt.from(r,s)]))}}t.from=i;async function e(o){return{items:await Promise.all(Array.from(o,async([r,s])=>[r,await nOt.from(r,s,s.id)]))}}t.fromList=e})(fme||={});var Kdo;(e=>{function a(t,o){return{kind:"reply",agentId:t.participant??o?.agentId??"",subCommand:t.command??o?.command,message:t.prompt,title:t.label}}e.from=a;function i(t){return{prompt:t.message,label:t.title,participant:t.agentId,command:t.subCommand}}e.to=i})(Kdo||={});var zJe;(e=>{function a(t){switch(t){case 0:return 3;case 1:return 1;case 2:return 2}}e.to=a;function i(t){switch(t){case 3:return 0;case 1:return 1;case 2:return 2}return 1}e.from=i})(zJe||={});var MXo;(e=>{function a(t){let o=t.content.map(s=>{if(s.type==="text")return new KI(s.value,s.audience);if(s.type==="tool_result"){let l=ui(s.value.map(c=>c.type==="text"?new KI(c.value,c.audience):c.type==="data"?new JT(c.data.buffer,c.mimeType):c.type==="prompt_tsx"?new _2(c.value):void 0));return new hpe(s.toolCallId,l,s.isError)}else{if(s.type==="image_url")return new JT(s.value.data.buffer,s.value.mimeType);if(s.type==="data")return new JT(s.data.buffer,s.mimeType);if(s.type==="tool_use")return new gpe(s.toolCallId,s.name,s.parameters)}}).filter(s=>s!==void 0),n=zJe.to(t.role);return new XLt(n,o,t.name)}e.to=a;function i(t){let o=zJe.from(t.role),n=t.name,r=t.content;typeof r=="string"&&(r=[new KI(r)]);let s=r.map(l=>{if(l instanceof hpe)return{type:"tool_result",toolCallId:l.callId,value:ui(l.content.map(c=>c instanceof KI?{type:"text",value:c.value,audience:c.audience}:c instanceof _2?{type:"prompt_tsx",value:c.value}:c instanceof JT?{type:"data",mimeType:c.mimeType,data:Ke.wrap(c.data),audience:c.audience}:void 0)),isError:l.isError};if(l instanceof JT)return Gdo(l)?{type:"image_url",value:{mimeType:l.mimeType,data:Ke.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:Ke.wrap(l.data),audience:l.audience};if(l instanceof gpe)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof KI)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:n,content:s}}e.from=i})(MXo||={});var PXo;(e=>{function a(t){let o=t.content.map(s=>{if(s.type==="text")return new KI(s.value,s.audience);if(s.type==="tool_result"){let l=s.value.map(c=>c.type==="text"?new KI(c.value,c.audience):c.type==="data"?new JT(c.data.buffer,c.mimeType):new _2(c.value));return new hpe(s.toolCallId,l,s.isError)}else return s.type==="image_url"?new JT(s.value.data.buffer,s.value.mimeType):s.type==="data"?new JT(s.data.buffer,s.mimeType):s.type==="thinking"?new x_e(s.value,s.id,s.metadata):new gpe(s.toolCallId,s.name,s.parameters)}),n=zJe.to(t.role);return new JLt(n,o,t.name)}e.to=a;function i(t){let o=zJe.from(t.role),n=t.name,r=t.content;typeof r=="string"&&(r=[new KI(r)]);let s=r.map(l=>{if(l instanceof hpe)return{type:"tool_result",toolCallId:l.callId,value:ui(l.content.map(c=>c instanceof KI?{type:"text",value:c.value,audience:c.audience}:c instanceof _2?{type:"prompt_tsx",value:c.value}:c instanceof JT?{type:"data",mimeType:c.mimeType,data:Ke.wrap(c.data),audience:c.audience}:void 0)),isError:l.isError};if(l instanceof JT)return Gdo(l)?{type:"image_url",value:{mimeType:l.mimeType,data:Ke.wrap(l.data)}}:{type:"data",mimeType:l.mimeType,data:Ke.wrap(l.data),audience:l.audience};if(l instanceof gpe)return{type:"tool_use",toolCallId:l.callId,name:l.name,parameters:l.input};if(l instanceof KI)return{type:"text",value:l.value};if(l instanceof x_e)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:n,content:s}}e.from=i})(PXo||={});function Gdo(a){switch(typeof a.mimeType=="string"?a.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 Gyi;(e=>{function a(t){return{kind:"markdownContent",content:hp.from(t.value)}}e.from=a;function i(t){return new N7e(hp.to(t.content))}e.to=i})(Gyi||={});var qdo;(e=>{function a(t){return{kind:"codeblockUri",uri:t.value,isEdit:t.isEdit,undoStopId:t.undoStopId}}e.from=a;function i(t){return new $7e(A.revive(t.uri),t.isEdit,t.undoStopId)}e.to=i})(qdo||={});var $do;(e=>{function a(t){return{kind:"markdownVuln",content:hp.from(t.value),vulnerabilities:t.vulnerabilities}}e.from=a;function i(t){return new O7e(hp.to(t.content),t.vulnerabilities)}e.to=i})($do||={});var jdo;(i=>{function a(e){return{kind:"confirmation",title:e.title,message:hp.from(e.message),data:e.data,buttons:e.buttons}}i.from=a})(jdo||={});var Qdo;(o=>{function a(n){switch(n){case 1:return"text";case 2:return"singleSelect";case 3:return"multiSelect";default:return"text"}}function i(n){switch(n){case"text":return 1;case"singleSelect":return 2;case"multiSelect":return 3;default:return 1}}function e(n){return{kind:"questionCarousel",questions:n.questions.map(r=>({id:r.id,type:a(r.type),title:r.title,message:r.message?hp.from(r.message):void 0,options:r.options?.map(s=>({id:s.id,label:s.label,value:String(s.value)})),defaultValue:r.defaultValue,allowFreeformInput:r.allowFreeformInput})),allowSkip:n.allowSkip}}o.from=e;function t(n){let r=n.questions.map(s=>new qLt(s.id,i(s.type),s.title,{message:s.message?typeof s.message=="string"?new lE(s.message):hp.to(s.message):void 0,options:s.options?.map(l=>({id:l.id,label:l.label,value:l.value})),defaultValue:s.defaultValue,allowFreeformInput:s.allowFreeformInput}));return new Q7e(r,n.allowSkip)}o.to=t})(Qdo||={});var qyi;(e=>{function a(t){let{value:o,baseUri:n}=t;function r(s,l){return s.map(c=>{let u=A.joinPath(l,c.name);return{label:c.name,uri:u,children:c.children&&r(c.children,u)}})}return{kind:"treeData",treeData:{label:Be(n),uri:n,children:r(o,n)}}}e.from=a;function i(t){let o=er(t.treeData);function n(l){return l.map(c=>({name:c.label,children:c.children&&n(c.children)}))}let r=o.uri,s=o.children?n(o.children):[];return new F7e(s,r)}e.to=i})(qyi||={});var Ydo;(e=>{function a(t){return{kind:"multiDiffData",multiDiffData:{title:t.title,resources:t.value.map(o=>({originalUri:o.originalUri,modifiedUri:o.modifiedUri,goToFileUri:o.goToFileUri,added:o.added,removed:o.removed}))},readOnly:t.readOnly}}e.from=a;function i(t){let o=t.multiDiffData.resources.map(n=>({originalUri:n.originalUri?A.revive(n.originalUri):void 0,modifiedUri:n.modifiedUri?A.revive(n.modifiedUri):void 0,goToFileUri:n.goToFileUri?A.revive(n.goToFileUri):void 0,added:n.added,removed:n.removed}));return new W7e(o,t.multiDiffData.title,t.readOnly)}e.to=i})(Ydo||={});var $yi;(e=>{function a(t){let o=r=>A.isUri(r),n=r=>"name"in r;return{kind:"inlineReference",name:t.title,inlineReference:o(t.value)?t.value:n(t.value)?Nyi.from(t.value):e8.from(t.value)}}e.from=a;function i(t){let o=er(t);return new V7e(A.isUri(o.inlineReference)?o.inlineReference:"location"in o.inlineReference?Nyi.to(o.inlineReference):e8.to(o.inlineReference),t.name)}e.to=i})($yi||={});var Xdo;(e=>{function a(t){return{kind:"progressMessage",content:hp.from(t.value)}}e.from=a;function i(t){return new B7e(t.content.value)}e.to=i})(Xdo||={});var Jdo;(e=>{function a(t){return{kind:"thinking",value:t.value,id:t.id,metadata:t.metadata}}e.from=a;function i(t){return new H7e(t.value??"",t.id,t.metadata)}e.to=i})(Jdo||={});var Zdo;(e=>{function a(t){return{kind:"hook",hookType:t.hookType,stopReason:t.stopReason,systemMessage:t.systemMessage,metadata:t.metadata}}e.from=a;function i(t){return new U7e(t.hookType,t.stopReason,t.systemMessage,t.metadata)}e.to=i})(Zdo||={});var euo;(e=>{function a(t){return{kind:"warning",content:hp.from(t.value)}}e.from=a;function i(t){return new z7e(t.content.value)}e.to=i})(euo||={});var tuo;(e=>{function a(t){return{kind:"info",content:hp.from(t.value)}}e.from=a;function i(t){return new K7e(t.content.value)}e.to=i})(tuo||={});var iuo;(i=>{function a(e){return{kind:"extensions",extensions:e.extensions}}i.from=a})(iuo||={});var ouo;(i=>{function a(e,t,o){let n;if(e.command)n=t.toInternal(e.command,o);else{if(!e.uri)throw new Error("Pull request part must have a command if URI is provided");n={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:n}}i.from=a})(ouo||={});var nuo;(e=>{function a(t){return{kind:"move",uri:t.uri,range:oa.from(t.range)}}e.from=a;function i(t){return new j7e(A.revive(t.uri),oa.to(t.range))}e.to=i})(nuo||={});var ruo;(l=>{function a(c){let u,p;c.toolSpecificData&&i(c.toolSpecificData)?(u=e(c.toolSpecificData,c.isError),p=void 0):p=c.toolSpecificData?t(c.toolSpecificData):void 0;let h=c.presentation==="hidden"?"hidden":c.presentation==="hiddenAfterComplete"?"hiddenAfterComplete":void 0;return c.enablePartialUpdate?{kind:"externalToolInvocationUpdate",toolCallId:c.toolCallId,toolName:c.toolName,isComplete:!!c.isComplete,invocationMessage:c.invocationMessage?hp.from(c.invocationMessage):void 0,pastTenseMessage:c.pastTenseMessage?hp.from(c.pastTenseMessage):void 0,toolSpecificData:p,subagentInvocationId:c.subAgentInvocationId,resultDetails:u}:{kind:"toolInvocationSerialized",toolCallId:c.toolCallId,toolId:c.toolName,invocationMessage:c.invocationMessage?hp.from(c.invocationMessage):c.toolName,originMessage:c.originMessage?hp.from(c.originMessage):void 0,pastTenseMessage:c.pastTenseMessage?hp.from(c.pastTenseMessage):void 0,isConfirmed:c.isConfirmed,isComplete:!0,source:wn.External,toolSpecificData:p,resultDetails:u,presentation:h,subAgentInvocationId:c.subAgentInvocationId}}l.from=a;function i(c){return c!==null&&typeof c=="object"&&"input"in c&&typeof c.input=="string"&&"output"in c&&Array.isArray(c.output)}function e(c,u){return{input:c.input,output:c.output.map(p=>{let h=p.mimeType.startsWith("text/");return{type:"embed",mimeType:p.mimeType,value:h?Ke.wrap(p.data).toString():gc(Ke.wrap(p.data)),isText:h}}),isError:u??!1}}function t(c){return"command"in c&&"language"in c?{kind:"terminal",command:c.command,language:c.language}:"commandLine"in c&&"language"in c?{kind:"terminal",presentationOverrides:c.presentationOverrides&&typeof c.presentationOverrides.commandLine=="string"?{commandLine:c.presentationOverrides.commandLine,language:c.presentationOverrides.language}:void 0,commandLine:c.commandLine,language:c.language,terminalCommandOutput:typeof c.output?.text=="string"?{text:c.output.text}:void 0,terminalCommandState:c.state?{exitCode:c.state.exitCode,duration:c.state.duration}:void 0}:"todoList"in c&&Array.isArray(c.todoList)?{kind:"todoList",todoList:c.todoList.map(u=>({id:String(u.id),title:u.title,status:o(u.status)}))}:"input"in c&&"output"in c&&!Array.isArray(c.output)?{kind:"simpleToolInvocation",input:typeof c.input=="string"?c.input:"",output:typeof c.output=="string"?c.output:""}:c&&"values"in c&&Array.isArray(c.values)?{kind:"resources",values:c.values.map(u=>u instanceof UD?e8.from(u):A.revive(u))}:c instanceof ULt?{kind:"subagent",description:c.description,agentName:c.agentName,prompt:c.prompt,result:c.result}:c}function o(c){switch(c){case 1:return"not-started";case 2:return"in-progress";case 3:return"completed";default:return"not-started"}}function n(c){switch(c){case"not-started":return 1;case"in-progress":return 2;case"completed":return 3;default:return 1}}function r(c){let u=new X7e(c.toolId||c.toolName,c.toolCallId,c.errorMessage);return c.invocationMessage&&(u.invocationMessage=c.invocationMessage),c.originMessage&&(u.originMessage=c.originMessage),c.pastTenseMessage&&(u.pastTenseMessage=c.pastTenseMessage),c.isConfirmed!==void 0&&(u.isConfirmed=c.isConfirmed),c.isComplete!==void 0&&(u.isComplete=c.isComplete),c.toolSpecificData&&(u.toolSpecificData=s(c.toolSpecificData)),u.subAgentInvocationId=c.subAgentInvocationId,u.subAgentName=c.subAgentName,u}l.to=r;function s(c){if(c.kind==="terminal")if(c.commandLine){let u={commandLine:c.commandLine,language:c.language};return c.terminalCommandOutput&&(u.output={text:c.terminalCommandOutput.text,truncated:c.terminalCommandOutput.truncated,lineCount:c.terminalCommandOutput.lineCount}),c.terminalCommandState&&(u.state={exitCode:c.terminalCommandState.exitCode,duration:c.terminalCommandState.duration}),u}else return{command:c.command,language:c.language};else{if(c.kind==="terminal2")return{commandLine:c.commandLine,language:c.language};if(c.kind==="todoList")return{todoList:c.todoList.map((u,p)=>{let h=Number(u.id);return{id:Number.isFinite(h)?h:p,title:u.title,status:n(u.status)}})}}return c}})(ruo||={});var AXo;(i=>{function a(e){return{kind:"progressTask",content:hp.from(e.value)}}i.from=a})(AXo||={});var NXo;(i=>{function a(e){return{kind:"progressTaskResult",content:typeof e=="string"?hp.from(e):void 0}}i.from=a})(NXo||={});var jyi;(e=>{function a(t,o,n){return{kind:"command",command:o.toInternal(t.value,n)??{command:t.value.command,title:t.value.title}}}e.from=a;function i(t,o){return new G7e(o.fromInternal(t.command)??{command:t.command.id,title:t.command.title})}e.to=i})(jyi||={});var suo;(e=>{function a(t){return{kind:"textEdit",uri:t.uri,edits:t.edits.map(o=>cG.from(o)),done:t.isDone}}e.from=a;function i(t){let o=new Y7e(A.revive(t.uri),t.edits.map(n=>cG.to(n)));return o.isDone=t.done,o}e.to=i})(suo||={});var auo;(i=>{function a(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(HJe.from)}}i.from=a})(auo||={});var luo;(i=>{function a(e){return{kind:"notebookEdit",uri:e.uri,edits:e.edits.map(auo.from),done:e.isDone}}i.from=a})(luo||={});var cuo;(i=>{function a(e){return{kind:"workspaceEdit",edits:e.edits.map(t=>({oldResource:t.oldResource,newResource:t.newResource}))}}i.from=a})(cuo||={});var Qyi;(e=>{function a(t){let o=q.isThemeIcon(t.iconPath)?t.iconPath:A.isUri(t.iconPath)?{light:A.revive(t.iconPath)}:t.iconPath&&"light"in t.iconPath&&"dark"in t.iconPath&&A.isUri(t.iconPath.light)&&A.isUri(t.iconPath.dark)?{light:A.revive(t.iconPath.light),dark:A.revive(t.iconPath.dark)}:void 0;return typeof t.value=="object"&&"variableName"in t.value?{kind:"reference",reference:{variableName:t.value.variableName,value:A.isUri(t.value.value)||!t.value.value?t.value.value:e8.from(t.value.value)},iconPath:o,options:t.options}:{kind:"reference",reference:A.isUri(t.value)||typeof t.value=="string"?t.value:e8.from(t.value),iconPath:o,options:t.options}}e.from=a;function i(t){let o=er(t),n=r=>A.isUri(r)?r:e8.to(r);return new q7e(typeof o.reference=="string"?o.reference:"variableName"in o.reference?{variableName:o.reference.variableName,value:o.reference.value&&n(o.reference.value)}:n(o.reference))}e.to=i})(Qyi||={});var duo;(i=>{function a(e){return{kind:"codeCitation",value:e.value,license:e.license,snippet:e.snippet}}i.from=a})(duo||={});var OXo;(t=>{function a(o,n,r){return o instanceof N7e?Gyi.from(o):o instanceof V7e?$yi.from(o):o instanceof q7e?Qyi.from(o):o instanceof B7e?Xdo.from(o):o instanceof H7e?Jdo.from(o):o instanceof U7e?Zdo.from(o):o instanceof F7e?qyi.from(o):o instanceof W7e?Ydo.from(o):o instanceof G7e?jyi.from(o,n,r):o instanceof Y7e?suo.from(o):o instanceof $Lt?luo.from(o):o instanceof O7e?$do.from(o):o instanceof $7e?qdo.from(o):o instanceof z7e?euo.from(o):o instanceof K7e?tuo.from(o):o instanceof HLt?jdo.from(o):o instanceof Q7e?Qdo.from(o):o instanceof zLt?duo.from(o):o instanceof j7e?nuo.from(o):o instanceof KLt?iuo.from(o):o instanceof GLt?ouo.from(o,n,r):o instanceof X7e?ruo.from(o):o instanceof jLt?cuo.from(o):{kind:"markdownContent",content:hp.from("")}}t.from=a;function i(o,n){switch(o.kind){case"reference":return Qyi.to(o);case"markdownContent":case"inlineReference":case"progressMessage":case"treeData":case"command":return e(o,n)}}t.to=i;function e(o,n){switch(o.kind){case"markdownContent":return Gyi.to(o);case"inlineReference":return $yi.to(o);case"progressMessage":return;case"treeData":return qyi.to(o);case"command":return jyi.to(o,n)}}t.toContent=e})(OXo||={});var FXo;(i=>{function a(e,t,o,n,r,s,l,c){let u=[],p=[];for(let f of e.variables.variables)f.kind==="tool"?u.push(f):f.kind==="toolset"?u.push(...f.value):p.push(f);let h=Br.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,sessionId:h,sessionResource:e.sessionResource,references:p.map(f=>puo.to(f,r,c)).filter(so),toolReferences:u.map(sOt.to),location:uuo.to(e.location),acceptedConfirmationData:e.acceptedConfirmationData,rejectedConfirmationData:e.rejectedConfirmationData,location2:t,toolInvocationToken:Object.freeze({sessionResource:e.sessionResource,workingDirectory:A.revive(e.workingDirectory)}),tools:s,model:o,modelConfiguration:n,editedFileEvents:e.editedFileEvents,modeInstructions:e.modeInstructions?.content,modeInstructions2:muo.to(e.modeInstructions),permissionLevel:e.permissionLevel,subAgentInvocationId:e.subAgentInvocationId,subAgentName:e.subAgentName,parentRequestId:e.parentRequestId,hasHooksEnabled:e.hasHooksEnabled??!1,hooks:e.hooks?buo.to(e.hooks):void 0,isSystemInitiated:e.isSystemInitiated};return Va(l,"chatParticipantPrivate")||(delete g.id,delete g.attempt,delete g.enableCommandDetection,delete g.isParticipantDetected,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),Va(l,"chatParticipantAdditions")||(delete g.acceptedConfirmationData,delete g.rejectedConfirmationData,delete g.tools),g}i.to=a})(FXo||={});var uuo;(e=>{function a(t){switch(t){case"notebook":return 3;case"terminal":return 2;case"panel":return 1;case"editor":return 4}}e.to=a;function i(t){switch(t){case 3:return"notebook";case 2:return"terminal";case 1:return"panel";case 4:return"editor"}}e.from=i})(uuo||={});var WXo;(i=>{function a(e){return e.id}i.from=a})(WXo||={});var puo;(i=>{function a(e,t,o){let n=e.value;if(!n){let s;try{s=JSON.stringify(e)}catch{s=`kind=${e.kind}, id=${e.id}, name=${e.name}`}o.error(`[ChatPromptReference] Ignoring invalid reference in variable: ${s}`);return}if(jm(n))n=A.revive(n);else if(n&&typeof n=="object"&&"uri"in n&&"range"in n&&jm(n.uri))n=e8.to(er(n));else if(SC(e)){let s=e.references?.[0]?.reference;n=new QLt(e.mimeType??"image/png",()=>Promise.resolve(new Uint8Array(Object.values(e.value))),s&&A.isUri(s)?s:void 0)}else if(e.kind==="diagnostic"){let s=e.filterSeverity&&rOt.to(e.filterSeverity),l=e.filterUri&&A.revive(e.filterUri).toString();n=new YLt(t.map(([c,u])=>e.filterUri&&c.toString()!==l?[c,[]]:[c,u.filter(p=>!(s&&p.severity>s||e.filterRange&&!G.areIntersectingOrTouching(e.filterRange,oa.from(p.range))))]).filter(([,c])=>c.length>0))}let r;return(tR(e)||B0(e))&&e.toolReferences&&(r=ewi.to(e.toolReferences)),{id:e.id,name:e.name,range:e.range&&[e.range.start,e.range.endExclusive],toolReferences:r,value:n,modelDescription:e.modelDescription}}i.to=a})(puo||={});var sOt;(i=>{function a(e){if(e.value)throw new Error("Invalid tool reference");return{name:e.id,range:e.range&&[e.range.start,e.range.endExclusive]}}i.to=a})(sOt||={});var ewi;(i=>{function a(e){let t=[];for(let o of e)if(o.kind==="tool")t.push(sOt.to(o));else if(o.kind==="toolset")t.push(...o.value.map(sOt.to));else throw new Error("Invalid tool reference in prompt variables");return t}i.to=a})(ewi||={});var muo;(e=>{function a(t){if(t)return{uri:A.revive(t.uri),name:t.name,content:t.content,toolReferences:ewi.to(er(t.toolReferences)),metadata:t.metadata,isBuiltin:t.isBuiltin}}e.to=a;function i(t){if(t)return{uri:t.uri,name:t.name,content:t.content,toolReferences:t.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}))??[],metadata:t.metadata,isBuiltin:t.isBuiltin}}e.from=i})(muo||={});var VXo;(i=>{function a(e,t,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:t.toInternal(e.command,o)}}i.from=a})(VXo||={});var huo;(t=>{function a(o){return{errorDetails:o.errorDetails,metadata:e(o.metadata),nextQuestion:o.nextQuestion,details:o.details}}t.to=a;function i(o){return{errorDetails:o.errorDetails,metadata:o.metadata,nextQuestion:o.nextQuestion,details:o.details}}t.from=i;function e(o){return Dk(o,n=>{if(n.$mid===20)return new J7e(Dk(n.content,e));if(n.$mid===21)return new KI(n.value);if(n.$mid===22)return new x_e(n.value,n.id,n.metadata);if(n.$mid===23)return new _2(n.value);if(n.$mid===24){let r;if(n.data&&typeof n.data=="object"&&n.data.type==="Buffer"&&Array.isArray(n.data.data))r=new Uint8Array(n.data.data);else if(typeof n.data=="string")try{r=Ws(n.data).buffer}catch{r=new Uint8Array(0)}else r=new Uint8Array(0);return new JT(r,n.mimeType,n.audience)}})}})(huo||={});var BXo;(i=>{function a(e,t,o){if(t.action.kind==="vote")return;let n=huo.to(e);if(t.action.kind==="command"){let r=t.action.commandButton.command;return{action:{kind:"command",commandButton:{command:o.fromInternal(r)??{command:r.id,title:r.title}}},result:n}}else return t.action.kind==="followUp"?{action:{kind:"followUp",followup:Kdo.to(t.action.followup)},result:n}:t.action.kind==="inlineChat"?{action:{kind:"editor",accepted:t.action.action==="accepted"},result:n}:t.action.kind==="chatEditingSessionAction"?{action:{kind:"chatEditingSessionAction",outcome:new Map([["accepted",1],["rejected",2],["saved",3]]).get(t.action.outcome)??2,uri:A.revive(t.action.uri),hasRemainingEdits:t.action.hasRemainingEdits},result:n}:t.action.kind==="chatEditingHunkAction"?{action:{kind:"chatEditingHunkAction",outcome:new Map([["accepted",1],["rejected",2]]).get(t.action.outcome)??2,uri:A.revive(t.action.uri),hasRemainingEdits:t.action.hasRemainingEdits,lineCount:t.action.lineCount,linesAdded:t.action.linesAdded,linesRemoved:t.action.linesRemoved},result:n}:{action:t.action,result:n}}i.to=a})(BXo||={});var HXo;(i=>{function a(e,t,o){return"terminalCommand"in e?{terminalCommand:e.terminalCommand,shouldExecute:e.shouldExecute}:"uri"in e?{uri:e.uri}:t.toInternal(e,o)}i.from=a})(HXo||={});var Yyi;(i=>{function a(e){return{...e,documentation:hp.fromStrict(e.documentation)}}i.from=a})(Yyi||={});var UXo;(i=>{function a(e,t){return Array.isArray(e)?{items:e.map(o=>Yyi.from(o))}:{items:e.items.map(o=>Yyi.from(o)),resourceOptions:e.resourceOptions?guo.from(e.resourceOptions,t):void 0}}i.from=a})(UXo||={});var guo;(i=>{function a(e,t){return{...e,pathSeparator:t,cwd:e.cwd,globPattern:lG.from(e.globPattern)??void 0}}i.from=a})(guo||={});var zXo;(i=>{function a(e){return{kind:fuo.to(e.kind),acceptedLength:e.acceptedLength}}i.to=a})(zXo||={});var fuo;(i=>{function a(e){switch(e){case 0:return 1;case 1:return 2;case 2:return 3;default:return 0}}i.to=a})(fuo||={});var KXo;(i=>{function a(e,t){if(e.kind===2){let o=e.supersededBy?t(e.supersededBy):void 0;return{kind:2,supersededBy:o,userTypingDisagreed:e.userTypingDisagreed}}else if(e.kind===0)return{kind:0};return{kind:1}}i.to=a})(KXo||={});var GXo;(e=>{function a(t){return t===2?2:1}e.from=a;function i(t){return t===2?2:1}e.to=i})(GXo||={});var qXo;(i=>{function a(e,t){return{id:t,label:e.label,description:e.description,canEdit:e.canEdit,collapsibleState:e.collapsibleState||0,contextValue:e.contextValue}}i.from=a})(qXo||={});var $Xo;(i=>{function a(e){return e.type==="mcp"?new tMt(e.label,e.serverLabel||e.label,e.instructions):e.type==="extension"?new eMt(e.extensionId.value,e.label):void 0}i.to=a})($Xo||={});var jXo;(e=>{function a(t){let o=new J7e(t.content.map(n=>n.kind==="text"?new KI(n.value,n.audience):n.kind==="data"?new JT(n.value.data.buffer,n.value.mimeType,n.audience):new _2(n.value)));return t.toolMetadata!==void 0&&(o.toolMetadata=t.toolMetadata),t.toolResultError&&(o.hasError=!!t.toolResultError),o}e.to=a;function i(t,o){t.toolResultMessage&&S7e(o,"chatParticipantPrivate");let n=c=>{c.audience&&S7e(o,"languageModelToolResultAudience")},r=!1,s;Array.isArray(t.toolResultDetails)?s=t.toolResultDetails?.map(c=>A.isUri(c)?c:e8.from(c)):t.toolResultDetails2&&(s={output:{type:"data",mimeType:t.toolResultDetails2.mime,value:Ke.wrap(t.toolResultDetails2.value)}},r=!0);let l={content:t.content.map(c=>{if(c instanceof KI)return n(c),{kind:"text",value:c.value,audience:c.audience};if(c instanceof _2)return{kind:"promptTsx",value:c.value};if(c instanceof JT)return n(c),r=!0,{kind:"data",value:{mimeType:c.mimeType,data:Ke.wrap(c.data)},audience:c.audience};throw new Error("Unknown LanguageModelToolResult part type")}),toolResultMessage:hp.fromStrict(t.toolResultMessage),toolResultDetails:s,toolMetadata:t.toolMetadata,toolResultError:t.hasError};return r?new Hg(l):l}e.from=i})(jXo||={});var vuo;(t=>{function a(o){return o}t.fromThemeIcon=a;function i(o){if(o){if(q.isThemeIcon(o))return o;if(A.isUri(o))return o;if(typeof o=="string")return A.file(o);if(typeof o=="object"&&o!==null&&"dark"in o){let n=typeof o.dark=="string"?A.file(o.dark):o.dark,r=typeof o.light=="string"?A.file(o.light):o.light;return n?{dark:n,light:r??n}:void 0}else return}else return}t.from=i;function e(o){if(o){if(q.isThemeIcon(o))return o;if(jm(o))return A.revive(o);{let n=o;return{light:A.revive(n.light),dark:A.revive(n.dark)}}}else return}t.to=e})(vuo||={});var QXo;(e=>{function a(t){return{query:t.query,kind:i(t.kind),settings:t.settings}}e.fromSettingsSearchResult=a;function i(t){switch(t){case 1:return 1;case 2:return 2;case 3:return 3;default:throw new Error("Unknown AiSettingsSearchResultKind")}}})(QXo||={});var YXo;(t=>{function a(o){return!!o.uri}function i(o){return yN.toSerialized(a(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})}t.from=i;function e(o){let n=yN.fromSerialized(o.launch);if(n.type===2)return new oMt(o.label,n.uri,Object.fromEntries(n.headers),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);{let r=new iMt(o.label,n.command,[...n.args],Object.fromEntries(Object.entries(n.env).map(([s,l])=>[s,l===null?null:String(l)])),o.cacheNonce==="$$NONE"?void 0:o.cacheNonce);return n.cwd&&(r.cwd=A.file(n.cwd)),r}}t.to=e})(YXo||={});var XXo;(i=>{function a(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error("Unknown SourceControlInputBoxValidationType")}}i.from=a})(XXo||={});var buo;(i=>{function a(e){let t={};for(let[o,n]of Object.entries(e)){if(!n||n.length===0)continue;let r=[];for(let s of n){let l=Suo.to(s);l&&r.push(l)}r.length>0&&(t[o]=r)}return t}i.to=a})(buo||={});var Suo;(i=>{function a(e){let t=LSi(e,Ao);if(t)return{command:t,cwd:e.cwd,env:e.env,timeout:e.timeout}}i.to=a})(Suo||={});var JXo;(e=>{function a(t){if(t!==void 0)switch(t){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;default:return}}function i(t){let o=t.timing,n=o?.created??o?.startTime??0,r=o?.lastRequestStarted??o?.startTime,s=o?.lastRequestEnded??o?.endTime;return{resource:t.resource,label:t.label,description:t.description?hp.from(t.description):void 0,badge:t.badge?hp.from(t.badge):void 0,status:a(t.status),archived:t.archived,tooltip:hp.fromStrict(t.tooltip),timing:{created:n,lastRequestStarted:r,lastRequestEnded:s},changes:t.changes instanceof Array?t.changes:void 0,metadata:t.metadata}}e.from=i})(JXo||={});var vme=class{constructor(){this.requestIdPool=0;this.dataTransferFiles=new Map}add(i){let e=this.requestIdPool++;return this.dataTransferFiles.set(e,ui(Array.from(i,([,t])=>t.asFile()))),{id:e,dispose:()=>{this.dataTransferFiles.delete(e)}}}async resolveFileData(i,e){let t=this.dataTransferFiles.get(i);if(!t)throw new Error("No data transfer found");let o=t.find(n=>n.id===e);if(!o)throw new Error("No matching file found in data transfer");return Ke.wrap(await o.data())}dispose(){this.dataTransferFiles.clear()}};function yuo(a){return typeof a=="string"?!1:Array.isArray(a)?a.every(yuo):!!a.exclusive}var cOt=class{constructor(i,e,t,o,n){this.uri=i;this.languageId=e;this.notebookUri=t;this.notebookType=o;this.recursive=n}equals(i){return this.notebookType===i.notebookType&&this.languageId===i.languageId&&this.uri.toString()===i.uri.toString()&&this.notebookUri?.toString()===i.notebookUri?.toString()&&this.recursive===i.recursive}},Yd=class a{constructor(i){this._notebookInfoResolver=i;this._clock=0;this._entries=[];this._onDidChange=new T}get onDidChange(){return this._onDidChange.event}register(i,e){let t={selector:i,provider:e,_score:-1,_time:this._clock++};return this._entries.push(t),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),ee(()=>{if(t){let o=this._entries.indexOf(t);o>=0&&(this._entries.splice(o,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),t=void 0)}})}has(i){return this.all(i).length>0}all(i){if(!i)return[];this._updateScores(i,!1);let e=[];for(let t of this._entries)t._score>0&&e.push(t.provider);return e}allNoModel(){return this._entries.map(i=>i.provider)}get registeredLanguageIds(){let i=new Set;for(let e of this._entries)mvi(e.selector,i);return i}ordered(i,e=!1){let t=[];return this._orderedForEach(i,e,o=>t.push(o.provider)),t}orderedGroups(i){let e=[],t,o;return this._orderedForEach(i,!1,n=>{t&&o===n._score?t.push(n.provider):(o=n._score,t=[n.provider],e.push(t))}),e}_orderedForEach(i,e,t){this._updateScores(i,e);for(let o of this._entries)o._score>0&&t(o)}_updateScores(i,e){let t=this._notebookInfoResolver?.(i.uri),o=t?new cOt(i.uri,i.getLanguageId(),t.uri,t.type,e):new cOt(i.uri,i.getLanguageId(),void 0,void 0,e);if(!this._lastCandidate?.equals(o)){this._lastCandidate=o;for(let n of this._entries)if(n._score=gH(n.selector,o.uri,o.languageId,Pk(i),o.notebookUri,o.notebookType),yuo(n.selector)&&n._score>0)if(e)n._score=0;else{for(let r of this._entries)r._score=0;n._score=1e3;break}this._entries.sort(a._compareByScoreAndTime)}}static _compareByScoreAndTime(i,e){return i._score<e._score?1:i._score>e._score?-1:$Je(i.selector)&&!$Je(e.selector)?1:!$Je(i.selector)&&$Je(e.selector)?-1:i._time<e._time?1:i._time>e._time?-1:0}};function $Je(a){return typeof a=="string"?!1:Array.isArray(a)?a.some($Je):!!a.isBuiltin}var Sme=new Yd,bme=class a{constructor(i,e,t,o){this.id=i;this.provider=e;this.roots=t;this.ref=o;this.root=t[0]}static async create(i,e,t){let[o]=Sme.ordered(i);if(!o)return;let n=await o.prepareCallHierarchy(i,e,t);if(n)return new a(n.roots.reduce((r,s)=>r+s._sessionId,""),o,n.roots,new hz(n))}dispose(){this.ref.release()}fork(i){let e=this;return new class extends a{constructor(){super(e.id,e.provider,[i],e.ref.acquire())}}}async resolveIncomingCalls(i,e){try{let t=await this.provider.provideIncomingCalls(i,e);if(Rr(t))return t}catch(t){vs(t)}return[]}async resolveOutgoingCalls(i,e){try{let t=await this.provider.provideOutgoingCalls(i,e);if(Rr(t))return t}catch(t){vs(t)}return[]}},jJe=new Map;Ge.registerCommand("_executePrepareCallHierarchy",async(a,...i)=>{let[e,t]=i;To(A.isUri(e)),To(ye.isIPosition(t));let n=a.get(_t).getModel(e),r;if(!n){let l=await a.get(Bt).createModelReference(e);n=l.object.textEditorModel,r=l}try{let s=await bme.create(n,t,Ie.None);return s?(jJe.set(s.id,s),jJe.forEach((l,c,u)=>{u.size>10&&(l.dispose(),jJe.delete(c))}),[s.root]):[]}finally{r?.dispose()}});function wuo(a){return!0}Ge.registerCommand("_executeProvideIncomingCalls",async(a,...i)=>{let[e]=i;To(wuo(e));let t=jJe.get(e._sessionId);return t?t.resolveIncomingCalls(e,Ie.None):[]});Ge.registerCommand("_executeProvideOutgoingCalls",async(a,...i)=>{let[e]=i;To(wuo(e));let t=jJe.get(e._sessionId);return t?t.resolveOutgoingCalls(e,Ie.None):[]});var dOt;(t=>{let a=[];function i(o){let n=o;return n&&a.push(n),{dispose(){if(n){let r=a.indexOf(n);r>=0&&(a.splice(r,1),n=void 0)}}}}t.register=i;function e(){return a.slice(0)}t.all=e})(dOt||={});var twi=class{constructor(i,e){this.symbol=i;this.provider=e}};async function uOt(a,i=Ie.None){let e=[],t=dOt.all().map(async n=>{try{let r=await n.provideWorkspaceSymbols(a,i);if(!r)return;for(let s of r)e.push(new twi(s,n))}catch(r){vs(r)}});if(await Promise.all(t),i.isCancellationRequested)return[];function o(n,r){let s=oc(n.symbol.name,r.symbol.name);return s===0&&(s=n.symbol.kind-r.symbol.kind),s===0&&(s=oc(n.symbol.location.uri.toString(),r.symbol.location.uri.toString())),s===0&&(n.symbol.location.range&&r.symbol.location.range?G.areIntersecting(n.symbol.location.range,r.symbol.location.range)||(s=G.compareRangesUsingStarts(n.symbol.location.range,r.symbol.location.range)):n.provider.resolveWorkspaceSymbol&&!r.provider.resolveWorkspaceSymbol?s=-1:!n.provider.resolveWorkspaceSymbol&&r.provider.resolveWorkspaceSymbol&&(s=1)),s===0&&(s=oc(n.symbol.containerName??"",r.symbol.containerName??"")),s}return Lf(e,o).map(n=>n[0]).flat()}function Tee(a){let i=a.get(ie),e=a.get(Ae),t=a.get(ge);return i.editors.map(n=>po.getOriginalUri(n,{supportSideBySide:1})).filter(n=>!!n&&!e.isInsideWorkspace(n)&&t.hasProvider(n))}var Cuo=/\s?[#:\(](?:line )?(\d*)(?:[#:,](\d*))?\)?:?\s*$/;function xuo(a,i){if(!a||i?.some(o=>{let n=a.indexOf(o);return n===0||n>0&&!Cuo.test(a.substring(n+1))}))return;let e,t=Cuo.exec(a);if(t){let o=parseInt(t[1]??"",10);if(on(o)){e={startLineNumber:o,startColumn:1,endLineNumber:o,endColumn:1};let n=parseInt(t[2]??"",10);on(n)&&(e={startLineNumber:e.startLineNumber,startColumn:n,endLineNumber:e.endLineNumber,endColumn:n})}else t[1]===""&&(e={startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1})}if(t&&e)return{filter:a.substr(0,t.index),range:e}}var IRe=new Y("searchState",0),yRe={id:"search",order:13,title:d(15313,null),type:"object",properties:{}};var yme=new Yd,Ime=class a{constructor(i,e,t,o){this.id=i;this.provider=e;this.roots=t;this.ref=o;this.root=t[0]}static async create(i,e,t){let[o]=yme.ordered(i);if(!o)return;let n=await o.prepareTypeHierarchy(i,e,t);if(n)return new a(n.roots.reduce((r,s)=>r+s._sessionId,""),o,n.roots,new hz(n))}dispose(){this.ref.release()}fork(i){let e=this;return new class extends a{constructor(){super(e.id,e.provider,[i],e.ref.acquire())}}}async provideSupertypes(i,e){try{let t=await this.provider.provideSupertypes(i,e);if(Rr(t))return t}catch(t){vs(t)}return[]}async provideSubtypes(i,e){try{let t=await this.provider.provideSubtypes(i,e);if(Rr(t))return t}catch(t){vs(t)}return[]}},QJe=new Map;Ge.registerCommand("_executePrepareTypeHierarchy",async(a,...i)=>{let[e,t]=i;To(A.isUri(e)),To(ye.isIPosition(t));let n=a.get(_t).getModel(e),r;if(!n){let l=await a.get(Bt).createModelReference(e);n=l.object.textEditorModel,r=l}try{let s=await Ime.create(n,t,Ie.None);if(!s)return[];QJe.forEach((l,c,u)=>{u.size>10&&(l.dispose(),QJe.delete(c))});for(let l of s.roots)QJe.set(l._sessionId,s);return s.roots}finally{r?.dispose()}});function kuo(a){let i=a;return typeof a=="object"&&typeof i.name=="string"&&typeof i.kind=="number"&&A.isUri(i.uri)&&G.isIRange(i.range)&&G.isIRange(i.selectionRange)}Ge.registerCommand("_executeProvideSupertypes",async(a,...i)=>{let[e]=i;To(kuo(e));let t=QJe.get(e._sessionId);return t?t.provideSupertypes(e,Ie.None):[]});Ge.registerCommand("_executeProvideSubtypes",async(a,...i)=>{let[e]=i;To(kuo(e));let t=QJe.get(e._sessionId);return t?t.provideSubtypes(e,Ie.None):[]});var XS=le("aiEditTelemetryService");var Euo="VSCode.ABExp.FeatureData",Tuo=3600*1e3;var _uo=(h=>(h.Market="X-MSEdge-Market",h.CorpNet="X-FD-Corpnet",h.ApplicationVersion="X-VSCode-AppVersion",h.Build="X-VSCode-Build",h.ClientId="X-MSEdge-ClientId",h.DeveloperDeviceId="X-VSCode-DevDeviceId",h.ExtensionName="X-VSCode-ExtensionName",h.ExtensionVersion="X-VSCode-ExtensionVersion",h.Language="X-VSCode-Language",h.TargetPopulation="X-VSCode-TargetPopulation",h.Platform="X-VSCode-Platform",h.ReleaseDate="X-VSCode-ReleaseDate",h))(_uo||{}),pOt=class a{constructor(i,e,t,o,n,r){this.version=i;this.appName=e;this.machineId=t;this.devDeviceId=o;this.targetPopulation=n;this.releaseDate=r}static trimVersionSuffix(i){let e=/\-[a-zA-Z0-9]+$/;return i.split(e)[0]}getFilterValue(i){switch(i){case"X-VSCode-AppVersion":return a.trimVersionSuffix(this.version);case"X-VSCode-Build":return this.appName;case"X-MSEdge-ClientId":return this.machineId;case"X-VSCode-DevDeviceId":return this.devDeviceId;case"X-VSCode-Language":return Kr;case"X-VSCode-ExtensionName":return"vscode-core";case"X-VSCode-ExtensionVersion":return"999999.0";case"X-VSCode-TargetPopulation":return this.targetPopulation;case"X-VSCode-Platform":return oD(xm);case"X-VSCode-ReleaseDate":return a.formatReleaseDate(this.releaseDate);default:return""}}static formatReleaseDate(i){if(!i)return"";let e=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2})/.exec(i);return e?e.slice(1,5).join(""):""}getFilters(){let i=new Map,e=Object.values(_uo);for(let t of e)i.set(t,this.getFilterValue(t));return i}};function mOt(a){let i=a?.includes("Visual-Studio-Code"),e=a?.includes("github"),t=a?.includes("microsoft")||a?.includes("ms-copilot")||a?.includes("MicrosoftCopilot");return i?"vscode":e?"github":t?"microsoft":void 0}var Duo=(l=>(l.CopilotExtensionVersion="X-Copilot-RelatedPluginVersion-githubcopilot",l.CopilotChatExtensionVersion="X-Copilot-RelatedPluginVersion-githubcopilotchat",l.CompletionsVersionInCopilotChat="X-VSCode-CompletionsInChatExtensionVersion",l.CopilotSku="X-GitHub-Copilot-SKU",l.MicrosoftInternalOrg="X-Microsoft-Internal-Org",l.CopilotTrackingId="X-Copilot-CopilotTrackingId",l.CopilotIsSn="X-GitHub-Copilot-IsSn",l.CopilotIsFcv1="X-GitHub-Copilot-IsFcv1",l))(Duo||{});var uG=class extends k{constructor(e,t,o,n,r){super();this._extensionService=e;this._logService=t;this._storageService=o;this._chatEntitlementService=n;this._defaultAccountService=r;this._onDidChangeFilters=this._register(new T);this.onDidChangeFilters=this._onDidChangeFilters.event;this.copilotExtensionVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotExtensionVersion",0),this.copilotChatExtensionVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotChatExtensionVersion",0),this.copilotCompletionsVersion=this._storageService.get("extensionsAssignmentFilterProvider.copilotCompletionsVersion",0),this.copilotSku=this._storageService.get("extensionsAssignmentFilterProvider.copilotSku",0),this.copilotInternalOrg=this._storageService.get("extensionsAssignmentFilterProvider.copilotInternalOrg",0),this.copilotTrackingId=this._storageService.get("extensionsAssignmentFilterProvider.copilotTrackingId",0),this.copilotIsSn=this._storageService.get("extensionsAssignmentFilterProvider.copilotIsSn",0),this.copilotIsFcv1=this._storageService.get("extensionsAssignmentFilterProvider.copilotIsFcv1",0),this._register(this._extensionService.onDidChangeExtensionsStatus(s=>{s.some(l=>hi.equals(l,"github.copilot")||hi.equals(l,"github.copilot-chat"))&&this.updateExtensionVersions()})),this._register(this._chatEntitlementService.onDidChangeEntitlement(()=>{this.updateCopilotEntitlementInfo()})),this._register(this._defaultAccountService.onDidChangeCopilotTokenInfo(()=>{this.updateCopilotTokenInfo()})),this.updateExtensionVersions(),this.updateCopilotEntitlementInfo(),this.updateCopilotTokenInfo()}async updateExtensionVersions(){let e,t,o;try{let[n,r]=await Promise.all([this._extensionService.getExtension("github.copilot"),this._extensionService.getExtension("github.copilot-chat")]);e=n?.version,t=r?.version,o=r?.completionsCoreVersion}catch(n){this._logService.error("Failed to update extension version assignments",n)}this.copilotCompletionsVersion===o&&this.copilotExtensionVersion===e&&this.copilotChatExtensionVersion===t||(this.copilotExtensionVersion=e,this.copilotChatExtensionVersion=t,this.copilotCompletionsVersion=o,this._storageService.store("extensionsAssignmentFilterProvider.copilotExtensionVersion",this.copilotExtensionVersion,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotChatExtensionVersion",this.copilotChatExtensionVersion,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotCompletionsVersion",this.copilotCompletionsVersion,0,1),this._onDidChangeFilters.fire())}updateCopilotEntitlementInfo(){let e=this._chatEntitlementService.sku,t=this._chatEntitlementService.copilotTrackingId,o=mOt(this._chatEntitlementService.organisations);this.copilotSku===e&&this.copilotInternalOrg===o&&this.copilotTrackingId===t||(this.copilotSku=e,this.copilotInternalOrg=o,this.copilotTrackingId=t,this._storageService.store("extensionsAssignmentFilterProvider.copilotSku",this.copilotSku,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotInternalOrg",this.copilotInternalOrg,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotTrackingId",this.copilotTrackingId,0,1),this._onDidChangeFilters.fire())}updateCopilotTokenInfo(){let e=this._defaultAccountService.copilotTokenInfo,t=e?.sn==="1"?"1":"0",o=e?.fcv1==="1"?"1":"0";this.copilotIsSn===t&&this.copilotIsFcv1===o||(this.copilotIsSn=t,this.copilotIsFcv1=o,this._storageService.store("extensionsAssignmentFilterProvider.copilotIsSn",this.copilotIsSn,0,1),this._storageService.store("extensionsAssignmentFilterProvider.copilotIsFcv1",this.copilotIsFcv1,0,1),this._onDidChangeFilters.fire())}static trimVersionSuffix(e){let t=/\-[a-zA-Z0-9]+$/;return e.split(t)[0]}getFilterValue(e){switch(e){case"X-Copilot-RelatedPluginVersion-githubcopilot":return this.copilotExtensionVersion?uG.trimVersionSuffix(this.copilotExtensionVersion):null;case"X-VSCode-CompletionsInChatExtensionVersion":return this.copilotCompletionsVersion?uG.trimVersionSuffix(this.copilotCompletionsVersion):null;case"X-Copilot-RelatedPluginVersion-githubcopilotchat":return this.copilotChatExtensionVersion?uG.trimVersionSuffix(this.copilotChatExtensionVersion):null;case"X-GitHub-Copilot-SKU":return this.copilotSku??null;case"X-Microsoft-Internal-Org":return this.copilotInternalOrg??null;case"X-Copilot-CopilotTrackingId":return this.copilotTrackingId??null;case"X-GitHub-Copilot-IsSn":return this.copilotIsSn??null;case"X-GitHub-Copilot-IsFcv1":return this.copilotIsFcv1??null;default:return null}}getFilters(){let e=new Map,t=Object.values(Duo);for(let o of t)e.set(o,this.getFilterValue(o));return e}};uG=I([m(0,lt),m(1,re),m(2,de),m(3,dr),m(4,Nd)],uG);function hOt(a,i,e){return Yy(a)===3&&!!i.tasConfig&&!e.disableExperiments&&!e.extensionTestsLocationURI&&!e.enableSmokeTestDriver&&a.getValue("workbench.enableExperiments")===!0}var wN=le("assignmentService"),iwi=class{constructor(i){this.memento=i;this.mementoObj=i.getMemento(-1,1)}async getValue(i,e){return await this.mementoObj[i]||e}setValue(i,e){this.mementoObj[i]=e,this.memento.saveMemento()}},owi=class extends k{constructor(e,t){super();this.telemetryService=e;this.productService=t;this._onDidUpdateAssignmentContext=this._register(new T);this.onDidUpdateAssignmentContext=this._onDidUpdateAssignmentContext.event;this._assignmentFilters=[];this._assignmentFilterDisposables=this._register(new O)}get assignmentContext(){return this._lastAssignmentContext?.split(";")}_filterAssignmentContext(e){return e.split(";").filter(n=>{for(let r of this._assignmentFilters)if(r.exclude(n))return!1;return!0}).join(";")}_setAssignmentContext(e){let t=this._filterAssignmentContext(e);this._lastAssignmentContext=t,this._onDidUpdateAssignmentContext.fire(),this.productService.tasConfig?.assignmentContextTelemetryPropertyName&&this.telemetryService.setExperimentProperty(this.productService.tasConfig.assignmentContextTelemetryPropertyName,t)}addAssignmentFilter(e){this._assignmentFilters.push(e),this._assignmentFilterDisposables.add(e.onDidChange(()=>{this._previousAssignmentContext&&this._setAssignmentContext(this._previousAssignmentContext)})),this._previousAssignmentContext&&this._setAssignmentContext(this._previousAssignmentContext)}setSharedProperty(e,t){if(e===this.productService.tasConfig?.assignmentContextTelemetryPropertyName)return this._previousAssignmentContext=t,this._setAssignmentContext(t);this.telemetryService.setExperimentProperty(e,t)}postEvent(e,t){let o={};for(let[n,r]of t.entries())o[n]=r;this.telemetryService.publicLog(e,o)}},YJe=class extends k{constructor(e,t,o,n,r,s){super();this.telemetryService=e;this.configurationService=o;this.productService=n;this.instantiationService=s;this.tasSetupDisposables=new O;this.networkInitialized=!1;this._onDidRefetchAssignments=this._register(new T);this.onDidRefetchAssignments=this._onDidRefetchAssignments.event;this.experimentsEnabled=hOt(o,n,r),this.experimentsEnabled&&(this.tasClient=this.setupTASClient()),this.telemetry=this._register(new owi(e,n)),this._register(this.telemetry.onDidUpdateAssignmentContext(()=>this._onDidRefetchAssignments.fire())),this._register(this.configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration("experiments.override")&&this._onDidRefetchAssignments.fire()})),this.keyValueStorage=new iwi(new $l("experiment.service.memento",t));let l=o.getValue("experiments.overrideDelay"),c=typeof l=="number"?l:0;this.overrideInitDelay=Li(c)}async getTreatment(e){let t=await this.doGetTreatment(e);return this.telemetryService.publicLog2("tasClientReadTreatmentComplete",{treatmentName:e,treatmentValue:JSON.stringify(t)}),t}async doGetTreatment(e){await this.overrideInitDelay;let t=this.configurationService.getValue(`experiments.override.${e}`);if(t!==void 0)return t;if(!this.tasClient||!this.experimentsEnabled)return;let o,n=await this.tasClient;return this.networkInitialized?o=n.getTreatmentVariable("vscode",e):o=await n.getTreatmentVariableAsync("vscode",e,!0),o=n.getTreatmentVariable("vscode",e),o}async setupTASClient(){this.tasSetupDisposables.clear();let e=this.productService.quality==="stable"?"public":this.productService.quality==="exploration"?"exploration":"insider",t=new pOt(this.productService.version,this.productService.nameLong,this.telemetryService.machineId,this.telemetryService.devDeviceId,e,this.productService.date??""),o=this.instantiationService.createInstance(uG);this.tasSetupDisposables.add(o),this.tasSetupDisposables.add(o.onDidChangeFilters(()=>this.refetchAssignments()));let n=this.productService.tasConfig,r=new(await vf("tas-client","dist/tas-client.min.js")).ExperimentationService({filterProviders:[t,o],telemetry:this.telemetry,storageKey:Euo,keyValueStorage:this.keyValueStorage,assignmentContextTelemetryPropertyName:n.assignmentContextTelemetryPropertyName,telemetryEventName:n.telemetryEventName,endpoint:n.endpoint,refetchInterval:Tuo});return await r.initializePromise,r.initialFetch.then(()=>{this.networkInitialized=!0}),r}async refetchAssignments(){if(!this.tasClient)return;let e=await this.tasClient;await e.initialFetch,await e.getTreatmentVariableAsync("vscode","refresh",!1)}async getCurrentExperiments(){if(this.tasClient&&this.experimentsEnabled)return await this.tasClient,this.telemetry.assignmentContext}addTelemetryAssignmentFilter(e){this.telemetry.addAssignmentFilter(e)}};YJe=I([m(0,_e),m(1,de),m(2,B),m(3,Ze),m(4,Mt),m(5,F)],YJe);Ce(wN,YJe,1);var iJo=oe.as($t.Configuration);iJo.registerConfiguration({...jd,properties:{"workbench.enableExperiments":{type:"boolean",description:d(18664,null),default:!0,scope:1,restricted:!0,tags:["usesOnlineServices"]}}});var nwi=le("inlineCompletionsUnificationService"),oJo="cmp-cht-",Ruo="cmp-ext-",nJo="inlineCompletionsUnificationCode",rJo="inlineCompletionsUnificationModel",sJo=new Y("isRunningUnificationExperiment",!1),gOt="chat.extensionUnification.enabled",XJe=class extends k{constructor(e,t,o,n,r,s,l){super();this._assignmentService=e;this._contextKeyService=t;this._configurationService=o;this._extensionEnablementService=n;this._extensionManagementService=r;this._extensionService=s;this._state=new fOt(!1,!1,!1,[]);this._onDidStateChange=this._register(new T);this.onDidStateChange=this._onDidStateChange.event;this._onDidChangeExtensionUnificationState=this._register(new T);this._onDidChangeExtensionUnificationSetting=this._register(new T);this._completionsExtensionId=l.defaultChatAgent?.extensionId.toLowerCase(),this._chatExtensionId=l.defaultChatAgent?.chatExtensionId.toLowerCase();let c=[this._completionsExtensionId,this._chatExtensionId].filter(u=>!!u);this.isRunningUnificationExperiment=sJo.bindTo(this._contextKeyService),this._assignmentService.addTelemetryAssignmentFilter({exclude:u=>u.startsWith(Ruo)&&this._state.extensionUnification!==this._configurationService.getValue(gOt),onDidChange:U.any(this._onDidChangeExtensionUnificationState.event,this._onDidChangeExtensionUnificationSetting.event)}),this._register(this._extensionEnablementService.onEnablementChanged(u=>{u.some(p=>c.includes(p.identifier.id.toLowerCase()))&&this._update()})),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(gOt)&&(this._update(),this._onDidChangeExtensionUnificationSetting.fire())})),this._register(this._extensionService.onDidChangeExtensions(({added:u})=>{u.some(p=>c.includes(p.identifier.value.toLowerCase()))&&this._update()})),this._register(this._assignmentService.onDidRefetchAssignments(()=>this._update())),this._update()}get state(){return this._state}async _update(){let[e,t,o]=await Promise.all([this._assignmentService.getTreatment(nJo),this._assignmentService.getTreatment(rJo),this._isExtensionUnificationActive()]),n=this._configurationService.getValue(gOt)===o,r=await this._assignmentService.getCurrentExperiments(),s=new fOt(e===!0,t===!0,o,r?.filter(c=>c.startsWith(oJo)||n&&c.startsWith(Ruo))??[]);if(this._state.equals(s))return;let l=this._state;this._state=s,this.isRunningUnificationExperiment.set(this._state.codeUnification||this._state.modelUnification||this._state.extensionUnification),this._onDidStateChange.fire(),l.extensionUnification!==this._state.extensionUnification&&this._onDidChangeExtensionUnificationState.fire()}async _isExtensionUnificationActive(){if(!this._configurationService.getValue(gOt)||!this._completionsExtensionId||!this._chatExtensionId)return!1;let[e,t,o]=await Promise.all([this._extensionService.getExtension(this._completionsExtensionId),this._extensionService.getExtension(this._chatExtensionId),this._extensionManagementService.getInstalled(1)]);if(!t||e)return!1;let n=o.filter(s=>s.identifier.id.toLowerCase()===this._completionsExtensionId);if(n.length===0)return!0;let r=n.some(s=>this._extensionEnablementService.getEnablementState(s)===9);return!!t&&r}};XJe=I([m(0,wN),m(1,X),m(2,B),m(3,As),m(4,xs),m(5,lt),m(6,Ze)],XJe);var fOt=class{constructor(i,e,t,o){this.codeUnification=i;this.modelUnification=e;this.extensionUnification=t;this.expAssignments=o}equals(i){return this.codeUnification===i.codeUnification&&this.modelUnification===i.modelUnification&&this.extensionUnification===i.extensionUnification&&eo(this.expAssignments,i.expAssignments)}};Ce(nwi,XJe,1);var hu=class extends k{constructor(e,t,o,n,r,s,l){super();this._languageService=t;this._languageConfigurationService=o;this._languageFeaturesService=n;this._uriIdentService=r;this._instantiationService=s;this._inlineCompletionsUnificationService=l;this._registrations=this._register(new Ot);this._pasteEditProviders=new Map;this._documentOnDropEditProviders=new Map;if(this._proxy=e.getProxy(ao.ExtHostLanguageFeatures),this._languageService){let c=()=>{let u=[];for(let p of t.getRegisteredLanguageIds()){let h=this._languageConfigurationService.getLanguageConfiguration(p).getWordDefinition();u.push({languageId:p,regexSource:h.source,regexFlags:h.flags})}this._proxy.$setWordDefinitions(u)};this._register(this._languageConfigurationService.onDidChange(u=>{if(!u.languageId)c();else{let p=this._languageConfigurationService.getLanguageConfiguration(u.languageId).getWordDefinition();this._proxy.$setWordDefinitions([{languageId:u.languageId,regexSource:p.source,regexFlags:p.flags}])}})),c()}this._inlineCompletionsUnificationService&&(this._register(this._inlineCompletionsUnificationService.onDidStateChange(()=>{this._proxy.$acceptInlineCompletionsUnificationState(this._inlineCompletionsUnificationService.state)})),this._proxy.$acceptInlineCompletionsUnificationState(this._inlineCompletionsUnificationService.state))}$unregister(e){this._registrations.deleteAndDispose(e)}static _reviveLocationDto(e){return e&&(Array.isArray(e)?(e.forEach(t=>hu._reviveLocationDto(t)),e):(e.uri=A.revive(e.uri),e))}static _reviveLocationLinkDto(e){return e&&(Array.isArray(e)?(e.forEach(t=>hu._reviveLocationLinkDto(t)),e):(e.uri=A.revive(e.uri),e))}static _reviveWorkspaceSymbolDto(e){return e&&(Array.isArray(e)?(e.forEach(hu._reviveWorkspaceSymbolDto),e):(e.location=hu._reviveLocationDto(e.location),e))}static _reviveCodeActionDto(e,t){return e?.forEach(o=>yH(o.edit,t)),e}static _reviveLinkDTO(e){return e.url&&typeof e.url!="string"&&(e.url=A.revive(e.url)),e}static _reviveCallHierarchyItemDto(e){return e&&(e.uri=A.revive(e.uri)),e}static _reviveTypeHierarchyItemDto(e){return e&&(e.uri=A.revive(e.uri)),e}$registerDocumentSymbolProvider(e,t,o){this._registrations.set(e,this._languageFeaturesService.documentSymbolProvider.register(t,{displayName:o,provideDocumentSymbols:(n,r)=>this._proxy.$provideDocumentSymbols(e,n.uri,r)}))}$registerCodeLensSupport(e,t,o){let n={provideCodeLenses:async(r,s)=>{let l=await this._proxy.$provideCodeLenses(e,r.uri,s);if(l)return{lenses:l.lenses,dispose:()=>l.cacheId&&this._proxy.$releaseCodeLenses(e,l.cacheId)}},resolveCodeLens:async(r,s,l)=>{let c=await this._proxy.$resolveCodeLens(e,s,l);if(!(!c||l.isCancellationRequested))return{...c,range:r.validateRange(c.range)}}};if(typeof o=="number"){let r=new T;this._registrations.set(o,r),n.onDidChange=r.event}this._registrations.set(e,this._languageFeaturesService.codeLensProvider.register(t,n))}$emitCodeLensEvent(e,t){let o=this._registrations.get(e);o instanceof T&&o.fire(t)}$registerDefinitionSupport(e,t){this._registrations.set(e,this._languageFeaturesService.definitionProvider.register(t,{provideDefinition:(o,n,r)=>this._proxy.$provideDefinition(e,o.uri,n,r).then(hu._reviveLocationLinkDto)}))}$registerDeclarationSupport(e,t){this._registrations.set(e,this._languageFeaturesService.declarationProvider.register(t,{provideDeclaration:(o,n,r)=>this._proxy.$provideDeclaration(e,o.uri,n,r).then(hu._reviveLocationLinkDto)}))}$registerImplementationSupport(e,t){this._registrations.set(e,this._languageFeaturesService.implementationProvider.register(t,{provideImplementation:(o,n,r)=>this._proxy.$provideImplementation(e,o.uri,n,r).then(hu._reviveLocationLinkDto)}))}$registerTypeDefinitionSupport(e,t){this._registrations.set(e,this._languageFeaturesService.typeDefinitionProvider.register(t,{provideTypeDefinition:(o,n,r)=>this._proxy.$provideTypeDefinition(e,o.uri,n,r).then(hu._reviveLocationLinkDto)}))}$registerHoverProvider(e,t){this._registrations.set(e,this._languageFeaturesService.hoverProvider.register(t,{provideHover:async(o,n,r,s)=>{let l={verbosityRequest:s?.verbosityRequest?{verbosityDelta:s.verbosityRequest.verbosityDelta,previousHover:{id:s.verbosityRequest.previousHover.id}}:void 0};return await this._proxy.$provideHover(e,o.uri,n,l,r)}}))}$registerEvaluatableExpressionProvider(e,t){this._registrations.set(e,this._languageFeaturesService.evaluatableExpressionProvider.register(t,{provideEvaluatableExpression:(o,n,r)=>this._proxy.$provideEvaluatableExpression(e,o.uri,n,r)}))}$registerInlineValuesProvider(e,t,o){let n={provideInlineValues:(r,s,l,c)=>this._proxy.$provideInlineValues(e,r.uri,s,l,c)};if(typeof o=="number"){let r=new T;this._registrations.set(o,r),n.onDidChangeInlineValues=r.event}this._registrations.set(e,this._languageFeaturesService.inlineValuesProvider.register(t,n))}$emitInlineValuesEvent(e,t){let o=this._registrations.get(e);o instanceof T&&o.fire(t)}$registerDocumentHighlightProvider(e,t){this._registrations.set(e,this._languageFeaturesService.documentHighlightProvider.register(t,{provideDocumentHighlights:(o,n,r)=>this._proxy.$provideDocumentHighlights(e,o.uri,n,r)}))}$registerMultiDocumentHighlightProvider(e,t){this._registrations.set(e,this._languageFeaturesService.multiDocumentHighlightProvider.register(t,{selector:t,provideMultiDocumentHighlights:(o,n,r,s)=>this._proxy.$provideMultiDocumentHighlights(e,o.uri,n,r.map(l=>l.uri),s).then(l=>{if(l==null)return;let c=new dt;return l?.forEach(u=>{let p=A.revive(u.uri);c.has(p)?c.get(p).push(...u.highlights):c.set(p,u.highlights)}),c})}))}$registerLinkedEditingRangeProvider(e,t){this._registrations.set(e,this._languageFeaturesService.linkedEditingRangeProvider.register(t,{provideLinkedEditingRanges:async(o,n,r)=>{let s=await this._proxy.$provideLinkedEditingRanges(e,o.uri,n,r);if(s)return{ranges:s.ranges,wordPattern:s.wordPattern?hu._reviveRegExp(s.wordPattern):void 0}}}))}$registerReferenceSupport(e,t){this._registrations.set(e,this._languageFeaturesService.referenceProvider.register(t,{provideReferences:(o,n,r,s)=>this._proxy.$provideReferences(e,o.uri,n,r,s).then(hu._reviveLocationDto)}))}$registerCodeActionSupport(e,t,o,n,r,s){let l={provideCodeActions:async(c,u,p,h)=>{let g=await this._proxy.$provideCodeActions(e,c.uri,u,p,h);if(g)return{actions:hu._reviveCodeActionDto(g.actions,this._uriIdentService),dispose:()=>{typeof g.cacheId=="number"&&this._proxy.$releaseCodeActions(e,g.cacheId)}}},providedCodeActionKinds:o.providedKinds,documentation:o.documentation,displayName:n,extensionId:r};s&&(l.resolveCodeAction=async(c,u)=>{let p=await this._proxy.$resolveCodeAction(e,c.cacheId,u);return p.edit&&(c.edit=yH(p.edit,this._uriIdentService)),p.command&&(c.command=p.command),c}),this._registrations.set(e,this._languageFeaturesService.codeActionProvider.register(t,l))}$registerPasteEditProvider(e,t,o){let n=new JJe(e,this._proxy,o,this._uriIdentService);this._pasteEditProviders.set(e,n),this._registrations.set(e,Fn(this._languageFeaturesService.documentPasteEditProvider.register(t,n),ee(()=>this._pasteEditProviders.delete(e))))}$resolvePasteFileData(e,t,o){let n=this._pasteEditProviders.get(e);if(!n)throw new Error("Could not find provider");return n.resolveFileData(t,o)}$registerDocumentFormattingSupport(e,t,o,n){this._registrations.set(e,this._languageFeaturesService.documentFormattingEditProvider.register(t,{extensionId:o,displayName:n,provideDocumentFormattingEdits:(r,s,l)=>this._proxy.$provideDocumentFormattingEdits(e,r.uri,s,l)}))}$registerRangeFormattingSupport(e,t,o,n,r){this._registrations.set(e,this._languageFeaturesService.documentRangeFormattingEditProvider.register(t,{extensionId:o,displayName:n,provideDocumentRangeFormattingEdits:(s,l,c,u)=>this._proxy.$provideDocumentRangeFormattingEdits(e,s.uri,l,c,u),provideDocumentRangesFormattingEdits:r?(s,l,c,u)=>this._proxy.$provideDocumentRangesFormattingEdits(e,s.uri,l,c,u):void 0}))}$registerOnTypeFormattingSupport(e,t,o,n){this._registrations.set(e,this._languageFeaturesService.onTypeFormattingEditProvider.register(t,{extensionId:n,autoFormatTriggerCharacters:o,provideOnTypeFormattingEdits:(r,s,l,c,u)=>this._proxy.$provideOnTypeFormattingEdits(e,r.uri,s,l,c,u)}))}$registerNavigateTypeSupport(e,t){let o,n={provideWorkspaceSymbols:async(r,s)=>{let l=await this._proxy.$provideWorkspaceSymbols(e,r,s);return o!==void 0&&this._proxy.$releaseWorkspaceSymbols(e,o),o=l.cacheId,hu._reviveWorkspaceSymbolDto(l.symbols)}};t&&(n.resolveWorkspaceSymbol=async(r,s)=>{let l=await this._proxy.$resolveWorkspaceSymbol(e,r,s);return l&&hu._reviveWorkspaceSymbolDto(l)}),this._registrations.set(e,dOt.register(n))}$registerRenameSupport(e,t,o){this._registrations.set(e,this._languageFeaturesService.renameProvider.register(t,{provideRenameEdits:(n,r,s,l)=>this._proxy.$provideRenameEdits(e,n.uri,r,s,l).then(c=>yH(c,this._uriIdentService)),resolveRenameLocation:o?(n,r,s)=>this._proxy.$resolveRenameLocation(e,n.uri,r,s):void 0}))}$registerNewSymbolNamesProvider(e,t){this._registrations.set(e,this._languageFeaturesService.newSymbolNamesProvider.register(t,{supportsAutomaticNewSymbolNamesTriggerKind:this._proxy.$supportsAutomaticNewSymbolNamesTriggerKind(e),provideNewSymbolNames:(o,n,r,s)=>this._proxy.$provideNewSymbolNames(e,o.uri,n,r,s)}))}$registerDocumentSemanticTokensProvider(e,t,o,n){let r;if(typeof n=="number"){let s=new T;this._registrations.set(n,s),r=s.event}this._registrations.set(e,this._languageFeaturesService.documentSemanticTokensProvider.register(t,new rwi(this._proxy,e,o,r)))}$emitDocumentSemanticTokensEvent(e){let t=this._registrations.get(e);t instanceof T&&t.fire(void 0)}$emitDocumentRangeSemanticTokensEvent(e){let t=this._registrations.get(e);t instanceof T&&t.fire(void 0)}$registerDocumentRangeSemanticTokensProvider(e,t,o,n){let r;if(typeof n=="number"){let s=new T;this._registrations.set(n,s),r=s.event}this._registrations.set(e,this._languageFeaturesService.documentRangeSemanticTokensProvider.register(t,new swi(this._proxy,e,o,r)))}static _inflateSuggestDto(e,t,o){let n=t.a,r=t.o,s=t.n,l=t.k,c;return r&&(c={$ident:s,id:r,title:"",arguments:s?[s]:t.p}),{label:n,extensionId:o,kind:t.b??9,tags:t.m,detail:t.c,documentation:t.d,sortText:t.e,filterText:t.f,preselect:t.g,insertText:t.h??(typeof n=="string"?n:n.label),range:t.j??e,insertTextRules:t.i,commitCharacters:l?Array.from(l):void 0,additionalTextEdits:t.l,command:c,_id:t.x}}$registerCompletionsProvider(e,t,o,n,r){let s={triggerCharacters:o,_debugDisplayName:`${r.value}(${o.join("")})`,provideCompletionItems:async(l,c,u,p)=>{let h=await this._proxy.$provideCompletionItems(e,l.uri,c,u,p);return h&&{suggestions:h.b.map(g=>hu._inflateSuggestDto(h.a,g,r)),incomplete:h.c||!1,duration:h.d,dispose:()=>{typeof h.x=="number"&&this._proxy.$releaseCompletionItems(e,h.x)}}}};n&&(s.resolveCompletionItem=(l,c)=>this._proxy.$resolveCompletionItem(e,l._id,c).then(u=>{if(!u)return l;let p=hu._inflateSuggestDto(l.range,u,r);return Cp(l,p,!0)})),this._registrations.set(e,this._languageFeaturesService.completionProvider.register(t,s))}$registerInlineCompletionsSupport(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=new zz(n,r,s),x=this._instantiationService.createInstance(_ee,e,s??n,w,l,p,u,c,f,o,g,h,v,S,b,y,t,this._proxy);this._registrations.set(e,x)}$emitInlineCompletionsChange(e,t){let o=this._registrations.get(e);o instanceof _ee&&o._emitDidChange(t)}$emitInlineCompletionModelInfoChange(e,t){let o=this._registrations.get(e);o instanceof _ee&&o._setModelInfo(t)}$emitInlineCompletionProviderOptionsChange(e,t){let o=this._registrations.get(e);o instanceof _ee&&o._setProviderOptions(t)}$registerSignatureHelpProvider(e,t,o){this._registrations.set(e,this._languageFeaturesService.signatureHelpProvider.register(t,{signatureHelpTriggerCharacters:o.triggerCharacters,signatureHelpRetriggerCharacters:o.retriggerCharacters,provideSignatureHelp:async(n,r,s,l)=>{let c=await this._proxy.$provideSignatureHelp(e,n.uri,r,l,s);if(c)return{value:c,dispose:()=>{this._proxy.$releaseSignatureHelp(e,c.id)}}}}))}$registerInlayHintsProvider(e,t,o,n,r){let s={displayName:r,provideInlayHints:async(l,c,u)=>{let p=await this._proxy.$provideInlayHints(e,l.uri,c,u);if(p)return{hints:er(p.hints),dispose:()=>{p.cacheId&&this._proxy.$releaseInlayHints(e,p.cacheId)}}}};if(o&&(s.resolveInlayHint=async(l,c)=>{let u=l;if(!u.cacheId)return l;let p=await this._proxy.$resolveInlayHint(e,u.cacheId,c);if(c.isCancellationRequested)throw new qi;return p?{...l,tooltip:p.tooltip,label:er(p.label),textEdits:p.textEdits}:l}),typeof n=="number"){let l=new T;this._registrations.set(n,l),s.onDidChangeInlayHints=l.event}this._registrations.set(e,this._languageFeaturesService.inlayHintsProvider.register(t,s))}$emitInlayHintsEvent(e){let t=this._registrations.get(e);t instanceof T&&t.fire(void 0)}$registerDocumentLinkProvider(e,t,o){let n={provideLinks:(r,s)=>this._proxy.$provideDocumentLinks(e,r.uri,s).then(l=>{if(l)return{links:l.links.map(hu._reviveLinkDTO),dispose:()=>{typeof l.cacheId=="number"&&this._proxy.$releaseDocumentLinks(e,l.cacheId)}}})};o&&(n.resolveLink=(r,s)=>{let l=r;return l.cacheId?this._proxy.$resolveDocumentLink(e,l.cacheId,s).then(c=>c&&hu._reviveLinkDTO(c)):r}),this._registrations.set(e,this._languageFeaturesService.linkProvider.register(t,n))}$registerDocumentColorProvider(e,t){let o=this._proxy;this._registrations.set(e,this._languageFeaturesService.colorProvider.register(t,{provideDocumentColors:(n,r)=>o.$provideDocumentColors(e,n.uri,r).then(s=>s.map(l=>{let[c,u,p,h]=l.color;return{color:{red:c,green:u,blue:p,alpha:h},range:l.range}})),provideColorPresentations:(n,r,s)=>o.$provideColorPresentations(e,n.uri,{color:[r.color.red,r.color.green,r.color.blue,r.color.alpha],range:r.range},s)}))}$registerFoldingRangeProvider(e,t,o,n){let r={id:o.value,provideFoldingRanges:(s,l,c)=>this._proxy.$provideFoldingRanges(e,s.uri,l,c)};if(typeof n=="number"){let s=new T;this._registrations.set(n,s),r.onDidChange=s.event}this._registrations.set(e,this._languageFeaturesService.foldingRangeProvider.register(t,r))}$emitFoldingRangeEvent(e,t){let o=this._registrations.get(e);o instanceof T&&o.fire(t)}$registerSelectionRangeProvider(e,t){this._registrations.set(e,this._languageFeaturesService.selectionRangeProvider.register(t,{provideSelectionRanges:(o,n,r)=>this._proxy.$provideSelectionRanges(e,o.uri,n,r)}))}$registerCallHierarchyProvider(e,t){this._registrations.set(e,Sme.register(t,{prepareCallHierarchy:async(o,n,r)=>{let s=await this._proxy.$prepareCallHierarchy(e,o.uri,n,r);if(!(!s||s.length===0))return{dispose:()=>{for(let l of s)this._proxy.$releaseCallHierarchy(e,l._sessionId)},roots:s.map(hu._reviveCallHierarchyItemDto)}},provideOutgoingCalls:async(o,n)=>{let r=await this._proxy.$provideCallHierarchyOutgoingCalls(e,o._sessionId,o._itemId,n);return r&&(r.forEach(s=>{s.to=hu._reviveCallHierarchyItemDto(s.to)}),r)},provideIncomingCalls:async(o,n)=>{let r=await this._proxy.$provideCallHierarchyIncomingCalls(e,o._sessionId,o._itemId,n);return r&&(r.forEach(s=>{s.from=hu._reviveCallHierarchyItemDto(s.from)}),r)}}))}static _reviveRegExp(e){return new RegExp(e.pattern,e.flags)}static _reviveIndentationRule(e){return{decreaseIndentPattern:hu._reviveRegExp(e.decreaseIndentPattern),increaseIndentPattern:hu._reviveRegExp(e.increaseIndentPattern),indentNextLinePattern:e.indentNextLinePattern?hu._reviveRegExp(e.indentNextLinePattern):void 0,unIndentedLinePattern:e.unIndentedLinePattern?hu._reviveRegExp(e.unIndentedLinePattern):void 0}}static _reviveOnEnterRule(e){return{beforeText:hu._reviveRegExp(e.beforeText),afterText:e.afterText?hu._reviveRegExp(e.afterText):void 0,previousLineText:e.previousLineText?hu._reviveRegExp(e.previousLineText):void 0,action:e.action}}static _reviveOnEnterRules(e){return e.map(hu._reviveOnEnterRule)}$setLanguageConfiguration(e,t,o){let n={comments:o.comments,brackets:o.brackets,wordPattern:o.wordPattern?hu._reviveRegExp(o.wordPattern):void 0,indentationRules:o.indentationRules?hu._reviveIndentationRule(o.indentationRules):void 0,onEnterRules:o.onEnterRules?hu._reviveOnEnterRules(o.onEnterRules):void 0,autoClosingPairs:void 0,surroundingPairs:void 0,__electricCharacterSupport:void 0};o.autoClosingPairs?n.autoClosingPairs=o.autoClosingPairs:o.__characterPairSupport&&(n.autoClosingPairs=o.__characterPairSupport.autoClosingPairs),o.__electricCharacterSupport&&o.__electricCharacterSupport.docComment&&(n.__electricCharacterSupport={docComment:{open:o.__electricCharacterSupport.docComment.open,close:o.__electricCharacterSupport.docComment.close}}),this._languageService.isRegisteredLanguageId(t)&&this._registrations.set(e,this._languageConfigurationService.register(t,n,100))}$registerTypeHierarchyProvider(e,t){this._registrations.set(e,yme.register(t,{prepareTypeHierarchy:async(o,n,r)=>{let s=await this._proxy.$prepareTypeHierarchy(e,o.uri,n,r);if(s)return{dispose:()=>{for(let l of s)this._proxy.$releaseTypeHierarchy(e,l._sessionId)},roots:s.map(hu._reviveTypeHierarchyItemDto)}},provideSupertypes:async(o,n)=>{let r=await this._proxy.$provideTypeHierarchySupertypes(e,o._sessionId,o._itemId,n);return r&&r.map(hu._reviveTypeHierarchyItemDto)},provideSubtypes:async(o,n)=>{let r=await this._proxy.$provideTypeHierarchySubtypes(e,o._sessionId,o._itemId,n);return r&&r.map(hu._reviveTypeHierarchyItemDto)}}))}$registerDocumentOnDropEditProvider(e,t,o){let n=new ZJe(e,this._proxy,o,this._uriIdentService);this._documentOnDropEditProviders.set(e,n),this._registrations.set(e,Fn(this._languageFeaturesService.documentDropEditProvider.register(t,n),ee(()=>this._documentOnDropEditProviders.delete(e))))}async $resolveDocumentOnDropFileData(e,t,o){let n=this._documentOnDropEditProviders.get(e);if(!n)throw new Error("Could not find provider");return n.resolveDocumentOnDropFileData(t,o)}};hu=I([fo(Xi.MainThreadLanguageFeatures),m(1,Rt),m(2,Us),m(3,Jt),m(4,gt),m(5,F),m(6,nwi)],hu);var JJe=class{constructor(i,e,t,o){this._handle=i;this._proxy=e;this._uriIdentService=o;this.dataTransfers=new vme;this.copyMimeTypes=t.copyMimeTypes??[],this.pasteMimeTypes=t.pasteMimeTypes??[],this.providedPasteEditKinds=t.providedPasteEditKinds?.map(n=>new Rs(n))??[],t.supportsCopy&&(this.prepareDocumentPaste=async(n,r,s,l)=>{let c=await fme.fromList(s);if(l.isCancellationRequested)return;let u=await this._proxy.$prepareDocumentPaste(i,n.uri,r,c,l);if(!u)return;let p=new Wk;for(let[h,g]of u.items)p.replace(h,MF(g.asString,g.id));return p}),t.supportsPaste&&(this.provideDocumentPasteEdits=async(n,r,s,l,c)=>{let u=this.dataTransfers.add(s);try{let p=await fme.fromList(s);if(c.isCancellationRequested)return;let h=await this._proxy.$providePasteEdits(this._handle,u.id,n.uri,r,p,{only:l.only?.value,triggerKind:l.triggerKind},c);return h?{edits:h.map(g=>({...g,kind:g.kind?new Rs(g.kind.value):new Rs(""),yieldTo:g.yieldTo?.map(f=>({kind:new Rs(f)})),additionalEdit:g.additionalEdit?yH(g.additionalEdit,this._uriIdentService,f=>this.resolveFileData(u.id,f)):void 0})),dispose:()=>{this._proxy.$releasePasteEdits(this._handle,u.id)}}:void 0}finally{u.dispose()}}),t.supportsResolve&&(this.resolveDocumentPasteEdit=async(n,r)=>{let s=await this._proxy.$resolvePasteEdit(this._handle,n._cacheId,r);return typeof s.insertText<"u"&&(n.insertText=s.insertText),s.additionalEdit&&(n.additionalEdit=yH(s.additionalEdit,this._uriIdentService)),n})}resolveFileData(i,e){return this.dataTransfers.resolveFileData(i,e)}};JJe=I([m(3,gt)],JJe);var ZJe=class{constructor(i,e,t,o){this._handle=i;this._proxy=e;this._uriIdentService=o;this.dataTransfers=new vme;this.dropMimeTypes=t?.dropMimeTypes??["*/*"],this.providedDropEditKinds=t?.providedDropKinds?.map(n=>new Rs(n)),t?.supportsResolve&&(this.resolveDocumentDropEdit=async(n,r)=>{let s=await this._proxy.$resolvePasteEdit(this._handle,n._cacheId,r);return s.additionalEdit&&(n.additionalEdit=yH(s.additionalEdit,this._uriIdentService)),n})}async provideDocumentDropEdits(i,e,t,o){let n=this.dataTransfers.add(t);try{let r=await fme.fromList(t);if(o.isCancellationRequested)return;let s=await this._proxy.$provideDocumentOnDropEdits(this._handle,n.id,i.uri,e,r,o);return s?{edits:s.map(l=>({...l,yieldTo:l.yieldTo?.map(c=>({kind:new Rs(c)})),kind:l.kind?new Rs(l.kind):void 0,additionalEdit:yH(l.additionalEdit,this._uriIdentService,c=>this.resolveDocumentOnDropFileData(n.id,c))})),dispose:()=>{this._proxy.$releaseDocumentOnDropEdits(this._handle,n.id)}}:void 0}finally{n.dispose()}}resolveDocumentOnDropFileData(i,e){return this.dataTransfers.resolveFileData(i,e)}};ZJe=I([m(3,gt)],ZJe);var rwi=class{constructor(i,e,t,o){this._proxy=i;this._handle=e;this._legend=t;this.onDidChange=o}releaseDocumentSemanticTokens(i){i&&this._proxy.$releaseDocumentSemanticTokens(this._handle,parseInt(i,10))}getLegend(){return this._legend}async provideDocumentSemanticTokens(i,e,t){let o=e?parseInt(e,10):0,n=await this._proxy.$provideDocumentSemanticTokens(this._handle,i.uri,o,t);if(!n||t.isCancellationRequested)return null;let r=Gfi(n);return r.type==="full"?{resultId:String(r.id),data:r.data}:{resultId:String(r.id),edits:r.deltas}}},swi=class{constructor(i,e,t,o){this._proxy=i;this._handle=e;this._legend=t;this.onDidChange=o}getLegend(){return this._legend}async provideDocumentRangeSemanticTokens(i,e,t){let o=await this._proxy.$provideDocumentRangeSemanticTokens(this._handle,i.uri,e,t);if(!o||t.isCancellationRequested)return null;let n=Gfi(o);if(n.type==="full")return{resultId:String(n.id),data:n.data};throw new Error("Unexpected")}},_ee=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E){super();this.handle=e;this.groupId=t;this.providerId=o;this.yieldsToGroupIds=n;this.excludesGroupIds=r;this.debounceDelayMs=s;this.displayName=l;this.modelInfo=c;this._supportsHandleEvents=u;this._supportsSetModelId=p;this._supportsOnDidChange=h;this._supportsOnDidChangeModelInfo=g;this.providerOptions=f;this._supportsSetProviderOption=v;this._supportsOnDidChangeProviderOptions=b;this._selector=S;this._proxy=y;this._languageFeaturesService=w;this._aiEditTelemetryService=x;this._instantiationService=E;this._onDidChangeEmitter=this._register(new T);this._onDidChangeModelInfoEmitter=this._register(new T);this._onDidProviderOptionsChangeEmitter=this._register(new T);this.setModelId=this._supportsSetModelId?async M=>{await this._proxy.$handleInlineCompletionSetCurrentModelId(this.handle,M)}:void 0,this.setProviderOption=this._supportsSetProviderOption?async(M,N)=>{await this._proxy.$handleInlineCompletionSetProviderOption(this.handle,M,N)}:void 0,this.onDidChangeInlineCompletions=this._supportsOnDidChange?this._onDidChangeEmitter.event:void 0,this.onDidChangeModelInfo=this._supportsOnDidChangeModelInfo?this._onDidChangeModelInfoEmitter.event:void 0,this.onDidProviderOptionsChange=this._supportsOnDidChangeProviderOptions?this._onDidProviderOptionsChangeEmitter.event:void 0,this._register(this._languageFeaturesService.inlineCompletionsProvider.register(this._selector,this))}_setModelInfo(e){this.modelInfo=e,this._supportsOnDidChangeModelInfo&&this._onDidChangeModelInfoEmitter.fire()}_setProviderOptions(e){this.providerOptions=e,this._supportsOnDidChangeProviderOptions&&this._onDidProviderOptionsChangeEmitter.fire()}_emitDidChange(e){this._supportsOnDidChange&&this._onDidChangeEmitter.fire(e)}async provideInlineCompletions(e,t,o,n){return await this._proxy.$provideInlineCompletions(this.handle,e.uri,t,o,n)}async handleItemDidShow(e,t,o,n){t.suggestionId===void 0&&(t.suggestionId=this._aiEditTelemetryService.createSuggestionId({applyCodeBlockSuggestionId:void 0,feature:"inlineSuggestion",source:this.providerId,languageId:e.languageId,editDeltaInfo:n,modeId:void 0,modelId:void 0,presentation:t.isInlineEdit?"nextEditSuggestion":"inlineCompletion",sourceRequestId:void 0})),this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionDidShow(this.handle,e.pid,t.idx,o)}async handlePartialAccept(e,t,o,n){this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionPartialAccept(this.handle,e.pid,t.idx,o,n)}async handleEndOfLifetime(e,t,o,n){function r(c,u){return c.kind===2?{...c,supersededBy:c.supersededBy?u(c.supersededBy):void 0}:c}this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionEndOfLifetime(this.handle,e.pid,t.idx,r(o,c=>({pid:e.pid,idx:c.idx}))),o.kind===0?t.suggestionId!==void 0&&this._aiEditTelemetryService.handleCodeAccepted({suggestionId:t.suggestionId,feature:"inlineSuggestion",source:this.providerId,languageId:e.languageId,editDeltaInfo:Uy.tryCreate(n.lineCountModified,n.lineCountOriginal,n.characterCountModified,n.characterCountOriginal),modeId:void 0,modelId:void 0,presentation:t.isInlineEdit?"nextEditSuggestion":"inlineCompletion",acceptanceMethod:"accept",applyCodeBlockSuggestionId:void 0,sourceRequestId:void 0}):o.kind===1&&t.suggestionId!==void 0&&this._aiEditTelemetryService.handleCodeRejected({suggestionId:t.suggestionId,feature:"inlineSuggestion",source:this.providerId,languageId:e.languageId,editDeltaInfo:Uy.tryCreate(n.lineCountModified,n.lineCountOriginal,n.characterCountModified,n.characterCountOriginal),modeId:void 0,modelId:void 0,presentation:t.isInlineEdit?"nextEditSuggestion":"inlineCompletion",rejectionMethod:"reject",applyCodeBlockSuggestionId:void 0,sourceRequestId:void 0});let s={opportunityId:n.requestUuid,correlationId:n.correlationId,shown:n.shown,shownDuration:n.shownDuration,shownDurationUncollapsed:n.shownDurationUncollapsed,timeUntilShown:n.timeUntilShown,timeUntilProviderRequest:n.timeUntilProviderRequest,timeUntilProviderResponse:n.timeUntilProviderResponse,editorType:n.editorType,viewKind:n.viewKind,preceeded:n.preceeded,requestReason:n.requestReason,typingInterval:n.typingInterval,typingIntervalCharacterCount:n.typingIntervalCharacterCount,languageId:n.languageId,cursorColumnDistance:n.cursorColumnDistance,cursorLineDistance:n.cursorLineDistance,lineCountOriginal:n.lineCountOriginal,lineCountModified:n.lineCountModified,characterCountOriginal:n.characterCountOriginal,characterCountModified:n.characterCountModified,disjointReplacements:n.disjointReplacements,sameShapeReplacements:n.sameShapeReplacements,selectedSuggestionInfo:n.selectedSuggestionInfo,extensionId:this.providerId.extensionId,extensionVersion:this.providerId.extensionVersion,groupId:aJo(n.correlationId)??this.groupId,skuPlan:n.skuPlan,skuType:n.skuType,performanceMarkers:n.performanceMarkers,availableProviders:n.availableProviders,partiallyAccepted:n.partiallyAccepted,partiallyAcceptedCountSinceOriginal:n.partiallyAcceptedCountSinceOriginal,partiallyAcceptedRatioSinceOriginal:n.partiallyAcceptedRatioSinceOriginal,partiallyAcceptedCharactersSinceOriginal:n.partiallyAcceptedCharactersSinceOriginal,superseded:o.kind===2&&!!o.supersededBy,reason:o.kind===0?"accepted":o.kind===1?"rejected":o.kind===2?"ignored":void 0,acceptedAlternativeAction:o.kind===0&&o.alternativeAction,noSuggestionReason:void 0,notShownReason:n.notShownReason,renameCreated:n.renameCreated,renameDuration:n.renameDuration,renameTimedOut:n.renameTimedOut,renameDroppedOtherEdits:n.renameDroppedOtherEdits,renameDroppedRenameEdits:n.renameDroppedRenameEdits,editKind:n.editKind,longDistanceHintVisible:n.longDistanceHintVisible,longDistanceHintDistance:n.longDistanceHintDistance,...aH(f0(this.providerId.extensionId))},l=this._instantiationService.createInstance(g0);L_t(l,s)}disposeInlineCompletions(e,t){this._proxy.$freeInlineCompletionsList(this.handle,e.pid,t)}async handleRejection(e,t){this._supportsHandleEvents&&await this._proxy.$handleInlineCompletionRejection(this.handle,e.pid,t.idx)}toString(){return`InlineCompletionsProvider(${this.providerId.toString()})`}};_ee=I([m(17,Jt),m(18,XS),m(19,F)],_ee);function aJo(a){if(a)try{let i=JSON.parse(a);return typeof i=="object"&&i!==null&&typeof i.engine=="string"?i.engine:void 0}catch{return}}var $H=le("ILanguageStatusService"),awi=class{constructor(){this._provider=new Yd;this.onDidChange=U.map(this._provider.onDidChange,()=>{})}addStatus(i){return this._provider.register(i.selector,i)}getLanguageStatus(i){return this._provider.ordered(i).sort((e,t)=>{let o=t.severity-e.severity;return o===0&&(o=oc(e.source,t.source)),o===0&&(o=oc(e.id,t.id)),o})}};Ce($H,awi,1);var vOt=class extends k{constructor(e,t,o,n,r){super();this._languageService=t;this._modelService=o;this._resolverService=n;this._languageStatusService=r;this._status=this._register(new Ot);this._proxy=e.getProxy(ao.ExtHostLanguages),this._proxy.$acceptLanguageIds(t.getRegisteredLanguageIds()),this._register(t.onDidChange(s=>{this._proxy.$acceptLanguageIds(t.getRegisteredLanguageIds())}))}async $changeLanguage(e,t){if(!this._languageService.isRegisteredLanguageId(t))return Promise.reject(new Error(`Unknown language id: ${t}`));let o=A.revive(e),n=await this._resolverService.createModelReference(o);try{n.object.textEditorModel.setLanguage(this._languageService.createById(t))}finally{n.dispose()}}async $tokensAtPosition(e,t){let o=A.revive(e),n=this._modelService.getModel(o);if(!n)return;n.tokenization.tokenizeIfCheap(t.lineNumber);let r=n.tokenization.getLineTokens(t.lineNumber),s=r.findTokenIndexAtOffset(t.column-1);return{type:r.getStandardTokenType(s),range:new G(t.lineNumber,1+r.getStartOffset(s),t.lineNumber,1+r.getEndOffset(s))}}$setLanguageStatus(e,t){this._status.set(e,this._languageStatusService.addStatus(t))}$removeLanguageStatus(e){this._status.deleteAndDispose(e)}};vOt=I([fo(Xi.MainThreadLanguages),m(1,Rt),m(2,_t),m(3,Bt),m(4,$H)],vOt);var bOt=class{constructor(i,e){this.loggerService=e;this.disposables=new O;let t=i.getProxy(ao.ExtHostLogLevelServiceShape);this.disposables.add(e.onDidChangeLogLevel(o=>{LY(o)?t.$setLogLevel(o):t.$setLogLevel(o[1],o[0])}))}$log(i,e){let t=this.loggerService.getLogger(A.revive(i));if(!t)throw new Error("Create the logger before logging");for(let[o,n]of e)MY(t,o,n)}async $createLogger(i,e){this.loggerService.createLogger(A.revive(i),e)}async $registerLogger(i){this.loggerService.registerLogger({...i,resource:A.revive(i.resource)})}async $deregisterLogger(i){this.loggerService.deregisterLogger(A.revive(i))}async $setVisibility(i,e){this.loggerService.setVisibility(A.revive(i),e)}$flush(i){let e=this.loggerService.getLogger(A.revive(i));if(!e)throw new Error("Create the logger before flushing");e.flush()}dispose(){this.disposables.dispose()}};bOt=I([fo(Xi.MainThreadLogger),m(1,Ol)],bOt);Ge.registerCommand("_extensionTests.setLogLevel",function(a,i){let e=a.get(Ol),t=a.get(ko);if(t.isExtensionDevelopment&&t.extensionTestsLocationURI){let o=oce(i);o!==void 0&&e.setLogLevel(o)}});Ge.registerCommand("_extensionTests.getLogLevel",function(a){let i=a.get(re);return ux(i.getLevel())});var wme=class{constructor(i,e,t,o,n){this._notificationService=e;this._commandService=t;this._dialogService=o;this.extensionsListener=n.onDidChangeExtensions(r=>{for(let s of r.removed)this._notificationService.removeFilter(s.identifier.value)})}dispose(){this.extensionsListener.dispose()}$showMessage(i,e,t,o){return t.modal?this._showModalMessage(i,e,t.detail,o,t.useCustom):this._showMessage(i,e,o,t)}_showMessage(i,e,t,o){return new Promise(n=>{let r=t.map(p=>li({id:`_extension_message_handle_${p.handle}`,label:p.title,enabled:!0,run:()=>(n(p.handle),Promise.resolve())})),s,l=!1;o.source&&(s={label:o.source.label,id:o.source.identifier.value},l=wme.URGENT_NOTIFICATION_SOURCES.includes(s.id)),s||(s=d(3953,null));let c=[];o.source&&c.push(li({id:o.source.identifier.value,label:d(3954,null),run:()=>this._commandService.executeCommand("_extensions.manage",o.source.identifier.value)}));let u=this._notificationService.notify({severity:i,message:e,actions:{primary:r,secondary:c},source:s,priority:l?3:0,sticky:l});U.once(u.onDidClose)(()=>{n(void 0)})})}async _showModalMessage(i,e,t,o,n){let r=[],s;for(let c of o){let u={label:c.title,run:()=>c.handle};c.isCloseAffordance?s=u:r.push(u)}s||(r.length>0?s={label:d(3952,null),run:()=>{}}:s={label:d(3955,null),run:()=>{}});let{result:l}=await this._dialogService.prompt({type:i,message:e,detail:t,buttons:r,cancelButton:s,custom:n});return l}};wme.URGENT_NOTIFICATION_SOURCES=["vscode.github-authentication","vscode.microsoft-authentication"],wme=I([fo(Xi.MainThreadMessageService),m(1,Ne),m(2,fe),m(3,ct),m(4,lt)],wme);function xRe(a){switch(a){case 100:return"req";case 101:return"cancel";case 102:return"subscribe";case 103:return"unsubscribe"}}function IOt(a){switch(a){case 200:return"init";case 201:return"reply:";case 202:case 203:return"replyErr:";case 204:return"event:"}}function wRe(a){let i=0;for(let e=0;;e+=7){let t=a.read(1);if(i|=(t.buffer[0]&127)<<e,!(t.buffer[0]&128))return i}}var lJo=Dee(0);function CRe(a,i){if(i===0){a.write(lJo);return}let e=0;for(let o=i;o!==0;o=o>>>7)e++;let t=Ke.alloc(e);for(let o=0;i!==0;o++)t.buffer[o]=i&127,i=i>>>7,i>0&&(t.buffer[o]|=128);a.write(t)}var yOt=class{constructor(i){this.buffer=i;this.pos=0}read(i){let e=this.buffer.slice(this.pos,this.pos+i);return this.pos+=e.byteLength,e}},eZe=class{constructor(){this.buffers=[]}get buffer(){return Ke.concat(this.buffers)}write(i){this.buffers.push(i)}};function Dee(a){let i=Ke.alloc(1);return i.writeUInt8(a,0),i}var Cme={Undefined:Dee(0),String:Dee(1),Buffer:Dee(2),VSBuffer:Dee(3),Array:Dee(4),Object:Dee(5),Uint:Dee(6)};function kRe(a,i){if(typeof i>"u")a.write(Cme.Undefined);else if(typeof i=="string"){let e=Ke.fromString(i);a.write(Cme.String),CRe(a,e.byteLength),a.write(e)}else if(Ke.isNativeBuffer(i)){let e=Ke.wrap(i);a.write(Cme.Buffer),CRe(a,e.byteLength),a.write(e)}else if(i instanceof Ke)a.write(Cme.VSBuffer),CRe(a,i.byteLength),a.write(i);else if(Array.isArray(i)){a.write(Cme.Array),CRe(a,i.length);for(let e of i)kRe(a,e)}else if(typeof i=="number"&&(i|0)===i)a.write(Cme.Uint),CRe(a,i);else{let e=Ke.fromString(JSON.stringify(i));a.write(Cme.Object),CRe(a,e.byteLength),a.write(e)}}function tZe(a){switch(a.read(1).readUInt8(0)){case 0:return;case 1:return a.read(wRe(a)).toString();case 2:return a.read(wRe(a)).buffer;case 3:return a.read(wRe(a));case 4:{let e=wRe(a),t=[];for(let o=0;o<e;o++)t.push(tZe(a));return t}case 5:return JSON.parse(a.read(wRe(a)).toString());case 6:return wRe(a)}}var lwi=class{constructor(i,e,t=null,o=1e3){this.protocol=i;this.ctx=e;this.logger=t;this.timeoutDelay=o;this.channels=new Map;this.activeRequests=new Map;this.pendingRequests=new Map;this.protocolListener=this.protocol.onMessage(n=>this.onRawMessage(n)),this.sendResponse({type:200})}registerChannel(i,e){this.channels.set(i,e),setTimeout(()=>this.flushPendingRequests(i),0)}sendResponse(i){switch(i.type){case 200:{let e=this.send([i.type]);this.logger?.logOutgoing(e,0,1,IOt(i.type));return}case 201:case 202:case 204:case 203:{let e=this.send([i.type,i.id],i.data);this.logger?.logOutgoing(e,i.id,1,IOt(i.type),i.data);return}}}send(i,e=void 0){let t=new eZe;return kRe(t,i),kRe(t,e),this.sendBuffer(t.buffer)}sendBuffer(i){try{return this.protocol.send(i),i.byteLength}catch{return 0}}onRawMessage(i){let e=new yOt(i),t=tZe(e),o=tZe(e),n=t[0];switch(n){case 100:return this.logger?.logIncoming(i.byteLength,t[1],1,`${xRe(n)}: ${t[2]}.${t[3]}`,o),this.onPromise({type:n,id:t[1],channelName:t[2],name:t[3],arg:o});case 102:return this.logger?.logIncoming(i.byteLength,t[1],1,`${xRe(n)}: ${t[2]}.${t[3]}`,o),this.onEventListen({type:n,id:t[1],channelName:t[2],name:t[3],arg:o});case 101:return this.logger?.logIncoming(i.byteLength,t[1],1,`${xRe(n)}`),this.disposeActiveRequest({type:n,id:t[1]});case 103:return this.logger?.logIncoming(i.byteLength,t[1],1,`${xRe(n)}`),this.disposeActiveRequest({type:n,id:t[1]})}}onPromise(i){let e=this.channels.get(i.channelName);if(!e){this.collectPendingRequest(i);return}let t=new qe,o;try{o=e.call(this.ctx,i.name,i.arg,t.token)}catch(s){o=Promise.reject(s)}let n=i.id;o.then(s=>{this.sendResponse({id:n,data:s,type:201})},s=>{s instanceof Error?this.sendResponse({id:n,data:{message:s.message,name:s.name,stack:s.stack?s.stack.split(`
`):void 0},type:202}):this.sendResponse({id:n,data:s,type:203})}).finally(()=>{r.dispose(),this.activeRequests.delete(i.id)});let r=ee(()=>t.cancel());this.activeRequests.set(i.id,r)}onEventListen(i){let e=this.channels.get(i.channelName);if(!e){this.collectPendingRequest(i);return}let t=i.id,n=e.listen(this.ctx,i.name,i.arg)(r=>this.sendResponse({id:t,data:r,type:204}));this.activeRequests.set(i.id,n)}disposeActiveRequest(i){let e=this.activeRequests.get(i.id);e&&(e.dispose(),this.activeRequests.delete(i.id))}collectPendingRequest(i){let e=this.pendingRequests.get(i.channelName);e||(e=[],this.pendingRequests.set(i.channelName,e));let t=setTimeout(()=>{console.error(`Unknown channel: ${i.channelName}`),i.type===100&&this.sendResponse({id:i.id,data:{name:"Unknown channel",message:`Channel name '${i.channelName}' timed out after ${this.timeoutDelay}ms`,stack:void 0},type:202})},this.timeoutDelay);e.push({request:i,timeoutTimer:t})}flushPendingRequests(i){let e=this.pendingRequests.get(i);if(e){for(let t of e)switch(clearTimeout(t.timeoutTimer),t.request.type){case 100:this.onPromise(t.request);break;case 102:this.onEventListen(t.request);break}this.pendingRequests.delete(i)}}dispose(){this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),je(this.activeRequests.values()),this.activeRequests.clear()}};var SOt=class{constructor(i,e=null){this.protocol=i;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(t=>this.onBuffer(t)),this.logger=e}getChannel(i){let e=this;return{call(t,o,n){return e.isDisposed?Promise.reject(new qi):e.requestPromise(i,t,o,n)},listen(t,o){return e.isDisposed?U.None:e.requestEvent(i,t,o)}}}requestPromise(i,e,t,o=Ie.None){let n=this.lastRequestId++,s={id:n,type:100,channelName:i,name:e,arg:t};if(o.isCancellationRequested)return Promise.reject(new qi);let l,c;return new Promise((p,h)=>{if(o.isCancellationRequested)return h(new qi);let g=()=>{let b=S=>{switch(S.type){case 201:this.handlers.delete(n),p(S.data);break;case 202:{this.handlers.delete(n);let y=new Error(S.data.message);y.stack=Array.isArray(S.data.stack)?S.data.stack.join(`
`):S.data.stack,y.name=S.data.name,h(y);break}case 203:this.handlers.delete(n),h(S.data);break}};this.handlers.set(n,b),this.sendRequest(s)},f=null;this.state===1?g():(f=Hn(b=>this.whenInitialized()),f.then(()=>{f=null,g()}));let v=()=>{f?(f.cancel(),f=null):this.sendRequest({id:n,type:101}),h(new qi)};l=o.onCancellationRequested(v),c={dispose:bd(()=>{v(),l.dispose()})},this.activeRequests.add(c)}).finally(()=>{l?.dispose(),this.activeRequests.delete(c)})}requestEvent(i,e,t){let o=this.lastRequestId++,r={id:o,type:102,channelName:i,name:e,arg:t},s=null,l=new T({onWillAddFirstListener:()=>{let u=()=>{this.activeRequests.add(l),this.sendRequest(r)};this.state===1?u():(s=Hn(p=>this.whenInitialized()),s.then(()=>{s=null,u()}))},onDidRemoveLastListener:()=>{s?(s.cancel(),s=null):(this.activeRequests.delete(l),this.sendRequest({id:o,type:103})),this.handlers.delete(o)}}),c=u=>l.fire(u.data);return this.handlers.set(o,c),l.event}sendRequest(i){switch(i.type){case 100:case 102:{let e=this.send([i.type,i.id,i.channelName,i.name],i.arg);this.logger?.logOutgoing(e,i.id,0,`${xRe(i.type)}: ${i.channelName}.${i.name}`,i.arg);return}case 101:case 103:{let e=this.send([i.type,i.id]);this.logger?.logOutgoing(e,i.id,0,xRe(i.type));return}}}send(i,e=void 0){let t=new eZe;return kRe(t,i),kRe(t,e),this.sendBuffer(t.buffer)}sendBuffer(i){try{return this.protocol.send(i),i.byteLength}catch{return 0}}onBuffer(i){let e=new yOt(i),t=tZe(e),o=tZe(e),n=t[0];switch(n){case 200:return this.logger?.logIncoming(i.byteLength,0,0,IOt(n)),this.onResponse({type:t[0]});case 201:case 202:case 204:case 203:return this.logger?.logIncoming(i.byteLength,t[1],0,IOt(n),o),this.onResponse({type:t[0],id:t[1],data:o})}}onResponse(i){if(i.type===200){this.state=1,this._onDidInitialize.fire();return}this.handlers.get(i.id)?.(i)}get onDidInitializePromise(){return U.toPromise(this.onDidInitialize)}whenInitialized(){return this.state===1?Promise.resolve():this.onDidInitializePromise}dispose(){this.isDisposed=!0,this.protocolListener&&(this.protocolListener.dispose(),this.protocolListener=null),je(this.activeRequests.values()),this.activeRequests.clear(),this._onDidInitialize.dispose()}};I([bi],SOt.prototype,"onDidInitializePromise",1);var Ree=class{constructor(i,e,t=null){let o=new eZe;kRe(o,e),i.send(o.buffer),this.channelClient=new SOt(i,t),this.channelServer=new lwi(i,e,t)}getChannel(i){return this.channelClient.getChannel(i)}registerChannel(i,e){this.channelServer.registerChannel(i,e)}dispose(){this.channelClient.dispose(),this.channelServer.dispose()}};function jH(a){return{call(i,e,t){return a.then(o=>o.call(i,e,t))},listen(i,e){let t=new Ig;return a.then(o=>t.input=o.listen(i,e)),t.event}}}var Xd;(o=>{function a(n,r,s){let l=n,c=s?.disableMarshalling,u=new Map;for(let p in l)e(p)&&u.set(p,U.buffer(l[p],p,!0,void 0,r));return new class{listen(p,h,g){let f=u.get(h);if(f)return f;let v=l[h];if(typeof v=="function"){if(t(h))return v.call(l,g);if(e(h))return u.set(h,U.buffer(l[h],h,!0,void 0,r)),u.get(h)}throw new ka(`Event not found: ${h}`)}call(p,h,g){let f=l[h];if(typeof f=="function"){if(!c&&Array.isArray(g))for(let b=0;b<g.length;b++)g[b]=er(g[b]);let v=f.apply(l,g);return v instanceof Promise||(v=Promise.resolve(v)),v}throw new ka(`Method not found: ${h}`)}}}o.fromService=a;function i(n,r){let s=r?.disableMarshalling;return new Proxy({},{get(l,c){if(typeof c=="string")return r?.properties?.has(c)?r.properties.get(c):t(c)?function(u){return n.listen(c,u)}:e(c)?n.listen(c):async function(...u){let p;r&&!mr(r.context)?p=[r.context,...u]:p=u;let h=await n.call(c,p);return s?h:er(h)};throw new ka(`Property not found: ${String(c)}`)}})}o.toService=i;function e(n){return n[0]==="o"&&n[1]==="n"&&sT(n.charCodeAt(2))}function t(n){return/^onDynamic/.test(n)&&sT(n.charCodeAt(9))}})(Xd||={});var ERe;(r=>{r.enableDiagnostics=!1,r.records=[];let e=new WeakMap,t=0;function o(s,l){if(!e.has(s)){let c=String(++t);e.set(s,c)}return e.get(s)}function n(s,l,c,u){}r.traceSocketEvent=n})(ERe||={});var cwi=null;function Lee(){return cwi||(cwi=Ke.alloc(0)),cwi}var dwi=class{get byteLength(){return this._totalLength}constructor(){this._chunks=[],this._totalLength=0}acceptChunk(i){this._chunks.push(i),this._totalLength+=i.byteLength}read(i){return this._read(i,!0)}peek(i){return this._read(i,!1)}_read(i,e){if(i===0)return Lee();if(i>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===i){let r=this._chunks[0];return e&&(this._chunks.shift(),this._totalLength-=i),r}if(this._chunks[0].byteLength>i){let r=this._chunks[0].slice(0,i);return e&&(this._chunks[0]=this._chunks[0].slice(i),this._totalLength-=i),r}let t=Ke.alloc(i),o=0,n=0;for(;i>0;){let r=this._chunks[n];if(r.byteLength>i){let s=r.slice(0,i);t.set(s,o),o+=i,e&&(this._chunks[n]=r.slice(i),this._totalLength-=i),i-=i}else t.set(r,o),o+=r.byteLength,e?(this._chunks.shift(),this._totalLength-=r.byteLength):n++,i-=r.byteLength}return t}};function Luo(a){switch(a){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 CN=class{constructor(i,e,t,o){this.type=i;this.id=e;this.ack=t;this.data=o;this.writtenTime=0}get size(){return this.data.byteLength}},iZe=class extends k{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 dwi,this._register(this._socket.onData(t=>this.acceptChunk(t))),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 t=this._incomingData.read(this._state.readLen);if(this._state.readHead)this._state.readHead=!1,this._state.readLen=t.readUInt32BE(9),this._state.messageType=t.readUInt8(0),this._state.id=t.readUInt32BE(1),this._state.ack=t.readUInt32BE(5),this._socket.traceSocketEvent("protocolHeaderRead",{messageType:Luo(this._state.messageType),id:this._state.id,ack:this._state.ack,messageSize:this._state.readLen});else{let o=this._state.messageType,n=this._state.id,r=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",t),this._onMessage.fire(new CN(o,n,r,t)),this._isDisposed)break}}}readEntireBuffer(){return this._incomingData.read(this._incomingData.byteLength)}dispose(){this._isDisposed=!0,super.dispose()}},oZe=class{constructor(i){this._writeNowTimeout=null;this._isDisposed=!1,this._isPaused=!1,this._socket=i,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(i){if(this._isDisposed)return;i.writtenTime=Date.now(),this.lastWriteTime=Date.now();let e=Ke.alloc(13);e.writeUInt8(i.type,0),e.writeUInt32BE(i.id,1),e.writeUInt32BE(i.ack,5),e.writeUInt32BE(i.data.byteLength,9),this._socket.traceSocketEvent("protocolHeaderWrite",{messageType:Luo(i.type),id:i.id,ack:i.ack,messageSize:i.data.byteLength}),this._socket.traceSocketEvent("protocolMessageWrite",i.data),this._writeSoon(e,i.data)}_bufferAdd(i,e){let t=this._totalLength===0;return this._data.push(i,e),this._totalLength+=i.byteLength+e.byteLength,t}_bufferTake(){let i=Ke.concat(this._data,this._totalLength);return this._data.length=0,this._totalLength=0,i}_writeSoon(i,e){this._bufferAdd(i,e)&&this._scheduleWriting()}_scheduleWriting(){this._writeNowTimeout||(this._writeNowTimeout=setTimeout(()=>{this._writeNowTimeout=null,this._writeNow()}))}_writeNow(){if(this._totalLength===0||this._isPaused)return;let i=this._bufferTake();this._socket.traceSocketEvent("protocolWrite",{byteLength:i.byteLength}),this._socket.write(i)}},uwi=class extends k{constructor(e){super();this._onMessage=this._register(new T);this.onMessage=this._onMessage.event;this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event;this._socket=e,this._socketWriter=this._register(new oZe(this._socket)),this._socketReader=this._register(new iZe(this._socket)),this._register(this._socketReader.onMessage(t=>{t.type===1&&this._onMessage.fire(t.data)})),this._register(this._socket.onClose(()=>this._onDidDispose.fire()))}drain(){return this._socketWriter.drain()}getSocket(){return this._socket}sendDisconnect(){}send(e){this._socketWriter.write(new CN(1,0,0,e))}},wOt=class a extends Ree{constructor(e,t,o=null){super(e,t,o);this.protocol=e}static fromSocket(e,t){return new a(new uwi(e),t)}get onDidDispose(){return this.protocol.onDidDispose}dispose(){super.dispose();let e=this.protocol.getSocket();this.protocol.sendDisconnect(),this.protocol.dispose(),e.end()}},o8=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(i){this._hasListeners?this._bufferedMessages.length>0?this._bufferedMessages.push(i):this._emitter.fire(i):this._bufferedMessages.push(i)}flushBuffer(){this._bufferedMessages=[]}},pwi=class{constructor(i){this.data=i,this.next=null}},mwi=class{constructor(){this._first=null,this._last=null}length(){let i=0,e=this._first;for(;e;)e=e.next,i++;return i}peek(){return this._first?this._first.data:null}toArray(){let i=[],e=0,t=this._first;for(;t;)i[e++]=t.data,t=t.next;return i}pop(){if(this._first){if(this._first===this._last){this._first=null,this._last=null;return}this._first=this._first.next}}push(i){let e=new pwi(i);if(!this._first){this._first=e,this._last=e;return}this._last.next=e,this._last=e}},nZe=class a{static{this._HISTORY_LENGTH=10}static{this._INSTANCE=null}static getInstance(){return a._INSTANCE||(a._INSTANCE=new a),a._INSTANCE}constructor(){this.lastRuns=[];let i=Date.now();for(let e=0;e<a._HISTORY_LENGTH;e++)this.lastRuns[e]=i-1e3*e;setInterval(()=>{for(let e=a._HISTORY_LENGTH;e>=1;e--)this.lastRuns[e]=this.lastRuns[e-1];this.lastRuns[0]=Date.now()},1e3)}load(){let i=Date.now(),e=(1+a._HISTORY_LENGTH)*1e3,t=0;for(let o=0;o<a._HISTORY_LENGTH;o++)i-this.lastRuns[o]<=e&&t++;return 1-t/a._HISTORY_LENGTH}hasHighLoad(){return this.load()>=.5}},COt=class{constructor(i){this._onControlMessage=new o8;this.onControlMessage=this._onControlMessage.event;this._onMessage=new o8;this.onMessage=this._onMessage.event;this._onDidDispose=new o8;this.onDidDispose=this._onDidDispose.event;this._onSocketClose=new o8;this.onSocketClose=this._onSocketClose.event;this._onSocketTimeout=new o8;this.onSocketTimeout=this._onSocketTimeout.event;this._loadEstimator=i.loadEstimator??nZe.getInstance(),this._shouldSendKeepAlive=i.sendKeepAlive??!0,this._isReconnecting=!1,this._outgoingUnackMsg=new mwi,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 O,this._socket=i.socket,this._socketWriter=this._socketDisposables.add(new oZe(this._socket)),this._socketReader=this._socketDisposables.add(new iZe(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(e=>this._receiveMessage(e))),this._socketDisposables.add(this._socket.onClose(e=>this._onSocketClose.fire(e))),i.initialChunk&&this._socketReader.acceptChunk(i.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 i=new CN(5,0,0,Lee());this._socketWriter.write(i),this._socketWriter.flush()}}sendPause(){let i=new CN(7,0,0,Lee());this._socketWriter.write(i)}sendResume(){let i=new CN(8,0,0,Lee());this._socketWriter.write(i)}pauseSocketWriting(){this._socketWriter.pause()}getSocket(){return this._socket}getMillisSinceLastIncomingData(){return Date.now()-this._socketReader.lastReadTime}beginAcceptReconnection(i,e){this._isReconnecting=!0,this._socketDisposables.dispose(),this._socketDisposables=new O,this._onControlMessage.flushBuffer(),this._onSocketClose.flushBuffer(),this._onSocketTimeout.flushBuffer(),this._socket.dispose(),this._lastReplayRequestTime=0,this._lastSocketTimeoutTime=Date.now(),this._socket=i,this._socketWriter=this._socketDisposables.add(new oZe(this._socket)),this._socketReader=this._socketDisposables.add(new iZe(this._socket)),this._socketDisposables.add(this._socketReader.onMessage(t=>this._receiveMessage(t))),this._socketDisposables.add(this._socket.onClose(t=>this._onSocketClose.fire(t))),this._socketReader.acceptChunk(e)}endAcceptReconnection(){this._isReconnecting=!1,this._incomingAckId=this._incomingMsgId;let i=new CN(3,0,this._incomingAckId,Lee());this._socketWriter.write(i);let e=this._outgoingUnackMsg.toArray();for(let t=0,o=e.length;t<o;t++)this._socketWriter.write(e[t]);this._recvAckCheck()}acceptDisconnect(){this._onDidDispose.fire()}_receiveMessage(i){if(i.ack>this._outgoingAckId){this._outgoingAckId=i.ack;do{let e=this._outgoingUnackMsg.peek();if(e&&e.id<=i.ack)this._outgoingUnackMsg.pop();else break}while(!0)}switch(i.type){case 0:break;case 1:{if(i.id>this._incomingMsgId)if(i.id!==this._incomingMsgId+1){let e=Date.now();e-this._lastReplayRequestTime>1e4&&(this._lastReplayRequestTime=e,this._socketWriter.write(new CN(6,0,0,Lee())))}else this._incomingMsgId=i.id,this._incomingMsgLastTime=Date.now(),this._sendAckCheck(),this._onMessage.fire(i.data);break}case 2:{this._onControlMessage.fire(i.data);break}case 3:break;case 5:{this._onDidDispose.fire();break}case 6:{let e=this._outgoingUnackMsg.toArray();for(let t=0,o=e.length;t<o;t++)this._socketWriter.write(e[t]);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(i){let e=++this._outgoingMsgId;this._incomingAckId=this._incomingMsgId;let t=new CN(1,e,this._incomingAckId,i);this._outgoingUnackMsg.push(t),this._isReconnecting||(this._socketWriter.write(t),this._recvAckCheck())}sendControl(i){let e=new CN(2,0,0,i);this._socketWriter.write(e)}_sendAckCheck(){if(this._incomingMsgId<=this._incomingAckId||this._incomingAckTimeout)return;let i=Date.now()-this._incomingMsgLastTime;if(i>=2e3){this._sendAck();return}this._incomingAckTimeout=setTimeout(()=>{this._incomingAckTimeout=null,this._sendAckCheck()},2e3-i+5)}_recvAckCheck(){if(this._outgoingMsgId<=this._outgoingAckId||this._outgoingAckTimeout||this._isReconnecting)return;let i=this._outgoingUnackMsg.peek(),e=Date.now()-i.writtenTime,t=Date.now()-this._socketReader.lastReadTime,o=Date.now()-this._lastSocketTimeoutTime;if(e>=2e4&&t>=2e4&&o>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=Date.now(),this._onSocketTimeout.fire({reason:"unacknowledgedMessage",unacknowledgedMsgCount:this._outgoingUnackMsg.length(),timeSinceOldestUnacknowledgedMsg:e,timeSinceLastReceivedSomeData:t});return}let n=Math.max(2e4-e,2e4-t,2e4-o,500);this._outgoingAckTimeout=setTimeout(()=>{this._outgoingAckTimeout=null,this._recvAckCheck()},n)}_keepAliveTimeoutCheck(){if(this._isReconnecting)return;let i=Date.now(),e=i-this._socketReader.lastReadTime,t=i-this._lastSocketTimeoutTime;if(e>=2e4&&t>=2e4&&!this._loadEstimator.hasHighLoad()){this._lastSocketTimeoutTime=i;let o=this._outgoingUnackMsg.length(),n=this._outgoingUnackMsg.peek();this._onSocketTimeout.fire({reason:"keepAlive",unacknowledgedMsgCount:o,timeSinceOldestUnacknowledgedMsg:n?i-n.writtenTime:void 0,timeSinceLastReceivedSomeData:e})}}_sendAck(){if(this._incomingMsgId<=this._incomingAckId)return;this._incomingAckId=this._incomingMsgId;let i=new CN(3,0,this._incomingAckId,Lee());this._socketWriter.write(i)}_sendKeepAlive(){this._incomingAckId=this._incomingMsgId;let i=new CN(9,0,this._incomingAckId,Lee());this._socketWriter.write(i),this._keepAliveTimeoutCheck()}};var cJo=(a,i,e)=>{let t=new Uint8Array(16);for(let r=0;r<16;r++)t[r]=Math.round(Math.random()*256);let o=gc(Ke.wrap(t));return[`GET ws://localhost${a}?${i}&skipWebSocketFrames=true HTTP/1.1`,"Connection: Upgrade","Upgrade: websocket",`Sec-WebSocket-Key: ${o}`].join(`\r
`)+`\r
\r
`},Muo=Ke.fromString(`\r
\r
`);async function Puo(a,i,e,t,o){a.write(Ke.fromString(cJo(i,e,t)));let n=new O;try{return await new Promise((r,s)=>{let l;n.add(a.onData(c=>{l?l=Ke.concat([l,c],l.byteLength+c.byteLength):l=c;let u=l.indexOf(Muo);if(u===-1)return;r(a),a.pauseData();let p=l.slice(u+Muo.byteLength);p.byteLength&&o.onData.fire(p)})),n.add(a.onClose(c=>s(c??new Error("socket closed")))),n.add(a.onEnd(()=>s(new Error("socket ended"))))})}catch(r){throw a.dispose(),r}finally{n.dispose()}}var xOt=class extends k{constructor(e,t){super();this.debugLabel=e;this.pausableDataEmitter=this._register(new Ih);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(t.onData),this._register(t.onData.event(o=>this.pausableDataEmitter.fire(o))),this.onClose=this._register(t.onClose).event,this.onEnd=this._register(t.onEnd).event}pauseData(){this.pausableDataEmitter.pause()}drain(){return Promise.resolve()}end(){this.ended=!0,this.closeRemote()}traceSocketEvent(e,t){ERe.traceSocketEvent(this,this.debugLabel,e,t)}dispose(){this.ended||this.closeRemote(),this.didDisposeEmitter.fire(),super.dispose()}};var pG=le("remoteSocketFactoryService"),kOt=class{constructor(){this.factories={}}register(i,e){return this.factories[i]??=[],this.factories[i].push(e),ee(()=>{let t=this.factories[i]?.indexOf(e);typeof t=="number"&&t>=0&&this.factories[i]?.splice(t,1)})}getSocketFactory(i){return(this.factories[i.type]||[]).find(t=>t.supports(i))}connect(i,e,t,o){let n=this.getSocketFactory(i);if(!n)throw new Error(`No socket factory found for ${i}`);return n.connect(i,e,t,o)}};var EOt=class extends k{constructor(e,t){super();this._remoteSocketFactoryService=t;this._registrations=this._register(new Ot);this._remoteSockets=new Map;this._proxy=e.getProxy(ao.ExtHostManagedSockets)}async $registerSocketFactory(e){let t=this,o=new O,n=new class{supports(r){return r.id===e}connect(r,s,l,c){return new Promise((u,p)=>{if(r.id!==e)return p(new Error("Invalid connectTo"));let h=r.id;t._proxy.$openRemoteSocket(h).then(g=>{let f={onClose:new T,onData:new T,onEnd:new T};t._remoteSockets.set(g,f),hwi.connect(g,t._proxy,s,l,c,f).then(v=>{o.add(U.once(v.onDidDispose)(()=>t._remoteSockets.delete(g))),u(v)},v=>{t._remoteSockets.delete(g),p(v)})}).catch(p)})}};o.add(this._remoteSocketFactoryService.register(1,n)),this._registrations.set(e,o)}async $unregisterSocketFactory(e){this._registrations.deleteAndDispose(e)}$onDidManagedSocketHaveData(e,t){this._remoteSockets.get(e)?.onData.fire(t)}$onDidManagedSocketClose(e,t){this._remoteSockets.get(e)?.onClose.fire({type:0,error:t?new Error(t):void 0,hadError:!!t}),this._remoteSockets.delete(e)}$onDidManagedSocketEnd(e){this._remoteSockets.get(e)?.onEnd.fire()}};EOt=I([fo(Xi.MainThreadManagedSockets),m(1,pG)],EOt);var hwi=class a extends xOt{constructor(e,t,o,n){super(o,n);this.socketId=e;this.proxy=t}static connect(e,t,o,n,r,s){let l=new a(e,t,r,s);return Puo(l,o,n,r,s)}write(e){this.proxy.$remoteSocketWrite(this.socketId,e)}closeRemote(){this.proxy.$remoteSocketEnd(this.socketId)}drain(){return this.proxy.$remoteSocketDrain(this.socketId)}};var TOt="text/x-code-output",TRe="Log",Mee="text/x-code-log-output",_Re="log",md="workbench.panel.output",_Ot=new Y("inOutput",!1),Nuo=new Y("activeLogOutput",!1),DOt=new Y("activeLogOutput.isLog",!1),ROt=new Y("activeLogOutput.levelSettable",!1),LOt=new Y("activeLogOutput.level",""),MOt=new Y("activeLogOutput.levelIsDefault",!1),POt=new Y("outputView.scrollLock",!1),AOt=new Y("activeOutputChannel",""),NOt=new Y("output.filter.trace",!0),OOt=new Y("output.filter.debug",!0),FOt=new Y("output.filter.info",!0),WOt=new Y("output.filter.warning",!0),VOt=new Y("output.filter.error",!0),DRe=new Y("outputFilterFocus",!1),BOt=new Y("output.filter.categories",""),Tl=le("outputService");var bb={OutputChannels:"workbench.contributions.outputChannels"};function xN(a){return!!a.source&&!Array.isArray(a.source)}function QH(a){return Array.isArray(a.source)}var gwi=class extends k{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(t=>e.push(t)),e}getChannel(e){return this.channels.get(e)}updateChannelSources(e,t){let o=this.channels.get(e);o&&QH(o)&&(o.source=t,this._onDidUpdateChannelFiles.fire(o))}removeChannel(e){let t=this.channels.get(e);t&&(this.channels.delete(e),this._onDidRemoveChannel.fire(t))}};oe.add(bb.OutputChannels,new gwi);var Gt=le("viewsService");var Pee=class extends k{constructor(e,t,o,n,r){super();this._outputStatusItem=this._register(new ue);this._outputService=t,this._viewsService=o,this._configurationService=n,this._statusbarService=r,this._proxy=e.getProxy(ao.ExtHostOutputService);let s=()=>{let l=this._viewsService.isViewVisible(md)?this._outputService.getActiveChannel():void 0;this._proxy.$setVisibleChannel(l?l.id:null),this._outputStatusItem.value=void 0};this._register(U.any(this._outputService.onActiveOutputChannel,U.filter(this._viewsService.onDidChangeViewVisibility,({id:l})=>l===md))(()=>s())),s()}async $register(e,t,o,n){let r=(Pee._extensionIdPool.get(n)||0)+1;Pee._extensionIdPool.set(n,r);let s=`extension-output-${n}-#${r}-${e}`,l=A.revive(t);return oe.as(bb.OutputChannels).registerChannel({id:s,label:e,source:{resource:l},log:!1,languageId:o,extensionId:n}),this._register(ee(()=>this.$dispose(s))),s}async $update(e,t,o){let n=this._getChannel(e);n&&(t===1?n.update(t):on(o)&&n.update(t,o))}async $reveal(e,t){let o=this._getChannel(e);if(!o)return;let n=this._configurationService.getValue("workbench.view.showQuietly")??{};if(!this._viewsService.isViewVisible(md)&&n[md]){this._showChannelQuietly(o);return}this._outputService.showChannel(o.id,t)}_showChannelQuietly(e){let t={name:d(3957,null),text:"$(output)",ariaLabel:d(3958,null,e.label),command:`workbench.action.output.show.${e.id}`,tooltip:d(3959,null,e.label),kind:"prominent"};this._outputStatusItem.value?this._outputStatusItem.value.update(t):this._outputStatusItem.value=this._statusbarService.addEntry(t,"status.view.showQuietly",1,{location:{id:"status.notifications",priority:Number.NEGATIVE_INFINITY},alignment:0})}async $close(e){if(this._viewsService.isViewVisible(md)){let t=this._outputService.getActiveChannel();t&&e===t.id&&this._viewsService.closeView(md)}}async $dispose(e){this._getChannel(e)?.dispose()}_getChannel(e){return this._outputService.getChannel(e)}};Pee._extensionIdPool=new Map,Pee=I([fo(Xi.MainThreadOutputService),m(1,Tl),m(2,Gt),m(3,B),m(4,Fr)],Pee);var xme=class{constructor(i,e,t){this._commandService=t;this._progress=new Map;this._proxy=i.getProxy(ao.ExtHostProgress),this._progressService=e}dispose(){this._progress.forEach(i=>i.resolve()),this._progress.clear()}async $startProgress(i,e,t){let o=this._createTask(i);if(e.location===15&&t){let n=xme.URGENT_PROGRESS_SOURCES.includes(t);e={...e,priority:n?3:0,location:15,secondaryActions:[li({id:t,label:d(3960,null),run:()=>this._commandService.executeCommand("_extensions.manage",t)})]}}try{this._progressService.withProgress(e,o,()=>this._proxy.$acceptProgressCanceled(i))}catch(n){vs(n)}}$progressReport(i,e){this._progress.get(i)?.progress.report(e)}$progressEnd(i){let e=this._progress.get(i);e&&(e.resolve(),this._progress.delete(i))}_createTask(i){return e=>new Promise(t=>{this._progress.set(i,{resolve:t,progress:e})})}};xme.URGENT_PROGRESS_SOURCES=["vscode.github-authentication","vscode.microsoft-authentication"],xme=I([fo(Xi.MainThreadProgress),m(1,Go),m(2,fe)],xme);var HOt=class{constructor(i,e){this.quickDiffService=e;this.providerDisposables=new Ot;this.proxy=i.getProxy(ao.ExtHostQuickDiff)}async $registerQuickDiffProvider(i,e,t,o,n){let r={id:t,label:o,rootUri:A.revive(n),selector:e,kind:"contributed",getOriginalResource:async l=>A.revive(await this.proxy.$provideOriginalResource(i,l,Ie.None))},s=this.quickDiffService.addQuickDiffProvider(r);this.providerDisposables.set(i,s)}async $unregisterQuickDiffProvider(i){this.providerDisposables.has(i)&&this.providerDisposables.deleteAndDispose(i)}dispose(){this.providerDisposables.dispose()}};HOt=I([fo(Xi.MainThreadQuickDiff),m(1,l_)],HOt);var UOt=class{constructor(i,e){this._editorWorkerService=e}async $computeDocumentDiff(i,e,t,o,n){let r=A.revive(i),s=A.revive(e),l=await this._editorWorkerService.computeDiff(r,s,{ignoreTrimWhitespace:t,maxComputationTimeMs:o,computeMoves:n},"advanced");if(!l)return null;let c=p=>({startLineNumber:p.startLineNumber,startColumn:1,endLineNumber:p.endLineNumberExclusive,endColumn:1}),u=p=>({originalRange:c(p.original),modifiedRange:c(p.modified),innerChanges:p.innerChanges?.map(h=>({originalRange:h.originalRange,modifiedRange:h.modifiedRange}))});return{identical:l.identical,quitEarly:l.quitEarly,changes:l.changes.map(u),moves:l.moves.map(p=>({originalRange:c(p.lineRangeMapping.original),modifiedRange:c(p.lineRangeMapping.modified),changes:p.changes.map(u)}))}}dispose(){}};UOt=I([fo(Xi.MainThreadDocumentDiff),m(1,Qs)],UOt);var zOt=class{constructor(i,e,t,o,n,r){this.labelService=t;this.customEditorLabelService=o;this.modelService=n;this.languageService=r;this._items={};this.sessions=new Map;this._proxy=i.getProxy(ao.ExtHostQuickOpen),this._quickInputService=e}dispose(){for(let[i,e]of this.sessions)e.store.dispose()}$show(i,e,t){let o=new Promise((n,r)=>{this._items[i]={resolve:n,reject:r}});return e={...e,onDidFocus:n=>{n&&this._proxy.$onItemSelected(n.handle)}},e.canPickMany?this._quickInputService.pick(o,e,t).then(n=>{if(n)return n.map(r=>r.handle)}):this._quickInputService.pick(o,e,t).then(n=>{if(n)return n.handle})}$setItems(i,e){return this._items[i]&&(e.forEach(t=>this.expandItemProps(t)),this._items[i].resolve(e),delete this._items[i]),Promise.resolve()}$setError(i,e){return this._items[i]&&(this._items[i].reject(e),delete this._items[i]),Promise.resolve()}$input(i,e,t){let o=Object.create(null);return i&&(o.title=i.title,o.password=i.password,o.placeHolder=i.placeHolder,o.valueSelection=i.valueSelection,o.prompt=i.prompt,o.value=i.value,o.ignoreFocusLost=i.ignoreFocusOut),e&&(o.validateInput=n=>this._proxy.$validateInput(n)),this._quickInputService.input(o,t)}$createOrUpdate(i){let e=i.id,t=this.sessions.get(e);if(!t){let s=new O,l=i.type==="quickPick"?this._quickInputService.createQuickPick():this._quickInputService.createInputBox();if(s.add(l),s.add(l.onDidAccept(()=>{this._proxy.$onDidAccept(e)})),s.add(l.onDidTriggerButton(c=>{this._proxy.$onDidTriggerButton(e,c.handle,c.toggle?.checked)})),s.add(l.onDidChangeValue(c=>{this._proxy.$onDidChangeValue(e,c)})),s.add(l.onDidHide(()=>{this._proxy.$onDidHide(e)})),i.type==="quickPick"){let c=l;s.add(c.onDidChangeActive(u=>{this._proxy.$onDidChangeActive(e,u.map(p=>p.handle))})),s.add(c.onDidChangeSelection(u=>{this._proxy.$onDidChangeSelection(e,u.map(p=>p.handle))})),s.add(c.onDidTriggerItemButton(u=>{let p=u.button;this._proxy.$onDidTriggerItemButton(e,u.item.handle,p.handle,p.toggle?.checked)}))}t={input:l,handlesToItems:new Map,store:s},this.sessions.set(e,t)}let{input:o,handlesToItems:n}=t,r=o;for(let s in i)switch(s){case"id":case"type":continue;case"visible":i.visible?o.show():o.hide();break;case"items":{n.clear(),i.items?.forEach(l=>{this.expandItemProps(l),l.type!=="separator"&&(l.buttons?.forEach(c=>this.expandIconPath(c)),n.set(l.handle,l))}),r.items=i.items;break}case"activeItems":r.activeItems=i.activeItems?.map(l=>n.get(l)).filter(Boolean);break;case"selectedItems":r.selectedItems=i.selectedItems?.map(l=>n.get(l)).filter(Boolean);break;case"buttons":{let l=[];for(let c of i.buttons)c.handle===-1?l.push(this._quickInputService.backButton):(this.expandIconPath(c),l.push(c));o.buttons=l;break}default:o[s]=i[s];break}return Promise.resolve(void 0)}$dispose(i){let e=this.sessions.get(i);return e&&(e.store.dispose(),this.sessions.delete(i)),Promise.resolve(void 0)}expandItemProps(i){if(i.type==="separator")return;if(!i.resourceUri){this.expandIconPath(i);return}let e=A.from(i.resourceUri);i.label??=this.customEditorLabelService.getName(e)||"",i.label?i.description??=this.labelService.getUriLabel(e,{relative:!0}):(i.label=sl(e),i.description??=this.labelService.getUriLabel(ai(e),{relative:!0}));let t=i.iconPathDto;if(q.isThemeIcon(t)&&(q.isFile(t)||q.isFolder(t))){let o=q.isFolder(t)||Vle(e)?1:0,n=new uo(()=>Ia(this.modelService,this.languageService,e,o));Object.defineProperty(i,"iconClasses",{get:()=>n.value})}else this.expandIconPath(i)}expandIconPath(i){let e=i.iconPathDto;if(e)if(q.isThemeIcon(e))i.iconClass=q.asClassName(e);else if(jm(e)){let t=A.from(e);i.iconPath={dark:t,light:t}}else{let{dark:t,light:o}=e;i.iconPath={dark:A.from(t),light:A.from(o)}}else return}};zOt=I([fo(Xi.MainThreadQuickOpen),m(1,$e),m(2,nt),m(3,nb),m(4,_t),m(5,Rt)],zOt);var KOt=class extends k{constructor(e,t,o){super();this._environmentService=t;this._proxy=e.getProxy(ao.ExtHostExtensionService);let n=this._environmentService.remoteAuthority;n&&this._register(o.onDidChangeConnectionData(()=>{let r=o.getConnectionData(n);r&&this._proxy.$updateRemoteConnectionData(r)}))}};KOt=I([RM,m(1,Mt),m(2,dd)],KOt);var fwi=class{constructor(i){this._proxy=i.getProxy(ao.ExtHostDocumentSaveParticipant)}async participate(i,e,t,o){if(!i.textEditorModel||!Pk(i.textEditorModel))return;let n=new Promise((r,s)=>{setTimeout(()=>s(new Error(d(3961,null))),1750),this._proxy.$participateInSave(i.resource,e.reason).then(l=>{if(!l.every(c=>c))return Promise.reject(new Error("listener failed"))}).then(r,s)});return Ym(n,o)}},GOt=class{constructor(i,e,t){this._textFileService=t;this._saveParticipantDisposable=this._textFileService.files.addSaveParticipant(e.createInstance(fwi,i))}dispose(){this._saveParticipantDisposable.dispose()}};GOt=I([RM,m(1,F),m(2,Uo)],GOt);var Gx=le("speechService"),YH=new Y("hasSpeechProvider",!1,{type:"boolean",description:d(15434,null)}),Aee=new Y("speechToTextInProgress",!1,{type:"boolean",description:d(15461,null)}),qOt=new Y("textToSpeechInProgress",!1,{type:"boolean",description:d(15462,null)});var vwi="accessibility.voice.speechLanguage",bwi={"da-DK":{name:d(15435,null)},"de-DE":{name:d(15436,null)},"en-AU":{name:d(15437,null)},"en-CA":{name:d(15438,null)},"en-GB":{name:d(15439,null)},"en-IE":{name:d(15440,null)},"en-IN":{name:d(15441,null)},"en-NZ":{name:d(15442,null)},"en-US":{name:d(15443,null)},"es-ES":{name:d(15444,null)},"es-MX":{name:d(15445,null)},"fr-CA":{name:d(15446,null)},"fr-FR":{name:d(15447,null)},"hi-IN":{name:d(15448,null)},"it-IT":{name:d(15449,null)},"ja-JP":{name:d(15450,null)},"ko-KR":{name:d(15451,null)},"nl-NL":{name:d(15452,null)},"pt-PT":{name:d(15454,null)},"pt-BR":{name:d(15453,null)},"ru-RU":{name:d(15455,null)},"sv-SE":{name:d(15456,null)},"tr-TR":{name:d(15457,null)},"zh-CN":{name:d(15458,null)},"zh-HK":{name:d(15459,null)},"zh-TW":{name:d(15460,null)}};function $Ot(a,i=Kr){if(typeof a=="string"){if(a==="auto"){if(i!=="en"){let e=i.split("-");return $Ot(`${e[0]}-${(e[1]??e[0]).toUpperCase()}`)}}else if(bwi[a])return a}return"en-US"}var jOt=class{constructor(i,e,t){this.speechService=e;this.logService=t;this.providerRegistrations=new Map;this.speechToTextSessions=new Map;this.textToSpeechSessions=new Map;this.keywordRecognitionSessions=new Map;this.proxy=i.getProxy(ao.ExtHostSpeech)}$registerProvider(i,e,t){this.logService.trace("[Speech] extension registered provider",t.extension.value);let o=this.speechService.registerSpeechProvider(e,{metadata:t,createSpeechToTextSession:(n,r)=>{if(n.isCancellationRequested)return{onDidChange:U.None};let s=new O,l=Math.random();this.proxy.$createSpeechToTextSession(i,l,r?.language);let c=s.add(new T);return this.speechToTextSessions.set(l,{onDidChange:c}),s.add(n.onCancellationRequested(()=>{this.proxy.$cancelSpeechToTextSession(l),this.speechToTextSessions.delete(l),s.dispose()})),{onDidChange:c.event}},createTextToSpeechSession:(n,r)=>{if(n.isCancellationRequested)return{onDidChange:U.None,synthesize:async()=>{}};let s=new O,l=Math.random();this.proxy.$createTextToSpeechSession(i,l,r?.language);let c=s.add(new T);return this.textToSpeechSessions.set(l,{onDidChange:c}),s.add(n.onCancellationRequested(()=>{this.proxy.$cancelTextToSpeechSession(l),this.textToSpeechSessions.delete(l),s.dispose()})),{onDidChange:c.event,synthesize:async u=>{await this.proxy.$synthesizeSpeech(l,u);let p=new O;try{await Ea(U.toPromise(U.filter(c.event,h=>h.status===2,p),p),n)}finally{p.dispose()}}}},createKeywordRecognitionSession:n=>{if(n.isCancellationRequested)return{onDidChange:U.None};let r=new O,s=Math.random();this.proxy.$createKeywordRecognitionSession(i,s);let l=r.add(new T);return this.keywordRecognitionSessions.set(s,{onDidChange:l}),r.add(n.onCancellationRequested(()=>{this.proxy.$cancelKeywordRecognitionSession(s),this.keywordRecognitionSessions.delete(s),r.dispose()})),{onDidChange:l.event}}});this.providerRegistrations.set(i,{dispose:()=>{o.dispose()}})}$unregisterProvider(i){let e=this.providerRegistrations.get(i);e&&(e.dispose(),this.providerRegistrations.delete(i))}$emitSpeechToTextEvent(i,e){this.speechToTextSessions.get(i)?.onDidChange.fire(e)}$emitTextToSpeechEvent(i,e){this.textToSpeechSessions.get(i)?.onDidChange.fire(e)}$emitKeywordRecognitionEvent(i,e){this.keywordRecognitionSessions.get(i)?.onDidChange.fire(e)}dispose(){this.providerRegistrations.forEach(i=>i.dispose()),this.providerRegistrations.clear(),this.speechToTextSessions.forEach(i=>i.onDidChange.dispose()),this.speechToTextSessions.clear(),this.textToSpeechSessions.forEach(i=>i.onDidChange.dispose()),this.textToSpeechSessions.clear(),this.keywordRecognitionSessions.forEach(i=>i.onDidChange.dispose()),this.keywordRecognitionSessions.clear()}};jOt=I([fo(Xi.MainThreadSpeech),m(1,Gx),m(2,re)],jOt);var mG=le("editSessionIdentityService");var Swi=class{constructor(i){this.timeout=2e4;this._proxy=i.getProxy(ao.ExtHostWorkspace)}async participate(i,e){let t=new Promise((o,n)=>{setTimeout(()=>n(new Error(d(3912,null))),this.timeout),this._proxy.$onWillCreateEditSessionIdentity(i.uri,e,this.timeout).then(o,n)});return Ym(t,e)}},QOt=class{constructor(i,e,t){this._editSessionIdentityService=t;this._saveParticipantDisposable=this._editSessionIdentityService.addEditSessionIdentityCreateParticipant(e.createInstance(Swi,i))}dispose(){this._saveParticipantDisposable.dispose()}};QOt=I([RM,m(1,F),m(2,mG)],QOt);var RRe=class{constructor(i,e,t,o=void 0,n=void 0){this.uri=i;this.relativePath=e;this.context=t;this.element=o;this.parent=n;this._children=new Map}get childrenCount(){return this._children.size}get children(){return this._children.values()}get name(){return Vo.basename(this.relativePath)}get(i){return this._children.get(i)}set(i,e){this._children.set(i,e)}delete(i){this._children.delete(i)}clear(){this._children.clear()}};I([bi],RRe.prototype,"name",1);function Fuo(a,i){typeof a.element<"u"&&i.push(a.element);for(let e of a.children)Fuo(e,i);return i}var Fm=class{constructor(i,e=A.file("/"),t=Jn){this.extUri=t;this.root=new RRe(e,"",i)}static getRoot(i){for(;i.parent;)i=i.parent;return i}static collect(i){return Fuo(i,[])}static isResourceNode(i){return i instanceof RRe}add(i,e){let t=this.extUri.relativePath(this.root.uri,i)||i.path,o=new fX(!1).reset(t),n=this.root,r="";for(;;){let s=o.value();r=r+"/"+s;let l=n.get(s);if(l?o.hasNext()||(l.element=e):(l=new RRe(this.extUri.joinPath(this.root.uri,r),r,this.root.context,o.hasNext()?void 0:e,n),n.set(s,l)),n=l,!o.hasNext())return;o.next()}}delete(i){let e=this.extUri.relativePath(this.root.uri,i)||i.path,t=new fX(!1).reset(e);return this._delete(this.root,t)}_delete(i,e){let t=e.value(),o=i.get(t);if(o){if(e.hasNext()){let n=this._delete(o,e.next());return typeof n<"u"&&o.childrenCount===0&&i.delete(t),n}return i.delete(t),o.element}}clear(){this.root.clear()}getNode(i){let e=this.extUri.relativePath(this.root.uri,i)||i.path,t=new fX(!1).reset(e),o=this.root;for(;;){let n=t.value(),r=o.get(n);if(!r||!t.hasNext())return r;o=r,t.next()}}};var rW="scm-graph-incoming-changes",Nee="scm-graph-outgoing-changes";var kN=22,ng=11,kme=5,n8=4,Oee=2,Tme=te("scmGraph.historyItemRefColor",O3e,d(14931,null)),rZe=te("scmGraph.historyItemRemoteRefColor",JIt,d(14932,null)),Vuo=te("scmGraph.historyItemBaseRefColor","#EA5C00",d(14927,null)),uJo=te("scmGraph.historyItemHoverDefaultLabelForeground",xo,d(14929,null)),ywi=te("scmGraph.historyItemHoverDefaultLabelBackground",Gv,d(14928,null)),wwi=te("scmGraph.historyItemHoverLabelForeground",GI,d(14930,null)),pbl=te("scmGraph.historyItemHoverAdditionsForeground",{light:"#587C0C",dark:"#81B88B",hcDark:"#A1E3AD",hcLight:"#374E06"},d(14920,null)),mbl=te("scmGraph.historyItemHoverDeletionsForeground",{light:"#AD0707",dark:"#C74E39",hcDark:"#C74E39",hcLight:"#AD0707"},d(14921,null)),Wuo=[te("scmGraph.foreground1","#FFB000",d(14922,null)),te("scmGraph.foreground2","#DC267F",d(14923,null)),te("scmGraph.foreground3","#994F00",d(14924,null)),te("scmGraph.foreground4","#40B0A6",d(14925,null)),te("scmGraph.foreground5","#B66DFF",d(14926,null))];function Iwi(a,i){if(a.id===rW)return rZe;if(a.id===Nee)return Tme;for(let e of a.references??[]){let t=i.get(e.id);if(t!==void 0)return t}}function YOt(a,i=1){let e=document.createElementNS("http://www.w3.org/2000/svg","path");return e.setAttribute("fill","none"),e.setAttribute("stroke-width",`${i}px`),e.setAttribute("stroke-linecap","round"),e.style.stroke=Tt(a),e}function Eme(a,i,e,t){let o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",`${ng*(a+1)}`),o.setAttribute("cy",`${ng}`),o.setAttribute("r",`${i}`),o.style.strokeWidth=`${e}px`,t&&(o.style.fill=Tt(t)),o}function pJo(a,i,e,t){let o=document.createElementNS("http://www.w3.org/2000/svg","circle");return o.setAttribute("cx",`${ng*(a+1)}`),o.setAttribute("cy",`${ng}`),o.setAttribute("r",`${n8+1}`),o.style.stroke=Tt(t),o.style.strokeWidth=`${e}px`,o.style.strokeDasharray="4,2",o}function XOt(a,i,e,t,o=1){let n=YOt(t,o);return n.setAttribute("d",`M ${a} ${i} V ${e}`),n}function mJo(a,i){for(let e=a.length-1;e>=0;e--)if(a[e].id===i)return e;return-1}function Buo(a){let i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.classList.add("graph");let e=a.historyItem,t=a.inputSwimlanes,o=a.outputSwimlanes,n=t.findIndex(c=>c.id===e.id),r=n!==-1?n:t.length,s=r<o.length?o[r].color:r<t.length?t[r].color:Tme,l=0;for(let c=0;c<t.length;c++){let u=t[c].color;if(t[c].id===e.id)if(c!==r){let p=[],h=YOt(u);p.push(`M ${ng*(c+1)} 0`),p.push(`A ${ng} ${ng} 0 0 1 ${ng*c} ${ng}`),p.push(`H ${ng*(r+1)}`),h.setAttribute("d",p.join(" ")),i.append(h)}else l++;else if(l<o.length&&t[c].id===o[l].id){if(c===l){let p=XOt(ng*(c+1),0,kN,u);i.append(p)}else{let p=[],h=YOt(u);p.push(`M ${ng*(c+1)} 0`),p.push("V 6"),p.push(`A ${kme} ${kme} 0 0 1 ${ng*(c+1)-kme} ${kN/2}`),p.push(`H ${ng*(l+1)+kme}`),p.push(`A ${kme} ${kme} 0 0 0 ${ng*(l+1)} ${kN/2+kme}`),p.push(`V ${kN}`),h.setAttribute("d",p.join(" ")),i.append(h)}l++}}for(let c=1;c<e.parentIds.length;c++){let u=mJo(o,e.parentIds[c]);if(u===-1)continue;let p=[],h=YOt(o[u].color);p.push(`M ${ng*u} ${kN/2}`),p.push(`A ${ng} ${ng} 0 0 1 ${ng*(u+1)} ${kN}`),p.push(`M ${ng*u} ${kN/2}`),p.push(`H ${ng*(r+1)} `),h.setAttribute("d",p.join(" ")),i.append(h)}if(n!==-1){let c=XOt(ng*(r+1),0,kN/2,t[n].color);i.append(c)}if(e.parentIds.length>0){let c=XOt(ng*(r+1),kN/2,kN,s);i.append(c)}if(a.kind==="HEAD"){let c=Eme(r,n8+3,Oee,s);i.append(c);let u=Eme(r,Oee,n8);i.append(u)}else if(a.kind==="incoming-changes"||a.kind==="outgoing-changes"){let c=Eme(r,n8+3,Oee,s);i.append(c);let u=Eme(r,n8+1,Oee+1);i.append(u);let p=pJo(r,n8+1,Oee-1,s);i.append(p)}else if(e.parentIds.length>1){let c=Eme(r,n8+2,Oee,s);i.append(c);let u=Eme(r,n8-1,Oee,s);i.append(u)}else{let c=Eme(r,n8+1,Oee,s);i.append(c)}return i.style.height=`${kN}px`,i.style.width=`${ng*(Math.max(t.length,o.length,1)+1)}px`,i}function Cwi(a,i){let e=xQi("svg",{style:{height:`${kN}px`,width:`${ng*(a.length+1)}px`}});for(let t=0;t<a.length;t++){let o=t===i?3:1,n=XOt(ng*(t+1),0,kN,a[t].color,o);e.root.append(n)}return e.root}function Huo(a,i=new Map,e,t,o,n,r,s){let l=-1,c=[];for(let u=0;u<a.length;u++){let p=a[u],h=p.id===e?.revision?"HEAD":"node",f=(c.at(-1)?.outputSwimlanes??[]).map(y=>io(y)),v=[],b=!1;if(p.parentIds.length>0)for(let y of f){if(y.id===p.id){b||(v.push({id:p.parentIds[0],color:Iwi(p,i)??y.color}),b=!0);continue}v.push(io(y))}for(let y=b?1:0;y<p.parentIds.length;y++){let w;if(y===0)w=Iwi(p,i);else{let x=a.find(E=>E.id===p.parentIds[y]);w=x?Iwi(x,i):void 0}w||(l=SB(l+1,Wuo.length),w=Wuo[l]),v.push({id:p.parentIds[y],color:w})}let S=(p.references??[]).map(y=>{let w=i.get(y.id);if(i.has(y.id)&&w===void 0){let x=f.findIndex(M=>M.id===p.id),E=x!==-1?x:f.length;w=E<v.length?v[E].color:E<f.length?f[E].color:Tme}return{...y,color:w}});S.sort((y,w)=>gJo(y,w,e,t,o)),c.push({historyItem:{...p,references:S},kind:h,inputSwimlanes:f,outputSwimlanes:v})}return hJo(c,e,t,n,r,s),c}function Uuo(a){let i=a.historyItem,e=a.inputSwimlanes,t=e.findIndex(o=>o.id===i.id);return t!==-1?t:e.length}function hJo(a,i,e,t,o,n){if(i?.revision!==e?.revision&&n){if(t&&e&&e.revision!==n){let r=Oye(a,l=>l.outputSwimlanes.some(c=>c.id===n)),s=a.findIndex(l=>l.historyItem.id===n);if(r!==-1&&s!==-1&&!(a[r].historyItem.parentIds.length===2&&a[r].historyItem.parentIds.includes(n))){a[r]={...a[r],inputSwimlanes:a[r].inputSwimlanes.map(g=>g.id===n&&g.color===rZe?{...g,id:rW}:g),outputSwimlanes:a[r].outputSwimlanes.map(g=>g.id===n&&g.color===rZe?{...g,id:rW}:g)};let c=a[r].outputSwimlanes.map(g=>io(g)),u=a[s].inputSwimlanes.map(g=>io(g)),p=a[0].historyItem.displayId?.length??0,h={id:rW,displayId:"0".repeat(p),parentIds:[n],author:e?.name,subject:d(14918,null),message:""};a.splice(s,0,{historyItem:h,kind:"incoming-changes",inputSwimlanes:c,outputSwimlanes:u})}}if(o&&i?.revision&&i.revision!==n){let r=a.findIndex(s=>s.kind==="HEAD"&&s.historyItem.id===i.revision);if(r!==-1){let s={id:Nee,displayId:a[0].historyItem.displayId?"0".repeat(a[0].historyItem.displayId.length):void 0,parentIds:[i.revision],author:i?.name,subject:d(14919,null),message:""},l=a[r].inputSwimlanes.slice(0),c=l.slice(0).concat({id:i.revision,color:Tme});a.splice(r,0,{historyItem:s,kind:"outgoing-changes",inputSwimlanes:l,outputSwimlanes:c}),a[r+1].inputSwimlanes.push({id:i.revision,color:Tme})}}}}function gJo(a,i,e,t,o){let n=l=>l.id===e?.id?1:l.id===t?.id?2:l.id===o?.id?3:l.color!==void 0?4:99,r=n(a),s=n(i);return r-s}function sZe(a,i,e){let t=new O;if(i.tooltip===void 0)return{content:i.message,disposables:t};if(yr(i.tooltip))return{content:i.tooltip,disposables:t};let o=i.tooltip.slice();if(e&&i.references?.length){let r=new he("",{supportHtml:!0,supportThemeIcons:!0});for(let s of i.references){let l=q.isThemeIcon(s.icon)?s.icon.id:"",c=s.color?Tt(s.color):Tt(ywi),u=s.color?Tt(wwi):Tt(uJo);r.appendMarkdown(`<span style="color:${u};background-color:${c};border-radius:10px;">&nbsp;$(${l})&nbsp;`),r.appendText(s.name),r.appendMarkdown("&nbsp;&nbsp;</span>")}r.appendMarkdown(`

---

`),o.splice(o.length-1,0,r)}let n=_(".history-item-hover-container");for(let r of o){if(KB(r))continue;let s=a.render(r);n.appendChild(s.element),t.add(s)}return{content:n,disposables:t}}function _me(a){if(a!==void 0){if(q.isThemeIcon(a))return a;if(jm(a))return A.revive(a);{let i=a;return{light:A.revive(i.light),dark:A.revive(i.dark)}}}}function zuo(a){let i=_me(a.authorIcon),e=a.references?.map(t=>({...t,icon:_me(t.icon)}));return{...a,authorIcon:i,references:e}}function LRe(a,i){return a?{...a,icon:_me(a.icon),color:i}:void 0}var xwi=class extends k{constructor(e,t,o){super();this.modelService=t;this.languageService=o;this._register(e.registerTextModelContentProvider(Q.vscodeSourceControl,this))}async provideTextContent(e){let t=this.modelService.getModel(e);return t||this.modelService.createModel("",this.languageService.createById("scminput"),e)}},kwi=class{constructor(i,e,t,o,n,r,s,l){this.sourceControlHandle=i;this.handle=e;this.provider=t;this.features=o;this.label=n;this.id=r;this.multiDiffEditorEnableViewChanges=s;this._uriIdentService=l;this.resources=[];this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._onDidChangeResources=new T;this.onDidChangeResources=this._onDidChangeResources.event}get resourceTree(){if(!this._resourceTree){let i=this.provider.rootUri??A.file("/");this._resourceTree=new Fm(this,i,this._uriIdentService.extUri);for(let e of this.resources)this._resourceTree.add(e.sourceUri,e)}return this._resourceTree}get hideWhenEmpty(){return!!this.features.hideWhenEmpty}get contextValue(){return this.features.contextValue}toJSON(){return{$mid:4,sourceControlHandle:this.sourceControlHandle,groupHandle:this.handle}}splice(i,e,t){this.resources.splice(i,e,...t),this._resourceTree=void 0,this._onDidChangeResources.fire()}$updateGroup(i){this.features={...this.features,...i},this._onDidChange.fire()}$updateGroupLabel(i){this.label=i,this._onDidChange.fire()}},Ewi=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.proxy=i;this.sourceControlHandle=e;this.groupHandle=t;this.handle=o;this.sourceUri=n;this.resourceGroup=r;this.decorations=s;this.contextValue=l;this.command=c;this.multiDiffEditorOriginalUri=u;this.multiDiffEditorModifiedUri=p}open(i){return this.proxy.$executeResourceCommand(this.sourceControlHandle,this.groupHandle,this.handle,i)}toJSON(){return{$mid:3,sourceControlHandle:this.sourceControlHandle,groupHandle:this.groupHandle,handle:this.handle}}},Twi=class{constructor(i,e){this.proxy=i;this.handle=e;this._onDidChangeArtifacts=new T;this.onDidChangeArtifacts=this._onDidChangeArtifacts.event;this._disposables=new O;this._disposables.add(this._onDidChangeArtifacts)}async provideArtifactGroups(i){return(await this.proxy.$provideArtifactGroups(this.handle,i??Ie.None))?.map(t=>({...t,icon:_me(t.icon)}))}async provideArtifacts(i,e){return(await this.proxy.$provideArtifacts(this.handle,i,e??Ie.None))?.map(o=>({...o,icon:_me(o.icon)}))}$onDidChangeArtifacts(i){this._onDidChangeArtifacts.fire(i)}dispose(){this._disposables.dispose()}},_wi=class{constructor(i,e){this.proxy=i;this.handle=e;this._historyItemRef=Xm({owner:this,equalsFn:cD},void 0);this._historyItemRemoteRef=Xm({owner:this,equalsFn:cD},void 0);this._historyItemBaseRef=Xm({owner:this,equalsFn:cD},void 0);this._historyItemRefChanges=De(this,{added:[],modified:[],removed:[],silent:!1})}get historyItemRef(){return this._historyItemRef}get historyItemRemoteRef(){return this._historyItemRemoteRef}get historyItemBaseRef(){return this._historyItemBaseRef}get historyItemRefChanges(){return this._historyItemRefChanges}async resolveHistoryItem(i,e){let t=await this.proxy.$resolveHistoryItem(this.handle,i,e??Ie.None);return t?zuo(t):void 0}async resolveHistoryItemChatContext(i,e){return this.proxy.$resolveHistoryItemChatContext(this.handle,i,e??Ie.None)}async resolveHistoryItemChangeRangeChatContext(i,e,t,o){return this.proxy.$resolveHistoryItemChangeRangeChatContext(this.handle,i,e,t,o??Ie.None)}async resolveHistoryItemRefsCommonAncestor(i,e){return this.proxy.$resolveHistoryItemRefsCommonAncestor(this.handle,i,e??Ie.None)}async provideHistoryItemRefs(i,e){return(await this.proxy.$provideHistoryItemRefs(this.handle,i,e??Ie.None))?.map(o=>({...o,icon:_me(o.icon)}))}async provideHistoryItems(i,e){return(await this.proxy.$provideHistoryItems(this.handle,i,e??Ie.None))?.map(o=>zuo(o))}async provideHistoryItemChanges(i,e,t){return(await this.proxy.$provideHistoryItemChanges(this.handle,i,e,t??Ie.None))?.map(n=>({uri:A.revive(n.uri),originalUri:n.originalUri&&A.revive(n.originalUri),modifiedUri:n.modifiedUri&&A.revive(n.modifiedUri)}))}$onDidChangeCurrentHistoryItemRefs(i,e,t){Ki(o=>{this._historyItemRef.set(LRe(i,Tme),o),this._historyItemRemoteRef.set(LRe(e,rZe),o),this._historyItemBaseRef.set(LRe(t,Vuo),o)})}$onDidChangeHistoryItemRefs(i){let e=i.added.map(n=>LRe(n)),t=i.modified.map(n=>LRe(n)),o=i.removed.map(n=>LRe(n));this._historyItemRefChanges.set({added:e,modified:t,removed:o,silent:i.silent},void 0)}},Dwi=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.proxy=i;this._handle=e;this._parentHandle=t;this._providerId=o;this._label=n;this._rootUri=r;this._iconPath=s;this._isHidden=l;this._inputBoxTextModel=c;this._quickDiffService=u;this._uriIdentService=p;this._workspaceContextService=h;this.groups=[];this._onDidChangeResourceGroups=new T;this.onDidChangeResourceGroups=this._onDidChangeResourceGroups.event;this._onDidChangeResources=new T;this.onDidChangeResources=this._onDidChangeResources.event;this._groupsByHandle=Object.create(null);this.features={};this._contextValue=De(this,void 0);this._count=De(this,void 0);this._statusBarCommands=De(this,void 0);this._commitTemplate=De(this,"");this._actionButton=De(this,void 0);this._artifactProvider=De(this,void 0);this._historyProvider=De(this,void 0);if(r){let g=this._workspaceContextService.getWorkspaceFolder(r);g?.uri.toString()===r.toString()?this._name=g.name:r.path!=="/"&&(this._name=Be(r))}}get id(){return`scm${this._handle}`}get parentId(){return this._parentHandle!==void 0?`scm${this._parentHandle}`:void 0}get providerId(){return this._providerId}get handle(){return this._handle}get label(){return this._label}get rootUri(){return this._rootUri}get iconPath(){return this._iconPath}get isHidden(){return this._isHidden}get inputBoxTextModel(){return this._inputBoxTextModel}get contextValue(){return this._contextValue}get acceptInputCommand(){return this.features.acceptInputCommand}get count(){return this._count}get statusBarCommands(){return this._statusBarCommands}get name(){return this._name??this._label}get commitTemplate(){return this._commitTemplate}get actionButton(){return this._actionButton}get artifactProvider(){return this._artifactProvider}get historyProvider(){return this._historyProvider}$updateSourceControl(i){if(this.features={...this.features,...i},typeof i.commitTemplate<"u"&&this._commitTemplate.set(i.commitTemplate,void 0),typeof i.actionButton<"u"&&this._actionButton.set(i.actionButton??void 0,void 0),typeof i.contextValue<"u"&&this._contextValue.set(i.contextValue,void 0),typeof i.count<"u"&&this._count.set(i.count,void 0),typeof i.statusBarCommands<"u"&&this._statusBarCommands.set(i.statusBarCommands,void 0),i.hasQuickDiffProvider&&!this._quickDiff?this._quickDiff=this._quickDiffService.addQuickDiffProvider({id:`${this._providerId}.quickDiffProvider`,label:i.quickDiffLabel??this.label,rootUri:this.rootUri,kind:"primary",getOriginalResource:async e=>{if(!this.features.hasQuickDiffProvider)return null;let t=await this.proxy.$provideOriginalResource(this.handle,e,Ie.None);return t&&A.revive(t)}}):i.hasQuickDiffProvider===!1&&this._quickDiff&&(this._quickDiff.dispose(),this._quickDiff=void 0),i.hasSecondaryQuickDiffProvider&&!this._stagedQuickDiff?this._stagedQuickDiff=this._quickDiffService.addQuickDiffProvider({id:`${this._providerId}.secondaryQuickDiffProvider`,label:i.secondaryQuickDiffLabel??this.label,rootUri:this.rootUri,kind:"secondary",getOriginalResource:async e=>{if(!this.features.hasSecondaryQuickDiffProvider)return null;let t=await this.proxy.$provideSecondaryOriginalResource(this.handle,e,Ie.None);return t&&A.revive(t)}}):i.hasSecondaryQuickDiffProvider===!1&&this._stagedQuickDiff&&(this._stagedQuickDiff.dispose(),this._stagedQuickDiff=void 0),i.hasArtifactProvider&&!this.artifactProvider.get()){let e=new Twi(this.proxy,this.handle);this._artifactProvider.set(e,void 0)}else i.hasArtifactProvider===!1&&this.artifactProvider.get()&&(this._artifactProvider.get()?.dispose(),this._artifactProvider.set(void 0,void 0));if(i.hasHistoryProvider&&!this.historyProvider.get()){let e=new _wi(this.proxy,this.handle);this._historyProvider.set(e,void 0)}else i.hasHistoryProvider===!1&&this.historyProvider.get()&&this._historyProvider.set(void 0,void 0)}$registerGroups(i){let e=i.map(([t,o,n,r,s])=>{let l=new kwi(this.handle,t,this,r,n,o,s,this._uriIdentService);return this._groupsByHandle[t]=l,l});this.groups.splice(this.groups.length,0,...e),this._onDidChangeResourceGroups.fire()}$updateGroup(i,e){let t=this._groupsByHandle[i];t&&t.$updateGroup(e)}$updateGroupLabel(i,e){let t=this._groupsByHandle[i];t&&t.$updateGroupLabel(e)}$spliceGroupResourceStates(i){for(let[e,t]of i){let o=this._groupsByHandle[e];if(!o){console.warn(`SCM group ${e} not found in provider ${this.label}`);continue}t.reverse();for(let[n,r,s]of t){let l=s.map(c=>{let[u,p,h,g,f,v,b,S,y,w]=c,[x,E]=h,M=q.isThemeIcon(x)?x:A.revive(x),N=(q.isThemeIcon(E)?E:A.revive(E))||M,V={icon:M,iconDark:N,tooltip:g,strikeThrough:f,faded:v};return new Ewi(this.proxy,this.handle,e,u,A.revive(p),o,V,b||void 0,S,A.revive(y),A.revive(w))});o.splice(n,r,l)}}this._onDidChangeResources.fire()}$unregisterGroup(i){let e=this._groupsByHandle[i];e&&(delete this._groupsByHandle[i],this.groups.splice(this.groups.indexOf(e),1),this._onDidChangeResourceGroups.fire())}async getOriginalResource(i){if(!this.features.hasQuickDiffProvider)return null;let e=await this.proxy.$provideOriginalResource(this.handle,i,Ie.None);return e&&A.revive(e)}$onDidChangeHistoryProviderCurrentHistoryItemRefs(i,e,t){let o=this.historyProvider.get();o&&o.$onDidChangeCurrentHistoryItemRefs(i,e,t)}$onDidChangeHistoryProviderHistoryItemRefs(i){let e=this.historyProvider.get();e&&e.$onDidChangeHistoryItemRefs(i)}$onDidChangeArtifacts(i){let e=this.artifactProvider.get();e&&e.$onDidChangeArtifacts(i)}toJSON(){return{$mid:5,handle:this.handle}}dispose(){this._onDidChangeResourceGroups.dispose(),this._onDidChangeResources.dispose(),this._artifactProvider.get()?.dispose(),this._stagedQuickDiff?.dispose(),this._quickDiff?.dispose()}},JOt=class{constructor(i,e,t,o,n,r,s,l,c){this.scmService=e;this.scmViewService=t;this.languageService=o;this.modelService=n;this.textModelService=r;this.quickDiffService=s;this._uriIdentService=l;this.workspaceContextService=c;this._repositories=new Map;this._repositoryBarriers=new Map;this._repositoryDisposables=new Map;this._disposables=new O;this._proxy=i.getProxy(ao.ExtHostSCM),this._disposables.add(new xwi(this.textModelService,this.modelService,this.languageService))}dispose(){je(this._repositories.values()),this._repositories.clear(),je(this._repositoryDisposables.values()),this._repositoryDisposables.clear(),this._disposables.dispose()}async $registerSourceControl(i,e,t,o,n,r,s,l){this._repositoryBarriers.set(i,new ip);let c=await this.textModelService.createModelReference(A.revive(l)),u=new Dwi(this._proxy,i,e,t,o,n?A.revive(n):void 0,_me(r),s,c.object.textEditorModel,this.quickDiffService,this._uriIdentService,this.workspaceContextService),p=this.scmService.registerSCMProvider(u);this._repositories.set(i,p);let h=Fn(c,U.filter(this.scmViewService.onDidFocusRepository,g=>g===p)(g=>this._proxy.$setSelectedSourceControl(i)),p.input.onDidChange(({value:g})=>this._proxy.$onInputBoxValueChange(i,g)));this._repositoryDisposables.set(i,h),this.scmViewService.focusedRepository===p&&setTimeout(()=>this._proxy.$setSelectedSourceControl(i),0),p.input.value&&setTimeout(()=>this._proxy.$onInputBoxValueChange(i,p.input.value),0),this._repositoryBarriers.get(i)?.open()}async $updateSourceControl(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$updateSourceControl(e)}async $unregisterSourceControl(i){await this._repositoryBarriers.get(i)?.wait();let e=this._repositories.get(i);e&&(this._repositoryDisposables.get(i).dispose(),this._repositoryDisposables.delete(i),e.dispose(),this._repositories.delete(i))}async $registerGroups(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;let n=o.provider;n.$registerGroups(e),n.$spliceGroupResourceStates(t)}async $updateGroup(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;o.provider.$updateGroup(e,t)}async $updateGroupLabel(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);if(!o)return;o.provider.$updateGroupLabel(e,t)}async $spliceResourceStates(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$spliceGroupResourceStates(e)}async $unregisterGroup(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$unregisterGroup(e)}async $setInputBoxValue(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&t.input.setValue(e,!1)}async $setInputBoxPlaceholder(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.placeholder=e)}async $setInputBoxEnablement(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.enabled=e)}async $setInputBoxVisibility(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(t.input.visible=e)}async $showValidationMessage(i,e,t){await this._repositoryBarriers.get(i)?.wait();let o=this._repositories.get(i);o&&o.input.showValidationMessage(e,t)}async $setValidationProviderIsEnabled(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);t&&(e?t.input.validateInput=async(o,n)=>{let r=await this._proxy.$validateInput(i,o,n);return r&&{message:r[0],type:r[1]}}:t.input.validateInput=async()=>{})}async $onDidChangeHistoryProviderCurrentHistoryItemRefs(i,e,t,o){await this._repositoryBarriers.get(i)?.wait();let n=this._repositories.get(i);if(!n)return;n.provider.$onDidChangeHistoryProviderCurrentHistoryItemRefs(e,t,o)}async $onDidChangeHistoryProviderHistoryItemRefs(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$onDidChangeHistoryProviderHistoryItemRefs(e)}async $onDidChangeArtifacts(i,e){await this._repositoryBarriers.get(i)?.wait();let t=this._repositories.get(i);if(!t)return;t.provider.$onDidChangeArtifacts(e)}};JOt=I([fo(Xi.MainThreadSCM),m(1,lc),m(2,Au),m(3,Rt),m(4,_t),m(5,Bt),m(6,l_),m(7,gt),m(8,Ae)],JOt);var Ri={SearchViewVisibleKey:new Y("searchViewletVisible",!0),SearchViewFocusedKey:new Y("searchViewletFocus",!1),SearchResultListFocusedKey:new Y("searchResultListFocused",!0),InputBoxFocusedKey:new Y("inputBoxFocus",!1),SearchInputBoxFocusedKey:new Y("searchInputBoxFocus",!1),ReplaceInputBoxFocusedKey:new Y("replaceInputBoxFocus",!1),PatternIncludesFocusedKey:new Y("patternIncludesInputBoxFocus",!1),PatternExcludesFocusedKey:new Y("patternExcludesInputBoxFocus",!1),ReplaceActiveKey:new Y("replaceActive",!1),HasSearchResults:new Y("hasSearchResult",!1),FirstMatchFocusKey:new Y("firstMatchFocus",!1),FileMatchOrMatchFocusKey:new Y("fileMatchOrMatchFocus",!1),FileMatchOrFolderMatchFocusKey:new Y("fileMatchOrFolderMatchFocus",!1),FileMatchOrFolderMatchWithResourceFocusKey:new Y("fileMatchOrFolderMatchWithResourceFocus",!1),FileFocusKey:new Y("fileMatchFocus",!1),FolderFocusKey:new Y("folderMatchFocus",!1),ResourceFolderFocusKey:new Y("folderMatchWithResourceFocus",!1),IsEditableItemKey:new Y("isEditableItem",!0),MatchFocusKey:new Y("matchFocus",!1),SearchResultHeaderFocused:new Y("searchResultHeaderFocused",!1),ViewHasSearchPatternKey:new Y("viewHasSearchPattern",!1),ViewHasReplacePatternKey:new Y("viewHasReplacePattern",!1),ViewHasFilePatternKey:new Y("viewHasFilePattern",!1),ViewHasSomeCollapsibleKey:new Y("viewHasSomeCollapsibleResult",!1),InTreeViewKey:new Y("inTreeView",!1),hasAIResultProvider:new Y("hasAIResultProviderKey",!1),AIResultsTitle:new Y("aiResultsTitle",!1),AIResultsRequested:new Y("aiResultsRequested",!1)};var ZOt=class{constructor(i,e,t,o,n){this._searchService=e;this._telemetryService=t;this.contextKeyService=n;this._searchProvider=new Map;this._aiSearchProviderHandles=new Set;this._proxy=i.getProxy(ao.ExtHostSearch),this._proxy.$enableExtensionHostSearch()}dispose(){this._searchProvider.forEach(i=>i.dispose()),this._searchProvider.clear(),this._aiSearchProviderHandles.clear(),Ri.hasAIResultProvider.bindTo(this.contextKeyService).set(!1)}$registerTextSearchProvider(i,e){this._searchProvider.set(i,new aZe(this._searchService,1,e,i,this._proxy))}$registerAITextSearchProvider(i,e){Ri.hasAIResultProvider.bindTo(this.contextKeyService).set(!0),this._aiSearchProviderHandles.add(i),this._searchProvider.set(i,new aZe(this._searchService,2,e,i,this._proxy))}$registerFileSearchProvider(i,e){this._searchProvider.set(i,new aZe(this._searchService,0,e,i,this._proxy))}$unregisterProvider(i){je(this._searchProvider.get(i)),this._searchProvider.delete(i),this._aiSearchProviderHandles.delete(i)&&this._aiSearchProviderHandles.size===0&&Ri.hasAIResultProvider.bindTo(this.contextKeyService).set(!1)}$handleFileMatch(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleFindMatch(e,t)}$handleTextMatch(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleFindMatch(e,t)}$handleKeywordResult(i,e,t){let o=this._searchProvider.get(i);if(!o)throw new Error("Got result for unknown provider");o.handleKeywordResult(e,t)}$handleTelemetry(i,e){this._telemetryService.publicLog(i,e)}};ZOt=I([fo(Xi.MainThreadSearch),m(1,Gg),m(2,_e),m(3,B),m(4,X)],ZOt);var Rwi=class a{constructor(i,e=++a._idPool,t=new Map,o=[]){this.progress=i;this.id=e;this.matches=t;this.keywords=o}static{this._idPool=0}addMatch(i){let e=this.matches.get(i.resource.toString());e?e.results&&i.results&&e.results.push(...i.results):this.matches.set(i.resource.toString(),i),this.progress?.(i)}addKeyword(i){this.keywords.push(i),this.progress?.(i)}},aZe=class{constructor(i,e,t,o,n){this._scheme=t;this._handle=o;this._proxy=n;this._registrations=new O;this._searches=new Map;this._registrations.add(i.registerSearchResultProvider(this._scheme,e,this))}async getAIName(){return this.cachedAIName===void 0&&(this.cachedAIName=await this._proxy.$getAIName(this._handle)),this.cachedAIName}dispose(){this._registrations.dispose()}fileSearch(i,e=Ie.None){return this.doSearch(i,void 0,e)}textSearch(i,e,t=Ie.None){return this.doSearch(i,e,t)}doSearch(i,e,t=Ie.None){if(!i.folderQueries.length)throw new Error("Empty folderQueries");let o=new Rwi(e);this._searches.set(o.id,o);let n=this._provideSearchResults(i,o.id,t);return Promise.resolve(n).then(r=>(this._searches.delete(o.id),{results:Array.from(o.matches.values()),aiKeywords:Array.from(o.keywords),stats:r.stats,limitHit:r.limitHit,messages:r.messages}),r=>(this._searches.delete(o.id),Promise.reject(r)))}clearCache(i){return Promise.resolve(this._proxy.$clearCache(i))}handleFindMatch(i,e){let t=this._searches.get(i);t&&e.forEach(o=>{o.results?t.addMatch(er(o)):t.addMatch({resource:A.revive(o)})})}handleKeywordResult(i,e){let t=this._searches.get(i);t&&t.addKeyword(e)}_provideSearchResults(i,e,t){switch(i.type){case 1:return this._proxy.$provideFileSearchResults(this._handle,e,i,t);case 2:return this._proxy.$provideTextSearchResults(this._handle,e,i,t);default:return this._proxy.$provideAITextSearchResults(this._handle,e,i,t)}}};var eFt=class extends k{constructor(e,t){super();this.statusbarService=t;this._entryDisposables=this._register(new Ot);this._proxy=e.getProxy(ao.ExtHostStatusBar);let o=[];for(let[r,s]of t.getEntries())o.push(n(r,s));this._proxy.$acceptStaticEntries(o),this._register(t.onDidChange(r=>{r.added&&this._proxy.$acceptStaticEntries([n(r.added[0],r.added[1])])}));function n(r,s){return{entryId:r,name:s.entry.name,text:s.entry.text,tooltip:s.entry.tooltip,command:typeof s.entry.command=="string"?s.entry.command:typeof s.entry.command=="object"?s.entry.command.id:void 0,priority:s.priority,alignLeft:s.alignment===0,accessibilityInformation:s.entry.ariaLabel?{label:s.entry.ariaLabel,role:s.entry.role}:void 0}}}$setEntry(e,t,o,n,r,s,l,c,u,p,h,g,f){let v=l?{markdown:S=>this._proxy.$provideTooltip(e,S),markdownNotSupportedFallback:void 0}:s;if(this.statusbarService.setOrUpdateEntry(e,t,o,n,r,v,c,u,p,h,g,f)===0){let S=ee(()=>this.statusbarService.unsetEntry(e));this._entryDisposables.set(e,S)}}$disposeEntry(e){this._entryDisposables.deleteAndDispose(e)}};eFt=I([fo(Xi.MainThreadStatusBar),m(1,EMt)],eFt);var hG=le("IExtensionStorageService"),vJo=/^extensionKeys\/([^.]+\..+)@(\d+\.\d+\.\d+(-.*)?)$/,DC=class extends k{constructor(e,t,o){super();this.storageService=e;this.productService=t;this.logService=o;this._onDidChangeExtensionStorageToSync=this._register(new T);this.onDidChangeExtensionStorageToSync=this._onDidChangeExtensionStorageToSync.event;this.extensionsWithKeysForSync=DC.readAllExtensionsWithKeysForSync(e),this._register(this.storageService.onDidChangeValue(0,void 0,this._store)(n=>this.onDidChangeStorageValue(n)))}static{this.LARGE_STATE_WARNING_THRESHOLD=512*1024}static toKey(e){return`extensionKeys/${epe(e.id)}@${e.version}`}static fromKey(e){let t=vJo.exec(e);if(t&&t[1])return{id:t[1],version:t[2]}}static async removeOutdatedExtensionVersions(e,t){let o=await e.getInstalled(),n=[];for(let[r,s]of DC.readAllExtensionsWithKeysForSync(t)){let l=o.find(c=>Ht(c.identifier,{id:r}))?.manifest.version;for(let c of s)l!==c&&n.push(DC.toKey({id:r,version:c}))}for(let r of n)t.remove(r,0)}static readAllExtensionsWithKeysForSync(e){let t=new Map,o=e.keys(0,1);for(let n of o){let r=DC.fromKey(n);if(r){let s=t.get(r.id.toLowerCase());s||t.set(r.id.toLowerCase(),s=[]),s.push(r.version)}}return t}onDidChangeStorageValue(e){if(this.extensionsWithKeysForSync.has(e.key.toLowerCase())){this._onDidChangeExtensionStorageToSync.fire();return}let t=DC.fromKey(e.key);if(t){if(this.storageService.get(e.key,0)===void 0)this.extensionsWithKeysForSync.delete(t.id.toLowerCase());else{let o=this.extensionsWithKeysForSync.get(t.id.toLowerCase());o||this.extensionsWithKeysForSync.set(t.id.toLowerCase(),o=[]),o.push(t.version),this._onDidChangeExtensionStorageToSync.fire()}return}}getExtensionId(e){if(We(e))return e;let t=e.manifest?e.manifest.publisher:e.publisher,o=e.manifest?e.manifest.name:e.name;return zS(t,o)}getExtensionState(e,t){let o=this.getExtensionId(e),n=this.getExtensionStateRaw(e,t);if(n)try{return JSON.parse(n)}catch(r){this.logService.error(`[mainThreadStorage] unexpected error parsing storage contents (extensionId: ${o}, global: ${t}): ${r}`)}}getExtensionStateRaw(e,t){let o=this.getExtensionId(e),n=this.storageService.get(o,t?0:1);return n&&n?.length>DC.LARGE_STATE_WARNING_THRESHOLD&&this.logService.warn(`[mainThreadStorage] large extension state detected (extensionId: ${o}, global: ${t}): ${n.length/1024}kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.`),n}setExtensionState(e,t,o){let n=this.getExtensionId(e);t===void 0?this.storageService.remove(n,o?0:1):this.storageService.store(n,JSON.stringify(t),o?0:1,1)}setKeysForSync(e,t){this.storageService.store(DC.toKey(e),JSON.stringify(t),0,1)}getKeysForSync(e){let t=this.productService.extensionSyncedKeys?.[e.id.toLowerCase()],o=this.storageService.get(DC.toKey(e),0),n=o?JSON.parse(o):void 0;return n&&t?jo([...n,...t]):n||t}addToMigrationList(e,t){if(e!==t){let o=this.migrationList.filter(n=>!n.includes(e)&&!n.includes(t));o.push([e,t]),this.migrationList=o}}getSourceExtensionToMigrate(e){let t=this.migrationList.find(([,o])=>e===o);return t?t[0]:void 0}get migrationList(){let e=this.storageService.get("extensionStorage.migrationList",-1,"[]");try{let t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return[]}set migrationList(e){e.length?this.storageService.store("extensionStorage.migrationList",JSON.stringify(e),-1,1):this.storageService.remove("extensionStorage.migrationList",-1)}};DC=I([m(0,de),m(1,Ze),m(2,re)],DC);async function Kuo(a,i,e,t){return t.invokeFunction(async o=>{let n=o.get(ko),r=o.get(hn),s=o.get(hG),l=o.get(de),c=o.get(gt),u=o.get(ge),p=o.get(Ae),h=o.get(re),g=`extensionStorage.migrate.${a}-${i}`,f=a.toLowerCase()===i.toLowerCase()?`extension.storage.migrateFromLowerCaseKey.${a.toLowerCase()}`:void 0;if(a===i)return;let v=(S,y)=>y?c.extUri.joinPath(r.defaultProfile.globalStorageHome,S.toLowerCase()):c.extUri.joinPath(n.workspaceStorageHome,p.getWorkspace().id,S),b=e?0:1;if(!l.getBoolean(g,b,!1)&&!(f&&l.getBoolean(f,b,!1))){h.info(`Migrating ${e?"global":"workspace"} extension storage from ${a} to ${i}...`);let S=s.getExtensionState(a,e);S&&(s.setExtensionState(i,S,e),s.setExtensionState(a,void 0,e));let y=v(a,e),w=v(i,e);if(!c.extUri.isEqual(y,w))try{await u.move(y,w,!0)}catch(x){x.code!=="EntryNotFound"&&h.info(`Error while migrating ${e?"global":"workspace"} file storage from '${a}' to '${i}'`,Dn(x))}h.info(`Migrated ${e?"global":"workspace"} extension storage from ${a} to ${i}`),l.store(g,!0,b,1)}})}var tFt=class{constructor(i,e,t,o,n){this._extensionStorageService=e;this._storageService=t;this._instantiationService=o;this._logService=n;this._storageListener=new O;this._sharedStorageKeysToWatch=new Map;this._proxy=i.getProxy(ao.ExtHostStorage),this._storageListener.add(this._storageService.onDidChangeValue(0,void 0,this._storageListener)(r=>{if(this._sharedStorageKeysToWatch.has(r.key)){let s=this._extensionStorageService.getExtensionStateRaw(r.key,!0);typeof s=="string"&&this._proxy.$acceptValue(!0,r.key,s)}}))}dispose(){this._storageListener.dispose()}async $initializeExtensionStorage(i,e){return await this.checkAndMigrateExtensionStorage(e,i),i&&this._sharedStorageKeysToWatch.set(e,!0),this._extensionStorageService.getExtensionStateRaw(e,i)}async $setValue(i,e,t){this._extensionStorageService.setExtensionState(e,t,i)}$registerExtensionStorageKeysToSync(i,e){this._extensionStorageService.setKeysForSync(i,e)}async checkAndMigrateExtensionStorage(i,e){try{let t=this._extensionStorageService.getSourceExtensionToMigrate(i);!t&&Ft&&i!==i.toLowerCase()&&(t=i.toLowerCase()),t&&(Ft&&t!==t.toLowerCase()&&this._extensionStorageService.getExtensionState(t.toLowerCase(),e)&&!this._extensionStorageService.getExtensionState(t,e)&&(t=t.toLowerCase()),await Kuo(t,i,e,this._instantiationService))}catch(t){this._logService.error(t)}}};tFt=I([fo(Xi.MainThreadStorage),m(1,hG),m(2,de),m(3,F),m(4,re)],tFt);var Dme=class extends k{constructor(e,t,o,n,r){super();this._telemetryService=t;this._configurationService=o;this._environmentService=n;this._productService=r;this._proxy=e.getProxy(ao.ExtHostTelemetry),EM(this._productService,this._environmentService)&&this._register(this._configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration(dT)||s.affectsConfiguration(xB))&&this._proxy.$onDidChangeTelemetryLevel(this.telemetryLevel)})),this._proxy.$initializeTelemetryLevel(this.telemetryLevel,EM(this._productService,this._environmentService),this._productService.enabledTelemetryLevels)}get telemetryLevel(){return EM(this._productService,this._environmentService)?this._telemetryService.telemetryLevel:0}$publicLog(e,t=Object.create(null)){t[Dme._name]=!0,this._telemetryService.publicLog(e,t)}$publicLog2(e,t){this.$publicLog(e,t)}};Dme._name="pluginHostTelemetry",Dme=I([fo(Xi.MainThreadTelemetry),m(1,_e),m(2,B),m(3,ko),m(4,Ze)],Dme);var iFt=class{constructor(i){this._callback=i;this._terminalBufferMap=new Map}dispose(){for(let i of this._terminalBufferMap.values())i.dispose()}startBuffering(i,e,t=5){let o=e(n=>{let r=We(n)?n:n.data,s=this._terminalBufferMap.get(i);if(s){s.data.push(r);return}let l=setTimeout(()=>this.flushBuffer(i),t);s={data:[r],timeoutId:l,dispose:()=>{clearTimeout(l),this.flushBuffer(i),o.dispose()}},this._terminalBufferMap.set(i,s)});return o}stopBuffering(i){this._terminalBufferMap.get(i)?.dispose()}flushBuffer(i){let e=this._terminalBufferMap.get(i);e&&(this._terminalBufferMap.delete(i),this._callback(i,e.data.join("")))}};var Fee=class extends k{constructor(e,t,o,n){super();this.instanceId=e;this._cols=t;this._rows=o;this._terminalService=n;this.id=0;this.shouldPersist=!1;this._onProcessData=this._register(new T);this.onProcessData=this._onProcessData.event;this._onProcessReady=this._register(new T);this._onStart=this._register(new T);this.onStart=this._onStart.event;this._onInput=this._register(new T);this.onInput=this._onInput.event;this._onBinary=this._register(new T);this.onBinary=this._onBinary.event;this._onResize=this._register(new T);this.onResize=this._onResize.event;this._onAcknowledgeDataEvent=this._register(new T);this.onAcknowledgeDataEvent=this._onAcknowledgeDataEvent.event;this._onShutdown=this._register(new T);this.onShutdown=this._onShutdown.event;this._onRequestInitialCwd=this._register(new T);this.onRequestInitialCwd=this._onRequestInitialCwd.event;this._onRequestCwd=this._register(new T);this.onRequestCwd=this._onRequestCwd.event;this._onDidChangeProperty=this._register(new T);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new T);this.onProcessExit=this._onProcessExit.event;this._pendingInitialCwdRequests=[];this._pendingCwdRequests=[]}get onProcessReady(){return this._onProcessReady.event}emitData(e){this._onProcessData.fire(e)}emitTitle(e){this._onDidChangeProperty.fire({type:"title",value:e})}emitReady(e,t){this._onProcessReady.fire({pid:e,cwd:t,windowsPty:void 0})}emitProcessProperty({type:e,value:t}){switch(e){case"cwd":this.emitCwd(t);break;case"initialCwd":this.emitInitialCwd(t);break;case"title":this.emitTitle(t);break;case"overrideDimensions":this.emitOverrideDimensions(t);break;case"resolvedShellLaunchConfig":this.emitResolvedShellLaunchConfig(t);break}}emitExit(e){this._onProcessExit.fire(e),this.dispose()}emitOverrideDimensions(e){this._onDidChangeProperty.fire({type:"overrideDimensions",value:e})}emitResolvedShellLaunchConfig(e){this._onDidChangeProperty.fire({type:"resolvedShellLaunchConfig",value:e})}emitInitialCwd(e){for(;this._pendingInitialCwdRequests.length>0;)this._pendingInitialCwdRequests.pop()(e)}emitCwd(e){for(;this._pendingCwdRequests.length>0;)this._pendingCwdRequests.pop()(e)}async start(){return this._terminalService.requestStartExtensionTerminal(this,this._cols,this._rows)}shutdown(e){this._onShutdown.fire(e)}input(e){this._onInput.fire(e)}sendSignal(e){}resize(e,t){this._onResize.fire({cols:e,rows:t})}clearBuffer(){}acknowledgeDataEvent(){}async setUnicodeVersion(e){}async processBinary(e){this._onBinary.fire(e)}getInitialCwd(){return new Promise(e=>{this._onRequestInitialCwd.fire(),this._pendingInitialCwdRequests.push(e)})}getCwd(){return new Promise(e=>{this._onRequestCwd.fire(),this._pendingCwdRequests.push(e)})}async refreshProperty(e){throw new Error("refreshProperty not implemented on extension host")}async updateProperty(e,t){}};Fee=I([m(3,an)],Fee);var gG=le("environmentVariableService");function Rme(a){return[...a.entries()]}function lZe(a){return a?[...a.entries()]:[]}function cZe(a){return new Map(a)}function dZe(a){return new Map(a??[])}function Lwi(a){return Array.from(a.entries()).map(i=>[i[0],Rme(i[1].map),lZe(i[1].descriptionMap)])}function Guo(a){return new Map(a.map(i=>[i[0],{map:cZe(i[1]),descriptionMap:dZe(i[2])}]))}var uZe=le("terminalLinkProviderService");var PRe=le("terminalQuickFixService");var oFt=class{constructor(i){this.completion=i;this.score=Xv.Default;this.isInvalid=!1;this.textLabel=typeof i.label=="string"?i.label:i.label?.label,this.labelLow=this.textLabel.toLowerCase()}};function quo(a){switch(a){case 20:return 0;case 23:return 1;case 0:return 2;case 18:return 4;case 4:return 4;case 16:return 6;case 17:return 3;default:return 2}}var ARe=class extends oFt{constructor(e,t){super(e);this.completion=e;this.fileExtLow="";this.punctuationPenalty=0;let n=(t??(this.labelLow.includes("\\")?"\\":void 0))==="\\";if(this.labelLowExcludeFileExt=this.labelLow,this.labelLowNormalizedPath=this.labelLow,(Mwi(e)||e.kind===11)&&n&&(this.labelLow=this.labelLow.replaceAll("/","\\")),Mwi(e)){let r=this.labelLow.lastIndexOf(".");r>0&&(this.labelLowExcludeFileExt=this.labelLow.substring(0,r),this.fileExtLow=this.labelLow.substring(r+1))}(Mwi(e)||e.kind===1)&&(n&&(this.labelLowNormalizedPath=this.labelLow.replaceAll("\\","/")),e.kind===1&&(this.labelLowNormalizedPath=this.labelLowNormalizedPath.replace(/\/$/,""))),this.punctuationPenalty=bJo(this.labelLowExcludeFileExt)?1:0}async resolve(e){if(this.resolveCache)return this.resolveCache;let t=this.completion._unresolvedItem,o=this.completion._resolveProvider;if(!(!t||!o||!o.resolveCompletionItem))return this.resolveCache=(async()=>{try{let n=await o.resolveCompletionItem(t,e);n&&(n.detail&&(this.completion.detail=n.detail),n.documentation&&(this.completion.documentation=n.documentation))}catch{return}})(),this.resolveCache}};function Mwi(a){return!!(a.kind===0||a.isFileOverride)}function bJo(a){return Jo(a).startsWith("_")||/^[\[\]\{\}\(\)\.,;:!?\/\\\-_@#~*%^=$]+$/.test(a)}function $uo(a,i){let e=(i||"C:").toUpperCase();if(a==="/")return`${e}\\`;let t=a.match(/^\/([a-zA-Z])(\/.*)?$/);if(t){let o=t[1].toUpperCase(),n=t[2]?t[2].replace(/\//g,"\\"):"\\";return`${o}:${n}`}return a.replace(/\//g,"\\")}function juo(a){return a.replace(/^[a-zA-Z]:\\/,i=>`/${i[0].toLowerCase()}/`).replace(/\\/g,"/")}var Vee=le("terminalCompletionService");var NRe=class extends k{constructor(e,t,o,n){super();this._configurationService=e;this._fileService=t;this._labelService=o;this._logService=n;this._providers=new Map;this._onDidChangeProviders=this._register(new T);this.onDidChangeProviders=this._onDidChangeProviders.event;this._processEnv=Sp}get providers(){return this._providersGenerator()}*_providersGenerator(){for(let e of this._providers.values())for(let t of e.values())yield t}set processEnv(e){this._processEnv=e}registerTerminalCompletionProvider(e,t,o,...n){let r=this._providers.get(e);return r||(r=new Map,this._providers.set(e,r)),o.triggerCharacters=n,o.id=t,r.set(t,o),this._onDidChangeProviders.fire(),ee(()=>{let s=this._providers.get(e);s&&(s.delete(t),s.size===0&&this._providers.delete(e)),this._onDidChangeProviders.fire()})}async provideCompletions(e,t,o,n,r,s,l,c,u){if(this._logService.trace("TerminalCompletionService#provideCompletions"),!this._providers||!this._providers.values||t<0)return;let p;if(l){let h=[];for(let g of this.providers)if(g.triggerCharacters){for(let f of g.triggerCharacters)if(e.substring(0,t)?.endsWith(f)){h.push(g);break}}p=h}else p=[...this._providers.values()].flatMap(h=>[...h.values()]);if(c)return p=p.filter(h=>h.isBuiltin),this._collectCompletions(p,n,e,t,o,r,s,u);if(p=this._getEnabledProviders(p),!!p.length)return this._collectCompletions(p,n,e,t,o,r,s,u)}_getEnabledProviders(e){let t=this._configurationService.getValue("terminal.integrated.suggest.providers");return e.filter(o=>{let n=o.id;return n&&(!Object.prototype.hasOwnProperty.call(t,n)||t[n]!==!1)})}async _collectCompletions(e,t,o,n,r,s,l,c){this._logService.trace("TerminalCompletionService#_collectCompletions");let u=e.map(async h=>{if(h.shellTypes&&t&&!h.shellTypes.includes(t))return;let g=c?3e4:5e3,f=!1,v;try{v=await Promise.race([h.provideCompletions(o,n,l).then(S=>(this._logService.trace(`TerminalCompletionService#_collectCompletions provider ${h.id} finished`),S)),(async()=>{await Li(g),f=!0})()])}catch(S){this._logService.trace(`[TerminalCompletionService] Exception from provider '${h.id}':`,S);return}if(f){this._logService.trace(`[TerminalCompletionService] Provider '${h.id}' timed out after ${g}ms. promptValue='${o}', cursorPosition=${n}, explicitlyInvoked=${c}`);return}if(!v)return;let b=Array.isArray(v)?v:v.items??[];if(this._logService.trace(`TerminalCompletionService#_collectCompletions amend ${b.length} completion items`),t==="pwsh")for(let S of b){let y=S.replacementRange?S.replacementRange[0]:0;S.isFileOverride??=S.kind===2&&y===0}if(h.isBuiltin)for(let S of b)S.provider??=h.id;if(Array.isArray(v))return b;if(v.resourceOptions){let S=await this.resolveResources(v.resourceOptions,o,n,`core:path:ext:${h.id}`,s,t);if(this._logService.trace("TerminalCompletionService#_collectCompletions dedupe"),S){let y=new Set(b.map(w=>w.label));for(let w of S)y.has(w.label)||b.push(w)}this._logService.trace("TerminalCompletionService#_collectCompletions dedupe done")}return b}),p=await Promise.all(u);return this._logService.trace("TerminalCompletionService#_collectCompletions done"),p.filter(h=>!!h).flat()}async resolveResources(e,t,o,n,r,s){this._logService.trace("TerminalCompletionService#resolveResources");let l=e.pathSeparator==="\\";l&&(t=t.replaceAll(/[\\/]/g,e.pathSeparator));let c=(e.showDirectories||e.showFiles)??!1,u=e.showFiles??!1,p=e.globPattern??void 0;if(!c&&!u)return;let h=[],g=t.substring(0,o),v=g.split(/(?<!\\) /).length<=1&&!g.endsWith(" "),b=g.endsWith(" ")?"":g.split(/(?<!\\) /).at(-1)??"",S=b.match(/^[a-zA-Z_]+=(?<rhs>.+)$/);S?.groups?.rhs&&(b=S.groups.rhs);let y;if(l){let j=-1;for(let J=b.length-1;J>=0;J--)if(b[J]==="\\"&&(J===b.length-1||b[J+1]!==" ")){j=J;break}y=Math.max(j,b.lastIndexOf("/"))}else y=b.lastIndexOf(e.pathSeparator);let w=y===-1?"":b.slice(0,y+1);l&&(w=w.replaceAll("/","\\"));let x=!!w.match(/^\.\.?[\\\/]/),E=!!w.match(/^~[\\\/]?/),M=IJo(s,e.pathSeparator,w,l),N=E?"tilde":M?"absolute":"relative",V=A.revive(e.cwd),H;if(N==="relative"&&w.length>0){let j=(l?w.replaceAll("\\","/"):w).replaceAll("\\ "," ");if(j.startsWith("./")){let se=j.replace(/^\.\/+/,"").replace(/\/+$/,"");if(se){let ae=V.path.replace(/\/+$/,"").split("/"),ce=se.split("/");if(ce.length<=ae.length&&ce.every((Re,xe)=>ae[ae.length-ce.length+xe]===Re))try{await this._fileService.stat(V),H=V}catch{return}}else try{await this._fileService.stat(V),H=V}catch{return}}if(!H){let se=A.joinPath(V,j);try{await this._fileService.stat(se),H=se}catch{return}}}else N==="relative"&&(H=V);if(N==="relative"&&!H)try{await this._fileService.stat(V),H=V}catch{return}switch(N){case"tilde":{let j=this._getHomeDir(l,r);j&&(H=A.joinPath(pZe(V,j),w.slice(1).replaceAll("\\ "," "))),H||b.match(/^~[\\\/]$/)&&(H=l?"Home directory":"$HOME");break}case"absolute":{s==="gitbash"?H=pZe(V,$uo(w,this._processEnv.SystemDrive)):H=pZe(V,w.replaceAll("\\ "," "));break}case"relative":{H??=V;break}}if(!H)return;if(We(H))return h.push({label:w,provider:n,kind:1,detail:H,replacementRange:[o-b.length,o]}),h;let K=await this._fileService.resolve(H,{resolveMetadata:!0,resolveSingleChildDescendants:!0});if(K?.children){if(this._logService.trace("TerminalCompletionService#resolveResources cwd"),c){let j;switch(N){case"tilde":{j=w;break}case"absolute":{j=w;break}case"relative":{j=".",w.length>0&&(j=Pwi(w,e,x));break}}h.push({label:j,provider:n,kind:1,detail:Wee(this._labelService,H,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}if(this._logService.trace("TerminalCompletionService#resolveResources direct children"),await Promise.all(K.children.map(j=>(async()=>{let J,se;if(c&&j.isDirectory)j.isSymbolicLink?J=9:J=1;else if(u&&j.isFile){if(v&&!l&&!j.executable)return;j.isSymbolicLink?J=8:J=0}if(J===void 0)return;let ae=w;if(ae.length>0&&!ae.endsWith(e.pathSeparator)&&(ae+=e.pathSeparator),ae+=j.name,N==="relative"&&(ae=Pwi(ae,e,x)),j.isDirectory&&!ae.endsWith(e.pathSeparator)&&(ae+=e.pathSeparator),ae=SJo(ae,s,e.pathSeparator),j.isFile&&p){let ce=j.resource.fsPath,Se=!this._fileService.hasCapability(j.resource,1024);if(!qd(p,ce,{ignoreCase:Se}))return}if(j.isSymbolicLink)try{let ce=await this._fileService.realpath(j.resource);ce&&!ze(j.resource,ce)&&(se=`${Wee(this._labelService,j.resource,e.pathSeparator,J,s)} -> ${Wee(this._labelService,ce,e.pathSeparator,J,s)}`)}catch{}h.push({label:ae,provider:n,kind:J,detail:se??Wee(this._labelService,j.resource,e.pathSeparator,J,s),replacementRange:[o-b.length,o]})})())),this._logService.trace("TerminalCompletionService#resolveResources CDPATH"),N==="relative"&&c&&t.startsWith("cd ")){let j=this._configurationService.getValue("terminal.integrated.suggest.cdPath");if(j==="absolute"||j==="relative"){let J=this._getEnvVar("CDPATH",r);if(J){let se=J.split(l?";":":");for(let ae of se)try{let ce=await this._fileService.resolve(pZe(V,ae),{resolveSingleChildDescendants:!0});if(ce?.children)for(let Se of ce.children){if(!Se.isDirectory)continue;let Re=j==="relative",xe=1,He=Re?Jo(Se.resource.fsPath):s==="gitbash"?juo(Se.resource.fsPath):Wee(this._labelService,Se.resource,e.pathSeparator,xe,s),Ee=Re?`CDPATH ${Wee(this._labelService,Se.resource,e.pathSeparator,xe,s)}`:"CDPATH";h.push({label:He,provider:n,kind:xe,detail:Ee,replacementRange:[o-b.length,o]})}}catch{}}}}if(this._logService.trace("TerminalCompletionService#resolveResources parent dir"),N==="relative"&&c){let j=`..${e.pathSeparator}`;w.length>0&&(j=Pwi(w+j,e,x));let J=A.joinPath(H,".."+e.pathSeparator);h.push({label:j,provider:n,kind:1,detail:Wee(this._labelService,J,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}if(this._logService.trace("TerminalCompletionService#resolveResources tilde"),N==="relative"&&!w.match(/[\\\/]/)){let j,J=this._getHomeDir(l,r);J&&(j=pZe(V,J)),j||(j=l?"Home directory":"$HOME"),h.push({label:"~",provider:n,kind:1,detail:We(j)?j:Wee(this._labelService,j,e.pathSeparator,1,s),replacementRange:[o-b.length,o]})}return this._logService.trace("TerminalCompletionService#resolveResources done"),h}}_getEnvVar(e,t){let o=t.get(5)?.env?.value;return o?o[e]:this._processEnv[e]}_getHomeDir(e,t){return e?this._getEnvVar("USERPROFILE",t):this._getEnvVar("HOME",t)}};NRe=I([m(0,B),m(1,ge),m(2,nt),m(3,wa)],NRe);function Wee(a,i,e,t,o){let n=a.getUriLabel(i,{noPrefix:!0}),r=o==="gitbash"?"\\":e;return t===1&&!n.endsWith(r)&&(n+=r),n}function Pwi(a,i,e){return e?a:a.startsWith(i.pathSeparator)?`.${a}`:`.${i.pathSeparator}${a}`}function SJo(a,i,e){return i===void 0||i==="pwsh"||i==="cmd"?a:a.replace(/[\[\]\(\)'"\\\`\*\?;|&<>]/g,"\\$&")}function IJo(a,i,e,t){return a==="gitbash"?e.startsWith(i)||/^[a-zA-Z]:\//.test(e):t?/^[a-zA-Z]:[\\\/]/.test(e):e.startsWith(i)}function pZe(a,i){return a.scheme==="file"?A.file(i):a.with({path:i})}var rFt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this._terminalService=t;this._terminalLinkProviderService=o;this._terminalQuickFixService=n;this._instantiationService=r;this._environmentVariableService=s;this._logService=l;this._terminalProfileResolverService=c;this._terminalGroupService=p;this._terminalEditorService=h;this._terminalProfileService=g;this._terminalCompletionService=f;this._environmentService=v;this._extHostTerminals=new Map;this._terminalProcessProxies=new Map;this._profileProviders=new Map;this._completionProviders=new Map;this._quickFixProviders=new Map;this._dataEventTracker=this._register(new ue);this._sendCommandEventListener=this._register(new ue);this._linkProvider=this._register(new ue);this._os=Ao;this._proxy=e.getProxy(ao.ExtHostTerminalService),this._register(t.onDidCreateInstance(S=>{this._onTerminalOpened(S),this._onInstanceDimensionsChanged(S)})),this._register(t.onDidDisposeInstance(S=>this._onTerminalDisposed(S))),this._register(t.onAnyInstanceProcessIdReady(S=>this._onTerminalProcessIdReady(S))),this._register(t.onDidChangeInstanceDimensions(S=>this._onInstanceDimensionsChanged(S))),this._register(t.onAnyInstanceMaximumDimensionsChange(S=>this._onInstanceMaximumDimensionsChanged(S))),this._register(t.onDidRequestStartExtensionTerminal(S=>this._onRequestStartExtensionTerminal(S))),this._register(t.onDidChangeActiveInstance(S=>this._onActiveTerminalChanged(S?S.instanceId:null))),this._register(t.onAnyInstanceTitleChange(S=>S&&this._onTitleChanged(S.instanceId,S.title))),this._register(t.onAnyInstanceDataInput(S=>this._proxy.$acceptTerminalInteraction(S.instanceId))),this._register(t.onAnyInstanceSelectionChange(S=>this._proxy.$acceptTerminalSelection(S.instanceId,S.selection))),this._register(t.onAnyInstanceShellTypeChanged(S=>this._onShellTypeChanged(S.instanceId)));for(let S of this._terminalService.instances)this._onTerminalOpened(S),S.processReady.then(()=>this._onTerminalProcessIdReady(S)),S.shellType&&this._proxy.$acceptTerminalShellType(S.instanceId,S.shellType);let b=this._terminalService.activeInstance;if(b&&this._proxy.$acceptActiveTerminalChanged(b.instanceId),this._environmentVariableService.collections.size>0){let y=[...this._environmentVariableService.collections.entries()].map(w=>[w[0],Rme(w[1].map)]);this._proxy.$initEnvironmentVariableCollections(y)}this._store.add(ee(()=>{for(let S of this._terminalProcessProxies.values())S.proxy.dispose(),S.store.dispose();this._terminalProcessProxies.clear()})),u.getEnvironment().then(async S=>{this._os=S?.os||Ao,this._updateDefaultProfile()}),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(()=>this._updateDefaultProfile())),this._register(ee(()=>{for(let S of this._profileProviders.values())S.dispose();for(let S of this._quickFixProviders.values())S.dispose()}))}async _updateDefaultProfile(){let e=this._environmentService.remoteAuthority,t=this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:e,os:this._os}),o=this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:e,os:this._os,allowAutomationShell:!0});this._proxy.$acceptDefaultProfile(...await Promise.all([t,o]))}async _getTerminalInstance(e){return typeof e=="string"?this._extHostTerminals.get(e):this._terminalService.getInstanceFromId(e)}async $createTerminal(e,t){let o={name:t.name,executable:t.shellPath,args:t.shellArgs,cwd:typeof t.cwd=="string"?t.cwd:A.revive(t.cwd),icon:t.icon,color:t.color,initialText:t.initialText,waitOnExit:t.waitOnExit,ignoreConfigurationCwd:!0,env:t.env,strictEnv:t.strictEnv,hideFromUser:t.hideFromUser,customPtyImplementation:t.isExtensionCustomPtyTerminal?(s,l,c)=>new Fee(s,l,c,this._terminalService):void 0,extHostTerminalId:e,forceShellIntegration:t.forceShellIntegration,isFeatureTerminal:t.isFeatureTerminal,isExtensionOwnedTerminal:t.isExtensionOwnedTerminal,useShellEnvironment:t.useShellEnvironment,isTransient:t.isTransient,shellIntegrationNonce:t.shellIntegrationNonce,titleTemplate:t.titleTemplate},n=vn.withAsyncBody(async s=>{let l=await this._terminalService.createTerminal({config:o,location:await this._deserializeParentTerminal(t.location)});s(l)});this._extHostTerminals.set(e,n);let r=await n;this._register(r.onDisposed(()=>{this._extHostTerminals.delete(e)}))}async _deserializeParentTerminal(e){if(typeof e=="object"&&yo(e,{parentTerminal:!0})){let t=await this._extHostTerminals.get(e.parentTerminal.toString());return t?{parentTerminal:t}:void 0}return e}async $show(e,t){let o=await this._getTerminalInstance(e);o&&(this._terminalService.setActiveInstance(o),o.target===2?await this._terminalEditorService.revealActiveEditor(t):await this._terminalGroupService.showPanel(!t))}async $hide(e){let t=await this._getTerminalInstance(e),o=this._terminalService.activeInstance;o&&o.instanceId===t?.instanceId&&o.target!==2&&this._terminalGroupService.hidePanel()}async $dispose(e){(await this._getTerminalInstance(e))?.dispose(4)}async $sendText(e,t,o){await(await this._getTerminalInstance(e))?.sendText(t,o)}$sendProcessExit(e,t){this._terminalProcessProxies.get(e)?.proxy.emitExit(t)}$startSendingDataEvents(){if(!this._dataEventTracker.value){this._dataEventTracker.value=this._instantiationService.createInstance(mZe,(e,t)=>{this._onTerminalData(e,t)});for(let e of this._terminalService.instances)for(let t of e.initialDataEvents||[])this._onTerminalData(e.instanceId,t)}}$stopSendingDataEvents(){this._dataEventTracker.clear()}$startSendingCommandEvents(){if(this._sendCommandEventListener.value)return;let e=this._terminalService.createOnInstanceCapabilityEvent(2,o=>o.onCommandFinished),t=e.event(o=>{this._onDidExecuteCommand(o.instance.instanceId,{commandLine:o.data.command,cwd:o.data.cwd,exitCode:o.data.exitCode,output:o.data.getOutput()})});this._sendCommandEventListener.value=Fn(e,t)}$stopSendingCommandEvents(){this._sendCommandEventListener.clear()}$startLinkProvider(){this._linkProvider.value=this._terminalLinkProviderService.registerLinkProvider(new Awi(this._proxy))}$stopLinkProvider(){this._linkProvider.clear()}$registerProcessSupport(e){this._terminalService.registerProcessSupport(e)}$registerCompletionProvider(e,t,...o){this._completionProviders.set(e,this._terminalCompletionService.registerTerminalCompletionProvider(t,e,{id:e,provideCompletions:async(n,r,s)=>{let l=await this._proxy.$provideTerminalCompletions(e,{commandLine:n,cursorIndex:r},s);if(l){if(l.resourceOptions){let{cwd:c,globPattern:u,...p}=l.resourceOptions;return{items:l.items?.map(h=>({provider:`ext:${e}`,...h})),resourceOptions:{...p,cwd:c,globPattern:u}}}return l.items?.map(c=>({provider:`ext:${e}`,...c}))}}},...o))}$unregisterCompletionProvider(e){this._completionProviders.get(e)?.dispose(),this._completionProviders.delete(e)}$registerProfileProvider(e,t){this._profileProviders.set(e,this._terminalProfileService.registerTerminalProfileProvider(t,e,{createContributedTerminalProfile:async o=>this._proxy.$createContributedProfileTerminal(e,o)}))}$unregisterProfileProvider(e){this._profileProviders.get(e)?.dispose(),this._profileProviders.delete(e)}async $registerQuickFixProvider(e,t){this._quickFixProviders.set(e,this._terminalQuickFixService.registerQuickFixProvider(e,{provideTerminalQuickFixes:async(o,n,r,s)=>{if(s.isCancellationRequested)return;r.outputMatcher?.length&&r.outputMatcher.length>40&&(r.outputMatcher.length=40,this._logService.warn("Cannot exceed output matcher length of 40"));let l=o.command.match(r.commandLineMatcher);if(!l||!n)return;let c=r.outputMatcher,u;if(c&&(u=yJo(n,c)),!u)return;let p={commandLineMatch:l,outputMatch:u,commandLine:o.command};if(p){let h=await this._proxy.$provideTerminalQuickFixes(e,p,s);if(h&&Array.isArray(h))return h.map(g=>Quo(e,t,g));if(h)return Quo(e,t,h)}}}))}$unregisterQuickFixProvider(e){this._quickFixProviders.get(e)?.dispose(),this._quickFixProviders.delete(e)}_onActiveTerminalChanged(e){this._proxy.$acceptActiveTerminalChanged(e)}_onTerminalData(e,t){this._proxy.$acceptTerminalProcessData(e,t)}_onDidExecuteCommand(e,t){this._proxy.$acceptDidExecuteCommand(e,t)}_onTitleChanged(e,t){this._proxy.$acceptTerminalTitleChange(e,t)}_onShellTypeChanged(e){let t=this._terminalService.getInstanceFromId(e);t&&this._proxy.$acceptTerminalShellType(e,t.shellType)}_onTerminalDisposed(e){this._proxy.$acceptTerminalClosed(e.instanceId,e.exitCode,e.exitReason??0);let t=this._terminalProcessProxies.get(e.instanceId);t&&(t.proxy.dispose(),t.store.dispose(),this._terminalProcessProxies.delete(e.instanceId))}_onTerminalOpened(e){let t=e.shellLaunchConfig.extHostTerminalId,o={name:e.shellLaunchConfig.name,executable:e.shellLaunchConfig.executable,args:e.shellLaunchConfig.args,cwd:e.shellLaunchConfig.cwd,env:e.shellLaunchConfig.env,hideFromUser:e.shellLaunchConfig.hideFromUser,tabActions:e.shellLaunchConfig.tabActions,titleTemplate:e.shellLaunchConfig.titleTemplate};this._proxy.$acceptTerminalOpened(e.instanceId,t,e.title,o)}_onTerminalProcessIdReady(e){e.processId!==void 0&&this._proxy.$acceptTerminalProcessId(e.instanceId,e.processId)}_onInstanceDimensionsChanged(e){this._proxy.$acceptTerminalDimensions(e.instanceId,e.cols,e.rows)}_onInstanceMaximumDimensionsChanged(e){this._proxy.$acceptTerminalMaximumDimensions(e.instanceId,e.maxCols,e.maxRows)}_onRequestStartExtensionTerminal(e){let t=e.proxy,o=new O;this._terminalProcessProxies.set(t.instanceId,{proxy:t,store:o});let n=e.cols&&e.rows?{columns:e.cols,rows:e.rows}:void 0;this._proxy.$startExtensionTerminal(t.instanceId,n).then(e.callback),o.add(t.onInput(r=>this._proxy.$acceptProcessInput(t.instanceId,r))),o.add(t.onShutdown(r=>this._proxy.$acceptProcessShutdown(t.instanceId,r))),o.add(t.onRequestCwd(()=>this._proxy.$acceptProcessRequestCwd(t.instanceId))),o.add(t.onRequestInitialCwd(()=>this._proxy.$acceptProcessRequestInitialCwd(t.instanceId)))}$sendProcessData(e,t){this._terminalProcessProxies.get(e)?.proxy.emitData(t)}$sendProcessReady(e,t,o,n){this._terminalProcessProxies.get(e)?.proxy.emitReady(t,o,n)}$sendProcessProperty(e,t){t.type==="title"&&this._terminalService.getInstanceFromId(e)?.rename(t.value),this._terminalProcessProxies.get(e)?.proxy.emitProcessProperty(t)}$setEnvironmentVariableCollection(e,t,o,n){if(o){let r={persistent:t,map:cZe(o),descriptionMap:dZe(n)};this._environmentVariableService.set(e,r)}else this._environmentVariableService.delete(e)}};rFt=I([fo(Xi.MainThreadTerminalService),m(1,an),m(2,uZe),m(3,PRe),m(4,F),m(5,gG),m(6,re),m(7,ig),m(8,bo),m(9,Cc),m(10,hb),m(11,fb),m(12,Vee),m(13,Mt)],rFt);var mZe=class extends k{constructor(e,t){super();this._callback=e;this._terminalService=t;this._register(this._bufferer=new iFt(this._callback));for(let o of this._terminalService.instances)this._registerInstance(o);this._register(this._terminalService.onDidCreateInstance(o=>this._registerInstance(o))),this._register(this._terminalService.onDidDisposeInstance(o=>this._bufferer.stopBuffering(o.instanceId)))}_registerInstance(e){this._register(this._bufferer.startBuffering(e.instanceId,e.onData))}};mZe=I([m(1,an)],mZe);var Awi=class{constructor(i){this._proxy=i}async provideLinks(i,e){let t=this._proxy;return(await t.$provideLinks(i.instanceId,e)).map(n=>({id:n.id,startIndex:n.startIndex,length:n.length,label:n.label,activate:()=>t.$activateLink(i.instanceId,n.id)}))}};function yJo(a,i){let e=a.join(`
`).match(i.lineMatcher);return e?{regexMatch:e,outputLines:a}:void 0}function Quo(a,i,e){let t=0;return yo(e,{uri:!0})?(e.uri=A.revive(e.uri),t=1):yo(e,{id:!0})&&(t=3),{id:a,type:t,source:i,...e}}var sFt=class extends k{constructor(e,t,o,n){super();this._terminalService=t;this._extensionService=n;this._proxy=e.getProxy(ao.ExtHostTerminalShellIntegration);let r=new Map;this._register(ee(()=>{for(let g of r.values())g.dispose()}));for(let g of this._terminalService.instances)g.capabilities.get(2)&&this._enableShellIntegration(g);let s=this._store.add(this._terminalService.createOnInstanceEvent(g=>U.map(g.capabilities.onDidAddCommandDetectionCapability,()=>g))).event;this._store.add(s(g=>this._enableShellIntegration(g)));let l=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(0,g=>g.onDidChangeCwd));this._store.add(l.event(g=>{this._proxy.$cwdChange(g.instance.instanceId,g.data)}));let c=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(5,g=>g.onDidChangeEnv));this._store.add(c.event(g=>{if(g.data.value&&typeof g.data.value=="object"){let f=g.data.value,v=Object.keys(f),b=Object.values(f);this._proxy.$shellEnvChange(g.instance.instanceId,v,b,g.data.isTrusted)}}));let u=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2,g=>g.onCommandExecuted)),p;this._store.add(u.event(g=>{if(g.data===p)return;p=g.data;let f=g.instance.instanceId;this._proxy.$shellExecutionStart(f,Juo(g.instance),g.data.command,Xuo(g.data),g.data.isTrusted,g.data.cwd),r.get(f)?.dispose(),r.set(f,U.accumulate(g.instance.onData,50,!0,this._store)(v=>{this._proxy.$shellExecutionData(f,v.join(""))}))}));let h=this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2,g=>g.onCommandFinished));this._store.add(h.event(g=>{p=void 0;let f=g.instance.instanceId;r.get(f)?.dispose(),this._proxy.$shellExecutionEnd(f,g.data.command,Xuo(g.data),g.data.isTrusted,g.data.exitCode)})),this._store.add(this._terminalService.onDidDisposeInstance(g=>this._proxy.$closeTerminal(g.instanceId)))}$executeCommand(e,t){this._terminalService.getInstanceFromId(e)?.runCommand(t,!0)}_enableShellIntegration(e){this._extensionService.activateByEvent("onTerminalShellIntegration:*"),e.shellType&&this._extensionService.activateByEvent(`onTerminalShellIntegration:${e.shellType}`),this._proxy.$shellIntegrationChange(e.instanceId,Juo(e));let t=e.capabilities.get(0);t&&this._proxy.$cwdChange(e.instanceId,t.getCwd())}};sFt=I([fo(Xi.MainThreadTerminalShellIntegration),m(1,an),m(2,Mt),m(3,lt)],sFt);function Xuo(a){switch(a.commandLineConfidence){case"high":return 2;case"medium":return 1;default:return 0}}function Juo(a){return a.shellLaunchConfig.type!=="Task"}var aFt=class{constructor(i,e){this._themeService=e,this._proxy=i.getProxy(ao.ExtHostTheming),this._themeChangeListener=this._themeService.onDidColorThemeChange(t=>{this._proxy.$onColorThemeChange(this._themeService.getColorTheme().type)}),this._proxy.$onColorThemeChange(this._themeService.getColorTheme().type)}dispose(){this._themeChangeListener.dispose()}};aFt=I([fo(Xi.MainThreadTheming),m(1,Pe)],aFt);var lFt=class extends k{constructor(e,t,o,n,r,s){super();this.viewsService=t;this.notificationService=o;this.extensionService=n;this.logService=r;this.telemetryService=s;this._dataProviders=this._register(new Ot);this._dndControllers=new Map;this._proxy=e.getProxy(ao.ExtHostTreeViews)}async $registerTreeViewDataProvider(e,t){this.logService.trace("MainThreadTreeViews#$registerTreeViewDataProvider",e,t),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{let o=new Owi(e,this._proxy,this.notificationService),n=new O;this._dataProviders.set(e,{dataProvider:o,dispose:()=>n.dispose()});let r=t.hasHandleDrag||t.hasHandleDrop?new Nwi(e,t.dropMimeTypes,t.dragMimeTypes,t.hasHandleDrag,this._proxy):void 0,s=this.getTreeView(e);s?(s.showCollapseAllAction=t.showCollapseAll,s.canSelectMany=t.canSelectMany,s.manuallyManageCheckboxes=t.manuallyManageCheckboxes,s.dragAndDropController=r,r&&this._dndControllers.set(e,r),s.dataProvider=o,this.registerListeners(e,s,n),this._proxy.$setVisible(e,s.visible)):this.notificationService.error("No view is registered with id: "+e)})}$reveal(e,t,o){return this.logService.trace("MainThreadTreeViews#$reveal",e,t?.item,t?.parentChain,o),this.viewsService.openView(e,o.focus).then(()=>{let n=this.getTreeView(e);if(n&&t)return this.reveal(n,this._dataProviders.get(e).dataProvider,t.item,t.parentChain,o)})}$refresh(e,t){this.logService.trace("MainThreadTreeViews#$refresh",e,t);let o=this.getTreeView(e),n=this._dataProviders.get(e);if(o&&n){let r=n.dataProvider.getItemsToRefresh(t);return o.refresh(r.items.length?r.items:void 0,r.checkboxes.length?r.checkboxes:void 0)}return Promise.resolve()}$setMessage(e,t){this.logService.trace("MainThreadTreeViews#$setMessage",e,t.toString());let o=this.getTreeView(e);o&&(o.message=t)}$setTitle(e,t,o){this.logService.trace("MainThreadTreeViews#$setTitle",e,t,o);let n=this.getTreeView(e);n&&(n.title=t,n.description=o)}$setBadge(e,t){this.logService.trace("MainThreadTreeViews#$setBadge",e,t?.value,t?.tooltip);let o=this.getTreeView(e);o&&(o.badge=t)}$resolveDropFileData(e,t,o){let n=this._dndControllers.get(e);if(!n)throw new Error("Unknown tree");return n.resolveDropFileData(t,o)}async $disposeTree(e){let t=this.getTreeView(e);t&&(t.dataProvider=void 0),this._dataProviders.deleteAndDispose(e)}$logResolveTreeNodeFailure(e){this.telemetryService.publicLog2("treeView.resolveFailure",{extensionId:e})}async reveal(e,t,o,n,r){r=r||{select:!1,focus:!1};let s=mr(r.select)?!1:r.select,l=mr(r.focus)?!1:r.focus,c=Math.min(on(r.expand)?r.expand:r.expand===!0?1:0,3);t.isEmpty()&&await e.refresh();for(let p of n){let h=t.getItem(p.handle);h&&await e.expand(h)}let u=t.getItem(o.handle);if(u){await e.reveal(u),s&&e.setSelection([u]),l===!1?e.setFocus():l&&e.setFocus(u);let p=[u];for(;p.length>0&&c>0;c--)await e.expand(p),p=p.reduce((h,g)=>{let f=t.getItem(g.handle);return f&&f.children&&f.children.length&&h.push(...f.children),h},[])}}registerListeners(e,t,o){o.add(t.onDidExpandItem(n=>this._proxy.$setExpanded(e,n.handle,!0))),o.add(t.onDidCollapseItem(n=>this._proxy.$setExpanded(e,n.handle,!1))),o.add(t.onDidChangeSelectionAndFocus(n=>this._proxy.$setSelectionAndFocus(e,n.selection.map(({handle:r})=>r),n.focus.handle))),o.add(t.onDidChangeVisibility(n=>this._proxy.$setVisible(e,n))),o.add(t.onDidChangeCheckboxState(n=>{this._proxy.$changeCheckboxState(e,n.map(r=>({treeItemHandle:r.handle,newState:r.checkbox?.isChecked??!1})))}))}getTreeView(e){let t=oe.as(Kn.ViewsRegistry).getView(e);return t?t.treeView:null}dispose(){for(let e of this._dataProviders){let t=this.getTreeView(e[0]);t&&(t.dataProvider=void 0)}this._dataProviders.dispose(),this._dndControllers.clear(),super.dispose()}};lFt=I([fo(Xi.MainThreadTreeViews),m(1,Gt),m(2,Ne),m(3,lt),m(4,re),m(5,_e)],lFt);var Nwi=class{constructor(i,e,t,o,n){this.treeViewId=i;this.dropMimeTypes=e;this.dragMimeTypes=t;this.hasWillDrop=o;this._proxy=n;this.dataTransfersCache=new vme}async handleDrop(i,e,t,o,n,r){let s=this.dataTransfersCache.add(i);try{let l=await fme.fromList(i);return t.isCancellationRequested?void 0:await this._proxy.$handleDrop(this.treeViewId,s.id,l,e?.handle,t,o,n,r)}finally{s.dispose()}}async handleDrag(i,e,t){if(!this.hasWillDrop)return;let o=await this._proxy.$handleDrag(this.treeViewId,i,e,t);if(!o)return;let n=new Wk;return o.items.forEach(([r,s])=>{let l=r===cr.uriList&&s.uriListData?$w.create(s.uriListData.map(c=>typeof c=="string"?c:A.revive(c))):s.asString;n.replace(r,MF(l))}),n}resolveDropFileData(i,e){return this.dataTransfersCache.resolveFileData(i,e)}},Owi=class{constructor(i,e,t){this.treeViewId=i;this._proxy=e;this.notificationService=t;this.itemsMap=new Map;this.hasResolve=this._proxy.$hasResolve(this.treeViewId)}async getChildren(i){return(await this.getChildrenBatch(i?[i]:void 0))?.[0]}getChildrenBatch(i){return i||this.itemsMap.clear(),this._proxy.$getChildren(this.treeViewId,i?i.map(e=>e.handle):void 0).then(e=>{let t=this.convertTransferChildren(i??[],e);return this.postGetChildren(t)},e=>(rNt.is(e)||this.notificationService.error(e),[]))}convertTransferChildren(i,e){let t=Array(i.length);if(e)for(let o of e){let n=o[0];t[n]=o.slice(1)}return t}getItemsToRefresh(i){let e=[],t=[];if(i)for(let o of Object.keys(i)){let n=this.getItem(o);if(n){let r=i[o];if(n.checkbox?.isChecked!==r.checkbox?.isChecked&&t.push(n),this.updateTreeItem(n,r),o===r.handle)e.push(n);else{this.itemsMap.delete(o),this.itemsMap.set(n.handle,n);let s=r.parentHandle?this.itemsMap.get(r.parentHandle):null;s&&e.push(s)}}}return{items:e,checkboxes:t}}getItem(i){return this.itemsMap.get(i)}isEmpty(){return this.itemsMap.size===0}async postGetChildren(i){if(i===void 0)return;let e=[],t=await this.hasResolve;if(i)for(let o of i){let n=[];if(e.push(n),!!o)for(let r of o){let s=new H3(r,t?l=>this._proxy.$resolve(this.treeViewId,r.handle,l):void 0);this.itemsMap.set(r.handle,s),n.push(s)}}return e}updateTreeItem(i,e){if(e.children=e.children?e.children:void 0,i){let t=jo([...Object.keys(i instanceof H3?i.asTreeItem():i),...Object.keys(e)]);for(let o of t)i[o]=e[o];i instanceof H3&&i.resetResolve()}}};var aW=le("downloadService");var cFt=class extends k{constructor(e,t){super();this.downloadService=t}$download(e,t){return this.downloadService.download(A.revive(e),A.revive(t),"mainThreadDownloadService.download")}};cFt=I([fo(Xi.MainThreadDownloadService),m(1,aW)],cFt);var tS=le("urlService");var wJo=300*1e3,CJo=30*1e3,Fwi="extensionUrlHandler.urlToHandle",xJo="extensions.confirmedUriHandlerExtensionIds",Zuo="extensionUrlHandler.confirmedExtensions";function epo(a){return/^[a-z0-9][a-z0-9\-]*\.[a-z0-9][a-z0-9\-]*$/i.test(a)}var dFt=class{constructor(i){this.storageService=i}get extensions(){let i=this.storageService.get(Zuo,0,"[]");try{return JSON.parse(i)}catch{return[]}}has(i){return this.extensions.indexOf(i)>-1}add(i){this.set([...this.extensions,i])}set(i){this.storageService.store(Zuo,JSON.stringify(i),0,1)}},Vwi=le("extensionUrlHandler"),gZe=class{static{this.handlers=new Set}static registerHandler(i){return this.handlers.add(i),ee(()=>this.handlers.delete(i))}static getHandler(i){for(let e of this.handlers)if(e.canHandleURL(i))return e}},hZe=class{constructor(i,e,t,o,n,r,s,l,c){this.extensionService=e;this.dialogService=t;this.commandService=o;this.hostService=n;this.storageService=r;this.configurationService=s;this.notificationService=l;this.productService=c;this.extensionHandlers=new Map;this.uriBuffer=new Map;this.userTrustedExtensionsStorage=new dFt(r);let u=Ly(ut,()=>this.garbageCollect(),CJo),p=this.storageService.get(Fwi,1);p&&(this.storageService.remove(Fwi,1),this.handleURL(A.revive(JSON.parse(p)),{trusted:!0})),this.disposable=Fn(i.registerHandler(this),u);let h=EN.cache;setTimeout(()=>h.forEach(([g,f])=>this.handleURL(g,f)))}async handleURL(i,e){if(!epo(i.authority))return!1;let t=gZe.getHandler(i);if(t){let p=await t.handleURL(i);if(p)return p}let o=i.authority,n=this.extensionHandlers.get(hi.toKey(o)),r;if(n)r=n.extensionDisplayName;else{let p=await this.extensionService.getExtension(o);if(p)r=p.displayName??"";else return await this.handleUnhandledURL(i,o,e),!0}if(!(e?.trusted||this.productService.trustedExtensionProtocolHandlers?.some(p=>xr(p,o))||this.didUserTrustExtension(hi.toKey(o)))){let p=i.toString(!1),h=p;h.length>40&&(h=`${h.substring(0,30)}...${h.substring(h.length-5)}`);let g=await this.dialogService.confirm({message:d(18940,null,r),checkbox:{label:d(18949,null)},primaryButton:d(18945,null),custom:{markdownDetails:[{markdown:new he(`<div title="${p}" aria-label='${p}'>${h}</div>`,{supportHtml:!0})}]}});if(!g.confirmed)return!0;g.checkboxChecked&&this.userTrustedExtensionsStorage.add(hi.toKey(o))}let l=this.extensionHandlers.get(hi.toKey(o));if(l)return n?!1:await this.handleURLByExtension(o,l,i,e);let c=new Date().getTime(),u=this.uriBuffer.get(hi.toKey(o));return u||(u=[],this.uriBuffer.set(hi.toKey(o),u)),u.push({timestamp:c,uri:i}),await this.extensionService.activateByEvent(`onUri:${hi.toKey(o)}`,1),!0}registerExtensionHandler(i,e){this.extensionHandlers.set(hi.toKey(i),e);let t=this.uriBuffer.get(hi.toKey(i))||[];for(let{uri:o}of t)this.handleURLByExtension(i,e,o);this.uriBuffer.delete(hi.toKey(i))}unregisterExtensionHandler(i){this.extensionHandlers.delete(hi.toKey(i))}async handleURLByExtension(i,e,t,o){return await e.handleURL(t,o)}async handleUnhandledURL(i,e,t){try{await this.commandService.executeCommand("workbench.extensions.installExtension",e,{justification:{reason:`${d(18942,null)}
${i.toString()}`,action:d(18946,null)},enable:!0,installPreReleaseVersion:this.productService.quality!=="stable"})}catch(n){Yi(n)||this.notificationService.error(n);return}if(await this.extensionService.getExtension(e))await this.handleURL(i,{...t,trusted:!0});else{if(!(await this.dialogService.confirm({message:d(18947,null,e),primaryButton:d(18948,null)})).confirmed)return;this.storageService.store(Fwi,JSON.stringify(i.toJSON()),1,1),await this.hostService.reload()}}garbageCollect(){let i=new Date().getTime(),e=new Map;this.uriBuffer.forEach((t,o)=>{t=t.filter(({timestamp:n})=>i-n<wJo),t.length>0&&e.set(o,t)}),this.uriBuffer=e}didUserTrustExtension(i){return this.userTrustedExtensionsStorage.has(i)?!0:this.getConfirmedTrustedExtensionIdsFromConfiguration().indexOf(i)>-1}getConfirmedTrustedExtensionIdsFromConfiguration(){let i=this.configurationService.getValue(xJo);return Array.isArray(i)?i:[]}dispose(){this.disposable.dispose(),this.extensionHandlers.clear(),this.uriBuffer.clear()}};hZe=I([m(0,tS),m(1,lt),m(2,ct),m(3,fe),m(4,ti),m(5,de),m(6,B),m(7,Ne),m(8,Ze)],hZe);Ce(Vwi,hZe,0);var EN=class{static{this.ID="workbench.contrib.extensionUrlBootstrapHandler"}static{this._cache=[]}static get cache(){EN.disposable.dispose();let i=EN._cache;return EN._cache=[],i}constructor(i){EN.disposable=i.registerHandler(this)}async handleURL(i,e){return epo(i.authority)?(EN._cache.push([i,e]),!0):!1}};EN=I([m(0,tS)],EN);bt(EN.ID,EN,vt.BlockRestore);var Wwi=class extends z{constructor(){super({id:"workbench.extensions.action.manageAuthorizedExtensionURIs",title:P(18943,"Manage Authorized Extension URIs..."),category:P(18941,"Extensions"),menu:{id:R.CommandPalette,when:Mu.toNegated()}})}async run(i){let e=i.get(de),t=i.get($e),o=new dFt(e),n=o.extensions.map(s=>({label:s,picked:!0}));if(n.length===0){await t.pick([{label:d(18944,null)}]);return}let r=await t.pick(n,{canPickMany:!0});r&&o.set(r.map(s=>s.label))}};W(Wwi);var ipo=A.parse("trustedDomains:/Trusted Domains"),WRe="http.linkProtectionTrustedDomains",uFt="http.linkProtectionTrustedDomainsContent";async function opo(a,i){await a.openEditor({resource:i,languageId:"jsonc",options:{pinned:!0}});let e=a.activeTextEditorControl;if(!fn(e))return;let t=e.getModel();if(!t||!ze(t.uri,i))return;let o=Jue(t.getValue(),!0),n;for(let r=o.scan();r!==17;r=o.scan())if(r===3){n=o.getTokenOffset()+o.getTokenLength();let s=o.scan();s!==17&&s!==4&&(n=o.getTokenOffset());break}if(n!==void 0){let r=t.getPositionAt(n);e.setPosition(r),e.revealPositionInCenter(r)}}var pFt={id:"workbench.action.manageTrustedDomain",description:{description:P(17543,"Manage Trusted Domains"),args:[]},handler:async a=>{let i=a.get(ie);await opo(i,ipo)}};async function npo(a,i,e,t,o,n,r){let s=A.parse(i),l=s.authority.split("."),c=l.slice(l.length-2).join("."),u="*."+c,p=[];if(p.push({type:"item",label:d(17547,null,i),id:"trust",toTrust:i,picked:!0}),l.length===4&&l.every(f=>Number.isInteger(+f)||Number.isInteger(+f.split(":")[0]))){if(s.authority.includes(":")){let f=s.authority.split(":")[0];p.push({type:"item",label:d(17546,null,f),toTrust:f+":*",id:"trust"})}}else p.push({type:"item",label:d(17548,null,c),toTrust:u,id:"trust"});p.push({type:"item",label:d(17545,null),toTrust:"*",id:"trust"}),p.push({type:"item",label:d(17544,null),id:"manage"});let g=await t.pick(p,{activeItem:p[0]});if(g&&g.id)switch(g.id){case"manage":{let f=ipo.with({fragment:e.toString()});return await opo(n,f),a}case"trust":{let f=g.toTrust;if(a.indexOf(f)===-1)return o.remove(uFt,-1),o.store(WRe,JSON.stringify([...a,f]),-1,0),[...a,f]}}return[]}async function rpo(a){let{defaultTrustedDomains:i,trustedDomains:e}=VRe(a);return{defaultTrustedDomains:i,trustedDomains:e}}function VRe(a){let i=a.get(de),e=a.get(Ze),t=a.get(Od),o=[...e.linkProtectionTrustedDomains??[],...t.options?.additionalTrustedDomains??[]],n=[];try{let r=i.get(WRe,-1);r&&(n=JSON.parse(r))}catch{}return{defaultTrustedDomains:o,trustedDomains:n}}function Bwi(a){let i=typeof a=="string"?A.parse(a):a;return i.with({path:i.path.replace(/\/+$/,""),query:null,fragment:null})}function BRe(a,i){let e=Bwi(a),t;if(/^[^./:]*:\/\//.test(i))t=Bwi(i);else{if(e.scheme!=="http"&&e.scheme!=="https")return!1;t=Bwi(`${e.scheme}://${i}`)}return Hwi(e.scheme,t.scheme)&&Hwi(e.authority,t.authority,!0)&&(t.path==="/"||Hwi(e.path,t.path))}function Hwi(a,i,e=!1){let t=Array.from({length:a.length+1}).map(()=>Array.from({length:i.length+1}).map(()=>{}));return r8(t,e,a,i,0,0)}function r8(a,i,e,t,o,n){if(a[o]?.[n]!==void 0)return a[o][n];let r=[];if(o===e.length)return n===t.length?!0:i&&t[n]+t[n+1]===":*"?n+2===t.length:!1;if(n===t.length)return e.slice(o)[0]==="/";if(e[o]===t[n]&&r.push(r8(a,i,e,t,o+1,n+1)),t[n]+t[n+1]==="*."&&(["/",":"].includes(e[o])||r.push(r8(a,i,e,t,o+1,n)),(o===0||e[o-1]===".")&&r.push(r8(a,i,e,t,o,n+2))),t[n]==="*"&&(o+1===e.length?r.push(r8(a,i,e,t,o+1,n+1)):r.push(r8(a,i,e,t,o+1,n)),r.push(r8(a,i,e,t,o,n+1))),i&&t[n]+t[n+1]===":*")if(e[o]===":"){let s=o+1;do s++;while(/[0-9]/.test(e[s]));r.push(r8(a,i,e,t,s,n+2))}else r.push(r8(a,i,e,t,o,n+2));return a[o][n]=r.some(s=>s===!0)}function mFt(a,i){if(a=A.parse(vZe(a)),i=i.map(vZe),bZe(a.authority))return!0;for(let e=0;e<i.length;e++)if(i[e]==="*"||BRe(a,i[e]))return!0;return!1}function vZe(a){let i=["github.com"];try{let e=typeof a=="string"?A.parse(a,!0):a;return i.includes(e.authority)?e.with({path:e.path.toLowerCase()}).toString(!0):e.toString(!0)}catch{return a.toString()}}var kJo=/^(.+\.)?localhost(:\d+)?$/i,EJo=/^127\.0\.0\.1(:\d+)?$/,TJo=/^(\[::1\]|\[0:0:0:0:0:0:0:1\])(:\d+)?$/;function bZe(a){return kJo.test(a)||EJo.test(a)||TJo.test(a)}var _Jo=/^0\.0\.0\.0(:\d+)?$/,DJo=/^(\[::\]|\[0:0:0:0:0:0:0:0\])(:\d+)?$/;function spo(a){return _Jo.test(a)||DJo.test(a)}var s8=le("ITrustedDomainService");var HRe=class extends k{constructor(e,t){super();this._instantiationService=e;this._storageService=t;this._onDidChangeTrustedDomains=this._register(new T);this.onDidChangeTrustedDomains=this._onDidChangeTrustedDomains.event;let o=()=>new uF(ut,()=>{let{defaultTrustedDomains:n,trustedDomains:r}=this._instantiationService.invokeFunction(VRe);return[...n,...r]});this._staticTrustedDomainsResult=o(),this._register(this._storageService.onDidChangeValue(-1,WRe,this._store)(()=>{this._staticTrustedDomainsResult?.dispose(),this._staticTrustedDomainsResult=o(),this._onDidChangeTrustedDomains.fire()}))}get trustedDomains(){return this._staticTrustedDomainsResult.value}isValid(e){let{defaultTrustedDomains:t,trustedDomains:o}=this._instantiationService.invokeFunction(VRe),n=[...t,...o];return mFt(e,n)}};HRe=I([m(0,F),m(1,de)],HRe);var Uwi=class{constructor(i,e,t,o){this.proxy=i;this.handle=e;this.extensionId=t;this.extensionDisplayName=o}async handleURL(i,e){return hi.equals(this.extensionId,i.authority)?(await this.proxy.$handleExternalUri(this.handle,i),!0):!1}},hFt=class extends k{constructor(e,t,o,n){super();this.urlService=o;this.extensionUrlHandler=n;this.handlers=new Map;this.proxy=e.getProxy(ao.ExtHostUrls)}async $registerUriHandler(e,t,o){let n=new Uwi(this.proxy,e,t,o),r=this.urlService.registerHandler(n);this.handlers.set(e,{extensionId:t,disposable:r}),this.extensionUrlHandler.registerExtensionHandler(t,n)}async $unregisterUriHandler(e){let t=this.handlers.get(e);if(!t)return;let{extensionId:o,disposable:n}=t;this.extensionUrlHandler.unregisterExtensionHandler(o),this.handlers.delete(e),n.dispose()}async $createAppUri(e){return this.urlService.create(e)}dispose(){super.dispose(),this.handlers.forEach(({disposable:e})=>e.dispose()),this.handlers.clear()}};hFt=I([fo(Xi.MainThreadUrls),m(1,s8),m(2,tS),m(3,Vwi)],hFt);var Lme="default",gFt="workbench.externalUriOpeners",zwi={type:"string",enum:[]},apo="\n- `https://microsoft.com`: Matches this specific domain using https\n- `https://microsoft.com:8080`: Matches this specific domain on this port using https\n- `https://microsoft.com:*`: Matches this specific domain on any port using https\n- `https://microsoft.com/foo`: Matches `https://microsoft.com/foo` and `https://microsoft.com/foo/bar`, but not `https://microsoft.com/foobar` or `https://microsoft.com/bar`\n- `https://*.microsoft.com`: Match all domains ending in `microsoft.com` using https\n- `microsoft.com`: Match this specific domain using either http or https\n- `*.microsoft.com`: Match all domains ending in `microsoft.com` using either http or https\n- `http://192.168.0.1`: Matches this specific IP using http\n- `http://192.168.0.*`: Matches all IP's with this prefix using http\n- `*`: Match all domains using either http or https",Kwi={...jd,properties:{[gFt]:{type:"object",markdownDescription:d(11956,null),defaultSnippets:[{body:{"example.com":"$1"}}],additionalProperties:{anyOf:[{type:"string",markdownDescription:d(11958,null,apo)},{type:"string",markdownDescription:d(11958,null,apo),enum:[Lme],enumDescriptions:[d(11957,null)]},zwi]}}}};function lpo(a,i){zwi.enum=a,zwi.enumDescriptions=i,oe.as($t.Configuration).notifyConfigurationSchemaUpdated(Kwi)}var Bee=class extends k{constructor(e,t){super();this._extensionService=t;this._openers=new Map;this._memento=new $l(Bee.STORAGE_ID,e),this._mementoObject=this._memento.getMemento(0,1);for(let[o,n]of Object.entries(this._mementoObject||{}))n&&this.add(o,n.extensionId,{isCurrentlyRegistered:!1});this.invalidateOpenersOnExtensionsChanged(),this._register(this._extensionService.onDidChangeExtensions(()=>this.invalidateOpenersOnExtensionsChanged())),this._register(this._extensionService.onDidChangeExtensionsStatus(()=>this.invalidateOpenersOnExtensionsChanged()))}static{this.STORAGE_ID="externalUriOpeners"}didRegisterOpener(e,t){this.add(e,t,{isCurrentlyRegistered:!0})}add(e,t,o){let n=this._openers.get(e);if(n){n.isCurrentlyRegistered=n.isCurrentlyRegistered||o.isCurrentlyRegistered;return}let r={extensionId:t,isCurrentlyRegistered:o.isCurrentlyRegistered};this._openers.set(e,r),this._mementoObject[e]=r,this._memento.saveMemento(),this.updateSchema()}delete(e){this._openers.delete(e),delete this._mementoObject[e],this._memento.saveMemento(),this.updateSchema()}async invalidateOpenersOnExtensionsChanged(){await this._extensionService.whenInstalledExtensionsRegistered();let e=this._extensionService.extensions;for(let[t,o]of this._openers){let n=e.find(r=>r.identifier.value===o.extensionId);n?this._extensionService.canRemoveExtension(n)||o.isCurrentlyRegistered||this.delete(t):this.delete(t)}}updateSchema(){let e=[],t=[];for(let[o,n]of this._openers)e.push(o),t.push(n.extensionId);lpo(e,t)}};Bee=I([m(0,de),m(1,lt)],Bee);var cpo=244;function URe(a){return{...a,override:Da.id,pinned:!0}}var Qo=le("preferencesService"),fFt="editor.contrib.defineKeybinding",zRe=".vscode/settings.json",SZe="workbench.settings.openDefaultSettings",IZe="workbench.settings.useSplitJSON",Gwi="workbench.settings.alwaysShowAdvancedSettings",KRe="settings";var Hee=le("externalUriOpenerService"),GRe=class extends k{constructor(e,t,o,n,r){super();this.configurationService=t;this.logService=o;this.preferencesService=n;this.quickInputService=r;this._providers=new ra;this._register(e.registerExternalOpener(this))}registerExternalOpenerProvider(e){return{dispose:this._providers.push(e)}}async getOpeners(e,t,o,n){let r=await this.getAllOpenersForUri(e);if(r.size===0)return[];if(o.preferredOpenerId){if(o.preferredOpenerId===Lme)return[];let u=r.get(o.preferredOpenerId);if(u)return[u]}let s=this.getConfiguredOpenerForUri(r,e);if(s)return s===Lme?[]:[s];let l=[];if(await Promise.all(Array.from(r.values()).map(async u=>{let p;try{p=await u.canOpen(o.sourceUri,n)}catch(h){this.logService.error(h);return}switch(p){case 1:case 2:case 3:l.push({opener:u,priority:p});break}})),l.length===0)return[];let c=l.filter(u=>u.priority===3).at(0);return c?[c.opener]:!t&&l.every(u=>u.priority===1)?[]:l.map(u=>u.opener)}async openExternal(e,t,o){let n=typeof e=="string"?A.parse(e):e,r=await this.getOpeners(n,!1,t,o);return r.length===0?!1:r.length===1?r[0].openExternalUri(n,t,o):this.showOpenerPrompt(r,n,t,o)}async getOpener(e,t,o){let n=await this.getOpeners(e,!0,t,o);if(n.length>=1)return n[0]}async getAllOpenersForUri(e){let t=new Map;return await Promise.all(yt.map(this._providers,async o=>{for await(let n of o.getOpeners(e))t.set(n.id,n)})),t}getConfiguredOpenerForUri(e,t){let o=this.configurationService.getValue(gFt)||{};for(let[n,r]of Object.entries(o))if(BRe(t,n)){if(r===Lme)return"default";let s=e.get(r);if(s)return s}}async showOpenerPrompt(e,t,o,n){let r=e.map(l=>({label:l.label,opener:l}));r.push({label:Ft?d(11961,null):d(11960,null),opener:void 0},{type:"separator"},{label:d(11959,null),opener:"configureDefault"});let s=await this.quickInputService.pick(r,{placeHolder:d(11962,null,t.toString())});return s?typeof s.opener>"u"?!1:s.opener==="configureDefault"?(await this.preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:gFt,edit:!0}}),!0):s.opener.openExternalUri(t,o,n):!0}};GRe=I([m(0,Je),m(1,B),m(2,re),m(3,Qo),m(4,$e)],GRe);var vFt=class extends k{constructor(e,t,o,n,r,s){super();this.extensionService=n;this.openerService=r;this.notificationService=s;this._registeredOpeners=new Map;this.proxy=e.getProxy(ao.ExtHostUriOpeners),this._register(o.registerExternalOpenerProvider(this)),this._contributedExternalUriOpenersStore=this._register(new Bee(t,n))}async*getOpeners(e){if(!(e.scheme!==Q.http&&e.scheme!==Q.https)){await this.extensionService.activateByEvent(`onOpenExternalUri:${e.scheme}`);for(let[t,o]of this._registeredOpeners)o.schemes.has(e.scheme)&&(yield this.createOpener(t,o))}}createOpener(e,t){return{id:e,label:t.label,canOpen:(o,n)=>this.proxy.$canOpenUri(e,o,n),openExternalUri:async(o,n,r)=>{try{await this.proxy.$openUri(e,{resolvedUri:o,sourceUri:n.sourceUri},r)}catch(s){if(!Yi(s)){let l=new it("default",d(3966,null),void 0,void 0,async()=>{await this.openerService.open(o,{allowTunneling:!1,allowContributedOpeners:Lme})});l.tooltip=o.toString(),this.notificationService.notify({severity:ft.Error,message:d(3965,null,e,s.toString()),actions:{primary:[l]}})}}return!0}}}async $registerUriOpener(e,t,o,n){if(this._registeredOpeners.has(e))throw new Error(`Opener with id '${e}' already registered`);this._registeredOpeners.set(e,{schemes:new Set(t),label:n,extensionId:o}),this._contributedExternalUriOpenersStore.didRegisterOpener(e,o.value)}async $unregisterUriOpener(e){this._registeredOpeners.delete(e),this._contributedExternalUriOpenersStore.delete(e)}dispose(){super.dispose(),this._registeredOpeners.clear()}};vFt=I([fo(Xi.MainThreadUriOpeners),m(1,de),m(2,Hee),m(3,lt),m(4,Je),m(5,Ne)],vFt);var qwi=class{constructor(){this.todo=[];this.add=i=>{this.todo.push(i)}}take(i,e){this.add=t=>e.createInstance(t,i),this.todo.forEach(this.add),this.todo=[]}},bFt=new qwi;var RJo=1e4,Mme=le("IUserActivityService"),yZe=class extends k{constructor(e){super();this.markInactive=this._register(new Dt(()=>{this.isActive=!1,this.changeEmitter.fire(!1)},RJo));this.changeEmitter=this._register(new T);this.active=0;this.isActive=!0;this.onDidChangeIsActive=this.changeEmitter.event;this._register(TL(()=>bFt.take(this,e)))}markActive(e){if(e?.extendOnly&&!this.isActive)return k.None;if(e?.whenHeldFor){let t=new O;return t.add(Zo(()=>t.add(this.markActive()),e.whenHeldFor)),t}return++this.active===1&&(this.isActive=!0,this.changeEmitter.fire(!0),this.markInactive.cancel()),ee(()=>{--this.active===0&&this.markInactive.schedule()})}};yZe=I([m(0,F)],yZe);Ce(Mme,yZe,1);var SFt=class{constructor(i,e,t,o){this.hostService=e;this.openerService=t;this.userActivityService=o;this.disposables=new O;this.proxy=i.getProxy(ao.ExtHostWindow),U.latch(e.onDidChangeFocus)(this.proxy.$onDidChangeWindowFocus,this.proxy,this.disposables),o.onDidChangeIsActive(this.proxy.$onDidChangeWindowActive,this.proxy,this.disposables),this.registerNativeHandle()}dispose(){this.disposables.dispose()}registerNativeHandle(){U.latch(this.hostService.onDidChangeActiveWindow)(async i=>{let e=await this.hostService.getNativeWindowHandle(i);this.proxy.$onDidChangeActiveNativeWindowHandle(e?gc(e):void 0)},this,this.disposables)}$getInitialState(){return Promise.resolve({isFocused:this.hostService.hasFocus,isActive:this.userActivityService.isActive})}async $openUri(i,e,t){let o=A.from(i),n;return e&&A.parse(e).toString()===o.toString()?n=e:n=o,this.openerService.open(n,{openExternal:!0,allowTunneling:t.allowTunneling,allowContributedOpeners:t.allowContributedOpeners})}async $asExternalUri(i,e){return(await this.openerService.resolveExternalUri(A.revive(i),e)).resolved}};SFt=I([fo(Xi.MainThreadWindow),m(1,ti),m(2,Je),m(3,Mme)],SFt);var IFt=le("powerService");var yFt=class extends k{constructor(e,t){super();this.powerService=t;this.proxy=e.getProxy(ao.ExtHostPower),this._register(this.powerService.onDidSuspend(this.proxy.$onDidSuspend,this.proxy)),this._register(this.powerService.onDidResume(this.proxy.$onDidResume,this.proxy)),this._register(this.powerService.onDidChangeOnBatteryPower(this.proxy.$onDidChangeOnBatteryPower,this.proxy)),this._register(this.powerService.onDidChangeThermalState(o=>this.proxy.$onDidChangeThermalState(o),this)),this._register(this.powerService.onDidChangeSpeedLimit(this.proxy.$onDidChangeSpeedLimit,this.proxy)),this._register(this.powerService.onWillShutdown(this.proxy.$onWillShutdown,this.proxy)),this._register(this.powerService.onDidLockScreen(this.proxy.$onDidLockScreen,this.proxy)),this._register(this.powerService.onDidUnlockScreen(this.proxy.$onDidUnlockScreen,this.proxy))}async $getSystemIdleState(e){return this.powerService.getSystemIdleState(e)}async $getSystemIdleTime(){return this.powerService.getSystemIdleTime()}async $getCurrentThermalState(){return this.powerService.getCurrentThermalState()}async $isOnBatteryPower(){return this.powerService.isOnBatteryPower()}async $startPowerSaveBlocker(e){return this.powerService.startPowerSaveBlocker(e)}async $stopPowerSaveBlocker(e){return this.powerService.stopPowerSaveBlocker(e)}async $isPowerSaveBlockerStarted(e){return this.powerService.isPowerSaveBlockerStarted(e)}};yFt=I([fo(Xi.MainThreadPower),m(1,IFt)],yFt);function dpo(a){return a.side==="original"?a.originalResource:a.modifiedResource}var Sf=class extends X0{constructor(e,t,o,n,r,s,l,c,u){super({providedId:e.viewType,viewType:e.viewType,name:e.label??"",iconPath:e.iconPath},t,o,n);this.init=e;this.instantiationService=r;this.customEditorService=s;this.filesConfigurationService=l;this.fileDialogService=c;this.undoRedoService=u;this._modelRef=this._register(new ue);this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire()))}static create(e,t,o){return e.invokeFunction(n=>{let r=n.get(Pu).createWebviewOverlay({providedViewType:t.viewType,title:t.label,options:{},contentOptions:{},extension:void 0}),s=e.createInstance(Sf,t,r);return o&&s.updateGroup(o.id),s})}static{this.typeId="workbench.editors.customDiffEditor"}get typeId(){return Sf.typeId}get editorId(){return this.viewType}get capabilities(){let e=136;return this.isReadonly()&&(e|=2),e}get resource(){return this.modifiedResource}get originalResource(){return this.init.originalResource}get modifiedResource(){return this.init.modifiedResource}getName(){return this.init.label??d(10373,null,Be(this.originalResource),Be(this.modifiedResource))}getDescription(e){return this.init.description??super.getDescription()}getTitle(e){let t=this.getDescription(e);return t?d(10374,null,this.getName(),t):this.getName()}isReadonly(){let e=this._modelRef.value;return e?e.object.isReadonly():this.filesConfigurationService.isReadonly(this.modifiedResource)}isDirty(){return this._modelRef.value?.object.isDirty()??!1}matches(e){return this===e?!0:e instanceof Sf?this.viewType===e.viewType&&ze(this.originalResource,e.originalResource)&&ze(this.modifiedResource,e.modifiedResource):ya(e)?!1:Ug(e)?e.options?.override===this.viewType&&ze(this.originalResource,e.original.resource)&&ze(this.modifiedResource,e.modified.resource):!1}copy(){return Sf.create(this.instantiationService,this.init,void 0)}async save(e,t){let o=this._modelRef.value;if(!o)return;let n=await o.object.saveCustomEditor(t);if(n)return ze(n,this.modifiedResource)?this:this.toUntypedWithModifiedResource(n)}async saveAs(e,t){let o=this._modelRef.value;if(!o)return;let n=await this.fileDialogService.pickFileToSave(this.modifiedResource,t?.availableFileSystems);if(n&&await o.object.saveCustomEditorAs(this.modifiedResource,n,t))return this.toUntypedWithModifiedResource(n)}async revert(e,t){await this._modelRef.value?.object.revert(t)}async resolve(){if(await super.resolve(),this.isDisposed())return null;if(!this._modelRef.value){let e=this.customEditorService.models.tryRetain(this.modifiedResource,this.viewType);if(e){let t=this.capabilities,o=await e;if(this.isDisposed())return o.dispose(),null;this._modelRef.value=o,this._register(o.object.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(o.object.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this.isDirty()&&this._onDidChangeDirty.fire(),this.capabilities!==t&&this._onDidChangeCapabilities.fire()}}return null}undo(){return this.undoRedoService.undo(this.modifiedResource)}redo(){return this.undoRedoService.redo(this.modifiedResource)}toUntyped(e){return this.toUntypedWithModifiedResource(this.modifiedResource)}toUntypedWithModifiedResource(e){return{original:{resource:this.originalResource},modified:{resource:e},label:this.init.label,description:this.init.description,options:{override:this.viewType}}}};Sf=I([m(2,Pe),m(3,Hx),m(4,F),m(5,FH),m(6,fr),m(7,nn),m(8,wl)],Sf);var rg=class extends X0{constructor(e,t,o,n,r,s,l,c,u){super({providedId:e.viewType,viewType:e.viewType,name:Be(dpo(e)),iconPath:e.iconPath},t,o,n);this.init=e;this.instantiationService=r;this.customEditorService=s;this.filesConfigurationService=l;this.fileDialogService=c;this.undoRedoService=u;this._modelRef=this._register(new ue);this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire()))}static create(e,t,o){return e.invokeFunction(n=>{let r=n.get(Pu).createWebviewOverlay({providedViewType:t.viewType,title:Be(dpo(t)),options:{},contentOptions:{},extension:void 0}),s=e.createInstance(rg,t,r);return o&&s.updateGroup(o.id),s})}static{this.typeId="workbench.editors.customSideBySideDiffEditor"}get typeId(){return rg.typeId}get editorId(){return this.viewType}get capabilities(){let e=136;return this.isReadonly()&&(e|=2),e}get resource(){return this.side==="original"?this.originalResource:this.modifiedResource}get originalResource(){return this.init.originalResource}get modifiedResource(){return this.init.modifiedResource}get side(){return this.init.side}get diffId(){return this.init.diffId}getName(){return Be(this.resource)}getDescription(e){return this.init.description??super.getDescription()}getTitle(e){let t=this.getDescription(e);return t?d(10375,null,this.getName(),t):this.getName()}isReadonly(){if(this.side==="original")return!0;let e=this._modelRef.value;return e?e.object.isReadonly():this.filesConfigurationService.isReadonly(this.modifiedResource)}isDirty(){return this.side==="modified"?this._modelRef.value?.object.isDirty()??!1:!1}matches(e){return this===e?!0:e instanceof rg?this.editorId===e.editorId&&this.side===e.side&&ze(this.originalResource,e.originalResource)&&ze(this.modifiedResource,e.modifiedResource):ya(e)?!1:zg(e)?ze(this.resource,e.resource):!1}copy(){return rg.create(this.instantiationService,this.init,void 0)}async save(e,t){let o=this._modelRef.value;if(!o)return;let n=await o.object.saveCustomEditor(t);if(n)return ze(n,this.modifiedResource)?this:{resource:n}}async saveAs(e,t){let o=this._modelRef.value;if(!o)return;let n=await this.fileDialogService.pickFileToSave(this.modifiedResource,t?.availableFileSystems);if(n&&await o.object.saveCustomEditorAs(this.modifiedResource,n,t))return{resource:n}}async revert(e,t){await this._modelRef.value?.object.revert(t)}async resolve(){if(await super.resolve(),this.isDisposed())return null;if(this.side==="modified"&&!this._modelRef.value){let e=this.customEditorService.models.tryRetain(this.modifiedResource,this.viewType);if(e){let t=this.capabilities,o=await e;if(this.isDisposed())return o.dispose(),null;this._modelRef.value=o,this._register(o.object.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this._register(o.object.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this.isDirty()&&this._onDidChangeDirty.fire(),this.capabilities!==t&&this._onDidChangeCapabilities.fire()}}return null}undo(){return this.undoRedoService.undo(this.modifiedResource)}redo(){return this.undoRedoService.redo(this.modifiedResource)}toUntyped(e){return{resource:this.resource}}};rg=I([m(2,Pe),m(3,Hx),m(4,F),m(5,FH),m(6,fr),m(7,nn),m(8,wl)],rg);var Uee=class extends k{constructor(e,t,o,n,r,s){super();this.viewType=e;this._resource=t;this._model=o;this.textFileService=n;this._labelService=r;this._onDidChangeOrphaned=this._register(new T);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidChangeReadonly=this._register(new T);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._register(o),this._textFileModel=this.textFileService.files.get(t),this._textFileModel&&(this._register(this._textFileModel.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire())),this._register(this._textFileModel.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))),this._register(this.textFileService.files.onDidChangeDirty(l=>{ze(this.resource,l.resource)&&(this._onDidChangeDirty.fire(),this._onDidChangeContent.fire())})),this._register(s.onWillStop(l=>{l.veto(!0,d(10381,null,this.name))}))}static async create(e,t,o){return e.invokeFunction(async n=>{let s=await n.get(Bt).createModelReference(o);return e.createInstance(Uee,t,o,s)})}get resource(){return this._resource}get name(){return Jo(this._labelService.getUriLabel(this._resource))}isReadonly(){return this._model.object.isReadonly()}get backupId(){}get canHotExit(){return!0}isDirty(){return this.textFileService.isDirty(this.resource)}isOrphaned(){return!!this._textFileModel?.hasState(4)}async revert(e){return this.textFileService.revert(this.resource,e)}saveCustomEditor(e){return this.textFileService.save(this.resource,e)}async saveCustomEditorAs(e,t,o){return!!await this.textFileService.saveAs(e,t,o)}};Uee=I([m(3,Uo),m(4,nt),m(5,lt)],Uee);var zee=class extends k{constructor(e,t){super();this.resource=e;this.fileService=t;this._onDidChangeOrphaned=this._register(new T);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this.orphaned=!1;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this._register(this.fileService.onDidFilesChange(o=>this.onDidFilesChange(o)))}isOrphaned(){return this.orphaned}async onDidFilesChange(e){let t=!1,o;if(this.orphaned?e.contains(this.resource,1)&&(o=!1,t=!0):e.contains(this.resource,2)&&(o=!0,t=!0),t&&this.orphaned!==o){let n=!1;o&&(await Li(100,Ie.None),this.isDisposed()?n=!0:n=!await this.fileService.exists(this.resource)),this.orphaned!==n&&!this.isDisposed()&&this.setOrphaned(n)}}setOrphaned(e){this.orphaned!==e&&(this.orphaned=e,this._onDidChangeOrphaned.fire())}isDisposed(){return this._store.isDisposed}dispose(){this.orphaned=!1,this._onWillDispose.fire(),super.dispose()}isModified(){return this.isDirty()}};zee=I([m(1,ge)],zee);var $Re=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.mainThreadWebview=t;this.mainThreadWebviewPanels=o;this._customEditorService=c;this._editorGroupService=u;this._editorService=p;this._instantiationService=h;this._webviewWorkbenchService=g;this._uriIdentityService=f;this._untitledTextEditorService=v;this._editorProviders=this._register(new Ot);this._editorRenameBackups=new Map;this._pendingSideBySideDiffResolutions=new Map;this._webviewOriginStore=new q0("mainThreadCustomEditors.origins",r),this._proxyCustomEditors=e.getProxy(ao.ExtHostCustomEditors),this._register(l.registerWorkingCopyProvider(b=>{let S=[];for(let y of s.workingCopies)y instanceof XH&&Yr(b,y.editorResource)&&S.push(y);return S})),this._register(g.registerResolver({canResolve:b=>((b instanceof pp||b instanceof Sf||b instanceof rg)&&n.activateByEvent(`onCustomEditor:${b.viewType}`),!1),resolveWebview:()=>{throw new Error("not implemented")}})),this._register(l.onWillRunWorkingCopyFileOperation(async b=>this.onWillRunWorkingCopyFileOperation(b)))}$registerTextEditorProvider(e,t,o,n,r){this.registerEditorProvider(1,zpe(e),t,o,n,!0,r)}$registerCustomEditorProvider(e,t,o,n,r,s){this.registerEditorProvider(0,zpe(e),t,o,n,r,s)}registerEditorProvider(e,t,o,n,r,s,l){if(this._editorProviders.has(o))throw new Error(`Provider for ${o} already registered`);let c=new O;c.add(this._customEditorService.registerCustomEditorCapabilities(o,{supportsMultipleEditorsPerDocument:s,isTextEditor:e===1,supportsInlineDiff:r.supportsInlineDiff,supportsSideBySideDiff:r.supportsSideBySideDiff})),c.add(this._webviewWorkbenchService.registerResolver({canResolve:u=>(u instanceof pp||u instanceof Sf||u instanceof rg)&&u.viewType===o,resolveWebview:async(u,p)=>{if(!(u instanceof pp||u instanceof Sf||u instanceof rg))return;let h=ht();u.webview.origin=this._webviewOriginStore.getOrigin(o,t.id),this.mainThreadWebviewPanels.addWebviewInput(h,u,{serializeBuffersForPostMessage:l}),u.webview.options=n,u.webview.extension=t;let g=u instanceof Sf?u.modifiedResource:u.resource,f;u instanceof pp&&(f=u.backupId,u.oldResource&&!u.backupId&&(f=this._editorRenameBackups.get(u.oldResource.toString())?.backupId,this._editorRenameBackups.delete(u.oldResource.toString())));let v,b=new O;try{if(v=await this.getOrCreateCustomEditorModel(e,g,o,{backupId:f},p),u instanceof Sf&&!ze(u.originalResource,g))b.add(await this.getOrCreateCustomEditorModel(e,u.originalResource,o,{},p));else if(e===1&&u instanceof rg){let E=u.side==="original"?u.modifiedResource:u.originalResource;ze(E,g)||b.add(await this.getOrCreateCustomEditorModel(e,E,o,{},p))}}catch(E){mt(E),u.webview.setHtml(this.mainThreadWebview.getWebviewResolvedFailedContent(o)),b.dispose(),v?.dispose();return}if(!v){b.dispose();return}let S=v;if(p.isCancellationRequested){b.dispose(),S.dispose();return}let y=()=>{if(b.dispose(),S.object.isDirty()){let E=S.object.onDidChangeDirty(()=>{S.object.isDirty()||(E.dispose(),S.dispose())});return}S.dispose()},w=u.webview.onDidDispose(()=>{w.dispose(),x.dispose(),y()}),x=u.onWillDispose(()=>{x.dispose(),w.dispose(),y()});u instanceof pp&&r.supportsMove&&u.onMove(async E=>{let M=S;S=await this.getOrCreateCustomEditorModel(e,E,o,{},Ie.None),this._proxyCustomEditors.$onMoveCustomEditor(h,E,o),M.dispose()});try{let E={title:u.getTitle(),contentOptions:u.webview.contentOptions,options:u.webview.options,active:u===this._editorService.activeEditor},M=Fx(this._editorGroupService,u.group||0);if(u instanceof Sf){let N=e===1?this._uriIdentityService.asCanonicalUri(u.originalResource):u.originalResource,V=e===1?this._uriIdentityService.asCanonicalUri(u.modifiedResource):u.modifiedResource;await this._proxyCustomEditors.$resolveCustomEditorInlineDiff(N,V,h,o,E,M,p)}else if(u instanceof rg)await this.resolveCustomEditorSideBySideDiff(e,u,h,o,E,M,p);else{let N=e===1?this._uriIdentityService.asCanonicalUri(g):g;await this._proxyCustomEditors.$resolveCustomEditor(N,h,o,E,M,p)}}catch(E){mt(E),u.webview.setHtml(this.mainThreadWebview.getWebviewResolvedFailedContent(o)),b.dispose(),S.dispose();return}}})),this._editorProviders.set(o,c)}resolveCustomEditorSideBySideDiff(e,t,o,n,r,s,l){let c=this._pendingSideBySideDiffResolutions.get(t.diffId);c||(c={promise:new Mo,cancellation:new qe,disposables:new O},this._pendingSideBySideDiffResolutions.set(t.diffId,c));let u=()=>{this._pendingSideBySideDiffResolutions.delete(t.diffId),c.disposables.dispose(),c.cancellation.dispose()};return c.disposables.add(l.onCancellationRequested(()=>{c.cancellation.cancel(),c.started||(c.promise.cancel(),u())})),c[t.side]={handle:o,initData:r},c.original&&c.modified&&!c.started&&(c.started=!0,c.promise.settleWith((async()=>{try{let p=e===1?this._uriIdentityService.asCanonicalUri(t.originalResource):t.originalResource,h=e===1?this._uriIdentityService.asCanonicalUri(t.modifiedResource):t.modifiedResource;await this._proxyCustomEditors.$resolveCustomEditorSideBySideDiff(p,h,{original:c.original.handle,modified:c.modified.handle},n,{original:c.original.initData,modified:c.modified.initData},s,c.cancellation.token)}finally{u()}})())),c.promise.p}$unregisterEditorProvider(e){if(!this._editorProviders.has(e))throw new Error(`No provider for ${e} registered`);this._editorProviders.deleteAndDispose(e),this._customEditorService.models.disposeAllModelsForView(e)}async getOrCreateCustomEditorModel(e,t,o,n,r){let s=this._customEditorService.models.tryRetain(t,o);if(s)return s;switch(e){case 1:{let l=Uee.create(this._instantiationService,o,t);return this._customEditorService.models.add(t,o,l)}case 0:{let l=XH.create(this._instantiationService,this._proxyCustomEditors,o,t,n,this._untitledTextEditorService,()=>Array.from(this.mainThreadWebviewPanels.webviewInputs).filter(c=>c instanceof pp&&ze(c.resource,t)||c instanceof Sf&&(ze(c.originalResource,t)||ze(c.modifiedResource,t))||c instanceof rg&&ze(c.resource,t)),r);return this._customEditorService.models.add(t,o,l)}}}async $onDidEdit(e,t,o,n){(await this.getCustomEditorModel(e,t)).pushEdit(o,n)}async $onContentChange(e,t){(await this.getCustomEditorModel(e,t)).changeContent()}async getCustomEditorModel(e,t){let o=A.revive(e),n=await this._customEditorService.models.get(o,t);if(!n||!(n instanceof XH))throw new Error("Could not find model for webview editor");return n}async onWillRunWorkingCopyFileOperation(e){e.operation===2&&e.waitUntil((async()=>{let t=[];for(let o of e.files)o.source&&t.push(...await this._customEditorService.models.getAllModels(o.source));for(let o of t)if(o instanceof XH&&o.isDirty()){let n=await o.backup(Ie.None);n.meta&&this._editorRenameBackups.set(o.editorResource.toString(),n.meta)}})())}};$Re=I([m(3,lt),m(4,de),m(5,$a),m(6,gm),m(7,FH),m(8,kt),m(9,ie),m(10,F),m(11,Hx),m(12,gt),m(13,yE)],$Re);var qRe;(o=>{let a;(l=>(l[l.Allowed=0]="Allowed",l[l.NotAllowed=1]="NotAllowed",l[l.Pending=2]="Pending"))(a=o.Type||={}),o.Allowed=Object.freeze({type:0}),o.NotAllowed=Object.freeze({type:1});class t{constructor(r){this.operation=r;this.type=2}}o.Pending=t})(qRe||={});var XH=class extends zee{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(XH.toWorkingCopyResource(t,o),u);this._proxy=e;this._viewType=t;this._editorResource=o;this._editable=r;this._getEditors=l;this._fileDialogService=c;this._labelService=p;this._undoService=h;this._environmentService=g;this._pathService=v;this._fromBackup=!1;this._hotExitState=qRe.Allowed;this._currentEditIndex=-1;this._savePoint=-1;this._edits=[];this.typeId=vN;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this.onDidChangeReadonly=U.None;this._fromBackup=n,this._isDirtyFromContentChange=s,r&&(this._register(f.registerWorkingCopy(this)),this._register(b.onWillStop(S=>{S.veto(!0,d(3911,null,this.name))})))}static async create(e,t,o,n,r,s,l,c){let u=l(),p,h=u.find(f=>f instanceof pp);h&&(p=h.untitledDocumentData);let{editable:g}=await t.$createCustomDocument(n,o,r.backupId,p,c);return p&&n.scheme===Q.untitled&&s.get(n)?.revert(),e.createInstance(XH,t,o,n,!!r.backupId,g,!!p,l)}get editorResource(){return this._editorResource}dispose(){this._editable&&this._undoService.removeElements(this._editorResource),this._proxy.$disposeCustomDocument(this._editorResource,this._viewType),super.dispose()}static toWorkingCopyResource(e,t){let o=e.replace(/[^a-z0-9\-_]/gi,"-"),n=`/${dY(t.with({query:null,fragment:null}).toString(!0))}`;return A.from({scheme:Q.vscodeCustomEditor,authority:o,path:n,query:JSON.stringify(t.toJSON())})}get name(){return Jo(this._labelService.getUriLabel(this._editorResource))}get capabilities(){return this.isUntitled()?2:0}isDirty(){return this._isDirtyFromContentChange?!0:this._edits.length>0?this._savePoint!==this._currentEditIndex:this._fromBackup}isUntitled(){return this._editorResource.scheme===Q.untitled}isReadonly(){return!this._editable}get viewType(){return this._viewType}get backupId(){return this._backupId}pushEdit(e,t){if(!this._editable)throw new Error("Document is not editable");this.change(()=>{this.spliceEdits(e),this._currentEditIndex=this._edits.length-1}),this._undoService.pushElement({type:0,resource:this._editorResource,label:t??d(3910,null),code:"undoredo.customEditorEdit",undo:()=>this.undo(),redo:()=>this.redo()})}changeContent(){this.change(()=>{this._isDirtyFromContentChange=!0})}async undo(){if(!this._editable||this._currentEditIndex<0)return;let e=this._edits[this._currentEditIndex];this.change(()=>{--this._currentEditIndex}),await this._proxy.$undo(this._editorResource,this.viewType,e,this.isDirty())}async redo(){if(!this._editable||this._currentEditIndex>=this._edits.length-1)return;let e=this._edits[this._currentEditIndex+1];this.change(()=>{++this._currentEditIndex}),await this._proxy.$redo(this._editorResource,this.viewType,e,this.isDirty())}spliceEdits(e){let t=this._currentEditIndex+1,o=this._edits.length-this._currentEditIndex,n=typeof e=="number"?this._edits.splice(t,o,e):this._edits.splice(t,o);n.length&&this._proxy.$disposeEdits(this._editorResource,this._viewType,n)}change(e){let t=this.isDirty();e(),this._onDidChangeContent.fire(),this.isDirty()!==t&&this._onDidChangeDirty.fire()}async revert(e){this._editable&&(this._currentEditIndex===this._savePoint&&!this._isDirtyFromContentChange&&!this._fromBackup||(e?.soft||this._proxy.$revert(this._editorResource,this.viewType,Ie.None),this.change(()=>{this._isDirtyFromContentChange=!1,this._fromBackup=!1,this._currentEditIndex=this._savePoint,this.spliceEdits()})))}async save(e){let t=!!await this.saveCustomEditor(e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),t}async saveCustomEditor(e){if(!this._editable)return;if(this.isUntitled()){let o=await this.suggestUntitledSavePath(e);return o?(await this.saveCustomEditorAs(this._editorResource,o,e),o):void 0}let t=Hn(o=>this._proxy.$onSave(this._editorResource,this.viewType,o));this._ongoingSave?.cancel(),this._ongoingSave=t;try{await t,this._ongoingSave===t&&this.change(()=>{this._isDirtyFromContentChange=!1,this._savePoint=this._currentEditIndex,this._fromBackup=!1})}finally{this._ongoingSave===t&&(this._ongoingSave=void 0)}return this._editorResource}suggestUntitledSavePath(e){if(!this.isUntitled())throw new Error("Resource is not untitled");let t=this._environmentService.remoteAuthority,o=Nf(this._editorResource,t,this._pathService.defaultUriScheme);return this._fileDialogService.pickFileToSave(o,e?.availableFileSystems)}async saveCustomEditorAs(e,t,o){return this._editable?(await Hn(n=>this._proxy.$onSaveAs(this._editorResource,this.viewType,t,n)),this.change(()=>{this._isDirtyFromContentChange=!1,this._savePoint=this._currentEditIndex,this._fromBackup=!1}),!0):(await this.fileService.copy(e,t,!1),!0)}get canHotExit(){return typeof this._backupId=="string"&&this._hotExitState.type===0}async backup(e){let t=this._getEditors();if(!t.length)throw new Error("No editors found for resource, cannot back up");let o=t[0],r={meta:{viewType:this.viewType,editorResource:this._editorResource,customTitle:o.getWebviewTitle(),iconPath:o.iconPath,backupId:"",extension:o.extension?{id:o.extension.id.value,location:o.extension.location}:void 0,webview:{origin:o.webview.origin,options:o.webview.options,state:o.webview.state}}};if(!this._editable)return r;this._hotExitState.type===2&&this._hotExitState.operation.cancel();let s=new qRe.Pending(Hn(c=>this._proxy.$backup(this._editorResource.toJSON(),this.viewType,c)));this._hotExitState=s,e.onCancellationRequested(()=>{s.operation.cancel()});let l="";try{let c=await s.operation;this._hotExitState===s&&(this._hotExitState=qRe.Allowed,r.meta.backupId=c,this._backupId=c)}catch(c){if(Yi(c))throw c;this._hotExitState===s&&(this._hotExitState=qRe.NotAllowed),c.message&&(l=c.message)}if(this._hotExitState===qRe.Allowed)return r;throw new Error(`Cannot backup in this state: ${l}`)}};XH=I([m(7,nn),m(8,ge),m(9,nt),m(10,wl),m(11,Mt),m(12,$a),m(13,Pn),m(14,lt)],XH);var $wi=class{constructor(){this._handlesToInputs=new Map;this._inputsToHandles=new Map}add(i,e){this._handlesToInputs.set(i,e),this._inputsToHandles.set(e,i)}getHandleForInput(i){return this._inputsToHandles.get(i)}getInputForHandle(i){return this._handlesToInputs.get(i)}delete(i){let e=this.getInputForHandle(i);this._handlesToInputs.delete(i),e&&this._inputsToHandles.delete(e)}get size(){return this._handlesToInputs.size}[Symbol.iterator](){return this._handlesToInputs.values()}},jwi=class{constructor(i){this.prefix=i}fromExternal(i){return this.prefix+i}toExternal(i){return i.startsWith(this.prefix)?i.substr(this.prefix.length):void 0}},jRe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._mainThreadWebviews=t;this._configurationService=o;this._editorGroupService=n;this._editorService=r;this._webviewWorkbenchService=c;this.webviewPanelViewType=new jwi("mainThreadWebview-");this._webviewInputs=new $wi;this._revivers=this._register(new Ot);this.webviewOriginStore=new q0("mainThreadWebviewPanel.origins",l),this._proxy=e.getProxy(ao.ExtHostWebviewPanels),this._register(U.any(r.onDidActiveEditorChange,r.onDidVisibleEditorsChange,n.onDidAddGroup,n.onDidRemoveGroup,n.onDidMoveGroup)(()=>{this.updateWebviewViewStates(this._editorService.activeEditor)})),this._register(c.onDidChangeActiveWebviewEditor(u=>{this.updateWebviewViewStates(u)})),this._register(c.registerResolver({canResolve:u=>{let p=this.webviewPanelViewType.toExternal(u.viewType);return typeof p=="string"&&s.activateByEvent(`onWebviewPanel:${p}`),!1},resolveWebview:()=>{throw new Error("not implemented")}}))}get webviewInputs(){return this._webviewInputs}addWebviewInput(e,t,o){this._webviewInputs.add(e,t),this._mainThreadWebviews.addWebview(e,t.webview,o);let n=t.webview.onDidDispose(()=>{n.dispose(),this._proxy.$onDidDisposeWebviewPanel(e).finally(()=>{this._webviewInputs.delete(e)})})}$createWebviewPanel(e,t,o,n,r){let s=this.getTargetGroupFromShowOptions(r),l=r?{preserveFocus:!!r.preserveFocus,group:s}:{},c=zpe(e),u=this.webviewOriginStore.getOrigin(o,c.id),p=this._webviewWorkbenchService.openWebview({origin:u,providedViewType:o,title:n.title,options:MJo(n.panelOptions),contentOptions:IDe(n.webviewOptions),extension:c},this.webviewPanelViewType.fromExternal(o),n.title,void 0,l);this.addWebviewInput(t,p,{serializeBuffersForPostMessage:n.serializeBuffersForPostMessage})}$disposeWebview(e){let t=this.tryGetWebviewInput(e);t&&t.dispose()}$setTitle(e,t){this.tryGetWebviewInput(e)?.setWebviewTitle(t)}$setIconPath(e,t){let o=this.tryGetWebviewInput(e);o&&(o.iconPath=LJo(t))}$reveal(e,t){let o=this.tryGetWebviewInput(e);if(!o||o.isDisposed())return;let n=this.getTargetGroupFromShowOptions(t);this._webviewWorkbenchService.revealWebview(o,n,!!t.preserveFocus)}getTargetGroupFromShowOptions(e){if(typeof e.viewColumn>"u"||e.viewColumn===tr||this._editorGroupService.count===1&&this._editorGroupService.activeGroup.isEmpty)return tr;if(e.viewColumn===En)return En;if(e.viewColumn>=0){let t=this._editorGroupService.getGroups(2)[e.viewColumn];if(t)return t.id;let o=this._editorGroupService.findGroup({location:1});if(o){let n=Zy(this._configurationService);return this._editorGroupService.addGroup(o,n)}}return tr}$registerSerializer(e,t){if(this._revivers.has(e))throw new Error(`Reviver for ${e} already registered`);this._revivers.set(e,this._webviewWorkbenchService.registerResolver({canResolve:o=>o.viewType===this.webviewPanelViewType.fromExternal(e),resolveWebview:async o=>{let n=this.webviewPanelViewType.toExternal(o.viewType);if(!n){o.webview.setHtml(this._mainThreadWebviews.getWebviewResolvedFailedContent(o.viewType));return}let r=ht();this.addWebviewInput(r,o,t);let s;if(o.webview.state)try{s=JSON.parse(o.webview.state)}catch(l){console.error("Could not load webview state",l,o.webview.state)}try{await this._proxy.$deserializeWebviewPanel(r,n,{title:o.getTitle(),state:s,panelOptions:o.webview.options,webviewOptions:o.webview.contentOptions,active:o===this._editorService.activeEditor},Fx(this._editorGroupService,o.group||0))}catch(l){mt(l),o.webview.setHtml(this._mainThreadWebviews.getWebviewResolvedFailedContent(n))}}}))}$unregisterSerializer(e){if(!this._revivers.has(e))throw new Error(`No reviver for ${e} registered`);this._revivers.deleteAndDispose(e)}updateWebviewViewStates(e){if(!this._webviewInputs.size)return;let t={},o=(n,r,s)=>{if(!(s instanceof up))return;s.updateGroup(n.id);let l=this._webviewInputs.getHandleForInput(s);l&&(t[l]={visible:r===n.activeEditor,active:s===e,position:Fx(this._editorGroupService,n.id)})};for(let n of this._editorGroupService.groups)for(let r of n.editors)r instanceof Ba?(o(n,r,r.primary),o(n,r,r.secondary)):o(n,r,r);Object.keys(t).length&&this._proxy.$onDidChangeWebviewPanelViewStates(t)}tryGetWebviewInput(e){return this._webviewInputs.getInputForHandle(e)}};jRe=I([m(2,B),m(3,kt),m(4,ie),m(5,lt),m(6,de),m(7,Hx)],jRe);function LJo(a){if(a)return q.isThemeIcon(a)?a:{light:A.revive(a.light),dark:A.revive(a.dark)}}function MJo(a){return{enableFindWidget:a.enableFindWidget,retainContextWhenHidden:a.retainContextWhenHidden}}var QRe=le("webviewViewService"),wFt=class extends k{constructor(){super(...arguments);this._resolvers=new Map;this._awaitingRevival=new Map;this._onNewResolverRegistered=this._register(new T);this.onNewResolverRegistered=this._onNewResolverRegistered.event}register(e,t){if(this._resolvers.has(e))throw new Error(`View resolver already registered for ${e}`);this._resolvers.set(e,t),this._onNewResolverRegistered.fire({viewType:e});let o=this._awaitingRevival.get(e);return o&&t.resolve(o.webview,Ie.None).then(()=>{this._awaitingRevival.delete(e),o.resolve()}),ee(()=>{this._resolvers.delete(e)})}resolve(e,t,o){let n=this._resolvers.get(e);if(!n){if(this._awaitingRevival.has(e))throw new Error("View already awaiting revival");let{promise:r,resolve:s}=Ey();return this._awaitingRevival.set(e,{webview:t,resolve:s}),r}return n.resolve(t,o)}};var YRe=class extends k{constructor(e,t,o,n){super();this.mainThreadWebviews=t;this._telemetryService=o;this._webviewViewService=n;this._webviewViews=this._register(new Ot);this._webviewViewProviders=this._register(new Ot);this._proxy=e.getProxy(ao.ExtHostWebviewViews)}$setWebviewViewTitle(e,t){let o=this.getWebviewView(e);o.title=t}$setWebviewViewDescription(e,t){let o=this.getWebviewView(e);o.description=t}$setWebviewViewBadge(e,t){let o=this.getWebviewView(e);o.badge=t}$show(e,t){this.getWebviewView(e).show(t)}$registerWebviewViewProvider(e,t,o){if(this._webviewViewProviders.has(t))throw new Error(`View provider for ${t} already registered`);let n=zpe(e),r=this._webviewViewService.register(t,{resolve:async(s,l)=>{let c=ht();this._webviewViews.set(c,s),this.mainThreadWebviews.addWebview(c,s.webview,{serializeBuffersForPostMessage:o.serializeBuffersForPostMessage});let u;if(s.webview.state)try{u=JSON.parse(s.webview.state)}catch(h){console.error("Could not load webview state",h,s.webview.state)}s.webview.extension=n,o&&(s.webview.options=o);let p=new O;p.add(s.onDidChangeVisibility(h=>{this._proxy.$onDidChangeWebviewViewVisibility(c,h)})),p.add(s.onDispose(()=>{this._proxy.$disposeWebviewView(c),this._webviewViews.deleteAndDispose(c),p.dispose()})),this._telemetryService.publicLog2("webviews:createWebviewView",{extensionId:n.id.value,id:t});try{await this._proxy.$resolveWebviewView(c,t,s.title,u,l)}catch(h){mt(h),s.webview.setHtml(this.mainThreadWebviews.getWebviewResolvedFailedContent(t))}}});this._webviewViewProviders.set(t,r)}$unregisterWebviewViewProvider(e){if(!this._webviewViewProviders.has(e))throw new Error(`No view provider for ${e} registered`);this._webviewViewProviders.deleteAndDispose(e)}getWebviewView(e){let t=this._webviewViews.get(e);if(!t)throw new Error("unknown webview view");return t}};YRe=I([m(2,_e),m(3,QRe)],YRe);var a8=le("chatOutputRendererService"),XRe=class extends k{constructor(e,t,o,n,r){super();this._contextKeyService=e;this._extensionService=t;this._webviewService=o;this._chatWidgetService=n;this._contributions=new Map;this._renderers=new Map;this._originStore=new q0("chatOutputRenderer.origins",r),this._register(AJo.setHandler(s=>{this.updateContributions(s)}))}registerRenderer(e,t,o){return this._renderers.set(e,{viewType:e,renderer:t,options:o}),{dispose:()=>{this._renderers.delete(e)}}}hasCodeBlockRenderer(e){return Array.from(this._contributions.values()).some(t=>t.codeBlockLanguageIdentifiers.some(o=>xr(o,e)))}async renderOutputPart(e,t,o,n,r){let s=await this.getRendererForMime(e,r);if(r.isCancellationRequested)throw new qi;if(!s)throw new Error(`No renderer registered found for mime type: ${e}`);return this.doRenderOutputPart(s,e,t,{},o,n,r)}async renderCodeBlock(e,t,o,n,r){let s=await this.getRendererForCodeBlock(e,r);if(r.isCancellationRequested)throw new qi;if(!s)throw new Error(`No renderer registered found for code block language identifier: ${e}`);return this.doRenderOutputPart(s,"text/x-vscode-chat-code-block",t,{codeBlockContext:{languageIdentifier:e}},o,n,r)}async doRenderOutputPart(e,t,o,n,r,s,l){let c=new O,u=c.add(this._webviewService.createWebviewElement({title:s.title??"",origin:this.getOrigin(e),providedViewType:e.viewType,options:{enableFindWidget:!1,purpose:"chatOutputItem",tryRestoreScrollPosition:!1},contentOptions:{},extension:e.options.extension?e.options.extension:void 0}));u.setContextKeyService(c.add(this._contextKeyService.createScoped(r))),s.chatSessionResource&&c.add(this.delegateScrollToChatWidget(u,s.chatSessionResource));let p=c.add(new T);return c.add(ve(h=>{let g=h.readObservable(u.intrinsicContentSize);g&&(p.fire(g.height),r.style.height=`${g.height}px`)})),s.webviewState&&(u.state=s.webviewState),u.mountTo(r,Me(r)),await e.renderer.renderOutputPart(t,o,u,n,l),{get webview(){return u},onDidChangeHeight:p.event,dispose:()=>{c.dispose()},reinitialize:()=>{u.reinitializeAfterDismount()}}}delegateScrollToChatWidget(e,t){return e.onDidWheel(o=>{this._chatWidgetService.getWidgetBySessionResource(t)?.delegateScrollFromMouseWheelEvent({...o,preventDefault:()=>{},stopPropagation:()=>{}})})}getOrigin(e){return e.options.extension?this._originStore.getOrigin(e.viewType,e.options.extension.id):void 0}async getRendererForMime(e,t){return this.getRenderer(o=>o.mimes.some(n=>K3e(n,[e])),t)}async getRendererForCodeBlock(e,t){return this.getRenderer(o=>o.codeBlockLanguageIdentifiers.some(n=>xr(n,e)),t)}async getRenderer(e,t){await Ym(this._extensionService.whenInstalledExtensionsRegistered(),t);for(let[o,n]of this._contributions)if(e(n)){await Ym(this._extensionService.activateByEvent(`onChatOutputRenderer:${o}`),t);let r=this._renderers.get(o);if(r)return r}}updateContributions(e){this._contributions.clear();for(let t of e)if(Va(t.description,"chatOutputRenderer"))for(let o of t.value){if(this._contributions.has(o.viewType)){t.collector.error(`Chat output renderer with view type '${o.viewType}' already registered`);continue}let n=o.mimeTypes??[],r=o.codeBlockLanguageIdentifiers??[];if(!n.length&&!r.length){t.collector.error(`Chat output renderer with view type '${o.viewType}' must specify at least one mime type or code block language identifier`);continue}this._contributions.set(o.viewType,{mimes:n,codeBlockLanguageIdentifiers:r})}}};XRe=I([m(0,X),m(1,lt),m(2,Pu),m(3,Lt),m(4,de)],XRe);var PJo={type:"object",additionalProperties:!1,required:["viewType"],properties:{viewType:{type:"string",description:d(8079,null)},mimeTypes:{type:"array",description:d(8078,null),uniqueItems:!0,items:{type:"string"}},codeBlockLanguageIdentifiers:{type:"array",description:d(8077,null),uniqueItems:!0,items:{type:"string"}}}},AJo=zn.registerExtensionPoint({extensionPoint:"chatOutputRenderers",activationEventsGenerator:function*(a){for(let i of a)yield`onChatOutputRenderer:${i.viewType}`},jsonSchema:{description:d(8080,null),type:"array",items:PJo}});var JRe=class extends k{constructor(e,t,o,n){super();this._mainThreadWebview=t;this._rendererService=o;this._logService=n;this._webviewHandlePool=0;this.registeredRenderers=new Map;this._proxy=e.getProxy(ao.ExtHostChatOutputRenderer)}dispose(){super.dispose(),this.registeredRenderers.forEach(e=>e.dispose()),this.registeredRenderers.clear()}$registerChatOutputRenderer(e,t,o){let n=this.registeredRenderers.get(e);n&&(this._logService.warn(`Re-registering chat output renderer for view type '${e}' from extension '${t.value}'.`),n.dispose());let r=this._rendererService.registerRenderer(e,{renderOutputPart:async(s,l,c,u,p)=>{let h=`chat-output-${++this._webviewHandlePool}`;return this._mainThreadWebview.addWebview(h,c,{serializeBuffersForPostMessage:!0}),this._proxy.$renderChatOutput(e,s,Ke.wrap(l),h,u,p)}},{extension:{id:t,location:A.revive(o)}});this.registeredRenderers.set(e,r)}$unregisterChatOutputRenderer(e){this.registeredRenderers.get(e)?.dispose(),this.registeredRenderers.delete(e)}};JRe=I([m(2,a8),m(3,re)],JRe);var xFt=class extends k{constructor(i,e){super();let t=this._register(e.createInstance(HZ,i));i.set(Xi.MainThreadWebviews,t);let o=this._register(e.createInstance(jRe,i,t));i.set(Xi.MainThreadWebviewPanels,o);let n=this._register(e.createInstance($Re,i,t,o));i.set(Xi.MainThreadCustomEditors,n);let r=this._register(e.createInstance(YRe,i,t));i.set(Xi.MainThreadWebviewViews,r);let s=this._register(e.createInstance(JRe,i,t));i.set(Xi.MainThreadChatOutputRenderer,s)}};xFt=I([RM,m(1,F)],xFt);function NJo(a){return typeof a=="object"&&"uri"in a&&"pattern"in a}var JS=class{constructor(i,e,t,o,n,r){this.configurationService=i;this.workspaceContextService=e;this.editorGroupsService=t;this.logService=o;this.pathService=n;this.uriIdentityService=r}aiText(i,e,t={}){return{...this.commonQuery(e?.map(tJ),t),type:3,contentPattern:i}}text(i,e,t={}){i=this.getContentPattern(i,t);let o=this.configurationService.getValue(),n=e&&e.some(s=>!this.configurationService.getValue({resource:s}).search?.useRipgrep);return{...this.commonQuery(e?.map(tJ),t),type:2,contentPattern:i,previewOptions:t.previewOptions,maxFileSize:t.maxFileSize,usePCRE2:o.search?.usePCRE2||n||!1,surroundingContext:t.surroundingContext,userDisabledExcludesAndIgnoreFiles:t.disregardExcludeSettings&&t.disregardIgnoreFiles}}getContentPattern(i,e){let t=this.configurationService.getValue();i.isRegExp&&(i.pattern=i.pattern.replace(/\r?\n/g,"\\n"));let o={...i,wordSeparators:t.editor.wordSeparators};return this.isCaseSensitive(i,e)&&(o.isCaseSensitive=!0),this.isMultiline(i)&&(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(i,e={}){return{...this.commonQuery(i,e),type:1,filePattern:e.filePattern?e.filePattern.trim():e.filePattern,exists:e.exists,sortByScore:e.sortByScore,cacheKey:e.cacheKey,shouldGlobMatchFilePattern:e.shouldGlobSearch}}handleIncludeExclude(i,e){if(!i)return{};if(Array.isArray(i)){if(i=i.filter(t=>t.length>0).map(kFt),!i.length)return{}}else i=kFt(i);return e?this.parseSearchPaths(i):{pattern:Qwi(...Array.isArray(i)?i:[i])}}commonQuery(i=[],e={}){let t=Array.isArray(e.excludePattern)?e.excludePattern.map(u=>u.pattern).flat():e.excludePattern;t=t?.length===1?t[0]:t;let o=this.handleIncludeExclude(e.includePattern,e.expandPatterns),n=this.handleIncludeExclude(t,e.expandPatterns),r=i.length>1,s=(o.searchPaths&&o.searchPaths.length?o.searchPaths.map(u=>this.getFolderQueryForSearchPath(u,e,n)):i.map(u=>this.getFolderQueryForRoot(u,e,n,r))).filter(u=>!!u),l={_reason:e._reason,folderQueries:s,usingSearchPaths:!!(o.searchPaths&&o.searchPaths.length),extraFileResources:e.extraFileResources,excludePattern:n.pattern,includePattern:o.pattern,ignoreGlobCase:e.ignoreGlobCase,onlyOpenEditors:e.onlyOpenEditors,maxResults:e.maxResults,onlyFileScheme:e.onlyFileScheme};if(e.onlyOpenEditors){let u=ui(this.editorGroupsService.groups.flatMap(g=>g.editors.map(f=>f.resource)));this.logService.trace("QueryBuilder#commonQuery - openEditor URIs",JSON.stringify(u));let p=u.filter(g=>Fpe(l,g.fsPath)),h=this.commonQueryFromFileList(p);return this.logService.trace("QueryBuilder#commonQuery - openEditor Query",JSON.stringify(h)),{...l,...h}}let c=e.extraFileResources&&e.extraFileResources.filter(u=>Fpe(l,u.fsPath));return l.extraFileResources=c&&c.length?c:void 0,l}commonQueryFromFileList(i){let e=[],t=new dt,o={},n=!1;return i.forEach(r=>{if(r.scheme===Q.walkThrough)return;if(abt(r)){let l=this.workspaceContextService.getWorkspaceFolder(r)?.uri??this.uriIdentityService.extUri.dirname(r),c=t.get(l);c||(n=!0,c={folder:l,includePattern:{}},e.push(c),t.set(l,c));let u=pA(l.fsPath,r.fsPath);Ti(c.includePattern)[Xwi(u.replace(/\\/g,"/"))]=!0}else r.fsPath&&(n=!0,o[Xwi(r.fsPath)]=!0)}),{folderQueries:e,includePattern:o,usingSearchPaths:!0,excludePattern:n?void 0:{"**/*":!0}}}isCaseSensitive(i,e){if(e.isSmartCase){if(i.isRegExp){if(u4e(i.pattern,!0))return!0}else if(u4e(i.pattern))return!0}return!!i.isCaseSensitive}isMultiline(i){return i.isMultiline||i.isRegExp&&v3e(i.pattern)||i.pattern.indexOf(`
`)>=0?!0:!!i.isMultiline}parseSearchPaths(i){let e=p=>Jl(p)||/^\.\.?([\/\\]|$)/.test(p),o=(Array.isArray(i)?i:FJo(i)).map(p=>{let h=this.pathService.resolvedUserHome;return h?aK(p,h.scheme===Q.file?h.fsPath:h.path):p}),n=yy(o,p=>e(p)?"searchPaths":"exprSegments"),r=(n.exprSegments||[]).map(p=>Bh(p,"/")).map(p=>Bh(p,"\\")).map(p=>(p[0]==="."&&(p="*"+p),WJo(p))),s={},l=this.expandSearchPathPatterns(n.searchPaths||[]);l&&l.length&&(s.searchPaths=l);let c=r.flat(),u=Qwi(...c);return u&&(s.pattern=u),s}getExcludesForFolder(i,e){return e.disregardExcludeSettings?void 0:PH(i,!e.disregardSearchExcludeSettings)}expandSearchPathPatterns(i){if(!i||!i.length)return[];let e=i.flatMap(o=>{let{pathPortion:n,globPortion:r}=OJo(o);return r&&(r=Ywi(r)),this.expandOneSearchPath(n).flatMap(l=>this.resolveOneSearchPathPattern(l,r))}),t=new Map;return e.forEach(o=>{let n=o.searchPath.toString(),r=t.get(n);r?o.pattern&&(r.pattern=r.pattern||{},r.pattern[o.pattern]=!0):t.set(n,{searchPath:o.searchPath,pattern:o.pattern?Qwi(o.pattern):void 0})}),Array.from(t.values())}expandOneSearchPath(i){if(Jl(i)){let e=this.workspaceContextService.getWorkspace().folders;return e[0]&&e[0].uri.scheme!==Q.file?[{searchPath:e[0].uri.with({path:i})}]:[{searchPath:A.file(Vh(i))}]}if(this.workspaceContextService.getWorkbenchState()===2){let e=this.workspaceContextService.getWorkspace().folders[0].uri;if(i=kFt(i),i.startsWith("../")||i===".."){let o=Vo.resolve(e.path,i);return[{searchPath:e.with({path:o})}]}let t=Ywi(i);return[{searchPath:e,pattern:t}]}else{if(i==="./"||i===".\\")return[];{let e=i.replace(/^\.[\/\\]/,""),o=this.workspaceContextService.getWorkspace().folders.map(n=>{let r=e.match(new RegExp(`^${Ss(n.name)}(?:/(.*)|$)`));return r?{match:r,folder:n}:null}).filter(so);if(o.length)return o.map(n=>{let r=n.match[1];return{searchPath:n.folder.uri,pattern:r&&Ywi(r)}});{let n=i.match(/\.[\/\\](.+)[\/\\]?/),r=n?n[1]:i,s=d(19250,null,r);throw new Error(s)}}}}resolveOneSearchPathPattern(i,e){let t=i.pattern&&e?`${i.pattern}/${e}`:i.pattern||e,o=[{searchPath:i.searchPath,pattern:t}];return t&&!t.endsWith("**")&&o.push({searchPath:i.searchPath,pattern:t+"/**"}),o}getFolderQueryForSearchPath(i,e,t){let o=this.getFolderQueryForRoot(tJ(i.searchPath),e,t,!1);return o?{...o,includePattern:i.pattern}:null}getFolderQueryForRoot(i,e,t,o){let n,r=A.isUri(i)?i:i.uri,s=e.excludePattern?.map(g=>{let f=e.excludePattern&&NJo(g)?g.uri:void 0;return!f||!(A.isUri(i)&&this.uriIdentityService.extUri.isEqual(i,f))?f:void 0});if(s?.length||(s=[void 0]),t.searchPaths){let g=t.searchPaths.filter(f=>ze(f.searchPath,r))[0];if(g&&!g.pattern)return null;g&&(n=g.pattern)}let l=this.configurationService.getValue({resource:r}),u={...this.getExcludesForFolder(l,e)||{},...n||{}},p=A.isUri(i)?Be(i):i.name,h=s.map(g=>Object.keys(u).length>0?{folder:g,pattern:u}:void 0).filter(g=>g);return{folder:r,folderName:o?p:void 0,excludePattern:h,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}}};JS=I([m(0,B),m(1,Ae),m(2,kt),m(3,re),m(4,Pn),m(5,gt)],JS);function OJo(a){let i=a.match(/[\*\{\}\(\)\[\]\?]/);if(i){let e=i.index,t=a.substr(0,e).match(/[/|\\][^/\\]*$/);if(t){let o=a.substr(0,t.index);return o.match(/[/\\]/)||(o+="/"),{pathPortion:o,globPortion:a.substr((t.index||0)+1)}}}return{pathPortion:a}}function Qwi(...a){return a.length?a.reduce((i,e)=>(i[e]=!0,i),Object.create(null)):void 0}function FJo(a){return wM(a,",").map(i=>i.trim()).filter(i=>!!i.length)}function WJo(a){return[`**/${a}/**`,`**/${a}`].map(e=>e.replace(/\*\*\/\*\*/g,"**"))}function kFt(a){return a.replace(/\\/g,"/")}function Ywi(a){return kFt(a).replace(/^\.\//,"").replace(/\/+$/g,"")}function Xwi(a){return a.replace(/([?*[\]])/g,"[$1]")}function upo(a,i){a=jo(a,o=>o.toString());let e=[],t=i.getWorkspace();return a&&a.forEach(o=>{let n;if(i.getWorkbenchState()===2)n=lu(t.folders[0].uri,o),n&&n!=="."&&(n="./"+n);else{let r=i.getWorkspaceFolder(o);if(r){let s=r.name;if(t.folders.filter(c=>c.name===s).length===1){let c=lu(r.uri,o);c===""?n=`./${r.name}`:n=`./${r.name}/${c}`}else n=o.fsPath}}n&&e.push(Xwi(n))}),e}var VJo=7e3;function ppo(a,i){let e=i.activationEvents;if(!e)return Promise.resolve(void 0);let t=[],o=[];for(let u of e)if(/^workspaceContains:/.test(u)){let p=u.substr(18);p.indexOf("*")>=0||p.indexOf("?")>=0||a.forceUsingSearch?o.push(p):t.push(p)}if(t.length===0&&o.length===0)return Promise.resolve(void 0);let{promise:n,resolve:r}=Ey(),s=u=>r({activationEvent:u}),l=Promise.all(t.map(u=>BJo(a,u,s))).then(()=>{}),c=HJo(a,i.identifier,o,s);return Promise.all([l,c]).then(()=>{r(void 0)}),n}async function BJo(a,i,e){for(let t of a.folders)if(await a.exists(Ve(A.revive(t),i))){e(`workspaceContains:${i}`);return}}async function HJo(a,i,e,t){if(e.length===0)return Promise.resolve(void 0);let o=new qe,n=a.checkExists(a.folders,e,o.token),r=setTimeout(async()=>{o.cancel(),a.logService.info(`Not activating extension '${i.value}': Timed out while searching for 'workspaceContains' pattern ${e.join(",")}`)},VJo),s=!1;try{s=await n}catch(l){Yi(l)||mt(l)}o.dispose(),clearTimeout(r),s&&t(`workspaceContains:${e.join(",")}`)}function ZRe(a,i,e,t){let o=a.get(F),n=a.get(Gg),s=o.createInstance(JS).file(i.map(l=>tJ(A.revive(l))),{_reason:"checkExists",includePattern:e,exists:!0});return n.fileSearch(s,t).then(l=>!!l.limitHit,l=>Yi(l)?!1:Promise.reject(l))}var iS=le("workspaceEditingService");var EFt=le("canonicalUriIdentityService");var TFt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this._searchService=t;this._contextService=o;this._editSessionIdentityService=n;this._canonicalUriService=r;this._editorService=s;this._workspaceEditingService=l;this._notificationService=c;this._requestService=u;this._instantiationService=p;this._labelService=h;this._environmentService=g;this._workspaceTrustManagementService=v;this._workspaceTrustRequestService=b;this._textFileService=S;this._activeCancelTokens=Object.create(null);this.registeredEditSessionProviders=this._register(new Ot);this.registeredCanonicalUriProviders=this._register(new Ot);this._queryBuilder=this._instantiationService.createInstance(JS),this._proxy=e.getProxy(ao.ExtHostWorkspace);let y=this._contextService.getWorkspace();y.configuration&&!Qr&&!f.hasProvider(y.configuration)?this._proxy.$initializeWorkspace(this.getWorkspaceData(y),this.isWorkspaceTrusted()):this._contextService.getCompleteWorkspace().then(w=>this._proxy.$initializeWorkspace(this.getWorkspaceData(w),this.isWorkspaceTrusted())),this._register(this._contextService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspace,this)),this._register(this._contextService.onDidChangeWorkbenchState(this._onDidChangeWorkspace,this)),this._register(this._workspaceTrustManagementService.onDidChangeTrust(this._onDidGrantWorkspaceTrust,this)),this._register(this._workspaceTrustManagementService.onDidChangeTrustedFolders(this._onDidChangeWorkspaceTrustedFolders,this))}dispose(){super.dispose();for(let e in this._activeCancelTokens)this._activeCancelTokens[e].cancel()}$updateWorkspaceFolders(e,t,o,n){let r=n.map(s=>({uri:A.revive(s.uri),name:s.name}));return this._notificationService.status(this.getStatusMessage(e,r.length,o),{hideAfter:10*1e3}),this._workspaceEditingService.updateFolders(t,o,r,!0)}getStatusMessage(e,t,o){let n,r=t>0,s=o>0;return r&&!s?t===1?n=d(3970,null,e):n=d(3969,null,e,t):s&&!r?o===1?n=d(3972,null,e):n=d(3971,null,e,o):n=d(3968,null,e),n}_onDidChangeWorkspace(){this._proxy.$acceptWorkspaceData(this.getWorkspaceData(this._contextService.getWorkspace()))}getWorkspaceData(e){return this._contextService.hasWorkspaceData()?{configuration:e.configuration||void 0,isUntitled:e.configuration?rM(e.configuration,this._environmentService):!1,folders:e.folders,id:e.id,name:this._labelService.getWorkspaceLabel(e),transient:e.transient}:null}$startFileSearch(e,t,o){let n=A.revive(e),r=this._contextService.getWorkspace(),s=this._queryBuilder.file(n?[n]:r.folders,er(t));return this._searchService.fileSearch(s,o).then(l=>l.results.map(c=>c.resource),l=>Yi(l)?null:Promise.reject(l))}$startTextSearch(e,t,o,n,r){let s=A.revive(t),l=this._contextService.getWorkspace(),c=s?[s]:l.folders.map(g=>g.uri),u=this._queryBuilder.text(e,c,er(o));u._reason="startTextSearch";let p=g=>{g.results&&this._proxy.$handleTextSearchResult(g,n)};return this._searchService.textSearch(u,r,p).then(g=>({limitHit:g.limitHit}),g=>Yi(g)?null:Promise.reject(g))}$checkExists(e,t,o){return this._instantiationService.invokeFunction(n=>ZRe(n,e,t,o))}async $save(e,t){let o=A.revive(e),n=[...this._editorService.findEditors(o,{supportSideBySide:1})],r=await this._editorService.save(n,{reason:1,saveAs:t.saveAs,force:!t.saveAs});return this._saveResultToUris(r).at(0)}_saveResultToUris(e){return e.success?ui(e.editors.map(t=>po.getCanonicalUri(t,{supportSideBySide:1}))):[]}$saveAll(e){return this._editorService.saveAll({includeUntitled:e}).then(t=>t.success)}$resolveProxy(e){return this._requestService.resolveProxy(e)}$lookupAuthorization(e){return this._requestService.lookupAuthorization(e)}$lookupKerberosAuthorization(e){return this._requestService.lookupKerberosAuthorization(e)}$loadCertificates(){return this._requestService.loadCertificates()}$requestResourceTrust(e){let t={...e,uri:A.revive(e.uri)};return this._workspaceTrustRequestService.requestResourcesTrust(t)}$requestWorkspaceTrust(e){return this._workspaceTrustRequestService.requestWorkspaceTrust(e)}async $isResourceTrusted(e){let t=A.revive(e);return(await this._workspaceTrustManagementService.getUriTrustInfo(t)).trusted}isWorkspaceTrusted(){return this._workspaceTrustManagementService.isWorkspaceTrusted()}_onDidGrantWorkspaceTrust(){this._proxy.$onDidGrantWorkspaceTrust()}_onDidChangeWorkspaceTrustedFolders(){this._proxy.$onDidChangeWorkspaceTrustedFolders()}$registerEditSessionIdentityProvider(e,t){let o=this._editSessionIdentityService.registerEditSessionIdentityProvider({scheme:t,getEditSessionIdentifier:async(n,r)=>this._proxy.$getEditSessionIdentifier(n.uri,r),provideEditSessionIdentityMatch:async(n,r,s,l)=>this._proxy.$provideEditSessionIdentityMatch(n.uri,r,s,l)});this.registeredEditSessionProviders.set(e,o)}$unregisterEditSessionIdentityProvider(e){this.registeredEditSessionProviders.deleteAndDispose(e)}$registerCanonicalUriProvider(e,t){let o=this._canonicalUriService.registerCanonicalUriProvider({scheme:t,provideCanonicalUri:async(n,r,s)=>{let l=await this._proxy.$provideCanonicalUri(n,r,s);return l&&A.revive(l)}});this.registeredCanonicalUriProviders.set(e,o)}$unregisterCanonicalUriProvider(e){this.registeredCanonicalUriProviders.deleteAndDispose(e)}$resolveDecoding(e,t){return this._textFileService.resolveDecoding(A.revive(e),t)}$validateDetectedEncoding(e,t,o){return this._textFileService.validateDetectedEncoding(A.revive(e),t,o)}$resolveEncoding(e,t){return this._textFileService.resolveEncoding(A.revive(e),t)}};TFt=I([fo(Xi.MainThreadWorkspace),m(1,Gg),m(2,Ae),m(3,mG),m(4,EFt),m(5,ie),m(6,iS),m(7,Ne),m(8,Ra),m(9,F),m(10,nt),m(11,ko),m(12,ge),m(13,Or),m(14,lp),m(15,Uo)],TFt);var eLe=class{constructor(i){this.menuService=i}getCommentThreadTitleActions(i){return this.getMenu(R.CommentThreadTitle,i)}getCommentThreadActions(i){return this.getMenu(R.CommentThreadActions,i)}getCommentEditorActions(i){return this.getMenu(R.CommentEditorActions,i)}getCommentThreadAdditionalActions(i){return this.getMenu(R.CommentThreadAdditionalActions,i,{emitEventsForSubmenuChanges:!0})}getCommentTitleActions(i,e){return this.getMenu(R.CommentTitle,e)}getCommentActions(i,e){return this.getMenu(R.CommentActions,e)}getCommentThreadTitleContextActions(i){return this.getActions(R.CommentThreadTitleContext,i,{shouldForwardArgs:!0})}getMenu(i,e,t){return this.menuService.createMenu(i,e,t)}getActions(i,e,t){return this.menuService.getMenuActions(i,e,t).map(o=>o[1]).flat()}dispose(){}};eLe=I([m(0,Yt)],eLe);var fG="comments";var jc;(h=>(h.activeCursorHasCommentingRange=new Y("activeCursorHasCommentingRange",!1,{description:d(10372,null),type:"boolean"}),h.activeCursorHasComment=new Y("activeCursorHasComment",!1,{description:d(10370,null),type:"boolean"}),h.activeEditorHasCommentingRange=new Y("activeEditorHasCommentingRange",!1,{description:d(10369,null),type:"boolean"}),h.WorkspaceHasCommenting=new Y("workspaceHasCommenting",!1,{description:d(10371,null),type:"boolean"}),h.commentThreadIsEmpty=new Y("commentThreadIsEmpty",!1,{type:"boolean",description:d(10367,null)}),h.commentIsEmpty=new Y("commentIsEmpty",!1,{type:"boolean",description:d(10365,null)}),h.commentContext=new Y("comment",void 0,{type:"string",description:d(10361,null)}),h.commentThreadContext=new Y("commentThread",void 0,{type:"string",description:d(10366,null)}),h.commentControllerContext=new Y("commentController",void 0,{type:"string",description:d(10362,null)}),h.commentFocused=new Y("commentFocused",!1,{type:"boolean",description:d(10363,null)}),h.commentWidgetVisible=new Y("commentWidgetVisible",!1,{type:"boolean",description:d(10368,null)}),h.commentingEnabled=new Y("commentingEnabled",!0,{description:d(10364,null),type:"boolean"})))(jc||={});var u_=class{constructor(i,e,t,o,n){this.uniqueOwner=i;this.owner=e;this.resource=t;this.comment=o;this.thread=n;this.isRoot=!1;this.replies=[];this.threadId=n.threadId,this.range=n.range,this.threadState=n.state,this.threadRelevance=n.applicability,this.contextValue=n.contextValue,this.controllerHandle=n.controllerHandle,this.threadHandle=n.commentThreadHandle}hasReply(){return this.replies&&this.replies.length!==0}get lastUpdatedAt(){if(this._lastUpdatedAt===void 0){let i=this.comment.timestamp||"";if(this.replies.length){let t=this.replies[this.replies.length-1].lastUpdatedAt;t>i&&(i=t)}this._lastUpdatedAt=i}return this._lastUpdatedAt}},RC=class a{constructor(i,e,t,o){this.uniqueOwner=i,this.owner=e,this.id=t.toString(),this.resource=t,this.commentThreads=o.filter(n=>n.comments&&n.comments.length).map(n=>a.createCommentNode(i,e,t,n))}static createCommentNode(i,e,t,o){let{comments:n}=o,r=n.map(s=>new u_(i,e,t,s,o));return r.length>1&&(r[0].replies=r.slice(1,r.length)),r[0].isRoot=!0,r[0]}get lastUpdatedAt(){if(this._lastUpdatedAt===void 0){let i="";if(!this.commentThreads.length)return i;for(let e of this.commentThreads){let t=e.lastUpdatedAt;t&&t>i&&(i=t)}this._lastUpdatedAt=i}return this._lastUpdatedAt}};function xZe(a){return!!a.comments&&!!a.comments.length&&a.comments.some(i=>yr(i.body)?i.body.value.length>0:i.body.length>0)}var vG=class a extends k{get resourceCommentThreads(){return this._resourceCommentThreads}constructor(){super(),this._resourceCommentThreads=[],this.commentThreadsMap=new Map}updateResourceCommentThreads(){let i=this.commentThreadsMap.size>1;this._resourceCommentThreads=[...this.commentThreadsMap.values()].map(e=>e.resourceWithCommentThreads.map(t=>(t.ownerLabel=i?e.ownerLabel:void 0,t)).flat()).flat()}setCommentThreads(i,e,t,o){this.commentThreadsMap.set(i,{ownerLabel:t,resourceWithCommentThreads:this.groupByResource(i,e,o)}),this.updateResourceCommentThreads()}deleteCommentsByOwner(i){if(i){let e=this.commentThreadsMap.get(i);this.commentThreadsMap.set(i,{ownerLabel:e?.ownerLabel,resourceWithCommentThreads:[]})}else this.commentThreadsMap.clear();this.updateResourceCommentThreads()}updateCommentThreads(i){let{uniqueOwner:e,owner:t,ownerLabel:o,removed:n,changed:r,added:s}=i,l=this.commentThreadsMap.get(e)?.resourceWithCommentThreads||[];return n.forEach(c=>{let u=l.findIndex(g=>g.id===c.resource),p=u>=0?l[u]:void 0,h=p?.commentThreads.findIndex(g=>g.threadId===c.threadId)??0;h>=0&&p?.commentThreads.splice(h,1),p?.commentThreads.length===0&&l.splice(u,1)}),r.forEach(c=>{let u=l.findIndex(g=>g.id===c.resource),p=u>=0?l[u]:void 0;if(!p)return;let h=p.commentThreads.findIndex(g=>g.threadId===c.threadId);h>=0?p.commentThreads[h]=RC.createCommentNode(e,t,A.parse(p.id),c):c.comments&&c.comments.length&&p.commentThreads.push(RC.createCommentNode(e,t,A.parse(p.id),c))}),s.forEach(c=>{let u=l.filter(p=>p.resource.toString()===c.resource);if(u.length){let p=u[0];c.comments&&c.comments.length&&p.commentThreads.push(RC.createCommentNode(e,t,p.resource,c))}else l.push(new RC(e,t,A.parse(c.resource),[c]))}),this.commentThreadsMap.set(e,{ownerLabel:o,resourceWithCommentThreads:l}),this.updateResourceCommentThreads(),n.length>0||r.length>0||s.length>0}hasCommentThreads(){return!!this._resourceCommentThreads.length&&this._resourceCommentThreads.some(i=>i.commentThreads.length>0&&i.commentThreads.some(e=>xZe(e.thread)))}getMessage(){return this._resourceCommentThreads.length?"":d(10304,null)}groupByResource(i,e,t){let o=[],n=new Map;for(let r of Lf(t,a._compareURIs))n.set(r[0].resource,new RC(i,e,A.parse(r[0].resource),r));return n.forEach((r,s,l)=>{o.push(r)}),o}static _compareURIs(i,e){let t=i.resource.toString(),o=e.resource.toString();return t<o?-1:t>o?1:0}};var Wm=le("commentService"),Jwi="comments.continueOnComments",tLe=class extends k{constructor(e,t,o,n,r,s,l){super();this.instantiationService=e;this.layoutService=t;this.configurationService=o;this.storageService=r;this.logService=s;this.modelService=l;this._onDidSetDataProvider=this._register(new T);this.onDidSetDataProvider=this._onDidSetDataProvider.event;this._onDidDeleteDataProvider=this._register(new T);this.onDidDeleteDataProvider=this._onDidDeleteDataProvider.event;this._onDidSetResourceCommentInfos=this._register(new T);this.onDidSetResourceCommentInfos=this._onDidSetResourceCommentInfos.event;this._onDidSetAllCommentThreads=this._register(new T);this.onDidSetAllCommentThreads=this._onDidSetAllCommentThreads.event;this._onDidUpdateCommentThreads=this._register(new T);this.onDidUpdateCommentThreads=this._onDidUpdateCommentThreads.event;this._onDidUpdateNotebookCommentThreads=this._register(new T);this.onDidUpdateNotebookCommentThreads=this._onDidUpdateNotebookCommentThreads.event;this._onDidUpdateCommentingRanges=this._register(new T);this.onDidUpdateCommentingRanges=this._onDidUpdateCommentingRanges.event;this._onDidChangeActiveEditingCommentThread=this._register(new T);this.onDidChangeActiveEditingCommentThread=this._onDidChangeActiveEditingCommentThread.event;this._onDidChangeCurrentCommentThread=this._register(new T);this.onDidChangeCurrentCommentThread=this._onDidChangeCurrentCommentThread.event;this._onDidChangeCommentingEnabled=this._register(new T);this.onDidChangeCommentingEnabled=this._onDidChangeCommentingEnabled.event;this._onResourceHasCommentingRanges=this._register(new T);this.onResourceHasCommentingRanges=this._onResourceHasCommentingRanges.event;this._onDidChangeActiveCommentingRange=this._register(new T);this.onDidChangeActiveCommentingRange=this._onDidChangeActiveCommentingRange.event;this._commentControls=new Map;this._commentMenus=new Map;this._isCommentingEnabled=!0;this._continueOnComments=new Map;this._continueOnCommentProviders=new Set;this._commentsModel=this._register(new vG);this.commentsModel=this._commentsModel;this._commentingRangeResources=new Set;this._commentingRangeResourceHintSchemes=new Set;this._handleConfiguration(),this._handleZenMode(),this._workspaceHasCommenting=jc.WorkspaceHasCommenting.bindTo(n),this._commentingEnabled=jc.commentingEnabled.bindTo(n);let c=this._register(new O),u=U.debounce(this.storageService.onDidChangeValue(1,Jwi,c),(p,h)=>p?.external?p:h,500);c.add(u(p=>{if(!p.external)return;let h=this.storageService.getObject(Jwi,1);if(!h)return;this.logService.debug(`Comments: URIs of continue on comments from storage ${h.map(f=>f.uri.toString()).join(", ")}.`);let g=this._addContinueOnComments(h,this._continueOnComments);for(let f of g){let v=this._commentControls.get(f);if(!v)continue;let b={uniqueOwner:f,owner:v.owner,ownerLabel:v.label,pending:this._continueOnComments.get(f)||[],added:[],removed:[],changed:[]};this.updateModelThreads(b)}})),this._register(r.onWillSaveState(()=>{let p=new Map;for(let h of this._continueOnCommentProviders){let g=h.provideContinueOnComments();this._addContinueOnComments(g,p)}this._saveContinueOnComments(p)})),this._register(this.modelService.onModelAdded(p=>{p.uri.scheme!==Q.vscodeSourceControl&&(this._commentingRangeResources.has(p.uri.toString())||this.getDocumentComments(p.uri))}))}_updateResourcesWithCommentingRanges(e,t){let o=!1;for(let n of t)n&&(n.commentingRanges.ranges.length>0||n.threads.length>0)&&(this._commentingRangeResources.add(e.toString()),o=!0);o&&this._onResourceHasCommentingRanges.fire()}_handleConfiguration(){this._isCommentingEnabled=this._defaultCommentingEnablement,this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("comments.visible")&&this.enableCommenting(this._defaultCommentingEnablement)}))}_handleZenMode(){let e=this._isCommentingEnabled;this._register(this.layoutService.onDidChangeZenMode(t=>{t?(e=this._isCommentingEnabled,this.enableCommenting(!1)):this.enableCommenting(e)}))}get _defaultCommentingEnablement(){return!!this.configurationService.getValue(fG)?.visible}get isCommentingEnabled(){return this._isCommentingEnabled}enableCommenting(e){e!==this._isCommentingEnabled&&(this._isCommentingEnabled=e,this._commentingEnabled.set(e),this._onDidChangeCommentingEnabled.fire(e))}setCurrentCommentThread(e){this._onDidChangeCurrentCommentThread.fire(e)}setActiveEditingCommentThread(e){this._onDidChangeActiveEditingCommentThread.fire(e)}get lastActiveCommentcontroller(){return this._lastActiveCommentController}async setActiveCommentAndThread(e,t){let o=this._commentControls.get(e);if(o)return o!==this._lastActiveCommentController&&await this._lastActiveCommentController?.setActiveCommentAndThread(void 0),this._lastActiveCommentController=o,o.setActiveCommentAndThread(t)}setDocumentComments(e,t){this._onDidSetResourceCommentInfos.fire({resource:e,commentInfos:t})}setModelThreads(e,t,o,n){this._commentsModel.setCommentThreads(e,t,o,n),this._onDidSetAllCommentThreads.fire({ownerId:e,ownerLabel:o,commentThreads:n})}updateModelThreads(e){this._commentsModel.updateCommentThreads(e),this._onDidUpdateCommentThreads.fire(e)}setWorkspaceComments(e,t){t.length&&this._workspaceHasCommenting.set(!0);let o=this._commentControls.get(e);o&&this.setModelThreads(e,o.owner,o.label,t)}removeWorkspaceComments(e){let t=this._commentControls.get(e);t&&this.setModelThreads(e,t.owner,t.label,[])}registerCommentController(e,t){this._commentControls.set(e,t),this._onDidSetDataProvider.fire()}unregisterCommentController(e){e?this._commentControls.delete(e):this._commentControls.clear(),this._commentsModel.deleteCommentsByOwner(e),this._onDidDeleteDataProvider.fire(e)}getCommentController(e){return this._commentControls.get(e)}async createCommentThreadTemplate(e,t,o,n){let r=this._commentControls.get(e);if(r)return r.createCommentThreadTemplate(t,o,n)}async updateCommentThreadTemplate(e,t,o){let n=this._commentControls.get(e);n&&await n.updateCommentThreadTemplate(t,o)}disposeCommentThread(e,t){this.getCommentController(e)?.deleteCommentThreadMain(t)}getCommentMenus(e){if(this._commentMenus.get(e))return this._commentMenus.get(e);let t=this.instantiationService.createInstance(eLe);return this._commentMenus.set(e,t),t}updateComments(e,t){let o=this._commentControls.get(e);if(o){let n=Object.assign({},t,{uniqueOwner:e,ownerLabel:o.label,owner:o.owner});this.updateModelThreads(n)}}updateNotebookComments(e,t){let o=Object.assign({},t,{uniqueOwner:e});this._onDidUpdateNotebookCommentThreads.fire(o)}updateCommentingRanges(e,t){if(t?.schemes&&t.schemes.length>0)for(let o of t.schemes)this._commentingRangeResourceHintSchemes.add(o);this._workspaceHasCommenting.set(!0),this._onDidUpdateCommentingRanges.fire({uniqueOwner:e})}async toggleReaction(e,t,o,n,r){let s=this._commentControls.get(e);if(s)return s.toggleReaction(t,o,n,r,Ie.None);throw new Error("Not supported")}hasReactionHandler(e){let t=this._commentControls.get(e);return t?!!t.features.reactionHandler:!1}async getDocumentComments(e){let t=[];for(let n of this._commentControls.values())t.push(n.getDocumentComments(e,Ie.None).then(r=>{for(let l of r.threads)l.comments?.length===0&&l.range&&this.removeContinueOnComment({range:l.range,uri:e,uniqueOwner:r.uniqueOwner});let s=this._continueOnComments.get(r.uniqueOwner);return r.pendingCommentThreads=s?.filter(l=>l.uri.toString()===e.toString()),r}).catch(r=>null));let o=await Promise.all(t);return this._updateResourcesWithCommentingRanges(e,o),o}async getNotebookComments(e){let t=[];return this._commentControls.forEach(o=>{t.push(o.getNotebookComments(e,Ie.None).catch(n=>null))}),Promise.all(t)}registerContinueOnCommentProvider(e){return this._continueOnCommentProviders.add(e),{dispose:()=>{this._continueOnCommentProviders.delete(e)}}}_saveContinueOnComments(e){let t=[];for(let o of e.values())t.push(...o);this.logService.debug(`Comments: URIs of continue on comments to add to storage ${t.map(o=>o.uri.toString()).join(", ")}.`),this.storageService.store(Jwi,t,1,0)}removeContinueOnComment(e){let t=this._continueOnComments.get(e.uniqueOwner);if(t){let o=t.findIndex(n=>n.uri.toString()===e.uri.toString()&&G.equalsRange(n.range,e.range)&&(e.isReply===void 0||n.isReply===e.isReply));if(o>-1)return t.splice(o,1)[0]}}_addContinueOnComments(e,t){let o=new Set;for(let n of e)if(!t.has(n.uniqueOwner))t.set(n.uniqueOwner,[n]),o.add(n.uniqueOwner);else{let r=t.get(n.uniqueOwner);r.every(s=>s.uri.toString()!==n.uri.toString()||!G.equalsRange(s.range,n.range))&&(r.push(n),o.add(n.uniqueOwner))}return o}resourceHasCommentingRanges(e){return this._commentingRangeResourceHintSchemes.has(e.scheme)||this._commentingRangeResources.has(e.toString())}};tLe=I([m(0,F),m(1,wi),m(2,B),m(3,X),m(4,de),m(5,re),m(6,_t)],tLe);function bG(a){if(a?.resource)return A.isUri(a.resource)?a.resource:a.resource.primary}var JH={onDidChangeVisibility:U.None},jl=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.instantiationService=t;this.configurationService=o;this.modelService=n;this.workspaceService=r;this.languageService=s;this.decorationsService=l;this.themeService=c;this.labelService=u;this.textFileService=p;this._onDidChangeDecorations=this._register(new T);this.widgets=[];this.labels=[];this.registerListeners(e)}get onDidChangeDecorations(){return this._onDidChangeDecorations.event}registerListeners(e){this._register(e.onDidChangeVisibility(t=>{this.widgets.forEach(o=>o.notifyVisibilityChanged(t))})),this._register(this.languageService.onDidChange(()=>this.widgets.forEach(t=>t.notifyExtensionsRegistered()))),this._register(this.modelService.onModelLanguageChanged(t=>{t.model.uri&&this.widgets.forEach(o=>o.notifyModelLanguageChanged(t.model))})),this._register(this.modelService.onModelAdded(t=>{t.uri&&this.widgets.forEach(o=>o.notifyModelAdded(t))})),this._register(this.workspaceService.onDidChangeWorkspaceFolders(()=>{this.widgets.forEach(t=>t.notifyWorkspaceFoldersChange())})),this._register(this.decorationsService.onDidChangeDecorations(t=>{let o=!1;this.widgets.forEach(n=>{n.notifyFileDecorationsChanges(t)&&(o=!0)}),o&&this._onDidChangeDecorations.fire()})),this._register(this.themeService.onDidColorThemeChange(()=>this.widgets.forEach(t=>t.notifyThemeChange()))),this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(F5)&&this.widgets.forEach(o=>o.notifyFileAssociationsChange())})),this._register(this.labelService.onDidChangeFormatters(t=>{this.widgets.forEach(o=>o.notifyFormattersChange(t.scheme))})),this._register(this.textFileService.untitled.onDidChangeLabel(t=>{this.widgets.forEach(o=>o.notifyUntitledLabelChange(t.resource))}))}get(e){return this.labels[e]}create(e,t){let o=this.instantiationService.createInstance(kZe,e,t),n={element:o.element,get onDidRender(){return o.onDidRender},setLabel:(r,s,l)=>o.setLabel(r,s,l),setResource:(r,s)=>o.setResource(r,s),setFile:(r,s)=>o.setFile(r,s),clear:()=>o.clear(),dispose:()=>this.disposeWidget(o)};return this.labels.push(n),this.widgets.push(o),n}disposeWidget(e){let t=this.widgets.indexOf(e);t>-1&&(this.widgets.splice(t,1),this.labels.splice(t,1)),je(e)}clear(){this.widgets=je(this.widgets),this.labels=[]}dispose(){super.dispose(),this.clear()}};jl=I([m(1,F),m(2,B),m(3,_t),m(4,Ae),m(5,Rt),m(6,mb),m(7,Pe),m(8,nt),m(9,Uo)],jl);var CE=class extends jl{get element(){return this.label}constructor(i,e,t,o,n,r,s,l,c,u,p){super(JH,t,o,n,r,s,l,c,u,p),this.label=this._register(this.create(i,e))}};CE=I([m(2,F),m(3,B),m(4,_t),m(5,Ae),m(6,Rt),m(7,mb),m(8,Pe),m(9,nt),m(10,Uo)],CE);var kZe=class extends ld{constructor(e,t,o,n,r,s,l,c,u){super(e,t);this.languageService=o;this.modelService=n;this.decorationsService=r;this.labelService=s;this.textFileService=l;this.contextService=c;this.notebookDocumentService=u;this._onDidRender=this._register(new T);this.label=void 0;this.decoration=this._register(new ue);this.options=void 0;this.computedIconClasses=void 0;this.computedLanguageId=void 0;this.computedPathLabel=void 0;this.computedWorkspaceFolderLabel=void 0;this.needsRedraw=void 0;this.isHidden=!1}get onDidRender(){return this._onDidRender.event}notifyVisibilityChanged(e){e===this.isHidden&&(this.isHidden=!e,e&&this.needsRedraw&&(this.render({updateIcon:this.needsRedraw===2,updateDecoration:this.needsRedraw===2}),this.needsRedraw=void 0))}notifyModelLanguageChanged(e){this.handleModelEvent(e)}notifyModelAdded(e){this.handleModelEvent(e)}handleModelEvent(e){let t=bG(this.label);t&&ze(e.uri,t)&&this.computedLanguageId!==e.getLanguageId()&&(this.computedLanguageId=e.getLanguageId(),this.render({updateIcon:!0,updateDecoration:!1}))}notifyFileDecorationsChanges(e){if(!this.options)return!1;let t=bG(this.label);return t&&this.options.fileDecorations&&e.affectsResource(t)?this.render({updateIcon:!1,updateDecoration:!0}):!1}notifyExtensionsRegistered(){this.render({updateIcon:!0,updateDecoration:!1})}notifyThemeChange(){this.render({updateIcon:!1,updateDecoration:!1})}notifyFileAssociationsChange(){this.render({updateIcon:!0,updateDecoration:!1})}notifyFormattersChange(e){bG(this.label)?.scheme===e&&this.render({updateIcon:!1,updateDecoration:!1})}notifyUntitledLabelChange(e){ze(e,bG(this.label))&&this.render({updateIcon:!1,updateDecoration:!1})}notifyWorkspaceFoldersChange(){if(typeof this.computedWorkspaceFolderLabel=="string"){let e=bG(this.label);A.isUri(e)&&this.label?.name===this.computedWorkspaceFolderLabel&&this.setFile(e,this.options)}}setFile(e,t){let o=t?.hideLabel,n;if(!o){if(t?.fileKind===2){let s=this.contextService.getWorkspaceFolder(e);s&&(n=s.name,this.computedWorkspaceFolderLabel=n)}n||(n=dm(sl(e)))}let r;if(!t?.hidePath){let s=this.labelService.getUriLabel(ai(e),{relative:!0});s&&s!=="."&&(r=s)}this.setResource({resource:e,name:n,description:r,range:t?.range},t)}setResource(e,t=Object.create(null)){let o=bG(e),n=e?.resource&&!A.isUri(e.resource);if(!t.forceLabel&&!n&&o?.scheme===Q.untitled){let u=this.textFileService.untitled.get(o);if(u&&!u.hasAssociatedFilePath){if(typeof e.name=="string"&&(e.name=u.name),typeof e.description=="string"){let h=u.resource.path;e.name!==h?e.description=h:e.description=void 0}let p=u.resource.path;u.name!==p?t.title=`${u.name} \u2022 ${p}`:t.title=p}}if(!t.forceLabel&&!n&&o?.scheme===Q.vscodeNotebookCell){let u=this.notebookDocumentService.getNotebook(o),p=u?.getCellIndex(o);u&&p!==void 0&&typeof e.name=="string"&&(t.title=d(4404,null,e.name,`${p+1}`)),typeof e.name=="string"&&u&&p!==void 0&&typeof e.name=="string"&&(e.name=d(4404,null,e.name,`${p+1}`))}if(!t.forceLabel&&!n&&o?.scheme===Q.vscodeNotebookCellOutput){let u=this.notebookDocumentService.getNotebook(o),p=k7e(o);if(p?.cellFragment){if(!p.notebook)return;let h=p.notebook.with({scheme:Q.vscodeNotebookCell,fragment:p.cellFragment}),g=u?.getCellIndex(h),f=p.outputIndex;g!==void 0&&f!==void 0&&typeof e.name=="string"?e.name=d(4405,null,e.name,`${g+1}`,`${f+1}`):g!==void 0&&typeof e.name=="string"&&(e.name=d(4406,null,e.name,`${g+1}`))}}t.namePrefix&&(typeof e.name=="string"?e.name=t.namePrefix+e.name:Array.isArray(e.name)&&e.name.length>0&&(e.name=[t.namePrefix+e.name[0],...e.name.slice(1)])),t.nameSuffix&&(typeof e.name=="string"?e.name=e.name+t.nameSuffix:Array.isArray(e.name)&&e.name.length>0&&(e.name=[...e.name.slice(0,e.name.length-1),e.name[e.name.length-1]+t.nameSuffix]));let r=this.hasResourceChanged(e),s=r||this.hasPathLabelChanged(e),l=this.hasFileKindChanged(t),c=this.hasIconChanged(t);this.label=e,this.options=t,r&&(this.computedLanguageId=void 0),s&&(this.computedPathLabel=void 0),this.render({updateIcon:r||l||c,updateDecoration:r||l})}hasFileKindChanged(e){let t=e?.fileKind,o=this.options?.fileKind;return t!==o}hasResourceChanged(e){let t=bG(e),o=bG(this.label);return t&&o?t.toString()!==o.toString():!(!t&&!o)}hasPathLabelChanged(e){let t=bG(e);return!!t&&this.computedPathLabel!==this.labelService.getUriLabel(t)}hasIconChanged(e){return this.options?.icon!==e?.icon}clear(){this.label=void 0,this.options=void 0,this.computedLanguageId=void 0,this.computedIconClasses=void 0,this.computedPathLabel=void 0,this.setLabel("")}render(e){if(this.isHidden)return this.needsRedraw!==2&&(this.needsRedraw=e.updateIcon||e.updateDecoration?2:1),!1;if(e.updateIcon&&(this.computedIconClasses=void 0),!this.label)return!1;let t={title:"",bold:this.options?.bold,italic:this.options?.italic,strikethrough:this.options?.strikethrough,matches:this.options?.matches,descriptionMatches:this.options?.descriptionMatches,extraClasses:[],separator:this.options?.separator,domId:this.options?.domId,disabledCommand:this.options?.disabledCommand,labelEscapeNewLines:this.options?.labelEscapeNewLines,descriptionTitle:this.options?.descriptionTitle,supportIcons:this.options?.supportIcons},o=bG(this.label);if(this.options?.title!==void 0&&(t.title=this.options.title),o&&o.scheme!==Q.data&&(!this.options?.title||typeof this.options.title!="string"&&!this.options.title.markdownNotSupportedFallback)&&(this.computedPathLabel||(this.computedPathLabel=this.labelService.getUriLabel(o)),!t.title||typeof t.title=="string"?t.title=this.computedPathLabel:t.title.markdownNotSupportedFallback||(t.title.markdownNotSupportedFallback=this.computedPathLabel)),this.options&&!this.options.hideIcon&&(this.computedIconClasses||(this.computedIconClasses=Ia(this.modelService,this.languageService,o,this.options.fileKind,this.options.icon)),A.isUri(this.options.icon)&&(t.iconPath=this.options.icon),t.extraClasses=this.computedIconClasses.slice(0)),this.options?.extraClasses&&t.extraClasses.push(...this.options.extraClasses),this.options?.fileDecorations&&o){e.updateDecoration&&(this.decoration.value=this.decorationsService.getDecoration(o,this.options.fileKind!==0));let n=this.decoration.value;if(n){if(n.tooltip){if(typeof t.title=="string")t.title=`${t.title} \u2022 ${n.tooltip}`;else if(typeof t.title?.markdown=="string"){let r=`${t.title.markdown} \u2022 ${n.tooltip}`;t.title={markdown:r,markdownNotSupportedFallback:r}}}n.strikethrough&&(t.strikethrough=!0),this.options.fileDecorations.colors&&t.extraClasses.push(n.labelClassName),this.options.fileDecorations.badges&&(t.extraClasses.push(n.badgeClassName),t.extraClasses.push(n.iconClassName))}}return this.label.range&&(t.suffix=this.label.range.startLineNumber!==this.label.range.endLineNumber?`:${this.label.range.startLineNumber}-${this.label.range.endLineNumber}`:`:${this.label.range.startLineNumber}`),this.setLabel(this.label.name??"",this.label.description,t),this._onDidRender.fire(),!0}dispose(){super.dispose(),this.label=void 0,this.options=void 0,this.computedLanguageId=void 0,this.computedIconClasses=void 0,this.computedPathLabel=void 0,this.computedWorkspaceFolderLabel=void 0}};kZe=I([m(2,Rt),m(3,_t),m(4,mb),m(5,nt),m(6,Uo),m(7,Ae),m(8,s3)],kZe);var Pme=class extends k{constructor(e,t,o,n){super();this.configurationService=e;this._date=D(o,_("span.timestamp")),this._date.style.display="none",this._useRelativeTime=this.useRelativeTimeSetting,this.hover=this._register(t.setupManagedHover(yi("mouse"),this._date,"")),this.setTimestamp(n)}get useRelativeTimeSetting(){return this.configurationService.getValue(fG).useRelativeTime}async setTimestamp(e){(e!==this._timestamp||this.useRelativeTimeSetting!==this._useRelativeTime)&&this.updateDate(e),this._timestamp=e,this._useRelativeTime=this.useRelativeTimeSetting}updateDate(e){if(!e)this._date.textContent="",this._date.style.display="none";else if(e!==this._timestamp||this.useRelativeTimeSetting!==this._useRelativeTime){this._date.style.display="";let t,o;this.useRelativeTimeSetting?(t=this.getRelative(e),o=this.getDateString(e)):t=this.getDateString(e),this._date.textContent=t,this.hover.update(o??"")}}getRelative(e){return ea(e,!0,!0)}getDateString(e){return e.toLocaleString(Kr)}};var Zwi=te("commentsView.resolvedIcon",{dark:rsi,light:rsi,hcDark:Ei,hcLight:Ei},d(10234,null)),eCi=te("commentsView.unresolvedIcon",{dark:F3e,light:F3e,hcDark:Ei,hcLight:Ei},d(10236,null));te("editorCommentsWidget.replyInputBackground",ZB,d(10230,null));var UJo=te("editorCommentsWidget.resolvedBorder",{dark:Zwi,light:Zwi,hcDark:Ei,hcLight:Ei},d(10233,null)),tCi=te("editorCommentsWidget.unresolvedBorder",{dark:eCi,light:eCi,hcDark:Ei,hcLight:Ei},d(10235,null)),GPl=te("editorCommentsWidget.rangeBackground",ni(tCi,.1),d(10232,null)),qPl=te("editorCommentsWidget.rangeActiveBackground",ni(tCi,.1),d(10231,null)),zJo=new Map([[0,tCi],[1,UJo]]),KJo=new Map([[0,eCi],[1,Zwi]]),mpo="--comment-thread-state-color",iCi="--comment-view-thread-state-color",hpo="--comment-thread-state-background-color";function gpo(a,i,e){let t=a!==void 0?e.get(a):void 0;return t!==void 0?i.getColor(t):void 0}function fpo(a,i){return gpo(a,i,zJo)}function vpo(a,i){return gpo(a,i,KJo)}var ZH=class{constructor(i,e,t){this.filter=i;this.showResolved=!0;this.showUnresolved=!0;i=i.trim(),this.showResolved=e,this.showUnresolved=t;let o=i.startsWith("!");this.textFilter={text:(o?ax(i,"!"):i).trim(),negate:o}}static{this._filter=hke}static{this._messageFilter=xh}};var gp="workbench.panel.comments",bpo="Comments",TZe=P(10308,"Comments"),oCi=class a{static{this.RESOURCE_ID="resource-with-comments"}static{this.COMMENT_ID="comment-node"}getHeight(i){return i instanceof u_&&i.hasReply()?44:22}getTemplateId(i){return i instanceof RC?a.RESOURCE_ID:i instanceof u_?a.COMMENT_ID:""}},nCi=class{constructor(i){this.labels=i;this.templateId="resource-with-comments"}renderTemplate(i){let e=D(i,_(".resource-container")),t=this.labels.create(e),o=D(e,_(".separator")),n=e.appendChild(_(".owner"));return{resourceLabel:t,owner:n,separator:o}}renderElement(i,e,t){t.resourceLabel.setFile(i.element.resource),t.separator.innerText="\xB7",i.element.ownerLabel?(t.owner.innerText=i.element.ownerLabel,t.separator.style.display="inline"):(t.owner.innerText="",t.separator.style.display="none")}disposeTemplate(i){i.resourceLabel.dispose()}},Nme=class{constructor(i){this.menuService=i}getResourceActions(i){return{actions:this.getActions(R.CommentsViewThreadActions,i).primary}}getResourceContextActions(i){return this.getActions(R.CommentsViewThreadActions,i).secondary}setContextKeyService(i){this.contextKeyService=i}getActions(i,e){if(!this.contextKeyService)return{primary:[],secondary:[]};let t=[["commentController",e.owner],["resourceScheme",e.resource.scheme],["commentThread",e.contextValue],["canReply",e.thread.canReply]],o=this.contextKeyService.createOverlay(t),n=this.menuService.getMenuActions(i,o,{shouldForwardArgs:!0});return um(n,"inline")}dispose(){this.contextKeyService=void 0}};Nme=I([m(0,Yt)],Nme);var EZe=class{constructor(i,e,t,o,n){this.actionViewItemProvider=i;this.menus=e;this.configurationService=t;this.hoverService=o;this.themeService=n;this.templateId="comment-node"}renderTemplate(i){let e=D(i,_(".comment-thread-container")),t=D(e,_(".comment-metadata-container")),o=D(t,_(".comment-metadata")),n=D(o,_(".icon")),r=D(o,_(".user")),s=new Pme(this.configurationService,this.hoverService,D(o,_(".timestamp-container"))),l=D(o,_(".relevance")),c=D(o,_(".separator")),u=D(o,_(".text")),p=D(o,_(".range")),h=_("p");p.appendChild(h);let g={icon:n,userNames:r,timestamp:s,relevance:l,separator:c,commentPreview:u,range:h};g.separator.innerText="\xB7";let f=D(t,_(".actions")),v=new oo(f,{actionViewItemProvider:this.actionViewItemProvider}),b=D(e,_(".comment-snippet-container")),S={container:b,icon:D(b,_(".icon")),count:D(b,_(".count")),lastReplyDetail:D(b,_(".reply-detail")),separator:D(b,_(".separator")),timestamp:new Pme(this.configurationService,this.hoverService,D(b,_(".timestamp-container")))};S.separator.innerText="\xB7",S.icon.classList.add(...q.asClassNameArray(L.indent));let y=[g.timestamp,S.timestamp];return{threadMetadata:g,repliesMetadata:S,actionBar:v,disposables:y,elementDisposables:new O}}getCountString(i){return i>2?d(10309,null,i-1):i===2?d(10310,null):d(10305,null)}getRenderedComment(i){let e=Lg(i,{},document.createElement("span")),t=e.element.getElementsByTagName("img");for(let n=0;n<t.length;n++){let r=t[n],s=_("");s.textContent=r.alt?d(10312,null,r.alt):d(10311,null),r.replaceWith(s)}let o=[...e.element.getElementsByTagName("h1"),...e.element.getElementsByTagName("h2"),...e.element.getElementsByTagName("h3"),...e.element.getElementsByTagName("h4"),...e.element.getElementsByTagName("h5"),...e.element.getElementsByTagName("h6")];for(let n of o){let r=document.createTextNode(n.textContent||"");n.replaceWith(r)}for(;e.element.children.length>1&&e.element.firstElementChild?.tagName==="HR";)e.element.removeChild(e.element.firstElementChild);return e}getIcon(i,e){return e?L.commentDraft:i===0?L.commentUnresolved:L.comment}renderElement(i,e,t){t.actionBar.clear();let o=i.element.replies.length+1;i.element.threadRelevance===1?(t.threadMetadata.relevance.style.display="",t.threadMetadata.relevance.innerText=d(10314,null),t.threadMetadata.separator.style.display="none"):(t.threadMetadata.relevance.innerText="",t.threadMetadata.relevance.style.display="none",t.threadMetadata.separator.style.display=""),t.threadMetadata.icon.classList.remove(...Array.from(t.threadMetadata.icon.classList.values()).filter(c=>c.startsWith("codicon")));let n=i.element.thread.comments?.some(c=>c.state===1);if(t.threadMetadata.icon.classList.add(...q.asClassNameArray(this.getIcon(i.element.threadState,n))),i.element.threadState!==void 0){let c=this.getCommentThreadWidgetStateColor(i.element.threadState,this.themeService.getColorTheme());t.threadMetadata.icon.style.setProperty(iCi,`${c}`),t.threadMetadata.icon.style.color=`var(${iCi})`}t.threadMetadata.userNames.textContent=i.element.comment.userName,t.threadMetadata.timestamp.setTimestamp(i.element.comment.timestamp?new Date(i.element.comment.timestamp):void 0);let r=i.element;if(t.threadMetadata.commentPreview.innerText="",t.threadMetadata.commentPreview.style.height="22px",typeof r.comment.body=="string")t.threadMetadata.commentPreview.innerText=r.comment.body;else{let c=this.getRenderedComment(r.comment.body);t.elementDisposables.add(c);for(let u=c.element.children.length-1;u>=1;u--)c.element.removeChild(c.element.children[u]);t.threadMetadata.commentPreview.appendChild(c.element),t.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.threadMetadata.commentPreview,c.element.textContent??""))}i.element.range&&(i.element.range.startLineNumber===i.element.range.endLineNumber?t.threadMetadata.range.textContent=d(10306,null,i.element.range.startLineNumber):t.threadMetadata.range.textContent=d(10307,null,i.element.range.startLineNumber,i.element.range.endLineNumber));let s=this.menus.getResourceActions(i.element);if(t.actionBar.push(s.actions,{icon:!0,label:!1}),t.actionBar.context={commentControlHandle:i.element.controllerHandle,commentThreadHandle:i.element.threadHandle,$mid:7},!i.element.hasReply()){t.repliesMetadata.container.style.display="none";return}t.repliesMetadata.container.style.display="",t.repliesMetadata.count.textContent=this.getCountString(o);let l=i.element.replies[i.element.replies.length-1].comment;t.repliesMetadata.lastReplyDetail.textContent=d(10313,null,l.userName),t.repliesMetadata.timestamp.setTimestamp(l.timestamp?new Date(l.timestamp):void 0)}getCommentThreadWidgetStateColor(i,e){return i!==void 0?vpo(i,e):void 0}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.disposables.forEach(e=>e.dispose()),i.elementDisposables.dispose(),i.actionBar.dispose()}};EZe=I([m(2,B),m(3,ot),m(4,Pe)],EZe);var _Ft=class{constructor(i){this.options=i}filter(i,e){return this.options.filter===""&&this.options.showResolved&&this.options.showUnresolved?1:i instanceof RC?this.filterResourceMarkers(i):this.filterCommentNode(i,e)}filterResourceMarkers(i){if(this.options.textFilter.text&&!this.options.textFilter.negate){let e=ZH._filter(this.options.textFilter.text,Be(i.resource));if(e)return{visibility:!0,data:{type:0,uriMatches:e||[]}}}return 2}filterCommentNode(i,e){if(!(i.threadState===void 0||this.options.showResolved&&1===i.threadState||this.options.showUnresolved&&0===i.threadState))return!1;if(!this.options.textFilter.text)return!0;let o=ZH._messageFilter(this.options.textFilter.text,typeof i.comment.body=="string"?i.comment.body:i.comment.body.value)||ZH._messageFilter(this.options.textFilter.text,i.comment.userName)||i.replies.map(n=>ZH._messageFilter(this.options.textFilter.text,n.comment.userName)||ZH._messageFilter(this.options.textFilter.text,typeof n.comment.body=="string"?n.comment.body:n.comment.body.value)).filter(n=>!!n).flat();return o.length&&!this.options.textFilter.negate?{visibility:!0,data:{type:1,textMatches:o}}:o.length&&this.options.textFilter.negate&&e===2?!1:o.length===0&&this.options.textFilter.negate&&e===2?!0:e}},iLe=class extends hf{constructor(e,t,o,n,r,s,l,c,u){let p=new oCi,h=ta.bind(void 0,s),g=s.createInstance(Nme);g.setContextKeyService(n);let f=[s.createInstance(nCi,e),s.createInstance(EZe,h,g)];super("CommentsTree",t,p,f,{accessibilityProvider:o.accessibilityProvider,identityProvider:{getId:v=>v instanceof vG?"root":v instanceof RC?`${v.uniqueOwner}-${v.id}`:v instanceof u_?`${v.uniqueOwner}-${v.resource.toString()}-${v.threadId}-${v.comment.uniqueIdInThread}`+(v.isRoot?"-root":""):""},expandOnlyOnTwistieClick:!0,collapseByDefault:!1,overrideStyles:o.overrideStyles,filter:o.filter,sorter:o.sorter,findWidgetEnabled:!1,multipleSelectionSupport:!1},s,n,r,l);this.contextMenuService=c;this.keybindingService=u;this.menus=g,this.disposables.add(this.onContextMenu(v=>this.commentsOnContextMenu(v)))}commentsOnContextMenu(e){let t=e.element;if(!(t instanceof u_))return;let o=e.browserEvent;o.preventDefault(),o.stopPropagation(),this.setFocus([t]);let n=this.menus.getResourceContextActions(t);n.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>n,getActionViewItem:r=>{let s=this.keybindingService.lookupKeybinding(r.id);if(s)return new ts(r,r,{label:!0,keybinding:s.getLabel()})},onHide:r=>{r&&this.domFocus()},getActionsContext:()=>({commentControlHandle:t.controllerHandle,commentThreadHandle:t.threadHandle,$mid:7,thread:t.thread})})}filterComments(){this.refilter()}getVisibleItemCount(){let e=0,t=this.getNode();for(let o of t.children)for(let n of o.children)n.visible&&o.visible&&e++;return e}};iLe=I([m(3,X),m(4,Co),m(5,F),m(6,B),m(7,Xe),m(8,Le)],iLe);var DFt=class a extends k{constructor(e){super();this.expandedSize=void 0;this._headerVisible=!0;this._collapsible=!0;this._bodyRendered=!1;this.styles={dropBackground:void 0,headerBackground:void 0,headerBorder:void 0,headerForeground:void 0,leftBorder:void 0};this.animationTimer=void 0;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onDidChangeExpansionState=this._register(new T);this.onDidChangeExpansionState=this._onDidChangeExpansionState.event;this.orthogonalSize=0;this._expanded=typeof e.expanded>"u"?!0:!!e.expanded,this._orientation=typeof e.orientation>"u"?0:e.orientation,this._ariaHeaderLabel=this.getAriaHeaderLabel(e.title),this._minimumBodySize=typeof e.minimumBodySize=="number"?e.minimumBodySize:this._orientation===1?200:120,this._maximumBodySize=typeof e.maximumBodySize=="number"?e.maximumBodySize:Number.POSITIVE_INFINITY,this.element=_(".pane")}static{this.HEADER_SIZE=22}get ariaHeaderLabel(){return this._ariaHeaderLabel}set ariaHeaderLabel(e){this._ariaHeaderLabel=e,this.header?.setAttribute("aria-label",this.ariaHeaderLabel)}get draggableElement(){return this.header}get dropTargetElement(){return this.element}get dropBackground(){return this.styles.dropBackground}get minimumBodySize(){return this._minimumBodySize}set minimumBodySize(e){this._minimumBodySize=e,this._onDidChange.fire(void 0)}get maximumBodySize(){return this._maximumBodySize}set maximumBodySize(e){this._maximumBodySize=e,this._onDidChange.fire(void 0)}get headerSize(){return this.headerVisible?a.HEADER_SIZE:0}get minimumSize(){let e=this.headerSize,o=!this.headerVisible||this.isExpanded()?this.minimumBodySize:0;return e+o}get maximumSize(){let e=this.headerSize,o=!this.headerVisible||this.isExpanded()?this.maximumBodySize:0;return e+o}getAriaHeaderLabel(e){return d(31,null,e)}isExpanded(){return this._expanded}setExpanded(e){return!e&&!this.collapsible||this._expanded===!!e?!1:(this.element?.classList.toggle("expanded",e),this._expanded=!!e,this.updateHeader(),e?(this._bodyRendered||(this.renderBody(this.body),this._bodyRendered=!0),typeof this.animationTimer=="number"&&Me(this.element).clearTimeout(this.animationTimer),D(this.element,this.body)):this.animationTimer=Me(this.element).setTimeout(()=>{this.body.remove()},200),this._onDidChangeExpansionState.fire(e),this._onDidChange.fire(e?this.expandedSize:void 0),!0)}get headerVisible(){return this._headerVisible}set headerVisible(e){this._headerVisible!==!!e&&(this._headerVisible=!!e,this.updateHeader(),this._onDidChange.fire(void 0))}get collapsible(){return this._collapsible}set collapsible(e){this._collapsible!==!!e&&(this._collapsible=!!e,this.updateHeader())}get orientation(){return this._orientation}set orientation(e){this._orientation!==e&&(this._orientation=e,this.element&&(this.element.classList.toggle("horizontal",this.orientation===1),this.element.classList.toggle("vertical",this.orientation===0)),this.header&&this.updateHeader())}render(){this.element.classList.toggle("expanded",this.isExpanded()),this.element.classList.toggle("horizontal",this.orientation===1),this.element.classList.toggle("vertical",this.orientation===0),this.header=_(".pane-header"),D(this.element,this.header),this.header.setAttribute("tabindex","0"),this.header.setAttribute("role","button"),this.header.setAttribute("aria-label",this.ariaHeaderLabel),this.renderHeader(this.header);let e=nr(this.header);this._register(e),this._register(e.onDidFocus(()=>this.header?.classList.add("focused"),null)),this._register(e.onDidBlur(()=>this.header?.classList.remove("focused"),null)),this.updateHeader();let t=this._register(new O),o=this._register(new Zn(this.header,"keydown")),n=U.map(o.event,s=>new mi(s),t);this._register(U.filter(n,s=>s.keyCode===3||s.keyCode===10,t)(()=>this.setExpanded(!this.isExpanded()),null)),this._register(U.filter(n,s=>s.keyCode===15,t)(()=>this.setExpanded(!1),null)),this._register(U.filter(n,s=>s.keyCode===17,t)(()=>this.setExpanded(!0),null)),this._register(ds.addTarget(this.header));let r=this.header;[ne.CLICK,Vn.Tap].forEach(s=>{this._register($(r,s,l=>{l.defaultPrevented||this.setExpanded(!this.isExpanded())}))}),this.body=D(this.element,_(".pane-body")),!this._bodyRendered&&this.isExpanded()&&(this.renderBody(this.body),this._bodyRendered=!0),this.isExpanded()||this.body.remove()}layout(e){let t=this.headerVisible?a.HEADER_SIZE:0,o=this._orientation===0?this.orthogonalSize:e,n=this._orientation===0?e-t:this.orthogonalSize-t;this.isExpanded()&&(this.body.classList.toggle("wide",o>=600),this.layoutBody(n,o),this.expandedSize=e)}style(e){this.styles=e,this.header&&this.updateHeader()}updateHeader(){if(!this.header)return;let e=!this.headerVisible||this.isExpanded();this.collapsible?(this.header.setAttribute("tabindex","0"),this.header.setAttribute("role","button")):(this.header.removeAttribute("tabindex"),this.header.removeAttribute("role")),this.header.style.lineHeight=`${this.headerSize}px`,this.header.classList.toggle("hidden",!this.headerVisible),this.header.classList.toggle("expanded",e),this.header.classList.toggle("not-collapsible",!this.collapsible),this.header.setAttribute("aria-expanded",String(e)),this.header.style.color=this.collapsible?this.styles.headerForeground??"":"",this.header.style.backgroundColor=(this.collapsible?this.styles.headerBackground:"transparent")??"",this.header.style.borderTop=this.styles.headerBorder&&this.orientation===0?`1px solid ${this.styles.headerBorder}`:"",this.element.style.borderLeft=this.styles.leftBorder&&this.orientation===1?`1px solid ${this.styles.leftBorder}`:""}},rCi=class a extends k{constructor(e,t,o){super();this.pane=e;this.dnd=t;this.context=o;this.dragOverCounter=0;this._onDidDrop=this._register(new T);this.onDidDrop=this._onDidDrop.event;e.draggableElement.draggable=!0,this._register($(e.draggableElement,"dragstart",n=>this.onDragStart(n))),this._register($(e.dropTargetElement,"dragenter",n=>this.onDragEnter(n))),this._register($(e.dropTargetElement,"dragleave",n=>this.onDragLeave(n))),this._register($(e.dropTargetElement,"dragend",n=>this.onDragEnd(n))),this._register($(e.dropTargetElement,"drop",n=>this.onDrop(n)))}static{this.DefaultDragOverBackgroundColor=new Ue(new Ut(128,128,128,.5))}onDragStart(e){if(!this.dnd.canDrag(this.pane)||!e.dataTransfer){e.preventDefault(),e.stopPropagation();return}let t=this.pane.draggableElement?.textContent||"";e.dataTransfer.effectAllowed="move",ed&&e.dataTransfer?.setData(Fl.TEXT,t),LA(e,this.pane.element,t),this.context.draggable=this}onDragEnter(e){!this.context.draggable||this.context.draggable===this||this.dnd.canDrop(this.context.draggable.pane,this.pane)&&(this.dragOverCounter++,this.render())}onDragLeave(e){!this.context.draggable||this.context.draggable===this||this.dnd.canDrop(this.context.draggable.pane,this.pane)&&(this.dragOverCounter--,this.dragOverCounter===0&&this.render())}onDragEnd(e){this.context.draggable&&(this.dragOverCounter=0,this.render(),this.context.draggable=null)}onDrop(e){this.context.draggable&&(Kt.stop(e),this.dragOverCounter=0,this.render(),this.dnd.canDrop(this.context.draggable.pane,this.pane)&&this.context.draggable!==this&&this._onDidDrop.fire({from:this.context.draggable.pane,to:this.pane}),this.context.draggable=null)}render(){let e=null;this.dragOverCounter>0&&(e=this.pane.dropBackground??a.DefaultDragOverBackgroundColor.toString()),this.pane.dropTargetElement.style.backgroundColor=e||""}};var RFt=class extends k{constructor(e,t={}){super();this.dndContext={draggable:null};this.paneItems=[];this.orthogonalSize=0;this.size=0;this.animationTimer=void 0;this._onDidDrop=this._register(new T);this.onDidDrop=this._onDidDrop.event;this.dnd=t.dnd,this.orientation=t.orientation??0,this.element=D(e,_(".monaco-pane-view")),this.splitview=this._register(new Gp(this.element,{orientation:this.orientation})),this.onDidSashReset=this.splitview.onDidSashReset,this.onDidSashChange=this.splitview.onDidSashChange,this.onDidScroll=this.splitview.onDidScroll;let o=this._register(new O),n=this._register(new Zn(this.element,"keydown")),r=U.map(U.filter(n.event,s=>go(s.target)&&s.target.classList.contains("pane-header"),o),s=>new mi(s),o);this._register(U.filter(r,s=>s.keyCode===16,o)(()=>this.focusPrevious())),this._register(U.filter(r,s=>s.keyCode===18,o)(()=>this.focusNext()))}addPane(e,t,o=this.splitview.length){let n=new O;e.onDidChangeExpansionState(this.setupAnimation,this,n);let r={pane:e,disposable:n};if(this.paneItems.splice(o,0,r),e.orientation=this.orientation,e.orthogonalSize=this.orthogonalSize,this.splitview.addView(e,t,o),this.dnd){let s=new rCi(e,this.dnd,this.dndContext);n.add(s),n.add(s.onDidDrop(this._onDidDrop.fire,this._onDidDrop))}}removePane(e){let t=this.paneItems.findIndex(n=>n.pane===e);if(t===-1)return;this.splitview.removeView(t,e.isExpanded()?Ac.Distribute:void 0),this.paneItems.splice(t,1)[0].disposable.dispose()}movePane(e,t){let o=this.paneItems.findIndex(s=>s.pane===e),n=this.paneItems.findIndex(s=>s.pane===t);if(o===-1||n===-1)return;let[r]=this.paneItems.splice(o,1);this.paneItems.splice(n,0,r),this.splitview.moveView(o,n)}resizePane(e,t){let o=this.paneItems.findIndex(n=>n.pane===e);o!==-1&&this.splitview.resizeView(o,t)}getPaneSize(e){let t=this.paneItems.findIndex(o=>o.pane===e);return t===-1?-1:this.splitview.getViewSize(t)}layout(e,t){this.orthogonalSize=this.orientation===0?t:e,this.size=this.orientation===1?t:e;for(let o of this.paneItems)o.pane.orthogonalSize=this.orthogonalSize;this.splitview.layout(this.size)}setBoundarySashes(e){this.boundarySashes=e,this.updateSplitviewOrthogonalSashes(e)}updateSplitviewOrthogonalSashes(e){this.orientation===0?(this.splitview.orthogonalStartSash=e?.left,this.splitview.orthogonalEndSash=e?.right):this.splitview.orthogonalEndSash=e?.bottom}flipOrientation(e,t){this.orientation=this.orientation===0?1:0;let o=this.paneItems.map(s=>this.getPaneSize(s.pane));this.splitview.dispose(),St(this.element),this.splitview=this._register(new Gp(this.element,{orientation:this.orientation})),this.updateSplitviewOrthogonalSashes(this.boundarySashes);let n=this.orientation===0?t:e,r=this.orientation===1?t:e;this.paneItems.forEach((s,l)=>{s.pane.orthogonalSize=n,s.pane.orientation=this.orientation;let c=this.size===0?0:r*o[l]/this.size;this.splitview.addView(s.pane,c,l)}),this.size=r,this.orthogonalSize=n,this.splitview.layout(this.size)}setupAnimation(){typeof this.animationTimer=="number"&&Me(this.element).clearTimeout(this.animationTimer),this.element.classList.add("animated"),this.animationTimer=Me(this.element).setTimeout(()=>{this.animationTimer=void 0,this.element.classList.remove("animated")},200)}getPaneHeaderElements(){return[...this.element.querySelectorAll(".pane-header")]}focusPrevious(){let e=this.getPaneHeaderElements(),t=e.indexOf(this.element.ownerDocument.activeElement);t!==-1&&e[Math.max(t-1,0)].focus()}focusNext(){let e=this.getPaneHeaderElements(),t=e.indexOf(this.element.ownerDocument.activeElement);t!==-1&&e[Math.min(t+1,e.length-1)].focus()}dispose(){super.dispose(),this.paneItems.forEach(e=>e.disposable.dispose())}};var LFt=class{constructor(i){this.nodes=i}toString(){return this.nodes.map(i=>typeof i=="string"?i:i.label).join("")}};I([bi],LFt.prototype,"toString",1);var $Jo=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function ZS(a){let i=[],e=0,t;for(;t=$Jo.exec(a);){t.index-e>0&&i.push(a.substring(e,t.index));let[,o,n,,r]=t;r?i.push({label:o,href:n,title:r}):i.push({label:o,href:n}),e=t.index+t[0].length}return e<a.length&&i.push(a.substring(e)),new LFt(i)}var jJo=()=>({msLoopTime:-1,msDelayTime:-1,dispose:()=>{}}),Spo=jJo;function Ipo(a){Spo=a}function ypo(a,i){return Spo(a,i)}var sCi="done",aCi="active",MFt="infinite",PFt="infinite-long-running",lCi="discrete",QJo=d(28,null);var Cv=class a extends k{constructor(e,t){super();this.progressSignal=this._register(new ue);this.workedVal=0,this.showDelayedScheduler=this._register(new Dt(()=>Xo(this.element),0)),this.longRunningScheduler=this._register(new Dt(()=>this.infiniteLongRunning(),a.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e,t)}static{this.LONG_RUNNING_INFINITE_THRESHOLD=1e4}static{this.PROGRESS_SIGNAL_DEFAULT_DELAY=3e3}create(e,t){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),this.element.setAttribute("aria-label",t?.ariaLabel&&t.ariaLabel.trim()?t.ariaLabel:QJo),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.bit.style.backgroundColor=t?.progressBarBackground||"#0E70C0",this.element.appendChild(this.bit)}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(aCi,MFt,PFt,lCi),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel(),this.progressSignal.clear()}done(){return this.doDone(!0)}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(sCi),this.element.classList.contains(MFt)?(this.bit.style.opacity="0",e?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",e?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(lCi,sCi,PFt),this.element.classList.add(aCi,MFt),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(PFt)}total(e){return this.workedVal=0,this.totalWork=e,this.element.setAttribute("aria-valuemax",e.toString()),this}hasTotal(){return on(this.totalWork)}worked(e){return e=Math.max(1,Number(e)),this.doSetWorked(this.workedVal+e)}setWorked(e){return e=Math.max(1,Number(e)),this.doSetWorked(e)}doSetWorked(e){let t=this.totalWork||100;return this.workedVal=e,this.workedVal=Math.min(t,this.workedVal),this.element.classList.remove(MFt,PFt,sCi),this.element.classList.add(aCi,lCi),this.element.setAttribute("aria-valuenow",e.toString()),this.bit.style.width=100*(this.workedVal/t)+"%",this}getContainer(){return this.element}show(e){this.showDelayedScheduler.cancel(),this.progressSignal.value=ypo(a.PROGRESS_SIGNAL_DEFAULT_DELAY),typeof e=="number"?this.showDelayedScheduler.schedule(e):Xo(this.element)}hide(){Wi(this.element),this.showDelayedScheduler.cancel(),this.progressSignal.clear()}};var AFt=class extends k{constructor(e,t){super();this.progressBar=e;this.group=t;this.registerListeners()}registerListeners(){this._register(this.group.onDidModelChange(e=>{(e.kind===8||e.kind===6&&this.group.isEmpty)&&this.progressBar.stop().hide()}))}show(e,t){return this.group.isEmpty?Nxt:e===!0?this.doShow(!0,t):this.doShow(e,t)}doShow(e,t){return typeof e=="boolean"?this.progressBar.infinite().show(t):this.progressBar.total(e).show(t),{total:o=>{this.progressBar.total(o)},worked:o=>{this.progressBar.hasTotal()?this.progressBar.worked(o):this.progressBar.infinite().show()},done:()=>{this.progressBar.stop().hide()}}}async showWhile(e,t){if(this.group.isEmpty)try{await e}catch{}return this.doShowWhile(e,t)}async doShowWhile(e,t){try{this.progressBar.infinite().show(t),await e}catch{}finally{this.progressBar.stop().hide()}}},eU;(r=>{let a;(h=>(h[h.None=0]="None",h[h.Done=1]="Done",h[h.Infinite=2]="Infinite",h[h.While=3]="While",h[h.Work=4]="Work"))(a=r.Type||={}),r.None={type:0},r.Done={type:1},r.Infinite={type:2};class o{constructor(l,c,u){this.whilePromise=l;this.whileStart=c;this.whileDelay=u;this.type=3}}r.While=o;class n{constructor(l,c){this.total=l;this.worked=c;this.type=4}}r.Work=n})(eU||={});var oLe=class extends k{constructor(e,t){super();this.progressBar=e;this.scope=t;this.progressState=eU.None;this.registerListeners()}registerListeners(){this._register(this.scope.onDidChangeActive(()=>{this.scope.isActive?this.onDidScopeActivate():this.onDidScopeDeactivate()}))}onDidScopeActivate(){if(this.progressState.type!==eU.Done.type)if(this.progressState.type===3){let e;if(this.progressState.whileDelay>0){let t=this.progressState.whileDelay-(Date.now()-this.progressState.whileStart);t>0&&(e=t)}this.doShowWhile(e)}else this.progressState.type===2?this.progressBar.infinite().show():this.progressState.type===4&&(this.progressState.total&&this.progressBar.total(this.progressState.total).show(),this.progressState.worked&&this.progressBar.worked(this.progressState.worked).show())}onDidScopeDeactivate(){this.progressBar.stop().hide()}show(e,t){return typeof e=="boolean"?this.progressState=eU.Infinite:this.progressState=new eU.Work(e,void 0),this.scope.isActive&&(this.progressState.type===2?this.progressBar.infinite().show(t):this.progressState.type===4&&typeof this.progressState.total=="number"&&this.progressBar.total(this.progressState.total).show(t)),{total:o=>{this.progressState=new eU.Work(o,this.progressState.type===4?this.progressState.worked:void 0),this.scope.isActive&&this.progressBar.total(o)},worked:o=>{!this.scope.isActive||this.progressBar.hasTotal()?(this.progressState=new eU.Work(this.progressState.type===4?this.progressState.total:void 0,this.progressState.type===4&&typeof this.progressState.worked=="number"?this.progressState.worked+o:o),this.scope.isActive&&this.progressBar.worked(o)):(this.progressState=eU.Infinite,this.progressBar.infinite().show())},done:()=>{this.progressState=eU.Done,this.scope.isActive&&this.progressBar.stop().hide()}}}async showWhile(e,t){this.progressState.type===3&&(e=Promise.allSettled([e,this.progressState.whilePromise])),this.progressState=new eU.While(e,t||0,Date.now());try{this.doShowWhile(t),await e}catch{}finally{(this.progressState.type!==3||this.progressState.whilePromise===e)&&(this.progressState=eU.None,this.scope.isActive&&this.progressBar.stop().hide())}}doShowWhile(e){this.scope.isActive&&this.progressBar.infinite().show(e)}},nLe=class extends k{constructor(e,t){super();this.scopeId=e;this._isActive=t;this._onDidChangeActive=this._register(new T);this.onDidChangeActive=this._onDidChangeActive.event}get isActive(){return this._isActive}onScopeOpened(e){e===this.scopeId&&(this._isActive||(this._isActive=!0,this._onDidChangeActive.fire()))}onScopeClosed(e){e===this.scopeId&&this._isActive&&(this._isActive=!1,this._onDidChangeActive.fire())}};var wpo=new R("menu.view.filter"),qx=new R("submenu.view.filter");be.appendMenuItem(wpo,{submenu:qx,title:d(5161,null),group:"navigation",icon:L.filter});var cCi=class extends FT{constructor(){super(...arguments);this._checked=!1}set checked(e){this._checked!==e&&(this._checked=e,this.updateChecked())}updateChecked(){this.element&&this.element.classList.toggle("checked",this._checked)}render(e){super.render(e),this.updateChecked()}},SG=class extends ll{constructor(e,t,o,n,r,s,l){super();this.options=e;this.instantiationService=t;this.contextViewService=o;this.keybindingService=r;this.configurationService=s;this.accessibilityService=l;this._onDidChangeFilterText=this._register(new T);this.onDidChangeFilterText=this._onDidChangeFilterText.event;this._onDidAcceptFilterText=this._register(new T);this.onDidAcceptFilterText=this._onDidAcceptFilterText.event;this.isMoreFiltersChecked=!1;this._accessibilityHelpHintAnnounced=!1;this.delayedFilterUpdate=new rn(300),this._register(ee(()=>this.delayedFilterUpdate.cancel())),e.focusContextKey&&(this.focusContextKey=new Y(e.focusContextKey,!1).bindTo(n)),this.element=_(".viewpane-filter"),[this.filterInputBox,this.focusTracker]=this.createInput(this.element),this._register(this.filterInputBox),this._register(this.focusTracker);let c=D(this.element,_(".viewpane-filter-controls"));this.filterBadge=this.createBadge(c),this.toolbar=this._register(this.createToolBar(c)),this.adjustInputBox()}get onDidFocus(){return this.focusTracker.onDidFocus}get onDidBlur(){return this.focusTracker.onDidBlur}hasFocus(){return this.filterInputBox.hasFocus()}focus(){this._updateFilterInputAriaLabel(),this.filterInputBox.focus()}_updateFilterInputAriaLabel(){let e=this.options.ariaLabel||d(5162,null);if(!this._accessibilityHelpHintAnnounced&&this.configurationService.getValue("accessibility.verbosity.find")&&this.accessibilityService.isScreenReaderOptimized()){let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t&&(e+=", "+d(5160,null,t),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=Zo(()=>{this.filterInputBox.setAriaLabel(this.options.ariaLabel||d(5162,null))},1e3))}this.filterInputBox.setAriaLabel(e)}blur(){this.filterInputBox.blur()}updateBadge(e){this.filterBadge.classList.toggle("hidden",!e),this.filterBadge.textContent=e||"",this.adjustInputBox()}setFilterText(e){this.filterInputBox.value=e}getFilterText(){return this.filterInputBox.value}getHistory(){return this.filterInputBox.getHistory()}layout(e){this.element.parentElement?.classList.toggle("grow",e>700),this.element.classList.toggle("small",e<400),this.adjustInputBox(),this.lastWidth=e}relayout(){this.lastWidth&&this.layout(this.lastWidth)}checkMoreFilters(e){this.isMoreFiltersChecked=e,this.moreFiltersActionViewItem&&(this.moreFiltersActionViewItem.checked=e)}createInput(e){let t=this.options.history||[],o=this._register(this.instantiationService.createInstance(YK,e,this.contextViewService,{placeholder:this.options.placeholder,ariaLabel:this.options.ariaLabel,history:new Set(t),showHistoryHint:()=>mM(this.keybindingService),inputBoxStyles:Wl}));this.options.text&&(o.value=this.options.text),this._register(o.onDidChange(r=>this.delayedFilterUpdate.trigger(()=>this.onDidInputChange(o)))),this._register(Yo(o.inputElement,ne.KEY_DOWN,r=>this.onInputKeyDown(r))),this._register(Yo(e,ne.KEY_DOWN,r=>this.handleKeyboardEvent(r))),this._register(Yo(e,ne.KEY_UP,r=>this.handleKeyboardEvent(r))),this._register(Yo(o.inputElement,ne.CLICK,r=>{r.stopPropagation(),r.preventDefault()}));let n=this._register(nr(o.inputElement));return this.focusContextKey&&(this._register(n.onDidFocus(()=>this.focusContextKey.set(!0))),this._register(n.onDidBlur(()=>this.focusContextKey.set(!1))),this._register(ee(()=>this.focusContextKey.reset()))),[o,n]}createBadge(e){let t=D(e,_(".viewpane-filter-badge.hidden"));return t.style.backgroundColor=Tt(Gv),t.style.color=Tt(gx),t.style.border=`1px solid ${Tt(Ei)}`,t}createToolBar(e){return this.instantiationService.createInstance(pr,e,wpo,{hiddenItemStrategy:-1,actionViewItemProvider:(t,o)=>{if(t instanceof id&&t.item.submenu.id===qx.id)return this.moreFiltersActionViewItem=this.instantiationService.createInstance(cCi,t,o),this.moreFiltersActionViewItem.checked=this.isMoreFiltersChecked,this.moreFiltersActionViewItem}})}onDidInputChange(e){e.addToHistory(),this._onDidChangeFilterText.fire(e.value)}adjustInputBox(){this.filterInputBox.inputElement.style.paddingRight=this.element.classList.contains("small")||this.filterBadge.classList.contains("hidden")?"25px":"150px"}handleKeyboardEvent(e){(e.equals(10)||e.equals(15)||e.equals(17)||e.equals(14)||e.equals(13))&&e.stopPropagation()}onInputKeyDown(e){let t=!1;e.equals(2)&&!this.toolbar.isEmpty()&&(this.toolbar.focus(),t=!0),e.equals(3)&&(this._onDidAcceptFilterText.fire(),t=!0),t&&(e.stopPropagation(),e.preventDefault())}};SG=I([m(1,F),m(2,qn),m(3,X),m(4,Le),m(5,B),m(6,Ai)],SG);var Ome=class extends k{constructor(e,t,o,n,r,s){super();this.menuId=e;this.contextMenuId=t;this.options=o;this.menuActionsOptions=n;this.contextKeyService=r;this.menuService=s;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.menu=this._register(s.createMenu(e,r,{emitEventsForSubmenuChanges:!0})),this._register(this.menu.onDidChange(()=>{this.actions=void 0,this._onDidChange.fire()}))}getActions(){return this.actions||(this.actions=xl(this.menu.getActions(this.options),e=>this.isPrimaryActionGroup(e),void 0,!0)),this.actions}isPrimaryActionGroup(e){return e==="navigation"?!0:this.menuActionsOptions?.primaryActionGroups?this.menuActionsOptions.primaryActionGroups.includes(e):!1}getPrimaryActions(){return this.getActions().primary}getSecondaryActions(){return this.getActions().secondary}getContextMenuActions(){if(this.contextMenuId){let e=this.menuService.getMenuActions(this.contextMenuId,this.contextKeyService,this.options);return xl(e).secondary}return[]}};Ome=I([m(4,X),m(5,Yt)],Ome);var rLe=class extends Ome{constructor(i,e,t,o,n,r){let s=n.createScoped(i);s.createKey("viewContainer",e.id);let l=s.createKey("viewContainerLocation",wC(o.getViewContainerLocation(e)));super(R.ViewContainerTitle,R.ViewContainerTitleContext,{shouldForwardArgs:!0,renderShortTitle:!0},t,s,r),this._register(s),this._register(U.filter(o.onDidChangeContainerLocation,c=>c.viewContainer===e)(()=>l.set(wC(o.getViewContainerLocation(e)))))}};rLe=I([m(3,ji),m(4,X),m(5,Yt)],rLe);var NFt=new it("viewpane.action.filter"),YJo=Oe("view-pane-container-expanded",L.chevronDown,d(5165,null)),XJo=Oe("view-pane-container-collapsed",L.chevronRight,d(5164,null)),Cpo=oe.as(Kn.ViewsRegistry),_Ze=class{constructor(i,e,t,o,n,r){this.container=i;this.delegate=e;this.instantiationService=t;this.openerService=o;this.contextKeyService=n;this.items=[];this._enabled=!1;this._wide=!1;this.disposables=new O;this.enabledDisposables=this.disposables.add(new O);this.renderDisposables=this.disposables.add(new O);this.disposables.add(U.runAndSubscribe(this.delegate.onDidChangeViewWelcomeState,()=>this.onDidChangeViewWelcomeState())),this.disposables.add(r.onWillShutdown(()=>this.dispose()))}get enabled(){return this._enabled}layout(i,e){this._enabled&&(this.element.style.height=`${i}px`,this.element.style.width=`${e}px`,this._wide=e>640,this.element.classList.toggle("wide",this._wide),this.scrollableElement.scanDomNode())}focus(){this._enabled&&this.element.focus()}onDidChangeViewWelcomeState(){let i=this.delegate.shouldShowWelcome();if(this._enabled===i)return;if(this._enabled=i,!i){this.enabledDisposables.clear();return}this.container.classList.add("welcome");let e=D(this.container,_(".welcome-view"));this.element=_(".welcome-view-content",{tabIndex:0,role:"region","aria-label":d(5167,null)}),this._wide&&this.element.classList.add("wide"),this.scrollableElement=new Ar(this.element,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3}),D(e,this.scrollableElement.getDomNode()),this.enabledDisposables.add(ee(()=>{this.container.classList.remove("welcome"),this.scrollableElement.dispose(),e.remove(),this.scrollableElement=void 0,this.element=void 0})),this.contextKeyService.onDidChangeContext(this.onDidChangeContext,this,this.enabledDisposables),U.chain(Cpo.onDidChangeViewWelcomeContent,t=>t.filter(o=>o===this.delegate.id))(this.onDidChangeViewWelcomeContent,this,this.enabledDisposables),this.onDidChangeViewWelcomeContent()}onDidChangeViewWelcomeContent(){let i=Cpo.getViewWelcomeContent(this.delegate.id);this.items=[];for(let e of i)if(e.when==="default")this.defaultItem={descriptor:e,visible:!0};else{let t=e.when?this.contextKeyService.contextMatchesRules(e.when):!0;this.items.push({descriptor:e,visible:t})}this.render()}onDidChangeContext(){let i=!1;for(let e of this.items){if(!e.descriptor.when||e.descriptor.when==="default")continue;let t=this.contextKeyService.contextMatchesRules(e.descriptor.when);e.visible!==t&&(e.visible=t,i=!0)}i&&this.render()}render(){this.renderDisposables.clear(),this.element.textContent="";let i=this.getContentDescriptors();if(i.length===0){this.container.classList.remove("welcome"),this.scrollableElement.scanDomNode();return}let e=0;for(let{content:t,precondition:o,renderSecondaryButtons:n}of i){let r=t.split(`
`);for(let s of r){if(s=s.trim(),!s)continue;let l=ZS(s);if(l.nodes.length===1&&typeof l.nodes[0]!="string"){let c=l.nodes[0],u=D(this.element,_(".button-container")),p=new Pi(u,{title:c.title,supportIcons:!0,secondary:!!(n&&e>0),...Ro});if(p.label=c.label,p.onDidClick(h=>{this.openerService.open(c.href,{allowCommands:!0})},null,this.renderDisposables),this.renderDisposables.add(p),e++,o){let h=()=>p.enabled=this.contextKeyService.contextMatchesRules(o);h();let g=new Set(o.keys());U.filter(this.contextKeyService.onDidChangeContext,v=>v.affectsSome(g))(h,null,this.renderDisposables)}}else{let c=D(this.element,_("p"));for(let u of l.nodes)if(typeof u=="string")D(c,...ir(u));else{let p=this.renderDisposables.add(this.instantiationService.createInstance(Bg,c,u,{}));if(o&&u.href.startsWith("command:")){let h=()=>p.enabled=this.contextKeyService.contextMatchesRules(o);h();let g=new Set(o.keys());U.filter(this.contextKeyService.onDidChangeContext,v=>v.affectsSome(g))(h,null,this.renderDisposables)}}}}}this.container.classList.add("welcome"),this.scrollableElement.scanDomNode()}getContentDescriptors(){let i=this.items.filter(e=>e.visible);return i.length===0&&this.defaultItem?[this.defaultItem.descriptor]:i.map(e=>e.descriptor)}dispose(){this.disposables.dispose()}};_Ze=I([m(2,F),m(3,Je),m(4,X),m(5,to)],_Ze);var na=class extends DFt{constructor(e,t,o,n,r,s,l,c,u,p,h){super({...e,orientation:s.getViewLocationById(e.id)===1?1:0});this.keybindingService=t;this.contextMenuService=o;this.configurationService=n;this.contextKeyService=r;this.viewDescriptorService=s;this.instantiationService=l;this.openerService=c;this.themeService=u;this.hoverService=p;this.accessibleViewInformationService=h;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new T);this.onDidBlur=this._onDidBlur.event;this._onDidChangeBodyVisibility=this._register(new T);this.onDidChangeBodyVisibility=this._onDidChangeBodyVisibility.event;this._onDidChangeTitleArea=this._register(new T);this.onDidChangeTitleArea=this._onDidChangeTitleArea.event;this._onDidChangeViewWelcomeState=this._register(new T);this.onDidChangeViewWelcomeState=this._onDidChangeViewWelcomeState.event;this._isVisible=!1;this.headerActionViewItems=this._register(new Ot);this.id=e.id,this._title=e.title,this._titleDescription=e.titleDescription,this._singleViewPaneContainerTitle=e.singleViewPaneContainerTitle,this.showActions=e.showActions??0,this.scopedContextKeyService=this._register(r.createScoped(this.element)),this.scopedContextKeyService.createKey("view",this.id);let g=this.scopedContextKeyService.createKey("viewLocation",wC(s.getViewLocationById(this.id)));this._register(U.filter(s.onDidChangeLocation,v=>v.views.some(b=>b.id===this.id))(()=>g.set(wC(s.getViewLocationById(this.id)))));let f=this._register(this.instantiationService.createChild(new Po([X,this.scopedContextKeyService])));this.menuActions=this._register(f.createInstance(Ome,e.titleMenuId??R.ViewTitle,R.ViewTitleContext,{shouldForwardArgs:!e.donotForwardArgs,renderShortTitle:!0},{primaryActionGroups:this.primaryActionGroups})),this._register(this.menuActions.onDidChange(()=>this.updateActions()))}static{this.AlwaysShowActionsConfig="workbench.view.alwaysShowHeaderActions"}get title(){return this._title}get titleDescription(){return this._titleDescription}get singleViewPaneContainerTitle(){return this._singleViewPaneContainerTitle}get primaryActionGroups(){}get headerVisible(){return super.headerVisible}set headerVisible(e){super.headerVisible=e,this.element.classList.toggle("merged-header",!e)}setVisible(e){this._isVisible!==e&&(this._isVisible=e,this.isExpanded()&&this._onDidChangeBodyVisibility.fire(e))}isVisible(){return this._isVisible}isBodyVisible(){return this._isVisible&&this.isExpanded()}setExpanded(e){let t=super.setExpanded(e);return t&&this._onDidChangeBodyVisibility.fire(e),this.updateTwistyIcon(),t}render(){super.render();let e=nr(this.element);this._register(e),this._register(e.onDidFocus(()=>this._onDidFocus.fire())),this._register(e.onDidBlur(()=>this._onDidBlur.fire()))}renderHeader(e){this.headerContainer=e,this.twistiesContainer=D(e,_(`.twisty-container${q.asCSSSelector(this.getTwistyIcon(this.isExpanded()))}`)),this.renderHeaderTitle(e,this.title);let t=D(e,_(".actions"));t.classList.toggle("show-always",this.showActions===2),t.classList.toggle("show-expanded",this.showActions===1),this.toolbar=this.instantiationService.createInstance(dl,t,{orientation:0,actionViewItemProvider:(r,s)=>{let l=this.createActionViewItem(r,s);return l&&this.headerActionViewItems.set(l.action.id,l),l},ariaLabel:d(5166,null,this.title),getKeyBinding:r=>this.keybindingService.lookupKeybinding(r.id),renderDropdownAsChildElement:!0,actionRunner:this.getActionRunner(),resetMenu:this.menuActions.menuId}),this._register(this.toolbar),this.setActions(),this._register($(t,ne.CLICK,r=>r.preventDefault()));let o=this.viewDescriptorService.getViewContainerByViewId(this.id);o?this._register(this.viewDescriptorService.getViewContainerModel(o).onDidChangeContainerInfo(({title:r})=>this.updateTitle(this.title))):console.error(`View container model not found for view ${this.id}`);let n=U.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration(na.AlwaysShowActionsConfig));this._register(n(this.updateActionsVisibility,this)),this.updateActionsVisibility()}updateHeader(){super.updateHeader(),this.updateTwistyIcon()}updateTwistyIcon(){this.twistiesContainer&&(this.twistiesContainer.classList.remove(...q.asClassNameArray(this.getTwistyIcon(!this._expanded))),this.twistiesContainer.classList.add(...q.asClassNameArray(this.getTwistyIcon(this._expanded))))}getTwistyIcon(e){return e?YJo:XJo}style(e){super.style(e);let t=this.getIcon();if(this.iconContainer){let o=_D(e.headerForeground,Tt(xo));A.isUri(t)?(this.iconContainer.style.backgroundColor=o,this.iconContainer.style.color=""):(this.iconContainer.style.color=o,this.iconContainer.style.backgroundColor="")}}getIcon(){return this.viewDescriptorService.getViewDescriptorById(this.id)?.containerIcon||GDe}renderHeaderTitle(e,t){this.iconContainer=D(e,_(".icon",void 0));let o=this.getIcon(),n;if(A.isUri(o)){n=`view-${this.id.replace(/[\.\:]/g,"-")}`;let s=`.pane-header .icon.${n}`;Eg(s,`
				mask: ${cl(o)} no-repeat 50% 50%;
				mask-size: 24px;
				-webkit-mask: ${cl(o)} no-repeat 50% 50%;
				-webkit-mask-size: 16px;
			`)}else q.isThemeIcon(o)&&(n=q.asClassName(o));n&&this.iconContainer.classList.add(...n.split(" "));let r=this.calculateTitle(t);this.titleContainer=D(e,_("h3.title",{},r)),this.titleContainerHover=this._register(this.hoverService.setupManagedHover(yi("mouse"),this.titleContainer,r)),this._titleDescription&&this.setTitleDescription(this._titleDescription),this.iconContainerHover=this._register(this.hoverService.setupManagedHover(yi("mouse"),this.iconContainer,r)),this.iconContainer.setAttribute("aria-label",this._getAriaLabel(r,this._titleDescription))}_getAriaLabel(e,t){let o=this.viewDescriptorService.getViewDescriptorById(this.id)?.accessibilityHelpContent,n=this.accessibleViewInformationService?.hasShownAccessibleView(this.id);return!o||n?t?`${e} - ${t}`:e:d(5163,null,e)}updateTitle(e){let t=this.calculateTitle(e);this.titleContainer&&(this.titleContainer.textContent=t,this.titleContainerHover?.update(t)),this.updateAriaHeaderLabel(t,this._titleDescription),this._title=e,this._onDidChangeTitleArea.fire()}updateAriaHeaderLabel(e,t){let o=this._getAriaLabel(e,t);this.iconContainer&&(this.iconContainerHover?.update(e),this.iconContainer.setAttribute("aria-label",o)),this.ariaHeaderLabel=this.getAriaHeaderLabel(o)}setTitleDescription(e){this.titleDescriptionContainer?(this.titleDescriptionContainer.textContent=e??"",this.titleDescriptionContainerHover?.update(e??"")):e&&this.titleContainer&&(this.titleDescriptionContainer=Bbt(this.titleContainer,_("span.description",{},e)),this.titleDescriptionContainerHover=this._register(this.hoverService.setupManagedHover(yi("mouse"),this.titleDescriptionContainer,e)))}updateTitleDescription(e){this.setTitleDescription(e),this.updateAriaHeaderLabel(this._title,e),this._titleDescription=e,this._onDidChangeTitleArea.fire()}calculateTitle(e){let t=this.viewDescriptorService.getViewContainerByViewId(this.id),o=this.viewDescriptorService.getViewContainerModel(t),n=this.viewDescriptorService.getViewDescriptorById(this.id);return!(this.viewDescriptorService.getDefaultContainerById(this.id)===t)&&n?.containerTitle&&o.title!==n.containerTitle&&e!==n.containerTitle?`${n.containerTitle}: ${e}`:e}renderBody(e){this.viewWelcomeController=this._register(this.instantiationService.createInstance(_Ze,e,this))}layoutBody(e,t){this.viewWelcomeController?.layout(e,t)}onDidScrollRoot(){}getProgressIndicator(){if(this.progressBar===void 0&&(this.progressBar=this._register(new Cv(this.element,oC)),this.progressBar.hide()),this.progressIndicator===void 0){let e=this;this.progressIndicator=this._register(new oLe(Ti(this.progressBar),this._register(new class extends nLe{constructor(){super(e.id,e.isBodyVisible()),this._register(e.onDidChangeBodyVisibility(t=>t?this.onScopeOpened(e.id):this.onScopeClosed(e.id)))}})))}return this.progressIndicator}getProgressLocation(){return this.viewDescriptorService.getViewContainerByViewId(this.id).id}getLocationBasedColors(){return IG(this.viewDescriptorService.getViewLocationById(this.id))}focus(){this.viewWelcomeController?.enabled?this.viewWelcomeController.focus():this.element&&this.element.focus(),(Na(this.element)||Is(this.element))&&this._onDidFocus.fire()}setActions(){if(this.toolbar){let e=[...this.menuActions.getPrimaryActions()];this.shouldShowFilterInHeader()&&e.unshift(NFt),this.toolbar.setActions(Kk(e),Kk(this.menuActions.getSecondaryActions())),this.toolbar.context=this.getActionsContext()}}updateActionsVisibility(){if(!this.headerContainer)return;let e=this.configurationService.getValue("workbench.view.alwaysShowHeaderActions");this.headerContainer.classList.toggle("actions-always-visible",e)}updateActions(){this.setActions(),this._onDidChangeTitleArea.fire()}createActionViewItem(e,t){if(e.id===NFt.id){let o=this;return new class extends Ja{constructor(){super(null,e)}setFocusable(){}get trapsArrowNavigation(){return!0}render(n){n.classList.add("viewpane-filter-container");let r=o.getFilterWidget();D(n,r.element),r.relayout()}}}return ta(this.instantiationService,e,{...t,menuAsChild:e instanceof id})}getActionsContext(){}getActionRunner(){}getOptimalWidth(){return 0}saveState(){}shouldShowWelcome(){return!1}getFilterWidget(){}shouldShowFilterInHeader(){return!1}};na=I([m(1,Le),m(2,Xe),m(3,B),m(4,X),m(5,ji),m(6,F),m(7,Je),m(8,Pe),m(9,ot)],na);var lW=class extends na{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,e,t,o,n,r,s,l,c,u,p);let h=this._register(s.createChild(new Po([X,this.scopedContextKeyService])));this.filterWidget=this._register(h.createInstance(SG,i.filterOptions)),this._register(this.filterWidget.onDidAcceptFilterText(()=>this.focusBodyContent()))}getFilterWidget(){return this.filterWidget}renderBody(i){super.renderBody(i),this.filterContainer=D(i,_(".viewpane-filter-container"))}layoutBody(i,e){super.layoutBody(i,e),this.dimension=new di(e,i);let t=!this.filterContainer?.hasChildNodes(),o=this.shouldShowFilterInHeader();t!==o&&(o&&Ii(this.filterContainer),this.updateActions(),o||D(this.filterContainer,this.filterWidget.element)),o||(i=i-44),this.filterWidget.layout(e),this.layoutBodyContent(i,e)}shouldShowFilterInHeader(){return!(this.dimension&&this.dimension.width<600&&this.dimension.height>100)}focusBodyContent(){this.focus()}};lW=I([m(1,Le),m(2,Xe),m(3,B),m(4,X),m(5,ji),m(6,F),m(7,Je),m(8,Pe),m(9,ot)],lW);function IG(a){let i,e,t,o,n;switch(a){case 1:i=GI,e=nYe,t=tso,o=iso,n=oso;break;case 0:case 2:default:i=ch,e=p3,t=dso,o=uso,n=pso}return{background:i,overlayBackground:e,listOverrideStyles:{listBackground:i,treeStickyScrollBackground:t,treeStickyScrollBorder:o,treeStickyScrollShadow:n}}}var rr=class extends z{constructor(i){super(i),this.desc=i}run(i,...e){let t=i.get(Gt).getActiveViewWithId(this.desc.viewId);if(t)return this.runInView(i,t,...e)}};var DZe=new Y("commentsFilterFocus",!1);var xpo=new Y("commentsView.showResolvedFilter",!0),kpo=new Y("commentsView.showUnResolvedFilter",!0),dCi=new Y("commentsView.sortBy","resourceAscending"),OFt=class extends k{constructor(e,t){super();this.contextKeyService=t;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._showUnresolved=kpo.bindTo(this.contextKeyService),this._showResolved=xpo.bindTo(this.contextKeyService),this._sortBy=dCi.bindTo(this.contextKeyService),this._showResolved.set(e.showResolved),this._showUnresolved.set(e.showUnresolved),this._sortBy.set(e.sortBy)}get showUnresolved(){return!!this._showUnresolved.get()}set showUnresolved(e){this._showUnresolved.get()!==e&&(this._showUnresolved.set(e),this._onDidChange.fire({showUnresolved:!0}))}get showResolved(){return!!this._showResolved.get()}set showResolved(e){this._showResolved.get()!==e&&(this._showResolved.set(e),this._onDidChange.fire({showResolved:!0}))}get sortBy(){return this._sortBy.get()??"resourceAscending"}set sortBy(e){this._sortBy.get()!==e&&(this._sortBy.set(e),this._onDidChange.fire({sortBy:e}))}};W(class extends rr{constructor(){super({id:"commentsFocusViewFromFilter",title:d(10333,null),keybinding:{when:DZe,weight:200,primary:2066},viewId:gp})}async runInView(a,i){i.focus()}});W(class extends rr{constructor(){super({id:"commentsClearFilterText",title:d(10331,null),keybinding:{when:DZe,weight:200,primary:9},viewId:gp})}async runInView(a,i){i.clearFilterText()}});W(class extends rr{constructor(){super({id:"commentsFocusFilter",title:d(10332,null),keybinding:{when:rc.isEqualTo(gp),weight:200,primary:2084},viewId:gp})}async runInView(a,i){i.focusFilter()}});W(class extends rr{constructor(){super({id:`workbench.actions.${gp}.toggleUnResolvedComments`,title:d(10340,null),category:d(10330,null),toggled:{condition:kpo,title:d(10341,null)},menu:{id:qx,group:"1_filter",when:C.equals("view",gp),order:1},viewId:gp})}async runInView(a,i){i.filters.showUnresolved=!i.filters.showUnresolved}});W(class extends rr{constructor(){super({id:`workbench.actions.${gp}.toggleResolvedComments`,title:d(10337,null),category:d(10330,null),toggled:{condition:xpo,title:d(10334,null)},menu:{id:qx,group:"1_filter",when:C.equals("view",gp),order:1},viewId:gp})}async runInView(a,i){i.filters.showResolved=!i.filters.showResolved}});var uCi=new R("submenu.filter.commentSort");be.appendMenuItem(qx,{submenu:uCi,title:d(10329,null),group:"2_sort",icon:L.history,when:C.equals("view",gp)});W(class extends rr{constructor(){super({id:`workbench.actions.${gp}.toggleSortByUpdatedAt`,title:d(10339,null),category:d(10330,null),icon:L.history,viewId:gp,toggled:{condition:C.equals(dCi.key,"updatedAtDescending"),title:d(10336,null)},menu:{id:uCi,group:"navigation",order:1,isHiddenByDefault:!1}})}async runInView(a,i){i.filters.sortBy="updatedAtDescending"}});W(class extends rr{constructor(){super({id:`workbench.actions.${gp}.toggleSortByResource`,title:d(10338,null),category:d(10330,null),icon:L.history,viewId:gp,toggled:{condition:C.equals(dCi.key,"resourceAscending"),title:d(10335,null)},menu:{id:uCi,group:"navigation",order:0,isHiddenByDefault:!1}})}async runInView(a,i){i.filters.sortBy="resourceAscending"}});var JJo=te("editorGutter.commentRangeForeground",{dark:w5(bv,Bo),light:Eu(w5(bv,Bo),.05),hcDark:Ue.white,hcLight:Ue.black},d(10239,null)),Epo=te("editorOverviewRuler.commentForeground",JJo,d(10242,null)),Tpo=te("editorOverviewRuler.commentUnresolvedForeground",Epo,d(10243,null)),ZJo=te("editorOverviewRuler.commentDraftForeground",Tpo,d(10241,null)),_po=te("editorGutter.commentGlyphForeground",{dark:Vd,light:Vd,hcDark:Ue.black,hcLight:Ue.white},d(10238,null));te("editorGutter.commentUnresolvedGlyphForeground",_po,d(10240,null));te("editorGutter.commentDraftGlyphForeground",_po,d(10237,null));var Fme=class a extends k{constructor(e,t){super();this._threadHasDraft=!1;this._onDidChangeLineNumber=this._register(new T);this.onDidChangeLineNumber=this._onDidChangeLineNumber.event;this._commentsOptions=this.createDecorationOptions(),this._editor=e,this._commentsDecorations=this._editor.createDecorationsCollection(),this._register(this._commentsDecorations.onDidChange(o=>{let n=this._commentsDecorations.length>0?this._commentsDecorations.getRange(0):null;n&&n.endLineNumber!==this._lineNumber&&(this._lineNumber=n.endLineNumber,this._onDidChangeLineNumber.fire(this._lineNumber))})),this._register(ee(()=>this._commentsDecorations.clear())),this.setLineNumber(t)}static{this.description="comment-glyph-widget"}createDecorationOptions(){let e;this._threadHasDraft?e="comment-range-glyph comment-thread-draft":e=`comment-range-glyph comment-thread${this._threadState===0?"-unresolved":""}`;let t={description:a.description,isWholeLine:!0,overviewRuler:{color:_s(this._threadHasDraft?ZJo:this._threadState===0?Tpo:Epo),position:2},collapseOnReplaceEdit:!0,linesDecorationsClassName:e};return So.createDynamic(t)}setThreadState(e,t=!1){(this._threadState!==e||this._threadHasDraft!==t)&&(this._threadState=e,this._threadHasDraft=t,this._commentsOptions=this.createDecorationOptions(),this._updateDecorations())}_updateDecorations(){let e=[{range:{startLineNumber:this._lineNumber,startColumn:1,endLineNumber:this._lineNumber,endColumn:1},options:this._commentsOptions}];this._commentsDecorations.set(e)}setLineNumber(e){this._lineNumber=e,this._updateDecorations()}getPosition(){let e=this._commentsDecorations.length>0?this._commentsDecorations.getRange(0):null;return{position:{lineNumber:e?e.endLineNumber:this._lineNumber,column:1},preference:[0]}}};var yG=class{constructor(i,e,t,o,n,r,s){this.keybindingService=i;this.contextKeyService=e;this.contextMenuService=t;this.container=o;this.actionHandler=n;this.maxActions=r;this.supportDropdowns=s;this._buttonElements=[];this._toDispose=new O;this._actions=[]}setActions(i,e=!1){this._toDispose.clear(),this._buttonElements.forEach(n=>n.remove()),this._buttonElements=[];let t=i.getActions({shouldForwardArgs:!0}),o=!e;for(let n of t){let[,r]=n;this._actions=r;for(let s of r){let l=this.supportDropdowns&&s instanceof id?s.actions:[],c=l.length?l[0]:s,u=this.keybindingService.lookupKeybinding(c.id,this.contextKeyService)?.getLabel();!u&&o&&(u=this.keybindingService.lookupKeybinding("editor.action.submitComment",this.contextKeyService)?.getLabel());let p=u?`${c.label} (${u})`:c.label,h=this.actionHandler,g=l.length?new Jv(this.container,{contextMenuProvider:this.contextMenuService,actions:l,actionRunner:this._toDispose.add(new class extends cs{async runAction(f,v){return h(f)}}),secondary:!o,title:p,addPrimaryActionToDropdown:!1,small:!0,...Ro}):new Pi(this.container,{secondary:!o,title:p,small:!0,...Ro});if(o=!1,this._buttonElements.push(g.element),this._toDispose.add(g),this._toDispose.add(g.onDidClick(()=>this.actionHandler(c))),g.enabled=c.enabled,g.label=c.label,this.maxActions!==void 0&&this._buttonElements.length>=this.maxActions){console.warn("An extension has contributed more than the allowable number of actions to a comments menu.");return}}}}triggerDefaultAction(){if(this._actions.length){let i=this._actions[0];if(i.enabled)return this.actionHandler(i)}}dispose(){this._toDispose.dispose()}};var dw=class extends k{static{this.ID="editor.contrib.menuPreventer"}constructor(i){super(),this._editor=i,this._altListeningMouse=!1,this._altMouseTriggered=!1,this._register(this._editor.onMouseDown(e=>{this._altListeningMouse&&(this._altMouseTriggered=!0)})),this._register(this._editor.onKeyDown(e=>{e.equals(512)&&(this._altListeningMouse||(this._altMouseTriggered=!1),this._altListeningMouse=!0)})),this._register(this._editor.onKeyUp(e=>{e.equals(512)&&(this._altMouseTriggered&&e.preventDefault(),this._altListeningMouse=!1,this._altMouseTriggered=!1)}))}};Eo(dw.ID,dw,2);var Dpo=new Y("editorDictation.inProgress",!1),Rpo=P(9961,"Voice"),mCi=class extends yl{constructor(){super({id:"workbench.action.editorDictation.start",title:P(9957,"Start Dictation in Editor"),category:Rpo,precondition:C.and(YH,Aee.toNegated(),me.readOnly.toNegated()),f1:!0,keybinding:{primary:2612,weight:200,secondary:ii?[603]:void 0}})}runEditorCommand(i,e){let o=i.get(Le).enableKeybindingHoldMode(this.desc.id);if(o){let n=!1,r=setTimeout(()=>{n=!0},500);o.finally(()=>{clearTimeout(r),n&&$x.get(e)?.stop()})}$x.get(e)?.start()}},RZe=class a extends yl{static{this.ID="workbench.action.editorDictation.stop"}constructor(){super({id:a.ID,title:P(9958,"Stop Dictation in Editor"),category:Rpo,precondition:Dpo,f1:!0,keybinding:{primary:9,weight:300}})}runEditorCommand(i,e){$x.get(e)?.stop()}},hCi=class extends k{constructor(e,t){super();this.editor=e;this.suppressMouseDown=!0;this.allowEditorOverflow=!0;this.domNode=document.createElement("div");let o=this._register(new oo(this.domNode)),n=t.lookupKeybinding(RZe.ID)?.getLabel();o.push(li({id:RZe.ID,label:n?d(9959,null,n):d(9960,null),class:q.asClassName(L.micFilled),run:()=>$x.get(e)?.stop()}),{icon:!0,label:!1,keybinding:n}),this.domNode.classList.add("editor-dictation-widget"),this.domNode.appendChild(o.domNode)}getId(){return"editorDictation"}getDomNode(){return this.domNode}getPosition(){if(!this.editor.hasModel())return null;let e=this.editor.getSelection();return{position:e.getPosition(),preference:[e.getPosition().equals(e.getStartPosition())?1:2,0]}}beforeRender(){let e=this.editor.getPosition(),t=e?this.editor.getLineHeightForPosition(e):this.editor.getOption(75),o=this.editor.getLayoutInfo().contentWidth*.7;return this.domNode.style.setProperty("--vscode-editor-dictation-widget-height",`${t}px`),this.domNode.style.setProperty("--vscode-editor-dictation-widget-width",`${o}px`),null}show(){this.editor.addContentWidget(this)}layout(){this.editor.layoutContentWidget(this)}active(){this.domNode.classList.add("recording")}hide(){this.domNode.classList.remove("recording"),this.editor.removeContentWidget(this)}},$x=class extends k{constructor(e,t,o,n){super();this.editor=e;this.speechService=t;this.sessionDisposables=this._register(new ue);this.widget=this._register(new hCi(this.editor,n)),this.editorDictationInProgress=Dpo.bindTo(o)}static{this.ID="editorDictation"}static get(e){return e.getContribution($x.ID)}async start(){let e=new O;this.sessionDisposables.value=e,this.widget.show(),e.add(ee(()=>this.widget.hide())),this.editorDictationInProgress.set(!0),e.add(ee(()=>this.editorDictationInProgress.reset()));let t=this.editor.createDecorationsCollection();e.add(ee(()=>t.clear())),e.add(this.editor.onDidChangeCursorPosition(()=>this.widget.layout()));let o,n=0,r=(c,u)=>{o||(o=Ti(this.editor.getPosition()));let p=new ye(o.lineNumber,o.column+c.length);this.editor.executeEdits($x.ID,[Qn.replace(G.fromPositions(o,o.with(void 0,o.column+n)),c)],[ei.fromPositions(p)]),u?t.set([{range:G.fromPositions(o,o.with(void 0,o.column+c.length)),options:{description:"editor-dictation-preview",inlineClassName:"ghost-text-decoration-preview"}}]):t.clear(),n=c.length,u||(o=void 0,n=0),this.editor.revealPositionInCenterIfOutsideViewport(p)},s=new qe;e.add(ee(()=>s.dispose(!0)));let l=await this.speechService.createSpeechToTextSession(s.token,"editor");e.add(l.onDidChange(c=>{if(!s.token.isCancellationRequested)switch(c.status){case 1:this.widget.active();break;case 4:e.dispose();break;case 2:{if(!c.text)return;r(c.text,!0);break}case 3:{if(!c.text)return;r(`${c.text} `,!1);break}}}))}stop(){this.sessionDisposables.clear()}};$x=I([m(1,Gx),m(2,X),m(3,Le)],$x);Eo($x.ID,$x,4);W(mCi);W(RZe);var uw=le("snippetService");var gCi=class{constructor(i){this.isBogous=!1,this.isTrivial=!1,this.usesClipboardVariable=!1,this.usesSelectionVariable=!1,this.codeSnippet=i;let e=new Og().parse(i,!1),t=new Map,o=0;for(let r of e.placeholders)o=Math.max(o,r.index);if(e.placeholders.length===0)this.isTrivial=!0;else if(o===0){let r=e.children.at(-1);this.isTrivial=r instanceof jk&&r.isFinalTabstop}let n=[...e.children];for(;n.length>0;){let r=n.shift();if(r instanceof HK){if(r.children.length===0&&!Kio[r.name]){let s=t.has(r.name)?t.get(r.name):++o;t.set(r.name,s);let l=new jk(s).appendChild(new VS(r.name));e.replace(r,[l]),this.isBogous=!0}switch(r.name){case"CLIPBOARD":this.usesClipboardVariable=!0;break;case"SELECTION":case"TM_SELECTED_TEXT":this.usesSelectionVariable=!0;break}}else n.push(...r.children)}this.isBogous&&(this.codeSnippet=e.toTextmateString())}},Wme=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.isFileTemplate=i;this.scopes=e;this.name=t;this.prefix=o;this.description=n;this.body=r;this.source=s;this.snippetSource=l;this.snippetIdentifier=c;this.include=u;this.exclude=p;this.extensionId=h;this.prefixLow=o.toLowerCase(),this._bodyInsights=new uF(zi(),()=>new gCi(this.body))}get codeSnippet(){return this._bodyInsights.value.codeSnippet}get isBogous(){return this._bodyInsights.value.isBogous}get isTrivial(){return this._bodyInsights.value.isTrivial}get needsClipboard(){return this._bodyInsights.value.usesClipboardVariable}get usesSelection(){return this._bodyInsights.value.usesSelectionVariable}isFileIncluded(i){let e=i.scheme===Q.file?i.fsPath:i.path,t=Jo(e),o=n=>n.includes("/")?e:t;if(this.exclude){for(let n of this.exclude.filter(Boolean))if(qd(n,o(n),{ignoreCase:!0}))return!1}if(this.include){for(let n of this.include.filter(Boolean))if(qd(n,o(n),{ignoreCase:!0}))return!0;return!1}return!0}};function eZo(a){return Di(a)&&!!a.body}var sLe=class{constructor(i,e,t,o,n,r){this.source=i;this.location=e;this.defaultScopes=t;this._extension=o;this._fileService=n;this._extensionResourceLoaderService=r;this.data=[];this.isGlobalSnippets=km(e.path)===".code-snippets",this.isUserSnippets=!this._extension}select(i,e){this.isGlobalSnippets||!this.isUserSnippets?this._scopeSelect(i,e):this._filepathSelect(i,e)}_filepathSelect(i,e){i+".json"===Jo(this.location.path)&&e.push(...this.data)}_scopeSelect(i,e){for(let o of this.data){let n=o.scopes.length;if(n===0)e.push(o);else for(let r=0;r<n;r++)if(o.scopes[r]===i){e.push(o);break}}let t=i.lastIndexOf(".");t>=0&&this._scopeSelect(i.substring(0,t),e)}async _load(){return this._extension?this._extensionResourceLoaderService.readExtensionResource(this.location):(await this._fileService.readFile(this.location)).value.toString()}load(){return this._loadPromise||(this._loadPromise=Promise.resolve(this._load()).then(i=>{let e=is(i);if(sE(e)==="object")for(let[t,o]of Object.entries(e))if(eZo(o))this._parseSnippet(t,o,this.data);else for(let[n,r]of Object.entries(o))this._parseSnippet(n,r,this.data);return this})),this._loadPromise}reset(){this._loadPromise=void 0,this.data.length=0}_parseSnippet(i,e,t){let{isFileTemplate:o,prefix:n,body:r,description:s}=e;if(n||(n=""),Array.isArray(r)&&(r=r.join(`
`)),typeof r!="string")return;Array.isArray(s)&&(s=s.join(`
`));let l;this.defaultScopes?l=this.defaultScopes:typeof e.scope=="string"?l=e.scope.split(",").map(h=>h.trim()).filter(Boolean):l=[];let c;e.include&&(Array.isArray(e.include)?c=e.include:typeof e.include=="string"&&(c=[e.include]));let u;e.exclude&&(Array.isArray(e.exclude)?u=e.exclude:typeof e.exclude=="string"&&(u=[e.exclude]));let p;this._extension?p=this._extension.displayName||this._extension.name:this.source===2?p=d(15421,null):this.isGlobalSnippets?p=d(15420,null):p=d(15419,null);for(let h of yt.wrap(n))t.push(new Wme(!!o,l,i,h,s,r,p,this.source,this._extension?`${lu(this._extension.extensionLocation,this.location)}/${i}`:`${Jo(this.location.path)}/${i}`,c,u,this._extension?.identifier))}};var Kee=[],fCi=[],vCi=[];function LZe(a,i=!1){Ppo(a,!1,i)}function Mpo(a){Ppo(a,!0,!1)}function Ppo(a,i,e){let t=tZo(a,i);Kee.push(t),t.userConfigured?vCi.push(t):fCi.push(t),e&&!t.userConfigured&&Kee.forEach(o=>{o.mime===t.mime||o.userConfigured||(t.extension&&o.extension===t.extension&&console.warn(`Overwriting extension <<${t.extension}>> to now point to mime <<${t.mime}>>`),t.filename&&o.filename===t.filename&&console.warn(`Overwriting filename <<${t.filename}>> to now point to mime <<${t.mime}>>`),t.filepattern&&o.filepattern===t.filepattern&&console.warn(`Overwriting filepattern <<${t.filepattern}>> to now point to mime <<${t.mime}>>`),t.firstline&&o.firstline===t.firstline&&console.warn(`Overwriting firstline <<${t.firstline}>> to now point to mime <<${t.mime}>>`))})}function tZo(a,i){return{id:a.id,mime:a.mime,filename:a.filename,extension:a.extension,filepattern:a.filepattern,firstline:a.firstline,userConfigured:i,filepatternParsed:a.filepattern?Eh(a.filepattern,{ignoreCase:!0}):void 0,filepatternOnPath:a.filepattern?a.filepattern.indexOf(Vo.sep)>=0:!1}}function Apo(){Kee=Kee.filter(a=>a.userConfigured),fCi=[]}function Npo(){Kee=Kee.filter(a=>!a.userConfigured),vCi=[]}function aLe(a,i){return Fpo(a,i).map(e=>e.mime)}function Opo(a,i){return Fpo(a,i).map(e=>e.id)}function Fpo(a,i){let e;if(a)switch(a.scheme){case Q.file:e=a.fsPath;break;case Q.data:{e=e5.parseMetaData(a).get(e5.META_DATA_LABEL);break}case Q.vscodeNotebookCell:e=void 0;break;default:e=a.path}if(!e)return[{id:"unknown",mime:cr.unknown}];e=e.toLowerCase();let t=Jo(e),o=Lpo(e,t,vCi);if(o)return[o,{id:es,mime:cr.text}];let n=Lpo(e,t,fCi);if(n)return[n,{id:es,mime:cr.text}];if(i){let r=iZo(i);if(r)return[r,{id:es,mime:cr.text}]}return[{id:"unknown",mime:cr.unknown}]}function Lpo(a,i,e){let t,o,n;for(let r=e.length-1;r>=0;r--){let s=e[r];if(G3i(i,s.filename,!0)){t=s;break}if(s.filepattern&&(!o||s.filepattern.length>o.filepattern.length)){let l=s.filepatternOnPath?a:i;s.filepatternParsed?.(l)&&(o=s)}s.extension&&(!n||s.extension.length>n.extension.length)&&Jvt(i,s.extension)&&(n=s)}if(t)return t;if(o)return o;if(n)return n}function iZo(a){if(obt(a)&&(a=a.substring(1)),a.length>0)for(let i=Kee.length-1;i>=0;i--){let e=Kee[i];if(!e.firstline)continue;let t=a.match(e.firstline);if(t&&t.length>0)return e}}var tU=Object.prototype.hasOwnProperty,Wpo="vs.editor.nullLanguage",bCi=class{constructor(){this._languageIdToLanguage=[];this._languageToLanguageId=new Map;this._register(Wpo,0),this._register(es,1),this._nextLanguageId=2}_register(i,e){this._languageIdToLanguage[e]=i,this._languageToLanguageId.set(i,e)}register(i){if(this._languageToLanguageId.has(i))return;let e=this._nextLanguageId++;this._register(i,e)}encodeLanguageId(i){return this._languageToLanguageId.get(i)||0}decodeLanguageId(i){return this._languageIdToLanguage[i]||Wpo}},WFt=class a extends k{constructor(e=!0,t=!1){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;a.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new bCi,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(CA.onDidChangeLanguages(o=>{this._initializeFromRegistry()})))}static{this.instanceCount=0}dispose(){a.instanceCount--,super.dispose()}setDynamicLanguages(e){this._dynamicLanguages=e,this._initializeFromRegistry()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Apo();let e=[].concat(CA.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}registerLanguage(e){return CA.registerLanguage(e)}_registerLanguages(e){for(let t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{let o=this._languages[t];o.name&&(this._nameMap[o.name]=o.identifier),o.aliases.forEach(n=>{this._lowercaseNameMap[n.toLowerCase()]=o.identifier}),o.mimetypes.forEach(n=>{this._mimeTypesMap[n]=o.identifier})}),oe.as($t.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){let t=e.id,o;tU.call(this._languages,t)?o=this._languages[t]:(this.languageIdCodec.register(t),o={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=o),this._mergeLanguage(o,e)}_mergeLanguage(e,t){let o=t.id,n=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),n=t.mimetypes[0]),n||(n=`text/x-${o}`,e.mimetypes.push(n)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(let l of t.extensions)LZe({id:o,mime:n,extension:l},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(let l of t.filenames)LZe({id:o,mime:n,filename:l},this._warnOnOverwrite),e.filenames.push(l);if(Array.isArray(t.filenamePatterns))for(let l of t.filenamePatterns)LZe({id:o,mime:n,filepattern:l},this._warnOnOverwrite);if(typeof t.firstLine=="string"&&t.firstLine.length>0){let l=t.firstLine;l.charAt(0)!=="^"&&(l="^"+l);try{let c=new RegExp(l);lwe(c)||LZe({id:o,mime:n,firstline:c},this._warnOnOverwrite)}catch(c){console.warn(`[${t.id}]: Invalid regular expression \`${l}\`: `,c)}}e.aliases.push(o);let r=null;if(typeof t.aliases<"u"&&Array.isArray(t.aliases)&&(t.aliases.length===0?r=[null]:r=t.aliases),r!==null)for(let l of r)!l||l.length===0||e.aliases.push(l);let s=r!==null&&r.length>0;if(!(s&&r[0]===null)){let l=(s?r[0]:null)||o;(s||!e.name)&&(e.name=l)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return e?tU.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getSortedRegisteredLanguageNames(){let e=[];for(let t in this._nameMap)tU.call(this._nameMap,t)&&e.push({languageName:t,languageId:this._nameMap[t]});return e.sort((t,o)=>MS(t.languageName,o.languageName)),e}getLanguageName(e){return tU.call(this._languages,e)?this._languages[e].name:null}getMimeType(e){return tU.call(this._languages,e)&&this._languages[e].mimetypes[0]||null}getExtensions(e){return tU.call(this._languages,e)?this._languages[e].extensions:[]}getFilenames(e){return tU.call(this._languages,e)?this._languages[e].filenames:[]}getIcon(e){return tU.call(this._languages,e)&&this._languages[e].icons[0]||null}getConfigurationFiles(e){return tU.call(this._languages,e)?this._languages[e].configurationFiles||[]:[]}getLanguageIdByLanguageName(e){let t=e.toLowerCase();return tU.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&tU.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:Opo(e,t)}};var VFt=class a extends k{constructor(e=!1){super();this._onDidRequestBasicLanguageFeatures=this._register(new T);this.onDidRequestBasicLanguageFeatures=this._onDidRequestBasicLanguageFeatures.event;this._onDidRequestRichLanguageFeatures=this._register(new T);this.onDidRequestRichLanguageFeatures=this._onDidRequestRichLanguageFeatures.event;this._onDidChange=this._register(new T({leakWarningThreshold:200,leakWarningName:"LanguageService._onDidChange"}));this.onDidChange=this._onDidChange.event;this._requestedBasicLanguages=new Set;this._requestedRichLanguages=new Set;a.instanceCount++,this._registry=this._register(new WFt(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange(()=>this._onDidChange.fire()))}static{this.instanceCount=0}dispose(){a.instanceCount--,super.dispose()}registerLanguage(e){return this._registry.registerLanguage(e)}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getRegisteredLanguageIds(){return this._registry.getRegisteredLanguageIds()}getSortedRegisteredLanguageNames(){return this._registry.getSortedRegisteredLanguageNames()}getLanguageName(e){return this._registry.getLanguageName(e)}getMimeType(e){return this._registry.getMimeType(e)}getIcon(e){return this._registry.getIcon(e)}getExtensions(e){return this._registry.getExtensions(e)}getFilenames(e){return this._registry.getFilenames(e)}getConfigurationFiles(e){return this._registry.getConfigurationFiles(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){return this._registry.guessLanguageIdByFilepathOrFirstLine(e,t).at(0)??null}createById(e){return new MZe(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByMimeType(e){return new MZe(this.onDidChange,()=>{let t=this.getLanguageIdByMimeType(e);return this._createAndGetLanguageIdentifier(t)})}createByFilepathOrFirstLine(e,t){return new MZe(this.onDidChange,()=>{let o=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(o)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=es),e}requestBasicLanguageFeatures(e){this._requestedBasicLanguages.has(e)||(this._requestedBasicLanguages.add(e),this._onDidRequestBasicLanguageFeatures.fire(e))}requestRichLanguageFeatures(e){this._requestedRichLanguages.has(e)||(this._requestedRichLanguages.add(e),this.requestBasicLanguageFeatures(e),vc.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}},MZe=class{constructor(i,e){this._value=vi(this,i,()=>e()),this.onDidChange=U.fromObservable(this._value)}get languageId(){return this._value.get()}};var l8=zn.registerExtensionPoint({extensionPoint:"languages",jsonSchema:{description:d(19152,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:languageId}",aliases:["${2:label}"],extensions:["${3:extension}"],configuration:"./language-configuration.json"}}],properties:{id:{description:d(19162,null),type:"string"},aliases:{description:d(19153,null),type:"array",items:{type:"string"}},extensions:{description:d(19155,null),default:[".foo"],type:"array",items:{type:"string"}},filenames:{description:d(19157,null),type:"array",items:{type:"string"}},filenamePatterns:{description:d(19156,null),type:"array",items:{type:"string"}},mimetypes:{description:d(19163,null),type:"array",items:{type:"string"}},firstLine:{description:d(19158,null),type:"string"},configuration:{description:d(19154,null),type:"string",default:"./language-configuration.json"},icon:{type:"object",description:d(19159,null),properties:{light:{description:d(19161,null),type:"string"},dark:{description:d(19160,null),type:"string"}}}}}},activationEventsGenerator:function*(a){for(let i of a)i.id&&i.configuration&&(yield`onLanguage:${i.id}`)}}),SCi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.languages}render(e){let t=e.contributes,o=t?.languages||[],n=[];for(let p of o)Vpo(p)&&n.push({id:p.id,name:(p.aliases||[])[0]||p.id,extensions:p.extensions||[],hasGrammar:!1,hasSnippets:!1});let r=oY(n,p=>p.id);if((t?.grammars||[]).forEach(p=>{if(!We(p.language))return;let h=r[p.language];h?h.hasGrammar=!0:(h={id:p.language,name:p.language,extensions:[],hasGrammar:!0,hasSnippets:!1},r[h.id]=h,n.push(h))}),(t?.snippets||[]).forEach(p=>{if(!We(p.language))return;let h=r[p.language];h?h.hasSnippets=!0:(h={id:p.language,name:p.language,extensions:[],hasGrammar:!1,hasSnippets:!0},r[h.id]=h,n.push(h))}),!n.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let c=[d(19140,null),d(19141,null),d(19136,null),d(19137,null),d(19151,null)],u=n.sort((p,h)=>p.id.localeCompare(h.id)).map(p=>[p.id,p.name,new he().appendMarkdown(`${p.extensions.map(h=>`\`${h}\``).join("&nbsp;")}`),p.hasGrammar?"\u2714\uFE0E":"\u2014",p.hasSnippets?"\u2714\uFE0E":"\u2014"]);return{data:{headers:c,rows:u},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"languages",label:d(19142,null),access:{canToggle:!1},renderer:new Vt(SCi)});var PZe=class extends VFt{constructor(e,t,o,n){super(o.verbose||o.isExtensionDevelopment||!o.isBuilt);this.logService=n;this._configurationService=t,this._extensionService=e,l8.setHandler(r=>{let s=[];for(let l=0,c=r.length;l<c;l++){let u=r[l];if(!Array.isArray(u.value)){u.collector.error(d(19138,null,l8.name));continue}for(let p=0,h=u.value.length;p<h;p++){let g=u.value[p];if(Vpo(g,u.collector)){let f;g.configuration&&(f=Ve(u.description.extensionLocation,g.configuration)),s.push({id:g.id,extensions:g.extensions,filenames:g.filenames,filenamePatterns:g.filenamePatterns,firstLine:g.firstLine,aliases:g.aliases,mimetypes:g.mimetypes,configuration:f,icon:g.icon&&{light:Ve(u.description.extensionLocation,g.icon.light),dark:Ve(u.description.extensionLocation,g.icon.dark)}})}}}this._registry.setDynamicLanguages(s)}),this.updateMime(),this._register(this._configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(F5)&&this.updateMime()})),this._extensionService.whenInstalledExtensionsRegistered().then(()=>{this.updateMime()}),this._register(this.onDidRequestRichLanguageFeatures(r=>{this._extensionService.activateByEvent(`onLanguage:${r}`),this._extensionService.activateByEvent("onLanguage")}))}updateMime(){let e=this._configurationService.getValue();Npo(),e.files?.associations&&Object.keys(e.files.associations).forEach(t=>{let o=e.files.associations[t];if(typeof o!="string"){this.logService.warn(`Ignoring configured 'files.associations' for '${t}' because its type is not a string but '${typeof o}'`);return}let n=this.getMimeType(o)||`text/x-${o}`;Mpo({id:o,mime:n,filepattern:t})}),this._onDidChange.fire()}};PZe=I([m(0,lt),m(1,B),m(2,ko),m(3,re)],PZe);function BFt(a){return typeof a>"u"?!0:Array.isArray(a)?a.every(i=>typeof i=="string"):!1}function Vpo(a,i){return a?typeof a.id!="string"?(i?.error(d(19150,null,"id")),!1):BFt(a.extensions)?BFt(a.filenames)?typeof a.firstLine<"u"&&typeof a.firstLine!="string"?(i?.error(d(19147,null,"firstLine")),!1):typeof a.configuration<"u"&&typeof a.configuration!="string"?(i?.error(d(19144,null,"configuration")),!1):BFt(a.aliases)?BFt(a.mimetypes)?typeof a.icon<"u"&&(typeof a.icon!="object"||typeof a.icon.light!="string"||typeof a.icon.dark!="string")?(i?.error(d(19148,null,"icon","light","dark")),!1):!0:(i?.error(d(19149,null,"mimetypes")),!1):(i?.error(d(19143,null,"aliases")),!1):(i?.error(d(19146,null,"filenames")),!1):(i?.error(d(19145,null,"extensions")),!1):(i?.error(d(19139,null,l8.name)),!1)}Ce(Rt,PZe,0);var Bpo="_snippet.markAsUsed";Ge.registerCommand(Bpo,(a,...i)=>{let e=a.get(uw),[t]=i;t instanceof Wme&&e.updateUsageTimestamp(t)});var Gee=class{constructor(i,e){this.snippet=i;this.label={label:i.prefix,description:i.name},this.detail=d(15400,null,i.description||i.name,i.source),this.insertText=i.codeSnippet,this.extensionId=i.extensionId,this.range=e,this.sortText=`${i.snippetSource===3?"z":"a"}-${i.prefix}`,this.kind=28,this.insertTextRules=4,this.command={id:Bpo,title:"",arguments:[i]}}resolve(){return this.documentation=new he().appendCodeblock("",Og.asInsertText(this.snippet.codeSnippet)),this}static compareByLabel(i,e){return oc(i.label.label,e.label.label)}},lLe=class{constructor(i,e,t){this._languageService=i;this._snippets=e;this._languageConfigurationService=t;this._debugDisplayName="snippetCompletions"}async provideCompletionItems(i,e,t){let o=new On,n=e.lineNumber,r=i.getWordAtPosition(e)??{startColumn:e.column,endColumn:e.column,word:""},s=i.getLineContent(e.lineNumber).toLowerCase(),l=s.substring(0,r.startColumn+r.word.length-1),c=this._computeSnippetPositions(i,n,r,l),u=e.column-1,p=t.triggerCharacter?.toLowerCase()??"",h=this._getLanguageIdAtPosition(i,e),g=this._languageConfigurationService.getLanguageConfiguration(h),f=new Set(await this._snippets.getSnippets(h,i.uri)),v=[];for(let b of f){if(t.triggerKind===1&&!b.prefixLow.startsWith(p))continue;let S;for(let H of c)if(!(H.prefixLow.match(/^\s/)&&!b.prefixLow.match(/^\s/))&&gke(H.prefixLow,0,H.prefixLow.length,b.prefixLow,0,b.prefixLow.length)){S=H;break}if(!S)continue;let y=S.startColumn-1,w=b.prefixLow.length-(u-y),x=cwe(s,b.prefixLow,u,u+w,u-y),E=e.with(void 0,y+1),M=x===0?e.column+w:e.column;u<s.length&&g.getAutoClosingPairs().autoClosingPairsCloseSingleChar.get(s[u])?.some(j=>j.open===s[E.column-1]&&b.prefix.startsWith(j.open)&&b.prefix[b.prefix.length-1]===j.close)&&M++;let N=G.fromPositions({lineNumber:n,column:S.startColumn},{lineNumber:n,column:M}),V=N.setEndPosition(n,e.column);v.push(new Gee(b,{replace:N,insert:V})),f.delete(b)}if(!p&&(/\s/.test(s[e.column-2])||!s))for(let b of f){let S=G.fromPositions(e),y=s.indexOf(b.prefixLow,u)===u?S.setEndPosition(e.lineNumber,e.column+b.prefixLow.length):S;v.push(new Gee(b,{replace:y,insert:S}))}return this._disambiguateSnippets(v),{suggestions:v,duration:o.elapsed()}}_disambiguateSnippets(i){i.sort(Gee.compareByLabel);for(let e=0;e<i.length;e++){let t=i[e],o=e+1;for(;o<i.length&&t.label===i[o].label;o++)i[o].label.label=d(15401,null,i[o].label.label,i[o].snippet.name);o>e+1&&(i[e].label.label=d(15401,null,i[e].label.label,i[e].snippet.name),e=o)}}resolveCompletionItem(i){return i instanceof Gee?i.resolve():i}_computeSnippetPositions(i,e,t,o){let n=[];for(let r=1;r<t.startColumn;r++){let s=i.getWordAtPosition(new ye(e,r));n.push({startColumn:r,prefixLow:o.substring(r-1),isWord:!!s}),s&&(r=s.endColumn,n.push({startColumn:s.endColumn,prefixLow:o.substring(s.endColumn-1),isWord:!1}))}return(t.word.length>0||n.length===0)&&n.push({startColumn:t.startColumn,prefixLow:o.substring(t.startColumn-1),isWord:!0}),n}_getLanguageIdAtPosition(i,e){i.tokenization.tokenizeIfCheap(e.lineNumber);let t=i.getLanguageIdAtPosition(e.lineNumber,e.column);return this._languageService.getLanguageName(t)||(t=i.getLanguageId()),t}};lLe=I([m(0,Rt),m(1,uw),m(2,Us)],lLe);var ICi;(t=>{function a(o,n,r){if(_c(n.path))return o.collector.error(d(15426,null,o.description.name,String(n.path))),null;if(_c(n.language)&&!n.path.endsWith(".code-snippets"))return o.collector.error(d(15425,null,o.description.name,String(n.path))),null;if(!_c(n.language)&&!r.isRegisteredLanguageId(n.language))return o.collector.error(d(15424,null,o.description.name,String(n.language))),null;let s=o.description.extensionLocation,l=Ve(s,n.path);return Yr(l,s)?{language:n.language,location:l}:(o.collector.error(d(15427,null,o.description.name,l.path,s.path)),null)}t.toValidSnippet=a,t.snippetsContribution={description:d(15428,null),type:"array",defaultSnippets:[{body:[{language:"",path:""}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",path:"./snippets/${2:id}.json."}}],properties:{language:{description:d(15429,null),type:"string"},path:{description:d(15430,null),type:"string"}}}},t.point=zn.registerExtensionPoint({extensionPoint:"snippets",deps:[l8],jsonSchema:t.snippetsContribution})})(ICi||={});function oZo(a,i,e){return Fn(a.watch(i),a.onDidFilesChange(t=>{t.affects(i)&&e()}))}var qee=class{constructor(i){this._storageService=i;let e=i.get(qee._key,0,""),t;try{t=JSON.parse(e)}catch{}this._ignored=vI(t)?new Set(t):new Set}static{this._key="snippets.ignoredSnippets"}isIgnored(i){return this._ignored.has(i)}updateIgnored(i,e){let t=!1;this._ignored.has(i)&&!e?(this._ignored.delete(i),t=!0):!this._ignored.has(i)&&e&&(this._ignored.add(i),t=!0),t&&this._storageService.store(qee._key,JSON.stringify(Array.from(this._ignored)),0,0)}};qee=I([m(0,de)],qee);var $ee=class{constructor(i){this._storageService=i;let e=i.get($ee._key,0,""),t;try{t=JSON.parse(e)}catch{t=[]}this._usages=Array.isArray(t)?new Map(t):new Map}static{this._key="snippets.usageTimestamps"}getUsageTimestamp(i){return this._usages.get(i)}updateUsageTimestamp(i){this._usages.delete(i),this._usages.set(i,Date.now());let e=[...this._usages].slice(-100);this._storageService.store($ee._key,JSON.stringify(e),0,0)}};$ee=I([m(0,de)],$ee);var cLe=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._environmentService=i;this._userDataProfileService=e;this._contextService=t;this._languageService=o;this._logService=n;this._fileService=r;this._textfileService=s;this._extensionResourceLoaderService=l;this._disposables=new O;this._pendingWork=[];this._files=new dt;this._pendingWork.push(Promise.resolve(c.when(3).then(()=>{this._initExtensionSnippets(),this._initUserSnippets(),this._initWorkspaceSnippets()}))),Bio(new lLe(this._languageService,this,p)),this._enablement=u.createInstance(qee),this._usageTimestamps=u.createInstance($ee)}dispose(){this._disposables.dispose()}isEnabled(i){return!this._enablement.isIgnored(i.snippetIdentifier)}updateEnablement(i,e){this._enablement.updateIgnored(i.snippetIdentifier,!e)}updateUsageTimestamp(i){this._usageTimestamps.updateUsageTimestamp(i.snippetIdentifier)}_joinSnippets(){let i=this._pendingWork.slice(0);return this._pendingWork.length=0,Promise.all(i)}async getSnippetFiles(){return await this._joinSnippets(),this._files.values()}async getSnippets(i,e,t){await this._joinSnippets();let o=[],n=[];if(i){if(this._languageService.isRegisteredLanguageId(i))for(let r of this._files.values())n.push(r.load().then(s=>s.select(i,o)).catch(s=>this._logService.error(s,r.location.toString())))}else for(let r of this._files.values())n.push(r.load().then(s=>Ile(o,o.length,s.data)).catch(s=>this._logService.error(s,r.location.toString())));return await Promise.all(n),this._filterAndSortSnippets(o,e,t)}getSnippetsSync(i,e,t){let o=[];if(this._languageService.isRegisteredLanguageId(i))for(let n of this._files.values())n.load().catch(r=>{}),n.select(i,o);return this._filterAndSortSnippets(o,e,t)}_filterAndSortSnippets(i,e,t){let o=[];for(let n of i)!n.prefix&&!t?.includeNoPrefixSnippets||!this.isEnabled(n)&&!t?.includeDisabledSnippets||typeof t?.fileTemplateSnippets=="boolean"&&t.fileTemplateSnippets!==n.isFileTemplate||e&&!n.isFileIncluded(e)||o.push(n);return o.sort((n,r)=>{let s=0;if(!t?.noRecencySort){let l=this._usageTimestamps.getUsageTimestamp(n.snippetIdentifier)??-1;s=(this._usageTimestamps.getUsageTimestamp(r.snippetIdentifier)??-1)-l}return s===0&&(s=this._compareSnippet(n,r)),s})}_compareSnippet(i,e){return i.snippetSource<e.snippetSource?-1:i.snippetSource>e.snippetSource?1:i.source<e.source?-1:i.source>e.source||i.name>e.name?1:i.name<e.name?-1:0}_initExtensionSnippets(){ICi.point.setHandler(i=>{for(let[e,t]of this._files)t.source===3&&this._files.delete(e);for(let e of i)for(let t of e.value){let o=ICi.toValidSnippet(e,t,this._languageService);if(!o)continue;let n=this._files.get(o.location);if(n)n.defaultScopes?n.defaultScopes.push(o.language):n.defaultScopes=[];else{let r=new sLe(3,o.location,o.language?[o.language]:void 0,e.description,this._fileService,this._extensionResourceLoaderService);this._files.set(r.location,r),this._environmentService.isExtensionDevelopment&&r.load().then(s=>{s.data.some(l=>l.isBogous)&&e.collector.warn(d(15423,null,e.description.name))},s=>{e.collector.warn(d(15422,null,r.location.toString()))})}}})}_initWorkspaceSnippets(){let i=new O,e=()=>{i.clear(),this._pendingWork.push(this._initWorkspaceFolderSnippets(this._contextService.getWorkspace(),i))};this._disposables.add(i),this._disposables.add(this._contextService.onDidChangeWorkspaceFolders(e)),this._disposables.add(this._contextService.onDidChangeWorkbenchState(e)),e()}async _initWorkspaceFolderSnippets(i,e){let t=i.folders.map(async o=>{let n=o.toResource(".vscode");await this._fileService.exists(n)?this._initFolderSnippets(2,n,e):e.add(this._fileService.onDidFilesChange(s=>{s.contains(n,1)&&this._initFolderSnippets(2,n,e)}))});await Promise.all(t)}async _initUserSnippets(){let i=new O,e=async()=>{i.clear();let t=this._userDataProfileService.currentProfile.snippetsHome;await this._fileService.createFolder(t),await this._initFolderSnippets(1,t,i)};this._disposables.add(i),this._disposables.add(this._userDataProfileService.onDidChangeCurrentProfile(t=>t.join((async()=>{this._pendingWork.push(e())})()))),await e()}_initFolderSnippets(i,e,t){let o=new O,n=async()=>{if(o.clear(),!!await this._fileService.exists(e))try{let r=await this._fileService.resolve(e);for(let s of r.children||[])o.add(this._addSnippetFile(s.resource,i))}catch(r){this._logService.error(`Failed snippets from folder '${e.toString()}'`,r)}};return t.add(this._textfileService.files.onDidSave(r=>{Yr(r.model.resource,e)&&n()})),t.add(oZo(this._fileService,e,n)),t.add(o),n()}_addSnippetFile(i,e){let t=Ts(i);if(e===1&&t===".json"){let o=Be(i).replace(/\.json/,"");this._files.set(i,new sLe(e,i,[o],void 0,this._fileService,this._extensionResourceLoaderService))}else t===".code-snippets"&&this._files.set(i,new sLe(e,i,void 0,void 0,this._fileService,this._extensionResourceLoaderService));return{dispose:()=>this._files.delete(i)}}};cLe=I([m(0,ko),m(1,gn),m(2,Ae),m(3,Rt),m(4,re),m(5,ge),m(6,Uo),m(7,aE),m(8,to),m(9,F),m(10,Us)],cLe);function Hpo(a,i){let t=a.getLineContent(i.lineNumber).substr(0,i.column-1),o=Math.max(0,t.length-100);for(let n=t.length-1;n>=o;n--){let r=t.charAt(n);if(/\s/.test(r))return t.substr(n+1)}return o===0?t:""}var pw=class{constructor(i,e,t,o,n){this._editor=i;this._snippetService=e;this._clipboardService=t;this._languageFeaturesService=o;this._activeSnippets=[];this._hasSnippets=pw.ContextKey.bindTo(n),this._configListener=this._editor.onDidChangeConfiguration(r=>{r.hasChanged(139)&&this._update()}),this._update()}static{this.ID="editor.tabCompletionController"}static{this.ContextKey=new Y("hasSnippetCompletions",void 0)}static get(i){return i.getContribution(pw.ID)}dispose(){this._configListener.dispose(),this._selectionListener?.dispose()}_update(){let i=this._editor.getOption(139)==="onlySnippets";this._enabled!==i&&(this._enabled=i,this._enabled?(this._selectionListener=this._editor.onDidChangeCursorSelection(e=>this._updateSnippets()),this._editor.getModel()&&this._updateSnippets()):this._selectionListener?.dispose())}_updateSnippets(){if(this._activeSnippets=[],this._completionProvider?.dispose(),!this._editor.hasModel())return;let i=this._editor.getSelection(),e=this._editor.getModel();e.tokenization.tokenizeIfCheap(i.positionLineNumber);let t=e.getLanguageIdAtPosition(i.positionLineNumber,i.positionColumn),o=this._snippetService.getSnippetsSync(t,e.uri);if(!o){this._hasSnippets.set(!1);return}if(G.isEmpty(i)){let r=Hpo(e,i.getPosition());if(r)for(let s of o)r.endsWith(s.prefix)&&this._activeSnippets.push(s)}else if(!G.spansMultipleLines(i)&&e.getValueLengthInRange(i)<=100){let r=e.getValueInRange(i);if(r)for(let s of o)r===s.prefix&&this._activeSnippets.push(s)}let n=this._activeSnippets.length;if(n===0)this._hasSnippets.set(!1);else if(n===1)this._hasSnippets.set(!0);else{this._hasSnippets.set(!0),this._completionProvider={_debugDisplayName:"tabCompletion",dispose:()=>{r.dispose()},provideCompletionItems:(s,l)=>s!==e||!i.containsPosition(l)?void 0:{suggestions:this._activeSnippets.map(u=>{let p=G.fromPositions(l.delta(0,-u.prefix.length),l);return new Gee(u,p)})}};let r=this._languageFeaturesService.completionProvider.register({language:e.getLanguageId(),pattern:e.uri.fsPath,scheme:e.uri.scheme},this._completionProvider)}}async performSnippetCompletions(){if(this._editor.hasModel())if(this._activeSnippets.length===1){let[i]=this._activeSnippets,e;if(i.needsClipboard){let t=new BK(this._editor,5);if(e=await this._clipboardService.readText(),!t.validate(this._editor))return}ss.get(this._editor)?.insert(i.codeSnippet,{overwriteBefore:i.prefix.length,overwriteAfter:0,clipboardText:e})}else this._activeSnippets.length>1&&this._completionProvider&&g_t(this._editor,this._completionProvider)}};pw=I([m(1,uw),m(2,Bi),m(3,Jt),m(4,X)],pw);Eo(pw.ID,pw,0);var nZo=od.bindToContribution(pw.get);ro(new nZo({id:"insertSnippet",precondition:pw.ContextKey,handler:a=>a.performSnippetCompletions(),kbOpts:{weight:100,kbExpr:C.and(me.editorTextFocus,me.tabDoesNotMoveFocus,ss.InSnippetMode.toNegated()),primary:2}}));var mw="editor.contrib.selectionClipboard";var dLe=new Y("commentEditorFocused",!1),Vme=90,rZo=450,gR=class extends us{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){let f={contributions:[{id:dw.ID,ctor:dw,instantiation:2},{id:Vg.ID,ctor:Vg,instantiation:2},{id:Sc.ID,ctor:Sc,instantiation:0},{id:ss.ID,ctor:ss,instantiation:4},{id:pw.ID,ctor:pw,instantiation:0},{id:$x.ID,ctor:$x,instantiation:4},...ml.getSomeEditorContributions([Ju.ID,Gh.ID,nE.ID,Xu.ID,ql.ID,jf.ID,mw,cd.ID,Rm.ID,X4.ID])],contextMenuId:R.SimpleEditorContext};super(i,e,f,n,r,s,t,l,c,u,p,h,g),this._commentEditorFocused=dLe.bindTo(t),this._commentEditorEmpty=jc.commentIsEmpty.bindTo(t),this._commentEditorEmpty.set(!this.getModel()?.getValueLength()),this._parentThread=o,this._register(this.onDidFocusEditorWidget(v=>this._commentEditorFocused.set(!0))),this._register(this.onDidChangeModelContent(v=>this._commentEditorEmpty.set(!this.getModel()?.getValueLength()))),this._register(this.onDidBlurEditorWidget(v=>this._commentEditorFocused.reset()))}getParentThread(){return this._parentThread}_getActions(){return ml.getEditorActions()}updateOptions(i){let e={...i,lineNumbers:"off"};super.updateOptions(e)}static getEditorOptions(i){return{wordWrap:"on",glyphMargin:!1,lineNumbers:"off",folding:!1,selectOnLineNumbers:!1,scrollbar:{vertical:"visible",verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,lineDecorationsWidth:0,scrollBeyondLastLine:!1,renderLineHighlight:"none",fixedOverflowWidgets:!0,acceptSuggestionOnEnter:"smart",minimap:{enabled:!1},dropIntoEditor:{enabled:!0},autoClosingBrackets:i.getValue("editor.autoClosingBrackets"),quickSuggestions:!1,accessibilitySupport:i.getValue("editor.accessibilitySupport"),fontFamily:i.getValue("editor.fontFamily"),fontSize:i.getValue("editor.fontSize"),allowVariableLineHeights:!1}}};gR=I([m(4,F),m(5,Qt),m(6,fe),m(7,Pe),m(8,Ne),m(9,Ai),m(10,Us),m(11,Jt),m(12,ET)],gR);function UFt(a,i,e){let t=i.getLayoutInfo(),o=i.getOption(75),n=i._getViewModel()?.getLineCount()*o;if(n>t.height||n<t.height&&e>Vme){let r=Math.ceil((n-t.height)/o),s=t.height+o*r;return jn(s,Vme,jn(a.getLayoutInfo().height-90,Vme,rZo))}return e}var sZo=0,zFt="commenteditordecoration",uLe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.owner=e;this._parentEditor=o;this._commentThread=n;this._scopedInstatiationService=r;this._contextKeyService=s;this._commentMenus=l;this._commentOptions=c;this._pendingComment=u;this._parentThread=p;this._actionRunDelegate=g;this.commentService=f;this.keybindingService=b;this.contextMenuService=S;this.hoverService=y;this.textModelService=w;this._commentThreadDisposables=[];this._editorHeight=Vme;this._container=D(t,_(".comment-form-container")),this._form=D(this._container,_(".comment-form")),this.commentEditor=this._register(this._scopedInstatiationService.createInstance(gR,this._form,gR.getEditorOptions(v),s,this._parentThread)),this.commentEditorIsEmpty=jc.commentIsEmpty.bindTo(this._contextKeyService),this.commentEditorIsEmpty.set(!this._pendingComment),this.initialize(h)}async initialize(e){this.avatar=D(this._form,_(".avatar-container")),this.updateAuthorInfo();let t=this._commentThread.comments&&this._commentThread.comments.length>0,o=ht()+"-"+(t?this._commentThread.threadId:++sZo),n=JSON.stringify({extensionId:this._commentThread.extensionId,commentThreadId:this._commentThread.threadId}),r=A.from({scheme:Q.commentsInput,path:`/${this._commentThread.extensionId}/commentinput-${o}.md?${n}`}),s=this.commentService.getCommentController(this.owner);s&&(r=r.with({authority:s.id}));let l=await this.textModelService.createModelReference(r);l.object.textEditorModel.setValue(this._pendingComment?.body||""),this._register(l),this.commentEditor.setModel(l.object.textEditorModel),this._pendingComment&&this.commentEditor.setPosition(this._pendingComment.cursor),this.calculateEditorHeight(),this._register(l.object.textEditorModel.onDidChangeContent(()=>{this.setCommentEditorDecorations(),this.commentEditorIsEmpty?.set(!this.commentEditor.getValue()),this.calculateEditorHeight()&&(this.commentEditor.layout({height:this._editorHeight,width:this.commentEditor.getLayoutInfo().width}),this.commentEditor.render(!0))})),this.createTextModelListener(this.commentEditor,this._form),this.setCommentEditorDecorations(),this._pendingComment?this.expandReplyArea():t?this.createReplyButton(this.commentEditor,this._form):this._commentThread.comments&&this._commentThread.comments.length===0&&this.expandReplyArea(e),this._error=D(this._container,_(".validation-error.hidden"));let c=D(this._container,_(".form-actions"));this._formActions=D(c,_(".other-actions")),this.createCommentWidgetFormActions(this._formActions,l.object.textEditorModel),this._editorActions=D(c,_(".editor-actions")),this.createCommentWidgetEditorActions(this._editorActions,l.object.textEditorModel)}calculateEditorHeight(){let e=UFt(this._parentEditor,this.commentEditor,this._editorHeight);return e!==this._editorHeight?(this._editorHeight=e,!0):!1}updateCommentThread(e){let t=this.commentEditor.hasTextFocus(),o=!this._commentThread.comments?.length&&!e.comments?.length;this._reviewThreadReplyButton||this.createReplyButton(this.commentEditor,this._form),this._commentThread.comments&&this._commentThread.comments.length===0&&!o&&this.expandReplyArea(),t&&this.commentEditor.focus()}getPendingComment(){let e=this.commentEditor.getModel();if(e&&e.getValueLength()>0)return{body:e.getValue(),cursor:this.commentEditor.getPosition()??new ye(1,1)}}setPendingComment(e){this._pendingComment=e,this.expandReplyArea(),this.commentEditor.setValue(e.body),this.commentEditor.setPosition(e.cursor)}layout(e){this.commentEditor.layout({height:this._editorHeight,width:e-54})}focusIfNeeded(){!this._commentThread.comments||!this._commentThread.comments.length?this.commentEditor.focus():(this.commentEditor.getModel()?.getValueLength()??0)>0&&this.expandReplyArea()}focusCommentEditor(){this.commentEditor.focus()}expandReplyAreaAndFocusCommentEditor(){this.expandReplyArea(),this.commentEditor.focus()}isCommentEditorFocused(){return this.commentEditor.hasWidgetFocus()}updateAuthorInfo(){if(this.avatar.textContent="",typeof this._commentThread.canReply!="boolean"&&this._commentThread.canReply.iconPath){this.avatar.style.display="block";let e=D(this.avatar,_("img.avatar"));e.src=In.uriToBrowserUri(A.revive(this._commentThread.canReply.iconPath)).toString(!0)}else this.avatar.style.display="none"}updateCanReply(){this.updateAuthorInfo(),this._commentThread.canReply?this._container.style.display="block":this._container.style.display="none"}async submitComment(){await this._commentFormActions?.triggerDefaultAction(),this._pendingComment=void 0}setCommentEditorDecorations(){let t=this._commentThread.comments&&this._commentThread.comments.length>0?this._commentOptions?.placeHolder||d(10252,null):this._commentOptions?.placeHolder||d(10251,null);this.commentEditor.updateOptions({placeholder:t})}createTextModelListener(e,t){this._commentThreadDisposables.push(e.onDidFocusEditorWidget(()=>{this._commentThread.input={uri:e.getModel().uri,value:e.getValue()},this.commentService.setActiveEditingCommentThread(this._commentThread),this.commentService.setActiveCommentAndThread(this.owner,{thread:this._commentThread})})),this._commentThreadDisposables.push(e.getModel().onDidChangeContent(()=>{let o=e.getValue();if(this._commentThread.input&&this._commentThread.input.uri===e.getModel().uri&&this._commentThread.input.value!==o){let n=this._commentThread.input;n.value=o,this._commentThread.input=n}this.commentService.setActiveEditingCommentThread(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeInput(o=>{let n=this._commentThread,r=e.getModel();n.input&&r&&n.input.uri!==r.uri||o&&e.getValue()!==o.value&&(e.setValue(o.value),o.value===""&&(this._pendingComment={body:"",cursor:new ye(1,1)},t.classList.remove("expand"),e.getDomNode().style.outline="",this._error.textContent="",this._error.classList.add("hidden")))}))}createCommentWidgetFormActions(e,t){let o=this._commentMenus.getCommentThreadActions(this._contextKeyService);this._register(o),this._register(o.onDidChange(()=>{this._commentFormActions.setActions(o)})),this._commentFormActions=new yG(this.keybindingService,this._contextKeyService,this.contextMenuService,e,async n=>{await this._actionRunDelegate?.(),await n.run({thread:this._commentThread,text:this.commentEditor.getValue(),$mid:9}),this.hideReplyArea()}),this._register(this._commentFormActions),this._commentFormActions.setActions(o)}createCommentWidgetEditorActions(e,t){let o=this._commentMenus.getCommentEditorActions(this._contextKeyService);this._register(o),this._register(o.onDidChange(()=>{this._commentEditorActions.setActions(o,!0)})),this._commentEditorActions=new yG(this.keybindingService,this._contextKeyService,this.contextMenuService,e,async n=>{this._actionRunDelegate?.(),n.run({thread:this._commentThread,text:this.commentEditor.getValue(),$mid:9}),this.focusCommentEditor()}),this._register(this._commentEditorActions),this._commentEditorActions.setActions(o,!0)}get isReplyExpanded(){return this._container.classList.contains("expand")}expandReplyArea(e=!0){this.isReplyExpanded||(this._container.classList.add("expand"),e&&this.commentEditor.focus(),this.commentEditor.layout())}clearAndExpandReplyArea(){this.isReplyExpanded||(this.commentEditor.setValue(""),this.expandReplyArea())}hideReplyArea(){let e=this.commentEditor.getDomNode();e&&(e.style.outline=""),this.commentEditor.setValue(""),this._pendingComment={body:"",cursor:new ye(1,1)},this._container.classList.remove("expand"),this._error.textContent="",this._error.classList.add("hidden")}createReplyButton(e,t){this._reviewThreadReplyButton=D(t,_(`button.review-thread-reply-button.${xT}`)),this._register(this.hoverService.setupManagedHover(yi("mouse"),this._reviewThreadReplyButton,this._commentOptions?.prompt||d(10252,null))),this._reviewThreadReplyButton.textContent=this._commentOptions?.prompt||d(10252,null),this._register($(this._reviewThreadReplyButton,"click",o=>this.clearAndExpandReplyArea())),this._register($(this._reviewThreadReplyButton,"focus",o=>this.clearAndExpandReplyArea())),this._register(e.onDidBlurEditorWidget(()=>{e.getModel().getValueLength()===0&&t.classList.contains("expand")&&t.classList.remove("expand")}))}dispose(){super.dispose(),je(this._commentThreadDisposables)}};uLe=I([m(12,Wm),m(13,B),m(14,Le),m(15,Xe),m(16,ot),m(17,Bt)],uLe);var jee=class a extends it{constructor(e,t){super(a.ID,t||d(10360,null),"toggle-reactions",!0);this._menuActions=[];this.toggleDropdownMenu=e}static{this.ID="toolbar.toggle.pickReactions"}run(){return this.toggleDropdownMenu(),Promise.resolve(!0)}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}},KFt=class extends ts{constructor(i){super(null,i,{})}updateLabel(){if(!this.label)return;let i=this.action;if(i.class&&this.label.classList.add(i.class),i.icon){let e=D(this.label,_(".reaction-icon")),t=A.revive(i.icon);e.style.backgroundImage=cl(t)}else{let e=D(this.label,_("span.reaction-label"));e.innerText=i.label}if(i.count){let e=D(this.label,_("span.reaction-count"));e.innerText=`${i.count}`}}getTooltip(){let i=this.action,e=i.enabled?d(10359,null):"";if(i.count===void 0)return d(10355,null,e,i.label);if(i.reactors===void 0||i.reactors.length===0){if(i.count===1)return d(10356,null,e,i.label);if(i.count>1)return d(10354,null,e,i.count,i.label)}else{if(i.reactors.length<=10&&i.reactors.length===i.count)return d(10357,null,e,i.reactors.join(", "),i.label);if(i.count>1){let t=i.reactors.slice(0,10);return d(10358,null,e,t.join(", "),i.count-t.length,i.label)}}}},AZe=class a extends it{constructor(e,t="",o="",n=!0,r,s,l,c){super(a.ID,t,o,n,r);this.reactors=s;this.icon=l;this.count=c}static{this.ID="toolbar.toggle.reaction"}};var yCi=class extends cs{async runAction(i,e){await i.run(...e)}},pLe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.parentEditor=e;this.commentThread=t;this.comment=o;this.pendingEdit=n;this.owner=r;this.resource=s;this.parentThread=l;this.markdownRendererOptions=c;this.instantiationService=u;this.commentService=p;this.notificationService=h;this.contextMenuService=g;this.configurationService=v;this.hoverService=b;this.keybindingService=S;this.textModelService=y;this.markdownRendererService=w;this._md=this._register(new ue);this._editAction=null;this._commentEditContainer=null;this._reactionsActionBar=this._register(new ue);this._reactionActions=this._register(new O);this._commentEditor=null;this._commentEditorModel=null;this._editorHeight=Vme;this._actionRunner=this._register(new yCi);this.toolbar=this._register(new ue);this._commentFormActions=null;this._commentEditorActions=null;this._onDidClick=this._register(new T);this.isEditing=!1;this._editModeDisposables=this._register(new O);this._domNode=_("div.review-comment"),this._contextKeyService=this._register(f.createScoped(this._domNode)),this._commentContextValue=jc.commentContext.bindTo(this._contextKeyService),this.comment.contextValue&&this._commentContextValue.set(this.comment.contextValue),this._commentMenus=this.commentService.getCommentMenus(this.owner),this._domNode.tabIndex=-1,this._avatar=D(this._domNode,_("div.avatar-container")),this.updateCommentUserIcon(this.comment.userIconPath),this._commentDetailsContainer=D(this._domNode,_(".review-comment-contents")),this.createHeader(this._commentDetailsContainer),this._body=document.createElement("div"),this._body.classList.add("comment-body",xT),v.getValue(fG)?.maxHeight!==!1&&this._body.classList.add("comment-body-max-height"),this.createScroll(this._commentDetailsContainer,this._body),this.updateCommentBody(this.comment.body),this.createReactionsContainer(this._commentDetailsContainer),this._domNode.setAttribute("aria-label",`${o.userName}, ${this.commentBodyValue}`),this._domNode.setAttribute("role","treeitem"),this._clearTimeout=null,this._register($(this._domNode,ne.CLICK,()=>this.isEditing||this._onDidClick.fire(this))),this._register($(this._domNode,ne.CONTEXT_MENU,x=>this.onContextMenu(x))),n&&this.switchToEditMode(),this.activeCommentListeners()}get domNode(){return this._domNode}activeCommentListeners(){this._register($(this._domNode,ne.FOCUS_IN,()=>{this.commentService.setActiveCommentAndThread(this.owner,{thread:this.commentThread,comment:this.comment})},!0))}createScroll(e,t){this._scrollable=this._register(new hD({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>kr(Me(e),n)})),this._scrollableElement=this._register(new LF(t,{horizontal:3,vertical:3},this._scrollable)),this._register(this._scrollableElement.onScroll(n=>{n.scrollLeftChanged&&(t.scrollLeft=n.scrollLeft),n.scrollTopChanged&&(t.scrollTop=n.scrollTop)}));let o=this._register(new Zn(t,"scroll")).event;this._register(o(n=>{let r=this._scrollableElement.getScrollPosition(),s=Math.abs(t.scrollLeft-r.scrollLeft)<=1?void 0:t.scrollLeft,l=Math.abs(t.scrollTop-r.scrollTop)<=1?void 0:t.scrollTop;(s!==void 0||l!==void 0)&&this._scrollableElement.setScrollPosition({scrollLeft:s,scrollTop:l})})),e.appendChild(this._scrollableElement.getDomNode())}updateCommentBody(e){this._body.innerText="",this._md.clear(),this._plainText=void 0,typeof e=="string"?(this._plainText=D(this._body,_(".comment-body-plainstring")),this._plainText.innerText=e):(this._md.value=this.markdownRendererService.render(e,this.markdownRendererOptions),this._body.appendChild(this._md.value.element))}updateCommentUserIcon(e){if(this._avatar.textContent="",e){let t=D(this._avatar,_("img.avatar"));t.src=In.uriToBrowserUri(A.revive(e)).toString(!0),t.onerror=o=>t.remove()}}get onDidClick(){return this._onDidClick.event}createTimestamp(e){this._timestamp=D(e,_("span.timestamp-container")),this.updateTimestamp(this.comment.timestamp)}updateTimestamp(e){if(!this._timestamp)return;let t=e!==void 0?new Date(e):void 0;t?this._timestampWidget?this._timestampWidget.setTimestamp(t):(this._timestampWidget=new Pme(this.configurationService,this.hoverService,this._timestamp,t),this._register(this._timestampWidget)):this._timestampWidget?.dispose()}createHeader(e){let t=D(e,_(`div.comment-title.${xT}`)),o=D(t,_("comment-header-info")),n=D(o,_("strong.author"));n.innerText=this.comment.userName,this.createTimestamp(o),this._isPendingLabel=D(o,_("span.isPending")),this.comment.label?this._isPendingLabel.innerText=this.comment.label:this._isPendingLabel.innerText="",this._actionsToolbarContainer=D(t,_(".comment-actions")),this.createActionsToolbar()}getToolbarActions(e){let t=e.getActions({shouldForwardArgs:!0}),r={primary:[],secondary:[]};return lZo(t,r,!1,s=>/^inline/.test(s)),r}get commentNodeContext(){return[{thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,$mid:10},{commentControlHandle:this.commentThread.controllerHandle,commentThreadHandle:this.commentThread.commentThreadHandle,$mid:7}]}createToolbar(){this.toolbar.value=new Kp(this._actionsToolbarContainer,this.contextMenuService,{actionViewItemProvider:(e,t)=>e.id===jee.ID?new rh(e,e.menuActions,this.contextMenuService,{...t,actionViewItemProvider:(o,n)=>this.actionViewItemProvider(o,n),classNames:["toolbar-toggle-pickReactions",...q.asClassNameArray(L.reactions)],anchorAlignmentProvider:()=>1}):this.actionViewItemProvider(e,t),orientation:0}),this.toolbar.value.context=this.commentNodeContext,this.toolbar.value.actionRunner=this._actionRunner}createActionsToolbar(){let e=[],t=this._commentMenus.getCommentTitleActions(this.comment,this._contextKeyService);this._register(t),this._register(t.onDidChange(r=>{let{primary:s,secondary:l}=this.getToolbarActions(t);!this.toolbar&&(s.length||l.length)&&this.createToolbar(),this.toolbar.value.setActions(s,l)}));let{primary:o,secondary:n}=this.getToolbarActions(t);e.push(...o),(e.length||n.length)&&(this.createToolbar(),this.toolbar.value.setActions(e,n))}actionViewItemProvider(e,t){return e.id===jee.ID?t={label:!1,icon:!0}:t={label:!1,icon:!0},e.id===AZe.ID?new KFt(e):e instanceof Do?this.instantiationService.createInstance(Cl,e,{hoverDelegate:t.hoverDelegate}):e instanceof id?this.instantiationService.createInstance(FT,e,t):new ts({},e,t)}async submitComment(){this._commentEditor&&this._commentFormActions&&(await this._commentFormActions.triggerDefaultAction(),this.pendingEdit=void 0)}createReactionPicker(e){let t=this._reactionActions.add(new jee(()=>{n?.show()},d(10248,null))),o=[];e&&e.length&&(o=e.map(r=>this._reactionActions.add(new it(`reaction.command.${r.label}`,`${r.label}`,"",!0,async()=>{try{await this.commentService.toggleReaction(this.owner,this.resource,this.commentThread,this.comment,r)}catch(s){let l=s.message?d(10250,null,s.message):d(10249,null);this.notificationService.error(l)}})))),t.menuActions=o;let n=this._reactionActions.add(new rh(t,t.menuActions,this.contextMenuService,{actionViewItemProvider:(r,s)=>r.id===jee.ID?n:this.actionViewItemProvider(r,s),classNames:"toolbar-toggle-pickReactions",anchorAlignmentProvider:()=>1}));return t}createReactionsContainer(e){this._reactionActionsContainer?.remove(),this._reactionsActionBar.clear(),this._reactionActions.clear();let t=this.commentService.hasReactionHandler(this.owner),o=this.comment.commentReactions?.filter(n=>!!n.count)||[];if(!(o.length===0&&!t)&&(this._reactionActionsContainer=D(e,_("div.comment-reactions")),this._reactionsActionBar.value=new oo(this._reactionActionsContainer,{actionViewItemProvider:(n,r)=>n.id===jee.ID?new rh(n,n.menuActions,this.contextMenuService,{actionViewItemProvider:(s,l)=>this.actionViewItemProvider(s,l),classNames:["toolbar-toggle-pickReactions",...q.asClassNameArray(L.reactions)],anchorAlignmentProvider:()=>1}):this.actionViewItemProvider(n,r)}),o.map(n=>{let r=this._reactionActions.add(new AZe(`reaction.${n.label}`,`${n.label}`,n.hasReacted&&(n.canEdit||t)?"active":"",n.canEdit||t,async()=>{try{await this.commentService.toggleReaction(this.owner,this.resource,this.commentThread,this.comment,n)}catch(s){let l;n.hasReacted?l=s.message?d(10247,null,s.message):d(10246,null):l=s.message?d(10245,null,s.message):d(10244,null),this.notificationService.error(l)}},n.reactors,n.iconPath,n.count));this._reactionsActionBar.value?.push(r,{label:!0,icon:!0})}),t)){let n=this.createReactionPicker(this.comment.commentReactions||[]);this._reactionsActionBar.value?.push(n,{label:!1,icon:!0})}}get commentBodyValue(){return typeof this.comment.body=="string"?this.comment.body:this.comment.body.value}async createCommentEditor(e){this._editModeDisposables.clear();let t=D(e,_(".edit-textarea"));this._commentEditor=this.instantiationService.createInstance(gR,t,gR.getEditorOptions(this.configurationService),this._contextKeyService,this.parentThread),this._editModeDisposables.add(this._commentEditor);let o=A.from({scheme:Q.commentsInput,path:`/commentinput-${this.comment.uniqueIdInThread}-${Date.now()}.md`}),n=await this.textModelService.createModelReference(o);if(this._commentEditorModel=n,this._editModeDisposables.add(this._commentEditorModel),this._commentEditor.setModel(this._commentEditorModel.object.textEditorModel),this._commentEditor.setValue(this.pendingEdit?.body??this.commentBodyValue),this.pendingEdit)this._commentEditor.setPosition(this.pendingEdit.cursor);else{let s=this._commentEditorModel.object.textEditorModel.getLineCount(),l=this._commentEditorModel.object.textEditorModel.getLineLength(s)+1;this._commentEditor.setPosition(new ye(s,l))}this.pendingEdit=void 0,this._commentEditor.layout({width:t.clientWidth-14,height:this._editorHeight}),this._commentEditor.focus(),kr(Me(e),()=>{this._commentEditor.layout({width:t.clientWidth-14,height:this._editorHeight}),this._commentEditor.focus()});let r=this.commentThread;r.input={uri:this._commentEditor.getModel().uri,value:this.commentBodyValue},this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment}),this._editModeDisposables.add(this._commentEditor.onDidFocusEditorWidget(()=>{r.input={uri:this._commentEditor.getModel().uri,value:this.commentBodyValue},this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment})})),this._editModeDisposables.add(this._commentEditor.onDidChangeModelContent(s=>{if(r.input&&this._commentEditor&&this._commentEditor.getModel().uri===r.input.uri){let l=this._commentEditor.getValue();if(l!==r.input.value){let c=r.input;c.value=l,r.input=c,this.commentService.setActiveEditingCommentThread(r),this.commentService.setActiveCommentAndThread(this.owner,{thread:r,comment:this.comment})}}})),this.calculateEditorHeight(),this._editModeDisposables.add(this._commentEditorModel.object.textEditorModel.onDidChangeContent(()=>{this._commentEditor&&this.calculateEditorHeight()&&(this._commentEditor.layout({height:this._editorHeight,width:this._commentEditor.getLayoutInfo().width}),this._commentEditor.render(!0))}))}calculateEditorHeight(){if(this._commentEditor){let e=UFt(this.parentEditor,this._commentEditor,this._editorHeight);if(e!==this._editorHeight)return this._editorHeight=e,!0}return!1}getPendingEdit(){let e=this._commentEditor?.getModel();if(this._commentEditor&&e&&e.getValueLength()>0)return{body:e.getValue(),cursor:this._commentEditor.getPosition()}}removeCommentEditor(){this.isEditing=!1,this._editAction&&(this._editAction.enabled=!0),this._body.classList.remove("hidden"),this._editModeDisposables.clear(),this._commentEditor=null,this._commentEditContainer.remove()}layout(e){let t=e!==void 0?e-72:this._commentEditor?.getLayoutInfo().width??0;this._commentEditor?.layout({width:t,height:this._editorHeight});let o=this._body.scrollWidth,n=xY(this._body),r=this._body.scrollHeight,s=Mwe(this._body)+4;this._scrollableElement.setScrollDimensions({width:n,scrollWidth:o,height:s,scrollHeight:r})}async switchToEditMode(){if(this.isEditing)return;this.isEditing=!0,this._body.classList.add("hidden"),this._commentEditContainer=D(this._commentDetailsContainer,_(".edit-container")),await this.createCommentEditor(this._commentEditContainer);let e=D(this._commentEditContainer,_(".form-actions")),t=D(e,_(".other-actions"));this.createCommentWidgetFormActions(t);let o=D(e,_(".editor-actions"));this.createCommentWidgetEditorActions(o)}createCommentWidgetFormActions(e){let o=this.commentService.getCommentMenus(this.owner).getCommentActions(this.comment,this._contextKeyService);this._editModeDisposables.add(o),this._editModeDisposables.add(o.onDidChange(()=>{this._commentFormActions?.setActions(o)})),this._commentFormActions=new yG(this.keybindingService,this._contextKeyService,this.contextMenuService,e,n=>{let r=this._commentEditor.getValue();n.run({thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,text:r,$mid:11}),this.removeCommentEditor()}),this._editModeDisposables.add(this._commentFormActions),this._commentFormActions.setActions(o)}createCommentWidgetEditorActions(e){let o=this.commentService.getCommentMenus(this.owner).getCommentEditorActions(this._contextKeyService);this._editModeDisposables.add(o),this._editModeDisposables.add(o.onDidChange(()=>{this._commentEditorActions?.setActions(o,!0)})),this._commentEditorActions=new yG(this.keybindingService,this._contextKeyService,this.contextMenuService,e,n=>{let r=this._commentEditor.getValue();n.run({thread:this.commentThread,commentUniqueId:this.comment.uniqueIdInThread,text:r,$mid:11}),this._commentEditor?.focus()}),this._editModeDisposables.add(this._commentEditorActions),this._commentEditorActions.setActions(o,!0)}setFocus(e,t=!1){e?(this._domNode.focus(),this._actionsToolbarContainer.classList.add("tabfocused"),this._domNode.tabIndex=0,this.comment.mode===0&&this._commentEditor?.focus()):(this._actionsToolbarContainer.classList.contains("tabfocused")&&!this._actionsToolbarContainer.classList.contains("mouseover")&&(this._domNode.tabIndex=-1),this._actionsToolbarContainer.classList.remove("tabfocused"))}async update(e){e.body!==this.comment.body&&this.updateCommentBody(e.body),this.comment.userIconPath&&e.userIconPath&&A.from(this.comment.userIconPath).toString()!==A.from(e.userIconPath).toString()&&this.updateCommentUserIcon(e.userIconPath);let t=e.mode!==void 0&&e.mode!==this.comment.mode;this.comment=e,t&&(e.mode===0?await this.switchToEditMode():this.removeCommentEditor()),e.label?this._isPendingLabel.innerText=e.label:this._isPendingLabel.innerText="",this.createReactionsContainer(this._commentDetailsContainer),this.comment.contextValue?this._commentContextValue.set(this.comment.contextValue):this._commentContextValue.reset(),this.comment.timestamp&&this.updateTimestamp(this.comment.timestamp)}onContextMenu(e){let t=new Ln(Me(this._domNode),e);this.contextMenuService.showContextMenu({getAnchor:()=>t,menuId:R.CommentThreadCommentContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this._contextKeyService,actionRunner:this._actionRunner,getActionsContext:()=>this.commentNodeContext})}focus(){this.domNode.focus(),this._clearTimeout||(this.domNode.classList.add("focus"),this._clearTimeout=setTimeout(()=>{this.domNode.classList.remove("focus")},3e3))}dispose(){super.dispose()}};pLe=I([m(8,F),m(9,Wm),m(10,Ne),m(11,Xe),m(12,X),m(13,B),m(14,ot),m(15,Le),m(16,Bt),m(17,_n)],pLe);function lZo(a,i,e,t=o=>o==="navigation"){for(let o of a){let[n,r]=o;if(e&&(r=r.map(s=>s instanceof Do&&s.alt?s.alt:s)),t(n))(Array.isArray(i)?i:i.primary).unshift(...r);else{let s=Array.isArray(i)?i:i.secondary;s.length>0&&s.push(new oi),s.push(...r)}}}var mLe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._parentEditor=e;this.owner=t;this.parentResourceUri=o;this.container=n;this._markdownRendererOptions=r;this._commentThread=s;this._pendingEdits=l;this._scopedInstatiationService=c;this._parentCommentThreadWidget=u;this.commentService=p;this._commentElements=[];this._resizeObserver=null;this._focusedComment=void 0;this._onDidResize=this._register(new T);this.onDidResize=this._onDidResize.event;this._commentDisposable=new Ot;this._containerClientArea=void 0;this._register($(n,ne.FOCUS_IN,h=>{this.commentService.setActiveEditingCommentThread(this._commentThread)}))}get length(){return this._commentThread.comments?this._commentThread.comments.length:0}get activeComment(){return this._commentElements.filter(e=>e.isEditing)[0]}focus(e){if(e!==void 0){let t=this._commentElements.find(o=>o.comment.uniqueIdInThread===e);if(t){t.focus();return}}this._commentsElement.focus()}hasCommentsInEditMode(){return this._commentElements.some(e=>e.isEditing)}ensureFocusIntoNewEditingComment(){this._commentElements.length===1&&this._commentElements[0].isEditing&&this._commentElements[0].setFocus(!0)}async display(){if(this._commentsElement=D(this.container,_("div.comments-container")),this._commentsElement.setAttribute("role","presentation"),this._commentsElement.tabIndex=0,this._updateAriaLabel(),this._register($(this._commentsElement,ne.KEY_DOWN,e=>{let t=new mi(e);if((t.equals(16)||t.equals(18))&&(!this._focusedComment||!this._commentElements[this._focusedComment].isEditing)){let o=n=>{if(this._focusedComment===void 0&&n>=0)return 0;if(this._focusedComment===void 0&&n<0)return this._commentElements.length-1;let r=this._focusedComment+n;return Math.min(Math.max(0,r),this._commentElements.length-1)};this._setFocusedComment(t.equals(16)?o(-1):o(1))}})),this._commentDisposable.clearAndDisposeAll(),this._commentElements=[],this._commentThread.comments)for(let e of this._commentThread.comments){let t=this.createNewCommentNode(e);this._commentElements.push(t),this._commentsElement.appendChild(t.domNode),e.mode===0&&await t.switchToEditMode()}this._resizeObserver=new MutationObserver(this._refresh.bind(this)),this._resizeObserver.observe(this.container,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}_refresh(){let e=wh(this.container);e.height===0&&e.width===0||di.equals(this._containerClientArea,e)||(this._containerClientArea=e,this._onDidResize.fire(e))}getDimensions(){return wh(this.container)}layout(e){this._commentElements.forEach(t=>{t.layout(e)})}getPendingEdits(){let e={};return this._commentElements.forEach(t=>{if(t.isEditing){let o=t.getPendingEdit();o&&(e[t.comment.uniqueIdInThread]=o)}}),e}getCommentCoords(e){let t=this._commentElements.filter(o=>o.comment.uniqueIdInThread===e);if(t&&t.length){let o=ur(this._commentElements[0].domNode),n=ur(t[0].domNode);return{thread:o,comment:n}}}async updateCommentThread(e,t){let o=this._commentElements.length,n=e.comments?e.comments.length:0,r=[],s=[];for(let h=0;h<o;h++){let g=this._commentElements[h].comment,f=e.comments?e.comments.filter(v=>v.uniqueIdInThread===g.uniqueIdInThread):[];f.length?this._commentElements[h].update(f[0]):(s.push(h),r.push(this._commentElements[h]))}for(let h=r.length-1;h>=0;h--){let g=r[h];this._commentDisposable.deleteAndDispose(g),this._commentElements.splice(s[h],1),g.domNode.remove()}let l=null,c=[],u=[],p=[];for(let h=n-1;h>=0;h--){let g=e.comments[h],f=this._commentElements.filter(v=>v.comment.uniqueIdInThread===g.uniqueIdInThread);if(f.length)l=f[0].domNode,c.unshift(f[0]);else{let v=this.createNewCommentNode(g);c.unshift(v),l?(this._commentsElement.insertBefore(v.domNode,l),l=v.domNode):(this._commentsElement.appendChild(v.domNode),l=v.domNode),g.mode===0&&(p.push(v.switchToEditMode()),u.push(v))}}if(this._commentThread=e,this._commentElements=c,await Promise.all(p),u.length){let h=this._commentElements.indexOf(u[u.length-1]);this._focusedComment=h}this._updateAriaLabel(),t||this._setFocusedComment(this._focusedComment)}_updateAriaLabel(){this._commentThread.isDocumentCommentThread()?this._commentThread.range?this._commentsElement.ariaLabel=d(10344,null,this._commentThread.comments?.length,this._commentThread.range.startLineNumber,this._commentThread.range.endLineNumber,this._commentThread.label):this._commentsElement.ariaLabel=d(10343,null,this._commentThread.comments?.length,this._commentThread.label):this._commentsElement.ariaLabel=d(10342,null,this._commentThread.comments?.length,this._commentThread.label)}_setFocusedComment(e){this._focusedComment!==void 0&&this._commentElements[this._focusedComment]?.setFocus(!1),this._commentElements.length===0||e===void 0?this._focusedComment=void 0:(this._focusedComment=Math.min(e,this._commentElements.length-1),this._commentElements[this._focusedComment].setFocus(!0))}createNewCommentNode(e){let t=this._scopedInstatiationService.createInstance(pLe,this._parentEditor,this._commentThread,e,this._pendingEdits?this._pendingEdits[e.uniqueIdInThread]:void 0,this.owner,this.parentResourceUri,this._parentCommentThreadWidget,this._markdownRendererOptions),o=new O;return o.add(t.onDidClick(n=>this._setFocusedComment(this._commentElements.findIndex(r=>r.comment.uniqueIdInThread===n.comment.uniqueIdInThread)))),o.add(t),this._commentDisposable.set(t,o),t}dispose(){super.dispose(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this._commentDisposable.dispose()}};mLe=I([m(9,Wm)],mLe);var cZo=Oe("review-comment-collapse",L.chevronUp,d(10345,null)),Upo="expand-review-action "+q.asClassName(cZo),dZo="expand-review-action "+q.asClassName(L.trashcan);function wCi(a){return!!a&&a.length>0}var hLe=class extends k{constructor(e,t,o,n,r,s,l){super();this._delegate=t;this._commentMenus=o;this._commentThread=n;this._contextKeyService=r;this._instantiationService=s;this._contextMenuService=l;this._headElement=_(".head"),e.appendChild(this._headElement),this._register(ee(()=>this._headElement.remove())),this._fillHead()}_fillHead(){let e=D(this._headElement,_(".review-title"));this._headingLabel=D(e,_("span.filename")),this.createThreadLabel();let t=D(this._headElement,_(".review-actions"));this._actionbarWidget=new oo(t,{actionViewItemProvider:ta.bind(void 0,this._instantiationService)}),this._register(this._actionbarWidget);let o=wCi(this._commentThread.comments)?Upo:dZo;if(this._collapseAction=new it("workbench.action.hideComment",d(10346,null),o,!0,()=>this._delegate.collapse()),!wCi(this._commentThread.comments)){let r=this._register(new ue);r.value=this._commentThread.onDidChangeComments(()=>{wCi(this._commentThread.comments)&&(this._collapseAction.class=Upo,r.clear())})}let n=this._commentMenus.getCommentThreadTitleActions(this._contextKeyService);this._register(n),this.setActionBarActions(n),this._register(n),this._register(n.onDidChange(r=>{this.setActionBarActions(n)})),this._register($(this._headElement,ne.CONTEXT_MENU,r=>this.onContextMenu(r))),this._actionbarWidget.context=this._commentThread}setActionBarActions(e){let t=e.getActions({shouldForwardArgs:!0}).reduce((o,[,n])=>[...o,...n],[]);this._actionbarWidget.clear(),this._actionbarWidget.push([...t,this._collapseAction],{label:!1,icon:!0})}updateCommentThread(e){this._commentThread=e,this._actionbarWidget.context=this._commentThread,this.createThreadLabel()}createThreadLabel(){let e;e=this._commentThread.label,e===void 0&&(this._commentThread.comments&&this._commentThread.comments.length||(e=d(10347,null))),e&&(this._headingLabel.textContent=Cr(e),this._headingLabel.setAttribute("aria-label",e))}updateHeight(e){this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height}onContextMenu(e){let t=this._commentMenus.getCommentThreadTitleContextActions(this._contextKeyService);if(!t.length)return;let o=new Ln(Me(this._headElement),e);this._contextMenuActionRunner||(this._contextMenuActionRunner=this._register(new cs)),this._contextMenuService.showContextMenu({getAnchor:()=>o,getActions:()=>t,actionRunner:this._contextMenuActionRunner,getActionsContext:()=>({commentControlHandle:this._commentThread.controllerHandle,commentThreadHandle:this._commentThread.commentThreadHandle,$mid:7})})}};hLe=I([m(4,X),m(5,F),m(6,Xe)],hLe);var gLe=class extends k{constructor(e,t,o,n,r,s,l){super();this._commentThread=t;this._contextKeyService=o;this._commentMenus=n;this._actionRunDelegate=r;this._keybindingService=s;this._contextMenuService=l;this._container=D(e,_(".comment-additional-actions")),D(this._container,_(".section-separator")),this._buttonBar=D(this._container,_(".button-bar")),this._createAdditionalActions(this._buttonBar)}_showMenu(){this._container?.classList.remove("hidden")}_hideMenu(){this._container?.classList.add("hidden")}_enableDisableMenu(e){let t=e.getActions({shouldForwardArgs:!0});for(let o of t){let[,n]=o;for(let r of n){if(r.enabled){this._showMenu();return}for(let s of r.actions??[])if(s.enabled){this._showMenu();return}}}this._hideMenu()}_createAdditionalActions(e){let t=this._commentMenus.getCommentThreadAdditionalActions(this._contextKeyService);this._register(t),this._register(t.onDidChange(()=>{this._commentFormActions.setActions(t,!0),this._enableDisableMenu(t)})),this._commentFormActions=new yG(this._keybindingService,this._contextKeyService,this._contextMenuService,e,async o=>{this._actionRunDelegate?.(),o.run({thread:this._commentThread,$mid:8})},4,!0),this._register(this._commentFormActions),this._commentFormActions.setActions(t,!0),this._enableDisableMenu(t)}};gLe=I([m(5,Le),m(6,Xe)],gLe);function uZo(a,i,e){let t=new Set;return Fn(...a.map((o,n)=>Fn(o.onDidFocus(()=>{e?.(n,"focus"),t.size||i(!0),t.add(n)}),o.onDidBlur(()=>{e?.(n,"blur"),t.delete(n),t.size||i(!1)}))))}var CCi=new Y("navigableContainerFocused",!1),cW=class{constructor(i,e,t){this.logService=e;this.configurationService=t;this.containers=new Set;this.focused=CCi.bindTo(i),cW.INSTANCE=this}static{this.ID="workbench.contrib.navigableContainerManager"}dispose(){this.containers.clear(),this.focused.reset(),cW.INSTANCE=void 0}get debugEnabled(){return this.configurationService.getValue("workbench.navigibleContainer.enableDebug")}log(i,...e){this.debugEnabled&&this.logService.debug(i,...e)}static register(i){let e=this.INSTANCE;return e?(e.containers.add(i),e.log("NavigableContainerManager.register",i.name),Fn(uZo(i.focusNotifiers,t=>{t?(e.log("NavigableContainerManager.focus",i.name),e.focused.set(!0),e.lastContainer=i):(e.log("NavigableContainerManager.blur",i.name,e.lastContainer?.name),e.lastContainer===i&&(e.focused.set(!1),e.lastContainer=void 0))},(t,o)=>{e.log("NavigableContainerManager.partFocusChange",i.name,t,o)}),ee(()=>{e.containers.delete(i),e.log("NavigableContainerManager.unregister",i.name,e.lastContainer?.name),e.lastContainer===i&&(e.focused.set(!1),e.lastContainer=void 0)}))):k.None}static getActive(){return this.INSTANCE?.lastContainer}};cW=I([m(0,X),m(1,re),m(2,B)],cW);function p_(a){return cW.register(a)}bt(cW.ID,cW,vt.BlockStartup);xt.registerCommandAndKeybindingRule({id:"widgetNavigation.focusPrevious",weight:200,when:C.and(CCi,C.or(Nc?.negate(),ETt)),primary:2064,handler:()=>{cW.getActive()?.focusPreviousWidget()}});xt.registerCommandAndKeybindingRule({id:"widgetNavigation.focusNext",weight:200,when:C.and(CCi,C.or(Nc?.negate(),TTt)),primary:2066,handler:()=>{cW.getActive()?.focusNextWidget()}});var jx=new Y("accessibilityHelpIsShown",!1,!0),Jd=new Y("accessibleViewIsShown",!1,!0),Hme=new Y("accessibleViewSupportsNavigation",!1,!0),NZe=new Y("accessibleViewVerbosityEnabled",!1,!0),OZe=new Y("accessibleViewGoToSymbolSupported",!1,!0),GFt=new Y("accessibleViewOnLastLine",!1,!0),Fu=new Y("accessibleViewCurrentProviderId",void 0,void 0),fLe=new Y("accessibleViewInCodeBlock",void 0,void 0),Ume=new Y("accessibleViewContainsCodeBlocks",void 0,void 0),FZe=new Y("accessibleViewHasUnassignedKeybindings",void 0,void 0),WZe=new Y("accessibleViewHasAssignedKeybindings",void 0,void 0);var hw={type:"boolean",default:!0,tags:["accessibility"]},qFt=Object.freeze({id:"accessibility",title:d(5844,null),type:"object"}),Vm={type:"string",enum:["auto","on","off"],default:"auto",enumDescriptions:[d(5851,null),d(5854,null),d(5853,null)],tags:["accessibility"]},oS={type:"object",tags:["accessibility"],additionalProperties:!1,default:{sound:"auto",announcement:"auto"}},nS={type:"string",enum:["auto","off"],default:"auto",enumDescriptions:[d(5845,null),d(5846,null)],tags:["accessibility"]},wG={type:"object",tags:["accessibility"],additionalProperties:!1,default:{sound:"auto"}},pZo={...qFt,scope:5,properties:{"accessibility.verbosity.terminal":{description:d(5874,null),...hw},"accessibility.verbosity.diffEditor":{description:d(5861,null),...hw},"accessibility.verbosity.panelChat":{description:d(5857,null),...hw},"accessibility.verbosity.inlineChat":{description:d(5867,null),...hw},"accessibility.verbosity.terminalChatOutput":{description:d(5875,null),...hw},"accessibility.verbosity.inlineCompletions":{description:d(5866,null),...hw},"accessibility.verbosity.keybindingsEditor":{description:d(5868,null),...hw},"accessibility.verbosity.notebook":{description:d(5869,null),...hw},"accessibility.verbosity.hover":{description:d(5865,null),...hw},"accessibility.verbosity.notification":{description:d(5870,null),...hw},"accessibility.verbosity.emptyEditorHint":{description:d(5863,null),...hw},"accessibility.verbosity.replEditor":{description:d(5871,null),...hw},"accessibility.verbosity.comments":{description:d(5859,null),...hw},"accessibility.verbosity.diffEditorActive":{description:d(5862,null),...hw},"accessibility.verbosity.debug":{description:d(5860,null),...hw},"accessibility.verbosity.walkthrough":{description:d(5876,null),...hw},"accessibility.accessibleView.closeOnKeyPress":{markdownDescription:d(5856,null),type:"boolean",default:!0},"accessibility.verbosity.sourceControl":{description:d(5872,null),...hw},"accessibility.verbosity.find":{description:d(5864,null),...hw},"accessibility.verbosity.sessionsChat":{description:d(5873,null),...hw},"accessibility.verbosity.chatQuestionCarousel":{description:d(5858,null),...hw},"accessibility.signalOptions.volume":{description:d(5731,null),type:"number",minimum:0,maximum:100,default:70,tags:["accessibility"]},"accessibility.signalOptions.debouncePositionChanges":{description:d(5724,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.general":{type:"object",description:"Delays for all signals besides error and warning at position",additionalProperties:!1,properties:{announcement:{description:d(5727,null),type:"number",minimum:0,default:3e3},sound:{description:d(5728,null),type:"number",minimum:0,default:400}},tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.warningAtPosition":{type:"object",additionalProperties:!1,properties:{announcement:{description:d(5729,null),type:"number",minimum:0,default:3e3},sound:{description:d(5730,null),type:"number",minimum:0,default:1e3}},tags:["accessibility"]},"accessibility.signalOptions.experimental.delays.errorAtPosition":{type:"object",additionalProperties:!1,properties:{announcement:{description:d(5725,null),type:"number",minimum:0,default:3e3},sound:{description:d(5726,null),type:"number",minimum:0,default:1e3}},tags:["accessibility"]},"accessibility.signals.lineHasBreakpoint":{...oS,description:d(5769,null),properties:{sound:{description:d(5771,null),...Vm},announcement:{description:d(5770,null),...nS}}},"accessibility.signals.lineHasInlineSuggestion":{...wG,description:d(5778,null),properties:{sound:{description:d(5779,null),...Vm,default:"off"}}},"accessibility.signals.nextEditSuggestion":{...oS,description:d(5783,null),properties:{sound:{description:d(5785,null),...Vm},announcement:{description:d(5784,null),...nS}}},"accessibility.signals.lineHasError":{...oS,description:d(5772,null),properties:{sound:{description:d(5774,null),...Vm},announcement:{description:d(5773,null),...nS,default:"off"}}},"accessibility.signals.lineHasFoldedArea":{...oS,description:d(5775,null),properties:{sound:{description:d(5777,null),...Vm,default:"off"},announcement:{description:d(5776,null),...nS}}},"accessibility.signals.lineHasWarning":{...oS,description:d(5780,null),properties:{sound:{description:d(5782,null),...Vm},announcement:{description:d(5781,null),...nS,default:"off"}}},"accessibility.signals.positionHasError":{...oS,description:d(5798,null),properties:{sound:{description:d(5800,null),...Vm},announcement:{description:d(5799,null),...nS,default:"on"}}},"accessibility.signals.positionHasWarning":{...oS,description:d(5801,null),properties:{sound:{description:d(5803,null),...Vm},announcement:{description:d(5802,null),...nS,default:"on"}}},"accessibility.signals.onDebugBreak":{...oS,description:d(5795,null),properties:{sound:{description:d(5797,null),...Vm},announcement:{description:d(5796,null),...nS}}},"accessibility.signals.noInlayHints":{...oS,description:d(5786,null),properties:{sound:{description:d(5788,null),...Vm},announcement:{description:d(5787,null),...nS}}},"accessibility.signals.taskCompleted":{...oS,description:d(5817,null),properties:{sound:{description:d(5819,null),...Vm},announcement:{description:d(5818,null),...nS}}},"accessibility.signals.taskFailed":{...oS,description:d(5820,null),properties:{sound:{description:d(5822,null),...Vm},announcement:{description:d(5821,null),...nS}}},"accessibility.signals.terminalCommandFailed":{...oS,description:d(5826,null),properties:{sound:{description:d(5828,null),...Vm},announcement:{description:d(5827,null),...nS}}},"accessibility.signals.terminalCommandSucceeded":{...oS,description:d(5829,null),properties:{sound:{description:d(5831,null),...Vm},announcement:{description:d(5830,null),...nS}}},"accessibility.signals.terminalQuickFix":{...oS,description:d(5832,null),properties:{sound:{description:d(5834,null),...Vm},announcement:{description:d(5833,null),...nS}}},"accessibility.signals.terminalBell":{...oS,description:d(5823,null),properties:{sound:{description:d(5825,null),...Vm},announcement:{description:d(5824,null),...nS}}},"accessibility.signals.diffLineInserted":{...wG,description:d(5751,null),properties:{sound:{description:d(5816,null),...Vm}}},"accessibility.signals.diffLineModified":{...wG,description:d(5752,null),properties:{sound:{description:d(5753,null),...Vm}}},"accessibility.signals.diffLineDeleted":{...wG,description:d(5749,null),properties:{sound:{description:d(5750,null),...Vm}}},"accessibility.signals.chatEditModifiedFile":{...wG,description:d(5732,null),properties:{sound:{description:d(5733,null),...Vm}}},"accessibility.signals.notebookCellCompleted":{...oS,description:d(5789,null),properties:{sound:{description:d(5791,null),...Vm},announcement:{description:d(5790,null),...nS}}},"accessibility.signals.notebookCellFailed":{...oS,description:d(5792,null),properties:{sound:{description:d(5794,null),...Vm},announcement:{description:d(5793,null),...nS}}},"accessibility.signals.progress":{...oS,description:d(5804,null),default:{sound:"auto",announcement:"off"},properties:{sound:{description:d(5806,null),...Vm},announcement:{description:d(5805,null),...nS}}},"accessibility.signals.chatRequestSent":{...oS,description:d(5734,null),properties:{sound:{description:d(5736,null),...Vm},announcement:{description:d(5735,null),...nS}}},"accessibility.signals.chatResponseReceived":{...wG,description:d(5737,null),properties:{sound:{description:d(5738,null),...Vm}}},"accessibility.signals.codeActionTriggered":{...wG,description:d(5747,null),properties:{sound:{description:d(5748,null),...Vm}}},"accessibility.signals.codeActionApplied":{...wG,description:d(5745,null),properties:{sound:{description:d(5746,null),...Vm}}},"accessibility.signals.voiceRecordingStarted":{...wG,description:d(5835,null),properties:{sound:{description:d(5836,null),...Vm}},default:{sound:"on"}},"accessibility.signals.voiceRecordingStopped":{...wG,description:d(5837,null),properties:{sound:{description:d(5838,null),...Vm,default:"off"}}},"accessibility.signals.clear":{...oS,description:d(5742,null),properties:{sound:{description:d(5744,null),...Vm},announcement:{description:d(5743,null),...nS}}},"accessibility.signals.editsUndone":{...oS,description:d(5757,null),properties:{sound:{description:d(5759,null),...Vm},announcement:{description:d(5758,null),...nS}}},"accessibility.signals.editsKept":{...oS,description:d(5754,null),properties:{sound:{description:d(5756,null),...Vm},announcement:{description:d(5755,null),...nS}}},"accessibility.signals.save":{type:"object",tags:["accessibility"],additionalProperties:!1,markdownDescription:d(5807,null),properties:{sound:{description:d(5812,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(5815,null),d(5813,null),d(5814,null)]},announcement:{description:d(5808,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(5811,null),d(5809,null),d(5810,null)]}},default:{sound:"never",announcement:"never"}},"accessibility.signals.format":{type:"object",tags:["accessibility"],additionalProperties:!1,markdownDescription:d(5760,null),properties:{sound:{description:d(5767,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(5768,null),d(5761,null),d(5766,null)]},announcement:{description:d(5762,null),type:"string",enum:["userGesture","always","never"],default:"never",enumDescriptions:[d(5765,null),d(5763,null),d(5764,null)]}},default:{sound:"never",announcement:"never"}},"accessibility.signals.chatUserActionRequired":{...oS,markdownDescription:d(5739,null),properties:{sound:{description:d(5741,null),type:"string",enum:["auto","on","off"],enumDescriptions:[d(5852,null),d(5854,null),d(5853,null)]},announcement:{description:d(5740,null),...nS}},default:{sound:"auto",announcement:"auto"},tags:["accessibility"]},"accessibility.underlineLinks":{type:"boolean",description:d(5839,null),default:!1},"accessibility.debugWatchVariableAnnouncements":{type:"boolean",description:d(5720,null),default:!0},"accessibility.replEditor.readLastExecutionOutput":{type:"boolean",description:d(5723,null),default:!0},"accessibility.replEditor.autoFocusReplExecution":{type:"string",enum:["none","input","lastExecution"],default:"input",description:d(5850,null)},"accessibility.windowTitleOptimized":{type:"boolean",default:!0,markdownDescription:d(5843,null,"`#window.title#`","`activeEditorState`")},"accessibility.openChatEditedFiles":{type:"boolean",default:!1,markdownDescription:d(5722,null)},"accessibility.verboseChatProgressUpdates":{type:"boolean",default:!0,markdownDescription:d(5840,null)}}};function zpo(){let a=oe.as($t.Configuration);a.registerConfiguration(pZo),a.registerConfiguration({...jd,properties:{"accessibility.dimUnfocused.enabled":{description:d(5848,null),type:"boolean",default:!1,tags:["accessibility"],scope:1},"accessibility.dimUnfocused.opacity":{markdownDescription:d(5849,null,"`#accessibility.dimUnfocused.enabled#`"),type:"number",minimum:.2,maximum:1,default:.75,tags:["accessibility"],scope:1},"accessibility.hideAccessibleView":{description:d(5721,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.verboseChatProgressUpdates":{type:"boolean",default:!0,markdownDescription:d(5840,null)},"accessibility.chat.showCheckmarks":{type:"boolean",default:!1,tags:["accessibility"],markdownDescription:d(5719,null)}}})}var VZe=0,Bme=class extends k{constructor(e){super();this.speechService=e;this._register(U.runAndSubscribe(e.onDidChangeHasSpeechProvider,()=>this.updateConfiguration()))}static{this.ID="workbench.contrib.dynamicSpeechAccessibilityConfiguration"}updateConfiguration(){if(!this.speechService.hasSpeechProvider)return;let e=this.getLanguages(),t=Object.keys(e).sort((n,r)=>e[n].name.localeCompare(e[r].name));oe.as($t.Configuration).registerConfiguration({...qFt,properties:{"accessibility.voice.speechTimeout":{markdownDescription:d(5879,null),type:"number",default:VZe,minimum:0,tags:["accessibility"]},"accessibility.voice.ignoreCodeBlocks":{markdownDescription:d(5877,null),type:"boolean",default:!1,tags:["accessibility"]},"accessibility.voice.speechLanguage":{markdownDescription:d(5878,null),type:"string",enum:t,default:"auto",tags:["accessibility"],enumDescriptions:t.map(n=>e[n].name),enumItemLabels:t.map(n=>e[n].name)},"accessibility.voice.autoSynthesize":{type:"string",enum:["on","off"],enumDescriptions:[d(5842,null),d(5841,null)],markdownDescription:d(5847,null),default:"off",tags:["accessibility"]}}})}getLanguages(){return{auto:{name:d(5855,null)},...bwi}}};Bme=I([m(0,Gx)],Bme);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"audioCues.volume",migrateFn:(a,i)=>[["accessibility.signalOptions.volume",{value:a}],["audioCues.volume",{value:void 0}]]}]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"audioCues.debouncePositionChanges",migrateFn:a=>[["accessibility.signalOptions.debouncePositionChanges",{value:a}],["audioCues.debouncePositionChanges",{value:void 0}]]}]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signalOptions",migrateFn:(a,i)=>{let e=xCi(i,"general"),t=xCi(i,"errorAtPosition"),o=xCi(i,"warningAtPosition"),n=mZo(i),r=hZo(i),s=[];return n&&s.push(["accessibility.signalOptions.volume",{value:n}]),e&&s.push(["accessibility.signalOptions.experimental.delays.general",{value:e}]),t&&s.push(["accessibility.signalOptions.experimental.delays.errorAtPosition",{value:t}]),o&&s.push(["accessibility.signalOptions.experimental.delays.warningAtPosition",{value:o}]),r&&s.push(["accessibility.signalOptions.debouncePositionChanges",{value:r}]),s.push(["accessibility.signalOptions",{value:void 0}]),s}}]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.sounds.volume",migrateFn:a=>[["accessibility.signalOptions.volume",{value:a}],["accessibility.signals.sounds.volume",{value:void 0}]]}]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.debouncePositionChanges",migrateFn:a=>[["accessibility.signalOptions.debouncePositionChanges",{value:a}],["accessibility.signals.debouncePositionChanges",{value:void 0}]]}]);function xCi(a,i){return a(`accessibility.signalOptions.experimental.delays.${i}`)||a("accessibility.signalOptions")?.["experimental.delays"]?.[`${i}`]||a("accessibility.signalOptions")?.delays?.[`${i}`]}function mZo(a){return a("accessibility.signalOptions.volume")||a("accessibility.signalOptions")?.volume||a("accessibility.signals.sounds.volume")||a("audioCues.volume")}function hZo(a){return a("accessibility.signalOptions.debouncePositionChanges")||a("accessibility.signalOptions")?.debouncePositionChanges||a("accessibility.signals.debouncePositionChanges")||a("audioCues.debouncePositionChanges")}oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.voice.autoSynthesize",migrateFn:a=>{let i;if(a===!0)i="on";else if(a===!1)i="off";else return[];return[["accessibility.voice.autoSynthesize",{value:i}]]}}]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"accessibility.signals.chatResponsePending",migrateFn:(a,i)=>[["accessibility.signals.progress",{value:a}],["accessibility.signals.chatResponsePending",{value:void 0}]]}]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations(tn.allAccessibilitySignals.map(a=>a.legacySoundSettingsKey?{key:a.legacySoundSettingsKey,migrateFn:(i,e)=>{let t=[],o=a.legacyAnnouncementSettingsKey,n;return o&&(n=e(o)??void 0,n!==void 0&&typeof n!="string"&&(n=n?"auto":"off")),t.push([`${a.legacySoundSettingsKey}`,{value:void 0}]),t.push([`${a.settingsKey}`,{value:n!==void 0?{announcement:n,sound:i}:{sound:i}}]),t}}:void 0).filter(so));oe.as(fm.ConfigurationMigration).registerConfigurationMigrations(tn.allAccessibilitySignals.filter(a=>!!a.legacyAnnouncementSettingsKey&&!!a.legacySoundSettingsKey).map(a=>({key:a.legacyAnnouncementSettingsKey,migrateFn:(i,e)=>{let t=[],o=e(a.settingsKey)?.sound||e(a.legacySoundSettingsKey);return i!==void 0&&typeof i!="string"&&(i=i?"auto":"off"),t.push([`${a.settingsKey}`,{value:i!==void 0?{announcement:i,sound:o}:{sound:o}}]),t.push([`${a.legacyAnnouncementSettingsKey}`,{value:void 0}]),t.push([`${a.legacySoundSettingsKey}`,{value:void 0}]),t}})));var Qee=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.container=e;this._parentEditor=t;this._owner=o;this._parentResourceUri=n;this._contextKeyService=r;this._scopedInstantiationService=s;this._commentThread=l;this._pendingComment=c;this._pendingEdits=u;this._markdownOptions=p;this._commentOptions=h;this._containerDelegate=g;this.commentService=f;this.configurationService=v;this._keybindingService=b;this._commentThreadDisposables=[];this._onDidResize=this._register(new T);this.onDidResize=this._onDidResize.event;this._threadIsEmpty=jc.commentThreadIsEmpty.bindTo(this._contextKeyService),this._threadIsEmpty.set(!l.comments||!l.comments.length),this._focusedContextKey=jc.commentFocused.bindTo(this._contextKeyService),this._commentMenus=this.commentService.getCommentMenus(this._owner),this._register(this._header=this._scopedInstantiationService.createInstance(hLe,e,{collapse:this._containerDelegate.collapse.bind(this)},this._commentMenus,this._commentThread)),this._header.updateCommentThread(this._commentThread);let S=_(".body");e.appendChild(S),this._register(ee(()=>S.remove()));let y=this._register(nr(S));this._register(p_({name:"commentThreadWidget",focusNotifiers:[y],focusNextWidget:()=>{this._commentReply?.isCommentEditorFocused()||this._commentReply?.expandReplyAreaAndFocusCommentEditor()},focusPreviousWidget:()=>{this._commentReply?.isCommentEditorFocused()&&this._commentThread.comments?.length&&this._body.focus()}})),this._register(y.onDidFocus(()=>this._focusedContextKey.set(!0))),this._register(y.onDidBlur(()=>this._focusedContextKey.reset())),this._register(this.configurationService.onDidChangeConfiguration(E=>{E.affectsConfiguration("accessibility.verbosity.comments")&&this._setAriaLabel()})),this._body=this._scopedInstantiationService.createInstance(mLe,this._parentEditor,this._owner,this._parentResourceUri,S,this._markdownOptions,this._commentThread,this._pendingEdits,this._scopedInstantiationService,this),this._register(this._body),this._setAriaLabel(),this._commentThreadContextValue=jc.commentThreadContext.bindTo(this._contextKeyService),this._commentThreadContextValue.set(l.contextValue);let w=jc.commentControllerContext.bindTo(this._contextKeyService),x=this.commentService.getCommentController(this._owner);x?.contextValue&&w.set(x.contextValue),this.currentThreadListeners()}get commentThread(){return this._commentThread}get hasUnsubmittedComments(){return!!this._commentReply?.commentEditor.getValue()||this._body.hasCommentsInEditMode()}_setAriaLabel(){let e=d(10348,null),t,o=this.configurationService.getValue("accessibility.verbosity.comments");o&&(t=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp",this._contextKeyService)?.getLabel()??void 0),t?e=d(10349,null,e,t):o&&(e=d(10350,null,e)),this._body.container.ariaLabel=e}updateCurrentThread(e,t){e||t?this.commentService.setCurrentCommentThread(this.commentThread):this.commentService.setCurrentCommentThread(void 0)}currentThreadListeners(){let e=!1,t=!1;this._register($(this.container,ne.MOUSE_ENTER,o=>{o.relatedTarget===this.container&&(e=!0,this.updateCurrentThread(e,t))},!0)),this._register($(this.container,ne.MOUSE_LEAVE,o=>{o.relatedTarget===this.container&&(e=!1,this.updateCurrentThread(e,t))},!0)),this._register($(this.container,ne.FOCUS_IN,()=>{t=!0,this.updateCurrentThread(e,t)},!0)),this._register($(this.container,ne.FOCUS_OUT,()=>{t=!1,this.updateCurrentThread(e,t)},!0))}async updateCommentThread(e){let t=this._commentThread.collapsibleState===1&&this._commentThreadState===0&&e.state===1;this._commentThreadState=e.state,this._commentThread=e,je(this._commentThreadDisposables),this._commentThreadDisposables=[],this._bindCommentThreadListeners(),await this._body.updateCommentThread(e,this._commentReply?.isCommentEditorFocused()??!1),this._threadIsEmpty.set(!this._body.length),this._header.updateCommentThread(e),this._commentReply?.updateCommentThread(e),this._commentThread.contextValue?this._commentThreadContextValue.set(this._commentThread.contextValue):this._commentThreadContextValue.reset(),t&&this.configurationService.getValue(fG).collapseOnResolve&&this.collapse()}async display(e,t){let o=Math.max(23,Math.ceil(e*1.2));this._header.updateHeight(o),await this._body.display(),this._commentThread.canReply&&this._createCommentForm(t),this._createAdditionalActions(),this._register(this._body.onDidResize(n=>{this._refresh(n)})),this._commentThread.canReply&&this._commentReply&&this._commentReply.focusIfNeeded(),this._bindCommentThreadListeners()}_refresh(e){this._body.layout(),this._onDidResize.fire(e)}dispose(){super.dispose(),je(this._commentThreadDisposables),this.updateCurrentThread(!1,!1)}_bindCommentThreadListeners(){this._commentThreadDisposables.push(this._commentThread.onDidChangeCanReply(()=>{this._commentReply?this._commentReply.updateCanReply():this._commentThread.canReply&&this._createCommentForm(!1)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeComments(async e=>{await this.updateCommentThread(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeLabel(e=>{this._header.createThreadLabel()}))}_createCommentForm(e){this._commentReply=this._scopedInstantiationService.createInstance(uLe,this._owner,this._body.container,this._parentEditor,this._commentThread,this._scopedInstantiationService,this._contextKeyService,this._commentMenus,this._commentOptions,this._pendingComment,this,e,this._containerDelegate.actionRunner),this._register(this._commentReply)}_createAdditionalActions(){this._additionalActions=this._scopedInstantiationService.createInstance(gLe,this._body.container,this._commentThread,this._contextKeyService,this._commentMenus,this._containerDelegate.actionRunner),this._register(this._additionalActions)}getCommentCoords(e){return this._body.getCommentCoords(e)}getPendingEdits(){return this._body.getPendingEdits()}getPendingComment(){if(this._commentReply)return this._commentReply.getPendingComment()}setPendingComment(e){this._pendingComment=e,this._commentReply?.setPendingComment(e)}getDimensions(){return this._body.getDimensions()}layout(e){this._body.layout(e),e!==void 0&&this._commentReply?.layout(e)}ensureFocusIntoNewEditingComment(){this._body.ensureFocusIntoNewEditingComment()}focusCommentEditor(){this._commentReply?.expandReplyAreaAndFocusCommentEditor()}focus(e){this._body.focus(e)}async submitComment(){let e=this._body.activeComment;if(e)return e.submitComment();if((this._commentReply?.getPendingComment()?.body.length??0)>0)return this._commentReply?.submitComment()}async collapse(){await this._containerDelegate.collapse()&&G.isIRange(this.commentThread.range)&&fn(this._parentEditor)&&this._parentEditor.setSelection(this.commentThread.range)}applyTheme(e){let t="--comment-thread-editor-font-family",o="--comment-thread-editor-font-weight";this.container?.style.setProperty(t,e.fontFamily),this.container?.style.setProperty(o,e.fontWeight),this._commentReply?.setCommentEditorDecorations()}};Qee=I([m(12,Wm),m(13,B),m(14,Le)],Qee);function Kpo(a,i){return fpo(a,i)??i.getColor(AD)}function Gpo(a){let i=a.comments;return i?i.some(e=>e.state===1):!1}function qpo(a){let i=a.target.range;if(!i||!a.event.leftButton||a.target.type!==4)return null;let e=a.target.detail;return e.offsetX-e.glyphMarginWidth-e.lineNumbersWidth-e.glyphMarginLeft>20?null:{lineNumber:i.startLineNumber}}function $po(a,i){if(!a)return null;let{lineNumber:e}=a;return i.target.range?e:null}var vLe=class extends o0{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{keepEditorSelection:!0,isAccessible:!0,showArrow:!!o.range});this._uniqueOwner=t;this._commentThread=o;this._pendingComment=n;this._pendingEdits=r;this.themeService=l;this.commentService=c;this.configurationService=p;this.dialogService=h;this._onDidClose=new T;this._onDidCreateThread=new T;this._onDidChangeExpandedState=new T;this._globalToDispose=new O;this._commentThreadDisposables=[];this._contextKeyService=this._globalToDispose.add(u.createScoped(this.domNode)),this._scopedInstantiationService=this._globalToDispose.add(s.createChild(new Po([X,this._contextKeyService])));let g=this.commentService.getCommentController(this._uniqueOwner);g&&(this._commentOptions=g.options),this._initialCollapsibleState=n?1:o.initialCollapsibleState,o.initialCollapsibleState=this._initialCollapsibleState,this._commentThreadDisposables=[],this.create(),this._globalToDispose.add(this.themeService.onDidColorThemeChange(this._applyTheme,this)),this._globalToDispose.add(this.editor.onDidChangeConfiguration(f=>{f.hasChanged(59)&&this._applyTheme()})),this._applyTheme()}get uniqueOwner(){return this._uniqueOwner}get commentThread(){return this._commentThread}get expanded(){return this._isExpanded}get onDidClose(){return this._onDidClose.event}get onDidCreateThread(){return this._onDidCreateThread.event}get onDidChangeExpandedState(){return this._onDidChangeExpandedState.event}getPosition(){if(this.position)return this.position;if(this._commentGlyph)return this._commentGlyph.getPosition().position??void 0}revealRange(){}reveal(e,t=0){this.makeVisible(e,t);let o=this._commentThread.comments?.find(n=>n.uniqueIdInThread===e)??this._commentThread.comments?.[0];this.commentService.setActiveCommentAndThread(this.uniqueOwner,{thread:this._commentThread,comment:o})}_expandAndShowZoneWidget(){this._isExpanded||this.show(this.arrowPosition(this._commentThread.range),2)}_setFocus(e,t){t===1?this._commentThreadWidget.focus(e):t===2&&this._commentThreadWidget.focusCommentEditor()}_goToComment(e,t){let o=this.editor.getLayoutInfo().height,n=this._commentThreadWidget.getCommentCoords(e);if(n){let r=1;if(this._commentThread.range){let s=n.thread,l=n.comment;r=this.editor.getTopForLineNumber(this._commentThread.range.startLineNumber)-o/2+l.top-s.top}this.editor.setScrollTop(r),this._setFocus(e,t)}else this._goToThread(t)}_goToThread(e){let t=this._commentThread.range?new G(this._commentThread.range.startLineNumber,this._commentThread.range.startColumn,this._commentThread.range.endLineNumber+1,1):new G(1,1,1,1);this.editor.revealRangeInCenter(t),this._setFocus(void 0,e)}makeVisible(e,t=0){this._expandAndShowZoneWidget(),e!==void 0?this._goToComment(e,t):this._goToThread(t)}getPendingComments(){return{newComment:this._commentThreadWidget.getPendingComment(),edits:this._commentThreadWidget.getPendingEdits()}}setPendingComment(e){this._pendingComment=e,this.expand(),this._commentThreadWidget.setPendingComment(e)}_fillContainer(e){this.setCssClass("review-widget"),this._commentThreadWidget=this._scopedInstantiationService.createInstance(Qee,e,this.editor,this._uniqueOwner,this.editor.getModel().uri,this._contextKeyService,this._scopedInstantiationService,this._commentThread,this._pendingComment,this._pendingEdits,{context:this.editor},this._commentOptions,{actionRunner:async()=>{if(!this._commentThread.comments||!this._commentThread.comments.length){let t=this.getPosition();if(t){let o=this._commentThread.range;if(!o)return;let n;if(t.lineNumber!==o.endLineNumber){let r=t.lineNumber-o.endLineNumber;n=new G(o.startLineNumber+r,o.startColumn,o.endLineNumber+r,o.endColumn)}else n=new G(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn);await this.commentService.updateCommentThreadTemplate(this.uniqueOwner,this._commentThread.commentThreadHandle,n)}}},collapse:()=>this.collapse(!0)}),this._disposables.add(this._commentThreadWidget)}arrowPosition(e){if(e)return{lineNumber:e.endLineNumber,column:e.endLineNumber===e.startLineNumber?(e.startColumn+e.endColumn+1)/2:1}}deleteCommentThread(){this.dispose(),this.commentService.disposeCommentThread(this.uniqueOwner,this._commentThread.threadId)}doCollapse(){this._commentThread.collapsibleState=0}async collapse(e=!1){return!e||await this.confirmCollapse()?(this.doCollapse(),!0):!1}async confirmCollapse(){if(this.configurationService.getValue("comments.thread.confirmOnCollapse")==="whenHasUnsubmittedComments"&&this._commentThreadWidget.hasUnsubmittedComments){let t=await this.dialogService.confirm({message:d(10351,null),primaryButton:d(10352,null),type:wt.Warning,checkbox:{label:d(10353,null),checked:!1}});return t.checkboxChecked&&await this.configurationService.updateValue("comments.thread.confirmOnCollapse","never"),t.confirmed}return!0}expand(e){this._commentThread.collapsibleState=1,e&&this.commentService.setActiveCommentAndThread(this.uniqueOwner,{thread:this._commentThread})}getGlyphPosition(){return this._commentGlyph?this._commentGlyph.getPosition().position.lineNumber:0}async update(e){this._commentThread!==e&&(this._commentThreadDisposables.forEach(n=>n.dispose()),this._commentThread=e,this._commentThreadDisposables=[],this.bindCommentThreadListeners()),await this._commentThreadWidget.updateCommentThread(e);let t=this._commentThread.range?.endLineNumber??1,o=!1;if(this._commentGlyph){let n=Gpo(e);this._commentGlyph.setThreadState(e.state,n),this._commentGlyph.getPosition().position.lineNumber!==t&&(o=!0,this._commentGlyph.setLineNumber(t))}o&&this._isExpanded||this._commentThread.collapsibleState===1&&!this._isExpanded?this.show(this.arrowPosition(this._commentThread.range),2):this._commentThread.collapsibleState!==1&&this.hide()}_onWidth(e){this._commentThreadWidget.layout(e)}_doLayout(e,t){this._commentThreadWidget.layout(t)}async display(e,t){if(e){this._commentGlyph=new Fme(this.editor,e?.endLineNumber??-1);let o=Gpo(this._commentThread);this._commentGlyph.setThreadState(this._commentThread.state,o),this._globalToDispose.add(this._commentGlyph.onDidChangeLineNumber(async n=>{if(!this._commentThread.range)return;let r=n-this._commentThread.range.endLineNumber,s=new G(this._commentThread.range.startLineNumber+r,this._commentThread.range.startColumn,this._commentThread.range.endLineNumber+r,this._commentThread.range.endColumn);this._commentThread.range=s}))}await this._commentThreadWidget.display(this.editor.getOption(75),t),this._disposables.add(this._commentThreadWidget.onDidResize(o=>{this._refresh(o)})),this._commentThread.collapsibleState===1&&this.show(this.arrowPosition(e),2),t&&this.makeVisible(),this.bindCommentThreadListeners()}bindCommentThreadListeners(){if(this._commentThreadDisposables.push(this._commentThread.onDidChangeComments(async e=>{await this.update(this._commentThread)})),this._commentThreadDisposables.push(this._commentThread.onDidChangeCollapsibleState(e=>{if(e===1&&!this._isExpanded){this.show(this.arrowPosition(this._commentThread.range),2),this._commentThreadWidget.ensureFocusIntoNewEditingComment();return}if(e===0&&this._isExpanded){this.hide();return}})),this._initialCollapsibleState===void 0){let e=this._commentThread.onDidChangeInitialCollapsibleState(t=>{this._initialCollapsibleState=t,this._commentThread.collapsibleState=this._initialCollapsibleState,e.dispose()});this._commentThreadDisposables.push(e)}this._commentThreadDisposables.push(this._commentThread.onDidChangeState(()=>{let e=Kpo(this._commentThread.state,this.themeService.getColorTheme())||Ue.transparent;this.style({frameColor:e,arrowColor:e}),this.container?.style.setProperty(mpo,`${e}`),this.container?.style.setProperty(hpo,`${e.transparent(.1)}`)}))}async submitComment(){return this._commentThreadWidget.submitComment()}_refresh(e){if(this._isExpanded===void 0&&e.height===0&&e.width===0){this.commentThread.collapsibleState=0;return}if(this._isExpanded){this._commentThreadWidget.layout();let t=Math.ceil(this.editor.getOption(75)*1.2),o=this.editor.getOption(75),n=Math.round(o/3),r=Math.round(o/9)*2,s=Math.ceil((t+e.height+n+r+8)/o);if(this._viewZone?.heightInLines===s)return;let l=this.getPosition();this._viewZone&&l&&l.lineNumber!==this._viewZone.afterLineNumber&&this._viewZone.afterLineNumber!==0&&(this._viewZone.afterLineNumber=l.lineNumber);let c=Sx.capture(this.editor);this._relayout(s),c.restore(this.editor)}}_applyTheme(){let e=Kpo(this._commentThread.state,this.themeService.getColorTheme())||Ue.transparent;this.style({arrowColor:e,frameColor:e});let t=this.editor.getOption(59);this._commentThreadWidget.applyTheme(t)}show(e,t){let o=this._commentGlyph?.getPosition(),n=G.isIRange(e)?e:e?G.fromPositions(e):void 0;if(o?.position&&n&&o.position.lineNumber!==n.endLineNumber){let s=o.position.lineNumber-n.endLineNumber;n=new G(n.startLineNumber+s,n.startColumn,n.endLineNumber+s,n.endColumn)}let r=this._isExpanded;this._isExpanded=!0,super.show(n??new G(0,0,0,0),t),this._commentThread.collapsibleState=1,this._refresh(this._commentThreadWidget.getDimensions()),r||this._onDidChangeExpandedState.fire(!0)}async collapseAndFocusRange(){await this.collapse(!0)&&G.isIRange(this.commentThread.range)&&fn(this.editor)&&this.editor.setSelection(this.commentThread.range)}hide(){this._isExpanded&&(this._isExpanded=!1,this.editor.hasWidgetFocus()&&this.editor.focus(),(!this._commentThread.comments||!this._commentThread.comments.length)&&this.deleteCommentThread(),this._onDidChangeExpandedState.fire(!1)),super.hide()}dispose(){super.dispose(),this._commentGlyph&&(this._commentGlyph.dispose(),this._commentGlyph=void 0),this._globalToDispose.dispose(),this._commentThreadDisposables.forEach(e=>e.dispose()),this._onDidClose.fire(void 0),this._onDidClose.dispose(),this._onDidCreateThread.dispose(),this._onDidChangeExpandedState.dispose()}};vLe=I([m(5,F),m(6,Pe),m(7,Wm),m(8,X),m(9,B),m(10,ct)],vLe);var jFt=class{constructor(i,e){this.range=i;this.options=e}get id(){return this._decorationId}set id(i){this._decorationId=i}},QFt=class a extends k{constructor(e){super();this.decorationIds=[];this.activeDecorationIds=[];this.threadCollapseStateListeners=[];let t={description:a.description,isWholeLine:!1,zIndex:20,className:"comment-thread-range",shouldFillLineOnLineBreak:!0};this.decorationOptions=So.createDynamic(t);let o={description:a.description,isWholeLine:!1,zIndex:20,className:"comment-thread-range-current",shouldFillLineOnLineBreak:!0};this.activeDecorationOptions=So.createDynamic(o),this._register(e.onDidChangeCurrentCommentThread(n=>{this.updateCurrent(n)})),this._register(e.onDidUpdateCommentThreads(()=>{this.updateCurrent(void 0)}))}static{this.description="comment-thread-range-decorator"}updateCurrent(e){if(!this.editor||e?.resource&&e.resource?.toString()!==this.editor.getModel()?.uri.toString())return;this.currentThreadCollapseStateListener?.dispose();let t=[];if(e){let o=e.range;o&&!(o.startLineNumber===o.endLineNumber&&o.startColumn===o.endColumn)&&e.collapsibleState===1&&(this.currentThreadCollapseStateListener=e.onDidChangeCollapsibleState(n=>{n===0&&this.updateCurrent(void 0)}),t.push(new jFt(o,this.activeDecorationOptions)))}this.editor.changeDecorations(o=>{this.activeDecorationIds=o.deltaDecorations(this.activeDecorationIds,t),t.forEach((n,r)=>n.id=this.decorationIds[r])})}update(e,t){let o=e?.getModel();if(!e||!o)return;je(this.threadCollapseStateListeners),this.editor=e;let n=[];for(let r of t)r.threads.forEach(s=>{if(s.isDisposed)return;let l=s.range;!l||l.startLineNumber===l.endLineNumber&&l.startColumn===l.endColumn||(this.threadCollapseStateListeners.push(s.onDidChangeCollapsibleState(()=>{this.update(e,t)})),s.collapsibleState!==0&&n.push(new jFt(l,this.decorationOptions)))});e.changeDecorations(r=>{this.decorationIds=r.deltaDecorations(this.decorationIds,n),n.forEach((s,l)=>s.id=this.decorationIds[l])})}dispose(){je(this.threadCollapseStateListeners),this.currentThreadCollapseStateListener?.dispose(),super.dispose()}};var ECi="editor.contrib.review",CG=class{constructor(i,e,t,o,n,r,s,l=!1){this._editor=i;this._ownerId=e;this._extensionId=t;this._label=o;this._range=n;this.options=r;this.commentingRangesInfo=s;this.isHover=l;this._startLineNumber=n.startLineNumber,this._endLineNumber=n.endLineNumber}get id(){return this._decorationId}set id(i){this._decorationId=i}get range(){return{startLineNumber:this._startLineNumber,startColumn:1,endLineNumber:this._endLineNumber,endColumn:1}}getCommentAction(){return{extensionId:this._extensionId,label:this._label,ownerId:this._ownerId,commentingRangesInfo:this.commentingRangesInfo}}getOriginalRange(){return this._range}getActiveRange(){return this.id?this._editor.getModel().getDecorationRange(this.id):void 0}},YFt=class a{constructor(){this.commentingRangeDecorations=[];this.decorationIds=[];this._lastHover=-1;this._onDidChangeDecorationsCount=new T;this.onDidChangeDecorationsCount=this._onDidChangeDecorationsCount.event;let i={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph comment-diff-added"};this.decorationOptions=So.createDynamic(i);let e={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph line-hover"};this.hoverDecorationOptions=So.createDynamic(e);let t={description:a.description,isWholeLine:!0,linesDecorationsClassName:"comment-range-glyph multiline-add"};this.multilineDecorationOptions=So.createDynamic(t)}static{this.description="commenting-range-decorator"}updateHover(i){this._editor&&this._infos&&i!==this._lastHover&&this._doUpdate(this._editor,this._infos,i),this._lastHover=i??-1}updateSelection(i,e=new G(0,0,0,0)){this._lastSelection=e.isEmpty()?void 0:e,this._lastSelectionCursor=e.isEmpty()?void 0:i,this._editor&&this._infos&&this._doUpdate(this._editor,this._infos,i,e)}update(i,e,t,o){i&&(this._editor=i,this._infos=e,this._doUpdate(i,e,t,o))}_lineHasThread(i,e){return i.getDecorationsInRange(e)?.find(t=>t.options.description===Fme.description)}_doUpdate(i,e,t=-1,o=this._lastSelection){if(!i.getModel())return;t=this._lastSelectionCursor??t;let r=[];for(let l of e)l.commentingRanges.ranges.forEach(c=>{let u=new G(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn),p=o?u.intersectRanges(o):void 0;if(o&&t>=0&&p&&!(p.startLineNumber===p.endLineNumber&&t===p.startLineNumber)){let h;t<=p.startLineNumber?(h=p.collapseToStart(),p=new G(p.startLineNumber+1,1,p.endLineNumber,1)):(h=new G(p.endLineNumber,1,p.endLineNumber,1),p=new G(p.startLineNumber,1,p.endLineNumber-1,1)),r.push(new CG(i,l.uniqueOwner,l.extensionId,l.label,p,this.multilineDecorationOptions,l.commentingRanges,!0)),this._lineHasThread(i,h)||r.push(new CG(i,l.uniqueOwner,l.extensionId,l.label,h,this.hoverDecorationOptions,l.commentingRanges,!0));let g=Math.min(h.startLineNumber,p.startLineNumber)-1,f=u.startLineNumber<=g,v=Math.max(h.endLineNumber,p.endLineNumber)+1,b=u.endLineNumber>=v;if(f){let S=new G(c.startLineNumber,1,g,1);r.push(new CG(i,l.uniqueOwner,l.extensionId,l.label,S,this.decorationOptions,l.commentingRanges,!0))}if(b){let S=new G(v,1,c.endLineNumber,1);r.push(new CG(i,l.uniqueOwner,l.extensionId,l.label,S,this.decorationOptions,l.commentingRanges,!0))}}else if(u.startLineNumber<=t&&t<=u.endLineNumber){if(u.startLineNumber<t){let g=new G(c.startLineNumber,1,t-1,1);r.push(new CG(i,l.uniqueOwner,l.extensionId,l.label,g,this.decorationOptions,l.commentingRanges,!0))}let h=new G(t,1,t,1);if(this._lineHasThread(i,h)||r.push(new CG(i,l.uniqueOwner,l.extensionId,l.label,h,this.hoverDecorationOptions,l.commentingRanges,!0)),t<u.endLineNumber){let g=new G(t+1,1,c.endLineNumber,1);r.push(new CG(i,l.uniqueOwner,l.extensionId,l.label,g,this.decorationOptions,l.commentingRanges,!0))}}else r.push(new CG(i,l.uniqueOwner,l.extensionId,l.label,c,this.decorationOptions,l.commentingRanges))});i.changeDecorations(l=>{this.decorationIds=l.deltaDecorations(this.decorationIds,r),r.forEach((c,u)=>c.id=this.decorationIds[u])});let s=this.commentingRangeDecorations.length-r.length;this.commentingRangeDecorations=r,s&&this._onDidChangeDecorationsCount.fire(this.commentingRangeDecorations.length)}areRangesIntersectingOrTouchingByLine(i,e){return!(i.endLineNumber<e.startLineNumber-1||e.endLineNumber+1<i.startLineNumber)}getMatchedCommentAction(i){if(i===void 0){let o=this._infos?.filter(n=>n.commentingRanges.fileComments);return o?o.map(n=>({action:{ownerId:n.uniqueOwner,extensionId:n.extensionId,label:n.label,commentingRangesInfo:n.commentingRanges}})):[]}let e=new Map;for(let o of this.commentingRangeDecorations){let n=o.getActiveRange();if(n&&this.areRangesIntersectingOrTouchingByLine(n,i)){let r=o.getCommentAction(),s=e.get(r.ownerId);if(s?.action.commentingRangesInfo===r.commentingRangesInfo){let l=new G(n.startLineNumber<s.range.startLineNumber?n.startLineNumber:s.range.startLineNumber,n.startColumn<s.range.startColumn?n.startColumn:s.range.startColumn,n.endLineNumber>s.range.endLineNumber?n.endLineNumber:s.range.endLineNumber,n.endColumn>s.range.endColumn?n.endColumn:s.range.endColumn);e.set(r.ownerId,{range:l,action:r})}else e.set(r.ownerId,{range:n,action:r})}}let t=new Set;return Array.from(e.values()).filter(o=>t.has(o.action.ownerId)?!1:(t.add(o.action.ownerId),!0))}getNearestCommentingRange(i,e){let t,o;if(e){o=[];for(let n=this.commentingRangeDecorations.length-1;n>=0;n--)o.push(this.commentingRangeDecorations[n])}else o=this.commentingRangeDecorations;for(let n of o){let r=n.getActiveRange();if(r){if(t&&this.areRangesIntersectingOrTouchingByLine(r,t)){t=G.plusRange(t,r);continue}if(r.startLineNumber<=i.lineNumber&&i.lineNumber<=r.endLineNumber){t=new G(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn);continue}if(!(!e&&r.endLineNumber<i.lineNumber)&&!(e&&r.startLineNumber>i.lineNumber))return r}}return o.length>0?o[0].getActiveRange()??void 0:void 0}dispose(){this._onDidChangeDecorationsCount.dispose(),this.commentingRangeDecorations=[]}};function TCi(a,i){if(!a?.comment||!a?.thread?.comments)return;let e=a.thread.comments?.indexOf(a.comment);if(e===void 0||e<0||i==="previous"&&e===0||i==="next"&&e===a.thread.comments.length-1)return;let t=a.thread.comments?.[i==="previous"?e-1:e+1];if(t)return{...a,comment:t}}function Yee(a,i,e,t,o,n,r,s,l){if(!t.resource)return;a.isCommentingEnabled||a.enableCommenting(!0);let c=t.range,u=n?2:s?0:1,p=i.activeTextEditorControl,h=Lc(p)?[p.getOriginalEditor(),p.getModifiedEditor()]:p?[p]:[],g=t.threadId,f=o?.uniqueIdInThread,v=A.parse(t.resource);for(let b of h){let S=b.getModel();if(S instanceof Tp&&e.extUri.isEqual(v,S.uri)){g&&fn(b)&&Qx.get(b)?.revealCommentThread(g,f,!0,u);return}}i.openEditor({resource:v,options:{pinned:r,preserveFocus:s,selection:c??new G(1,1,1,1)}},l?En:tr).then(b=>{if(b){let S=b.getControl();g&&fn(S)&&Qx.get(S)?.revealCommentThread(g,f,!0,u)}})}var Qx=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.commentService=t;this.instantiationService=o;this.codeEditorService=n;this.contextMenuService=r;this.quickInputService=s;this.viewsService=l;this.configurationService=c;this.editorService=p;this.keybindingService=h;this.accessibilityService=g;this.notificationService=f;this.uriIdentityService=v;this.localToDispose=this._register(new O);this.mouseDownInfo=null;this._commentingRangeSpaceReserved=!1;this._commentingRangeAmountReserved=0;this._emptyThreadsToAddQueue=[];this._inProcessContinueOnComments=new Map;this._editorDisposables=[];this._hasRespondedToEditorChange=!1;this._commentInfos=[],this._commentWidgets=[],this._pendingNewCommentCache={},this._pendingEditsCache={},this._computePromise=null,this._activeCursorHasCommentingRange=jc.activeCursorHasCommentingRange.bindTo(u),this._activeCursorHasComment=jc.activeCursorHasComment.bindTo(u),this._activeEditorHasCommentingRange=jc.activeEditorHasCommentingRange.bindTo(u),this._commentWidgetVisible=jc.commentWidgetVisible.bindTo(u),!(e instanceof Ed)&&(this.editor=e,this._commentingRangeDecorator=this._register(new YFt),this._register(this._commentingRangeDecorator.onDidChangeDecorationsCount(b=>{b===0?this.clearEditorListeners():this._editorDisposables.length===0&&this.registerEditorListeners()})),this._register(this._commentThreadRangeDecorator=new QFt(this.commentService)),this._register(this.commentService.onDidDeleteDataProvider(b=>{b?(delete this._pendingNewCommentCache[b],delete this._pendingEditsCache[b]):(this._pendingNewCommentCache={},this._pendingEditsCache={}),this.beginCompute()})),this._register(this.commentService.onDidSetDataProvider(b=>this.beginComputeAndHandleEditorChange())),this._register(this.commentService.onDidUpdateCommentingRanges(b=>this.beginComputeAndHandleEditorChange())),this._register(this.commentService.onDidSetResourceCommentInfos(async b=>{let S=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;S&&S.toString()===b.resource.toString()&&await this.setComments(b.commentInfos.filter(y=>y!==null))})),this._register(this.commentService.onDidChangeCommentingEnabled(b=>{b?(this.registerEditorListeners(),this.beginCompute()):(this.tryUpdateReservedSpace(),this.clearEditorListeners(),this._commentingRangeDecorator.update(this.editor,[]),this._commentThreadRangeDecorator.update(this.editor,[]),je(this._commentWidgets),this._commentWidgets=[])})),this._register(this.editor.onWillChangeModel(b=>this.onWillChangeModel(b))),this._register(this.editor.onDidChangeModel(b=>this.onModelChanged())),this._register(this.configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("diffEditor.renderSideBySide")&&this.beginCompute()})),this.onModelChanged(),this._register(this.codeEditorService.registerDecorationType("comment-controller",zFt,{})),this._register(this.commentService.registerContinueOnCommentProvider({provideContinueOnComments:()=>{let b=[];if(this._commentWidgets)for(let S of this._commentWidgets){let w=S.getPendingComments().newComment;if(!w)continue;let x;if(S.commentThread.comments&&S.commentThread.comments.length){let E=S.commentThread.comments[S.commentThread.comments.length-1];typeof E.body=="string"?x=E.body:x=E.body.value}w.body!==x&&b.push({uniqueOwner:S.uniqueOwner,uri:S.editor.getModel().uri,range:S.commentThread.range,comment:w,isReply:S.commentThread.comments!==void 0&&S.commentThread.comments.length>0})}return b}})))}registerEditorListeners(){this._editorDisposables=[],this.editor&&(this._editorDisposables.push(this.editor.onMouseMove(e=>this.onEditorMouseMove(e))),this._editorDisposables.push(this.editor.onMouseLeave(()=>this.onEditorMouseLeave())),this._editorDisposables.push(this.editor.onDidChangeCursorPosition(e=>this.onEditorChangeCursorPosition(e.position))),this._editorDisposables.push(this.editor.onDidFocusEditorWidget(()=>this.onEditorChangeCursorPosition(this.editor?.getPosition()??null))),this._editorDisposables.push(this.editor.onDidChangeCursorSelection(e=>this.onEditorChangeCursorSelection(e))),this._editorDisposables.push(this.editor.onDidBlurEditorWidget(()=>this.onEditorChangeCursorSelection())))}clearEditorListeners(){je(this._editorDisposables),this._editorDisposables=[]}onEditorMouseLeave(){this._commentingRangeDecorator.updateHover()}onEditorMouseMove(e){let t=e.target.position?.lineNumber;e.event.leftButton.valueOf()&&t&&this.mouseDownInfo?this._commentingRangeDecorator.updateSelection(t,new G(this.mouseDownInfo.lineNumber,1,t,1)):this._commentingRangeDecorator.updateHover(t)}onEditorChangeCursorSelection(e){let t=this.editor?.getPosition()?.lineNumber;t&&this._commentingRangeDecorator.updateSelection(t,e?.selection)}onEditorChangeCursorPosition(e){if(!e)return;let t=G.fromPositions(e,{column:-1,lineNumber:e.lineNumber}),o=this.editor?.getDecorationsInRange(t),n=!1;if(o)for(let r of o)if(r.options.description===Fme.description){n=!1;break}else r.options.description===YFt.description&&(n=!0);this._activeCursorHasCommentingRange.set(n),this._activeCursorHasComment.set(this.getCommentsAtLine(t).length>0)}isEditorInlineOriginal(e){return this.configurationService.getValue("diffEditor.renderSideBySide")?!1:!!this.editorService.visibleTextEditorControls.find(o=>o.getEditorType()===v5.IDiffEditor?o.getOriginalEditor()===e:!1)}beginCompute(){return this._computePromise=Hn(e=>{let t=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;return t?this.commentService.getDocumentComments(t):Promise.resolve([])}),this._computeAndSetPromise=this._computePromise.then(async e=>{await this.setComments(ui(e)),this._computePromise=null},e=>console.log(e)),this._computePromise.then(()=>this._computeAndSetPromise=void 0),this._computeAndSetPromise}beginComputeCommentingRanges(){this._computeCommentingRangeScheduler&&this._computeCommentingRangeScheduler.trigger(()=>{let e=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;return e?this.commentService.getDocumentComments(e):Promise.resolve([])}).then(e=>{if(this.commentService.isCommentingEnabled){let t=ui(e);this._commentingRangeDecorator.update(this.editor,t,this.editor?.getPosition()?.lineNumber,this.editor?.getSelection()??void 0)}},e=>(mt(e),null))}static get(e){return e.getContribution(ECi)}revealCommentThread(e,t,o,n){let r=this._commentWidgets.filter(s=>s.commentThread.threadId===e);r.length===1?r[0].reveal(t,n):o&&(this._computeAndSetPromise?this._computeAndSetPromise.then(s=>{this.revealCommentThread(e,t,!1,n)}):this.beginCompute().then(s=>{this.revealCommentThread(e,t,!1,n)}))}collapseAll(){for(let e of this._commentWidgets)e.collapse(!0)}async collapseVisibleComments(){if(!this.editor)return;let e=this.editor.getVisibleRanges();for(let t of this._commentWidgets)t.expanded&&t.commentThread.range&&e.some(n=>G.areIntersectingOrTouching(n,t.commentThread.range))&&await t.collapse(!0)}_updateCommentWidgetVisibleContext(){let e=this._commentWidgets.some(t=>t.expanded);this._commentWidgetVisible.set(e)}expandAll(){for(let e of this._commentWidgets)e.expand()}expandUnresolved(){for(let e of this._commentWidgets)e.commentThread.state===0&&e.expand()}nextCommentThread(e){this._findNearestCommentThread(e)}_findNearestCommentThread(e,t){if(!this._commentWidgets.length||!this.editor?.hasModel())return;let o=t?this.editor.getSelection().getStartPosition():this.editor.getSelection().getEndPosition(),n=this._commentWidgets.sort((l,c)=>{if(t){let u=l;l=c,c=u}return l.commentThread.range===void 0?-1:c.commentThread.range===void 0?1:l.commentThread.range.startLineNumber<c.commentThread.range.startLineNumber?-1:l.commentThread.range.startLineNumber>c.commentThread.range.startLineNumber?1:l.commentThread.range.startColumn<c.commentThread.range.startColumn?-1:l.commentThread.range.startColumn>c.commentThread.range.startColumn?1:0}),r=Mw(n,l=>{let c=t?o.lineNumber:l.commentThread.range?.startLineNumber??0,u=t?l.commentThread.range?.startLineNumber??0:o.lineNumber,p=t?o.column:l.commentThread.range?.startColumn??0,h=t?l.commentThread.range?.startColumn??0:o.column;return c>u?!0:c<u?!1:p>h}),s=n[r];s!==void 0&&(this.editor.setSelection(s.commentThread.range??new G(1,1,1,1)),s.reveal(void 0,e?1:0))}previousCommentThread(e){this._findNearestCommentThread(e,!0)}_findNearestCommentingRange(e){if(!this.editor?.hasModel())return;let t=this.editor.getSelection().getEndPosition(),o=this._commentingRangeDecorator.getNearestCommentingRange(t,e);if(o){let n=e?o.getEndPosition():o.getStartPosition();this.editor.setPosition(n),this.editor.revealLineInCenterIfOutsideViewport(n.lineNumber)}if(this.accessibilityService.isScreenReaderOptimized()){let n=o?.getStartPosition().lineNumber,r=o?.getEndPosition().lineNumber;n&&r&&(n===r?Er(d(10284,null,n)):Er(d(10285,null,n,r)))}}nextCommentingRange(){this._findNearestCommentingRange()}previousCommentingRange(){this._findNearestCommentingRange(!0)}dispose(){super.dispose(),je(this._editorDisposables),je(this._commentWidgets),this.editor=null}onWillChangeModel(e){e.newModelUrl&&this.tryUpdateReservedSpace(e.newModelUrl)}async handleCommentAdded(e,t,o){if(this._commentWidgets.filter(h=>h.uniqueOwner===t&&h.commentThread.threadId===o.threadId).length)return;let r=this._commentWidgets.filter(h=>h.uniqueOwner===t&&h.commentThread.commentThreadHandle===-1&&G.equalsRange(h.commentThread.range,o.range));if(r.length){r[0].update(o);return}let s=this._inProcessContinueOnComments.get(t)?.findIndex(h=>h.range===void 0?o.range===void 0:G.lift(h.range).equalsRange(o.range)),l;s!==void 0&&s>=0&&(l=this._inProcessContinueOnComments.get(t)?.splice(s,1)[0].comment.body);let c=(this._pendingNewCommentCache[t]&&this._pendingNewCommentCache[t][o.threadId])??l,u=this._pendingEditsCache[t]&&this._pendingEditsCache[t][o.threadId],p=o.canReply&&o.isTemplate&&(!o.comments||o.comments.length===0)&&(!o.editorId||o.editorId===e);await this.displayCommentThread(t,o,p,c,u),this._commentInfos.filter(h=>h.uniqueOwner===t)[0].threads.push(o),this.tryUpdateReservedSpace()}onModelChanged(){this.localToDispose.clear(),this.tryUpdateReservedSpace(),this.removeCommentWidgetsAndStoreCache(),this.editor&&(this._hasRespondedToEditorChange=!1,this.localToDispose.add(this.editor.onMouseDown(e=>this.onEditorMouseDown(e))),this.localToDispose.add(this.editor.onMouseUp(e=>this.onEditorMouseUp(e))),this._editorDisposables.length&&(this.clearEditorListeners(),this.registerEditorListeners()),this._computeCommentingRangeScheduler=new rn(200),this.localToDispose.add({dispose:()=>{this._computeCommentingRangeScheduler?.cancel(),this._computeCommentingRangeScheduler=null}}),this.localToDispose.add(this.editor.onDidChangeModelContent(async()=>{this.beginComputeCommentingRanges()})),this.localToDispose.add(this.commentService.onDidUpdateCommentThreads(async e=>{let t=this.editor&&this.editor.hasModel()&&this.editor.getModel().uri;if(!t||!this.commentService.isCommentingEnabled)return;this._computePromise&&await this._computePromise;let o=this._commentInfos.filter(u=>u.uniqueOwner===e.uniqueOwner);if(!o||!o.length)return;let n=e.added.filter(u=>u.resource&&this.uriIdentityService.extUri.isEqual(A.parse(u.resource),t)),r=e.removed.filter(u=>u.resource&&this.uriIdentityService.extUri.isEqual(A.parse(u.resource),t)),s=e.changed.filter(u=>u.resource&&this.uriIdentityService.extUri.isEqual(A.parse(u.resource),t)),l=e.pending.filter(u=>this.uriIdentityService.extUri.isEqual(u.uri,t));r.forEach(u=>{let p=this._commentWidgets.filter(g=>g.uniqueOwner===e.uniqueOwner&&g.commentThread.threadId===u.threadId&&g.commentThread.threadId!=="");if(p.length){let g=p[0],f=this._commentWidgets.indexOf(g);this._commentWidgets.splice(f,1),g.dispose()}let h=this._commentInfos.filter(g=>g.uniqueOwner===e.uniqueOwner)[0].threads;for(let g=0;g<h.length;g++)h[g]===u&&(h.splice(g,1),g--)});for(let u of s){let p=this._commentWidgets.filter(h=>h.uniqueOwner===e.uniqueOwner&&h.commentThread.threadId===u.threadId);p.length&&(p[0].update(u),this.openCommentsView(u))}let c=this.editor?.getId();for(let u of n)await this.handleCommentAdded(c,e.uniqueOwner,u);for(let u of l)await this.resumePendingComment(t,u);this._commentThreadRangeDecorator.update(this.editor,o)})),this.beginComputeAndHandleEditorChange())}async resumePendingComment(e,t){let o=this._commentWidgets.filter(n=>n.uniqueOwner===t.uniqueOwner&&G.lift(n.commentThread.range)?.equalsRange(t.range));if(t.isReply&&o.length)this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!0}),o[0].setPendingComment(t.comment);else if(o.length){this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!1});let n=o[0].getPendingComments().newComment,r;!n||t.comment.body.includes(n.body)?r=t.comment:n.body.includes(t.comment.body)?r=n:r={body:`${n}
${t.comment.body}`,cursor:t.comment.cursor},o[0].setPendingComment(r)}else if(!t.isReply){if(!this.commentService.removeContinueOnComment({uniqueOwner:t.uniqueOwner,uri:e,range:t.range,isReply:!1}))return;this._inProcessContinueOnComments.has(t.uniqueOwner)||this._inProcessContinueOnComments.set(t.uniqueOwner,[]),this._inProcessContinueOnComments.get(t.uniqueOwner)?.push(t),await this.commentService.createCommentThreadTemplate(t.uniqueOwner,t.uri,t.range?G.lift(t.range):void 0)}}beginComputeAndHandleEditorChange(){this.beginCompute().then(()=>{if(!this._hasRespondedToEditorChange&&this._commentInfos.some(e=>e.commentingRanges.ranges.length>0||e.commentingRanges.fileComments))if(this._hasRespondedToEditorChange=!0,this.configurationService.getValue("accessibility.verbosity.comments")){let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t?Er(d(10289,null,t)):Er(d(10290,null))}else Er(d(10288,null))})}async openCommentsView(e){if(e.comments&&e.comments.length>0&&xZe(e)){let t=this.configurationService.getValue(fG).openView;if(t==="file")return this.viewsService.openView(gp);if((t==="firstFile"||t==="firstFileUnresolved"&&e.state===0)&&!this.viewsService.getViewWithId(gp)?.hasRendered)return this.viewsService.openView(gp)}}async displayCommentThread(e,t,o,n,r){let s=this.editor?.getModel();if(!s||!this.editor||this.isEditorInlineOriginal(this.editor))return;let l;t.range&&!n&&(l=this.commentService.removeContinueOnComment({uniqueOwner:e,uri:s.uri,range:t.range,isReply:!0}));let c=this.instantiationService.createInstance(vLe,this.editor,e,t,n??l?.comment,r);await c.display(t.range,o),this._commentWidgets.push(c),this.localToDispose.add(c.onDidChangeExpandedState(()=>this._updateCommentWidgetVisibleContext())),this.localToDispose.add(c.onDidClose(()=>this._updateCommentWidgetVisibleContext())),this.openCommentsView(t)}onEditorMouseDown(e){this.mouseDownInfo=(e.target.element?.className.indexOf("comment-range-glyph")??-1)>=0?qpo(e):null}onEditorMouseUp(e){let t=$po(this.mouseDownInfo,e);if(this.mouseDownInfo=null,!this.editor||t===null||!e.target.element)return;let o=e.target.element.className.indexOf("comment-range-glyph")>=0,n=e.target.position.lineNumber,r,s;t!==n?t>n?s=new G(t,this.editor.getModel().getLineLength(t)+1,n,1):s=new G(t,1,n,this.editor.getModel().getLineLength(n)+1):o&&(s=this.editor.getSelection()),s&&s.startLineNumber<=n&&n<=s.endLineNumber?(r=s,this.editor.setSelection(new G(s.endLineNumber,1,s.endLineNumber,1))):o&&(r=new G(n,1,n,1)),r&&this.addOrToggleCommentAtLine(r,e)}getCommentsAtLine(e){return this._commentWidgets.filter(t=>t.getGlyphPosition()===(e?e.endLineNumber:0))}async addOrToggleCommentAtLine(e,t){if(this._addInProgress)this._emptyThreadsToAddQueue.push([e,t]);else{this._addInProgress=!0;let o=this.getCommentsAtLine(e);if(o.length){let n=o.every(r=>r.expanded);o.forEach(n?r=>r.collapse(!0):r=>r.expand(!0)),this.processNextThreadToAdd();return}else this.addCommentAtLine(e,t)}}processNextThreadToAdd(){this._addInProgress=!1;let e=this._emptyThreadsToAddQueue.shift();e&&this.addOrToggleCommentAtLine(e[0],e[1])}clipUserRangeToCommentRange(e,t){return e.startLineNumber<t.startLineNumber&&(e=new G(t.startLineNumber,t.startColumn,e.endLineNumber,e.endColumn)),e.endLineNumber>t.endLineNumber&&(e=new G(e.startLineNumber,e.startColumn,t.endLineNumber,t.endColumn)),e}addCommentAtLine(e,t){let o=this._commentingRangeDecorator.getMatchedCommentAction(e);if(!o.length||!this.editor?.hasModel())return this._addInProgress=!1,o.length||(e?this.notificationService.error(d(10286,null)):this.notificationService.error(d(10287,null))),Promise.resolve();if(o.length>1){if(t&&e)return this.contextMenuService.showContextMenu({getAnchor:()=>t.event,getActions:()=>this.getContextMenuActions(o,e),getActionsContext:()=>o.length?o[0]:void 0,onHide:()=>{this._addInProgress=!1}}),Promise.resolve();{let n=this.getCommentProvidersQuickPicks(o);return this.quickInputService.pick(n,{placeHolder:d(10291,null),matchOnDescription:!0}).then(r=>{if(!r)return;let s=o.filter(l=>l.action.ownerId===r.id);if(s.length){let{ownerId:l}=s[0].action,c=e&&s[0].range?this.clipUserRangeToCommentRange(e,s[0].range):e;this.addCommentAtLine2(c,l)}}).then(()=>{this._addInProgress=!1})}}else{let{ownerId:n}=o[0].action,r=e&&o[0].range?this.clipUserRangeToCommentRange(e,o[0].range):e;this.addCommentAtLine2(r,n)}return Promise.resolve()}getCommentProvidersQuickPicks(e){return e.map(o=>{let{ownerId:n,extensionId:r,label:s}=o.action;return{label:s??r??n,id:n}})}getContextMenuActions(e,t){let o=[];return e.forEach(n=>{let{ownerId:r,extensionId:s,label:l}=n.action;o.push(new it("addCommentThread",`${l||s}`,void 0,!0,()=>{let c=n.range?this.clipUserRangeToCommentRange(t,n.range):t;return this.addCommentAtLine2(c,r),Promise.resolve()}))}),o}addCommentAtLine2(e,t){this.editor&&(this.commentService.createCommentThreadTemplate(t,this.editor.getModel().uri,e,this.editor.getId()),this.processNextThreadToAdd())}getExistingCommentEditorOptions(e){let t=e.getOption(74),o=[],n=e.getRawOptions().extraEditorClassName;return n&&(o=n.split(" ")),{lineDecorationsWidth:t,extraEditorClassName:o}}getWithoutCommentsEditorOptions(e,t,o){let n=o,r=t.findIndex(l=>l==="inline-comment");r>=0&&t.splice(r,1);let s=e.getOptions();return s.get(52)&&s.get(126)!=="never"&&(n+=11),n-=24,{extraEditorClassName:t,lineDecorationsWidth:n}}getWithCommentsLineDecorationWidth(e,t){let o=t,n=e.getOptions();return n.get(52)&&n.get(126)!=="never"&&(o-=11),o+=24,this._commentingRangeAmountReserved=o,this._commentingRangeAmountReserved}getWithCommentsEditorOptions(e,t,o){return t.push("inline-comment"),{lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(e,o),extraEditorClassName:t}}updateEditorLayoutOptions(e,t,o){e.updateOptions({extraEditorClassName:t.join(" "),lineDecorationsWidth:o})}ensureCommentingRangeReservedAmount(e){let t=this.getExistingCommentEditorOptions(e);t.lineDecorationsWidth!==this._commentingRangeAmountReserved&&e.updateOptions({lineDecorationsWidth:this.getWithCommentsLineDecorationWidth(e,t.lineDecorationsWidth)})}tryUpdateReservedSpace(e){if(!this.editor)return;let t=this._commentInfos.some(r=>!!(r.commentingRanges&&(Array.isArray(r.commentingRanges)?r.commentingRanges:r.commentingRanges.ranges).length)||r.threads.length>0);e=e??this.editor.getModel()?.uri;let o=e?this.commentService.resourceHasCommentingRanges(e):!1,n=t||o;if(n&&this.commentService.isCommentingEnabled)if(this._commentingRangeSpaceReserved)this.ensureCommentingRangeReservedAmount(this.editor);else{this._commentingRangeSpaceReserved=!0;let{lineDecorationsWidth:r,extraEditorClassName:s}=this.getExistingCommentEditorOptions(this.editor),l=this.getWithCommentsEditorOptions(this.editor,s,r);this.updateEditorLayoutOptions(this.editor,l.extraEditorClassName,l.lineDecorationsWidth)}else if((!n||!this.commentService.isCommentingEnabled)&&this._commentingRangeSpaceReserved){this._commentingRangeSpaceReserved=!1;let{lineDecorationsWidth:r,extraEditorClassName:s}=this.getExistingCommentEditorOptions(this.editor),l=this.getWithoutCommentsEditorOptions(this.editor,s,r);this.updateEditorLayoutOptions(this.editor,l.extraEditorClassName,l.lineDecorationsWidth)}}async setComments(e){if(!this.editor||!this.commentService.isCommentingEnabled)return;this._commentInfos=e,this.tryUpdateReservedSpace(),this.removeCommentWidgetsAndStoreCache();let t=!1;for(let o of this._commentInfos){!t&&(o.commentingRanges.ranges.length>0||o.commentingRanges.fileComments)&&(t=!0);let n=this._pendingNewCommentCache[o.uniqueOwner],r=this._pendingEditsCache[o.uniqueOwner];o.threads=o.threads.filter(s=>!s.isDisposed);for(let s of o.threads){let l;n&&(l=n[s.threadId]);let c;r&&(c=r[s.threadId]),await this.displayCommentThread(o.uniqueOwner,s,!1,l,c)}for(let s of o.pendingCommentThreads??[])this.resumePendingComment(this.editor.getModel().uri,s)}this._commentingRangeDecorator.update(this.editor,this._commentInfos),this._commentThreadRangeDecorator.update(this.editor,this._commentInfos),t?this._activeEditorHasCommentingRange.set(!0):this._activeEditorHasCommentingRange.set(!1)}collapseAndFocusRange(e){this._commentWidgets?.find(t=>t.commentThread.threadId===e)?.collapseAndFocusRange()}removeCommentWidgetsAndStoreCache(){this._commentWidgets&&this._commentWidgets.forEach(e=>{let t=e.getPendingComments(),o=t.newComment,n=this._pendingNewCommentCache[e.uniqueOwner],r;if(e.commentThread.comments&&e.commentThread.comments.length){let c=e.commentThread.comments[e.commentThread.comments.length-1];typeof c.body=="string"?r=c.body:r=c.body.value}o&&o.body!==r?(n||(this._pendingNewCommentCache[e.uniqueOwner]={}),this._pendingNewCommentCache[e.uniqueOwner][e.commentThread.threadId]=o):n&&delete n[e.commentThread.threadId];let s=t.edits,l=this._pendingEditsCache[e.uniqueOwner];Object.keys(s).length>0?(l||(this._pendingEditsCache[e.uniqueOwner]={}),this._pendingEditsCache[e.uniqueOwner][e.commentThread.threadId]=s):l&&delete l[e.commentThread.threadId],e.dispose()}),this._commentWidgets=[]}};Qx=I([m(1,Wm),m(2,F),m(3,Qt),m(4,Xe),m(5,$e),m(6,Gt),m(7,B),m(8,X),m(9,ie),m(10,Le),m(11,Ai),m(12,Ne),m(13,gt)],Qx);var BZe={id:R.AccessibleView,group:"navigation",when:Jd},HZe={id:R.CommandPalette,group:"",order:1},_Ci=class extends z{constructor(){super({id:"editor.action.accessibleViewNext",precondition:C.and(Jd,Hme),keybinding:{primary:606,weight:200},menu:[HZe,{...BZe,when:C.and(Jd,Hme)}],icon:L.arrowDown,title:d(5923,null)})}run(i){i.get(Kd).next()}};W(_Ci);var DCi=class extends z{constructor(){super({id:"editor.action.accessibleViewNextCodeBlock",precondition:C.and(Ume,C.or(C.equals(Fu.key,"panelChat"),C.equals(Fu.key,"inlineChat"),C.equals(Fu.key,"quickChat"))),keybinding:{primary:2572,mac:{primary:2572},weight:200},icon:L.arrowRight,menu:{...BZe,when:C.and(Jd,Ume)},title:d(5924,null)})}run(i){i.get(Kd).navigateToCodeBlock("next")}};W(DCi);var RCi=class extends z{constructor(){super({id:"editor.action.accessibleViewPreviousCodeBlock",precondition:C.and(Ume,C.or(C.equals(Fu.key,"panelChat"),C.equals(Fu.key,"inlineChat"),C.equals(Fu.key,"quickChat"))),keybinding:{primary:2571,mac:{primary:2571},weight:200},icon:L.arrowLeft,menu:{...BZe,when:C.and(Jd,Ume)},title:d(5926,null)})}run(i){i.get(Kd).navigateToCodeBlock("previous")}};W(RCi);var LCi=class extends z{constructor(){super({id:"editor.action.accessibleViewPrevious",precondition:C.and(Jd,Hme),keybinding:{primary:604,weight:200},icon:L.arrowUp,menu:[HZe,{...BZe,when:C.and(Jd,Hme)}],title:d(5925,null)})}run(i){i.get(Kd).previous()}};W(LCi);var MCi=class extends z{constructor(){super({id:"editor.action.accessibleViewGoToSymbol",precondition:C.and(C.or(Jd,jx),OZe),keybinding:{primary:3117,secondary:[3161],weight:210},icon:L.symbolMisc,menu:[HZe,{...BZe,when:C.and(C.or(Jd,jx),OZe)}],title:d(5922,null)})}run(i){i.get(Kd).goToSymbol()}};W(MCi);function jpo(a){return a.register(),a}var zme=jpo(new hF({id:"editor.action.accessibilityHelp",precondition:void 0,kbOpts:{primary:571,weight:200,linux:{primary:1595,secondary:[571]},kbExpr:jx.toNegated()},menuOpts:[{menuId:R.CommandPalette,group:"",title:d(5915,null),order:1}]})),Xee=jpo(new hF({id:"editor.action.accessibleView",precondition:void 0,kbOpts:{primary:572,weight:200,linux:{primary:1596,secondary:[572]}},menuOpts:[{menuId:R.CommandPalette,group:"",title:d(5919,null),order:1}]})),PCi=class extends z{constructor(){super({id:"editor.action.accessibleViewDisableHint",precondition:C.and(C.or(Jd,jx),NZe),keybinding:{primary:576,weight:200},icon:L.bellSlash,menu:[HZe,{id:R.AccessibleView,group:"navigation",when:C.and(C.or(Jd,jx),NZe)}],title:d(5921,null)})}run(i){i.get(Kd).disableHint()}};W(PCi);var ACi=class extends z{constructor(){super({id:"editor.action.accessibilityHelpConfigureKeybindings",precondition:C.and(jx,FZe),icon:L.recordKeys,keybinding:{primary:553,weight:200},menu:[{id:R.AccessibleView,group:"navigation",order:3,when:FZe}],title:d(5917,null)})}async run(i){await i.get(Kd).configureKeybindings(!0)}};W(ACi);var NCi=class extends z{constructor(){super({id:"editor.action.accessibilityHelpConfigureAssignedKeybindings",precondition:C.and(jx,WZe),icon:L.recordKeys,keybinding:{primary:543,weight:200},menu:[{id:R.AccessibleView,group:"navigation",order:4,when:WZe}],title:d(5916,null)})}async run(i){await i.get(Kd).configureKeybindings(!1)}};W(NCi);var OCi=class extends z{constructor(){super({id:"editor.action.accessibilityHelpOpenHelpLink",precondition:C.and(jx),keybinding:{primary:550,weight:200},title:d(5918,null)})}run(i){i.get(Kd).openHelpLink()}};W(OCi);var FCi=class extends z{constructor(){super({id:"editor.action.accessibleViewAcceptInlineCompletion",precondition:C.and(Jd,C.equals(Fu.key,"inlineCompletions")),keybinding:{primary:2138,mac:{primary:346},weight:200},icon:L.check,menu:[HZe,{id:R.AccessibleView,group:"navigation",order:0,when:C.and(Jd,C.equals(Fu.key,"inlineCompletions"))}],title:d(5920,null)})}async run(i){let e=i.get(Qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=cd.get(t)?.model.get(),n=o?.state.get();!o||!n||(await o.accept(t),o.stop(),t.focus())}};W(FCi);var XFt=new Y("commentsView.hasComments",!1),JFt=new Y("commentsView.someCommentsExpanded",!1),WCi=new Y("commentsView.commentFocused",!1),fZo="commentsViewState";function vZo(a){let i=[];for(let e of a.resourceCommentThreads){let t=[];for(let o of e.commentThreads)xZe(o.thread)&&t.push({element:o});t.length>0&&i.push({element:e,children:t})}return i}var bLe=class extends lW{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=new $l(fZo,v),y=S.getMemento(1,1);super({...e,filterOptions:{placeholder:d(10318,null),ariaLabel:d(10317,null),history:y.filterHistory||[],text:y.filter||"",focusContextKey:DZe.key}},c,l,r,s,o,t,u,p,g);this.editorService=n;this.commentService=h;this.uriIdentityService=f;this.pathService=b;this.totalComments=0;this.currentHeight=0;this.currentWidth=0;this.cachedFilterStats=void 0;this.onDidChangeVisibility=this.onDidChangeBodyVisibility;this.hasCommentsContextKey=XFt.bindTo(s),this.someCommentsExpandedContextKey=JFt.bindTo(s),this.commentsFocusedContextKey=WCi.bindTo(s),this.stateMemento=S,this.viewState=y,this.filters=this._register(new OFt({showResolved:this.viewState.showResolved!==!1,showUnresolved:this.viewState.showUnresolved!==!1,sortBy:this.viewState.sortBy??"resourceAscending"},this.contextKeyService)),this.filter=new _Ft(new ZH(this.filterWidget.getFilterText(),this.filters.showResolved,this.filters.showUnresolved)),this._register(this.filters.onDidChange(w=>{(w.showResolved||w.showUnresolved)&&this.updateFilter(),w.sortBy&&this.refresh()})),this._register(this.filterWidget.onDidChangeFilterText(()=>this.updateFilter()))}get focusedCommentNode(){let e=this.tree?.getFocus();if(e?.length===1&&e[0]instanceof u_)return e[0]}get focusedCommentInfo(){if(this.focusedCommentNode)return this.getScreenReaderInfoForNode(this.focusedCommentNode)}focusNextNode(){if(!this.tree)return;let e=this.tree.getFocus()?.[0];if(!e)return;let t=this.tree.navigate(e).next();for(;t&&!(t instanceof u_);)t=this.tree.navigate(t).next();t&&this.tree.setFocus([t])}focusPreviousNode(){if(!this.tree)return;let e=this.tree.getFocus()?.[0];if(!e)return;let t=this.tree.navigate(e).previous();for(;t&&!(t instanceof u_);)t=this.tree.navigate(t).previous();t&&this.tree.setFocus([t])}saveState(){this.viewState.filter=this.filterWidget.getFilterText(),this.viewState.filterHistory=this.filterWidget.getHistory(),this.viewState.showResolved=this.filters.showResolved,this.viewState.showUnresolved=this.filters.showUnresolved,this.viewState.sortBy=this.filters.sortBy,this.stateMemento.saveMemento(),super.saveState()}render(){super.render(),this._register(p_({name:"commentsView",focusNotifiers:[this,this.filterWidget],focusNextWidget:()=>{this.filterWidget.hasFocus()&&this.focus()},focusPreviousWidget:()=>{this.filterWidget.hasFocus()||this.focusFilter()}}))}focusFilter(){this.filterWidget.focus()}clearFilterText(){this.filterWidget.setFilterText("")}getFilterStats(){return this.cachedFilterStats||(this.cachedFilterStats={total:this.totalComments,filtered:this.tree?.getVisibleItemCount()??0}),this.cachedFilterStats}updateFilter(){this.filter.options=new ZH(this.filterWidget.getFilterText(),this.filters.showResolved,this.filters.showUnresolved),this.tree?.filterComments(),this.cachedFilterStats=void 0;let{total:e,filtered:t}=this.getFilterStats();this.filterWidget.updateBadge(e===t||e===0?void 0:d(10328,null,t,e)),this.filterWidget.checkMoreFilters(!this.filters.showResolved||!this.filters.showUnresolved)}renderBody(e){super.renderBody(e),e.classList.add("comments-panel");let t=D(e,_(".comments-panel-container"));this.treeContainer=D(t,_(".tree-container")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons"),this.cachedFilterStats=void 0,this.createTree(),this.createMessageBox(t),this._register(this.commentService.onDidSetAllCommentThreads(this.onAllCommentsChanged,this)),this._register(this.commentService.onDidUpdateCommentThreads(this.onCommentsUpdated,this)),this._register(this.commentService.onDidDeleteDataProvider(this.onDataProviderDeleted,this)),this._register(this.onDidChangeBodyVisibility(o=>{o&&this.refresh()})),this.renderComments()}focus(){super.focus();let e=this.tree?.getHTMLElement();e&&Na(e)||(!this.commentService.commentsModel.hasCommentThreads()&&this.messageBoxContainer?this.messageBoxContainer.focus():this.tree&&this.tree.domFocus())}renderComments(){this.treeContainer.classList.toggle("hidden",!this.commentService.commentsModel.hasCommentThreads()),this.renderMessage(),this.tree?.setChildren(null,vZo(this.commentService.commentsModel))}collapseAll(){this.tree&&(this.tree.collapseAll(),this.tree.setSelection([]),this.tree.setFocus([]),this.tree.domFocus(),this.tree.focusFirst())}expandAll(){this.tree&&(this.tree.expandAll(),this.tree.setSelection([]),this.tree.setFocus([]),this.tree.domFocus(),this.tree.focusFirst())}get hasRendered(){return!!this.tree}layoutBodyContent(e=this.currentHeight,t=this.currentWidth){this.messageBoxContainer&&(this.messageBoxContainer.style.height=`${e}px`),this.tree?.layout(e,t),this.currentHeight=e,this.currentWidth=t}createMessageBox(e){this.messageBoxContainer=D(e,_(".message-box-container")),this.messageBoxContainer.setAttribute("tabIndex","0")}renderMessage(){this.messageBoxContainer.textContent=this.commentService.commentsModel.getMessage(),this.messageBoxContainer.classList.toggle("hidden",this.commentService.commentsModel.hasCommentThreads())}makeCommentLocationLabel(e,t){let o=Be(e);return t?t.startLineNumber===t.endLineNumber?d(10321,null,t.startLineNumber,t.startColumn,o):d(10320,null,t.startLineNumber,t.endLineNumber,o):d(10319,null,o)}makeScreenReaderLabelInfo(e,t){let o=e.comment.userName,n=this.makeCommentLocationLabel(e.resource,e.range),r=this.getReplyCountAsString(e,t),s=typeof e.comment.body=="string"?e.comment.body:e.comment.body.value;return{userName:o,locationLabel:n,replyCountLabel:r,bodyLabel:s}}getScreenReaderInfoForNode(e,t){let o="";if(t&&this.configurationService.getValue("accessibility.verbosity.comments")){let u=this.keybindingService.lookupKeybinding(Xee.id)?.getAriaLabel();o=u?d(10315,null,u):d(10316,null)}let n=this.getRepliesAsString(e,t),r=this.editorService.findEditors(e.resource),s=this.editorService.activeEditorPane?.getControl(),l;e.range&&r?.length&&fn(s)&&(l=s.getModel()?.getValueInRange(e.range),l&&(l=`
Corresponding code: 
`+l)),l||(l="");let c=this.makeScreenReaderLabelInfo(e,t);return e.threadRelevance===1?d(10324,null,c.userName,c.bodyLabel,c.locationLabel,c.replyCountLabel,l)+n+o:d(10323,null,c.userName,c.bodyLabel,c.locationLabel,c.replyCountLabel,l)+n+o}getRepliesAsString(e,t){return!e.replies.length||t?"":`
`+e.replies.map(o=>d(10326,null,o.comment.userName,typeof o.comment.body=="string"?o.comment.body:o.comment.body.value)).join(`
`)}getReplyCountAsString(e,t){return e.replies.length&&!t?d(10322,null,e.replies.length):""}createTree(){this.treeLabels=this._register(this.instantiationService.createInstance(jl,this)),this.tree=this._register(this.instantiationService.createInstance(iLe,this.treeLabels,this.treeContainer,{overrideStyles:this.getLocationBasedColors().listOverrideStyles,selectionNavigation:!0,filter:this.filter,sorter:{compare:(e,t)=>{if(e instanceof vG||t instanceof vG)return 0;if(this.filters.sortBy==="updatedAtDescending")return e.lastUpdatedAt>t.lastUpdatedAt?-1:1;if(this.filters.sortBy==="resourceAscending"){if(e instanceof RC&&t instanceof RC){let o=this.pathService.defaultUriScheme;return e.resource.scheme!==t.resource.scheme&&(e.resource.scheme===o||t.resource.scheme===o)?t.resource.scheme===o?1:-1:e.resource.toString()>t.resource.toString()?1:-1}else if(e instanceof u_&&t instanceof u_&&e.thread.range&&t.thread.range)return e.thread.range?.startLineNumber>t.thread.range?.startLineNumber?1:-1}return 0}},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:e=>{}},accessibilityProvider:{getAriaLabel:e=>e instanceof vG?d(10327,null):e instanceof RC?d(10325,null,Be(e.resource),e.resource.fsPath):e instanceof u_?this.getScreenReaderInfoForNode(e,!0):"",getWidgetAriaLabel(){return TZe.value}}})),this._register(this.tree.onDidOpen(e=>{this.openFile(e.element,e.editorOptions.pinned,e.editorOptions.preserveFocus,e.sideBySide)})),this._register(this.tree.onDidChangeModel(()=>{this.updateSomeCommentsExpanded()})),this._register(this.tree.onDidChangeCollapseState(()=>{this.updateSomeCommentsExpanded()})),this._register(this.tree.onDidFocus(()=>this.commentsFocusedContextKey.set(!0))),this._register(this.tree.onDidBlur(()=>this.commentsFocusedContextKey.set(!1)))}openFile(e,t,o,n){if(!e||!(e instanceof RC||e instanceof u_))return;let r=e instanceof RC?e.commentThreads[0].thread:e.thread,s=e instanceof RC?e.commentThreads[0].comment:void 0;return Yee(this.commentService,this.editorService,this.uriIdentityService,r,s,!1,t,o,n)}async refresh(){if(this.tree&&this.isVisible()&&(this.hasCommentsContextKey.set(this.commentService.commentsModel.hasCommentThreads()),this.cachedFilterStats=void 0,this.renderComments(),this.tree.getSelection().length===0&&this.commentService.commentsModel.hasCommentThreads())){let e=this.commentService.commentsModel.resourceCommentThreads[0].commentThreads[0];e&&(this.tree.setFocus([e]),this.tree.setSelection([e]))}}onAllCommentsChanged(e){this.cachedFilterStats=void 0,this.totalComments+=e.commentThreads.length;let t=0;for(let o of e.commentThreads)o.state===0&&t++;this.refresh()}onCommentsUpdated(e){this.cachedFilterStats=void 0,this.totalComments+=e.added.length,this.totalComments-=e.removed.length;let t=0;for(let o of this.commentService.commentsModel.resourceCommentThreads)for(let n of o.commentThreads)n.threadState===0&&t++;this.refresh()}onDataProviderDeleted(e){this.cachedFilterStats=void 0,this.totalComments=0,this.refresh()}updateSomeCommentsExpanded(){this.someCommentsExpandedContextKey.set(this.isSomeCommentsExpanded())}areAllCommentsExpanded(){if(!this.tree)return!1;let e=this.tree.navigate();for(;e.next();)if(this.tree.isCollapsed(e.current()))return!1;return!0}isSomeCommentsExpanded(){if(!this.tree)return!1;let e=this.tree.navigate();for(;e.next();)if(!this.tree.isCollapsed(e.current()))return!0;return!1}};bLe=I([m(1,F),m(2,ji),m(3,ie),m(4,B),m(5,X),m(6,Xe),m(7,Le),m(8,Je),m(9,Pe),m(10,Wm),m(11,ot),m(12,gt),m(13,de),m(14,Pn)],bLe);function Qpo(a,i,e){let t,o,n,r,s;if(i){for(r=i.offset,s=r+i.length,n=r;n>0&&!UZe(a,n-1);)n--;let w=s;for(;w<a.length&&!UZe(a,w);)w++;o=a.substring(n,w),t=bZo(o,e)}else o=a,t=0,n=0,r=0,s=a.length;let l=BCi(e,a),c=!1,u=0,p;e.insertSpaces?p=VCi(" ",e.tabSize||4):p="	";let h=Jue(o,!1),g=!1;function f(){return l+VCi(p,t+u)}function v(){let w=h.scan();for(c=!1;w===15||w===14;)c=c||w===14,w=h.scan();return g=w===16||h.getTokenError()!==0,w}let b=[];function S(w,x,E){!g&&x<s&&E>r&&a.substring(x,E)!==w&&b.push({offset:x,length:E-x,content:w})}let y=v();if(y!==17){let w=h.getTokenOffset()+n,x=VCi(p,t);S(x,n,w)}for(;y!==17;){let w=h.getTokenOffset()+h.getTokenLength()+n,x=v(),E="";for(;!c&&(x===12||x===13);){let N=h.getTokenOffset()+n;S(" ",w,N),w=h.getTokenOffset()+h.getTokenLength()+n,E=x===12?f():"",x=v()}if(x===2)y!==1&&(u--,E=f());else if(x===4)y!==3&&(u--,E=f());else{switch(y){case 3:case 1:u++,E=f();break;case 5:case 12:E=f();break;case 13:c?E=f():E=" ";break;case 6:E=" ";break;case 10:if(x===6){E="";break}case 7:case 8:case 9:case 11:case 2:case 4:x===12||x===13?E=" ":x!==5&&x!==17&&(g=!0);break;case 16:g=!0;break}c&&(x===12||x===13)&&(E=f())}let M=h.getTokenOffset()+n;S(E,w,M),y=x}return b}function dW(a,i){let e=JSON.stringify(a,void 0,i.insertSpaces?i.tabSize||4:"	");return i.eol!==void 0?e.replace(/\r\n|\r|\n/g,i.eol):e}function VCi(a,i){let e="";for(let t=0;t<i;t++)e+=a;return e}function bZo(a,i){let e=0,t=0,o=i.tabSize||4;for(;e<a.length;){let n=a.charAt(e);if(n===" ")t++;else if(n==="	")t+=o;else break;e++}return Math.floor(t/o)}function BCi(a,i){for(let e=0;e<i.length;e++){let t=i.charAt(e);if(t==="\r")return e+1<i.length&&i.charAt(e+1)===`
`?`\r
`:"\r";if(t===`
`)return`
`}return a&&a.eol||`
`}function UZe(a,i){return`\r
`.indexOf(a.charAt(i))!==-1}function ZFt(a,i,e){return rS(a,i,void 0,e)}function rS(a,i,e,t,o){let n=i.slice(),s=xM(a,[]),l,c;for(;n.length>0&&(c=n.pop(),l=Tx(s,n),l===void 0&&e!==void 0);)typeof c=="string"?e={[c]:e}:e=[e];if(l)if(l.type==="object"&&typeof c=="string"&&Array.isArray(l.children)){let u=Tx(l,[c]);if(u!==void 0)if(e===void 0){if(!u.parent)throw new Error("Malformed AST");let p=l.children.indexOf(u.parent),h,g=u.parent.offset+u.parent.length;if(p>0){let f=l.children[p-1];h=f.offset+f.length}else h=l.offset+1,l.children.length>1&&(g=l.children[1].offset);return Jee(a,{offset:h,length:g-h,content:""},t)}else return Jee(a,{offset:u.offset,length:u.length,content:JSON.stringify(e)},t);else{if(e===void 0)return[];let p=`${JSON.stringify(c)}: ${JSON.stringify(e)}`,h=o?o(l.children.map(f=>f.children[0].value)):l.children.length,g;if(h>0){let f=l.children[h-1];g={offset:f.offset+f.length,length:0,content:","+p}}else l.children.length===0?g={offset:l.offset+1,length:0,content:p}:g={offset:l.offset+1,length:0,content:p+","};return Jee(a,g,t)}}else if(l.type==="array"&&typeof c=="number"&&Array.isArray(l.children))if(e!==void 0){let u=`${JSON.stringify(e)}`,p;if(l.children.length===0||c===0)p={offset:l.offset+1,length:0,content:l.children.length===0?u:u+","};else{let h=c===-1||c>l.children.length?l.children.length:c,g=l.children[h-1];p={offset:g.offset+g.length,length:0,content:","+u}}return Jee(a,p,t)}else{let u=c,p=l.children[u],h;if(l.children.length===1)h={offset:l.offset+1,length:l.length-2,content:""};else if(l.children.length-1===u){let g=l.children[u-1],f=g.offset+g.length,v=l.offset+l.length;h={offset:f,length:v-2-f,content:""}}else h={offset:p.offset,length:l.children[u+1].offset-p.offset,content:""};return Jee(a,h,t)}else throw new Error(`Can not add ${typeof c!="number"?"index":"property"} to parent of type ${l.type}`);else return e===void 0?[]:Jee(a,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(e)},t)}function Jee(a,i,e){let t=HCi(a,i),o=i.offset,n=i.offset+i.content.length;if(i.length===0||i.content.length===0){for(;o>0&&!UZe(t,o-1);)o--;for(;n<t.length&&!UZe(t,n);)n++}let r=Qpo(t,{offset:o,length:n-o},e);for(let l=r.length-1;l>=0;l--){let c=r[l];t=HCi(t,c),o=Math.min(o,c.offset),n=Math.max(n,c.offset+c.length),n+=c.content.length-c.length}let s=a.length-(t.length-n)-o;return[{offset:o,length:s,content:t.substring(o,n)}]}function HCi(a,i){return a.substring(0,i.offset)+i.content+a.substring(i.offset+i.length)}function c8(a,i){let e=i.slice(0).sort((o,n)=>{let r=o.offset-n.offset;return r===0?o.length-n.length:r}),t=a.length;for(let o=e.length-1;o>=0;o--){let n=e[o];if(n.offset+n.length<=t)a=HCi(a,n);else throw new Error("Overlapping edit");t=n.offset}return a}var bm=le("workspacesService");function TN(a){return a.hasOwnProperty("workspace")}function YM(a){return a.hasOwnProperty("folderUri")}function UCi(a){return e0t(a)||Xpo(a)}function e0t(a){let i=a;return typeof i?.path=="string"&&(!i.name||typeof i.name=="string")}function Xpo(a){let i=a;return typeof i?.uri=="string"&&(!i.name||typeof i.name=="string")}function zCi(a,i,e,t,o){if(a.scheme!==t.scheme)return{name:e,uri:a.toString(!0)};let n=i?void 0:o.relativePath(t,a);if(n!==void 0)n.length===0?n=".":ii&&(n=Ypo(n));else if(a.scheme===Q.file)n=a.fsPath,ii&&(n=Ypo(n));else if(o.isEqualAuthority(a.authority,t.authority))n=a.path;else return{name:e,uri:a.toString(!0)};return{name:e,path:n}}function Ypo(a){return a=dm(a),Xj(a)||(a=kz(a)),a}function t0t(a,i,e){let t=[],o=new Set,n=e.dirname(i);for(let r of a){let s;if(e0t(r))r.path&&(s=e.resolvePath(n,r.path));else if(Xpo(r))try{s=A.parse(r.uri),s.path[0]!==Vo.sep&&(s=s.with({path:Vo.sep+s.path}))}catch(l){console.warn(l)}if(s){let l=e.getComparisonKey(s);if(!o.has(l)){o.add(l);let c=r.name||e.basenameOrAuthority(s);t.push(new Ode({uri:s,name:c,index:t.length},r))}}}return t}function KCi(a,i,e,t,o){let n=IZo(i,a),r=o.dirname(i),s=o.dirname(t),l=[];for(let h of n.folders){let g=e0t(h)?o.resolvePath(r,h.path):A.parse(h.uri),f;e?f=!1:f=!e0t(h)||Jl(h.path),l.push(zCi(g,f,h.name,s,o))}let c={insertSpaces:!1,tabSize:4,eol:Sn||et?`
`:`\r
`},u=rS(a,["folders"],l,c),p=c8(a,u);return vB(n.remoteAuthority,N4(t))&&(p=c8(p,ZFt(p,["remoteAuthority"],c))),p}function IZo(a,i){let e=is(i);if(e&&Array.isArray(e.folders))e.folders=e.folders.filter(t=>UCi(t));else throw new Error(`${a} looks like an invalid workspace file.`);return e}var i0t=class extends k{constructor(e){super();this.channelName=e;this._onDidReceiveData=this._register(new T);this.onDidReceiveData=this._onDidReceiveData.event;if("BroadcastChannel"in ut)try{this.broadcastChannel=new BroadcastChannel(e);let t=o=>{this._onDidReceiveData.fire(o.data)};this.broadcastChannel.addEventListener("message",t),this._register(ee(()=>{this.broadcastChannel&&(this.broadcastChannel.removeEventListener("message",t),this.broadcastChannel.close())}))}catch(t){console.warn("Error while creating broadcast channel. Falling back to localStorage.",Dn(t))}this.broadcastChannel||(this.channelName=`BroadcastDataChannel.${e}`,this.createBroadcastChannel())}createBroadcastChannel(){let e=t=>{t.key===this.channelName&&t.newValue&&this._onDidReceiveData.fire(JSON.parse(t.newValue))};ut.addEventListener("storage",e),this._register(ee(()=>ut.removeEventListener("storage",e)))}postData(e){this.broadcastChannel?this.broadcastChannel.postMessage(e):(localStorage.removeItem(this.channelName),localStorage.setItem(this.channelName,JSON.stringify(e)))}};var xv=class{constructor(i){this.identifier=i}},ey=class{constructor(i){this.identifier=i}};async function o0t(a){let i=[],e=cr.uriList.toLowerCase();if(a.has(e))try{let t=await a.get(e)?.asString(),o=JSON.stringify($w.parse(t??""));i.push(...Usi(o))}catch{}return i}var uW=class{constructor(i,e,t,o,n,r,s,l){this.options=i;this.fileService=e;this.workspacesService=t;this.editorService=o;this.workspaceEditingService=n;this.hostService=r;this.contextService=s;this.instantiationService=l}async handleDrop(i,e,t,o,n){let r=await this.instantiationService.invokeFunction(u=>dxe(u,i));if(!r.length)return;await this.hostService.focus(e);let s=oe.as(WB.DragAndDropContribution);for(let{resource:u}of r)if(u&&await this.instantiationService.invokeFunction(h=>s.handleResourceDrop(u,h)))return;if(this.options.allowWorkspaceOpen){let u=ui(r.filter(p=>p.allowWorkspaceOpen&&p.resource?.scheme===Q.file).map(p=>p.resource));if(u.length>0&&await this.handleWorkspaceDrop(u))return}let l=ui(r.filter(u=>u.isExternal&&u.resource?.scheme===Q.file).map(u=>u.resource));l.length&&this.workspacesService.addRecentlyOpened(l.map(u=>({fileUri:u})));let c=t?.();await this.editorService.openEditors(r.map(u=>({...u,resource:u.resource,options:{...u.options,...n,pinned:!0}})),c,{validateTrust:!0}),o?.(c)}async handleWorkspaceDrop(i){let e=[],t=[];return await Promise.all(i.map(async o=>{if(jF(o)){e.push({workspaceUri:o});return}try{let n=await this.fileService.stat(o);n.isDirectory&&(e.push({folderUri:n.resource}),t.push({uri:n.resource}))}catch{}})),e.length===0?!1:(e.length>t.length||t.length===1?await this.hostService.openWindow(e):tC(this.contextService.getWorkspace())?await this.workspaceEditingService.addFolders(t):await this.workspaceEditingService.createAndEnterWorkspace(t),!0)}};uW=I([m(1,ge),m(2,bm),m(3,ie),m(4,iS),m(5,ti),m(6,Ae),m(7,F)],uW);function kv(a,i,e,t){if(i.length===0||!e.dataTransfer)return;let o=a.get(Uo),n=a.get(ie),r=a.get(ge),s=a.get(nt),l=ui(i.map(f=>A.isUri(f)?{resource:f}:uYe(f)?A.isUri(f.editor.resource)?{resource:f.editor.resource}:void 0:{resource:f.selection?$L(f.resource,f.selection):f.resource,isDirectory:f.isDirectory,selection:f.selection})),c=l.filter(({resource:f})=>r.hasProvider(f));if(!t?.disableStandardTransfer){let f=ii?`\r
`:`
`;e.dataTransfer.setData(Fl.TEXT,c.map(({resource:b})=>s.getUriLabel(b,{noPrefix:!0})).join(f));let v=c.find(({isDirectory:b})=>!b);if(v){let b=In.uriToFileUri(v.resource);b.scheme===Q.file&&e.dataTransfer.setData(Fl.DOWNLOAD_URL,[cr.binary,Be(v.resource),b.toString()].join(":"))}}let u=c.filter(({isDirectory:f})=>!f);u.length&&e.dataTransfer.setData(Fl.RESOURCES,JSON.stringify(u.map(({resource:f})=>f.toString())));let p=oe.as(WB.DragAndDropContribution).getAll();for(let f of p)f.setData(l,e);let h=[];for(let f of i){let v;if(uYe(f)){let b=f.editor.toUntyped({preserveViewState:f.groupId});b&&(v={...b,resource:po.getCanonicalUri(b)})}else if(A.isUri(f)){let{selection:b,uri:S}=cxe(f);v={resource:S,options:b?{selection:b}:void 0}}else f.isDirectory||(v={resource:f.resource,options:{selection:f.selection}});if(v){{let b=v.resource;if(b){let S=o.files.get(b);S&&(typeof v.languageId!="string"&&(v.languageId=S.getLanguageId()),typeof v.encoding!="string"&&(v.encoding=S.getEncoding()),typeof v.contents!="string"&&S.isDirty()&&!S.textEditorModel.isTooLargeForHeapOperation()&&(v.contents=S.textEditorModel.getValue())),v.options?.viewState||(v.options={...v.options,viewState:(()=>{for(let y of n.visibleEditorPanes)if(ze(y.input.resource,b)){let w=y.getViewState();if(w)return w}})()})}}h.push(v)}}h.length&&e.dataTransfer.setData(Mc.EDITORS,nxe(h));let g=c.filter(({isDirectory:f})=>f).map(({resource:f})=>f);if(h.length||g.length){let f=[...g];for(let v of h)v.resource?f.push(v.options?.selection?$L(v.resource,v.options.selection):v.resource):Ug(v)?v.modified.resource&&f.push(v.modified.resource):GD(v)?v.primary.resource&&f.push(v.primary.resource):Xy(v)&&f.push(v.result.resource);t?.disableStandardTransfer||e.dataTransfer.setData(cr.uriList,$w.create(f.slice(0,1))),e.dataTransfer.setData(Fl.INTERNAL_URI_LIST,$w.create(f))}}var GCi=class{constructor(i,e){this.type=i;this.id=e}update(i){}getData(){return{type:this.type,id:this.id}}},Kme=class{constructor(i){this.compositeId=i}get id(){return this.compositeId}},Gme=class{constructor(i){this.viewId=i}get id(){return this.viewId}},m_=class a extends k{constructor(){super();this.transferData=Vy.getInstance();this.onDragStart=this._register(new T);this.onDragEnd=this._register(new T);this._register(this.onDragEnd.event(e=>{let t=e.dragAndDropData.getData().id,o=e.dragAndDropData.getData().type;this.readDragData(o)?.getData().id===t&&this.transferData.clearData(o==="view"?Gme.prototype:Kme.prototype)}))}static get INSTANCE(){return a.instance||(a.instance=new a,bp(a.instance)),a.instance}readDragData(e){if(this.transferData.hasData(e==="view"?Gme.prototype:Kme.prototype)){let t=this.transferData.getData(e==="view"?Gme.prototype:Kme.prototype);if(t?.[0])return new GCi(e,t[0].id)}}writeDragData(e,t){this.transferData.setData([t==="view"?new Gme(e):new Kme(e)],t==="view"?Gme.prototype:Kme.prototype)}registerTarget(e,t){let o=new O;return o.add(new wg(e,{onDragEnter:n=>{if(n.preventDefault(),t.onDragEnter){let r=this.readDragData("composite")||this.readDragData("view");r&&t.onDragEnter({eventData:n,dragAndDropData:r})}},onDragLeave:n=>{let r=this.readDragData("composite")||this.readDragData("view");t.onDragLeave&&r&&t.onDragLeave({eventData:n,dragAndDropData:r})},onDrop:n=>{if(t.onDrop){let r=this.readDragData("composite")||this.readDragData("view");if(!r)return;t.onDrop({eventData:n,dragAndDropData:r}),this.onDragEnd.fire({eventData:n,dragAndDropData:r})}},onDragOver:n=>{if(n.preventDefault(),t.onDragOver){let r=this.readDragData("composite")||this.readDragData("view");if(!r)return;t.onDragOver({eventData:n,dragAndDropData:r})}}})),t.onDragStart&&this.onDragStart.event(n=>{t.onDragStart(n)},this,o),t.onDragEnd&&this.onDragEnd.event(n=>{t.onDragEnd(n)},this,o),this._register(o)}registerDraggable(e,t,o){e.draggable=!0;let n=new O;return n.add(new wg(e,{onDragStart:r=>{let{id:s,type:l}=t();this.writeDragData(s,l),r.dataTransfer?.setDragImage(e,0,0),this.onDragStart.fire({eventData:r,dragAndDropData:this.readDragData(l)})},onDragEnd:r=>{let{type:s}=t(),l=this.readDragData(s);l&&this.onDragEnd.fire({eventData:r,dragAndDropData:l})},onDragEnter:r=>{if(o.onDragEnter){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;s&&o.onDragEnter({eventData:r,dragAndDropData:s})}},onDragLeave:r=>{let s=this.readDragData("composite")||this.readDragData("view");s&&o.onDragLeave?.({eventData:r,dragAndDropData:s})},onDrop:r=>{if(o.onDrop){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;o.onDrop({eventData:r,dragAndDropData:s}),this.onDragEnd.fire({eventData:r,dragAndDropData:s})}},onDragOver:r=>{if(o.onDragOver){let s=this.readDragData("composite")||this.readDragData("view");if(!s)return;o.onDragOver({eventData:r,dragAndDropData:s})}}})),o.onDragStart&&this.onDragStart.event(r=>{o.onDragStart(r)},this,n),o.onDragEnd&&this.onDragEnd.event(r=>{o.onDragEnd(r)},this,n),this._register(n)}};function u8(a,i,e){a&&(a.dropEffect=e?i:"none")}var d8=class{constructor(i,e){this.toResource=i;this.instantiationService=e}getDragURI(i){let e=this.toResource(i);return e?e.toString():null}getDragLabel(i){let e=ui(i.map(this.toResource));return e.length===1?Be(e[0]):e.length>1?String(e.length):void 0}onDragStart(i,e){let t=[],o=i.elements;for(let n of o){let r=this.toResource(n);r&&t.push(r)}this.onWillDragElements(o,e),t.length&&this.instantiationService.invokeFunction(n=>kv(n,t,e))}onWillDragElements(i,e){}onDragOver(i,e,t,o,n){return!1}drop(i,e,t,o,n){}dispose(){}};d8=I([m(1,F)],d8);var qCi=class a extends k{constructor(){super();this.broadcaster=this._register(new i0t(a.CHANNEL_NAME));this.draggedOver=!1;this.registerListeners()}static{this.CHANNEL_NAME="monaco-workbench-global-dragged-over"}registerListeners(){this._register(U.runAndSubscribe(Of,({window:e,disposables:t})=>{t.add($(e,ne.DRAG_OVER,()=>this.markDraggedOver(!1),!0)),t.add($(e,ne.DRAG_LEAVE,()=>this.clearDraggedOver(!1),!0))},{window:ut,disposables:this._store})),this._register(this.broadcaster.onDidReceiveData(e=>{e===!0?this.markDraggedOver(!0):this.clearDraggedOver(!0)}))}get isDraggedOver(){return this.draggedOver}markDraggedOver(e){this.draggedOver!==!0&&(this.draggedOver=!0,e||this.broadcaster.postData(!0))}clearDraggedOver(e){this.draggedOver!==!1&&(this.draggedOver=!1,e||this.broadcaster.postData(!1))}},yZo=new qCi;function n0t(){return yZo.isDraggedOver}var p8=new R("Views");be.appendMenuItem(R.ViewContainerTitle,{submenu:p8,title:d(5172,null),order:1});var SLe=class a extends ju{constructor(e,t,o,n,r){super(r);this.paneElement=e;this.orientation=t;this.bounds=o;this.location=n;this.cleanupOverlayScheduler=this._register(new Dt(()=>this.dispose(),300)),this.create()}static{this.OVERLAY_ID="monaco-pane-drop-overlay"}get currentDropOperation(){return this._currentDropOperation}get disposed(){return!!this._disposed}create(){this.container=_("div",{id:a.OVERLAY_ID}),this.container.style.top="0px",this.paneElement.appendChild(this.container),this.paneElement.classList.add("dragged-over"),this._register(ee(()=>{this.container.remove(),this.paneElement.classList.remove("dragged-over")})),this.overlay=_(".pane-overlay-indicator"),this.container.appendChild(this.overlay),this.registerListeners(),this.updateStyles()}updateStyles(){this.overlay.style.backgroundColor=this.getColor(this.location===1?nYe:p3)||"";let e=this.getColor(la);this.overlay.style.outlineColor=e||"",this.overlay.style.outlineOffset=e?"-2px":"",this.overlay.style.outlineStyle=e?"dashed":"",this.overlay.style.outlineWidth=e?"2px":"",this.overlay.style.borderColor=e||"",this.overlay.style.borderStyle="solid",this.overlay.style.borderWidth="0px"}registerListeners(){this._register(new wg(this.container,{onDragOver:e=>{this.positionOverlay(e.offsetX,e.offsetY),this.cleanupOverlayScheduler.isScheduled()&&this.cleanupOverlayScheduler.cancel()},onDragLeave:e=>this.dispose(),onDragEnd:e=>this.dispose(),onDrop:e=>{this.dispose()}})),this._register($(this.container,ne.MOUSE_OVER,()=>{this.cleanupOverlayScheduler.isScheduled()||this.cleanupOverlayScheduler.schedule()}))}positionOverlay(e,t){let o=this.paneElement.clientWidth,n=this.paneElement.clientHeight,r=o/2,s=n/2,l;switch(this.orientation===0?t<s?l=0:t>=s&&(l=1):this.orientation===1&&(e<r?l=2:e>=r&&(l=3)),l){case 0:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"50%"});break;case 1:this.doPositionOverlay({bottom:"0",left:"0",width:"100%",height:"50%"});break;case 2:this.doPositionOverlay({top:"0",left:"0",width:"50%",height:"100%"});break;case 3:this.doPositionOverlay({top:"0",right:"0",width:"50%",height:"100%"});break;default:{let c="0",u="0",p="100%",h="100%";if(this.bounds){let g=this.container.getBoundingClientRect();c=`${this.bounds.top-g.top}px`,u=`${this.bounds.left-g.left}px`,h=`${this.bounds.bottom-this.bounds.top}px`,p=`${this.bounds.right-this.bounds.left}px`}this.doPositionOverlay({top:c,left:u,width:p,height:h})}}this.orientation===0&&n<=25||this.orientation===1&&o<=25?this.doUpdateOverlayBorder(l):this.doUpdateOverlayBorder(void 0),this.overlay.style.opacity="1",setTimeout(()=>this.overlay.classList.add("overlay-move-transition"),0),this._currentDropOperation=l}doUpdateOverlayBorder(e){this.overlay.style.borderTopWidth=e===0?"2px":"0px",this.overlay.style.borderLeftWidth=e===2?"2px":"0px",this.overlay.style.borderBottomWidth=e===1?"2px":"0px",this.overlay.style.borderRightWidth=e===3?"2px":"0px"}doPositionOverlay(e){this.container.style.height="100%",this.overlay.style.top=e.top||"",this.overlay.style.left=e.left||"",this.overlay.style.bottom=e.bottom||"",this.overlay.style.right=e.right||"",this.overlay.style.width=e.width,this.overlay.style.height=e.height}contains(e){return e===this.container||e===this.overlay}dispose(){super.dispose(),this._disposed=!0}},Qc=class extends V3{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,u,p);this.options=t;this.instantiationService=o;this.configurationService=n;this.layoutService=r;this.contextMenuService=s;this.telemetryService=l;this.extensionService=c;this.storageService=p;this.contextService=h;this.viewDescriptorService=g;this.logService=f;this.paneItems=[];this.visible=!1;this.areExtensionsReady=!1;this.didLayout=!1;this._onTitleAreaUpdate=this._register(new T);this.onTitleAreaUpdate=this._onTitleAreaUpdate.event;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDidAddViews=this._register(new T);this.onDidAddViews=this._onDidAddViews.event;this._onDidRemoveViews=this._register(new T);this.onDidRemoveViews=this._onDidRemoveViews.event;this._onDidChangeViewVisibility=this._register(new T);this.onDidChangeViewVisibility=this._onDidChangeViewVisibility.event;this._onDidFocusView=this._register(new T);this.onDidFocusView=this._onDidFocusView.event;this._onDidBlurView=this._register(new T);this.onDidBlurView=this._onDidBlurView.event;let v=this.viewDescriptorService.getViewContainerById(e);if(!v)throw new Error("Could not find container");this.viewContainer=v,this.visibleViewsStorageId=`${e}.numberOfVisibleViews`,this.visibleViewsCountFromCache=this.storageService.getNumber(this.visibleViewsStorageId,1,void 0),this.viewContainerModel=this.viewDescriptorService.getViewContainerModel(v)}get onDidSashChange(){return Ti(this.paneview).onDidSashChange}get panes(){return this.paneItems.map(e=>e.pane)}get views(){return this.panes}get length(){return this.paneItems.length}get menuActions(){return this._menuActions}create(e){let t=this.options;t.orientation=this.orientation,this.paneview=this._register(new RFt(e,this.options)),this._boundarySashes&&this.paneview.setBoundarySashes(this._boundarySashes),this._register(this.paneview.onDidDrop(({from:c,to:u})=>this.movePane(c,u))),this._register(this.paneview.onDidScroll(c=>this.onDidScrollPane())),this._register(this.paneview.onDidSashReset(c=>this.onDidSashReset(c))),this._register($(e,ne.CONTEXT_MENU,c=>this.showContextMenu(new Ln(Me(e),c)))),this._register(ds.addTarget(e)),this._register($(e,Vn.Contextmenu,c=>this.showContextMenu(new Ln(Me(e),c)))),this._menuActions=this._register(this.instantiationService.createInstance(rLe,this.paneview.element,this.viewContainer,void 0)),this._register(this._menuActions.onDidChange(()=>this.updateTitleArea()));let o,n=()=>{let c=e.getBoundingClientRect(),u=this.panes[this.panes.length-1].element.getBoundingClientRect(),p=this.orientation===0?u.bottom:c.top,h=this.orientation===1?u.right:c.left;return{top:p,bottom:c.bottom,left:h,right:c.right}},r=(c,u)=>u.x>=c.left&&u.x<=c.right&&u.y>=c.top&&u.y<=c.bottom,s;this.viewDescriptorService.canMoveViews()&&this._register(m_.INSTANCE.registerTarget(e,{onDragEnter:c=>{if(s=n(),o?.disposed&&(o=void 0),!o&&r(s,c.eventData)){let u=c.dragAndDropData.getData();if(u.type==="view"){let p=this.viewDescriptorService.getViewContainerByViewId(u.id),h=this.viewDescriptorService.getViewDescriptorById(u.id);if(p!==this.viewContainer&&(!h||!h.canMoveView||this.viewContainer.rejectAddedViews))return;o=new SLe(e,void 0,s,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService)}if(u.type==="composite"&&u.id!==this.viewContainer.id){let p=this.viewDescriptorService.getViewContainerById(u.id),h=this.viewDescriptorService.getViewContainerModel(p).allViewDescriptors;!h.some(g=>!g.canMoveView)&&h.length>0&&(o=new SLe(e,void 0,s,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService))}}},onDragOver:c=>{o?.disposed&&(o=void 0),o&&!r(s,c.eventData)&&(o.dispose(),o=void 0),r(s,c.eventData)&&u8(c.eventData.dataTransfer,"move",o!==void 0)},onDragLeave:c=>{o?.dispose(),o=void 0},onDrop:c=>{if(o){let u=c.dragAndDropData.getData(),p=[];if(u.type==="composite"&&u.id!==this.viewContainer.id){let g=this.viewDescriptorService.getViewContainerById(u.id),f=this.viewDescriptorService.getViewContainerModel(g).allViewDescriptors;f.some(v=>!v.canMoveView)||p.push(...f)}else if(u.type==="view"){let g=this.viewDescriptorService.getViewContainerByViewId(u.id),f=this.viewDescriptorService.getViewDescriptorById(u.id);g!==this.viewContainer&&f?.canMoveView&&this.viewDescriptorService.moveViewsToContainer([f],this.viewContainer,void 0,"dnd")}let h=this.panes.length;if(p.length>0&&this.viewDescriptorService.moveViewsToContainer(p,this.viewContainer,void 0,"dnd"),h>0)for(let g of p){let f=this.panes.find(v=>v.id===g.id);f&&this.movePane(f,this.panes[this.panes.length-1])}}o?.dispose(),o=void 0}})),this._register(this.onDidSashChange(()=>this.saveViewSizes())),this._register(this.viewContainerModel.onDidAddVisibleViewDescriptors(c=>this.onDidAddViewDescriptors(c))),this._register(this.viewContainerModel.onDidRemoveVisibleViewDescriptors(c=>this.onDidRemoveViewDescriptors(c)));let l=this.viewContainerModel.visibleViewDescriptors.map((c,u)=>{let p=this.viewContainerModel.getSize(c.id),h=this.viewContainerModel.isCollapsed(c.id);return{viewDescriptor:c,index:u,size:p,collapsed:h}});l.length&&this.onDidAddViewDescriptors(l),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this.areExtensionsReady=!0,this.panes.length&&(this.updateTitleArea(),this.updateViewHeaders()),this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("workbench.activityBar.location")&&this.updateViewHeaders()}))}),this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(()=>this._onTitleAreaUpdate.fire()))}getTitle(){let e=this.viewContainerModel.title;if(this.isViewMergedWithContainer()){let t=this.paneItems[0].pane.singleViewPaneContainerTitle;if(t)return t;let o=this.paneItems[0].pane.title;return e===o?o:o?`${e}: ${o}`:e}return e}showContextMenu(e){for(let t of this.paneItems)if(ms(e.target,t.pane.element))return;e.stopPropagation(),e.preventDefault(),this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>this.menuActions?.getContextMenuActions()??[]})}getActionsContext(){if(this.isViewMergedWithContainer())return this.panes[0].getActionsContext()}getActionViewItem(e,t){return this.isViewMergedWithContainer()?this.paneItems[0].pane.createActionViewItem(e,t):ta(this.instantiationService,e,t)}focus(){let e;if(this.lastFocusedPane)e=this.lastFocusedPane;else if(this.paneItems.length>0){for(let{pane:t}of this.paneItems)if(t.isExpanded()){e=t;break}}e&&e.focus()}get orientation(){switch(this.viewDescriptorService.getViewContainerLocation(this.viewContainer)){case 0:case 2:return 0;case 1:return eg(this.layoutService.getPanelPosition())?1:0}return 0}layout(e){this.paneview&&(this.paneview.orientation!==this.orientation&&this.paneview.flipOrientation(e.height,e.width),this.paneview.layout(e.height,e.width)),this.dimension=e,this.didLayout?this.saveViewSizes():(this.didLayout=!0,this.restoreViewSizes())}setBoundarySashes(e){this._boundarySashes=e,this.paneview?.setBoundarySashes(e)}getOptimalWidth(){return Math.max(...this.panes.map(o=>o.getOptimalWidth()||0))+16}addPanes(e){let t=this.isViewMergedWithContainer();for(let{pane:o,size:n,index:r,disposable:s}of e)this.addPane(o,n,s,r);this.updateViewHeaders(),this.isViewMergedWithContainer()!==t&&this.updateTitleArea(),this._onDidAddViews.fire(e.map(({pane:o})=>o))}setVisible(e){this.visible!==!!e&&(this.visible=e,this._onDidChangeVisibility.fire(e)),this.panes.filter(t=>t.isVisible()!==e).map(t=>t.setVisible(e))}isVisible(){return this.visible}updateTitleArea(){this._onTitleAreaUpdate.fire()}createView(e,t){return this.instantiationService.createInstance(e.ctorDescriptor.ctor,...e.ctorDescriptor.staticArguments||[],t)}getView(e){return this.panes.filter(t=>t.id===e)[0]}saveViewSizes(){this.didLayout&&this.viewContainerModel.setSizes(this.panes.map(e=>({id:e.id,size:this.getPaneSize(e)})))}restoreViewSizes(){if(this.didLayout){let e;for(let t=0;t<this.viewContainerModel.visibleViewDescriptors.length;t++){let o=this.panes[t],n=this.viewContainerModel.visibleViewDescriptors[t],r=this.viewContainerModel.getSize(n.id);typeof r=="number"?this.resizePane(o,r):(e=e||this.computeInitialSizes(),this.resizePane(o,e.get(o.id)||200))}}}computeInitialSizes(){let e=new Map;if(this.dimension){let t=this.viewContainerModel.visibleViewDescriptors.reduce((o,{weight:n})=>o+(n||20),0);for(let o of this.viewContainerModel.visibleViewDescriptors)this.orientation===0?e.set(o.id,this.dimension.height*(o.weight||20)/t):e.set(o.id,this.dimension.width*(o.weight||20)/t)}return e}saveState(){this.panes.forEach(e=>e.saveState()),this.storageService.store(this.visibleViewsStorageId,this.length,1,1)}onContextMenu(e,t){e.stopPropagation(),e.preventDefault();let o=t.menuActions.getContextMenuActions();this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>o})}openView(e,t){let o=this.getView(e);return o||this.toggleViewVisibility(e),o=this.getView(e),o&&(o.setExpanded(!0),t&&o.focus()),o}onDidAddViewDescriptors(e){let t=[];for(let{viewDescriptor:n,collapsed:r,index:s,size:l}of e){let c=this.createView(n,{id:n.id,title:n.name.value,fromExtensionId:n.extensionId,expanded:!r,singleViewPaneContainerTitle:n.singleViewPaneContainerTitle});try{c.render()}catch(u){this.logService.error(`Fail to render view ${n.id}`,u);continue}if(c.draggableElement){let u=$(c.draggableElement,"contextmenu",h=>{h.stopPropagation(),h.preventDefault(),this.onContextMenu(new Ln(Me(c.draggableElement),h),c)}),p=U.latch(U.map(c.onDidChange,()=>!c.isExpanded()))(h=>{this.viewContainerModel.setCollapsed(n.id,h)});t.push({pane:c,size:l||c.minimumSize,index:s,disposable:Fn(u,p)})}}this.addPanes(t),this.restoreViewSizes();let o=[];for(let{pane:n}of t)n.setVisible(this.isVisible()),o.push(n);return o}onDidRemoveViewDescriptors(e){e=e.sort((o,n)=>n.index-o.index);let t=[];for(let{index:o}of e)this.paneItems[o]&&t.push(this.paneItems[o].pane);if(t.length){this.removePanes(t);for(let o of t)o.setVisible(!1)}}toggleViewVisibility(e){if(this.viewContainerModel.activeViewDescriptors.some(t=>t.id===e)){let t=!this.viewContainerModel.isVisible(e);this.viewContainerModel.setVisible(e,t)}}addPane(e,t,o,n=this.paneItems.length-1){let r=e.onDidFocus(()=>{this._onDidFocusView.fire(e),this.lastFocusedPane=e}),s=e.onDidBlur(()=>this._onDidBlurView.fire(e)),l=e.onDidChangeTitleArea(()=>{this.isViewMergedWithContainer()&&this.updateTitleArea()}),c=e.onDidChangeBodyVisibility(()=>this._onDidChangeViewVisibility.fire(e)),u=e.onDidChange(()=>{e===this.lastFocusedPane&&!e.isExpanded()&&(this.lastFocusedPane=void 0)}),p=this.viewDescriptorService.getViewContainerLocation(this.viewContainer)===1;e.style({headerForeground:Tt(p?Zro:cso),headerBackground:Tt(p?Jro:lso),headerBorder:Tt(p?eso:Dbi),dropBackground:Tt(p?nYe:p3),leftBorder:p?Tt(wMt):void 0});let h=new O;h.add(o),h.add(Fn(e,r,s,l,u,c));let g={pane:e,disposable:h};this.paneItems.splice(n,0,g),Ti(this.paneview).addPane(e,t,n);let f;this.viewDescriptorService.canMoveViews()&&(e.draggableElement&&h.add(m_.INSTANCE.registerDraggable(e.draggableElement,()=>({type:"view",id:e.id}),{})),h.add(m_.INSTANCE.registerTarget(e.dropTargetElement,{onDragEnter:v=>{if(!f){let b=v.dragAndDropData.getData();if(b.type==="view"&&b.id!==e.id){let S=this.viewDescriptorService.getViewContainerByViewId(b.id),y=this.viewDescriptorService.getViewDescriptorById(b.id);if(S!==this.viewContainer&&(!y||!y.canMoveView||this.viewContainer.rejectAddedViews))return;f=new SLe(e.dropTargetElement,this.orientation??0,void 0,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService)}if(b.type==="composite"&&b.id!==this.viewContainer.id&&!this.viewContainer.rejectAddedViews){let S=this.viewDescriptorService.getViewContainerById(b.id),y=this.viewDescriptorService.getViewContainerModel(S).allViewDescriptors;!y.some(w=>!w.canMoveView)&&y.length>0&&(f=new SLe(e.dropTargetElement,this.orientation??0,void 0,this.viewDescriptorService.getViewContainerLocation(this.viewContainer),this.themeService))}}},onDragOver:v=>{u8(v.eventData.dataTransfer,"move",f!==void 0)},onDragLeave:v=>{f?.dispose(),f=void 0},onDrop:v=>{if(f){let b=v.dragAndDropData.getData(),S=[],y;if(b.type==="composite"&&b.id!==this.viewContainer.id&&!this.viewContainer.rejectAddedViews){let w=this.viewDescriptorService.getViewContainerById(b.id),x=this.viewDescriptorService.getViewContainerModel(w).allViewDescriptors;x.length>0&&!x.some(E=>!E.canMoveView)&&(S.push(...x),y=x[0])}else if(b.type==="view"){let w=this.viewDescriptorService.getViewContainerByViewId(b.id),x=this.viewDescriptorService.getViewDescriptorById(b.id);w!==this.viewContainer&&x&&x.canMoveView&&!this.viewContainer.rejectAddedViews&&S.push(x),x&&(y=x)}if(S&&this.viewDescriptorService.moveViewsToContainer(S,this.viewContainer,void 0,"dnd"),y){if(f.currentDropOperation===1||f.currentDropOperation===3){let w=this.panes.findIndex(E=>E.id===y.id),x=this.panes.findIndex(E=>E.id===e.id);w>=0&&x>=0&&(w>x&&x++,x<this.panes.length&&x!==w&&this.movePane(this.panes[w],this.panes[x]))}if(f.currentDropOperation===0||f.currentDropOperation===2){let w=this.panes.findIndex(E=>E.id===y.id),x=this.panes.findIndex(E=>E.id===e.id);w>=0&&x>=0&&(w<x&&x--,x>=0&&x!==w&&this.movePane(this.panes[w],this.panes[x]))}S.length>1&&S.slice(1).forEach(w=>{let x=this.panes.findIndex(M=>M.id===y.id),E=this.panes.findIndex(M=>M.id===w.id);E>=0&&x>=0&&(E>x&&x++,x<this.panes.length&&x!==E&&(this.movePane(this.panes[E],this.panes[x]),y=w))})}}f?.dispose(),f=void 0}})))}removePanes(e){let t=this.isViewMergedWithContainer();e.forEach(o=>this.removePane(o)),this.updateViewHeaders(),t!==this.isViewMergedWithContainer()&&this.updateTitleArea(),this._onDidRemoveViews.fire(e)}removePane(e){let t=this.paneItems.findIndex(n=>n.pane===e);if(t===-1)return;this.lastFocusedPane===e&&(this.lastFocusedPane=void 0),Ti(this.paneview).removePane(e);let[o]=this.paneItems.splice(t,1);o.disposable.dispose()}movePane(e,t){let o=this.paneItems.findIndex(c=>c.pane===e),n=this.paneItems.findIndex(c=>c.pane===t),r=this.viewContainerModel.visibleViewDescriptors[o],s=this.viewContainerModel.visibleViewDescriptors[n];if(o<0||o>=this.paneItems.length||n<0||n>=this.paneItems.length)return;let[l]=this.paneItems.splice(o,1);this.paneItems.splice(n,0,l),Ti(this.paneview).movePane(e,t),this.viewContainerModel.move(r.id,s.id),this.updateTitleArea()}resizePane(e,t){Ti(this.paneview).resizePane(e,t)}getPaneSize(e){return Ti(this.paneview).getPaneSize(e)}updateViewHeaders(){this.isViewMergedWithContainer()?(this.paneItems[0].pane.isExpanded()?this.lastMergedCollapsedPane=void 0:(this.lastMergedCollapsedPane=this.paneItems[0].pane,this.paneItems[0].pane.setExpanded(!0)),this.paneItems[0].pane.headerVisible=!1,this.paneItems[0].pane.collapsible=!0):(this.paneItems.length===1?(this.paneItems[0].pane.headerVisible=!0,this.paneItems[0].pane===this.lastMergedCollapsedPane&&this.paneItems[0].pane.setExpanded(!1),this.paneItems[0].pane.collapsible=!1):this.paneItems.forEach(e=>{e.pane.headerVisible=!0,e.pane.collapsible=!0,e.pane===this.lastMergedCollapsedPane&&e.pane.setExpanded(!1)}),this.lastMergedCollapsedPane=void 0)}isViewMergedWithContainer(){return this.options.mergeViewWithContainerWhenSingleView&&this.paneItems.length===1?this.areExtensionsReady?!0:this.visibleViewsCountFromCache===void 0?this.paneItems[0].pane.isExpanded():this.visibleViewsCountFromCache===1:!1}onDidScrollPane(){for(let e of this.panes)e.onDidScrollRoot()}onDidSashReset(e){let t,o;for(let n=e;n>=0;n--)if(this.paneItems[n].pane?.isVisible()&&this.paneItems[n]?.pane.isExpanded()){t=this.paneItems[n].pane;break}for(let n=e+1;n<this.paneItems.length;n++)if(this.paneItems[n].pane?.isVisible()&&this.paneItems[n]?.pane.isExpanded()){o=this.paneItems[n].pane;break}if(t&&o){let n=this.getPaneSize(t),r=this.getPaneSize(o),s=Math.ceil((n+r)/2),l=Math.floor((n+r)/2);n>r?(this.resizePane(t,s),this.resizePane(o,l)):(this.resizePane(o,l),this.resizePane(t,s))}}dispose(){super.dispose(),this.paneItems.forEach(e=>e.disposable.dispose()),this.paneview&&this.paneview.dispose()}};Qc=I([m(2,F),m(3,B),m(4,wi),m(5,Xe),m(6,_e),m(7,lt),m(8,Pe),m(9,de),m(10,Ae),m(11,ji),m(12,re)],Qc);var zZe=class extends z{constructor(i){super(i),this.desc=i}run(i,...e){let t=i.get(Gt).getActiveViewPaneContainerWithId(this.desc.viewPaneContainerId);if(t)return this.runInViewPaneContainer(i,t,...e)}},ILe=class extends z{constructor(e,t){super(e);this.offset=t}async run(e){let t=e.get(ji),o=e.get(X),n=rc.getValue(o);if(n===void 0)return;let r=t.getViewContainerByViewId(n),s=t.getViewContainerModel(r),l=s.visibleViewDescriptors.find(p=>p.id===n),c=s.visibleViewDescriptors.indexOf(l);if(c+this.offset<0||c+this.offset>=s.visibleViewDescriptors.length)return;let u=s.visibleViewDescriptors[c+this.offset];s.move(l.id,u.id)}};W(class extends ILe{constructor(){super({id:"views.moveViewUp",title:d(5171,null),keybinding:{primary:Gi(2089,16),weight:201,when:rc.notEqualsTo("")}},-1)}});W(class extends ILe{constructor(){super({id:"views.moveViewLeft",title:d(5169,null),keybinding:{primary:Gi(2089,15),weight:201,when:rc.notEqualsTo("")}},-1)}});W(class extends ILe{constructor(){super({id:"views.moveViewDown",title:d(5168,null),keybinding:{primary:Gi(2089,18),weight:201,when:rc.notEqualsTo("")}},1)}});W(class extends ILe{constructor(){super({id:"views.moveViewRight",title:d(5170,null),keybinding:{primary:Gi(2089,17),weight:201,when:rc.notEqualsTo("")}},1)}});W(class extends z{constructor(){super({id:"vscode.moveViews",title:d(5173,null)})}async run(i,e){if(!Array.isArray(e?.viewIds)||typeof e?.destinationId!="string")return Promise.reject("Invalid arguments");let t=i.get(ji),o=t.getViewContainerById(e.destinationId);if(o){for(let n of e.viewIds){let r=t.getViewDescriptorById(n);r?.canMoveView&&t.moveViewsToContainer([r],o,0,this.desc.id)}await i.get(Gt).openViewContainer(o.id,!0)}}});var $Ci=class{constructor(i,e,t,o,n,r,s,l,c,u){this.commentThreadHandle=i;this.controllerHandle=e;this.extensionId=t;this.threadId=o;this.resource=n;this._range=r;this._canReply=l;this._isTemplate=c;this.editorId=u;this._onDidChangeInput=new T;this._onDidChangeLabel=new T;this.onDidChangeLabel=this._onDidChangeLabel.event;this._onDidChangeComments=new T;this._onDidChangeCanReply=new T;this._collapsibleState=0;this._onDidChangeCollapsibleState=new T;this.onDidChangeCollapsibleState=this._onDidChangeCollapsibleState.event;this._onDidChangeInitialCollapsibleState=new T;this.onDidChangeInitialCollapsibleState=this._onDidChangeInitialCollapsibleState.event;this._onDidChangeApplicability=new T;this.onDidChangeApplicability=this._onDidChangeApplicability.event;this._onDidChangeState=new T;this.onDidChangeState=this._onDidChangeState.event;this._isDisposed=!1,c?this.comments=[]:s&&(this._comments=s)}get input(){return this._input}set input(i){this._input=i,this._onDidChangeInput.fire(i)}get onDidChangeInput(){return this._onDidChangeInput.event}get label(){return this._label}set label(i){this._label=i,this._onDidChangeLabel.fire(this._label)}get contextValue(){return this._contextValue}set contextValue(i){this._contextValue=i}get comments(){return this._comments}set comments(i){this._comments=i,this._onDidChangeComments.fire(this._comments)}get onDidChangeComments(){return this._onDidChangeComments.event}set range(i){this._range=i}get range(){return this._range}get onDidChangeCanReply(){return this._onDidChangeCanReply.event}set canReply(i){this._canReply=i,this._onDidChangeCanReply.fire(!!this._canReply)}get canReply(){return this._canReply}get collapsibleState(){return this._collapsibleState}set collapsibleState(i){this.initialCollapsibleState===void 0&&(this.initialCollapsibleState=i),i!==this._collapsibleState&&(this._collapsibleState=i,this._onDidChangeCollapsibleState.fire(this._collapsibleState))}get initialCollapsibleState(){return this._initialCollapsibleState}set initialCollapsibleState(i){this._initialCollapsibleState=i,this._onDidChangeInitialCollapsibleState.fire(i)}get isDisposed(){return this._isDisposed}isDocumentCommentThread(){return this._range===void 0||G.isIRange(this._range)}get state(){return this._state}set state(i){this._state=i,this._onDidChangeState.fire(this._state)}get applicability(){return this._applicability}set applicability(i){this._applicability=i,this._onDidChangeApplicability.fire(i)}get isTemplate(){return this._isTemplate}batchUpdate(i){let e=t=>Object.prototype.hasOwnProperty.call(i,t);e("range")&&(this._range=i.range),e("label")&&(this._label=i.label),e("contextValue")&&(this._contextValue=i.contextValue===null?void 0:i.contextValue),e("comments")&&(this.comments=i.comments),e("collapseState")&&(this.collapsibleState=i.collapseState),e("canReply")&&(this.canReply=i.canReply),e("state")&&(this.state=i.state),e("applicability")&&(this.applicability=i.applicability),e("isTemplate")&&(this._isTemplate=i.isTemplate)}hasComments(){return!!this.comments&&this.comments.length>0}dispose(){this._isDisposed=!0,this._onDidChangeCollapsibleState.dispose(),this._onDidChangeInitialCollapsibleState.dispose(),this._onDidChangeComments.dispose(),this._onDidChangeInput.dispose(),this._onDidChangeLabel.dispose(),this._onDidChangeCanReply.dispose(),this._onDidChangeState.dispose(),this._onDidChangeApplicability.dispose()}toJSON(){return{$mid:7,commentControlHandle:this.controllerHandle,commentThreadHandle:this.commentThreadHandle}}},jCi=class{constructor(i){this.thread=i;this.disposableStore=new O}dispose(){this.disposableStore.dispose()}},KZe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._proxy=e;this._handle=t;this._uniqueId=o;this._id=n;this._label=r;this._features=s;this._commentService=l;this._uriIdentityService=c;this._threads=this._register(new Ot)}get handle(){return this._handle}get id(){return this._id}get contextValue(){return this._id}get proxy(){return this._proxy}get label(){return this._label}get reactions(){return this._reactions}set reactions(e){this._reactions=e}get options(){return this._features.options}get features(){return this._features}get owner(){return this._id}get activeComment(){return this._activeComment}async setActiveCommentAndThread(e){return this._activeComment=e,this._proxy.$setActiveComment(this._handle,e?{commentThreadHandle:e.thread.commentThreadHandle,uniqueIdInThread:e.comment?.uniqueIdInThread}:void 0)}updateFeatures(e){this._features=e}createCommentThread(e,t,o,n,r,s,l,c){let u=new $Ci(t,this.handle,e,o,A.revive(n).toString(),r,s,!0,l,c),p=new jCi(u);return this._threads.set(t,p),p.disposableStore.add(u.onDidChangeCollapsibleState(()=>{this.proxy.$updateCommentThread(this.handle,u.commentThreadHandle,{collapseState:u.collapsibleState})})),u.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[u],removed:[],changed:[],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[u],removed:[],changed:[],pending:[]}),u}updateCommentThread(e,t,o,n){let r=this.getKnownThread(e);r.batchUpdate(n),r.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[],removed:[],changed:[r],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[],removed:[],changed:[r],pending:[]})}deleteCommentThread(e){let t=this.getKnownThread(e);this._threads.deleteAndDispose(e),t.dispose(),t.isDocumentCommentThread()?this._commentService.updateComments(this._uniqueId,{added:[],removed:[t],changed:[],pending:[]}):this._commentService.updateNotebookComments(this._uniqueId,{added:[],removed:[t],changed:[],pending:[]})}deleteCommentThreadMain(e){for(let{thread:t}of this._threads.values())t.threadId===e&&this._proxy.$deleteCommentThread(this._handle,t.commentThreadHandle)}updateInput(e){let t=this.activeEditingCommentThread;if(t&&t.input){let o=t.input;o.value=e,t.input=o}}updateCommentingRanges(e){this._commentService.updateCommentingRanges(this._uniqueId,e)}getKnownThread(e){let t=this._threads.get(e);if(!t)throw new Error("unknown thread");return t.thread}async getDocumentComments(e,t){if(e.scheme===Q.vscodeNotebookCell)return{uniqueOwner:this._uniqueId,label:this.label,threads:[],commentingRanges:{resource:e,ranges:[],fileComments:!1}};let o=[];for(let r of[...this._threads.keys()]){let s=this._threads.get(r);s.thread.resource&&this._uriIdentityService.extUri.isEqual(A.parse(s.thread.resource),e)&&s.thread.isDocumentCommentThread()&&o.push(s.thread)}let n=await this._proxy.$provideCommentingRanges(this.handle,e,t);return{uniqueOwner:this._uniqueId,label:this.label,threads:o,commentingRanges:{resource:e,ranges:n?.ranges||[],fileComments:!!n?.fileComments}}}async getNotebookComments(e,t){if(e.scheme!==Q.vscodeNotebookCell)return{uniqueOwner:this._uniqueId,label:this.label,threads:[]};let o=[];for(let n of[...this._threads.keys()]){let r=this._threads.get(n);r.thread.resource===e.toString()&&(r.thread.isDocumentCommentThread()||o.push(r.thread))}return{uniqueOwner:this._uniqueId,label:this.label,threads:o}}async toggleReaction(e,t,o,n,r){return this._proxy.$toggleReaction(this._handle,t.commentThreadHandle,e,o,n)}getAllComments(){let e=[];for(let t of[...this._threads.keys()])e.push(this._threads.get(t).thread);return e}createCommentThreadTemplate(e,t,o){return this._proxy.$createCommentThreadTemplate(this.handle,e,t,o)}async updateCommentThreadTemplate(e,t){await this._proxy.$updateCommentThreadTemplate(this.handle,e,t)}toJSON(){return{$mid:6,handle:this.handle}}};KZe=I([m(6,Wm),m(7,gt)],KZe);var Jpo=Oe("comments-view-icon",L.commentDiscussion,d(3909,null)),r0t=class extends k{constructor(e,t,o,n,r,s,l){super();this._commentService=t;this._viewsService=o;this._viewDescriptorService=n;this._uriIdentityService=r;this._editorService=s;this._instantiationService=l;this._handlers=new Map;this._commentControllers=new Map;this._activeEditingCommentThreadDisposables=this._register(new O);this._openViewListener=this._register(new ue);this._onChangeContainerListener=this._register(new ue);this._onChangeContainerLocationListener=this._register(new ue);this._proxy=e.getProxy(ao.ExtHostComments),this._commentService.unregisterCommentController(),this._register(this._commentService.onDidChangeActiveEditingCommentThread(async c=>{let u=c.controllerHandle,p=this._commentControllers.get(u);p&&(this._activeEditingCommentThreadDisposables.clear(),this._activeEditingCommentThread=c,p.activeEditingCommentThread=this._activeEditingCommentThread)})),this._register(this._commentService.onResourceHasCommentingRanges(()=>{this.registerView()})),this._register(this._commentService.onDidUpdateCommentThreads(()=>{this.registerView()}))}$registerCommentController(e,t,o,n){let r=`${t}-${n}`;this._handlers.set(e,r);let s=this._instantiationService.createInstance(KZe,this._proxy,e,r,t,o,{});this._commentService.registerCommentController(r,s),this._commentControllers.set(e,s),this._commentService.setWorkspaceComments(String(e),[])}$unregisterCommentController(e){let t=this._handlers.get(e);this._handlers.delete(e),this._commentControllers.get(e)?.dispose(),this._commentControllers.delete(e),typeof t=="string"&&this._commentService.unregisterCommentController(t)}$updateCommentControllerFeatures(e,t){let o=this._commentControllers.get(e);o&&o.updateFeatures(t)}$createCommentThread(e,t,o,n,r,s,l,c,u){let p=this._commentControllers.get(e);if(p)return p.createCommentThread(l.value,t,o,n,r,s,c,u)}$updateCommentThread(e,t,o,n,r){let s=this._commentControllers.get(e);if(s)return s.updateCommentThread(t,o,n,r)}$deleteCommentThread(e,t){let o=this._commentControllers.get(e);if(o)return o.deleteCommentThread(t)}$updateCommentingRanges(e,t){let o=this._commentControllers.get(e);o&&o.updateCommentingRanges(t)}async $revealCommentThread(e,t,o,n){let r=this._commentControllers.get(e);if(!r)return Promise.resolve();let s=r.getAllComments().find(c=>c.commentThreadHandle===t);if(!s||!s.isDocumentCommentThread())return Promise.resolve();let l=s.comments?.find(c=>c.uniqueIdInThread===o);Yee(this._commentService,this._editorService,this._uriIdentityService,s,l,n.focusReply,void 0,n.preserveFocus)}async $hideCommentThread(e,t){let o=this._commentControllers.get(e);if(!o)return Promise.resolve();let n=o.getAllComments().find(r=>r.commentThreadHandle===t);if(!n||!n.isDocumentCommentThread())return Promise.resolve();n.collapsibleState=0}registerView(){let e=!!this._viewDescriptorService.getViewDescriptorById(gp);if(!e){let t=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:gp,title:TZe,ctorDescriptor:new Vt(Qc,[gp,{mergeViewWithContainerWhenSingleView:!0}]),storageId:bpo,hideIfEmpty:!0,icon:Jpo,order:10},1);oe.as(Kn.ViewsRegistry).registerViews([{id:gp,name:TZe,canToggleVisibility:!1,ctorDescriptor:new Vt(bLe),canMoveView:!0,containerIcon:Jpo,focusCommand:{id:"workbench.action.focusCommentsPanel"}}],t)}this.registerViewListeners(e)}setComments(){[...this._commentControllers.keys()].forEach(e=>{let t=this._commentControllers.get(e).getAllComments();if(t.length){let o=this.getHandler(e);this._commentService.setWorkspaceComments(o,t)}})}registerViewOpenedListener(){this._openViewListener.value||(this._openViewListener.value=this._viewsService.onDidChangeViewVisibility(e=>{e.id===gp&&e.visible&&(this.setComments(),this._openViewListener&&this._openViewListener.dispose())}))}registerViewListeners(e){e||this.registerViewOpenedListener(),this._onChangeContainerListener.value||(this._onChangeContainerListener.value=this._viewDescriptorService.onDidChangeContainer(t=>{t.views.find(o=>o.id===gp)&&(this.setComments(),this.registerViewOpenedListener())})),this._onChangeContainerLocationListener.value||(this._onChangeContainerLocationListener.value=this._viewDescriptorService.onDidChangeContainerLocation(t=>{let o=this._viewDescriptorService.getViewContainerByViewId(gp);t.viewContainer.id===o?.id&&(this.setComments(),this.registerViewOpenedListener())}))}getHandler(e){if(!this._handlers.has(e))throw new Error("Unknown handler");return this._handlers.get(e)}};r0t=I([fo(Xi.MainThreadComments),m(1,Wm),m(2,Gt),m(3,ji),m(4,gt),m(5,ie),m(6,F)],r0t);var Zee=le("notebookCellStatusBarService");var s0t=class{constructor(i,e,t,o){this._notebookService=e;this._cellStatusBarService=t;this._logService=o;this._disposables=new O;this._notebookSerializer=new Map;this._notebookCellStatusBarRegistrations=new Map;this._proxy=i.getProxy(ao.ExtHostNotebook)}dispose(){this._disposables.dispose(),je(this._notebookSerializer.values())}$registerNotebookSerializer(i,e,t,o,n){let r=new O;r.add(this._notebookService.registerNotebookSerializer(t,e,{options:o,dataToNotebook:async s=>{let l=new On,c;if(s.byteLength===0&&t==="interactive")c=$I.fromNotebookDataDto({cells:[],metadata:{}});else{let u=await this._proxy.$dataToNotebook(i,s,Ie.None);c=$I.fromNotebookDataDto(u.value)}return this._logService.trace(`[NotebookSerializer] dataToNotebook DONE after ${l.elapsed()}ms`,{viewType:t,extensionId:e.id.value}),c},notebookToData:s=>{let l=new On,c=this._proxy.$notebookToData(i,new Hg($I.toNotebookDataDto(s)),Ie.None);return this._logService.trace(`[NotebookSerializer] notebookToData DONE after ${l.elapsed()}`,{viewType:t,extensionId:e.id.value}),c},save:async(s,l,c,u)=>{let p=await this._proxy.$saveNotebook(i,s,l,c,u);if(CZo(p))throw new ua(p.message,p.fileOperationResult,p.options);return{...p,children:void 0,resource:s}},searchInNotebooks:async(s,l,c)=>{let u=this._notebookService.getContributedNotebookType(t);if(!u)return{results:[],limitHit:!1};let h=u.selectors.map(S=>(S.include||S).toString());if(!h.length)return{results:[],limitHit:!1};let g=ui([{isFromSettings:!1,filenamePatterns:h},...c.get(t)??[]]),f=Array.from(c.keys()).flatMap(S=>S!==t?c.get(S)??[]:[]),v=await this._proxy.$searchInNotebooks(i,s,g,f,l);return{results:v.results.map(S=>({resource:A.revive(S.resource),cellResults:S.cellResults.map(w=>er(w))})),limitHit:v.limitHit}}})),n&&r.add(this._notebookService.registerContributedNotebookType(t,n)),this._notebookSerializer.set(i,r),this._logService.trace("[NotebookSerializer] registered notebook serializer",{viewType:t,extensionId:e.id.value})}$unregisterNotebookSerializer(i){this._notebookSerializer.get(i)?.dispose(),this._notebookSerializer.delete(i)}$emitCellStatusBarEvent(i){let e=this._notebookCellStatusBarRegistrations.get(i);e instanceof T&&e.fire(void 0)}async $registerNotebookCellStatusBarItemProvider(i,e,t){let o=this,n={async provideCellStatusBarItems(s,l,c){let u=await o._proxy.$provideNotebookCellStatusBarItems(i,s,l,c);return{items:u?.items??[],dispose(){u&&o._proxy.$releaseNotebookCellStatusBarItems(u.cacheId)}}},viewType:t};if(typeof e=="number"){let s=new T;this._notebookCellStatusBarRegistrations.set(e,s),n.onDidChangeStatusBarItems=s.event}let r=this._cellStatusBarService.registerCellStatusBarItemProvider(n);this._notebookCellStatusBarRegistrations.set(i,r)}async $unregisterNotebookCellStatusBarItemProvider(i,e){let t=o=>{this._notebookCellStatusBarRegistrations.get(o)&&(this._notebookCellStatusBarRegistrations.get(o)?.dispose(),this._notebookCellStatusBarRegistrations.delete(o))};t(i),typeof e=="number"&&t(e)}};s0t=I([fo(Xi.MainThreadNotebook),m(1,kn),m(2,Zee),m(3,re)],s0t);Ge.registerCommand("_executeDataToNotebook",async(a,...i)=>{let[e,t]=i;To(typeof e=="string","string"),To(t instanceof Ke,"VSBuffer");let n=await a.get(kn).withNotebookDataProvider(e);if(!(n instanceof LM))return;let r=await n.serializer.dataToNotebook(t);return new Hg($I.toNotebookDataDto(r))});Ge.registerCommand("_executeNotebookToData",async(a,i,e)=>{To(typeof i=="string","string");let o=await a.get(kn).withNotebookDataProvider(i);if(!(o instanceof LM))return;let n=$I.fromNotebookDataDto(e.value);return await o.serializer.notebookToData(n)});function CZo(a){let i=a;return typeof i?.fileOperationResult=="number"&&typeof i?.message=="string"}var hd=le("INotebookEditorWidgetService");var Ns=le("INotebookExecutionStateService");var a0t=100;var Ql=le("INotebookKernelService"),XM=le("INotebookKernelHistoryService");var QCi=class{constructor(i,e){this._languageService=e;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this.id=i.id,this.viewType=i.notebookType,this.extension=i.extensionId,this.implementsInterrupt=i.supportsInterrupt??!1,this.label=i.label,this.description=i.description,this.detail=i.detail,this.supportedLanguages=Rr(i.supportedLanguages)?i.supportedLanguages:e.getRegisteredLanguageIds(),this.implementsExecutionOrder=i.supportsExecutionOrder??!1,this.hasVariableProvider=i.hasVariableProvider??!1,this.localResourceRoot=A.revive(i.extensionLocation),this.preloads=i.preloads?.map(t=>({uri:A.revive(t.uri),provides:t.provides}))??[]}get preloadUris(){return this.preloads.map(i=>i.uri)}get preloadProvides(){return this.preloads.flatMap(i=>i.provides)}update(i){let e=Object.create(null);i.label!==void 0&&(this.label=i.label,e.label=!0),i.description!==void 0&&(this.description=i.description,e.description=!0),i.detail!==void 0&&(this.detail=i.detail,e.detail=!0),i.supportedLanguages!==void 0&&(this.supportedLanguages=Rr(i.supportedLanguages)?i.supportedLanguages:this._languageService.getRegisteredLanguageIds(),e.supportedLanguages=!0),i.supportsExecutionOrder!==void 0&&(this.implementsExecutionOrder=i.supportsExecutionOrder,e.hasExecutionOrder=!0),i.supportsInterrupt!==void 0&&(this.implementsInterrupt=i.supportsInterrupt,e.hasInterruptHandler=!0),i.hasVariableProvider!==void 0&&(this.hasVariableProvider=i.hasVariableProvider,e.hasVariableProvider=!0),this._onDidChange.fire(e)}},YCi=class{constructor(i){this.notebookType=i}},l0t=class{constructor(i,e,t,o,n,r){this._languageService=e;this._notebookKernelService=t;this._notebookExecutionStateService=o;this._notebookService=n;this._editors=new Ot;this._disposables=new O;this._kernels=new Map;this._kernelDetectionTasks=new Map;this._kernelSourceActionProviders=new Map;this._kernelSourceActionProvidersEventRegistrations=new Map;this._executions=new Map;this._notebookExecutions=new Map;this.variableRequestIndex=0;this.variableRequestMap=new Map;this._proxy=i.getProxy(ao.ExtHostNotebookKernels),r.listNotebookEditors().forEach(this._onEditorAdd,this),r.onDidAddNotebookEditor(this._onEditorAdd,this,this._disposables),r.onDidRemoveNotebookEditor(this._onEditorRemove,this,this._disposables),this._disposables.add(ee(()=>{this._executions.forEach(s=>{s.complete({})}),this._notebookExecutions.forEach(s=>s.complete())})),this._disposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(s=>{for(let[l,[c]]of this._kernels)s.oldKernel===c.id?this._proxy.$acceptNotebookAssociation(l,s.notebook,!1):s.newKernel===c.id&&this._proxy.$acceptNotebookAssociation(l,s.notebook,!0)}))}dispose(){this._disposables.dispose();for(let[,i]of this._kernels.values())i.dispose();for(let[,i]of this._kernelDetectionTasks.values())i.dispose();for(let[,i]of this._kernelSourceActionProviders.values())i.dispose();this._editors.dispose()}_onEditorAdd(i){let e=i.onDidReceiveMessage(t=>{if(!i.hasModel())return;let{selected:o}=this._notebookKernelService.getMatchingKernel(i.textModel);if(o){for(let[n,r]of this._kernels)if(r[0]===o){this._proxy.$acceptKernelMessageFromRenderer(n,i.getId(),t.message);break}}});this._editors.set(i,e)}_onEditorRemove(i){this._editors.deleteAndDispose(i)}async $postMessage(i,e,t){let o=this._kernels.get(i);if(!o)throw new Error("kernel already disposed");let[n]=o,r=!1;for(let[s]of this._editors)if(s.hasModel()&&this._notebookKernelService.getMatchingKernel(s.textModel).selected===n){if(e===void 0)s.postMessage(t),r=!0;else if(s.getId()===e){s.postMessage(t),r=!0;break}}return r}$receiveVariable(i,e){let t=this.variableRequestMap.get(i);t&&t.emitOne(e)}async $addKernel(i,e){let t=this,o=new class extends QCi{async executeNotebookCellsRequest(r,s){await t._proxy.$executeCells(i,r,s)}async cancelNotebookCellExecution(r,s){await t._proxy.$cancelCells(i,r,s)}provideVariables(r,s,l,c,u){let p=`${i}variables${t.variableRequestIndex++}`;return new Fp(async h=>{t.variableRequestMap.set(p,h);try{await t._proxy.$provideVariables(i,p,r,s,l,c,u)}finally{t.variableRequestMap.delete(p)}})}}(e,this._languageService),n=this._disposables.add(new O);this._kernels.set(i,[o,n]),n.add(this._notebookKernelService.registerKernel(o))}$updateKernel(i,e){let t=this._kernels.get(i);t&&t[0].update(e)}$removeKernel(i){let e=this._kernels.get(i);e&&(e[1].dispose(),this._kernels.delete(i))}$updateNotebookPriority(i,e,t){let o=this._kernels.get(i);o&&this._notebookKernelService.updateKernelNotebookAffinity(o[0],A.revive(e),t)}$createExecution(i,e,t,o){let n=A.revive(t),r=this._notebookService.getNotebookTextModel(n);if(!r)throw new Error(`Notebook not found: ${n.toString()}`);let s=this._notebookKernelService.getMatchingKernel(r);if(!s.selected||s.selected.id!==e)throw new Error(`Kernel is not selected: ${s.selected?.id} !== ${e}`);let l=this._notebookExecutionStateService.createCellExecution(n,o);l.confirm(),this._executions.set(i,l)}$updateExecution(i,e){let t=e.value;try{this._executions.get(i)?.update(t.map($I.fromCellExecuteUpdateDto))}catch(o){mt(o)}}$completeExecution(i,e){try{this._executions.get(i)?.complete($I.fromCellExecuteCompleteDto(e.value))}catch(t){mt(t)}finally{this._executions.delete(i)}}$createNotebookExecution(i,e,t){let o=A.revive(t),n=this._notebookService.getNotebookTextModel(o);if(!n)throw new Error(`Notebook not found: ${o.toString()}`);let r=this._notebookKernelService.getMatchingKernel(n);if(!r.selected||r.selected.id!==e)throw new Error(`Kernel is not selected: ${r.selected?.id} !== ${e}`);let s=this._notebookExecutionStateService.createExecution(o);s.confirm(),this._notebookExecutions.set(i,s)}$beginNotebookExecution(i){try{this._notebookExecutions.get(i)?.begin()}catch(e){mt(e)}}$completeNotebookExecution(i){try{this._notebookExecutions.get(i)?.complete()}catch(e){mt(e)}finally{this._notebookExecutions.delete(i)}}async $addKernelDetectionTask(i,e){let t=new YCi(e),o=this._notebookKernelService.registerNotebookKernelDetectionTask(t);this._kernelDetectionTasks.set(i,[t,o])}$removeKernelDetectionTask(i){let e=this._kernelDetectionTasks.get(i);e&&(e[1].dispose(),this._kernelDetectionTasks.delete(i))}async $addKernelSourceActionProvider(i,e,t){let o={viewType:t,provideKernelSourceActions:async()=>(await this._proxy.$provideKernelSourceActions(i,Ie.None)).map(s=>{let l=s.documentation;return s.documentation&&typeof s.documentation!="string"&&(l=A.revive(s.documentation)),{label:s.label,command:s.command,description:s.description,detail:s.detail,documentation:l}})};if(typeof e=="number"){let r=new T;this._kernelSourceActionProvidersEventRegistrations.set(e,r),o.onDidChangeSourceActions=r.event}let n=this._notebookKernelService.registerKernelSourceActionProvider(t,o);this._kernelSourceActionProviders.set(i,[o,n])}$removeKernelSourceActionProvider(i,e){let t=this._kernelSourceActionProviders.get(i);t&&(t[1].dispose(),this._kernelSourceActionProviders.delete(i)),typeof e=="number"&&this._kernelSourceActionProvidersEventRegistrations.delete(e)}$emitNotebookKernelSourceActionsChangeEvent(i){let e=this._kernelSourceActionProvidersEventRegistrations.get(i);e instanceof T&&e.fire(void 0)}$variablesUpdated(i){this._notebookKernelService.notifyVariablesChange(A.revive(i))}};l0t=I([fo(Xi.MainThreadNotebookKernels),m(1,Rt),m(2,Ql),m(3,Ns),m(4,kn),m(5,hd)],l0t);var yLe=class{constructor(i,e,t){this._notebookEditorModelResolverService=e;this._uriIdentityService=t;this._disposables=new O;this._documentEventListenersMapping=new dt;this._proxy=i.getProxy(ao.ExtHostNotebookDocuments),this._modelReferenceCollection=new PXe(this._uriIdentityService.extUri),this._disposables.add(this._notebookEditorModelResolverService.onDidChangeDirty(o=>this._proxy.$acceptDirtyStateChanged(o.resource,o.isDirty()))),this._disposables.add(this._notebookEditorModelResolverService.onDidSaveNotebook(o=>this._proxy.$acceptModelSaved(o))),this._disposables.add(e.onWillFailWithConflict(o=>{this._modelReferenceCollection.remove(o.resource)}))}dispose(){this._disposables.dispose(),this._modelReferenceCollection.dispose(),je(this._documentEventListenersMapping.values())}handleNotebooksAdded(i){for(let e of i){let t=new O;t.add(e.onDidChangeContent(o=>{let n={versionId:o.versionId,rawEvents:[]};for(let s of o.rawEvents)switch(s.kind){case 1:n.rawEvents.push({kind:s.kind,changes:s.changes.map(l=>[l[0],l[1],l[2].map(c=>$I.toNotebookCellDto(c))])});break;case 2:n.rawEvents.push({kind:s.kind,index:s.index,length:s.length,newIdx:s.newIdx});break;case 8:n.rawEvents.push({kind:s.kind,index:s.index,outputs:s.outputs.map($I.toNotebookOutputDto)});break;case 9:n.rawEvents.push({kind:s.kind,index:s.index,outputId:s.outputId,outputItems:s.outputItems.map($I.toNotebookOutputItemDto),append:s.append});break;case 5:case 10:case 7:case 12:n.rawEvents.push(s);break}let r=o.rawEvents.find(s=>s.kind===11);this._proxy.$acceptModelChanged(e.uri,new Hg(n),this._notebookEditorModelResolverService.isDirty(e.uri),r?e.metadata:void 0)})),this._documentEventListenersMapping.set(e.uri,t)}}handleNotebooksRemoved(i){for(let e of i)this._documentEventListenersMapping.get(e)?.dispose(),this._documentEventListenersMapping.delete(e)}async $tryCreateNotebook(i){if(i.content){let e=await this._notebookEditorModelResolverService.resolve({untitledResource:void 0},i.viewType);if(U.once(e.object.notebook.onWillDispose)(()=>{e.dispose()}),this._proxy.$acceptDirtyStateChanged(e.object.resource,!0),i.content){let t=$I.fromNotebookDataDto(i.content);e.object.notebook.reset(t.cells,t.metadata,e.object.notebook.transientOptions)}return e.object.notebook.uri}else return(await this._notebookEditorModelResolverService.createUntitledNotebookTextModel(i.viewType)).uri}async $tryOpenNotebook(i){let e=A.revive(i),t=await this._notebookEditorModelResolverService.resolve(e,void 0);return i.scheme==="untitled"&&t.object.notebook.onWillDispose(()=>{t.dispose()}),this._modelReferenceCollection.add(e,t),e}async $trySaveNotebook(i){let e=A.revive(i),t=await this._notebookEditorModelResolverService.resolve(e),o=await t.object.save();return t.dispose(),o}};yLe=I([m(1,Yh),m(2,gt)],yLe);var XCi=class{constructor(i,e){this.editor=i;this.disposables=e}dispose(){this.disposables.dispose()}},wLe=class{constructor(i,e,t,o,n){this._editorService=e;this._notebookEditorService=t;this._editorGroupService=o;this._configurationService=n;this._disposables=new O;this._mainThreadEditors=new Map;this._proxy=i.getProxy(ao.ExtHostNotebookEditors),this._editorService.onDidActiveEditorChange(()=>this._updateEditorViewColumns(),this,this._disposables),this._editorGroupService.onDidRemoveGroup(()=>this._updateEditorViewColumns(),this,this._disposables),this._editorGroupService.onDidMoveGroup(()=>this._updateEditorViewColumns(),this,this._disposables)}dispose(){this._disposables.dispose(),je(this._mainThreadEditors.values())}handleEditorsAdded(i){for(let e of i){let t=new O;t.add(e.onDidChangeVisibleRanges(()=>{this._proxy.$acceptEditorPropertiesChanged(e.getId(),{visibleRanges:{ranges:e.visibleRanges}})})),t.add(e.onDidChangeSelection(()=>{this._proxy.$acceptEditorPropertiesChanged(e.getId(),{selections:{selections:e.getSelections()}})}));let o=new XCi(e,t);this._mainThreadEditors.set(e.getId(),o)}}handleEditorsRemoved(i){for(let e of i)this._mainThreadEditors.get(e)?.dispose(),this._mainThreadEditors.delete(e)}_updateEditorViewColumns(){let i=Object.create(null);for(let e of this._editorService.visibleEditorPanes){let t=lr(e);t&&this._mainThreadEditors.has(t.getId())&&(i[t.getId()]=Fx(this._editorGroupService,e.group))}Qi(i,this._currentViewColumnInfo)||(this._currentViewColumnInfo=i,this._proxy.$acceptEditorViewColumns(i))}async $tryShowNotebookDocument(i,e,t){let o={cellSelections:t.selections,preserveFocus:t.preserveFocus,pinned:t.pinned,activation:t.preserveFocus?2:void 0,label:t.label,override:e},n=await this._editorService.openEditor({resource:A.revive(i),options:o},SE(this._editorGroupService,this._configurationService,t.position)),r=lr(n);if(r)return r.getId();throw new Error(`Notebook Editor creation failure for document ${JSON.stringify(i)}`)}async $tryRevealRange(i,e,t){let o=this._notebookEditorService.getNotebookEditor(i);if(!o)return;let n=o;if(!n.hasModel()||e.start>=n.getLength())return;let r=n.cellAt(e.start);switch(t){case 0:return n.revealCellRangeInView(e);case 1:return n.revealInCenter(r);case 2:return n.revealInCenterIfOutsideViewport(r);case 3:return n.revealInViewAtTop(r)}}$trySetSelections(i,e){let t=this._notebookEditorService.getNotebookEditor(i);t&&(t.setSelections(e),e.length&&t.setFocus({start:e[0].start,end:e[0].start+1}))}};wLe=I([m(1,ie),m(2,hd),m(3,kt),m(4,B)],wLe);var c0t=class{constructor(i,e,t,o){this.documents=i;this.textEditors=e;this.activeEditor=t;this.visibleEditors=o}static delta(i,e){if(!i)return{addedDocuments:[...e.documents],removedDocuments:[],addedEditors:[...e.textEditors.values()],removedEditors:[],visibleEditors:[...e.visibleEditors].map(s=>s[0])};let t=cz(i.documents,e.documents),o=q5e(i.textEditors,e.textEditors),n=i.activeEditor!==e.activeEditor?e.activeEditor:void 0,r=q5e(i.visibleEditors,e.visibleEditors);return{addedDocuments:t.added,removedDocuments:t.removed.map(s=>s.uri),addedEditors:o.added,removedEditors:o.removed.map(s=>s.getId()),newActiveEditor:n,visibleEditors:r.added.length===0&&r.removed.length===0?void 0:[...e.visibleEditors].map(s=>s[0])}}},qme=class{constructor(i,e,t,o,n,r,s){this._notebookService=t;this._notebookEditorService=o;this._editorService=n;this._editorGroupService=r;this._logService=s;this._disposables=new O;this._editorListeners=new Ot;this._proxy=i.getProxy(ao.ExtHostNotebook),this._mainThreadNotebooks=e.createInstance(yLe,i),this._mainThreadEditors=e.createInstance(wLe,i),i.set(Xi.MainThreadNotebookDocuments,this._mainThreadNotebooks),i.set(Xi.MainThreadNotebookEditors,this._mainThreadEditors),this._notebookService.onWillAddNotebookDocument(()=>this._updateState(),this,this._disposables),this._notebookService.onDidRemoveNotebookDocument(()=>this._updateState(),this,this._disposables),this._editorService.onDidActiveEditorChange(()=>this._updateState(),this,this._disposables),this._editorService.onDidVisibleEditorsChange(()=>this._updateState(),this,this._disposables),this._notebookEditorService.onDidAddNotebookEditor(this._handleEditorAdd,this,this._disposables),this._notebookEditorService.onDidRemoveNotebookEditor(this._handleEditorRemove,this,this._disposables),this._updateState()}dispose(){this._mainThreadNotebooks.dispose(),this._mainThreadEditors.dispose(),this._disposables.dispose(),this._editorListeners.dispose()}_handleEditorAdd(i){this._editorListeners.set(i.getId(),Fn(i.onDidChangeModel(()=>this._updateState()),i.onDidFocusWidget(()=>this._updateState(i)))),this._updateState()}_handleEditorRemove(i){this._editorListeners.deleteAndDispose(i.getId()),this._updateState()}_updateState(i){let e=new Map,t=new Map;for(let s of this._notebookEditorService.listNotebookEditors())s.hasModel()&&e.set(s.getId(),s);let o=lr(this._editorService.activeEditorPane),n=null;o?n=o.getId():i?.textModel&&(n=i.getId()),n&&!e.has(n)&&(this._logService.trace("MainThreadNotebooksAndEditors#_updateState: active editor is not in editors list",n,e.keys()),n=null);for(let s of this._editorService.visibleEditorPanes){let l=lr(s);l?.hasModel()&&e.has(l.getId())&&t.set(l.getId(),l)}let r=new c0t(new Set(this._notebookService.listNotebookDocuments()),e,n,t);this._onDelta(c0t.delta(this._currentState,r)),this._currentState=r}_onDelta(i){if(qme._isDeltaEmpty(i))return;let e={removedDocuments:i.removedDocuments,removedEditors:i.removedEditors,newActiveEditor:i.newActiveEditor,visibleEditors:i.visibleEditors,addedDocuments:i.addedDocuments.map(qme._asModelAddData),addedEditors:i.addedEditors.map(this._asEditorAddData,this)};this._proxy.$acceptDocumentAndEditorsDelta(new Hg(e)),this._mainThreadEditors.handleEditorsRemoved(i.removedEditors),this._mainThreadNotebooks.handleNotebooksRemoved(i.removedDocuments),this._mainThreadNotebooks.handleNotebooksAdded(i.addedDocuments),this._mainThreadEditors.handleEditorsAdded(i.addedEditors)}static _isDeltaEmpty(i){return!(i.addedDocuments!==void 0&&i.addedDocuments.length>0||i.removedDocuments!==void 0&&i.removedDocuments.length>0||i.addedEditors!==void 0&&i.addedEditors.length>0||i.removedEditors!==void 0&&i.removedEditors.length>0||i.visibleEditors!==void 0&&i.visibleEditors.length>0||i.newActiveEditor!==void 0)}static _asModelAddData(i){return{viewType:i.viewType,uri:i.uri,metadata:i.metadata,versionId:i.versionId,cells:i.cells.map($I.toNotebookCellDto)}}_asEditorAddData(i){let e=this._editorService.visibleEditorPanes.find(t=>lr(t)===i);return{id:i.getId(),documentUri:i.textModel.uri,selections:i.getSelections(),visibleRanges:i.visibleRanges,viewColumn:e&&Fx(this._editorGroupService,e.group),viewType:i.getViewModel().viewType}}};qme=I([RM,m(1,F),m(2,kn),m(3,hd),m(4,ie),m(5,kt),m(6,re)],qme);var CLe=le("INotebookRendererMessagingService");var d0t=class extends k{constructor(e,t){super();this.messaging=t;this.proxy=e.getProxy(ao.ExtHostNotebookRenderers),this._register(t.onShouldPostMessage(o=>{this.proxy.$postRendererMessage(o.editorId,o.rendererId,o.message)}))}$postMessage(e,t,o){return this.messaging.receiveMessage(e,t,o)}};d0t=I([fo(Xi.MainThreadNotebookRenderers),m(1,CLe)],d0t);var Sb=le("INotebookLoggingService");var If=le("workingCopyEditorService"),GZe=class extends k{constructor(e){super();this.editorService=e;this._onDidRegisterHandler=this._register(new T);this.onDidRegisterHandler=this._onDidRegisterHandler.event;this.handlers=new Set}registerHandler(e){return this.handlers.add(e),this._onDidRegisterHandler.fire(e),ee(()=>this.handlers.delete(e))}findEditor(e){for(let t of this.editorService.getEditors(0))if(this.isOpen(e,t.editor))return t}isOpen(e,t){for(let o of this.handlers)if(o.isOpen(e,t))return!0;return!1}};GZe=I([m(0,ie)],GZe);Ce(If,GZe,1);var pW=le("elevatedFileService");function Zpo(a){return!!a.stat}var m8=class extends zee{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(t,s);this.typeId=e;this.name=o;this.modelFactory=n;this.externalResolver=r;this.logService=l;this.workingCopyFileService=c;this.filesConfigurationService=u;this.workingCopyBackupService=p;this.notificationService=g;this.workingCopyEditorService=f;this.editorService=v;this.elevatedFileService=b;this.progressService=S;this.capabilities=0;this._model=void 0;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidResolve=this._register(new T);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSaveError=this._register(new T);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new T);this.onDidRevert=this._onDidRevert.event;this._onDidChangeReadonly=this._register(new T);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.dirty=!1;this.ignoreDirtyOnModelContentChange=!1;this.versionId=0;this.lastContentChangeFromUndoRedo=void 0;this.saveSequentializer=new vwe;this.ignoreSaveFromSaveParticipants=!1;this.inConflictMode=!1;this.inErrorMode=!1;this._register(h.registerWorkingCopy(this)),this.registerListeners()}get model(){return this._model}registerListeners(){this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))}isDirty(){return this.dirty}markModified(){this.setDirty(!0)}setDirty(e){if(!this.isResolved())return;let t=this.dirty;this.doSetDirty(e),e!==t&&this._onDidChangeDirty.fire()}doSetDirty(e){let t=this.dirty,o=this.inConflictMode,n=this.inErrorMode,r=this.savedVersionId;return e?this.dirty=!0:(this.dirty=!1,this.inConflictMode=!1,this.inErrorMode=!1,this.isResolved()&&(this.savedVersionId=this.model.versionId)),()=>{this.dirty=t,this.inConflictMode=o,this.inErrorMode=n,this.savedVersionId=r}}isResolved(){return!!this.model}async resolve(e){if(this.trace("resolve() - enter"),this.isDisposed()){this.trace("resolve() - exit - without resolving because file working copy is disposed");return}if(!e?.contents&&(this.dirty||this.saveSequentializer.isRunning())){this.trace("resolve() - exit - without resolving because file working copy is dirty or being saved");return}return this.doResolve(e)}async doResolve(e){if(e?.contents)return this.resolveFromBuffer(e.contents);if(!(!this.isResolved()&&await this.resolveFromBackup()))return this.resolveFromFile(e)}async resolveFromBuffer(e){this.trace("resolveFromBuffer()");let t,o,n,r;try{let s=await this.fileService.stat(this.resource);t=s.mtime,o=s.ctime,n=s.size,r=s.etag,this.setOrphaned(!1)}catch(s){t=Date.now(),o=Date.now(),n=0,r=GL,this.setOrphaned(s.fileOperationResult===1)}return this.resolveFromContent({resource:this.resource,name:this.name,mtime:t,ctime:o,size:n,etag:r,value:e,readonly:!1,locked:!1,executable:!1},!0)}async resolveFromBackup(){let e=await this.workingCopyBackupService.resolve(this);return this.isResolved()?(this.trace("resolveFromBackup() - exit - withoutresolving because previously new file working copy got created meanwhile"),!0):e?(await this.doResolveFromBackup(e),!0):!1}async doResolveFromBackup(e){this.trace("doResolveFromBackup()"),await this.resolveFromContent({resource:this.resource,name:this.name,mtime:e.meta?e.meta.mtime:Date.now(),ctime:e.meta?e.meta.ctime:Date.now(),size:e.meta?e.meta.size:0,etag:e.meta?e.meta.etag:GL,value:e.value,readonly:!1,locked:!1,executable:!1},!0),e.meta?.orphaned&&this.setOrphaned(!0)}async resolveFromFile(e){this.trace("resolveFromFile()");let t=e?.forceReadFromFile,o;t?o=GL:this.lastResolvedFileStat&&(o=this.lastResolvedFileStat.etag);let n=this.versionId;try{let r=await this.fileService.readFileStream(this.resource,{etag:o,limits:e?.limits});if(this.setOrphaned(!1),n!==this.versionId){this.trace("resolveFromFile() - exit - without resolving because file working copy content changed");return}await this.resolveFromContent(r,!1)}catch(r){let s=r.fileOperationResult;if(this.setOrphaned(s===1),this.isResolved()&&s===2){r instanceof lK&&this.updateLastResolvedFileStat(r.stat);return}if(this.isResolved()&&s===1&&!t)return;throw r}}async resolveFromContent(e,t){if(this.trace("resolveFromContent() - enter"),this.isDisposed()){this.trace("resolveFromContent() - exit - because working copy is disposed");return}this.updateLastResolvedFileStat({resource:this.resource,name:e.name,mtime:e.mtime,ctime:e.ctime,size:e.size,etag:e.etag,readonly:e.readonly,locked:e.locked,executable:!1,isFile:!0,isDirectory:!1,isSymbolicLink:!1,children:void 0}),this.isResolved()?await this.doUpdateModel(e.value):await this.doCreateModel(e.value),this.setDirty(!!t),this._onDidResolve.fire()}async doCreateModel(e){this.trace("doCreateModel()"),this._model=this._register(await this.modelFactory.createModel(this.resource,e,Ie.None)),this.installModelListeners(this._model)}async doUpdateModel(e){this.trace("doUpdateModel()"),this.ignoreDirtyOnModelContentChange=!0;try{await this.model?.update(e,Ie.None)}finally{this.ignoreDirtyOnModelContentChange=!1}}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t.isUndoing||t.isRedoing))),this._register(e.onWillDispose(()=>this.dispose()))}onModelContentChanged(e,t){if(this.trace("onModelContentChanged() - enter"),this.versionId++,this.trace(`onModelContentChanged() - new versionId ${this.versionId}`),t&&(this.lastContentChangeFromUndoRedo=Date.now()),!this.ignoreDirtyOnModelContentChange&&!this.isReadonly())if(e.versionId===this.savedVersionId){this.trace("onModelContentChanged() - model content changed back to last saved version");let o=this.dirty;this.setDirty(!1),o&&this._onDidRevert.fire()}else this.trace("onModelContentChanged() - model content changed and marked as dirty"),this.setDirty(!0);this._onDidChangeContent.fire()}async forceResolveFromFile(){this.isDisposed()||await this.externalResolver({forceReadFromFile:!0})}get backupDelay(){return this.model?.configuration?.backupDelay}async backup(e){let t;this.lastResolvedFileStat&&(t={mtime:this.lastResolvedFileStat.mtime,ctime:this.lastResolvedFileStat.ctime,size:this.lastResolvedFileStat.size,etag:this.lastResolvedFileStat.etag,orphaned:this.isOrphaned()});let o;return this.isResolved()&&(o=await Ea(this.model.snapshot(2,e),e)),{meta:t,content:o}}static{this.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD=500}async save(e=Object.create(null)){return this.isResolved()?this.isReadonly()?(this.trace("save() - ignoring request for readonly resource"),!1):(this.hasState(3)||this.hasState(5))&&(e.reason===2||e.reason===3||e.reason===4)?(this.trace("save() - ignoring auto save request for file working copy that is in conflict or error"),!1):(this.trace("save() - enter"),await this.doSave(e),this.trace("save() - exit"),this.hasState(0)):!1}async doSave(e){typeof e.reason!="number"&&(e.reason=1);let t=this.versionId;if(this.trace(`doSave(${t}) - enter with versionId ${t}`),this.ignoreSaveFromSaveParticipants){this.trace(`doSave(${t}) - exit - refusing to save() recursively from save participant`);return}if(this.saveSequentializer.isRunning(t))return this.trace(`doSave(${t}) - exit - found a running save for versionId ${t}`),this.saveSequentializer.running;if(!e.force&&!this.dirty){this.trace(`doSave(${t}) - exit - because not dirty and/or versionId is different (this.isDirty: ${this.dirty}, this.versionId: ${this.versionId})`);return}if(this.saveSequentializer.isRunning())return this.trace(`doSave(${t}) - exit - because busy saving`),this.saveSequentializer.cancelRunning(),this.saveSequentializer.queue(()=>this.doSave(e));this.isResolved()&&this.model.pushStackElement();let o=new qe;return this.progressService.withProgress({title:d(19657,null,this.name),location:10,cancellable:!0,delay:this.isDirty()?3e3:5e3},n=>this.doSaveSequential(t,e,n,o),()=>{o.cancel()}).finally(()=>{o.dispose()})}doSaveSequential(e,t,o,n){return this.saveSequentializer.run(e,(async()=>{if(this.isResolved()&&!t.skipSaveParticipants&&this.workingCopyFileService.hasSaveParticipants)try{if(t.reason===2&&typeof this.lastContentChangeFromUndoRedo=="number"){let l=Date.now()-this.lastContentChangeFromUndoRedo;l<m8.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD&&await Li(m8.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD-l)}if(!n.token.isCancellationRequested){this.ignoreSaveFromSaveParticipants=!0;try{await this.workingCopyFileService.runSaveParticipants(this,{reason:t.reason??1,savedFrom:t.from},o,n.token)}catch(l){Yi(l)&&!n.token.isCancellationRequested&&n.cancel()}finally{this.ignoreSaveFromSaveParticipants=!1}}}catch(l){this.logService.error(`[stored file working copy] runSaveParticipants(${e}) - resulted in an error: ${l.toString()}`,this.resource.toString(),this.typeId)}if(n.token.isCancellationRequested||this.isDisposed()||!this.isResolved())return;e=this.versionId,this.inErrorMode=!1,o.report({message:d(19658,null)}),this.trace(`doSave(${e}) - before write()`);let r=Ti(this.lastResolvedFileStat),s=this;return this.saveSequentializer.run(e,(async()=>{try{let l={mtime:r.mtime,etag:t.ignoreModifiedSince||!this.filesConfigurationService.preventSaveConflicts(r.resource)?GL:r.etag,unlock:t.writeUnlock},c;if(typeof s.model.save=="function")try{c=await s.model.save(l,n.token)}catch(u){if(n.token.isCancellationRequested)return;throw u}else{let u=await Ea(s.model.snapshot(1,n.token),n.token);if(n.token.isCancellationRequested)return;n.dispose(),t?.writeElevated&&this.elevatedFileService.isSupported(r.resource)?c=await this.elevatedFileService.writeFileElevated(r.resource,Ti(u),l):c=await this.fileService.writeFile(r.resource,Ti(u),l)}this.handleSaveSuccess(c,e,t)}catch(l){this.handleSaveError(l,e,t)}})(),()=>n.cancel())})(),()=>n.cancel())}handleSaveSuccess(e,t,o){this.updateLastResolvedFileStat(e),t===this.versionId?(this.trace(`handleSaveSuccess(${t}) - setting dirty to false because versionId did not change`),this.setDirty(!1)):this.trace(`handleSaveSuccess(${t}) - not setting dirty to false because versionId did change meanwhile`),this.setOrphaned(!1),this._onDidSave.fire({reason:o.reason,stat:e,source:o.source})}handleSaveError(e,t,o){if((o.ignoreErrorHandler?this.logService.trace:this.logService.error).apply(this.logService,[`[stored file working copy] handleSaveError(${t}) - exit - resulted in a save error: ${e.toString()}`,this.resource.toString(),this.typeId]),o.ignoreErrorHandler)throw e;this.setDirty(!0),this.inErrorMode=!0,e.fileOperationResult===3&&(this.inConflictMode=!0),this.doHandleSaveError(e,o),this._onDidSaveError.fire()}doHandleSaveError(e,t){let o=e,n=[],r;if(o.fileOperationResult===3)r=d(19659,null,this.name),n.push(li({id:"fileWorkingCopy.overwrite",label:d(19644,null),run:()=>this.save({...t,ignoreModifiedSince:!0,reason:1})})),n.push(li({id:"fileWorkingCopy.revert",label:d(19653,null),run:()=>this.revert()}));else{let c=o.fileOperationResult===5,u=c&&o.options?.unlock,p=o.fileOperationResult===6,h=this.elevatedFileService.isSupported(this.resource);RY(e)&&n.push(...e.actions),h&&(p||u)?n.push(li({id:"fileWorkingCopy.saveElevated",label:u?ii?d(19645,null):d(19646,null):ii?d(19655,null):d(19656,null),run:()=>{this.save({...t,writeElevated:!0,writeUnlock:u,reason:1})}})):c?n.push(li({id:"fileWorkingCopy.unlock",label:d(19644,null),run:()=>this.save({...t,writeUnlock:!0,reason:1})})):n.push(li({id:"fileWorkingCopy.retry",label:d(19652,null),run:()=>this.save({...t,reason:1})})),n.push(li({id:"fileWorkingCopy.saveAs",label:d(19654,null),run:async()=>{let g=this.workingCopyEditorService.findEditor(this);g&&((await this.editorService.save(g,{saveAs:!0,reason:1})).success||this.doHandleSaveError(e,t))}})),n.push(li({id:"fileWorkingCopy.revert",label:d(19653,null),run:()=>this.revert()})),c?u&&h?r=ii?d(19650,null,this.name):d(19651,null,this.name):r=d(19649,null,this.name):h&&p?r=ii?d(19647,null,this.name):d(19648,null,this.name):r=d(19643,null,this.name,Mn(e,!1))}let s=this.notificationService.notify({id:`${Lr(this.resource.toString())}`,severity:ft.Error,message:r,actions:{primary:n}}),l=this._register(U.once(U.any(this.onDidSave,this.onDidRevert))(()=>s.close()));this._register(U.once(s.onDidClose)(()=>l.dispose()))}updateLastResolvedFileStat(e){let t=this.isReadonly();this.lastResolvedFileStat?this.lastResolvedFileStat.mtime<=e.mtime?this.lastResolvedFileStat=e:this.lastResolvedFileStat={...this.lastResolvedFileStat,readonly:e.readonly,locked:e.locked}:this.lastResolvedFileStat=e,this.isReadonly()!==t&&this._onDidChangeReadonly.fire()}async revert(e){if(!this.isResolved()||!this.dirty&&!e?.force)return;this.trace("revert()");let t=this.dirty,o=this.doSetDirty(!1);if(!e?.soft)try{await this.forceResolveFromFile()}catch(r){if(r.fileOperationResult!==1)throw o(),r}this._onDidRevert.fire(),t&&this._onDidChangeDirty.fire()}hasState(e){switch(e){case 3:return this.inConflictMode;case 1:return this.dirty;case 5:return this.inErrorMode;case 4:return this.isOrphaned();case 2:return this.saveSequentializer.isRunning();case 0:return!this.dirty}}async joinState(e){return this.saveSequentializer.running}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource,this.lastResolvedFileStat)}trace(e){this.logService.trace(`[stored file working copy] ${e}`,this.resource.toString(),this.typeId)}dispose(){this.trace("dispose()"),this.inConflictMode=!1,this.inErrorMode=!1,this._model=void 0,super.dispose()}};m8=I([m(5,ge),m(6,re),m(7,gm),m(8,fr),m(9,Om),m(10,$a),m(11,Ne),m(12,If),m(13,ie),m(14,pW),m(15,Go)],m8);var mW=class extends Zh{constructor(e,t,o,n,r,s){super();this.resource=e;this._hasAssociatedFilePath=t;this.viewType=o;this._workingCopyManager=n;this._filesConfigurationService=s;this._onDidChangeDirty=this._register(new T);this._onDidSave=this._register(new T);this._onDidChangeOrphaned=this._register(new T);this._onDidChangeReadonly=this._register(new T);this._onDidRevertUntitled=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this.onDidSave=this._onDidSave.event;this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.onDidRevertUntitled=this._onDidRevertUntitled.event;this._workingCopyListeners=this._register(new O);this.scratchPad=r}dispose(){this._workingCopy?.dispose(),super.dispose()}get notebook(){return this._workingCopy?.model?.notebookModel}isResolved(){return!!this._workingCopy?.model?.notebookModel}async canDispose(){return this._workingCopy&&mW._isStoredFileWorkingCopy(this._workingCopy)?this._workingCopyManager.stored.canDispose(this._workingCopy):!0}isDirty(){return this._workingCopy?.isDirty()??!1}isModified(){return this._workingCopy?.isModified()??!1}isOrphaned(){return mW._isStoredFileWorkingCopy(this._workingCopy)&&this._workingCopy.hasState(4)}hasAssociatedFilePath(){return!mW._isStoredFileWorkingCopy(this._workingCopy)&&!!this._workingCopy?.hasAssociatedFilePath}isReadonly(){return mW._isStoredFileWorkingCopy(this._workingCopy)?this._workingCopy?.isReadonly():this._filesConfigurationService.isReadonly(this.resource)}get hasErrorState(){return this._workingCopy&&yo(this._workingCopy,{hasState:!0})?this._workingCopy.hasState(5):!1}async revert(e){return To(this.isResolved()),this._workingCopy.revert(e)}async save(e){return To(this.isResolved()),this._workingCopy.save(e)}async load(e){return!this._workingCopy||!this._workingCopy.model?(this.resource.scheme===Q.untitled?(this._hasAssociatedFilePath?this._workingCopy=await this._workingCopyManager.resolve({associatedResource:this.resource}):this._workingCopy=await this._workingCopyManager.resolve({untitledResource:this.resource,isScratchpad:this.scratchPad}),this._register(this._workingCopy.onDidRevert(()=>this._onDidRevertUntitled.fire()))):(this._workingCopy=await this._workingCopyManager.resolve(this.resource,{limits:e?.limits,reload:e?.forceReadFromFile?{async:!1,force:!0}:void 0}),this._workingCopyListeners.add(this._workingCopy.onDidSave(t=>this._onDidSave.fire(t))),this._workingCopyListeners.add(this._workingCopy.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire())),this._workingCopyListeners.add(this._workingCopy.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))),this._workingCopyListeners.add(this._workingCopy.onDidChangeDirty(()=>this._onDidChangeDirty.fire(),void 0)),this._workingCopyListeners.add(this._workingCopy.onWillDispose(()=>{this._workingCopyListeners.clear(),this._workingCopy?.model?.dispose()}))):await this._workingCopyManager.resolve(this.resource,{reload:{async:!e?.forceReadFromFile,force:e?.forceReadFromFile},limits:e?.limits}),To(this.isResolved()),this}async saveAs(e){let t=await this._workingCopyManager.saveAs(this.resource,e);if(t)return{resource:t.resource}}static _isStoredFileWorkingCopy(e){return!(e&&e.capabilities&2)}};mW=I([m(5,fr)],mW);var iU=class extends k{constructor(e,t,o,n,r){super();this._notebookModel=e;this._notebookService=t;this._configurationService=o;this._telemetryService=n;this._notebookLogService=r;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this.configuration=void 0;this.onWillDispose=e.onWillDispose.bind(e),this._register(e.onDidChangeContent(l=>{for(let c of l.rawEvents)if(c.kind!==6&&!c.transient){this._onDidChangeContent.fire({isRedoing:!1,isUndoing:!1,isInitial:!1});break}}));let s=this._configurationService.getValue(Ct.remoteSaving);(s||e.uri.scheme===Q.vscodeRemote)&&(this.configuration={backupDelay:1e4}),s&&this.setSaveDelegate().catch(l=>this._notebookLogService.error("WorkingCopyModel",`Failed to set save delegate: ${l}`))}async setSaveDelegate(){await this.getNotebookSerializer(),this.save=async(e,t)=>{try{let o=this._notebookService.tryGetDataProviderSync(this.notebookModel.viewType)?.serializer;if(o||(this._notebookLogService.info("WorkingCopyModel","No serializer found for notebook model, checking if provider still needs to be resolved"),o=await this.getNotebookSerializer().catch(r=>{throw this._notebookLogService.error("WorkingCopyModel",`Failed to get notebook serializer: ${r}`),this.save=void 0,new u0t("Failed to get notebook serializer")})),t.isCancellationRequested)throw new qi;return await o.save(this._notebookModel.uri,this._notebookModel.versionId,e,t)}catch(o){if(!t.isCancellationRequested&&o.name!=="Canceled"){let n=this._notebookModel.viewType==="jupyter-notebook"||this._notebookModel.viewType==="interactive",r=xZo(o);this._telemetryService.publicLogError2("notebook/SaveError",{isRemote:this._notebookModel.uri.scheme===Q.vscodeRemote,isIPyNbWorkerSerializer:n&&this._configurationService.getValue("ipynb.experimental.serialization"),error:r})}throw o}}}dispose(){this._notebookModel.dispose(),super.dispose()}get notebookModel(){return this._notebookModel}async snapshot(e,t){return this._notebookService.createNotebookTextDocumentSnapshot(this._notebookModel.uri,e,t)}async update(e,t){let o=await this.getNotebookSerializer(),n=await yI(e),r=await o.dataToNotebook(n);if(t.isCancellationRequested)throw new qi;this._notebookLogService.info("WorkingCopyModel","Notebook content updated from file system - "+this._notebookModel.uri.toString()),this._notebookModel.reset(r.cells,r.metadata,o.options)}async getNotebookSerializer(){let e=await this._notebookService.withNotebookDataProvider(this.notebookModel.viewType);if(!(e instanceof LM)){let t="CANNOT open notebook with this provider";throw new u0t(t)}return e.serializer}get versionId(){return this._notebookModel.alternativeVersionId}pushStackElement(){this._notebookModel.pushStackElement()}},kLe=class{constructor(i,e,t,o,n){this._viewType=i;this._notebookService=e;this._configurationService=t;this._telemetryService=o;this._notebookLogService=n}async createModel(i,e,t){let o=this._notebookService.getNotebookTextModel(i)??await this._notebookService.createNotebookTextModel(this._viewType,i,e);return new iU(o,this._notebookService,this._configurationService,this._telemetryService,this._notebookLogService)}};kLe=I([m(1,kn),m(2,B),m(3,_e),m(4,Sb)],kLe);var u0t=class extends Error{constructor(i){super(i),this.name="NotebookSaveError"}};function xZo(a){if(a.name==="NotebookSaveError")return a.message;if(a instanceof ua)switch(a.fileOperationResult){case 0:return"File is a directory";case 1:return"File not found";case 2:return"File not modified since";case 3:return"File modified since";case 4:return"File move conflict";case 5:return"File write locked";case 6:return"File permission denied";case 7:return"File too large";case 8:return"File invalid path";case 9:return"File not directory";case 10:return"File other error"}return"Unknown error"}var JCi=class{constructor(i){this._proxy=i.getProxy(ao.ExtHostNotebookDocumentSaveParticipant)}async participate(i,e,t,o){if(!i.model||!(i.model instanceof iU))return;let n,r=new Promise((s,l)=>{n=setTimeout(()=>l(new Error(d(3956,null))),1750),this._proxy.$participateInSave(i.resource,e.reason,o).then(c=>{clearTimeout(n)}).then(s,l)});return Ym(r,o)}},p0t=class{constructor(i,e,t){this.workingCopyFileService=t;this._saveParticipantDisposable=this.workingCopyFileService.addSaveParticipant(e.createInstance(JCi,i))}dispose(){this._saveParticipantDisposable.dispose()}};p0t=I([RM,m(1,F),m(2,gm)],p0t);var m0t=class{constructor(i,e){this._disposables=new O;this._proxy=i.getProxy(ao.ExtHostInteractive),this._disposables.add(e.onWillAddInteractiveDocument(t=>{this._proxy.$willAddInteractiveDocument(t.inputUri,`
`,es,t.notebookUri)})),this._disposables.add(e.onWillRemoveInteractiveDocument(t=>{this._proxy.$willRemoveInteractiveDocument(t.inputUri,t.notebookUri)}))}dispose(){this._disposables.dispose()}};m0t=I([fo(Xi.MainThreadInteractive),m(1,XDe)],m0t);var kZo={type:"object",additionalProperties:!1,properties:{type:{type:"string",description:d(15887,null)},required:{type:"array",markdownDescription:d(15889,null),items:{type:"string"}},properties:{type:"object",description:d(15888,null),additionalProperties:{$ref:"http://json-schema.org/draft-07/schema#"}},when:{type:"string",markdownDescription:d(15890,null),default:""}}},tmo;(i=>{function a(e,t,o){if(!e)return;let n=We(e.type)?e.type:void 0;if(!n||n.length===0){o.error(d(15892,null));return}let r=[];if(Array.isArray(e.required))for(let s of e.required)We(s)&&r.push(s);return{extensionId:t.value,taskType:n,required:r,properties:e.properties?io(e.properties):{},when:e.when?C.deserialize(e.when):void 0}}i.from=a})(tmo||={});var EZo=zn.registerExtensionPoint({extensionPoint:"taskDefinitions",activationEventsGenerator:function*(a){for(let i of a)i.type&&(yield`onTaskType:${i.type}`)},jsonSchema:{description:d(15891,null),type:"array",items:kZo}}),ZCi=class{constructor(){this._onDefinitionsChanged=new T;this.onDefinitionsChanged=this._onDefinitionsChanged.event;this.taskTypes=Object.create(null),this.readyPromise=new Promise((i,e)=>{EZo.setHandler((t,o)=>{this._schema=void 0;try{for(let n of o.removed){let r=n.value;for(let s of r)this.taskTypes&&s.type&&this.taskTypes[s.type]&&delete this.taskTypes[s.type]}for(let n of o.added){let r=n.value;for(let s of r){let l=tmo.from(s,n.description.identifier,n.collector);l&&(this.taskTypes[l.taskType]=l)}}(o.removed.length>0||o.added.length>0)&&this._onDefinitionsChanged.fire()}catch{}i(void 0)})})}onReady(){return this.readyPromise}get(i){return this.taskTypes[i]}all(){return Object.keys(this.taskTypes).map(i=>this.taskTypes[i])}getJsonSchema(){if(this._schema===void 0){let i=[];for(let e of this.all()){let t={type:"object",additionalProperties:!1};e.required.length>0&&(t.required=e.required.slice(0)),e.properties!==void 0?t.properties=io(e.properties):t.properties=Object.create(null),t.properties.type={type:"string",enum:[e.taskType]},i.push(t)}this._schema={oneOf:i}}return this._schema}},xE=new ZCi;var oU="settings",TLe=new Y("taskRunning",!1,d(15895,null)),$Ze=new Y("taskTerminalActive",!1,d(15897,null)),Yx=P(15896,"Tasks"),_Le=(t=>(t[t.Escape=1]="Escape",t[t.Strong=2]="Strong",t[t.Weak=3]="Weak",t))(_Le||{}),h8="$customized";(i=>{function a(e){if(!e)return 2;switch(e.toLowerCase()){case"escape":return 1;case"strong":return 2;case"weak":return 3;default:return 2}}i.from=a})(_Le||={});var jZe;(i=>i.defaults={cwd:"${workspaceFolder}"})(jZe||={});var $me=(t=>(t[t.Always=1]="Always",t[t.Silent=2]="Silent",t[t.Never=3]="Never",t))($me||{});(i=>{function a(e){switch(e.toLowerCase()){case"always":return 1;case"silent":return 2;case"never":return 3;default:return 1}}i.fromString=a})($me||={});var DLe=(t=>(t[t.Never=1]="Never",t[t.OnProblem=2]="OnProblem",t[t.Always=3]="Always",t))(DLe||{});(i=>{function a(e){switch(e.toLowerCase()){case"always":return 3;case"never":return 1;case"onproblem":return 2;default:return 2}}i.fromString=a})(DLe||={});var RLe=(t=>(t[t.Shared=1]="Shared",t[t.Dedicated=2]="Dedicated",t[t.New=3]="New",t))(RLe||{});(i=>{function a(e){switch(e.toLowerCase()){case"shared":return 1;case"dedicated":return 2;case"new":return 3;default:return 1}}i.fromString=a})(RLe||={});var g0t;(i=>i.defaults={echo:!0,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1})(g0t||={});var g8=(t=>(t[t.Shell=1]="Shell",t[t.Process=2]="Process",t[t.CustomExecution=3]="CustomExecution",t))(g8||{});(e=>{function a(t){switch(t.toLowerCase()){case"shell":return 1;case"process":return 2;case"customExecution":return 3;default:return 2}}e.fromString=a;function i(t){switch(t){case 1:return"shell";case 2:return"process";case 3:return"customExecution";default:return"process"}}e.toString=i})(g8||={});var f8;(i=>{function a(e){return We(e)?e:e.value}i.value=a})(f8||={});var Lh;(r=>{r.Clean={_id:"clean",isDefault:!1},r.Build={_id:"build",isDefault:!1},r.Rebuild={_id:"rebuild",isDefault:!1},r.Test={_id:"test",isDefault:!1};function o(s){return s===r.Clean._id||s===r.Build._id||s===r.Rebuild._id||s===r.Test._id}r.is=o;function n(s){if(s!==void 0)return We(s)?o(s)?{_id:s,isDefault:!1}:void 0:s}r.from=n})(Lh||={});var Vl;(r=>{r.Workspace="workspace",r.Extension="extension",r.InMemory="inMemory",r.WorkspaceFile="workspaceFile",r.User="user";function n(s){switch(s){case r.User:return 2;case r.WorkspaceFile:return 5;default:return 6}}r.toConfigurationTarget=n})(Vl||={});var f0t;(i=>i.defaults={reevaluateOnRerun:!0,runOn:1,instanceLimit:1,instancePolicy:"prompt"})(f0t||={});var ELe=class{constructor(i,e,t,o,n,r){this._label="";this._id=i,e&&(this._label=e),t&&(this.type=t),this.runOptions=o,this.configurationProperties=n,this._source=r}getDefinition(i){}getMapKey(){return this._id}getKey(){}getCommonTaskId(){let i={folder:this.getFolderId(),id:this._id};return JSON.stringify(i)}clone(){return this.fromObject(Object.assign({},this))}getWorkspaceFolder(){}getWorkspaceFileName(){}getTelemetryKind(){return"unknown"}matches(i,e=!1){if(i===void 0)return!1;if(We(i))return i===this._label||i===this.configurationProperties.identifier||e&&i===this._id;let t=this.getDefinition(!0);return t!==void 0&&t._key===i._key}getQualifiedLabel(){let i=this.getWorkspaceFolder();return i?`${this._label} (${i.name})`:this._label}getTaskExecution(){return{id:this._id,task:this}}addTaskLoadMessages(i){this._taskLoadMessages===void 0&&(this._taskLoadMessages=[]),i&&(this._taskLoadMessages=this._taskLoadMessages.concat(i))}get taskLoadMessages(){return this._taskLoadMessages}},Zd=class a extends ELe{constructor(e,t,o,n,r,s,l,c){super(e,o,void 0,l,c,t);this.command={};this._source=t,this.hasDefinedMatchers=s,r&&(this.command=r)}clone(){return new a(this._id,this._source,this._label,this.type,this.command,this.hasDefinedMatchers,this.runOptions,this.configurationProperties)}customizes(){if(this._source&&this._source.customizes)return this._source.customizes}getDefinition(e=!1){if(e&&this._source.customizes!==void 0)return this._source.customizes;{let t;switch(this.command?this.command.runtime:void 0){case 1:t="shell";break;case 2:t="process";break;case 3:t="customExecution";break;case void 0:t="$composite";break;default:throw new Error("Unexpected task runtime")}return{type:t,_key:this._id,id:this._id}}}static is(e){return e instanceof a}getMapKey(){let e=this._source.config.workspaceFolder;return e?`${e.uri.toString()}|${this._id}|${this.instance}`:`${this._id}|${this.instance}`}getFolderId(){return this._source.kind===Vl.User?oU:this._source.config.workspaceFolder?.uri.toString()}getCommonTaskId(){return this._source.customizes?super.getCommonTaskId():this.getKey()??super.getCommonTaskId()}getKey(){let e=this.getFolderId();if(!e)return;let t=this.configurationProperties.identifier;return this._source.kind!==Vl.Workspace&&(t+=this._source.kind),JSON.stringify({type:h8,folder:e,id:t})}getWorkspaceFolder(){return this._source.config.workspaceFolder}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?Be(this._source.config.workspace.configuration):void 0}getTelemetryKind(){return this._source.customizes?"workspace>extension":"workspace"}fromObject(e){let t=e;return new a(t._id,t._source,t._label,t.type,t.command,t.hasDefinedMatchers,t.runOptions,t.configurationProperties)}},ev=class a extends ELe{constructor(i,e,t,o,n,r,s){super(i,t,o,r,s,e),this._source=e,this.configures=n}static is(i){return i instanceof a}fromObject(i){return i}getDefinition(){return this.configures}getWorkspaceFileName(){return this._source.config.workspace&&this._source.config.workspace.configuration?Be(this._source.config.workspace.configuration):void 0}getWorkspaceFolder(){return this._source.config.workspaceFolder}getFolderId(){return this._source.kind===Vl.User?oU:this._source.config.workspaceFolder?.uri.toString()}getKey(){let i=this.getFolderId();if(!i)return;let e=this.configurationProperties.identifier;return this._source.kind!==Vl.Workspace&&(e+=this._source.kind),JSON.stringify({type:h8,folder:i,id:e})}},sg=class a extends ELe{constructor(i,e,t,o,n,r,s,l,c){super(i,t,o,l,c,e),this.defines=n,this.hasDefinedMatchers=s,this.command=r,this.icon=c.icon,this.hide=c.hide}clone(){return new a(this._id,this._source,this._label,this.type,this.defines,this.command,this.hasDefinedMatchers,this.runOptions,this.configurationProperties)}getDefinition(){return this.defines}static is(i){return i instanceof a}getMapKey(){let i=this._source.workspaceFolder;return i?`${this._source.scope.toString()}|${i.uri.toString()}|${this._id}|${this.instance}`:`${this._source.scope.toString()}|${this._id}|${this.instance}`}getFolderId(){if(this._source.scope===3&&this._source.workspaceFolder)return this._source.workspaceFolder.uri.toString()}getKey(){let i={type:"contributed",scope:this._source.scope,id:this._id};return i.folder=this.getFolderId(),JSON.stringify(i)}getWorkspaceFolder(){return this._source.workspaceFolder}getTelemetryKind(){return"extension"}fromObject(i){let e=i;return new a(e._id,e._source,e._label,e.type,e.defines,e.command,e.hasDefinedMatchers,e.runOptions,e.configurationProperties)}},h_=class a extends ELe{constructor(i,e,t,o,n,r){super(i,t,o,n,r,e),this._source=e}clone(){return new a(this._id,this._source,this._label,this.type,this.runOptions,this.configurationProperties)}static is(i){return i instanceof a}getTelemetryKind(){return"composite"}getMapKey(){return`${this._id}|${this.instance}`}getFolderId(){}fromObject(i){let e=i;return new a(e._id,e._source,e._label,e.type,e.runOptions,e.configurationProperties)}},jme=(e=>(e[e.Process=1]="Process",e[e.Terminal=2]="Terminal",e))(jme||{});(i=>i._default=2)(jme||={});var h0t=class{constructor(i){this._order=new Map;for(let e=0;e<i.length;e++)this._order.set(i[e].uri.toString(),e)}compare(i,e){let t=i.getWorkspaceFolder(),o=e.getWorkspaceFolder();if(t&&o){let n=this._order.get(t.uri.toString());n=n===void 0?0:n+1;let r=this._order.get(o.uri.toString());return r=r===void 0?0:r+1,n===r?i._label.localeCompare(e._label):n-r}else return!t&&o?-1:t&&!o?1:0}};var Mp;(c=>{function a(u){return{taskId:u._id,taskName:u.configurationProperties.name,runType:u.configurationProperties.isBackground?"background":"singleRun",group:u.configurationProperties.group,__task:u}}function i(u,p,h){return{...a(u),kind:"start",terminalId:p,resolvedVariables:h}}c.start=i;function e(u,p,h){return{...a(u),kind:"processStarted",terminalId:p,processId:h}}c.processStarted=e;function t(u,p,h,g){return{...a(u),kind:"processEnded",terminalId:p,exitCode:h,durationMs:g}}c.processEnded=t;function o(u,p,h){return{...a(u),kind:"inactive",terminalId:p,durationMs:h}}c.inactive=o;function n(u,p,h){return{...a(u),kind:"terminated",exitReason:h,terminalId:p}}c.terminated=n;function r(u,p,h){return{...a(p),kind:u,terminalId:h}}c.general=r;function s(u,p,h){return{...a(u),kind:"problemMatcherEnded",hasErrors:p}}c.problemMatcherEnded=s;function l(){return{kind:"changed"}}c.changed=l})(Mp||={});var qZe;(e=>{function a(t){let o=Object.keys(t).sort(),n="";for(let r of o){let s=t[r];s instanceof Object?s=a(s):typeof s=="string"&&(s=s.replace(/,/g,",,")),n+=r+","+s+","}return n}function i(t){let n={_key:a(t),type:t.taskType};return Object.assign(n,t),n}e.create=i})(qZe||={});var nU;(i=>{function a(e,t){let o=xE.get(e.type);if(o===void 0){let l=io(e);return delete l._key,qZe.create(l)}let n=Object.create(null);n.type=o.taskType;let r=new Set;o.required.forEach(l=>r.add(l));let s=o.properties;for(let l of Object.keys(s)){let c=e[l];if(c!=null)n[l]=c;else if(r.has(l)){let u=s[l];if(u.default!==void 0)n[l]=io(u.default);else switch(u.type){case"boolean":n[l]=!1;break;case"number":case"integer":n[l]=0;break;case"string":n[l]="";break;default:t.error(d(15894,null,JSON.stringify(e,void 0,0),l));return}}}return qZe.create(n)}i.createTaskIdentifier=a})(nU||={});var v0t=Oe("rerun-task",L.refresh,d(15893,null)),b0t="workbench.action.tasks.rerunForActiveTerminal",S0t="workbench.action.tasks.rerunAllRunningTasks";var exi=new Y("customExecutionSupported",!1,d(15898,null)),Qme=new Y("shellExecutionSupported",!1,d(15901,null)),I0t=new Y("taskCommandsRegistered",!1,d(15902,null)),LLe=new Y("processExecutionSupported",!1,d(15899,null)),y0t=new Y("serverlessWebContext",!1,d(15900,null)),imo=new Y("tasksAvailable",!1,d(15903,null)),ag=C.or(C.and(Qme,LLe),exi),yf=le("taskService");var Xp=le("configurationResolverService"),w0t=(J=>(J.Unknown="unknown",J.Env="env",J.Config="config",J.Command="command",J.Input="input",J.ExtensionInstallFolder="extensionInstallFolder",J.TaskVar="taskVar",J.WorkspaceFolder="workspaceFolder",J.Cwd="cwd",J.WorkspaceFolderBasename="workspaceFolderBasename",J.UserHome="userHome",J.LineNumber="lineNumber",J.ColumnNumber="columnNumber",J.SelectedText="selectedText",J.File="file",J.FileWorkspaceFolder="fileWorkspaceFolder",J.FileWorkspaceFolderBasename="fileWorkspaceFolderBasename",J.RelativeFile="relativeFile",J.RelativeFileDirname="relativeFileDirname",J.FileDirname="fileDirname",J.FileExtname="fileExtname",J.FileBasename="fileBasename",J.FileBasenameNoExtension="fileBasenameNoExtension",J.FileDirnameBasename="fileDirnameBasename",J.ExecPath="execPath",J.ExecInstallFolder="execInstallFolder",J.PathSeparator="pathSeparator",J.PathSeparatorAlias="/",J))(w0t||{}),omo=Object.values(w0t).filter(a=>typeof a=="string"),Ev=class extends ka{constructor(e,t){super(t);this.variable=e}};var eI=class a{constructor(i){this.locations=new Map;this.newReplacementNotifiers=new Set;typeof i=="string"?(this.stringRoot=!0,this.root={value:i}):(this.stringRoot=!1,this.root=structuredClone(i))}static{this.VARIABLE_LHS="${"}static parse(i){if(i instanceof a)return i;let e=new a(i);return e.applyPlatformSpecificKeys(),e.parseObject(e.root),e}applyPlatformSpecificKeys(){let i=this.root,e=ii?"windows":et?"osx":Sn?"linux":void 0;e&&i&&typeof i=="object"&&i.hasOwnProperty(e)&&Object.keys(i[e]).forEach(t=>i[t]=i[e][t]),delete i.windows,delete i.osx,delete i.linux}parseVariable(i,e){if(i[e]!=="$"||i[e+1]!=="{")return;let t=e+2,o=1;for(;t<i.length;){if(i[t]==="{")o++;else if(i[t]==="}"&&(o--,o===0))break;t++}if(o!==0)return;let n=i.slice(e,t+1),r=i.substring(e+2,t),s=r.indexOf(":");return s===-1?{replacement:{id:n,name:r,inner:r},end:t}:{replacement:{id:n,inner:r,name:r.slice(0,s),arg:r.slice(s+1)},end:t}}parseObject(i){if(!(typeof i!="object"||i===null)){if(Array.isArray(i)){for(let e=0;e<i.length;e++){let t=i[e];typeof t=="string"?this.parseString(i,e,t):this.parseObject(t)}return}for(let[e,t]of Object.entries(i))this.parseString(i,e,e,!0),typeof t=="string"?this.parseString(i,e,t):this.parseObject(t)}}parseString(i,e,t,o,n){let r=0;for(;r<t.length;){let s=t.indexOf("${",r);if(s===-1)break;let l=this.parseVariable(t,s);if(l){if(r=l.end+1,n?.includes(l.replacement.id))continue;let c=this.locations.get(l.replacement.id)||{locations:[],replacement:l.replacement},u={object:i,propertyName:e,replaceKeyName:o};c.locations.push(u),this.locations.set(l.replacement.id,c),c.resolved?this._resolveAtLocation(l.replacement,u,c.resolved,n):this.newReplacementNotifiers.forEach(p=>p(l.replacement))}else r=s+2}}*unresolved(){let i=new Map,e=t=>{i.set(t.id,t)};for(let t of this.locations.values())t.resolved===void 0&&i.set(t.replacement.id,t.replacement);for(this.newReplacementNotifiers.add(e);;){let t=yt.first(i);if(!t)break;let[o,n]=t;yield n,i.delete(o)}this.newReplacementNotifiers.delete(e)}resolved(){return yt.map(yt.filter(this.locations.values(),i=>!!i.resolved),i=>[i.replacement,i.resolved])}resolve(i,e){typeof e!="object"&&(e={value:String(e)});let t=this.locations.get(i.id);if(t&&(t.resolved=e,e.value!==void 0))for(let o of t.locations||yt.empty())this._resolveAtLocation(i,o,e)}_resolveAtLocation(i,{replaceKeyName:e,propertyName:t,object:o},n,r=[]){if(n.value!==void 0){if(r.push(i.id),e&&typeof t=="string"){let s=o[t],l=t.replaceAll(i.id,n.value);delete o[t],o[l]=s,this._renameKeyInLocations(o,t,l),this.parseString(o,l,n.value,!0,r)}else o[t]=o[t].replaceAll(i.id,n.value),this.parseString(o,t,n.value,!1,r);r.pop()}}_renameKeyInLocations(i,e,t){for(let o of this.locations.values())for(let n of o.locations)n.object===i&&n.propertyName===e&&(n.propertyName=t)}toObject(){return this.stringRoot?this.root.value:this.root}};var txi;(i=>{function a(e){return{id:e.id,task:fR.from(e.task)}}i.from=a})(txi||={});var nmo;(i=>{function a(e){return{execution:{id:e.execution.id,task:fR.from(e.execution.task)}}}i.from=a})(nmo||={});var ixi;(i=>{function a(e){return{execution:{id:e.execution.id,task:fR.from(e.execution.task)},hasErrors:e.hasErrors}}i.from=a})(ixi||={});var rmo;(i=>{function a(e,t){return{id:e.id,processId:t}}i.from=a})(rmo||={});var smo;(i=>{function a(e,t){return{id:e.id,exitCode:t}}i.from=a})(smo||={});var oxi;(e=>{function a(t){let o=Object.assign(Object.create(null),t);return delete o._key,o}e.from=a;function i(t,o){let n=nU.createTaskIdentifier(t,console);return n===void 0&&o&&(n={_key:ht(),type:"$executeOnly"}),n}e.to=i})(oxi||={});var nxi;(e=>{function a(t){if(t!=null)return Object.assign(Object.create(null),t)}e.from=a;function i(t){return t==null?g0t.defaults:Object.assign(Object.create(null),g0t.defaults,t)}e.to=i})(nxi||={});var rxi;(e=>{function a(t){if(t!=null)return Object.assign(Object.create(null),t)}e.from=a;function i(t){return t==null?f0t.defaults:Object.assign(Object.create(null),f0t.defaults,t)}e.to=i})(rxi||={});var sxi;(e=>{function a(t){if(t!=null)return{cwd:t.cwd,env:t.env}}e.from=a;function i(t){return t==null?jZe.defaults:{cwd:t.cwd||jZe.defaults.cwd,env:t.env}}e.to=i})(sxi||={});var x0t;(t=>{function a(o){let n=o;return n&&!!n.process}t.is=a;function i(o){let n=We(o.name)?o.name:o.name.value,r=o.args?o.args.map(l=>We(l)?l:l.value):[],s={process:n,args:r};return o.options&&(s.options=sxi.from(o.options)),s}t.from=i;function e(o){let n={runtime:2,name:o.process,args:o.args,presentation:void 0};return n.options=sxi.to(o.options),n}t.to=e})(x0t||={});var axi;(e=>{function a(t){if(t==null)return;let o={cwd:t.cwd||jZe.defaults.cwd,env:t.env};return t.shell&&(o.executable=t.shell.executable,o.shellArgs=t.shell.args,o.shellQuoting=t.shell.quoting),o}e.from=a;function i(t){if(t==null)return;let o={cwd:t.cwd,env:t.env};return t.executable&&(o.shell={executable:t.executable},t.shellArgs&&(o.shell.args=t.shellArgs),t.shellQuoting&&(o.shell.quoting=t.shellQuoting)),o}e.to=i})(axi||={});var k0t;(t=>{function a(o){let n=o;return n&&(!!n.commandLine||!!n.command)}t.is=a;function i(o){let n={};return o.name&&We(o.name)&&(o.args===void 0||o.args===null||o.args.length===0)?n.commandLine=o.name:(n.command=o.name,n.args=o.args),o.options&&(n.options=axi.from(o.options)),n}t.from=i;function e(o){let n={runtime:1,name:o.commandLine?o.commandLine:o.command,args:o.args,presentation:void 0};return o.options&&(n.options=axi.to(o.options)),n}t.to=e})(k0t||={});var MLe;(t=>{function a(o){let n=o;return n&&n.customExecution==="customExecution"}t.is=a;function i(o){return{customExecution:"customExecution"}}t.from=i;function e(o){return{runtime:3,presentation:void 0}}t.to=e})(MLe||={});var lxi;(e=>{function a(t){let o={label:t.label};return t.kind===Vl.Extension?(o.extensionId=t.extension,t.workspaceFolder?o.scope=t.workspaceFolder.uri:o.scope=t.scope):t.kind===Vl.Workspace&&(o.extensionId="$core",o.scope=t.config.workspaceFolder?t.config.workspaceFolder.uri:1),o}e.from=a;function i(t,o){let n,r;return t.scope===void 0||typeof t.scope=="number"&&t.scope!==1?o.getWorkspace().folders.length===0?(n=1,r=void 0):(n=3,r=o.getWorkspace().folders[0]):typeof t.scope=="number"?n=t.scope:(n=3,r=o.getWorkspaceFolder(A.revive(t.scope))??void 0),{kind:Vl.Extension,label:t.label,extension:t.extensionId,scope:n,workspaceFolder:r}}e.to=i})(lxi||={});var cxi;(i=>{function a(e){let t=e;return!!t&&We(t.id)&&!!t.workspaceFolder}i.is=a})(cxi||={});var fR;(e=>{function a(t){if(t==null||!Zd.is(t)&&!sg.is(t)&&!ev.is(t))return;let o={_id:t._id,name:t.configurationProperties.name,definition:oxi.from(t.getDefinition(!0)),source:lxi.from(t._source),execution:void 0,presentationOptions:!ev.is(t)&&t.command?nxi.from(t.command.presentation):void 0,isBackground:t.configurationProperties.isBackground,problemMatchers:[],hasDefinedMatchers:sg.is(t)?t.hasDefinedMatchers:!1,runOptions:rxi.from(t.runOptions)};if(o.group=amo.from(t.configurationProperties.group),t.configurationProperties.detail&&(o.detail=t.configurationProperties.detail),!ev.is(t)&&t.command)switch(t.command.runtime){case 2:o.execution=x0t.from(t.command);break;case 1:o.execution=k0t.from(t.command);break;case 3:o.execution=MLe.from(t.command);break}if(t.configurationProperties.problemMatchers)for(let n of t.configurationProperties.problemMatchers)We(n)&&o.problemMatchers.push(n);return o}e.from=a;function i(t,o,n,r,s){if(!t||typeof t.name!="string")return;let l;if(t.execution&&(k0t.is(t.execution)?l=k0t.to(t.execution):x0t.is(t.execution)?l=x0t.to(t.execution):MLe.is(t.execution)&&(l=MLe.to(t.execution))),!l)return;l.presentation=nxi.to(t.presentationOptions);let c=lxi.to(t.source,o),u=d(3962,null,c.label,t.name),p=oxi.to(t.definition,n),h=MLe.is(t.execution)&&t._id?t._id:`${t.source.extensionId}.${p._key}`;return new sg(h,c,u,p.type,p,l,t.hasDefinedMatchers,rxi.to(t.runOptions),{name:t.name,identifier:u,group:t.group,isBackground:!!t.isBackground,problemMatchers:t.problemMatchers.slice(),detail:t.detail,icon:r,hide:s})}e.to=i})(fR||={});var amo;(i=>{function a(e){if(e!==void 0)return{_id:typeof e=="string"?e:e._id,isDefault:typeof e=="string"||typeof e.isDefault=="string"?!1:e.isDefault}}i.from=a})(amo||={});var lmo;(e=>{function a(t){return t}e.from=a;function i(t){return t}e.to=i})(lmo||={});var C0t=class extends k{constructor(e,t,o,n){super();this._taskService=t;this._workspaceContextServer=o;this._configurationResolverService=n;this._proxy=e.getProxy(ao.ExtHostTask),this._providers=new Map,this._register(this._taskService.onDidStateChange(async r=>{if(r.kind==="changed")return;let s=r.__task;if(r.kind==="start"){let l=txi.from(s.getTaskExecution()),c=l.task.definition;if(l.task?.execution&&MLe.is(l.task.execution)&&r.resolvedVariables){let u=eI.parse(l.task.definition);for(let p of u.unresolved()){let h=r.resolvedVariables.get(p.inner);h!==void 0&&u.resolve(p,h)}c=await this._configurationResolverService.resolveAsync(s.getWorkspaceFolder(),u)}this._proxy.$onDidStartTask(l,r.terminalId,c)}else r.kind==="processStarted"?this._proxy.$onDidStartTaskProcess(rmo.from(s.getTaskExecution(),r.processId)):r.kind==="processEnded"?this._proxy.$onDidEndTaskProcess(smo.from(s.getTaskExecution(),r.exitCode)):r.kind==="end"?this._proxy.$OnDidEndTask(txi.from(s.getTaskExecution())):r.kind==="problemMatcherStarted"?this._proxy.$onDidStartTaskProblemMatchers(nmo.from({execution:s.getTaskExecution()})):r.kind==="problemMatcherEnded"?this._proxy.$onDidEndTaskProblemMatchers(ixi.from({execution:s.getTaskExecution(),hasErrors:!1})):r.kind==="problemMatcherFoundErrors"&&this._proxy.$onDidEndTaskProblemMatchers(ixi.from({execution:s.getTaskExecution(),hasErrors:!0}))}))}dispose(){for(let e of this._providers.values())e.disposable.dispose();this._providers.clear(),super.dispose()}$createTaskId(e){return new Promise((t,o)=>{let n=fR.to(e,this._workspaceContextServer,!0);n?t(n._id):o(new Error("Task could not be created from DTO"))})}$registerTaskProvider(e,t){let o={provideTasks:r=>Promise.resolve(this._proxy.$provideTasks(e,r)).then(s=>{let l=[];for(let u of s.tasks){let p=fR.to(u,this._workspaceContextServer,!0);p?l.push(p):console.error(`Task System: can not convert task: ${JSON.stringify(u.definition,void 0,0)}. Task will be dropped`)}let c={...s.extension,extensionLocation:A.revive(s.extension.extensionLocation)};return{tasks:l,extension:c}}),resolveTask:r=>{let s=fR.from(r);return s?(s.name=s.name===void 0?"":s.name,Promise.resolve(this._proxy.$resolveTask(e,s)).then(l=>{if(l)return fR.to(l,this._workspaceContextServer,!0,r.configurationProperties.icon,r.configurationProperties.hide)})):Promise.resolve(void 0)}},n=this._taskService.registerTaskProvider(o,t);return this._providers.set(e,{disposable:n,provider:o}),Promise.resolve(void 0)}$unregisterTaskProvider(e){let t=this._providers.get(e);return t&&(t.disposable.dispose(),this._providers.delete(e)),Promise.resolve(void 0)}$fetchTasks(e){return this._taskService.tasks(lmo.to(e)).then(t=>{let o=[];for(let n of t){let r=fR.from(n);r&&o.push(r)}return o})}getWorkspace(e){let t;if(typeof e=="string")t=e;else{let o=this._workspaceContextServer.getWorkspace(),n=A.revive(e);o.configuration?.toString()===n.toString()?t=o:t=this._workspaceContextServer.getWorkspaceFolder(n)}return t}async $getTaskExecution(e){if(cxi.is(e)){let t=this.getWorkspace(e.workspaceFolder);if(t){let o=await this._taskService.getTask(t,e.id,!0);if(o)return{id:o._id,task:fR.from(o)};throw new Error("Task not found")}else throw new Error("No workspace folder")}else{let t=fR.to(e,this._workspaceContextServer,!0);return{id:t._id,task:fR.from(t)}}}$executeTask(e){return new Promise((t,o)=>{if(cxi.is(e)){let n=this.getWorkspace(e.workspaceFolder);n?this._taskService.getTask(n,e.id,!0).then(r=>{if(!r)o(new Error("Task not found"));else{let s={id:e.id,task:fR.from(r)};this._taskService.run(r).then(l=>{(l?.exitCode===void 0||l.exitCode!==0)&&this._proxy.$OnDidEndTask(s)},l=>{}),t(s)}},r=>{o(new Error("Task not found"))}):o(new Error("No workspace folder"))}else{let n=fR.to(e,this._workspaceContextServer,!0);this._taskService.run(n).then(void 0,s=>{});let r={id:n._id,task:fR.from(n)};t(r)}})}$customExecutionComplete(e,t){return new Promise((o,n)=>{this._taskService.getActiveTasks().then(r=>{for(let s of r)if(e===s._id){this._taskService.extensionCallbackTaskComplete(s,t).then(l=>{o(void 0)},l=>{n(l)});return}n(new Error("Task to mark as complete not found"))})})}$terminateTask(e){return new Promise((t,o)=>{this._taskService.getActiveTasks().then(n=>{for(let r of n)if(e===r._id){this._taskService.terminate(r).then(s=>{t(void 0)},s=>{o(void 0)});return}o(new ka("Task to terminate not found"))})})}$registerTaskSystem(e,t){let o;switch(t.platform){case"Web":o=0;break;case"win32":o=3;break;case"darwin":o=1;break;case"linux":o=2;break;default:o=xm}this._taskService.registerTaskSystem(e,{platform:o,uriProvider:n=>A.from({scheme:t.scheme,authority:t.authority,path:n}),context:this._extHostContext,resolveVariables:(n,r,s)=>{let l=[];return r.variables.forEach(c=>l.push(c)),Promise.resolve(this._proxy.$resolveVariables(n.uri,{process:r.process,variables:l})).then(c=>{let u=Array.from(Object.values(c.variables));return new Promise((p,h)=>{this._configurationResolverService.resolveWithInteraction(n,u,"tasks",void 0,s).then(g=>{g||p(void 0);let f={process:void 0,variables:new Map};for(let v=0;v<u.length;v++){let b=l[v].substring(2,l[v].length-1);if(g&&c.variables[l[v]]===l[v]){let S=g.get(b);typeof S=="string"&&f.variables.set(b,S)}else f.variables.set(b,u[v])}We(c.process)&&(f.process=c.process),p(f)},g=>{h(g)})})})},findExecutable:(n,r,s)=>this._proxy.$findExecutable(n,r,s)})}async $registerSupportedExecutions(e,t,o){return this._taskService.registerSupportedExecutions(e,t,o)}};C0t=I([fo(Xi.MainThreadTask),m(1,yf),m(2,Ae),m(3,Xp)],C0t);var E0t=class extends k{constructor(e,t){super();this._labelService=t;this._resourceLabelFormatters=this._register(new Ot)}$registerResourceLabelFormatter(e,t){t.priority=!0;let o=this._labelService.registerCachedFormatter(t);this._resourceLabelFormatters.set(e,o)}$unregisterResourceLabelFormatter(e){this._resourceLabelFormatters.deleteAndDispose(e)}};E0t=I([fo(Xi.MainThreadLabelService),m(1,nt)],E0t);var Jp=le("tunnelService"),O6l=le("sharedTunnelsService");function dxi(a){let i=a;return!!(i.tunnelRemotePort&&i.tunnelRemoteHost&&i.localAddress&&i.privacy&&i.dispose)}function cmo(a){return!!a.forwardPort}function NLe(a){if(a.scheme!=="http"&&a.scheme!=="https")return;let i=/^(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d+)$/.exec(a.authority);if(i)return{address:i[1],port:+i[2]}}function dmo(a){if(a.scheme!=="http"&&a.scheme!=="https"||!a.query)return;let i=a.query.split("&");for(let e of i){let t=e.split("=")[1];if(/^https?:/.exec(t)){let o=NLe(A.parse(t));if(o)return o}}}var ALe=["localhost","127.0.0.1","0:0:0:0:0:0:0:1","::1"];function ete(a){return ALe.indexOf(a)>=0}var QZe=["0.0.0.0","0:0:0:0:0:0:0:0","::"];function v8(a){return QZe.indexOf(a)>=0}function umo(a,i,e,t){if(e===1)return!1;if(e===2&&v8(i)){let o=/(\d+)\.(\d+)\.(\d+)/g.exec(t);if(o?.length===4&&parseInt(o[1])>=18)return!1}return a<1024}var T0t=class{constructor(i,e,t){this.remoteAddress=i;this.localAddress=e;this._dispose=t;this._onDispose=new T;this.onDidDispose=this._onDispose.event}dispose(){return this._onDispose.fire(),this._onDispose.dispose(),this._dispose()}},PLe=class extends k{constructor(e,t){super();this.logService=e;this.configurationService=t;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=[],t=Array.from(this._tunnels.values());for(let o of t){let n=Array.from(o.values());for(let r of n){let s=await r.value;s&&typeof s!="string"&&e.push(s)}}return e}async dispose(){super.dispose();for(let e of this._tunnels.values()){for(let{value:t}of e.values())await t.then(o=>typeof o!="string"?o?.dispose():void 0);e.clear()}this._tunnels.clear()}setEnvironmentTunnel(e,t,o,n,r){this.addTunnelToMap(e,t,Promise.resolve({tunnelRemoteHost:e,tunnelRemotePort:t,localAddress:o,privacy:n,protocol:r,dispose:()=>Promise.resolve()}))}async getExistingTunnel(e,t){(v8(e)||ete(e))&&(e=ALe[0]);let o=this.getTunnelFromMap(e,t);if(o)return++o.refcount,o.value}openTunnel(e,t,o,n,r,s=!1,l,c){this.logService.trace(`ForwardedPorts: (TunnelService) openTunnel request for ${t}:${o} on local port ${r}.`);let u=this._tunnelProvider??e;if(!u)return;if(t||(t="localhost"),n||(n=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 p=this.retainOrCreateTunnel(u,t,o,n,r,s,l,c);return p?p.then(h=>{if(h){if(typeof h=="string")return this.logService.trace("ForwardedPorts: (TunnelService) The tunnel provider returned an error when creating the tunnel."),this.removeEmptyOrErrorTunnelFromMap(t,o),h}else{this.logService.trace("ForwardedPorts: (TunnelService) New tunnel is undefined."),this.removeEmptyOrErrorTunnelFromMap(t,o);return}this.logService.trace("ForwardedPorts: (TunnelService) New tunnel established.");let g=this.makeTunnel(h);return(h.tunnelRemoteHost!==t||h.tunnelRemotePort!==o)&&this.logService.warn("ForwardedPorts: (TunnelService) Created tunnel does not match requirements of requested tunnel. Host or port mismatch."),l&&h.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."),p)}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 t=this._tunnels.get(e.tunnelRemoteHost);if(t){let o=t.get(e.tunnelRemotePort);o&&(o.refcount--,await this.tryDisposeTunnel(e.tunnelRemoteHost,e.tunnelRemotePort,o))}}}}async tryDisposeTunnel(e,t,o){if(o.refcount<=0){this.logService.trace(`ForwardedPorts: (TunnelService) Tunnel is being disposed ${e}:${t}.`);let n=o.value.then(async r=>{r&&typeof r!="string"&&(await r.dispose(!0),this._onTunnelClosed.fire({host:r.tunnelRemoteHost,port:r.tunnelRemotePort}))});return this._tunnels.has(e)&&this._tunnels.get(e).delete(t),n}}async closeTunnel(e,t){this.logService.trace(`ForwardedPorts: (TunnelService) close request for ${e}:${t} `);let o=this._tunnels.get(e);if(o&&o.has(t)){let n=o.get(t);n.refcount=0,await this.tryDisposeTunnel(e,t,n)}}addTunnelToMap(e,t,o){this._tunnels.has(e)||this._tunnels.set(e,new Map),this._tunnels.get(e).set(t,{refcount:1,value:o})}async removeEmptyOrErrorTunnelFromMap(e,t){let o=this._tunnels.get(e);if(o){let n=o.get(t),r=n?await n.value:void 0;(!r||typeof r=="string")&&o.delete(t),o.size===0&&this._tunnels.delete(e)}}getTunnelFromMap(e,t){let o=[e];ete(e)?(o.push(...ALe),o.push(...QZe)):v8(e)&&o.push(...QZe);let n=o.map(r=>this._tunnels.get(r));for(let r of n){let s=r?.get(t);if(s)return s}}canTunnel(e){return!!NLe(e)}createWithProvider(e,t,o,n,r,s,l){this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel with provider ${t}:${o} on local port ${n}.`);let c=o;this._factoryInProgress.add(c);let u=n===void 0?o:n,p={elevationRequired:r?this.isPortPrivileged(u):!1},h={remoteAddress:{host:t,port:o},localAddressPort:n,privacy:s,public:s?s!=="private":void 0,protocol:l},g=e.forwardPort(h,p);return g?(this.addTunnelToMap(t,o,g),g.finally(()=>{this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created by provider."),this._factoryInProgress.delete(c)})):this._factoryInProgress.delete(c),g}};PLe=I([m(0,re),m(1,B)],PLe);var pmo=le("IExtHostInitDataService");var mmo=le("IExtHostRpcService");var uxi=class extends T0t{},D0t;(e=>{function a(t){return{remoteAddress:t.remoteAddress,localAddress:t.localAddress,public:!!t.public,privacy:t.privacy??(t.public?"public":"private"),protocol:t.protocol}}e.fromApiTunnel=a;function i(t){return{remoteAddress:{host:t.tunnelRemoteHost,port:t.tunnelRemotePort},localAddress:t.localAddress,public:t.privacy!=="constantPrivate"&&t.privacy!=="constantPrivate",privacy:t.privacy,protocol:t.protocol}}e.fromServiceTunnel=i})(D0t||={});var l9l=le("IExtHostTunnelService"),_0t=class extends k{constructor(e,t,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(Xi.MainThreadTunnelService)}async openTunnel(e,t){this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) ${e.identifier.value} called openTunnel API for ${t.remoteAddress.host}:${t.remoteAddress.port}.`);let o=await this._proxy.$openTunnel(t,e.displayName);if(o){let n=new uxi(o.remoteAddress,o.localAddress,()=>this._proxy.$closeTunnel(o.remoteAddress));return this._register(n),n}}async getTunnels(){return this._proxy.$getTunnels()}nextPortAttributesProviderHandle(){return this._providerHandleCounter++}registerPortsAttributesProvider(e,t){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:t}),this._proxy.$registerPortsAttributesProvider(e,o),new sZ(()=>{this._portAttributesProviders.delete(o),this._proxy.$unregisterPortsAttributesProvider(o)})}async $providePortAttributes(e,t,o,n,r){let s=[];for(let c of e){let u=this._portAttributesProviders.get(c);if(!u)return[];s.push(...await Promise.all(t.map(async p=>{let h;try{h=await u.provider.providePortAttributes({port:p,pid:o,commandLine:n},r)}catch{h=await u.provider.providePortAttributes(p,o,n,r)}return{providedAttributes:h,port:p}})))}let l=s.filter(c=>!!c.providedAttributes);return l.length>0?l.map(c=>({autoForwardAction:c.providedAttributes.autoForwardAction,port:c.port})):[]}async $registerCandidateFinder(e){}registerTunnelProvider(e,t){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(n,r)=>await e.provideTunnel(n,r,Ie.None)??void 0;let o=t.tunnelFeatures?{elevation:!!t.tunnelFeatures?.elevation,privacyOptions:t.tunnelFeatures?.privacyOptions,protocol:t.tunnelFeatures.protocol===void 0?!0:t.tunnelFeatures.protocol}:void 0;return this._proxy.$setTunnelProvider(o,!0),Promise.resolve(ee(()=>{this._forwardPortProvider=void 0,this._proxy.$setTunnelProvider(void 0,!1)}))}hasTunnelProvider(){return this._proxy.$hasTunnelProvider()}async setTunnelFactory(e,t){if(e){e.candidatePortSource!==void 0&&this._proxy.$setCandidatePortSource(e.candidatePortSource),e.showCandidatePort&&(this._showCandidatePort=e.showCandidatePort,this._proxy.$setCandidateFilter());let o=e.tunnelFactory??(t?this.makeManagedTunnelFactory(t):void 0);if(o){this._forwardPortProvider=o;let n=e.tunnelFeatures?.privacyOptions??[];e.tunnelFeatures?.public&&n.length===0&&(n=[{id:"private",label:d(4118,null),themeIcon:"lock"},{id:"public",label:d(4119,null),themeIcon:"eye"}]);let r=e.tunnelFeatures?{elevation:!!e.tunnelFeatures?.elevation,public:!!e.tunnelFeatures?.public,privacyOptions:n,protocol:!0}:void 0;this._proxy.$setTunnelProvider(r,!!e.tunnelFactory)}}else this._forwardPortProvider=void 0;return ee(()=>{this._forwardPortProvider=void 0})}makeManagedTunnelFactory(e){}async $closeTunnel(e,t){if(this._extensionTunnels.has(e.host)){let o=this._extensionTunnels.get(e.host);o.has(e.port)&&(t&&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,t){if(this._forwardPortProvider)try{this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Getting tunnel from provider.");let o=this._forwardPortProvider(e,t);if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Got tunnel promise from provider."),o!==void 0){let n=await o;if(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Successfully awaited tunnel from provider."),n===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 r=this._register(n.onDidDispose(()=>(this.logService.trace("ForwardedPorts: (ExtHostTunnelService) Extension fired tunnel's onDidDispose."),this._proxy.$closeTunnel(n.remoteAddress))));return this._extensionTunnels.get(e.remoteAddress.host).set(e.remoteAddress.port,{tunnel:n,disposeListener:r}),D0t.fromApiTunnel(n)}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 t=await Promise.all(e.map(n=>this._showCandidatePort(n.host,n.port,n.detail??""))),o=e.filter((n,r)=>t[r]);return this.logService.trace(`ForwardedPorts: (ExtHostTunnelService) filtered from ${e.map(n=>n.port).join(", ")} to ${o.map(n=>n.port).join(", ")}`),o}};_0t=I([m(0,mmo),m(1,pmo),m(2,re)],_0t);var DZo=10*1e3,R0t="remote.tunnels.toRestore",pxi="remote.tunnels.toRestoreExpiration",RZo=1e3*60*60*24*14,hmo="onTunnel",Xme=new Y("forwardedPortsViewEnabled",!1,d(19242,null)),xG=new Y("forwardedPortsViewOnlyEnabled",!1,d(19242,null));function XZe(a){let i=a.match(/^([a-zA-Z0-9_-]+(?:\.[a-zA-Z0-9_-]+)*:)?([0-9]+)$/);if(i)return{host:i[1]?.substring(0,i[1].length-1)||"localhost",port:Number(i[2])}}var mxi={source:0,description:d(19244,null)},M0t={source:1,description:d(19243,null)};function gmo(a,i,e){let t=a.get(Sm(i,e));if(t)return t;if(ete(i))for(let o of ALe){let n=Sm(o,e);if(a.has(n))return a.get(n)}else if(v8(i))for(let o of QZe){let n=Sm(o,e);if(a.has(n))return a.get(n)}}function sS(a,i,e){let t=gmo(a,i,e);if(t)return t;let o=v8(i)?"localhost":ete(i)?"0.0.0.0":void 0;if(o)return gmo(a,o,e)}function Sm(a,i){return a+":"+i}function LZo(a){return a&&"host"in a&&typeof a.host=="string"&&"port"in a&&typeof a.port=="number"&&(!("detail"in a)||typeof a.detail=="string")&&(!("pid"in a)||typeof a.pid=="string")}var L0t=class a extends k{constructor(e){super();this.configurationService=e;this.portsAttributes=[];this._onDidChangeAttributes=this._register(new T);this.onDidChangeAttributes=this._onDidChangeAttributes.event;this._register(e.onDidChangeConfiguration(t=>{(t.affectsConfiguration(a.SETTING)||t.affectsConfiguration(a.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,t,o){let n=this.findNextIndex(e,t,o,this.portsAttributes,0),r={label:void 0,onAutoForward:void 0,elevateIfNeeded:void 0,requireLocalPort:void 0,protocol:void 0};for(;n>=0;){let s=this.portsAttributes[n];s.key===e?(r.onAutoForward=s.onAutoForward??r.onAutoForward,r.elevateIfNeeded=s.elevateIfNeeded!==void 0?s.elevateIfNeeded:r.elevateIfNeeded,r.label=s.label??r.label,r.requireLocalPort=s.requireLocalPort,r.protocol=s.protocol):(r.onAutoForward=r.onAutoForward??s.onAutoForward,r.elevateIfNeeded=r.elevateIfNeeded!==void 0?r.elevateIfNeeded:s.elevateIfNeeded,r.label=r.label??s.label,r.requireLocalPort=r.requireLocalPort!==void 0?r.requireLocalPort:void 0,r.protocol=r.protocol??s.protocol),n=this.findNextIndex(e,t,o,this.portsAttributes,n+1)}return r.onAutoForward!==void 0||r.elevateIfNeeded!==void 0||r.label!==void 0||r.requireLocalPort!==void 0||r.protocol!==void 0?r:this.getOtherAttributes()}hasStartEnd(e){return e.start!==void 0&&e.end!==void 0}hasHostAndPort(e){return e.host!==void 0&&e.port!==void 0&&We(e.host)&&on(e.port)}findNextIndex(e,t,o,n,r){if(r>=n.length)return-1;let s=!ete(t)&&!v8(t),c=n.slice(r).findIndex(u=>on(u.key)?s?!1:u.key===e:this.hasStartEnd(u.key)?s?!1:e>=u.key.start&&e<=u.key.end:this.hasHostAndPort(u.key)?e===u.key.port&&t===u.key.host:o?u.key.test(o):!1);return c>=0?c+r:-1}readSetting(){let e=this.configurationService.getValue(a.SETTING);if(!e||!Di(e))return[];let t=[];for(let n in e){if(n===void 0)continue;let r=e[n],s;if(Number(n))s=Number(n);else if(We(n))if(a.RANGE.test(n)){let l=n.match(a.RANGE);s={start:Number(l[1]),end:Number(l[2])}}else if(a.HOST_AND_PORT.test(n)){let l=n.match(a.HOST_AND_PORT);s={host:l[1],port:Number(l[2])}}else{let l;try{l=RegExp(n)}catch{}l&&(s=l)}s&&t.push({key:s,elevateIfNeeded:r.elevateIfNeeded,onAutoForward:r.onAutoForward,label:r.label,requireLocalPort:r.requireLocalPort,protocol:r.protocol})}let o=this.configurationService.getValue(a.DEFAULTS);return o&&(this.defaultPortAttributes={elevateIfNeeded:o.elevateIfNeeded,label:o.label,onAutoForward:o.onAutoForward,requireLocalPort:o.requireLocalPort,protocol:o.protocol}),this.sortAttributes(t)}sortAttributes(e){function t(o,n){return on(o.key)?o.key:n.hasStartEnd(o.key)?o.key.start:n.hasHostAndPort(o.key)?o.key.port:Number.MAX_VALUE}return e.sort((o,n)=>t(o,this)-t(n,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,t,o){let r=this.configurationService.inspect(a.SETTING).userRemoteValue,s;!r||!Di(r)?s={}:s=io(r),s[`${e}`]||(s[`${e}`]={});for(let l in t)s[`${e}`][l]=t[l];return this.configurationService.updateValue(a.SETTING,s,o)}},Yme=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.tunnelService=e;this.storageService=t;this.configurationService=o;this.environmentService=n;this.remoteAuthorityResolverService=r;this.workspaceContextService=s;this.logService=l;this.dialogService=c;this.extensionService=u;this.contextKeyService=p;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 L0t(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 h=>{let g=await this.getAttributes(h.map(f=>({port:f.tunnelRemotePort,host:f.tunnelRemoteHost})));for(let f of h)if(f.localAddress){let v=Sm(f.tunnelRemoteHost,f.tunnelRemotePort),b=sS(this._candidates??new Map,f.tunnelRemoteHost,f.tunnelRemotePort);this.forwarded.set(v,{remotePort:f.tunnelRemotePort,remoteHost:f.tunnelRemoteHost,localAddress:f.localAddress,protocol:g?.get(f.tunnelRemotePort)?.protocol??"http",localUri:await this.makeLocalUri(f.localAddress,g?.get(f.tunnelRemotePort)),localPort:f.tunnelLocalPort,name:g?.get(f.tunnelRemotePort)?.label,runningProcess:b?.detail,hasRunningProcess:!!b,pid:b?.pid,privacy:f.privacy,source:mxi}),this.remoteTunnels.set(v,f)}}),this.detected=new Map,this._register(this.tunnelService.onTunnelOpened(async h=>{let g=Sm(h.tunnelRemoteHost,h.tunnelRemotePort);if(!sS(this.forwarded,h.tunnelRemoteHost,h.tunnelRemotePort)&&!sS(this.detected,h.tunnelRemoteHost,h.tunnelRemotePort)&&!sS(this.inProgress,h.tunnelRemoteHost,h.tunnelRemotePort)&&h.localAddress){let f=sS(this._candidates??new Map,h.tunnelRemoteHost,h.tunnelRemotePort),v=(await this.getAttributes([{port:h.tunnelRemotePort,host:h.tunnelRemoteHost}]))?.get(h.tunnelRemotePort);this.forwarded.set(g,{remoteHost:h.tunnelRemoteHost,remotePort:h.tunnelRemotePort,localAddress:h.localAddress,protocol:v?.protocol??"http",localUri:await this.makeLocalUri(h.localAddress,v),localPort:h.tunnelLocalPort,name:v?.label,closeable:!0,runningProcess:f?.detail,hasRunningProcess:!!f,pid:f?.pid,privacy:h.privacy,source:mxi})}await this.storeForwarded(),this.checkExtensionActivationEvents(!0),this.remoteTunnels.set(g,h),this._onForwardPort.fire(this.forwarded.get(g))})),this._register(this.tunnelService.onTunnelClosed(h=>this.onTunnelClosed(h,"Other"))),this.checkExtensionActivationEvents(!1)}extensionHasActivationEvent(){return this.extensionService.extensions.find(e=>e.activationEvents?.includes(hmo))?(this.contextKeyService.createKey(xG.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,t){let o=Sm(e.host,e.port);this.forwarded.delete(o)&&(await this.storeForwarded(),this._onClosePort.fire(e))}makeLocalUri(e,t){if(e.startsWith("http"))return A.parse(e);let o=t?.protocol??"http";return A.parse(`${o}://${e}`)}async addStorageKeyPostfix(e){let t=this.workspaceContextService.getWorkspace(),o=t.configuration?Lr(t.configuration.path):t.folders.length>0?Lr(t.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(R0t)}async getRestoreExpirationStorageKey(){return this.addStorageKeyPostfix(pxi)}async getTunnelRestoreValue(){let e=this.storageService.get(R0t,1);if(e)return this.storageService.remove(R0t,1),await this.storeForwarded(),e;let t=await this.getTunnelRestoreStorageKey();if(t)return this.storageService.get(t,0)}async restoreForwarded(){if(this.cleanupExpiredTunnelsForRestore(),this.configurationService.getValue("remote.restoreForwardedPorts")){let e=await this.tunnelRestoreValue;if(e&&e!==this.knownPortsRestoreValue){let t=JSON.parse(e)??[];this.logService.trace(`ForwardedPorts: (TunnelModel) restoring ports ${t.map(o=>o.remotePort).join(", ")}`);for(let o of t){let n=sS(this.detected,o.remoteHost,o.remotePort);o.source.source!==2&&!n||o.source.source===2&&n?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&&!n&&this.unrestoredExtensionTunnels.set(Sm(o.remoteHost,o.remotePort),o)}}}if(this.restoreComplete=!0,this.onRestoreComplete.fire(),!this.restoreListener){let e=await this.getTunnelRestoreStorageKey();this.restoreListener=this._register(new O),this.restoreListener.add(this.storageService.onDidChangeValue(0,void 0,this.restoreListener)(async t=>{t.key===e&&(this.tunnelRestoreValue=Promise.resolve(this.storageService.get(e,0)),await this.restoreForwarded())}))}}cleanupExpiredTunnelsForRestore(){let e=this.storageService.keys(0,0).filter(t=>t.startsWith(pxi));for(let t of e){let o=this.storageService.getNumber(t,0);if(o&&o<Date.now()){this.tunnelRestoreValue=Promise.resolve(void 0);let n=t.replace(pxi,R0t);this.storageService.remove(t,0),this.storageService.remove(n,0)}}}async storeForwarded(){if(this.configurationService.getValue("remote.restoreForwardedPorts")){let e=Array.from(this.forwarded.values()),t=e.map(s=>({remoteHost:s.remoteHost,remotePort:s.remotePort,localPort:s.localPort,name:s.name,localAddress:s.localAddress,localUri:s.localUri,protocol:s.protocol,source:s.source})),o;e.length>0&&(o=JSON.stringify(t));let n=await this.getTunnelRestoreStorageKey(),r=await this.getRestoreExpirationStorageKey();!o&&n&&r?(this.storageService.remove(n,0),this.storageService.remove(r,0)):o!==this.knownPortsRestoreValue&&n&&r&&(this.storageService.store(n,o,0,0),this.storageService.store(r,Date.now()+RZo,0,0)),this.knownPortsRestoreValue=o}}async showPortMismatchModalIfNeeded(e,t,o){if(!e.tunnelLocalPort||!o?.requireLocalPort||e.tunnelLocalPort===t)return;let n=new Date;if(this.mismatchCooldown.getTime()+DZo>n.getTime())return;this.mismatchCooldown=n;let r=d(19241,null,t,e.tunnelRemotePort,e.tunnelLocalPort);return this.dialogService.info(r)}async forward(e,t){return!this.restoreComplete&&this.environmentService.remoteAuthority&&await U.toPromise(this.onRestoreComplete.event),this.doForward(e,t)}async doForward(e,t){await this.extensionService.activateByEvent(hmo);let o=sS(this.forwarded,e.remote.host,e.remote.port);t=t??(t!==null?(await this.getAttributes([e.remote]))?.get(e.remote.port):void 0);let n=e.local!==void 0?e.local:e.remote.port,r;if(o)return this.mergeAttributesIntoExistingTunnel(o,e,t);{let s=this.environmentService.remoteAuthority,l=s?{getAddress:async()=>(await this.remoteAuthorityResolverService.resolveAuthority(s)).authority}:void 0,c=Sm(e.remote.host,e.remote.port);this.inProgress.set(c,!0),e=this.mergeCachedAndUnrestoredProperties(c,e);let u=await this.tunnelService.openTunnel(l,e.remote.host,e.remote.port,void 0,n,e.elevateIfNeeded?e.elevateIfNeeded:t?.elevateIfNeeded,e.privacy,t?.protocol);if(typeof u=="string")r=u;else if(u&&u.localAddress){let p=sS(this._candidates??new Map,e.remote.host,e.remote.port),h=u.protocol?u.protocol==="https"?"https":"http":t?.protocol??"http",g={remoteHost:u.tunnelRemoteHost,remotePort:u.tunnelRemotePort,localPort:u.tunnelLocalPort,name:t?.label??e.name,closeable:!0,localAddress:u.localAddress,protocol:h,localUri:await this.makeLocalUri(u.localAddress,t),runningProcess:p?.detail,hasRunningProcess:!!p,pid:p?.pid,source:e.source??mxi,privacy:u.privacy};return this.forwarded.set(c,g),this.remoteTunnels.set(c,u),this.inProgress.delete(c),await this.storeForwarded(),await this.showPortMismatchModalIfNeeded(u,n,t),this._onForwardPort.fire(g),u}this.inProgress.delete(c)}return r}mergeCachedAndUnrestoredProperties(e,t){let o=this.unrestoredExtensionTunnels.has(e)?this.unrestoredExtensionTunnels:this.sessionCachedProperties.has(e)?this.sessionCachedProperties:void 0;if(o){let n=o.get(e);o.delete(e),n&&(t.name=n.name??t.name,t.local=("local"in n?n.local:"localPort"in n?n.localPort:void 0)??t.local,t.privacy=t.privacy)}return t}async mergeAttributesIntoExistingTunnel(e,t,o){let n=o?.label??t.name,r;(p=>(p[p.None=0]="None",p[p.Fire=1]="Fire",p[p.Reopen=2]="Reopen"))(r||={});let s=0;switch(n!==e.name&&(e.name=n,s=1),(o?.protocol||e.protocol!=="http")&&o?.protocol!==e.protocol&&(t.source=e.source,s=2),t.privacy&&e.privacy!==t.privacy&&(s=2),s){case 1:{this._onForwardPort.fire();break}case 2:await this.close(e.remoteHost,e.remotePort,"User"),await this.doForward(t,o)}return sS(this.remoteTunnels,t.remote.host,t.remote.port)}async name(e,t,o){let n=sS(this.forwarded,e,t),r=Sm(e,t);if(n){n.name=o,await this.storeForwarded(),this._onPortName.fire({host:e,port:t});return}else this.detected.has(r)&&(this.detected.get(r).name=o,this._onPortName.fire({host:e,port:t}))}async close(e,t,o){let n=Sm(e,t),r=this.forwarded.get(n);return o==="AutoForwardEnd"&&r&&r.source.source===1&&this.sessionCachedProperties.set(n,{local:r.localPort,name:r.name,privacy:r.privacy}),await this.tunnelService.closeTunnel(e,t),this.onTunnelClosed({host:e,port:t},o)}address(e,t){let o=Sm(e,t);return(this.forwarded.get(o)||this.detected.get(o))?.localAddress}get environmentTunnelsSet(){return this._environmentTunnelsSet}addEnvironmentTunnels(e){if(e)for(let t of e){let o=sS(this._candidates??new Map,t.remoteAddress.host,t.remoteAddress.port),n=typeof t.localAddress=="string"?t.localAddress:Sm(t.localAddress.host,t.localAddress.port);this.detected.set(Sm(t.remoteAddress.host,t.remoteAddress.port),{remoteHost:t.remoteAddress.host,remotePort:t.remoteAddress.port,localAddress:n,protocol:"http",localUri:this.makeLocalUri(n),closeable:!1,runningProcess:o?.detail,hasRunningProcess:!!o,pid:o?.pid,privacy:"constantPrivate",source:{source:2,description:d(19245,null)}}),this.tunnelService.setEnvironmentTunnel(t.remoteAddress.host,t.remoteAddress.port,n,"constantPrivate","http")}this._environmentTunnelsSet=!0,this._onEnvironmentTunnelsSet.fire(),this._onForwardPort.fire()}setCandidateFilter(e){this._candidateFilter=e}async setCandidates(e){let t=e;this._candidateFilter&&(t=await this._candidateFilter(e));let o=this.updateInResponseToCandidates(t);this.logService.trace(`ForwardedPorts: (TunnelModel) removed candidates ${Array.from(o.values()).map(n=>n.port).join(", ")}`),this._onCandidatesChanged.fire(o)}updateInResponseToCandidates(e){let t=this._candidates??new Map,o=new Map;return this._candidates=o,e.forEach(n=>{let r=Sm(n.host,n.port);o.set(r,{host:n.host,port:n.port,detail:n.detail,pid:n.pid}),t.delete(r);let s=sS(this.forwarded,n.host,n.port);s&&(s.runningProcess=n.detail,s.hasRunningProcess=!0,s.pid=n.pid)}),t.forEach((n,r)=>{let s=XZe(r);if(!s)return;let l=sS(this.forwarded,s.host,s.port);l&&(l.runningProcess=void 0,l.hasRunningProcess=!1,l.pid=void 0);let c=sS(this.detected,s.host,s.port);c&&(c.runningProcess=void 0,c.hasRunningProcess=!1,c.pid=void 0)}),t}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()),t=await this.getAttributes(e.map(o=>({port:o.remotePort,host:o.remoteHost})),!1);if(t)for(let o of e){let n=t.get(o.remotePort);(n?.protocol||o.protocol!=="http")&&n?.protocol!==o.protocol&&await this.doForward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,source:o.source},n),n&&n.label&&n.label!==o.name&&await this.name(o.remoteHost,o.remotePort,n.label)}}async getAttributes(e,t=!0){let o=new Map,n=new Map;e.forEach(u=>{let p=sS(this._candidates??new Map,ALe[0],u.port)??u;if(p){o.set(u.port,p);let h=LZo(p)?p.pid:void 0;n.has(h)||n.set(h,[]),n.get(h)?.push(u.port)}});let r=new Map;if(e.forEach(u=>{let p=this.configPortsAttributes.getAttributes(u.port,u.host,o.get(u.port)?.detail);p&&r.set(u.port,p)}),this.portAttributesProviders.length===0||!t)return r.size>0?r:void 0;let s=await Promise.all(this.portAttributesProviders.flatMap(u=>Array.from(n.entries()).map(p=>{let h=p[1],g=o.get(h[0]);return u.providePortAttributes(h,g?.pid,g?.detail,Ie.None)}))),l=new Map;if(s.forEach(u=>u.forEach(p=>{p&&l.set(p.port,p)})),!r&&!l)return;let c=new Map;return e.forEach(u=>{let p=r.get(u.port),h=l.get(u.port);c.set(u.port,{elevateIfNeeded:p?.elevateIfNeeded,label:p?.label,onAutoForward:p?.onAutoForward??L0t.providedActionToAction(h?.autoForwardAction),requireLocalPort:p?.requireLocalPort,protocol:p?.protocol})}),c}addAttributesProvider(e){this.portAttributesProviders.push(e)}};I([Tu(1e3)],Yme.prototype,"storeForwarded",1),Yme=I([m(0,Jp),m(1,de),m(2,B),m(3,Mt),m(4,dd),m(5,Ae),m(6,re),m(7,ct),m(8,lt),m(9,X)],Yme);var Wu=le("remoteExplorerService"),ZZe="remote.explorerType",b8="~remote.forwardedPorts",P0t="~remote.forwardedPortsContainer",S8="remote.autoForwardPorts",vR="remote.autoForwardPortsSource",eet="remote.autoForwardPortsFallback",kG="process",tte="output",OLe="hybrid";var MZo={type:"object",required:["id"],properties:{id:{description:d(19233,null),type:"string"}}},PZo=zn.registerExtensionPoint({extensionPoint:"remoteHelp",jsonSchema:{description:d(19234,null),type:"object",properties:{getStarted:{description:d(19238,null),oneOf:[{type:"string"},MZo]},documentation:{description:d(19235,null),type:"string"},feedback:{description:d(19236,null),type:"string",markdownDeprecationMessage:d(19237,null,"`reportIssue`")},reportIssue:{description:d(19240,null),type:"string"},issues:{description:d(19239,null),type:"string"}}}});var JZe=class{constructor(i,e,t){this.storageService=i;this.tunnelService=e;this._targetType=[];this._onDidChangeTargetType=new T;this.onDidChangeTargetType=this._onDidChangeTargetType.event;this._onDidChangeHelpInformation=new T;this.onDidChangeHelpInformation=this._onDidChangeHelpInformation.event;this._helpInformation=[];this._onDidChangeEditable=new T;this.onDidChangeEditable=this._onDidChangeEditable.event;this._onEnabledPortsFeatures=new T;this.onEnabledPortsFeatures=this._onEnabledPortsFeatures.event;this._portsFeaturesEnabled=0;this.namedProcesses=new Map;this._tunnelModel=t.createInstance(Yme),PZo.setHandler(o=>{this._helpInformation.push(...o),this._onDidChangeHelpInformation.fire(o)})}get helpInformation(){return this._helpInformation}set targetType(i){let e=this._targetType.length>0?this._targetType[0]:"",t=i.length>0?i[0]:"";e!==t&&(this._targetType=i,this.storageService.store(ZZe,this._targetType.toString(),1,1),this.storageService.store(ZZe,this._targetType.toString(),0,0),this._onDidChangeTargetType.fire(this._targetType))}get targetType(){return this._targetType}get tunnelModel(){return this._tunnelModel}forward(i,e){return this.tunnelModel.forward(i,e)}close(i,e){return this.tunnelModel.close(i.host,i.port,e)}setTunnelInformation(i){i?.features&&this.tunnelService.setTunnelFeatures(i.features),this.tunnelModel.addEnvironmentTunnels(i?.environmentTunnels)}setEditable(i,e,t){t?this._editable={tunnelItem:i,data:t,editId:e}:this._editable=void 0,this._onDidChangeEditable.fire(i?{tunnel:i,editId:e}:void 0)}getEditableData(i,e){return this._editable&&(!i&&i===this._editable.tunnelItem||i&&this._editable.tunnelItem?.remotePort===i.remotePort&&this._editable.tunnelItem.remoteHost===i.remoteHost&&this._editable.editId===e)?this._editable.data:void 0}setCandidateFilter(i){return i?(this.tunnelModel.setCandidateFilter(i),{dispose:()=>{this.tunnelModel.setCandidateFilter(void 0)}}):{dispose:()=>{}}}onFoundNewCandidates(i){this.tunnelModel.setCandidates(i)}restore(){return this.tunnelModel.restoreForwarded()}enablePortsFeatures(i){this._portsFeaturesEnabled=i?1:2,this._onEnabledPortsFeatures.fire()}get portsFeaturesEnabled(){return this._portsFeaturesEnabled}};JZe=I([m(0,de),m(1,Jp),m(2,F)],JZe);Ce(Wu,JZe,1);var A0t=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.remoteExplorerService=t;this.tunnelService=o;this.notificationService=n;this.configurationService=r;this.logService=s;this.remoteAgentService=l;this.contextKeyService=c;this.elevateionRetry=!1;this.portsAttributesProviders=new Map;this._alreadyRegistered=!1;this._proxy=e.getProxy(ao.ExtHostTunnelService),this._register(o.onTunnelOpened(()=>this._proxy.$onDidTunnelsChange())),this._register(o.onTunnelClosed(()=>this._proxy.$onDidTunnelsChange()))}processFindingEnabled(){return(!!this.configurationService.getValue(S8)||this.tunnelService.hasTunnelProvider)&&this.configurationService.getValue(vR)!==tte}async $setRemoteTunnelService(e){this.remoteExplorerService.namedProcesses.set(e,"Code Extension Host"),this.remoteExplorerService.portsFeaturesEnabled===2?this._proxy.$registerCandidateFinder(this.processFindingEnabled()):this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>this._proxy.$registerCandidateFinder(this.processFindingEnabled()))),this._register(this.configurationService.onDidChangeConfiguration(async t=>{if(this.remoteExplorerService.portsFeaturesEnabled===2&&(t.affectsConfiguration(S8)||t.affectsConfiguration(vR)))return this._proxy.$registerCandidateFinder(this.processFindingEnabled())})),this._register(this.tunnelService.onAddedTunnelProvider(async()=>{if(this.remoteExplorerService.portsFeaturesEnabled===2)return this._proxy.$registerCandidateFinder(this.processFindingEnabled())}))}async $registerPortsAttributesProvider(e,t){this.portsAttributesProviders.set(t,e),this._alreadyRegistered||(this.remoteExplorerService.tunnelModel.addAttributesProvider(this),this._alreadyRegistered=!0)}async $unregisterPortsAttributesProvider(e){this.portsAttributesProviders.delete(e)}async providePortAttributes(e,t,o,n){if(this.portsAttributesProviders.size===0)return[];let r=Array.from(this.portsAttributesProviders.entries()).filter(s=>{let l=s[1],c=typeof l.portRange=="number"?[l.portRange,l.portRange+1]:l.portRange,u=c?e.some(h=>c[0]<=h&&h<c[1]):!0,p=!l.commandPattern||o&&o.match(l.commandPattern);return u&&p}).map(s=>s[0]);return r.length===0?[]:this._proxy.$providePortAttributes(r,e,t,o,n)}async $openTunnel(e,t){let o=await this.remoteExplorerService.forward({remote:e.remoteAddress,local:e.localAddressPort,name:e.label,source:{source:2,description:t},elevateIfNeeded:!1});if(!(!o||typeof o=="string"))return!this.elevateionRetry&&e.localAddressPort!==void 0&&o.tunnelLocalPort!==void 0&&this.tunnelService.isPortPrivileged(e.localAddressPort)&&o.tunnelLocalPort!==e.localAddressPort&&this.tunnelService.canElevate&&this.elevationPrompt(e,o,t),D0t.fromServiceTunnel(o)}async elevationPrompt(e,t,o){return this.notificationService.prompt(ft.Info,d(3963,null,o,e.remoteAddress.port,e.localAddressPort),[{label:d(3964,null,t.tunnelRemotePort),run:async()=>{this.elevateionRetry=!0,await this.remoteExplorerService.close({host:t.tunnelRemoteHost,port:t.tunnelRemotePort},"Other"),await this.remoteExplorerService.forward({remote:e.remoteAddress,local:e.localAddressPort,name:e.label,source:{source:2,description:o},elevateIfNeeded:!0}),this.elevateionRetry=!1}}])}async $closeTunnel(e){return this.remoteExplorerService.close(e,"Other")}async $getTunnels(){return(await this.tunnelService.tunnels).map(e=>({remoteAddress:{port:e.tunnelRemotePort,host:e.tunnelRemoteHost},localAddress:e.localAddress,privacy:e.privacy,protocol:e.protocol}))}async $onFoundNewCandidates(e){this.remoteExplorerService.onFoundNewCandidates(e)}async $setTunnelProvider(e,t){let o={forwardPort:(n,r)=>this._proxy.$forwardPort(n,r).then(l=>{if(l){if(typeof l=="string")return l}else return;let c=l;return this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) New tunnel established by tunnel provider: ${c?.remoteAddress.host}:${c?.remoteAddress.port}`),{tunnelRemotePort:c.remoteAddress.port,tunnelRemoteHost:c.remoteAddress.host,localAddress:typeof c.localAddress=="string"?c.localAddress:Sm(c.localAddress.host,c.localAddress.port),tunnelLocalPort:typeof c.localAddress!="string"?c.localAddress.port:void 0,public:c.public,privacy:c.privacy,protocol:c.protocol??"http",dispose:async u=>(this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) Closing tunnel from tunnel provider: ${c?.remoteAddress.host}:${c?.remoteAddress.port}`),this._proxy.$closeTunnel({host:c.remoteAddress.host,port:c.remoteAddress.port},u))}})};e&&this.tunnelService.setTunnelFeatures(e),this.tunnelService.setTunnelProvider(o),t&&this.contextKeyService.createKey(Xme.key,!0)}async $hasTunnelProvider(){return this.tunnelService.hasTunnelProvider}async $setCandidateFilter(){this.remoteExplorerService.setCandidateFilter(e=>this._proxy.$applyCandidateFilter(e))}async $setCandidatePortSource(e){this.remoteAgentService.getEnvironment().then(()=>{switch(e){case 0:{oe.as($t.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPorts":!1}}]);break}case 2:{oe.as($t.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":tte}}]);break}case 3:{oe.as($t.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":OLe}}]);break}default:}}).catch(()=>{})}};A0t=I([fo(Xi.MainThreadTunnelService),m(1,Wu),m(2,Jp),m(3,Ne),m(4,B),m(5,re),m(6,bo),m(7,X)],A0t);var RN=le("IAuthenticationUsageService"),tet=class extends k{constructor(e,t,o,n){super();this._storageService=e;this._authenticationService=t;this._logService=o;this._queue=this._register(new Hh);this._extensionsUsingAuth=new Set;this._disposed=!1;this._register(ee(()=>this._disposed=!0));let r=n.trustedExtensionAuthAccess;if(Array.isArray(r))for(let s of r)this._extensionsUsingAuth.add(s);else if(r)for(let s of Object.values(r))for(let l of s)this._extensionsUsingAuth.add(l);this._register(this._authenticationService.onDidRegisterAuthenticationProvider(s=>this._queue.queue(()=>this._addExtensionsToCache(s.id))))}async initializeExtensionUsageCache(){await this._queue.queue(()=>Promise.all(this._authenticationService.getProviderIds().map(e=>this._addExtensionsToCache(e))))}async extensionUsesAuth(e){return await this._queue.whenIdle(),this._extensionsUsingAuth.has(e)}readAccountUsages(e,t){let o=`${e}-${t}-usages`,n=this._storageService.get(o,-1),r=[];if(n)try{r=JSON.parse(n)}catch{}return r}removeAccountUsage(e,t){let o=`${e}-${t}-usages`;this._storageService.remove(o,-1)}addAccountUsage(e,t,o,n,r){let s=`${e}-${t}-usages`,l=this.readAccountUsages(e,t),c=l.findIndex(u=>u.extensionId===n);c>-1?l.splice(c,1,{extensionId:n,extensionName:r,scopes:o,lastUsed:Date.now()}):l.push({extensionId:n,extensionName:r,scopes:o,lastUsed:Date.now()}),this._storageService.store(s,JSON.stringify(l),-1,1),this._extensionsUsingAuth.add(n)}async _addExtensionsToCache(e){if(!this._disposed)try{let t=await this._authenticationService.getAccounts(e);for(let o of t){let n=this.readAccountUsages(e,o.label);for(let r of n)this._extensionsUsingAuth.add(r.extensionId)}}catch(t){this._logService.error(t)}}};tet=I([m(0,de),m(1,ks),m(2,re),m(3,Ze)],tet);Ce(RN,tet,1);var fxi="/.well-known",z7l=`${fxi}/oauth-protected-resource`,K7l=`${fxi}/oauth-authorization-server`,G7l=`${fxi}/openid-configuration`;function vmo(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.access_token!==void 0&&i.token_type!==void 0}function vxi(a){let i=[],e=[],t="",o=!1;for(let r=0;r<a.length;r++){let s=a[r];s==='"'?(o=!o,t+=s):s===","&&!o?(t.trim()&&e.push(t.trim()),t=""):t+=s}t.trim()&&e.push(t.trim());let n;for(let r of e)if(!r.includes("="))n&&i.push(n),n={scheme:r.trim(),params:{}};else{let l=r.indexOf(" ");if(l>0){let c=r.substring(0,l),u=r.substring(l+1);if(!c.includes("=")&&u.includes("=")){n&&i.push(n),n={scheme:c.trim(),params:{}};let p=u.indexOf("=");if(p>0){let h=u.substring(0,p).trim(),g=u.substring(p+1).trim().replace(/^"|"$/g,"");h&&g!==void 0&&(n.params[h]=g)}continue}}if(n){let c=r.indexOf("=");if(c>0){let u=r.substring(0,c).trim(),p=r.substring(c+1).trim().replace(/^"|"$/g,"");u&&p!==void 0&&(n.params[u]=p)}}}return n&&i.push(n),i}function N0t(a,i){if(a===i)return!0;if(!a||!i||a.length!==i.length)return!1;let e=[...a].sort(),t=[...i].sort();return e.every((o,n)=>o===t[n])}function bxi(a){return`onAuthenticationRequest:${a}`}async function ite(a,i){let e=await a.get(`${i.urlProtocol}.loginAccount`);if(e)try{let t=JSON.parse(e);if(t&&We(t.id)&&We(t.accessToken)&&We(t.providerId))return t}catch(t){console.error(`Failed parsing current auth session value: ${t}`)}}var NZo={type:"object",additionalProperties:!1,properties:{id:{type:"string",description:d(18685,null)},label:{type:"string",description:d(18687,null)},authorizationServerGlobs:{type:"array",items:{type:"string",description:d(18683,null)},description:d(18684,null)}}},OZo=zn.registerExtensionPoint({extensionPoint:"authentication",jsonSchema:{description:d(18690,null),type:"array",items:NZo},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onAuthenticationRequest:${i.id}`)}}),iet=class extends k{constructor(e,t,o,n){super();this._extensionService=e;this._environmentService=o;this._logService=n;this._onDidRegisterAuthenticationProvider=this._register(new T);this.onDidRegisterAuthenticationProvider=this._onDidRegisterAuthenticationProvider.event;this._onDidUnregisterAuthenticationProvider=this._register(new T);this.onDidUnregisterAuthenticationProvider=this._onDidUnregisterAuthenticationProvider.event;this._onDidChangeSessions=this._register(new T);this.onDidChangeSessions=this._onDidChangeSessions.event;this._onDidChangeDeclaredProviders=this._register(new T);this.onDidChangeDeclaredProviders=this._onDidChangeDeclaredProviders.event;this._authenticationProviders=new Map;this._authenticationProviderDisposables=this._register(new Ot);this._dynamicAuthenticationProviderIds=new Set;this._delegates=[];this._disposedSource=new qe;this._declaredProviders=[];this._register(ee(()=>this._disposedSource.dispose(!0))),this._register(t.onDidChangeExtensionSessionAccess(r=>{this._onDidChangeSessions.fire({providerId:r.providerId,label:r.accountName,event:{added:[],changed:[],removed:[]}})})),this._registerEnvContributedAuthenticationProviders(),this._registerAuthenticationExtensionPointHandler()}get declaredProviders(){return this._declaredProviders}_registerEnvContributedAuthenticationProviders(){if(this._environmentService.options?.authenticationProviders?.length)for(let e of this._environmentService.options.authenticationProviders)this.registerDeclaredAuthenticationProvider(e),this.registerAuthenticationProvider(e.id,e)}_registerAuthenticationExtensionPointHandler(){this._register(OZo.setHandler((e,{added:t,removed:o})=>{this._logService.debug(`Found authentication providers. added: ${t.length}, removed: ${o.length}`),t.forEach(r=>{for(let s of r.value){if(_c(s.id)){r.collector.error(d(18688,null));continue}if(_c(s.label)){r.collector.error(d(18689,null));continue}this.declaredProviders.some(l=>l.id===s.id)?r.collector.error(d(18686,null,s.id)):(this.registerDeclaredAuthenticationProvider(s),this._logService.debug(`Declared authentication provider: ${s.id}`))}}),o.flatMap(r=>r.value).forEach(r=>{let s=this.declaredProviders.find(l=>l.id===r.id);s&&(this.unregisterDeclaredAuthenticationProvider(s.id),this._logService.debug(`Undeclared authentication provider: ${s.id}`))})}))}registerDeclaredAuthenticationProvider(e){if(_c(e.id))throw new Error(d(18688,null));if(_c(e.label))throw new Error(d(18689,null));if(this.declaredProviders.some(t=>t.id===e.id))throw new Error(d(18686,null,e.id));this._declaredProviders.push(e),this._onDidChangeDeclaredProviders.fire()}unregisterDeclaredAuthenticationProvider(e){let t=this.declaredProviders.findIndex(o=>o.id===e);t>-1&&this.declaredProviders.splice(t,1),this._onDidChangeDeclaredProviders.fire()}isAuthenticationProviderRegistered(e){return this._authenticationProviders.has(e)}isDynamicAuthenticationProvider(e){return this._dynamicAuthenticationProviderIds.has(e)}registerAuthenticationProvider(e,t){this._authenticationProviders.set(e,t);let o=new O;o.add(t.onDidChangeSessions(n=>this._onDidChangeSessions.fire({providerId:e,label:t.label,event:n}))),Sd(t)&&o.add(t),this._authenticationProviderDisposables.set(e,o),this._onDidRegisterAuthenticationProvider.fire({id:e,label:t.label})}unregisterAuthenticationProvider(e){let t=this._authenticationProviders.get(e);t&&(this._authenticationProviders.delete(e),this._dynamicAuthenticationProviderIds.delete(e),this._onDidUnregisterAuthenticationProvider.fire({id:e,label:t.label})),this._authenticationProviderDisposables.deleteAndDispose(e)}getProviderIds(){let e=[];return this._authenticationProviders.forEach(t=>{e.push(t.id)}),e}getProvider(e){if(this._authenticationProviders.has(e))return this._authenticationProviders.get(e);throw new Error(`No authentication provider '${e}' is currently registered.`)}async getAccounts(e){let t=await this.getSessions(e),o=new Array,n=new Set;for(let r of t)n.has(r.account.label)||(n.add(r.account.label),o.push(r.account));return o}async getSessions(e,t,o,n=!1){if(this._disposedSource.token.isCancellationRequested)return[];let r=this._authenticationProviders.get(e)||await this.tryActivateProvider(e,n);if(r){let s=o?.authorizationServer;if(s&&!this.matchesProvider(r,s))throw new Error(`The authentication provider '${e}' does not support the authorization server '${s.toString(!0)}'.`);if(Lpe(t)){if(!r.getSessionsFromChallenges)throw new Error(`The authentication provider '${e}' does not support getting sessions from challenges.`);return await r.getSessionsFromChallenges({challenges:vxi(t.wwwAuthenticate),fallbackScopes:t.fallbackScopes},{...o})}return await r.getSessions(t?[...t]:void 0,{...o})}else throw new Error(`No authentication provider '${e}' is currently registered.`)}async createSession(e,t,o){if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let n=this._authenticationProviders.get(e)||await this.tryActivateProvider(e,!!o?.activateImmediate);if(n){if(Lpe(t)){if(!n.createSessionFromChallenges)throw new Error(`The authentication provider '${e}' does not support creating sessions from challenges.`);return await n.createSessionFromChallenges({challenges:vxi(t.wwwAuthenticate),fallbackScopes:t.fallbackScopes},{...o})}return await n.createSession([...t],{...o})}else throw new Error(`No authentication provider '${e}' is currently registered.`)}async removeSession(e,t){if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let o=this._authenticationProviders.get(e);if(o)return o.removeSession(t);throw new Error(`No authentication provider '${e}' is currently registered.`)}async getOrActivateProviderIdForServer(e,t){for(let r of this._authenticationProviders.values())if(this.matchesProvider(r,e,t))return r.id;let o=e.toString(!0),n=this._declaredProviders.filter(r=>!this._authenticationProviders.has(r.id)).filter(r=>!!r.authorizationServerGlobs?.some(s=>qd(s,o,{ignoreCase:!0})));for(let r of n){let s=await this.tryActivateProvider(r.id,!0);if(this.matchesProvider(s,e,t))return s.id}}async createDynamicAuthenticationProvider(e,t,o,n){let r=this._delegates[0];if(!r){this._logService.error("No authentication provider host delegate found");return}let s=await r.create(e,t,o,n),l=this._authenticationProviders.get(s);if(l)return this._logService.debug(`Created dynamic authentication provider: ${s}`),this._dynamicAuthenticationProviderIds.add(s),l;this._logService.error(`Failed to create dynamic authentication provider: ${s}`)}registerAuthenticationProviderHostDelegate(e){return this._delegates.push(e),this._delegates.sort((t,o)=>o.priority-t.priority),{dispose:()=>{let t=this._delegates.indexOf(e);t!==-1&&this._delegates.splice(t,1)}}}matchesProvider(e,t,o){if(o&&e.resourceServer){let n=o.toString(!0),r=e.resourceServer.toString(!0);if(!xr(r,n))return!1}if(e.authorizationServers){let n=t.toString(!0);for(let r of e.authorizationServers){let s=r.toString(!0);if(xr(s,n)||qd(s,n,{ignoreCase:!0}))return!0}}return!1}async tryActivateProvider(e,t){let o=new O;try{let n=this._extensionService.activateByEvent(bxi(e),t?1:0),r=this._authenticationProviders.get(e);if(r)return r;if(this._disposedSource.token.isCancellationRequested)throw new Error("Authentication service is disposed.");let s=Ea(U.toPromise(U.filter(this.onDidRegisterAuthenticationProvider,c=>c.id===e,o),o),this._disposedSource.token);if(await Promise.race([n,s]),r=this._authenticationProviders.get(e),r)return r;let l=await Uu(s,5e3);if(r=this._authenticationProviders.get(e),r)return r;throw l?new Error(`No authentication provider '${e}' is currently registered.`):new Error(`Timed out waiting for authentication provider '${e}' to register.`)}finally{o.dispose()}}};iet=I([m(0,lt),m(1,mE),m(2,Od),m(3,re)],iet);Ce(ks,iet,1);var ote=le("dynamicAuthenticationProviderStorageService");var F0t=class extends k{constructor(e,t,o,n,r,s,l){super();this._proxy=e;this.id=t;this.label=o;this.supportsMultipleAccounts=n;this.authorizationServers=r;this.resourceServer=s;this.onDidChangeSessions=l.event}async getSessions(e,t){return this._proxy.$getSessions(this.id,e,t)}createSession(e,t){return this._proxy.$createSession(this.id,e,t)}async removeSession(e){await this._proxy.$removeSession(this.id,e)}},Sxi=class extends F0t{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s)}getSessionsFromChallenges(i,e){return this._proxy.$getSessionsFromChallenges(this.id,i,e)}createSessionFromChallenges(i,e){return this._proxy.$createSessionFromChallenges(this.id,i,e)}},O0t=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.productService=t;this.authenticationService=o;this.authenticationExtensionsService=n;this.authenticationAccessService=r;this.authenticationUsageService=s;this.dialogService=l;this.notificationService=c;this.extensionService=u;this.telemetryService=p;this.openerService=h;this.logService=g;this.urlService=f;this.dynamicAuthProviderStorageService=v;this.clipboardService=b;this.quickInputService=S;this._registrations=this._register(new Ot);this._sentProviderUsageEvents=new Set;this._suppressUnregisterEvent=!1;this._sentClientIdUsageEvents=new Set;this._proxy=e.getProxy(ao.ExtHostAuthentication),this._register(this.authenticationService.onDidChangeSessions(y=>this._proxy.$onDidChangeAuthenticationSessions(y.providerId,y.label))),this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(y=>{this._suppressUnregisterEvent||this._proxy.$onDidUnregisterAuthenticationProvider(y.id)})),this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(y=>{let w=this.authenticationService.getProvider(y.providerId);this._proxy.$onDidChangeAuthenticationSessions(w.id,w.label,y.extensionIds)})),this._register(this.dynamicAuthProviderStorageService.onDidChangeTokens(y=>{this._proxy.$onDidChangeDynamicAuthProviderTokens(y.authProviderId,y.clientId,y.tokens)})),this._register(o.registerAuthenticationProviderHostDelegate({priority:e.extensionHostKind===2?0:1,create:async(y,w,x,E)=>{let M=x?`${y.toString(!0)} ${x.resource}`:y.toString(!0),N=await this.dynamicAuthProviderStorageService.getClientRegistration(M),V=E??N?.clientId,H=E?void 0:N?.clientSecret,K;return V?K=await this.dynamicAuthProviderStorageService.getSessionsForDynamicAuthProvider(M,V):w.client_id_metadata_document_supported&&(V=this.productService.authClientIdMetadataUrl),await this._proxy.$registerDynamicAuthProvider(y,w,x,V,H,K)}}))}async $registerAuthenticationProvider({id:e,label:t,supportsMultipleAccounts:o,resourceServer:n,supportedAuthorizationServers:r,supportsChallenges:s}){this.authenticationService.declaredProviders.find(p=>p.id===e)||(this.logService.warn(`Authentication provider ${e} was not declared in the Extension Manifest.`),this.telemetryService.publicLog2("authentication.providerNotDeclared",{id:e}));let l=new T;this._registrations.set(e,l);let c=(r??[]).map(p=>A.revive(p)),u=s?new Sxi(this._proxy,e,t,o,c,n?A.revive(n):void 0,l):new F0t(this._proxy,e,t,o,c,n?A.revive(n):void 0,l);this.authenticationService.registerAuthenticationProvider(e,u)}async $unregisterAuthenticationProvider(e){this._registrations.deleteAndDispose(e),this._suppressUnregisterEvent=!0;try{this.authenticationService.unregisterAuthenticationProvider(e)}finally{this._suppressUnregisterEvent=!1}}async $ensureProvider(e){if(!this.authenticationService.isAuthenticationProviderRegistered(e))return await this.extensionService.activateByEvent(bxi(e),1)}async $sendDidChangeSessions(e,t){let o=this._registrations.get(e);o instanceof T&&o.fire(t)}$removeSession(e,t){return this.authenticationService.removeSession(e,t)}async $waitForUriHandler(e){let t=new Mo,o=this.urlService.registerHandler({handleURL:async r=>r.scheme!==e.scheme||r.authority!==e.authority||r.path!==e.path?!1:(t.complete(r),o.dispose(),!0)});if(!await Uu(t.p,300*1e3))throw new Error("Timed out waiting for URI handler");return await t.p}$showContinueNotification(e){let t=d(3905,null),o=d(3904,null),n=new Mo,r=!1,l=this.notificationService.prompt(wt.Warning,e,[{label:t,run:()=>r=!0},{label:o,run:()=>r=!1}]).onDidClose(()=>{n.complete(r),l.dispose()});return n.p}async $registerDynamicAuthenticationProvider(e){await this.$registerAuthenticationProvider({id:e.id,label:e.label,supportsMultipleAccounts:!0,supportedAuthorizationServers:[e.authorizationServer],resourceServer:e.resourceServer}),await this.dynamicAuthProviderStorageService.storeClientRegistration(e.id,A.revive(e.authorizationServer).toString(!0),e.clientId,e.clientSecret,e.label)}async $setSessionsForDynamicAuthProvider(e,t,o){await this.dynamicAuthProviderStorageService.setSessionsForDynamicAuthProvider(e,t,o)}async $sendDidChangeDynamicProviderInfo({providerId:e,clientId:t,authorizationServer:o,label:n,clientSecret:r}){this.logService.info(`Client ID for authentication provider ${e} changed to ${t}`);let s=this.dynamicAuthProviderStorageService.getInteractedProviders().find(l=>l.providerId===e);if(!s)throw new Error(`Dynamic authentication provider ${e} not found. Has it been registered?`);await this.dynamicAuthProviderStorageService.storeClientRegistration(e||s.providerId,o?A.revive(o).toString(!0):s.authorizationServer,t||s.clientId,r,n||s.label)}async loginPrompt(e,t,o,n){let r,s=e.confirmation?.(t,o);s?r=s:r=o?d(3890,null,t,e.label):d(3889,null,t,e.label);let l=[{label:d(3882,null),run(){return!0}}];n?.learnMore&&l.push({label:d(3902,null),run:async()=>{let u=this.loginPrompt(e,t,o,n);return await this.openerService.open(A.revive(n.learnMore),{allowCommands:!0}),await u}});let{result:c}=await this.dialogService.prompt({type:wt.Info,message:r,buttons:l,detail:n?.detail,cancelButton:!0});return c??!1}async continueWithIncorrectAccountPrompt(e,t){let o=await this.dialogService.prompt({message:d(3899,null),detail:d(3900,null,e,t),type:wt.Warning,cancelButton:!0,buttons:[{label:d(3901,null,e),run:()=>e},{label:d(3903,null,t),run:()=>t}]});if(!o.result)throw new qi;return o.result===e}async doGetSession(e,t,o,n,r){let s=A.revive(r.authorizationServer),l=await this.authenticationService.getSessions(e,t,{account:r.account,authorizationServer:s},!0),c=this.authenticationService.getProvider(e);if(r.forceNewSession&&r.createIfNone)throw new Error("Invalid combination of options. Please remove one of the following: forceNewSession, createIfNone");if(r.forceNewSession&&r.silent)throw new Error("Invalid combination of options. Please remove one of the following: forceNewSession, silent");if(r.createIfNone&&r.silent)throw new Error("Invalid combination of options. Please remove one of the following: createIfNone, silent");r.clearSessionPreference&&this.authenticationExtensionsService.removeAccountPreference(o,e);let u=r.account?l[0]:this._getAccountPreference(o,e,l);if(!r.forceNewSession&&l.length){if(u&&this.authenticationAccessService.isAccessAllowed(e,u.account.label,o))return u;if(!c.supportsMultipleAccounts&&this.authenticationAccessService.isAccessAllowed(e,l[0].account.label,o))return l[0]}if(r.createIfNone||r.forceNewSession){let p;typeof r.forceNewSession=="object"?p=r.forceNewSession:typeof r.createIfNone=="object"&&(p=r.createIfNone);let h=!!(r.forceNewSession&&l.length);if(!await this.loginPrompt(c,n,h,p))throw new Error("User did not consent to login.");let f;if(l?.length&&!r.forceNewSession)f=c.supportsMultipleAccounts&&!r.account?await this.authenticationExtensionsService.selectSession(e,o,n,t,l):l[0];else{let v=r.account??u?.account;do f=await this.authenticationService.createSession(e,t,{activateImmediate:!0,account:v,authorizationServer:s});while(v&&v.label!==f.account.label&&!await this.continueWithIncorrectAccountPrompt(f.account.label,v.label))}return this.authenticationAccessService.updateAllowedExtensions(e,f.account.label,[{id:o,name:n,allowed:!0}]),this.authenticationExtensionsService.updateNewSessionRequests(e,[f]),this.authenticationExtensionsService.updateAccountPreference(o,e,f.account),f}if(!u){let p=l.filter(h=>this.authenticationAccessService.isAccessAllowed(e,h.account.label,o));if(p.length===1)return p[0]}r.silent||(l.length?this.authenticationExtensionsService.requestSessionAccess(e,o,n,t,l):await this.authenticationExtensionsService.requestNewSession(e,t,o,n))}async $getSession(e,t,o,n,r){let s=Lpe(t)?t.fallbackScopes:t;s&&this.sendClientIdUsageTelemetry(o,e,s);let l=await this.doGetSession(e,t,o,n,r);return l&&(this.sendProviderUsageTelemetry(o,e),this.authenticationUsageService.addAccountUsage(e,l.account.label,l.scopes,o,n)),l}async $getAccounts(e){return await this.authenticationService.getAccounts(e)}sendClientIdUsageTelemetry(e,t,o){let n=o.some(s=>s.startsWith("VSCODE_CLIENT_ID:")),r=`${e}|${t}|${n}`;this._sentClientIdUsageEvents.has(r)||(this._sentClientIdUsageEvents.add(r),n&&this.telemetryService.publicLog2("authentication.clientIdUsage",{extensionId:e}))}sendProviderUsageTelemetry(e,t){let o=`${e}|${t}`;this._sentProviderUsageEvents.has(o)||(this._sentProviderUsageEvents.add(o),this.telemetryService.publicLog2("authentication.providerUsage",{providerId:t,extensionId:e}))}_getAccountPreference(e,t,o){if(o.length===0)return;let n=this.authenticationExtensionsService.getAccountPreference(e,t);if(n)return o.find(s=>s.account.label===n)}async $showDeviceCodeModal(e,t){let{result:o}=await this.dialogService.prompt({type:wt.Info,message:d(3897,null),detail:d(3896,null,e,t),buttons:[{label:d(3891,null),run:()=>!0}],cancelButton:!0});if(o)try{return await this.clipboardService.writeText(e),await this.openerService.open(A.parse(t))}catch{this.notificationService.error(d(3898,null,t))}return!1}async $promptForClientRegistration(e){let t=`http://127.0.0.1:33418
https://vscode.dev/redirect`;if(!await this.dialogService.prompt({type:wt.Info,message:d(3894,null),detail:d(3895,null,e,t),buttons:[{label:d(3892,null),run:async()=>{try{await this.clipboardService.writeText(t)}catch{this.notificationService.error(d(3893,null))}return!0}}],cancelButton:{label:d(3883,null),run:()=>!1}}))return;let n=d(3881,null),r=await this.quickInputService.input({title:n,prompt:d(3885,null),placeHolder:d(3884,null),ignoreFocusLost:!0,validateInput:async l=>{if(!l||l.trim().length===0)return d(3886,null)}});if(!r||r.trim().length===0)return;let s=await this.quickInputService.input({title:n,prompt:d(3888,null,r),placeHolder:d(3887,null),password:!0,ignoreFocusLost:!0});return{clientId:r.trim(),clientSecret:s?.trim()||void 0}}};O0t=I([fo(Xi.MainThreadAuthentication),m(1,Ze),m(2,ks),m(3,xZ),m(4,mE),m(5,RN),m(6,ct),m(7,Ne),m(8,lt),m(9,_e),m(10,Je),m(11,re),m(12,tS),m(13,ote),m(14,Bi),m(15,$e)],O0t);var W0t="timeline",FZo="timeline",rU=le(FZo);var V0t=class{constructor(i,e,t){this.logService=e;this._timelineService=t;this._providerEmitters=new Map;this._proxy=i.getProxy(ao.ExtHostTimeline)}$registerTimelineProvider(i){this.logService.trace(`MainThreadTimeline#registerTimelineProvider: id=${i.id}`);let e=this._proxy,t=this._providerEmitters,o=t.get(i.id);o===void 0&&(o=new T,t.set(i.id,o)),this._timelineService.registerTimelineProvider({...i,onDidChange:o.event,async provideTimeline(n,r,s){return er(await e.$getTimeline(i.id,n,r,s))},dispose(){t.delete(i.id),o?.dispose()}})}$unregisterTimelineProvider(i){this.logService.trace(`MainThreadTimeline#unregisterTimelineProvider: id=${i}`),this._timelineService.unregisterTimelineProvider(i)}$emitTimelineChangeEvent(i){this.logService.trace(`MainThreadTimeline#emitChangeEvent: id=${i.id}, uri=${i.uri?.toString(!0)}`),this._providerEmitters.get(i.id)?.fire(i)}dispose(){}};V0t=I([fo(Xi.MainThreadTimeline),m(1,re),m(2,rU)],V0t);var bmo=0,B0t=class{constructor(i,e,t,o){this.result=i;this.fromTaskId=e;this.uriIdentityService=t;this.accessor=o;this.fileCoverage=new dt;this.didAddCoverage=zc(this);this.tree=new IN;this.associatedData=new Map}*allPerTestIDs(){let i=new Set;for(let e of this.tree.nodes)if(e.value&&e.value.perTestData)for(let t of e.value.perTestData)i.has(t)||(i.add(t),yield t)}append(i,e){let t=this.getComputedForUri(i.uri),o=this.result,n=(l,c)=>{c[l]?(c[l].covered+=(i[l]?.covered||0)-(t?.[l]?.covered||0),c[l].total+=(i[l]?.total||0)-(t?.[l]?.total||0)):i[l]&&(c[l]={...i[l]})},r=[...this.treePathForUri(i.uri,!0)],s=[];this.tree.mutatePath(this.treePathForUri(i.uri,!1),l=>{if(s.push(l),s.length===r.length)if(l.value){let c=l.value;c.id=i.id,c.statement=i.statement,c.branch=i.branch,c.declaration=i.declaration}else{let c=l.value=new I8(i,o,this.accessor);this.fileCoverage.set(i.uri,c)}else if(l.value)n("statement",l.value),n("branch",l.value),n("declaration",l.value),l.value.didChange.trigger(e);else{let c=io(i);c.id=String(bmo++),c.uri=this.treePathToUri(r.slice(0,s.length)),l.value=new U0t(c,o)}if(i.testIds){l.value.perTestData??=new Set;for(let c of i.testIds)l.value.perTestData.add(c)}}),s&&this.didAddCoverage.trigger(e,s)}filterTreeForTest(i){let e=new IN;for(let t of this.tree.values())if(t instanceof I8){if(!t.perTestData?.has(i.toString()))continue;let o=[...this.treePathForUri(t.uri,!0)],n=[];e.mutatePath(this.treePathForUri(t.uri,!1),r=>{n.push(r),r.value??=new oet(this.treePathToUri(o.slice(0,n.length)),t.fromResult)})}return e}getAllFiles(){return this.fileCoverage}getUri(i){return this.fileCoverage.get(i)}getComputedForUri(i){return this.tree.find(this.treePathForUri(i,!1))}*treePathForUri(i,e){yield i.scheme,yield i.authority,yield*(!e&&this.uriIdentityService.extUri.ignorePathCasing(i)?i.path.toLowerCase():i.path).split("/")}treePathToUri(i){return A.from({scheme:i[0],authority:i[1],path:i.slice(2).join("/")})}},nte=(a,i,e)=>{let t=a.covered,o=a.total;return i&&(t+=i.covered,o+=i.total),e&&(t+=e.covered,o+=e.total),o===0?1:t/o},H0t=class{constructor(i,e){this.fromResult=e;this.didChange=zc(this);this.id=i.id,this.uri=i.uri,this.statement=i.statement,this.branch=i.branch,this.declaration=i.declaration}get tpc(){return nte(this.statement,this.branch,this.declaration)}},U0t=class extends H0t{},oet=class extends U0t{constructor(i,e){super({id:String(bmo++),uri:i,statement:{covered:0,total:0}},e)}},I8=class extends H0t{constructor(e,t,o){super(e,t);this.accessor=o}get hasSynchronousDetails(){return this._details instanceof Array||this.resolved}async detailsForTest(e,t=Ie.None){this._detailsForTest??=new Map;let o=e.toString(),n=this._detailsForTest.get(o);if(n)return n;let r=(async()=>{try{return await this.accessor.getCoverageDetails(this.id,o,t)}catch(s){throw this._detailsForTest?.delete(o),s}})();return this._detailsForTest.set(o,r),r}async details(e=Ie.None){this._details??=this.accessor.getCoverageDetails(this.id,void 0,e);try{let t=await this._details;return this.resolved=!0,t}catch(t){throw this._details=void 0,t}}};var WZo={deserialize:a=>JSON.parse(a),serialize:a=>JSON.stringify(a)},tI=class extends k{constructor(e,t){super();this.storage=t;this.key=e.key,this.scope=e.scope,this.target=e.target,this.serialization=e.serialization??WZo,this.onDidChange=this.storage.onDidChangeValue(this.scope,this.key,this._store)}get(e){if(this.value===void 0){let t=this.storage.get(this.key,this.scope);this.value=t===void 0?e:this.serialization.deserialize(t)}return this.value}store(e){this.value=e,this.storage.store(this.key,this.serialization.serialize(e),this.scope,this.target)}delete(){this.storage.remove(this.key,this.scope)}};tI=I([m(1,de)],tI);var VZo={6:d(17279,null),4:d(17280,null),3:d(17281,null),1:d(17282,null),2:d(17283,null),5:d(17284,null),0:d(17285,null)},z0t=(a,i)=>d(17278,null,Du(a),VZo[i]),K0t={4:d(17276,null),2:d(17277,null),8:d(17275,null)};var co;(tt=>(tt.providerCount=new Y("testing.providerCount",0),tt.canRefreshTests=new Y("testing.canRefresh",!1,{type:"boolean",description:d(17305,null)}),tt.isRefreshingTests=new Y("testing.isRefreshing",!1,{type:"boolean",description:d(17321,null)}),tt.isContinuousModeOn=new Y("testing.isContinuousModeOn",!1,{type:"boolean",description:d(17318,null)}),tt.hasDebuggableTests=new Y("testing.hasDebuggableTests",!1,{type:"boolean",description:d(17312,null)}),tt.hasRunnableTests=new Y("testing.hasRunnableTests",!1,{type:"boolean",description:d(17316,null)}),tt.hasCoverableTests=new Y("testing.hasCoverableTests",!1,{type:"boolean",description:d(17310,null)}),tt.hasNonDefaultProfile=new Y("testing.hasNonDefaultProfile",!1,{type:"boolean",description:d(17314,null)}),tt.hasConfigurableProfile=new Y("testing.hasConfigurableProfile",!1,{type:"boolean",description:d(17309,null)}),tt.supportsContinuousRun=new Y("testing.supportsContinuousRun",!1,{type:"boolean",description:d(17326,null)}),tt.isParentRunningContinuously=new Y("testing.isParentRunningContinuously",!1,{type:"boolean",description:d(17320,null)}),tt.activeEditorHasTests=new Y("testing.activeEditorHasTests",!1,{type:"boolean",description:d(17302,null)}),tt.cursorInsideTestRange=new Y("testing.cursorInsideTestRange",!1,{type:"boolean",description:d(17308,null)}),tt.isTestCoverageOpen=new Y("testing.isTestCoverageOpen",!1,{type:"boolean",description:d(17322,null)}),tt.hasCoverageInFile=new Y("testing.hasCoverageInFile",!1,{type:"boolean",description:d(17311,null)}),tt.hasPerTestCoverage=new Y("testing.hasPerTestCoverage",!1,{type:"boolean",description:d(17315,null)}),tt.hasInlineCoverageDetails=new Y("testing.hasInlineCoverageDetails",!1,{type:"boolean",description:d(17313,null)}),tt.isCoverageFilteredToTest=new Y("testing.isCoverageFilteredToTest",!1,{type:"boolean",description:d(17319,null)}),tt.coverageToolbarEnabled=new Y("testing.coverageToolbarEnabled",!0,{type:"boolean",description:d(17307,null)}),tt.inlineCoverageEnabled=new Y("testing.inlineCoverageEnabled",!1,{type:"boolean",description:d(17317,null)}),tt.canGoToRelatedCode=new Y("testing.canGoToRelatedCode",!1,{type:"boolean",description:d(17303,null)}),tt.canGoToRelatedTest=new Y("testing.canGoToRelatedTest",!1,{type:"boolean",description:d(17304,null)}),tt.peekHasStack=new Y("testing.peekHasStack",!1,{type:"boolean",description:d(17323,null)}),tt.capabilityToContextKey={2:tt.hasRunnableTests,8:tt.hasCoverableTests,4:tt.hasDebuggableTests,16:tt.hasNonDefaultProfile,32:tt.hasConfigurableProfile,64:tt.supportsContinuousRun},tt.hasAnyResults=new Y("testing.hasAnyResults",!1),tt.viewMode=new Y("testing.explorerViewMode","list"),tt.viewSorting=new Y("testing.explorerViewSorting","location"),tt.isRunning=new Y("testing.isRunning",!1),tt.isInPeek=new Y("testing.isInPeek",!1),tt.isPeekVisible=new Y("testing.isPeekVisible",!1),tt.peekItemType=new Y("peekItemType",void 0,{type:"string",description:d(17324,null)}),tt.controllerId=new Y("controllerId",void 0,{type:"string",description:d(17306,null)}),tt.testItemExtId=new Y("testId",void 0,{type:"string",description:d(17327,null)}),tt.testItemHasUri=new Y("testing.testItemHasUri",!1,{type:"boolean",description:d(17328,null)}),tt.testItemIsHidden=new Y("testing.testItemIsHidden",!1,{type:"boolean",description:d(17329,null)}),tt.testMessageContext=new Y("testMessage",void 0,{type:"string",description:d(17330,null)}),tt.testResultOutdated=new Y("testResultOutdated",void 0,{type:"boolean",description:d(17331,null)}),tt.testResultState=new Y("testResultState",void 0,{type:"string",description:d(17332,null)}),tt.testProfileContextGroup=new Y("testing.profile.context.group",void 0,{type:"string",description:d(17325,null)})))(co||={});var Vu=le("testProfileService"),JM=(a,i)=>a.controllerId===i.controllerId&&(ns.isRoot(i.item.extId)||!a.tag||i.item.tags.includes(a.tag)),Ixi=(a,i)=>a.isDefault!==i.isDefault?a.isDefault?-1:1:a.label.localeCompare(i.label),G0t=a=>[[co.hasRunnableTests.key,(a&2)!==0],[co.hasDebuggableTests.key,(a&4)!==0],[co.hasCoverableTests.key,(a&8)!==0]],FLe=class extends k{constructor(e,t){super();this.changeEmitter=this._register(new T);this.controllerProfiles=new Map;this.onDidChange=this.changeEmitter.event;t.remove("testingPreferredProfiles",1),this.userDefaults=this._register(new tI({key:"testingPreferredProfiles2",scope:1,target:1},t)),this.capabilitiesContexts={2:co.hasRunnableTests.bindTo(e),4:co.hasDebuggableTests.bindTo(e),8:co.hasCoverableTests.bindTo(e),16:co.hasNonDefaultProfile.bindTo(e),32:co.hasConfigurableProfile.bindTo(e),64:co.supportsContinuousRun.bindTo(e)},this.refreshContextKeys()}addProfile(e,t){let o=this.userDefaults.get()?.[e.id]?.[t.profileId],n={...t,isDefault:o??t.isDefault,wasInitiallyDefault:t.isDefault},r=this.controllerProfiles.get(t.controllerId);r?(r.profiles.push(n),r.profiles.sort(Ixi)):(r={profiles:[n],controller:e},this.controllerProfiles.set(t.controllerId,r)),this.refreshContextKeys(),this.changeEmitter.fire()}updateProfile(e,t,o){let n=this.controllerProfiles.get(e);if(!n)return;let r=n.profiles.find(s=>s.controllerId===e&&s.profileId===t);if(r){if(Object.assign(r,o),n.profiles.sort(Ixi),o.isDefault!==void 0){let s=io(this.userDefaults.get({}));yxi(s,r,o.isDefault),this.userDefaults.store(s)}this.changeEmitter.fire()}}configure(e,t){this.controllerProfiles.get(e)?.controller.configureRunProfile(t)}removeProfile(e,t){let o=this.controllerProfiles.get(e);if(!o)return;if(!t){this.controllerProfiles.delete(e),this.changeEmitter.fire();return}let n=o.profiles.findIndex(r=>r.profileId===t);n!==-1&&(o.profiles.splice(n,1),this.refreshContextKeys(),this.changeEmitter.fire())}capabilitiesForTest(e){let t=this.controllerProfiles.get(ns.root(e.extId));if(!t)return 0;let o=0;for(let n of t.profiles)(!n.tag||e.tags.includes(n.tag))&&(o|=o&n.group?16:n.group);return o}all(){return this.controllerProfiles.values()}getControllerProfiles(e){return this.controllerProfiles.get(e)?.profiles??[]}getGroupDefaultProfiles(e,t){let o=t?this.controllerProfiles.get(t)?.profiles||[]:[...yt.flatMap(this.controllerProfiles.values(),r=>r.profiles)],n=o.filter(r=>r.group===e&&r.isDefault);if(n.length===0){let r=o.find(s=>s.group===e);r&&n.push(r)}return n}setGroupDefaultProfiles(e,t){let o={};for(let n of this.controllerProfiles.values()){o[n.controller.id]={};for(let r of n.profiles)r.group===e&&yxi(o,r,t.some(s=>s.profileId===r.profileId));for(let r of n.profiles){if(r.group===e)continue;let s=n.profiles.find(l=>l.group===e&&l.label===r.label);s&&yxi(o,r,s.isDefault)}n.profiles.sort(Ixi)}this.userDefaults.store(o),this.changeEmitter.fire()}getDefaultProfileForTest(e,t){return this.getControllerProfiles(t.controllerId).find(o=>(o.group&e)!==0&&JM(o,t))}refreshContextKeys(){let e=0;for(let{profiles:t}of this.controllerProfiles.values())for(let o of t)e|=e&o.group?16:o.group,e|=o.supportsContinuousRun?64:0;for(let t of Mdo)this.capabilitiesContexts[t].set((e&t)!==0)}};FLe=I([m(0,X),m(1,de)],FLe);var yxi=(a,i,e)=>{i.isDefault=e,a[i.controllerId]??={},i.isDefault!==i.wasInitiallyDefault?a[i.controllerId][i.profileId]=i.isDefault:delete a[i.controllerId][i.profileId]};var LN={2:6,6:5,4:4,1:3,3:2,0:0,5:1},Xx=a=>a===6||a===4,ymo=a=>a===6||a===4||a===3,xJl=Uwe(LN,(a,i)=>({statusNode:!0,state:Number(i),priority:a})),net=(a,i)=>LN[i]-LN[a],WLe=(...a)=>{switch(a.length){case 0:return 0;case 1:return a[0];case 2:return LN[a[0]]>LN[a[1]]?a[0]:a[1];default:{let i=a[0];for(let e=1;e<a.length;e++)LN[i]<LN[a[e]]&&(i=a[e]);return i}}},ret=Object.keys(LN).map(a=>Number(a)).sort(net),wxi={3:0,5:1,4:2,6:3},set=()=>new Uint32Array(ret.length);var BZo=a=>"getOwnDuration"in a,Cxi=(a,i,e=!1)=>{let t=a.getCurrentComputedState(i);if(t===void 0||e){t=a.getOwnState(i)??0;let o=0,n=set();for(let r of a.getChildren(i)){let s=Cxi(a,r);o++,n[s]++,t=s===5&&t===0?5:WLe(t,s)}o>HZo&&Cmo.set(i,n),a.setComputedState(i,t)}return t},wmo=(a,i,e=!1)=>{let t=a.getCurrentComputedDuration(i);if(t===void 0||e){let o=a.getOwnDuration(i);if(o!==void 0)t=o;else{t=void 0;for(let n of a.getChildren(i)){let r=wmo(a,n);r!==void 0&&(t=(t||0)+r)}}a.setComputedDuration(i,t)}return t},HZo=64,Cmo=new WeakMap,Jme=(a,i,e,t=!0)=>{let o=a.getCurrentComputedState(i),n=LN[o],r=e??Cxi(a,i,!0),s=LN[r],l=new Set;if(s!==n){a.setComputedState(i,r),l.add(i);let c=o,u=r;for(let p of a.getParents(i)){let h=Cmo.get(p);h&&(h[c]--,h[u]++);let g=a.getCurrentComputedState(p);if(s>n){if(g!==void 0&&LN[g]>=s||h&&h[u]>1)break;a.setComputedState(p,r),l.add(p)}else{if(g===void 0||LN[g]>n||h&&h[c]>0)break;u=Cxi(a,p,!0),a.setComputedState(p,u),l.add(p)}c=g}}if(BZo(a)&&t)for(let c of yt.concat(yt.single(i),a.getParents(i))){let u=a.getCurrentComputedDuration(c),p=wmo(a,c,!0);if(u===p)break;a.setComputedDuration(c,p),l.add(c)}return l};var UZo={buffers:[],length:0,onDidWriteData:U.None,endPromise:Promise.resolve(),getRange:()=>Ke.alloc(0),getRangeIter:()=>[]},xxi=class{constructor(){this.writeDataEmitter=new T;this.endDeferred=new Mo;this.offset=0;this.onDidWriteData=this.writeDataEmitter.event;this.endPromise=this.endDeferred.p;this.buffers=[]}get length(){return this.offset}getRange(i,e){let t=Ke.alloc(e),o=0;for(let n of this.getRangeIter(i,e))t.buffer.set(n.buffer,o),o+=n.byteLength;return o<e?t.slice(0,o):t}*getRangeIter(i,e){let t=0,o=0;for(let n of this.buffers){if(o+n.byteLength<=i){o+=n.byteLength;continue}let r=Math.max(0,i-o),s=Math.min(n.byteLength,r+e-t);if(yield n.slice(r,s),t+=s-r,o+=n.byteLength,t===e)break}}append(i,e){let t=this.offset,o=i.byteLength;if(e===void 0)return this.push(i),{offset:t,length:o};let n;(p=>(p[p.CR=13]="CR",p[p.LF=10]="LF"))(n||={});let r=Ke.fromString(xmo(e,!0)),s=Ke.fromString(xmo(e,!1));o+=r.byteLength+s.byteLength,this.push(r);let l=i.byteLength;for(;l>0;l--){let c=i.buffer[l-1];if(c!==13&&c!==10)break}return this.push(i.slice(0,l)),this.push(s),this.push(i.slice(l)),{offset:t,length:o}}push(i){i.byteLength!==0&&(this.buffers.push(i),this.writeDataEmitter.fire(i),this.offset+=i.byteLength)}end(){this.endDeferred.complete()}},kmo=function*(a,i){for(let e of ns.fromString(i.item.extId).idsToRoot())yield a.getStateById(e.toString())},Emo=a=>{for(let i of ret)if(a[i]>0)return i;return 0},xmo=(a,i)=>`\x1B]633;SetMark;Id=${AJe(a,i)};Hidden\x07`,zZo=(a,i,e)=>({controllerId:a,expand:0,item:{...i},children:[],tasks:[],ownComputedState:0,computedState:0});var lg=class extends k{constructor(e,t,o,n,r){super();this.id=e;this.persist=t;this.request=o;this.insertOrder=n;this.telemetry=r;this.completeEmitter=this._register(new T);this.newTaskEmitter=this._register(new T);this.endTaskEmitter=this._register(new T);this.changeEmitter=this._register(new T);this.testById=new Map;this.testMarkerCounter=0;this.startedAt=Date.now();this.onChange=this.changeEmitter.event;this.onComplete=this.completeEmitter.event;this.onNewTask=this.newTaskEmitter.event;this.onEndTask=this.endTaskEmitter.event;this.tasks=[];this.name=d(17338,null,new Date().toLocaleString(Kr));this.counts=set();this.computedStateAccessor={getOwnState:e=>e.ownComputedState,getCurrentComputedState:e=>e.computedState,setComputedState:(e,t)=>e.computedState=t,getChildren:e=>e.children,getParents:e=>{let{testById:t}=this;return(function*(){let o=ns.fromString(e.item.extId).parentId;if(o)for(let n of o.idsToRoot())yield t.get(n.toString())})()}};this.doSerialize=new uo(()=>({id:this.id,completedAt:this.completedAt,tasks:this.tasks.map(e=>({id:e.id,name:e.name,ctrlId:e.ctrlId,hasCoverage:!!e.coverage.get()})),name:this.name,request:this.request,items:[...this.testById.values()].map(NJe.serializeWithoutMessages)}));this.doSerializeWithMessages=new uo(()=>({id:this.id,completedAt:this.completedAt,tasks:this.tasks.map(e=>({id:e.id,name:e.name,ctrlId:e.ctrlId,hasCoverage:!!e.coverage.get()})),name:this.name,request:this.request,items:[...this.testById.values()].map(NJe.serialize)}))}get completedAt(){return this._completedAt}get tests(){return this.testById.values()}getTestById(e){return this.testById.get(e)?.item}getStateById(e){return this.testById.get(e)}appendOutput(e,t,o,n){let r=e.byteLength>100?e.slice(0,100).toString()+"\u2026":e.toString(),s=Hv(r),l;(n||o)&&(l=this.testMarkerCounter++);let c=this.mustGetTaskIndex(t),u=this.tasks[c],{offset:p,length:h}=u.output.append(e,l),g={location:o,message:s,offset:p,length:h,marker:l,type:1},f=n&&this.testById.get(n);f?(f.tasks[c].messages.push(g),this.changeEmitter.fire({item:f,result:this,reason:2,message:g})):u.otherMessages.push(g)}addTask(e){this.tasks.push({...e,coverage:De(this,void 0),otherMessages:[],output:new xxi});for(let t of this.tests)t.tasks.push({duration:void 0,messages:[],state:0});this.newTaskEmitter.fire(this.tasks.length-1)}addTestChainToRun(e,t){let o=this.testById.get(t[0].extId);o||(o=this.addTestToRun(e,t[0],null));for(let n=1;n<t.length;n++)o=this.addTestToRun(e,t[n],o.item.extId)}updateState(e,t,o,n){let r=this.testById.get(e);if(!r)return;let s=this.mustGetTaskIndex(t),l=wxi[r.tasks[s].state],c=wxi[o];l!==void 0&&(c===void 0||c<l)||this.fireUpdateAndRefresh(r,s,o,n)}appendMessage(e,t,o){let n=this.testById.get(e);n&&(n.tasks[this.mustGetTaskIndex(t)].messages.push(o),this.changeEmitter.fire({item:n,result:this,reason:2,message:o}))}markTaskComplete(e){let t=this.mustGetTaskIndex(e),o=this.tasks[t];o.running=!1,o.output.end(),this.setAllToState(5,e,n=>n.state===1||n.state===2),this.endTaskEmitter.fire(t)}markComplete(){if(this._completedAt!==void 0)throw new Error("cannot complete a test result multiple times");for(let e of this.tasks)e.running&&this.markTaskComplete(e.id);this._completedAt=Date.now(),this.completeEmitter.fire(),this.telemetry.publicLog2("test.outcomes",{failures:this.counts[6]+this.counts[4],passes:this.counts[3],controller:this.request.targets.map(e=>e.controllerId).join(",")})}markRetired(e){for(let[t,o]of this.testById)!o.retired&&(!e||e.hasKeyOrParent(ns.fromString(t).path))&&(o.retired=!0,this.changeEmitter.fire({reason:0,item:o,result:this}))}toJSON(){return this.completedAt&&this.persist?this.doSerialize.value:void 0}toJSONWithMessages(){return this.completedAt&&this.persist?this.doSerializeWithMessages.value:void 0}setAllToState(e,t,o){let n=this.mustGetTaskIndex(t);for(let r of this.testById.values())o(r.tasks[n],r)&&this.fireUpdateAndRefresh(r,n,e)}fireUpdateAndRefresh(e,t,o,n){let r=e.ownComputedState,s=e.ownDuration,l={item:e,result:this,reason:1,previousState:r,previousOwnDuration:s};e.tasks[t].state=o,n!==void 0&&(e.tasks[t].duration=n,e.ownDuration=Math.max(e.ownDuration||0,n));let c=WLe(...e.tasks.map(u=>u.state));if(c===r){n!==s&&this.changeEmitter.fire(l);return}e.ownComputedState=c,this.counts[r]--,this.counts[c]++,Jme(this.computedStateAccessor,e).forEach(u=>this.changeEmitter.fire(u===e?l:{item:u,result:this,reason:0}))}addTestToRun(e,t,o){let n=zZo(e,t,o);if(this.testById.set(t.extId,n),this.counts[0]++,o&&this.testById.get(o)?.children.push(n),this.tasks.length)for(let r=0;r<this.tasks.length;r++)n.tasks.push({duration:void 0,messages:[],state:0});return n}mustGetTaskIndex(e){let t=this.tasks.findIndex(o=>o.id===e);if(t===-1)throw new Error(`Unknown task ${e} in updateState`);return t}};lg=I([m(4,_e)],lg);var q0t=class{constructor(i,e,t=!0){this.serialized=e;this.persist=t;this.counts=set();this.testById=new Map;this.id=e.id,this.completedAt=e.completedAt,this.tasks=e.tasks.map((o,n)=>({id:o.id,name:o.name||d(17339,null),ctrlId:o.ctrlId,running:!1,coverage:De(this,void 0),output:UZo,otherMessages:[]})),this.name=e.name,this.request=e.request;for(let o of e.items){let n=NJe.deserialize(i,o);this.counts[n.ownComputedState]++,this.testById.set(o.item.extId,n)}}get tests(){return this.testById.values()}getStateById(i){return this.testById.get(i)}toJSON(){return this.persist?this.serialized:void 0}toJSONWithMessages(){return this.toJSON()}};var kxi=128,KZo=16,GZo=1024*128,qZo=.2,j0t=le("ITestResultStorage"),$0t=1,aet=class extends k{constructor(e,t,o){super();this.uriIdentityService=e;this.logService=o;this.stored=this._register(new tI({key:"storedTestResults",scope:1,target:1},t))}async read(){let e=await Promise.all(this.stored.get([]).map(async o=>{if(o.rev===$0t)try{let n=await this.readForResultId(o.id);return n?{rec:o,result:new q0t(this.uriIdentityService,n)}:void 0}catch(n){this.logService.warn(`Error deserializing stored test result ${o.id}`,n);return}})),t=e.filter(so);return t.length!==e.length&&this.stored.store(t.map(({rec:o})=>o)),t.map(({result:o})=>o)}getResultOutputWriter(e){let t=ywe();return this.storeOutputForResultId(e,t),t}async persist(e){let t=new Map(this.stored.get([]).map(({id:s,bytes:l})=>[s,l])),o=[],n=[],r=GZo;for(let s=0;s<e.length&&s<kxi&&(r>0||o.length<KZo);s++){let l=e[s],c=t.get(l.id);if(c!==void 0){t.delete(l.id),o.push({id:l.id,rev:$0t,bytes:c}),r-=c;continue}let u=l.toJSON();if(!u)continue;let p=Ke.fromString(JSON.stringify(u));n.push(this.storeForResultId(l.id,u)),o.push({id:l.id,rev:$0t,bytes:p.byteLength}),r-=p.byteLength}for(let s of t.keys())n.push(this.deleteForResultId(s).catch(()=>{}));this.stored.store(o),await Promise.all(n)}};aet=I([m(0,gt),m(1,de),m(2,re)],aet);var VLe=class extends aet{constructor(e,t,o,n,r,s){super(e,t,o);this.fileService=r;this.directory=A.joinPath(s.workspaceStorageHome,n.getWorkspace().id,"testResults")}async readForResultId(e){let t=await this.fileService.readFile(this.getResultJsonPath(e));return JSON.parse(t.value.toString())}storeForResultId(e,t){return this.fileService.writeFile(this.getResultJsonPath(e),Ke.fromString(JSON.stringify(t)))}deleteForResultId(e){return this.fileService.del(this.getResultJsonPath(e)).catch(()=>{})}async readOutputRangeForResultId(e,t,o){try{let{value:n}=await this.fileService.readFile(this.getResultOutputPath(e),{position:t,length:o});return n}catch{return Ke.alloc(0)}}async readOutputForResultId(e){try{let{value:t}=await this.fileService.readFileStream(this.getResultOutputPath(e));return t}catch{return lD(Ke.alloc(0))}}async storeOutputForResultId(e,t){await this.fileService.createFile(this.getResultOutputPath(e),t)}async persist(e){await super.persist(e),Math.random()<qZo&&await this.cleanupDereferenced()}async cleanupDereferenced(){let{children:e}=await this.fileService.resolve(this.directory);if(!e)return;let t=new Set(this.stored.get([]).filter(o=>o.rev===$0t).map(o=>o.id));await Promise.all(e.filter(o=>!t.has(o.name.replace(/\.[a-z]+$/,""))).map(o=>this.fileService.del(o.resource).catch(()=>{})))}getResultJsonPath(e){return A.joinPath(this.directory,`${e}.json`)}getResultOutputPath(e){return A.joinPath(this.directory,`${e}.output`)}};VLe=I([m(0,gt),m(1,de),m(2,re),m(3,Ae),m(4,ge),m(5,ko)],VLe);var $Zo=a=>a.results.length>0&&a.results[0].completedAt===void 0,Rd=le("testResultService"),BLe=class extends k{constructor(e,t,o,n){super();this.storage=t;this.testProfiles=o;this.telemetryService=n;this.changeResultEmitter=this._register(new T);this._results=[];this._resultsDisposables=[];this.testChangeEmitter=this._register(new T);this.insertOrderCounter=0;this.onResultsChanged=this.changeResultEmitter.event;this.onTestChanged=this.testChangeEmitter.event;this.loadResults=bd(()=>this.storage.read().then(e=>{for(let t=e.length-1;t>=0;t--)this.push(e[t])}));this.persistScheduler=this._register(new Dt(()=>this.persistImmediately(),500));this._register(ee(()=>je(this._resultsDisposables))),this.isRunning=co.isRunning.bindTo(e),this.hasAnyResults=co.hasAnyResults.bindTo(e)}get results(){return this.loadResults(),this._results}getStateById(e){for(let t of this.results){let o=t.getStateById(e);if(o&&o.computedState!==0)return[t,o]}}createLiveResult(e){if("targets"in e){let n=ht();return this.push(new lg(n,!0,e,this.insertOrderCounter++,this.telemetryService))}let t;e.profile&&(t=this.testProfiles.getControllerProfiles(e.controllerId).find(r=>r.profileId===e.profile.id));let o={preserveFocus:e.preserveFocus,targets:[],exclude:e.exclude,continuous:e.continuous,group:t?.group??2};return t&&o.targets.push({profileId:t.profileId,controllerId:e.controllerId,testIds:e.include}),this.push(new lg(e.id,e.persist,o,this.insertOrderCounter++,this.telemetryService))}push(e){if(e.completedAt===void 0)this.results.unshift(e);else{let o=Mw(this.results,n=>n.completedAt!==void 0&&n.completedAt<=e.completedAt);this.results.splice(o,0,e),this.persistScheduler.schedule()}this.hasAnyResults.set(!0),this.results.length>kxi&&(this.results.pop(),this._resultsDisposables.pop()?.dispose());let t=new O;if(this._resultsDisposables.push(t),e instanceof lg)t.add(e),t.add(e.onComplete(()=>this.onComplete(e))),t.add(e.onChange(this.testChangeEmitter.fire,this.testChangeEmitter)),this.isRunning.set(!0),this.changeResultEmitter.fire({started:e});else{this.changeResultEmitter.fire({inserted:e});for(let o of e.tests)for(let n of this.results)if(n===e){this.testChangeEmitter.fire({item:o,result:e,reason:0});break}else if(n.getStateById(o.item.extId)!==void 0)break}return e}getResult(e){return this.results.find(t=>t.id===e)}clear(){let e=[],t=[];for(let o of this.results)o.completedAt!==void 0?t.push(o):e.push(o);this._results=e,this.persistScheduler.schedule(),e.length===0&&this.hasAnyResults.set(!1),this.changeResultEmitter.fire({removed:t})}onComplete(e){this.resort(),this.updateIsRunning(),this.persistScheduler.schedule(),this.changeResultEmitter.fire({completed:e})}resort(){this.results.sort((e,t)=>{if(!!e.completedAt!=!!t.completedAt)return e.completedAt===void 0?-1:1;let o=e instanceof lg?e.insertOrder:-1;return(t instanceof lg?t.insertOrder:-1)-o})}updateIsRunning(){this.isRunning.set($Zo(this))}async persistImmediately(){await this.loadResults(),this.storage.persist(this.results)}};BLe=I([m(0,X),m(1,j0t),m(2,Vu),m(3,_e)],BLe);var Xs=le("testService"),Tmo=a=>!yt.some(a.rootItems,i=>i.children.size>0),_mo=(a,i)=>{if(typeof i=="string"&&(i=ns.fromString(i)),i.isRoot)return{controller:i.toString()};let e={$mid:16,tests:[]};for(let t of i.idsFromRoot())if(!t.isRoot){let o=a.getNodeById(t.toString());o&&e.tests.push(o)}return e},Dmo=async(a,i,e=Ie.None)=>{let t=[...ns.fromString(i).idsFromRoot()],o=0;for(let n=t.length-1;!e.isCancellationRequested&&n>=o;){let r=t[n].toString(),s=a.getNodeById(r);if(!s){n--;continue}if(n===t.length-1)return s;s.children.has(t[n+1].toString())||await a.expand(r,0),o=n+1,n=t.length-1}},cet=(a,i)=>{if(i.item.busy)return new Promise(e=>{let t=a.onDidProcessDiff(()=>{a.collection.getNodeById(i.item.extId)?.item.busy!==!0&&(e(),t.dispose())})})},Zme=async function*(a,i,e,t=!0,o=!0){let n=new ra,r=[...a.collection.getNodeByUrl(e)].sort((c,u)=>c.item.extId.length-u.item.extId.length);for(let c=0;c<r.length-1;c++){let u=r[c].item.extId+"\0";for(let p=c+1;p<r.length;p++)r[p].item.extId.startsWith(u)&&r.splice(p--,1)}n.push(r.length?r.map(c=>c.item.extId):a.collection.rootIds);let s=0,l=[];for(;n.size>0;){let c=n.pop(),u;c instanceof Mo?c.isSettled?u=c.value||yt.empty():(l.length&&(yield l,l=[]),u=await c.p):u=c;for(let p of u){s++;let h=a.collection.getNodeById(p);if(h){if(!h.item.uri){n.push(h.children);continue}if(!(i.extUri.isEqual(e,h.item.uri)&&(l.push(h),!o))&&i.extUri.isEqualOrParent(e,h.item.uri)){let g;h.expand===1&&(g=a.collection.expand(h.item.extId,1)),t&&(g?g=g.then(()=>cet(a,h)):h.item.busy&&(g=cet(a,h))),g?n.push(Mo.fromPromise(g.then(()=>h.children))):h.children.size&&n.push(h.children)}}}}l.length&&(yield l)},Rmo=async function*(a,i,e,t=!0){let o=[a.collection.rootIds];for(;o.length;)for(let n of o.pop()){let r=a.collection.getNodeById(n);r&&(r.item.uri&&i.extUri.isEqualOrParent(r.item.uri,e)?yield r:(!r.item.uri||i.extUri.isEqualOrParent(e,r.item.uri))&&(r.expand===1&&await a.collection.expand(r.item.extId,1),t&&await cet(a,r),o.push(r.children.values())))}},Lmo=(a,i)=>{if(i.length<2)return i;let e=new IN;for(let n of i)e.insert(ns.fromString(n.item.extId).path,n);let t=[],o=(n,r)=>{if(r.value)return r.value;Aw(!!r.children,"expect to have children");let s=[];for(let[u,p]of r.children){n.push(u);let h=o(n,p);h&&s.push(h),n.pop()}if(!s.length)return;let l=new ns(n),c=a.getNodeById(l.toString());if(c?.children.size===s.length)return c;t.push(...s)};for(let[n,r]of e.entries){let s=o([n],r);s&&t.push(s)}return t};var Q0t=class extends k{constructor(e,t,o,n,r){super();this.uriIdentityService=t;this.testService=o;this.testProfiles=n;this.resultService=r;this.diffListener=this._register(new ue);this.testProviderRegistrations=new Map;this.proxy=e.getProxy(ao.ExtHostTesting),this._register(this.testService.registerExtHost({provideTestFollowups:(s,l)=>this.proxy.$provideTestFollowups(s,l),executeTestFollowup:s=>this.proxy.$executeTestFollowup(s),disposeTestFollowups:s=>this.proxy.$disposeTestFollowups(s),getTestsRelatedToCode:(s,l,c)=>this.proxy.$getTestsRelatedToCode(s,l,c)})),this._register(this.testService.onDidCancelTestRun(({runId:s,taskId:l})=>{this.proxy.$cancelExtensionTestRun(s,l)})),this._register(U.debounce(n.onDidChange,(s,l)=>l)(()=>{let s={};for(let l of[2,4,8])for(let c of this.testProfiles.getGroupDefaultProfiles(l))s[c.controllerId]??=[],s[c.controllerId].push(c.profileId);this.proxy.$setDefaultRunProfiles(s)})),this._register(r.onResultsChanged(s=>{if("completed"in s){let l=s.completed.toJSONWithMessages();l&&this.proxy.$publishTestResults([l])}else"removed"in s&&s.removed.forEach(l=>{l instanceof lg&&this.proxy.$disposeRun(l.id)})}))}$markTestRetired(e){let t;if(e){t=new IN;for(let o of e)t.insert(ns.fromString(o).path,void 0)}for(let o of this.resultService.results)o instanceof lg&&o.markRetired(t)}$publishTestRunProfile(e){let t=this.testProviderRegistrations.get(e.controllerId);t&&this.testProfiles.addProfile(t.instance,e)}$updateTestRunConfig(e,t,o){this.testProfiles.updateProfile(e,t,o)}$removeTestProfile(e,t){this.testProfiles.removeProfile(e,t)}$addTestsToRun(e,t,o){this.withLiveRun(t,n=>n.addTestChainToRun(e,o.map(r=>PJe.deserialize(this.uriIdentityService,r))))}$appendCoverage(e,t,o){this.withLiveRun(e,n=>{let r=n.tasks.find(l=>l.id===t);if(!r)return;let s=_yi.deserialize(this.uriIdentityService,o);Ki(l=>{let c=r.coverage.read(void 0);c?c.append(s,l):(c=new B0t(n,t,this.uriIdentityService,{getCoverageDetails:(u,p,h)=>this.proxy.$getCoverageDetails(u,p,h).then(g=>g.map(Lyi.deserialize))}),c.append(s,l),r.coverage.set(c,l))})})}$startedExtensionTestRun(e){this.resultService.createLiveResult(e)}$startedTestRunTask(e,t){this.withLiveRun(e,o=>o.addTask(t))}$finishedTestRunTask(e,t){this.withLiveRun(e,o=>o.markTaskComplete(t))}$finishedExtensionTestRun(e){this.withLiveRun(e,t=>t.markComplete())}$updateTestStateInRun(e,t,o,n,r){this.withLiveRun(e,s=>s.updateState(o,t,n,r))}$appendOutputToRun(e,t,o,n,r){let s=n&&{uri:A.revive(n.uri),range:G.lift(n.range)};this.withLiveRun(e,l=>l.appendOutput(o,t,s,r))}$appendTestMessagesInRun(e,t,o,n){let r=this.resultService.getResult(e);if(r&&r instanceof lg)for(let s of n)r.appendMessage(o,t,oW.deserialize(this.uriIdentityService,s))}$registerTestController(e,t,o){let n=new O,r=De(`${e}.label`,t),s=De(`${e}.cap`,o),l={id:e,label:r,capabilities:s,syncTests:()=>this.proxy.$syncTests(),refreshTests:c=>this.proxy.$refreshTests(e,c),configureRunProfile:c=>this.proxy.$configureRunProfile(e,c),runTests:(c,u)=>this.proxy.$runControllerTests(c,u),startContinuousRun:(c,u)=>this.proxy.$startContinuousRun(c,u),expandTest:(c,u)=>this.proxy.$expandTest(c,isFinite(u)?u:-1),getRelatedCode:(c,u)=>this.proxy.$getCodeRelatedToTest(c,u).then(p=>p.map(h=>({uri:A.revive(h.uri),range:G.lift(h.range)})))};n.add(ee(()=>this.testProfiles.removeProfile(e))),n.add(this.testService.registerTestController(e,l)),this.testProviderRegistrations.set(e,{instance:l,label:r,capabilities:s,disposable:n})}$updateController(e,t){let o=this.testProviderRegistrations.get(e);o&&Ki(n=>{t.label!==void 0&&o.label.set(t.label,n),t.capabilities!==void 0&&o.capabilities.set(t.capabilities,n)})}$unregisterTestController(e){this.testProviderRegistrations.get(e)?.disposable.dispose(),this.testProviderRegistrations.delete(e)}$subscribeToDiffs(){this.proxy.$acceptDiff(this.testService.collection.getReviverDiff().map(iOt.serialize)),this.diffListener.value=this.testService.onDidProcessDiff(this.proxy.$acceptDiff,this.proxy)}$unsubscribeFromDiffs(){this.diffListener.clear()}$publishDiff(e,t){this.testService.publishDiff(e,t.map(o=>iOt.deserialize(this.uriIdentityService,o)))}async $runTests(e,t){return(await this.testService.runResolvedTests(e,t)).id}async $getCoverageDetails(e,t,o,n){return await this.resultService.getResult(e)?.tasks[t]?.coverage.get()?.getUri(A.from(o))?.details(n)||[]}dispose(){super.dispose();for(let e of this.testProviderRegistrations.values())e.disposable.dispose();this.testProviderRegistrations.clear()}withLiveRun(e,t){let o=this.resultService.getResult(e);return o&&o instanceof lg?t(o):void 0}};Q0t=I([fo(Xi.MainThreadTesting),m(1,gt),m(2,Xs),m(3,Vu),m(4,Rd)],Q0t);var Y0t=class extends k{constructor(e,t,o,n){super();this.secretStorageService=t;this.logService=o;this._sequencer=new II;this._proxy=e.getProxy(ao.ExtHostSecretState),this._register(this.secretStorageService.onDidChangeSecret(r=>{let s=this.parseKey(r);s&&this._proxy.$onDidChangePassword(s)}))}$getPassword(e,t){return this.logService.trace(`[mainThreadSecretState] Getting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doGetPassword(e,t))}async doGetPassword(e,t){let o=this.getKey(e,t),n=await this.secretStorageService.get(o);return this.logService.trace(`[mainThreadSecretState] ${n?"P":"No p"}assword found for: `,e,t),n}$setPassword(e,t,o){return this.logService.trace(`[mainThreadSecretState] Setting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doSetPassword(e,t,o))}async doSetPassword(e,t,o){let n=this.getKey(e,t);await this.secretStorageService.set(n,o),this.logService.trace("[mainThreadSecretState] Password set for: ",e,t)}$deletePassword(e,t){return this.logService.trace(`[mainThreadSecretState] Deleting password for ${e} extension: `,t),this._sequencer.queue(e,()=>this.doDeletePassword(e,t))}async doDeletePassword(e,t){let o=this.getKey(e,t);await this.secretStorageService.delete(o),this.logService.trace("[mainThreadSecretState] Password deleted for: ",e,t)}$getKeys(e){return this.logService.trace(`[mainThreadSecretState] Getting keys for ${e} extension: `),this._sequencer.queue(e,()=>this.doGetKeys(e))}async doGetKeys(e){if(!this.secretStorageService.keys)throw new Error("Secret storage service does not support keys() method");let o=(await this.secretStorageService.keys()).map(n=>this.parseKey(n)).filter(n=>n!==void 0&&n.extensionId===e).map(({key:n})=>n);return this.logService.trace(`[mainThreadSecretState] Got ${o.length}key(s) for: `,e),o}getKey(e,t){return JSON.stringify({extensionId:e,key:t})}parseKey(e){try{return JSON.parse(e)}catch{return}}};Y0t=I([fo(Xi.MainThreadSecretState),m(1,fC),m(2,re),m(3,Od)],Y0t);var HLe=le("shareService");var X0t=class{constructor(i,e){this.shareService=e;this.providers=new Map;this.providerDisposables=new Map;this.proxy=i.getProxy(ao.ExtHostShare)}$registerShareProvider(i,e,t,o,n){let r={id:t,label:o,selector:e,priority:n,provideShare:async l=>{let c=await this.proxy.$provideShare(i,l,Ie.None);return typeof c=="string"?c:A.revive(c)}};this.providers.set(i,r);let s=this.shareService.registerShareProvider(r);this.providerDisposables.set(i,s)}$unregisterShareProvider(i){this.providers.delete(i),this.providerDisposables.delete(i)}dispose(){this.providers.clear(),je(this.providerDisposables.values()),this.providerDisposables.clear()}};X0t=I([fo(Xi.MainThreadShare),m(1,HLe)],X0t);var J0t=class extends k{constructor(e,t){super();this.userDataProfileImportExportService=t;this.registeredHandlers=this._register(new Ot);this.proxy=e.getProxy(ao.ExtHostProfileContentHandlers)}async $registerProfileContentHandler(e,t,o,n){this.registeredHandlers.set(e,this.userDataProfileImportExportService.registerProfileContentHandler(e,{name:t,description:o,extensionId:n,saveProfile:async(r,s,l)=>{let c=await this.proxy.$saveProfile(e,r,s,l);return c?er(c):null},readProfile:async(r,s)=>this.proxy.$readProfile(e,r,s)}))}async $unregisterProfileContentHandler(e){this.registeredHandlers.deleteAndDispose(e)}};J0t=I([fo(Xi.MainThreadProfileContentHandlers),m(1,MH)],J0t);var ULe=le("IAiRelatedInformationService");var Z0t=class extends k{constructor(e,t){super();this._aiRelatedInformationService=t;this._registrations=this._register(new Ot);this._proxy=e.getProxy(ao.ExtHostAiRelatedInformation)}$getAiRelatedInformation(e,t){return this._aiRelatedInformationService.getRelatedInformation(e,t,Ie.None)}$registerAiRelatedInformationProvider(e,t){let o={provideAiRelatedInformation:(n,r)=>this._proxy.$provideAiRelatedInformation(e,n,r)};this._registrations.set(e,this._aiRelatedInformationService.registerAiRelatedInformationProvider(t,o))}$unregisterAiRelatedInformationProvider(e){this._registrations.deleteAndDispose(e)}};Z0t=I([fo(Xi.MainThreadAiRelatedInformation),m(1,ULe)],Z0t);var Exi=le("IAiEmbeddingVectorService"),ehe=class{constructor(i){this.logService=i;this._providers=[]}static{this.DEFAULT_TIMEOUT=1e3*10}isEnabled(){return this._providers.length>0}registerAiEmbeddingVectorProvider(i,e){return this._providers.push(e),{dispose:()=>{let t=this._providers.indexOf(e);t>=0&&this._providers.splice(t,1)}}}async getEmbeddingVector(i,e){if(this._providers.length===0)throw new Error("No embedding vector providers registered");let t=On.create(),o=[],n=Li(ehe.DEFAULT_TIMEOUT),r=e.onCancellationRequested(()=>{r.dispose(),n.cancel()});for(let s of this._providers)o.push(Hn(async l=>{try{return await s.provideAiEmbeddingVector(Array.isArray(i)?i:[i],l)}catch{}throw await n,new Error("Embedding vector provider timed out")}));o.push(Hn(async s=>{let l=s.onCancellationRequested(()=>{n.cancel(),l.dispose()});throw await n,new Error("Embedding vector provider timed out")}));try{let s=await Hle(o);return s.length===1?s[0]:s}finally{t.stop(),this.logService.trace(`[AiEmbeddingVectorService]: getEmbeddingVector took ${t.elapsed()}ms`)}}};ehe=I([m(0,re)],ehe);Ce(Exi,ehe,1);var eWt=class extends k{constructor(e,t){super();this._AiEmbeddingVectorService=t;this._registrations=this._register(new Ot);this._proxy=e.getProxy(ao.ExtHostAiEmbeddingVector)}$registerAiEmbeddingVectorProvider(e,t){let o={provideAiEmbeddingVector:(n,r)=>this._proxy.$provideAiEmbeddingVector(t,n,r)};this._registrations.set(t,this._AiEmbeddingVectorService.registerAiEmbeddingVectorProvider(e,o))}$unregisterAiEmbeddingVectorProvider(e){this._registrations.deleteAndDispose(e)}};eWt=I([fo(Xi.MainThreadAiEmbeddingVector),m(1,Exi)],eWt);var tWt=class extends k{constructor(e,t){super();this._settingsSearchService=t;this._registrations=this._register(new Ot);this._proxy=e.getProxy(ao.ExtHostAiSettingsSearch)}$registerAiSettingsSearchProvider(e){let t={searchSettings:(o,n,r)=>this._proxy.$startSearch(e,o,n,r)};this._registrations.set(e,this._settingsSearchService.registerSettingsSearchProvider(t))}$unregisterAiSettingsSearchProvider(e){this._registrations.deleteAndDispose(e)}$handleSearchResult(e,t){if(!this._registrations.has(e))throw new Error("No AI settings search provider found");this._settingsSearchService.handleSearchResult(t)}};tWt=I([fo(Xi.MainThreadAiSettingsSearch),m(1,SRe)],tWt);var zLe=le("IWorkbenchMcpGatewayService");var xc=le("mcpRegistry");var the=le("IAuthenticationMcpAccessService"),det=class extends k{constructor(e,t){super();this._storageService=e;this._productService=t;this._onDidChangeMcpSessionAccess=this._register(new T);this.onDidChangeMcpSessionAccess=this._onDidChangeMcpSessionAccess.event}isAccessAllowed(e,t,o){let n=this._productService.trustedMcpAuthAccess;if(Array.isArray(n)){if(n.includes(o))return!0}else if(n?.[e]?.includes(o))return!0;let s=this.readAllowedMcpServers(e,t).find(l=>l.id===o);if(s)return s.allowed!==void 0?s.allowed:!0}readAllowedMcpServers(e,t){let o=[];try{let s=this._storageService.get(`mcpserver-${e}-${t}`,-1);s&&(o=JSON.parse(s))}catch{}let n=this._productService.trustedMcpAuthAccess,r=Array.isArray(n)?n:typeof n=="object"?n[e]??[]:[];for(let s of r){let l=o.find(c=>c.id===s);l?(l.allowed=!0,l.trusted=!0):o.push({id:s,name:s,allowed:!0,trusted:!0})}return o}updateAllowedMcpServers(e,t,o){let n=this.readAllowedMcpServers(e,t);for(let s of o){let l=n.findIndex(c=>c.id===s.id);l===-1?n.push(s):(n[l].allowed=s.allowed,s.name&&s.name!==s.id&&n[l].name!==s.name&&(n[l].name=s.name))}let r=n.filter(s=>!s.trusted);this._storageService.store(`mcpserver-${e}-${t}`,JSON.stringify(r),-1,0),this._onDidChangeMcpSessionAccess.fire({providerId:e,accountName:t})}removeAllowedMcpServers(e,t){this._storageService.remove(`mcpserver-${e}-${t}`,-1),this._onDidChangeMcpSessionAccess.fire({providerId:e,accountName:t})}};det=I([m(0,de),m(1,Ze)],det);Ce(the,det,1);var Al=le("activityService"),uet=class{constructor(i,e){this.descriptorFn=i;this.stylesFn=e}getDescription(){return this.descriptorFn(null)}getColors(i){return this.stylesFn?.(i)}},eu=class extends uet{constructor(e,t){super(t,void 0);this.number=e;this.number=e}getDescription(){return this.descriptorFn(this.number)}},EG=class extends uet{constructor(e,t,o){super(t,o);this.icon=e}},Jx=class extends uet{constructor(i){super(i,void 0)}},pet=class extends EG{constructor(i){super(L.warning,i,e=>({badgeBackground:e.getColor(A9i),badgeForeground:e.getColor(P9i),badgeBorder:void 0}))}};var ihe=le("IAuthenticationMcpUsageService"),met=class extends k{constructor(e,t,o,n){super();this._storageService=e;this._authenticationService=t;this._logService=o;this._queue=new Hh;this._mcpServersUsingAuth=new Set;let r=n.trustedMcpAuthAccess;if(Array.isArray(r))for(let s of r)this._mcpServersUsingAuth.add(s);else if(r)for(let s of Object.values(r))for(let l of s)this._mcpServersUsingAuth.add(l);this._register(this._authenticationService.onDidRegisterAuthenticationProvider(s=>this._queue.queue(()=>this._addToCache(s.id))))}async initializeUsageCache(){await this._queue.queue(()=>Promise.all(this._authenticationService.getProviderIds().map(e=>this._addToCache(e))))}async hasUsedAuth(e){return await this._queue.whenIdle(),this._mcpServersUsingAuth.has(e)}readAccountUsages(e,t){let o=`${e}-${t}-mcpserver-usages`,n=this._storageService.get(o,-1),r=[];if(n)try{r=JSON.parse(n)}catch{}return r}removeAccountUsage(e,t){let o=`${e}-${t}-mcpserver-usages`;this._storageService.remove(o,-1)}addAccountUsage(e,t,o,n,r){let s=`${e}-${t}-mcpserver-usages`,l=this.readAccountUsages(e,t),c=l.findIndex(u=>u.mcpServerId===n);c>-1?l.splice(c,1,{mcpServerId:n,mcpServerName:r,scopes:o,lastUsed:Date.now()}):l.push({mcpServerId:n,mcpServerName:r,scopes:o,lastUsed:Date.now()}),this._storageService.store(s,JSON.stringify(l),-1,1),this._mcpServersUsingAuth.add(n)}async _addToCache(e){try{let t=await this._authenticationService.getAccounts(e);for(let o of t){let n=this.readAccountUsages(e,o.label);for(let r of n)this._mcpServersUsingAuth.add(r.mcpServerId)}}catch(t){this._logService.error(t)}}};met=I([m(0,de),m(1,ks),m(2,re),m(3,Ze)],met);Ce(ihe,met,1);var het=" ",fet=le("IAuthenticationMcpService"),get=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.activityService=e;this.storageService=t;this.dialogService=o;this.quickInputService=n;this._productService=r;this._authenticationService=s;this._authenticationUsageService=l;this._authenticationAccessService=c;this._signInRequestItems=new Map;this._sessionAccessRequestItems=new Map;this._accountBadgeDisposable=this._register(new ue);this._onDidAccountPreferenceChange=this._register(new T);this.onDidChangeAccountPreference=this._onDidAccountPreferenceChange.event;this._inheritAuthAccountPreferenceParentToChildren=this._productService.inheritAuthAccountPreference||{},this._inheritAuthAccountPreferenceChildToParent=Object.entries(this._inheritAuthAccountPreferenceParentToChildren).reduce((u,[p,h])=>(h.forEach(g=>{u[g]=p}),u),{}),this.registerListeners()}registerListeners(){this._register(this._authenticationService.onDidChangeSessions(async e=>{e.event.added?.length&&await this.updateNewSessionRequests(e.providerId,e.event.added),e.event.removed?.length&&await this.updateAccessRequests(e.providerId,e.event.removed),this.updateBadgeCount()})),this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this._sessionAccessRequestItems.get(e.id)||{};Object.keys(t).forEach(o=>{this.removeAccessRequest(e.id,o)})}))}async updateNewSessionRequests(e,t){let o=this._signInRequestItems.get(e);o&&Object.keys(o).forEach(n=>{let r=n.split(het);t.some(s=>N0t(s.scopes,r))&&(o[n]?.disposables.forEach(l=>l.dispose()),delete o[n],Object.keys(o).length===0?this._signInRequestItems.delete(e):this._signInRequestItems.set(e,o))})}async updateAccessRequests(e,t){let o=this._sessionAccessRequestItems.get(e);o&&Object.keys(o).forEach(n=>{t.forEach(r=>{let s=o[n].possibleSessions.findIndex(l=>l.id===r.id);s&&o[n].possibleSessions.splice(s,1)}),o[n].possibleSessions.length||this.removeAccessRequest(e,n)})}updateBadgeCount(){this._accountBadgeDisposable.clear();let e=0;if(this._signInRequestItems.forEach(t=>{Object.keys(t).forEach(o=>{e+=t[o].requestingMcpServerIds.length})}),this._sessionAccessRequestItems.forEach(t=>{e+=Object.keys(t).length}),e>0){let t=new eu(e,()=>d(18680,null));this._accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:t})}}removeAccessRequest(e,t){let o=this._sessionAccessRequestItems.get(e)||{};o[t]&&(je(o[t].disposables),delete o[t],this.updateBadgeCount())}updateAccountPreference(e,t,o){let n=this._inheritAuthAccountPreferenceChildToParent[e]??e,r=this._getKey(n,t);this.storageService.store(r,o.label,1,1),this.storageService.store(r,o.label,-1,1);let s=this._inheritAuthAccountPreferenceParentToChildren[n],l=s?[n,...s]:[n];this._onDidAccountPreferenceChange.fire({mcpServerIds:l,providerId:t})}getAccountPreference(e,t){let o=this._getKey(this._inheritAuthAccountPreferenceChildToParent[e]??e,t);return this.storageService.get(o,1)??this.storageService.get(o,-1)}removeAccountPreference(e,t){let o=this._getKey(this._inheritAuthAccountPreferenceChildToParent[e]??e,t);this.storageService.remove(o,1),this.storageService.remove(o,-1)}_getKey(e,t){return`${e}-${t}`}updateSessionPreference(e,t,o){let n=`${t}-${e}-${o.scopes.join(het)}`;this.storageService.store(n,o.id,1,1),this.storageService.store(n,o.id,-1,1)}getSessionPreference(e,t,o){let n=`${t}-${e}-${o.join(het)}`;return this.storageService.get(n,1)??this.storageService.get(n,-1)}removeSessionPreference(e,t,o){let n=`${t}-${e}-${o.join(het)}`;this.storageService.remove(n,1),this.storageService.remove(n,-1)}_updateAccountAndSessionPreferences(e,t,o){this.updateAccountPreference(t,e,o.account),this.updateSessionPreference(e,t,o)}async showGetSessionPrompt(e,t,o,n){let r;(p=>(p[p.Allow=0]="Allow",p[p.Deny=1]="Deny",p[p.Cancel=2]="Cancel"))(r||={});let{result:s}=await this.dialogService.prompt({type:ft.Info,message:d(18676,null,n,e.label,t),buttons:[{label:d(18675,null),run:()=>0},{label:d(18677,null),run:()=>1}],cancelButton:{run:()=>2}});return s!==2&&(this._authenticationAccessService.updateAllowedMcpServers(e.id,t,[{id:o,name:n,allowed:s===0}]),this.removeAccessRequest(e.id,o)),s===0}async selectSession(e,t,o,n,r){let s=await this._authenticationService.getAccounts(e);if(!s.length)throw new Error("No accounts available");let l=new O,c=l.add(this.quickInputService.createQuickPick());c.ignoreFocusOut=!0;let u=new Set,p=r.filter(h=>!u.has(h.account.label)&&u.add(h.account.label)).map(h=>({label:h.account.label,session:h}));return s.forEach(h=>{u.has(h.label)||p.push({label:h.label,account:h})}),p.push({label:d(18682,null)}),c.items=p,c.title=d(18679,null,o,this._authenticationService.getProvider(e).label),c.placeholder=d(18678,null,o),await new Promise((h,g)=>{l.add(c.onDidAccept(async f=>{c.dispose();let v=c.selectedItems[0].session;if(!v){let S=c.selectedItems[0].account;try{v=await this._authenticationService.createSession(e,n,{account:S})}catch(y){g(y);return}}let b=v.account.label;this._authenticationAccessService.updateAllowedMcpServers(e,b,[{id:t,name:o,allowed:!0}]),this._updateAccountAndSessionPreferences(e,t,v),this.removeAccessRequest(e,t),h(v)})),l.add(c.onDidHide(f=>{c.selectedItems[0]||g("User did not consent to account access"),l.dispose()})),c.show()})}async completeSessionAccessRequest(e,t,o,n){let s=(this._sessionAccessRequestItems.get(e.id)||{})[t];if(!s||!e)return;let l=s.possibleSessions,c;if(e.supportsMultipleAccounts)try{c=await this.selectSession(e.id,t,o,n,l)}catch{}else await this.showGetSessionPrompt(e,l[0].account.label,t,o)&&(c=l[0]);c&&this._authenticationUsageService.addAccountUsage(e.id,c.account.label,c.scopes,t,o)}requestSessionAccess(e,t,o,n,r){let s=this._sessionAccessRequestItems.get(e)||{};if(s[t])return;let c=this._authenticationService.getProvider(e),u=be.appendMenuItem(R.AccountsContext,{group:"3_accessRequests",command:{id:`${e}${t}Access`,title:d(18674,null,c.label,o)}}),p=Ge.registerCommand({id:`${e}${t}Access`,handler:async h=>{this.completeSessionAccessRequest(c,t,o,n)}});s[t]={possibleSessions:r,disposables:[u,p]},this._sessionAccessRequestItems.set(e,s),this.updateBadgeCount()}async requestNewSession(e,t,o,n){this._authenticationService.isAuthenticationProviderRegistered(e)||await new Promise((g,f)=>{let v=this._authenticationService.onDidRegisterAuthenticationProvider(b=>{b.id===e&&(v.dispose(),g())})});let r;try{r=this._authenticationService.getProvider(e)}catch{return}let s=this._signInRequestItems.get(e),l=t.join(het);if(s&&s[l]&&s[l].requestingMcpServerIds.includes(o))return;let u=`${e}:${o}:signIn${Object.keys(s||[]).length}`,p=be.appendMenuItem(R.AccountsContext,{group:"2_signInRequests",command:{id:u,title:d(18681,null,r.label,n)}}),h=Ge.registerCommand({id:u,handler:async g=>{let v=await g.get(ks).createSession(e,t);this._authenticationAccessService.updateAllowedMcpServers(e,v.account.label,[{id:o,name:n,allowed:!0}]),this._updateAccountAndSessionPreferences(e,o,v)}});if(s){let g=s[l]||{disposables:[],requestingMcpServerIds:[]};s[l]={disposables:[...g.disposables,p,h],requestingMcpServerIds:[...g.requestingMcpServerIds,o]},this._signInRequestItems.set(e,s)}else this._signInRequestItems.set(e,{[l]:{disposables:[p,h],requestingMcpServerIds:[o]}});this.updateBadgeCount()}};get=I([m(0,Al),m(1,de),m(2,ct),m(3,$e),m(4,Ze),m(5,ks),m(6,ihe),m(7,the)],get);Ce(fet,get,1);var iWt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._extHostContext=e;this._mcpRegistry=t;this.dialogService=o;this._authenticationService=n;this.authenticationMcpServersService=r;this.authenticationMCPServerAccessService=s;this.authenticationMCPServerUsageService=l;this._dynamicAuthenticationProviderStorageService=c;this._extensionService=u;this._contextKeyService=p;this._telemetryService=h;this._mcpGatewayService=g;this._serverIdCounter=0;this._servers=new Map;this._serverDefinitions=new Map;this._serverAuthTracking=new _xi;this._collectionDefinitions=this._register(new Ot);this._gateways=this._register(new Ot);this._register(n.onDidChangeSessions(b=>this._onDidChangeAuthSessions(b.providerId,b.label)));let f=this._proxy=e.getProxy(ao.ExtHostMcp);this._register(this._mcpRegistry.registerDelegate({priority:e.extensionHostKind===2?0:1,waitForInitialProviderPromises(){return f.$waitForInitialCollectionProviders()},canStart(b,S){return!(b.remoteAuthority!==e.remoteAuthority||S.launch.type===1&&e.extensionHostKind===2)},async substituteVariables(b,S){let y=await f.$substituteVariables(b.variableReplacement?.folder?.uri,yN.toSerialized(S));return yN.fromSerialized(y)},start:(b,S,y,w)=>{let x=++this._serverIdCounter,E=new Txi(e.extensionHostKind,()=>f.$stopMcp(x),M=>f.$sendMessage(x,JSON.stringify(M)));return this._servers.set(x,E),this._serverDefinitions.set(x,S),f.$startMcp(x,{launch:y,defaultCwd:S.variableReplacement?.folder?.uri,errorOnUserInteraction:w?.errorOnUserInteraction}),E}}));let v=this._register(new Dt(()=>this._publishServerDefinitions(),500));this._register(ve(b=>{let S=this._mcpRegistry.collections.read(b);for(let y of S)y.serverDefinitions.read(b);v.isScheduled()||v.schedule()})),v.schedule()}_publishServerDefinitions(){let e=this._mcpRegistry.collections.get(),t=[];for(let o of e){let n=o.serverDefinitions.get();for(let r of n)t.push(GH.toSerialized(r))}this._proxy.$onDidChangeMcpServerDefinitions(t)}$upsertMcpCollection(e,t){let o=t.map(GH.fromSerialized),n=this._collectionDefinitions.get(e.id);if(n)n.servers.set(o,void 0);else{let r=De("mcpServers",o),s=new hi(e.extensionId),l=new O,c=l.add(new ue),u=()=>{c.value??=this._mcpRegistry.registerCollection({...e,source:s,order:300,resolveServerLanch:e.canResolveLaunch?(async g=>{let f=await this._proxy.$resolveMcpLaunch(e.id,g.label);return f?yN.fromSerialized(f):void 0}):void 0,trustBehavior:e.isTrustedByDefault?TC.Kind.Trusted:TC.Kind.TrustedOnNonce,remoteAuthority:this._extHostContext.remoteAuthority,serverDefinitions:r})},p=iD(this._extensionService.extensions,g=>hi.equals(s,g.identifier)?g.contributes?.mcpServerDefinitionProviders?.find(f=>RJe(s,f.id)===e.id)?.when:void 0),h=p&&C.deserialize(p);if(!h)u();else{let g=()=>{this._contextKeyService.contextMatchesRules(h)?u():c.clear()};l.add(this._contextKeyService.onDidChangeContext(g)),g()}this._collectionDefinitions.set(e.id,{servers:r,dispose:()=>l.dispose()})}}$deleteMcpCollection(e){this._collectionDefinitions.deleteAndDispose(e)}$onDidChangeState(e,t){let o=this._servers.get(e);o&&(o.state.set(t,void 0),Sr.isRunning(t)||(o.dispose(),this._servers.delete(e),this._serverDefinitions.delete(e),this._serverAuthTracking.untrack(e)))}$onDidPublishLog(e,t,o){typeof t=="string"&&(t=3,o=t),this._servers.get(e)?.pushLog(t,o)}$onDidReceiveMessage(e,t){this._servers.get(e)?.pushMessage(t)}async $getTokenForProviderId(e,t,o,n={}){let r=this._serverDefinitions.get(e);if(r)return this._getSessionForProvider(e,r,t,o,void 0,n.errorOnUserInteraction,n.clientId)}async $getTokenFromServerMetadata(e,t,{errorOnUserInteraction:o,forceNewRegistration:n,clientId:r}={}){let s=this._serverDefinitions.get(e);if(!s)return;let l=A.revive(t.authorizationServer),c=t.resourceMetadata?.resource?A.parse(t.resourceMetadata.resource):void 0,u=t.scopes??t.resourceMetadata?.scopes_supported??t.authorizationServerMetadata.scopes_supported??[],p=await this._authenticationService.getOrActivateProviderIdForServer(l,c);if(n&&p){if(!this._authenticationService.isDynamicAuthenticationProvider(p))throw new Error("Cannot force new registration for a non-dynamic authentication provider.");this._authenticationService.unregisterAuthenticationProvider(p),await this._dynamicAuthenticationProviderStorageService.removeDynamicProvider(p),p=void 0}if(!p){let h=await this._authenticationService.createDynamicAuthenticationProvider(l,t.authorizationServerMetadata,t.resourceMetadata,t.clientId);if(!h)return;p=h.id}return this._getSessionForProvider(e,s,p,u,l,o,r??t.clientId,t.resourceMetadata?.resource)}async _getSessionForProvider(e,t,o,n,r,s=!1,l,c){let u=await this._authenticationService.getSessions(o,n,{authorizationServer:r,clientId:l,resource:c},!0),p=this.authenticationMcpServersService.getAccountPreference(t.id,o),h;p&&(h=u.find(b=>b.account.label===p));let g=this._authenticationService.getProvider(o),f;if(u.length){if(h&&this.authenticationMCPServerAccessService.isAccessAllowed(o,h.account.label,t.id))return this.authenticationMCPServerUsageService.addAccountUsage(o,h.account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),h.accessToken;if(!g.supportsMultipleAccounts&&this.authenticationMCPServerAccessService.isAccessAllowed(o,u[0].account.label,t.id))return this.authenticationMCPServerUsageService.addAccountUsage(o,u[0].account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),u[0].accessToken}if(s)throw new EC("authentication");if(!await this.loginPrompt(t.label,g.label,!1))throw new Error("User did not consent to login.");if(u.length){if(g.supportsMultipleAccounts&&s)throw new EC("authentication");f=g.supportsMultipleAccounts?await this.authenticationMcpServersService.selectSession(o,t.id,t.label,n,u):u[0]}else{if(s)throw new EC("authentication");let b=h?.account;do f=await this._authenticationService.createSession(o,n,{activateImmediate:!0,account:b,authorizationServer:r,clientId:l,resource:c});while(b&&b.label!==f.account.label&&!await this.continueWithIncorrectAccountPrompt(f.account.label,b.label))}return this.authenticationMCPServerAccessService.updateAllowedMcpServers(o,f.account.label,[{id:t.id,name:t.label,allowed:!0}]),this.authenticationMcpServersService.updateAccountPreference(t.id,o,f.account),this.authenticationMCPServerUsageService.addAccountUsage(o,f.account.label,n,t.id,t.label),this._serverAuthTracking.track(o,e,n),f.accessToken}async continueWithIncorrectAccountPrompt(e,t){let o=await this.dialogService.prompt({message:d(3947,null),detail:d(3948,null,e,t),type:wt.Warning,cancelButton:!0,buttons:[{label:d(3949,null,e),run:()=>e},{label:d(3950,null,t),run:()=>t}]});if(!o.result)throw new qi;return o.result===e}async _onDidChangeAuthSessions(e,t){let o=this._serverAuthTracking.get(e);if(o)for(let{serverId:n,scopes:r}of o){let s=this._servers.get(n),l=this._serverDefinitions.get(n);if(!(!s||!l||s.state.get().state!==Sr.Kind.Running))try{await this._getSessionForProvider(n,l,e,r,void 0,!0)}catch(u){EC.is(u)&&(s.pushLog(4,d(3951,null,t)),s.stop())}}}$logMcpAuthSetup(e){this._telemetryService.publicLog2("mcp/authSetup",e)}async $startMcpGateway(e){let t=await this._mcpGatewayService.createGateway(this._extHostContext.extensionHostKind===3,e?A.revive(e):void 0);if(!t)return;if(this._store.isDisposed){t.dispose();return}let o=ht(),n=new O;return n.add(t),n.add(t.onDidChangeServers(r=>{this._proxy.$onDidChangeGatewayServers(o,r.map(s=>({label:s.label,address:s.address})))})),this._gateways.set(o,n),{servers:t.servers.map(r=>({label:r.label,address:r.address})),gatewayId:o}}$disposeMcpGateway(e){this._gateways.deleteAndDispose(e)}async loginPrompt(e,t,o){let n=o?d(3946,null,e,t):d(3945,null,e,t),r=[{label:d(3944,null),run(){return!0}}],{result:s}=await this.dialogService.prompt({type:wt.Info,message:n,buttons:r,cancelButton:!0});return s??!1}dispose(){for(let e of this._servers.values())e.extHostDispose();this._servers.clear(),this._serverDefinitions.clear(),this._serverAuthTracking.clear(),super.dispose()}};iWt=I([fo(Xi.MainThreadMcp),m(1,xc),m(2,ct),m(3,ks),m(4,fet),m(5,the),m(6,ihe),m(7,ote),m(8,lt),m(9,X),m(10,_e),m(11,zLe)],iWt);var Txi=class extends k{constructor(e,t,o){super();this.stop=t;this.send=o;this.state=De("mcpServerState",{state:Sr.Kind.Starting});this._onDidLog=this._register(new T);this.onDidLog=this._onDidLog.event;this._onDidReceiveMessage=this._register(new T);this.onDidReceiveMessage=this._onDidReceiveMessage.event;this._register(Zo(()=>{this.pushLog(3,`Starting server from ${SN(e)} extension host`)}))}pushLog(e,t){this._onDidLog.fire({message:t,level:e})}pushMessage(e){let t;try{t=JSON.parse(e)}catch{this.pushLog(4,`Failed to parse message: ${JSON.stringify(e)}`)}t&&(Array.isArray(t)?t.forEach(o=>this._onDidReceiveMessage.fire(o)):this._onDidReceiveMessage.fire(t))}extHostDispose(){Sr.isRunning(this.state.get())&&(this.pushLog(4,"Extension host shut down, server will stop."),this.state.set({state:Sr.Kind.Stopped},void 0)),this.dispose()}dispose(){Sr.isRunning(this.state.get())&&this.stop(),super.dispose()}},_xi=class{constructor(){this._tracking=new Map}track(i,e,t){let n=(this._tracking.get(i)||[]).filter(r=>r.serverId!==e);n.push({serverId:e,scopes:t}),this._tracking.set(i,n)}untrack(i){for(let[e,t]of this._tracking.entries()){let o=t.filter(n=>n.serverId!==i);o.length===0?this._tracking.delete(e):this._tracking.set(e,o)}}get(i){return this._tracking.get(i)}clear(){this._tracking.clear()}};function Mmo(a){return Di(a)&&typeof a.asAttachment=="function"}function ohe(a){return(i,e)=>ke(o=>{let n=i.read(o),r=new qe(e);return o.store.add(ee(()=>r.dispose(!0))),new Uc(a(n,r.token))}).map((o,n)=>{let r=o.promiseResult.read(n);return{picks:r?.data||[],busy:r===void 0}})}var iI=le("IContextPickService"),oWt=class{constructor(){this._picks=[];this.items=this._picks}registerChatContextItem(i){return this._picks.push(i),this._picks.sort((e,t)=>{let o=e.ordinal??0,n=t.ordinal??0;return o===n?oc(e.label,t.label):o<n?1:-1}),ee(()=>{let e=this._picks.indexOf(i);e>=0&&this._picks.splice(e,1)})}};var SR=le("chatContextService"),vet=class extends k{constructor(e,t){super();this._contextPickService=e;this._extensionService=t;this._providers=new Map;this._workspaceContext=new Map;this._registeredPickers=this._register(new Ot);this._lastResourceContext=new Map}setExecuteCommandCallback(e){this._executeCommandCallback=e}async executeChatContextItemCommand(e){this._executeCommandCallback&&await this._executeCommandCallback(e)}setChatContextProvider(e,t){let o=this._providers.get(e)??{};o.picker=t,this._providers.set(e,o),this._registerWithPickService(e)}_registerWithPickService(e){let t=this._providers.get(e);if(!t||!t.picker||!t.explicitProvider)return;let o=`${t.picker.title.replace(/\.+$/,"")}...`;this._registeredPickers.set(e,this._contextPickService.registerChatContextItem(this._asPicker(o,t.picker.icon,e)))}registerChatWorkspaceContextProvider(e,t){let o=this._providers.get(e)??{};o.workspaceProvider=t,this._providers.set(e,o)}registerChatExplicitContextProvider(e,t){let o=this._providers.get(e)??{};o.explicitProvider=t,this._providers.set(e,o),this._registerWithPickService(e)}registerChatResourceContextProvider(e,t,o){let n=this._providers.get(e)??{};n.resourceProvider={selector:t,provider:o},this._providers.set(e,n)}unregisterChatContextProvider(e){this._providers.delete(e),this._registeredPickers.deleteAndDispose(e)}updateWorkspaceContextItems(e,t){this._workspaceContext.set(e,t)}getWorkspaceContextItems(){let e=[];for(let t of this._workspaceContext.values())for(let o of t){if(!o.value)continue;let n=o.label??(o.resourceUri?Be(o.resourceUri):"Unknown");e.push({value:o.value,name:n,modelDescription:o.modelDescription,id:n,kind:"workspace"})}return e}async contextForResource(e,t){return this._contextForResource(e,!1,t)}async _contextForResource(e,t,o){let n=[];for(let p of this._providers.values()){if(!p.resourceProvider)continue;let h=gH(p.resourceProvider.selector,e,o??"",!0,void 0,void 0);n.push({score:h,provider:p.resourceProvider.provider})}if(n.sort((p,h)=>h.score-p.score),n.length===0||n[0].score<=0)return;let r=n[0].provider,s=await r.provideChatContext(e,t,Ie.None);if(!s)return;let l=s.resourceUri??e,u={value:void 0,name:s.label??Be(l),icon:s.icon,uri:e,resourceUri:s.resourceUri,modelDescription:s.modelDescription,tooltip:s.tooltip,commandId:s.command?.id,handle:s.handle};return this._lastResourceContext.clear(),this._lastResourceContext.set(u,{originalItem:s,provider:r}),u}async resolveChatContext(e,t){if(e.value!==void 0)return e;let o=this._lastResourceContext.get(e);if(o){let n=await o.provider.resolveChatContext(o.originalItem,Ie.None);if(n)return e.value=n.value,e.modelDescription=n.modelDescription,e.tooltip=n.tooltip,e}else{let n=await this._contextForResource(e.uri,!0,t);return e.value=n?.value,e.modelDescription=n?.modelDescription,e.tooltip=n?.tooltip,e}return e}_asPicker(e,t,o){return{asPicker:()=>{let s=this._providers.get(o);if(!s)throw new Error("No chat context provider registered");return{picks:(async()=>s&&!s.explicitProvider&&(await this._extensionService.activateByEvent(`onChatContextProvider:${o}`),s=this._providers.get(o),!s?.explicitProvider)?[]:await s?.explicitProvider.provideChatContext(Ie.None)||[])().then(c=>c.map(u=>({label:u.label??(u.resourceUri?Be(u.resourceUri):"Unknown"),iconClass:u.icon?q.asClassName(u.icon):void 0,asAttachment:async()=>{let h=u;h.value===void 0&&s?.explicitProvider&&(h=await s.explicitProvider.resolveChatContext(u,Ie.None));let g=h.label??(h.resourceUri?Be(h.resourceUri):"Unknown");return{kind:"generic",id:g,name:g,icon:h.icon,value:h.value}}}))),placeholder:e}},type:"pickerPick",label:e,icon:t}}};vet=I([m(0,iI),m(1,lt)],vet);Ce(SR,vet,1);function rWt(a){return{...a,resourceUri:a.resourceUri?A.revive(a.resourceUri):void 0}}function Dxi(a){return a.map(rWt)}var nWt=class extends k{constructor(e,t){super();this._chatContextService=t;this._providers=new Map;this._proxy=e.getProxy(ao.ExtHostChatContext),this._chatContextService.setExecuteCommandCallback(o=>this._proxy.$executeChatContextItemCommand(o))}$registerChatWorkspaceContextProvider(e,t){this._providers.set(e,{id:t}),this._chatContextService.registerChatWorkspaceContextProvider(t,{provideWorkspaceChatContext:async o=>{let n=await this._proxy.$provideWorkspaceChatContext(e,o);return Dxi(n)}})}$registerChatExplicitContextProvider(e,t){this._providers.set(e,{id:t}),this._chatContextService.registerChatExplicitContextProvider(t,{provideChatContext:async o=>{let n=await this._proxy.$provideExplicitChatContext(e,o);return Dxi(n)},resolveChatContext:async(o,n)=>{let r=await this._proxy.$resolveExplicitChatContext(e,o,n);return rWt(r)}})}$registerChatResourceContextProvider(e,t,o){this._providers.set(e,{id:t,selector:o}),this._chatContextService.registerChatResourceContextProvider(t,o,{provideChatContext:async(n,r,s)=>{let l=await this._proxy.$provideResourceChatContext(e,{resource:n,withValue:r},s);return l?rWt(l):void 0},resolveChatContext:async(n,r)=>{let s=await this._proxy.$resolveResourceChatContext(e,n,r);return rWt(s)}})}$unregisterChatContextProvider(e){let t=this._providers.get(e);t&&(this._chatContextService.unregisterChatContextProvider(t.id),this._providers.delete(e))}$updateWorkspaceContextItems(e,t){let o=this._providers.get(e);o&&this._chatContextService.updateWorkspaceContextItems(o.id,Dxi(t))}$executeChatContextItemCommand(e){return this._proxy.$executeChatContextItemCommand(e)}};nWt=I([fo(Xi.MainThreadChatContext),m(1,SR)],nWt);var ph=le("chatDebugService");var sWt=class extends k{constructor(e,t,o){super();this._chatDebugService=t;this._chatService=o;this._providerDisposables=new Map;this._activeSessionResources=new Map;this._coreEventForwarder=this._register(new ue);this._proxy=e.getProxy(ao.ExtHostChatDebug)}$subscribeToCoreDebugEvents(){this._coreEventForwarder.value=this._chatDebugService.onDidAddEvent(e=>{this._chatDebugService.isCoreEvent(e)&&this._proxy.$onCoreDebugEvent(this._serializeEvent(e))})}$unsubscribeFromCoreDebugEvents(){this._coreEventForwarder.clear()}$registerChatDebugLogProvider(e){let t=new O;this._providerDisposables.set(e,t),t.add(this._chatDebugService.registerProvider({provideChatDebugLog:async(o,n)=>(this._activeSessionResources.set(e,o),(await this._proxy.$provideChatDebugLog(e,o,n))?.map(s=>this._reviveEvent(s,o))),resolveChatDebugLogEvent:async(o,n)=>{let r=await this._proxy.$resolveChatDebugLogEvent(e,o,n);return r?this._reviveResolvedContent(r):void 0},provideChatDebugLogExport:async(o,n)=>{let r=this._chatDebugService.getEvents(o).filter(c=>this._chatDebugService.isCoreEvent(c)).map(c=>this._serializeEvent(c)),s=this._chatService.getSessionTitle(o);return(await this._proxy.$exportChatDebugLog(e,o,r,s,n))?.buffer},resolveChatDebugLogImport:async(o,n)=>{let r=await this._proxy.$importChatDebugLog(e,Ke.wrap(o),n);if(!r)return;let s=A.revive(r.uri);return r.sessionTitle&&this._chatDebugService.setImportedSessionTitle(s,r.sessionTitle),s}})),this._chatDebugService.registerAvailableSessionsFetcher(async o=>(await this._proxy.$getAvailableDebugSessionResources(e,o)).map(r=>({uri:A.revive(r.uri),title:r.title})))}$unregisterChatDebugLogProvider(e){this._providerDisposables.get(e)?.dispose(),this._providerDisposables.delete(e),this._activeSessionResources.delete(e)}$acceptChatDebugEvent(e,t){let o=(t.sessionResource?A.revive(t.sessionResource):void 0)??this._activeSessionResources.get(e)??this._chatDebugService.activeSessionResource;if(!o)return;let n=this._reviveEvent(t,o);this._chatDebugService.addProviderEvent(n)}_serializeEvent(e){let t={id:e.id,sessionResource:e.sessionResource,created:e.created.getTime(),parentEventId:e.parentEventId};switch(e.kind){case"toolCall":return{...t,kind:"toolCall",toolName:e.toolName,toolCallId:e.toolCallId,input:e.input,output:e.output,result:e.result,durationInMillis:e.durationInMillis};case"modelTurn":return{...t,kind:"modelTurn",model:e.model,requestName:e.requestName,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cachedTokens:e.cachedTokens,totalTokens:e.totalTokens,copilotUsageNanoAiu:e.copilotUsageNanoAiu,durationInMillis:e.durationInMillis};case"generic":return{...t,kind:"generic",name:e.name,details:e.details,level:e.level,category:e.category};case"subagentInvocation":return{...t,kind:"subagentInvocation",agentName:e.agentName,description:e.description,status:e.status,durationInMillis:e.durationInMillis,toolCallCount:e.toolCallCount,modelTurnCount:e.modelTurnCount};case"userMessage":return{...t,kind:"userMessage",message:e.message,sections:e.sections.map(o=>({name:o.name,content:o.content}))};case"agentResponse":return{...t,kind:"agentResponse",message:e.message,sections:e.sections.map(o=>({name:o.name,content:o.content}))}}}_reviveEvent(e,t){let o={id:e.id,sessionResource:t,created:new Date(e.created),parentEventId:e.parentEventId};switch(e.kind){case"toolCall":return{...o,kind:"toolCall",toolName:e.toolName,toolCallId:e.toolCallId,input:e.input,output:e.output,result:e.result,durationInMillis:e.durationInMillis};case"modelTurn":return{...o,kind:"modelTurn",model:e.model,requestName:e.requestName,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cachedTokens:e.cachedTokens,totalTokens:e.totalTokens,copilotUsageNanoAiu:e.copilotUsageNanoAiu,durationInMillis:e.durationInMillis};case"generic":return{...o,kind:"generic",name:e.name,details:e.details,level:e.level,category:e.category};case"subagentInvocation":return{...o,kind:"subagentInvocation",agentName:e.agentName,description:e.description,status:e.status,durationInMillis:e.durationInMillis,toolCallCount:e.toolCallCount,modelTurnCount:e.modelTurnCount};case"userMessage":return{...o,kind:"userMessage",message:e.message,sections:e.sections};case"agentResponse":return{...o,kind:"agentResponse",message:e.message,sections:e.sections}}}_reviveResolvedContent(e){switch(e.kind){case"text":return{kind:"text",value:e.value};case"message":return{kind:"message",type:e.type,message:e.message,sections:e.sections};case"toolCall":return{kind:"toolCall",toolName:e.toolName,result:e.result,durationInMillis:e.durationInMillis,input:e.input,output:e.output};case"modelTurn":return{kind:"modelTurn",requestName:e.requestName,model:e.model,status:e.status,durationInMillis:e.durationInMillis,timeToFirstTokenInMillis:e.timeToFirstTokenInMillis,requestId:e.requestId,maxInputTokens:e.maxInputTokens,maxOutputTokens:e.maxOutputTokens,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cachedTokens:e.cachedTokens,totalTokens:e.totalTokens,requestOptions:e.requestOptions,errorMessage:e.errorMessage,sections:e.sections};case"hook":return{kind:"hook",hookType:e.hookType,command:e.command,result:e.result==="success"?0:e.result==="error"?1:e.result==="nonBlockingError"?2:void 0,durationInMillis:e.durationInMillis,input:e.input,output:e.output,exitCode:e.exitCode,errorMessage:e.errorMessage}}}};sWt=I([fo(Xi.MainThreadChatDebug),m(1,ph),m(2,si)],sWt);var bet=le("chatStatusItemService"),Rxi=class{constructor(){this._entries=new Map;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}setOrUpdateEntry(i){let e=this._entries.has(i.id);this._entries.set(i.id,i),e&&this._onDidChange.fire({entry:i})}deleteEntry(i){this._entries.delete(i)}getEntries(){return this._entries.values()}};Ce(bet,Rxi,1);var aWt=class extends k{constructor(e,t){super();this._chatStatusItemService=t}$setEntry(e,t){this._chatStatusItemService.setOrUpdateEntry({id:e,label:t.title,description:t.description,detail:t.detail,tooltip:t.tooltip})}$disposeEntry(e){this._chatStatusItemService.deleteEntry(e)}};aWt=I([fo(Xi.MainThreadChatStatus),m(1,bet)],aWt);var w8=le("chatInputNotificationService"),Lxi=class extends k{constructor(){super(...arguments);this._notifications=new Map;this._dismissed=new Set;this._insertionOrder=new Map;this._insertionCounter=0;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event}setNotification(e){this._notifications.set(e.id,e),this._dismissed.delete(e.id),this._insertionOrder.set(e.id,this._insertionCounter++),this._fireDidChange()}deleteNotification(e){this._notifications.delete(e)&&(this._dismissed.delete(e),this._insertionOrder.delete(e),this._fireDidChange())}dismissNotification(e){this._notifications.has(e)&&!this._dismissed.has(e)&&(this._dismissed.add(e),this._fireDidChange())}getActiveNotification(){let e,t=-1;for(let o of this._notifications.values()){if(this._dismissed.has(o.id))continue;let n=this._insertionOrder.get(o.id)??0;(!e||o.severity>e.severity||o.severity===e.severity&&n>t)&&(e=o,t=n)}return e}handleMessageSent(){let e=!1;for(let t of this._notifications.values())t.autoDismissOnMessage&&!this._dismissed.has(t.id)&&(this._dismissed.add(t.id),e=!0);e&&this._fireDidChange()}_fireDidChange(){this._announceActiveIfChanged(),this._onDidChange.fire()}_announceActiveIfChanged(){let e=this.getActiveNotification();if(!e){this._lastAnnouncedSignature=void 0;return}let t=typeof e.message=="string"?e.message:e.message.value,o=`${e.id}\0${t}\0${e.description??""}`;if(o===this._lastAnnouncedSignature)return;this._lastAnnouncedSignature=o;let n=ma(e.message),r=e.description?`${n}. ${e.description}`:n;Er(r)}};Ce(w8,Lxi,1);var lWt=class extends k{constructor(e,t){super();this._chatInputNotificationService=t}$setNotification(e){this._chatInputNotificationService.setNotification({id:e.id,severity:e.severity,message:e.message,description:e.description,actions:e.actions,dismissible:e.dismissible,autoDismissOnMessage:e.autoDismissOnMessage})}$disposeNotification(e){this._chatInputNotificationService.deleteNotification(e)}};lWt=I([fo(Xi.MainThreadChatInputNotification),m(1,w8)],lWt);function nhe(a){return a?a instanceof Array?a.length>0:a.files>0||a.insertions>0||a.deletions>0:!1}function KLe(a){if(!a)return;if(!(a instanceof Array))return a;let i=0,e=0;for(let t of a)i+=t.insertions,e+=t.deletions;return{files:a.length,insertions:i,deletions:e}}function GLe(a){return a.providerType===zo.Local}function _G(a){let i=a;return A.isUri(i?.resource)&&typeof i.isArchived=="function"&&typeof i.setArchived=="function"&&typeof i.isPinned=="function"&&typeof i.setPinned=="function"&&typeof i.isRead=="function"&&typeof i.isMarkedUnread=="function"&&typeof i.setRead=="function"}function cWt(a){let i=a;return Array.isArray(i?.sessions)&&typeof i?.getSession=="function"}function oI(a){let i=a;return typeof i.section=="string"&&Array.isArray(i.sessions)}function hW(a){return a?.showMore===!0}function gW(a){return a?.showLess===!0}function dWt(a){if(typeof a=="object"&&a!==null){let i=a;return i.$mid===25&&typeof i.session=="object"&&i.session!==null}return!1}var Mxi="agentSessionsOutput",QZo=d(6830,null);function YZo(a){switch(a){case 0:return"Failed";case 1:return"Completed";case 2:return"InProgress";case 3:return"NeedsInput";default:return`Unknown(${a})`}}var Iet=class extends k{constructor(e,t,o,n){super();this.getSessionsData=e;this.logService=t;this.outputService=o;this.chatEntitlementService=n;this.isChannelRegistered=!1;this.updateChannelRegistration(),this.registerListeners()}updateChannelRegistration(){let e=this.chatEntitlementService.sentiment.hidden;e&&this.isChannelRegistered?(oe.as(bb.OutputChannels).removeChannel(Mxi),this.isChannelRegistered=!1):!e&&!this.isChannelRegistered&&(oe.as(bb.OutputChannels).registerChannel({id:Mxi,label:QZo,log:!1}),this.isChannelRegistered=!0)}registerListeners(){this._register(this.logService.onDidChangeLogLevel(e=>{e===1&&this.logAllStatsIfTrace("Log level changed to trace")})),this._register(this.chatEntitlementService.onDidChangeSentiment(()=>{this.updateChannelRegistration()}))}logIfTrace(e){this.logService.getLevel()===1&&this.trace(`[Agent Sessions] ${e}`)}logAllStatsIfTrace(e){this.logService.getLevel()===1&&(this.logAllSessions(e),this.logSessionStates())}logAllSessions(e){let{sessions:t,sessionStates:o}=this.getSessionsData(),n=[];n.push(`=== Agent Sessions (${e}) ===`);let r=0;for(let s of t){r++;let l=o.get(s.resource);if(n.push(`--- Session: ${s.label} ---`),n.push(`  Resource: ${s.resource.toString()}`),n.push(`  Provider Type: ${s.providerType}`),n.push(`  Provider Label: ${s.providerLabel}`),n.push(`  Status: ${YZo(s.status)}`),n.push(`  Icon: ${s.icon.id}`),s.description&&n.push(`  Description: ${typeof s.description=="string"?s.description:s.description.value}`),s.badge&&n.push(`  Badge: ${typeof s.badge=="string"?s.badge:s.badge.value}`),s.tooltip&&n.push(`  Tooltip: ${typeof s.tooltip=="string"?s.tooltip:s.tooltip.value}`),n.push("  Timing:"),n.push(`    Created: ${s.timing.created?new Date(s.timing.created).toISOString():"N/A"}`),n.push(`    Last Request Started: ${s.timing.lastRequestStarted?new Date(s.timing.lastRequestStarted).toISOString():"N/A"}`),n.push(`    Last Request Ended: ${s.timing.lastRequestEnded?new Date(s.timing.lastRequestEnded).toISOString():"N/A"}`),s.changes){let c=KLe(s.changes);c&&n.push(`  Changes: ${c.files} files, +${c.insertions} -${c.deletions}`)}if(s.metadata&&Object.keys(s.metadata).length>0){n.push("  Metadata:");for(let[c,u]of Object.entries(s.metadata)){let p=typeof u=="string"?u:gF(u);n.push(`    ${c}: ${p}`)}}n.push("  State:"),n.push(`    Archived (provider): ${s.archived??"N/A"}`),n.push(`    Archived (computed): ${s.isArchived()}`),n.push(`    Archived (stored): ${l?.archived??"N/A"}`),n.push(`    Pinned: ${s.isPinned()}`),n.push(`    Pinned (stored): ${l?.pinned??"N/A"}`),n.push(`    Read: ${s.isRead()}`),n.push(`    Read date (stored): ${l?.read?new Date(l.read).toISOString():"N/A"}`),n.push("")}n.unshift(`Total sessions: ${r}`,""),n.push("=== End Agent Sessions ==="),this.trace(n.join(`
`))}logSessionStates(){let{sessionStates:e}=this.getSessionsData(),t=[];t.push("=== Session States ==="),t.push(`Total stored states: ${e.size}`),t.push("");for(let[o,n]of e)t.push(`URI: ${o.toString()}`),t.push(`  Archived: ${n.archived}`),t.push(`  Pinned: ${n.pinned}`),t.push(`  Read: ${n.read?new Date(n.read).toISOString():"0 (unread)"}`),t.push("");t.push("=== End Session States ==="),this.trace(t.join(`
`))}trace(e){let t=this.outputService.getChannel(Mxi);t&&t.append(`${e}
`)}};Iet=I([m(1,re),m(2,Tl),m(3,dr)],Iet);var MN=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.chatSessionsService=e;this.lifecycleService=t;this.instantiationService=o;this.storageService=n;this.productService=r;this.chatWidgetService=s;this.workspaceContextService=l;this.workspaceTrustManagementService=c;this.chatEntitlementService=u;this._onWillResolve=this._register(new T);this.onWillResolve=this._onWillResolve.event;this._onDidResolve=this._register(new T);this.onDidResolve=this._onDidResolve.event;this._onDidChangeSessions=this._register(new T);this.onDidChangeSessions=this._onDidChangeSessions.event;this._onDidChangeSessionArchivedState=this._register(new T);this.onDidChangeSessionArchivedState=this._onDidChangeSessionArchivedState.event;this._resolved=!1;this.resolvers=this._register(new Ot);this._sessionObservables=new dt;this._resolvedResources=new xn;this._sessions=new dt,this.cache=this.instantiationService.createInstance(TG);for(let p of this.cache.loadCachedSessions()){let h=this.toAgentSession(p);this._sessions.set(h.resource,h)}this.sessionStates=this.cache.loadSessionStates(),this.logger=this._register(this.instantiationService.createInstance(Iet,()=>({sessions:this._sessions.values(),sessionStates:this.sessionStates}))),this.logger.logAllStatsIfTrace("Loaded cached sessions"),this.readDateBaseline=this.resolveReadDateBaseline(),this.registerListeners()}get resolved(){return this._resolved}get sessions(){return Array.from(this._sessions.values())}registerListeners(){this._register(this.chatSessionsService.onDidChangeItemsProviders(({chatSessionType:e})=>this.resolve(e))),this._register(this.chatSessionsService.onDidChangeAvailability(()=>this.resolve(void 0))),this._register(this.chatSessionsService.onDidChangeSessionItems(e=>{let t=new Set;for(let o of e.addedOrUpdated??[])t.add(yn(o.resource));for(let o of e.removed??[])t.add(yn(o));for(let o of t)this.resolveProvider(o,{refreshProvider:!1})})),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(()=>this.resolve(void 0))),this._register(this.workspaceTrustManagementService.onDidChangeTrust(()=>this.resolve(void 0))),this._register(this.storageService.onWillSaveState(()=>{this.cache.saveCachedSessions(Array.from(this._sessions.values())),this.cache.saveSessionStates(this.sessionStates)}))}getSession(e){return this._sessions.get(e)}observeSession(e){if(!this._resolvedResources.has(e)){this._resolvedResources.add(e);let o=yn(e);this.chatSessionsService.resolveChatSessionItem(o,e,Ie.None).catch(n=>this.logger.logIfTrace(`observeSession: resolve failed for ${e.toString()}: ${n instanceof Error?n.message:String(n)}`))}let t=this._sessionObservables.get(e);if(!t){this._changedSignal??=qr("agentSessionsChanged",this.onDidChangeSessions);let o=this._changedSignal;t=ke(n=>(o.read(n),this._sessions.get(e))),this._sessionObservables.set(e,t)}return t}async resolve(e){let t=Array.isArray(e)?e:e!==void 0?[e]:this.chatSessionsService.getRegisteredChatSessionItemProviders();await Promise.all(t.map(o=>this.resolveProvider(o,{refreshProvider:!0})))}resolveProvider(e,t){if(this.chatEntitlementService.sentiment.hidden)return Promise.resolve();let o=this.resolvers.get(e);return o||(o=new Aa(500),this.resolvers.set(e,o)),o.trigger(async n=>{if(!(n.isCancellationRequested||this.lifecycleService.willShutdown))try{return this._onWillResolve.fire(e),await this.doResolveProvider(e,t,n)}catch(r){this.logger.logIfTrace(`Error resolving sessions for provider ${e}: ${r instanceof Error?r.stack:String(r)}`)}finally{this._onDidResolve.fire(e)}})}async doResolveProvider(e,t,o){if(t.refreshProvider){await this.chatSessionsService.refreshChatSessionItems([e],o);for(let s of[...this._resolvedResources])yn(s)===e&&(this._resolvedResources.delete(s),this._sessionObservables.has(s)&&this.observeSession(s))}let n=new Map;for(let s of this.chatSessionsService.getAllChatSessionContributions())n.set(s.type,s);let r=new dt;for await(let{chatSessionType:s,items:l}of this.chatSessionsService.getChatSessionItems([e],o)){if(o.isCancellationRequested)return;for(let c of l){let u,p,h=Kg(s);h!==void 0?(p=sb(h),u=n_(h)):(p=n.get(s)?.name??s,u=c.iconPath??L.terminal);let g=c.changes,f=g&&!(g instanceof Array)?{files:g.files,insertions:g.insertions,deletions:g.deletions}:g;r.set(c.resource,this.toAgentSession({providerType:s,providerLabel:p,resource:c.resource,label:c.label.split(`
`)[0],description:c.description,icon:u,badge:c.badge,tooltip:c.tooltip,status:c.status??1,archived:c.archived,timing:c.timing,changes:f,metadata:c.metadata}))}}for(let[,s]of this._sessions)s.providerType!==e&&!r.has(s.resource)&&(uao(s.providerType)||n.has(s.providerType))&&r.set(s.resource,s);this._sessions=r,this._resolved=!0,this.logger.logAllStatsIfTrace("Sessions resolved from providers"),this._onDidChangeSessions.fire()}toAgentSession(e){return{...e,isArchived:()=>this.isArchived(e),setArchived:t=>this.setArchived(e,t),isPinned:()=>this.isPinned(e),setPinned:t=>this.setPinned(e,t),isRead:()=>this.isRead(e),isMarkedUnread:()=>this.isMarkedUnread(e),setRead:t=>this.setRead(e,t)}}static{this.UNREAD_MARKER=-1}isArchived(e){return this.sessionStates.get(e.resource)?.archived??!!e.archived}setArchived(e,t){if(t&&this.setRead(e,!0),t===this.isArchived(e))return;let o=this.sessionStates.get(e.resource)??{};this.sessionStates.set(e.resource,{...o,archived:t});let n=this._sessions.get(e.resource);n&&this._onDidChangeSessionArchivedState.fire(n),this._onDidChangeSessions.fire()}isPinned(e){return this.sessionStates.get(e.resource)?.pinned??!1}setPinned(e,t){if(t===this.isPinned(e))return;let o=this.sessionStates.get(e.resource)??{};this.sessionStates.set(e.resource,{...o,pinned:t}),this._onDidChangeSessions.fire()}isMarkedUnread(e){return this.sessionStates.get(e.resource)?.read===MN.UNREAD_MARKER}isRead(e){if(this.isArchived(e))return!0;let t=this.sessionStates.get(e.resource)?.read;return t===MN.UNREAD_MARKER?!1:Math.max(t??0,this.readDateBaseline)>=this.sessionTimeForReadStateTracking(e)-2e3?!0:!!this.chatWidgetService.getWidgetBySessionResource(e.resource)}sessionTimeForReadStateTracking(e){return e.timing.lastRequestEnded??e.timing.created}setRead(e,t,o){let n=this.sessionStates.get(e.resource)??{},r;if(t){if(r=Math.max(Date.now(),this.sessionTimeForReadStateTracking(e)),typeof n.read=="number"&&n.read>=r)return}else if(r=MN.UNREAD_MARKER,n.read===MN.UNREAD_MARKER)return;this.sessionStates.set(e.resource,{...n,read:r}),o||this._onDidChangeSessions.fire()}static{this.READ_DATE_BASELINE_KEY="agentSessions.readDateBaseline2"}resolveReadDateBaseline(){let e=this.storageService.getNumber(MN.READ_DATE_BASELINE_KEY,1,0);return e>0||(e=this.productService.quality==="stable"?Date.now()-10080*60*1e3:Date.now(),this.storageService.store(MN.READ_DATE_BASELINE_KEY,e,1,1)),e}};MN=I([m(0,Ms),m(1,to),m(2,F),m(3,de),m(4,Ze),m(5,Lt),m(6,Ae),m(7,Or),m(8,dr)],MN);var TG=class{constructor(i){this.storageService=i}static{this.SESSIONS_STORAGE_KEY="agentSessions.model.cache"}static{this.STATE_STORAGE_KEY="agentSessions.state.cache"}saveCachedSessions(i){let e=i.map(t=>({providerType:t.providerType,providerLabel:t.providerLabel,resource:t.resource.toString(),icon:t.icon.id,label:t.label,description:t.description,badge:t.badge,tooltip:t.tooltip,status:Rx(t.status)?1:t.status,archived:t.archived,timing:t.timing,changes:t.changes,metadata:t.metadata}));this.storageService.store(TG.SESSIONS_STORAGE_KEY,gF(e),1,1)}loadCachedSessions(){let i=this.storageService.get(TG.SESSIONS_STORAGE_KEY,1);if(!i)return[];try{return JSON.parse(i).map(t=>({providerType:t.providerType,providerLabel:t.providerLabel,resource:typeof t.resource=="string"?A.parse(t.resource):A.revive(t.resource),icon:q.fromId(t.icon),label:t.label,description:t.description,badge:t.badge,tooltip:t.tooltip,status:t.status,archived:t.archived,timing:{created:t.timing.created??0,lastRequestStarted:t.timing.lastRequestStarted,lastRequestEnded:t.timing.lastRequestEnded},changes:Array.isArray(t.changes)?t.changes.map(o=>({modifiedUri:A.revive(o.modifiedUri),originalUri:o.originalUri?A.revive(o.originalUri):void 0,insertions:o.insertions,deletions:o.deletions})):t.changes,metadata:t.metadata}))}catch{return[]}}saveSessionStates(i){let e=Array.from(i.entries()).map(([t,o])=>({resource:t.toString(),archived:o.archived,pinned:o.pinned,read:o.read}));this.storageService.store(TG.STATE_STORAGE_KEY,JSON.stringify(e),1,1)}loadSessionStates(){let i=new dt,e=this.storageService.get(TG.STATE_STORAGE_KEY,1);if(!e)return i;try{let t=JSON.parse(e);for(let o of t)i.set(typeof o.resource=="string"?A.parse(o.resource):A.revive(o.resource),{archived:o.archived,pinned:o.pinned,read:o.read})}catch{}return i}};TG=I([m(0,de)],TG);var qLe=class extends k{constructor(e,t){super();this.instantiationService=e;this.chatService=t;this._onDidChangeSessionArchivedState=this._register(new T);this.onDidChangeSessionArchivedState=this._onDidChangeSessionArchivedState.event}get model(){return this._model||(this._model=this._register(this.instantiationService.createInstance(MN)),this._register(this._model.onDidChangeSessionArchivedState(e=>{e.isArchived()&&this.chatService.cancelCurrentRequestForSession(e.resource,"archive"),this._onDidChangeSessionArchivedState.fire(e)})),this._model.resolve(void 0)),this._model}getSession(e){return this.model.getSession(e)}};qLe=I([m(0,F),m(1,si)],qLe);var Vc=le("agentSessions");function uWt(a){let i=a.getRequests();if(i.length===0)return;let t=i.at(-1)?.response;if(!t||t.isComplete)return;let o=t.response.value,n="";for(let r=o.length-1;r>=0;r--){let s=o[r];if(n)break;if(s.kind==="confirmation"&&typeof s.message=="string")n=s.message;else if(s.kind==="toolInvocation"){let l=s,c=l.state.get();if(n=l.generatedTitle||l.pastTenseMessage||l.invocationMessage,c.type===pi.StateKind.WaitingForConfirmation){let u=c.confirmationMessages?.title,p=u&&(typeof u=="string"?u:u.value),h=typeof n=="string"?n:n.value;n=p??d(8115,null,h)}}else s.kind==="toolInvocationSerialized"?n=s.invocationMessage:s.kind==="progressMessage"?n=s.content:s.kind==="thinking"&&(n=d(8114,null))}return n?ma(n,{useLinkFormatter:!0}):""}var sU=class{constructor(i,e){this._scmService=i;this._activityService=e}static{this._scheme="scm-multi-diff-source"}static getMultiDiffSourceUri(i,e){return A.from({scheme:sU._scheme,query:JSON.stringify({repositoryUri:i,groupId:e})})}static parseUri(i){if(i.scheme!==sU._scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryUri:t,groupId:o}=e;if(!(typeof t!="string"||typeof o!="string"))return{repositoryUri:A.parse(t),groupId:o}}canHandleUri(i){return sU.parseUri(i)!==void 0}async resolveDiffSource(i){let{repositoryUri:e,groupId:t}=sU.parseUri(i),o=await yh(vi(this,this._scmService.onDidAddRepository,()=>[...this._scmService.repositories].find(l=>l.provider.rootUri?.toString()===e.toString()))),n=await yh(vi(this,o.provider.onDidChangeResourceGroups,()=>o.provider.groups.find(l=>l.id===t))),s=vi(this._activityService.onDidChangeActivity,()=>[...this._activityService.getViewContainerActivities("workbench.view.scm")]).map(l=>!l.some(c=>c.badge instanceof Jx));return await yh(s,l=>l),new Pxi(n,o)}};sU=I([m(0,lc),m(1,Al)],sU);var Zx=class{constructor(i){this._scmService=i}static{this.scheme="scm-history-item"}static getMultiDiffSourceUri(i,e,t,o){return A.from({scheme:Zx.scheme,path:i.rootUri?.fsPath,query:JSON.stringify({repositoryId:i.id,historyItemId:e,historyItemParentId:t,historyItemDisplayId:o})},!0)}static parseUri(i){if(i.scheme!==Zx.scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryId:t,historyItemId:o,historyItemParentId:n,historyItemDisplayId:r}=e;if(!(typeof t!="string"||typeof o!="string"||typeof n!="string"&&n!==void 0||typeof r!="string"&&r!==void 0))return{repositoryId:t,historyItemId:o,historyItemParentId:n,historyItemDisplayId:r}}canHandleUri(i){return Zx.parseUri(i)!==void 0}async resolveDiffSource(i){let{repositoryId:e,historyItemId:t,historyItemParentId:o,historyItemDisplayId:n}=Zx.parseUri(i),l=await this._scmService.getRepository(e)?.provider.historyProvider.get()?.provideHistoryItemChanges(t,o)??[];return{resources:ewe.const(l.map(u=>{let p=u.modifiedUri?`${Jo(u.modifiedUri.fsPath)} (${n??t})`:void 0;return new wE(u.originalUri,u.modifiedUri,u.modifiedUri,p)}))}}};Zx=I([m(0,lc)],Zx);var Pxi=class{constructor(i,e){this._group=i;this._repository=e;this._resources=vi(this._group.onDidChangeResources,()=>this._group.resources.map(t=>new wE(t.multiDiffEditorOriginalUri,t.multiDiffEditorModifiedUri,t.sourceUri))),this.resources=new cF(this._resources),this.contextKeys={scmResourceGroup:this._group.id,scmProvider:this._repository.provider.providerId}}},rhe=class extends k{static{this.ID="workbench.contrib.scmMultiDiffSourceResolver"}constructor(i,e){super(),this._register(e.registerResolver(i.createInstance(Zx))),this._register(e.registerResolver(i.createInstance(sU)))}};rhe=I([m(0,F),m(1,rG)],rhe);var $Le=class a extends z{static async openMultiFileDiffEditor(i,e,t,o,n){if(!t)return;let r=sU.getMultiDiffSourceUri(t.toString(),o);return await i.openEditor({label:e,multiDiffSource:r,options:n})}constructor(){super({id:"_workbench.openScmMultiDiffEditor",title:P(13449,"Open Changes"),f1:!1})}async run(i,e){let t=i.get(ie);await a.openMultiFileDiffEditor(t,e.title,A.revive(e.repositoryUri),e.resourceGroupId)}};function Pmo(a){if(!a.dataTransfer?.types.includes(Mc.SCM_HISTORY_ITEM))return;let i=a.dataTransfer?.getData(Mc.SCM_HISTORY_ITEM);if(i)return JSON.parse(i)}var she=class extends k{static{this.ID="workbench.contrib.chat.scmHistoryItemContextContribution"}constructor(i,e,t){super(),this._store.add(i.registerChatContextItem(e.createInstance(C8))),this._store.add(t.registerTextModelContentProvider(Zx.scheme,e.createInstance(yet))),this._store.add(t.registerTextModelContentProvider(DG.scheme,e.createInstance(DG)))}};she=I([m(0,iI),m(1,F),m(2,Bt)],she);var C8=class{constructor(i){this._scmViewService=i;this.type="pickerPick";this.label=d(14935,null);this.icon=L.gitCommit;this._delayer=new Aa(200)}static asAttachment(i,e){let t=e.parentIds.length>0?e.parentIds[0]:void 0,o=Zx.getMultiDiffSourceUri(i,e.id,t,e.displayId),n=`$(${L.repo.id})\xA0${i.name}\xA0$(${L.gitCommit.id})\xA0${e.displayId??e.id}`;return{id:e.id,name:n,value:o,historyItem:{...e,references:[]},kind:"scmHistoryItem"}}isEnabled(i){let e=this._scmViewService.activeRepository.get(),t=!!i.attachmentCapabilities.supportsSourceControlAttachments;return e?.repository.provider.historyProvider.get()!==void 0&&t}asPicker(i){return{placeholder:d(14936,null),picks:ohe((e,t)=>{let o=e.trim()!==""?e.trim():void 0,n=this._scmViewService.activeRepository.get(),r=n?.repository.provider.historyProvider.get();if(!n||!r)return Promise.resolve([]);let s=ui([r.historyItemRef.get(),r.historyItemRemoteRef.get(),r.historyItemBaseRef.get()]).map(l=>l.id);return this._delayer.trigger(()=>r.provideHistoryItems({historyItemRefs:s,filterText:o,limit:100},t).then(l=>l?l.map(c=>{let u=[`${c.displayId??c.id}`];return c.author&&u.push(c.author),c.statistics&&u.push(`${c.statistics.files} ${d(14937,null)}`),c.timestamp&&u.push(ea(c.timestamp,!0,!0)),{iconClass:q.asClassName(L.gitCommit),label:c.subject,detail:u.join(`$(${L.circleSmallFilled.id})`),asAttachment:()=>C8.asAttachment(n.repository.provider,c)}}):[]))})}}};C8=I([m(0,Au)],C8);var yet=class{constructor(i,e){this._modelService=i;this._scmService=e}async provideTextContent(i){let e=Zx.parseUri(i);if(!e)return null;let t=this._modelService.getModel(i);if(t)return t;let{repositoryId:o,historyItemId:n}=e,r=this._scmService.getRepository(o),s=r?.provider.historyProvider.get();if(!r||!s)return null;let l=await s.resolveHistoryItemChatContext(n);return l?this._modelService.createModel(l,null,i,!1):null}};yet=I([m(0,_t),m(1,lc)],yet);var DG=class{constructor(i,e){this._modelService=i;this._scmService=e}static{this.scheme="scm-history-item-change-range"}async provideTextContent(i){let e=this._parseUri(i);if(!e)return null;let t=this._modelService.getModel(i);if(t)return t;let{repositoryId:o,start:n,end:r}=e,s=this._scmService.getRepository(o),l=s?.provider.historyProvider.get();if(!s||!l)return null;let c=await l.resolveHistoryItemChangeRangeChatContext(r,n,i.path);return c?this._modelService.createModel(c,null,i,!1):null}_parseUri(i){if(i.scheme!==DG.scheme)return;let e;try{e=JSON.parse(i.query)}catch{return}if(typeof e!="object"||e===null)return;let{repositoryId:t,start:o,end:n}=e;if(!(typeof t!="string"||typeof o!="string"||typeof n!="string"))return{repositoryId:t,start:o,end:n}}};DG=I([m(0,_t),m(1,lc)],DG);W(class extends z{constructor(){super({id:"workbench.scm.action.graph.addHistoryItemToChat",title:d(14933,null),f1:!1,menu:{id:R.SCMHistoryItemContext,group:"z_chat",order:1,when:Z.enabled}})}async run(a,i,e){let o=await a.get(Lt).revealWidget();!i||!e||!o||o.attachmentModel.addContext(C8.asAttachment(i,e))}});W(class extends z{constructor(){super({id:"workbench.scm.action.graph.summarizeHistoryItem",title:d(14934,null),f1:!1,menu:{id:R.SCMHistoryItemContext,group:"z_chat",order:2,when:Z.enabled}})}async run(a,i,e){let o=await a.get(Lt).revealWidget();!i||!e||!o||(o.attachmentModel.addContext(C8.asAttachment(i,e)),await o.acceptInput("Summarize the attached history item"))}});W(class extends z{constructor(){super({id:"workbench.scm.action.graph.addHistoryItemChangeToChat",title:d(14933,null),f1:!1,menu:{id:R.SCMHistoryItemChangeContext,group:"z_chat",order:1,when:Z.enabled}})}async run(a,i,e){let o=await a.get(Lt).revealWidget();!i||!e.modifiedUri||!o||o.attachmentModel.addContext({id:e.uri.toString(),name:`${Be(e.modifiedUri)}`,value:e.modifiedUri,historyItem:i,kind:"scmHistoryItemChange"})}});var kE=le("chatModeService"),ahe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.sessionResource=e;this.promptsService=t;this.chatAgentService=o;this.logService=r;this.storageService=s;this.configurationService=l;this.customizationHarnessService=c;this._customModeInstances=new Map;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._pendingRefresh=Promise.resolve();let u=yn(e);this._storageKey=ahe.CUSTOM_MODES_STORAGE_KEY_PREFIX+u,this.hasCustomModes=Z.Modes.hasCustomChatModes.bindTo(n),this.loadCachedModes(),this._pendingRefresh=this.refreshCustomPromptModes(!0),this._register(this.promptsService.onDidChangeCustomAgents(()=>{this._pendingRefresh=this.refreshCustomPromptModes(!0)})),this._register(this.customizationHarnessService.onDidChangeCustomAgents(h=>{h.sessionType===u&&this.useChatSessionCustomizationsForCustomAgents()&&(this._pendingRefresh=this.refreshCustomPromptModes(!0))})),this._register(this.storageService.onWillSaveState(()=>this.saveCachedModes())),this._register(this.configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration("chat.agent.enabled")&&this._onDidChange.fire(),h.affectsConfiguration("chat.customizations.useChatSessionCustomizationsForCustomAgents")&&(this._pendingRefresh=this.refreshCustomPromptModes(!0))}));let p=this.chatAgentService.hasToolsAgent;this._register(this.chatAgentService.onDidChangeAgents(()=>{p!==this.chatAgentService.hasToolsAgent&&(p=this.chatAgentService.hasToolsAgent,this._onDidChange.fire())}))}static{this.CUSTOM_MODES_STORAGE_KEY_PREFIX="chat.customModes."}get builtin(){return this.getBuiltinModes()}get custom(){return this.getCustomModes()}findModeById(e){return this.getBuiltinModes().find(t=>t.id===e)??this._customModeInstances.get(e)}findModeByName(e){return this.getBuiltinModes().find(t=>t.name.get()===e)??this.getCustomModes().find(t=>t.name.get()===e)}waitForRefresh(){return this._pendingRefresh}loadCachedModes(){try{let e=this.storageService.getObject(this._storageKey,1);e&&this.deserializeCachedModes(e)}catch(e){this.logService.error(e,"Failed to load cached custom agents")}}deserializeCachedModes(e){if(!Array.isArray(e)){this.logService.error("Invalid cached custom modes data: expected array");return}for(let t of e)if(XZo(t)&&t.uri)try{let o=t.visibility??{userInvocable:!0,agentInvocable:t.infer!==!1};if(!o.userInvocable)continue;let n=A.revive(t.uri),r={uri:n,name:t.name,description:t.description,tools:t.customTools,model:We(t.model)?[t.model]:t.model,argumentHint:t.argumentHint,agentInstructions:t.modeInstructions??{content:t.body??"",toolReferences:[]},handOffs:t.handOffs,target:t.target??"undefined",visibility:o,agents:t.agents,sessionTypes:t.sessionTypes,source:een(t.source)??{storage:"local"},enabled:!0},s=new pWt(r);this._customModeInstances.set(n.toString(),s)}catch(o){this.logService.error(o,"Failed to revive cached custom agent")}this.hasCustomModes.set(this._customModeInstances.size>0)}saveCachedModes(){try{let e=Array.from(this._customModeInstances.values());this.storageService.store(this._storageKey,e,1,1)}catch(e){this.logService.warn("Failed to save cached custom agents",e)}}useChatSessionCustomizationsForCustomAgents(){return this.configurationService.getValue("chat.customizations.useChatSessionCustomizationsForCustomAgents")===!0}async computeCustomAgents(){if(this.useChatSessionCustomizationsForCustomAgents())return await this.customizationHarnessService.getCustomAgents(yn(this.sessionResource),Ie.None);let t=yn(this.sessionResource);return(await this.promptsService.getCustomAgents(Ie.None)).filter(o=>lb(o.sessionTypes,t))}async refreshCustomPromptModes(e){try{let t=await this.computeCustomAgents(),o=new Set;for(let n of t){if(!n.visibility.userInvocable||!n.enabled)continue;let r=n.uri.toString();o.add(r);let s=this._customModeInstances.get(r);s?s.updateData(n):(s=new pWt(n),this._customModeInstances.set(r,s))}for(let[n]of this._customModeInstances.entries())o.has(n)||this._customModeInstances.delete(n);this.hasCustomModes.set(this._customModeInstances.size>0)}catch(t){this.logService.error(t,"Failed to load custom agents"),this._customModeInstances.clear(),this.hasCustomModes.set(!1)}e&&this._onDidChange.fire()}getBuiltinModes(){let e=[Bc.Ask];return(this.chatAgentService.hasToolsAgent||this.isAgentModeDisabledByPolicy())&&e.unshift(Bc.Agent),e.push(Bc.Edit),e}getCustomModes(){return this.chatAgentService.hasToolsAgent||this.isAgentModeDisabledByPolicy()?Array.from(this._customModeInstances.values()):[]}isAgentModeDisabledByPolicy(){return this.configurationService.inspect("chat.agent.enabled").policyValue===!1}};ahe=I([m(1,jr),m(2,gr),m(3,X),m(4,re),m(5,de),m(6,B),m(7,dh)],ahe);var jLe=class extends k{constructor(e,t,o){super();this.instantiationService=e;this.configurationService=o;this.agentModeDisabledByPolicy=Z.Modes.agentModeDisabledByPolicy.bindTo(t),this.updateAgentModePolicyContextKey(),this._register(this.configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("chat.agent.enabled")&&this.updateAgentModePolicyContextKey()}))}createModes(e){return this.instantiationService.createInstance(ahe,e)}async getLocalModes(){return this.localMode||(this.localMode=(async()=>{let e=this._register(this.createModes(Br.getNewSessionUri()));return await e.waitForRefresh(),e})()),this.localMode}updateAgentModePolicyContextKey(){this.agentModeDisabledByPolicy.set(this.isAgentModeDisabledByPolicy())}isAgentModeDisabledByPolicy(){return this.configurationService.inspect("chat.agent.enabled").policyValue===!1}};jLe=I([m(0,F),m(1,X),m(2,B)],jLe);function XZo(a){if(typeof a!="object"||a===null)return!1;let i=a;return typeof i.id=="string"&&typeof i.name=="string"&&typeof i.kind=="string"&&(i.description===void 0||typeof i.description=="string")&&(i.customTools===void 0||Array.isArray(i.customTools))&&(i.modeInstructions===void 0||typeof i.modeInstructions=="object"&&i.modeInstructions!==null)&&(i.model===void 0||typeof i.model=="string"||Array.isArray(i.model))&&(i.argumentHint===void 0||typeof i.argumentHint=="string")&&(i.handOffs===void 0||Array.isArray(i.handOffs))&&(i.uri===void 0||typeof i.uri=="object"&&i.uri!==null)&&(i.source===void 0||JZo(i.source))&&(i.target===void 0||JPt(i.target))&&(i.visibility===void 0||vao(i.visibility))&&(i.agents===void 0||Array.isArray(i.agents))&&(i.sessionTypes===void 0||Array.isArray(i.sessionTypes))}var pWt=class{constructor(i){this.kind="agent";this.id=i.uri.toString(),this._nameObservable=De("name",i.name),this._descriptionObservable=De("description",i.description),this._customToolsObservable=De("customTools",i.tools),this._modelObservable=De("model",i.model),this._argumentHintObservable=De("argumentHint",i.argumentHint),this._handoffsObservable=De("handOffs",i.handOffs),this._targetObservable=De("target",i.target),this._visibilityObservable=De("visibility",i.visibility),this._agentsObservable=De("agents",i.agents),this._modeInstructions=De("_modeInstructions",i.agentInstructions),this._uriObservable=De("uri",i.uri),this._source=i.source,this._sessionTypes=i.sessionTypes}get name(){return this._nameObservable}get description(){return this._descriptionObservable}get icon(){return Fo(void 0)}get isBuiltin(){return mWt(this)}get customTools(){return this._customToolsObservable}get model(){return this._modelObservable}get argumentHint(){return this._argumentHintObservable}get modeInstructions(){return this._modeInstructions}get uri(){return this._uriObservable}get label(){return this.name}get handOffs(){return this._handoffsObservable}get source(){return this._source}get target(){return this._targetObservable}get visibility(){return this._visibilityObservable}get agents(){return this._agentsObservable}get sessionTypes(){return this._sessionTypes}updateData(i){Ki(e=>{this._nameObservable.set(i.name,e),this._descriptionObservable.set(i.description,e),this._customToolsObservable.set(i.tools,e),this._modelObservable.set(i.model,e),this._argumentHintObservable.set(i.argumentHint,e),this._handoffsObservable.set(i.handOffs,e),this._targetObservable.set(i.target,e),this._visibilityObservable.set(i.visibility,e),this._agentsObservable.set(i.agents,e),this._modeInstructions.set(i.agentInstructions,e),this._uriObservable.set(i.uri,e),this._source=i.source,this._sessionTypes=i.sessionTypes})}toJSON(){return{id:this.id,name:this.name.get(),description:this.description.get(),kind:this.kind,customTools:this.customTools.get(),model:this.model.get(),argumentHint:this.argumentHint.get(),modeInstructions:this.modeInstructions.get(),uri:this.uri.get(),handOffs:this.handOffs.get(),source:ZZo(this._source),target:this.target.get(),visibility:this.visibility.get(),agents:this.agents.get(),sessionTypes:this.sessionTypes}}};function JZo(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.storage==="extension"?typeof i.extensionId=="string":i.storage==="plugin"?jm(i.pluginUri):i.storage==="local"||i.storage==="user"}function ZZo(a){if(a)return a.storage==="extension"?{storage:"extension",extensionId:a.extensionId.value}:a.storage==="plugin"?{storage:"plugin",pluginUri:a.pluginUri}:{storage:a.storage}}function een(a){if(a)return a.storage==="extension"?{storage:"extension",extensionId:new hi(a.extensionId)}:a.storage==="plugin"?{storage:"plugin",pluginUri:A.revive(a.pluginUri)}:{storage:a.storage}}var wet=class{constructor(i,e,t,o){this.kind=i;this.name=Fo(i),this.label=Fo(e),this.description=De("description",t),this.icon=Fo(o),this.target=Fo("undefined")}get isBuiltin(){return mWt(this)}get id(){return this.kind}toJSON(){return{id:this.id,name:this.name.get(),description:this.description.get(),kind:this.kind}}},Bc;(t=>(t.Ask=new wet("ask","Ask",d(9331,null),L.question),t.Edit=new wet("edit","Edit",d(9332,null),L.edit),t.Agent=new wet("agent","Agent",d(9330,null),L.agent)))(Bc||={});function mWt(a){return a.id===Bc.Ask.id||a.id===Bc.Edit.id||a.id===Bc.Agent.id}function x8(a){let i=a.source?.storage;return i==="local"||i==="user"?String(Lr(a.name.get())):a.name.get()}function Axi(a){let i=a.label.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return`${a.agent}:${i}`}function Amo(a){return a.map(i=>{let e=i.handOffs?.get()??[],t=i.visibility?.get();return{id:i.id,name:i.name.get(),isBuiltin:i.isBuiltin,visibility:{userInvocable:t?.userInvocable??!0,agentInvocable:t?.agentInvocable??!0},handoffs:e.map(o=>({id:Axi(o),label:o.label,agent:o.agent,prompt:o.prompt,...o.send!==void 0?{send:o.send}:{},...o.showContinueOn!==void 0?{showContinueOn:o.showContinueOn}:{},...o.model!==void 0?{model:o.model}:{}}))}})}var ten=250,ien=500,oen=250,nen=1e3,Nxi=10,ren=2,QLe=class{constructor(i){this.logService=i;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(i){let{totalWordCount:e}=i;if(e===this._data.lastWordCount){this.trace("Update- no new words");return}let t=Date.now(),o=e-this._data.lastWordCount,n=this._data.lastWordCount===0,r=this._data.firstMarkdownTime,s=this._data.wordCountAtBootstrapExit;typeof r!="number"&&e>0&&(r=t);let l=this._data.updatesWithNewWords+1;n&&(this._data.lastUpdateTime=t);let c=o>Nxi?nen:oen,u=Math.min(t-this._data.lastUpdateTime,c),p=this._data.totalTime+u,h=n&&e>Nxi?ien:ten,g=this._data.bootstrapActive;if(g){let w=r;typeof w=="number"&&l>=ren&&e>=Nxi?(g=!1,p=Math.max(t-w,u),s=this._data.lastWordCount,this.trace("Has stable data")):p=Math.max(p,h)}let f=typeof s=="number"?Math.max(e-s,0):e,v=p,b=g?e:f,S=v>0?b/(v/1e3):0;this._data={totalTime:p,lastUpdateTime:t,impliedWordLoadRate:S,lastWordCount:e,firstMarkdownTime:r,bootstrapActive:g,wordCountAtBootstrapExit:s,updatesWithNewWords:l},this._publicData={impliedWordLoadRate:S,lastWordCount:e};let y=g?e:f;return this.trace(`Update- got ${y} words over last ${p}ms = ${S} words/s`),this._data}trace(i){this.logService.trace(`ChatStreamStatsTracker#update: ${i}`)}};QLe=I([m(0,re)],QLe);var Oxi=/(?<![a-zA-Z0-9])(?<dollars>\${1,2})(?!\.|\(["'])((?:\\.|[^\\\n])*?(?:\\.|[^\\\n\$]))\k<dollars>(?![a-zA-Z0-9])/,YLe="vscode-katex-container",Cet="data-latex",sen=new RegExp("^"+Oxi.source),hWt;(n=>{let a=/^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;function i(r,s={}){return{extensions:[t(s,e(r,s,!1)),o(s,e(r,s,!0))]}}n.extension=i;function e(r,s,l){return c=>{let u;try{let p=r.renderToString(c.text,{...s,throwOnError:!0,displayMode:c.displayMode});u=`<span class="${YLe}" ${Cet}="${Xvt(c.text)}">${p}</span>`}catch{u=c.raw}return u+(l?`
`:"")}}function t(r,s){let l=sen;return{name:"inlineKatex",level:"inline",start(c){let u,p=c;for(;p;){if(u=p.indexOf("$"),u===-1)return;if(p.substring(u).match(l))return u;p=p.substring(u+1).replace(/^\$+/,"")}},tokenizer(c,u){let p=c.match(l);if(p)return{type:"inlineKatex",raw:p[0],text:p[2].trim(),displayMode:p[1].length===2}},renderer:s}}function o(r,s){return{name:"blockKatex",level:"block",start(l){return l.match(new RegExp(a.source,"m"))?.index},tokenizer(l,c){let u=l.match(a);if(u)return{type:"blockKatex",raw:u[0],text:u[2].trim(),displayMode:u[1].length===2}},renderer:s}}})(hWt||={});var g_=String.raw,len=g_`(?<!\\)`+g_`(!?\[`+g_`(?:`+g_`[^\[\]\\]|`+g_`\\.|`+g_`\[[^\[\]]*\]`+g_`)*`+g_`\])`+g_`(\(\s*)`+g_`(`+g_`[^\s\(\)<](?:[^\s\(\)]|\([^\s\(\)]*?\))*|`+g_`<(?:\\[<>]|[^<>])+>`+g_`)`+g_`\s*(?:"[^"]*"|'[^']*'|\([^\(\)]*\))?\s*`+g_`\)`;function xet(a,i){let t=new RegExp("(?:"+len+")|(?:"+Oxi.source+g_`)|\p{sc=Han}|=+|\++|-+|[^\s\|\p{sc=Han}|=|\+|\-|${"`"}]+`,"gu"),o=Array.from(a.matchAll(t)),n=o.slice(0,i),r=i>=o.length?a.length:n.length?n.at(-1).index+n.at(-1)[0].length:0,s=a.substring(0,r);return{value:s,returnedWordCount:n.length===0?s.length?1:0:n.length,isFullString:r>=a.length,totalWordCount:o.length}}function Nmo(a){return xet(a,Number.MAX_SAFE_INTEGER).returnedWordCount}function _r(a){return!!a&&typeof a=="object"&&"message"in a}function Ni(a){return!!a&&typeof a.setVote<"u"}function ket(a){return!!a&&typeof a=="object"&&a.kind==="pendingDivider"}function EE(a){return _r(a)||Ni(a)}function Omo(a){if(!Ni(a))throw new Error("Expected item to be IChatResponseViewModel")}var ste=class extends k{constructor(e,t,o){super();this._model=e;this._options=t;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((n,r)=>{let s=this.instantiationService.createInstance(XLe,n);this._items.push(s),n.response&&this.onAddResponse(n.response)}),this._register(e.onDidDispose(()=>this._onDidDisposeModel.fire())),this._register(e.onDidChangePendingRequests(()=>this._onDidChange.fire(null))),this._register(e.onDidChange(n=>{if(n.kind==="addRequest"){let s=this.instantiationService.createInstance(XLe,n.request);this._items.push(s),n.request.response&&this.onAddResponse(n.request.response)}else if(n.kind==="addResponse")this.onAddResponse(n.response);else if(n.kind==="removeRequest"){let s=this._items.findIndex(c=>_r(c)&&c.id===n.requestId);s>=0&&this._items.splice(s,1);let l=n.responseId&&this._items.findIndex(c=>Ni(c)&&c.id===n.responseId);if(typeof l=="number"&&l>=0){let u=this._items.splice(l,1)[0];u instanceof k8&&u.dispose()}}let r=n.kind==="addRequest"?{kind:"addRequest"}:n.kind==="initialize"?{kind:"initialize"}:n.kind==="setHidden"?{kind:"setHidden"}:null;this._onDidChange.fire(r)}))}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 t=this.instantiationService.createInstance(k8,e,this);this._register(t.onDidChange(()=>this._onDidChange.fire(null))),this._items.push(t)}getItems(){let e=this._items.filter(o=>!(o.shouldBeRemovedOnSend&&!o.shouldBeRemovedOnSend.afterUndoStop));this._options?.maxVisibleItems!==void 0&&e.length>this._options.maxVisibleItems&&(e=e.slice(-this._options.maxVisibleItems));let t=this._model.getPendingRequests();if(t.length>0){let o=t.filter(r=>r.kind==="steering"),n=t.filter(r=>r.kind==="queued");if(o.length>0){let r=o.every(s=>s.request.isSystemInitiated);e.push({kind:"pendingDivider",id:"pending-divider-steering",sessionResource:this._model.sessionResource,isComplete:!0,dividerKind:"steering",isSystemInitiated:r,currentRenderedHeight:void 0});for(let s of o){let l=this.instantiationService.createInstance(XLe,s.request,s.kind);e.push(l)}}if(n.length>0){e.push({kind:"pendingDivider",id:"pending-divider-queued",sessionResource:this._model.sessionResource,isComplete:!0,dividerKind:"queued",currentRenderedHeight:void 0});for(let r of n){let s=this.instantiationService.createInstance(XLe,r.request,r.kind);e.push(s)}}}return e}get editing(){return this._editing}setEditing(e){this.editing&&e&&this.editing.id===e.id||(this._editing=e)}dispose(){super.dispose(),je(this._items.filter(e=>e instanceof k8)),this._items.length=0}};ste=I([m(2,F)],ste);var XLe=class{constructor(i,e){this._model=i;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 L.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 shouldBeRemovedOnSend(){return this._model.shouldBeRemovedOnSend}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 timestamp(){return this._model.timestamp}get pendingKind(){return this._pendingKind}get isSystemInitiated(){return this._model.isSystemInitiated}get systemInitiatedLabel(){return this._model.systemInitiatedLabel}},k8=class extends k{constructor(e,t,o,n){super();this._model=e;this.session=t;this.instantiationService=o;this.chatAgentNameService=n;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(QLe));let r=this.liveUpdateTracker?this._register(new Dt(()=>{let s=Nmo(e.entireResponse.getMarkdown());this.liveUpdateTracker.update({totalWordCount:s})},0)):void 0;this._register(e.onDidChange(()=>{r?.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:_3(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 isCompleteAddedRequest(){return this._model.isCompleteAddedRequest}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,t){this._modelChangeCount++,this._model.setEditApplied(e,t)}};k8=I([m(2,F),m(3,P2)],k8);var Eet=le("IChatWidgetHistoryService"),cen=40,JLe=class extends k{constructor(e){super();this._onDidChangeHistory=this._register(new T);this.changed=!1;this.onDidChangeHistory=this._onDidChangeHistory.event;this.memento=new $l("interactive-session",e);let t=this.memento.getMemento(1,1);this.viewState=t,this._register(e.onWillSaveState(()=>{this.changed&&(this.memento.saveMemento(),this.changed=!1)}))}getHistory(e){let t=this.getKey(e);return(this.viewState.history?.[t]??[]).map(n=>this.migrateHistoryEntry(n))}migrateHistoryEntry(e){if(e.inputText!==void 0)return e;let t=e,o=t.state??{},n,r;if(o.chatMode)if(typeof o.chatMode=="string")n=o.chatMode,r=Object.values(wc).includes(o.chatMode)?o.chatMode:void 0;else if(typeof o.chatMode=="object"&&o.chatMode!==null){let s=o.chatMode;n=s.id??"ask",r=s.id&&Object.values(wc).includes(s.id)?s.id:void 0}else n="ask",r="ask";else n="ask",r="ask";return{inputText:t.text??"",attachments:o.chatContextAttachments??[],mode:{id:n,kind:r},contrib:t.state||{},selectedModel:void 0,selections:[]}}getKey(e){return e==="panel"?Z_e:e}append(e,t){this.viewState.history??={};let o=this.getKey(e);this.viewState.history[o]=this.getHistory(e).concat(t).slice(-cen),this.changed=!0,this._onDidChangeHistory.fire({kind:"append",entry:t})}clearHistory(){this.viewState.history={},this.changed=!0,this._onDidChangeHistory.fire({kind:"clear"})}};JLe=I([m(0,de)],JLe);var ZLe=class extends k{constructor(e,t){super();this.location=e;this.chatWidgetHistoryService=t;this._overlay=[];this._history=this.chatWidgetHistoryService.getHistory(this.location),this._currentIndex=this._history.length,this._register(this.chatWidgetHistoryService.onDidChangeHistory(o=>{if(o.kind==="append"){let n=this._history.length;this._history=this.chatWidgetHistoryService.getHistory(this.location);let r=this._history.length;n===r?(this._overlay.shift(),this._currentIndex<this._history.length&&(this._currentIndex=Math.max(this._currentIndex-1,0))):this._currentIndex===n&&(this._currentIndex=r)}else o.kind==="clear"&&(this._history=[],this._currentIndex=0,this._overlay=[])}))}get values(){return this.chatWidgetHistoryService.getHistory(this.location)}isAtEnd(){return this._currentIndex===Math.max(this._history.length,this._overlay.length)}isAtStart(){return this._currentIndex===0}overlay(e){this._overlay[this._currentIndex]=e}resetCursor(){this._currentIndex=this._history.length}previous(){return this._currentIndex=Math.max(this._currentIndex-1,0),this.current()}next(){return this._currentIndex=Math.min(this._currentIndex+1,this._history.length),this.current()}current(){return this._overlay[this._currentIndex]??this._history[this._currentIndex]}append(e){this._overlay=[],this._currentIndex=this._history.length,den(this._history.at(-1),e)||this.chatWidgetHistoryService.append(this.location,e)}};ZLe=I([m(1,Eet)],ZLe);function den(a,i){return!(!a||!i||a.inputText!==i.inputText||!eo(a.attachments,i.attachments,(e,t)=>e.id===t.id))}function gWt(a){switch(a){case pn.Agents:return"agent";case pn.Skills:return"skill";case pn.Instructions:return"instructions";case pn.Hooks:return"hook";case pn.Prompts:default:return"prompt"}}var fWt="workbench.editor.aiCustomizationManagement",vWt="workbench.input.aiCustomizationManagement",eMe={OpenEditor:"aiCustomization.openManagementEditor",OpenMarketplace:"aiCustomization.openMarketplace",CreateNewAgent:"aiCustomization.createNewAgent",CreateNewSkill:"aiCustomization.createNewSkill",CreateNewInstructions:"aiCustomization.createNewInstructions",CreateNewPrompt:"aiCustomization.createNewPrompt",GenerateDebugReport:"aiCustomization.generateDebugReport"},Fmo=new Y("aiCustomizationManagementEditorFocused",!1,d(7041,null)),Wmo=new Y("chatCustomizationSection",pn.Agents,d(7042,null)),Vmo=new Y("chatCustomizationSessionType","",d(7043,null)),pcc=R.for("AICustomizationManagementEditorTitle"),ek=R.for("AICustomizationManagementEditorItem"),Bmo=R.for("AICustomizationManagementCreate"),PN="aiCustomizationManagementItemType",fW="aiCustomizationManagementItemStorage",tMe="aiCustomizationManagementItemUri",Tet="aiCustomizationManagementItemPluginUri",lte="aiCustomizationManagementItemDisabled",_et="aiCustomizationManagement.selectedSection",Fxi="aiCustomizationManagement.sidebarWidth";var bWt=200,Hmo=150,Umo=350,zmo=400;var Kmo=le("ILanguageModelStatsService"),iMe=class extends k{constructor(e,t){super();this.extensionFeaturesManagementService=e;for(let o in t.keys(-1,0))(o.startsWith("languageModelStats.")||o.startsWith("languageModelAccess."))&&t.remove(o,-1)}async update(e,t,o,n){await this.extensionFeaturesManagementService.getAccess(t,SWt)}};iMe=I([m(0,Qy),m(1,de)],iMe);var SWt="copilot";oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:SWt,label:d(9370,null),description:d(9371,null),icon:L.copilot,access:{canToggle:!1},accessDataLabel:d(9369,null)});var IR=le("ILanguageModelToolsConfirmationService");var uen="screenshot-focused-window";function IWt(a){return{id:uen,name:d(7334,null),value:a.buffer,kind:"image"}}var fi=P(6383,"Chat"),Mh="workbench.action.chat.newChat",Gmo="workbench.action.chat.newEditSession",yWt="workbench.action.openChat",tk="workbench.action.chat.open",aS="workbench.action.chat.triggerSetup",che="workbench.action.chat.triggerSetupSupportAnonymousAction",pen="workbench.action.chat.toggle",RG="workbench.action.chat.generateAgentInstructions",Det="workbench.action.chat.generateOnDemandInstructions",T8="workbench.action.chat.generatePrompt",_8="workbench.action.chat.generateSkill",D8="workbench.action.chat.generateAgent",Bxi="workbench.action.chat.generateHook",Ret="workbench.action.chat.insertForkConversationCommand",CWt="workbench.action.chat.insertTroubleshootCommand",Wxi={provider:$i.defaultChatAgent?.provider??{enterprise:{id:""}},completionsAdvancedSetting:$i.defaultChatAgent?.completionsAdvancedSetting??"",completionsMenuCommand:$i.defaultChatAgent?.completionsMenuCommand??""},LC=new R("workbench.chat.menu.config"),men="workbench.action.chat.openQuotaExceededDialog",wWt=class extends z{constructor(e,t){super({...e,icon:L.chatSparkle,f1:!0,category:fi,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())});this.mode=t}async run(e,t){t=typeof t=="string"?{query:t}:t;let o=e.get(si),n=e.get(Lt),r=e.get(Wn),s=e.get(ti),l=e.get(gr),c=e.get(F),u=e.get(fe),p=e.get(ge),h=e.get(Gr),g=e.get(lc),f=e.get(re),v=e.get(B),b=n.lastFocusedWidget;if((!this.mode||!b||!Is(b.domNode))&&(b=await n.revealWidget()),!b)return;let S=t?.mode?b.input.currentChatModesObs.get().findModeByName(t.mode):this.mode;if(S&&await this.handleSwitchToMode(S,b,c,u),t?.modelSelector){let x=(await h.selectLanguageModels(t.modelSelector)).sort().at(0);if(!x)throw new Error(`No language models found matching selector: ${JSON.stringify(t.modelSelector)}.`);let E=h.lookupLanguageModel(x);if(!E)throw new Error(`Language model not loaded: ${x}.`);b.input.setCurrentLanguageModel({metadata:E,identifier:x})}if(t?.toolsInclude||t?.toolsExclude){let w=b.input.selectedLanguageModel.get()?.metadata,x=Array.from(r.getTools(w)),E=Array.from(r.getToolSetsForModel(w)),M=fen({allTools:x,allToolSets:E,toolsInclude:t.toolsInclude,toolsExclude:t.toolsExclude});for(let N of M.unknownIdentifiers)f.warn(`Tool filtering: Unknown identifier '${N}' - no matching tool or toolset found.`);b.input.selectedToolsModel.set(M.enablementMap,!0)}if(t?.previousRequests?.length&&b.viewModel)for(let{request:w,response:x}of t.previousRequests)o.addCompleteRequest(b.viewModel.sessionResource,w,void 0,0,{message:x});if(t?.attachScreenshot){let w=await s.getScreenshot();w&&b.attachmentModel.addContext(IWt(w))}if(t?.attachFiles)for(let w of t.attachFiles){let x=w instanceof A?w:w.uri,E=w instanceof A?void 0:w.range;await p.exists(x)&&b.attachmentModel.addFile(x,E)}if(t?.attachHistoryItemChanges)for(let w of t.attachHistoryItemChanges){let E=g.getRepository(A.file(w.uri.path))?.provider.historyProvider.get();if(!E)continue;let M=await E.resolveHistoryItem(w.historyItemId);M&&b.attachmentModel.addContext({id:w.uri.toString(),name:`${Be(w.uri)}`,value:w.uri,historyItem:M,kind:"scmHistoryItemChange"})}if(t?.attachHistoryItemChangeRanges)for(let w of t.attachHistoryItemChangeRanges){let x=g.getRepository(A.file(w.end.uri.path)),E=x?.provider.historyProvider.get();if(!x||!E)continue;let[M,N]=await Promise.all([E.resolveHistoryItem(w.start.historyItemId),E.resolveHistoryItem(w.end.historyItemId)]);if(!M||!N)continue;let V=w.end.uri.with({scheme:DG.scheme,query:JSON.stringify({repositoryId:x.id,start:M.id,end:w.end.historyItemId})});b.attachmentModel.addContext({id:V.toString(),name:`${Be(V)}`,value:V,historyItemChangeStart:{uri:w.start.uri,historyItem:M},historyItemChangeEnd:{uri:w.end.uri,historyItem:{...N,displayId:w.end.historyItemId}},kind:"scmHistoryItemChangeRange"})}let y;if(t?.query&&(t.isPartialQuery?(b.input.showScrollbarUntilAccept(),b.setInput(t.query)):(b.viewModel||await U.toPromise(b.onDidChangeViewModel),await hen(l,b.input.currentModeKind),b.setInput(t.query),y=b.acceptInput())),t?.toolIds&&t.toolIds.length>0)for(let w of t.toolIds){let x=r.getTool(w);x&&b.attachmentModel.addContext({id:x.id,name:x.displayName,fullName:x.displayName,value:void 0,icon:q.isThemeIcon(x.icon)?x.icon:void 0,kind:"tool"})}if(b.focusInput(),t?.blockOnResponse){let w=await y;if(w){let x=v.getValue("chat.autoReply");await new Promise(M=>{let N=w.onDidChange(async()=>{if(w.isComplete){N.dispose(),M();return}if(w.isPendingConfirmation.get()){let H=w.response.value.some(K=>K.kind==="questionCarousel"&&!K.isUsed);if(x&&H)return;N.dispose(),M()}})});let E=gen(w);return E?{...w.result,...E}:{...w.result}}}}async handleSwitchToMode(e,t,o,n){let r=t.input.currentModeKind;if(e){let s=t.viewModel?.model,l=s?await o.invokeFunction(Met,r,e.kind,s.getRequests().length,s):{needToClearSession:!1};if(!l)return;t.input.setChatMode(e.id),l.needToClearSession&&await n.executeCommand(Mh)}}};async function hen(a,i){a.getDefaultAgent("panel",i)||await Promise.race([U.toPromise(U.filter(a.onDidChangeAgents,()=>!!a.getDefaultAgent("panel",i))),Li(6e4).then(()=>{throw new Error("Timed out waiting for default agent")})])}function gen(a){for(let i of a.response.value){if(i.kind==="toolInvocation"){let e=i.state.get();if(e.type===pi.StateKind.WaitingForConfirmation)return{type:"confirmation",kind:"toolInvocation",toolId:i.toolId};if(e.type===pi.StateKind.WaitingForPostApproval)return{type:"confirmation",kind:"toolPostApproval",toolId:i.toolId}}if(i.kind==="confirmation"&&!i.isUsed)return{type:"confirmation",kind:"confirmation",title:i.title,data:i.data};if(i.kind==="questionCarousel"&&!i.isUsed)return{type:"confirmation",kind:"questionCarousel",questions:i.questions};if(i.kind==="elicitation2"&&i.state.get()==="pending"){let e=i.title;return{type:"confirmation",kind:"elicitation",title:typeof e=="string"?e:e.value}}}}var Vxi=class extends wWt{constructor(){super({id:tk,title:P(6425,"Open Chat"),keybinding:{weight:200,primary:2599,mac:{primary:2343}},menu:[{id:R.ChatTitleBarMenu,group:"a_open",order:1}]})}};function Hxi(a){return`workbench.action.chat.open${a.name.get()}`}var lhe=class extends wWt{constructor(i,e){super({id:Hxi(i),title:P(6429,"Open Chat ({0})",i.label.get()),keybinding:e},i)}};function Jmo(){W(Vxi),W(class extends lhe{constructor(){super(Bc.Ask)}}),W(class extends lhe{constructor(){super(Bc.Agent,{when:C.has("config.chat.agent.enabled"),weight:200,primary:3111,linux:{primary:3623}})}}),W(class extends lhe{constructor(){super(Bc.Edit)}}),W(class extends z{constructor(){super({id:pen,title:P(6435,"Toggle Chat"),category:fi})}async run(e){let t=e.get(wi),o=e.get(Gt),n=e.get(ji),r=e.get(Lt),s=n.getViewLocationById(Xr);o.isViewVisible(Xr)?this.updatePartVisibility(t,s,!1):(this.updatePartVisibility(t,s,!0),(await r.revealWidget())?.focusInput())}updatePartVisibility(e,t,o){let n;switch(t){case 1:n="workbench.parts.panel";break;case 0:n="workbench.parts.sidebar";break;case 2:n="workbench.parts.auxiliarybar";break}n&&e.setPartHidden(!o,n)}}),W(class extends z{constructor(){super({id:yWt,title:P(6420,"New Chat Editor"),icon:L.plus,f1:!0,category:fi,precondition:Z.enabled,keybinding:{weight:200,primary:2092,when:C.and(Z.inChatSession,Z.inChatEditor)},menu:[{id:R.ChatTitleBarMenu,group:"b_new",order:0},{id:R.ChatNewMenu,group:"2_new",order:2},{id:R.EditorTitle,group:"navigation",when:C.and(Tr.isEqualTo(tl.EditorID),Z.newChatButtonExperimentIcon.notEqualsTo("copilot"),Z.newChatButtonExperimentIcon.notEqualsTo("new-session"),Z.newChatButtonExperimentIcon.notEqualsTo("comment")),order:1}]})}async run(e){await e.get(Lt).openSession(Br.getNewSessionUri(),tr,{pinned:!0})}}),W(class extends z{constructor(){super({id:yWt+".copilotIcon",title:P(6420,"New Chat Editor"),icon:L.copilot,f1:!1,category:fi,precondition:Z.enabled,menu:[{id:R.EditorTitle,group:"navigation",when:C.and(Tr.isEqualTo(tl.EditorID),Z.newChatButtonExperimentIcon.isEqualTo("copilot")),order:1}]})}async run(e){await e.get(Lt).openSession(Br.getNewSessionUri(),tr,{pinned:!0})}}),W(class extends z{constructor(){super({id:yWt+".newSessionIcon",title:P(6420,"New Chat Editor"),icon:L.newSession,f1:!1,category:fi,precondition:Z.enabled,menu:[{id:R.EditorTitle,group:"navigation",when:C.and(Tr.isEqualTo(tl.EditorID),Z.newChatButtonExperimentIcon.isEqualTo("new-session")),order:1}]})}async run(e){await e.get(Lt).openSession(Br.getNewSessionUri(),tr,{pinned:!0})}}),W(class extends z{constructor(){super({id:yWt+".commentIcon",title:P(6420,"New Chat Editor"),icon:L.comment,f1:!1,category:fi,precondition:Z.enabled,menu:[{id:R.EditorTitle,group:"navigation",when:C.and(Tr.isEqualTo(tl.EditorID),Z.newChatButtonExperimentIcon.isEqualTo("comment")),order:1}]})}async run(e){await e.get(Lt).openSession(Br.getNewSessionUri(),tr,{pinned:!0})}}),W(class extends z{constructor(){super({id:"workbench.action.openChatToSide",title:P(6421,"New Chat Editor to the Side"),f1:!0,category:fi,precondition:Z.enabled})}async run(e){await e.get(Lt).openSession(Br.getNewSessionUri(),En,{pinned:!0})}}),W(class extends z{constructor(){super({id:"workbench.action.newChatWindow",title:P(6418,"New Chat Window"),f1:!0,category:fi,precondition:Z.enabled,menu:[{id:R.ChatTitleBarMenu,group:"b_new",order:1},{id:R.ChatNewMenu,group:"2_new",order:3}]})}async run(e){await e.get(Lt).openSession(Br.getNewSessionUri(),ff,{pinned:!0,auxiliary:{compact:!0,bounds:{width:640,height:640}}})}}),W(class extends z{constructor(){super({id:"workbench.action.chat.clearInputHistory",title:P(6412,"Clear Input History"),precondition:Z.enabled,category:fi,f1:!0})}async run(e,...t){e.get(Eet).clearHistory()}}),W(class extends yl{constructor(){super({id:"chat.action.focus",title:P(6378,"Focus Chat List"),precondition:C.and(Z.inChatInput),category:fi,keybinding:[{when:C.and(Z.inputCursorAtTop,Z.inQuickChat.negate()),primary:2064,weight:100},{when:C.and(C.or(cC,aue),Z.inQuickChat.negate()),primary:2064,weight:100},{when:C.and(Z.inChatSession,Z.inQuickChat),primary:2066,weight:200}]})}runEditorCommand(e,t){let o=t.getModel()?.uri;o&&e.get(Lt).getWidgetByInputUri(o)?.focusResponseItem()}}),W(class extends yl{constructor(){super({id:"workbench.chat.action.focusLastFocused",title:P(6379,"Focus Last Focused Chat List Item"),precondition:C.and(Z.inChatInput),category:fi,keybinding:[{when:C.and(Z.inputCursorAtTop,Z.inQuickChat.negate()),primary:3088,weight:101},{when:C.and(C.or(cC,aue),Z.inQuickChat.negate()),primary:3088,weight:101},{when:C.and(Z.inChatSession,Z.inQuickChat),primary:3090,weight:201}]})}runEditorCommand(e,t){let o=t.getModel()?.uri;o&&e.get(Lt).getWidgetByInputUri(o)?.focusResponseItem(!0)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.focusInput",title:P(6413,"Focus Chat Input"),f1:!1,keybinding:[{primary:2066,weight:200,when:C.and(Z.inChatSession,Z.inChatInput.negate(),Z.inQuickChat.negate())},{when:C.and(Z.inChatSession,Z.inChatInput.negate(),Z.inQuickChat),primary:2064,weight:200}]})}run(e,...t){e.get(Lt).lastFocusedWidget?.focusInput()}}),W(class qmo extends z{static{this.ID="workbench.action.chat.focusTodosView"}constructor(){super({id:qmo.ID,title:P(6417,"Toggle Focus Between TODOs and Input"),category:fi,f1:!0,precondition:Z.chatModeKind.isEqualTo("agent"),keybinding:[{weight:201,primary:3122,when:C.or(C.and(Z.inChatInput,Z.chatModeKind.isEqualTo("agent")),C.and(Z.inChatTodoList,Z.chatModeKind.isEqualTo("agent")))}]})}run(e){let o=e.get(Lt).lastFocusedWidget;(!o||!o.toggleTodosViewFocus())&&cn(d(6389,null))}}),W(class $mo extends z{static{this.ID="workbench.action.chat.focusQuestionCarousel"}constructor(){super({id:$mo.ID,title:P(6414,"Chat: Toggle Focus Between Question and Input"),category:fi,f1:!0,precondition:Z.inChatSession,keybinding:[{weight:200,primary:3103,when:C.and(Z.inChatSession,Z.Editing.hasQuestionCarousel)}]})}run(e){let o=e.get(Lt).lastFocusedWidget;(!o||!o.toggleQuestionCarouselFocus())&&cn(d(6386,null))}}),W(class jmo extends z{static{this.ID="workbench.action.chat.previousQuestion"}constructor(){super({id:jmo.ID,title:P(6422,"Chat: Previous Question"),category:fi,f1:!0,precondition:C.and(Z.inChatSession,Z.Editing.hasQuestionCarousel),keybinding:[{weight:200,primary:558,when:C.and(Z.inChatQuestionCarousel,Z.Editing.hasQuestionCarousel)}]})}run(e){e.get(Lt).lastFocusedWidget?.navigateToPreviousQuestion()}}),W(class Qmo extends z{static{this.ID="workbench.action.chat.nextQuestion"}constructor(){super({id:Qmo.ID,title:P(6419,"Chat: Next Question"),category:fi,f1:!0,precondition:C.and(Z.inChatSession,Z.Editing.hasQuestionCarousel),keybinding:[{weight:200,primary:556,when:C.and(Z.inChatQuestionCarousel,Z.Editing.hasQuestionCarousel)}]})}run(e){e.get(Lt).lastFocusedWidget?.navigateToNextQuestion()}}),W(class Ymo extends z{static{this.ID="workbench.action.chat.focusQuestionCarouselTerminal"}constructor(){super({id:Ymo.ID,title:P(6415,"Chat: Focus Terminal from Question Carousel"),category:fi,f1:!0,precondition:C.and(Z.inChatSession,Z.Editing.hasQuestionCarousel,Z.chatQuestionCarouselHasTerminal),keybinding:[{weight:200,primary:562,when:C.and(Z.inChatQuestionCarousel,Z.Editing.hasQuestionCarousel,Z.chatQuestionCarouselHasTerminal)}]})}run(e){e.get(Lt).lastFocusedWidget?.focusQuestionCarouselTerminal()}}),W(class Xmo extends z{static{this.ID="workbench.action.chat.focusTip"}constructor(){super({id:Xmo.ID,title:P(6416,"Chat: Toggle Focus Between Tip and Input"),category:fi,f1:!0,precondition:Z.inChatSession,keybinding:[{weight:200,primary:3162,when:C.or(Z.inChatSession,Z.inChatTip)}]})}run(e){let o=e.get(Lt).lastFocusedWidget;(!o||!o.toggleTipFocus())&&cn(d(6388,null))}}),W(class extends z{constructor(){super({id:"workbench.action.chat.showContextUsage",title:P(6423,"Show Context Window Usage"),category:fi,f1:!0,precondition:Z.enabled})}async run(e){let t=e.get(Lt);(t.lastFocusedWidget??await t.revealWidget())?.input.showContextUsageDetails()}}),W(class extends z{constructor(){super({id:"workbench.action.chat.toggleShowContextUsage",title:P(6387,"Show Context Usage"),category:fi,toggled:C.equals("config.chat.contextUsage.enabled",!0),menu:{id:R.ChatWelcomeContext,group:"1_display",order:1,when:Z.inChatEditor.negate()}})}async run(e){let t=e.get(B),o=t.getValue("chat.contextUsage.enabled");await t.updateValue("chat.contextUsage.enabled",!o)}});let a=C.and(Z.enabled,C.notEquals(`config.${Wxi.completionsAdvancedSetting}.authProvider`,Wxi.provider.enterprise.id));W(class extends z{constructor(){super({id:"workbench.action.chat.manageSettings",title:P(6424,"Manage Copilot Settings"),category:fi,f1:!0,precondition:C.and(C.or(Z.Entitlement.planFree,Z.Entitlement.planEdu,Z.Entitlement.planPro,Z.Entitlement.planProPlus,Z.Entitlement.planMax),a),menu:{id:R.ChatTitleBarMenu,group:"y_manage",order:1,when:a}})}async run(i){let e=i.get(Je),t=i.get(Nd);e.open(A.parse(t.resolveGitHubUrl(SM.copilotSettings)))}}),W(class extends z{constructor(){super({id:"workbench.action.chat.showExtensionsUsingCopilot",title:P(6433,"Show Extensions using Copilot"),f1:!0,category:Q3,precondition:Z.enabled})}async run(e){e.get(Ui).openSearch(`@contribute:${SWt}`)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.configureCodeCompletions",title:P(6394,"Configure Inline Suggestions..."),precondition:C.and(Z.Setup.installed,Z.Setup.disabled.negate(),Z.Setup.untrusted.negate()),menu:{id:R.ChatTitleBarMenu,group:"f_completions",order:10}})}async run(e){e.get(fe).executeCommand(Wxi.completionsMenuCommand)}}),W(class extends z{constructor(){super({id:men,title:d(6436,null)})}async run(e){let t=e.get(dr),o=e.get(fe),n=e.get(ct),r=e.get(_e),s,l=t.quotas.chat?.percentRemaining===0,c=t.quotas.completions?.percentRemaining===0;if(l&&!c?s=d(6392,null):c&&!l?s=d(6393,null):s=d(6391,null),t.quotas.resetDate){let h=t.quotas.resetDateHasTime?nd.DateTimeFormat(Kr,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"}):nd.DateTimeFormat(Kr,{year:"numeric",month:"long",day:"numeric"}),g=new Date(t.quotas.resetDate);s=[s,d(6430,null,h.value.format(g))].join(" ")}let u=t.entitlement===5,p=u?d(6439,null):void 0;await n.prompt({type:"none",message:d(6395,null),cancelButton:{label:d(6396,null),run:()=>{}},buttons:[{label:u?d(6438,null):d(6437,null),run:()=>{let h="workbench.action.chat.upgradePlan";r.publicLog2("workbenchActionExecuted",{id:h,from:"chat-dialog"}),o.executeCommand(h)}}],custom:{icon:L.copilotWarningLarge,markdownDetails:ui([{markdown:new he(s,!0)},p?{markdown:new he(p,!0)}:void 0])}})}}),W(class extends z{constructor(){super({id:"workbench.action.chat.resetTrustedTools",title:P(6431,"Reset Tool Confirmations"),category:fi,f1:!0,precondition:Z.enabled})}run(e){e.get(IR).resetToolAutoConfirmation(),e.get(Ne).info(d(6432,null))}}),W(class extends z{constructor(){super({id:RG,title:P(6402,"Generate Agent Instructions"),category:fi,icon:L.sparkle,f1:!0,precondition:Z.enabled})}async run(e){await e.get(fe).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/init",isPartialQuery:!1})}}),W(class extends z{constructor(){super({id:Det,title:P(6403,"Generate On-Demand Instructions"),category:fi,icon:L.sparkle,f1:!0,precondition:Z.enabled})}async run(e){await e.get(fe).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-instructions ",isPartialQuery:!0})}}),W(class extends z{constructor(){super({id:T8,title:P(6404,"Generate Prompt File"),shortTitle:P(6405,"Generate Prompt"),category:fi,icon:L.sparkle,f1:!0,precondition:Z.enabled})}async run(e){await e.get(fe).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-prompt ",isPartialQuery:!0})}}),W(class extends z{constructor(){super({id:_8,title:P(6406,"Generate Skill"),shortTitle:P(6407,"Generate Skill"),category:fi,icon:L.sparkle,f1:!0,precondition:Z.enabled})}async run(e){await e.get(fe).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-skill ",isPartialQuery:!0})}}),W(class extends z{constructor(){super({id:D8,title:P(6397,"Generate Custom Agent"),shortTitle:P(6398,"Generate Agent"),category:fi,icon:L.sparkle,f1:!0,precondition:Z.enabled})}async run(e){await e.get(fe).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-agent ",isPartialQuery:!0})}}),W(class extends z{constructor(){super({id:Bxi,title:P(6400,"Generate Hook"),shortTitle:P(6401,"Generate Hook"),category:fi,icon:L.sparkle,f1:!0,precondition:Z.enabled})}async run(e){await e.get(fe).executeCommand("workbench.action.chat.open",{mode:"agent",query:"/create-hook ",isPartialQuery:!0})}}),W(class extends z{constructor(){super({id:Ret,title:P(6408,"Insert Fork Command"),shortTitle:P(6409,"Insert /fork"),category:fi,icon:L.repoForked,f1:!0,precondition:Z.enabled})}async run(e){await e.get(fe).executeCommand("workbench.action.chat.open",{query:"/fork ",isPartialQuery:!0})}}),W(class extends z{constructor(){super({id:CWt,title:P(6410,"Insert Troubleshoot Command"),shortTitle:P(6411,"Insert /troubleshoot"),category:fi,f1:!0,precondition:Z.enabled})}async run(e){await e.get(fe).executeCommand("workbench.action.chat.open",{query:"/troubleshoot ",isPartialQuery:!0})}}),W(class extends z{constructor(){super({id:"workbench.action.chat.openFeatureSettings",title:P(6427,"Chat Settings"),shortTitle:d(6428,null),category:fi,f1:!0,precondition:Z.enabled,menu:[{id:LC,when:C.and(Z.enabled,C.equals("view",Xr)),order:15,group:"3_configure"},{id:R.ChatWelcomeContext,group:"2_settings",order:1},{id:R.ViewTitle,when:C.and(Z.enabled,C.equals("view",Xr)),order:15,group:"3_configure"}]})}async run(e){e.get(Qo).openSettings({query:"@feature:chat "})}}),be.appendMenuItem(R.ViewTitle,{command:{id:eMe.OpenEditor,title:P(6426,"Open Customizations"),category:fi,icon:L.gear},group:"navigation",when:C.and(Z.enabled,C.equals("view",Xr)),order:6})}function Uxi(a,i=!0){return _r(a)?(i?`${a.username}: `:"")+a.messageText:(i?`${a.username}: `:"")+a.response.toString()}function fen(a){let{allTools:i,allToolSets:e,toolsInclude:t,toolsExclude:o}=a,n=new Map,r=new Set,s=(g,f)=>f.has(g.id)?(r.add(g.id),!0):g.toolReferenceName&&f.has(g.toolReferenceName)?(r.add(g.toolReferenceName),!0):!1,l=(g,f)=>f.has(g.id)?(r.add(g.id),!0):f.has(g.referenceName)?(r.add(g.referenceName),!0):!1,c=new Set;if(t){let g=new Set(t);for(let f of e)if(l(f,g))for(let v of f.getTools())n.set(v,!0);for(let f of i)s(f,g)?(n.set(f,!0),c.add(f)):n.has(f)||n.set(f,!1);for(let f of e)for(let v of f.getTools())s(v,g)?(n.set(v,!0),c.add(v)):n.has(v)||n.set(v,!1)}else{for(let g of i)n.set(g,!0);for(let g of e)for(let f of g.getTools())n.set(f,!0)}if(o){let g=new Set(o);for(let f of e)if(l(f,g))for(let v of f.getTools())c.has(v)||n.set(v,!1);for(let f of i)s(f,g)&&n.set(f,!1);for(let f of e)for(let v of f.getTools())s(v,g)&&n.set(v,!1)}let u=new Set([...t??[],...o??[]]),p=[];for(let g of u)r.has(g)||p.push(g);if(Array.from(n.entries()).filter(([g,f])=>f&&!_h(g)).length===0)throw new Error("Tool filtering resulted in zero enabled tools. At least one tool must be enabled.");for(let g of e){let f=Array.from(g.getTools()),v=f.length>0&&f.every(b=>n.get(b)===!0);n.set(g,v)}return{enablementMap:n,unknownIdentifiers:p}}async function Let(a,i,e){return eJe(a,e,{messageOverride:i})}async function Met(a,i,e,t,o){if(!o?.editingSession||i===e)return{needToClearSession:!1};let n=a.get(ct);if((i==="edit"||e==="edit")&&t>0){let s=d(6434,null);return o.editingSession.entries.get().filter(u=>u.state.get()===0).length>0?await Let(o,s,n)?{needToClearSession:!0}:!1:(await n.confirm({title:d(6380,null),message:d(6382,null),primaryButton:d(6381,null),type:"info"})).confirmed?{needToClearSession:!0}:!1}return{needToClearSession:!1}}async function xWt(a,i,e){let t=a.viewModel?.model.sessionResource,o=e??(t?yn(t):kl);if(tw(a.viewContext)&&o!==kl){let n=A.from({scheme:o,path:`/untitled-${ht()}`});await(await i.openView(Xr)).loadSession(n)}else await a.clear()}be.appendMenuItem(R.EditorContext,{submenu:R.ChatTextEditorMenu,group:"1_chat",order:5,title:d(6399,null),when:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())});W(class extends z{constructor(){super({id:"workbench.action.chat.toggleDefaultVisibility",title:P(6390,"Show View by Default"),toggled:C.equals("config.workbench.secondarySideBar.defaultVisibility","hidden").negate(),f1:!1,menu:{id:R.ViewTitle,when:C.and(C.equals("view",Xr),Z.panelLocation.isEqualTo(2)),order:0,group:"5_configure"}})}async run(i){let e=i.get(B),t=e.getValue("workbench.secondarySideBar.defaultVisibility");e.updateValue("workbench.secondarySideBar.defaultVisibility",t!=="hidden"?"hidden":"visible")}});W(class extends z{constructor(){super({id:"workbench.action.chat.editToolApproval",title:P(6385,"Manage Tool Approval"),metadata:{description:P(6384,"Edit/manage the tool approval and confirmation preferences for AI chat agents.")},precondition:Z.enabled,f1:!0,category:fi})}async run(i,e){let t=i.get(IR),o=i.get(Wn);t.manageConfirmationPreferences([...o.getAllToolsIncludingDisabled()],e?{defaultScope:e}:void 0)}});var ven=zn.registerExtensionPoint({extensionPoint:"chatSessions",jsonSchema:{description:d(8123,null),type:"array",items:{type:"object",additionalProperties:!1,properties:{type:{description:d(8128,null),type:"string"},name:{description:d(8134,null),type:"string",pattern:"^[\\w-]+$"},displayName:{description:d(8131,null),type:"string"},description:{description:d(8130,null),type:"string"},when:{description:d(8152,null),type:"string"},icon:{description:d(8132,null,"$(github)","$(cloud)"),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(8154,null),type:"string"},dark:{description:d(8153,null),type:"string"}}}]},order:{description:d(8135,null),type:"integer"},alternativeIds:{description:d(8124,null),type:"array",items:{type:"string"}},welcomeTitle:{description:d(8151,null),type:"string"},welcomeMessage:{description:d(8149,null),type:"string"},welcomeTips:{description:d(8150,null),type:"string"},inputPlaceholder:{description:d(8133,null),type:"string"},capabilities:{description:d(8127,null),type:"object",additionalProperties:!1,properties:{supportsFileAttachments:{description:d(8137,null),type:"boolean"},supportsToolAttachments:{description:d(8147,null),type:"boolean"},supportsMCPAttachments:{description:d(8141,null),type:"boolean"},supportsImageAttachments:{description:d(8139,null),type:"boolean"},supportsSearchResultAttachments:{description:d(8144,null),type:"boolean"},supportsInstructionAttachments:{description:d(8140,null),type:"boolean"},supportsSourceControlAttachments:{description:d(8145,null),type:"boolean"},supportsProblemAttachments:{description:d(8142,null),type:"boolean"},supportsSymbolAttachments:{description:d(8146,null),type:"boolean"},supportsPromptAttachments:{description:d(8143,null),type:"boolean"},supportsHandOffs:{description:d(8138,null),type:"boolean"}}},commands:{markdownDescription:d(8120,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(8118,null),type:"string"},description:{description:d(8119,null),type:"string"},when:{description:d(8121,null),type:"string"}}}},canDelegate:{description:d(8126,null),type:"boolean",default:!1},customAgentTarget:{description:d(8129,null),type:"string"},requiresCustomModels:{description:d(8136,null),type:"boolean",default:!1},autoAttachReferences:{description:d(8125,null),type:"boolean",default:!1},useRequestToPopulateBuiltInPickers:{description:d(8148,null),type:"boolean",default:!1}},required:["type","name","displayName","description"]}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatSession:${i.type}`}}),Kxi=class extends k{constructor(e,t,o,n,r){super();this.session=e;this.chatSessionType=t;this.resource=o;this.options=n;this.onWillDispose=r;this._optionsCache=new Map(n),this._register(this.session.onWillDispose(()=>{this.onWillDispose(this.resource)}))}getOption(e){return this._optionsCache.get(e)}getAllOptions(){return this._optionsCache.entries()}setOption(e,t){this._optionsCache.set(e,t)}},Pet=class extends k{constructor(e,t,o,n,r,s,l){super();this._logService=e;this._chatAgentService=t;this._extensionService=o;this._contextKeyService=n;this._menuService=r;this._themeService=s;this._labelService=l;this._itemControllers=new Map;this._contributions=new Map;this._contributionDisposables=this._register(new Ot);this._contentProviders=new Map;this._alternativeIdMap=new Map;this._contextKeys=new Set;this._onDidChangeItemsProviders=this._register(new T);this.onDidChangeItemsProviders=this._onDidChangeItemsProviders.event;this._onDidChangeSessionItems=this._register(new T);this.onDidChangeSessionItems=this._onDidChangeSessionItems.event;this._onDidCommitSession=this._register(new T);this.onDidCommitSession=this._onDidCommitSession.event;this._onDidChangeAvailability=this._register(new T);this.onDidChangeAvailability=this._onDidChangeAvailability.event;this._onDidChangeInProgress=this._register(new T);this._onDidChangeContentProviderSchemes=this._register(new T);this._onDidChangeSessionOptions=this._register(new T);this._onDidChangeOptionGroups=this._register(new T);this.inProgressMap=new Map;this._sessionTypeOptions=new Map;this._sessions=new dt;this._resourceAliases=new dt;this._customizationsProviders=new Map;this._onDidChangeCustomizations=this._register(new T);this.onDidChangeCustomizations=this._onDidChangeCustomizations.event;this._hasCanDelegateProvidersKey=Z.hasCanDelegateProviders.bindTo(this._contextKeyService),this._register(ven.setHandler(p=>{for(let h of p)if(Va(h.description,"chatSessionsProvider")&&Array.isArray(h.value))for(let g of h.value)this._register(this.registerContribution(g,h.description))})),this._register(U.filter(this._contextKeyService.onDidChangeContext,p=>p.affectsSome(this._contextKeys))(()=>{this._evaluateAvailability()}));let c=[zo.Local],u=vi(this.onDidChangeAvailability,()=>Array.from(this._contributions.keys()).filter(p=>this._contributionDisposables.has(p))).recomputeInitiallyAndOnChange(this._store);this._register(ve(p=>{let h=u.read(p);for(let g of c)p.store.add(zxi(g,sb(g)));for(let g of h){let f=Kg(g);if(f)p.store.add(zxi(g,sb(f)));else{let v=this._contributions.get(g);v&&p.store.add(zxi(g,v.contribution.displayName??v.contribution.name??g))}}})),this._register(this._labelService.registerFormatter({scheme:Q.copilotPr,formatting:{label:"${authority}${path}",separator:Cu,stripPathStartingSeparator:!0}}))}get onDidChangeInProgress(){return this._onDidChangeInProgress.event}get onDidChangeContentProviderSchemes(){return this._onDidChangeContentProviderSchemes.event}get onDidChangeSessionOptions(){return this._onDidChangeSessionOptions.event}get onDidChangeOptionGroups(){return this._onDidChangeOptionGroups.event}reportInProgress(e,t){this._itemControllers.has(e)||this._logService.warn(`Attempted to report in-progress status for unknown chat session type '${e}'`),this.inProgressMap.set(e,t),this._onDidChangeInProgress.fire()}getInProgress(){return Array.from(this.inProgressMap.entries()).map(([e,t])=>({chatSessionType:e,count:t}))}async resolveChatSessionItem(e,t,o){let n=this._itemControllers.get(e);if(n?.controller.resolveChatSessionItem)return n.controller.resolveChatSessionItem(t,o)}async updateInProgressStatus(e){try{let t=[];for await(let n of this.getChatSessionItems([e],Ie.None))t.push(...n.items);let o=t.filter(n=>n.status&&Rx(n.status));this.reportInProgress(e,o.length)}catch(t){this._logService.warn(`Failed to update in-progress status for chat session type '${e}':`,t)}}registerContribution(e,t){if(this._logService.trace(`[ChatSessionsService] registerContribution called for type='${e.type}', canDelegate=${e.canDelegate}, when='${e.when}', extension='${t.identifier.value}'`),this._contributions.has(e.type))return this._logService.trace(`[ChatSessionsService] registerContribution: type='${e.type}' already registered, skipping`),k.None;if(e.when){let o=C.deserialize(e.when);if(o)for(let n of o.keys())this._contextKeys.add(n)}if(this._contributions.set(e.type,{contribution:e,extension:t}),e.alternativeIds)for(let o of e.alternativeIds)this._alternativeIdMap.has(o)&&this._logService.warn(`Alternative ID '${o}' is already mapped to '${this._alternativeIdMap.get(o)}'. Remapping to '${e.type}'.`),this._alternativeIdMap.set(o,e.type);return this._evaluateAvailability(),{dispose:()=>{if(this._contributions.delete(e.type),e.alternativeIds)for(let o of e.alternativeIds)this._alternativeIdMap.get(o)===e.type&&this._alternativeIdMap.delete(o);this._contributionDisposables.deleteAndDispose(e.type),this._updateHasCanDelegateProvidersContextKey()}}}_isContributionAvailable(e){if(!e.when)return!0;let t=C.deserialize(e.when);return!t||this._contextKeyService.contextMatchesRules(t)}_resolveToPrimaryType(e){let t=this._contributions.get(e)?.contribution;if(t&&this._isContributionAvailable(t))return e;let o=this._alternativeIdMap.get(e);if(o){let n=this._contributions.get(o)?.contribution;if(n&&this._isContributionAvailable(n))return o}}_registerMenuItems(e,t){let o=this._contextKeyService.createOverlay([["chatSessionType",e.type]]),r=this._menuService.getMenuActions(R.AgentSessionsCreateSubMenu,o).map(l=>l[1]).flat(),s=new O;for(let l=0;l<r.length;l++){let c=r[l];c instanceof Do&&(l===0&&!e.canDelegate?s.add(ben(e.type,e.displayName,c.item.id)):s.add(be.appendMenuItem(R.ChatNewMenu,{command:c.item,group:"4_externally_contributed"})))}return{dispose:()=>s.dispose()}}_registerCommands(e){let t=Ien(e.type);return Fn(W(class extends z{constructor(){super({id:`workbench.action.chat.openSessionWithPrompt.${e.type}`,title:P(8159,"New {0} with Prompt",e.displayName),category:fi,icon:L.plus,f1:!1,precondition:Z.enabled})}async run(n,r){let s=n.get(si),l=n.get(dh),c=n.get(Wn),{type:u}=e;if(r){let p=r.attachedContext,h=A.revive(r.resource),g=await s.acquireOrLoadSession(h,"panel",Ie.None,"ChatSessionsContribution#sendPrompt");try{let f=await Zmo(r.prompt,e.type,l,c);f&&(p=[f,...p??[]]);let v=await s.sendRequest(h,r.prompt,{agentIdSilent:u,attachedContext:p});v.kind==="queued"?await v.deferred:v.kind==="sent"&&await v.data.responseCompletePromise}finally{g?.dispose()}}}}),W(class extends z{constructor(){super({id:`workbench.action.chat.openNewSessionEditor.${e.type}`,title:P(8157,"New {0} Session",e.displayName),category:fi,icon:L.plus,f1:!0,precondition:Z.enabled})}async run(n,r){let{type:s,displayName:l}=e;await Aet(n,{type:s,displayName:l,position:"editor"},r)}}),W(class extends z{constructor(){super({id:`workbench.action.chat.openNewSessionSidebar.${e.type}`,title:P(8158,"New {0} Session",e.displayName),category:fi,icon:L.plus,f1:!1,precondition:Z.enabled,menu:t?void 0:{id:R.ChatNewMenu,group:"3_new_special"}})}async run(n,r){let{type:s,displayName:l}=e;await Aet(n,{type:s,displayName:l,position:"sidebar"},r)}}))}_evaluateAvailability(){let e=new Set,t=new Set,o=new xn;for(let{contribution:n,extension:r}of this._contributions.values()){let s=this._contributionDisposables.has(n.type),l=this._isContributionAvailable(n);if(this._logService.trace(`[ChatSessionsService] _evaluateAvailability: type='${n.type}', isCurrentlyRegistered=${s}, shouldBeRegistered=${l}, when='${n.when}'`),s&&!l){this._contributionDisposables.deleteAndDispose(n.type);for(let c of this._disposeSessionsForContribution(n.type))o.add(c);t.add(n.type)}else!s&&l&&(r&&this._enableContribution(n,r),e.add(n.type))}if(e.size>0||t.size>0){this._onDidChangeAvailability.fire();for(let n of[...e,...t])this._onDidChangeItemsProviders.fire({chatSessionType:n});o.size>0&&this._onDidChangeSessionItems.fire({removed:Array.from(o)})}this._updateHasCanDelegateProvidersContextKey()}_enableContribution(e,t){this._logService.trace(`[ChatSessionsService] _enableContribution: type='${e.type}', canDelegate=${e.canDelegate}`);let o=new O;this._contributionDisposables.set(e.type,o),e.canDelegate&&(o.add(this._registerAgent(e,t)),o.add(this._registerCommands(e))),o.add(this._registerMenuItems(e,t))}_disposeSessionsForContribution(e){let t=[];for(let[o,n]of this._sessions)n.chatSessionType===e&&t.push(o);t.length>0&&this._logService.info(`Disposing ${t.length} cached sessions for contribution '${e}' due to when clause change`);for(let o of t){let n=this._sessions.get(o);n&&n.dispose()}return t}_registerAgent(e,t){let o=this.getContributionIcon(t,e),n=q.isThemeIcon(o)?{themeIcon:o,icon:void 0,iconDark:void 0}:o?{icon:o.light,iconDark:o.dark}:{themeIcon:L.sendToRemoteAgent},r=e.type,s={id:r,name:e.name,fullName:e.displayName,description:e.description,isDefault:!1,isCore:!1,isDynamic:!0,slashCommands:e.commands??[],locations:["panel"],modes:["agent","ask"],disambiguation:[],metadata:{...n},capabilities:e.capabilities,canAccessPreviousChatHistory:!0,extensionId:t.identifier,extensionVersion:t.version,extensionDisplayName:t.displayName||t.name,extensionPublisherId:t.publisher};return this._chatAgentService.registerAgent(r,s)}getAllChatSessionContributions(){return Array.from(this._contributions.values()).filter(e=>this._isContributionAvailable(e.contribution)).map(e=>this.resolveChatSessionContribution(e.extension,e.contribution))}_updateHasCanDelegateProvidersContextKey(){let e=this.getAllChatSessionContributions().filter(o=>o.canDelegate),t=e.length>0;this._logService.trace(`[ChatSessionsService] hasCanDelegateProvidersAvailable=${t} (${e.map(o=>o.type).join(", ")})`),this._hasCanDelegateProvidersKey.set(t)}getChatSessionContribution(e){let t=this._contributions.get(e);if(t&&this._isContributionAvailable(t.contribution))return this.resolveChatSessionContribution(t.extension,t.contribution)}resolveChatSessionContribution(e,t){return{...t,icon:this.resolveIconForCurrentColorTheme(this.getContributionIcon(e,t))}}getContributionIcon(e,t){if(t.icon)return typeof t.icon=="string"?t.icon.startsWith("$(")&&t.icon.endsWith(")")?q.fromString(t.icon):q.fromId(t.icon):{dark:e?Ve(e.extensionLocation,t.icon.dark):A.parse(t.icon.dark),light:e?Ve(e.extensionLocation,t.icon.light):A.parse(t.icon.light)}}resolveIconForCurrentColorTheme(e){if(e)return q.isThemeIcon(e)?e:cm(this._themeService.getColorTheme().type)?e.dark:e.light}registerChatSessionContribution(e){return this._contributions.has(e.type)?{dispose:()=>{}}:(this._contributions.set(e.type,{contribution:e,extension:void 0}),this._contributionDisposables.set(e.type,new O),this._updateHasCanDelegateProvidersContextKey(),this._onDidChangeAvailability.fire(),ee(()=>{this._contributions.delete(e.type),this._contributionDisposables.deleteAndDispose(e.type),this._updateHasCanDelegateProvidersContextKey(),this._onDidChangeAvailability.fire()}))}async activateChatSessionItemProvider(e){await this.doActivateChatSessionItemController(e)}async doActivateChatSessionItemController(e){await this._extensionService.whenInstalledExtensionsRegistered();let t=this._resolveToPrimaryType(e);t&&(e=t);let o=this._contributions.get(e)?.contribution;return o&&!this._isContributionAvailable(o)?!1:this._itemControllers.has(e)?!0:(await this._extensionService.activateByEvent(`onChatSession:${e}`),!!this._itemControllers.get(e))}async canResolveChatSession(e){await this._extensionService.whenInstalledExtensionsRegistered();let t=this._resolveToPrimaryType(e)||e,o=this._contributions.get(t)?.contribution;return o&&!this._isContributionAvailable(o)?!1:this._contentProviders.has(e)?!0:(await this._extensionService.activateByEvent(`onChatSession:${e}`),this._contentProviders.has(e))}async provideChatInputCompletions(e,t,o){let n=yn(e),r=this._resolveToPrimaryType(n)||n,s=this._contentProviders.get(r);if(s?.provideChatInputCompletions)return s.provideChatInputCompletions(e,t,o)}async getChatInputCompletionTriggerCharacters(e){let t=this._resolveToPrimaryType(e)||e,o=this._contentProviders.get(t);if(o)return o.provideChatInputCompletionTriggerCharacters?o.provideChatInputCompletionTriggerCharacters():[]}async tryActivateControllers(e){await Promise.all(this.getAllChatSessionContributions().map(async t=>{e&&!e.includes(t.type)||await this.doActivateChatSessionItemController(t.type)||e?.includes(t.type)&&this._logService.trace(`[ChatSessionsService] No enabled provider found for chat session type ${t.type}`)}))}getChatSessionItems(e,t){return new Fp(async o=>{await Ym(this.tryActivateControllers(e),t),await Promise.all(Array.from(this._itemControllers,async([n,r])=>{let s=this._resolveToPrimaryType(n)??n;if(!(e&&!e.includes(s)))try{await Ym(r.initialRefresh,t);let l=r.controller.items;this._logService.trace(`[ChatSessionsService] Resolved ${l.length} sessions for provider ${s}`),o.emitOne({chatSessionType:s,items:l})}catch(l){Yi(l)||this._logService.error(`[ChatSessionsService] Failed to resolve sessions for provider ${s}`,l)}}))})}async refreshChatSessionItems(e,t){await this.tryActivateControllers(e),await Promise.all(Array.from(this._itemControllers).map(async([o,n])=>{let r=this._resolveToPrimaryType(o)??o;if(!(e&&!e.includes(r)))try{await n.controller.refresh(t)}catch(s){Yi(s)||this._logService.error(`[ChatSessionsService] Failed to resolve sessions for provider ${r}`,s)}}))}getRegisteredChatSessionItemProviders(){return[...new Set(Array.from(this._itemControllers.keys()).map(e=>this._resolveToPrimaryType(e)??e))]}registerChatSessionItemController(e,t){let o=new O,n=o.add(new qe);return this._itemControllers.set(e,{controller:t,initialRefresh:t.refresh(n.token)}),this._onDidChangeItemsProviders.fire({chatSessionType:e}),o.add(t.onDidChangeChatSessionItems(r=>{this._onDidChangeSessionItems.fire(r),this.updateInProgressStatus(e)})),{dispose:()=>{n.cancel(),o.dispose(),this._itemControllers.get(e)&&(this._itemControllers.delete(e),this._onDidChangeItemsProviders.fire({chatSessionType:e})),this.updateInProgressStatus(e)}}}registerChatSessionContentProvider(e,t){if(this._contentProviders.has(e))throw new Error(`Content provider for ${e} is already registered.`);return this._contentProviders.set(e,t),this._onDidChangeContentProviderSchemes.fire({added:[e],removed:[]}),{dispose:()=>{this._contentProviders.delete(e),this._onDidChangeContentProviderSchemes.fire({added:[],removed:[e]});for(let[o,n]of this._sessions)n.chatSessionType===e&&(n.dispose(),this._sessions.delete(o))}}}registerCustomizationsProvider(e,t){this._customizationsProviders.set(e,t);let o=t.onDidChangeCustomizations(()=>{this._onDidChangeCustomizations.fire({chatSessionType:e})});return ee(()=>{o.dispose(),this._customizationsProviders.get(e)===t&&this._customizationsProviders.delete(e)})}hasCustomizationsProvider(e){return this._customizationsProviders.has(e)}async getCustomizations(e,t){let o=this._customizationsProviders.get(e);if(o)return o.provideCustomizations(t)}async createNewChatSessionItem(e,t,o){let n=this._itemControllers.get(e);if(n)return await n.initialRefresh,n.controller.newChatSessionItem?.(t,o)}async getOrCreateChatSession(e,t){{let u=this._sessions.get(e);if(u)return u.session}let o=yn(e);if(!await Ym(this.canResolveChatSession(o),t))throw Error(`Can not find provider for ${e}`);{let u=this._sessions.get(e);if(u)return u.session}let n=this._resolveToPrimaryType(o)||o,r=this._contentProviders.get(n);if(!r)throw Error(`Can not find provider for ${e}`);let s,l=ZD(e)?await this.getNewChatSessionInputState(n,e):void 0;if(ZD(e)&&(l||n.startsWith("agent-host-"))){let u=new Map;for(let p of l??[]){let h=p.selected??p.items.find(g=>g.default)??p.items[0];h&&u.set(p.id,h)}s={sessionResource:e,onWillDispose:U.None,history:[],options:u.size>0?u:void 0,dispose:()=>{}}}else s=await Ym(r.provideChatSessionContent(e,t),t);if(s.options)for(let[u,p]of s.options)this.setSessionOption(e,u,p);{let u=this._sessions.get(e);if(u)return s.dispose(),u.session}let c=new Kxi(s,o,e,s.options,u=>{c.dispose(),this._sessions.delete(u)});return this._sessions.set(e,c),s.options&&this._onDidChangeSessionOptions.fire({sessionResource:e,updates:s.options}),s}hasAnySessionOptions(e){let t=this._sessions.get(this._resolveResource(e));return!!t&&!!t.options&&t.options.size>0}getSessionOptions(e){let t=this._sessions.get(this._resolveResource(e));if(!t)return;let o=new Map;for(let[n,r]of t.getAllOptions())o.set(n,typeof r=="string"?r:r.id);return o.size>0?o:void 0}getSessionOption(e,t){return this._sessions.get(this._resolveResource(e))?.getOption(t)}setSessionOption(e,t,o){return this.updateSessionOptions(e,new Map([[t,o]]))}updateSessionOptions(e,t){let o=this._sessions.get(this._resolveResource(e));if(!o)return!1;let n=!1;for(let[r,s]of t)o.getOption(r)!==s&&(o.setOption(r,s),n=!0);return n&&this._onDidChangeSessionOptions.fire({sessionResource:e,updates:t}),n}_resolveResource(e){return this._resourceAliases.get(e)??e}registerSessionResourceAlias(e,t){this._resourceAliases.set(t,e)}fireSessionCommitted(e,t){this._onDidCommitSession.fire({original:e,committed:t})}setOptionGroupsForSessionType(e,t,o){o?this._sessionTypeOptions.set(e,o):this._sessionTypeOptions.delete(e),this._onDidChangeOptionGroups.fire(e)}getOptionGroupsForSessionType(e){return this._sessionTypeOptions.get(e)}async getNewChatSessionInputState(e,t){let o=this._itemControllers.get(e);if(o?.controller.getNewChatSessionInputState){let r=await o.controller.getNewChatSessionInputState(t,Ie.None);return r?.length&&(this._sessionTypeOptions.set(e,[...r]),this._onDidChangeOptionGroups.fire(e)),r}let n=this._sessionTypeOptions.get(e);if(n?.length)return n}getCapabilitiesForSessionType(e){return this._contributions.get(e)?.contribution?.capabilities}getCustomAgentTargetForSessionType(e){return this._contributions.get(e)?.contribution?.customAgentTarget??"undefined"}requiresCustomModelsForSessionType(e){return!!this._contributions.get(e)?.contribution?.requiresCustomModels}supportsDelegationForSessionType(e){return this._contributions.get(e)?.contribution?.supportsDelegation!==!1}sessionSupportsFork(e){return!!(this._sessions.get(e)??this._sessions.get(this._resolveResource(e)))?.session.forkSession}async forkChatSession(e,t,o){let n=this._sessions.get(e)??this._sessions.get(this._resolveResource(e));if(!n?.session.forkSession)throw new Error(`Session ${e.toString()} does not support forking`);return n.session.forkSession(t,o)}getContentProviderSchemes(){return Array.from(this._contentProviders.keys())}};Pet=I([m(0,re),m(1,gr),m(2,lt),m(3,X),m(4,Yt),m(5,Pe),m(6,nt)],Pet);Ce(Ms,Pet,1);function zxi(a,i){return W(class extends z{constructor(){super({id:`workbench.action.chat.openNewChatSessionInPlace.${a}`,title:P(8156,"New {0} Session",i),category:fi,f1:!1,precondition:Z.enabled})}async run(t,...o){if(o.length===0)throw new ci("Expected chat session position argument");let n=o[0];if(n!=="sidebar"&&n!=="editor")throw new ci(`Invalid chat session position argument: ${n}`);await Aet(t,{type:a,displayName:d(8117,null),position:n,replaceEditor:!0})}})}function ben(a,i,e){return W(class extends z{constructor(){super({id:`workbench.action.chat.openNewChatSessionExternal.${a}`,title:P(8155,"New {0} Session",i),category:fi,f1:!1,precondition:Z.enabled})}async run(o){await o.get(fe).executeCommand(e)}})}async function Aet(a,i,e){let t=a.get(Gt),o=a.get(si),n=a.get(Ms),r=a.get(re),s=a.get(kt),l=a.get(ie),c=a.get(dh),u=a.get(Wn),p=Gxi(i);try{switch(i.position){case"sidebar":{let h=await t.openView(Xr);i.type===zo.Local?await h.widget.clear():await h.loadSession(p),h.focus();break}case"editor":{let h={override:tl.EditorID,pinned:!0,title:{fallback:d(8122,null,i.displayName)}};if(i.replaceEditor){let g=s.activeGroup.activeEditor;if(!g||!(g instanceof tl))throw new Error("No active chat editor to replace");await l.replaceEditors([{editor:g,replacement:{resource:p,options:h}}],s.activeGroup)}else await l.openEditor({resource:p,options:h});break}default:bs(i.position,`Unknown chat session position: ${i.position}`)}}catch(h){r.error(`Failed to open '${i.type}' chat session with openOptions: ${JSON.stringify(i)}`,h);return}if(e)try{e.initialSessionOptions&&n.updateSessionOptions(p,Sen(e.initialSessionOptions));let h=e.attachedContext,g=await Zmo(e.prompt,i.type,c,u);g&&(h=[g,...h??[]]),await o.sendRequest(p,e.prompt,{agentIdSilent:i.type,attachedContext:h})}catch(h){r.error(`Failed to send initial request to '${i.type}' chat session with contextOptions: ${JSON.stringify(e)}`,h)}}function Sen(a){return a instanceof Map?a:Array.isArray(a)?new Map(a.map(i=>[i.optionId,i.value])):k3.fromRecord(a)}async function Zmo(a,i,e,t){let o=a.match(BYe);if(o){let n=await e.resolvePromptSlashCommand(o[1],i,Ie.None);if(n){let r=n.parsedPromptFile,s=r.body?.variableReferences.map(({name:c,offset:u,fullLength:p})=>({name:c,range:new gi(u,u+p)}))??[],l=t.toToolReferences(s);return H0(r.uri,"vscode.prompt.file",void 0,!0,l)}}}function Gxi(a){return a.type!==zo.Local?A.from({scheme:a.type,path:`/untitled-${ht()}`}):a.position==="editor"?tl.getNewEditorUri():Br.getNewSessionUri()}function Ien(a){return Object.values(zo).includes(a)}function kWt(a){if(a.requestInProgress.get())return 2;let i=a.getRequests().at(-1);if(i?.response)return i.response.state===4?3:i.response.isCanceled||i.response.result?.errorDetails?.code==="canceled"?1:i.response.result?.errorDetails?0:i.response.isComplete?1:2}function eho(a){switch(a){case 2:case 1:return 1;case 3:return 0;case 0:return 2;case 4:return 3}}function cte(a,i){if(i!==void 0)return typeof i=="function"?i(a):i}function yR(a){return cDe(a)&&(a={kind:"terminal",commandLine:{original:a.command,toolEdited:void 0,userEdited:void 0},language:a.language}),a}async function EWt(a){if(!a.editingSession||(await iee(a.editingSession),!a.editingSession)||(await Promise.all(a.editingSession.entries.get().map(t=>t.getDiffInfo?.())),!a.editingSession))return;let e=a.editingSession.entries.get().reduce((t,o)=>(t.fileUris.add(o.originalURI),t.added+=o.linesAdded?.get()??0,t.removed+=o.linesRemoved?.get()??0,t),{fileUris:new xn,added:0,removed:0});if(e.fileUris.size>0&&(e.added>0||e.removed>0))return{fileCount:e.fileUris.size,added:e.added,removed:e.removed}}var ZM=class a{constructor(i,e,t,o,n,r={},s){this.toolCallId=t;this.kind="toolInvocation";this.isAttachedToThinking=!1;this._toolSpecificDataKind=De(this,void 0);this.toolSpecificDataKind=this._toolSpecificDataKind;this._progress=De(this,{progress:0});this._partialInput=De(this,void 0);this._streamingMessage=De(this,void 0);let l="";r.startInStreaming?l=e.displayName:r.startInCancelled&&(l=r.cancelReasonMessage??d(9380,null,e.displayName)),this.invocationMessage=i?.invocationMessage??l,this.pastTenseMessage=i?.pastTenseMessage,this.originMessage=i?.originMessage,this.confirmationMessages=i?.confirmationMessages,this.presentation=i?.presentation,this.toolSpecificData=i?.toolSpecificData,this.toolId=e.id,this.icon=i?.icon??(e.icon&&q.isThemeIcon(e.icon)?e.icon:void 0),this.source=e.source,this.subAgentInvocationId=o,this.parameters=n,this.chatRequestId=s,r.startInCancelled?this._state=De(this,{type:pi.StateKind.Cancelled,reason:r.cancelReason??0,reasonMessage:r.cancelReasonMessage,parameters:this.parameters,confirmationMessages:this.confirmationMessages}):r.startInStreaming?this._state=De(this,{type:pi.StateKind.Streaming,partialInput:this._partialInput,streamingMessage:this._streamingMessage}):this.confirmationMessages?.title?this._state=De(this,{type:pi.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:c=>{c.type===0||c.type===5?this._state.set({type:pi.StateKind.Cancelled,reason:c.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:pi.StateKind.Executing,confirmed:c,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}}):this._state=De(this,{type:pi.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(i){this._toolSpecificData=i,this._toolSpecificDataKind.set(i?.kind,void 0)}get state(){return this._state}static createStreaming(i){return new a(void 0,i.toolData,i.toolCallId,i.subagentInvocationId,void 0,{startInStreaming:!0},i.chatRequestId)}static createCancelled(i,e,t,o){return new a(void 0,i.toolData,i.toolCallId,i.subagentInvocationId,e,{startInCancelled:!0,cancelReason:t,cancelReasonMessage:o},i.chatRequestId)}updatePartialInput(i){this._state.get().type===pi.StateKind.Streaming&&this._partialInput.set(i,void 0)}updateStreamingMessage(i){this._state.get().type===pi.StateKind.Streaming&&this._streamingMessage.set(i,void 0)}notifyToolSpecificDataChanged(){let i=this._state.get();this._state.set({...i},void 0)}cancelFromStreaming(i,e){return this._state.get().type!==pi.StateKind.Streaming?!1:(this._state.set({type:pi.StateKind.Cancelled,reason:i,reasonMessage:e,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0),!0)}transitionFromStreaming(i,e,t){if(this._state.get().type!==pi.StateKind.Streaming)return;let n=this._streamingMessage.get();n&&!i?.invocationMessage&&(this.invocationMessage=n),this.parameters=e,i&&(i.invocationMessage&&(this.invocationMessage=i.invocationMessage),this.pastTenseMessage=i.pastTenseMessage,this.confirmationMessages=i.confirmationMessages,this.presentation=i.presentation,this.toolSpecificData=i.toolSpecificData);let r=s=>{s.type===0||s.type===5?this._state.set({type:pi.StateKind.Cancelled,reason:s.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0):this._state.set({type:pi.StateKind.Executing,confirmed:s,progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)};t?r(t):this.confirmationMessages?.title?this._state.set({type:pi.StateKind.WaitingForConfirmation,parameters:this.parameters,confirmationMessages:this.confirmationMessages,confirm:r},void 0):this._state.set({type:pi.StateKind.Executing,confirmed:{type:1,reason:this.confirmationMessages?.confirmationNotNeededReason},progress:this._progress,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}_setCompleted(i,e){if(e&&(e.type===0||e.type===5)){this._state.set({type:pi.StateKind.Cancelled,reason:e.type,parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0);return}this._state.set({type:pi.StateKind.Completed,confirmed:pi.executionConfirmedOrDenied(this)||{type:1},resultDetails:i?.toolResultDetails,postConfirmed:e,contentForModel:i?.content||[],parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}async didExecuteTool(i,e,t){if(i?.toolResultMessage?this.pastTenseMessage=i.toolResultMessage:this._progress.get().message&&(this.pastTenseMessage=this._progress.get().message),this.confirmationMessages?.confirmResults&&!i?.toolResultError&&i?.confirmResults!==!1&&!e){let o=await t?.();o?this._setCompleted(i,o):this._state.set({type:pi.StateKind.WaitingForPostApproval,confirmed:pi.executionConfirmedOrDenied(this)||{type:1},resultDetails:i?.toolResultDetails,contentForModel:i?.content||[],confirm:n=>this._setCompleted(i,n),parameters:this.parameters,confirmationMessages:this.confirmationMessages},void 0)}else this._setCompleted(i);return this._state.get()}acceptProgress(i){let e=this._progress.get();this._progress.set({progress:i.progress||e.progress||0,message:i.message},void 0)}toJSON(){let i=this.state.get().type===pi.StateKind.WaitingForPostApproval,e=i?void 0:pi.resultDetails(this);return{kind:"toolInvocationSerialized",presentation:this.presentation,invocationMessage:this.invocationMessage,pastTenseMessage:this.pastTenseMessage,originMessage:this.originMessage,isConfirmed:i?{type:5}:pi.executionConfirmedOrDenied(this),isComplete:!0,source:this.source,resultDetails:RH(e)?{output:{type:"data",mimeType:e.output.mimeType,base64Data:gc(e.output.value)}}:e,toolSpecificData:this.toolSpecificData,toolCallId:this.toolCallId,toolId:this.toolId,subAgentInvocationId:this.subAgentInvocationId,generatedTitle:this.generatedTitle}}};var f_=class{constructor(i,e,t,o,n,r,s,l,c){this.title=i;this.content=e;this.actions=t;this.canProvideFeedback=o;this.planUri=n;this.resolveId=r;this.data=s;this.isUsed=l;this.source=c;this.kind="planReview";this.completion=new Mo}dismiss(){this.isUsed||(this.isUsed=!0,this.draftFeedback=void 0,this.draftCollapsed=void 0,this.completion.complete(void 0))}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,source:this.source}}};var nI=class{constructor(i,e,t,o,n,r,s,l){this.questions=i;this.allowSkip=e;this.resolveId=t;this.data=o;this.isUsed=n;this.message=r;this.source=s;this.terminalId=l;this.kind="questionCarousel";this.completion=new Mo}dismiss(i){this.isUsed||(this.data=i??{},this.isUsed=!0,this.draftAnswers=void 0,this.draftCurrentIndex=void 0,this.draftCollapsed=void 0,this.completion.complete({answers:i}))}toJSON(){return{kind:this.kind,questions:this.questions,allowSkip:this.allowSkip,resolveId:this.resolveId,data:this.data,isUsed:this.isUsed,message:this.message,source:this.source,terminalId:this.terminalId}}};var RWt={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function R8(a){return Object.entries(RWt).find(([i,e])=>e===a)?.[0]}var tho;(i=>{function a(e){return{variables:e.variables.map(eR.toExport)}}i.toExport=a})(tho||={});function yen(a){let i=a;return!!i&&!!i.edit&&!!i.uri&&A.isUri(i.uri)}function nMe(a){return a.some(yen)}var wen=new Set(["toolInvocation","toolInvocationSerialized","undoStop"]);function Cen(a){return!wen.has(a.kind)}function iho(a){return a.filter(Cen)}var aU={reason:"other"},lU=class{constructor(i){this._shouldBeBlocked=De(this,!1);this._version=0;this._session=i.session,this.message=i.message,this._variableData=i.variableData,this.timestamp=i.timestamp,this._attempt=i.attempt??0,this.modeInfo=i.modeInfo,this._confirmation=i.confirmation,this._locationData=i.locationData,this._attachedContext=i.attachedContext,this.isCompleteAddedRequest=i.isCompleteAddedRequest??!1,this.modelId=i.modelId,this.id=i.restoredId??"request_"+ht(),this._editedFileEvents=i.editedFileEvents,this.userSelectedTools=i.userSelectedTools,this.isSystemInitiated=i.isSystemInitiated,this.systemInitiatedLabel=i.systemInitiatedLabel,this.terminalExecutionId=i.terminalExecutionId}get shouldBeBlocked(){return this._shouldBeBlocked}setShouldBeBlocked(i){this._shouldBeBlocked.set(i,void 0)}get session(){return this._session}get attempt(){return this._attempt}get variableData(){return this._variableData}set variableData(i){this._version++,this._variableData=i}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(i){this._session=i}},TWt=class{get value(){return this._responseParts}constructor(i){this._responseParts=i}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 i=this._responseParts,e=i.length-1;for(;e>=0;){let r=i[e];if(r.kind==="markdownContent"||r.kind==="markdownVuln"){if(r.content.value.length>0)break}else if(r.kind==="inlineReference")break;e--}if(e<0)return"";let t=e;for(;e>=0;){let r=i[e];if(r.kind==="markdownContent"||r.kind==="markdownVuln"||r.kind==="inlineReference")e--;else break}let o=e+1,n=[];for(let r=o;r<=t;r++){let s=i[r];s.kind==="inlineReference"?n.push(this.inlineRefToRepr(s)):(s.kind==="markdownContent"||s.kind==="markdownVuln")&&s.content.value.length>0&&n.push(s.content.value)}return n.join("")}_invalidateRepr(){this._responseRepr=void 0,this._markdownContent=void 0}computeMarkdownContent(){let i=[];for(let e of this._responseParts)e.kind==="inlineReference"?i.push(this.inlineRefToRepr(e)):(e.kind==="markdownContent"||e.kind==="markdownVuln")&&e.content.value.length>0&&i.push(e.content.value);return i.join("")}computeRepr(){return this.partsToRepr(this._responseParts)}partsToRepr(i){let e=[],t=[],o=!1;for(let n of i){let r;switch(n.kind){case"clearToPreviousToolInvocation":t=[],e.length=0,o=!1;continue;case"treeData":case"progressMessage":case"codeblockUri":case"extensions":case"pullRequest":case"undoStop":case"workspaceEdit":case"elicitation2":case"elicitationSerialized":case"thinking":case"hook":case"multiDiffData":case"mcpServersStarting":case"questionCarousel":case"planReview":case"disabledClaudeHooks":continue;case"toolInvocation":case"toolInvocationSerialized":r=this.getToolInvocationText(n);break;case"inlineReference":r={text:this.inlineRefToRepr(n)};break;case"command":r={text:n.command.title,isBlock:!0};break;case"textEditGroup":case"notebookEditGroup":o=!0;continue;case"confirmation":if(n.message instanceof he){r={text:`${n.title}
${n.message.value}`,isBlock:!0};break}r={text:`${n.title}
${n.message}`,isBlock:!0};break;case"markdownContent":case"markdownVuln":case"progressTask":case"progressTaskSerialized":case"warning":case"info":r={text:n.content.value};break;default:continue}r.isBlock?(t.length&&(e.push(t.join("")),t=[]),e.push(r.text)):t.push(r.text)}return t.length&&e.push(t.join("")),o&&e.push(d(9375,null)),e.join(`

`)}inlineRefToRepr(i){return"uri"in i.inlineReference?this.uriToRepr(i.inlineReference.uri):"name"in i.inlineReference?"`"+i.inlineReference.name+"`":this.uriToRepr(i.inlineReference)}getToolInvocationText(i){let e=r=>r.presentationOverrides?.commandLine??r.commandLine.forDisplay??r.commandLine.userEdited??r.commandLine.toolEdited??r.commandLine.original,t="",o="";if(i.pastTenseMessage?t=typeof i.pastTenseMessage=="string"?i.pastTenseMessage:i.pastTenseMessage.value:t=typeof i.invocationMessage=="string"?i.invocationMessage:i.invocationMessage.value,i.toolSpecificData&&i.toolSpecificData.kind==="terminal"){t="Ran terminal command";let r=yR(i.toolSpecificData);o=e(r)}let n=t;if(o&&(n+=`: ${o}`),i.kind==="toolInvocationSerialized"||i.kind==="toolInvocation"&&pi.isComplete(i)){let r=pi.resultDetails(i);if(r&&"input"in r){let s=i.kind==="toolInvocationSerialized"||pi.isComplete(i)?"Completed":"Errored",l=i.toolSpecificData?.kind==="terminal"?e(yR(i.toolSpecificData)):r.input;n+=`
${s} with input: ${l}`}}return{text:n,isBlock:!0}}uriToRepr(i){return i.scheme===Q.http||i.scheme===Q.https?i.toString(!1):Be(i)}},qxi=class extends TWt{constructor(e,t){let o=e.value.findIndex(n=>n.kind==="undoStop"&&n.id===t);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=t}},$xi=class extends TWt{constructor(e){super(Ec(e).map(t=>"kind"in t?t:yr(t)?{content:t,kind:"markdownContent"}:{kind:"treeData",treeData:t}));this._store=new O;this._onDidChangeValue=this._store.add(new T);this._citations=[]}get onDidChangeValue(){return this._onDidChangeValue.event}dispose(){this._store.dispose()}clear(){this._responseParts=[],this._contentChanged(!0)}clearToPreviousToolInvocation(e){let t=-1;for(let o=this._responseParts.length-1;o>=0;o--){let n=this._responseParts[o];if(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized"){t=o;break}}t!==-1?this._responseParts=this._responseParts.slice(0,t+1):this._responseParts=[],e&&this._responseParts.push({kind:"warning",content:new he(e)}),this._contentChanged(!0)}updateContent(e,t){if(e.kind==="clearToPreviousToolInvocation"){e.reason===2?this.clearToPreviousToolInvocation(d(9374,null)):e.reason===1?this.clearToPreviousToolInvocation(d(9376,null)):this.clearToPreviousToolInvocation();return}else if(e.kind==="markdownContent"){let o=this._responseParts.filter(n=>n.kind!=="textEditGroup").at(-1);if(!o||o.kind!=="markdownContent"||!_Wt(o.content,e.content))this._responseParts.push(e);else{let n=this._responseParts.indexOf(o);this._responseParts[n]={...o,content:dte(o.content,e.content)}}this._contentChanged(t)}else if(e.kind==="thinking"){let o=this._responseParts.filter(l=>l.kind!=="textEditGroup").at(-1),n=o&&o.kind==="thinking"?Array.isArray(o.value)?o.value.join(""):o.value||"":"",r=Array.isArray(e.value)?e.value.join(""):e.value||"",s=l=>l.length===0;if(!o||o.kind!=="thinking"||s(r)||s(n)||!_Wt(new he(n),new he(r)))this._responseParts.push(e);else{let l=this._responseParts.indexOf(o);this._responseParts[l]={...o,value:dte(new he(n),new he(r)).value}}this._contentChanged(t)}else if(e.kind==="textEdit"||e.kind==="notebookEdit"){let o=sn.parse(e.uri)?.notebook,n=o??e.uri,r=e.isExternalEdit;if(e.kind==="textEdit"&&!o)this._mergeOrPushTextEditGroup(n,e.edits,e.done,r);else if(e.kind==="textEdit"){let s=e.edits.map(l=>({uri:e.uri,edit:l}));this._mergeOrPushNotebookEditGroup(n,s,e.done,r)}else this._mergeOrPushNotebookEditGroup(n,e.edits,e.done,r);this._contentChanged(t)}else if(e.kind==="progressTask"){let o=this._responseParts.push(e)-1;this._contentChanged(t);let n=e.onDidAddProgress(()=>{this._contentChanged(!1)});e.task?.().then(r=>{n.dispose(),typeof r=="string"&&(this._responseParts[o].content=new he(r)),this._contentChanged(!1)})}else e.kind==="toolInvocation"?(roi(this._store,o=>{e.state.read(o),this._contentChanged(!1),pi.isComplete(e,o)&&o.dispose()}),this._responseParts.push(e),this._contentChanged(t)):e.kind==="externalToolInvocationUpdate"?(this._handleExternalToolInvocationUpdate(e),this._contentChanged(t)):(this._responseParts.push(e),this._contentChanged(t))}addCitation(e){this._citations.push(e),this._contentChanged()}resolveInlineReference(e,t){for(let o=0;o<this._responseParts.length;o++){let n=this._responseParts[o];if(!(n.kind!=="inlineReference"||n.resolveId!==e))return this._responseParts[o]={...n,inlineReference:t.inlineReference,name:t.name??n.name},this._contentChanged(),!0}return!1}_mergeOrPushTextEditGroup(e,t,o,n){for(let r of this._responseParts)if(r.kind==="textEditGroup"&&!r.done&&ze(r.uri,e)){r.edits.push(t),r.done=o;return}this._responseParts.push({kind:"textEditGroup",uri:e,edits:[t],done:o,isExternalEdit:n})}_mergeOrPushNotebookEditGroup(e,t,o,n){for(let r of this._responseParts)if(r.kind==="notebookEditGroup"&&!r.done&&ze(r.uri,e)){r.edits.push(t),r.done=o;return}this._responseParts.push({kind:"notebookEditGroup",uri:e,edits:[t],done:o,isExternalEdit:n})}_handleExternalToolInvocationUpdate(e){let t=this._responseParts.findLast(r=>r.kind==="toolInvocation"&&r.toolCallId===e.toolCallId);if(t){e.toolSpecificData!==void 0&&(t.toolSpecificData=e.toolSpecificData),e.isComplete&&t.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage,toolResultDetails:e.resultDetails});return}let o={id:e.toolName,source:wn.External,displayName:e.toolName,modelDescription:e.toolName},n=new ZM({invocationMessage:e.invocationMessage,pastTenseMessage:e.pastTenseMessage,toolSpecificData:e.toolSpecificData},o,e.toolCallId,e.subagentInvocationId,void 0,{},void 0);e.isComplete&&(e.toolSpecificData!==void 0&&(n.toolSpecificData=e.toolSpecificData),n.didExecuteTool({content:[],toolResultMessage:e.pastTenseMessage,toolResultError:e.errorMessage,toolResultDetails:e.resultDetails})),this._responseParts.push(n)}computeRepr(){let e=super.computeRepr();return this._citations.length&&(e+=`

`+Yxi(this._citations)),e}_contentChanged(e){this._invalidateRepr(),e||this._onDidChangeValue.fire()}},oMe=class extends k{constructor(e){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._modelState=De(this,{value:0});this._usageObs=De(this,void 0);this._completionTokenCountObs=De(this,void 0);this._shouldBeBlocked=De(this,!1);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._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||yr(e.responseContent)&&e.responseContent.value.length!==0),this._response=this._register(new $xi(e.responseContent)),this._codeBlockInfos=e.codeBlockInfos?[...e.codeBlockInfos]:void 0;let t=qr(this,this.onDidChange),o=t.map((s,l)=>{t.read(l);for(let c of this._response.value){if(c.kind==="toolInvocation"){let u=c.state.read(l);if(u.type===pi.StateKind.WaitingForConfirmation){let p=u.confirmationMessages?.title;return p?yr(p)?p.value:p:void 0}if(u.type===pi.StateKind.WaitingForPostApproval)return d(9378,null)}if(c.kind==="confirmation"&&!c.isUsed)return c.title;if(c.kind==="questionCarousel"&&!c.isUsed)return d(9377,null);if(c.kind==="planReview"&&!c.isUsed)return d(9379,null);if(c.kind==="elicitation2"&&c.state.read(l)==="pending"){let u=c.title;return yr(u)?u.value:u}}}),n=o.map(s=>!!s).map(s=>s?Date.now():void 0);this.isPendingConfirmation=n.map((s,l)=>s?{startedWaitingAt:s,detail:o.read(l)}:void 0),this.isInProgress=t.map((s,l)=>(t.read(l),!o.read(l)&&!this.shouldBeRemovedOnSend&&(this._modelState.read(l).value===0||this._modelState.read(l).value===4))),this.isIncomplete=this._modelState.map(s=>s.value===0||s.value===4),this._register(this._response.onDidChangeValue(()=>this._onDidChange.fire(aU))),this.id=e.restoredId??"response_"+ht();let r;this.confirmationAdjustedTimestamp=ke(s=>{let l=this.isPendingConfirmation.read(s);return l?(this._modelState.set({value:4},void 0),r||(r=l.startedWaitingAt)):r&&(this._modelState.read(s).value===4&&this._modelState.set({value:0},void 0),this._timeSpentWaitingAccumulator+=Date.now()-r,r=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 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(aU))}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 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 qxi(this._response,e)),this._responseView):this._finalizedResponse||this._response}get codeBlockInfos(){return this._codeBlockInfos}initializeCodeBlockInfos(e){if(this._codeBlockInfos)throw new ci("Code block infos have already been initialized");this._codeBlockInfos=[...e]}setBlockedState(e){this._shouldBeBlocked.set(e,void 0)}updateContent(e,t){this._response.updateContent(e,t)}resolveInlineReference(e,t){return this._response.resolveInlineReference(e,t)}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(aU))}applyCodeCitation(e){this._codeCitations.push(e),this._response.addCitation(e),this._onDidChange.fire(aU)}setAgent(e,t){this._agent=e,this._slashCommand=t,this._agentOrSlashCommandDetected=!e.isDefault||!!t,this._onDidChange.fire(aU)}setResult(e){this._result=e,this._onDidChange.fire(aU)}setUsage(e){if(this.isSameUsage(e))return;this._usageObs.set(e,void 0);let t=this._completionTokenCountObs.get()??0;this._completionTokenCountObs.set(t+e.completionTokens,void 0),this._onDidChange.fire(aU)}isSameUsage(e){let t=this._usageObs.get();return!!t&&t.promptTokens===e.promptTokens&&t.completionTokens===e.completionTokens&&t.outputBuffer===e.outputBuffer&&Qi(t.promptTokenDetails,e.promptTokenDetails)}complete(){if(this.isComplete)return;this._result?.errorDetails?.responseIsRedacted&&this._response.clear(),this._elapsedMs=Math.max(0,Date.now()-this.confirmationAdjustedTimestamp.get());let e=this._result?.errorDetails&&this._result.errorDetails.code!=="canceled"?3:1;this._modelState.set({value:e,completedAt:Date.now()},void 0),this._onDidChange.fire({reason:"completedRequest"})}cancel(){for(let e of this._response.value)e.kind==="toolInvocation"&&e instanceof ZM?e.cancelFromStreaming(5):e instanceof f_?e.dismiss():e instanceof nI&&e.dismiss(void 0);this._modelState.set({value:2,completedAt:Date.now()},void 0),this._onDidChange.fire({reason:"completedRequest"})}setFollowups(e){this._followups=e,this._onDidChange.fire(aU)}setVote(e){this._vote=e,this._onDidChange.fire(aU)}setEditApplied(e,t){return!this.response.value.includes(e)||!e.state?!1:(e.state.applied=t,this._onDidChange.fire(aU),!0)}adoptTo(e){this._session=e,this._onDidChange.fire(aU)}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(),t=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,timestamp:this._timestamp,timeSpentWaiting:(t?Date.now()-t.startedWaitingAt:0)+this._timeSpentWaitingAccumulator,completionTokens:this.completionTokenCount,elapsedMs:this.elapsedMs??(this.completedAt?Math.max(0,this.completedAt-this.confirmationAdjustedTimestamp.get()):void 0)}}};function LWt(a){return xen(a),"version"in a?a.version===2?{...a,version:3,customTitle:a.computedTitle}:a:{version:3,...a,customTitle:void 0}}function xen(a){a.sessionId||(a.sessionId=ht()),a.creationDate||(a.creationDate=ken()),a.initialLocation==="editing-session"&&(a.initialLocation="panel")}function ken(){let a=new Date;return a.setFullYear(a.getFullYear()-1),a.getTime()}function MWt(a){return!!a&&Array.isArray(a.requests)&&typeof a.responderUsername=="string"}function Een(a){let i=a;return MWt(a)&&typeof i.creationDate=="number"&&typeof i.sessionId=="string"&&a.requests.every(e=>!e.usedContext||Dao(e.usedContext))}var jxi=class{constructor(i){this._state=Xm({debugName:"inputModelState",equalsFn:Qi},i),this.state=this._state}setState(i){let e=this._state.get();this._state.set({attachments:[],mode:{id:"agent",kind:"agent"},selectedModel:void 0,inputText:"",selections:[],contrib:{},...e,...i},void 0)}clearState(){this._state.set(void 0,void 0)}toJSON(){let i=this.state.get();if(!i)return;let e=i.attachments.filter(t=>!(N2(t)||IPt(t)&&hE(t.value)));return{contrib:i.contrib,attachments:e.map(eR.toExport),mode:i.mode,selectedModel:i.selectedModel?{identifier:i.selectedModel.identifier,metadata:i.selectedModel.metadata}:void 0,inputText:i.inputText,selections:i.selections,permissionLevel:i.permissionLevel}}},ty=class extends k{constructor(e,t,o,n,r,s){super();this.logService=o;this.chatAgentService=n;this.chatEditingService=r;this.chatService=s;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 dt;this._checkpoint=void 0;let l=e?.value,c=MWt(l),u=c&&Een(l);l&&!c&&this.logService.warn(`ChatModel#constructor: Loaded malformed session data: ${JSON.stringify(l)}`),this._isImported=!!l&&c&&!u,t.resource?(this._sessionId=jp(t.resource),this._sessionResource=t.resource):u?(this._sessionId=l.sessionId,this._sessionResource=Br.forSession(l.sessionId)):(this._sessionId=ht(),this._sessionResource=Br.forSession(this._sessionId)),this._disableBackgroundKeepAlive=t.disableBackgroundKeepAlive??!1,this._requests=l?this._deserialize(l):[],this._timestamp=u&&l.creationDate||Date.now(),this._customTitle=u?l.customTitle:void 0;let p=t.inputState||(u&&l.inputState?l.inputState:void 0);if(this.inputModel=new jxi(p&&{attachments:(p.attachments??[]).map(eR.fromExport),mode:p.mode,selectedModel:p.selectedModel&&{identifier:p.selectedModel.identifier,metadata:p.selectedModel.metadata},contrib:p.contrib,inputText:p.inputText,selections:p.selections,permissionLevel:p.permissionLevel}),this.dataSerializer=e?.serializer,this._initialResponderUsername=l?.responderUsername,this._repoData=u&&l.repoData?l.repoData:void 0,this._workingDirectory=u&&l.workingDirectory?A.parse(l.workingDirectory):void 0,u&&l.pendingRequests&&(this._pendingRequests=this._deserializePendingRequests(l.pendingRequests)),this._initialLocation=l?.initialLocation??t.initialLocation,this._canUseTools=t.canUseTools,this.lastRequestObs=vi(this,this.onDidChange,()=>this._requests.at(-1)),this._register(ve(h=>{let g=this.lastRequestObs.read(h);g?.response&&h.store.add(g.response.onDidChange(async f=>{!this._editingSession||f.reason!=="completedRequest"||this._onDidChange.fire({kind:"completedRequest",request:g})}))})),this.requestInProgress=this.lastRequestObs.map((h,g)=>h?.response?.isInProgress.read(g)??!1),this.hasActiveRequest=this.lastRequestObs.map((h,g)=>h?.response?.isIncomplete.read(g)??!1),this.requestNeedsInput=this.lastRequestObs.map((h,g)=>{let f=h?.response?.isPendingConfirmation.read(g);if(f)return{title:this.title,detail:f.detail}}),this.initialLocation==="panel"&&!t.disableBackgroundKeepAlive){let h=this._register(new ue);this._register(ve(g=>{let f=this.requestInProgress.read(g),v=this.requestNeedsInput.read(g),b=f||!!v;b&&!h.value?h.value=s.acquireExistingSession(this._sessionResource,"ChatModel#requestInProgressKeepAlive"):!b&&h.value&&h.clear()}))}}static getDefaultTitle(e){let t=e.at(0)?.message??"";return(typeof t=="string"?t:t.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 t=new Map(this._pendingRequests.map(n=>[n.request.id,n])),o=[];for(let{requestId:n,kind:r}of e){let s=t.get(n);s&&o.push(s.kind===r?s:{request:s.request,kind:r,sendOptions:s.sendOptions})}this._pendingRequests.length=0,this._pendingRequests.push(...o),this._onDidChangePendingRequests.fire()}addPendingRequest(e,t,o){let n={request:e,kind:t,sendOptions:o};if(t==="steering"){let r=0;for(let s=0;s<this._pendingRequests.length&&this._pendingRequests[s].kind==="steering";s++)r=s+1;this._pendingRequests.splice(r,0,n)}else this._pendingRequests.push(n);return this._onDidChangePendingRequests.fire(),n}removePendingRequest(e){let t=this._pendingRequests.findIndex(o=>o.request.id===e);t!==-1&&(this._pendingRequests.splice(t,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 timestamp(){return this._timestamp}get timing(){let e=this._requests.at(-1),t=e?.response,o=e?.timestamp,n=t?.completedAt??t?.timestamp;return{created:this._timestamp,lastRequestStarted:o,lastRequestEnded:n}}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||ty.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,t){let o=this._editingSession??=this._register(t?this.chatEditingService.transferEditingSession(this,t):e?this.chatEditingService.startOrContinueGlobalEditingSession(this):this.chatEditingService.createEditingSession(this));if(!this._disableBackgroundKeepAlive){let n=this._register(new ue);this._register(ve(r=>{let s=o.entries.read(r).some(l=>l.state.read(r)===0);s&&!n.value?n.value=this.chatService.acquireExistingSession(this._sessionResource,"ChatModel#modifiedEditsKeepAlive"):!s&&n.value&&n.clear()}))}this._register(ve(n=>{this._setDisabledRequests(o.requestDisablement.read(n))}))}notifyEditingAction(e){let t=e.outcome==="accepted"?1:e.outcome==="rejected"?2:e.outcome==="userModified"?3:null;t!==null&&(!this.currentEditedFileEvents.has(e.uri)||this.currentEditedFileEvents.get(e.uri)?.eventKind===1)&&this.currentEditedFileEvents.set(e.uri,{eventKind:t,uri:e.uri})}_deserialize(e){let t=yo(e,{serializer:!0})?e.value.requests:e.requests;if(!Array.isArray(t))return this.logService.error(`Ignoring malformed session data: ${JSON.stringify(e)}`),[];try{return t.map(o=>this._deserializeRequest(o))}catch(o){return this.logService.error("Failed to parse chat data",o),[]}}_deserializeRequest(e){let t=typeof e.message=="string"?this.getParsedRequestFromString(e.message):xao(e.message),o=this.reviveVariableData(e.variableData),n=new lU({session:this,message:t,variableData:o,timestamp:e.timestamp??-1,restoredId:e.requestId,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId,modeInfo:e.modeInfo,isSystemInitiated:e.isSystemInitiated,systemInitiatedLabel:e.systemInitiatedLabel,terminalExecutionId:e.terminalExecutionId});if(n.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,e.response||e.result||e.responseErrorDetails){let r=e.agent&&"metadata"in e.agent?mPt(e.agent):void 0,s="responseErrorDetails"in e?{errorDetails:e.responseErrorDetails}:e.result,l=e.modelState||{value:e.isCanceled?2:1,completedAt:Date.now()};if((l.value===0||l.value===4)&&(l={value:2,completedAt:Date.now()}),e.response)for(let c of e.response)yo(c,{kind:!0})&&(c.kind==="questionCarousel"||c.kind==="planReview")&&(c.isUsed=!0);n.response=new oMe({responseContent:e.response??[new he(e.response)],session:this,agent:r,slashCommand:e.slashCommand,requestId:n.id,modelState:l,vote:e.vote,timestamp:e.timestamp,result:s,followups:e.followups,restoredId:e.responseId,timeSpentWaiting:e.timeSpentWaiting,elapsedMs:e.elapsedMs,shouldBeBlocked:n.shouldBeBlocked.get(),codeBlockInfos:e.responseMarkdownInfo?.map(c=>({suggestionId:c.suggestionId}))}),n.response.shouldBeRemovedOnSend=e.isHidden?{requestId:e.requestId}:e.shouldBeRemovedOnSend,typeof e.completionTokens=="number"&&n.response.setUsage({kind:"usage",promptTokens:0,completionTokens:e.completionTokens}),e.usedContext&&n.response.applyReference(er(e.usedContext)),e.contentReferences?.forEach(c=>n.response.applyReference(er(c))),e.codeCitations?.forEach(c=>n.response.applyCodeCitation(er(c)))}return n}reviveVariableData(e){let t=e&&Array.isArray(e.variables)?e:{variables:[]};return t.variables=t.variables.map(eR.fromExport),t}getParsedRequestFromString(e){let t=[new Yb(new gi(0,e.length),{startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1},e)];return{text:e,parts:t}}_deserializePendingRequests(e){try{return e.map(t=>({id:t.id,request:this._deserializeRequest(t.request),kind:t.kind,sendOptions:{...t.sendOptions,userSelectedTools:t.sendOptions.userSelectedTools?Fo(t.sendOptions.userSelectedTools):void 0}}))}catch(t){return this.logService.error("Failed to parse pending chat requests",t),[]}}getRequests(){return this._requests}resetCheckpoint(){for(let e of this._requests)e.setShouldBeBlocked(!1),e.response&&e.response.setBlockedState(!1)}setCheckpoint(e){let t,o=-1;if(!(e!==void 0&&(this._requests.forEach((n,r)=>{n.id===e&&(o=r,t=n,n.setShouldBeBlocked(!0))}),!t))){for(let n=this._requests.length-1;n>=0;n-=1){let r=this._requests[n];this._checkpoint&&!t?(r.setShouldBeBlocked(!1),r.response&&r.response.setBlockedState(!1)):t&&n>=o?(r.setShouldBeBlocked(!0),r.response&&r.response.setBlockedState(!0)):t&&n<o&&(r.setShouldBeBlocked(!1),r.response&&r.response.setBlockedState(!1))}this._checkpoint=t}}get checkpoint(){return this._checkpoint}_setDisabledRequests(e){this._requests.forEach(t=>{let o=e.find(n=>n.requestId===t.id);t.shouldBeRemovedOnSend=o,t.response&&(t.response.shouldBeRemovedOnSend=o)}),this._onDidChange.fire({kind:"setHidden"})}addRequest(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){let y=[...this.currentEditedFileEvents.values()];this.currentEditedFileEvents.clear();let w=new lU({restoredId:f,session:this,message:e,variableData:t,timestamp:Date.now(),attempt:o,modeInfo:n,confirmation:l,locationData:c,attachedContext:u,isCompleteAddedRequest:p,modelId:h,editedFileEvents:y.length?y:void 0,userSelectedTools:g,isSystemInitiated:v,systemInitiatedLabel:b,terminalExecutionId:S});return w.response=new oMe({responseContent:[],session:this,agent:r,slashCommand:s,requestId:w.id,isCompleteAddedRequest:p,codeBlockInfos:void 0}),this._requests.push(w),V0(this.sessionResource,W0.RequestUiUpdated),this._onDidChange.fire({kind:"addRequest",request:w}),w}setCustomTitle(e){this._customTitle=e,this._onDidChange.fire({kind:"setCustomTitle",title:e})}updateRequest(e,t){e.variableData=t,this._onDidChange.fire({kind:"changedRequest",request:e})}adoptRequest(e){let t=e.session,o=t._requests.findIndex(n=>n.id===e.id);o!==-1&&(t._requests.splice(o,1),e.adoptTo(this),e.response?.adoptTo(this),this._requests.push(e),t._onDidChange.fire({kind:"removeRequest",requestId:e.id,responseId:e.response?.id,reason:2}),this._onDidChange.fire({kind:"addRequest",request:e}))}acceptResponseProgress(e,t,o){if(e.response||(e.response=new oMe({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");t.kind==="usage"?e.response.setUsage(t):t.kind==="usedContext"||t.kind==="reference"?e.response.applyReference(t):t.kind==="codeCitation"?e.response.applyCodeCitation(t):t.kind==="move"?this._onDidChange.fire({kind:"move",target:t.uri,range:t.range}):t.kind==="codeblockUri"&&t.isEdit?(e.response.addUndoStop({id:t.undoStopId??ht(),kind:"undoStop"}),e.response.updateContent(t,o)):t.kind==="progressTaskResult"?this.logService.error(`Couldn't handle progress: ${JSON.stringify(t)}`):e.response.updateContent(t,o)}removeRequest(e,t=0){let o=this._requests.findIndex(r=>r.id===e),n=this._requests[o];o!==-1&&(this._onDidChange.fire({kind:"removeRequest",requestId:n.id,responseId:n.response?.id,reason:t}),this._requests.splice(o,1),n.response?.dispose())}cancelRequest(e){e.response&&e.response.cancel()}setResponse(e,t){e.response||(e.response=new oMe({responseContent:[],session:this,requestId:e.id,codeBlockInfos:void 0})),e.response.setResult(t)}setFollowups(e,t){e.response&&e.response.setFollowups(t)}setResponseModel(e,t){e.response=t,this._onDidChange.fire({kind:"addResponse",response:t})}toExport(){return{responderUsername:this.responderUsername,initialLocation:this.initialLocation,requests:this._requests.map(e=>{let t={...e.message,parts:e.message.parts.map(r=>r&&"toJSON"in r?r.toJSON():r)},o=e.response?.agent,n=o&&"toJSON"in o?o.toJSON():o?{...o}:void 0;return{requestId:e.id,message:t,variableData:tho.toExport(e.variableData),response:e.response?e.response.entireResponse.value.map(r=>r.kind==="treeData"?r.treeData:r.kind==="markdownContent"?r.content:r):void 0,shouldBeRemovedOnSend:e.shouldBeRemovedOnSend,agent:n,timestamp:e.timestamp,confirmation:e.confirmation,editedFileEvents:e.editedFileEvents,modelId:e.modelId,modeInfo:e.modeInfo,isSystemInitiated:e.isSystemInitiated||void 0,systemInitiatedLabel:e.systemInitiatedLabel,terminalExecutionId:e.terminalExecutionId,...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}};ty=I([m(2,re),m(3,gr),m(4,mu),m(5,si)],ty);function Qxi(a,i){return{variables:a.variables.map(e=>({...e,range:e.range&&{start:e.range.start-i,endExclusive:e.range.endExclusive-i}}))}}function _Wt(a,i){if(a.baseUri&&i.baseUri){if(!(a.baseUri.scheme===i.baseUri.scheme&&a.baseUri.authority===i.baseUri.authority&&a.baseUri.path===i.baseUri.path&&a.baseUri.query===i.baseUri.query&&a.baseUri.fragment===i.baseUri.fragment))return!1}else if(a.baseUri||i.baseUri)return!1;return Qi(a.isTrusted,i.isTrusted)&&a.supportHtml===i.supportHtml&&a.supportThemeIcons===i.supportThemeIcons}function dte(a,i){let e=typeof i=="string"?i:i.value;return{value:a.value+e,isTrusted:a.isTrusted,supportThemeIcons:a.supportThemeIcons,supportHtml:a.supportHtml,baseUri:a.baseUri}}function Yxi(a){if(a.length===0)return"";let i=a.reduce((t,o)=>t.add(o.license),new Set);return i.size===1?d(9372,null,i.size):d(9373,null,i.size)}function oho(a){return{modeInfo:a.modeInfo,userSelectedModelId:a.userSelectedModelId,userSelectedTools:a.userSelectedTools?.get(),location:a.location,locationData:a.locationData,attempt:a.attempt,noCommandDetection:a.noCommandDetection,agentId:a.agentId,agentIdSilent:a.agentIdSilent,slashCommand:a.slashCommand,confirmation:a.confirmation,isSystemInitiated:a.isSystemInitiated,systemInitiatedLabel:a.systemInitiatedLabel,terminalExecutionId:a.terminalExecutionId}}var v_;(t=>{t.scheme="vscode-chat-response-resource";function i(o,n,r,s){return A.from({scheme:t.scheme,authority:o5(Ke.fromString(o.toString())),path:`/tool/${n}/${r}`+(s?`/${s}`:"")})}t.createUri=i;function e(o){if(o.scheme!==t.scheme)return;let n=o.path.split("/");if(n.length<4)return;let[,r,s,l]=n;if(r!=="tool")return;let c;try{c=A.parse(wwe(o.authority).toString())}catch(u){if(u instanceof SyntaxError)c=Br.forSession(o.authority);else throw u}return{sessionResource:c,toolCallId:s,index:Number(l)}}t.parseUri=e})(v_||={});var nho="chat-memory-file",Ten="copilot_memory",Fet;(t=>{function a(o,n){return A.from({scheme:nho,path:o,query:n.toString()})}t.createUri=a;function i(o){return o.scheme===nho}t.isChatMemoryFileUri=i;function e(o){return{memoryPath:o.path,sessionResource:o.query}}t.parse=e})(Fet||={});function _en(a,i){if(a===i)return!0;let[e,t]=a.split("/"),[o]=i.split("/");return t==="*"&&e===o}function PWt(a,i){let e=Jo(a);for(let[t,o]of Object.entries(i))if(qd(t,a)||qd(t,e))return o}function rho(a,i){for(let[e,t]of Object.entries(i))if(_en(e,a))return t}function Den(a){return typeof a=="object"&&a!==null&&"output"in a&&typeof a.output=="object"&&a.output?.type==="data"&&typeof a.output?.mimeType=="string"}function Ren(a){if(typeof a!="object"||a===null)return;let i=a.path;return typeof i=="string"?i:void 0}var Len=new Set(["create","str_replace","insert"]);function Men(a){if(typeof a!="object"||a===null)return!1;let i=a.command;return typeof i=="string"&&Len.has(i)}function sho(a,i,e,t,o={}){let n=[],r=new Set;for(let s of a.value){if(s.kind==="codeblockUri"){let l=s.uri,c=l.toString();if(r.has(c))continue;let u=PWt(l.path,t);u&&(r.add(c),n.push({label:Be(l),uri:c,type:"plan",groupName:u.groupName,onlyShowGroup:u.onlyShowGroup}))}if(s.kind==="textEditGroup"){let l=s.uri,c=l.toString();if(r.has(c))continue;let u=PWt(l.path,t);u&&(r.add(c),n.push({label:Be(l),uri:c,type:"plan",groupName:u.groupName,onlyShowGroup:u.onlyShowGroup}))}if(s.kind==="workspaceEdit")for(let l of s.edits){let c=l.newResource??l.oldResource;if(!c)continue;let u=c.toString();if(r.has(u))continue;let p=PWt(c.path,t);p&&(r.add(u),n.push({label:Be(c),uri:u,type:"plan",groupName:p.groupName,onlyShowGroup:p.onlyShowGroup}))}if((s.kind==="toolInvocation"||s.kind==="toolInvocationSerialized")&&s.toolId===Ten){let l=pi.getParameters(s),c=Ren(l);if(c&&Men(l)){let u=PWt(c,o);if(u){let p=`memory:${s.toolCallId}:${c}`;r.has(p)||(r.add(p),n.push({label:Jo(c),uri:Fet.createUri(c,i).toString(),type:"plan",groupName:u.groupName,onlyShowGroup:u.onlyShowGroup}))}}}if(s.kind==="toolInvocation"||s.kind==="toolInvocationSerialized"){let l=pi.resultDetails(s);if(!l)continue;if(oR(l))for(let c=0;c<l.output.length;c++){let u=l.output[c];if(u.type==="embed"&&!u.isText&&u.mimeType){let p=rho(u.mimeType,e);if(p){let h=`${s.toolCallId}:${c}`;if(!r.has(h)){r.add(h);let g=wA(u.mimeType),f=g?`file${g}`:"file.bin",v=v_.createUri(i,s.toolCallId,c,f);n.push({label:u.uri?.path.split("/").pop()??`${p.groupName} ${c+1}`,uri:v.toString(),toolCallId:s.toolCallId,dataPartIndex:c,type:"screenshot",groupName:p.groupName,onlyShowGroup:p.onlyShowGroup})}}}}if(Den(l)){let c=rho(l.output.mimeType,e);if(c){let u=`${s.toolCallId}:0`;if(!r.has(u)){r.add(u);let p=wA(l.output.mimeType),h=p?`file${p}`:"file.bin",g=v_.createUri(i,s.toolCallId,0,h);n.push({label:`${c.groupName}`,uri:g.toString(),toolCallId:s.toolCallId,dataPartIndex:0,type:"screenshot",groupName:c.groupName,onlyShowGroup:c.onlyShowGroup})}}}}}return n}var LG=le("chatArtifactsService"),Wet=class{constructor(i){this._memento=new $l("chat-artifacts",i)}get(i){return this._memento.getMemento(1,1)[i]||[]}set(i,e){let t=this._memento.getMemento(1,1);t[i]=e,this._memento.saveMemento()}delete(i){let e=this._memento.getMemento(1,1);delete e[i],this._memento.saveMemento()}};Wet=I([m(0,de)],Wet);var Xxi=class extends k{constructor(e,t,o,n,r){super();this._storageKey=t;this._storage=o;this._responseCache=new Map;this._ruleOverrides=Xm({owner:this,equalsFn:()=>!1},void 0);this._agentArtifacts=Xm({owner:this,equalsFn:()=>!1},[]);this._subagentArtifacts=Xm({owner:this,equalsFn:()=>!1},new Map);this._nextSequence=1;this._sourceSequences=new Map;let s=this._storage.get(this._storageKey);this._agentArtifacts.set(s,void 0),this._sourceSequences.set("rules",0),s.length>0&&this._sourceSequences.set("agent",this._nextSequence++);let l=vi(this,r.onDidChangeConfiguration,()=>r.getValue("chat.artifacts.rules.byMimeType")??{}),c=vi(this,r.onDidChangeConfiguration,()=>r.getValue("chat.artifacts.rules.byFilePath")??{}),u=vi(this,r.onDidChangeConfiguration,()=>r.getValue("chat.artifacts.rules.byMemoryFilePath")??{}),p=vi(this,n.onDidCreateModel,()=>n.getSession(e)),h=ke(g=>{let f=this._ruleOverrides.read(g),v=f?.byMimeType??l.read(g),b=f?.byFilePath??c.read(g),S=f?.byMemoryFilePath??u.read(g),y=p.read(g);if(!y)return[];qr(this,y.onDidChange).read(g);let x=y.getRequests(),E=[],M=new Set,N=new Set;for(let V of x){let H=V.response;if(!H)continue;M.add(H.id);let K=H.response,j=K.value.length,J=0;for(let ce of K.value)(ce.kind==="toolInvocation"||ce.kind==="toolInvocationSerialized")&&pi.resultDetails(ce)!==void 0&&J++;let se=this._responseCache.get(H.id),ae;se&&se.partsLength===j&&se.completedToolCount===J&&se.byMimeType===v&&se.byFilePath===b&&se.byMemoryFilePath===S?ae=se.artifacts:(ae=sho(K,e,v,b,S),this._responseCache.set(H.id,{partsLength:j,completedToolCount:J,byMimeType:v,byFilePath:b,byMemoryFilePath:S,artifacts:ae}));for(let ce of ae){let Se=ce.toolCallId?`${ce.toolCallId}:${ce.dataPartIndex}`:ce.uri;if(N.has(Se)){let Re=E.findIndex(xe=>xe.toolCallId?`${xe.toolCallId}:${xe.dataPartIndex}`===Se:xe.uri===Se);Re!==-1&&E.splice(Re,1)}N.add(Se),E.push(ce)}}for(let V of this._responseCache.keys())M.has(V)||this._responseCache.delete(V);return E});this.artifactGroups=ke(g=>{let f=[],v=h.read(g);v.length>0&&f.push({key:"rules",seq:this._sourceSequences.get("rules")??0,group:{source:{kind:"rules"},artifacts:v}});let b=this._agentArtifacts.read(g);b.length>0&&f.push({key:"agent",seq:this._sourceSequences.get("agent")??1/0,group:{source:{kind:"agent"},artifacts:b}});let S=this._subagentArtifacts.read(g);for(let[x,E]of S)if(E.artifacts.length>0){let M=`subagent:${x}`;f.push({key:M,seq:this._sourceSequences.get(M)??1/0,group:{source:{kind:"subagent",invocationId:x,name:E.name},artifacts:E.artifacts}})}f.sort((x,E)=>x.seq-E.seq);let y=new Set,w=[];for(let x of f){let E=x.group.artifacts.filter(M=>{let N=M.toolCallId?`${M.toolCallId}:${M.dataPartIndex}`:M.uri;if(!N)return!1;let V=N.toLowerCase();return y.has(V)?!1:(y.add(V),!0)});E.length>0&&w.push({source:x.group.source,artifacts:E})}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,t,o){let n=`subagent:${e}`;this._sourceSequences.has(n)||this._sourceSequences.set(n,this._nextSequence++);let r=new Map(this._subagentArtifacts.get());o.length===0?r.delete(e):r.set(e,{name:t,artifacts:o}),this._subagentArtifacts.set(r,void 0)}setRuleOverrides(e){this._ruleOverrides.set(e,void 0)}clearAgentArtifacts(){this._agentArtifacts.set([],void 0),this._storage.set(this._storageKey,[])}clearSubagentArtifacts(e){let t=new Map(this._subagentArtifacts.get());t.delete(e),this._subagentArtifacts.set(t,void 0)}migrate(e){let t=this._agentArtifacts.get();t.length>0&&e.setAgentArtifacts([...t]),this._agentArtifacts.set([],void 0),this._storage.delete(this._storageKey)}},rMe=class extends k{constructor(e,t,o){super();this._chatService=t;this._configurationService=o;this._instances=this._register(new Ot);this._storage=new Wet(e)}getArtifacts(e){let t=jp(e),o=this._instances.get(t);return o||(o=new Xxi(e,t,this._storage,this._chatService,this._configurationService),this._instances.set(t,o)),o}};rMe=I([m(0,de),m(1,si),m(2,B)],rMe);var vW=le("chatTodoListService"),Vet=class{constructor(i){this.memento=new $l("chat-todo-list",i)}getSessionData(i){return this.memento.getMemento(1,1)[this.toKey(i)]||[]}setSessionData(i,e){let t=this.memento.getMemento(1,1);t[this.toKey(i)]=e,this.memento.saveMemento()}getTodoList(i){return this.getSessionData(i)}setTodoList(i,e){this.setSessionData(i,e)}migrateTodoList(i,e){let t=this.getSessionData(i);if(t.length>0){this.setSessionData(e,t);let o=this.memento.getMemento(1,1);delete o[this.toKey(i)],this.memento.saveMemento()}}toKey(i){return jp(i)}};Vet=I([m(0,de)],Vet);var sMe=class extends k{constructor(e){super();this._onDidUpdateTodos=this._register(new T);this.onDidUpdateTodos=this._onDidUpdateTodos.event;this.todoListStorage=new Vet(e)}getTodos(e){return this.todoListStorage.getTodoList(e)}setTodos(e,t){this.todoListStorage.setTodoList(e,t),this._onDidUpdateTodos.fire(e)}migrateTodos(e,t){this.todoListStorage.migrateTodoList(e,t),this._onDidUpdateTodos.fire(t)}};sMe=I([m(0,de)],sMe);function aho(a,i){return a===i?!0:!a||!i||typeof a=="string"||typeof i=="string"?!1:Cde(a,i)}var Zxi=class extends k{constructor(e,t,o,n,r){super();this._progressObservable=De(this,[]);this._isCompleteObservable=De(this,!1);this._onWillDispose=new T;this.onWillDispose=this._onWillDispose.event;this._pendingProgressChunks=new Map;this._isInitialized=!1;this._interruptionWasCanceled=!1;this._disposalPending=!1;this.sessionResource=e,this.providerHandle=t,this.history=[],this._proxy=o,this._providerHandle=t,this._logService=n,this._dialogService=r}get options(){return this._options?new Map(this._options):void 0}get progressObs(){return this._progressObservable}get isCompleteObs(){return this._isCompleteObservable}initialize(e,t){return this._initializationPromise||(this._initializationPromise=this._doInitializeContent(e,t)),this._initializationPromise}async _doInitializeContent(e,t){try{let o=await Ym(this._proxy.$provideChatSessionContent(this._providerHandle,this.sessionResource,t,e),e);this._options=o.options?k3.fromRecord(o.options):void 0,this.title=o.title,this.history.length=0,this.history.push(...o.history.map(l=>{if(l.type==="request"){let c=l.variableData?.variables.map(u=>({...u,value:er(u.value)}));return{type:"request",prompt:l.prompt,participant:l.participant,command:l.command,variableData:c?{variables:c}:void 0,id:l.id,modelId:l.modelId,modeInstructions:l.modeInstructions?er(l.modeInstructions):void 0}}return{type:"response",parts:l.parts.map(c=>er(c)),participant:l.participant,details:l.details}})),o.hasActiveResponseCallback&&!this.interruptActiveResponseCallback&&(this.interruptActiveResponseCallback=async()=>{let l=()=>(this._disposalPending&&(this._proxy.$disposeChatSessionContent(this._providerHandle,this.sessionResource),this._disposalPending=!1),this._proxy.$interruptChatSessionActiveResponse(this._providerHandle,this.sessionResource,"ongoing"),!0);return o.supportsInterruption?l():this._dialogService.confirm({message:d(3907,null)}).then(c=>c.confirmed?l():(this._addProgress([{kind:"progressMessage",content:{value:"",isTrusted:!1}}]),this._interruptionWasCanceled=!0,this._disposalPending&&(this._logService.info(`Canceling deferred disposal for session ${this.sessionResource} (user canceled interruption)`),this._disposalPending=!1),!1))}),o.hasRequestHandler&&!this.requestHandler&&(this.requestHandler=async(l,c,u,p)=>{this._progressObservable.set([],void 0),this._isCompleteObservable.set(!1,void 0);let h=0,g=ve(f=>{let v=this._progressObservable.read(f),b=this._isCompleteObservable.read(f);if(v.length>h){let S=v.slice(h);c(S),h=v.length}b&&g.dispose()});try{await this._proxy.$invokeChatSessionRequestHandler(this._providerHandle,this.sessionResource,l,u,p),!this._isCompleteObservable.get()&&!this.interruptActiveResponseCallback&&this._markComplete()}catch(f){let v={kind:"progressMessage",content:{value:`Error: ${f instanceof Error?f.message:String(f)}`,isTrusted:!1}};throw this._addProgress([v]),this._markComplete(),f}finally{g.dispose()}}),o.hasForkHandler&&!this.forkSession&&(this.forkSession=async(l,c)=>{let u=await this._proxy.$forkChatSession(this._providerHandle,this.sessionResource,l?this.toRequestDto(l):void 0,c);return er(u)}),this._isInitialized=!0;let n=o.hasActiveResponseCallback,r=o.hasRequestHandler,s=n||r;for(let[l,c]of this._pendingProgressChunks)this._logService.debug(`Processing ${c.length} pending progress chunks for session ${this.sessionResource}, requestId ${l}`),this._addProgress(c);this._pendingProgressChunks.clear(),s||this._isCompleteObservable.set(!0,void 0)}catch(o){throw this._logService.error(`Failed to initialize chat session ${this.sessionResource}:`,o),o}}handleProgressChunk(e,t){if(!this._isInitialized){let o=this._pendingProgressChunks.get(e)||[];this._pendingProgressChunks.set(e,[...o,...t]),this._logService.debug(`Queuing ${t.length} progress chunks for session ${this.sessionResource}, requestId ${e} (session not initialized)`);return}this._addProgress(t)}handleProgressComplete(e){this._pendingProgressChunks.delete(e),this._isInitialized&&(this._interruptionWasCanceled?this._interruptionWasCanceled=!1:this._markComplete())}_addProgress(e){let t=this._progressObservable.get();this._progressObservable.set([...t,...e],void 0)}_markComplete(){this._isCompleteObservable.get()||this._isCompleteObservable.set(!0,void 0)}toRequestDto(e){return{type:"request",id:e.id,prompt:e.prompt,participant:e.participant,command:e.command,variableData:void 0,modelId:e.modelId,modeInstructions:e.modeInstructions}}dispose(){this._onWillDispose.fire(),this._onWillDispose.dispose(),this._pendingProgressChunks.clear(),this.interruptActiveResponseCallback&&!this._interruptionWasCanceled?this._disposalPending=!0:this._proxy.$disposeChatSessionContent(this._providerHandle,this.sessionResource),super.dispose()}},Bet=class extends k{constructor(e,t,o,n,r){super();this._chatService=r;this._onDidChangeChatSessionItems=this._register(new T);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._modelListeners=this._register(new bI);this._resolveCache=new dt;this._resolving=new dt;this._isDisposed=!1;this._items=new dt;this._proxy=e,this._handle=o,this._supportsResolve=n;let s=async l=>{if(yn(l.sessionResource)!==t||(await this.refresh(Ie.None),this._isDisposed))return;this.tryUpdateItemForModel(l);let c=l.lastRequestObs.map(p=>p?.response&&qr("chatSessions.modelRequestChangeListener",p.response.onDidChange)),u=qr("chatSessions.modelChangeListener",l.onDidChange);this._modelListeners.set(l.sessionResource,ve(p=>{c.read(p)?.read(p),u.read(p),this.tryUpdateItemForModel(l)}))};this._register(r.onDidCreateModel(l=>s(l)));for(let l of r.chatModels.get())s(l);this._register(r.onDidDisposeSession(l=>{for(let c of l.sessionResources)this._modelListeners.deleteAndDispose(c)}))}dispose(){this._isDisposed=!0,this._resolveCache.clear(),super.dispose()}get items(){return Array.from(this._items.values())}refresh(e){return this._proxy.$refreshChatSessionItems(this._handle,e)}async newChatSessionItem(e,t){let o=await Ym(this._proxy.$newChatSessionItem(this._handle,{prompt:e.prompt,command:e.command,initialSessionOptions:e.initialSessionOptions?k3.toStrValueArray(e.initialSessionOptions):void 0},t),t);return o?this.addOrUpdateItem(o):void 0}async acceptChange(e){let t=[];for(let o of e.addedOrUpdated){let n=A.revive(o.resource);this._resolving.has(n)||this._resolveCache.delete(n),t.push(await this.addOrUpdateItem(o))}for(let o of e.removed)this._resolveCache.delete(o),this._items.delete(o);this._onDidChangeChatSessionItems.fire({addedOrUpdated:t,removed:e.removed})}async addOrUpdateItem(e){let t=A.revive(e.resource),o=this._items.get(t),n=new NWt(e,this._chatService.getSession(t),await this._chatService.getMetadataForSession(t));return o?.isEqual(n)?o:(o&&o.label!==n.label&&this._chatService.getSession(t)&&this._chatService.setSessionTitle(t,n.label),this._items.set(t,n),this._onDidChangeChatSessionItems.fire({addedOrUpdated:[n]}),n)}async tryUpdateItemForModel(e){let t=e.sessionResource,o=this._items.get(t);o&&this.addOrUpdateItem(o)}async getNewChatSessionInputState(e,t){let o=await this._proxy.$provideChatSessionInputState(this._handle,e,t);if(o?.length)return o}async resolveChatSessionItem(e,t){if(!this._supportsResolve)return;let o=this._resolveCache.get(e);if(o)return o;let n=this._doResolveItem(e,t).catch(r=>{throw this._resolveCache.delete(e),r});return this._resolveCache.set(e,n),n}async _doResolveItem(e,t){let o=this._items.get(e);this._resolving.set(e,!0);let n;try{n=await Ym(this._proxy.$resolveChatSessionItem(this._handle,e,t),t)}finally{this._resolving.delete(e)}if(!n)return;if(this._items.get(e)!==o)return this._items.get(e);let r=new NWt(n,this._chatService.getSession(e),await this._chatService.getMetadataForSession(e));return this._items.get(e)!==o?this._items.get(e):o?.isEqual(r)?o:(this._items.set(e,r),this._onDidChangeChatSessionItems.fire({addedOrUpdated:[r]}),r)}setSupportsResolve(e){this._supportsResolve!==e&&(this._supportsResolve=e,e&&this._resolveCache.clear())}};Bet=I([m(4,si)],Bet);var NWt=class{constructor(i,e,t){if(this.resource=A.revive(i.resource),this.label=i.label,this.timing=i.timing,this.iconPath=i.iconPath,this.badge=Jxi(i.badge),this.tooltip=Jxi(i.tooltip),this.archived=i.archived,this.metadata=i.metadata,this.description=(e&&uWt(e))??Jxi(i.description),this.status=(e&&kWt(e))??i.status,this.changes=er(i.changes),t&&!this.changes){let o={files:t.stats?.fileCount||0,insertions:t.stats?.added||0,deletions:t.stats?.removed||0};nhe(o)&&(this.changes=o)}}isEqual(i){return ze(this.resource,i.resource)&&this.label===i.label&&this.description===i.description&&this.status===i.status&&this.timing.created===i.timing.created&&this.timing.lastRequestStarted===i.timing.lastRequestStarted&&this.timing.lastRequestEnded===i.timing.lastRequestEnded&&Qi(this.changes,i.changes)&&Qi(this.iconPath,i.iconPath)&&aho(this.badge,i.badge)&&aho(this.tooltip,i.tooltip)&&this.archived===i.archived&&Qi(this.metadata,i.metadata)}},AWt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this._extHostContext=e;this._agentSessionsService=t;this._chatSessionsService=o;this._chatService=n;this._chatWidgetService=r;this._chatTodoListService=s;this._chatArtifactsService=l;this._chatDebugService=c;this._dialogService=u;this._editorService=p;this.editorGroupService=h;this._logService=g;this._instantiationService=f;this._itemControllerRegistrations=this._register(new Ot);this._contentProvidersRegistrations=this._register(new Ot);this._sessionTypeToHandle=new Map;this._activeSessions=new dt;this._sessionDisposables=new dt;this._proxy=this._extHostContext.getProxy(ao.ExtHostChatSessions),this._register(this._chatSessionsService.onDidChangeSessionOptions(({sessionResource:v,updates:b})=>{let S=yn(v),y=this._getHandleForSessionType(S);this._logService.trace(`[MainThreadChatSessions] onRequestNotifyExtension received: sessionType '${S}', handle ${y}, ${b.size} update(s)`),y!==void 0?this.notifyOptionsChange(y,v,b):this._logService.warn(`[MainThreadChatSessions] Cannot notify option change for sessionType '${S}': no provider registered. Registered types: [${Array.from(this._sessionTypeToHandle.keys()).join(", ")}]`)})),this._register(this._agentSessionsService.model.onDidChangeSessionArchivedState(v=>{for(let[b,{chatSessionType:S}]of this._itemControllerRegistrations)S===v.providerType&&this._proxy.$onDidChangeChatSessionItemState(b,v.resource,v.isArchived())}))}_getHandleForSessionType(e){return this._sessionTypeToHandle.get(e)}$registerChatSessionItemController(e,t,o){let n=new O,r=n.add(this._instantiationService.createInstance(Bet,this._proxy,t,e,o));n.add(this._chatSessionsService.registerChatSessionItemController(t,r)),this._itemControllerRegistrations.set(e,{chatSessionType:t,controller:r,dispose:()=>n.dispose()}),this._refreshControllerInputState(e,t)}$updateChatSessionItemControllerCapabilities(e,t){let o=this._itemControllerRegistrations.get(e);if(!o){this._logService.warn(`No chat session item controller found for handle ${e}`);return}o.controller.setSupportsResolve(t)}_refreshControllerInputState(e,t){this._proxy.$provideChatSessionInputState(e,void 0,Ie.None).then(o=>{o?.length&&this._applyOptionGroups(e,t,void 0,o)}).catch(o=>this._logService.error("Error fetching chat session input state",o))}_applyOptionGroups(e,t,o,n){if(this._chatSessionsService.setOptionGroupsForSessionType(t,e,n),o){let r=A.revive(o);n.forEach(s=>{s.selected&&this._chatSessionsService.setSessionOption(r,s.id,s.selected)})}}getController(e){let t=this._itemControllerRegistrations.get(e);if(!t)throw new Error(`No chat session controller registered for handle ${e}`);return t.controller}async $updateChatSessionItems(e,t){this.getController(e).acceptChange({addedOrUpdated:t.addedOrUpdated,removed:t.removed.map(n=>A.revive(n))})}async $addOrUpdateChatSessionItem(e,t){this.getController(e).acceptChange({addedOrUpdated:[t],removed:[]})}$onDidChangeChatSessionOptions(e,t,o){let n=A.revive(t);this._chatSessionsService.updateSessionOptions(n,k3.fromRecord(o))}async $onDidCommitChatSessionItem(e,t,o){let n=A.revive(t),r=A.revive(o);this._logService.trace(`$onDidCommitChatSessionItem: handle(${e}), original(${n}), modified(${r})`);let s=this._itemControllerRegistrations.get(e)?.chatSessionType;if(!s){this._logService.error(`No chat session type found for provider handle ${e}`);return}let l=this._editorService.editors.find(p=>p.resource?.toString()===n.toString()),c=this._chatService.acquireExistingSession(n),u=this._chatSessionsService.getAllChatSessionContributions().find(p=>p.type===s);try{this._chatTodoListService.migrateTodos(n,r),this._chatArtifactsService.getArtifacts(n).migrate(this._chatArtifactsService.getArtifacts(r)),s==="copilotcli"&&this._chatDebugService.invokeProviders(r).catch(()=>{});let p=this.editorGroupService.groups.find(v=>v.editors.some(b=>ze(b.resource,n)))??this.editorGroupService.activeGroup,h={title:{preferred:l?.getName()||void 0,fallback:d(3906,null,u?.displayName)}},g=await this._chatSessionsService.getOrCreateChatSession(A.revive(r),Ie.None);if(l){g.transferredState=l instanceof tl?{editingSession:l.transferOutEditingSession(),inputState:c?.object?.inputModel.toJSON()}:void 0,await this._editorService.replaceEditors([{editor:l,replacement:{resource:r,options:h}}],p),this._resendPendingRequests(n,r);return}c&&(g.transferredState={editingSession:c.object.editingSession,inputState:c.object.inputModel.toJSON()});let f=this._chatWidgetService.getWidgetBySessionResource(n);f&&tw(f.viewContext)?await this._chatWidgetService.openSession(r,void 0,{preserveFocus:!0}):(await this._chatService.acquireOrLoadSession(r,"panel",Ie.None))?.dispose(),this._resendPendingRequests(n,r),this._chatSessionsService.fireSessionCommitted(n,r)}finally{c?.dispose()}}_resendPendingRequests(e,t){this._chatService.migrateRequests(e,t)}async _provideChatSessionContent(e,t,o){let n=Date.now();this._logService.trace(`[MainThreadChatSessions] _provideChatSessionContent start handle=${e} uri=${t.toString()}`);let r=this._activeSessions.get(t);if(!r){r=new Zxi(t,e,this._proxy,this._logService,this._dialogService),this._activeSessions.set(t,r);let s=r.onWillDispose(()=>{this._activeSessions.delete(t),this._sessionDisposables.get(t)?.dispose(),this._sessionDisposables.delete(t)});this._sessionDisposables.set(t,s)}try{let s=this._chatSessionsService.getSessionOptions(t);if(await r.initialize(o,{initialSessionOptions:s?[...s].map(([l,c])=>({optionId:l,value:typeof c=="string"?c:c?.id})):void 0}),r.options){for(let[l,c]of this._sessionTypeToHandle)if(c===e){for(let[u,p]of r.options)this._chatSessionsService.setSessionOption(t,u,p);break}}return this._logService.trace(`[MainThreadChatSessions] _provideChatSessionContent done total=${Date.now()-n}ms handle=${e} uri=${t.toString()}`),r}catch(s){throw r.dispose(),this._logService.error(`Error providing chat session content for handle ${e} and resource ${t.toString()}:`,s),s}}$unregisterChatSessionItemController(e){this._itemControllerRegistrations.deleteAndDispose(e)}$registerChatSessionContentProvider(e,t){let o={provideChatSessionContent:(n,r)=>this._provideChatSessionContent(e,n,r)};this._sessionTypeToHandle.set(t,e),this._contentProvidersRegistrations.set(e,this._chatSessionsService.registerChatSessionContentProvider(t,o)),this._refreshProviderOptions(e,t)}$unregisterChatSessionContentProvider(e){this._contentProvidersRegistrations.deleteAndDispose(e);for(let[t,o]of this._sessionTypeToHandle)if(o===e){this._sessionTypeToHandle.delete(t);break}for(let[t,o]of this._activeSessions)o.providerHandle===e&&(o.dispose(),this._activeSessions.delete(t))}async $handleProgressChunk(e,t,o,n){let r=A.revive(t),s=this._activeSessions.get(r);if(!s){this._logService.warn(`No session found for progress chunks: handle ${e}, sessionResource ${r}, requestId ${o}`);return}let l=n.map(c=>{let[u]=Array.isArray(c)?c:[c];return er(u)});s.handleProgressChunk(o,l)}$handleProgressComplete(e,t,o){let n=A.revive(t),r=this._activeSessions.get(n);if(!r){this._logService.warn(`No session found for progress completion: handle ${e}, sessionResource ${n}, requestId ${o}`);return}r.handleProgressComplete(o)}$handleAnchorResolve(e,t,o,n,r){}$onDidChangeChatSessionProviderOptions(e){let t;for(let[o,n]of this._sessionTypeToHandle)if(n===e){t=o;break}if(!t){this._logService.warn(`No session type found for chat session content provider handle ${e} when refreshing provider options`);return}this._refreshProviderOptions(e,t)}$updateChatSessionInputState(e,t,o){let n=this._itemControllerRegistrations.get(e);if(!n){this._logService.warn(`No controller found for handle ${e} when updating input state`);return}this._applyOptionGroups(e,n.chatSessionType,t,o)}_refreshProviderOptions(e,t){this._proxy.$provideChatSessionProviderOptions(e,Ie.None).then(o=>{o?.optionGroups&&o.optionGroups.length&&this._chatSessionsService.setOptionGroupsForSessionType(t,e,[...o.optionGroups])}).catch(o=>this._logService.error("Error fetching chat session options",o))}dispose(){for(let e of this._activeSessions.values())e.dispose();this._activeSessions.clear();for(let e of this._sessionDisposables.values())e.dispose();this._sessionDisposables.clear(),super.dispose()}async notifyOptionsChange(e,t,o){this._logService.trace(`[MainThreadChatSessions] notifyOptionsChange: starting proxy call for handle ${e}, sessionResource ${t}`);try{await this._proxy.$provideHandleOptionsChange(e,t,Object.fromEntries(o),Ie.None),this._logService.trace(`[MainThreadChatSessions] notifyOptionsChange: proxy call completed for handle ${e}, sessionResource ${t}`)}catch(n){this._logService.error(`[MainThreadChatSessions] notifyOptionsChange: error for handle ${e}, sessionResource ${t}:`,n)}}};AWt=I([fo(Xi.MainThreadChatSessions),m(1,Vc),m(2,Ms),m(3,si),m(4,Lt),m(5,vW),m(6,LG),m(7,ph),m(8,ct),m(9,ie),m(10,kt),m(11,re),m(12,F)],AWt);function Jxi(a){if(a){if(typeof a=="string")return a;if(typeof a=="object"&&"value"in a)return he.lift(a)}}var OWt=class extends k{constructor(e,t){super();this._dataChannelService=t;this._proxy=e.getProxy(ao.ExtHostDataChannels),this._register(this._dataChannelService.onDidSendData(o=>{this._proxy.$onDidReceiveData(o.channelId,o.data)}))}};OWt=I([fo(Xi.MainThreadDataChannels),m(1,MJ)],OWt);var MG=le("meteredConnectionService"),aMe="network.meteredConnection";function eki(){let a=navigator.connection;if(!a)return!1;if(a.saveData||a.metered)return!0;let i=a.effectiveType;return i==="2g"||i==="slow-2g"}var FWt=class extends k{constructor(e,t){super();this._onDidChangeIsConnectionMetered=this._register(new T);this.onDidChangeIsConnectionMetered=this._onDidChangeIsConnectionMetered.event;this._isBrowserConnectionMetered=t,this._meteredConnectionSetting=e.getValue(aMe),this._isConnectionMetered=this._meteredConnectionSetting==="on"||this._meteredConnectionSetting!=="off"&&this._isBrowserConnectionMetered,this._register(e.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(aMe)){let n=e.getValue(aMe);n!==this._meteredConnectionSetting&&(this._meteredConnectionSetting=n,this.onUpdated())}}))}get isConnectionMetered(){return this._isConnectionMetered}get isBrowserConnectionMetered(){return this._isBrowserConnectionMetered}setIsBrowserConnectionMetered(e){e!==this._isBrowserConnectionMetered&&(this._isBrowserConnectionMetered=e,this.onChangeBrowserConnection())}onChangeBrowserConnection(){this.onUpdated()}onUpdated(){let e=this._meteredConnectionSetting==="on"||this._meteredConnectionSetting!=="off"&&this._isBrowserConnectionMetered;e!==this._isConnectionMetered&&(this._isConnectionMetered=e,this.onChangeIsConnectionMetered())}onChangeIsConnectionMetered(){this._onDidChangeIsConnectionMetered.fire(this._isConnectionMetered)}};var WWt=class extends k{constructor(e,t){super();this.meteredConnectionService=t;this._proxy=e.getProxy(ao.ExtHostMeteredConnection),this._proxy.$initializeIsConnectionMetered(this.meteredConnectionService.isConnectionMetered),this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(o=>{this._proxy.$onDidChangeIsConnectionMetered(o)}))}};WWt=I([fo(Xi.MainThreadMeteredConnection),m(1,MG)],WWt);var lMe=class extends k{constructor(e){super();this.logService=e;this._delegateBarrier=new t5(1e4)}get repositories(){return this._delegate?.repositories??[]}setDelegate(e){if(this._delegate)throw this.logService.error("[GitService][setDelegate] GitExtension delegate is already set."),new ci("GitExtension delegate is already set.");return this._delegate=e,this._delegateBarrier.open(),ee(()=>{this._delegate=void 0})}async openRepository(e){if(await this._delegateBarrier.wait(),!this._delegate){this.logService.warn("[GitService][openRepository] GitExtension delegate is not set after 10 seconds. Cannot open repository.");return}return this._delegate.openRepository(e)}};lMe=I([m(0,re)],lMe);var VWt=class extends k{constructor(e,t,o){super();this.delegate=o;this.rootUri=e,this.state=Xm({owner:this,equalsFn:cD},t)}updateState(e){this.state.set(e,void 0)}async getRefs(e,t){return this.delegate.getRefs(this.rootUri,e,t)}async diffBetweenWithStats(e,t,o){return this.delegate.diffBetweenWithStats(this.rootUri,e,t,o)}async diffBetweenWithStats2(e,t){return this.delegate.diffBetweenWithStats2(this.rootUri,e,t)}};var cMe=le("gitService");function dho(a){switch(a){case 0:return 0;case 1:return 1;case 2:return 2;default:throw new Error(`Unknown GitRefType: ${a}`)}}function lho(a){return{uri:A.revive(a.uri),originalUri:a.originalUri?A.revive(a.originalUri):void 0,modifiedUri:a.modifiedUri?A.revive(a.modifiedUri):void 0,insertions:a.insertions,deletions:a.deletions}}function cho(a){return{HEAD:a?.HEAD?{type:dho(a.HEAD.type),name:a.HEAD.name,commit:a.HEAD.commit,remote:a.HEAD.remote,upstream:a.HEAD.upstream,ahead:a.HEAD.ahead,behind:a.HEAD.behind}:void 0,remotes:a?.remotes??[],mergeChanges:a?.mergeChanges?.map(i=>({uri:A.revive(i.uri),originalUri:i.originalUri?A.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?A.revive(i.modifiedUri):void 0}))??[],indexChanges:a?.indexChanges?.map(i=>({uri:A.revive(i.uri),originalUri:i.originalUri?A.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?A.revive(i.modifiedUri):void 0}))??[],workingTreeChanges:a?.workingTreeChanges?.map(i=>({uri:A.revive(i.uri),originalUri:i.originalUri?A.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?A.revive(i.modifiedUri):void 0}))??[],untrackedChanges:a?.untrackedChanges?.map(i=>({uri:A.revive(i.uri),originalUri:i.originalUri?A.revive(i.originalUri):void 0,modifiedUri:i.modifiedUri?A.revive(i.modifiedUri):void 0}))??[]}}var BWt=class extends k{constructor(e,t){super();this.gitService=t;this._openRepositorySequencer=new Tm;this._repositoryHandles=new dt;this._repositories=new Map;this._proxy=e.getProxy(ao.ExtHostGitExtension),this._initializeDelegate()}get repositories(){return this._repositories.values()}async _initializeDelegate(){await this._proxy.$isGitExtensionAvailable()&&!this._store.isDisposed&&this._register(this.gitService.setDelegate(this))}async openRepository(e){return this._openRepositorySequencer.queue(async()=>{let t=await this._proxy.$openRepository(e);if(!t)return;let o=A.revive(t.rootUri),n=cho(t.state),r=new VWt(o,n,this);return this._repositories.set(t.handle,r),this._repositoryHandles.set(o,t.handle),await yh(r.state,s=>s.HEAD!==void 0),r})}async getRefs(e,t,o){let n=this._repositoryHandles.get(e);if(n===void 0)return[];let r=await this._proxy.$getRefs(n,t,o);return o?.isCancellationRequested?[]:r.map(s=>({...s,type:dho(s.type)}))}async diffBetweenWithStats(e,t,o,n){let r=this._repositoryHandles.get(e);return r===void 0?[]:(await this._proxy.$diffBetweenWithStats(r,t,o,n)).map(lho)}async diffBetweenWithStats2(e,t,o){let n=this._repositoryHandles.get(e);return n===void 0?[]:(await this._proxy.$diffBetweenWithStats2(n,t,o)).map(lho)}async $onDidChangeRepository(e){let t=this._repositories.get(e);if(!t)return;let o=await this._proxy.$getRepositoryState(e);o&&t.updateState(cho(o))}};BWt=I([fo(Xi.MainThreadGitExtension),m(1,cMe)],BWt);var tv=le("playwrightService");var Ib="workbench.action.browser",Ld=(V=>(V.Open=`${Ib}.open`,V.OpenFile=`${Ib}.openFile`,V.NewTab=`${Ib}.newTab`,V.QuickOpen=`${Ib}.quickOpen`,V.OpenOrList=`${Ib}.openOrList`,V.CloseAll=`${Ib}.closeAll`,V.CloseAllInGroup=`${Ib}.closeAllInGroup`,V.GoBack=`${Ib}.goBack`,V.GoForward=`${Ib}.goForward`,V.Reload=`${Ib}.reload`,V.HardReload=`${Ib}.hardReload`,V.FocusUrlInput=`${Ib}.focusUrlInput`,V.OpenExternal=`${Ib}.openExternal`,V.OpenSettings=`${Ib}.openSettings`,V.AddElementToChat=`${Ib}.addElementToChat`,V.AddConsoleLogsToChat=`${Ib}.addConsoleLogsToChat`,V.ToggleDevTools=`${Ib}.toggleDevTools`,V.ClearGlobalStorage=`${Ib}.clearGlobalStorage`,V.ClearWorkspaceStorage=`${Ib}.clearWorkspaceStorage`,V.ClearEphemeralStorage=`${Ib}.clearEphemeralStorage`,V.ShowFind=`${Ib}.showFind`,V.HideFind=`${Ib}.hideFind`,V.FindNext=`${Ib}.findNext`,V.FindPrevious=`${Ib}.findPrevious`,V))(Ld||{});var uho="browserView",wR=[.25,1/3,.5,2/3,.75,.8,.9,1,1.1,1.25,1.5,1.75,2,2.5,3,4,5],Het=wR.indexOf(1);function pho(a){return d(2081,null,Math.round(a*100))}function mho(a){return d(2080,null,Math.round(a*100))}var Pen=new Set(["7z","bz2","cjs","class","cpp","cs","css","csv","dll","exe","gif","gz","ico","jar","env","java","jpeg","jpg","js","json","jsx","lock","log","md","mjs","pdf","php","png","py","rar","rs","so","sql","svg","tar","tgz","toml","ts","tsx","txt","wasm","webp","xml","yaml","yml","zip"]),Aen=new Set(["ai","cloud","com","dev","io","me","net","org","tech"]);function dMe(a,i=!1){if(!a)return;let e=a.trim().toLowerCase().replace(/^[^@]+@/,"").replace(/:\d+$/,"").replace(/\.+$/,"");if(!e||e.includes("/")||e==="."||e==="..")return;if(e==="*")return"*";if(!/^\*?\.?[a-z0-9.;,)!?:-]+$/.test(e))return;let t=e.replace(/[),;:!?]+$/,"");if(!t)return;let o=t.startsWith("*.")?t.slice(2):t;if(!/^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)(?:\.(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?))*$/.test(o))return;let n=t.startsWith("*."),r=n?t.slice(2):t;if(r&&/^[a-z0-9.-]+$/.test(r)){if(!i){let s=r.slice(r.lastIndexOf(".")+1);if(Pen.has(s)||!Aen.has(s))return}return n?`*.${r}`:r}}function Nen(a){let i=a.trim();if(i==="*"||!i.includes("://"))return i;try{return A.parse(i).authority}catch{return i}}function Uet(a,i){let e=dMe(Nen(i),i.includes("://"));if(!e)return!1;if(e==="*")return!0;if(e.startsWith("*.")){let t=e.slice(2);return a===t||a.endsWith(`.${t}`)}return a===e}function tki(a){return dMe(a.authority,!0)}function hho(a,i,e){return i.length===0&&e.length===0||e.some(t=>Uet(a,t))?!1:i.length===0?!0:i.some(t=>Uet(a,t))}var bW=le("agentNetworkFilterService"),uMe=class extends k{constructor(e){super();this.configurationService=e;this.networkFilterEnabled=!1;this.allowedPatterns=[];this.deniedPatterns=[];this.domainCache=new Ua(100);this.onDidChangeEmitter=this._register(new T);this.onDidChange=this.onDidChangeEmitter.event;this.readConfiguration(),this._register(this.configurationService.onDidChangeConfiguration(t=>{(t.affectsConfiguration("chat.agent.networkFilter")||t.affectsConfiguration("chat.agent.allowedNetworkDomains")||t.affectsConfiguration("chat.agent.deniedNetworkDomains"))&&(this.readConfiguration(),this.onDidChangeEmitter.fire())}))}readConfiguration(){let e=this.configurationService.getValue("chat.agent.networkFilter")??!1;this.networkFilterEnabled=e,this.allowedPatterns=this.configurationService.getValue("chat.agent.allowedNetworkDomains")??[],this.deniedPatterns=this.configurationService.getValue("chat.agent.deniedNetworkDomains")??[],this.domainCache.clear()}isUriAllowed(e){if(!this.shouldFilter()||e.scheme==="file"||!e.authority)return!0;let t=tki(e);if(!t)return!0;let o=this.domainCache.get(t);return o===void 0&&(o=hho(t,this.allowedPatterns,this.deniedPatterns),this.domainCache.set(t,o)),o}shouldFilter(){return this.networkFilterEnabled}formatError(e){let t=tki(e);return d(2480,null,t??e.authority,"chat.agent.allowedNetworkDomains","chat.agent.deniedNetworkDomains")}};uMe=I([m(0,B)],uMe);var mMe=le("browserZoomService"),iki="browserView.zoomPerHost",zet="Match Window",Oen=new Map(wR.map((a,i)=>[`${Math.round(a*100)}%`,i])),pMe=class extends k{constructor(e,t){super();this.configurationService=e;this.storageService=t;this._onDidChangeZoom=this._register(new T);this.onDidChangeZoom=this._onDidChangeZoom.event;this._ephemeralZoomMap=new Map;this._windowZoomFactor=Bde(0);this._persistentZoomMap=this._readPersistentZoomMap(),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("workbench.browser.pageZoom")&&this._onDidChangeZoom.fire({host:void 0,isEphemeralChange:!1})}))}getEffectiveZoomIndex(e,t){if(e!==void 0)if(t){let o=this._ephemeralZoomMap.get(e);if(o!==void 0)return this._clamp(o)}else{let o=this._persistentZoomMap[e];if(o!==void 0)return this._clamp(o)}return this._getDefaultZoomIndex()}setHostZoomIndex(e,t,o){let n=this._clamp(t),r=this._getDefaultZoomIndex(),s=n===r;if(o){if(s){if(!this._ephemeralZoomMap.has(e))return;this._ephemeralZoomMap.delete(e)}else{if(this._ephemeralZoomMap.get(e)===n)return;this._ephemeralZoomMap.set(e,n)}this._onDidChangeZoom.fire({host:e,isEphemeralChange:!0})}else{let l=!1;s?Object.prototype.hasOwnProperty.call(this._persistentZoomMap,e)&&(delete this._persistentZoomMap[e],l=!0):this._persistentZoomMap[e]!==n&&(this._persistentZoomMap[e]=n,l=!0);let c=!1;if(s?c=this._ephemeralZoomMap.delete(e):this._ephemeralZoomMap.get(e)!==n&&(this._ephemeralZoomMap.set(e,n),c=!0),!l&&!c)return;l&&this._writePersistentZoomMap(),this._onDidChangeZoom.fire({host:e,isEphemeralChange:!1})}}notifyWindowZoomChanged(e){this._windowZoomFactor=e,this.configurationService.getValue("workbench.browser.pageZoom")===zet&&this._onDidChangeZoom.fire({host:void 0,isEphemeralChange:!1})}_getDefaultZoomIndex(){let e=this.configurationService.getValue("workbench.browser.pageZoom");return e===zet?this._getMatchWindowZoomIndex():Oen.get(e)??Het}_getMatchWindowZoomIndex(){let e=this._windowZoomFactor,t=Het,o=1/0;for(let n=0;n<wR.length;n++){let r=Math.abs(Math.log(wR[n])-Math.log(e));r<o&&(o=r,t=n)}return t}_readPersistentZoomMap(){let e=this.storageService.get(iki,0);if(!e)return{};try{let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))return{};let o={};for(let[n,r]of Object.entries(t))typeof r=="number"&&r>=0&&r<wR.length&&(o[n]=r);return o}catch{return{}}}_writePersistentZoomMap(){Object.keys(this._persistentZoomMap).length>0?this.storageService.store(iki,JSON.stringify(this._persistentZoomMap),0,1):this.storageService.remove(iki,0)}_clamp(e){return Math.max(0,Math.min(Math.trunc(e),wR.length-1))}};pMe=I([m(0,B),m(1,de)],pMe);function gho(a){let i=URL.parse(a);if(!(!i?.host||i.protocol!=="http:"&&i.protocol!=="https:"))return i.host}var Bm=le("browserViewWorkbenchService"),UWt=le("browserViewCDPService"),L8=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.id=e;this.owner=t;this.browserViewService=n;this.browserViewWorkbenchService=r;this.telemetryService=s;this.playwrightService=l;this.dialogService=c;this.storageService=u;this.zoomService=p;this.agentNetworkFilterService=h;this.logService=g;this._url="";this._title="";this._favicon=void 0;this._screenshot=void 0;this._loading=!1;this._focused=!1;this._visible=!1;this._isDevToolsOpen=!1;this._canGoBack=!1;this._canGoForward=!1;this._error=void 0;this._certificateError=void 0;this._storageScope="ephemeral";this._isEphemeral=!1;this._zoomHost=void 0;this._sharedWithAgent=!1;this._browserZoomIndex=Het;this._isElementSelectionActive=!1;this._onDidChangeSharingState=this._register(new T);this.onDidChangeSharingState=this._onDidChangeSharingState.event;this._onDidChangeZoom=this._register(new T);this.onDidChangeZoom=this._onDidChangeZoom.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this._url=o.url,this._title=o.title,this._loading=o.loading,this._focused=o.focused,this._visible=o.visible,this._isDevToolsOpen=o.isDevToolsOpen,this._canGoBack=o.canGoBack,this._canGoForward=o.canGoForward,this._screenshot=o.lastScreenshot,this._favicon=o.lastFavicon,this._error=o.lastError,this._certificateError=o.certificateError,this._storageScope=o.storageScope,this._browserZoomIndex=o.browserZoomIndex,this._isElementSelectionActive=o.isElementSelectionActive,this._isEphemeral=this._storageScope==="ephemeral",this._zoomHost=gho(this._url);let f=this.zoomService.getEffectiveZoomIndex(this._zoomHost,this._isEphemeral);f!==this._browserZoomIndex&&this.setBrowserZoomIndex(f).catch(v=>{this.logService.warn("[BrowserViewModel] Failed to set initial zoom:",v)}),this.playwrightService.isPageTracked(this.id).then(v=>this._setSharedWithAgent(v)).catch(v=>{this.logService.warn("[BrowserViewModel] Failed to check initial page tracking:",v)}),this._register(this.zoomService.onDidChangeZoom(({host:v,isEphemeralChange:b})=>{b&&!this._isEphemeral||(v===void 0||v===this._zoomHost)&&this.setBrowserZoomIndex(this.zoomService.getEffectiveZoomIndex(this._zoomHost,this._isEphemeral)).catch(()=>{})})),this._register(this.onDidNavigate(v=>{URL.parse(v.url)?.host!==URL.parse(this._url)?.host&&(this._favicon=void 0),this._zoomHost=gho(v.url),this._url=v.url,this._title=v.title,this._canGoBack=v.canGoBack,this._canGoForward=v.canGoForward,this._certificateError=v.certificateError,this.setBrowserZoomIndex(this.zoomService.getEffectiveZoomIndex(this._zoomHost,this._isEphemeral),!0)})),this._register(this.onDidChangeLoadingState(v=>{this._loading=v.loading,this._error=v.error})),this._register(this.onDidChangeDevToolsState(v=>{this._isDevToolsOpen=v.isDevToolsOpen})),this._register(this.onDidChangeTitle(v=>{this._title=v.title})),this._register(this.onDidChangeFavicon(v=>{this._favicon=v.favicon})),this._register(this.onDidChangeFocus(({focused:v})=>{this._focused=v})),this._register(this.onDidChangeVisibility(({visible:v})=>{this._visible=v})),this._register(this.onDidChangeElementSelectionActive(v=>{v&&this.telemetryService.publicLog2("integratedBrowser.addElementToChat.start",{}),this._isElementSelectionActive=v})),this._register(this.playwrightService.onDidChangeTrackedPages(v=>{this._setSharedWithAgent(v.includes(this.id))})),this._register(this.browserViewWorkbenchService.onDidChangeSharingAvailable(()=>{this._onDidChangeSharingState.fire(this.sharingState)}))}get url(){return this._url}get title(){return this._title}get favicon(){return this._favicon}get loading(){return this._loading}get focused(){return this._focused}get visible(){return this._visible}get isDevToolsOpen(){return this._isDevToolsOpen}get canGoBack(){return this._canGoBack}get canGoForward(){return this._canGoForward}get screenshot(){return this._screenshot}get error(){return this._error}get certificateError(){return this._certificateError}get storageScope(){return this._storageScope}get sharingState(){return this.browserViewWorkbenchService.isSharingAvailable?this._sharedWithAgent?"shared":"notShared":"unavailable"}get zoomFactor(){return wR[this._browserZoomIndex]}get canZoomIn(){return this._browserZoomIndex<wR.length-1}get canZoomOut(){return this._browserZoomIndex>0}get onDidNavigate(){return this.browserViewService.onDynamicDidNavigate(this.id)}get onDidChangeLoadingState(){return this.browserViewService.onDynamicDidChangeLoadingState(this.id)}get onDidChangeFocus(){return this.browserViewService.onDynamicDidChangeFocus(this.id)}get onDidChangeDevToolsState(){return this.browserViewService.onDynamicDidChangeDevToolsState(this.id)}get onDidKeyCommand(){return this.browserViewService.onDynamicDidKeyCommand(this.id)}get onDidChangeTitle(){return this.browserViewService.onDynamicDidChangeTitle(this.id)}get onDidChangeFavicon(){return this.browserViewService.onDynamicDidChangeFavicon(this.id)}get onDidFindInPage(){return this.browserViewService.onDynamicDidFindInPage(this.id)}get onDidChangeVisibility(){return this.browserViewService.onDynamicDidChangeVisibility(this.id)}get onDidClose(){return this.browserViewService.onDynamicDidClose(this.id)}async layout(e){return this.browserViewService.layout(this.id,e)}async setVisible(e){return this._visible=e,this.browserViewService.setVisible(this.id,e)}async loadURL(e){return this.logNavigationTelemetry("urlInput",e),this.browserViewService.loadURL(this.id,e)}async goBack(){return this.logNavigationTelemetry("goBack",this._url),this.browserViewService.goBack(this.id)}async goForward(){return this.logNavigationTelemetry("goForward",this._url),this.browserViewService.goForward(this.id)}async reload(e){return this.logNavigationTelemetry("reload",this._url),this.browserViewService.reload(this.id,e)}async toggleDevTools(){return this.browserViewService.toggleDevTools(this.id)}async captureScreenshot(e){let t=await this.browserViewService.captureScreenshot(this.id,e);return!e?.screenRect&&!e?.pageRect&&(this._screenshot=t),t}async focus(e){return this.browserViewService.focus(this.id,e)}async findInPage(e,t){return this.browserViewService.findInPage(this.id,e,t)}async stopFindInPage(e){return this.browserViewService.stopFindInPage(this.id,e)}async getSelectedText(){return this.browserViewService.getSelectedText(this.id)}async clearStorage(){return this.browserViewService.clearStorage(this.id)}async trustCertificate(e,t){return this.browserViewService.trustCertificate(this.id,e,t)}async untrustCertificate(e,t){return this.browserViewService.untrustCertificate(this.id,e,t)}async setBrowserZoomIndex(e,t=!1){let o=Math.max(0,Math.min(e,wR.length-1));!t&&o===this._browserZoomIndex||(this._browserZoomIndex=o,await this.browserViewService.setBrowserZoomIndex(this.id,this._browserZoomIndex),this._onDidChangeZoom.fire())}async zoomIn(){this.canZoomIn&&(await this.setBrowserZoomIndex(this._browserZoomIndex+1),this._zoomHost&&this.zoomService.setHostZoomIndex(this._zoomHost,this._browserZoomIndex,this._isEphemeral))}async zoomOut(){this.canZoomOut&&(await this.setBrowserZoomIndex(this._browserZoomIndex-1),this._zoomHost&&this.zoomService.setHostZoomIndex(this._zoomHost,this._browserZoomIndex,this._isEphemeral))}async resetZoom(){let e=this.zoomService.getEffectiveZoomIndex(void 0,!1);await this.setBrowserZoomIndex(e),this._zoomHost&&this.zoomService.setHostZoomIndex(this._zoomHost,e,this._isEphemeral)}async getConsoleLogs(){return this.browserViewService.getConsoleLogs(this.id)}get isElementSelectionActive(){return this._isElementSelectionActive}async toggleElementSelection(e){return this.browserViewService.toggleElementSelection(this.id,e)}get onDidSelectElement(){return this.browserViewService.onDynamicDidSelectElement(this.id)}get onDidChangeElementSelectionActive(){return this.browserViewService.onDynamicDidChangeElementSelectionActive(this.id)}static{this.SHARE_DONT_ASK_KEY="browserView.shareWithAgent.dontAskAgain"}async setSharedWithAgent(e){if(e){if(this._url)try{let o=A.parse(this._url);if(!this.agentNetworkFilterService.isUriAllowed(o))return await this.dialogService.info(d(6011,null),this.agentNetworkFilterService.formatError(o)),!1}catch{}if(this.storageService.getBoolean(L8.SHARE_DONT_ASK_KEY,0))this.telemetryService.publicLog2("integratedBrowser.shareWithAgent",{shared:!0,dontAskAgain:!0});else{let o=await this.dialogService.confirm({type:"question",title:d(6017,null),message:d(6016,null),detail:d(6014,null),primaryButton:d(6012,null),cancelButton:d(6013,null),checkbox:{label:d(6015,null),checked:!1}});if(o.confirmed&&o.checkboxChecked&&this.storageService.store(L8.SHARE_DONT_ASK_KEY,o.confirmed,0,0),this.telemetryService.publicLog2("integratedBrowser.shareWithAgent",{shared:o.confirmed,dontAskAgain:o.checkboxChecked??!1}),!o.confirmed)return!1}await this.playwrightService.startTrackingPage(this.id),this._setSharedWithAgent(!0)}else await this.playwrightService.stopTrackingPage(this.id),this._setSharedWithAgent(!1);return!0}_setSharedWithAgent(e){e!==this._sharedWithAgent&&(this._sharedWithAgent=e,this._onDidChangeSharingState.fire(this.sharingState))}logNavigationTelemetry(e,t){let o;try{o=bZe(new URL(t).host)}catch{o=!1}this.telemetryService.publicLog2("integratedBrowser.navigation",{navigationType:e,isLocalhost:o})}dispose(){this._onWillDispose.fire(),this._sharedWithAgent&&this.playwrightService.stopTrackingPage(this.id),this.browserViewService.destroyBrowserView(this.id),super.dispose()}};L8=I([m(4,Bm),m(5,_e),m(6,tv),m(7,ct),m(8,de),m(9,mMe),m(10,bW),m(11,re)],L8);var cS;(o=>{o.scheme=Q.vscodeBrowser;function i(n){return A.from({scheme:o.scheme,path:`/${n}`})}o.forId=i;function e(n){if(n.scheme!==o.scheme)return;let r=n.path.startsWith("/")?n.path.substring(1):n.path;if(r)return{id:r}}o.parse=e;function t(n){return e(n)?.id}o.getId=t})(cS||={});function PG(a,i){a.publicLog2("integratedBrowser.open",{source:i})}var Fen=a=>`
	<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
		<path d="M8 1a7 7 0 1 0 0 14 7 7 0 0 0 0-14zm0 1.5a5.5 5.5 0 1 1 0 11 5.5 5.5 0 0 1 0-11z" fill="${a}" opacity="0.3"/>
		<path d="M8 1a7 7 0 0 1 7 7h-1.5A5.5 5.5 0 0 0 8 2.5V1z" fill="${a}">
			<animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" values="0 8 8;360 8 8"/>
		</path>
	</svg>
`,Wen=30,gd=class extends Ls{constructor(e,t,o,n,r,s){super();this._resolveModel=t;this.themeService=o;this.instantiationService=n;this.telemetryService=r;this.browserViewWorkbenchService=s;this._modelStore=this._register(new O);this._onBeforeDispose=this._register(new T);this.onBeforeDispose=this._onBeforeDispose.event;this._onDidResolveModel=this._register(new T);this.onDidResolveModel=this._onDidResolveModel.event;this.getURLTitles=new lY(e=>{let t,o,n,r;function s(){return t||(t=A.parse(e)),t}return{get 0(){return o||(o=s().authority),o},get 1(){return n||(n=s().with({query:"",fragment:""}).toString()),n},get 2(){return r||(r=s().with({fragment:""}).toString()),r}}});this._id=e.id,this._initialData=e}static{this.ID="workbench.editorinputs.browser"}static{this.EDITOR_ID="workbench.editor.browser"}static{this.DEFAULT_LABEL=d(6010,null)}get model(){return this._model}set model(e){this._model!==e&&(this._modelStore.clear(),this._model=e,this._modelStore.add(this._model.onWillDispose(()=>{this._modelStore.clear(),this._model=void 0})),this._modelStore.add(this._model.onDidClose(()=>{this.dispose(!0)})),this._modelStore.add(this._model.onDidChangeTitle(()=>this._onDidChangeLabel.fire())),this._modelStore.add(this._model.onDidChangeFavicon(()=>this._onDidChangeLabel.fire())),this._modelStore.add(this._model.onDidChangeLoadingState(()=>this._onDidChangeLabel.fire())),this._modelStore.add(this._model.onDidNavigate(()=>this._onDidChangeLabel.fire())),this._onDidChangeLabel.fire(),this._onDidResolveModel.fire(e))}get id(){return this._id}get url(){return this._model?this._model.url:this._initialData.url}get title(){return this._model?this._model.title:this._initialData.title}get favicon(){return this._model?this._model.favicon:this._initialData.favicon}get isDefaultLinkOpen(){return!!this._initialData.isDefaultLinkOpen}get isSharingAvailable(){return this._model?this._model.sharingState!=="unavailable":this.browserViewWorkbenchService.isSharingAvailable}navigate(e){this._model?this._model.loadURL(e):(this._initialData={id:this._id,url:e},this._onDidChangeLabel.fire())}async resolve(){return!this._model&&!this._modelPromise&&(this._modelPromise=(async()=>(this._model=await this._resolveModel(),this._modelPromise=void 0,this._model))()),this._model||this._modelPromise}get typeId(){return gd.ID}get editorId(){return gd.EDITOR_ID}get capabilities(){return 1026}get resource(){return cS.forId(this._id)}getIcon(){if(this._model){if(this._model.loading){let e=this.themeService.getColorTheme().getColor(IH);return A.parse("data:image/svg+xml;utf8,"+encodeURIComponent(Fen(e?.toString())))}return this._model.favicon?A.parse(this._model.favicon):L.globe}return this._initialData.favicon?A.parse(this._initialData.favicon):L.globe}getName(){let t=(this._model?!!this._model.title:!!this._initialData.title)?this.title:this.getDescription(0)||gd.DEFAULT_LABEL;return tF(t,Wen)}getTitle(e=1){let t=this._model?!!this._model.title:!!this._initialData.title,o=this.getDescription(e);return(t?`${this.title} (${o})`:o)||gd.DEFAULT_LABEL}getDescription(e=1){return this.url&&this.getURLTitles.get(this.url)[e]}canReopen(){return!0}matches(e){if(super.matches(e))return!0;if(e instanceof gd)return this._id===e._id;if(yo(e,{resource:!0})&&e.resource?.scheme===cS.scheme){let t=cS.parse(e.resource);if(t)return this._id===t.id}return!1}copy(){return PG(this.telemetryService,"copyToNewWindow"),this.instantiationService.invokeFunction(e=>e.get(Bm).getOrCreateLazy(ht(),{url:this.url,title:this.title,favicon:this.favicon}))}toUntyped(){let e={url:this.url,title:this.title,favicon:this.favicon};return{resource:this.resource,options:{override:gd.EDITOR_ID,viewState:e}}}dispose(e){if(!e){let t=!1;if(this._onBeforeDispose.fire({veto:()=>{t=!0}}),t)return}super.dispose(),this._model&&(this._initialData={id:this._id,url:this._model.url,title:this._model.title,favicon:this._model.favicon},this._model.dispose(),this._model=void 0)}serialize(){return{id:this._id,url:this.url,title:this.title,favicon:this.favicon}}};gd=I([m(2,Pe),m(3,F),m(4,_e),m(5,Bm)],gd);var zWt=class{canSerialize(i){return i instanceof gd}serialize(i){if(this.canSerialize(i))return JSON.stringify(i.serialize())}deserialize(i,e){try{let t=JSON.parse(e);return i.invokeFunction(o=>o.get(Bm).getOrCreateLazy(t.id,t))}catch{return}}};var KWt=class extends k{constructor(e,t,o,n,r,s){super();this.editorService=t;this.cdpService=o;this.browserViewService=n;this.editorGroupsService=r;this.configurationService=s;this._cdpSessions=this._register(new Ot);this._knownBrowsers=this._register(new Ot);this._lastActiveBrowserId=void 0;this._proxy=e.getProxy(ao.ExtHostBrowsers),this._register(this.browserViewService.onDidChangeBrowserViews(()=>{for(let l of this.browserViewService.getKnownBrowserViews().values())this._track(l)})),this._register(this.editorService.onDidActiveEditorChange(()=>this._syncActiveBrowserTab()));for(let l of this.browserViewService.getKnownBrowserViews().values())this._track(l);this._syncActiveBrowserTab()}async $openBrowserTab(e,t,o){let n=ht(),r=cS.forId(n);await this.editorService.openEditor({resource:r,options:{...o,viewState:{url:e}}},SE(this.editorGroupsService,this.configurationService,t));let s=this._knownBrowsers.get(n);if(!s)throw new Error("Failed to open browser tab");return this._toDto(s.input)}async _syncActiveBrowserTab(){let e=this.editorService.activeEditorPane?.input,t;e instanceof gd&&(this._track(e),t=e.id),this._lastActiveBrowserId!==t&&(this._lastActiveBrowserId=t,this._proxy.$onDidChangeActiveBrowserTab(t))}_track(e){if(this._knownBrowsers.has(e.id))return;let t=new O;t.add(e.onDidChangeLabel(()=>{this._proxy.$onDidChangeBrowserTabState(this._toDto(e))})),t.add(e.onWillDispose(()=>{this._knownBrowsers.deleteAndDispose(e.id)})),t.add(ee(()=>{this._proxy.$onDidCloseBrowserTab(e.id)})),this._knownBrowsers.set(e.id,{input:e,dispose:()=>t.dispose()}),this._proxy.$onDidOpenBrowserTab(this._toDto(e))}_toDto(e){return{id:e.id,url:e.url||"about:blank",title:e.getTitle(),favicon:e.favicon}}async $startCDPSession(e,t){let o=this._knownBrowsers.get(t);if(!o)throw new Error(`Unknown browser id: ${t}`);await o.input.resolve();let n=await this.cdpService.createSessionGroup(t),r=new O;r.add(this.cdpService.onCDPMessage(n)(s=>{this._proxy.$onCDPSessionMessage(e,s)})),r.add(this.cdpService.onDidDestroy(n)(()=>{this._cdpSessions.deleteAndDispose(e)})),r.add(ee(()=>{this.cdpService.destroySessionGroup(n).catch(()=>{}),this._proxy.$onCDPSessionClosed(e)})),this._cdpSessions.set(e,{groupId:n,dispose:()=>r.dispose()})}async $closeCDPSession(e){this._cdpSessions.deleteAndDispose(e)}async $sendCDPMessage(e,t){let o=this._cdpSessions.get(e);o&&await this.cdpService.sendCDPMessage(o.groupId,t)}async $closeBrowserTab(e){let t=this._knownBrowsers.get(e);if(!t)throw new Error(`Unknown browser id: ${e}`);t.input.dispose()}};KWt=I([fo(Xi.MainThreadBrowsers),m(1,ie),m(2,UWt),m(3,Bm),m(4,kt),m(5,B)],KWt);var hMe=class{constructor(i){this.instantiationService=i;this.instantiationService.createInstance(MRt),this.instantiationService.createInstance(ARt),this.instantiationService.createInstance(NRt),this.instantiationService.createInstance(BRt),this.instantiationService.createInstance(tZ),this.instantiationService.createInstance(D_e),this.instantiationService.createInstance(R_e)}static{this.ID="workbench.contrib.extensionPoints"}};hMe=I([m(0,F)],hMe);bt(hMe.ID,hMe,vt.BlockStartup);var oki=class extends k{constructor(e,t){super();this.item=e;this.onClose=t;this._onDidClose=this._register(new T);this.onDidClose=this._onDidClose.event;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.registerListeners()}registerListeners(){this._register(this.item.onDidChangeVisibility(e=>this._onDidChangeVisibility.fire(e))),U.once(this.item.onDidClose)(()=>{this._onDidClose.fire(),this.dispose()})}get progress(){return this.item.progress}updateSeverity(e){this.item.updateSeverity(e)}updateMessage(e){this.item.updateMessage(e)}updateActions(e){this.item.updateActions(e)}close(){this.onClose(this.item),this.dispose()}},GWt=class a extends k{constructor(){super(...arguments);this._onDidChangeNotification=this._register(new T);this.onDidChangeNotification=this._onDidChangeNotification.event;this._onDidChangeStatusMessage=this._register(new T);this.onDidChangeStatusMessage=this._onDidChangeStatusMessage.event;this._onDidChangeFilter=this._register(new T);this.onDidChangeFilter=this._onDidChangeFilter.event;this._notifications=[];this.filter={global:0,sources:new Map}}static{this.NO_OP_NOTIFICATION=new lde}get notifications(){return this._notifications}get statusMessage(){return this._statusMessage}setFilter(e){let t=!1;typeof e.global=="number"&&(t=this.filter.global!==e.global,this.filter.global=e.global);let o=!1;e.sources&&(o=!Cle(this.filter.sources,e.sources),this.filter.sources=e.sources),(t||o)&&this._onDidChangeFilter.fire({global:t?e.global:void 0,sources:o?e.sources:void 0})}addNotification(e){let t=this.createViewItem(e);return t?(this.findNotification(t)?.close(),this._notifications.splice(0,0,t),this._onDidChangeNotification.fire({item:t,index:0,kind:0}),new oki(t,n=>this.onClose(n))):a.NO_OP_NOTIFICATION}onClose(e){let t=this.findNotification(e);t&&t!==e?t.close():e.close()}findNotification(e){return this._notifications.find(t=>t.equals(e))}createViewItem(e){let t=gMe.create(e,this.filter);if(!t)return;let o=(s,l)=>{let c=this._notifications.indexOf(t);c>=0&&this._onDidChangeNotification.fire({item:t,index:c,kind:s,detail:l})},n=t.onDidChangeExpansion(()=>o(2)),r=t.onDidChangeContent(s=>o(1,s.kind));return U.once(t.onDidClose)(()=>{n.dispose(),r.dispose();let s=this._notifications.indexOf(t);s>=0&&(this._notifications.splice(s,1),this._onDidChangeNotification.fire({item:t,index:s,kind:3}))}),t}showStatusMessage(e,t){let o=rki.create(e,t);return o?(this._statusMessage=o,this._onDidChangeStatusMessage.fire({kind:0,item:o}),{close:()=>{this._statusMessage===o&&(this._statusMessage=void 0,this._onDidChangeStatusMessage.fire({kind:1,item:o}))}}):{close:()=>{}}}};function qWt(a){return a instanceof gMe}var nki=class extends k{constructor(){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._state=Object.create(null)}get state(){return this._state}infinite(){this._state.infinite||(this._state.infinite=!0,this._state.total=void 0,this._state.worked=void 0,this._state.done=void 0,this._onDidChange.fire())}done(){this._state.done||(this._state.done=!0,this._state.infinite=void 0,this._state.total=void 0,this._state.worked=void 0,this._onDidChange.fire())}total(e){this._state.total!==e&&(this._state.total=e,this._state.infinite=void 0,this._state.done=void 0,this._onDidChange.fire())}worked(e){typeof this._state.worked=="number"?this._state.worked+=e:this._state.worked=e,this._state.infinite=void 0,this._state.done=void 0,this._onDidChange.fire()}},gMe=class a extends k{constructor(e,t,o,n,r,s,l,c){super();this.id=e;this._severity=t;this._sticky=o;this._priority=n;this._message=r;this._source=s;this._visible=!1;this._onDidChangeExpansion=this._register(new T);this.onDidChangeExpansion=this._onDidChangeExpansion.event;this._onDidClose=this._register(new T);this.onDidClose=this._onDidClose.event;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;l&&this.setProgress(l),this.setActions(c)}static{this.MAX_MESSAGE_LENGTH=1e3}static create(e,t){if(!e?.message||Yi(e.message))return;let o;typeof e.severity=="number"?o=e.severity:o=ft.Info;let n=a.parseNotificationMessage(e.message);if(!n)return;let r;e.actions?r=e.actions:RY(e.message)&&(r={primary:e.message.actions});let s=e.priority??0;return(s===0||s===1)&&o!==ft.Error&&(t.global===1?s=2:yX(e.source)&&t.sources.get(e.source.id)===1&&(s=2)),new a(e.id,o,e.sticky,s,n,e.source,e.progress,r)}static parseNotificationMessage(e){let t;if(e instanceof Error?t=Mn(e,!1):typeof e=="string"&&(t=e),!t)return;let o=t;t.length>a.MAX_MESSAGE_LENGTH&&(t=`${t.substr(0,a.MAX_MESSAGE_LENGTH)}...`),t=t.replace(/(\r\n|\n|\r)/gm," ").trim();let n=ZS(t);return{raw:o,linkedText:n,original:e}}setProgress(e){e.infinite?this.progress.infinite():e.total&&(this.progress.total(e.total),e.worked&&this.progress.worked(e.worked))}setActions(e={primary:[],secondary:[]}){this._actions={primary:Array.isArray(e.primary)?e.primary:[],secondary:Array.isArray(e.secondary)?e.secondary:[]},this._expanded=e.primary&&e.primary.length>0}get canCollapse(){return!this.hasActions}get expanded(){return!!this._expanded}get severity(){return this._severity}get sticky(){if(this._sticky)return!0;let e=this.hasActions;return!!(e&&this._severity===ft.Error||!e&&this._expanded||this._progress&&!this._progress.state.done)}get priority(){return this._priority}get hasActions(){return!this._actions||!this._actions.primary?!1:this._actions.primary.length>0}get hasProgress(){return!!this._progress}get progress(){return this._progress||(this._progress=this._register(new nki),this._register(this._progress.onDidChange(()=>this._onDidChangeContent.fire({kind:3})))),this._progress}get message(){return this._message}get source(){return typeof this._source=="string"?this._source:this._source?this._source.label:void 0}get sourceId(){return this._source&&typeof this._source!="string"&&"id"in this._source?this._source.id:void 0}get actions(){return this._actions}get visible(){return this._visible}updateSeverity(e){e!==this._severity&&(this._severity=e,this._onDidChangeContent.fire({kind:0}))}updateMessage(e){let t=a.parseNotificationMessage(e);!t||t.raw===this._message.raw||(this._message=t,this._onDidChangeContent.fire({kind:1}))}updateActions(e){this.setActions(e),this._onDidChangeContent.fire({kind:2})}updateVisibility(e){this._visible!==e&&(this._visible=e,this._onDidChangeVisibility.fire(e))}expand(){this._expanded||!this.canCollapse||(this._expanded=!0,this._onDidChangeExpansion.fire())}collapse(e){!this._expanded||!this.canCollapse||(this._expanded=!1,e||this._onDidChangeExpansion.fire())}toggle(){this._expanded?this.collapse():this.expand()}close(){this._onDidClose.fire(),this.dispose()}equals(e){if(this.hasProgress||e.hasProgress)return!1;if(typeof this.id=="string"||typeof e.id=="string")return this.id===e.id;if(typeof this._source=="object"){if(this._source.label!==e.source||this._source.id!==e.sourceId)return!1}else if(this._source!==e.source)return!1;if(this._message.raw!==e.message.raw)return!1;let t=this._actions?.primary||[],o=e.actions?.primary||[];return eo(t,o,(n,r)=>n.id+n.label===r.id+r.label)}},dhe=class a extends it{constructor(e,t){super(e,t.label,void 0,!0,async()=>{t.run(),this._onDidRun.fire()});this._onDidRun=this._register(new T);this.onDidRun=this._onDidRun.event;this._keepOpen=!!t.keepOpen,this._menu=!t.isSecondary&&t.menu?t.menu.map((o,n)=>new a(`${e}.${n}`,o)):void 0}get menu(){return this._menu}get keepOpen(){return this._keepOpen}},rki=class{static create(i,e){if(!i||Yi(i))return;let t;if(i instanceof Error?t=Mn(i,!1):typeof i=="string"&&(t=i),!!t)return{message:t,options:e}}};function NN(a){let i=a.getValue("workbench.notifications.position");return i==="bottom-left"||i==="top-right"?i:"bottom-right"}var ski=(()=>{if(et&&Qr)return"${activeEditorShort}${separator}${rootName}${separator}${profileName}";let a="${dirty}${activeEditorShort}${separator}${rootName}${separator}${profileName}${separator}${appName}";return Ft?a+"${separator}${remoteName}":a})(),aki=et?" \u2014 ":" - ",CR=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.configurationService=t;this.contextKeyService=o;this.editorService=n;this.environmentService=r;this.contextService=s;this.labelService=l;this.userDataProfileService=c;this.productService=u;this.viewsService=p;this.decorationsService=h;this.accessibilityService=g;this.properties={isPure:!0,isAdmin:!1,prefix:void 0};this.variables=new Map;this.activeEditorListeners=this._register(new O);this.titleUpdater=this._register(new Dt(()=>this.doUpdateTitle(),0));this.onDidChangeEmitter=this._register(new T);this.onDidChange=this.onDidChangeEmitter.event;this.titleIncludesFocusedView=!1;this.titleIncludesEditorState=!1;this.windowId=e.vscodeWindowId,this.checkTitleVariables(),this.registerListeners()}static{this.NLS_USER_IS_ADMIN=ii?d(5149,null):d(5150,null)}static{this.NLS_EXTENSION_HOST=d(5148,null)}static{this.TITLE_DIRTY="\u25CF "}get value(){return this.title??""}get workspaceName(){return this.labelService.getWorkspaceLabel(this.contextService.getWorkspace())}get fileName(){let e=this.editorService.activeEditor;if(!e)return;let t=e.getTitle(0);return`${e?.isDirty()&&!e.isSaving()?CR.TITLE_DIRTY:""}${t}`}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationChanged(e))),this._register(this.editorService.onDidActiveEditorChange(()=>this.onActiveEditorChange())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.titleUpdater.schedule())),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.titleUpdater.schedule())),this._register(this.contextService.onDidChangeWorkspaceName(()=>this.titleUpdater.schedule())),this._register(this.labelService.onDidChangeFormatters(()=>this.titleUpdater.schedule())),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>this.titleUpdater.schedule())),this._register(this.viewsService.onDidChangeFocusedView(()=>{this.titleIncludesFocusedView&&this.titleUpdater.schedule()})),this._register(this.contextKeyService.onDidChangeContext(e=>{e.affectsSome(this.variables)&&this.titleUpdater.schedule()})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this.titleUpdater.schedule()))}onConfigurationChanged(e){let t=e.affectsConfiguration("window.title");t&&this.checkTitleVariables(),(t||e.affectsConfiguration("window.titleSeparator"))&&this.titleUpdater.schedule()}checkTitleVariables(){let e=this.configurationService.getValue("window.title");typeof e=="string"&&(this.titleIncludesFocusedView=e.includes("${focusedView}"),this.titleIncludesEditorState=e.includes("${activeEditorState}"))}onActiveEditorChange(){this.activeEditorListeners.clear(),this.titleUpdater.schedule();let e=this.editorService.activeEditor;if(e&&(this.activeEditorListeners.add(e.onDidChangeDirty(()=>this.titleUpdater.schedule())),this.activeEditorListeners.add(e.onDidChangeLabel(()=>this.titleUpdater.schedule()))),this.titleIncludesFocusedView){let t=this.editorService.activeTextEditorControl,o=[];fn(t)?o.push(t):Lc(t)&&o.push(t.getOriginalEditor(),t.getModifiedEditor());for(let n of o)this.activeEditorListeners.add(n.onDidBlurEditorText(()=>this.titleUpdater.schedule())),this.activeEditorListeners.add(n.onDidFocusEditorText(()=>this.titleUpdater.schedule()))}this.titleIncludesEditorState&&this.activeEditorListeners.add(this.decorationsService.onDidChangeDecorations(()=>this.titleUpdater.schedule()))}doUpdateTitle(){let e=this.getFullWindowTitle();if(e!==this.title){let t=e;CL(t)||(t=this.productService.nameLong);let o=gv(this.windowId,!0).window;!o.document.title&&et&&t===this.productService.nameLong&&(o.document.title=`${this.productService.nameLong} ${CR.TITLE_DIRTY}`),o.document.title=t,this.title=e,this.onDidChangeEmitter.fire()}}getFullWindowTitle(){let{prefix:e,suffix:t}=this.getTitleDecorations(),o=this.getWindowTitle()||this.productService.nameLong;return e&&(o=`${e} ${o}`),t&&(o=`${o} ${t}`),o.replace(/[^\S ]/g," ")}getTitleDecorations(){let e,t;return this.properties.prefix&&(e=this.properties.prefix),this.environmentService.isExtensionDevelopment&&(e=e?`${CR.NLS_EXTENSION_HOST} - ${e}`:CR.NLS_EXTENSION_HOST),this.properties.isAdmin&&(t=CR.NLS_USER_IS_ADMIN),{prefix:e,suffix:t}}updateProperties(e){let t=typeof e.isAdmin=="boolean"?e.isAdmin:this.properties.isAdmin,o=typeof e.isPure=="boolean"?e.isPure:this.properties.isPure,n=typeof e.prefix=="string"?e.prefix:this.properties.prefix;(t!==this.properties.isAdmin||o!==this.properties.isPure||n!==this.properties.prefix)&&(this.properties.isAdmin=t,this.properties.isPure=o,this.properties.prefix=n,this.titleUpdater.schedule())}registerVariables(e){let t=!1;for(let{name:o,contextKey:n}of e)this.variables.has(n)||(this.variables.set(n,o),t=!0);t&&this.titleUpdater.schedule()}getWindowTitle(){let e=this.editorService.activeEditor,t=this.contextService.getWorkspace(),o;t.configuration?o=t.configuration:t.folders.length&&(o=t.folders[0].uri);let n=po.getOriginalUri(e,{supportSideBySide:1}),r=n?ai(n):void 0;r?.path==="."&&(r=void 0);let s;this.contextService.getWorkbenchState()===2?s=t.folders[0]:n&&(s=this.contextService.getWorkspaceFolder(n)??void 0);let l;if(this.environmentService.remoteAuthority&&!Ft)l=this.labelService.getHostLabel(Q.vscodeRemote,this.environmentService.remoteAuthority);else{let se=PM(t);se&&(l=this.labelService.getHostLabel(se.scheme,se.authority))}let c=e?e.getTitle(0):"",u=e?e.getTitle(1):c,p=e?e.getTitle(2):u,h=r?Be(r):"",g=r?this.labelService.getUriLabel(r,{relative:!0}):"",f=r?this.labelService.getUriLabel(r):"",v=this.labelService.getWorkspaceLabel(t),b=this.labelService.getWorkspaceLabel(t,{verbose:0}),S=o?this.labelService.getUriLabel(o):"",y=s?s.name:"",w=s?this.labelService.getUriLabel(s.uri):"",x=e?.isDirty()&&!e.isSaving()?CR.TITLE_DIRTY:"",E=this.productService.nameLong,M=this.userDataProfileService.currentProfile.isDefault?"":this.userDataProfileService.currentProfile.name,N=this.viewsService.getFocusedViewName(),V=n?this.decorationsService.getDecoration(n,!1)?.tooltip:void 0,H=this.editorService.activeTextEditorLanguageId,K={};for(let[se,ae]of this.variables)K[ae]=this.contextKeyService.getContextKeyValue(se)??"";let j=this.configurationService.getValue("window.title");typeof j!="string"&&(j=ski),!this.titleIncludesEditorState&&this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("accessibility.windowTitleOptimized")&&(j+="${separator}${activeEditorState}");let J=this.configurationService.getValue("window.titleSeparator");return typeof J!="string"&&(J=aki),Fyt(j,{...K,activeEditorShort:c,activeEditorLong:p,activeEditorMedium:u,activeEditorLanguageId:H,activeFolderShort:h,activeFolderMedium:g,activeFolderLong:f,rootName:v,rootPath:S,rootNameShort:b,folderName:y,folderPath:w,dirty:x,appName:E,remoteName:l,profileName:M,focusedView:N,activeEditorState:V,separator:{label:J}})}isCustomTitleFormat(){if(this.accessibilityService.isScreenReaderOptimized()||this.titleIncludesEditorState)return!0;let e=this.configurationService.inspect("window.title"),t=this.configurationService.inspect("window.titleSeparator");if(m5(e)||m5(t))return!0;let n=oe.as($t.Configuration).getConfigurationProperties();return e.defaultValue!==n["window.title"]?.defaultDefaultValue}};CR=I([m(1,B),m(2,X),m(3,ie),m(4,Od),m(5,Ae),m(6,nt),m(7,gn),m(8,Ze),m(9,Gt),m(10,mb),m(11,Ai)],CR);var lki=oe.as($t.Configuration);(function(){bt(tme.ID,tme,vt.Eventually),bt(z3.ID,z3,vt.AfterRestored),lki.registerConfiguration({...jd,properties:{"workbench.externalBrowser":{type:"string",markdownDescription:d(5213,null),included:Qr,restricted:!0},"workbench.editor.titleScrollbarSizing":{type:"string",enum:["default","large"],enumDescriptions:[d(5403,null),d(5404,null)],description:d(5309,null),default:"default"},"workbench.editor.titleScrollbarVisibility":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[d(5405,null),d(5407,null),d(5406,null)],description:d(5312,null),default:"auto"},"workbench.editor.showTabs":{type:"string",enum:["multiple","single","none"],enumDescriptions:[d(5387,null),d(5389,null),d(5388,null)],description:d(5296,null),default:"multiple"},"workbench.editor.editorActionsLocation":{type:"string",enum:["default","titleBar","hidden"],markdownEnumDescriptions:[d(5353,null,"`#workbench.editor.showTabs#`","`none`"),d(5355,null,"`#window.customTitleBarVisibility#`","`never`"),d(5354,null)],markdownDescription:d(5229,null),default:"default",agentsWindow:{default:"default",readOnly:!0}},"workbench.editor.alwaysShowEditorActions":{type:"boolean",markdownDescription:d(5208,null),default:!1},"workbench.editor.wrapTabs":{type:"boolean",markdownDescription:d(5438,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.scrollToSwitchTabs":{type:"boolean",markdownDescription:d(5284,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.highlightModifiedTabs":{type:"boolean",markdownDescription:d(5242,null,"`#workbench.editor.showTabs#`","multiple"),default:!1},"workbench.editor.decorations.badges":{type:"boolean",markdownDescription:d(5224,null),default:!0},"workbench.editor.decorations.colors":{type:"boolean",markdownDescription:d(5225,null),default:!0},[XA.SETTING_ID_ENABLED]:{type:"boolean",markdownDescription:d(5359,null),default:!0},[XA.SETTING_ID_PATTERNS]:{type:"object",markdownDescription:(()=>{let e=d(5364,null);return e+=`
- `+[d(5358,null),d(5362,null),d(5361,null),d(5360,null),d(5363,null)].join(`
- `),e+=`

`+d(5222,null),e})(),additionalProperties:{type:["string","null"],markdownDescription:d(5365,null),minLength:1,pattern:".*[a-zA-Z0-9].*"},default:{}},"workbench.editor.labelFormat":{type:"string",enum:["default","short","medium","long"],enumDescriptions:[d(5366,null),d(5369,null),d(5368,null),d(5367,null)],default:"default",description:d(5308,null)},"workbench.editor.untitled.labelFormat":{type:"string",enum:["content","name"],enumDescriptions:[d(5408,null),d(5409,null)],default:"content",description:d(5313,null)},"workbench.editor.empty.hint":{type:"string",enum:["text","hidden"],default:"text",markdownDescription:d(5356,null)},"workbench.editor.languageDetection":{type:"boolean",default:!0,description:d(5370,null),scope:6},"workbench.editor.historyBasedLanguageDetection":{type:"boolean",default:!0,description:d(5357,null)},"workbench.editor.preferHistoryBasedLanguageDetection":{type:"boolean",default:!1,description:d(5378,null)},"workbench.editor.languageDetectionHints":{type:"object",default:{untitledEditors:!0,notebookEditors:!0},description:d(5384,null),additionalProperties:!1,properties:{untitledEditors:{type:"boolean",description:d(5385,null)},notebookEditors:{type:"boolean",description:d(5386,null)}}},"workbench.editor.tabActionLocation":{type:"string",enum:["left","right"],default:"right",markdownDescription:d(5307,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabActionCloseVisibility":{type:"boolean",default:!0,description:d(5395,null)},"workbench.editor.tabActionUnpinVisibility":{type:"boolean",default:!0,description:d(5396,null)},"workbench.editor.showTabIndex":{type:"boolean",default:!1,markdownDescription:d(5298,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabSizing":{type:"string",enum:["fit","shrink","fixed"],default:"fit",enumDescriptions:[d(5398,null),d(5400,null),d(5399,null)],markdownDescription:d(5310,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.tabSizingFixedMinWidth":{type:"number",default:50,minimum:38,markdownDescription:d(5402,null,"`#workbench.editor.tabSizing#`","`fixed`")},"workbench.editor.tabSizingFixedMaxWidth":{type:"number",default:160,minimum:38,markdownDescription:d(5401,null,"`#workbench.editor.tabSizing#`","`fixed`")},"window.density.editorTabHeight":{type:"string",enum:["default","compact"],default:"default",markdownDescription:d(5397,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.pinnedTabSizing":{type:"string",enum:["normal","compact","shrink"],default:"normal",enumDescriptions:[d(5375,null),d(5374,null),d(5376,null)],markdownDescription:d(5273,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.pinnedTabsOnSeparateRow":{type:"boolean",default:!1,markdownDescription:d(5377,null,"`#workbench.editor.showTabs#`","`multiple`")},"workbench.editor.preventPinnedEditorClose":{type:"string",enum:["keyboardAndMouse","keyboard","mouse","never"],default:"keyboardAndMouse",enumDescriptions:[d(5380,null),d(5382,null),d(5383,null),d(5381,null)],description:d(5379,null)},"workbench.editor.splitSizing":{type:"string",enum:["auto","distribute","split"],default:"auto",enumDescriptions:[d(5392,null),d(5393,null),d(5394,null)],description:d(5303,null),keywords:["pane"]},"workbench.editor.splitOnDragAndDrop":{type:"boolean",default:!0,description:d(5302,null),keywords:["pane"]},"workbench.editor.dragToOpenWindow":{type:"boolean",default:!0,markdownDescription:d(5228,null)},"workbench.editor.focusRecentEditorAfterClose":{type:"boolean",description:d(5238,null),default:!0},"workbench.editor.showIcons":{type:"boolean",description:d(5297,null),default:!0},"workbench.editor.enablePreview":{type:"boolean",description:d(5233,null),default:!0},"workbench.editor.enablePreviewFromQuickOpen":{type:"boolean",markdownDescription:d(5235,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.enablePreviewFromCodeNavigation":{type:"boolean",markdownDescription:d(5234,null,"`#workbench.editor.showTabs#`","`multiple`"),default:!1},"workbench.editor.closeOnFileDelete":{type:"boolean",description:d(5217,null),default:!1},"workbench.editor.openPositioning":{type:"string",enum:["left","right","first","last"],default:"right",markdownDescription:d(5230,null,"`left`","`right`","`first`","`last`")},"workbench.editor.openSideBySideDirection":{type:"string",enum:["right","down"],default:"right",markdownDescription:d(5300,null)},"workbench.editor.closeEmptyGroups":{type:"boolean",description:d(5216,null),default:!0,keywords:["pane"]},"workbench.editor.revealIfOpen":{type:"boolean",description:d(5280,null),default:!1},"workbench.editor.useModal":{type:"string",enum:["off","some","all"],enumDescriptions:[d(5316,null),d(5317,null),d(5315,null)],description:d(5314,null),default:"some",agentsWindow:{default:"all"}},"workbench.editor.swipeToNavigate":{type:"boolean",description:d(5306,null),default:!1,included:et&&!Ft},"workbench.editor.mouseBackForwardToNavigate":{type:"boolean",description:d(5258,null),default:!0},"workbench.editor.navigationScope":{type:"string",enum:["default","editorGroup","editor"],default:"default",markdownDescription:d(5261,null),enumDescriptions:[d(5371,null),d(5373,null),d(5372,null)]},"workbench.editor.restoreViewState":{type:"boolean",markdownDescription:d(5279,null,"`#workbench.editor.sharedViewState#`"),default:!0,scope:6},"workbench.editor.sharedViewState":{type:"boolean",description:d(5294,null),default:!1},"workbench.editor.restoreEditors":{type:"boolean",description:d(5278,null),default:!0,agentsWindow:{default:!1,readOnly:!0}},"workbench.editor.splitInGroupLayout":{type:"string",enum:["vertical","horizontal"],default:"horizontal",markdownDescription:d(5301,null),enumDescriptions:[d(5391,null),d(5390,null)]},"workbench.editor.centeredLayoutAutoResize":{type:"boolean",default:!0,description:d(5214,null)},"workbench.editor.centeredLayoutFixedWidth":{type:"boolean",default:!1,description:d(5215,null)},"workbench.editor.doubleClickTabToToggleEditorGroupSizes":{type:"string",enum:["maximize","expand","off"],default:"expand",markdownDescription:d(5227,null,"`#workbench.editor.showTabs#`","`multiple`"),enumDescriptions:[d(5351,null),d(5350,null),d(5352,null)],agentsWindow:{default:"maximize",readOnly:!0}},"workbench.editor.limit.enabled":{type:"boolean",default:!1,description:d(5249,null)},"workbench.editor.limit.value":{type:"number",default:10,exclusiveMinimum:0,markdownDescription:d(5251,null,"`#workbench.editor.limit.perEditorGroup#`")},"workbench.editor.limit.excludeDirty":{type:"boolean",default:!1,description:d(5250,null)},"workbench.editor.limit.perEditorGroup":{type:"boolean",default:!1,description:d(5272,null)},"workbench.localHistory.enabled":{type:"boolean",default:!0,description:d(5252,null),scope:5},"workbench.localHistory.maxFileSize":{type:"number",default:256,minimum:1,description:d(5254,null),scope:5},"workbench.localHistory.maxFileEntries":{type:"number",default:50,minimum:0,description:d(5253,null),scope:5},"workbench.localHistory.exclude":{type:"object",patternProperties:{".*":{type:"boolean"}},markdownDescription:d(5236,null),scope:5},"workbench.localHistory.mergeWindow":{type:"number",default:10,minimum:1,markdownDescription:d(5257,null),scope:5},"workbench.commandPalette.history":{type:"number",description:d(5219,null),default:50,minimum:0},"workbench.commandPalette.preserveInput":{type:"boolean",description:d(5274,null),default:!1},"workbench.commandPalette.experimental.suggestCommands":{type:"boolean",tags:["experimental"],description:d(5305,null),default:!1},"workbench.commandPalette.experimental.askChatLocation":{type:"string",tags:["experimental"],description:d(5210,null),default:"chatView",enum:["chatView","quickChat"],enumDescriptions:[d(5211,null),d(5212,null)]},"workbench.commandPalette.showAskInChat":{type:"boolean",tags:["experimental"],description:d(5295,null),default:!0},"workbench.commandPalette.experimental.enableNaturalLanguageSearch":{type:"boolean",tags:["experimental"],description:d(5232,null),default:!0},"workbench.quickOpen.closeOnFocusLost":{type:"boolean",description:d(5218,null),default:!0},"workbench.quickOpen.preserveInput":{type:"boolean",description:d(5423,null),default:!1},"workbench.settings.openDefaultSettings":{type:"boolean",description:d(5265,null),default:!1},"workbench.settings.useSplitJSON":{type:"boolean",markdownDescription:d(5318,null),default:!1},"workbench.settings.openDefaultKeybindings":{type:"boolean",description:d(5264,null),default:!1},"workbench.settings.alwaysShowAdvancedSettings":{type:"boolean",description:d(5207,null),default:$i.quality!=="stable"},"workbench.sideBar.location":{type:"string",enum:["left","right"],default:"left",description:d(5299,null),agentsWindow:{default:"left",readOnly:!0}},"workbench.panel.showLabels":{type:"boolean",default:!0,description:d(5271,null)},"workbench.panel.defaultLocation":{type:"string",enum:["left","bottom","top","right"],default:"bottom",description:d(5269,null),agentsWindow:{default:"bottom",readOnly:!0}},"workbench.panel.opensMaximized":{type:"string",enum:["always","never","preserve"],default:"preserve",description:d(5270,null),enumDescriptions:[d(5419,null),d(5420,null),d(5421,null)],agentsWindow:{default:"never",readOnly:!0}},"workbench.secondarySideBar.defaultVisibility":{type:"string",enum:["hidden","visibleInWorkspace","visible","maximizedInWorkspace","maximized"],default:"visibleInWorkspace",description:d(5285,null),enumDescriptions:[d(5432,null),d(5436,null),d(5435,null),d(5434,null),d(5433,null)],agentsWindow:{default:"visibleInWorkspace",readOnly:!0}},"workbench.secondarySideBar.forceMaximized":{type:"boolean",default:!1,tags:["experimental"],description:d(5286,null),agentsWindow:{default:!1,readOnly:!0}},"workbench.secondarySideBar.showLabels":{type:"boolean",default:!0,markdownDescription:d(5287,null,"`#workbench.activityBar.location#`","`top`"),agentsWindow:{default:!0,readOnly:!0}},"workbench.statusBar.visible":{type:"boolean",default:!0,description:d(5304,null),agentsWindow:{default:!1,readOnly:!0}},"workbench.notifications.position":{type:"string",enum:["bottom-right","bottom-left","top-right"],default:"bottom-right",description:d(5263,null),enumDescriptions:[d(5417,null),d(5416,null),d(5418,null)],tags:["experimental"],experiment:{mode:"auto"}},"workbench.notifications.showInTitleBar":{type:"boolean",default:!0,description:d(5262,null)},"workbench.activityBar.location":{type:"string",enum:["default","top","bottom","hidden"],default:"default",markdownDescription:d(5206,null),enumDescriptions:[d(5347,null),d(5349,null),d(5346,null),d(5348,null)],agentsWindow:{default:"default",readOnly:!0}},"workbench.activityBar.autoHide":{type:"boolean",default:!1,markdownDescription:d(5203,null,"`#workbench.activityBar.location#`","`top`","`bottom`"),agentsWindow:{default:!1,readOnly:!0}},"workbench.activityBar.compact":{type:"boolean",default:!1,markdownDescription:d(5204,null,"`#workbench.activityBar.location#`","`default`"),agentsWindow:{default:!1,readOnly:!0}},"workbench.activityBar.iconClickBehavior":{type:"string",enum:["toggle","focus"],default:"toggle",markdownDescription:d(5205,null,"`#workbench.activityBar.location#`","`default`"),enumDescriptions:[d(5345,null),d(5344,null)],agentsWindow:{default:"toggle",readOnly:!0}},"workbench.view.alwaysShowHeaderActions":{type:"boolean",default:!1,description:d(5319,null)},"workbench.view.showQuietly":{type:"object",description:d(5437,null),scope:4,properties:{"workbench.panel.output":{type:"boolean",description:d(5422,null)}},additionalProperties:!1},"workbench.fontAliasing":{type:"string",enum:["default","antialiased","none","auto"],default:"default",description:d(5241,null),enumDescriptions:[d(5412,null),d(5410,null),d(5413,null),d(5411,null)],included:et},"workbench.settings.editor":{type:"string",enum:["ui","json"],enumDescriptions:[d(5291,null),d(5290,null)],description:d(5289,null),default:"ui",scope:4},"workbench.settings.showAISearchToggle":{type:"boolean",default:!0,description:d(5292,null)},"workbench.hover.delay":{type:"number",description:d(5414,null),default:et?1500:500,minimum:0},"workbench.hover.reducedDelay":{type:"number",description:d(5415,null),default:500,minimum:0},"workbench.reduceMotion":{type:"string",description:d(5424,null),enumDescriptions:[d(5427,null),d(5426,null),d(5425,null)],default:"auto",tags:["accessibility"],enum:["on","off","auto"]},"workbench.reduceTransparency":{type:"string",description:d(5428,null),enumDescriptions:[d(5431,null),d(5430,null),d(5429,null)],default:"off",tags:["accessibility"],enum:["on","off","auto"]},"workbench.navigationControl.enabled":{type:"boolean",default:!0,markdownDescription:Ft?d(5260,null):d(5259,null,"`#window.customTitleBarVisibility#`","`never`"),agentsWindow:{default:!1,readOnly:!0}},"workbench.layoutControl.enabled":{type:"boolean",default:!0,markdownDescription:Ft?d(5247,null):d(5246,null,"`#window.customTitleBarVisibility#`","`never`"),agentsWindow:{default:!0,readOnly:!0}},"workbench.layoutControl.type":{type:"string",enum:["menu","toggles","both"],enumDescriptions:[d(5244,null),d(5245,null),d(5243,null)],default:"both",description:d(5248,null),agentsWindow:{default:"both",readOnly:!0}},"workbench.tips.enabled":{type:"boolean",default:!0,description:d(5311,null),agentsWindow:{default:!1}},"workbench.shadows":{type:"boolean",default:!0,description:d(5293,null)}}});let i=d(5343,null);i+=`
- `+[d(5196,null),d(5195,null),d(5194,null),d(5193,null),d(5200,null),d(5199,null),d(5198,null),d(5239,null),d(5240,null),d(5281,null),d(5282,null),d(5283,null),d(5276,null),d(5209,null),d(5277,null),d(5226,null),d(5237,null),d(5202,null),d(5201,null),d(5197,null,"`accessibility.windowTitleOptimized`"),d(5288,null)].join(`
- `),lki.registerConfiguration({...NIi,properties:{"window.title":{type:"string",default:ski,markdownDescription:i,agentsWindow:{default:"${appName}",readOnly:!0}},"window.titleSeparator":{type:"string",default:aki,markdownDescription:d(5342,null,"`#window.title#`")},"window.commandCenter":{type:"boolean",default:!0,markdownDescription:Ft?d(5321,null):d(5320,null,"`#window.customTitleBarVisibility#`","`never`"),agentsWindow:{default:!1,readOnly:!0}},"window.menuBarVisibility":{type:"string",enum:["classic","visible","toggle","hidden","compact"],markdownEnumDescriptions:[d(5328,null),d(5334,null),et?d(5333,null):d(5332,null),d(5331,null),Ft?d(5330,null):d(5329,null,"`#window.titleBarStyle#`","`native`","`#window.menuStyle#`","`native`","`inherit`")],default:Ft?"compact":"classic",scope:1,markdownDescription:et?d(5256,null):d(5255,null),included:ii||Sn||Ft},"window.enableMenuBarMnemonics":{type:"boolean",default:!0,scope:1,description:d(5231,null),included:ii||Sn},"window.customMenuBarAltFocus":{type:"boolean",default:!0,scope:1,markdownDescription:d(5223,null),included:ii||Sn,agentsWindow:{default:!1,readOnly:!0}},"window.openFilesInNewWindow":{type:"string",enum:["on","off","default"],enumDescriptions:[d(5338,null),d(5337,null),et?d(5336,null):d(5335,null)],default:"off",scope:1,markdownDescription:et?d(5267,null):d(5266,null)},"window.openFoldersInNewWindow":{type:"string",enum:["on","off","default"],enumDescriptions:[d(5341,null),d(5340,null),d(5339,null)],default:"default",scope:1,markdownDescription:d(5268,null)},"window.confirmBeforeClose":{type:"string",enum:["always","keyboardOnly","never"],enumDescriptions:[Ft?d(5323,null):d(5322,null),Ft?d(5325,null):d(5324,null),Ft?d(5327,null):d(5326,null)],default:Ft&&!owe()?"keyboardOnly":"never",markdownDescription:Ft?d(5221,null):d(5220,null),scope:1}}}),bt(ime.ID,ime,vt.Eventually),lki.registerConfiguration({...pNt,properties:{"problems.visibility":{type:"boolean",default:!0,description:d(5275,null)}}})})();oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.activityBar.visible",migrateFn:a=>{let i=[];return a!==void 0&&i.push(["workbench.activityBar.visible",{value:void 0}]),a===!1&&i.push(["workbench.activityBar.location",{value:"hidden"}]),i}}]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.activityBar.location",migrateFn:a=>{let i=[];return a==="side"&&i.push(["workbench.activityBar.location",{value:"default"}]),i}}]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"workbench.editor.doubleClickTabToToggleEditorGroupSizes",migrateFn:a=>{let i=[];return typeof a=="boolean"&&(a=a?"expand":"off",i.push(["workbench.editor.doubleClickTabToToggleEditorGroupSizes",{value:a}])),i}},{key:"workbench.editor.showTabs",migrateFn:a=>{let i=[];return typeof a=="boolean"&&(a=a?"multiple":"single",i.push(["workbench.editor.showTabs",{value:a}])),i}},{key:"workbench.editor.tabCloseButton",migrateFn:a=>{let i=[];return a==="left"||a==="right"?i.push(["workbench.editor.tabActionLocation",{value:a}]):a==="off"&&i.push(["workbench.editor.tabActionCloseVisibility",{value:!1}]),i}},{key:"zenMode.hideTabs",migrateFn:a=>{let i=[["zenMode.hideTabs",{value:void 0}]];return a===!0&&i.push(["zenMode.showTabs",{value:"single"}]),i}}]);var AG=class extends it{constructor(e){super(e.id,e.name,e.classNames?.join(" "),!0);this.item=e;this._onDidChangeCompositeBarActionItem=this._register(new T);this.onDidChangeCompositeBarActionItem=this._onDidChangeCompositeBarActionItem.event;this._onDidChangeActivity=this._register(new T);this.onDidChangeActivity=this._onDidChangeActivity.event;this._activities=[]}get compositeBarActionItem(){return this.item}set compositeBarActionItem(e){this._label=e.name,this.item=e,this._onDidChangeCompositeBarActionItem.fire(this)}get activities(){return this._activities}set activities(e){this._activities=e,this._onDidChangeActivity.fire(e)}activate(){this.checked||this._setChecked(!0)}deactivate(){this.checked&&this._setChecked(!1)}},pte=class extends Ja{constructor(e,t,o,n,r,s,l){super(null,e,t);this.badgesEnabled=o;this.themeService=n;this.hoverService=r;this.configurationService=s;this.keybindingService=l;this.badgeDisposable=this._register(new ue);this.options=t,this._register(this.themeService.onDidColorThemeChange(this.onThemeChange,this)),this._register(e.onDidChangeCompositeBarActionItem(()=>this.update())),this._register(U.filter(l.onDidUpdateKeybindings,()=>this.keybindingLabel!==this.computeKeybindingLabel())(()=>this.updateTitle())),this._register(e.onDidChangeActivity(()=>this.updateActivity()))}get compositeBarActionItem(){return this._action.compositeBarActionItem}updateStyles(){let e=this.themeService.getColorTheme(),t=this.options.colors(e);if(this.label){if(this.options.icon){let o=this._action.checked?t.activeForegroundColor:t.inactiveForegroundColor;this.compositeBarActionItem.iconUrl?(this.label.style.backgroundColor=o?o.toString():"",this.label.style.color=""):(this.label.style.color=o?o.toString():"",this.label.style.backgroundColor="")}else{let o=this._action.checked?t.activeForegroundColor:t.inactiveForegroundColor,n=this._action.checked?t.activeBorderBottomColor:null;this.label.style.color=o?o.toString():"",this.label.style.borderBottomColor=n?n.toString():""}this.container.style.setProperty("--insert-border-color",t.dragAndDropBorder?t.dragAndDropBorder.toString():"")}if(this.badgeContent){let o=this.getActivities()[0]?.badge.getColors(e),n=o?.badgeForeground??t.badgeForeground??e.getColor(gx),r=o?.badgeBackground??t.badgeBackground??e.getColor(Gv),s=o?.badgeBorder??e.getColor(Ei);this.badgeContent.style.color=n?n.toString():"",this.badgeContent.style.backgroundColor=r?r.toString():"",this.badgeContent.style.borderStyle=s&&!this.options.compact?"solid":"",this.badgeContent.style.borderWidth=s?"1px":"",this.badgeContent.style.borderColor=s?s.toString():""}}render(e){super.render(e),this.container=e,this.options.icon&&this.container.classList.add("icon");let t=this.options.isTabList||!this.options.hasPopup?"tab":"button";this.container.setAttribute("role",t),this.options.hasPopup&&this.container.setAttribute("aria-haspopup","true"),this._register($(this.container,ne.MOUSE_DOWN,()=>{this.container.classList.add("clicked")})),this._register($(this.container,ne.MOUSE_UP,()=>{this.mouseUpTimeout&&clearTimeout(this.mouseUpTimeout),this.mouseUpTimeout=setTimeout(()=>{this.container.classList.remove("clicked")},800)})),this._register(this.hoverService.setupDelayedHover(this.container,()=>({content:this.computeTitle(),style:1,position:{hoverPosition:this.options.hoverOptions.position()},persistence:{hideOnKeyDown:!0}}),{groupId:"composite-bar-actions"})),this.label=D(e,_("a")),this.badge=D(e,_(".badge")),this.badgeContent=D(this.badge,_(".badge-content")),D(e,_(".active-item-indicator")),Wi(this.badge),this.update(),this.updateStyles(),this.updateTitle()}onThemeChange(e){this.updateStyles()}update(){this.updateLabel(),this.updateActivity(),this.updateTitle(),this.updateStyles()}getActivities(){return this._action instanceof AG?this._action.activities:[]}updateActivity(){if(!this.badge||!this.badgeContent||!(this._action instanceof AG))return;let{badges:e,type:t}=this.getVisibleBadges(this.getActivities());this.badgeDisposable.value=new O,St(this.badgeContent),Wi(this.badge);let o=this.badgesEnabled(this.compositeBarActionItem.id);if(e.length>0&&o){let n=[];if(this.options.compact&&n.push("compact"),t==="progress")Xo(this.badge),n.push("progress-badge");else if(t==="number"){let r=e.reduce((s,l)=>s+(l instanceof eu?l.number:0),0);if(r>0){let s=r.toString();if(r>999){let l=r/1e3,c=Math.floor(l);s=l>c?`${c}K+`:`${l}K`}this.options.compact&&s.length>=3&&n.push("compact-content"),this.badgeContent.textContent=s,Xo(this.badge)}}else if(t==="icon"){n.push("icon-badge");let r=["icon-overlay",...q.asClassNameArray(e[0].icon)];this.badgeContent.classList.add(...r),this.badgeDisposable.value.add(ee(()=>this.badgeContent?.classList.remove(...r))),Xo(this.badge)}n.length&&(this.badge.classList.add(...n),this.badgeDisposable.value.add(ee(()=>this.badge.classList.remove(...n))))}this.updateTitle(),this.updateStyles()}getVisibleBadges(e){let t=e.filter(r=>r.badge instanceof Jx).map(r=>r.badge);if(t.length>0)return{badges:t,type:"progress"};let o=e.filter(r=>r.badge instanceof EG).map(r=>r.badge);if(o.length>0)return{badges:o,type:"icon"};let n=e.filter(r=>r.badge instanceof eu).map(r=>r.badge);return n.length>0?{badges:n,type:"number"}:{badges:[],type:void 0}}updateLabel(){this.label.className="action-label",this.compositeBarActionItem.classNames&&this.label.classList.add(...this.compositeBarActionItem.classNames),this.options.icon||(this.label.textContent=this.action.label)}updateTitle(){let e=this.computeTitle();[this.label,this.badge,this.container].forEach(t=>{t&&(t.setAttribute("aria-label",e),t.setAttribute("title",""),t.removeAttribute("title"))})}computeTitle(){this.keybindingLabel=this.computeKeybindingLabel();let e=this.keybindingLabel?d(4468,null,this.compositeBarActionItem.name,this.keybindingLabel):this.compositeBarActionItem.name,t=this.getVisibleBadges(this.action.activities).badges;for(let o of t)o.getDescription()&&(e=`${e} - ${o.getDescription()}`);return e}computeKeybindingLabel(){return(this.compositeBarActionItem.keybindingId?this.keybindingService.lookupKeybinding(this.compositeBarActionItem.keybindingId):null)?.getLabel()}dispose(){super.dispose(),this.mouseUpTimeout&&clearTimeout(this.mouseUpTimeout),this.badge.remove()}};pte=I([m(3,Pe),m(4,ot),m(5,B),m(6,Le)],pte);var Get=class extends AG{constructor(e){super({id:"additionalComposites.action",name:d(4462,null),classNames:q.asClassNameArray(L.more)});this.showMenu=e}async run(){this.showMenu()}},bMe=class extends pte{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,{icon:!0,colors:s,hasPopup:!0,hoverOptions:l,isTabList:!0},()=>!0,u,p,h,g);this.getOverflowingComposites=t;this.getActiveCompositeId=o;this.getBadge=n;this.getCompositeOpenAction=r;this.contextMenuService=c}showMenu(){this.contextMenuService.showContextMenu({getAnchor:()=>this.container,getActions:()=>this.getActions(),getCheckedActionsRepresentation:()=>"radio"})}getActions(){return this.getOverflowingComposites().map(e=>{let t=this.getCompositeOpenAction(e.id);t.checked=this.getActiveCompositeId()===t.id;let o=this.getBadge(e.id),n;return o instanceof eu&&(n=o.number),n?t.label=d(4466,null,e.name,n):t.label=e.name||"",t})}};bMe=I([m(7,Xe),m(8,Pe),m(9,ot),m(10,B),m(11,Le)],bMe);var SMe=class extends pte{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(t,e,c.areBadgesEnabled.bind(c),g,f,v,p);this.toggleCompositePinnedAction=o;this.toggleCompositeBadgeAction=n;this.compositeContextMenuActionsProvider=r;this.contextMenuActionsProvider=s;this.dndHandler=l;this.compositeBar=c;this.contextMenuService=u;this.commandService=b}render(e){super.render(e),this.updateChecked(),this.updateEnabled(),this._register($(this.container,ne.CONTEXT_MENU,o=>{Kt.stop(o,!0),this.showContextMenu(e)}));let t;this._register(m_.INSTANCE.registerDraggable(this.container,()=>({type:"composite",id:this.compositeBarActionItem.id}),{onDragOver:o=>{let n=o.dragAndDropData.getData().id!==this.compositeBarActionItem.id&&this.dndHandler.onDragOver(o.dragAndDropData,this.compositeBarActionItem.id,o.eventData);u8(o.eventData.dataTransfer,"move",n),t=this.updateFromDragging(e,n,o.eventData)},onDragLeave:o=>{t=this.updateFromDragging(e,!1,o.eventData)},onDragEnd:o=>{t=this.updateFromDragging(e,!1,o.eventData)},onDrop:o=>{Kt.stop(o.eventData,!0),this.dndHandler.drop(o.dragAndDropData,this.compositeBarActionItem.id,o.eventData,t),t=this.updateFromDragging(e,!1,o.eventData)},onDragStart:o=>{o.dragAndDropData.getData().id===this.compositeBarActionItem.id&&(o.eventData.dataTransfer&&(o.eventData.dataTransfer.effectAllowed="move"),this.blur())}})),[this.badge,this.label].forEach(o=>this._register(new oxe(o,()=>{this.action.checked||this.action.run()}))),this.updateStyles()}updateFromDragging(e,t,o){let n=e.getBoundingClientRect(),r=o.clientX,s=o.clientY,l=n.bottom-n.top,c=n.right-n.left,u=s<=n.top+l*.4,p=s>n.bottom-l*.4,h=s<=n.top+l*.5,g=r<=n.left+c*.4,f=r>n.right-c*.4,v=r<=n.left+c*.5,b=e.classList,S={vertical:b.contains("top")?"top":b.contains("bottom")?"bottom":void 0,horizontal:b.contains("left")?"left":b.contains("right")?"right":void 0},y=u||h&&!S.vertical||!p&&S.vertical==="top",w=p||!h&&!S.vertical||!u&&S.vertical==="bottom",x=g||v&&!S.horizontal||!f&&S.horizontal==="left",E=f||!v&&!S.horizontal||!g&&S.horizontal==="right";if(e.classList.toggle("top",t&&y),e.classList.toggle("bottom",t&&w),e.classList.toggle("left",t&&x),e.classList.toggle("right",t&&E),!!t)return{verticallyBefore:y,horizontallyBefore:x}}showContextMenu(e){let t=[];this.compositeBarActionItem.keybindingId&&t.push(LQe(this.commandService,this.keybindingService,this.compositeBarActionItem.keybindingId)),t.push(this.toggleCompositePinnedAction,this.toggleCompositeBadgeAction);let o=this.compositeContextMenuActionsProvider(this.compositeBarActionItem.id);o.length&&t.push(...o),this.compositeBar.isPinned(this.compositeBarActionItem.id)?(this.toggleCompositePinnedAction.label=d(4463,null,this.compositeBarActionItem.name),this.toggleCompositePinnedAction.checked=!1,this.toggleCompositePinnedAction.enabled=this.compositeBar.getPinnedCompositeIds().length>1):(this.toggleCompositePinnedAction.label=d(4465,null,this.compositeBarActionItem.name),this.toggleCompositePinnedAction.enabled=!0),this.compositeBar.areBadgesEnabled(this.compositeBarActionItem.id)?this.toggleCompositeBadgeAction.label=d(4464,null):this.toggleCompositeBadgeAction.label=d(4467,null);let s=this.contextMenuActionsProvider();s.length&&(t.push(new oi),t.push(...s));let l=ur(e),c={x:Math.floor(l.left+l.width/2),y:l.top+l.height};this.contextMenuService.showContextMenu({getAnchor:()=>c,getActions:()=>t,getActionsContext:()=>this.compositeBarActionItem.id})}updateChecked(){this.action.checked?(this.container.classList.add("checked"),this.container.setAttribute("aria-label",this.getTooltip()??this.container.title),this.container.setAttribute("aria-expanded","true"),this.container.setAttribute("aria-selected","true")):(this.container.classList.remove("checked"),this.container.setAttribute("aria-label",this.getTooltip()??this.container.title),this.container.setAttribute("aria-expanded","false"),this.container.setAttribute("aria-selected","false")),this.updateStyles()}updateEnabled(){this.element&&(this.action.enabled?this.element.classList.remove("disabled"):this.element.classList.add("disabled"))}dispose(){super.dispose(),this.label.remove()}};SMe=I([m(8,Xe),m(9,Le),m(10,F),m(11,Pe),m(12,ot),m(13,B),m(14,fe)],SMe);var qet=class extends it{constructor(e,t){super("show.toggleCompositePinned",e?e.name:d(4469,null));this.activity=e;this.compositeBar=t;this.checked=!!this.activity&&this.compositeBar.isPinned(this.activity.id)}async run(e){let t=this.activity?this.activity.id:e;this.compositeBar.isPinned(t)?this.compositeBar.unpin(t):this.compositeBar.pin(t)}},$et=class extends it{constructor(e,t){super("show.toggleCompositeBadge",e?e.name:d(4470,null));this.compositeBarActionItem=e;this.compositeBar=t;this.checked=!1}async run(e){let t=this.compositeBarActionItem?this.compositeBarActionItem.id:e;this.compositeBar.toggleBadgeEnablement(t)}},cU=class extends z{constructor(e,t,o){super(e);this.location=t;this.offset=o}async run(e){let t=e.get(Es),o=t.getActivePaneComposite(this.location);if(!o)return;let n,r=t.getVisiblePaneCompositeIds(this.location);for(let s=0;s<r.length;s++)if(r[s]===o.getId()){n=r[(s+r.length+this.offset)%r.length];break}typeof n<"u"&&await t.openPaneComposite(n,this.location,!0)}};var Ven=Oe("auxiliarybar-maximize",L.screenFull,d(4439,null)),uki=Oe("auxiliarybar-close",L.close,d(4431,null)),Ben=Oe("auxiliarybar-right-layout-icon",L.layoutSidebarRight,d(4449,null)),Hen=Oe("auxiliarybar-right-off-layout-icon",L.layoutSidebarRightOff,d(4450,null)),Uen=Oe("auxiliarybar-left-layout-icon",L.layoutSidebarLeft,d(4447,null)),zen=Oe("auxiliarybar-left-off-layout-icon",L.layoutSidebarLeftOff,d(4448,null)),SW=class a extends z{static{this.ID="workbench.action.toggleAuxiliaryBar"}static{this.LABEL=P(4446,"Toggle Secondary Side Bar Visibility")}constructor(){super({id:a.ID,title:a.LABEL,toggled:{condition:tN,title:d(4432,null),icon:uki,mnemonicTitle:d(4440,null)},icon:uki,category:Fe.View,metadata:{description:d(4442,null)},f1:!0,keybinding:{weight:200,primary:2592},menu:[{id:R.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:1},{id:R.MenubarAppearanceMenu,group:"2_workbench_layout",order:2}]})}async run(i){let e=i.get(wi),t=e.isVisible("workbench.parts.auxiliarybar");e.setPartHidden(t,"workbench.parts.auxiliarybar");let o=t?d(4429,null):d(4430,null);cn(o)}};W(SW);be.appendMenuItem(R.AuxiliaryBarTitle,{command:{id:SW.ID,title:d(4432,null),icon:uki},group:"navigation",order:2,when:C.equals("config.workbench.activityBar.location","default")});W(class extends z{constructor(){super({id:"workbench.action.closeAuxiliaryBar",title:P(4433,"Hide Secondary Side Bar"),category:Fe.View,precondition:tN,f1:!0})}run(a){a.get(wi).setPartHidden(!0,"workbench.parts.auxiliarybar")}});W(class pki extends z{static{this.ID="workbench.action.focusAuxiliaryBar"}static{this.LABEL=P(4434,"Focus into Secondary Side Bar")}constructor(){super({id:pki.ID,title:pki.LABEL,category:Fe.View,f1:!0})}async run(i){let e=i.get(Es),t=i.get(wi);t.isVisible("workbench.parts.auxiliarybar")||t.setPartHidden(!1,"workbench.parts.auxiliarybar"),e.getActivePaneComposite(2)?.focus()}});be.appendMenuItems([{id:R.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:SW.ID,title:d(4452,null),toggled:{condition:tN,icon:Uen},icon:zen},when:C.and(Qf.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both")),C.equals("config.workbench.sideBar.location","right")),order:0}},{id:R.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:SW.ID,title:d(4452,null),toggled:{condition:tN,icon:Ben},icon:Hen},when:C.and(Qf.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both")),C.equals("config.workbench.sideBar.location","left")),order:2}},{id:R.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:SW.ID,title:P(4435,"Hide Secondary Side Bar")},when:C.and(tN,C.equals("viewContainerLocation",wC(2))),order:2}}]);W(class extends cU{constructor(){super({id:"workbench.action.previousAuxiliaryBarView",title:P(4443,"Previous Secondary Side Bar View"),category:Fe.View,f1:!0},2,-1)}});W(class extends cU{constructor(){super({id:"workbench.action.nextAuxiliaryBarView",title:P(4441,"Next Secondary Side Bar View"),category:Fe.View,f1:!0},2,1)}});var mki=class a extends z{static{this.ID="workbench.action.maximizeAuxiliaryBar"}constructor(){super({id:a.ID,title:P(4436,"Maximize Secondary Side Bar"),tooltip:d(4437,null),category:Fe.View,f1:!0,precondition:M2.negate()})}run(i){i.get(wi).setAuxiliaryBarMaximized(!0)}};W(mki);var hki=class a extends z{static{this.ID="workbench.action.restoreAuxiliaryBar"}constructor(){super({id:a.ID,title:P(4444,"Restore Secondary Side Bar"),tooltip:d(4445,null),category:Fe.View,f1:!0,precondition:M2,keybinding:{weight:200,primary:2101,win:{primary:2110,secondary:[2101]}}})}run(i){i.get(wi).setAuxiliaryBarMaximized(!1)}};W(hki);var gki=class a extends z{static{this.ID="workbench.action.toggleMaximizedAuxiliaryBar"}constructor(){super({id:a.ID,title:P(4451,"Toggle Maximized Secondary Side Bar"),tooltip:d(4438,null),f1:!0,category:Fe.View,icon:Ven,toggled:{condition:M2,tooltip:d(4445,null)},menu:{id:R.AuxiliaryBarTitle,group:"navigation",order:1}})}run(i){i.get(wi).toggleMaximizedAuxiliaryBar()}};W(gki);var Ken=Oe("panel-maximize",L.screenFull,d(5069,null)),fki=Oe("panel-close",L.close,d(5064,null)),Gen=Oe("panel-layout-icon",L.layoutPanel,d(5090,null)),qen=Oe("panel-layout-icon-off",L.layoutPanelOff,d(5091,null)),NG=class a extends z{static{this.ID="workbench.action.togglePanel"}static{this.LABEL=P(5092,"Toggle Panel Visibility")}constructor(){super({id:a.ID,title:a.LABEL,toggled:{condition:CZ,title:d(5065,null),icon:fki,mnemonicTitle:d(5072,null)},icon:fki,f1:!0,category:Fe.View,metadata:{description:d(5076,null)},keybinding:{primary:2088,weight:200},menu:[{id:R.MenubarAppearanceMenu,group:"2_workbench_layout",order:5},{id:R.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:4}]})}async run(i){let e=i.get(wi);e.setPartHidden(e.isVisible("workbench.parts.panel"),"workbench.parts.panel")}};W(NG);be.appendMenuItem(R.PanelTitle,{command:{id:NG.ID,title:d(5065,null),icon:fki},group:"navigation",order:2});W(class extends z{constructor(){super({id:"workbench.action.closePanel",title:P(5066,"Hide Panel"),category:Fe.View,precondition:CZ,f1:!0})}run(a){a.get(wi).setPartHidden(!0,"workbench.parts.panel")}});W(class extends z{static{this.ID="workbench.action.focusPanel"}static{this.LABEL=d(5067,null)}constructor(){super({id:"workbench.action.focusPanel",title:P(5068,"Focus into Panel"),category:Fe.View,f1:!0})}async run(a){let i=a.get(wi),e=a.get(Es);i.isVisible("workbench.parts.panel")||i.setPartHidden(!1,"workbench.parts.panel"),e.getActivePaneComposite(1)?.focus()}});var $Wt={LEFT:"workbench.action.positionPanelLeft",RIGHT:"workbench.action.positionPanelRight",BOTTOM:"workbench.action.positionPanelBottom",TOP:"workbench.action.positionPanelTop"},jWt={LEFT:"workbench.action.alignPanelLeft",RIGHT:"workbench.action.alignPanelRight",CENTER:"workbench.action.alignPanelCenter",JUSTIFY:"workbench.action.alignPanelJustify"};function bho(a,i,e,t,o){return{id:a,title:i,shortLabel:e,value:t,when:o}}function QWt(a,i,e,t){return bho(a,i,e,t,wZ.notEqualsTo(Bx(t)))}function YWt(a,i,e,t){return bho(a,i,e,t,EH.notEqualsTo(t))}var $en=[QWt($Wt.TOP,P(5085,"Move Panel To Top"),d(5086,null),3),QWt($Wt.LEFT,P(5081,"Move Panel Left"),d(5082,null),0),QWt($Wt.RIGHT,P(5083,"Move Panel Right"),d(5084,null),1),QWt($Wt.BOTTOM,P(5079,"Move Panel To Bottom"),d(5080,null),2)],jen=[YWt(jWt.LEFT,P(5060,"Set Panel Alignment to Left"),d(5061,null),"left"),YWt(jWt.RIGHT,P(5062,"Set Panel Alignment to Right"),d(5063,null),"right"),YWt(jWt.CENTER,P(5056,"Set Panel Alignment to Center"),d(5057,null),"center"),YWt(jWt.JUSTIFY,P(5058,"Set Panel Alignment to Justify"),d(5059,null),"justify")];be.appendMenuItem(R.MenubarAppearanceMenu,{submenu:R.PanelPositionMenu,title:d(5078,null),group:"3_workbench_layout_move",order:4});$en.forEach((a,i)=>{let{id:e,title:t,shortLabel:o,value:n,when:r}=a;W(class extends z{constructor(){super({id:e,title:t,category:Fe.View,f1:!0})}run(s){s.get(wi).setPanelPosition(n===void 0?2:n)}}),be.appendMenuItem(R.PanelPositionMenu,{command:{id:e,title:o,toggled:r.negate()},order:5+i})});be.appendMenuItem(R.MenubarAppearanceMenu,{submenu:R.PanelAlignmentMenu,title:d(5055,null),group:"3_workbench_layout_move",order:5});jen.forEach(a=>{let{id:i,title:e,shortLabel:t,value:o,when:n}=a;W(class extends z{constructor(){super({id:i,title:e,category:Fe.View,toggled:n.negate(),f1:!0})}run(r){r.get(wi).setPanelAlignment(o===void 0?"center":o)}}),be.appendMenuItem(R.PanelAlignmentMenu,{command:{id:i,title:t,toggled:n.negate()},order:5})});W(class extends cU{constructor(){super({id:"workbench.action.previousPanelView",title:P(5087,"Previous Panel View"),category:Fe.View,f1:!0},1,-1)}});W(class extends cU{constructor(){super({id:"workbench.action.nextPanelView",title:P(5075,"Next Panel View"),category:Fe.View,f1:!0},1,1)}});var vho=C.or(EH.isEqualTo("center"),C.and(wZ.notEqualsTo("bottom"),wZ.notEqualsTo("top")));W(class extends z{constructor(){super({id:"workbench.action.toggleMaximizedPanel",title:P(5088,"Toggle Maximized Panel"),tooltip:d(5070,null),category:Fe.View,f1:!0,icon:Ken,precondition:vho,toggled:{condition:tPt,tooltip:d(5071,null)},menu:[{id:R.PanelTitle,group:"navigation",order:1,when:vho}]})}run(a){let i=a.get(wi),e=a.get(Ne);if(i.getPanelAlignment()!=="center"&&eg(i.getPanelPosition())){e.warn(d(5077,null));return}i.isVisible("workbench.parts.panel")?i.toggleMaximizedPanel():(i.setPartHidden(!1,"workbench.parts.panel"),i.isPanelMaximized()||i.toggleMaximizedPanel())}});be.appendMenuItems([{id:R.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:NG.ID,title:d(5089,null),icon:qen,toggled:{condition:CZ,icon:Gen}},when:C.and(Qf.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both"))),order:1}}]);var IMe=class extends z{constructor(e,t,o){super(o);this.source=e;this.destination=t}run(e,...t){let o=e.get(ji),n=e.get(wi),r=e.get(Gt),s=o.getViewContainersByLocation(this.source),l=o.getViewContainersByLocation(this.destination);if(s.length){let c=r.getVisibleViewContainer(this.source);s.forEach(u=>o.moveViewContainerToLocation(u,this.destination,void 0,this.desc.id)),n.setPartHidden(!1,this.destination===1?"workbench.parts.panel":"workbench.parts.auxiliarybar"),c&&l.length===0&&r.openViewContainer(c.id,!0)}}},vki=class a extends IMe{static{this.ID="workbench.action.movePanelToSidePanel"}constructor(){super(1,2,{id:a.ID,title:P(5073,"Move Panel Views To Secondary Side Bar"),category:Fe.View,f1:!1})}},bki=class a extends IMe{static{this.ID="workbench.action.movePanelToSecondarySideBar"}constructor(){super(1,2,{id:a.ID,title:P(5073,"Move Panel Views To Secondary Side Bar"),category:Fe.View,f1:!0})}};W(vki);W(bki);var Ski=class a extends IMe{static{this.ID="workbench.action.moveSidePanelToPanel"}constructor(){super(2,1,{id:a.ID,title:P(5074,"Move Secondary Side Bar Views To Panel"),category:Fe.View,f1:!1})}},Iki=class a extends IMe{static{this.ID="workbench.action.moveSecondarySideBarToPanel"}constructor(){super(2,1,{id:a.ID,title:P(5074,"Move Secondary Side Bar Views To Panel"),category:Fe.View,f1:!0})}};W(Ski);W(Iki);var yki={},Qen=new xde("quick-input-button-icon-");function Yen(a){if(!a)return;let i,e=a.dark.toString();return yki[e]?i=yki[e]:(i=Qen.nextId(),Eg(`.${i}, .hc-light .${i}`,`background-image: ${cl(a.light||a.dark)}`),Eg(`.vs-dark .${i}, .hc-black .${i}`,`background-image: ${cl(a.dark)}`),yki[e]=i),i}var wki=class{constructor(i,e,t,o,n,r,s){this.id=i;this.label=e;this.tooltip=t;this.enabled=n;this._checked=r;this._run=s;this.class=o}get checked(){return this._checked}set checked(i){this._checked=i,this._run()}run(){return this._checked=!this._checked,this._run()}};function Cki(a,i,e){let t=a.iconClass||Yen(a.iconPath);a.alwaysVisible&&(t=t?`${t} always-visible`:"always-visible");let o=()=>(a.toggle&&(a.toggle.checked=!a.toggle.checked),e());return a.toggle?new wki(i,a.tooltip||"","",t,!0,a.toggle.checked,o):{id:i,label:"",tooltip:a.tooltip||"",class:t,enabled:!0,run:o}}function M8(a,i,e){let t=[],o=[];return a.forEach((n,r)=>{let s=Cki(n,`${i}-${r}`,async()=>e(n));n.label&&(s.label=n.label),n.secondary?o.push(s):t.push(s)}),{primary:t,secondary:o}}function Sho(a,i,e){Ii(i);let t=ZS(a),o=0;for(let n of t.nodes)if(typeof n=="string")i.append(...ir(n));else{let r=n.title;!r&&n.href.startsWith("command:")?r=d(2516,null,n.href.substring(8)):r||(r=n.href);let s=_("a",{href:n.href,title:r,tabIndex:o++},n.label);s.style.textDecoration="underline";let l=g=>{Vbt(g)&&Kt.stop(g,!0),e.callback(n.href)},c=e.disposables.add(new Zn(s,ne.CLICK)).event,u=e.disposables.add(new Zn(s,ne.KEY_DOWN)).event,p=U.chain(u,g=>g.filter(f=>{let v=new mi(f);return v.equals(10)||v.equals(3)}));e.disposables.add(ds.addTarget(s));let h=e.disposables.add(new Zn(s,Vn.Tap)).event;U.any(c,h,p)(l,null,e.disposables),i.appendChild(s)}}var yho="inQuickInput",who=new Y(yho,!1,d(2496,null)),CMe=C.has(yho),Xen="quickInputAlignment",jet=new Y(Xen,"top",d(2500,null)),gte="quickInputType",Cho=new Y(gte,void 0,d(2502,null)),xho="cursorAtEndOfQuickInputBox",kho=new Y(xho,!1,d(2493,null)),Eho=C.has(xho),eVt={iconClass:q.asClassName(L.quickInputBack),tooltip:d(2498,null),handle:-1},mte=class a extends k{constructor(e){super();this.ui=e;this._visible=De("visible",!1);this._enabled=!0;this._busy=!1;this._ignoreFocusOut=!1;this._leftButtons=[];this._rightButtons=[];this._inlineButtons=[];this._inputButtons=[];this.buttonsUpdated=!1;this.noValidationMessage=a.noPromptMessage;this._severity=wt.Ignore;this.onDidTriggerButtonEmitter=this._register(new T);this.onDidHideEmitter=this._register(new T);this.onWillHideEmitter=this._register(new T);this.onDisposeEmitter=this._register(new T);this.visibleDisposables=this._register(new O);this.onDidTriggerButton=this.onDidTriggerButtonEmitter.event;this.onDidHide=this.onDidHideEmitter.event;this.onWillHide=this.onWillHideEmitter.event;this.onDispose=this.onDisposeEmitter.event}static{this.noPromptMessage=d(2494,null)}get visible(){return this._visible.get()}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){let t=this._ignoreFocusOut!==e&&!Tc;this._ignoreFocusOut=e&&!Tc,t&&this.update()}get titleButtons(){return this._leftButtons.length?[...this._leftButtons,this._rightButtons]:this._rightButtons}get buttons(){return[...this._leftButtons,...this._rightButtons,...this._inlineButtons,...this._inputButtons]}set buttons(e){let t=[],o=[],n=[],r=[];for(let s of e)if(s===eVt)t.push(s);else switch(s.location){case 2:n.push(s);break;case 3:r.push(s);break;default:o.push(s);break}this._leftButtons=t,this._rightButtons=o,this._inlineButtons=n,this._inputButtons=r,this.buttonsUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton(e=>{this.buttons.indexOf(e)!==-1&&this.onDidTriggerButtonEmitter.fire(e)})),this.ui.show(this),this._visible.set(!0,void 0),this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=3){this._visible.set(!1,void 0),this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}willHide(e=3){this.onWillHideEmitter.fire({reason:e})}update(){if(!this.visible)return;let e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:!e&&this.ui.title.innerHTML!=="&nbsp;"&&(this.ui.title.innerText="\xA0");let t=this.getDescription();if(this.ui.description1.textContent!==t&&(this.ui.description1.textContent=t),this.ui.description2.textContent!==t&&(this.ui.description2.textContent=t),this.busy&&!this.busyDelay&&(this.busyDelay=new Nl,this.busyDelay.setIfNotSet(()=>{this.visible&&(this.ui.progressBar.infinite(),this.ui.progressBar.getContainer().removeAttribute("aria-hidden"))},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.ui.progressBar.getContainer().setAttribute("aria-hidden","true"),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1;let n=M8(this._leftButtons,"left-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.leftActionBar.setActions(n.primary,n.secondary);let r=M8(this._rightButtons,"right-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.rightActionBar.setActions(r.primary,r.secondary);let s=M8(this._inlineButtons,"inline-button",c=>this.onDidTriggerButtonEmitter.fire(c));this.ui.inlineActionBar.setActions(s.primary,s.secondary);let l=this._inputButtons.length*22;this.ui.countContainer.style.right=l>0?`${4+l}px`:"4px",this.ui.inputBox.actions=this._inputButtons.map((c,u)=>Cki(c,`id-${u}`,async()=>this.onDidTriggerButtonEmitter.fire(c)))}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);let o=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==o&&(this._lastValidationMessage=o,Ii(this.ui.message),o&&Sho(o,this.ui.message,{callback:n=>{this.ui.linkOpenerDelegate(n)},disposables:this.visibleDisposables})),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?d(2499,null,this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==wt.Ignore){let t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}},hte=class a extends mte{constructor(e){super(e);this._value="";this.onDidChangeValueEmitter=this._register(new T);this.onWillAcceptEmitter=this._register(new T);this.onDidAcceptEmitter=this._register(new T);this.onDidCustomEmitter=this._register(new T);this._items=[];this.itemsUpdated=!1;this._canSelectMany=!1;this._canAcceptInBackground=!1;this._matchOnDescription=!1;this._matchOnDetail=!1;this._matchOnLabel=!0;this._matchOnLabelMode="fuzzy";this._sortByLabel=!0;this._keepScrollPosition=!1;this._itemActivation=1;this._activeItems=[];this.activeItemsUpdated=!1;this.activeItemsToConfirm=[];this.onDidChangeActiveEmitter=this._register(new T);this._selectedItems=[];this.selectedItemsUpdated=!1;this.selectedItemsToConfirm=[];this.onDidChangeSelectionEmitter=this._register(new T);this.onDidTriggerItemButtonEmitter=this._register(new T);this.onDidTriggerSeparatorButtonEmitter=this._register(new T);this.valueSelectionUpdated=!0;this._ok="default";this._customButton=!1;this._customButtonSecondary=!1;this._focusEventBufferer=new JO;this.type="quickPick";this.filterValue=e=>e;this.onDidChangeValue=this.onDidChangeValueEmitter.event;this.onWillAccept=this.onWillAcceptEmitter.event;this.onDidAccept=this.onDidAcceptEmitter.event;this.onDidCustom=this.onDidCustomEmitter.event;this.onDidChangeActive=this.onDidChangeActiveEmitter.event;this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event;this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event;this.onDidTriggerSeparatorButton=this.onDidTriggerSeparatorButtonEmitter.event;this.noValidationMessage=void 0}static{this.DEFAULT_ARIA_LABEL=d(2501,null)}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){this._value!==e&&(this._value=e,t||this.update(),this.visible&&this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(this._value))}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get prompt(){return this.noValidationMessage}set prompt(e){this.noValidationMessage=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?xeo:this.ui.keyMods}get valueSelection(){let e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get customButtonSecondary(){return this._customButtonSecondary}set customButtonSecondary(e){this._customButtonSecondary=e??!1,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get okLabel(){return this._okLabel??d(2497,null)}set okLabel(e){this._okLabel=e,this.update()}inputHasFocus(){return this.visible?this.ui.inputBox.hasFocus():!1}focusOnInput(){this.ui.inputBox.setFocus()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}get hideCountBadge(){return!!this._hideCountBadge}set hideCountBadge(e){this._hideCountBadge=e,this.update()}get hideCheckAll(){return!!this._hideCheckAll}set hideCheckAll(e){this._hideCheckAll=e,this.update()}trySelectFirst(){this.canSelectMany||this.ui.list.focus(1)}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{this.doSetValue(e,!0)})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)})),this.visibleDisposables.add(this.ui.onDidCustom(()=>{this.onDidCustomEmitter.fire()})),this.visibleDisposables.add(this._focusEventBufferer.wrapEvent(this.ui.list.onDidChangeFocus,(e,t)=>t)(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&eo(e,this._activeItems,(t,o)=>t===o)||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({items:e,event:t})=>{if(this.canSelectMany&&!e.some(o=>o.pickable===!1)){e.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&eo(e,this._selectedItems,(o,n)=>o===n)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(Wp(t)&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{!this.canSelectMany||!this.visible||this.selectedItemsToConfirm!==this._selectedItems&&eo(e,this._selectedItems,(t,o)=>t===o)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onButtonTriggered(e=>this.onDidTriggerItemButtonEmitter.fire(e))),this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered(e=>this.onDidTriggerSeparatorButtonEmitter.fire(e))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return $(this.ui.container,ne.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;let t=new mi(e),o=t.keyCode;this._quickNavigate.keybindings.some(s=>{let l=s.getChords();return l.length>1?!1:l[0].shiftKey&&o===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(l[0].altKey&&o===6||l[0].ctrlKey&&o===5||l[0].metaKey&&o===57)})&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)})}update(){if(!this.visible)return;let e=this.keepScrollPosition?this.scrollTop:0,t=!!this.description,o={title:!!this.title||!!this.step||!!this.titleButtons.length,description:t,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!this._hideInput,progressBar:!this._hideInput||t,visibleCount:!0,count:this.canSelectMany&&!this._hideCountBadge,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage||!!this.prompt,customButton:this.customButton};this.ui.setVisibilities(o),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");let n=this.ariaLabel;!n&&o.inputBox&&(n=this.placeholder,this.title&&(n=n?`${n} - ${this.title}`:this.title),n||(n=a.DEFAULT_ARIA_LABEL)),this.ui.list.ariaLabel!==n&&(this.ui.list.ariaLabel=n??null),this.ui.inputBox.ariaLabel!==n&&(this.ui.inputBox.ariaLabel=n??"input"),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.matchOnLabelMode=this.matchOnLabelMode,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated&&(this.itemsUpdated=!1,this._focusEventBufferer.bufferEvents(()=>{switch(this.ui.list.setElements(this.items),this.ui.list.shouldLoop=!this.canSelectMany,this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this._itemActivation){case 0:this._itemActivation=1;break;case 2:this.ui.list.focus(2),this._itemActivation=1;break;case 3:this.ui.list.focus(3),this._itemActivation=1;break;default:this.trySelectFirst();break}})),this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.ok.label=this.okLabel||"",this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",this.ui.customButton.secondary=this.customButtonSecondary||!1,o.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(1)),this.keepScrollPosition&&(this.scrollTop=e)}focus(e){this.ui.list.focus(e),this.canSelectMany&&this.ui.list.domFocus()}accept(e){e&&!this._canAcceptInBackground||(this.activeItems[0]&&!this._canSelectMany&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(e??!1))}},XWt=class extends mte{constructor(){super(...arguments);this._value="";this.valueSelectionUpdated=!0;this._password=!1;this.onDidValueChangeEmitter=this._register(new T);this.onDidAcceptEmitter=this._register(new T);this.type="inputBox";this.onDidChangeValue=this.onDidValueChangeEmitter.event;this.onDidAccept=this.onDidAcceptEmitter.event}get value(){return this._value}set value(e){this._value=e||"",this.update()}get valueSelection(){let e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.update()}get password(){return this._password}set password(e){this._password=e,this.update()}get prompt(){return this._prompt}set prompt(e){this._prompt=e,this.noValidationMessage=e?d(2495,null,e):mte.noPromptMessage,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{e!==this.value&&(this._value=e,this.onDidValueChangeEmitter.fire(e))})),this.visibleDisposables.add(this.ui.onDidAccept(()=>this.onDidAcceptEmitter.fire())),this.valueSelectionUpdated=!0),super.show()}accept(){this.onDidAcceptEmitter.fire()}update(){if(!this.visible)return;this.ui.container.classList.remove("hidden-input");let e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step,inputBox:!0,message:!0,progressBar:!0};this.ui.setVisibilities(e),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||""),this.ui.inputBox.password!==this.password&&(this.ui.inputBox.password=this.password);let t=this.ariaLabel;!t&&e.inputBox&&(t=this.placeholder?this.title?`${this.placeholder} - ${this.title}`:this.placeholder:this.title?this.title:"input"),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t||"input")}},JWt=class extends mte{constructor(){super(...arguments);this.type="quickWidget";this._widgetUpdated=!1}get widget(){return this._widget}set widget(e){this._widget!==e&&(this._widget=e,this._widgetUpdated=!0,this.update())}update(){this.visible&&(this.ui.setVisibilities({title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step}),this._widgetUpdated&&(this._widgetUpdated=!1,this._widget?Ii(this.ui.widget,this._widget):Ii(this.ui.widget)),super.update())}},yMe=class extends Kf{constructor(i,e){super("mouse",void 0,t=>this.getOverrideOptions(t),i,e)}getOverrideOptions(i){let e=(go(i.content)?i.content.textContent??"":typeof i.content=="string"?i.content:i.content.value).includes(`
`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:e,skipFadeInAnimation:!0}}}};yMe=I([m(0,B),m(1,ot)],yMe);var Zen=Oe("menuBar",L.layoutMenubar,d(4233,null)),etn=Oe("activity-bar-left",L.layoutActivitybarLeft,d(4197,null)),ttn=Oe("activity-bar-right",L.layoutActivitybarRight,d(4198,null)),tVt=Oe("panel-left",L.layoutSidebarLeft,d(4273,null)),itn=Oe("panel-left-off",L.layoutSidebarLeftOff,d(4274,null)),iVt=Oe("panel-right",L.layoutSidebarRight,d(4275,null)),otn=Oe("panel-right-off",L.layoutSidebarRightOff,d(4276,null)),ntn=Oe("panel-bottom",L.layoutPanel,d(4267,null)),rtn=Oe("statusBar",L.layoutStatusbar,d(4309,null)),stn=Oe("panel-align-left",L.layoutPanelLeft,d(4270,null)),atn=Oe("panel-align-right",L.layoutPanelRight,d(4271,null)),ltn=Oe("panel-align-center",L.layoutPanelCenter,d(4268,null)),ctn=Oe("panel-align-justify",L.layoutPanelJustify,d(4269,null)),dtn=Oe("quickInputAlignmentTop",L.arrowUp,d(4280,null)),utn=Oe("quickInputAlignmentCenter",L.circle,d(4279,null)),ptn=Oe("fullscreen",L.screenFull,d(4218,null)),mtn=Oe("centerLayoutIcon",L.layoutCentered,d(4203,null)),htn=Oe("zenMode",L.target,d(4324,null)),Mki="workbench.action.toggleActivityBarVisibility";W(class extends z{constructor(){super({id:"workbench.action.toggleCenteredLayout",title:{...P(4311,"Toggle Centered Layout"),mnemonicTitle:d(4241,null)},precondition:C.and(ew.toNegated(),qo.negate()),category:Fe.View,f1:!0,toggled:yYe,menu:[{id:R.MenubarAppearanceMenu,group:"1_toggle_view",order:3,when:qo.negate()}]})}run(a){let i=a.get(wi),e=a.get(kt);i.centerMainEditorLayout(!i.isMainEditorLayoutCentered()),e.activeGroup.focus()}});var Tho="workbench.sideBar.location",oVt=class extends z{constructor(e,t,o){super({id:e,title:t,f1:!1});this.position=o}async run(e){let t=e.get(wi),o=e.get(B);if(t.getSideBarPosition()!==this.position)return o.updateValue(Tho,Bx(this.position))}},nVt=class a extends oVt{static{this.ID="workbench.action.moveSideBarRight"}constructor(){super(a.ID,P(4261,"Move Primary Side Bar Right"),1)}},rVt=class a extends oVt{static{this.ID="workbench.action.moveSideBarLeft"}constructor(){super(a.ID,P(4259,"Move Primary Side Bar Left"),0)}};W(nVt);W(rVt);var S_=class a extends z{static{this.ID="workbench.action.toggleSidebarPosition"}static{this.LABEL=d(4318,null)}static getLabel(i){return i.getSideBarPosition()===0?d(4262,null):d(4260,null)}constructor(){super({id:a.ID,title:P(4319,"Toggle Primary Side Bar Position"),category:Fe.View,f1:!0,precondition:qo.negate()})}run(i){let e=i.get(wi),t=i.get(B),n=e.getSideBarPosition()===0?"right":"left";return t.updateValue(Tho,n)}};W(S_);var _ho=Oe("configure-layout-icon",L.layout,d(4206,null));be.appendMenuItem(R.LayoutControlMenu,{submenu:R.LayoutControlMenuSubmenu,title:d(4209,null),icon:_ho,group:"1_workbench_layout",when:C.and(Qf.negate(),C.equals("config.workbench.layoutControl.type","menu"))});be.appendMenuItems([{id:R.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:S_.ID,title:d(4244,null)},when:C.and(C.notEquals("config.workbench.sideBar.location","right"),C.equals("viewContainerLocation",wC(0))),order:1}},{id:R.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:S_.ID,title:d(4245,null)},when:C.and(C.equals("config.workbench.sideBar.location","right"),C.equals("viewContainerLocation",wC(0))),order:1}},{id:R.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:S_.ID,title:d(4242,null)},when:C.and(C.notEquals("config.workbench.sideBar.location","right"),C.equals("viewContainerLocation",wC(2))),order:1}},{id:R.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:S_.ID,title:d(4243,null)},when:C.and(C.equals("config.workbench.sideBar.location","right"),C.equals("viewContainerLocation",wC(2))),order:1}}]);be.appendMenuItem(R.MenubarAppearanceMenu,{group:"3_workbench_layout_move",command:{id:S_.ID,title:d(4238,null)},when:C.and(C.notEquals("config.workbench.sideBar.location","right"),qo.negate()),order:2});be.appendMenuItem(R.MenubarAppearanceMenu,{group:"3_workbench_layout_move",command:{id:S_.ID,title:d(4237,null)},when:C.and(C.equals("config.workbench.sideBar.location","right"),qo.negate()),order:2});W(class extends z{constructor(){super({id:"workbench.action.toggleEditorVisibility",title:{...P(4312,"Toggle Editor Area Visibility"),mnemonicTitle:d(4239,null)},category:Fe.View,f1:!0,toggled:ePt,precondition:C.and(ew.toNegated(),C.or(EH.isEqualTo("center"),wZ.notEqualsTo("bottom")))})}run(a){a.get(wi).toggleMaximizedPanel()}});be.appendMenuItem(R.MenubarViewMenu,{group:"2_appearance",title:d(4234,null),submenu:R.MenubarAppearanceMenu,when:qo.negate(),order:1});var uU=class a extends z{static{this.ID="workbench.action.toggleSidebarVisibility"}static{this.LABEL=d(4207,null)}constructor(){super({id:a.ID,title:P(4316,"Toggle Primary Side Bar Visibility"),toggled:{condition:eN,title:d(4277,null),mnemonicTitle:d(4278,null)},metadata:{description:d(4264,null)},category:Fe.View,f1:!0,keybinding:{weight:200,primary:2080},menu:[{id:R.LayoutControlMenuSubmenu,group:"0_workbench_layout",order:0},{id:R.MenubarAppearanceMenu,group:"2_workbench_layout",order:1}]})}run(i){let e=i.get(wi),t=e.isVisible("workbench.parts.sidebar");e.setPartHidden(t,"workbench.parts.sidebar");let o=t?d(4305,null):d(4307,null);cn(o)}};W(uU);be.appendMenuItems([{id:R.ViewContainerTitleContext,item:{group:"3_workbench_layout_move",command:{id:uU.ID,title:d(4207,null)},when:C.and(eN,C.equals("viewContainerLocation",wC(0))),order:2}},{id:R.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:uU.ID,title:d(4317,null),icon:itn,toggled:{condition:eN,icon:tVt}},when:C.and(Qf.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both")),C.equals("config.workbench.sideBar.location","left")),order:0}},{id:R.LayoutControlMenu,item:{group:"2_pane_toggles",command:{id:uU.ID,title:d(4317,null),icon:otn,toggled:{condition:eN,icon:iVt}},when:C.and(Qf.negate(),C.or(C.equals("config.workbench.layoutControl.type","toggles"),C.equals("config.workbench.layoutControl.type","both")),C.equals("config.workbench.sideBar.location","right")),order:2}}]);var hhe=class a extends z{static{this.ID="workbench.action.toggleStatusbarVisibility"}static{this.statusbarVisibleKey="workbench.statusBar.visible"}constructor(){super({id:a.ID,title:{...P(4320,"Toggle Status Bar Visibility"),mnemonicTitle:d(4240,null)},category:Fe.View,f1:!0,precondition:qo.negate(),toggled:C.equals("config.workbench.statusBar.visible",!0),menu:[{id:R.MenubarAppearanceMenu,group:"2_workbench_layout",order:3,when:qo.negate()}]})}run(i){let e=i.get(wi),t=i.get(B),n=!e.isVisible("workbench.parts.statusbar",ut);return t.updateValue(a.statusbarVisibleKey,n)}};W(hhe);var fte=class extends z{constructor(e,t,o,n,r,s){super({id:n,title:o,category:Fe.View,precondition:C.and(r,qo.negate()),metadata:s?{description:s}:void 0,f1:!0});this.settingName=e;this.value=t}run(e){return e.get(B).updateValue(this.settingName,this.value)}},Qet=class a extends fte{static{this.ID="workbench.action.hideEditorTabs"}constructor(){let i=C.and(C.equals("config.workbench.editor.showTabs","none").negate(),Yf.negate()),e=P(4221,"Hide Editor Tabs");super("workbench.editor.showTabs","none",e,a.ID,i,P(4222,"Hide Tab Bar"))}},kMe=class a extends fte{static{this.ID="workbench.action.zenHideEditorTabs"}constructor(){let i=C.and(C.equals("config.zenMode.showTabs","none").negate(),Yf),e=P(4223,"Hide Editor Tabs in Zen Mode");super("zenMode.showTabs","none",e,a.ID,i,P(4224,"Hide Tab Bar in Zen Mode"))}},Yet=class a extends fte{static{this.ID="workbench.action.showMultipleEditorTabs"}constructor(){let i=C.and(C.equals("config.workbench.editor.showTabs","multiple").negate(),Yf.negate()),e=P(4294,"Show Multiple Editor Tabs");super("workbench.editor.showTabs","multiple",e,a.ID,i,P(4295,"Show Tab Bar with multiple tabs"))}},EMe=class a extends fte{static{this.ID="workbench.action.zenShowMultipleEditorTabs"}constructor(){let i=C.and(C.equals("config.zenMode.showTabs","multiple").negate(),Yf),e=P(4296,"Show Multiple Editor Tabs in Zen Mode");super("zenMode.showTabs","multiple",e,a.ID,i,P(4297,"Show Tab Bar in Zen Mode"))}},Xet=class a extends fte{static{this.ID="workbench.action.showEditorTab"}constructor(){let i=C.and(C.equals("config.workbench.editor.showTabs","single").negate(),Yf.negate()),e=P(4298,"Show Single Editor Tab");super("workbench.editor.showTabs","single",e,a.ID,i,P(4299,"Show Tab Bar with one Tab"))}};W(Qet);W(Yet);W(Xet);var TMe=class a extends fte{static{this.ID="workbench.action.zenShowEditorTab"}constructor(){let i=C.and(C.equals("config.zenMode.showTabs","single").negate(),Yf),e=P(4300,"Show Single Editor Tab in Zen Mode");super("zenMode.showTabs","single",e,a.ID,i,P(4301,"Show Tab Bar in Zen Mode with one Tab"))}};be.appendMenuItem(R.MenubarAppearanceMenu,{submenu:R.EditorTabsBarShowTabsSubmenu,title:d(4310,null),group:"3_workbench_layout_move",order:10,when:C.and(Yf.negate(),qo.negate())});var Jet=class a extends z{static{this.ID="workbench.action.editorActionsTitleBar"}constructor(){super({id:a.ID,title:P(4248,"Move Editor Actions to Title Bar"),category:Fe.View,precondition:C.and(C.equals("config.workbench.editor.editorActionsLocation","titleBar").negate(),qo.negate()),metadata:{description:P(4249,"Move Editor Actions from the tab bar to the title bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","titleBar")}};W(Jet);var Zet=class a extends z{static{this.ID="workbench.action.editorActionsDefault"}constructor(){super({id:a.ID,title:P(4246,"Move Editor Actions to Tab Bar"),category:Fe.View,precondition:C.and(C.equals("config.workbench.editor.editorActionsLocation","default").negate(),C.equals("config.workbench.editor.showTabs","none").negate(),qo.negate()),metadata:{description:P(4247,"Move Editor Actions from the title bar to the tab bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","default")}};W(Zet);var ett=class a extends z{static{this.ID="workbench.action.hideEditorActions"}constructor(){super({id:a.ID,title:P(4219,"Hide Editor Actions"),category:Fe.View,precondition:C.and(C.equals("config.workbench.editor.editorActionsLocation","hidden").negate(),qo.negate()),metadata:{description:P(4220,"Hide Editor Actions in the tab and title bar")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","hidden")}};W(ett);var xki=class a extends z{static{this.ID="workbench.action.showEditorActions"}constructor(){super({id:a.ID,title:P(4292,"Show Editor Actions"),category:Fe.View,precondition:C.and(C.equals("config.workbench.editor.editorActionsLocation","hidden"),qo.negate()),metadata:{description:P(4293,"Make Editor Actions visible.")},f1:!0})}run(i){return i.get(B).updateValue("workbench.editor.editorActionsLocation","default")}};W(xki);be.appendMenuItem(R.MenubarAppearanceMenu,{submenu:R.EditorActionsPositionSubmenu,title:d(4216,null),group:"3_workbench_layout_move",order:11,when:qo.negate()});var ttt=class a extends z{static{this.ID="workbench.action.configureEditorTabs"}constructor(){super({id:a.ID,title:P(4210,"Configure Tabs"),category:Fe.View})}run(i){i.get(Qo).openSettings({jsonEditor:!1,query:"workbench.editor tab"})}};W(ttt);var itt=class a extends z{static{this.ID="workbench.action.configureEditor"}constructor(){super({id:a.ID,title:P(4208,"Configure Editors"),category:Fe.View})}run(i){i.get(Qo).openSettings({jsonEditor:!1,query:"workbench.editor"})}};W(itt);W(class extends z{constructor(){super({id:"workbench.action.toggleSeparatePinnedEditorTabs",title:P(4314,"Separate Pinned Editor Tabs"),category:Fe.View,precondition:C.equals("config.workbench.editor.showTabs","multiple"),metadata:{description:P(4315,"Toggle whether pinned editor tabs are shown on a separate row above unpinned tabs.")},f1:!0})}run(a){let i=a.get(B),t=!i.getValue("workbench.editor.pinnedTabsOnSeparateRow");return i.updateValue("workbench.editor.pinnedTabsOnSeparateRow",t)}});if(ii||Sn||Ft){W(class extends z{constructor(){super({id:"workbench.action.toggleMenuBar",title:{...P(4313,"Toggle Menu Bar"),mnemonicTitle:d(4235,null)},category:Fe.View,f1:!0,precondition:qo.negate(),toggled:C.and(Zk.toNegated(),C.notEquals("config.window.menuBarVisibility","hidden"),C.notEquals("config.window.menuBarVisibility","toggle"),C.notEquals("config.window.menuBarVisibility","compact")),menu:[{id:R.MenubarAppearanceMenu,group:"2_workbench_layout",order:0,when:qo.negate()}]})}run(i){return i.get(wi).toggleMenuBar()}});for(let a of[R.TitleBarContext,R.TitleBarTitleContext])be.appendMenuItem(a,{command:{id:"workbench.action.toggleMenuBar",title:d(4236,null),toggled:C.and(Zk.toNegated(),C.notEquals("config.window.menuBarVisibility","hidden"),C.notEquals("config.window.menuBarVisibility","toggle"),C.notEquals("config.window.menuBarVisibility","compact"))},when:C.and(ew.toNegated(),C.notEquals(yZ.key,"native"),ZA.negate()),group:"2_config",order:0})}W(class extends z{constructor(){super({id:"workbench.action.resetViewLocations",title:P(4284,"Reset View Locations"),category:Fe.View,f1:!0})}run(a){return a.get(ji).reset()}});W(class extends z{constructor(){super({id:"workbench.action.moveView",title:P(4263,"Move View"),category:Fe.View,f1:!0})}async run(a){let i=a.get(ji),e=a.get(F),t=a.get($e),o=a.get(X),n=a.get(Es),r=rc.getValue(o),s;r&&i.getViewDescriptorById(r)?.canMoveView&&(s=r);try{if(s=await this.getView(t,i,n,s),!s)return;let l=new sVt;e.invokeFunction(c=>l.run(c,s))}catch{}}getViewItems(a,i){let e=[];return i.getVisiblePaneCompositeIds(0).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(4304,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),i.getPinnedPaneCompositeIds(1).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(4272,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),i.getPinnedPaneCompositeIds(2).forEach(r=>{let s=a.getViewContainerById(r),l=a.getViewContainerModel(s),c=!1;l.visibleViewDescriptors.forEach(u=>{u.canMoveView&&(c||(e.push({type:"separator",label:d(4289,null,l.title)}),c=!0),e.push({id:u.id,label:u.name.value}))})}),e}async getView(a,i,e,t){let o=new O,n=o.add(a.createQuickPick({useSeparators:!0}));return n.placeholder=d(4257,null),n.items=this.getViewItems(i,e),n.selectedItems=n.items.filter(r=>r.id===t),new Promise((r,s)=>{o.add(n.onDidAccept(()=>{let l=n.selectedItems[0];l.id?r(l.id):s(),n.hide()})),o.add(n.onDidHide(()=>{o.dispose(),s()})),n.show()})}});var sVt=class extends z{constructor(){super({id:"workbench.action.moveFocusedView",title:P(4250,"Move Focused View"),category:Fe.View,precondition:rc.notEqualsTo(""),f1:!0})}run(i,e){let t=i.get(ji),o=i.get(Gt),n=i.get($e),r=i.get(X),s=i.get(ct),l=i.get(Es),c=e||rc.getValue(r);if(c===void 0||c.trim()===""){s.error(d(4251,null));return}let u=t.getViewDescriptorById(c);if(!u?.canMoveView){s.error(d(4252,null));return}let p=new O,h=p.add(n.createQuickPick({useSeparators:!0}));h.placeholder=d(4256,null),h.title=d(4258,null,u.name.value);let g=[],f=t.getViewContainerByViewId(c),v=t.getViewLocationById(c),b=t.getViewContainerModel(f).allViewDescriptors.length===1;b&&v===1||g.push({id:"_.panel.newcontainer",label:d(4253,null)}),b&&v===0||g.push({id:"_.sidebar.newcontainer",label:d(4254,null)}),b&&v===2||g.push({id:"_.auxiliarybar.newcontainer",label:d(4255,null)}),g.push({type:"separator",label:d(4302,null)});let S=l.getVisiblePaneCompositeIds(0);g.push(...S.filter(x=>x===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(x).rejectAddedViews).map(x=>({id:x,label:t.getViewContainerModel(t.getViewContainerById(x)).title}))),g.push({type:"separator",label:d(4265,null)});let y=l.getPinnedPaneCompositeIds(1);g.push(...y.filter(x=>x===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(x).rejectAddedViews).map(x=>({id:x,label:t.getViewContainerModel(t.getViewContainerById(x)).title}))),g.push({type:"separator",label:d(4288,null)});let w=l.getPinnedPaneCompositeIds(2);g.push(...w.filter(x=>x===t.getViewContainerByViewId(c).id?!1:!t.getViewContainerById(x).rejectAddedViews).map(x=>({id:x,label:t.getViewContainerModel(t.getViewContainerById(x)).title}))),h.items=g,p.add(h.onDidAccept(()=>{let x=h.selectedItems[0];x.id==="_.panel.newcontainer"?(t.moveViewToLocation(u,1,this.desc.id),o.openView(c,!0)):x.id==="_.sidebar.newcontainer"?(t.moveViewToLocation(u,0,this.desc.id),o.openView(c,!0)):x.id==="_.auxiliarybar.newcontainer"?(t.moveViewToLocation(u,2,this.desc.id),o.openView(c,!0)):x.id&&(t.moveViewsToContainer([u],t.getViewContainerById(x.id),void 0,this.desc.id),o.openView(c,!0)),h.hide()})),p.add(h.onDidHide(()=>p.dispose())),h.show()}};W(sVt);W(class extends z{constructor(){super({id:"workbench.action.resetFocusedViewLocation",title:P(4283,"Reset Focused View Location"),category:Fe.View,f1:!0,precondition:rc.notEqualsTo("")})}run(a){let i=a.get(ji),e=a.get(X),t=a.get(ct),o=a.get(Gt),n=rc.getValue(e),r=null;if(n!==void 0&&n.trim()!==""&&(r=i.getViewDescriptorById(n)),!r){t.error(d(4282,null));return}let s=i.getDefaultContainerById(r.id);!s||s===i.getViewContainerByViewId(r.id)||(i.moveViewsToContainer([r],s,void 0,this.desc.id),o.openView(r.id,!0))}});var I_=class extends z{static{this.RESIZE_INCREMENT=60}resizePart(i,e,t,o){if(t.activeContainer!==t.mainContainer)return;let n;if(o===void 0){let r=t.hasFocus("workbench.parts.editor"),s=t.hasFocus("workbench.parts.sidebar"),l=t.hasFocus("workbench.parts.panel"),c=t.hasFocus("workbench.parts.auxiliarybar");s?n="workbench.parts.sidebar":l?n="workbench.parts.panel":r?n="workbench.parts.editor":c&&(n="workbench.parts.auxiliarybar")}else n=o;n&&t.resizePart(n,i,e)}},kki=class extends I_{constructor(){super({id:"workbench.action.increaseViewSize",title:P(4227,"Increase Current View Size"),f1:!0,precondition:ew.toNegated()})}run(i){this.resizePart(I_.RESIZE_INCREMENT,I_.RESIZE_INCREMENT,i.get(wi))}},Eki=class extends I_{constructor(){super({id:"workbench.action.increaseViewWidth",title:P(4226,"Increase Editor Width"),f1:!0,precondition:ew.toNegated()})}run(i){this.resizePart(I_.RESIZE_INCREMENT,0,i.get(wi),"workbench.parts.editor")}},Tki=class extends I_{constructor(){super({id:"workbench.action.increaseViewHeight",title:P(4225,"Increase Editor Height"),f1:!0,precondition:ew.toNegated()})}run(i){this.resizePart(0,I_.RESIZE_INCREMENT,i.get(wi),"workbench.parts.editor")}},_ki=class extends I_{constructor(){super({id:"workbench.action.decreaseViewSize",title:P(4215,"Decrease Current View Size"),f1:!0,precondition:ew.toNegated()})}run(i){this.resizePart(-I_.RESIZE_INCREMENT,-I_.RESIZE_INCREMENT,i.get(wi))}},Dki=class extends I_{constructor(){super({id:"workbench.action.decreaseViewWidth",title:P(4214,"Decrease Editor Width"),f1:!0,precondition:ew.toNegated()})}run(i){this.resizePart(-I_.RESIZE_INCREMENT,0,i.get(wi),"workbench.parts.editor")}},Rki=class extends I_{constructor(){super({id:"workbench.action.decreaseViewHeight",title:P(4213,"Decrease Editor Height"),f1:!0,precondition:ew.toNegated()})}run(i){this.resizePart(0,-I_.RESIZE_INCREMENT,i.get(wi),"workbench.parts.editor")}};W(kki);W(Eki);W(Tki);W(_ki);W(Dki);W(Rki);W(class extends z{constructor(){super({id:"workbench.action.alignQuickInputTop",title:P(4200,"Align Quick Input Top"),f1:!1})}run(i){i.get($e).setAlignment("top")}});W(class extends z{constructor(){super({id:"workbench.action.alignQuickInputCenter",title:P(4199,"Align Quick Input Center"),f1:!1})}run(i){i.get($e).setAlignment("center")}});function gtn(a){return a.iconA!==void 0}var xMe=(a,i,e,t)=>({id:a,active:i,label:e,visualIcon:t,activeIcon:L.eye,inactiveIcon:L.eyeClosed,activeAriaLabel:d(4290,null),inactiveAriaLabel:d(4291,null),useButtons:!0}),dU=(a,i,e,t)=>({id:a,active:i,label:e,visualIcon:t,activeIcon:L.check,activeAriaLabel:d(4195,null),useButtons:!1}),ftn=C.and(Zk.toNegated(),C.notEquals("config.window.menuBarVisibility","hidden"),C.notEquals("config.window.menuBarVisibility","toggle"),C.notEquals("config.window.menuBarVisibility","compact")),aVt=[];(!et||!Qr)&&aVt.push(xMe("workbench.action.toggleMenuBar",ftn,d(4232,null),Zen));aVt.push(xMe(Mki,C.notEquals("config.workbench.activityBar.location","hidden"),d(4196,null),{whenA:C.equals("config.workbench.sideBar.location","left"),iconA:etn,iconB:ttn}),xMe(uU.ID,eN,d(4303,null),{whenA:C.equals("config.workbench.sideBar.location","left"),iconA:tVt,iconB:iVt}),xMe(SW.ID,tN,d(4288,null),{whenA:C.equals("config.workbench.sideBar.location","left"),iconA:iVt,iconB:tVt}),xMe(NG.ID,CZ,d(4265,null),ntn),xMe(hhe.ID,C.equals("config.workbench.statusBar.visible",!0),d(4308,null),rtn));var Dho=[dU(rVt.ID,C.equals("config.workbench.sideBar.location","left"),d(4231,null),tVt),dU(nVt.ID,C.equals("config.workbench.sideBar.location","right"),d(4287,null),iVt)],Rho=[dU("workbench.action.alignPanelLeft",EH.isEqualTo("left"),d(4230,null),stn),dU("workbench.action.alignPanelRight",EH.isEqualTo("right"),d(4286,null),atn),dU("workbench.action.alignPanelCenter",EH.isEqualTo("center"),d(4204,null),ltn),dU("workbench.action.alignPanelJustify",EH.isEqualTo("justify"),d(4228,null),ctn)],Lho=[dU("workbench.action.alignQuickInputTop",jet.isEqualTo("top"),d(4322,null),dtn),dU("workbench.action.alignQuickInputCenter",jet.isEqualTo("center"),d(4201,null),utn)],Mho=[dU("workbench.action.toggleFullScreen",ZA,d(4217,null),ptn),dU("workbench.action.toggleZenMode",Yf,d(4323,null),htn),dU("workbench.action.toggleCenteredLayout",yYe,d(4202,null),mtn)],Pho=new Set;for(let{active:a}of[...aVt,...Dho,...Rho,...Lho,...Mho])for(let i of a.keys())Pho.add(i);W(class extends z{constructor(){super({id:"workbench.action.customizeLayout",title:P(4211,"Customize Layout..."),f1:!0,icon:_ho,menu:[{id:R.LayoutControlMenuSubmenu,group:"z_end"},{id:R.LayoutControlMenu,when:C.and(Qf.toNegated(),C.equals("config.workbench.layoutControl.type","both")),group:"1_layout"}]})}getItems(i,e){let t=o=>{let n=o.active.evaluate(i.getContext(null)),r=o.useButtons?o.label:o.label+(n&&o.activeIcon?` $(${o.activeIcon.id})`:!n&&o.inactiveIcon?` $(${o.inactiveIcon.id})`:""),s=o.label+(n&&o.activeAriaLabel?` (${o.activeAriaLabel})`:!n&&o.inactiveAriaLabel?` (${o.inactiveAriaLabel})`:"");if(o.visualIcon){let c=o.visualIcon;gtn(c)&&(c=c.whenA.evaluate(i.getContext(null))?c.iconA:c.iconB),r=`$(${c.id}) ${r}`}let l=n?o.activeIcon:o.inactiveIcon;return{type:"item",id:o.id,label:r,ariaLabel:s,keybinding:e.lookupKeybinding(o.id,i),buttons:o.useButtons?[{alwaysVisible:!1,tooltip:s,iconClass:l?q.asClassName(l):void 0}]:void 0}};return[{type:"separator",label:d(4321,null)},...aVt.map(t),{type:"separator",label:d(4306,null)},...Dho.map(t),{type:"separator",label:d(4266,null)},...Rho.map(t),{type:"separator",label:d(4281,null)},...Lho.map(t),{type:"separator",label:d(4229,null)},...Mho.map(t)]}run(i){if(this._currentQuickPick){this._currentQuickPick.hide();return}let e=i.get(B),t=i.get(X),o=i.get(fe),n=i.get($e),r=i.get(Le),s=new O,l=s.add(n.createQuickPick({useSeparators:!0}));this._currentQuickPick=l,l.items=this.getItems(t,r),l.ignoreFocusOut=!0,l.hideInput=!0,l.title=d(4212,null);let c={alwaysVisible:!0,iconClass:q.asClassName(L.close),tooltip:d(4205,null)},u={alwaysVisible:!0,iconClass:q.asClassName(L.discard),tooltip:d(4285,null)};l.buttons=[u,c];let p;s.add(t.onDidChangeContext(h=>{h.affectsSome(Pho)&&(l.items=this.getItems(t,r),p&&(l.activeItems=l.items.filter(g=>g.id===p?.id)),setTimeout(()=>n.focus(),0))})),s.add(l.onDidAccept(h=>{l.selectedItems.length&&(p=l.selectedItems[0],o.executeCommand(p.id))})),s.add(l.onDidTriggerItemButton(h=>{h.item&&(p=h.item,o.executeCommand(p.id))})),s.add(l.onDidTriggerButton(h=>{if(h===c)l.hide();else if(h===u){let g=f=>{let v=e.inspect(f);e.updateValue(f,v.defaultValue)};g("workbench.activityBar.location"),g("workbench.sideBar.location"),g("workbench.statusBar.visible"),g("workbench.panel.defaultLocation"),(!et||!Qr)&&g("window.menuBarVisibility"),o.executeCommand("workbench.action.alignPanelCenter"),o.executeCommand("workbench.action.alignQuickInputTop")}})),s.add(l.onDidHide(()=>{l.dispose()})),s.add(l.onDispose(()=>{this._currentQuickPick=void 0,s.dispose()})),l.show()}});(function(){oe.as($t.Configuration).registerConfiguration({id:"zenMode",order:9,title:d(5453,null),type:"object",properties:{"zenMode.fullScreen":{type:"boolean",default:!0,description:d(5443,null)},"zenMode.centerLayout":{type:"boolean",default:!0,description:d(5442,null)},"zenMode.showTabs":{type:"string",enum:["multiple","single","none"],description:d(5448,null),enumDescriptions:[d(5449,null),d(5451,null),d(5450,null)],default:"multiple"},"zenMode.hideStatusBar":{type:"boolean",default:!0,description:d(5446,null)},"zenMode.hideActivityBar":{type:"boolean",default:!0,description:d(5444,null)},"zenMode.hideLineNumbers":{type:"boolean",default:!0,description:d(5445,null)},"zenMode.restore":{type:"boolean",default:!0,description:d(5447,null)},"zenMode.silentNotifications":{type:"boolean",default:!0,description:d(5452,null)}}})})();W(kMe);W(EMe);W(TMe);be.appendMenuItem(R.MenubarAppearanceMenu,{submenu:R.EditorTabsBarShowTabsZenModeSubmenu,title:d(5440,null),group:"3_workbench_layout_move",order:10,when:Yf});W(class extends z{constructor(){super({id:"workbench.action.toggleZenMode",title:{...P(5441,"Toggle Zen Mode"),mnemonicTitle:d(5439,null)},precondition:ew.toNegated(),category:Fe.View,f1:!0,keybinding:{weight:200,primary:Gi(2089,56)},toggled:Yf,menu:[{id:R.MenubarAppearanceMenu,group:"1_toggle_view",order:2}]})}run(a){return a.get(wi).toggleZenMode()}});xt.registerCommandAndKeybindingRule({id:"workbench.action.exitZenMode",weight:-900,handler(a){let i=a.get(wi),e=a.get(X);Yf.getValue(e)&&i.toggleZenMode()},when:Yf,primary:Gi(9,9)});var tTc=te("agents.background",{dark:Bo,light:ch,hcDark:Bo,hcLight:Bo},d(3141,null)),iTc=te("agentsPanel.background",{dark:ch,light:Bo,hcDark:ch,hcLight:ch},d(3154,null)),oTc=te("agentsPanel.foreground",QA,d(3156,null)),nTc=te("agentsPanel.border",{dark:ni(xo,.15),light:ni(xo,.15),hcDark:Ei,hcLight:Ei},d(3155,null)),rTc=te("agentsGradient.tintColor",th,d(3149,null)),sTc=te("agentFeedbackInputWidget.border",{dark:bT,light:bT,hcDark:Ei,hcLight:Ei},d(3140,null)),aTc=te("agentsUpdateButton.downloadingBackground",ni(th,.4),d(3160,null)),lTc=te("agentsUpdateButton.downloadedBackground",ni(th,.7),d(3159,null)),cTc=te("agentsChatInput.background",Hf,d(3144,null)),dTc=te("agentsChatInput.foreground",IT,d(3147,null)),uTc=te("agentsChatInput.border",LI,d(3145,null)),pTc=te("agentsChatInput.focusBorder",Kc,d(3146,null)),mTc=te("agentsChatInput.placeholderForeground",cX,d(3148,null)),hTc=te("agentsNewSessionButton.background","#00000000",d(3150,null)),gTc=te("agentsNewSessionButton.foreground",QA,d(3152,null)),fTc=te("agentsNewSessionButton.border",dX,d(3151,null)),vTc=te("agentsNewSessionButton.hoverBackground",x5,d(3153,null)),bTc=te("agentsBadge.background",zD,d(3142,null)),STc=te("agentsBadge.foreground",KD,d(3143,null)),ITc=te("agentsUnreadBadge.background",zD,d(3157,null)),yTc=te("agentsUnreadBadge.foreground",KD,d(3158,null));function Oho(a){return`--vscode-${a.replace(/\./g,"-")}`}function Aho(a){return a!==null&&typeof a=="object"&&"light"in a&&"dark"in a}function vtn(a,i="px"){return{value:a,unit:i}}function Tv(a,i="px"){let e=vtn(a,i);return{light:e,dark:e,hcDark:e,hcLight:e}}function ott(a){return a.unit===""?`${a.value}`:`${a.value}${a.unit}`}var btn={SizeContribution:"base.contributions.sizes"};var Pki=class extends k{constructor(){super();this._onDidChangeSchema=this._register(new T);this.onDidChangeSchema=this._onDidChangeSchema.event;this.sizeSchema={type:"object",properties:{}};this.sizeReferenceSchema={type:"string",enum:[],enumDescriptions:[]};this.sizesById={}}notifyThemeUpdate(e){for(let t of Object.keys(this.sizesById)){let o=this.resolveDefaultSize(t,e);o&&(this.sizeSchema.properties[t].default=ott(o))}this._onDidChangeSchema.fire()}registerSize(e,t,o,n){let r={id:e,description:o,defaults:t,deprecationMessage:n};this.sizesById[e]=r;let l=(t?Aho(t)?(t.dark??t.light??t.hcDark??t.hcLight)?.unit==="":t.unit==="":!1)?{type:"string",pattern:"^(?:\\d+|default)$",patternErrorMessage:'Value must be an integer (e.g., "400") or "default"'}:{type:"string",pattern:"^(?:\\d+(\\.\\d+)?(px|rem|em|%)|default)$",patternErrorMessage:'Size must be a number followed by px, rem, em, or % (e.g., "12px", "1.5rem") or "default"'};return n&&(l.deprecationMessage=n),this.sizeSchema.properties[e]={description:o,...l},this.sizeReferenceSchema.enum.push(e),this.sizeReferenceSchema.enumDescriptions.push(o),this._onDidChangeSchema.fire(),e}deregisterSize(e){delete this.sizesById[e],delete this.sizeSchema.properties[e];let t=this.sizeReferenceSchema.enum.indexOf(e);t!==-1&&(this.sizeReferenceSchema.enum.splice(t,1),this.sizeReferenceSchema.enumDescriptions.splice(t,1)),this._onDidChangeSchema.fire()}getSizes(){return Object.keys(this.sizesById).map(e=>this.sizesById[e])}resolveDefaultSize(e,t){let o=this.sizesById[e];if(o?.defaults)return(Aho(o.defaults)?o.defaults[t.type]:o.defaults)??void 0}getSizeSchema(){return this.sizeSchema}getSizeReferenceSchema(){return this.sizeReferenceSchema}toString(){let e=(t,o)=>{let n=t.indexOf(".")===-1?0:1,r=o.indexOf(".")===-1?0:1;return n!==r?n-r:t.localeCompare(o)};return Object.keys(this.sizesById).sort(e).map(t=>`- \`${t}\`: ${this.sizesById[t].description}`).join(`
`)}},ntt=new Pki;oe.add(btn.SizeContribution,ntt);function _v(a,i,e,t){return ntt.registerSize(a,i,e,t)}function rtt(){return ntt}var Fho="vscode://schemas/workbench-sizes",Who=oe.as(Ta.JSONContribution);Who.registerSchema(Fho,ntt.getSizeSchema());var Nho=new Dt(()=>Who.notifySchemaChanged(Fho),200);ntt.onDidChangeSchema(()=>{Nho.isScheduled()||Nho.schedule()});var MTc=_v("agents.fontSize.heading1",Tv(26,"px"),d(3130,null)),PTc=_v("agents.fontSize.heading2",Tv(18,"px"),d(3131,null)),ATc=_v("agents.fontSize.heading3",Tv(13,"px"),d(3132,null)),NTc=_v("agents.fontSize.body1",Tv(13,"px"),d(3128,null)),OTc=_v("agents.fontSize.body2",Tv(11,"px"),d(3129,null)),FTc=_v("agents.fontSize.label1",Tv(12,"px"),d(3133,null)),WTc=_v("agents.fontSize.label2",Tv(11,"px"),d(3134,null)),VTc=_v("agents.fontSize.label3",Tv(11,"px"),d(3135,null)),BTc=_v("agents.fontSize.label4",Tv(10,"px"),d(3136,null)),HTc=_v("agents.fontWeight.regular",Tv(400,""),d(3138,null)),UTc=_v("agents.fontWeight.medium",Tv(500,""),d(3137,null)),zTc=_v("agents.fontWeight.semiBold",Tv(600,""),d(3139,null));function Aki(a,i){return[li({id:"undo",label:d(4345,null),run:()=>_m().execCommand("undo")}),li({id:"redo",label:d(4343,null),run:()=>_m().execCommand("redo")}),new oi,li({id:"editor.action.clipboardCutAction",label:d(4341,null),run:()=>{i.trace("TextInputActionsProvider#cut"),_m().execCommand("cut")}}),li({id:"editor.action.clipboardCopyAction",label:d(4340,null),run:()=>{i.trace("TextInputActionsProvider#copy"),_m().execCommand("copy")}}),li({id:"editor.action.clipboardPasteAction",label:d(4342,null),run:async e=>{i.trace("TextInputActionsProvider#paste");let t=await a.readText();if(kY(e)||Xle(e)){let o=e.selectionStart||0,n=e.selectionEnd||0;e.value=`${e.value.substring(0,o)}${t}${e.value.substring(n,e.value.length)}`,e.selectionStart=o+t.length,e.selectionEnd=e.selectionStart,e.dispatchEvent(new Event("input",{bubbles:!0,cancelable:!0}))}}}),new oi,li({id:"editor.action.selectAll",label:d(4344,null),run:()=>_m().execCommand("selectAll")})]}var DMe=class extends k{constructor(e,t,o,n){super();this.layoutService=e;this.contextMenuService=t;this.clipboardService=o;this.logService=n;this.textInputActions=new uo(()=>Aki(this.clipboardService,this.logService));this.registerListeners()}static{this.ID="workbench.contrib.textInputActionsProvider"}registerListeners(){this._register(U.runAndSubscribe(this.layoutService.onDidAddContainer,({container:e,disposables:t})=>{t.add($(e,"contextmenu",o=>this.onContextMenu(Me(e),o)))},{container:this.layoutService.mainContainer,disposables:this._store}))}onContextMenu(e,t){if(t.defaultPrevented)return;let o=t.target;if(!kY(o)&&!Xle(o))return;Kt.stop(t,!0);let n=new Ln(e,t);this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>this.textInputActions.value,getActionsContext:()=>o})}};DMe=I([m(0,wi),m(1,Xe),m(2,Bi),m(3,re)],DMe);bt(DMe.ID,DMe,vt.BlockRestore);var ghe="rendererLog",eP={id:ghe,name:d(19170,null)},OG="workbench.action.showWindowLog";var Nki=class extends z{constructor(){super({id:"workbench.action.inspectContextKeys",title:P(4139,"Inspect Context Keys"),category:Fe.Developer,f1:!0})}run(i){let e=i.get(X),t=new O,o=Pr(void 0,void 0,t);Eg("*","cursor: crosshair !important;",o);let n=document.createElement("div"),r=_m();r.body.appendChild(n),t.add(ee(()=>n.remove())),n.style.position="absolute",n.style.pointerEvents="none",n.style.backgroundColor="rgba(255, 0, 0, 0.5)",n.style.zIndex="1000";let s=t.add(new Zn(r,"mousemove",!0));t.add(s.event(u=>{let p=u.target,h=ur(p);n.style.top=`${h.top}px`,n.style.left=`${h.left}px`,n.style.width=`${h.width}px`,n.style.height=`${h.height}px`}));let l=t.add(new Zn(r,"mousedown",!0));U.once(l.event)(u=>{u.preventDefault(),u.stopPropagation()},null,t);let c=t.add(new Zn(r,"mouseup",!0));U.once(c.event)(u=>{u.preventDefault(),u.stopPropagation();let p=e.getContext(u.target);console.log(p.collectAllValues()),je(t)},null,t)}},Oki=class a extends z{constructor(){super({id:"workbench.action.toggleScreencastMode",title:P(4173,"Toggle Screencast Mode"),category:Fe.Developer,f1:!0})}run(i){if(a.disposable){a.disposable.dispose(),a.disposable=void 0;return}let e=i.get(Kl),t=i.get(B),o=i.get(Le),n=new O,r=e.activeContainer,s=D(r,_(".screencast-mouse"));n.add(ee(()=>s.remove()));let l=D(r,_(".screencast-keyboard"));n.add(ee(()=>l.remove()));let c=n.add(new T),u=n.add(new T),p=n.add(new T);function h(se,ae){let ce=new O;ce.add(ce.add(new Zn(se,"mousedown",!0)).event(Se=>c.fire(Se))),ce.add(ce.add(new Zn(se,"mouseup",!0)).event(Se=>u.fire(Se))),ce.add(ce.add(new Zn(se,"mousemove",!0)).event(Se=>p.fire(Se))),ae.add(ce),n.add(ee(()=>ae.delete(ce))),n.add(ce)}for(let{window:se,disposables:ae}of dx())h(e.getContainer(se),ae);n.add(Of(({window:se,disposables:ae})=>h(e.getContainer(se),ae))),n.add(e.onDidChangeActiveContainer(()=>{e.activeContainer.appendChild(s),e.activeContainer.appendChild(l)}));let g=()=>{s.style.borderColor=Ue.fromHex(t.getValue("screencastMode.mouseIndicatorColor")).toString()},f,v=()=>{f=jn(t.getValue("screencastMode.mouseIndicatorSize")||20,20,100),s.style.height=`${f}px`,s.style.width=`${f}px`};g(),v(),n.add(c.event(se=>{s.style.top=`${se.clientY-f/2}px`,s.style.left=`${se.clientX-f/2}px`,s.style.display="block",s.style.transform="scale(1)",s.style.transition="transform 0.1s";let ae=p.event(ce=>{s.style.top=`${ce.clientY-f/2}px`,s.style.left=`${ce.clientX-f/2}px`,s.style.transform=`scale(${.8})`});U.once(u.event)(()=>{s.style.display="none",ae.dispose()})}));let b=()=>{l.style.fontSize=`${jn(t.getValue("screencastMode.fontSize")||56,20,100)}px`},S=()=>{l.style.bottom=`${jn(t.getValue("screencastMode.verticalOffset")||0,0,90)}%`},y,w=()=>{y=jn(t.getValue("screencastMode.keyboardOverlayTimeout")||800,500,5e3)};b(),S(),w(),n.add(t.onDidChangeConfiguration(se=>{se.affectsConfiguration("screencastMode.verticalOffset")&&S(),se.affectsConfiguration("screencastMode.fontSize")&&b(),se.affectsConfiguration("screencastMode.keyboardOverlayTimeout")&&w(),se.affectsConfiguration("screencastMode.mouseIndicatorColor")&&g(),se.affectsConfiguration("screencastMode.mouseIndicatorSize")&&v()}));let x=n.add(new T),E=n.add(new T),M=n.add(new T),N=n.add(new T);function V(se,ae){let ce=new O;ce.add(ce.add(new Zn(se,"keydown",!0)).event(Se=>x.fire(Se))),ce.add(ce.add(new Zn(se,"compositionstart",!0)).event(Se=>E.fire(Se))),ce.add(ce.add(new Zn(se,"compositionupdate",!0)).event(Se=>M.fire(Se))),ce.add(ce.add(new Zn(se,"compositionend",!0)).event(Se=>N.fire(Se))),ae.add(ce),n.add(ee(()=>ae.delete(ce))),n.add(ce)}for(let{window:se,disposables:ae}of dx())V(se,ae);n.add(Of(({window:se,disposables:ae})=>V(se,ae)));let H=0,K,j=!1,J=n.add(new Dt(()=>{l.textContent="",K=void 0,H=0},y));n.add(E.event(se=>{j=!0})),n.add(M.event(se=>{se.data&&j?(H>20&&(l.innerText="",H=0),K=K??D(l,_("span.key")),K.textContent=se.data):j&&(l.innerText="",D(l,_("span.key",{},"Backspace"))),J.schedule(y)})),n.add(N.event(se=>{K=void 0,H++})),n.add(x.event(se=>{if(se.key==="Process"||/[\uac00-\ud787\u3131-\u314e\u314f-\u3163\u3041-\u3094\u30a1-\u30f4\u30fc\u3005\u3006\u3024\u4e00-\u9fa5]/u.test(se.key)){se.code==="Backspace"||se.code.includes("Key")?j=!0:(K=void 0,j=!1),J.schedule(y);return}if(se.isComposing)return;let ae=t.getValue("screencastMode.keyboardOptions"),ce=new mi(se),Se=o.softDispatch(ce,ce.target);if(Se.kind===2&&Se.commandId&&!(ae.showSingleEditorCursorMoves??!0)&&["cursorLeft","cursorRight","cursorUp","cursorDown"].includes(Se.commandId))return;(ce.ctrlKey||ce.altKey||ce.metaKey||ce.shiftKey||H>20||ce.keyCode===1||ce.keyCode===9||ce.keyCode===16||ce.keyCode===18||ce.keyCode===15||ce.keyCode===17)&&(l.innerText="",H=0);let Re=o.resolveKeyboardEvent(ce),xe=this._isKbFound(Se)&&Se.commandId?this.getCommandDetails(Se.commandId):void 0,He=xe?.title,Ee=Re.getLabel();if(xe&&((ae.showCommandGroups??!1)&&xe.category&&(He=`${xe.category}: ${He} `),this._isKbFound(Se)&&Se.commandId)){let Te=o.lookupKeybindings(Se.commandId).filter(It=>It.getLabel()?.endsWith(Ee??""));Te.length>0&&(Ee=Te[Te.length-1].getLabel())}(ae.showCommands??!0)&&He&&D(l,_("span.title",{},`${He} `)),((ae.showKeys??!0)||(ae.showKeybindings??!0)&&this._isKbFound(Se))&&(Ee=Ee?.replace("UpArrow","\u2191")?.replace("DownArrow","\u2193")?.replace("LeftArrow","\u2190")?.replace("RightArrow","\u2192"),D(l,_("span.key",{},Ee??""))),H++,J.schedule(y)})),a.disposable=n}_isKbFound(i){return i.kind===2}getCommandDetails(i){let e=be.getCommand(i);if(e)return{title:typeof e.title=="string"?e.title:e.title.value,category:e.category?typeof e.category=="string"?e.category:e.category.value:void 0};let t=Ge.getCommand(i);if(t?.metadata?.description)return{title:typeof t.metadata.description=="string"?t.metadata.description:t.metadata.description.value}}},Fki=class extends z{constructor(){super({id:"workbench.action.logStorage",title:P(4141,"Log Storage Database Contents"),category:Fe.Developer,f1:!0})}run(i){let e=i.get(de),t=i.get(ct);e.log(),t.info(d(4169,null),d(4168,null))}},Wki=class extends z{constructor(){super({id:"workbench.action.logWorkingCopies",title:P(4142,"Log Working Copies"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get($a),t=i.get(Om),o=i.get(re),n=i.get(Tl),r=await t.getBackups(),s=["","[Working Copies]",...e.workingCopies.length>0?e.workingCopies.map(l=>`${l.isDirty()?"\u25CF ":""}${l.resource.toString(!0)} (typeId: ${l.typeId||"<no typeId>"})`):["<none>"],"","[Backups]",...r.length>0?r.map(l=>`${l.resource.toString(!0)} (typeId: ${l.typeId||"<no typeId>"})`):["<none>"]];o.info(s.join(`
`)),n.showChannel(ghe,!0)}},Vki=class a extends z{static{this.SIZE_THRESHOLD=1024*16}constructor(){super({id:"workbench.action.removeLargeStorageDatabaseEntries",title:P(4146,"Remove Large Storage Database Entries..."),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(de),t=i.get($e),o=i.get(gn),n=i.get(ct),r=i.get(ko),s=[];for(let p of[-1,0,1])if(!(p===0&&o.currentProfile.isDefault))for(let h of[1,0])for(let g of e.keys(p,h)){let f=e.get(g,p);f&&(!r.isBuilt||f.length>a.SIZE_THRESHOLD)&&s.push({key:g,scope:p,target:h,size:f.length,label:g,description:Ml.formatSize(f.length),detail:d(4140,null,p===-1?d(4138,null):p===0?d(4145,null):d(4175,null),h===1?d(4143,null):d(4174,null))})}s.sort((p,h)=>h.size-p.size);let l=await new Promise(p=>{let h=new O,g=h.add(t.createQuickPick());g.items=s,g.canSelectMany=!0,g.ok=!1,g.customButton=!0,g.hideCheckAll=!0,g.customLabel=d(4150,null),g.placeholder=d(4152,null),s.length===0&&(g.description=d(4151,null)),g.show(),h.add(g.onDidCustom(()=>{p(g.selectedItems),g.hide()})),h.add(g.onDidHide(()=>h.dispose()))});if(l.length===0)return;let{confirmed:c}=await n.confirm({type:"warning",message:d(4148,null),detail:d(4149,null,l.map(p=>p.label).join(`
`)),primaryButton:d(4147,null)});if(!c)return;let u=new Set;for(let p of l)e.remove(p.key,p.scope),u.add(p.scope);for(let p of u)await e.optimize(p)}},fhe,lVt=new Set,vhe=new Y("dirtyWorkingCopies","stopped"),Bki=class extends z{constructor(){super({id:"workbench.action.startTrackDisposables",title:P(4166,"Start Tracking Disposables"),category:Fe.Developer,f1:!0,precondition:C.and(vhe.isEqualTo("pending").negate(),vhe.isEqualTo("started").negate())})}run(i){vhe.bindTo(i.get(X)).set("started"),lVt.clear(),fhe=new Tvt,Hye(fhe)}},Hki=class extends z{constructor(){super({id:"workbench.action.snapshotTrackedDisposables",title:P(4165,"Snapshot Tracked Disposables"),category:Fe.Developer,f1:!0,precondition:vhe.isEqualTo("started")})}run(i){vhe.bindTo(i.get(X)).set("pending"),lVt=new Set(fhe?.computeLeakingDisposables(1e3)?.leaks.map(t=>t.value))}},Uki=class extends z{constructor(){super({id:"workbench.action.stopTrackDisposables",title:P(4167,"Stop Tracking Disposables"),category:Fe.Developer,f1:!0,precondition:vhe.isEqualTo("pending")})}run(i){let e=i.get(ie);if(vhe.bindTo(i.get(X)).set("stopped"),fhe){let o=new Set;for(let r of new Set(fhe.computeLeakingDisposables(1e3)?.leaks)??[])lVt.has(r.value)&&o.add(r);let n=fhe.computeLeakingDisposables(1e3,Array.from(o));n&&e.openEditor({resource:void 0,contents:n.details})}Hye(null),fhe=void 0,lVt.clear()}},zki=class extends z{constructor(){super({id:"workbench.action.showPolicyDiagnostics",title:P(4144,"Policy Diagnostics"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(ie),t=i.get(B),o=i.get(Ze),n=i.get(Nd),r=i.get(ks),s=i.get(mE),l=i.get(q_e),c=i.get(j_e),u=oe.as($t.Configuration),p=`# VS Code Policy Diagnostics

`;p+=`*WARNING: This file may contain sensitive information.*

`,p+=`## System Information

`,p+=`| Property | Value |
`,p+=`|----------|-------|
`,p+=`| Generated | ${new Date().toISOString()} |
`,p+=`| Product | ${o.nameLong} ${o.version} |
`,p+=`| Commit | ${o.commit||"n/a"} |

`,p+=`## Account Information

`;try{let v=await n.getDefaultAccount(),b=["sessionId","analytics_tracking_id"];if(v){let S="Unknown",y="Unknown";try{let x=r.getProviderIds();for(let E of x){let N=(await r.getSessions(E)).find(V=>V.id===v.sessionId);if(N){S=N.account.id,y=N.account.label;break}}}catch{}p+=`### Default Account Summary

`,p+=`**Account ID/Username**: ${S}

`,p+=`**Account Label**: ${y}

`,p+=`### Detailed Account Properties

`,p+=`| Property | Value |
`,p+=`|----------|-------|
`;for(let[x,E]of Object.entries(v))if(E!=null){let M;b.includes(x)?M="***":typeof E=="object"?M=JSON.stringify(E):M=String(E),p+=`| ${x} | ${M} |
`}let w=n.policyData;p+=`| policyData | ${w?JSON.stringify(w):"No Policy Data"} |
`,p+=`
`}else p+=`*No default account configured*

`}catch(v){p+=`*Error retrieving account information: ${v}*

`}p+=`## Account Policy Gate

`;try{let v=c.gateInfo,b=l.getPolicyValue(EYe);p+=`| Property | Value |
`,p+=`|----------|-------|
`,p+=`| State | \`${v.state}\` |
`,p+=`| Reason | ${v.reason?`\`${v.reason}\``:"*n/a*"} |
`,p+=`| ${EYe} | ${b!==void 0?`\`${String(b)}\``:"*not set*"} |
`,p+=`
`,p+=`**Legend**

`,p+="- `inactive`: gate disabled (no approved orgs configured) \u2014 policies behave as account data dictates.\n",p+="- `satisfied`: gate active and approved \u2014 account policy values flow normally.\n",p+="- `restricted`: gate active and not satisfied \u2014 opted-in policies forced to their restricted value.\n",p+="  - `noAccount`: no default account signed in.\n",p+="  - `wrongProvider`: signed in with a non-GitHub provider.\n",p+="  - `orgNotApproved`: signed in but account is not a member of any approved organization.\n",p+="  - `policyNotResolved`: signed in to an approved org but account-side policy data has not yet been fetched.\n\n"}catch(v){p+=`*Error retrieving account policy gate info: ${v}*

`}p+=`## Policy-Controlled Settings

`;let h=u.getPolicyConfigurations(),g=u.getConfigurationProperties(),f=u.getExcludedConfigurationProperties();if(h.size>0){let v=[],b=[];for(let[w,x]of h){let E=g[x]??f[x];if(E){let M=t.inspect(x),N={name:w,key:x,property:E,inspection:M};M.policyValue!==void 0?v.push(N):b.push(N)}}let S=new Map,y=w=>{if(S.has(w))return S.get(w);try{if(l.constructor.name==="MultiplexPolicyService"){let E=l;if(E.policyServices){let M=E.policyServices;for(let N of M)if(N.getPolicyValue&&N.getPolicyValue(w)!==void 0)return S.set(w,N.constructor.name),N.constructor.name}}return""}catch{return"Unknown"}};if(p+=`### Applied Policy

`,v.sort((w,x)=>y(w.name).localeCompare(y(x.name))||w.name.localeCompare(x.name)),v.length>0){p+=`| Setting Key | Policy Name | Policy Source | Default Value | Current Value | Policy Value |
`,p+=`|-------------|-------------|---------------|---------------|---------------|-------------|
`;for(let w of v){let x=JSON.stringify(w.property.default),E=JSON.stringify(w.inspection.value),M=JSON.stringify(w.inspection.policyValue),N=y(w.name);p+=`| ${w.key} | ${w.name} | ${N} | \`${x}\` | \`${E}\` | \`${M}\` |
`}p+=`
`}else p+=`*No settings are currently controlled by policies*

`;if(p+=`###  Non-applied Policy

`,b.length>0){p+=`| Setting Key | Policy Name  
`,p+=`|-------------|-------------|
`;for(let w of b)p+=`| ${w.key} | ${w.name}|
`;p+=`
`}else p+=`*All policy-controllable settings are currently being enforced*

`}else p+=`*No policy-controlled settings found*

`;p+=`## Authentication Information

`;try{let v=r.getProviderIds();if(v.length>0){p+=`### Authentication Providers

`,p+=`| Provider ID | Sessions | Accounts |
`,p+=`|-------------|----------|----------|
`;for(let b of v)try{let S=await r.getSessions(b),y=S.map(x=>x.account),w=Array.from(new Set(y.map(x=>x.label)));p+=`| ${b} | ${S.length} | ${w.join(", ")||"None"} |
`}catch(S){p+=`| ${b} | Error | ${S} |
`}p+=`
`,p+=`### Detailed Session Information

`;for(let b of v)try{let S=await r.getSessions(b);if(S.length>0){p+=`#### ${b}

`,p+=`| Account | Scopes | Extensions with Access |
`,p+=`|---------|--------|------------------------|
`;for(let y of S){let w=y.account.label,x=y.scopes.join(", ")||"Default";try{let M=s.readAllowedExtensions(b,w).filter(N=>N.allowed!==!1).map(N=>`${N.name}${N.trusted?" (trusted)":""}`).join(", ")||"None";p+=`| ${w} | ${x} | ${M} |
`}catch(E){p+=`| ${w} | ${x} | Error: ${E} |
`}}p+=`
`}}catch(S){p+=`#### ${b}
*Error retrieving sessions: ${S}*

`}}else p+=`*No authentication providers found*

`}catch(v){p+=`*Error retrieving authentication information: ${v}*

`}await e.openEditor({resource:void 0,contents:p,languageId:"markdown",options:{pinned:!0}})}},Kki=class extends z{constructor(){super({id:"workbench.action.syncAccountPolicy",title:P(4170,"Sync Account Policy"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(Nd),t=i.get(ct),o=i.get(re);try{o.info("[DefaultAccount] Manually syncing account policy"),await e.refresh({forceRefresh:!0}),await t.info(d(4172,null))}catch(n){o.error("[DefaultAccount] Failed to sync account policy",n),await t.error(d(4171,null),n instanceof Error?n.message:String(n))}}};W(Nki);W(Oki);W(Fki);W(Wki);W(Vki);W(zki);W(Kki);$i.commit||(W(Bki),W(Hki),W(Uki));var Stn=oe.as($t.Configuration);Stn.registerConfiguration({id:"screencastMode",order:9,title:d(4164,null),type:"object",properties:{"screencastMode.verticalOffset":{type:"number",default:20,minimum:0,maximum:90,description:d(4161,null)},"screencastMode.fontSize":{type:"number",default:56,minimum:20,maximum:100,description:d(4153,null)},"screencastMode.keyboardOptions":{type:"object",description:d(4154,null),properties:{showKeys:{type:"boolean",default:!0,description:d(4158,null)},showKeybindings:{type:"boolean",default:!0,description:d(4157,null)},showCommands:{type:"boolean",default:!0,description:d(4156,null)},showCommandGroups:{type:"boolean",default:!1,description:d(4155,null)},showSingleEditorCursorMoves:{type:"boolean",default:!0,description:d(4159,null)}},default:{showKeys:!0,showKeybindings:!0,showCommands:!0,showCommandGroups:!1,showSingleEditorCursorMoves:!0},additionalProperties:!1},"screencastMode.keyboardOverlayTimeout":{type:"number",default:800,minimum:500,maximum:5e3,description:d(4160,null)},"screencastMode.mouseIndicatorColor":{type:"string",format:"color-hex",default:"#FF0000",description:d(4162,null)},"screencastMode.mouseIndicatorSize":{type:"number",default:20,minimum:20,maximum:100,description:d(4163,null)}}});var cVt=class a extends z{static{this.ID="workbench.action.keybindingsReference"}static{this.AVAILABLE=!!(Sn?$i.keyboardShortcutsUrlLinux:et?$i.keyboardShortcutsUrlMac:$i.keyboardShortcutsUrlWin)}constructor(){super({id:a.ID,title:{...P(4178,"Keyboard Shortcuts Reference"),mnemonicTitle:d(4180,null)},category:Fe.Help,f1:!0,keybinding:{weight:200,when:null,primary:Gi(2089,2096)},menu:{id:R.MenubarHelpMenu,group:"2_reference",order:1}})}run(i){let e=i.get(Ze),t=i.get(Je),o=Sn?e.keyboardShortcutsUrlLinux:et?e.keyboardShortcutsUrlMac:e.keyboardShortcutsUrlWin;o&&t.open(A.parse(o))}},dVt=class a extends z{static{this.ID="workbench.action.openVideoTutorialsUrl"}static{this.AVAILABLE=!!$i.introductoryVideosUrl}constructor(){super({id:a.ID,title:{...P(4193,"Video Tutorials"),mnemonicTitle:d(4185,null)},category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"2_reference",order:2}})}run(i){let e=i.get(Ze),t=i.get(Je);e.introductoryVideosUrl&&t.open(A.parse(e.introductoryVideosUrl))}},uVt=class a extends z{static{this.ID="workbench.action.openTipsAndTricksUrl"}static{this.AVAILABLE=!!$i.tipsAndTricksUrl}constructor(){super({id:a.ID,title:{...P(4191,"Tips and Tricks"),mnemonicTitle:d(4183,null)},category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"2_reference",order:3}})}run(i){let e=i.get(Ze),t=i.get(Je);e.tipsAndTricksUrl&&t.open(A.parse(e.tipsAndTricksUrl))}},pVt=class a extends z{static{this.ID="workbench.action.openDocumentationUrl"}static{this.AVAILABLE=!!(Ft?$i.serverDocumentationUrl:$i.documentationUrl)}constructor(){super({id:a.ID,title:{...P(4188,"Documentation"),mnemonicTitle:d(4179,null)},category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"1_welcome",order:3}})}run(i){let e=i.get(Ze),t=i.get(Je),o=Ft?e.serverDocumentationUrl:e.documentationUrl;o&&t.open(A.parse(o))}},mVt=class a extends z{static{this.ID="workbench.action.openNewsletterSignupUrl"}static{this.AVAILABLE=!!$i.newsletterSignupUrl}constructor(){super({id:a.ID,title:P(4187,"Signup for the VS Code Newsletter"),category:Fe.Help,f1:!0})}run(i){let e=i.get(Ze),t=i.get(Je),o=i.get(_e);t.open(A.parse(`${e.newsletterSignupUrl}?machineId=${encodeURIComponent(o.machineId)}`))}},hVt=class a extends z{static{this.ID="workbench.action.openYouTubeUrl"}static{this.AVAILABLE=!!$i.youTubeUrl}constructor(){super({id:a.ID,title:{...P(4194,"Join Us on YouTube"),mnemonicTitle:d(4186,null)},category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"3_feedback",order:1}})}run(i){let e=i.get(Ze),t=i.get(Je);e.youTubeUrl&&t.open(A.parse(e.youTubeUrl))}},gVt=class a extends z{static{this.ID="workbench.action.openRequestFeatureUrl"}static{this.AVAILABLE=!!$i.requestFeatureUrl}constructor(){super({id:a.ID,title:{...P(4192,"Search Feature Requests"),mnemonicTitle:d(4184,null)},category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"3_feedback",order:2}})}run(i){let e=i.get(Ze),t=i.get(Je);e.requestFeatureUrl&&t.open(A.parse(e.requestFeatureUrl))}},fVt=class a extends z{static{this.ID="workbench.action.openLicenseUrl"}static{this.AVAILABLE=!!(Ft?$i.serverLicense:$i.licenseUrl)}constructor(){super({id:a.ID,title:{...P(4189,"View License"),mnemonicTitle:d(4181,null)},category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"4_legal",order:1}})}run(i){let e=i.get(Ze),t=i.get(Je),o=Ft?e.serverLicenseUrl:e.licenseUrl;if(o)if(Kr){let n=o.indexOf("?")>0?"&":"?";t.open(A.parse(`${o}${n}lang=${Kr}`))}else t.open(A.parse(o))}},vVt=class a extends z{static{this.ID="workbench.action.openPrivacyStatementUrl"}static{this.AVAILABLE=!!$i.privacyStatementUrl}constructor(){super({id:a.ID,title:{...P(4190,"Privacy Statement"),mnemonicTitle:d(4182,null)},category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"4_legal",order:2}})}run(i){let e=i.get(Ze),t=i.get(Je);e.privacyStatementUrl&&t.open(A.parse(e.privacyStatementUrl))}},Gki=class a extends z{static{this.ID="workbench.action.getStartedWithAccessibilityFeatures"}constructor(){super({id:a.ID,title:P(4177,"Get Started with Accessibility Features"),category:Fe.Help,f1:!0,precondition:qo.negate(),menu:{id:R.MenubarHelpMenu,group:"1_welcome",order:6,when:qo.negate()}})}run(i){i.get(fe).executeCommand("workbench.action.openWalkthrough","SetupAccessibility")}},bVt=class a extends z{static{this.ID="workbench.action.askVScode"}constructor(){super({id:a.ID,title:P(4176,"Ask @vscode"),category:Fe.Help,f1:!0,precondition:C.and(C.equals("chatSetupHidden",!1),C.equals("chatSetupDisabledInWorkspace",!1),qo.negate())})}async run(i){i.get(fe).executeCommand("workbench.action.chat.open",{mode:"agent",query:"@vscode ",isPartialQuery:!0})}};be.appendMenuItem(R.MenubarHelpMenu,{command:{id:bVt.ID,title:P(4176,"Ask @vscode")},order:7,group:"1_welcome",when:C.and(C.equals("chatSetupHidden",!1),C.equals("chatSetupDisabledInWorkspace",!1),qo.negate())});cVt.AVAILABLE&&W(cVt);dVt.AVAILABLE&&W(dVt);uVt.AVAILABLE&&W(uVt);pVt.AVAILABLE&&W(pVt);mVt.AVAILABLE&&W(mVt);hVt.AVAILABLE&&W(hVt);gVt.AVAILABLE&&W(gVt);fVt.AVAILABLE&&W(fVt);vVt.AVAILABLE&&W(vVt);W(Gki);W(bVt);function qki(a){let i=a?.getHTMLElement();i&&!Na(i)&&a?.domFocus()}async function Itn(a,i){if(!lue.getValue(a.contextKeyService))return i(a);let e=a.getFocus(),t=a.getSelection();await i(a);let o=a.getFocus();if(t.length>1||!eo(e,t)||eo(e,o))return;let n=new KeyboardEvent("keydown");a.setSelection(o,n)}async function tP(a,i){if(!a)return;await Itn(a,i);let e=a.getFocus();e.length&&a.reveal(e[0]),a.setAnchor(e[0]),qki(a)}xt.registerCommandAndKeybindingRule({id:"list.focusDown",weight:200,when:Nc,primary:18,mac:{primary:18,secondary:[300]},handler:(a,i)=>{tP(a.get(Co).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusNext(typeof i=="number"?i:1,!1,t)})}});xt.registerCommandAndKeybindingRule({id:"list.focusUp",weight:200,when:Nc,primary:16,mac:{primary:16,secondary:[302]},handler:(a,i)=>{tP(a.get(Co).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown");await e.focusPrevious(typeof i=="number"?i:1,!1,t)})}});xt.registerCommandAndKeybindingRule({id:"list.focusAnyDown",weight:200,when:Nc,primary:530,mac:{primary:530,secondary:[812]},handler:(a,i)=>{tP(a.get(Co).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusNext(typeof i=="number"?i:1,!1,t)})}});xt.registerCommandAndKeybindingRule({id:"list.focusAnyUp",weight:200,when:Nc,primary:528,mac:{primary:528,secondary:[814]},handler:(a,i)=>{tP(a.get(Co).lastFocusedList,async e=>{let t=new KeyboardEvent("keydown",{altKey:!0});await e.focusPrevious(typeof i=="number"?i:1,!1,t)})}});xt.registerCommandAndKeybindingRule({id:"list.focusPageDown",weight:200,when:Nc,primary:12,handler:a=>{tP(a.get(Co).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusNextPage(e)})}});xt.registerCommandAndKeybindingRule({id:"list.focusPageUp",weight:200,when:Nc,primary:11,handler:a=>{tP(a.get(Co).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusPreviousPage(e)})}});xt.registerCommandAndKeybindingRule({id:"list.focusFirst",weight:200,when:Nc,primary:14,handler:a=>{tP(a.get(Co).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusFirst(e)})}});xt.registerCommandAndKeybindingRule({id:"list.focusLast",weight:200,when:Nc,primary:13,handler:a=>{tP(a.get(Co).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown");await i.focusLast(e)})}});xt.registerCommandAndKeybindingRule({id:"list.focusAnyFirst",weight:200,when:Nc,primary:526,handler:a=>{tP(a.get(Co).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown",{altKey:!0});await i.focusFirst(e)})}});xt.registerCommandAndKeybindingRule({id:"list.focusAnyLast",weight:200,when:Nc,primary:525,handler:a=>{tP(a.get(Co).lastFocusedList,async i=>{let e=new KeyboardEvent("keydown",{altKey:!0});await i.focusLast(e)})}});function Vho(a,i){if(a instanceof Gc||a instanceof i2||a instanceof s0){let e=a,t=e.getFocus()?e.getFocus()[0]:void 0,o=e.getSelection();o&&typeof t=="number"&&o.indexOf(t)>=0?e.setSelection(o.filter(n=>n!==i)):typeof t=="number"&&e.setSelection(o.concat(t))}else if(a instanceof lC||a instanceof KT||a instanceof Zv){let e=a,t=e.getFocus()?e.getFocus()[0]:void 0;if(i===t)return;let o=e.getSelection(),n=new KeyboardEvent("keydown",{shiftKey:!0});o&&o.indexOf(t)>=0?e.setSelection(o.filter(r=>r!==i),n):e.setSelection(o.concat(t),n)}}function $ki(a,i){let e=a.getStickyScrollFocus();if(e.length===0)throw new Error("StickyScroll has no focus");if(e.length>1)throw new Error("StickyScroll can only have a single focused item");a.reveal(e[0]),a.getHTMLElement().focus(),a.setFocus(e),i?.(e[0])}xt.registerCommandAndKeybindingRule({id:"list.expandSelectionDown",weight:200,when:C.and(Nc,CJ),primary:1042,handler:(a,i)=>{let e=a.get(Co).lastFocusedList;if(!e)return;let t=e.getFocus()?e.getFocus()[0]:void 0,o=new KeyboardEvent("keydown");e.focusNext(typeof i=="number"?i:1,!1,o),Vho(e,t);let n=e.getFocus();n.length&&e.reveal(n[0]),qki(e)}});xt.registerCommandAndKeybindingRule({id:"list.expandSelectionUp",weight:200,when:C.and(Nc,CJ),primary:1040,handler:(a,i)=>{let e=a.get(Co).lastFocusedList;if(!e)return;let t=e.getFocus()?e.getFocus()[0]:void 0,o=new KeyboardEvent("keydown");e.focusPrevious(typeof i=="number"?i:1,!1,o),Vho(e,t);let n=e.getFocus();n.length&&e.reveal(n[0]),qki(e)}});xt.registerCommandAndKeybindingRule({id:"list.collapse",weight:200,when:C.and(Nc,C.or(NEe,$pi)),primary:15,mac:{primary:15,secondary:[2064]},handler:a=>{let i=a.get(Co).lastFocusedList;if(!i||!(i instanceof lC||i instanceof KT||i instanceof Zv))return;let e=i,t=e.getFocus();if(t.length===0)return;let o=t[0];if(!e.collapse(o)){let n=e.getParentElement(o);n&&tP(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([n],s)})}}});xt.registerCommandAndKeybindingRule({id:"list.stickyScroll.collapse",weight:250,when:AEe,primary:15,mac:{primary:15,secondary:[2064]},handler:a=>{let i=a.get(Co).lastFocusedList;!i||!(i instanceof lC||i instanceof KT||i instanceof Zv)||$ki(i,e=>i.collapse(e))}});xt.registerCommandAndKeybindingRule({id:"list.collapseAll",weight:200,when:Nc,primary:2063,mac:{primary:2063,secondary:[3088]},handler:a=>{let i=a.get(Co).lastFocusedList;i&&!(i instanceof Gc||i instanceof i2||i instanceof s0)&&i.collapseAll()}});xt.registerCommandAndKeybindingRule({id:"list.collapseAllToFocus",weight:200,when:Nc,handler:a=>{let i=a.get(Co).lastFocusedList,e=GT("keydown",!0);if(i instanceof lC||i instanceof KT||i instanceof Zv){let t=i,o=t.getFocus();o.length>0&&t.collapse(o[0],!0),t.setSelection(o,e),t.setAnchor(o[0])}}});xt.registerCommandAndKeybindingRule({id:"list.focusParent",weight:200,when:Nc,handler:a=>{let i=a.get(Co).lastFocusedList;if(!i||!(i instanceof lC||i instanceof KT||i instanceof Zv))return;let e=i,t=e.getFocus();if(t.length===0)return;let o=t[0],n=e.getParentElement(o);n&&tP(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([n],s)})}});xt.registerCommandAndKeybindingRule({id:"list.expand",weight:200,when:C.and(Nc,C.or(OEe,jpi)),primary:17,handler:a=>{let i=a.get(Co).lastFocusedList;if(i){if(i instanceof lC||i instanceof KT){let e=i.getFocus();if(e.length===0)return;let t=e[0];if(!i.expand(t)){let o=i.getFirstElementChild(t);o&&i.getNode(o).visible&&tP(i,r=>{let s=new KeyboardEvent("keydown");r.setFocus([o],s)})}}else if(i instanceof Zv){let e=i.getFocus();if(e.length===0)return;let t=e[0];i.expand(t).then(o=>{if(t&&!o){let n=i.getFirstElementChild(t);n&&i.getNode(n).visible&&tP(i,s=>{let l=new KeyboardEvent("keydown");s.setFocus([n],l)})}})}}}});function jki(a,i){let e=a.get(Co).lastFocusedList,t=GT("keydown",i);if(e instanceof Gc||e instanceof i2||e instanceof s0){let o=e;o.setAnchor(o.getFocus()[0]),o.setSelection(o.getFocus(),t)}else if(e instanceof lC||e instanceof KT||e instanceof Zv){let o=e,n=o.getFocus();if(n.length>0){let r=!0;(o.expandOnlyOnTwistieClick===!0||typeof o.expandOnlyOnTwistieClick!="boolean"&&o.expandOnlyOnTwistieClick(n[0]))&&(r=!1),r&&o.toggleCollapsed(n[0])}o.setAnchor(n[0]),o.setSelection(n,t)}}xt.registerCommandAndKeybindingRule({id:"list.select",weight:200,when:Nc,primary:3,mac:{primary:3,secondary:[2066]},handler:a=>{jki(a,!1)}});xt.registerCommandAndKeybindingRule({id:"list.stickyScrollselect",weight:250,when:AEe,primary:3,mac:{primary:3,secondary:[2066]},handler:a=>{let i=a.get(Co).lastFocusedList;!i||!(i instanceof lC||i instanceof KT||i instanceof Zv)||$ki(i,e=>i.setSelection([e]))}});xt.registerCommandAndKeybindingRule({id:"list.selectAndPreserveFocus",weight:200,when:Nc,handler:a=>{jki(a,!0)}});xt.registerCommandAndKeybindingRule({id:"list.selectAll",weight:200,when:C.and(Nc,CJ),primary:2079,handler:a=>{let i=a.get(Co).lastFocusedList;if(i instanceof Gc||i instanceof i2||i instanceof s0){let e=i,t=new KeyboardEvent("keydown");e.setSelection(tf(e.length),t)}else if(i instanceof lC||i instanceof KT||i instanceof Zv){let e=i,t=e.getFocus(),o=e.getSelection(),n;t.length>0&&(o.length===0||!o.includes(t[0]))&&(n=t[0]),!n&&o.length>0&&(n=o[0]);let r;n?r=e.getParentElement(n):r=void 0;let s=[],l=u=>{for(let p of u.children)p.visible&&(s.push(p.element),p.collapsed||l(p))};l(e.getNode(r)),r&&o.length===s.length&&s.unshift(r);let c=new KeyboardEvent("keydown");e.setSelection(s,c)}}});xt.registerCommandAndKeybindingRule({id:"list.toggleSelection",weight:200,when:Nc,primary:3075,handler:a=>{let i=a.get(Co).lastFocusedList;if(!i)return;let e=i.getFocus();if(e.length===0)return;let t=i.getSelection(),o=t.indexOf(e[0]);o>-1?i.setSelection([...t.slice(0,o),...t.slice(o+1)]):i.setSelection([...t,e[0]])}});xt.registerCommandAndKeybindingRule({id:"list.showHover",weight:200,primary:Gi(2089,2087),when:Nc,handler:async a=>{let e=a.get(Co).lastFocusedList;if(!e)return;let t=e.getFocus();if(!t||t.length===0)return;let s=e.getHTMLElement().querySelector(".monaco-scrollable-element")?.querySelector(".monaco-list-rows")?.querySelector(".focused");if(!s)return;let l=ytn(s);l&&a.get(ot).showManagedHover(l)}});function ytn(a){if(a.matches('[custom-hover="true"]'))return a;let i=a.querySelector('[custom-hover="true"]:not([tabindex]):not(.action-item)');if(i)return i}xt.registerCommandAndKeybindingRule({id:"list.toggleExpand",weight:200,when:Nc,primary:10,handler:a=>{let i=a.get(Co).lastFocusedList;if(i instanceof lC||i instanceof KT||i instanceof Zv){let e=i,t=e.getFocus();if(!e.options.disableExpandOnSpacebar&&t.length>0&&e.isCollapsible(t[0])){e.toggleCollapsed(t[0]);return}}jki(a,!0)}});xt.registerCommandAndKeybindingRule({id:"list.stickyScrolltoggleExpand",weight:250,when:AEe,primary:10,handler:a=>{let i=a.get(Co).lastFocusedList;!i||!(i instanceof lC||i instanceof KT||i instanceof Zv)||$ki(i)}});xt.registerCommandAndKeybindingRule({id:"list.clear",weight:200,when:C.and(Nc,_6e),primary:9,handler:a=>{let i=a.get(Co).lastFocusedList;if(!i)return;let e=i.getSelection(),t=new KeyboardEvent("keydown");if(e.length>1)if(lue.getValue(i.contextKeyService)){let n=i.getFocus();i.setSelection([n[0]],t)}else i.setSelection([],t);else i.setSelection([],t),i.setFocus([],t);i.setAnchor(void 0)}});Ge.registerCommand({id:"list.triggerTypeNavigation",handler:a=>{a.get(Co).lastFocusedList?.triggerTypeNavigation()}});Ge.registerCommand({id:"list.toggleFindMode",handler:a=>{let i=a.get(Co).lastFocusedList;if(i instanceof eH||i instanceof Zv){let e=i;e.findMode=e.findMode===1?0:1}}});Ge.registerCommand({id:"list.toggleFindMatchType",handler:a=>{let i=a.get(Co).lastFocusedList;if(i instanceof eH||i instanceof Zv){let e=i;e.findMatchType=e.findMatchType===1?0:1}}});Ge.registerCommandAlias("list.toggleKeyboardNavigation","list.triggerTypeNavigation");Ge.registerCommandAlias("list.toggleFilterOnType","list.toggleFindMode");xt.registerCommandAndKeybindingRule({id:"list.find",weight:200,when:C.and(T6e,qpi),primary:2596,secondary:[61],handler:a=>{let i=a.get(Co).lastFocusedList;i instanceof Gc||i instanceof i2||i instanceof s0||(i instanceof eH||i instanceof Zv)&&i.openFind()}});xt.registerCommandAndKeybindingRule({id:"list.closeFind",weight:200,when:C.and(T6e,Qpi),primary:9,handler:a=>{let i=a.get(Co).lastFocusedList;(i instanceof eH||i instanceof Zv)&&i.closeFind()}});xt.registerCommandAndKeybindingRule({id:"list.scrollUp",weight:200,when:C.and(Nc,ETt?.negate()),primary:2064,handler:a=>{let i=a.get(Co).lastFocusedList;i&&(i.scrollTop-=10)}});xt.registerCommandAndKeybindingRule({id:"list.scrollDown",weight:200,when:C.and(Nc,TTt?.negate()),primary:2066,handler:a=>{let i=a.get(Co).lastFocusedList;i&&(i.scrollTop+=10)}});xt.registerCommandAndKeybindingRule({id:"list.scrollLeft",weight:200,when:Nc,handler:a=>{let i=a.get(Co).lastFocusedList;i&&(i.scrollLeft-=10)}});xt.registerCommandAndKeybindingRule({id:"list.scrollRight",weight:200,when:Nc,handler:a=>{let i=a.get(Co).lastFocusedList;i&&(i.scrollLeft+=10)}});W(class extends z{constructor(){super({id:"tree.toggleStickyScroll",title:{...P(4326,"Toggle Tree Sticky Scroll"),mnemonicTitle:d(4325,null)},category:"View",metadata:{description:d(4327,null)},f1:!0})}run(i){let e=i.get(B),t=!e.getValue("workbench.tree.enableStickyScroll");e.updateValue("workbench.tree.enableStickyScroll",t)}});var wtn={separatorBorder:Ue.transparent};function ON(a){return a===0?1:0}var Qki=class{constructor(i){this.isLayoutEnabled=i}};function Ctn(a,i){return i===1?{left:a.start,right:a.end,top:a.orthogonalStart,bottom:a.orthogonalEnd}:{top:a.start,bottom:a.end,left:a.orthogonalStart,right:a.orthogonalEnd}}function xtn(a,i){return i===1?{start:a.left,end:a.right,orthogonalStart:a.top,orthogonalEnd:a.bottom}:{start:a.top,end:a.bottom,orthogonalStart:a.left,orthogonalEnd:a.right}}function pU(a,i){if(Math.abs(a)>i)throw new Error("Invalid index");return SB(a,i+1)}var dS=class a{constructor(i,e,t,o,n=0,r=0,s=!1,l){this.orientation=i;this.layoutController=e;this.splitviewProportionalLayout=o;this.children=[];this._absoluteOffset=0;this._absoluteOrthogonalOffset=0;this.absoluteOrthogonalSize=0;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._onDidVisibilityChange=new T;this.onDidVisibilityChange=this._onDidVisibilityChange.event;this.childrenVisibilityChangeDisposable=new O;this._onDidScroll=new T;this.onDidScrollDisposable=k.None;this.onDidScroll=this._onDidScroll.event;this.childrenChangeDisposable=k.None;this._onDidSashReset=new T;this.onDidSashReset=this._onDidSashReset.event;this.splitviewSashResetDisposable=k.None;this.childrenSashResetDisposable=k.None;this._boundarySashes={};this._edgeSnapping=!1;if(this._styles=t,this._size=n,this._orthogonalSize=r,this.element=_(".monaco-grid-branch-node"),!l)this.splitview=new Gp(this.element,{orientation:i,styles:t,proportionalLayout:o}),this.splitview.layout(n,{orthogonalSize:r,absoluteOffset:0,absoluteOrthogonalOffset:0,absoluteSize:n,absoluteOrthogonalSize:r});else{let u={views:l.map(h=>({view:h.node,size:h.node.size,visible:h.visible!==!1})),size:this.orthogonalSize},p={proportionalLayout:o,orientation:i,styles:t};this.children=l.map(h=>h.node),this.splitview=new Gp(this.element,{...p,descriptor:u}),this.children.forEach((h,g)=>{let f=g===0,v=g===this.children.length;h.boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:f?this.boundarySashes.start:this.splitview.sashes[g-1],orthogonalEnd:v?this.boundarySashes.end:this.splitview.sashes[g]}})}let c=U.map(this.splitview.onDidSashReset,u=>[u]);this.splitviewSashResetDisposable=c(this._onDidSashReset.fire,this._onDidSashReset),this.updateChildrenEvents()}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get absoluteOffset(){return this._absoluteOffset}get absoluteOrthogonalOffset(){return this._absoluteOrthogonalOffset}get styles(){return this._styles}get width(){return this.orientation===1?this.size:this.orthogonalSize}get height(){return this.orientation===1?this.orthogonalSize:this.size}get top(){return this.orientation===1?this._absoluteOffset:this._absoluteOrthogonalOffset}get left(){return this.orientation===1?this._absoluteOrthogonalOffset:this._absoluteOffset}get minimumSize(){return this.children.length===0?0:Math.max(...this.children.map((i,e)=>this.splitview.isViewVisible(e)?i.minimumOrthogonalSize:0))}get maximumSize(){return Math.min(...this.children.map((i,e)=>this.splitview.isViewVisible(e)?i.maximumOrthogonalSize:Number.POSITIVE_INFINITY))}get priority(){if(this.children.length===0)return 0;let i=this.children.map(e=>typeof e.priority>"u"?0:e.priority);return i.some(e=>e===2)?2:i.some(e=>e===1)?1:0}get proportionalLayout(){return this.children.length===0?!0:this.children.every(i=>i.proportionalLayout)}get minimumOrthogonalSize(){return this.splitview.minimumSize}get maximumOrthogonalSize(){return this.splitview.maximumSize}get minimumWidth(){return this.orientation===1?this.minimumOrthogonalSize:this.minimumSize}get minimumHeight(){return this.orientation===1?this.minimumSize:this.minimumOrthogonalSize}get maximumWidth(){return this.orientation===1?this.maximumOrthogonalSize:this.maximumSize}get maximumHeight(){return this.orientation===1?this.maximumSize:this.maximumOrthogonalSize}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){if(!(this._boundarySashes.start===i.start&&this._boundarySashes.end===i.end&&this._boundarySashes.orthogonalStart===i.orthogonalStart&&this._boundarySashes.orthogonalEnd===i.orthogonalEnd)){this._boundarySashes=i,this.splitview.orthogonalStartSash=i.orthogonalStart,this.splitview.orthogonalEndSash=i.orthogonalEnd;for(let e=0;e<this.children.length;e++){let t=this.children[e],o=e===0,n=e===this.children.length-1;t.boundarySashes={start:i.orthogonalStart,end:i.orthogonalEnd,orthogonalStart:o?i.start:t.boundarySashes.orthogonalStart,orthogonalEnd:n?i.end:t.boundarySashes.orthogonalEnd}}}}get edgeSnapping(){return this._edgeSnapping}set edgeSnapping(i){if(this._edgeSnapping!==i){this._edgeSnapping=i;for(let e of this.children)e instanceof a&&(e.edgeSnapping=i);this.updateSplitviewEdgeSnappingEnablement()}}style(i){this._styles=i,this.splitview.style(i);for(let e of this.children)e instanceof a&&e.style(i)}layout(i,e,t){if(this.layoutController.isLayoutEnabled){if(typeof t>"u")throw new Error("Invalid state");this._size=t.orthogonalSize,this._orthogonalSize=i,this._absoluteOffset=t.absoluteOffset+e,this._absoluteOrthogonalOffset=t.absoluteOrthogonalOffset,this.absoluteOrthogonalSize=t.absoluteOrthogonalSize,this.splitview.layout(t.orthogonalSize,{orthogonalSize:i,absoluteOffset:this._absoluteOrthogonalOffset,absoluteOrthogonalOffset:this._absoluteOffset,absoluteSize:t.absoluteOrthogonalSize,absoluteOrthogonalSize:t.absoluteSize}),this.updateSplitviewEdgeSnappingEnablement()}}setVisible(i){for(let e of this.children)e.setVisible(i)}addChild(i,e,t,o){t=pU(t,this.children.length),this.splitview.addView(i,e,t,o),this.children.splice(t,0,i),this.updateBoundarySashes(),this.onDidChildrenChange()}removeChild(i,e){i=pU(i,this.children.length);let t=this.splitview.removeView(i,e);return this.children.splice(i,1),this.updateBoundarySashes(),this.onDidChildrenChange(),t}removeAllChildren(){let i=this.splitview.removeAllViews();return this.children.splice(0,this.children.length),this.updateBoundarySashes(),this.onDidChildrenChange(),i}moveChild(i,e){i=pU(i,this.children.length),e=pU(e,this.children.length),i!==e&&(i<e&&(e-=1),this.splitview.moveView(i,e),this.children.splice(e,0,this.children.splice(i,1)[0]),this.updateBoundarySashes(),this.onDidChildrenChange())}swapChildren(i,e){i=pU(i,this.children.length),e=pU(e,this.children.length),i!==e&&(this.splitview.swapViews(i,e),[this.children[i].boundarySashes,this.children[e].boundarySashes]=[this.children[i].boundarySashes,this.children[e].boundarySashes],[this.children[i],this.children[e]]=[this.children[e],this.children[i]],this.onDidChildrenChange())}resizeChild(i,e){i=pU(i,this.children.length),this.splitview.resizeView(i,e)}isChildExpanded(i){return this.splitview.isViewExpanded(i)}distributeViewSizes(i=!1){if(this.splitview.distributeViewSizes(),i)for(let e of this.children)e instanceof a&&e.distributeViewSizes(!0)}getChildSize(i){return i=pU(i,this.children.length),this.splitview.getViewSize(i)}isChildVisible(i){return i=pU(i,this.children.length),this.splitview.isViewVisible(i)}setChildVisible(i,e){if(i=pU(i,this.children.length),this.splitview.isViewVisible(i)===e)return;let t=this.splitview.contentSize===0;this.splitview.setViewVisible(i,e);let o=this.splitview.contentSize===0;(e&&t||!e&&o)&&this._onDidVisibilityChange.fire(e)}getChildCachedVisibleSize(i){return i=pU(i,this.children.length),this.splitview.getViewCachedVisibleSize(i)}updateBoundarySashes(){for(let i=0;i<this.children.length;i++)this.children[i].boundarySashes={start:this.boundarySashes.orthogonalStart,end:this.boundarySashes.orthogonalEnd,orthogonalStart:i===0?this.boundarySashes.start:this.splitview.sashes[i-1],orthogonalEnd:i===this.children.length-1?this.boundarySashes.end:this.splitview.sashes[i]}}onDidChildrenChange(){this.updateChildrenEvents(),this._onDidChange.fire(void 0)}updateChildrenEvents(){let i=U.map(U.any(...this.children.map(o=>o.onDidChange)),()=>{});this.childrenChangeDisposable.dispose(),this.childrenChangeDisposable=i(this._onDidChange.fire,this._onDidChange);let e=U.any(...this.children.map((o,n)=>U.map(o.onDidSashReset,r=>[n,...r])));this.childrenSashResetDisposable.dispose(),this.childrenSashResetDisposable=e(this._onDidSashReset.fire,this._onDidSashReset);let t=U.any(U.signal(this.splitview.onDidScroll),...this.children.map(o=>o.onDidScroll));this.onDidScrollDisposable.dispose(),this.onDidScrollDisposable=t(this._onDidScroll.fire,this._onDidScroll),this.childrenVisibilityChangeDisposable.clear(),this.children.forEach((o,n)=>{o instanceof a&&this.childrenVisibilityChangeDisposable.add(o.onDidVisibilityChange(r=>{this.setChildVisible(n,r)}))})}trySet2x2(i){if(this.children.length!==2||i.children.length!==2)return k.None;if(this.getChildSize(0)!==i.getChildSize(0))return k.None;let[e,t]=this.children,[o,n]=i.children;if(!(e instanceof uS)||!(t instanceof uS))return k.None;if(!(o instanceof uS)||!(n instanceof uS))return k.None;this.orientation===0?(t.linkedWidthNode=o.linkedHeightNode=e,e.linkedWidthNode=n.linkedHeightNode=t,n.linkedWidthNode=e.linkedHeightNode=o,o.linkedWidthNode=t.linkedHeightNode=n):(o.linkedWidthNode=t.linkedHeightNode=e,n.linkedWidthNode=e.linkedHeightNode=t,e.linkedWidthNode=n.linkedHeightNode=o,t.linkedWidthNode=o.linkedHeightNode=n);let r=this.splitview.sashes[0],s=i.splitview.sashes[0];return r.linkedSash=s,s.linkedSash=r,this._onDidChange.fire(void 0),i._onDidChange.fire(void 0),ee(()=>{r.linkedSash=s.linkedSash=void 0,e.linkedHeightNode=e.linkedWidthNode=void 0,t.linkedHeightNode=t.linkedWidthNode=void 0,o.linkedHeightNode=o.linkedWidthNode=void 0,n.linkedHeightNode=n.linkedWidthNode=void 0})}updateSplitviewEdgeSnappingEnablement(){this.splitview.startSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset>0,this.splitview.endSnappingEnabled=this._edgeSnapping||this._absoluteOrthogonalOffset+this._size<this.absoluteOrthogonalSize}dispose(){for(let i of this.children)i.dispose();this._onDidChange.dispose(),this._onDidScroll.dispose(),this._onDidSashReset.dispose(),this._onDidVisibilityChange.dispose(),this.childrenVisibilityChangeDisposable.dispose(),this.splitviewSashResetDisposable.dispose(),this.childrenSashResetDisposable.dispose(),this.childrenChangeDisposable.dispose(),this.onDidScrollDisposable.dispose(),this.splitview.dispose()}};function ktn(a){let[i,e]=U.split(a.onDidChange,bn);return U.any(e,U.map(U.latch(U.map(i,t=>[a.minimumWidth,a.maximumWidth,a.minimumHeight,a.maximumHeight]),eo),t=>{}))}var uS=class{constructor(i,e,t,o,n=0){this.view=i;this.orientation=e;this.layoutController=t;this._size=0;this.absoluteOffset=0;this.absoluteOrthogonalOffset=0;this.onDidScroll=U.None;this.onDidSashReset=U.None;this._onDidLinkedWidthNodeChange=new Ig;this._linkedWidthNode=void 0;this._onDidLinkedHeightNodeChange=new Ig;this._linkedHeightNode=void 0;this._onDidSetLinkedNode=new T;this.disposables=new O;this._boundarySashes={};this.cachedWidth=0;this.cachedHeight=0;this.cachedTop=0;this.cachedLeft=0;this._orthogonalSize=o,this._size=n;let r=ktn(i);this._onDidViewChange=U.map(r,s=>s&&(this.orientation===0?s.width:s.height),this.disposables),this.onDidChange=U.any(this._onDidViewChange,this._onDidSetLinkedNode.event,this._onDidLinkedWidthNodeChange.event,this._onDidLinkedHeightNodeChange.event)}get size(){return this._size}get orthogonalSize(){return this._orthogonalSize}get linkedWidthNode(){return this._linkedWidthNode}set linkedWidthNode(i){this._onDidLinkedWidthNodeChange.input=i?i._onDidViewChange:U.None,this._linkedWidthNode=i,this._onDidSetLinkedNode.fire(void 0)}get linkedHeightNode(){return this._linkedHeightNode}set linkedHeightNode(i){this._onDidLinkedHeightNodeChange.input=i?i._onDidViewChange:U.None,this._linkedHeightNode=i,this._onDidSetLinkedNode.fire(void 0)}get width(){return this.orientation===1?this.orthogonalSize:this.size}get height(){return this.orientation===1?this.size:this.orthogonalSize}get top(){return this.orientation===1?this.absoluteOffset:this.absoluteOrthogonalOffset}get left(){return this.orientation===1?this.absoluteOrthogonalOffset:this.absoluteOffset}get element(){return this.view.element}get minimumWidth(){return this.linkedWidthNode?Math.max(this.linkedWidthNode.view.minimumWidth,this.view.minimumWidth):this.view.minimumWidth}get maximumWidth(){return this.linkedWidthNode?Math.min(this.linkedWidthNode.view.maximumWidth,this.view.maximumWidth):this.view.maximumWidth}get minimumHeight(){return this.linkedHeightNode?Math.max(this.linkedHeightNode.view.minimumHeight,this.view.minimumHeight):this.view.minimumHeight}get maximumHeight(){return this.linkedHeightNode?Math.min(this.linkedHeightNode.view.maximumHeight,this.view.maximumHeight):this.view.maximumHeight}get minimumSize(){return this.orientation===1?this.minimumHeight:this.minimumWidth}get maximumSize(){return this.orientation===1?this.maximumHeight:this.maximumWidth}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return this.view.snap}get minimumOrthogonalSize(){return this.orientation===1?this.minimumWidth:this.minimumHeight}get maximumOrthogonalSize(){return this.orientation===1?this.maximumWidth:this.maximumHeight}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.view.setBoundarySashes?.(Ctn(i,this.orientation))}layout(i,e,t){if(this.layoutController.isLayoutEnabled){if(typeof t>"u")throw new Error("Invalid state");this._size=i,this._orthogonalSize=t.orthogonalSize,this.absoluteOffset=t.absoluteOffset+e,this.absoluteOrthogonalOffset=t.absoluteOrthogonalOffset,this._layout(this.width,this.height,this.top,this.left)}}_layout(i,e,t,o){this.cachedWidth===i&&this.cachedHeight===e&&this.cachedTop===t&&this.cachedLeft===o||(this.cachedWidth=i,this.cachedHeight=e,this.cachedTop=t,this.cachedLeft=o,this.view.layout(i,e,t,o))}setVisible(i){this.view.setVisible?.(i)}dispose(){this._onDidSetLinkedNode.dispose(),this.disposables.dispose()}};function Bho(a,i,e){if(a instanceof dS){let t=new dS(ON(a.orientation),a.layoutController,a.styles,a.splitviewProportionalLayout,i,e,a.edgeSnapping),o=0;for(let n=a.children.length-1;n>=0;n--){let r=a.children[n],s=r instanceof dS?r.orthogonalSize:r.size,l=a.size===0?0:Math.round(i*s/a.size);o+=l,n===0&&(l+=i-o),t.addChild(Bho(r,e,l),l,0,!0)}return a.dispose(),t}else{let t=new uS(a.view,ON(a.orientation),a.layoutController,e);return a.dispose(),t}}var bhe=class a{constructor(i={}){this.onDidSashResetRelay=new Ig;this._onDidScroll=new Ig;this._onDidChange=new Ig;this._boundarySashes={};this.disposable2x2=k.None;this.onDidSashReset=this.onDidSashResetRelay.event;this.onDidScroll=this._onDidScroll.event;this.onDidChange=this._onDidChange.event;this.maximizedNode=void 0;this._onDidChangeViewMaximized=new T;this.onDidChangeViewMaximized=this._onDidChangeViewMaximized.event;this.element=_(".monaco-grid-view"),this.styles=i.styles||wtn,this.proportionalLayout=typeof i.proportionalLayout<"u"?!!i.proportionalLayout:!0,this.layoutController=new Qki(!1),this.root=new dS(0,this.layoutController,this.styles,this.proportionalLayout)}get root(){return this._root}set root(i){let e=this._root;e&&(e.element.remove(),e.dispose()),this._root=i,this.element.appendChild(i.element),this.onDidSashResetRelay.input=i.onDidSashReset,this._onDidChange.input=U.map(i.onDidChange,()=>{}),this._onDidScroll.input=i.onDidScroll}get width(){return this.root.width}get height(){return this.root.height}get minimumWidth(){return this.root.minimumWidth}get minimumHeight(){return this.root.minimumHeight}get maximumWidth(){return this.root.maximumHeight}get maximumHeight(){return this.root.maximumHeight}get orientation(){return this._root.orientation}get boundarySashes(){return this._boundarySashes}set orientation(i){if(this._root.orientation===i)return;let{size:e,orthogonalSize:t,absoluteOffset:o,absoluteOrthogonalOffset:n}=this._root;this.root=Bho(this._root,t,e),this.root.layout(e,0,{orthogonalSize:t,absoluteOffset:n,absoluteOrthogonalOffset:o,absoluteSize:e,absoluteOrthogonalSize:t}),this.boundarySashes=this.boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.root.boundarySashes=xtn(i,this.orientation)}set edgeSnapping(i){this.root.edgeSnapping=i}style(i){this.styles=i,this.root.style(i)}layout(i,e,t=0,o=0){this.layoutController.isLayoutEnabled=!0;let[n,r,s,l]=this.root.orientation===1?[e,i,t,o]:[i,e,o,t];this.root.layout(n,0,{orthogonalSize:r,absoluteOffset:s,absoluteOrthogonalOffset:l,absoluteSize:n,absoluteOrthogonalSize:r})}addView(i,e,t){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=k.None;let[o,n]=Rf(t),[r,s]=this.getNode(o);if(s instanceof dS){let l=new uS(i,ON(s.orientation),this.layoutController,s.orthogonalSize);try{s.addChild(l,e,n)}catch(c){throw l.dispose(),c}}else{let[,l]=Rf(r),[,c]=Rf(o),u=0,p=l.getChildCachedVisibleSize(c);typeof p=="number"&&(u=Ac.Invisible(p)),l.removeChild(c).dispose();let g=new dS(s.orientation,s.layoutController,this.styles,this.proportionalLayout,s.size,s.orthogonalSize,l.edgeSnapping);l.addChild(g,s.size,c);let f=new uS(s.view,l.orientation,this.layoutController,s.size);g.addChild(f,u,0),typeof e!="number"&&e.type==="split"&&(e=Ac.Split(0));let v=new uS(i,l.orientation,this.layoutController,s.size);g.addChild(v,e,n)}this.trySet2x2()}removeView(i,e){this.hasMaximizedView()&&this.exitMaximizedView(),this.disposable2x2.dispose(),this.disposable2x2=k.None;let[t,o]=Rf(i),[n,r]=this.getNode(t);if(!(r instanceof dS))throw new Error("Invalid location");let s=r.children[o];if(!(s instanceof uS))throw new Error("Invalid location");if(r.removeChild(o,e),s.dispose(),r.children.length===0)throw new Error("Invalid grid state");if(r.children.length>1)return this.trySet2x2(),s.view;if(n.length===0){let g=r.children[0];return g instanceof uS||(r.removeChild(0),r.dispose(),this.root=g,this.boundarySashes=this.boundarySashes,this.trySet2x2()),s.view}let[,l]=Rf(n),[,c]=Rf(t),u=r.isChildVisible(0),p=r.removeChild(0),h=l.children.map((g,f)=>l.getChildSize(f));if(l.removeChild(c,e),r.dispose(),p instanceof dS){h.splice(c,1,...p.children.map(f=>f.size));let g=p.removeAllChildren();for(let f=0;f<g.length;f++)l.addChild(g[f],g[f].size,c+f)}else{let g=new uS(p.view,ON(p.orientation),this.layoutController,p.size),f=u?p.orthogonalSize:Ac.Invisible(p.orthogonalSize);l.addChild(g,f,c)}p.dispose();for(let g=0;g<h.length;g++)l.resizeChild(g,h[g]);return this.trySet2x2(),s.view}moveView(i,e,t){this.hasMaximizedView()&&this.exitMaximizedView();let[,o]=this.getNode(i);if(!(o instanceof dS))throw new Error("Invalid location");o.moveChild(e,t),this.trySet2x2()}swapViews(i,e){this.hasMaximizedView()&&this.exitMaximizedView();let[t,o]=Rf(i),[,n]=this.getNode(t);if(!(n instanceof dS))throw new Error("Invalid from location");let r=n.getChildSize(o),s=n.children[o];if(!(s instanceof uS))throw new Error("Invalid from location");let[l,c]=Rf(e),[,u]=this.getNode(l);if(!(u instanceof dS))throw new Error("Invalid to location");let p=u.getChildSize(c),h=u.children[c];if(!(h instanceof uS))throw new Error("Invalid to location");n===u?n.swapChildren(o,c):(n.removeChild(o),u.removeChild(c),n.addChild(h,r,o),u.addChild(s,p,c)),this.trySet2x2()}resizeView(i,e){this.hasMaximizedView()&&this.exitMaximizedView();let[t,o]=Rf(i),[n,r]=this.getNode(t);if(!(r instanceof dS))throw new Error("Invalid location");if(!e.width&&!e.height)return;let[s,l]=r.orientation===1?[e.width,e.height]:[e.height,e.width];if(typeof l=="number"&&n.length>0){let[,c]=Rf(n),[,u]=Rf(t);c.resizeChild(u,l)}typeof s=="number"&&r.resizeChild(o,s),this.trySet2x2()}getViewSize(i){if(!i)return{width:this.root.width,height:this.root.height};let[,e]=this.getNode(i);return{width:e.width,height:e.height}}getViewCachedVisibleSize(i){let[e,t]=Rf(i),[,o]=this.getNode(e);if(!(o instanceof dS))throw new Error("Invalid location");return o.getChildCachedVisibleSize(t)}expandView(i){this.hasMaximizedView()&&this.exitMaximizedView();let[e,t]=this.getNode(i);if(!(t instanceof uS))throw new Error("Invalid location");for(let o=0;o<e.length;o++)e[o].resizeChild(i[o],Number.POSITIVE_INFINITY)}isViewExpanded(i){if(this.hasMaximizedView())return!1;let[e,t]=this.getNode(i);if(!(t instanceof uS))throw new Error("Invalid location");for(let o=0;o<e.length;o++)if(!e[o].isChildExpanded(i[o]))return!1;return!0}maximizeView(i,e=[]){let[,t]=this.getNode(i);if(!(t instanceof uS))throw new Error("Location is not a LeafNode");if(this.maximizedNode===t)return;this.hasMaximizedView()&&this.exitMaximizedView();let o=new Set(e);function n(r,s){for(let l=0;l<r.children.length;l++){let c=r.children[l];c instanceof uS?c!==s&&!o.has(c.view)&&r.setChildVisible(l,!1):n(c,s)}}n(this.root,t),this.maximizedNode=t,this._onDidChangeViewMaximized.fire(!0)}exitMaximizedView(){if(!this.maximizedNode)return;this.maximizedNode=void 0;function i(e){for(let t=e.children.length-1;t>=0;t--){let o=e.children[t];o instanceof uS?e.setChildVisible(t,!0):i(o)}}i(this.root),this._onDidChangeViewMaximized.fire(!1)}hasMaximizedView(){return this.maximizedNode!==void 0}isViewMaximized(i){let[,e]=this.getNode(i);if(!(e instanceof uS))throw new Error("Location is not a LeafNode");return e===this.maximizedNode}distributeViewSizes(i){if(this.hasMaximizedView()&&this.exitMaximizedView(),!i){this.root.distributeViewSizes(!0);return}let[,e]=this.getNode(i);if(!(e instanceof dS))throw new Error("Invalid location");e.distributeViewSizes(),this.trySet2x2()}isViewVisible(i){let[e,t]=Rf(i),[,o]=this.getNode(e);if(!(o instanceof dS))throw new Error("Invalid from location");return o.isChildVisible(t)}setViewVisible(i,e){if(this.hasMaximizedView()){this.exitMaximizedView();return}let[t,o]=Rf(i),[,n]=this.getNode(t);if(!(n instanceof dS))throw new Error("Invalid from location");n.setChildVisible(o,e)}getView(i){let e=i?this.getNode(i)[1]:this._root;return this._getViews(e,this.orientation)}static deserialize(i,e,t={}){if(typeof i.orientation!="number")throw new Error("Invalid JSON: 'orientation' property must be a number.");if(typeof i.width!="number")throw new Error("Invalid JSON: 'width' property must be a number.");if(typeof i.height!="number")throw new Error("Invalid JSON: 'height' property must be a number.");if(i.root?.type!=="branch")throw new Error("Invalid JSON: 'root' property must have 'type' value of branch.");let o=i.orientation,n=i.height,r=new a(t);return r._deserialize(i.root,o,e,n),r}_deserialize(i,e,t,o){this.root=this._deserializeNode(i,e,t,o)}_deserializeNode(i,e,t,o){let n;if(i.type==="branch"){let s=i.data.map(l=>({node:this._deserializeNode(l,ON(e),t,i.size),visible:l.visible}));n=new dS(e,this.layoutController,this.styles,this.proportionalLayout,i.size,o,void 0,s)}else n=new uS(t.fromJSON(i.data),e,this.layoutController,o,i.size),i.maximized&&!this.maximizedNode&&(this.maximizedNode=n,this._onDidChangeViewMaximized.fire(!0));return n}_getViews(i,e,t){let o={top:i.top,left:i.left,width:i.width,height:i.height};if(i instanceof uS)return{view:i.view,box:o,cachedVisibleSize:t,maximized:this.maximizedNode===i};let n=[];for(let r=0;r<i.children.length;r++){let s=i.children[r],l=i.getChildCachedVisibleSize(r);n.push(this._getViews(s,ON(e),l))}return{children:n,box:o}}getNode(i,e=this.root,t=[]){if(i.length===0)return[t,e];if(!(e instanceof dS))throw new Error("Invalid location");let[o,...n]=i;if(o<0||o>=e.children.length)throw new Error("Invalid location");let r=e.children[o];return t.push(e),this.getNode(n,r,t)}trySet2x2(){if(this.disposable2x2.dispose(),this.disposable2x2=k.None,this.root.children.length!==2)return;let[i,e]=this.root.children;!(i instanceof dS)||!(e instanceof dS)||(this.disposable2x2=i.trySet2x2(e))}getViewMap(i,e){e||(e=this.root),e instanceof dS?e.children.forEach(t=>this.getViewMap(i,t)):i.set(e.view,e.element)}dispose(){this._onDidChangeViewMaximized.dispose(),this.onDidSashResetRelay.dispose(),this.root.dispose(),this.element.remove()}};function Etn(a){switch(a){case 0:return 1;case 1:return 0;case 2:return 3;case 3:return 2}}function vte(a){return!!a.children}function Uho(a,i){if(i.length===0)return a;if(!vte(a))throw new Error("Invalid location");let[e,...t]=i;return Uho(a.children[e],t)}function Ttn(a,i){return!(a.start>=i.end||i.start>=a.end)}function zho(a,i){let e=Jki(i),t=i===0?a.top:i===3?a.left+a.width:i===1?a.top+a.height:a.left,o={start:e===1?a.top:a.left,end:e===1?a.top+a.height:a.left+a.width};return{offset:t,range:o}}function _tn(a,i,e){let t=[];function o(n,r,s){if(vte(n))for(let l of n.children)o(l,r,s);else{let{offset:l,range:c}=zho(n.box,r);l===s.offset&&Ttn(c,s.range)&&t.push(n)}}return o(a,i,e),t}function Yki(a,i){return i.length%2===0?ON(a):a}function Jki(a){return a===0||a===1?0:1}function Hho(a,i,e){let t=Yki(a,i),o=Jki(e);if(t===o){let[n,r]=Rf(i);return(e===3||e===1)&&(r+=1),[...n,r]}else{let n=e===3||e===1?1:0;return[...i,n]}}function Dtn(a){let i=a.parentElement;if(!i)throw new Error("Invalid grid element");let e=i.firstElementChild,t=0;for(;e!==a&&e!==i.lastElementChild&&e;)e=e.nextElementSibling,t++;return t}function Kho(a){let i=a.parentElement;if(!i)throw new Error("Invalid grid element");if(/\bmonaco-grid-view\b/.test(i.className))return[];let e=Dtn(i),t=i.parentElement.parentElement.parentElement.parentElement;return[...Kho(t),e]}var IW;(o=>{o.Distribute={type:"distribute"},o.Split={type:"split"},o.Auto={type:"auto"};function t(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=t})(IW||={});var Xki=class extends k{constructor(e,t={}){super();this.views=new Map;this.didLayout=!1;e instanceof bhe?(this.gridview=e,this.gridview.getViewMap(this.views)):this.gridview=new bhe(t),this._register(this.gridview),this._register(this.gridview.onDidSashReset(this.onDidSashReset,this)),e instanceof bhe||this._addView(e,0,[0]),this.onDidChange=this.gridview.onDidChange,this.onDidScroll=this.gridview.onDidScroll,this.onDidChangeViewMaximized=this.gridview.onDidChangeViewMaximized}get orientation(){return this.gridview.orientation}set orientation(e){this.gridview.orientation=e}get width(){return this.gridview.width}get height(){return this.gridview.height}get minimumWidth(){return this.gridview.minimumWidth}get minimumHeight(){return this.gridview.minimumHeight}get maximumWidth(){return this.gridview.maximumWidth}get maximumHeight(){return this.gridview.maximumHeight}get boundarySashes(){return this.gridview.boundarySashes}set boundarySashes(e){this.gridview.boundarySashes=e}set edgeSnapping(e){this.gridview.edgeSnapping=e}get element(){return this.gridview.element}style(e){this.gridview.style(e)}layout(e,t,o=0,n=0){this.gridview.layout(e,t,o,n),this.didLayout=!0}addView(e,t,o,n){if(this.views.has(e))throw new Error("Can't add same view twice");let r=Jki(n);this.views.size===1&&this.orientation!==r&&(this.orientation=r);let s=this.getViewLocation(o),l=Hho(this.gridview.orientation,s,n),c;if(typeof t=="number")c=t;else if(t.type==="split"){let[,u]=Rf(s);c=Ac.Split(u)}else if(t.type==="distribute")c=Ac.Distribute;else if(t.type==="auto"){let[,u]=Rf(s);c=Ac.Auto(u)}else c=t;this._addView(e,c,l)}addViewAt(e,t,o){if(this.views.has(e))throw new Error("Can't add same view twice");let n;typeof t=="number"?n=t:t.type==="distribute"?n=Ac.Distribute:n=t,this._addView(e,n,o)}_addView(e,t,o){this.views.set(e,e.element),this.gridview.addView(e,t,o)}removeView(e,t){if(this.views.size===1)throw new Error("Can't remove last view");let o=this.getViewLocation(e),n;if(t?.type==="distribute")n=Ac.Distribute;else if(t?.type==="auto"){let r=o[o.length-1];n=Ac.Auto(r===0?1:r-1)}this.gridview.removeView(o,n),this.views.delete(e)}moveView(e,t,o,n){let r=this.getViewLocation(e),[s,l]=Rf(r),c=this.getViewLocation(o),u=Hho(this.gridview.orientation,c,n),[p,h]=Rf(u);eo(s,p)?this.gridview.moveView(s,l,h):(this.removeView(e,typeof t=="number"?void 0:t),this.addView(e,t,o,n))}moveViewTo(e,t){let o=this.getViewLocation(e),[n,r]=Rf(o),[s,l]=Rf(t);if(eo(n,s))this.gridview.moveView(n,r,l);else{let c=this.getViewSize(e),u=Yki(this.gridview.orientation,o),p=this.getViewCachedVisibleSize(e),h=typeof p>"u"?u===1?c.width:c.height:IW.Invisible(p);this.removeView(e),this.addViewAt(e,h,t)}}swapViews(e,t){let o=this.getViewLocation(e),n=this.getViewLocation(t);return this.gridview.swapViews(o,n)}resizeView(e,t){let o=this.getViewLocation(e);return this.gridview.resizeView(o,t)}isViewExpanded(e){let t=this.getViewLocation(e);return this.gridview.isViewExpanded(t)}isViewMaximized(e){let t=this.getViewLocation(e);return this.gridview.isViewMaximized(t)}hasMaximizedView(){return this.gridview.hasMaximizedView()}getViewSize(e){if(!e)return this.gridview.getViewSize();let t=this.getViewLocation(e);return this.gridview.getViewSize(t)}getViewCachedVisibleSize(e){let t=this.getViewLocation(e);return this.gridview.getViewCachedVisibleSize(t)}maximizeView(e,t=[]){if(this.views.size<2)throw new Error("At least two views are required to maximize a view");let o=this.getViewLocation(e);this.gridview.maximizeView(o,t)}exitMaximizedView(){this.gridview.exitMaximizedView()}expandView(e){let t=this.getViewLocation(e);this.gridview.expandView(t)}distributeViewSizes(){this.gridview.distributeViewSizes()}isViewVisible(e){let t=this.getViewLocation(e);return this.gridview.isViewVisible(t)}setViewVisible(e,t){let o=this.getViewLocation(e);this.gridview.setViewVisible(o,t)}getViews(){return this.gridview.getView()}getNeighborViews(e,t,o=!1){if(!this.didLayout)throw new Error("Can't call getNeighborViews before first layout");let n=this.getViewLocation(e),r=this.getViews(),s=Uho(r,n),l=zho(s.box,t);return o&&(t===0&&s.box.top===0?l={offset:r.box.top+r.box.height,range:l.range}:t===3&&s.box.left+s.box.width===r.box.width?l={offset:0,range:l.range}:t===1&&s.box.top+s.box.height===r.box.height?l={offset:0,range:l.range}:t===2&&s.box.left===0&&(l={offset:r.box.left+r.box.width,range:l.range})),_tn(r,Etn(t),l).map(c=>c.view)}getViewLocation(e){let t=this.views.get(e);if(!t)throw new Error("View not found");return Kho(t)}onDidSashReset(e){let t=r=>{let s=this.gridview.getView(r);if(vte(s))return!1;let l=Yki(this.orientation,r),c=l===1?s.view.preferredWidth:s.view.preferredHeight;if(typeof c!="number")return!1;let u=l===1?{width:Math.round(c)}:{height:Math.round(c)};return this.gridview.resizeView(r,u),!0};if(t(e))return;let[o,n]=Rf(e);t([...o,n+1])||this.gridview.distributeViewSizes(o)}},P8=class a extends Xki{constructor(){super(...arguments);this.initialLayoutContext=!0}static serializeNode(e,t){let o=t===0?e.box.width:e.box.height;if(!vte(e)){let r={type:"leaf",data:e.view.toJSON(),size:o};return typeof e.cachedVisibleSize=="number"?(r.size=e.cachedVisibleSize,r.visible=!1):e.maximized&&(r.maximized=!0),r}let n=e.children.map(r=>a.serializeNode(r,ON(t)));return n.some(r=>r.visible!==!1)?{type:"branch",data:n,size:o}:{type:"branch",data:n,size:o,visible:!1}}static deserialize(e,t,o={}){if(typeof e.orientation!="number")throw new Error("Invalid JSON: 'orientation' property must be a number.");if(typeof e.width!="number")throw new Error("Invalid JSON: 'width' property must be a number.");if(typeof e.height!="number")throw new Error("Invalid JSON: 'height' property must be a number.");let n=bhe.deserialize(e,t,o);return new a(n,o)}static from(e,t={}){return a.deserialize(Zki(e),{fromJSON:o=>o},t)}serialize(){return{root:a.serializeNode(this.getViews(),this.orientation),orientation:this.orientation,width:this.width,height:this.height}}layout(e,t,o=0,n=0){super.layout(e,t,o,n),this.initialLayoutContext&&(this.initialLayoutContext=!1,this.gridview.trySet2x2())}};function Gho(a){return!!a.groups}function qho(a,i){if(!i&&a.groups&&a.groups.length<=1&&(a.groups=void 0),!Gho(a))return;let e=0,t=0;for(let s of a.groups)qho(s,!1),s.size&&(e+=s.size,t++);let o=t>0?e:1,n=a.groups.length-t,r=o/n;for(let s of a.groups)s.size||(s.size=r)}function $ho(a){return Gho(a)?{type:"branch",data:a.groups.map(i=>$ho(i)),size:a.size}:{type:"leaf",data:a.data,size:a.size}}function jho(a,i){if(a.type==="branch"){let e=a.data.map(t=>jho(t,ON(i)));if(i===0){let t=a.size||(e.length===0?void 0:Math.max(...e.map(n=>n.width||0))),o=e.length===0?void 0:e.reduce((n,r)=>n+(r.height||0),0);return{width:t,height:o}}else{let t=e.length===0?void 0:e.reduce((n,r)=>n+(r.width||0),0),o=a.size||(e.length===0?void 0:Math.max(...e.map(n=>n.height||0)));return{width:t,height:o}}}else{let e=i===0?a.size:void 0,t=i===0?void 0:a.size;return{width:e,height:t}}}function Zki(a){qho(a,!0);let i=$ho(a),{width:e,height:t}=jho(i,a.orientation);return{root:i,orientation:a.orientation,width:e||1,height:t||1}}var LMe=class extends z{constructor(e,t){super(e);this.direction=t}run(e){let t=e.get(wi),o=e.get(kt),n=e.get(Es),r=t.hasFocus("workbench.parts.editor"),s=t.hasFocus("workbench.parts.panel"),l=t.hasFocus("workbench.parts.sidebar"),c=t.hasFocus("workbench.parts.auxiliarybar"),u;if(r){if(this.navigateAcrossEditorGroup(this.toGroupDirection(this.direction),o))return;u=t.getVisibleNeighborPart("workbench.parts.editor",this.direction)}s&&(u=t.getVisibleNeighborPart("workbench.parts.panel",this.direction)),l&&(u=t.getVisibleNeighborPart("workbench.parts.sidebar",this.direction)),c&&(u=u=t.getVisibleNeighborPart("workbench.parts.auxiliarybar",this.direction)),u==="workbench.parts.editor"?this.navigateBackToEditorGroup(this.toGroupDirection(this.direction),o)||this.navigateToEditorGroup(this.direction===3?0:1,o):u==="workbench.parts.sidebar"?this.navigateToSidebar(t,n):u==="workbench.parts.panel"?this.navigateToPanel(t,n):u==="workbench.parts.auxiliarybar"&&this.navigateToAuxiliaryBar(t,n)}async navigateToPanel(e,t){if(!e.isVisible("workbench.parts.panel"))return!1;let o=t.getActivePaneComposite(1);if(!o)return!1;let n=o.getId(),r=await t.openPaneComposite(n,1,!0);return r||!1}async navigateToSidebar(e,t){if(!e.isVisible("workbench.parts.sidebar"))return!1;let o=t.getActivePaneComposite(0);if(!o)return!1;let n=o.getId();return!!await t.openPaneComposite(n,0,!0)}async navigateToAuxiliaryBar(e,t){if(!e.isVisible("workbench.parts.auxiliarybar"))return!1;let o=t.getActivePaneComposite(2);if(!o)return!1;let n=o.getId(),r=await t.openPaneComposite(n,2,!0);return r||!1}navigateAcrossEditorGroup(e,t){return this.doNavigateToEditorGroup({direction:e},t)}navigateToEditorGroup(e,t){return this.doNavigateToEditorGroup({location:e},t)}navigateBackToEditorGroup(e,t){if(!t.activeGroup)return!1;let o=this.toOppositeDirection(e);return t.findGroup({direction:o},t.activeGroup)?!1:(t.activeGroup.focus(),!0)}toGroupDirection(e){switch(e){case 1:return 1;case 2:return 2;case 3:return 3;case 0:return 0}}toOppositeDirection(e){switch(e){case 0:return 1;case 3:return 2;case 2:return 3;case 1:return 0}}doNavigateToEditorGroup(e,t){let o=t.findGroup(e,t.activeGroup);return o?(o.focus(),!0):!1}};W(class extends LMe{constructor(){super({id:"workbench.action.navigateLeft",title:P(4331,"Navigate to the View on the Left"),category:Fe.View,f1:!0},2)}});W(class extends LMe{constructor(){super({id:"workbench.action.navigateRight",title:P(4332,"Navigate to the View on the Right"),category:Fe.View,f1:!0},3)}});W(class extends LMe{constructor(){super({id:"workbench.action.navigateUp",title:P(4333,"Navigate to the View Above"),category:Fe.View,f1:!0},0)}});W(class extends LMe{constructor(){super({id:"workbench.action.navigateDown",title:P(4330,"Navigate to the View Below"),category:Fe.View,f1:!0},1)}});var SVt=class extends z{constructor(e,t){super(e);this.focusNext=t}run(e){let t=e.get(wi),o=e.get(ie);this.focusNextOrPreviousPart(t,o,this.focusNext)}findVisibleNeighbour(e,t,o){let n=zi(),r=fI(n),s;if(r)t==="workbench.parts.editor"?s="workbench.parts.statusbar":s="workbench.parts.editor";else switch(t){case"workbench.parts.editor":s=o?"workbench.parts.panel":"workbench.parts.sidebar";break;case"workbench.parts.panel":s=o?"workbench.parts.auxiliarybar":"workbench.parts.editor";break;case"workbench.parts.auxiliarybar":s=o?"workbench.parts.statusbar":"workbench.parts.panel";break;case"workbench.parts.statusbar":s=o?"workbench.parts.activitybar":"workbench.parts.auxiliarybar";break;case"workbench.parts.activitybar":s=o?"workbench.parts.sidebar":"workbench.parts.statusbar";break;case"workbench.parts.sidebar":s=o?"workbench.parts.editor":"workbench.parts.activitybar";break;default:s="workbench.parts.editor"}return e.isVisible(s,n)||s==="workbench.parts.editor"?s:this.findVisibleNeighbour(e,s,o)}focusNextOrPreviousPart(e,t,o){let n;t.activeEditorPane?.hasFocus()||e.hasFocus("workbench.parts.editor")?n="workbench.parts.editor":e.hasFocus("workbench.parts.activitybar")?n="workbench.parts.activitybar":e.hasFocus("workbench.parts.statusbar")?n="workbench.parts.statusbar":e.hasFocus("workbench.parts.sidebar")?n="workbench.parts.sidebar":e.hasFocus("workbench.parts.auxiliarybar")?n="workbench.parts.auxiliarybar":e.hasFocus("workbench.parts.panel")&&(n="workbench.parts.panel"),e.focusPart(n?this.findVisibleNeighbour(e,n,o):"workbench.parts.editor",zi())}};W(class extends SVt{constructor(){super({id:"workbench.action.focusNextPart",title:P(4328,"Focus Next Part"),category:Fe.View,f1:!0,keybinding:{primary:64,weight:200}},!0)}});W(class extends SVt{constructor(){super({id:"workbench.action.focusPreviousPart",title:P(4329,"Focus Previous Part"),category:Fe.View,f1:!0,keybinding:{primary:1088,weight:200}},!1)}});var Yho="inQuickOpen",Xho=new Y(Yho,!1,d(5174,null)),y_=C.has(Yho),eEi="inFilesPicker",tEi=C.and(y_,C.has(eEi));function xR(a,i){return e=>{let t=e.get(Le),o=e.get($e),r={keybindings:t.lookupKeybindings(a)};o.navigate(!!i,r)}}var FG=class extends k{constructor(e,t){super();this.editorService=e;this.editorGroupsService=t;this.editorViewState=void 0;this.openedTransientEditors=new Set}set(){if(this.editorViewState)return;let e=this.editorService.activeEditorPane;e&&(this.editorViewState={group:e.group,editor:e.input,state:k9i(e.getControl())?.saveViewState()??void 0})}async openTransientEditor(e,t){e.options={...e.options,transient:!0};let o=await this.editorService.openEditor(e,t);return o?.input&&o.input!==this.editorViewState?.editor&&o.group.isTransient(o.input)&&this.openedTransientEditors.add(o.input),o}async restore(){if(this.editorViewState){for(let e of this.openedTransientEditors)if(!e.isDirty())for(let t of this.editorGroupsService.groups)t.isTransient(e)&&await t.closeEditor(e,{preserveFocus:!0});await this.editorViewState.group.openEditor(this.editorViewState.editor,{viewState:this.editorViewState.state,preserveFocus:!0}),this.reset()}}reset(){this.editorViewState=void 0,this.openedTransientEditors.clear()}dispose(){super.dispose(),this.reset()}};FG=I([m(0,ie),m(1,kt)],FG);function iEi(a){return a?.hasOwnProperty("folderUri")}function Jho(a){return a?.hasOwnProperty("workspace")}var tgo="inRecentFilesPicker",IVt=class extends z{constructor(){super(...arguments);this.removeFromRecentlyOpened={iconClass:q.asClassName(L.removeClose),tooltip:d(4376,null)};this.dirtyRecentlyOpenedFolder={iconClass:"dirty-workspace "+q.asClassName(L.closeDirty),tooltip:d(4353,null),alwaysVisible:!0};this.dirtyRecentlyOpenedWorkspace={...this.dirtyRecentlyOpenedFolder,tooltip:d(4354,null)};this.windowOpenedRecentlyOpenedFolder={iconClass:"opened-workspace "+q.asClassName(L.window),tooltip:d(4367,null),alwaysVisible:!0};this.windowOpenedRecentlyOpenedWorkspace={...this.windowOpenedRecentlyOpenedFolder,tooltip:d(4368,null)};this.activeWindowOpenedRecentlyOpenedFolder={iconClass:"opened-workspace "+q.asClassName(L.windowActive),tooltip:d(4347,null),alwaysVisible:!0};this.activeWindowOpenedRecentlyOpenedWorkspace={...this.activeWindowOpenedRecentlyOpenedFolder,tooltip:d(4348,null)}}async run(e){let t=e.get(bm),o=e.get($e),n=e.get(Ae),r=e.get(nt),s=e.get(Le),l=e.get(_t),c=e.get(Rt),u=e.get(ti),p=e.get(ct),[h,g,f]=await Promise.all([u.getWindows({includeAuxiliaryWindows:!1}),t.getRecentlyOpened(),t.getDirtyWorkspaces()]),v=!1,b=new dt,S=new dt;for(let ce of f)iEi(ce)?b.set(ce.folderUri,!0):(S.set(ce.workspace.configPath,ce.workspace),v=!0);let y=zi().vscodeWindowId,w=new dt;for(let ce of h){let Se=ce.id===y;Pg(ce.workspace)?w.set(ce.workspace.uri,{isActive:Se}):Gy(ce.workspace)&&w.set(ce.workspace.configPath,{isActive:Se})}let x=new dt,E=new dt;for(let ce of g.workspaces)YM(ce)?x.set(ce.folderUri,!0):(E.set(ce.workspace.configPath,ce.workspace),v=!0);let M=[];for(let ce of g.workspaces){let Se=YM(ce)?b.has(ce.folderUri):S.has(ce.workspace.configPath),Re=YM(ce)?w.get(ce.folderUri):w.get(ce.workspace.configPath);M.push(this.toQuickPick(l,c,r,ce,{isDirty:Se,windowState:Re}))}for(let ce of f)iEi(ce)&&!x.has(ce.folderUri)?M.push(this.toQuickPick(l,c,r,ce,{isDirty:!0,windowState:void 0})):Jho(ce)&&!E.has(ce.workspace.configPath)&&M.push(this.toQuickPick(l,c,r,ce,{isDirty:!0,windowState:void 0}));let N=g.files.map(ce=>this.toQuickPick(l,c,r,ce,{isDirty:!1,windowState:void 0})),V=g.workspaces[0],H=V&&n.isCurrentWorkspace(TN(V)?V.workspace:V.folderUri),K,j={type:"separator",label:v?d(4378,null):d(4359,null)},J={type:"separator",label:d(4358,null)},se=[j,...M,J,...N],ae=await o.pick(se,{contextKey:tgo,activeItem:[...M,...N][H?1:0],placeHolder:et?d(4371,null):d(4370,null),matchOnDescription:!0,sortByLabel:!1,onKeyMods:ce=>K=ce,quickNavigate:this.isQuickNavigate()?{keybindings:s.lookupKeybindings(this.desc.id)}:void 0,hideInput:this.isQuickNavigate(),onDidTriggerItemButton:async ce=>{if(ce.button===this.removeFromRecentlyOpened||ce.button===this.windowOpenedRecentlyOpenedFolder||ce.button===this.windowOpenedRecentlyOpenedWorkspace)await t.removeRecentlyOpened([ce.item.resource]),ce.removeItem();else if(ce.button===this.dirtyRecentlyOpenedFolder||ce.button===this.dirtyRecentlyOpenedWorkspace){let Se=ce.button===this.dirtyRecentlyOpenedWorkspace,{confirmed:Re}=await p.confirm({title:Se?d(4355,null):d(4350,null),message:Se?d(4356,null):d(4351,null),detail:Se?d(4357,null):d(4352,null)});Re&&(u.openWindow([ce.item.openable],{remoteAuthority:ce.item.remoteAuthority||null}),o.cancel())}}});if(ae)return u.openWindow([ae.openable],{forceNewWindow:K?.ctrlCmd,forceReuseWindow:K?.alt,remoteAuthority:ae.remoteAuthority||null})}toQuickPick(e,t,o,n,r){let s,l,c,u,p=!1;YM(n)?(u=n.folderUri,l=Ia(e,t,u,1),s={folderUri:u},c=n.label||o.getWorkspaceLabel(u,{verbose:2})):TN(n)?(u=n.workspace.configPath,l=Ia(e,t,u,2),s={workspaceUri:u},c=n.label||o.getWorkspaceLabel(n.workspace,{verbose:2}),p=!0):(u=n.fileUri,l=Ia(e,t,u,0),s={fileUri:u},c=n.label||o.getUriLabel(u,{appendWorkspaceSuffix:!0}));let{name:h,parentPath:g}=Wyt(c),f=[];return r.isDirty?f.push(p?this.dirtyRecentlyOpenedWorkspace:this.dirtyRecentlyOpenedFolder):r.windowState?r.windowState.isActive?f.push(p?this.activeWindowOpenedRecentlyOpenedWorkspace:this.activeWindowOpenedRecentlyOpenedFolder):f.push(p?this.windowOpenedRecentlyOpenedWorkspace:this.windowOpenedRecentlyOpenedFolder):f.push(this.removeFromRecentlyOpened),{iconClasses:l,label:h,ariaLabel:r.isDirty?p?d(4374,null,h):d(4373,null,h):h,description:g,buttons:f,openable:s,resource:u,remoteAuthority:n.remoteAuthority}}},yW=class a extends IVt{static{this.ID="workbench.action.openRecent"}constructor(){super({id:a.ID,title:{...P(4369,"Open Recent..."),mnemonicTitle:d(4362,null)},category:Fe.File,f1:!0,keybinding:{weight:200,primary:2096,mac:{primary:304}},menu:{id:R.MenubarRecentMenu,group:"y_more",order:1}})}isQuickNavigate(){return!1}},oEi=class extends IVt{constructor(){super({id:"workbench.action.quickOpenRecent",title:P(4372,"Quick Open Recent..."),category:Fe.File,f1:!1})}isQuickNavigate(){return!0}},nEi=class extends z{constructor(){super({id:"workbench.action.toggleFullScreen",title:{...P(4377,"Toggle Full Screen"),mnemonicTitle:d(4365,null)},category:Fe.View,f1:!0,keybinding:{weight:200,primary:69,mac:{primary:2340}},precondition:vTt.toNegated(),toggled:ZA,menu:[{id:R.MenubarAppearanceMenu,group:"1_toggle_view",order:1}]})}run(i){return i.get(ti).toggleFullScreen(zi())}},bte=class a extends z{static{this.ID="workbench.action.reloadWindow"}constructor(){super({id:a.ID,title:P(4375,"Reload Window"),category:Fe.Developer,f1:!0,keybinding:{weight:250,when:_4,primary:2096}})}async run(i){return i.get(ti).reload()}},rEi=class extends z{constructor(){super({id:"workbench.action.showAboutDialog",title:{...P(4346,"About"),mnemonicTitle:d(4360,null)},category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"z_about",order:1,when:Zk.toNegated()}})}run(i){return i.get(ct).about()}},sEi=class extends z{constructor(){super({id:"workbench.action.newWindow",title:{...P(4366,"New Window"),mnemonicTitle:d(4363,null)},f1:!0,keybinding:{weight:200,primary:Ft?ii?Gi(2089,1068):3628:3116,secondary:Ft?[3116]:void 0},menu:{id:R.MenubarFileMenu,group:"1_new",order:3}})}run(i){return i.get(ti).openWindow({remoteAuthority:null})}},aEi=class extends z{constructor(){super({id:"workbench.action.blur",title:P(4349,"Remove keyboard focus from focused element")})}run(){let i=Un();go(i)&&i.blur()}};W(sEi);W(nEi);W(oEi);W(yW);W(bte);W(rEi);W(aEi);var igo=C.and(y_,C.has(tgo)),Zho="workbench.action.quickOpenNavigateNextInRecentFilesPicker";xt.registerCommandAndKeybindingRule({id:Zho,weight:250,handler:xR(Zho,!0),when:igo,primary:2096,mac:{primary:304}});var ego="workbench.action.quickOpenNavigatePreviousInRecentFilesPicker";xt.registerCommandAndKeybindingRule({id:ego,weight:250,handler:xR(ego,!1),when:igo,primary:3120,mac:{primary:1328}});Ge.registerCommand("workbench.action.toggleConfirmBeforeClose",a=>{let i=a.get(B),e=i.inspect("window.confirmBeforeClose").userValue;return i.updateValue("window.confirmBeforeClose",e==="never"?"keyboardOnly":"never")});be.appendMenuItem(R.MenubarFileMenu,{group:"z_ConfirmClose",command:{id:"workbench.action.toggleConfirmBeforeClose",title:d(4361,null),toggled:C.notEquals("config.window.confirmBeforeClose","never")},order:1,when:Mu});be.appendMenuItem(R.MenubarFileMenu,{title:d(4364,null),submenu:R.MenubarRecentMenu,group:"2_open",order:4});var MMe="addRootFolder",yVt=P(4399,"Add Folder to Workspace..."),lEi="setRootFolder",iP="_workbench.pickWorkspaceFolder";Ge.registerCommand({id:"workbench.action.files.openFileFolderInNewWindow",handler:a=>a.get(nn).pickFileFolderAndOpen({forceNewWindow:!0})});Ge.registerCommand({id:"_files.pickFolderAndOpen",handler:(a,i)=>a.get(nn).pickFolderAndOpen(i)});Ge.registerCommand({id:"workbench.action.files.openFolderInNewWindow",handler:a=>a.get(nn).pickFolderAndOpen({forceNewWindow:!0})});Ge.registerCommand({id:"workbench.action.files.openFileInNewWindow",handler:a=>a.get(nn).pickFileAndOpen({forceNewWindow:!0})});Ge.registerCommand({id:"workbench.action.openWorkspaceInNewWindow",handler:a=>a.get(nn).pickWorkspaceAndOpen({forceNewWindow:!0})});Ge.registerCommand({id:MMe,handler:async a=>{let i=a.get(iS),e=await ogo(a);e?.length&&await i.addFolders(e.map(t=>({uri:t})))}});Ge.registerCommand({id:lEi,handler:async a=>{let i=a.get(iS),e=a.get(Ae),t=await ogo(a);t?.length&&await i.updateFolders(0,e.getWorkspace().folders.length,t.map(o=>({uri:o})))}});async function ogo(a){let i=a.get(nn),e=a.get(Pn);return await i.showOpenDialog({openLabel:FB(d(4398,null)),title:d(4400,null),canSelectFolders:!0,canSelectMany:!0,defaultUri:await i.defaultFolderPath(),availableFileSystems:[e.defaultUriScheme]})}Ge.registerCommand(iP,async function(a,i){let e=a.get($e),t=a.get(nt),o=a.get(Ae),n=a.get(_t),r=a.get(Rt),s=o.getWorkspace().folders;if(!s.length)return;let l=s.map(h=>{let g=h.name,f=t.getUriLabel(ai(h.uri),{relative:!0});return{label:g,description:f!==g?f:void 0,folder:h,iconClasses:Ia(n,r,h.uri,2)}}),c=(i?i[0]:void 0)||Object.create(null);c.activeItem||(c.activeItem=l[0]),c.placeHolder||(c.placeHolder=d(4401,null)),typeof c.matchOnDescription!="boolean"&&(c.matchOnDescription=!0);let u=(i?i[1]:void 0)||Ie.None,p=await e.pick(l,c,u);if(p)return s[l.indexOf(p)]});Ge.registerCommand({id:"vscode.openFolder",handler:(a,i,e)=>{let t=a.get(fe);if(typeof e=="boolean"&&(e={forceNewWindow:e}),!i){let l={forceNewWindow:e?.forceNewWindow};return e?.forceLocalWindow&&(l.remoteAuthority=null,l.availableFileSystems=["file"]),t.executeCommand("_files.pickFolderAndOpen",l)}let o=A.from(i,!0),n={forceNewWindow:e?.forceNewWindow,forceReuseWindow:e?.forceReuseWindow,noRecentEntry:e?.noRecentEntry,remoteAuthority:e?.forceLocalWindow?null:void 0,forceProfile:e?.forceProfile,forceTempProfile:e?.forceTempProfile},r=jF(o)||o.scheme===Q.untitled?{workspaceUri:o}:{folderUri:o},s=e?.filesToOpen?.map(l=>({fileUri:A.from(l,!0)}))??[];return t.executeCommand("_files.windowOpen",[r,...s],n)},metadata:{description:"Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.",args:[{name:"uri",description:"(optional) Uri of the folder or workspace file to open. If not provided, a native dialog will ask the user for the folder",constraint:a=>a==null||a instanceof A},{name:"options",description:"(optional) Options. Object with the following properties: `forceNewWindow`: Whether to open the folder/workspace in a new window or the same. Defaults to opening in the same window. `forceReuseWindow`: Whether to force opening the folder/workspace in the same window.  Defaults to false. `noRecentEntry`: Whether the opened URI will appear in the 'Open Recent' list. Defaults to false. `forceLocalWindow`: Whether to force opening the folder/workspace in a local window. Defaults to false. `forceProfile`: The profile to use when opening the folder/workspace. Defaults to the current profile. `forceTempProfile`: Whether to use a temporary profile when opening the folder/workspace. Defaults to false. `filesToOpen`: An array of files to open in the new window. Defaults to an empty array. Note, for backward compatibility, options can also be of type boolean, representing the `forceNewWindow` setting.",constraint:a=>a===void 0||typeof a=="object"||typeof a=="boolean"}]}});Ge.registerCommand({id:"vscode.newWindow",handler:(a,i)=>{let e=a.get(fe),t={forceReuseWindow:i?.reuseWindow,remoteAuthority:i?.remoteAuthority};return e.executeCommand("_files.newWindow",t)},metadata:{description:"Opens an new window depending on the newWindow argument.",args:[{name:"options",description:"(optional) Options. Object with the following properties: `reuseWindow`: Whether to open a new window or the same. Defaults to opening in a new window. ",constraint:a=>a===void 0||typeof a=="object"}]}});Ge.registerCommand("_workbench.removeFromRecentlyOpened",function(a,i){return a.get(bm).removeRecentlyOpened([i])});Ge.registerCommand({id:"vscode.removeFromRecentlyOpened",handler:(a,i)=>{let e=a.get(bm);return typeof i=="string"?i=i.match(/^[^:/?#]+:\/\//)?A.parse(i):A.file(i):i=A.revive(i),e.removeRecentlyOpened([i])},metadata:{description:"Removes an entry with the given path from the recently opened list.",args:[{name:"path",description:"URI or URI string to remove from recently opened.",constraint:a=>typeof a=="string"||a instanceof A}]}});Ge.registerCommand("_workbench.addToRecentlyOpened",async function(a,i){let e=a.get(bm),t=i.uri,o=i.label,n=i.remoteAuthority,r;return i.type==="workspace"?r={workspace:await e.getWorkspaceIdentifier(t),label:o,remoteAuthority:n}:i.type==="folder"?r={folderUri:t,label:o,remoteAuthority:n}:r={fileUri:t,label:o,remoteAuthority:n},e.addRecentlyOpened([r])});Ge.registerCommand("_workbench.getRecentlyOpened",async function(a){return a.get(bm).getRecentlyOpened()});var OMe=P(4397,"Workspaces"),PMe=class a extends z{static{this.ID="workbench.action.files.openFile"}constructor(){super({id:a.ID,title:P(4391,"Open File..."),category:Fe.File,f1:!0,keybinding:{when:Zk.toNegated(),weight:200,primary:2093}})}async run(i,e){return i.get(nn).pickFileAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},wW=class a extends z{static{this.ID="workbench.action.files.openFolder"}constructor(){super({id:a.ID,title:P(4393,"Open Folder..."),category:Fe.File,f1:!0,precondition:P0,keybinding:{weight:200,primary:void 0,linux:{primary:Gi(2089,2093)},win:{primary:Gi(2089,2093)}}})}async run(i,e){return i.get(nn).pickFolderAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},Ste=class a extends z{static{this.ID="workbench.action.files.openFolderViaWorkspace"}constructor(){super({id:a.ID,title:P(4393,"Open Folder..."),category:Fe.File,f1:!0,precondition:C.and(P0.toNegated(),el.isEqualTo("workspace")),keybinding:{weight:200,primary:2093}})}run(i){return i.get(fe).executeCommand(lEi)}},AMe=class a extends z{static{this.ID="workbench.action.files.openFileFolder"}static{this.LABEL=P(4392,"Open...")}constructor(){super({id:a.ID,title:a.LABEL,category:Fe.File,f1:!0,precondition:C.and(Zk,P0),keybinding:{weight:200,primary:2093}})}async run(i,e){return i.get(nn).pickFileFolderAndOpen({forceNewWindow:!1,telemetryExtraData:e})}},wVt=class a extends z{static{this.ID="workbench.action.openWorkspace"}constructor(){super({id:a.ID,title:P(4394,"Open Workspace from File..."),category:Fe.File,f1:!0,precondition:QD})}async run(i,e){return i.get(nn).pickWorkspaceAndOpen({telemetryExtraData:e})}},stt=class a extends z{static{this.ID="workbench.action.closeFolder"}constructor(){super({id:a.ID,title:P(4379,"Close Workspace"),category:OMe,f1:!0,precondition:C.and(el.notEqualsTo("empty"),SZ,qo.negate()),keybinding:{weight:200,primary:Gi(2089,36)}})}async run(i){let e=i.get(ti),t=i.get(Mt);return e.openWindow({forceReuseWindow:!0,remoteAuthority:t.remoteAuthority})}},cEi=class a extends z{static{this.ID="workbench.action.openWorkspaceConfigFile"}constructor(){super({id:a.ID,title:P(4395,"Open Workspace Configuration File"),category:OMe,f1:!0,precondition:C.and(el.isEqualTo("workspace"),qo.negate())})}async run(i){let e=i.get(Ae),t=i.get(ie),o=e.getWorkspace().configuration;o&&await t.openEditor({resource:o,options:{pinned:!0}})}},NMe=class a extends z{static{this.ID="workbench.action.addRootFolder"}constructor(){super({id:a.ID,title:yVt,category:OMe,f1:!0,precondition:C.and(C.or(QD,el.isEqualTo("workspace")),qo.negate())})}run(i){return i.get(fe).executeCommand(MMe)}},att=class a extends z{static{this.ID="workbench.action.removeRootFolder"}constructor(){super({id:a.ID,title:P(4382,"Remove Folder from Workspace..."),category:OMe,f1:!0,precondition:C.and(i_.notEqualsTo("0"),C.or(QD,el.isEqualTo("workspace")),qo.negate())})}async run(i){let e=i.get(fe),t=i.get(iS),o=await e.executeCommand(iP);o&&await t.removeFolders([o.uri])}},CVt=class a extends z{static{this.ID="workbench.action.saveWorkspaceAs"}constructor(){super({id:a.ID,title:P(4396,"Save Workspace As..."),category:OMe,f1:!0,precondition:C.and(QD,qo.negate())})}async run(i){let e=i.get(iS),t=i.get(Ae),o=await e.pickNewWorkspacePath();if(o&&jF(o))switch(t.getWorkbenchState()){case 1:case 2:{let n=t.getWorkspace().folders.map(r=>({uri:r.uri}));return e.createAndEnterWorkspace(n,o)}case 3:return e.saveAndEnterWorkspace(o)}}},xVt=class a extends z{static{this.ID="workbench.action.duplicateWorkspaceInNewWindow"}constructor(){super({id:a.ID,title:P(4381,"Duplicate As Workspace in New Window"),category:OMe,f1:!0,precondition:C.and(QD,qo.negate())})}async run(i){let e=i.get(Ae),t=i.get(iS),o=i.get(ti),n=i.get(bm),r=i.get(Mt),s=e.getWorkspace().folders,l=r.remoteAuthority,c=await n.createUntitledWorkspace(s,l);return await t.copyWorkspaceSettings(c),o.openWindow([{workspaceUri:c.configPath}],{forceNewWindow:!0,remoteAuthority:l})}};W(NMe);W(att);W(PMe);W(wW);W(Ste);W(AMe);W(wVt);W(cEi);W(stt);W(CVt);W(xVt);be.appendMenuItem(R.MenubarFileMenu,{group:"2_open",command:{id:PMe.ID,title:d(4387,null)},order:1,when:Zk.toNegated()});be.appendMenuItem(R.MenubarFileMenu,{group:"2_open",command:{id:wW.ID,title:d(4388,null)},order:2,when:P0});be.appendMenuItem(R.MenubarFileMenu,{group:"2_open",command:{id:Ste.ID,title:d(4388,null)},order:2,when:C.and(P0.toNegated(),el.isEqualTo("workspace"))});be.appendMenuItem(R.MenubarFileMenu,{group:"2_open",command:{id:AMe.ID,title:d(4386,null)},order:1,when:C.and(Zk,P0)});be.appendMenuItem(R.MenubarFileMenu,{group:"2_open",command:{id:wVt.ID,title:d(4389,null)},order:3,when:QD});be.appendMenuItem(R.MenubarFileMenu,{group:"3_workspace",command:{id:MMe,title:d(4383,null)},when:C.and(C.or(QD,el.isEqualTo("workspace")),qo.negate()),order:1});be.appendMenuItem(R.MenubarFileMenu,{group:"3_workspace",command:{id:CVt.ID,title:d(4390,null)},order:2,when:C.and(QD,qo.negate())});be.appendMenuItem(R.MenubarFileMenu,{group:"3_workspace",command:{id:xVt.ID,title:d(4380,null)},order:3,when:C.and(QD,qo.negate())});be.appendMenuItem(R.MenubarFileMenu,{group:"6_close",command:{id:stt.ID,title:d(4384,null)},order:3,when:C.and(el.isEqualTo("folder"),SZ,qo.negate())});be.appendMenuItem(R.MenubarFileMenu,{group:"6_close",command:{id:stt.ID,title:d(4385,null)},order:3,when:C.and(el.isEqualTo("workspace"),SZ,qo.negate())});var Rtn="chat.unifiedAgentsBar.enabled",A8={primary:2094,secondary:[2083],mac:{primary:2094,secondary:void 0}};xt.registerCommandAndKeybindingRule({id:"workbench.action.closeQuickOpen",weight:200,when:y_,primary:9,secondary:[1033],handler:a=>a.get($e).cancel(2)});xt.registerCommandAndKeybindingRule({id:"workbench.action.acceptSelectedQuickOpenItem",weight:200,when:y_,primary:0,handler:a=>a.get($e).accept()});xt.registerCommandAndKeybindingRule({id:"workbench.action.alternativeAcceptSelectedQuickOpenItem",weight:200,when:y_,primary:0,handler:a=>a.get($e).accept({ctrlCmd:!0,alt:!1,shift:!1})});xt.registerCommandAndKeybindingRule({id:"workbench.action.focusQuickOpen",weight:200,when:y_,primary:0,handler:a=>{a.get($e).focus()}});var ngo="workbench.action.quickOpenNavigateNextInFilePicker";xt.registerCommandAndKeybindingRule({id:ngo,weight:250,handler:xR(ngo,!0),when:tEi,primary:A8.primary,secondary:A8.secondary,mac:A8.mac});var rgo="workbench.action.quickOpenNavigatePreviousInFilePicker";xt.registerCommandAndKeybindingRule({id:rgo,weight:250,handler:xR(rgo,!1),when:tEi,primary:A8.primary|1024,secondary:[A8.secondary[0]|1024],mac:{primary:A8.mac.primary|1024,secondary:void 0}});xt.registerCommandAndKeybindingRule({id:"workbench.action.quickPickManyToggle",weight:200,when:y_,primary:0,handler:a=>{a.get($e).toggle()}});xt.registerCommandAndKeybindingRule({id:"workbench.action.quickInputBack",weight:250,when:y_,primary:0,win:{primary:527},mac:{primary:344},linux:{primary:2648},handler:a=>{a.get($e).back()}});W(class extends z{constructor(){super({id:"workbench.action.quickOpen",title:P(4336,"Go to File..."),metadata:{description:"Quick access",args:[{name:"prefix",schema:{type:"string"}}]},keybinding:{weight:200,primary:A8.primary,secondary:A8.secondary,mac:A8.mac},f1:!0})}run(i,e){i.get($e).quickAccess.show(typeof e=="string"?e:void 0,{preserveValue:typeof e=="string"})}});W(class extends z{constructor(){super({id:"workbench.action.quickOpenWithModes",title:d(4337,null),icon:L.search,menu:{id:R.CommandCenterCenter,order:100}})}async run(i){let e=()=>{let s=i.get($e),l={includeHelp:!0,from:"commandCenter"};s.quickAccess.show(void 0,{preserveValue:!0,providerOptions:l})},t=i.get(B),o=i.get(fe);if(!(t.getValue("chat.disableAIFeatures")===!0)&&t.getValue(Rtn)===!0){try{await o.executeCommand("workbench.action.unifiedQuickAccess")}catch{e()}return}e()}});Ge.registerCommand("workbench.action.quickOpenPreviousEditor",async a=>{a.get($e).quickAccess.show("",{itemActivation:2})});var FMe=class extends z{constructor(e,t,o,n,r){super({id:e,title:t,f1:!0,keybinding:r});this.id=e;this.next=o;this.quickNavigate=n}async run(e){let t=e.get(Le),o=e.get($e),n=t.lookupKeybindings(this.id),r=this.quickNavigate?{keybindings:n}:void 0;o.navigate(this.next,r)}},dEi=class extends FMe{constructor(){super("workbench.action.quickOpenNavigateNext",P(4334,"Navigate Next in Quick Open"),!0,!0)}},uEi=class extends FMe{constructor(){super("workbench.action.quickOpenNavigatePrevious",P(4335,"Navigate Previous in Quick Open"),!1,!0)}},pEi=class extends FMe{constructor(){super("workbench.action.quickOpenSelectNext",P(4338,"Select Next in Quick Open"),!0,!1,{weight:250,when:y_,primary:0,mac:{primary:300}})}},mEi=class extends FMe{constructor(){super("workbench.action.quickOpenSelectPrevious",P(4339,"Select Previous in Quick Open"),!1,!1,{weight:250,when:y_,primary:0,mac:{primary:302}})}};W(pEi);W(mEi);W(dEi);W(uEi);var lgo=[{key:"commandPalette",id:R.CommandPalette,description:d(18563,null),supportsSubmenus:!1},{key:"touchBar",id:R.TouchBarContext,description:d(18602,null),supportsSubmenus:!1},{key:"editor/title",id:R.EditorTitle,description:d(18574,null)},{key:"modalEditor/editorTitle",id:R.ModalEditorEditorTitle,description:d(18585,null)},{key:"editor/title/run",id:R.EditorTitleRun,description:d(18576,null)},{key:"editor/context",id:R.EditorContext,description:d(18570,null)},{key:"editor/context/copy",id:R.EditorContextCopy,description:d(18571,null)},{key:"editor/context/share",id:R.EditorContextShare,description:d(18572,null),proposed:"contribShareMenu"},{key:"explorer/context",id:R.ExplorerContext,description:d(18577,null)},{key:"explorer/context/share",id:R.ExplorerContextShare,description:d(18578,null),proposed:"contribShareMenu"},{key:"editor/title/context",id:R.EditorTitleContext,description:d(18573,null)},{key:"editor/title/context/share",id:R.EditorTitleContextShare,description:d(18575,null),proposed:"contribShareMenu"},{key:"debug/callstack/context",id:R.DebugCallStackContext,description:d(18564,null)},{key:"debug/variables/context",id:R.DebugVariablesContext,description:d(18567,null)},{key:"debug/watch/context",id:R.DebugWatchContext,description:d(18568,null)},{key:"debug/toolBar",id:R.DebugToolBar,description:d(18566,null)},{key:"debug/createConfiguration",id:R.DebugCreateConfiguration,proposed:"contribDebugCreateConfiguration",description:d(18565,null)},{key:"notebook/variables/context",id:R.NotebookVariablesContext,description:d(18588,null)},{key:"menuBar/home",id:R.MenubarHomeMenu,description:d(18582,null),proposed:"contribMenuBarHome",supportsSubmenus:!1},{key:"menuBar/edit/copy",id:R.MenubarCopy,description:d(18589,null)},{key:"scm/title",id:R.SCMTitle,description:d(18597,null)},{key:"scm/sourceControl",id:R.SCMSourceControl,description:d(18594,null)},{key:"scm/repositories/title",id:R.SCMSourceControlTitle,description:d(18596,null),proposed:"contribSourceControlTitleMenu"},{key:"scm/repository",id:R.SCMSourceControlInline,description:d(18595,null)},{key:"scm/resourceState/context",id:R.SCMResourceContext,description:d(18592,null)},{key:"scm/resourceFolder/context",id:R.SCMResourceFolderContext,description:d(18590,null)},{key:"scm/resourceGroup/context",id:R.SCMResourceGroupContext,description:d(18591,null)},{key:"scm/change/title",id:R.SCMChangeContext,description:d(18551,null)},{key:"scm/inputBox",id:R.SCMInputBox,description:d(18583,null),proposed:"contribSourceControlInputBoxMenu"},{key:"scm/history/title",id:R.SCMHistoryTitle,description:d(18593,null),proposed:"contribSourceControlHistoryTitleMenu"},{key:"scm/historyItem/context",id:R.SCMHistoryItemContext,description:d(18580,null),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/historyItemRef/context",id:R.SCMHistoryItemRefContext,description:d(18581,null),proposed:"contribSourceControlHistoryItemMenu"},{key:"scm/artifactGroup/context",id:R.SCMArtifactGroupContext,description:d(18550,null),proposed:"contribSourceControlArtifactGroupMenu"},{key:"scm/artifact/context",id:R.SCMArtifactContext,description:d(18549,null),proposed:"contribSourceControlArtifactMenu"},{key:"statusBar/remoteIndicator",id:R.StatusBarRemoteIndicatorMenu,description:d(18599,null),supportsSubmenus:!1},{key:"terminal/context",id:R.TerminalInstanceContext,description:d(18600,null)},{key:"terminal/title/context",id:R.TerminalTabContext,description:d(18601,null)},{key:"view/title",id:R.ViewTitle,description:d(18640,null)},{key:"viewContainer/title",id:R.ViewContainerTitle,description:d(18633,null),proposed:"contribViewContainerTitle"},{key:"view/item/context",id:R.ViewItemContext,description:d(18634,null)},{key:"comments/comment/editorActions",id:R.CommentEditorActions,description:d(18532,null),proposed:"contribCommentEditorActionsMenu"},{key:"comments/commentThread/title",id:R.CommentThreadTitle,description:d(18533,null)},{key:"comments/commentThread/context",id:R.CommentThreadActions,description:d(18531,null),supportsSubmenus:!1},{key:"comments/commentThread/additionalActions",id:R.CommentThreadAdditionalActions,description:d(18531,null),supportsSubmenus:!0,proposed:"contribCommentThreadAdditionalMenu"},{key:"comments/commentThread/title/context",id:R.CommentThreadTitleContext,description:d(18534,null),proposed:"contribCommentPeekContext"},{key:"comments/comment/title",id:R.CommentTitle,description:d(18529,null)},{key:"comments/comment/context",id:R.CommentActions,description:d(18527,null),supportsSubmenus:!1},{key:"comments/commentThread/comment/context",id:R.CommentThreadCommentContext,description:d(18528,null),proposed:"contribCommentPeekContext"},{key:"commentsView/commentThread/context",id:R.CommentsViewThreadActions,description:d(18530,null),proposed:"contribCommentsViewThreadMenus"},{key:"notebook/toolbar",id:R.NotebookToolbar,description:d(18611,null)},{key:"notebook/kernelSource",id:R.NotebookKernelSource,description:d(18610,null),proposed:"notebookKernelSource"},{key:"notebook/cell/title",id:R.NotebookCellTitle,description:d(18609,null)},{key:"notebook/cell/execute",id:R.NotebookCellExecute,description:d(18608,null)},{key:"interactive/toolbar",id:R.InteractiveToolbar,description:d(18542,null)},{key:"interactive/cell/title",id:R.InteractiveCellTitle,description:d(18541,null)},{key:"issue/reporter",id:R.IssueReporter,description:d(18543,null)},{key:"testing/item/context",id:R.TestItem,description:d(18626,null)},{key:"testing/item/gutter",id:R.TestItemGutter,description:d(18627,null)},{key:"testing/profiles/context",id:R.TestProfilesContext,description:d(18631,null)},{key:"testing/item/result",id:R.TestPeekElement,description:d(18628,null)},{key:"testing/message/context",id:R.TestMessageContext,description:d(18630,null)},{key:"testing/message/content",id:R.TestMessageContent,description:d(18629,null)},{key:"extension/context",id:R.ExtensionContext,description:d(18579,null)},{key:"timeline/title",id:R.TimelineTitle,description:d(18636,null)},{key:"timeline/item/context",id:R.TimelineItemContext,description:d(18635,null)},{key:"ports/item/context",id:R.TunnelContext,description:d(18637,null)},{key:"ports/item/origin/inline",id:R.TunnelOriginInline,description:d(18638,null)},{key:"ports/item/port/inline",id:R.TunnelPortInline,description:d(18639,null)},{key:"file/newFile",id:R.NewFile,description:d(18539,null),supportsSubmenus:!1},{key:"webview/context",id:R.WebviewContext,description:d(18663,null)},{key:"file/share",id:R.MenubarShare,description:d(18598,null),proposed:"contribShareMenu"},{key:"editor/inlineCompletions/actions",id:R.InlineCompletionsActions,description:d(18540,null),supportsSubmenus:!1,proposed:"inlineCompletionsAdditions"},{key:"editor/content",id:R.EditorContent,description:d(18603,null),proposed:"contribEditorContentMenu"},{key:"editor/lineNumber/context",id:R.EditorLineNumberContext,description:d(18538,null)},{key:"mergeEditor/result/title",id:R.MergeInputResultToolbar,description:d(18584,null),proposed:"contribMergeEditorMenus"},{key:"multiDiffEditor/content",id:R.MultiDiffEditorContent,description:d(18586,null),proposed:"contribEditorContentMenu"},{key:"multiDiffEditor/resource/title",id:R.MultiDiffEditorFileToolbar,description:d(18587,null),proposed:"contribMultiDiffEditorMenus"},{key:"diffEditor/gutter/hunk",id:R.DiffEditorHunkToolbar,description:d(18569,null),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"diffEditor/gutter/selection",id:R.DiffEditorSelectionToolbar,description:d(18569,null),proposed:"contribDiffEditorGutterToolBarMenus"},{key:"searchPanel/aiResults/commands",id:R.SearchActionMenu,description:d(18621,null)},{key:"editor/context/chat",id:R.ChatTextEditorMenu,description:d(18562,null),supportsSubmenus:!1,proposed:"chatParticipantPrivate"},{key:"chat/input/editing/sessionToolbar",id:R.ChatEditingSessionChangesToolbar,description:d(18555,null),proposed:"chatSessionsProvider"},{key:"chat/input/editing/sessionTitleToolbar",id:R.ChatEditingSessionTitleToolbar,description:d(18556,null),proposed:"chatSessionsProvider"},{key:"chat/chatSessions",id:R.AgentSessionsContext,description:d(18560,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chatSessions/newSession",id:R.AgentSessionsCreateSubMenu,description:d(18561,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/multiDiff/context",id:R.ChatMultiDiffContext,description:d(18558,null),supportsSubmenus:!1,proposed:"chatSessionsProvider"},{key:"chat/customizations/create",id:R.for("AICustomizationManagementCreate"),description:d(18553,null),supportsSubmenus:!1,proposed:"chatSessionCustomizationProvider"},{key:"chat/customizations/item",id:R.for("AICustomizationManagementEditorItem"),description:d(18554,null),supportsSubmenus:!1,proposed:"chatSessionCustomizationProvider"},{key:"chat/editor/inlineGutter",id:R.ChatEditorInlineMenu,description:d(18557,null),supportsSubmenus:!1,proposed:"contribChatEditorInlineGutterMenu"},{key:"chat/contextUsage/actions",id:R.ChatContextUsageActions,description:d(18552,null),proposed:"chatParticipantAdditions"},{key:"chat/newSession",id:R.ChatNewMenu,description:d(18559,null),proposed:"chatSessionsProvider"},{key:"agents/changes/actions",id:R.AgentsChangesToolbar,description:d(18548,null),proposed:"chatSessionsProvider"},{key:"agents/changes/actions/primary",id:R.AgentsChangesPrimaryActionSubMenu,description:d(18547,null),proposed:"chatSessionsProvider"},{key:"agents/change/inline",id:R.AgentsChangeInlineToolbar,description:d(18546,null),proposed:"chatSessionsProvider"}],Ite;(v=>{function a(b){return typeof b.command=="string"}v.isMenuItem=a;function i(b,S){return typeof b.command!="string"?(S.error(d(18618,null,"command")),!1):b.alt&&typeof b.alt!="string"?(S.error(d(18613,null,"alt")),!1):b.when&&typeof b.when!="string"?(S.error(d(18613,null,"when")),!1):b.group&&typeof b.group!="string"?(S.error(d(18613,null,"group")),!1):!0}v.isValidMenuItem=i;function e(b,S){return typeof b.submenu!="string"?(S.error(d(18618,null,"submenu")),!1):b.when&&typeof b.when!="string"?(S.error(d(18613,null,"when")),!1):b.group&&typeof b.group!="string"?(S.error(d(18613,null,"group")),!1):!0}v.isValidSubmenuItem=e;function t(b,S){if(!Array.isArray(b))return S.error(d(18617,null)),!1;for(let y of b)if(a(y)){if(!i(y,S))return!1}else if(!e(y,S))return!1;return!0}v.isValidItems=t;function o(b,S){return typeof b!="object"?(S.error(d(18616,null)),!1):typeof b.id!="string"?(S.error(d(18618,null,"id")),!1):typeof b.label!="string"?(S.error(d(18618,null,"label")),!1):!0}v.isValidSubmenu=o;let n={type:"object",required:["command"],properties:{command:{description:d(18652,null),type:"string"},alt:{description:d(18651,null),type:"string"},when:{description:d(18655,null),type:"string"},group:{description:d(18653,null),type:"string"}}},r={type:"object",required:["submenu"],properties:{submenu:{description:d(18654,null),type:"string"},when:{description:d(18655,null),type:"string"},group:{description:d(18653,null),type:"string"}}},s={type:"object",required:["id","label"],properties:{id:{description:d(18660,null),type:"string"},label:{description:d(18661,null),type:"string"},icon:{description:d(18657,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(18659,null),type:"string"},dark:{description:d(18658,null),type:"string"}}}]}}};v.menusContribution={description:d(18656,null),type:"object",properties:oY(lgo,b=>b.key,b=>({markdownDescription:b.proposed?d(18614,null,b.proposed,b.description):b.description,type:"array",items:b.supportsSubmenus===!1?n:{oneOf:[n,r]}})),additionalProperties:{description:"Submenu",type:"array",items:{oneOf:[n,r]}}},v.submenusContribution={description:d(18662,null),type:"array",items:s};function u(b,S){return b?_c(b.command)?(S.error(d(18618,null,"command")),!1):!h(b.title,S,"title")||b.shortTitle&&!h(b.shortTitle,S,"shortTitle")?!1:b.enablement&&typeof b.enablement!="string"?(S.error(d(18613,null,"precondition")),!1):!(b.category&&!h(b.category,S,"category")||!p(b.icon,S)):(S.error(d(18607,null)),!1)}v.isValidCommand=u;function p(b,S){return typeof b>"u"||typeof b=="string"||typeof b.dark=="string"&&typeof b.light=="string"?!0:(S.error(d(18612,null)),!1)}function h(b,S,y){return typeof b>"u"?(S.error(d(18619,null,y)),!1):typeof b=="string"&&_c(b)?(S.error(d(18618,null,y)),!1):typeof b!="string"&&(_c(b.original)||_c(b.value))?(S.error(d(18620,null,`${y}.value`,`${y}.original`)),!1):!0}let g={type:"object",required:["command","title"],properties:{command:{description:d(18644,null),type:"string"},title:{description:d(18650,null),type:"string"},shortTitle:{markdownDescription:d(18649,null),type:"string"},category:{description:d(18643,null),type:"string"},enablement:{description:d(18648,null),type:"string"},icon:{description:d(18645,null),anyOf:[{type:"string"},{type:"object",properties:{light:{description:d(18647,null),type:"string"},dark:{description:d(18646,null),type:"string"}}}]}}};v.commandsContribution={description:d(18642,null),oneOf:[g,{type:"array",items:g}]}})(Ite||={});var sgo=new O,gEi=zn.registerExtensionPoint({extensionPoint:"commands",jsonSchema:Ite.commandsContribution,activationEventsGenerator:function*(a){for(let i of a)i.command&&(yield`onCommand:${i.command}`)}});gEi.setHandler(a=>{function i(e,t){if(!Ite.isValidCommand(e,t.collector))return;let{icon:o,enablement:n,category:r,title:s,shortTitle:l,command:c}=e,u;o&&(typeof o=="string"?u=q.fromString(o)??{dark:Ve(t.description.extensionLocation,o),light:Ve(t.description.extensionLocation,o)}:u={dark:Ve(t.description.extensionLocation,o.dark),light:Ve(t.description.extensionLocation,o.light)});let p=be.getCommand(c);p&&(p.source?t.collector.info(d(18536,null,e.command,p.source.title,p.source.id)):t.collector.info(d(18535,null,e.command))),sgo.add(be.addCommand({id:c,title:s,source:{id:t.description.identifier.value,title:t.description.displayName??t.description.name},shortTitle:l,tooltip:s,category:r,precondition:C.deserialize(n),icon:u}))}sgo.clear();for(let e of a){let{value:t}=e;if(Array.isArray(t))for(let o of t)i(o,e);else i(t,e)}});var ctt=new Map,cgo=zn.registerExtensionPoint({extensionPoint:"submenus",jsonSchema:Ite.submenusContribution});cgo.setHandler(a=>{ctt.clear();for(let i of a){let{value:e,collector:t}=i;for(let[,o]of Object.entries(e)){if(!Ite.isValidSubmenu(o,t))continue;if(!o.id){t.warn(d(18623,null,o.id));continue}if(ctt.has(o.id)){t.info(d(18622,null,o.id));continue}if(!o.label){t.warn(d(18624,null,o.label));continue}let n;o.icon&&(typeof o.icon=="string"?n=q.fromString(o.icon)||{dark:Ve(i.description.extensionLocation,o.icon)}:n={dark:Ve(i.description.extensionLocation,o.icon.dark),light:Ve(i.description.extensionLocation,o.icon.light)});let r={id:R.for(`api:${o.id}`),label:o.label,icon:n};ctt.set(o.id,r)}}});var Ltn=new Map(lgo.map(a=>[a.key,a])),ago=new O,hEi=new Map,Mtn=zn.registerExtensionPoint({extensionPoint:"menus",jsonSchema:Ite.menusContribution,deps:[cgo]});Mtn.setHandler(a=>{ago.clear(),hEi.clear();for(let i of a){let{value:e,collector:t}=i;for(let o of Object.entries(e)){if(!Ite.isValidItems(o[1],t))continue;let n=Ltn.get(o[0]);if(!n){let r=ctt.get(o[0]);r&&(n={key:o[0],id:r.id,description:""})}if(n){if(n.proposed&&!Va(i.description,n.proposed)){t.error(d(18615,null,o[0],n.proposed,i.description.identifier.value));continue}for(let r of o[1]){let s;if(Ite.isMenuItem(r)){let l=be.getCommand(r.command),c=r.alt&&be.getCommand(r.alt)||void 0;if(!l){t.error(d(18605,null,r.command));continue}r.alt&&!c&&t.warn(d(18604,null,r.alt)),r.command===r.alt&&t.info(d(18537,null)),s={command:l,alt:c,group:void 0,order:void 0,when:void 0}}else{if(n.supportsSubmenus===!1){t.error(d(18632,null));continue}let l=ctt.get(r.submenu);if(!l){t.error(d(18606,null,r.submenu));continue}let c=hEi.get(n.id.id);if(c||(c=new Set,hEi.set(n.id.id,c)),c.has(l.id.id)){t.warn(d(18625,null,r.submenu,o[0]));continue}c.add(l.id.id),s={submenu:l.id,icon:l.icon,title:l.label,group:void 0,order:void 0,when:void 0}}if(r.group){let l=r.group.lastIndexOf("@");l>0?(s.group=r.group.substr(0,l),s.order=Number(r.group.substr(l+1))||void 0):s.group=r.group}if(n.id===R.ViewContainerTitle&&!r.when?.includes("viewContainer == workbench.view.debug")){t.error(d(18641,null,"`viewContainer/title`","`viewContainer == workbench.view.debug`",'"when"'));continue}s.when=C.deserialize(r.when),ago.add(be.appendMenuItem(n.id,s))}}}}});var ltt=class extends k{constructor(e){super();this._keybindingService=e;this.type="table"}shouldRender(e){return!!e.contributes?.commands}render(e){let o=(e.contributes?.commands||[]).map(p=>({id:p.command,title:p.title,keybindings:[],menus:[]})),n=oY(o,p=>p.id),r=e.contributes?.menus||{},s=oY(o,p=>p.id);if(r.commandPalette)for(let p of r.commandPalette)delete s[p.command];if(Object.keys(s).length){r.commandPalette||(r.commandPalette=[]);for(let p in s)r.commandPalette.push({command:p})}for(let p in r)for(let h of r[p])if(h.when!=="false"&&h.command){let g=n[h.command];g?g.menus.includes(p)||g.menus.push(p):(g={id:h.command,title:"",keybindings:[],menus:[p]},n[g.id]=g,o.push(g))}if((e.contributes?.keybindings?Array.isArray(e.contributes.keybindings)?e.contributes.keybindings:[e.contributes.keybindings]:[]).forEach(p=>{let h=this.resolveKeybinding(p);if(!h)return;let g=n[p.command];g?g.keybindings.push(h):(g={id:p.command,title:"",keybindings:[h],menus:[]},n[g.id]=g,o.push(g))}),!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let c=[d(18524,null),d(18525,null),d(18544,null),d(18545,null)],u=o.sort((p,h)=>p.id.localeCompare(h.id)).map(p=>[new he().appendMarkdown(`\`${p.id}\``),typeof p.title=="string"?p.title:p.title.value,p.keybindings,new he().appendMarkdown(`${p.menus.sort((h,g)=>h.localeCompare(g)).map(h=>`\`${h}\``).join("&nbsp;")}`)]);return{data:{headers:c,rows:u},dispose:()=>{}}}resolveKeybinding(e){let t;switch(XO){case"win32":t=e.win;break;case"linux":t=e.linux;break;case"darwin":t=e.mac;break}return this._keybindingService.resolveUserBinding(t??e.key)[0]}};ltt=I([m(0,Le)],ltt);oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"commands",label:d(18526,null),access:{canToggle:!1},renderer:new Vt(ltt)});var WMe=".vscode",dtt="settings",dgo=`${WMe}/${dtt}.json`,ugo="vscode://schemas/settings/default",pgo="vscode://schemas/settings/user",mgo="vscode://schemas/settings/profile",hgo="vscode://schemas/settings/machine",kVt="vscode://schemas/settings/workspace",ggo="vscode://schemas/settings/folder",mU="vscode://schemas/launch",She="vscode://schemas/tasks",VMe="vscode://schemas/mcp",MC=[1,3],fgo=[2,4,5,6,7],fEi=[4,5,6],EVt=[1,...fEi],BMe=[2,3,4,5,6,7],N8=[4,5,6,7],yte=[5,6,7],w_="tasks",WG="launch",yb="mcp",kR=Object.create(null);kR[w_]=`${WMe}/${w_}.json`;kR[WG]=`${WMe}/${WG}.json`;kR[yb]=`${WMe}/${yb}.json`;var TVt=Object.create(null);TVt[w_]=`${w_}.json`;TVt[yb]=`${yb}.json`;var Yg=B,vgo=`{
	"version": "2.0.0",
	"tasks": []
}`,gw="workbench.settings.applyToAllProfiles";var Ptn=oe.as(Ta.JSONContribution),_Vt=oe.as($t.Configuration),bgo={type:"object",defaultSnippets:[{body:{title:"",properties:{}}}],properties:{title:{description:d(4086,null),type:"string"},order:{description:d(4082,null),type:"integer"},properties:{description:d(4083,null),type:"object",propertyNames:{pattern:"\\S+",patternErrorMessage:d(4085,null)},additionalProperties:{anyOf:[{title:d(4084,null),$ref:"http://json-schema.org/draft-07/schema#"},{type:"object",properties:{scope:{type:"string",enum:["application","machine","window","resource","language-overridable","machine-overridable"],default:"window",enumDescriptions:[d(4054,null),d(4064,null),d(4073,null),d(4070,null),d(4062,null),d(4063,null)],markdownDescription:d(4056,null)},enumDescriptions:{type:"array",items:{type:"string"},description:d(4058,null)},markdownEnumDescriptions:{type:"array",items:{type:"string"},description:d(4067,null)},enumItemLabels:{type:"array",items:{type:"string"},markdownDescription:d(4059,null,"`enum`")},markdownDescription:{type:"string",description:d(4066,null)},deprecationMessage:{type:"string",description:d(4055,null)},markdownDeprecationMessage:{type:"string",description:d(4065,null)},editPresentation:{type:"string",enum:["singlelineText","multilineText"],enumDescriptions:[d(4071,null),d(4068,null)],default:"singlelineText",description:d(4057,null)},order:{type:"integer",description:d(4069,null)},ignoreSync:{type:"boolean",description:d(4060,null)},keywords:{type:"array",items:{type:"string"},description:d(4061,null)},tags:{type:"array",items:{type:"string",enum:["accessibility","advanced","experimental","telemetry","usesOnlineServices"],enumDescriptions:[d(4035,null),d(4036,null),d(4044,null),d(4050,null),d(4078,null),d(4080,null)]},additionalItems:!0,markdownDescription:d(4072,null)},agentsWindow:{type:"object",markdownDescription:d(4051,null),properties:{default:{description:d(4052,null)},readOnly:{type:"boolean",description:d(4053,null),default:!1}},additionalProperties:!1}}}]}}}},FN,Sgo=zn.registerExtensionPoint({extensionPoint:"configurationDefaults",jsonSchema:{$ref:PSt},canHandleResolver:!0});Sgo.setHandler((a,{added:i,removed:e})=>{FN&&_Vt.deltaConfiguration(FN);let t=FN={};if(queueMicrotask(()=>{FN===t&&(_Vt.deltaConfiguration(FN),FN=void 0)}),e.length){let o=e.map(n=>({overrides:io(n.value),source:{id:n.description.identifier.value,displayName:n.description.displayName}}));FN.removedDefaults=o}if(i.length){let o=_Vt.getConfigurationProperties(),n=[7,4,5,6],r=i.map(s=>{let l=io(s.value);for(let c of Object.keys(l)){let u=o[c];if(u?.disallowConfigurationDefault){s.collector.warn(d(4040,null,c)),delete l[c];continue}if(!af.test(c)&&u?.scope&&!n.includes(u.scope)){s.collector.warn(d(4038,null,c)),delete l[c];continue}}return{overrides:l,source:{id:s.description.identifier.value,displayName:s.description.displayName}}});FN.addedDefaults=r}});var Atn=zn.registerExtensionPoint({extensionPoint:"configuration",deps:[Sgo],jsonSchema:{description:d(4081,null),oneOf:[bgo,{type:"array",items:bgo}]},canHandleResolver:!0}),vEi=new uu;Atn.setHandler((a,{added:i,removed:e})=>{if(FN??={},e.length){let r=[];for(let s of e)r.push(...vEi.get(s.description.identifier)||[]),vEi.delete(s.description.identifier);FN.removedConfigurations=r}let t=new Set;function o(r,s){let l=io(r);return l.title&&typeof l.title!="string"&&s.collector.error(d(4048,null)),n(l,s),l.id=r.id||s.description.identifier.value,l.extensionInfo={id:s.description.identifier.value,displayName:s.description.displayName},l.restrictedProperties=s.description.capabilities?.untrustedWorkspaces?.supported==="limited"?s.description.capabilities?.untrustedWorkspaces.restrictedConfigurations:void 0,l.title=l.title||s.description.displayName||s.description.identifier.value,l}function n(r,s){let l=r.properties,c=$i.extensionConfigurationPolicy;if(l){typeof l!="object"&&(s.collector.error(d(4046,null)),r.properties={});for(let p in l){let h=l[p],g=ori(p,h,s.description.identifier.value);if(g){delete l[p],s.collector.warn(g);continue}if(t.has(p)&&!nri.has(s.description.identifier.value.toLowerCase())){delete l[p],s.collector.warn(d(4039,null,p));continue}if(!Di(h)){delete l[p],s.collector.error(d(4047,null,p));continue}c?.[p]&&(h.policy=c?.[p]),h.tags?.some(f=>f.toLowerCase()==="onexp")&&(h.experiment={mode:"startup"}),h.agentsWindow&&!Va(s.description,"agentsWindowConfiguration")&&(s.collector.error(d(4037,null,s.description.identifier.value,p)),delete h.agentsWindow),t.add(p),h.scope=h.scope?OSt(h.scope.toString()):4}}let u=r.allOf;if(u){s.collector.error(d(4045,null));for(let p of u)n(p,s)}}if(i.length){let r=[];for(let s of i){let l=[],c=s.value;Array.isArray(c)?c.forEach(u=>l.push(o(u,s))):l.push(o(c,s)),vEi.set(s.description.identifier,l),r.push(...l)}FN.addedConfigurations=r}_Vt.deltaConfiguration(FN),FN=void 0});Ptn.registerSchema("vscode://schemas/workspaceConfig",{allowComments:!0,allowTrailingCommas:!0,default:{folders:[{path:""}],settings:{}},required:["folders"],properties:{folders:{minItems:0,uniqueItems:!0,description:d(4088,null),items:{type:"object",defaultSnippets:[{body:{path:"$1"}}],oneOf:[{properties:{path:{type:"string",description:d(4092,null)},name:{type:"string",description:d(4091,null)}},required:["path"]},{properties:{uri:{type:"string",description:d(4097,null)},name:{type:"string",description:d(4091,null)}},required:["uri"]}]}},settings:{type:"object",default:{},description:d(4094,null),$ref:kVt},launch:{type:"object",default:{configurations:[],compounds:[]},description:d(4089,null),$ref:mU},tasks:{type:"object",default:{version:"2.0.0",tasks:[]},description:d(4095,null),$ref:She},mcp:{type:"object",default:{inputs:[],servers:{"mcp-server-time":{command:"uvx",args:["mcp_server_time","--local-timezone=America/Los_Angeles"]}}},description:d(4090,null),$ref:VMe},extensions:{type:"object",default:{},description:d(4087,null),$ref:"vscode://schemas/extensions"},remoteAuthority:{type:"string",doNotSuggest:!0,description:d(4093,null)},transient:{type:"boolean",doNotSuggest:!0,description:d(4096,null)}},errorMessage:d(4079,null)});var bEi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.configuration}render(e){let t=e.contributes?.configuration?Array.isArray(e.contributes.configuration)?e.contributes.configuration:[e.contributes.configuration]:[],o=NSt(t),n=o?Object.keys(o):[],r=[d(4075,null),d(4043,null),d(4041,null)],s=n.sort((l,c)=>l.localeCompare(c)).map(l=>[new he().appendMarkdown(`\`${l}\``),o[l].markdownDescription?new he(o[l].markdownDescription,!1):o[l].description??"",new he().appendCodeblock("json",JSON.stringify(bn(o[l].default)?i3e(o[l].type):o[l].default,null,2))]);return{data:{headers:r,rows:s},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configuration",label:d(4076,null),access:{canToggle:!1},renderer:new Vt(bEi)});var SEi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.configurationDefaults}render(e){let t=e.contributes?.configurationDefaults??{},o=[d(4049,null),d(4074,null),d(4042,null)],n=[];for(let r of Object.keys(t).sort((s,l)=>s.localeCompare(l))){let s=t[r];if(af.test(r)){let l=Hz(r),c=new he().appendMarkdown(`${l.join(", ")}`);for(let u of Object.keys(s).sort((p,h)=>p.localeCompare(h))){let p=[];p.push(c),p.push(new he().appendMarkdown(`\`${u}\``)),p.push(new he().appendCodeblock("json",JSON.stringify(s[u],null,2))),n.push(p)}}else{let l=[];l.push(""),l.push(new he().appendMarkdown(`\`${r}\``)),l.push(new he().appendCodeblock("json",JSON.stringify(s,null,2))),n.push(l)}}return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"configurationDefaults",label:d(4077,null),access:{canToggle:!1},renderer:new Vt(SEi)});var HMe=class extends zDe{constructor(e,t,o,n,r,s,l,c){super(e,t,r,o);this.storageService=o;this.instantiationService=n;this.contextMenuService=s;this.extensionService=l;this.contextService=c}create(e){super.create(e),this.viewPaneContainer=this._register(this.createViewPaneContainer(e)),this._register(this.viewPaneContainer.onTitleAreaUpdate(()=>this.updateTitleArea())),this.viewPaneContainer.create(e)}setVisible(e){super.setVisible(e),this.viewPaneContainer?.setVisible(e)}layout(e){this.viewPaneContainer?.layout(e)}setBoundarySashes(e){this.viewPaneContainer?.setBoundarySashes(e)}getOptimalWidth(){return this.viewPaneContainer?.getOptimalWidth()??0}openView(e,t){return this.viewPaneContainer?.openView(e,t)}getViewPaneContainer(){return this.viewPaneContainer}getActionsContext(){return this.getViewPaneContainer()?.getActionsContext()}getContextMenuActions(){return this.viewPaneContainer?.menuActions?.getContextMenuActions()??[]}getMenuIds(){let e=[];return this.viewPaneContainer?.menuActions&&(e.push(this.viewPaneContainer.menuActions.menuId),this.viewPaneContainer.isViewMergedWithContainer()&&e.push(this.viewPaneContainer.panes[0].menuActions.menuId)),e}getActions(){let e=[];if(this.viewPaneContainer?.menuActions&&(e.push(...this.viewPaneContainer.menuActions.getPrimaryActions()),this.viewPaneContainer.isViewMergedWithContainer())){let t=this.viewPaneContainer.panes[0];t.shouldShowFilterInHeader()&&e.push(NFt),e.push(...t.menuActions.getPrimaryActions())}return e}getSecondaryActions(){if(!this.viewPaneContainer?.menuActions)return[];let e=this.viewPaneContainer.isViewMergedWithContainer()?this.viewPaneContainer.panes[0].menuActions.getSecondaryActions():[],t=this.viewPaneContainer.menuActions.getSecondaryActions(),o=t.findIndex(n=>n instanceof id&&n.item.submenu===p8);if(o!==-1){let n=t[o];n.actions.some(({enabled:r})=>r)?t.length===1&&e.length===0?t=n.actions.slice():o!==0&&(t=[n,...t.slice(0,o),...t.slice(o+1)]):t.splice(o,1)}return t.length&&e.length?[...t,new oi,...e]:t.length?t:e}getActionViewItem(e,t){return this.viewPaneContainer?.getActionViewItem(e,t)}getTitle(){return this.viewPaneContainer?.getTitle()??""}focus(){super.focus(),this.viewPaneContainer?.focus()}};HMe=I([m(1,_e),m(2,de),m(3,F),m(4,Pe),m(5,Xe),m(6,lt),m(7,Ae)],HMe);var DVt=class a extends eNt{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r,s);this.iconUrl=l}static create(e,t,o,n,r,s,l){return new a(e,t,o,n,r,s,l)}},CW={Viewlets:"workbench.contributions.viewlets",Panels:"workbench.contributions.panels",Auxiliary:"workbench.contributions.auxiliary",ChatBar:"workbench.contributions.chatbar"},UMe=class extends tNt{registerPaneComposite(i){super.registerComposite(i)}deregisterPaneComposite(i){super.deregisterComposite(i)}getPaneComposite(i){return this.getComposite(i)}getPaneComposites(){return this.getComposites()}};oe.add(CW.Viewlets,new UMe);oe.add(CW.Panels,new UMe);oe.add(CW.Auxiliary,new UMe);oe.add(CW.ChatBar,new UMe);var RVt=class extends it{constructor(e,t){super("vs.tree.collapse",d(45,null),"collapse-all",t);this.viewer=e}async run(){this.viewer.collapseAll(),this.viewer.setSelection([]),this.viewer.setFocus([])}};function IEi(a){return Array.isArray(a.items)}function Igo(a){let i=a;return!!i.picks&&i.additionalPicks instanceof Promise}var cg=class extends k{constructor(e,t){super();this.prefix=e;this.options=t}provide(e,t,o){let n=new O;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let r,s=n.add(new ue),l=async()=>{r?.dispose(!0),e.busy=!1;let u=s.value=new O;r=u.add(new qe(t));let p=r.token,h=e.value.substring(this.prefix.length);this.options?.shouldSkipTrimPickFilter||(h=h.trim());let g=this._getPicks(h,u,p,o),f=(b,S)=>{let y,w;if(IEi(b)?(y=b.items,w=b.active):y=b,y.length===0){if(S)return!1;(h.length>0||e.hideInput)&&this.options?.noResultsPick&&(bL(this.options.noResultsPick)?y=[this.options.noResultsPick(h)]:y=[this.options.noResultsPick])}return e.items=y,w&&(e.activeItems=[w]),!0},v=async b=>{let S=!1,y=!1;await Promise.all([(async()=>{typeof b.mergeDelay=="number"&&(await Li(b.mergeDelay),p.isCancellationRequested)||y||(S=f(b.picks,!0))})(),(async()=>{e.busy=!0;try{let w=await b.additionalPicks;if(p.isCancellationRequested)return;let x,E;IEi(b.picks)?(x=b.picks.items,E=b.picks.active):x=b.picks;let M,N;if(IEi(w)?(M=w.items,N=w.active):M=w,M.length>0||!S){let V;if(!E&&!N){let H=e.activeItems[0];H&&x.indexOf(H)!==-1&&(V=H)}f({items:[...x,...M],active:E||N||V})}}finally{p.isCancellationRequested||(e.busy=!1),y=!0}})()])};if(g!==null)if(Igo(g))await v(g);else if(!(g instanceof Promise))f(g);else{e.busy=!0;try{let b=await g;if(p.isCancellationRequested)return;Igo(b)?await v(b):f(b)}finally{p.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>l())),l(),n.add(e.onDidAccept(u=>{if(o?.handleAccept){u.inBackground||e.hide(),o.handleAccept?.(e.activeItems[0],u.inBackground);return}let[p]=e.selectedItems;if(typeof p?.accept=="function"){if(Ceo(e.keyMods)&&!!p.attach){p.attach(e.keyMods,u);return}u.inBackground||e.hide(),p.accept(e.keyMods,u)}}));let c=async(u,p)=>{if(typeof p.trigger!="function")return;let h=p.buttons?.indexOf(u)??-1;if(h>=0){let g=p.trigger(h,e.keyMods),f=typeof g=="number"?g:await g;if(t.isCancellationRequested)return;switch(f){case 0:break;case 1:e.hide();break;case 2:l();break;case 3:{let v=e.items.indexOf(p);if(v!==-1){let b=e.items.slice(),S=b.splice(v,1),y=e.activeItems.filter(x=>x!==S[0]),w=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=b,y&&(e.activeItems=y),e.keepScrollPosition=w}break}}}};return n.add(e.onDidTriggerItemButton(({button:u,item:p})=>c(u,p))),n.add(e.onDidTriggerSeparatorButton(({button:u,separator:p})=>c(u,p))),n}};var zMe=new uo(()=>{let a=nd.Collator(void 0,{numeric:!0,sensitivity:"base"}).value;return{collator:a,collatorIsNumeric:a.resolvedOptions().numeric}}),KMe=new uo(()=>({collator:nd.Collator(void 0,{numeric:!0}).value})),yEi=new uo(()=>({collator:nd.Collator(void 0,{numeric:!0,sensitivity:"accent"}).value}));function C_(a,i,e=!1){let t=a||"",o=i||"",n=zMe.value.collator.compare(t,o);return zMe.value.collatorIsNumeric&&n===0&&t!==o?t<o?-1:1:n}function utt(a,i){let e=KMe.value.collator;return a=a||"",i=i||"",O8(e,a,i)}function wgo(a,i){let e=KMe.value.collator;return a=a||"",i=i||"",Lgo(a,i)||O8(e,a,i)}function Cgo(a,i){let e=KMe.value.collator;return a=a||"",i=i||"",Rgo(a,i)||O8(e,a,i)}function xgo(a,i){return a=a||"",i=i||"",a===i?0:a<i?-1:1}function wEi(a,i){let[e,t]=ygo(a),[o,n]=ygo(i),r=zMe.value.collator.compare(t,n);if(r===0){if(zMe.value.collatorIsNumeric&&t!==n)return t<n?-1:1;if(r=zMe.value.collator.compare(e,o),zMe.value.collatorIsNumeric&&r===0&&e!==o)return e<o?-1:1}return r}function kgo(a,i){a=a||"",i=i||"";let e=wte(a),t=wte(i),o=KMe.value.collator,n=yEi.value.collator;return O8(n,e,t)||O8(o,a,i)}function Ego(a,i){a=a||"",i=i||"";let e=wte(a),t=wte(i),o=KMe.value.collator,n=yEi.value.collator;return O8(n,e,t)||Lgo(a,i)||O8(o,a,i)}function Tgo(a,i){a=a||"",i=i||"";let e=wte(a),t=wte(i),o=KMe.value.collator,n=yEi.value.collator;return O8(n,e,t)||Rgo(a,i)||O8(o,a,i)}function _go(a,i){a=a||"",i=i||"";let e=wte(a).toLowerCase(),t=wte(i).toLowerCase();return e!==t?e<t?-1:1:a!==i?a<i?-1:1:0}var Dgo=/^(.*?)(\.([^.]*))?$/;function ygo(a,i=!1){let e=a?Dgo.exec(a):[],t=[e&&e[1]||"",e&&e[3]||""];return i&&(!t[0]&&t[1]||t[0]&&t[0].charAt(0)===".")&&(t=[t[0]+"."+t[1],""]),t}function wte(a){let i=a?Dgo.exec(a):[];return i&&i[1]&&i[1].charAt(0)!=="."&&i[3]||""}function O8(a,i,e){let t=a.compare(i,e);return t!==0?t:i.length!==e.length?i.length<e.length?-1:1:0}function LVt(a){let i=a.charAt(0);return i.toLocaleUpperCase()!==i}function MVt(a){let i=a.charAt(0);return i.toLocaleLowerCase()!==i}function Rgo(a,i){return LVt(a)&&MVt(i)?-1:MVt(a)&&LVt(i)?1:0}function Lgo(a,i){return MVt(a)&&LVt(i)?-1:LVt(a)&&MVt(i)?1:0}function Ntn(a,i,e=!1){return e||(a=a&&a.toLowerCase(),i=i&&i.toLowerCase()),a===i?0:a<i?-1:1}function Cte(a,i,e=!1){let t=a.split(Cu),o=i.split(Cu),n=t.length-1,r=o.length-1,s,l;for(let c=0;;c++){if(s=n===c,l=r===c,s&&l)return C_(t[c],o[c],e);if(s)return-1;if(l)return 1;let u=Ntn(t[c],o[c],e);if(u!==0)return u}}function GMe(a,i,e){let t=a.toLowerCase(),o=i.toLowerCase(),n=Otn(a,i,e);if(n)return n;let r=t.endsWith(e),s=o.endsWith(e);if(r!==s)return r?-1:1;let l=C_(t,o);return l!==0?l:t.localeCompare(o)}function Otn(a,i,e){let t=a.toLowerCase(),o=i.toLowerCase(),n=t.startsWith(e),r=o.startsWith(e);if(n!==r)return n?-1:1;if(n&&r){if(t.length<o.length)return-1;if(t.length>o.length)return 1}return 0}var AVt=0,Mgo=[AVt,[]];function Pgo(a,i,e,t){if(!a||!i)return Mgo;let o=a.length,n=i.length;if(o<n)return Mgo;let r=a.toLowerCase();return Ftn(i,e,n,a,r,o,t)}function Ftn(a,i,e,t,o,n,r){let s=[],l=[];for(let h=0;h<e;h++){let g=h*n,f=g-n,v=h>0,b=a[h],S=i[h];for(let y=0;y<n;y++){let w=y>0,x=g+y,E=x-1,M=f+y-1,N=w?s[E]:0,V=v&&w?s[M]:0,H=v&&w?l[M]:0,K;!V&&v?K=0:K=Wtn(b,S,t,o,y,H),K&&V+K>=N&&(r||v||o.startsWith(i,y))?(l[x]=H+1,s[x]=V+K):(l[x]=AVt,s[x]=N)}}let c=[],u=e-1,p=n-1;for(;u>=0&&p>=0;){let h=u*n+p;l[h]===AVt||(c.push(p),u--),p--}return[s[e*n-1],c.reverse()]}function Wtn(a,i,e,t,o,n){let r=0;if(!Vtn(i,t[o]))return r;if(r+=1,n>0&&(r+=Math.min(n,3)*6+Math.max(0,n-3)*3),a===e[o]&&(r+=1),o===0)r+=8;else{let s=Btn(e.charCodeAt(o-1));s?r+=s:mke(e.charCodeAt(o))&&n===0&&(r+=2)}return r}function Vtn(a,i){return a===i?!0:a==="/"||a==="\\"?i==="/"||i==="\\":!1}function Btn(a){switch(a){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 Wgo=[void 0,[]];function kte(a,i,e=0,t=0){let o=i;return o.values&&o.values.length>1?Htn(a,o.values,e,t):Vgo(a,i,e,t)}function Htn(a,i,e,t){let o=0,n=[];for(let r of i){let[s,l]=Vgo(a,r,e,t);if(typeof s!="number")return Wgo;o+=s,n.push(...l)}return[o,kEi(n)]}function Vgo(a,i,e,t){let o=eM(i.normalized,i.normalizedLowercase,e,a,a.toLowerCase(),t,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return o?[o[0],Wa(o)]:Wgo}var NVt=Object.freeze({score:0}),PVt=1<<18,CEi=1<<17,xEi=65536;function Utn(a,i,e,t){let o=t.values?t.values:[t];return Lr({[t.normalized]:{values:o.map(r=>({value:r.normalized,expectContiguousMatch:r.expectContiguousMatch})),label:a,description:i,allowNonContiguousMatches:e}})}function xte(a,i,e,t,o){if(!a||!i.normalized)return NVt;let n=t.getItemLabel(a);if(!n)return NVt;let r=t.getItemDescription(a),s=Utn(n,r,e,i),l=o[s];if(l)return l;let c=ztn(n,r,t.getItemPath(a),i,e);return o[s]=c,c}function ztn(a,i,e,t,o){let n=!e||!t.containsPathSeparator;return e&&(Sn?t.pathNormalized===e:xr(t.pathNormalized,e))?{score:PVt,labelMatch:[{start:0,end:a.length}],descriptionMatch:i?[{start:0,end:i.length}]:void 0}:t.values&&t.values.length>1?Ktn(a,i,e,t.values,n,o):Bgo(a,i,e,t,n,o)}function Ktn(a,i,e,t,o,n){let r=0,s=[],l=[];for(let c of t){let{score:u,labelMatch:p,descriptionMatch:h}=Bgo(a,i,e,c,o,n);if(u===AVt)return NVt;r+=u,p&&s.push(...p),h&&l.push(...h)}return{score:r,labelMatch:kEi(s),descriptionMatch:kEi(l)}}function Bgo(a,i,e,t,o,n){if(o||!i){let[r,s]=Pgo(a,t.normalized,t.normalizedLowercase,n&&!t.expectContiguousMatch);if(r){let l=bde(t.normalized,a),c;if(l){c=CEi;let u=Math.round(t.normalized.length/a.length*100);c+=u}else c=xEi;return{score:c+r,labelMatch:l||Ago(s)}}}if(i){let r=i;e&&(r=`${i}${Cu}`);let s=r.length,l=`${r}${a}`,[c,u]=Pgo(l,t.normalized,t.normalizedLowercase,n&&!t.expectContiguousMatch);if(c){let p=Ago(u),h=[],g=[];return p.forEach(f=>{f.start<s&&f.end>s?(h.push({start:0,end:f.end-s}),g.push({start:f.start,end:s})):f.start>=s?h.push({start:f.start-s,end:f.end-s}):g.push(f)}),{score:c,labelMatch:h,descriptionMatch:g}}}return NVt}function Ago(a){let i=[];if(!a)return i;let e;for(let t of a)e&&e.end===t?e.end+=1:(e={start:t,end:t+1},i.push(e));return i}function kEi(a){let i=a.sort((o,n)=>o.start-n.start),e=[],t;for(let o of i)!t||!Gtn(t,o)?(t=o,e.push(o)):(t.start=Math.min(t.start,o.start),t.end=Math.max(t.end,o.end));return e}function Gtn(a,i){return!(a.end<i.start||i.end<a.start)}function ptt(a,i,e,t,o,n){let r=xte(a,e,t,o,n),s=xte(i,e,t,o,n),l=r.score,c=s.score;if((l===PVt||c===PVt)&&l!==c)return l===PVt?-1:1;if(l>xEi||c>xEi){if(l!==c)return l>c?-1:1;if(l<CEi&&c<CEi){let b=qtn(r.labelMatch,s.labelMatch);if(b!==0)return b}let f=o.getItemLabel(a)||"",v=o.getItemLabel(i)||"";if(f.length!==v.length)return f.length-v.length}if(l!==c)return l>c?-1:1;let u=Array.isArray(r.labelMatch)&&r.labelMatch.length>0,p=Array.isArray(s.labelMatch)&&s.labelMatch.length>0;if(u&&!p)return-1;if(p&&!u)return 1;let h=Ngo(a,r,o),g=Ngo(i,s,o);return h&&g&&h!==g?g>h?-1:1:$tn(a,i,e,o)}function Ngo(a,i,e){let t=-1,o=-1;if(i.descriptionMatch?.length?t=i.descriptionMatch[0].start:i.labelMatch?.length&&(t=i.labelMatch[0].start),i.labelMatch?.length){if(o=i.labelMatch[i.labelMatch.length-1].end,i.descriptionMatch?.length){let n=e.getItemDescription(a);n&&(o+=n.length)}}else i.descriptionMatch?.length&&(o=i.descriptionMatch[i.descriptionMatch.length-1].end);return o-t}function qtn(a,i){if(!a&&!i||!a?.length&&!i?.length)return 0;if(!i?.length)return-1;if(!a?.length)return 1;let e=a[0].start,o=a[a.length-1].end-e,n=i[0].start,s=i[i.length-1].end-n;return o===s?0:s<o?1:-1}function $tn(a,i,e,t){let o=t.getItemLabel(a)||"",n=t.getItemLabel(i)||"",r=t.getItemDescription(a),s=t.getItemDescription(i),l=o.length+(r?r.length:0),c=n.length+(s?s.length:0);if(l!==c)return l-c;let u=t.getItemPath(a),p=t.getItemPath(i);return u&&p&&u.length!==p.length?u.length-p.length:o!==n?GMe(o,n,e.normalized):r&&s&&r!==s?GMe(r,s,e.normalized):u&&p&&u!==p?GMe(u,p,e.normalized):0}function Ogo(a){return a.startsWith('"')&&a.endsWith('"')}var Hgo=" ";function xW(a){typeof a!="string"&&(a="");let i=a.toLowerCase(),{pathNormalized:e,normalized:t,normalizedLowercase:o}=Fgo(a),n=e.indexOf(Cu)>=0,r=Ogo(a),s,l=a.split(Hgo);if(l.length>1)for(let c of l){let u=Ogo(c),{pathNormalized:p,normalized:h,normalizedLowercase:g}=Fgo(c);h&&(s||(s=[]),s.push({original:c,originalLowercase:c.toLowerCase(),pathNormalized:p,normalized:h,normalizedLowercase:g,expectContiguousMatch:u}))}return{original:a,originalLowercase:i,pathNormalized:e,normalized:t,normalizedLowercase:o,values:s,containsPathSeparator:n,expectContiguousMatch:r}}function Fgo(a){let i;ii?i=a.replace(/\//g,Cu):i=a.replace(/\\/g,Cu);let e=i.replace(/[\*\u2026\s"]/g,"").replace(/(?<=.)#$/,"");return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function qMe(a){return Array.isArray(a)?xW(a.map(i=>i.original).join(Hgo)):xW(a.original)}var Ihe=class extends cg{constructor(e,t,o,n,r){super(e,{canAcceptInBackground:!0,noResultsPick:{label:d(4887,null),groupId:-1}});this.editorGroupService=t;this.editorService=o;this.modelService=n;this.languageService=r;this.pickState=new class{constructor(){this.scorerCache=Object.create(null);this.isQuickNavigating=void 0}reset(e){e||(this.scorerCache=Object.create(null)),this.isQuickNavigating=e}}}provide(e,t){return this.pickState.reset(!!e.quickNavigate),super.provide(e,t)}_getPicks(e){let t=xW(e),o=this.doGetEditorPickItems().filter(r=>{if(!t.normalized)return!0;let s=xte(r,t,!0,rJ,this.pickState.scorerCache);return s.score?(r.highlights={label:s.labelMatch,description:s.descriptionMatch},!0):!1});if(t.normalized){let r=this.editorGroupService.getGroups(2).map(s=>s.id);o.sort((s,l)=>s.groupId!==l.groupId?r.indexOf(s.groupId)-r.indexOf(l.groupId):ptt(s,l,t,!0,rJ,this.pickState.scorerCache))}let n=[];if(this.editorGroupService.count>1){let r;for(let s of o){if(typeof r!="number"||r!==s.groupId){let l=this.editorGroupService.getGroup(s.groupId);l&&n.push({type:"separator",label:l.label}),r=s.groupId}n.push(s)}}else n.push(...o);return n}doGetEditorPickItems(){let e=this.doGetEditors(),t=new Map;for(let{groupId:o}of e)if(!t.has(o)){let n=this.editorGroupService.getGroup(o);n&&t.set(o,n.ariaLabel)}return this.doGetEditors().map(({editor:o,groupId:n})=>{let r=po.getOriginalUri(o,{supportSideBySide:1}),s=o.isDirty()&&!o.isSaving(),l=o.getDescription(),c=l?`${o.getName()} ${l}`:o.getName(),u=o.getIcon();return{groupId:n,resource:r,label:o.getName(),ariaLabel:t.size>1?s?d(4886,null,c,t.get(n)):d(4885,null,c,t.get(n)):s?d(4884,null,c):c,description:l,iconPath:A.isUri(u)?{dark:u}:void 0,iconClasses:Ia(this.modelService,this.languageService,r,void 0,u).concat(o.getLabelExtraClasses()),italic:!this.editorGroupService.getGroup(n)?.isPinned(o),buttons:[{iconClass:s?"dirty-editor "+q.asClassName(L.closeDirty):q.asClassName(L.close),tooltip:d(4883,null),alwaysVisible:s}],trigger:async()=>{let p=this.editorGroupService.getGroup(n);return p&&(await p.closeEditor(o,{preserveFocus:!0}),!p.contains(o))?3:0},accept:(p,h)=>this.editorGroupService.getGroup(n)?.openEditor(o,{preserveFocus:h.inBackground})}})}};Ihe=I([m(1,kt),m(2,ie),m(3,_t),m(4,Rt)],Ihe);var ER=class extends Ihe{static{this.PREFIX="edt active "}constructor(i,e,t,o){super(ER.PREFIX,i,e,t,o)}doGetEditors(){let i=this.editorGroupService.activeGroup;return i.getEditors(0).map(e=>({editor:e,groupId:i.id}))}};ER=I([m(0,kt),m(1,ie),m(2,_t),m(3,Rt)],ER);var hU=class extends Ihe{static{this.PREFIX="edt "}constructor(i,e,t,o){super(hU.PREFIX,i,e,t,o)}doGetEditors(){let i=[];for(let e of this.editorGroupService.getGroups(2))for(let t of e.getEditors(1))i.push({editor:t,groupId:e.id});return i}};hU=I([m(0,kt),m(1,ie),m(2,_t),m(3,Rt)],hU);var WN=class extends Ihe{static{this.PREFIX="edt mru "}constructor(i,e,t,o){super(WN.PREFIX,i,e,t,o)}doGetEditors(){let i=[];for(let e of this.editorService.getEditors(0))i.push(e);return i}};WN=I([m(0,kt),m(1,ie),m(2,_t),m(3,Rt)],WN);function jtn(a){let i=a;return typeof i?.primary=="object"&&typeof i.secondary=="object"}var iv=class extends Y0{constructor(e,t,o,n,r,s,l,c,u){super(iv.ID,e,iv.VIEW_STATE_PREFERENCE_KEY,t,o,r,l,n,c,u);this.configurationService=s;this.onDidCreateEditors=this._register(new T);this._onDidChangeSizeConstraints=this._register(new Ig);this.onDidChangeSizeConstraints=U.any(this.onDidCreateEditors.event,this._onDidChangeSizeConstraints.event);this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this.primaryEditorPane=void 0;this.secondaryEditorPane=void 0;this.splitviewDisposables=this._register(new O);this.editorDisposables=this._register(new O);this.dimension=new di(0,0);this.lastFocusedSide=void 0;this.orientation=this.configurationService.getValue(iv.SIDE_BY_SIDE_LAYOUT_SETTING)==="vertical"?0:1,this.registerListeners()}static{this.ID=_so}static{this.SIDE_BY_SIDE_LAYOUT_SETTING="workbench.editor.splitInGroupLayout"}static{this.VIEW_STATE_PREFERENCE_KEY="sideBySideEditorViewState"}get minimumPrimaryWidth(){return this.primaryEditorPane?this.primaryEditorPane.minimumWidth:0}get maximumPrimaryWidth(){return this.primaryEditorPane?this.primaryEditorPane.maximumWidth:Number.POSITIVE_INFINITY}get minimumPrimaryHeight(){return this.primaryEditorPane?this.primaryEditorPane.minimumHeight:0}get maximumPrimaryHeight(){return this.primaryEditorPane?this.primaryEditorPane.maximumHeight:Number.POSITIVE_INFINITY}get minimumSecondaryWidth(){return this.secondaryEditorPane?this.secondaryEditorPane.minimumWidth:0}get maximumSecondaryWidth(){return this.secondaryEditorPane?this.secondaryEditorPane.maximumWidth:Number.POSITIVE_INFINITY}get minimumSecondaryHeight(){return this.secondaryEditorPane?this.secondaryEditorPane.minimumHeight:0}get maximumSecondaryHeight(){return this.secondaryEditorPane?this.secondaryEditorPane.maximumHeight:Number.POSITIVE_INFINITY}set minimumWidth(e){}set maximumWidth(e){}set minimumHeight(e){}set maximumHeight(e){}get minimumWidth(){return this.minimumPrimaryWidth+this.minimumSecondaryWidth}get maximumWidth(){return this.maximumPrimaryWidth+this.maximumSecondaryWidth}get minimumHeight(){return this.minimumPrimaryHeight+this.minimumSecondaryHeight}get maximumHeight(){return this.maximumPrimaryHeight+this.maximumSecondaryHeight}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onConfigurationUpdated(e){e.affectsConfiguration(iv.SIDE_BY_SIDE_LAYOUT_SETTING)&&(this.orientation=this.configurationService.getValue(iv.SIDE_BY_SIDE_LAYOUT_SETTING)==="vertical"?0:1,this.splitview&&this.recreateSplitview())}recreateSplitview(){let e=Ti(this.getContainer()),t=this.getSplitViewRatio();this.splitview&&(this.splitview.el.remove(),this.splitviewDisposables.clear()),this.createSplitView(e,t),this.layout(this.dimension)}getSplitViewRatio(){let e;if(this.splitview){let t=this.splitview.getViewSize(0),o=this.splitview.getViewSize(1);if(Math.abs(t-o)>1){let n=this.splitview.orientation===1?this.dimension.width:this.dimension.height;e=t/n}}return e}createEditor(e){e.classList.add("side-by-side-editor"),this.secondaryEditorContainer=_(".side-by-side-editor-container.editor-instance"),this.primaryEditorContainer=_(".side-by-side-editor-container.editor-instance"),this.createSplitView(e)}createSplitView(e,t){this.splitview=this.splitviewDisposables.add(new Gp(e,{orientation:this.orientation})),this.splitviewDisposables.add(this.splitview.onDidSashReset(()=>this.splitview?.distributeViewSizes())),this.orientation===1?this.splitview.orthogonalEndSash=this._boundarySashes?.bottom:(this.splitview.orthogonalStartSash=this._boundarySashes?.left,this.splitview.orthogonalEndSash=this._boundarySashes?.right);let o=Ac.Distribute,n=Ac.Distribute;if(t){let l=this.splitview.orientation===1?this.dimension.width:this.dimension.height;o=Math.round(l*t),n=l-o,this.splitview.layout(this.orientation===1?this.dimension.width:this.dimension.height)}let r=Ti(this.secondaryEditorContainer);this.splitview.addView({element:r,layout:l=>this.layoutPane(this.secondaryEditorPane,l),minimumSize:this.orientation===1?c_.width:c_.height,maximumSize:Number.POSITIVE_INFINITY,onDidChange:U.None},o);let s=Ti(this.primaryEditorContainer);this.splitview.addView({element:s,layout:l=>this.layoutPane(this.primaryEditorPane,l),minimumSize:this.orientation===1?c_.width:c_.height,maximumSize:Number.POSITIVE_INFINITY,onDidChange:U.None},n),this.updateStyles()}getTitle(){return this.input?this.input.getName():d(4957,null)}async setInput(e,t,o,n){let r=this.input;await super.setInput(e,t,o,n),(!r||!e.matches(r))&&(r&&this.disposeEditors(),this.createEditors(e));let{primary:s,secondary:l,viewState:c}=this.loadViewState(e,t,o);if(this.lastFocusedSide=c?.focus,typeof c?.ratio=="number"&&this.splitview){let u=this.splitview.orientation===1?this.dimension.width:this.dimension.height;this.splitview.resizeView(0,Math.round(u*c.ratio))}else this.splitview?.distributeViewSizes();await Promise.all([this.secondaryEditorPane?.setInput(e.secondary,l,o,n),this.primaryEditorPane?.setInput(e.primary,s,o,n)]),typeof t?.target=="number"&&(this.lastFocusedSide=t.target)}loadViewState(e,t,o){let n=jtn(t?.viewState)?t?.viewState:this.loadEditorViewState(e,o),r=Object.create(null),s;return t?.target===2?s={...t}:r={...t},r.viewState=n?.primary,n?.secondary&&(s?s.viewState=n?.secondary:s={viewState:n.secondary}),{primary:r,secondary:s,viewState:n}}createEditors(e){this.secondaryEditorPane=this.doCreateEditor(e.secondary,Ti(this.secondaryEditorContainer)),this.primaryEditorPane=this.doCreateEditor(e.primary,Ti(this.primaryEditorContainer)),this.layout(this.dimension),this._onDidChangeSizeConstraints.input=U.any(U.map(this.secondaryEditorPane.onDidChangeSizeConstraints,()=>{}),U.map(this.primaryEditorPane.onDidChangeSizeConstraints,()=>{})),this.onDidCreateEditors.fire(void 0),this.editorDisposables.add(this.primaryEditorPane.onDidFocus(()=>this.onDidFocusChange(1))),this.editorDisposables.add(this.secondaryEditorPane.onDidFocus(()=>this.onDidFocusChange(2)))}doCreateEditor(e,t){let o=oe.as(en.EditorPane).getEditorPane(e);if(!o)throw new Error("No editor pane descriptor for editor found");let n=o.instantiate(this.instantiationService,this.group);return n.create(t),n.setVisible(this.isVisible()),bpe(n)&&this.editorDisposables.add(n.onDidChangeSelection(r=>this._onDidChangeSelection.fire(r))),this.editorDisposables.add(n),n}onDidFocusChange(e){this.lastFocusedSide=e,this._onDidChangeControl.fire()}getSelection(){let e=this.getLastFocusedEditorPane();if(bpe(e)){let t=e.getSelection();if(t)return new EEi(t,e===this.primaryEditorPane?1:2)}}setOptions(e){super.setOptions(e),typeof e?.target=="number"&&(this.lastFocusedSide=e.target),this.getLastFocusedEditorPane()?.setOptions(e)}setEditorVisible(e){this.primaryEditorPane?.setVisible(e),this.secondaryEditorPane?.setVisible(e),super.setEditorVisible(e)}clearInput(){super.clearInput(),this.primaryEditorPane?.clearInput(),this.secondaryEditorPane?.clearInput(),this.disposeEditors()}focus(){super.focus(),this.getLastFocusedEditorPane()?.focus()}getLastFocusedEditorPane(){return this.lastFocusedSide===2?this.secondaryEditorPane:this.primaryEditorPane}layout(e){this.dimension=e,Ti(this.splitview).layout(this.orientation===1?e.width:e.height)}setBoundarySashes(e){this._boundarySashes=e,this.splitview&&(this.splitview.orthogonalEndSash=e.bottom)}layoutPane(e,t){e?.layout(this.orientation===1?new di(t,this.dimension.height):new di(this.dimension.width,t))}getControl(){return this.getLastFocusedEditorPane()?.getControl()}getPrimaryEditorPane(){return this.primaryEditorPane}getSecondaryEditorPane(){return this.secondaryEditorPane}tracksEditorViewState(e){return e instanceof ja}computeEditorViewState(e){if(!this.input||!ze(e,this.toEditorViewStateResource(this.input)))return;let t=this.primaryEditorPane?.getViewState(),o=this.secondaryEditorPane?.getViewState();if(!(!t||!o))return{primary:t,secondary:o,focus:this.lastFocusedSide,ratio:this.getSplitViewRatio()}}toEditorViewStateResource(e){let t,o;if(e instanceof ja&&(t=e.primary.resource,o=e.secondary.resource),!(!o||!t))return A.from({scheme:"sideBySide",path:`${dY(o.toString())}${dY(t.toString())}`})}updateStyles(){super.updateStyles(),this.primaryEditorContainer&&(this.orientation===1?(this.primaryEditorContainer.style.borderLeftWidth="1px",this.primaryEditorContainer.style.borderLeftStyle="solid",this.primaryEditorContainer.style.borderLeftColor=this.getColor(Vro)??"",this.primaryEditorContainer.style.borderTopWidth="0"):(this.primaryEditorContainer.style.borderTopWidth="1px",this.primaryEditorContainer.style.borderTopStyle="solid",this.primaryEditorContainer.style.borderTopColor=this.getColor(Wro)??"",this.primaryEditorContainer.style.borderLeftWidth="0"))}dispose(){this.disposeEditors(),super.dispose()}disposeEditors(){this.editorDisposables.clear(),this.secondaryEditorPane=void 0,this.primaryEditorPane=void 0,this.lastFocusedSide=void 0,this.secondaryEditorContainer&&St(this.secondaryEditorContainer),this.primaryEditorContainer&&St(this.primaryEditorContainer)}};iv=I([m(1,_e),m(2,F),m(3,Pe),m(4,de),m(5,B),m(6,Gn),m(7,ie),m(8,kt)],iv);var EEi=class a{constructor(i,e){this.selection=i;this.side=e}compare(i){return i instanceof a?this.side!==i.side?3:this.selection.compare(i.selection):3}restore(i){let e={...i,target:this.side};return this.selection.restore(e)}};function x_(a,i,e){let t=!1,o=Qtn(a);if(f3(o)&&(i.restoreViewState(o),t=!0),a.selection){let n={startLineNumber:a.selection.startLineNumber,startColumn:a.selection.startColumn,endLineNumber:a.selection.endLineNumber??a.selection.startLineNumber,endColumn:a.selection.endColumn??a.selection.startColumn};i.setSelection(n,a.selectionSource??"code.navigation"),a.selectionRevealType===2?i.revealRangeNearTop(n,e):a.selectionRevealType===3?i.revealRangeNearTopIfOutsideViewport(n,e):a.selectionRevealType===1?i.revealRangeInCenterIfOutsideViewport(n,e):i.revealRangeInCenter(n,e),t=!0}return t}function Qtn(a){if(!a.selection||!a.viewState)return a.viewState;let i=a.viewState;if(i.modified)return i.modified.cursorState=[],i;let e=a.viewState;return e.cursorState&&(e.cursorState=[]),e}var TR=class extends KM{constructor(e,t,o,n,r,s,l,c,u,p){super(TR.ID,e,t,o,n,r,l,s,c,u);this.preferencesService=p;this.diffEditorControl=void 0;this.inputLifecycleStopWatch=void 0;this._previousViewModel=null}static{this.ID=hZ}get scopedContextKeyService(){if(!this.diffEditorControl)return;let e=this.diffEditorControl.getOriginalEditor(),t=this.diffEditorControl.getModifiedEditor();return(e.hasTextFocus()?e:t).invokeWithinContext(o=>o.get(X))}getTitle(){return this.input?this.input.getName():d(4961,null)}createEditorControl(e,t){this.diffEditorControl=this._register(this.instantiationService.createInstance(_p,e,t,{}))}updateEditorControlOptions(e){this.diffEditorControl?.updateOptions(e)}getMainControl(){return this.diffEditorControl?.getModifiedEditor()}async setInput(e,t,o,n){this._previousViewModel&&(this._previousViewModel.dispose(),this._previousViewModel=null),this.inputLifecycleStopWatch=void 0,await super.setInput(e,t,o,n);try{let r=await e.resolve();if(n.isCancellationRequested)return;if(!(r instanceof $De)){this.openAsBinary(e,t);return}let s=Ti(this.diffEditorControl),l=r,c=l.textDiffEditorModel?s.createViewModel(l.textDiffEditorModel):null;this._previousViewModel=c,await c?.waitForDiff(),s.setModel(c);let u=!1;f3(t?.viewState)||(u=this.restoreTextDiffEditorViewState(e,t,o,s));let p=!1;t&&(p=x_(t,s,1)),!p&&!u&&s.revealFirstDiff(),s.updateOptions({...this.getReadonlyConfiguration(l.modifiedModel?.isReadonly()),originalEditable:!l.originalModel?.isReadonly()}),s.handleInitialized(),this.inputLifecycleStopWatch=new On(!1)}catch(r){await this.handleSetInputError(r,e,t)}}async handleSetInputError(e,t,o){if(this.isFileBinaryError(e))return this.openAsBinary(t,o);if(e.fileOperationResult===7){let n;throw e instanceof NF?n=d(4960,null,Ml.formatSize(e.size)):n=d(4959,null),A_e(this.group,t,o,n,this.preferencesService)}throw e}restoreTextDiffEditorViewState(e,t,o,n){let r=this.loadEditorViewState(e,o);return r?(t?.selection&&r.modified&&(r.modified.cursorState=[]),n.restoreViewState(r),t?.revealIfVisible&&n.revealFirstDiff(),!0):!1}openAsBinary(e,t){let o=e.original,n=e.modified,r=this.instantiationService.createInstance(Ba,e.getName(),e.getDescription(),o,n,!0),s=oe.as(en.EditorFactory).getFileEditorFactory();s.isFileEditor(o)&&o.setForceOpenAsBinary(),s.isFileEditor(n)&&n.setForceOpenAsBinary(),this.group.replaceEditors([{editor:e,replacement:r,options:{...t,activation:3,pinned:this.group.isPinned(e),sticky:this.group.isSticky(e)}}])}setOptions(e){super.setOptions(e),e&&x_(e,Ti(this.diffEditorControl),0)}shouldHandleConfigurationChangeEvent(e,t){return super.shouldHandleConfigurationChangeEvent(e,t)?!0:e.affectsConfiguration(t,"diffEditor")||e.affectsConfiguration(t,"accessibility.verbosity.diffEditor")}computeConfiguration(e){let t=super.computeConfiguration(e);if(Di(e.diffEditor)){let n=io(e.diffEditor);n.diffCodeLens=n.codeLens,delete n.codeLens,n.diffWordWrap=n.wordWrap,delete n.wordWrap,Object.assign(t,n)}let o=e.accessibility?.verbosity?.diffEditor??!1;return t.accessibilityVerbose=o,t}getConfigurationOverrides(e){return{...super.getConfigurationOverrides(e),...this.getReadonlyConfiguration(this.input?.isReadonly()),originalEditable:this.input instanceof Ba&&!this.input.original.isReadonly(),lineDecorationsWidth:"2ch"}}updateReadonly(e){e instanceof Ba?this.diffEditorControl?.updateOptions({...this.getReadonlyConfiguration(e.isReadonly()),originalEditable:!e.original.isReadonly()}):super.updateReadonly(e)}isFileBinaryError(e){return Array.isArray(e)?e.some(o=>this.isFileBinaryError(o)):e.textFileOperationResult===0}clearInput(){this._previousViewModel&&(this._previousViewModel.dispose(),this._previousViewModel=null),super.clearInput();let e=this.inputLifecycleStopWatch?.elapsed();this.inputLifecycleStopWatch=void 0,typeof e=="number"&&this.logInputLifecycleTelemetry(e,this.getControl()?.getModel()?.modified?.getLanguageId()),this.diffEditorControl?.setModel(null)}logInputLifecycleTelemetry(e,t){let o=!1;this.diffEditorControl instanceof _p&&(o=this.diffEditorControl.collapseUnchangedRegions),this.telemetryService.publicLog2("diffEditor.editorVisibleTime",{editorVisibleTimeMs:e,languageId:t??"",collapseUnchangedRegions:o})}getControl(){return this.diffEditorControl}focus(){super.focus(),this.diffEditorControl?.focus()}hasFocus(){return this.diffEditorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.diffEditorControl?.onVisible():this.diffEditorControl?.onHide()}layout(e){this.diffEditorControl?.layout(e)}setBoundarySashes(e){this.diffEditorControl?.setBoundarySashes(e)}tracksEditorViewState(e){return e instanceof Ba}computeEditorViewState(e){if(!this.diffEditorControl)return;let t=this.diffEditorControl.getModel();if(!t?.modified||!t.original)return;let o=this.toEditorViewStateResource(t);if(o&&ze(o,e))return this.diffEditorControl.saveViewState()??void 0}toEditorViewStateResource(e){let t,o;if(e instanceof Ba?(t=e.original.resource,o=e.modified.resource):ya(e)||(t=e.original.uri,o=e.modified.uri),!(!t||!o))return A.from({scheme:"diff",path:`${dY(t.toString())}${dY(o.toString())}`})}};TR=I([m(1,_e),m(2,F),m(3,de),m(4,Gn),m(5,ie),m(6,Pe),m(7,kt),m(8,ge),m(9,Qo)],TR);var OVt="toggle.diff.renderSideBySide",FVt="workbench.action.compareEditor.nextChange",WVt="workbench.action.compareEditor.previousChange",_Ei="workbench.action.compareEditor.focusPrimarySide",DEi="workbench.action.compareEditor.focusSecondarySide",REi="workbench.action.compareEditor.focusOtherSide",Ugo="workbench.action.compareEditor.openSide",LEi="toggle.diff.ignoreTrimWhitespace",VVt="workbench.action.compareEditor.swapSides";function zgo(){xt.registerCommandAndKeybindingRule({id:Ugo,weight:200,when:me.inDiffEditor,primary:Gi(2089,1069),handler:async l=>{let c=l.get(ie),u=c.activeEditor,p=c.activeTextEditorControl;if(!Lc(p)||!(u instanceof Ba))return;let h;return p.getOriginalEditor().hasTextFocus()?h=u.original:h=u.modified,c.openEditor(h)}}),be.appendMenuItem(R.CommandPalette,{command:{id:Ugo,title:P(4541,"Open Active Diff Side")}}),xt.registerCommandAndKeybindingRule({id:FVt,weight:200,when:IYe,primary:575,handler:(l,...c)=>e(l,c,!0)}),be.appendMenuItem(R.CommandPalette,{command:{id:FVt,title:P(4540,"Go to Next Change")}}),xt.registerCommandAndKeybindingRule({id:WVt,weight:200,when:IYe,primary:1599,handler:(l,...c)=>e(l,c,!1)}),be.appendMenuItem(R.CommandPalette,{command:{id:WVt,title:P(4542,"Go to Previous Change")}});function a(l,c){let u=l.get(ie),p=c.length>0&&c[0]instanceof A?c[0]:void 0;for(let h of[u.activeEditorPane,...u.visibleEditorPanes])if(h instanceof TR&&(!p||h.input instanceof Ba&&ze(h.input.primary.resource,p)))return h}function i(l,c){let p=a(l,c)?.getControl()?.getModifiedEditor()?.getModel();if(p)return p.uri;let h=l.get(ie),g=l.get(X),f=c.length>0&&c[0]instanceof A?c[0]:void 0;if(Epe.getValue(g)){let v=po.getOriginalUri(h.activeEditor,{supportSideBySide:1});if(v&&(!f||ze(v,f)))return v}for(let v of[h.activeEditor,...h.visibleEditors])if(qD(v)&&v.modified.resource&&(!f||ze(v.modified.resource,f)))return v.modified.resource}function e(l,c,u){let p=a(l,c);p&&p.getControl()?.goToDiff(u?"next":"previous")}let t;(p=>(p[p.Original=0]="Original",p[p.Modified=1]="Modified",p[p.Toggle=2]="Toggle"))(t||={});function o(l,c,u){let p=a(l,c);if(p)switch(u){case 0:p.getControl()?.getOriginalEditor().focus();break;case 1:p.getControl()?.getModifiedEditor().focus();break;case 2:return p.getControl()?.getModifiedEditor().hasWidgetFocus()?o(l,c,0):o(l,c,1)}}function n(l,c){let u=l.get(Gn),p=i(l,c);if(!p)return;let h="diffEditor.renderSideBySide",g=u.getValue(p,h);u.updateValue(p,h,!g)}function r(l,c){let u=l.get(Gn),h=a(l,c)?.getControl()?.getModifiedEditor()?.getModel();if(!h)return;let g="diffEditor.ignoreTrimWhitespace",f=u.getValue(h.uri,g);u.updateValue(h.uri,g,!f)}async function s(l,c){let u=l.get(ie),p=a(l,c),h=p?.group,g=p?.input;if(!p||typeof h>"u"||!(g instanceof Ba)||!g.modified.resource)return;let f=g.toUntyped({preserveViewState:h.id,preserveResource:!0});if(f){if(g.modified.isModified()&&u.findEditors({resource:g.modified.resource,typeId:g.modified.typeId,editorId:g.modified.editorId}).length===0){let v={...f.modified};v.options||(v.options={}),v.options.pinned=!0,v.options.inactive=!0,await u.openEditor(v,h)}await u.replaceEditors([{editor:g,replacement:{...f,original:f.modified,modified:f.original,options:{...f.options,pinned:!0}}}],h)}}xt.registerCommandAndKeybindingRule({id:OVt,weight:200,when:void 0,primary:void 0,handler:(l,...c)=>n(l,c)}),xt.registerCommandAndKeybindingRule({id:_Ei,weight:200,when:void 0,primary:void 0,handler:(l,...c)=>o(l,c,1)}),xt.registerCommandAndKeybindingRule({id:DEi,weight:200,when:void 0,primary:void 0,handler:(l,...c)=>o(l,c,0)}),xt.registerCommandAndKeybindingRule({id:REi,weight:200,when:void 0,primary:void 0,handler:(l,...c)=>o(l,c,2)}),xt.registerCommandAndKeybindingRule({id:LEi,weight:200,when:void 0,primary:void 0,handler:(l,...c)=>r(l,c)}),xt.registerCommandAndKeybindingRule({id:VVt,weight:200,when:void 0,primary:void 0,handler:(l,...c)=>s(l,c)}),be.appendMenuItem(R.CommandPalette,{command:{id:OVt,title:P(4544,"Toggle Inline View"),category:d(4539,null)},when:C.or(GS,Epe)}),be.appendMenuItem(R.CommandPalette,{command:{id:VVt,title:P(4543,"Swap Left and Right Editor Side"),category:d(4539,null)},when:C.and(GS,G_e)})}function Zp(a,i,e,t){let o=Ytn(a,i,e,t),n=o.length&&o[0].preserveFocus||!1,r={groupedEditors:[],preserveFocus:n};for(let s of o){let l=Ztn(s,e);if(!l)continue;let{group:c,editor:u}=l,p;for(let h of r.groupedEditors)if(h.group.id===c.id){p=h;break}p||(p={group:c,editors:[]},r.groupedEditors.push(p)),u&&p.editors.push(u)}return r}function Ytn(a,i,e,t){let o=t.lastFocusedList,n=o instanceof Gc&&o.getHTMLElement()===Un(),r=Jtn(a,n,i,e,t);if(!r){let c=e.activeModalEditorPart?.activeGroup??e.activeGroup,u=c.activeEditor;r={groupId:c.id,editorIndex:u?c.getIndexOfEditor(u):void 0},n=!1}let s=Kgo(r,n,i,e,t);return Xtn(r,s)}function Xtn(a,i){if(i.length<=1)return i;let e=i.findIndex(t=>t.groupId===a.groupId&&t.editorIndex===a.editorIndex);if(e!==-1)i.splice(e,1),i.unshift(a);else if(a.editorIndex===void 0)i.unshift(a);else throw new Error("Editor context not found in multi editor context");return i}function Jtn(a,i,e,t,o){let n=a.filter(r=>Spe(r)||A.isUri(r));for(let r of n)if(Spe(r))return r;for(let r of n){let s=e.findEditors(r);if(s.length){let l=s[0],c=t.getGroup(l.groupId);return{groupId:l.groupId,editorIndex:c?.getIndexOfEditor(l.editor)}}}if(i){let r=o.lastFocusedList;for(let s of r.getFocusedElements())if(Ggo(s))return MEi(s,void 0,t)}}function Kgo(a,i,e,t,o){if(i){let r=o.lastFocusedList.getSelectedElements().filter(Ggo);if(r.length>1)return r.map(s=>MEi(s,a.preserveFocus,t));if(r.length===0)return Kgo(a,!1,e,t,o)}else{let n=t.getGroup(a.groupId),r=a.editorIndex!==void 0?n?.getEditorByIndex(a.editorIndex):n?.activeEditor;if(n&&r&&n.isSelected(r))return n.selectedEditors.map(s=>MEi({editor:s,groupId:n.id},a.preserveFocus,t))}return[a]}function MEi(a,i,e){if(Ipe(a))return{groupId:a.id,editorIndex:void 0,preserveFocus:i};let t=e.getGroup(a.groupId);return{groupId:a.groupId,editorIndex:t?t.getIndexOfEditor(a.editor):-1,preserveFocus:i}}function Ggo(a){return Ipe(a)||uYe(a)}function Ztn(a,i){let e=i.getGroup(a.groupId);if(!e)return;if(a.editorIndex===void 0)return{group:e,editor:void 0};let t=e.getEditorByIndex(a.editorIndex);return{group:e,editor:t}}var whe="workbench.action.closeUnmodifiedEditors",F8="workbench.action.closeEditorsInGroup",mtt="workbench.action.closeEditorsAndGroup",BVt="workbench.action.closeEditorsToTheRight",ok="workbench.action.closeActiveEditor",PEi="workbench.action.closeActivePinnedEditor",HVt="workbench.action.closeGroup",$Me="workbench.action.closeOtherEditors",BG="moveActiveEditor",HG="copyActiveEditor",UG="layoutEditorGroups",UVt="workbench.action.keepEditor",AEi="workbench.action.toggleKeepEditors",zVt="workbench.action.toggleEditorGroupLock",KVt="workbench.action.lockEditorGroup",W8="workbench.action.unlockEditorGroup",NEi="workbench.action.showEditorsInGroup",jMe="workbench.action.reopenWithEditor",OEi="reopenActiveEditorWith",GVt="workbench.action.pinEditor",V8="workbench.action.unpinEditor",Ete="workbench.action.splitEditor",B8="workbench.action.splitEditorUp",zG="workbench.action.splitEditorDown",H8="workbench.action.splitEditorLeft",KG="workbench.action.splitEditorRight",QMe="workbench.action.moveEditorToAboveGroup",YMe="workbench.action.moveEditorToBelowGroup",XMe="workbench.action.moveEditorToLeftGroup",JMe="workbench.action.moveEditorToRightGroup",ZMe="workbench.action.toggleMaximizeEditorGroup",qVt="workbench.action.splitEditorInGroup",ein="workbench.action.toggleSplitEditorInGroup",$Vt="workbench.action.joinEditorInGroup",FEi="workbench.action.toggleSplitEditorInGroupLayout",WEi="workbench.action.focusFirstSideEditor",VEi="workbench.action.focusSecondSideEditor",tin="workbench.action.focusOtherSideEditor",iin="workbench.action.focusLeftGroupWithoutWrap",oin="workbench.action.focusRightGroupWithoutWrap",nin="workbench.action.focusAboveGroupWithoutWrap",rin="workbench.action.focusBelowGroupWithoutWrap",qgo="workbench.action.openEditorAtIndex",htt="workbench.action.moveEditorToNewWindow",gtt="workbench.action.copyEditorToNewWindow",jVt="workbench.action.moveEditorGroupToNewWindow",QVt="workbench.action.copyEditorGroupToNewWindow",YVt="workbench.action.newEmptyEditorWindow",BEi="workbench.action.closeModalEditor",HEi="workbench.action.moveModalEditorToMain",UEi="workbench.action.moveModalEditorToWindow",zEi="workbench.action.toggleModalEditorMaximized",KEi="workbench.action.navigateModalEditorPrevious",GEi="workbench.action.navigateModalEditorNext",XVt="workbench.action.toggleModalEditorSidebar",Xg="_workbench.open",ik="_workbench.diff",sin="_workbench.openWith",JVt=[Ete,ok,V8,W8,ZMe],$go=function(a){return!(!Di(a)||!We(a.to)||!bn(a.by)&&!We(a.by)||!bn(a.value)&&!on(a.value))};function ain(){let a={type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right"]},by:{type:"string",enum:["tab","group"]},value:{type:"number"}}};xt.registerCommandAndKeybindingRule({id:BG,weight:200,when:me.editorTextFocus,primary:0,handler:(n,r)=>i(!0,r,n),metadata:{description:d(4821,null),args:[{name:d(4820,null),description:d(4819,null),constraint:$go,schema:a}]}}),xt.registerCommandAndKeybindingRule({id:HG,weight:200,when:me.editorTextFocus,primary:0,handler:(n,r)=>i(!1,r,n),metadata:{description:d(4818,null),args:[{name:d(4817,null),description:d(4816,null),constraint:$go,schema:a}]}}),[{id:QMe,to:"up"},{id:YMe,to:"down"},{id:XMe,to:"left"},{id:JMe,to:"right"}].forEach(({id:n,to:r})=>{Ge.registerCommand(n,function(s,...l){let c=Zp(l,s.get(ie),s.get(kt),s.get(Co));c.groupedEditors.length&&o(!0,{to:r,by:"group"},c.groupedEditors[0].group,c.groupedEditors[0].editors,s)})});function i(n,r=Object.create(null),s){r.to=r.to||"right",r.by=r.by||"tab",r.value=typeof r.value=="number"?r.value:1;let l=s.get(kt).activeGroup,c=l.selectedEditors;if(c.length>0)switch(r.by){case"tab":if(n)return e(r,l,c);break;case"group":return o(n,r,l,c,s)}}function e(n,r,s){let l=n.to;l==="first"||l==="right"?s=[...s].reverse():l==="position"&&(n.value??1)<r.getIndexOfEditor(s[0])&&(s=[...s].reverse());for(let c of s)t(n,r,c)}function t(n,r,s){let l=r.getIndexOfEditor(s);switch(n.to){case"first":l=0;break;case"last":l=r.count-1;break;case"left":l=l-(n.value??1);break;case"right":l=l+(n.value??1);break;case"center":l=Math.round(r.count/2)-1;break;case"position":l=(n.value??1)-1;break}l=l<0?0:l>=r.count?r.count-1:l,r.moveEditor(s,r,{index:l})}function o(n,r,s,l,c){let u=c.get(kt),p=c.get(B),h;switch(r.to){case"left":h=u.findGroup({direction:2},s),h||(h=u.addGroup(s,2));break;case"right":h=u.findGroup({direction:3},s),h||(h=u.addGroup(s,3));break;case"up":h=u.findGroup({direction:0},s),h||(h=u.addGroup(s,0));break;case"down":h=u.findGroup({direction:1},s),h||(h=u.addGroup(s,1));break;case"first":h=u.findGroup({location:0},s);break;case"last":h=u.findGroup({location:1},s);break;case"previous":if(h=u.findGroup({location:3},s),!h){let g=Zy(p)===3?2:0;h=u.addGroup(s,g)}break;case"next":h=u.findGroup({location:2},s),h||(h=u.addGroup(s,Zy(p)));break;case"center":h=u.getGroups(2)[u.count/2-1];break;case"position":h=u.getGroups(2)[(r.value??1)-1];break}if(h){let g=see(s,l);n?s.moveEditors(g,h):s.id!==h.id&&s.copyEditors(g,h),h.focus()}}}function lin(){function a(i,e){if(!e||typeof e!="object")return;i.get(kt).applyLayout(e)}Ge.registerCommand(UG,(i,e)=>{a(i,e)}),Ge.registerCommand({id:"vscode.setEditorLayout",handler:(i,e)=>a(i,e),metadata:{description:`Set the editor layout. Editor layout is represented as a tree of groups in which the first group is the root group of the layout.
					The orientation of the first group is 0 (horizontal) by default unless specified otherwise. The other orientations are 1 (vertical).
					The orientation of subsequent groups is the opposite of the orientation of the group that contains it.
					Here are some examples: A layout representing 1 row and 2 columns: { orientation: 0, groups: [{}, {}] }.
					A layout representing 3 rows and 1 column: { orientation: 1, groups: [{}, {}, {}] }.
					A layout representing 3 rows and 1 column in which the second row has 2 columns: { orientation: 1, groups: [{}, { groups: [{}, {}] }, {}] }
					`,args:[{name:"args",schema:{type:"object",required:["groups"],properties:{orientation:{type:"number",default:0,description:"The orientation of the root group in the layout. 0 for horizontal, 1 for vertical.",enum:[0,1],enumDescriptions:[d(4822,null),d(4823,null)]},groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]}}}}]}}),Ge.registerCommand({id:"vscode.getEditorLayout",handler:i=>i.get(kt).getLayout(),metadata:{description:"Get Editor Layout",args:[],returns:"An editor layout object, in the same format as vscode.setEditorLayout"}})}function cin(){function a(i,e,t){return i?[{...i.editorOptions,...e??Object.create(null)},i.sideBySide?En:t]:[e,t]}Ge.registerCommand({id:"vscode.open",handler:(i,e)=>{i.get(fe).executeCommand(Xg,e)},metadata:{description:"Opens the provided resource in the editor.",args:[{name:"Uri"}]}}),Ge.registerCommand(Xg,async function(i,e,t,o,n){let r=i.get(ie),s=i.get(kt),l=i.get(Je),c=i.get(Pn),u=i.get(B),p=i.get(yE),h=typeof e=="string"?e:A.from(e,!0),[g,f]=t??[];if(f||typeof g=="number"||hc(h,Q.untitled)){let[v,b]=a(n,f,g),S=A.isUri(h)?h:A.parse(h),y;p.isUntitledWithAssociatedResource(S)?y={resource:S.with({scheme:c.defaultUriScheme}),forceUntitled:!0,options:v,label:o}:y={resource:S,options:v,label:o},await r.openEditor(y,SE(s,u,b))}else{if(hc(h,Q.command))return;await l.open(h,{openToSide:n?.sideBySide,editorOptions:n?.editorOptions})}}),Ge.registerCommand({id:"vscode.diff",handler:(i,e,t,o)=>{i.get(fe).executeCommand(ik,e,t,o)},metadata:{description:"Opens the provided resources in the diff editor to compare their contents.",args:[{name:"left",description:"Left-hand side resource of the diff editor"},{name:"right",description:"Right-hand side resource of the diff editor"},{name:"title",description:"Human readable title for the diff editor"}]}}),Ge.registerCommand(ik,async function(i,e,t,o,n,r){let s=i.get(ie),l=i.get(kt),c=i.get(B),[u,p]=n??[],[h,g]=a(r,p,u),f,v;typeof o=="string"?f=o:o&&(f=o.label,v=o.description),await s.openEditor({original:{resource:A.from(e,!0)},modified:{resource:A.from(t,!0)},label:f,description:v,options:h},SE(l,c,g))}),Ge.registerCommand(sin,async(i,e,t,o)=>{let n=i.get(ie),r=i.get(kt),s=i.get(B),[l,c]=o??[];await n.openEditor({resource:A.from(e,!0),options:{pinned:!0,...c,override:t}},SE(r,s,l))}),Ge.registerCommand({id:"vscode.changes",handler:(i,e,t)=>{i.get(fe).executeCommand("_workbench.changes",e,t)},metadata:{description:"Opens a list of resources in the changes editor to compare their contents.",args:[{name:"title",description:"Human readable title for the diff editor"},{name:"resources",description:"List of resources to open in the changes editor"}]}}),Ge.registerCommand("_workbench.changes",async(i,e,t)=>{let o=i.get(ie),n=[];for(let[r,s,l]of t)n.push({resource:A.revive(r),original:{resource:A.revive(s)},modified:{resource:A.revive(l)}});await o.openEditor({resources:n,label:e})}),Ge.registerCommand("_workbench.openMultiDiffEditor",async(i,e)=>{let t=i.get(ie),o=e.resources?.map(l=>({original:{resource:A.revive(l.originalUri)},modified:{resource:A.revive(l.modifiedUri)}})),n=e.reveal?.modifiedUri?A.revive(e.reveal.modifiedUri):void 0,r=n&&o?o.find(l=>ze(l.modified.resource,n)):void 0;e.reveal&&!r&&console.error("Reveal resource not found");let s={viewState:r?{revealData:{resource:{original:r.original.resource,modified:r.modified.resource},range:e.reveal?.range}}:void 0};await t.openEditor({multiDiffSource:e.multiDiffSourceUri?A.revive(e.multiDiffSourceUri):void 0,resources:o,label:e.title,options:s})})}function din(){let a=(e,t)=>{let o=e.get(ie),n=o.activeEditorPane;if(n&&typeof t=="number"){let r=n.group.getEditorByIndex(t);r&&o.openEditor(r)}};Ge.registerCommand({id:qgo,handler:a});for(let e=0;e<9;e++){let t=e,o=e+1;xt.registerCommandAndKeybindingRule({id:qgo+o,weight:200,when:void 0,primary:512|i(o),mac:{primary:256|i(o)},handler:n=>a(n,t)})}function i(e){switch(e){case 0:return 21;case 1:return 22;case 2:return 23;case 3:return 24;case 4:return 25;case 5:return 26;case 6:return 27;case 7:return 28;case 8:return 29;case 9:return 30}throw new Error("invalid index")}}function uin(){for(let e=1;e<8;e++)xt.registerCommandAndKeybindingRule({id:a(e),weight:200,when:void 0,primary:2048|i(e),handler:t=>{let o=t.get(kt),n=t.get(B);if(e>o.count)return;let r=o.getGroups(2);if(r[e])return r[e].focus();let s=Zy(n),l=o.findGroup({location:1});if(!l)return;o.addGroup(l,s).focus()}});function a(e){switch(e){case 1:return"workbench.action.focusSecondEditorGroup";case 2:return"workbench.action.focusThirdEditorGroup";case 3:return"workbench.action.focusFourthEditorGroup";case 4:return"workbench.action.focusFifthEditorGroup";case 5:return"workbench.action.focusSixthEditorGroup";case 6:return"workbench.action.focusSeventhEditorGroup";case 7:return"workbench.action.focusEighthEditorGroup"}throw new Error("Invalid index")}function i(e){switch(e){case 1:return 23;case 2:return 24;case 3:return 25;case 4:return 26;case 5:return 27;case 6:return 28;case 7:return 29}throw new Error("Invalid index")}}function qEi(a,i,e){if(!e.groupedEditors.length)return;let{group:t,editors:o}=e.groupedEditors[0],n=e.preserveFocus,r=a.addGroup(t,i);for(let s of o)s&&!s.hasCapability(8)&&t.copyEditor(s,r,{preserveFocus:n});r.focus()}function pin(){[{id:B8,direction:0},{id:zG,direction:1},{id:H8,direction:2},{id:KG,direction:3}].forEach(({id:a,direction:i})=>{Ge.registerCommand(a,function(e,...t){let o=Zp(t,e.get(ie),e.get(kt),e.get(Co));qEi(e.get(kt),i,o)})})}function min(){function a(e,t,...o){let n=e.get(kt),r=e.get(ie),s;if(t||o.length?s=!1:s=n.partOptions.preventPinnedEditorClose==="keyboard"||n.partOptions.preventPinnedEditorClose==="keyboardAndMouse",s){let u=n.activeGroup,p=u.activeEditor;if(p&&u.isSticky(p)){let h=u.getEditors(0,{excludeSticky:!0})[0];if(h)return u.openEditor(h);let g=r.getEditors(0,{excludeSticky:!0})[0];if(g)return Promise.resolve(n.getGroup(g.groupId)?.openEditor(g.editor))}}let l=Zp(o,e.get(ie),e.get(kt),e.get(Co)),c=l.preserveFocus;return Promise.all(l.groupedEditors.map(async({group:u,editors:p})=>{let h=p.filter(g=>!s||!u.isSticky(g));await u.closeEditors(h,{preserveFocus:c})}))}xt.registerCommandAndKeybindingRule({id:ok,weight:200,when:void 0,primary:2101,win:{primary:2110,secondary:[2101]},handler:(e,...t)=>a(e,!1,...t)}),Ge.registerCommand(PEi,(e,...t)=>a(e,!0,...t)),xt.registerCommandAndKeybindingRule({id:F8,weight:200,when:void 0,primary:Gi(2089,53),handler:(e,...t)=>{let o=Zp(t,e.get(ie),e.get(kt),e.get(Co));return Promise.all(o.groupedEditors.map(async({group:n})=>{await n.closeAllEditors({excludeSticky:!0})}))}}),xt.registerCommandAndKeybindingRule({id:HVt,weight:200,when:C.and(Tpe,qS),primary:2101,win:{primary:2110,secondary:[2101]},handler:(e,...t)=>{let o=e.get(kt),n=Zp(t,e.get(ie),o,e.get(Co));n.groupedEditors.length&&o.removeGroup(n.groupedEditors[0].group)}}),xt.registerCommandAndKeybindingRule({id:whe,weight:200,when:void 0,primary:Gi(2089,51),handler:(e,...t)=>{let o=Zp(t,e.get(ie),e.get(kt),e.get(Co));return Promise.all(o.groupedEditors.map(async({group:n})=>{await n.closeEditors({savedOnly:!0,excludeSticky:!0},{preserveFocus:o.preserveFocus})}))}}),xt.registerCommandAndKeybindingRule({id:$Me,weight:200,when:void 0,primary:void 0,mac:{primary:2610},handler:(e,...t)=>{let o=Zp(t,e.get(ie),e.get(kt),e.get(Co));return Promise.all(o.groupedEditors.map(async({group:n,editors:r})=>{let s=n.getEditors(1,{excludeSticky:!0}).filter(l=>!r.includes(l));for(let l of r)l&&n.pinEditor(l);await n.closeEditors(s,{preserveFocus:o.preserveFocus})}))}}),xt.registerCommandAndKeybindingRule({id:BVt,weight:200,when:void 0,primary:void 0,handler:async(e,...t)=>{let o=Zp(t,e.get(ie),e.get(kt),e.get(Co));if(o.groupedEditors.length){let{group:n,editors:r}=o.groupedEditors[0];n.activeEditor&&n.pinEditor(n.activeEditor),await n.closeEditors({direction:1,except:r[0],excludeSticky:!0},{preserveFocus:o.preserveFocus})}}}),xt.registerCommandAndKeybindingRule({id:jMe,weight:200,when:void 0,primary:void 0,handler:(e,...t)=>i(e,0,...t)}),xt.registerCommandAndKeybindingRule({id:OEi,weight:200,when:void 0,primary:void 0,handler:(e,t,...o)=>i(e,t??0,...o)});async function i(e,t,...o){let n=e.get(ie),r=e.get(il),s=e.get(_e),l=e.get(Uo),c=e.get($a),u=e.get(If),p=Zp(o,n,e.get(kt),e.get(Co)),h=new Map;for(let{group:g,editors:f}of p.groupedEditors)for(let v of f){let b=qD(v),S=b?v.modified:v,y=b?v.toUntyped():S.toUntyped();if(!y)return;y.options={...n.activeEditorPane?.options,override:t};let w=await r.resolveEditor(y,g);if(!g3(w))return;let x=h.get(g);x||(x=[],h.set(g,x));let E=S.resource,M=!!E&&(E.scheme===Q.untitled||l.isDirty(E));if(M&&S.isDirty()){for(let N of c.dirtyWorkingCopies)if(!ze(N.resource,E)&&u.findEditor(N)?.editor===S){M=!1;break}}x.push({editor:v,replacement:w.editor,forceReplaceDirty:M,options:w.options}),s.publicLog2("workbenchEditorReopen",{scheme:S.resource?.scheme??"",ext:S.resource?Ts(S.resource):"",from:v.editorId??"",to:w.editor.editorId??""})}for(let[g,f]of h)await g.replaceEditors(f),await g.openEditor(f[0].replacement)}Ge.registerCommand(mtt,async(e,...t)=>{let o=e.get(kt),n=Zp(t,e.get(ie),o,e.get(Co));if(n.groupedEditors.length){let{group:r}=n.groupedEditors[0];await r.closeAllEditors(),r.count===0&&o.getGroup(r.id)&&o.removeGroup(r)}})}function hin(){let a=[{id:iin,direction:2},{id:oin,direction:3},{id:nin,direction:0},{id:rin,direction:1}];for(let i of a)Ge.registerCommand(i.id,async e=>{let t=e.get(kt);(t.findGroup({direction:i.direction},t.activeGroup,!1)??t.activeGroup).focus()})}function gin(){async function a(e,t){let o=e.get(F);if(!t.groupedEditors.length)return;let{group:n,editors:r}=t.groupedEditors[0],s=r[0];s&&await n.replaceEditors([{editor:s,replacement:o.createInstance(ja,void 0,void 0,s,s),forceReplaceDirty:!0}])}W(class extends z{constructor(){super({id:qVt,title:P(4834,"Split Editor in Group"),category:Fe.View,precondition:wH,f1:!0,keybinding:{weight:200,when:wH,primary:Gi(2089,3165)}})}run(e,...t){return a(e,Zp(t,e.get(ie),e.get(kt),e.get(Co)))}});async function i(e){if(!e.groupedEditors.length)return;let{group:t,editors:o}=e.groupedEditors[0],n=o[0];if(!n||!(n instanceof ja))return;let r,s=t.activeEditorPane;if(s instanceof iv&&t.activeEditor===n){for(let l of[s.getPrimaryEditorPane(),s.getSecondaryEditorPane()])if(l?.hasFocus()){r={viewState:l.getViewState()};break}}await t.replaceEditors([{editor:n,replacement:n.primary,options:r}])}W(class extends z{constructor(){super({id:$Vt,title:P(4827,"Join Editor in Group"),category:Fe.View,precondition:Dx,f1:!0,keybinding:{weight:200,when:Dx,primary:Gi(2089,3165)}})}run(e,...t){return i(Zp(t,e.get(ie),e.get(kt),e.get(Co)))}}),W(class extends z{constructor(){super({id:ein,title:P(4836,"Toggle Split Editor in Group"),category:Fe.View,precondition:C.or(wH,Dx),f1:!0})}async run(e,...t){let o=Zp(t,e.get(ie),e.get(kt),e.get(Co));if(!o.groupedEditors.length)return;let{editors:n}=o.groupedEditors[0];n[0]instanceof ja?await i(o):n[0]&&await a(e,o)}}),W(class extends z{constructor(){super({id:FEi,title:P(4839,"Toggle Layout of Split Editor in Group"),category:Fe.View,precondition:Dx,f1:!0})}async run(e){let t=e.get(B),o=t.getValue(iv.SIDE_BY_SIDE_LAYOUT_SETTING),n;return o!=="horizontal"?n="horizontal":n="vertical",t.updateValue(iv.SIDE_BY_SIDE_LAYOUT_SETTING,n)}})}function fin(){W(class extends z{constructor(){super({id:WEi,title:P(4824,"Focus First Side in Active Editor"),category:Fe.View,precondition:C.or(Dx,GS),f1:!0})}async run(a){let i=a.get(ie),e=a.get(fe),t=i.activeEditorPane;t instanceof iv?t.getSecondaryEditorPane()?.focus():t instanceof TR&&await e.executeCommand(DEi)}}),W(class extends z{constructor(){super({id:VEi,title:P(4826,"Focus Second Side in Active Editor"),category:Fe.View,precondition:C.or(Dx,GS),f1:!0})}async run(a){let i=a.get(ie),e=a.get(fe),t=i.activeEditorPane;t instanceof iv?t.getPrimaryEditorPane()?.focus():t instanceof TR&&await e.executeCommand(_Ei)}}),W(class extends z{constructor(){super({id:tin,title:P(4825,"Focus Other Side in Active Editor"),category:Fe.View,precondition:C.or(Dx,GS),f1:!0})}async run(a){let i=a.get(ie),e=a.get(fe),t=i.activeEditorPane;t instanceof iv?t.getPrimaryEditorPane()?.hasFocus()?t.getSecondaryEditorPane()?.focus():t.getPrimaryEditorPane()?.focus():t instanceof TR&&await e.executeCommand(REi)}})}function vin(){xt.registerCommandAndKeybindingRule({id:UVt,weight:200,when:void 0,primary:Gi(2089,3),handler:async(i,...e)=>{let t=Zp(e,i.get(ie),i.get(kt),i.get(Co));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.pinEditor(r)}}),Ge.registerCommand({id:AEi,handler:i=>{let e=i.get(B),o=e.getValue("workbench.editor.enablePreview")!==!0;e.updateValue("workbench.editor.enablePreview",o)}});function a(i,e,...t){let n=Zp(t,i.get(ie),i.get(kt),i.get(Co)).groupedEditors[0]?.group;n?.lock(e??!n.isLocked)}W(class extends z{constructor(){super({id:zVt,title:P(4835,"Toggle Editor Group Lock"),category:Fe.View,f1:!0})}async run(i,...e){a(i,void 0,...e)}}),W(class extends z{constructor(){super({id:KVt,title:P(4828,"Lock Editor Group"),category:Fe.View,precondition:o_.toNegated(),f1:!0})}async run(i,...e){a(i,!0,...e)}}),W(class extends z{constructor(){super({id:W8,title:P(4840,"Unlock Editor Group"),precondition:o_,category:Fe.View,f1:!0})}async run(i,...e){a(i,!1,...e)}}),xt.registerCommandAndKeybindingRule({id:GVt,weight:200,when:NM.toNegated(),primary:Gi(2089,1027),handler:async(i,...e)=>{let t=Zp(e,i.get(ie),i.get(kt),i.get(Co));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.stickEditor(r)}}),xt.registerCommandAndKeybindingRule({id:V8,weight:200,when:NM,primary:Gi(2089,1027),handler:async(i,...e)=>{let t=Zp(e,i.get(ie),i.get(kt),i.get(Co));for(let{group:o,editors:n}of t.groupedEditors)for(let r of n)o.unstickEditor(r)}}),xt.registerCommandAndKeybindingRule({id:NEi,weight:200,when:void 0,primary:void 0,handler:(i,...e)=>{let t=i.get(kt),o=i.get($e),r=Zp(e,i.get(ie),t,i.get(Co)).groupedEditors[0]?.group;return r&&t.activateGroup(r),o.quickAccess.show(ER.PREFIX)}})}function bin(){W(class extends z{constructor(){super({id:HEi,title:P(4830,"Open Modal Editor in Main Window"),category:Fe.View,f1:!0,icon:L.openInProduct,precondition:vC,menu:{id:R.ModalEditorTitle,group:"navigation",order:0,when:qo.negate()}})}async run(a){let i=a.get(kt);for(let e of i.parts)if(yhe(e)){await e.close({mergeAllEditorsToMainPart:!0});break}}}),W(class extends z{constructor(){super({id:UEi,title:P(4829,"Open Modal Editor in New Window"),category:Fe.View,f1:!0,icon:L.emptyWindow,precondition:vC,menu:[{id:R.ModalEditorTitleContext,group:"1_window",order:0,when:qo}]})}async run(a){let i=a.get(kt);for(let e of i.parts)if(yhe(e)){let t=await i.createAuxiliaryEditorPart();for(let o of e.getGroups(1))o.moveEditors(o.editors.map(n=>({editor:n,options:{preserveFocus:!0}})),t.activeGroup);t.activeGroup.focus(),await e.close();break}}}),W(class extends z{constructor(){super({id:XVt,title:P(4838,"Toggle Modal Editor Sidebar"),category:Fe.View,f1:!0,precondition:C.and(vC,JMt)})}run(a){let i=a.get(kt);for(let e of i.parts)if(yhe(e)){e.toggleSidebar();break}}}),W(class extends z{constructor(){super({id:zEi,title:P(4837,"Maximize Modal Editor"),category:Fe.View,f1:!0,precondition:vC,icon:L.screenFull,toggled:{condition:XMt,title:d(4833,null)},menu:{id:R.ModalEditorTitle,group:"navigation",order:99}})}run(a){let i=a.get(kt);for(let e of i.parts)if(yhe(e)){e.toggleMaximized();break}}}),W(class extends z{constructor(){super({id:BEi,title:P(4815,"Close Modal Editor"),category:Fe.View,f1:!0,icon:L.close,precondition:vC,keybinding:[{primary:9,weight:210,when:me.focus.toNegated()},{primary:9,weight:99,when:me.focus}],menu:{id:R.ModalEditorTitle,group:"navigation",order:100}})}async run(a){let i=a.get(kt);for(let e of i.parts)if(yhe(e)){await e.close();break}}}),W(class extends z{constructor(){super({id:KEi,title:P(4832,"Navigate to Previous Item in Modal Editor"),category:Fe.View,precondition:C.and(vC,_pe),keybinding:{primary:528,weight:210,when:C.and(vC,_pe)}})}run(a){let i=a.get(kt);for(let e of i.parts)if(yhe(e)){let t=e.navigation;t&&t.current>0&&t.navigate(t.current-1);break}}}),W(class extends z{constructor(){super({id:GEi,title:P(4831,"Navigate to Next Item in Modal Editor"),category:Fe.View,precondition:C.and(vC,_pe),keybinding:{primary:530,weight:210,when:C.and(vC,_pe)}})}run(a){let i=a.get(kt);for(let e of i.parts)if(yhe(e)){let t=e.navigation;t&&t.current<t.total-1&&t.navigate(t.current+1);break}}})}function yhe(a){let i=a;return!!i&&typeof i.close=="function"&&typeof i.onWillClose=="function"&&typeof i.toggleMaximized=="function"&&typeof i.maximized=="boolean"&&typeof i.updateOptions=="function"&&!!i.modalElement&&i.windowId===ut.vscodeWindowId}function Qgo(){ain(),lin(),zgo(),cin(),din(),min(),vin(),gin(),fin(),uin(),pin(),hin(),bin()}var ZVt=class extends k{constructor(){super(...arguments);this._onDidChangeCheckboxState=this._register(new T);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e){this._onDidChangeCheckboxState.fire([e])}},ftt=class a extends k{constructor(e,t,o,n){super();this.checkboxStateHandler=t;this.hoverDelegate=o;this.hoverService=n;this.checkboxContainer=e}static{this.checkboxClass="custom-view-tree-node-item-checkbox"}render(e){e.checkbox&&(this.toggle?this.toggle.checked=e.checkbox.isChecked:this.createCheckbox(e))}createCheckbox(e){e.checkbox&&(this.toggle=new qf("",e.checkbox.isChecked,{...Ag,size:15}),this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.toggle.domNode.classList.add(a.checkboxClass),this.toggle.domNode.tabIndex=1,D(this.checkboxContainer,this.toggle.domNode),this.registerListener(e))}registerListener(e){this.toggle&&(this._register({dispose:()=>this.removeCheckbox()}),this._register(this.toggle),this._register(this.toggle.onChange(()=>{this.setCheckbox(e)})))}setHover(e){this.toggle&&(this.hover?this.hover.update(e.tooltip):this.hover=this._register(this.hoverService.setupManagedHover(this.hoverDelegate,this.toggle.domNode,this.checkboxHoverContent(e))))}setCheckbox(e){this.toggle&&e.checkbox&&(e.checkbox.isChecked=this.toggle.checked,this.setHover(e.checkbox),this.setAccessibilityInformation(e.checkbox),this.checkboxStateHandler.setCheckboxState(e))}checkboxHoverContent(e){return e.tooltip?e.tooltip:e.isChecked?d(5151,null):d(5152,null)}setAccessibilityInformation(e){this.toggle&&e.accessibilityInformation&&(this.toggle.setTitle(e.accessibilityInformation.label),e.accessibilityInformation.role&&(this.toggle.domNode.role=e.accessibilityInformation.role))}removeCheckbox(){let e=this.checkboxContainer.children;for(let t of e)t.remove()}};var tPe=le("accessibleViewInformationService"),ePe=class extends k{constructor(e){super();this._storageService=e}hasShownAccessibleView(e){return this._storageService.getBoolean(`${$4e}${e}`,-1,!1)===!0}};ePe=I([m(0,de)],ePe);var _R=class extends na{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super({...i,titleMenuId:R.ViewTitle,donotForwardArgs:!1},e,t,o,n,r,s,l,c,p,h);let{treeView:g}=oe.as(Kn.ViewsRegistry).getView(i.id);this.treeView=g,this._register(this.treeView.onDidChangeActions(()=>this.updateActions(),this)),this._register(this.treeView.onDidChangeTitle(f=>this.updateTitle(f))),this._register(this.treeView.onDidChangeDescription(f=>this.updateTitleDescription(f))),this._register(ee(()=>{this._container&&this.treeView.container&&this._container===this.treeView.container&&this.treeView.setVisibility(!1)})),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.treeView.onDidChangeWelcomeState(()=>this._onDidChangeViewWelcomeState.fire())),i.title!==this.treeView.title&&this.updateTitle(this.treeView.title),i.titleDescription!==this.treeView.description&&this.updateTitleDescription(this.treeView.description),this._actionRunner=this._register(new eBt(u,()=>this.treeView.getSelection())),this.updateTreeVisibility()}focus(){super.focus(),this.treeView.focus()}renderBody(i){this._container=i,super.renderBody(i),this.renderTreeView(i)}shouldShowWelcome(){return(this.treeView.dataProvider===void 0||!!this.treeView.dataProvider.isTreeEmpty)&&(this.treeView.message===void 0||this.treeView.message==="")}layoutBody(i,e){super.layoutBody(i,e),this.layoutTreeView(i,e)}getOptimalWidth(){return this.treeView.getOptimalWidth()}renderTreeView(i){this.treeView.show(i)}layoutTreeView(i,e){this.treeView.layout(i,e)}updateTreeVisibility(){this.treeView.setVisibility(this.isBodyVisible())}getActionRunner(){return this._actionRunner}getActionsContext(){return{$treeViewId:this.id,$focusedTreeItem:!0,$selectedTreeItems:!0}}};_R=I([m(1,Le),m(2,Xe),m(3,B),m(4,X),m(5,ji),m(6,F),m(7,Je),m(8,Pe),m(9,Ne),m(10,ot),m(11,tPe)],_R);var Stt=class{constructor(){this.label={label:"root"};this.handle="0";this.parentHandle=void 0;this.collapsibleState=2;this.children=void 0}};function Xgo(a){let i=Ge.getCommand(a);if(i)return be.getCommand(i.id)?.precondition}function Jgo(a,i){let e=a.originalId?a.originalId:a.id,t=Xgo(e);return t?i.contextMatchesRules(t):!0}function Ygo(a){return!!a&&typeof a!="string"&&!!a.element&&!!a.disposables}var Sin=d(5155,null),Iin=new Y("customTreeView",!1),$Ei=class extends Rp{},iPe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.id=e;this._title=t;this.themeService=o;this.instantiationService=n;this.commandService=r;this.configurationService=s;this.progressService=l;this.contextMenuService=c;this.keybindingService=u;this.notificationService=p;this.viewDescriptorService=h;this.hoverService=g;this.contextKeyService=f;this.activityService=v;this.logService=b;this.openerService=S;this.markdownRendererService=y;this.isVisible=!1;this._hasIconForParentNode=!1;this._hasIconForLeafNode=!1;this.focused=!1;this._canSelectMany=!1;this._manuallyManageCheckboxes=!1;this.elementsToRefresh=[];this.lastSelection=[];this._onDidExpandItem=this._register(new T);this._onDidCollapseItem=this._register(new T);this._onDidChangeSelectionAndFocus=this._register(new T);this._onDidChangeVisibility=this._register(new T);this._onDidChangeActions=this._register(new T);this._onDidChangeWelcomeState=this._register(new T);this._onDidChangeTitle=this._register(new T);this._onDidChangeDescription=this._register(new T);this._onDidChangeCheckboxState=this._register(new T);this._onDidCompleteRefresh=this._register(new T);this._isInitialized=!1;this._activity=this._register(new ue);this.activated=!1;this.treeDisposables=this._register(new O);this._height=0;this._width=0;this.refreshing=!1;this.root=new Stt,this.lastActive=this.root}get onDidExpandItem(){return this._onDidExpandItem.event}get onDidCollapseItem(){return this._onDidCollapseItem.event}get onDidChangeSelectionAndFocus(){return this._onDidChangeSelectionAndFocus.event}get onDidChangeVisibility(){return this._onDidChangeVisibility.event}get onDidChangeActions(){return this._onDidChangeActions.event}get onDidChangeWelcomeState(){return this._onDidChangeWelcomeState.event}get onDidChangeTitle(){return this._onDidChangeTitle.event}get onDidChangeDescription(){return this._onDidChangeDescription.event}get onDidChangeCheckboxState(){return this._onDidChangeCheckboxState.event}initialize(){this._isInitialized||(this._isInitialized=!0,this.contextKeyService.bufferChangeEvents(()=>{this.initializeShowCollapseAllAction(),this.initializeCollapseAllToggle(),this.initializeShowRefreshAction()}),this.treeViewDnd=this.instantiationService.createInstance(btt,this.id),this._dragAndDropController&&(this.treeViewDnd.controller=this._dragAndDropController),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("explorer.decorations")&&this.doRefresh([this.root])})),this._register(this.viewDescriptorService.onDidChangeLocation(({views:e,from:t,to:o})=>{e.some(n=>n.id===this.id)&&this.tree?.updateOptions({overrideStyles:IG(this.viewLocation).listOverrideStyles})})),this.registerActions(),this.create())}get viewContainer(){return this.viewDescriptorService.getViewContainerByViewId(this.id)}get viewLocation(){return this.viewDescriptorService.getViewLocationById(this.id)}get dragAndDropController(){return this._dragAndDropController}set dragAndDropController(e){this._dragAndDropController=e,this.treeViewDnd&&(this.treeViewDnd.controller=e)}get dataProvider(){return this._dataProvider}set dataProvider(e){if(e){this.visible&&this.activate();let t=this;this._dataProvider=new class{constructor(){this._isEmpty=!0;this._onDidChangeEmpty=new T;this.onDidChangeEmpty=this._onDidChangeEmpty.event}get isTreeEmpty(){return this._isEmpty}async getChildren(o){return(await this.getChildrenBatch(o?[o]:void 0))?.[0]}updateEmptyState(o,n){if(o.length===1&&o[0]instanceof Stt){let r=this._isEmpty;this._isEmpty=n.length===0||n[0].length===0,r!==this._isEmpty&&this._onDidChangeEmpty.fire()}}findCheckboxesUpdated(o,n){if(n.length===0)return[];let r=[];for(let s=0;s<o.length;s++){let l=o[s],c=n[s];for(let u of c)u.parent=l,!t.manuallyManageCheckboxes&&l?.checkbox?.isChecked===!0&&u.checkbox?.isChecked===!1&&(u.checkbox.isChecked=!0,r.push(u))}return r}async getChildrenBatch(o){let n,r=[];if(o?.every(s=>!!s.children))n=o.map(s=>s.children);else{o=o??[t.root];let s=await(o.length===1&&o[0]instanceof Stt?YEi(e,void 0):YEi(e,o));for(let l=0;l<o.length;l++){let c=o[l];c.children=s?s[l]:void 0}n=s??[],r=this.findCheckboxesUpdated(o,n)}return this.updateEmptyState(o,n),r.length>0&&t._onDidChangeCheckboxState.fire(r),n}},this._dataProvider.onDidChangeEmpty&&this._register(this._dataProvider.onDidChangeEmpty(()=>{this.updateCollapseAllToggle(),this._onDidChangeWelcomeState.fire()})),this.updateMessage(),this.refresh()}else this._dataProvider=void 0,this.treeDisposables.clear(),this.activated=!1,this.updateMessage();this._onDidChangeWelcomeState.fire()}get message(){return this._message}set message(e){this._message=e,this.updateMessage(),this._onDidChangeWelcomeState.fire()}get title(){return this._title}set title(e){this._title=e,this.tree&&(this.tree.ariaLabel=this._title),this._onDidChangeTitle.fire(this._title)}get description(){return this._description}set description(e){this._description=e,this._onDidChangeDescription.fire(this._description)}get badge(){return this._badge}set badge(e){if(!(this._badge?.value===e?.value&&this._badge?.tooltip===e?.tooltip))if(this._badge=e,e){let t={badge:new eu(e.value,()=>e.tooltip),priority:50};this._activity.value=this.activityService.showViewActivity(this.id,t)}else this._activity.clear()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){let t=this._canSelectMany;this._canSelectMany=e,this._canSelectMany!==t&&this.tree?.updateOptions({multipleSelectionSupport:this.canSelectMany})}get manuallyManageCheckboxes(){return this._manuallyManageCheckboxes}set manuallyManageCheckboxes(e){this._manuallyManageCheckboxes=e}get hasIconForParentNode(){return this._hasIconForParentNode}get hasIconForLeafNode(){return this._hasIconForLeafNode}get visible(){return this.isVisible}initializeShowCollapseAllAction(e=!1){return this.collapseAllContext||(this.collapseAllContextKey=new Y(`treeView.${this.id}.enableCollapseAll`,e,d(5157,null,this.id)),this.collapseAllContext=this.collapseAllContextKey.bindTo(this.contextKeyService)),!0}get showCollapseAllAction(){return this.initializeShowCollapseAllAction(),!!this.collapseAllContext?.get()}set showCollapseAllAction(e){this.initializeShowCollapseAllAction(e),this.collapseAllContext?.set(e)}initializeShowRefreshAction(e=!1){this.refreshContext||(this.refreshContextKey=new Y(`treeView.${this.id}.enableRefresh`,e,d(5158,null,this.id)),this.refreshContext=this.refreshContextKey.bindTo(this.contextKeyService))}get showRefreshAction(){return this.initializeShowRefreshAction(),!!this.refreshContext?.get()}set showRefreshAction(e){this.initializeShowRefreshAction(e),this.refreshContext?.set(e)}registerActions(){let e=this;this._register(W(class extends z{constructor(){super({id:`workbench.actions.treeView.${e.id}.refresh`,title:d(5156,null),menu:{id:R.ViewTitle,when:C.and(C.equals("view",e.id),e.refreshContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER-1},icon:L.refresh})}async run(){return e.refresh()}})),this._register(W(class extends z{constructor(){super({id:`workbench.actions.treeView.${e.id}.collapseAll`,title:d(5153,null),menu:{id:R.ViewTitle,when:C.and(C.equals("view",e.id),e.collapseAllContextKey),group:"navigation",order:Number.MAX_SAFE_INTEGER},precondition:e.collapseAllToggleContextKey,icon:L.collapseAll})}async run(){if(e.tree)return new RVt(e.tree,!0).run()}}))}setVisibility(e){this.initialize(),e=!!e,this.isVisible!==e&&(this.isVisible=e,this.tree&&(this.isVisible?Xo(this.tree.getHTMLElement()):Wi(this.tree.getHTMLElement()),this.isVisible&&this.elementsToRefresh.length&&this.dataProvider&&(this.doRefresh(this.elementsToRefresh),this.elementsToRefresh=[])),ox(()=>{this.dataProvider&&this._onDidChangeVisibility.fire(this.isVisible)}),this.visible&&this.activate())}focus(e=!0,t){if(this.tree&&this.root.children&&this.root.children.length>0){let o=t??this.tree.getSelection()[0];o&&e&&this.tree.reveal(o,.5),this.tree.domFocus()}else this.tree&&this.treeContainer&&!this.treeContainer.classList.contains("hide")?this.tree.domFocus():this.domNode.focus()}show(e){this._container=e,D(e,this.domNode)}create(){this.domNode=_(".tree-explorer-viewlet-tree-view"),this.messageElement=D(this.domNode,_(".message")),this.updateMessage(),this.treeContainer=D(this.domNode,_(".customview-tree")),this.treeContainer.classList.add("file-icon-themable-tree","show-file-icons");let e=this._register(nr(this.domNode));this._register(e.onDidFocus(()=>this.focused=!0)),this._register(e.onDidBlur(()=>this.focused=!1))}createTree(){this.treeDisposables.clear();let e=ta.bind(void 0,this.instantiationService),t=this.treeDisposables.add(this.instantiationService.createInstance(vtt,this.id));this.treeLabels=this.treeDisposables.add(this.instantiationService.createInstance(jl,this));let o=this.instantiationService.createInstance(XEi,this,p=>this.progressService.withProgress({location:this.id},()=>p)),n=this.treeDisposables.add(new JEi(this.themeService,this.logService)),r=this.treeDisposables.add(new ZVt),s=this.treeDisposables.add(this.instantiationService.createInstance(U8,this.id,t,this.treeLabels,e,n,r,()=>this.manuallyManageCheckboxes));this.treeDisposables.add(s.onDidChangeCheckboxState(p=>this._onDidChangeCheckboxState.fire(p)));let l=this._title;this.tree=this.treeDisposables.add(this.instantiationService.createInstance($Ei,this.id,this.treeContainer,new QEi,[s],o,{identityProvider:new jEi,accessibilityProvider:{getAriaLabel(p){if(p.accessibilityInformation)return p.accessibilityInformation.label;if(We(p.tooltip))return p.tooltip;{if(p.resourceUri&&!p.label)return null;let h="";if(p.label){let g=yr(p.label.label)?p.label.label.value:p.label.label;h+=g+" "}return p.description&&(h+=p.description),h}},getRole(p){return p.accessibilityInformation?.role??"treeitem"},getWidgetAriaLabel(){return l}},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:p=>p.label?yr(p.label.label)?p.label.label.value:p.label.label:p.resourceUri?Be(A.revive(p.resourceUri)):void 0},expandOnlyOnTwistieClick:p=>!!p.command||!!p.checkbox||this.configurationService.getValue("workbench.tree.expandMode")==="doubleClick",collapseByDefault:p=>p.collapsibleState!==2,multipleSelectionSupport:this.canSelectMany,dnd:this.treeViewDnd,overrideStyles:IG(this.viewLocation).listOverrideStyles})),this.treeDisposables.add(s.onDidChangeMenuContext(p=>p.forEach(h=>this.tree?.rerender(h)))),this.treeDisposables.add(this.tree),t.setContextKeyService(this.tree.contextKeyService),n.tree=this.tree;let c=this.treeDisposables.add(new eBt(this.notificationService,()=>this.tree.getSelection()));s.actionRunner=c,this.tree.contextKeyService.createKey(this.id,!0),Iin.bindTo(this.tree.contextKeyService).set(!0),this.treeDisposables.add(this.tree.onContextMenu(p=>this.onContextMenu(t,p,c))),this.treeDisposables.add(this.tree.onDidChangeSelection(p=>{this.lastSelection=p.elements,this.lastActive=this.tree?.getFocus()[0]??this.lastActive,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})})),this.treeDisposables.add(this.tree.onDidChangeFocus(p=>{p.elements.length&&p.elements[0]!==this.lastActive&&(this.lastActive=p.elements[0],this.lastSelection=this.tree?.getSelection()??this.lastSelection,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive}))})),this.treeDisposables.add(this.tree.onDidChangeCollapseState(p=>{if(!p.node.element)return;let h=Array.isArray(p.node.element.element)?p.node.element.element[0]:p.node.element.element;p.node.collapsed?this._onDidCollapseItem.fire(h):this._onDidExpandItem.fire(h)})),this.tree.setInput(this.root).then(()=>this.updateContentAreas()),this.treeDisposables.add(this.tree.onDidOpen(async p=>{if(!p.browserEvent||p.browserEvent.target&&p.browserEvent.target.classList.contains(ftt.checkboxClass))return;let h=this.tree.getSelection(),g=await this.resolveCommand(h.length===1?h[0]:void 0);if(g&&Jgo(g,this.contextKeyService)){let f=g.arguments||[];(g.id===Xg||g.id===ik)&&(f=[...f,p]);try{await this.commandService.executeCommand(g.id,...f)}catch(v){this.notificationService.error(v)}}})),this.treeDisposables.add(t.onDidChange(p=>{this.tree?.hasNode(p)&&this.tree?.rerender(p)}))}async resolveCommand(e){let t=e?.command;return e&&!t&&e instanceof H3&&e.hasResolve&&(await e.resolve(Ie.None),t=e.command),t}onContextMenu(e,t,o){this.hoverService.hideHover();let n=t.element;if(n===null)return;let r=t.browserEvent;r.preventDefault(),r.stopPropagation(),this.tree.setFocus([n]);let s=this.canSelectMany?this.getSelection():[];s.find(c=>c.handle===n.handle)||(s=[n]);let l=e.getResourceContextActions(s);l.length&&this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>l,getActionViewItem:c=>{let u=this.keybindingService.lookupKeybinding(c.id);if(u)return new ts(c,c,{label:!0,keybinding:u.getLabel()})},onHide:c=>{c&&this.tree.domFocus()},getActionsContext:()=>({$treeViewId:this.id,$treeItemHandle:n.handle}),actionRunner:o})}updateMessage(){this._message?this.showMessage(this._message):this.dataProvider?this.hideMessage():this.showMessage(Sin),this.updateContentAreas()}processMessage(e,t){let o=e.value.split(`
`),n=[],r=!1;for(let l of o){let c=ZS(l);if(c.nodes.length===1&&typeof c.nodes[0]!="string"){let u=c.nodes[0],p=document.createElement("div");p.classList.add("button-container");let h=new Pi(p,{title:u.title,secondary:r,supportIcons:!0,...Ro});h.label=u.label,h.onDidClick(f=>{this.openerService.open(u.href,{allowCommands:!0})},null,t);let g=A.parse(u.href);if(g.scheme===Q.command){let f=Xgo(g.path);f&&(h.enabled=this.contextKeyService.contextMatchesRules(f),t.add(this.contextKeyService.onDidChangeContext(v=>{v.affectsSome(new Set(f.keys()))&&(h.enabled=this.contextKeyService.contextMatchesRules(f))})))}t.add(h),r=!0,n.push(p)}else{r=!1;let u=this.markdownRendererService.render(new he(l,{isTrusted:e.isTrusted,supportThemeIcons:e.supportThemeIcons,supportHtml:e.supportHtml}));n.push(u.element),t.add(u)}}let s=document.createElement("div");s.classList.add("rendered-message");for(let l of n)go(l)?s.appendChild(l):s.appendChild(l.element);return s}showMessage(e){if(Ygo(this._messageValue)&&this._messageValue.disposables.dispose(),yr(e)){let t=new O,o=this.processMessage(e,t);this._messageValue={element:o,disposables:t}}else this._messageValue=e;this.messageElement&&(this.messageElement.classList.remove("hide"),this.resetMessageElement(),typeof this._messageValue=="string"&&!_c(this._messageValue)?this.messageElement.textContent=this._messageValue:Ygo(this._messageValue)&&this.messageElement.appendChild(this._messageValue.element),this.layout(this._height,this._width))}hideMessage(){this.resetMessageElement(),this.messageElement?.classList.add("hide"),this.layout(this._height,this._width)}resetMessageElement(){this.messageElement&&St(this.messageElement)}layout(e,t){if(e&&t&&this.messageElement&&this.treeContainer){this._height=e,this._width=t;let o=e-Uh(this.messageElement);this.treeContainer.style.height=o+"px",this.tree?.layout(o,t)}}getOptimalWidth(){if(this.tree){let e=this.tree.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".outline-item-label > a"));return Pwe(e,t)}return 0}updateCheckboxes(e){return Zgo(e)}async refresh(e,t){if(this.dataProvider&&this.tree){this.refreshing&&await U.toPromise(this._onDidCompleteRefresh.event),e||(e=[this.root],this.elementsToRefresh=[]);for(let o of e)o.children=void 0;if(this.isVisible){let o=this.updateCheckboxes(t??[]);return this.doRefresh(e.concat(o))}else if(this.elementsToRefresh.length){let o=new Set;this.elementsToRefresh.forEach(n=>o.add(n.handle));for(let n of e)o.has(n.handle)||this.elementsToRefresh.push(n)}else this.elementsToRefresh.push(...e)}}async expand(e){let t=this.tree;if(t)try{e=Array.isArray(e)?e:[e];for(let o of e)await t.expand(o,!1)}catch{}}isCollapsed(e){return!!this.tree?.isCollapsed(e)}setSelection(e){this.tree?.setSelection(e)}getSelection(){return this.tree?.getSelection()??[]}setFocus(e){this.tree&&(e?(this.focus(!0,e),this.tree.setFocus([e])):this.tree.getFocus().length===0&&this.tree.setFocus([]))}async reveal(e){if(this.tree)return this.tree.reveal(e)}async doRefresh(e){let t=this.tree;if(t&&this.visible){this.refreshing=!0;let o=t.getSelection();try{await Promise.all(e.map(r=>t.updateChildren(r,!0,!0)))}catch(r){this.logService.error(r)}let n=t.getSelection();(o.length!==n.length||o.some((r,s)=>r.handle!==n[s].handle))&&(this.lastSelection=n,this._onDidChangeSelectionAndFocus.fire({selection:this.lastSelection,focus:this.lastActive})),this.refreshing=!1,this._onDidCompleteRefresh.fire(),this.updateContentAreas(),this.focused&&this.focus(!1),this.updateCollapseAllToggle()}}initializeCollapseAllToggle(){this.collapseAllToggleContext||(this.collapseAllToggleContextKey=new Y(`treeView.${this.id}.toggleCollapseAll`,!1,d(5159,null,this.id)),this.collapseAllToggleContext=this.collapseAllToggleContextKey.bindTo(this.contextKeyService))}updateCollapseAllToggle(){this.showCollapseAllAction&&(this.initializeCollapseAllToggle(),this.collapseAllToggleContext?.set(!!this.root.children&&this.root.children.length>0&&this.root.children.some(e=>e.collapsibleState!==0)))}updateContentAreas(){let e=!this.root.children||this.root.children.length===0;this._messageValue&&e&&!this.refreshing&&this.treeContainer?(this.dragAndDropController||this.treeContainer.classList.add("hide"),this.domNode.setAttribute("tabindex","0")):this.treeContainer&&(this.treeContainer.classList.remove("hide"),this.domNode===Un()&&this.focus(),this.domNode.removeAttribute("tabindex"))}get container(){return this._container}};iPe=I([m(2,Pe),m(3,F),m(4,fe),m(5,B),m(6,Go),m(7,Xe),m(8,Le),m(9,Ne),m(10,ji),m(11,ot),m(12,X),m(13,Al),m(14,re),m(15,Je),m(16,_n)],iPe);var jEi=class{getId(i){return i.handle}},QEi=class{getHeight(i){return U8.ITEM_HEIGHT}getTemplateId(i){return U8.TREE_TEMPLATE_ID}};async function YEi(a,i){return a.getChildrenBatch?a.getChildrenBatch(i):i?Promise.all(i.map(e=>a.getChildren(e).then(t=>t??[]))):[await a.getChildren()].filter(e=>e!==void 0)}var XEi=class{constructor(i,e){this.treeView=i;this.withProgress=e}hasChildren(i){return!!this.treeView.dataProvider&&i.collapsibleState!==0}async getChildren(i){let e=this.treeView.dataProvider;if(!e)return[];this.batch===void 0?(this.batch=[i],this.batchPromise=void 0):this.batch.push(i);let t=this.batch.length-1;return new Promise((o,n)=>{setTimeout(async()=>{let r=this.batch;this.batch=void 0,this.batchPromise||(this.batchPromise=this.withProgress(YEi(e,r)));try{let s=await this.batchPromise;o(s&&t<s.length?s[t]:[])}catch(s){s.message.startsWith("Bad progress location:")||n(s)}},0)})}},U8=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.treeViewId=e;this.menus=t;this.labels=o;this.actionViewItemProvider=n;this.aligner=r;this.checkboxStateHandler=s;this.manuallyManageCheckboxes=l;this.themeService=c;this.configurationService=u;this.labelService=p;this.contextKeyService=h;this.hoverService=g;this._onDidChangeCheckboxState=this._register(new T);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidChangeMenuContext=this._register(new T);this.onDidChangeMenuContext=this._onDidChangeMenuContext.event;this._hasCheckbox=!1;this._renderedElements=new Map;this._hoverDelegate=this._register(f.createInstance(Kf,"mouse",void 0,{})),this._register(this.themeService.onDidFileIconThemeChange(()=>this.rerender())),this._register(this.themeService.onDidColorThemeChange(()=>this.rerender())),this._register(s.onDidChangeCheckboxState(v=>{this.updateCheckboxes(v)})),this._register(this.contextKeyService.onDidChangeContext(v=>this.onDidChangeContext(v)))}static{this.ITEM_HEIGHT=22}static{this.TREE_TEMPLATE_ID="treeExplorer"}get templateId(){return U8.TREE_TEMPLATE_ID}set actionRunner(e){this._actionRunner=e}renderTemplate(e){e.classList.add("custom-view-tree-node-item");let t=D(e,_("")),o=this.labels.create(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate}),n=CI(o.element,_(".custom-view-tree-node-item-icon")),r=D(o.element,_(".actions")),s=new oo(r,{actionViewItemProvider:this.actionViewItemProvider});return{resourceLabel:o,icon:n,checkboxContainer:t,actionBar:s,container:e}}getHover(e,t,o){return!(o instanceof H3)||!o.hasResolve?t&&!o.tooltip?void 0:o.tooltip===void 0?yr(e)?{markdown:e,markdownNotSupportedFallback:e.value}:e:We(o.tooltip)?o.tooltip!==""?o.tooltip:void 0:{markdown:o.tooltip,markdownNotSupportedFallback:t?void 0:ma(o.tooltip)}:{markdown:typeof o.tooltip=="string"?o.tooltip:n=>new Promise(r=>{o.resolve(n).then(()=>r(o.tooltip))}),markdownNotSupportedFallback:t?void 0:e?yr(e)?e.value:e:""}}processLabel(e,t){if(!yr(e))return{label:e};let o=e.value.trim(),n=!1,r=!1,s=!1;function l(p){if(t)for(let h of t)h.start-=p,h.end-=p}let c=[{open:"~~",close:"~~",mark:()=>{s=!0}},{open:"**",close:"**",mark:()=>{n=!0}},{open:"*",close:"*",mark:()=>{r=!0}},{open:"_",close:"_",mark:()=>{r=!0}}];function u(){let p=!1;for(let h of c)if(o.startsWith(h.open)&&o.endsWith(h.close)){if(t?.some(g=>g.start<h.open.length||g.end>o.length-h.close.length))return!1;h.mark(),o=o.substring(h.open.length,o.length-h.close.length),l(h.open.length),p=!0}return p}for(let p=0;p<10&&u();p++);return{label:o,bold:n,italic:r,strikethrough:s,supportIcons:e.supportThemeIcons}}renderElement(e,t,o){let n=e.element,r=n.resourceUri?A.revive(n.resourceUri):null,s=n.label?n.label:r?{label:Be(r)}:void 0,l=We(n.description)?n.description:r&&n.description===!0?this.labelService.getUriLabel(ai(r),{relative:!0}):void 0,c=s?yr(s.label)?s.label.value:s.label:void 0,u=s?.highlights&&c?s.highlights.map(([M,N])=>{if(M<0&&(M=c.length+M),N<0&&(N=c.length+N),M>=c.length||N>c.length)return{start:0,end:0};if(M>N){let V=M;M=N,N=V}return{start:M,end:N}}):void 0,{label:p,bold:h,italic:g,strikethrough:f,supportIcons:v}=this.processLabel(s?.label,u),b=cm(this.themeService.getColorTheme().type)?n.iconDark:n.icon,S=b?A.revive(b):void 0,y=this.getHover(s?.label,r,n);o.actionBar.clear(),o.icon.style.color="";let w=!0;if(n.command&&(w=Jgo(n.command,this.contextKeyService)),this.renderCheckbox(n,o),r){let M=this.configurationService.getValue("explorer.decorations"),N=r||A.parse("missing:_icon_resource");o.resourceLabel.setResource({name:p,description:l,resource:N},{fileKind:this.getFileKind(n),title:y,hideIcon:this.shouldHideResourceLabelIcon(S,n.themeIcon),fileDecorations:M,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:u||Wa(e.filterData),bold:h,italic:g,strikethrough:f,disabledCommand:!w,labelEscapeNewLines:!0,forceLabel:!!n.label,supportIcons:v})}else o.resourceLabel.setResource({name:p,description:l},{title:y,hideIcon:!0,extraClasses:["custom-view-tree-node-item-resourceLabel"],matches:u||Wa(e.filterData),bold:h,italic:g,strikethrough:f,disabledCommand:!w,labelEscapeNewLines:!0,supportIcons:v});if(S)o.icon.className="custom-view-tree-node-item-icon",o.icon.style.backgroundImage=cl(S);else{let M;this.shouldShowThemeIcon(!!r,n.themeIcon)&&(M=q.asClassName(n.themeIcon),n.themeIcon.color&&(o.icon.style.color=this.themeService.getColorTheme().getColor(n.themeIcon.color.id)?.toString()??"")),o.icon.className=M?`custom-view-tree-node-item-icon ${M}`:"",o.icon.style.backgroundImage=""}w||(o.icon.className=o.icon.className+" disabled",o.container.parentElement&&(o.container.parentElement.className=o.container.parentElement.className+" disabled")),o.actionBar.context={$treeViewId:this.treeViewId,$treeItemHandle:n.handle};let x=this.menus.getResourceActions([n]);o.actionBar.push(x,{icon:!0,label:!1}),this._actionRunner&&(o.actionBar.actionRunner=this._actionRunner),this.setAlignment(o.container,n);let E=this._renderedElements.get(e.element.handle)??[];this._renderedElements.set(e.element.handle,[...E,{original:e,rendered:o}])}rerender(){let e=new Set(this._renderedElements.keys());for(let t of e){let o=this._renderedElements.get(t)??[];for(let n of o)this.disposeElement(n.original,0,n.rendered),this.renderElement(n.original,0,n.rendered)}}renderCheckbox(e,t){if(e.checkbox){if(this._hasCheckbox||(this._hasCheckbox=!0,this.rerender()),!t.checkbox){let o=new ftt(t.checkboxContainer,this.checkboxStateHandler,this._hoverDelegate,this.hoverService);t.checkbox=o}t.checkbox.render(e)}else t.checkbox&&(t.checkbox.dispose(),t.checkbox=void 0)}setAlignment(e,t){e.parentElement.classList.toggle("align-icon-with-twisty",this.aligner.alignIconWithTwisty(t))}shouldHideResourceLabelIcon(e,t){return!!e||!!t&&!this.isFileKindThemeIcon(t)}shouldShowThemeIcon(e,t){return t?!(e&&this.isFileKindThemeIcon(t)):!1}isFileKindThemeIcon(e){return q.isFile(e)||q.isFolder(e)}getFileKind(e){if(e.themeIcon)switch(e.themeIcon.id){case LYi.id:return 0;case W5.id:return 1}return e.collapsibleState===1||e.collapsibleState===2?1:0}onDidChangeContext(e){let t=e.affectsSome(this.menus.getEntireMenuContexts()),o=[];for(let[n,r]of this._renderedElements)for(let s of r)(t||e.affectsSome(this.menus.getElementOverlayContexts(s.original.element)))&&o.push(s.original.element);o.length&&this._onDidChangeMenuContext.fire(o)}updateCheckboxes(e){let t=[];this.manuallyManageCheckboxes()?t=e:t=Zgo(e),t.forEach(o=>{let n=this._renderedElements.get(o.handle);n&&n.forEach(r=>r.rendered.checkbox?.render(o))}),this._onDidChangeCheckboxState.fire(t)}disposeElement(e,t,o){let n=this._renderedElements.get(e.element.handle)??[],r=n.findIndex(s=>o===s.rendered);n.length===1?this._renderedElements.delete(e.element.handle):n.length>0&&n.splice(r,1),o.checkbox?.dispose(),o.checkbox=void 0}disposeTemplate(e){e.resourceLabel.dispose(),e.actionBar.dispose()}};U8=I([m(7,Pe),m(8,B),m(9,nt),m(10,X),m(11,ot),m(12,F)],U8);var JEi=class extends k{constructor(e,t){super();this.themeService=e;this.logService=t}set tree(e){this._tree=e}alignIconWithTwisty(e){if(e.collapsibleState!==0||!this.hasIconOrCheckbox(e))return!1;if(this._tree){let t=this._tree.getInput(),o;try{o=this._tree.getParentElement(e)||t}catch(n){return this.logService.error(`[TreeView] Failed to resolve parent for ${e.handle}`,n),!1}return this.hasIconOrCheckbox(o)?!!o.children&&o.children.some(n=>n.collapsibleState!==0&&!this.hasIconOrCheckbox(n)):!!o.children&&o.children.every(n=>n.collapsibleState===0||!this.hasIconOrCheckbox(n))}else return!1}hasIconOrCheckbox(e){return this.hasIcon(e)||!!e.checkbox}hasIcon(e){if(cm(this.themeService.getColorTheme().type)?e.iconDark:e.icon)return!0;if(e.resourceUri||e.themeIcon){let o=this.themeService.getFileIconTheme();return(e.themeIcon?e.themeIcon.id===W5.id:e.collapsibleState!==0)?o.hasFileIcons&&o.hasFolderIcons:o.hasFileIcons}return!1}},eBt=class extends cs{constructor(e,t){super();this.getSelectedResources=t;this._register(this.onDidRun(o=>{o.error&&!Yi(o.error)&&e.error(d(5154,null,o.error.message,o.action.id))}))}async runAction(e,t){let o=this.getSelectedResources(),n,r=!1;o.length>1&&(n=o.map(s=>((s.handle===t.$treeItemHandle||t.$selectedTreeItems)&&(r=!0),{$treeViewId:t.$treeViewId,$treeItemHandle:s.handle}))),!r&&n&&(n=void 0),await e.run(t,n)}},vtt=class{constructor(i,e){this.id=i;this.menuService=e;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}getResourceActions(i){return this.getActions(this.getMenuId(),i).primary}getResourceContextActions(i){return this.getActions(this.getMenuId(),i).secondary}setContextKeyService(i){this.contextKeyService=i}filterNonUniversalActions(i,e){let t=new Set(e.map(o=>o.id));for(let o of i){let n=o.keys();for(let r of n)t.has(r)||o.delete(r)}}buildMenu(i){let e=[];for(let t of i)t.size>0&&(e.length&&e.push(new oi),e.push(...t.values()));return e}createGroups(i){let e=[],t=new Map;for(let o of i)o instanceof oi?(e.push(t),t=new Map):t.set(o.id,o);return e.push(t),e}getElementOverlayContexts(i){return new Map([["view",this.id],["viewItem",i.contextValue]])}getEntireMenuContexts(){return this.menuService.getMenuContexts(this.getMenuId())}getMenuId(){return R.ViewItemContext}getActions(i,e){if(!this.contextKeyService)return{primary:[],secondary:[]};let t=[],o=[];for(let n=0;n<e.length;n++){let r=e[n],s=this.contextKeyService.createOverlay(this.getElementOverlayContexts(r)),l=this.menuService.getMenuActions(i,s,{shouldForwardArgs:!0}),c=um(l,"inline");n===0?(t=this.createGroups(c.primary),o=this.createGroups(c.secondary)):(this.filterNonUniversalActions(t,c.primary),this.filterNonUniversalActions(o,c.secondary))}return{primary:this.buildMenu(t),secondary:this.buildMenu(o)}}dispose(){this.contextKeyService=void 0,this._onDidChange.dispose()}};vtt=I([m(1,Yt)],vtt);var oPe=class extends iPe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E){super(e,t,n,r,s,l,c,u,p,h,g,v,f,S,w,x,E);this.extensionId=o;this.extensionService=b;this.telemetryService=y}activate(){this.activated||(this.telemetryService.publicLog2("Extension:ViewActivate",{extensionId:new lh(this.extensionId),id:this.id}),this.createTree(),this.progressService.withProgress({location:this.id},()=>this.extensionService.activateByEvent(`onView:${this.id}`)).then(()=>Li(2e3)).then(()=>{this.updateMessage()}),this.activated=!0)}};oPe=I([m(3,Pe),m(4,F),m(5,fe),m(6,B),m(7,Go),m(8,Xe),m(9,Le),m(10,Ne),m(11,ji),m(12,X),m(13,ot),m(14,lt),m(15,Al),m(16,_e),m(17,re),m(18,Je),m(19,_n)],oPe);var GG=class extends iPe{activate(){this.activated||(this.createTree(),this.activated=!0)}},btt=class{constructor(i,e,t,o,n){this.treeId=i;this.labelService=e;this.instantiationService=t;this.treeViewsDragAndDropService=o;this.logService=n;this.treeItemsTransfer=Vy.getInstance();this.treeMimeType=`application/vnd.code.tree.${i.toLowerCase()}`}set controller(i){this.dndController=i}handleDragAndLog(i,e,t,o){return i.handleDrag(e,t,o).then(n=>{if(n){let r=[];for(let s of n)s[0]!==this.treeMimeType&&i.dragMimeTypes.findIndex(l=>l===s[0])<0&&r.push(s[0]);r.length&&this.logService.warn(`Drag and drop controller for tree ${this.treeId} adds the following data transfer types but does not declare them in dragMimeTypes: ${r.join(", ")}`)}return n})}addExtensionProvidedTransferTypes(i,e){if(!i.dataTransfer||!this.dndController)return;let t=ht();this.dragCancellationToken=new qe,this.treeViewsDragAndDropService.addDragOperationTransfer(t,this.handleDragAndLog(this.dndController,e,t,this.dragCancellationToken.token)),this.treeItemsTransfer.setData([new xx(t)],xx.prototype),i.dataTransfer.clearData(cr.text),this.dndController.dragMimeTypes.find(o=>o===cr.uriList)&&i.dataTransfer?.setData(Fl.RESOURCES,""),this.dndController.dragMimeTypes.forEach(o=>{i.dataTransfer?.setData(o,"")})}addResourceInfoToTransfer(i,e){if(e.length&&i.dataTransfer){this.instantiationService.invokeFunction(o=>kv(o,e,i));let t=e.filter(o=>o.scheme===Q.file).map(o=>o.fsPath);t.length&&i.dataTransfer.setData(Mc.FILES,JSON.stringify(t))}}onDragStart(i,e){if(e.dataTransfer){let t=i.getData(),o=[],n={id:this.treeId,itemHandles:[]};t.forEach(r=>{n.itemHandles.push(r.handle),r.resourceUri&&o.push(A.revive(r.resourceUri))}),this.addResourceInfoToTransfer(e,o),this.addExtensionProvidedTransferTypes(e,n.itemHandles),e.dataTransfer.setData(this.treeMimeType,JSON.stringify(n))}}debugLog(i){i.size?this.logService.debug(`TreeView dragged mime types: ${Array.from(i).join(", ")}`):this.logService.debug("TreeView dragged with no supported mime types.")}onDragOver(i,e,t,o,n){let r=Zce(n.dataTransfer),s=new Set(Array.from(r,u=>u[0]));if(n.dataTransfer){for(let u of n.dataTransfer.items)if(u.kind==="file"||u.type===Fl.RESOURCES.toLowerCase()){s.add(cr.uriList);break}}this.debugLog(s);let l=this.dndController;return!l||!n.dataTransfer||l.dropMimeTypes.length===0?!1:Array.from(s).some((u,p)=>u===this.treeMimeType?!0:l.dropMimeTypes.indexOf(u)>=0)?{accept:!0,bubble:0,autoExpand:!0}:!1}getDragURI(i){return this.dndController?i.resourceUri?A.revive(i.resourceUri).toString():i.handle:null}getDragLabel(i){if(!this.dndController)return;if(i.length>1)return String(i.length);let e=i[0];return e.label?yr(e.label.label)?e.label.label.value:e.label.label:e.resourceUri?this.labelService.getUriLabel(A.revive(e.resourceUri)):void 0}async drop(i,e,t,o,n){let r=this.dndController;if(!n.dataTransfer||!r)return;let s,l;this.treeItemsTransfer.hasData(xx.prototype)&&(l=this.treeItemsTransfer.getData(xx.prototype)[0].identifier);let c=Zce(n.dataTransfer,!0),u=new Wk;for(let[h,g]of c)if((h===this.treeMimeType||r.dropMimeTypes.includes(h)||g.asFile()&&r.dropMimeTypes.includes(Fl.FILES.toLowerCase()))&&(u.append(h,g),h===this.treeMimeType))try{s=JSON.parse(await g.asString())}catch{}let p=await this.treeViewsDragAndDropService.removeDragOperationTransfer(l);if(p)for(let[h,g]of p)u.append(h,g);return r.handleDrop(u,e,Ie.None,l,s?.id,s?.itemHandles)}onDragEnd(i){i.dataTransfer?.dropEffect==="none"&&this.dragCancellationToken?.cancel()}dispose(){}};btt=I([m(1,nt),m(2,F),m(3,A4),m(4,re)],btt);function Zgo(a){let i=[];for(let e of a)if(e.checkbox!==void 0){let t=r=>{for(let s of r.children??[])s.checkbox!==void 0&&r.checkbox!==void 0&&s.checkbox.isChecked!==r.checkbox.isChecked&&(s.checkbox.isChecked=r.checkbox.isChecked,i.push(s),t(s))};t(e);let o=new Set,n=r=>{if(r.parent?.checkbox!==void 0&&r.parent.children){if(o.has(r.parent))return;o.add(r.parent);let s=!1,l=!1;for(let c of r.parent.children){if(s&&l)break;c.checkbox!==void 0&&(c.checkbox.isChecked?l=!0:s=!0)}l&&!s&&r.parent.checkbox.isChecked!==!0?(r.parent.checkbox.isChecked=!0,i.push(r.parent),n(r.parent)):s&&r.parent.checkbox.isChecked!==!1&&(r.parent.checkbox.isChecked=!1,i.push(r.parent),n(r.parent))}};n(e)}return a.concat(i)}var Dv="workbench.view.explorer",pS="workbench.explorer.fileView",efo=new Y("explorerViewletVisible",!0,{type:"boolean",description:d(12344,null)}),z8=new Y("foldersViewVisible",!0,{type:"boolean",description:d(12346,null)}),gu=new Y("explorerResourceIsFolder",!1,{type:"boolean",description:d(12335,null)}),ZEi=new Y("explorerResourceReadonly",!1,{type:"boolean",description:d(12339,null)}),kW=ZEi.toNegated(),eTi=new Y("explorerResourceParentReadonly",!1,{type:"boolean",description:d(12338,null)}),tBt=new Y("explorerResourceAvailableEditorIds",""),nk=new Y("explorerResourceIsRoot",!1,{type:"boolean",description:d(12336,null)}),iBt=new Y("explorerResourceCut",!1,{type:"boolean",description:d(12334,null)}),Che=new Y("explorerResourceMoveableToTrash",!1,{type:"boolean",description:d(12337,null)}),tTi=new Y("filesExplorerFocus",!0,{type:"boolean",description:d(12345,null)}),tfo=new Y("openEditorsFocus",!0,{type:"boolean",description:d(12347,null)}),Itt=new Y("explorerViewletFocus",!0,{type:"boolean",description:d(12343,null)}),oBt=new Y("explorerFindProviderActive",!1,{type:"boolean",description:d(12333,null)}),xhe=new Y("explorerViewletCompressedFocus",!0,{type:"boolean",description:d(12341,null)}),ytt=new Y("explorerViewletCompressedFirstFocus",!0,{type:"boolean",description:d(12340,null)}),wtt=new Y("explorerViewletCompressedLastFocus",!0,{type:"boolean",description:d(12342,null)}),ifo=new Y("viewHasSomeCollapsibleItem",!1,{type:"boolean",description:d(12348,null)}),rk=C.and(z8,tTi,C.not(Dp)),ofo=C.and(z8,Itt,C.not(Dp)),EW="workbench.editors.files.textFileEditor",khe="workbench.editors.files.fileEditorInput",nBt="workbench.editors.files.binaryFileEditor",nPe="code-text-binary";var oP=class extends k{constructor(e,t,o,n){super();this.textFileService=e;this.fileService=t;this.languageService=o;this.modelService=n;this.fileWatcherDisposable=this._register(new ue)}static async open(e,t,o,n,r){await n.openEditor({original:{resource:oP.resourceToTextFile(t,e)},modified:{resource:e},label:o,options:r})}static resourceToTextFile(e,t){return t.with({scheme:e,query:JSON.stringify({scheme:t.scheme,query:t.query})})}static textFileToResource(e){let{scheme:t,query:o}=JSON.parse(e.query);return e.with({scheme:t,query:o})}async provideTextContent(e){if(!e.query)return null;let t=oP.textFileToResource(e),o=await this.resolveEditorModel(e);if(!this.fileWatcherDisposable.value){let n=new O;this.fileWatcherDisposable.value=n,n.add(this.fileService.onDidFilesChange(r=>{r.contains(t,0)&&this.resolveEditorModel(e,!1)})),o&&n.add(U.once(o.onWillDispose)(()=>this.fileWatcherDisposable.clear()))}return o}async resolveEditorModel(e,t=!0){let o=oP.textFileToResource(e),n=await this.textFileService.readStream(o),r=this.modelService.getModel(e);if(r)this.modelService.updateModel(r,n.value);else if(t){let s=this.modelService.getModel(o),l;s?l=this.languageService.createById(s.getLanguageId()):l=this.languageService.createByFilepathOrFirstLine(o),r=this.modelService.createModel(n.value,l,e)}return r}};oP=I([m(0,Uo),m(1,ge),m(2,Rt),m(3,_t)],oP);var dg=class a{constructor(i,e){this._editor=i;this._group=e;this.id=a.COUNTER++}static{this.COUNTER=0}get editor(){return this._editor}get group(){return this._group}get groupId(){return this._group.id}getId(){return`openeditor:${this.groupId}:${this.id}`}isPreview(){return!this._group.isPinned(this.editor)}isSticky(){return this._group.isSticky(this.editor)}getResource(){return po.getOriginalUri(this.editor,{supportSideBySide:1})}};var iTi=Oe("remote-explorer-get-started",L.star,d(14558,null)),oTi=Oe("remote-explorer-documentation",L.book,d(14553,null)),XVc=Oe("remote-explorer-feedback",L.twitter,d(14554,null)),nTi=Oe("remote-explorer-review-issues",L.issues,d(14567,null)),rTi=Oe("remote-explorer-report-issues",L.comment,d(14566,null)),nfo=Oe("remote-explorer-view-icon",L.remoteExplorer,d(14565,null)),rBt=Oe("ports-view-icon",L.plug,d(14563,null)),JVc=Oe("ports-view-icon",L.plug,d(14562,null)),sTi=Oe("private-ports-view-icon",L.lock,d(14564,null)),rfo=Oe("ports-forward-icon",L.plus,d(14557,null)),sfo=Oe("ports-stop-forward-icon",L.x,d(14568,null)),afo=Oe("ports-open-browser-icon",L.globe,d(14560,null)),lfo=Oe("ports-open-preview-icon",L.openPreview,d(14561,null)),cfo=Oe("ports-copy-address-icon",L.clippy,d(14552,null)),aTi=Oe("ports-label-icon",L.tag,d(14559,null)),dfo=Oe("ports-forwarded-without-process-icon",L.circleOutline,d(14555,null)),ufo=Oe("ports-forwarded-with-process-icon",L.circleFilled,d(14556,null));var pfo=new Y("openPreviewEnabled",!1),lTi=class{constructor(i){this.remoteExplorerService=i;this.headerRowHeight=22}getHeight(i){return i.tunnelType==="Add"&&!this.remoteExplorerService.getEditableData(void 0)?30:22}},rPe=class{constructor(i,e){this.remoteExplorerService=i;this.tunnelService=e;this._candidates=new Map;this.input={label:d(14627,null),icon:void 0,tunnelType:"Add",hasRunningProcess:!1,remoteHost:"",remotePort:0,processDescription:"",tooltipPostfix:"",iconTooltip:"",portTooltip:"",processTooltip:"",originTooltip:"",privacyTooltip:"",source:{source:0,description:""},protocol:"http",privacy:{id:"private",themeIcon:sTi.id,label:d(14651,null)},strip:()=>{}};this.model=i.tunnelModel,this.onForwardedPortsChanged=U.any(this.model.onForwardPort,this.model.onClosePort,this.model.onPortName,this.model.onCandidatesChanged)}get all(){let i=[];return this._candidates=new Map,this.model.candidates.forEach(e=>{this._candidates.set(Sm(e.host,e.port),e)}),(this.model.forwarded.size>0||this.remoteExplorerService.getEditableData(void 0))&&i.push(...this.forwarded),this.model.detected.size>0&&i.push(...this.detected),i.push(this.input),i}addProcessInfoFromCandidate(i){let e=Sm(i.remoteHost,i.remotePort);this._candidates.has(e)&&(i.processDescription=this._candidates.get(e).detail)}get forwarded(){return Array.from(this.model.forwarded.values()).map(e=>{let t=sk.createFromTunnel(this.remoteExplorerService,this.tunnelService,e);return this.addProcessInfoFromCandidate(t),t}).sort((e,t)=>e.remotePort===t.remotePort?e.remoteHost<t.remoteHost?-1:1:e.remotePort<t.remotePort?-1:1)}get detected(){return Array.from(this.model.detected.values()).map(i=>{let e=sk.createFromTunnel(this.remoteExplorerService,this.tunnelService,i,"Detected",!1);return this.addProcessInfoFromCandidate(e),e})}isEmpty(){return this.detected.length===0&&(this.forwarded.length===0||this.forwarded.length===1&&this.forwarded[0].tunnelType==="Add"&&!this.remoteExplorerService.getEditableData(void 0))}};rPe=I([m(0,Wu),m(1,Jp)],rPe);function Ett(a){return{label:"",tunnel:a,editId:0,tooltip:""}}var cTi=class{constructor(){this.label="";this.tooltip="";this.weight=1;this.minimumWidth=40;this.maximumWidth=40;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return Ett(i);let e=i.processDescription?ufo:dfo,t="";return i instanceof sk&&(t=`${i.iconTooltip} ${i.tooltipPostfix}`),{label:"",icon:e,tunnel:i,editId:0,tooltip:t}}},dTi=class{constructor(){this.label=d(14643,null);this.tooltip=d(14644,null);this.weight=1;this.templateId="actionbar"}project(i){let e=i.tunnelType==="Add",t=i.label,o="";return i instanceof sk&&!e?o=`${i.portTooltip} ${i.tooltipPostfix}`:o=t,{label:t,tunnel:i,menuId:R.TunnelPortInline,editId:i.tunnelType==="Add"?1:2,tooltip:o}}},uTi=class a{constructor(){this.label=d(14636,null);this.tooltip=d(14637,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return Ett(i);let e=i.localAddress??"",t=e;return i instanceof sk&&(t=i.tooltipPostfix),{label:e,menuId:R.TunnelLocalAddressInline,tunnel:i,editId:3,tooltip:t,markdownTooltip:e?a.getHoverText(e):void 0}}static getHoverText(i){return function(e){let t=e.getValue("editor"),o="";t.multiCursorModifier==="ctrlCmd"?et?o=d(14597,null):o=d(14596,null):et?o=d(14598,null):o=d(14599,null);let n=new he("",!0),r=i.startsWith("http")?i:`http://${i}`;return n.appendLink(r,"Follow link").appendMarkdown(` (${o})`)}}},pTi=class{constructor(){this.label=d(14647,null);this.tooltip=d(14648,null);this.weight=2;this.templateId="actionbar"}project(i){return i.tunnelType==="Add"?Ett(i):{label:i.processDescription??"",tunnel:i,editId:0,tooltip:i instanceof sk?i.processTooltip:""}}},mTi=class{constructor(){this.label=d(14641,null);this.tooltip=d(14642,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return Ett(i);let e=i.source.description,t=`${i instanceof sk?i.originTooltip:""}. ${i instanceof sk?i.tooltipPostfix:""}`;return{label:e,menuId:R.TunnelOriginInline,tunnel:i,editId:0,tooltip:t}}},hTi=class{constructor(){this.label=d(14645,null);this.tooltip=d(14646,null);this.weight=1;this.templateId="actionbar"}project(i){if(i.tunnelType==="Add")return Ett(i);let e=i.privacy?.label,t="";return i instanceof sk&&(t=`${i.privacy.label} ${i.tooltipPostfix}`),{label:e,tunnel:i,icon:{id:i.privacy.themeIcon},editId:0,tooltip:t}}},Ctt=class{constructor(i,e,t,o,n,r,s){this.instantiationService=i;this.contextKeyService=e;this.menuService=t;this.contextViewService=o;this.remoteExplorerService=n;this.commandService=r;this.configurationService=s;this.templateId="actionbar";this._hoverDelegate=yi("mouse")}set actionRunner(i){this._actionRunner=i}renderTemplate(i){let e=D(i,_(".ports-view-actionbar-cell")),t=D(e,_(".ports-view-actionbar-cell-icon")),o=new O,n=new O;o.add(n);let r=o.add(new ld(e,{supportHighlights:!0,hoverDelegate:this._hoverDelegate})),s=D(e,_(".actions")),l=o.add(new oo(s,{actionViewItemProvider:ta.bind(void 0,this.instantiationService),hoverDelegate:this._hoverDelegate}));return{label:r,icon:t,actionBar:l,container:e,templateDisposables:o,elementDisposables:n}}renderElement(i,e,t){t.actionBar.clear(),t.icon.className="ports-view-actionbar-cell-icon",t.icon.style.display="none",t.label.setLabel(""),t.label.element.style.display="none",t.container.style.height="22px",t.button&&(t.button.element.style.display="none"),t.container.style.paddingLeft="0px",t.elementDisposables.clear();let o;i.editId===1&&(o=this.remoteExplorerService.getEditableData(void 0))?this.renderInputBox(t,o):(o=this.remoteExplorerService.getEditableData(i.tunnel,i.editId),o?this.renderInputBox(t,o):i.tunnel.tunnelType==="Add"&&i.menuId===R.TunnelPortInline?this.renderButton(i,t):this.renderActionBarItem(i,t))}renderButton(i,e){e.container.style.paddingLeft="7px",e.container.style.height="28px",e.button=e.elementDisposables.add(new Pi(e.container,Ro)),e.button.label=i.label,e.button.element.title=i.tooltip,e.elementDisposables.add(e.button.onDidClick(()=>{this.commandService.executeCommand(PC.INLINE_ID)}))}tunnelContext(i){let e;return i instanceof sk&&(e=i.strip()),e||(e={tunnelType:i.tunnelType,remoteHost:i.remoteHost,remotePort:i.remotePort,localAddress:i.localAddress,protocol:i.protocol,localUri:i.localUri,localPort:i.localPort,name:i.name,closeable:i.closeable,source:i.source,privacy:i.privacy,processDescription:i.processDescription,label:i.label}),e}renderActionBarItem(i,e){e.label.element.style.display="flex",e.label.setLabel(i.label,void 0,{title:i.markdownTooltip?{markdown:i.markdownTooltip(this.configurationService),markdownNotSupportedFallback:i.tooltip}:i.tooltip,extraClasses:i.menuId===R.TunnelLocalAddressInline?["ports-view-actionbar-cell-localaddress"]:void 0}),e.actionBar.context=this.tunnelContext(i.tunnel),e.container.style.paddingLeft="10px";let t=[["view",b8],[Ttt.key,i.tunnel.tunnelType],[_tt.key,i.tunnel.closeable],[gTi.key,i.tunnel.privacy.id],[aBt.key,i.tunnel.protocol]],o=this.contextKeyService.createOverlay(t);if(i.menuId){let n=e.elementDisposables.add(this.menuService.createMenu(i.menuId,o)),r=Ng(n.getActions({shouldForwardArgs:!0}));if(r){let s=r.filter(l=>l.id.toLowerCase().indexOf("label")>=0);s.length>1&&(s.sort((l,c)=>l.label.length-c.label.length),s.pop(),r=r.filter(l=>s.indexOf(l)<0)),e.actionBar.push(r,{icon:!0,label:!1}),this._actionRunner&&(e.actionBar.actionRunner=this._actionRunner)}}i.icon&&(e.icon.className=`ports-view-actionbar-cell-icon ${q.asClassName(i.icon)}`,e.icon.title=i.tooltip,e.icon.style.display="inline")}renderInputBox(i,e){this.inputDone&&(this.inputDone(!1,!1),this.inputDone=void 0);let{container:t}=i;t.style.paddingLeft="5px";let o=e.startingValue||"",n=new ad(t,this.contextViewService,{ariaLabel:d(14629,null),validationOptions:{validation:l=>{let c=e.validationMessage(l);return c?{content:c.content,formatContent:!0,type:c.severity===ft.Error?3:1}:null}},placeholder:e.placeholder||"",inputBoxStyles:Wl});n.value=o,n.focus(),n.select({start:0,end:e.startingValue?e.startingValue.length:0});let r=bd(async(l,c)=>{je(s),this.inputDone&&(this.inputDone=void 0),n.element.style.display="none";let u=n.value;if(c)return e.onFinish(u,l)});this.inputDone=r;let s=[n,Yo(n.inputElement,ne.KEY_DOWN,async l=>{if(l.equals(3))return l.stopPropagation(),n.validate()!==3?r(!0,!0):r(!1,!0);if(l.equals(9))return l.preventDefault(),l.stopPropagation(),r(!1,!0)}),$(n.inputElement,ne.BLUR,()=>r(n.validate()!==3,!0))];i.elementDisposables.add(ee(()=>{r(!1,!1)}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Ctt=I([m(0,F),m(1,X),m(2,Yt),m(3,qn),m(4,Wu),m(5,fe),m(6,B)],Ctt);var sk=class a{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this.tunnelType=i;this.remoteHost=e;this.remotePort=t;this.source=o;this.hasRunningProcess=n;this.protocol=r;this.localUri=s;this.localAddress=l;this.localPort=c;this.closeable=u;this.name=p;this.runningProcess=h;this.pid=g;this._privacy=f;this.remoteExplorerService=v;this.tunnelService=b}static createFromTunnel(i,e,t,o="Forwarded",n){return new a(o,t.remoteHost,t.remotePort,t.source,!!t.hasRunningProcess,t.protocol,t.localUri,t.localAddress,t.localPort,n===void 0?t.closeable:n,t.name,t.runningProcess,t.pid,t.privacy,i,e)}strip(){return new a(this.tunnelType,this.remoteHost,this.remotePort,this.source,this.hasRunningProcess,this.protocol,this.localUri,this.localAddress,this.localPort,this.closeable,this.name,this.runningProcess,this.pid,this._privacy)}get label(){if(this.tunnelType==="Add"&&this.name)return this.name;let i=ete(this.remoteHost)||v8(this.remoteHost)?`${this.remotePort}`:`${this.remoteHost}:${this.remotePort}`;return this.name?`${this.name} (${i})`:i}set processDescription(i){this.runningProcess=i}get processDescription(){let i="";return this.runningProcess?(this.pid&&this.remoteExplorerService?.namedProcesses.has(this.pid)?i=this.remoteExplorerService.namedProcesses.get(this.pid):i=this.runningProcess.replace(/\0/g," ").trim(),this.pid&&(i+=` (${this.pid})`)):this.hasRunningProcess&&(i=d(14654,null)),i}get tooltipPostfix(){let i;return this.localAddress?i=d(14625,null,this.remoteHost,this.remotePort,this.localAddress):i=d(14624,null,this.remoteHost,this.remotePort),i}get iconTooltip(){return this.tunnelType==="Add"?this.label:`${this.processDescription?d(14640,null):d(14639,null)}`}get portTooltip(){return this.tunnelType==="Add"?"":`${this.name?d(14626,null,this.name):""}`}get processTooltip(){return this.processDescription??""}get originTooltip(){return this.source.description}get privacy(){return this.tunnelService?.privacyOptions?this.tunnelService?.privacyOptions.find(i=>i.id===this._privacy)??{id:"",themeIcon:L.question.id,label:d(14652,null)}:{id:"private",themeIcon:sTi.id,label:d(14651,null)}}},Ttt=new Y("tunnelType","Add",!0),_tt=new Y("tunnelCloseable",!1,!0),gTi=new Y("tunnelPrivacy",void 0,!0),mfo=new Y("tunnelPrivacyEnabled",!1,!0),aBt=new Y("tunnelProtocol","http",!0),lBt=new Y("tunnelViewFocus",!1,d(14638,null)),Dtt="tunnelViewSelection",Cin=new Y(Dtt,void 0,!0),hfo="tunnelViewMultiSelection",gfo=new Y(hfo,void 0,!0),ffo=new Y("portChangable",!1,!0),vfo=new Y("protocolChangable",!0,!0),TW=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(t,o,n,s,r,c,l,u,f,b);this.viewModel=e;this.quickInputService=p;this.commandService=h;this.menuService=g;this.remoteExplorerService=v;this.tunnelService=S;this.contextViewService=y;this.tableDisposables=this._register(new O);this.isEditing=!1;this.titleActions=[];this.lastFocus=[];this.height=0;this.width=0;this.tunnelTypeContext=Ttt.bindTo(r),this.tunnelCloseableContext=_tt.bindTo(r),this.tunnelPrivacyContext=gTi.bindTo(r),this.tunnelPrivacyEnabledContext=mfo.bindTo(r),this.tunnelPrivacyEnabledContext.set(S.canChangePrivacy),this.protocolChangableContextKey=vfo.bindTo(r),this.protocolChangableContextKey.set(S.canChangeProtocol),this.tunnelProtocolContext=aBt.bindTo(r),this.tunnelViewFocusContext=lBt.bindTo(r),this.tunnelViewSelectionContext=Cin.bindTo(r),this.tunnelViewMultiSelectionContext=gfo.bindTo(r),this.portChangableContextKey=ffo.bindTo(r);let w=this.contextKeyService.createOverlay([["view",TW.ID]]),x=this._register(this.menuService.createMenu(R.TunnelTitle,w)),E=()=>{this.titleActions=Ng(x.getActions()),this.updateActions()};this._register(x.onDidChange(E)),E(),this._register(ee(()=>{this.titleActions=[]})),this.registerPrivacyActions(),this._register(U.once(this.tunnelService.onAddedTunnelProvider)(()=>{let M=!1;this.tunnelPrivacyEnabledContext.get()===!1&&(this.tunnelPrivacyEnabledContext.set(S.canChangePrivacy),M=!0),this.protocolChangableContextKey.get()===!0&&(this.protocolChangableContextKey.set(S.canChangeProtocol),M=!0),M&&(E(),this.registerPrivacyActions(),this.createTable(),this.table?.layout(this.height,this.width))}))}static{this.ID=b8}static{this.TITLE=P(14601,"Ports")}registerPrivacyActions(){for(let e of this.tunnelService.privacyOptions){let t=`remote.tunnel.privacy${e.id}`;Ge.registerCommand(t,yfo.handler(e.id)),be.appendMenuItem(R.TunnelPrivacy,{order:0,command:{id:t,title:e.label,toggled:gTi.isEqualTo(e.id)}})}}get portCount(){return this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size}createTable(){if(!this.panelContainer)return;this.tableDisposables.clear(),St(this.panelContainer);let e=D(this.panelContainer,_(".customview-tree"));e.classList.add("ports-view"),e.classList.add("file-icon-themable-tree","show-file-icons");let t=new Ctt(this.instantiationService,this.contextKeyService,this.menuService,this.contextViewService,this.remoteExplorerService,this.commandService,this.configurationService),o=[new cTi,new dTi,new uTi,new pTi];this.tunnelService.canChangePrivacy&&o.push(new hTi),o.push(new mTi),this.table=this.instantiationService.createInstance(Cx,"RemoteTunnels",e,new lTi(this.remoteExplorerService),o,[t],{keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:l=>l.label},multipleSelectionSupport:!0,accessibilityProvider:{getAriaLabel:l=>l instanceof sk?`${l.tooltipPostfix} ${l.portTooltip} ${l.iconTooltip} ${l.processTooltip} ${l.originTooltip} ${this.tunnelService.canChangePrivacy?l.privacy.label:""}`:l.label,getWidgetAriaLabel:()=>d(14653,null)},openOnSingleClick:!0});let n=this.tableDisposables.add(new cs);t.actionRunner=n,this.tableDisposables.add(this.table),this.tableDisposables.add(this.table.onContextMenu(l=>this.onContextMenu(l,n))),this.tableDisposables.add(this.table.onMouseDblClick(l=>this.onMouseDblClick(l))),this.tableDisposables.add(this.table.onDidChangeFocus(l=>this.onFocusChanged(l))),this.tableDisposables.add(this.table.onDidChangeSelection(l=>this.onSelectionChanged(l))),this.tableDisposables.add(this.table.onDidFocus(()=>this.tunnelViewFocusContext.set(!0))),this.tableDisposables.add(this.table.onDidBlur(()=>this.tunnelViewFocusContext.set(!1)));let r=()=>this.table?.splice(0,Number.POSITIVE_INFINITY,this.viewModel.all);r();let s=this.portCount;this.tableDisposables.add(U.debounce(this.viewModel.onForwardedPortsChanged,(l,c)=>c,50)(()=>{let l=this.portCount;(s===0||l===0)&&s!==l&&this._onDidChangeViewWelcomeState.fire(),s=l,r()})),this.tableDisposables.add(this.table.onMouseClick(l=>{if(this.hasOpenLinkModifier(l.browserEvent)&&this.table){let c=this.table.getSelectedElements();(c.length===0||c.length===1&&c[0]===l.element)&&this.commandService.executeCommand(VN.ID,l.element)}})),this.tableDisposables.add(this.table.onDidOpen(l=>{!l.element||l.element.tunnelType!=="Forwarded"||l.browserEvent?.type==="dblclick"&&this.commandService.executeCommand(Tte.ID)})),this.tableDisposables.add(this.remoteExplorerService.onDidChangeEditable(l=>{this.isEditing=!!this.remoteExplorerService.getEditableData(l?.tunnel,l?.editId),this._onDidChangeViewWelcomeState.fire(),this.isEditing||e.classList.remove("highlight"),r(),this.isEditing?(e.classList.add("highlight"),l||this.table?.reveal(this.table.indexOf(this.viewModel.input))):(l&&l.tunnel.tunnelType!=="Add"&&this.table?.setFocus(this.lastFocus),this.focus())}))}renderBody(e){super.renderBody(e),this.panelContainer=D(e,_(".tree-explorer-viewlet-tree-view")),this.createTable()}shouldShowWelcome(){return this.viewModel.isEmpty()&&!this.isEditing}focus(){super.focus(),this.table?.domFocus()}onFocusChanged(e){e.indexes.length>0&&e.elements.length>0&&(this.lastFocus=[...e.indexes]);let t=e.elements,o=t&&t.length?t[0]:void 0;o?(this.tunnelViewSelectionContext.set(Sm(o.remoteHost,o.remotePort)),this.tunnelTypeContext.set(o.tunnelType),this.tunnelCloseableContext.set(!!o.closeable),this.tunnelPrivacyContext.set(o.privacy.id),this.tunnelProtocolContext.set(o.protocol==="https"?"https":"https"),this.portChangableContextKey.set(!!o.localPort)):(this.tunnelTypeContext.reset(),this.tunnelViewSelectionContext.reset(),this.tunnelCloseableContext.reset(),this.tunnelPrivacyContext.reset(),this.tunnelProtocolContext.reset(),this.portChangableContextKey.reset())}hasOpenLinkModifier(e){let t=this.configurationService.getValue("editor"),o=!1;return t.multiCursorModifier==="ctrlCmd"?o=e.altKey:et?o=e.metaKey:o=e.ctrlKey,o}onSelectionChanged(e){let t=e.elements;t.length>1?this.tunnelViewMultiSelectionContext.set(t.map(o=>Sm(o.remoteHost,o.remotePort))):this.tunnelViewMultiSelectionContext.set(void 0)}onContextMenu(e,t){if(e.element!==void 0&&!(e.element instanceof sk))return;e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let o=e.element;o?(this.table?.setFocus([this.table.indexOf(o)]),this.tunnelTypeContext.set(o.tunnelType),this.tunnelCloseableContext.set(!!o.closeable),this.tunnelPrivacyContext.set(o.privacy.id),this.tunnelProtocolContext.set(o.protocol),this.portChangableContextKey.set(!!o.localPort)):(this.tunnelTypeContext.set("Add"),this.tunnelCloseableContext.set(!1),this.tunnelPrivacyContext.set(void 0),this.tunnelProtocolContext.set(void 0),this.portChangableContextKey.set(!1)),this.contextMenuService.showContextMenu({menuId:R.TunnelContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this.table?.contextKeyService,getAnchor:()=>e.anchor,getActionViewItem:n=>{let r=this.keybindingService.lookupKeybinding(n.id);if(r)return new ts(n,n,{label:!0,keybinding:r.getLabel()})},onHide:n=>{n&&this.table?.domFocus()},getActionsContext:()=>o?.strip(),actionRunner:t})}onMouseDblClick(e){e.element||this.commandService.executeCommand(PC.INLINE_ID)}layoutBody(e,t){this.height=e,this.width=t,super.layoutBody(e,t),this.table?.layout(e,t)}};TW=I([m(2,Le),m(3,Xe),m(4,X),m(5,B),m(6,F),m(7,ji),m(8,Je),m(9,$e),m(10,fe),m(11,Yt),m(12,Pe),m(13,Wu),m(14,ot),m(15,Jp),m(16,qn)],TW);var sBt=class{constructor(i,e){this.id=TW.ID;this.name=TW.TITLE;this.canToggleVisibility=!0;this.hideByDefault=!1;this.group="details@0";this.order=-500;this.canMoveView=!0;this.containerIcon=rBt;this.ctorDescriptor=new Vt(TW,[i]),this.remoteAuthority=e.remoteAuthority?e.remoteAuthority.split("+")[0]:void 0}};function _te(a){return a&&a.tunnelType&&a.remoteHost&&a.source}var Tte;(o=>{o.ID="remote.tunnel.label",o.LABEL=d(14615,null),o.COMMAND_ID_KEYWORD="label";function t(){return async(n,r)=>{let s=n.get(Wu),l;if(_te(r))l=r;else{let c=n.get(X).getContextKeyValue(Dtt),u=c?s.tunnelModel.forwarded.get(c):void 0;if(u){let p=n.get(Jp);l=sk.createFromTunnel(s,p,u)}}if(l){let c=l;return new Promise(u=>{let p=c.name?c.name:`${c.remotePort}`;s.setEditable(c,2,{onFinish:async(h,g)=>{h=h.trim(),s.setEditable(c,2,null);let f=g&&h!==p;f&&await s.tunnelModel.name(c.remoteHost,c.remotePort,h),u(f?{port:c.remotePort,label:h}:void 0)},validationMessage:()=>null,placeholder:d(14630,null),startingValue:p})})}}}o.handler=t})(Tte||={});var xin=d(14632,null),fTi=65536,bfo=d(14631,null,fTi),Sfo=d(14635,null),kin=d(14634,null),PC;(c=>{c.INLINE_ID="remote.tunnel.forwardInline",c.COMMANDPALETTE_ID="remote.tunnel.forwardCommandPalette",c.LABEL=P(14610,"Forward a Port"),c.TREEITEM_LABEL=d(14613,null);let o=d(14614,null);function n(u,p,h,g){let f=XZe(h);if(f){if(f.port>=fTi)return{content:bfo,severity:ft.Error};if(g&&p.isPortPrivileged(f.port))return{content:Sfo,severity:ft.Info};if(sS(u.tunnelModel.forwarded,f.host,f.port))return{content:kin,severity:ft.Error}}else return{content:xin,severity:ft.Error};return null}function r(u,p,h,g){p?typeof p=="string"&&u.warn(d(14612,null,h,g,p)):u.warn(d(14611,null,h,g))}function s(){return async(u,p)=>{let h=u.get(Wu),g=u.get(Ne),f=u.get(Jp);h.setEditable(void 0,1,{onFinish:async(v,b)=>{h.setEditable(void 0,1,null);let S;b&&(S=XZe(v))&&h.forward({remote:{host:S.host,port:S.port},elevateIfNeeded:!0}).then(y=>r(g,y,S.host,S.port))},validationMessage:v=>n(h,f,v,f.canElevate),placeholder:o})}}c.inlineHandler=s;function l(){return async(u,p)=>{let h=u.get(Wu),g=u.get(Ne),f=u.get(Gt),v=u.get($e),b=u.get(Jp);await f.openView(TW.ID,!0);let S=await v.input({prompt:o,validateInput:w=>Promise.resolve(n(h,b,w,b.canElevate))}),y;S&&(y=XZe(S))&&h.forward({remote:{host:y.host,port:y.port},elevateIfNeeded:!0}).then(w=>r(g,w,y.host,y.port))}}c.commandPaletteHandler=l})(PC||={});function Ifo(a,i,e){let t=a.map(o=>{let n=sk.createFromTunnel(i,e,o);return{label:n.label,description:n.processDescription,tunnel:n}});return t.length===0&&t.push({label:d(14605,null,PC.LABEL.value)}),t}var gU;(n=>{n.INLINE_ID="remote.tunnel.closeInline",n.COMMANDPALETTE_ID="remote.tunnel.closeCommandPalette",n.LABEL=P(14604,"Stop Forwarding Port");function t(){return async(r,s)=>{let l=r.get(X),c=r.get(Wu),u=[],p=l.getContextKeyValue(hfo);if(p)p.forEach(h=>{let g=c.tunnelModel.forwarded.get(h);g&&u?.push(g)});else if(_te(s))u=[s];else{let h=l.getContextKeyValue(Dtt),g=h?c.tunnelModel.forwarded.get(h):void 0;g&&(u=[g])}if(!(!u||u.length===0))return Promise.all(u.map(h=>c.close({host:h.remoteHost,port:h.remotePort},"User")))}}n.inlineHandler=t;function o(){return async r=>{let s=r.get($e),l=r.get(Wu),c=r.get(Jp),u=r.get(fe),p=Ifo(Array.from(l.tunnelModel.forwarded.values()).filter(g=>g.closeable),l,c),h=await s.pick(p,{placeHolder:d(14606,null)});h&&h.tunnel?await l.close({host:h.tunnel.remoteHost,port:h.tunnel.remotePort},"User"):h&&await u.executeCommand(PC.COMMANDPALETTE_ID)}}n.commandPaletteHandler=o})(gU||={});var VN;(o=>{o.ID="remote.tunnel.open",o.LABEL=d(14616,null);function e(){return async(n,r)=>{let s;if(_te(r)?s=Sm(r.remoteHost,r.remotePort):dxi(r)&&(s=Sm(r.tunnelRemoteHost,r.tunnelRemotePort)),s){let l=n.get(Wu).tunnelModel,c=n.get(Je);return t(l,c,s)}}}o.handler=e;function t(n,r,s){let l=n.forwarded.get(s)||n.detected.get(s);return l?r.open(l.localUri,{allowContributedOpeners:!1}):Promise.resolve()}o.run=t})(VN||={});var fU;(o=>{o.ID="remote.tunnel.openPreview",o.LABEL=d(14621,null);function e(){return async(n,r)=>{let s;if(_te(r)?s=Sm(r.remoteHost,r.remotePort):dxi(r)&&(s=Sm(r.tunnelRemoteHost,r.tunnelRemotePort)),s){let l=n.get(Wu).tunnelModel,c=n.get(Je),u=n.get(Hee);return t(l,c,u,s)}}}o.handler=e;async function t(n,r,s,l){let c=n.forwarded.get(l)||n.detected.get(l);if(c){let u=c.remoteHost.includes(":")?`[${c.remoteHost}]`:c.remoteHost,p=A.parse(`http://${u}:${c.remotePort}`),h=await s.getOpener(c.localUri,{sourceUri:p},Ie.None);return h?h.openExternalUri(c.localUri,{sourceUri:p},Ie.None):r.open(c.localUri)}return Promise.resolve()}o.run=t})(fU||={});var xtt;(t=>{t.ID="remote.tunnel.openCommandPalette",t.LABEL=d(14617,null);function e(){return async(o,n)=>{let r=o.get(Wu),s=o.get(Jp),l=r.tunnelModel,c=o.get($e),u=o.get(Je),p=o.get(fe),h=[...l.forwarded,...l.detected].map(f=>{let v=sk.createFromTunnel(r,s,f[1]);return{label:v.label,description:v.processDescription,tunnel:v}});h.length===0?h.push({label:d(14618,null)}):h.push({label:d(14620,null)});let g=await c.pick(h,{placeHolder:d(14619,null)});if(g&&g.tunnel)return VN.run(l,u,Sm(g.tunnel.remoteHost,g.tunnel.remotePort));if(g)return p.executeCommand(`${b8}.focus`)}}t.handler=e})(xtt||={});var vU;(s=>{s.INLINE_ID="remote.tunnel.copyAddressInline",s.COMMANDPALETTE_ID="remote.tunnel.copyAddressCommandPalette",s.INLINE_LABEL=d(14608,null),s.COMMANDPALETTE_LABEL=d(14607,null);async function o(l,c,u){let p=l.tunnelModel.address(u.remoteHost,u.remotePort);p&&await c.writeText(p.toString())}function n(){return async(l,c)=>{let u=l.get(Wu),p;if(_te(c))p=c;else{let h=l.get(X).getContextKeyValue(Dtt);p=h?u.tunnelModel.forwarded.get(h):void 0}if(p)return o(u,l.get(Bi),p)}}s.inlineHandler=n;function r(){return async(l,c)=>{let u=l.get($e),p=l.get(Wu),h=l.get(Jp),g=l.get(fe),f=l.get(Bi),v=Array.from(p.tunnelModel.forwarded.values()).concat(Array.from(p.tunnelModel.detected.values())),b=await u.pick(Ifo(v,p,h),{placeHolder:d(14609,null)});b&&b.tunnel?await o(p,f,b.tunnel):b&&await g.executeCommand(PC.COMMANDPALETTE_ID)}}s.commandPaletteHandler=r})(vU||={});var ktt;(o=>{o.ID="remote.tunnel.changeLocalPort",o.LABEL=d(14602,null);function e(n,r,s){if(r.match(/^[0-9]+$/)){if(Number(r)>=fTi)return{content:bfo,severity:ft.Error};if(s&&n.isPortPrivileged(Number(r)))return{content:Sfo,severity:ft.Info}}else return{content:d(14633,null),severity:ft.Error};return null}function t(){return async(n,r)=>{let s=n.get(Wu),l=n.get(Ne),c=n.get(Jp),u;if(_te(r))u=r;else{let p=n.get(X).getContextKeyValue(Dtt),h=p?s.tunnelModel.forwarded.get(p):void 0;if(h){let g=n.get(Jp);u=sk.createFromTunnel(s,g,h)}}if(u){let p=u;s.setEditable(p,3,{onFinish:async(h,g)=>{if(s.setEditable(p,3,null),g){await s.close({host:p.remoteHost,port:p.remotePort},"Other");let f=Number(h),v=await s.forward({remote:{host:p.remoteHost,port:p.remotePort},local:f,name:p.name,elevateIfNeeded:!0,source:p.source});v&&typeof v!="string"&&v.tunnelLocalPort!==f&&l.warn(d(14603,null,h,v.tunnelLocalPort??v.localAddress))}},validationMessage:h=>e(c,h,c.canElevate),placeholder:d(14628,null)})}}}o.handler=t})(ktt||={});var yfo;(i=>{function a(e){return async(t,o)=>{if(_te(o)){let n=t.get(Wu);return await n.close({host:o.remoteHost,port:o.remotePort},"Other"),n.forward({remote:{host:o.remoteHost,port:o.remotePort},local:o.localPort,name:o.name,elevateIfNeeded:!0,privacy:e,source:o.source})}}}i.handler=a})(yfo||={});var K8;(s=>{s.ID_HTTP="remote.tunnel.setProtocolHttp",s.ID_HTTPS="remote.tunnel.setProtocolHttps",s.LABEL_HTTP=d(14622,null),s.LABEL_HTTPS=d(14623,null);async function o(l,c,u,p){if(_te(l)){let h={protocol:c},g=p.remoteAuthority?4:3;return u.tunnelModel.configPortsAttributes.addAttributes(l.remotePort,h,g)}}function n(){return async(l,c)=>o(c,"http",l.get(Wu),l.get(Mt))}s.handlerHttp=n;function r(){return async(l,c)=>o(c,"https",l.get(Wu),l.get(Mt))}s.handlerHttps=r})(K8||={});var vTi=10,Ehe=Ttt.isEqualTo("Forwarded"),The=C.or(Ehe,Ttt.isEqualTo("Detected")),Dte=gfo.isEqualTo(void 0);xt.registerCommandAndKeybindingRule({id:Tte.ID,weight:200+vTi,when:C.and(lBt,Ehe,Dte),primary:60,mac:{primary:3},handler:Tte.handler()});Ge.registerCommand(PC.INLINE_ID,PC.inlineHandler());Ge.registerCommand(PC.COMMANDPALETTE_ID,PC.commandPaletteHandler());xt.registerCommandAndKeybindingRule({id:gU.INLINE_ID,weight:200+vTi,when:C.and(_tt,lBt),primary:20,mac:{primary:2049,secondary:[20]},handler:gU.inlineHandler()});Ge.registerCommand(gU.COMMANDPALETTE_ID,gU.commandPaletteHandler());Ge.registerCommand(VN.ID,VN.handler());Ge.registerCommand(fU.ID,fU.handler());Ge.registerCommand(xtt.ID,xtt.handler());xt.registerCommandAndKeybindingRule({id:vU.INLINE_ID,weight:200+vTi,when:C.and(lBt,The,Dte),primary:2081,handler:vU.inlineHandler()});Ge.registerCommand(vU.COMMANDPALETTE_ID,vU.commandPaletteHandler());Ge.registerCommand(ktt.ID,ktt.handler());Ge.registerCommand(K8.ID_HTTP,K8.handlerHttp());Ge.registerCommand(K8.ID_HTTPS,K8.handlerHttps());be.appendMenuItem(R.CommandPalette,{command:{id:gU.COMMANDPALETTE_ID,title:gU.LABEL},when:xG});be.appendMenuItem(R.CommandPalette,{command:{id:PC.COMMANDPALETTE_ID,title:PC.LABEL},when:xG});be.appendMenuItem(R.CommandPalette,{command:{id:vU.COMMANDPALETTE_ID,title:vU.COMMANDPALETTE_LABEL},when:xG});be.appendMenuItem(R.CommandPalette,{command:{id:xtt.ID,title:xtt.LABEL},when:xG});be.appendMenuItem(R.TunnelContext,{group:"._open",order:0,command:{id:VN.ID,title:VN.LABEL},when:C.and(The,Dte)});be.appendMenuItem(R.TunnelContext,{group:"._open",order:1,command:{id:fU.ID,title:fU.LABEL},when:C.and(The,Dte)});be.appendMenuItem(R.TunnelContext,{group:"0_manage",order:1,command:{id:Tte.ID,title:Tte.LABEL,icon:aTi},when:C.and(Ehe,Dte)});be.appendMenuItem(R.TunnelContext,{group:"2_localaddress",order:0,command:{id:vU.INLINE_ID,title:vU.INLINE_LABEL},when:C.and(The,Dte)});be.appendMenuItem(R.TunnelContext,{group:"2_localaddress",order:1,command:{id:ktt.ID,title:ktt.LABEL},when:C.and(Ehe,ffo,Dte)});be.appendMenuItem(R.TunnelContext,{group:"2_localaddress",order:2,submenu:R.TunnelPrivacy,title:d(14649,null),when:C.and(Ehe,mfo)});be.appendMenuItem(R.TunnelContext,{group:"2_localaddress",order:3,submenu:R.TunnelProtocol,title:d(14650,null),when:C.and(Ehe,Dte,vfo)});be.appendMenuItem(R.TunnelContext,{group:"3_forward",order:0,command:{id:gU.INLINE_ID,title:gU.LABEL},when:_tt});be.appendMenuItem(R.TunnelContext,{group:"3_forward",order:1,command:{id:PC.INLINE_ID,title:PC.LABEL}});be.appendMenuItem(R.TunnelProtocol,{order:0,command:{id:K8.ID_HTTP,title:K8.LABEL_HTTP,toggled:aBt.isEqualTo("http")}});be.appendMenuItem(R.TunnelProtocol,{order:1,command:{id:K8.ID_HTTPS,title:K8.LABEL_HTTPS,toggled:aBt.isEqualTo("https")}});be.appendMenuItem(R.TunnelPortInline,{group:"0_manage",order:0,command:{id:PC.INLINE_ID,title:PC.TREEITEM_LABEL,icon:rfo},when:Ttt.isEqualTo("Candidate")});be.appendMenuItem(R.TunnelPortInline,{group:"0_manage",order:4,command:{id:Tte.ID,title:Tte.LABEL,icon:aTi},when:Ehe});be.appendMenuItem(R.TunnelPortInline,{group:"0_manage",order:5,command:{id:gU.INLINE_ID,title:gU.LABEL,icon:sfo},when:_tt});be.appendMenuItem(R.TunnelLocalAddressInline,{order:-1,command:{id:vU.INLINE_ID,title:vU.INLINE_LABEL,icon:cfo},when:The});be.appendMenuItem(R.TunnelLocalAddressInline,{order:0,command:{id:VN.ID,title:VN.LABEL,icon:afo},when:The});be.appendMenuItem(R.TunnelLocalAddressInline,{order:1,command:{id:fU.ID,title:fU.LABEL,icon:lfo},when:The});te("ports.iconRunningProcessForeground",nso,d(14600,null));var cBt=class a extends k{constructor(e,t){super();this._onDidMatchLocalUrl=this._register(new T);this.onDidMatchLocalUrl=this._onDidMatchLocalUrl.event;this.listeners=new Map;this.terminalDataWorkers=this._register(new Ot);this.replPositions=new Map;e.instances.forEach(o=>{this.registerTerminalInstance(o)}),this._register(e.onDidCreateInstance(o=>{this.registerTerminalInstance(o)})),this._register(e.onDidDisposeInstance(o=>{this.listeners.get(o)?.dispose(),this.listeners.delete(o),this.terminalDataWorkers.deleteAndDispose(o)})),this._register(t.onDidNewSession(o=>{(!o.parentSession||o.parentSession&&o.hasSeparateRepl())&&this.listeners.set(o.getId(),o.onDidChangeReplElements(()=>{this.processNewReplElements(o)}))})),this._register(t.onDidEndSession(({session:o})=>{this.listeners.has(o.getId())&&(this.listeners.get(o.getId())?.dispose(),this.listeners.delete(o.getId()))}))}static{this.dataDebounceTimeout=500}static{this.maxDataLength=1e4}static{this.localUrlRegex=/\b\w{0,20}(?::\/\/)?(?:localhost|127\.0\.0\.1|0\.0\.0\.0|:\d{2,5})[\w\-\.\~:\/\?\#[\]\@!\$&\(\)\*\+\,\;\=]*/gim}static{this.extractPortRegex=/(localhost|127\.0\.0\.1|0\.0\.0\.0):(\d{1,5})/}static{this.localPythonServerRegex=/HTTP\son\s(127\.0\.0\.1|0\.0\.0\.0)\sport\s(\d+)/}static{this.excludeTerminals=["Dev Containers"]}registerTerminalInstance(e){a.excludeTerminals.includes(e.title)||this.listeners.set(e,e.onData(t=>{this.getOrCreateWorker(e).work(t)}))}getOrCreateWorker(e){let t=this.terminalDataWorkers.get(e);return t||(t=new hA(o=>this.processTerminalData(o),a.dataDebounceTimeout),this.terminalDataWorkers.set(e,t)),t}processTerminalData(e){e.reduce((o,n)=>o+n.length,0)>a.maxDataLength||this.processData(e.join(""))}processNewReplElements(e){let t=this.replPositions.get(e.getId()),o=e.getReplElements();if(this.replPositions.set(e.getId(),{position:o.length-1,tail:o[o.length-1]}),!t&&o.length>0)o.forEach(n=>this.processData(n.toString()));else if(t&&o.length-1!==t.position)for(let n=o.length-1;n>=0;n--){let r=o[n];if(r===t.tail)break;this.processData(r.toString())}}dispose(){super.dispose();for(let e of this.listeners.values())e.dispose()}processData(e){e=Hv(e);let t=e.match(a.localUrlRegex)||[];if(t&&t.length>0)t.forEach(o=>{let n;try{n=new URL(o)}catch{}if(n){let r=o.match(a.extractPortRegex),s=parseFloat(n.port?n.port:r?r[2]:"NaN");if(!isNaN(s)&&Number.isInteger(s)&&s>0&&s<=65535){let l=n.hostname;if(l!=="0.0.0.0"&&l!=="127.0.0.1"&&(l="localhost"),s!==9229&&e.startsWith("Debugger listening on"))return;this._onDidMatchLocalUrl.fire({port:s,host:l})}}});else{let o=e.match(a.localPythonServerRegex);o&&o.length===3&&this._onDidMatchLocalUrl.fire({host:o[1],port:Number(o[2])})}}};var bU="workbench.view.remote",sPe=class extends k{constructor(e,t,o,n,r,s){super();this.contextKeyService=e;this.environmentService=t;this.remoteExplorerService=o;this.tunnelService=n;this.activityService=r;this.statusbarService=s;this.contextKeyListener=this._register(new ue);this.activityBadge=this._register(new ue);this.hasPortsInSession=!1;this._register(oe.as(Kn.ViewsRegistry).registerViewWelcomeContent(b8,{content:this.environmentService.remoteAuthority?d(14550,null,`command:${PC.INLINE_ID}`):d(14538,null,`command:${PC.INLINE_ID}`)})),this.enableBadgeAndStatusBar(),this.enableForwardedPortsFeatures(),this.environmentService.remoteAuthority||this._register(U.once(this.tunnelService.onTunnelOpened)(()=>{this.hasPortsInSession=!0}))}async getViewContainer(){return oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:P0t,title:P(14539,"Ports"),icon:rBt,ctorDescriptor:new Vt(Qc,[P0t,{mergeViewWithContainerWhenSingleView:!0}]),storageId:P0t,hideIfEmpty:!0,order:5},1)}async enableForwardedPortsFeatures(){this.contextKeyListener.clear();let e=!!Xme.getValue(this.contextKeyService),t=!!xG.getValue(this.contextKeyService);if(e||t){t||this.contextKeyService.createKey(xG.key,!0);let o=await this.getViewContainer(),n=new sBt(new rPe(this.remoteExplorerService,this.tunnelService),this.environmentService),r=oe.as(Kn.ViewsRegistry);o&&(this.remoteExplorerService.enablePortsFeatures(!e),r.registerViews([n],o))}else this.contextKeyListener.value=this.contextKeyService.onDidChangeContext(o=>{o.affectsSome(new Set([...Xme.keys(),...xG.keys()]))&&this.enableForwardedPortsFeatures()})}enableBadgeAndStatusBar(){let e=oe.as(Kn.ViewsRegistry).onViewsRegistered(t=>{t.find(o=>o.views.find(n=>n.id===b8))&&(this._register(U.debounce(this.remoteExplorerService.tunnelModel.onForwardPort,(o,n)=>n,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this._register(U.debounce(this.remoteExplorerService.tunnelModel.onClosePort,(o,n)=>n,50)(()=>{this.updateActivityBadge(),this.updateStatusBar()})),this.updateActivityBadge(),this.updateStatusBar(),e.dispose())})}async updateActivityBadge(){this.remoteExplorerService.tunnelModel.forwarded.size>0?this.activityBadge.value=this.activityService.showViewActivity(b8,{badge:new eu(this.remoteExplorerService.tunnelModel.forwarded.size,e=>e===1?d(14536,null):d(14537,null,e))}):this.activityBadge.clear()}updateStatusBar(){!this.environmentService.remoteAuthority&&!this.hasPortsInSession||(this.entryAccessor?this.entryAccessor.update(this.entry):this._register(this.entryAccessor=this.statusbarService.addEntry(this.entry,"status.forwardedPorts",0,40)))}get entry(){let e,t=this.remoteExplorerService.tunnelModel.forwarded.size+this.remoteExplorerService.tunnelModel.detected.size,o=`${t}`;if(t===0)e=d(14543,null);else{let n=Array.from(this.remoteExplorerService.tunnelModel.forwarded.values());n.push(...Array.from(this.remoteExplorerService.tunnelModel.detected.values())),e=d(14544,null,n.map(r=>r.remotePort).join(", "))}return{name:d(14551,null),text:`$(radio-tower) ${o}`,ariaLabel:e,tooltip:e,command:`${b8}.focus`}}};sPe=I([m(0,X),m(1,Mt),m(2,Wu),m(3,Jp),m(4,Al),m(5,Fr)],sPe);var aPe=class{constructor(i,e){this.remoteExplorerService=i;this.logService=e;this.remoteExplorerService.tunnelModel.environmentTunnelsSet?this.restore():U.once(this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet)(async()=>{await this.restore()})}async restore(){return this.logService.trace("ForwardedPorts: Doing first restore."),this.remoteExplorerService.restore()}};aPe=I([m(0,Wu),m(1,re)],aPe);var lPe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.terminalService=e;this.notificationService=t;this.openerService=o;this.externalOpenerService=n;this.remoteExplorerService=r;this.contextKeyService=l;this.configurationService=c;this.debugService=u;this.tunnelService=h;this.hostService=g;this.logService=f;this.storageService=v;this.preferencesService=b;s.remoteAuthority&&(c.whenRemoteConfigurationLoaded().then(()=>p.getEnvironment()).then(S=>{this.setup(S),this._register(c.onDidChangeConfiguration(y=>{y.affectsConfiguration(vR)?this.setup(S):y.affectsConfiguration(eet)&&!this.portListener&&this.listenForPorts()}))}),this.storageService.getBoolean("processPortForwardingFallback",1,!0)||this.configurationService.updateValue(eet,0,5))}getPortAutoFallbackNumber(){let e=this.configurationService.inspect(eet);if(e.value!==void 0&&(e.value===0||e.value!==e.defaultValue))return e.value;let t=this.configurationService.inspect(vR);return t.applicationValue===kG||t.userValue===kG||t.userLocalValue===kG||t.userRemoteValue===kG||t.workspaceFolderValue===kG||t.workspaceValue===kG?0:e.value??20}listenForPorts(){let e=this.getPortAutoFallbackNumber();if(e===0){this.portListener?.dispose();return}this.procForwarder&&!this.portListener&&this.configurationService.getValue(vR)===kG?this.portListener=this._register(this.remoteExplorerService.tunnelModel.onForwardPort(async()=>{if(e=this.getPortAutoFallbackNumber(),e===0){this.portListener?.dispose();return}Array.from(this.remoteExplorerService.tunnelModel.forwarded.values()).filter(t=>t.source.source===1).length>e&&(await this.configurationService.updateValue(vR,OLe),this.notificationService.notify({message:d(14540,null),severity:wt.Warning,actions:{primary:[li({id:"switchBack",label:d(14542,null),run:async()=>{await this.configurationService.updateValue(vR,kG),await this.configurationService.updateValue(eet,0,5),this.portListener?.dispose(),this.portListener=void 0}}),li({id:"showPortSourceSetting",label:d(14541,null),run:async()=>{await this.preferencesService.openSettings({query:"remote.autoForwardPortsSource"})}})]}}))})):(this.portListener?.dispose(),this.portListener=void 0)}setup(e){let t=this.procForwarder?.forwarded,o=this.outputForwarder||this.procForwarder;if(this.procForwarder?.dispose(),this.procForwarder=void 0,this.outputForwarder?.dispose(),this.outputForwarder=void 0,e?.os!==3)this.configurationService.inspect(vR).default?.value!==tte&&oe.as($t.Configuration).registerDefaultConfigurations([{overrides:{"remote.autoForwardPortsSource":tte}}]),this.outputForwarder=this._register(new uBt(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,()=>!1));else{let n=()=>this.configurationService.getValue(vR)===kG;n()?this.procForwarder=this._register(new pBt(!1,t,!o,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService)):this.configurationService.getValue(vR)===OLe&&(this.procForwarder=this._register(new pBt(!0,t,!o,this.configurationService,this.remoteExplorerService,this.notificationService,this.openerService,this.externalOpenerService,this.tunnelService,this.hostService,this.logService,this.contextKeyService))),this.outputForwarder=this._register(new uBt(this.terminalService,this.notificationService,this.openerService,this.externalOpenerService,this.remoteExplorerService,this.configurationService,this.debugService,this.tunnelService,this.hostService,this.logService,this.contextKeyService,n))}this.listenForPorts()}};lPe=I([m(0,an),m(1,Ne),m(2,Je),m(3,Hee),m(4,Wu),m(5,Mt),m(6,X),m(7,Yg),m(8,Hi),m(9,bo),m(10,Jp),m(11,ti),m(12,re),m(13,de),m(14,Qo)],lPe);var dBt=class a extends k{constructor(e,t,o,n,r,s,l,c){super();this.notificationService=e;this.remoteExplorerService=t;this.openerService=o;this.externalOpenerService=n;this.tunnelService=r;this.hostService=s;this.logService=l;this.contextKeyService=c;this.notificationDisposable=this._register(new ue);this.alreadyOpenedOnce=new Set;this.lastNotifyTime=new Date,this.lastNotifyTime.setFullYear(this.lastNotifyTime.getFullYear()-1)}static{this.NOTIFY_COOL_DOWN=5e3}async doAction(e){this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Starting action for ${e[0]?.tunnelRemotePort}`),this.doActionTunnels=e;let t=await this.portNumberHeuristicDelay();if(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose ${t?.tunnelRemotePort}`),t){let n=(await this.remoteExplorerService.tunnelModel.getAttributes([{port:t.tunnelRemotePort,host:t.tunnelRemoteHost}]))?.get(t.tunnelRemotePort)?.onAutoForward;switch(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) onAutoForward action is ${n}`),n){case"openBrowserOnce":{if(this.alreadyOpenedOnce.has(t.localAddress))break;this.alreadyOpenedOnce.add(t.localAddress)}case"openBrowser":{let r=Sm(t.tunnelRemoteHost,t.tunnelRemotePort);await VN.run(this.remoteExplorerService.tunnelModel,this.openerService,r);break}case"openPreview":{let r=Sm(t.tunnelRemoteHost,t.tunnelRemotePort);await fU.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,r);break}case"silent":break;default:{let r=new Date().getTime()-this.lastNotifyTime.getTime();this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) time elapsed since last notification ${r} ms`),r>a.NOTIFY_COOL_DOWN&&await this.showNotification(t)}}}}hide(e){this.doActionTunnels&&(this.doActionTunnels=this.doActionTunnels.filter(t=>!e.includes(t.tunnelRemotePort))),this.lastShownPort&&e.indexOf(this.lastShownPort)>=0&&this.lastNotification?.close()}async portNumberHeuristicDelay(){if(this.logService.trace("ForwardedPorts: (OnAutoForwardedAction) Starting heuristic delay"),!this.doActionTunnels||this.doActionTunnels.length===0)return;this.doActionTunnels=this.doActionTunnels.sort((t,o)=>t.tunnelRemotePort-o.tunnelRemotePort);let e=this.doActionTunnels.shift();return e.tunnelRemotePort%1e3===0?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because % 1000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):e.tunnelRemotePort<1e4&&e.tunnelRemotePort!==9229?(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Heuristic chose tunnel because < 10000: ${e.tunnelRemotePort}`),this.newerTunnel=e,e):(this.logService.trace(`ForwardedPorts: (OnAutoForwardedAction) Waiting for "better" tunnel than ${e.tunnelRemotePort}`),this.newerTunnel=void 0,new Promise(t=>{setTimeout(()=>{this.newerTunnel?t(void 0):this.doActionTunnels?.includes(e)?t(e):t(void 0)},3e3)}))}async basicMessage(e){let o=(await this.remoteExplorerService.tunnelModel.getAttributes([{host:e.tunnelRemoteHost,port:e.tunnelRemotePort}],!1))?.get(e.tunnelRemotePort)?.label;return d(14545,null,o?` (${o})`:"",e.tunnelRemotePort)}linkMessage(){return d(14549,null,`command:${TW.ID}.focus`)}async showNotification(e){if(!await this.hostService.hadLastFocus())return;this.lastNotification?.close();let t=await this.basicMessage(e),o=[this.openBrowserChoice(e)];(!Ft||pfo.getValue(this.contextKeyService))&&o.push(this.openPreviewChoice(e)),e.tunnelLocalPort!==e.tunnelRemotePort&&this.tunnelService.canElevate&&this.tunnelService.isPortPrivileged(e.tunnelRemotePort)&&(t+=d(14547,null,e.tunnelRemotePort),o.unshift(this.elevateChoice(e))),e.privacy==="private"&&Ft&&this.tunnelService.canChangePrivacy&&o.push(this.makePublicChoice(e)),t+=this.linkMessage(),this.lastNotification=this.notificationService.prompt(wt.Info,t,o,{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.lastShownPort=e.tunnelRemotePort,this.lastNotifyTime=new Date,this.notificationDisposable.value=this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0})}makePublicChoice(e){return{label:d(14548,null),run:async()=>{let t=sS(this.remoteExplorerService.tunnelModel.forwarded,e.tunnelRemoteHost,e.tunnelRemotePort);return await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},"Other"),this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelLocalPort,name:t?.name,elevateIfNeeded:!0,privacy:"public",source:t?.source})}}}openBrowserChoice(e){let t=Sm(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:VN.LABEL,run:()=>VN.run(this.remoteExplorerService.tunnelModel,this.openerService,t)}}openPreviewChoice(e){let t=Sm(e.tunnelRemoteHost,e.tunnelRemotePort);return{label:fU.LABEL,run:()=>fU.run(this.remoteExplorerService.tunnelModel,this.openerService,this.externalOpenerService,t)}}elevateChoice(e){return{label:d(14546,null,e.tunnelRemotePort),run:async()=>{await this.remoteExplorerService.close({host:e.tunnelRemoteHost,port:e.tunnelRemotePort},"Other");let t=await this.remoteExplorerService.forward({remote:{host:e.tunnelRemoteHost,port:e.tunnelRemotePort},local:e.tunnelRemotePort,elevateIfNeeded:!0,source:M0t});!t||typeof t=="string"||(this.lastNotification?.close(),this.lastShownPort=t.tunnelRemotePort,this.lastNotification=this.notificationService.prompt(wt.Info,await this.basicMessage(t)+this.linkMessage(),[this.openBrowserChoice(t),this.openPreviewChoice(e)],{neverShowAgain:{id:"remote.tunnelsView.autoForwardNeverShow",isSecondary:!0}}),this.notificationDisposable.value=this.lastNotification.onDidClose(()=>{this.lastNotification=void 0,this.lastShownPort=void 0}))}}}},uBt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.terminalService=e;this.notificationService=t;this.openerService=o;this.externalOpenerService=n;this.remoteExplorerService=r;this.configurationService=s;this.debugService=l;this.tunnelService=c;this.hostService=u;this.logService=p;this.contextKeyService=h;this.privilegedOnly=g;this.notifier=new dBt(t,r,o,n,c,u,p,h),this._register(s.onDidChangeConfiguration(f=>{f.affectsConfiguration(S8)&&this.tryStartStopUrlFinder()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(()=>{this.tryStartStopUrlFinder()})),this.tryStartStopUrlFinder(),s.getValue(vR)===OLe&&this._register(this.tunnelService.onTunnelClosed(f=>this.notifier.hide([f.port])))}tryStartStopUrlFinder(){this.configurationService.getValue(S8)?this.startUrlFinder():this.stopUrlFinder()}startUrlFinder(){!this.urlFinder&&this.remoteExplorerService.portsFeaturesEnabled!==2||(this.portsFeatures?.dispose(),this.urlFinder=this._register(new cBt(this.terminalService,this.debugService)),this._register(this.urlFinder.onDidMatchLocalUrl(async e=>{if(sS(this.remoteExplorerService.tunnelModel.detected,e.host,e.port))return;let t=(await this.remoteExplorerService.tunnelModel.getAttributes([e]))?.get(e.port);if(t?.onAutoForward==="ignore"||this.privilegedOnly()&&!this.tunnelService.isPortPrivileged(e.port))return;let o=await this.remoteExplorerService.forward({remote:e,source:M0t},t??null);o&&typeof o!="string"&&this.notifier.doAction([o])})))}stopUrlFinder(){this.urlFinder&&(this.urlFinder.dispose(),this.urlFinder=void 0)}},pBt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.unforwardOnly=e;this.alreadyAutoForwarded=t;this.needsInitialCandidates=o;this.configurationService=n;this.remoteExplorerService=r;this.notificationService=s;this.openerService=l;this.externalOpenerService=c;this.tunnelService=u;this.hostService=p;this.logService=h;this.contextKeyService=g;this.autoForwarded=new Set;this.notifiedOnly=new Set;this.initialCandidates=new Set;this.notifier=new dBt(s,r,l,c,u,p,h,g),t?.forEach(f=>this.autoForwarded.add(f)),this.initialize()}get forwarded(){return this.autoForwarded}async initialize(){this.remoteExplorerService.tunnelModel.environmentTunnelsSet||await new Promise(e=>this.remoteExplorerService.tunnelModel.onEnvironmentTunnelsSet(()=>e())),this._register(this.configurationService.onDidChangeConfiguration(async e=>{e.affectsConfiguration(S8)&&await this.startStopCandidateListener()})),this.portsFeatures=this._register(this.remoteExplorerService.onEnabledPortsFeatures(async()=>{await this.startStopCandidateListener()})),this.startStopCandidateListener()}async startStopCandidateListener(){this.configurationService.getValue(S8)?await this.startCandidateListener():this.stopCandidateListener()}stopCandidateListener(){this.candidateListener&&(this.candidateListener.dispose(),this.candidateListener=void 0)}async startCandidateListener(){this.candidateListener||this.remoteExplorerService.portsFeaturesEnabled!==2||(this.portsFeatures?.dispose(),await this.setInitialCandidates(),this.configurationService.getValue(S8)&&(this.candidateListener=this._register(this.remoteExplorerService.tunnelModel.onCandidatesChanged(this.handleCandidateUpdate,this))))}async setInitialCandidates(){if(!this.needsInitialCandidates){this.logService.debug("ForwardedPorts: (ProcForwarding) Not setting initial candidates");return}let e=this.remoteExplorerService.tunnelModel.candidatesOrUndefined;e||(await new Promise(t=>this.remoteExplorerService.tunnelModel.onCandidatesChanged(()=>t())),e=this.remoteExplorerService.tunnelModel.candidates);for(let t of e)this.initialCandidates.add(Sm(t.host,t.port));this.logService.debug(`ForwardedPorts: (ProcForwarding) Initial candidates set to ${e.map(t=>t.port).join(", ")}`)}async forwardCandidates(){let e,t=[];this.logService.trace(`ForwardedPorts: (ProcForwarding) Attempting to forward ${this.remoteExplorerService.tunnelModel.candidates.length} candidates`);for(let o of this.remoteExplorerService.tunnelModel.candidates){if(!o.detail){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} missing detail`);continue}e||(e=await this.remoteExplorerService.tunnelModel.getAttributes(this.remoteExplorerService.tunnelModel.candidates));let n=e?.get(o.port),r=Sm(o.host,o.port);if(this.initialCandidates.has(r)&&n?.onAutoForward===void 0||this.notifiedOnly.has(r)||this.autoForwarded.has(r))continue;let s=sS(this.remoteExplorerService.tunnelModel.forwarded,o.host,o.port);if(sS(this.remoteExplorerService.tunnelModel.detected,o.host,o.port))continue;if(n?.onAutoForward==="ignore"){this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} is ignored`);continue}let l=await this.remoteExplorerService.forward({remote:o,source:M0t},n??null);!s&&l?(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} has been forwarded`),this.autoForwarded.add(r)):l&&(this.logService.trace(`ForwardedPorts: (ProcForwarding) Port ${o.port} has been notified`),this.notifiedOnly.add(r)),l&&typeof l!="string"&&t.push(l)}if(this.logService.trace(`ForwardedPorts: (ProcForwarding) Forwarded ${t.length} candidates`),t.length!==0)return t}async handleCandidateUpdate(e){let t=[],o;if(this.unforwardOnly){o=new Map;for(let r of this.remoteExplorerService.tunnelModel.forwarded.entries())r[1].source.source===1&&o.set(r[0],r[1])}else o=new Map(this.autoForwarded.entries());for(let r of e){let s=r[0],l=r[1],c=sS(o,l.host,l.port);c?(typeof c=="string"?this.autoForwarded.delete(s):l={host:c.remoteHost,port:c.remotePort},await this.remoteExplorerService.close(l,"AutoForwardEnd"),t.push(l.port)):this.notifiedOnly.delete(s)?t.push(l.port):this.initialCandidates.delete(s)}if(this.unforwardOnly)return;t.length>0&&await this.notifier.hide(t);let n=await this.forwardCandidates();n&&await this.notifier.doAction(n)}};var bTi={webviewState:"webviewState"},Rte=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super({...e,titleMenuId:R.ViewTitle,showActions:1},s,n,t,o,p,r,l,u,c);this.activityService=h;this.extensionService=g;this.progressService=f;this.storageService=v;this.viewService=b;this.webviewService=S;this.webviewViewService=y;this._webview=this._register(new ue);this._webviewDisposables=this._register(new O);this._activated=!1;this.activity=this._register(new ue);this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDispose=this._register(new T);this.onDispose=this._onDispose.event;this.extensionId=e.fromExtensionId,this.defaultTitle=this.title,this.memento=new $l(`webviewView.${this.id}`,v),this.viewState=this.memento.getMemento(1,1),this._register(this.onDidChangeBodyVisibility(()=>this.updateTreeVisibility())),this._register(this.webviewViewService.onNewResolverRegistered(w=>{w.viewType===this.id&&this.updateTreeVisibility()})),this.updateTreeVisibility()}static getOriginStore(e){return this._originStore??=new q0("webviewViews.origins",e),this._originStore}dispose(){this._onDispose.fire(),super.dispose()}focus(){super.focus(),this._webview.value?.focus()}renderBody(e){super.renderBody(e),this._container=e,this._rootContainer=void 0,this.layoutWebview()}saveState(){this._webview.value&&(this.viewState[bTi.webviewState]=this._webview.value.state),this.memento.saveMemento(),super.saveState()}updateTreeVisibility(){this.isBodyVisible()?(this.activate(),this._webview.value?.claim(this,Me(this.element),void 0)):this._webview.value?.release(this)}activate(){if(this._activated)return;this._activated=!0;let e=this.extensionId?Rte.getOriginStore(this.storageService).getOrigin(this.id,this.extensionId):void 0,t=this.webviewService.createWebviewOverlay({origin:e,providedViewType:this.id,title:this.title,options:{purpose:"webviewView"},contentOptions:{},extension:this.extensionId?{id:this.extensionId}:void 0});t.state=this.viewState[bTi.webviewState],this._webview.value=t,this.layoutWebview(),this._webviewDisposables.add(ee(()=>{this._webview.value?.release(this)})),this._webviewDisposables.add(t.onDidUpdateState(()=>{this.viewState[bTi.webviewState]=t.state}));for(let n of[ne.DRAG,ne.DRAG_END,ne.DRAG_ENTER,ne.DRAG_LEAVE,ne.DRAG_START])this._webviewDisposables.add($(this._webview.value.container,n,r=>{r.preventDefault(),r.stopImmediatePropagation(),this.dropTargetElement.dispatchEvent(new DragEvent(r.type,r))}));this._webviewDisposables.add(new dee(Me(this.element),()=>this._webview.value));let o=this._webviewDisposables.add(new qe);this.withProgress(async()=>{await this.extensionService.activateByEvent(`onView:${this.id}`);let n=this,r={webview:t,onDidChangeVisibility:this.onDidChangeBodyVisibility,onDispose:this.onDispose,get title(){return n.setTitle},set title(s){n.updateTitle(s)},get description(){return n.titleDescription},set description(s){n.updateTitleDescription(s)},get badge(){return n.badge},set badge(s){n.updateBadge(s)},dispose:()=>{this._activated=!1,this._webview.clear(),this._webviewDisposables.clear()},show:s=>{this.viewService.openView(this.id,!s)}};await this.webviewViewService.resolve(this.id,r,o.token)})}updateTitle(e){this.setTitle=e,super.updateTitle(typeof e=="string"?e:this.defaultTitle)}updateBadge(e){if(!(this.badge?.value===e?.value&&this.badge?.tooltip===e?.tooltip)&&(this.badge=e,e)){let t={badge:new eu(e.value,()=>e.tooltip),priority:150};this.activity.value=this.activityService.showViewActivity(this.id,t)}}async withProgress(e){return this.progressService.withProgress({location:this.id,delay:500},e)}layoutWebview(){let e=this._webview.value;!this._container||!e||((!this._rootContainer||!this._rootContainer.isConnected)&&(this._rootContainer=this.findRootContainer(this._container)),e.setAnchorElement(this._container,this._rootContainer))}findRootContainer(e){return rf(e,"monaco-scrollable-element")??void 0}};Rte=I([m(1,B),m(2,X),m(3,Xe),m(4,F),m(5,Le),m(6,Je),m(7,ot),m(8,Pe),m(9,ji),m(10,Al),m(11,lt),m(12,Go),m(13,de),m(14,Gt),m(15,Pu),m(16,QRe)],Rte);var STi={type:"object",properties:{id:{description:d(4031,null),type:"string",pattern:"^[a-zA-Z0-9_-]+$"},title:{description:d(4032,null),type:"string"},icon:{description:d(4030,null),type:"string"}},required:["id","title","icon"]},Ein={description:d(4033,null),type:"object",properties:{activitybar:{description:d(4004,null),type:"array",items:STi},panel:{description:d(4005,null),type:"array",items:STi},secondarySidebar:{description:d(4006,null),type:"array",items:STi}},additionalProperties:!1};var ITi=(t=>(t.Visible="visible",t.Hidden="hidden",t.Collapsed="collapsed",t))(ITi||{}),Rtt={type:"object",required:["id","name","icon"],defaultSnippets:[{body:{id:"${1:id}",name:"${2:name}",icon:"${3:icon}"}}],properties:{type:{markdownDescription:d(4026,null),type:"string",enum:["tree","webview"],markdownEnumDescriptions:[d(4025,null),d(4027,null)]},id:{markdownDescription:d(4018,null),type:"string"},name:{description:d(4023,null),type:"string"},when:{description:d(4028,null),type:"string"},icon:{description:d(4017,null),type:"string"},contextualTitle:{description:d(4015,null),type:"string"},visibility:{description:d(4019,null),type:"string",enum:["visible","hidden","collapsed"],default:"visible",enumDescriptions:[d(4022,null),d(4021,null),d(4020,null)]},initialSize:{type:"number",description:d(4034,null)},accessibilityHelpContent:{type:"string",markdownDescription:d(4014,null)}}},Tin={type:"object",required:["id","name"],properties:{id:{description:d(4018,null),type:"string"},name:{description:d(4023,null),type:"string"},when:{description:d(4028,null),type:"string"},group:{description:d(4016,null),type:"string"},remoteName:{description:d(4024,null),type:["string","array"],items:{type:"string"}}}},_in={description:d(4029,null),type:"object",properties:{explorer:{description:d(4009,null),type:"array",items:Rtt,default:[]},debug:{description:d(4008,null),type:"array",items:Rtt,default:[]},scm:{description:d(4011,null),type:"array",items:Rtt,default:[]},test:{description:d(4012,null),type:"array",items:Rtt,default:[]},remote:{description:d(4010,null),type:"array",items:Tin,default:[]}},additionalProperties:{description:d(4007,null),type:"array",items:Rtt,default:[]}},Cfo=zn.registerExtensionPoint({extensionPoint:"viewsContainers",jsonSchema:Ein}),Din=zn.registerExtensionPoint({extensionPoint:"views",deps:[Cfo],jsonSchema:_in,activationEventsGenerator:function*(a){for(let i of a)for(let e of Object.values(i))for(let t of e)t.id&&(yield`onView:${t.id}`)}}),Rin=7,cPe=class{constructor(i,e){this.instantiationService=i;this.logService=e;this.viewContainersRegistry=oe.as(Kn.ViewContainersRegistry),this.viewsRegistry=oe.as(Kn.ViewsRegistry),this.handleAndRegisterCustomViewContainers(),this.handleAndRegisterCustomViews()}static{this.ID="workbench.contrib.viewsExtensionHandler"}handleAndRegisterCustomViewContainers(){Cfo.setHandler((i,{added:e,removed:t})=>{t.length&&this.removeCustomViewContainers(t),e.length&&this.addCustomViewContainers(e,this.viewContainersRegistry.all)})}addCustomViewContainers(i,e){let t=oe.as(Kn.ViewContainersRegistry),o=Rin+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===0).length,n=5+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===1).length+1,r=100+t.all.filter(s=>!!s.extensionId&&t.getViewContainerLocation(s)===2).length+1;for(let{value:s,collector:l,description:c}of i)Object.entries(s).forEach(([u,p])=>{if(this.isValidViewsContainer(p,l))switch(u){case"activitybar":o=this.registerCustomViewContainers(p,c,o,e,0);break;case"panel":n=this.registerCustomViewContainers(p,c,n,e,1);break;case"secondarySidebar":r=this.registerCustomViewContainers(p,c,r,e,2);break}})}removeCustomViewContainers(i){let e=oe.as(Kn.ViewContainersRegistry),t=i.reduce((o,n)=>(o.add(n.description.identifier),o),new HS);for(let o of e.all)if(o.extensionId&&t.has(o.extensionId)){let n=this.viewsRegistry.getViews(o);n.length&&this.viewsRegistry.moveViews(n,this.getDefaultViewContainer()),this.deregisterCustomViewContainer(o)}}isValidViewsContainer(i,e){if(!Array.isArray(i))return e.error(d(4000,null)),!1;for(let t of i){if(typeof t.id!="string"&&_c(t.id))return e.error(d(3990,null,"id")),!1;if(!/^[a-z0-9_-]+$/i.test(t.id))return e.error(d(3990,null,"id")),!1;if(typeof t.title!="string")return e.error(d(3993,null,"title")),!1;if(typeof t.icon!="string")return e.error(d(3993,null,"icon")),!1;if(_c(t.title))return e.warn(d(3991,null,"title")),!0}return!0}registerCustomViewContainers(i,e,t,o,n){return i.forEach(r=>{let l=q.fromString(r.icon)||Ve(e.extensionLocation,r.icon),c=`workbench.view.extension.${r.id}`,u=r.title||c,p=this.registerCustomViewContainer(c,u,l,t++,e.identifier,n);if(o.length){let h=[];for(let g of o)p!==g&&h.push(...this.viewsRegistry.getViews(g).filter(f=>f.originalContainerId===r.id));h.length&&this.viewsRegistry.moveViews(h,p)}}),t}registerCustomViewContainer(i,e,t,o,n,r){let s=this.viewContainersRegistry.get(i);return s||(s=this.viewContainersRegistry.registerViewContainer({id:i,title:{value:e,original:e},extensionId:n,ctorDescriptor:new Vt(Qc,[i,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:o,icon:t},r)),s}deregisterCustomViewContainer(i){this.viewContainersRegistry.deregisterViewContainer(i),oe.as(CW.Viewlets).deregisterPaneComposite(i.id)}handleAndRegisterCustomViews(){Din.setHandler((i,{added:e,removed:t})=>{t.length&&this.removeViews(t),e.length&&this.addViews(e)})}addViews(i){let e=new Set,t=[];for(let o of i){let{value:n,collector:r}=o;Object.entries(n).forEach(([s,l])=>{if(!this.isValidViewDescriptors(l,r))return;if(s==="remote"&&!Va(o.description,"contribViewsRemote")){r.warn(d(4002,null,s));return}if(s==="agentSessions"&&!Va(o.description,"chatSessionsProvider")){r.warn(d(3992,null,s));return}let c=this.getViewContainer(s);c||r.warn(d(4001,null,s));let u=c||this.getDefaultViewContainer(),p=[];for(let h=0;h<l.length;h++){let g=l[h];if(e.has(g.id)){r.error(d(3985,null,g.id));continue}if(this.viewsRegistry.getView(g.id)!==null){r.error(d(3986,null,g.id));continue}let f=hi.equals(o.description.identifier,u.extensionId)?h+1:u.viewOrderDelegate?u.viewOrderDelegate.getOrder(g.group):void 0,v;typeof g.icon=="string"&&(v=q.fromString(g.icon)||Ve(o.description.extensionLocation,g.icon));let b=this.convertInitialVisibility(g.visibility),S=this.getViewType(g.type);if(!S){r.error(d(3994,null,g.type));continue}let y;typeof g.initialSize=="number"&&(u.extensionId?.value===o.description.identifier.value?y=g.initialSize:this.logService.warn(`${o.description.identifier.value} tried to set the view size of ${g.id} but it was ignored because the view container does not belong to it.`));let w;Va(o.description,"contribAccessibilityHelpContent")&&g.accessibilityHelpContent&&(w=new he(g.accessibilityHelpContent));let x={type:S,ctorDescriptor:S==="tree"?new Vt(_R):new Vt(Rte),id:g.id,name:{value:g.name,original:g.name},when:C.deserialize(g.when),containerIcon:v||c?.icon,containerTitle:g.contextualTitle||c&&(typeof c.title=="string"?c.title:c.title.value),canToggleVisibility:!0,canMoveView:c?.id!==bU,treeView:S==="tree"?this.instantiationService.createInstance(oPe,g.id,g.name,o.description.identifier.value):void 0,collapsed:this.showCollapsed(u)||b==="collapsed",order:f,extensionId:o.description.identifier,originalContainerId:s,group:g.group,remoteAuthority:g.remoteName||g.remoteAuthority,virtualWorkspace:g.virtualWorkspace,hideByDefault:b==="hidden",workspace:c?.id===bU?!0:void 0,weight:y,accessibilityHelpContent:w};e.add(x.id),p.push(x)}t.push({viewContainer:u,views:p})})}this.viewsRegistry.registerViews2(t)}getViewType(i){if(i==="webview")return"webview";if(!i||i==="tree")return"tree"}getDefaultViewContainer(){return this.viewContainersRegistry.get(Dv)}removeViews(i){let e=i.reduce((t,o)=>(t.add(o.description.identifier),t),new HS);for(let t of this.viewContainersRegistry.all){let o=this.viewsRegistry.getViews(t).filter(n=>n.extensionId&&e.has(n.extensionId));if(o.length){this.viewsRegistry.deregisterViews(o,t);for(let n of o){let r=n;r.treeView&&r.treeView.dispose()}}}}convertInitialVisibility(i){if(Object.values(ITi).includes(i))return i}isValidViewDescriptors(i,e){if(!Array.isArray(i))return e.error(d(3989,null)),!1;for(let t of i){if(typeof t.id!="string")return e.error(d(3993,null,"id")),!1;if(typeof t.name!="string")return e.error(d(3993,null,"name")),!1;if(t.when&&typeof t.when!="string")return e.error(d(3988,null,"when")),!1;if(t.icon&&typeof t.icon!="string")return e.error(d(3988,null,"icon")),!1;if(t.contextualTitle&&typeof t.contextualTitle!="string")return e.error(d(3988,null,"contextualTitle")),!1;if(t.visibility&&!this.convertInitialVisibility(t.visibility))return e.error(d(3987,null,"visibility",Object.values(ITi).join(", "))),!1}return!0}getViewContainer(i){switch(i){case"explorer":return this.viewContainersRegistry.get(Dv);case"debug":return this.viewContainersRegistry.get($g);case"scm":return this.viewContainersRegistry.get(Jpe);case"remote":return this.viewContainersRegistry.get(bU);default:return this.viewContainersRegistry.get(`workbench.view.extension.${i}`)}}showCollapsed(i){switch(i.id){case Dv:case Jpe:case $g:return!0}return!1}};cPe=I([m(0,F),m(1,re)],cPe);var yTi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.viewsContainers}render(e){let t=e.contributes?.viewsContainers||{},o=Object.keys(t).reduce((s,l)=>{let c=t[l];return s.push(...c.map(u=>({...u,location:l}))),s},[]);if(!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let n=[d(3995,null),d(3997,null),d(3996,null)],r=o.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[s.id,s.title,s.location]);return{data:{headers:n,rows:r},dispose:()=>{}}}},wTi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.views}render(e){let t=e.contributes?.views||{},o=Object.keys(t).reduce((s,l)=>{let c=t[l];return s.push(...c.map(u=>({...u,location:l}))),s},[]);if(!o.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let n=[d(3998,null),d(3999,null),d(3996,null)],r=o.sort((s,l)=>s.id.localeCompare(l.id)).map(s=>[s.id,s.name,s.location]);return{data:{headers:n,rows:r},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"viewsContainers",label:d(4013,null),access:{canToggle:!1},renderer:new Vt(yTi)});oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"views",label:d(4003,null),access:{canToggle:!1},renderer:new Vt(wTi)});bt(cPe.ID,cPe,vt.BlockStartup);var Jg=class extends IE{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e.resource,void 0,n,t,o,r,c,p,h);this.model=e;this.environmentService=s;this.pathService=l;this.textModelService=u;this.modelResolve=void 0;this.modelDisposables=this._register(new O);this.cachedUntitledTextEditorModelReference=void 0;this.registerModelListeners(e),this._register(this.textFileService.untitled.onDidCreate(g=>this.onDidCreateUntitledModel(g)))}static{this.ID="workbench.editors.untitledEditorInput"}get typeId(){return Jg.ID}get editorId(){return Da.id}registerModelListeners(e){this.modelDisposables.clear(),this.modelDisposables.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this.modelDisposables.add(e.onDidChangeName(()=>this._onDidChangeLabel.fire())),this.modelDisposables.add(e.onDidRevert(()=>this.dispose()))}onDidCreateUntitledModel(e){ze(e.resource,this.model.resource)&&e!==this.model&&(this.model=e,this.registerModelListeners(e))}getName(){return this.model.name}getDescription(e=1){if(!this.model.hasAssociatedFilePath){let t=this.resource.path;return t!==this.getName()?t:void 0}return super.getDescription(e)}getTitle(e){if(!this.model.hasAssociatedFilePath){let t=this.getName(),o=this.getDescription();return o&&o!==t?`${t} \u2022 ${o}`:t}return super.getTitle(e)}isDirty(){return this.model.isDirty()}getEncoding(){return this.model.getEncoding()}setEncoding(e,t){return this.model.setEncoding(e)}get hasLanguageSetExplicitly(){return this.model.hasLanguageSetExplicitly}get hasAssociatedFilePath(){return this.model.hasAssociatedFilePath}setLanguageId(e,t){this.model.setLanguageId(e,t)}getLanguageId(){return this.model.getLanguageId()}async resolve(){return this.modelResolve||(this.modelResolve=(async()=>{this.cachedUntitledTextEditorModelReference=await this.textModelService.createModelReference(this.resource)})()),await this.modelResolve,this.isDisposed()&&this.disposeModelReference(),this.model}toUntyped(e){let t={resource:this.model.hasAssociatedFilePath?Nf(this.model.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):this.resource,forceUntitled:!0,options:{override:this.editorId}};return typeof e?.preserveViewState=="number"&&(t.encoding=this.getEncoding(),t.languageId=this.getLanguageId(),t.contents=this.model.isModified()?this.model.textEditorModel?.getValue():void 0,t.options.viewState=h3(this,e.preserveViewState,this.editorService),typeof t.contents=="string"&&!this.model.hasAssociatedFilePath&&!e.preserveResource&&(t.resource=void 0)),t}matches(e){return this===e?!0:e instanceof Jg?ze(e.resource,this.resource):P_e(e)?super.matches(e):!1}dispose(){this.modelResolve=void 0,this.disposeModelReference(),super.dispose()}disposeModelReference(){je(this.cachedUntitledTextEditorModelReference),this.cachedUntitledTextEditorModelReference=void 0}};Jg=I([m(1,Uo),m(2,nt),m(3,ie),m(4,ge),m(5,Mt),m(6,Pn),m(7,fr),m(8,Bt),m(9,Gn),m(10,nb)],Jg);var Lte=class extends KM{constructor(){super(...arguments);this.editorControl=void 0}get scopedContextKeyService(){return this.editorControl?.invokeWithinContext(e=>e.get(X))}getTitle(){return this.input?this.input.getName():d(4958,null)}createEditorControl(e,t){this.editorControl=this._register(this.instantiationService.createInstance(us,e,t,this.getCodeEditorWidgetOptions()))}getCodeEditorWidgetOptions(){return Object.create(null)}updateEditorControlOptions(e){this.editorControl?.updateOptions(e)}getMainControl(){return this.editorControl}getControl(){return this.editorControl}computeEditorViewState(e){if(!this.editorControl)return;let t=this.editorControl.getModel();if(!t)return;let o=t.uri;if(o&&ze(o,e))return this.editorControl.saveViewState()??void 0}setOptions(e){super.setOptions(e),e&&x_(e,Ti(this.editorControl),0)}focus(){super.focus(),this.editorControl?.focus()}hasFocus(){return this.editorControl?.hasTextFocus()||super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e),e?this.editorControl?.onVisible():this.editorControl?.onHide()}layout(e){this.editorControl?.layout(e)}};var _he=class extends Lte{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,c,l,u)}async setInput(i,e,t,o){await super.setInput(i,e,t,o);let n=await i.resolve();if(o.isCancellationRequested)return;if(!(n instanceof CC))throw new Error("Unable to open file as text");let r=Ti(this.editorControl),s=n.textEditorModel;if(r.setModel(s),!f3(e?.viewState)){let l=this.loadEditorViewState(i,t);l&&(e?.selection&&(l.cursorState=[]),r.restoreViewState(l))}e&&x_(e,r,1),r.updateOptions(this.getReadonlyConfiguration(n.isReadonly()))}revealLastLine(){let i=this.editorControl;if(!i)return;let e=i.getModel();if(e){let t=e.getLineCount();i.revealPosition({lineNumber:t,column:e.getLineMaxColumn(t)},0)}}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}tracksEditorViewState(i){return i instanceof Jg||i instanceof Vx}};_he=I([m(2,_e),m(3,F),m(4,de),m(5,Gn),m(6,Pe),m(7,kt),m(8,ie),m(9,ge)],_he);var G8=class extends _he{constructor(e,t,o,n,r,s,l,c,u,p,h){super(G8.ID,e,t,o,n,r,s,c,l,h);this.modelService=u;this.languageService=p}static{this.ID="workbench.editors.textResourceEditor"}createEditorControl(e,t){super.createEditorControl(e,t);let o=this.editorControl;o&&this._register(o.onDidPaste(n=>this.onDidEditorPaste(n,o)))}onDidEditorPaste(e,t){if(this.input instanceof Jg&&this.input.hasLanguageSetExplicitly||e.range.startLineNumber!==1||e.range.startColumn!==1||t.getOption(104))return;let o=t.getModel();if(!o||!(o.getLineCount()===e.range.endLineNumber&&o.getLineMaxColumn(e.range.endLineNumber)===e.range.endColumn)||o.getLanguageId()!==es)return;let s;if(e.languageId)s={id:e.languageId,source:"event"};else{let l=this.languageService.guessLanguageIdByFilepathOrFirstLine(o.uri,o.getLineContent(1).substr(0,1e3))??void 0;l&&(s={id:l,source:"guess"})}if(s&&s.id!==es){this.input instanceof Jg&&s.source==="event"?this.input.setLanguageId(s.id):o.setLanguage(this.languageService.createById(s.id));let l=this.modelService.getCreationOptions(o.getLanguageId(),o.uri,o.isForSimpleWidget);o.detectIndentation(l.insertSpaces,l.tabSize)}}};G8=I([m(1,_e),m(2,F),m(3,de),m(4,Gn),m(5,Pe),m(6,ie),m(7,kt),m(8,_t),m(9,Rt),m(10,ge)],G8);var $G=class extends Zh{constructor(e,t,o){super();this.resource=e;this.name=t;this.fileService=o;this.mime=cr.binary}getName(){return this.name}getSize(){return this.size}getMime(){return this.mime}getETag(){return this.etag}async resolve(){if(this.fileService.hasProvider(this.resource)){let e=await this.fileService.stat(this.resource);this.etag=e.etag,typeof e.size=="number"&&(this.size=e.size)}return super.resolve()}};$G=I([m(2,ge)],$G);var ak=class{constructor(i){this._container=i}set text(i){Ii(this._container,...ir(i??""))}set title(i){!this.hover&&i?this.hover=sp().setupManagedHover(yi("mouse"),this._container,i):this.hover&&this.hover.update(i)}dispose(){this.hover?.dispose()}};var jG=class extends zs{constructor(e,t,o,n,r){super(e,t,o,n,r);this.inputDisposable=this._register(new ue)}static{this.PLACEHOLDER_LABEL_MAX_LENGTH=1024}createEditor(e){this.container=_(".monaco-editor-pane-placeholder",{tabIndex:0}),this.container.style.outline="none",this.scrollbar=this._register(new Ar(this.container,{horizontal:1,vertical:1})),e.appendChild(this.scrollbar.getDomNode())}async setInput(e,t,o,n){await super.setInput(e,t,o,n),!n.isCancellationRequested&&(this.inputDisposable.value=await this.renderInput(e,t))}async renderInput(e,t){let[o,n]=Ow(this.container,this.scrollbar);St(o);let r=new O,{icon:s,label:l,actions:c}=await this.getContents(e,t,r),u=tF(l,jG.PLACEHOLDER_LABEL_MAX_LENGTH),p=o.appendChild(_(".editor-placeholder-icon-container")),h=r.add(new ak(p));h.text=s;let g=o.appendChild(_(".editor-placeholder-label-container")),f=_("span");if(f.textContent=u,g.appendChild(f),o.setAttribute("aria-label",`${ree(e,void 0,this.group,void 0)}, ${u}`),c.length){let v=o.appendChild(_(".editor-placeholder-buttons-container")),b=r.add(new sC(v));for(let S=0;S<c.length;S++){let y=r.add(b.addButton({...Ro,secondary:S!==0}));y.label=c[S].label,r.add(y.onDidClick(w=>{w&&Kt.stop(w,!0),c[S].run()}))}}return n.scanDomNode(),r}clearInput(){this.container&&St(this.container),this.inputDisposable.clear(),super.clearInput()}layout(e){let[t,o]=Ow(this.container,this.scrollbar);PL(t,e.width,e.height),o.scanDomNode(),t.classList.toggle("max-height-200px",e.height<=200)}focus(){super.focus(),this.container?.focus()}dispose(){this.container?.remove(),super.dispose()}};jG=I([m(2,_e),m(3,Pe),m(4,de)],jG);var q8=class extends jG{constructor(e,t,o,n,r,s){super(q8.ID,e,t,o,s);this.commandService=n;this.workspaceService=r}static{this.ID="workbench.editors.workspaceTrustRequiredEditor"}static{this.LABEL=d(4879,null)}static{this.DESCRIPTOR=os.create(this,this.ID,this.LABEL)}getTitle(){return q8.LABEL}async getContents(){return{icon:"$(workspace-untrusted)",label:Pg(pf(this.workspaceService.getWorkspace()))?d(4875,null):d(4876,null),actions:[{label:d(4874,null),run:()=>this.commandService.executeCommand("workbench.trust.manage")}]}}};q8=I([m(1,_e),m(2,Pe),m(3,fe),m(4,Ae),m(5,de)],q8);var Mte=class extends jG{constructor(e,t,o,n,r,s,l){super(Mte.ID,e,t,o,n);this.fileService=r;this.dialogService=s;this.commandService=l}static{this.ID="workbench.editors.errorEditor"}static{this.LABEL=d(4873,null)}static{this.DESCRIPTOR=os.create(this,this.ID,this.LABEL)}async getContents(e,t,o){let n=e.resource,r=t.error,s=r?.fileOperationResult===1,l;s?l=d(4880,null):v3(r)&&r.forceMessage?l=r.message:r?l=d(4881,null):l=d(4882,null);let c="$(error)";v3(r)&&(r.forceSeverity===wt.Info?c="$(info)":r.forceSeverity===wt.Warning&&(c="$(warning)"));let u;return v3(r)&&r.actions.length>0?u=r.actions.map(p=>({label:p.label,run:()=>{let h=p.run();h instanceof Promise&&h.catch(g=>this.dialogService.error(Mn(g)))}})):u=[{label:d(4877,null),run:()=>this.group.openEditor(e,{...t,source:1})},{label:d(4878,null),run:()=>this.commandService.executeCommand(OG)}],s&&n&&this.fileService.hasProvider(n)&&o.add(this.fileService.onDidFilesChange(p=>{p.contains(n,1,0)&&this.group.openEditor(e,t)})),{icon:c,label:l,actions:u??[]}}};Mte=I([m(1,_e),m(2,Pe),m(3,de),m(4,ge),m(5,ct),m(6,fe)],Mte);var nP=class extends jG{constructor(e,t,o,n,r,s){super(e,t,n,r,s);this.callbacks=o;this._onDidChangeMetadata=this._register(new T);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidOpenInPlace=this._register(new T);this.onDidOpenInPlace=this._onDidOpenInPlace.event}getTitle(){return this.input?this.input.getName():d(4481,null)}async getContents(e,t){let o=await e.resolve();if(!(o instanceof $G))throw new Error("Unable to open file as binary");let n=o.getSize();return this.handleMetadataChanged(typeof n=="number"?Ml.formatSize(n):""),{icon:"$(warning)",label:d(4482,null),actions:[{label:d(4483,null),run:async()=>{await this.callbacks.openInternal(e,t),this._onDidOpenInPlace.fire()}}]}}handleMetadataChanged(e){this.metadata=e,this._onDidChangeMetadata.fire()}getMetadata(){return this.metadata}};nP=I([m(5,de)],nP);var SU=class extends iv{static{this.ID=RMt}constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,n,r,s,l,c)}getMetadata(){let i=this.getPrimaryEditorPane(),e=this.getSecondaryEditorPane();if(i instanceof nP&&e instanceof nP)return d(4480,null,e.getMetadata(),i.getMetadata())}};SU=I([m(1,_e),m(2,F),m(3,Pe),m(4,de),m(5,B),m(6,Gn),m(7,ie),m(8,kt)],SU);var CTi=class{constructor(i,e){this.primary=i;this.secondary=e}getEncoding(){return this.primary.getEncoding()}async setEncoding(i,e){await vn.settled([this.primary,this.secondary].map(t=>t.setEncoding(i,e)))}},xTi=class{constructor(i,e){this.primary=i;this.secondary=e}setLanguageId(i,e){[this.primary,this.secondary].forEach(t=>t.setLanguageId(i,e))}};function Att(a){if(a instanceof Jg)return a;if(a instanceof ja){let e=Att(a.primary),t=Att(a.secondary);return e&&t?new CTi(e,t):e}let i=a;return kvt(i.setEncoding,i.getEncoding)?i:null}function mBt(a){if(a instanceof Jg)return a;if(a instanceof ja){let e=mBt(a.primary),t=mBt(a.secondary);return e&&t?new xTi(e,t):e}let i=a;return typeof i.setLanguageId=="function"?i:null}var kTi=class{constructor(){this.indentation=!1;this.selectionStatus=!1;this.languageId=!1;this.languageStatus=!1;this.encoding=!1;this.EOL=!1;this.tabFocusMode=!1;this.inputMode=!1;this.columnSelectionMode=!1;this.metadata=!1}combine(i){this.indentation=this.indentation||i.indentation,this.selectionStatus=this.selectionStatus||i.selectionStatus,this.languageId=this.languageId||i.languageId,this.languageStatus=this.languageStatus||i.languageStatus,this.encoding=this.encoding||i.encoding,this.EOL=this.EOL||i.EOL,this.tabFocusMode=this.tabFocusMode||i.tabFocusMode,this.inputMode=this.inputMode||i.inputMode,this.columnSelectionMode=this.columnSelectionMode||i.columnSelectionMode,this.metadata=this.metadata||i.metadata}hasChanges(){return this.indentation||this.selectionStatus||this.languageId||this.languageStatus||this.encoding||this.EOL||this.tabFocusMode||this.inputMode||this.columnSelectionMode||this.metadata}},ETi=class{get selectionStatus(){return this._selectionStatus}get languageId(){return this._languageId}get encoding(){return this._encoding}get EOL(){return this._EOL}get indentation(){return this._indentation}get tabFocusMode(){return this._tabFocusMode}get inputMode(){return this._inputMode}get columnSelectionMode(){return this._columnSelectionMode}get metadata(){return this._metadata}update(i){let e=new kTi;switch(i.type){case"selectionStatus":this._selectionStatus!==i.selectionStatus&&(this._selectionStatus=i.selectionStatus,e.selectionStatus=!0);break;case"indentation":this._indentation!==i.indentation&&(this._indentation=i.indentation,e.indentation=!0);break;case"languageId":this._languageId!==i.languageId&&(this._languageId=i.languageId,e.languageId=!0);break;case"encoding":this._encoding!==i.encoding&&(this._encoding=i.encoding,e.encoding=!0);break;case"EOL":this._EOL!==i.EOL&&(this._EOL=i.EOL,e.EOL=!0);break;case"tabFocusMode":this._tabFocusMode!==i.tabFocusMode&&(this._tabFocusMode=i.tabFocusMode,e.tabFocusMode=!0);break;case"inputMode":this._inputMode!==i.inputMode&&(this._inputMode=i.inputMode,e.inputMode=!0);break;case"columnSelectionMode":this._columnSelectionMode!==i.columnSelectionMode&&(this._columnSelectionMode=i.columnSelectionMode,e.columnSelectionMode=!0);break;case"metadata":this._metadata!==i.metadata&&(this._metadata=i.metadata,e.metadata=!0);break}return e}},Ltt=class extends k{constructor(e){super();this.configurationService=e;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.registerListeners();let t=e.getValue("editor.tabFocusMode")===!0;vD.setTabFocusMode(t)}registerListeners(){this._register(vD.onDidChangeTabFocus(e=>this._onDidChange.fire(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration("editor.tabFocusMode")){let t=this.configurationService.getValue("editor.tabFocusMode")===!0;vD.setTabFocusMode(t),this._onDidChange.fire(t)}}))}};Ltt=I([m(0,B)],Ltt);var TTi=class extends k{constructor(){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;_B.setInputMode("insert"),this._register(_B.onDidChangeInputMode(e=>this._onDidChange.fire(e)))}},Lin=d(4934,null),Min=d(4933,null),Pin=d(4913,null),Ain=d(4912,null),xfo=d(4902,null),kfo=d(4901,null),Mtt=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.targetWindowId=e;this.editorService=t;this.quickInputService=o;this.languageService=n;this.textFileService=r;this.statusbarService=s;this.configurationService=c;this.tabFocusModeElement=this._register(new ue);this.inputModeElement=this._register(new ue);this.columnSelectionModeElement=this._register(new ue);this.indentationElement=this._register(new ue);this.selectionElement=this._register(new ue);this.encodingElement=this._register(new ue);this.eolElement=this._register(new ue);this.languageElement=this._register(new ue);this.metadataElement=this._register(new ue);this.state=new ETi;this.toRender=void 0;this.activeEditorListeners=this._register(new O);this.delayedRender=this._register(new ue);this.currentMarkerStatus=this._register(l.createInstance(Ptt)),this.tabFocusMode=this._register(l.createInstance(Ltt)),this.inputMode=this._register(l.createInstance(TTi)),this.registerCommands(),this.registerListeners()}registerListeners(){this._register(this.editorService.onDidActiveEditorChange(()=>this.updateStatusBar())),this._register(this.textFileService.untitled.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(this.textFileService.files.onDidChangeEncoding(e=>this.onResourceEncodingChange(e.resource))),this._register(U.runAndSubscribe(this.tabFocusMode.onDidChange,e=>{e!==void 0?this.onTabFocusModeChange(e):this.onTabFocusModeChange(this.configurationService.getValue("editor.tabFocusMode"))})),this._register(U.runAndSubscribe(this.inputMode.onDidChange,e=>this.onInputModeChange(e??"insert")))}registerCommands(){this._register(Ge.registerCommand({id:`changeEditorIndentation${this.targetWindowId}`,handler:()=>this.showIndentationPicker()}))}async showIndentationPicker(){let e=da(this.editorService.activeTextEditorControl);if(!e)return this.quickInputService.pick([{label:d(4914,null)}]);if(this.editorService.activeEditor?.isReadonly())return this.quickInputService.pick([{label:d(4916,null)}]);let t=[Ti(e.getAction(Q9e.ID)),Ti(e.getAction(j9e.ID)),Ti(e.getAction(Y9e.ID)),Ti(e.getAction(X9e.ID)),Ti(e.getAction(G9e.ID)),Ti(e.getAction(q9e.ID)),Ti(e.getAction(c9e.ID))].map(n=>({id:n.id,label:n.label,detail:SI.isDefaultVariant()||n.label===n.alias?void 0:n.alias,run:()=>{e.focus(),n.run()}}));return t.splice(3,0,{type:"separator",label:d(4906,null)}),t.unshift({type:"separator",label:d(4907,null)}),(await this.quickInputService.pick(t,{placeHolder:d(4917,null),matchOnDetail:!0}))?.run()}updateTabFocusModeElement(e){if(e){if(!this.tabFocusModeElement.value){let t=d(4946,null);this.tabFocusModeElement.value=this.statusbarService.addEntry({name:d(4945,null),text:t,ariaLabel:t,tooltip:d(4900,null),command:"editor.action.toggleTabFocusMode",kind:"prominent"},"status.editor.tabFocusMode",1,100.7)}}else this.tabFocusModeElement.clear()}updateInputModeElement(e){if(e==="overtype"){if(!this.inputModeElement.value){let t=d(4908,null),o=d(4938,null);this.inputModeElement.value=this.statusbarService.addEntry({name:o,text:t,ariaLabel:t,tooltip:o,command:"editor.action.toggleOvertypeInsertMode",kind:"prominent"},"status.editor.inputMode",1,100.6)}}else this.inputModeElement.clear()}updateColumnSelectionModeElement(e){if(e){if(!this.columnSelectionModeElement.value){let t=d(4894,null);this.columnSelectionModeElement.value=this.statusbarService.addEntry({name:d(4937,null),text:t,ariaLabel:t,tooltip:d(4899,null),command:"editor.action.toggleColumnSelection",kind:"prominent"},"status.editor.columnSelectionMode",1,100.8)}}else this.columnSelectionModeElement.clear()}updateSelectionElement(e){if(!e){this.selectionElement.clear();return}if(da(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===Q.vscodeNotebookCell){this.selectionElement.clear();return}let o={name:d(4944,null),text:e,ariaLabel:e,tooltip:d(4904,null),command:"workbench.action.gotoLine"};this.updateElement(this.selectionElement,o,"status.editor.selection",1,100.5)}updateIndentationElement(e){if(!e){this.indentationElement.clear();return}if(da(this.editorService.activeTextEditorControl)?.getModel()?.uri?.scheme===Q.vscodeNotebookCell){this.indentationElement.clear();return}let o={name:d(4941,null),text:e,ariaLabel:e,tooltip:d(4930,null),command:`changeEditorIndentation${this.targetWindowId}`};this.updateElement(this.indentationElement,o,"status.editor.indentation",1,100.4)}updateEncodingElement(e){if(!e){this.encodingElement.clear();return}let t={name:d(4939,null),text:e,ariaLabel:e,tooltip:d(4928,null),command:"workbench.action.editor.changeEncoding"};this.updateElement(this.encodingElement,t,"status.editor.encoding",1,100.3)}updateEOLElement(e){if(!e){this.eolElement.clear();return}let t={name:d(4940,null),text:e,ariaLabel:e,tooltip:d(4929,null),command:"workbench.action.editor.changeEOL"};this.updateElement(this.eolElement,t,"status.editor.eol",1,100.2)}updateLanguageIdElement(e){if(!e){this.languageElement.clear();return}let t={name:d(4943,null),text:e,ariaLabel:e,tooltip:d(4931,null),command:"workbench.action.editor.changeLanguageMode"};this.updateElement(this.languageElement,t,"status.editor.mode",1,100.1)}updateMetadataElement(e){if(!e){this.metadataElement.clear();return}let t={name:d(4942,null),text:e,ariaLabel:e,tooltip:d(4903,null)};this.updateElement(this.metadataElement,t,"status.editor.info",1,100)}updateElement(e,t,o,n,r){e.value?e.value.update(t):e.value=this.statusbarService.addEntry(t,o,n,r)}updateState(e){let t=this.state.update(e);t.hasChanges()&&(this.toRender?this.toRender.combine(t):(this.toRender=t,this.delayedRender.value=Cg(gv(this.targetWindowId,!0).window,()=>{this.delayedRender.clear();let o=this.toRender;this.toRender=void 0,o&&this.doRenderNow()})))}doRenderNow(){this.updateTabFocusModeElement(!!this.state.tabFocusMode),this.updateInputModeElement(this.state.inputMode),this.updateColumnSelectionModeElement(!!this.state.columnSelectionMode),this.updateIndentationElement(this.state.indentation),this.updateSelectionElement(this.state.selectionStatus),this.updateEncodingElement(this.state.encoding),this.updateEOLElement(this.state.EOL?this.state.EOL===`\r
`?kfo:xfo:void 0),this.updateLanguageIdElement(this.state.languageId),this.updateMetadataElement(this.state.metadata)}getSelectionLabel(e){if(e?.selections){if(e.selections.length===1)return e.charactersSelected?Wd(Lin,e.selections[0].positionLineNumber,e.selections[0].positionColumn,e.charactersSelected):Wd(Min,e.selections[0].positionLineNumber,e.selections[0].positionColumn);if(e.charactersSelected)return Wd(Pin,e.selections.length,e.charactersSelected);if(e.selections.length>0)return Wd(Ain,e.selections.length)}}updateStatusBar(){let e=this.editorService.activeEditor,t=this.editorService.activeEditorPane,o=t?da(t.getControl())??void 0:void 0;if(this.onColumnSelectionModeChange(o),this.onSelectionChange(o),this.onLanguageChange(o,e),this.onEOLChange(o),this.onEncodingChange(t,o),this.onIndentationChange(o),this.onMetadataChange(t),this.currentMarkerStatus.update(o),this.activeEditorListeners.clear(),t&&this.activeEditorListeners.add(t.onDidChangeControl(()=>{this.updateStatusBar()})),o)this.activeEditorListeners.add(o.onDidChangeConfiguration(n=>{n.hasChanged(28)&&this.onColumnSelectionModeChange(o)})),this.activeEditorListeners.add(U.defer(o.onDidChangeCursorPosition)(()=>{this.onSelectionChange(o),this.currentMarkerStatus.update(o)})),this.activeEditorListeners.add(o.onDidChangeModelLanguage(()=>{this.onLanguageChange(o,e)})),this.activeEditorListeners.add(U.accumulate(o.onDidChangeModelContent)(n=>{this.onEOLChange(o),this.currentMarkerStatus.update(o);let r=o.getSelections();if(r){for(let s of n)for(let l of s.changes)if(r.some(c=>G.areIntersecting(c,l.range))){this.onSelectionChange(o);break}}})),this.activeEditorListeners.add(o.onDidChangeModelOptions(()=>{this.onIndentationChange(o)}));else if(t instanceof nP||t instanceof SU){let n=[];if(t instanceof SU){let r=t.getPrimaryEditorPane();r instanceof nP&&n.push(r);let s=t.getSecondaryEditorPane();s instanceof nP&&n.push(s)}else n.push(t);for(let r of n)this.activeEditorListeners.add(r.onDidChangeMetadata(()=>{this.onMetadataChange(t)})),this.activeEditorListeners.add(r.onDidOpenInPlace(()=>{this.updateStatusBar()}))}}onLanguageChange(e,t){let o={type:"languageId",languageId:void 0};if(e&&t&&mBt(t)){let n=e.getModel();if(n){let r=n.getLanguageId();o.languageId=this.languageService.getLanguageName(r)??void 0}}this.updateState(o)}onIndentationChange(e){let t={type:"indentation",indentation:void 0};if(e){let o=e.getModel();if(o){let n=o.getOptions();t.indentation=n.insertSpaces?n.tabSize===n.indentSize?d(4936,null,n.indentSize):d(4935,null,n.indentSize,n.tabSize):d(4947,null,n.tabSize)}}this.updateState(t)}onMetadataChange(e){let t={type:"metadata",metadata:void 0};(e instanceof nP||e instanceof SU)&&(t.metadata=e.getMetadata()),this.updateState(t)}onColumnSelectionModeChange(e){let t={type:"columnSelectionMode",columnSelectionMode:!1};e?.getOption(28)&&(t.columnSelectionMode=!0),this.updateState(t)}onSelectionChange(e){let t=Object.create(null);if(e){t.selections=e.getSelections()||[],t.charactersSelected=0;let o=e.getModel();if(o)for(let n of t.selections)typeof t.charactersSelected!="number"&&(t.charactersSelected=0),t.charactersSelected+=o.getCharacterCountInRange(n);if(t.selections.length===1){let n=e.getPosition(),r=new ei(t.selections[0].selectionStartLineNumber,t.selections[0].selectionStartColumn,t.selections[0].positionLineNumber,n?e.getStatusbarColumn(n):t.selections[0].positionColumn);t.selections[0]=r}}this.updateState({type:"selectionStatus",selectionStatus:this.getSelectionLabel(t)})}onEOLChange(e){let t={type:"EOL",EOL:void 0};if(e&&!e.getOption(104)){let o=e.getModel();o&&(t.EOL=o.getEOL())}this.updateState(t)}onEncodingChange(e,t){if(e&&!this.isActiveEditor(e))return;let o={type:"encoding",encoding:void 0};if(e&&t?.hasModel()){let n=e.input?Att(e.input):null;if(n){let r=n.getEncoding(),s=typeof r=="string"?kC[r]:void 0;s?o.encoding=s.labelShort:o.encoding=r}}this.updateState(o)}onResourceEncodingChange(e){let t=this.editorService.activeEditorPane;if(t){let o=po.getCanonicalUri(t.input,{supportSideBySide:1});if(o&&ze(o,e)){let n=da(t.getControl())??void 0;return this.onEncodingChange(t,n)}}}onTabFocusModeChange(e){let t={type:"tabFocusMode",tabFocusMode:e};this.updateState(t)}onInputModeChange(e){let t={type:"inputMode",inputMode:e};this.updateState(t)}isActiveEditor(e){let t=this.editorService.activeEditorPane;return!!t&&t===e}};Mtt=I([m(1,ie),m(2,$e),m(3,Rt),m(4,Uo),m(5,Fr),m(6,F),m(7,B)],Mtt);var Dhe=class extends k{constructor(e){super();this.editorGroupService=e;for(let t of e.parts)this.createEditorStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createEditorStatus(t)))}static{this.ID="workbench.contrib.editorStatus"}createEditorStatus(e){let t=new O;U.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(Mtt,e.windowId))}};Dhe=I([m(0,kt)],Dhe);var Ptt=class extends k{constructor(e,t,o){super();this.statusbarService=e;this.markerService=t;this.configurationService=o;this.editor=void 0;this.markers=[];this.currentMarker=null;this.statusBarEntryAccessor=this._register(new ue),this._register(t.onMarkerChanged(n=>this.onMarkerChanged(n))),this._register(U.filter(o.onDidChangeConfiguration,n=>n.affectsConfiguration("problems.showCurrentInStatus"))(()=>this.updateStatus()))}update(e){this.editor=e,this.updateMarkers(),this.updateStatus()}updateStatus(){let e=this.currentMarker;if(this.currentMarker=this.getMarker(),this.hasToUpdateStatus(e,this.currentMarker))if(this.currentMarker){let t=Hc(this.currentMarker.message)[0],o=`${this.getType(this.currentMarker)} ${t}`;this.statusBarEntryAccessor.value?this.statusBarEntryAccessor.value.update({name:d(4898,null),text:o,ariaLabel:o}):this.statusBarEntryAccessor.value=this.statusbarService.addEntry({name:d(4898,null),text:o,ariaLabel:o},"statusbar.currentProblem",0)}else this.statusBarEntryAccessor.clear()}hasToUpdateStatus(e,t){return!t||!e?!0:YB.makeKey(e)!==YB.makeKey(t)}getType(e){switch(e.severity){case 8:return"$(error)";case 4:return"$(warning)";case 2:return"$(info)"}return""}getMarker(){if(!this.configurationService.getValue("problems.showCurrentInStatus")||!this.editor||!this.editor.getModel())return null;let t=this.editor.getPosition();return t&&this.markers.find(o=>G.containsPosition(o,t))||null}onMarkerChanged(e){if(!this.editor)return;let t=this.editor.getModel();t&&(t&&!e.some(o=>ze(t.uri,o))||this.updateMarkers())}updateMarkers(){if(!this.editor)return;let e=this.editor.getModel();e&&(e?(this.markers=this.markerService.read({resource:e.uri,severities:14}),this.markers.sort(this.compareMarker)):this.markers=[],this.updateStatus())}compareMarker(e,t){let o=oc(e.resource.toString(),t.resource.toString());return o===0&&(o=Pl.compare(e.severity,t.severity)),o===0&&(o=G.compareRangesUsingStarts(e,t)),o}};Ptt=I([m(0,Fr),m(1,ha),m(2,B)],Ptt);var Pte=class a extends z{static{this.ID="workbench.action.editor.changeLanguageMode"}constructor(){super({id:a.ID,title:P(4893,"Change Language Mode"),f1:!0,keybinding:{weight:200,primary:Gi(2089,43)},precondition:C.not("notebookEditorFocused"),metadata:{description:d(4892,null),args:[{name:d(4891,null),constraint:i=>typeof i=="string"}]}})}async run(i,e){let t=i.get($e),o=i.get(ie),n=i.get(Rt),r=i.get(jS),s=i.get(Uo),l=i.get(Qo),c=i.get(B),u=i.get(_e),p=i.get(fe),h=i.get(ga),g=da(o.activeTextEditorControl);if(!g){await t.pick([{label:d(4914,null)}]);return}let f=g.getModel(),v=po.getOriginalUri(o.activeEditor,{supportSideBySide:1}),b,S;f&&(S=f.getLanguageId(),b=n.getLanguageName(S)??void 0);let y=!!v;v?.scheme===Q.untitled&&!s.untitled.get(v)?.hasAssociatedFilePath&&(y=!1);let x=n.getSortedRegisteredLanguageNames().map(({languageName:j,languageId:J})=>{let se=n.getExtensions(J).join(" "),ae;return b===j?ae=d(4909,null,J):ae=d(4910,null,J),{id:J,label:j,meta:se,iconClasses:v2(J),description:ae}});x.unshift({type:"separator",label:d(4911,null)});let E,M,N;if(y&&v){let j=Ts(v)||Be(v);h.isEnabled()&&(N=li({id:"workbench.action.showLanguageExtensions",label:d(4932,null,j),run:()=>p.executeCommand("workbench.extensions.action.showExtensionsForLanguage",j)}),x.unshift(N)),M={label:d(4896,null,b)},x.unshift(M),E={label:d(4895,null,j)},x.unshift(E)}let V={label:d(4888,null)};f&&f.getValueLength()>0&&x.unshift(V);let H=typeof e=="string"?{label:e}:await t.pick(x,{placeHolder:d(4921,null),matchOnDescription:!0});if(!H)return;if(H===N){N.run();return}if(H===E){v&&this.configureFileAssociation(v,n,t,c);return}if(H===M){l.openUserSettings({jsonEditor:!0,revealSetting:{key:`[${S??null}]`,edit:!0}});return}let K=o.activeEditor;if(K){let j=mBt(K);if(j){let J,se;if(H===V){if(f){let ae=po.getOriginalUri(K,{supportSideBySide:1});if(ae){let ce=n.guessLanguageIdByFilepathOrFirstLine(ae,f.getLineContent(1))??void 0;(!ce||ce==="unknown")&&(se=await r.detectLanguage(ae),ce=se),ce&&(J=n.createById(ce))}}}else J=n.createById(H.id),v&&r.detectLanguage(v).then(ae=>{let ce=n.getLanguageIdByLanguageName(H.label)||"unknown";if(ae===S&&S!==ce){let Se=c.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";u.publicLog2(nco,{currentLanguageId:b??"unknown",nextLanguageId:H.label,lineCount:f?.getLineCount()??-1,modelPreference:Se})}});if(typeof J<"u"&&(j.setLanguageId(J.languageId,a.ID),v?.scheme===Q.untitled)){let ae=c.getValue("workbench.editor.preferHistoryBasedLanguageDetection")?"history":"classic";u.publicLog2("setUntitledDocumentLanguage",{to:J.languageId,from:S??"none",modelPreference:ae})}}g.focus()}}configureFileAssociation(i,e,t,o){let n=Ts(i),r=Be(i),s=e.guessLanguageIdByFilepathOrFirstLine(A.file(r)),c=e.getSortedRegisteredLanguageNames().map(({languageName:u,languageId:p})=>({id:p,label:u,iconClasses:v2(p),description:p===s?d(4897,null):void 0}));setTimeout(async()=>{let u=await t.pick(c,{placeHolder:d(4922,null,n||r)});if(u){let p=o.inspect(F5),h;n&&r[0]!=="."?h=`*${n}`:h=r;let g=2;p.workspaceValue?.[h]&&(g=5);let f=io(g===5?p.workspaceValue:p.userValue)||Object.create(null);f[h]=u.id,o.updateValue(F5,f,g)}},50)}},hBt=class extends z{constructor(){super({id:"workbench.action.editor.changeEOL",title:P(4890,"Change End of Line Sequence"),f1:!0})}async run(i){let e=i.get(ie),t=i.get($e),o=da(e.activeTextEditorControl);if(!o){await t.pick([{label:d(4914,null)}]);return}if(e.activeEditor?.isReadonly()){await t.pick([{label:d(4916,null)}]);return}let n=o.getModel(),r=[{label:xfo,eol:0},{label:kfo,eol:1}],s=n?.getEOL()===`
`?0:1,l=await t.pick(r,{placeHolder:d(4920,null),activeItem:r[s]});if(l){let c=da(e.activeTextEditorControl);c?.hasModel()&&!e.activeEditor?.isReadonly()&&(n=c.getModel(),n.pushStackElement(),n.pushEOL(l.eol),n.pushStackElement())}o.focus()}},gBt=class extends z{constructor(){super({id:"workbench.action.editor.changeEncoding",title:P(4889,"Change File Encoding"),f1:!0})}async run(i){let e=i.get(ie),t=i.get($e),o=i.get(ge),n=i.get(Uo),r=i.get(Gn),s=i.get(ct),l=da(e.activeTextEditorControl);if(!l){await t.pick([{label:d(4914,null)}]);return}let c=e.activeEditorPane;if(!c){await t.pick([{label:d(4914,null)}]);return}let u=Att(c.input);if(!u){await t.pick([{label:d(4915,null)}]);return}let p={label:d(4927,null)},h={label:d(4924,null)};if(!SI.isDefaultVariant()){let V="Save with Encoding";V!==p.label&&(p.detail=V);let H="Reopen with Encoding";H!==h.label&&(h.detail=H)}let g;if(u instanceof Jg?g=p:c.input.isReadonly()?g=h:g=await t.pick([h,p],{placeHolder:d(4917,null),matchOnDetail:!0}),!g)return;await Li(50);let f=po.getOriginalUri(c.input,{supportSideBySide:1});if(!f||!o.hasProvider(f)&&f.scheme!==Q.untitled)return;let v;o.hasProvider(f)&&(v=(await n.readStream(f,{autoGuessEncoding:!0,candidateGuessEncodings:r.getValue(f,"files.candidateGuessEncodings")})).encoding);let b=g===h,S=r.getValue(f,"files.encoding"),y,w,x=Object.keys(kC).sort((V,H)=>V===S?-1:H===S?1:kC[V].order-kC[H].order).filter(V=>V===v&&v!==S?!1:!b||!kC[V].encodeOnly).map((V,H)=>(V===u.getEncoding()?y=H:kC[V].alias===u.getEncoding()&&(w=H),{id:V,label:kC[V].labelLong,description:V})),E=x.slice();v&&S!==v&&kC[v]&&(x.unshift({type:"separator"}),x.unshift({id:v,label:kC[v].labelLong,description:d(4905,null)}));let M=await t.pick(x,{placeHolder:b?d(4918,null):d(4919,null),activeItem:E[typeof y=="number"?y:typeof w=="number"?w:-1]});if(!M||!e.activeEditorPane)return;let N=Att(e.activeEditorPane.input);if(typeof M.id<"u"&&N){if(b&&e.activeEditorPane.input.isDirty()){let{confirmed:V}=await s.confirm({message:d(4926,null),detail:d(4925,null),primaryButton:d(4923,null)});if(!V)return;await e.activeEditorPane.input.revert(e.activeEditorPane.group.id)}await N.setEncoding(M.id,b?1:0)}l.focus()}};var fa=le("historyService");var Pp=class extends z{constructor(e,t,o){super(e);this.commandId=t;this.commandArgs=o}run(e){return e.get(fe).executeCommand(this.commandId,this.commandArgs)}},fBt=class extends z{getDirection(i){return Zy(i)}async run(i,...e){let t=i.get(kt),o=i.get(B),n=i.get(ie),r=i.get(Co),s=this.getDirection(o),l=Zp(e,n,t,r);qEi(t,s,l)}},vBt=class a extends fBt{static{this.ID=Ete}constructor(){super({id:a.ID,title:P(4793,"Split Editor"),f1:!0,keybinding:{weight:200,primary:2141},category:Fe.View})}},bBt=class extends fBt{constructor(){super({id:"workbench.action.splitEditorOrthogonal",title:P(4800,"Split Editor Orthogonal"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2141)},category:Fe.View})}getDirection(i){return Zy(i)===3?1:3}},SBt=class extends Pp{constructor(){super({id:H8,title:P(4796,"Split Editor Left"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2141)},category:Fe.View},H8)}},IBt=class extends Pp{constructor(){super({id:KG,title:P(4797,"Split Editor Right"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2141)},category:Fe.View},KG)}},yBt=class extends Pp{static{this.LABEL=d(4798,null)}constructor(){super({id:B8,title:P(4799,"Split Editor Up"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2141)},category:Fe.View},B8)}},wBt=class extends Pp{static{this.LABEL=d(4794,null)}constructor(){super({id:zG,title:P(4795,"Split Editor Down"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2141)},category:Fe.View},zG)}},CBt=class extends z{constructor(){super({id:"workbench.action.joinTwoGroups",title:P(4722,"Join Editor Group with Next Group"),f1:!0,category:Fe.View})}async run(i,e){let t=i.get(kt),o;if(e&&typeof e.groupId=="number"?o=t.getGroup(e.groupId):o=t.activeGroup,o){let n=[3,1,2,0];for(let r of n){let s=t.findGroup({direction:r},o);if(s&&o!==s){t.mergeGroup(o,s);break}}}}},xBt=class extends z{constructor(){super({id:"workbench.action.joinAllGroups",title:P(4721,"Join All Editor Groups"),f1:!0,category:Fe.View})}async run(i){let e=i.get(kt);e.mergeAllGroups(e.activeGroup)}},kBt=class extends z{constructor(){super({id:"workbench.action.navigateEditorGroups",title:P(4757,"Navigate Between Editor Groups"),f1:!0,category:Fe.View})}async run(i){let e=i.get(kt);e.findGroup({location:2},e.activeGroup,!0)?.focus()}},EBt=class extends z{constructor(){super({id:"workbench.action.focusActiveEditorGroup",title:P(4713,"Focus Active Editor Group"),f1:!0,category:Fe.View})}async run(i){i.get(kt).activeGroup.focus()}},QG=class extends z{constructor(e,t){super(e);this.scope=t}async run(e){let t=e.get(kt);t.findGroup(this.scope,t.activeGroup,!0)?.focus()}},TBt=class extends QG{constructor(){super({id:"workbench.action.focusFirstEditorGroup",title:P(4715,"Focus First Editor Group"),f1:!0,keybinding:{weight:200,primary:2070},category:Fe.View},{location:0})}},_Bt=class extends QG{constructor(){super({id:"workbench.action.focusLastEditorGroup",title:P(4716,"Focus Last Editor Group"),f1:!0,category:Fe.View},{location:1})}},DBt=class extends QG{constructor(){super({id:"workbench.action.focusNextGroup",title:P(4718,"Focus Next Editor Group"),f1:!0,category:Fe.View},{location:2})}},RBt=class extends QG{constructor(){super({id:"workbench.action.focusPreviousGroup",title:P(4719,"Focus Previous Editor Group"),f1:!0,category:Fe.View},{location:3})}},LBt=class extends QG{constructor(){super({id:"workbench.action.focusLeftGroup",title:P(4717,"Focus Left Editor Group"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2063)},category:Fe.View},{direction:2})}},MBt=class extends QG{constructor(){super({id:"workbench.action.focusRightGroup",title:P(4720,"Focus Right Editor Group"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2065)},category:Fe.View},{direction:3})}},PBt=class extends QG{constructor(){super({id:"workbench.action.focusAboveGroup",title:P(4712,"Focus Editor Group Above"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2064)},category:Fe.View},{direction:0})}},ABt=class extends QG{constructor(){super({id:"workbench.action.focusBelowGroup",title:P(4714,"Focus Editor Group Below"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2066)},category:Fe.View},{direction:1})}},Ate=class extends it{constructor(e,t,o){super(e,t,q.asClassName(L.close));this.commandService=o}static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=d(4688,null)}run(e){return this.commandService.executeCommand(ok,void 0,e)}};Ate=I([m(2,fe)],Ate);var _W=class extends it{constructor(e,t,o){super(e,t,q.asClassName(L.pinned));this.commandService=o}static{this.ID="workbench.action.unpinActiveEditor"}static{this.LABEL=d(4814,null)}run(e){return this.commandService.executeCommand(V8,void 0,e)}};_W=I([m(2,fe)],_W);var Nte=class extends it{constructor(e,t,o){super(e,t,q.asClassName(L.close));this.editorGroupService=o}static{this.ID="workbench.action.closeActiveEditor"}static{this.LABEL=d(4692,null)}async run(e){let t=e?this.editorGroupService.getGroup(e.groupId):this.editorGroupService.activeGroup;if(!t)return;let o=e?.editorIndex!==void 0?t.getEditorByIndex(e.editorIndex):t.activeEditor;if(!o)return;let n=[];t.isSelected(o)?n.push(...t.selectedEditors):n.push(o);for(let r of n)await t.closeEditor(r,{preserveFocus:e?.preserveFocus})}};Nte=I([m(2,kt)],Nte);var NBt=class extends z{constructor(){super({id:"workbench.action.revertAndCloseActiveEditor",title:P(4788,"Revert and Close Editor"),f1:!0,category:Fe.View})}async run(i){let e=i.get(ie),t=i.get(re),o=e.activeEditorPane;if(o){let n=o.input,r=o.group;try{await e.revert({editor:n,groupId:r.id})}catch(s){t.error(s),await e.revert({editor:n,groupId:r.id},{soft:!0})}await r.closeEditor(n)}}},OBt=class extends z{constructor(){super({id:"workbench.action.closeEditorsToTheLeft",title:P(4691,"Close Editors to the Left in Group"),f1:!0,category:Fe.View})}async run(i,e){let t=i.get(kt),{group:o,editor:n}=this.getTarget(t,e);o&&n&&await o.closeEditors({direction:0,except:n,excludeSticky:!0})}getTarget(i,e){return e?{editor:e.editor,group:i.getGroup(e.groupId)}:{group:i.activeGroup,editor:i.activeGroup.activeEditor}}},FBt=class extends z{groupsToClose(i){let e=[],t=i.getGroups(2);for(let o=t.length-1;o>=0;o--)e.push(t[o]);return e}async run(i){let e=i.get(ie),t=i.get(re),o=i.get(Go),n=i.get(kt),r=i.get(fr),s=i.get(nn),l=new Set,c=new Set,u=new Set,p=new Map;for(let{editor:h,groupId:g}of e.getEditors(1,{excludeSticky:this.excludeSticky})){let f=!1,v=!1;if(h.closeHandler)try{f=h.closeHandler.showConfirm()}catch(b){t.error(b),v=!0}if((!h.closeHandler||v)&&(f=h.isDirty()&&!h.isSaving()),!!f)if(typeof h.closeHandler?.confirm=="function"){let b=p.get(h.typeId);b||(b=new Set,p.set(h.typeId,b)),b.add({editor:h,groupId:g})}else!h.hasCapability(4)&&r.getAutoSaveMode(h).mode===3?c.add({editor:h,groupId:g}):Qr&&(ii||Sn)&&!h.hasCapability(4)&&r.getAutoSaveMode(h).mode===4?u.add({editor:h,groupId:g}):l.add({editor:h,groupId:g})}if(l.size>0){let h=Array.from(l.values());switch(await this.revealEditorsToConfirm(h,n),await s.showSaveConfirm(h.map(({editor:f})=>f instanceof ja?f.primary.getName():f.getName()))){case 2:return;case 1:await this.revertEditors(e,t,o,h);break;case 0:await e.save(h,{reason:1});break}}for(let[,h]of p){let g=Array.from(h.values());await this.revealEditorsToConfirm(g,n);let f=await g.at(0)?.editor.closeHandler?.confirm?.(g);if(typeof f=="number")switch(f){case 2:return;case 1:await this.revertEditors(e,t,o,g);break;case 0:await e.save(g,{reason:1});break}}if(c.size>0){let h=Array.from(c.values());await e.save(h,{reason:3})}if(u.size>0){let h=Array.from(u.values());await e.save(h,{reason:4})}return this.doCloseAll(n)}revertEditors(i,e,t,o){return t.withProgress({location:10,delay:800,title:d(4789,null)},()=>this.doRevertEditors(i,e,o))}async doRevertEditors(i,e,t){try{await i.revert(t)}catch(o){e.error(o),await i.revert(t,{soft:!0})}}async revealEditorsToConfirm(i,e){try{let t=new Set;for(let{editor:o,groupId:n}of i){if(t.has(n))continue;t.add(n),await e.getGroup(n)?.openEditor(o)}}catch{}}async doCloseAll(i){await Promise.all(this.groupsToClose(i).map(e=>e.closeAllEditors({excludeSticky:this.excludeSticky})))}},Rhe=class a extends FBt{static{this.ID="workbench.action.closeAllEditors"}static{this.LABEL=P(4686,"Close All Editors")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,keybinding:{weight:200,primary:Gi(2089,2101)},icon:L.closeAll,category:Fe.View})}get excludeSticky(){return!0}},WBt=class extends FBt{constructor(){super({id:"workbench.action.closeAllGroups",title:P(4687,"Close All Editor Groups"),f1:!0,keybinding:{weight:200,primary:Gi(2089,3125)},category:Fe.View})}get excludeSticky(){return!1}async doCloseAll(i){await super.doCloseAll(i);for(let e of this.groupsToClose(i))i.removeGroup(e)}},VBt=class extends z{constructor(){super({id:"workbench.action.closeEditorsInOtherGroups",title:P(4690,"Close Editors in Other Groups"),f1:!0,category:Fe.View})}async run(i,e){let t=i.get(kt),o=e?t.getGroup(e.groupId):t.activeGroup;await Promise.all(t.getGroups(1).map(async n=>{if(!(o&&n.id===o.id))return n.closeAllEditors({excludeSticky:!0})}))}},BBt=class extends z{constructor(){super({id:"workbench.action.closeEditorInAllGroups",title:P(4689,"Close Editor in All Groups"),f1:!0,category:Fe.View})}async run(i){let e=i.get(ie),t=i.get(kt),o=e.activeEditor;o&&await Promise.all(t.getGroups(1).map(n=>n.closeEditor(o)))}},HBt=class extends z{constructor(e,t,o){super(e);this.direction=t;this.isMove=o}async run(e,t){let o=e.get(kt),n;if(t&&typeof t.groupId=="number"?n=o.getGroup(t.groupId):n=o.activeGroup,n){let r;if(this.isMove){let s=this.findTargetGroup(o,n);s&&(r=o.moveGroup(n,s,this.direction))}else r=o.copyGroup(n,n,this.direction);r&&o.activateGroup(r)}}findTargetGroup(e,t){let o=[this.direction];switch(this.direction){case 2:case 3:o.push(0,1);break;case 0:case 1:o.push(2,3);break}for(let n of o){let r=e.findGroup({direction:n},t);if(r)return r}}},uPe=class extends HBt{constructor(i,e){super(i,e,!0)}},UBt=class extends uPe{constructor(){super({id:"workbench.action.moveActiveEditorGroupLeft",title:P(4736,"Move Editor Group Left"),f1:!0,keybinding:{weight:200,primary:Gi(2089,15)},category:Fe.View},2)}},zBt=class extends uPe{constructor(){super({id:"workbench.action.moveActiveEditorGroupRight",title:P(4737,"Move Editor Group Right"),f1:!0,keybinding:{weight:200,primary:Gi(2089,17)},category:Fe.View},3)}},KBt=class extends uPe{constructor(){super({id:"workbench.action.moveActiveEditorGroupUp",title:P(4738,"Move Editor Group Up"),f1:!0,keybinding:{weight:200,primary:Gi(2089,16)},category:Fe.View},0)}},GBt=class extends uPe{constructor(){super({id:"workbench.action.moveActiveEditorGroupDown",title:P(4735,"Move Editor Group Down"),f1:!0,keybinding:{weight:200,primary:Gi(2089,18)},category:Fe.View},1)}},pPe=class extends HBt{constructor(i,e){super(i,e,!1)}},qBt=class extends pPe{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupLeft",title:P(4699,"Duplicate Editor Group Left"),f1:!0,category:Fe.View},2)}},$Bt=class extends pPe{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupRight",title:P(4700,"Duplicate Editor Group Right"),f1:!0,category:Fe.View},3)}},jBt=class extends pPe{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupUp",title:P(4701,"Duplicate Editor Group Up"),f1:!0,category:Fe.View},0)}},QBt=class extends pPe{constructor(){super({id:"workbench.action.duplicateActiveEditorGroupDown",title:P(4698,"Duplicate Editor Group Down"),f1:!0,category:Fe.View},1)}},YBt=class extends z{constructor(){super({id:"workbench.action.minimizeOtherEditors",title:P(4732,"Expand Editor Group"),f1:!0,category:Fe.View,precondition:qS})}async run(i){i.get(kt).arrangeGroups(1)}},XBt=class extends z{constructor(){super({id:"workbench.action.minimizeOtherEditorsHideSidebar",title:P(4733,"Expand Editor Group and Hide Side Bars"),f1:!0,category:Fe.View,precondition:C.or(qS,eN,tN)})}async run(i){let e=i.get(kt),t=i.get(wi);t.setPartHidden(!0,"workbench.parts.sidebar"),t.setPartHidden(!0,"workbench.parts.auxiliarybar"),e.arrangeGroups(1)}},JBt=class extends z{constructor(){super({id:"workbench.action.evenEditorWidths",title:P(4710,"Reset Editor Group Sizes"),f1:!0,category:Fe.View})}async run(i){i.get(kt).arrangeGroups(2)}},ZBt=class extends z{constructor(){super({id:"workbench.action.toggleEditorWidths",title:P(4811,"Toggle Editor Group Sizes"),f1:!0,category:Fe.View})}async run(i){i.get(kt).toggleExpandGroup()}},eHt=class extends z{constructor(){super({id:"workbench.action.maximizeEditorHideSidebar",title:P(4724,"Maximize Editor Group and Hide Side Bars"),f1:!0,category:Fe.View,precondition:C.or(C.and(CH.negate(),y3),eN,tN)})}async run(i){let e=i.get(wi),t=i.get(kt);i.get(ie).activeEditor&&(e.setPartHidden(!0,"workbench.parts.sidebar"),e.setPartHidden(!0,"workbench.parts.auxiliarybar"),t.arrangeGroups(0))}},tHt=class extends z{constructor(){super({id:ZMe,title:P(4812,"Toggle Maximize Editor Group"),f1:!0,category:Fe.View,precondition:C.or(y3,CH),keybinding:{weight:200,primary:Gi(2089,2091)},menu:[{id:R.EditorTitle,order:-1e4,group:"navigation",when:CH},{id:R.EmptyEditorGroup,order:-1e4,group:"navigation",when:CH}],icon:L.screenFull,toggled:{condition:CH,title:d(4813,null)}})}async run(i,...e){let t=i.get(kt),o=i.get(ie),n=i.get(Co),r=Zp(e,o,t,n);r.groupedEditors.length&&t.toggleMaximizeGroup(r.groupedEditors[0].group)}},Ote=class extends z{async run(i){let e=i.get(kt),t=this.navigate(e);if(!t)return;let{groupId:o,editor:n}=t;if(!n)return;let r=e.getGroup(o);r&&await r.openEditor(n)}},iHt=class extends Ote{constructor(){super({id:"workbench.action.nextEditor",title:P(4774,"Open Next Editor"),f1:!0,keybinding:{weight:200,primary:2060,mac:{primary:2577,secondary:[3166]}},category:Fe.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;if(o+1<t.length)return{editor:t[o+1],groupId:e.id};let n=new Set,r=i.activeGroup;for(;r&&!n.has(r.id);)if(r=i.findGroup({location:2},r,!0),r){n.add(r.id);let s=r.getEditors(1);if(s.length>0)return{editor:s[0],groupId:r.id}}}},oHt=class extends Ote{constructor(){super({id:"workbench.action.previousEditor",title:P(4777,"Open Previous Editor"),f1:!0,keybinding:{weight:200,primary:2059,mac:{primary:2575,secondary:[3164]}},category:Fe.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;if(o>0)return{editor:t[o-1],groupId:e.id};let n=new Set,r=i.activeGroup;for(;r&&!n.has(r.id);)if(r=i.findGroup({location:3},r,!0),r){n.add(r.id);let s=r.getEditors(1);if(s.length>0)return{editor:s[s.length-1],groupId:r.id}}}},nHt=class extends Ote{constructor(){super({id:"workbench.action.nextEditorInGroup",title:P(4773,"Open Next Editor in Group"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2060),mac:{primary:Gi(2089,2577)}},category:Fe.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;return{editor:o+1<t.length?t[o+1]:t[0],groupId:e.id}}},rHt=class extends Ote{constructor(){super({id:"workbench.action.previousEditorInGroup",title:P(4778,"Open Previous Editor in Group"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2059),mac:{primary:Gi(2089,2575)}},category:Fe.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1),o=e.activeEditor?t.indexOf(e.activeEditor):-1;return{editor:o>0?t[o-1]:t[t.length-1],groupId:e.id}}},sHt=class extends Ote{constructor(){super({id:"workbench.action.firstEditorInGroup",title:P(4711,"Open First Editor in Group"),f1:!0,category:Fe.View})}navigate(i){let e=i.activeGroup;return{editor:e.getEditors(1)[0],groupId:e.id}}},aHt=class extends Ote{constructor(){super({id:"workbench.action.lastEditorInGroup",title:P(4723,"Open Last Editor in Group"),f1:!0,keybinding:{weight:200,primary:533,secondary:[2078],mac:{primary:277,secondary:[2078]}},category:Fe.View})}navigate(i){let e=i.activeGroup,t=e.getEditors(1);return{editor:t[t.length-1],groupId:e.id}}},mPe=class a extends z{static{this.ID="workbench.action.navigateForward"}static{this.LABEL=d(4759,null)}constructor(){super({id:a.ID,title:{...P(4760,"Go Forward"),mnemonicTitle:d(4728,null)},f1:!0,icon:L.arrowRight,precondition:C.has("canNavigateForward"),keybinding:{weight:200,win:{primary:529,secondary:[123]},mac:{primary:1368,secondary:[123]},linux:{primary:3160,secondary:[123]}},menu:[{id:R.MenubarGoMenu,group:"1_history_nav",order:2},{id:R.CommandCenter,order:2,when:C.has("config.workbench.navigationControl.enabled")}]})}async run(i){await i.get(fa).goForward(0)}},hPe=class a extends z{static{this.ID="workbench.action.navigateBack"}static{this.LABEL=d(4753,null)}constructor(){super({id:a.ID,title:{...P(4754,"Go Back"),mnemonicTitle:d(4725,null)},f1:!0,precondition:C.has("canNavigateBack"),icon:L.arrowLeft,keybinding:{weight:200,win:{primary:527,secondary:[122]},mac:{primary:344,secondary:[122]},linux:{primary:2648,secondary:[122]}},menu:[{id:R.MenubarGoMenu,group:"1_history_nav",order:1},{id:R.CommandCenter,order:1,when:C.has("config.workbench.navigationControl.enabled")}]})}async run(i){await i.get(fa).goBack(0)}},lHt=class extends z{constructor(){super({id:"workbench.action.navigateLast",title:P(4763,"Go Previous"),f1:!0})}async run(i){await i.get(fa).goPrevious(0)}},cHt=class extends z{constructor(){super({id:"workbench.action.navigateForwardInEditLocations",title:P(4761,"Go Forward in Edit Locations"),f1:!0})}async run(i){await i.get(fa).goForward(1)}},dHt=class extends z{constructor(){super({id:"workbench.action.navigateBackInEditLocations",title:P(4755,"Go Back in Edit Locations"),f1:!0})}async run(i){await i.get(fa).goBack(1)}},uHt=class extends z{constructor(){super({id:"workbench.action.navigatePreviousInEditLocations",title:P(4764,"Go Previous in Edit Locations"),f1:!0})}async run(i){await i.get(fa).goPrevious(1)}},pHt=class extends z{constructor(){super({id:"workbench.action.navigateToLastEditLocation",title:P(4766,"Go to Last Edit Location"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2095)}})}async run(i){await i.get(fa).goLast(1)}},mHt=class extends z{constructor(){super({id:"workbench.action.navigateForwardInNavigationLocations",title:P(4762,"Go Forward in Navigation Locations"),f1:!0})}async run(i){await i.get(fa).goForward(2)}},hHt=class extends z{constructor(){super({id:"workbench.action.navigateBackInNavigationLocations",title:P(4756,"Go Back in Navigation Locations"),f1:!0})}async run(i){await i.get(fa).goBack(2)}},gHt=class extends z{constructor(){super({id:"workbench.action.navigatePreviousInNavigationLocations",title:P(4765,"Go Previous in Navigation Locations"),f1:!0})}async run(i){await i.get(fa).goPrevious(2)}},fHt=class extends z{constructor(){super({id:"workbench.action.navigateToLastNavigationLocation",title:P(4767,"Go to Last Navigation Location"),f1:!0})}async run(i){await i.get(fa).goLast(2)}},Ntt=class a extends z{static{this.ID="workbench.action.reopenClosedEditor"}constructor(){super({id:a.ID,title:P(4785,"Reopen Closed Editor"),f1:!0,keybinding:{weight:200,primary:3122},category:Fe.View})}async run(i){await i.get(fa).reopenLastClosedEditor()}},Ott=class a extends z{static{this.ID="workbench.action.clearRecentFiles"}constructor(){super({id:a.ID,title:P(4685,"Clear Recently Opened..."),f1:!0,category:Fe.File})}async run(i){let e=i.get(ct),t=i.get(bm),o=i.get(fa),{confirmed:n}=await e.confirm({type:"warning",message:d(4695,null),detail:d(4693,null),primaryButton:d(4682,null)});n&&(t.clearRecentlyOpened(),o.clearRecentlyOpened())}},Ftt=class a extends z{static{this.ID="workbench.action.showEditorsInActiveGroup"}constructor(){super({id:a.ID,title:P(4792,"Show Editors in Active Group By Most Recently Used"),f1:!0,category:Fe.View})}async run(i){i.get($e).quickAccess.show(ER.PREFIX)}},Wtt=class a extends z{static{this.ID="workbench.action.showAllEditors"}constructor(){super({id:a.ID,title:P(4790,"Show All Editors By Appearance"),f1:!0,keybinding:{weight:200,primary:Gi(2089,2094),mac:{primary:2562}},category:Fe.File})}async run(i){i.get($e).quickAccess.show(hU.PREFIX)}},Vtt=class a extends z{static{this.ID="workbench.action.showAllEditorsByMostRecentlyUsed"}constructor(){super({id:a.ID,title:P(4791,"Show All Editors By Most Recently Used"),f1:!0,category:Fe.View})}async run(i){i.get($e).quickAccess.show(WN.PREFIX)}},gPe=class extends z{constructor(e,t,o){super(e);this.prefix=t;this.itemActivation=o}async run(e){let t=e.get(Le),o=e.get($e),n=t.lookupKeybindings(this.desc.id);o.quickAccess.show(this.prefix,{quickNavigateConfiguration:{keybindings:n},itemActivation:this.itemActivation})}},vHt=class extends gPe{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditor",title:P(4783,"Quick Open Previous Recently Used Editor"),f1:!0,category:Fe.View},WN.PREFIX,void 0)}},bHt=class extends gPe{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditor",title:P(4781,"Quick Open Least Recently Used Editor"),f1:!0,category:Fe.View},WN.PREFIX,void 0)}},SHt=class extends gPe{constructor(){super({id:"workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup",title:P(4784,"Quick Open Previous Recently Used Editor in Group"),f1:!0,keybinding:{weight:200,primary:2050,mac:{primary:258}},precondition:Tpe.toNegated(),category:Fe.View},ER.PREFIX,void 0)}},IHt=class extends gPe{constructor(){super({id:"workbench.action.quickOpenLeastRecentlyUsedEditorInGroup",title:P(4782,"Quick Open Least Recently Used Editor in Group"),f1:!0,keybinding:{weight:200,primary:3074,mac:{primary:1282}},precondition:Tpe.toNegated(),category:Fe.View},ER.PREFIX,3)}},yHt=class a extends z{static{this.ID="workbench.action.openPreviousEditorFromHistory"}constructor(){super({id:a.ID,title:P(4758,"Quick Open Previous Editor from History"),f1:!0})}async run(i){let e=i.get(Le),t=i.get($e),o=i.get(kt),n=e.lookupKeybindings(a.ID),r;o.activeGroup.count===0&&(r=1),t.quickAccess.show("",{quickNavigateConfiguration:{keybindings:n},itemActivation:r})}},wHt=class extends z{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditor",title:P(4775,"Open Next Recently Used Editor"),f1:!0,category:Fe.View})}async run(i){i.get(fa).openNextRecentlyUsedEditor()}},CHt=class extends z{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditor",title:P(4779,"Open Previous Recently Used Editor"),f1:!0,category:Fe.View})}async run(i){i.get(fa).openPreviouslyUsedEditor()}},xHt=class extends z{constructor(){super({id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:P(4776,"Open Next Recently Used Editor In Group"),f1:!0,category:Fe.View})}async run(i){let e=i.get(fa),t=i.get(kt);e.openNextRecentlyUsedEditor(t.activeGroup.id)}},kHt=class extends z{constructor(){super({id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:P(4780,"Open Previous Recently Used Editor In Group"),f1:!0,category:Fe.View})}async run(i){let e=i.get(fa),t=i.get(kt);e.openPreviouslyUsedEditor(t.activeGroup.id)}},EHt=class extends z{constructor(){super({id:"workbench.action.clearEditorHistoryWithoutConfirm",title:P(4684,"Clear Editor History without Confirmation"),f1:!0,precondition:zMt})}async run(i){i.get(fa).clear()}},THt=class extends z{constructor(){super({id:"workbench.action.clearEditorHistory",title:P(4683,"Clear Editor History"),f1:!0})}async run(i){let e=i.get(ct),t=i.get(fa),{confirmed:o}=await e.confirm({type:"warning",message:d(4694,null),detail:d(4693,null),primaryButton:d(4682,null)});o&&t.clear()}},_Ht=class extends Pp{constructor(){super({id:"workbench.action.moveEditorLeftInGroup",title:P(4740,"Move Editor Left"),keybinding:{weight:200,primary:3083,mac:{primary:Gi(2089,3087)}},f1:!0,category:Fe.View},BG,{to:"left"})}},DHt=class extends Pp{constructor(){super({id:"workbench.action.moveEditorRightInGroup",title:P(4741,"Move Editor Right"),keybinding:{weight:200,primary:3084,mac:{primary:Gi(2089,3089)}},f1:!0,category:Fe.View},BG,{to:"right"})}},RHt=class extends Pp{constructor(){super({id:"workbench.action.moveEditorToStart",title:P(4752,"Move Editor to Start"),f1:!0,category:Fe.View},BG,{to:"first"})}},LHt=class extends Pp{constructor(){super({id:"workbench.action.moveEditorToEnd",title:P(4744,"Move Editor to End"),f1:!0,category:Fe.View},BG,{to:"last"})}},MHt=class extends Pp{constructor(){super({id:"workbench.action.moveEditorToPreviousGroup",title:P(4750,"Move Editor into Previous Group"),keybinding:{weight:200,primary:2575,mac:{primary:2319}},f1:!0,category:Fe.View},BG,{to:"previous",by:"group"})}},PHt=class extends Pp{constructor(){super({id:"workbench.action.moveEditorToNextGroup",title:P(4749,"Move Editor into Next Group"),f1:!0,keybinding:{weight:200,primary:2577,mac:{primary:2321}},category:Fe.View},BG,{to:"next",by:"group"})}},AHt=class extends Pp{constructor(){super({id:QMe,title:P(4742,"Move Editor into Group Above"),f1:!0,category:Fe.View},QMe)}},NHt=class extends Pp{constructor(){super({id:YMe,title:P(4743,"Move Editor into Group Below"),f1:!0,category:Fe.View},YMe)}},OHt=class extends Pp{constructor(){super({id:XMe,title:P(4747,"Move Editor into Left Group"),f1:!0,category:Fe.View},XMe)}},FHt=class extends Pp{constructor(){super({id:JMe,title:P(4751,"Move Editor into Right Group"),f1:!0,category:Fe.View},JMe)}},WHt=class extends Pp{constructor(){super({id:"workbench.action.moveEditorToFirstGroup",title:P(4745,"Move Editor into First Group"),f1:!0,keybinding:{weight:200,primary:1558,mac:{primary:2326}},category:Fe.View},BG,{to:"first",by:"group"})}},VHt=class extends Pp{constructor(){super({id:"workbench.action.moveEditorToLastGroup",title:P(4746,"Move Editor into Last Group"),f1:!0,keybinding:{weight:200,primary:1566,mac:{primary:2334}},category:Fe.View},BG,{to:"last",by:"group"})}},BHt=class extends Pp{constructor(){super({id:"workbench.action.splitEditorToPreviousGroup",title:P(4808,"Split Editor into Previous Group"),f1:!0,category:Fe.View},HG,{to:"previous",by:"group"})}},HHt=class extends Pp{constructor(){super({id:"workbench.action.splitEditorToNextGroup",title:P(4807,"Split Editor into Next Group"),f1:!0,category:Fe.View},HG,{to:"next",by:"group"})}},UHt=class extends Pp{constructor(){super({id:"workbench.action.splitEditorToAboveGroup",title:P(4801,"Split Editor into Group Above"),f1:!0,category:Fe.View},HG,{to:"up",by:"group"})}},zHt=class extends Pp{constructor(){super({id:"workbench.action.splitEditorToBelowGroup",title:P(4802,"Split Editor into Group Below"),f1:!0,category:Fe.View},HG,{to:"down",by:"group"})}},KHt=class extends Pp{static{this.ID="workbench.action.splitEditorToLeftGroup"}static{this.LABEL=d(4805,null)}constructor(){super({id:"workbench.action.splitEditorToLeftGroup",title:P(4806,"Split Editor into Left Group"),f1:!0,category:Fe.View},HG,{to:"left",by:"group"})}},GHt=class extends Pp{constructor(){super({id:"workbench.action.splitEditorToRightGroup",title:P(4809,"Split Editor into Right Group"),f1:!0,category:Fe.View},HG,{to:"right",by:"group"})}},qHt=class extends Pp{constructor(){super({id:"workbench.action.splitEditorToFirstGroup",title:P(4803,"Split Editor into First Group"),f1:!0,category:Fe.View},HG,{to:"first",by:"group"})}},$Ht=class extends Pp{constructor(){super({id:"workbench.action.splitEditorToLastGroup",title:P(4804,"Split Editor into Last Group"),f1:!0,category:Fe.View},HG,{to:"last",by:"group"})}},Btt=class a extends Pp{static{this.ID="workbench.action.editorLayoutSingle"}constructor(){super({id:a.ID,title:P(4702,"Single Column Editor Layout"),f1:!0,category:Fe.View},UG,{groups:[{}],orientation:0})}},Htt=class a extends Pp{static{this.ID="workbench.action.editorLayoutTwoColumns"}constructor(){super({id:a.ID,title:P(4706,"Two Columns Editor Layout"),f1:!0,category:Fe.View},UG,{groups:[{},{}],orientation:0})}},Utt=class a extends Pp{static{this.ID="workbench.action.editorLayoutThreeColumns"}constructor(){super({id:a.ID,title:P(4703,"Three Columns Editor Layout"),f1:!0,category:Fe.View},UG,{groups:[{},{},{}],orientation:0})}},ztt=class a extends Pp{static{this.ID="workbench.action.editorLayoutTwoRows"}constructor(){super({id:a.ID,title:P(4708,"Two Rows Editor Layout"),f1:!0,category:Fe.View},UG,{groups:[{},{}],orientation:1})}},Ktt=class a extends Pp{static{this.ID="workbench.action.editorLayoutThreeRows"}constructor(){super({id:a.ID,title:P(4704,"Three Rows Editor Layout"),f1:!0,category:Fe.View},UG,{groups:[{},{},{}],orientation:1})}},Gtt=class a extends Pp{static{this.ID="workbench.action.editorLayoutTwoByTwoGrid"}constructor(){super({id:a.ID,title:P(4705,"Grid Editor Layout (2x2)"),f1:!0,category:Fe.View},UG,{groups:[{groups:[{},{}]},{groups:[{},{}]}],orientation:0})}},qtt=class a extends Pp{static{this.ID="workbench.action.editorLayoutTwoColumnsBottom"}constructor(){super({id:a.ID,title:P(4707,"Two Columns Bottom Editor Layout"),f1:!0,category:Fe.View},UG,{groups:[{},{groups:[{},{}]}],orientation:1})}},$tt=class a extends Pp{static{this.ID="workbench.action.editorLayoutTwoRowsRight"}constructor(){super({id:a.ID,title:P(4709,"Two Rows Right Editor Layout"),f1:!0,category:Fe.View},UG,{groups:[{},{groups:[{},{}]}],orientation:0})}},fPe=class extends z{constructor(e,t){super(e);this.direction=t}async run(e){let t=e.get(kt),o=e.get(wi),n=_m(),r=o.hasFocus("workbench.parts.editor")||n.activeElement===n.body,s=t.addGroup(t.activeGroup,this.direction);t.activateGroup(s),r&&s.focus()}},jHt=class extends fPe{constructor(){super({id:"workbench.action.newGroupLeft",title:P(4771,"New Editor Group to the Left"),f1:!0,category:Fe.View},2)}},QHt=class extends fPe{constructor(){super({id:"workbench.action.newGroupRight",title:P(4772,"New Editor Group to the Right"),f1:!0,category:Fe.View},3)}},YHt=class extends fPe{constructor(){super({id:"workbench.action.newGroupAbove",title:P(4769,"New Editor Group Above"),f1:!0,category:Fe.View},0)}},XHt=class extends fPe{constructor(){super({id:"workbench.action.newGroupBelow",title:P(4770,"New Editor Group Below"),f1:!0,category:Fe.View},1)}},JHt=class extends z{constructor(){super({id:"workbench.action.toggleEditorType",title:P(4810,"Toggle Editor Type"),f1:!0,category:Fe.View,precondition:A0})}async run(i){let e=i.get(ie),t=i.get(il),o=e.activeEditorPane;if(!o)return;let n=po.getCanonicalUri(o.input);if(!n)return;let r=t.getEditors(n).map(s=>s.id).filter(s=>s!==o.input.editorId);r.length!==0&&await e.replaceEditors([{editor:o.input,replacement:{resource:n,options:{override:r[0]}}}],o.group)}},jtt=class a extends Pp{static{this.ID="workbench.action.reopenTextEditor"}static{this.TITLE=P(4786,"Reopen Editor with Text Editor")}constructor(){super({id:a.ID,title:a.TITLE,f1:!0,category:Fe.View,precondition:A0},OEi,"default")}},ZHt=class extends z{constructor(e,t,o,n){super({id:e,title:t,category:Fe.View,precondition:Tr,keybinding:o,f1:!0});this.move=n}async run(e,...t){let o=e.get(kt),n=e.get(ie),r=e.get(Co),s=Zp(t,n,o,r);if(!s.groupedEditors.length)return;let l=await o.createAuxiliaryEditorPart(),{group:c,editors:u}=s.groupedEditors[0],p=see(c,u,s.preserveFocus);this.move?c.moveEditors(p,l.activeGroup):c.copyEditors(p,l.activeGroup),l.activeGroup.focus()}},eUt=class extends ZHt{constructor(){super(htt,{...P(4748,"Move Editor into New Window"),mnemonicTitle:d(4730,null)},void 0,!0)}},tUt=class extends ZHt{constructor(){super(gtt,{...P(4697,"Copy Editor into New Window"),mnemonicTitle:d(4727,null)},{primary:Gi(2089,45),weight:200},!1)}},iUt=class extends z{constructor(e,t,o){super({id:e,title:t,category:Fe.View,f1:!0});this.move=o}async run(e){let t=e.get(kt),o=t.activeGroup,n=await t.createAuxiliaryEditorPart();t.mergeGroup(o,n.activeGroup,{mode:this.move?1:0}),n.activeGroup.focus()}},oUt=class extends iUt{constructor(){super(jVt,{...P(4739,"Move Editor Group into New Window"),mnemonicTitle:d(4729,null)},!0)}},nUt=class extends iUt{constructor(){super(QVt,{...P(4696,"Copy Editor Group into New Window"),mnemonicTitle:d(4726,null)},!1)}},rUt=class extends z{constructor(){super({id:"workbench.action.restoreEditorsToMainWindow",title:{...P(4787,"Restore Editors into Main Window"),mnemonicTitle:d(4734,null)},f1:!0,precondition:ew,category:Fe.View})}async run(i){let e=i.get(kt);e.mergeAllGroups(e.mainPart.activeGroup)}},sUt=class extends z{constructor(){super({id:YVt,title:{...P(4768,"New Empty Editor Window"),mnemonicTitle:d(4731,null)},f1:!0,category:Fe.View})}async run(i){(await i.get(kt).createAuxiliaryEditorPart()).activeGroup.focus()}};var Lhe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.filesConfigurationService=e;this.hostService=t;this.editorService=o;this.editorGroupService=n;this.workingCopyService=r;this.logService=s;this.markerService=l;this.uriIdentityService=c;this.scheduledAutoSavesAfterDelay=new Map;this.lastActiveEditor=void 0;this.lastActiveGroupId=void 0;this.lastActiveEditorControlDisposable=this._register(new O);this.waitingOnConditionAutoSaveWorkingCopies=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.waitingOnConditionAutoSaveEditors=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));for(let u of this.workingCopyService.dirtyWorkingCopies)this.onDidRegister(u);this.registerListeners()}static{this.ID="workbench.contrib.editorAutoSave"}registerListeners(){this._register(this.hostService.onDidChangeFocus(e=>this.onWindowFocusChange(e))),this._register(this.hostService.onDidChangeActiveWindow(()=>this.onActiveWindowChange())),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.filesConfigurationService.onDidChangeAutoSaveConfiguration(()=>this.onDidChangeAutoSaveConfiguration())),this._register(this.workingCopyService.onDidRegister(e=>this.onDidRegister(e))),this._register(this.workingCopyService.onDidUnregister(e=>this.onDidUnregister(e))),this._register(this.workingCopyService.onDidChangeDirty(e=>this.onDidChangeDirty(e))),this._register(this.workingCopyService.onDidChangeContent(e=>this.onDidChangeContent(e))),this._register(this.markerService.onMarkerChanged(e=>this.onConditionChanged(e,3))),this._register(this.filesConfigurationService.onDidChangeAutoSaveDisabled(e=>this.onConditionChanged([e],4)))}onConditionChanged(e,t){for(let o of e){let n=this.waitingOnConditionAutoSaveWorkingCopies.get(o);if(n?.condition===t)n.workingCopy.isDirty()&&this.filesConfigurationService.getAutoSaveMode(n.workingCopy.resource,n.reason).mode!==0&&(this.discardAutoSave(n.workingCopy),this.logService.trace("[editor auto save] running auto save from condition change event",n.workingCopy.resource.toString(),n.workingCopy.typeId),n.workingCopy.save({reason:n.reason}));else{let r=this.waitingOnConditionAutoSaveEditors.get(o);r?.condition===t&&!r.editor.editor.isDisposed()&&r.editor.editor.isDirty()&&this.filesConfigurationService.getAutoSaveMode(r.editor.editor,r.reason).mode!==0&&(this.waitingOnConditionAutoSaveEditors.delete(o),this.logService.trace(`[editor auto save] running auto save from condition change event with reason ${r.reason}`),this.editorService.save(r.editor,{reason:r.reason}))}}}onWindowFocusChange(e){e||this.maybeTriggerAutoSave(4)}onActiveWindowChange(){this.maybeTriggerAutoSave(4)}onDidActiveEditorChange(){this.lastActiveEditor&&typeof this.lastActiveGroupId=="number"&&this.maybeTriggerAutoSave(3,{groupId:this.lastActiveGroupId,editor:this.lastActiveEditor});let e=this.editorGroupService.activeGroup,t=this.lastActiveEditor=e.activeEditor??void 0;this.lastActiveGroupId=e.id,this.lastActiveEditorControlDisposable.clear();let o=this.editorService.activeEditorPane;t&&o&&this.lastActiveEditorControlDisposable.add(o.onDidBlur(()=>{this.maybeTriggerAutoSave(3,{groupId:e.id,editor:t})}))}maybeTriggerAutoSave(e,t){if(t){if(!t.editor.isDirty()||t.editor.isReadonly()||t.editor.hasCapability(4))return;let o=this.filesConfigurationService.getAutoSaveMode(t.editor,e);o.mode!==0?(e===4&&(o.mode===3||o.mode===4)||e===3&&o.mode===3)&&(this.logService.trace(`[editor auto save] triggering auto save with reason ${e}`),this.editorService.save(t,{reason:e})):t.editor.resource&&(o.reason===3||o.reason===4)&&this.waitingOnConditionAutoSaveEditors.set(t.editor.resource,{editor:t,reason:e,condition:o.reason})}else this.saveAllDirtyAutoSaveables(e)}onDidChangeAutoSaveConfiguration(){let e;switch(this.filesConfigurationService.getAutoSaveMode(void 0).mode){case 3:e=3;break;case 4:e=4;break;case 1:case 2:e=2;break}e&&this.saveAllDirtyAutoSaveables(e)}saveAllDirtyAutoSaveables(e){for(let t of this.workingCopyService.dirtyWorkingCopies){if(t.capabilities&2)continue;let o=this.filesConfigurationService.getAutoSaveMode(t.resource,e);o.mode!==0?t.save({reason:e}):(o.reason===3||o.reason===4)&&this.waitingOnConditionAutoSaveWorkingCopies.set(t.resource,{workingCopy:t,reason:e,condition:o.reason})}}onDidRegister(e){e.isDirty()&&this.scheduleAutoSave(e)}onDidUnregister(e){this.discardAutoSave(e)}onDidChangeDirty(e){e.isDirty()?this.scheduleAutoSave(e):this.discardAutoSave(e)}onDidChangeContent(e){e.isDirty()&&this.scheduleAutoSave(e)}scheduleAutoSave(e){if(e.capabilities&2)return;let t=this.filesConfigurationService.getAutoSaveConfiguration(e.resource).autoSaveDelay;if(typeof t!="number")return;this.discardAutoSave(e),this.logService.trace(`[editor auto save] scheduling auto save after ${t}ms`,e.resource.toString(),e.typeId);let o=setTimeout(()=>{if(this.discardAutoSave(e),e.isDirty()){let n=2,r=this.filesConfigurationService.getAutoSaveMode(e.resource,n);r.mode!==0?(this.logService.trace("[editor auto save] running auto save",e.resource.toString(),e.typeId),e.save({reason:n})):(r.reason===3||r.reason===4)&&this.waitingOnConditionAutoSaveWorkingCopies.set(e.resource,{workingCopy:e,reason:n,condition:r.reason})}},t);this.scheduledAutoSavesAfterDelay.set(e,ee(()=>{this.logService.trace("[editor auto save] clearing pending auto save",e.resource.toString(),e.typeId),clearTimeout(o)}))}discardAutoSave(e){je(this.scheduledAutoSavesAfterDelay.get(e)),this.scheduledAutoSavesAfterDelay.delete(e),this.waitingOnConditionAutoSaveWorkingCopies.delete(e.resource),this.waitingOnConditionAutoSaveEditors.delete(e.resource)}};Lhe=I([m(0,fr),m(1,ti),m(2,ie),m(3,kt),m(4,$a),m(5,re),m(6,ha),m(7,gt)],Lhe);var Bu={Quickaccess:"workbench.contributions.quickaccess"},RTi=class{constructor(){this.providers=[];this.defaultProvider=void 0}registerQuickAccessProvider(i){return i.prefix.length===0?this.defaultProvider=i:this.providers.push(i),this.providers.sort((e,t)=>t.prefix.length-e.prefix.length),ee(()=>{this.providers.splice(this.providers.indexOf(i),1),this.defaultProvider===i&&(this.defaultProvider=void 0)})}getQuickAccessProviders(i){return ui([this.defaultProvider,...this.providers]).filter(e=>!e.when||i.contextMatchesRules(e.when))}getQuickAccessProvider(i,e){return(i?this.providers.find(o=>i.startsWith(o.prefix)&&(!o.when||e.contextMatchesRules(o.when))):void 0)||this.defaultProvider}clear(){let i=[...this.providers],e=this.defaultProvider;return this.providers=[],this.defaultProvider=void 0,()=>{this.providers=i,this.defaultProvider=e}}};oe.add(Bu.Quickaccess,new RTi);var TE=le("textEditorService"),LTi=class extends Error{constructor(i,e){super(i),this.name="FileEditorInputLeakError",this.stack=e}},YG=class extends k{constructor(e,t,o,n,r){super();this.untitledTextEditorService=e;this.instantiationService=t;this.uriIdentityService=o;this.fileService=n;this.editorResolverService=r;this.editorInputCache=new dt;this.fileEditorFactory=oe.as(en.EditorFactory).getFileEditorFactory();this.mapLeakToCounter=new Map;this.registerDefaultEditor()}registerDefaultEditor(){this._register(this.editorResolverService.registerEditor("*",{id:Da.id,label:Da.displayName,detail:Da.providerDisplayName,priority:"builtin"},{},{createEditorInput:e=>({editor:this.createTextEditor(e)}),createUntitledEditorInput:e=>({editor:this.createTextEditor(e)}),createDiffEditorInput:e=>({editor:this.createTextEditor(e)})}))}async resolveTextEditor(e){return this.createTextEditor(e)}createTextEditor(e){if(Xy(e))return this.createTextEditor(e.result);if(Ug(e)){let n=this.createTextEditor(e.original),r=this.createTextEditor(e.modified);return this.instantiationService.createInstance(Ba,e.label,e.description,n,r,void 0)}if(GD(e)){let n=this.createTextEditor(e.primary),r=this.createTextEditor(e.secondary);return this.instantiationService.createInstance(ja,e.label,e.description,r,n)}let t=e;if(t.forceUntitled||!t.resource||t.resource.scheme===Q.untitled){let n={languageId:t.languageId,initialValue:t.contents,encoding:t.encoding},r;return t.resource?.scheme===Q.untitled?r=this.untitledTextEditorService.create({untitledResource:t.resource,...n}):r=this.untitledTextEditorService.create({associatedResource:t.resource,...n}),this.createOrGetCached(r.resource,()=>this.instantiationService.createInstance(Jg,r))}let o=e;if(o.resource instanceof A){let n=o.label||Be(o.resource),r=o.resource,s=this.uriIdentityService.asCanonicalUri(r);return this.createOrGetCached(s,()=>o.forceFile||this.fileService.hasProvider(s)?this.fileEditorFactory.createFileEditor(s,r,o.label,o.description,o.encoding,o.languageId,o.contents,this.instantiationService):this.instantiationService.createInstance(Vx,s,o.label,o.description,o.languageId,o.contents),l=>{l instanceof Jg||(l instanceof Vx?(n&&l.setName(n),o.description&&l.setDescription(o.description),o.languageId&&l.setPreferredLanguageId(o.languageId),typeof o.contents=="string"&&l.setPreferredContents(o.contents)):(l.setPreferredResource(r),o.label&&l.setPreferredName(o.label),o.description&&l.setPreferredDescription(o.description),o.encoding&&l.setPreferredEncoding(o.encoding),o.languageId&&l.setPreferredLanguageId(o.languageId),typeof o.contents=="string"&&l.setPreferredContents(o.contents)))})}throw new Error(`ITextEditorService: Unable to create texteditor from ${JSON.stringify(e)}`)}createOrGetCached(e,t,o){let n=this.editorInputCache.get(e);if(n)return o?.(n),n;n=t(),this.editorInputCache.set(e,n);let r=this.trackLeaks(n);return U.once(n.onWillDispose)(()=>{this.editorInputCache.delete(e),r&&this.untrackLeaks(r)}),n}static{this.LEAK_TRACKING_THRESHOLD=256}static{this.LEAK_REPORTING_THRESHOLD=2*this.LEAK_TRACKING_THRESHOLD}static{this.LEAK_REPORTED=!1}trackLeaks(e){if(YG.LEAK_REPORTED||this.editorInputCache.size<YG.LEAK_TRACKING_THRESHOLD)return;let t=`${e.resource.scheme}#${e.typeId||"<no typeId>"}#${e.editorId||"<no editorId>"}
${new Error().stack?.split(`
`).slice(2).join(`
`)??""}`,o=(this.mapLeakToCounter.get(t)??0)+1;if(this.mapLeakToCounter.set(t,o),this.editorInputCache.size>YG.LEAK_REPORTING_THRESHOLD){YG.LEAK_REPORTED=!0;let[n,r]=Array.from(this.mapLeakToCounter.entries()).reduce(([l,c],[u,p])=>p>c?[u,p]:[l,c]),s=`Potential text editor input LEAK detected, having ${this.editorInputCache.size} text editor inputs already. Most frequent owner (${r})`;mt(new LTi(s,n))}return t}untrackLeaks(e){let t=(this.mapLeakToCounter.get(e)??1)-1;this.mapLeakToCounter.set(e,t),t===0&&this.mapLeakToCounter.delete(e)}};YG=I([m(0,yE),m(1,F),m(2,gt),m(3,ge),m(4,il)],YG);Ce(TE,YG,0);var vPe=class{constructor(i,e,t){this.filesConfigurationService=i;this.environmentService=e;this.pathService=t}canSerialize(i){return this.filesConfigurationService.isHotExitEnabled&&!i.isDisposed()}serialize(i){if(!this.canSerialize(i))return;let e=i,t=e.resource;e.hasAssociatedFilePath&&(t=Nf(t,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme));let o,n=e.getLanguageId();(n!==es||e.hasLanguageSetExplicitly)&&(o=n);let r={resourceJSON:t.toJSON(),modeId:o,encoding:e.getEncoding()};return JSON.stringify(r)}deserialize(i,e){return i.invokeFunction(t=>{let o=JSON.parse(e),n=A.revive(o.resourceJSON),r=o.modeId,s=o.encoding;return t.get(TE).createTextEditor({resource:n,languageId:r,encoding:s,forceUntitled:!0})})}};vPe=I([m(0,fr),m(1,Mt),m(2,Pn)],vPe);var Mhe=class extends k{constructor(e,t,o,n,r){super();this.environmentService=t;this.pathService=o;this.textEditorService=n;this.untitledTextEditorService=r;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.untitledTextEditorWorkingCopyEditorHandler"}handles(e){return e.resource.scheme===Q.untitled&&e.typeId===vN}isOpen(e,t){return this.handles(e)?ze(e.resource,t.resource):!1}createEditor(e){let t;return this.untitledTextEditorService.isUntitledWithAssociatedResource(e.resource)?t=Nf(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme):t=e.resource,this.textEditorService.createTextEditor({resource:t,forceUntitled:!0})}};Mhe=I([m(0,If),m(1,Mt),m(2,Pn),m(3,TE),m(4,yE)],Mhe);var DW=class extends k{constructor(e,t,o){super();this.editorResolverService=e;this.environmentService=o;this.configurationRegistry=oe.as($t.Configuration);(async()=>(await t.whenInstalledExtensionsRegistered(),this.updateDynamicEditorConfigurations(),this.registerListeners()))()}static{this.ID="workbench.contrib.dynamicEditorConfigurations"}static{this.AUTO_LOCK_DEFAULT_ENABLED=new Set(["terminalEditor","mainThreadWebview-simpleBrowser.view","mainThreadWebview-browserPreview","workbench.editor.processExplorer"])}static{this.AUTO_LOCK_EXTRA_EDITORS=[{id:"workbench.input.interactive",label:d(4844,null),priority:ome("builtin")},{id:"mainThreadWebview-markdown.preview",label:d(4846,null),priority:ome("builtin")},{id:"mainThreadWebview-simpleBrowser.view",label:d(4847,null),priority:ome("builtin")},{id:"mainThreadWebview-browserPreview",label:d(4845,null),priority:ome("builtin")}]}static{this.AUTO_LOCK_REMOVE_EDITORS=new Set(["vscode-interactive-input","interactive","vscode.markdown.preview.editor"])}registerListeners(){this._register(U.debounce(this.editorResolverService.onDidChangeEditorRegistrations,(e,t)=>t)(()=>this.updateDynamicEditorConfigurations()))}updateDynamicEditorConfigurations(){let e=[...this.editorResolverService.getEditors(),...DW.AUTO_LOCK_EXTRA_EDITORS].filter(p=>!DW.AUTO_LOCK_REMOVE_EDITORS.has(p.id)),t=this.editorResolverService.getEditors().filter(p=>p.priority.editor!=="exclusive").map(p=>p.id),o=Object.create(null);for(let p of e)o[p.id]={type:"boolean",default:DW.AUTO_LOCK_DEFAULT_ENABLED.has(p.id),description:p.label};let n=Object.create(null);for(let p of e)n[p.id]=DW.AUTO_LOCK_DEFAULT_ENABLED.has(p.id);let r=this.autoLockConfigurationNode;this.autoLockConfigurationNode={...jd,properties:{"workbench.editor.autoLockGroups":{type:"object",description:d(4848,null),properties:o,default:n,additionalProperties:!1}}};let s=this.defaultBinaryEditorConfigurationNode;this.defaultBinaryEditorConfigurationNode={...jd,properties:{"workbench.editor.defaultBinaryEditor":{type:"string",default:"",enum:[...t,""],description:d(4849,null)}}};let l=this.editorAssociationsConfigurationNode;this.editorAssociationsConfigurationNode={...jd,properties:{[iG]:{type:"object",markdownDescription:d(4842,null),patternProperties:{".*":{type:"string",enum:t}},agentsWindow:{default:OIi}}}};let c=this.diffEditorAssociationsConfigurationNode;this.diffEditorAssociationsConfigurationNode={...jd,properties:{[lee]:{type:"object",markdownDescription:d(4841,null),patternProperties:{".*":{type:"string",enum:t}}}}};let u=this.editorLargeFileConfirmationConfigurationNode;this.editorLargeFileConfirmationConfigurationNode={...jd,properties:{"workbench.editorLargeFileConfirmation":{type:"number",default:qyt(this.environmentService.remoteAuthority)/Ml.MB,minimum:1,scope:5,markdownDescription:d(4843,null)}}},this.configurationRegistry.updateConfigurations({add:[this.autoLockConfigurationNode,this.defaultBinaryEditorConfigurationNode,this.editorAssociationsConfigurationNode,this.diffEditorAssociationsConfigurationNode,this.editorLargeFileConfirmationConfigurationNode],remove:ui([r,s,l,c,u])})}};DW=I([m(0,il),m(1,lt),m(2,Mt)],DW);oe.as(en.EditorPane).registerEditorPane(os.create(G8,G8.ID,d(4671,null)),[new Vt(Jg),new Vt(Vx)]);oe.as(en.EditorPane).registerEditorPane(os.create(TR,TR.ID,d(4670,null)),[new Vt(Ba)]);oe.as(en.EditorPane).registerEditorPane(os.create(SU,SU.ID,d(4548,null)),[new Vt(Ba)]);oe.as(en.EditorPane).registerEditorPane(os.create(iv,iv.ID,d(4658,null)),[new Vt(ja)]);oe.as(en.EditorFactory).registerEditorSerializer(Jg.ID,vPe);oe.as(en.EditorFactory).registerEditorSerializer(ja.ID,aNt);oe.as(en.EditorFactory).registerEditorSerializer(Ba.ID,lNt);bt(Lhe.ID,Lhe,vt.BlockRestore);bt(Dhe.ID,Dhe,vt.BlockRestore);bt(Mhe.ID,Mhe,vt.BlockRestore);bt(DW.ID,DW,vt.BlockRestore);var MTi=oe.as(Bu.Quickaccess),lUt="inEditorsPicker",_fo=C.and(y_,C.has(lUt));MTi.registerQuickAccessProvider({ctor:ER,prefix:ER.PREFIX,contextKey:lUt,placeholder:d(4568,null),helpEntries:[{description:d(4545,null),commandId:Ftt.ID}]});MTi.registerQuickAccessProvider({ctor:hU,prefix:hU.PREFIX,contextKey:lUt,placeholder:d(4568,null),helpEntries:[{description:d(4546,null),commandId:Wtt.ID}]});MTi.registerQuickAccessProvider({ctor:WN,prefix:WN.PREFIX,contextKey:lUt,placeholder:d(4568,null),helpEntries:[{description:d(4547,null),commandId:Vtt.ID}]});W(Pte);W(hBt);W(gBt);W(mPe);W(hPe);W(iHt);W(oHt);W(nHt);W(rHt);W(sHt);W(aHt);W(wHt);W(CHt);W(xHt);W(kHt);W(Ntt);W(Ott);W(Wtt);W(Vtt);W(Ftt);W(Rhe);W(WBt);W(OBt);W(VBt);W(BBt);W(NBt);W(vBt);W(bBt);W(SBt);W(IBt);W(yBt);W(wBt);W(CBt);W(xBt);W(kBt);W(JBt);W(ZBt);W(eHt);W(tHt);W(YBt);W(XBt);W(_Ht);W(DHt);W(RHt);W(LHt);W(UBt);W(zBt);W(KBt);W(GBt);W(qBt);W($Bt);W(jBt);W(QBt);W(MHt);W(PHt);W(WHt);W(VHt);W(OHt);W(FHt);W(AHt);W(NHt);W(BHt);W(HHt);W(qHt);W($Ht);W(KHt);W(GHt);W(UHt);W(zHt);W(EBt);W(TBt);W(_Bt);W(RBt);W(DBt);W(LBt);W(MBt);W(PBt);W(ABt);W(jHt);W(QHt);W(YHt);W(XHt);W(lHt);W(cHt);W(dHt);W(uHt);W(pHt);W(mHt);W(hHt);W(gHt);W(fHt);W(THt);W(EHt);W(Btt);W(Htt);W(Utt);W(ztt);W(Ktt);W(Gtt);W($tt);W(qtt);W(JHt);W(jtt);W(vHt);W(bHt);W(SHt);W(IHt);W(yHt);W(eUt);W(tUt);W(oUt);W(nUt);W(rUt);W(sUt);var Efo="workbench.action.quickOpenNavigateNextInEditorPicker";xt.registerCommandAndKeybindingRule({id:Efo,weight:250,handler:xR(Efo,!0),when:_fo,primary:2050,mac:{primary:258}});var Tfo="workbench.action.quickOpenNavigatePreviousInEditorPicker";xt.registerCommandAndKeybindingRule({id:Tfo,weight:250,handler:xR(Tfo,!1),when:_fo,primary:3074,mac:{primary:1282}});Qgo();et&&(be.appendMenuItem(R.TouchBarContext,{command:{id:hPe.ID,title:hPe.LABEL,icon:{dark:In.asFileUri("vs/workbench/browser/parts/editor/media/back-tb.png")}},group:"navigation",order:0}),be.appendMenuItem(R.TouchBarContext,{command:{id:mPe.ID,title:mPe.LABEL,icon:{dark:In.asFileUri("vs/workbench/browser/parts/editor/media/forward-tb.png")}},group:"navigation",order:1}));be.appendMenuItem(R.EmptyEditorGroup,{command:{id:KVt,title:d(4578,null),icon:L.unlock},group:"navigation",order:10,when:C.and(Qf,o_.toNegated())});be.appendMenuItem(R.EmptyEditorGroup,{command:{id:W8,title:d(4678,null),icon:L.lock,toggled:C.true()},group:"navigation",order:10,when:o_});be.appendMenuItem(R.EmptyEditorGroup,{command:{id:HVt,title:d(4555,null),icon:L.close},group:"navigation",order:20,when:C.or(Qf,y3)});be.appendMenuItem(R.EmptyEditorGroupContext,{command:{id:B8,title:d(4667,null)},group:"2_split",order:10});be.appendMenuItem(R.EmptyEditorGroupContext,{command:{id:zG,title:d(4661,null)},group:"2_split",order:20});be.appendMenuItem(R.EmptyEditorGroupContext,{command:{id:H8,title:d(4665,null)},group:"2_split",order:30});be.appendMenuItem(R.EmptyEditorGroupContext,{command:{id:KG,title:d(4666,null)},group:"2_split",order:40});be.appendMenuItem(R.EmptyEditorGroupContext,{command:{id:YVt,title:d(4648,null)},group:"3_window",order:10});be.appendMenuItem(R.EmptyEditorGroupContext,{command:{id:zVt,title:d(4673,null),toggled:o_},group:"4_lock",order:10,when:Qf.toNegated()});be.appendMenuItem(R.EmptyEditorGroupContext,{command:{id:HVt,title:d(4549,null)},group:"5_close",order:10,when:qS});be.appendMenuItem(R.EditorTabsBarContext,{command:{id:B8,title:d(4667,null)},group:"2_split",order:10});be.appendMenuItem(R.EditorTabsBarContext,{command:{id:zG,title:d(4661,null)},group:"2_split",order:20});be.appendMenuItem(R.EditorTabsBarContext,{command:{id:H8,title:d(4665,null)},group:"2_split",order:30});be.appendMenuItem(R.EditorTabsBarContext,{command:{id:KG,title:d(4666,null)},group:"2_split",order:40});be.appendMenuItem(R.EditorTabsBarContext,{command:{id:jVt,title:d(4640,null)},group:"3_window",order:10});be.appendMenuItem(R.EditorTabsBarContext,{command:{id:QVt,title:d(4564,null)},group:"3_window",order:20});be.appendMenuItem(R.EditorTabsBarContext,{submenu:R.EditorTabsBarShowTabsSubmenu,title:d(4669,null),group:"4_config",order:10,when:Yf.negate()});be.appendMenuItem(R.EditorTabsBarShowTabsSubmenu,{command:{id:Yet.ID,title:d(4645,null),toggled:C.equals("config.workbench.editor.showTabs","multiple")},group:"1_config",order:10});be.appendMenuItem(R.EditorTabsBarShowTabsSubmenu,{command:{id:Xet.ID,title:d(4659,null),toggled:C.equals("config.workbench.editor.showTabs","single")},group:"1_config",order:20});be.appendMenuItem(R.EditorTabsBarShowTabsSubmenu,{command:{id:Qet.ID,title:d(4570,null),toggled:C.equals("config.workbench.editor.showTabs","none")},group:"1_config",order:30});be.appendMenuItem(R.EditorTabsBarContext,{submenu:R.EditorTabsBarShowTabsZenModeSubmenu,title:d(4669,null),group:"4_config",order:10,when:Yf});be.appendMenuItem(R.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:EMe.ID,title:d(4645,null),toggled:C.equals("config.zenMode.showTabs","multiple")},group:"1_config",order:10});be.appendMenuItem(R.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:TMe.ID,title:d(4659,null),toggled:C.equals("config.zenMode.showTabs","single")},group:"1_config",order:20});be.appendMenuItem(R.EditorTabsBarShowTabsZenModeSubmenu,{command:{id:kMe.ID,title:d(4570,null),toggled:C.equals("config.zenMode.showTabs","none")},group:"1_config",order:30});be.appendMenuItem(R.EditorTabsBarContext,{submenu:R.EditorActionsPositionSubmenu,title:d(4567,null),group:"4_config",order:20});be.appendMenuItem(R.EditorActionsPositionSubmenu,{command:{id:Zet.ID,title:d(4669,null),toggled:C.equals("config.workbench.editor.editorActionsLocation","default")},group:"1_config",order:10,when:C.equals("config.workbench.editor.showTabs","none").negate()});be.appendMenuItem(R.EditorActionsPositionSubmenu,{command:{id:Jet.ID,title:d(4672,null),toggled:C.or(C.equals("config.workbench.editor.editorActionsLocation","titleBar"),C.and(C.equals("config.workbench.editor.showTabs","none"),C.equals("config.workbench.editor.editorActionsLocation","default")))},group:"1_config",order:20});be.appendMenuItem(R.EditorActionsPositionSubmenu,{command:{id:ett.ID,title:d(4569,null),toggled:C.equals("config.workbench.editor.editorActionsLocation","hidden")},group:"1_config",order:30});be.appendMenuItem(R.EditorTabsBarContext,{command:{id:ttt.ID,title:d(4563,null)},group:"9_configure",order:10});be.appendMenuItem(R.EditorTitleContext,{command:{id:ok,title:d(4549,null)},group:"1_close",order:10});be.appendMenuItem(R.EditorTitleContext,{command:{id:$Me,title:d(4557,null),precondition:jMt.notEqualsTo("1")},group:"1_close",order:20});be.appendMenuItem(R.EditorTitleContext,{command:{id:BVt,title:d(4559,null),precondition:C.and(kpe.toNegated(),I3.negate())},group:"1_close",order:30,when:L2});be.appendMenuItem(R.EditorTitleContext,{command:{id:whe,title:d(4551,null)},group:"1_close",order:40});be.appendMenuItem(R.EditorTitleContext,{command:{id:F8,title:d(4550,null)},group:"1_close",order:50});be.appendMenuItem(R.EditorTitleContext,{command:{id:jMe,title:d(4654,null)},group:"1_open",order:10,when:A0});be.appendMenuItem(R.EditorTitleContext,{command:{id:UVt,title:d(4575,null),precondition:K_e.toNegated()},group:"3_preview",order:10,when:C.has("config.workbench.editor.enablePreview")});be.appendMenuItem(R.EditorTitleContext,{command:{id:GVt,title:d(4650,null)},group:"3_preview",order:20,when:NM.toNegated()});be.appendMenuItem(R.EditorTitleContext,{command:{id:V8,title:d(4680,null)},group:"3_preview",order:20,when:NM});be.appendMenuItem(R.EditorTitleContext,{command:{id:Ete,title:d(4666,null)},group:"5_split",order:10,when:Dpe.negate()});be.appendMenuItem(R.EditorTitleContext,{command:{id:Ete,title:d(4661,null)},group:"5_split",order:10,when:Dpe});be.appendMenuItem(R.EditorTitleContext,{submenu:R.EditorSplitMoveSubmenu,title:d(4660,null),group:"5_split",order:15});be.appendMenuItem(R.EditorTitleContext,{command:{id:htt,title:d(4644,null)},group:"7_new_window",order:10});be.appendMenuItem(R.EditorTitleContext,{command:{id:gtt,title:d(4566,null)},group:"7_new_window",order:20});be.appendMenuItem(R.EditorTitleContext,{submenu:R.EditorTitleContextShare,title:d(4656,null),group:"11_share",order:-1,when:I3.negate()});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:B8,title:d(4667,null)},group:"1_split",order:10});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:zG,title:d(4661,null)},group:"1_split",order:20});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:H8,title:d(4665,null)},group:"1_split",order:30});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:KG,title:d(4666,null)},group:"1_split",order:40});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:QMe,title:d(4638,null)},group:"2_move",order:10});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:YMe,title:d(4639,null)},group:"2_move",order:20});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:XMe,title:d(4642,null)},group:"2_move",order:30});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:JMe,title:d(4643,null)},group:"2_move",order:40});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:qVt,title:d(4664,null),precondition:I3.negate()},group:"3_split_in_group",order:10,when:wH});be.appendMenuItem(R.EditorSplitMoveSubmenu,{command:{id:$Vt,title:d(4573,null),precondition:I3.negate()},group:"3_split_in_group",order:10,when:Dx});be.appendMenuItem(R.EditorTitle,{command:{id:OVt,title:d(4572,null),toggled:C.equals("config.diffEditor.renderSideBySide",!1)},group:"1_diff",order:10,when:C.or(C.has("isInDiffEditor"),Epe)});be.appendMenuItem(R.EditorTitle,{command:{id:NEi,title:d(4657,null)},group:"3_open",order:10,when:vC.toNegated()});be.appendMenuItem(R.EditorTitle,{command:{id:F8,title:d(4550,null)},group:"5_close",order:10,when:vC.toNegated()});be.appendMenuItem(R.EditorTitle,{command:{id:whe,title:d(4551,null)},group:"5_close",order:20,when:vC.toNegated()});be.appendMenuItem(R.EditorTitle,{command:{id:AEi,title:d(4674,null),toggled:C.has("config.workbench.editor.enablePreview")},group:"7_settings",order:10,when:vC.toNegated()});be.appendMenuItem(R.EditorTitle,{command:{id:ZMe,title:d(4579,null)},group:"8_group_operations",order:5,when:C.and(CH.negate(),y3)});be.appendMenuItem(R.EditorTitle,{command:{id:ZMe,title:d(4679,null)},group:"8_group_operations",order:5,when:CH});be.appendMenuItem(R.EditorTitle,{command:{id:zVt,title:d(4577,null),toggled:o_},group:"8_group_operations",order:10,when:C.and(Qf.toNegated(),vC.toNegated())});be.appendMenuItem(R.EditorTitle,{command:{id:itt.ID,title:d(4562,null)},group:"9_configure",order:10,when:vC.toNegated()});function BN(a,i,e,t,o,n,r){let s={command:{id:a.id,title:a.title,icon:a.icon,toggled:a.toggled,precondition:o},group:"navigation",when:i,order:e};t&&(s.alt={id:t.id,title:t.title,icon:t.icon}),be.appendMenuItem(R.EditorTitle,s),n&&be.appendMenuItem(R.CompactWindowEditorTitle,s),r&&be.appendMenuItem(R.ModalEditorEditorTitle,s)}var PTi=1e5,bPe=1e6;BN({id:Ete,title:d(4663,null),icon:L.splitHorizontal},Dpe.negate(),PTi,{id:zG,title:d(4662,null),icon:L.splitVertical});BN({id:Ete,title:d(4662,null),icon:L.splitVertical},Dpe,PTi,{id:KG,title:d(4663,null),icon:L.splitHorizontal});BN({id:FEi,title:d(4675,null),icon:L.editorLayout},Dx,PTi-1);BN({id:ok,title:d(4549,null),icon:L.close},C.and(L2.toNegated(),xpe.toNegated(),NM.toNegated()),bPe,{id:F8,title:d(4550,null),icon:L.closeAll});BN({id:ok,title:d(4549,null),icon:L.closeDirty},C.and(L2.toNegated(),xpe,NM.toNegated()),bPe,{id:F8,title:d(4550,null),icon:L.closeAll});BN({id:V8,title:d(4680,null),icon:L.pinned},C.and(L2.toNegated(),xpe.toNegated(),NM),bPe,{id:ok,title:d(4549,null),icon:L.close});BN({id:V8,title:d(4680,null),icon:L.pinnedDirty},C.and(L2.toNegated(),xpe,NM),bPe,{id:ok,title:d(4549,null),icon:L.close});BN({id:KVt,title:d(4576,null),icon:L.unlock},C.and(Qf,o_.toNegated()),bPe-1);BN({id:W8,title:d(4677,null),icon:L.lock,toggled:C.true()},o_,bPe-1);var Fin=Oe("diff-editor-previous-change",L.arrowUp,d(4652,null));BN({id:WVt,title:d(4647,null),icon:Fin},GS,10,void 0,me.hasChanges,!0,!0);var Win=Oe("diff-editor-next-change",L.arrowDown,d(4649,null));BN({id:FVt,title:d(4646,null),icon:Win},GS,11,void 0,me.hasChanges,!0,!0);BN({id:VVt,title:d(4668,null),icon:L.arrowSwap},C.and(GS,G_e),15,void 0,void 0);BN({id:jtt.ID,title:d(4653,null),icon:L.fileCode},$Mt,16,void 0,void 0);var Vin=Oe("diff-editor-toggle-whitespace",L.whitespace,d(4676,null));be.appendMenuItem(R.EditorTitle,{command:{id:LEi,title:d(4571,null),icon:Vin,precondition:GS,toggled:C.equals("config.diffEditor.ignoreTrimWhitespace",!1)},group:"navigation",when:GS,order:20});be.appendMenuItem(R.CommandPalette,{command:{id:UVt,title:P(4574,"Keep Editor"),category:Fe.View},when:C.has("config.workbench.editor.enablePreview")});be.appendMenuItem(R.CommandPalette,{command:{id:GVt,title:P(4651,"Pin Editor"),category:Fe.View}});be.appendMenuItem(R.CommandPalette,{command:{id:V8,title:P(4681,"Unpin Editor"),category:Fe.View}});be.appendMenuItem(R.CommandPalette,{command:{id:ok,title:P(4552,"Close Editor"),category:Fe.View}});be.appendMenuItem(R.CommandPalette,{command:{id:PEi,title:P(4558,"Close Pinned Editor"),category:Fe.View}});be.appendMenuItem(R.CommandPalette,{command:{id:F8,title:P(4554,"Close All Editors in Group"),category:Fe.View}});be.appendMenuItem(R.CommandPalette,{command:{id:whe,title:P(4561,"Close Saved Editors in Group"),category:Fe.View}});be.appendMenuItem(R.CommandPalette,{command:{id:$Me,title:P(4556,"Close Other Editors in Group"),category:Fe.View}});be.appendMenuItem(R.CommandPalette,{command:{id:BVt,title:P(4560,"Close Editors to the Right in Group"),category:Fe.View},when:kpe.toNegated()});be.appendMenuItem(R.CommandPalette,{command:{id:mtt,title:P(4553,"Close Editor Group"),category:Fe.View},when:qS});be.appendMenuItem(R.CommandPalette,{command:{id:jMe,title:P(4655,"Reopen Editor With..."),category:Fe.View},when:A0});be.appendMenuItem(R.MenubarRecentMenu,{group:"1_editor",command:{id:Ntt.ID,title:d(4607,null),precondition:C.has("canReopenClosedEditor")},order:1});be.appendMenuItem(R.MenubarRecentMenu,{group:"z_clear",command:{id:Ott.ID,title:d(4580,null)},order:1});be.appendMenuItem(R.MenubarFileMenu,{title:d(4609,null),submenu:R.MenubarShare,group:"45_share",order:1,when:qo.negate()});be.appendMenuItem(R.MenubarViewMenu,{group:"2_appearance",title:d(4582,null),submenu:R.MenubarLayoutMenu,order:2,when:qo.negate()});be.appendMenuItem(R.MenubarLayoutMenu,{group:"1_split",command:{id:B8,title:{...P(4621,"Split Up"),mnemonicTitle:d(4620,null)}},order:1});be.appendMenuItem(R.MenubarLayoutMenu,{group:"1_split",command:{id:zG,title:{...P(4613,"Split Down"),mnemonicTitle:d(4612,null)}},order:2});be.appendMenuItem(R.MenubarLayoutMenu,{group:"1_split",command:{id:H8,title:{...P(4617,"Split Left"),mnemonicTitle:d(4616,null)}},order:3});be.appendMenuItem(R.MenubarLayoutMenu,{group:"1_split",command:{id:KG,title:{...P(4619,"Split Right"),mnemonicTitle:d(4618,null)}},order:4});be.appendMenuItem(R.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:qVt,title:{...P(4615,"Split in Group"),mnemonicTitle:d(4614,null)}},when:wH,order:1});be.appendMenuItem(R.MenubarLayoutMenu,{group:"2_split_in_group",command:{id:$Vt,title:{...P(4594,"Join in Group"),mnemonicTitle:d(4593,null)}},when:Dx,order:1});be.appendMenuItem(R.MenubarLayoutMenu,{group:"3_new_window",command:{id:htt,title:{...P(4641,"Move Editor into New Window"),mnemonicTitle:d(4596,null)}},order:1});be.appendMenuItem(R.MenubarLayoutMenu,{group:"3_new_window",command:{id:gtt,title:{...P(4565,"Copy Editor into New Window"),mnemonicTitle:d(4581,null)}},order:2});be.appendMenuItem(R.MenubarLayoutMenu,{group:"4_layouts",command:{id:Btt.ID,title:{...P(4611,"Single"),mnemonicTitle:d(4610,null)}},order:1});be.appendMenuItem(R.MenubarLayoutMenu,{group:"4_layouts",command:{id:Htt.ID,title:{...P(4633,"Two Columns"),mnemonicTitle:d(4632,null)}},order:3});be.appendMenuItem(R.MenubarLayoutMenu,{group:"4_layouts",command:{id:Utt.ID,title:{...P(4625,"Three Columns"),mnemonicTitle:d(4624,null)}},order:4});be.appendMenuItem(R.MenubarLayoutMenu,{group:"4_layouts",command:{id:ztt.ID,title:{...P(4635,"Two Rows"),mnemonicTitle:d(4634,null)}},order:5});be.appendMenuItem(R.MenubarLayoutMenu,{group:"4_layouts",command:{id:Ktt.ID,title:{...P(4627,"Three Rows"),mnemonicTitle:d(4626,null)}},order:6});be.appendMenuItem(R.MenubarLayoutMenu,{group:"4_layouts",command:{id:Gtt.ID,title:{...P(4629,"Grid (2x2)"),mnemonicTitle:d(4628,null)}},order:7});be.appendMenuItem(R.MenubarLayoutMenu,{group:"4_layouts",command:{id:$tt.ID,title:{...P(4637,"Two Rows Right"),mnemonicTitle:d(4636,null)}},order:8});be.appendMenuItem(R.MenubarLayoutMenu,{group:"4_layouts",command:{id:qtt.ID,title:{...P(4631,"Two Columns Bottom"),mnemonicTitle:d(4630,null)}},order:9});be.appendMenuItem(R.MenubarGoMenu,{group:"1_history_nav",command:{id:"workbench.action.navigateToLastEditLocation",title:d(4595,null),precondition:C.has("canNavigateToLastEditLocation")},order:3});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:WEi,title:d(4583,null)},when:C.or(Dx,GS),order:1});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"1_sideBySide",command:{id:VEi,title:d(4608,null)},when:C.or(Dx,GS),order:2});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.nextEditor",title:d(4597,null)},order:1});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"2_any",command:{id:"workbench.action.previousEditor",title:d(4602,null)},order:2});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openNextRecentlyUsedEditor",title:d(4600,null)},order:1});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"3_any_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditor",title:d(4605,null)},order:2});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.nextEditorInGroup",title:d(4598,null)},order:1});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"4_group",command:{id:"workbench.action.previousEditorInGroup",title:d(4603,null)},order:2});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openNextRecentlyUsedEditorInGroup",title:d(4601,null)},order:1});be.appendMenuItem(R.MenubarSwitchEditorMenu,{group:"5_group_used",command:{id:"workbench.action.openPreviousRecentlyUsedEditorInGroup",title:d(4606,null)},order:2});be.appendMenuItem(R.MenubarGoMenu,{group:"2_editor_nav",title:d(4622,null),submenu:R.MenubarSwitchEditorMenu,order:1});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFirstEditorGroup",title:d(4587,null)},order:1});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusSecondEditorGroup",title:d(4591,null)},order:2});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusThirdEditorGroup",title:d(4592,null),precondition:qS},order:3});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFourthEditorGroup",title:d(4588,null),precondition:qS},order:4});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"1_focus_index",command:{id:"workbench.action.focusFifthEditorGroup",title:d(4586,null),precondition:qS},order:5});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusNextGroup",title:d(4599,null),precondition:qS},order:1});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"2_next_prev",command:{id:"workbench.action.focusPreviousGroup",title:d(4604,null),precondition:qS},order:2});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusLeftGroup",title:d(4589,null),precondition:qS},order:1});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusRightGroup",title:d(4590,null),precondition:qS},order:2});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusAboveGroup",title:d(4584,null),precondition:qS},order:3});be.appendMenuItem(R.MenubarSwitchGroupMenu,{group:"3_directional",command:{id:"workbench.action.focusBelowGroup",title:d(4585,null),precondition:qS},order:4});be.appendMenuItem(R.MenubarGoMenu,{group:"2_editor_nav",title:d(4623,null),submenu:R.MenubarSwitchGroupMenu,order:2});Peo(Dwt);var k_=class extends V3{constructor(e,t,o,n,r){super(e,o,n);this.options=t;this.layoutService=r;this._onDidVisibilityChange=this._register(new T);this.onDidVisibilityChange=this._onDidVisibilityChange.event;this._onDidChange=this._register(new T);this._register(r.registerPart(this))}get dimension(){return this._dimension}get contentPosition(){return this._contentPosition}onThemeChange(e){this.parent&&super.onThemeChange(e)}create(e,t){this.parent=e,this.titleArea=this.createTitleArea(e,t),this.contentArea=this.createContentArea(e,t),this.partLayout=new ATi(this.options,this.contentArea),this.updateStyles()}getContainer(){return this.parent}createTitleArea(e,t){}createContentArea(e,t){}setHeaderArea(e){if(this.headerArea)throw new Error("Header already exists");!this.parent||!this.titleArea||(CI(this.parent,e),e.classList.add("header-or-footer"),e.classList.add("header"),this.headerArea=e,this.partLayout?.setHeaderVisibility(!0),this.relayout())}setFooterArea(e){if(this.footerArea)throw new Error("Footer already exists");!this.parent||!this.titleArea||(this.parent.appendChild(e),e.classList.add("header-or-footer"),e.classList.add("footer"),this.footerArea=e,this.partLayout?.setFooterVisibility(!0),this.relayout())}removeHeaderArea(){this.headerArea&&(this.headerArea.remove(),this.headerArea=void 0,this.partLayout?.setHeaderVisibility(!1),this.relayout())}removeFooterArea(){this.footerArea&&(this.footerArea.remove(),this.footerArea=void 0,this.partLayout?.setFooterVisibility(!1),this.relayout())}relayout(){this.dimension&&this.contentPosition&&this.layout(this.dimension.width,this.dimension.height,this.contentPosition.top,this.contentPosition.left)}layoutContents(e,t){return Ti(this.partLayout).layout(e,t)}get onDidChange(){return this._onDidChange.event}layout(e,t,o,n){this._dimension=new di(e,t),this._contentPosition={top:o,left:n}}setVisible(e){this._onDidVisibilityChange.fire(e)}},ATi=class a{constructor(i,e){this.options=i;this.contentArea=e;this.headerVisible=!1;this.footerVisible=!1}static{this.HEADER_HEIGHT=35}static{this.TITLE_HEIGHT=35}static{this.Footer_HEIGHT=35}layout(i,e){let t;this.options.hasTitle?t=new di(i,Math.min(e,a.TITLE_HEIGHT)):t=di.None;let o;this.headerVisible?o=new di(i,Math.min(e,a.HEADER_HEIGHT)):o=di.None;let n;this.footerVisible?n=new di(i,Math.min(e,a.Footer_HEIGHT)):n=di.None;let r=i;this.options&&typeof this.options.borderWidth=="function"&&(r-=this.options.borderWidth());let s=new di(r,e-t.height-o.height-n.height);return this.contentArea&&PL(this.contentArea,s.width,s.height),{headerSize:o,titleSize:t,contentSize:s,footerSize:n}}setFooterVisibility(i){this.footerVisible=i}setHeaderVisibility(i){this.headerVisible=i}},Fte=class extends V3{constructor(){super(...arguments);this._parts=new Set}get parts(){return Array.from(this._parts)}registerPart(e){return this._parts.add(e),ee(()=>this.unregisterPart(e))}unregisterPart(e){this._parts.delete(e)}getPart(e){return this.getPartByDocument(e.ownerDocument)}getPartByDocument(e){if(this._parts.size>1){for(let t of this._parts)if(t.element?.ownerDocument===e)return t}return this.mainPart}get activePart(){return this.getPartByDocument(_m())}};var SPe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editorGroupParent=e;this.editorPanesParent=t;this.groupView=o;this.layoutService=n;this.instantiationService=r;this.workspaceTrustService=l;this.logService=c;this.dialogService=u;this.hostService=p;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidChangeSizeConstraints=this._register(new T);this.onDidChangeSizeConstraints=this._onDidChangeSizeConstraints.event;this._activeEditorPane=null;this.editorPanes=[];this.mapEditorPaneToPendingSetInput=new Map;this.activeEditorPaneDisposables=this._register(new O);this.editorPanesRegistry=oe.as(en.EditorPane);this.editorOperation=this._register(new uke(s)),this.registerListeners()}get minimumWidth(){return this._activeEditorPane?.minimumWidth??c_.width}get minimumHeight(){return this._activeEditorPane?.minimumHeight??c_.height}get maximumWidth(){return this._activeEditorPane?.maximumWidth??B3.width}get maximumHeight(){return this._activeEditorPane?.maximumHeight??B3.height}get activeEditorPane(){return this._activeEditorPane}registerListeners(){this._register(this.workspaceTrustService.onDidChangeTrust(()=>this.onDidChangeWorkspaceTrust()))}onDidChangeWorkspaceTrust(){let e=this._activeEditorPane?.input,t=this._activeEditorPane?.options;e?.hasCapability(16)&&this.groupView.openEditor(e,t)}async openEditor(e,t,o,n=Object.create(null)){try{return await this.doOpenEditor(this.getEditorPaneDescriptor(e),e,t,o,n)}catch(r){return t?.ignoreError?{error:r}:this.doShowError(r,e,t,o,n)}}async doShowError(e,t,o,n,r){this.logService.error(e);let s=!1;if(o?.source===1&&(!v3(e)||e.allowDialog)&&(s=await this.doShowErrorDialog(e,t)),s)return{error:e};let l={...o};return Yi(e)||(l.error=e),{...await this.doOpenEditor(Mte.DESCRIPTOR,t,l,n,r),error:e}}async doShowErrorDialog(e,t){let o=wt.Error,n,r=Mn(e),s;v3(e)&&(s=e.actions,o=e.forceSeverity??wt.Error,e.forceMessage&&(n=e.message,r=void 0)),n||(n=d(4870,null,t.getName()));let l=[];if(s&&s.length>0)for(let h of s)l.push({label:h.label,run:()=>h});else l.push({label:d(4871,null),run:()=>{}});let c;l.length===1&&(c={run:()=>{u=!0}});let u=!1,{result:p}=await this.dialogService.prompt({type:o,message:n,detail:r,buttons:l,cancelButton:c});if(p){let h=p.run();h instanceof Promise&&h.catch(g=>this.dialogService.error(Mn(g))),u=!0}return u}async doOpenEditor(e,t,o,n,r=Object.create(null)){let s=this.doShowEditorPane(e),l=Un(),{changed:c,cancelled:u}=await this.doSetInput(s,t,o,r);return u||(!o?.preserveFocus&&this.shouldRestoreFocus(l)?s.focus():n?.preserveWindowOrder||this.hostService.moveTop(gv(this.groupView.windowId,!0).window)),{pane:s,changed:c,cancelled:u}}shouldRestoreFocus(e){if(!this.layoutService.isRestored()||!e)return!0;let t=Un();return!!(!t||t===e.ownerDocument.body||e===t||!Ch(t)||ms(t,this.editorGroupParent))}getEditorPaneDescriptor(e){return e.hasCapability(16)&&!this.workspaceTrustService.isWorkspaceTrusted()?q8.DESCRIPTOR:Ti(this.editorPanesRegistry.getEditorPane(e))}doShowEditorPane(e){if(this._activeEditorPane&&e.describes(this._activeEditorPane))return this._activeEditorPane;this.doHideActiveEditorPane();let t=this.doCreateEditorPane(e);this.doSetActiveEditorPane(t);let o=Ti(t.getContainer());return this.editorPanesParent.appendChild(o),Xo(o),t.setVisible(!0),this.pagePosition&&t.layout(new di(this.pagePosition.width,this.pagePosition.height),{top:this.pagePosition.top,left:this.pagePosition.left}),this.boundarySashes&&t.setBoundarySashes(this.boundarySashes),t}doCreateEditorPane(e){let t=this.doInstantiateEditorPane(e);if(!t.getContainer()){let o=_(".editor-instance");this.editorPanesParent.appendChild(o);try{t.create(o)}catch(n){throw o.remove(),Wi(o),n}}return t}doInstantiateEditorPane(e){let t=this.editorPanes.find(n=>e.describes(n));if(t)return t;let o=this._register(e.instantiate(this.instantiationService,this.groupView));return this.editorPanes.push(o),o}doSetActiveEditorPane(e){this._activeEditorPane=e,this.activeEditorPaneDisposables.clear(),e&&(this.activeEditorPaneDisposables.add(e.onDidChangeSizeConstraints(t=>this._onDidChangeSizeConstraints.fire(t))),this.activeEditorPaneDisposables.add(e.onDidFocus(()=>this._onDidFocus.fire()))),this._onDidChangeSizeConstraints.fire(void 0)}async doSetInput(e,t,o,n){let r=e.input?.matches(t);if(r&&!o?.forceReload)return this.mapEditorPaneToPendingSetInput.has(e)&&await this.mapEditorPaneToPendingSetInput.get(e),r=e.input?.matches(t),r&&e.setOptions(o),{changed:!1,cancelled:!r};let s=this.editorOperation.start(this.layoutService.isRestored()?800:3200),l=!1;try{e.clearInput();let c=e.setInput(t,o,n,s.token);this.mapEditorPaneToPendingSetInput.set(e,c),await c,s.isCurrent()||(l=!0)}catch(c){if(!s.isCurrent())l=!0;else throw c}finally{s.isCurrent()&&this.mapEditorPaneToPendingSetInput.delete(e),s.stop()}return{changed:!r,cancelled:l}}doHideActiveEditorPane(){if(!this._activeEditorPane)return;this.editorOperation.stop(),this.safeRun(()=>this._activeEditorPane?.clearInput()),this.safeRun(()=>this._activeEditorPane?.setVisible(!1)),this.mapEditorPaneToPendingSetInput.delete(this._activeEditorPane);let e=this._activeEditorPane.getContainer();e&&(e.remove(),Wi(e)),this.doSetActiveEditorPane(null)}closeEditor(e){this._activeEditorPane?.input&&e.matches(this._activeEditorPane.input)&&this.doHideActiveEditorPane()}setVisible(e){this.safeRun(()=>this._activeEditorPane?.setVisible(e))}layout(e){this.pagePosition=e,this.safeRun(()=>this._activeEditorPane?.layout(new di(e.width,e.height),e))}setBoundarySashes(e){this.boundarySashes=e,this.safeRun(()=>this._activeEditorPane?.setBoundarySashes(e))}safeRun(e){try{e()}catch(t){this.logService.error(t)}}};SPe=I([m(3,wi),m(4,F),m(5,Hd),m(6,Or),m(7,re),m(8,ct),m(9,ti)],SPe);var Dfo=C.and(C.equals("chatSetupHidden",!1),C.equals("chatSetupDisabledInWorkspace",!1)),Bin={text:d(4860,null),id:"workbench.action.chat.open",when:{native:Dfo,web:Dfo}},Hin={text:d(4867,null),id:"workbench.action.showCommands"},Uin={text:d(4866,null),id:"workbench.action.quickOpen"},zin={text:d(4861,null),id:"workbench.action.files.openFile"},Kin={text:d(4863,null),id:"workbench.action.files.openFolder"},Gin={text:d(4862,null),id:"workbench.action.files.openFileFolder"},qin={text:d(4864,null),id:"workbench.action.openRecent"},$in={text:d(4859,null),id:"workbench.action.files.newUntitledFile"},jin={text:d(4858,null),id:"workbench.action.findInFiles"},Qin={text:d(4869,null),id:"workbench.action.terminal.toggleTerminal",when:{web:C.equals("terminalProcessSupported",!0)}},Yin={text:d(4868,null),id:"workbench.action.debug.start",when:{web:C.equals("terminalProcessSupported",!0)}},Xin={text:d(4865,null),id:"workbench.action.openSettings"},Pfo=[Bin,Hin],Rfo=ui([...Pfo,qin,...et&&!Ft?[Gin]:[zin,Kin],et&&!Ft?$in:void 0]),Lfo=[...Pfo],Mfo=[Uin,jin,Yin,Qin,Xin],rP=class extends k{constructor(e,t,o,n,r,s){super();this.keybindingService=t;this.contextService=o;this.contextKeyService=n;this.configurationService=r;this.storageService=s;this.transientDisposables=this._register(new O);this.keybindingLabels=this._register(new O);this.enabled=!1;this.cachedWhen=this.storageService.getObject(rP.CACHED_WHEN,0,Object.create(null)),this.workbenchState=this.contextService.getWorkbenchState();let l=st(".editor-group-watermark",[st(".watermark-container",[st(".letterpress"),st(".shortcuts@shortcuts")])]);D(e,l.root),this.shortcuts=l.shortcuts,this.registerListeners(),this.render()}static{this.CACHED_WHEN="editorGroupWatermark.whenConditions"}static{this.SETTINGS_KEY="workbench.tips.enabled"}static{this.MINIMUM_ENTRIES=3}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(rP.SETTINGS_KEY)&&this.enabled!==this.configurationService.getValue(rP.SETTINGS_KEY)&&this.render()})),this._register(this.contextService.onDidChangeWorkbenchState(e=>{this.workbenchState!==e&&(this.workbenchState=e,this.render())})),this._register(this.storageService.onWillSaveState(e=>{if(e.reason===1){let t=[...Rfo,...Lfo,...Mfo];for(let o of t){let n=Ft?o.when?.web:o.when?.native;n&&(this.cachedWhen[o.id]=this.contextKeyService.contextMatchesRules(n))}this.storageService.store(rP.CACHED_WHEN,JSON.stringify(this.cachedWhen),0,1)}}))}render(){if(this.enabled=this.configurationService.getValue(rP.SETTINGS_KEY),St(this.shortcuts),this.transientDisposables.clear(),!this.enabled)return;let e=this.filterEntries(this.workbenchState!==1?Lfo:Rfo);if(e.length<rP.MINIMUM_ENTRIES){let n=this.filterEntries(Mfo);nY(n),e.push(...n.slice(0,rP.MINIMUM_ENTRIES-e.length))}let t=D(this.shortcuts,_(".watermark-box")),o=()=>{St(t),this.keybindingLabels.clear();for(let n of e){let r=this.keybindingService.lookupKeybinding(n.id);if(!r)continue;let s=D(t,_("dl")),l=D(s,_("dt"));l.textContent=n.text;let c=D(s,_("dd"));this.keybindingLabels.add(new ah(c,Ao,{renderUnboundKeybindings:!0,...qk})).set(r)}};o(),this.transientDisposables.add(this.keybindingService.onDidUpdateKeybindings(o))}filterEntries(e){return e.filter(o=>{if(this.cachedWhen[o.id])return!0;let n=Ft?o.when?.web:o.when?.native;return!n||this.contextKeyService.contextMatchesRules(n)}).filter(o=>!!Ge.getCommand(o.id)).filter(o=>!!this.keybindingService.lookupKeybinding(o.id))}};rP=I([m(1,Le),m(2,Ae),m(3,X),m(4,B),m(5,de)],rP);var Wte=class{},RW=class{constructor(i,e,t=1,o,n){this._disposables=new O;this._onDidSelectItem=new T;this._onDidFocusItem=new T;this._onDidChangeFocus=new T;this.onDidSelectItem=this._onDidSelectItem.event;this.onDidFocusItem=this._onDidFocusItem.event;this.onDidChangeFocus=this._onDidChangeFocus.event;this._items=new Array;this._nodes=new Array;this._freeNodes=new Array;this._enabled=!0;this._focusedItemIdx=-1;this._selectedItemIdx=-1;this._domNode=document.createElement("div"),this._domNode.className="monaco-breadcrumbs",this._domNode.tabIndex=0,this._domNode.setAttribute("role","list"),this._scrollable=new Ar(this._domNode,{vertical:2,horizontal:t,horizontalScrollbarSize:e,useShadows:!1,scrollYToX:!0}),this._separatorIcon=o,this._disposables.add(this._scrollable),this._disposables.add(Yo(this._domNode,"click",l=>this._onClick(l))),i.appendChild(this._scrollable.getDomNode());let r=Pr(this._domNode);this._style(r,n);let s=nr(this._domNode);this._disposables.add(s),this._disposables.add(s.onDidBlur(l=>this._onDidChangeFocus.fire(!1))),this._disposables.add(s.onDidFocus(l=>this._onDidChangeFocus.fire(!0)))}setHorizontalScrollbarSize(i){this._scrollable.updateOptions({horizontalScrollbarSize:i})}setHorizontalScrollbarVisibility(i){this._scrollable.updateOptions({horizontal:i})}dispose(){this._disposables.dispose(),this._pendingLayout?.dispose(),this._pendingDimLayout?.dispose(),this._onDidSelectItem.dispose(),this._onDidFocusItem.dispose(),this._onDidChangeFocus.dispose(),this._domNode.remove(),this._nodes.length=0,this._freeNodes.length=0}layout(i){i&&di.equals(i,this._dimension)||(i?(this._pendingDimLayout?.dispose(),this._pendingDimLayout=this._updateDimensions(i)):(this._pendingLayout?.dispose(),this._pendingLayout=this._updateScrollbar()))}_updateDimensions(i){let e=new O;return e.add(wY(Me(this._domNode),()=>{this._dimension=i,this._domNode.style.width=`${i.width}px`,this._domNode.style.height=`${i.height}px`,e.add(this._updateScrollbar())})),e}_updateScrollbar(){return xoi(Me(this._domNode),()=>{xoi(Me(this._domNode),()=>{this._scrollable.setRevealOnScroll(!1),this._scrollable.scanDomNode(),this._scrollable.setRevealOnScroll(!0)})})}_style(i,e){let t="";e.breadcrumbsBackground&&(t+=`.monaco-breadcrumbs { background-color: ${e.breadcrumbsBackground}}`),e.breadcrumbsForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item { color: ${e.breadcrumbsForeground}}
`),e.breadcrumbsFocusForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item.focused { color: ${e.breadcrumbsFocusForeground}}
`),e.breadcrumbsFocusAndSelectionForeground&&(t+=`.monaco-breadcrumbs .monaco-breadcrumb-item.focused.selected { color: ${e.breadcrumbsFocusAndSelectionForeground}}
`),e.breadcrumbsHoverForeground&&(t+=`.monaco-breadcrumbs:not(.disabled	) .monaco-breadcrumb-item:hover:not(.focused):not(.selected) { color: ${e.breadcrumbsHoverForeground}}
`),i.textContent=t}setEnabled(i){this._enabled=i,this._domNode.classList.toggle("disabled",!this._enabled)}domFocus(){let i=this._focusedItemIdx>=0?this._focusedItemIdx:this._items.length-1;i>=0&&i<this._items.length?this._focus(i,void 0):this._domNode.focus()}isDOMFocused(){return Is(this._domNode)}getFocused(){return this._items[this._focusedItemIdx]}setFocused(i,e){this._focus(this._items.indexOf(i),e)}focusPrev(i){this._focusedItemIdx>0&&this._focus(this._focusedItemIdx-1,i)}focusNext(i){this._focusedItemIdx+1<this._nodes.length&&this._focus(this._focusedItemIdx+1,i)}_focus(i,e){this._focusedItemIdx=-1;for(let t=0;t<this._nodes.length;t++){let o=this._nodes[t];t!==i?o.classList.remove("focused"):(this._focusedItemIdx=t,o.classList.add("focused"),o.focus())}this._reveal(this._focusedItemIdx,!0),this._onDidFocusItem.fire({type:"focus",item:this._items[this._focusedItemIdx],node:this._nodes[this._focusedItemIdx],payload:e})}reveal(i){let e=this._items.indexOf(i);e>=0&&this._reveal(e,!1)}revealLast(){this._reveal(this._items.length-1,!1)}_reveal(i,e){if(i<0||i>=this._nodes.length)return;let t=this._nodes[i];if(!t)return;let{width:o}=this._scrollable.getScrollDimensions(),{scrollLeft:n}=this._scrollable.getScrollPosition();(!e||t.offsetLeft>n+o||t.offsetLeft<n)&&(this._scrollable.setRevealOnScroll(!1),this._scrollable.setScrollPosition({scrollLeft:t.offsetLeft}),this._scrollable.setRevealOnScroll(!0))}getSelection(){return this._items[this._selectedItemIdx]}setSelection(i,e){this._select(this._items.indexOf(i),e)}_select(i,e){this._selectedItemIdx=-1;for(let t=0;t<this._nodes.length;t++){let o=this._nodes[t];t!==i?o.classList.remove("selected"):(this._selectedItemIdx=t,o.classList.add("selected"))}this._onDidSelectItem.fire({type:"select",item:this._items[this._selectedItemIdx],node:this._nodes[this._selectedItemIdx],payload:e})}getItems(){return this._items}setItems(i){let e,t=[];try{e=$4i(this._items,i,(o,n)=>o.equals(n)),t=this._items.splice(e,this._items.length-e,...i.slice(e)),this._render(e),je(t),je(i.slice(0,e)),this._focus(-1,void 0)}catch(o){let n=new Error(`BreadcrumbsItem#setItems: newItems: ${i.length}, prefix: ${e}, removed: ${t.length}`);throw n.name=o.name,n.stack=o.stack,n}}_render(i){let e=!1;for(;i<this._items.length&&i<this._nodes.length;i++){let t=this._items[i],o=this._nodes[i];this._renderItem(t,o),e=!0}for(;i<this._nodes.length;){let t=this._nodes.pop();t&&(this._freeNodes.push(t),t.remove(),e=!0)}for(;i<this._items.length;i++){let t=this._items[i],o=this._freeNodes.length>0?this._freeNodes.pop():document.createElement("div");o&&(this._renderItem(t,o),this._domNode.appendChild(o),this._nodes.push(o),e=!0)}e&&this.layout(void 0)}_renderItem(i,e){St(e),e.className="";try{i.render(e)}catch(o){e.textContent="<<RENDER ERROR>>",console.error(o)}e.tabIndex=-1,e.setAttribute("role","listitem"),e.classList.add("monaco-breadcrumb-item");let t=_(q.asCSSSelector(this._separatorIcon));e.appendChild(t)}_onClick(i){if(this._enabled)for(let e=i.target;e;e=e.parentElement){let t=this._nodes.indexOf(e);if(t>=0){this._focus(t,i),this._select(t,i);break}}}};var sP=le("IOutlineService");var IU=le("IEditorBreadcrumbsService"),NTi=class{constructor(){this._map=new Map}register(i,e){if(this._map.has(i))throw new Error(`group (${i}) has already a widget`);return this._map.set(i,e),{dispose:()=>this._map.delete(i)}}getWidget(i){return this._map.get(i)}};Ce(IU,NTi,1);var E_=class a{constructor(){}static{this.IsEnabled=a._stub("breadcrumbs.enabled")}static{this.UseQuickPick=a._stub("breadcrumbs.useQuickPick")}static{this.FilePath=a._stub("breadcrumbs.filePath")}static{this.SymbolPath=a._stub("breadcrumbs.symbolPath")}static{this.SymbolSortOrder=a._stub("breadcrumbs.symbolSortOrder")}static{this.SymbolPathSeparator=a._stub("breadcrumbs.symbolPathSeparator")}static{this.Icons=a._stub("breadcrumbs.icons")}static{this.TitleScrollbarSizing=a._stub("workbench.editor.titleScrollbarSizing")}static{this.TitleScrollbarVisibility=a._stub("workbench.editor.titleScrollbarVisibility")}static{this.FileExcludes=a._stub("files.exclude")}static _stub(i){return{bindTo(e){let t=new T,o=e.onDidChangeConfiguration(n=>{n.affectsConfiguration(i)&&t.fire(void 0)});return new class{constructor(){this.name=i;this.onDidChange=t.event}getValue(n){return n?e.getValue(i,n):e.getValue(i)}updateValue(n,r){return r?e.updateValue(i,n,r):e.updateValue(i,n)}dispose(){o.dispose(),t.dispose()}}}}}};oe.as($t.Configuration).registerConfiguration({id:"breadcrumbs",title:d(4525,null),order:101,type:"object",properties:{"breadcrumbs.enabled":{description:d(4484,null),type:"boolean",default:!0,agentsWindow:{default:!1}},"breadcrumbs.filePath":{description:d(4485,null),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[d(4488,null),d(4487,null),d(4486,null)]},"breadcrumbs.symbolPath":{description:d(4516,null),type:"string",default:"on",enum:["on","off","last"],enumDescriptions:[d(4519,null),d(4518,null),d(4517,null)]},"breadcrumbs.symbolSortOrder":{description:d(4521,null),type:"string",default:"position",scope:6,enum:["position","name","type"],enumDescriptions:[d(4523,null),d(4522,null),d(4524,null)]},"breadcrumbs.icons":{description:d(4515,null),type:"boolean",default:!0},"breadcrumbs.symbolPathSeparator":{description:d(4520,null),type:"string",default:".",scope:6},"breadcrumbs.showFiles":{type:"boolean",default:!0,scope:6,markdownDescription:d(4498,null)},"breadcrumbs.showModules":{type:"boolean",default:!0,scope:6,markdownDescription:d(4503,null)},"breadcrumbs.showNamespaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(4504,null)},"breadcrumbs.showPackages":{type:"boolean",default:!0,scope:6,markdownDescription:d(4509,null)},"breadcrumbs.showClasses":{type:"boolean",default:!0,scope:6,markdownDescription:d(4491,null)},"breadcrumbs.showMethods":{type:"boolean",default:!0,scope:6,markdownDescription:d(4502,null)},"breadcrumbs.showProperties":{type:"boolean",default:!0,scope:6,markdownDescription:d(4510,null)},"breadcrumbs.showFields":{type:"boolean",default:!0,scope:6,markdownDescription:d(4497,null)},"breadcrumbs.showConstructors":{type:"boolean",default:!0,scope:6,markdownDescription:d(4493,null)},"breadcrumbs.showEnums":{type:"boolean",default:!0,scope:6,markdownDescription:d(4494,null)},"breadcrumbs.showInterfaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(4500,null)},"breadcrumbs.showFunctions":{type:"boolean",default:!0,scope:6,markdownDescription:d(4499,null)},"breadcrumbs.showVariables":{type:"boolean",default:!0,scope:6,markdownDescription:d(4514,null)},"breadcrumbs.showConstants":{type:"boolean",default:!0,scope:6,markdownDescription:d(4492,null)},"breadcrumbs.showStrings":{type:"boolean",default:!0,scope:6,markdownDescription:d(4511,null)},"breadcrumbs.showNumbers":{type:"boolean",default:!0,scope:6,markdownDescription:d(4506,null)},"breadcrumbs.showBooleans":{type:"boolean",default:!0,scope:6,markdownDescription:d(4490,null)},"breadcrumbs.showArrays":{type:"boolean",default:!0,scope:6,markdownDescription:d(4489,null)},"breadcrumbs.showObjects":{type:"boolean",default:!0,scope:6,markdownDescription:d(4507,null)},"breadcrumbs.showKeys":{type:"boolean",default:!0,scope:6,markdownDescription:d(4501,null)},"breadcrumbs.showNull":{type:"boolean",default:!0,scope:6,markdownDescription:d(4505,null)},"breadcrumbs.showEnumMembers":{type:"boolean",default:!0,scope:6,markdownDescription:d(4495,null)},"breadcrumbs.showStructs":{type:"boolean",default:!0,scope:6,markdownDescription:d(4512,null)},"breadcrumbs.showEvents":{type:"boolean",default:!0,scope:6,markdownDescription:d(4496,null)},"breadcrumbs.showOperators":{type:"boolean",default:!0,scope:6,markdownDescription:d(4508,null)},"breadcrumbs.showTypeParameters":{type:"boolean",default:!0,scope:6,markdownDescription:d(4513,null)}}});var Phe=class{constructor(i,e){this.uri=i;this.kind=e}},yPe=class{constructor(i,e){this.element=i;this.outline=e}},IPe=class{constructor(i,e,t,o,n){this.resource=i;this.editor=e;this._workspaceService=o;this._outlineService=n;this._disposables=new O;this._currentOutline=new ue;this._outlineDisposables=new O;this._onDidUpdate=new T;this.onDidUpdate=this._onDidUpdate.event;this._cfgFilePath=E_.FilePath.bindTo(t),this._cfgSymbolPath=E_.SymbolPath.bindTo(t),this._disposables.add(this._cfgFilePath.onDidChange(r=>this._onDidUpdate.fire(this))),this._disposables.add(this._cfgSymbolPath.onDidChange(r=>this._onDidUpdate.fire(this))),this._workspaceService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspaceFolders,this,this._disposables),this._fileInfo=this._initFilePathInfo(i),e&&(this._bindToEditor(e),this._disposables.add(n.onDidChange(()=>this._bindToEditor(e))),this._disposables.add(e.onDidChangeControl(()=>this._bindToEditor(e)))),this._onDidUpdate.fire(this)}dispose(){this._disposables.dispose(),this._cfgFilePath.dispose(),this._cfgSymbolPath.dispose(),this._currentOutline.dispose(),this._outlineDisposables.dispose(),this._onDidUpdate.dispose()}isRelative(){return!!this._fileInfo.folder}getElements(){let i=[];if(this._cfgFilePath.getValue()==="on"?i=i.concat(this._fileInfo.path):this._cfgFilePath.getValue()==="last"&&this._fileInfo.path.length>0&&(i=i.concat(this._fileInfo.path.slice(-1))),this._cfgSymbolPath.getValue()==="off"||!this._currentOutline.value)return i;let e=this._currentOutline.value.config.breadcrumbsDataSource.getBreadcrumbElements();for(let t=this._cfgSymbolPath.getValue()==="last"&&e.length>0?e.length-1:0;t<e.length;t++)i.push(new yPe(e[t].element,this._currentOutline.value));return e.length===0&&!this._currentOutline.value.isEmpty&&i.push(new yPe(this._currentOutline.value,this._currentOutline.value)),i}_initFilePathInfo(i){if(gB(i,Q.untitled,Q.data))return{folder:void 0,path:[]};let e={folder:this._workspaceService.getWorkspaceFolder(i)??void 0,path:[]},t=i;for(;t&&t.path!=="/"&&!(e.folder&&ze(e.folder.uri,t));){e.path.unshift(new Phe(t,e.path.length===0?0:1));let o=t.path.length;if(t=ai(t),t.path.length===o)break}return e.folder&&this._workspaceService.getWorkbenchState()===3&&e.path.unshift(new Phe(e.folder.uri,2)),e}_onDidChangeWorkspaceFolders(){this._fileInfo=this._initFilePathInfo(this.resource),this._onDidUpdate.fire(this)}_bindToEditor(i){let e=new qe;this._currentOutline.clear(),this._outlineDisposables.clear(),this._outlineDisposables.add(ee(()=>e.dispose(!0))),this._outlineService.createOutline(i,2,e.token).then(t=>{e.token.isCancellationRequested&&(t?.dispose(),t=void 0),this._currentOutline.value=t,this._onDidUpdate.fire(this),t&&this._outlineDisposables.add(t.onDidChange(()=>this._onDidUpdate.fire(this)))}).catch(t=>{this._onDidUpdate.fire(this),mt(t)})}};IPe=I([m(2,B),m(3,Ae),m(4,sP)],IPe);var CPe=class{constructor(i,e,t,o,n){this.resource=e;this._instantiationService=t;this._themeService=o;this._configurationService=n;this._disposables=new O;this._fakeEvent=new UIEvent("fakeEvent");this._onWillPickElement=new T;this.onWillPickElement=this._onWillPickElement.event;this._previewDispoables=new ue;this._domNode=document.createElement("div"),this._domNode.className="monaco-breadcrumbs-picker show-file-icons",i.appendChild(this._domNode)}dispose(){this._disposables.dispose(),this._previewDispoables.dispose(),this._onWillPickElement.dispose(),this._domNode.remove(),setTimeout(()=>this._tree.dispose(),0)}async show(i,e,t,o,n){let s=this._themeService.getColorTheme().getColor(usi);this._arrow=document.createElement("div"),this._arrow.className="arrow",this._arrow.style.borderColor=`transparent transparent ${s?s.toString():""}`,this._domNode.appendChild(this._arrow),this._treeContainer=document.createElement("div"),this._treeContainer.style.background=s?s.toString():"",this._treeContainer.style.paddingTop="2px",this._treeContainer.style.borderRadius="3px",this._treeContainer.style.boxShadow="var(--vscode-shadow-lg)",this._treeContainer.style.border=`1px solid ${this._themeService.getColorTheme().getColor(SD)}`,this._domNode.appendChild(this._treeContainer),this._layoutInfo={maxHeight:e,width:t,arrowSize:o,arrowOffset:n,inputHeight:0},this._tree=this._createTree(this._treeContainer,i),this._disposables.add(this._tree.onDidOpen(async l=>{let{element:c,editorOptions:u,sideBySide:p}=l;await this._revealElement(c,{...u,preserveFocus:!1},p)})),this._disposables.add(this._tree.onDidChangeFocus(l=>{this._previewDispoables.value=this._previewElement(l.elements[0])})),this._disposables.add(this._tree.onDidChangeContentHeight(()=>{this._layout()})),this._domNode.focus();try{await this._setInput(i),this._layout()}catch(l){mt(l)}}_layout(){let i=2*this._layoutInfo.arrowSize,e=Math.min(this._layoutInfo.maxHeight-i,this._tree.contentHeight),t=e+i;this._domNode.style.height=`${t}px`,this._domNode.style.width=`${this._layoutInfo.width}px`,this._arrow.style.top=`-${2*this._layoutInfo.arrowSize}px`,this._arrow.style.borderWidth=`${this._layoutInfo.arrowSize}px`,this._arrow.style.marginLeft=`${this._layoutInfo.arrowOffset}px`,this._treeContainer.style.height=`${e}px`,this._treeContainer.style.width=`${this._layoutInfo.width}px`,this._tree.layout(e,this._layoutInfo.width)}restoreViewState(){}};CPe=I([m(2,F),m(3,Pe),m(4,B)],CPe);var OTi=class{getHeight(i){return 22}getTemplateId(i){return"FileStat"}},FTi=class{getId(i){return A.isUri(i)?i.toString():p4(i)?i.id:eC(i)?i.uri.toString():i.resource.toString()}},Qtt=class{constructor(i){this._fileService=i}hasChildren(i){return A.isUri(i)||p4(i)||eC(i)||i.isDirectory}async getChildren(i){if(p4(i))return i.folders;let e;return eC(i)?e=i.uri:A.isUri(i)?e=i:e=i.resource,(await this._fileService.resolve(e)).children??[]}};Qtt=I([m(0,ge)],Qtt);var Ytt=class{constructor(i,e){this._labels=i;this._configService=e;this.templateId="FileStat"}renderTemplate(i){return this._labels.create(i,{supportHighlights:!0})}renderElement(i,e,t){let o=this._configService.getValue("explorer.decorations"),{element:n}=i,r,s;eC(n)?(r=n.uri,s=2):(r=n.resource,s=n.isDirectory?1:0),t.setFile(r,{fileKind:s,hidePath:!0,fileDecorations:o,matches:Wa(i.filterData),extraClasses:["picker-item"]})}disposeTemplate(i){i.dispose()}};Ytt=I([m(1,B)],Ytt);var WTi=class{getKeyboardNavigationLabel(i){return i.name}},VTi=class{getWidgetAriaLabel(){return d(4538,null)}getAriaLabel(i){return i.name}},Xtt=class{constructor(i,e,t){this._workspaceService=i;this._cachedExpressions=new Map;this._disposables=new O;let o=E_.FileExcludes.bindTo(e),n=()=>{i.getWorkspace().folders.forEach(r=>{let s=o.getValue({resource:r.uri});if(!s)return;let l={};for(let u in s){if(typeof s[u]!="boolean")continue;let p=u.indexOf("**/")!==0?Vo.join(r.uri.path,u):u;l[p]=s[u]}let c=!t.hasCapability(r.uri,1024);this._cachedExpressions.set(r.uri.toString(),Eh(l,{ignoreCase:c}))})};n(),this._disposables.add(o),this._disposables.add(o.onDidChange(n)),this._disposables.add(i.onDidChangeWorkspaceFolders(n))}dispose(){this._disposables.dispose()}filter(i,e){if(eC(i))return!0;let t=this._workspaceService.getWorkspaceFolder(i.resource);return!t||!this._cachedExpressions.has(t.uri.toString())?!0:!this._cachedExpressions.get(t.uri.toString())(pA(t.uri.path,i.resource.path),Be(i.resource))}};Xtt=I([m(0,Ae),m(1,B),m(2,ge)],Xtt);var BTi=class{compare(i,e){return eC(i)&&eC(e)?i.index-e.index:i.isDirectory===e.isDirectory?C_(i.name,e.name):i.isDirectory?-1:1}},xPe=class extends CPe{constructor(e,t,o,n,r,s,l){super(e,t,o,n,r);this._workspaceService=s;this._editorService=l}_createTree(e){this._treeContainer.classList.add("file-icon-themable-tree"),this._treeContainer.classList.add("show-file-icons");let t=n=>{this._treeContainer.classList.toggle("align-icons-and-twisties",n.hasFileIcons&&!n.hasFolderIcons),this._treeContainer.classList.toggle("hide-arrows",n.hidesExplorerArrows===!0)};this._disposables.add(this._themeService.onDidFileIconThemeChange(t)),t(this._themeService.getFileIconTheme());let o=this._instantiationService.createInstance(jl,JH);return this._disposables.add(o),this._instantiationService.createInstance(Rp,"BreadcrumbsFilePicker",e,new OTi,[this._instantiationService.createInstance(Ytt,o)],this._instantiationService.createInstance(Qtt),{multipleSelectionSupport:!1,sorter:new BTi,filter:this._instantiationService.createInstance(Xtt),identityProvider:new FTi,keyboardNavigationLabelProvider:new WTi,accessibilityProvider:this._instantiationService.createInstance(VTi),showNotFoundMessage:!1,overrideStyles:{listBackground:usi}})}async _setInput(e){let{uri:t,kind:o}=e,n;o===2?n=this._workspaceService.getWorkspace():n=ai(t);let r=this._tree;await r.setInput(n);let s;for(let{element:l}of r.getNode().children)if(eC(l)&&ze(l.uri,t)){s=l;break}else if(ze(l.resource,t)){s=l;break}s&&(r.reveal(s,.5),r.setFocus([s],this._fakeEvent)),r.domFocus()}_previewElement(e){return k.None}async _revealElement(e,t,o){return!eC(e)&&e.isFile?(this._onWillPickElement.fire(),await this._editorService.openEditor({resource:e.resource,options:t},o?En:void 0),!0):!1}};xPe=I([m(2,F),m(3,Pe),m(4,B),m(5,Ae),m(6,ie)],xPe);var Jtt=class{constructor(i,e,t){this.comparator=i;this._order=t.getValue(e,"breadcrumbs.symbolSortOrder")}compare(i,e){return this._order==="name"?this.comparator.compareByName(i,e):this._order==="type"?this.comparator.compareByType(i,e):this.comparator.compareByPosition(i,e)}};Jtt=I([m(2,Gn)],Jtt);var cUt=class extends CPe{_createTree(i,e){let{config:t}=e.outline;return this._instantiationService.createInstance(c0,"BreadcrumbsOutlinePicker",i,t.delegate,t.renderers,t.treeDataSource,{...t.options,sorter:this._instantiationService.createInstance(Jtt,t.comparator,void 0),collapseByDefault:!0,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,showNotFoundMessage:!1})}_setInput(i){let e=i.outline.captureViewState();this.restoreViewState=()=>{e.dispose()};let t=this._tree;return t.setInput(i.outline),i.element!==i.outline&&(t.reveal(i.element,.5),t.setFocus([i.element],this._fakeEvent)),t.domFocus(),Promise.resolve()}_previewElement(i){return this._tree.getInput().preview(i)}async _revealElement(i,e,t){return this._onWillPickElement.fire(),await this._tree.getInput().reveal(i,e,t,!1),!0}};var Vte=class extends Wte{constructor(e,t,o,n){super();this.model=e;this.element=t;this.options=o;this._instantiationService=n;this._disposables=new O}dispose(){this._disposables.dispose()}equals(e){return e instanceof Vte?this.element.element===e.element.element&&this.options.showFileIcons===e.options.showFileIcons&&this.options.showSymbolIcons===e.options.showSymbolIcons:!1}render(e){let{element:t,outline:o}=this.element;if(t===o){let l=_("span",void 0,"\u2026");e.appendChild(l);return}let n=o.config.delegate.getTemplateId(t),r=o.config.renderers.find(l=>l.templateId===n);if(!r){e.textContent="<<NO RENDERER>>";return}let s=r.renderTemplate(e);r.renderElement({element:t,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:0,collapsible:!1,collapsed:!1,visible:!0,filterData:void 0},0,s,void 0),this.options.showSymbolIcons||Wi(s.iconClass),this._disposables.add(ee(()=>{r.disposeTemplate(s)})),t instanceof Iv&&o.uri&&this._disposables.add(this._instantiationService.invokeFunction(l=>Afo(l,e,t.symbol.name,{symbol:t.symbol,uri:o.uri},this.model,this.options.dragEditor)))}};Vte=I([m(3,F)],Vte);var Bte=class extends Wte{constructor(e,t,o,n,r,s){super();this.model=e;this.element=t;this.options=o;this._labels=n;this._hoverDelegate=r;this._instantiationService=s;this._disposables=new O}dispose(){this._disposables.dispose()}equals(e){return e instanceof Bte?Jn.isEqual(this.element.uri,e.element.uri)&&this.options.showFileIcons===e.options.showFileIcons&&this.options.showSymbolIcons===e.options.showSymbolIcons:!1}render(e){let t=this._labels.create(e,{hoverDelegate:this._hoverDelegate});t.setFile(this.element.uri,{hidePath:!0,hideIcon:this.element.kind===1||!this.options.showFileIcons,fileKind:this.element.kind,fileDecorations:{colors:this.options.showDecorationColors,badges:!1}}),e.classList.add($u[this.element.kind].toLowerCase()),this._disposables.add(t),this._disposables.add(this._instantiationService.invokeFunction(o=>Afo(o,e,Be(this.element.uri),this.element.uri,this.model,this.options.dragEditor)))}};Bte=I([m(5,F)],Bte);function Afo(a,i,e,t,o,n){let r=a.get(F);return i.draggable=!0,new wg(i,{onDragStart:s=>{s.dataTransfer&&(s.dataTransfer.effectAllowed="copyMove",r.invokeFunction(l=>{A.isUri(t)?kv(l,[t],s):(kv(l,[{resource:t.uri,selection:t.symbol.range}],s),uxe([{name:t.symbol.name,fsPath:t.uri.fsPath,range:t.symbol.range,kind:t.symbol.kind}],s)),n&&o.editor?.input&&Vy.getInstance().setData([new xv({editor:o.editor.input,groupId:o.editor.group.id})],xv.prototype)}),LA(s,i,e))}})}var Jin=Oe("breadcrumb-separator",L.chevronRight,d(4537,null)),Yc=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._options=e;this._editorGroup=t;this._contextKeyService=o;this._contextViewService=n;this._instantiationService=r;this._quickInputService=s;this._fileService=l;this._editorService=c;this._labelService=u;this._disposables=new O;this._breadcrumbsDisposables=new O;this._model=new ue;this._breadcrumbsPickerShowing=!1;this._onDidVisibilityChange=this._disposables.add(new T);this.domNode=document.createElement("div"),this.domNode.classList.add("breadcrumbs-control"),D(i,this.domNode),this._cfUseQuickPick=E_.UseQuickPick.bindTo(p),this._cfShowIcons=E_.Icons.bindTo(p),this._cfTitleScrollbarSizing=E_.TitleScrollbarSizing.bindTo(p),this._cfTitleScrollbarVisibility=E_.TitleScrollbarVisibility.bindTo(p),this._labels=this._instantiationService.createInstance(jl,JH);let g=this._cfTitleScrollbarSizing.getValue()??"default",f=e.widgetStyles??YF,v=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget=new RW(this.domNode,Yc.SCROLLBAR_SIZES[g],Yc.SCROLLBAR_VISIBILITY[v],Jin,f),this._widget.onDidSelectItem(this._onSelectEvent,this,this._disposables),this._widget.onDidFocusItem(this._onFocusEvent,this,this._disposables),this._widget.onDidChangeFocus(this._updateCkBreadcrumbsActive,this,this._disposables),this._ckBreadcrumbsPossible=Yc.CK_BreadcrumbsPossible.bindTo(this._contextKeyService),this._ckBreadcrumbsVisible=Yc.CK_BreadcrumbsVisible.bindTo(this._contextKeyService),this._ckBreadcrumbsActive=Yc.CK_BreadcrumbsActive.bindTo(this._contextKeyService),this._hoverDelegate=yi("mouse"),this._disposables.add(h.register(this._editorGroup.id,this._widget)),this.hide()}static{this.HEIGHT=22}static{this.SCROLLBAR_SIZES={default:3,large:8}}static{this.SCROLLBAR_VISIBILITY={auto:1,visible:3,hidden:2}}static{this.Payload_Reveal={}}static{this.Payload_RevealAside={}}static{this.Payload_Pick={}}static{this.CK_BreadcrumbsPossible=new Y("breadcrumbsPossible",!1,d(4527,null))}static{this.CK_BreadcrumbsVisible=new Y("breadcrumbsVisible",!1,d(4528,null))}static{this.CK_BreadcrumbsActive=new Y("breadcrumbsActive",!1,d(4526,null))}get onDidVisibilityChange(){return this._onDidVisibilityChange.event}dispose(){this._disposables.dispose(),this._breadcrumbsDisposables.dispose(),this._model.dispose(),this._ckBreadcrumbsPossible.reset(),this._ckBreadcrumbsVisible.reset(),this._ckBreadcrumbsActive.reset(),this._cfUseQuickPick.dispose(),this._cfShowIcons.dispose(),this._cfTitleScrollbarSizing.dispose(),this._cfTitleScrollbarVisibility.dispose(),this._widget.dispose(),this._labels.dispose(),this.domNode.remove()}get model(){return this._model.value}layout(i){this._widget.layout(i)}isHidden(){return this.domNode.classList.contains("hidden")}hide(){let i=this.isHidden();this._breadcrumbsDisposables.clear(),this._ckBreadcrumbsVisible.set(!1),this.domNode.classList.toggle("hidden",!0),i||this._onDidVisibilityChange.fire()}show(){let i=this.isHidden();this._ckBreadcrumbsVisible.set(!0),this.domNode.classList.toggle("hidden",!1),i&&this._onDidVisibilityChange.fire()}revealLast(){this._widget.revealLast()}update(){this._breadcrumbsDisposables.clear();let i=po.getCanonicalUri(this._editorGroup.activeEditor,{supportSideBySide:1}),e=this.isHidden();if(!i||!this._fileService.hasProvider(i))return this._ckBreadcrumbsPossible.set(!1),e?!1:(this.hide(),!0);let t=po.getOriginalUri(this._editorGroup.activeEditor,{supportSideBySide:1});this.show(),this._ckBreadcrumbsPossible.set(!0);let o=this._instantiationService.createInstance(IPe,t??i,this._editorGroup.activeEditorPane);this._model.value=o,this.domNode.classList.toggle("backslash-path",this._labelService.getSeparator(i.scheme,i.authority)==="\\");let n=()=>{this.domNode.classList.toggle("relative-path",o.isRelative());let p=this._cfShowIcons.getValue(),h={...this._options,showFileIcons:this._options.showFileIcons&&p,showSymbolIcons:this._options.showSymbolIcons&&p},g=o.getElements().map(f=>f instanceof Phe?this._instantiationService.createInstance(Bte,o,f,h,this._labels,this._hoverDelegate):this._instantiationService.createInstance(Vte,o,f,h));g.length===0?(this._widget.setEnabled(!1),this._widget.setItems([new class extends Wte{render(f){f.textContent=d(4535,null)}equals(f){return f===this}dispose(){}}])):(this._widget.setEnabled(!0),this._widget.setItems(g),this._widget.reveal(g[g.length-1]))},r=o.onDidUpdate(n),s=this._cfShowIcons.onDidChange(n);n(),this._breadcrumbsDisposables.clear(),this._breadcrumbsDisposables.add(r),this._breadcrumbsDisposables.add(ee(()=>this._model.clear())),this._breadcrumbsDisposables.add(s),this._breadcrumbsDisposables.add(ee(()=>this._widget.setItems([])));let l=()=>{let p=this._cfTitleScrollbarSizing.getValue()??"default",h=this._cfTitleScrollbarVisibility?.getValue()??"auto";this._widget.setHorizontalScrollbarSize(Yc.SCROLLBAR_SIZES[p]),this._widget.setHorizontalScrollbarVisibility(Yc.SCROLLBAR_VISIBILITY[h])};l();let c=this._cfTitleScrollbarSizing.onDidChange(l),u=this._cfTitleScrollbarVisibility.onDidChange(l);return this._breadcrumbsDisposables.add(c),this._breadcrumbsDisposables.add(u),this._breadcrumbsDisposables.add({dispose:()=>{this._breadcrumbsPickerShowing&&this._contextViewService.hideContextView({source:this})}}),e!==this.isHidden()}_onFocusEvent(i){i.item&&this._breadcrumbsPickerShowing&&(this._breadcrumbsPickerIgnoreOnceItem=void 0,this._widget.setSelection(i.item))}_onSelectEvent(i){if(!i.item)return;if(i.item===this._breadcrumbsPickerIgnoreOnceItem){this._breadcrumbsPickerIgnoreOnceItem=void 0,this._widget.setFocused(void 0),this._widget.setSelection(void 0);return}let{element:e}=i.item;this._editorGroup.focus();let t=this._getEditorGroup(i.payload);if(t!==void 0){this._widget.setFocused(void 0),this._widget.setSelection(void 0),this._revealInEditor(i,e,t);return}if(this._cfUseQuickPick.getValue()){this._widget.setFocused(void 0),this._widget.setSelection(void 0),this._quickInputService.quickAccess.show(e instanceof yPe?"@":"");return}let o,n;this._contextViewService.showContextView({render:r=>{i.item instanceof Bte?o=this._instantiationService.createInstance(xPe,r,i.item.model.resource):i.item instanceof Vte&&(o=this._instantiationService.createInstance(cUt,r,i.item.model.resource));let s=o.onWillPickElement(()=>this._contextViewService.hideContextView({source:this,didPick:!0})),l=Gu.getInstance(Me(this.domNode)).onDidChange(()=>this._contextViewService.hideContextView({source:this})),c=nr(r),u=c.onDidBlur(()=>{this._breadcrumbsPickerIgnoreOnceItem=this._widget.isDOMFocused()?i.item:void 0,this._contextViewService.hideContextView({source:this})});return this._breadcrumbsPickerShowing=!0,this._updateCkBreadcrumbsActive(),Fn(o,s,l,c,u)},getAnchor:()=>{if(!n){let r=Me(this.domNode),s=r.innerWidth-8,l=Math.min(r.innerHeight*.7,300),c=Math.min(s,Math.max(240,s/4.17)),u=8,p,h=ur(i.node),g=h.top+h.height+u;g+l>=r.innerHeight&&(l=r.innerHeight-g-30);let f=h.left;if(f+c>=s&&(f=s-c),i.payload instanceof Ln){let v=c-2*u;p=i.payload.posx-f,p>v&&(f=Math.min(s-c,f+p-v),p=v)}else p=h.left+h.width*.3-f;o.show(e,l,c,u,Math.max(0,p)),n={x:f,y:g}}return n},onHide:r=>{r?.didPick||o.restoreViewState(),this._breadcrumbsPickerShowing=!1,this._updateCkBreadcrumbsActive(),r?.source===this&&(this._widget.setFocused(void 0),this._widget.setSelection(void 0)),o.dispose()}})}_updateCkBreadcrumbsActive(){let i=this._widget.isDOMFocused()||this._breadcrumbsPickerShowing;this._ckBreadcrumbsActive.set(i)}async _revealInEditor(i,e,t,o=!1){if(e instanceof Phe)if(e.kind===0)await this._editorService.openEditor({resource:e.uri,options:{pinned:o}},t);else{let n=this._widget.getItems(),r=n.indexOf(i.item);this._widget.setFocused(n[r+1]),this._widget.setSelection(n[r+1],Yc.Payload_Pick)}else e.outline.reveal(e,{pinned:o},t===En,!1)}_getEditorGroup(i){return i===Yc.Payload_RevealAside?En:i===Yc.Payload_Reveal?tr:void 0}};Yc=I([m(3,X),m(4,qn),m(5,F),m(6,$e),m(7,ge),m(8,ie),m(9,nt),m(10,B),m(11,IU)],Yc);var Hte=class{constructor(i,e,t,o,n,r){this._container=i;this._editorGroup=e;this._options=t;this._instantiationService=n;this._disposables=new O;this._controlDisposables=new O;this._onDidEnablementChange=this._disposables.add(new T);this._onDidVisibilityChange=this._disposables.add(new T);let s=this._disposables.add(E_.IsEnabled.bindTo(o));this._disposables.add(s.onDidChange(()=>{let l=s.getValue();!l&&this._control?(this._controlDisposables.clear(),this._control=void 0,this._onDidEnablementChange.fire()):l&&!this._control&&(this._control=this.createControl(),this._control.update(),this._onDidEnablementChange.fire())})),s.getValue()&&(this._control=this.createControl()),this._disposables.add(r.onDidChangeFileSystemProviderRegistrations(l=>{this._control?.model&&this._control.model.resource.scheme!==l.scheme||this._control?.update()&&this._onDidEnablementChange.fire()}))}get control(){return this._control}get onDidEnablementChange(){return this._onDidEnablementChange.event}get onDidVisibilityChange(){return this._onDidVisibilityChange.event}createControl(){let i=this._controlDisposables.add(this._instantiationService.createInstance(Yc,this._container,this._options,this._editorGroup));return this._controlDisposables.add(i.onDidVisibilityChange(()=>this._onDidVisibilityChange.fire())),i}dispose(){this._disposables.dispose(),this._controlDisposables.dispose()}};Hte=I([m(3,B),m(4,F),m(5,ge)],Hte);W(class extends z{constructor(){super({id:"breadcrumbs.toggle",title:P(4532,"Toggle Breadcrumbs"),shortTitle:P(4533,"Breadcrumbs"),category:Fe.View,toggled:{condition:C.equals("config.breadcrumbs.enabled",!0),title:d(4534,null),mnemonicTitle:d(4536,null)},menu:[{id:R.CommandPalette},{id:R.MenubarAppearanceMenu,group:"4_editor",order:2},{id:R.NotebookToolbar,group:"notebookLayout",order:2},{id:R.StickyScrollContext},{id:R.NotebookStickyScrollContext,group:"notebookView",order:2},{id:R.NotebookToolbarContext,group:"notebookView",order:2}]})}run(i){let e=i.get(B),t=E_.IsEnabled.bindTo(e),o=t.getValue();t.updateValue(!o),t.dispose()}});function HTi(a,i){let e=a.get(kt),o=a.get(IU).getWidget(e.activeGroup.id);if(o){let n=o.getItems().at(-1);o.setFocused(n),i&&o.setSelection(n,Yc.Payload_Pick)}}W(class extends z{constructor(){super({id:"breadcrumbs.focusAndSelect",title:P(4531,"Focus and Select Breadcrumbs"),precondition:Yc.CK_BreadcrumbsVisible,keybinding:{weight:200,primary:3161,when:Yc.CK_BreadcrumbsPossible},f1:!0})}run(i,...e){HTi(i,!0)}});W(class extends z{constructor(){super({id:"breadcrumbs.focus",title:P(4530,"Focus Breadcrumbs"),precondition:Yc.CK_BreadcrumbsVisible,keybinding:{weight:200,primary:3157,when:Yc.CK_BreadcrumbsPossible},f1:!0})}run(i,...e){HTi(i,!1)}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.toggleToOn",weight:200,primary:3161,when:C.not("config.breadcrumbs.enabled"),handler:async a=>{let i=a.get(F),e=a.get(B),t=E_.IsEnabled.bindTo(e);return t.getValue()||(await t.updateValue(!0),await Li(50)),t.dispose(),i.invokeFunction(HTi,!0)}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNext",weight:200,primary:17,secondary:[2065],mac:{primary:17,secondary:[529]},when:C.and(Yc.CK_BreadcrumbsVisible,Yc.CK_BreadcrumbsActive),handler(a){let i=a.get(kt),t=a.get(IU).getWidget(i.activeGroup.id);t&&t.focusNext()}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPrevious",weight:200,primary:15,secondary:[2063],mac:{primary:15,secondary:[527]},when:C.and(Yc.CK_BreadcrumbsVisible,Yc.CK_BreadcrumbsActive),handler(a){let i=a.get(kt),t=a.get(IU).getWidget(i.activeGroup.id);t&&t.focusPrev()}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusNextWithPicker",weight:201,primary:2065,mac:{primary:529},when:C.and(Yc.CK_BreadcrumbsVisible,Yc.CK_BreadcrumbsActive,Nc),handler(a){let i=a.get(kt),t=a.get(IU).getWidget(i.activeGroup.id);t&&t.focusNext()}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.focusPreviousWithPicker",weight:201,primary:2063,mac:{primary:527},when:C.and(Yc.CK_BreadcrumbsVisible,Yc.CK_BreadcrumbsActive,Nc),handler(a){let i=a.get(kt),t=a.get(IU).getWidget(i.activeGroup.id);t&&t.focusPrev()}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.selectFocused",weight:200,primary:3,secondary:[18],when:C.and(Yc.CK_BreadcrumbsVisible,Yc.CK_BreadcrumbsActive),handler(a){let i=a.get(kt),t=a.get(IU).getWidget(i.activeGroup.id);t&&t.setSelection(t.getFocused(),Yc.Payload_Pick)}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocused",weight:200,primary:10,secondary:[2051],when:C.and(Yc.CK_BreadcrumbsVisible,Yc.CK_BreadcrumbsActive),handler(a){let i=a.get(kt),t=a.get(IU).getWidget(i.activeGroup.id);t&&t.setSelection(t.getFocused(),Yc.Payload_Reveal)}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.selectEditor",weight:201,primary:9,when:C.and(Yc.CK_BreadcrumbsVisible,Yc.CK_BreadcrumbsActive),handler(a){let i=a.get(kt),t=a.get(IU).getWidget(i.activeGroup.id);t&&(t.setFocused(void 0),t.setSelection(void 0),i.activeGroup.activeEditorPane?.focus())}});xt.registerCommandAndKeybindingRule({id:"breadcrumbs.revealFocusedFromTreeAside",weight:200,primary:2051,when:C.and(Yc.CK_BreadcrumbsVisible,Yc.CK_BreadcrumbsActive,Nc),handler(a){let i=a.get(ie),t=a.get(Co).lastFocusedList;if(!(t instanceof c0)&&!(t instanceof Rp))return;let o=t.getFocus()[0];if(A.isUri(o?.resource))return i.openEditor({resource:o.resource,options:{pinned:!0}},En);let n=t.getInput();if(n&&typeof n.outlineKind=="string")return n.reveal(o,{pinned:!0,preserveFocus:!1},!0,!1)}});W(class extends z{constructor(){super({id:"breadcrumbs.copyPath",title:P(4529,"Copy Breadcrumbs Path"),category:Fe.View,precondition:Yc.CK_BreadcrumbsVisible,f1:!0,menu:[{id:R.EditorTitleContext,group:"1_cutcopypaste",order:100,when:Yc.CK_BreadcrumbsPossible}]})}async run(i){let e=i.get(kt),t=i.get(Bi),o=i.get(B),n=i.get(sP);if(!e.activeGroup.activeEditorPane)return;let r=await n.createOutline(e.activeGroup.activeEditorPane,2,Ie.None);if(!r)return;let l=r.config.breadcrumbsDataSource.getBreadcrumbElements().map(g=>g.label).filter(Boolean);if(r.dispose(),l.length===0)return;let c=e.activeGroup.activeEditorPane.input.resource,u=E_.SymbolPathSeparator.bindTo(o),p=u.getValue(c&&{resource:c})??".";u.dispose();let h=l.join(p);await t.writeText(h)}});var Ute=class extends cs{constructor(e){super();this.context=e}run(e,t){let o=this.context;return t?.preserveFocus&&(o={...this.context,preserveFocus:!0}),super.run(e,o)}},HN=class extends ju{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(g);this.parent=e;this.editorPartsView=t;this.groupsView=o;this.groupView=n;this.tabsModel=r;this.contextMenuService=s;this.instantiationService=l;this.contextKeyService=c;this.keybindingService=u;this.notificationService=p;this.quickInputService=h;this.editorResolverService=f;this.hostService=v;this.editorTransfer=Vy.getInstance();this.groupTransfer=Vy.getInstance();this.treeItemsTransfer=Vy.getInstance();this.editorActionsToolbarDisposables=this._register(new O);this.editorActionsDisposables=this._register(new O);this.editorLayoutActionsToolbarDisposables=this._register(new O);this.editorLayoutActionsDisposables=this._register(new O);this.renderDropdownAsChildElement=!1;let b=this.create(e);this.contextMenuContextKeyService=this._register(this.contextKeyService.createScoped(b));let S=this._register(this.instantiationService.createChild(new Po([X,this.contextMenuContextKeyService])));this.resourceContext=this._register(S.createInstance(Ho)),this.editorPinnedContext=K_e.bindTo(this.contextMenuContextKeyService),this.editorIsFirstContext=KMt.bindTo(this.contextMenuContextKeyService),this.editorIsLastContext=kpe.bindTo(this.contextMenuContextKeyService),this.editorStickyContext=NM.bindTo(this.contextMenuContextKeyService),this.editorAvailableEditorIds=A0.bindTo(this.contextMenuContextKeyService),this.editorCanSplitInGroupContext=wH.bindTo(this.contextMenuContextKeyService),this.sideBySideEditorContext=Dx.bindTo(this.contextMenuContextKeyService),this.groupLockedContext=o_.bindTo(this.contextMenuContextKeyService)}static{this.EDITOR_TAB_HEIGHT={normal:35,compact:22}}create(e){return this.updateTabHeight(),e}get editorActionsEnabled(){return this.groupsView.partOptions.editorActionsLocation==="default"&&this.groupsView.partOptions.showTabs!=="none"}createEditorActionsToolBar(e,t){this.editorActionsToolbarContainer=_("div"),this.editorActionsToolbarContainer.classList.add(...t),e.appendChild(this.editorActionsToolbarContainer),this.handleEditorActionToolBarVisibility(this.editorActionsToolbarContainer),this.editorLayoutActionsSeparator=_("div.editor-actions-separator"),e.appendChild(this.editorLayoutActionsSeparator),this.editorLayoutActionsToolbarContainer=_("div.editor-layout-actions"),e.appendChild(this.editorLayoutActionsToolbarContainer),this.handleEditorLayoutActionsToolBarVisibility(this.editorLayoutActionsToolbarContainer)}handleEditorActionToolBarVisibility(e){let t=this.editorActionsEnabled,o=!!this.editorActionsToolbar;t&&!o?this.doCreateEditorActionsToolBar(e):!t&&o&&(this.editorActionsToolbar?.getElement().remove(),this.editorActionsToolbar=void 0,this.editorActionsToolbarDisposables.clear(),this.editorActionsDisposables.clear()),e.classList.toggle("hidden",!t)}handleEditorLayoutActionsToolBarVisibility(e){let t=this.editorActionsEnabled,o=!!this.editorLayoutActionsToolbar;t&&!o?this.doCreateEditorLayoutActionsToolBar(e):!t&&o&&(this.editorLayoutActionsToolbar?.getElement().remove(),this.editorLayoutActionsToolbar=void 0,this.editorLayoutActionsToolbarDisposables.clear(),this.editorLayoutActionsDisposables.clear()),e.classList.toggle("hidden",!t),this.editorLayoutActionsSeparator&&!t&&Md(!1,this.editorLayoutActionsSeparator)}doCreateEditorActionsToolBar(e){let t={groupId:this.groupView.id};this.editorActionsToolbar=this.editorActionsToolbarDisposables.add(this.instantiationService.createInstance(dl,e,{actionViewItemProvider:(o,n)=>this.actionViewItemProvider(o,n),orientation:0,ariaLabel:d(4948,null),getKeyBinding:o=>this.getKeybinding(o),actionRunner:this.editorActionsToolbarDisposables.add(new Ute(t)),anchorAlignmentProvider:()=>1,renderDropdownAsChildElement:this.renderDropdownAsChildElement,telemetrySource:"editorPart",resetMenu:R.EditorTitle,overflowBehavior:{maxItems:9,exempted:JVt},highlightToggledItems:!0})),this.editorActionsToolbar.context=t,this.editorActionsToolbarDisposables.add(this.editorActionsToolbar.actionRunner.onDidRun(o=>{o.error&&!Yi(o.error)&&this.notificationService.error(o.error)}))}doCreateEditorLayoutActionsToolBar(e){let t={groupId:this.groupView.id};this.editorLayoutActionsToolbar=this.editorLayoutActionsToolbarDisposables.add(this.instantiationService.createInstance(dl,e,{actionViewItemProvider:(o,n)=>this.actionViewItemProvider(o,n),orientation:0,ariaLabel:d(4949,null),getKeyBinding:o=>this.getKeybinding(o),actionRunner:this.editorLayoutActionsToolbarDisposables.add(new Ute(t)),anchorAlignmentProvider:()=>1,renderDropdownAsChildElement:this.renderDropdownAsChildElement,telemetrySource:"editorPartTrailing",resetMenu:R.EditorTitleLayout,hiddenItemStrategy:-1,highlightToggledItems:!0})),this.editorLayoutActionsToolbar.context=t,this.editorLayoutActionsToolbarDisposables.add(this.editorLayoutActionsToolbar.actionRunner.onDidRun(o=>{o.error&&!Yi(o.error)&&this.notificationService.error(o.error)}))}actionViewItemProvider(e,t){let o=this.groupView.activeEditorPane;if(o instanceof zs){let n=o.getActionViewItem(e,t);if(n)return n}return ta(this.instantiationService,e,{...t,menuAsChild:this.renderDropdownAsChildElement})}updateEditorActionsToolbar(){if(!this.editorActionsEnabled)return;this.editorActionsDisposables.clear();let e=this.groupView.createEditorActions(this.editorActionsDisposables);this.editorActionsDisposables.add(e.onDidChange(()=>this.updateEditorActionsToolbar()));let t=Ti(this.editorActionsToolbar),{primary:o,secondary:n}=this.prepareEditorActions(e.actions);t.setActions(Kk(o),Kk(n)),this.updateEditorLayoutActionsToolbar()}updateEditorLayoutActionsToolbar(){if(!this.editorActionsEnabled||!this.editorLayoutActionsToolbar)return;this.editorLayoutActionsDisposables.clear();let e=this.groupView.createEditorActions(this.editorLayoutActionsDisposables,R.EditorTitleLayout);this.editorLayoutActionsDisposables.add(e.onDidChange(()=>this.updateEditorLayoutActionsToolbar()));let{primary:t,secondary:o}=this.prepareEditorLayoutActions(e.actions);this.editorLayoutActionsToolbar.setActions(Kk(t),Kk(o)),this.editorLayoutActionsSeparator&&Md(t.length>0||o.length>0,this.editorLayoutActionsSeparator)}getEditorPaneAwareContextKeyService(){return this.groupView.activeEditorPane?.scopedContextKeyService??this.contextKeyService}clearEditorActionsToolbar(){if(!this.editorActionsEnabled)return;Ti(this.editorActionsToolbar).setActions([],[]),this.editorLayoutActionsToolbar?.setActions([],[]),this.editorLayoutActionsSeparator&&Md(!1,this.editorLayoutActionsSeparator)}onGroupDragStart(e,t){if(e.target!==t)return!1;let o=this.isNewWindowOperation(e);this.groupTransfer.setData([new ey(this.groupView.id)],ey.prototype),e.dataTransfer&&(e.dataTransfer.effectAllowed="copyMove");let n=!1;if(this.groupsView.partOptions.showTabs==="multiple"?n=this.doFillResourceDataTransfers(this.groupView.getEditors(1),e,o):this.groupView.activeEditor&&(n=this.doFillResourceDataTransfers([this.groupView.activeEditor],e,o)),!n&&ed&&e.dataTransfer?.setData(Fl.TEXT,String(this.groupView.label)),this.groupView.activeEditor){let r=this.groupView.activeEditor.getName();this.groupsView.partOptions.showTabs==="multiple"&&this.groupView.count>1&&(r=d(4950,null,r,this.groupView.count-1)),LA(e,t,r)}return o}async onGroupDragEnd(e,t,o,n){if(this.groupTransfer.clearData(ey.prototype),e.target!==o||!n||n0t())return;let r=await this.maybeCreateAuxiliaryEditorPartAt(e,o);if(!r)return;let s=r.activeGroup;this.groupsView.mergeGroup(this.groupView,s.id,{mode:this.isMoveOperation(t??e,s.id)?1:0}),s.focus()}async maybeCreateAuxiliaryEditorPartAt(e,t){let{point:o,display:n}=await this.hostService.getCursorScreenPoint()??{point:{x:e.screenX,y:e.screenY}},r=zi();if(r.document.visibilityState==="visible"&&r.document.hasFocus()&&o.x>=r.screenX&&o.x<=r.screenX+r.outerWidth&&o.y>=r.screenY&&o.y<=r.screenY+r.outerHeight)return;let s=t.offsetWidth/2,l=30+t.offsetHeight/2,c={x:o.x-s,y:o.y-l};return n&&(c.x<n.x&&(c.x=n.x),c.y<n.y&&(c.y=n.y)),this.editorPartsView.createAuxiliaryEditorPart({bounds:c})}isNewWindowOperation(e){return this.groupsView.partOptions.dragToOpenWindow?!e.altKey:e.altKey}isMoveOperation(e,t,o){return o?.hasCapability(8)?!0:!(e.ctrlKey&&!et||e.altKey&&et)||t===this.groupView.id}doFillResourceDataTransfers(e,t,o){return e.length?(this.instantiationService.invokeFunction(kv,e.map(n=>({editor:n,groupId:this.groupView.id})),t,{disableStandardTransfer:o}),!0):!1}onTabContextMenu(e,t,o){this.resourceContext.set(po.getOriginalUri(e,{supportSideBySide:1})),this.editorPinnedContext.set(this.tabsModel.isPinned(e)),this.editorIsFirstContext.set(this.tabsModel.isFirst(e)),this.editorIsLastContext.set(this.tabsModel.isLast(e)),this.editorStickyContext.set(this.tabsModel.isSticky(e)),this.groupLockedContext.set(this.tabsModel.isLocked),this.editorCanSplitInGroupContext.set(e.hasCapability(32)),this.sideBySideEditorContext.set(e.typeId===ja.ID),iPt(this.editorAvailableEditorIds,e,this.editorResolverService);let n=o;Wp(t)&&(n=new Ln(Me(o),t)),this.contextMenuService.showContextMenu({getAnchor:()=>n,menuId:R.EditorTitleContext,menuActionOptions:{shouldForwardArgs:!0,arg:this.resourceContext.get()},contextKeyService:this.contextMenuContextKeyService,getActionsContext:()=>({groupId:this.groupView.id,editorIndex:this.groupView.getIndexOfEditor(e)}),getKeyBinding:r=>this.keybindingService.lookupKeybinding(r.id,this.contextMenuContextKeyService),onHide:()=>this.groupsView.activeGroup.focus()})}getKeybinding(e){return this.keybindingService.lookupKeybinding(e.id,this.getEditorPaneAwareContextKeyService())}getKeybindingLabel(e){let t=this.getKeybinding(e);return t?t.getLabel()??void 0:void 0}get tabHeight(){return this.groupsView.partOptions.tabHeight!=="compact"?HN.EDITOR_TAB_HEIGHT.normal:HN.EDITOR_TAB_HEIGHT.compact}getHoverTitle(e){let t=e.getTitle(2);return this.tabsModel.isPinned(e)?t:{markdown:new he("",{supportThemeIcons:!0,isTrusted:!0}).appendText(t).appendMarkdown(' (_preview_ [$(gear)](command:workbench.action.openSettings?%5B%22workbench.editor.enablePreview%22%5D "Configure Preview Mode"))'),markdownNotSupportedFallback:t+" (preview)"}}updateTabHeight(){this.parent.style.setProperty("--editor-group-tab-height",`${this.tabHeight}px`)}updateOptions(e,t){e.tabHeight!==t.tabHeight&&this.updateTabHeight(),(e.editorActionsLocation!==t.editorActionsLocation||e.showTabs!==t.showTabs)&&(this.editorActionsToolbarContainer&&(this.handleEditorActionToolBarVisibility(this.editorActionsToolbarContainer),this.updateEditorActionsToolbar()),this.editorLayoutActionsToolbarContainer&&(this.handleEditorLayoutActionsToolBarVisibility(this.editorLayoutActionsToolbarContainer),this.updateEditorLayoutActionsToolbar()))}};HN=I([m(5,Xe),m(6,F),m(7,X),m(8,Le),m(9,Ne),m(10,$e),m(11,Pe),m(12,il),m(13,ti)],HN);var dUt=class extends k{constructor(e){super();this.model=e;this._onDidModelChange=this._register(new T);this.onDidModelChange=this._onDidModelChange.event;this._register(this.model.onDidModelChange(t=>{let o=t.editorIndex??t.editor;o!==void 0&&!this.filter(o)||this._onDidModelChange.fire(t)}))}get id(){return this.model.id}get isLocked(){return this.model.isLocked}get stickyCount(){return this.model.stickyCount}get activeEditor(){return this.model.activeEditor&&this.filter(this.model.activeEditor)?this.model.activeEditor:null}get previewEditor(){return this.model.previewEditor&&this.filter(this.model.previewEditor)?this.model.previewEditor:null}get selectedEditors(){return this.model.selectedEditors.filter(e=>this.filter(e))}isPinned(e){return this.model.isPinned(e)}isTransient(e){return this.model.isTransient(e)}isSticky(e){return this.model.isSticky(e)}isActive(e){return this.model.isActive(e)}isSelected(e){return this.model.isSelected(e)}isFirst(e){return this.model.isFirst(e,this.getEditors(1))}isLast(e){return this.model.isLast(e,this.getEditors(1))}getEditors(e,t){return this.model.getEditors(e,t).filter(n=>this.filter(n))}findEditor(e,t){let o=this.model.findEditor(e,t);if(o)return this.filter(o[1])?o:void 0}},kPe=class extends dUt{get count(){return this.model.stickyCount}getEditors(i,e){return e?.excludeSticky?[]:i===1?this.model.getEditors(1).slice(0,this.model.stickyCount):super.getEditors(i,e)}isSticky(i){return!0}getEditorByIndex(i){return i<this.count?this.model.getEditorByIndex(i):void 0}indexOf(i,e,t){let o=this.model.indexOf(i,e,t);return o<0||o>=this.model.stickyCount?-1:o}contains(i,e){let t=this.model.indexOf(i,void 0,e);return t>=0&&t<this.model.stickyCount}filter(i){return this.model.isSticky(i)}},EPe=class extends dUt{get count(){return this.model.count-this.model.stickyCount}get stickyCount(){return 0}isSticky(i){return!1}getEditors(i,e){return i===1?this.model.getEditors(1).slice(this.model.stickyCount):super.getEditors(i,e)}getEditorByIndex(i){return i>=0?this.model.getEditorByIndex(i+this.model.stickyCount):void 0}indexOf(i,e,t){let o=this.model.indexOf(i,e,t);return o<this.model.stickyCount||o>=this.model.count?-1:o-this.model.stickyCount}contains(i,e){let t=this.model.indexOf(i,void 0,e);return t>=this.model.stickyCount&&t<this.model.count}filter(i){return!this.model.isSticky(i)}};var iy=class extends HN{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,o,n,r,s,l,c,u,p,h,g,S,y);this.editorService=f;this.pathService=v;this.treeViewsDragAndDropService=b;this.closeEditorAction=this._register(this.instantiationService.createInstance(Nte,Nte.ID,Nte.LABEL));this.unpinEditorAction=this._register(this.instantiationService.createInstance(_W,_W.ID,_W.LABEL));this.tabResourceLabels=this._register(this.instantiationService.createInstance(jl,JH));this.tabLabels=[];this.tabActionBars=[];this.tabDisposables=[];this.dimensions={container:di.None,available:di.None};this.layoutScheduler=this._register(new ue);this.path=ii?Gs:Vo;this.lastMouseWheelEventTime=0;this.isMouseOverTabs=!1;this.updateEditorLabelScheduler=this._register(new Dt(()=>this.doUpdateEditorLabels(),0));(async()=>this.path=await this.pathService.path)(),this._register(this.tabResourceLabels.onDidChangeDecorations(()=>this.doHandleDecorationsChange()))}static{this.SCROLLBAR_SIZES={default:3,large:10}}static{this.TAB_WIDTH={compact:38,shrink:80,fit:120}}static{this.DRAG_OVER_OPEN_TAB_THRESHOLD=1500}static{this.MOUSE_WHEEL_EVENT_THRESHOLD=150}static{this.MOUSE_WHEEL_DISTANCE_THRESHOLD=1.5}create(e){return super.create(e),this.titleContainer=e,this.tabsAndActionsContainer=_(".tabs-and-actions-container"),this.titleContainer.appendChild(this.tabsAndActionsContainer),this.tabsContainer=_(".tabs-container",{role:"tablist",draggable:!0}),this._register(ds.addTarget(this.tabsContainer)),this.tabSizingFixedDisposables=this._register(new O),this.updateTabSizing(!1),this.tabsScrollbar=this.createTabsScrollbar(this.tabsContainer),this.tabsAndActionsContainer.appendChild(this.tabsScrollbar.getDomNode()),this.registerTabsContainerListeners(this.tabsContainer,this.tabsScrollbar),this.createEditorActionsToolBar(this.tabsAndActionsContainer,["editor-actions"]),this.updateTabsControlVisibility(),this.tabsAndActionsContainer}createTabsScrollbar(e){let t=this._register(new gX(e,{horizontal:this.getTabsScrollbarVisibility(),horizontalScrollbarSize:this.getTabsScrollbarSizing(),vertical:2,scrollYToX:!0,useShadows:!1}));return this._register(t.onScroll(o=>{o.scrollLeftChanged&&(e.scrollLeft=o.scrollLeft)})),t}updateTabsScrollbarSizing(){this.tabsScrollbar?.updateOptions({horizontalScrollbarSize:this.getTabsScrollbarSizing()})}updateTabsScrollbarVisibility(){this.tabsScrollbar?.updateOptions({horizontal:this.getTabsScrollbarVisibility()})}updateTabSizing(e){let[t,o]=Ow(this.tabsContainer,this.tabSizingFixedDisposables);o.clear();let n=this.groupsView.partOptions;n.tabSizing==="fixed"?(t.style.setProperty("--tab-sizing-fixed-min-width",`${n.tabSizingFixedMinWidth}px`),t.style.setProperty("--tab-sizing-fixed-max-width",`${n.tabSizingFixedMaxWidth}px`),o.add($(t,ne.MOUSE_ENTER,()=>{this.isMouseOverTabs=!0})),o.add($(t,ne.MOUSE_LEAVE,()=>{this.isMouseOverTabs=!1,this.updateTabsFixedWidth(!1)}))):e&&(t.style.removeProperty("--tab-sizing-fixed-min-width"),t.style.removeProperty("--tab-sizing-fixed-max-width"),this.updateTabsFixedWidth(!1))}updateTabsFixedWidth(e){this.forEachTab((t,o,n)=>{if(e){let{width:r}=n.getBoundingClientRect();n.style.setProperty("--tab-sizing-current-width",`${r}px`)}else n.style.removeProperty("--tab-sizing-current-width")})}getTabsScrollbarSizing(){return this.groupsView.partOptions.titleScrollbarSizing!=="large"?iy.SCROLLBAR_SIZES.default:iy.SCROLLBAR_SIZES.large}getTabsScrollbarVisibility(){switch(this.groupsView.partOptions.titleScrollbarVisibility){case"visible":return 3;case"hidden":return 2;default:return 1}}registerTabsContainerListeners(e,t){this._register($(e,ne.SCROLL,()=>{e.classList.contains("scroll")&&t.setScrollPosition({scrollLeft:e.scrollLeft})}));for(let s of[Vn.Tap,ne.DBLCLICK])this._register($(e,s,l=>{if(s===ne.DBLCLICK){if(l.target!==e)return}else if(l.tapCount!==2||l.initialTarget!==e)return;Kt.stop(l),this.editorService.openEditor({resource:void 0,options:{pinned:!0,index:this.groupView.count,override:Da.id}},this.groupView.id)}));this._register($(e,ne.MOUSE_DOWN,s=>{s.button===1&&s.preventDefault()})),Sn&&this._register($(e,ne.MOUSE_UP,s=>{s.button===1&&s.preventDefault()}));let o,n=!1;this._register(new wg(e,{onDragStart:s=>{n=this.onGroupDragStart(s,e)},onDrag:s=>{o=s},onDragEnter:s=>{if(e.classList.add("scroll"),s.target===e){if(!this.isSupportedDropTransfer(s)){s.dataTransfer&&(s.dataTransfer.dropEffect="none");return}this.editorTransfer.hasData(xv.prototype)||s.dataTransfer&&(s.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,s)}},onDragLeave:s=>{this.updateDropFeedback(e,!1,s),e.classList.remove("scroll")},onDragEnd:s=>{this.updateDropFeedback(e,!1,s),e.classList.remove("scroll"),this.onGroupDragEnd(s,o,e,n)},onDrop:s=>{if(this.updateDropFeedback(e,!1,s),e.classList.remove("scroll"),s.target===e){let l=this.groupTransfer.hasData(ey.prototype);this.onDrop(s,l?this.groupView.count:this.tabsModel.count,e)}}})),this._register($(e,ne.MOUSE_WHEEL,s=>{let l=this.groupView.activeEditor;if(!l||this.groupView.count<2)return;if(this.groupsView.partOptions.scrollToSwitchTabs===!0){if(s.shiftKey)return}else if(!s.shiftKey)return;let c=Date.now();if(c-this.lastMouseWheelEventTime<iy.MOUSE_WHEEL_EVENT_THRESHOLD-2*(Math.abs(s.deltaX)+Math.abs(s.deltaY)))return;this.lastMouseWheelEventTime=c;let u;if(s.deltaX+s.deltaY<-iy.MOUSE_WHEEL_DISTANCE_THRESHOLD)u=-1;else if(s.deltaX+s.deltaY>iy.MOUSE_WHEEL_DISTANCE_THRESHOLD)u=1;else return;let p=this.groupView.getEditorByIndex(this.groupView.getIndexOfEditor(l)+u);p&&(this.groupView.openEditor(p),Kt.stop(s,!0))}));let r=s=>{Kt.stop(s);let l=e;Wp(s)&&(l=new Ln(Me(this.parent),s)),this.contextMenuService.showContextMenu({getAnchor:()=>l,menuId:R.EditorTabsBarContext,contextKeyService:this.contextKeyService,menuActionOptions:{shouldForwardArgs:!0},getActionsContext:()=>({groupId:this.groupView.id}),getKeyBinding:c=>this.getKeybinding(c),onHide:()=>this.groupView.focus()})};this._register($(e,Vn.Contextmenu,s=>r(s))),this._register($(e,ne.CONTEXT_MENU,s=>r(s)))}doHandleDecorationsChange(){this.layout(this.dimensions)}updateEditorActionsToolbar(){super.updateEditorActionsToolbar(),this.layout(this.dimensions)}openEditor(e,t){let o=this.handleOpenedEditors();return t?.focusTabControl&&this.withTab(e,(n,r,s)=>s.focus()),o}openEditors(e){return this.handleOpenedEditors()}handleOpenedEditors(){this.updateTabsControlVisibility();let[e,t]=Ow(this.tabsContainer,this.tabsScrollbar);for(let s=e.children.length;s<this.tabsModel.count;s++)e.appendChild(this.createTab(s,e,t));let o=this.didActiveEditorChange(),n=this.tabLabels;this.computeTabLabels();let r=!1;return o||n.length!==this.tabLabels.length||n.some((s,l)=>!this.equalsEditorInputLabel(s,this.tabLabels.at(l)))?(this.redraw({forceRevealActiveTab:!0}),r=!0):this.layout(this.dimensions,{forceRevealActiveTab:!0}),r}didActiveEditorChange(){return!!(!this.activeTabLabel?.editor&&this.tabsModel.activeEditor||this.activeTabLabel?.editor&&!this.tabsModel.activeEditor||!this.activeTabLabel?.editor||!this.tabsModel.isActive(this.activeTabLabel.editor))}equalsEditorInputLabel(e,t){return e===t?!0:!e||!t?!1:e.name===t.name&&e.description===t.description&&e.forceDescription===t.forceDescription&&e.title===t.title&&e.ariaLabel===t.ariaLabel}beforeCloseEditor(e){if(this.isMouseOverTabs&&this.groupsView.partOptions.tabSizing==="fixed"){let t=this.tabsModel.isLast(e);this.updateTabsFixedWidth(!t)}}closeEditor(e){this.handleClosedEditors()}closeEditors(e){this.handleClosedEditors()}handleClosedEditors(){if(this.tabsModel.count){let e=Ti(this.tabsContainer);for(;e.children.length>this.tabsModel.count;)e.lastChild?.remove(),je(this.tabDisposables.pop());this.computeTabLabels(),this.redraw({forceRevealActiveTab:!0})}else this.tabsContainer&&St(this.tabsContainer),this.tabDisposables=je(this.tabDisposables),this.tabResourceLabels.clear(),this.tabLabels=[],this.activeTabLabel=void 0,this.tabActionBars=[],this.clearEditorActionsToolbar(),this.updateTabsControlVisibility()}moveEditor(e,t,o){let n=this.tabLabels[t];this.tabLabels.splice(t,1),this.tabLabels.splice(o,0,n),this.forEachTab((r,s,l,c,u,p)=>{this.redrawTab(r,s,l,c,u,p)},Math.min(t,o),Math.max(t,o)),this.layout(this.dimensions,{forceRevealActiveTab:!0})}pinEditor(e){this.withTab(e,(t,o,n,r,s)=>this.redrawTabLabel(t,o,n,r,s))}stickEditor(e){this.doHandleStickyEditorChange(e)}unstickEditor(e){this.doHandleStickyEditorChange(e)}doHandleStickyEditorChange(e){this.withTab(e,(t,o,n,r,s,l)=>this.redrawTab(t,o,n,r,s,l)),this.forEachTab((t,o,n,r,s)=>{this.redrawTabBorders(o,n)}),this.layout(this.dimensions,{forceRevealActiveTab:!0})}setActive(e){this.forEachTab((t,o,n,r,s,l)=>{this.redrawTabSelectedActiveAndDirty(e,t,n,l)}),this.updateEditorActionsToolbar(),this.layout(this.dimensions,{forceRevealActiveTab:!0})}updateEditorSelections(){this.forEachTab((e,t,o,n,r,s)=>{this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,o,s)})}updateEditorLabel(e){this.updateEditorLabelScheduler.schedule()}doUpdateEditorLabels(){this.computeTabLabels(),this.forEachTab((e,t,o,n,r)=>{this.redrawTabLabel(e,t,o,n,r)}),this.layout(this.dimensions)}updateEditorDirty(e){this.withTab(e,(t,o,n,r,s,l)=>this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,t,n,l))}updateOptions(e,t){super.updateOptions(e,t),e.labelFormat!==t.labelFormat&&this.computeTabLabels(),e.titleScrollbarSizing!==t.titleScrollbarSizing&&this.updateTabsScrollbarSizing(),e.titleScrollbarVisibility!==t.titleScrollbarVisibility&&this.updateTabsScrollbarVisibility(),e.alwaysShowEditorActions!==t.alwaysShowEditorActions&&this.updateEditorActionsToolbar(),(e.tabSizingFixedMinWidth!==t.tabSizingFixedMinWidth||e.tabSizingFixedMaxWidth!==t.tabSizingFixedMaxWidth||e.tabSizing!==t.tabSizing)&&this.updateTabSizing(!0),(e.labelFormat!==t.labelFormat||e.tabActionLocation!==t.tabActionLocation||e.tabActionCloseVisibility!==t.tabActionCloseVisibility||e.tabActionUnpinVisibility!==t.tabActionUnpinVisibility||e.tabSizing!==t.tabSizing||e.pinnedTabSizing!==t.pinnedTabSizing||e.showIcons!==t.showIcons||e.hasIcons!==t.hasIcons||e.highlightModifiedTabs!==t.highlightModifiedTabs||e.wrapTabs!==t.wrapTabs||e.showTabIndex!==t.showTabIndex||!Qi(e.decorations,t.decorations))&&this.redraw()}updateStyles(){this.redraw()}forEachTab(e,t,o){this.tabsModel.getEditors(1).forEach((n,r)=>{typeof t=="number"&&t>r||typeof o=="number"&&o<r||this.doWithTab(r,n,e)})}withTab(e,t){this.doWithTab(this.tabsModel.indexOf(e),e,t)}doWithTab(e,t,o){let r=Ti(this.tabsContainer).children[e],s=this.tabResourceLabels.get(e),l=this.tabLabels[e],c=this.tabActionBars[e];r&&s&&l&&o(t,e,r,s,l,c)}createTab(e,t,o){let n=_(".tab",{draggable:!0,role:"tab"}),r=ds.addTarget(n),s=_(".tab-border-top-container");n.appendChild(s);let l=this.tabResourceLabels.create(n,{hoverTargetOverride:n}),c=_(".tab-actions");n.appendChild(c);let u=this,p=new Ute({groupId:this.groupView.id,get editorIndex(){return u.toEditorIndex(e)}}),h=new oo(c,{ariaLabel:d(4956,null),actionRunner:p}),g=h.onWillRun(y=>{y.action.id===this.closeEditorAction.id&&this.blockRevealActiveTabOnce()}),f=Fn(p,h,g,ee(vg(this.tabActionBars,h))),v=_(".tab-fade-hider");n.appendChild(v);let b=_(".tab-border-bottom-container");n.appendChild(b);let S=this.registerTabListeners(n,e,t,o);return this.tabDisposables.push(Fn(r,S,f,l)),n}toEditorIndex(e){let t=Ti(this.tabsModel.getEditorByIndex(e));return this.groupView.getIndexOfEditor(t)}registerTabListeners(e,t,o,n){let r=new O,s=async(p,h)=>{if(e.blur(),Wp(p)&&(p.button!==0||et&&p.ctrlKey)){p.button===1&&p.preventDefault();return}if(this.originatesFromTabActionBar(p))return;let g=this.tabsModel.getEditorByIndex(t);if(g)if(p.shiftKey){let f;if(this.lastSingleSelectSelectedEditor&&this.tabsModel.isSelected(this.lastSingleSelectSelectedEditor))f=this.lastSingleSelectSelectedEditor;else{let v=Ti(this.groupView.activeEditor);this.lastSingleSelectSelectedEditor=v,f=v}await this.selectEditorsBetween(g,f)}else if(p.ctrlKey&&!et||p.metaKey&&et)this.tabsModel.isSelected(g)?await this.unselectEditor(g):(await this.selectEditor(g),this.lastSingleSelectSelectedEditor=g);else{let f=this.tabsModel.isSelected(g)?this.groupView.selectedEditors.filter(v=>!v.matches(g)):[];await this.groupView.openEditor(g,{preserveFocus:h,activation:1},{inactiveSelection:f,focusTabControl:!0})}},l=p=>{Kt.stop(p);let h=this.tabsModel.getEditorByIndex(t);h&&this.onTabContextMenu(h,p,e)};r.add($(e,ne.MOUSE_DOWN,p=>s(p,!1))),r.add($(e,Vn.Tap,p=>s(p,!0))),r.add($(e,Vn.Change,p=>{n.setScrollPosition({scrollLeft:n.getScrollPosition().scrollLeft-p.translationX})})),r.add($(e,ne.MOUSE_UP,async p=>{if(Kt.stop(p),e.blur(),Wp(p)&&(p.button!==0||et&&p.ctrlKey)||this.originatesFromTabActionBar(p))return;!(p.ctrlKey&&!et||p.metaKey&&et)&&!p.shiftKey&&this.groupView.selectedEditors.length>1&&await this.unselectAllEditors()})),r.add($(e,ne.AUXCLICK,p=>{if(p.button===1){Kt.stop(p,!0);let h=this.tabsModel.getEditorByIndex(t);if(h){if(N_e(this.tabsModel,h,2,this.groupsView.partOptions))return;this.blockRevealActiveTabOnce(),this.closeEditorAction.run({groupId:this.groupView.id,editorIndex:this.groupView.getIndexOfEditor(h)})}}})),r.add($(e,ne.KEY_DOWN,p=>{let h=new mi(p);h.shiftKey&&h.keyCode===68&&l(p)})),r.add($(e,Vn.Contextmenu,p=>{l(p)})),r.add($(e,ne.KEY_UP,p=>{let h=new mi(p),g=!1;if(h.equals(3)||h.equals(10)){g=!0;let f=this.tabsModel.getEditorByIndex(t);f&&this.groupView.openEditor(f)}else if([15,17,16,18,14,13].some(f=>h.equals(f))){let f=this.toEditorIndex(t);h.equals(15)||h.equals(16)?f=f-1:h.equals(17)||h.equals(18)?f=f+1:h.equals(14)?f=0:f=this.groupView.count-1;let v=this.groupView.getEditorByIndex(f);v&&(g=!0,this.groupView.openEditor(v,{preserveFocus:!0},{focusTabControl:!0}))}g&&Kt.stop(p,!0),n.setScrollPosition({scrollLeft:o.scrollLeft})}));for(let p of[Vn.Tap,ne.DBLCLICK])r.add($(e,p,h=>{if(p===ne.DBLCLICK)Kt.stop(h);else if(h.tapCount!==2)return;let g=this.tabsModel.getEditorByIndex(t);if(g&&this.tabsModel.isPinned(g))switch(this.groupsView.partOptions.doubleClickTabToToggleEditorGroupSizes){case"maximize":this.groupsView.toggleMaximizeGroup(this.groupView);break;case"expand":this.groupsView.toggleExpandGroup(this.groupView);break;case"off":break}else this.groupView.pinEditor(g)}));r.add($(e,ne.CONTEXT_MENU,p=>{Kt.stop(p,!0);let h=this.tabsModel.getEditorByIndex(t);h&&this.onTabContextMenu(h,p,e)},!0));let c,u=!1;return r.add(new wg(e,{onDragStart:p=>{let h=this.tabsModel.getEditorByIndex(t);if(!h)return;u=this.isNewWindowOperation(p);let g=this.groupView.selectedEditors;if(this.editorTransfer.setData(g.map(f=>new xv({editor:f,groupId:this.groupView.id})),xv.prototype),p.dataTransfer)if(p.dataTransfer.effectAllowed="copyMove",g.length>1){let f=`${h.getName()} + ${g.length-1}`;LA(p,e,f)}else{let f=this.groupsView.partOptions,v=this.tabsModel.isSticky(t);f.tabSizing==="shrink"||v&&f.pinnedTabSizing==="shrink"?LA(p,e,h.getName()):p.dataTransfer.setDragImage(e,0,0)}this.doFillResourceDataTransfers(g,p,u),kr(Me(this.parent),()=>this.updateDropFeedback(e,!1,p,t))},onDrag:p=>{c=p},onDragEnter:p=>{if(!this.isSupportedDropTransfer(p)){p.dataTransfer&&(p.dataTransfer.dropEffect="none");return}this.editorTransfer.hasData(xv.prototype)||p.dataTransfer&&(p.dataTransfer.dropEffect="copy"),this.updateDropFeedback(e,!0,p,t)},onDragOver:(p,h)=>{if(h>=iy.DRAG_OVER_OPEN_TAB_THRESHOLD){let g=this.tabsModel.getEditorByIndex(t);g&&this.tabsModel.activeEditor!==g&&this.groupView.openEditor(g,{preserveFocus:!0})}this.updateDropFeedback(e,!0,p,t)},onDragEnd:async p=>{this.updateDropFeedback(e,!1,p,t);let h=this.editorTransfer.getData(xv.prototype);if(this.editorTransfer.clearData(xv.prototype),!u||n0t()||!h||h.length===0)return;let g=await this.maybeCreateAuxiliaryEditorPartAt(p,e);if(!g)return;let f=g.activeGroup,v=see(this.groupView,h.map(b=>b.identifier.editor));this.isMoveOperation(c??p,f.id,h[0].identifier.editor)?this.groupView.moveEditors(v,f):this.groupView.copyEditors(v,f),f.focus()},onDrop:p=>{this.updateDropFeedback(e,!1,p,t);let h=t;this.getTabDragOverLocation(p,e)==="right"&&h++,this.onDrop(p,h,o)}})),r}isSupportedDropTransfer(e){if(this.groupTransfer.hasData(ey.prototype)){let t=this.groupTransfer.getData(ey.prototype);return!(Array.isArray(t)&&t.length>0&&t[0].identifier===this.groupView.id)}return!!(this.editorTransfer.hasData(xv.prototype)||e.dataTransfer&&e.dataTransfer.types.length>0)}updateDropFeedback(e,t,o,n){let r=typeof n=="number",s;t?r?s=this.computeDropTarget(o,n,e):s={leftElement:e.lastElementChild,rightElement:void 0}:s=void 0,this.updateDropTarget(s)}updateDropTarget(e){let t=this.dropTarget;if(t===e||t&&e&&t.leftElement===e.leftElement&&t.rightElement===e.rightElement)return;let o="drop-target-left",n="drop-target-right";t&&(t.leftElement?.classList.remove(o),t.rightElement?.classList.remove(n)),e&&(e.leftElement?.classList.add(o),e.rightElement?.classList.add(n)),this.dropTarget=e}getTabDragOverLocation(e,t){let o=t.getBoundingClientRect();return e.clientX-o.left<=o.width/2?"left":"right"}computeDropTarget(e,t,o){let n=this.getTabDragOverLocation(e,o)==="left",r=t===this.tabsModel.count-1;if(n&&t===0)return{leftElement:void 0,rightElement:o};if(!n&&r)return{leftElement:o,rightElement:void 0};let l=n?o.previousElementSibling:o,c=n?o:o.nextElementSibling;return{leftElement:l,rightElement:c}}async selectEditor(e){this.groupView.isActive(e)||await this.groupView.setSelection(e,this.groupView.selectedEditors)}async selectEditorsBetween(e,t){let o=this.groupView.getIndexOfEditor(e);if(o===-1)throw new ci;let n=this.groupView.getIndexOfEditor(t);if(n===-1)throw new ci;let r=this.groupView.selectedEditors,s=n;for(;s>=0&&s<=this.groupView.count-1;){s=n<o?s-1:s+1;let h=this.groupView.getEditorByIndex(s);if(!h||!this.groupView.isSelected(h))break;r=r.filter(g=>!g.matches(h))}let l=n<o?n:o,c=n<o?o:n,u=this.groupView.getEditors(1).slice(l,c+1);for(let h of u)this.groupView.isSelected(h)||r.push(h);let p=r.filter(h=>!h.matches(e));await this.groupView.setSelection(e,p)}async unselectEditor(e){let t=this.groupView.isActive(e);if(t&&this.groupView.selectedEditors.length===1)return;let o=Ti(this.groupView.activeEditor);if(t){let r=this.groupView.getEditors(0);for(let s=1;s<r.length;s++){let l=r[s];if(this.groupView.isSelected(l)){o=l;break}}}let n=this.groupView.selectedEditors.filter(r=>!r.matches(e)&&!r.matches(o));await this.groupView.setSelection(o,n)}async unselectAllEditors(){if(this.groupView.selectedEditors.length>1){let e=Ti(this.groupView.activeEditor);await this.groupView.setSelection(e,[])}}computeTabLabels(){let{labelFormat:e}=this.groupsView.partOptions,{verbosity:t,shortenDuplicates:o}=this.getLabelConfigFlags(e),n=[],r=-1;this.tabsModel.getEditors(1).forEach((s,l)=>{n.push({editor:s,name:s.getName(),description:s.getDescription(t),forceDescription:s.hasCapability(64),title:s.getTitle(2),ariaLabel:ree(s,l,this.groupView,this.editorPartsView.count)}),s===this.tabsModel.activeEditor&&(r=l)}),o&&this.shortenTabLabels(n),this.tabLabels=n,this.activeTabLabel=n[r]}shortenTabLabels(e){let t=new Map;for(let o of e)typeof o.description=="string"?cB(t,o.name,[]).push(o):o.description="";for(let[,o]of t){if(o.length===1&&!o[0].forceDescription){o[0].description="";continue}let n=new Map;for(let c of o)cB(n,c.description,[]).push(c);let r=!1;for(let[,c]of n)if(!r&&c.length>1){let[u,...p]=c.map(({editor:h})=>h.getDescription(2));r=p.some(h=>h!==u)}if(r){n.clear();for(let c of o)c.description=c.editor.getDescription(2),cB(n,c.description,[]).push(c)}let s=[];for(let[c]of n)s.push(c);if(s.length===1){for(let c of n.get(s[0])||[])c.forceDescription||(c.description="");continue}let l=rxe(s,this.path.sep);s.forEach((c,u)=>{for(let p of n.get(c)||[])p.description=l[u]})}}getLabelConfigFlags(e){switch(e){case"short":return{verbosity:0,shortenDuplicates:!1};case"medium":return{verbosity:1,shortenDuplicates:!1};case"long":return{verbosity:2,shortenDuplicates:!1};default:return{verbosity:1,shortenDuplicates:!0}}}redraw(e){if(this.tabsAndActionsContainer){let t=this.getColor(Mro);!t&&Uf(this.theme.type)&&(t=this.getColor(tYe)||this.getColor(Ei)),t?(this.tabsAndActionsContainer.classList.add("tabs-border-bottom"),this.tabsAndActionsContainer.style.setProperty("--tabs-border-bottom-color",t.toString())):(this.tabsAndActionsContainer.classList.remove("tabs-border-bottom"),this.tabsAndActionsContainer.style.removeProperty("--tabs-border-bottom-color"))}this.forEachTab((t,o,n,r,s,l)=>{this.redrawTab(t,o,n,r,s,l)}),this.updateEditorActionsToolbar(),this.layout(this.dimensions,e)}redrawTab(e,t,o,n,r,s){let l=this.tabsModel.isSticky(t),c=this.groupsView.partOptions;this.redrawTabLabel(e,t,o,n,r);let u=l&&c.tabActionUnpinVisibility,p=!u&&c.tabActionCloseVisibility,h=u||p,g;h?g=u?this.unpinEditorAction:this.closeEditorAction:g=l?this.unpinEditorAction:this.closeEditorAction,s.hasAction(g)||(s.isEmpty()||s.clear(),s.push(g,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(g)})),o.classList.toggle("pinned-action-off",l&&!u),o.classList.toggle("close-action-off",!u&&!p);for(let v of["left","right"])o.classList.toggle(`tab-actions-${v}`,h&&c.tabActionLocation===v);let f=l&&c.pinnedTabSizing==="shrink"?"shrink":c.tabSizing;for(let v of["fit","shrink","fixed"])o.classList.toggle(`sizing-${v}`,f===v);o.classList.toggle("has-icon",c.showIcons&&c.hasIcons),o.classList.toggle("sticky",l);for(let v of["normal","compact","shrink"])o.classList.toggle(`sticky-${v}`,l&&c.pinnedTabSizing===v);if(!c.wrapTabs&&l&&c.pinnedTabSizing!=="normal"){let v=0;switch(c.pinnedTabSizing){case"compact":v=iy.TAB_WIDTH.compact;break;case"shrink":v=iy.TAB_WIDTH.shrink;break}o.style.left=`${t*v}px`}else o.style.left="auto";this.redrawTabBorders(t,o),this.redrawTabSelectedActiveAndDirty(this.groupsView.activeGroup===this.groupView,e,o,s)}redrawTabLabel(e,t,o,n,r){let s=this.groupsView.partOptions,l,c,u=!1,p=!!s.decorations?.badges,h=!!s.decorations?.colors,g;s.pinnedTabSizing==="compact"&&this.tabsModel.isSticky(t)?(l=s.showIcons&&s.hasIcons?"":r.name?.charAt(0).toUpperCase(),g="",u=!0,p=!1):(l=r.name,c=s.showTabIndex?`${this.toEditorIndex(t)+1}: `:void 0,g=r.description||""),r.ariaLabel&&(o.setAttribute("aria-label",r.ariaLabel),o.setAttribute("aria-description","")),n.setResource({name:l,description:g,resource:po.getOriginalUri(e,{supportSideBySide:3})},{title:this.getHoverTitle(e),extraClasses:ui(["tab-label",p?"tab-label-has-badge":void 0].concat(e.getLabelExtraClasses())),italic:!this.tabsModel.isPinned(e),forceLabel:u,fileDecorations:{colors:h,badges:p},icon:e.getIcon(),hideIcon:s.showIcons===!1,namePrefix:c});let f=po.getOriginalUri(e,{supportSideBySide:1});f?o.setAttribute("data-resource-name",sl(f)):o.removeAttribute("data-resource-name")}redrawTabSelectedActiveAndDirty(e,t,o,n){let r=this.tabsModel.isActive(t),s=this.doRedrawTabDirty(e,r,t,o);this.doRedrawTabActive(e,!s,t,o,n)}doRedrawTabActive(e,t,o,n,r){let s=this.tabsModel.isActive(o),l=this.tabsModel.isSelected(o);if(n.classList.toggle("active",s),n.classList.toggle("selected",l),n.setAttribute("aria-selected",s?"true":"false"),n.tabIndex=s?0:-1,r.setFocusable(s),s){let u=this.getColor(e?k_e:kro);n.classList.toggle("tab-border-bottom",!!u),n.style.setProperty("--tab-border-bottom-color",u??"")}let c=null;t&&(s&&(c=this.getColor(e?eYe:Ero)),c===null&&l&&(c=this.getColor(Tro))),n.classList.toggle("tab-border-top",!!c),n.style.setProperty("--tab-border-top-color",c??"")}doRedrawTabDirty(e,t,o,n){let r=!1;if(o.isDirty()&&!o.isSaving())if(n.classList.add("dirty"),this.groupsView.partOptions.highlightModifiedTabs){let s;e&&t?s=this.getColor(E_e):e&&!t?s=this.getColor(lMt):!e&&t?s=this.getColor(Dro):s=this.getColor(Rro),s&&(r=!0,n.classList.add("dirty-border-top"),n.style.setProperty("--tab-dirty-border-top-color",s))}else n.classList.remove("dirty-border-top"),n.style.removeProperty("--tab-dirty-border-top-color");else n.classList.remove("dirty","dirty-border-top"),n.style.removeProperty("--tab-dirty-border-top-color");return r}redrawTabBorders(e,t){let n=this.tabsModel.isSticky(e)&&this.tabsModel.stickyCount===e+1,r=this.tabsModel.stickyCount!==this.tabsModel.count,s=(n&&r?this.getColor(xro):void 0)||this.getColor(tYe)||this.getColor(Ei);t.style.borderRight=s?`1px solid ${s}`:"",t.style.outlineColor=this.getColor(la)||""}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(o=>o.id===W8),secondary:e.secondary}}prepareEditorLayoutActions(e){return e}getHeight(){return this.dimensions.used?this.dimensions.used.height:this.computeHeight()}computeHeight(){let e;return this.visible?this.groupsView.partOptions.wrapTabs&&this.tabsAndActionsContainer?.classList.contains("wrapping")?e=this.tabsAndActionsContainer.offsetHeight:e=this.tabHeight:e=0,e}layout(e,t){if(Object.assign(this.dimensions,e),this.visible){if(!this.layoutScheduler.value){let o=kr(Me(this.parent),()=>{this.doLayout(this.dimensions,this.layoutScheduler.value?.options),this.layoutScheduler.clear()});this.layoutScheduler.value={options:t,dispose:()=>o.dispose()}}t?.forceRevealActiveTab&&(this.layoutScheduler.value.options={...this.layoutScheduler.value.options,forceRevealActiveTab:!0})}return this.dimensions.used||(this.dimensions.used=new di(e.container.width,this.computeHeight())),this.dimensions.used}doLayout(e,t){e.container!==di.None&&e.available!==di.None&&this.doLayoutTabs(e,t);let o=this.dimensions.used,n=this.dimensions.used=new di(e.container.width,this.computeHeight());o&&o.height!==n.height&&this.groupView.relayout()}doLayoutTabs(e,t){this.doLayoutTabsWrapping(e)||this.doLayoutTabsNonWrapping(t)}doLayoutTabsWrapping(e){let[t,o,n,r]=Ow(this.tabsAndActionsContainer,this.tabsContainer,this.editorActionsToolbarContainer,this.tabsScrollbar),s=this.editorLayoutActionsToolbarContainer,l=()=>n.offsetWidth+(s?.offsetWidth??0),c=t.classList.contains("wrapping"),u=c;function p(h){u=h,t.classList.toggle("wrapping",u),o.style.setProperty("--last-tab-margin-right",u?`${l()}px`:"0"),t.style.setProperty("--last-tab-layout-actions-width",`${s?.offsetWidth??0}px`);for(let g of o.children)g.classList.remove("last-in-row")}if(this.groupsView.partOptions.wrapTabs){let h=o.offsetWidth,g=o.scrollWidth,f=()=>{let v=this.getLastTab();return v?!(v.offsetWidth+l()-e.available.width>1):!0};(u||g>h&&f())&&p(!0),u&&(o.offsetHeight>e.available.height||g===h&&o.offsetHeight===this.tabHeight||!f())&&p(!1)}else c&&p(!1);if(u&&!c){let h=o.offsetWidth;r.setScrollDimensions({width:h,scrollWidth:h})}if(u){let h=new Map,g,f;for(let v of o.children){let b=v,S=b.offsetTop;S!==g&&(g=S,f&&h.set(f,!0)),f=b,h.set(b,!1)}f&&h.set(f,!0);for(let[v,b]of h)v.classList.toggle("last-in-row",b)}return u}doLayoutTabsNonWrapping(e){let[t,o]=Ow(this.tabsContainer,this.tabsScrollbar),n=t.offsetWidth,r=t.scrollWidth,s=0;if(this.tabsModel.stickyCount>0){let E=0;switch(this.groupsView.partOptions.pinnedTabSizing){case"compact":E=iy.TAB_WIDTH.compact;break;case"shrink":E=iy.TAB_WIDTH.shrink;break}s=this.tabsModel.stickyCount*E}let l=this.tabsModel.activeEditor?this.getTabAndIndex(this.tabsModel.activeEditor):void 0,[c,u]=l??[void 0,void 0],p=this.groupsView.partOptions.pinnedTabSizing!=="normal"&&typeof u=="number"&&this.tabsModel.isSticky(u),h=n-s;this.tabsModel.stickyCount>0&&h<iy.TAB_WIDTH.fit?(t.classList.add("disable-sticky-tabs"),h=n,s=0,p=!1):t.classList.remove("disable-sticky-tabs");let g,f;!this.blockRevealActiveTab&&c&&(g=c.offsetLeft,f=c.offsetWidth);let{width:v,scrollWidth:b}=o.getScrollDimensions();o.setScrollDimensions({width:n,scrollWidth:r});let S=v!==n||b!==r;if(this.blockRevealActiveTab||typeof g!="number"||typeof f!="number"||p||!S&&!e?.forceRevealActiveTab){this.blockRevealActiveTab=!1;return}let y=o.getScrollPosition().scrollLeft,w=f<=h,x=g-s;w&&y+h<x+f?o.setScrollPosition({scrollLeft:y+(x+f-(y+h))}):(y>x||!w)&&o.setScrollPosition({scrollLeft:x})}updateTabsControlVisibility(){Ti(this.tabsAndActionsContainer).classList.toggle("empty",!this.visible),!this.visible&&this.dimensions&&(this.dimensions.used=void 0)}get visible(){return this.tabsModel.count>0}getTabAndIndex(e){let t=this.tabsModel.indexOf(e),o=this.getTabAtIndex(t);if(o)return[o,t]}getTabAtIndex(e){if(e>=0)return Ti(this.tabsContainer).children[e]}getLastTab(){return this.getTabAtIndex(this.tabsModel.count-1)}blockRevealActiveTabOnce(){this.blockRevealActiveTab=!0}originatesFromTabActionBar(e){let t;return Wp(e)?t=e.target||e.srcElement:t=e.initialTarget,!!rf(t,"action-item","tab")}async onDrop(e,t,o){Kt.stop(e,!0),this.updateDropFeedback(o,!1,e,t),o.classList.remove("scroll");let n=this.tabsModel instanceof EPe?t+this.groupView.stickyCount:t,r={sticky:this.tabsModel instanceof kPe&&this.tabsModel.stickyCount===n,index:n};if(this.groupTransfer.hasData(ey.prototype)){let s=this.groupTransfer.getData(ey.prototype);if(Array.isArray(s)&&s.length>0){let l=this.editorPartsView.getGroup(s[0].identifier);if(l){let c={index:n};this.isMoveOperation(e,l.id)||(c.mode=0),this.groupsView.mergeGroup(l,this.groupView,c)}this.groupView.focus(),this.groupTransfer.clearData(ey.prototype)}}else if(this.editorTransfer.hasData(xv.prototype)){let s=this.editorTransfer.getData(xv.prototype);if(Array.isArray(s)&&s.length>0){let l=this.editorPartsView.getGroup(s[0].identifier.groupId);if(l)for(let c of s){let u=c.identifier.editor;if(l.id!==c.identifier.groupId)continue;let p=l.getIndexOfEditor(u);l===this.groupView&&p<n&&n--,this.isMoveOperation(e,c.identifier.groupId,u)?l.moveEditor(u,this.groupView,{...r,index:n}):l.copyEditor(u,this.groupView,{...r,index:n}),n++}}this.groupView.focus(),this.editorTransfer.clearData(xv.prototype)}else if(this.treeItemsTransfer.hasData(xx.prototype)){let s=this.treeItemsTransfer.getData(xx.prototype);if(Array.isArray(s)&&s.length>0){let l=[];for(let c of s){let u=await this.treeViewsDragAndDropService.removeDragOperationTransfer(c.identifier);if(u){let p=await o0t(u);l.push(...p.map(h=>({...h,options:{...h.options,pinned:!0,index:n}})))}}this.editorService.openEditors(l,this.groupView,{validateTrust:!0})}this.treeItemsTransfer.clearData(xx.prototype)}else this.instantiationService.createInstance(uW,{allowWorkspaceOpen:!1}).handleDrop(e,Me(this.parent),()=>this.groupView,()=>this.groupView.focus(),r)}dispose(){super.dispose(),this.tabDisposables=je(this.tabDisposables)}};iy=I([m(5,Xe),m(6,F),m(7,X),m(8,Le),m(9,Ne),m(10,$e),m(11,Pe),m(12,ie),m(13,Pn),m(14,A4),m(15,il),m(16,ti)],iy);hs((a,i)=>{let e=a.getColor(tYe);e&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title > .tabs-and-actions-container.wrapping .tabs-container > .tab {
				border-bottom: 1px solid ${e};
			}
		`);let t=a.getColor(la);t&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active,
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:hover  {
				outline: 1px solid;
				outline-offset: -5px;
			}

			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.selected:not(.active):not(:hover)  {
				outline: 1px dotted;
				outline-offset: -5px;
			}

			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab.active:focus {
				outline-style: dashed;
			}

			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active {
				outline: 1px dotted;
				outline-offset: -5px;
			}

			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover  {
				outline: 1px dashed;
				outline-offset: -5px;
			}

			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active > .tab-actions .action-label,
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.active:hover > .tab-actions .action-label,
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.dirty > .tab-actions .action-label,
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky > .tab-actions .action-label,
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-actions .action-label {
				opacity: 1 !important;
			}
		`);let o=a.getColor(Ei);o&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .editor-actions {
				outline: 1px solid ${o}
			}
		`);let n=a.getColor(rMt);n&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:not(.selected):hover {
				background-color: ${n} !important;
			}
		`);let r=a.getColor(wro);r&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:not(.selected):hover  {
				background-color: ${r} !important;
			}
		`);let s=a.getColor(sMt);s&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:not(.selected):hover  {
				color: ${s} !important;
			}
		`);let l=a.getColor(Cro);l&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:not(.selected):hover  {
				color: ${l} !important;
			}
		`);let c=a.getColor(aMt);c&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container.active > .title .tabs-container > .tab:hover > .tab-border-bottom-container {
				display: block;
				position: absolute;
				left: 0;
				pointer-events: none;
				width: 100%;
				z-index: 10;
				bottom: 0;
				height: 1px;
				background-color: ${c};
			}
		`);let u=a.getColor(_ro);if(u&&i.addRule(`
			.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab:hover > .tab-border-bottom-container  {
				display: block;
				position: absolute;
				left: 0;
				pointer-events: none;
				width: 100%;
				z-index: 10;
				bottom: 0;
				height: 1px;
				background-color: ${u};
			}
		`),!Uf(a.type)&&!_S&&!t){let p=_0(a),h=a.getColor(Bo),g=a.getColor(dMt),f=a.getColor(ZT),v;g&&h&&(v=g.flatten(h,h,p));let b;g&&h&&f&&h&&(b=g.flatten(h,f,h,p));let S=(N,V,H=!1)=>`
			.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${H?".active":""} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after,
			.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${H?".active":""} > .title .tabs-container > .tab.sizing-fixed:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
				background: linear-gradient(to left, ${N}, transparent) !important;
			}

			.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${H?".active":""} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after,
			.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${H?".active":""} > .title .tabs-container > .tab.sizing-fixed:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
				background: linear-gradient(to left, ${V}, transparent) !important;
			}
		`;if(n&&v&&b){let N=n.flatten(v),V=n.flatten(b);i.addRule(S(N,V,!0))}if(r&&v&&b){let N=r.flatten(v),V=r.flatten(b);i.addRule(S(N,V))}if(f&&b){let N=f.flatten(b);i.addRule(`
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-fixed.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-fixed.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
					background: linear-gradient(to left, ${N}, transparent) !important;
				}
		`)}let y=(N,V,H,K)=>`
				.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${H?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-shrink${K?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${H?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-fixed${K?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
					background: linear-gradient(to left, ${N}, transparent);
				}

				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${H?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-shrink${K?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
				.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${H?".active":":not(.active)"} > .title .tabs-container > .tab.sizing-fixed${K?".active":""}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
					background: linear-gradient(to left, ${V}, transparent);
				}
		`,w=a.getColor(cMt);if(w&&v&&b){let N=w.flatten(v),V=w.flatten(b);i.addRule(y(N,V,!0,!0))}let x=a.getColor(Sro);if(x&&v&&b){let N=x.flatten(v),V=x.flatten(b);i.addRule(y(N,V,!1,!0))}let E=a.getColor(kbi);if(E&&v&&b){let N=E.flatten(v),V=E.flatten(b);i.addRule(y(N,V,!0,!1))}let M=a.getColor(Iro);if(M&&v&&b){let N=M.flatten(v),V=M.flatten(b);i.addRule(y(N,V,!1,!1))}}});var uUt=class extends HN{constructor(){super(...arguments);this.activeLabel=Object.create(null)}get breadcrumbsControl(){return this.breadcrumbsControlFactory?.control}create(e){super.create(e);let t=this.titleContainer=e;t.draggable=!0,this.registerContainerListeners(t),this._register(ds.addTarget(t));let o=_(".label-container");return t.appendChild(o),this.editorLabel=this._register(this.instantiationService.createInstance(CE,o,{})).element,this._register($(this.editorLabel.element,ne.CLICK,n=>this.onTitleLabelClick(n))),this.breadcrumbsControlFactory=this._register(this.instantiationService.createInstance(Hte,o,this.groupView,{showFileIcons:!1,showSymbolIcons:!0,showDecorationColors:!1,widgetStyles:{...YF,breadcrumbsBackground:Ue.transparent.toString()},showPlaceholder:!1,dragEditor:!0})),this._register(this.breadcrumbsControlFactory.onDidEnablementChange(()=>this.handleBreadcrumbsEnablementChange())),t.classList.toggle("breadcrumbs",!!this.breadcrumbsControl),this._register(ee(()=>t.classList.remove("breadcrumbs"))),this.createEditorActionsToolBar(t,["title-actions"]),t}registerContainerListeners(e){let t,o=!1;this._register(new wg(e,{onDragStart:n=>{o=this.onGroupDragStart(n,e)},onDrag:n=>{t=n},onDragEnd:n=>{this.onGroupDragEnd(n,t,e,o)}})),this._register($(e,ne.DBLCLICK,n=>this.onTitleDoubleClick(n))),this._register($(e,ne.AUXCLICK,n=>this.onTitleAuxClick(n))),this._register($(e,Vn.Tap,n=>this.onTitleTap(n)));for(let n of[ne.CONTEXT_MENU,Vn.Contextmenu])this._register($(e,n,r=>{this.tabsModel.activeEditor&&this.onTabContextMenu(this.tabsModel.activeEditor,r,e)}))}onTitleLabelClick(e){Kt.stop(e,!1),setTimeout(()=>this.quickInputService.quickAccess.show())}onTitleDoubleClick(e){Kt.stop(e),this.groupView.pinEditor()}onTitleAuxClick(e){e.button===1&&this.tabsModel.activeEditor&&(Kt.stop(e,!0),N_e(this.tabsModel,this.tabsModel.activeEditor,2,this.groupsView.partOptions)||this.groupView.closeEditor(this.tabsModel.activeEditor))}onTitleTap(e){let t=e.initialTarget;!go(t)||!this.editorLabel||!ms(t,this.editorLabel.element)||setTimeout(()=>this.quickInputService.quickAccess.show(),50)}openEditor(e){return this.doHandleOpenEditor()}openEditors(e){return this.doHandleOpenEditor()}doHandleOpenEditor(){let e=this.ifActiveEditorChanged(()=>this.redraw());return e||this.ifActiveEditorPropertiesChanged(()=>this.redraw()),e}beforeCloseEditor(e){}closeEditor(e){this.ifActiveEditorChanged(()=>this.redraw())}closeEditors(e){this.ifActiveEditorChanged(()=>this.redraw())}moveEditor(e,t,o){this.ifActiveEditorChanged(()=>this.redraw())}pinEditor(e){this.ifEditorIsActive(e,()=>this.redraw())}stickEditor(e){}unstickEditor(e){}setActive(e){this.redraw()}updateEditorSelections(){}updateEditorLabel(e){this.ifEditorIsActive(e,()=>this.redraw())}updateEditorDirty(e){this.ifEditorIsActive(e,()=>{let t=Ti(this.titleContainer);e.isDirty()&&!e.isSaving()?t.classList.add("dirty"):t.classList.remove("dirty")})}updateOptions(e,t){super.updateOptions(e,t),(e.labelFormat!==t.labelFormat||!Qi(e.decorations,t.decorations))&&this.redraw()}updateStyles(){this.redraw()}handleBreadcrumbsEnablementChange(){Ti(this.titleContainer).classList.toggle("breadcrumbs",!!this.breadcrumbsControl),this.redraw()}ifActiveEditorChanged(e){return!this.activeLabel.editor&&this.tabsModel.activeEditor||this.activeLabel.editor&&!this.tabsModel.activeEditor||!this.activeLabel.editor||!this.tabsModel.isActive(this.activeLabel.editor)?(e(),!0):!1}ifActiveEditorPropertiesChanged(e){!this.activeLabel.editor||!this.tabsModel.activeEditor||this.activeLabel.pinned!==this.tabsModel.isPinned(this.tabsModel.activeEditor)&&e()}ifEditorIsActive(e,t){this.tabsModel.isActive(e)&&t()}redraw(){let e=this.tabsModel.activeEditor??void 0,t=this.groupsView.partOptions,o=e?this.tabsModel.isPinned(e):!1,n=this.groupsView.activeGroup===this.groupView;this.activeLabel={editor:e,pinned:o},this.breadcrumbsControl&&(n?(this.breadcrumbsControl.update(),this.breadcrumbsControl.domNode.classList.toggle("preview",!o)):this.breadcrumbsControl.hide());let[r,s]=Ow(this.titleContainer,this.editorLabel);if(!e)r.classList.remove("dirty"),s.clear(),this.clearEditorActionsToolbar();else{this.updateEditorDirty(e);let{labelFormat:l}=this.groupsView.partOptions,c;this.breadcrumbsControl&&!this.breadcrumbsControl.isHidden()||l==="default"&&!n?c="":c=e.getDescription(this.getVerbosity(l))||"",s.setResource({resource:po.getOriginalUri(e,{supportSideBySide:3}),name:e.getName(),description:c},{title:this.getHoverTitle(e),italic:!o,extraClasses:["single-tab","title-label"].concat(e.getLabelExtraClasses()),fileDecorations:{colors:!!t.decorations?.colors,badges:!!t.decorations?.badges},icon:e.getIcon(),hideIcon:t.showIcons===!1}),n?r.style.color=this.getColor(IH)||"":r.style.color=this.getColor(yro)||"",this.updateEditorActionsToolbar()}}getVerbosity(e){switch(e){case"short":return 0;case"long":return 2;default:return 1}}prepareEditorActions(e){return this.groupsView.activeGroup===this.groupView?e:{primary:this.groupsView.partOptions.alwaysShowEditorActions?e.primary:e.primary.filter(o=>o.id===ok||o.id===W8),secondary:e.secondary}}prepareEditorLayoutActions(){return{primary:[],secondary:[]}}getHeight(){return this.tabHeight}layout(e){return this.breadcrumbsControl?.layout(void 0),new di(e.container.width,this.getHeight())}};var TPe=class extends k{constructor(e,t,o,n,r,s){super();this.parent=e;this.groupsView=o;this.groupView=n;this.model=r;this.instantiationService=s;let l=this._register(new kPe(this.model)),c=this._register(new EPe(this.model));this.stickyEditorTabsControl=this._register(this.instantiationService.createInstance(iy,this.parent,t,this.groupsView,this.groupView,l)),this.unstickyEditorTabsControl=this._register(this.instantiationService.createInstance(iy,this.parent,t,this.groupsView,this.groupView,c)),this.handleTabBarsStateChange()}handleTabBarsStateChange(){this.activeControl=this.model.activeEditor?this.getEditorTabsController(this.model.activeEditor):void 0,this.handleTabBarsLayoutChange()}handleTabBarsLayoutChange(){if(this.groupView.count===0)return;let e=this.parent.classList.contains("two-tab-bars"),t=this.groupView.count!==this.groupView.stickyCount&&this.groupView.stickyCount>0;this.parent.classList.toggle("two-tab-bars",t),e!==t&&this.groupView.relayout()}didActiveControlChange(){return this.activeControl!==(this.model.activeEditor?this.getEditorTabsController(this.model.activeEditor):void 0)}getEditorTabsController(e){return this.model.isSticky(e)?this.stickyEditorTabsControl:this.unstickyEditorTabsControl}openEditor(e,t){let o=this.didActiveControlChange(),r=this.getEditorTabsController(e).openEditor(e,t)||o;return r&&this.handleOpenedEditors(),r}openEditors(e){let t=e.filter(c=>this.model.isSticky(c)),o=e.filter(c=>!this.model.isSticky(c)),n=this.didActiveControlChange(),r=this.stickyEditorTabsControl.openEditors(t),s=this.unstickyEditorTabsControl.openEditors(o),l=r||s||n;return l&&this.handleOpenedEditors(),l}handleOpenedEditors(){this.handleTabBarsStateChange()}beforeCloseEditor(e){this.getEditorTabsController(e).beforeCloseEditor(e)}closeEditor(e){this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.closeEditor(e),this.handleClosedEditors()}closeEditors(e){let t=e.filter(n=>this.model.isSticky(n)),o=e.filter(n=>!this.model.isSticky(n));this.stickyEditorTabsControl.closeEditors(t),this.unstickyEditorTabsControl.closeEditors(o),this.handleClosedEditors()}handleClosedEditors(){this.handleTabBarsStateChange()}moveEditor(e,t,o,n){n?(this.model.isSticky(e)?(this.stickyEditorTabsControl.openEditor(e),this.unstickyEditorTabsControl.closeEditor(e)):(this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.openEditor(e)),this.handleTabBarsStateChange()):this.model.isSticky(e)?this.stickyEditorTabsControl.moveEditor(e,t,o,n):this.unstickyEditorTabsControl.moveEditor(e,t-this.model.stickyCount,o-this.model.stickyCount,n)}pinEditor(e){this.getEditorTabsController(e).pinEditor(e)}stickEditor(e){this.unstickyEditorTabsControl.closeEditor(e),this.stickyEditorTabsControl.openEditor(e),this.handleTabBarsStateChange()}unstickEditor(e){this.stickyEditorTabsControl.closeEditor(e),this.unstickyEditorTabsControl.openEditor(e),this.handleTabBarsStateChange()}setActive(e){this.stickyEditorTabsControl.setActive(e),this.unstickyEditorTabsControl.setActive(e)}updateEditorSelections(){this.stickyEditorTabsControl.updateEditorSelections(),this.unstickyEditorTabsControl.updateEditorSelections()}updateEditorLabel(e){this.getEditorTabsController(e).updateEditorLabel(e)}updateEditorDirty(e){this.getEditorTabsController(e).updateEditorDirty(e)}updateOptions(e,t){this.stickyEditorTabsControl.updateOptions(e,t),this.unstickyEditorTabsControl.updateOptions(e,t)}layout(e){let t=this.stickyEditorTabsControl.layout(e),o={container:e.container,available:new di(e.available.width,e.available.height-t.height)},n=this.unstickyEditorTabsControl.layout(o);return new di(e.container.width,t.height+n.height)}getHeight(){return this.stickyEditorTabsControl.getHeight()+this.unstickyEditorTabsControl.getHeight()}dispose(){this.parent.classList.toggle("two-tab-bars",!1),super.dispose()}};TPe=I([m(5,F)],TPe);var pUt=class extends HN{constructor(){super(...arguments);this.activeEditor=null}prepareEditorActions(e){return{primary:[],secondary:[]}}prepareEditorLayoutActions(){return{primary:[],secondary:[]}}openEditor(e){return this.handleOpenedEditors()}openEditors(e){return this.handleOpenedEditors()}handleOpenedEditors(){let e=this.activeEditorChanged();return this.activeEditor=this.tabsModel.activeEditor,e}activeEditorChanged(){return!!(!this.activeEditor&&this.tabsModel.activeEditor||this.activeEditor&&!this.tabsModel.activeEditor||!this.activeEditor||!this.tabsModel.isActive(this.activeEditor))}beforeCloseEditor(e){}closeEditor(e){this.handleClosedEditors()}closeEditors(e){this.handleClosedEditors()}handleClosedEditors(){this.activeEditor=this.tabsModel.activeEditor}moveEditor(e,t,o){}pinEditor(e){}stickEditor(e){}unstickEditor(e){}setActive(e){}updateEditorSelections(){}updateEditorLabel(e){}updateEditorDirty(e){}getHeight(){return 0}layout(e){return new di(e.container.width,this.getHeight())}};var _Pe=class extends ju{constructor(e,t,o,n,r,s,l){super(l);this.parent=e;this.editorPartsView=t;this.groupsView=o;this.groupView=n;this.model=r;this.instantiationService=s;this.editorTabsControlDisposable=this._register(new O);this.breadcrumbsControlDisposables=this._register(new O);this.editorTabsControl=this.createEditorTabsControl(),this.breadcrumbsControlFactory=this.createBreadcrumbsControl()}get breadcrumbsControl(){return this.breadcrumbsControlFactory?.control}createEditorTabsControl(){let e;switch(this.groupsView.partOptions.showTabs){case"none":e=pUt;break;case"single":e=uUt;break;default:e=this.groupsView.partOptions.pinnedTabsOnSeparateRow?TPe:iy;break}let t=this.instantiationService.createInstance(e,this.parent,this.editorPartsView,this.groupsView,this.groupView,this.model);return this.editorTabsControlDisposable.add(t)}createBreadcrumbsControl(){if(this.groupsView.partOptions.showTabs==="single")return;let e=_(".breadcrumbs-below-tabs");this.parent.appendChild(e);let t=this.breadcrumbsControlDisposables.add(this.instantiationService.createInstance(Hte,e,this.groupView,{showFileIcons:!0,showSymbolIcons:!0,showDecorationColors:!1,showPlaceholder:!0,dragEditor:!1}));return this.breadcrumbsControlDisposables.add(t.onDidEnablementChange(()=>this.groupView.relayout())),this.breadcrumbsControlDisposables.add(t.onDidVisibilityChange(()=>this.groupView.relayout())),t}openEditor(e,t){let o=this.editorTabsControl.openEditor(e,t);this.handleOpenedEditors(o)}openEditors(e){let t=this.editorTabsControl.openEditors(e);this.handleOpenedEditors(t)}handleOpenedEditors(e){e?this.breadcrumbsControl?.update():this.breadcrumbsControl?.revealLast()}beforeCloseEditor(e){return this.editorTabsControl.beforeCloseEditor(e)}closeEditor(e){this.editorTabsControl.closeEditor(e),this.handleClosedEditors()}closeEditors(e){this.editorTabsControl.closeEditors(e),this.handleClosedEditors()}handleClosedEditors(){this.groupView.activeEditor||this.breadcrumbsControl?.update()}moveEditor(e,t,o,n){return this.editorTabsControl.moveEditor(e,t,o,n)}pinEditor(e){return this.editorTabsControl.pinEditor(e)}stickEditor(e){return this.editorTabsControl.stickEditor(e)}unstickEditor(e){return this.editorTabsControl.unstickEditor(e)}setActive(e){return this.editorTabsControl.setActive(e)}updateEditorSelections(){this.editorTabsControl.updateEditorSelections()}updateEditorLabel(e){return this.editorTabsControl.updateEditorLabel(e)}updateEditorDirty(e){return this.editorTabsControl.updateEditorDirty(e)}updateOptions(e,t){e.showTabs!==t.showTabs||t.showTabs!=="single"&&e.pinnedTabsOnSeparateRow!==t.pinnedTabsOnSeparateRow?(this.editorTabsControlDisposable.clear(),this.breadcrumbsControlDisposables.clear(),St(this.parent),this.editorTabsControl=this.createEditorTabsControl(),this.breadcrumbsControlFactory=this.createBreadcrumbsControl()):this.editorTabsControl.updateOptions(e,t)}layout(e){let t=this.editorTabsControl.layout(e),o;return this.breadcrumbsControl?.isHidden()===!1&&(o=new di(e.container.width,Yc.HEIGHT),this.breadcrumbsControl.layout(o)),new di(e.container.width,t.height+(o?o.height:0))}getHeight(){let e=this.editorTabsControl.getHeight(),t=this.breadcrumbsControl?.isHidden()===!1?Yc.HEIGHT:0;return{total:e+t,offset:e}}};_Pe=I([m(5,F),m(6,Pe)],_Pe);var oy=class extends ju{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N){super(u);this.editorPartsView=t;this.groupsView=o;this.groupsLabel=n;this._index=r;this.instantiationService=l;this.contextKeyService=c;this.telemetryService=p;this.keybindingService=h;this.menuService=g;this.contextMenuService=f;this.fileDialogService=v;this.editorService=b;this.filesConfigurationService=S;this.uriIdentityService=y;this.logService=w;this.editorResolverService=x;this.hostService=E;this.dialogService=M;this.fileService=N;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this._onDidModelChange=this._register(new T);this.onDidModelChange=this._onDidModelChange.event;this._onDidActiveEditorChange=this._register(new T);this.onDidActiveEditorChange=this._onDidActiveEditorChange.event;this._onDidOpenEditorFail=this._register(new T);this.onDidOpenEditorFail=this._onDidOpenEditorFail.event;this._onWillCloseEditor=this._register(new T);this.onWillCloseEditor=this._onWillCloseEditor.event;this._onDidCloseEditor=this._register(new T);this.onDidCloseEditor=this._onDidCloseEditor.event;this._onWillMoveEditor=this._register(new T);this.onWillMoveEditor=this._onWillMoveEditor.event;this._onWillOpenEditor=this._register(new T);this.onWillOpenEditor=this._onWillOpenEditor.event;this.disposedEditorsWorker=this._register(new hA(e=>this.handleDisposedEditors(e),0));this.mapEditorToPendingConfirmation=new Map;this.containerToolBarMenuDisposable=this._register(new ue);this.whenRestoredPromise=new Mo;this.whenRestored=this.whenRestoredPromise.p;this._disposed=!1;this.element=_("div");this._onDidChange=this._register(new Ig);this.onDidChange=this._onDidChange.event;e instanceof oy?this.model=this._register(e.model.clone()):ZXe(e)?this.model=this._register(l.createInstance(gN,e)):this.model=this._register(l.createInstance(gN,void 0)),this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.element)),this.element.classList.add(...ui(["editor-group-container",this.model.isLocked?"locked":void 0])),this.registerContainerListeners(),this.createContainerToolbar(),this.createContainerContextMenu(),this._register(this.instantiationService.createInstance(rP,this.element)),this.progressBar=this._register(new Cv(this.element,oC)),this.progressBar.hide(),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new Po([X,this.scopedContextKeyService],[Hd,this._register(new AFt(this.progressBar,this))]))),this.resourceContext=this._register(this.scopedInstantiationService.createInstance(Ho)),this.handleGroupContextKeys(),this.titleContainer=_(".title"),this.element.appendChild(this.titleContainer),this.titleControl=this._register(this.scopedInstantiationService.createInstance(_Pe,this.titleContainer,this.editorPartsView,this.groupsView,this,this.model)),this.editorContainer=_(".editor-container"),this.element.appendChild(this.editorContainer),this.editorPane=this._register(this.scopedInstantiationService.createInstance(SPe,this.element,this.editorContainer,this)),this._onDidChange.input=this.editorPane.onDidChangeSizeConstraints,this.doTrackFocus(),this.updateTitleContainer(),this.updateContainer(),this.updateStyles(),(this.restoreEditors(e,s)??Promise.resolve()).finally(()=>{this.whenRestoredPromise.complete()}),this.registerListeners()}static createNew(e,t,o,n,r,s){return r.createInstance(oy,null,e,t,o,n,s)}static createFromSerialized(e,t,o,n,r,s,l){return s.createInstance(oy,e,t,o,n,r,l)}static createCopy(e,t,o,n,r,s,l){return s.createInstance(oy,e,t,o,n,r,l)}handleGroupContextKeys(){let e=this.editorPartsView.bind(xpe,this),t=this.editorPartsView.bind(K_e,this),o=this.editorPartsView.bind(KMt,this),n=this.editorPartsView.bind(kpe,this),r=this.editorPartsView.bind(NM,this),s=this.editorPartsView.bind(jMt,this),l=this.editorPartsView.bind(o_,this),c=I3.bindTo(this.scopedContextKeyService),u=QMt.bindTo(this.scopedContextKeyService),p=YMt.bindTo(this.scopedContextKeyService),h=this.editorPartsView.bind(Tr,this),g=this.editorPartsView.bind(Kso,this),f=this.editorPartsView.bind(qMt,this),v=this.editorPartsView.bind(GMt,this),b=this.editorPartsView.bind(G_e,this),S=this.editorPartsView.bind(IYe,this),y=this.editorPartsView.bind(GS,this),w=this.editorPartsView.bind(A0,this),x=this.editorPartsView.bind(wH,this),E=this.editorPartsView.bind(Dx,this),M=this._register(new ue),N=()=>{M.clear(),this.scopedContextKeyService.bufferChangeEvents(()=>{let H=this.activeEditor,K=this.activeEditorPane;if(this.resourceContext.set(po.getOriginalUri(H,{supportSideBySide:1})),iPt(w,H,this.editorResolverService),H?(x.set(H.hasCapability(32)),E.set(H.typeId===ja.ID),e.set(H.isDirty()&&!H.isSaving()),M.value=H.onDidChangeDirty(()=>{e.set(H.isDirty()&&!H.isSaving())})):(x.set(!1),E.set(!1),e.set(!1)),K){h.set(K.getId()),f.set(!K.input.hasCapability(4)),g.set(!!K.input.isReadonly());let j=po.getOriginalUri(K.input,{supportSideBySide:1}),J=po.getOriginalUri(K.input,{supportSideBySide:2});b.set(K.input instanceof Ba&&!K.input.original.isReadonly()&&!!j&&(this.fileService.hasProvider(j)||j.scheme===Q.untitled)&&!!J&&(this.fileService.hasProvider(J)||J.scheme===Q.untitled)),v.set(!!j&&this.fileService.hasProvider(j)&&!this.fileService.hasCapability(j,2048));let se=K?.getId()===hZ;y.set(se),S.set(se)}else h.reset(),f.reset(),g.reset(),b.reset(),v.reset()})},V=H=>{switch(H.kind){case 3:l.set(this.isLocked);break;case 8:o.set(this.model.isFirst(this.model.activeEditor)),n.set(this.model.isLast(this.model.activeEditor)),t.set(this.model.activeEditor?this.model.isPinned(this.model.activeEditor):!1),r.set(this.model.activeEditor?this.model.isSticky(this.model.activeEditor):!1);break;case 6:t.set(this.model.activeEditor?this.model.isPinned(this.model.activeEditor):!1),r.set(this.model.activeEditor?this.model.isSticky(this.model.activeEditor):!1);break;case 5:case 7:o.set(this.model.isFirst(this.model.activeEditor)),n.set(this.model.isLast(this.model.activeEditor));break;case 11:H.editor&&H.editor===this.model.activeEditor&&t.set(this.model.isPinned(this.model.activeEditor));break;case 13:H.editor&&H.editor===this.model.activeEditor&&r.set(this.model.isSticky(this.model.activeEditor));break;case 4:c.set(this.model.selectedEditors.length>1),u.set(this.model.selectedEditors.length===2),p.set(this.model.selectedEditors.every(K=>K.resource&&(this.fileService.hasProvider(K.resource)||K.resource.scheme===Q.untitled)));break}s.set(this.count)};this._register(this.onDidModelChange(H=>V(H))),this._register(this.onDidActiveEditorChange(()=>N())),N(),V({kind:8}),V({kind:3})}registerContainerListeners(){this._register($(this.element,ne.DBLCLICK,e=>{this.isEmpty&&(Kt.stop(e),this.editorService.openEditor({resource:void 0,options:{pinned:!0,override:Da.id}},this.id))})),this._register($(this.element,ne.AUXCLICK,e=>{this.isEmpty&&e.button===1&&(Kt.stop(e,!0),this.groupsView.removeGroup(this))}))}createContainerToolbar(){let e=_(".editor-group-container-toolbar");this.element.appendChild(e);let t=this._register(new oo(e,{ariaLabel:d(4851,null),highlightToggledItems:!0})),o=this._register(this.menuService.createMenu(R.EmptyEditorGroup,this.scopedContextKeyService)),n=()=>{this.containerToolBarMenuDisposable.value=ee(()=>t.clear());let r=xl(o.getActions({arg:{groupId:this.id},shouldForwardArgs:!0}),"navigation");for(let s of[...r.primary,...r.secondary]){let l=this.keybindingService.lookupKeybinding(s.id);t.push(s,{icon:!0,label:!1,keybinding:l?.getLabel()})}};n(),this._register(o.onDidChange(n))}createContainerContextMenu(){this._register($(this.element,ne.CONTEXT_MENU,e=>this.onShowContainerContextMenu(e))),this._register($(this.element,Vn.Contextmenu,()=>this.onShowContainerContextMenu()))}onShowContainerContextMenu(e){if(!this.isEmpty)return;let t=this.element;e&&(t=new Ln(Me(this.element),e)),this.contextMenuService.showContextMenu({menuId:R.EmptyEditorGroupContext,contextKeyService:this.contextKeyService,getAnchor:()=>t,onHide:()=>this.focus()})}doTrackFocus(){let e=this._register(nr(this.element));this._register(e.onDidFocus(()=>{this.isEmpty&&this._onDidFocus.fire()}));let t=o=>{let n;if(Wp(o)){if(o.button!==0||et&&o.ctrlKey)return;n=o.target}else n=o.initialTarget;rf(n,"monaco-action-bar",this.titleContainer)||rf(n,"monaco-breadcrumb-item",this.titleContainer)||setTimeout(()=>{this.focus()})};this._register($(this.titleContainer,ne.MOUSE_DOWN,o=>t(o))),this._register($(this.titleContainer,Vn.Tap,o=>t(o))),this._register(this.editorPane.onDidFocus(()=>{this._onDidFocus.fire()}))}updateContainer(){this.isEmpty?(this.element.classList.add("empty"),this.element.tabIndex=0,this.element.setAttribute("aria-label",d(4852,null,this.ariaLabel))):(this.element.classList.remove("empty"),this.element.removeAttribute("tabIndex"),this.element.removeAttribute("aria-label")),this.updateStyles()}updateTitleContainer(){this.titleContainer.classList.toggle("tabs",this.groupsView.partOptions.showTabs==="multiple"),this.titleContainer.classList.toggle("show-file-icons",this.groupsView.partOptions.showIcons)}restoreEditors(e,t){if(this.count===0)return;let o;e instanceof oy?o=kIi(e):o=Object.create(null);let n=this.model.activeEditor;if(!n)return;o.pinned=this.model.isPinned(n),o.sticky=this.model.isSticky(n),o.preserveFocus=!0;let r={preserveWindowOrder:!0,skipTitleUpdate:!0},s=Un(),l=this.doShowEditor(n,{active:!0,isNew:!1},o,r).then(()=>{this.groupsView.activeGroup===this&&s&&Na(s)&&!t?.preserveFocus&&this.focus()});return this.titleControl.openEditors(this.editors),l}registerListeners(){this._register(this.model.onDidModelChange(e=>this.onDidGroupModelChange(e))),this._register(this.groupsView.onDidChangeEditorPartOptions(e=>this.onDidChangeEditorPartOptions(e))),this._register(this.groupsView.onDidVisibilityChange(e=>this.onDidVisibilityChange(e))),this._register(this.onDidFocus(()=>this.onDidGainFocus()))}onDidGroupModelChange(e){switch(this._onDidModelChange.fire(e),e.kind){case 3:this.element.classList.toggle("locked",this.isLocked);break;case 4:this.onDidChangeEditorSelection();break}if(e.editor)switch(e.kind){case 5:sco(e)&&this.onDidOpenEditor(e.editor,e.editorIndex);break;case 6:lco(e)&&this.handleOnDidCloseEditor(e.editor,e.editorIndex,e.context,e.sticky);break;case 15:this.onWillDisposeEditor(e.editor);break;case 14:this.onDidChangeEditorDirty(e.editor);break;case 12:this.onDidChangeEditorTransient(e.editor);break;case 9:this.onDidChangeEditorLabel(e.editor);break}}onDidOpenEditor(e,t){this.telemetryService.publicLog("editorOpened",this.toEditorTelemetryDescriptor(e)),this.updateContainer()}handleOnDidCloseEditor(e,t,o,n){this._onWillCloseEditor.fire({groupId:this.id,editor:e,context:o,index:t,sticky:n});let r=[e];e instanceof ja&&r.push(e.primary,e.secondary);for(let s of r)this.canDispose(s)&&s.dispose();this.updateContainer(),this._onDidCloseEditor.fire({groupId:this.id,editor:e,context:o,index:t,sticky:n})}canDispose(e){for(let t of this.editorPartsView.groups)if(t instanceof oy&&t.model.contains(e,{strictEquals:!0,supportSideBySide:4}))return!1;return!0}toResourceTelemetryDescriptor(e){if(!e)return;let t=e?e.scheme===Q.file?e.fsPath:e.path:void 0;if(!t)return;let o=Ts(e),n=o.indexOf("?");return o=n!==-1?o.substr(0,n):o,{mimeType:new lh(aLe(e).join(", ")),scheme:e.scheme,ext:o,path:Lr(t)}}toEditorTelemetryDescriptor(e){let t=e.getTelemetryDescriptor(),o=po.getOriginalUri(e,{supportSideBySide:3});return A.isUri(o)?(t.resource=this.toResourceTelemetryDescriptor(o),t):(o&&(o.primary&&(t.resource=this.toResourceTelemetryDescriptor(o.primary)),o.secondary&&(t.resourceSecondary=this.toResourceTelemetryDescriptor(o.secondary))),t)}onWillDisposeEditor(e){this.disposedEditorsWorker.work(e)}handleDisposedEditors(e){let t,o=[];for(let n of e){let r=this.model.findEditor(n);if(!r)continue;let s=r[0];s.isDisposed()&&(this.model.isActive(s)?t=s:o.push(s))}for(let n of o)this.doCloseEditor(n,!0);t&&this.doCloseEditor(t,!0)}onDidChangeEditorPartOptions(e){this.updateTitleContainer(),this.titleControl.updateOptions(e.oldPartOptions,e.newPartOptions),(e.oldPartOptions.showTabs!==e.newPartOptions.showTabs||e.oldPartOptions.tabHeight!==e.newPartOptions.tabHeight||e.oldPartOptions.showTabs==="multiple"&&e.oldPartOptions.pinnedTabsOnSeparateRow!==e.newPartOptions.pinnedTabsOnSeparateRow)&&(this.relayout(),this.model.activeEditor&&this.titleControl.openEditors(this.model.getEditors(1))),this.updateStyles(),e.oldPartOptions.enablePreview&&!e.newPartOptions.enablePreview&&this.model.previewEditor&&this.pinEditor(this.model.previewEditor)}onDidChangeEditorDirty(e){this.pinEditor(e),this.titleControl.updateEditorDirty(e)}onDidChangeEditorTransient(e){!this.model.isTransient(e)&&!this.groupsView.partOptions.enablePreview&&this.pinEditor(e)}onDidChangeEditorLabel(e){this.titleControl.updateEditorLabel(e)}onDidChangeEditorSelection(){this.titleControl.updateEditorSelections()}onDidVisibilityChange(e){this.editorPane.setVisible(e)}onDidGainFocus(){this.activeEditor&&this.model.setTransient(this.activeEditor,!1)}get index(){return this._index}get label(){return this.groupsLabel?d(4856,null,this.groupsLabel,this._index+1):d(4855,null,this._index+1)}get ariaLabel(){return this.groupsLabel?d(4854,null,this.groupsLabel,this._index+1):d(4853,null,this._index+1)}get disposed(){return this._disposed}get isEmpty(){return this.count===0}get titleHeight(){return this.titleControl.getHeight()}notifyIndexChanged(e){this._index!==e&&(this._index=e,this.model.setIndex(e))}notifyLabelChanged(e){this.groupsLabel!==e&&(this.groupsLabel=e,this.model.setLabel(e))}setActive(e){this.active=e,!e&&this.activeEditor&&this.selectedEditors.length>1&&this.setSelection(this.activeEditor,[]),this.element.classList.toggle("active",e),this.element.classList.toggle("inactive",!e),this.titleControl.setActive(e),this.updateStyles(),this.model.setActive(void 0)}get id(){return this.model.id}get windowId(){return this.groupsView.windowId}get editors(){return this.model.getEditors(1)}get count(){return this.model.count}get stickyCount(){return this.model.stickyCount}get activeEditorPane(){return this.editorPane?this.editorPane.activeEditorPane??void 0:void 0}get activeEditor(){return this.model.activeEditor}get selectedEditors(){return this.model.selectedEditors}get previewEditor(){return this.model.previewEditor}isPinned(e){return this.model.isPinned(e)}isSticky(e){return this.model.isSticky(e)}isSelected(e){return this.model.isSelected(e)}isTransient(e){return this.model.isTransient(e)}isActive(e){return this.model.isActive(e)}async setSelection(e,t){this.isActive(e)?this.model.setSelection(e,t):await this.openEditor(e,{activation:1},{inactiveSelection:t})}contains(e,t){return this.model.contains(e,t)}getEditors(e,t){return this.model.getEditors(e,t)}findEditors(e,t){let o=this.uriIdentityService.asCanonicalUri(e);return this.getEditors(t?.order??1).filter(n=>{if(n.resource&&ze(n.resource,o))return!0;if(t?.supportSideBySide===1||t?.supportSideBySide===4){let r=po.getCanonicalUri(n,{supportSideBySide:1});if(r&&ze(r,o))return!0}if(t?.supportSideBySide===2||t?.supportSideBySide===4){let r=po.getCanonicalUri(n,{supportSideBySide:2});if(r&&ze(r,o))return!0}return!1})}getEditorByIndex(e){return this.model.getEditorByIndex(e)}getIndexOfEditor(e){return this.model.indexOf(e)}isFirst(e){return this.model.isFirst(e)}isLast(e){return this.model.isLast(e)}focus(){this.activeEditorPane?this.activeEditorPane.focus():this.element.focus(),this._onDidFocus.fire()}pinEditor(e=this.activeEditor||void 0){if(e&&!this.model.isPinned(e)){let t=this.model.pin(e);t&&this.titleControl.pinEditor(t)}}stickEditor(e=this.activeEditor||void 0){this.doStickEditor(e,!0)}unstickEditor(e=this.activeEditor||void 0){this.doStickEditor(e,!1)}doStickEditor(e,t){if(e&&this.model.isSticky(e)!==t){let o=this.getIndexOfEditor(e),n=t?this.model.stick(e):this.model.unstick(e);if(!n)return;let r=this.getIndexOfEditor(n);r!==o&&this.titleControl.moveEditor(n,o,r,!0),t?this.titleControl.stickEditor(n):this.titleControl.unstickEditor(n)}}async openEditor(e,t,o){return this.doOpenEditor(e,t,{...o,supportSideBySide:3})}async doOpenEditor(e,t,o){if(!e||e.isDisposed())return;this._onWillOpenEditor.fire({editor:e,groupId:this.id});let n=t?.sticky||!this.groupsView.partOptions.enablePreview&&!t?.transient||e.isDirty()||(t?.pinned??typeof t?.index=="number")||typeof t?.index=="number"&&this.model.isSticky(t.index)||e.hasCapability(512),r={index:t?t.index:void 0,pinned:n,sticky:t?.sticky||typeof t?.index=="number"&&this.model.isSticky(t.index),transient:!!t?.transient,inactiveSelection:o?.inactiveSelection,active:this.count===0||!t?.inactive,supportSideBySide:o?.supportSideBySide};!r.active&&!r.pinned&&this.model.activeEditor&&!this.model.isPinned(this.model.activeEditor)&&(r.active=!0);let s=!1,l=!1;if(t?.activation===1?s=!0:t?.activation===2?l=!0:t?.activation===3?(s=!1,l=!1):r.active&&(s=!t?.preserveFocus,l=!s),typeof r.index=="number"){let h=this.model.indexOf(e);h!==-1&&h!==r.index&&this.doMoveEditorInsideGroup(e,r)}let{editor:c,isNew:u}=this.model.openEditor(e,r);u&&this.count===1&&this.editorPartsView.groups.length>1&&c.editorId&&this.groupsView.partOptions.autoLockGroups?.has(c.editorId)&&this.lock(!0);let p=this.doShowEditor(c,{active:!!r.active,isNew:u},t,o);return s?this.groupsView.activateGroup(this):l&&this.groupsView.restoreGroup(this),p}doShowEditor(e,t,o,n){let r;return t.active?r=(async()=>{let{pane:s,changed:l,cancelled:c,error:u}=await this.editorPane.openEditor(e,o,n,{newInGroup:t.isNew});if(!c)return l&&this._onDidActiveEditorChange.fire({editor:e,isExplicit:o?.isExplicit}),u&&this._onDidOpenEditorFail.fire(e),!s&&this.activeEditor===e&&this.doCloseEditor(e,o?.preserveFocus,{fromError:!0}),s})():r=Promise.resolve(void 0),n?.skipTitleUpdate||this.titleControl.openEditor(e,n),r}async openEditors(e){let t=ui(e).filter(({editor:l})=>!l.isDisposed()),o=t.at(0);if(!o)return;let n={supportSideBySide:3};await this.doOpenEditor(o.editor,o.options,n);let r=t.slice(1),s=this.getIndexOfEditor(o.editor)+1;return await vn.settled(r.map(({editor:l,options:c},u)=>this.doOpenEditor(l,{...c,inactive:!0,pinned:!0,index:s+u},{...n,skipTitleUpdate:!0}))),this.titleControl.openEditors(r.map(({editor:l})=>l)),this.editorPane.activeEditorPane??void 0}moveEditors(e,t){let o={skipTitleUpdate:this!==t},n=!1,r=new Set;for(let{editor:s,options:l}of e)this.moveEditor(s,t,l,o)?r.add(s):n=!0;return o.skipTitleUpdate&&(t.titleControl.openEditors(Array.from(r)),this.titleControl.closeEditors(Array.from(r))),!n}moveEditor(e,t,o,n){return this===t?(this.doMoveEditorInsideGroup(e,o),!0):this.doMoveOrCopyEditorAcrossGroups(e,t,o,{...n,keepCopy:!1})}doMoveEditorInsideGroup(e,t){let o=t?t.index:void 0;if(typeof o!="number")return;let n=this.model.indexOf(e),r=this.model.getEditorByIndex(n);if(r){if(n!==o){let s=this.model.stickyCount;this.model.moveEditor(r,o),this.model.pin(r),this.titleControl.moveEditor(r,n,o,s!==this.model.stickyCount),this.titleControl.pinEditor(r)}t?.sticky&&this.stickEditor(r)}}doMoveOrCopyEditorAcrossGroups(e,t,o,n){let r=n?.keepCopy;if(!r||e.hasCapability(8)){let l=e.canMove(this.id,t.id);if(typeof l=="string")return this.dialogService.error(l,d(4857,null)),!1}let s=kIi(this,e,{...o,pinned:!0,sticky:o?.sticky??(!r&&this.model.isSticky(e))});return r||this._onWillMoveEditor.fire({groupId:this.id,editor:e,target:t.id}),t.doOpenEditor(r?e.copy():e,s,n),r||this.doCloseEditor(e,!0,{...n,context:2}),!0}copyEditors(e,t){let o={skipTitleUpdate:this!==t};for(let{editor:n,options:r}of e)this.copyEditor(n,t,r,o);if(o.skipTitleUpdate){let n=e.map(({editor:r})=>r);t.titleControl.openEditors(n)}}copyEditor(e,t,o,n){this===t?this.doMoveEditorInsideGroup(e,o):this.doMoveOrCopyEditorAcrossGroups(e,t,o,{...n,keepCopy:!0})}async closeEditor(e=this.activeEditor||void 0,t){return this.doCloseEditorWithConfirmationHandling(e,t)}async doCloseEditorWithConfirmationHandling(e=this.activeEditor||void 0,t,o){return!e||await this.handleCloseConfirmation([e])?!1:(this.doCloseEditor(e,t?.preserveFocus,o),!0)}doCloseEditor(e,t=this.groupsView.activeGroup!==this,o){o?.skipTitleUpdate||this.titleControl.beforeCloseEditor(e),this.model.isActive(e)?this.doCloseActiveEditor(t,o):this.doCloseInactiveEditor(e,o),o?.skipTitleUpdate||this.titleControl.closeEditor(e)}doCloseActiveEditor(e=this.groupsView.activeGroup!==this,t){let o=this.activeEditor,n=!e&&this.shouldRestoreFocus(this.element),r=this.groupsView.partOptions.closeEmptyGroups;if(r&&this.active&&this.count===1){let c=this.groupsView.getGroups(1)[1];c&&(n?c.focus():this.groupsView.activateGroup(c,!0))}o&&this.model.closeEditor(o,t?.context);let s=this.model.activeEditor;if(s){let l;e&&this.groupsView.activeGroup!==this&&(l=3);let c={preserveFocus:e,activation:l,ignoreError:t?.fromError},u={preserveWindowOrder:!0};this.doOpenEditor(s,c,u)}else o&&this.editorPane.closeEditor(o),n&&!r&&this.focus(),this._onDidActiveEditorChange.fire({editor:void 0}),r&&this.groupsView.removeGroup(this,e)}shouldRestoreFocus(e){let t=Un();return t===e.ownerDocument.body?!0:ms(t,e)}doCloseInactiveEditor(e,t){this.model.closeEditor(e,t?.context)}async handleCloseConfirmation(e){if(!e.length)return!1;let t=e.shift(),o=this.mapEditorToPendingConfirmation.get(t);o||(o=this.doHandleCloseConfirmation(t),this.mapEditorToPendingConfirmation.set(t,o));let n;try{n=await o}finally{this.mapEditorToPendingConfirmation.delete(t)}return n||this.handleCloseConfirmation(e)}async doHandleCloseConfirmation(e,t){if(!this.shouldConfirmClose(e)||e instanceof ja&&this.model.contains(e.primary)||this.editorPartsView.groups.some(s=>{if(s===this)return!1;let l=s;return!!(l.contains(e,{supportSideBySide:3})||e instanceof ja&&l.contains(e.primary))}))return!1;let o=2,n=1,r=!1;if(!e.hasCapability(4)&&!t?.skipAutoSave&&!e.closeHandler&&(this.filesConfigurationService.getAutoSaveMode(e).mode===3?(r=!0,o=0,n=3):Qr&&(ii||Sn)&&this.filesConfigurationService.getAutoSaveMode(e).mode===4&&(r=!0,o=0,n=4)),!r){this.activeEditor?.matches(e)||await this.doOpenEditor(e),await this.hostService.focus(Me(this.element));let s=!1;if(typeof e.closeHandler?.confirm=="function")try{o=await e.closeHandler.confirm([{editor:e,groupId:this.id}])}catch(l){this.logService.error(l),s=!0}if(typeof e.closeHandler?.confirm!="function"||s){let l;e instanceof ja?l=e.primary.getName():l=e.getName(),o=await this.fileDialogService.showSaveConfirm([l])}}if(!e.closeHandler&&!this.shouldConfirmClose(e))return o===2;switch(o){case 0:return!await e.save(this.id,{reason:n})&&r?this.doHandleCloseConfirmation(e,{skipAutoSave:!0}):e.isDirty();case 1:try{return await e.revert(this.id),e.isDirty()}catch(s){return this.logService.error(s),await e.revert(this.id,{soft:!0}),e.isDirty()}case 2:return!0}}shouldConfirmClose(e){if(e.closeHandler)try{return e.closeHandler.showConfirm()}catch(t){this.logService.error(t)}return e.isDirty()&&!e.isSaving()}async closeEditors(e,t){if(this.isEmpty)return!0;let o=this.doGetEditorsToClose(e);return await this.handleCloseConfirmation(o.slice(0))?!1:(this.doCloseEditors(o,t),!0)}doGetEditorsToClose(e){if(Array.isArray(e))return e;let t=e,o=typeof t.direction=="number",n=this.model.getEditors(o?1:0,t);return t.savedOnly?n=n.filter(r=>!r.isDirty()||r.isSaving()):o&&t.except?n=t.direction===0?n.slice(0,this.model.indexOf(t.except,n)):n.slice(this.model.indexOf(t.except,n)+1):t.except&&(n=n.filter(r=>t.except&&!r.matches(t.except))),n}doCloseEditors(e,t){let o=!1;for(let n of e)this.isActive(n)?o=!0:this.doCloseInactiveEditor(n);o&&this.doCloseActiveEditor(t?.preserveFocus),e.length&&this.titleControl.closeEditors(e)}closeAllEditors(e){return this.isEmpty?(this.groupsView.partOptions.closeEmptyGroups&&this.groupsView.removeGroup(this),!0):e?.excludeConfirming?(this.doCloseAllEditors(e),!0):this.handleCloseConfirmation(this.model.getEditors(0,e)).then(t=>t?!1:(this.doCloseAllEditors(e),!0))}doCloseAllEditors(e){let t=this.model.getEditors(1,e);e?.excludeConfirming&&(t=t.filter(n=>!this.shouldConfirmClose(n)));let o=[];for(let n of t)this.isActive(n)||this.doCloseInactiveEditor(n),o.push(n);this.activeEditor&&o.includes(this.activeEditor)&&this.doCloseActiveEditor(),o.length&&this.titleControl.closeEditors(o)}async replaceEditors(e){let t,o=[];for(let{editor:n,replacement:r,forceReplaceDirty:s,options:l}of e){let c=this.getIndexOfEditor(n);if(c>=0){let u=this.isActive(n);l?l.index=c:l={index:c},l.inactive=!u,l.pinned=l.pinned??!0;let p={editor:n,replacement:r,forceReplaceDirty:s,options:l};u?t=p:o.push(p)}}for(let{editor:n,replacement:r,forceReplaceDirty:s,options:l}of o)if(await this.doOpenEditor(r,l),!n.matches(r)){let c=!1;if(s?(this.doCloseEditor(n,!0,{context:1}),c=!0):c=await this.doCloseEditorWithConfirmationHandling(n,{preserveFocus:!0},{context:1}),!c)return}if(t){let n=this.doOpenEditor(t.replacement,t.options);t.editor.matches(t.replacement)||(t.forceReplaceDirty?this.doCloseEditor(t.editor,!0,{context:1}):await this.doCloseEditorWithConfirmationHandling(t.editor,{preserveFocus:!0},{context:1})),await n}}get isLocked(){return this.model.isLocked}lock(e){this.model.lock(e)}createEditorActions(e,t=R.EditorTitle){let o={primary:[],secondary:[]},n,r=this.activeEditorPane;if(r instanceof zs){let s=r.scopedContextKeyService??this.scopedContextKeyService,l=e.add(this.menuService.createMenu(t,s,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:0}));n=l.onDidChange;let c=(u,p)=>p==="navigation"&&u.actions.length<=1;o=xl(l.getActions({arg:this.resourceContext.get(),shouldForwardArgs:!0,renderShortTitle:!0}),"navigation",c)}else{let s=e.add(new T);n=s.event,e.add(this.onDidActiveEditorChange(()=>s.fire()))}return{actions:o,onDidChange:n}}updateStyles(){let e=this.isEmpty;e?this.element.style.backgroundColor=this.getColor(Lro)||"":this.element.style.backgroundColor="";let t=this.getColor(Aro)||this.getColor(Ei);!e&&t?(this.titleContainer.classList.add("title-border-bottom"),this.titleContainer.style.setProperty("--title-border-bottom-color",t)):(this.titleContainer.classList.remove("title-border-bottom"),this.titleContainer.style.removeProperty("--title-border-bottom-color"));let{showTabs:o}=this.groupsView.partOptions;this.titleContainer.style.backgroundColor=this.getColor(o==="multiple"?dMt:Pro)||"",this.editorContainer.style.backgroundColor=this.getColor(Bo)||""}get minimumWidth(){return this.editorPane.minimumWidth}get minimumHeight(){return this.editorPane.minimumHeight}get maximumWidth(){return this.editorPane.maximumWidth}get maximumHeight(){return this.editorPane.maximumHeight}get proportionalLayout(){return this.lastLayout?!(this.lastLayout.width===this.minimumWidth||this.lastLayout.height===this.minimumHeight):!0}layout(e,t,o,n){this.lastLayout={width:e,height:t,top:o,left:n},this.element.classList.toggle("max-height-478px",t<=478);let r=this.titleControl.layout({container:new di(e,t),available:new di(e,t-this.editorPane.minimumHeight)});this.progressBar.getContainer().style.top=`${Math.max(this.titleHeight.offset-2,0)}px`;let s=Math.max(0,t-r.height);this.editorContainer.style.height=`${s}px`,this.editorPane.layout({width:e,height:s,top:o+r.height,left:n})}relayout(){if(this.lastLayout){let{width:e,height:t,top:o,left:n}=this.lastLayout;this.layout(e,t,o,n)}}setBoundarySashes(e){this.editorPane.setBoundarySashes(e)}toJSON(){return this.model.serialize()}dispose(){this._disposed=!0,this._onWillDispose.fire(),super.dispose()}};oy=I([m(6,F),m(7,X),m(8,Pe),m(9,_e),m(10,Le),m(11,Yt),m(12,Xe),m(13,nn),m(14,ie),m(15,fr),m(16,gt),m(17,re),m(18,il),m(19,ti),m(20,ct),m(21,ge)],oy);function Ofo(a){return a.getValue("editor.dropIntoEditor.enabled")}function Ffo(a){return a.shiftKey}var Ahe=class extends ju{constructor(e,t,o,n,r,s,l,c){super(t);this.groupView=e;this.configurationService=o;this.instantiationService=n;this.editorService=r;this.editorGroupService=s;this.treeViewsDragAndDropService=l;this.contextService=c;this.editorTransfer=Vy.getInstance();this.groupTransfer=Vy.getInstance();this.treeItemsTransfer=Vy.getInstance();this.cleanupOverlayScheduler=this._register(new Dt(()=>this.dispose(),300)),this.enableDropIntoEditor=Ofo(this.configurationService)&&this.isDropIntoActiveEditorEnabled(),this.create()}static{this.OVERLAY_ID="monaco-workbench-editor-drop-overlay"}get disposed(){return!!this._disposed}create(){let e=this.getOverlayOffsetHeight(),t=this.container=_("div",{id:Ahe.OVERLAY_ID});t.style.top=`${e}px`,this.groupView.element.appendChild(t),this.groupView.element.classList.add("dragged-over"),this._register(ee(()=>{t.remove(),this.groupView.element.classList.remove("dragged-over")})),this.overlay=_(".editor-group-overlay-indicator"),t.appendChild(this.overlay),this.enableDropIntoEditor&&(this.dropIntoPromptElement=Jk(d(4850,null,et?"\u21E7":"Shift"),{}),this.dropIntoPromptElement.classList.add("editor-group-overlay-drop-into-prompt"),this.overlay.appendChild(this.dropIntoPromptElement)),this.registerListeners(t),this.updateStyles()}updateStyles(){let e=Ti(this.overlay);e.style.backgroundColor=this.getColor(ZT)||"";let t=this.getColor(la);if(e.style.outlineColor=t||"",e.style.outlineOffset=t?"-2px":"",e.style.outlineStyle=t?"dashed":"",e.style.outlineWidth=t?"2px":"",this.dropIntoPromptElement){this.dropIntoPromptElement.style.backgroundColor=this.getColor(Oro)??"",this.dropIntoPromptElement.style.color=this.getColor(Nro)??"";let o=this.getColor(Fro);o?(this.dropIntoPromptElement.style.borderWidth="1px",this.dropIntoPromptElement.style.borderStyle="solid",this.dropIntoPromptElement.style.borderColor=o):this.dropIntoPromptElement.style.borderWidth="0"}}registerListeners(e){this._register(new wg(e,{onDragOver:t=>{if(this.enableDropIntoEditor&&Ffo(t)){this.dispose();return}let o=this.groupTransfer.hasData(ey.prototype),n=this.editorTransfer.hasData(xv.prototype);!n&&!o&&t.dataTransfer&&(t.dataTransfer.dropEffect="copy");let r=!0;if(o)r=this.isCopyOperation(t);else if(n){let l=this.editorTransfer.getData(xv.prototype);Array.isArray(l)&&l.length>0&&(r=this.isCopyOperation(t,l[0].identifier))}if(!r){let l=this.findSourceGroupView();if(l===this.groupView&&(o||n&&l.count<2)){this.hideOverlay();return}}let s=!!this.groupView.groupsView.partOptions.splitOnDragAndDrop;this.isToggleSplitOperation(t)&&(s=!s),this.positionOverlay(t.offsetX,t.offsetY,o,s),this.cleanupOverlayScheduler.isScheduled()&&this.cleanupOverlayScheduler.cancel()},onDragLeave:t=>this.dispose(),onDragEnd:t=>this.dispose(),onDrop:t=>{Kt.stop(t,!0),this.dispose(),this.currentDropOperation&&this.handleDrop(t,this.currentDropOperation.splitDirection)}})),this._register($(e,ne.MOUSE_OVER,()=>{this.cleanupOverlayScheduler.isScheduled()||this.cleanupOverlayScheduler.schedule()}))}isDropIntoActiveEditorEnabled(){return!!this.groupView.activeEditor?.hasCapability(128)}findSourceGroupView(){if(this.groupTransfer.hasData(ey.prototype)){let e=this.groupTransfer.getData(ey.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier)}else if(this.editorTransfer.hasData(xv.prototype)){let e=this.editorTransfer.getData(xv.prototype);if(Array.isArray(e)&&e.length>0)return this.editorGroupService.getGroup(e[0].identifier.groupId)}}async handleDrop(e,t){let o=()=>{let n;return typeof t=="number"?n=this.editorGroupService.addGroup(this.groupView,t):n=this.groupView,n};if(this.groupTransfer.hasData(ey.prototype)){let n=this.groupTransfer.getData(ey.prototype);if(Array.isArray(n)&&n.length>0){let r=this.editorGroupService.getGroup(n[0].identifier);if(r){if(typeof t!="number"&&r===this.groupView)return;let s;if(typeof t=="number")this.isCopyOperation(e)?s=this.editorGroupService.copyGroup(r,this.groupView,t):s=this.editorGroupService.moveGroup(r,this.groupView,t);else{let l;this.isCopyOperation(e)&&(l={mode:0}),this.editorGroupService.mergeGroup(r,this.groupView,l)}s&&this.editorGroupService.activateGroup(s)}this.groupTransfer.clearData(ey.prototype)}}else if(this.editorTransfer.hasData(xv.prototype)){let n=this.editorTransfer.getData(xv.prototype);if(Array.isArray(n)&&n.length>0){let r=n,s=n[0].identifier,l=this.editorGroupService.getGroup(s.groupId);if(l){let c=this.isCopyOperation(e,s),u;if(this.groupView.groupsView.partOptions.closeEmptyGroups&&l.count===1&&typeof t=="number"&&!c)u=this.editorGroupService.moveGroup(l,this.groupView,t);else{if(u=o(),l===u)return;let p=see(this.groupView,r.map(h=>h.identifier.editor));c?l.copyEditors(p,u):l.moveEditors(p,u)}u.focus()}this.editorTransfer.clearData(xv.prototype)}}else if(this.treeItemsTransfer.hasData(xx.prototype)){let n=this.treeItemsTransfer.getData(xx.prototype);if(Array.isArray(n)&&n.length>0){let r=[];for(let s of n){let l=await this.treeViewsDragAndDropService.removeDragOperationTransfer(s.identifier);if(l){let c=await o0t(l);r.push(...c.map(u=>({...u,options:{...u.options,pinned:!0}})))}}r.length&&this.editorService.openEditors(r,o(),{validateTrust:!0})}this.treeItemsTransfer.clearData(xx.prototype)}else this.instantiationService.createInstance(uW,{allowWorkspaceOpen:!Ft||tC(this.contextService.getWorkspace())}).handleDrop(e,Me(this.groupView.element),()=>o(),r=>r?.focus())}isCopyOperation(e,t){return t?.editor.hasCapability(8)?!1:e.ctrlKey&&!et||e.altKey&&et}isToggleSplitOperation(e){return e.altKey&&!et||e.shiftKey&&et}positionOverlay(e,t,o,n){let r=this.groupView.groupsView.partOptions.openSideBySideDirection==="right",s=this.groupView.element.clientWidth,l=this.groupView.element.clientHeight-this.getOverlayOffsetHeight(),c,u;n?(o?c=r?.3:.1:c=.1,o?u=r?.1:.3:u=.1):(c=0,u=0);let p=s*c,h=l*u,g=s/3,f=l/3,v;switch(e>p&&e<s-p&&t>h&&t<l-h?v=void 0:r?e<g?v=2:e>g*2?v=3:t<l/2?v=0:v=1:t<f?v=0:t>f*2?v=1:e<s/2?v=2:v=3,v){case 0:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case 1:this.doPositionOverlay({top:"50%",left:"0",width:"100%",height:"50%"}),this.toggleDropIntoPrompt(!1);break;case 2:this.doPositionOverlay({top:"0",left:"0",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;case 3:this.doPositionOverlay({top:"0",left:"50%",width:"50%",height:"100%"}),this.toggleDropIntoPrompt(!1);break;default:this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),this.toggleDropIntoPrompt(!0)}let b=Ti(this.overlay);b.style.opacity="1",setTimeout(()=>b.classList.add("overlay-move-transition"),0),this.currentDropOperation={splitDirection:v}}doPositionOverlay(e){let[t,o]=Ow(this.container,this.overlay),n=this.getOverlayOffsetHeight();n?t.style.height=`calc(100% - ${n}px)`:t.style.height="100%",o.style.top=e.top,o.style.left=e.left,o.style.width=e.width,o.style.height=e.height}getOverlayOffsetHeight(){return!this.groupView.isEmpty&&this.groupView.groupsView.partOptions.showTabs==="multiple"?this.groupView.titleHeight.offset:0}hideOverlay(){let e=Ti(this.overlay);this.doPositionOverlay({top:"0",left:"0",width:"100%",height:"100%"}),e.style.opacity="0",e.classList.remove("overlay-move-transition"),this.currentDropOperation=void 0}toggleDropIntoPrompt(e){this.dropIntoPromptElement&&(this.dropIntoPromptElement.style.opacity=e?"1":"0")}contains(e){return e===this.container||e===this.overlay}dispose(){super.dispose(),this._disposed=!0}};Ahe=I([m(1,Pe),m(2,B),m(3,F),m(4,ie),m(5,kt),m(6,A4),m(7,Ae)],Ahe);var DPe=class extends ju{constructor(e,t,o,n,r,s,l){super(r);this.groupsView=e;this.container=t;this.delegate=o;this.editorGroupService=n;this.configurationService=s;this.instantiationService=l;this.counter=0;this.editorTransfer=Vy.getInstance();this.groupTransfer=Vy.getInstance();this.registerListeners()}get overlay(){if(this._overlay&&!this._overlay.disposed)return this._overlay}registerListeners(){this._register($(this.container,ne.DRAG_ENTER,e=>this.onDragEnter(e))),this._register($(this.container,ne.DRAG_LEAVE,()=>this.onDragLeave()));for(let e of[this.container,Me(this.container)])this._register($(e,ne.DRAG_END,()=>this.onDragEnd()))}onDragEnter(e){if(Ofo(this.configurationService)&&Ffo(e))return;if(this.counter++,!this.editorTransfer.hasData(xv.prototype)&&!this.groupTransfer.hasData(ey.prototype)&&e.dataTransfer){let o=oe.as(WB.DragAndDropContribution).getAll(),n=Array.from(o).map(r=>r.dataFormatKey);if(!Up(e,Fl.FILES,Mc.FILES,Fl.RESOURCES,Mc.EDITORS,...n)){e.dataTransfer.dropEffect="none";return}}if(!this.groupsView.partOptions.allowDropIntoGroup){e.dataTransfer&&(e.dataTransfer.dropEffect="none");return}this.updateContainer(!0);let t=e.target;if(t&&(this.overlay&&!this.overlay.contains(t)&&this.disposeOverlay(),!this.overlay)){let o=this.findTargetGroupView(t);o&&(this._overlay=this.instantiationService.createInstance(Ahe,o))}}onDragLeave(){this.counter--,this.counter===0&&this.updateContainer(!1)}onDragEnd(){this.counter=0,this.updateContainer(!1),this.disposeOverlay()}findTargetGroupView(e){return this.editorGroupService.groups.find(o=>ms(e,o.element)||this.delegate.containsGroup?.(o))}updateContainer(e){this.container.classList.toggle("dragged-over",e)}dispose(){super.dispose(),this.disposeOverlay()}disposeOverlay(){this.overlay&&(this.overlay.dispose(),this._overlay=void 0)}};DPe=I([m(3,kt),m(4,Pe),m(5,B),m(6,F)],DPe);var Ztt={targetWidth:900,leftMarginRatio:.1909,rightMarginRatio:.1909},UTi={type:"distribute"};function Wfo(a){let i=_(".centered-layout-margin");return i.style.height="100%",a&&(i.style.backgroundColor=a.toString()),{element:i,layout:()=>{},minimumSize:60,maximumSize:Number.POSITIVE_INFINITY,onDidChange:U.None}}function Zin(a,i){return{element:a.element,get maximumSize(){return a.maximumWidth},get minimumSize(){return a.minimumWidth},onDidChange:U.map(a.onDidChange,e=>e&&e.width),layout:(e,t,o)=>a.layout(e,i(),o?.top??0,(o?.left??0)+t)}}var mUt=class{constructor(i,e,t={...Ztt},o=!1){this.container=i;this.view=e;this.state=t;this.centeredLayoutFixedWidth=o;this.lastLayoutPosition={width:0,height:0,left:0,top:0};this.didLayout=!1;this.splitViewDisposables=new O;this._boundarySashes={};this.container.appendChild(this.view.element),this.container.style.overflow="hidden"}get minimumWidth(){return this.splitView?this.splitView.minimumSize:this.view.minimumWidth}get maximumWidth(){return this.splitView?this.splitView.maximumSize:this.view.maximumWidth}get minimumHeight(){return this.view.minimumHeight}get maximumHeight(){return this.view.maximumHeight}get onDidChange(){return this.view.onDidChange}get boundarySashes(){return this._boundarySashes}set boundarySashes(i){this._boundarySashes=i,this.splitView&&(this.splitView.orthogonalStartSash=i.top,this.splitView.orthogonalEndSash=i.bottom)}layout(i,e,t,o){this.lastLayoutPosition={width:i,height:e,top:t,left:o},this.splitView?(this.splitView.layout(i,this.lastLayoutPosition),(!this.didLayout||this.centeredLayoutFixedWidth)&&this.resizeSplitViews()):this.view.layout(i,e,t,o),this.didLayout=!0}resizeSplitViews(){if(this.splitView)if(this.centeredLayoutFixedWidth){let i=Math.min(this.lastLayoutPosition.width,this.state.targetWidth),e=(this.lastLayoutPosition.width-i)/2;this.splitView.resizeView(0,Math.floor(e)),this.splitView.resizeView(1,i),this.splitView.resizeView(2,Math.ceil(e))}else{let i=this.state.leftMarginRatio*this.lastLayoutPosition.width,e=this.state.rightMarginRatio*this.lastLayoutPosition.width,t=this.lastLayoutPosition.width-i-e;this.splitView.resizeView(0,i),this.splitView.resizeView(1,t),this.splitView.resizeView(2,e)}}setFixedWidth(i){this.centeredLayoutFixedWidth=i,this.splitView&&(this.updateState(),this.resizeSplitViews())}updateState(){this.splitView&&(this.state.targetWidth=this.splitView.getViewSize(1),this.state.leftMarginRatio=this.splitView.getViewSize(0)/this.lastLayoutPosition.width,this.state.rightMarginRatio=this.splitView.getViewSize(2)/this.lastLayoutPosition.width)}isActive(){return!!this.splitView}styles(i){this.style=i,this.splitView&&this.emptyViews&&(this.splitView.style(this.style),this.emptyViews[0].element.style.backgroundColor=this.style.background.toString(),this.emptyViews[1].element.style.backgroundColor=this.style.background.toString())}activate(i){if(i!==this.isActive())if(i){this.view.element.remove(),this.splitView=new Gp(this.container,{inverseAltBehavior:!0,orientation:1,styles:this.style}),this.splitView.orthogonalStartSash=this.boundarySashes.top,this.splitView.orthogonalEndSash=this.boundarySashes.bottom,this.splitViewDisposables.add(this.splitView.onDidSashChange(()=>{this.splitView&&this.updateState()})),this.splitViewDisposables.add(this.splitView.onDidSashReset(()=>{this.state={...Ztt},this.resizeSplitViews()})),this.splitView.layout(this.lastLayoutPosition.width,this.lastLayoutPosition);let e=this.style?this.style.background:void 0;this.emptyViews=[Wfo(e),Wfo(e)],this.splitView.addView(this.emptyViews[0],UTi,0),this.splitView.addView(Zin(this.view,()=>this.lastLayoutPosition.height),UTi,1),this.splitView.addView(this.emptyViews[1],UTi,2),this.resizeSplitViews()}else this.splitView?.el.remove(),this.splitViewDisposables.clear(),this.splitView?.dispose(),this.splitView=void 0,this.emptyViews=void 0,this.container.appendChild(this.view.element),this.view.layout(this.lastLayoutPosition.width,this.lastLayoutPosition.height,this.lastLayoutPosition.top,this.lastLayoutPosition.left)}isDefault(i){return this.centeredLayoutFixedWidth?i.targetWidth===Ztt.targetWidth:i.leftMarginRatio===Ztt.leftMarginRatio&&i.rightMarginRatio===Ztt.rightMarginRatio}dispose(){this.splitViewDisposables.dispose(),this.splitView&&(this.splitView.dispose(),this.splitView=void 0)}};function Nhe(a,i,e){let t=a.get(kt),o=a.get(B),n=ton(i,e,t,o);return n instanceof Promise?n.then(r=>Vfo(r,i,e,t,o)):Vfo(n,i,e,t,o)}function Vfo(a,i,e,t,o){let n=t.activeModalEditorPart,r=o.getValue("workbench.editor.useModal"),s=D0(i)?i.editor:ya(i)?i:void 0,l=s instanceof Ls&&s.hasCapability(2048);return n&&e!==MM&&r!=="all"&&!l?eon(a,i,n,t,e):Bfo(a,i,e,t)}async function eon(a,i,e,t,o){let n=i.options;return e.groups.some(r=>r.id===a.id)&&(a=t.mainPart.activeGroup),n?.preserveFocus||await e.close(),Bfo(a,i,o,t)}function Bfo(a,i,e,t){let o;return t.activeGroup!==a&&i.options&&!i.options.inactive&&i.options.preserveFocus&&typeof i.options.activation!="number"&&e!==En&&(o=1),[a,o]}function ton(a,i,e,t){let o,n=D0(a)?a.editor:a,r=a.options;if(ya(n)&&n.hasCapability(2048))o=e.createModalEditorPart(r?.modal).then(s=>s.activeGroup);else if(i&&typeof i!="number")o=i;else if(typeof i=="number"&&i>=0)o=e.getGroup(i);else if(i===En){let s=Zy(t),l=e.findGroup({direction:s});(!l||hUt(l,n))&&(l=e.addGroup(e.activeGroup,s)),o=l}else if(i===ff)o=e.createAuxiliaryEditorPart(r?.auxiliary).then(s=>s.activeGroup);else if(i===MM&&t.getValue("workbench.editor.useModal")!=="off")o=e.createModalEditorPart(r?.modal).then(s=>s.activeGroup);else if(!r||typeof r.index!="number"){let s=e.getGroups(1);if(r?.revealIfVisible){for(let l of s)if(ion(l,n)){o=l;break}}if(!o&&(r?.revealIfOpened||t.getValue("workbench.editor.revealIfOpen")||ya(n)&&(n.hasCapability(1024)||n.hasCapability(8)))){let l,c;for(let u of s)if(Hfo(u,n)&&(c||(c=u),!l&&u.isActive(n)&&(l=u)),c&&l)break;o=l||c}}if(!o&&t.getValue("workbench.editor.useModal")==="all"&&(o=e.createModalEditorPart(r?.modal).then(s=>s.activeGroup)),!o){let s=e.activeGroup;if(hUt(s,n)){for(let l of e.getGroups(1))if(!hUt(l,n)){s=l;break}hUt(s,n)?o=e.addGroup(s,Zy(t)):o=s}else o=s}return o}function hUt(a,i){return!(!a.isLocked||Hfo(a,i))}function ion(a,i){return a.activeEditor?a.activeEditor.matches(i):!1}function Hfo(a,i){for(let e of a.editors)if(e.matches(i))return!0;return!1}var zTi=class{constructor(){this.element=_(".grid-view-container");this._onDidChange=new Ig;this.onDidChange=this._onDidChange.event}get minimumWidth(){return this.gridWidget?this.gridWidget.minimumWidth:0}get maximumWidth(){return this.gridWidget?this.gridWidget.maximumWidth:Number.POSITIVE_INFINITY}get minimumHeight(){return this.gridWidget?this.gridWidget.minimumHeight:0}get maximumHeight(){return this.gridWidget?this.gridWidget.maximumHeight:Number.POSITIVE_INFINITY}get gridWidget(){return this._gridWidget}set gridWidget(i){this.element.textContent="",i?(this.element.appendChild(i.element),this._onDidChange.input=i.onDidChange):this._onDidChange.input=U.None,this._gridWidget=i}layout(i,e,t,o){this.gridWidget?.layout(i,e,t,o)}dispose(){this._onDidChange.dispose()}},_E=class extends k_{constructor(e,t,o,n,r,s,l,c,u,p,h){super(t,{hasTitle:!1},s,c,u);this.editorPartsView=e;this.groupsLabel=o;this.windowId=n;this.instantiationService=r;this.configurationService=l;this.hostService=p;this.contextKeyService=h;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidLayout=this._register(new T);this.onDidLayout=this._onDidLayout.event;this._onDidChangeActiveGroup=this._register(new T);this.onDidChangeActiveGroup=this._onDidChangeActiveGroup.event;this._onDidChangeGroupIndex=this._register(new T);this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event;this._onDidChangeGroupLabel=this._register(new T);this.onDidChangeGroupLabel=this._onDidChangeGroupLabel.event;this._onDidChangeGroupLocked=this._register(new T);this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event;this._onDidChangeGroupMaximized=this._register(new T);this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event;this._onDidActivateGroup=this._register(new T);this.onDidActivateGroup=this._onDidActivateGroup.event;this._onDidAddGroup=this._register(new Ih);this.onDidAddGroup=this._onDidAddGroup.event;this._onDidRemoveGroup=this._register(new Ih);this.onDidRemoveGroup=this._onDidRemoveGroup.event;this._onDidMoveGroup=this._register(new T);this.onDidMoveGroup=this._onDidMoveGroup.event;this.onDidSetGridWidget=this._register(new T);this._onDidChangeSizeConstraints=this._register(new Ig);this.onDidChangeSizeConstraints=U.any(this.onDidSetGridWidget.event,this._onDidChangeSizeConstraints.event);this._onDidScroll=this._register(new Ig);this.onDidScroll=U.any(this.onDidSetGridWidget.event,this._onDidScroll.event);this._onDidChangeEditorPartOptions=this._register(new T);this.onDidChangeEditorPartOptions=this._onDidChangeEditorPartOptions.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this.workspaceMemento=this.getMemento(1,0);this.profileMemento=this.getMemento(0,1);this.groupViews=new Map;this.mostRecentActiveGroups=[];this.container=_(".content");this.gridWidgetDisposables=this._register(new O);this.gridWidgetView=this._register(new zTi);this.enforcedPartOptions=[];this.top=0;this.left=0;this.sideGroup={openEditor:async(e,t)=>{let o=this.scopedInstantiationService.invokeFunction(r=>Nhe(r,{editor:e,options:t},En)),n;return o instanceof Promise?[n]=await o:[n]=o,n.openEditor(e,t)}};this._isReady=!1;this.whenReadyPromise=new Mo;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Mo;this.whenRestored=this.whenRestoredPromise.p;this._willRestoreState=!1;this.priority=2;this.scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.container)),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new Po([X,this.scopedContextKeyService]))),this._partOptions=xIi(this.configurationService,this.themeService),this.registerListeners()}static{this.EDITOR_PART_UI_STATE_STORAGE_KEY="editorpart.state"}static{this.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY="editorpart.centeredview"}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e))),this._register(this.themeService.onDidFileIconThemeChange(()=>this.handleChangedPartOptions())),this._register(this.onDidChangeMementoValue(1,this._store)(e=>this.onDidChangeMementoState(e)))}onConfigurationUpdated(e){oco(e)&&this.handleChangedPartOptions()}handleChangedPartOptions(){let e=this._partOptions,t=xIi(this.configurationService,this.themeService);for(let o of this.enforcedPartOptions)Object.assign(t,o);this._partOptions=t,this._onDidChangeEditorPartOptions.fire({oldPartOptions:e,newPartOptions:t})}get partOptions(){return this._partOptions}enforcePartOptions(e){return this.enforcedPartOptions.push(e),this.handleChangedPartOptions(),ee(()=>{this.enforcedPartOptions.splice(this.enforcedPartOptions.indexOf(e),1),this.handleChangedPartOptions()})}get contentDimension(){return this._contentDimension}get activeGroup(){return this._activeGroup}get groups(){return Array.from(this.groupViews.values())}get count(){return this.groupViews.size}get orientation(){return this.gridWidget&&this.gridWidget.orientation===0?1:0}get isReady(){return this._isReady}get hasRestorableState(){return!!this.workspaceMemento[_E.EDITOR_PART_UI_STATE_STORAGE_KEY]}get willRestoreState(){return this._willRestoreState}getGroups(e=0){switch(e){case 0:return this.groups;case 1:{let t=ui(this.mostRecentActiveGroups.map(o=>this.getGroup(o)));return jo([...t,...this.groups])}case 2:{let t=[];return this.gridWidget&&this.fillGridNodes(t,this.gridWidget.getViews()),t}}}fillGridNodes(e,t){vte(t)?t.children.forEach(o=>this.fillGridNodes(e,o)):e.push(t.view)}hasGroup(e){return this.groupViews.has(e)}getGroup(e){return this.groupViews.get(e)}findGroup(e,t=this.activeGroup,o){if(typeof e.direction=="number")return this.doFindGroupByDirection(e.direction,t,o);if(typeof e.location=="number")return this.doFindGroupByLocation(e.location,t,o);throw new Error("invalid arguments")}doFindGroupByDirection(e,t,o){let n=this.assertGroupView(t),r=this.gridWidget.getNeighborViews(n,this.toGridViewDirection(e),o);return r.sort(((s,l)=>this.mostRecentActiveGroups.indexOf(s.id)-this.mostRecentActiveGroups.indexOf(l.id))),r[0]}doFindGroupByLocation(e,t,o){let n=this.assertGroupView(t),r=this.getGroups(2),s=r.indexOf(n);switch(e){case 0:return r[0];case 1:return r[r.length-1];case 2:{let l=r[s+1];return!l&&o&&(l=this.doFindGroupByLocation(0,t)),l}case 3:{let l=r[s-1];return!l&&o&&(l=this.doFindGroupByLocation(1,t)),l}}}activateGroup(e,t,o){let n=this.assertGroupView(e);return this.doSetGroupActive(n,o),t||this.hostService.moveTop(Me(this.element)),n}restoreGroup(e){let t=this.assertGroupView(e);return this.doRestoreGroup(t),t}getSize(e){let t=this.assertGroupView(e);return this.gridWidget.getViewSize(t)}setSize(e,t){let o=this.assertGroupView(e);this.gridWidget.resizeView(o,t)}arrangeGroups(e,t=this.activeGroup){if(this.count<2||!this.gridWidget)return;let o=this.assertGroupView(t);switch(e){case 2:this.gridWidget.distributeViewSizes();break;case 0:if(this.groups.length<2)return;this.gridWidget.maximizeView(o),o.focus();break;case 1:this.gridWidget.expandView(o);break}}toggleMaximizeGroup(e=this.activeGroup){this.hasMaximizedGroup()?this.unmaximizeGroup():this.arrangeGroups(0,e)}toggleExpandGroup(e=this.activeGroup){this.isGroupExpanded(this.activeGroup)?this.arrangeGroups(2):this.arrangeGroups(1,e)}unmaximizeGroup(){this.gridWidget.exitMaximizedView(),this._activeGroup.focus()}hasMaximizedGroup(){return this.gridWidget.hasMaximizedView()}isGroupMaximized(e){return this.gridWidget.isViewMaximized(e)}isGroupExpanded(e){return this.gridWidget.isViewExpanded(e)}setGroupOrientation(e){if(!this.gridWidget)return;let t=e===0?1:0;this.gridWidget.orientation!==t&&(this.gridWidget.orientation=t)}applyLayout(e){let t=this.shouldRestoreFocus(this.container),o=0;function n(c){for(let u of c)Array.isArray(u.groups)?n(u.groups):o++}n(e.groups);let r=this.getGroups(2);if(o<r.length){let c=r[o-1];r.forEach((u,p)=>{p>=o&&this.mergeGroup(u,c)}),r=this.getGroups(2)}let s=this.activeGroup,l=Zki({orientation:this.toGridViewOrientation(e.orientation,this.isTwoDimensionalGrid()?this.gridWidget.orientation:ON(this.gridWidget.orientation)),groups:e.groups});this.doApplyGridState(l,s.id,r),t&&this._activeGroup.focus()}getLayout(){let e=this.gridWidget.serialize(),t=e.orientation===1?0:1,o=this.serializedNodeToGroupLayoutArgument(e.root);return{orientation:t,groups:o.groups}}serializedNodeToGroupLayoutArgument(e){return e.type==="branch"?{size:e.size,groups:e.data.map(t=>this.serializedNodeToGroupLayoutArgument(t))}:{size:e.size}}shouldRestoreFocus(e){return e?Un()===e.ownerDocument.body?!0:Is(e):!1}isTwoDimensionalGrid(){let e=this.gridWidget.getViews();return vte(e)?e.children.some(t=>vte(t)):!1}addGroup(e,t,o){let n=this.assertGroupView(e),r;if(n.groupsView===this){let s=this.shouldRestoreFocus(n.element),l=this.groupViews.size>1&&this.isGroupExpanded(n);r=this.doCreateGroupView(o),this.gridWidget.addView(r,this.getSplitSizingStyle(),n,this.toGridViewDirection(t)),this.updateContainer(),this._onDidAddGroup.fire(r),this.notifyGroupIndexChange(),l&&this.arrangeGroups(1,r),s&&n.focus()}else r=n.groupsView.addGroup(n,t,o);return r}getSplitSizingStyle(){switch(this._partOptions.splitSizing){case"distribute":return IW.Distribute;case"split":return IW.Split;default:return IW.Auto}}doCreateGroupView(e,t){let o;e instanceof oy?o=oy.createCopy(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):ZXe(e)?o=oy.createFromSerialized(e,this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t):o=oy.createNew(this.editorPartsView,this,this.groupsLabel,this.count,this.scopedInstantiationService,t),this.groupViews.set(o.id,o);let n=new O;return n.add(o.onDidFocus(()=>{this.doSetGroupActive(o),this._onDidFocus.fire()})),n.add(o.onDidModelChange(r=>{switch(r.kind){case 3:this._onDidChangeGroupLocked.fire(o);break;case 1:this._onDidChangeGroupIndex.fire(o);break;case 2:this._onDidChangeGroupLabel.fire(o);break}})),n.add(o.onDidActiveEditorChange(()=>{this.updateContainer()})),U.once(o.onWillDispose)(()=>{je(n),this.groupViews.delete(o.id),this.doUpdateMostRecentActive(o)}),o}doSetGroupActive(e,t=0){if(this._activeGroup!==e){let o=this._activeGroup;this._activeGroup=e,this.doUpdateMostRecentActive(e,!0),o&&!o.disposed&&o.setActive(!1),e.setActive(!0),this.doRestoreGroup(e),this._onDidChangeActiveGroup.fire(e)}this._onDidActivateGroup.fire({group:e,reason:t})}doRestoreGroup(e){if(this.gridWidget)try{this.hasMaximizedGroup()&&!this.isGroupMaximized(e)&&this.unmaximizeGroup();let t=this.gridWidget.getViewSize(e);(t.width===e.minimumWidth||t.height===e.minimumHeight)&&this.arrangeGroups(1,e)}catch{}}doUpdateMostRecentActive(e,t){let o=this.mostRecentActiveGroups.indexOf(e.id);o!==-1&&this.mostRecentActiveGroups.splice(o,1),t&&this.mostRecentActiveGroups.unshift(e.id)}toGridViewDirection(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3}}toGridViewOrientation(e,t){return typeof e=="number"?e===0?1:0:t}removeGroup(e,t){let o=this.assertGroupView(e);this.count!==1&&(o.isEmpty?this.doRemoveEmptyGroup(o,t):this.doRemoveGroupWithEditors(o))}doRemoveGroupWithEditors(e){let t=this.getGroups(1),o;this._activeGroup===e?o=t[1]:o=t[0],this.mergeGroup(e,o)}doRemoveEmptyGroup(e,t){let o=!t&&this.shouldRestoreFocus(this.container);if(this._activeGroup===e){let r=this.getGroups(1)[1];this.doSetGroupActive(r)}this.gridWidget.removeView(e,this.getSplitSizingStyle()),e.dispose(),o&&this._activeGroup.focus(),this.notifyGroupIndexChange(),this.updateContainer(),this._onDidRemoveGroup.fire(e)}moveGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t);if(n.id===r.id)throw new Error("Cannot move group into its own");let s=this.shouldRestoreFocus(n.element),l;return n.groupsView===r.groupsView?(this.gridWidget.moveView(n,this.getSplitSizingStyle(),r,this.toGridViewDirection(o)),l=n):(l=r.groupsView.addGroup(r,o,n),n.closeAllEditors(),this.removeGroup(n,s)),s&&l.focus(),this._onDidMoveGroup.fire(l),this.notifyGroupIndexChange(),l}copyGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t),s=this.shouldRestoreFocus(n.element),l=this.addGroup(r,o,n);return s&&l.focus(),l}mergeGroup(e,t,o){let n=this.assertGroupView(e),r=this.assertGroupView(t),s=[],l=o&&typeof o.index=="number"?o.index:r.count;for(let u of n.editors){let p=!n.isActive(u)||this._activeGroup!==n,h;r.contains(u)&&(r.isSticky(u)||o?.preserveExistingIndex)||(h=l,l++),s.push({editor:u,options:{index:h,inactive:p,preserveFocus:p}})}let c=!0;return o?.mode===0?n.copyEditors(s,r):c=n.moveEditors(s,r),n.isEmpty&&!n.disposed&&this.removeGroup(n,!0),c}mergeAllGroups(e,t){let o=this.assertGroupView(e),n=!0;for(let r of this.getGroups(1)){if(r===o)continue;this.mergeGroup(r,o,t)||(n=!1)}return n}assertGroupView(e){let t;if(typeof e=="number"?t=this.editorPartsView.getGroup(e):t=e,!t)throw new Error("Invalid editor group provided!");return t}createEditorDropTarget(e,t){return To(go(e)),this.scopedInstantiationService.createInstance(DPe,this,e,t)}get minimumWidth(){return Math.min(this.centeredLayoutWidget.minimumWidth,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(Me(this.container))).width)}get maximumWidth(){return this.centeredLayoutWidget.maximumWidth}get minimumHeight(){return Math.min(this.centeredLayoutWidget.minimumHeight,this.layoutService.getMaximumEditorDimensions(this.layoutService.getContainer(Me(this.container))).height)}get maximumHeight(){return this.centeredLayoutWidget.maximumHeight}get snap(){return this.layoutService.getPanelAlignment()==="center"}get onDidChange(){return U.any(this.centeredLayoutWidget.onDidChange,this.onDidSetGridWidget.event)}get gridSeparatorBorder(){return this.theme.getColor(uMt)||this.theme.getColor(Ei)||Ue.transparent}updateStyles(){this.container.style.backgroundColor=this.getColor(Bo)||"";let e={separatorBorder:this.gridSeparatorBorder,background:this.theme.getColor(iYe)||Ue.transparent};this.gridWidget.style(e),this.centeredLayoutWidget.styles(e)}createContentArea(e,t){return this.element=e,this.windowId!==ut.vscodeWindowId&&this.container.classList.add("auxiliary"),e.appendChild(this.container),this._willRestoreState=!t||t.restorePreviousState,this.doCreateGridControl(),this.centeredLayoutWidget=this._register(new mUt(this.container,this.gridWidgetView,this.profileMemento[_E.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY],this._partOptions.centeredLayoutFixedWidth)),this._register(this.onDidChangeEditorPartOptions(o=>this.centeredLayoutWidget.setFixedWidth(o.newPartOptions.centeredLayoutFixedWidth??!1))),this.setupDragAndDropSupport(e,this.container),this.handleContextKeys(),this.whenReadyPromise.complete(),this._isReady=!0,vn.settled(this.groups.map(o=>o.whenRestored)).finally(()=>{this.whenRestoredPromise.complete()}),this.container}handleContextKeys(){let e=y3.bindTo(this.scopedContextKeyService),t=CH.bindTo(this.scopedContextKeyService),o=L2.bindTo(this.scopedContextKeyService),n=()=>{this.count>1?e.set(!0):e.reset(),this.hasMaximizedGroup()?t.set(!0):t.reset()},r=()=>{o.set(this.partOptions.showTabs==="multiple")},s=()=>{if(!this.gridWidget||!this._contentDimension)return;let l;for(let c of this.groups)if(this.gridWidget.getNeighborViews(c,0).length===0&&this.gridWidget.getNeighborViews(c,3).length===0){l=c;break}for(let c of this.groups)this.editorPartsView.bind(Gso,c).set(c===l)};n(),r(),s(),this._register(this.onDidAddGroup(()=>{n(),s()})),this._register(this.onDidRemoveGroup(()=>{n(),s()})),this._register(this.onDidChangeGroupMaximized(()=>n())),this._register(this.onDidChangeEditorPartOptions(()=>r())),this._register(this.onDidMoveGroup(()=>s())),this._register(this.onDidLayout(()=>s()))}setupDragAndDropSupport(e,t){this._register(this.createEditorDropTarget(t,Object.create(null)));let o=_(".drop-block-overlay");e.appendChild(o),this._register(ML(o,()=>o.classList.remove("visible"))),this._register(m_.INSTANCE.registerTarget(this.element,{onDragStart:p=>o.classList.add("visible"),onDragEnd:p=>o.classList.remove("visible")}));let n,r,s,l,c=p=>{!this.layoutService.isVisible("workbench.parts.panel")&&p===this.layoutService.getPanelPosition()?this.layoutService.setPartHidden(!1,"workbench.parts.panel"):!this.layoutService.isVisible("workbench.parts.auxiliarybar")&&p===(this.layoutService.getSideBarPosition()===1?0:1)&&this.layoutService.setPartHidden(!1,"workbench.parts.auxiliarybar")},u=()=>{n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)};this._register(m_.INSTANCE.registerTarget(o,{onDragOver:p=>{Kt.stop(p.eventData,!0),p.eventData.dataTransfer&&(p.eventData.dataTransfer.dropEffect="none");let h=o.getBoundingClientRect(),g,f,v=100;p.eventData.clientX<h.left+v&&(g=0),p.eventData.clientX>h.right-v&&(g=1),p.eventData.clientY>h.bottom-v&&(f=2),p.eventData.clientY<h.top+v&&(f=3),n&&g!==s&&(clearTimeout(n),n=void 0),r&&f!==l&&(clearTimeout(r),r=void 0),!n&&g!==void 0&&(s=g,n=setTimeout(()=>c(g),200)),!r&&f!==void 0&&(l=f,r=setTimeout(()=>c(f),200))},onDragLeave:()=>u(),onDragEnd:()=>u(),onDrop:()=>u()}))}centerLayout(e){this.centeredLayoutWidget.activate(e)}isLayoutCentered(){return this.centeredLayoutWidget?this.centeredLayoutWidget.isActive():!1}doCreateGridControl(){let e=!1;if(this._willRestoreState&&(e=!this.doCreateGridControlWithPreviousState()),!this.gridWidget||e){let t=this.doCreateGroupView();this.doSetGridWidget(new P8(t)),this.doSetGroupActive(t)}this.updateContainer(),this.notifyGroupIndexChange()}doCreateGridControlWithPreviousState(){let e=this.loadState();if(e?.serializedGrid)try{this.mostRecentActiveGroups=e.mostRecentActiveGroups,this.doCreateGridControlWithState(e.serializedGrid,e.activeGroup)}catch(t){return mt(new Error(`Error restoring editor grid widget: ${t} (with state: ${JSON.stringify(e)})`)),this.disposeGroups(),!1}return!0}doCreateGridControlWithState(e,t,o,n){let r;o?r=o.slice(0):r=[];let s=[],l=P8.deserialize(e,{fromJSON:c=>{let u;return r.length>0?u=r.shift():u=this.doCreateGroupView(c,n),s.push(u),u.id===t&&this.doSetGroupActive(u),u}},{styles:{separatorBorder:this.gridSeparatorBorder}});this._activeGroup||this.doSetGroupActive(s[0]),this.mostRecentActiveGroups.some(c=>!this.getGroup(c))&&(this.mostRecentActiveGroups=s.map(c=>c.id)),this.doSetGridWidget(l)}doSetGridWidget(e){let t={};this.gridWidget&&(t=this.gridWidget.boundarySashes,this.gridWidget.dispose()),this.gridWidget=e,this.gridWidget.boundarySashes=t,this.gridWidgetView.gridWidget=e,this._onDidChangeSizeConstraints.input=e.onDidChange,this._onDidScroll.input=e.onDidScroll,this.gridWidgetDisposables.clear(),this.gridWidgetDisposables.add(e.onDidChangeViewMaximized(o=>this._onDidChangeGroupMaximized.fire(o))),this.onDidSetGridWidget.fire(void 0)}updateContainer(){this.container.classList.toggle("empty",this.isEmpty)}notifyGroupIndexChange(){this.getGroups(2).forEach((e,t)=>e.notifyIndexChanged(t))}notifyGroupsLabelChange(e){for(let t of this.groups)t.notifyLabelChanged(e)}get isEmpty(){return this.count===1&&this._activeGroup.isEmpty}setBoundarySashes(e){this.gridWidget.boundarySashes=e,this.centeredLayoutWidget.boundarySashes=e}layout(e,t,o,n){this.top=o,this.left=n;let r=super.layoutContents(e,t).contentSize;this.doLayout(di.lift(r),o,n)}doLayout(e,t=this.top,o=this.left){this._contentDimension=e,this.centeredLayoutWidget.layout(this._contentDimension.width,this._contentDimension.height,t,o),this._onDidLayout.fire(e)}saveState(){if(this.gridWidget&&(this.isEmpty?delete this.workspaceMemento[_E.EDITOR_PART_UI_STATE_STORAGE_KEY]:this.workspaceMemento[_E.EDITOR_PART_UI_STATE_STORAGE_KEY]=this.createState()),this.centeredLayoutWidget){let e=this.centeredLayoutWidget.state;this.centeredLayoutWidget.isDefault(e)?delete this.profileMemento[_E.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]:this.profileMemento[_E.EDITOR_PART_CENTERED_VIEW_STORAGE_KEY]=e}super.saveState()}loadState(){return this.workspaceMemento[_E.EDITOR_PART_UI_STATE_STORAGE_KEY]}createState(){return{serializedGrid:this.gridWidget.serialize(),activeGroup:this._activeGroup.id,mostRecentActiveGroups:this.mostRecentActiveGroups}}applyState(e,t){return e==="empty"?this.doApplyEmptyState():this.doApplyState(e,t)}async doApplyState(e,t){let o=await this.doPrepareApplyState();this._onDidAddGroup.pause(),this._onDidRemoveGroup.pause(),this.disposeGroups(),this.mostRecentActiveGroups=e.mostRecentActiveGroups;try{this.doApplyGridState(e.serializedGrid,e.activeGroup,void 0,t)}finally{this._onDidRemoveGroup.resume(),this._onDidAddGroup.resume()}await this.activeGroup.openEditors(o.flatMap(n=>n.editors).filter(n=>this.editorPartsView.groups.every(r=>!r.contains(n))).map(n=>({editor:n,options:{pinned:!0,preserveFocus:!0,inactive:!0}})))}async doApplyEmptyState(){await this.doPrepareApplyState(),this.mergeAllGroups(this.activeGroup)}async doPrepareApplyState(){let e=this.getGroups(1);for(let t of e)await t.closeAllEditors({excludeConfirming:!0});return e}doApplyGridState(e,t,o,n){this.doCreateGridControlWithState(e,t,o,n),this.doLayout(this._contentDimension),this.updateContainer();for(let r of this.getGroups(2))o?.includes(r)||this._onDidAddGroup.fire(r);this.notifyGroupIndexChange()}onDidChangeMementoState(e){if(e.external&&e.scope===1){this.reloadMemento(e.scope);let t=this.loadState();t&&this.applyState(t)}}toJSON(){return{type:"workbench.parts.editor"}}disposeGroups(){for(let e of this.groups)e.dispose(),this._onDidRemoveGroup.fire(e);this.groupViews.clear(),this.mostRecentActiveGroups=[]}dispose(){this._onWillDispose.fire(),this.disposeGroups(),this.gridWidget?.dispose(),super.dispose()}};_E=I([m(4,F),m(5,Pe),m(6,B),m(7,de),m(8,wi),m(9,ti),m(10,X)],_E);var RPe=class extends _E{constructor(i,e,t,o,n,r,s,l){super(i,"workbench.parts.editor","",ut.vscodeWindowId,e,t,o,n,r,s,l)}};RPe=I([m(1,F),m(2,Pe),m(3,B),m(4,de),m(5,wi),m(6,ti),m(7,X)],RPe);async function Ufo(a){let i=navigator.usb;if(!i)return;let e=await i.requestDevice({filters:a?.filters??[]});if(e)return{deviceClass:e.deviceClass,deviceProtocol:e.deviceProtocol,deviceSubclass:e.deviceSubclass,deviceVersionMajor:e.deviceVersionMajor,deviceVersionMinor:e.deviceVersionMinor,deviceVersionSubminor:e.deviceVersionSubminor,manufacturerName:e.manufacturerName,productId:e.productId,productName:e.productName,serialNumber:e.serialNumber,usbVersionMajor:e.usbVersionMajor,usbVersionMinor:e.usbVersionMinor,usbVersionSubminor:e.usbVersionSubminor,vendorId:e.vendorId}}async function zfo(a){let i=navigator.serial;if(!i)return;let e=await i.requestPort({filters:a?.filters??[]});if(!e)return;let t=e.getInfo();return{usbVendorId:t.usbVendorId,usbProductId:t.usbProductId}}async function Kfo(a){let i=navigator.hid;if(!i)return;let e=await i.requestDevice({filters:a?.filters??[]});if(!e.length)return;let t=e[0];return{opened:t.opened,vendorId:t.vendorId,productId:t.productId,productName:t.productName,collections:t.collections}}var oon=d(2377,null),non=d(2375,null),ron=d(2376,null),fUt={open:oon,close:non,find:ron};async function Gfo(a,i){let e=[];return await qfo(a,e,i.logsHome,i.logsHome),e}async function qfo(a,i,e,t){let o=await a.resolve(e);for(let{resource:n,isDirectory:r}of o.children||[])if(r)await qfo(a,i,n,t);else{let s=(await a.readFile(n)).value.toString();if(s){let l=lu(t,n);l&&i.push({relativePath:l,contents:s})}}}var eit=class{constructor(i,e,t,o){this.fileService=i;this.environmentService=e;this.lifecycleService=t;this.logService=o}async getLogs(){return Gfo(this.fileService,this.environmentService)}async whenWorkbenchRestored(){this.logService.info("[driver] Waiting for restored lifecycle phase..."),await this.lifecycleService.when(3),this.logService.info("[driver] Restored lifecycle phase reached. Waiting for contributions..."),await oe.as(Zi.Workbench).whenRestored,this.logService.info("[driver] Workbench contributions created.")}async setValue(i,e){let t=ut.document.querySelector(i);if(!t)return Promise.reject(new Error(`Element not found: ${i}`));let o=t;o.value=e;let n=new Event("input",{bubbles:!0,cancelable:!0});o.dispatchEvent(n)}async isActiveElement(i){if(ut.document.querySelector(i)!==ut.document.activeElement){let t=[],o=ut.document.activeElement;for(;o;){let n=o.tagName,r=o.id?`#${o.id}`:"",s=ui(o.className.split(/\s+/g).map(l=>l.trim())).map(l=>`.${l}`).join("");t.unshift(`${n}${r}${s}`),o=o.parentElement}throw new Error(`Active element not found. Current active element is '${t.join(" > ")}'. Looking for ${i}`)}return!0}async getElements(i,e){let t=ut.document.querySelectorAll(i),o=[];for(let n=0;n<t.length;n++){let r=t.item(n);o.push(this.serializeElement(r,e))}return o}serializeElement(i,e){let t=Object.create(null);for(let s=0;s<i.attributes.length;s++){let l=i.attributes.item(s);l&&(t[l.name]=l.value)}let o=[];if(e)for(let s=0;s<i.children.length;s++){let l=i.children.item(s);l&&o.push(this.serializeElement(l,!0))}let{left:n,top:r}=pF(i);return{tagName:i.tagName,className:i.className,textContent:i.textContent||"",attributes:t,children:o,left:n,top:r}}async getElementXY(i,e,t){let o=typeof e=="number"&&typeof t=="number"?{x:e,y:t}:void 0;return this._getElementXY(i,o)}async typeInEditor(i,e){let t=ut.document.querySelector(i);if(!t)throw new Error(`Editor not found: ${i}`);if(koi(t)){let o=t.editContext;if(!o)throw new Error(`Edit context not found: ${i}`);let n=o.selectionStart,r=o.selectionEnd,s=new TextUpdateEvent("textupdate",{updateRangeStart:n,updateRangeEnd:r,text:e,selectionStart:n+e.length,selectionEnd:n+e.length,compositionStart:0,compositionEnd:0});o.dispatchEvent(s)}else if(kY(t)){let o=t.selectionStart,n=o+e.length,r=t.value,s=r.substr(0,o)+e+r.substr(o);t.value=s,t.setSelectionRange(n,n);let l=new Event("input",{bubbles:!0,cancelable:!0});t.dispatchEvent(l)}}async getEditorSelection(i){let e=ut.document.querySelector(i);if(!e)throw new Error(`Editor not found: ${i}`);if(koi(e)){let t=e.editContext;if(!t)throw new Error(`Edit context not found: ${i}`);return{selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}}else{if(kY(e))return{selectionStart:e.selectionStart,selectionEnd:e.selectionEnd};throw new Error(`Unknown type of element: ${i}`)}}async getTerminalBuffer(i){let e=ut.document.querySelector(i);if(!e)throw new Error(`Terminal not found: ${i}`);let t=e.xterm;if(!t)throw new Error(`Xterm not found: ${i}`);let o=[];for(let n=0;n<t.buffer.active.length;n++)o.push(t.buffer.active.getLine(n).translateToString(!0));return o}async writeInTerminal(i,e){let t=ut.document.querySelector(i);if(!t)throw new Error(`Element not found: ${i}`);let o=t.xterm;if(!o)throw new Error(`Xterm not found: ${i}`);o.input(e)}getLocaleInfo(){return Promise.resolve({language:Kr,locale:Kye})}getLocalizedStrings(){return Promise.resolve({open:fUt.open,close:fUt.close,find:fUt.find})}async _getElementXY(i,e){let t=ut.document.querySelector(i);if(!t)return Promise.reject(new Error(`Element not found: ${i}`));let{left:o,top:n}=pF(t),{width:r,height:s}=wh(t),l,c;return e?(l=o+e.x,c=n+e.y):(l=o+r/2,c=n+s/2),l=Math.round(l),c=Math.round(c),{x:l,y:c}}};eit=I([m(0,ge),m(1,ko),m(2,to),m(3,re)],eit);function vUt(a){Object.assign(ut,{driver:a.createInstance(eit)})}var DR=class extends k{constructor(e,t={getWindowsCount:Dwe,getWindows:dx},o,n,r,s){super();this.hostService=o;this.environmentService=n;this.contextMenuService=r;this.layoutService=s;this.enableWindowFocusOnElementFocus(e),this.enableMultiWindowAwareTimeout(e,t),this.registerFullScreenListeners(e.vscodeWindowId),this.registerContextMenuListeners(e)}static{this.TIMEOUT_HANDLES=Number.MIN_SAFE_INTEGER}static{this.TIMEOUT_DISPOSABLES=new Map}enableWindowFocusOnElementFocus(e){let t=e.HTMLElement.prototype.focus,o=this;e.HTMLElement.prototype.focus=function(n){o.onElementFocus(Me(this)),t.apply(this,[n])}}onElementFocus(e){!e.document.hasFocus()&&sQi()&&(e.focus(),!this.environmentService.extensionTestsLocationURI&&!e.document.hasFocus()&&this.hostService.focus(e))}enableMultiWindowAwareTimeout(e,t={getWindowsCount:Dwe,getWindows:dx}){let o=e.setTimeout;Object.defineProperty(e,"vscodeOriginalSetTimeout",{get:()=>o});let n=e.clearTimeout;Object.defineProperty(e,"vscodeOriginalClearTimeout",{get:()=>n}),e.setTimeout=function(r,s=0,...l){if(t.getWindowsCount()===1||typeof r=="string"||s===0)return o.apply(this,[r,s,...l]);let c=new Set,u=DR.TIMEOUT_HANDLES++;DR.TIMEOUT_DISPOSABLES.set(u,c);let p=bd(r,()=>{je(c),DR.TIMEOUT_DISPOSABLES.delete(u)});for(let{window:h,disposables:g}of t.getWindows()){if(fI(h)&&h.document.visibilityState==="hidden")continue;let f=!1,v=h.vscodeOriginalSetTimeout?.apply(this,[(...S)=>{f||p(...S)},s,...l]),b=ee(()=>{f=!0,h.vscodeOriginalClearTimeout?.apply(this,[v]),c.delete(b),g.deleteAndLeak(b)});g.add(b),c.add(b)}return u},e.clearTimeout=function(r){let s=typeof r=="number"?DR.TIMEOUT_DISPOSABLES.get(r):void 0;s?(je(s),DR.TIMEOUT_DISPOSABLES.delete(r)):n.apply(this,[r])}}static async confirmOnShutdown(e,t){let o=e.get(ct),n=e.get(B),r=t===2?et?d(5186,null):d(5185,null):d(5176,null),s=t===2?et?d(5184,null):d(5178,null):d(5175,null),l=await o.confirm({message:r,primaryButton:s,checkbox:{label:d(5177,null)}});return l.confirmed&&l.checkboxChecked&&await n.updateValue("window.confirmBeforeClose","never"),l.confirmed}registerFullScreenListeners(e){this._register(this.hostService.onDidChangeFullScreen(({windowId:t,fullscreen:o})=>{if(t===e){let n=gv(e);n&&Gj(o,n.window)}}))}registerContextMenuListeners(e){if(e!==ut)return;let t=o=>this.layoutService.activeContainer.classList.toggle("context-menu-visible",o);this._register(this.contextMenuService.onDidShowContextMenu(()=>t(!0))),this._register(this.contextMenuService.onDidHideContextMenu(()=>t(!1)))}};DR=I([m(2,ti),m(3,Mt),m(4,Xe),m(5,wi)],DR);var bUt=class extends DR{constructor(e,t,o,n,r,s,l,c,u,p){super(ut,void 0,u,s,p,l);this.openerService=e;this.lifecycleService=t;this.dialogService=o;this.labelService=n;this.productService=r;this.browserEnvironmentService=s;this.instantiationService=c;this.registerListeners(),this.create()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(()=>this.onWillShutdown()));let e=Tc&&ut.visualViewport?ut.visualViewport:ut;this._register($(e,ne.RESIZE,()=>{this.layoutService.layout(),Tc&&ut.scrollTo(0,0)})),this._register($(this.layoutService.mainContainer,ne.WHEEL,t=>t.preventDefault(),{passive:!1})),this._register($(this.layoutService.mainContainer,ne.CONTEXT_MENU,t=>Kt.stop(t,!0))),this._register($(this.layoutService.mainContainer,ne.DROP,t=>Kt.stop(t,!0)))}onWillShutdown(){U.toPromise(U.any(U.once(new Zn(ut.document.body,ne.KEY_DOWN,!0).event),U.once(new Zn(ut.document.body,ne.MOUSE_DOWN,!0).event))).then(async()=>{await Li(3e3),await this.dialogService.prompt({type:wt.Error,message:d(5189,null),detail:d(5190,null),buttons:[{label:d(5187,null),run:()=>ut.location.reload()}]})})}create(){this.setupOpenHandlers(),this.registerLabelFormatters(),this.registerCommands(),this.setupDriver()}setupDriver(){this.environmentService.enableSmokeTestDriver&&vUt(this.instantiationService)}setupOpenHandlers(){this.openerService.setDefaultExternalOpener({openExternal:async e=>{let t=!1;if(this.browserEnvironmentService.options?.openerAllowedExternalUrlPrefixes){for(let o of this.browserEnvironmentService.options.openerAllowedExternalUrlPrefixes)if(e.startsWith(o)){t=!0;break}}if(hc(e,Q.http)||hc(e,Q.https))_S?bQi(e,!t)||await this.dialogService.prompt({type:wt.Warning,message:d(5191,null),custom:{markdownDetails:[{markdown:new he(d(5192,null,"https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:d(5188,null),run:()=>t?Toi(e):M4e(e)}],cancelButton:!0}):t?Toi(e):M4e(e);else{let o=()=>{this.lifecycleService.withExpectedShutdown({disableShutdownHandling:!0},()=>ut.location.href=e)};o();let n=async()=>{let{downloadUrl:r}=this.productService,s,l=[{label:d(5180,null),run:()=>o()}];r!==void 0?(s=d(5181,null,this.productService.nameLong,this.productService.nameLong),l.push({label:d(5179,null),run:async()=>{await this.openerService.open(A.parse(r)),n()}})):s=d(5182,null,this.productService.nameLong,this.productService.nameLong),await this.hostService.withExpectedShutdown(()=>this.dialogService.prompt({type:wt.Info,message:d(5183,null),detail:s,buttons:l,cancelButton:!0}))};hc(e,this.productService.urlProtocol)&&await n()}return!0}})}registerLabelFormatters(){this._register(this.labelService.registerFormatter({scheme:Q.vscodeUserData,priority:!0,formatting:{label:"(Settings) ${path}",separator:"/"}}))}registerCommands(){Ge.registerCommand("workbench.experimental.requestUsbDevice",async(e,t)=>Ufo(t)),Ge.registerCommand("workbench.experimental.requestSerialPort",async(e,t)=>zfo(t)),Ge.registerCommand("workbench.experimental.requestHidDevice",async(e,t)=>Kfo(t))}};bUt=I([m(0,Je),m(1,to),m(2,ct),m(3,nt),m(4,Ze),m(5,Od),m(6,wi),m(7,F),m(8,ti),m(9,Xe)],bUt);var RR=le("auxiliaryWindowService");var son=new di(Mkt.width,Mkt.height),Ohe=class extends DR{constructor(e,t,o,n,r,s,l,c){super(e,void 0,r,s,l,c);this.window=e;this.container=t;this.configurationService=n;this._onWillLayout=this._register(new T);this.onWillLayout=this._onWillLayout.event;this._onDidLayout=this._register(new T);this.onDidLayout=this._onDidLayout.event;this._onBeforeUnload=this._register(new T);this.onBeforeUnload=this._onBeforeUnload.event;this._onUnload=this._register(new T);this.onUnload=this._onUnload.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this.compact=!1;this.whenStylesHaveLoaded=o.wait().then(()=>{}),this.registerListeners()}updateOptions(e){this.compact=e.compact}registerListeners(){this._register($(this.window,ne.BEFORE_UNLOAD,e=>this.handleBeforeUnload(e))),this._register($(this.window,ne.UNLOAD,()=>this.handleUnload())),this._register($(this.window,"unhandledrejection",e=>{mt(e.reason),e.preventDefault()})),this._register($(this.window,ne.RESIZE,()=>this.layout())),this._register($(this.container,ne.SCROLL,()=>this.container.scrollTop=0)),Ft?(this._register($(this.container,ne.DROP,e=>Kt.stop(e,!0))),this._register($(this.container,ne.WHEEL,e=>e.preventDefault(),{passive:!1})),this._register($(this.container,ne.CONTEXT_MENU,e=>Kt.stop(e,!0)))):(this._register($(this.window.document.body,ne.DRAG_OVER,e=>Kt.stop(e))),this._register($(this.window.document.body,ne.DROP,e=>Kt.stop(e))))}handleBeforeUnload(e){let t;if(this._onBeforeUnload.fire({veto(r){r&&(t=r)}}),t){this.handleVetoBeforeClose(e,t);return}let o=this.configurationService.getValue("window.confirmBeforeClose");(o==="always"||o==="keyboardOnly"&&Ab.getInstance().isModifierPressed)&&this.confirmBeforeClose(e)}handleVetoBeforeClose(e,t){this.preventUnload(e)}preventUnload(e){e.preventDefault(),e.returnValue=d(18691,null)}confirmBeforeClose(e){this.preventUnload(e)}handleUnload(){this._onUnload.fire()}layout(){let e=wh(this.window.document.body,son,this.container);this._onWillLayout.fire(e),this._onDidLayout.fire(e)}createState(){return{bounds:{x:this.window.screenX,y:this.window.screenY,width:this.window.outerWidth,height:this.window.outerHeight},zoomLevel:nx(this.window),compact:this.compact}}dispose(){this._store.isDisposed||(this._onWillDispose.fire(),super.dispose())}};Ohe=I([m(3,B),m(4,ti),m(5,Mt),m(6,Xe),m(7,wi)],Ohe);var $8=class extends k{constructor(e,t,o,n,r,s,l){super();this.layoutService=e;this.dialogService=t;this.configurationService=o;this.telemetryService=n;this.hostService=r;this.environmentService=s;this.contextMenuService=l;this._onDidOpenAuxiliaryWindow=this._register(new T);this.onDidOpenAuxiliaryWindow=this._onDidOpenAuxiliaryWindow.event;this.windows=new Map}static{this.WINDOW_IDS=hv(ut)+1}async open(e){Wo("code/auxiliaryWindow/willOpen");let t=await this.openWindow(e);if(!t)throw new Error(d(18695,null));let o=await this.resolveWindowId(t);dvt(t,o);let n=new O,{container:r,stylesLoaded:s}=this.createContainer(t,n,e),l=this.createAuxiliaryWindow(t,r,s);l.updateOptions({compact:e?.compact??!1});let c=new O;this.windows.set(t.vscodeWindowId,l),c.add(ee(()=>this.windows.delete(t.vscodeWindowId)));let u=new O;return U.once(l.onWillDispose)(()=>{t.close(),n.dispose(),c.dispose(),u.dispose()}),c.add(iQi(t)),this._onDidOpenAuxiliaryWindow.fire({window:l,disposables:u}),Wo("code/auxiliaryWindow/didOpen"),this.telemetryService.publicLog2("auxiliaryWindowOpen",{bounds:!!e?.bounds}),l}createAuxiliaryWindow(e,t,o){return new Ohe(e,t,o,this.configurationService,this.hostService,this.environmentService,this.contextMenuService,this.layoutService)}async openWindow(e){let t=zi(),o={x:t.screenX,y:t.screenY,width:t.outerWidth,height:t.outerHeight},n=Mkt,r=Math.max(e?.bounds?.width??n.width,qke.WIDTH),s=Math.max(e?.bounds?.height??n.height,qke.HEIGHT),l={x:e?.bounds?.x??Math.max(o.x+o.width/2-r/2,0),y:e?.bounds?.y??Math.max(o.y+o.height/2-s/2,0),width:r,height:s};!e?.bounds&&l.x===o.x&&l.y===o.y&&(l={...l,x:l.x+30,y:l.y+30});let c=ui(["popup=yes",`left=${l.x}`,`top=${l.y}`,`width=${l.width}`,`height=${l.height}`,e?.nativeTitlebar?"window-native-titlebar=yes":void 0,e?.disableFullscreen?"window-disable-fullscreen=yes":void 0,e?.alwaysOnTop?"window-always-on-top=yes":void 0,e?.mode===0?"window-maximized=yes":void 0,e?.mode===2?"window-fullscreen=yes":void 0]),u=ut.open(Gye?"":"about:blank",void 0,c.join(","));return!u&&Ft?(await this.dialogService.prompt({type:wt.Warning,message:d(18693,null),custom:{markdownDetails:[{markdown:new he(d(18694,null,"https://aka.ms/allow-vscode-popup"),!0)}]},buttons:[{label:d(18692,null),run:()=>this.openWindow(e)}],cancelButton:!0})).result:u?.window}async resolveWindowId(e){return $8.WINDOW_IDS++}createContainer(e,t,o){e.document.createElement=function(){throw new Error('Not allowed to create elements in child window JavaScript context. Always use the main window so that "xyz instanceof HTMLElement" continues to work.')},this.applyMeta(e);let{stylesLoaded:n}=this.applyCSS(e,t),r=this.applyHTML(e,t);return{stylesLoaded:n,container:r}}applyMeta(e){for(let o of['meta[charset="utf-8"]','meta[http-equiv="Content-Security-Policy"]','meta[name="viewport"]','meta[name="theme-color"]']){let n=ut.document.querySelector(o);if(n){let r=Obt(e.document.head);if(Hbt(n,r),o==='meta[http-equiv="Content-Security-Policy"]'){let s=r.getAttribute("content");s&&r.setAttribute("content",s.replace(/(script-src[^\;]*)/,"script-src 'none'"))}}}let t=ut.document.querySelector('link[rel="icon"]');if(t){let o=Fbt(e.document.head);Hbt(t,o)}}applyCSS(e,t){Wo("code/auxiliaryWindow/willApplyCSS");let o=new Map,n=new ip;n.wait().then(()=>Wo("code/auxiliaryWindow/didLoadCSSStyles"));let r=t.add(new O),s=0;function l(){--s===0&&(r.dispose(),n.open())}function c(u){if(E9i(u))return;let p=e.document.head.appendChild(u.cloneNode(!0));u.tagName.toLowerCase()==="link"&&(s++,r.add($(p,"load",l)),r.add($(p,"error",l))),o.set(u,p)}s++;try{for(let u of ut.document.head.querySelectorAll('link[rel="stylesheet"], style'))c(u)}finally{l()}return t.add(T9i(e)),t.add(R4e.observe(ut.document.head,t,{childList:!0,subtree:!0})(u=>{for(let p of u)if(!(p.type!=="childList"||p.target.nodeName.toLowerCase()==="title"||p.target.nodeName.toLowerCase()==="script"||p.target.nodeName.toLowerCase()==="meta")){for(let h of p.addedNodes)if(go(h)&&(h.tagName.toLowerCase()==="style"||h.tagName.toLowerCase()==="link"))c(h);else if(h.nodeType===Node.TEXT_NODE&&h.parentNode){let g=o.get(h.parentNode);g&&(g.textContent=h.textContent)}for(let h of p.removedNodes){let g=o.get(h);g&&(g.parentNode?.removeChild(g),o.delete(h))}}})),Wo("code/auxiliaryWindow/didApplyCSS"),{stylesLoaded:n}}applyHTML(e,t){Wo("code/auxiliaryWindow/willApplyHTML");let o=_("div",{role:"application"});return aQi(o,0,0,0,0,"relative"),o.style.display="flex",o.style.height="100%",o.style.flexDirection="column",e.document.body.append(o),t.add(Ubt(ut.document.documentElement,e.document.documentElement)),t.add(Ubt(ut.document.body,e.document.body)),t.add(Ubt(this.layoutService.mainContainer,o,["class"])),Wo("code/auxiliaryWindow/didApplyHTML"),o}getWindow(e){return this.windows.get(e)}};$8=I([m(0,wi),m(1,ct),m(2,B),m(3,_e),m(4,ti),m(5,Mt),m(6,Xe)],$8);Ce(RR,$8,1);var aP=le("titleService");var SUt=bp(new T);W(class extends z{constructor(){super({id:"workbench.action.toggleCompactAuxiliaryWindow",title:P(4479,"Toggle Window Compact Mode"),category:Fe.View,f1:!0,precondition:ew})}async run(){SUt.fire({windowId:zi().vscodeWindowId,compact:"toggle"})}});W(class extends z{constructor(){super({id:"workbench.action.enableCompactAuxiliaryWindow",title:d(4478,null),icon:L.screenFull,menu:{id:R.LayoutControlMenu,when:C.and(N0.toNegated(),Qf),order:0}})}async run(){SUt.fire({windowId:zi().vscodeWindowId,compact:!0})}});W(class extends z{constructor(){super({id:"workbench.action.disableCompactAuxiliaryWindow",title:d(4477,null),icon:L.screenNormal,menu:{id:R.LayoutControlMenu,when:C.and(N0,Qf),order:0}})}async run(){SUt.fire({windowId:zi().vscodeWindowId,compact:!1})}});var yU=class{constructor(i,e,t,o,n,r,s,l,c){this.editorPartsView=i;this.instantiationService=e;this.auxiliaryWindowService=t;this.lifecycleService=o;this.configurationService=n;this.statusbarService=r;this.titleService=s;this.editorService=l;this.layoutService=c}static{this.STATUS_BAR_VISIBILITY="workbench.statusBar.visible"}async create(i,e){let t=this,o=new O,n=!!e?.compact;function r(){let E=0;return y&&(E+=S.height),f&&v&&(E+=f.height),E}function s(E){y?Xo(S.container):Wi(S.container),E&&u.layout()}function l(E){f&&(v?Xo(f.container):Wi(f.container),E&&u.layout())}function c(E){if(E===n)return;n=E,u.updateOptions({compact:n}),f?.updateOptions({compact:n}),h.updateOptions({compact:n});let M=y;y=!n&&t.configurationService.getValue(yU.STATUS_BAR_VISIBILITY)!==!1,M!==y&&s(!0)}let u=o.add(await this.auxiliaryWindowService.open(e)),p=_(".part.editor",{role:"main"});p.style.position="relative",u.container.appendChild(p);let h=o.add(this.instantiationService.createInstance(Fhe,u.window.vscodeWindowId,this.editorPartsView,e?.state,i));h.updateOptions({compact:n}),o.add(this.editorPartsView.registerPart(h)),h.create(p);let g=o.add(h.scopedInstantiationService.createChild(new Po([ie,this.editorService.createScoped(h,o)]))),f,v=!1;if(Qr&&JF(this.configurationService)){f=o.add(this.titleService.createAuxiliaryTitlebarPart(u.container,h,g)),f.updateOptions({compact:n}),v=WH(this.configurationService,u.window,void 0);let E=()=>{let M=v;v=WH(this.configurationService,u.window,void 0),M!==v&&l(!0)};o.add(f.onDidChange(()=>u.layout())),o.add(this.layoutService.onDidChangePartVisibility(()=>E())),o.add(ZO(M=>{M===u.window.vscodeWindowId&&E()})),l(!1)}else o.add(g.createInstance(CR,u.window));let S=o.add(this.statusbarService.createAuxiliaryStatusbarPart(u.container,g)),y=!n&&this.configurationService.getValue(yU.STATUS_BAR_VISIBILITY)!==!1;o.add(this.configurationService.onDidChangeConfiguration(E=>{E.affectsConfiguration(yU.STATUS_BAR_VISIBILITY)&&(y=!n&&this.configurationService.getValue(yU.STATUS_BAR_VISIBILITY)!==!1,s(!0))})),s(!1);let w=o.add(U.once(h.onWillClose)(()=>u.window.close()));o.add(U.once(u.onUnload)(()=>{o.isDisposed||(w.dispose(),h.close(),o.dispose())})),o.add(U.once(this.lifecycleService.onDidShutdown)(()=>o.dispose())),o.add(u.onBeforeUnload(E=>{for(let M of h.groups)for(let N of M.editors){let V=N.canMove(M.id,this.editorPartsView.mainPart.activeGroup.id);if(typeof V=="string"){M.openEditor(N),E.veto(V);return}}})),o.add(u.onWillLayout(E=>{let M=f?.height??0;f?.layout(E.width,M,0,0);let N=E.height-r();h.layout(E.width,N,M,0),S.layout(E.width,S.height,E.height-S.height,0)})),u.layout(),o.add(SUt.event(E=>{if(E.windowId===u.window.vscodeWindowId){let M;typeof E.compact=="boolean"?M=E.compact:M=!n,c(M)}})),o.add(h.onDidAddGroup(E=>{c(!1),o.add(E.onDidActiveEditorChange(()=>{E.count>1&&c(!1)}))})),o.add(h.activeGroup.onDidActiveEditorChange(()=>{h.activeGroup.count>1&&c(!1)}));let x=o.add(g.createChild(new Po([Fr,this.statusbarService.createScoped(S,o)])));return{part:h,instantiationService:x,disposables:o}}};yU=I([m(1,F),m(2,RR),m(3,to),m(4,B),m(5,Fr),m(6,aP),m(7,ie),m(8,wi)],yU);var Fhe=class extends _E{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Fhe.COUNTER++;super(t,`workbench.parts.auxiliaryEditor.${g}`,n,e,r,s,l,c,u,p,h);this.state=o;this._onWillClose=this._register(new T);this.onWillClose=this._onWillClose.event;this.optionsDisposable=this._register(new ue);this.isCompact=!1}static{this.COUNTER=1}handleContextKeys(){Qf.bindTo(this.scopedContextKeyService).set(!0),super.handleContextKeys()}updateOptions(e){this.isCompact=e.compact,e.compact?this.optionsDisposable.value||(this.optionsDisposable.value=this.enforcePartOptions({showTabs:"none",closeEmptyGroups:!0})):this.optionsDisposable.clear()}addGroup(e,t,o){return this.isCompact&&(e=this.editorPartsView.mainPart.activeGroup),super.addGroup(e,t,o)}removeGroup(e,t){let o=this.assertGroupView(e);this.count===1&&this.activeGroup===o?this.doRemoveLastGroup(t):super.removeGroup(e,t)}doRemoveLastGroup(e){let t=!e&&this.shouldRestoreFocus(this.container),n=this.editorPartsView.getGroups(1)[1];n&&n.groupsView.activateGroup(n,void 0,1),n&&t&&(n.groupsView===this.editorPartsView.mainPart&&!this.layoutService.isVisible("workbench.parts.editor",ut)||n.focus()),this.doClose(!1)}loadState(){return this.state}saveState(){}close(){return this.doClose(!0)}doClose(e){let t=!0;if(e){for(let o of this.groups)o.closeAllEditors({excludeConfirming:!0});if(t=this.mergeGroupsToMainPart(),!t)return!1}return this._onWillClose.fire(),t}mergeGroupsToMainPart(){if(!this.groups.some(o=>o.count>0))return!0;let e;for(let o of this.editorPartsView.mainPart.getGroups(1))if(!o.isLocked){e=o;break}e||(e=this.editorPartsView.mainPart.addGroup(this.editorPartsView.mainPart.activeGroup,this.partOptions.openSideBySideDirection==="right"?3:1));let t=this.mergeAllGroups(e,{preserveExistingIndex:!0});return e.focus(),t}};Fhe=I([m(4,F),m(5,Pe),m(6,B),m(7,de),m(8,wi),m(9,ti),m(10,X)],Fhe);var tit=400,aon=300,lon=1400,con=900,qTi=1,KTi=qTi*2,iit=33,$fo=20,jfo=16,oit=160,GTi=260,Qfo=8,don=1,uon=new Set(["workbench.action.quit","workbench.action.reloadWindow","workbench.action.toggleFullScreen","workbench.action.gotoSymbol","workbench.action.gotoLine","workbench.action.zoomIn","workbench.action.zoomOut","workbench.action.zoomReset","workbench.action.files.save","workbench.action.files.saveAll","workbench.action.files.revert","workbench.action.closeActiveEditor","workbench.action.closeAllEditors","workbench.action.closeEditorsInGroup","workbench.action.closeUnmodifiedEditors","workbench.action.openSettings","workbench.action.openSettings2","workbench.action.openSettingsJson","workbench.action.openGlobalSettings","workbench.action.openApplicationSettingsJson","workbench.action.openRawDefaultSettings","workbench.action.openWorkspaceSettings","workbench.action.openWorkspaceSettingsFile","workbench.action.openFolderSettings","workbench.action.openFolderSettingsFile","workbench.action.openRemoteSettings","workbench.action.openRemoteSettingsFile","workbench.action.openAccessibilitySettings","workbench.action.configureLanguageBasedSettings","workbench.action.openGlobalKeybindings","workbench.action.openDefaultKeybindingsFile","workbench.action.openGlobalKeybindingsFile","workbench.action.openKeyboardLayoutPicker",BEi,HEi,UEi,zEi,KEi,GEi,XVt]),nit="workbench.editor.useModal",LPe=class{constructor(i,e,t,o,n,r,s,l){this.editorPartsView=i;this.instantiationService=e;this.editorService=t;this.layoutService=o;this.keybindingService=n;this.hostService=r;this.configurationService=s;this.contextMenuService=l}async create(i){let e=new O,t=_(".monaco-modal-editor-block");this.layoutService.mainContainer.appendChild(t),e.add(ee(()=>t.remove())),e.add($(t,ne.MOUSE_DOWN,_i=>{_i.target===t&&(Kt.stop(_i,!0),M.close())}));let o=this.configurationService.getValue(nit);e.add(this.configurationService.onDidChangeConfiguration(_i=>{_i.affectsConfiguration(nit)&&(o=this.configurationService.getValue(nit))})),e.add($(t,ne.KEY_DOWN,_i=>{let ln=new mi(_i);if(o!=="all"){let Tn=this.keybindingService.softDispatch(ln,this.layoutService.mainContainer);Tn.kind===2&&Tn.commandId&&Tn.commandId.startsWith("workbench.")&&!uon.has(Tn.commandId)&&Kt.stop(ln,!0)}}));let n=new uM;e.add(ee(()=>n.dispose())),n.domNode.classList.add("modal-editor-resizable");let r=tit+(i?.sidebar?oit:0);n.minSize=new di(r,aon),t.appendChild(n.domNode);let s=n.domNode.appendChild(_(".modal-editor-shadow")),l="modal-editor-title",c=_(".part.editor.modal-editor-part",{role:"dialog","aria-modal":"true","aria-labelledby":l});s.appendChild(c);let u=c.appendChild(_(".modal-editor-header")),p=D(u,_("div.modal-editor-sidebar-toggle"));i?.sidebar||Wi(p);let h=i?.sidebar?.sidebarHidden?L.layoutSidebarLeftOff:L.layoutSidebarLeft,g=e.add(new it(XVt,d(4955,null),q.asClassName(h),!0)),f=e.add(new oo(p));f.push(g,{icon:!0,label:!1});let v=D(u,_("div.modal-editor-title.show-file-icons"));v.id=l,v.textContent="";let b=D(u,_("div.modal-editor-navigation"));Wi(b),e.add($(b,ne.DBLCLICK,_i=>Kt.stop(_i,!0)));let S=e.add(new Pi(b,{title:d(4954,null)}));S.icon=L.chevronLeft,S.element.classList.add("modal-editor-nav-button"),e.add(S.onDidClick(()=>{let _i=M.navigation;_i&&_i.current>0&&_i.navigate(_i.current-1)}));let y=D(b,_("span.modal-editor-nav-label"));y.setAttribute("aria-live","polite");let w=e.add(new Pi(b,{title:d(4953,null)}));w.icon=L.chevronRight,w.element.classList.add("modal-editor-nav-button"),e.add(w.onDidClick(()=>{let _i=M.navigation;_i&&_i.current<_i.total-1&&_i.navigate(_i.current+1)}));let x=D(u,_("div.modal-editor-action-container")),E=this.createSidebar(c,i?.sidebar,e);E&&(E.isVisible()&&c.classList.add("has-sidebar"),e.add(E.onDidResize(()=>No())));let M=e.add(this.instantiationService.createInstance(Whe,ut.vscodeWindowId,this.editorPartsView,t,i));e.add(this.editorPartsView.registerPart(M)),M.create(c),e.add(U.once(M.onWillClose)(()=>e.dispose())),e.add(U.runAndSubscribe(M.onDidChangeNavigation,(_i=>{_i&&_i.total>1?(Xo(b),y.textContent=d(4952,null,_i.current+1,_i.total),S.enabled=_i.current>0,w.enabled=_i.current<_i.total-1):Wi(b)}),M.navigation)),E&&(e.add(U.runAndSubscribe(E.onDidResize,()=>{E.isVisible()&&(M.sidebarWidth=E.hasCustomWidth()?E.getWidth():void 0)})),e.add(M.onDidToggleSidebar(()=>{E.setVisible(!M.sidebarHidden),g.class=q.asClassName(M.sidebarHidden?L.layoutSidebarLeftOff:L.layoutSidebarLeft),No()}))),e.add(f.onDidRun(()=>M.toggleSidebar()));let N=this.editorService.createScoped(M,e),V=e.add(M.scopedInstantiationService.createChild(new Po([ie,N]))),H=D(x,_("div.modal-editor-editor-actions")),K=e.add(V.createInstance(dl,H,{hiddenItemStrategy:-1,highlightToggledItems:!0})),j=D(x,_("div.modal-editor-action-separator")),J=e.add(new O),se=()=>{J.clear();let _i=M.activeGroup.createEditorActions(J,R.ModalEditorEditorTitle);J.add(_i.onDidChange(()=>se()));let{primary:ln,secondary:Tn}=_i.actions;K.setActions(Kk(ln),Kk(Tn));let Ko=ln.length>0||Tn.length>0;Md(Ko,j)};e.add(U.runAndSubscribe(N.onDidActiveEditorChange,()=>se())),e.add(N.onDidEditorsChange(()=>M.enforceModalPartOptions())),e.add(V.createInstance(pr,x,R.ModalEditorTitle,{hiddenItemStrategy:-1,highlightToggledItems:!0,menuOptions:{shouldForwardArgs:!0}}));let ae=e.add(V.createInstance(CE,v,{})),ce=e.add(new ue),Se,Re=()=>{let _i=M.activeGroup.activeEditor;if(_i){let{labelFormat:ln}=M.partOptions;ae.element.setResource({resource:po.getOriginalUri(_i,{supportSideBySide:3}),name:_i.getName(),description:_i.getDescription(ln==="short"?0:ln==="long"?2:1)||""},{icon:_i.getIcon(),extraClasses:_i.getLabelExtraClasses()}),Se!==_i&&(Se=_i,ce.value=_i.onDidChangeLabel(()=>Re()))}else ae.element.clear(),Se=void 0,ce.clear()};e.add(U.runAndSubscribe(N.onDidActiveEditorChange,Re)),e.add($(u,ne.DBLCLICK,_i=>{Kt.stop(_i),M.handleHeaderDoubleClick()})),e.add($(u,ne.CONTEXT_MENU,_i=>{let ln=_i.target;if(go(ln)&&(ln.closest(".monaco-button")||ln.closest(".action-item")))return;Kt.stop(_i,!0);let Tn=new O,Ko=M.activeGroup,Bn=Ko.activeEditor,Mr=Ko.activeEditorPane?.scopedContextKeyService??Ko.scopedContextKeyService,va=Ko.createEditorActions(Tn,R.EditorTitle),{primary:$s,secondary:_l}=va.actions;this.contextMenuService.showContextMenu({menuId:R.ModalEditorTitleContext,contextKeyService:Mr,getAnchor:()=>({x:_i.clientX,y:_i.clientY}),getActions:()=>oi.join($s,_l),getActionsContext:()=>({groupId:Ko.id,editorIndex:Bn?Ko.getIndexOfEditor(Bn):void 0}),getKeyBinding:mc=>this.keybindingService.lookupKeybinding(mc.id,Mr),onHide:()=>Tn.dispose()})}));let xe=_i=>{let{width:ln,height:Tn}=n.size,{top:Ko,left:Bn}=n.domNode.style,Mr=E?.getWidth()??0;M.layout(Math.max(0,ln-KTi-Mr),Tn-KTi-iit,parseFloat(Ko)+qTi+iit,parseFloat(Bn)+qTi+Mr),_i&&E?.layout(Tn-KTi-iit)},He=e.add(new fT),Ee=e.add(new O),Te=!1;e.add($(u,ne.POINTER_DOWN,_i=>{if(M.maximized||_i.button!==0)return;let ln=_i.target;if(!go(ln)||ln.closest(".monaco-button")||ln.closest(".action-item"))return;Kt.stop(_i,!0),Ee.clear(),u.classList.add("dragging"),Ee.add(ee(()=>u.classList.remove("dragging")));let Tn=_i.clientX,Ko=_i.clientY,Bn=parseFloat(n.domNode.style.left)||0,Mr=parseFloat(n.domNode.style.top)||0;Te=!1;let va=_l=>{Te=!0,Kt.stop(_l,!0);let mc=this.layoutService.mainContainerDimension,su=this.layoutService.mainContainerOffset.top,yu=n.size.width,sr=n.size.height,Lo=0,kc=su,Cn=Math.max(Lo,mc.width-yu),xa=Math.max(kc,mc.height-sr),Os=Math.max(Lo,Math.min(Cn,Bn+(_l.clientX-Tn))),rl=Math.max(kc,Math.min(xa,Mr+(_l.clientY-Ko))),js=(mc.width-yu)/2,Fh=Math.max(su,(mc.height-sr)/2);Math.abs(Os-js)<$fo&&Math.abs(rl-Fh)<$fo&&(Os=js,rl=Fh),n.domNode.style.left=`${Os}px`,n.domNode.style.top=`${rl}px`,xe(!1)},$s=()=>{if(Ee.clear(),Te){let _l=parseFloat(n.domNode.style.left)||0,mc=parseFloat(n.domNode.style.top)||0,su=this.layoutService.mainContainerDimension,yu=this.layoutService.mainContainerOffset.top,sr=(su.width-n.size.width)/2,Lo=Math.max(yu,(su.height-n.size.height)/2);Math.abs(_l-sr)<1&&Math.abs(mc-Lo)<1?M.position=void 0:M.position={left:_l,top:mc}}};He.startMonitoring(u,_i.pointerId,_i.buttons,va,$s)})),e.add($(u,ne.CLICK,_i=>{let ln=Te;Te=!1,!ln&&(Kt.stop(_i),M.activeGroup.focus())}));let It=!1,tt=0,Oi=0,zt=di.None;e.add(n.onDidWillResize(()=>{It=!0,tt=parseFloat(n.domNode.style.left)||0,Oi=parseFloat(n.domNode.style.top)||0,zt=new di(n.size.width,n.size.height)})),e.add(n.onDidResize(_i=>{if(!_i.done){let ln=this.layoutService.mainContainerDimension,Tn=this.layoutService.mainContainerOffset.top,Ko=_i.dimension.width-zt.width,Bn=_i.dimension.height-zt.height,Mr=_i.west?tt-Ko:tt,va=_i.north?Oi-Bn:Oi,$s=_i.dimension.width,_l=_i.dimension.height;Mr<0&&($s+=Mr,Mr=0),va<Tn&&(_l+=va-Tn,va=Tn),Mr+$s>ln.width&&($s=ln.width-Mr),va+_l>ln.height&&(_l=ln.height-va),($s!==_i.dimension.width||_l!==_i.dimension.height)&&n.layout(_l,$s),_i.west&&(n.domNode.style.left=`${Mr}px`),_i.north&&(n.domNode.style.top=`${va}px`)}if(xe(!0),_i.done){It=!1;let ln=mo(),Tn=n.size;Tn.width===ln.width&&Tn.height===ln.height?(M.size=void 0,M.position=void 0,No()):(M.size=new di(Tn.width,Tn.height),M.position={left:parseFloat(n.domNode.style.left)||0,top:parseFloat(n.domNode.style.top)||0})}}));let mo=()=>{let _i=this.layoutService.mainContainerDimension,ln=this.layoutService.mainContainerOffset.top,Tn=Math.max(_i.height-ln,0),Ko=_i.width*.8,Bn=Tn*.8,Mr=Math.min(Ko,lon,_i.width),va=Math.min(Bn,con,Tn);return new di(Mr,va)},dn=!0,No=()=>{if(It)return;let _i=this.layoutService.mainContainerDimension,ln=this.layoutService.mainContainerOffset.top,Tn=Math.max(_i.height-ln,0),Ko=mo(),Bn,Mr;if(M.maximized){let $s=Math.max(ln,jfo);Bn=Math.max(_i.width-jfo,0),Mr=Math.max(Tn-$s,0)}else M.size?(Bn=Math.min(M.size.width,_i.width),Mr=Math.min(M.size.height,Tn)):(Bn=Ko.width,Mr=Ko.height);Mr=Math.min(Mr,Tn),dn&&(dn=!1,E?.clampWidth(Bn)),n.maxSize=new di(_i.width,Tn),n.preferredSize=Ko,n.layout(Mr,Bn);let va=!M.maximized;if(n.enableSashes(va,va,va,va),!M.maximized&&M.position){let $s=Math.max(0,Math.min(M.position.left,_i.width-Bn)),_l=Math.max(ln,Math.min(M.position.top,ln+Tn-Mr));n.domNode.style.left=`${$s}px`,n.domNode.style.top=`${_l}px`}else{let $s=(_i.width-Bn)/2,_l=Math.max(ln,(_i.height-Mr)/2);n.domNode.style.left=`${$s}px`,n.domNode.style.top=`${_l}px`}xe(!0)};return e.add(U.runAndSubscribe(this.layoutService.onDidLayoutMainContainer,No)),e.add(M.onDidChangeMaximized(()=>No())),e.add(M.onDidRequestLayout(()=>No())),this.hostService.setWindowDimmed(ut,!0),e.add(ee(()=>this.hostService.setWindowDimmed(ut,!1))),M.activeGroup.focus(),{part:M,instantiationService:V,disposables:e}}createSidebar(i,e,t){if(!e)return;let o=e.sidebarWidth&&e.sidebarWidth>0?e.sidebarWidth:GTi,n=e.sidebarWidth!==void 0&&e.sidebarWidth>0,r=!e.sidebarHidden,s=D(i,_("div.modal-editor-sidebar.show-file-icons"));s.style.width=`${o}px`,Md(r,s);let l=t.add(new T),c=t.add(new ue);c.value=e.render(s,l.event);let u=t.add(new kh(i,{getVerticalSashLeft:()=>o,getVerticalSashTop:()=>iit,getVerticalSashHeight:()=>i.clientHeight-iit},{orientation:0}));r||(u.state=0);let p=t.add(new T),h;return t.add(u.onDidStart(()=>h=o)),t.add(u.onDidEnd(()=>h=void 0)),t.add(u.onDidChange(g=>{if(h===void 0)return;let f=g.currentX-g.startX,v=Math.max(oit,i.clientWidth-tit);o=Math.min(v,Math.max(oit,h+f)),n=!0,s.style.width=`${o}px`,u.layout(),p.fire()})),t.add(u.onDidReset(()=>{let g=Math.max(oit,i.clientWidth-tit);o=Math.min(g,GTi),n=!1,s.style.width=`${o}px`,u.layout(),p.fire()})),{onDidResize:p.event,getWidth:()=>r?o:0,hasCustomWidth:()=>n,clampWidth:g=>{o+tit>g&&(o=Math.min(GTi,Math.max(oit,g-tit)),n=!1,s.style.width=`${o}px`,u.layout(),p.fire())},isVisible:()=>r,setVisible:g=>{r=g,Md(r,s),i.classList.toggle("has-sidebar",r),u.state=r?3:0,p.fire()},layout:g=>{r&&l.fire({height:g-Qfo*2,width:o-Qfo*2-don}),u.layout()},updateContent:g=>{c.clear(),s.textContent="",c.value=g.render(s,l.event)}}}};LPe=I([m(1,F),m(2,ie),m(3,wi),m(4,Le),m(5,ti),m(6,B),m(7,Xe)],LPe);var Whe=class extends _E{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Whe.COUNTER++;super(t,`workbench.parts.modalEditor.${g}`,d(4951,null),e,r,s,l,c,u,p,h);this.modalElement=o;this._onWillClose=this._register(new T);this.onWillClose=this._onWillClose.event;this._onDidChangeMaximized=this._register(new T);this.onDidChangeMaximized=this._onDidChangeMaximized.event;this._onDidRequestLayout=this._register(new T);this.onDidRequestLayout=this._onDidRequestLayout.event;this._onDidChangeNavigation=this._register(new T);this.onDidChangeNavigation=this._onDidChangeNavigation.event;this._sidebarHidden=!1;this._hasSidebar=!1;this._onDidToggleSidebar=this._register(new T);this.onDidToggleSidebar=this._onDidToggleSidebar.event;this.optionsDisposable=this._register(new ue);this.previousMainWindowActiveElement=null;this._maximized=n?.maximized??!1,this._size=n?.size,this._position=n?.position,this._navigation=n?.navigation,this._hasSidebar=!!n?.sidebar,this._sidebarHidden=n?.sidebar?.sidebarHidden??!1,this._sidebarWidth=n?.sidebar?.sidebarWidth,this._maximized&&(this.savedSize=this._size,this.savedPosition=this._position),this.enforceModalPartOptions(),this._register(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(nit)&&this.enforceModalPartOptions()}))}static{this.COUNTER=1}get maximized(){return this._maximized}get size(){return this._size}set size(e){this._size=e}get position(){return this._position}set position(e){this._position=e}get sidebarWidth(){return this._sidebarWidth}set sidebarWidth(e){this._sidebarWidth=e}get sidebarHidden(){return this._sidebarHidden}set sidebarHidden(e){this._sidebarHidden=e}get hasSidebar(){return this._hasSidebar}set hasSidebar(e){this._hasSidebar=e}get navigation(){return this._navigation}create(e,t){this.previousMainWindowActiveElement=ut.document.activeElement,super.create(e,t)}enforceModalPartOptions(){let e=this.configurationService.getValue(nit)==="all",t=this.groups.reduce((n,r)=>n+r.count,0),o=e&&t>1?"multiple":"none";this.optionsDisposable.value=this.enforcePartOptions({showTabs:o,enablePreview:!0,closeEmptyGroups:!0,tabActionCloseVisibility:o!=="none",editorActionsLocation:"hidden",tabHeight:"default",wrapTabs:!1,allowDropIntoGroup:!1})}updateOptions(e){typeof e?.maximized=="boolean"&&e.maximized!==this._maximized&&this.toggleMaximized(),this._navigation=e?.navigation,this._onDidChangeNavigation.fire(e?.navigation)}toggleMaximized(){this._maximized=!this._maximized,this._maximized?(this.savedSize=this._size,this.savedPosition=this._position):(this._size=this.savedSize,this._position=this.savedPosition,this.savedSize=void 0,this.savedPosition=void 0),this._onDidChangeMaximized.fire(this._maximized)}toggleSidebar(){this._sidebarHidden=!this._sidebarHidden,this._onDidToggleSidebar.fire()}handleHeaderDoubleClick(){this._maximized?(this.savedSize=void 0,this.savedPosition=void 0,this.toggleMaximized()):this._size?(this._size=void 0,this._position=void 0,this._onDidRequestLayout.fire()):this.toggleMaximized()}handleContextKeys(){vC.bindTo(this.scopedContextKeyService).set(!0);let t=XMt.bindTo(this.scopedContextKeyService);t.set(this._maximized),this._register(this.onDidChangeMaximized(s=>t.set(s)));let o=_pe.bindTo(this.scopedContextKeyService);o.set(!!this._navigation&&this._navigation.total>1),this._register(this.onDidChangeNavigation(s=>o.set(!!s&&s.total>1))),JMt.bindTo(this.scopedContextKeyService).set(this._hasSidebar);let r=Qso.bindTo(this.scopedContextKeyService);r.set(this._hasSidebar&&!this._sidebarHidden),this._register(this.onDidToggleSidebar(()=>r.set(this._hasSidebar&&!this._sidebarHidden))),super.handleContextKeys()}removeGroup(e,t){let o=this.assertGroupView(e);this.count===1&&this.activeGroup===o?this.doRemoveLastGroup():super.removeGroup(e,t)}doRemoveLastGroup(){let e=this.editorPartsView.mainPart.activeGroup;this.editorPartsView.mainPart.activateGroup(e,void 0,1);let t=this.layoutService.getContainer(ut,"workbench.parts.editor");!go(this.previousMainWindowActiveElement)||!this.previousMainWindowActiveElement.isConnected||t?.contains(this.previousMainWindowActiveElement)?e.focus():this.previousMainWindowActiveElement.focus(),this._onWillClose.fire()}saveState(){}async close(e){if(e?.mergeAllEditorsToMainPart){if(!this.mergeGroupsToMainPart())return!1}else for(let t of this.groups)if(!await t.closeAllEditors())return!1;return this._onWillClose.fire(),!0}mergeGroupsToMainPart(){if(!this.groups.some(o=>o.count>0))return!0;let e;for(let o of this.editorPartsView.mainPart.getGroups(1))if(!o.isLocked){e=o;break}e||(e=this.editorPartsView.mainPart.addGroup(this.editorPartsView.mainPart.activeGroup,this.partOptions.openSideBySideDirection==="right"?3:1));let t=this.mergeAllGroups(e,{preserveExistingIndex:!0});return e.focus(),t}dispose(){this._navigation=void 0,super.dispose()}};Whe=I([m(4,F),m(5,Pe),m(6,B),m(7,de),m(8,wi),m(9,ti),m(10,X)],Whe);var lP=class extends Fte{constructor(e,t,o,n,r){super("workbench.editorParts",o,t);this.instantiationService=e;this.storageService=t;this.auxiliaryWindowService=n;this.contextKeyService=r;this.mapPartToInstantiationService=new Map;this._onDidCreateAuxiliaryEditorPart=this._register(new T);this.onDidCreateAuxiliaryEditorPart=this._onDidCreateAuxiliaryEditorPart.event;this.modalEditorMaximized=!1;this.workspaceMemento=this.getMemento(1,0);this.profileMemento=this.getMemento(0,1);this._isReady=!1;this.whenReadyPromise=new Mo;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Mo;this.whenRestored=this.whenRestoredPromise.p;this._onDidActiveGroupChange=this._register(new T);this.onDidChangeActiveGroup=this._onDidActiveGroupChange.event;this._onDidAddGroup=this._register(new T);this.onDidAddGroup=this._onDidAddGroup.event;this._onDidRemoveGroup=this._register(new T);this.onDidRemoveGroup=this._onDidRemoveGroup.event;this._onDidMoveGroup=this._register(new T);this.onDidMoveGroup=this._onDidMoveGroup.event;this._onDidActivateGroup=this._register(new T);this.onDidActivateGroup=this._onDidActivateGroup.event;this._onDidChangeGroupIndex=this._register(new T);this.onDidChangeGroupIndex=this._onDidChangeGroupIndex.event;this._onDidChangeGroupLocked=this._register(new T);this.onDidChangeGroupLocked=this._onDidChangeGroupLocked.event;this._onDidChangeGroupMaximized=this._register(new T);this.onDidChangeGroupMaximized=this._onDidChangeGroupMaximized.event;this.globalContextKeys=new Map;this.scopedContextKeys=new Map;this.contextKeyProviders=new Map;this.registeredContextKeys=new Map;this.contextKeyProviderDisposables=this._register(new Ot);this.editorWorkingSets=(()=>{let l=this.storageService.get(lP.EDITOR_WORKING_SETS_STORAGE_KEY,1);return l?JSON.parse(l):[]})();let s=this.profileMemento[lP.MODAL_EDITOR_STATE_STORAGE_KEY];s&&(this.modalEditorMaximized=s.maximized,this.modalEditorSize=s.size,this.modalEditorPosition=s.position,this.modalEditorSidebarWidth=s.sidebarWidth,this.modalEditorSidebarHidden=s.sidebarHidden),this.mainPart=this._register(this.createMainEditorPart()),this._register(this.registerPart(this.mainPart)),this.mostRecentActiveParts=[this.mainPart],this.restoreParts(),this.registerListeners()}registerListeners(){this._register(this.onDidChangeMementoValue(1,this._store)(e=>this.onDidChangeMementoState(e))),this.whenReady.then(()=>this.registerGroupsContextKeyListeners())}createMainEditorPart(){return this.instantiationService.createInstance(RPe,this)}getScopedInstantiationService(e){if(e===this.mainPart){let t=this.mapPartToInstantiationService.get(e.windowId);return t||(t=this.instantiationService.invokeFunction(o=>{let n=o.get(ie),r=o.get(Fr),s=this._register(this.mainPart.scopedInstantiationService.createChild(new Po([ie,n.createScoped(this.mainPart,this._store)],[Fr,r.createScoped(r,this._store)])));return this.mapPartToInstantiationService.set(e.windowId,s),s})),t}return e===this.modalEditorPart&&this.modalPartInstantiationService?this.modalPartInstantiationService:this.mapPartToInstantiationService.get(e.windowId)??this.instantiationService}async createAuxiliaryEditorPart(e){let{part:t,instantiationService:o,disposables:n}=await this.instantiationService.createInstance(yU,this).create(this.getGroupsLabel(this._parts.size),e);return this.mapPartToInstantiationService.set(t.windowId,o),n.add(ee(()=>this.mapPartToInstantiationService.delete(t.windowId))),this._onDidAddGroup.fire(t.activeGroup),this._onDidCreateAuxiliaryEditorPart.fire(t),t}get activeModalEditorPart(){return this.modalEditorPart}async createModalEditorPart(e){if(this.modalEditorPart)return this.modalEditorPart.updateOptions(e),this.modalEditorPart;let{part:t,instantiationService:o,disposables:n}=await this.instantiationService.createInstance(LPe,this).create({...e,maximized:e?.maximized??this.modalEditorMaximized,size:e?.size??this.modalEditorSize,position:e?.position??this.modalEditorPosition,sidebar:e?.sidebar?{...e.sidebar,sidebarWidth:e.sidebar.sidebarWidth??this.modalEditorSidebarWidth,sidebarHidden:e.sidebar.sidebarHidden??this.modalEditorSidebarHidden}:void 0});return this.modalEditorPart=t,this.modalPartInstantiationService=o,n.add(ee(()=>{this.modalEditorMaximized=t.maximized,this.modalEditorSize=t.size,this.modalEditorPosition=t.position,t.hasSidebar&&(this.modalEditorSidebarWidth=t.sidebarWidth,this.modalEditorSidebarHidden=t.sidebarHidden||void 0),this.modalPartInstantiationService=void 0,this.modalEditorPart=void 0})),this._onDidAddGroup.fire(t.activeGroup),t}registerPart(e){let t=this._register(new O);return t.add(super.registerPart(e)),this.registerEditorPartListeners(e,t),t}unregisterPart(e){super.unregisterPart(e),this.parts.forEach((t,o)=>{t!==this.mainPart&&t.notifyGroupsLabelChange(this.getGroupsLabel(o))})}registerEditorPartListeners(e,t){t.add(e.onDidFocus(()=>{this.doUpdateMostRecentActive(e,!0),this._parts.size>1&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add(ee(()=>{this.doUpdateMostRecentActive(e),e.windowId!==ut.vscodeWindowId&&this._onDidActiveGroupChange.fire(this.activeGroup)})),t.add(e.onDidChangeActiveGroup(o=>this._onDidActiveGroupChange.fire(o))),t.add(e.onDidAddGroup(o=>this._onDidAddGroup.fire(o))),t.add(e.onDidRemoveGroup(o=>this._onDidRemoveGroup.fire(o))),t.add(e.onDidMoveGroup(o=>this._onDidMoveGroup.fire(o))),t.add(e.onDidActivateGroup(o=>{o.reason===1&&this.doUpdateMostRecentActive(e,!0),this._onDidActivateGroup.fire(o)})),t.add(e.onDidChangeGroupMaximized(o=>this._onDidChangeGroupMaximized.fire(o))),t.add(e.onDidChangeGroupIndex(o=>this._onDidChangeGroupIndex.fire(o))),t.add(e.onDidChangeGroupLocked(o=>this._onDidChangeGroupLocked.fire(o)))}doUpdateMostRecentActive(e,t){let o=this.mostRecentActiveParts.indexOf(e);o!==-1&&this.mostRecentActiveParts.splice(o,1),t&&this.mostRecentActiveParts.unshift(e)}getGroupsLabel(e){return d(4872,null,e+1)}getPartByDocument(e){let o=this.mostRecentActiveParts.filter(n=>n.element?.ownerDocument===e);if(o.length>1){let n=Un();for(let r of o){let s=r.getContainer();if(s&&ms(n,s))return r}return o[0]}return super.getPartByDocument(e)}getPart(e){if(this._parts.size>1)if(go(e)){let t=e;return this.getPartByDocument(t.ownerDocument)}else{let t=e,o;typeof t=="number"?o=t:o=t.id;for(let n of this._parts)if(n.hasGroup(o))return n}return this.mainPart}static{this.EDITOR_PARTS_UI_STATE_STORAGE_KEY="editorparts.state"}static{this.MODAL_EDITOR_STATE_STORAGE_KEY="editorparts.modalState"}get isReady(){return this._isReady}async restoreParts(){if(await this.mainPart.whenReady,this.mainPart.willRestoreState){let t=this.loadState();t&&await this.restoreState(t)}this.mostRecentActiveParts.at(0)?.activeGroup.focus(),this._isReady=!0,this.whenReadyPromise.complete(),await Promise.allSettled(this.parts.map(t=>t.whenRestored)),this.whenRestoredPromise.complete()}loadState(){return this.workspaceMemento[lP.EDITOR_PARTS_UI_STATE_STORAGE_KEY]}saveState(){let e=this.createState();e.auxiliary.length===0?delete this.workspaceMemento[lP.EDITOR_PARTS_UI_STATE_STORAGE_KEY]:this.workspaceMemento[lP.EDITOR_PARTS_UI_STATE_STORAGE_KEY]=e,this.saveModalState()}saveModalState(){this.modalEditorPart&&(this.modalEditorMaximized=this.modalEditorPart.maximized,this.modalEditorSize=this.modalEditorPart.size,this.modalEditorPosition=this.modalEditorPart.position,this.modalEditorPart.hasSidebar&&(this.modalEditorSidebarWidth=this.modalEditorPart.sidebarWidth,this.modalEditorSidebarHidden=this.modalEditorPart.sidebarHidden||void 0)),this.modalEditorMaximized||this.modalEditorSize||this.modalEditorPosition||this.modalEditorSidebarWidth||this.modalEditorSidebarHidden?this.profileMemento[lP.MODAL_EDITOR_STATE_STORAGE_KEY]={maximized:this.modalEditorMaximized,size:this.modalEditorSize?{width:this.modalEditorSize.width,height:this.modalEditorSize.height}:void 0,position:this.modalEditorPosition,sidebarWidth:this.modalEditorSidebarWidth,sidebarHidden:this.modalEditorSidebarHidden}:delete this.profileMemento[lP.MODAL_EDITOR_STATE_STORAGE_KEY]}createState(){return{auxiliary:this.parts.map(e=>({part:e,auxiliaryWindow:this.auxiliaryWindowService.getWindow(e.windowId)})).filter(({auxiliaryWindow:e})=>e!==void 0).map(({part:e,auxiliaryWindow:t})=>({state:e.createState(),...t.createState()})),mru:this.mostRecentActiveParts.map(e=>this.parts.indexOf(e))}}async restoreState(e){if(e.auxiliary.length){let t=[];for(let o of e.auxiliary)t.push(this.createAuxiliaryEditorPart(o));await Promise.allSettled(t),e.mru.length===this.parts.length?this.mostRecentActiveParts=e.mru.map(o=>this.parts[o]):this.mostRecentActiveParts=[...this.parts],await Promise.allSettled(this.parts.map(o=>o.whenReady))}}get hasRestorableState(){return this.parts.some(e=>e.hasRestorableState)}onDidChangeMementoState(e){if(e.external&&e.scope===1){this.reloadMemento(e.scope);let t=this.loadState();t&&this.applyState(t)}}async applyState(e){for(let t of this.parts){if(t===this.mainPart)continue;for(let n of t.getGroups(1))await n.closeAllEditors({excludeConfirming:!0});if(!t.close())return!1}return e!=="empty"&&await this.restoreState(e),!0}static{this.EDITOR_WORKING_SETS_STORAGE_KEY="editor.workingSets"}saveWorkingSet(e){let t={id:ht(),name:e,main:this.mainPart.createState(),auxiliary:this.createState()};return this.editorWorkingSets.push(t),this.saveWorkingSets(),{id:t.id,name:t.name}}getWorkingSets(){return this.editorWorkingSets.map(e=>({id:e.id,name:e.name}))}deleteWorkingSet(e){let t=this.indexOfWorkingSet(e);typeof t=="number"&&(this.editorWorkingSets.splice(t,1),this.saveWorkingSets())}async applyWorkingSet(e,t){let o;if(e==="empty"?o="empty":o=this.editorWorkingSets[this.indexOfWorkingSet(e)??-1],!o||!await this.applyState(o==="empty"?o:o.auxiliary))return!1;if(await this.mainPart.applyState(o==="empty"?o:o.main,t),!t?.preserveFocus){let r=this.mostRecentActiveParts.at(0);r&&(await r.whenReady,r.activeGroup.focus())}return!0}indexOfWorkingSet(e){for(let t=0;t<this.editorWorkingSets.length;t++)if(this.editorWorkingSets[t].id===e.id)return t}saveWorkingSets(){this.storageService.store(lP.EDITOR_WORKING_SETS_STORAGE_KEY,JSON.stringify(this.editorWorkingSets),1,1)}get activeGroup(){return this.activePart.activeGroup}get sideGroup(){return this.activePart.sideGroup}get groups(){return this.getGroups()}get count(){return this.groups.length}getGroups(e=0){if(this._parts.size>1){let t;switch(e){case 2:case 0:t=this.parts;break;case 1:t=jo([...this.mostRecentActiveParts,...this.parts]);break}return t.flatMap(o=>o.getGroups(e))}return this.mainPart.getGroups(e)}getGroup(e){if(this._parts.size>1)for(let t of this._parts){let o=t.getGroup(e);if(o)return o}return this.mainPart.getGroup(e)}assertGroupView(e){let t;if(typeof e=="number"?t=this.getGroup(e):t=e,!t)throw new Error("Invalid editor group provided!");return t}activateGroup(e){return this.getPart(e).activateGroup(e)}getSize(e){return this.getPart(e).getSize(e)}setSize(e,t){this.getPart(e).setSize(e,t)}arrangeGroups(e,t=this.activePart.activeGroup){this.getPart(t).arrangeGroups(e,t)}toggleMaximizeGroup(e=this.activePart.activeGroup){this.getPart(e).toggleMaximizeGroup(e)}toggleExpandGroup(e=this.activePart.activeGroup){this.getPart(e).toggleExpandGroup(e)}restoreGroup(e){return this.getPart(e).restoreGroup(e)}applyLayout(e){this.activePart.applyLayout(e)}getLayout(){return this.activePart.getLayout()}get orientation(){return this.activePart.orientation}setGroupOrientation(e){this.activePart.setGroupOrientation(e)}findGroup(e,t=this.activeGroup,o){let n=this.getPart(t);if(this._parts.size>1){let r=this.getGroups(2);if(e.location===0||e.location===1)return e.location===0?r[0]:r[r.length-1];let s=n.findGroup(e,t,!1);if(s)return s;if(e.location===2||e.location===3){let l=this.assertGroupView(t),c=r.indexOf(l);if(e.location===2){let u=r[c+1];return!u&&o&&(u=r[0]),u}else{let u=r[c-1];return!u&&o&&(u=r[r.length-1]),u}}}return n.findGroup(e,t,o)}addGroup(e,t){return this.getPart(e).addGroup(e,t)}removeGroup(e){this.getPart(e).removeGroup(e)}moveGroup(e,t,o){return this.getPart(e).moveGroup(e,t,o)}mergeGroup(e,t,o){return this.getPart(e).mergeGroup(e,t,o)}mergeAllGroups(e,t){return this.activePart.mergeAllGroups(e,t)}copyGroup(e,t,o){return this.getPart(e).copyGroup(e,t,o)}createEditorDropTarget(e,t){return this.getPart(e).createEditorDropTarget(e,t)}registerGroupsContextKeyListeners(){this._register(this.onDidChangeActiveGroup(()=>this.updateGlobalContextKeys())),this.groups.forEach(e=>this.registerGroupContextKeyProvidersListeners(e)),this._register(this.onDidAddGroup(e=>this.registerGroupContextKeyProvidersListeners(e))),this._register(this.onDidRemoveGroup(e=>{this.scopedContextKeys.delete(e.id),this.registeredContextKeys.delete(e.id),this.contextKeyProviderDisposables.deleteAndDispose(e.id)}))}updateGlobalContextKeys(){let e=this.scopedContextKeys.get(this.activeGroup.id);if(e)for(let[t,o]of this.globalContextKeys){let n=e.get(t);n?o.set(n.get()):o.reset()}}bind(e,t){let o=this.globalContextKeys.get(e.key);o||(o=e.bindTo(this.contextKeyService),this.globalContextKeys.set(e.key,o));let n=this.scopedContextKeys.get(t.id);n||(n=new Map,this.scopedContextKeys.set(t.id,n));let r=n.get(e.key);r||(r=e.bindTo(t.scopedContextKeyService),n.set(e.key,r));let s=this;return{get(){return r.get()},set(l){s.activeGroup===t&&o.set(l),r.set(l)},reset(){s.activeGroup===t&&o.reset(),r.reset()}}}registerContextKeyProvider(e){if(this.contextKeyProviders.has(e.contextKey.key)||this.globalContextKeys.has(e.contextKey.key))throw new Error(`A context key provider for key ${e.contextKey.key} already exists.`);this.contextKeyProviders.set(e.contextKey.key,e);let t=()=>{for(let n of this.groups)this.updateRegisteredContextKey(n,e)};t();let o=e.onDidChange?.(()=>t());return ee(()=>{o?.dispose(),this.globalContextKeys.delete(e.contextKey.key),this.scopedContextKeys.forEach(n=>n.delete(e.contextKey.key)),this.contextKeyProviders.delete(e.contextKey.key),this.registeredContextKeys.forEach(n=>n.delete(e.contextKey.key))})}registerGroupContextKeyProvidersListeners(e){let t=e.onDidActiveEditorChange(()=>{for(let o of this.contextKeyProviders.values())this.updateRegisteredContextKey(e,o)});this.contextKeyProviderDisposables.set(e.id,t)}updateRegisteredContextKey(e,t){let o=this.registeredContextKeys.get(e.id);o||(o=new Map,this.registeredContextKeys.set(e.id,o));let n=o.get(t.contextKey.key);n||(n=this.bind(t.contextKey,e),o.set(t.contextKey.key,n)),n.set(t.getGroupContextKeyValue(e))}get partOptions(){return this.mainPart.partOptions}get onDidChangeEditorPartOptions(){return this.mainPart.onDidChangeEditorPartOptions}enforcePartOptions(e){return this.mainPart.enforcePartOptions(e)}};lP=I([m(0,F),m(1,de),m(2,Pe),m(3,RR),m(4,X)],lP);Ce(kt,lP,0);var IUt=class extends k_{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(S,y,c,t,n);this.notificationService=e;this.storageService=t;this.contextMenuService=o;this.keybindingService=r;this.hoverService=s;this.instantiationService=l;this.registry=u;this.activeCompositeSettingsKey=p;this.defaultCompositeId=h;this.nameForTelemetry=g;this.compositeCSSClass=f;this.titleForegroundColor=v;this.titleBorderColor=b;this.onDidCompositeOpen=this._register(new T);this.onDidCompositeClose=this._register(new T);this.mapCompositeToCompositeContainer=new Map;this.mapActionsBindingToComposite=new Map;this.instantiatedCompositeItems=new Map;this.actionsListener=this._register(new ue);this.lastActiveCompositeId=t.get(p,1,this.defaultCompositeId),this.toolbarHoverDelegate=this._register(Dg()),this.trailingSeparator=y.trailingSeparator??!1}openComposite(e,t){if(this.activeComposite?.getId()===e)return t&&this.activeComposite.focus(),this.activeComposite;if(this.element)return this.doOpenComposite(e,t)}doOpenComposite(e,t=!1){let o=o4.nextId();this.currentCompositeOpenToken=o,this.activeComposite&&this.hideActiveComposite(),this.updateTitle(e);let n=this.createComposite(e,!0);if(!(this.currentCompositeOpenToken!==o||this.activeComposite&&this.activeComposite.getId()!==n.getId()))return this.activeComposite?.getId()===n.getId()?(t&&n.focus(),this.onDidCompositeOpen.fire({composite:n,focus:t}),n):(this.showComposite(n),t&&n.focus(),n&&this.onDidCompositeOpen.fire({composite:n,focus:t}),n)}createComposite(e,t){let o=this.instantiatedCompositeItems.get(e);if(o)return o.composite;let n=this.registry.getComposite(e);if(n){let r=this,s=new oLe(Ti(this.progressBar),this._register(new class extends nLe{constructor(){super(n.id,!!t),this._register(r.onDidCompositeOpen.event(p=>this.onScopeOpened(p.composite.getId()))),this._register(r.onDidCompositeClose.event(p=>this.onScopeClosed(p.getId())))}})),l=this._register(this.instantiationService.createChild(new Po([Hd,s]))),c=n.instantiate(l),u=new O;return this.instantiatedCompositeItems.set(e,{composite:c,disposable:u,progress:s}),u.add(c.onTitleAreaUpdate(()=>this.onTitleAreaUpdate(c.getId()),this)),u.add(l),c}throw new Error(`Unable to find composite with id ${e}`)}showComposite(e){this.activeComposite=e;let t=this.activeComposite.getId();t!==this.defaultCompositeId?this.storageService.store(this.activeCompositeSettingsKey,t,1,1):this.storageService.remove(this.activeCompositeSettingsKey,1),this.lastActiveCompositeId=this.activeComposite.getId();let o=this.mapCompositeToCompositeContainer.get(e.getId());if(o||(o=_(".composite"),o.classList.add(...this.compositeCSSClass.split(" ")),o.id=e.getId(),e.create(o),e.updateStyles(),this.mapCompositeToCompositeContainer.set(e.getId(),o)),!this.activeComposite||e.getId()!==this.activeComposite.getId())return;this.contentArea?.appendChild(o),Xo(o),this.toolBar&&(this.toolBar.actionRunner=e.getActionRunner());let n=this.registry.getComposite(e.getId());n&&n.name!==e.getTitle()&&this.updateTitle(e.getId(),e.getTitle());let r=this.mapActionsBindingToComposite.get(e.getId());r||(r=this.collectCompositeActions(e),this.mapActionsBindingToComposite.set(e.getId(),r)),r(),this.toolBar&&(this.actionsListener.value=this.toolBar.actionRunner.onDidRun(s=>{s.error&&!Yi(s.error)&&this.notificationService.error(s.error)})),e.setVisible(!0),!(!this.activeComposite||e.getId()!==this.activeComposite.getId())&&(this.contentAreaSize&&e.layout(this.contentAreaSize),this.boundarySashes&&e.setBoundarySashes(this.boundarySashes))}onTitleAreaUpdate(e){let t=this.instantiatedCompositeItems.get(e);if(t&&this.updateTitle(e,t.composite.getTitle()),this.activeComposite?.getId()===e){let o=this.collectCompositeActions(this.activeComposite);this.mapActionsBindingToComposite.set(this.activeComposite.getId(),o),o()}else this.mapActionsBindingToComposite.delete(e)}updateTitle(e,t){let o=this.registry.getComposite(e);if(!o||!this.titleLabel)return;t||(t=o.name);let n=this.keybindingService.lookupKeybinding(e);this.titleLabel.updateTitle(e,t,n?.getLabel()??void 0),this.toolBar?.setAriaLabel(d(4471,null,t))}collectCompositeActions(e){let t=e?.getMenuIds(),o=e?.getActions().slice(0)||[],n=e?.getSecondaryActions().slice(0)||[];return this.toolBar&&(this.toolBar.context=this.actionsContextProvider()),()=>{this.toolBar?.setActions(Kk(o),Kk(n),t),this.titleArea?.classList.toggle("has-actions",o.length>0||n.length>0)}}getActiveComposite(){return this.activeComposite}getLastActiveCompositeId(){return this.lastActiveCompositeId}hideActiveComposite(){if(!this.activeComposite)return;let e=this.activeComposite;this.activeComposite=void 0;let t=this.mapCompositeToCompositeContainer.get(e.getId());return e.setVisible(!1),t&&(t.remove(),Wi(t)),this.progressBar?.stop().hide(),this.toolBar&&this.collectCompositeActions()(),this.onDidCompositeClose.fire(e),e}createTitleArea(e){if(!this.options.hasTitle)return;let t=D(e,_(".composite"));t.classList.add("title"),this.titleLabel=this.createTitleLabel(t);let o=D(t,_(".title-actions"));return this.toolBar=this._register(this.instantiationService.createInstance(dl,o,{actionViewItemProvider:(n,r)=>this.actionViewItemProvider(n,r),orientation:0,getKeyBinding:n=>this.keybindingService.lookupKeybinding(n.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:d(4473,null),telemetrySource:this.nameForTelemetry,hoverDelegate:this.toolbarHoverDelegate,trailingSeparator:this.trailingSeparator})),this.collectCompositeActions()(),t}createTitleLabel(e){let t=D(e,_(".title-label")),o=D(t,_("h2"));this.titleLabelElement=o;let n=this._register(this.hoverService.setupManagedHover(yi("mouse"),o,"")),r=this;return{updateTitle:(s,l,c)=>{(!this.activeComposite||this.activeComposite.getId()===s)&&(o.textContent=l,n.update(c?d(4472,null,l,c):l))},updateStyles:()=>{o.style.color=r.titleForegroundColor&&r.getColor(r.titleForegroundColor)||"";let s=r.titleBorderColor?r.getColor(r.titleBorderColor):void 0;e.style.borderBottom=s?`1px solid ${s}`:""}}}createHeaderArea(){return _(".composite")}createFooterArea(){return _(".composite")}updateStyles(){super.updateStyles(),this.titleLabel?.updateStyles()}actionViewItemProvider(e,t){return this.activeComposite?this.activeComposite.getActionViewItem(e,t):ta(this.instantiationService,e,t)}actionsContextProvider(){return this.activeComposite?this.activeComposite.getActionsContext():null}createContentArea(e){let t=D(e,_(".content"));return this.progressBar=this._register(new Cv(t,oC)),this.progressBar.hide(),t}getProgressIndicator(e){let t=this.instantiatedCompositeItems.get(e);return t?t.progress:void 0}getTitleAreaDropDownAnchorAlignment(){return 1}layout(e,t,o,n){super.layout(e,t,o,n),this.contentAreaSize=di.lift(super.layoutContents(e,t).contentSize),this.activeComposite?.layout(this.contentAreaSize)}setBoundarySashes(e){this.boundarySashes=e,this.activeComposite?.setBoundarySashes(e)}removeComposite(e){if(this.activeComposite?.getId()===e)return!1;this.mapCompositeToCompositeContainer.delete(e),this.mapActionsBindingToComposite.delete(e);let t=this.instantiatedCompositeItems.get(e);return t&&(t.composite.dispose(),je(t.disposable),this.instantiatedCompositeItems.delete(e)),!0}dispose(){this.mapCompositeToCompositeContainer.clear(),this.mapActionsBindingToComposite.clear(),this.instantiatedCompositeItems.forEach(e=>{e.composite.dispose(),je(e.disposable)}),this.instantiatedCompositeItems.clear(),super.dispose()}};var yUt=class{constructor(i,e,t,o,n,r){this.viewDescriptorService=i;this.targetContainerLocation=e;this.orientation=t;this.openComposite=o;this.moveComposite=n;this.getItems=r}drop(i,e,t,o){let n=i.getData();if(n.type==="composite"){let r=this.viewDescriptorService.getViewContainerById(n.id),s=this.viewDescriptorService.getViewContainerLocation(r),l=!1;s===this.targetContainerLocation?e&&(this.moveComposite(n.id,e,o),l=!0):(this.viewDescriptorService.moveViewContainerToLocation(r,this.targetContainerLocation,this.getTargetIndex(e,o),"dnd"),l=!0),l&&this.openComposite(r.id,!0)}if(n.type==="view"){let r=this.viewDescriptorService.getViewDescriptorById(n.id);if(r.canMoveView){this.viewDescriptorService.moveViewToLocation(r,this.targetContainerLocation,"dnd");let s=this.viewDescriptorService.getViewContainerByViewId(r.id);e&&this.moveComposite(s.id,e,o),this.openComposite(s.id,!0).then(l=>{l?.openView(r.id,!0)})}}}onDragEnter(i,e,t){return this.canDrop(i,e)}onDragOver(i,e,t){return this.canDrop(i,e)}getTargetIndex(i,e){if(!i)return;let t=this.getItems(),o=this.orientation===0?e?.horizontallyBefore:e?.verticallyBefore;return t.filter(n=>n.visible).findIndex(n=>n.id===i)+(o?0:1)}canDrop(i,e){let t=i.getData();if(t.type==="composite"){let o=this.viewDescriptorService.getViewContainerById(t.id);return this.viewDescriptorService.getViewContainerLocation(o)===this.targetContainerLocation?t.id!==e:!0}else return!!this.viewDescriptorService.getViewDescriptorById(t.id)?.canMoveView}},$Ti=class{constructor(i,e,t,o,n){this.compositeBarContainer=i;this.actionBarContainer=e;this.compositeBarModel=t;this.dndHandler=o;this.orientation=n;this.insertDropBefore=void 0}onDragOver(i){let e=this.compositeBarModel.visibleItems;if(!e.length||i.eventData.target&&ms(i.eventData.target,this.actionBarContainer)){this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,!1,!1,!0);return}let t=this.insertAtFront(this.actionBarContainer,i.eventData),o=t?e[0]:e[e.length-1],n=this.dndHandler.onDragOver(i.dragAndDropData,o.id,i.eventData);u8(i.eventData.dataTransfer,"move",n),this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,n,t,!0)}onDragLeave(i){this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,!1,!1,!1)}onDragEnd(i){this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,!1,!1,!1)}onDrop(i){let e=this.compositeBarModel.visibleItems,t;e.length&&(t=this.insertAtFront(this.actionBarContainer,i.eventData)?e[0].id:e[e.length-1].id),this.dndHandler.drop(i.dragAndDropData,t,i.eventData,this.insertDropBefore),this.insertDropBefore=this.updateFromDragging(this.compositeBarContainer,!1,!1,!1)}insertAtFront(i,e){let t=i.getBoundingClientRect(),o=e.clientX,n=e.clientY;switch(this.orientation){case 0:return o<t.left;case 1:return n<t.top}}updateFromDragging(i,e,t,o){if(i.classList.toggle("dragged-over",o),i.classList.toggle("dragged-over-head",e&&t),i.classList.toggle("dragged-over-tail",e&&!t),!!e)return{verticallyBefore:t,horizontallyBefore:t}}},MPe=class extends ll{constructor(e,t,o,n,r){super();this.options=t;this.instantiationService=o;this.contextMenuService=n;this.viewDescriptorService=r;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.compositeOverflowAction=this._register(new ue);this.compositeOverflowActionViewItem=this._register(new ue);this.model=new jTi(e,t),this.visibleComposites=[],this.compositeSizeInBar=new Map,this.computeSizes(this.model.visibleItems)}getCompositeBarItems(){return[...this.model.items]}setCompositeBarItems(e){this.model.setItems(e),this.updateCompositeSwitcher(!0)}getPinnedComposites(){return this.model.pinnedItems}getPinnedCompositeIds(){return this.getPinnedComposites().map(e=>e.id)}getVisibleComposites(){return this.model.visibleItems}create(e){let t=e.appendChild(_(".composite-bar"));this.compositeSwitcherBar=this._register(new oo(t,{actionViewItemProvider:(n,r)=>{if(n instanceof Get)return this.compositeOverflowActionViewItem.value;let s=this.model.findItem(n.id);return s&&this.instantiationService.createInstance(SMe,{...r,draggable:!0,colors:this.options.colors,icon:this.options.icon,hoverOptions:this.options.activityHoverOptions,compact:this.options.compact},n,s.pinnedAction,s.toggleBadgeAction,l=>this.options.getContextMenuActionsForComposite(l),()=>this.getContextMenuActions(),this.options.dndHandler,this)},orientation:this.options.orientation,ariaLabel:d(4461,null),ariaRole:"tablist",preventLoopNavigation:this.options.preventLoopNavigation,triggerKeys:{keyDown:!0}})),this._register($(e,ne.CONTEXT_MENU,n=>this.showContextMenu(Me(e),n))),this._register(ds.addTarget(e)),this._register($(e,Vn.Contextmenu,n=>this.showContextMenu(Me(e),n)));let o=new $Ti(e,t,this.model,this.options.dndHandler,this.options.orientation);return this._register(m_.INSTANCE.registerTarget(e,o)),t}focus(e){this.compositeSwitcherBar?.focus(e)}recomputeSizes(){this.computeSizes(this.model.visibleItems),this.updateCompositeSwitcher()}layout(e){this.dimension=e,!(e.height===0||e.width===0)&&(this.compositeSizeInBar.size===0&&this.computeSizes(this.model.visibleItems),this.updateCompositeSwitcher())}addComposite({id:e,name:t,order:o,requestedIndex:n}){this.model.add(e,t,o,n)&&(this.computeSizes([this.model.findItem(e)]),this.updateCompositeSwitcher())}removeComposite(e){this.isPinned(e)&&this.unpin(e),this.model.remove(e)&&this.updateCompositeSwitcher()}hideComposite(e){this.model.hide(e)&&(this.resetActiveComposite(e),this.updateCompositeSwitcher())}activateComposite(e){let t=this.model.activeItem;this.model.activate(e)&&(this.visibleComposites.indexOf(e)===-1||this.model.activeItem&&!this.model.activeItem.pinned||t&&!t.pinned)&&this.updateCompositeSwitcher()}deactivateComposite(e){let t=this.model.activeItem;this.model.deactivate()&&t&&!t.pinned&&this.updateCompositeSwitcher()}async pin(e,t){this.model.setPinned(e,!0)&&(this.updateCompositeSwitcher(),t&&(await this.options.openComposite(e),this.activateComposite(e)))}unpin(e){this.model.setPinned(e,!1)&&(this.updateCompositeSwitcher(),this.resetActiveComposite(e))}areBadgesEnabled(e){return this.viewDescriptorService.getViewContainerBadgeEnablementState(e)}toggleBadgeEnablement(e){this.viewDescriptorService.setViewContainerBadgeEnablementState(e,!this.areBadgesEnabled(e)),this.updateCompositeSwitcher();let t=this.model.findItem(e);t&&(t.activityAction.activities=t.activityAction.activities)}resetActiveComposite(e){let t=this.options.getDefaultCompositeId();if(!(!this.model.activeItem||this.model.activeItem.id!==e))if(this.deactivateComposite(e),t&&t!==e&&this.isPinned(t))this.options.openComposite(t,!0);else{let o=this.visibleComposites.find(n=>n!==e);o&&this.options.openComposite(o)}}isPinned(e){return this.model.findItem(e)?.pinned}move(e,t,o){if(o!==void 0){let n=this.model.items.findIndex(s=>s.id===e),r=this.model.items.findIndex(s=>s.id===t);n>=0&&r>=0&&(!o&&n>r&&r++,o&&n<r&&r--,r<this.model.items.length&&r>=0&&r!==n&&this.model.move(this.model.items[n].id,this.model.items[r].id)&&setTimeout(()=>this.updateCompositeSwitcher(),0))}else this.model.move(e,t)&&setTimeout(()=>this.updateCompositeSwitcher(),0)}getAction(e){return this.model.findItem(e)?.activityAction}computeSizes(e){let t=this.options.compositeSize;if(t)e.forEach(o=>this.compositeSizeInBar.set(o.id,t));else{let o=this.compositeSwitcherBar;if(o&&this.dimension&&this.dimension.height!==0&&this.dimension.width!==0){let n=o.viewItems.length;o.push(e.map(r=>r.activityAction)),e.map((r,s)=>this.compositeSizeInBar.set(r.id,this.options.orientation===1?o.getHeight(n+s):o.getWidth(n+s))),e.forEach(()=>o.pull(o.viewItems.length-1))}}}updateCompositeSwitcher(e){let t=this.compositeSwitcherBar;if(!t||!this.dimension)return;let o=this.model.visibleItems.filter(u=>u.pinned||this.model.activeItem&&this.model.activeItem.id===u.id).map(u=>u.id),n=o.length,r=o.length,s=0,l=this.options.orientation===1?this.dimension.height:this.dimension.width;for(let u=0;u<o.length;u++){let p=this.compositeSizeInBar.get(o[u]);if(s+p>l){n=u;break}s+=p}for(r>n&&(o=o.slice(0,n)),this.model.activeItem&&o.every(u=>!!this.model.activeItem&&u!==this.model.activeItem.id)&&(s+=this.compositeSizeInBar.get(this.model.activeItem.id),o.push(this.model.activeItem.id));s>l&&o.length;){let u=o.length>1?o.splice(o.length-2,1)[0]:o.pop();s-=this.compositeSizeInBar.get(u)}for(r>o.length&&(s+=this.options.overflowActionSize);s>l&&o.length;){let u=o.length>1&&o[o.length-1]===this.model.activeItem?.id?o.splice(o.length-2,1)[0]:o.pop();s-=this.compositeSizeInBar.get(u)}r===o.length&&this.compositeOverflowAction.value&&(t.pull(t.length()-1),this.compositeOverflowAction.value=void 0,this.compositeOverflowActionViewItem.value=void 0);let c=[];this.visibleComposites.forEach((u,p)=>{o.includes(u)||c.push(p)}),c.reverse().forEach(u=>{t.pull(u),this.visibleComposites.splice(u,1)}),o.forEach((u,p)=>{let h=this.visibleComposites.indexOf(u);p!==h&&(h!==-1&&(t.pull(h),this.visibleComposites.splice(h,1)),t.push(this.model.findItem(u).activityAction,{label:!0,icon:this.options.icon,index:p}),this.visibleComposites.splice(p,0,u))}),r>o.length&&!this.compositeOverflowAction.value&&(this.compositeOverflowAction.value=this.instantiationService.createInstance(Get,()=>{this.compositeOverflowActionViewItem.value?.showMenu()}),this.compositeOverflowActionViewItem.value=this.instantiationService.createInstance(bMe,this.compositeOverflowAction.value,()=>this.getOverflowingComposites(),()=>this.model.activeItem?this.model.activeItem.id:void 0,u=>this.model.findItem(u)?.activity[0]?.badge,this.options.getOnCompositeClickAction,this.options.colors,this.options.activityHoverOptions),t.push(this.compositeOverflowAction.value,{label:!1,icon:!0})),e||this._onDidChange.fire()}getOverflowingComposites(){let e=this.model.visibleItems.filter(t=>t.pinned).map(t=>t.id);return this.model.activeItem&&!this.model.activeItem.pinned&&e.push(this.model.activeItem.id),e=e.filter(t=>!this.visibleComposites.includes(t)),this.model.visibleItems.filter(t=>e.includes(t.id)).map(t=>({id:t.id,name:this.getAction(t.id)?.label||t.name}))}showContextMenu(e,t){Kt.stop(t,!0);let o=new Ln(e,t);this.contextMenuService.showContextMenu({getAnchor:()=>o,getActions:()=>this.getContextMenuActions(t)})}getContextMenuActions(e){let t=this.model.visibleItems.map(({id:o,name:n,activityAction:r})=>{let s=this.isPinned(o);return li({id:o,label:this.getAction(o).label||n||o,checked:s,enabled:r.enabled&&(!s||this.getPinnedCompositeIds().length>1),run:()=>{this.isPinned(o)?this.unpin(o):this.pin(o,!0)}})});return this.options.fillExtraContextMenuActions(t,e),t}};MPe=I([m(2,F),m(3,Xe),m(4,ji)],MPe);var jTi=class{constructor(i,e){this._items=[];this.options=e,this.setItems(i)}get items(){return this._items}setItems(i){this._items=[],this._items=i.map(e=>this.createCompositeBarItem(e.id,e.name,e.order,e.pinned,e.visible))}get visibleItems(){return this.items.filter(i=>i.visible)}get pinnedItems(){return this.items.filter(i=>i.visible&&i.pinned)}createCompositeBarItem(i,e,t,o,n){let r=this.options;return{id:i,name:e,pinned:o,order:t,visible:n,activity:[],get activityAction(){return r.getActivityAction(i)},get pinnedAction(){return r.getCompositePinnedAction(i)},get toggleBadgeAction(){return r.getCompositeBadgeAction(i)}}}add(i,e,t,o){let n=this.findItem(i);if(n){let r=!1;return n.name=e,mr(t)||(r=n.order!==t,n.order=t),n.visible||(n.visible=!0,r=!0),r}else{let r=this.createCompositeBarItem(i,e,t,!0,!0);if(mr(o))if(mr(t))this.items.push(r);else{let s=0;for(;s<this.items.length&&typeof this.items[s].order=="number"&&this.items[s].order<t;)s++;this.items.splice(s,0,r)}else{let s=0,l=o;for(;l>0&&s<this.items.length;)this.items[s++].visible&&l--;this.items.splice(s,0,r)}return!0}}remove(i){for(let e=0;e<this.items.length;e++)if(this.items[e].id===i)return this.items.splice(e,1),!0;return!1}hide(i){for(let e of this.items)if(e.id===i)return e.visible?(e.visible=!1,!0):!1;return!1}move(i,e){let t=this.findIndex(i),o=this.findIndex(e);if(t===-1||o===-1)return!1;let n=this.items.splice(t,1)[0];return this.items.splice(o,0,n),n.pinned=!0,!0}setPinned(i,e){for(let t of this.items)if(t.id===i)return t.pinned!==e?(t.pinned=e,!0):!1;return!1}activate(i){if(!this.activeItem||this.activeItem.id!==i){this.activeItem&&this.deactivate();for(let e of this.items)if(e.id===i)return this.activeItem=e,this.activeItem.activityAction.activate(),!0}return!1}deactivate(){return this.activeItem?(this.activeItem.activityAction.deactivate(),this.activeItem=void 0,!0):!1}findItem(i){return this.items.filter(e=>e.id===i)[0]}findIndex(i){for(let e=0;e<this.items.length;e++)if(this.items[e].id===i)return e;return-1}};var zte=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.location=e;this.options=t;this.part=o;this.paneCompositePart=n;this.instantiationService=r;this.storageService=s;this.extensionService=l;this.viewDescriptorService=c;this.viewService=u;this.contextKeyService=p;this.environmentService=h;this.layoutService=g;this.viewContainerDisposables=this._register(new Ot);this.compositeActions=new Map;this.hasExtensionsRegistered=!1;this._cachedViewContainers=void 0;this.dndHandler=new yUt(this.viewDescriptorService,this.location,this.options.orientation,async(v,b)=>await this.paneCompositePart.openPaneComposite(v,b)??null,(v,b,S)=>this.compositeBar.move(v,b,this.options.orientation===1?S?.verticallyBefore:S?.horizontallyBefore),()=>this.compositeBar.getCompositeBarItems());let f=this.cachedViewContainers.map(v=>({id:v.id,name:v.name,visible:!this.shouldBeHidden(v.id,v),order:v.order,pinned:v.pinned}));this.compositeBar=this.createCompositeBar(f),this.onDidRegisterViewContainers(this.getViewContainers()),this.registerListeners()}createCompositeBar(e){return this._register(this.instantiationService.createInstance(MPe,e,{icon:this.options.icon,compact:this.options.compact,orientation:this.options.orientation,activityHoverOptions:this.options.activityHoverOptions,preventLoopNavigation:this.options.preventLoopNavigation,openComposite:async(t,o)=>await this.paneCompositePart.openPaneComposite(t,!o)??null,getActivityAction:t=>this.getCompositeActions(t).activityAction,getCompositePinnedAction:t=>this.getCompositeActions(t).pinnedAction,getCompositeBadgeAction:t=>this.getCompositeActions(t).badgeAction,getOnCompositeClickAction:t=>this.getCompositeActions(t).activityAction,fillExtraContextMenuActions:(t,o)=>this.options.fillExtraContextMenuActions(t,o),getContextMenuActionsForComposite:t=>this.getContextMenuActionsForComposite(t),getDefaultCompositeId:()=>this.viewDescriptorService.getDefaultViewContainer(this.location)?.id,dndHandler:this.dndHandler,compositeSize:this.options.compositeSize,overflowActionSize:this.options.overflowActionSize,colors:t=>this.options.colors(t)}))}getContextMenuActionsForComposite(e){let t=[new oi],o=this.viewDescriptorService.getViewContainerById(e),n=this.viewDescriptorService.getDefaultViewContainerLocation(o),r=this.viewDescriptorService.getViewContainerLocation(o),s=[];for(let l of[0,2,1])r!==l&&s.push(this.createMoveAction(o,l,n));if(t.push(new sa("moveToMenu",d(5048,null),s)),n!==r)t.push(li({id:"resetLocationAction",label:d(5050,null),run:()=>{this.viewDescriptorService.moveViewContainerToLocation(o,n,void 0,"resetLocationAction"),this.viewService.openViewContainer(o.id,!0)}}));else{let l=this.viewDescriptorService.getViewContainerModel(o);if(l.allViewDescriptors.length===1){let c=l.allViewDescriptors[0],u=this.viewDescriptorService.getDefaultContainerById(c.id);u!==o&&t.push(li({id:"resetLocationAction",label:d(5050,null),run:()=>{this.viewDescriptorService.moveViewsToContainer([c],u,void 0,"resetLocationAction"),this.viewService.openViewContainer(o.id,!0)}}))}}return t}createMoveAction(e,t,o){return li({id:`moveViewContainerTo${t}`,label:t===1?d(5049,null):t===0?d(5051,null):d(5047,null),run:()=>{let n;t!==o?n=this.viewDescriptorService.getViewContainersByLocation(t).length:n=void 0,this.viewDescriptorService.moveViewContainerToLocation(e,t,n),this.viewService.openViewContainer(e.id,!0)}})}registerListeners(){this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:e,removed:t})=>this.onDidChangeViewContainers(e,t))),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:e,from:t,to:o})=>this.onDidChangeViewContainerLocation(e,t,o))),this._register(this.paneCompositePart.onDidPaneCompositeOpen(e=>this.onDidChangeViewContainerVisibility(e.getId(),!0))),this._register(this.paneCompositePart.onDidPaneCompositeClose(e=>this.onDidChangeViewContainerVisibility(e.getId(),!1))),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this._store.isDisposed||(this.onDidRegisterExtensions(),this._register(this.compositeBar.onDidChange(()=>{this.updateCompositeBarItemsFromStorage(!0),this.saveCachedViewContainers()})),this._register(this.storageService.onDidChangeValue(0,this.options.pinnedViewContainersKey,this._store)(()=>this.updateCompositeBarItemsFromStorage(!1))))})}onDidChangeViewContainers(e,t){t.filter(({location:o})=>o===this.location).forEach(({container:o})=>this.onDidDeregisterViewContainer(o)),this.onDidRegisterViewContainers(e.filter(({location:o})=>o===this.location).map(({container:o})=>o))}onDidChangeViewContainerLocation(e,t,o){t===this.location&&this.onDidDeregisterViewContainer(e),o===this.location&&this.onDidRegisterViewContainers([e])}onDidChangeViewContainerVisibility(e,t){t?this.onDidViewContainerVisible(e):this.compositeBar.deactivateComposite(e)}onDidRegisterExtensions(){this.hasExtensionsRegistered=!0;for(let{id:e}of this.cachedViewContainers){let t=this.getViewContainer(e);t?this.showOrHideViewContainer(t):this.viewDescriptorService.isViewContainerRemovedPermanently(e)?this.removeComposite(e):this.hideComposite(e)}this.saveCachedViewContainers()}onDidViewContainerVisible(e){let t=this.getViewContainer(e);t&&(this.addComposite(t),this.compositeBar.activateComposite(t.id),this.shouldBeHidden(t)&&this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length===0&&this.hideComposite(t.id))}create(e){return this.compositeBar.create(e)}getCompositeActions(e){let t=this.compositeActions.get(e);if(!t){let o=this.getViewContainer(e);if(o){let n=this.viewDescriptorService.getViewContainerModel(o);t={activityAction:this._register(this.instantiationService.createInstance(Kte,this.toCompositeBarActionItemFrom(n),this.part,this.paneCompositePart)),pinnedAction:this._register(new qet(this.toCompositeBarActionItemFrom(n),this.compositeBar)),badgeAction:this._register(new $et(this.toCompositeBarActionItemFrom(n),this.compositeBar))}}else{let n=this.cachedViewContainers.filter(r=>r.id===e)[0];t={activityAction:this._register(this.instantiationService.createInstance(QTi,this.toCompositeBarActionItem(e,n?.name??e,n?.icon,void 0),this.part,this.paneCompositePart)),pinnedAction:this._register(new wUt(e,this.compositeBar)),badgeAction:this._register(new YTi(e,this.compositeBar))}}this.compositeActions.set(e,t)}return t}onDidRegisterViewContainers(e){for(let t of e){this.addComposite(t),this.cachedViewContainers.filter(({id:l})=>l===t.id)[0]||this.compositeBar.pin(t.id),this.paneCompositePart.getActivePaneComposite()?.getId()===t.id&&this.compositeBar.activateComposite(t.id);let r=this.viewDescriptorService.getViewContainerModel(t);this.updateCompositeBarActionItem(t,r),this.showOrHideViewContainer(t);let s=new O;s.add(r.onDidChangeContainerInfo(()=>this.updateCompositeBarActionItem(t,r))),s.add(r.onDidChangeActiveViewDescriptors(()=>this.showOrHideViewContainer(t))),this.viewContainerDisposables.set(t.id,s)}}onDidDeregisterViewContainer(e){this.viewContainerDisposables.deleteAndDispose(e.id),this.removeComposite(e.id)}updateCompositeBarActionItem(e,t){let o=this.toCompositeBarActionItemFrom(t),{activityAction:n,pinnedAction:r}=this.getCompositeActions(e.id);n.updateCompositeBarActionItem(o),r instanceof wUt&&r.setActivity(o),this.options.recomputeSizes&&this.compositeBar.recomputeSizes(),this.saveCachedViewContainers()}toCompositeBarActionItemFrom(e){return this.toCompositeBarActionItem(e.viewContainer.id,e.title,e.icon,e.keybindingId)}toCompositeBarActionItem(e,t,o,n){let r,s;if(this.options.icon)if(A.isUri(o)){s=o;let l=cl(o),c=new wI;c.update(l);let u=`activity-${e.replace(/\./g,"-")}-${c.digest()}`,p=`.monaco-workbench .${this.options.partContainerClass} .monaco-action-bar .action-label.${u}`;r=[u,"uri-icon"],Eg(p,`
				mask: ${l} no-repeat 50% 50%;
				mask-size: var(--activity-bar-icon-size, ${this.options.iconSize}px);
				-webkit-mask: ${l} no-repeat 50% 50%;
				-webkit-mask-size: var(--activity-bar-icon-size, ${this.options.iconSize}px);
				mask-origin: padding;
				-webkit-mask-origin: padding;
			`)}else q.isThemeIcon(o)&&(r=q.asClassNameArray(o));return{id:e,name:t,classNames:r,iconUrl:s,keybindingId:n}}showOrHideViewContainer(e){this.shouldBeHidden(e)?this.hideComposite(e.id):(this.addComposite(e),this.paneCompositePart.getActivePaneComposite()?.getId()===e.id&&this.compositeBar.activateComposite(e.id))}shouldBeHidden(e,t){let o=We(e)?this.getViewContainer(e):e,n=We(e)?e:e.id;if(o)if(o.hideIfEmpty){if(this.viewService.isViewContainerActive(n))return!1}else return!1;if(!this.hasExtensionsRegistered&&!(this.part==="workbench.parts.sidebar"&&this.environmentService.remoteAuthority&&Qr)){if(t=t||this.cachedViewContainers.find(({id:r})=>r===n),!o&&t?.isBuiltin&&t?.visible)return!1;if(t?.views?.length)return t.views.every(({when:r})=>!!r&&!this.contextKeyService.contextMatchesRules(C.deserialize(r)))}return!0}addComposite(e){this.compositeBar.addComposite({id:e.id,name:typeof e.title=="string"?e.title:e.title.value,order:e.order,requestedIndex:e.requestedIndex})}hideComposite(e){this.compositeBar.hideComposite(e);let t=this.compositeActions.get(e);t&&(t.activityAction.dispose(),t.pinnedAction.dispose(),this.compositeActions.delete(e))}removeComposite(e){this.compositeBar.removeComposite(e);let t=this.compositeActions.get(e);t&&(t.activityAction.dispose(),t.pinnedAction.dispose(),this.compositeActions.delete(e))}getPinnedPaneCompositeIds(){let e=this.compositeBar.getPinnedComposites().map(t=>t.id);return this.getViewContainers().filter(t=>this.compositeBar.isPinned(t.id)).sort((t,o)=>e.indexOf(t.id)-e.indexOf(o.id)).map(t=>t.id)}getVisiblePaneCompositeIds(){return this.compositeBar.getVisibleComposites().filter(e=>this.paneCompositePart.getActivePaneComposite()?.getId()===e.id||this.compositeBar.isPinned(e.id)).map(e=>e.id)}getPaneCompositeIds(){return this.compositeBar.getVisibleComposites().map(e=>e.id)}getContextMenuActions(){return this.compositeBar.getContextMenuActions()}focus(e){this.compositeBar.focus(e)}layout(e,t){this.compositeBar.layout(new di(e,t))}getViewContainer(e){let t=this.viewDescriptorService.getViewContainerById(e);return t&&this.viewDescriptorService.getViewContainerLocation(t)===this.location?t:void 0}getViewContainers(){return this.viewDescriptorService.getViewContainersByLocation(this.location)}updateCompositeBarItemsFromStorage(e){if(this.pinnedViewContainersValue===this.getStoredPinnedViewContainersValue())return;this._placeholderViewContainersValue=void 0,this._pinnedViewContainersValue=void 0,this._cachedViewContainers=void 0;let t=[],o=this.compositeBar.getCompositeBarItems();for(let n of this.cachedViewContainers)t.push({id:n.id,name:n.name,order:n.order,pinned:n.pinned,visible:n.visible&&!!this.getViewContainer(n.id)});for(let n of this.getViewContainers())if(!t.some(({id:r})=>r===n.id)){let r=o.findIndex(({id:s})=>s===n.id);if(r!==-1){let s=o[r];t.splice(r,0,{id:n.id,name:typeof n.title=="string"?n.title:n.title.value,order:s.order,pinned:s.pinned,visible:s.visible})}else t.push({id:n.id,name:typeof n.title=="string"?n.title:n.title.value,order:n.order,pinned:!0,visible:!this.shouldBeHidden(n)})}if(e)for(let n of o)t.find(({id:s})=>s===n.id)||t.push(n);this.compositeBar.setCompositeBarItems(t)}saveCachedViewContainers(){let e=[],t=this.compositeBar.getCompositeBarItems();for(let o of t){let n=this.getViewContainer(o.id);if(n){let r=this.viewDescriptorService.getViewContainerModel(n),s=[];for(let{when:l}of r.allViewDescriptors)s.push({when:l?l.serialize():void 0});e.push({id:o.id,name:r.title,icon:A.isUri(r.icon)&&this.environmentService.remoteAuthority?void 0:r.icon,views:s,pinned:o.pinned,order:o.order,visible:o.visible,isBuiltin:!n.extensionId})}else e.push({id:o.id,name:o.name,pinned:o.pinned,order:o.order,visible:!1,isBuiltin:!1})}this.storeCachedViewContainersState(e)}get cachedViewContainers(){if(this._cachedViewContainers===void 0){this._cachedViewContainers=this.getPinnedViewContainers();for(let e of this.getPlaceholderViewContainers()){let t=this._cachedViewContainers.find(o=>o.id===e.id);t&&(t.visible=e.visible??t.visible,t.name=e.name,t.icon=e.themeIcon?e.themeIcon:e.iconUrl?A.revive(e.iconUrl):void 0,A.isUri(t.icon)&&this.environmentService.remoteAuthority&&(t.icon=void 0),t.views=e.views,t.isBuiltin=e.isBuiltin)}for(let e of this.getViewContainersWorkspaceState()){let t=this._cachedViewContainers.find(o=>o.id===e.id);t&&(t.visible=e.visible??t.visible)}}return this._cachedViewContainers}storeCachedViewContainersState(e){let t=this.getPinnedViewContainers();this.setPinnedViewContainers(e.map(({id:o,pinned:n,order:r})=>({id:o,pinned:n,visible:!!t.find(({id:s})=>s===o)?.visible,order:r}))),this.setPlaceholderViewContainers(e.map(({id:o,icon:n,name:r,views:s,isBuiltin:l})=>({id:o,iconUrl:A.isUri(n)?n:void 0,themeIcon:q.isThemeIcon(n)?n:void 0,name:r,isBuiltin:l,views:s}))),this.setViewContainersWorkspaceState(e.map(({id:o,visible:n})=>({id:o,visible:n})))}getPinnedViewContainers(){return JSON.parse(this.pinnedViewContainersValue)}setPinnedViewContainers(e){this.pinnedViewContainersValue=JSON.stringify(e)}get pinnedViewContainersValue(){return this._pinnedViewContainersValue||(this._pinnedViewContainersValue=this.getStoredPinnedViewContainersValue()),this._pinnedViewContainersValue}set pinnedViewContainersValue(e){this.pinnedViewContainersValue!==e&&(this._pinnedViewContainersValue=e,this.setStoredPinnedViewContainersValue(e))}getStoredPinnedViewContainersValue(){return this.storageService.get(this.options.pinnedViewContainersKey,0,"[]")}setStoredPinnedViewContainersValue(e){this.storageService.store(this.options.pinnedViewContainersKey,e,0,0)}getPlaceholderViewContainers(){return JSON.parse(this.placeholderViewContainersValue)}setPlaceholderViewContainers(e){this.placeholderViewContainersValue=JSON.stringify(e)}get placeholderViewContainersValue(){return this._placeholderViewContainersValue||(this._placeholderViewContainersValue=this.getStoredPlaceholderViewContainersValue()),this._placeholderViewContainersValue}set placeholderViewContainersValue(e){this.placeholderViewContainersValue!==e&&(this._placeholderViewContainersValue=e,this.setStoredPlaceholderViewContainersValue(e))}getStoredPlaceholderViewContainersValue(){return this.storageService.get(this.options.placeholderViewContainersKey,0,"[]")}setStoredPlaceholderViewContainersValue(e){this.storageService.store(this.options.placeholderViewContainersKey,e,0,1)}getViewContainersWorkspaceState(){return JSON.parse(this.viewContainersWorkspaceStateValue)}setViewContainersWorkspaceState(e){this.viewContainersWorkspaceStateValue=JSON.stringify(e)}get viewContainersWorkspaceStateValue(){return this._viewContainersWorkspaceStateValue||(this._viewContainersWorkspaceStateValue=this.getStoredViewContainersWorkspaceStateValue()),this._viewContainersWorkspaceStateValue}set viewContainersWorkspaceStateValue(e){this.viewContainersWorkspaceStateValue!==e&&(this._viewContainersWorkspaceStateValue=e,this.setStoredViewContainersWorkspaceStateValue(e))}getStoredViewContainersWorkspaceStateValue(){return this.storageService.get(this.options.viewContainersWorkspaceStateKey,1,"[]")}setStoredViewContainersWorkspaceStateValue(e){this.storageService.store(this.options.viewContainersWorkspaceStateKey,e,1,1)}};zte=I([m(4,F),m(5,de),m(6,lt),m(7,ji),m(8,Gt),m(9,X),m(10,Mt),m(11,wi)],zte);var Kte=class extends AG{constructor(e,t,o,n,r,s){super(e);this.part=t;this.paneCompositePart=o;this.layoutService=n;this.configurationService=r;this.activityService=s;this.lastRun=0;this.updateActivity(),this._register(this.activityService.onDidChangeActivity(l=>{!We(l)&&l.id===this.compositeBarActionItem.id&&this.updateActivity()}))}static{this.preventDoubleClickDelay=300}updateCompositeBarActionItem(e){this.compositeBarActionItem=e}updateActivity(){this.activities=this.activityService.getViewContainerActivities(this.compositeBarActionItem.id)}async run(e){if(Wp(e)&&e.button===2)return;let t=Date.now();if(t>this.lastRun&&t-this.lastRun<Kte.preventDoubleClickDelay)return;this.lastRun=t;let o=e&&"preserveFocus"in e?!e.preserveFocus:!0;if(this.part==="workbench.parts.activitybar"){let n=this.layoutService.isVisible("workbench.parts.sidebar"),r=this.paneCompositePart.getActivePaneComposite(),s=this.configurationService.getValue("workbench.activityBar.iconClickBehavior");if(n&&r?.getId()===this.compositeBarActionItem.id){s==="focus"?this.paneCompositePart.openPaneComposite(this.compositeBarActionItem.id,o):this.layoutService.setPartHidden(!0,"workbench.parts.sidebar");return}}return await this.paneCompositePart.openPaneComposite(this.compositeBarActionItem.id,o),this.activate()}};Kte=I([m(3,wi),m(4,B),m(5,Al)],Kte);var QTi=class extends Kte{},wUt=class extends qet{constructor(i,e){super({id:i,name:i,classNames:void 0},e)}setActivity(i){this.label=i.name}},YTi=class extends $et{constructor(i,e){super({id:i,name:i,classNames:void 0},e)}setCompositeBarActionItem(i){this.label=i.name}};var LW=class extends IUt{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H){super(f,v,b,S,y,w,x,E,oe.as(h),o,M.getDefaultViewContainer(p)?.id||"",s,l,c,u,e,t);this.partId=e;this.activePaneContextKey=n;this.paneFocusContextKey=r;this.location=p;this.registryId=h;this.globalActionsMenuId=g;this.viewDescriptorService=M;this.contextKeyService=N;this.extensionService=V;this.menuService=H;this.onDidPaneCompositeClose=this.onDidCompositeClose.event;this.headerFooterCompositeBarDispoables=this._register(new O);this.paneCompositeBar=this._register(new ue);this.compositeBarPosition=void 0;this.blockOpening=void 0;this.registerListeners()}static{this.MIN_COMPOSITE_BAR_WIDTH=50}get snap(){return this.layoutService.isVisible(this.partId)||!!this.paneCompositeBar.value?.getVisiblePaneCompositeIds().length}get onDidPaneCompositeOpen(){return U.map(this.onDidCompositeOpen.event,e=>e.composite)}registerListeners(){this._register(this.onDidPaneCompositeOpen(e=>this.onDidOpen(e))),this._register(this.onDidPaneCompositeClose(this.onDidClose,this)),this._register(this.registry.onDidDeregister(e=>{let t=this.viewDescriptorService.getViewContainersByLocation(this.location).filter(o=>this.viewDescriptorService.getViewContainerModel(o).activeViewDescriptors.length>0);if(t.length){if(this.getActiveComposite()?.getId()===e.id){let o=this.viewDescriptorService.getDefaultViewContainer(this.location)?.id,n=t.filter(r=>r.id===o)[0]||t[0];this.doOpenPaneComposite(n.id)}}else this.layoutService.setPartHidden(!0,this.partId);this.removeComposite(e.id)})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.layoutCompositeBar()}))}onDidOpen(e){this.activePaneContextKey.set(e.getId())}onDidClose(e){let t=e.getId();this.activePaneContextKey.get()===t&&this.activePaneContextKey.reset()}showComposite(e){super.showComposite(e),this.layoutCompositeBar(),this.layoutEmptyMessage()}hideActiveComposite(){let e=super.hideActiveComposite();return this.layoutCompositeBar(),this.layoutEmptyMessage(),e}create(e){this.element=e,this.element.classList.add("pane-composite-part"),super.create(e),this.contentArea&&this.createEmptyPaneMessage(this.contentArea),this.updateCompositeBar();let t=this._register(nr(e));this._register(t.onDidFocus(()=>this.paneFocusContextKey.set(!0))),this._register(t.onDidBlur(()=>this.paneFocusContextKey.set(!1)))}createEmptyPaneMessage(e){this.emptyPaneMessageElement=_(".empty-pane-message-area");let t=_(".empty-pane-message");t.textContent=d(5053,null),this.emptyPaneMessageElement.appendChild(t),e.appendChild(this.emptyPaneMessageElement);let o=n=>{let r=!this.getActiveComposite()||!n,s=n&&this.theme.getColor(ZT)?.toString()||"";this.titleContainer&&r&&(this.titleContainer.style.backgroundColor=s),this.headerFooterCompositeBarContainer&&r&&(this.headerFooterCompositeBarContainer.style.backgroundColor=s),this.emptyPaneMessageElement.style.backgroundColor=s};this.viewDescriptorService.canMoveViews()&&this._register(m_.INSTANCE.registerTarget(this.element,{onDragOver:n=>{if(Kt.stop(n.eventData,!0),this.paneCompositeBar.value){let r=this.paneCompositeBar.value.dndHandler.onDragEnter(n.dragAndDropData,void 0,n.eventData);u8(n.eventData.dataTransfer,"move",r)}},onDragEnter:n=>{if(Kt.stop(n.eventData,!0),this.paneCompositeBar.value){let r=this.paneCompositeBar.value.dndHandler.onDragEnter(n.dragAndDropData,void 0,n.eventData);o(r)}},onDragLeave:n=>{Kt.stop(n.eventData,!0),o(!1)},onDragEnd:n=>{Kt.stop(n.eventData,!0),o(!1)},onDrop:n=>{if(Kt.stop(n.eventData,!0),o(!1),this.paneCompositeBar.value)this.paneCompositeBar.value.dndHandler.drop(n.dragAndDropData,void 0,n.eventData);else{let r=n.dragAndDropData.getData();if(r.type==="composite"){let s=this.viewDescriptorService.getViewContainerById(r.id);this.viewDescriptorService.moveViewContainerToLocation(s,this.location,void 0,"dnd"),this.openPaneComposite(s.id,!0)}else if(r.type==="view"){let s=this.viewDescriptorService.getViewDescriptorById(r.id);if(s.canMoveView){this.viewDescriptorService.moveViewToLocation(s,this.location,"dnd");let l=this.viewDescriptorService.getViewContainerByViewId(s.id);this.openPaneComposite(l.id,!0).then(c=>{c?.openView(s.id,!0)})}}}}}))}createTitleArea(e){let t=super.createTitleArea(e);if(!t)return;this._register($(t,ne.CONTEXT_MENU,n=>{this.onTitleAreaContextMenu(new Ln(Me(t),n))})),this._register(ds.addTarget(t)),this._register($(t,Vn.Contextmenu,n=>{this.onTitleAreaContextMenu(new Ln(Me(t),n))}));let o=t.appendChild(_(".global-actions"));return this.globalToolBar=this._register(this.instantiationService.createInstance(pr,o,this.globalActionsMenuId,{actionViewItemProvider:(n,r)=>this.actionViewItemProvider(n,r),orientation:0,getKeyBinding:n=>this.keybindingService.lookupKeybinding(n.id),anchorAlignmentProvider:()=>this.getTitleAreaDropDownAnchorAlignment(),toggleMenuTitle:d(5052,null),hoverDelegate:this.toolbarHoverDelegate,hiddenItemStrategy:-1,highlightToggledItems:!0,telemetrySource:this.nameForTelemetry})),t}createTitleLabel(e){this.titleContainer=e;let t=super.createTitleLabel(e);this.titleLabelElement.draggable=this.viewDescriptorService.canMoveViews();let o=()=>({type:"composite",id:this.getActivePaneComposite().getId()});return this._register(m_.INSTANCE.registerDraggable(this.titleLabelElement,o,{})),t}updateCompositeBar(e=!1){let t=this.compositeBarPosition!==void 0,o=this.shouldShowCompositeBar(),n=this.compositeBarPosition,r=o?this.getCompositeBarPosition():void 0;if(!e&&n===r)return;if(t){let l=n===1?this.titleContainer:this.headerFooterCompositeBarContainer;if(!this.paneCompositeBarContainer||!this.paneCompositeBar.value||!l)throw new Error("Composite bar containers should exist when removing the previous composite bar");this.paneCompositeBarContainer.remove(),this.paneCompositeBarContainer=void 0,this.paneCompositeBar.value=void 0,l.classList.remove("has-composite-bar"),n===0?this.removeFooterHeaderArea(!0):n===2&&this.removeFooterHeaderArea(!1)}let s;switch(r){case 0:s=this.createHeaderArea();break;case 1:s=this.titleContainer;break;case 2:s=this.createFooterArea();break}if(o){if(this.paneCompositeBarContainer||this.paneCompositeBar.value||!s)throw new Error("Invalid composite bar state when creating the new composite bar");s.classList.add("has-composite-bar"),this.paneCompositeBarContainer=CI(s,_(".composite-bar-container")),this.paneCompositeBar.value=this.createCompositeBar(),this.paneCompositeBar.value.create(this.paneCompositeBarContainer),r===0?this.setHeaderArea(s):r===2&&this.setFooterArea(s)}this.compositeBarPosition=r,e&&this.layoutCompositeBar()}createHeaderArea(){let e=super.createHeaderArea();return this.createHeaderFooterCompositeBarArea(e)}createFooterArea(){let e=super.createFooterArea();return this.createHeaderFooterCompositeBarArea(e)}createHeaderFooterCompositeBarArea(e){if(this.headerFooterCompositeBarContainer)throw new Error("Header or Footer composite bar already exists");return this.headerFooterCompositeBarContainer=e,this.headerFooterCompositeBarDispoables.add($(e,ne.CONTEXT_MENU,t=>{this.onCompositeBarAreaContextMenu(new Ln(Me(e),t))})),this.headerFooterCompositeBarDispoables.add(ds.addTarget(e)),this.headerFooterCompositeBarDispoables.add($(e,Vn.Contextmenu,t=>{this.onCompositeBarAreaContextMenu(new Ln(Me(e),t))})),e}removeFooterHeaderArea(e){this.headerFooterCompositeBarContainer=void 0,this.headerFooterCompositeBarDispoables.clear(),e?this.removeHeaderArea():this.removeFooterArea()}createCompositeBar(){return this.instantiationService.createInstance(zte,this.location,this.getCompositeBarOptions(),this.partId,this)}onTitleAreaUpdate(e){super.onTitleAreaUpdate(e),this.layoutCompositeBar()}async openPaneComposite(e,t){if(typeof e=="string"&&this.getPaneComposite(e))return this.doOpenPaneComposite(e,t);if(await this.extensionService.whenInstalledExtensionsRegistered(),typeof e=="string"&&this.getPaneComposite(e))return this.doOpenPaneComposite(e,t)}async doOpenPaneComposite(e,t){if(this.blockOpening)return this.blockOpening.p;let o;if(!this.layoutService.isVisible(this.partId))try{o=this.blockOpening=new Mo,this.layoutService.setPartHidden(!1,this.partId)}finally{this.blockOpening=void 0}try{let n=this.openComposite(e,t);return o?.complete(n),n}catch(n){throw o?.error(n),n}}getPaneComposite(e){return this.registry.getPaneComposite(e)}getPaneComposites(){return this.registry.getPaneComposites().sort((e,t)=>typeof e.order!="number"?1:typeof t.order!="number"?-1:e.order-t.order)}getPinnedPaneCompositeIds(){return this.paneCompositeBar.value?.getPinnedPaneCompositeIds()??[]}getVisiblePaneCompositeIds(){return this.paneCompositeBar.value?.getVisiblePaneCompositeIds()??[]}getPaneCompositeIds(){return this.paneCompositeBar.value?.getPaneCompositeIds()??[]}getActivePaneComposite(){return this.getActiveComposite()}getLastActivePaneCompositeId(){return this.getLastActiveCompositeId()}hideActivePaneComposite(){this.layoutService.isVisible(this.partId)&&this.layoutService.setPartHidden(!0,this.partId),this.hideActiveComposite()}focusCompositeBar(){this.paneCompositeBar.value?.focus()}layout(e,t,o,n){this.layoutService.isVisible(this.partId)&&(this.contentDimension=new di(e,t),super.layout(this.contentDimension.width,this.contentDimension.height,o,n),this.layoutCompositeBar(),this.layoutEmptyMessage())}layoutCompositeBar(){if(this.contentDimension&&this.dimension&&this.paneCompositeBar.value){let e=this.compositeBarPosition===1?16:8,t=this.partId==="workbench.parts.panel"?0:1,o=this.contentDimension.width-e-t;o=Math.max(LW.MIN_COMPOSITE_BAR_WIDTH,o-this.getToolbarWidth()),this.paneCompositeBar.value.layout(o,this.dimension.height)}}layoutEmptyMessage(){let e=!this.getActiveComposite();this.element.classList.toggle("empty",e),e&&this.titleLabel?.updateTitle("","")}getToolbarWidth(){if(!this.toolBar||this.compositeBarPosition!==1||!this.getActivePaneComposite())return 0;let t=this.toolBar.getItemsWidth()+this.toolBar.getItemsLength()*4,o=this.globalToolBar?this.globalToolBar.getItemsWidth()+this.globalToolBar.getItemsLength()*4:0;return t+o+8}onTitleAreaContextMenu(e){if(this.shouldShowCompositeBar()&&this.getCompositeBarPosition()===1)return this.onCompositeBarContextMenu(e);{let t=this.getActivePaneComposite(),o=t?t.getContextMenuActions():[];o.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>o,getActionViewItem:(n,r)=>this.actionViewItemProvider(n,r),actionRunner:t.getActionRunner(),skipTelemetry:!0})}}onCompositeBarAreaContextMenu(e){return this.onCompositeBarContextMenu(e)}onCompositeBarContextMenu(e){if(this.paneCompositeBar.value){let t=[...this.paneCompositeBar.value.getContextMenuActions()];t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>t,skipTelemetry:!0})}}getViewsSubmenuAction(){let e=this.getActivePaneComposite()?.getViewPaneContainer();if(e){let t=new O,o=t.add(this.contextKeyService.createScoped(this.element));o.createKey("viewContainer",e.viewContainer.id);let n=this.menuService.getMenuActions(p8,o,{shouldForwardArgs:!0,renderShortTitle:!0}),r=xl(n,()=>!0).primary;return t.dispose(),r.length>1&&r.some(s=>s.enabled)?new sa("views",d(5054,null),r):void 0}}};LW=I([m(12,Ne),m(13,de),m(14,Xe),m(15,wi),m(16,Le),m(17,ot),m(18,F),m(19,Pe),m(20,ji),m(21,X),m(22,lt),m(23,Yt)],LW);var Gte=class extends k{constructor(e,t){super();this.location=e;this.viewDescriptorService=t;this.viewContainerModelListeners=this._register(new Ot);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._visibleCount=0;this.registerListeners(),this.initializeViewContainerListeners(),this.updateVisibleCount()}get visibleCount(){return this._visibleCount}registerListeners(){this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:e,removed:t})=>{for(let{container:n,location:r}of e)r===this.location&&this.addViewContainerModelListener(n.id);for(let{container:n,location:r}of t)r===this.location&&this.viewContainerModelListeners.deleteAndDispose(n.id);[...e,...t].some(({location:n})=>n===this.location)&&this.updateVisibleCount()})),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:e,from:t,to:o})=>{t===this.location&&this.viewContainerModelListeners.deleteAndDispose(e.id),o===this.location&&this.addViewContainerModelListener(e.id),(t===this.location||o===this.location)&&this.updateVisibleCount()}))}initializeViewContainerListeners(){for(let e of this.viewDescriptorService.getViewContainersByLocation(this.location))this.addViewContainerModelListener(e.id)}addViewContainerModelListener(e){let t=this.viewDescriptorService.getViewContainerById(e);if(t){let n=this.viewDescriptorService.getViewContainerModel(t).onDidChangeActiveViewDescriptors(()=>this.updateVisibleCount());this.viewContainerModelListeners.set(e,n)}}updateVisibleCount(){let o=this.viewDescriptorService.getViewContainersByLocation(this.location).filter(n=>this.viewDescriptorService.getViewContainerModel(n).activeViewDescriptors.length>0).length;if(this._visibleCount!==o){let n=this._visibleCount;this._visibleCount=o,this._onDidChange.fire({before:n,after:o})}}};Gte=I([m(1,ji)],Gte);var UN=class extends LW{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("workbench.parts.auxiliarybar",{hasTitle:!0,trailingSeparator:!0,borderWidth:()=>this.getColor(R2)||this.getColor(Ei)?1:0},UN.activeViewSettingsKey,Xso.bindTo(p),Jso.bindTo(p),"auxiliarybar","auxiliarybar",void 0,CMt,2,CW.Auxiliary,R.AuxiliaryBarTitle,e,t,o,n,r,s,l,c,u,p,h,f);this.commandService=g;this.configurationService=v;this.minimumWidth=170;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.priority=1;this.visibleViewContainersTracker=this._register(l.createInstance(Gte,2)),this._register(this.visibleViewContainersTracker.onDidChange(b=>this.onDidChangeAutoHideViewContainers(b))),this.configuration=this.resolveConfiguration(),this._register(v.onDidChangeConfiguration(b=>{b.affectsConfiguration("workbench.activityBar.location")?(this.configuration=this.resolveConfiguration(),this.onDidChangeActivityBarLocation()):b.affectsConfiguration("workbench.secondarySideBar.showLabels")?(this.configuration=this.resolveConfiguration(),this.updateCompositeBar(!0)):b.affectsConfiguration("workbench.activityBar.autoHide")&&this.onDidChangeActivityBarLocation()}))}static{this.activeViewSettingsKey="workbench.auxiliarybar.activepanelid"}static{this.pinnedViewsKey="workbench.auxiliarybar.pinnedPanels"}static{this.placeholdeViewContainersKey="workbench.auxiliarybar.placeholderPanels"}static{this.viewContainersWorkspaceStateKey="workbench.auxiliarybar.viewContainersWorkspaceState"}get preferredHeight(){return this.layoutService.mainContainerDimension.height*.4}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}onDidChangeAutoHideViewContainers(e){if(this.configurationService.getValue("workbench.activityBar.autoHide")&&(this.configuration.position==="top"||this.configuration.position==="bottom")){let o=e.before>1,n=e.after>1;o!==n&&this.onDidChangeActivityBarLocation()}}resolveConfiguration(){let e=this.configurationService.getValue("workbench.activityBar.location"),t=e!=="top"&&e!=="bottom",o=t&&this.configurationService.getValue("workbench.secondarySideBar.showLabels")!==!1;return{position:e,canShowLabels:t,showLabels:o}}onDidChangeActivityBarLocation(){this.updateCompositeBar();let e=this.getActiveComposite()?.getId();e&&this.onTitleAreaUpdate(e)}updateStyles(){super.updateStyles();let e=Ti(this.getContainer());e.style.backgroundColor=this.getColor(ch)||"";let t=this.getColor(R2)||this.getColor(Ei),o=this.layoutService.getSideBarPosition()===1;e.style.color=this.getColor(QA)||"",e.style.borderLeftColor=t??"",e.style.borderRightColor=t??"",e.style.borderLeftStyle=t&&!o?"solid":"none",e.style.borderRightStyle=t&&o?"solid":"none",e.style.borderLeftWidth=t&&!o?"1px":"0px",e.style.borderRightWidth=t&&o?"1px":"0px"}getCompositeBarOptions(){let e=this;return{partContainerClass:"auxiliarybar",pinnedViewContainersKey:UN.pinnedViewsKey,placeholderViewContainersKey:UN.placeholdeViewContainersKey,viewContainersWorkspaceStateKey:UN.viewContainersWorkspaceStateKey,icon:!this.configuration.showLabels,orientation:0,recomputeSizes:!0,activityHoverOptions:{position:()=>this.getCompositeBarPosition()===2?3:2},fillExtraContextMenuActions:t=>this.fillExtraContextMenuActions(t),compositeSize:0,iconSize:16,get overflowActionSize(){return e.getCompositeBarPosition()===1?40:30},colors:t=>({activeBackgroundColor:t.getColor(ch),inactiveBackgroundColor:t.getColor(ch),get activeBorderBottomColor(){return e.getCompositeBarPosition()===1?t.getColor(IMt):t.getColor(fMt)},get activeForegroundColor(){return e.getCompositeBarPosition()===1?t.getColor(u3):t.getColor(d3)},get inactiveForegroundColor(){return e.getCompositeBarPosition()===1?t.getColor(SMt):t.getColor(vMt)},badgeBackground:t.getColor(zD),badgeForeground:t.getColor(KD),get dragAndDropBorder(){return e.getCompositeBarPosition()===1?t.getColor(yMt):t.getColor(bMt)}}),compact:!0}}fillExtraContextMenuActions(e){let t=this.layoutService.getSideBarPosition()===0;if(this.getCompositeBarPosition()===1){let s=this.getViewsSubmenuAction();s&&(e.push(new oi),e.push(s))}let o=this.menuService.getMenuActions(R.ActivityBarPositionMenu,this.contextKeyService,{shouldForwardArgs:!0,renderShortTitle:!0}),n=um(o).secondary,r=li({id:"workbench.action.auxiliarybar.toggleShowLabels",label:this.configuration.showLabels?d(4457,null):d(4458,null),enabled:this.configuration.canShowLabels,run:()=>this.configurationService.updateValue("workbench.secondarySideBar.showLabels",!this.configuration.showLabels)});e.push(new oi,new sa("workbench.action.panel.position",d(4453,null),n),li({id:S_.ID,label:t?d(4455,null):d(4456,null),run:()=>this.commandService.executeCommand(S_.ID)}),r,li({id:SW.ID,label:d(4454,null),run:()=>this.commandService.executeCommand(SW.ID)}))}shouldShowCompositeBar(){return!(this.configuration.position==="hidden"||(this.configuration.position==="top"||this.configuration.position==="bottom")&&this.configurationService.getValue("workbench.activityBar.autoHide")&&this.visibleViewContainersTracker.visibleCount<=1)}getCompositeBarPosition(){switch(this.configuration.position){case"top":return 0;case"bottom":return 2;case"hidden":return 1;case"default":return 1;default:return 1}}toJSON(){return{type:"workbench.parts.auxiliarybar"}}};UN=I([m(0,Ne),m(1,de),m(2,Xe),m(3,wi),m(4,Le),m(5,ot),m(6,F),m(7,Pe),m(8,ji),m(9,X),m(10,lt),m(11,fe),m(12,Yt),m(13,B)],UN);var XG=class extends LW{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("workbench.parts.panel",{hasTitle:!0,trailingSeparator:!0},XG.activePanelSettingsKey,Zso.bindTo(p),Rpe.bindTo(p),"panel","panel",void 0,Qro,1,CW.Panels,R.PanelTitle,e,t,o,n,r,s,l,c,u,p,h,f);this.commandService=g;this.configurationService=v;this.minimumWidth=300;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=77;this.maximumHeight=Number.POSITIVE_INFINITY;this._register(this.configurationService.onDidChangeConfiguration(b=>{b.affectsConfiguration("workbench.panel.showLabels")&&this.updateCompositeBar(!0)}))}get preferredHeight(){return this.layoutService.mainContainerDimension.height*.4}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}static{this.activePanelSettingsKey="workbench.panelpart.activepanelid"}updateStyles(){super.updateStyles();let e=Ti(this.getContainer());e.style.backgroundColor=this.getColor(GI)||"";let t=this.getColor(ob)||this.getColor(Ei)||"";e.style.borderLeftColor=t,e.style.borderRightColor=t,e.style.borderBottomColor=t,this.titleArea&&(this.titleArea.style.borderTopColor=this.getColor(ob)||this.getColor(Ei)||"")}getCompositeBarOptions(){return{partContainerClass:"panel",pinnedViewContainersKey:"workbench.panel.pinnedPanels",placeholderViewContainersKey:"workbench.panel.placeholderPanels",viewContainersWorkspaceStateKey:"workbench.panel.viewContainersWorkspaceState",icon:this.configurationService.getValue("workbench.panel.showLabels")===!1,orientation:0,recomputeSizes:!0,activityHoverOptions:{position:()=>this.layoutService.getPanelPosition()===2&&!this.layoutService.isPanelMaximized()?3:2},fillExtraContextMenuActions:e=>this.fillExtraContextMenuActions(e),compositeSize:0,iconSize:16,compact:!0,overflowActionSize:44,colors:e=>({activeBackgroundColor:e.getColor(GI),inactiveBackgroundColor:e.getColor(GI),activeBorderBottomColor:e.getColor(IMt),activeForegroundColor:e.getColor(u3),inactiveForegroundColor:e.getColor(SMt),badgeBackground:e.getColor(Yro),badgeForeground:e.getColor(Xro),dragAndDropBorder:e.getColor(yMt)})}}fillExtraContextMenuActions(e){if(this.getCompositeBarPosition()===1){let c=this.getViewsSubmenuAction();c&&(e.push(new oi),e.push(c))}let t=this.menuService.getMenuActions(R.PanelPositionMenu,this.contextKeyService,{shouldForwardArgs:!0}),o=this.menuService.getMenuActions(R.PanelAlignmentMenu,this.contextKeyService,{shouldForwardArgs:!0}),n=um(t).secondary,r=um(o).secondary,s=this.configurationService.getValue("workbench.panel.showLabels"),l=li({id:"workbench.action.panel.toggleShowLabels",label:s?d(5096,null):d(5097,null),run:()=>this.configurationService.updateValue("workbench.panel.showLabels",!s)});e.push(new oi,new sa("workbench.action.panel.position",d(5095,null),n),new sa("workbench.action.panel.align",d(5093,null),r),l,li({id:NG.ID,label:d(5094,null),run:()=>this.commandService.executeCommand(NG.ID)}))}layout(e,t,o,n){let r;switch(this.layoutService.getPanelPosition()){case 1:r=new di(e-1,t);break;case 3:r=new di(e,t-1);break;default:r=new di(e,t);break}super.layout(r.width,r.height,o,n)}shouldShowCompositeBar(){return!0}getCompositeBarPosition(){return 1}toJSON(){return{type:"workbench.parts.panel"}}};XG=I([m(0,Ne),m(1,de),m(2,Xe),m(3,wi),m(4,Le),m(5,ot),m(6,F),m(7,Pe),m(8,ji),m(9,X),m(10,lt),m(11,fe),m(12,Yt),m(13,B)],XG);W(class extends z{constructor(){super({id:"workbench.action.closeSidebar",title:P(5098,"Close Primary Side Bar"),category:Fe.View,f1:!0,precondition:eN})}run(a){a.get(wi).setPartHidden(!0,"workbench.parts.sidebar")}});var XTi=class extends z{constructor(){super({id:"workbench.action.focusSideBar",title:P(5099,"Focus into Primary Side Bar"),category:Fe.View,f1:!0,keybinding:{weight:200,when:null,primary:2069}})}async run(i){let e=i.get(wi),t=i.get(Es);e.isVisible("workbench.parts.sidebar")||e.setPartHidden(!1,"workbench.parts.sidebar"),t.getActivePaneComposite(0)?.focus()}};W(XTi);var PPe=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,Vhe=/(&amp;)?(&amp;)([^\s&])/g;var Jfo={shadowColor:void 0,borderColor:void 0,foregroundColor:void 0,backgroundColor:void 0,selectionForegroundColor:void 0,selectionBackgroundColor:void 0,selectionBorderColor:void 0,separatorColor:void 0,scrollbarShadow:void 0,scrollbarSliderBackground:void 0,scrollbarSliderHoverBackground:void 0,scrollbarSliderActiveBackground:void 0},j8=class a extends oo{constructor(e,t,o,n){e.classList.add("monaco-menu-container"),e.setAttribute("role","presentation");let r=document.createElement("div");r.classList.add("monaco-menu"),r.setAttribute("role","presentation");super(r,{orientation:1,actionViewItemProvider:u=>this.doGetActionViewItem(u,o,s),context:o.context,actionRunner:o.actionRunner,ariaLabel:o.ariaLabel,ariaRole:"menu",focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...et||Sn?[10]:[]],keyDown:!0}});this.menuStyles=n;this.menuElement=r,this.actionsList.tabIndex=0,this.initializeOrUpdateStyleSheet(e,n),this._register(ds.addTarget(r)),this._register($(r,ne.KEY_DOWN,u=>{new mi(u).equals(2)&&u.preventDefault()})),o.enableMnemonics&&this._register($(r,ne.KEY_DOWN,u=>{let p=u.key.toLocaleLowerCase(),h=this.mnemonics.get(p);if(h!==void 0&&(Kt.stop(u,!0),h.length===1&&(h[0]instanceof rit&&h[0].container&&this.focusItemByElement(h[0].container),h[0].onClick(u)),h.length>1)){let g=h.shift();g&&g.container&&(this.focusItemByElement(g.container),h.push(g)),this.mnemonics.set(p,h)}})),Sn&&this._register($(r,ne.KEY_DOWN,u=>{let p=new mi(u);p.equals(14)||p.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),Kt.stop(u,!0)):(p.equals(13)||p.equals(12))&&(this.focusedItem=0,this.focusPrevious(),Kt.stop(u,!0))})),this._register($(this.domNode,ne.MOUSE_OUT,u=>{let p=u.relatedTarget;ms(p,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),u.stopPropagation())})),this._register($(this.actionsList,ne.MOUSE_OVER,u=>{let p=u.target;if(!(!p||!ms(p,this.actionsList)||p===this.actionsList)){for(;p.parentElement!==this.actionsList&&p.parentElement!==null;)p=p.parentElement;if(p.classList.contains("action-item")){let h=this.focusedItem;this.setFocusedItem(p),h!==this.focusedItem&&this.updateFocus()}}})),this._register(ds.addTarget(this.actionsList)),this._register($(this.actionsList,Vn.Tap,u=>{let p=u.initialTarget;if(!(!p||!ms(p,this.actionsList)||p===this.actionsList)){for(;p.parentElement!==this.actionsList&&p.parentElement!==null;)p=p.parentElement;if(p.classList.contains("action-item")){let h=this.focusedItem;this.setFocusedItem(p),h!==this.focusedItem&&this.updateFocus()}}}));let s={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new Ar(r,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));let l=this.scrollableElement.getDomNode();l.style.position="",this.styleScrollElement(l,n),this._register($(r,Vn.Change,u=>{Kt.stop(u,!0);let p=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:p-u.translationY})})),this._register($(l,ne.MOUSE_UP,u=>{u.preventDefault()}));let c=Me(e);r.style.maxHeight=`${Math.max(10,c.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter((u,p)=>o.submenuIds?.has(u.id)?(console.warn(`Found submenu cycle: ${u.id}`),!1):!(u instanceof oi&&(p===t.length-1||p===0||t[p-1]instanceof oi))),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(u=>!(u instanceof CUt)).forEach((u,p,h)=>{u.updatePositionInSet(p+1,h.length)})}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(a5(e)?this.styleSheet=Pr(e):(a.globalStyleSheet||(a.globalStyleSheet=Pr()),this.styleSheet=a.globalStyleSheet)),this.styleSheet.textContent=JTi(t,a5(e))}styleScrollElement(e,t){let o=t.foregroundColor??"",n=t.backgroundColor??"",r=t.borderColor?`1px solid ${t.borderColor}`:"",s="var(--vscode-cornerRadius-large)";e.style.outline=r,e.style.borderRadius=s,e.style.color=o,e.style.backgroundColor=n}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}get scrollOffset(){return this.menuElement.scrollTop}trigger(e){if(e<=this.viewItems.length&&e>=0){let t=this.viewItems[e];if(t instanceof rit)super.focus(e),t.open(!0);else if(t instanceof sit)super.run(t._action,t._context);else return}}focusItemByElement(e){let t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t<this.actionsList.children.length;t++){let o=this.actionsList.children[t];if(e===o){this.focusedItem=t;break}}}updateFocus(e){super.updateFocus(e,!0,!0),typeof this.focusedItem<"u"&&this.scrollableElement.setScrollPosition({scrollTop:Math.round(this.menuElement.scrollTop)})}doGetActionViewItem(e,t,o){if(e instanceof oi)return new CUt(t.context,e,{icon:!0},this.menuStyles);if(e instanceof sa){let n=new rit(e,e.actions,o,{...t,submenuIds:new Set([...t.submenuIds||[],e.id])},this.menuStyles);if(t.enableMnemonics){let r=n.getMnemonic();if(r&&n.isEnabled()){let s=this.mnemonics.get(r);s!==void 0?s.push(n):this.mnemonics.set(r,[n])}}return n}else{let n=t.getKeyBinding?.(e)?.getLabel(),r={enableMnemonics:t.enableMnemonics,useEventAsContext:t.useEventAsContext,keybinding:n},s=new sit(t.context,e,r,this.menuStyles);if(t.enableMnemonics){let l=s.getMnemonic();if(l&&s.isEnabled()){let c=this.mnemonics.get(l);c!==void 0?c.push(s):this.mnemonics.set(l,[s])}}return s}}},sit=class extends Ja{constructor(e,t,o,n){o={...o,isMenu:!0,icon:o.icon!==void 0?o.icon:!1,label:o.label!==void 0?o.label:!0};super(t,t,o);this.menuStyle=n;if(this.options=o,this.cssClass="",this.options.label&&o.enableMnemonics){let r=this.action.label;if(r){let s=PPe.exec(r);s&&(this.mnemonic=(s[1]?s[1]:s[3]).toLocaleLowerCase())}}this.runOnceToEnableMouseUp=new Dt(()=>{this.element&&(this._register($(this.element,ne.MOUSE_UP,r=>{if(Kt.stop(r,!0),ed){if(new Ln(Me(this.element),r).rightButton)return;this.onClick(r)}else setTimeout(()=>{this.onClick(r)},0)})),this._register($(this.element,ne.CONTEXT_MENU,r=>{Kt.stop(r,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=D(this.element,_("a.action-menu-item")),this._action.id===oi.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=D(this.item,_("span.menu-item-check"+q.asCSSSelector(L.menuSelection))),this.check.setAttribute("role","none"),this.label=D(this.item,_("span.action-label")),this.options.label&&this.options.keybinding&&(D(this.item,_("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked(),this.applyStyle())}blur(){super.blur(),this.applyStyle()}focus(){super.focus(),this.item?.focus(),this.applyStyle()}updatePositionInSet(e,t){this.item&&(this.item.setAttribute("aria-posinset",`${e}`),this.item.setAttribute("aria-setsize",`${t}`))}updateLabel(){if(this.label&&this.options.label){St(this.label);let e=Du(this.action.label);if(e){let t=xUt(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));let o=PPe.exec(e);if(o){e=Cr(e),Vhe.lastIndex=0;let n=Vhe.exec(e);for(;n&&n[1];)n=Vhe.exec(e);let r=s=>s.replace(/&amp;&amp;/g,"&amp;");n?this.label.append(ax(r(e.substr(0,n.index))," "),_("u",{"aria-hidden":"true"},n[3]),Bh(r(e.substr(n.index+n[0].length))," ")):this.label.textContent=r(e).trim(),this.item?.setAttribute("aria-keyshortcuts",(o[1]?o[1]:o[3]).toLocaleLowerCase())}else this.label.textContent=e.replace(/&&/g,"&").trim()}}}updateTooltip(){}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.action.class||"",this.label.classList.add("icon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" ")),this.updateEnabled()):this.label&&this.label.classList.remove("icon")}updateEnabled(){this.action.enabled?(this.element&&(this.element.classList.remove("disabled"),this.element.removeAttribute("aria-disabled")),this.item&&(this.item.classList.remove("disabled"),this.item.removeAttribute("aria-disabled"),this.item.tabIndex=0)):(this.element&&(this.element.classList.add("disabled"),this.element.setAttribute("aria-disabled","true")),this.item&&(this.item.classList.add("disabled"),this.item.setAttribute("aria-disabled","true")))}updateChecked(){if(!this.item)return;let e=this.action.checked;this.item.classList.toggle("checked",!!e),e!==void 0?(this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked",e?"true":"false")):(this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked",""))}getMnemonic(){return this.mnemonic}applyStyle(){let e=this.element&&this.element.classList.contains("focused"),t=e&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor,o=e&&this.menuStyle.selectionBackgroundColor?this.menuStyle.selectionBackgroundColor:void 0,n=e&&this.menuStyle.selectionBorderColor?`1px solid ${this.menuStyle.selectionBorderColor}`:"",r=e&&this.menuStyle.selectionBorderColor?"-1px":"";this.item&&(this.item.style.color=t??"",this.item.style.backgroundColor=o??"",this.item.style.outline=n,this.item.style.outlineOffset=r),this.check&&(this.check.style.color=t??"")}},rit=class extends sit{constructor(e,t,o,n,r){super(e,e,n,r);this.submenuActions=t;this.parentData=o;this.submenuOptions=n;this.mysubmenu=null;this.submenuDisposables=this._register(new O);this.mouseOver=!1;this.expandDirection=n&&n.expandDirection!==void 0?n.expandDirection:{horizontal:0,vertical:1},this.showScheduler=new Dt(()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))},250),this.hideScheduler=new Dt(()=>{this.element&&!ms(Un(),this.element)&&this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))},750)}render(e){super.render(e),this.element&&(this.item&&(this.item.classList.add("monaco-submenu-item"),this.item.tabIndex=0,this.item.setAttribute("aria-haspopup","true"),this.updateAriaExpanded("false"),this.submenuIndicator=D(this.item,_("span.submenu-indicator"+q.asCSSSelector(L.menuSubmenu))),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register($(this.element,ne.KEY_UP,t=>{let o=new mi(t);(o.equals(17)||o.equals(3))&&(Kt.stop(t,!0),this.createSubmenu(!0))})),this._register($(this.element,ne.KEY_DOWN,t=>{let o=new mi(t);Un()===this.item&&(o.equals(17)||o.equals(3))&&Kt.stop(t,!0)})),this._register($(this.element,ne.MOUSE_OVER,t=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())})),this._register($(this.element,ne.MOUSE_LEAVE,t=>{this.mouseOver=!1})),this._register($(this.element,ne.FOCUS_OUT,t=>{this.element&&!ms(Un(),this.element)&&this.hideScheduler.schedule()})),this._register(this.parentData.parent.onScroll(()=>{this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))})))}updateEnabled(){}open(e){this.cleanupExistingSubmenu(!1),this.createSubmenu(e)}onClick(e){Kt.stop(e,!0),this.cleanupExistingSubmenu(!1),this.createSubmenu(!0)}cleanupExistingSubmenu(e){if(this.parentData.submenu&&(e||this.parentData.submenu!==this.mysubmenu)){try{this.parentData.submenu.dispose()}catch{}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,o,n){let r={top:0,left:0};return r.left=_de(e.width,t.width,{position:n.horizontal===0?0:1,offset:o.left,size:o.width}).position,r.left>=o.left&&r.left<o.left+o.width&&(o.left+10+t.width<=e.width&&(r.left=o.left+10),o.top+=10,o.height=0),r.top=_de(e.height,t.height,{position:0,offset:o.top,size:0}).position,r.top+t.height===o.top&&r.top+o.height+t.height<=e.height&&(r.top+=o.height),r}createSubmenu(e=!0){if(this.element)if(this.parentData.submenu)this.parentData.submenu.focus(!1);else{this.updateAriaExpanded("true"),this.submenuContainer=D(this.element,_("div.monaco-submenu")),this.submenuContainer.classList.add("menubar-menu-items-holder","context-view");let t=Me(this.parentData.parent.domNode).getComputedStyle(this.parentData.parent.domNode),o=parseFloat(t.paddingTop||"0")||0;this.submenuContainer.style.position="fixed",this.submenuContainer.style.top="0",this.submenuContainer.style.left="0",this.submenuContainer.style.zIndex="1",this.parentData.submenu=new j8(this.submenuContainer,this.submenuActions.length?this.submenuActions:[new qbt],this.submenuOptions,this.menuStyle);let n=this.element.getBoundingClientRect(),r={top:n.top-o,left:n.left,height:n.height+2*o,width:n.width},s=this.submenuContainer.getBoundingClientRect(),l=Me(this.element),{top:c,left:u}=this.calculateSubmenuMenuLayout(new di(l.innerWidth,l.innerHeight),di.lift(s),r,this.expandDirection);this.submenuContainer.style.left=`${u-s.left}px`,this.submenuContainer.style.top=`${c-s.top}px`,this.submenuDisposables.add($(this.submenuContainer,ne.KEY_UP,p=>{new mi(p).equals(15)&&(Kt.stop(p,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add($(this.submenuContainer,ne.KEY_DOWN,p=>{new mi(p).equals(15)&&Kt.stop(p,!0)})),this.submenuDisposables.add(this.parentData.submenu.onDidCancel(()=>{this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0)})),this.parentData.submenu.focus(e),this.mysubmenu=this.parentData.submenu}}updateAriaExpanded(e){this.item&&this.item?.setAttribute("aria-expanded",e)}applyStyle(){super.applyStyle();let t=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=t??"")}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}},CUt=class extends ts{constructor(e,t,o,n){super(e,t,o);this.menuStyles=n}render(e){super.render(e),this.label&&(this.label.style.borderBottomColor=this.menuStyles.separatorColor?`${this.menuStyles.separatorColor}`:"")}};function xUt(a){let i=PPe,e=i.exec(a);if(!e)return a;let t=!e[1];return a.replace(i,t?"$2$3":"").trim()}function Xfo(a){let i=$bt()[a.id];return`.codicon-${a.id}:before { content: '\\${i.toString(16)}'; }`}function JTi(a,i){let t=`
.monaco-menu {
	font-size: 13px;
	border-radius: var(--vscode-cornerRadius-large);
	border: 1px solid ${a.borderColor??"var(--vscode-menu-border)"};
	min-width: 160px;
}

${Xfo(L.menuSelection)}
${Xfo(L.menuSubmenu)}

.monaco-menu .monaco-action-bar {
	text-align: right;
	overflow: hidden;
	white-space: nowrap;
}

.monaco-menu .monaco-action-bar .actions-container {
	display: flex;
	margin: 0 auto;
	padding: 0;
	width: 100%;
	justify-content: flex-end;
}

.monaco-menu .monaco-action-bar.vertical .actions-container {
	display: inline-block;
}

.monaco-menu .monaco-action-bar.reverse .actions-container {
	flex-direction: row-reverse;
}

.monaco-menu .monaco-action-bar .action-item {
	cursor: pointer;
	display: inline-block;
	transition: transform 50ms ease;
	position: relative;  /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */
}

.monaco-menu .monaco-action-bar .action-item.disabled {
	cursor: default;
}

.monaco-menu .monaco-action-bar .action-item .icon,
.monaco-menu .monaco-action-bar .action-item .codicon {
	display: inline-block;
}

.monaco-menu .monaco-action-bar .action-item .codicon {
	display: flex;
	align-items: center;
}

.monaco-menu .monaco-action-bar .action-label {
	font-size: 11px;
	margin-right: 4px;
}

.monaco-menu .monaco-action-bar .action-item.disabled .action-label,
.monaco-menu .monaco-action-bar .action-item.disabled .action-label:hover {
	color: var(--vscode-disabledForeground);
}

/* Vertical actions */

.monaco-menu .monaco-action-bar.vertical {
	text-align: left;
}

.monaco-menu .monaco-action-bar.vertical .action-item {
	display: block;
}

.monaco-menu .monaco-action-bar.vertical .action-label.separator {
	display: block;
	border-bottom: 1px solid var(--vscode-menu-separatorBackground);
	padding-top: 1px;
	padding: 30px;
}

.monaco-menu .secondary-actions .monaco-action-bar .action-label {
	margin-left: 6px;
}

/* Action Items */
.monaco-menu .monaco-action-bar .action-item.select-container {
	overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */
	flex: 1;
	max-width: 170px;
	min-width: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 10px;
}

.monaco-menu .monaco-action-bar.vertical {
	margin-left: 0;
	overflow: visible;
}

.monaco-menu .monaco-action-bar.vertical .actions-container {
	display: block;
}

.monaco-menu .monaco-action-bar.vertical .action-item {
	padding: 0;
	transform: none;
	display: flex;
}

.monaco-menu .monaco-action-bar.vertical .action-item.active {
	transform: none;
}

.monaco-menu .monaco-action-bar.vertical .action-menu-item {
	flex: 1 1 auto;
	display: flex;
	height: 24px;
	align-items: center;
	position: relative;
	margin: 0 4px;
	border-radius: var(--vscode-cornerRadius-medium);
}

.monaco-menu .monaco-action-bar.vertical .action-menu-item:hover .keybinding,
.monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .keybinding {
	opacity: unset;
}

.monaco-menu .monaco-action-bar.vertical .action-label {
	flex: 1 1 auto;
	text-decoration: none;
	padding: 0 1em;
	background: none;
	font-size: 12px;
	line-height: 1;
}

.monaco-menu .monaco-action-bar.vertical .keybinding,
.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
	display: inline-block;
	flex: 2 1 auto;
	padding: 0 1em;
	text-align: right;
	font-size: 12px;
	line-height: 1;
	opacity: 0.7;
}

.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
	height: 100%;
}

.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon {
	font-size: 16px !important;
	display: flex;
	align-items: center;
}

.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before {
	margin-left: auto;
	margin-right: -20px;
}

.monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding,
.monaco-menu .monaco-action-bar.vertical .action-item.disabled .submenu-indicator {
	opacity: 0.4;
}

.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) {
	display: inline-block;
	box-sizing: border-box;
	margin: 0;
}

.monaco-menu .monaco-action-bar.vertical .action-item {
	position: static;
	overflow: visible;
}

.monaco-menu .monaco-action-bar.vertical .action-item .monaco-submenu {
	position: absolute;
}

.monaco-menu .monaco-action-bar.vertical .action-label.separator {
	width: 100%;
	height: 0px !important;
	opacity: 1;
}

.monaco-menu .monaco-action-bar.vertical .action-label.separator.text {
	padding: 0.7em 1em 0.1em 1em;
	font-weight: bold;
	opacity: 1;
}

.monaco-menu .monaco-action-bar.vertical .action-label:hover {
	color: inherit;
}

.monaco-menu .monaco-action-bar.vertical .menu-item-check {
	position: absolute;
	visibility: hidden;
	width: 1em;
	height: 100%;
}

.monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check {
	visibility: visible;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Context Menu */

.context-view.monaco-menu-container {
	outline: 0;
	border: none;
	animation: fadeIn 0.083s linear;
	-webkit-app-region: no-drag;
	box-shadow: var(--vscode-shadow-lg${a.shadowColor?`, 0 0 12px ${a.shadowColor}`:""});
	border-radius: var(--vscode-cornerRadius-large);
	overflow: hidden;
}

.context-view.monaco-menu-container :focus,
.context-view.monaco-menu-container .monaco-action-bar.vertical:focus,
.context-view.monaco-menu-container .monaco-action-bar.vertical :focus {
	outline: 0;
}

.hc-black .context-view.monaco-menu-container,
.hc-light .context-view.monaco-menu-container,
:host-context(.hc-black) .context-view.monaco-menu-container,
:host-context(.hc-light) .context-view.monaco-menu-container {
	box-shadow: none;
}

.hc-black .monaco-menu .monaco-action-bar.vertical .action-item.focused,
.hc-light .monaco-menu .monaco-action-bar.vertical .action-item.focused,
:host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused,
:host-context(.hc-light) .monaco-menu .monaco-action-bar.vertical .action-item.focused {
	background: none;
}

/* Vertical Action Bar Styles */

.monaco-menu .monaco-action-bar.vertical {
	padding: 4px 0;
}

.monaco-menu .monaco-action-bar.vertical .action-menu-item {
	height: 24px;
}

.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator),
.monaco-menu .monaco-action-bar.vertical .keybinding {
	font-size: inherit;
	padding: 0 2em;
	max-height: 100%;
}

.monaco-menu .monaco-action-bar.vertical .menu-item-check {
	font-size: inherit;
	width: 2em;
}

.monaco-menu .monaco-action-bar.vertical .action-label.separator {
	font-size: inherit;
	margin: 5px 0 !important;
	padding: 0;
	border-radius: 0;
}

.linux .monaco-menu .monaco-action-bar.vertical .action-label.separator,
:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .action-label.separator {
	margin-left: 0;
	margin-right: 0;
}

.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
	font-size: 60%;
	padding: 0 1.8em;
}

.linux .monaco-menu .monaco-action-bar.vertical .submenu-indicator,
:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .submenu-indicator {
	height: 100%;
	mask-size: 10px 10px;
	-webkit-mask-size: 10px 10px;
}

.monaco-menu .action-item {
	cursor: default;
}`;if(i){t+=`
			/* Arrows */
			.monaco-scrollable-element > .scrollbar > .scra {
				cursor: pointer;
				font-size: 11px !important;
			}

			.monaco-scrollable-element > .visible {
				opacity: 1;

				/* Background rule added for IE9 - to allow clicks on dom node */
				background:rgba(0,0,0,0);

				transition: opacity 100ms linear;
			}
			.monaco-scrollable-element > .invisible {
				opacity: 0;
				pointer-events: none;
			}
			.monaco-scrollable-element > .invisible.fade {
				transition: opacity 800ms linear;
			}

			/* Scrollable Content Inset Shadow */
			.monaco-scrollable-element > .shadow {
				position: absolute;
				display: none;
			}
			.monaco-scrollable-element > .shadow.top {
				display: block;
				top: 0;
				left: 3px;
				height: 3px;
				width: 100%;
			}
			.monaco-scrollable-element > .shadow.left {
				display: block;
				top: 3px;
				left: 0;
				height: 100%;
				width: 3px;
			}
			.monaco-scrollable-element > .shadow.top-left-corner {
				display: block;
				top: 0;
				left: 0;
				height: 3px;
				width: 3px;
			}
			/* Fix for https://github.com/microsoft/vscode/issues/103170 */
			.monaco-menu .action-item .monaco-submenu {
				z-index: 1;
			}
		`;let o=a.scrollbarShadow;o&&(t+=`
				.monaco-scrollable-element > .shadow.top {
					box-shadow: ${o} 0 6px 6px -6px inset;
				}

				.monaco-scrollable-element > .shadow.left {
					box-shadow: ${o} 6px 0 6px -6px inset;
				}

				.monaco-scrollable-element > .shadow.top.left {
					box-shadow: ${o} 6px 6px 6px -6px inset;
				}
			`);let n=a.scrollbarSliderBackground;n&&(t+=`
				.monaco-scrollable-element > .scrollbar > .slider {
					background: ${n};
				}
			`);let r=a.scrollbarSliderHoverBackground;r&&(t+=`
				.monaco-scrollable-element > .scrollbar > .slider:hover {
					background: ${r};
				}
			`);let s=a.scrollbarSliderActiveBackground;s&&(t+=`
				.monaco-scrollable-element > .scrollbar > .slider.active {
					background: ${s};
				}
			`)}return t}var APe=_;var kUt=class a extends k{constructor(e,t,o){super();this.container=e;this.options=t;this.menuStyle=o;this._mnemonicsInUse=!1;this.openedViaKeyboard=!1;this.awaitingAltRelease=!1;this.ignoreNextMouseUp=!1;this.updatePending=!1;this.numMenusShown=0;this.overflowLayoutScheduled=void 0;this.menuDisposables=this._register(new O);this.container.setAttribute("role","menubar"),this.isCompact&&this.container.classList.add("compact"),this.menus=[],this.mnemonics=new Map,this._focusState=1,this._onVisibilityChange=this._register(new T),this._onFocusStateChange=this._register(new T),this.createOverflowMenu(),this.menuUpdater=this._register(new Dt(()=>this.update(),200)),this.actionRunner=this.options.actionRunner??this._register(new cs),this._register(this.actionRunner.onWillRun(()=>{this.setUnfocusedState()})),this._register(Ab.getInstance().event(this.onModifierKeyToggled,this)),this._register($(this.container,ne.KEY_DOWN,r=>{let s=new mi(r),l=!0,c=r.key?r.key.toLocaleLowerCase():"",u=et&&!this.isCompact;if(s.equals(15)||u&&s.equals(1026))this.focusPrevious();else if(s.equals(17)||u&&s.equals(2))this.focusNext();else if(s.equals(9)&&this.isFocused&&!this.isOpen)this.setUnfocusedState();else if(!this.isOpen&&!s.ctrlKey&&this.options.enableMnemonics&&this.mnemonicsInUse&&this.mnemonics.has(c)){let p=this.mnemonics.get(c);this.onMenuTriggered(p,!1)}else l=!1;!this.isCompact&&(s.equals(1026)||s.equals(2))&&s.preventDefault(),l&&(s.preventDefault(),s.stopPropagation())}));let n=Me(this.container);this._register($(n,ne.MOUSE_DOWN,()=>{this.isFocused&&this.setUnfocusedState()})),this._register($(this.container,ne.FOCUS_IN,r=>{let s=r;s.relatedTarget&&(this.container.contains(s.relatedTarget)||(this.focusToReturn=s.relatedTarget))})),this._register($(this.container,ne.FOCUS_OUT,r=>{let s=r;s.relatedTarget?s.relatedTarget&&!this.container.contains(s.relatedTarget)&&(this.focusToReturn=void 0,this.setUnfocusedState()):this.setUnfocusedState()})),this._register($(n,ne.KEY_DOWN,r=>{if(!this.options.enableMnemonics||!r.altKey||r.ctrlKey||r.defaultPrevented)return;let s=r.key.toLocaleLowerCase();if(!this.mnemonics.has(s))return;this.mnemonicsInUse=!0,this.updateMnemonicVisibility(!0);let l=this.mnemonics.get(s);this.onMenuTriggered(l,!1)})),this.setUnfocusedState()}static{this.OVERFLOW_INDEX=-1}push(e){Ec(e).forEach(o=>{let n=this.menus.length,r=xUt(o.label),s=PPe.exec(o.label);if(s){let l=s[1]?s[1]:s[3];this.registerMnemonic(this.menus.length,l)}if(this.isCompact)this.menus.push(o);else{let l=APe("div.menubar-menu-button",{role:"menuitem",tabindex:-1,"aria-label":r,"aria-haspopup":!0}),c=APe("div.menubar-menu-title",{role:"none","aria-hidden":!0});l.appendChild(c),this.container.insertBefore(l,this.overflowMenu.buttonElement),this.updateLabels(c,l,o.label),this._register($(l,ne.KEY_UP,u=>{let p=new mi(u),h=!0;(p.equals(18)||p.equals(3))&&!this.isOpen?(this.focusedMenu={index:n},this.openedViaKeyboard=!0,this.focusState=3):h=!1,h&&(p.preventDefault(),p.stopPropagation())})),this._register(ds.addTarget(l)),this._register($(l,Vn.Tap,u=>{this.isOpen&&this.focusedMenu&&this.focusedMenu.holder&&ms(u.initialTarget,this.focusedMenu.holder)||(this.ignoreNextMouseUp=!1,this.onMenuTriggered(n,!0),u.preventDefault(),u.stopPropagation())})),this._register($(l,ne.MOUSE_DOWN,u=>{if(!new Ln(Me(l),u).leftButton){u.preventDefault();return}this.isOpen?this.ignoreNextMouseUp=!1:(this.ignoreNextMouseUp=!0,this.onMenuTriggered(n,!0)),u.preventDefault(),u.stopPropagation()})),this._register($(l,ne.MOUSE_UP,u=>{u.defaultPrevented||(this.ignoreNextMouseUp?this.ignoreNextMouseUp=!1:this.isFocused&&this.onMenuTriggered(n,!0))})),this._register($(l,ne.MOUSE_ENTER,()=>{this.isOpen&&!this.isCurrentMenu(n)?(l.focus(),this.cleanupCustomMenu(),this.showCustomMenu(n,!1)):this.isFocused&&!this.isOpen&&(this.focusedMenu={index:n},l.focus())})),this.menus.push({label:o.label,actions:o.actions,buttonElement:l,titleElement:c})}})}createOverflowMenu(){let e=this.isCompact?d(26,null):d(27,null),t=APe("div.menubar-menu-button",{role:"menuitem",tabindex:this.isCompact?0:-1,"aria-label":e,"aria-haspopup":!0}),o=APe("div.menubar-menu-title.toolbar-toggle-more"+q.asCSSSelector(L.menuBarMore),{role:"none","aria-hidden":!0});t.appendChild(o),this.container.appendChild(t),t.style.visibility="hidden",this._register($(t,ne.KEY_UP,n=>{let r=new mi(n),s=!0,l=[3];this.isCompact?(l.push(10),this.options.compactMode?.horizontal===0?l.push(17):this.options.compactMode?.horizontal===1&&l.push(15)):l.push(18),l.some(c=>r.equals(c))&&!this.isOpen?(this.focusedMenu={index:a.OVERFLOW_INDEX},this.openedViaKeyboard=!0,this.focusState=3):s=!1,s&&(r.preventDefault(),r.stopPropagation())})),this._register(ds.addTarget(t)),this._register($(t,Vn.Tap,n=>{this.isOpen&&this.focusedMenu&&this.focusedMenu.holder&&ms(n.initialTarget,this.focusedMenu.holder)||(this.ignoreNextMouseUp=!1,this.onMenuTriggered(a.OVERFLOW_INDEX,!0),n.preventDefault(),n.stopPropagation())})),this._register($(t,ne.MOUSE_DOWN,n=>{if(!new Ln(Me(t),n).leftButton){n.preventDefault();return}this.isOpen?this.ignoreNextMouseUp=!1:(this.ignoreNextMouseUp=!0,this.onMenuTriggered(a.OVERFLOW_INDEX,!0)),n.preventDefault(),n.stopPropagation()})),this._register($(t,ne.MOUSE_UP,n=>{n.defaultPrevented||(this.ignoreNextMouseUp?this.ignoreNextMouseUp=!1:this.isFocused&&this.onMenuTriggered(a.OVERFLOW_INDEX,!0))})),this._register($(t,ne.MOUSE_ENTER,()=>{this.isOpen&&!this.isCurrentMenu(a.OVERFLOW_INDEX)?(this.overflowMenu.buttonElement.focus(),this.cleanupCustomMenu(),this.showCustomMenu(a.OVERFLOW_INDEX,!1)):this.isFocused&&!this.isOpen&&(this.focusedMenu={index:a.OVERFLOW_INDEX},t.focus())})),this.overflowMenu={buttonElement:t,titleElement:o,label:"More",actions:[]}}updateMenu(e){let t=this.menus.filter(o=>o.label===e.label);t&&t.length&&(t[0].actions=e.actions)}dispose(){super.dispose(),this.menus.forEach(e=>{e.titleElement?.remove(),e.buttonElement?.remove()}),this.overflowMenu.titleElement.remove(),this.overflowMenu.buttonElement.remove(),je(this.overflowLayoutScheduled),this.overflowLayoutScheduled=void 0}blur(){this.setUnfocusedState()}getWidth(){if(!this.isCompact&&this.menus){let e=this.menus[0].buttonElement.getBoundingClientRect().left;return(this.hasOverflow?this.overflowMenu.buttonElement.getBoundingClientRect().right:this.menus[this.menus.length-1].buttonElement.getBoundingClientRect().right)-e}return 0}getHeight(){return this.container.clientHeight}toggleFocus(){!this.isFocused&&this.options.visibility!=="hidden"?(this.mnemonicsInUse=!0,this.focusedMenu={index:this.numMenusShown>0?0:a.OVERFLOW_INDEX},this.focusState=2):this.isOpen||this.setUnfocusedState()}updateOverflowAction(){if(!this.menus||!this.menus.length)return;let e="overflow-menu-only";this.container.classList.toggle(e,!1);let t=this.container.offsetWidth,o=0,n=this.isCompact,r=this.numMenusShown;this.numMenusShown=0;let s=this.menus.filter(l=>l.buttonElement!==void 0&&l.titleElement!==void 0);for(let l of s){if(!n){let c=l.buttonElement.offsetWidth;o+c>t?n=!0:(o+=c,this.numMenusShown++,this.numMenusShown>r&&(l.buttonElement.style.visibility="visible"))}n&&(l.buttonElement.style.visibility="hidden")}if(this.numMenusShown-1<=s.length/4){for(let l of s)l.buttonElement.style.visibility="hidden";n=!0,this.numMenusShown=0,o=0}if(this.isCompact){this.overflowMenu.actions=[];for(let c=this.numMenusShown;c<this.menus.length;c++)this.overflowMenu.actions.push(new sa(`menubar.submenu.${this.menus[c].label}`,this.menus[c].label,this.menus[c].actions||[]));let l=this.options.getCompactMenuActions?.();l&&l.length&&(this.overflowMenu.actions.push(new oi),this.overflowMenu.actions.push(...l)),this.overflowMenu.buttonElement.style.visibility="visible"}else if(n){for(;o+this.overflowMenu.buttonElement.offsetWidth>t&&this.numMenusShown>0;){this.numMenusShown--;let l=s[this.numMenusShown].buttonElement.offsetWidth;s[this.numMenusShown].buttonElement.style.visibility="hidden",o-=l}this.overflowMenu.actions=[];for(let l=this.numMenusShown;l<s.length;l++)this.overflowMenu.actions.push(new sa(`menubar.submenu.${s[l].label}`,s[l].label,s[l].actions||[]));this.overflowMenu.buttonElement.nextElementSibling!==s[this.numMenusShown].buttonElement&&(this.overflowMenu.buttonElement.remove(),this.container.insertBefore(this.overflowMenu.buttonElement,s[this.numMenusShown].buttonElement)),this.overflowMenu.buttonElement.style.visibility="visible"}else this.overflowMenu.buttonElement.remove(),this.container.appendChild(this.overflowMenu.buttonElement),this.overflowMenu.buttonElement.style.visibility="hidden";this.container.classList.toggle(e,this.numMenusShown===0)}updateLabels(e,t,o){let n=xUt(o);if(this.options.enableMnemonics){let s=Cr(o);Vhe.lastIndex=0;let l=Vhe.exec(s);for(;l&&l[1];)l=Vhe.exec(s);let c=u=>u.replace(/&amp;&amp;/g,"&amp;");l?(e.textContent="",e.append(ax(c(s.substr(0,l.index))," "),APe("mnemonic",{"aria-hidden":"true"},l[3]),Bh(c(s.substr(l.index+l[0].length))," "))):e.textContent=c(s).trim()}else e.textContent=n.replace(/&&/g,"&");let r=PPe.exec(o);if(r){let s=r[1]?r[1]:r[3];this.options.enableMnemonics?t.setAttribute("aria-keyshortcuts","Alt+"+s.toLocaleLowerCase()):t.removeAttribute("aria-keyshortcuts")}}update(e){if(e&&(this.options=e),this.isFocused){this.updatePending=!0;return}this.menus.forEach(t=>{!t.buttonElement||!t.titleElement||this.updateLabels(t.titleElement,t.buttonElement,t.label)}),this.overflowLayoutScheduled||(this.overflowLayoutScheduled=kr(Me(this.container),()=>{this.updateOverflowAction(),this.overflowLayoutScheduled=void 0})),this.setUnfocusedState()}registerMnemonic(e,t){this.mnemonics.set(t.toLocaleLowerCase(),e)}hideMenubar(){this.container.style.display!=="none"&&(this.container.style.display="none",this._onVisibilityChange.fire(!1))}showMenubar(){this.container.style.display!=="flex"&&(this.container.style.display="flex",this._onVisibilityChange.fire(!0),this.updateOverflowAction())}get focusState(){return this._focusState}set focusState(e){if(this._focusState>=2&&e<2&&this.updatePending&&(this.menuUpdater.schedule(),this.updatePending=!1),e===this._focusState)return;let t=this.isVisible,o=this.isOpen,n=this.isFocused;switch(this._focusState=e,e){case 0:t&&this.hideMenubar(),o&&this.cleanupCustomMenu(),n&&(this.focusedMenu=void 0,this.focusToReturn&&(this.focusToReturn.focus(),this.focusToReturn=void 0));break;case 1:t||this.showMenubar(),o&&this.cleanupCustomMenu(),n&&(this.focusedMenu&&(this.focusedMenu.index===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.blur():this.menus[this.focusedMenu.index].buttonElement?.blur()),this.focusedMenu=void 0,this.focusToReturn&&(this.focusToReturn.focus(),this.focusToReturn=void 0));break;case 2:t||this.showMenubar(),o&&this.cleanupCustomMenu(),this.focusedMenu&&(this.focusedMenu.index===0&&this.numMenusShown===0&&(this.focusedMenu.index=a.OVERFLOW_INDEX),this.focusedMenu.index===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.focus():this.menus[this.focusedMenu.index].buttonElement?.focus());break;case 3:t||this.showMenubar(),this.focusedMenu&&(this.cleanupCustomMenu(),this.showCustomMenu(this.focusedMenu.index,this.openedViaKeyboard));break}this._focusState=e,this._onFocusStateChange.fire(this.focusState>=2)}get isVisible(){return this.focusState>=1}get isFocused(){return this.focusState>=2}get isOpen(){return this.focusState>=3}get hasOverflow(){return this.isCompact||this.numMenusShown<this.menus.length}get isCompact(){return this.options.compactMode!==void 0}setUnfocusedState(){this.options.visibility==="toggle"||this.options.visibility==="hidden"?this.focusState=0:this.options.visibility==="classic"&&rx(ut)?this.focusState=0:this.focusState=1,this.ignoreNextMouseUp=!1,this.mnemonicsInUse=!1,this.updateMnemonicVisibility(!1)}focusPrevious(){if(!this.focusedMenu||this.numMenusShown===0)return;let e=(this.focusedMenu.index-1+this.numMenusShown)%this.numMenusShown;this.focusedMenu.index===a.OVERFLOW_INDEX?e=this.numMenusShown-1:this.focusedMenu.index===0&&this.hasOverflow&&(e=a.OVERFLOW_INDEX),e!==this.focusedMenu.index&&(this.isOpen?(this.cleanupCustomMenu(),this.showCustomMenu(e)):this.isFocused&&(this.focusedMenu.index=e,e===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.focus():this.menus[e].buttonElement?.focus()))}focusNext(){if(!this.focusedMenu||this.numMenusShown===0)return;let e=(this.focusedMenu.index+1)%this.numMenusShown;this.focusedMenu.index===a.OVERFLOW_INDEX?e=0:this.focusedMenu.index===this.numMenusShown-1&&(e=a.OVERFLOW_INDEX),e!==this.focusedMenu.index&&(this.isOpen?(this.cleanupCustomMenu(),this.showCustomMenu(e)):this.isFocused&&(this.focusedMenu.index=e,e===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.focus():this.menus[e].buttonElement?.focus()))}updateMnemonicVisibility(e){this.menus&&this.menus.forEach(t=>{if(t.titleElement&&t.titleElement.children.length){let o=t.titleElement.children.item(0);o&&(o.style.textDecoration=this.options.alwaysOnMnemonics||e?"underline":"")}})}get mnemonicsInUse(){return this._mnemonicsInUse}set mnemonicsInUse(e){this._mnemonicsInUse=e}get shouldAltKeyFocus(){return et?!1:!this.options.disableAltFocus||this.options.visibility==="toggle"}get onVisibilityChange(){return this._onVisibilityChange.event}get onFocusStateChange(){return this._onFocusStateChange.event}onMenuTriggered(e,t){this.isOpen?this.isCurrentMenu(e)?this.setUnfocusedState():(this.cleanupCustomMenu(),this.showCustomMenu(e,this.openedViaKeyboard)):(this.focusedMenu={index:e},this.openedViaKeyboard=!t,this.focusState=3)}onModifierKeyToggled(e){let t=!e.altKey&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey;this.options.visibility!=="hidden"&&(e.event&&this.shouldAltKeyFocus&&DS.toEnum(e.event.code)===159&&e.event.preventDefault(),this.isFocused&&e.lastKeyPressed==="alt"&&e.altKey&&(this.setUnfocusedState(),this.mnemonicsInUse=!1,this.awaitingAltRelease=!0),t&&e.lastKeyPressed==="alt"&&e.lastKeyReleased==="alt"&&(this.awaitingAltRelease||(!this.isFocused&&this.shouldAltKeyFocus?(this.mnemonicsInUse=!0,this.focusedMenu={index:this.numMenusShown>0?0:a.OVERFLOW_INDEX},this.focusState=2):this.isOpen||this.setUnfocusedState())),!e.altKey&&e.lastKeyReleased==="alt"&&(this.awaitingAltRelease=!1),this.options.enableMnemonics&&this.menus&&!this.isOpen&&this.updateMnemonicVisibility(!this.awaitingAltRelease&&e.altKey||this.mnemonicsInUse))}isCurrentMenu(e){return this.focusedMenu?this.focusedMenu.index===e:!1}cleanupCustomMenu(){this.focusedMenu&&(this.focusedMenu.index===a.OVERFLOW_INDEX?this.overflowMenu.buttonElement.focus():this.menus[this.focusedMenu.index].buttonElement?.focus(),this.focusedMenu.holder&&(this.focusedMenu.holder.parentElement?.classList.remove("open"),this.focusedMenu.holder.remove()),this.focusedMenu.widget?.dispose(),this.focusedMenu={index:this.focusedMenu.index}),this.menuDisposables.clear()}showCustomMenu(e,t=!0){let o=e>=this.numMenusShown?a.OVERFLOW_INDEX:e,n=o===a.OVERFLOW_INDEX?this.overflowMenu:this.menus[o];if(!n.actions||!n.buttonElement||!n.titleElement)return;let r=APe("div.menubar-menu-items-holder",{title:""});n.buttonElement.classList.add("open");let s=n.titleElement.getBoundingClientRect(),l=CY(n.titleElement);if(this.options.compactMode?.horizontal===0)r.style.left=`${s.left+this.container.clientWidth}px`;else if(this.options.compactMode?.horizontal===1){let p=Me(this.container).innerWidth;r.style.right=`${p-s.left}px`,r.style.left="auto"}else r.style.left=`${s.left*l}px`;this.options.compactMode?.vertical===0?r.style.top=`${s.top-this.menus.length*30+this.container.clientHeight}px`:this.options.compactMode?.vertical===1?r.style.top=`${s.top}px`:r.style.top=`${s.bottom*l}px`,n.buttonElement.appendChild(r);let c={getKeyBinding:this.options.getKeybinding,actionRunner:this.actionRunner,enableMnemonics:this.options.alwaysOnMnemonics||this.mnemonicsInUse&&this.options.enableMnemonics,ariaLabel:n.buttonElement.getAttribute("aria-label")??void 0,expandDirection:this.isCompact?this.options.compactMode:{horizontal:0,vertical:1},useEventAsContext:!0},u=this.menuDisposables.add(new j8(r,n.actions,c,this.menuStyle));this.menuDisposables.add(u.onDidCancel(()=>{this.focusState=2})),o!==e?u.trigger(e-this.numMenusShown):u.focus(t),this.focusedMenu={index:o,holder:r,widget:u}}};var ait=class a extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.menuService=e;this.workspacesService=t;this.contextKeyService=o;this.keybindingService=n;this.configurationService=r;this.labelService=s;this.updateService=l;this.storageService=c;this.notificationService=u;this.preferencesService=p;this.environmentService=h;this.accessibilityService=g;this.hostService=f;this.commandService=v;this.keys=["window.menuBarVisibility","window.enableMenuBarMnemonics","window.customMenuBarAltFocus","workbench.sideBar.location","window.nativeTabs"];this.menus={};this.topLevelTitles={};this.recentlyOpened={files:[],workspaces:[]};this.mainMenu=this._register(this.menuService.createMenu(R.MenubarMainMenu,this.contextKeyService)),this.mainMenuDisposables=this._register(new O),this.setupMainMenu(),this.menuUpdater=this._register(new Dt(()=>this.doUpdateMenubar(!1),200)),this.notifyUserOfCustomMenubarAccessibility()}static{this.MAX_MENU_RECENT_ENTRIES=10}registerListeners(){this._register(this.hostService.onDidChangeFocus(e=>this.onDidChangeWindowFocus(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e))),this._register(this.updateService.onStateChange(()=>this.onUpdateStateChange())),this._register(this.workspacesService.onDidChangeRecentlyOpened(()=>{this.onDidChangeRecentlyOpened()})),this._register(this.keybindingService.onDidUpdateKeybindings(()=>this.updateMenubar())),this._register(this.labelService.onDidChangeFormatters(()=>{this.onDidChangeRecentlyOpened()})),this._register(this.mainMenu.onDidChange(()=>{this.setupMainMenu(),this.doUpdateMenubar(!0)}))}setupMainMenu(){this.mainMenuDisposables.clear(),this.menus={},this.topLevelTitles={};let[,e]=this.mainMenu.getActions()[0];for(let t of e)t instanceof id&&typeof t.item.title!="string"&&(this.menus[t.item.title.original]=this.mainMenuDisposables.add(this.menuService.createMenu(t.item.submenu,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.topLevelTitles[t.item.title.original]=t.item.title.mnemonicTitle??t.item.title.value)}updateMenubar(){this.menuUpdater.schedule()}calculateActionLabel(e){let t=e.label;switch(e.id){default:break}return t}onUpdateStateChange(){this.updateMenubar()}onUpdateKeybindings(){this.updateMenubar()}getOpenRecentActions(){if(!this.recentlyOpened)return[];let{workspaces:e,files:t}=this.recentlyOpened,o=[];if(e.length>0){for(let n=0;n<a.MAX_MENU_RECENT_ENTRIES&&n<e.length;n++)o.push(this.createOpenRecentMenuAction(e[n]));o.push(new oi)}if(t.length>0){for(let n=0;n<a.MAX_MENU_RECENT_ENTRIES&&n<t.length;n++)o.push(this.createOpenRecentMenuAction(t[n]));o.push(new oi)}return o}onDidChangeWindowFocus(e){e&&this.onDidChangeRecentlyOpened()}onConfigurationUpdated(e){this.keys.some(t=>e.affectsConfiguration(t))&&this.updateMenubar(),e.affectsConfiguration("editor.accessibilitySupport")&&this.notifyUserOfCustomMenubarAccessibility(),e.affectsConfiguration("window.menuBarVisibility")&&this.onDidChangeRecentlyOpened()}get menubarHidden(){return et&&Qr?!1:sM(this.configurationService)==="hidden"}onDidChangeRecentlyOpened(){this.menubarHidden||this.workspacesService.getRecentlyOpened().then(e=>{this.recentlyOpened=e,this.updateMenubar()})}createOpenRecentMenuAction(e){let t,o,n,r,s=e.remoteAuthority;YM(e)?(o=e.folderUri,t=e.label||this.labelService.getWorkspaceLabel(o,{verbose:2}),n="openRecentFolder",r={folderUri:o}):TN(e)?(o=e.workspace.configPath,t=e.label||this.labelService.getWorkspaceLabel(e.workspace,{verbose:2}),n="openRecentWorkspace",r={workspaceUri:o}):(o=e.fileUri,t=e.label||this.labelService.getUriLabel(o,{appendWorkspaceSuffix:!0}),n="openRecentFile",r={fileUri:o});let l=li({id:n,label:j3e(t),run:c=>{let u=c&&(!et&&(c.ctrlKey||c.shiftKey)||et&&(c.metaKey||c.altKey));return this.hostService.openWindow([r],{forceNewWindow:!!u,remoteAuthority:s||null})}});return Object.assign(l,{uri:o,remoteAuthority:s})}notifyUserOfCustomMenubarAccessibility(){if(Ft||et)return;let e=this.storageService.getBoolean("menubar/accessibleMenubarNotified",-1,!1),t=!XF(this.configurationService);if(e||t||!this.accessibilityService.isScreenReaderOptimized())return;let o=d(5127,null);this.notificationService.prompt(ft.Info,o,[{label:d(5124,null),run:()=>this.preferencesService.openUserSettings({query:"window.menuStyle"})}]),this.storageService.store("menubar/accessibleMenubarNotified",!0,-1,0)}},EUt;function hon(){return EUt||(EUt=new T,W(class extends z{constructor(){super({id:"workbench.actions.menubar.focus",title:P(5123,"Focus Application Menu"),keybinding:{primary:580,weight:200,when:Mu},f1:!0})}async run(){EUt?.fire()}})),EUt}var qte=class extends ait{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,t,o,n,r,s,l,c,u,p,h,g,v,b);this.telemetryService=f;this.alwaysOnMnemonics=!1;this.focusInsideMenubar=!1;this.pendingFirstTimeUpdate=!1;this.visible=!0;this.webNavigationMenu=this._register(this.menuService.createMenu(R.MenubarHomeMenu,this.contextKeyService));this.reinstallDisposables=this._register(new O);this.updateActionsDisposables=this._register(new O);this._onVisibilityChange=this._register(new T),this._onFocusStateChange=this._register(new T),this.actionRunner=this._register(new cs),this._register(this.actionRunner.onDidRun(S=>{this.telemetryService.publicLog2("workbenchActionExecuted",{id:S.action.id,from:"menu"})})),this.workspacesService.getRecentlyOpened().then(S=>{this.recentlyOpened=S}),this.registerListeners()}doUpdateMenubar(e){this.focusInsideMenubar||this.setupCustomMenubar(e),e&&(this.pendingFirstTimeUpdate=!0)}getUpdateAction(){switch(this.updateService.state.type){case"idle":return li({id:"update.check",label:d(5119,null),enabled:!0,run:()=>this.updateService.checkForUpdates(!0)});case"checking for updates":return li({id:"update.checking",label:d(5120,null),enabled:!1,run:()=>{}});case"available for download":return li({id:"update.downloadNow",label:d(5121,null),enabled:!0,run:()=>this.updateService.downloadUpdate(!0)});case"downloading":case"overwriting":return li({id:"update.downloading",label:d(5122,null),enabled:!1,run:()=>{}});case"downloaded":return et?null:li({id:"update.install",label:d(5126,null),enabled:!0,run:()=>this.updateService.applyUpdate()});case"updating":return li({id:"update.updating",label:d(5125,null),enabled:!1,run:()=>{}});case"ready":return li({id:"update.restart",label:d(5128,null),enabled:!0,run:()=>this.updateService.quitAndInstall()});default:return null}}get currentMenubarVisibility(){return sM(this.configurationService)}get currentDisableMenuBarAltFocus(){let e=this.configurationService.getValue("window.customMenuBarAltFocus"),t=!1;return typeof e=="boolean"&&(t=!e),t}insertActionsBefore(e,t){switch(e.id){case yW.ID:t.push(...this.getOpenRecentActions());break;case"workbench.action.showAboutDialog":if(!et&&!Ft){let o=this.getUpdateAction();o&&(o.label=M5(o.label),t.push(o),t.push(new oi))}break;default:break}}get currentEnableMenuBarMnemonics(){let e=this.configurationService.getValue("window.enableMenuBarMnemonics");return typeof e!="boolean"&&(e=!0),e&&(!Ft||rx(ut))}get currentCompactMenuMode(){if(this.currentMenubarVisibility!=="compact")return;let t=this.configurationService.getValue("workbench.sideBar.location")==="right"?1:0,n=this.configurationService.getValue("workbench.activityBar.location")==="bottom"?0:1;return{horizontal:t,vertical:n}}onDidVisibilityChange(e){this.visible=e,this.onDidChangeRecentlyOpened(),this._onVisibilityChange.fire(e)}toActionsArray(e){return Lu(e.getActions({shouldForwardArgs:!0}))}setupCustomMenubar(e){if(!this.container)return;e?(this.menubar&&this.reinstallDisposables.clear(),this.menubar=this.reinstallDisposables.add(new kUt(this.container,this.getMenuBarOptions(),_kt)),this.accessibilityService.alwaysUnderlineAccessKeys().then(o=>{this.alwaysOnMnemonics=o,this.menubar?.update(this.getMenuBarOptions())}),this.reinstallDisposables.add(this.menubar.onFocusStateChange(o=>{this._onFocusStateChange.fire(o),o||(this.pendingFirstTimeUpdate?(this.setupCustomMenubar(!0),this.pendingFirstTimeUpdate=!1):this.updateMenubar(),this.focusInsideMenubar=!1)})),this.reinstallDisposables.add(this.menubar.onVisibilityChange(o=>this.onDidVisibilityChange(o))),this.reinstallDisposables.add($(this.container,ne.FOCUS_IN,()=>{this.focusInsideMenubar=!0})),this.reinstallDisposables.add($(this.container,ne.FOCUS_OUT,()=>{this.focusInsideMenubar=!1})),this.menubar.isVisible&&this.onDidVisibilityChange(!0)):this.menubar?.update(this.getMenuBarOptions());let t=(o,n,r,s)=>{n.splice(0);for(let l of o)if(this.insertActionsBefore(l,n),l instanceof oi)n.push(l);else if(l instanceof id||l instanceof Do){let c=typeof l.item.title=="string"?l.item.title:l.item.title.mnemonicTitle??l.item.title.value;if(l instanceof id){let u=[];t(l.actions,u,r,s),u.length>0&&n.push(new sa(l.id,M5(c),u))}else{Uke(l.item.toggled)&&(c=l.item.toggled.mnemonicTitle??l.item.toggled.title??c);let u=s.add(new it(l.id,M5(c),l.class,l.enabled,()=>this.commandService.executeCommand(l.id)));u.tooltip=l.tooltip,u.checked=l.checked,n.push(u)}}if(r==="File"&&this.currentCompactMenuMode===void 0){let l=this.getWebNavigationActions();l.length&&n.push(...l)}};for(let o of Object.keys(this.topLevelTitles)){let n=this.menus[o];if(e&&n){let s=this.reinstallDisposables.add(new O);if(this.reinstallDisposables.add(n.onDidChange(()=>{if(!this.focusInsideMenubar){let l=[];s.clear(),t(this.toActionsArray(n),l,o,s),this.menubar?.updateMenu({actions:l,label:M5(this.topLevelTitles[o])})}})),n===this.menus.File){let l=this.reinstallDisposables.add(new O);this.reinstallDisposables.add(this.webNavigationMenu.onDidChange(()=>{if(!this.focusInsideMenubar){let c=[];l.clear(),t(this.toActionsArray(n),c,o,l),this.menubar?.updateMenu({actions:c,label:M5(this.topLevelTitles[o])})}}))}}let r=[];n&&(this.updateActionsDisposables.clear(),t(this.toActionsArray(n),r,o,this.updateActionsDisposables)),this.menubar&&(e?this.menubar.push({actions:r,label:M5(this.topLevelTitles[o])}):this.menubar.updateMenu({actions:r,label:M5(this.topLevelTitles[o])}))}}getWebNavigationActions(){if(!Ft)return[];let e=[];for(let t of this.webNavigationMenu.getActions()){let[,o]=t;for(let n of o)if(n instanceof Do){let r=typeof n.item.title=="string"?n.item.title:n.item.title.mnemonicTitle??n.item.title.value;e.push(li({id:n.id,label:M5(r),class:n.class,enabled:n.enabled,run:async s=>{this.commandService.executeCommand(n.id,s)}}))}e.push(new oi)}return e.length&&e.pop(),e}getMenuBarOptions(){return{enableMnemonics:this.currentEnableMenuBarMnemonics,disableAltFocus:this.currentDisableMenuBarAltFocus,visibility:this.currentMenubarVisibility,actionRunner:this.actionRunner,getKeybinding:e=>this.keybindingService.lookupKeybinding(e.id),alwaysOnMnemonics:this.alwaysOnMnemonics,compactMode:this.currentCompactMenuMode,getCompactMenuActions:()=>Ft?this.getWebNavigationActions():[]}}onDidChangeWindowFocus(e){this.visible&&(super.onDidChangeWindowFocus(e),this.container&&(e?this.container.classList.remove("inactive"):(this.container.classList.add("inactive"),this.menubar?.blur())))}onUpdateStateChange(){this.visible&&super.onUpdateStateChange()}onDidChangeRecentlyOpened(){this.visible&&super.onDidChangeRecentlyOpened()}onUpdateKeybindings(){this.visible&&super.onUpdateKeybindings()}registerListeners(){super.registerListeners(),this._register($(ut,ne.RESIZE,()=>{this.menubar&&!(Tc&&of.pointerEvents)&&this.menubar.blur()})),Ft&&(this._register(ZO(e=>{e===ut.vscodeWindowId&&this.updateMenubar()})),this._register(this.webNavigationMenu.onDidChange(()=>this.updateMenubar())),this._register(hon().event(()=>this.menubar?.toggleFocus())))}get onVisibilityChange(){return this._onVisibilityChange.event}get onFocusStateChange(){return this._onFocusStateChange.event}getMenubarItemsDimensions(){return this.menubar?new di(this.menubar.getWidth(),this.menubar.getHeight()):new di(0,0)}create(e){return this.container=e,this.container&&this.doUpdateMenubar(!0),this.container}layout(e){this.menubar?.update(this.getMenuBarOptions())}toggleFocus(){this.menubar?.toggleFocus()}};qte=I([m(0,Yt),m(1,bm),m(2,X),m(3,Le),m(4,B),m(5,nt),m(6,Lp),m(7,de),m(8,Ne),m(9,Qo),m(10,Mt),m(11,Ai),m(12,_e),m(13,ti),m(14,fe)],qte);var wU="workbench.actions.manage",CU="workbench.actions.accounts";var Q8=Oe("settings-view-bar-icon",L.settingsGear,d(19576,null)),Zfo=[Q8,L.vm,L.server,L.recordKeys,L.deviceMobile,L.watch,L.vr,L.piano,L.ruby,L.code,L.coffee,L.snake,L.project,L.window,L.library,L.extensions,L.terminal,L.terminalDebian,L.terminalLinux,L.terminalUbuntu,L.beaker,L.package,L.cloud,L.book,L.globe,L.database,L.notebook,L.robot,L.game,L.chip,L.music,L.remoteExplorer,L.github,L.azure,L.vscode,L.copilot,L.gift,L.send,L.bookmark,L.briefcase,L.megaphone,L.comment,L.telescope,L.creditCard,L.map,L.deviceCameraVideo,L.unmute,L.law,L.graphLine,L.heart,L.home,L.inbox,L.mortarBoard,L.rocket,L.magnet,L.lock,L.milestone,L.tag,L.pulse,L.radioTower,L.smiley,L.zap,L.squirrel,L.symbolColor,L.mail,L.key,L.pieChart,L.organization,L.preview,L.wand,L.starEmpty,L.lightbulb,L.symbolRuler,L.dashboard,L.calendar,L.shield,L.verified,L.debug,L.flame,L.compass,L.paintcan,L.archive,L.mic,L.jersey];var xU=class extends k{constructor(e,t,o,n,r,s,l){super();this.contextMenuActionsProvider=e;this.colors=t;this.activityHoverOptions=o;this.instantiationService=r;this.storageService=s;this.extensionService=l;this.globalActivityAction=this._register(new it(wU));this.accountAction=this._register(new it(CU));this.element=_("div");let c=()=>({anchorAlignment:n.getValue("workbench.sideBar.location")==="left"?1:0,anchorAxisAlignment:1});this.globalActivityActionBar=this._register(new oo(this.element,{actionViewItemProvider:(u,p)=>{if(u.id===wU)return this.instantiationService.createInstance(OPe,this.contextMenuActionsProvider,{...p,colors:this.colors,hoverOptions:this.activityHoverOptions},c);if(u.id===CU)return this.instantiationService.createInstance(kU,this.contextMenuActionsProvider,{...p,colors:this.colors,hoverOptions:this.activityHoverOptions},c,h=>{h.unshift(li({id:"hideAccounts",label:d(4966,null),run:()=>TUt(s,!1)}),new oi)});throw new Error(`No view item for action '${u.id}'`)},orientation:1,ariaLabel:d(4968,null),preventLoopNavigation:!0})),this.accountsVisibilityPreference&&this.globalActivityActionBar.push(this.accountAction,{index:xU.ACCOUNTS_ACTION_INDEX}),this.globalActivityActionBar.push(this.globalActivityAction),this.registerListeners()}static{this.ACCOUNTS_ACTION_INDEX=0}static{this.ACCOUNTS_ICON=Oe("accounts-view-bar-icon",L.account,d(4964,null))}registerListeners(){this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this._store.isDisposed||this._register(this.storageService.onDidChangeValue(0,kU.ACCOUNTS_VISIBILITY_PREFERENCE_KEY,this._store)(()=>this.toggleAccountsActivity()))})}create(e){e.appendChild(this.element)}focus(){this.globalActivityActionBar.focus(!0)}size(){return this.globalActivityActionBar.viewItems.length}getContextMenuActions(){return[li({id:"toggleAccountsVisibility",label:d(4963,null),checked:this.accountsVisibilityPreference,run:()=>this.accountsVisibilityPreference=!this.accountsVisibilityPreference})]}toggleAccountsActivity(){this.globalActivityActionBar.length()===2&&this.accountsVisibilityPreference||(this.globalActivityActionBar.length()===2?this.globalActivityActionBar.pull(xU.ACCOUNTS_ACTION_INDEX):this.globalActivityActionBar.push(this.accountAction,{index:xU.ACCOUNTS_ACTION_INDEX}))}get accountsVisibilityPreference(){return lit(this.storageService)}set accountsVisibilityPreference(e){TUt(this.storageService,e)}};xU=I([m(3,B),m(4,F),m(5,de),m(6,lt)],xU);var NPe=class extends pte{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(t,{draggable:!1,icon:!0,hasPopup:!0,...o},()=>!0,s,l,h,g);this.menuId=e;this.contextMenuActionsProvider=n;this.contextMenuAlignmentOptions=r;this.menuService=c;this.contextMenuService=u;this.contextKeyService=p;this.activityService=f;this.updateItemActivity(),this._register(this.activityService.onDidChangeActivity(v=>{We(v)&&v===this.compositeBarActionItem.id&&this.updateItemActivity()}))}updateItemActivity(){this.action.activities=this.activityService.getActivity(this.compositeBarActionItem.id)}render(e){super.render(e),this._register($(this.container,ne.MOUSE_DOWN,async t=>{Kt.stop(t,!0),t?.button!==2&&this.run()})),this._register($(this.container,ne.CONTEXT_MENU,async t=>{t.stopPropagation();let o=new O,n=await this.resolveContextMenuActions(o),r=new Ln(Me(this.container),t);this.contextMenuService.showContextMenu({getAnchor:()=>r,getActions:()=>n,onHide:()=>o.dispose()})})),this._register($(this.container,ne.KEY_UP,t=>{let o=new mi(t);(o.equals(3)||o.equals(10))&&(Kt.stop(t,!0),this.run())})),this._register($(this.container,Vn.Tap,t=>{Kt.stop(t,!0),this.run()}))}async resolveContextMenuActions(e){return this.contextMenuActionsProvider()}async run(){let e=new O,t=e.add(this.menuService.createMenu(this.menuId,this.contextKeyService)),o=await this.resolveMainMenuActions(t,e),{anchorAlignment:n,anchorAxisAlignment:r}=this.contextMenuAlignmentOptions()??{anchorAlignment:void 0,anchorAxisAlignment:void 0};this.contextMenuService.showContextMenu({getAnchor:()=>this.label,anchorAlignment:n,anchorAxisAlignment:r,getActions:()=>o,onHide:()=>e.dispose(),menuActionOptions:{renderShortTitle:!0}})}async resolveMainMenuActions(e,t){return xl(e.getActions({renderShortTitle:!0})).secondary}};NPe=I([m(5,Pe),m(6,ot),m(7,Yt),m(8,Xe),m(9,X),m(10,B),m(11,Le),m(12,Al)],NPe);var kU=class extends NPe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E){let M=x.createInstance(AG,{id:CU,name:d(4963,null),classNames:q.asClassNameArray(xU.ACCOUNTS_ICON)});super(R.AccountsContext,M,t,e,o,r,l,u,c,p,v,b,w);this.fillContextMenuActions=n;this.lifecycleService=s;this.authenticationService=h;this.productService=f;this.secretStorageService=S;this.logService=y;this.commandService=E;this.groupedAccounts=new Map;this.problematicProviders=new Set;this.initialized=!1;this.sessionFromEmbedder=new uo(()=>ite(this.secretStorageService,this.productService));this._register(M),this.registerListeners(),this.initialize()}static{this.ACCOUNTS_VISIBILITY_PREFERENCE_KEY="workbench.activity.showAccounts"}registerListeners(){this._register(this.authenticationService.onDidRegisterAuthenticationProvider(async e=>{await this.addAccountsFromProvider(e.id)})),this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(e=>{this.groupedAccounts.delete(e.id),this.problematicProviders.delete(e.id)})),this._register(this.authenticationService.onDidChangeSessions(async e=>{if(e.event.removed)for(let t of e.event.removed)this.removeAccount(e.providerId,t.account);for(let t of[...e.event.changed??[],...e.event.added??[]])try{await this.addOrUpdateAccount(e.providerId,t.account)}catch(o){this.logService.error(o)}}))}async initialize(){if(await this.lifecycleService.when(3),this._store.isDisposed)return;let e=this._register(Ff(Me(this.element),async()=>{await this.doInitialize(),e.dispose()}))}async doInitialize(){let e=this.authenticationService.getProviderIds(),t=await Promise.allSettled(e.map(o=>this.addAccountsFromProvider(o)));for(let o of t)o.status==="rejected"&&this.logService.error(o.reason);this.initialized=!0}async resolveMainMenuActions(e,t){await super.resolveMainMenuActions(e,t);let o=this.authenticationService.getProviderIds().filter(c=>!c.startsWith(iN)),n=e.getActions(),r=[],s=o.filter(c=>!this.authenticationService.isDynamicAuthenticationProvider(c)),l=o.filter(c=>this.authenticationService.isDynamicAuthenticationProvider(c));if(this.initialized){for(let c of s){let u=this.authenticationService.getProvider(c),p=this.groupedAccounts.get(c);if(!p){if(this.problematicProviders.has(c)){let g=t.add(new it("providerUnavailable",d(4965,null,u.label),void 0,!1));r.push(g);try{await this.addAccountsFromProvider(c)}catch(f){this.logService.error(f)}}continue}let h=!!u.authorizationServers?.length;for(let g of p){let v=[li({id:`configureSessions${g.label}`,label:d(4971,null),enabled:!0,run:()=>this.commandService.executeCommand("_manageTrustedExtensionsForAccount",{providerId:c,accountLabel:g.label})})];if(h){let S=li({id:`configureSessions${g.label}`,label:d(4972,null),enabled:!0,run:()=>this.commandService.executeCommand("_manageTrustedMCPServersForAccount",{providerId:c,accountLabel:g.label})});v.push(S)}g.canSignOut&&v.push(li({id:"signOut",label:d(4973,null),enabled:!0,run:()=>this.commandService.executeCommand("_signOutOfAccount",{providerId:c,accountLabel:g.label})}));let b=new sa("activitybar.submenu",`${g.label} (${u.label})`,v);r.push(b)}}l.length&&s.length&&r.push(new oi);for(let c of l){let u=this.authenticationService.getProvider(c),p=this.groupedAccounts.get(c),h=li({id:"manageDynamicAuthProviders",label:d(4970,null),enabled:!0,run:()=>this.commandService.executeCommand("workbench.action.removeDynamicAuthenticationProviders")});if(!p){if(this.problematicProviders.has(c)){let g=t.add(new it("providerUnavailable",d(4965,null,u.label),void 0,!1));r.push(g);try{await this.addAccountsFromProvider(c)}catch(f){this.logService.error(f)}}r.push(h);continue}for(let g of p){let f=[],v=li({id:`configureSessions${g.label}`,label:d(4972,null),enabled:!0,run:()=>this.commandService.executeCommand("_manageTrustedMCPServersForAccount",{providerId:c,accountLabel:g.label})});f.push(v),f.push(h),g.canSignOut&&f.push(li({id:"signOut",label:d(4973,null),enabled:!0,run:()=>this.commandService.executeCommand("_signOutOfAccount",{providerId:c,accountLabel:g.label})}));let b=new sa("activitybar.submenu",`${g.label} (${u.label})`,f);r.push(b)}}}else{let c=t.add(new it("noAccountsAvailable",d(4967,null),void 0,!1));r.push(c)}return r.length&&n.length&&r.push(new oi),n.forEach((c,u)=>{let p=c[1];r=r.concat(p),u!==n.length-1&&r.push(new oi)}),r}async resolveContextMenuActions(e){let t=await super.resolveContextMenuActions(e);return this.fillContextMenuActions(t),t}async addOrUpdateAccount(e,t){let o=this.groupedAccounts.get(e);o||(o=[],this.groupedAccounts.set(e,o));let n=await this.sessionFromEmbedder.value,r=!0;n&&!n.canSignOut&&(await this.authenticationService.getSessions(e)).some(l=>l.id===n.id&&l.account.id===t.id)&&(r=!1);let s=o.find(l=>l.label===t.label);s?r||(s.canSignOut=r):o.push({...t,canSignOut:r})}removeAccount(e,t){let o=this.groupedAccounts.get(e);if(!o)return;let n=o.findIndex(r=>r.id===t.id);n!==-1&&(o.splice(n,1),o.length===0&&this.groupedAccounts.delete(e))}async addAccountsFromProvider(e){try{let t=await this.authenticationService.getSessions(e);this.problematicProviders.delete(e);for(let o of t)try{await this.addOrUpdateAccount(e,o.account)}catch(n){this.logService.error(n)}}catch(t){this.logService.error(t),this.problematicProviders.add(e)}}};kU=I([m(4,Pe),m(5,to),m(6,ot),m(7,Xe),m(8,Yt),m(9,X),m(10,ks),m(11,Mt),m(12,Ze),m(13,B),m(14,Le),m(15,fC),m(16,re),m(17,Al),m(18,F),m(19,fe)],kU);var OPe=class extends NPe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){let b=f.createInstance(AG,{id:wU,name:d(4968,null),classNames:q.asClassNameArray(n.currentProfile.icon?q.fromId(n.currentProfile.icon):Q8)});super(R.GlobalActivity,b,t,e,o,r,s,l,c,u,p,g,v);this.userDataProfileService=n;this._register(b),this._register(this.userDataProfileService.onDidChangeCurrentProfile(S=>{b.compositeBarActionItem={...b.compositeBarActionItem,classNames:q.asClassNameArray(n.currentProfile.icon?q.fromId(n.currentProfile.icon):Q8)}}))}render(e){super.render(e),this.profileBadge=D(e,_(".profile-badge")),this.profileBadgeContent=D(this.profileBadge,_(".profile-badge-content")),this.updateProfileBadge()}updateProfileBadge(){!this.profileBadge||!this.profileBadgeContent||(St(this.profileBadgeContent),Wi(this.profileBadge),!this.userDataProfileService.currentProfile.isDefault&&(this.userDataProfileService.currentProfile.icon&&this.userDataProfileService.currentProfile.icon!==Q8.id||this.action.activities.length>0||(Xo(this.profileBadge),this.profileBadgeContent.classList.add("profile-text-overlay"),this.profileBadgeContent.textContent=this.userDataProfileService.currentProfile.name.substring(0,2).toUpperCase())))}updateActivity(){super.updateActivity(),this.updateProfileBadge()}computeTitle(){return this.userDataProfileService.currentProfile.isDefault?super.computeTitle():d(4969,null,this.userDataProfileService.currentProfile.name)}};OPe=I([m(3,gn),m(4,Pe),m(5,ot),m(6,Yt),m(7,Xe),m(8,X),m(9,B),m(10,Mt),m(11,Le),m(12,F),m(13,Al)],OPe);var FPe=class extends kU{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(()=>evo(v,!0),{...e,colors:x=>({badgeBackground:x.getColor(zD),badgeForeground:x.getColor(KD)}),hoverOptions:i,compact:!0},()=>{},x=>x,t,o,n,r,s,l,c,u,p,h,g,f,b,S,y,w)}};FPe=I([m(2,Pe),m(3,to),m(4,ot),m(5,Xe),m(6,Yt),m(7,X),m(8,ks),m(9,Mt),m(10,Ze),m(11,B),m(12,Le),m(13,fC),m(14,de),m(15,re),m(16,Al),m(17,F),m(18,fe)],FPe);var WPe=class extends OPe{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(()=>evo(f,!1),{...e,colors:v=>({badgeBackground:v.getColor(zD),badgeForeground:v.getColor(KD)}),hoverOptions:i,compact:!0},()=>{},t,o,n,r,s,l,c,u,p,h,g)}};WPe=I([m(2,gn),m(3,Pe),m(4,ot),m(5,Yt),m(6,Xe),m(7,X),m(8,B),m(9,Mt),m(10,Le),m(11,F),m(12,Al),m(13,de)],WPe);function evo(a,i){let e=[];return i&&e.push(li({id:"hideAccounts",label:d(4966,null),run:()=>TUt(a,!1)}),new oi),[...e,li({id:"toggle.hideAccounts",label:d(4963,null),checked:lit(a),run:()=>TUt(a,!lit(a))}),li({id:"toggle.hideManage",label:d(4968,null),checked:!0,enabled:!1,run:()=>{throw new Error('"Manage" can not be hidden')}})]}function lit(a){return a.getBoolean(kU.ACCOUNTS_VISIBILITY_PREFERENCE_KEY,0,!0)}function TUt(a,i){a.store(kU.ACCOUNTS_VISIBILITY_PREFERENCE_KEY,i,0,0)}var Rv=class extends k_{constructor(e,t,o,n,r,s,l){super("workbench.parts.activitybar",{hasTitle:!1},r,s,n);this.location=e;this.paneCompositePart=t;this.instantiationService=o;this.configurationService=l;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.compositeBar=this._register(new ue);this._isCompact=this.configurationService.getValue("workbench.activityBar.compact")??!1,this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("workbench.activityBar.compact")&&(this._isCompact=this.configurationService.getValue("workbench.activityBar.compact")??!1,this.updateCompactStyle(),this.recreateCompositeBar(),this._onDidChange.fire(void 0))}))}static{this.ACTION_HEIGHT=48}static{this.COMPACT_ACTION_HEIGHT=32}static{this.ACTIVITYBAR_WIDTH=48}static{this.COMPACT_ACTIVITYBAR_WIDTH=36}static{this.ICON_SIZE=24}static{this.COMPACT_ICON_SIZE=16}static{this.pinnedViewContainersKey="workbench.activity.pinnedViewlets2"}static{this.placeholderViewContainersKey="workbench.activity.placeholderViewlets"}static{this.viewContainersWorkspaceStateKey="workbench.activity.viewletsWorkspaceState"}get minimumWidth(){return this._isCompact?Rv.COMPACT_ACTIVITYBAR_WIDTH:Rv.ACTIVITYBAR_WIDTH}get maximumWidth(){return this._isCompact?Rv.COMPACT_ACTIVITYBAR_WIDTH:Rv.ACTIVITYBAR_WIDTH}updateCompactStyle(){this.element&&(this.element.classList.toggle("compact",this._isCompact),this.element.style.setProperty("--activity-bar-width",`${this.minimumWidth}px`),this.element.style.setProperty("--activity-bar-action-height",`${this._isCompact?Rv.COMPACT_ACTION_HEIGHT:Rv.ACTION_HEIGHT}px`),this.element.style.setProperty("--activity-bar-icon-size",`${this._isCompact?Rv.COMPACT_ICON_SIZE:Rv.ICON_SIZE}px`))}recreateCompositeBar(){!this.content||!this.compositeBar.value||(this.compositeBar.clear(),St(this.content),this.compositeBar.value=this.createCompositeBar(),this.compositeBar.value.create(this.content),this.dimension&&this.layout(this.dimension.width,this.dimension.height))}createCompositeBar(){let e=this._isCompact?Rv.COMPACT_ACTION_HEIGHT:Rv.ACTION_HEIGHT,t=this._isCompact?Rv.COMPACT_ICON_SIZE:Rv.ICON_SIZE;return this.instantiationService.createInstance(Hhe,this.location,{partContainerClass:"activitybar",pinnedViewContainersKey:Rv.pinnedViewContainersKey,placeholderViewContainersKey:Rv.placeholderViewContainersKey,viewContainersWorkspaceStateKey:Rv.viewContainersWorkspaceStateKey,orientation:1,icon:!0,iconSize:t,activityHoverOptions:{position:()=>this.layoutService.getSideBarPosition()===0?1:0},preventLoopNavigation:!0,recomputeSizes:!1,fillExtraContextMenuActions:(o,n)=>{},compositeSize:52,colors:o=>({activeForegroundColor:o.getColor(D2),inactiveForegroundColor:o.getColor(qro),activeBorderColor:o.getColor(Tbi),activeBackground:o.getColor(_bi),badgeBackground:o.getColor(zD),badgeForeground:o.getColor(KD),dragAndDropBorder:o.getColor(jro),activeBackgroundColor:void 0,inactiveBackgroundColor:void 0,activeBorderBottomColor:void 0}),overflowActionSize:e},"workbench.parts.activitybar",this.paneCompositePart,!0)}createContentArea(e){return this.element=e,this.content=D(this.element,_(".content")),this.updateCompactStyle(),this.layoutService.isVisible("workbench.parts.activitybar")&&this.show(),this.content}getPinnedPaneCompositeIds(){return this.compositeBar.value?.getPinnedPaneCompositeIds()??[]}getVisiblePaneCompositeIds(){return this.compositeBar.value?.getVisiblePaneCompositeIds()??[]}getPaneCompositeIds(){return this.compositeBar.value?.getPaneCompositeIds()??[]}focus(){this.compositeBar.value?.focus()}updateStyles(){super.updateStyles();let e=Ti(this.getContainer()),t=this.getColor(hMt)||"";e.style.backgroundColor=t;let o=this.getColor(gMt)||this.getColor(Ei)||"";e.classList.toggle("bordered",!!o),e.style.borderColor=o||""}show(e){this.content&&(this.compositeBar.value||(this.compositeBar.value=this.createCompositeBar(),this.compositeBar.value.create(this.content),this.dimension&&this.layout(this.dimension.width,this.dimension.height)),e&&this.focus())}hide(){this.compositeBar.value&&(this.compositeBar.clear(),this.content&&St(this.content))}layout(e,t){if(super.layout(e,t,0,0),!this.compositeBar.value)return;let o=super.layoutContents(e,t).contentSize;this.compositeBar.value.layout(e,o.height)}toJSON(){return{type:"workbench.parts.activitybar"}}};Rv=I([m(2,F),m(3,wi),m(4,Pe),m(5,de),m(6,B)],Rv);var Hhe=class extends zte{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,{...t,fillExtraContextMenuActions:(S,y)=>{t.fillExtraContextMenuActions(S,y),this.fillContextMenuActions(S,y)}},o,n,s,l,c,u,p,h,g,b);this.configurationService=f;this.menuService=v;this.menuBar=this._register(new ue);this.keyboardNavigationDisposables=this._register(new O);r&&(this.globalCompositeBar=this._register(s.createInstance(xU,()=>this.getContextMenuActions(),S=>this.options.colors(S),this.options.activityHoverOptions))),this._register(this.configurationService.onDidChangeConfiguration(S=>{S.affectsConfiguration("window.menuBarVisibility")&&(sM(this.configurationService)==="compact"?this.installMenubar():this.uninstallMenubar())}))}fillContextMenuActions(e,t){let o=sM(this.configurationService);(o==="compact"||o==="hidden"||o==="toggle")&&e.unshift(li({id:"toggleMenuVisibility",label:d(4417,null),checked:o==="compact",run:()=>this.configurationService.updateValue("window.menuBarVisibility",o==="compact"?"toggle":"compact")}),new oi),o==="compact"&&this.menuBarContainer&&t?.target&&ms(t.target,this.menuBarContainer)&&e.unshift(li({id:"hideCompactMenu",label:d(4416,null),run:()=>this.configurationService.updateValue("window.menuBarVisibility","toggle")}),new oi),this.globalCompositeBar&&(e.push(new oi),e.push(...this.globalCompositeBar.getContextMenuActions())),e.push(new oi),e.push(...this.getActivityBarContextMenuActions())}uninstallMenubar(){this.menuBar.value&&(this.menuBar.value=void 0),this.menuBarContainer&&(this.menuBarContainer.remove(),this.menuBarContainer=void 0)}installMenubar(){if(this.menuBar.value)return;this.menuBarContainer=_(".menubar"),Ti(this.element).prepend(this.menuBarContainer),this.menuBar.value=this._register(this.instantiationService.createInstance(qte)),this.menuBar.value.create(this.menuBarContainer)}registerKeyboardNavigationListeners(){this.keyboardNavigationDisposables.clear(),this.menuBarContainer&&this.keyboardNavigationDisposables.add($(this.menuBarContainer,ne.KEY_DOWN,e=>{let t=new mi(e);(t.equals(18)||t.equals(17))&&this.focus()})),this.compositeBarContainer&&this.keyboardNavigationDisposables.add($(this.compositeBarContainer,ne.KEY_DOWN,e=>{let t=new mi(e);t.equals(18)||t.equals(17)?this.globalCompositeBar?.focus():(t.equals(16)||t.equals(15))&&this.menuBar.value?.toggleFocus()})),this.globalCompositeBar&&this.keyboardNavigationDisposables.add($(this.globalCompositeBar.element,ne.KEY_DOWN,e=>{let t=new mi(e);(t.equals(16)||t.equals(15))&&this.focus(this.getVisiblePaneCompositeIds().length-1)}))}create(e){return this.element=e,sM(this.configurationService)==="compact"&&this.installMenubar(),this.compositeBarContainer=super.create(this.element),this.globalCompositeBar&&this.globalCompositeBar.create(this.element),this.registerKeyboardNavigationListeners(),this.compositeBarContainer}layout(e,t){this.menuBarContainer&&(this.options.orientation===1?t-=this.menuBarContainer.clientHeight:e-=this.menuBarContainer.clientWidth),this.globalCompositeBar&&(this.options.orientation===1?t-=this.globalCompositeBar.size()*this.options.overflowActionSize:e-=this.globalCompositeBar.element.clientWidth),super.layout(e,t)}getActivityBarContextMenuActions(){let e=this.menuService.getMenuActions(R.ActivityBarPositionMenu,this.contextKeyService,{shouldForwardArgs:!0,renderShortTitle:!0}),t=um(e).secondary,o=[new sa("workbench.action.activityBar.position",d(4407,null),t)];if(this.configurationService.getValue("workbench.activityBar.location")==="default"){let r=this.configurationService.getValue("workbench.activityBar.compact")??!1,s=[li({id:"workbench.action.activityBar.size.default",label:d(4410,null),checked:!r,run:()=>this.configurationService.updateValue("workbench.activityBar.compact",!1)}),li({id:"workbench.action.activityBar.size.compact",label:d(4409,null),checked:r,run:()=>this.configurationService.updateValue("workbench.activityBar.compact",!0)})];o.push(new sa("workbench.action.activityBar.size",d(4408,null),s))}return o.push(li({id:S_.ID,label:S_.getLabel(this.layoutService),run:()=>this.instantiationService.invokeFunction(r=>new S_().run(r))})),this.part==="workbench.parts.sidebar"&&o.push(li({id:uU.ID,label:uU.LABEL,run:()=>this.instantiationService.invokeFunction(r=>new uU().run(r))})),o}};Hhe=I([m(5,F),m(6,de),m(7,lt),m(8,ji),m(9,Gt),m(10,X),m(11,Mt),m(12,B),m(13,Yt),m(14,wi)],Hhe);W(class extends z{constructor(){super({id:"workbench.action.activityBarLocation.default",title:{...P(4425,"Move Activity Bar to Side"),mnemonicTitle:d(4419,null)},shortTitle:d(4412,null),category:Fe.View,toggled:C.equals("config.workbench.activityBar.location","default"),menu:[{id:R.ActivityBarPositionMenu,order:1},{id:R.CommandPalette,when:C.and(C.notEquals("config.workbench.activityBar.location","default"),qo.negate())}]})}run(a){a.get(B).updateValue("workbench.activityBar.location","default")}});W(class extends z{constructor(){super({id:"workbench.action.activityBarLocation.top",title:{...P(4426,"Move Activity Bar to Top"),mnemonicTitle:d(4421,null)},shortTitle:d(4428,null),category:Fe.View,toggled:C.equals("config.workbench.activityBar.location","top"),menu:[{id:R.ActivityBarPositionMenu,order:2},{id:R.CommandPalette,when:C.and(C.notEquals("config.workbench.activityBar.location","top"),qo.negate())}]})}run(a){a.get(B).updateValue("workbench.activityBar.location","top")}});W(class extends z{constructor(){super({id:"workbench.action.activityBarLocation.bottom",title:{...P(4424,"Move Activity Bar to Bottom"),mnemonicTitle:d(4418,null)},shortTitle:d(4411,null),category:Fe.View,toggled:C.equals("config.workbench.activityBar.location","bottom"),menu:[{id:R.ActivityBarPositionMenu,order:3},{id:R.CommandPalette,when:C.and(C.notEquals("config.workbench.activityBar.location","bottom"),qo.negate())}]})}run(a){a.get(B).updateValue("workbench.activityBar.location","bottom")}});W(class extends z{constructor(){super({id:"workbench.action.activityBarLocation.hide",title:{...P(4415,"Hide Activity Bar"),mnemonicTitle:d(4420,null)},shortTitle:d(4414,null),category:Fe.View,toggled:C.equals("config.workbench.activityBar.location","hidden"),menu:[{id:R.ActivityBarPositionMenu,order:4},{id:R.CommandPalette,when:C.and(C.notEquals("config.workbench.activityBar.location","hidden"),qo.negate())}]})}run(a){a.get(B).updateValue("workbench.activityBar.location","hidden")}});be.appendMenuItem(R.MenubarAppearanceMenu,{submenu:R.ActivityBarPositionMenu,title:d(4423,null),group:"3_workbench_layout_move",order:2,when:qo.negate()});be.appendMenuItem(R.ViewContainerTitleContext,{submenu:R.ActivityBarPositionMenu,title:d(4423,null),when:C.or(C.equals("viewContainerLocation",wC(0)),C.equals("viewContainerLocation",wC(2))),group:"3_workbench_layout_move",order:1});W(class extends cU{constructor(){super({id:"workbench.action.previousSideBarView",title:P(4427,"Previous Primary Side Bar View"),category:Fe.View,f1:!0},0,-1)}});W(class extends cU{constructor(){super({id:"workbench.action.nextSideBarView",title:P(4422,"Next Primary Side Bar View"),category:Fe.View,f1:!0},0,1)}});W(class extends z{constructor(){super({id:"workbench.action.focusActivityBar",title:P(4413,"Focus Activity Bar"),category:Fe.View,f1:!0})}async run(i){i.get(wi).focusPart("workbench.parts.activitybar")}});hs((a,i)=>{let e=a.getColor(Tbi);e&&i.addRule(`
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator:before {
				border-left-color: ${e};
			}
		`);let t=a.getColor($ro);t&&i.addRule(`
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:focus::before {
				visibility: hidden;
			}

			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:focus .active-item-indicator:before {
				visibility: visible;
				border-left-color: ${t};
			}
		`);let o=a.getColor(_bi);o&&i.addRule(`
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .active-item-indicator {
				z-index: 0;
				background-color: ${o};
			}
		`);let n=a.getColor(la);if(n)i.addRule(`
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item .action-label::before{
				padding: 6px;
			}

			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active .action-label::before,
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active:hover .action-label::before,
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked .action-label::before,
			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.checked:hover .action-label::before {
				outline: 1px solid ${n};
			}

			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label::before {
				outline: 1px dashed ${n};
			}

			.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .active-item-indicator:before {
				border-left-color: ${n};
			}
		`);else{let r=a.getColor(Kc);r&&i.addRule(`
				.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .active-item-indicator::before {
						border-left-color: ${r};
					}
				`)}});var JG=class extends LW{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super("workbench.parts.sidebar",{hasTitle:!0,trailingSeparator:!1,borderWidth:()=>this.getColor(R2)||this.getColor(Ei)?1:0},JG.activeViewletSettingsKey,Yso.bindTo(p),xH.bindTo(p),"sideBar","viewlet",aso,CMt,0,CW.Viewlets,R.SidebarTitle,e,t,o,n,r,s,l,c,u,p,h,f);this.configurationService=g;this.minimumWidth=170;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=0;this.maximumHeight=Number.POSITIVE_INFINITY;this.priority=1;this.activityBarPart=this._register(this.instantiationService.createInstance(Rv,this.location,this));this.visibleViewContainersTracker=this._register(l.createInstance(Gte,0)),this._register(this.visibleViewContainersTracker.onDidChange(v=>this.onDidChangeAutoHideViewContainers(v))),this.rememberActivityBarVisiblePosition(),this._register(g.onDidChangeConfiguration(v=>{v.affectsConfiguration("workbench.activityBar.location")&&this.onDidChangeActivityBarLocation(),v.affectsConfiguration("workbench.activityBar.autoHide")&&this.onDidChangeActivityBarLocation()})),this.registerActions()}static{this.activeViewletSettingsKey="workbench.sidebar.activeviewletid"}get snap(){return!0}get preferredWidth(){let e=this.getActivePaneComposite();if(!e)return;let t=e.getOptimalWidth();if(typeof t=="number")return Math.max(t,300)}onDidChangeAutoHideViewContainers(e){let t=this.configurationService.getValue("workbench.activityBar.location");if(this.configurationService.getValue("workbench.activityBar.autoHide")&&(t==="top"||t==="bottom")){let n=e.before>1,r=e.after>1;n!==r&&this.onDidChangeActivityBarLocation()}}onDidChangeActivityBarLocation(){this.activityBarPart.hide(),this.updateCompositeBar();let e=this.getActiveComposite()?.getId();e&&this.onTitleAreaUpdate(e),this.shouldShowActivityBar()&&this.activityBarPart.show(),this.rememberActivityBarVisiblePosition()}updateStyles(){super.updateStyles();let e=Ti(this.getContainer());e.style.backgroundColor=this.getColor(ch)||"",e.style.color=this.getColor(QA)||"";let t=this.getColor(R2)||this.getColor(Ei),o=this.layoutService.getSideBarPosition()===0;e.style.borderRightWidth=t&&o?"1px":"",e.style.borderRightStyle=t&&o?"solid":"",e.style.borderRightColor=o&&t||"",e.style.borderLeftWidth=t&&!o?"1px":"",e.style.borderLeftStyle=t&&!o?"solid":"",e.style.borderLeftColor=o?"":t||"",e.style.outlineColor=this.getColor(p3)??""}layout(e,t,o,n){this.layoutService.isVisible("workbench.parts.sidebar")&&super.layout(e,t,o,n)}getTitleAreaDropDownAnchorAlignment(){return this.layoutService.getSideBarPosition()===0?0:1}createCompositeBar(){return this.instantiationService.createInstance(Hhe,0,this.getCompositeBarOptions(),this.partId,this,!1)}getCompositeBarOptions(){return{partContainerClass:"sidebar",pinnedViewContainersKey:Rv.pinnedViewContainersKey,placeholderViewContainersKey:Rv.placeholderViewContainersKey,viewContainersWorkspaceStateKey:Rv.viewContainersWorkspaceStateKey,icon:!0,orientation:0,recomputeSizes:!0,activityHoverOptions:{position:()=>this.getCompositeBarPosition()===2?3:2},fillExtraContextMenuActions:e=>{if(this.getCompositeBarPosition()===1){let t=this.getViewsSubmenuAction();t&&(e.push(new oi),e.push(t))}},compositeSize:0,iconSize:16,overflowActionSize:30,colors:e=>({activeBackgroundColor:e.getColor(ch),inactiveBackgroundColor:e.getColor(ch),activeBorderBottomColor:e.getColor(fMt),activeForegroundColor:e.getColor(d3),inactiveForegroundColor:e.getColor(vMt),badgeBackground:e.getColor(zD),badgeForeground:e.getColor(KD),dragAndDropBorder:e.getColor(bMt)}),compact:!0}}shouldShowCompositeBar(){let e=this.configurationService.getValue("workbench.activityBar.location");return!(e!=="top"&&e!=="bottom"||this.configurationService.getValue("workbench.activityBar.autoHide")&&this.visibleViewContainersTracker.visibleCount<=1)}shouldShowActivityBar(){return this.shouldShowCompositeBar()?!1:this.configurationService.getValue("workbench.activityBar.location")!=="hidden"}getCompositeBarPosition(){switch(this.configurationService.getValue("workbench.activityBar.location")){case"top":return 0;case"bottom":return 2;case"hidden":case"default":default:return 1}}rememberActivityBarVisiblePosition(){let e=this.configurationService.getValue("workbench.activityBar.location");e!=="hidden"&&this.storageService.store("workbench.activityBar.location",e,0,0)}getRememberedActivityBarVisiblePosition(){switch(this.storageService.get("workbench.activityBar.location",0)){case"top":return"top";case"bottom":return"bottom";default:return"default"}}getPinnedPaneCompositeIds(){return this.shouldShowCompositeBar()?super.getPinnedPaneCompositeIds():this.activityBarPart.getPinnedPaneCompositeIds()}getVisiblePaneCompositeIds(){return this.shouldShowCompositeBar()?super.getVisiblePaneCompositeIds():this.activityBarPart.getVisiblePaneCompositeIds()}getPaneCompositeIds(){return this.shouldShowCompositeBar()?super.getPaneCompositeIds():this.activityBarPart.getPaneCompositeIds()}async focusActivityBar(){this.configurationService.getValue("workbench.activityBar.location")==="hidden"&&(await this.configurationService.updateValue("workbench.activityBar.location",this.getRememberedActivityBarVisiblePosition()),this.onDidChangeActivityBarLocation()),this.shouldShowCompositeBar()?this.focusCompositeBar():(this.layoutService.isVisible("workbench.parts.activitybar")||this.layoutService.setPartHidden(!1,"workbench.parts.activitybar"),this.activityBarPart.show(!0))}registerActions(){let e=this;this._register(W(class extends z{constructor(){super({id:Mki,title:P(5100,"Toggle Activity Bar Visibility")})}run(){let t=e.configurationService.getValue("workbench.activityBar.location")==="hidden"?e.getRememberedActivityBarVisiblePosition():"hidden";return e.configurationService.updateValue("workbench.activityBar.location",t)}}))}toJSON(){return{type:"workbench.parts.sidebar"}}};JG=I([m(0,Ne),m(1,de),m(2,Xe),m(3,wi),m(4,Le),m(5,ot),m(6,F),m(7,Pe),m(8,ji),m(9,X),m(10,lt),m(11,B),m(12,Yt)],JG);var cit=class extends k{constructor(e){super();this.paneCompositeParts=new Map;let t=e.createInstance(XG),o=e.createInstance(JG),n=e.createInstance(UN);this.paneCompositeParts.set(1,t),this.paneCompositeParts.set(0,o),this.paneCompositeParts.set(2,n);let r=[0,1,2],s=this._register(new O);this.onDidPaneCompositeOpen=U.any(...r.map(l=>U.map(this.paneCompositeParts.get(l).onDidPaneCompositeOpen,c=>({composite:c,viewContainerLocation:l}),s))),this.onDidPaneCompositeClose=U.any(...r.map(l=>U.map(this.paneCompositeParts.get(l).onDidPaneCompositeClose,c=>({composite:c,viewContainerLocation:l}),s)))}getRegistryId(e){return this.getPartByLocation(e).registryId}getPartId(e){return this.getPartByLocation(e).partId}openPaneComposite(e,t,o){return this.getPartByLocation(t).openPaneComposite(e,o)}getActivePaneComposite(e){return this.getPartByLocation(e).getActivePaneComposite()}getPaneComposite(e,t){return this.getPartByLocation(t).getPaneComposite(e)}getPaneComposites(e){return this.getPartByLocation(e).getPaneComposites()}getPinnedPaneCompositeIds(e){return this.getPartByLocation(e).getPinnedPaneCompositeIds()}getVisiblePaneCompositeIds(e){return this.getPartByLocation(e).getVisiblePaneCompositeIds()}getPaneCompositeIds(e){return this.getPartByLocation(e).getPaneCompositeIds()}getProgressIndicator(e,t){return this.getPartByLocation(t).getProgressIndicator(e)}hideActivePaneComposite(e){this.getPartByLocation(e).hideActivePaneComposite()}getLastActivePaneCompositeId(e){return this.getPartByLocation(e).getLastActivePaneCompositeId()}getPartByLocation(e){return Ti(this.paneCompositeParts.get(e))}};cit=I([m(0,F)],cit);Ce(Es,cit,1);var LR=le("bannerService");var dit=class extends k_{constructor(e,t,o,n,r,s){super("workbench.parts.banner",{hasTitle:!1},e,o,t);this.contextKeyService=n;this.instantiationService=r;this.markdownRendererService=s;this.height=26;this.minimumWidth=0;this.maximumWidth=Number.POSITIVE_INFINITY;this._onDidChangeSize=this._register(new T);this.visible=!1;this.focusedActionIndex=-1}get minimumHeight(){return this.visible?this.height:0}get maximumHeight(){return this.visible?this.height:0}get onDidChange(){return this._onDidChangeSize.event}createContentArea(e){this.element=e,this.element.tabIndex=0,this._register($(this.element,ne.FOCUS,()=>{this.focusedActionIndex!==-1&&this.focusActionLink()}));let t=this._register(this.contextKeyService.createScoped(this.element));return wYe.bindTo(t).set(!0),this.element}close(e){this.setVisibility(!1),St(this.element),typeof e.onClose=="function"&&e.onClose(),this.item=void 0}focusActionLink(){let e=this.item?.actions?.length??0;if(this.focusedActionIndex<e){let t=this.messageActionsContainer?.children[this.focusedActionIndex];go(t)&&(this.actionBar?.setFocusable(!1),t.focus())}else this.actionBar?.focus(0)}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){let t=_("span");return t.textContent=e,t}return this.markdownRendererService.render(e).element}setVisibility(e){e!==this.visible&&(this.visible=e,this.focusedActionIndex=-1,this.layoutService.setPartHidden(!e,"workbench.parts.banner"),this._onDidChangeSize.fire(void 0))}focus(){this.focusedActionIndex=-1,this.element.focus()}focusNextAction(){let e=this.item?.actions?.length??0;this.focusedActionIndex=this.focusedActionIndex<e?this.focusedActionIndex+1:0,this.focusActionLink()}focusPreviousAction(){let e=this.item?.actions?.length??0;this.focusedActionIndex=this.focusedActionIndex>0?this.focusedActionIndex-1:e,this.focusActionLink()}hide(e){this.item?.id===e&&this.setVisibility(!1)}show(e){if(e.id===this.item?.id){this.setVisibility(!0);return}St(this.element);let t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);let o=D(this.element,_("div.icon-container"));o.setAttribute("aria-hidden","true"),q.isThemeIcon(e.icon)?o.appendChild(_(`div${q.asCSSSelector(e.icon)}`)):(o.classList.add("custom-icon"),A.isUri(e.icon)&&(o.style.backgroundImage=cl(e.icon)));let n=D(this.element,_("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=D(this.element,_("div.message-actions-container")),e.actions)for(let c of e.actions)this._register(this.instantiationService.createInstance(Bg,this.messageActionsContainer,{...c,tabIndex:-1},{}));let r=D(this.element,_("div.action-container"));this.actionBar=this._register(new oo(r));let s=e.closeLabel??d(4459,null),l=this._register(new it("banner.close",s,q.asClassName(MT),!0,()=>this.close(e)));this.actionBar.push(l,{icon:!0,label:!1}),this.actionBar.setFocusable(!1),this.setVisibility(!0),this.item=e}toJSON(){return{type:"workbench.parts.banner"}}};dit=I([m(0,Pe),m(1,wi),m(2,de),m(3,X),m(4,F),m(5,_n)],dit);Ce(LR,dit,0);xt.registerCommandAndKeybindingRule({id:"workbench.banner.focusBanner",weight:200,primary:9,when:wYe,handler:a=>{a.get(LR).focus()}});xt.registerCommandAndKeybindingRule({id:"workbench.banner.focusNextAction",weight:200,primary:17,secondary:[18],when:wYe,handler:a=>{a.get(LR).focusNextAction()}});xt.registerCommandAndKeybindingRule({id:"workbench.banner.focusPreviousAction",weight:200,primary:15,secondary:[16],when:wYe,handler:a=>{a.get(LR).focusPreviousAction()}});var ZTi=class a extends z{static{this.ID="workbench.action.focusBanner"}static{this.LABEL=P(4460,"Focus Banner")}constructor(){super({id:a.ID,title:a.LABEL,category:Fe.View,f1:!0})}async run(i){i.get(wi).focusPart("workbench.parts.banner")}};W(ZTi);var _Ut=class extends it{constructor(e,t,o){super(e,t,void 0,!0);this.model=o;this.checked=!o.isHidden(e)}async run(){this.model.isHidden(this.id)?this.model.show(this.id):this.model.hide(this.id)}},DUt=class extends it{constructor(e,t,o){super(e,d(5102,null,t),void 0,!0);this.model=o}async run(){this.model.hide(this.id)}},VPe=class extends it{constructor(e,t){super("statusbar.manage.extension",d(5103,null));this.extensionId=e;this.commandService=t}run(){return this.commandService.executeCommand("_extensions.manage",this.extensionId)}};VPe=I([m(1,fe)],VPe);xt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusPrevious",weight:200,primary:15,secondary:[16],when:IZ,handler:a=>{a.get(Fr).focusPreviousEntry()}});xt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusNext",weight:200,primary:17,secondary:[18],when:IZ,handler:a=>{a.get(Fr).focusNextEntry()}});xt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusFirst",weight:200,primary:14,when:IZ,handler:a=>{let i=a.get(Fr);i.focus(!1),i.focusNextEntry()}});xt.registerCommandAndKeybindingRule({id:"workbench.statusBar.focusLast",weight:200,primary:13,when:IZ,handler:a=>{let i=a.get(Fr);i.focus(!1),i.focusPreviousEntry()}});xt.registerCommandAndKeybindingRule({id:"workbench.statusBar.clearFocus",weight:200,primary:9,when:IZ,handler:a=>{let i=a.get(Fr),e=a.get(ie);i.isEntryFocused()?i.focus(!1):e.activeEditorPane&&e.activeEditorPane.focus()}});var e_i=class extends z{constructor(){super({id:"workbench.action.focusStatusBar",title:P(5101,"Focus Status Bar"),category:Fe.View,f1:!0})}async run(i){i.get(wi).focusPart("workbench.parts.statusbar",zi())}};W(e_i);var RUt=class a extends k{constructor(e){super();this.storageService=e;this._onDidChangeEntryVisibility=this._register(new T);this.onDidChangeEntryVisibility=this._onDidChangeEntryVisibility.event;this._entries=[];this.hidden=new Set;this.restoreState(),this.registerListeners()}static{this.HIDDEN_ENTRIES_KEY="workbench.statusbar.hidden"}get entries(){return this._entries.slice(0)}get lastFocusedEntry(){return this._lastFocusedEntry&&!this.isHidden(this._lastFocusedEntry.id)?this._lastFocusedEntry:void 0}restoreState(){let e=this.storageService.get(a.HIDDEN_ENTRIES_KEY,0);if(e)try{this.hidden=new Set(JSON.parse(e))}catch{}}registerListeners(){this._register(this.storageService.onDidChangeValue(0,a.HIDDEN_ENTRIES_KEY,this._store)(()=>this.onDidStorageValueChange()))}onDidStorageValueChange(){let e=new Set(this.hidden);this.hidden.clear(),this.restoreState();let t=new Set;for(let o of e)this.hidden.has(o)||t.add(o);for(let o of this.hidden)e.has(o)||t.add(o);if(t.size>0)for(let o of this._entries)t.has(o.id)&&(this.updateVisibility(o.id,!0),t.delete(o.id))}add(e){this._entries.push(e),this.updateVisibility(e,!1),this.sort(),this.markFirstLastVisibleEntry()}remove(e){let t=this._entries.indexOf(e);t>=0&&(this._entries.splice(t,1),this._entries.some(o=>npe(o.priority.primary)&&o.priority.primary.location.id===e.id)&&this.sort(),this.markFirstLastVisibleEntry())}isHidden(e){return this.hidden.has(e)}hide(e){this.hidden.has(e)||(this.hidden.add(e),this.updateVisibility(e,!0),this.saveState())}show(e){this.hidden.delete(e)&&(this.updateVisibility(e,!0),this.saveState())}findEntry(e){return this._entries.find(t=>t.container===e)}getEntries(e){return this._entries.filter(t=>t.alignment===e)}focusNextEntry(){this.focusEntry(1,0)}focusPreviousEntry(){this.focusEntry(-1,this.entries.length-1)}isEntryFocused(){return!!this.getFocusedEntry()}getFocusedEntry(){return this._entries.find(e=>Is(e.container))}focusEntry(e,t){let o=s=>{let l=s,c=l>=0&&l<this._entries.length?this._entries[l]:void 0;for(;c&&this.isHidden(c.id);)l+=e,c=l>=0&&l<this._entries.length?this._entries[l]:void 0;return c},n=this.getFocusedEntry();if(n){let s=o(this._entries.indexOf(n)+e);if(s){this._lastFocusedEntry=s,s.labelContainer.focus();return}}let r=o(t);r&&(this._lastFocusedEntry=r,r.labelContainer.focus())}updateVisibility(e,t){if(typeof e=="string"){let o=e;for(let n of this._entries)n.id===o&&this.updateVisibility(n,t)}else{let o=e,n=this.isHidden(o.id);n?Wi(o.container):Xo(o.container),t&&this._onDidChangeEntryVisibility.fire({id:o.id,visible:!n}),this.markFirstLastVisibleEntry()}}saveState(){this.hidden.size>0?this.storageService.store(a.HIDDEN_ENTRIES_KEY,JSON.stringify(Array.from(this.hidden.values())),0,0):this.storageService.remove(a.HIDDEN_ENTRIES_KEY,0)}sort(){let e=new Set(this._entries.map(s=>s.id)),t=new Map,o=new Map;for(let s=0;s<this._entries.length;s++){let l=this._entries[s];if(typeof l.priority.primary=="number"||!e.has(l.priority.primary.location.id))t.set(l,s);else{let c=l.priority.primary.location.id,u=o.get(c);if(!u){for(let p of o.values())if(p.has(c)){u=p;break}u||(u=new Map,o.set(c,u))}u.set(l.id,l)}}let n=Array.from(t.keys());n.sort((s,l)=>{if(s.alignment===l.alignment){let c=typeof s.priority.primary=="number"?s.priority.primary:s.priority.primary.location.priority,u=typeof l.priority.primary=="number"?l.priority.primary:l.priority.primary.location.priority;return c!==u?u-c:s.priority.secondary!==l.priority.secondary?l.priority.secondary-s.priority.secondary:t.get(s)-t.get(l)}return s.alignment===0?-1:l.alignment===0?1:0});let r;if(o.size>0){r=[];for(let s of n){let l=o.get(s.id),c=l?Array.from(l.values()):void 0;c&&r.push(...c.filter(u=>npe(u.priority.primary)&&u.priority.primary.alignment===0).sort((u,p)=>p.priority.secondary-u.priority.secondary)),r.push(s),c&&r.push(...c.filter(u=>npe(u.priority.primary)&&u.priority.primary.alignment===1).sort((u,p)=>p.priority.secondary-u.priority.secondary)),o.delete(s.id)}for(let[,s]of o)r.push(...Array.from(s.values()).sort((l,c)=>c.priority.secondary-l.priority.secondary))}else r=n;this._entries=r}markFirstLastVisibleEntry(){this.doMarkFirstLastVisibleStatusbarItem(this.getEntries(0)),this.doMarkFirstLastVisibleStatusbarItem(this.getEntries(1))}doMarkFirstLastVisibleStatusbarItem(e){let t,o;for(let n of e)n.container.classList.remove("first-visible-item","last-visible-item"),!this.isHidden(n.id)&&(t||(t=n),o=n);t?.container.classList.add("first-visible-item"),o?.container.classList.add("last-visible-item")}};var BPe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.container=e;this.hoverDelegate=o;this.commandService=n;this.hoverService=r;this.notificationService=s;this.telemetryService=l;this.themeService=c;this.entry=void 0;this.foregroundListener=this._register(new ue);this.backgroundListener=this._register(new ue);this.commandMouseListener=this._register(new ue);this.commandTouchListener=this._register(new ue);this.commandKeyboardListener=this._register(new ue);this.hover=void 0;this.labelContainer=_("a.statusbar-item-label",{role:"button",tabIndex:-1}),this._register(ds.addTarget(this.labelContainer)),this.label=this._register(new t_i(this.labelContainer)),this.container.appendChild(this.labelContainer),this.beakContainer=_(".status-bar-item-beak-container"),this.container.appendChild(this.beakContainer),t.content&&this.container.appendChild(t.content),this.update(t)}get name(){return Ti(this.entry).name}get hasCommand(){return typeof this.entry?.command<"u"}update(e){if(this.label.showProgress=e.showProgress??!1,(!this.entry||e.text!==this.entry.text)&&(this.label.text=e.text,e.text?Xo(this.labelContainer):Wi(this.labelContainer)),(!this.entry||e.ariaLabel!==this.entry.ariaLabel)&&(this.container.setAttribute("aria-label",e.ariaLabel),this.labelContainer.setAttribute("aria-label",e.ariaLabel)),(!this.entry||e.role!==this.entry.role)&&this.labelContainer.setAttribute("role",e.role||"button"),!this.entry||!this.isEqualTooltip(this.entry,e)){let o,n;tro(e.tooltip)?(n=e.tooltip.content,o={actions:e.tooltip.commands.map(s=>({commandId:s.id,label:s.title,run:()=>this.executeCommand(s)}))}):n=e.tooltip;let r=yr(n)?{markdown:n,markdownNotSupportedFallback:void 0}:n;this.hover?this.hover.update(r,o):this.hover=this._register(this.hoverService.setupManagedHover(this.hoverDelegate,this.container,r,o))}if(!this.entry||e.command!==this.entry.command){this.commandMouseListener.clear(),this.commandTouchListener.clear(),this.commandKeyboardListener.clear();let o=e.command;o&&(o!==i3||this.hover)?(this.commandMouseListener.value=$(this.labelContainer,ne.CLICK,()=>this.executeCommand(o)),this.commandTouchListener.value=$(this.labelContainer,Vn.Tap,()=>this.executeCommand(o)),this.commandKeyboardListener.value=$(this.labelContainer,ne.KEY_DOWN,n=>{let r=new mi(n);r.equals(10)||r.equals(3)?(Kt.stop(n),this.executeCommand(o)):(r.equals(9)||r.equals(15)||r.equals(17))&&(Kt.stop(n),this.hover?.hide())}),this.labelContainer.classList.remove("disabled")):this.labelContainer.classList.add("disabled")}(!this.entry||e.showBeak!==this.entry.showBeak)&&(e.showBeak?this.container.classList.add("has-beak"):this.container.classList.remove("has-beak"));let t=!!e.backgroundColor||e.kind&&e.kind!=="standard";if(!this.entry||e.kind!==this.entry.kind){for(let o of ero)this.container.classList.remove(`${o}-kind`);e.kind&&e.kind!=="standard"&&this.container.classList.add(`${e.kind}-kind`),this.container.classList.toggle("has-background-color",t)}(!this.entry||e.color!==this.entry.color)&&this.applyColor(this.labelContainer,e.color),(!this.entry||e.backgroundColor!==this.entry.backgroundColor)&&(this.container.classList.toggle("has-background-color",t),this.applyColor(this.container,e.backgroundColor,!0)),this.entry=e}isEqualTooltip({tooltip:e},{tooltip:t}){return e===void 0?t===void 0:yr(e)?yr(t)&&Cde(e,t):e===t}async executeCommand(e){if(e===i3)this.hover?.show(!0);else{let t=typeof e=="string"?e:e.id,o=typeof e=="string"?[]:e.arguments??[];this.telemetryService.publicLog2("workbenchActionExecuted",{id:t,from:"status bar"});try{await this.commandService.executeCommand(t,...o)}catch(n){this.notificationService.error(Mn(n))}}}applyColor(e,t,o){let n;if(o?this.backgroundListener.clear():this.foregroundListener.clear(),t)if(cCe(t)){n=this.themeService.getColorTheme().getColor(t.id)?.toString();let r=this.themeService.onDidColorThemeChange(s=>{let l=s.getColor(t.id)?.toString();o?e.style.backgroundColor=l??"":e.style.color=l??""});o?this.backgroundListener.value=r:this.foregroundListener.value=r}else n=t;o?e.style.backgroundColor=n??"":e.style.color=n??""}};BPe=I([m(3,fe),m(4,ot),m(5,Ne),m(6,_e),m(7,Pe)],BPe);var t_i=class extends ak{constructor(e){super(e);this.container=e;this.progressCodicon=un(uQe);this.currentText="";this.currentShowProgress=!1}set showProgress(e){this.currentShowProgress!==e&&(this.currentShowProgress=e,this.progressCodicon=un(e==="syncing"?uQe:PT),this.text=this.currentText)}set text(e){if(this.currentShowProgress){this.container.firstChild!==this.progressCodicon&&this.container.appendChild(this.progressCodicon);for(let o of Array.from(this.container.childNodes))o!==this.progressCodicon&&o.remove();let t=e??"";t&&(t=`\xA0${t}`),D(this.container,...ir(t))}else super.text=e}};var ZG=class extends k_{constructor(e,t,o,n,r,s,l,c){super(e,{hasTitle:!1},o,r,s);this.instantiationService=t;this.contextService=n;this.contextMenuService=l;this.contextKeyService=c;this.minimumWidth=0;this.maximumWidth=Number.POSITIVE_INFINITY;this.minimumHeight=ZG.HEIGHT;this.maximumHeight=ZG.HEIGHT;this.pendingEntries=[];this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this.onDidOverrideEntry=this._register(new T);this.entryOverrides=new Map;this.compactEntriesDisposable=this._register(new ue);this.styleOverrides=new Set;this.viewModel=this._register(new RUt(r)),this.onDidChangeEntryVisibility=this.viewModel.onDidChangeEntryVisibility,this.hoverDelegate=this._register(this.instantiationService.createInstance(Kf,"element",{instantHover:!0,dynamicDelay(u){if(typeof u=="function"||go(u)||bEe(u)&&typeof u.markdown=="function"||bto(u))return 500}},(u,p)=>({persistence:{hideOnKeyDown:!0,sticky:p},appearance:{maxHeightRatio:.9}}))),this.registerListeners()}static{this.HEIGHT=22}registerListeners(){this._register(this.onDidChangeEntryVisibility(()=>this.updateCompactEntries())),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.updateStyles()))}overrideEntry(e,t){return this.entryOverrides.set(e,t),this.onDidOverrideEntry.fire(e),ee(()=>{this.entryOverrides.get(e)===t&&(this.entryOverrides.delete(e),this.onDidOverrideEntry.fire(e))})}withEntryOverride(e,t){let o=this.entryOverrides.get(t);return o&&(e={...e,...o}),e}addEntry(e,t,o,n=0){let r;return Zno(n)?r=n:r={primary:n,secondary:Lr(t)},this.element?this.doAddEntry(e,t,o,r):this.doAddPendingEntry(e,t,o,r)}doAddPendingEntry(e,t,o,n){let r={entry:e,id:t,alignment:o,priority:n};return this.pendingEntries.push(r),{update:l=>{r.accessor?r.accessor.update(l):r.entry=l},dispose:()=>{r.accessor?r.accessor.dispose():this.pendingEntries=this.pendingEntries.filter(l=>l!==r)}}}doAddEntry(e,t,o,n){let r=new O,s=this.doCreateStatusItem(t,o),l=r.add(this.instantiationService.createInstance(BPe,s,this.withEntryOverride(e,t),this.hoverDelegate)),c=new class{constructor(){this.id=t;this.extensionId=e.extensionId;this.alignment=o;this.priority=n;this.container=s;this.labelContainer=l.labelContainer}get name(){return l.name}get hasCommand(){return l.hasCommand}},{needsFullRefresh:u}=this.doAddOrRemoveModelEntry(c,!0);u?this.appendStatusbarEntries():this.appendStatusbarEntry(c);let p=e,h={update:g=>{p=g,l.update(this.withEntryOverride(g,t))},dispose:()=>{let{needsFullRefresh:g}=this.doAddOrRemoveModelEntry(c,!1);g?this.appendStatusbarEntries():(s.remove(),this.updateCompactEntries()),r.dispose()}};return r.add(this.onDidOverrideEntry.event(g=>{g===t&&h.update(p)})),h}doCreateStatusItem(e,t,...o){let n=_(".statusbar-item",{id:e});return o&&n.classList.add(...o),t===1?n.classList.add("right"):n.classList.add("left"),n}doAddOrRemoveModelEntry(e,t){let o=this.viewModel.entries;t?this.viewModel.add(e):this.viewModel.remove(e);let n=this.viewModel.entries;return t?o.splice(n.indexOf(e),0,e):o.splice(o.indexOf(e),1),{needsFullRefresh:!eo(o,n)}}isEntryVisible(e){return!this.viewModel.isHidden(e)}updateEntryVisibility(e,t){t?this.viewModel.show(e):this.viewModel.hide(e)}focusNextEntry(){this.viewModel.focusNextEntry()}focusPreviousEntry(){this.viewModel.focusPreviousEntry()}isEntryFocused(){return this.viewModel.isEntryFocused()}focus(e=!0){this.getContainer()?.focus();let t=this.viewModel.lastFocusedEntry;e&&t&&setTimeout(()=>t.labelContainer.focus(),0)}createContentArea(e){this.element=e;let t=this._register(this.contextKeyService.createScoped(this.element));return IZ.bindTo(t).set(!0),this.leftItemsContainer=_(".left-items.items-container"),this.element.appendChild(this.leftItemsContainer),this.element.tabIndex=0,this.rightItemsContainer=_(".right-items.items-container"),this.element.appendChild(this.rightItemsContainer),this._register($(e,ne.CONTEXT_MENU,o=>this.showContextMenu(o))),this._register(ds.addTarget(e)),this._register($(e,Vn.Contextmenu,o=>this.showContextMenu(o))),this.createInitialStatusbarEntries(),this.element}createInitialStatusbarEntries(){for(this.appendStatusbarEntries();this.pendingEntries.length;){let e=this.pendingEntries.shift();e&&(e.accessor=this.addEntry(e.entry,e.id,e.alignment,e.priority.primary))}}appendStatusbarEntries(){let e=Ti(this.leftItemsContainer),t=Ti(this.rightItemsContainer);St(e),St(t);for(let o of[...this.viewModel.getEntries(0),...this.viewModel.getEntries(1).reverse()])(o.alignment===0?e:t).appendChild(o.container);this.updateCompactEntries()}appendStatusbarEntry(e){let t=this.viewModel.getEntries(e.alignment);e.alignment===1&&t.reverse();let o=Ti(e.alignment===0?this.leftItemsContainer:this.rightItemsContainer),n=t.indexOf(e);n+1===t.length?o.appendChild(e.container):o.insertBefore(e.container,t[n+1].container),this.updateCompactEntries()}updateCompactEntries(){let e=this.viewModel.entries,t=new Map;for(let s of e)this.viewModel.isHidden(s.id)||t.set(s.id,s),s.container.classList.remove("compact-left","compact-right");let o=new Map;for(let s of t.values())if(npe(s.priority.primary)&&s.priority.primary.compact){let l=s.priority.primary.location.id,c=t.get(l);if(!c)continue;let u=o.get(l);if(!u){for(let p of o.values())if(p.has(l)){u=p;break}u||(u=new Map,o.set(l,u))}u.set(s.id,s),u.set(c.id,c),s.priority.primary.alignment===0?(c.container.classList.add("compact-left"),s.container.classList.add("compact-right")):(c.container.classList.add("compact-right"),s.container.classList.add("compact-left"))}let n=this.getColor(SH),r=this.getColor(Kro);if(this.compactEntriesDisposable.value=new O,n&&r&&!Uf(this.theme.type))for(let[,s]of o)for(let l of s.values())l.hasCommand&&(this.compactEntriesDisposable.value.add($(l.labelContainer,ne.MOUSE_OVER,()=>{s.forEach(c=>c.labelContainer.style.backgroundColor=n),l.labelContainer.style.backgroundColor=r})),this.compactEntriesDisposable.value.add($(l.labelContainer,ne.MOUSE_OUT,()=>{s.forEach(c=>c.labelContainer.style.backgroundColor="")})))}showContextMenu(e){Kt.stop(e,!0);let t=new Ln(Me(this.element),e),o;this.contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>(o=this.getContextMenuActions(t),o),onHide:()=>{o&&gz(o)}})}getContextMenuActions(e){let t=[];t.push(li({id:hhe.ID,label:d(5104,null),run:()=>this.instantiationService.invokeFunction(r=>new hhe().run(r))})),t.push(new oi);let o=new Set;for(let r of this.viewModel.entries)o.has(r.id)||(t.push(new _Ut(r.id,r.name,this.viewModel)),o.add(r.id));let n;for(let r=e.target;r;r=r.parentElement){let s=this.viewModel.findEntry(r);if(s){n=s;break}}return n&&(t.push(new oi),n.extensionId&&t.push(this.instantiationService.createInstance(VPe,n.extensionId)),t.push(new DUt(n.id,n.name,this.viewModel))),t}updateStyles(){super.updateStyles();let e=Ti(this.getContainer()),t=[...this.styleOverrides].sort((c,u)=>c.priority-u.priority)[0],o=this.getColor(t?.background??(this.contextService.getWorkbenchState()!==1?pMt:mMt))||"";e.style.backgroundColor=o;let n=this.getColor(t?.foreground??(this.contextService.getWorkbenchState()!==1?DM:Bro))||"";e.style.color=n;let r=this.getColor(zro);this.updateCompactEntries();let s=this.getColor(t?.border??(this.contextService.getWorkbenchState()!==1?fpe:Uro))||this.getColor(Ei);s?(e.classList.add("status-border-top"),e.style.setProperty("--status-border-top-color",s)):(e.classList.remove("status-border-top"),e.style.removeProperty("--status-border-top-color"));let l=this.getColor(Hro);this.styleElement||(this.styleElement=Pr(e,void 0,this._store)),this.styleElement.textContent=`

				/* Status bar focus outline */
				.monaco-workbench .part.statusbar:focus {
					outline-color: ${l};
				}

				/* Status bar item focus outline */
				.monaco-workbench .part.statusbar > .items-container > .statusbar-item a:focus-visible {
					outline: 1px solid ${this.getColor(la)??r};
					outline-offset: ${s?"-2px":"-1px"};
				}

				/* Notification Beak */
				.monaco-workbench .part.statusbar > .items-container > .statusbar-item.has-beak > .status-bar-item-beak-container:before {
					border-bottom-color: ${s??o};
				}
			`}layout(e,t,o,n){super.layout(e,t,o,n),super.layoutContents(e,t)}overrideStyle(e){return this.styleOverrides.add(e),this.updateStyles(),ee(()=>{this.styleOverrides.delete(e),this.updateStyles()})}toJSON(){return{type:"workbench.parts.statusbar"}}dispose(){this._onWillDispose.fire(),super.dispose()}};ZG=I([m(1,F),m(2,Pe),m(3,Ae),m(4,de),m(5,wi),m(6,Xe),m(7,X)],ZG);var uit=class extends ZG{constructor(i,e,t,o,n,r,s){super("workbench.parts.statusbar",i,e,t,o,n,r,s)}};uit=I([m(0,F),m(1,Pe),m(2,Ae),m(3,de),m(4,wi),m(5,Xe),m(6,X)],uit);var Uhe=class extends ZG{constructor(e,t,o,n,r,s,l,c){let u=Uhe.COUNTER++;super(`workbench.parts.auxiliaryStatus.${u}`,t,o,n,r,s,l,c);this.container=e;this.height=ZG.HEIGHT}static{this.COUNTER=1}};Uhe=I([m(1,F),m(2,Pe),m(3,Ae),m(4,de),m(5,wi),m(6,Xe),m(7,X)],Uhe);var pit=class extends Fte{constructor(e,t,o){super("workbench.statusBarService",o,t);this.instantiationService=e;this._onDidCreateAuxiliaryStatusbarPart=this._register(new T);this.onDidCreateAuxiliaryStatusbarPart=this._onDidCreateAuxiliaryStatusbarPart.event;this.mainPart=this._register(this.instantiationService.createInstance(uit)),this._register(this.registerPart(this.mainPart)),this.onDidChangeEntryVisibility=this.mainPart.onDidChangeEntryVisibility}createAuxiliaryStatusbarPart(e,t){let o=_("footer.part.statusbar",{role:"status","aria-live":"off",tabIndex:"0"});o.style.position="relative",e.appendChild(o);let n=t.createInstance(Uhe,o),r=this.registerPart(n);return n.create(o),U.once(n.onWillDispose)(()=>r.dispose()),this._onDidCreateAuxiliaryStatusbarPart.fire(n),n}createScoped(e,t){return t.add(this.instantiationService.createInstance(mit,e))}addEntry(e,t,o,n=0){return e.showInAllWindows?this.doAddEntryToAllWindows(e,t,o,n):this.mainPart.addEntry(e,t,o,n)}doAddEntryToAllWindows(e,t,o,n=0){let r=new O,s=new Set,l=e;function c(u){let p=new O;p.add(u.onWillDispose(()=>p.dispose()));let h=p.add(u.addEntry(l,t,o,n));s.add(h),p.add(ee(()=>s.delete(h))),r.add(p),p.add(ee(()=>r.delete(p)))}for(let u of this.parts)c(u);return r.add(this.onDidCreateAuxiliaryStatusbarPart(u=>c(u))),{update:u=>{l=u;for(let p of s)p.update(u)},dispose:()=>r.dispose()}}isEntryVisible(e){return this.mainPart.isEntryVisible(e)}updateEntryVisibility(e,t){for(let o of this.parts)o.updateEntryVisibility(e,t)}overrideEntry(e,t){let o=new O;for(let n of this.parts)o.add(n.overrideEntry(e,t));return o}focus(e){this.activePart.focus(e)}focusNextEntry(){this.activePart.focusNextEntry()}focusPreviousEntry(){this.activePart.focusPreviousEntry()}isEntryFocused(){return this.activePart.isEntryFocused()}overrideStyle(e){let t=new O;for(let o of this.parts)t.add(o.overrideStyle(e));return t}};pit=I([m(0,F),m(1,de),m(2,Pe)],pit);var mit=class extends k{constructor(e,t){super();this.statusbarEntryContainer=e;this.statusbarService=t;this.onDidChangeEntryVisibility=this.statusbarEntryContainer.onDidChangeEntryVisibility}createAuxiliaryStatusbarPart(e,t){return this.statusbarService.createAuxiliaryStatusbarPart(e,t)}createScoped(e,t){return this.statusbarService.createScoped(e,t)}getPart(){return this.statusbarEntryContainer}addEntry(e,t,o,n=0){return this.statusbarEntryContainer.addEntry(e,t,o,n)}isEntryVisible(e){return this.statusbarEntryContainer.isEntryVisible(e)}updateEntryVisibility(e,t){this.statusbarEntryContainer.updateEntryVisibility(e,t)}overrideEntry(e,t){return this.statusbarEntryContainer.overrideEntry(e,t)}focus(e){this.statusbarEntryContainer.focus(e)}focusNextEntry(){this.statusbarEntryContainer.focusNextEntry()}focusPreviousEntry(){this.statusbarEntryContainer.focusPreviousEntry()}isEntryFocused(){return this.statusbarEntryContainer.isEntryFocused()}overrideStyle(e){return this.statusbarEntryContainer.overrideStyle(e)}};mit=I([m(1,Fr)],mit);Ce(Fr,pit,0);be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarFileMenu,title:{value:"File",original:"File",mnemonicTitle:d(5112,null)},order:1});be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarEditMenu,title:{value:"Edit",original:"Edit",mnemonicTitle:d(5111,null)},order:2});be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarSelectionMenu,title:{value:"Selection",original:"Selection",mnemonicTitle:d(5116,null)},order:3});be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarViewMenu,title:{value:"View",original:"View",mnemonicTitle:d(5118,null)},order:4});be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarGoMenu,title:{value:"Go",original:"Go",mnemonicTitle:d(5113,null)},order:5});be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarTerminalMenu,title:{value:"Terminal",original:"Terminal",mnemonicTitle:d(5117,null)},order:7});be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarHelpMenu,title:{value:"Help",original:"Help",mnemonicTitle:d(5114,null)},order:8});be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarPreferencesMenu,title:{value:"Preferences",original:"Preferences",mnemonicTitle:d(5115,null)},when:Zk,order:9});var LUt=class extends z{constructor(){super({id:"menu.resetHiddenStates",title:P(1827,"Reset All Menus"),category:Fe.View,f1:!0})}run(i){i.get(Yt).resetHiddenStates(),i.get(re).info("did RESET all menu hidden states")}};Ce(Yt,Qke,1);W(LUt);var HPe=!1;function MUt(a){return a.scheme===Q.file?a.fsPath:a.path}var tvo=0,UPe=class{constructor(i,e,t,o,n,r,s){this.id=++tvo;this.type=0;this.actual=i,this.label=i.label,this.confirmBeforeUndo=i.confirmBeforeUndo||!1,this.resourceLabel=e,this.strResource=t,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=o,this.groupOrder=n,this.sourceId=r,this.sourceOrder=s,this.isValid=!0}setValid(i){this.isValid=i}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?"  VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}};var PUt=class{constructor(i,e){this.resourceLabel=i;this.reason=e}},AUt=class{constructor(){this.elements=new Map}createMessage(){let i=[],e=[];for(let[,o]of this.elements)(o.reason===0?i:e).push(o.resourceLabel);let t=[];return i.length>0&&t.push(d(2940,null,i.join(", "))),e.length>0&&t.push(d(2942,null,e.join(", "))),t.join(`
`)}get size(){return this.elements.size}has(i){return this.elements.has(i)}set(i,e){this.elements.set(i,e)}delete(i){return this.elements.delete(i)}},i_i=class{constructor(i,e,t,o,n,r,s){this.id=++tvo;this.type=1;this.actual=i,this.label=i.label,this.confirmBeforeUndo=i.confirmBeforeUndo||!1,this.resourceLabels=e,this.strResources=t,this.groupId=o,this.groupOrder=n,this.sourceId=r,this.sourceOrder=s,this.removedResources=null,this.invalidatedResources=null}canSplit(){return typeof this.actual.split=="function"}removeResource(i,e,t){this.removedResources||(this.removedResources=new AUt),this.removedResources.has(e)||this.removedResources.set(e,new PUt(i,t))}setValid(i,e,t){t?this.invalidatedResources&&(this.invalidatedResources.delete(e),this.invalidatedResources.size===0&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new AUt),this.invalidatedResources.has(e)||this.invalidatedResources.set(e,new PUt(i,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":"  VALID"}] ${this.actual.constructor.name} - ${this.actual}`}},NUt=class{constructor(i,e){this.resourceLabel=i,this.strResource=e,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(let i of this._past)i.type===1&&i.removeResource(this.resourceLabel,this.strResource,0);for(let i of this._future)i.type===1&&i.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){let i=[];i.push(`* ${this.strResource}:`);for(let e=0;e<this._past.length;e++)i.push(`   * [UNDO] ${this._past[e]}`);for(let e=this._future.length-1;e>=0;e--)i.push(`   * [REDO] ${this._future[e]}`);return i.join(`
`)}flushAllElements(){this._past=[],this._future=[],this.versionId++}setElementsIsValid(i){for(let e of this._past)e.type===1?e.setValid(this.resourceLabel,this.strResource,i):e.setValid(i);for(let e of this._future)e.type===1?e.setValid(this.resourceLabel,this.strResource,i):e.setValid(i)}_setElementValidFlag(i,e){i.type===1?i.setValid(this.resourceLabel,this.strResource,e):i.setValid(e)}setElementsValidFlag(i,e){for(let t of this._past)e(t.actual)&&this._setElementValidFlag(t,i);for(let t of this._future)e(t.actual)&&this._setElementValidFlag(t,i)}pushElement(i){for(let e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(i),this.versionId++}createSnapshot(i){let e=[];for(let t=0,o=this._past.length;t<o;t++)e.push(this._past[t].id);for(let t=this._future.length-1;t>=0;t--)e.push(this._future[t].id);return new l8e(i,e)}restoreSnapshot(i){let e=i.elements.length,t=!0,o=0,n=-1;for(let s=0,l=this._past.length;s<l;s++,o++){let c=this._past[s];t&&(o>=e||c.id!==i.elements[o])&&(t=!1,n=s),!t&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}let r=-1;for(let s=this._future.length-1;s>=0;s--,o++){let l=this._future[s];t&&(o>=e||l.id!==i.elements[o])&&(t=!1,r=s),!t&&l.type===1&&l.removeResource(this.resourceLabel,this.strResource,0)}n!==-1&&(this._past=this._past.slice(0,n)),r!==-1&&(this._future=this._future.slice(r+1)),this.versionId++}getElements(){let i=[],e=[];for(let t of this._past)i.push(t.actual);for(let t of this._future)e.push(t.actual);return{past:i,future:e}}getClosestPastElement(){return this._past.length===0?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return this._future.length===0?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(i,e){for(let t=this._past.length-1;t>=0;t--)if(this._past[t]===i){e.has(this.strResource)?this._past[t]=e.get(this.strResource):this._past.splice(t,1);break}this.versionId++}splitFutureWorkspaceElement(i,e){for(let t=this._future.length-1;t>=0;t--)if(this._future[t]===i){e.has(this.strResource)?this._future[t]=e.get(this.strResource):this._future.splice(t,1);break}this.versionId++}moveBackward(i){this._past.pop(),this._future.push(i),this.versionId++}moveForward(i){this._future.pop(),this._past.push(i),this.versionId++}},git=class{constructor(i){this.editStacks=i,this._versionIds=[];for(let e=0,t=this.editStacks.length;e<t;e++)this._versionIds[e]=this.editStacks[e].versionId}isValid(){for(let i=0,e=this.editStacks.length;i<e;i++)if(this._versionIds[i]!==this.editStacks[i].versionId)return!1;return!0}},ivo=new NUt("","");ivo.locked=!0;var hit=class{constructor(i,e){this._dialogService=i;this._notificationService=e;this._editStacks=new Map,this._uriComparisonKeyComputers=[]}registerUriComparisonKeyComputer(i,e){return this._uriComparisonKeyComputers.push([i,e]),{dispose:()=>{for(let t=0,o=this._uriComparisonKeyComputers.length;t<o;t++)if(this._uriComparisonKeyComputers[t][1]===e){this._uriComparisonKeyComputers.splice(t,1);return}}}}getUriComparisonKey(i){for(let e of this._uriComparisonKeyComputers)if(e[0]===i.scheme)return e[1].getComparisonKey(i);return i.toString()}_print(i){console.log("------------------------------------"),console.log(`AFTER ${i}: `);let e=[];for(let t of this._editStacks)e.push(t[1].toString());console.log(e.join(`
`))}pushElement(i,e=DX.None,t=pK.None){if(i.type===0){let o=MUt(i.resource),n=this.getUriComparisonKey(i.resource);this._pushElement(new UPe(i,o,n,e.id,e.nextOrder(),t.id,t.nextOrder()))}else{let o=new Set,n=[],r=[];for(let s of i.resources){let l=MUt(s),c=this.getUriComparisonKey(s);o.has(c)||(o.add(c),n.push(l),r.push(c))}n.length===1?this._pushElement(new UPe(i,n[0],r[0],e.id,e.nextOrder(),t.id,t.nextOrder())):this._pushElement(new i_i(i,n,r,e.id,e.nextOrder(),t.id,t.nextOrder()))}HPe&&this._print("pushElement")}_pushElement(i){for(let e=0,t=i.strResources.length;e<t;e++){let o=i.resourceLabels[e],n=i.strResources[e],r;this._editStacks.has(n)?r=this._editStacks.get(n):(r=new NUt(o,n),this._editStacks.set(n,r)),r.pushElement(i)}}getLastElement(i){let e=this.getUriComparisonKey(i);if(this._editStacks.has(e)){let t=this._editStacks.get(e);if(t.hasFutureElements())return null;let o=t.getClosestPastElement();return o?o.actual:null}return null}_splitPastWorkspaceElement(i,e){let t=i.actual.split(),o=new Map;for(let n of t){let r=MUt(n.resource),s=this.getUriComparisonKey(n.resource),l=new UPe(n,r,s,0,0,0,0);o.set(l.strResource,l)}for(let n of i.strResources){if(e&&e.has(n))continue;this._editStacks.get(n).splitPastWorkspaceElement(i,o)}}_splitFutureWorkspaceElement(i,e){let t=i.actual.split(),o=new Map;for(let n of t){let r=MUt(n.resource),s=this.getUriComparisonKey(n.resource),l=new UPe(n,r,s,0,0,0,0);o.set(l.strResource,l)}for(let n of i.strResources){if(e&&e.has(n))continue;this._editStacks.get(n).splitFutureWorkspaceElement(i,o)}}removeElements(i){let e=typeof i=="string"?i:this.getUriComparisonKey(i);this._editStacks.has(e)&&(this._editStacks.get(e).dispose(),this._editStacks.delete(e)),HPe&&this._print("removeElements")}setElementsValidFlag(i,e,t){let o=this.getUriComparisonKey(i);this._editStacks.has(o)&&this._editStacks.get(o).setElementsValidFlag(e,t),HPe&&this._print("setElementsValidFlag")}hasElements(i){let e=this.getUriComparisonKey(i);if(this._editStacks.has(e)){let t=this._editStacks.get(e);return t.hasPastElements()||t.hasFutureElements()}return!1}createSnapshot(i){let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).createSnapshot(i):new l8e(i,[])}restoreSnapshot(i){let e=this.getUriComparisonKey(i.resource);if(this._editStacks.has(e)){let t=this._editStacks.get(e);t.restoreSnapshot(i),!t.hasPastElements()&&!t.hasFutureElements()&&(t.dispose(),this._editStacks.delete(e))}HPe&&this._print("restoreSnapshot")}getElements(i){let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).getElements():{past:[],future:[]}}_findClosestUndoElementWithSource(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestPastElement();r&&r.sourceId===i&&(!e||r.sourceOrder>e.sourceOrder)&&(e=r,t=o)}return[e,t]}canUndo(i){if(i instanceof pK){let[,t]=this._findClosestUndoElementWithSource(i.id);return!!t}let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).hasPastElements():!1}_onError(i,e){mt(i);for(let t of e.strResources)this.removeElements(t);this._notificationService.error(i)}_acquireLocks(i){for(let e of i.editStacks)if(e.locked)throw new Error("Cannot acquire edit stack lock");for(let e of i.editStacks)e.locked=!0;return()=>{for(let e of i.editStacks)e.locked=!1}}_safeInvokeWithLocks(i,e,t,o,n){let r=this._acquireLocks(t),s;try{s=e()}catch(l){return r(),o.dispose(),this._onError(l,i)}return s?s.then(()=>(r(),o.dispose(),n()),l=>(r(),o.dispose(),this._onError(l,i))):(r(),o.dispose(),n())}async _invokeWorkspacePrepare(i){if(typeof i.actual.prepareUndoRedo>"u")return k.None;let e=i.actual.prepareUndoRedo();return typeof e>"u"?k.None:e}_invokeResourcePrepare(i,e){if(i.actual.type!==1||typeof i.actual.prepareUndoRedo>"u")return e(k.None);let t=i.actual.prepareUndoRedo();return t?Sd(t)?e(t):t.then(o=>e(o)):e(k.None)}_getAffectedEditStacks(i){let e=[];for(let t of i.strResources)e.push(this._editStacks.get(t)||ivo);return new git(e)}_tryToSplitAndUndo(i,e,t,o){if(e.canSplit())return this._splitPastWorkspaceElement(e,t),this._notificationService.warn(o),new zPe(this._undo(i,0,!0));for(let n of e.strResources)this.removeElements(n);return this._notificationService.warn(o),new zPe}_checkWorkspaceUndo(i,e,t,o){if(e.removedResources)return this._tryToSplitAndUndo(i,e,e.removedResources,d(2932,null,e.label,e.removedResources.createMessage()));if(o&&e.invalidatedResources)return this._tryToSplitAndUndo(i,e,e.invalidatedResources,d(2932,null,e.label,e.invalidatedResources.createMessage()));let n=[];for(let s of t.editStacks)s.getClosestPastElement()!==e&&n.push(s.resourceLabel);if(n.length>0)return this._tryToSplitAndUndo(i,e,null,d(2933,null,e.label,n.join(", ")));let r=[];for(let s of t.editStacks)s.locked&&r.push(s.resourceLabel);return r.length>0?this._tryToSplitAndUndo(i,e,null,d(2935,null,e.label,r.join(", "))):t.isValid()?null:this._tryToSplitAndUndo(i,e,null,d(2934,null,e.label))}_workspaceUndo(i,e,t){let o=this._getAffectedEditStacks(e),n=this._checkWorkspaceUndo(i,e,o,!1);return n?n.returnValue:this._confirmAndExecuteWorkspaceUndo(i,e,o,t)}_isPartOfUndoGroup(i){if(!i.groupId)return!1;for(let[,e]of this._editStacks){let t=e.getClosestPastElement();if(t){if(t===i){let o=e.getSecondClosestPastElement();if(o&&o.groupId===i.groupId)return!0}if(t.groupId===i.groupId)return!0}}return!1}async _confirmAndExecuteWorkspaceUndo(i,e,t,o){if(e.canSplit()&&!this._isPartOfUndoGroup(e)){let s;(g=>(g[g.All=0]="All",g[g.This=1]="This",g[g.Cancel=2]="Cancel"))(s||={});let{result:l}=await this._dialogService.prompt({type:wt.Info,message:d(2939,null,e.label),buttons:[{label:d(2943,null,t.editStacks.length),run:()=>0},{label:d(2941,null),run:()=>1}],cancelButton:{run:()=>2}});if(l===2)return;if(l===1)return this._splitPastWorkspaceElement(e,null),this._undo(i,0,!0);let c=this._checkWorkspaceUndo(i,e,t,!1);if(c)return c.returnValue;o=!0}let n;try{n=await this._invokeWorkspacePrepare(e)}catch(s){return this._onError(s,e)}let r=this._checkWorkspaceUndo(i,e,t,!0);if(r)return n.dispose(),r.returnValue;for(let s of t.editStacks)s.moveBackward(e);return this._safeInvokeWithLocks(e,()=>e.actual.undo(),t,n,()=>this._continueUndoInGroup(e.groupId,o))}_resourceUndo(i,e,t){if(!e.isValid){i.flushAllElements();return}if(i.locked){let o=d(2927,null,e.label);this._notificationService.warn(o);return}return this._invokeResourcePrepare(e,o=>(i.moveBackward(e),this._safeInvokeWithLocks(e,()=>e.actual.undo(),new git([i]),o,()=>this._continueUndoInGroup(e.groupId,t))))}_findClosestUndoElementInGroup(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestPastElement();r&&r.groupId===i&&(!e||r.groupOrder>e.groupOrder)&&(e=r,t=o)}return[e,t]}_continueUndoInGroup(i,e){if(!i)return;let[,t]=this._findClosestUndoElementInGroup(i);if(t)return this._undo(t,0,e)}undo(i){if(i instanceof pK){let[,e]=this._findClosestUndoElementWithSource(i.id);return e?this._undo(e,i.id,!1):void 0}return typeof i=="string"?this._undo(i,0,!1):this._undo(this.getUriComparisonKey(i),0,!1)}_undo(i,e=0,t){if(!this._editStacks.has(i))return;let o=this._editStacks.get(i),n=o.getClosestPastElement();if(!n)return;if(n.groupId){let[s,l]=this._findClosestUndoElementInGroup(n.groupId);if(n!==s&&l)return this._undo(l,e,t)}if((n.sourceId!==e||n.confirmBeforeUndo)&&!t)return this._confirmAndContinueUndo(i,e,n);try{return n.type===1?this._workspaceUndo(i,n,t):this._resourceUndo(o,n,t)}finally{HPe&&this._print("undo")}}async _confirmAndContinueUndo(i,e,t){if((await this._dialogService.confirm({message:d(2936,null,t.label),primaryButton:d(2938,null),cancelButton:d(2937,null)})).confirmed)return this._undo(i,e,!0)}_findClosestRedoElementWithSource(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestFutureElement();r&&r.sourceId===i&&(!e||r.sourceOrder<e.sourceOrder)&&(e=r,t=o)}return[e,t]}canRedo(i){if(i instanceof pK){let[,t]=this._findClosestRedoElementWithSource(i.id);return!!t}let e=this.getUriComparisonKey(i);return this._editStacks.has(e)?this._editStacks.get(e).hasFutureElements():!1}_tryToSplitAndRedo(i,e,t,o){if(e.canSplit())return this._splitFutureWorkspaceElement(e,t),this._notificationService.warn(o),new zPe(this._redo(i));for(let n of e.strResources)this.removeElements(n);return this._notificationService.warn(o),new zPe}_checkWorkspaceRedo(i,e,t,o){if(e.removedResources)return this._tryToSplitAndRedo(i,e,e.removedResources,d(2928,null,e.label,e.removedResources.createMessage()));if(o&&e.invalidatedResources)return this._tryToSplitAndRedo(i,e,e.invalidatedResources,d(2928,null,e.label,e.invalidatedResources.createMessage()));let n=[];for(let s of t.editStacks)s.getClosestFutureElement()!==e&&n.push(s.resourceLabel);if(n.length>0)return this._tryToSplitAndRedo(i,e,null,d(2929,null,e.label,n.join(", ")));let r=[];for(let s of t.editStacks)s.locked&&r.push(s.resourceLabel);return r.length>0?this._tryToSplitAndRedo(i,e,null,d(2931,null,e.label,r.join(", "))):t.isValid()?null:this._tryToSplitAndRedo(i,e,null,d(2930,null,e.label))}_workspaceRedo(i,e){let t=this._getAffectedEditStacks(e),o=this._checkWorkspaceRedo(i,e,t,!1);return o?o.returnValue:this._executeWorkspaceRedo(i,e,t)}async _executeWorkspaceRedo(i,e,t){let o;try{o=await this._invokeWorkspacePrepare(e)}catch(r){return this._onError(r,e)}let n=this._checkWorkspaceRedo(i,e,t,!0);if(n)return o.dispose(),n.returnValue;for(let r of t.editStacks)r.moveForward(e);return this._safeInvokeWithLocks(e,()=>e.actual.redo(),t,o,()=>this._continueRedoInGroup(e.groupId))}_resourceRedo(i,e){if(!e.isValid){i.flushAllElements();return}if(i.locked){let t=d(2926,null,e.label);this._notificationService.warn(t);return}return this._invokeResourcePrepare(e,t=>(i.moveForward(e),this._safeInvokeWithLocks(e,()=>e.actual.redo(),new git([i]),t,()=>this._continueRedoInGroup(e.groupId))))}_findClosestRedoElementInGroup(i){if(!i)return[null,null];let e=null,t=null;for(let[o,n]of this._editStacks){let r=n.getClosestFutureElement();r&&r.groupId===i&&(!e||r.groupOrder<e.groupOrder)&&(e=r,t=o)}return[e,t]}_continueRedoInGroup(i){if(!i)return;let[,e]=this._findClosestRedoElementInGroup(i);if(e)return this._redo(e)}redo(i){if(i instanceof pK){let[,e]=this._findClosestRedoElementWithSource(i.id);return e?this._redo(e):void 0}return typeof i=="string"?this._redo(i):this._redo(this.getUriComparisonKey(i))}_redo(i){if(!this._editStacks.has(i))return;let e=this._editStacks.get(i),t=e.getClosestFutureElement();if(t){if(t.groupId){let[o,n]=this._findClosestRedoElementInGroup(t.groupId);if(t!==o&&n)return this._redo(n)}try{return t.type===1?this._workspaceRedo(i,t):this._resourceRedo(e,t)}finally{HPe&&this._print("redo")}}}};hit=I([m(0,ct),m(1,Ne)],hit);var zPe=class{constructor(i){this.returnValue=i}};Ce(wl,hit,1);var $te=le("IMcpResourceScannerService"),fit=class extends k{constructor(e,t){super();this.fileService=e;this.uriIdentityService=t;this.resourcesAccessQueueMap=new dt}async scanMcpServers(e,t){return this.withProfileMcpServers(e,t)}async addMcpServers(e,t,o){await this.withProfileMcpServers(t,o,n=>{let r=n.inputs??[],s=n.servers??{};for(let{name:l,config:c,inputs:u}of e)if(s[l]=c,u){let p=new Set(r.map(g=>g.id)),h=u.filter(g=>!p.has(g.id));r=[...r,...h]}return{servers:s,inputs:r,sandbox:n.sandbox}})}async updateSandboxConfig(e,t,o){await this.withProfileMcpServers(t,o,e)}async removeMcpServers(e,t,o){await this.withProfileMcpServers(t,o,n=>{for(let r of e)n.servers?.[r]&&delete n.servers[r];return n})}async withProfileMcpServers(e,t,o){return this.getResourceAccessQueue(e).queue(async()=>{t=t??2;let n={};try{let r=await this.fileService.readFile(e),s=[],l=is(r.value.toString(),s,{allowTrailingComma:!0,allowEmptyContent:!0})||{};if(s.length>0)throw new Error("Failed to parse scanned MCP servers: "+s.join(", "));if(t===2)n=this.fromUserMcpServers(l);else if(t===6)n=this.fromWorkspaceFolderMcpServers(l);else if(t===5){let c=l;c.settings?.mcp&&(n=this.fromWorkspaceFolderMcpServers(c.settings?.mcp))}}catch(r){if(rp(r)!==1)throw r}return o&&(n=o(n??{}),t===2?await this.writeScannedMcpServers(e,n):t===6?await this.writeScannedMcpServersToWorkspaceFolder(e,n):t===5?await this.writeScannedMcpServersToWorkspace(e,n):bs(t,`Invalid Target: ${HY(t)}`)),n})}async writeScannedMcpServers(e,t){t.servers&&Object.keys(t.servers).length>0||t.inputs&&t.inputs.length>0||t.sandbox!==void 0?await this.fileService.writeFile(e,Ke.fromString(JSON.stringify(t,null,"	"))):await this.fileService.del(e)}async writeScannedMcpServersToWorkspaceFolder(e,t){await this.fileService.writeFile(e,Ke.fromString(JSON.stringify(t,null,"	")))}async writeScannedMcpServersToWorkspace(e,t){let o;try{let n=await this.fileService.readFile(e),r=[];if(o=is(n.value.toString(),r,{allowTrailingComma:!0,allowEmptyContent:!0}),r.length>0)throw new Error("Failed to parse scanned MCP servers: "+r.join(", "))}catch(n){if(rp(n)!==1)throw n;o={settings:{}}}o.settings||(o.settings={}),o.settings.mcp=t,await this.fileService.writeFile(e,Ke.fromString(JSON.stringify(o,null,"	")))}fromUserMcpServers(e){let t={inputs:e.inputs,sandbox:e.sandbox},o=Object.entries(e.servers??{});if(o.length>0){t.servers={};for(let[n,r]of o)t.servers[n]=this.sanitizeServer(r)}return t}fromWorkspaceFolderMcpServers(e){let t={inputs:e.inputs,sandbox:e.sandbox},o=Object.entries(e.servers??{});if(o.length>0){t.servers={};for(let[n,r]of o){let s=this.sanitizeServer(r);t.servers[n]=s}}return t}sanitizeServer(e){let t;if(e.config){let o=e;t={...o.config,version:o.version,gallery:o.gallery}}else t=e;return(t.type===void 0||t.type!=="http"&&t.type!=="stdio")&&(t.type=t.command?"stdio":"http"),t}getResourceAccessQueue(e){let t=this.resourcesAccessQueueMap.get(e);return t||(t=new Hh,this.resourcesAccessQueueMap.set(e,t)),t}};fit=I([m(0,ge),m(1,gt)],fit);Ce($te,fit,1);var vit=class{constructor(i,e){this._extensionService=i;this._logService=e;this._editSessionIdentifierProviders=new Map;this._participants=[]}registerEditSessionIdentityProvider(i){if(this._editSessionIdentifierProviders.get(i.scheme))throw new Error(`A provider has already been registered for scheme ${i.scheme}`);return this._editSessionIdentifierProviders.set(i.scheme,i),ee(()=>{this._editSessionIdentifierProviders.delete(i.scheme)})}async getEditSessionIdentifier(i,e){let{scheme:t}=i.uri,o=await this.activateProvider(t);return this._logService.trace(`EditSessionIdentityProvider for scheme ${t} available: ${!!o}`),o?.getEditSessionIdentifier(i,e)}async provideEditSessionIdentityMatch(i,e,t,o){let{scheme:n}=i.uri,r=await this.activateProvider(n);return this._logService.trace(`EditSessionIdentityProvider for scheme ${n} available: ${!!r}`),r?.provideEditSessionIdentityMatch?.(i,e,t,o)}async onWillCreateEditSessionIdentity(i,e){this._logService.debug("Running onWillCreateEditSessionIdentity participants...");for(let t of this._participants)await t.participate(i,e);this._logService.debug(`Done running ${this._participants.length} onWillCreateEditSessionIdentity participants.`)}addEditSessionIdentityCreateParticipant(i){let e=vg(this._participants,i);return ee(()=>e())}async activateProvider(i){let e=i==="vscode-remote"?"file":i,t=this._editSessionIdentifierProviders.get(i);return t||(await this._extensionService.activateByEvent(`onEditSession:${e}`),this._editSessionIdentifierProviders.get(i))}};vit=I([m(0,lt),m(1,re)],vit);Ce(mG,vit,1);var o_i=class{constructor(){this._providers=new Map}registerCanonicalUriProvider(i){return this._providers.set(i.scheme,i),{dispose:()=>this._providers.delete(i.scheme)}}async provideCanonicalUri(i,e,t){let o=this._providers.get(i.scheme);if(o)return o.provideCanonicalUri(i,e,t)}};Ce(EFt,o_i,1);var n_i=le("keybindingEditingService"),bit=class extends k{constructor(e,t,o,n){super();this.textModelResolverService=e;this.textFileService=t;this.fileService=o;this.userDataProfileService=n;this.queue=new Hh}addKeybinding(e,t,o){return this.queue.queue(()=>this.doEditKeybinding(e,t,o,!0))}editKeybinding(e,t,o){return this.queue.queue(()=>this.doEditKeybinding(e,t,o,!1))}resetKeybinding(e){return this.queue.queue(()=>this.doResetKeybinding(e))}removeKeybinding(e){return this.queue.queue(()=>this.doRemoveKeybinding(e))}async doEditKeybinding(e,t,o,n){let r=await this.resolveAndValidate(),s=r.object.textEditorModel;if(n)this.updateKeybinding(e,t,o,s,-1);else{let l=is(s.getValue()),c=this.findUserKeybindingEntryIndex(e,l);this.updateKeybinding(e,t,o,s,c),e.isDefault&&e.resolvedKeybinding&&this.removeDefaultKeybinding(e,s)}try{await this.save()}finally{r.dispose()}}async doRemoveKeybinding(e){let t=await this.resolveAndValidate(),o=t.object.textEditorModel;e.isDefault?this.removeDefaultKeybinding(e,o):this.removeUserKeybinding(e,o);try{return await this.save()}finally{t.dispose()}}async doResetKeybinding(e){let t=await this.resolveAndValidate(),o=t.object.textEditorModel;e.isDefault||(this.removeUserKeybinding(e,o),this.removeUnassignedDefaultKeybinding(e,o));try{return await this.save()}finally{t.dispose()}}save(){return this.textFileService.save(this.userDataProfileService.currentProfile.keybindingsResource)}updateKeybinding(e,t,o,n,r){let{tabSize:s,insertSpaces:l}=n.getOptions(),c=n.getEOL();if(r!==-1){this.applyEditsToBuffer(rS(n.getValue(),[r,"key"],t,{tabSize:s,insertSpaces:l,eol:c})[0],n);let u=rS(n.getValue(),[r,"when"],o,{tabSize:s,insertSpaces:l,eol:c});u.length>0&&this.applyEditsToBuffer(u[0],n)}else this.applyEditsToBuffer(rS(n.getValue(),[-1],this.asObject(t,e.command,o,!1),{tabSize:s,insertSpaces:l,eol:c})[0],n)}removeUserKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=is(t.getValue()),l=this.findUserKeybindingEntryIndex(e,s);l!==-1&&this.applyEditsToBuffer(rS(t.getValue(),[l],void 0,{tabSize:o,insertSpaces:n,eol:r})[0],t)}removeDefaultKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=e.resolvedKeybinding?e.resolvedKeybinding.getUserSettingsLabel():null;if(s){let l=this.asObject(s,e.command,e.when?e.when.serialize():void 0,!0);is(t.getValue()).every(u=>!this.areSame(u,l))&&this.applyEditsToBuffer(rS(t.getValue(),[-1],l,{tabSize:o,insertSpaces:n,eol:r})[0],t)}}removeUnassignedDefaultKeybinding(e,t){let{tabSize:o,insertSpaces:n}=t.getOptions(),r=t.getEOL(),s=is(t.getValue()),l=this.findUnassignedDefaultKeybindingEntryIndex(e,s).reverse();for(let c of l)this.applyEditsToBuffer(rS(t.getValue(),[c],void 0,{tabSize:o,insertSpaces:n,eol:r})[0],t)}findUserKeybindingEntryIndex(e,t){for(let o=0;o<t.length;o++){let n=t[o];if(n.command===e.command){if(!n.when&&!e.when)return o;if(n.when&&e.when){let r=C.deserialize(n.when);if(r&&r.serialize()===e.when.serialize())return o}}}return-1}findUnassignedDefaultKeybindingEntryIndex(e,t){let o=[];for(let n=0;n<t.length;n++)t[n].command===`-${e.command}`&&o.push(n);return o}asObject(e,t,o,n){let r={key:e};return t&&(r.command=n?`-${t}`:t),o&&(r.when=o),r}areSame(e,t){if(e.command!==t.command||e.key!==t.key)return!1;let o=C.deserialize(e.when),n=C.deserialize(t.when);return!(o&&!n||!o&&n||o&&n&&!o.equals(n)||!Qi(e.args,t.args))}applyEditsToBuffer(e,t){let o=t.getPositionAt(e.offset),n=t.getPositionAt(e.offset+e.length),r=new G(o.lineNumber,o.column,n.lineNumber,n.column),l=t.getValueInRange(r)?Qn.replace(r,e.content):Qn.insert(o,e.content);t.pushEditOperations([new ei(o.lineNumber,o.column,o.lineNumber,o.column)],[l],()=>[])}async resolveModelReference(){return await this.fileService.exists(this.userDataProfileService.currentProfile.keybindingsResource)||await this.textFileService.write(this.userDataProfileService.currentProfile.keybindingsResource,this.getEmptyContent(),{encoding:"utf8"}),this.textModelResolverService.createModelReference(this.userDataProfileService.currentProfile.keybindingsResource)}async resolveAndValidate(){if(this.textFileService.isDirty(this.userDataProfileService.currentProfile.keybindingsResource))throw new Error(d(19121,null));let e=await this.resolveModelReference(),t=e.object.textEditorModel,o=t.getEOL();if(t.getValue()){let n=this.parse(t);if(n.parseErrors.length)throw e.dispose(),new Error(d(19122,null));if(n.result){if(!Array.isArray(n.result))throw e.dispose(),new Error(d(19120,null))}else{let r=o+"[]";this.applyEditsToBuffer({content:r,length:r.length,offset:t.getValue().length},t)}}else{let n=this.getEmptyContent();this.applyEditsToBuffer({content:n,length:n.length,offset:0},t)}return e}parse(e){let t=[];return{result:is(e.getValue(),t,{allowTrailingComma:!0,allowEmptyContent:!0}),parseErrors:t}}getEmptyContent(){return"// "+d(19119,null)+`
[
]`}};bit=I([m(0,Bt),m(1,Uo),m(2,ge),m(3,gn)],bit);Ce(n_i,bit,1);var OUt=class a{constructor(i,e,t){this.themeService=i;this._refCounter=0;this.data=e;let o=Lr(t).toString(36);this.itemColorClassName=`${a._classNamesPrefix}-itemColor-${o}`,this.itemBadgeClassName=`${a._classNamesPrefix}-itemBadge-${o}`,this.bubbleBadgeClassName=`${a._classNamesPrefix}-bubbleBadge-${o}`,this.iconBadgeClassName=`${a._classNamesPrefix}-iconBadge-${o}`}static keyOf(i){if(Array.isArray(i))return i.map(a.keyOf).join(",");{let{color:e,letter:t}=i;return q.isThemeIcon(t)?`${e}+${t.id}`:`${e}/${t}`}}static{this._classNamesPrefix="monaco-decoration"}acquire(){this._refCounter+=1}release(){return--this._refCounter===0}appendCSSRules(i){Array.isArray(this.data)?this._appendForMany(this.data,i):this._appendForOne(this.data,i)}_appendForOne(i,e){let{color:t,letter:o}=i;Eg(`.${this.itemColorClassName}`,`color: ${Khe(t)};`,e),q.isThemeIcon(o)?this._createIconCSSRule(o,t,e):o&&Eg(`.${this.itemBadgeClassName}::after`,`content: "${o}"; color: ${Khe(t)};`,e)}_appendForMany(i,e){let{color:t}=i.find(r=>!!r.color)??i[0];Eg(`.${this.itemColorClassName}`,`color: ${Khe(t)};`,e);let o=[],n;for(let r of i)if(q.isThemeIcon(r.letter)){n=r.letter;break}else r.letter&&o.push(r.letter);n?this._createIconCSSRule(n,t,e):(o.length&&Eg(`.${this.itemBadgeClassName}::after`,`content: "${o.join(", ")}"; color: ${Khe(t)};`,e),Eg(`.${this.bubbleBadgeClassName}::after`,`content: "\uEA71"; color: ${Khe(t)}; font-family: codicon; font-size: 14px; margin-right: 14px; opacity: 0.4;`,e))}_createIconCSSRule(i,e,t){let o=q.getModifier(i);o&&(i=q.modify(i,void 0));let n=Zw().getIcon(i.id);if(!n)return;let r=this.themeService.getProductIconTheme().getIcon(n);r&&Eg(`.${this.iconBadgeClassName}::after`,`content: '${r.fontCharacter}';
			color: ${i.color?Khe(i.color.id):Khe(e)};
			font-family: ${FI(r.font?.id??"codicon")};
			font-size: 16px;
			margin-right: 14px;
			font-weight: normal;
			${o==="spin"?"animation: codicon-spin 1.5s steps(30) infinite; font-style: normal !important; transform-origin: center center;":""};
			`,t)}removeCSSRules(i){xF(this.itemColorClassName,i),xF(this.itemBadgeClassName,i),xF(this.bubbleBadgeClassName,i),xF(this.iconBadgeClassName,i)}},r_i=class{constructor(i){this._themeService=i;this._dispoables=new O;this._styleElement=Pr(void 0,void 0,this._dispoables);this._decorationRules=new Map}dispose(){this._dispoables.dispose()}asDecoration(i,e){i.sort((u,p)=>(p.weight||0)-(u.weight||0));let t=OUt.keyOf(i),o=this._decorationRules.get(t);o||(o=new OUt(this._themeService,i,t),this._decorationRules.set(t,o),o.appendCSSRules(this._styleElement)),o.acquire();let n=o.itemColorClassName,r=o.itemBadgeClassName,s=o.iconBadgeClassName,l=jo(i.filter(u=>!_c(u.tooltip)).map(u=>u.tooltip)).join(" \u2022 "),c=i.some(u=>u.strikethrough);return e&&(r=o.bubbleBadgeClassName,l=d(18796,null)),{labelClassName:n,badgeClassName:r,iconClassName:s,strikethrough:c,tooltip:l,dispose:()=>{o?.release()&&(this._decorationRules.delete(t),o.removeCSSRules(this._styleElement),o=void 0)}}}},s_i=class{constructor(i){this._data=Hp.forUris(i=>!0);this._data.fill(!0,Ec(i))}affectsResource(i){return this._data.hasElementOrSubtree(i)}},KPe=class{constructor(i,e){this.source=i;this.thenable=e}};function Khe(a){return a?Tt(a):"inherit"}var Sit=class{constructor(i,e){this._store=new O;this._onDidChangeDecorationsDelayed=this._store.add(new Zye({merge:i=>i.flat()}));this._onDidChangeDecorations=this._store.add(new T);this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._provider=new ra;this._decorationStyles=new r_i(e),this._data=Hp.forUris(t=>i.extUri.ignorePathCasing(t)),this._store.add(this._onDidChangeDecorationsDelayed.event(t=>{this._onDidChangeDecorations.fire(new s_i(t))}))}dispose(){this._store.dispose(),this._data.clear()}registerDecorationsProvider(i){let e=this._provider.unshift(i);this._onDidChangeDecorations.fire({affectsResource(){return!0}});let t=()=>{let n=[];for(let[r,s]of this._data)s.delete(i)&&n.push(r);n.length>0&&this._onDidChangeDecorationsDelayed.fire(n)},o=i.onDidChange(n=>{if(!n)t();else for(let r of n){let s=this._ensureEntry(r);this._fetchData(s,r,i)}});return ee(()=>{e(),o.dispose(),t()})}_ensureEntry(i){let e=this._data.get(i);return e||(e=new Map,this._data.set(i,e)),e}getDecoration(i,e){let t=[],o=!1,n=this._ensureEntry(i);for(let r of this._provider){let s=n.get(r);s===void 0&&(s=this._fetchData(n,i,r)),s&&!(s instanceof KPe)&&t.push(s)}if(e){let r=this._data.findSuperstr(i);if(r)for(let s of r)for(let l of s[1].values())l&&!(l instanceof KPe)&&l.bubble&&(t.push(l),o=!0)}return t.length===0?void 0:this._decorationStyles.asDecoration(t,o)}_fetchData(i,e,t){let o=i.get(t);o instanceof KPe&&(o.source.cancel(),i.delete(t));let n=new qe,r=t.provideDecorations(e,n.token);if(aD(r)){let s=new KPe(n,Promise.resolve(r).then(l=>{i.get(t)===s&&this._keepItem(i,t,e,l)}).catch(l=>{!Yi(l)&&i.get(t)===s&&i.delete(t)}).finally(()=>{n.dispose()}));return i.set(t,s),null}else return n.dispose(),this._keepItem(i,t,e,r)}_keepItem(i,e,t,o){let n=o||null,r=i.get(e);return i.set(e,n),(n||r)&&this._onDidChangeDecorationsDelayed.fire(t),n}};Sit=I([m(0,gt),m(1,Pe)],Sit);Ce(mb,Sit,1);var FUt=class extends k{constructor(){super(...arguments);this.dialogs=[];this._onWillShowDialog=this._register(new T);this.onWillShowDialog=this._onWillShowDialog.event;this._onDidShowDialog=this._register(new T);this.onDidShowDialog=this._onDidShowDialog.event}show(e){let t=new Mo,o={args:e,close:n=>{this.dialogs.splice(0,1),n instanceof Error?t.error(n):t.complete(n),this._onDidShowDialog.fire()}};return this.dialogs.push(o),this._onWillShowDialog.fire(),{item:o,result:t.p}}};var Iit=class extends k{constructor(e,t){super();this.environmentService=e;this.logService=t;this.model=this._register(new FUt);this.onWillShowDialog=this.model.onWillShowDialog;this.onDidShowDialog=this.model.onDidShowDialog}skipDialogs(){return this.environmentService.enableSmokeTestDriver&&this.logService.warn("DialogService: Dialog requested during smoke test."),this.environmentService.isExtensionDevelopment&&!!this.environmentService.extensionTestsLocationURI}async confirm(e){return this.skipDialogs()?(this.logService.trace("DialogService: refused to show confirmation dialog in tests."),{confirmed:!0}):await this.model.show({confirmArgs:{confirmation:e}}).result}async prompt(e){if(this.skipDialogs())throw new Error(`DialogService: refused to show dialog in tests. Contents: ${e.message}`);let o=await this.model.show({promptArgs:{prompt:e}}).result;return{result:await o.result,checkboxChecked:o.checkboxChecked}}async input(e){if(this.skipDialogs())throw new Error("DialogService: refused to show input dialog in tests.");return await this.model.show({inputArgs:{input:e}}).result}async info(e,t){await this.prompt({type:wt.Info,message:e,detail:t})}async warn(e,t){await this.prompt({type:wt.Warning,message:e,detail:t})}async error(e,t){await this.prompt({type:wt.Error,message:e,detail:t})}async about(){if(this.skipDialogs())throw new Error("DialogService: refused to show about dialog in tests.");await this.model.show({}).result}};Iit=I([m(0,Mt),m(1,re)],Iit);Ce(ct,Iit,1);var jte=class extends k{constructor(e,t,o,n){super();this.container=e;this.message=t;this.options=n;if(this.modalElement=this.container.appendChild(_(".monaco-dialog-modal-block.dimmed")),this._register(Yo(this.modalElement,ne.CLICK,c=>{c.target===this.modalElement&&this.element.focus()})),this.shadowElement=this.modalElement.appendChild(_(".dialog-shadow")),this.element=this.shadowElement.appendChild(_(".monaco-dialog-box")),n.alignment===1&&this.element.classList.add("align-vertical"),n.extraClasses&&this.element.classList.add(...n.extraClasses),this.element.setAttribute("role","dialog"),this.element.tabIndex=-1,Wi(this.element),this.options.renderFooter){this.footerContainer=this.element.appendChild(_(".dialog-footer-row"));let c=this.footerContainer.appendChild(_("#monaco-dialog-footer.dialog-footer"));this.options.renderFooter(c);for(let u of this.footerContainer.querySelectorAll("a"))u.tabIndex=0}this.buttonStyles=n.buttonStyles,Array.isArray(o)&&o.length>0?this.buttons=o:this.options.disableDefaultAction?this.buttons=[]:this.buttons=[d(7,null)];let r=this.element.appendChild(_(".dialog-buttons-row"));this.buttonsContainer=r.appendChild(_(".dialog-buttons"));let s=this.element.appendChild(_(".dialog-message-row"));if(this.iconElement=s.appendChild(_("#monaco-dialog-icon.dialog-icon")),this.iconElement.setAttribute("aria-label",this.getIconAriaLabel()),this.messageContainer=s.appendChild(_(".dialog-message-container")),this.options.detail||this.options.renderBody){let u=this.messageContainer.appendChild(_(".dialog-message")).appendChild(_("#monaco-dialog-message-text.dialog-message-text"));u.innerText=this.message}if(this.messageDetailElement=this.messageContainer.appendChild(_("#monaco-dialog-message-detail.dialog-message-detail")),this.options.detail||!this.options.renderBody?this.messageDetailElement.innerText=this.options.detail?this.options.detail:t:this.messageDetailElement.style.display="none",this.options.renderBody){let c=this.messageContainer.appendChild(_("#monaco-dialog-message-body.dialog-message-body"));this.options.renderBody(c);for(let u of this.messageContainer.querySelectorAll("a"))u.tabIndex=0}if(this.options.inputs?this.inputs=this.options.inputs.map(c=>{let u=this.messageContainer.appendChild(_(".dialog-message-input")),p=this._register(new ad(u,void 0,{placeholder:c.placeholder,type:c.type??"text",inputBoxStyles:n.inputBoxStyles}));return c.value&&(p.value=c.value),p}):this.inputs=[],this.options.checkboxLabel){let c=this.messageContainer.appendChild(_(".dialog-checkbox-row")),u=this.checkbox=this._register(new qf(this.options.checkboxLabel,!!this.options.checkboxChecked,n.checkboxStyles));c.appendChild(u.domNode);let p=c.appendChild(_(".dialog-checkbox-message"));p.innerText=this.options.checkboxLabel,this._register($(p,ne.CLICK,()=>u.checked=!u.checked))}let l=this.element.appendChild(_(".dialog-toolbar-row"));this.toolbarContainer=l.appendChild(_(".dialog-toolbar")),this.applyStyles()}getIconAriaLabel(){let e=d(4,null);switch(this.options.type){case"error":e=d(3,null);break;case"warning":e=d(6,null);break;case"pending":e=d(5,null);break;default:break}return e}updateMessage(e){this.messageDetailElement.innerText=e}async show(){return this.focusToReturn=this.container.ownerDocument.activeElement,new Promise(e=>{St(this.buttonsContainer);let t=()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})};this._register(ee(t));let o=this.buttonBar=this._register(new sC(this.buttonsContainer,{alignment:this.options?.alignment===1?1:0})),n=this.rearrangeButtons(this.buttons,this.options.cancelId),r=u=>{e({button:n[u].index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(p=>p.value):void 0})};n.forEach((u,p)=>{let h=n[p].index===0,g,f=this.options.buttonOptions?.[n[p]?.index];if(h&&this.options?.primaryButtonDropdown){let v=ieo(this.options.primaryButtonDropdown.actions)?this.options.primaryButtonDropdown.actions.getActions():this.options.primaryButtonDropdown.actions;g=this._register(o.addButtonWithDropdown({...this.options.primaryButtonDropdown,...this.buttonStyles,dropdownLayer:2600,actions:v.map(b=>li({...b,run:async()=>{await b.run(),r(p)}}))}))}else f?.sublabel?g=this._register(o.addButtonWithDescription({secondary:!h,...this.buttonStyles})):g=this._register(o.addButton({secondary:!h,...this.buttonStyles}));f?.styleButton&&f.styleButton(g),g.label=FB(n[p].label,!0),g instanceof BQe&&f?.sublabel&&(g.description=f?.sublabel),this._register(g.onDidClick(v=>{v&&Kt.stop(v),r(p)}))});let s=Me(this.container),l=!1;this._register($(s,"keydown",u=>{let p=new mi(u);if(p.equals(9)&&(l=!0),p.equals(512)&&p.preventDefault(),p.equals(3)){this.inputs.some(g=>g.hasFocus())&&(Kt.stop(u),e({button:n.find(g=>g.index!==this.options.cancelId)?.index??0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(g=>g.value):void 0}));return}if(et&&p.equals(2082)){Kt.stop(u);let g=n.find(f=>f.index===1&&f.index!==this.options.cancelId);g&&e({button:g.index,checkboxChecked:this.checkbox?this.checkbox.checked:void 0,values:this.inputs.length>0?this.inputs.map(f=>f.value):void 0});return}if(p.equals(10))return;let h=!1;if(p.equals(2)||p.equals(17)||p.equals(1026)||p.equals(15)){let g=[],f=-1;if(this.messageContainer){let v=this.messageContainer.querySelectorAll("a");for(let b of v)g.push(b),Na(b)&&(f=g.length-1)}for(let v of this.inputs)g.push(v),v.hasFocus()&&(f=g.length-1);if(this.checkbox&&(g.push(this.checkbox),this.checkbox.hasFocus()&&(f=g.length-1)),this.buttonBar)for(let v of this.buttonBar.buttons)v instanceof Jv?(g.push(v.primaryButton),v.primaryButton.hasFocus()&&(f=g.length-1),g.push(v.dropdownButton),v.dropdownButton.hasFocus()&&(f=g.length-1)):(g.push(v),v.hasFocus()&&(f=g.length-1));if(this.footerContainer){let v=this.footerContainer.querySelectorAll("a");for(let b of v)g.push(b),Na(b)&&(f=g.length-1)}if(p.equals(2)||p.equals(17)){let v=(f+1)%g.length;g[v].focus()}else{f===-1&&(f=g.length);let v=f-1;v===-1&&(v=g.length-1),g[v].focus()}h=!0}h?Kt.stop(u,!0):this.options.keyEventProcessor&&this.options.keyEventProcessor(p)},!0)),this._register($(s,"keyup",u=>{Kt.stop(u,!0);let p=new mi(u);!this.options.disableCloseAction&&p.equals(9)&&l&&t()},!0)),this._register($(this.element,"focusout",u=>{u.relatedTarget&&this.element&&(ms(u.relatedTarget,this.element)||(this.focusToReturn=u.relatedTarget,u.target&&(u.target.focus(),Kt.stop(u,!0))))},!1));let c="codicon-modifier-spin";if(this.iconElement.classList.remove(...q.asClassNameArray(L.dialogError),...q.asClassNameArray(L.dialogWarning),...q.asClassNameArray(L.dialogInfo),...q.asClassNameArray(L.loading),c),this.options.icon)this.iconElement.classList.add(...q.asClassNameArray(this.options.icon));else switch(this.options.type){case"error":this.iconElement.classList.add(...q.asClassNameArray(L.dialogError));break;case"warning":this.iconElement.classList.add(...q.asClassNameArray(L.dialogWarning));break;case"pending":this.iconElement.classList.add(...q.asClassNameArray(L.loading),c);break;case"none":this.iconElement.classList.add("no-codicon");break;default:this.iconElement.classList.add(...q.asClassNameArray(L.dialogInfo));break}if(!this.options.disableCloseAction&&!this.options.disableCloseButton){let u=this._register(new oo(this.toolbarContainer,{})),p=this._register(new it("dialog.close",d(2,null),q.asClassName(L.dialogClose),!0,async()=>{e({button:this.options.cancelId||0,checkboxChecked:this.checkbox?this.checkbox.checked:void 0})}));u.push(p,{icon:!0,label:!1})}this.applyStyles(),this.element.setAttribute("aria-modal","true"),this.element.setAttribute("aria-labelledby","monaco-dialog-icon monaco-dialog-message-text"),this.element.setAttribute("aria-describedby","monaco-dialog-icon monaco-dialog-message-text monaco-dialog-message-detail monaco-dialog-message-body monaco-dialog-footer"),Xo(this.element),this.options.onVisibilityChange?.(s,!0),this._register(ee(()=>this.options.onVisibilityChange?.(s,!1))),this.inputs.length>0?(this.inputs[0].focus(),this.inputs[0].select()):n.forEach((u,p)=>{u.index===0&&o.buttons[p].focus()})})}applyStyles(){let e=this.options.dialogStyles,t=e.dialogForeground,o=e.dialogBackground,n=e.dialogShadow?`0 0px 8px ${e.dialogShadow}`:"",r=e.dialogBorder?`1px solid ${e.dialogBorder}`:"",s=e.textLinkForeground;if(this.shadowElement.style.boxShadow=n,this.element.style.color=t??"",this.element.style.backgroundColor=o??"",this.element.style.border=r,s)for(let c of[...this.messageContainer.getElementsByTagName("a"),...this.footerContainer?.getElementsByTagName("a")??[]])c.style.color=s;let l;switch(this.options.type){case"none":break;case"error":l=e.errorIconForeground;break;case"warning":l=e.warningIconForeground;break;default:l=e.infoIconForeground;break}l&&(this.iconElement.style.color=l)}dispose(){super.dispose(),this.modalElement&&(this.modalElement.remove(),this.modalElement=void 0),this.focusToReturn&&ms(this.focusToReturn,this.container.ownerDocument.body)&&(this.focusToReturn.focus(),this.focusToReturn=void 0)}rearrangeButtons(e,t){let o=e.map((n,r)=>({label:n,index:r}));if(e.length<2||this.options.alignment===1)return o;if(et||Sn){if(typeof t=="number"&&o[t]){let n=o.splice(t,1)[0];o.splice(1,0,n)}o.reverse()}else if(ii&&typeof t=="number"&&o[t]){let n=o.splice(t,1)[0];o.push(n)}return o}};var gon=new Set(["workbench.action.quit","workbench.action.reloadWindow","copy","cut","editor.action.selectAll","editor.action.clipboardCopyAction","editor.action.clipboardCutAction","editor.action.clipboardPasteAction"]);function GPe(a,i,e,t,o=gon){return{keyEventProcessor:n=>{let r=i.softDispatch(n,e.activeContainer);r.kind===2&&r.commandId&&(o.has(r.commandId)||Kt.stop(n,!0))},buttonStyles:Ro,checkboxStyles:Ag,inputBoxStyles:Wl,dialogStyles:meo,onVisibilityChange:(n,r)=>t.setWindowDimmed(n,r),...a}}var yit=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.activityService=e;this.paneCompositeService=t;this.viewDescriptorService=o;this.viewsService=n;this.notificationService=r;this.statusbarService=s;this.layoutService=l;this.keybindingService=c;this.userActivityService=u;this.hostService=p;this.windowProgressStack=[];this.windowProgressStatusEntry=void 0}async withProgress(e,t,o){let{location:n}=e,r=async l=>{let c=this.userActivityService.markActive({extendOnly:!0,whenHeldFor:15e3});try{return await t(l)}finally{c.dispose()}},s=l=>{let c=this.viewDescriptorService.getViewContainerById(l);if(c){let u=this.viewDescriptorService.getViewContainerLocation(c);if(u!==null)return this.withPaneCompositeProgress(l,u,r,{...e,location:l})}if(this.viewDescriptorService.getViewDescriptorById(l)!==null)return this.withViewProgress(l,r,{...e,location:l});throw new Error(`Bad progress location: ${l}`)};if(typeof n=="string")return s(n);switch(n){case 15:{let l=e.priority;return l!==3&&(this.notificationService.getFilter()===1?l=2:yX(e.source)&&this.notificationService.getFilter(e.source)===1&&(l=2)),this.withNotificationProgress({...e,location:n,priority:l},r,o)}case 10:{let l=e.type;return e.command?this.withWindowProgress({...e,location:n,type:l},r):this.withNotificationProgress({delay:150,...e,priority:2,location:15,type:l},r,o)}case 1:return this.withPaneCompositeProgress("workbench.view.explorer",0,r,{...e,location:n});case 3:return s("workbench.scm");case 5:return this.withPaneCompositeProgress("workbench.view.extensions",0,r,{...e,location:n});case 20:return this.withDialogProgress(e,r,o);default:throw new Error(`Bad progress location: ${n}`)}}withWindowProgress(e,t){let o=[e,new nh(()=>this.updateWindowProgress())],n=t(o[1]),r=setTimeout(()=>{r=void 0,this.windowProgressStack.unshift(o),this.updateWindowProgress(),Promise.all([Li(150),n]).finally(()=>{let s=this.windowProgressStack.indexOf(o);this.windowProgressStack.splice(s,1),this.updateWindowProgress()})},150);return n.finally(()=>clearTimeout(r))}updateWindowProgress(e=0){if(e<this.windowProgressStack.length){let[t,o]=this.windowProgressStack[e],n=t.title,r=o.value?.message,s=t.command,l,c,u=t.source&&typeof t.source!="string"?t.source.label:t.source;if(n&&r)l=d(19229,null,n,r),c=u?d(19231,null,u,n,r):l;else if(n)l=n,c=u?d(19230,null,u,n):l;else if(r)l=r,c=u?d(19230,null,u,r):l;else{this.updateWindowProgress(e+1);return}let p={name:d(19232,null),text:l,showProgress:t.type||!0,ariaLabel:l,tooltip:Du(c).trim(),command:s};this.windowProgressStatusEntry?this.windowProgressStatusEntry.update(p):this.windowProgressStatusEntry=this.statusbarService.addEntry(p,"status.progress",0,-Number.MAX_VALUE)}else this.windowProgressStatusEntry?.dispose(),this.windowProgressStatusEntry=void 0}withNotificationProgress(e,t,o){let n=new class extends k{constructor(){super();this._onDidReport=this._register(new T);this.onDidReport=this._onDidReport.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this._step=void 0;this._done=!1;this.promise=t(this),this.promise.finally(()=>{this.dispose()})}get step(){return this._step}get done(){return this._done}report(v){this._step=v,this._onDidReport.fire(v)}cancel(v){o?.(v),this.dispose()}dispose(){this._done=!0,this._onWillDispose.fire(),super.dispose()}},r=()=>{let f=new Mo;return this.withWindowProgress({location:10,title:e.title?ZS(e.title).toString():void 0,command:"notifications.showList",type:e.type},v=>{function b(y){y.message&&v.report({message:ZS(y.message).toString()})}n.step&&b(n.step);let S=n.onDidReport(y=>b(y));return f.p.finally(()=>S.dispose()),U.once(n.onWillDispose)(()=>f.complete()),f.p}),ee(()=>f.complete())},s=(f,v,b)=>{let S=new O,y=e.primaryActions?Array.from(e.primaryActions):[],w=e.secondaryActions?Array.from(e.secondaryActions):[];if(e.buttons&&e.buttons.forEach((N,V)=>{let H=new class extends it{constructor(){super(`progress.button.${N}`,N,void 0,!0)}async run(){n.cancel(V)}};S.add(H),y.push(H)}),e.cancellable){let N=new class extends it{constructor(){super("progress.cancel",typeof e.cancellable=="string"?e.cancellable:d(19227,null),void 0,!0)}async run(){n.cancel()}};S.add(N),y.push(N)}let x=this.notificationService.notify({severity:ft.Info,message:Du(f),source:e.source,actions:{primary:y,secondary:w},progress:typeof b=="number"&&b>=0?{total:100,worked:b}:{infinite:!0},priority:v}),E,M=N=>{je(E),!N&&!n.done&&(E=r())};return S.add(x.onDidChangeVisibility(M)),v===2&&M(!1),U.once(x.onDidClose)(()=>{S.dispose(),je(E)}),x},l=(f,v)=>{typeof v=="number"&&v>=0?(f.progress.total(100),f.progress.worked(v)):f.progress.infinite()},c,u,p,h=f=>{f?.message&&e.title?p=`${e.title}: ${f.message}`:p=e.title||f?.message,!c&&p&&(typeof e.delay=="number"&&e.delay>0?u===void 0&&(u=setTimeout(()=>c=s(p,e.priority,f?.increment),e.delay)):c=s(p,e.priority,f?.increment)),c&&(p&&c.updateMessage(p),typeof f?.increment=="number"&&l(c,f.increment))};h(n.step);let g=n.onDidReport(f=>h(f));return U.once(n.onWillDispose)(()=>g.dispose()),(async()=>{try{typeof e.delay=="number"&&e.delay>0?await n.promise:await Promise.all([Li(800),n.promise])}finally{clearTimeout(u),c?.close()}})(),n.promise}withPaneCompositeProgress(e,t,o,n){let r=this.paneCompositeService.getProgressIndicator(e,t),s=r?this.withCompositeProgress(r,o,n):o({report:()=>{}});return t===0&&this.showOnActivityBar(e,n,s),s}withViewProgress(e,t,o){let n=this.viewsService.getViewProgressIndicator(e),r=n?this.withCompositeProgress(n,t,o):t({report:()=>{}}),s=this.viewDescriptorService.getViewContainerByViewId(e)?.id;return s===void 0||this.showOnActivityBar(s,o,r),r}showOnActivityBar(e,t,o){let n,r=setTimeout(()=>{r=void 0;let s=this.activityService.showViewContainerActivity(e,{badge:new Jx(()=>"")}),l=Date.now(),c=300;n={dispose(){let u=Date.now()-l;u<c?setTimeout(()=>s.dispose(),c-u):s.dispose()}}},t.delay||300);o.finally(()=>{clearTimeout(r),je(n)})}withCompositeProgress(e,t,o){let n;function r(l){let c,u;return typeof l<"u"&&(typeof l=="number"?c=l:typeof l.increment=="number"&&(c=l.total??100,u=l.increment)),typeof c=="number"?(n||(n=e.show(c,o.delay),s.catch(()=>{}).finally(()=>n?.done())),typeof u=="number"&&n.worked(u)):(n?.done(),e.showWhile(s,o.delay)),n}let s=t({report:l=>{r(l)}});return r(o.total),s}withDialogProgress(e,t,o){let n=new O,r,s=!1,l=f=>{let v=e.buttons||[];return e.sticky||v.push(e.cancellable?typeof e.cancellable=="boolean"?d(19227,null):e.cancellable:d(19228,null)),r=new jte(this.layoutService.activeContainer,f,v,GPe({type:"pending",detail:e.detail,cancelId:v.length-1,disableCloseAction:e.sticky,disableDefaultAction:e.sticky},this.keybindingService,this.layoutService,this.hostService)),n.add(r),r.show().then(b=>{s||o?.(b.button),je(r)}),r},c=e.delay??0,u,p=n.add(new Dt(()=>{c=0,u&&!r?r=l(u):u&&r.updateMessage(u)},0)),h=function(f){u=f,p.isScheduled()||p.schedule(c)},g=t({report:f=>{h(f.message)}});return g.finally(()=>{s=!0,je(n)}),e.title&&h(e.title),g}};yit=I([m(0,Al),m(1,Es),m(2,ji),m(3,Gt),m(4,Ne),m(5,Fr),m(6,Kl),m(7,Le),m(8,Mme),m(9,ti)],yit);Ce(Go,yit,1);var qPe=class extends k{constructor(e){super();this._themeService=e;this._onWillCreateCodeEditor=this._register(new T);this.onWillCreateCodeEditor=this._onWillCreateCodeEditor.event;this._onCodeEditorAdd=this._register(new T);this.onCodeEditorAdd=this._onCodeEditorAdd.event;this._onCodeEditorRemove=this._register(new T);this.onCodeEditorRemove=this._onCodeEditorRemove.event;this._onWillCreateDiffEditor=this._register(new T);this.onWillCreateDiffEditor=this._onWillCreateDiffEditor.event;this._onDiffEditorAdd=this._register(new T);this.onDiffEditorAdd=this._onDiffEditorAdd.event;this._onDiffEditorRemove=this._register(new T);this.onDiffEditorRemove=this._onDiffEditorRemove.event;this._onDidChangeTransientModelProperty=this._register(new T);this.onDidChangeTransientModelProperty=this._onDidChangeTransientModelProperty.event;this._onDecorationTypeRegistered=this._register(new T);this.onDecorationTypeRegistered=this._onDecorationTypeRegistered.event;this._decorationOptionProviders=new Map;this._editorStyleSheets=new Map;this._codeEditorOpenHandlers=new ra;this._transientWatchers=this._register(new Ot);this._modelProperties=new Map;this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}willCreateCodeEditor(){this._onWillCreateCodeEditor.fire()}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map(e=>this._codeEditors[e])}willCreateDiffEditor(){this._onWillCreateDiffEditor.fire()}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}removeDiffEditor(e){delete this._diffEditors[e.getId()]&&this._onDiffEditorRemove.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map(e=>this._diffEditors[e])}getFocusedCodeEditor(){let e=null,t=this.listCodeEditors();for(let o of t){if(o.hasTextFocus())return o;o.hasWidgetFocus()&&(e=o)}return e}_getOrCreateGlobalStyleSheet(){return this._globalStyleSheet||(this._globalStyleSheet=this._createGlobalStyleSheet()),this._globalStyleSheet}_createGlobalStyleSheet(){return new c_i(Pr())}_getOrCreateStyleSheet(e){if(!e)return this._getOrCreateGlobalStyleSheet();let t=e.getContainerDomNode();if(!a5(t))return this._getOrCreateGlobalStyleSheet();let o=e.getId();if(!this._editorStyleSheets.has(o)){let n=new l_i(this,o,Pr(t));this._editorStyleSheets.set(o,n)}return this._editorStyleSheets.get(o)}_removeEditorStyleSheets(e){this._editorStyleSheets.delete(e)}registerDecorationType(e,t,o,n,r){let s=this._decorationOptionProviders.get(t);if(!s){let l=this._getOrCreateStyleSheet(r),c={styleSheet:l,key:t,parentTypeKey:n,options:o||Object.create(null)};n?s=new d_i(this._themeService,l,c):s=new u_i(e,this._themeService,l,c),this._decorationOptionProviders.set(t,s),this._onDecorationTypeRegistered.fire(t)}return s.refCount++,{dispose:()=>{this.removeDecorationType(t)}}}listDecorationTypes(){return Array.from(this._decorationOptionProviders.keys())}removeDecorationType(e){let t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(o=>o.removeDecorationsByType(e))))}resolveDecorationOptions(e,t){let o=this._decorationOptionProviders.get(e);if(!o)throw new Error("Unknown decoration type key: "+e);return o.getOptions(this,t)}resolveDecorationCSSRules(e){let t=this._decorationOptionProviders.get(e);return t?t.resolveDecorationCSSRules():null}setModelProperty(e,t,o){let n=e.toString(),r;this._modelProperties.has(n)?r=this._modelProperties.get(n):(r=new Map,this._modelProperties.set(n,r)),r.set(t,o)}getModelProperty(e,t){let o=e.toString();if(this._modelProperties.has(o))return this._modelProperties.get(o).get(t)}setTransientModelProperty(e,t,o){let n=e.uri.toString(),r=this._transientWatchers.get(n);r||(r=new a_i(n,e,this),this._transientWatchers.set(n,r)),r.get(t)!==o&&(r.set(t,o),this._onDidChangeTransientModelProperty.fire(e))}getTransientModelProperty(e,t){let o=e.uri.toString(),n=this._transientWatchers.get(o);if(n)return n.get(t)}getTransientModelProperties(e){let t=e.uri.toString(),o=this._transientWatchers.get(t);if(o)return o.keys().map(n=>[n,o.get(n)])}_removeWatcher(e){this._transientWatchers.deleteAndDispose(e.uri)}async openCodeEditor(e,t,o){for(let n of this._codeEditorOpenHandlers){let r=await n(e,t,o);if(r!==null)return r}return null}registerCodeEditorOpenHandler(e){let t=this._codeEditorOpenHandlers.unshift(e);return ee(t)}};qPe=I([m(0,Pe)],qPe);var a_i=class extends k{constructor(i,e,t){super(),this.uri=i,this._values={},this._register(e.onWillDispose(()=>t._removeWatcher(this)))}set(i,e){this._values[i]=e}get(i){return this._values[i]}keys(){return Object.keys(this._values)}},l_i=class{get sheet(){return this._styleSheet.sheet}constructor(i,e,t){this._parent=i,this._editorId=e,this._styleSheet=t,this._refCount=0}ref(){this._refCount++}unref(){this._refCount--,this._refCount===0&&(this._styleSheet.remove(),this._parent._removeEditorStyleSheets(this._editorId))}insertRule(i,e){Eg(i,e,this._styleSheet)}removeRulesContainingSelector(i){xF(i,this._styleSheet)}},c_i=class{get sheet(){return this._styleSheet.sheet}constructor(i){this._styleSheet=i}ref(){}unref(){}insertRule(i,e){Eg(i,e,this._styleSheet)}removeRulesContainingSelector(i){xF(i,this._styleSheet)}},d_i=class{constructor(i,e,t){this._styleSheet=e,this._styleSheet.ref(),this._parentTypeKey=t.parentTypeKey,this.refCount=0,this._beforeContentRules=new $Pe(3,t,i),this._afterContentRules=new $Pe(4,t,i)}getOptions(i,e){let t=i.resolveDecorationOptions(this._parentTypeKey,!0);return this._beforeContentRules&&(t.beforeContentClassName=this._beforeContentRules.className),this._afterContentRules&&(t.afterContentClassName=this._afterContentRules.className),t}resolveDecorationCSSRules(){return this._styleSheet.sheet.cssRules}dispose(){this._beforeContentRules&&(this._beforeContentRules.dispose(),this._beforeContentRules=null),this._afterContentRules&&(this._afterContentRules.dispose(),this._afterContentRules=null),this._styleSheet.unref()}},u_i=class{constructor(i,e,t,o){this._disposables=new O;this.description=i,this._styleSheet=t,this._styleSheet.ref(),this.refCount=0;let n=p=>{let h=new $Pe(p,o,e);if(this._disposables.add(h),h.hasContent)return h.className},r=p=>{let h=new $Pe(p,o,e);return this._disposables.add(h),h.hasContent?{className:h.className,hasLetterSpacing:h.hasLetterSpacing}:null};this.className=n(0);let s=r(1);if(s&&(this.inlineClassName=s.className,this.inlineClassNameAffectsLetterSpacing=s.hasLetterSpacing),this.beforeContentClassName=n(3),this.afterContentClassName=n(4),o.options.beforeInjectedText&&o.options.beforeInjectedText.contentText){let p=r(5);this.beforeInjectedText={content:o.options.beforeInjectedText.contentText,inlineClassName:p?.className,inlineClassNameAffectsLetterSpacing:p?.hasLetterSpacing||o.options.beforeInjectedText.affectsLetterSpacing}}if(o.options.afterInjectedText&&o.options.afterInjectedText.contentText){let p=r(6);this.afterInjectedText={content:o.options.afterInjectedText.contentText,inlineClassName:p?.className,inlineClassNameAffectsLetterSpacing:p?.hasLetterSpacing||o.options.afterInjectedText.affectsLetterSpacing}}this.glyphMarginClassName=n(2);let l=o.options;this.isWholeLine=!!l.isWholeLine,this.lineHeight=l.lineHeight,this.fontFamily=l.fontFamily,this.fontSize=l.fontSize,this.fontWeight=l.fontWeight,this.fontStyle=l.fontStyle,this.stickiness=l.rangeBehavior;let c=l.light&&l.light.overviewRulerColor||l.overviewRulerColor,u=l.dark&&l.dark.overviewRulerColor||l.overviewRulerColor;(typeof c<"u"||typeof u<"u")&&(this.overviewRuler={color:c||u,darkColor:u||c,position:l.overviewRulerLane||2})}getOptions(i,e){return e?{description:this.description,inlineClassName:this.inlineClassName,beforeContentClassName:this.beforeContentClassName,afterContentClassName:this.afterContentClassName,className:this.className,glyphMarginClassName:this.glyphMarginClassName,isWholeLine:this.isWholeLine,lineHeight:this.lineHeight,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontStyle:this.fontStyle,overviewRuler:this.overviewRuler,stickiness:this.stickiness,before:this.beforeInjectedText,after:this.afterInjectedText}:this}resolveDecorationCSSRules(){return this._styleSheet.sheet.rules}dispose(){this._disposables.dispose(),this._styleSheet.unref()}},wit={color:"color:{0} !important;",opacity:"opacity:{0};",backgroundColor:"background-color:{0};",outline:"outline:{0};",outlineColor:"outline-color:{0};",outlineStyle:"outline-style:{0};",outlineWidth:"outline-width:{0};",border:"border:{0};",borderColor:"border-color:{0};",borderRadius:"border-radius:{0};",borderSpacing:"border-spacing:{0};",borderStyle:"border-style:{0};",borderWidth:"border-width:{0};",fontStyle:"font-style:{0};",fontWeight:"font-weight:{0};",fontSize:"font-size:{0};",fontFamily:"font-family:{0};",textDecoration:"text-decoration:{0};",cursor:"cursor:{0};",letterSpacing:"letter-spacing:{0};",gutterIconPath:"background:{0} center center no-repeat;",gutterIconSize:"background-size:{0};",contentText:"content:'{0}';",contentIconPath:"content:{0};",margin:"margin:{0};",padding:"padding:{0};",width:"width:{0};",height:"height:{0};",verticalAlign:"vertical-align:{0};"},$Pe=class{constructor(i,e,t){this._theme=t.getColorTheme(),this._ruleType=i,this._providerArgs=e,this._usesThemeColors=!1,this._hasContent=!1,this._hasLetterSpacing=!1;let o=Cit.getClassName(this._providerArgs.key,i);this._providerArgs.parentTypeKey&&(o=o+" "+Cit.getClassName(this._providerArgs.parentTypeKey,i)),this._className=o,this._unThemedSelector=Cit.getSelector(this._providerArgs.key,this._providerArgs.parentTypeKey,i),this._buildCSS(),this._usesThemeColors?this._themeListener=t.onDidColorThemeChange(n=>{this._theme=t.getColorTheme(),this._removeCSS(),this._buildCSS()}):this._themeListener=null}dispose(){this._hasContent&&(this._removeCSS(),this._hasContent=!1),this._themeListener&&(this._themeListener.dispose(),this._themeListener=null)}get hasContent(){return this._hasContent}get hasLetterSpacing(){return this._hasLetterSpacing}get className(){return this._className}_buildCSS(){let i=this._providerArgs.options,e,t,o;switch(this._ruleType){case 0:e=this.getCSSTextForModelDecorationClassName(i),t=this.getCSSTextForModelDecorationClassName(i.light),o=this.getCSSTextForModelDecorationClassName(i.dark);break;case 1:e=this.getCSSTextForModelDecorationInlineClassName(i),t=this.getCSSTextForModelDecorationInlineClassName(i.light),o=this.getCSSTextForModelDecorationInlineClassName(i.dark);break;case 2:e=this.getCSSTextForModelDecorationGlyphMarginClassName(i),t=this.getCSSTextForModelDecorationGlyphMarginClassName(i.light),o=this.getCSSTextForModelDecorationGlyphMarginClassName(i.dark);break;case 3:e=this.getCSSTextForModelDecorationContentClassName(i.before),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.before),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.before);break;case 4:e=this.getCSSTextForModelDecorationContentClassName(i.after),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.after),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.after);break;case 5:e=this.getCSSTextForModelDecorationContentClassName(i.beforeInjectedText),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.beforeInjectedText),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.beforeInjectedText);break;case 6:e=this.getCSSTextForModelDecorationContentClassName(i.afterInjectedText),t=this.getCSSTextForModelDecorationContentClassName(i.light&&i.light.afterInjectedText),o=this.getCSSTextForModelDecorationContentClassName(i.dark&&i.dark.afterInjectedText);break;default:throw new Error("Unknown rule type: "+this._ruleType)}let n=this._providerArgs.styleSheet,r=!1;e.length>0&&(n.insertRule(this._unThemedSelector,e),r=!0),t.length>0&&(n.insertRule(`.vs${this._unThemedSelector}, .hc-light${this._unThemedSelector}`,t),r=!0),o.length>0&&(n.insertRule(`.vs-dark${this._unThemedSelector}, .hc-black${this._unThemedSelector}`,o),r=!0),this._hasContent=r}_removeCSS(){this._providerArgs.styleSheet.removeRulesContainingSelector(this._unThemedSelector)}getCSSTextForModelDecorationClassName(i){if(!i)return"";let e=[];return this.collectCSSText(i,["backgroundColor"],e),this.collectCSSText(i,["outline","outlineColor","outlineStyle","outlineWidth"],e),this.collectBorderSettingsCSSText(i,e),e.join("")}getCSSTextForModelDecorationInlineClassName(i){if(!i)return"";let e=[];return this.collectCSSText(i,["fontStyle","fontWeight","fontFamily","fontSize","textDecoration","cursor","color","opacity","letterSpacing"],e),i.letterSpacing&&(this._hasLetterSpacing=!0),e.join("")}getCSSTextForModelDecorationContentClassName(i){if(!i)return"";let e=[];if(typeof i<"u"){if(this.collectBorderSettingsCSSText(i,e),typeof i.contentIconPath<"u"&&e.push(Wd(wit.contentIconPath,cl(A.revive(i.contentIconPath)))),typeof i.contentText=="string"){let o=i.contentText.match(/^.*$/m)[0].replace(/['\\]/g,"\\$&");e.push(Wd(wit.contentText,o))}this.collectCSSText(i,["verticalAlign","fontStyle","fontWeight","fontSize","fontFamily","textDecoration","color","opacity","backgroundColor","margin","padding"],e),this.collectCSSText(i,["width","height"],e)&&e.push("display:inline-block;")}return e.join("")}getCSSTextForModelDecorationGlyphMarginClassName(i){if(!i)return"";let e=[];return typeof i.gutterIconPath<"u"&&(e.push(Wd(wit.gutterIconPath,cl(A.revive(i.gutterIconPath)))),typeof i.gutterIconSize<"u"&&e.push(Wd(wit.gutterIconSize,i.gutterIconSize))),e.join("")}collectBorderSettingsCSSText(i,e){return this.collectCSSText(i,["border","borderColor","borderRadius","borderSpacing","borderStyle","borderWidth"],e)?(e.push(Wd("box-sizing: border-box;")),!0):!1}collectCSSText(i,e,t){let o=t.length;for(let n of e){let r=this.resolveValue(i[n]);typeof r=="string"&&t.push(Wd(wit[n],r))}return t.length!==o}resolveValue(i){if(cCe(i)){this._usesThemeColors=!0;let e=this._theme.getColor(i.id);return e?e.toString():"transparent"}return i}};var Cit=class{static getClassName(i,e){return"ced-"+i+"-"+e}static getSelector(i,e,t){let o=".monaco-editor ."+this.getClassName(i,t);return e&&(o=o+"."+this.getClassName(e,t)),t===3?o+="::before":t===4&&(o+="::after"),o}};var xit=class extends qPe{constructor(e,t,o){super(t);this.editorService=e;this.configurationService=o;this._register(this.registerCodeEditorOpenHandler(this.doOpenCodeEditor.bind(this))),this._register(this.registerCodeEditorOpenHandler(this.doOpenCodeEditorFromDiff.bind(this)))}getActiveCodeEditor(){let e=this.editorService.activeTextEditorControl;if(fn(e))return e;if(Lc(e))return e.getModifiedEditor();let t=this.editorService.activeEditorPane?.getControl();return CF(t)&&fn(t.activeCodeEditor)?t.activeCodeEditor:null}async doOpenCodeEditorFromDiff(e,t,o){let n=this.editorService.activeTextEditorControl;if(!o&&Lc(n)&&e.options&&e.resource&&t===n.getModifiedEditor()&&n.getModel()&&ze(e.resource,n.getModel()?.modified.uri)){let r=n.getModifiedEditor();return x_(e.options,r,0),r}return null}async doOpenCodeEditor(e,t,o){if(!this.configurationService.getValue().workbench?.editor?.enablePreviewFromCodeNavigation&&t&&!e.options?.pinned&&!o&&!ze(t.getModel()?.uri,e.resource)){for(let s of this.editorService.visibleEditorPanes)if(da(s.getControl())===t){s.group.pinEditor();break}}let r=await this.editorService.openEditor(e,o?En:tr);if(r){let s=r.getControl();if(fn(s))return s;if(CF(s)&&fn(s.activeCodeEditor))return s.activeCodeEditor}return null}};xit=I([m(0,ie),m(1,Pe),m(2,B)],xit);Ce(Qt,xit,1);var Zg=le("jsonEditingService");var WUt=class extends Error{constructor(e,t){super(e);this.code=t}};var zN=class{constructor(i,e,t,o,n,r,s){this._resolvedKeybindingItemBrand=void 0;this.resolvedKeybinding=i,this.chords=i?jPe(i.getDispatchChords()):[],i&&this.chords.length===0&&(this.chords=jPe(i.getSingleModifierDispatchChords())),this.bubble=e?e.charCodeAt(0)===94:!1,this.command=this.bubble?e.substr(1):e,this.commandArgs=t,this.when=o,this.isDefault=n,this.extensionId=r,this.isBuiltinExtension=s}};function jPe(a){let i=[];for(let e=0,t=a.length;e<t;e++){let o=a[e];if(!o)return[];i.push(o)}return i}function QPe(a){let i=[],e=new Map,t=(o,n)=>{if(!e.has(o)&&(e.set(o,!0),!(o[0]==="_"||o.indexOf("vscode.")===0)&&a.get(o)!==!0)){if(!n){let r=Ge.getCommand(o);if(r&&typeof r.metadata=="object"&&Rr(r.metadata.args))return}i.push(o)}};for(let o of be.getMenuItems(R.CommandPalette))cT(o)&&t(o.command.id,!0);for(let o of ml.getEditorActions())t(o.id,!0);for(let o of Ge.getCommands().keys())t(o,!1);return i}var Y8="keybinding.entry.template",ovo=d(19182,null),nvo=d(19183,null),rvo=d(19186,null);function lvo(a,i){let e=i?` +when:${i}`:"";return`@command:${a}${e}`}var fon=UF(HX,Qw),von=/@command:\s*([^\+]+)/i,bon=/\+when:\s*(.+)/i,svo=/@source:\s*(user|default|system|extension)/i,avo=/@ext:\s*((".+")|([^\s]+))/i,Son=/@keybinding:\s*((\".+\")|(\S+))/i,DE=class extends Zh{constructor(e,t,o){super();this.keybindingsService=t;this.extensionService=o;this._keybindingItems=[],this._keybindingItemsSortedByPrecedence=[],this.modifierLabels={ui:nM.modifierLabels[e],aria:ykt.modifierLabels[e],user:Hke.modifierLabels[e]}}fetch(e,t=!1){let o=t?this._keybindingItemsSortedByPrecedence:this._keybindingItems,n=von.exec(e);if(n&&n[1]){let r=n[1].trim(),s=o.filter(l=>l.command===r);if(s.length){let l=bon.exec(e);if(l&&l[1]){let c=l[1].trim();s=this.filterByWhen(s,r,c)}}return s.map(l=>({id:DE.getId(l),keybindingItem:l,templateId:Y8}))}if(svo.test(e))o=this.filterBySource(o,e),e=e.replace(svo,"");else{let r=avo.exec(e);if(r&&(r[2]||r[3])){let s=r[2]?r[2].substring(1,r[2].length-1):r[3];o=this.filterByExtension(o,s),e=e.replace(avo,"")}else{let s=Son.exec(e);s&&(s[2]||s[3])&&(e=s[2]||`"${s[3]}"`)}}return e=e.trim(),e?this.filterByText(o,e):o.map(r=>({id:DE.getId(r),keybindingItem:r,templateId:Y8}))}filterBySource(e,t){return/@source:\s*default/i.test(t)||/@source:\s*system/i.test(t)?e.filter(o=>o.source===ovo):/@source:\s*user/i.test(t)?e.filter(o=>o.source===rvo):/@source:\s*extension/i.test(t)?e.filter(o=>!We(o.source)||o.source===nvo):e}filterByExtension(e,t){return t=t.toLowerCase().trim(),e.filter(o=>!We(o.source)&&(hi.equals(o.source.identifier,t)||o.source.displayName?.toLowerCase()===t.toLowerCase()))}filterByText(e,t){let o=t.charAt(0)==='"',n=t.charAt(t.length-1)==='"',r=o&&n;o&&(t=t.substring(1)),n&&(t=t.substring(0,t.length-1)),t=t.trim();let s=[],l=t.split(" "),c=this.splitKeybindingWords(l);for(let u of e){let p=new p_i(this.modifierLabels,u,t,l,c,r);(p.commandIdMatches||p.commandLabelMatches||p.commandDefaultLabelMatches||p.sourceMatches||p.whenMatches||p.keybindingMatches||p.extensionIdMatches||p.extensionLabelMatches)&&s.push({id:DE.getId(u),templateId:Y8,commandLabelMatches:p.commandLabelMatches||void 0,commandDefaultLabelMatches:p.commandDefaultLabelMatches||void 0,keybindingItem:u,keybindingMatches:p.keybindingMatches||void 0,commandIdMatches:p.commandIdMatches||void 0,sourceMatches:p.sourceMatches||void 0,whenMatches:p.whenMatches||void 0,extensionIdMatches:p.extensionIdMatches||void 0,extensionLabelMatches:p.extensionLabelMatches||void 0})}return s}filterByWhen(e,t,o){if(e.length===0)return[];let n=e.filter(c=>c.when===o);if(n.length)return n;let r=e[0].commandLabel,s=new zN(void 0,t,null,C.deserialize(o),!1,null,!1),l=new Map([[t,r]]);return[DE.toKeybindingEntry(t,s,l,this.getExtensionsMapping())]}splitKeybindingWords(e){let t=[];for(let o of e)t.push(...ui(o.split("+")));return t}async resolve(e=new Map){let t=this.getExtensionsMapping();this._keybindingItemsSortedByPrecedence=[];let o=new Map;for(let r of this.keybindingsService.getKeybindings())r.command&&(this._keybindingItemsSortedByPrecedence.push(DE.toKeybindingEntry(r.command,r,e,t)),o.set(r.command,!0));let n=this.keybindingsService.getDefaultKeybindings().map(r=>r.command);for(let r of QPe(o)){let s=new zN(void 0,r,null,void 0,n.indexOf(r)===-1,null,!1);this._keybindingItemsSortedByPrecedence.push(DE.toKeybindingEntry(r,s,e,t))}return this._keybindingItemsSortedByPrecedence=jo(this._keybindingItemsSortedByPrecedence,r=>DE.getId(r)),this._keybindingItems=this._keybindingItemsSortedByPrecedence.slice(0).sort((r,s)=>DE.compareKeybindingData(r,s)),super.resolve()}static getId(e){return e.command+(e?.keybinding?.getAriaLabel()??"")+e.when+(We(e.source)?e.source:e.source.identifier.value)}getExtensionsMapping(){let e=new uu;for(let t of this.extensionService.extensions)e.set(t.identifier,t);return e}static compareKeybindingData(e,t){return e.keybinding&&!t.keybinding?-1:t.keybinding&&!e.keybinding?1:e.commandLabel&&!t.commandLabel?-1:t.commandLabel&&!e.commandLabel?1:e.commandLabel&&t.commandLabel&&e.commandLabel!==t.commandLabel?e.commandLabel.localeCompare(t.commandLabel):e.command===t.command?e.keybindingItem.isDefault?1:-1:e.command.localeCompare(t.command)}static toKeybindingEntry(e,t,o,n){let r=be.getCommand(e),s=o.get(e),l=rvo;if(t.isDefault){let c=t.extensionId??(t.resolvedKeybinding?void 0:r?.source?.id);l=c?n.get(c)??nvo:ovo}return{keybinding:t.resolvedKeybinding,keybindingItem:t,command:e,commandLabel:DE.getCommandLabel(r,s),commandDefaultLabel:DE.getCommandDefaultLabel(r),when:t.when?t.when.serialize():"",source:l}}static getCommandDefaultLabel(e){if(!SI.isDefaultVariant()&&e&&e.title&&e.title.original){let t=e.category?e.category.original:void 0,o=e.title.original;return t?d(19181,null,t,o):o}return null}static getCommandLabel(e,t){if(e){let o=e.category?typeof e.category=="string"?e.category:e.category.value:void 0,n=typeof e.title=="string"?e.title:e.title.value;return o?d(19181,null,o,n):n}return t||""}};DE=I([m(1,Le),m(2,lt)],DE);var p_i=class{constructor(i,e,t,o,n,r){this.modifierLabels=i;this.commandIdMatches=null;this.commandLabelMatches=null;this.commandDefaultLabelMatches=null;this.sourceMatches=null;this.whenMatches=null;this.keybindingMatches=null;this.extensionIdMatches=null;this.extensionLabelMatches=null;r||(this.commandIdMatches=this.matches(t,e.command,UF(Qw,UX),o),this.commandLabelMatches=e.commandLabel?this.matches(t,e.commandLabel,(s,l)=>Qw(s,e.commandLabel,!0),o):null,this.commandDefaultLabelMatches=e.commandDefaultLabel?this.matches(t,e.commandDefaultLabel,(s,l)=>Qw(s,e.commandDefaultLabel,!0),o):null,this.whenMatches=e.when?this.matches(null,e.when,UF(Qw,UX),o):null,We(e.source)?this.sourceMatches=this.matches(t,e.source,(s,l)=>Qw(s,e.source,!0),o):this.extensionLabelMatches=e.source.displayName?this.matches(t,e.source.displayName,(s,l)=>Qw(s,e.commandLabel,!0),o):null),this.keybindingMatches=e.keybinding?this.matchesKeybinding(e.keybinding,t,n,r):null}matches(i,e,t,o){let n=i?fon(i,e):null;return n||(n=this.matchesWords(o,e,t)),n&&(n=this.filterAndSort(n)),n}matchesWords(i,e,t){let o=[];for(let n of i){let r=t(n,e);if(r)o=[...o||[],...r];else{o=null;break}}return o}filterAndSort(i){return jo(i,(e=>e.start+"."+e.end)).filter(e=>!i.some(t=>!(t.start===e.start&&t.end===e.end)&&t.start<=e.start&&t.end>=e.end)).sort((e,t)=>e.start-t.start)}matchesKeybinding(i,e,t,o){let[n,r]=i.getChords(),s=i.getUserSettingsLabel(),l=i.getAriaLabel(),c=i.getLabel();if(s&&MS(e,s)===0||l&&MS(e,l)===0||c&&MS(e,c)===0)return{firstPart:this.createCompleteMatch(n),chordPart:this.createCompleteMatch(r)};let u={},p={},h=[],g=[],f=[],v=!0;for(let b=0;b<t.length;b++){let S=t[b],y=!1,w=!1;v=v&&!u.keyCode;let x=!p.keyCode;if(v&&(y=this.matchPart(n,u,S,o),u.keyCode)){for(let E of f)g.indexOf(E)===-1&&h.splice(h.indexOf(E),1);p={},f=[],x=!1}x&&(w=this.matchPart(r,p,S,o)),y&&g.push(b),w&&f.push(b),(y||w)&&h.push(b),v=v&&this.isModifier(S)}return h.length!==t.length||o&&(!this.isCompleteMatch(n,u)||!dv(p)&&!this.isCompleteMatch(r,p))?null:this.hasAnyMatch(u)||this.hasAnyMatch(p)?{firstPart:u,chordPart:p}:null}matchPart(i,e,t,o){let n=!1;return this.matchesMetaModifier(i,t)&&(n=!0,e.metaKey=!0),this.matchesCtrlModifier(i,t)&&(n=!0,e.ctrlKey=!0),this.matchesShiftModifier(i,t)&&(n=!0,e.shiftKey=!0),this.matchesAltModifier(i,t)&&(n=!0,e.altKey=!0),this.matchesKeyCode(i,t,o)&&(e.keyCode=!0,n=!0),n}matchesKeyCode(i,e,t){if(!i)return!1;let o=i.keyAriaLabel||"";if(t||o.length===1||e.length===1){if(MS(o,e)===0)return!0}else if(zF(e,o))return!0;return!1}matchesMetaModifier(i,e){return!i||!i.metaKey?!1:this.wordMatchesMetaModifier(e)}matchesCtrlModifier(i,e){return!i||!i.ctrlKey?!1:this.wordMatchesCtrlModifier(e)}matchesShiftModifier(i,e){return!i||!i.shiftKey?!1:this.wordMatchesShiftModifier(e)}matchesAltModifier(i,e){return!i||!i.altKey?!1:this.wordMatchesAltModifier(e)}hasAnyMatch(i){return!!i.altKey||!!i.ctrlKey||!!i.metaKey||!!i.shiftKey||!!i.keyCode}isCompleteMatch(i,e){return i?!(!e.keyCode||i.metaKey&&!e.metaKey||i.altKey&&!e.altKey||i.ctrlKey&&!e.ctrlKey||i.shiftKey&&!e.shiftKey):!0}createCompleteMatch(i){let e={};return i&&(e.keyCode=!0,i.metaKey&&(e.metaKey=!0),i.altKey&&(e.altKey=!0),i.ctrlKey&&(e.ctrlKey=!0),i.shiftKey&&(e.shiftKey=!0)),e}isModifier(i){return!!(this.wordMatchesAltModifier(i)||this.wordMatchesCtrlModifier(i)||this.wordMatchesMetaModifier(i)||this.wordMatchesShiftModifier(i))}wordMatchesAltModifier(i){return!!(xr(this.modifierLabels.ui.altKey,i)||xr(this.modifierLabels.aria.altKey,i)||xr(this.modifierLabels.user.altKey,i)||xr(d(19185,null),i))}wordMatchesCtrlModifier(i){return!!(xr(this.modifierLabels.ui.ctrlKey,i)||xr(this.modifierLabels.aria.ctrlKey,i)||xr(this.modifierLabels.user.ctrlKey,i))}wordMatchesMetaModifier(i){return!!(xr(this.modifierLabels.ui.metaKey,i)||xr(this.modifierLabels.aria.metaKey,i)||xr(this.modifierLabels.user.metaKey,i)||xr(d(19184,null),i))}wordMatchesShiftModifier(i){return!!(xr(this.modifierLabels.ui.shiftKey,i)||xr(this.modifierLabels.aria.shiftKey,i)||xr(this.modifierLabels.user.shiftKey,i))}};var Ion=Oe("keybindings-editor-label-icon",L.keyboard,d(19179,null)),MR=class extends Ls{constructor(e){super();this.searchOptions=null;this.resource=void 0;this.keybindingsModel=e.createInstance(DE,Ao)}static{this.ID="workbench.input.keybindings"}get typeId(){return MR.ID}getName(){return d(19180,null)}getIcon(){return Ion}async resolve(){return this.keybindingsModel}matches(e){return e instanceof MR}dispose(){this.keybindingsModel.dispose(),super.dispose()}};MR=I([m(0,F)],MR);var yon=Oe("settings-editor-label-icon",L.settings,d(19194,null)),PR=class extends Ls{constructor(e){super();this.resource=A.from({scheme:Q.vscodeSettings,path:"settingseditor"});this._settingsModel=e.createSettings2EditorModel()}static{this.ID="workbench.input.settings2"}matches(e){return super.matches(e)||e instanceof PR}get typeId(){return PR.ID}getName(){return d(19193,null)}getIcon(){return yon}async resolve(){return this._settingsModel}dispose(){this._settingsModel.dispose(),super.dispose()}};PR=I([m(0,Qo)],PR);var won=Oe("preferences-editor-label-icon",L.settings,d(19192,null)),Qte=class a extends Ls{constructor(){super(...arguments);this.resource=A.from({scheme:Q.vscodeSettings,path:"preferenceseditor"})}static{this.ID="workbench.input.preferences"}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(19191,null)}getIcon(){return won}async resolve(){return null}};function YPe(a,...i){return i.some(e=>a.includes(e))}function cvo(a){return a===""||mr(a)}function m_i(a){let i=Array.isArray(a.type)?a.type:[a.type],e=YPe(i,"null"),t=(YPe(i,"number")||YPe(i,"integer"))&&(i.length===1||i.length===2&&e),o=kon(a),n=xon(a),r=Eon(a),s=Ton(a);return l=>{if(e&&cvo(l))return"";let c=[];if(r){let u=r(l);u&&c.push(u)}if(s){let u=s(l);u&&c.push(u)}return a.type==="boolean"&&l!==!0&&l!==!1&&c.push(d(19200,null)),t&&(cvo(l)||typeof l=="boolean"||Array.isArray(l)||isNaN(+l)?c.push(d(19205,null)):c.push(...o.filter(u=>!u.isValid(+l)).map(u=>u.message))),a.type==="string"&&(a.enum&&!vI(a.enum)?c.push(d(19222,null)):We(l)?c.push(...n.filter(u=>!u.isValid(l)).map(u=>u.message)):c.push(d(19223,null))),c.length?a.errorMessage?[a.errorMessage,...c].join(" "):c.join(" "):""}}function h_i(a,i){if(typeof i>"u")return;if(!(Array.isArray(i)?i:[i]).some(t=>Con(a,t)))return d(19197,null,JSON.stringify(i))}function Con(a,i){let e=typeof a;return i==="boolean"?e==="boolean":i==="object"?a&&!Array.isArray(a)&&e==="object":i==="null"?a===null:i==="array"?Array.isArray(a):i==="string"?e==="string":i==="number"||i==="integer"?e==="number":!0}function BUt(a){try{return new RegExp(a,"u")}catch{try{return new RegExp(a)}catch{return console.error(d(19198,null),a),/.*/}}}function xon(a){let i=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,e;return typeof a.pattern=="string"&&(e=BUt(a.pattern)),[{enabled:a.maxLength!==void 0,isValid:(t=>t.length<=a.maxLength),message:d(19208,null,a.maxLength)},{enabled:a.minLength!==void 0,isValid:(t=>t.length>=a.minLength),message:d(19210,null,a.minLength)},{enabled:e!==void 0,isValid:(t=>e.test(t)),message:a.patternErrorMessage||d(19215,null,a.pattern)},{enabled:a.format==="color-hex",isValid:(t=>Ue.Format.CSS.parseHex(t)),message:d(19201,null)},{enabled:a.format==="uri"||a.format==="uri-reference",isValid:(t=>!!t.length),message:d(19224,null)},{enabled:a.format==="uri"||a.format==="uri-reference",isValid:(t=>i.test(t)),message:d(19225,null)},{enabled:a.format==="uri",isValid:(t=>{let o=t.match(i);return!!(o&&o[2])}),message:d(19226,null)},{enabled:a.enum!==void 0,isValid:(t=>a.enum.includes(t)),message:d(19206,null,a.enum?a.enum.map(t=>`"${t}"`).join(", "):"[]")}].filter(t=>t.enabled)}function kon(a){let i=Array.isArray(a.type)?a.type:[a.type],e=YPe(i,"null"),t=YPe(i,"integer")&&(i.length===1||i.length===2&&e);if(!(YPe(i,"number","integer")&&(i.length===1||i.length===2&&e)))return[];let n,r;return typeof a.exclusiveMaximum=="boolean"?n=a.exclusiveMaximum?a.maximum:void 0:n=a.exclusiveMaximum,typeof a.exclusiveMinimum=="boolean"?r=a.exclusiveMinimum?a.minimum:void 0:r=a.exclusiveMinimum,[{enabled:n!==void 0&&(a.maximum===void 0||n<=a.maximum),isValid:(s=>s<n),message:d(19202,null,n)},{enabled:r!==void 0&&(a.minimum===void 0||r>=a.minimum),isValid:(s=>s>r),message:d(19203,null,r)},{enabled:a.maximum!==void 0&&(n===void 0||n>a.maximum),isValid:(s=>s<=a.maximum),message:d(19207,null,a.maximum)},{enabled:a.minimum!==void 0&&(r===void 0||r<a.minimum),isValid:(s=>s>=a.minimum),message:d(19209,null,a.minimum)},{enabled:a.multipleOf!==void 0,isValid:(s=>s%a.multipleOf===0),message:d(19211,null,a.multipleOf)},{enabled:t,isValid:(s=>s%1===0),message:d(19204,null)}].filter(s=>s.enabled)}function Eon(a){if(a.type==="array"&&a.items&&!Array.isArray(a.items)){let i=a.items;if(i&&!Array.isArray(i.type)){let e=t=>"'"+t+"'";return t=>{if(!t)return null;let o="";if(!Array.isArray(t))return o+=d(19199,null),o+=`
`,o;let n=t;if(a.uniqueItems&&new Set(n).size<n.length&&(o+=d(19221,null),o+=`
`),a.minItems&&n.length<a.minItems&&(o+=d(19220,null,a.minItems),o+=`
`),a.maxItems&&n.length>a.maxItems&&(o+=d(19219,null,a.maxItems),o+=`
`),i.type==="string"){if(!vI(n))return o+=d(19216,null),o+=`
`,o;if(typeof i.pattern=="string"){let s=BUt(i.pattern);n.forEach(l=>{s.test(l)||(o+=i.patternErrorMessage||d(19218,null,e(l),e(i.pattern)))})}let r=i.enum;r&&n.forEach(s=>{r.indexOf(s)===-1&&(o+=d(19217,null,e(s),"["+r.map(e).join(", ")+"]"),o+=`
`)})}else(i.type==="integer"||i.type==="number")&&n.forEach(r=>{let s=VUt(i,r);s&&(o+=`${r}: ${s}
`)});return o}}}return null}function Ton(a){if(a.type==="object"){let{properties:i,patternProperties:e,additionalProperties:t,propertyNames:o}=a;return n=>{if(!n)return null;let r=[],s=!1;return Di(n)?Object.keys(n).forEach(l=>{let c=n[l];if(o?.pattern&&!s&&!BUt(o.pattern).test(l)){let p=o.patternErrorMessage||d(19214,null,o.pattern);r.push(p+`
`),s=!0}if(i&&l in i){let u=VUt(i[l],c);u&&r.push(`${l}: ${u}
`);return}if(e){for(let u in e)if(RegExp(u).test(l)){let p=VUt(e[u],c);p&&r.push(`${l}: ${p}
`);return}}if(t===!1)r.push(d(19213,null,l));else if(typeof t=="object"){let u=VUt(t,c);u&&r.push(`${l}: ${u}
`)}}):r.push(d(19212,null)),r.length?a.errorMessage?[a.errorMessage,...r].join(" "):r.join(" "):""}}return null}function dvo(a,i){return a?.pattern?BUt(a.pattern).test(i):!0}function VUt(a,i){return m_i(a)(i)}var wf={startLineNumber:-1,startColumn:-1,endLineNumber:-1,endColumn:-1};function g_i(a){return a.startLineNumber===-1&&a.startColumn===-1&&a.endLineNumber===-1&&a.endColumn===-1}function HUt(a){return a.replace(/`#([^#`]*)#`/g,(i,e)=>`\`${e}\``)}var kit=class extends Zh{constructor(){super(...arguments);this._currentResultGroups=new Map}updateResultGroup(e,t){return t?this._currentResultGroups.set(e,t):this._currentResultGroups.delete(e),this.removeDuplicateResults(),this.update()}removeDuplicateResults(){let e=new Set;[...this._currentResultGroups.keys()].sort((t,o)=>this._currentResultGroups.get(t).order-this._currentResultGroups.get(o).order).forEach(t=>{let o=this._currentResultGroups.get(t);o.result.filterMatches=o.result.filterMatches.filter(n=>!e.has(n.setting.key)),o.result.filterMatches.forEach(n=>e.add(n.setting.key))})}filterSettings(e,t,o){let n=this.filterGroups,r=[];for(let s of n){let l=t(s);for(let c of s.sections)for(let u of c.settings){let p=o(u,s);(l||p)&&r.push({setting:u,matches:p&&p.matches,matchType:p?.matchType??0,keyMatchScore:p?.keyMatchScore??0,score:p?.score??0})}}return r}getPreference(e){for(let t of this.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(e===n.key)return n}collectMetadata(e){let t=Object.create(null),o=!1;return e.forEach(n=>{n.result.metadata&&(t[n.id]=n.result.metadata,o=!0)}),o?t:null}get filterGroups(){return this.settingsGroups}},Ghe=class extends kit{constructor(e,t){super();this._configurationTarget=t;this._onDidChangeGroups=this._register(new T);this.onDidChangeGroups=this._onDidChangeGroups.event;this.settingsModel=e.object.textEditorModel,this._register(this.onWillDispose(()=>e.dispose())),this._register(this.settingsModel.onDidChangeContent(()=>{this._settingsGroups=void 0,this._onDidChangeGroups.fire()}))}get uri(){return this.settingsModel.uri}get configurationTarget(){return this._configurationTarget}get settingsGroups(){return this._settingsGroups||this.parse(),this._settingsGroups}get content(){return this.settingsModel.getValue()}isSettingsProperty(e,t){return t.length===0}parse(){this._settingsGroups=uvo(this.settingsModel,(e,t)=>this.isSettingsProperty(e,t))}update(){let e=[...this._currentResultGroups.values()];if(!e.length)return;let t=[],o=[];e.forEach(l=>{l.result.filterMatches.forEach(c=>{t.push(c.setting),c.matches&&o.push(...c.matches)})});let n,r=this.settingsGroups[0];r&&(n={id:r.id,range:r.range,sections:[{settings:t}],title:r.title,titleRange:r.titleRange,order:r.order,extensionInfo:r.extensionInfo});let s=this.collectMetadata(e);return{allGroups:this.settingsGroups,filteredGroups:n?[n]:[],matches:o,metadata:s??void 0}}},Yte=class extends kit{constructor(e,t){super();this._defaultSettings=e;this._onDidChangeGroups=this._register(new T);this.onDidChangeGroups=this._onDidChangeGroups.event;this.additionalGroups=[];this.dirty=!1;this._register(t.onDidChangeConfiguration(o=>{o.source===7&&(this.dirty=!0,this._onDidChangeGroups.fire())})),this._register(oe.as($t.Configuration).onDidSchemaChange(o=>{this.dirty=!0,this._onDidChangeGroups.fire()}))}get filterGroups(){return this.settingsGroups.slice(1)}get settingsGroups(){let e=this._defaultSettings.getSettingsGroups(this.dirty);return this.dirty=!1,[...e,...this.additionalGroups]}setAdditionalGroups(e){this.additionalGroups=e}update(){throw new Error("Not supported")}};Yte=I([m(1,B)],Yte);function uvo(a,i){let e=[],t=null,o=null,n=[],r=[],s=-1,l={startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0};function c(p,h,g){if(Array.isArray(n)?n.push(p):o&&(n[o]=p),r.length===s+1||r.length===s+2&&t!==null){let f=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(f){let v=a.getPositionAt(h),b=a.getPositionAt(h+g);f.value=p,f.valueRange={startLineNumber:v.lineNumber,startColumn:v.column,endLineNumber:b.lineNumber,endColumn:b.column},f.range=Object.assign(f.range,{endLineNumber:b.lineNumber,endColumn:b.column})}}}let u={onObjectBegin:(p,h)=>{if(i(o,r)){s=r.length;let f=a.getPositionAt(p);l.startLineNumber=f.lineNumber,l.startColumn=f.column}let g={};c(g,p,h),n=g,o=null,r.push(n)},onObjectProperty:(p,h,g)=>{if(o=p,r.length===s+1||r.length===s+2&&t!==null){let f=a.getPositionAt(h),v={description:[],descriptionIsMarkdown:!1,key:p,keyRange:{startLineNumber:f.lineNumber,startColumn:f.column+1,endLineNumber:f.lineNumber,endColumn:f.column+g},range:{startLineNumber:f.lineNumber,startColumn:f.column,endLineNumber:0,endColumn:0},value:null,valueRange:wf,descriptionRanges:[],overrides:[],overrideOf:t??void 0};r.length===s+1?(e.push(v),af.test(p)&&(t=v)):t.overrides.push(v)}},onObjectEnd:(p,h)=>{if(n=r.pop(),s!==-1&&(r.length===s+1||r.length===s+2&&t!==null)){let g=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(g){let f=a.getPositionAt(p+h);g.valueRange=Object.assign(g.valueRange,{endLineNumber:f.lineNumber,endColumn:f.column}),g.range=Object.assign(g.range,{endLineNumber:f.lineNumber,endColumn:f.column})}r.length===s+1&&(t=null)}if(r.length===s){let g=a.getPositionAt(p);l.endLineNumber=g.lineNumber,l.endColumn=g.column,s=-1}},onArrayBegin:(p,h)=>{let g=[];c(g,p,h),r.push(n),n=g,o=null},onArrayEnd:(p,h)=>{if(n=r.pop(),r.length===s+1||r.length===s+2&&t!==null){let g=r.length===s+1?e[e.length-1]:t.overrides[t.overrides.length-1];if(g){let f=a.getPositionAt(p+h);g.valueRange=Object.assign(g.valueRange,{endLineNumber:f.lineNumber,endColumn:f.column}),g.range=Object.assign(g.range,{endLineNumber:f.lineNumber,endColumn:f.column})}}},onLiteralValue:c,onError:p=>{let h=e[e.length-1];h&&(g_i(h.range)||g_i(h.keyRange)||g_i(h.valueRange))&&e.pop()}};return a.isDisposed()||rE(a.getValue(),u),e.length>0?[{id:a.isDisposed()?"":a.id,sections:[{settings:e}],title:"",titleRange:wf,range:l}]:[]}var qhe=class extends Ghe{constructor(){super(...arguments);this._configurationGroups=[]}get configurationGroups(){return this._configurationGroups}parse(){super.parse(),this._configurationGroups=uvo(this.settingsModel,(e,t)=>t.length===0)}isSettingsProperty(e,t){return e==="settings"&&t.length===1}},JPe=class extends k{constructor(e,t,o){super();this._mostCommonlyUsedSettingsKeys=e;this.target=t;this.configurationService=o;this._settingsByName=new Map;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(o.onDidChangeConfiguration(n=>{n.source===7&&(this.reset(),this._onDidChange.fire())}))}getContent(e=!1){return(!this._content||e)&&this.initialize(),this._content}getContentWithoutMostCommonlyUsed(e=!1){return(!this._contentWithoutMostCommonlyUsed||e)&&this.initialize(),this._contentWithoutMostCommonlyUsed}getSettingsGroups(e=!1){return(!this._allSettingsGroups||e)&&this.initialize(),this._allSettingsGroups}initialize(){this._allSettingsGroups=this.parse(),this._content=this.toContent(this._allSettingsGroups,0),this._contentWithoutMostCommonlyUsed=this.toContent(this._allSettingsGroups,1)}reset(){this._content=void 0,this._contentWithoutMostCommonlyUsed=void 0,this._allSettingsGroups=void 0}parse(){let e=this.getRegisteredGroups();return this.initAllSettingsMap(e),[this.getMostCommonlyUsedSettings(),...e]}getRegisteredGroups(){let e=oe.as($t.Configuration),t={...e.getConfigurationProperties()},o=e.getExcludedConfigurationProperties();for(let r of this.configurationService.keys().policy??[]){let s=o[r];s&&(t[r]=s)}let n=this.removeEmptySettingsGroups(this.parseProperties(t).sort(this.compareGroups));return this.sortGroups(n)}sortGroups(e){return e.forEach(t=>{t.sections.forEach(o=>{o.settings.sort((n,r)=>n.key.localeCompare(r.key))})}),e}initAllSettingsMap(e){this._settingsByName=new Map;for(let t of e)for(let o of t.sections)for(let n of o.settings)this._settingsByName.set(n.key,n)}getMostCommonlyUsedSettings(){let e=ui(this._mostCommonlyUsedSettingsKeys.map(t=>{let o=this._settingsByName.get(t);return o?{description:o.description,key:o.key,value:o.value,keyRange:wf,range:wf,valueRange:wf,overrides:[],scope:5,type:o.type,enum:o.enum,enumDescriptions:o.enumDescriptions,descriptionRanges:[]}:null}));return{id:"mostCommonlyUsed",range:wf,title:d(19195,null),titleRange:wf,sections:[{settings:e}]}}parseProperties(e){let t=[],o=new Map,n=new Map;for(let[r,s]of Object.entries(e)){if(!s.section)continue;let l;if(s.section.title){let u=o.get(s.section.title);if(u){let p=s.section.extensionInfo?.id;l=u.find(h=>h.extensionInfo?.id===p)}}if(!l&&s.section.id){let u=n.get(s.section.id);if(u){let p=s.section.extensionInfo?.id;l=u.find(h=>h.extensionInfo?.id===p&&!h.title)}if(l&&!l?.title&&s.section.title){l.title=s.section.title;let p=o.get(s.section.title);p?p.push(l):o.set(s.section.title,[l])}}if(!l){if(l={sections:[{title:s.section.title,settings:[]}],id:s.section.id||"",title:s.section.title??"",titleRange:wf,order:s.section.order,range:wf,extensionInfo:We(s.source)?void 0:s.source},t.push(l),s.section.title){let u=o.get(s.section.title);u?u.push(l):o.set(s.section.title,[l])}if(s.section.id){let u=n.get(s.section.id);u?u.push(l):n.set(s.section.id,[l])}}let c=this.parseSetting(r,s);c&&l.sections[0].settings.push(c)}return t}removeEmptySettingsGroups(e){let t=[];for(let o of e)o.sections=o.sections.filter(n=>n.settings.length>0),o.sections.length&&t.push(o);return t}parseSetting(e,t){if(!this.matchesScope(t))return;let o=t.default,n=t.markdownDescription||t.description||"";typeof n!="string"&&(n="");let r=n.split(`
`),s=af.test(e)?this.parseOverrideSettings(t.default):[],l;t.type==="array"&&t.items&&!Array.isArray(t.items)&&t.items.type&&(t.items.enum?l="enum":Array.isArray(t.items.type)||(l=t.items.type));let c=t.type==="object"?t.properties:void 0,u=t.type==="object"?t.patternProperties:void 0,p=t.type==="object"?t.additionalProperties:void 0,h=t.type==="object"?t.propertyNames:void 0,g=t.enum,f=t.markdownEnumDescriptions??t.enumDescriptions,v=!!t.markdownEnumDescriptions;l==="enum"&&!Array.isArray(t.items)&&(g=t.items.enum,f=t.items.markdownEnumDescriptions??t.items.enumDescriptions,v=!!t.items.markdownEnumDescriptions);let b=!1;t.type==="object"&&!t.additionalProperties&&t.properties&&Object.keys(t.properties).length&&(b=Object.keys(t.properties).every(w=>t.properties[w].type==="boolean"));let S=!1;af.test(e)&&(S=!0);let y;if(!S){let w=t;w&&w.defaultValueSource&&(y=w.defaultValueSource)}return!g&&(t.enumItemLabels||f||v)&&console.error(`The setting ${e} has enum-related fields, but doesn't have an enum field. This setting may render improperly in the Settings editor.`),{key:e,value:o,description:r,descriptionIsMarkdown:!!t.markdownDescription,keywords:t.keywords,range:wf,keyRange:wf,valueRange:wf,descriptionRanges:[],overrides:s,scope:t.scope,type:t.type,arrayItemType:l,objectProperties:c,objectPatternProperties:u,objectAdditionalProperties:p,propertyNames:h,enum:g,enumDescriptions:f,enumDescriptionsAreMarkdown:v,enumItemLabels:t.enumItemLabels,uniqueItems:t.uniqueItems,tags:t.tags,disallowSyncIgnore:t.disallowSyncIgnore,restricted:t.restricted,extensionInfo:We(t.source)?void 0:t.source,deprecationMessage:t.markdownDeprecationMessage||t.deprecationMessage,deprecationMessageIsMarkdown:!!t.markdownDeprecationMessage,validator:m_i(t),allKeysAreBoolean:b,editPresentation:t.editPresentation,order:t.order,nonLanguageSpecificDefaultValueSource:y,isLanguageTagSetting:S,categoryLabel:(We(t.source)?void 0:t.source?.id)===t.section?.id?t.title:t.section?.id}}parseOverrideSettings(e){return Object.keys(e).map(t=>({key:t,value:e[t],description:[],descriptionIsMarkdown:!1,range:wf,keyRange:wf,valueRange:wf,descriptionRanges:[],overrides:[]}))}matchesScope(e){return e.scope?this.target===6?yte.indexOf(e.scope)!==-1:this.target===5?N8.indexOf(e.scope)!==-1:!0:!0}compareGroups(e,t){if(typeof e?.order!="number")return 1;if(typeof t?.order!="number")return-1;if(e.order===t.order){let o=e.title||"",n=t.title||"";return o.localeCompare(n)}return e.order-t.order}toContent(e,t){let o=new Eit;for(let n=t;n<e.length;n++)o.pushGroup(e[n],n===t,n===e.length-1);return o.getContent()}},ZPe=class extends kit{constructor(e,t,o){super();this._uri=e;this.defaultSettings=o;this._onDidChangeGroups=this._register(new T);this.onDidChangeGroups=this._onDidChangeGroups.event;this._register(o.onDidChange(()=>this._onDidChangeGroups.fire())),this._model=t.object.textEditorModel,this._register(this.onWillDispose(()=>t.dispose()))}get uri(){return this._uri}get target(){return this.defaultSettings.target}get settingsGroups(){return this.defaultSettings.getSettingsGroups()}get filterGroups(){return this.settingsGroups.slice(1)}update(){if(this._model.isDisposed())return;let e=[...this._currentResultGroups.values()].sort((l,c)=>l.order-c.order),t=e.filter(l=>l.result.filterMatches.length),o=this.settingsGroups.at(-1).range.endLineNumber+2,{settingsGroups:n,matches:r}=this.writeResultGroups(t,o),s=this.collectMetadata(e);return e.length?{allGroups:this.settingsGroups,filteredGroups:n,matches:r,metadata:s??void 0}:void 0}writeResultGroups(e,t){let o=t-1,n=new Eit(o),r=[],s=[];e.length&&(n.pushLine(","),e.forEach(g=>{let f=this.getGroup(g);r.push(f),s.push(...this.writeSettingsGroupToBuilder(n,f,g.result.filterMatches))}));let l=n.getContent()+`
`,c=this._model.getLineCount(),u=new ei(t,1,t,1),p={text:l,forceMoveMarkers:!0,range:new G(t,1,c,1)};this._model.pushEditOperations([u],[p],()=>[u]);let h=Math.min(t+60,this._model.getLineCount());return this._model.tokenization.forceTokenization(h),{matches:s,settingsGroups:r}}writeSettingsGroupToBuilder(e,t,o){return o=o.map(r=>({setting:r.setting,score:r.score,matchType:r.matchType,keyMatchScore:r.keyMatchScore,matches:r.matches&&r.matches.map(s=>new G(s.startLineNumber-r.setting.range.startLineNumber,s.startColumn,s.endLineNumber-r.setting.range.startLineNumber,s.endColumn))})),e.pushGroup(t),o.map(r=>r.matches||[]).flatMap((r,s)=>{let l=t.sections[0].settings[s];return r.map(c=>new G(c.startLineNumber+l.range.startLineNumber,c.startColumn,c.endLineNumber+l.range.startLineNumber,c.endColumn))})}copySetting(e){return{description:e.description,scope:e.scope,type:e.type,enum:e.enum,enumDescriptions:e.enumDescriptions,key:e.key,value:e.value,range:e.range,overrides:[],overrideOf:e.overrideOf,tags:e.tags,deprecationMessage:e.deprecationMessage,keyRange:wf,valueRange:wf,descriptionIsMarkdown:void 0,descriptionRanges:[]}}getPreference(e){for(let t of this.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(n.key===e)return n}getGroup(e){return{id:e.id,range:wf,title:e.label,titleRange:wf,sections:[{settings:e.result.filterMatches.map(t=>this.copySetting(t.setting))}]}}},Eit=class{constructor(i=0){this._rangeOffset=i;this._contentByLines=[]}get lineCountWithOffset(){return this._contentByLines.length+this._rangeOffset}get lastLine(){return this._contentByLines[this._contentByLines.length-1]||""}pushLine(...i){this._contentByLines.push(...i)}pushGroup(i,e,t){this._contentByLines.push(e?"[{":"{");let o=this._pushGroup(i,"  ");if(o){let n=o.range.endLineNumber-this._rangeOffset,r=this._contentByLines[n-2];this._contentByLines[n-2]=r.substring(0,r.length-1)}this._contentByLines.push(t?"}]":"},")}_pushGroup(i,e){let t=null,o=this.lineCountWithOffset+1;for(let n of i.sections)if(n.title&&this.addDescription([n.title],e,this._contentByLines),n.settings.length)for(let r of n.settings)this.pushSetting(r,e),t=r;return i.range={startLineNumber:o,startColumn:1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length},t}getContent(){return this._contentByLines.join(`
`)}pushSetting(i,e){let t=this.lineCountWithOffset+1;this.pushSettingDescription(i,e);let o=e,n=JSON.stringify(i.key);o+=n,i.keyRange={startLineNumber:this.lineCountWithOffset+1,startColumn:o.indexOf(i.key)+1,endLineNumber:this.lineCountWithOffset+1,endColumn:i.key.length},o+=": ";let r=this.lineCountWithOffset+1;this.pushValue(i,o,e),i.valueRange={startLineNumber:r,startColumn:o.length+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length+1},this._contentByLines[this._contentByLines.length-1]+=",",this._contentByLines.push(""),i.range={startLineNumber:t,startColumn:1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length}}pushSettingDescription(i,e){i.descriptionRanges=[];let t=e+"// ",o=i.deprecationMessage?.split(/\n/g)??[];for(let n of[...o,...i.description])n=HUt(n),this._contentByLines.push(t+n),i.descriptionRanges.push({startLineNumber:this.lineCountWithOffset,startColumn:this.lastLine.indexOf(n)+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length});i.enum&&i.enumDescriptions?.some(n=>!!n)&&i.enumDescriptions.forEach((n,r)=>{let s=_on(String(i.enum[r])),l=n?`${s}: ${HUt(n)}`:s,c=l.split(/\n/g);c[0]=" - "+c[0],this._contentByLines.push(...c.map(u=>`${e}// ${u}`)),i.descriptionRanges.push({startLineNumber:this.lineCountWithOffset,startColumn:this.lastLine.indexOf(l)+1,endLineNumber:this.lineCountWithOffset,endColumn:this.lastLine.length})})}pushValue(i,e,t){let o=JSON.stringify(i.value,null,t);if(o&&typeof i.value=="object")if(i.overrides&&i.overrides.length){this._contentByLines.push(e+" {");for(let s of i.overrides)this.pushSetting(s,t+t),this._contentByLines.pop();let n=i.overrides[i.overrides.length-1],r=this._contentByLines[n.range.endLineNumber-2];this._contentByLines[n.range.endLineNumber-2]=r.substring(0,r.length-1),this._contentByLines.push(t+"}")}else{let n=o.split(`
`);this._contentByLines.push(e+n[0]);for(let r=1;r<n.length;r++)this._contentByLines.push(t+n[r])}else this._contentByLines.push(e+o)}addDescription(i,e,t){for(let o of i)t.push(e+"// "+o)}},f_i=class extends Eit{constructor(e="	"){super(0);this.indent=e}pushGroup(e){this._pushGroup(e,this.indent)}},UUt=class extends k{constructor(e){super();this.defaultSettings=e;this._content=null;this._onDidContentChanged=this._register(new T);this.onDidContentChanged=this._onDidContentChanged.event;this._register(e.onDidChange(()=>{this._content=null,this._onDidContentChanged.fire()}))}get content(){if(this._content===null){let e=new f_i;e.pushLine("{");for(let t of this.defaultSettings.getRegisteredGroups())e.pushGroup(t);e.pushLine("}"),this._content=e.getContent()}return this._content}};function _on(a){return a&&a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}function b_i(a){return"// "+d(19196,null)+`
`+a.getDefaultKeybindingsContent()}var XPe=class{constructor(i,e){this._uri=i;this.keybindingService=e}get uri(){return this._uri}get content(){return this._content||(this._content=b_i(this.keybindingService)),this._content}getPreference(){return null}dispose(){}};XPe=I([m(1,Le)],XPe);var Don=`{
}`,Tit=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E){super();this.editorService=e;this.editorGroupService=t;this.textFileService=o;this.configurationService=n;this.notificationService=r;this.contextService=s;this.instantiationService=l;this.userDataProfileService=c;this.userDataProfilesService=u;this.textModelResolverService=p;this.jsonEditingService=f;this.labelService=v;this.remoteAgentService=b;this.textEditorService=S;this.extensionService=w;this.progressService=x;this.environmentService=E;this._onDispose=this._register(new T);this._onDidDefaultSettingsContentChanged=this._register(new T);this.onDidDefaultSettingsContentChanged=this._onDidDefaultSettingsContentChanged.event;this._requestedDefaultSettings=new xn;this._settingsGroups=void 0;this._cachedSettingsEditor2Input=void 0;this.defaultKeybindingsResource=A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/keybindings.json"});this.defaultSettingsRawResource=A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/defaultSettings.jsonc"});this._register(h.onDidUpdateKeybindings(()=>{let M=g.getModel(this.defaultKeybindingsResource);M&&g.updateModel(M,b_i(h))})),this._register(y.registerHandler(this))}get userSettingsResource(){return this.userDataProfileService.currentProfile.settingsResource}get workspaceSettingsResource(){if(this.contextService.getWorkbenchState()===1)return null;let e=this.contextService.getWorkspace();return e.configuration||e.folders[0].toResource(zRe)}createOrGetCachedSettingsEditor2Input(){return(!this._cachedSettingsEditor2Input||this._cachedSettingsEditor2Input.isDisposed())&&(this._cachedSettingsEditor2Input=new PR(this)),this._cachedSettingsEditor2Input}getFolderSettingsResource(e){let t=this.contextService.getWorkspaceFolder(e);return t?t.toResource(zRe):null}hasDefaultSettingsContent(e){return this.isDefaultSettingsResource(e)||ze(e,this.defaultSettingsRawResource)||ze(e,this.defaultKeybindingsResource)}getDefaultSettingsContent(e){if(this.isDefaultSettingsResource(e)){let t=this.getConfigurationTargetFromDefaultSettingsResource(e),o=this.getDefaultSettings(t);return this._requestedDefaultSettings.has(e)||(this._register(o.onDidChange(()=>this._onDidDefaultSettingsContentChanged.fire(e))),this._requestedDefaultSettings.add(e)),o.getContentWithoutMostCommonlyUsed(!0)}if(ze(e,this.defaultSettingsRawResource))return this._defaultRawSettingsEditorModel||(this._defaultRawSettingsEditorModel=this._register(this.instantiationService.createInstance(UUt,this.getDefaultSettings(3))),this._register(this._defaultRawSettingsEditorModel.onDidContentChanged(()=>this._onDidDefaultSettingsContentChanged.fire(e)))),this._defaultRawSettingsEditorModel.content;if(ze(e,this.defaultKeybindingsResource))return this.instantiationService.createInstance(XPe,e).content}async createPreferencesEditorModel(e){if(this.isDefaultSettingsResource(e))return this.createDefaultSettingsEditorModel(e);if(this.userSettingsResource.toString()===e.toString()||this.userDataProfilesService.defaultProfile.settingsResource.toString()===e.toString())return this.createEditableSettingsEditorModel(3,e);let t=await this.getEditableSettingsURI(5);if(t&&t.toString()===e.toString())return this.createEditableSettingsEditorModel(5,t);if(this.contextService.getWorkbenchState()===3){let r=await this.getEditableSettingsURI(6,e);if(r&&r.toString()===e.toString())return this.createEditableSettingsEditorModel(6,e)}let o=await this.remoteAgentService.getEnvironment(),n=o?o.settingsPath:null;return n&&n.toString()===e.toString()?this.createEditableSettingsEditorModel(4,e):null}openRawDefaultSettings(){return this.editorService.openEditor({resource:this.defaultSettingsRawResource})}openRawUserSettings(){return this.editorService.openEditor({resource:this.userSettingsResource})}shouldOpenJsonByDefault(){return this.configurationService.getValue("workbench.settings.editor")==="json"}async openPreferences(){await this.editorService.openEditor(this.instantiationService.createInstance(Qte),void 0,MM)}openSettings(e={}){return e={...e,target:3},e.query&&(e.jsonEditor=!1),this.open(this.userSettingsResource,e)}openLanguageSpecificSettings(e,t={}){return this.shouldOpenJsonByDefault()?(t.query=void 0,t.revealSetting={key:`[${e}]`,edit:!0}):t.query=`@lang:${e}${t.query?` ${t.query}`:""}`,t.target=t.target??3,this.open(this.userSettingsResource,t)}open(e,t){if(t={...t,jsonEditor:t.jsonEditor??this.shouldOpenJsonByDefault()},t.jsonEditor&&t.query&&!t.revealSetting){let o=t.query.trim(),n=o.match(/^@id:(.+)$/),r;n?r=n[1].trim():oe.as($t.Configuration).getConfigurationProperties()[o.trim()]&&(r=o.trim()),t.query=void 0,r&&(t.revealSetting={key:r})}return t.jsonEditor?this.openSettingsJson(e,t):this.openSettings2(t)}async openSettings2(e){let t=this.createOrGetCachedSettingsEditor2Input();e={...e,focusSearch:!0};let o=this.getEditorGroupFromOptions(e);return this.editorService.openEditor(t,URe(e),o)}openApplicationSettings(e={}){return e={...e,target:3},this.open(this.userDataProfilesService.defaultProfile.settingsResource,e)}openUserSettings(e={}){return e={...e,target:3},this.open(this.userSettingsResource,e)}async openRemoteSettings(e={}){let t=await this.remoteAgentService.getEnvironment();t&&(e={...e,target:4},this.open(t.settingsPath,e))}openWorkspaceSettings(e={}){return this.workspaceSettingsResource?(e={...e,target:5},this.open(this.workspaceSettingsResource,e)):(this.notificationService.info(d(19190,null)),Promise.reject(null))}async openFolderSettings(e={}){if(e={...e,target:6},!e.folderUri)throw new Error("Missing folder URI");let t=await this.getEditableSettingsURI(6,e.folderUri);if(!t)throw new Error(`Invalid folder URI - ${e.folderUri.toString()}`);return this.open(t,e)}async openGlobalKeybindingSettings(e,t){if(t={pinned:!0,revealIfOpened:!0,...t},e){let o="// "+d(19188,null)+`
[
]`,n=this.userDataProfileService.currentProfile.keybindingsResource,r=!!this.configurationService.getValue("workbench.settings.openDefaultKeybindings");if(await this.createIfNotExists(n,o),r){let s=t.groupId??this.editorGroupService.activeGroup.id,l=this.editorGroupService.addGroup(s,3);await Promise.all([this.editorService.openEditor({resource:this.defaultKeybindingsResource,options:{pinned:!0,preserveFocus:!0,revealIfOpened:!0,override:Da.id},label:d(19187,null),description:""},s),this.editorService.openEditor({resource:n,options:t},l.id)])}else await this.editorService.openEditor({resource:n,options:t},this.getEditorGroupFromOptions(t))}else{let o=this.getEditorGroupFromOptions(t),n=await this.editorService.openEditor(this.instantiationService.createInstance(MR),{...t},o);t.query&&n.search(t.query)}}openDefaultKeybindingsFile(){return this.editorService.openEditor({resource:this.defaultKeybindingsResource,label:d(19187,null)})}getEditorGroupFromOptions(e){return this.configurationService.getValue("workbench.editor.useModal")!=="off"&&!this.environmentService.enableSmokeTestDriver&&!this.environmentService.extensionTestsLocationURI?MM:e.openToSide?En:e?.groupId!==void 0?this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup:tr}async openSettingsJson(e,t){let o=this.getEditorGroupFromOptions(t),n=await this.doOpenSettingsJson(e,t,o);return n&&t?.revealSetting&&await this.revealSetting(t.revealSetting.key,!!t.revealSetting.edit,n,e),n}async doOpenSettingsJson(e,t,o){let n=!!this.configurationService.getValue(IZe),r=!!this.configurationService.getValue(SZe);if(n||r)return this.doOpenSplitJSON(e,t,o);let s=t?.target??2,l=await this.getOrCreateEditableSettingsEditorInput(s,e);return t={...t,pinned:!0},await this.editorService.openEditor(l,{...URe(t)},o)}async doOpenSplitJSON(e,t={},o){let n=t.target??2;await this.createSettingsIfNotExists(n,e);let r=this.createSplitJsonEditorInput(n,e);return t={...t,pinned:!0},this.editorService.openEditor(r,URe(t),o)}createSplitJsonEditorInput(e,t){let o=this.textEditorService.createTextEditor({resource:t}),n=this.textEditorService.createTextEditor({resource:this.getDefaultSettingsResource(e)});return this.instantiationService.createInstance(ja,o.getName(),void 0,n,o)}createSettings2EditorModel(){return this.instantiationService.createInstance(Yte,this.getDefaultSettings(3))}getConfigurationTargetFromDefaultSettingsResource(e){return this.isDefaultWorkspaceSettingsResource(e)?5:this.isDefaultFolderSettingsResource(e)?6:3}isDefaultSettingsResource(e){return this.isDefaultUserSettingsResource(e)||this.isDefaultWorkspaceSettingsResource(e)||this.isDefaultFolderSettingsResource(e)}isDefaultUserSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Q.vscode&&!!e.path.match(/\/(\d+\/)?settings\.json$/)}isDefaultWorkspaceSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Q.vscode&&!!e.path.match(/\/(\d+\/)?workspaceSettings\.json$/)}isDefaultFolderSettingsResource(e){return e.authority==="defaultsettings"&&e.scheme===Q.vscode&&!!e.path.match(/\/(\d+\/)?resourceSettings\.json$/)}getDefaultSettingsResource(e){switch(e){case 5:return A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/workspaceSettings.json"});case 6:return A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/resourceSettings.json"})}return A.from({scheme:Q.vscode,authority:"defaultsettings",path:"/settings.json"})}async getOrCreateEditableSettingsEditorInput(e,t){return await this.createSettingsIfNotExists(e,t),this.textEditorService.createTextEditor({resource:t})}async createEditableSettingsEditorModel(e,t){let o=this.contextService.getWorkspace();if(o.configuration&&o.configuration.toString()===t.toString()){let r=await this.textModelResolverService.createModelReference(t);return this.instantiationService.createInstance(qhe,r,e)}let n=await this.textModelResolverService.createModelReference(t);return this.instantiationService.createInstance(Ghe,n,e)}async createDefaultSettingsEditorModel(e){let t=await this.textModelResolverService.createModelReference(e),o=this.getConfigurationTargetFromDefaultSettingsResource(e);return this.instantiationService.createInstance(ZPe,e,t,this.getDefaultSettings(o))}getDefaultSettings(e){return e===5?(this._defaultWorkspaceSettingsContentModel??=this._register(new JPe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultWorkspaceSettingsContentModel):e===6?(this._defaultFolderSettingsContentModel??=this._register(new JPe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultFolderSettingsContentModel):(this._defaultUserSettingsContentModel??=this._register(new JPe(this.getMostCommonlyUsedSettings(),e,this.configurationService)),this._defaultUserSettingsContentModel)}async getEditableSettingsURI(e,t){switch(e){case 1:return this.userDataProfilesService.defaultProfile.settingsResource;case 2:case 3:return this.userSettingsResource;case 4:{let o=await this.remoteAgentService.getEnvironment();return o?o.settingsPath:null}case 5:return this.workspaceSettingsResource;case 6:if(t)return this.getFolderSettingsResource(t)}return null}async createSettingsIfNotExists(e,t){if(this.contextService.getWorkbenchState()===3&&e===5){let o=this.contextService.getWorkspace().configuration;if(!o)return;let n=await this.textFileService.read(o);Object.keys(is(n.value)).indexOf("settings")===-1&&await this.jsonEditingService.write(t,[{path:["settings"],value:{}}],!0);return}await this.createIfNotExists(t,Don)}async createIfNotExists(e,t){try{await this.textFileService.read(e,{acceptTextOnly:!0})}catch(o){if(o.fileOperationResult===1)try{await this.textFileService.write(e,t);return}catch(n){throw new Error(d(19189,null,this.labelService.getUriLabel(e,{relative:!0}),Dn(n)))}else throw o}}getMostCommonlyUsedSettings(){return["editor.fontSize","editor.formatOnSave","files.autoSave","editor.defaultFormatter","editor.fontFamily","editor.wordWrap","chat.agent.maxRequests","files.exclude","workbench.colorTheme","editor.tabSize","editor.mouseWheelZoom","editor.formatOnPaste"]}async revealSetting(e,t,o,n){let r=o?da(o.getControl()):null;if(!r)return;let s=await this.createPreferencesEditorModel(n);if(!s)return;let l=await this.getPositionToReveal(e,t,s,r);l&&(r.setPosition(l),r.revealPositionNearTop(l),r.focus(),t&&Sc.get(r)?.triggerSuggest())}async getPositionToReveal(e,t,o,n){let r=n.getModel();if(!r)return null;let s=oe.as($t.Configuration).getConfigurationProperties()[e],l=af.test(e);if(!s&&!l)return null;let c=null,u=s?.type??"object",p=o.getPreference(e);if(!p&&t){let h=u==="object"||u==="array"?this.configurationService.inspect(e).defaultValue:i3e(u);if(h=h===void 0&&l?{}:h,h!==void 0){let g=o instanceof qhe?["settings",e]:[e];await this.jsonEditingService.write(o.uri,[{path:g,value:h}],!1),p=o.getPreference(e)}}if(p)if(t)if(Di(p.value)||Array.isArray(p.value)){c={lineNumber:p.valueRange.startLineNumber,column:p.valueRange.startColumn+1},n.setPosition(c),await this.instantiationService.invokeFunction(g=>VL.LineBreakInsert.runEditorCommand(g,n,null)),c={lineNumber:c.lineNumber+1,column:r.getLineMaxColumn(c.lineNumber+1)};let h=r.getLineFirstNonWhitespaceColumn(c.lineNumber);h&&(n.setPosition({lineNumber:c.lineNumber,column:h}),await this.instantiationService.invokeFunction(g=>VL.LineBreakInsert.runEditorCommand(g,n,null)),c={lineNumber:c.lineNumber,column:r.getLineMaxColumn(c.lineNumber)})}else c={lineNumber:p.valueRange.startLineNumber,column:p.valueRange.endColumn};else c={lineNumber:p.keyRange.startLineNumber,column:p.keyRange.startColumn};return c}getSetting(e){if(!this._settingsGroups){let t=this.getDefaultSettings(2),o=this._register(new ue);o.value=t.onDidChange(()=>{this._settingsGroups=void 0,o.clear()}),this._settingsGroups=t.getSettingsGroups()}for(let t of this._settingsGroups)for(let o of t.sections)for(let n of o.settings)if(MS(n.key,e)===0)return n}async handleURL(e){if(MS(e.authority,KRe)!==0)return!1;let t=e.path.split("/").filter(s=>!!s),o=t.length>0?t[0]:void 0;if(!o)return this.openSettings(),!0;let n=this.getSetting(o);!n&&this.extensionService.extensions.length===0&&(await this.progressService.withProgress({location:10},()=>U.toPromise(this.extensionService.onDidRegisterExtensions)),n=this.getSetting(o));let r={};return n&&(r.query=o),this.openSettings(r),!0}dispose(){this._cachedSettingsEditor2Input&&!this._cachedSettingsEditor2Input.isDisposed()&&this._cachedSettingsEditor2Input.dispose(),this._onDispose.fire(),super.dispose()}};Tit=I([m(0,ie),m(1,kt),m(2,Uo),m(3,B),m(4,Ne),m(5,Ae),m(6,F),m(7,gn),m(8,hn),m(9,Bt),m(10,Le),m(11,_t),m(12,Zg),m(13,nt),m(14,bo),m(15,TE),m(16,tS),m(17,lt),m(18,Go),m(19,Mt)],Tit);Ce(Qo,Tit,1);var _it=class{constructor(i,e,t,o){this.fileService=i;this.textModelResolverService=e;this.textFileService=t;this.filesConfigurationService=o;this.queue=new Hh}write(i,e){return Promise.resolve(this.queue.queue(()=>this.doWriteConfiguration(i,e)))}async doWriteConfiguration(i,e){let t=await this.resolveAndValidate(i,!0);try{await this.writeToBuffer(t.object.textEditorModel,e)}finally{t.dispose()}}async writeToBuffer(i,e){let t;try{t=this.filesConfigurationService.enableAutoSaveAfterShortDelay(i.uri);let o=!1;for(let n of e){let r=this.getEdits(i,n)[0];o=!!r&&this.applyEditsToBuffer(r,i)||o}if(o)return this.textFileService.save(i.uri)}finally{t?.dispose()}}applyEditsToBuffer(i,e){let t=e.getPositionAt(i.offset),o=e.getPositionAt(i.offset+i.length),n=new G(t.lineNumber,t.column,o.lineNumber,o.column),r=e.getValueInRange(n);if(i.content!==r){let s=r?Qn.replace(n,i.content):Qn.insert(t,i.content);return e.pushEditOperations([new ei(t.lineNumber,t.column,t.lineNumber,t.column)],[s],()=>[]),!0}return!1}getEdits(i,e){let{tabSize:t,insertSpaces:o}=i.getOptions(),n=i.getEOL(),{path:r,value:s}=e;if(!r.length){let l=JSON.stringify(s,null,o?" ".repeat(t):"	");return[{content:l,length:l.length,offset:0}]}return rS(i.getValue(),r,s,{tabSize:t,insertSpaces:o,eol:n})}async resolveModelReference(i){return await this.fileService.exists(i)||await this.textFileService.write(i,"{}",{encoding:"utf8"}),this.textModelResolverService.createModelReference(i)}hasParseErrors(i){let e=[];return is(i.getValue(),e,{allowTrailingComma:!0,allowEmptyContent:!0}),e.length>0}async resolveAndValidate(i,e){let t=await this.resolveModelReference(i),o=t.object.textEditorModel;return this.hasParseErrors(o)?(t.dispose(),this.reject(0)):t}reject(i){let e=this.toErrorMessage(i);return Promise.reject(new WUt(e,i))}toErrorMessage(i){if(i===0)return d(18757,null)}};_it=I([m(0,ge),m(1,Bt),m(2,Uo),m(3,fr)],_it);Ce(Zg,_it,1);var MW=class extends CC{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(r,n,f,v);this.resource=e;this.preferredEncoding=t;this.preferredLanguageId=o;this.fileService=s;this.textFileService=l;this.workingCopyBackupService=c;this.logService=u;this.workingCopyService=p;this.filesConfigurationService=h;this.labelService=g;this.pathService=b;this.extensionService=S;this.progressService=y;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidResolve=this._register(new T);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSaveError=this._register(new T);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new T);this.onDidRevert=this._onDidRevert.event;this._onDidChangeEncoding=this._register(new T);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this._onDidChangeOrphaned=this._register(new T);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidChangeReadonly=this._register(new T);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this.typeId=vN;this.capabilities=0;this.versionId=0;this.ignoreDirtyOnModelContentChange=!1;this.ignoreSaveFromSaveParticipants=!1;this.lastModelContentChangeFromUndoRedo=void 0;this.saveSequentializer=new vwe;this.dirty=!1;this.inConflictMode=!1;this.inOrphanMode=!1;this.inErrorMode=!1;this.hasEncodingSetExplicitly=!1;this.name=Jo(this.labelService.getUriLabel(this.resource)),this.resourceHasExtension=!!Jn.extname(this.resource),this._register(this.workingCopyService.registerWorkingCopy(this)),this.registerListeners()}static{this.TEXTFILE_SAVE_ENCODING_SOURCE=Qh.registerSource("textFileEncoding.source",d(19286,null))}static{this.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD=500}registerListeners(){this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.filesConfigurationService.onDidChangeFilesAssociation(()=>this.onDidChangeFilesAssociation())),this._register(this.filesConfigurationService.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire()))}async onDidFilesChange(e){let t=!1,o;if(this.inOrphanMode?e.contains(this.resource,1)&&(o=!1,t=!0):e.contains(this.resource,2)&&(o=!0,t=!0),t&&this.inOrphanMode!==o){let n=!1;o&&(await Li(100,Ie.None),this.isDisposed()?n=!0:n=!await this.fileService.exists(this.resource)),this.inOrphanMode!==n&&!this.isDisposed()&&this.setOrphaned(n)}}setOrphaned(e){this.inOrphanMode!==e&&(this.inOrphanMode=e,this._onDidChangeOrphaned.fire())}onDidChangeFilesAssociation(){if(!this.isResolved())return;let e=this.getFirstLineText(this.textEditorModel),t=this.getOrCreateLanguage(this.resource,this.languageService,this.preferredLanguageId,e);this.textEditorModel.setLanguage(t)}setLanguageId(e,t){super.setLanguageId(e,t),this.preferredLanguageId=e}async backup(e){let t;this.lastResolvedFileStat&&(t={mtime:this.lastResolvedFileStat.mtime,ctime:this.lastResolvedFileStat.ctime,size:this.lastResolvedFileStat.size,etag:this.lastResolvedFileStat.etag,orphaned:this.inOrphanMode});let o=await this.textFileService.getEncodedReadable(this.resource,this.createSnapshot()??void 0,{encoding:Jb});return{meta:t,content:o}}async revert(e){if(!this.isResolved())return;let t=this.dirty,o=this.doSetDirty(!1);if(!e?.soft)try{await this.forceResolveFromFile()}catch(r){if(r.fileOperationResult!==1)throw o(),r}this._onDidRevert.fire(),t&&this._onDidChangeDirty.fire()}async resolve(e){if(this.trace("resolve() - enter"),Wo("code/willResolveTextFileEditorModel"),this.isDisposed()){this.trace("resolve() - exit - without resolving because model is disposed");return}if(!e?.contents&&(this.dirty||this.saveSequentializer.isRunning())){this.trace("resolve() - exit - without resolving because model is dirty or being saved");return}await this.doResolve(e),Wo("code/didResolveTextFileEditorModel")}async doResolve(e){if(e?.contents)return this.resolveFromBuffer(e.contents,e);if(!(!this.isResolved()&&await this.resolveFromBackup(e)))return this.resolveFromFile(e)}async resolveFromBuffer(e,t){this.trace("resolveFromBuffer()");let o,n,r,s;try{let c=await this.fileService.stat(this.resource);o=c.mtime,n=c.ctime,r=c.size,s=c.etag,this.setOrphaned(!1)}catch(c){o=Date.now(),n=Date.now(),r=0,s=GL,this.setOrphaned(c.fileOperationResult===1)}let l=await this.textFileService.encoding.getPreferredWriteEncoding(this.resource,this.preferredEncoding);this.resolveFromContent({resource:this.resource,name:this.name,mtime:o,ctime:n,size:r,etag:s,value:e,encoding:l.encoding,readonly:!1,locked:!1,executable:!1},!0,t)}async resolveFromBackup(e){let t=await this.workingCopyBackupService.resolve(this),o=Jb;return t&&(o=(await this.textFileService.encoding.getPreferredWriteEncoding(this.resource,this.preferredEncoding)).encoding),!this.isResolved()?t?(await this.doResolveFromBackup(t,o,e),!0):!1:(this.trace("resolveFromBackup() - exit - without resolving because previously new model got created meanwhile"),!0)}async doResolveFromBackup(e,t,o){this.trace("doResolveFromBackup()"),this.resolveFromContent({resource:this.resource,name:this.name,mtime:e.meta?e.meta.mtime:Date.now(),ctime:e.meta?e.meta.ctime:Date.now(),size:e.meta?e.meta.size:0,etag:e.meta?e.meta.etag:GL,value:await OX(await this.textFileService.getDecodedStream(this.resource,e.value,{encoding:Jb})),encoding:t,readonly:!1,locked:!1,executable:!1},!0,o),e.meta?.orphaned&&this.setOrphaned(!0)}async resolveFromFile(e){this.trace("resolveFromFile()");let t=e?.forceReadFromFile,o=this.isResolved()||e?.allowBinary,n;t?n=GL:this.lastResolvedFileStat&&(n=this.lastResolvedFileStat.etag);let r=this.versionId;try{let s=await this.textFileService.readStream(this.resource,{acceptTextOnly:!o,etag:n,encoding:this.preferredEncoding,limits:e?.limits});if(this.setOrphaned(!1),r!==this.versionId){this.trace("resolveFromFile() - exit - without resolving because model content changed");return}return this.resolveFromContent(s,!1,e)}catch(s){let l=s.fileOperationResult;if(this.setOrphaned(l===1),this.isResolved()&&l===2){s instanceof lK&&this.updateLastResolvedFileStat(s.stat);return}if(this.isResolved()&&l===1&&!t)return;throw s}}resolveFromContent(e,t,o){if(this.trace("resolveFromContent() - enter"),this.isDisposed()){this.trace("resolveFromContent() - exit - because model is disposed");return}this.updateLastResolvedFileStat({resource:this.resource,name:e.name,mtime:e.mtime,ctime:e.ctime,size:e.size,etag:e.etag,readonly:e.readonly,locked:e.locked,executable:!1,isFile:!0,isDirectory:!1,isSymbolicLink:!1,children:void 0});let n=this.contentEncoding;this.contentEncoding=e.encoding,this.preferredEncoding?this.updatePreferredEncoding(this.contentEncoding):n!==this.contentEncoding&&this._onDidChangeEncoding.fire(),this.textEditorModel?this.doUpdateTextModel(e.value,sd.reloadFromDisk()):this.doCreateTextModel(e.resource,e.value),this.setDirty(!!t),this._onDidResolve.fire(o?.reason??3)}doCreateTextModel(e,t){this.trace("doCreateTextModel()");let o=this.createTextEditorModel(t,e,this.preferredLanguageId);this.installModelListeners(o),this.autoDetectLanguage()}doUpdateTextModel(e,t){this.trace("doUpdateTextModel()"),this.ignoreDirtyOnModelContentChange=!0;try{this.updateTextEditorModel(e,this.preferredLanguageId,t)}finally{this.ignoreDirtyOnModelContentChange=!1}}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(e,t.isUndoing||t.isRedoing))),this._register(e.onDidChangeLanguage(()=>this.onMaybeShouldChangeEncoding())),super.installModelListeners(e)}onModelContentChanged(e,t){if(this.trace("onModelContentChanged() - enter"),this.versionId++,this.trace(`onModelContentChanged() - new versionId ${this.versionId}`),t&&(this.lastModelContentChangeFromUndoRedo=Date.now()),!this.ignoreDirtyOnModelContentChange&&!this.isReadonly())if(e.getAlternativeVersionId()===this.bufferSavedVersionId){this.trace("onModelContentChanged() - model content changed back to last saved version");let o=this.dirty;this.setDirty(!1),o&&this._onDidRevert.fire()}else this.trace("onModelContentChanged() - model content changed and marked as dirty"),this.setDirty(!0);this._onDidChangeContent.fire(),this.autoDetectLanguage()}async autoDetectLanguage(){await this.extensionService?.whenInstalledExtensionsRegistered();let e=this.getLanguageId();if(this.resource.scheme===this.pathService.defaultUriScheme&&(!e||e===es)&&!this.resourceHasExtension)return super.autoDetectLanguage()}async forceResolveFromFile(){this.isDisposed()||await this.textFileService.files.resolve(this.resource,{reload:{async:!1},forceReadFromFile:!0})}isDirty(){return this.dirty}isModified(){return this.isDirty()}setDirty(e){if(!this.isResolved())return;let t=this.dirty;this.doSetDirty(e),e!==t&&this._onDidChangeDirty.fire()}doSetDirty(e){let t=this.dirty,o=this.inConflictMode,n=this.inErrorMode,r=this.bufferSavedVersionId;return e?this.dirty=!0:(this.dirty=!1,this.inConflictMode=!1,this.inErrorMode=!1,this.updateSavedVersionId()),()=>{this.dirty=t,this.inConflictMode=o,this.inErrorMode=n,this.bufferSavedVersionId=r}}async save(e=Object.create(null)){return this.isResolved()?this.isReadonly()?(this.trace("save() - ignoring request for readonly resource"),!1):(this.hasState(3)||this.hasState(5))&&(e.reason===2||e.reason===3||e.reason===4)?(this.trace("save() - ignoring auto save request for model that is in conflict or error"),!1):(this.trace("save() - enter"),await this.doSave(e),this.trace("save() - exit"),this.hasState(0)):!1}async doSave(e){typeof e.reason!="number"&&(e.reason=1);let t=this.versionId;if(this.trace(`doSave(${t}) - enter with versionId ${t}`),this.ignoreSaveFromSaveParticipants){this.trace(`doSave(${t}) - exit - refusing to save() recursively from save participant`);return}if(this.saveSequentializer.isRunning(t))return this.trace(`doSave(${t}) - exit - found a running save for versionId ${t}`),this.saveSequentializer.running;if(!e.force&&!this.dirty){this.trace(`doSave(${t}) - exit - because not dirty and/or versionId is different (this.isDirty: ${this.dirty}, this.versionId: ${this.versionId})`);return}if(this.saveSequentializer.isRunning())return this.trace(`doSave(${t}) - exit - because busy saving`),this.saveSequentializer.cancelRunning(),this.saveSequentializer.queue(()=>this.doSave(e));this.isResolved()&&this.textEditorModel.pushStackElement();let o=new qe;return this.progressService.withProgress({title:d(19284,null,this.name),location:10,cancellable:!0,delay:this.isDirty()?3e3:5e3},n=>this.doSaveSequential(t,e,n,o),()=>{o.cancel()}).finally(()=>{o.dispose()})}doSaveSequential(e,t,o,n){return this.saveSequentializer.run(e,(async()=>{if(this.isResolved()&&!t.skipSaveParticipants)try{if(t.reason===2&&typeof this.lastModelContentChangeFromUndoRedo=="number"){let l=Date.now()-this.lastModelContentChangeFromUndoRedo;l<MW.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD&&await Li(MW.UNDO_REDO_SAVE_PARTICIPANTS_AUTO_SAVE_THROTTLE_THRESHOLD-l)}if(!n.token.isCancellationRequested){this.ignoreSaveFromSaveParticipants=!0;try{await this.textFileService.files.runSaveParticipants(this,{reason:t.reason??1,savedFrom:t.from},o,n.token)}catch(l){Yi(l)&&!n.token.isCancellationRequested&&n.cancel()}finally{this.ignoreSaveFromSaveParticipants=!1}}}catch(l){this.logService.error(`[text file model] runSaveParticipants(${e}) - resulted in an error: ${l.toString()}`,this.resource.toString())}if(n.token.isCancellationRequested||(n.dispose(),this.isDisposed())||!this.isResolved())return;e=this.versionId,this.inErrorMode=!1,o.report({message:d(19285,null)}),this.trace(`doSave(${e}) - before write()`);let r=Ti(this.lastResolvedFileStat),s=this;return this.saveSequentializer.run(e,(async()=>{try{let l=await this.textFileService.write(r.resource,s.createSnapshot(),{mtime:r.mtime,encoding:this.getEncoding(),etag:t.ignoreModifiedSince||!this.filesConfigurationService.preventSaveConflicts(r.resource,s.getLanguageId())?GL:r.etag,unlock:t.writeUnlock,writeElevated:t.writeElevated});this.handleSaveSuccess(l,e,t)}catch(l){this.handleSaveError(l,e,t)}})())})(),()=>n.cancel())}handleSaveSuccess(e,t,o){this.updateLastResolvedFileStat(e),t===this.versionId?(this.trace(`handleSaveSuccess(${t}) - setting dirty to false because versionId did not change`),this.setDirty(!1)):this.trace(`handleSaveSuccess(${t}) - not setting dirty to false because versionId did change meanwhile`),this.setOrphaned(!1),this._onDidSave.fire({reason:o.reason,stat:e,source:o.source})}handleSaveError(e,t,o){if((o.ignoreErrorHandler?this.logService.trace:this.logService.error).apply(this.logService,[`[text file model] handleSaveError(${t}) - exit - resulted in a save error: ${e.toString()}`,this.resource.toString()]),o.ignoreErrorHandler)throw e;this.setDirty(!0),this.inErrorMode=!0,e.fileOperationResult===3&&(this.inConflictMode=!0),this.textFileService.files.saveErrorHandler.onSaveError(e,this,o),this._onDidSaveError.fire()}updateSavedVersionId(){this.isResolved()&&(this.bufferSavedVersionId=this.textEditorModel.getAlternativeVersionId())}updateLastResolvedFileStat(e){let t=this.isReadonly();this.lastResolvedFileStat?this.lastResolvedFileStat.mtime<=e.mtime?this.lastResolvedFileStat=e:this.lastResolvedFileStat={...this.lastResolvedFileStat,readonly:e.readonly,locked:e.locked}:this.lastResolvedFileStat=e,this.isReadonly()!==t&&this._onDidChangeReadonly.fire()}hasState(e){switch(e){case 3:return this.inConflictMode;case 1:return this.dirty;case 5:return this.inErrorMode;case 4:return this.inOrphanMode;case 2:return this.saveSequentializer.isRunning();case 0:return!this.dirty}}async joinState(e){return this.saveSequentializer.running}getLanguageId(){return this.textEditorModel?this.textEditorModel.getLanguageId():this.preferredLanguageId}async onMaybeShouldChangeEncoding(){if(this.hasEncodingSetExplicitly){this.trace("onMaybeShouldChangeEncoding() - ignoring because encoding was set explicitly");return}if(this.contentEncoding===VH||this.contentEncoding===K3||this.contentEncoding===G3){this.trace("onMaybeShouldChangeEncoding() - ignoring because content encoding has a BOM");return}let{encoding:e}=await this.textFileService.encoding.getPreferredReadEncoding(this.resource);if(typeof e!="string"||!this.isNewEncoding(e)){this.trace(`onMaybeShouldChangeEncoding() - ignoring because preferred encoding ${e} is not new`);return}if(this.isDirty()){this.trace("onMaybeShouldChangeEncoding() - ignoring because model is dirty");return}return this.logService.info(`Adjusting encoding based on configured language override to '${e}' for ${this.resource.toString(!0)}.`),this.forceResolveFromFile()}setEncoding(e,t){return this.hasEncodingSetExplicitly=!0,this.setEncodingInternal(e,t)}async setEncodingInternal(e,t){if(t===0)this.updatePreferredEncoding(e),this.isDirty()||(this.versionId++,this.setDirty(!0)),this.inConflictMode||await this.save({source:MW.TEXTFILE_SAVE_ENCODING_SOURCE});else{if(!this.isNewEncoding(e))return;if(this.isDirty())throw new Error("Cannot re-open a dirty text document with different encoding. Save it first.");this.updatePreferredEncoding(e),await this.forceResolveFromFile()}}updatePreferredEncoding(e){this.isNewEncoding(e)&&(this.preferredEncoding=e,this._onDidChangeEncoding.fire())}isNewEncoding(e){return!(this.preferredEncoding===e||!this.preferredEncoding&&this.contentEncoding===e)}getEncoding(){return this.preferredEncoding||this.contentEncoding}trace(e){this.logService.trace(`[text file model] ${e}`,this.resource.toString())}isResolved(){return!!this.textEditorModel}isReadonly(){return this.filesConfigurationService.isReadonly(this.resource,this.lastResolvedFileStat)}dispose(){this.trace("dispose()"),this.inConflictMode=!1,this.inOrphanMode=!1,this.inErrorMode=!1,super.dispose()}};MW=I([m(3,Rt),m(4,_t),m(5,ge),m(6,Uo),m(7,Om),m(8,re),m(9,$a),m(10,fr),m(11,nt),m(12,jS),m(13,Ai),m(14,Pn),m(15,lt),m(16,Go)],MW);var eAe=class extends k{constructor(e,t,o){super();this._modelService=e;this._textModelService=t;this._undoRedoService=o;this._register(this._modelService.onModelRemoved(n=>{let r=this._undoRedoService.getElements(n.uri);if(!(r.past.length===0&&r.future.length===0)){for(let s of r.past)s instanceof UB&&s.setDelegate(this);for(let s of r.future)s instanceof UB&&s.setDelegate(this)}}))}prepareUndoRedo(e){let t=e.getMissingModels();if(t.length===0)return k.None;let o=t.map(async n=>{try{return await this._textModelService.createModelReference(n)}catch{return k.None}});return Promise.all(o).then(n=>({dispose:()=>je(n)}))}};eAe=I([m(0,_t),m(1,Bt),m(2,wl)],eAe);var Dit=class extends ix{constructor(e,t,o,n){super();this.instantiationService=e;this.textFileService=t;this.fileService=o;this.modelService=n;this.providers=new Map;this.modelsToDispose=new Map}createReferencedObject(e){return this.doCreateReferencedObject(e)}async doCreateReferencedObject(e,t){let o=A.parse(e),n=this.modelsToDispose.get(e);if(this.modelsToDispose.delete(e),o.scheme===Q.untitled){let r=await this.textFileService.untitled.resolve({untitledResource:o});if(this.ensureResolvedModel(r,e))return r}if(this.fileService.hasProvider(o)){let r=await this.textFileService.files.resolve(o,{reason:2});if(this.ensureResolvedModel(r,e))return r}if(o.scheme===Q.inMemory||this.providers.has(o.scheme)){await this.ensureResolvedTextModelContent(o);let r;if(n)try{r=await n}catch{}if(r||(r=this.instantiationService.createInstance(aee,o)),this.ensureResolvedModel(r,e))return r}if(!t)return await this.fileService.activateProvider(o.scheme),this.doCreateReferencedObject(e,!0);throw new Error(`Unable to resolve resource ${e}`)}ensureResolvedModel(e,t){if(RQi(e))return!0;throw new Error(`Unable to resolve resource ${t}`)}destroyReferencedObject(e,t){this.modelsToDispose.set(e,t),(async()=>{try{let o=await t;if(!this.modelsToDispose.has(e)||(o instanceof MW?await this.textFileService.files.canDispose(o):o instanceof uR&&await this.textFileService.untitled.canDispose(o),!this.modelsToDispose.has(e)))return;o.dispose()}catch{}finally{this.modelsToDispose.delete(e)}})()}registerTextModelContentProvider(e,t){let o=this.providers.get(e);return o||(o=[],this.providers.set(e,o)),o.unshift(t),ee(()=>{let n=this.providers.get(e);if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&this.providers.delete(e))})}hasTextModelContentProvider(e){return this.providers.get(e)!==void 0}async ensureResolvedTextModelContent(e){if(e.scheme===Q.inMemory&&this.modelService.getModel(e))return;let t=this.providers.get(e.scheme)||[];for(let o of t)if(await o.provideTextContent(e))return;throw new Error(`Unable to resolve text model content for resource ${e.toString()}`)}};Dit=I([m(0,F),m(1,Uo),m(2,ge),m(3,_t)],Dit);var Rit=class extends k{constructor(e,t,o,n,r){super();this.instantiationService=e;this.fileService=t;this.undoRedoService=o;this.modelService=n;this.uriIdentityService=r;this._resourceModelCollection=void 0;this._asyncModelCollection=void 0;this._register(new eAe(this.modelService,this,this.undoRedoService))}get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(Dit)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new Vye(this.resourceModelCollection)),this._asyncModelCollection}async createModelReference(e){return e=this.uriIdentityService.asCanonicalUri(e),await this.asyncModelCollection.acquire(e.toString())}registerTextModelContentProvider(e,t){return this.resourceModelCollection.registerTextModelContentProvider(e,t)}canHandleResource(e){return this.fileService.hasProvider(e)||e.scheme===Q.untitled||e.scheme===Q.inMemory?!0:this.resourceModelCollection.hasTextModelContentProvider(e.scheme)}};Rit=I([m(0,F),m(1,ge),m(2,wl),m(3,_t),m(4,gt)],Rit);Ce(Bt,Rit,1);var eq=class extends k{constructor(e,t,o){super();this.editorGroupService=t;this.storageService=o;this.keyMap=new Map;this.mostRecentEditorsMap=new uz;this.editorsPerResourceCounter=new dt;this._onDidMostRecentlyActiveEditorsChange=this._register(new T);this.onDidMostRecentlyActiveEditorsChange=this._onDidMostRecentlyActiveEditorsChange.event;this.editorGroupsContainer=e??t,this.isScoped=!!e,this.registerListeners(),this.loadState()}static{this.STORAGE_KEY="editors.mru"}get count(){return this.mostRecentEditorsMap.size}get editors(){return[...this.mostRecentEditorsMap.values()]}hasEditor(e){return this.editorsPerResourceCounter.get(e.resource)?.has(this.toIdentifier(e))??!1}hasEditors(e){return this.editorsPerResourceCounter.has(e)}toIdentifier(e,t){return typeof e!="string"?this.toIdentifier(e.typeId,e.editorId):t?`${e}/${t}`:e}registerListeners(){this._register(this.editorGroupsContainer.onDidAddGroup(e=>this.onGroupAdded(e))),this._register(this.editorGroupService.onDidChangeEditorPartOptions(e=>this.onDidChangeEditorPartOptions(e))),this._register(this.storageService.onWillSaveState(()=>this.saveState()))}onGroupAdded(e){let t=e.getEditors(0);for(let o=t.length-1;o>=0;o--)this.addMostRecentEditor(e,t[o],!1,!0);this.editorGroupsContainer.activeGroup===e&&e.activeEditor&&this.addMostRecentEditor(e,e.activeEditor,!0,!1),this.registerGroupListeners(e)}registerGroupListeners(e){let t=new O;t.add(e.onDidModelChange(o=>{switch(o.kind){case 0:{this.editorGroupsContainer.activeGroup===e&&e.activeEditor&&this.addMostRecentEditor(e,e.activeEditor,!0,!1);break}case 5:{o.editor&&(this.addMostRecentEditor(e,o.editor,!1,!0),this.ensureOpenedEditorsLimit({groupId:e.id,editor:o.editor},e.id));break}}})),t.add(e.onDidCloseEditor(o=>{this.removeMostRecentEditor(e,o.editor)})),t.add(e.onDidActiveEditorChange(o=>{o.editor&&this.addMostRecentEditor(e,o.editor,this.editorGroupsContainer.activeGroup===e,!1)})),U.once(e.onWillDispose)(()=>je(t))}onDidChangeEditorPartOptions(e){if(!Qi(e.newPartOptions.limit,e.oldPartOptions.limit)){let t=this.editorGroupsContainer.activeGroup,o;t.activeEditor&&(o={editor:t.activeEditor,groupId:t.id}),this.ensureOpenedEditorsLimit(o)}}addMostRecentEditor(e,t,o,n){let r=this.ensureKey(e,t),s=this.mostRecentEditorsMap.first;o||!s?this.mostRecentEditorsMap.set(r,r,s?1:void 0):(this.mostRecentEditorsMap.set(r,r,1),this.mostRecentEditorsMap.set(s,s,1)),n&&this.updateEditorResourcesMap(t,!0),this._onDidMostRecentlyActiveEditorsChange.fire()}updateEditorResourcesMap(e,t){let o,n,r;if(e instanceof ja?(o=e.primary.resource,n=e.primary.typeId,r=e.primary.editorId):(o=e.resource,n=e.typeId,r=e.editorId),!o)return;let s=this.toIdentifier(n,r);if(t){let l=this.editorsPerResourceCounter.get(o);l||(l=new Map,this.editorsPerResourceCounter.set(o,l)),l.set(s,(l.get(s)??0)+1)}else{let l=this.editorsPerResourceCounter.get(o);if(l){let c=l.get(s)??0;c>1?l.set(s,c-1):(l.delete(s),l.size===0&&this.editorsPerResourceCounter.delete(o))}}}removeMostRecentEditor(e,t){this.updateEditorResourcesMap(t,!1);let o=this.findKey(e,t);if(o){this.mostRecentEditorsMap.delete(o);let n=this.keyMap.get(e.id);n?.delete(o.editor)&&n.size===0&&this.keyMap.delete(e.id),this._onDidMostRecentlyActiveEditorsChange.fire()}}findKey(e,t){let o=this.keyMap.get(e.id);if(o)return o.get(t)}ensureKey(e,t){let o=this.keyMap.get(e.id);o||(o=new Map,this.keyMap.set(e.id,o));let n=o.get(t);return n||(n={groupId:e.id,editor:t},o.set(t,n)),n}async ensureOpenedEditorsLimit(e,t){if(!this.editorGroupService.partOptions.limit?.enabled||typeof this.editorGroupService.partOptions.limit.value!="number"||this.editorGroupService.partOptions.limit.value<=0)return;let o=this.editorGroupService.partOptions.limit.value;if(this.editorGroupService.partOptions.limit?.perEditorGroup)if(typeof t=="number"){let n=this.editorGroupsContainer.getGroup(t);n&&await this.doEnsureOpenedEditorsLimit(o,n.getEditors(0).map(r=>({editor:r,groupId:t})),e)}else for(let n of this.editorGroupsContainer.groups)await this.ensureOpenedEditorsLimit(e,n.id);else await this.doEnsureOpenedEditorsLimit(o,[...this.mostRecentEditorsMap.values()],e)}async doEnsureOpenedEditorsLimit(e,t,o){let n;if(this.editorGroupService.partOptions.limit?.excludeDirty?n=t.filter(({editor:c})=>!(c.isDirty()&&!c.isSaving()||c.hasCapability(512))):n=t,e>=n.length)return;let r=n.reverse().filter(({editor:c,groupId:u})=>!(c.isDirty()&&!c.isSaving()||c.hasCapability(512)||o&&c===o.editor&&u===o.groupId||this.editorGroupsContainer.getGroup(u)?.isSticky(c))),s=n.length-e,l=new Map;for(let{groupId:c,editor:u}of r){let p=l.get(c);if(p||(p=[],l.set(c,p)),p.push(u),s--,s===0)break}for(let[c,u]of l){let p=this.editorGroupsContainer.getGroup(c);p&&await p.closeEditors(u,{preserveFocus:!0})}}saveState(){this.isScoped||(this.mostRecentEditorsMap.isEmpty()?this.storageService.remove(eq.STORAGE_KEY,1):this.storageService.store(eq.STORAGE_KEY,JSON.stringify(this.serialize()),1,1))}serialize(){let e=oe.as(en.EditorFactory),t=[...this.mostRecentEditorsMap.values()],o=new Map;return{entries:ui(t.map(({editor:n,groupId:r})=>{let s=this.editorGroupsContainer.getGroup(r);if(!s)return;let l=o.get(s);l||(l=s.getEditors(1).filter(u=>e.getEditorSerializer(u)?.canSerialize(u)),o.set(s,l));let c=l.indexOf(n);if(c!==-1)return{groupId:r,index:c}}))}}async loadState(){(this.editorGroupsContainer===this.editorGroupService.mainPart||this.editorGroupsContainer===this.editorGroupService)&&await this.editorGroupService.whenReady;let e=!1;if(!this.isScoped){let t=this.storageService.get(eq.STORAGE_KEY,1);t&&(e=!0,this.deserialize(JSON.parse(t)))}if(!e){let t=this.editorGroupsContainer.getGroups(1);for(let o=t.length-1;o>=0;o--){let n=t[o],r=n.getEditors(0);for(let s=r.length-1;s>=0;s--)this.addMostRecentEditor(n,r[s],!0,!0)}}for(let t of this.editorGroupsContainer.groups)this.registerGroupListeners(t)}deserialize(e){let t=[];for(let{groupId:o,index:n}of e.entries){let r=this.editorGroupsContainer.getGroup(o);if(!r)continue;let s=r.getEditorByIndex(n);if(!s)continue;let l=this.ensureKey(r,s);t.push([l,l]),this.updateEditorResourcesMap(s,!0)}this.mostRecentEditorsMap.fromJSON(t)}};eq=I([m(1,kt),m(2,de)],eq);var $he=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.editorGroupService=t;this.instantiationService=o;this.fileService=n;this.configurationService=r;this.contextService=s;this.uriIdentityService=l;this.editorResolverService=c;this.workspaceTrustRequestService=u;this.hostService=p;this.textEditorService=h;this._onDidActiveEditorChange=this._register(new T);this.onDidActiveEditorChange=this._onDidActiveEditorChange.event;this._onDidVisibleEditorsChange=this._register(new T);this.onDidVisibleEditorsChange=this._onDidVisibleEditorsChange.event;this._onDidEditorsChange=this._register(new T);this.onDidEditorsChange=this._onDidEditorsChange.event;this._onWillOpenEditor=this._register(new T);this.onWillOpenEditor=this._onWillOpenEditor.event;this._onDidCloseEditor=this._register(new T);this.onDidCloseEditor=this._onDidCloseEditor.event;this._onDidOpenEditorFail=this._register(new T);this.onDidOpenEditorFail=this._onDidOpenEditorFail.event;this._onDidMostRecentlyActiveEditorsChange=this._register(new T);this.onDidMostRecentlyActiveEditorsChange=this._onDidMostRecentlyActiveEditorsChange.event;this.lastActiveEditor=void 0;this.activeOutOfWorkspaceWatchers=new dt;this.closeOnFileDelete=!1;this.editorGroupsContainer=e??t,this.editorsObserver=this._register(this.instantiationService.createInstance(eq,this.editorGroupsContainer)),this.onConfigurationUpdated(),this.registerListeners()}createScoped(e,t){return t.add(new $he(e,this.editorGroupService,this.instantiationService,this.fileService,this.configurationService,this.contextService,this.uriIdentityService,this.editorResolverService,this.workspaceTrustRequestService,this.hostService,this.textEditorService))}registerListeners(){this.editorGroupsContainer===this.editorGroupService.mainPart||this.editorGroupsContainer===this.editorGroupService?this.editorGroupService.whenReady.then(()=>this.onEditorGroupsReady()):this.onEditorGroupsReady(),this._register(this.editorGroupsContainer.onDidChangeActiveGroup(e=>this.handleActiveEditorChange(e))),this._register(this.editorGroupsContainer.onDidAddGroup(e=>this.registerGroupListeners(e))),this._register(this.editorsObserver.onDidMostRecentlyActiveEditorsChange(()=>this._onDidMostRecentlyActiveEditorsChange.fire())),this._register(this.onDidVisibleEditorsChange(()=>this.handleVisibleEditorsChange())),this._register(this.fileService.onDidRunOperation(e=>this.onDidRunFileOperation(e))),this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onConfigurationUpdated(e)))}onEditorGroupsReady(){for(let e of this.editorGroupsContainer.groups)this.registerGroupListeners(e);this.activeEditor&&(this.doHandleActiveEditorChangeEvent(),this._onDidVisibleEditorsChange.fire({isExplicit:!1}))}handleActiveEditorChange(e){e===this.editorGroupsContainer.activeGroup&&(!this.lastActiveEditor&&!e.activeEditor||this.doHandleActiveEditorChangeEvent())}doHandleActiveEditorChangeEvent(){let e=this.editorGroupsContainer.activeGroup;this.lastActiveEditor=e.activeEditor??void 0,this._onDidActiveEditorChange.fire()}registerGroupListeners(e){let t=new O;t.add(e.onDidModelChange(o=>{this._onDidEditorsChange.fire({groupId:e.id,event:o})})),t.add(e.onDidActiveEditorChange(o=>{this.handleActiveEditorChange(e),this._onDidVisibleEditorsChange.fire({isExplicit:o.isExplicit!==!1})})),t.add(e.onWillOpenEditor(o=>{this._onWillOpenEditor.fire(o)})),t.add(e.onDidCloseEditor(o=>{this._onDidCloseEditor.fire(o)})),t.add(e.onDidOpenEditorFail(o=>{this._onDidOpenEditorFail.fire({editor:o,groupId:e.id})})),U.once(e.onWillDispose)(()=>{je(t)})}handleVisibleEditorsChange(){let e=new xn;for(let t of this.visibleEditors){let o=jo(ui([po.getCanonicalUri(t,{supportSideBySide:1}),po.getCanonicalUri(t,{supportSideBySide:2})]),n=>n.toString());for(let n of o)this.fileService.hasProvider(n)&&!this.contextService.isInsideWorkspace(n)&&e.add(n)}for(let t of this.activeOutOfWorkspaceWatchers.keys())e.has(t)||(je(this.activeOutOfWorkspaceWatchers.get(t)),this.activeOutOfWorkspaceWatchers.delete(t));for(let t of e.keys())if(!this.activeOutOfWorkspaceWatchers.get(t)){let o=this.fileService.watch(t);this.activeOutOfWorkspaceWatchers.set(t,o)}}async onDidRunFileOperation(e){e.isOperation(2)&&this.handleMovedFile(e.resource,e.target.resource),(e.isOperation(1)||e.isOperation(2))&&this.handleDeletedFile(e.resource,!1,e.target?e.target.resource:void 0)}onDidFilesChange(e){e.gotDeleted()&&this.handleDeletedFile(e,!0)}async handleMovedFile(e,t){for(let o of this.editorGroupsContainer.groups){let n=[];for(let r of o.editors){let s=r.resource;if(!s||!this.uriIdentityService.extUri.isEqualOrParent(s,e))continue;let l;if(this.uriIdentityService.extUri.isEqual(e,s))l=t;else{let p=mwe(s.path,e.path,this.uriIdentityService.extUri.ignorePathCasing(s));l=Ve(t,s.path.substr(p+e.path.length+1))}let c=await r.rename(o.id,l);if(!c)return;let u={preserveFocus:!0,pinned:o.isPinned(r),sticky:o.isSticky(r),index:o.getIndexOfEditor(r),inactive:!o.isActive(r)};ya(c.editor)?n.push({editor:r,replacement:c.editor,options:{...c.options,...u}}):n.push({editor:r,replacement:{...c.editor,options:{...c.editor.options,...u}}})}n.length&&this.replaceEditors(n,o)}}onConfigurationUpdated(e){if(e&&!e.affectsConfiguration("workbench.editor.closeOnFileDelete"))return;let t=this.configurationService.getValue();typeof t.workbench?.editor?.closeOnFileDelete=="boolean"?this.closeOnFileDelete=t.workbench.editor.closeOnFileDelete:this.closeOnFileDelete=!1}handleDeletedFile(e,t,o){for(let n of this.getAllNonDirtyEditors({includeUntitled:!1,supportSideBySide:!0}))(async()=>{let r=n.resource;if(r&&(this.closeOnFileDelete||!t)){if(o&&this.uriIdentityService.extUri.isEqualOrParent(r,o))return;let s=!1;if(e instanceof AF?s=e.contains(r,2):s=this.uriIdentityService.extUri.isEqualOrParent(r,e),!s)return;let l=!1;t&&this.fileService.hasProvider(r)&&(await Li(100),l=await this.fileService.exists(r)),!l&&!n.isDisposed()&&n.dispose()}})()}getAllNonDirtyEditors(e){let t=[];function o(n){n.hasCapability(4)&&!e.includeUntitled||n.isDirty()||t.push(n)}for(let n of this.editors)e.supportSideBySide&&n instanceof ja?(o(n.primary),o(n.secondary)):o(n);return t}get activeEditorPane(){return this.editorGroupsContainer.activeGroup?.activeEditorPane}get activeTextEditorControl(){let e=this.activeEditorPane;if(e){let t=e.getControl();if(fn(t)||Lc(t))return t;if(CF(t)&&fn(t.activeCodeEditor))return t.activeCodeEditor}}get activeTextEditorLanguageId(){let e,t=this.activeTextEditorControl;return Lc(t)?e=t.getModifiedEditor():e=t,e?.getModel()?.getLanguageId()}get count(){return this.editorsObserver.count}get editors(){return this.getEditors(1).map(({editor:e})=>e)}getEditors(e,t){switch(e){case 0:return t?.excludeSticky?this.editorsObserver.editors.filter(({groupId:o,editor:n})=>!this.editorGroupsContainer.getGroup(o)?.isSticky(n)):this.editorsObserver.editors;case 1:{let o=[];for(let n of this.editorGroupsContainer.getGroups(2))o.push(...n.getEditors(1,t).map(r=>({editor:r,groupId:n.id})));return o}}}get activeEditor(){let e=this.editorGroupsContainer.activeGroup;return e?e.activeEditor??void 0:void 0}get visibleEditorPanes(){return ui(this.editorGroupsContainer.groups.map(e=>e.activeEditorPane))}get visibleTextEditorControls(){return this.doGetVisibleTextEditorControls(this.visibleEditorPanes)}doGetVisibleTextEditorControls(e){let t=[];for(let o of e){let n=[];o instanceof iv?(n.push(o.getPrimaryEditorPane()?.getControl()),n.push(o.getSecondaryEditorPane()?.getControl())):n.push(o.getControl());for(let r of n)(fn(r)||Lc(r))&&t.push(r)}return t}getVisibleTextEditorControls(e){return this.doGetVisibleTextEditorControls(ui(this.editorGroupsContainer.getGroups(e===1?2:1).map(t=>t.activeEditorPane)))}get visibleEditors(){return ui(this.editorGroupsContainer.groups.map(e=>e.activeEditor))}async openEditor(e,t,o){let n,r=ya(e)?t:e.options,s;if(Dso(t)&&(o=t),!ya(e)){let l=await this.editorResolverService.resolveEditor(e,o);if(l===1)return;g3(l)&&(n=l.editor,r=l.options,s=l.group)}if(n||(n=ya(e)?e:await this.textEditorService.resolveTextEditor(e)),!s){let l,c=this.instantiationService.invokeFunction(Nhe,{editor:n,options:r},o);c instanceof Promise?[s,l]=await c:[s,l]=c,l&&(r={...r,activation:l})}return r?.preserveFocus&&this.editorGroupService.activeModalEditorPart?.groups.some(l=>l.id===s.id)&&this.editorGroupService.activeModalEditorPart.count===1&&this.editorGroupService.activeModalEditorPart.groups[0].isEmpty&&(r={...r,preserveFocus:!1}),s.openEditor(n,r)}async openEditors(e,t,o){if(o?.validateTrust&&!await this.handleWorkspaceTrust(e))return[];let n=new Map;for(let s of e){let l,c;if(!D0(s)){let p=await this.editorResolverService.resolveEditor(s,t);if(p===1)continue;g3(p)&&(l=p,c=p.group)}if(l||(l=D0(s)?s:{editor:await this.textEditorService.resolveTextEditor(s),options:s.options}),!c){let p=this.instantiationService.invokeFunction(Nhe,l,t);p instanceof Promise?[c]=await p:[c]=p}l.options?.preserveFocus&&this.editorGroupService.activeModalEditorPart?.groups.some(p=>p.id===c.id)&&this.editorGroupService.activeModalEditorPart.count===1&&this.editorGroupService.activeModalEditorPart.groups[0].isEmpty&&(l={...l,options:{...l.options,preserveFocus:!1}});let u=n.get(c);u||(u=[],n.set(c,u)),u.push(l)}let r=[];for(let[s,l]of n)r.push(s.openEditors(l));return ui(await vn.settled(r))}async handleWorkspaceTrust(e){let{resources:t,diffMode:o,mergeMode:n}=this.extractEditorResources(e);switch(await this.workspaceTrustRequestService.requestOpenFilesTrust(t)){case 1:return!0;case 2:return await this.hostService.openWindow(t.map(s=>({fileUri:s})),{forceNewWindow:!0,diffMode:o,mergeMode:n}),!1;case 3:return!1}}extractEditorResources(e){let t=new xn,o=!1,n=!1;for(let r of e)if(D0(r)){let s=po.getOriginalUri(r.editor,{supportSideBySide:3});A.isUri(s)?t.add(s):s&&(s.primary&&t.add(s.primary),s.secondary&&t.add(s.secondary),o=r.editor instanceof Ba)}else Xy(r)&&(A.isUri(r.input1)&&t.add(r.input1.resource),A.isUri(r.input2)&&t.add(r.input2.resource),A.isUri(r.base)&&t.add(r.base.resource),A.isUri(r.result)&&t.add(r.result.resource),n=!0),Ug(r)?(A.isUri(r.original.resource)&&t.add(r.original.resource),A.isUri(r.modified.resource)&&t.add(r.modified.resource),o=!0):zg(r)&&t.add(r.resource);return{resources:Array.from(t.keys()),diffMode:o,mergeMode:n}}isOpened(e){return this.editorsObserver.hasEditor({resource:this.uriIdentityService.asCanonicalUri(e.resource),typeId:e.typeId,editorId:e.editorId})}isVisible(e){for(let t of this.editorGroupsContainer.groups)if(t.activeEditor?.matches(e))return!0;return!1}async closeEditor({editor:e,groupId:t},o){await this.editorGroupsContainer.getGroup(t)?.closeEditor(e,o)}async closeEditors(e,t){let o=new Map;for(let{editor:n,groupId:r}of e){let s=this.editorGroupsContainer.getGroup(r);if(!s)continue;let l=o.get(s);l||(l=[],o.set(s,l)),l.push(n)}for(let[n,r]of o)await n.closeEditors(r,t)}findEditors(e,t,o){let n=A.isUri(e)?e:e.resource,r=A.isUri(e)?void 0:e.typeId;if(t?.supportSideBySide!==4&&t?.supportSideBySide!==2&&!this.editorsObserver.hasEditors(n))return A.isUri(e)||bn(o)?[]:void 0;if(bn(o)){let s=[];for(let l of this.editorGroupsContainer.getGroups(t?.order===1?2:1)){let c=[];if(A.isUri(e))c.push(...this.findEditors(e,t,l));else{let u=this.findEditors(e,t,l);u&&c.push(u)}s.push(...c.map(u=>({editor:u,groupId:l.id})))}return s}else{let s=typeof o=="number"?this.editorGroupsContainer.getGroup(o):o;if(A.isUri(e))return s?s.findEditors(n,t):[];{if(!s)return;let l=s.findEditors(n,t);for(let c of l)if(c.typeId===r)return c;return}}}async replaceEditors(e,t){let o=typeof t=="number"?this.editorGroupsContainer.getGroup(t):t,n=[];for(let r of e){let s;if(!ya(r.replacement)){let l=await this.editorResolverService.resolveEditor(r.replacement,o);if(l===1)continue;g3(l)&&(s={editor:r.editor,replacement:l.editor,options:l.options,forceReplaceDirty:r.forceReplaceDirty})}s||(s={editor:r.editor,replacement:Fbi(r)?r.replacement:await this.textEditorService.resolveTextEditor(r.replacement),options:Fbi(r)?r.options:r.replacement.options,forceReplaceDirty:r.forceReplaceDirty}),n.push(s)}return o?.replaceEditors(n)}async save(e,t){Array.isArray(e)||(e=[e]);let o=this.getUniqueEditors(e),n=[],r=[];if(t?.saveAs)r.push(...o);else for(let{groupId:l,editor:c}of o)c.hasCapability(4)?r.push({groupId:l,editor:c}):n.push({groupId:l,editor:c});let s=await vn.settled(n.map(({groupId:l,editor:c})=>(t?.reason===1&&this.editorGroupsContainer.getGroup(l)?.pinEditor(c),c.save(l,t))));for(let{groupId:l,editor:c}of r){if(c.isDisposed())continue;let p={pinned:!0,viewState:(await this.openEditor(c,l))?.getViewState()},h=t?.saveAs?await c.saveAs(l,t):await c.save(l,t);if(s.push(h),!h)break;if(!c.matches(h)){let g=c.hasCapability(4)?this.editorGroupsContainer.groups.map(f=>f.id):[l];for(let f of g)h instanceof Ls?await this.replaceEditors([{editor:c,replacement:h,options:p}],f):await this.replaceEditors([{editor:c,replacement:{...h,options:p}}],f)}}return{success:s.every(l=>!!l),editors:ui(s)}}saveAll(e){return this.save(this.getAllModifiedEditors(e),e)}async revert(e,t){Array.isArray(e)||(e=[e]);let o=this.getUniqueEditors(e);return await vn.settled(o.map(async({groupId:n,editor:r})=>(this.editorGroupsContainer.getGroup(n)?.pinEditor(r),r.revert(n,t)))),!o.some(({editor:n})=>n.isDirty())}async revertAll(e){return this.revert(this.getAllModifiedEditors(e),e)}getAllModifiedEditors(e){let t=[];for(let o of this.editorGroupsContainer.getGroups(1))for(let n of o.getEditors(0))n.isModified()&&((typeof e?.includeUntitled=="boolean"||!e?.includeUntitled?.includeScratchpad)&&n.hasCapability(512)||!e?.includeUntitled&&n.hasCapability(4)||e?.excludeSticky&&o.isSticky(n)||t.push({groupId:o.id,editor:n}));return t}getUniqueEditors(e){let t=[];for(let{editor:o,groupId:n}of e)t.some(r=>r.editor.matches(o))||t.push({editor:o,groupId:n});return t}dispose(){super.dispose(),this.activeOutOfWorkspaceWatchers.forEach(e=>je(e)),this.activeOutOfWorkspaceWatchers.clear()}};$he=I([m(1,kt),m(2,F),m(3,ge),m(4,B),m(5,Ae),m(6,gt),m(7,il),m(8,lp),m(9,ti),m(10,TE)],$he);Ce(ie,new Vt($he,[void 0],!1));function Lon(a){return{id:a.id,label:a.label,detail:a.detail,priority:ome(a.priority)}}var KN=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.editorGroupService=e;this.instantiationService=t;this.configurationService=o;this.quickInputService=n;this.notificationService=r;this.storageService=s;this.extensionService=l;this.logService=c;this._onDidChangeEditorRegistrations=this._register(new Ih);this.onDidChangeEditorRegistrations=this._onDidChangeEditorRegistrations.event;this._editors=new Map;this._flattenedEditors=new Map;this._shouldReFlattenEditors=!0;this.cache=new Set(JSON.parse(this.storageService.get(KN.cacheStorageID,0,JSON.stringify([])))),this.storageService.remove(KN.cacheStorageID,0),this._register(this.storageService.onWillSaveState(()=>{this.cacheEditors()})),this._register(this.extensionService.onDidRegisterExtensions(()=>{this.cache=void 0}))}static{this.configureDefaultID="promptOpenWith.configureDefault"}static{this.cacheStorageID="editorOverrideService.cache"}static{this.conflictingDefaultsStorageID="editorOverrideService.conflictingDefaults"}resolveUntypedInputAndGroup(e,t){let o=e,n=this.instantiationService.invokeFunction(Nhe,o,t);if(n instanceof Promise)return n.then(([r,s])=>[o,r,s]);{let[r,s]=n;return[o,r,s]}}async resolveEditor(e,t){if(this._flattenedEditors=this._flattenEditorsMap(),GD(e))return this.doResolveSideBySideEditor(e,t);let o,n=this.resolveUntypedInputAndGroup(e,t);if(n instanceof Promise?o=await n:o=n,!o)return 2;let[r,s,l]=o;l&&(r.options={...r.options,activation:l});let c=po.getCanonicalUri(r,{supportSideBySide:1}),u=Ug(r)?1:Xy(r)?2:0;if(this.cache&&c&&(this.resourceMatchesCache(c)||this.resourceMatchesUserAssociation(c,u))&&await this.extensionService.whenInstalledExtensionsRegistered(),c===void 0)c=A.from({scheme:Q.untitled});else if(c.scheme===void 0||c===null)return 2;if(r.options?.override===0){let f=await this.doPickEditor(r);if(!f)return 1;r.options=f}let{editor:p,conflictingDefault:h}=this.getEditor(c,r.options?.override,u);if(!p&&(r.options?.override||D0(e)))return 2;if(!p){let f=this.getEditor(c,Da.id,u);if(p=f?.editor,h=f?.conflictingDefault,!p)return 2}if(Ug(r)&&r.options?.override===void 0){let f=po.getCanonicalUri(r,{supportSideBySide:2});f||(f=A.from({scheme:Q.untitled}));let{editor:v}=this.getEditor(f,void 0,u);if(!v||p.editorInfo.id!==v.editorInfo.id){let{editor:b,conflictingDefault:S}=this.getEditor(c,Da.id,u);p=b,h=S}if(!p)return 2}if(r.options={override:p.editorInfo.id,...r.options},p.editorFactoryObject.createDiffEditorInput===void 0&&Ug(r))return 2;let g=await this.doResolveEditor(r,s,p);return h&&g&&await this.doHandleConflictingDefaults(c,p.editorInfo.label,r,g.editor,s),g?(g.editor.editorId!==p.editorInfo.id&&this.logService.warn(`Editor ID Mismatch: ${g.editor.editorId} !== ${p.editorInfo.id}. This will cause bugs. Please ensure editorInput.editorId matches the registered id`),{...g,group:s}):1}async doResolveSideBySideEditor(e,t){let o=await this.resolveEditor(e.primary,t);if(!g3(o))return 2;let n=await this.resolveEditor(e.secondary,o.group??t);return g3(n)?{group:o.group??n.group,editor:this.instantiationService.createInstance(ja,e.label,e.description,n.editor,o.editor),options:e.options}:2}bufferChangeEvents(e){this._onDidChangeEditorRegistrations.pause();try{e()}finally{this._onDidChangeEditorRegistrations.resume()}}registerEditor(e,t,o,n){let r=Lon(t),s=this._editors.get(e);s===void 0&&(s=new Map,this._editors.set(e,s));let l=s.get(r.id);l===void 0&&(l=[]);let c=vg(l,{globPattern:e,editorInfo:r,options:o,editorFactoryObject:n});return s.set(r.id,l),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire(),ee(()=>{c(),l&&l.length===0&&s?.delete(t.id),this._shouldReFlattenEditors=!0,this._onDidChangeEditorRegistrations.fire()})}getAssociationsForResource(e){return this.getAssociationsForResourceFromSetting(e,iG)}getAssociationsForResourceByType(e,t){if(t===1||t===2){let o=this.getAssociationsForResourceFromSetting(e,lee);if(o.length)return o}return this.getAssociationsForResource(e)}getAssociationsForResourceFromSetting(e,t){let o=this.getRawAssociationsForResourceFromSetting(e,t),n=this._registeredEditors;return o.filter(r=>n.find(s=>s.editorInfo.id===r.viewType))}getRawAssociationsForResourceByType(e,t){if(t===0)return this.getRawAssociationsForResourceFromSetting(e,iG);let o=this.getRawAssociationsForResourceFromSetting(e,lee);return o.length?o:this.getRawAssociationsForResourceFromSetting(e,iG)}getRawAssociationsForResourceFromSetting(e,t){return this.getAllUserAssociationsForSetting(t).filter(r=>r.filenamePattern&&cee(r.filenamePattern,e)).sort((r,s)=>(s.filenamePattern?.length??0)-(r.filenamePattern?.length??0))}getAllUserAssociations(){return this.getAllUserAssociationsForSetting(iG)}getAllUserAssociationsForSetting(e){let t=this.configurationService.inspect(e)||{},o=t.defaultValue??{},n=t.workspaceValue??{},r=t.userValue??{},s={...n};for(let[c,u]of Object.entries({...o,...r}))s[c]===void 0&&(s[c]=u);let l=[];for(let[c,u]of Object.entries(s)){let p={filenamePattern:c,viewType:u};l.push(p)}return l}_flattenEditorsMap(){if(!this._shouldReFlattenEditors)return this._flattenedEditors;this._shouldReFlattenEditors=!1;let e=new Map;for(let[t,o]of this._editors){let n=[];for(let r of o.values()){let s;for(let l of r)s||(s={editorInfo:l.editorInfo,globPattern:l.globPattern,options:{},editorFactoryObject:{}}),s.options={...s.options,...l.options},s.editorFactoryObject={...s.editorFactoryObject,...l.editorFactoryObject};s&&n.push(s)}e.set(t,n)}return e}get _registeredEditors(){return Array.from(this._flattenedEditors.values()).flat()}updateUserAssociations(e,t){this.updateUserAssociationsForSetting(iG,e,t)}updateUserAssociationsForType(e,t,o){this.updateUserAssociationsForSetting(e===1?lee:iG,t,o)}updateUserAssociationsForSetting(e,t,o){let n={viewType:o,filenamePattern:t},r=this.getAllUserAssociationsForSetting(e),s=Object.create(null);for(let l of[...r,n])l.filenamePattern&&(s[l.filenamePattern]=l.viewType);this.configurationService.updateValue(e,s)}findMatchingEditors(e,t=0){let o=this.getAssociationsForResourceByType(e,t),n=[];for(let[r,s]of this._flattenedEditors)for(let l of s){if(t===1&&!l.editorFactoryObject.createDiffEditorInput||t===2&&!l.editorFactoryObject.createMergeEditorInput)continue;(o.find(u=>u.viewType===l.editorInfo.id)&&this.getEffectivePriority(l.editorInfo,t)!=="exclusive"||cee(r,e))&&n.push(l)}return n.sort((r,s)=>{let l=this.getEffectivePriority(r.editorInfo,t),c=this.getEffectivePriority(s.editorInfo,t);return GM(c)===GM(l)&&typeof s.globPattern=="string"&&typeof r.globPattern=="string"?s.globPattern.length-r.globPattern.length:GM(c)-GM(l)})}getEditors(e){if(this._flattenedEditors=this._flattenEditorsMap(),A.isUri(e)){let t=this.findMatchingEditors(e);return t.find(o=>o.editorInfo.priority.editor==="exclusive")?[]:t.map(o=>o.editorInfo)}return jo(this._registeredEditors.map(t=>t.editorInfo),t=>t.id)}getEditor(e,t,o){let n=(h,g)=>h.find(f=>o===1&&!f.editorFactoryObject.createDiffEditorInput||o===2&&!f.editorFactoryObject.createMergeEditorInput?!1:f.options?.canSupportResource!==void 0?f.editorInfo.id===g&&f.options.canSupportResource(e):f.editorInfo.id===g);if(t&&t!==1){let h=this._registeredEditors;return{editor:n(h,t),conflictingDefault:!1}}let r=this.findMatchingEditors(e,o),s=this.getAssociationsForResourceByType(e,o),l=t===1?"exclusive":"builtin",c=r.filter(h=>GM(this.getEffectivePriority(h.editorInfo,o))>=GM(l)&&h.editorInfo.id!==Da.id);if(c.length===0)return{editor:s[0]&&l!=="exclusive"?n(r,s[0].viewType):void 0,conflictingDefault:!1};let u=this.getEffectivePriority(c[0].editorInfo,o)==="exclusive"?c[0].editorInfo.id:s[0]?.viewType||c.find(h=>!h.options?.canSupportResource||h.options.canSupportResource(e))?.editorInfo.id||c[0].editorInfo.id,p=!1;return c=c.filter(h=>this.getEffectivePriority(h.editorInfo,o)!=="exclusive").filter(h=>!h.options?.canSupportResource||h.options.canSupportResource(e)),s.length===0&&c.length>1&&(p=!0),{editor:n(r,u),conflictingDefault:p}}getEffectivePriority(e,t){switch(t){case 1:return e.priority.diff;case 2:return e.priority.merge;default:return e.priority.editor}}async doResolveEditor(e,t,o){let n=e.options,r=po.getCanonicalUri(e,{supportSideBySide:1});if(n&&typeof n.activation>"u"&&(n={...n,activation:n.preserveFocus?2:void 0}),Xy(e)){if(!o.editorFactoryObject.createMergeEditorInput)return;let u=await o.editorFactoryObject.createMergeEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(Ug(e)){if(!o.editorFactoryObject.createDiffEditorInput)return;let u=await o.editorFactoryObject.createDiffEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(mZ(e)){if(!o.editorFactoryObject.createMultiDiffEditorInput)return;let u=await o.editorFactoryObject.createMultiDiffEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(GD(e))throw new Error("Untyped side by side editor input not supported here.");if(P_e(e)){if(!o.editorFactoryObject.createUntitledEditorInput)return;let u=await o.editorFactoryObject.createUntitledEditorInput(e,t);return{editor:u.editor,options:u.options??n}}if(r===void 0)throw new Error("Undefined resource on non untitled editor input.");if(typeof o.options?.singlePerResource=="function"?o.options.singlePerResource():o.options?.singlePerResource){let u=this.findExistingEditorsForResource(r,o.editorInfo.id);if(u.length){let p=await this.moveExistingEditorForResource(u,t);return p?{editor:p,options:n}:void 0}}if(!o.editorFactoryObject.createEditorInput)return;let l=await o.editorFactoryObject.createEditorInput(e,t);return n=l.options??n,{editor:l.editor,options:n}}async moveExistingEditorForResource(e,t){let o=e[0];for(let{editor:n,group:r}of e)if(n!==o.editor&&!await r.closeEditor(n))return;if(!(t.id!==o.group.id&&!o.group.moveEditor(o.editor,t)))return o.editor}findExistingEditorsForResource(e,t){let o=[],n=jo([...this.editorGroupService.groups]);for(let r of n)for(let s of r.editors)ze(s.resource,e)&&s.editorId===t&&o.push({editor:s,group:r});return o}async doHandleConflictingDefaults(e,t,o,n,r){let s=Ug(o)?1:Xy(o)?2:0,l=this.findMatchingEditors(e,s),c=JSON.parse(this.storageService.get(KN.conflictingDefaultsStorageID,0,"{}")),u=`*${Ts(e)}`,p=()=>{c[u]=[],l.forEach(f=>c[u].push(f.editorInfo.id)),this.storageService.store(KN.conflictingDefaultsStorageID,JSON.stringify(c),0,1)};if(c[u]?.find(f=>f===n.editorId))return;let g=this.notificationService.prompt(ft.Warning,d(18834,null),[{label:d(18833,null),run:async()=>{let f=await this.doPickEditor(o,!0);if(!f)return;o.options=f;let v=await this.resolveEditor(o,r);v===1||v===2||r.replaceEditors([{editor:n,replacement:v.editor,options:v.options??f}])}},{label:d(18835,null,t),run:p}]).onDidClose(()=>{p(),g.dispose()})}mapEditorsToQuickPickEntry(e,t,o){let n=this.editorGroupService.activeGroup.findEditors(e).at(0),r=e.scheme===Q.untitled?this._registeredEditors.filter(g=>g.editorInfo.priority.editor!=="exclusive"):this.findMatchingEditors(e,o);o===1&&(r=r.filter(g=>!!g.editorFactoryObject.createDiffEditorInput)),r=jo(r,g=>g.editorInfo.id);let s=this.getAssociationsForResourceByType(e,o)[0]?.viewType;r=r.sort((g,f)=>g.editorInfo.id===Da.id?-1:f.editorInfo.id===Da.id?1:GM(this.getEffectivePriority(f.editorInfo,o))-GM(this.getEffectivePriority(g.editorInfo,o)));let l=[],c=d(18839,null),u=d(18837,null),p=d(18838,null),h=s;if(!h&&r.length>2&&this.getEffectivePriority(r[1].editorInfo,o)!=="option"&&(h=r[1]?.editorInfo.id),h||(h=Da.id),r.forEach(g=>{let f=n?.editorId??Da.id,v=n?g.editorInfo.id===f:!1,b=g.editorInfo.id===h,S={id:g.editorInfo.id,label:g.editorInfo.label,description:v&&b?p:v?c:b?u:void 0,detail:g.editorInfo.detail??g.editorInfo.priority.editor};l.push(S)}),!t&&Ts(e)!==""){let g={type:"separator"};l.push(g);let f={id:KN.configureDefaultID,label:d(18836,null,`*${Ts(e)}`)};l.push(f)}return l}async doPickEditor(e,t){let o=po.getOriginalUri(e,{supportSideBySide:1});o===void 0&&(o=A.from({scheme:Q.untitled}));let n=Ug(e)?1:0,r=this.mapEditorsToQuickPickEntry(o,t,n),s=new O,l=s.add(this.quickInputService.createQuickPick({useSeparators:!0})),c=t?d(18841,null,`*${Ts(o)}`):d(18840,null,Be(o));l.placeholder=c,l.canAcceptInBackground=!0,l.items=r;let u=l.items.find(h=>h.type==="item");u&&(l.selectedItems=[u]);let p=await new Promise(h=>{s.add(l.onDidAccept(g=>{let f;l.selectedItems.length===1&&(f={item:l.selectedItems[0],keyMods:l.keyMods,openInBackground:g.inBackground}),o&&t&&f?.item.id&&this.updateUserAssociationsForType(n,`*${Ts(o)}`,f.item.id),h(f)})),s.add(l.onDidHide(()=>{s.dispose(),h(void 0)})),s.add(l.onDidTriggerItemButton(g=>{h({item:g.item,openInBackground:!1}),o&&g.item?.id&&this.updateUserAssociationsForType(n,`*${Ts(o)}`,g.item.id)})),l.show()});if(l.dispose(),p)return p.item.id===KN.configureDefaultID?this.doPickEditor(e,!0):{...e.options,override:p.item.id,preserveFocus:p.openInBackground||e.options?.preserveFocus}}cacheEditors(){let e=new Set;for(let[o,n]of this._flattenedEditors)n.find(s=>s.editorInfo.priority.editor!=="option"&&s.editorInfo.id!==Da.id)&&(GA(o)?e.add(`${o.pattern}`):e.add(o));let t=[...this.getAllUserAssociations(),...this.getAllUserAssociationsForSetting(lee)];for(let o of t)o.filenamePattern&&e.add(o.filenamePattern);this.storageService.store(KN.cacheStorageID,JSON.stringify(Array.from(e)),0,1)}resourceMatchesUserAssociation(e,t){let o=this.getRawAssociationsForResourceByType(e,t);for(let n of o)if(n.viewType!==Da.id)return!0;return!1}resourceMatchesCache(e){if(!this.cache)return!1;for(let t of this.cache)if(cee(t,e))return!0;return!1}};KN=I([m(0,kt),m(1,F),m(2,B),m(3,$e),m(4,Ne),m(5,de),m(6,lt),m(7,re)],KN);Ce(il,KN,0);var jhe=class{constructor(i){this.logService=i;this._providers=new Map}static{this.DEFAULT_TIMEOUT=1e3*10}isEnabled(){return this._providers.size>0}registerAiRelatedInformationProvider(i,e){let t=this._providers.get(i)??[];return t.push(e),this._providers.set(i,t),{dispose:()=>{let o=this._providers.get(i)??[],n=o.indexOf(e);n!==-1&&o.splice(n,1),o.length===0&&this._providers.delete(i)}}}async getRelatedInformation(i,e,t){if(this._providers.size===0)throw new Error("No related information providers registered");let o=[];for(let s of e){let l=this._providers.get(s);l&&o.push(...l)}if(o.length===0)throw new Error("No related information providers registered for the given types");let n=On.create(),r=o.map(s=>Hn(async l=>{try{return(await s.provideAiRelatedInformation(i,l)).filter(u=>e.includes(u.type))}catch{}return[]}));try{let s=await Uu(Promise.allSettled(r),jhe.DEFAULT_TIMEOUT,()=>{r.forEach(c=>c.cancel()),this.logService.warn("[AiRelatedInformationService]: Related information provider timed out")});return s?s.filter(c=>c.status==="fulfilled").flatMap(c=>c.value):[]}finally{n.stop(),this.logService.trace(`[AiRelatedInformationService]: getRelatedInformation took ${n.elapsed()}ms`)}}};jhe=I([m(0,re)],jhe);Ce(ULe,jhe,1);var S_i=class a extends k{constructor(){super(...arguments);this._providers=[];this._llmRankedResultsPromises=new Map;this._embeddingsResultsPromises=new Map;this._onProviderRegistered=this._register(new T);this.onProviderRegistered=this._onProviderRegistered.event}static{this.MAX_PICKS=5}isEnabled(){return this._providers.length>0}registerSettingsSearchProvider(e){return this._providers.push(e),this._onProviderRegistered.fire(),{dispose:()=>{let t=this._providers.indexOf(e);t!==-1&&this._providers.splice(t,1)}}}startSearch(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");this._embeddingsResultsPromises.delete(e),this._llmRankedResultsPromises.delete(e),this._providers.forEach(o=>o.searchSettings(e,{limit:a.MAX_PICKS,embeddingsOnly:!1},t))}async getEmbeddingsResults(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");let o=this._embeddingsResultsPromises.get(e);if(o)return await o.p??null;let n=new Mo;return this._embeddingsResultsPromises.set(e,n),await Ea(n.p,t)??null}async getLLMRankedResults(e,t){if(!this.isEnabled())throw new Error("No settings search providers registered");let o=this._llmRankedResultsPromises.get(e);if(o)return await o.p??null;let n=new Mo;return this._llmRankedResultsPromises.set(e,n),await Ea(n.p,t)??null}handleSearchResult(e){if(this.isEnabled()){if(e.kind===1){let t=this._embeddingsResultsPromises.get(e.query);if(t)t.complete(e.settings);else{let o=new Mo;o.complete(e.settings),this._embeddingsResultsPromises.set(e.query,o)}}else if(e.kind===2){let t=this._llmRankedResultsPromises.get(e.query);if(t)t.complete(e.settings);else{let o=new Mo;o.complete(e.settings),this._llmRankedResultsPromises.set(e.query,o)}}}}};Ce(SRe,S_i,1);var cP=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.editorService=e;this.editorGroupService=t;this.contextService=o;this.storageService=n;this.configurationService=r;this.fileService=s;this.workspacesService=l;this.instantiationService=c;this.layoutService=u;this.contextKeyService=p;this.logService=h;this.activeEditorListeners=this._register(new O);this.lastActiveEditor=void 0;this._onDidChangeEditorNavigationStack=this._register(new T);this.onDidChangeEditorNavigationStack=this._onDidChangeEditorNavigationStack.event;this.defaultScopedEditorNavigationStack=void 0;this.editorGroupScopedNavigationStacks=new Map;this.editorScopedNavigationStacks=new Map;this.editorNavigationScope=0;this.recentlyUsedEditorsStack=void 0;this.recentlyUsedEditorsStackIndex=0;this.recentlyUsedEditorsInGroupStack=void 0;this.recentlyUsedEditorsInGroupStackIndex=0;this.navigatingInRecentlyUsedEditorsStack=!1;this.navigatingInRecentlyUsedEditorsInGroupStack=!1;this.recentlyClosedEditors=[];this.ignoreEditorCloseEvent=!1;this.history=void 0;this.editorHistoryListeners=this._register(new Ot);this.resourceExcludeMatcher=this._register(new uF(ut,()=>{let e=this._register(this.instantiationService.createInstance(qI,t=>PH(t?this.configurationService.getValue({resource:t}):this.configurationService.getValue())||Object.create(null),t=>t.affectsConfiguration(zyt)||t.affectsConfiguration(GPt)));return this._register(e.onExpressionChange(()=>this.removeExcludedFromHistory())),e}));this.editorHelper=this.instantiationService.createInstance(tAe),this.canNavigateBackContextKey=new Y("canNavigateBack",!1,d(19087,null)).bindTo(this.contextKeyService),this.canNavigateForwardContextKey=new Y("canNavigateForward",!1,d(19090,null)).bindTo(this.contextKeyService),this.canNavigateBackInNavigationsContextKey=new Y("canNavigateBackInNavigationLocations",!1,d(19089,null)).bindTo(this.contextKeyService),this.canNavigateForwardInNavigationsContextKey=new Y("canNavigateForwardInNavigationLocations",!1,d(19092,null)).bindTo(this.contextKeyService),this.canNavigateToLastNavigationLocationContextKey=new Y("canNavigateToLastNavigationLocation",!1,d(19094,null)).bindTo(this.contextKeyService),this.canNavigateBackInEditsContextKey=new Y("canNavigateBackInEditLocations",!1,d(19088,null)).bindTo(this.contextKeyService),this.canNavigateForwardInEditsContextKey=new Y("canNavigateForwardInEditLocations",!1,d(19091,null)).bindTo(this.contextKeyService),this.canNavigateToLastEditLocationContextKey=new Y("canNavigateToLastEditLocation",!1,d(19093,null)).bindTo(this.contextKeyService),this.canReopenClosedEditorContextKey=new Y("canReopenClosedEditor",!1,d(19095,null)).bindTo(this.contextKeyService),this.registerListeners(),this.editorService.activeEditorPane&&this.onDidActiveEditorChange()}static{this.MOUSE_NAVIGATION_SETTING="workbench.editor.mouseBackForwardToNavigate"}static{this.NAVIGATION_SCOPE_SETTING="workbench.editor.navigationScope"}registerListeners(){this.registerMouseNavigationListener(),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.editorService.onDidOpenEditorFail(e=>this.remove(e.editor))),this._register(this.editorService.onDidCloseEditor(e=>this.onDidCloseEditor(e))),this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(()=>this.handleEditorEventInRecentEditorsStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>this.onDidRemoveGroup(e))),this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidRunOperation(e=>this.onDidFilesChange(e))),this._register(this.storageService.onWillSaveState(()=>this.saveState())),this.registerEditorNavigationScopeChangeListener(),this._register(this.onDidChangeEditorNavigationStack(()=>this.updateContextKeys())),this._register(this.editorGroupService.onDidChangeActiveGroup(()=>this.updateContextKeys()))}onDidCloseEditor(e){this.handleEditorCloseEventInHistory(e),this.handleEditorCloseEventInReopen(e)}registerMouseNavigationListener(){let e=this._register(new O),t=()=>{e.clear(),this.configurationService.getValue(cP.MOUSE_NAVIGATION_SETTING)&&this._register(U.runAndSubscribe(this.layoutService.onDidAddContainer,({container:o,disposables:n})=>{let r=n.add(new O);r.add($(o,ne.MOUSE_DOWN,s=>this.onMouseDownOrUp(s,!0))),r.add($(o,ne.MOUSE_UP,s=>this.onMouseDownOrUp(s,!1))),e.add(r)},{container:this.layoutService.mainContainer,disposables:this._store}))};this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(cP.MOUSE_NAVIGATION_SETTING)&&t()})),t()}onMouseDownOrUp(e,t){switch(e.button){case 3:Kt.stop(e),t&&this.goBack();break;case 4:Kt.stop(e),t&&this.goForward();break}}onDidRemoveGroup(e){this.handleEditorGroupRemoveInNavigationStacks(e)}onDidActiveEditorChange(){let e=this.editorGroupService.activeGroup,t=e.activeEditorPane;if(!(this.lastActiveEditor&&this.editorHelper.matchesEditorIdentifier(this.lastActiveEditor,t))){if(this.lastActiveEditor=t?.input?{editor:t.input,groupId:t.group.id}:void 0,this.activeEditorListeners.clear(),!t?.group.isTransient(t.input))this.handleActiveEditorChange(e,t);else{this.logService.trace(`[History]: ignoring transient editor change until becoming non-transient (editor: ${t.input?.resource?.toString()}})`);let o=e.onDidModelChange(n=>{n.kind===12&&n.editor===t.input&&!t.group.isTransient(t.input)&&(o.dispose(),this.handleActiveEditorChange(e,t))});this.activeEditorListeners.add(o)}bpe(t)&&this.activeEditorListeners.add(t.onDidChangeSelection(o=>{t.group.isTransient(t.input)?this.logService.trace(`[History]: ignoring transient editor selection change (editor: ${t.input?.resource?.toString()}})`):this.handleActiveEditorSelectionChangeEvent(e,t,o)})),this.updateContextKeys()}}onDidFilesChange(e){e instanceof AF?e.gotDeleted()&&this.remove(e):e.isOperation(1)?this.remove(e):e.isOperation(2)&&e.target.isFile&&this.move(e)}handleActiveEditorChange(e,t){this.handleActiveEditorChangeInHistory(t),this.handleActiveEditorChangeInNavigationStacks(e,t)}handleActiveEditorSelectionChangeEvent(e,t,o){this.handleActiveEditorSelectionChangeInNavigationStacks(e,t,o)}move(e){this.moveInHistory(e),this.moveInEditorNavigationStacks(e)}remove(e){this.removeFromHistory(e),this.removeFromEditorNavigationStacks(e),this.removeFromRecentlyClosedEditors(e),this.removeFromRecentlyOpened(e)}removeFromRecentlyOpened(e){let t;ya(e)?t=po.getOriginalUri(e):e instanceof AF||(t=e.resource),t&&this.workspacesService.removeRecentlyOpened([t])}clear(){this.clearRecentlyOpened(),this.clearEditorNavigationStacks(),this.recentlyClosedEditors=[],this.updateContextKeys()}updateContextKeys(){this.contextKeyService.bufferChangeEvents(()=>{let e=this.getStack();this.canNavigateBackContextKey.set(e.canGoBack(0)),this.canNavigateForwardContextKey.set(e.canGoForward(0)),this.canNavigateBackInNavigationsContextKey.set(e.canGoBack(2)),this.canNavigateForwardInNavigationsContextKey.set(e.canGoForward(2)),this.canNavigateToLastNavigationLocationContextKey.set(e.canGoLast(2)),this.canNavigateBackInEditsContextKey.set(e.canGoBack(1)),this.canNavigateForwardInEditsContextKey.set(e.canGoForward(1)),this.canNavigateToLastEditLocationContextKey.set(e.canGoLast(1)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)})}registerEditorNavigationScopeChangeListener(){let e=()=>{this.disposeEditorNavigationStacks();let t=this.configurationService.getValue(cP.NAVIGATION_SCOPE_SETTING);t==="editorGroup"?this.editorNavigationScope=1:t==="editor"?this.editorNavigationScope=2:this.editorNavigationScope=0};this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(cP.NAVIGATION_SCOPE_SETTING)&&e()})),e()}getStack(e=this.editorGroupService.activeGroup,t=e.activeEditor){switch(this.editorNavigationScope){case 2:{if(!t)return new I_i;let o=this.editorScopedNavigationStacks.get(e.id);o||(o=new Map,this.editorScopedNavigationStacks.set(e.id,o));let n=o.get(t)?.stack;if(!n){let r=new O;n=r.add(this.instantiationService.createInstance(Qhe,2)),r.add(n.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),o.set(t,{stack:n,disposable:r})}return n}case 1:{let o=this.editorGroupScopedNavigationStacks.get(e.id)?.stack;if(!o){let n=new O;o=n.add(this.instantiationService.createInstance(Qhe,1)),n.add(o.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire())),this.editorGroupScopedNavigationStacks.set(e.id,{stack:o,disposable:n})}return o}case 0:return this.defaultScopedEditorNavigationStack||(this.defaultScopedEditorNavigationStack=this._register(this.instantiationService.createInstance(Qhe,0)),this._register(this.defaultScopedEditorNavigationStack.onDidChange(()=>this._onDidChangeEditorNavigationStack.fire()))),this.defaultScopedEditorNavigationStack}}goForward(e){return this.getStack().goForward(e)}goBack(e){return this.getStack().goBack(e)}goPrevious(e){return this.getStack().goPrevious(e)}goLast(e){return this.getStack().goLast(e)}handleActiveEditorChangeInNavigationStacks(e,t){this.getStack(e,t?.input).handleActiveEditorChange(t)}handleActiveEditorSelectionChangeInNavigationStacks(e,t,o){this.getStack(e,t.input).handleActiveEditorSelectionChange(t,o)}handleEditorCloseEventInHistory(e){let t=this.editorScopedNavigationStacks.get(e.groupId);if(t){let o=t.get(e.editor);o&&(o.disposable.dispose(),t.delete(e.editor)),t.size===0&&this.editorScopedNavigationStacks.delete(e.groupId)}}handleEditorGroupRemoveInNavigationStacks(e){this.defaultScopedEditorNavigationStack?.remove(e.id);let t=this.editorGroupScopedNavigationStacks.get(e.id);t&&(t.disposable.dispose(),this.editorGroupScopedNavigationStacks.delete(e.id))}clearEditorNavigationStacks(){this.withEachEditorNavigationStack(e=>e.clear())}removeFromEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.remove(e))}moveInEditorNavigationStacks(e){this.withEachEditorNavigationStack(t=>t.move(e))}withEachEditorNavigationStack(e){this.defaultScopedEditorNavigationStack&&e(this.defaultScopedEditorNavigationStack);for(let[,t]of this.editorGroupScopedNavigationStacks)e(t.stack);for(let[,t]of this.editorScopedNavigationStacks)for(let[,o]of t)e(o.stack)}disposeEditorNavigationStacks(){this.defaultScopedEditorNavigationStack?.dispose(),this.defaultScopedEditorNavigationStack=void 0;for(let[,e]of this.editorGroupScopedNavigationStacks)e.disposable.dispose();this.editorGroupScopedNavigationStacks.clear();for(let[,e]of this.editorScopedNavigationStacks)for(let[,t]of e)t.disposable.dispose();this.editorScopedNavigationStacks.clear()}openNextRecentlyUsedEditor(e){let[t,o]=this.ensureRecentlyUsedStack(n=>n-1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[o],e)}openPreviouslyUsedEditor(e){let[t,o]=this.ensureRecentlyUsedStack(n=>n+1,e);return this.doNavigateInRecentlyUsedEditorsStack(t[o],e)}async doNavigateInRecentlyUsedEditorsStack(e,t){if(e){let o=typeof t!="number"||!this.editorGroupService.getGroup(t);o?this.navigatingInRecentlyUsedEditorsStack=!0:this.navigatingInRecentlyUsedEditorsInGroupStack=!0;let n=this.editorGroupService.getGroup(e.groupId)??this.editorGroupService.activeGroup;try{await n.openEditor(e.editor)}finally{o?this.navigatingInRecentlyUsedEditorsStack=!1:this.navigatingInRecentlyUsedEditorsInGroupStack=!1}}}ensureRecentlyUsedStack(e,t){let o,n,r=typeof t=="number"?this.editorGroupService.getGroup(t):void 0;r?(o=this.recentlyUsedEditorsInGroupStack||r.getEditors(0).map(l=>({groupId:r.id,editor:l})),n=this.recentlyUsedEditorsInGroupStackIndex):(o=this.recentlyUsedEditorsStack||this.editorService.getEditors(0),n=this.recentlyUsedEditorsStackIndex);let s=e(n);return s<0?s=0:s>o.length-1&&(s=o.length-1),r?(this.recentlyUsedEditorsInGroupStack=o,this.recentlyUsedEditorsInGroupStackIndex=s):(this.recentlyUsedEditorsStack=o,this.recentlyUsedEditorsStackIndex=s),[o,s]}handleEditorEventInRecentEditorsStack(){this.navigatingInRecentlyUsedEditorsStack||(this.recentlyUsedEditorsStack=void 0,this.recentlyUsedEditorsStackIndex=0),this.navigatingInRecentlyUsedEditorsInGroupStack||(this.recentlyUsedEditorsInGroupStack=void 0,this.recentlyUsedEditorsInGroupStackIndex=0)}static{this.MAX_RECENTLY_CLOSED_EDITORS=20}handleEditorCloseEventInReopen(e){if(this.ignoreEditorCloseEvent)return;let{editor:t,context:o}=e;if(o===1||o===2||!t.canReopen())return;let n=t.toUntyped();if(!n)return;let r=[],s=po.getOriginalUri(t,{supportSideBySide:3});A.isUri(s)?r.push(s):s&&r.push(...ui([s.primary,s.secondary])),this.removeFromRecentlyClosedEditors(t),this.recentlyClosedEditors.push({editorId:t.editorId,editor:n,resource:po.getOriginalUri(t),associatedResources:r,index:e.index,sticky:e.sticky}),this.recentlyClosedEditors.length>cP.MAX_RECENTLY_CLOSED_EDITORS&&this.recentlyClosedEditors.shift(),this.canReopenClosedEditorContextKey.set(!0)}async reopenLastClosedEditor(){let e=this.recentlyClosedEditors.pop(),t;return e&&(t=this.doReopenLastClosedEditor(e)),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0),t}async doReopenLastClosedEditor(e){let t={pinned:!0,sticky:e.sticky,index:e.index,ignoreError:!0};(e.sticky&&!this.editorGroupService.activeGroup.isSticky(e.index)||!e.sticky&&this.editorGroupService.activeGroup.isSticky(e.index))&&(t.index=void 0);let o;if(!this.editorGroupService.activeGroup.contains(e.editor)){this.ignoreEditorCloseEvent=!0;try{o=await this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}})}finally{this.ignoreEditorCloseEvent=!1}}o||(Y5e(this.recentlyClosedEditors,e),this.reopenLastClosedEditor())}removeFromRecentlyClosedEditors(e){this.recentlyClosedEditors=this.recentlyClosedEditors.filter(t=>ya(e)&&t.editorId!==e.editorId?!0:!(t.resource&&this.editorHelper.matchesFile(t.resource,e)||t.associatedResources.some(o=>this.editorHelper.matchesFile(o,e)))),this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length>0)}static{this.MAX_HISTORY_ITEMS=200}static{this.HISTORY_STORAGE_KEY="history.entries"}handleActiveEditorChangeInHistory(e){let t=e?.input;!t||t.isDisposed()||!this.includeInHistory(t)||(this.removeFromHistory(t),this.addToHistory(t))}addToHistory(e,t=!0){this.ensureHistoryLoaded(this.history);let o=this.editorHelper.preferResourceEditorInput(e);o&&(t?this.history.unshift(o):this.history.push(o),this.history.length>cP.MAX_HISTORY_ITEMS&&this.editorHelper.clearOnEditorDispose(this.history.pop(),this.editorHistoryListeners),ya(e)&&this.editorHelper.onEditorDispose(e,()=>this.updateHistoryOnEditorDispose(o),this.editorHistoryListeners))}updateHistoryOnEditorDispose(e){if(ya(e))if(!Obi(e))this.removeFromHistory(e);else{let t=[],o=e.primary.matches(e.secondary)?[e.primary]:[e.primary,e.secondary];for(let n of o){let r=this.editorHelper.preferResourceEditorInput(n);zg(r)&&this.includeInHistory(r)&&t.push(r)}this.replaceInHistory(e,...t)}else this.includeInHistory(e)||this.removeFromHistory(e)}includeInHistory(e){return ya(e)?!0:!this.resourceExcludeMatcher.value.matches(e.resource)}removeExcludedFromHistory(){this.ensureHistoryLoaded(this.history),this.history=this.history.filter(e=>{let t=this.includeInHistory(e);return t||this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t})}moveInHistory(e){e.isOperation(2)&&this.removeFromHistory(e)&&this.addToHistory({resource:e.target.resource})}removeFromHistory(e){let t=!1;return this.ensureHistoryLoaded(this.history),this.history=this.history.filter(o=>{let n=this.editorHelper.matchesEditor(e,o);return n&&(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),t=!0),!n}),t}replaceInHistory(e,...t){this.ensureHistoryLoaded(this.history);let o=!1,n=[];for(let r of this.history)this.editorHelper.matchesEditor(e,r)?(this.editorHelper.clearOnEditorDispose(e,this.editorHistoryListeners),o||(n.push(...t),o=!0)):t.some(s=>this.editorHelper.matchesEditor(s,r))||n.push(r);o||n.push(...t),this.history=n}clearRecentlyOpened(){this.history=[],this.editorHistoryListeners.clearAndDisposeAll()}getHistory(){return this.ensureHistoryLoaded(this.history),this.history}ensureHistoryLoaded(e){this.history||(this.history=[],this.editorGroupService.isReady?this.loadHistory():(async()=>(await this.editorGroupService.whenReady,this.loadHistory()))())}loadHistory(){this.history=[];let e=this.loadHistoryFromStorage(),t=[...this.editorService.getEditors(0)].reverse(),o=new Set;for(let{editor:n}of t)if(this.includeInHistory(n)){if(n.resource){let r=`${n.resource.toString()}/${n.editorId}`;if(o.has(r))continue;o.add(r)}this.addToHistory(n)}for(let n of e){let r=`${n.resource.toString()}/${n.options?.override}`;!o.has(r)&&this.includeInHistory(n)&&(o.add(r),this.addToHistory(n,!1))}}loadHistoryFromStorage(){let e=[],t=this.storageService.get(cP.HISTORY_STORAGE_KEY,1);if(t)try{let o=JSON.parse(t);for(let n of o)if(!(!n.editor||!n.editor.resource))try{e.push({...n.editor,resource:typeof n.editor.resource=="string"?A.parse(n.editor.resource):A.from(n.editor.resource)})}catch(r){mt(r)}}catch(o){mt(o)}return e}saveState(){if(!this.history)return;let e=[];for(let t of this.history)ya(t)||!zg(t)||e.push({editor:{...t,resource:t.resource.toString()}});this.storageService.store(cP.HISTORY_STORAGE_KEY,JSON.stringify(e),1,1)}getLastActiveWorkspaceRoot(e,t){let o=this.contextService.getWorkspace().folders;if(o.length!==0){if(o.length===1){let n=o[0].uri;return(!e||n.scheme===e)&&(!t||n.authority===t)?n:void 0}for(let n of this.getHistory()){if(ya(n)||e&&n.resource.scheme!==e||t&&n.resource.authority!==t)continue;let r=this.contextService.getWorkspaceFolder(n.resource);if(r)return r.uri}for(let n of o){let r=n.uri;if((!e||r.scheme===e)&&(!t||r.authority===t))return r}}}getLastActiveFile(e,t){for(let o of this.getHistory()){let n;if(ya(o)?n=po.getOriginalUri(o,{filterByScheme:e}):n=o.resource,n&&n.scheme===e&&(!t||n.authority===t))return n}}dispose(){super.dispose();for(let[,e]of this.editorGroupScopedNavigationStacks)e.disposable.dispose();for(let[,e]of this.editorScopedNavigationStacks)for(let[,t]of e)t.disposable.dispose();for(let[,e]of this.editorHistoryListeners)e.dispose()}};cP=I([m(0,ie),m(1,kt),m(2,Ae),m(3,de),m(4,B),m(5,ge),m(6,bm),m(7,F),m(8,wi),m(9,X),m(10,re)],cP);Ce(fa,cP,0);var zUt=class{constructor(i,e,t){this.editorIdentifier=i;this.selection=e;this.reason=t}justifiesNewNavigationEntry(i){if(this.editorIdentifier.groupId!==i.editorIdentifier.groupId||!this.editorIdentifier.editor.matches(i.editorIdentifier.editor)||!this.selection||!i.selection)return!0;let e=this.selection.compare(i.selection);return e===2&&(i.reason===4||i.reason===5)?!0:e===3}},Qhe=class extends k{constructor(e,t){super();this.scope=e;this.instantiationService=t;this.selectionsStack=this._register(this.instantiationService.createInstance(X8,0,this.scope)),this.editsStack=this._register(this.instantiationService.createInstance(X8,1,this.scope)),this.navigationsStack=this._register(this.instantiationService.createInstance(X8,2,this.scope)),this.stacks=[this.selectionsStack,this.editsStack,this.navigationsStack],this.onDidChange=U.any(this.selectionsStack.onDidChange,this.editsStack.onDidChange,this.navigationsStack.onDidChange)}canGoForward(e){return this.getStack(e).canGoForward()}goForward(e){return this.getStack(e).goForward()}canGoBack(e){return this.getStack(e).canGoBack()}goBack(e){return this.getStack(e).goBack()}goPrevious(e){return this.getStack(e).goPrevious()}canGoLast(e){return this.getStack(e).canGoLast()}goLast(e){return this.getStack(e).goLast()}getStack(e=0){switch(e){case 0:return this.selectionsStack;case 1:return this.editsStack;case 2:return this.navigationsStack}}handleActiveEditorChange(e){this.selectionsStack.notifyNavigation(e)}handleActiveEditorSelectionChange(e,t){let o=this.selectionsStack.current;this.selectionsStack.notifyNavigation(e,t),t.reason===3?this.editsStack.notifyNavigation(e,t):(t.reason===4||t.reason===5)&&!this.selectionsStack.isNavigating()&&(t.reason===5&&!this.navigationsStack.isNavigating()&&o&&this.navigationsStack.addOrReplace(o.groupId,o.editor,o.selection),this.navigationsStack.notifyNavigation(e,t))}clear(){for(let e of this.stacks)e.clear()}remove(e){for(let t of this.stacks)t.remove(e)}move(e){for(let t of this.stacks)t.move(e)}};Qhe=I([m(1,F)],Qhe);var I_i=class{constructor(){this.onDidChange=U.None}canGoForward(){return!1}async goForward(){}canGoBack(){return!1}async goBack(){}async goPrevious(){}canGoLast(){return!1}async goLast(){}handleActiveEditorChange(){}handleActiveEditorSelectionChange(){}clear(){}remove(){}move(){}dispose(){}},X8=class extends k{constructor(e,t,o,n,r,s){super();this.filter=e;this.scope=t;this.editorService=n;this.editorGroupService=r;this.logService=s;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.mapEditorToDisposable=this._register(new Ot);this.mapGroupToDisposable=this._register(new Ot);this.stack=[];this.index=-1;this.previousIndex=-1;this.navigating=!1;this.currentSelectionState=void 0;this.editorHelper=o.createInstance(tAe),this.registerListeners()}static{this.MAX_STACK_SIZE=50}get current(){return this.stack[this.index]}set current(e){e&&(this.stack[this.index]=e)}registerListeners(){this._register(this.onDidChange(()=>this.traceStack())),this._register(this.logService.onDidChangeLogLevel(()=>this.traceStack())),this._register(this.editorGroupService.onDidRemoveGroup(e=>{this.mapGroupToDisposable.deleteAndDispose(e.id)}))}traceStack(){if(this.logService.getLevel()!==1)return;let e=[];for(let t of this.stack)typeof t.selection?.log=="function"?e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: ${t.selection.log()}`):e.push(`- group: ${t.groupId}, editor: ${t.editor.resource?.toString()}, selection: <none>`);e.length===0?this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}: <empty>`):this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}
${e.join(`
`)}
			`)}trace(e,t=null,o){if(this.logService.getLevel()!==1)return;let n;switch(this.filter){case 0:n="global";break;case 1:n="edits";break;case 2:n="navigation";break}let r;switch(this.scope){case 0:r="default";break;case 1:r="editorGroup";break;case 2:r="editor";break}t!==null?this.logService.trace(`[History stack ${n}-${r}]: ${e} (editor: ${t?.resource?.toString()}, event: ${this.traceEvent(o)})`):this.logService.trace(`[History stack ${n}-${r}]: ${e}`)}traceEvent(e){if(!e)return"<none>";switch(e.reason){case 3:return"edit";case 4:return"navigation";case 5:return"jump";case 1:return"programmatic";case 2:return"user"}}registerGroupListeners(e){if(!this.mapGroupToDisposable.has(e)){let t=this.editorGroupService.getGroup(e);t&&this.mapGroupToDisposable.set(e,t.onWillMoveEditor(o=>this.onWillMoveEditor(o)))}}onWillMoveEditor(e){if(this.trace("onWillMoveEditor()",e.editor),this.scope!==1)for(let t of this.stack)t.groupId===e.groupId&&this.editorHelper.matchesEditor(e.editor,t.editor)&&(t.groupId=e.target)}notifyNavigation(e,t){this.trace("notifyNavigation()",e?.input,t);let o=bpe(e),n=e?.input&&!e.input.isDisposed();this.navigating?(this.trace("notifyNavigation() ignoring (navigating)",e?.input,t),o&&n?(this.trace("notifyNavigation() updating current selection state",e?.input,t),this.currentSelectionState=new zUt({groupId:e.group.id,editor:e.input},e.getSelection(),t?.reason)):(this.trace("notifyNavigation() dropping current selection state",e?.input,t),this.currentSelectionState=void 0)):(this.trace("notifyNavigation() not ignoring",e?.input,t),o&&n?this.onSelectionAwareEditorNavigation(e.group.id,e.input,e.getSelection(),t):(this.currentSelectionState=void 0,n&&this.onNonSelectionAwareEditorNavigation(e.group.id,e.input)))}onSelectionAwareEditorNavigation(e,t,o,n){if(this.current?.groupId===e&&!o&&this.editorHelper.matchesEditor(this.current.editor,t))return;this.trace("onSelectionAwareEditorNavigation()",t,n);let r=new zUt({groupId:e,editor:t},o,n?.reason);!this.currentSelectionState||this.currentSelectionState.justifiesNewNavigationEntry(r)?this.doAdd(e,t,r.selection):this.doReplace(e,t,r.selection),this.currentSelectionState=r}onNonSelectionAwareEditorNavigation(e,t){this.current?.groupId===e&&this.editorHelper.matchesEditor(this.current.editor,t)||(this.trace("onNonSelectionAwareEditorNavigation()",t),this.doAdd(e,t))}doAdd(e,t,o){this.navigating||this.addOrReplace(e,t,o)}doReplace(e,t,o){this.navigating||this.addOrReplace(e,t,o,!0)}addOrReplace(e,t,o,n){this.registerGroupListeners(e);let r=!1;this.current&&(n||this.shouldReplaceStackEntry(this.current,{groupId:e,editor:t,selection:o}))&&(r=!0);let s=this.editorHelper.preferResourceEditorInput(t);if(!s)return;r?this.trace("replace()",s):this.trace("add()",s);let l={groupId:e,editor:s,selection:o},c=[];if(r)this.current&&c.push(this.current),this.current=l;else{if(this.stack.length>this.index+1){for(let u=this.index+1;u<this.stack.length;u++)c.push(this.stack[u]);this.stack=this.stack.slice(0,this.index+1)}this.stack.splice(this.index+1,0,l),this.stack.length>X8.MAX_STACK_SIZE?(c.push(this.stack.shift()),this.previousIndex>=0&&this.previousIndex--):this.setIndex(this.index+1,!0)}for(let u of c)this.editorHelper.clearOnEditorDispose(u.editor,this.mapEditorToDisposable);ya(s)&&this.editorHelper.onEditorDispose(s,()=>this.remove(s),this.mapEditorToDisposable),this._onDidChange.fire()}shouldReplaceStackEntry(e,t){return e.groupId!==t.groupId||!this.editorHelper.matchesEditor(e.editor,t.editor)?!1:e.selection?t.selection?e.selection.compare(t.selection)===1:!1:!0}move(e){if(e.isOperation(2))for(let t of this.stack)this.editorHelper.matchesEditor(e,t.editor)&&(t.editor={resource:e.target.resource})}remove(e){let t=this.stack.length;this.stack=this.stack.filter(o=>{let n=typeof e=="number"?o.groupId===e:this.editorHelper.matchesEditor(e,o.editor);return n&&this.editorHelper.clearOnEditorDispose(o.editor,this.mapEditorToDisposable),!n}),t!==this.stack.length&&(this.flatten(),this.index=this.stack.length-1,this.previousIndex=-1,typeof e=="number"&&this.mapGroupToDisposable.deleteAndDispose(e),this._onDidChange.fire())}flatten(){let e=[],t;for(let o of this.stack)t&&this.shouldReplaceStackEntry(o,t)||(t=o,e.push(o));this.stack=e}clear(){this.index=-1,this.previousIndex=-1,this.stack.splice(0),this.mapEditorToDisposable.clearAndDisposeAll(),this.mapGroupToDisposable.clearAndDisposeAll()}dispose(){this.clear(),super.dispose()}canGoForward(){return this.stack.length>this.index+1}async goForward(){if(!await this.maybeGoCurrent()&&this.canGoForward())return this.setIndex(this.index+1),this.navigate()}canGoBack(){return this.index>0}async goBack(){if(!await this.maybeGoCurrent()&&this.canGoBack())return this.setIndex(this.index-1),this.navigate()}async goPrevious(){if(!await this.maybeGoCurrent())return this.previousIndex===-1?this.goBack():(this.setIndex(this.previousIndex),this.navigate())}canGoLast(){return this.stack.length>0}async goLast(){if(this.canGoLast())return this.setIndex(this.stack.length-1),this.navigate()}async maybeGoCurrent(){return this.filter===0||this.isCurrentSelectionActive()?!1:(await this.navigate(),!0)}isCurrentSelectionActive(){if(!this.current?.selection)return!1;let e=this.editorService.activeEditorPane;if(!bpe(e)||e.group.id!==this.current.groupId||!e.input||!this.editorHelper.matchesEditor(e.input,this.current.editor))return!1;let t=e.getSelection();return t?t.compare(this.current.selection)===1:!1}setIndex(e,t){this.previousIndex=this.index,this.index=e,t||this._onDidChange.fire()}async navigate(){this.navigating=!0;try{this.current&&await this.doNavigate(this.current)}finally{this.navigating=!1}}doNavigate(e){let t=Object.create(null);return e.selection&&(t=e.selection.restore(t)),ya(e.editor)?this.editorService.openEditor(e.editor,t,e.groupId):this.editorService.openEditor({...e.editor,options:{...e.editor.options,...t}},e.groupId)}isNavigating(){return this.navigating}};X8=I([m(2,F),m(3,ie),m(4,kt),m(5,re)],X8);var tAe=class{constructor(i,e,t,o){this.uriIdentityService=i;this.lifecycleService=e;this.fileService=t;this.pathService=o}preferResourceEditorInput(i){let e=po.getOriginalUri(i);if(e?.scheme===Q.file||e?.scheme===Q.vscodeRemote||e?.scheme===Q.vscodeUserData||e?.scheme===this.pathService.defaultUriScheme){if(ya(i)){let o=i.toUntyped();if(zg(o))return o}return i}else return ya(i)?i:void 0}matchesEditor(i,e){return i instanceof AF||i instanceof PF?ya(e)?!1:i instanceof AF?i.contains(e.resource,2):this.matchesFile(e.resource,i):ya(i)?ya(e)?i.matches(e):this.matchesFile(e.resource,i):ya(e)?this.matchesFile(i.resource,e):i&&e&&this.uriIdentityService.extUri.isEqual(i.resource,e.resource)}matchesFile(i,e){if(e instanceof AF)return e.contains(i,2);if(e instanceof PF)return this.uriIdentityService.extUri.isEqualOrParent(i,e.resource);if(ya(e)){let t=e.resource;return!t||this.lifecycleService.phase>=3&&!this.fileService.hasProvider(t)?!1:this.uriIdentityService.extUri.isEqual(t,i)}return this.uriIdentityService.extUri.isEqual(e?.resource,i)}matchesEditorIdentifier(i,e){return!e?.group||i.groupId!==e.group.id?!1:e.input?i.editor.matches(e.input):!1}onEditorDispose(i,e,t){let o=U.once(i.onWillDispose)(()=>e()),n=t.get(i);n||(n=new O,t.set(i,n)),n.add(o)}clearOnEditorDispose(i,e){ya(i)&&e.deleteAndDispose(i)}};tAe=I([m(0,gt),m(1,to),m(2,ge),m(3,Pn)],tAe);var Lit=class extends k{constructor(e,t,o){super();this.viewId=e;this.viewDescriptorService=t;this.activityService=o;this.activity=void 0;this.activityDisposable=k.None;this._register(U.filter(this.viewDescriptorService.onDidChangeContainer,n=>n.views.some(r=>r.id===e))(()=>this.update())),this._register(U.filter(this.viewDescriptorService.onDidChangeLocation,n=>n.views.some(r=>r.id===e))(()=>this.update()))}setActivity(e){this.activity=e,this.update()}clearActivity(){this.activity=void 0,this.update()}update(){this.activityDisposable.dispose();let e=this.viewDescriptorService.getViewContainerByViewId(this.viewId);e&&this.activity&&(this.activityDisposable=this.activityService.showViewContainerActivity(e.id,this.activity))}dispose(){this.activityDisposable.dispose(),super.dispose()}};Lit=I([m(1,ji),m(2,Al)],Lit);var Mit=class extends k{constructor(e,t){super();this.viewDescriptorService=e;this.instantiationService=t;this.viewActivities=new Map;this._onDidChangeActivity=this._register(new T);this.onDidChangeActivity=this._onDidChangeActivity.event;this.viewContainerActivities=new Map;this.globalActivities=new Map}showViewContainerActivity(e,t){let o=this.viewDescriptorService.getViewContainerById(e);if(!o)return k.None;let n=this.viewContainerActivities.get(e);return n||(n=[],this.viewContainerActivities.set(e,n)),n.push(t),this._onDidChangeActivity.fire(o),ee(()=>{n.splice(n.indexOf(t),1),n.length===0&&this.viewContainerActivities.delete(e),this._onDidChangeActivity.fire(o)})}getViewContainerActivities(e){return this.viewDescriptorService.getViewContainerById(e)?this.viewContainerActivities.get(e)??[]:[]}showViewActivity(e,t){let o=this.viewActivities.get(e);o?o.id++:(o={id:1,activity:this.instantiationService.createInstance(Lit,e)},this.viewActivities.set(e,o));let n=o.id;o.activity.setActivity(t);let r=o;return ee(()=>{r.id===n&&(r.activity.dispose(),this.viewActivities.delete(e))})}showAccountsActivity(e){return this.showActivity(CU,e)}showGlobalActivity(e){return this.showActivity(wU,e)}getActivity(e){return this.globalActivities.get(e)??[]}showActivity(e,t){let o=this.globalActivities.get(e);return o||(o=[],this.globalActivities.set(e,o)),o.push(t),this._onDidChangeActivity.fire(e),ee(()=>{o.splice(o.indexOf(t),1),o.length===0&&this.globalActivities.delete(e),this._onDidChangeActivity.fire(e)})}};Mit=I([m(0,ji),m(1,F)],Mit);Ce(Al,Mit,1);var dP=class{static _readModifiers(i){i=i.toLowerCase().trim();let e=!1,t=!1,o=!1,n=!1,r;do r=!1,/^ctrl(\+|\-)/.test(i)&&(e=!0,i=i.substr(5),r=!0),/^shift(\+|\-)/.test(i)&&(t=!0,i=i.substr(6),r=!0),/^alt(\+|\-)/.test(i)&&(o=!0,i=i.substr(4),r=!0),/^meta(\+|\-)/.test(i)&&(n=!0,i=i.substr(5),r=!0),/^win(\+|\-)/.test(i)&&(n=!0,i=i.substr(4),r=!0),/^cmd(\+|\-)/.test(i)&&(n=!0,i=i.substr(4),r=!0);while(r);let s,l=i.indexOf(" ");return l>0?(s=i.substring(0,l),i=i.substring(l)):(s=i,i=""),{remains:i,ctrl:e,shift:t,alt:o,meta:n,key:s}}static parseChord(i){let e=this._readModifiers(i),t=e.key.match(/^\[([^\]]+)\]$/);if(t){let n=t[1],r=DS.lowerCaseToEnum(n);return[new IL(e.ctrl,e.shift,e.alt,e.meta,r),e.remains]}let o=sm.fromUserSettings(e.key);return[new RS(e.ctrl,e.shift,e.alt,e.meta,o),e.remains]}static parseKeybinding(i){if(!i)return null;let e=[],t;for(;i.length>0;)[t,i]=this.parseChord(i),e.push(t);return e.length>0?new yz(e):null}};var Mon=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/,KUt=class extends k{constructor(e,t,o,n,r){super();this._contextKeyService=e;this._commandService=t;this._telemetryService=o;this._notificationService=n;this._logService=r;this._onDidUpdateKeybindings=this._register(new T);this._currentChords=[],this._currentChordChecker=new ky,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=iAe.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new Nl,this._currentlyDispatchingCommandId=null,this._logging=!1}get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:U.None}get inChordMode(){return this._currentChords.length>0}getDefaultKeybindingsContent(){return""}toggleLogging(){return this._logging=!this._logging,this._logging}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getDefaultKeybindings(){return this._getResolver().getDefaultKeybindings()}getKeybindings(){return this._getResolver().getKeybindings()}customKeybindingsCount(){return 0}lookupKeybindings(e){return ui(this._getResolver().lookupKeybindings(e).map(t=>t.resolvedKeybinding))}lookupKeybinding(e,t,o=!1){let n=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService,o);if(n)return n.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){this._log("/ Soft dispatching keyboard event");let o=this.resolveKeyboardEvent(e);if(o.hasMultipleChords())return console.warn("keyboard event should not be mapped to multiple chords"),e6e;let[n]=o.getDispatchChords();if(n===null)return this._log("\\ Keyboard event cannot be dispatched"),e6e;let r=this._contextKeyService.getContext(t),s=this._currentChords.map((({keypress:l})=>l));return this._getResolver().resolve(r,s,n)}_scheduleLeaveChordMode(){let e=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-e>5e3&&this._leaveChordMode()},500)}_expectAnotherChord(e,t){switch(this._currentChords.push({keypress:e,label:t}),this._currentChords.length){case 0:throw Nye("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(d(2367,null,t));break;default:{let o=this._currentChords.map(({label:n})=>n).join(", ");this._currentChordStatusMessage=this._notificationService.status(d(2370,null,o))}}this._scheduleLeaveChordMode(),xD.enabled&&xD.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.close(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],xD.enable()}dispatchByUserSettingsLabel(e,t){this._log(`/ Dispatching keybinding triggered via menu entry accelerator - ${e}`);let o=this.resolveUserBinding(e);o.length===0?this._log(`\\ Could not resolve - ${e}`):this._doDispatch(o[0],t,!1)}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){let o=this.resolveKeyboardEvent(e),[n]=o.getSingleModifierDispatchChords();if(n)return this._ignoreSingleModifiers.has(n)?(this._log(`+ Ignoring single modifier ${n} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=iAe.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=iAe.EMPTY,this._currentSingleModifier===null?(this._log(`+ Storing single modifier for possible chord ${n}.`),this._currentSingleModifier=n,this._currentSingleModifierClearTimeout.cancelAndSet(()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null},300),!1):n===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${n} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(o,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));let[r]=o.getChords();return this._ignoreSingleModifiers=new iAe(r),this._currentSingleModifier!==null&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,o=!1){let n=!1;if(e.hasMultipleChords())return console.warn("Unexpected keyboard event mapped to multiple chords"),!1;let r=null,s=null;if(o){let[p]=e.getSingleModifierDispatchChords();r=p,s=p?[p]:[]}else[r]=e.getDispatchChords(),s=this._currentChords.map(({keypress:p})=>p);if(r===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),n;let l=this._contextKeyService.getContext(t),c=e.getLabel(),u=this._getResolver().resolve(l,s,r);switch(u.kind){case 0:{if(this._logService.trace("KeybindingService#dispatch",c,"[ No matching keybinding ]"),this.inChordMode){let p=this._currentChords.map(({label:h})=>h).join(", ");this._log(`+ Leaving multi-chord mode: Nothing bound to "${p}, ${c}".`),this._notificationService.status(d(2369,null,p,c),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}return n}case 1:return this._logService.trace("KeybindingService#dispatch",c,"[ Several keybindings match - more chords needed ]"),n=!0,this._expectAnotherChord(r,c),this._log(this._currentChords.length===1?"+ Entering multi-chord mode...":"+ Continuing multi-chord mode..."),n;case 2:{if(this._logService.trace("KeybindingService#dispatch",c,`[ Will dispatch command ${u.commandId} ]`),u.commandId===null||u.commandId===""){if(this.inChordMode){let p=this._currentChords.map(({label:h})=>h).join(", ");this._log(`+ Leaving chord mode: Nothing bound to "${p}, ${c}".`),this._notificationService.status(d(2369,null,p,c),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}}else{this.inChordMode&&this._leaveChordMode(),u.isBubble||(n=!0),this._log(`+ Invoking command ${u.commandId}.`),this._currentlyDispatchingCommandId=u.commandId;try{typeof u.commandArgs>"u"?this._commandService.executeCommand(u.commandId).then(void 0,p=>this._notificationService.warn(p)):this._commandService.executeCommand(u.commandId,u.commandArgs).then(void 0,p=>this._notificationService.warn(p))}finally{this._currentlyDispatchingCommandId=null}Mon.test(u.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:u.commandId,from:"keybinding",detail:e.getUserSettingsLabel()??void 0})}return n}}}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}appendKeybinding(e,t,o,n){if(t){let r=this.lookupKeybinding(t,o,n)?.getLabel();if(r)return d(2368,null,e,r)}return e}},iAe=class a{static{this.EMPTY=new a(null)}constructor(i){this._ctrlKey=i?i.ctrlKey:!1,this._shiftKey=i?i.shiftKey:!1,this._altKey=i?i.altKey:!1,this._metaKey=i?i.metaKey:!1}has(i){switch(i){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}};var GUt=le("keyboardLayoutService");function y_i(a){return a.name?a.name:a.id?a.id:a.layout}function Pon(a,i){return!a&&!i?!0:!a||!i?!1:a.vkey===i.vkey&&a.value===i.value&&a.withShift===i.withShift&&a.withAltGr===i.withAltGr&&a.withShiftAltGr===i.withShiftAltGr}function mvo(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;for(let e=0;e<193;e++){let t=DS.toString(e),o=a[t],n=i[t];if(!Pon(o,n))return!1}return!0}function Aon(a,i){return!a&&!i?!0:!a||!i?!1:a.value===i.value&&a.withShift===i.withShift&&a.withAltGr===i.withAltGr&&a.withShiftAltGr===i.withShiftAltGr}function hvo(a,i){if(!a&&!i)return!0;if(!a||!i)return!1;for(let e=0;e<193;e++){let t=DS.toString(e),o=a[t],n=i[t];if(!Aon(o,n))return!1}return!0}var Yhe=class{static writeKeybindingItem(i,e){if(!e.resolvedKeybinding)return;let t=JSON.stringify(e.resolvedKeybinding.getUserSettingsLabel());i.write(`{ "key": ${Non(t+",",25)} "command": `);let o=e.when?JSON.stringify(e.when.serialize()):"",n=JSON.stringify(e.command);o.length>0?(i.write(`${n},`),i.writeLine(),i.write(`                                     "when": ${o}`)):i.write(`${n}`),e.commandArgs&&(i.write(","),i.writeLine(),i.write(`                                     "args": ${JSON.stringify(e.commandArgs)}`)),i.write(" }")}static readUserKeybindingItem(i){let e="key"in i&&typeof i.key=="string"?dP.parseKeybinding(i.key):null,t="when"in i&&typeof i.when=="string"?C.deserialize(i.when):void 0,o="command"in i&&typeof i.command=="string"?i.command:null,n="args"in i&&typeof i.args<"u"?i.args:void 0;return{keybinding:e,command:o,commandArgs:n,when:t,_sourceKey:"key"in i&&typeof i.key=="string"?i.key:void 0}}};function Non(a,i){return a.length<i?a+new Array(i-a.length).join(" "):a}var oAe=class{constructor(){this._lines=[];this._currentLine=""}write(i){this._currentLine+=i}writeLine(i=""){this._lines.push(this._currentLine+i),this._currentLine=""}toString(){return this.writeLine(),this._lines.join(`
`)}};function Oon(a,i){return a?typeof a.command!="string"?(i.push(d(19109,null,"command")),!1):a.key&&typeof a.key!="string"?(i.push(d(19108,null,"key")),!1):a.when&&typeof a.when!="string"?(i.push(d(19108,null,"when")),!1):a.mac&&typeof a.mac!="string"?(i.push(d(19108,null,"mac")),!1):a.linux&&typeof a.linux!="string"?(i.push(d(19108,null,"linux")),!1):a.win&&typeof a.win!="string"?(i.push(d(19108,null,"win")),!1):!0:(i.push(d(19107,null)),!1)}var gvo={type:"object",default:{command:"",key:""},required:["command","key"],properties:{command:{description:d(19113,null),type:"string"},args:{description:d(19112,null)},key:{description:d(19114,null),type:"string"},mac:{description:d(19116,null),type:"string"},linux:{description:d(19115,null),type:"string"},win:{description:d(19118,null),type:"string"},when:{description:d(19117,null),type:"string"}}},fvo=zn.registerExtensionPoint({extensionPoint:"keybindings",deps:[gEi],jsonSchema:{description:d(19111,null),oneOf:[gvo,{type:"array",items:gvo}]}}),Fon=[90,91,92,93,95,96,97,98,99,100,101,102,103,104,105],EU=new Map;EU.set(95,22);EU.set(96,23);EU.set(97,24);EU.set(98,25);EU.set(99,26);EU.set(100,27);EU.set(101,28);EU.set(102,29);EU.set(103,30);EU.set(104,21);var J8=class extends KUt{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,p);this.hostService=s;this.keyboardLayoutService=h;this._contributions=[];this.isComposingGlobalContextKey=e.createKey(me.isComposing.key,!1),this.kbsJsonSchema=new C_i,this.updateKeybindingsJsonSchema(),this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this._register(this.keyboardLayoutService.onDidChangeKeyboardLayout(()=>{this._keyboardMapper=this.keyboardLayoutService.getKeyboardMapper(),this.updateResolver()})),this._keybindingHoldMode=null,this._cachedResolver=null,this.userKeybindings=this._register(new w_i(r,u,c,p)),this.userKeybindings.initialize().then(()=>{this.userKeybindings.keybindings.length&&this.updateResolver()}),this._register(this.userKeybindings.onDidChange(()=>{p.debug("User keybindings changed"),this.updateResolver()})),fvo.setHandler(g=>{let f=[];for(let v of g)this._handleKeybindingsExtensionPointUser(v.description.identifier,v.description.isBuiltin,v.value,v.collector,f);xt.setExtensionKeybindings(f),this.updateResolver()}),this.updateKeybindingsJsonSchema(),this._register(l.onDidRegisterExtensions(()=>this.updateKeybindingsJsonSchema())),this._register(U.runAndSubscribe(Of,({window:g,disposables:f})=>f.add(this._registerKeyListeners(g)),{window:ut,disposables:this._store})),this._register(ZO(g=>{if(g!==ut.vscodeWindowId)return;let f=navigator.keyboard;of.keyboard!==2&&(rx(ut)?f?.lock(["Escape"]):f?.unlock(),this._cachedResolver=null,this._onDidUpdateKeybindings.fire())}))}dispose(){this._contributions.forEach(e=>e.listener?.dispose()),this._contributions.length=0,super.dispose()}_registerKeyListeners(e){let t=new O;return t.add($(e,ne.KEY_DOWN,o=>{if(this._keybindingHoldMode)return;this.isComposingGlobalContextKey.set(o.isComposing);let n=new mi(o);this._log(`/ Received  keydown event - ${O3i(o)}`),this._log(`| Converted keydown event - ${F3i(n)}`),this._dispatch(n,n.target)&&n.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t.add($(e,ne.KEY_UP,o=>{this._resetKeybindingHoldMode(),this.isComposingGlobalContextKey.set(o.isComposing);let n=new mi(o);this._singleModifierDispatch(n,n.target)&&n.preventDefault(),this.isComposingGlobalContextKey.set(!1)})),t}registerSchemaContribution(e){let t=e.onDidChange?.(()=>this.updateKeybindingsJsonSchema()),o={listener:t,contribution:e};return this._contributions.push(o),this.updateKeybindingsJsonSchema(),ee(()=>{t?.dispose(),Y5e(this._contributions,o),this.updateKeybindingsJsonSchema()})}updateKeybindingsJsonSchema(){this.kbsJsonSchema.updateSchema(this._contributions.flatMap(e=>e.contribution.getSchemaAdditions()))}_printKeybinding(e){return Hke.toLabel(Ao,e.chords,t=>t instanceof RS?sm.toString(t.keyCode):DS.toString(t.scanCode))||"[null]"}_printResolvedKeybinding(e){return e.getDispatchChords().map(t=>t||"[null]").join(" ")}_printResolvedKeybindings(e,t,o){let r=`${t.padStart(35," ")} => `;if(o.length===0){e.push(`${r}${"[NO BINDING]".padStart(35," ")}`);return}let s=r.length,l=!0;for(let c of o)l?e.push(`${r}${this._printResolvedKeybinding(c).padStart(35," ")}`):e.push(`${" ".repeat(s)}${this._printResolvedKeybinding(c).padStart(35," ")}`)}_dumpResolveKeybindingDebugInfo(){let e=new Set,t=[];t.push("Default Resolved Keybindings (unique only):");for(let o of xt.getDefaultKeybindings()){if(!o.keybinding)continue;let n=this._printKeybinding(o.keybinding);if(e.has(n))continue;e.add(n);let r=this._keyboardMapper.resolveKeybinding(o.keybinding);this._printResolvedKeybindings(t,n,r)}t.push("User Resolved Keybindings (unique only):");for(let o of this.userKeybindings.keybindings){if(!o.keybinding)continue;let n=o._sourceKey??"Impossible: missing source key, but has keybinding";if(e.has(n))continue;e.add(n);let r=this._keyboardMapper.resolveKeybinding(o.keybinding);this._printResolvedKeybindings(t,n,r)}return t.join(`
`)}_dumpDebugInfo(){let e=JSON.stringify(this.keyboardLayoutService.getCurrentKeyboardLayout(),null,"	"),t=this._keyboardMapper.dumpDebugInfo(),o=this._dumpResolveKeybindingDebugInfo(),n=JSON.stringify(this.keyboardLayoutService.getRawKeyboardMapping(),null,"	");return`Layout info:
${e}

${o}

${t}

Raw mapping:
${n}`}_dumpDebugInfoJSON(){let e={layout:this.keyboardLayoutService.getCurrentKeyboardLayout(),rawMapping:this.keyboardLayoutService.getRawKeyboardMapping()};return JSON.stringify(e,null,"	")}enableKeybindingHoldMode(e){if(this._currentlyDispatchingCommandId!==e)return;this._keybindingHoldMode=new Mo;let t=nr(Me(void 0)),o=t.onDidBlur(()=>this._resetKeybindingHoldMode());return this._keybindingHoldMode.p.finally(()=>{o.dispose(),t.dispose()}),this._log(`+ Enabled hold-mode for ${e}.`),this._keybindingHoldMode.p}_resetKeybindingHoldMode(){this._keybindingHoldMode&&(this._keybindingHoldMode?.complete(),this._keybindingHoldMode=null)}customKeybindingsCount(){return this.userKeybindings.keybindings.length}updateResolver(){this._cachedResolver=null,this._onDidUpdateKeybindings.fire()}_getResolver(){if(!this._cachedResolver){let e=this._resolveKeybindingItems(xt.getDefaultKeybindings(),!0),t=this._resolveUserKeybindingItems(this.userKeybindings.keybindings,!1);this._cachedResolver=new gEe(e,t,o=>this._log(o))}return this._cachedResolver}_documentHasFocus(){return this.hostService.hasFocus}_resolveKeybindingItems(e,t){let o=[],n=0;for(let r of e){let s=r.when||void 0,l=r.keybinding;if(!l)o[n++]=new zN(void 0,r.command,r.commandArgs,s,t,r.extensionId,r.isBuiltinExtension);else{if(this._assertBrowserConflicts(l))continue;let c=this._keyboardMapper.resolveKeybinding(l);for(let u=c.length-1;u>=0;u--){let p=c[u];o[n++]=new zN(p,r.command,r.commandArgs,s,t,r.extensionId,r.isBuiltinExtension)}}}return o}_resolveUserKeybindingItems(e,t){let o=[],n=0;for(let r of e){let s=r.when||void 0;if(!r.keybinding)o[n++]=new zN(void 0,r.command,r.commandArgs,s,t,null,!1);else{let l=this._keyboardMapper.resolveKeybinding(r.keybinding);for(let c of l)o[n++]=new zN(c,r.command,r.commandArgs,s,t,null,!1)}}return o}_assertBrowserConflicts(e){if(of.keyboard===0||of.keyboard===1&&rx(ut))return!1;for(let t of e.chords){if(!t.metaKey&&!t.altKey&&!t.ctrlKey&&!t.shiftKey)continue;let o=3584,n=0;if(t.metaKey&&(n|=2048),t.shiftKey&&(n|=1024),t.altKey&&(n|=512),t.ctrlKey&&Ao===2&&(n|=256),(n&o)===2560&&(t instanceof IL&&(t.scanCode===86||t.scanCode===85)||t instanceof RS&&(t.keyCode===15||t.keyCode===17))||(n&o)===2048&&(t instanceof IL&&t.scanCode>=36&&t.scanCode<=45||t instanceof RS&&t.keyCode>=21&&t.keyCode<=30))return!0}return!1}resolveKeybinding(e){return this._keyboardMapper.resolveKeybinding(e)}resolveKeyboardEvent(e){return this.keyboardLayoutService.validateCurrentKeyboardMapping(e),this._keyboardMapper.resolveKeyboardEvent(e)}resolveUserBinding(e){let t=dP.parseKeybinding(e);return t?this._keyboardMapper.resolveKeybinding(t):[]}_handleKeybindingsExtensionPointUser(e,t,o,n,r){if(Array.isArray(o))for(let s=0,l=o.length;s<l;s++)this._handleKeybinding(e,t,s+1,o[s],n,r);else this._handleKeybinding(e,t,1,o,n,r)}_handleKeybinding(e,t,o,n,r,s){let l=[];if(Oon(n,l)){let c=this._asCommandRule(e,t,o++,n);c&&s.push(c)}l.length>0&&r.error(d(19099,null,fvo.name,l.join(`
`)))}static bindToCurrentPlatform(e,t,o,n){if(Ao===1&&n){if(n)return n}else if(Ao===2){if(t)return t}else if(o)return o;return e}_asCommandRule(e,t,o,n){let{command:r,args:s,when:l,key:c,mac:u,linux:p,win:h}=n,g=J8.bindToCurrentPlatform(c,u,p,h);if(!g)return;let f;t?f=300+o:f=400+o;let v=be.getCommand(r),b=v&&v.precondition,S;return l&&b?S=C.and(b,C.deserialize(l)):l?S=C.deserialize(l):b&&(S=b),{id:r,args:s,when:S,weight:f,keybinding:dP.parseKeybinding(g),extensionId:e.value,isBuiltinExtension:t}}getDefaultKeybindingsContent(){let e=this._getResolver(),t=e.getDefaultKeybindings(),o=e.getDefaultBoundCommands();return J8._getDefaultKeybindings(t)+`

`+J8._getAllCommandsAsComment(o)}static _getDefaultKeybindings(e){let t=new oAe;t.writeLine("[");let o=e.length-1;return e.forEach((n,r)=>{Yhe.writeKeybindingItem(t,n),r!==o?t.writeLine(","):t.writeLine()}),t.writeLine("]"),t.toString()}static _getAllCommandsAsComment(e){let o=QPe(e).sort().join(`
// - `);return"// "+d(19110,null)+`
// - `+o}mightProducePrintableCharacter(e){if(e.ctrlKey||e.metaKey||e.altKey)return!1;let t=DS.toEnum(e.code);if(Fon.indexOf(t)!==-1)return!!(e.keyCode===Fw[t]||et&&e.keyCode===EU.get(t));if(Fw[t]!==-1)return!1;let n=this.keyboardLayoutService.getRawKeyboardMapping();if(!n)return!1;let r=n[e.code];return!(!r||!r.value||/\s/.test(r.value))}};J8=I([m(0,X),m(1,fe),m(2,_e),m(3,Ne),m(4,gn),m(5,ti),m(6,lt),m(7,ge),m(8,gt),m(9,re),m(10,GUt)],J8);var w_i=class extends k{constructor(e,t,o,n){super();this.userDataProfileService=e;this.uriIdentityService=t;this.fileService=o;this._rawKeybindings=[];this._keybindings=[];this.watchDisposables=this._register(new O);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.watch(),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.reload().then(r=>{r&&this._onDidChange.fire()}),50)),this._register(U.filter(this.fileService.onDidFilesChange,r=>r.contains(this.userDataProfileService.currentProfile.keybindingsResource))(()=>{n.debug("Keybindings file changed"),this.reloadConfigurationScheduler.schedule()})),this._register(this.fileService.onDidRunOperation(r=>{r.operation===4&&r.resource.toString()===this.userDataProfileService.currentProfile.keybindingsResource.toString()&&(n.debug("Keybindings file written"),this.reloadConfigurationScheduler.schedule())})),this._register(e.onDidChangeCurrentProfile(r=>{this.uriIdentityService.extUri.isEqual(r.previous.keybindingsResource,r.profile.keybindingsResource)||r.join(this.whenCurrentProfileChanged())}))}get keybindings(){return this._keybindings}async whenCurrentProfileChanged(){this.watch(),this.reloadConfigurationScheduler.schedule()}watch(){this.watchDisposables.clear(),this.watchDisposables.add(this.fileService.watch(ai(this.userDataProfileService.currentProfile.keybindingsResource))),this.watchDisposables.add(this.fileService.watch(this.userDataProfileService.currentProfile.keybindingsResource))}async initialize(){await this.reload()}async reload(){let e=await this.readUserKeybindings();return Qi(this._rawKeybindings,e)?!1:(this._rawKeybindings=e,this._keybindings=this._rawKeybindings.map(t=>Yhe.readUserKeybindingItem(t)),!0)}async readUserKeybindings(){try{let e=await this.fileService.readFile(this.userDataProfileService.currentProfile.keybindingsResource),t=is(e.value.toString());return Array.isArray(t)?t.filter(o=>o&&typeof o=="object"):[]}catch{return[]}}},C_i=class a{constructor(){this.commandsSchemas=[];this.commandsEnum=[];this.removalCommandsEnum=[];this.commandsEnumDescriptions=[];this.schema={id:a.schemaId,type:"array",title:d(19105,null),allowTrailingCommas:!0,allowComments:!0,definitions:{editorGroupsSchema:{type:"array",items:{type:"object",properties:{groups:{$ref:"#/definitions/editorGroupsSchema",default:[{},{}]},size:{type:"number",default:.5}}}},commandNames:{type:"string",enum:this.commandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:d(19102,null)},commandType:{anyOf:[{$ref:"#/definitions/commandNames"},{type:"string",enum:this.removalCommandsEnum,enumDescriptions:this.commandsEnumDescriptions,description:d(19104,null)},{type:"string"}]},commandsSchemas:{allOf:this.commandsSchemas}},items:{required:["key"],type:"object",defaultSnippets:[{body:{key:"$1",command:"$2",when:"$3"}}],properties:{key:{type:"string",description:d(19103,null)},command:{anyOf:[{if:{type:"array"},then:{not:{type:"array"},errorMessage:d(19100,null,"string")},else:{$ref:"#/definitions/commandType"}},{$ref:"#/definitions/commandType"}]},when:{type:"string",description:d(19106,null)},args:{description:d(19101,null)}},$ref:"#/definitions/commandsSchemas"}};this.schemaRegistry=oe.as(Ta.JSONContribution);this.schemaRegistry.registerSchema(a.schemaId,this.schema)}static{this.schemaId="vscode://schemas/keybindings"}updateSchema(i){this.commandsSchemas.length=0,this.commandsEnum.length=0,this.removalCommandsEnum.length=0,this.commandsEnumDescriptions.length=0;let e=new Set,t=(r,s)=>{/^_/.test(r)||e.has(r)||(e.add(r),this.commandsEnum.push(r),this.commandsEnumDescriptions.push(s===void 0?"":d4(s)?s.value:s),this.removalCommandsEnum.push(`-${r}`))},o=Ge.getCommands();for(let[r,s]of o){let l=s.metadata;if(t(r,l?.description??be.getCommand(r)?.title),!l||!l.args||l.args.length!==1||!l.args[0].schema)continue;let c=l.args[0].schema,u=typeof l.args[0].isOptional<"u"?!l.args[0].isOptional:Array.isArray(c.required)&&c.required.length>0,p={if:{required:["command"],properties:{command:{const:r}}},then:{required:[].concat(u?["args"]:[]),properties:{args:c}}};this.commandsSchemas.push(p)}let n=be.getCommands();for(let r of n.keys())t(r);this.commandsSchemas.push(...i),this.schemaRegistry.notifySchemaChanged(a.schemaId)}};Ce(Le,J8,0);var Pit=class{constructor(i,e,t,o){this.configurationService=i;this.environmentService=t;this.storageService=o;this.remoteEnvironment=null;e.getEnvironment().then(n=>this.remoteEnvironment=n)}getEOL(i,e){let t=this.configurationService.getValue("files.eol",{overrideIdentifier:e,resource:i});if(t&&typeof t=="string"&&t!=="auto")return t;let o=this.getOS(i);return o===3||o===2?`
`:`\r
`}getOS(i){let e=Ao,t=this.environmentService.remoteAuthority;if(t&&i&&i.scheme!==Q.file){let o=`resource.authority.os.${t}`;e=this.remoteEnvironment?this.remoteEnvironment.os:this.storageService.getNumber(o,1,Ao),this.storageService.store(o,e,1,1)}return e}};Pit=I([m(0,B),m(1,bo),m(2,Mt),m(3,de)],Pit);Ce(BL,Pit,1);function Xte(a){return a.toString()}var x_i=class{constructor(i,e,t){this.model=i;this._modelEventListeners=new O;this.model=i,this._modelEventListeners.add(i.onWillDispose(()=>e(i))),this._modelEventListeners.add(i.onDidChangeLanguage(o=>t(i,o)))}dispose(){this._modelEventListeners.dispose()}},Won=Sn||et?1:2,k_i=class{constructor(i,e,t,o,n,r,s,l){this.uri=i;this.initialUndoRedoSnapshot=e;this.time=t;this.sharesUndoRedoStack=o;this.heapSize=n;this.sha1=r;this.versionId=s;this.alternativeVersionId=l}},PW=class extends k{constructor(e,t,o,n){super();this._configurationService=e;this._resourcePropertiesService=t;this._undoRedoService=o;this._instantiationService=n;this._onModelAdded=this._register(new T);this.onModelAdded=this._onModelAdded.event;this._onModelRemoved=this._register(new T);this.onModelRemoved=this._onModelRemoved.event;this._onModelModeChanged=this._register(new T);this.onModelLanguageChanged=this._onModelModeChanged.event;this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._register(this._configurationService.onDidChangeConfiguration(r=>this._updateModelOptions(r))),this._updateModelOptions(void 0)}static{this.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024}static _readModelOptions(e,t){let o=Uv.tabSize;e.editor&&typeof e.editor.tabSize<"u"&&(o=TB(e.editor.tabSize,Uv.tabSize,1,100));let n="tabSize";e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"&&(n=TB(e.editor.indentSize,"tabSize",1,100));let r=Uv.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(r=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let s=Won,l=e.eol;l===`\r
`?s=2:l===`
`&&(s=1);let c=Uv.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace<"u"&&(c=e.editor.trimAutoWhitespace==="false"?!1:!!e.editor.trimAutoWhitespace);let u=Uv.detectIndentation;e.editor&&typeof e.editor.detectIndentation<"u"&&(u=e.editor.detectIndentation==="false"?!1:!!e.editor.detectIndentation);let p=Uv.largeFileOptimizations;e.editor&&typeof e.editor.largeFileOptimizations<"u"&&(p=e.editor.largeFileOptimizations==="false"?!1:!!e.editor.largeFileOptimizations);let h=Uv.bracketPairColorizationOptions;if(e.editor?.bracketPairColorization&&typeof e.editor.bracketPairColorization=="object"){let g=e.editor.bracketPairColorization;h={enabled:!!g.enabled,independentColorPoolPerBracketType:!!g.independentColorPoolPerBracketType}}return{isForSimpleWidget:t,tabSize:o,indentSize:n,insertSpaces:r,detectIndentation:u,defaultEOL:s,trimAutoWhitespace:c,largeFileOptimizations:p,bracketPairColorizationOptions:h}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);let o=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return o&&typeof o=="string"&&o!=="auto"?o:Ao===3||Ao===2?`
`:`\r
`}_shouldRestoreUndoStack(){let e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,o){let n=typeof e=="string"?e:e.languageId,r=this._modelCreationOptionsByLanguageAndResource[n+t];if(!r){let s=this._configurationService.getValue("editor",{overrideIdentifier:n,resource:t}),l=this._getEOL(t,n);r=PW._readModelOptions({editor:s,eol:l},o),this._modelCreationOptionsByLanguageAndResource[n+t]=r}return r}_updateModelOptions(e){let t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);let o=Object.keys(this._models);for(let n=0,r=o.length;n<r;n++){let s=o[n],l=this._models[s],c=l.model.getLanguageId(),u=l.model.uri;if(e&&!e.affectsConfiguration("editor",{overrideIdentifier:c,resource:u})&&!e.affectsConfiguration("files.eol",{overrideIdentifier:c,resource:u}))continue;let p=t[c+u],h=this.getCreationOptions(c,u,l.model.isForSimpleWidget);PW._setModelOptionsForModel(l.model,h,p)}}static _setModelOptionsForModel(e,t,o){o&&o.defaultEOL!==t.defaultEOL&&e.getLineCount()===1&&e.setEOL(t.defaultEOL===1?0:1),!(o&&o.detectIndentation===t.detectIndentation&&o.insertSpaces===t.insertSpaces&&o.tabSize===t.tabSize&&o.indentSize===t.indentSize&&o.trimAutoWhitespace===t.trimAutoWhitespace&&Qi(o.bracketPairColorizationOptions,t.bracketPairColorizationOptions))&&(t.detectIndentation?(e.detectIndentation(t.insertSpaces,t.tabSize),e.updateOptions({trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions})):e.updateOptions({insertSpaces:t.insertSpaces,tabSize:t.tabSize,indentSize:t.indentSize,trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions}))}_insertDisposedModel(e){this._disposedModels.set(Xte(e.uri),e),this._disposedModelsHeapSize+=e.heapSize}_removeDisposedModel(e){let t=this._disposedModels.get(Xte(e));return t&&(this._disposedModelsHeapSize-=t.heapSize),this._disposedModels.delete(Xte(e)),t}_ensureDisposedModelsHeapSize(e){if(this._disposedModelsHeapSize>e){let t=[];for(this._disposedModels.forEach(o=>{o.sharesUndoRedoStack||t.push(o)}),t.sort((o,n)=>o.time-n.time);t.length>0&&this._disposedModelsHeapSize>e;){let o=t.shift();this._removeDisposedModel(o.uri),o.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(o.initialUndoRedoSnapshot)}}}_createModelData(e,t,o,n){let r=this.getCreationOptions(t,o,n),s=this._instantiationService.createInstance(Tp,e,t,r,o);if(o&&this._disposedModels.has(Xte(o))){let u=this._removeDisposedModel(o),p=this._undoRedoService.getElements(o),h=this._getSHA1Computer(),g=h.canComputeSHA1(s)?h.computeSHA1(s)===u.sha1:!1;if(g||u.sharesUndoRedoStack){for(let f of p.past)hK(f)&&f.matchesResource(o)&&f.setModel(s);for(let f of p.future)hK(f)&&f.matchesResource(o)&&f.setModel(s);this._undoRedoService.setElementsValidFlag(o,!0,f=>hK(f)&&f.matchesResource(o)),g&&(s._overwriteVersionId(u.versionId),s._overwriteAlternativeVersionId(u.alternativeVersionId),s._overwriteInitialUndoRedoSnapshot(u.initialUndoRedoSnapshot))}else u.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(u.initialUndoRedoSnapshot)}let l=Xte(s.uri);if(this._models[l])throw new Error("ModelService: Cannot add model because it already exists!");let c=new x_i(s,u=>this._onWillDispose(u),(u,p)=>this._onDidChangeLanguage(u,p));return this._models[l]=c,c}updateModel(e,t,o=sd.unknown({name:"updateModel"})){let n=this.getCreationOptions(e.getLanguageId(),e.uri,e.isForSimpleWidget),{textBuffer:r,disposable:s}=xK(t,n.defaultEOL);if(e.equalsTextBuffer(r)){s.dispose();return}e.pushStackElement(),e.pushEOL(r.getEOL()===`\r
`?1:0),e.pushEditOperations([],PW._computeEdits(e,r),()=>[],void 0,o),e.pushStackElement(),s.dispose()}static _commonPrefix(e,t,o,n,r,s){let l=Math.min(t,r),c=0;for(let u=0;u<l&&e.getLineContent(o+u)===n.getLineContent(s+u);u++)c++;return c}static _commonSuffix(e,t,o,n,r,s){let l=Math.min(t,r),c=0;for(let u=0;u<l&&e.getLineContent(o+t-u)===n.getLineContent(s+r-u);u++)c++;return c}static _computeEdits(e,t){let o=e.getLineCount(),n=t.getLineCount(),r=this._commonPrefix(e,o,1,t,n,1);if(o===n&&r===o)return[];let s=this._commonSuffix(e,o-r,r,t,n-r,r),l,c;return s>0?(l=new G(r+1,1,o-s+1,1),c=new G(r+1,1,n-s+1,1)):r>0?(l=new G(r,e.getLineMaxColumn(r),o,e.getLineMaxColumn(o)),c=new G(r,1+t.getLineLength(r),n,1+t.getLineLength(n))):(l=new G(1,1,o,e.getLineMaxColumn(o)),c=new G(1,1,n,1+t.getLineLength(n))),[Qn.replaceMove(l,t.getValueInRange(c,0))]}createModel(e,t,o,n=!1){let r;return t?r=this._createModelData(e,t,o,n):r=this._createModelData(e,es,o,n),this._onModelAdded.fire(r.model),r.model}destroyModel(e){let t=this._models[Xte(e)];t&&t.model.dispose()}getModels(){let e=[],t=Object.keys(this._models);for(let o=0,n=t.length;o<n;o++){let r=t[o];e.push(this._models[r].model)}return e}getModel(e){let t=Xte(e),o=this._models[t];return o?o.model:null}_schemaShouldMaintainUndoRedoElements(e){return e.scheme===Q.file||e.scheme===Q.vscodeRemote||e.scheme===Q.vscodeUserData||e.scheme===Q.vscodeNotebookCell||e.scheme==="fake-fs"}_onWillDispose(e){let t=Xte(e.uri),o=this._models[t],n=this._undoRedoService.getUriComparisonKey(e.uri)!==e.uri.toString(),r=!1,s=0;if(n||this._shouldRestoreUndoStack()&&this._schemaShouldMaintainUndoRedoElements(e.uri)){let u=this._undoRedoService.getElements(e.uri);if(u.past.length>0||u.future.length>0){for(let p of u.past)hK(p)&&p.matchesResource(e.uri)&&(r=!0,s+=p.heapSize(e.uri),p.setModel(e.uri));for(let p of u.future)hK(p)&&p.matchesResource(e.uri)&&(r=!0,s+=p.heapSize(e.uri),p.setModel(e.uri))}}let l=PW.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK,c=this._getSHA1Computer();if(r)if(!n&&(s>l||!c.canComputeSHA1(e))){let u=o.model.getInitialUndoRedoSnapshot();u!==null&&this._undoRedoService.restoreSnapshot(u)}else this._ensureDisposedModelsHeapSize(l-s),this._undoRedoService.setElementsValidFlag(e.uri,!1,u=>hK(u)&&u.matchesResource(e.uri)),this._insertDisposedModel(new k_i(e.uri,o.model.getInitialUndoRedoSnapshot(),Date.now(),n,s,c.computeSHA1(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!n){let u=o.model.getInitialUndoRedoSnapshot();u!==null&&this._undoRedoService.restoreSnapshot(u)}delete this._models[t],o.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageId()+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){let o=t.oldLanguage,n=e.getLanguageId(),r=this.getCreationOptions(o,e.uri,e.isForSimpleWidget),s=this.getCreationOptions(n,e.uri,e.isForSimpleWidget);PW._setModelOptionsForModel(e,s,r),this._onModelModeChanged.fire({model:e,oldLanguageId:o})}_getSHA1Computer(){return new Xhe}};PW=I([m(0,B),m(1,BL),m(2,wl),m(3,F)],PW);var Xhe=class a{static{this.MAX_MODEL_SIZE=10*1024*1024}canComputeSHA1(i){return i.getValueLength()<=a.MAX_MODEL_SIZE}computeSHA1(i){let e=new wI,t=i.createSnapshot(),o;for(;o=t.read();)e.update(o);return e.digest()}};var Ait=class extends PW{constructor(e,t,o,n,r){super(e,t,o,r);this._pathService=n}_schemaShouldMaintainUndoRedoElements(e){return super._schemaShouldMaintainUndoRedoElements(e)||e.scheme===this._pathService.defaultUriScheme}};Ait=I([m(0,B),m(1,BL),m(2,wl),m(3,Pn),m(4,F)],Ait);Ce(_t,Ait,1);var Nit=class extends k{constructor(e,t,o){super();this._instantiationService=e;this._extensionService=t;this._logService=o;this._extensionHostIsReady=!1;this._onWillExecuteCommand=this._register(new T);this.onWillExecuteCommand=this._onWillExecuteCommand.event;this._onDidExecuteCommand=this._register(new T);this.onDidExecuteCommand=this._onDidExecuteCommand.event;this._extensionService.whenInstalledExtensionsRegistered().then(n=>this._extensionHostIsReady=n),this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Hle([this._extensionService.activateByEvent("*"),Li(3e4)])),h8i(this._starActivation)}async executeCommand(e,...t){this._logService.trace("CommandService#executeCommand",e);let o=`onCommand:${e}`;return Ge.getCommand(e)?this._extensionService.activationEventIsDone(o)?this._tryExecuteCommand(e,t):this._extensionHostIsReady?(await this._extensionService.activateByEvent(o),this._tryExecuteCommand(e,t)):(this._extensionService.activateByEvent(o),this._tryExecuteCommand(e,t)):(await Promise.all([this._extensionService.activateByEvent(o),Hle([this._activateStar(),U.toPromise(U.filter(Ge.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))}_tryExecuteCommand(e,t){let o=Ge.getCommand(e);if(!o)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this._instantiationService.invokeFunction(o.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}dispose(){super.dispose(),this._starActivation?.cancel()}};Nit=I([m(0,F),m(1,lt),m(2,re)],Nit);Ce(fe,Nit,1);var E_i={};function fw(a,i){let e=E_i[a];e||(E_i[a]=e=[]),e.push(i)}function T_i(a,i){for(let e of a)if(i.textMateRules.push(e),!e.scope){let t=e.settings;if(!t)e.settings={};else for(let o in t){let n=o,r=E_i[n];if(r){let s=t[n];if(typeof s=="string"){let l=Ue.fromHex(s);for(let c of r)i.colors[c]=l}}n!=="foreground"&&n!=="background"&&n!=="fontStyle"&&delete t[n]}}}fw("background",Bo);fw("foreground",Vd);fw("selection",qv);fw("inactiveSelection",q9i);fw("selectionHighlightColor",ACe);fw("findMatchHighlight",NS);fw("currentFindMatchHighlight",Uce);fw("hoverHighlight",qIt);fw("wordHighlight","editor.wordHighlightBackground");fw("wordHighlightStrong","editor.wordHighlightStrongBackground");fw("findRangeHighlight",Q9i);fw("findMatchHighlight","peekViewResult.matchHighlightBackground");fw("referenceHighlight","peekViewEditor.matchHighlightBackground");fw("lineHighlight",fxe);fw("rangeHighlight",AYi);fw("caret",bX);fw("invisibles",vxe);fw("guide",lwt);fw("activeGuide",cwt);var Von=["ansiBlack","ansiRed","ansiGreen","ansiYellow","ansiBlue","ansiMagenta","ansiCyan","ansiWhite","ansiBrightBlack","ansiBrightRed","ansiBrightGreen","ansiBrightYellow","ansiBrightBlue","ansiBrightMagenta","ansiBrightCyan","ansiBrightWhite"];for(let a of Von)fw(a,"terminal."+a);function vvo(a){return Bon(a,null,null)}function Bon(a,i,e){let t=a.length,o=0,n=1,r=0;t>0&&a.charCodeAt(0)===65279&&(o=1);function s(Te){if(e===null)o=o+Te;else for(;Te>0;)a.charCodeAt(o)===10?(o++,n++,r=0):(o++,r++),Te--}function l(Te){e===null?o=Te:s(Te-o)}function c(){for(;o<t;){let Te=a.charCodeAt(o);if(Te!==32&&Te!==9&&Te!==13&&Te!==10)break;s(1)}}function u(Te){return a.substr(o,Te.length)===Te?(s(Te.length),!0):!1}function p(Te){let It=a.indexOf(Te,o);l(It!==-1?It+Te.length:t)}function h(Te){let It=a.indexOf(Te,o);if(It!==-1){let tt=a.substring(o,It);return l(It+Te.length),tt}else{let tt=a.substr(o);return l(t),tt}}let g=0,f=null,v=[],b=[],S=null;function y(Te,It){v.push(g),b.push(f),g=Te,f=It}function w(){if(v.length===0)return x("illegal state stack");g=v.pop(),f=b.pop()}function x(Te){throw new Error("Near offset "+o+": "+Te+" ~~~"+a.substr(o,50)+"~~~")}let E={enterDict:function(){if(S===null)return x("missing <key>");let Te={};e!==null&&(Te[e]={filename:i,line:n,char:r}),f[S]=Te,S=null,y(1,Te)},enterArray:function(){if(S===null)return x("missing <key>");let Te=[];f[S]=Te,S=null,y(2,Te)}},M={enterDict:function(){let Te={};e!==null&&(Te[e]={filename:i,line:n,char:r}),f.push(Te),y(1,Te)},enterArray:function(){let Te=[];f.push(Te),y(2,Te)}};function N(){g===1?E.enterDict():g===2?M.enterDict():(f={},e!==null&&(f[e]={filename:i,line:n,char:r}),y(1,f))}function V(){if(g===1)w();else return x("unexpected </dict>")}function H(){g===1?E.enterArray():g===2?M.enterArray():(f=[],y(2,f))}function K(){if(g===1)return x("unexpected </array>");if(g===2)w();else return x("unexpected </array>")}function j(Te){if(g===1){if(S!==null)return x("too many <key>");S=Te}else return x("unexpected <key>")}function J(Te){if(g===1){if(S===null)return x("missing <key>");f[S]=Te,S=null}else g===2?f.push(Te):f=Te}function se(Te){if(isNaN(Te))return x("cannot parse float");if(g===1){if(S===null)return x("missing <key>");f[S]=Te,S=null}else g===2?f.push(Te):f=Te}function ae(Te){if(isNaN(Te))return x("cannot parse integer");if(g===1){if(S===null)return x("missing <key>");f[S]=Te,S=null}else g===2?f.push(Te):f=Te}function ce(Te){if(g===1){if(S===null)return x("missing <key>");f[S]=Te,S=null}else g===2?f.push(Te):f=Te}function Se(Te){if(g===1){if(S===null)return x("missing <key>");f[S]=Te,S=null}else g===2?f.push(Te):f=Te}function Re(Te){if(g===1){if(S===null)return x("missing <key>");f[S]=Te,S=null}else g===2?f.push(Te):f=Te}function xe(Te){return Te.replace(/&#([0-9]+);/g,function(It,tt){return String.fromCodePoint(parseInt(tt,10))}).replace(/&#x([0-9a-f]+);/g,function(It,tt){return String.fromCodePoint(parseInt(tt,16))}).replace(/&amp;|&lt;|&gt;|&quot;|&apos;/g,function(It){switch(It){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&apos;":return"'"}return It})}function He(){let Te=h(">"),It=!1;return Te.charCodeAt(Te.length-1)===47&&(It=!0,Te=Te.substring(0,Te.length-1)),{name:Te.trim(),isClosed:It}}function Ee(Te){if(Te.isClosed)return"";let It=h("</");return p(">"),xe(It)}for(;o<t&&(c(),!(o>=t));){let Te=a.charCodeAt(o);if(s(1),Te!==60)return x("expected <");if(o>=t)return x("unexpected end of input");let It=a.charCodeAt(o);if(It===63){s(1),p("?>");continue}if(It===33){if(s(1),u("--")){p("-->");continue}p(">");continue}if(It===47){if(s(1),c(),u("plist")){p(">");continue}if(u("dict")){p(">"),V();continue}if(u("array")){p(">"),K();continue}return x("unexpected closed tag")}let tt=He();switch(tt.name){case"dict":N(),tt.isClosed&&V();continue;case"array":H(),tt.isClosed&&K();continue;case"key":j(Ee(tt));continue;case"string":J(Ee(tt));continue;case"real":se(parseFloat(Ee(tt)));continue;case"integer":ae(parseInt(Ee(tt),10));continue;case"date":ce(new Date(Ee(tt)));continue;case"data":Se(Ee(tt));continue;case"true":Ee(tt),Re(!0);continue;case"false":Ee(tt),Re(!1);continue}if(!/^plist/.test(tt.name))return x("unexpected opened tag "+tt.name)}return f}function __i(a,i,e){let t=Hon(a),o=t.next();for(;o!==null;){let l=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=t.next()}let c=r();if(c&&e.push({matcher:c,priority:l}),o!==",")break;o=t.next()}function n(){if(o==="-"){o=t.next();let l=n();return l?c=>l(c)<0?0:-1:null}if(o==="("){o=t.next();let l=s();return o===")"&&(o=t.next()),l}if(bvo(o)){let l=[];do l.push(o),o=t.next();while(bvo(o));return c=>i(l,c)}return null}function r(){let l=n();if(!l)return null;let c=[];for(;l;)c.push(l),l=n();return u=>{let p=c[0](u);for(let h=1;p>=0&&h<c.length;h++)p=Math.min(p,c[h](u));return p}}function s(){let l=r();if(!l)return null;let c=[];for(;l&&(c.push(l),o==="|"||o===",");){do o=t.next();while(o==="|"||o===",");l=r()}return u=>{let p=c[0](u);for(let h=1;h<c.length;h++)p=Math.max(p,c[h](u));return p}}}function bvo(a){return!!a&&!!a.match(/[\w\.:]+/)}function Hon(a){let i=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,e=i.exec(a);return{next:()=>{if(!e)return null;let t=e[0];return e=i.exec(a),t}}}var Uon=oe.as(Fce.ColorContribution),qUt=VRt(),Svo={comments:["comment","punctuation.definition.comment"],strings:["string","meta.embedded.assembly"],keywords:["keyword - keyword.operator","keyword.control","storage","storage.type"],numbers:["constant.numeric"],types:["entity.name.type","entity.name.class","support.type","support.class"],functions:["entity.name.function","support.function"],variables:["variable","entity.name.variable"]},Z8=class a{constructor(i,e,t){this.themeTokenColors=[];this.customTokenColors=[];this.colorMap={};this.customColorMap={};this.semanticTokenRules=[];this.customSemanticTokenRules=[];this.textMateThemingRules=void 0;this.tokenColorIndex=void 0;this.tokenFontIndex=void 0;this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1}static{this.STORAGE_KEY="colorThemeData"}get semanticHighlighting(){return this.customSemanticHighlighting!==void 0?this.customSemanticHighlighting:this.customSemanticHighlightingDeprecated!==void 0?this.customSemanticHighlightingDeprecated:!!this.themeSemanticHighlighting}get tokenColors(){if(!this.textMateThemingRules){let n=function(r){if(r.scope&&r.settings){r.scope==="token.info-token"&&(o=!0);let s=r.settings;i.push({scope:r.scope,settings:{foreground:nAe(s.foreground),background:nAe(s.background),fontStyle:s.fontStyle,fontSize:s.fontSize,fontFamily:s.fontFamily,lineHeight:s.lineHeight}})}},i=[],e=this.getColor(Vd)||this.getDefault(Vd),t=this.getColor(Bo)||this.getDefault(Bo);i.push({settings:{foreground:nAe(e),background:nAe(t)}});let o=!1;this.themeTokenColors.forEach(n),this.customTokenColors.forEach(n),o||Kon[this.type].forEach(n),this.textMateThemingRules=i}return this.textMateThemingRules}getColor(i,e){let t=this.customColorMap[i];if(t instanceof Ue)return t;if(t===void 0){let o=this.colorMap[i];if(o!==void 0)return o}if(e!==!1)return this.getDefault(i)}getTokenStyle(i,e,t,o=!0,n={}){let r={foreground:void 0,bold:void 0,underline:void 0,strikethrough:void 0,italic:void 0},s={foreground:-1,bold:-1,underline:-1,strikethrough:-1,italic:-1,fontFamily:-1,fontSize:-1,lineHeight:-1};function l(p,h,g){h.foreground&&s.foreground<=p&&(s.foreground=p,r.foreground=h.foreground,n.foreground=g);for(let f of["bold","underline","strikethrough","italic"]){let v=f,b=h[v];b!==void 0&&s[v]<=p&&(s[v]=p,r[v]=b,n[v]=g)}}function c(p){let h=p.selector.match(i,e,t);h>=0&&l(h,p.style,p)}this.semanticTokenRules.forEach(c),this.customSemanticTokenRules.forEach(c);let u=!1;for(let p in s){let h=p;s[h]===-1?u=!0:s[h]=Number.MAX_VALUE}if(u)for(let p of qUt.getTokenStylingDefaultRules()){let h=p.selector.match(i,e,t);if(h>=0){let g;if(p.defaults.scopesToProbe&&(g=this.resolveScopes(p.defaults.scopesToProbe),g&&l(h,g,p.defaults.scopesToProbe)),!g&&o!==!1){let f=p.defaults[this.type];g=this.resolveTokenStyleValue(f),g&&l(h,g,f)}}}return qA.fromData(r)}resolveTokenStyleValue(i){if(i!==void 0){if(typeof i=="string"){let{type:e,modifiers:t,language:o}=FRt(i,"");return this.getTokenStyle(e,t,o)}else if(typeof i=="object")return i}}getTokenColorIndex(){if(!this.tokenColorIndex){let i=new D_i;this.tokenColors.forEach(e=>{i.add(e.settings.foreground),i.add(e.settings.background)}),this.semanticTokenRules.forEach(e=>i.add(e.style.foreground)),qUt.getTokenStylingDefaultRules().forEach(e=>{let t=e.defaults[this.type];t&&typeof t=="object"&&i.add(t.foreground)}),this.customSemanticTokenRules.forEach(e=>i.add(e.style.foreground)),this.tokenColorIndex=i}return this.tokenColorIndex}getTokenFontIndex(){if(!this.tokenFontIndex){let i=new R_i;this.tokenColors.forEach(e=>i.add(e.settings.fontFamily,e.settings.fontSize,e.settings.lineHeight)),this.tokenFontIndex=i}return this.tokenFontIndex}get tokenColorMap(){return this.getTokenColorIndex().asArray()}get tokenFontMap(){return this.getTokenFontIndex().asArray()}getTokenStyleMetadata(i,e,t,o=!0,n={}){let{type:r,language:s}=FRt(i,t),l=this.getTokenStyle(r,e,s,o,n);if(l)return{foreground:this.getTokenColorIndex().get(l.foreground),bold:l.bold,underline:l.underline,strikethrough:l.strikethrough,italic:l.italic}}getTokenStylingRuleScope(i){if(this.customSemanticTokenRules.indexOf(i)!==-1)return"setting";if(this.semanticTokenRules.indexOf(i)!==-1)return"theme"}getDefault(i){return Uon.resolveDefaultColor(i,this)}resolveScopes(i,e){this.themeTokenScopeMatchers||(this.themeTokenScopeMatchers=this.themeTokenColors.map(Cvo)),this.customTokenScopeMatchers||(this.customTokenScopeMatchers=this.customTokenColors.map(Cvo));for(let t of i){let u=function(p,h){for(let g=0;g<p.length;g++){let f=p[g](t);if(f>=0){let v=h[g],b=h[g].settings;f>=r&&b.foreground&&(o=b.foreground,r=f,c=v),f>=s&&We(b.fontStyle)&&(n=b.fontStyle,s=f,l=v)}}},o,n,r=-1,s=-1,l,c;if(u(this.themeTokenScopeMatchers,this.themeTokenColors),u(this.customTokenScopeMatchers,this.customTokenColors),o!==void 0||n!==void 0)return e&&(e.foreground=c,e.bold=e.italic=e.underline=e.strikethrough=l,e.scope=t),qA.fromSettings(o,n)}}defines(i){let e=this.customColorMap[i];return e instanceof Ue?!0:e===void 0&&this.colorMap.hasOwnProperty(i)}setCustomizations(i){this.setCustomColors(i.colorCustomizations),this.setCustomTokenColors(i.tokenColorCustomizations),this.setCustomSemanticTokenColors(i.semanticTokenColorCustomizations)}setCustomColors(i){this.customColorMap={},this.overwriteCustomColors(i);let e=this.getThemeSpecificColors(i);Di(e)&&this.overwriteCustomColors(e),this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.customTokenScopeMatchers=void 0}overwriteCustomColors(i){for(let e in i){let t=i[e];t===D3e?this.customColorMap[e]=D3e:typeof t=="string"&&(this.customColorMap[e]=Ue.fromHex(t))}}setCustomTokenColors(i){this.customTokenColors=[],this.customSemanticHighlightingDeprecated=void 0,this.addCustomTokenColors(i);let e=this.getThemeSpecificColors(i);Di(e)&&this.addCustomTokenColors(e),this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.customTokenScopeMatchers=void 0}setCustomSemanticTokenColors(i){if(this.customSemanticTokenRules=[],this.customSemanticHighlighting=void 0,i){this.customSemanticHighlighting=i.enabled,i.rules&&this.readSemanticTokenRules(i.rules);let e=this.getThemeSpecificColors(i);Di(e)&&(e.enabled!==void 0&&(this.customSemanticHighlighting=e.enabled),e.rules&&this.readSemanticTokenRules(e.rules))}this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0}isThemeScope(i){return i.charAt(0)===Iso&&i.charAt(i.length-1)===yso}isThemeScopeMatch(i){let e=i.charAt(0),t=i.charAt(i.length-1),o=i.slice(0,-1),n=i.slice(1,-1),r=i.slice(1);return i===this.settingsId||this.settingsId.includes(n)&&e===sYe&&t===sYe||this.settingsId.startsWith(o)&&t===sYe||this.settingsId.endsWith(r)&&e===sYe}getThemeSpecificColors(i){let e;for(let t in i){let o=i[t];if(this.isThemeScope(t)&&o instanceof Object&&!Array.isArray(o)){let n=t.match(wso)||[];for(let r of n){let s=r.substring(1,r.length-1);if(this.isThemeScopeMatch(s)){e||(e={});let l=o;for(let c in l){let u=e[c],p=l[c];Array.isArray(u)&&Array.isArray(p)?e[c]=u.concat(p):p&&(e[c]=p)}}}}}return e}readSemanticTokenRules(i){for(let e in i)if(!this.isThemeScope(e))try{let t=kvo(e,i[e]);t&&this.customSemanticTokenRules.push(t)}catch{}}addCustomTokenColors(i){for(let e in Svo){let t=e,o=i[t];if(o){let n=typeof o=="string"?{foreground:o}:o,r=Svo[t];for(let s of r)this.customTokenColors.push({scope:s,settings:n})}}if(Array.isArray(i.textMateRules))for(let e of i.textMateRules)e.scope&&e.settings&&this.customTokenColors.push(e);i.semanticHighlighting!==void 0&&(this.customSemanticHighlightingDeprecated=i.semanticHighlighting)}ensureLoaded(i){return this.isLoaded?Promise.resolve(void 0):this.load(i)}reload(i){return this.load(i)}load(i){if(!this.location)return Promise.resolve(void 0);this.themeTokenColors=[],this.clearCaches();let e={colors:{},textMateRules:[],semanticTokenRules:[],semanticHighlighting:!1};return xvo(i,this.location,e).then(t=>{this.isLoaded=!0,this.semanticTokenRules=e.semanticTokenRules,this.colorMap=e.colors,this.themeTokenColors=e.textMateRules,this.themeSemanticHighlighting=e.semanticHighlighting})}clearCaches(){this.tokenColorIndex=void 0,this.tokenFontIndex=void 0,this.textMateThemingRules=void 0,this.themeTokenScopeMatchers=void 0,this.customTokenScopeMatchers=void 0}toStorage(i){let e={};for(let o in this.colorMap)e[o]=Ue.Format.CSS.formatHexA(this.colorMap[o],!0);let t=JSON.stringify({id:this.id,label:this.label,settingsId:this.settingsId,themeTokenColors:this.themeTokenColors.map(o=>({settings:o.settings,scope:o.scope})),semanticTokenRules:this.semanticTokenRules.map(ZTe.toJSONObject),extensionData:e_.toJSONObject(this.extensionData),themeSemanticHighlighting:this.themeSemanticHighlighting,colorMap:e,watch:this.watch});i.store(a.STORAGE_KEY,t,0,0)}get themeTypeSelector(){return this.classNames[0]}get classNames(){return this.id.split(" ")}get type(){switch(this.themeTypeSelector){case"vs":return"light";case"hc-black":return"hcDark";case"hc-light":return"hcLight";default:return"dark"}}static createUnloadedThemeForThemeType(i,e){return a.createUnloadedTheme(V5(i),e)}static createUnloadedTheme(i,e){let t=new a(i,"","__"+i);if(t.isLoaded=!1,t.themeTokenColors=[],t.watch=!1,e)for(let o in e)t.colorMap[o]=Ue.fromHex(e[o]);return t}static createLoadedEmptyTheme(i,e){let t=new a(i,"",e);return t.isLoaded=!0,t.themeTokenColors=[],t.watch=!1,t}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","","");for(let n in t)switch(n){case"colorMap":{let r=t[n];for(let s in r)o.colorMap[s]=Ue.fromHex(r[s]);break}case"themeTokenColors":case"id":case"label":case"settingsId":case"watch":case"themeSemanticHighlighting":o[n]=t[n];break;case"semanticTokenRules":{let r=t[n];if(Array.isArray(r))for(let s of r){let l=ZTe.fromJSONObject(qUt,s);l&&o.semanticTokenRules.push(l)}break}case"location":break;case"extensionData":o.extensionData=e_.fromJSONObject(t.extensionData);break}return!o.id||!o.settingsId?void 0:o}catch{return}}static fromExtensionTheme(i,e,t){let o=i.uiTheme||"vs-dark",n=zon(t.extensionId,i.path),r=`${o} ${n}`,s=i.label||Jo(i.path),l=i.id||s,c=new a(r,s,l);return c.description=i.description,c.watch=i._watch===!0,c.location=e,c.extensionData=t,c.isLoaded=!1,c}};function zon(a,i){i.startsWith("./")&&(i=i.substr(2));let e=`${a}-${i}`;return e=e.replace(/[^_a-zA-Z0-9-]/g,"-"),e.charAt(0).match(/[0-9-]/)&&(e="_"+e),e}async function xvo(a,i,e){if(Ts(i)===".json"){let t=await a.readExtensionResource(i),o=[],n=is(t,o);if(o.length>0)return Promise.reject(new Error(d(19358,null,o.map(c=>x0(c.error)).join(", "))));if(sE(n)!=="object")return Promise.reject(new Error(d(19359,null)));if(n.include&&await xvo(a,Ve(ai(i),n.include),e),Array.isArray(n.settings))return T_i(n.settings,e),null;e.semanticHighlighting=e.semanticHighlighting||n.semanticHighlighting;let r=n.colors;if(r){if(typeof r!="object")return Promise.reject(new Error(d(19360,null,i.toString())));for(let c in r){let u=r[c];u===D3e?delete e.colors[c]:typeof u=="string"&&(e.colors[c]=Ue.fromHex(r[c]))}}let s=n.tokenColors;if(s)if(Array.isArray(s))e.textMateRules.push(...s);else if(typeof s=="string")await Ivo(a,Ve(ai(i),s),e);else return Promise.reject(new Error(d(19362,null,i.toString())));let l=n.semanticTokenColors;if(l&&typeof l=="object")for(let c in l)try{let u=kvo(c,l[c]);u&&e.semanticTokenRules.push(u)}catch{return Promise.reject(new Error(d(19361,null,i.toString())))}}else return Ivo(a,i,e)}function Ivo(a,i,e){return a.readExtensionResource(i).then(t=>{try{let n=vvo(t).settings;return Array.isArray(n)?(T_i(n,e),Promise.resolve(null)):Promise.reject(new Error(d(19363,null)))}catch(o){return Promise.reject(new Error(d(19357,null,o.message)))}},t=>Promise.reject(new Error(d(19356,null,i.toString(),t.message))))}var Kon={light:[{scope:"token.info-token",settings:{foreground:"#316bcd"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#cd3131"}},{scope:"token.debug-token",settings:{foreground:"#800080"}}],dark:[{scope:"token.info-token",settings:{foreground:"#6796e6"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#f44747"}},{scope:"token.debug-token",settings:{foreground:"#b267e6"}}],hcLight:[{scope:"token.info-token",settings:{foreground:"#316bcd"}},{scope:"token.warn-token",settings:{foreground:"#cd9731"}},{scope:"token.error-token",settings:{foreground:"#cd3131"}},{scope:"token.debug-token",settings:{foreground:"#800080"}}],hcDark:[{scope:"token.info-token",settings:{foreground:"#6796e6"}},{scope:"token.warn-token",settings:{foreground:"#008000"}},{scope:"token.error-token",settings:{foreground:"#FF0000"}},{scope:"token.debug-token",settings:{foreground:"#b267e6"}}]},yvo=a=>-1;function wvo(a,i){if(i.length<a.length)return-1;let e;return a.every(o=>{for(let n=i.length-1;n>=0;n--)if(Gon(i[n],o))return e=(n+1)*65536+o.length,!0;return!1})&&e!==void 0?e:-1}function Gon(a,i){if(!a)return!1;if(a===i)return!0;let e=i.length;return a.length>e&&a.substr(0,e)===i&&a[e]==="."}function Cvo(a){let i=a.scope;if(!i||!a.settings)return yvo;let e=[];if(Array.isArray(i))for(let t of i)__i(t,wvo,e);else __i(i,wvo,e);return e.length===0?yvo:t=>{let o=e[0].matcher(t);for(let n=1;n<e.length;n++)o=Math.max(o,e[n].matcher(t));return o}}function kvo(a,i){let e=qUt.parseTokenSelector(a),t;if(typeof i=="string"?t=qA.fromSettings(i,void 0):qon(i)&&(t=qA.fromSettings(i.foreground,i.fontStyle,i.bold,i.underline,i.strikethrough,i.italic)),t)return{selector:e,style:t}}function qon(a){return a&&(We(a.foreground)||We(a.fontStyle)||Xa(a.italic)||Xa(a.underline)||Xa(a.strikethrough)||Xa(a.bold))}function $Ut(a,i,e,t){let o=0;o|=e<<0;let n={},r=a.resolveScopes([i],n);if(i.length>0){let u=ZXi(i[i.length-1]);o|=u<<8}let s=n.foreground?.settings.fontStyle||n.bold?.settings.fontStyle;s?.includes("italic")&&(o|=2049),s?.includes("bold")&&(o|=4098),s?.includes("underline")&&(o|=8196),s?.includes("strikethrough")&&(o|=16392);let l=r?.foreground,c=l!==void 0?a.getTokenColorIndex().get(l):1;return o|=c<<15,t&&(o|=1024),o}var D_i=class{constructor(){this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null)}add(i){if(i=nAe(i),i===void 0)return 0;let e=this._color2id[i];return e||(e=++this._lastColorId,this._color2id[i]=e,this._id2color[e]=i,e)}get(i){if(i=nAe(i),i===void 0)return 0;let e=this._color2id[i];return e||(console.log(`Color ${i} not in index.`),0)}asArray(){return this._id2color.slice(0)}},R_i=class{constructor(){this._lastFontId=0,this._id2font=[],this._font2id=new Map}add(i,e,t){let o={fontFamily:i,fontSizeMultiplier:e,lineHeightMultiplier:t},n=this._font2id.get(o);return n||(n=++this._lastFontId,this._font2id.set(o,n),this._id2font[n]=o,n)}get(i){let e=this._font2id.get(i);return e||0}asArray(){return this._id2font.slice(0)}};function nAe(a){if(!a)return;typeof a!="string"&&(a=Ue.Format.CSS.formatHexA(a,!0));let i=a.length;if(a.charCodeAt(0)!==35||i!==4&&i!==5&&i!==7&&i!==9)return;let e=[35];for(let t=1;t<i;t++){let o=$on(a.charCodeAt(t));if(!o)return;e.push(o),(i===4||i===5)&&e.push(o)}return e.length===9&&e[7]===70&&e[8]===70&&(e.length=7),String.fromCharCode(...e)}function $on(a){return a>=48&&a<=57||a>=65&&a<=70?a:a>=97&&a<=102?a-97+65:0}var jon="vscode://schemas/icon-theme",Qon={type:"object",allowComments:!0,allowTrailingCommas:!0,definitions:{folderExpanded:{type:"string",description:d(19386,null)},folder:{type:"string",description:d(19385,null)},file:{type:"string",description:d(19380,null)},rootFolder:{type:"string",description:d(19410,null)},rootFolderExpanded:{type:"string",description:d(19411,null)},rootFolderNames:{type:"object",description:d(19413,null),additionalProperties:{type:"string",description:d(19387,null)}},rootFolderNamesExpanded:{type:"object",description:d(19414,null),additionalProperties:{type:"string",description:d(19412,null)}},folderNames:{type:"object",description:d(19389,null),additionalProperties:{type:"string",description:d(19387,null)}},folderNamesExpanded:{type:"object",description:d(19390,null),additionalProperties:{type:"string",description:d(19388,null)}},fileExtensions:{type:"object",description:d(19382,null),additionalProperties:{type:"string",description:d(19381,null)}},fileNames:{type:"object",description:d(19384,null),additionalProperties:{type:"string",description:d(19383,null)}},languageIds:{type:"object",description:d(19408,null),additionalProperties:{type:"string",description:d(19407,null)}},associations:{type:"object",properties:{folderExpanded:{$ref:"#/definitions/folderExpanded"},folder:{$ref:"#/definitions/folder"},file:{$ref:"#/definitions/file"},folderNames:{$ref:"#/definitions/folderNames"},folderNamesExpanded:{$ref:"#/definitions/folderNamesExpanded"},rootFolder:{$ref:"#/definitions/rootFolder"},rootFolderExpanded:{$ref:"#/definitions/rootFolderExpanded"},rootFolderNames:{$ref:"#/definitions/rootFolderNames"},rootFolderNamesExpanded:{$ref:"#/definitions/rootFolderNamesExpanded"},fileExtensions:{$ref:"#/definitions/fileExtensions"},fileNames:{$ref:"#/definitions/fileNames"},languageIds:{$ref:"#/definitions/languageIds"}}}},properties:{fonts:{type:"array",description:d(19399,null),items:{type:"object",properties:{id:{type:"string",description:d(19406,null),pattern:qX.source,patternErrorMessage:Lke},src:{type:"array",description:d(19416,null),items:{type:"object",properties:{path:{type:"string",description:d(19392,null)},format:{type:"string",description:d(19391,null),enum:["woff","woff2","truetype","opentype","embedded-opentype","svg"]}},required:["path","format"]}},weight:{type:"string",description:d(19395,null),pattern:Rke.source},style:{type:"string",description:d(19394,null),pattern:Dke.source},size:{type:"string",description:d(19393,null),pattern:dQe.source}},required:["id","src"]}},iconDefinitions:{type:"object",description:d(19404,null),additionalProperties:{type:"object",description:d(19403,null),properties:{iconPath:{type:"string",description:d(19405,null)},fontCharacter:{type:"string",description:d(19396,null)},fontColor:{type:"string",format:"color-hex",description:d(19397,null),pattern:ckt.source},fontSize:{type:"string",description:d(19400,null),pattern:dQe.source},fontId:{type:"string",description:d(19398,null),pattern:qX.source,patternErrorMessage:Lke}}}},folderExpanded:{$ref:"#/definitions/folderExpanded"},folder:{$ref:"#/definitions/folder"},file:{$ref:"#/definitions/file"},folderNames:{$ref:"#/definitions/folderNames"},folderNamesExpanded:{$ref:"#/definitions/folderNamesExpanded"},rootFolder:{$ref:"#/definitions/rootFolder"},rootFolderExpanded:{$ref:"#/definitions/rootFolderExpanded"},rootFolderNames:{$ref:"#/definitions/rootFolderNames"},rootFolderNamesExpanded:{$ref:"#/definitions/rootFolderNamesExpanded"},fileExtensions:{$ref:"#/definitions/fileExtensions"},fileNames:{$ref:"#/definitions/fileNames"},languageIds:{$ref:"#/definitions/languageIds"},light:{$ref:"#/definitions/associations",description:d(19409,null)},highContrast:{$ref:"#/definitions/associations",description:d(19402,null)},hidesExplorerArrows:{type:"boolean",description:d(19401,null)},showLanguageModeIcons:{type:"boolean",description:d(19415,null)}}};function Evo(){oe.as(Ta.JSONContribution).registerSchema(jon,Qon)}var TU=class a{static{this.STORAGE_KEY="iconThemeData"}constructor(i,e,t){this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1,this.hasFileIcons=!1,this.hasFolderIcons=!1,this.hidesExplorerArrows=!1}ensureLoaded(i){return this.isLoaded?Promise.resolve(this.styleSheetContent):this.load(i)}reload(i){return this.load(i)}load(i){return i.load(this)}static fromExtensionTheme(i,e,t){let o=t.extensionId+"-"+i.id,n=i.label||Jo(i.path),r=i.id,s=new a(o,n,r);return s.description=i.description,s.location=e,s.extensionData=t,s.watch=i._watch,s.isLoaded=!1,s}static{this._noIconTheme=null}static get noIconTheme(){let i=a._noIconTheme;return i||(i=a._noIconTheme=new a("","",null),i.hasFileIcons=!1,i.hasFolderIcons=!1,i.hidesExplorerArrows=!1,i.isLoaded=!0,i.extensionData=void 0,i.watch=!1),i}static createUnloadedTheme(i){let e=new a(i,"","__"+i);return e.isLoaded=!1,e.hasFileIcons=!1,e.hasFolderIcons=!1,e.hidesExplorerArrows=!1,e.extensionData=void 0,e.watch=!1,e}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","",null);for(let n in t)switch(n){case"id":case"label":case"description":case"settingsId":case"styleSheetContent":case"hasFileIcons":case"hidesExplorerArrows":case"hasFolderIcons":case"watch":o[n]=t[n];break;case"location":break;case"extensionData":o.extensionData=e_.fromJSONObject(t.extensionData);break}return o}catch{return}}toStorage(i){let e=JSON.stringify({id:this.id,label:this.label,description:this.description,settingsId:this.settingsId,styleSheetContent:this.styleSheetContent,hasFileIcons:this.hasFileIcons,hasFolderIcons:this.hasFolderIcons,hidesExplorerArrows:this.hidesExplorerArrows,extensionData:e_.toJSONObject(this.extensionData),watch:this.watch});i.store(a.STORAGE_KEY,e,0,1)}},QUt=class{constructor(i,e){this.fileService=i;this.languageService=e}load(i){return i.location?this.loadIconThemeDocument(i.location).then(e=>{let t=this.processIconThemeDocument(i.id,i.location,e);return i.styleSheetContent=t.content,i.hasFileIcons=t.hasFileIcons,i.hasFolderIcons=t.hasFolderIcons,i.hidesExplorerArrows=t.hidesExplorerArrows,i.isLoaded=!0,i.styleSheetContent}):Promise.resolve(i.styleSheetContent)}loadIconThemeDocument(i){return this.fileService.readExtensionResource(i).then(e=>{let t=[],o=is(e,t);return t.length>0?Promise.reject(new Error(d(19316,null,t.map(n=>x0(n.error)).join(", ")))):sE(o)!=="object"?Promise.reject(new Error(d(19317,null))):Promise.resolve(o)})}processIconThemeDocument(i,e,t){let o={content:"",hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!!t.hidesExplorerArrows},n=!1;if(!t.iconDefinitions)return o;let r={},s={},l=ai(e);function c(b){return Ve(l,b)}function u(b,S){function y(w,x){if(x){let E=r[x];E||(E=r[x]=new TD),E.push(w)}}if(b){let w=pa`.show-file-icons`;S&&(w=pa`${S} ${w}`);let x=pa`.monaco-tl-twistie.collapsible:not(.collapsed) + .monaco-tl-contents`;b.folder&&(y(pa`${w} .folder-icon::before`,b.folder),o.hasFolderIcons=!0),b.folderExpanded&&(y(pa`${w} ${x} .folder-icon::before`,b.folderExpanded),o.hasFolderIcons=!0);let E=b.rootFolder||b.folder,M=b.rootFolderExpanded||b.folderExpanded;E&&(y(pa`${w} .rootfolder-icon::before`,E),o.hasFolderIcons=!0),M&&(y(pa`${w} ${x} .rootfolder-icon::before`,M),o.hasFolderIcons=!0),b.file&&(y(pa`${w} .file-icon::before`,b.file),o.hasFileIcons=!0);let N=b.folderNames;if(N)for(let ae in N){let ce=new TD,Se=jUt(ae.toLowerCase(),ce);ce.push(pa`.${tq(Se)}-name-folder-icon`),y(pa`${w} ${ce.join("")}.folder-icon::before`,N[ae]),o.hasFolderIcons=!0}let V=b.folderNamesExpanded;if(V)for(let ae in V){let ce=new TD,Se=jUt(ae.toLowerCase(),ce);ce.push(pa`.${tq(Se)}-name-folder-icon`),y(pa`${w} ${x} ${ce.join("")}.folder-icon::before`,V[ae]),o.hasFolderIcons=!0}let H=b.rootFolderNames;if(H)for(let ae in H){let ce=ae.toLowerCase();y(pa`${w} .${tq(ce)}-root-name-folder-icon.rootfolder-icon::before`,H[ae]),o.hasFolderIcons=!0}let K=b.rootFolderNamesExpanded;if(K)for(let ae in K){let ce=ae.toLowerCase();y(pa`${w} ${x} .${tq(ce)}-root-name-folder-icon.rootfolder-icon::before`,K[ae]),o.hasFolderIcons=!0}let j=b.languageIds;if(j){!j.jsonc&&j.json&&(j.jsonc=j.json);for(let ae in j)y(pa`${w} .${tq(ae)}-lang-file-icon.file-icon::before`,j[ae]),o.hasFileIcons=!0,n=!0,s[ae]=!0}let J=b.fileExtensions;if(J)for(let ae in J){let ce=new TD,Re=jUt(ae.toLowerCase(),ce).split(".");if(Re.length){for(let xe=0;xe<Re.length;xe++)ce.push(pa`.${tq(Re.slice(xe).join("."))}-ext-file-icon`);ce.push(pa`.ext-file-icon`)}y(pa`${w} ${ce.join("")}.file-icon::before`,J[ae]),o.hasFileIcons=!0,n=!0}let se=b.fileNames;if(se)for(let ae in se){let ce=new TD,Se=jUt(ae.toLowerCase(),ce);ce.push(pa`.${tq(Se)}-name-file-icon`),ce.push(pa`.name-file-icon`);let Re=Se.split(".");if(Re.length){for(let xe=1;xe<Re.length;xe++)ce.push(pa`.${tq(Re.slice(xe).join("."))}-ext-file-icon`);ce.push(pa`.ext-file-icon`)}y(pa`${w} ${ce.join("")}.file-icon::before`,se[ae]),o.hasFileIcons=!0,n=!0}}}if(u(t),u(t.light,pa`.vs`),u(t.highContrast,pa`.hc-black`),u(t.highContrast,pa`.hc-light`),!o.hasFileIcons&&!o.hasFolderIcons)return o;let p=t.showLanguageModeIcons===!0||n&&t.showLanguageModeIcons!==!1,h=new TD,g=t.fonts,f=new Map;if(Array.isArray(g)){let b=this.tryNormalizeFontSize(g[0].size)||"150%";g.forEach(S=>{let y=new TD;y.push(...S.src.map(x=>pa`${cl(c(x.path))} format(${FI(x.format)})`)),h.push(pa`@font-face { src: ${y.join(", ")}; font-family: ${FI(S.id)}; font-weight: ${pke(S.weight)}; font-style: ${pke(S.style)}; font-display: block; }`);let w=this.tryNormalizeFontSize(S.size);w!==void 0&&w!==b&&f.set(S.id,w)}),h.push(pa`.show-file-icons .file-icon::before, .show-file-icons .folder-icon::before, .show-file-icons .rootfolder-icon::before { font-family: ${FI(g[0].id)}; font-size: ${lci(b)}; }`)}let v=FI("\\2001");for(let b in r){let S=r[b],y=t.iconDefinitions[b];if(y){if(y.iconPath)h.push(pa`${S.join(", ")} { content: ${v}; background-image: ${cl(c(y.iconPath))}; }`);else if(y.fontCharacter||y.fontColor){let w=new TD;y.fontColor&&y.fontColor.match(ckt)&&w.push(pa`color: ${yJi(y.fontColor)};`),y.fontCharacter&&w.push(pa`content: ${FI(y.fontCharacter)};`);let x=y.fontSize??(y.fontId?f.get(y.fontId):void 0);x&&x.match(dQe)&&w.push(pa`font-size: ${lci(x)};`),y.fontId&&w.push(pa`font-family: ${FI(y.fontId)};`),p&&w.push(pa`background-image: unset;`),h.push(pa`${S.join(", ")} { ${w.join(" ")} }`)}}}if(p){for(let b of this.languageService.getRegisteredLanguageIds())if(!s[b]){let S=this.languageService.getIcon(b);if(S){let y=pa`.show-file-icons .${tq(b)}-lang-file-icon.file-icon::before`;h.push(pa`${y} { content: ${v}; background-image: ${cl(S.dark)}; }`),h.push(pa`.vs ${y} { content: ${v}; background-image: ${cl(S.light)}; }`)}}}return o.content=h.join(`
`),o}tryNormalizeFontSize(i){if(!i)return;let e=13;if(i.endsWith("px")){let t=parseInt(i,10);if(!isNaN(t))return Math.round(t/e*100)+"%"}return i}};function jUt(a,i){let e=a.lastIndexOf("/");if(e>=0){let t=a.substring(0,e);return i.push(pa`.${tq(t)}-name-dir-icon`),a.substring(e+1)}return a}function tq(a){return a=Oue(a),_K(a,!0)}var Tvo=["comment","comment.block","comment.block.documentation","comment.line","constant","constant.character","constant.character.escape","constant.numeric","constant.numeric.integer","constant.numeric.float","constant.numeric.hex","constant.numeric.octal","constant.other","constant.regexp","constant.rgb-value","emphasis","entity","entity.name","entity.name.class","entity.name.function","entity.name.method","entity.name.section","entity.name.selector","entity.name.tag","entity.name.type","entity.other","entity.other.attribute-name","entity.other.inherited-class","invalid","invalid.deprecated","invalid.illegal","keyword","keyword.control","keyword.operator","keyword.operator.new","keyword.operator.assignment","keyword.operator.arithmetic","keyword.operator.logical","keyword.other","markup","markup.bold","markup.changed","markup.deleted","markup.heading","markup.inline.raw","markup.inserted","markup.italic","markup.list","markup.list.numbered","markup.list.unnumbered","markup.other","markup.quote","markup.raw","markup.underline","markup.underline.link","meta","meta.block","meta.cast","meta.class","meta.function","meta.function-call","meta.preprocessor","meta.return-type","meta.selector","meta.tag","meta.type.annotation","meta.type","punctuation.definition.string.begin","punctuation.definition.string.end","punctuation.separator","punctuation.separator.continuation","punctuation.terminator","storage","storage.modifier","storage.type","string","string.interpolated","string.other","string.quoted","string.quoted.double","string.quoted.other","string.quoted.single","string.quoted.triple","string.regexp","string.unquoted","strong","support","support.class","support.constant","support.function","support.other","support.type","support.type.property-name","support.variable","variable","variable.language","variable.name","variable.other","variable.other.readwrite","variable.parameter"],Oit="vscode://schemas/textmate-colors",_vo=`${Oit}#/definitions/colorGroup`,Yon={type:"array",definitions:{colorGroup:{default:"#FF0000",anyOf:[{type:"string",format:"color-hex"},{$ref:"#/definitions/settings"}]},settings:{type:"object",description:d(19377,null),properties:{foreground:{type:"string",description:d(19375,null),format:"color-hex",default:"#ff0000"},background:{type:"string",deprecationMessage:d(19370,null)},fontStyle:{type:"string",description:d(19373,null),pattern:"^(\\s*\\b(italic|bold|underline|strikethrough))*\\s*$",patternErrorMessage:d(19365,null),defaultSnippets:[{label:d(19374,null),bodyText:'""'},{body:"italic"},{body:"bold"},{body:"underline"},{body:"strikethrough"},{body:"italic bold"},{body:"italic underline"},{body:"italic strikethrough"},{body:"bold underline"},{body:"bold strikethrough"},{body:"underline strikethrough"},{body:"italic bold underline"},{body:"italic bold strikethrough"},{body:"italic underline strikethrough"},{body:"bold underline strikethrough"},{body:"italic bold underline strikethrough"}]},fontFamily:{type:"string",description:d(19371,null)},fontSize:{type:"number",description:d(19372,null)},lineHeight:{type:"number",description:d(19376,null)}},additionalProperties:!1,defaultSnippets:[{body:{foreground:"${1:#FF0000}",fontStyle:"${2:bold}"}}]}},items:{type:"object",defaultSnippets:[{body:{scope:"${1:keyword.operator}",settings:{foreground:"${2:#FF0000}"}}}],properties:{name:{type:"string",description:d(19366,null)},scope:{description:d(19367,null),anyOf:[{enum:Tvo},{type:"string"},{type:"array",items:{enum:Tvo}},{type:"array",items:{type:"string"}}]},settings:{$ref:"#/definitions/settings"}},required:["settings"],additionalProperties:!1}},L_i="vscode://schemas/color-theme",Xon={type:"object",allowComments:!0,allowTrailingCommas:!0,properties:{colors:{description:d(19379,null),$ref:Bce,additionalProperties:!1},tokenColors:{anyOf:[{type:"string",description:d(19378,null)},{description:d(19364,null),$ref:Oit}]},semanticHighlighting:{type:"boolean",description:d(19369,null)},semanticTokenColors:{type:"object",description:d(19368,null),$ref:e_e}}};function Dvo(){let a=oe.as(Ta.JSONContribution);a.registerSchema(L_i,Xon),a.registerSchema(Oit,Yon)}function Rvo(){return zn.registerExtensionPoint({extensionPoint:"themes",jsonSchema:{description:d(19485,null),type:"array",items:{type:"object",defaultSnippets:[{body:{label:"${1:label}",id:"${2:id}",uiTheme:"vs-dark",path:"./themes/${3:id}.tmTheme."}}],properties:{id:{description:d(19486,null),type:"string"},label:{description:d(19487,null),type:"string"},uiTheme:{markdownDescription:d(19489,null),enum:["vs","vs-dark","hc-black","hc-light"]},path:{markdownDescription:d(19488,null),type:"string"}},required:["path","uiTheme"]}}})}function Lvo(){return zn.registerExtensionPoint({extensionPoint:"iconThemes",jsonSchema:{description:d(19477,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:id}",label:"${2:label}",path:"./fileicons/${3:id}-icon-theme.json"}}],properties:{id:{description:d(19478,null),type:"string"},label:{description:d(19479,null),type:"string"},path:{description:d(19480,null),type:"string"}},required:["path","id"]}}})}function Mvo(){return zn.registerExtensionPoint({extensionPoint:"productIconThemes",jsonSchema:{description:d(19481,null),type:"array",items:{type:"object",defaultSnippets:[{body:{id:"${1:id}",label:"${2:label}",path:"./producticons/${3:id}-product-icon-theme.json"}}],properties:{id:{description:d(19482,null),type:"string"},label:{description:d(19483,null),type:"string"},path:{description:d(19484,null),type:"string"}},required:["path","id"]}}})}var M_i=class extends k{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.contributes?.themes||!!e.contributes?.iconThemes||!!e.contributes?.productIconThemes}render(e){let t=new he;if(e.contributes?.themes){t.appendMarkdown(`### ${d(19469,null)}

`);for(let o of e.contributes.themes)t.appendMarkdown(`- ${o.label}
`)}if(e.contributes?.iconThemes){t.appendMarkdown(`### ${d(19470,null)}

`);for(let o of e.contributes.iconThemes)t.appendMarkdown(`- ${o.label}
`)}if(e.contributes?.productIconThemes){t.appendMarkdown(`### ${d(19472,null)}

`);for(let o of e.contributes.productIconThemes)t.appendMarkdown(`- ${o.label}
`)}return{data:t,dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"themes",label:d(19476,null),access:{canToggle:!1},renderer:new Vt(M_i)});var rAe=class{constructor(i,e,t=!1,o=void 0){this.themesExtPoint=i;this.create=e;this.idRequired=t;this.builtInTheme=o;this.onDidChangeEmitter=new T;this.onDidChange=this.onDidChangeEmitter.event;this.extensionThemes=[],this.initialize()}dispose(){this.themesExtPoint.setHandler(()=>{}),this.onDidChangeEmitter.dispose()}initialize(){this.themesExtPoint.setHandler((i,e)=>{let t={},o=[];for(let r of this.extensionThemes)t[r.id]=r;this.extensionThemes.length=0;for(let r of i){let s=e_.fromName(r.description.publisher,r.description.name,r.description.isBuiltin);this.onThemes(s,r.description.extensionLocation,r.value,this.extensionThemes,r.collector)}for(let r of this.extensionThemes)t[r.id]?delete t[r.id]:o.push(r);let n=Object.values(t);this.onDidChangeEmitter.fire({themes:this.extensionThemes,added:o,removed:n})})}onThemes(i,e,t,o=[],n){return Array.isArray(t)?(t.forEach(r=>{if(!r.path||!We(r.path)){n?.error(d(19475,null,this.themesExtPoint.name,String(r.path)));return}if(this.idRequired&&(!r.id||!We(r.id))){n?.error(d(19474,null,this.themesExtPoint.name,String(r.id)));return}let s=Ve(e,r.path);Yr(s,e)||n?.warn(d(19471,null,this.themesExtPoint.name,s.path,e.path));let l=this.create(r,s,i);o.push(l)}),o):(n?.error(d(19473,null,this.themesExtPoint.name)),o)}findThemeById(i){if(this.builtInTheme&&this.builtInTheme.id===i)return this.builtInTheme;let e=this.getThemes();for(let t of e)if(t.id===i)return t}findThemeBySettingsId(i,e){let t=i&&aYe(i);if(this.builtInTheme&&this.builtInTheme.settingsId===t)return this.builtInTheme;let o=this.getThemes(),n;for(let r of o){if(r.settingsId===t)return r;r.settingsId===e&&(n=r)}return n}findThemeByExtensionLocation(i){return i?this.getThemes().filter(e=>e.location&&Yr(e.location,i)):[]}getThemes(){return this.extensionThemes}getMarketplaceThemes(i,e,t){let o=i?.contributes?.[this.themesExtPoint.name];return Array.isArray(o)?this.onThemes(t,e,o):[]}};var sAe=oe.as($t.Configuration),Zhe=[],ege=[],tge=[];function GN(a){return`\`#${a}#\``}var eQ="colorThemeConfiguration",Jon={type:"string",markdownDescription:d(19438,null,GN("window.autoDetectColorScheme")),default:Ft?fl.COLOR_THEME_LIGHT:fl.COLOR_THEME_DARK,tags:[eQ],enum:Zhe,enumDescriptions:tge,enumItemLabels:ege,errorMessage:d(19439,null)},Zon={type:"string",markdownDescription:d(19461,null,GN("window.autoDetectColorScheme")),default:fl.COLOR_THEME_DARK,tags:[eQ],enum:Zhe,enumDescriptions:tge,enumItemLabels:ege,errorMessage:d(19439,null)},enn={type:"string",markdownDescription:d(19464,null,GN("window.autoDetectColorScheme")),default:fl.COLOR_THEME_LIGHT,tags:[eQ],enum:Zhe,enumDescriptions:tge,enumItemLabels:ege,errorMessage:d(19439,null)},tnn={type:"string",markdownDescription:d(19462,null,GN("window.autoDetectHighContrast")),default:fl.COLOR_THEME_HC_DARK,tags:[eQ],enum:Zhe,enumDescriptions:tge,enumItemLabels:ege,errorMessage:d(19439,null)},inn={type:"string",markdownDescription:d(19463,null,GN("window.autoDetectHighContrast")),default:fl.COLOR_THEME_HC_LIGHT,tags:[eQ],enum:Zhe,enumDescriptions:tge,enumItemLabels:ege,errorMessage:d(19439,null)},onn={type:"boolean",markdownDescription:d(19442,null,GN("workbench.preferredDarkColorTheme"),GN("workbench.preferredLightColorTheme")),default:!1,...Ft?{agentsWindow:{default:!0}}:{},tags:[eQ]},Pvo={type:"object",description:d(19468,null),allOf:[{$ref:Bce}],default:{},defaultSnippets:[{body:{}}]},YUt={type:["string","null"],default:fl.FILE_ICON_THEME,description:d(19457,null),enum:[null],enumItemLabels:[d(19460,null)],enumDescriptions:[d(19459,null)],errorMessage:d(19458,null)},XUt={type:["string","null"],default:fl.PRODUCT_ICON_THEME,description:d(19465,null),enum:[fl.PRODUCT_ICON_THEME],enumItemLabels:[d(19441,null)],enumDescriptions:[d(19440,null)],errorMessage:d(19466,null)},nnn={type:"boolean",default:!0,markdownDescription:d(19437,null,GN("workbench.preferredHighContrastColorTheme"),GN("workbench.preferredHighContrastLightColorTheme")),scope:1,tags:[eQ]},ZUt={id:"workbench",order:7.1,type:"object",properties:{"workbench.colorTheme":Jon,"workbench.preferredDarkColorTheme":Zon,"workbench.preferredLightColorTheme":enn,"workbench.preferredHighContrastColorTheme":tnn,"workbench.preferredHighContrastLightColorTheme":inn,"workbench.iconTheme":YUt,"workbench.colorCustomizations":Pvo,"workbench.productIconTheme":XUt}};sAe.registerConfiguration(ZUt);var rnn={id:"window",order:8.1,type:"object",properties:{"window.autoDetectHighContrast":nnn,"window.autoDetectColorScheme":onn}};sAe.registerConfiguration(rnn);function Jhe(a){return{description:a,$ref:_vo}}var P_i="^\\[[^\\]]*(\\]\\s*\\[[^\\]]*)*\\]$",Avo={type:"object",properties:{comments:Jhe(d(19444,null)),strings:Jhe(d(19453,null)),keywords:Jhe(d(19446,null)),numbers:Jhe(d(19447,null)),types:Jhe(d(19455,null)),functions:Jhe(d(19445,null)),variables:Jhe(d(19456,null)),textMateRules:{description:d(19454,null),$ref:Oit},semanticHighlighting:{description:d(19448,null),deprecationMessage:d(19449,null),markdownDeprecationMessage:d(19450,null,GN("editor.semanticTokenColorCustomizations")),type:"boolean"}},additionalProperties:!1},Nvo={description:d(19443,null),default:{},allOf:[{...Avo,patternProperties:{"^\\[":{}}}]},A_i={type:"object",properties:{enabled:{type:"boolean",description:d(19451,null),suggestSortText:"0_enabled"},rules:{$ref:e_e,description:d(19452,null),suggestSortText:"0_rules"}},additionalProperties:!1},Ovo={description:d(19467,null),default:{},allOf:[{...A_i,patternProperties:{"^\\[":{}}}]},Fvo={id:"editor",order:7.2,type:"object",properties:{"editor.tokenColorCustomizations":Nvo,"editor.semanticTokenColorCustomizations":Ovo}};sAe.registerConfiguration(Fvo);function O_i(a){a.sort((r,s)=>r.label.localeCompare(s.label)),Zhe.splice(0,Zhe.length,...a.map(r=>r.settingsId)),tge.splice(0,tge.length,...a.map(r=>r.description||"")),ege.splice(0,ege.length,...a.map(r=>r.label||""));let i={properties:{}},e={properties:{}},t={properties:{}},o={$ref:Bce,additionalProperties:!1},n={properties:Avo.properties,additionalProperties:!1};for(let r of a){let s=`[${r.settingsId}]`;i.properties[s]=o,e.properties[s]=n,t.properties[s]=A_i}i.patternProperties={[P_i]:o},e.patternProperties={[P_i]:n},t.patternProperties={[P_i]:A_i},Pvo.allOf[1]=i,Nvo.allOf[1]=e,Ovo.allOf[1]=t,sAe.notifyConfigurationSchemaUpdated(ZUt,Fvo)}function F_i(a){YUt.enum.splice(1,Number.MAX_VALUE,...a.map(i=>i.settingsId)),YUt.enumItemLabels.splice(1,Number.MAX_VALUE,...a.map(i=>i.label)),YUt.enumDescriptions.splice(1,Number.MAX_VALUE,...a.map(i=>i.description||"")),sAe.notifyConfigurationSchemaUpdated(ZUt)}function W_i(a){XUt.enum.splice(1,Number.MAX_VALUE,...a.map(i=>i.settingsId)),XUt.enumItemLabels.splice(1,Number.MAX_VALUE,...a.map(i=>i.label)),XUt.enumDescriptions.splice(1,Number.MAX_VALUE,...a.map(i=>i.description||"")),sAe.notifyConfigurationSchemaUpdated(ZUt)}var snn={dark:"workbench.preferredDarkColorTheme",light:"workbench.preferredLightColorTheme",hcDark:"workbench.preferredHighContrastColorTheme",hcLight:"workbench.preferredHighContrastLightColorTheme"},JUt=class{constructor(i,e){this.configurationService=i;this.hostColorService=e}get colorTheme(){return this.configurationService.getValue(this.getColorThemeSettingId())}get fileIconTheme(){return this.configurationService.getValue("workbench.iconTheme")}get productIconTheme(){return this.configurationService.getValue("workbench.productIconTheme")}get colorCustomizations(){return this.configurationService.getValue("workbench.colorCustomizations")||{}}get tokenColorCustomizations(){let i=this.configurationService.getValue("editor.tokenColorCustomizations")||{},e=i.textMateRules;if(!e)return i;let t=e.map(n=>{let r=n.settings?.fontSize,s=n.settings?.lineHeight;return r!==void 0&&s===void 0?{...n,settings:{...n.settings,lineHeight:r}}:n});return{...i,textMateRules:t}}get semanticTokenColorCustomizations(){return this.configurationService.getValue("editor.semanticTokenColorCustomizations")}getPreferredColorScheme(){if(this.configurationService.getValue("window.autoDetectHighContrast")&&this.hostColorService.highContrast)return this.hostColorService.dark?"hcDark":"hcLight";if(this.isDetectingColorScheme())return this.hostColorService.dark?"dark":"light"}isDetectingColorScheme(){return this.configurationService.getValue("window.autoDetectColorScheme")}getColorThemeSettingId(){let i=this.getPreferredColorScheme();return i?snn[i]:"workbench.colorTheme"}async setColorTheme(i,e){return await this.writeConfiguration(this.getColorThemeSettingId(),i.settingsId,e),i}async setFileIconTheme(i,e){return await this.writeConfiguration("workbench.iconTheme",i.settingsId,e),i}async setProductIconTheme(i,e){return await this.writeConfiguration("workbench.productIconTheme",i.settingsId,e),i}isDefaultColorTheme(){let i=this.configurationService.inspect(this.getColorThemeSettingId());return i&&i.default?.value===i.value}findAutoConfigurationTarget(i){let e=this.configurationService.inspect(i);if(bn(e.workspaceFolderValue))if(bn(e.workspaceValue)){if(!bn(e.userRemoteValue))return 4}else return 5;else return 6;return 2}async writeConfiguration(i,e,t){if(t===void 0||t==="preview")return;let o=this.configurationService.inspect(i);if(t==="auto")return this.configurationService.updateValue(i,e);if(t===2){if(e===o.userValue)return Promise.resolve(void 0);if(e===o.defaultValue){if(bn(o.userValue))return Promise.resolve(void 0);e=void 0}}else if((t===5||t===6||t===4)&&e===o.value)return Promise.resolve(void 0);return this.configurationService.updateValue(i,e,t)}};var ige="",_U=class a{constructor(i,e,t){this.iconThemeDocument={iconDefinitions:new Map};this.id=i,this.label=e,this.settingsId=t,this.isLoaded=!1}static{this.STORAGE_KEY="productIconThemeData"}getIcon(i){return cnn(i,this.iconThemeDocument)}ensureLoaded(i,e){return this.isLoaded?Promise.resolve(this.styleSheetContent):this.load(i,e)}reload(i,e){return this.load(i,e)}async load(i,e){let t=this.location;if(!t)return Promise.resolve(this.styleSheetContent);let o=[];return this.iconThemeDocument=await ann(i,t,o),this.isLoaded=!0,o.length&&e.error(d(19329,null,t.toString(),o.join(`
`))),this.styleSheetContent}static fromExtensionTheme(i,e,t){let o=t.extensionId+"-"+i.id,n=i.label||Jo(i.path),r=i.id,s=new a(o,n,r);return s.description=i.description,s.location=e,s.extensionData=t,s.watch=i._watch,s.isLoaded=!1,s}static createUnloadedTheme(i){let e=new a(i,"","__"+i);return e.isLoaded=!1,e.extensionData=void 0,e.watch=!1,e}static{this._defaultProductIconTheme=null}static get defaultTheme(){let i=a._defaultProductIconTheme;return i||(i=a._defaultProductIconTheme=new a(ige,d(19318,null),fl.PRODUCT_ICON_THEME),i.isLoaded=!0,i.extensionData=void 0,i.watch=!1),i}static fromStorageData(i){let e=i.get(a.STORAGE_KEY,0);if(e)try{let t=JSON.parse(e),o=new a("","","");for(let s in t)switch(s){case"id":case"label":case"description":case"settingsId":case"styleSheetContent":case"watch":o[s]=t[s];break;case"location":break;case"extensionData":o.extensionData=e_.fromJSONObject(t.extensionData);break}let{iconDefinitions:n,iconFontDefinitions:r}=t;if(Array.isArray(n)&&Di(r)){let s=new Map;for(let l of n){let{id:c,fontCharacter:u,fontId:p}=l;if(We(c)&&We(u))if(We(p)){let h=lkt.fromJSONObject(r[p]);h&&s.set(c,{fontCharacter:u,font:{id:p,definition:h}})}else s.set(c,{fontCharacter:u})}o.iconThemeDocument={iconDefinitions:s}}return o}catch{return}}toStorage(i){let e=[],t={};for(let n of this.iconThemeDocument.iconDefinitions.entries()){let r=n[1].font;e.push({id:n[0],fontCharacter:n[1].fontCharacter,fontId:r?.id}),r&&t[r.id]===void 0&&(t[r.id]=lkt.toJSONObject(r.definition))}let o=JSON.stringify({id:this.id,label:this.label,description:this.description,settingsId:this.settingsId,styleSheetContent:this.styleSheetContent,watch:this.watch,extensionData:e_.toJSONObject(this.extensionData),iconDefinitions:e,iconFontDefinitions:t});i.store(a.STORAGE_KEY,o,0,1)}};function ann(a,i,e){return a.readExtensionResource(i).then(t=>{let o=[],n=is(t,o);if(o.length>0)return Promise.reject(new Error(d(19319,null,o.map(u=>x0(u.error)).join(", "))));if(sE(n)!=="object")return Promise.reject(new Error(d(19326,null)));if(!n.iconDefinitions||!Array.isArray(n.fonts)||!n.fonts.length)return Promise.reject(new Error(d(19327,null)));let r=ai(i),s=new Map;for(let u of n.fonts){let p=u.id;if(We(p)&&p.match(qX)){let h;We(u.weight)&&u.weight.match(Rke)?h=u.weight:e.push(d(19323,null,u.id));let g;We(u.style)&&u.style.match(Dke)?g=u.style:e.push(d(19322,null,u.id));let f=[];if(Array.isArray(u.src))for(let v of u.src)if(We(v.path)&&We(v.format)&&v.format.match(OZi)){let b=Ve(r,v.path);f.push({location:b,format:v.format})}else e.push(d(19321,null,u.id));f.length?s.set(p,{weight:h,style:g,src:f}):e.push(d(19328,null,u.id))}else e.push(d(19320,null,u.id))}let l=new Map,c=n.fonts[0].id;for(let u in n.iconDefinitions){let p=n.iconDefinitions[u];if(We(p.fontCharacter)){let h=p.fontId??c,g=s.get(h);if(g){let f={id:`pi-${h}`,definition:g};l.set(u,{fontCharacter:p.fontCharacter,font:f})}else e.push(d(19324,null,u))}else e.push(d(19325,null,u))}return{iconDefinitions:l}})}var lnn=Zw();function cnn(a,i){let e=i.iconDefinitions,t=e.get(a.id),o=a.defaults;for(;!t&&q.isThemeIcon(o);){let n=lnn.getIcon(o.id);if(n)t=e.get(n.id),o=n.defaults;else return}if(t)return t;if(!q.isThemeIcon(o))return o}var dnn="vscode://schemas/product-icon-theme",unn={type:"object",allowComments:!0,allowTrailingCommas:!0,properties:{fonts:{type:"array",items:{type:"object",properties:{id:{type:"string",description:d(19435,null),pattern:qX.source,patternErrorMessage:Lke},src:{type:"array",description:d(19436,null),items:{type:"object",properties:{path:{type:"string",description:d(19431,null)},format:{type:"string",description:d(19430,null),enum:["woff","woff2","truetype","opentype","embedded-opentype","svg"]}},required:["path","format"]}},weight:{type:"string",description:d(19433,null),anyOf:[{enum:["normal","bold","lighter","bolder"]},{type:"string",pattern:Rke.source}]},style:{type:"string",description:d(19432,null),anyOf:[{enum:["normal","italic","oblique"]},{type:"string",pattern:Dke.source}]}},required:["id","src"]}},iconDefinitions:{description:d(19434,null),$ref:dkt}}};function Wvo(){oe.as(Ta.JSONContribution).registerSchema(dnn,unn)}var e1t=le("hostColorSchemeService");var tQ=le("IUserDataInitializationService"),t1t=class{constructor(i=[]){this.initializers=i}async whenInitializationFinished(){await this.requiresInitialization()&&await Promise.all(this.initializers.map(i=>i.whenInitializationFinished()))}async requiresInitialization(){return(await Promise.all(this.initializers.map(i=>i.requiresInitialization()))).some(i=>i)}async initializeRequiredResources(){await this.requiresInitialization()&&await Promise.all(this.initializers.map(i=>i.initializeRequiredResources()))}async initializeOtherResources(i){await this.requiresInitialization()&&await Promise.all(this.initializers.map(e=>e.initializeOtherResources(i)))}async initializeInstalledExtensions(i){await this.requiresInitialization()&&await Promise.all(this.initializers.map(e=>e.initializeInstalledExtensions(i)))}},Fit=class{constructor(i,e,t){t.whenInstalledExtensionsRegistered().then(()=>this.initializeOtherResource(i,e))}async initializeOtherResource(i,e){await i.requiresInitialization()&&(Wo("code/willInitOtherUserData"),await i.initializeOtherResources(e),Wo("code/didInitOtherUserData"))}};Fit=I([m(0,tQ),m(1,F),m(2,lt)],Fit);Ft&&oe.as(Zi.Workbench).registerWorkbenchContribution(Fit,3);function i1t(a){let i=new O,e=i.add(new T),t=Zw();return i.add(t.onDidChange(()=>e.fire())),a&&i.add(a.onDidProductIconThemeChange(()=>e.fire())),{dispose:()=>i.dispose(),onDidChange:e.event,getCSS(){let o=a?a.getProductIconTheme():new V_i,n={},r=new TD,s=new TD;for(let l of t.getIcons()){let c=o.getIcon(l);if(!c)continue;let u=c.font,p=pa`--vscode-icon-${_K(l.id)}-font-family`,h=pa`--vscode-icon-${_K(l.id)}-content`;u?(n[u.id]=u.definition,s.push(pa`${p}: ${FI(u.id)};`,pa`${h}: ${FI(c.fontCharacter)};`),r.push(pa`.codicon-${_K(l.id)}:before { content: ${FI(c.fontCharacter)}; font-family: ${FI(u.id)}; }`)):(s.push(pa`${h}: ${FI(c.fontCharacter)}; ${p}: 'codicon';`),r.push(pa`.codicon-${_K(l.id)}:before { content: ${FI(c.fontCharacter)}; }`))}for(let l in n){let c=n[l],u=c.weight?pa`font-weight: ${pke(c.weight)};`:pa``,p=c.style?pa`font-style: ${pke(c.style)};`:pa``,h=new TD;for(let g of c.src)h.push(pa`${cl(g.location)} format(${FI(g.format)})`);r.push(pa`@font-face { src: ${h.join(", ")}; font-family: ${FI(l)};${u}${p} font-display: block; }`)}return r.push(pa`:root { ${s.join(" ")} }`),r.join(`
`)}}}var V_i=class{getIcon(i){let e=Zw(),t=i.defaults;for(;q.isThemeIcon(t);){let o=e.getIcon(t.id);if(!o)return;t=o.defaults}return t}};var kLd=_v("bodyFontSize",Tv(13,"px"),d(2873,null)),ELd=_v("bodyFontSize.small",Tv(12,"px"),d(2874,null)),TLd=_v("bodyFontSize.xSmall",Tv(11,"px"),d(2875,null)),_Ld=_v("codiconFontSize",Tv(16,"px"),d(2876,null)),DLd=_v("cornerRadius.medium",Tv(6,"px"),d(2879,null)),RLd=_v("cornerRadius.xSmall",Tv(2,"px"),d(2882,null)),LLd=_v("cornerRadius.small",Tv(4,"px"),d(2880,null)),MLd=_v("cornerRadius.large",Tv(8,"px"),d(2878,null)),PLd=_v("cornerRadius.xLarge",Tv(12,"px"),d(2881,null)),ALd=_v("cornerRadius.circle",Tv(9999,"px"),d(2877,null)),NLd=_v("strokeThickness",Tv(1,"px"),d(2883,null));function Vvo(a,i,e,t){let o=new Set,n={addRule:s=>{o.has(s)||o.add(s)}};if(n.addRule(`${i} { forced-color-adjust: none; }`),e&&t)for(let s of e)s(a,n,t);let r=[];for(let s of DCe().getColors()){let l=a.getColor(s.id,!0);l&&r.push(`${kF(s.id)}: ${l.toString()};`)}for(let s of rtt().getSizes()){let l=rtt().resolveDefaultSize(s.id,a);l&&r.push(`${Oho(s.id)}: ${ott(l)};`)}return n.addRule(`${i} { ${r.join(`
`)} }`),new B_i([...o].join(`
`))}var B_i=class{constructor(i){this.code=i}};var o1t="vscode-theme-defaults",H_i="vscode.vscode-theme-seti-vs-seti",Bvo="file-icons-enabled",pnn="contributedColorTheme",mnn="contributedFileIconTheme",hnn="contributedProductIconTheme",Hvo=oe.as(Zsi.ThemingContribution);function gnn(a){switch(a){case"vs":return`vs ${o1t}-themes-light_vs-json`;case"vs-dark":return`vs-dark ${o1t}-themes-dark_vs-json`;case"hc-black":return`hc-black ${o1t}-themes-hc_black-json`;case"hc-light":return`hc-light ${o1t}-themes-hc_light-json`}return a}var fnn=Rvo(),vnn=Lvo(),bnn=Mvo(),Jte=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.storageService=t;this.configurationService=o;this.telemetryService=n;this.environmentService=r;this.extensionResourceLoaderService=l;this.logService=u;this.hostColorService=p;this.userDataInitializationService=h;this.languageService=g;this.notificationService=f;this.hostService=v;this.themeExtensionsActivated=new Map;this.container=c.mainContainer,this.settings=new JUt(o,p),this.colorThemeRegistry=this._register(new rAe(fnn,Z8.fromExtensionTheme)),this.colorThemeWatcher=this._register(new Wit(s,r,this.reloadCurrentColorTheme.bind(this))),this.onColorThemeChange=this._register(new T({leakWarningThreshold:400,leakWarningName:"ThemeService.onColorThemeChange"})),this.currentColorTheme=Z8.createUnloadedTheme(""),this.colorThemeSequencer=new Tm,this.fileIconThemeWatcher=this._register(new Wit(s,r,this.reloadCurrentFileIconTheme.bind(this))),this.fileIconThemeRegistry=this._register(new rAe(vnn,TU.fromExtensionTheme,!0,TU.noIconTheme)),this.fileIconThemeLoader=new QUt(l,g),this.onFileIconThemeChange=this._register(new T({leakWarningThreshold:400,leakWarningName:"ThemeService.onFileIconThemeChange"})),this.currentFileIconTheme=TU.createUnloadedTheme(""),this.fileIconThemeSequencer=new Tm,this.productIconThemeWatcher=this._register(new Wit(s,r,this.reloadCurrentProductIconTheme.bind(this))),this.productIconThemeRegistry=this._register(new rAe(bnn,_U.fromExtensionTheme,!0,_U.defaultTheme)),this.onProductIconThemeChange=this._register(new T),this.currentProductIconTheme=_U.createUnloadedTheme(""),this.productIconThemeSequencer=new Tm,this._register(this.onDidColorThemeChange(K=>DCe().notifyThemeUpdate(K)));let b=Z8.fromStorageData(this.storageService),S=b?.settingsId,y=this.settings.colorTheme;b&&y!==b.settingsId&&(b=void 0);let w=y===fl.COLOR_THEME_LIGHT?xso:y===fl.COLOR_THEME_DARK?Cso:void 0;if(!b){let K=r.options?.initialColorTheme;K&&(b=Z8.createUnloadedThemeForThemeType(K.themeType,K.colors??w))}if(!b){let K=this.settings.getPreferredColorScheme()??(Ft?"light":"dark");b=Z8.createUnloadedThemeForThemeType(K,w)}b.setCustomizations(this.settings),this.applyTheme(b,void 0,!0);let x=TU.fromStorageData(this.storageService);x&&this.applyAndSetFileIconTheme(x,!0);let E=_U.fromStorageData(this.storageService);E&&this.applyAndSetProductIconTheme(E,!0),e.whenInstalledExtensionsRegistered().then(K=>{this.installConfigurationListener(),this.installPreferredSchemeListener(),this.installRegistryListeners(),this.initialize(S).catch(mt)});let M=Pr();M.id="codiconStyles";let N=this._register(i1t(this));function V(){M.textContent=N.getCSS()}let H=this._register(new Dt(V,0));this._register(N.onDidChange(()=>H.schedule())),H.schedule()}async initialize(e){let t=this.environmentService.extensionDevelopmentLocationURI,o=t&&t.length===1?t[0]:void 0,n=async()=>{let c=this.colorThemeRegistry.findThemeByExtensionLocation(o);if(c.length){let p=c.find(h=>h.type===this.currentColorTheme.type);return this.setColorTheme(p?p.id:c[0].id,void 0)}let u=this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme,void 0);if(!u){await this.userDataInitializationService.whenInitializationFinished();let p=this.currentColorTheme.type==="light"?fl.COLOR_THEME_LIGHT:fl.COLOR_THEME_DARK;u=this.colorThemeRegistry.findThemeBySettingsId(this.settings.colorTheme,p)}return this.setColorTheme(u&&u.id,void 0)},r=async()=>{let c=this.fileIconThemeRegistry.findThemeByExtensionLocation(o);if(c.length)return this.setFileIconTheme(c[0].id,8);let u=this.fileIconThemeRegistry.findThemeBySettingsId(this.settings.fileIconTheme);return u||(await this.userDataInitializationService.whenInitializationFinished(),u=this.fileIconThemeRegistry.findThemeBySettingsId(this.settings.fileIconTheme)),this.setFileIconTheme(u?u.id:H_i,void 0)},s=async()=>{let c=this.productIconThemeRegistry.findThemeByExtensionLocation(o);if(c.length)return this.setProductIconTheme(c[0].id,8);let u=this.productIconThemeRegistry.findThemeBySettingsId(this.settings.productIconTheme);return u||(await this.userDataInitializationService.whenInitializationFinished(),u=this.productIconThemeRegistry.findThemeBySettingsId(this.settings.productIconTheme)),this.setProductIconTheme(u?u.id:ige,void 0)};this.migrateColorThemeSettings();let l=await Promise.all([n(),r(),s()]);return await this.showNewDefaultThemeNotification(e),l}static{this.NEW_THEME_NOTIFICATION_KEY="workbench.newDefaultThemeNotification"}async showNewDefaultThemeNotification(e){if(this.storageService.getBoolean(Jte.NEW_THEME_NOTIFICATION_KEY,-1)||!await this.hostService.hadLastFocus()||this.environmentService.isSessionsWindow)return;try{if(!this.settings.isDefaultColorTheme()||!e||(e=aYe(e),!["Dark Modern","Light Modern"].includes(e))||![fl.COLOR_THEME_DARK,fl.COLOR_THEME_LIGHT].includes(this.settings.colorTheme))return}finally{this.storageService.store(Jte.NEW_THEME_NOTIFICATION_KEY,!0,-1,0)}if(!await new Promise(o=>{this.notificationService.prompt(ft.Info,d(19332,null,this.getColorTheme().label),[li({id:"themeUpdated.tryItOut",label:d(19333,null),run:()=>o(!0)}),li({id:"themeUpdated.noThanks",label:d(19331,null),run:()=>o(!1)})],{onCancel:()=>o(!1)})})){let o=this.colorThemeRegistry.findThemeBySettingsId(e);o&&this.setColorTheme(o.id,"auto")}}migrateColorThemeSettings(){let e=["workbench.colorTheme","workbench.preferredDarkColorTheme","workbench.preferredLightColorTheme","workbench.preferredHighContrastColorTheme","workbench.preferredHighContrastLightColorTheme"];for(let t of e){let o=this.configurationService.inspect(t);for(let[n,r]of[[2,o.userValue],[4,o.userRemoteValue],[5,o.workspaceValue]])if(r){let s=aYe(r);s!==r&&this.configurationService.updateValue(t,s,n)}}}installConfigurationListener(){this._register(this.configurationService.onDidChangeConfiguration(e=>{if((e.affectsConfiguration("workbench.colorTheme")||e.affectsConfiguration("workbench.preferredDarkColorTheme")||e.affectsConfiguration("workbench.preferredLightColorTheme")||e.affectsConfiguration("workbench.preferredHighContrastColorTheme")||e.affectsConfiguration("workbench.preferredHighContrastLightColorTheme")||e.affectsConfiguration("window.autoDetectColorScheme")||e.affectsConfiguration("window.autoDetectHighContrast")||e.affectsConfiguration("window.systemColorTheme"))&&this.restoreColorTheme(),e.affectsConfiguration("workbench.iconTheme")&&this.restoreFileIconTheme(),e.affectsConfiguration("workbench.productIconTheme")&&this.restoreProductIconTheme(),this.currentColorTheme){let t=!1;e.affectsConfiguration("workbench.colorCustomizations")&&(this.currentColorTheme.setCustomColors(this.settings.colorCustomizations),t=!0),e.affectsConfiguration("editor.tokenColorCustomizations")&&(this.currentColorTheme.setCustomTokenColors(this.settings.tokenColorCustomizations),t=!0),e.affectsConfiguration("editor.semanticTokenColorCustomizations")&&(this.currentColorTheme.setCustomSemanticTokenColors(this.settings.semanticTokenColorCustomizations),t=!0),t&&(this.updateDynamicCSSRules(this.currentColorTheme),this.onColorThemeChange.fire(this.currentColorTheme))}}))}installRegistryListeners(){let e;this._register(this.colorThemeRegistry.onDidChange(async n=>{if(O_i(n.themes),await this.restoreColorTheme())this.currentColorTheme.settingsId===fl.COLOR_THEME_DARK&&!bn(e)&&await this.colorThemeRegistry.findThemeById(e)?(await this.setColorTheme(e,"auto"),e=void 0):n.added.some(r=>r.settingsId===this.currentColorTheme.settingsId)&&await this.reloadCurrentColorTheme();else if(n.removed.some(r=>r.settingsId===this.currentColorTheme.settingsId)){e=this.currentColorTheme.id;let r=this.colorThemeRegistry.findThemeBySettingsId(fl.COLOR_THEME_DARK);await this.setColorTheme(r,"auto")}}));let t;this._register(this._register(this.fileIconThemeRegistry.onDidChange(async n=>{F_i(n.themes),await this.restoreFileIconTheme()?this.currentFileIconTheme.id===H_i&&!bn(t)&&this.fileIconThemeRegistry.findThemeById(t)?(await this.setFileIconTheme(t,"auto"),t=void 0):n.added.some(r=>r.settingsId===this.currentFileIconTheme.settingsId)&&await this.reloadCurrentFileIconTheme():n.removed.some(r=>r.settingsId===this.currentFileIconTheme.settingsId)&&(t=this.currentFileIconTheme.id,await this.setFileIconTheme(H_i,"auto"))})));let o;return this._register(this.productIconThemeRegistry.onDidChange(async n=>{W_i(n.themes),await this.restoreProductIconTheme()?this.currentProductIconTheme.id===ige&&!bn(o)&&this.productIconThemeRegistry.findThemeById(o)?(await this.setProductIconTheme(o,"auto"),o=void 0):n.added.some(r=>r.settingsId===this.currentProductIconTheme.settingsId)&&await this.reloadCurrentProductIconTheme():n.removed.some(r=>r.settingsId===this.currentProductIconTheme.settingsId)&&(o=this.currentProductIconTheme.id,await this.setProductIconTheme(ige,"auto"))})),this._register(this.languageService.onDidChange(()=>this.reloadCurrentFileIconTheme())),Promise.all([this.getColorThemes(),this.getFileIconThemes(),this.getProductIconThemes()]).then(([n,r,s])=>{O_i(n),F_i(r),W_i(s)})}installPreferredSchemeListener(){this._register(this.hostColorService.onDidChangeColorScheme(()=>{this.settings.isDetectingColorScheme()&&this.restoreColorTheme()}))}getColorTheme(){return this.currentColorTheme}async getColorThemes(){return this.colorThemeRegistry.getThemes()}getPreferredColorScheme(){return this.settings.getPreferredColorScheme()}async getMarketplaceColorThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(Ve(n,"package.json"));return this.colorThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,e_.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}get onDidColorThemeChange(){return this.onColorThemeChange.event}setColorTheme(e,t){return this.colorThemeSequencer.queue(async()=>this.internalSetColorTheme(e,t))}async internalSetColorTheme(e,t){if(!e)return null;let o=We(e)?gnn(e):e.id;if(this.currentColorTheme.isLoaded&&o===this.currentColorTheme.id)return t!=="preview"&&this.currentColorTheme.toStorage(this.storageService),this.settings.setColorTheme(this.currentColorTheme,t);let n=this.colorThemeRegistry.findThemeById(o);if(!n)if(e instanceof Z8)n=e;else return null;try{return await n.ensureLoaded(this.extensionResourceLoaderService),n.setCustomizations(this.settings),this.applyTheme(n,t)}catch(r){throw new Error(d(19330,null,n.location?.toString(),r.message))}}reloadCurrentColorTheme(){return this.colorThemeSequencer.queue(async()=>{try{let e=this.colorThemeRegistry.findThemeBySettingsId(this.currentColorTheme.settingsId)||this.currentColorTheme;await e.reload(this.extensionResourceLoaderService),e.setCustomizations(this.settings),await this.applyTheme(e,void 0,!1)}catch{this.logService.info("Unable to reload {0}: {1}",this.currentColorTheme.location?.toString())}})}async restoreColorTheme(){return this.colorThemeSequencer.queue(async()=>{let e=this.settings.colorTheme,t=this.colorThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentColorTheme.settingsId?await this.internalSetColorTheme(t.id,void 0):t!==this.currentColorTheme&&(await t.ensureLoaded(this.extensionResourceLoaderService),t.setCustomizations(this.settings),await this.applyTheme(t,void 0,!0)),!0):!1})}updateDynamicCSSRules(e){let t=Vvo(e,".monaco-workbench",Hvo.getThemingParticipants(),this.environmentService);U_i(t.code,pnn)}applyTheme(e,t,o=!1){return this.updateDynamicCSSRules(e),this.currentColorTheme.id?this.container.classList.remove(...this.currentColorTheme.classNames):this.container.classList.remove("vs","vs-dark","hc-black","hc-light"),this.container.classList.add(...e.classNames),this.currentColorTheme.clearCaches(),this.currentColorTheme=e,this.colorThemingParticipantChangeListener||(this.colorThemingParticipantChangeListener=Hvo.onThemingParticipantAdded(n=>this.updateDynamicCSSRules(this.currentColorTheme))),this.colorThemeWatcher.update(e),this.sendTelemetry(e.id,e.extensionData,"color"),o?Promise.resolve(null):(this.onColorThemeChange.fire(this.currentColorTheme),e.isLoaded&&t!=="preview"&&e.toStorage(this.storageService),this.settings.setColorTheme(this.currentColorTheme,t))}sendTelemetry(e,t,o){if(t){let n=o+t.extensionId;this.themeExtensionsActivated.get(n)||(this.telemetryService.publicLog2("activateThemeExtension",{id:t.extensionId,name:t.extensionName,isBuiltin:t.extensionIsBuiltin,publisherDisplayName:t.extensionPublisher,themeId:e}),this.themeExtensionsActivated.set(n,!0))}}async getFileIconThemes(){return this.fileIconThemeRegistry.getThemes()}getFileIconTheme(){return this.currentFileIconTheme}get onDidFileIconThemeChange(){return this.onFileIconThemeChange.event}async setFileIconTheme(e,t){return this.fileIconThemeSequencer.queue(async()=>this.internalSetFileIconTheme(e,t))}async internalSetFileIconTheme(e,t){e===void 0&&(e="");let o=We(e)?e:e.id;if(o!==this.currentFileIconTheme.id||!this.currentFileIconTheme.isLoaded){let r=this.fileIconThemeRegistry.findThemeById(o);!r&&e instanceof TU&&(r=e),r||(r=TU.noIconTheme),await r.ensureLoaded(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(r)}let n=this.currentFileIconTheme;return n.isLoaded&&t!=="preview"&&(!n.location||!N4(n.location))&&n.toStorage(this.storageService),await this.settings.setFileIconTheme(this.currentFileIconTheme,t),n}async getMarketplaceFileIconThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(Ve(n,"package.json"));return this.fileIconThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,e_.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}async reloadCurrentFileIconTheme(){return this.fileIconThemeSequencer.queue(async()=>{await this.currentFileIconTheme.reload(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(this.currentFileIconTheme)})}async restoreFileIconTheme(){return this.fileIconThemeSequencer.queue(async()=>{let e=this.settings.fileIconTheme,t=this.fileIconThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentFileIconTheme.settingsId?await this.internalSetFileIconTheme(t.id,void 0):t!==this.currentFileIconTheme&&(await t.ensureLoaded(this.fileIconThemeLoader),this.applyAndSetFileIconTheme(t,!0)),!0):!1})}applyAndSetFileIconTheme(e,t=!1){this.currentFileIconTheme=e,U_i(e.styleSheetContent,mnn),e.id?this.container.classList.add(Bvo):this.container.classList.remove(Bvo),this.fileIconThemeWatcher.update(e),e.id&&this.sendTelemetry(e.id,e.extensionData,"fileIcon"),t||this.onFileIconThemeChange.fire(this.currentFileIconTheme)}async getProductIconThemes(){return this.productIconThemeRegistry.getThemes()}getProductIconTheme(){return this.currentProductIconTheme}get onDidProductIconThemeChange(){return this.onProductIconThemeChange.event}async setProductIconTheme(e,t){return this.productIconThemeSequencer.queue(async()=>this.internalSetProductIconTheme(e,t))}async internalSetProductIconTheme(e,t){e===void 0&&(e="");let o=We(e)?e:e.id;if(o!==this.currentProductIconTheme.id||!this.currentProductIconTheme.isLoaded){let r=this.productIconThemeRegistry.findThemeById(o);!r&&e instanceof _U&&(r=e),r||(r=_U.defaultTheme),await r.ensureLoaded(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(r)}let n=this.currentProductIconTheme;return n.isLoaded&&t!=="preview"&&(!n.location||!N4(n.location))&&n.toStorage(this.storageService),await this.settings.setProductIconTheme(this.currentProductIconTheme,t),n}async getMarketplaceProductIconThemes(e,t,o){let n=await this.extensionResourceLoaderService.getExtensionGalleryResourceURL({publisher:e,name:t,version:o},"extension");if(n)try{let r=await this.extensionResourceLoaderService.readExtensionResource(Ve(n,"package.json"));return this.productIconThemeRegistry.getMarketplaceThemes(JSON.parse(r),n,e_.fromName(e,t))}catch(r){this.logService.error("Problem loading themes from marketplace",r)}return[]}async reloadCurrentProductIconTheme(){return this.productIconThemeSequencer.queue(async()=>{await this.currentProductIconTheme.reload(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(this.currentProductIconTheme)})}async restoreProductIconTheme(){return this.productIconThemeSequencer.queue(async()=>{let e=this.settings.productIconTheme,t=this.productIconThemeRegistry.findThemeBySettingsId(e);return t?(e!==this.currentProductIconTheme.settingsId?await this.internalSetProductIconTheme(t.id,void 0):t!==this.currentProductIconTheme&&(await t.ensureLoaded(this.extensionResourceLoaderService,this.logService),this.applyAndSetProductIconTheme(t,!0)),!0):!1})}applyAndSetProductIconTheme(e,t=!1){this.currentProductIconTheme=e,U_i(e.styleSheetContent,hnn),this.productIconThemeWatcher.update(e),e.id&&this.sendTelemetry(e.id,e.extensionData,"productIcon"),t||this.onProductIconThemeChange.fire(this.currentProductIconTheme)}};Jte=I([m(0,lt),m(1,de),m(2,B),m(3,_e),m(4,Od),m(5,ge),m(6,aE),m(7,wi),m(8,re),m(9,e1t),m(10,tQ),m(11,Rt),m(12,Ne),m(13,ti)],Jte);var Wit=class{constructor(i,e,t){this.fileService=i;this.environmentService=e;this.onUpdate=t;this.watcherDisposables=new O}update(i){ze(i.location,this.watchedLocation)||(this.watchedLocation=void 0,this.watcherDisposables.clear(),i.location&&(i.watch||this.environmentService.isExtensionDevelopment)&&(this.watchedLocation=i.location,this.watcherDisposables.add(this.fileService.watch(i.location)),this.watcherDisposables.add(this.fileService.onDidFilesChange(e=>{this.watchedLocation&&e.contains(this.watchedLocation,0)&&this.onUpdate()}))))}dispose(){this.watcherDisposables.dispose(),this.watchedLocation=void 0}};function U_i(a,i){let e=ut.document.head.getElementsByClassName(i);if(e.length===0){let t=Pr();t.className=i,t.textContent=a}else e[0].textContent=a}Dvo();Evo();Wvo();Ce(ep,Jte,0);var Snn=zn.registerExtensionPoint({extensionPoint:"resourceLabelFormatters",jsonSchema:{description:d(19125,null),type:"array",items:{type:"object",required:["scheme","formatting"],properties:{scheme:{type:"string",description:d(19130,null)},authority:{type:"string",description:d(19126,null)},formatting:{description:d(19127,null),type:"object",properties:{label:{type:"string",description:d(19129,null)},separator:{type:"string",description:d(19131,null)},stripPathStartingSeparator:{type:"boolean",description:d(19132,null)},tildify:{type:"boolean",description:d(19133,null)},workspaceSuffix:{type:"string",description:d(19128,null)}}}}}}}),Inn=/\//g,ynn=/[\\\/]/g,wnn=/\$\{(scheme|authoritySuffix|authority|path|(query)\.(.+?))\}/g;function Cnn(a){return!!(a&&a[2]===":")}var Vit=class{constructor(i){this.formattersDisposables=new Map;Snn.setHandler((e,t)=>{for(let o of t.added)for(let n of o.value){let r={...n};typeof r.formatting.label!="string"&&(r.formatting.label="${authority}${path}"),typeof r.formatting.separator!="string"&&(r.formatting.separator=Cu),!Va(o.description,"contribLabelFormatterWorkspaceTooltip")&&r.formatting.workspaceTooltip&&(r.formatting.workspaceTooltip=void 0),this.formattersDisposables.set(r,i.registerFormatter(r))}for(let o of t.removed)for(let n of o.value)je(this.formattersDisposables.get(n))})}};Vit=I([m(0,nt)],Vit);oe.as(Zi.Workbench).registerWorkbenchContribution(Vit,3);var Uvo=50,Bit=class extends k{constructor(e,t,o,n,r,s){super();this.environmentService=e;this.contextService=t;this.pathService=o;this.remoteAgentService=n;this._onDidChangeFormatters=this._register(new T({leakWarningThreshold:400,leakWarningName:"LabelService._onDidChangeFormatters"}));this.onDidChangeFormatters=this._onDidChangeFormatters.event;this.os=Ao,this.userHome=o.defaultUriScheme===Q.file?this.pathService.userHome({preferLocal:!0}):void 0;let l=this.storedFormattersMemento=new $l("cachedResourceLabelFormatters2",r);this.storedFormatters=l.getMemento(0,1),this.formatters=this.storedFormatters?.formatters?.slice()||[],this.resolveRemoteEnvironment()}async resolveRemoteEnvironment(){let e=await this.remoteAgentService.getEnvironment();this.os=e?.os??Ao,this.userHome=await this.pathService.userHome()}findFormatting(e){let t;for(let o of this.formatters)if(o.scheme===e.scheme){if(!o.authority&&(!t||o.priority)){t=o;continue}if(!o.authority)continue;qd(o.authority,e.authority,{ignoreCase:!0})&&(!t?.authority||o.authority.length>t.authority.length||o.authority.length===t.authority.length&&o.priority)&&(t=o)}return t?t.formatting:void 0}getUriLabel(e,t={}){let o=this.findFormatting(e);o&&t.separator&&(o={...o,separator:t.separator});let n=this.doGetUriLabel(e,o,t);return!o&&t.separator&&(n=this.adjustPathSeparators(n,t.separator)),t.appendWorkspaceSuffix&&o?.workspaceSuffix&&(n=this.appendWorkspaceSuffix(n,e)),n}doGetUriLabel(e,t,o={}){if(!t)return gYi(e,{os:this.os,tildify:this.userHome?{userHome:this.userHome}:void 0,relative:o.relative?{noPrefix:o.noPrefix,getWorkspace:()=>this.contextService.getWorkspace(),getWorkspaceFolder:n=>this.contextService.getWorkspaceFolder(n)}:void 0});if(o.relative&&this.contextService){let n=this.contextService.getWorkspaceFolder(e);if(!n){let s=this.contextService.getWorkspace().folders.at(0);s&&e.scheme!==s.uri.scheme&&e.path.startsWith(Vo.sep)&&(n=this.contextService.getWorkspaceFolder(s.uri.with({path:e.path})))}if(n){let r=this.formatUri(n.uri,t,o.noPrefix),s=this.formatUri(e,t,o.noPrefix),l=0;for(;s[l]&&s[l]===r[l];)l++;if(!s[l]||s[l]===t.separator?s=s.substring(1+l):l===r.length&&n.uri.path===Vo.sep&&(s=s.substring(l)),this.contextService.getWorkspace().folders.length>1&&!o.noPrefix){let u=n?.name??sl(n.uri);s=s?`${u} \u2022 ${s}`:u}return s}}return this.formatUri(e,t,o.noPrefix)}getUriBasenameLabel(e){let t=this.findFormatting(e),o=this.doGetUriLabel(e,t),n;return t?.separator===Gs.sep?n=Gs:t?.separator===Vo.sep?n=Vo:n=this.os===1?Gs:Vo,n.basename(o)}getWorkspaceLabel(e,t){if(p4(e)){let o=pf(e);return Pg(o)||Gy(o)?this.getWorkspaceLabel(o,t):""}return A.isUri(e)?this.doGetSingleFolderWorkspaceLabel(e,t):Pg(e)?this.doGetSingleFolderWorkspaceLabel(e.uri,t):Gy(e)?this.doGetWorkspaceLabel(e.configPath,t):""}doGetWorkspaceLabel(e,t){if(rM(e,this.environmentService))return d(19124,null);if(tC(e))return d(19123,null);let o=Be(e);o.endsWith(OT)&&(o=o.substr(0,o.length-OT.length-1));let n;switch(t?.verbose){case 0:n=o;break;case 2:n=d(19135,null,this.getUriLabel(Ve(ai(e),o)));break;case 1:default:n=d(19134,null,o);break}return t?.verbose===0?n:this.appendWorkspaceSuffix(n,e)}doGetSingleFolderWorkspaceLabel(e,t){let o;switch(t?.verbose){case 2:o=this.getUriLabel(e);break;case 0:case 1:default:o=Be(e)||Vo.sep;break}return t?.verbose===0?o:this.appendWorkspaceSuffix(o,e)}getSeparator(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.separator||Vo.sep}getHostLabel(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.workspaceSuffix||t||""}getHostTooltip(e,t){return this.findFormatting(A.from({scheme:e,authority:t}))?.workspaceTooltip}registerCachedFormatter(e){let t=this.storedFormatters.formatters??=[],o=t.findIndex(n=>n.scheme===e.scheme&&n.authority===e.authority);if(o===-1&&t.length>=Uvo&&(o=Uvo-1),o===-1)t.unshift(e);else{for(let n=o;n>0;n--)t[n]=t[n-1];t[0]=e}return this.storedFormattersMemento.saveMemento(),this.registerFormatter(e)}registerFormatter(e){return this.formatters.push(e),this._onDidChangeFormatters.fire({scheme:e.scheme}),{dispose:()=>{this.formatters=this.formatters.filter(t=>t!==e),this._onDidChangeFormatters.fire({scheme:e.scheme})}}}formatUri(e,t,o){let n=t.label.replace(wnn,(r,s,l,c)=>{switch(s){case"scheme":return e.scheme;case"authority":return e.authority;case"authoritySuffix":{let u=e.authority.indexOf("+");return u===-1?e.authority:e.authority.slice(u+1)}case"path":{let u=e.path;if(t.stripPathSegments){let p=0;for(let h=0;h<t.stripPathSegments;h++){let g=u.indexOf("/",p+1);if(g===-1)break;p=g}u=u.substring(p)}return t.stripPathStartingSeparator?u.slice(u[0]===t.separator?1:0):u}default:{if(l==="query"){let{query:u}=e;if(u&&u[0]==="{"&&u[u.length-1]==="}")try{return JSON.parse(u)[c]||""}catch{}}return""}}});return t.normalizeDriveLetter&&Cnn(n)&&(n=n.charAt(1).toUpperCase()+n.substr(2)),t.tildify&&!o&&this.userHome&&(n=$3e(n,this.userHome.fsPath,this.os)),t.authorityPrefix&&e.authority&&(n=t.authorityPrefix+n),this.adjustPathSeparators(n,t.separator)}adjustPathSeparators(e,t){return e.replace(this.os===1?ynn:Inn,t)}appendWorkspaceSuffix(e,t){let o=this.findFormatting(t),n=o&&typeof o.workspaceSuffix=="string"?o.workspaceSuffix:void 0;return n?`${e} [${n}]`:e}};Bit=I([m(0,Mt),m(1,Ae),m(2,Pn),m(3,bo),m(4,de),m(5,to)],Bit);Ce(nt,Bit,1);var z_i="Offline";function Uit(a){return a instanceof Hit?!0:a instanceof Error&&a.name===z_i&&a.message===z_i}var Hit=class extends Error{constructor(){super(z_i),this.name=this.message}};var zvo=/^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/,xnn=/^-(\d{4})(\d{2})(\d{2})(\d{2})?(\d{2})?$/;function knn(a){return a=a.trim(),a==="*"||zvo.test(a)}function G_i(a){if(!knn(a))return null;if(a=a.trim(),a==="*")return{hasCaret:!1,hasGreaterEquals:!1,majorBase:0,majorMustEqual:!1,minorBase:0,minorMustEqual:!1,patchBase:0,patchMustEqual:!1,preRelease:null};let i=a.match(zvo);return i?{hasCaret:i[1]==="^",hasGreaterEquals:i[1]===">=",majorBase:i[2]==="x"?0:parseInt(i[2],10),majorMustEqual:i[2]!=="x",minorBase:i[4]==="x"?0:parseInt(i[4],10),minorMustEqual:i[4]!=="x",patchBase:i[6]==="x"?0:parseInt(i[6],10),patchMustEqual:i[6]!=="x",preRelease:i[8]||null}:null}function q_i(a){if(!a)return null;let i=a.majorBase,e=a.majorMustEqual,t=a.minorBase,o=a.minorMustEqual,n=a.patchBase,r=a.patchMustEqual;a.hasCaret&&(i===0||(o=!1),r=!1);let s=0;if(a.preRelease){let l=xnn.exec(a.preRelease);if(l){let[,c,u,p,h,g]=l;s=Date.UTC(Number(c),Number(u)-1,Number(p),Number(h)||0,Number(g)||0)}}return{majorBase:i,majorMustEqual:e,minorBase:t,minorMustEqual:o,patchBase:n,patchMustEqual:r,isMinimum:a.hasGreaterEquals,notBefore:s}}function Enn(a,i,e){let t;typeof a=="string"?t=q_i(G_i(a)):t=a;let o;i instanceof Date?o=i.getTime():typeof i=="string"&&(o=new Date(i).getTime());let n;if(typeof e=="string"?n=q_i(G_i(e)):n=e,!t||!n)return!1;let r=t.majorBase,s=t.minorBase,l=t.patchBase,c=n.majorBase,u=n.minorBase,p=n.patchBase,h=n.notBefore,g=n.majorMustEqual,f=n.minorMustEqual,v=n.patchMustEqual;return n.isMinimum?r>c?!0:r<c?!1:s>u?!0:s<u||o&&o<h?!1:l>=p:(r===1&&c===0&&(!g||!f||!v)&&(c=1,u=0,p=0,g=!0,f=!1,v=!1),r<c?!1:r>c?!g:s<u?!1:s>u?!f:l<p?!1:l>p?!v:!(o&&o<h))}function Kvo(a,i,e,t,o,n){let r=[];if(typeof t.publisher<"u"&&typeof t.publisher!="string")return r.push([wt.Error,d(2307,null)]),r;if(typeof t.name!="string")return r.push([wt.Error,d(2306,null,"name")]),r;if(typeof t.version!="string")return r.push([wt.Error,d(2308,null,"version")]),r;if(!t.engines)return r.push([wt.Error,d(2299,null,"engines")]),r;if(typeof t.engines.vscode!="string")return r.push([wt.Error,d(2300,null,"engines.vscode")]),r;if(typeof t.extensionDependencies<"u"&&!K_i(t.extensionDependencies))return r.push([wt.Error,d(2302,null,"extensionDependencies")]),r;if(typeof t.extensionAffinity<"u"&&!K_i(t.extensionAffinity))return r.push([wt.Error,d(2301,null,"extensionAffinity")]),r;if(typeof t.activationEvents<"u"){if(!K_i(t.activationEvents))return r.push([wt.Error,d(2295,null,"activationEvents")]),r;if(typeof t.main>"u"&&typeof t.browser>"u")return r.push([wt.Error,d(2296,null,"activationEvents","main","browser")]),r}if(typeof t.extensionKind<"u"&&typeof t.main>"u"&&r.push([wt.Warning,d(2303,null,"extensionKind")]),typeof t.main<"u"){if(typeof t.main!="string")return r.push([wt.Error,d(2304,null,"main")]),r;{let c=Ve(e,t.main);Yr(c,e)||r.push([wt.Warning,d(2305,null,c.path,e.path)])}}if(typeof t.browser<"u"){if(typeof t.browser!="string")return r.push([wt.Error,d(2297,null,"browser")]),r;{let c=Ve(e,t.browser);Yr(c,e)||r.push([wt.Warning,d(2298,null,c.path,e.path)])}}if(!wDe(t.version))return r.push([wt.Error,d(2309,null)]),r;let s=[];if(!Tnn(a,i,t,o,s))for(let c of s)r.push([wt.Error,c]);if(n&&t.enabledApiProposals?.length){let c=[];if(!iQ([...t.enabledApiProposals],c))for(let u of c)r.push([wt.Error,u])}return r}function Tnn(a,i,e,t,o){return t||typeof e.main>"u"&&typeof e.browser>"u"?!0:Gvo(a,i,e.engines.vscode,o)}function oge(a,i,e){return a==="*"||Gvo(i,e,a)}function iQ(a,i){if(a.length===0)return!0;let e=Array.isArray(i)?i:void 0,t=(Array.isArray(i)?void 0:i)??k2,o=[],n=_io(a);for(let{proposalName:r,version:s}of n){if(!s)continue;t[r]?.version!==s&&o.push(r)}return o.length?(e&&(o.length===1?e.push(d(2293,null,o[0])):e.push(d(2294,null,o.slice(0,o.length-1).map(r=>`'${r}'`).join(", "),o[o.length-1]))),!1):!0}function Gvo(a,i,e,t=[]){let o=q_i(G_i(e));if(!o)return t.push(d(2313,null,e)),!1;if(o.majorBase===0){if(!o.majorMustEqual||!o.minorMustEqual)return t.push(d(2311,null,e)),!1}else if(!o.majorMustEqual)return t.push(d(2312,null,e)),!1;return Enn(a,i,o)?!0:(t.push(d(2310,null,a,e)),!1)}function K_i(a){if(!Array.isArray(a))return!1;for(let i=0,e=a.length;i<e;i++)if(typeof a[i]!="string")return!1;return!0}async function n1t(a,i,e,t,o,n,r){let s={"X-Market-Client-Id":`VSCode ${a}`,"User-Agent":`VSCode ${a} (${i.nameShort})`};if(EM(i,e)&&Yy(t)===3){let l=await k0(e,o,n);s["X-Market-User-Id"]=l,s["VSCode-SessionId"]=r.machineId||l}return s}var r1t=Ft?"web":DRt(xm,jye),c1t="X-Market-Search-Activity-Id",$_i="Activityid",j_i="Server",Q_i="X-Vss-E2eid",AC={Icon:"Microsoft.VisualStudio.Services.Icons.Default",Details:"Microsoft.VisualStudio.Services.Content.Details",Changelog:"Microsoft.VisualStudio.Services.Content.Changelog",Manifest:"Microsoft.VisualStudio.Code.Manifest",VSIX:"Microsoft.VisualStudio.Services.VSIXPackage",License:"Microsoft.VisualStudio.Services.Content.License",Repository:"Microsoft.VisualStudio.Services.Links.Source",Signature:"Microsoft.VisualStudio.Services.VsixSignature"},RU={Dependency:"Microsoft.VisualStudio.Code.ExtensionDependencies",ExtensionPack:"Microsoft.VisualStudio.Code.ExtensionPack",Engine:"Microsoft.VisualStudio.Code.Engine",PreRelease:"Microsoft.VisualStudio.Code.PreRelease",EnabledApiProposals:"Microsoft.VisualStudio.Code.EnabledApiProposals",LocalizedLanguages:"Microsoft.VisualStudio.Code.LocalizedLanguages",WebExtension:"Microsoft.VisualStudio.Code.WebExtension",SponsorLink:"Microsoft.VisualStudio.Code.SponsorLink",SupportLink:"Microsoft.VisualStudio.Services.Links.Support",ExecutesCode:"Microsoft.VisualStudio.Code.ExecutesCode",Private:"PrivateMarketplace"},Rnn=10,Lnn={pageNumber:1,pageSize:Rnn,sortBy:"NoneOrRelevance",sortOrder:0,flags:[],criteria:[],assetTypes:[]};var aAe=class a{constructor(i=Lnn){this.state=i}get pageNumber(){return this.state.pageNumber}get pageSize(){return this.state.pageSize}get sortBy(){return this.state.sortBy}get sortOrder(){return this.state.sortOrder}get flags(){return this.state.flags}get criteria(){return this.state.criteria}get assetTypes(){return this.state.assetTypes}get source(){return this.state.source}get searchText(){let i=this.state.criteria.filter(e=>e.filterType==="SearchText")[0];return i&&i.value?i.value:""}withPage(i,e=this.state.pageSize){return new a({...this.state,pageNumber:i,pageSize:e})}withFilter(i,...e){let t=[...this.state.criteria,...e.length?e.map(o=>({filterType:i,value:o})):[{filterType:i}]];return new a({...this.state,criteria:t})}withSortBy(i){return new a({...this.state,sortBy:i})}withSortOrder(i){return new a({...this.state,sortOrder:i})}withFlags(...i){return new a({...this.state,flags:jo(i)})}withAssetTypes(...i){return new a({...this.state,assetTypes:i})}withSource(i){return new a({...this.state,source:i})}};function Y_i(a,i){let e=(a||[]).filter(t=>t.statisticName===i)[0];return e?e.value:0}function Mnn(a){let i="Microsoft.VisualStudio.Code.Translation.";return a.files.filter(t=>t.assetType.indexOf(i)===0).reduce((t,o)=>{let n=DU(a,o.assetType);return n&&t.push([o.assetType.substring(i.length),n]),t},[])}function Pnn(a){if(a.properties){let i=a.properties.filter(o=>o.key===AC.Repository),e=new RegExp("((git|ssh|http(s)?)|(git@[\\w.]+))(:(//)?)([\\w.@:/\\-~]+)(.git)(/)?"),t=i.filter(o=>e.test(o.value))[0];return t?{uri:t.value,fallbackUri:t.value}:null}return DU(a,AC.Repository)}function Ann(a){return{uri:`${a.fallbackAssetUri}/${AC.VSIX}?redirect=true${a.targetPlatform?`&targetPlatform=${a.targetPlatform}`:""}`,fallbackUri:`${a.fallbackAssetUri}/${AC.VSIX}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`}}function DU(a,i){return a.files.filter(t=>t.assetType===i)[0]?{uri:`${a.assetUri}/${i}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`,fallbackUri:`${a.fallbackAssetUri}/${i}${a.targetPlatform?`?targetPlatform=${a.targetPlatform}`:""}`}:null}function qvo(a,i){let e=a.properties?a.properties.filter(o=>o.key===i):[],t=e.length>0&&e[0].value;return t?t.split(",").map(o=>epe(o)):[]}function d1t(a){let i=a.properties?a.properties.filter(e=>e.key===RU.Engine):[];return i.length>0&&i[0].value||""}function Nnn(a,i){a.properties=a.properties??[],a.properties.push({key:RU.Engine,value:i})}function lAe(a){let i=a.properties?a.properties.filter(e=>e.key===RU.PreRelease):[];return i.length>0&&i[0].value==="true"}function Yvo(a,i){return i.extensionProperties?.[a.toLowerCase()]?.hasPrereleaseVersion}function Onn(a,i){return i.extensionProperties?.[a.toLowerCase()]?.excludeVersionRange}function Fnn(a){let i=a.properties?a.properties.filter(e=>e.key===RU.Private):[];return i.length>0&&i[0].value==="true"}function Wnn(a){let i=a.properties?a.properties.filter(e=>e.key===RU.ExecutesCode):[];return i.length>0?i[0].value==="true":void 0}function J_i(a){let i=a.properties?a.properties.filter(t=>t.key===RU.EnabledApiProposals):[],e=i.length>0&&i[0].value||"";return e?e.split(","):[]}function Vnn(a){let i=a.properties?a.properties.filter(t=>t.key===RU.LocalizedLanguages):[],e=i.length>0&&i[0].value||"";return e?e.split(","):[]}function Bnn(a){return a.properties?.find(i=>i.key===RU.SponsorLink)?.value}function Hnn(a){return a.properties?.find(i=>i.key===RU.SupportLink)?.value}function Unn(a){return a.indexOf("preview")!==-1}function nge(a){return a.targetPlatform?Dno(a.targetPlatform):"undefined"}function s1t(a){let i=jo(a.versions.map(nge)),e=!!a.tags?.includes(TRt),t=i.indexOf("web");return e?t===-1&&i.push("web"):t!==-1&&i.splice(t,1),i}function $vo(a,i){for(let e=0;e<a.length;e++){let t=a[e];if(t.version===a[e-1]?.version){let o=e;if(nge(t)===i)for(;o>0&&a[o-1].version===t.version;)o--;o!==e&&(a.splice(e,1),a.splice(o,0,t))}}return a}function znn(a,i,e){let t=[],o=-1,n=-1;for(let r of a){let s=nge(r);if(!Yue(s,e,i)){t.push(r);continue}lAe(r)?o===-1?(o=t.length,t.push(r)):s===i&&t[o].version===r.version&&(t[o]=r):n===-1?(n=t.length,t.push(r)):s===i&&t[n].version===r.version&&(t[n]=r)}return t}function jvo(a,i,e){a.telemetryData={index:i,querySource:e,queryActivityId:a.queryContext?.[c1t]}}function X_i(a,i,e,t,o,n){let r=a.versions[0],s={manifest:DU(i,AC.Manifest),readme:DU(i,AC.Details),changelog:DU(i,AC.Changelog),license:DU(i,AC.License),repository:Pnn(i),download:Ann(i),icon:DU(i,AC.Icon),signature:DU(i,AC.Signature),coreTranslations:Mnn(i)},l=jA(t,a.linkType??"ExtensionDetailsViewUriTemplate"),c=jA(t,a.publisher.linkType??"PublisherViewUriTemplate"),u=jA(t,a.ratingLinkType??"ExtensionRatingViewUriTemplate"),p=gf(a.publisher.publisherName,a.extensionName);return{type:"gallery",identifier:{id:p,uuid:a.extensionId},name:a.extensionName,version:i.version,displayName:a.displayName,publisherId:a.publisher.publisherId,publisher:a.publisher.publisherName,publisherDisplayName:a.publisher.displayName,publisherDomain:a.publisher.domain?{link:a.publisher.domain,verified:!!a.publisher.isDomainVerified}:void 0,publisherSponsorLink:Bnn(r),description:a.shortDescription??"",installCount:Y_i(a.statistics,"install"),rating:Y_i(a.statistics,"averagerating"),ratingCount:Y_i(a.statistics,"ratingcount"),categories:a.categories||[],tags:a.tags||[],releaseDate:Date.parse(a.releaseDate),lastUpdated:Date.parse(a.lastUpdated),allTargetPlatforms:e,assets:s,properties:{dependencies:qvo(i,RU.Dependency),extensionPack:qvo(i,RU.ExtensionPack),engine:d1t(i),enabledApiProposals:J_i(i),localizedLanguages:Vnn(i),targetPlatform:nge(i),isPreReleaseVersion:lAe(i),executesCode:Wnn(i)},hasPreReleaseVersion:Yvo(p,o)??lAe(r),hasReleaseVersion:!0,private:Fnn(r),preview:Unn(a.flags),isSigned:!!s.signature,queryContext:n,supportLink:Hnn(r),detailsLink:l?rD(l,{publisher:a.publisher.publisherName,name:a.extensionName}):void 0,publisherLink:c?rD(c,{publisher:a.publisher.publisherName}):void 0,ratingLink:u?rD(u,{publisher:a.publisher.publisherName,name:a.extensionName}):void 0}}var Zte=class{constructor(i,e,t,o,n,r,s,l,c,u){this.requestService=e;this.logService=t;this.environmentService=o;this.telemetryService=n;this.fileService=r;this.productService=s;this.configurationService=l;this.allowedExtensionsService=c;this.extensionGalleryManifestService=u;this.extensionsControlUrl=s.extensionsGallery?.controlUrl,this.unpkgResourceApi=s.extensionsGallery?.extensionUrlTemplate,this.extensionsEnabledWithApiProposalVersion=s.extensionsEnabledWithApiProposalVersion?.map(p=>p.toLowerCase())??[],this.commonHeadersPromise=n1t(s.version,s,this.environmentService,this.configurationService,this.fileService,i,this.telemetryService)}isEnabled(){return this.extensionGalleryManifestService.extensionGalleryManifestStatus==="available"}async getExtensions(i,e,t){let o=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!o)throw new Error("No extension gallery service configured.");let n=Ie.isCancellationToken(e)?{}:e,r=Ie.isCancellationToken(e)?e:t,s=this.getResourceApi(o),l=s?await this.getExtensionsUsingResourceApi(i,n,s,o,r):await this.getExtensionsUsingQueryApi(i,n,o,r),c=l.map(p=>p.identifier.uuid),u=[];for(let p of i)p.uuid&&!c.includes(p.uuid)&&u.push({...p,uuid:void 0});if(u.length){this.telemetryService.publicLog2("galleryService:additionalQueryByName",{count:u.length});let p=await this.getExtensionsUsingQueryApi(u,n,o,r);l.push(...p)}return l}getResourceApi(i){let e=jA(i,"ExtensionLatestVersionUriTemplate");if(e)return{uri:e,fallback:this.unpkgResourceApi}}async getExtensionsUsingQueryApi(i,e,t,o){let n=[],r=[],s=[],l=[],c=!0;for(let h of i)h.uuid?r.push(h.uuid):n.push(h.id),h.version?l.push({id:h.id,uuid:h.uuid,version:h.version}):s.push({id:h.id,uuid:h.uuid,includePreRelease:!!h.preRelease}),c=c&&!!h.hasPreRelease&&!h.preRelease;if(!r.length&&!n.length)return[];let u=new aAe().withPage(1,i.length);r.length&&(u=u.withFilter("ExtensionId",...r)),n.length&&(u=u.withFilter("ExtensionName",...n)),e.queryAllVersions&&(u=u.withFlags(...u.flags,"IncludeVersions")),e.source&&(u=u.withSource(e.source));let{extensions:p}=await this.queryGalleryExtensions(u,{targetPlatform:e.targetPlatform??r1t,includePreRelease:s,versions:l,compatible:!!e.compatible,productVersion:e.productVersion??{version:this.productService.version,date:this.productService.date},isQueryForReleaseVersionFromPreReleaseVersion:c},t,o);return e.source&&p.forEach((h,g)=>jvo(h,g,e.source)),p}async getExtensionsUsingResourceApi(i,e,t,o,n){let r=[],s=[],l=[];for(let c of i)Z4.test(c.id)&&(c.version?s.push(c):l.push(c));if(await Promise.all(l.map(async c=>{let u;try{u=await this.getLatestGalleryExtension(c,e,t,o,n),We(u)?u==="LATEST_IS_OUTDATED"?this.logService.debug(`Skipping query API fallback for extension ${c.id} because the latest gallery version is older than the current version`):(this.telemetryService.publicLog2("galleryService:fallbacktoquery",{extension:c.id,preRelease:!!c.preRelease,compatible:!!e.compatible,errorCode:u}),s.push(c)):r.push(u)}catch(p){if(p instanceof QT)switch(p.code){case"Offline":case"Cancelled":case"Timeout":throw p}this.logService.error(`Error while getting the latest version for the extension ${c.id}.`,Dn(p)),this.telemetryService.publicLog2("galleryService:fallbacktoquery",{extension:c.id,preRelease:!!c.preRelease,compatible:!!e.compatible,errorCode:p instanceof QT?p.code:"Unknown"}),s.push(c)}})),s.length){let c=await this.getExtensionsUsingQueryApi(s,e,o,n);r.push(...c)}return r}async getLatestGalleryExtension(i,e,t,o,n){let r=await this.getLatestRawGalleryExtensionWithFallback(i,t,n);if(!r)return"NOT_FOUND";let s=s1t(r),l=await this.getValidRawGalleryExtensionVersionFromLatestVersions(r,r.versions,i,e,s);if(!l){if(i.currentVersion){let c=r.versions.length>0?r.versions[0].version:void 0;if(c&&Clo(c,i.currentVersion))return"LATEST_IS_OUTDATED"}return"NOT_COMPATIBLE"}return X_i(r,l,s,o,this.productService)}async getValidRawGalleryExtensionVersionFromLatestVersions(i,e,t,o,n){let r=o.targetPlatform??r1t,s=znn(e,r,n),l=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!!o.compatible,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:t.preRelease?1:0},n);if(!t.preRelease)return l;let c=l,u=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!!o.compatible,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:0},n);if(c&&u)return BM(u.version,c.version)?u:c;if(o.compatible){if(u){let p=await this.getValidRawGalleryExtensionVersion(i,s,{targetPlatform:r,compatible:!1,productVersion:o.productVersion??{version:this.productService.version,date:this.productService.date},version:1},n);if(!p||BM(u.version,p.version))return u}return c}return c??u??null}async getCompatibleExtension(i,e,t,o={version:this.productService.version,date:this.productService.date}){return YTe(i.allTargetPlatforms,t)?null:await this.isExtensionCompatible(i,e,t)?i:this.allowedExtensionsService.isAllowed({id:i.identifier.id,publisherDisplayName:i.publisherDisplayName})!==!0?null:(await this.getExtensions([{...i.identifier,preRelease:e,hasPreRelease:i.hasPreReleaseVersion}],{compatible:!0,productVersion:o,queryAllVersions:!0,targetPlatform:t},Ie.None))[0]??null}async isExtensionCompatible(i,e,t,o={version:this.productService.version,date:this.productService.date}){return this.isValidVersion({id:i.identifier.id,version:i.version,isPreReleaseVersion:i.properties.isPreReleaseVersion,targetPlatform:i.properties.targetPlatform,manifestAsset:i.assets.manifest,engine:i.properties.engine,enabledApiProposals:i.properties.enabledApiProposals},{targetPlatform:t,compatible:!0,productVersion:o,version:e?2:0},i.publisherDisplayName,i.allTargetPlatforms)}async isValidVersion(i,{targetPlatform:e,compatible:t,productVersion:o,version:n},r,s){let l=Yvo(i.id,this.productService),c=Onn(i.id,this.productService);if(i.isPreReleaseVersion&&l===!1||c&&pXe(i.version,c))return!1;if(We(n)){if(i.version!==n)return!1}else if((n===0||n===1)&&i.isPreReleaseVersion!==(n===1))return!1;return!(e&&!Yue(i.targetPlatform,s,e)||t&&(this.allowedExtensionsService.isAllowed({id:i.id,publisherDisplayName:r,version:i.version,prerelease:i.isPreReleaseVersion,targetPlatform:i.targetPlatform})!==!0||!this.areApiProposalsCompatible(i.id,i.enabledApiProposals)||!await this.isEngineValid(i.id,i.version,i.engine,i.manifestAsset,o)))}areApiProposalsCompatible(i,e){return!e||!this.extensionsEnabledWithApiProposalVersion.includes(i.toLowerCase())?!0:iQ(e)}async isEngineValid(i,e,t,o,n){if(!t)try{t=await this.getEngine(i,e,o)}catch(r){return this.logService.error(`Error while getting the engine for the version ${e}.`,Dn(r)),!1}return t?oge(t,n.version,n.date):(this.logService.error(`Missing engine for the extension ${i} with version ${e}`),!1)}async getEngine(i,e,t){if(!t){this.logService.error(`Missing engine and manifest asset for the extension ${i} with version ${e}`);return}try{this.telemetryService.publicLog2("galleryService:engineFallback",{extension:i,extensionVersion:e});let o={"Accept-Encoding":"gzip"},n=await this.getAsset(i,t,AC.Manifest,e,"extensionGalleryService.engineVersion",{headers:o}),r=await Th(n);if(!r){this.logService.error(`Manifest was not found for the extension ${i} with version ${e}`);return}return r.engines.vscode}catch(o){this.logService.error(`Error while getting the engine for the version ${e}.`,Dn(o));return}}async query(i,e){let t=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!t)throw new Error("No extension gallery service configured.");let o=i.text||"",n=i.pageSize??50,r=new aAe().withPage(1,n);o?(o=o.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(p,h,g)=>(r=r.withFilter("Category",g||h),"")),o=o.replace(/\btag:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(p,h,g)=>(r=r.withFilter("Tag",g||h),"")),o=o.replace(/\bfeatured(\s+|\b|$)/g,()=>(r=r.withFilter("Featured"),"")),o=o.trim(),o&&(o=o.length<200?o:o.substring(0,200),r=r.withFilter("SearchText",o)),t.capabilities.extensionQuery.sorting?.some(p=>p.name==="NoneOrRelevance")&&(r=r.withSortBy("NoneOrRelevance"))):t.capabilities.extensionQuery.sorting?.some(p=>p.name==="InstallCount")&&(r=r.withSortBy("InstallCount")),i.sortBy&&t.capabilities.extensionQuery.sorting?.some(p=>p.name===i.sortBy)&&(r=r.withSortBy(i.sortBy)),typeof i.sortOrder=="number"&&(r=r.withSortOrder(i.sortOrder)),i.source&&(r=r.withSource(i.source));let s=async(p,h)=>{let{extensions:g,total:f}=await this.queryGalleryExtensions(p,{targetPlatform:r1t,compatible:!1,includePreRelease:!!i.includePreRelease,productVersion:i.productVersion??{version:this.productService.version,date:this.productService.date}},t,h),v=[],b;for(let S=0;S<g.length;S++){let y=g[S];jvo(y,(p.pageNumber-1)*p.pageSize+S,i.source),Ht(y.identifier,{id:this.productService.defaultChatAgent.extensionId})?b=y:v.push(y)}return b&&v.push(b),{extensions:v,total:f}},{extensions:l,total:c}=await s(r,e),u=async(p,h)=>{if(h.isCancellationRequested)throw new qi;let{extensions:g}=await s(r.withPage(p+1),h);return g};return{firstPage:l,total:c,pageSize:r.pageSize,getPage:u}}async queryGalleryExtensions(i,e,t,o){let n=i.flags;i.flags.includes("IncludeLatestVersionOnly")&&i.flags.includes("IncludeVersions")&&(i=i.withFlags(...i.flags.filter(h=>h!=="IncludeVersions"))),!i.flags.includes("IncludeLatestVersionOnly")&&!i.flags.includes("IncludeVersions")&&(i=i.withFlags(...i.flags,"IncludeLatestVersionOnly")),(e.versions?.length||e.isQueryForReleaseVersionFromPreReleaseVersion)&&(i=i.withFlags(...i.flags.filter(h=>h!=="IncludeLatestVersionOnly"),"IncludeVersions")),i=i.withFlags(...i.flags,"IncludeAssetUri","IncludeCategoryAndTags","IncludeFiles","IncludeStatistics","IncludeVersionProperties");let{galleryExtensions:r,total:s,context:l}=await this.queryRawGalleryExtensions(i,t,o);if(!i.flags.includes("IncludeLatestVersionOnly")){let h=[];for(let g of r){let f=s1t(g),v={id:gf(g.publisher.publisherName,g.extensionName),uuid:g.extensionId},b=Xa(e.includePreRelease)?e.includePreRelease:!!e.includePreRelease.find(y=>Ht(y,v))?.includePreRelease,S=await this.getValidRawGalleryExtensionVersion(g,g.versions,{compatible:e.compatible,targetPlatform:e.targetPlatform,productVersion:e.productVersion,version:e.versions?.find(y=>Ht(y,v))?.version??(b?2:0)},f);S&&h.push(X_i(g,S,f,t,this.productService,l))}return{extensions:h,total:s}}let u=[],p=new Map;for(let h=0;h<r.length;h++){let g=r[h],f={id:gf(g.publisher.publisherName,g.extensionName),uuid:g.extensionId},v=Xa(e.includePreRelease)?e.includePreRelease:!!e.includePreRelease.find(w=>Ht(w,f))?.includePreRelease,b=s1t(g);if(e.compatible&&(YTe(b,e.targetPlatform)||this.allowedExtensionsService.isAllowed({id:f.id,publisherDisplayName:g.publisher.displayName})!==!0))continue;let S=await this.getValidRawGalleryExtensionVersion(g,g.versions,{compatible:e.compatible,targetPlatform:e.targetPlatform,productVersion:e.productVersion,version:e.versions?.find(w=>Ht(w,f))?.version??(v?2:0)},b),y=S?X_i(g,S,b,t,this.productService,l):null;!y||y.properties.isPreReleaseVersion&&(!v||!y.hasReleaseVersion)||!y.properties.isPreReleaseVersion&&y.properties.targetPlatform!==e.targetPlatform&&y.hasPreReleaseVersion?p.set(g.extensionId,h):u.push([h,y])}if(p.size){let h=new On,g=new aAe().withFlags(...n.filter(v=>v!=="IncludeLatestVersionOnly"),"IncludeVersions").withPage(1,p.size).withFilter("ExtensionId",...p.keys()),{extensions:f}=await this.queryGalleryExtensions(g,e,t,o);this.telemetryService.publicLog2("galleryService:additionalQuery",{duration:h.elapsed(),count:p.size});for(let v of f){let b=p.get(v.identifier.uuid);u.push([b,v])}}return{extensions:u.sort((h,g)=>h[0]-g[0]).map(([,h])=>h),total:s}}async getValidRawGalleryExtensionVersion(i,e,t,o){let n={id:gf(i.publisher.publisherName,i.extensionName),uuid:i.extensionId},r=$vo(e,t.targetPlatform);if(t.compatible&&YTe(o,t.targetPlatform))return null;let s=We(t.version)?t.version:void 0;for(let l=0;l<r.length;l++){let c=r[l];if(t.compatible&&await this.setEngineIfNotExists(n.id,c),await this.isValidVersion({id:n.id,version:c.version,isPreReleaseVersion:lAe(c),targetPlatform:nge(c),engine:d1t(c),manifestAsset:DU(c,AC.Manifest),enabledApiProposals:J_i(c)},t,i.publisher.displayName,o))return c;if(s&&c.version===s)return null}return s||t.compatible?null:i.versions[0]}async setEngineIfNotExists(i,e){if(!d1t(e))try{let t=await this.getEngine(i,e.version,DU(e,AC.Manifest));t&&Nnn(e,t)}catch(t){this.logService.error(`Error while getting the engine for the version ${e.version}.`,Dn(t))}}async queryRawGalleryExtensions(i,e,t){let o=jA(e,"ExtensionQueryService");if(!o)throw new Error("No extension gallery query service configured.");i=i.withFlags(...i.flags,"ExcludeNonValidated").withFilter("Target","Microsoft.VisualStudio.Code");let n=e.capabilities.extensionQuery.flags?.find(g=>g.name==="Unpublished");n&&(i=i.withFilter("ExcludeWithFlags",String(n.value)));let r=JSON.stringify({filters:[{criteria:i.criteria.reduce((g,f)=>{let v=e.capabilities.extensionQuery.filtering?.find(b=>b.name===f.filterType);return v&&g.push({filterType:v.value,value:f.value}),g},[]),pageNumber:i.pageNumber,pageSize:i.pageSize,sortBy:e.capabilities.extensionQuery.sorting?.find(g=>g.name===i.sortBy)?.value,sortOrder:i.sortOrder}],assetTypes:i.assetTypes,flags:i.flags.reduce((g,f)=>{let v=e.capabilities.extensionQuery.flags?.find(b=>b.name===f);return v&&(g|=v.value),g},0)}),l={...await this.commonHeadersPromise,"Content-Type":"application/json",Accept:"application/json;api-version=3.0-preview.1","Accept-Encoding":"gzip","Content-Length":String(r.length)},c=new On,u,p,h=0;try{if(u=await this.requestService.request({type:"POST",url:o,data:r,headers:l,callSite:"extensionGalleryService.queryRawGalleryExtensions"},t),u.res.statusCode&&u.res.statusCode>=400&&u.res.statusCode<500)return{galleryExtensions:[],total:h};let g=await Th(u);if(g){let f=g.results[0],v=f.extensions,b=f.resultMetadata&&f.resultMetadata.filter(S=>S.metadataType==="ResultCount")[0];return h=b&&b.metadataItems.filter(S=>S.name==="TotalCount")[0].count||0,{galleryExtensions:v,total:h,context:u.res.headers.activityid?{[c1t]:u.res.headers.activityid}:{}}}return{galleryExtensions:[],total:h}}catch(g){if(Yi(g))throw p="Cancelled",g;{let f=Dn(g);throw p=Uit(g)?"Offline":f.startsWith("XHR timeout")?"Timeout":"Failed",new QT(f,p)}}finally{this.telemetryService.publicLog2("galleryService:query",{filterTypes:i.criteria.map(g=>g.filterType),flags:i.flags,sortBy:i.sortBy,sortOrder:String(i.sortOrder),pageNumber:String(i.pageNumber),source:i.source,searchTextLength:i.searchText.length,requestBodySize:String(r.length),duration:c.elapsed(),success:!!u&&pE(u),responseBodySize:u?.res.headers["Content-Length"],statusCode:u?String(u.res.statusCode):void 0,errorCode:p,count:String(h),server:this.getHeaderValue(u?.res.headers,j_i),activityId:this.getHeaderValue(u?.res.headers,$_i),endToEndId:this.getHeaderValue(u?.res.headers,Q_i)})}}getHeaderValue(i,e){let t=i?.[e.toLowerCase()],o=Array.isArray(t)?t[0]:t;return o?new lh(o):void 0}async getLatestRawGalleryExtensionWithFallback(i,e,t){let[o,n]=i.id.split("."),r;try{let s=A.parse(rD(e.uri,{publisher:o,name:n}));return await this.getLatestRawGalleryExtension(i.id,s,t)}catch(s){if(s instanceof QT)switch(r=s.code,s.code){case"Offline":case"Cancelled":case"Timeout":case"ClientError":throw s}else r="Unknown";if(!e.fallback)throw s}finally{this.telemetryService.publicLog2("galleryService:getmarketplacelatest",{extension:i.id,errorCode:r})}this.logService.error(`Error while getting the latest version for the extension ${i.id} from ${e.uri}. Trying the fallback ${e.fallback}`,r);try{let s=A.parse(rD(e.fallback,{publisher:o,name:n}));return await this.getLatestRawGalleryExtension(i.id,s,t)}catch(s){throw r=s instanceof QT?s.code:"Unknown",s}finally{this.telemetryService.publicLog2("galleryService:fallbacktounpkg",{extension:i.id,errorCode:r})}}async getLatestRawGalleryExtension(i,e,t){let o,n,r=new On;try{let l={...await this.commonHeadersPromise,"Content-Type":"application/json",Accept:"application/json;api-version=7.2-preview","Accept-Encoding":"gzip"};if(o=await this.requestService.request({type:"GET",url:e.toString(!0),headers:l,timeout:this.getRequestTimeout(),callSite:"extensionGalleryService.getLatestRawGalleryExtension"},t),o.res.statusCode===404)return n="NotFound",null;if(o.res.statusCode&&o.res.statusCode!==200)throw new Error("Unexpected HTTP response: "+o.res.statusCode);let c=await Th(o);return c||(n="NoData"),c}catch(s){let l;throw Yi(s)?l="Cancelled":Uit(s)?l="Offline":Dn(s).startsWith("XHR timeout")?l="Timeout":o&&Cpe(o)?l="ClientError":o&&Vso(o)?l="ServerError":l="Failed",n=l,new QT(s,l)}finally{this.telemetryService.publicLog2("galleryService:getLatest",{extension:i,host:e.authority,duration:r.elapsed(),errorCode:n,statusCode:o?.res.statusCode&&o?.res.statusCode!==200?`${o.res.statusCode}`:void 0,server:this.getHeaderValue(o?.res.headers,j_i),activityId:this.getHeaderValue(o?.res.headers,$_i),endToEndId:this.getHeaderValue(o?.res.headers,Q_i)})}}async reportStatistic(i,e,t,o){if(Ft){this.logService.info("ExtensionGalleryService#reportStatistic: Skipped in web");return}let n=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!n)return;let r=jA(n,"ExtensionStatisticsUriTemplate");if(!r)return;let s=rD(r,{publisher:i,name:e,version:t,statTypeName:o}),u={...await this.commonHeadersPromise,Accept:"*/*;api-version=4.0-preview.1"};try{await this.requestService.request({type:"POST",url:s,headers:u,callSite:"extensionGalleryService.reportStatistic"},Ie.None)}catch{}}async download(i,e,t){this.logService.trace("ExtensionGalleryService#download",i.identifier.id);let o=tpe(i),n=new Date().getTime(),r=t===2?"install":t===3?"update":"",s=r?{uri:`${i.assets.download.uri}${A.parse(i.assets.download.uri).query?"&":"?"}${r}=true`,fallbackUri:`${i.assets.download.fallbackUri}${A.parse(i.assets.download.fallbackUri).query?"&":"?"}${r}=true`}:i.assets.download,l=i.queryContext?.[c1t],c=l&&typeof l=="string"?{[c1t]:l}:void 0,u=await this.getAsset(i.identifier.id,s,AC.VSIX,i.version,"extensionGalleryService.download",c?{headers:c}:void 0);try{await this.fileService.writeFile(e,u.stream)}catch(p){try{await this.fileService.del(e)}catch(h){this.logService.warn(`Error while deleting the file ${e.toString()}`,Dn(h))}throw new QT(Dn(p),"DownloadFailedWriting")}this.telemetryService.publicLog("galleryService:downloadVSIX",{...o,duration:new Date().getTime()-n})}async downloadSignatureArchive(i,e){if(!i.assets.signature)throw new Error("No signature asset found");this.logService.trace("ExtensionGalleryService#downloadSignatureArchive",i.identifier.id);let t=await this.getAsset(i.identifier.id,i.assets.signature,AC.Signature,i.version,"extensionGalleryService.signature");try{await this.fileService.writeFile(e,t.stream)}catch(o){try{await this.fileService.del(e)}catch(n){this.logService.warn(`Error while deleting the file ${e.toString()}`,Dn(n))}throw new QT(Dn(o),"DownloadFailedWriting")}}async getReadme(i,e){if(i.assets.readme){let t=await this.getAsset(i.identifier.id,i.assets.readme,AC.Details,i.version,"extensionGalleryService.readme",{},e);return await gC(t)||""}return""}async getManifest(i,e){if(i.assets.manifest){let t=await this.getAsset(i.identifier.id,i.assets.manifest,AC.Manifest,i.version,"extensionGalleryService.manifest",{},e),o=await gC(t);return o?JSON.parse(o):null}return null}async getCoreTranslation(i,e){let t=i.assets.coreTranslations.filter(o=>o[0]===e.toUpperCase())[0];if(t){let o=await this.getAsset(i.identifier.id,t[1],t[0],i.version,"extensionGalleryService.coreTranslation"),n=await gC(o);return n?JSON.parse(n):null}return null}async getChangelog(i,e){if(i.assets.changelog){let t=await this.getAsset(i.identifier.id,i.assets.changelog,AC.Changelog,i.version,"extensionGalleryService.changelog",{},e);return await gC(t)||""}return""}async getAllVersions(i){return this.getVersions(i)}async getAllCompatibleVersions(i,e,t){return this.getVersions(i,{version:e?2:0,targetPlatform:t})}async getVersions(i,e){let t=await this.extensionGalleryManifestService.getExtensionGalleryManifest();if(!t)throw new Error("No extension gallery service configured.");let o=new aAe().withFlags("IncludeVersions","IncludeCategoryAndTags","IncludeFiles","IncludeVersionProperties").withPage(1,1);i.uuid?o=o.withFilter("ExtensionId",i.uuid):o=o.withFilter("ExtensionName",i.id);let{galleryExtensions:n}=await this.queryRawGalleryExtensions(o,t,Ie.None);if(!n.length)return[];let r=s1t(n[0]);if(e&&YTe(r,e.targetPlatform))return[];let s=[],l={version:this.productService.version,date:this.productService.date};await Promise.all(n[0].versions.map(async p=>{try{await this.isValidVersion({id:i.id,version:p.version,isPreReleaseVersion:lAe(p),targetPlatform:nge(p),engine:d1t(p),manifestAsset:DU(p,AC.Manifest),enabledApiProposals:J_i(p)},{compatible:!!e,productVersion:l,targetPlatform:e?.targetPlatform,version:e?.version??p.version},n[0].publisher.displayName,r)&&s.push(p)}catch{}}));let c=[],u=new Map;for(let p of $vo(s,e?.targetPlatform??r1t)){let h=u.get(p.version),g=h!==void 0?c[h]:void 0,f=nge(p);g?g.targetPlatforms.push(f):(u.set(p.version,c.length),c.push({version:p.version,date:p.lastUpdated,isPreReleaseVersion:lAe(p),targetPlatforms:[f]}))}return c}async getAsset(i,e,t,o,n,r={},s=Ie.None){let l=await this.commonHeadersPromise,c={type:"GET"},u={...l,...r.headers||{}};r={...r,...c,headers:u};let p=e.uri,h=e.fallbackUri,g={...r,url:p,timeout:this.getRequestTimeout(),callSite:n},f;try{if(f=await this.requestService.request(g,s),f.res.statusCode===200)return f;let v=await gC(f);throw new Error(`Expected 200, got back ${f.res.statusCode} instead.

${v}`)}catch(v){if(Yi(v))throw v;let b=Dn(v);this.telemetryService.publicLog2("galleryService:cdnFallback",{extension:i,assetType:t,message:b,extensionVersion:o,server:this.getHeaderValue(f?.res.headers,j_i),activityId:this.getHeaderValue(f?.res.headers,$_i),endToEndId:this.getHeaderValue(f?.res.headers,Q_i)});let S={...r,url:h,timeout:this.getRequestTimeout(),callSite:`${n}.fallback`};return this.requestService.request(S,s)}}async getExtensionsControlManifest(){if(!await this.extensionGalleryManifestService.getExtensionGalleryManifest())throw new Error("No extension gallery service configured.");if(!this.extensionsControlUrl)return{malicious:[],deprecated:{},search:[],autoUpdate:{}};let e=await this.requestService.request({type:"GET",url:this.extensionsControlUrl,timeout:this.getRequestTimeout(),callSite:"extensionGalleryService.getExtensionsControlManifest"},Ie.None);if(e.res.statusCode!==200)throw new Error("Could not get extensions report.");let t=await Th(e),o=[],n={},r=[],s=t?.autoUpdate??{};if(t){for(let l of t.malicious){if(!We(l))continue;let c=Z4.test(l)?{id:l}:l;o.push({extensionOrPublisher:c,learnMoreLink:t.learnMoreLinks?.[l]})}if(t.migrateToPreRelease)for(let[l,c]of Object.entries(t.migrateToPreRelease))(!c.engine||oge(c.engine,this.productService.version,this.productService.date))&&(n[l.toLowerCase()]={disallowInstall:!0,extension:{id:c.id,displayName:c.displayName,autoMigrate:{storage:!!c.migrateStorage},preRelease:!0}});if(t.deprecated)for(let[l,c]of Object.entries(t.deprecated))c&&(n[l.toLowerCase()]=Xa(c)?{}:c);if(t.search)for(let l of t.search)r.push(l)}return n[this.productService.defaultChatAgent.extensionId.toLowerCase()]={disallowInstall:!0,extension:{id:this.productService.defaultChatAgent.chatExtensionId,displayName:"GitHub Copilot Chat",autoMigrate:{storage:!1,donotDisable:!0},preRelease:this.productService.quality!=="stable"}},{malicious:o,deprecated:n,search:r,autoUpdate:s}}getRequestTimeout(){let i=this.configurationService.getValue(RRt);return on(i)&&i>=0?i:6e4}};Zte=I([m(1,Ra),m(2,re),m(3,ko),m(4,_e),m(5,ge),m(6,Ze),m(7,B),m(8,Mm),m(9,tb)],Zte);var a1t=class extends Zte{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,l,c,u)}};a1t=I([m(0,de),m(1,Ra),m(2,re),m(3,ko),m(4,_e),m(5,ge),m(6,Ze),m(7,B),m(8,Mm),m(9,tb)],a1t);var l1t=class extends Zte{constructor(i,e,t,o,n,r,s,l,c){super(void 0,i,e,t,o,n,r,s,l,c)}};l1t=I([m(0,Ra),m(1,re),m(2,ko),m(3,_e),m(4,ge),m(5,Ze),m(6,B),m(7,Mm),m(8,tb)],l1t);var Kit=class extends Zte{constructor(i,e,t,o,n,r,s,l,c,u){super(i,e,t,o,n,r,s,l,c,u)}};Kit=I([m(0,de),m(1,Ra),m(2,re),m(3,ko),m(4,_e),m(5,ge),m(6,Ze),m(7,B),m(8,Mm),m(9,tb)],Kit);Ce(ga,Kit,1);var iq=class extends k{constructor(e,t){super();this._onDidChangeEnablement=this._register(new T);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this.storageManager=this._register(new Git(e)),this._register(this.storageManager.onDidChange(o=>this._onDidChangeEnablement.fire({extensions:o,source:"storage"}))),this._register(t.onDidInstallExtensions(o=>o.forEach(({local:n,operation:r})=>{n&&r===4&&this._removeFromDisabledExtensions(n.identifier)})))}async enableExtension(e,t){return this._removeFromDisabledExtensions(e)?(this._onDidChangeEnablement.fire({extensions:[e],source:t}),!0):!1}async disableExtension(e,t){return this._addToDisabledExtensions(e)?(this._onDidChangeEnablement.fire({extensions:[e],source:t}),!0):!1}getDisabledExtensions(){return this._getExtensions(JJ)}async getDisabledExtensionsAsync(){return this.getDisabledExtensions()}_addToDisabledExtensions(e){let t=this.getDisabledExtensions();return t.every(o=>!Ht(o,e))?(t.push(e),this._setDisabledExtensions(t),!0):!1}_removeFromDisabledExtensions(e){let t=this.getDisabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ht(n,e))return t.splice(o,1),this._setDisabledExtensions(t),!0}return!1}_setDisabledExtensions(e){this._setExtensions(JJ,e)}_getExtensions(e){return this.storageManager.get(e,0)}_setExtensions(e,t){this.storageManager.set(e,t,0)}};iq=I([m(0,de),m(1,xs)],iq);var Git=class extends k{constructor(e){super();this.storageService=e;this.storage=Object.create(null);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(e.onDidChangeValue(0,void 0,this._store)(t=>this.onDidStorageChange(t)))}get(e,t){let o;return t===0?(mr(this.storage[e])&&(this.storage[e]=this._get(e,t)),o=this.storage[e]):o=this._get(e,t),JSON.parse(o)}set(e,t,o){let n=JSON.stringify(t.map(({id:s,uuid:l})=>({id:s,uuid:l})));this._get(e,o)!==n&&(o===0&&(t.length?this.storage[e]=n:delete this.storage[e]),this._set(e,t.length?n:void 0,o))}onDidStorageChange(e){if(!mr(this.storage[e.key])&&this._get(e.key,e.scope)!==this.storage[e.key]){let o=this.get(e.key,e.scope);delete this.storage[e.key];let n=this.get(e.key,e.scope),r=o.filter(l=>!n.some(c=>Ht(l,c))),s=n.filter(l=>!o.some(c=>Ht(c,l)));(r.length||s.length)&&this._onDidChange.fire([...r,...s])}}_get(e,t){return this.storageService.get(e,t,"[]")}_set(e,t,o){t?this.storageService.store(e,t,o,1):this.storageService.remove(e,o)}};function p1t(){let a=oe.as($t.Configuration).getConfigurationProperties();return Object.keys(a).filter(i=>!!a[i].disallowSyncIgnore)}function eie(a=!1){let i=oe.as($t.Configuration).getConfigurationProperties(),e=Knn(i,a),t=p1t();return jo([...e,...t])}function Knn(a,i){let e=new Set;for(let t in a){if(i&&a[t].source)continue;let o=We(a[t].scope)?OSt(a[t].scope):a[t].scope;(a[t].ignoreSync||o===2||o===7)&&e.add(t)}return[...e.values()]}var Xvo="settingsSync",Gnn="settingsSync.keybindingsPerPlatform";function Jvo(){let a="vscode://schemas/ignoredSettings",i=oe.as($t.Configuration);i.registerConfiguration({id:"settingsSync",order:30,title:d(2968,null),type:"object",properties:{[Gnn]:{type:"boolean",description:d(2971,null),default:!0,scope:1,tags:["sync","usesOnlineServices"]},"settingsSync.ignoredExtensions":{type:"array",markdownDescription:d(2969,null),items:[{type:"string",pattern:w0,errorMessage:d(2967,null)}],default:[],scope:1,uniqueItems:!0,disallowSyncIgnore:!0,tags:["sync","usesOnlineServices"]},"settingsSync.ignoredSettings":{type:"array",description:d(2970,null),default:[],scope:1,$ref:a,additionalProperties:!0,uniqueItems:!0,disallowSyncIgnore:!0,tags:["sync","usesOnlineServices"]}}});let e=oe.as(Ta.JSONContribution),t=()=>{let o=p1t(),n=eie(),r=Object.keys(Ay.properties).filter(c=>!n.includes(c)),s=n.filter(c=>!o.includes(c)),l={items:{type:"string",enum:[...r,...s.map(c=>`-${c}`)]}};e.registerSchema(a,l)};return i.onDidUpdateConfiguration(()=>t())}var Zvo="0";function ebo(a){return a&&Di(a)&&We(a.id)&&Array.isArray(a.scopes)}var rge=["settings","keybindings","snippets","prompts","tasks","extensions","globalState","profiles","mcp"];function Z_i(a,...i){return a?[a,...i]:i}function qit(a,i,e,t){return t.joinPath(e.userDataSyncHome,...Z_i(a,i,`lastSync${i}.json`))}var uP=le("IUserDataSyncStoreManagementService"),AW=le("IUserDataSyncStoreService"),tie=le("IUserDataSyncLocalStoreService"),LU="x-operation-id",eDi="X-Execution-Id";function $it(a){let i={};return i[eDi]=a,i}var Cf=class extends Error{constructor(e,t,o,n){super(e);this.code=t;this.resource=o;this.operationId=n;this.name=`${this.code} (UserDataSyncError) syncResource:${this.resource||"unknown"} operationId:${this.operationId||"unknown"}`}},mh=class extends Cf{constructor(e,t,o,n,r){super(e,o,void 0,r);this.url=t;this.serverCode=n}};(i=>{function a(e){if(e instanceof i)return e;let t=/^(.+) \(UserDataSyncError\) syncResource:(.+) operationId:(.+)$/.exec(e.name);if(t&&t[1]){let o=t[2]==="unknown"?void 0:t[2],n=t[3]==="unknown"?void 0:t[3];return new i(e.message,t[1],o,n)}return new i(e.message,"Unknown")}i.toUserDataSyncError=a})(Cf||={});var MU="sync.store.url.type";function sge(a){return`sync.enable.${a}`}var Yl=le("IUserDataSyncEnablementService"),ny=le("IUserDataSyncService"),cAe=le("IUserDataSyncResourceProviderService"),T_=le("IUserDataAutoSyncService"),iie=le("IUserDataSyncUtilService"),vw=le("IUserDataSyncLogService"),age="userDataSync",lk="vscode-userdata-sync",tbo="preview";var dAe=le("IUserDataSyncAccountService"),m1t=class extends k{constructor(e,t){super();this.userDataSyncStoreService=e;this.logService=t;this._onDidChangeAccount=this._register(new T);this.onDidChangeAccount=this._onDidChangeAccount.event;this._onTokenFailed=this._register(new T);this.onTokenFailed=this._onTokenFailed.event;this.wasTokenFailed=!1;this._register(e.onTokenFailed(o=>{this.logService.info("Settings Sync auth token failed",this.account?.authenticationProviderId,this.wasTokenFailed,o),this.updateAccount(void 0),o==="Forbidden"?this._onTokenFailed.fire(!0):this._onTokenFailed.fire(this.wasTokenFailed),this.wasTokenFailed=!0})),this._register(e.onTokenSucceed(()=>this.wasTokenFailed=!1))}get account(){return this._account}async updateAccount(e){(e&&this._account?e.token!==this._account.token||e.authenticationProviderId!==this._account.authenticationProviderId:e!==this._account)&&(this._account=e,this._account&&this.userDataSyncStoreService.setAuthToken(this._account.token,this._account.authenticationProviderId),this._onDidChangeAccount.fire(e))}};m1t=I([m(0,AW),m(1,vw)],m1t);var oQ=le("IExtensionBisectService"),jit=class a{constructor(i,e,t,o=(e+t)/2|0){this.extensions=i;this.low=e;this.high=t;this.mid=o}static fromJSON(i){if(i)try{let e=JSON.parse(i);return new a(e.extensions,e.low,e.high,e.mid)}catch{return}}},oq=class{constructor(i,e,t){this._storageService=e;this._envService=t;this._disabled=new Map;let o=e.get(oq._storageKey,-1);if(this._state=jit.fromJSON(o),this._state){let{mid:n,high:r}=this._state;for(let s=0;s<this._state.extensions.length;s++){let l=s>=n&&s<r;this._disabled.set(this._state.extensions[s],l)}i.warn("extension BISECT active",[...this._disabled])}}static{this._storageKey="extensionBisectState"}get isActive(){return!!this._state}get disabledCount(){return this._state?this._state.high-this._state.mid:-1}isDisabledByBisect(i){return!this._state||XEe(i.manifest,this._envService.remoteAuthority)||this._isEnabledInEnv(i)?!1:this._disabled.get(i.identifier.id)??!1}_isEnabledInEnv(i){return Array.isArray(this._envService.enableExtensions)&&this._envService.enableExtensions.some(e=>Ht({id:e},i.identifier))}async start(i){if(this._state)throw new Error("invalid state");let e=i.map(o=>o.identifier.id),t=new jit(e,0,e.length,0);this._storageService.store(oq._storageKey,JSON.stringify(t),-1,1),await this._storageService.flush()}async next(i){if(!this._state)throw new Error("invalid state");if(i&&this._state.mid===0&&this._state.high===this._state.extensions.length)return{bad:!0,id:""};if(this._state.low===this._state.high-1)return await this.reset(),{id:this._state.extensions[this._state.low],bad:i};let e=new jit(this._state.extensions,i?this._state.low:this._state.mid,i?this._state.mid:this._state.high);this._storageService.store(oq._storageKey,JSON.stringify(e),-1,1),await this._storageService.flush()}async reset(){this._storageService.remove(oq._storageKey,-1),await this._storageService.flush()}};oq=I([m(0,re),m(1,de),m(2,Mt)],oq);Ce(oQ,oq,1);var nq=class{constructor(i,e,t,o){this._extensionBisectService=e;this._notificationService=t;this._commandService=o;e.isActive&&(nq.ctxIsBisectActive.bindTo(i).set(!0),this._showBisectPrompt())}static{this.ctxIsBisectActive=new Y("isExtensionBisectActive",!1)}_showBisectPrompt(){let i={label:d(18853,null),run:()=>this._commandService.executeCommand("extension.bisect.next",!1)},e={label:d(18862,null),run:()=>this._commandService.executeCommand("extension.bisect.next",!0)},t={label:"Stop Bisect",run:()=>this._commandService.executeCommand("extension.bisect.stop")},o=this._extensionBisectService.disabledCount===1?d(18846,null):d(18845,null,this._extensionBisectService.disabledCount);this._notificationService.prompt(ft.Info,o,[i,e,t],{sticky:!0,priority:3})}};nq=I([m(0,X),m(1,oQ),m(2,Ne),m(3,fe)],nq);oe.as(Zi.Workbench).registerWorkbenchContribution(nq,3);W(class extends z{constructor(){super({id:"extension.bisect.start",title:P(18864,"Start Extension Bisect"),category:Fe.Help,f1:!0,precondition:nq.ctxIsBisectActive.negate(),menu:{id:R.ViewContainerTitle,when:C.equals("viewContainer","workbench.view.extensions"),group:"2_enablement",order:4}})}async run(a){let i=a.get(ct),e=a.get(ti),t=a.get(xs),o=a.get(As),n=a.get(oQ),r=(await t.getInstalled(1)).filter(l=>o.isEnabled(l));(await i.confirm({message:d(18855,null),detail:d(18848,null,2+Math.log2(r.length)|0),primaryButton:d(18856,null)})).confirmed&&(await n.start(r),e.reload())}});W(class extends z{constructor(){super({id:"extension.bisect.next",title:P(18863,"Continue Extension Bisect"),category:Fe.Help,f1:!0,precondition:nq.ctxIsBisectActive})}async run(a,i){let e=a.get(ct),t=a.get(ti),o=a.get(oQ),n=a.get(Ze),r=a.get(x2),s=a.get(fe);if(!o.isActive)return;if(i===void 0){let c=await this._checkForBad(e,o);if(c===null)return;i=c}if(i===void 0){await o.reset(),t.reload();return}let l=await o.next(i);if(!l){t.reload();return}if(l.bad)await e.info(d(18852,null),d(18850,null,n.nameShort));else{let c=await e.confirm({type:ft.Info,message:d(18852,null),primaryButton:d(18861,null),cancelButton:d(18847,null),detail:d(18849,null,l.id),checkbox:{label:d(18851,null),checked:!0}});c.checkboxChecked&&await r.disableExtension({id:l.id},void 0),c.confirmed&&await s.executeCommand("workbench.action.openIssueReporter",l.id)}await o.reset(),t.reload()}async _checkForBad(a,i){let{result:e}=await a.prompt({type:ft.Info,message:d(18854,null),detail:d(18844,null,i.disabledCount),buttons:[{label:d(18859,null),run:()=>!1},{label:d(18857,null),run:()=>!0},{label:d(18860,null),run:()=>{}}],cancelButton:{label:d(18858,null),run:()=>null}});return e}});W(class extends z{constructor(){super({id:"extension.bisect.stop",title:P(18865,"Stop Extension Bisect"),category:Fe.Help,f1:!0,precondition:nq.ctxIsBisectActive})}async run(a){let i=a.get(oQ),e=a.get(ti);await i.reset(),e.reload()}});var tDi="IWorkbenchExtensionEnablementService",iDi="chat.extensionUnification.enabled",Qit=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M){super();this.storageService=e;this.globalExtensionEnablementService=t;this.contextService=o;this.environmentService=n;this.extensionManagementService=r;this.configurationService=s;this.extensionManagementServerService=l;this.userDataSyncEnablementService=c;this.userDataSyncAccountService=u;this.lifecycleService=p;this.notificationService=h;this.extensionBisectService=f;this.allowedExtensionsService=v;this.workspaceTrustManagementService=b;this.workspaceTrustRequestService=S;this.extensionManifestPropertiesService=y;this.chatEntitlementService=w;this.logService=E;this._onEnablementChanged=this._register(new T);this.onEnablementChanged=this._onEnablementChanged.event;this.extensionsDisabledExtensions=[];this.delayer=this._register(new rn(0));this.storageManager=this._register(new Git(e));let N=this._register(U.filter(r.onDidUninstallExtension,K=>!K.error)(({identifier:K})=>this._reset(K))),V=!1;this._register(ee(()=>V=!0)),this.extensionsManager=this._register(x.createInstance(Yit)),this.extensionsManager.whenInitialized().then(()=>{V||(N.dispose(),this._onDidChangeExtensions([],[],!1),this._register(this.extensionsManager.onDidChangeExtensions(({added:K,removed:j,isProfileSwitch:J})=>this._onDidChangeExtensions(K,j,J))),this.loopCheckForMaliciousExtensions())}),this._register(this.globalExtensionEnablementService.onDidChangeEnablement(({extensions:K,source:j})=>this._onDidChangeGloballyDisabledExtensions(K,j))),this._register(v.onDidChangeAllowedExtensionsConfigValue(()=>this._onDidChangeExtensions([],[],!1))),this._completionsExtensionId=M.defaultChatAgent?.extensionId.toLowerCase(),this._chatExtensionId=M.defaultChatAgent?.chatExtensionId.toLowerCase(),this._sessionsWindowAllowedExtensions=new Set((M.sessionsWindowAllowedExtensions??[]).map(K=>K.toLowerCase()));let H=[this._completionsExtensionId,this._chatExtensionId].filter(K=>!!K);Ft&&this.environmentService.remoteAuthority===void 0?this._extensionUnificationEnabled=!1:this._extensionUnificationEnabled=this.configurationService.getValue(iDi),this._register(this.configurationService.onDidChangeConfiguration(K=>{K.affectsConfiguration(iDi)&&(this.configurationService.getValue(iDi)||(this._extensionUnificationEnabled=!1,this._onEnablementChanged.fire(this.extensionsManager.extensions.filter(J=>H.includes(J.identifier.id.toLowerCase())))))})),this.allUserExtensionsDisabled&&this.lifecycleService.when(4).then(()=>{this.notificationService.prompt(ft.Info,d(18877,null),[{label:d(18879,null),run:()=>g.reload({disableExtensions:!1})}],{sticky:!0,priority:3})}),this.ensureChatExtensionInitialDisabledState()}ensureChatExtensionInitialDisabledState(){if(!this._chatExtensionId||this.environmentService.isSessionsWindow||this.environmentService.skipBuiltinExtensions?.some(n=>n.toLowerCase()===this._chatExtensionId))return;let e="builtinChatExtensionEnablementMigration";if(this.storageService.getBoolean(e,0)===!0)return;this.logService.debug("Running builtin chat extension enablement migration"),this.storageService.store(e,!0,0,1);let o=this.chatEntitlementService.context;if(o)if(o.value.state.completed)this._isDisabledGlobally({id:this._chatExtensionId})&&this.configurationService.getValue("chat.disableAIFeatures")!==!0&&(this.logService.debug("Disabling AI features because builtin chat extension is disabled"),this.configurationService.updateValue("chat.disableAIFeatures",!0).catch(n=>this.logService.error("Failed to update chat.disableAIFeatures setting during builtin chat extension enablement migration",n)));else try{this.logService.debug("Disabling builtin chat extension as chat set up is not completed"),this._disableExtension({id:this._chatExtensionId})}catch(n){this.logService.error("Failed to disable builtin chat extension during enablement migration",n)}}get hasWorkspace(){return this.contextService.getWorkbenchState()!==1}get allUserExtensionsDisabled(){return this.environmentService.disableExtensions===!0}getEnablementState(e){return this._computeEnablementState(e,this.extensionsManager.extensions,this.getWorkspaceType())}getEnablementStates(e,t={}){let o=new Map,n={...this.getWorkspaceType(),...t};return e.map(r=>this._computeEnablementState(r,e,n,o))}getDependenciesEnablementStates(e){return ipe(this.extensionsManager.extensions,e).map(t=>[t,this.getEnablementState(t)])}canChangeEnablement(e){try{return this.throwErrorIfCannotChangeEnablement(e),!0}catch{return!1}}canChangeWorkspaceEnablement(e){if(!this.canChangeEnablement(e))return!1;try{return this.throwErrorIfCannotChangeWorkspaceEnablement(e),!0}catch{return!1}}throwErrorIfCannotChangeEnablement(e,t){if(gM(e.manifest))throw new Error(d(18876,null,e.manifest.displayName||e.identifier.id));if(this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncAccountService.account&&ghi(e.manifest)&&e.manifest.contributes.authentication.some(o=>o.id===this.userDataSyncAccountService.account.authenticationProviderId))throw new Error(d(18874,null,e.manifest.displayName||e.identifier.id));if(this._isEnabledInEnv(e))throw new Error(d(18869,null,e.manifest.displayName||e.identifier.id));this.throwErrorIfEnablementStateCannotBeChanged(e,this.getEnablementState(e),t)}throwErrorIfEnablementStateCannotBeChanged(e,t,o){switch(t){case 2:throw new Error(d(18866,null,e.manifest.displayName||e.identifier.id));case 4:throw new Error(d(18871,null,e.manifest.displayName||e.identifier.id));case 5:throw new Error(d(18872,null,e.manifest.displayName||e.identifier.id));case 1:throw new Error(d(18870,null,e.manifest.displayName||e.identifier.id));case 7:throw new Error(d(18867,null,e.manifest.displayName||e.identifier.id));case 6:throw new Error(d(18873,null,e.manifest.displayName||e.identifier.id));case 8:if(o)break;for(let n of ipe(this.extensionsManager.extensions,e))if(!this.isEnabled(n))throw new Error(d(18868,null,e.manifest.displayName||e.identifier.id,n.manifest.displayName||n.identifier.id))}}throwErrorIfCannotChangeWorkspaceEnablement(e){if(!this.hasWorkspace)throw new Error(d(18878,null));if(ghi(e.manifest))throw new Error(d(18875,null,e.manifest.displayName||e.identifier.id))}async setEnablement(e,t){await this.extensionsManager.whenInitialized(),(t===12||t===13)&&e.push(...this.getExtensionsToEnableRecursively(e,this.extensionsManager.extensions,t,{dependencies:!0,pack:!0}));let o=t===11||t===13;for(let s of e)o?this.throwErrorIfCannotChangeWorkspaceEnablement(s):this.throwErrorIfCannotChangeEnablement(s);let n=[];for(let s of e){let l=this.getEnablementState(s);if(l===0||l===8&&this.getDependenciesEnablementStates(s).every(([,c])=>this.isEnabledEnablementState(c)||c===0)){let c=await this.workspaceTrustRequestService.requestWorkspaceTrust();n.push(c??!1)}else n.push(await this._setUserEnablementState(s,t))}let r=e.filter((s,l)=>n[l]);return r.length&&this._onEnablementChanged.fire(r),n}getExtensionsToEnableRecursively(e,t,o,n,r=[]){if(!n.dependencies&&!n.pack)return[];let s=e.filter(c=>r.indexOf(c)===-1);if(!s.length)return[];for(let c of s)r.push(c);let l=[];for(let c of t){if(r.some(p=>Ht(p.identifier,c.identifier)))continue;let u=this.getEnablementState(c);if(!this.isEnabledEnablementState(u)&&u!==1&&e.some(p=>n.dependencies&&p.manifest.extensionDependencies?.some(h=>Ht({id:h},c.identifier))||n.pack&&p.manifest.extensionPack?.some(h=>Ht({id:h},c.identifier)))){let p=l.findIndex(h=>Ht(h.identifier,c.identifier));if(p===-1)l.push(c);else try{this.throwErrorIfEnablementStateCannotBeChanged(c,u,!0),l.splice(p,1,c)}catch{}}}return l.length&&l.push(...this.getExtensionsToEnableRecursively(l,t,o,n,r)),l}_setUserEnablementState(e,t){if(this._getUserEnablementState(e.identifier)===t)return Promise.resolve(!1);switch(t){case 12:this._enableExtension(e.identifier);break;case 10:this._disableExtension(e.identifier);break;case 13:this._enableExtensionInWorkspace(e.identifier);break;case 11:this._disableExtensionInWorkspace(e.identifier);break}return Promise.resolve(!0)}isEnabled(e){let t=this.getEnablementState(e);return this.isEnabledEnablementState(t)}isEnabledEnablementState(e){return e===3||e===13||e===12}isDisabledGlobally(e){return this._isDisabledGlobally(e.identifier)}_computeEnablementState(e,t,o,n){n=n??new Map;let r=n.get(e);if(r!==void 0)return r;e.identifier.id.toLowerCase()===this._chatExtensionId&&this.ensureChatExtensionInitialDisabledState(),r=this._getUserEnablementState(e.identifier);let s=this.isEnabledEnablementState(r);return jRt(e.identifier,this.getMaliciousExtensions().map(l=>({extensionOrPublisher:l})))?r=4:s&&e.type===1&&this.allowedExtensionsService.isAllowed(e)!==!0?r=7:s&&!e.isValid?r=6:this.extensionBisectService.isDisabledByBisect(e)?r=2:this._isDisabledInEnv(e)?r=2:this._isDisabledByVirtualWorkspace(e,o)?r=5:s&&this._isDisabledByWorkspaceTrust(e,o)?r=0:this._isDisabledByExtensionKind(e)?r=1:this._isDisabledBySessionsWindow(e)?r=2:s&&this._isDisabledByExtensionDependency(e,t,o,n)?r=8:this._isDisabledByUnification(e.identifier)?r=9:!s&&this._isEnabledInEnv(e)&&(r=3),n.set(e,r),r}_isDisabledInEnv(e){if(this.allUserExtensionsDisabled)return!e.isBuiltin&&!XEe(e.manifest,this.environmentService.remoteAuthority);let t=this.environmentService.disableExtensions;return Array.isArray(t)?t.some(o=>Ht({id:o},e.identifier)):!!Ht({id:Yno.value},e.identifier)}_isEnabledInEnv(e){let t=this.environmentService.enableExtensions;return Array.isArray(t)?t.some(o=>Ht({id:o},e.identifier)):!1}_isDisabledByVirtualWorkspace(e,t){return!(!t.virtual||this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(e.manifest)!==!1||this.extensionManagementServerService.getExtensionManagementServer(e)===this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWeb(e.manifest))}_isDisabledByExtensionKind(e){if(this.extensionManagementServerService.remoteExtensionManagementServer||this.extensionManagementServerService.webExtensionManagementServer){let t=this.extensionManagementServerService.getExtensionInstallLocation(e);for(let o of this.extensionManifestPropertiesService.getExtensionKind(e.manifest)){if(o==="ui"&&t===1||o==="workspace"&&t===2)return!1;if(o==="web"){if(this.extensionManagementServerService.webExtensionManagementServer){if(t===3||t===2)return!1}else if(t===1){let n=this.configurationService.getValue(XRt);if(n===!0||n==="auto")return!1}}}return!0}return!1}_isDisabledByWorkspaceTrust(e,t){return t.trusted?!1:this.contextService.isInsideWorkspace(e.location)?!0:this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(e.manifest)===!1}_isDisabledByExtensionDependency(e,t,o,n){if(!e.manifest.extensionDependencies)return!1;let r=t.filter(l=>e.manifest.extensionDependencies?.some(c=>Ht(l.identifier,{id:c})&&(this.extensionManagementServerService.getExtensionManagementServer(l)===this.extensionManagementServerService.getExtensionManagementServer(e)||(l.manifest.main||l.manifest.browser)&&l.manifest.api==="none")));if(!r.length)return!1;let s=n.has(e);s||n.set(e,12);try{for(let l of r){let c=this._computeEnablementState(l,t,o,n);if(!this.isEnabledEnablementState(c)&&c!==1)return!0}}finally{s||n.delete(e)}return!1}_getUserEnablementState(e){if(this.hasWorkspace){if(this._getWorkspaceEnabledExtensions().filter(t=>Ht(t,e))[0])return 13;if(this._getWorkspaceDisabledExtensions().filter(t=>Ht(t,e))[0])return 11}return this._isDisabledGlobally(e)?10:12}_isDisabledGlobally(e){return this.globalExtensionEnablementService.getDisabledExtensions().some(t=>Ht(t,e))}_isDisabledByUnification(e){return this._extensionUnificationEnabled&&e.id.toLowerCase()===this._completionsExtensionId}_isDisabledBySessionsWindow(e){if(!this.environmentService.isSessionsWindow||this._sessionsWindowAllowedExtensions.has(e.identifier.id.toLowerCase()))return!1;if(e.isBuiltin){if(e.identifier.id.toLowerCase()===this._chatExtensionId)return!1;let t=e.manifest.contributes;return!!(t?.debuggers||t?.views||t?.viewsContainers||t?.walkthroughs)}return!this.extensionManifestPropertiesService.canExecuteOnSessionsWindow(e.manifest)}_enableExtension(e){return this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.enableExtension(e,tDi)}_disableExtension(e){return this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.disableExtension(e,tDi)}_enableExtensionInWorkspace(e){this._removeFromWorkspaceDisabledExtensions(e),this._addToWorkspaceEnabledExtensions(e)}_disableExtensionInWorkspace(e){this._addToWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e)}_addToWorkspaceDisabledExtensions(e){if(!this.hasWorkspace)return Promise.resolve(!1);let t=this._getWorkspaceDisabledExtensions();return t.every(o=>!Ht(o,e))?(t.push(e),this._setDisabledExtensions(t),Promise.resolve(!0)):Promise.resolve(!1)}async _removeFromWorkspaceDisabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceDisabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ht(n,e))return t.splice(o,1),this._setDisabledExtensions(t),!0}return!1}_addToWorkspaceEnabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceEnabledExtensions();return t.every(o=>!Ht(o,e))?(t.push(e),this._setEnabledExtensions(t),!0):!1}_removeFromWorkspaceEnabledExtensions(e){if(!this.hasWorkspace)return!1;let t=this._getWorkspaceEnabledExtensions();for(let o=0;o<t.length;o++){let n=t[o];if(Ht(n,e))return t.splice(o,1),this._setEnabledExtensions(t),!0}return!1}_getWorkspaceEnabledExtensions(){return this._getExtensions(Qvi)}_setEnabledExtensions(e){this._setExtensions(Qvi,e)}_getWorkspaceDisabledExtensions(){return this._getExtensions(JJ)}_setDisabledExtensions(e){this._setExtensions(JJ,e)}_getExtensions(e){return this.hasWorkspace?this.storageManager.get(e,1):[]}_setExtensions(e,t){this.storageManager.set(e,t,1)}async _onDidChangeGloballyDisabledExtensions(e,t){if(t!==tDi){await this.extensionsManager.whenInitialized();let o=this.extensionsManager.extensions.filter(n=>e.some(r=>Ht(r,n.identifier)));this._onEnablementChanged.fire(o)}}_onDidChangeExtensions(e,t,o){let n=e.filter(s=>!this.isEnabledEnablementState(this.getEnablementState(s))),r=this.extensionsDisabledExtensions;this.extensionsDisabledExtensions=this.extensionsManager.extensions.filter(s=>{let l=this.getEnablementState(s);return l===8||l===7||l===4});for(let s of r)this.extensionsDisabledExtensions.every(l=>!Ht(l.identifier,s.identifier))&&n.push(s);for(let s of this.extensionsDisabledExtensions)r.every(l=>!Ht(l.identifier,s.identifier))&&n.push(s);n.length&&this._onEnablementChanged.fire(n),o||t.forEach(({identifier:s})=>this._reset(s))}async updateExtensionsEnablementsWhenWorkspaceTrustChanges(){await this.extensionsManager.whenInitialized();let e=s=>{let l=new Map;return this.extensionsManager.extensions.map(c=>[c,this._computeEnablementState(c,this.extensionsManager.extensions,s,l)])},t=this.getWorkspaceType(),o=e({...t,trusted:!0}),n=e({...t,trusted:!1}),r=o.filter(([,s],l)=>s!==n[l][1]).map(([s])=>s);r.length&&this._onEnablementChanged.fire(r)}getWorkspaceType(){return{trusted:this.workspaceTrustManagementService.isWorkspaceTrusted(),virtual:R0(this.contextService.getWorkspace())}}_reset(e){this._removeFromWorkspaceDisabledExtensions(e),this._removeFromWorkspaceEnabledExtensions(e),this.globalExtensionEnablementService.enableExtension(e)}loopCheckForMaliciousExtensions(){this.checkForMaliciousExtensions().then(()=>this.delayer.trigger(()=>{},1e3*60*5)).then(()=>this.loopCheckForMaliciousExtensions())}async checkForMaliciousExtensions(){try{let e=await this.extensionManagementService.getExtensionsControlManifest();this.storeMaliciousExtensions(e.malicious.map(({extensionOrPublisher:o})=>o))&&this._onDidChangeExtensions([],[],!1)}catch(e){this.logService.error(e)}}getMaliciousExtensions(){return this.storageService.getObject("extensionsEnablement/malicious",-1,[])}storeMaliciousExtensions(e){let t=this.getMaliciousExtensions();return eo(t,e,(o,n)=>!We(o)&&!We(n)?Ht(o,n):o===n)?!1:(this.storageService.store("extensionsEnablement/malicious",JSON.stringify(e),-1,1),!0)}};Qit=I([m(0,de),m(1,x2),m(2,Ae),m(3,Mt),m(4,xs),m(5,B),m(6,$c),m(7,Yl),m(8,dAe),m(9,to),m(10,Ne),m(11,ti),m(12,oQ),m(13,Mm),m(14,Or),m(15,lp),m(16,hm),m(17,dr),m(18,F),m(19,re),m(20,Ze)],Qit);var Yit=class extends k{constructor(e,t,o){super();this.extensionManagementService=e;this.extensionManagementServerService=t;this.logService=o;this._extensions=[];this._onDidChangeExtensions=this._register(new T);this.onDidChangeExtensions=this._onDidChangeExtensions.event;this.disposed=!1;this._register(ee(()=>this.disposed=!0)),this.initializePromise=this.initialize()}get extensions(){return this._extensions}whenInitialized(){return this.initializePromise}async initialize(){try{if(this._extensions=[...await this.extensionManagementService.getInstalled(),...await this.extensionManagementService.getInstalledWorkspaceExtensions(!0)],this.disposed)return;this._onDidChangeExtensions.fire({added:this.extensions,removed:[],isProfileSwitch:!1})}catch(e){this.logService.error(e)}this._register(this.extensionManagementService.onDidInstallExtensions(e=>this.updateExtensions(e.reduce((t,{local:o,operation:n})=>(o&&n!==4&&t.push(o),t),[]),[],void 0,!1))),this._register(U.filter(this.extensionManagementService.onDidUninstallExtension,(e=>!e.error))(e=>this.updateExtensions([],[e.identifier],e.server,!1))),this._register(this.extensionManagementService.onDidChangeProfile(({added:e,removed:t,server:o})=>{this.updateExtensions(e,t.map(({identifier:n})=>n),o,!0)}))}updateExtensions(e,t,o,n){if(e.length){for(let s of e){let l=this.extensionManagementServerService.getExtensionManagementServer(s),c=this._extensions.findIndex(u=>Ht(u.identifier,s.identifier)&&this.extensionManagementServerService.getExtensionManagementServer(u)===l);c!==-1&&this._extensions.splice(c,1)}this._extensions.push(...e)}let r=[];for(let s of t){let l=this._extensions.findIndex(c=>Ht(c.identifier,s)&&this.extensionManagementServerService.getExtensionManagementServer(c)===o);l!==-1&&r.push(...this._extensions.splice(l,1))}(e.length||r.length)&&this._onDidChangeExtensions.fire({added:e,removed:r,isProfileSwitch:n})}};Yit=I([m(0,Dd),m(1,$c),m(2,re)],Yit);Ce(As,Qit,1);function uAe(a,i,e,t){try{$nn(a,i,e,t)}catch(o){a.error(o?.message??o)}return i}function $nn(a,i,e,t){let o=(n,r,s)=>{let l=n[r];if(We(l)){let c=l,u=c.length;if(u>1&&c[0]==="%"&&c[u-1]==="%"){let p=c.substr(1,u-2),h=e[p];h===void 0&&t&&(h=t[p]);let g=typeof h=="string"?h:h?.message,f=t?.[p],v=typeof f=="string"?f:f?.message;if(!g){v||a.warn(`[${i.name}]: ${d(2276,null,p)}`);return}if(s&&(r==="title"||r==="category")&&v&&v!==g){let b={value:g,original:v};n[r]=b}else n[r]=g}}else if(Di(l))for(let c in l)l.hasOwnProperty(c)&&(c==="commands"?o(l,c,!0):o(l,c,s));else if(Array.isArray(l))for(let c=0;c<l.length;c++)o(l,c,s)};for(let n in i)i.hasOwnProperty(n)&&o(i,n)}var Xit=class{constructor(i,e,t,o,n){this.extensionResourceLoaderService=t;this.logService=n;this.builtinExtensionsPromises=[];if(Ft){let r=o.extensionsGallery?.nlsBaseUrl;r&&o.commit&&!SI.isDefaultVariant()&&(this.nlsUrl=A.joinPath(A.parse(r),o.commit,o.version,SI.value()));let s=In.asBrowserUri(p8i);if(s){let l=[];if(i.isBuilt)l=[{extensionPath:"TypeScriptTeam.jsts-chat-features",packageJSON:{name:"jsts-chat-features",displayName:"JS/TS Chat Features",description:"Provides extensions to VS Family to improve the Copilot experience in JavaScript and TypeScript contexts",publisher:"TypeScriptTeam",author:"Microsoft Corp.",private:!0,version:"0.0.2",icon:"logo.png",license:"SEE LICENSE IN LICENSE.txt",engines:{vscode:"^1.109.0"},categories:["AI","Programming Languages"],extensionKind:["workspace"],contributes:{chatSkills:[{path:"./skills/typescript-setup/SKILL.md",when:"config.jsts-chat-features.skills.enabled"}],configuration:{title:"JS/TS Chat Features",type:"object",properties:{"jsts-chat-features.skills.enabled":{type:"boolean",default:!1,description:"These skills provide helpful prompts and features to enhance your experience when using Copilot to work with JavaScript and TypeScript."}}}},files:["LICENSE.txt","README.md","logo.png","skills/typescript-setup/SKILL.md"],__metadata:{id:"7d881d23-233c-448d-9700-cf11a0de79c2",publisherId:{publisherId:"4f0355d2-4a53-4ab1-a8ea-507f4a333a6f",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},readmePath:"TypeScriptTeam.jsts-chat-features/readme.md"},{extensionPath:"bat",packageJSON:{name:"bat",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.52.0"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin mmims/language-batchfile grammars/batchfile.cson ./syntaxes/batchfile.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],configuration:"./language-configuration.json"}],grammars:[{language:"bat",scopeName:"source.batchfile",path:"./syntaxes/batchfile.tmLanguage.json"}],snippets:[{language:"bat",path:"./snippets/batchfile.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Windows Bat Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Windows batch files."}},{extensionPath:"clojure",packageJSON:{name:"clojure",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-clojure grammars/clojure.cson ./syntaxes/clojure.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"clojure",aliases:["Clojure","clojure"],extensions:[".clj",".cljs",".cljc",".cljx",".clojure",".edn"],configuration:"./language-configuration.json"}],grammars:[{language:"clojure",scopeName:"source.clojure",path:"./syntaxes/clojure.tmLanguage.json"}],configurationDefaults:{"[clojure]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Clojure Language Basics",description:"Provides syntax highlighting and bracket matching in Clojure files."}},{extensionPath:"coffeescript",packageJSON:{name:"coffeescript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-coffee-script grammars/coffeescript.cson ./syntaxes/coffeescript.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"coffeescript",extensions:[".coffee",".cson",".iced"],aliases:["CoffeeScript","coffeescript","coffee"],configuration:"./language-configuration.json"}],grammars:[{language:"coffeescript",scopeName:"source.coffee",path:"./syntaxes/coffeescript.tmLanguage.json"}],breakpoints:[{language:"coffeescript"}],snippets:[{language:"coffeescript",path:"./snippets/coffeescript.code-snippets"}],configurationDefaults:{"[coffeescript]":{"diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CoffeeScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in CoffeeScript files."}},{extensionPath:"configuration-editing",packageJSON:{name:"configuration-editing",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.0.0"},icon:"images/icon.png",activationEvents:["onProfile","onProfile:github","onLanguage:json","onLanguage:jsonc"],enabledApiProposals:["profileContentHandlers"],main:"./dist/configurationEditingMain",browser:"./dist/browser/configurationEditingMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{languages:[{id:"jsonc",extensions:[".code-workspace","language-configuration.json","icon-theme.json","color-theme.json"],filenames:["settings.json","launch.json","tasks.json","mcp.json","keybindings.json","extensions.json","argv.json","profiles.json","devcontainer.json",".devcontainer.json"]},{id:"json",extensions:[".code-profile"]}],jsonValidation:[{fileMatch:"vscode://defaultsettings/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"%APP_SETTINGS_HOME%/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/keybindings.json",url:"vscode://schemas/keybindings"},{fileMatch:"vscode://defaultsettings/*.json",url:"vscode://schemas/settings/default"},{fileMatch:"%APP_SETTINGS_HOME%/settings.json",url:"vscode://schemas/settings/user"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/settings.json",url:"vscode://schemas/settings/profile"},{fileMatch:"%MACHINE_SETTINGS_HOME%/settings.json",url:"vscode://schemas/settings/machine"},{fileMatch:"%APP_WORKSPACES_HOME%/*/workspace.json",url:"vscode://schemas/workspaceConfig"},{fileMatch:"**/*.code-workspace",url:"vscode://schemas/workspaceConfig"},{fileMatch:"**/argv.json",url:"vscode://schemas/argv"},{fileMatch:"/.vscode/settings.json",url:"vscode://schemas/settings/folder"},{fileMatch:"/.vscode/launch.json",url:"vscode://schemas/launch"},{fileMatch:"/.vscode/tasks.json",url:"vscode://schemas/tasks"},{fileMatch:"/.vscode/mcp.json",url:"vscode://schemas/mcp"},{fileMatch:"%APP_SETTINGS_HOME%/tasks.json",url:"vscode://schemas/tasks"},{fileMatch:"%APP_SETTINGS_HOME%/snippets/*.json",url:"vscode://schemas/snippets"},{fileMatch:"%APP_SETTINGS_HOME%/prompts/*.toolsets.jsonc",url:"vscode://schemas/toolsets"},{fileMatch:"%APP_SETTINGS_HOME%/profiles/*/snippets/.json",url:"vscode://schemas/snippets"},{fileMatch:"%APP_SETTINGS_HOME%/sync/snippets/preview/*.json",url:"vscode://schemas/snippets"},{fileMatch:"**/*.code-snippets",url:"vscode://schemas/global-snippets"},{fileMatch:"/.vscode/extensions.json",url:"vscode://schemas/extensions"},{fileMatch:"devcontainer.json",url:"https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json"},{fileMatch:".devcontainer.json",url:"https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json"},{fileMatch:"%APP_SETTINGS_HOME%/globalStorage/ms-vscode-remote.remote-containers/nameConfigs/*.json",url:"./schemas/attachContainer.schema.json"},{fileMatch:"%APP_SETTINGS_HOME%/globalStorage/ms-vscode-remote.remote-containers/imageConfigs/*.json",url:"./schemas/attachContainer.schema.json"},{fileMatch:"**/quality/*/product.json",url:"vscode://schemas/vscode-product"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Configuration Editing",description:"Provides capabilities (advanced IntelliSense, auto-fixing) in configuration files like settings, launch, and extension recommendation files."}},{extensionPath:"cpp",packageJSON:{name:"cpp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"c",extensions:[".c",".i"],aliases:["C","c"],configuration:"./language-configuration.json"},{id:"cpp",extensions:[".cpp",".cppm",".cc",".ccm",".cxx",".cxxm",".c++",".c++m",".hpp",".hh",".hxx",".h++",".h",".ii",".ino",".inl",".ipp",".ixx",".tpp",".txx",".hpp.in",".h.in"],aliases:["C++","Cpp","cpp"],configuration:"./language-configuration.json"},{id:"cuda-cpp",extensions:[".cu",".cuh"],aliases:["CUDA C++"],configuration:"./language-configuration.json"}],grammars:[{language:"c",scopeName:"source.c",path:"./syntaxes/c.tmLanguage.json"},{language:"cpp",scopeName:"source.cpp.embedded.macro",path:"./syntaxes/cpp.embedded.macro.tmLanguage.json"},{language:"cpp",scopeName:"source.cpp",path:"./syntaxes/cpp.tmLanguage.json"},{scopeName:"source.c.platform",path:"./syntaxes/platform.tmLanguage.json"},{language:"cuda-cpp",scopeName:"source.cuda-cpp",path:"./syntaxes/cuda-cpp.tmLanguage.json"}],problemPatterns:[{name:"nvcc-location",regexp:"^(.*)\\((\\d+)\\):\\s+(warning|error):\\s+(.*)",kind:"location",file:1,location:2,severity:3,message:4}],problemMatchers:[{name:"nvcc",owner:"cuda-cpp",fileLocation:["relative","${workspaceFolder}"],pattern:"$nvcc-location"}],snippets:[{language:"c",path:"./snippets/c.code-snippets"},{language:"cpp",path:"./snippets/cpp.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"C/C++ Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in C/C++ files."}},{extensionPath:"csharp",packageJSON:{name:"csharp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dotnet/csharp-tmLanguage grammars/csharp.tmLanguage ./syntaxes/csharp.tmLanguage.json"},categories:["Programming Languages"],contributes:{configurationDefaults:{"[csharp]":{"editor.maxTokenizationLineLength":2500}},languages:[{id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],configuration:"./language-configuration.json"}],grammars:[{language:"csharp",scopeName:"source.cs",path:"./syntaxes/csharp.tmLanguage.json",tokenTypes:{"meta.interpolation":"other"},unbalancedBracketScopes:["keyword.operator.relational.cs","keyword.operator.arrow.cs","punctuation.accessor.pointer.cs","keyword.operator.bitwise.shift.cs","keyword.operator.assignment.compound.bitwise.cs"]}],snippets:[{language:"csharp",path:"./snippets/csharp.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"C# Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in C# files."}},{extensionPath:"css",packageJSON:{name:"css",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin microsoft/vscode-css grammars/css.cson ./syntaxes/css.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"css",aliases:["CSS","css"],extensions:[".css"],mimetypes:["text/css"],configuration:"./language-configuration.json"}],grammars:[{language:"css",scopeName:"source.css",path:"./syntaxes/css.tmLanguage.json",tokenTypes:{"meta.function.url string.quoted":"other"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CSS Language Basics",description:"Provides syntax highlighting and bracket matching for CSS, LESS and SCSS files."}},{extensionPath:"css-language-features",packageJSON:{name:"css-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.77.0"},icon:"icons/css.png",activationEvents:["onLanguage:css","onLanguage:less","onLanguage:scss"],main:"./client/dist/node/cssClientMain",browser:"./client/dist/browser/cssClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},categories:["Programming Languages"],contributes:{configuration:[{order:22,id:"css",title:"%css.title%",properties:{"css.customData":{type:"array",markdownDescription:"%css.customData.desc%",default:[],items:{type:"string"},scope:"resource"},"css.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%css.completion.triggerPropertyValueCompletion.desc%"},"css.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%css.completion.completePropertyWithSemicolon.desc%"},"css.validate":{type:"boolean",scope:"resource",default:!0,description:"%css.validate.desc%"},"css.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%css.hover.documentation%"},"css.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%css.hover.references%"},"css.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.compatibleVendorPrefixes.desc%"},"css.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.vendorPrefix.desc%"},"css.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.duplicateProperties.desc%"},"css.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.emptyRules.desc%"},"css.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.importStatement.desc%"},"css.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.boxModel.desc%"},"css.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.universalSelector.desc%"},"css.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.zeroUnits.desc%"},"css.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%css.lint.fontFaceProperties.desc%"},"css.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%css.lint.hexColorLength.desc%"},"css.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%css.lint.argumentsInColorFunction.desc%"},"css.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.unknownProperties.desc%"},"css.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],markdownDescription:"%css.lint.validProperties.desc%"},"css.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.ieHack.desc%"},"css.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.unknownVendorSpecificProperties.desc%"},"css.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%css.lint.propertyIgnoredDueToDisplay.desc%"},"css.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.important.desc%"},"css.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%css.lint.float.desc%"},"css.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%css.lint.idSelector.desc%"},"css.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%css.lint.unknownAtRules.desc%"},"css.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%css.trace.server.desc%"},"css.format.enable":{type:"boolean",scope:"window",default:!0,description:"%css.format.enable.desc%"},"css.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.newlineBetweenSelectors.desc%"},"css.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.newlineBetweenRules.desc%"},"css.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%css.format.spaceAroundSelectorSeparator.desc%"},"css.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%css.format.braceStyle.desc%"},"css.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%css.format.preserveNewLines.desc%"},"css.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%css.format.maxPreserveNewLines.desc%"}}},{id:"scss",order:24,title:"%scss.title%",properties:{"scss.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%scss.completion.triggerPropertyValueCompletion.desc%"},"scss.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%scss.completion.completePropertyWithSemicolon.desc%"},"scss.validate":{type:"boolean",scope:"resource",default:!0,description:"%scss.validate.desc%"},"scss.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%scss.hover.documentation%"},"scss.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%scss.hover.references%"},"scss.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.compatibleVendorPrefixes.desc%"},"scss.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.vendorPrefix.desc%"},"scss.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.duplicateProperties.desc%"},"scss.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.emptyRules.desc%"},"scss.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.importStatement.desc%"},"scss.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.boxModel.desc%"},"scss.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.universalSelector.desc%"},"scss.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.zeroUnits.desc%"},"scss.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%scss.lint.fontFaceProperties.desc%"},"scss.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%scss.lint.hexColorLength.desc%"},"scss.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%scss.lint.argumentsInColorFunction.desc%"},"scss.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.unknownProperties.desc%"},"scss.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],markdownDescription:"%scss.lint.validProperties.desc%"},"scss.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.ieHack.desc%"},"scss.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.unknownVendorSpecificProperties.desc%"},"scss.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%scss.lint.propertyIgnoredDueToDisplay.desc%"},"scss.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.important.desc%"},"scss.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%scss.lint.float.desc%"},"scss.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%scss.lint.idSelector.desc%"},"scss.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%scss.lint.unknownAtRules.desc%"},"scss.format.enable":{type:"boolean",scope:"window",default:!0,description:"%scss.format.enable.desc%"},"scss.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.newlineBetweenSelectors.desc%"},"scss.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.newlineBetweenRules.desc%"},"scss.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%scss.format.spaceAroundSelectorSeparator.desc%"},"scss.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%scss.format.braceStyle.desc%"},"scss.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%scss.format.preserveNewLines.desc%"},"scss.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%scss.format.maxPreserveNewLines.desc%"}}},{id:"less",order:23,type:"object",title:"%less.title%",properties:{"less.completion.triggerPropertyValueCompletion":{type:"boolean",scope:"resource",default:!0,description:"%less.completion.triggerPropertyValueCompletion.desc%"},"less.completion.completePropertyWithSemicolon":{type:"boolean",scope:"resource",default:!0,description:"%less.completion.completePropertyWithSemicolon.desc%"},"less.validate":{type:"boolean",scope:"resource",default:!0,description:"%less.validate.desc%"},"less.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%less.hover.documentation%"},"less.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%less.hover.references%"},"less.lint.compatibleVendorPrefixes":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.compatibleVendorPrefixes.desc%"},"less.lint.vendorPrefix":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.vendorPrefix.desc%"},"less.lint.duplicateProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.duplicateProperties.desc%"},"less.lint.emptyRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.emptyRules.desc%"},"less.lint.importStatement":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.importStatement.desc%"},"less.lint.boxModel":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.boxModel.desc%"},"less.lint.universalSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.universalSelector.desc%"},"less.lint.zeroUnits":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.zeroUnits.desc%"},"less.lint.fontFaceProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%less.lint.fontFaceProperties.desc%"},"less.lint.hexColorLength":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%less.lint.hexColorLength.desc%"},"less.lint.argumentsInColorFunction":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"error",description:"%less.lint.argumentsInColorFunction.desc%"},"less.lint.unknownProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.unknownProperties.desc%"},"less.lint.validProperties":{type:"array",uniqueItems:!0,items:{type:"string"},scope:"resource",default:[],markdownDescription:"%less.lint.validProperties.desc%"},"less.lint.ieHack":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.ieHack.desc%"},"less.lint.unknownVendorSpecificProperties":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.unknownVendorSpecificProperties.desc%"},"less.lint.propertyIgnoredDueToDisplay":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",markdownDescription:"%less.lint.propertyIgnoredDueToDisplay.desc%"},"less.lint.important":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.important.desc%"},"less.lint.float":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",markdownDescription:"%less.lint.float.desc%"},"less.lint.idSelector":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"ignore",description:"%less.lint.idSelector.desc%"},"less.lint.unknownAtRules":{type:"string",scope:"resource",enum:["ignore","warning","error"],default:"warning",description:"%less.lint.unknownAtRules.desc%"},"less.format.enable":{type:"boolean",scope:"window",default:!0,description:"%less.format.enable.desc%"},"less.format.newlineBetweenSelectors":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.newlineBetweenSelectors.desc%"},"less.format.newlineBetweenRules":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.newlineBetweenRules.desc%"},"less.format.spaceAroundSelectorSeparator":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%less.format.spaceAroundSelectorSeparator.desc%"},"less.format.braceStyle":{type:"string",scope:"resource",default:"collapse",enum:["collapse","expand"],markdownDescription:"%less.format.braceStyle.desc%"},"less.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%less.format.preserveNewLines.desc%"},"less.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%less.format.maxPreserveNewLines.desc%"}}}],configurationDefaults:{"[css]":{"editor.suggest.insertMode":"replace"},"[scss]":{"editor.suggest.insertMode":"replace"},"[less]":{"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.css-data.json",url:"https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/master/docs/customData.schema.json"},{fileMatch:"package.json",url:"./schemas/package.schema.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"CSS Language Features",description:"Provides rich language support for CSS, LESS and SCSS files.","css.title":"CSS","css.customData.desc":`A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-css-languageservice/blob/master/docs/customData.md).

VS Code loads custom data on startup to enhance its CSS support for CSS custom properties (variables), at-rules, pseudo-classes, and pseudo-elements you specify in the JSON files.

The file paths are relative to workspace and only workspace folder settings are considered.`,"css.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","css.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","css.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","css.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","css.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","css.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","css.lint.emptyRules.desc":"Do not use empty rulesets.","css.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","css.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","css.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","css.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","css.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","css.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","css.lint.importStatement.desc":"Import statements do not load in parallel.","css.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","css.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","css.lint.unknownAtRules.desc":"Unknown at-rule.","css.lint.unknownProperties.desc":"Unknown property.","css.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","css.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","css.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","css.lint.zeroUnits.desc":"No unit for zero needed.","css.trace.server.desc":"Traces the communication between VS Code and the CSS language server.","css.validate.title":"Controls CSS validation and problem severities.","css.validate.desc":"Enables or disables all validations.","css.hover.documentation":"Show property and value documentation in CSS hovers.","css.hover.references":"Show references to MDN in CSS hovers.","css.format.enable.desc":"Enable/disable default CSS formatter.","css.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","css.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","css.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators `>`, `+`, `~` (e.g. `a > b`).","css.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","css.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","css.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#css.format.preserveNewLines#` is enabled.","less.title":"LESS","less.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","less.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","less.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","less.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","less.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","less.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","less.lint.emptyRules.desc":"Do not use empty rulesets.","less.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","less.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","less.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","less.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","less.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","less.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","less.lint.importStatement.desc":"Import statements do not load in parallel.","less.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","less.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","less.lint.unknownAtRules.desc":"Unknown at-rule.","less.lint.unknownProperties.desc":"Unknown property.","less.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","less.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","less.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","less.lint.zeroUnits.desc":"No unit for zero needed.","less.validate.title":"Controls LESS validation and problem severities.","less.validate.desc":"Enables or disables all validations.","less.hover.documentation":"Show property and value documentation in LESS hovers.","less.hover.references":"Show references to MDN in LESS hovers.","less.format.enable.desc":"Enable/disable default LESS formatter.","less.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","less.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","less.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators `>`, `+`, `~` (e.g. `a > b`).","less.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","less.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","less.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#less.format.preserveNewLines#` is enabled.","scss.title":"SCSS (Sass)","scss.completion.triggerPropertyValueCompletion.desc":"By default, VS Code triggers property value completion after selecting a CSS property. Use this setting to disable this behavior.","scss.completion.completePropertyWithSemicolon.desc":"Insert semicolon at end of line when completing CSS properties.","scss.lint.argumentsInColorFunction.desc":"Invalid number of parameters.","scss.lint.boxModel.desc":"Do not use `width` or `height` when using `padding` or `border`.","scss.lint.compatibleVendorPrefixes.desc":"When using a vendor-specific prefix make sure to also include all other vendor-specific properties.","scss.lint.duplicateProperties.desc":"Do not use duplicate style definitions.","scss.lint.emptyRules.desc":"Do not use empty rulesets.","scss.lint.float.desc":"Avoid using `float`. Floats lead to fragile CSS that is easy to break if one aspect of the layout changes.","scss.lint.fontFaceProperties.desc":"`@font-face` rule must define `src` and `font-family` properties.","scss.lint.hexColorLength.desc":"Hex colors must consist of 3, 4, 6 or 8 hex numbers.","scss.lint.idSelector.desc":"Selectors should not contain IDs because these rules are too tightly coupled with the HTML.","scss.lint.ieHack.desc":"IE hacks are only necessary when supporting IE7 and older.","scss.lint.important.desc":"Avoid using `!important`. It is an indication that the specificity of the entire CSS has gotten out of control and needs to be refactored.","scss.lint.importStatement.desc":"Import statements do not load in parallel.","scss.lint.propertyIgnoredDueToDisplay.desc":"Property is ignored due to the display. E.g. with `display: inline`, the `width`, `height`, `margin-top`, `margin-bottom`, and `float` properties have no effect.","scss.lint.universalSelector.desc":"The universal selector (`*`) is known to be slow.","scss.lint.unknownAtRules.desc":"Unknown at-rule.","scss.lint.unknownProperties.desc":"Unknown property.","scss.lint.validProperties.desc":"A list of properties that are not validated against the `unknownProperties` rule.","scss.lint.unknownVendorSpecificProperties.desc":"Unknown vendor specific property.","scss.lint.vendorPrefix.desc":"When using a vendor-specific prefix, also include the standard property.","scss.lint.zeroUnits.desc":"No unit for zero needed.","scss.validate.title":"Controls SCSS validation and problem severities.","scss.validate.desc":"Enables or disables all validations.","scss.hover.documentation":"Show property and value documentation in SCSS hovers.","scss.hover.references":"Show references to MDN in SCSS hovers.","scss.format.enable.desc":"Enable/disable default SCSS formatter.","scss.format.newlineBetweenSelectors.desc":"Separate selectors with a new line.","scss.format.newlineBetweenRules.desc":"Separate rulesets by a blank line.","scss.format.spaceAroundSelectorSeparator.desc":"Ensure a space character around selector separators `>`, `+`, `~` (e.g. `a > b`).","scss.format.braceStyle.desc":"Put braces on the same line as rules (`collapse`) or put braces on own line (`expand`).","scss.format.preserveNewLines.desc":"Whether existing line breaks before rules and declarations should be preserved.","scss.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk, when `#scss.format.preserveNewLines#` is enabled.","css.colorDecorators.enable.deprecationMessage":"The setting `css.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","scss.colorDecorators.enable.deprecationMessage":"The setting `scss.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","less.colorDecorators.enable.deprecationMessage":"The setting `less.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`."},readmePath:"css-language-features/README.md"},{extensionPath:"dart",packageJSON:{name:"dart",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dart-lang/dart-syntax-highlight grammars/dart.json ./syntaxes/dart.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"dart",extensions:[".dart"],aliases:["Dart"],configuration:"./language-configuration.json"}],grammars:[{language:"dart",scopeName:"source.dart",path:"./syntaxes/dart.tmLanguage.json"}]}},packageNLS:{displayName:"Dart Language Basics",description:"Provides syntax highlighting & bracket matching in Dart files."}},{extensionPath:"diff",packageJSON:{name:"diff",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/diff.tmbundle Syntaxes/Diff.plist ./syntaxes/diff.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"diff",aliases:["Diff","diff"],extensions:[".diff",".patch",".rej"],configuration:"./language-configuration.json"}],grammars:[{language:"diff",scopeName:"source.diff",path:"./syntaxes/diff.tmLanguage.json"}]}},packageNLS:{displayName:"Diff Language Basics",description:"Provides syntax highlighting & bracket matching in Diff files."}},{extensionPath:"docker",packageJSON:{name:"docker",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{},categories:["Programming Languages"],contributes:{languages:[{id:"dockerfile",extensions:[".dockerfile",".containerfile"],filenames:["Dockerfile","Containerfile"],filenamePatterns:["Dockerfile.*","Containerfile.*"],aliases:["Docker","Dockerfile","Containerfile"],configuration:"./language-configuration.json"}],grammars:[{language:"dockerfile",scopeName:"source.dockerfile",path:"./syntaxes/docker.tmLanguage.json"}],configurationDefaults:{"[dockerfile]":{"editor.quickSuggestions":{strings:!0}}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Docker Language Basics",description:"Provides syntax highlighting and bracket matching in Docker files."}},{extensionPath:"dotenv",packageJSON:{name:"dotenv",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin dotenv-org/dotenv-vscode syntaxes/dotenv.tmLanguage.json ./syntaxes/dotenv.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"dotenv",extensions:[".env"],filenames:[".env",".flaskenv","user-dirs.dirs"],filenamePatterns:[".env.*"],aliases:["Dotenv"],configuration:"./language-configuration.json"}],grammars:[{language:"dotenv",scopeName:"source.dotenv",path:"./syntaxes/dotenv.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Dotenv Language Basics",description:"Provides syntax highlighting and bracket matching in dotenv files."}},{extensionPath:"emmet",packageJSON:{name:"emmet",displayName:"Emmet",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.13.0"},icon:"images/icon.png",categories:["Other"],repository:{type:"git",url:"https://github.com/microsoft/vscode.git"},activationEvents:["onCommand:emmet.expandAbbreviation","onLanguage"],main:"./dist/node/emmetNodeMain",browser:"./dist/browser/emmetBrowserMain",contributes:{configuration:{type:"object",title:"Emmet",properties:{"emmet.showExpandedAbbreviation":{type:["string"],enum:["never","always","inMarkupAndStylesheetFilesOnly"],default:"always",markdownDescription:"%emmetShowExpandedAbbreviation%"},"emmet.showAbbreviationSuggestions":{type:"boolean",default:!0,scope:"language-overridable",markdownDescription:"%emmetShowAbbreviationSuggestions%"},"emmet.includeLanguages":{type:"object",additionalProperties:{type:"string"},default:{},markdownDescription:"%emmetIncludeLanguages%"},"emmet.variables":{type:"object",properties:{lang:{type:"string",default:"en"},charset:{type:"string",default:"UTF-8"}},additionalProperties:{type:"string"},default:{},markdownDescription:"%emmetVariables%"},"emmet.syntaxProfiles":{type:"object",default:{},markdownDescription:"%emmetSyntaxProfiles%"},"emmet.excludeLanguages":{type:"array",items:{type:"string"},default:["markdown"],markdownDescription:"%emmetExclude%"},"emmet.extensionsPath":{type:"array",items:{type:"string",markdownDescription:"%emmetExtensionsPathItem%"},default:[],scope:"machine-overridable",markdownDescription:"%emmetExtensionsPath%"},"emmet.triggerExpansionOnTab":{type:"boolean",default:!1,scope:"language-overridable",markdownDescription:"%emmetTriggerExpansionOnTab%"},"emmet.useInlineCompletions":{type:"boolean",default:!1,markdownDescription:"%emmetUseInlineCompletions%"},"emmet.preferences":{type:"object",default:{},markdownDescription:"%emmetPreferences%",properties:{"css.intUnit":{type:"string",default:"px",markdownDescription:"%emmetPreferencesIntUnit%"},"css.floatUnit":{type:"string",default:"em",markdownDescription:"%emmetPreferencesFloatUnit%"},"css.propertyEnd":{type:"string",default:";",markdownDescription:"%emmetPreferencesCssAfter%"},"sass.propertyEnd":{type:"string",default:"",markdownDescription:"%emmetPreferencesSassAfter%"},"stylus.propertyEnd":{type:"string",default:"",markdownDescription:"%emmetPreferencesStylusAfter%"},"css.valueSeparator":{type:"string",default:": ",markdownDescription:"%emmetPreferencesCssBetween%"},"sass.valueSeparator":{type:"string",default:": ",markdownDescription:"%emmetPreferencesSassBetween%"},"stylus.valueSeparator":{type:"string",default:" ",markdownDescription:"%emmetPreferencesStylusBetween%"},"bem.elementSeparator":{type:"string",default:"__",markdownDescription:"%emmetPreferencesBemElementSeparator%"},"bem.modifierSeparator":{type:"string",default:"_",markdownDescription:"%emmetPreferencesBemModifierSeparator%"},"filter.commentBefore":{type:"string",default:"",markdownDescription:"%emmetPreferencesFilterCommentBefore%"},"filter.commentAfter":{type:"string",default:`
<!-- /[#ID][.CLASS] -->`,markdownDescription:"%emmetPreferencesFilterCommentAfter%"},"filter.commentTrigger":{type:"array",default:["id","class"],markdownDescription:"%emmetPreferencesFilterCommentTrigger%"},"format.noIndentTags":{type:"array",default:["html"],markdownDescription:"%emmetPreferencesFormatNoIndentTags%"},"format.forceIndentationForTags":{type:"array",default:["body"],markdownDescription:"%emmetPreferencesFormatForceIndentTags%"},"profile.allowCompactBoolean":{type:"boolean",default:!1,markdownDescription:"%emmetPreferencesAllowCompactBoolean%"},"css.webkitProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssWebkitProperties%"},"css.mozProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssMozProperties%"},"css.oProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssOProperties%"},"css.msProperties":{type:"string",default:null,markdownDescription:"%emmetPreferencesCssMsProperties%"},"css.fuzzySearchMinScore":{type:"number",default:.3,markdownDescription:"%emmetPreferencesCssFuzzySearchMinScore%"},"output.inlineBreak":{type:"number",default:0,markdownDescription:"%emmetPreferencesOutputInlineBreak%"},"output.reverseAttributes":{type:"boolean",default:!1,markdownDescription:"%emmetPreferencesOutputReverseAttributes%"},"output.selfClosingStyle":{type:"string",enum:["html","xhtml","xml"],default:"html",markdownDescription:"%emmetPreferencesOutputSelfClosingStyle%"},"css.color.short":{type:"boolean",default:!0,markdownDescription:"%emmetPreferencesCssColorShort%"}}},"emmet.showSuggestionsAsSnippets":{type:"boolean",default:!1,markdownDescription:"%emmetShowSuggestionsAsSnippets%"},"emmet.optimizeStylesheetParsing":{type:"boolean",default:!0,markdownDescription:"%emmetOptimizeStylesheetParsing%"}}},commands:[{command:"editor.emmet.action.wrapWithAbbreviation",title:"%command.wrapWithAbbreviation%",category:"Emmet"},{command:"editor.emmet.action.removeTag",title:"%command.removeTag%",category:"Emmet"},{command:"editor.emmet.action.updateTag",title:"%command.updateTag%",category:"Emmet"},{command:"editor.emmet.action.matchTag",title:"%command.matchTag%",category:"Emmet"},{command:"editor.emmet.action.balanceIn",title:"%command.balanceIn%",category:"Emmet"},{command:"editor.emmet.action.balanceOut",title:"%command.balanceOut%",category:"Emmet"},{command:"editor.emmet.action.prevEditPoint",title:"%command.prevEditPoint%",category:"Emmet"},{command:"editor.emmet.action.nextEditPoint",title:"%command.nextEditPoint%",category:"Emmet"},{command:"editor.emmet.action.mergeLines",title:"%command.mergeLines%",category:"Emmet"},{command:"editor.emmet.action.selectPrevItem",title:"%command.selectPrevItem%",category:"Emmet"},{command:"editor.emmet.action.selectNextItem",title:"%command.selectNextItem%",category:"Emmet"},{command:"editor.emmet.action.splitJoinTag",title:"%command.splitJoinTag%",category:"Emmet"},{command:"editor.emmet.action.toggleComment",title:"%command.toggleComment%",category:"Emmet"},{command:"editor.emmet.action.evaluateMathExpression",title:"%command.evaluateMathExpression%",category:"Emmet"},{command:"editor.emmet.action.updateImageSize",title:"%command.updateImageSize%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByOneTenth",title:"%command.incrementNumberByOneTenth%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByOne",title:"%command.incrementNumberByOne%",category:"Emmet"},{command:"editor.emmet.action.incrementNumberByTen",title:"%command.incrementNumberByTen%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByOneTenth",title:"%command.decrementNumberByOneTenth%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByOne",title:"%command.decrementNumberByOne%",category:"Emmet"},{command:"editor.emmet.action.decrementNumberByTen",title:"%command.decrementNumberByTen%",category:"Emmet"},{command:"editor.emmet.action.reflectCSSValue",title:"%command.reflectCSSValue%",category:"Emmet"},{command:"workbench.action.showEmmetCommands",title:"%command.showEmmetCommands%",category:""}],menus:{commandPalette:[{command:"editor.emmet.action.wrapWithAbbreviation",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.removeTag",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.updateTag",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.matchTag",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.balanceIn",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.balanceOut",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.prevEditPoint",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.nextEditPoint",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.mergeLines",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.selectPrevItem",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.selectNextItem",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.splitJoinTag",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.toggleComment",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.evaluateMathExpression",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.updateImageSize",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByOneTenth",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByOne",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.incrementNumberByTen",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByOneTenth",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByOne",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.decrementNumberByTen",when:"activeEditor && !activeEditorIsReadonly"},{command:"editor.emmet.action.reflectCSSValue",when:"activeEditor && !activeEditorIsReadonly"}]}},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}}},packageNLS:{description:"Emmet support for VS Code","command.wrapWithAbbreviation":"Wrap with Abbreviation","command.removeTag":"Remove Tag","command.updateTag":"Update Tag","command.matchTag":"Go to Matching Pair","command.balanceIn":"Balance (inward)","command.balanceOut":"Balance (outward)","command.prevEditPoint":"Go to Previous Edit Point","command.nextEditPoint":"Go to Next Edit Point","command.mergeLines":"Merge Lines","command.selectPrevItem":"Select Previous Item","command.selectNextItem":"Select Next Item","command.splitJoinTag":"Split/Join Tag","command.toggleComment":"Toggle Comment","command.evaluateMathExpression":"Evaluate Math Expression","command.updateImageSize":"Update Image Size","command.reflectCSSValue":"Reflect CSS Value","command.incrementNumberByOne":"Increment by 1","command.decrementNumberByOne":"Decrement by 1","command.incrementNumberByOneTenth":"Increment by 0.1","command.decrementNumberByOneTenth":"Decrement by 0.1","command.incrementNumberByTen":"Increment by 10","command.decrementNumberByTen":"Decrement by 10","command.showEmmetCommands":"Show Emmet Commands",emmetSyntaxProfiles:"Define profile for specified syntax or use your own profile with specific rules.",emmetExclude:"An array of languages where Emmet abbreviations should not be expanded.",emmetExtensionsPath:`An array of paths, where each path can contain Emmet syntaxProfiles and/or snippet files.
In case of conflicts, the profiles/snippets of later paths will override those of earlier paths.
See https://code.visualstudio.com/docs/editor/emmet for more information and an example snippet file.`,emmetExtensionsPathItem:"A path containing Emmet syntaxProfiles and/or snippets.",emmetShowExpandedAbbreviation:'Shows expanded Emmet abbreviations as suggestions.\nThe option `"inMarkupAndStylesheetFilesOnly"` applies to html, haml, jade, slim, xml, xsl, css, scss, sass, less and stylus.\nThe option `"always"` applies to all parts of the file regardless of markup/css.',emmetShowAbbreviationSuggestions:'Shows possible Emmet abbreviations as suggestions. Not applicable in stylesheets or when emmet.showExpandedAbbreviation is set to `"never"`.',emmetIncludeLanguages:'Enable Emmet abbreviations in languages that are not supported by default. Add a mapping here between the language and Emmet supported language.\n For example: `{"vue-html": "html", "javascript": "javascriptreact"}`',emmetVariables:"Variables to be used in Emmet snippets.",emmetTriggerExpansionOnTab:"When enabled, Emmet abbreviations are expanded when pressing TAB, even when completions do not show up. When disabled, completions that show up can still be accepted by pressing TAB.",emmetPreferences:"Preferences used to modify behavior of some actions and resolvers of Emmet.",emmetPreferencesIntUnit:"Default unit for integer values.",emmetPreferencesFloatUnit:"Default unit for float values.",emmetPreferencesCssAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations.",emmetPreferencesSassAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Sass files.",emmetPreferencesStylusAfter:"Symbol to be placed at the end of CSS property when expanding CSS abbreviations in Stylus files.",emmetPreferencesCssBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations.",emmetPreferencesSassBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Sass files.",emmetPreferencesStylusBetween:"Symbol to be placed at the between CSS property and value when expanding CSS abbreviations in Stylus files.",emmetShowSuggestionsAsSnippets:"If `true`, then Emmet suggestions will show up as snippets allowing you to order them as per `#editor.snippetSuggestions#` setting.",emmetPreferencesBemElementSeparator:"Element separator used for classes when using the BEM filter.",emmetPreferencesBemModifierSeparator:"Modifier separator used for classes when using the BEM filter.",emmetPreferencesFilterCommentBefore:"A definition of comment that should be placed before matched element when comment filter is applied.",emmetPreferencesFilterCommentAfter:"A definition of comment that should be placed after matched element when comment filter is applied.",emmetPreferencesFilterCommentTrigger:"A comma-separated list of attribute names that should exist in the abbreviation for the comment filter to be applied.",emmetPreferencesFormatNoIndentTags:"An array of tag names that should never get inner indentation.",emmetPreferencesFormatForceIndentTags:"An array of tag names that should always get inner indentation.",emmetPreferencesAllowCompactBoolean:"If `true`, compact notation of boolean attributes are produced.",emmetPreferencesCssWebkitProperties:"Comma separated CSS properties that get the `webkit` vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the `webkit` prefix.",emmetPreferencesCssMozProperties:"Comma separated CSS properties that get the `moz` vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the `moz` prefix.",emmetPreferencesCssOProperties:"Comma separated CSS properties that get the `o` vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the `o` prefix.",emmetPreferencesCssMsProperties:"Comma separated CSS properties that get the `ms` vendor prefix when used in Emmet abbreviation that starts with `-`. Set to empty string to always avoid the `ms` prefix.",emmetPreferencesCssFuzzySearchMinScore:"The minimum score (from 0 to 1) that fuzzy-matched abbreviation should achieve. Lower values may produce many false-positive matches, higher values may reduce possible matches.",emmetOptimizeStylesheetParsing:"When set to `false`, the whole file is parsed to determine if current position is valid for expanding Emmet abbreviations. When set to `true`, only the content around the current position in CSS/SCSS/Less files is parsed.",emmetPreferencesOutputInlineBreak:"The number of sibling inline elements needed for line breaks to be placed between those elements. If `0`, inline elements are always expanded onto a single line.",emmetPreferencesOutputReverseAttributes:"If `true`, reverses attribute merging directions when resolving snippets.",emmetPreferencesOutputSelfClosingStyle:"Style of self-closing tags: html (`<br>`), xml (`<br/>`) or xhtml (`<br />`).",emmetPreferencesCssColorShort:"If `true`, color values like `#f` will be expanded to `#fff` instead of `#ffffff`.",emmetUseInlineCompletions:"If `true`, Emmet will use inline completions to suggest expansions. To prevent the non-inline completion item provider from showing up as often while this setting is `true`, turn `#editor.quickSuggestions#` to `inline` or `off` for the `other` item."},readmePath:"emmet/README.md"},{extensionPath:"extension-editing",packageJSON:{name:"extension-editing",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.4.0"},icon:"images/icon.png",activationEvents:["onLanguage:json","onLanguage:markdown"],main:"./dist/extensionEditingMain",browser:"./dist/browser/extensionEditingBrowserMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{jsonValidation:[{fileMatch:"package.json",url:"vscode://schemas/vscode-extensions"},{fileMatch:"*language-configuration.json",url:"vscode://schemas/language-configuration"},{fileMatch:["*icon-theme.json","!*product-icon-theme.json"],url:"vscode://schemas/icon-theme"},{fileMatch:"*product-icon-theme.json",url:"vscode://schemas/product-icon-theme"},{fileMatch:"*color-theme.json",url:"vscode://schemas/color-theme"}],languages:[{id:"ignore",filenames:[".vscodeignore"]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Extension Authoring",description:"Provides linting capabilities for authoring extensions."}},{extensionPath:"fsharp",packageJSON:{name:"fsharp",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin ionide/ionide-fsgrammar grammars/fsharp.json ./syntaxes/fsharp.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"fsharp",extensions:[".fs",".fsi",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],configuration:"./language-configuration.json"}],grammars:[{language:"fsharp",scopeName:"source.fsharp",path:"./syntaxes/fsharp.tmLanguage.json"}],snippets:[{language:"fsharp",path:"./snippets/fsharp.code-snippets"}],configurationDefaults:{"[fsharp]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"F# Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in F# files."}},{extensionPath:"git-base",packageJSON:{name:"git-base",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Other"],activationEvents:["*"],main:"./dist/extension.js",browser:"./dist/browser/extension.js",icon:"resources/icons/git.png",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{commands:[{command:"git-base.api.getRemoteSources",title:"%command.api.getRemoteSources%",category:"Git Base API"}],menus:{commandPalette:[{command:"git-base.api.getRemoteSources",when:"false"}]},languages:[{id:"git-commit",aliases:["Git Commit Message","git-commit"],filenames:["COMMIT_EDITMSG","MERGE_MSG"],configuration:"./languages/git-commit.language-configuration.json"},{id:"git-rebase",aliases:["Git Rebase Message","git-rebase"],filenames:["git-rebase-todo"],filenamePatterns:["**/rebase-merge/done"],configuration:"./languages/git-rebase.language-configuration.json"},{id:"ignore",aliases:["Ignore","ignore"],extensions:[".gitignore_global",".gitignore",".git-blame-ignore-revs"],configuration:"./languages/ignore.language-configuration.json"}],grammars:[{language:"git-commit",scopeName:"text.git-commit",path:"./syntaxes/git-commit.tmLanguage.json"},{language:"git-rebase",scopeName:"text.git-rebase",path:"./syntaxes/git-rebase.tmLanguage.json"},{language:"ignore",scopeName:"source.ignore",path:"./syntaxes/ignore.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Git Base",description:"Git static contributions and pickers.","command.api.getRemoteSources":"Get Remote Sources"},readmePath:"git-base/README.md"},{extensionPath:"github-authentication",packageJSON:{name:"github-authentication",displayName:"%displayName%",description:"%description%",publisher:"vscode",license:"MIT",version:"0.0.2",engines:{vscode:"^1.41.0"},icon:"images/icon.png",categories:["Other"],api:"none",extensionKind:["ui","workspace"],enabledApiProposals:["authIssuers","authProviderSpecific"],activationEvents:[],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",restrictedConfigurations:["github-enterprise.uri"]}},contributes:{authentication:[{label:"GitHub",id:"github",authorizationServerGlobs:["https://github.com/login/oauth"]},{label:"GitHub Enterprise Server",id:"github-enterprise",authorizationServerGlobs:["*"]}],configuration:[{title:"%config.github-enterprise.title%",properties:{"github-enterprise.uri":{type:"string",markdownDescription:"%config.github-enterprise.uri.description%",pattern:"^(?:$|(https?)://(?!github\\.com).*)"},"github-authentication.useElectronFetch":{type:"boolean",default:!0,scope:"application",markdownDescription:"%config.github-authentication.useElectronFetch.description%"},"github-authentication.preferDeviceCodeFlow":{type:"boolean",default:!1,scope:"application",markdownDescription:"%config.github-authentication.preferDeviceCodeFlow.description%"}}}]},aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",main:"./dist/extension.js",browser:"./dist/browser/extension.js",repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"GitHub Authentication",description:"GitHub Authentication Provider","config.github-enterprise.title":"GHE.com & GitHub Enterprise Server Authentication","config.github-enterprise.uri.description":`The URI for your GHE.com or GitHub Enterprise Server instance.

Examples:
* GHE.com: \`https://octocat.ghe.com\`
* GitHub Enterprise Server: \`https://github.octocat.com\`

> **Note:** This should _not_ be set to a GitHub.com URI. If your account exists on GitHub.com or is a GitHub Enterprise Managed User, you do not need any additional configuration and can simply log in to GitHub.`,"config.github-authentication.useElectronFetch.description":"When true, uses Electron's built-in fetch function for HTTP requests. When false, uses the Node.js global fetch function. This setting only applies when running in the Electron environment. **Note:** A restart is required for this setting to take effect.","config.github-authentication.preferDeviceCodeFlow.description":"When true, prioritize the device code flow for authentication instead of other available flows. This is useful for environments like WSL where the local server or URL handler flows may not work as expected."},readmePath:"github-authentication/README.md"},{extensionPath:"go",packageJSON:{name:"go",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin worlpaker/go-syntax syntaxes/go.tmLanguage.json ./syntaxes/go.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"go",extensions:[".go"],aliases:["Go"],configuration:"./language-configuration.json"}],grammars:[{language:"go",scopeName:"source.go",path:"./syntaxes/go.tmLanguage.json"}],configurationDefaults:{"[go]":{"editor.insertSpaces":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Go Language Basics",description:"Provides syntax highlighting and bracket matching in Go files."}},{extensionPath:"groovy",packageJSON:{name:"groovy",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/groovy.tmbundle Syntaxes/Groovy.tmLanguage ./syntaxes/groovy.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"groovy",aliases:["Groovy","groovy"],extensions:[".groovy",".gvy",".gradle",".jenkinsfile",".nf"],filenames:["Jenkinsfile"],filenamePatterns:["Jenkinsfile*"],firstLine:"^#!.*\\bgroovy\\b",configuration:"./language-configuration.json"}],grammars:[{language:"groovy",scopeName:"source.groovy",path:"./syntaxes/groovy.tmLanguage.json"}],snippets:[{language:"groovy",path:"./snippets/groovy.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Groovy Language Basics",description:"Provides snippets, syntax highlighting and bracket matching in Groovy files."}},{extensionPath:"handlebars",packageJSON:{name:"handlebars",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin daaain/Handlebars grammars/Handlebars.json ./syntaxes/Handlebars.tmLanguage.json"},categories:["Programming Languages"],extensionKind:["ui","workspace"],contributes:{languages:[{id:"handlebars",extensions:[".handlebars",".hbs",".hjs"],aliases:["Handlebars","handlebars"],mimetypes:["text/x-handlebars-template"],configuration:"./language-configuration.json"}],grammars:[{language:"handlebars",scopeName:"text.html.handlebars",path:"./syntaxes/Handlebars.tmLanguage.json"}],htmlLanguageParticipants:[{languageId:"handlebars",autoInsert:!0}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Handlebars Language Basics",description:"Provides syntax highlighting and bracket matching in Handlebars files."}},{extensionPath:"hlsl",packageJSON:{name:"hlsl",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin tgjones/shaders-tmLanguage grammars/hlsl.json ./syntaxes/hlsl.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"hlsl",extensions:[".hlsl",".hlsli",".fx",".fxh",".vsh",".psh",".cginc",".compute"],aliases:["HLSL","hlsl"],configuration:"./language-configuration.json"}],grammars:[{language:"hlsl",path:"./syntaxes/hlsl.tmLanguage.json",scopeName:"source.hlsl"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HLSL Language Basics",description:"Provides syntax highlighting and bracket matching in HLSL files."}},{extensionPath:"html",packageJSON:{name:"html",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"html",extensions:[".html",".htm",".shtml",".xhtml",".xht",".mdoc",".jsp",".asp",".aspx",".jshtm",".volt",".ejs",".rhtml"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template","application/xhtml+xml"],configuration:"./language-configuration.json"}],grammars:[{scopeName:"text.html.basic",path:"./syntaxes/html.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.css":"css","source.js":"javascript","source.python":"python","source.smarty":"smarty"},tokenTypes:{"meta.tag string.quoted":"other"}},{language:"html",scopeName:"text.html.derivative",path:"./syntaxes/html-derivative.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.css":"css","source.js":"javascript","source.python":"python","source.smarty":"smarty"},tokenTypes:{"meta.tag string.quoted":"other"}}],snippets:[{language:"html",path:"./snippets/html.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HTML Language Basics",description:"Provides syntax highlighting, bracket matching & snippets in HTML files."}},{extensionPath:"html-language-features",packageJSON:{name:"html-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.77.0"},icon:"icons/html.png",activationEvents:["onLanguage:html","onLanguage:handlebars"],enabledApiProposals:["extensionsAny"],main:"./client/dist/node/htmlClientMain",browser:"./client/dist/browser/htmlClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},categories:["Programming Languages"],contributes:{configuration:{id:"html",order:20,type:"object",title:"HTML",properties:{"html.completion.attributeDefaultValue":{type:"string",scope:"resource",enum:["doublequotes","singlequotes","empty"],enumDescriptions:["%html.completion.attributeDefaultValue.doublequotes%","%html.completion.attributeDefaultValue.singlequotes%","%html.completion.attributeDefaultValue.empty%"],default:"doublequotes",markdownDescription:"%html.completion.attributeDefaultValue%"},"html.customData":{type:"array",markdownDescription:"%html.customData.desc%",default:[],items:{type:"string"},scope:"resource"},"html.format.enable":{type:"boolean",scope:"window",default:!0,description:"%html.format.enable.desc%"},"html.format.wrapLineLength":{type:"integer",scope:"resource",default:120,description:"%html.format.wrapLineLength.desc%"},"html.format.unformatted":{type:["string","null"],scope:"resource",default:"wbr",markdownDescription:"%html.format.unformatted.desc%"},"html.format.contentUnformatted":{type:["string","null"],scope:"resource",default:"pre,code,textarea",markdownDescription:"%html.format.contentUnformatted.desc%"},"html.format.indentInnerHtml":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%html.format.indentInnerHtml.desc%"},"html.format.preserveNewLines":{type:"boolean",scope:"resource",default:!0,description:"%html.format.preserveNewLines.desc%"},"html.format.maxPreserveNewLines":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%html.format.maxPreserveNewLines.desc%"},"html.format.indentHandlebars":{type:"boolean",scope:"resource",default:!1,markdownDescription:"%html.format.indentHandlebars.desc%"},"html.format.extraLiners":{type:["string","null"],scope:"resource",default:"head, body, /html",markdownDescription:"%html.format.extraLiners.desc%"},"html.format.wrapAttributes":{type:"string",scope:"resource",default:"auto",enum:["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"],enumDescriptions:["%html.format.wrapAttributes.auto%","%html.format.wrapAttributes.force%","%html.format.wrapAttributes.forcealign%","%html.format.wrapAttributes.forcemultiline%","%html.format.wrapAttributes.alignedmultiple%","%html.format.wrapAttributes.preserve%","%html.format.wrapAttributes.preservealigned%"],description:"%html.format.wrapAttributes.desc%"},"html.format.wrapAttributesIndentSize":{type:["number","null"],scope:"resource",default:null,markdownDescription:"%html.format.wrapAttributesIndentSize.desc%"},"html.format.templating":{type:"boolean",scope:"resource",default:!1,description:"%html.format.templating.desc%"},"html.format.unformattedContentDelimiter":{type:"string",scope:"resource",default:"",markdownDescription:"%html.format.unformattedContentDelimiter.desc%"},"html.suggest.html5":{type:"boolean",scope:"resource",default:!0,description:"%html.suggest.html5.desc%"},"html.suggest.hideEndTagSuggestions":{type:"boolean",scope:"resource",default:!1,description:"%html.suggest.hideEndTagSuggestions.desc%"},"html.validate.scripts":{type:"boolean",scope:"resource",default:!0,description:"%html.validate.scripts%"},"html.validate.styles":{type:"boolean",scope:"resource",default:!0,description:"%html.validate.styles%"},"html.autoCreateQuotes":{type:"boolean",scope:"resource",default:!0,markdownDescription:"%html.autoCreateQuotes%"},"html.autoClosingTags":{type:"boolean",scope:"resource",default:!0,description:"%html.autoClosingTags%"},"html.hover.documentation":{type:"boolean",scope:"resource",default:!0,description:"%html.hover.documentation%"},"html.hover.references":{type:"boolean",scope:"resource",default:!0,description:"%html.hover.references%"},"html.mirrorCursorOnMatchingTag":{type:"boolean",scope:"resource",default:!1,description:"%html.mirrorCursorOnMatchingTag%",deprecationMessage:"%html.mirrorCursorOnMatchingTagDeprecationMessage%"},"html.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%html.trace.server.desc%"}}},configurationDefaults:{"[html]":{"editor.suggest.insertMode":"replace"},"[handlebars]":{"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.html-data.json",url:"https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/master/docs/customData.schema.json"},{fileMatch:"package.json",url:"./schemas/package.schema.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"HTML Language Features",description:"Provides rich language support for HTML and Handlebar files","html.customData.desc":`A list of relative file paths pointing to JSON files following the [custom data format](https://github.com/microsoft/vscode-html-languageservice/blob/master/docs/customData.md).

VS Code loads custom data on startup to enhance its HTML support for the custom HTML tags, attributes and attribute values you specify in the JSON files.

The file paths are relative to workspace and only workspace folder settings are considered.`,"html.format.enable.desc":"Enable/disable default HTML formatter.","html.format.wrapLineLength.desc":"Maximum amount of characters per line (0 = disable).","html.format.unformatted.desc":"List of tags, comma separated, that shouldn't be reformatted. `null` defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.","html.format.contentUnformatted.desc":"List of tags, comma separated, where the content shouldn't be reformatted. `null` defaults to the `pre` tag.","html.format.indentInnerHtml.desc":"Indent `<head>` and `<body>` sections.","html.format.preserveNewLines.desc":"Controls whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.","html.format.maxPreserveNewLines.desc":"Maximum number of line breaks to be preserved in one chunk. Use `null` for unlimited.","html.format.indentHandlebars.desc":"Format and indent `{{#foo}}` and `{{/foo}}`.","html.format.extraLiners.desc":'List of tags, comma separated, that should have an extra newline before them. `null` defaults to `"head, body, /html"`.',"html.format.wrapAttributes.desc":"Wrap attributes.","html.format.wrapAttributes.auto":"Wrap attributes only when line length is exceeded.","html.format.wrapAttributes.force":"Wrap each attribute except first.","html.format.wrapAttributes.forcealign":"Wrap each attribute except first and keep aligned.","html.format.wrapAttributes.forcemultiline":"Wrap each attribute.","html.format.wrapAttributes.alignedmultiple":"Wrap when line length is exceeded, align attributes vertically.","html.format.wrapAttributes.preserve":"Preserve wrapping of attributes.","html.format.wrapAttributes.preservealigned":"Preserve wrapping of attributes but align.","html.format.templating.desc":"Honor django, erb, handlebars and php templating language tags.","html.format.unformattedContentDelimiter.desc":"Keep text content together between this string.","html.format.wrapAttributesIndentSize.desc":"Indent wrapped attributes to after N characters. Use `null` to use the default indent size. Ignored if `#html.format.wrapAttributes#` is set to `aligned`.","html.suggest.html5.desc":"Controls whether the built-in HTML language support suggests HTML5 tags, properties and values.","html.suggest.hideEndTagSuggestions.desc":"Controls whether the built-in HTML language support suggests closing tags. When disabled, end tag completions like `</div>` will not be shown.","html.trace.server.desc":"Traces the communication between VS Code and the HTML language server.","html.validate.scripts":"Controls whether the built-in HTML language support validates embedded scripts.","html.validate.styles":"Controls whether the built-in HTML language support validates embedded styles.","html.autoCreateQuotes":"Enable/disable auto creation of quotes for HTML attribute assignment. The type of quotes can be configured by `#html.completion.attributeDefaultValue#`.","html.autoClosingTags":"Enable/disable autoclosing of HTML tags.","html.completion.attributeDefaultValue":"Controls the default value for attributes when completion is accepted.","html.completion.attributeDefaultValue.doublequotes":'Attribute value is set to "".',"html.completion.attributeDefaultValue.singlequotes":"Attribute value is set to ''.","html.completion.attributeDefaultValue.empty":"Attribute value is not set.","html.mirrorCursorOnMatchingTag":"Enable/disable mirroring cursor on matching HTML tag.","html.mirrorCursorOnMatchingTagDeprecationMessage":"Deprecated in favor of `editor.linkedEditing`","html.hover.documentation":"Show tag and attribute documentation in hover.","html.hover.references":"Show references to MDN in hover."},readmePath:"html-language-features/README.md"},{extensionPath:"ini",packageJSON:{name:"ini",displayName:"%displayName%",description:"%description%",version:"10.0.0",private:!0,publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/ini.tmbundle Syntaxes/Ini.plist ./syntaxes/ini.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"ini",extensions:[".ini"],aliases:["Ini","ini"],configuration:"./ini.language-configuration.json"},{id:"properties",extensions:[".conf",".properties",".cfg",".directory",".gitattributes",".gitconfig",".gitmodules",".editorconfig",".repo"],filenames:["gitconfig"],filenamePatterns:["**/.config/git/config","**/.git/config"],aliases:["Properties","properties"],configuration:"./properties.language-configuration.json"}],grammars:[{language:"ini",scopeName:"source.ini",path:"./syntaxes/ini.tmLanguage.json"},{language:"properties",scopeName:"source.ini",path:"./syntaxes/ini.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Ini Language Basics",description:"Provides syntax highlighting and bracket matching in Ini files."}},{extensionPath:"ipynb",packageJSON:{name:"ipynb",displayName:"%displayName%",description:"%description%",publisher:"vscode",version:"10.0.0",license:"MIT",icon:"media/icon.png",engines:{vscode:"^1.57.0"},enabledApiProposals:["diffContentOptions"],activationEvents:["onNotebook:jupyter-notebook","onNotebookSerializer:interactive","onNotebookSerializer:repl"],extensionKind:["workspace","ui"],main:"./dist/ipynbMain.node.js",browser:"./dist/browser/ipynbMain.browser.js",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{configuration:[{properties:{"ipynb.pasteImagesAsAttachments.enabled":{type:"boolean",scope:"resource",markdownDescription:"%ipynb.pasteImagesAsAttachments.enabled%",default:!0},"ipynb.experimental.serialization":{type:"boolean",scope:"resource",markdownDescription:"%ipynb.experimental.serialization%",default:!0,tags:["experimental"]}}}],commands:[{command:"ipynb.newUntitledIpynb",title:"%newUntitledIpynb.title%",shortTitle:"%newUntitledIpynb.shortTitle%",category:"Create"},{command:"ipynb.openIpynbInNotebookEditor",title:"%openIpynbInNotebookEditor.title%"},{command:"ipynb.cleanInvalidImageAttachment",title:"%cleanInvalidImageAttachment.title%"},{command:"notebook.cellOutput.copy",title:"%copyCellOutput.title%",category:"Notebook"},{command:"notebook.cellOutput.addToChat",title:"%addCellOutputToChat.title%",category:"Notebook",enablement:"chatIsEnabled"},{command:"notebook.cellOutput.openInTextEditor",title:"%openCellOutput.title%",category:"Notebook"}],notebooks:[{type:"jupyter-notebook",displayName:"Jupyter Notebook",selector:[{filenamePattern:"*.ipynb"}],priority:"default"}],notebookRenderer:[{id:"vscode.markdown-it-cell-attachment-renderer",displayName:"%markdownAttachmentRenderer.displayName%",entrypoint:{extends:"vscode.markdown-it-renderer",path:"./notebook-out/cellAttachmentRenderer.js"}}],menus:{"file/newFile":[{command:"ipynb.newUntitledIpynb",group:"notebook"}],commandPalette:[{command:"ipynb.newUntitledIpynb"},{command:"ipynb.openIpynbInNotebookEditor",when:"false"},{command:"ipynb.cleanInvalidImageAttachment",when:"false"},{command:"notebook.cellOutput.copy",when:"notebookCellHasOutputs"},{command:"notebook.cellOutput.openInTextEditor",when:"false"}],"webview/context":[{command:"notebook.cellOutput.copy",when:"webviewId == 'notebook.output' && webviewSection == 'image'",group:"context@1"},{command:"notebook.cellOutput.copy",when:"webviewId == 'notebook.output' && webviewSection == 'text'"},{command:"notebook.cellOutput.addToChat",when:"webviewId == 'notebook.output' && (webviewSection == 'text' || webviewSection == 'image')",group:"context@2"},{command:"notebook.cellOutput.openInTextEditor",when:"webviewId == 'notebook.output' && webviewSection == 'text'"}]}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:".ipynb Support",description:"Provides basic support for opening and reading Jupyter's .ipynb notebook files","ipynb.pasteImagesAsAttachments.enabled":"Enable/disable pasting of images into Markdown cells in ipynb notebook files. Pasted images are inserted as attachments to the cell.","ipynb.experimental.serialization":"Experimental feature to serialize the Jupyter notebook in a worker thread.","newUntitledIpynb.title":"New Jupyter Notebook","newUntitledIpynb.shortTitle":"Jupyter Notebook","openIpynbInNotebookEditor.title":"Open IPYNB File In Notebook Editor","cleanInvalidImageAttachment.title":"Clean Invalid Image Attachment Reference","copyCellOutput.title":"Copy Cell Output","addCellOutputToChat.title":"Add Cell Output to Chat","openCellOutput.title":"Open Cell Output in Text Editor","markdownAttachmentRenderer.displayName":{message:"Markdown-It ipynb Cell Attachment renderer",comment:["Markdown-It is a product name and should not be translated"]}},readmePath:"ipynb/README.md"},{extensionPath:"java",packageJSON:{name:"java",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin redhat-developer/vscode-java language-support/java/java.tmLanguage.json ./syntaxes/java.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"java",extensions:[".java",".jav"],aliases:["Java","java"],configuration:"./language-configuration.json"}],grammars:[{language:"java",scopeName:"source.java",path:"./syntaxes/java.tmLanguage.json"}],snippets:[{language:"java",path:"./snippets/java.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Java Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Java files."}},{extensionPath:"javascript",packageJSON:{name:"javascript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{configurationDefaults:{"[javascript]":{"editor.maxTokenizationLineLength":2500}},languages:[{id:"javascriptreact",aliases:["JavaScript JSX","JavaScript React","jsx"],extensions:[".jsx"],configuration:"./javascript-language-configuration.json"},{id:"javascript",aliases:["JavaScript","javascript","js"],extensions:[".js",".es6",".mjs",".cjs",".pac"],filenames:["jakefile"],firstLine:"^#!.*\\bnode",mimetypes:["text/javascript"],configuration:"./javascript-language-configuration.json"},{id:"jsx-tags",aliases:[],configuration:"./tags-language-configuration.json"}],grammars:[{language:"javascriptreact",scopeName:"source.js.jsx",path:"./syntaxes/JavaScriptReact.tmLanguage.json",embeddedLanguages:{"meta.tag.js":"jsx-tags","meta.tag.without-attributes.js":"jsx-tags","meta.tag.attributes.js.jsx":"javascriptreact","meta.embedded.expression.js":"javascriptreact"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{language:"javascript",scopeName:"source.js",path:"./syntaxes/JavaScript.tmLanguage.json",embeddedLanguages:{"meta.tag.js":"jsx-tags","meta.tag.without-attributes.js":"jsx-tags","meta.tag.attributes.js":"javascript","meta.embedded.expression.js":"javascript"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{scopeName:"source.js.regexp",path:"./syntaxes/Regular Expressions (JavaScript).tmLanguage"}],semanticTokenScopes:[{language:"javascript",scopes:{property:["variable.other.property.js"],"property.readonly":["variable.other.constant.property.js"],variable:["variable.other.readwrite.js"],"variable.readonly":["variable.other.constant.object.js"],function:["entity.name.function.js"],namespace:["entity.name.type.module.js"],"variable.defaultLibrary":["support.variable.js"],"function.defaultLibrary":["support.function.js"]}},{language:"javascriptreact",scopes:{property:["variable.other.property.jsx"],"property.readonly":["variable.other.constant.property.jsx"],variable:["variable.other.readwrite.jsx"],"variable.readonly":["variable.other.constant.object.jsx"],function:["entity.name.function.jsx"],namespace:["entity.name.type.module.jsx"],"variable.defaultLibrary":["support.variable.js"],"function.defaultLibrary":["support.function.js"]}}],snippets:[{language:"javascript",path:"./snippets/javascript.code-snippets"},{language:"javascriptreact",path:"./snippets/javascript.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JavaScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in JavaScript files."}},{extensionPath:"json",packageJSON:{name:"json",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"json",aliases:["JSON","json"],extensions:[".json",".bowerrc",".jscsrc",".webmanifest",".js.map",".css.map",".ts.map",".har",".jslintrc",".jsonld",".geojson",".ipynb",".vuerc"],filenames:["composer.lock",".watchmanconfig"],mimetypes:["application/json","application/manifest+json"],configuration:"./language-configuration.json"},{id:"jsonc",aliases:["JSON with Comments"],extensions:[".jsonc",".eslintrc",".eslintrc.json",".jsfmtrc",".jshintrc",".swcrc",".hintrc",".babelrc",".toolset.jsonc"],filenames:["babel.config.json","bun.lock",".babelrc.json",".ember-cli","typedoc.json"],filenamePatterns:["**/.github/hooks/*.json"],configuration:"./language-configuration.json"},{id:"jsonl",aliases:["JSON Lines"],extensions:[".jsonl",".ndjson"],filenames:[],configuration:"./language-configuration.json"},{id:"snippets",aliases:["Code Snippets"],extensions:[".code-snippets"],filenamePatterns:["**/User/snippets/*.json","**/User/profiles/*/snippets/*.json","**/snippets*.json"],configuration:"./language-configuration.json"}],grammars:[{language:"json",scopeName:"source.json",path:"./syntaxes/JSON.tmLanguage.json"},{language:"jsonc",scopeName:"source.json.comments",path:"./syntaxes/JSONC.tmLanguage.json"},{language:"jsonl",scopeName:"source.json.lines",path:"./syntaxes/JSONL.tmLanguage.json"},{language:"snippets",scopeName:"source.json.comments.snippets",path:"./syntaxes/snippets.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JSON Language Basics",description:"Provides syntax highlighting & bracket matching in JSON files."}},{extensionPath:"json-language-features",packageJSON:{name:"json-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.77.0"},enabledApiProposals:["extensionsAny"],icon:"icons/json.png",activationEvents:["onLanguage:json","onLanguage:jsonc","onLanguage:snippets","onCommand:json.validate"],main:"./client/dist/node/jsonClientMain",browser:"./client/dist/browser/jsonClientMain",capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",description:"%json.workspaceTrust%"}},categories:["Programming Languages"],contributes:{configuration:{id:"json",order:20,type:"object",title:"JSON",properties:{"json.schemas":{type:"array",scope:"resource",description:"%json.schemas.desc%",items:{type:"object",default:{fileMatch:["/myfile"],url:"schemaURL"},properties:{url:{type:"string",default:"/user.schema.json",markdownDescription:"%json.schemas.url.desc%"},fileMatch:{type:"array",items:{type:"string",default:"MyFile.json",markdownDescription:"%json.schemas.fileMatch.item.desc%"},minItems:1,markdownDescription:"%json.schemas.fileMatch.desc%"},schema:{$ref:"http://json-schema.org/draft-07/schema#",description:"%json.schemas.schema.desc%"}}}},"json.validate.enable":{type:"boolean",scope:"window",default:!0,description:"%json.validate.enable.desc%"},"json.format.enable":{type:"boolean",scope:"window",default:!0,description:"%json.format.enable.desc%"},"json.format.keepLines":{type:"boolean",scope:"window",default:!1,description:"%json.format.keepLines.desc%"},"json.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%json.tracing.desc%"},"json.colorDecorators.enable":{type:"boolean",scope:"window",default:!0,description:"%json.colorDecorators.enable.desc%",deprecationMessage:"%json.colorDecorators.enable.deprecationMessage%"},"json.maxItemsComputed":{type:"number",default:5e3,description:"%json.maxItemsComputed.desc%"},"json.schemaDownload.enable":{type:"boolean",default:!0,description:"%json.enableSchemaDownload.desc%",tags:["usesOnlineServices"]},"json.schemaDownload.trustedDomains":{type:"object",default:{"https://schemastore.azurewebsites.net/":!0,"https://raw.githubusercontent.com/microsoft/vscode/":!0,"https://raw.githubusercontent.com/devcontainers/spec/":!0,"https://www.schemastore.org/":!0,"https://json.schemastore.org/":!0,"https://json-schema.org/":!0,"https://developer.microsoft.com/json-schemas/":!0},additionalProperties:{type:"boolean"},markdownDescription:"%json.schemaDownload.trustedDomains.desc%",tags:["usesOnlineServices"]}}},configurationDefaults:{"[json]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"},"[jsonc]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"},"[snippets]":{"editor.quickSuggestions":{strings:!0},"editor.suggest.insertMode":"replace"}},jsonValidation:[{fileMatch:"*.schema.json",url:"http://json-schema.org/draft-07/schema#"}],commands:[{command:"json.clearCache",title:"%json.command.clearCache%",category:"JSON"},{command:"json.sort",title:"%json.command.sort%",category:"JSON"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JSON Language Features",description:"Provides rich language support for JSON files.","json.schemas.desc":"Associate schemas to JSON files in the current project.","json.schemas.url.desc":"A URL or absolute file path to a schema. Can be a relative path (starting with `./`) in workspace and workspace folder settings.","json.schemas.fileMatch.desc":"An array of file patterns to match against when resolving JSON files to schemas. `*` and `**` can be used as a wildcard. Exclusion patterns can also be defined and start with `!`. A file matches when there is at least one matching pattern and the last matching pattern is not an exclusion pattern.","json.schemas.fileMatch.item.desc":"A file pattern that can contain `*` and `**` to match against when resolving JSON files to schemas. When beginning with `!`, it defines an exclusion pattern.","json.schemas.schema.desc":"The schema definition for the given URL. The schema only needs to be provided to avoid accesses to the schema URL.","json.format.enable.desc":"Enable/disable default JSON formatter","json.format.keepLines.desc":"Keep all existing new lines when formatting.","json.validate.enable.desc":"Enable/disable JSON validation.","json.tracing.desc":"Traces the communication between VS Code and the JSON language server.","json.colorDecorators.enable.desc":"Enables or disables color decorators","json.colorDecorators.enable.deprecationMessage":"The setting `json.colorDecorators.enable` has been deprecated in favor of `editor.colorDecorators`.","json.schemaResolutionErrorMessage":"Unable to resolve schema.","json.clickToRetry":"Click to retry.","json.maxItemsComputed.desc":"The maximum number of outline symbols and folding regions computed (limited for performance reasons).","json.maxItemsExceededInformation.desc":"Show notification when exceeding the maximum number of outline symbols and folding regions.","json.enableSchemaDownload.desc":"When enabled, JSON schemas can be fetched from http and https locations.","json.command.clearCache":"Clear Schema Cache","json.command.sort":"Sort Document","json.workspaceTrust":"The extension requires workspace trust to load schemas from http and https.","json.schemaDownload.trustedDomains.desc":"List of trusted domains for downloading JSON schemas over http(s). Use `*` to trust all domains. `*` can also be used as a wildcard in domain names."},readmePath:"json-language-features/README.md"},{extensionPath:"julia",packageJSON:{name:"julia",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin JuliaEditorSupport/atom-language-julia variants/julia_vscode.json ./syntaxes/julia.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"julia",aliases:["Julia","julia"],extensions:[".jl"],firstLine:"^#!\\s*/.*\\bjulia[0-9.-]*\\b",configuration:"./language-configuration.json"},{id:"juliamarkdown",aliases:["Julia Markdown","juliamarkdown"],extensions:[".jmd"]}],grammars:[{language:"julia",scopeName:"source.julia",path:"./syntaxes/julia.tmLanguage.json",embeddedLanguages:{"meta.embedded.inline.cpp":"cpp","meta.embedded.inline.javascript":"javascript","meta.embedded.inline.python":"python","meta.embedded.inline.r":"r","meta.embedded.inline.sql":"sql"}}],configurationDefaults:{"[julia]":{"editor.defaultColorDecorators":"never"}}}},packageNLS:{displayName:"Julia Language Basics",description:"Provides syntax highlighting & bracket matching in Julia files."}},{extensionPath:"latex",packageJSON:{name:"latex",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"tex",aliases:["TeX","tex"],extensions:[".sty",".cls",".bbx",".cbx"],configuration:"latex-language-configuration.json"},{id:"latex",aliases:["LaTeX","latex"],extensions:[".tex",".ltx",".ctx"],configuration:"latex-language-configuration.json"},{id:"bibtex",aliases:["BibTeX","bibtex"],extensions:[".bib"]},{id:"cpp_embedded_latex",configuration:"latex-cpp-embedded-language-configuration.json",aliases:[]},{id:"markdown_latex_combined",configuration:"markdown-latex-combined-language-configuration.json",aliases:[]}],grammars:[{language:"tex",scopeName:"text.tex",path:"./syntaxes/TeX.tmLanguage.json",unbalancedBracketScopes:["keyword.control.ifnextchar.tex","punctuation.math.operator.tex"]},{language:"latex",scopeName:"text.tex.latex",path:"./syntaxes/LaTeX.tmLanguage.json",unbalancedBracketScopes:["keyword.control.ifnextchar.tex","punctuation.math.operator.tex"],embeddedLanguages:{"source.cpp":"cpp_embedded_latex","source.css":"css","text.html":"html","source.java":"java","source.js":"javascript","source.julia":"julia","source.lua":"lua","source.python":"python","source.ruby":"ruby","source.ts":"typescript","text.xml":"xml","source.yaml":"yaml","meta.embedded.markdown_latex_combined":"markdown_latex_combined"}},{language:"bibtex",scopeName:"text.bibtex",path:"./syntaxes/Bibtex.tmLanguage.json"},{language:"markdown_latex_combined",scopeName:"text.tex.markdown_latex_combined",path:"./syntaxes/markdown-latex-combined.tmLanguage.json"},{language:"cpp_embedded_latex",scopeName:"source.cpp.embedded.latex",path:"./syntaxes/cpp-grammar-bailout.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"LaTeX Language Basics",description:"Provides syntax highlighting and bracket matching for TeX, LaTeX and BibTeX."}},{extensionPath:"less",packageJSON:{name:"less",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.js"},categories:["Programming Languages"],contributes:{languages:[{id:"less",aliases:["Less","less"],extensions:[".less"],mimetypes:["text/x-less","text/less"],configuration:"./language-configuration.json"}],grammars:[{language:"less",scopeName:"source.css.less",path:"./syntaxes/less.tmLanguage.json"}],problemMatchers:[{name:"lessc",label:"Lessc compiler",owner:"lessc",source:"less",fileLocation:"absolute",pattern:{regexp:"(.*)\\sin\\s(.*)\\son line\\s(\\d+),\\scolumn\\s(\\d+)",message:1,file:2,line:3,column:4}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Less Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Less files."}},{extensionPath:"log",packageJSON:{name:"log",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin emilast/vscode-logfile-highlighter syntaxes/log.tmLanguage ./syntaxes/log.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"log",extensions:[".log","*.log.?"],aliases:["Log"]}],grammars:[{language:"log",scopeName:"text.log",path:"./syntaxes/log.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Log",description:"Provides syntax highlighting for files with .log extension."}},{extensionPath:"lua",packageJSON:{name:"lua",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin sumneko/lua.tmbundle Syntaxes/Lua.plist ./syntaxes/lua.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"lua",extensions:[".lua"],aliases:["Lua","lua"],configuration:"./language-configuration.json"}],grammars:[{language:"lua",scopeName:"source.lua",path:"./syntaxes/lua.tmLanguage.json",tokenTypes:{"comment.line.double-dash.doc.lua":"other"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Lua Language Basics",description:"Provides syntax highlighting and bracket matching in Lua files."}},{extensionPath:"make",packageJSON:{name:"make",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin fadeevab/make.tmbundle Syntaxes/Makefile.plist ./syntaxes/make.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"makefile",aliases:["Makefile","makefile"],extensions:[".mak",".mk"],filenames:["Makefile","makefile","GNUmakefile","OCamlMakefile"],firstLine:"^#!\\s*/usr/bin/make",configuration:"./language-configuration.json"}],grammars:[{language:"makefile",scopeName:"source.makefile",path:"./syntaxes/make.tmLanguage.json",tokenTypes:{"string.interpolated":"other"}}],configurationDefaults:{"[makefile]":{"editor.insertSpaces":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Make Language Basics",description:"Provides syntax highlighting and bracket matching in Make files."}},{extensionPath:"markdown-basics",packageJSON:{name:"markdown",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.20.0"},categories:["Programming Languages"],contributes:{languages:[{id:"markdown",aliases:["Markdown","markdown"],extensions:[".md",".mkd",".mkdn",".mdwn",".mdown",".markdown",".markdn",".mdtxt",".mdtext",".litcoffee",".ron",".ronn",".workbook"],filenamePatterns:["**/.cursor/**/*.mdc"],configuration:"./language-configuration.json"}],grammars:[{language:"markdown",scopeName:"text.html.markdown",path:"./syntaxes/markdown.tmLanguage.json",embeddedLanguages:{"meta.embedded.block.html":"html","source.js":"javascript","source.css":"css","meta.embedded.block.frontmatter":"yaml","meta.embedded.block.css":"css","meta.embedded.block.ini":"ini","meta.embedded.block.java":"java","meta.embedded.block.lua":"lua","meta.embedded.block.makefile":"makefile","meta.embedded.block.perl":"perl","meta.embedded.block.r":"r","meta.embedded.block.ruby":"ruby","meta.embedded.block.php":"php","meta.embedded.block.sql":"sql","meta.embedded.block.vs_net":"vs_net","meta.embedded.block.xml":"xml","meta.embedded.block.xsl":"xsl","meta.embedded.block.yaml":"yaml","meta.embedded.block.dosbatch":"dosbatch","meta.embedded.block.clojure":"clojure","meta.embedded.block.coffee":"coffee","meta.embedded.block.c":"c","meta.embedded.block.cpp":"cpp","meta.embedded.block.diff":"diff","meta.embedded.block.dockerfile":"dockerfile","meta.embedded.block.go":"go","meta.embedded.block.groovy":"groovy","meta.embedded.block.pug":"jade","meta.embedded.block.ignore":"ignore","meta.embedded.block.javascript":"javascript","meta.embedded.block.json":"json","meta.embedded.block.jsonc":"jsonc","meta.embedded.block.jsonl":"jsonl","meta.embedded.block.latex":"latex","meta.embedded.block.less":"less","meta.embedded.block.objc":"objc","meta.embedded.block.scss":"scss","meta.embedded.block.perl6":"perl6","meta.embedded.block.powershell":"powershell","meta.embedded.block.python":"python","meta.embedded.block.restructuredtext":"restructuredtext","meta.embedded.block.rust":"rust","meta.embedded.block.scala":"scala","meta.embedded.block.shellscript":"shellscript","meta.embedded.block.typescript":"typescript","meta.embedded.block.typescriptreact":"typescriptreact","meta.embedded.block.csharp":"csharp","meta.embedded.block.fsharp":"fsharp"},unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]}],snippets:[{language:"markdown",path:"./snippets/markdown.code-snippets"}],configurationDefaults:{"[markdown]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1}}},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin microsoft/vscode-markdown-tm-grammar syntaxes/markdown.tmLanguage ./syntaxes/markdown.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Language Basics",description:"Provides snippets and syntax highlighting for Markdown."}},{extensionPath:"markdown-language-features",packageJSON:{name:"markdown-language-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",icon:"icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",enabledApiProposals:["customEditorDiffs","documentDiff"],engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension",categories:["Programming Languages"],activationEvents:["onLanguage:markdown","onLanguage:prompt","onLanguage:instructions","onLanguage:chatagent","onLanguage:skill","onCommand:markdown.api.render","onCommand:markdown.api.reloadPlugins","onWebviewPanel:markdown.preview"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%",restrictedConfigurations:["markdown.styles"]}},contributes:{notebookRenderer:[{id:"vscode.markdown-it-renderer",displayName:"Markdown it renderer",entrypoint:"./notebook-out/index.js",mimeTypes:["text/markdown","text/latex","text/x-css","text/x-html","text/x-json","text/x-typescript","text/x-abap","text/x-apex","text/x-azcli","text/x-bat","text/x-cameligo","text/x-clojure","text/x-coffee","text/x-cpp","text/x-csharp","text/x-csp","text/x-css","text/x-dart","text/x-dockerfile","text/x-ecl","text/x-fsharp","text/x-go","text/x-graphql","text/x-handlebars","text/x-hcl","text/x-html","text/x-ini","text/x-java","text/x-javascript","text/x-julia","text/x-kotlin","text/x-less","text/x-lexon","text/x-lua","text/x-m3","text/x-markdown","text/x-mips","text/x-msdax","text/x-mysql","text/x-objective-c/objective","text/x-pascal","text/x-pascaligo","text/x-perl","text/x-pgsql","text/x-php","text/x-postiats","text/x-powerquery","text/x-powershell","text/x-pug","text/x-python","text/x-r","text/x-razor","text/x-redis","text/x-redshift","text/x-restructuredtext","text/x-ruby","text/x-rust","text/x-sb","text/x-scala","text/x-scheme","text/x-scss","text/x-shell","text/x-solidity","text/x-sophia","text/x-sql","text/x-st","text/x-swift","text/x-systemverilog","text/x-tcl","text/x-twig","text/x-typescript","text/x-vb","text/x-xml","text/x-yaml","application/json"]}],commands:[{command:"_markdown.copyImage",title:"%markdown.copyImage.title%",category:"Markdown"},{command:"_markdown.openImage",title:"%markdown.openImage.title%",category:"Markdown"},{command:"_markdown.openFrontMatterSettings",title:"%markdown.openFrontMatterSettings.title%",category:"Markdown"},{command:"markdown.showPreview",title:"%markdown.preview.title%",category:"Markdown",icon:{light:"./media/preview-light.svg",dark:"./media/preview-dark.svg"}},{command:"markdown.showPreviewToSide",title:"%markdown.previewSide.title%",category:"Markdown",icon:"$(open-preview)"},{command:"markdown.showLockedPreviewToSide",title:"%markdown.showLockedPreviewToSide.title%",category:"Markdown",icon:"$(open-preview)"},{command:"markdown.showSource",title:"%markdown.showSource.title%",category:"Markdown",icon:"$(file-code)"},{command:"markdown.showPreviewSecuritySelector",title:"%markdown.showPreviewSecuritySelector.title%",category:"Markdown"},{command:"markdown.preview.refresh",title:"%markdown.preview.refresh.title%",category:"Markdown"},{command:"markdown.preview.toggleLock",title:"%markdown.preview.toggleLock.title%",category:"Markdown"},{command:"markdown.findAllFileReferences",title:"%markdown.findAllFileReferences%",category:"Markdown"},{command:"markdown.reopenAsPreview",title:"%markdown.reopenAsPreview.title%",category:"Markdown",icon:"$(preview)"},{command:"markdown.reopenAsSource",title:"%markdown.reopenAsSource.title%",category:"Markdown",icon:"$(file-code)"},{command:"markdown.togglePreview",title:"%markdown.togglePreview.title%",category:"Markdown"},{command:"markdown.editor.insertLinkFromWorkspace",title:"%markdown.editor.insertLinkFromWorkspace%",category:"Markdown",enablement:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !activeEditorIsReadonly"},{command:"markdown.editor.insertImageFromWorkspace",title:"%markdown.editor.insertImageFromWorkspace%",category:"Markdown",enablement:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !activeEditorIsReadonly"}],menus:{"webview/context":[{command:"_markdown.copyImage",when:"(webviewId == 'markdown.preview' || webviewId == 'vscode.markdown.preview.editor') && (webviewSection == 'image' || webviewSection == 'localImage')"},{command:"_markdown.openImage",when:"(webviewId == 'markdown.preview' || webviewId == 'vscode.markdown.preview.editor') && webviewSection == 'localImage'"},{command:"_markdown.openFrontMatterSettings",when:"(webviewId == 'markdown.preview' || webviewId == 'vscode.markdown.preview.editor') && webviewSection == 'frontMatter'"}],"editor/title":[{command:"markdown.showPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",alt:"markdown.showPreview",group:"navigation"},{command:"markdown.reopenAsPreview",when:"activeEditor == workbench.editors.files.textFileEditor && resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",group:"navigation"},{command:"markdown.showSource",when:"activeWebviewPanelId == 'markdown.preview'",group:"navigation"},{command:"markdown.reopenAsSource",when:"activeCustomEditorId == 'vscode.markdown.preview.editor' && !activeCustomEditorTextDiff",group:"navigation"},{command:"markdown.preview.refresh",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"},{command:"markdown.preview.toggleLock",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"},{command:"markdown.showPreviewSecuritySelector",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"1_markdown"}],"modalEditor/editorTitle":[{command:"markdown.showPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",alt:"markdown.showPreview",group:"navigation"},{command:"markdown.reopenAsPreview",when:"(activeEditor == workbench.editors.files.textFileEditor || activeEditor == workbench.editors.textDiffEditor) && resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused && !hasCustomMarkdownPreview",group:"navigation"},{command:"markdown.reopenAsSource",when:"activeCustomEditorId == 'vscode.markdown.preview.editor' && !activeCustomEditorTextDiff",group:"navigation"}],"explorer/context":[{command:"markdown.showPreview",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !hasCustomMarkdownPreview",group:"navigation"},{command:"markdown.findAllFileReferences",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/",group:"4_search"}],"editor/title/context":[{command:"markdown.showPreview",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !hasCustomMarkdownPreview",group:"1_open"},{command:"markdown.findAllFileReferences",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/"}],commandPalette:[{command:"_markdown.openImage",when:"false"},{command:"_markdown.copyImage",when:"false"},{command:"markdown.showPreview",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showLockedPreviewToSide",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused",group:"navigation"},{command:"markdown.showSource",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"navigation"},{command:"markdown.showPreviewSecuritySelector",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.showPreviewSecuritySelector",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.preview.toggleLock",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.preview.refresh",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.preview.refresh",when:"activeWebviewPanelId == 'markdown.preview' || activeCustomEditorId == 'vscode.markdown.preview.editor'"},{command:"markdown.findAllFileReferences",when:"editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/"},{command:"markdown.reopenAsPreview",when:"activeEditor == workbench.editors.files.textFileEditor && resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/",group:"navigation"},{command:"markdown.reopenAsSource",when:"activeCustomEditorId == 'vscode.markdown.preview.editor'",group:"navigation"},{command:"markdown.togglePreview",when:"resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/"}]},keybindings:[{command:"markdown.showPreviewToSide",key:"ctrl+k v",mac:"cmd+k v",when:"editorFocus && editorLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused"},{command:"markdown.togglePreview",key:"shift+ctrl+v",mac:"shift+cmd+v",when:"!terminalFocus && ((editorFocus && resourceLangId =~ /^(markdown|prompt|instructions|chatagent|skill)$/ && !notebookEditorFocused) || activeCustomEditorId == 'vscode.markdown.preview.editor')"}],configuration:[{title:"%configuration.editor%",order:20,properties:{"markdown.links.openLocation":{type:"string",default:"currentGroup",description:"%configuration.markdown.links.openLocation.description%",scope:"resource",enum:["currentGroup","beside"],enumDescriptions:["%configuration.markdown.links.openLocation.currentGroup%","%configuration.markdown.links.openLocation.beside%"]},"markdown.suggest.paths.enabled":{type:"boolean",default:!0,description:"%configuration.markdown.suggest.paths.enabled.description%",scope:"resource"},"markdown.suggest.paths.includeWorkspaceHeaderCompletions":{type:"string",default:"onDoubleHash",scope:"resource",markdownDescription:"%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions%",enum:["never","onDoubleHash","onSingleOrDoubleHash"],markdownEnumDescriptions:["%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.never%","%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onDoubleHash%","%configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onSingleOrDoubleHash%"]},"markdown.editor.drop.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.drop.enabled%",default:"smart",enum:["always","smart","never"],markdownEnumDescriptions:["%configuration.markdown.editor.drop.enabled.always%","%configuration.markdown.editor.drop.enabled.smart%","%configuration.markdown.editor.drop.enabled.never%"]},"markdown.editor.drop.copyIntoWorkspace":{type:"string",markdownDescription:"%configuration.markdown.editor.drop.copyIntoWorkspace%",default:"mediaFiles",enum:["mediaFiles","never"],markdownEnumDescriptions:["%configuration.copyIntoWorkspace.mediaFiles%","%configuration.copyIntoWorkspace.never%"]},"markdown.editor.filePaste.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.filePaste.enabled%",default:"smart",enum:["always","smart","never"],markdownEnumDescriptions:["%configuration.markdown.editor.filePaste.enabled.always%","%configuration.markdown.editor.filePaste.enabled.smart%","%configuration.markdown.editor.filePaste.enabled.never%"]},"markdown.editor.filePaste.copyIntoWorkspace":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.copyIntoWorkspace%",default:"mediaFiles",enum:["mediaFiles","never"],markdownEnumDescriptions:["%configuration.copyIntoWorkspace.mediaFiles%","%configuration.copyIntoWorkspace.never%"]},"markdown.editor.filePaste.videoSnippet":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.videoSnippet%",default:'<video controls src="${src}" title="${title}"></video>'},"markdown.editor.filePaste.audioSnippet":{type:"string",markdownDescription:"%configuration.markdown.editor.filePaste.audioSnippet%",default:'<audio controls src="${src}" title="${title}"></audio>'},"markdown.editor.pasteUrlAsFormattedLink.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.editor.pasteUrlAsFormattedLink.enabled%",default:"smartWithSelection",enum:["always","smart","smartWithSelection","never"],markdownEnumDescriptions:["%configuration.pasteUrlAsFormattedLink.always%","%configuration.pasteUrlAsFormattedLink.smart%","%configuration.pasteUrlAsFormattedLink.smartWithSelection%","%configuration.pasteUrlAsFormattedLink.never%"]},"markdown.editor.updateLinksOnPaste.enabled":{type:"boolean",markdownDescription:"%configuration.markdown.editor.updateLinksOnPaste.enabled%",scope:"resource",default:!0},"markdown.updateLinksOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%configuration.markdown.updateLinksOnFileMove.enabled.prompt%","%configuration.markdown.updateLinksOnFileMove.enabled.always%","%configuration.markdown.updateLinksOnFileMove.enabled.never%"],default:"never",markdownDescription:"%configuration.markdown.updateLinksOnFileMove.enabled%",scope:"window"},"markdown.updateLinksOnFileMove.include":{type:"array",markdownDescription:"%configuration.markdown.updateLinksOnFileMove.include%",scope:"window",items:{type:"string",description:"%configuration.markdown.updateLinksOnFileMove.include.property%"},default:["**/*.{md,mkd,mdwn,mdown,markdown,markdn,mdtxt,mdtext,workbook}","**/*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,tiff,svg,mp4}"]},"markdown.updateLinksOnFileMove.enableForDirectories":{type:"boolean",default:!0,description:"%configuration.markdown.updateLinksOnFileMove.enableForDirectories%",scope:"window"},"markdown.occurrencesHighlight.enabled":{type:"boolean",default:!1,description:"%configuration.markdown.occurrencesHighlight.enabled%",scope:"resource"},"markdown.copyFiles.destination":{type:"object",markdownDescription:"%configuration.markdown.copyFiles.destination%",additionalProperties:{type:"string"}},"markdown.copyFiles.overwriteBehavior":{type:"string",markdownDescription:"%configuration.markdown.copyFiles.overwriteBehavior%",default:"nameIncrementally",enum:["nameIncrementally","overwrite"],markdownEnumDescriptions:["%configuration.markdown.copyFiles.overwriteBehavior.nameIncrementally%","%configuration.markdown.copyFiles.overwriteBehavior.overwrite%"]},"markdown.preferredMdPathExtensionStyle":{type:"string",default:"auto",markdownDescription:"%configuration.markdown.preferredMdPathExtensionStyle%",enum:["auto","includeExtension","removeExtension"],markdownEnumDescriptions:["%configuration.markdown.preferredMdPathExtensionStyle.auto%","%configuration.markdown.preferredMdPathExtensionStyle.includeExtension%","%configuration.markdown.preferredMdPathExtensionStyle.removeExtension%"]}}},{title:"%configuration.validation%",order:22,properties:{"markdown.validate.enabled":{order:0,type:"boolean",scope:"resource",description:"%configuration.markdown.validate.enabled.description%",default:!1},"markdown.validate.referenceLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.referenceLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fragmentLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fragmentLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fileLinks.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fileLinks.enabled.description%",default:"warning",enum:["ignore","warning","error"]},"markdown.validate.fileLinks.markdownFragmentLinks":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.fileLinks.markdownFragmentLinks.description%",default:"inherit",enum:["inherit","ignore","warning","error"]},"markdown.validate.ignoredLinks":{type:"array",scope:"resource",markdownDescription:"%configuration.markdown.validate.ignoredLinks.description%",items:{type:"string"}},"markdown.validate.unusedLinkDefinitions.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.unusedLinkDefinitions.description%",default:"hint",enum:["ignore","hint","warning","error"]},"markdown.validate.duplicateLinkDefinitions.enabled":{type:"string",scope:"resource",markdownDescription:"%configuration.markdown.validate.duplicateLinkDefinitions.description%",default:"warning",enum:["ignore","warning","error"]}}},{title:"%configuration.preview%",order:23,properties:{"markdown.styles":{type:"array",items:{type:"string"},default:[],markdownDescription:"%markdown.styles.dec%",scope:"resource"},"markdown.preview.breaks":{type:"boolean",default:!1,markdownDescription:"%markdown.preview.breaks.desc%",scope:"resource"},"markdown.preview.linkify":{type:"boolean",default:!0,description:"%markdown.preview.linkify%",scope:"resource"},"markdown.preview.typographer":{type:"boolean",default:!1,description:"%markdown.preview.typographer%",scope:"resource"},"markdown.preview.fontFamily":{type:"string",default:"-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', system-ui, 'Ubuntu', 'Droid Sans', sans-serif",description:"%markdown.preview.fontFamily.desc%",scope:"resource"},"markdown.preview.fontSize":{type:"number",default:14,description:"%markdown.preview.fontSize.desc%",scope:"resource"},"markdown.preview.lineHeight":{type:"number",default:1.6,description:"%markdown.preview.lineHeight.desc%",scope:"resource"},"markdown.preview.scrollPreviewWithEditor":{type:"boolean",default:!0,description:"%markdown.preview.scrollPreviewWithEditor.desc%",scope:"resource"},"markdown.preview.markEditorSelection":{type:"boolean",default:!1,description:"%markdown.preview.markEditorSelection.desc%",scope:"resource"},"markdown.preview.scrollEditorWithPreview":{type:"boolean",default:!0,description:"%markdown.preview.scrollEditorWithPreview.desc%",scope:"resource"},"markdown.preview.doubleClickToSwitchToEditor":{type:"boolean",default:!1,description:"%markdown.preview.doubleClickToSwitchToEditor.desc%",scope:"resource"},"markdown.preview.openMarkdownLinks":{type:"string",default:"inPreview",description:"%configuration.markdown.preview.openMarkdownLinks.description%",scope:"resource",enum:["inPreview","inEditor"],enumDescriptions:["%configuration.markdown.preview.openMarkdownLinks.inPreview%","%configuration.markdown.preview.openMarkdownLinks.inEditor%"]},"markdown.preview.frontMatter":{type:"string",default:"table",scope:"resource",markdownDescription:"%configuration.markdown.preview.frontMatter.description%",enum:["hide","codeBlock","table"],enumDescriptions:["%configuration.markdown.preview.frontMatter.hide%","%configuration.markdown.preview.frontMatter.codeBlock%","%configuration.markdown.preview.frontMatter.table%"]}}},{title:"%configuration.advanced%",order:24,properties:{"markdown.trace.server":{type:"string",scope:"window",enum:["off","messages","verbose"],default:"off",description:"%markdown.trace.server.desc%"},"markdown.server.log":{type:"string",scope:"window",enum:["off","debug","trace"],default:"off",description:"%markdown.server.log.desc%"}}}],configurationDefaults:{"[markdown]":{"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"off",other:"off"}}},jsonValidation:[{fileMatch:"package.json",url:"./schemas/package.schema.json"}],"markdown.previewStyles":["./media/markdown.css","./media/highlight.css"],"markdown.previewScripts":[{path:"./media/index.js",type:"module"}],customEditors:[{viewType:"vscode.markdown.preview.editor",displayName:"Markdown Preview",priority:"option",selector:[{filenamePattern:"*.md"}]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Language Features",description:"Provides rich language support for Markdown.","configuration.preview":"Preview","configuration.editor":"Language Features","configuration.validation":"Validation","configuration.advanced":"Advanced","markdown.copyImage.title":"Copy Image","markdown.openImage.title":"Open Image","markdown.openFrontMatterSettings.title":"Configure Frontmatter Visibility","markdown.preview.breaks.desc":"Sets how line-breaks are rendered in the Markdown preview. Setting it to `true` creates a `<br>` for newlines inside paragraphs.","markdown.preview.linkify":"Convert URL-like text to links in the Markdown preview.","markdown.preview.typographer":"Enable some language-neutral replacement and quotes beautification in the Markdown preview.","markdown.preview.doubleClickToSwitchToEditor.desc":"Double-click in the Markdown preview to switch to the editor.","markdown.preview.fontFamily.desc":"Controls the font family used in the Markdown preview.","markdown.preview.fontSize.desc":"Controls the font size in pixels used in the Markdown preview.","markdown.preview.lineHeight.desc":"Controls the line height used in the Markdown preview. This number is relative to the font size.","markdown.preview.markEditorSelection.desc":"Mark the current editor selection in the Markdown preview.","markdown.preview.scrollEditorWithPreview.desc":"When a Markdown preview is scrolled, update the view of the editor.","markdown.preview.scrollPreviewWithEditor.desc":"When a Markdown editor is scrolled, update the view of the preview.","markdown.preview.title":"Open Preview","markdown.previewSide.title":"Open Preview to the Side","markdown.showLockedPreviewToSide.title":"Open Locked Preview to the Side","markdown.showSource.title":"Open Source File","markdown.styles.dec":"A list of URLs or local paths to CSS style sheets to use from the Markdown preview. Relative paths are interpreted relative to the folder open in the Explorer. If there is no open folder, they are interpreted relative to the location of the Markdown file. All `\\` need to be written as `\\\\`.","markdown.reopenAsPreview.title":"Open as Preview","markdown.reopenAsSource.title":"Reopen as source file","markdown.togglePreview.title":"Toggle Preview","markdown.showPreviewSecuritySelector.title":"Change Preview Security Settings","markdown.trace.extension.desc":"Enable debug logging for the Markdown extension.","markdown.trace.server.desc":"Traces the communication between VS Code and the Markdown language server.","markdown.server.log.desc":"Controls the logging level of the Markdown language server.","markdown.preview.refresh.title":"Refresh Preview","markdown.preview.toggleLock.title":"Toggle Preview Locking","markdown.findAllFileReferences":"Find File References","markdown.editor.insertLinkFromWorkspace":"Insert Link to File in Workspace","markdown.editor.insertImageFromWorkspace":"Insert Image from Workspace","configuration.markdown.preview.openMarkdownLinks.description":"Controls how links to other Markdown files in the Markdown preview should be opened.","configuration.markdown.preview.openMarkdownLinks.inEditor":"Try to open links in the editor.","configuration.markdown.preview.openMarkdownLinks.inPreview":"Try to open links in the Markdown preview.","configuration.markdown.preview.frontMatter.description":"Controls how YAML frontmatter (delimited by `---`) at the start of a Markdown file is rendered in the preview.","configuration.markdown.preview.frontMatter.hide":"Do not render frontmatter.","configuration.markdown.preview.frontMatter.codeBlock":"Render frontmatter as a code block.","configuration.markdown.preview.frontMatter.table":"Render frontmatter as a table of keys and values.","configuration.markdown.links.openLocation.description":"Controls where links in Markdown files should be opened.","configuration.markdown.links.openLocation.currentGroup":"Open links in the active editor group.","configuration.markdown.links.openLocation.beside":"Open links beside the active editor.","configuration.markdown.suggest.paths.enabled.description":"Controls whether path suggestions are shown while writing links in Markdown files.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions":"Enable suggestions for headers in other Markdown files in the current workspace. Accepting one of these suggestions inserts the full path to header in that file, for example: `[link text](/path/to/file.md#header)`.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.never":"Disable workspace header suggestions.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onDoubleHash":"Enable workspace header suggestions after typing `##` in a path, for example: `[link text](##`.","configuration.markdown.suggest.paths.includeWorkspaceHeaderCompletions.onSingleOrDoubleHash":"Enable workspace header suggestions after typing either `##` or `#` in a path, for example: `[link text](#` or `[link text](##`.","configuration.markdown.editor.drop.enabled":"Controls whether dropping files into a Markdown editor while holding Shift inserts Markdown links. Requires enabling `#editor.dropIntoEditor.enabled#`.","configuration.markdown.editor.drop.enabled.always":"Always insert Markdown links.","configuration.markdown.editor.drop.enabled.smart":"Smartly create Markdown links by default when not dropping into a code block or other special element. Use the drop widget to switch between pasting as plain text or as Markdown links.","configuration.markdown.editor.drop.enabled.never":"Never create Markdown links.","configuration.markdown.editor.drop.copyIntoWorkspace":"Controls if files outside of the workspace that are dropped into a Markdown editor should be copied into the workspace.\n\nUse `#markdown.copyFiles.destination#` to configure where copied dropped files should be created","configuration.markdown.editor.filePaste.enabled":"Controls whether pasting files into a Markdown editor creates Markdown links. Requires enabling `#editor.pasteAs.enabled#`.","configuration.markdown.editor.filePaste.enabled.always":"Always insert Markdown links.","configuration.markdown.editor.filePaste.enabled.smart":"Smartly create Markdown links by default when not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.markdown.editor.filePaste.enabled.never":"Never create Markdown links.","configuration.markdown.editor.filePaste.copyIntoWorkspace":"Controls if files outside of the workspace that are pasted into a Markdown editor should be copied into the workspace.\n\nUse `#markdown.copyFiles.destination#` to configure where copied files should be created.","configuration.copyIntoWorkspace.mediaFiles":"Try to copy external image and video files into the workspace.","configuration.copyIntoWorkspace.never":"Do not copy external files into the workspace.","configuration.markdown.editor.pasteUrlAsFormattedLink.enabled":"Controls if Markdown links are created when URLs are pasted into a Markdown editor. Requires enabling `#editor.pasteAs.enabled#`.","configuration.pasteUrlAsFormattedLink.always":"Always insert Markdown links.","configuration.pasteUrlAsFormattedLink.smart":"Smartly create Markdown links by default when not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.pasteUrlAsFormattedLink.smartWithSelection":"Smartly create Markdown links by default when you have selected text and are not pasting into a code block or other special element. Use the paste widget to switch between pasting as plain text or as Markdown links.","configuration.pasteUrlAsFormattedLink.never":"Never create Markdown links.","configuration.markdown.validate.enabled.description":"Controls whether error reporting is enabled in Markdown files.","configuration.markdown.validate.referenceLinks.enabled.description":"Controls whether reference links in Markdown files are validated, for example: `[link][ref]`. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fragmentLinks.enabled.description":"Controls whether fragment links to headers in the current Markdown file are validated, for example: `[link](#header)`. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fileLinks.enabled.description":"Controls whether links to other files in Markdown files are validated, for example `[link](/path/to/file.md)`. This checks that the target files exist. Requires enabling `#markdown.validate.enabled#`.","configuration.markdown.validate.fileLinks.markdownFragmentLinks.description":"Validate the fragment part of links to headers in other files in Markdown files, for example: `[link](/path/to/file.md#header)`. Inherits the setting value from `#markdown.validate.fragmentLinks.enabled#` by default.","configuration.markdown.validate.ignoredLinks.description":"Configure links that should not be validated. For example adding `/about` would not validate the link `[about](/about)`, while the glob `/assets/**/*.svg` would let you skip validation for any link to `.svg` files under the `assets` directory.","configuration.markdown.validate.unusedLinkDefinitions.description":"Validate link definitions that are unused in the current file.","configuration.markdown.validate.duplicateLinkDefinitions.description":"Validate duplicated definitions in the current file.","configuration.markdown.updateLinksOnFileMove.enabled":"Try to update links in Markdown files when a file is renamed/moved in the workspace. Use `#markdown.updateLinksOnFileMove.include#` to configure which files trigger link updates.","configuration.markdown.updateLinksOnFileMove.enabled.prompt":"Prompt on each file move.","configuration.markdown.updateLinksOnFileMove.enabled.always":"Always update links automatically.","configuration.markdown.updateLinksOnFileMove.enabled.never":"Never try to update link and don't prompt.","configuration.markdown.updateLinksOnFileMove.include":"Glob patterns that specifies files that trigger automatic link updates. See `#markdown.updateLinksOnFileMove.enabled#` for details about this feature.","configuration.markdown.updateLinksOnFileMove.include.property":"The glob pattern to match file paths against. Set to true to enable the pattern.","configuration.markdown.updateLinksOnFileMove.enableForDirectories":"Enable updating links when a directory is moved or renamed in the workspace.","configuration.markdown.occurrencesHighlight.enabled":"Controls whether link occurrences in the current document are highlighted.","configuration.markdown.copyFiles.destination":{message:"Configures the path and file name of files created by copy/paste or drag and drop. This is a map of globs that match against a Markdown document path to the destination path where the new file should be created.\n\nThe destination path may use the following variables:\n\n- `${documentDirName}` \u2014 Absolute parent directory path of the Markdown document, e.g. `/Users/me/myProject/docs`.\n- `${documentRelativeDirName}` \u2014 Relative parent directory path of the Markdown document, e.g. `docs`. This is the same as `${documentDirName}` if the file is not part of a workspace.\n- `${documentFileName}` \u2014 The full filename of the Markdown document, e.g. `README.md`.\n- `${documentBaseName}` \u2014 The basename of the Markdown document, e.g. `README`.\n- `${documentExtName}` \u2014 The extension of the Markdown document, e.g. `md`.\n- `${documentFilePath}` \u2014 Absolute path of the Markdown document, e.g. `/Users/me/myProject/docs/README.md`.\n- `${documentRelativeFilePath}` \u2014 Relative path of the Markdown document, e.g. `docs/README.md`. This is the same as `${documentFilePath}` if the file is not part of a workspace.\n- `${documentWorkspaceFolder}` \u2014 The workspace folder for the Markdown document, e.g. `/Users/me/myProject`. This is the same as `${documentDirName}` if the file is not part of a workspace.\n- `${fileName}` \u2014 The file name of the dropped file, e.g. `image.png`.\n- `${fileExtName}` \u2014 The extension of the dropped file, e.g. `png`.\n- `${unixTime}` \u2014 The current Unix timestamp in milliseconds.\n- `${isoTime}` \u2014 The current time in ISO 8601 format, e.g. '2025-06-06T08:40:32.123Z'.",comment:["This setting is use the user drops or pastes image data into the editor. In this case, VS Code automatically creates a new image file in the workspace containing the dropped/pasted image.","It's easier to explain this setting with an example. For example, let's say the setting value was:","","{ 'docs/*.md': '${documentDirName}/images/${fileName}' }","","Here the setting is an object mapping from a set of globs to a set of file destinations.","The left hand side ('docs/*.md') is a glob that matches against a markdown document. If the glob, matches then we use the right hand side to compute the new file's path and name. The right hand side can also use the special variables document in this setting description."]},"configuration.markdown.copyFiles.overwriteBehavior":"Controls if files created by drop or paste should overwrite existing files.","configuration.markdown.copyFiles.overwriteBehavior.nameIncrementally":"If a file with the same name already exists, append a number to the file name, for example: `image.png` becomes `image-1.png`.","configuration.markdown.copyFiles.overwriteBehavior.overwrite":"If a file with the same name already exists, overwrite it.","configuration.markdown.preferredMdPathExtensionStyle":"Controls if file extensions (for example `.md`) are added or not for links to Markdown files. This setting is used when file paths are added by tooling such as path completions or file renames.","configuration.markdown.preferredMdPathExtensionStyle.auto":"For existing paths, try to maintain the file extension style. For new paths, add file extensions.","configuration.markdown.preferredMdPathExtensionStyle.includeExtension":"Prefer including the file extension. For example, path completions to a file named `file.md` will insert `file.md`.","configuration.markdown.preferredMdPathExtensionStyle.removeExtension":"Prefer removing the file extension. For example, path completions to a file named `file.md` will insert `file` without the `.md`.","configuration.markdown.editor.filePaste.videoSnippet":"Snippet used when adding videos to Markdown. This snippet can use the following variables:\n- `${src}` \u2014 The resolved path of the video file.\n- `${title}` \u2014 The title used for the video. A snippet placeholder will automatically be created for this variable.","configuration.markdown.editor.filePaste.audioSnippet":"Snippet used when adding audio to Markdown. This snippet can use the following variables:\n- `${src}` \u2014 The resolved path of the audio  file.\n- `${title}` \u2014 The title used for the audio. A snippet placeholder will automatically be created for this variable.","configuration.markdown.editor.updateLinksOnPaste.enabled":"Enable/disable a paste option that updates links and reference in text that is copied and pasted between Markdown editors.\n\nTo use this feature, after pasting text that contains updatable links, just click on the Paste Widget and select `Paste and update pasted links`.",workspaceTrust:"Required for loading styles configured in the workspace."},readmePath:"markdown-language-features/README.md"},{extensionPath:"markdown-math",packageJSON:{name:"markdown-math",displayName:"%displayName%",description:"%description%",version:"10.0.0",icon:"icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.54.0"},categories:["Other","Programming Languages"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},main:"./dist/extension",browser:"./dist/browser/extension",activationEvents:[],contributes:{languages:[{id:"markdown-math",aliases:[]}],grammars:[{language:"markdown-math",scopeName:"text.html.markdown.math",path:"./syntaxes/md-math.tmLanguage.json"},{scopeName:"markdown.math.block",path:"./syntaxes/md-math-block.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex"}},{scopeName:"markdown.math.inline",path:"./syntaxes/md-math-inline.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex","punctuation.definition.math.end.markdown":"latex"}},{scopeName:"markdown.math.codeblock",path:"./syntaxes/md-math-fence.tmLanguage.json",injectTo:["text.html.markdown"],embeddedLanguages:{"meta.embedded.math.markdown":"latex"}}],notebookRenderer:[{id:"vscode.markdown-it-katex-extension",displayName:"Markdown it KaTeX renderer",entrypoint:{extends:"vscode.markdown-it-renderer",path:"./notebook-out/katex.js"}}],"markdown.markdownItPlugins":!0,"markdown.previewStyles":["./notebook-out/katex.min.css","./preview-styles/index.css"],configuration:[{title:"Markdown Math",properties:{"markdown.math.enabled":{type:"boolean",default:!0,description:"%config.markdown.math.enabled%"},"markdown.math.macros":{type:"object",additionalProperties:{type:"string"},default:{},description:"%config.markdown.math.macros%",scope:"resource"}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Markdown Math",description:"Adds math support to Markdown in notebooks.","config.markdown.math.enabled":"Enable/disable rendering math in the built-in Markdown preview.","config.markdown.math.macros":"A collection of custom macros. Each macro is a key-value pair where the key is a new command name and the value is the expansion of the macro."},readmePath:"markdown-math/README.md"},{extensionPath:"media-preview",packageJSON:{name:"media-preview",displayName:"%displayName%",description:"%description%",extensionKind:["ui","workspace"],version:"10.0.0",publisher:"vscode",icon:"icon.png",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension.js",categories:["Other"],activationEvents:[],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{configuration:{type:"object",title:"Media Previewer",properties:{"mediaPreview.video.autoPlay":{type:"boolean",default:!1,markdownDescription:"%videoPreviewerAutoPlay%"},"mediaPreview.video.loop":{type:"boolean",default:!1,markdownDescription:"%videoPreviewerLoop%"}}},customEditors:[{viewType:"imagePreview.previewEditor",displayName:"%customEditor.imagePreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{jpg,jpe,jpeg,png,bmp,gif,ico,webp,avif,svg}"}]},{viewType:"vscode.audioPreview",displayName:"%customEditor.audioPreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{mp3,wav,ogg,oga}"}]},{viewType:"vscode.videoPreview",displayName:"%customEditor.videoPreview.displayName%",priority:"builtin",selector:[{filenamePattern:"*.{mp4,webm}"}]}],commands:[{command:"imagePreview.zoomIn",title:"%command.zoomIn%",category:"Image Preview"},{command:"imagePreview.zoomOut",title:"%command.zoomOut%",category:"Image Preview"},{command:"imagePreview.copyImage",title:"%command.copyImage%",category:"Image Preview"},{command:"imagePreview.reopenAsPreview",title:"%command.reopenAsPreview%",category:"Image Preview",icon:"$(preview)"},{command:"imagePreview.reopenAsText",title:"%command.reopenAsText%",category:"Image Preview",icon:"$(go-to-file)"}],menus:{commandPalette:[{command:"imagePreview.zoomIn",when:"activeCustomEditorId == 'imagePreview.previewEditor'",group:"1_imagePreview"},{command:"imagePreview.zoomOut",when:"activeCustomEditorId == 'imagePreview.previewEditor'",group:"1_imagePreview"},{command:"imagePreview.copyImage",when:"false"},{command:"imagePreview.reopenAsPreview",when:"activeEditor == workbench.editors.files.textFileEditor && resourceExtname == '.svg'",group:"navigation"},{command:"imagePreview.reopenAsText",when:"activeCustomEditorId == 'imagePreview.previewEditor' && resourceExtname == '.svg'",group:"navigation"}],"webview/context":[{command:"imagePreview.copyImage",when:"webviewId == 'imagePreview.previewEditor'"}],"editor/title":[{command:"imagePreview.reopenAsPreview",when:"editorFocus && resourceExtname == '.svg'",group:"navigation"},{command:"imagePreview.reopenAsText",when:"activeCustomEditorId == 'imagePreview.previewEditor' && resourceExtname == '.svg'",group:"navigation"}]}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Media Preview",description:"Provides VS Code's built-in previews for images, audio, and video","customEditor.audioPreview.displayName":"Audio Preview","customEditor.imagePreview.displayName":"Image Preview","customEditor.videoPreview.displayName":"Video Preview",videoPreviewerAutoPlay:"Start playing videos on mute automatically.",videoPreviewerLoop:"Loop videos over again automatically.","command.zoomIn":"Zoom in","command.zoomOut":"Zoom out","command.copyImage":"Copy","command.reopenAsPreview":"Reopen as image preview","command.reopenAsText":"Reopen as source text"},readmePath:"media-preview/README.md"},{extensionPath:"merge-conflict",packageJSON:{name:"merge-conflict",publisher:"vscode",displayName:"%displayName%",description:"%description%",icon:"media/icon.png",version:"10.0.0",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.5.0"},categories:["Other"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},activationEvents:["onStartupFinished"],main:"./dist/mergeConflictMain",browser:"./dist/browser/mergeConflictMain",contributes:{commands:[{category:"%command.category%",title:"%command.accept.all-current%",original:"Accept All Current",command:"merge-conflict.accept.all-current",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.all-incoming%",original:"Accept All Incoming",command:"merge-conflict.accept.all-incoming",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.all-both%",original:"Accept All Both",command:"merge-conflict.accept.all-both",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.current%",original:"Accept Current",command:"merge-conflict.accept.current",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.incoming%",original:"Accept Incoming",command:"merge-conflict.accept.incoming",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.selection%",original:"Accept Selection",command:"merge-conflict.accept.selection",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.accept.both%",original:"Accept Both",command:"merge-conflict.accept.both",enablement:"!isMergeEditor"},{category:"%command.category%",title:"%command.next%",original:"Next Conflict",command:"merge-conflict.next",enablement:"!isMergeEditor",icon:"$(arrow-down)"},{category:"%command.category%",title:"%command.previous%",original:"Previous Conflict",command:"merge-conflict.previous",enablement:"!isMergeEditor",icon:"$(arrow-up)"},{category:"%command.category%",title:"%command.compare%",original:"Compare Current Conflict",command:"merge-conflict.compare",enablement:"!isMergeEditor"}],menus:{"scm/resourceState/context":[{command:"merge-conflict.accept.all-current",when:"scmProvider == git && scmResourceGroup == merge",group:"1_modification"},{command:"merge-conflict.accept.all-incoming",when:"scmProvider == git && scmResourceGroup == merge",group:"1_modification"}],"editor/title":[{command:"merge-conflict.previous",group:"navigation@1",when:"!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"},{command:"merge-conflict.next",group:"navigation@2",when:"!isMergeEditor && mergeConflictsCount && mergeConflictsCount != 0"}]},configuration:{title:"%config.title%",properties:{"merge-conflict.codeLens.enabled":{type:"boolean",description:"%config.codeLensEnabled%",default:!0},"merge-conflict.decorators.enabled":{type:"boolean",description:"%config.decoratorsEnabled%",default:!0},"merge-conflict.autoNavigateNextConflict.enabled":{type:"boolean",description:"%config.autoNavigateNextConflictEnabled%",default:!1},"merge-conflict.diffViewPosition":{type:"string",enum:["Current","Beside","Below"],description:"%config.diffViewPosition%",enumDescriptions:["%config.diffViewPosition.current%","%config.diffViewPosition.beside%","%config.diffViewPosition.below%"],default:"Current"}}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Merge Conflict",description:"Highlighting and commands for inline merge conflicts.","command.category":"Merge Conflict","command.accept.all-current":"Accept All Current","command.accept.all-incoming":"Accept All Incoming","command.accept.all-both":"Accept All Both","command.accept.current":"Accept Current","command.accept.incoming":"Accept Incoming","command.accept.selection":"Accept Selection","command.accept.both":"Accept Both","command.next":"Next Conflict","command.previous":"Previous Conflict","command.compare":"Compare Current Conflict","config.title":"Merge Conflict","config.autoNavigateNextConflictEnabled":"Whether to automatically navigate to the next merge conflict after resolving a merge conflict.","config.codeLensEnabled":"Create a CodeLens for merge conflict blocks within editor.","config.decoratorsEnabled":"Create decorators for merge conflict blocks within editor.","config.diffViewPosition":"Controls where the diff view should be opened when comparing changes in merge conflicts.","config.diffViewPosition.current":"Open the diff view in the current editor group.","config.diffViewPosition.beside":"Open the diff view next to the current editor group.","config.diffViewPosition.below":"Open the diff view below the current editor group."},readmePath:"merge-conflict/README.md"},{extensionPath:"mermaid-markdown-features",packageJSON:{name:"mermaid-markdown-features",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",repository:{type:"git",url:"https://github.com/microsoft/vscode.git"},aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.104.0"},enabledApiProposals:["chatOutputRenderer"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},main:"./dist/extension",browser:"./dist/browser/extension",activationEvents:["onWebviewPanel:vscode.mermaid-markdown-features.preview"],contributes:{commands:[{command:"_mermaid-markdown.resetPanZoom",title:"%command.resetPanZoom.title%"},{command:"_mermaid-markdown.openInEditor",title:"%command.openInEditor.title%"},{command:"_mermaid-markdown.copySource",title:"%command.copySource.title%"}],menus:{commandPalette:[{command:"_mermaid-markdown.resetPanZoom",when:"false"},{command:"_mermaid-markdown.openInEditor",when:"false"},{command:"_mermaid-markdown.copySource",when:"false"}],"webview/context":[{command:"_mermaid-markdown.openInEditor",when:"webviewId == 'vscode.mermaid-markdown-features.chatOutputItem' || ((webviewId == 'markdown.preview' || webviewId == 'vscode.markdown.preview.editor' || webviewId == 'notebook.output') && webviewSection == 'mermaid')",group:"navigation@1"},{command:"_mermaid-markdown.copySource",when:"webviewId == 'vscode.mermaid-markdown-features.chatOutputItem' || webviewId == 'vscode.mermaid-markdown-features.preview' || ((webviewId == 'markdown.preview' || webviewId == 'vscode.markdown.preview.editor' || webviewId == 'notebook.output') && webviewSection == 'mermaid')",group:"navigation@2"},{command:"_mermaid-markdown.resetPanZoom",when:"webviewId == 'vscode.mermaid-markdown-features.chatOutputItem' || webviewId == 'vscode.mermaid-markdown-features.preview'",group:"navigation@3"}]},configuration:{title:"%config.title%",properties:{"markdown-mermaid.lightModeTheme":{order:0,type:"string",enum:["base","forest","dark","default","neutral"],default:"default",description:"%config.markdown-mermaid.lightModeTheme.description%"},"markdown-mermaid.darkModeTheme":{order:1,type:"string",enum:["base","forest","dark","default","neutral"],default:"dark",description:"%config.markdown-mermaid.darkModeTheme.description%"},"markdown-mermaid.languages":{order:2,type:"array",default:["mermaid"],description:"%config.markdown-mermaid.languages.description%"},"markdown-mermaid.maxTextSize":{order:3,type:"number",default:5e4,description:"%config.markdown-mermaid.maxTextSize.description%"},"markdown-mermaid.mouseNavigation.enabled":{type:"string",description:"%config.markdown-mermaid.mouseNavigation.enabled.description%",enum:["always","alt","never"],default:"alt",markdownEnumDescriptions:["%config.markdown-mermaid.mouseNavigation.enabled.always%","%config.markdown-mermaid.mouseNavigation.enabled.alt%","%config.markdown-mermaid.mouseNavigation.enabled.never%"]},"markdown-mermaid.controls.show":{type:"string",description:"%config.markdown-mermaid.controls.show.description%",enum:["never","onHoverOrFocus","always"],enumDescriptions:["%config.markdown-mermaid.controls.show.never%","%config.markdown-mermaid.controls.show.onHoverOrFocus%","%config.markdown-mermaid.controls.show.always%"],default:"onHoverOrFocus"},"markdown-mermaid.resizable":{type:"boolean",default:!0,description:"%config.markdown-mermaid.resizable.description%"},"markdown-mermaid.maxHeight":{type:"string",default:"",markdownDescription:"%config.markdown-mermaid.maxHeight.markdownDescription%"}}},"markdown.previewScripts":[{path:"./markdown-preview-out/index.js",type:"module"}],notebookRenderer:[{id:"vscode.markdown-it.mermaid-extension",displayName:"Markdown-It Mermaid Renderer",entrypoint:{extends:"vscode.markdown-it-renderer",path:"./notebook-out/index.js"}}],"markdown.markdownItPlugins":!0,chatOutputRenderers:[{viewType:"vscode.mermaid-markdown-features.chatOutputItem",mimeTypes:["text/vnd.mermaid"],codeBlockLanguageIdentifiers:["mermaid"]}],languageModelTools:[{name:"renderMermaidDiagram",displayName:"Mermaid Renderer",toolReferenceName:"renderMermaidDiagram",legacyToolReferenceFullNames:["vscode.mermaid-chat-features/renderMermaidDiagram"],canBeReferencedInPrompt:!0,modelDescription:"Renders a Mermaid diagram from Mermaid.js markup.",userDescription:"Render a Mermaid.js diagram from markup.",when:"chatSessionType == local",inputSchema:{type:"object",properties:{markup:{type:"string",description:"The mermaid diagram markup to render as a Mermaid diagram. This should only be the markup of the diagram. Do not include a wrapping code block."},title:{type:"string",description:"A short title that describes the diagram."}}}}]},overrides:{"lodash-es":"4.18.1"}},packageNLS:{displayName:"Mermaid Markdown Features",description:"Adds Mermaid diagram support to built-in chats, Markdown previews, and notebooks.","command.resetPanZoom.title":"Reset Pan and Zoom","command.openInEditor.title":"Open Diagram in Editor","command.copySource.title":"Copy Diagram Source","config.title":"Mermaid","config.markdown-mermaid.lightModeTheme.description":"Default Mermaid theme for light mode.","config.markdown-mermaid.darkModeTheme.description":"Default Mermaid theme for dark mode.","config.markdown-mermaid.languages.description":"Default languages in Markdown.","config.markdown-mermaid.maxTextSize.description":"The maximum allowed size of the user's text diagram.","config.markdown-mermaid.mouseNavigation.enabled.description":"Controls when mouse-based navigation is enabled on Mermaid diagrams.","config.markdown-mermaid.mouseNavigation.enabled.always":"Always enable mouse navigation on Mermaid diagrams.","config.markdown-mermaid.mouseNavigation.enabled.alt":"Only enable mouse navigation when holding down Alt (Option on macOS). Gestures such as pinch-to-zoom will still work without Alt.","config.markdown-mermaid.mouseNavigation.enabled.never":"Disable mouse navigation.","config.markdown-mermaid.controls.show.description":"Controls showing UI controls on Mermaid diagrams.","config.markdown-mermaid.controls.show.never":"Never show controls.","config.markdown-mermaid.controls.show.onHoverOrFocus":"Show zoom controls when hovering over or focusing a diagram.","config.markdown-mermaid.controls.show.always":"Always show zoom controls.","config.markdown-mermaid.resizable.description":"Allow diagrams to be resized vertically by dragging the bottom edge.","config.markdown-mermaid.maxHeight.markdownDescription":"Maximum height for diagrams. Must be a CSS value with units such as `80vh` or `400px`. Leave empty to try to automatically size diagrams based on their content."},readmePath:"mermaid-markdown-features/README.md"},{extensionPath:"ms-vscode.vscode-js-profile-table",packageJSON:{name:"vscode-js-profile-table",version:"1.0.10",displayName:"Table Visualizer for JavaScript Profiles",description:"Text visualizer for profiles taken from the JavaScript debugger",author:"Connor Peet <connor@peet.io>",homepage:"https://github.com/microsoft/vscode-js-profile-visualizer#readme",license:"MIT",main:"out/extension.js",browser:"out/extension.web.js",repository:{type:"git",url:"https://github.com/microsoft/vscode-js-profile-visualizer.git"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},icon:"resources/icon.png",publisher:"ms-vscode",sideEffects:!1,engines:{vscode:"^1.74.0"},contributes:{customEditors:[{viewType:"jsProfileVisualizer.cpuprofile.table",displayName:"CPU Profile Table Visualizer",priority:"default",selector:[{filenamePattern:"*.cpuprofile"}]},{viewType:"jsProfileVisualizer.heapprofile.table",displayName:"Heap Profile Table Visualizer",priority:"default",selector:[{filenamePattern:"*.heapprofile"}]},{viewType:"jsProfileVisualizer.heapsnapshot.table",displayName:"Heap Snapshot Table Visualizer",priority:"default",selector:[{filenamePattern:"*.heapsnapshot"}]}],commands:[{command:"extension.jsProfileVisualizer.table.clearCodeLenses",title:"Clear Profile Code Lenses"}],menus:{commandPalette:[{command:"extension.jsProfileVisualizer.table.clearCodeLenses",when:"jsProfileVisualizer.hasCodeLenses == true"}]}},bugs:{url:"https://github.com/microsoft/vscode-js-profile-visualizer/issues"},__metadata:{id:"7e52b41b-71ad-457b-ab7e-0620f1fc4feb",publisherId:{publisherId:"5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee",publisherName:"ms-vscode",displayName:"Microsoft",flags:"verified"},publisherDisplayName:"Microsoft"}},readmePath:"ms-vscode.vscode-js-profile-table/README.md"},{extensionPath:"notebook-renderers",packageJSON:{name:"builtin-notebook-renderers",displayName:"%displayName%",description:"%description%",publisher:"vscode",version:"10.0.0",license:"MIT",icon:"media/icon.png",engines:{vscode:"^1.57.0"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{notebookRenderer:[{id:"vscode.builtin-renderer",entrypoint:"./renderer-out/index.js",displayName:"VS Code Builtin Notebook Output Renderer",requiresMessaging:"never",mimeTypes:["image/gif","image/png","image/jpeg","image/git","image/svg+xml","text/html","application/javascript","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","text/plain"]}]},scripts:{compile:"npx gulp compile-extension:notebook-renderers && npm run build-notebook",watch:"npx gulp compile-watch:notebook-renderers","build-notebook":"node ./esbuild.notebook.mts"},devDependencies:{"@types/jsdom":"^21.1.0","@types/node":"^22.18.10","@types/vscode-notebook-renderer":"^1.60.0",jsdom:"^28.1.0"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Builtin Notebook Output Renderers",description:"Provides basic output renderers for notebooks"},readmePath:"notebook-renderers/README.md"},{extensionPath:"npm",packageJSON:{name:"npm",publisher:"vscode",displayName:"%displayName%",description:"%description%",version:"1.0.1",private:!0,license:"MIT",engines:{vscode:"0.10.x"},icon:"images/npm_icon.png",categories:["Other"],enabledApiProposals:["terminalQuickFixProvider"],main:"./dist/npmMain",browser:"./dist/browser/npmBrowserMain",activationEvents:["onTaskType:npm","onLanguage:json","workspaceContains:package.json"],capabilities:{virtualWorkspaces:{supported:"limited",description:"%virtualWorkspaces%"},untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%"}},contributes:{languages:[{id:"ignore",extensions:[".npmignore"]},{id:"properties",extensions:[".npmrc"]}],views:{explorer:[{id:"npm",name:"%view.name%",when:"npm:showScriptExplorer",icon:"$(json)",visibility:"hidden",contextualTitle:"%view.name%"}]},commands:[{command:"npm.runScript",title:"%command.run%",icon:"$(run)"},{command:"npm.debugScript",title:"%command.debug%",icon:"$(debug)"},{command:"npm.openScript",title:"%command.openScript%"},{command:"npm.runInstall",title:"%command.runInstall%"},{command:"npm.refresh",title:"%command.refresh%",icon:"$(refresh)"},{command:"npm.runSelectedScript",title:"%command.runSelectedScript%"},{command:"npm.runScriptFromFolder",title:"%command.runScriptFromFolder%"},{command:"npm.packageManager",title:"%command.packageManager%"}],menus:{commandPalette:[{command:"npm.refresh",when:"false"},{command:"npm.runScript",when:"false"},{command:"npm.debugScript",when:"false"},{command:"npm.openScript",when:"false"},{command:"npm.runInstall",when:"false"},{command:"npm.runSelectedScript",when:"false"},{command:"npm.runScriptFromFolder",when:"false"},{command:"npm.packageManager",when:"false"}],"editor/context":[{command:"npm.runSelectedScript",when:"resourceFilename == 'package.json' && resourceScheme == file",group:"navigation@+1"}],"view/title":[{command:"npm.refresh",when:"view == npm",group:"navigation"}],"view/item/context":[{command:"npm.openScript",when:"view == npm && viewItem == packageJSON",group:"navigation@1"},{command:"npm.runInstall",when:"view == npm && viewItem == packageJSON",group:"navigation@2"},{command:"npm.openScript",when:"view == npm && viewItem == script",group:"navigation@1"},{command:"npm.runScript",when:"view == npm && viewItem == script",group:"navigation@2"},{command:"npm.runScript",when:"view == npm && viewItem == script",group:"inline"},{command:"npm.debugScript",when:"view == npm && viewItem == script",group:"inline"},{command:"npm.debugScript",when:"view == npm && viewItem == script",group:"navigation@3"}],"explorer/context":[{when:"config.npm.enableRunFromFolder && explorerViewletVisible && explorerResourceIsFolder && resourceScheme == file",command:"npm.runScriptFromFolder",group:"2_workspace"}]},configuration:{id:"npm",type:"object",title:"Npm",properties:{"npm.autoDetect":{type:"string",enum:["off","on"],default:"on",scope:"resource",description:"%config.npm.autoDetect%"},"npm.runSilent":{type:"boolean",default:!1,scope:"resource",markdownDescription:"%config.npm.runSilent%"},"npm.packageManager":{scope:"resource",type:"string",enum:["auto","npm","yarn","pnpm","bun"],enumDescriptions:["%config.npm.packageManager.auto%","%config.npm.packageManager.npm%","%config.npm.packageManager.yarn%","%config.npm.packageManager.pnpm%","%config.npm.packageManager.bun%"],default:"auto",description:"%config.npm.packageManager%"},"npm.scriptRunner":{scope:"resource",type:"string",enum:["auto","npm","yarn","pnpm","bun","node"],enumDescriptions:["%config.npm.scriptRunner.auto%","%config.npm.scriptRunner.npm%","%config.npm.scriptRunner.yarn%","%config.npm.scriptRunner.pnpm%","%config.npm.scriptRunner.bun%","%config.npm.scriptRunner.node%"],default:"auto",description:"%config.npm.scriptRunner%"},"npm.exclude":{type:["string","array"],items:{type:"string"},description:"%config.npm.exclude%",scope:"resource"},"npm.enableScriptExplorer":{type:"boolean",default:!1,scope:"resource",deprecationMessage:"The NPM Script Explorer is now available in 'Views' menu in the Explorer in all folders.",markdownDescription:"%config.npm.enableScriptExplorer%"},"npm.enableRunFromFolder":{type:"boolean",default:!1,scope:"resource",description:"%config.npm.enableRunFromFolder%"},"npm.scriptExplorerAction":{type:"string",enum:["open","run"],markdownDescription:"%config.npm.scriptExplorerAction%",scope:"window",default:"open"},"npm.scriptExplorerExclude":{type:"array",items:{type:"string"},markdownDescription:"%config.npm.scriptExplorerExclude%",scope:"resource",default:[]},"npm.fetchOnlinePackageInfo":{type:"boolean",description:"%config.npm.fetchOnlinePackageInfo%",default:!0,scope:"window",tags:["usesOnlineServices"]},"npm.scriptHover":{type:"boolean",markdownDescription:"%config.npm.scriptHover%",default:!0,scope:"window"}}},jsonValidation:[{fileMatch:"package.json",url:"https://www.schemastore.org/package"},{fileMatch:"bower.json",url:"https://www.schemastore.org/bower"}],taskDefinitions:[{type:"npm",required:["script"],properties:{script:{type:"string",description:"%taskdef.script%"},path:{type:"string",description:"%taskdef.path%"}},when:"shellExecutionSupported"}],terminalQuickFixes:[{id:"ms-vscode.npm-command",commandLineMatcher:"npm",commandExitResult:"error",outputMatcher:{anchor:"bottom",length:8,lineMatcher:"Did you mean (?:this|one of these)\\?((?:\\n.+?npm .+ #.+)+)",offset:2}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{description:"Extension to add task support for npm scripts.",displayName:"NPM support for VS Code",workspaceTrust:"This extension executes tasks, which require trust to run.",virtualWorkspaces:"Functionality that requires running the 'npm' command is not available in virtual workspaces.","config.npm.autoDetect":"Controls whether npm scripts should be automatically detected.","config.npm.runSilent":"Run npm commands with the `--silent` option.","config.npm.packageManager":"The package manager used to install dependencies.","config.npm.packageManager.npm":"Use npm as the package manager.","config.npm.packageManager.yarn":"Use yarn as the package manager.","config.npm.packageManager.pnpm":"Use pnpm as the package manager.","config.npm.packageManager.bun":"Use bun as the package manager.","config.npm.packageManager.auto":"Auto-detect which package manager to use based on lock files and installed package managers.","config.npm.scriptRunner":"The script runner used to run scripts.","config.npm.scriptRunner.npm":"Use npm as the script runner.","config.npm.scriptRunner.yarn":"Use yarn as the script runner.","config.npm.scriptRunner.pnpm":"Use pnpm as the script runner.","config.npm.scriptRunner.bun":"Use bun as the script runner.","config.npm.scriptRunner.node":"Use Node.js as the script runner.","config.npm.scriptRunner.auto":"Auto-detect which script runner to use based on lock files and installed package managers.","config.npm.exclude":"Configure glob patterns for folders that should be excluded from automatic script detection.","config.npm.enableScriptExplorer":"Enable an explorer view for npm scripts when there is no top-level `package.json` file.","config.npm.scriptExplorerAction":"The default click action used in the NPM Scripts Explorer: `open` or `run`, the default is `open`.","config.npm.scriptExplorerExclude":"An array of regular expressions that indicate which scripts should be excluded from the NPM Scripts view.","config.npm.enableRunFromFolder":"Enable running npm scripts contained in a folder from the Explorer context menu.","config.npm.fetchOnlinePackageInfo":"Fetch data from https://registry.npmjs.org and https://registry.bower.io to provide auto-completion and information on hover features on npm dependencies.","config.npm.scriptHover":"Display hover with `Run` and `Debug` commands for scripts.","npm.parseError":"Npm task detection: failed to parse the file {0}","taskdef.script":"The npm script to customize.","taskdef.path":"The path to the folder of the package.json file that provides the script. Can be omitted.","view.name":"NPM Scripts","command.refresh":"Refresh","command.run":"Run","command.debug":"Debug","command.openScript":"Open","command.runInstall":"Run Install","command.runSelectedScript":"Run Script","command.runScriptFromFolder":"Run NPM Script in Folder...","command.packageManager":"Get Configured Package Manager"},readmePath:"npm/README.md"},{extensionPath:"objective-c",packageJSON:{name:"objective-c",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.js"},categories:["Programming Languages"],contributes:{languages:[{id:"objective-c",extensions:[".m"],aliases:["Objective-C"],configuration:"./language-configuration.json"},{id:"objective-cpp",extensions:[".mm"],aliases:["Objective-C++"],configuration:"./language-configuration.json"}],grammars:[{language:"objective-c",scopeName:"source.objc",path:"./syntaxes/objective-c.tmLanguage.json"},{language:"objective-cpp",scopeName:"source.objcpp",path:"./syntaxes/objective-c++.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Objective-C Language Basics",description:"Provides syntax highlighting and bracket matching in Objective-C files."}},{extensionPath:"perl",packageJSON:{name:"perl",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/perl.tmbundle Syntaxes/Perl.plist ./syntaxes/perl.tmLanguage.json Syntaxes/Perl%206.tmLanguage ./syntaxes/perl6.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"perl",aliases:["Perl","perl"],extensions:[".pl",".pm",".pod",".t",".PL",".psgi"],firstLine:"^#!.*\\bperl\\b",configuration:"./perl.language-configuration.json"},{id:"raku",aliases:["Raku","Perl6","perl6"],extensions:[".raku",".rakumod",".rakutest",".rakudoc",".nqp",".p6",".pl6",".pm6"],firstLine:"(^#!.*\\bperl6\\b)|use\\s+v6|raku|=begin\\spod|my\\sclass",configuration:"./perl6.language-configuration.json"}],grammars:[{language:"perl",scopeName:"source.perl",path:"./syntaxes/perl.tmLanguage.json",unbalancedBracketScopes:["variable.other.predefined.perl"]},{language:"raku",scopeName:"source.perl.6",path:"./syntaxes/perl6.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Perl Language Basics",description:"Provides syntax highlighting and bracket matching in Perl files."}},{extensionPath:"php",packageJSON:{name:"php",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},categories:["Programming Languages"],contributes:{languages:[{id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],firstLine:"^#!\\s*/.*\\bphp\\b",mimetypes:["application/x-php"],configuration:"./language-configuration.json"}],grammars:[{language:"php",scopeName:"source.php",path:"./syntaxes/php.tmLanguage.json"},{language:"php",scopeName:"text.html.php",path:"./syntaxes/html.tmLanguage.json",embeddedLanguages:{"text.html":"html","source.php":"php","source.sql":"sql","text.xml":"xml","source.js":"javascript","source.json":"json","source.css":"css"}}],snippets:[{language:"php",path:"./snippets/php.code-snippets"}]},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"PHP Language Basics",description:"Provides syntax highlighting and bracket matching for PHP files."}},{extensionPath:"powershell",packageJSON:{name:"powershell",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"powershell",extensions:[".ps1",".psm1",".psd1",".pssc",".psrc"],aliases:["PowerShell","powershell","ps","ps1","pwsh"],firstLine:"^#!\\s*/.*\\bpwsh\\b",configuration:"./language-configuration.json"}],grammars:[{language:"powershell",scopeName:"source.powershell",path:"./syntaxes/powershell.tmLanguage.json"}]},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin PowerShell/EditorSyntax PowerShellSyntax.tmLanguage ./syntaxes/powershell.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Powershell Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Powershell files."}},{extensionPath:"prompt-basics",packageJSON:{name:"prompt",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.20.0"},categories:["Programming Languages"],contributes:{languages:[{id:"prompt",aliases:["Prompt","prompt"],extensions:[".prompt.md"],configuration:"./language-configuration.json"},{id:"instructions",aliases:["Instructions","instructions"],extensions:[".instructions.md","copilot-instructions.md"],filenamePatterns:["**/.claude/rules/**/*.md"],configuration:"./language-configuration.json"},{id:"chatagent",aliases:["Agent","chat agent"],extensions:[".agent.md",".chatmode.md"],filenamePatterns:["**/.github/agents/*.md","**/.claude/agents/*.md"],configuration:"./language-configuration.json"},{id:"skill",aliases:["Skill","skill"],filenames:["SKILL.md"],configuration:"./language-configuration.json"}],grammars:[{language:"prompt",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"instructions",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"chatagent",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]},{language:"skill",path:"./syntaxes/prompt.tmLanguage.json",scopeName:"text.html.markdown.prompt",unbalancedBracketScopes:["markup.underline.link.markdown","punctuation.definition.list.begin.markdown"]}],configurationDefaults:{"[prompt]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[instructions]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[chatagent]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"},"[skill]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1,"diffEditor.ignoreTrimWhitespace":!1,"editor.wordWrap":"on","editor.quickSuggestions":{comments:"off",strings:"on",other:"on"},"editor.wordBasedSuggestions":"off"}}},scripts:{},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Prompt Language Basics",description:"Syntax highlighting for Prompt and Instructions documents."}},{extensionPath:"pug",packageJSON:{name:"pug",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin davidrios/pug-tmbundle Syntaxes/Pug.JSON-tmLanguage ./syntaxes/pug.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"jade",extensions:[".pug",".jade"],aliases:["Pug","Jade","jade"],configuration:"./language-configuration.json"}],grammars:[{language:"jade",scopeName:"text.pug",path:"./syntaxes/pug.tmLanguage.json"}],configurationDefaults:{"[jade]":{"diffEditor.ignoreTrimWhitespace":!1}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Pug Language Basics",description:"Provides syntax highlighting and bracket matching in Pug files."}},{extensionPath:"python",packageJSON:{name:"python",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi",".pyi",".ipy",".pyt"],aliases:["Python","py"],filenames:["SConstruct","SConscript"],firstLine:"^#!\\s*/?.*\\bpython[0-9.-]*\\b",configuration:"./language-configuration.json"}],grammars:[{language:"python",scopeName:"source.python",path:"./syntaxes/MagicPython.tmLanguage.json"},{scopeName:"source.regexp.python",path:"./syntaxes/MagicRegExp.tmLanguage.json"}],configurationDefaults:{"[python]":{"diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never"}}},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin MagicStack/MagicPython grammars/MagicPython.tmLanguage ./syntaxes/MagicPython.tmLanguage.json grammars/MagicRegExp.tmLanguage ./syntaxes/MagicRegExp.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Python Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Python files."}},{extensionPath:"r",packageJSON:{name:"r",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin REditorSupport/vscode-R-syntax syntaxes/r.json ./syntaxes/r.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"r",extensions:[".R",".Rhistory",".Rprofile",".rt"],aliases:["R","r"],configuration:"./language-configuration.json"}],grammars:[{language:"r",scopeName:"source.r",path:"./syntaxes/r.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"R Language Basics",description:"Provides syntax highlighting and bracket matching in R files."}},{extensionPath:"razor",packageJSON:{name:"razor",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"0.10.x"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"razor",extensions:[".cshtml",".razor"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],configuration:"./language-configuration.json"}],grammars:[{language:"razor",scopeName:"text.html.cshtml",path:"./syntaxes/cshtml.tmLanguage.json",embeddedLanguages:{"section.embedded.source.cshtml":"csharp","source.css":"css","source.js":"javascript"}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Razor Language Basics",description:"Provides syntax highlighting, bracket matching and folding in Razor files."}},{extensionPath:"references-view",packageJSON:{name:"references-view",displayName:"%displayName%",description:"%description%",icon:"media/icon.png",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"^1.67.0"},capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},repository:{type:"git",url:"https://github.com/Microsoft/vscode-references-view"},bugs:{url:"https://github.com/Microsoft/vscode-references-view/issues"},activationEvents:["onCommand:references-view.find","onCommand:editor.action.showReferences"],main:"./dist/extension",browser:"./dist/browser/extension",contributes:{configuration:{properties:{"references.preferredLocation":{description:"%config.references.preferredLocation%",type:"string",default:"peek",enum:["peek","view"],enumDescriptions:["%config.references.preferredLocation.peek%","%config.references.preferredLocation.view%"]}}},viewsContainers:{activitybar:[{id:"references-view",icon:"$(references)",title:"%container.title%"}]},views:{"references-view":[{id:"references-view.tree",name:"%view.title%",when:"reference-list.isActive"}]},commands:[{command:"references-view.findReferences",title:"%cmd.references-view.findReferences%",category:"%cmd.category.references%"},{command:"references-view.findImplementations",title:"%cmd.references-view.findImplementations%",category:"%cmd.category.references%"},{command:"references-view.clearHistory",title:"%cmd.references-view.clearHistory%",category:"%cmd.category.references%",icon:"$(clear-all)"},{command:"references-view.clear",title:"%cmd.references-view.clear%",category:"%cmd.category.references%",icon:"$(clear-all)"},{command:"references-view.refresh",title:"%cmd.references-view.refresh%",category:"%cmd.category.references%",icon:"$(refresh)"},{command:"references-view.pickFromHistory",title:"%cmd.references-view.pickFromHistory%",category:"%cmd.category.references%"},{command:"references-view.removeReferenceItem",title:"%cmd.references-view.removeReferenceItem%",icon:"$(close)"},{command:"references-view.copy",title:"%cmd.references-view.copy%"},{command:"references-view.copyAll",title:"%cmd.references-view.copyAll%"},{command:"references-view.copyPath",title:"%cmd.references-view.copyPath%"},{command:"references-view.refind",title:"%cmd.references-view.refind%",icon:"$(refresh)"},{command:"references-view.showCallHierarchy",title:"%cmd.references-view.showCallHierarchy%",category:"Calls"},{command:"references-view.showOutgoingCalls",title:"%cmd.references-view.showOutgoingCalls%",category:"Calls",icon:"$(call-incoming)"},{command:"references-view.showIncomingCalls",title:"%cmd.references-view.showIncomingCalls%",category:"Calls",icon:"$(call-outgoing)"},{command:"references-view.removeCallItem",title:"%cmd.references-view.removeCallItem%",icon:"$(close)"},{command:"references-view.next",title:"%cmd.references-view.next%",enablement:"references-view.canNavigate"},{command:"references-view.prev",title:"%cmd.references-view.prev%",enablement:"references-view.canNavigate"},{command:"references-view.showTypeHierarchy",title:"%cmd.references-view.showTypeHierarchy%",category:"Types"},{command:"references-view.showSupertypes",title:"%cmd.references-view.showSupertypes%",category:"Types",icon:"$(type-hierarchy-super)"},{command:"references-view.showSubtypes",title:"%cmd.references-view.showSubtypes%",category:"Types",icon:"$(type-hierarchy-sub)"},{command:"references-view.removeTypeItem",title:"%cmd.references-view.removeTypeItem%",icon:"$(close)"}],menus:{"editor/context":[{command:"references-view.findReferences",when:"editorHasReferenceProvider",group:"0_navigation@1"},{command:"references-view.findImplementations",when:"editorHasImplementationProvider",group:"0_navigation@2"},{command:"references-view.showCallHierarchy",when:"editorHasCallHierarchyProvider",group:"0_navigation@3"},{command:"references-view.showTypeHierarchy",when:"editorHasTypeHierarchyProvider",group:"0_navigation@4"}],"view/title":[{command:"references-view.clear",group:"navigation@3",when:"view == references-view.tree && reference-list.hasResult"},{command:"references-view.clearHistory",group:"navigation@3",when:"view == references-view.tree && reference-list.hasHistory && !reference-list.hasResult"},{command:"references-view.refresh",group:"navigation@2",when:"view == references-view.tree && reference-list.hasResult"},{command:"references-view.showOutgoingCalls",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == callHierarchy &&  references-view.callHierarchyMode == showIncoming"},{command:"references-view.showIncomingCalls",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == callHierarchy &&  references-view.callHierarchyMode == showOutgoing"},{command:"references-view.showSupertypes",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == typeHierarchy &&  references-view.typeHierarchyMode != supertypes"},{command:"references-view.showSubtypes",group:"navigation@1",when:"view == references-view.tree && reference-list.hasResult && reference-list.source == typeHierarchy &&  references-view.typeHierarchyMode != subtypes"}],"view/item/context":[{command:"references-view.removeReferenceItem",group:"inline",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.removeCallItem",group:"inline",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.removeTypeItem",group:"inline",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.refind",group:"inline",when:"view == references-view.tree && viewItem == history-item"},{command:"references-view.removeReferenceItem",group:"1",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.removeCallItem",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.removeTypeItem",group:"1",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.refind",group:"1",when:"view == references-view.tree && viewItem == history-item"},{command:"references-view.copy",group:"2@1",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.copyPath",group:"2@2",when:"view == references-view.tree && viewItem == file-item"},{command:"references-view.copyAll",group:"2@3",when:"view == references-view.tree && viewItem == file-item || view == references-view.tree && viewItem == reference-item"},{command:"references-view.showOutgoingCalls",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.showIncomingCalls",group:"1",when:"view == references-view.tree && viewItem == call-item"},{command:"references-view.showSupertypes",group:"1",when:"view == references-view.tree && viewItem == type-item"},{command:"references-view.showSubtypes",group:"1",when:"view == references-view.tree && viewItem == type-item"}],commandPalette:[{command:"references-view.removeReferenceItem",when:"never"},{command:"references-view.removeCallItem",when:"never"},{command:"references-view.removeTypeItem",when:"never"},{command:"references-view.copy",when:"never"},{command:"references-view.copyAll",when:"never"},{command:"references-view.copyPath",when:"never"},{command:"references-view.refind",when:"never"},{command:"references-view.findReferences",when:"editorHasReferenceProvider"},{command:"references-view.clear",when:"reference-list.hasResult"},{command:"references-view.clearHistory",when:"reference-list.isActive && !reference-list.hasResult"},{command:"references-view.refresh",when:"reference-list.hasResult"},{command:"references-view.pickFromHistory",when:"reference-list.isActive"},{command:"references-view.next",when:"never"},{command:"references-view.prev",when:"never"}]},keybindings:[{command:"references-view.findReferences",when:"editorHasReferenceProvider",key:"shift+alt+f12"},{command:"references-view.next",when:"reference-list.hasResult",key:"f4"},{command:"references-view.prev",when:"reference-list.hasResult",key:"shift+f4"},{command:"references-view.showCallHierarchy",when:"editorHasCallHierarchyProvider",key:"shift+alt+h"}]}},packageNLS:{displayName:"Reference Search View",description:"Reference Search results as separate, stable view in the sidebar","config.references.preferredLocation":"Controls whether 'Peek References' or 'Find References' is invoked when selecting CodeLens references.","config.references.preferredLocation.peek":"Show references in peek editor.","config.references.preferredLocation.view":"Show references in separate view.","container.title":"References","view.title":"Reference Search Results","cmd.category.references":"References","cmd.references-view.findReferences":"Find All References","cmd.references-view.findImplementations":"Find All Implementations","cmd.references-view.clearHistory":"Clear History","cmd.references-view.clear":"Clear","cmd.references-view.refresh":"Refresh","cmd.references-view.pickFromHistory":"Show History","cmd.references-view.removeReferenceItem":"Dismiss","cmd.references-view.copy":"Copy","cmd.references-view.copyAll":"Copy All","cmd.references-view.copyPath":"Copy Path","cmd.references-view.refind":"Rerun","cmd.references-view.showCallHierarchy":"Show Call Hierarchy","cmd.references-view.showOutgoingCalls":"Show Outgoing Calls","cmd.references-view.showIncomingCalls":"Show Incoming Calls","cmd.references-view.removeCallItem":"Dismiss","cmd.references-view.next":"Go to Next Reference","cmd.references-view.prev":"Go to Previous Reference","cmd.references-view.showTypeHierarchy":"Show Type Hierarchy","cmd.references-view.showSupertypes":"Show Supertypes","cmd.references-view.showSubtypes":"Show Subtypes","cmd.references-view.removeTypeItem":"Dismiss"},readmePath:"references-view/README.md"},{extensionPath:"restructuredtext",packageJSON:{name:"restructuredtext",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin trond-snekvik/vscode-rst syntaxes/rst.tmLanguage.json ./syntaxes/rst.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"restructuredtext",aliases:["reStructuredText"],configuration:"./language-configuration.json",extensions:[".rst"]}],grammars:[{language:"restructuredtext",scopeName:"source.rst",path:"./syntaxes/rst.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"reStructuredText Language Basics",description:"Provides syntax highlighting in reStructuredText files."}},{extensionPath:"ruby",packageJSON:{name:"ruby",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin Shopify/ruby-lsp vscode/grammars/ruby.cson.json ./syntaxes/ruby.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".rake",".ru",".erb",".podspec",".rbi"],filenames:["rakefile","gemfile","guardfile","podfile","capfile","cheffile","hobofile","vagrantfile","appraisals","rantfile","berksfile","berksfile.lock","thorfile","puppetfile","dangerfile","brewfile","fastfile","appfile","deliverfile","matchfile","scanfile","snapfile","gymfile"],aliases:["Ruby","rb"],firstLine:"^#!\\s*/.*\\bruby\\b",configuration:"./language-configuration.json"}],grammars:[{language:"ruby",scopeName:"source.ruby",path:"./syntaxes/ruby.tmLanguage.json"}],configurationDefaults:{"[ruby]":{"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Ruby Language Basics",description:"Provides syntax highlighting and bracket matching in Ruby files."}},{extensionPath:"rust",packageJSON:{name:"rust",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"rust",extensions:[".rs"],aliases:["Rust","rust"],configuration:"./language-configuration.json"}],grammars:[{language:"rust",path:"./syntaxes/rust.tmLanguage.json",scopeName:"source.rust"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Rust Language Basics",description:"Provides syntax highlighting and bracket matching in Rust files."}},{extensionPath:"scss",packageJSON:{name:"scss",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-sass grammars/scss.cson ./syntaxes/scss.tmLanguage.json grammars/sassdoc.cson ./syntaxes/sassdoc.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"scss",aliases:["SCSS","scss"],extensions:[".scss"],mimetypes:["text/x-scss","text/scss"],configuration:"./language-configuration.json"}],grammars:[{language:"scss",scopeName:"source.css.scss",path:"./syntaxes/scss.tmLanguage.json"},{scopeName:"source.sassdoc",path:"./syntaxes/sassdoc.tmLanguage.json"}],problemMatchers:[{name:"node-sass",label:"Node Sass Compiler",owner:"node-sass",fileLocation:"absolute",pattern:[{regexp:"^{$"},{regexp:'\\s*"status":\\s\\d+,'},{regexp:'\\s*"file":\\s"(.*)",',file:1},{regexp:'\\s*"line":\\s(\\d+),',line:1},{regexp:'\\s*"column":\\s(\\d+),',column:1},{regexp:'\\s*"message":\\s"(.*)",',message:1},{regexp:'\\s*"formatted":\\s(.*)'},{regexp:"^}$"}]}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"SCSS Language Basics",description:"Provides syntax highlighting, bracket matching and folding in SCSS files."}},{extensionPath:"search-result",packageJSON:{name:"search-result",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",icon:"images/icon.png",engines:{vscode:"^1.39.0"},main:"./dist/extension.js",browser:"./dist/browser/extension",activationEvents:["onLanguage:search-result"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},enabledApiProposals:["documentFiltersExclusive"],contributes:{configurationDefaults:{"[search-result]":{"editor.lineNumbers":"off"}},languages:[{id:"search-result",extensions:[".code-search"],aliases:["Search Result"]}],grammars:[{language:"search-result",scopeName:"text.searchResult",path:"./syntaxes/searchResult.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Search Result",description:"Provides syntax highlighting and language features for tabbed search results."},readmePath:"search-result/README.md"},{extensionPath:"shaderlab",packageJSON:{name:"shaderlab",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin tgjones/shaders-tmLanguage grammars/shaderlab.json ./syntaxes/shaderlab.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"shaderlab",extensions:[".shader"],aliases:["ShaderLab","shaderlab"],configuration:"./language-configuration.json"}],grammars:[{language:"shaderlab",path:"./syntaxes/shaderlab.tmLanguage.json",scopeName:"source.shaderlab"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Shaderlab Language Basics",description:"Provides syntax highlighting and bracket matching in Shaderlab files."}},{extensionPath:"shellscript",packageJSON:{name:"shellscript",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin jeff-hykin/better-shell-syntax autogenerated/shell.tmLanguage.json ./syntaxes/shell-unix-bash.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"shellscript",aliases:["Shell Script","shellscript","bash","fish","sh","zsh","ksh","csh"],extensions:[".sh",".bash",".bashrc",".bash_aliases",".bash_profile",".bash_login",".ebuild",".eclass",".profile",".bash_logout",".xprofile",".xsession",".xsessionrc",".Xsession",".zsh",".zshrc",".zprofile",".zlogin",".zlogout",".zshenv",".zsh-theme",".fish",".ksh",".csh",".cshrc",".tcshrc",".yashrc",".yash_profile"],filenames:["APKBUILD","PKGBUILD",".envrc",".hushlogin","zshrc","zshenv","zlogin","zprofile","zlogout","bashrc_Apple_Terminal","zshrc_Apple_Terminal"],firstLine:"^#!.*\\b(bash|fish|zsh|sh|ksh|dtksh|pdksh|mksh|ash|dash|yash|sh|csh|jcsh|tcsh|itcsh).*|^#\\s*-\\*-[^*]*mode:\\s*shell-script[^*]*-\\*-",configuration:"./language-configuration.json",mimetypes:["text/x-shellscript"]}],grammars:[{language:"shellscript",scopeName:"source.shell",path:"./syntaxes/shell-unix-bash.tmLanguage.json",balancedBracketScopes:["*"],unbalancedBracketScopes:["meta.scope.case-pattern.shell"]}],configurationDefaults:{"[shellscript]":{"files.eol":`
`,"editor.defaultColorDecorators":"never"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Shell Script Language Basics",description:"Provides syntax highlighting and bracket matching in Shell Script files."}},{extensionPath:"simple-browser",packageJSON:{name:"simple-browser",displayName:"%displayName%",description:"%description%",enabledApiProposals:["externalUriOpener"],version:"10.0.0",icon:"media/icon.png",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",engines:{vscode:"^1.70.0"},main:"./dist/extension",browser:"./dist/browser/extension",categories:["Other"],extensionKind:["ui","workspace"],activationEvents:["onCommand:simpleBrowser.api.open","onOpenExternalUri:http","onOpenExternalUri:https","onWebviewPanel:simpleBrowser.view"],capabilities:{virtualWorkspaces:!0,untrustedWorkspaces:{supported:!0}},contributes:{commands:[{command:"simpleBrowser.show",title:"Show",category:"Simple Browser"}],menus:{commandPalette:[{command:"simpleBrowser.show",when:"isWeb"}]},configuration:[{title:"Simple Browser",properties:{"simpleBrowser.focusLockIndicator.enabled":{type:"boolean",default:!0,title:"Focus Lock Indicator Enabled",description:"%configuration.focusLockIndicator.enabled.description%"}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Simple Browser",description:"A very basic built-in webview for displaying web content.","configuration.focusLockIndicator.enabled.description":"Enable/disable the floating indicator that shows when focused in the simple browser."},readmePath:"simple-browser/README.md"},{extensionPath:"sql",packageJSON:{name:"sql",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"sql",extensions:[".sql",".dsql"],aliases:["MS SQL","T-SQL"],configuration:"./language-configuration.json"}],grammars:[{language:"sql",scopeName:"source.sql",path:"./syntaxes/sql.tmLanguage.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"SQL Language Basics",description:"Provides syntax highlighting and bracket matching in SQL files."}},{extensionPath:"swift",packageJSON:{name:"swift",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin jtbandes/swift-tmlanguage Swift.tmLanguage.json ./syntaxes/swift.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"swift",aliases:["Swift","swift"],extensions:[".swift"],configuration:"./language-configuration.json"}],grammars:[{language:"swift",scopeName:"source.swift",path:"./syntaxes/swift.tmLanguage.json"}],snippets:[{language:"swift",path:"./snippets/swift.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Swift Language Basics",description:"Provides snippets, syntax highlighting and bracket matching in Swift files."}},{extensionPath:"theme-abyss",packageJSON:{name:"theme-abyss",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Abyss",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/abyss-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Abyss Theme",description:"Abyss theme for Visual Studio Code",themeLabel:"Abyss"}},{extensionPath:"theme-defaults",packageJSON:{name:"theme-defaults",displayName:"%displayName%",description:"%description%",categories:["Themes"],version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},contributes:{themes:[{id:"Light 2026",label:"%light2026ThemeLabel%",uiTheme:"vs",path:"./themes/2026-light.json"},{id:"Dark 2026",label:"%dark2026ThemeLabel%",uiTheme:"vs-dark",path:"./themes/2026-dark.json"},{id:"Dark+",label:"%darkPlusColorThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_plus.json"},{id:"Dark Modern",label:"%darkModernThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_modern.json"},{id:"Light+",label:"%lightPlusColorThemeLabel%",uiTheme:"vs",path:"./themes/light_plus.json"},{id:"Light Modern",label:"%lightModernThemeLabel%",uiTheme:"vs",path:"./themes/light_modern.json"},{id:"Visual Studio Dark",label:"%darkColorThemeLabel%",uiTheme:"vs-dark",path:"./themes/dark_vs.json"},{id:"Visual Studio Light",label:"%lightColorThemeLabel%",uiTheme:"vs",path:"./themes/light_vs.json"},{id:"Default High Contrast",label:"%hcColorThemeLabel%",uiTheme:"hc-black",path:"./themes/hc_black.json"},{id:"Default High Contrast Light",label:"%lightHcColorThemeLabel%",uiTheme:"hc-light",path:"./themes/hc_light.json"}],iconThemes:[{id:"vs-minimal",label:"%minimalIconThemeLabel%",path:"./fileicons/vs_minimal-icon-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Default Themes",description:"The default Visual Studio light and dark themes",light2026ThemeLabel:"Light 2026",dark2026ThemeLabel:"Dark 2026",darkPlusColorThemeLabel:"Dark+",darkModernThemeLabel:"Dark Modern",lightPlusColorThemeLabel:"Light+",lightModernThemeLabel:"Light Modern",darkColorThemeLabel:"Dark (Visual Studio)",lightColorThemeLabel:"Light (Visual Studio)",hcColorThemeLabel:"Dark High Contrast",lightHcColorThemeLabel:"Light High Contrast",minimalIconThemeLabel:"Minimal (Visual Studio Code)"}},{extensionPath:"theme-kimbie-dark",packageJSON:{name:"theme-kimbie-dark",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Kimbie Dark",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/kimbie-dark-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Kimbie Dark Theme",description:"Kimbie dark theme for Visual Studio Code",themeLabel:"Kimbie Dark"}},{extensionPath:"theme-monokai",packageJSON:{name:"theme-monokai",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Monokai",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/monokai-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Monokai Theme",description:"Monokai theme for Visual Studio Code",themeLabel:"Monokai"}},{extensionPath:"theme-monokai-dimmed",packageJSON:{name:"theme-monokai-dimmed",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Monokai Dimmed",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/dimmed-monokai-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Monokai Dimmed Theme",description:"Monokai dimmed theme for Visual Studio Code",themeLabel:"Monokai Dimmed"}},{extensionPath:"theme-quietlight",packageJSON:{name:"theme-quietlight",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Quiet Light",label:"%themeLabel%",uiTheme:"vs",path:"./themes/quietlight-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Quiet Light Theme",description:"Quiet light theme for Visual Studio Code",themeLabel:"Quiet Light"}},{extensionPath:"theme-red",packageJSON:{name:"theme-red",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Red",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/Red-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Red Theme",description:"Red theme for Visual Studio Code",themeLabel:"Red"}},{extensionPath:"theme-seti",packageJSON:{name:"vscode-theme-seti",private:!0,version:"10.0.0",displayName:"%displayName%",description:"%description%",publisher:"vscode",license:"MIT",icon:"icons/seti-circular-128x128.png",scripts:{update:"node ./build/update-icon-theme.js"},engines:{vscode:"*"},categories:["Themes"],contributes:{iconThemes:[{id:"vs-seti",label:"%themeLabel%",path:"./icons/vs-seti-icon-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Seti File Icon Theme",description:"A file icon theme made out of the Seti UI file icons",themeLabel:"Seti (Visual Studio Code)"},readmePath:"theme-seti/README.md"},{extensionPath:"theme-solarized-dark",packageJSON:{name:"theme-solarized-dark",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Solarized Dark",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/solarized-dark-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Solarized Dark Theme",description:"Solarized dark theme for Visual Studio Code",themeLabel:"Solarized Dark"}},{extensionPath:"theme-solarized-light",packageJSON:{name:"theme-solarized-light",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Solarized Light",label:"%themeLabel%",uiTheme:"vs",path:"./themes/solarized-light-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Solarized Light Theme",description:"Solarized light theme for Visual Studio Code",themeLabel:"Solarized Light"}},{extensionPath:"theme-tomorrow-night-blue",packageJSON:{name:"theme-tomorrow-night-blue",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Themes"],contributes:{themes:[{id:"Tomorrow Night Blue",label:"%themeLabel%",uiTheme:"vs-dark",path:"./themes/tomorrow-night-blue-color-theme.json"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Tomorrow Night Blue Theme",description:"Tomorrow night blue theme for Visual Studio Code",themeLabel:"Tomorrow Night Blue"}},{extensionPath:"typescript-basics",packageJSON:{name:"typescript",description:"%description%",displayName:"%displayName%",version:"10.0.0",author:"vscode",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammars.mjs"},categories:["Programming Languages"],contributes:{languages:[{id:"typescript",aliases:["TypeScript","ts","typescript"],extensions:[".ts",".cts",".mts"],firstLine:"^#!.*\\b(deno|bun|ts-node)\\b",configuration:"./language-configuration.json"},{id:"typescriptreact",aliases:["TypeScript JSX","TypeScript React","tsx"],extensions:[".tsx"],configuration:"./language-configuration.json"},{id:"jsonc",filenames:["tsconfig.json","jsconfig.json"],filenamePatterns:["tsconfig.*.json","jsconfig.*.json","tsconfig-*.json","jsconfig-*.json"]},{id:"json",extensions:[".tsbuildinfo"]}],grammars:[{language:"typescript",scopeName:"source.ts",path:"./syntaxes/TypeScript.tmLanguage.json",unbalancedBracketScopes:["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","meta.brace.angle","punctuation.definition.tag","keyword.operator.assignment.compound.bitwise.ts"],tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{language:"typescriptreact",scopeName:"source.tsx",path:"./syntaxes/TypeScriptReact.tmLanguage.json",unbalancedBracketScopes:["keyword.operator.relational","storage.type.function.arrow","keyword.operator.bitwise.shift","punctuation.definition.tag","keyword.operator.assignment.compound.bitwise.ts"],embeddedLanguages:{"meta.tag.tsx":"jsx-tags","meta.tag.without-attributes.tsx":"jsx-tags","meta.tag.attributes.tsx":"typescriptreact","meta.embedded.expression.tsx":"typescriptreact"},tokenTypes:{"punctuation.definition.template-expression":"other","entity.name.type.instance.jsdoc":"other","entity.name.function.tagged-template":"other","meta.import string.quoted":"other","variable.other.jsdoc":"other"}},{scopeName:"documentation.injection.ts",path:"./syntaxes/jsdoc.ts.injection.tmLanguage.json",injectTo:["source.ts","source.tsx"]},{scopeName:"documentation.injection.js.jsx",path:"./syntaxes/jsdoc.js.injection.tmLanguage.json",injectTo:["source.js","source.js.jsx"]}],semanticTokenScopes:[{language:"typescript",scopes:{property:["variable.other.property.ts"],"property.readonly":["variable.other.constant.property.ts"],variable:["variable.other.readwrite.ts"],"variable.readonly":["variable.other.constant.object.ts"],function:["entity.name.function.ts"],namespace:["entity.name.type.module.ts"],"variable.defaultLibrary":["support.variable.ts"],"function.defaultLibrary":["support.function.ts"]}},{language:"typescriptreact",scopes:{property:["variable.other.property.tsx"],"property.readonly":["variable.other.constant.property.tsx"],variable:["variable.other.readwrite.tsx"],"variable.readonly":["variable.other.constant.object.tsx"],function:["entity.name.function.tsx"],namespace:["entity.name.type.module.tsx"],"variable.defaultLibrary":["support.variable.tsx"],"function.defaultLibrary":["support.function.tsx"]}}],snippets:[{language:"typescript",path:"./snippets/typescript.code-snippets"},{language:"typescriptreact",path:"./snippets/typescript.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"TypeScript Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in TypeScript files."}},{extensionPath:"typescript-language-features",packageJSON:{name:"typescript-language-features",description:"%description%",displayName:"%displayName%",version:"10.0.0",author:"vscode",publisher:"vscode",license:"MIT",aiKey:"0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",enabledApiProposals:["workspaceTrust","multiDocumentHighlightProvider","codeActionAI","codeActionRanges","editorHoverVerbosityLevel"],capabilities:{virtualWorkspaces:{supported:"limited",description:"%virtualWorkspaces%"},untrustedWorkspaces:{supported:"limited",description:"%workspaceTrust%",restrictedConfigurations:["typescript.tsdk","js/ts.tsdk.path","typescript.tsserver.pluginPaths","js/ts.tsserver.pluginPaths","typescript.npm","js/ts.tsserver.npm.path","typescript.tsserver.nodePath","js/ts.tsserver.node.path","js/ts.tsserver.diagnosticDir","js/ts.tsserver.heapProfile","js/ts.preferences.autoImportSpecifierExcludeRegexes","typescript.preferences.autoImportSpecifierExcludeRegexes","javascript.preferences.autoImportSpecifierExcludeRegexes"]}},engines:{vscode:"^1.30.0"},icon:"media/icon.png",categories:["Programming Languages"],activationEvents:["onLanguage:javascript","onLanguage:javascriptreact","onLanguage:typescript","onLanguage:typescriptreact","onLanguage:jsx-tags","onCommand:typescript.tsserverRequest","onCommand:_typescript.configurePlugin","onCommand:_typescript.learnMoreAboutRefactorings","onCommand:typescript.fileReferences","onTaskType:typescript","onLanguage:jsonc","onWalkthrough:nodejsWelcome"],main:"./dist/extension",browser:"./dist/browser/extension",contributes:{jsonValidation:[{fileMatch:"package.json",url:"./schemas/package.schema.json"},{fileMatch:"tsconfig.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"tsconfig.*.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig-*.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"tsconfig-*.json",url:"https://www.schemastore.org/tsconfig"},{fileMatch:"tsconfig.*.json",url:"./schemas/tsconfig.schema.json"},{fileMatch:"typings.json",url:"https://www.schemastore.org/typings"},{fileMatch:".bowerrc",url:"https://www.schemastore.org/bowerrc"},{fileMatch:".babelrc",url:"https://www.schemastore.org/babelrc"},{fileMatch:".babelrc.json",url:"https://www.schemastore.org/babelrc"},{fileMatch:"babel.config.json",url:"https://www.schemastore.org/babelrc"},{fileMatch:"jsconfig.json",url:"https://www.schemastore.org/jsconfig"},{fileMatch:"jsconfig.json",url:"./schemas/jsconfig.schema.json"},{fileMatch:"jsconfig.*.json",url:"https://www.schemastore.org/jsconfig"},{fileMatch:"jsconfig.*.json",url:"./schemas/jsconfig.schema.json"},{fileMatch:".swcrc",url:"https://swc.rs/schema.json"},{fileMatch:"typedoc.json",url:"https://typedoc.org/schema.json"}],configuration:[{type:"object",properties:{"js/ts.tsdk.path":{type:"string",markdownDescription:"%typescript.tsdk.desc%",scope:"window",order:1,keywords:["TypeScript"]},"typescript.tsdk":{type:"string",markdownDescription:"%typescript.tsdk.desc%",markdownDeprecationMessage:"%typescript.tsdk.unifiedDeprecationMessage%",scope:"window",order:1},"js/ts.experimental.useTsgo":{type:"boolean",default:!1,markdownDescription:"%typescript.useTsgo%",scope:"window",order:2,keywords:["TypeScript","experimental"]},"typescript.experimental.useTsgo":{type:"boolean",default:!1,markdownDescription:"%typescript.useTsgo%",markdownDeprecationMessage:"%typescript.useTsgo.unifiedDeprecationMessage%",scope:"window",order:2,keywords:["experimental"]},"js/ts.locale":{type:"string",default:"auto",enum:["auto","de","es","en","fr","it","ja","ko","ru","zh-CN","zh-TW"],enumDescriptions:["%typescript.locale.auto%","Deutsch","espa\xF1ol","English","fran\xE7ais","italiano","\u65E5\u672C\u8A9E","\uD55C\uAD6D\uC5B4","\u0440\u0443\u0441\u0441\u043A\u0438\u0439","\u4E2D\u6587(\u7B80\u4F53)","\u4E2D\u6587(\u7E41\u9AD4)"],markdownDescription:"%typescript.locale%",scope:"window",order:3,keywords:["TypeScript"]},"typescript.locale":{type:"string",default:"auto",enum:["auto","de","es","en","fr","it","ja","ko","ru","zh-CN","zh-TW"],enumDescriptions:["%typescript.locale.auto%","Deutsch","espa\xF1ol","English","fran\xE7ais","italiano","\u65E5\u672C\u8A9E","\uD55C\uAD6D\uC5B4","\u0440\u0443\u0441\u0441\u043A\u0438\u0439","\u4E2D\u6587(\u7B80\u4F53)","\u4E2D\u6587(\u7E41\u9AD4)"],markdownDescription:"%typescript.locale%",markdownDeprecationMessage:"%typescript.locale.unifiedDeprecationMessage%",scope:"window",order:3},"js/ts.tsc.autoDetect":{type:"string",default:"on",enum:["on","off","build","watch"],markdownEnumDescriptions:["%typescript.tsc.autoDetect.on%","%typescript.tsc.autoDetect.off%","%typescript.tsc.autoDetect.build%","%typescript.tsc.autoDetect.watch%"],description:"%typescript.tsc.autoDetect%",scope:"window",order:4,keywords:["TypeScript"]},"typescript.tsc.autoDetect":{type:"string",default:"on",enum:["on","off","build","watch"],markdownEnumDescriptions:["%typescript.tsc.autoDetect.on%","%typescript.tsc.autoDetect.off%","%typescript.tsc.autoDetect.build%","%typescript.tsc.autoDetect.watch%"],description:"%typescript.tsc.autoDetect%",markdownDeprecationMessage:"%typescript.tsc.autoDetect.unifiedDeprecationMessage%",scope:"window",order:4}}},{type:"object",title:"%configuration.preferences%",properties:{"js/ts.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],markdownDeprecationMessage:"%configuration.preferences.quoteStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.quoteStyle":{type:"string",enum:["auto","single","double"],default:"auto",markdownDescription:"%typescript.preferences.quoteStyle%",markdownEnumDescriptions:["%typescript.preferences.quoteStyle.auto%","%typescript.preferences.quoteStyle.single%","%typescript.preferences.quoteStyle.double%"],markdownDeprecationMessage:"%configuration.preferences.quoteStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.importModuleSpecifier":{type:"string",enum:["shortest","relative","non-relative","project-relative"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifier.shortest%","%typescript.preferences.importModuleSpecifier.relative%","%typescript.preferences.importModuleSpecifier.nonRelative%","%typescript.preferences.importModuleSpecifier.projectRelative%"],default:"shortest",description:"%typescript.preferences.importModuleSpecifier%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.importModuleSpecifierEnding":{type:"string",enum:["auto","minimal","index","js"],enumItemLabels:[null,null,null,"%typescript.preferences.importModuleSpecifierEnding.label.js%"],markdownEnumDescriptions:["%typescript.preferences.importModuleSpecifierEnding.auto%","%typescript.preferences.importModuleSpecifierEnding.minimal%","%typescript.preferences.importModuleSpecifierEnding.index%","%typescript.preferences.importModuleSpecifierEnding.js%"],default:"auto",description:"%typescript.preferences.importModuleSpecifierEnding%",markdownDeprecationMessage:"%configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%configuration.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%javascript.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",markdownDeprecationMessage:"%configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.jsxAttributeCompletionStyle":{type:"string",enum:["auto","braces","none"],markdownEnumDescriptions:["%typescript.preferences.jsxAttributeCompletionStyle.auto%","%typescript.preferences.jsxAttributeCompletionStyle.braces%","%typescript.preferences.jsxAttributeCompletionStyle.none%"],default:"auto",description:"%typescript.preferences.jsxAttributeCompletionStyle%",markdownDeprecationMessage:"%configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.includePackageJsonAutoImports":{type:"string",enum:["auto","on","off"],enumDescriptions:["%typescript.preferences.includePackageJsonAutoImports.auto%","%typescript.preferences.includePackageJsonAutoImports.on%","%typescript.preferences.includePackageJsonAutoImports.off%"],default:"auto",markdownDescription:"%typescript.preferences.includePackageJsonAutoImports%",scope:"window",keywords:["TypeScript"]},"typescript.preferences.includePackageJsonAutoImports":{type:"string",enum:["auto","on","off"],enumDescriptions:["%typescript.preferences.includePackageJsonAutoImports.auto%","%typescript.preferences.includePackageJsonAutoImports.on%","%typescript.preferences.includePackageJsonAutoImports.off%"],default:"auto",markdownDescription:"%typescript.preferences.includePackageJsonAutoImports%",markdownDeprecationMessage:"%configuration.preferences.includePackageJsonAutoImports.unifiedDeprecationMessage%",scope:"window"},"js/ts.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",scope:"resource",keywords:["JavaScript","TypeScript"]},"javascript.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",markdownDeprecationMessage:"%configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage%",scope:"resource"},"typescript.preferences.autoImportFileExcludePatterns":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportFileExcludePatterns%",markdownDeprecationMessage:"%configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",scope:"resource",keywords:["JavaScript","TypeScript"]},"javascript.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",markdownDeprecationMessage:"%configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage%",scope:"resource"},"typescript.preferences.autoImportSpecifierExcludeRegexes":{type:"array",items:{type:"string"},markdownDescription:"%typescript.preferences.autoImportSpecifierExcludeRegexes%",markdownDeprecationMessage:"%configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.preferTypeOnlyAutoImports":{type:"boolean",default:!1,markdownDescription:"%typescript.preferences.preferTypeOnlyAutoImports%",scope:"resource",keywords:["TypeScript"]},"typescript.preferences.preferTypeOnlyAutoImports":{type:"boolean",default:!1,markdownDescription:"%typescript.preferences.preferTypeOnlyAutoImports%",markdownDeprecationMessage:"%configuration.preferences.preferTypeOnlyAutoImports.unifiedDeprecationMessage%",scope:"resource"},"js/ts.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",markdownDeprecationMessage:"%configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.useAliasesForRenames":{type:"boolean",default:!0,description:"%typescript.preferences.useAliasesForRenames%",markdownDeprecationMessage:"%configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",markdownDeprecationMessage:"%configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.preferences.renameMatchingJsxTags":{type:"boolean",default:!0,description:"%typescript.preferences.renameMatchingJsxTags%",markdownDeprecationMessage:"%configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive%","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}},keywords:["JavaScript","TypeScript"]},"javascript.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",markdownDeprecationMessage:"%configuration.preferences.organizeImports.unifiedDeprecationMessage%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive%","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}}},"typescript.preferences.organizeImports":{type:"object",markdownDescription:"%typescript.preferences.organizeImports%",markdownDeprecationMessage:"%configuration.preferences.organizeImports.unifiedDeprecationMessage%",properties:{caseSensitivity:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseSensitivity%",enum:["auto","caseInsensitive","caseSensitive"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseSensitivity.auto%","%typescript.preferences.organizeImports.caseSensitivity.insensitive","%typescript.preferences.organizeImports.caseSensitivity.sensitive%"],default:"auto"},typeOrder:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.typeOrder%",enum:["auto","last","inline","first"],default:"auto",markdownEnumDescriptions:["%typescript.preferences.organizeImports.typeOrder.auto%","%typescript.preferences.organizeImports.typeOrder.last%","%typescript.preferences.organizeImports.typeOrder.inline%","%typescript.preferences.organizeImports.typeOrder.first%"]},unicodeCollation:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.unicodeCollation%",enum:["ordinal","unicode"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.unicodeCollation.ordinal%","%typescript.preferences.organizeImports.unicodeCollation.unicode%"],default:"ordinal"},locale:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.locale%"},numericCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.numericCollation%"},accentCollation:{type:"boolean",markdownDescription:"%typescript.preferences.organizeImports.accentCollation%"},caseFirst:{type:"string",markdownDescription:"%typescript.preferences.organizeImports.caseFirst%",enum:["default","upper","lower"],markdownEnumDescriptions:["%typescript.preferences.organizeImports.caseFirst.default%","%typescript.preferences.organizeImports.caseFirst.upper%","%typescript.preferences.organizeImports.caseFirst.lower%"],default:"default"}}}}},{type:"object",title:"%configuration.format%",properties:{"js/ts.format.enabled":{type:"boolean",default:!0,description:"%format.enable%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.enable":{type:"boolean",default:!0,description:"%javascript.format.enable%",markdownDeprecationMessage:"%configuration.format.enable.unifiedDeprecationMessage%",scope:"window"},"typescript.format.enable":{type:"boolean",default:!0,description:"%typescript.format.enable%",markdownDeprecationMessage:"%configuration.format.enable.unifiedDeprecationMessage%",scope:"window"},"js/ts.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterCommaDelimiter":{type:"boolean",default:!0,description:"%format.insertSpaceAfterCommaDelimiter%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterConstructor":{type:"boolean",default:!1,description:"%format.insertSpaceAfterConstructor%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterSemicolonInForStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterSemicolonInForStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceBeforeAndAfterBinaryOperators":{type:"boolean",default:!0,description:"%format.insertSpaceBeforeAndAfterBinaryOperators%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterKeywordsInControlFlowStatements":{type:"boolean",default:!0,description:"%format.insertSpaceAfterKeywordsInControlFlowStatements%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":{type:"boolean",default:!0,description:"%format.insertSpaceAfterFunctionKeywordForAnonymousFunctions%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceBeforeFunctionParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceBeforeFunctionParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":{type:"boolean",default:!0,description:"%format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":{type:"boolean",default:!1,description:"%format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.insertSpaceAfterTypeAssertion":{type:"boolean",default:!1,description:"%format.insertSpaceAfterTypeAssertion%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.format.insertSpaceAfterTypeAssertion":{type:"boolean",default:!1,description:"%format.insertSpaceAfterTypeAssertion%",markdownDeprecationMessage:"%configuration.format.insertSpaceAfterTypeAssertion.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.placeOpenBraceOnNewLineForFunctions":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForFunctions%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.placeOpenBraceOnNewLineForControlBlocks":{type:"boolean",default:!1,description:"%format.placeOpenBraceOnNewLineForControlBlocks%",markdownDeprecationMessage:"%configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage%",scope:"resource"},"js/ts.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",scope:"language-overridable",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"],keywords:["JavaScript","TypeScript"]},"javascript.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",markdownDeprecationMessage:"%configuration.format.semicolons.unifiedDeprecationMessage%",scope:"resource",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"]},"typescript.format.semicolons":{type:"string",default:"ignore",description:"%format.semicolons%",markdownDeprecationMessage:"%configuration.format.semicolons.unifiedDeprecationMessage%",scope:"resource",enum:["ignore","insert","remove"],enumDescriptions:["%format.semicolons.ignore%","%format.semicolons.insert%","%format.semicolons.remove%"]},"js/ts.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",markdownDeprecationMessage:"%configuration.format.indentSwitchCase.unifiedDeprecationMessage%",scope:"resource"},"typescript.format.indentSwitchCase":{type:"boolean",default:!0,description:"%format.indentSwitchCase%",markdownDeprecationMessage:"%configuration.format.indentSwitchCase.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.validation%",properties:{"js/ts.validate.enabled":{type:"boolean",default:!0,description:"%configuration.validate.enable%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"typescript.validate.enable":{type:"boolean",default:!0,description:"%typescript.validate.enable%",markdownDeprecationMessage:"%configuration.validate.enable.unifiedDeprecationMessage%",scope:"window"},"javascript.validate.enable":{type:"boolean",default:!0,description:"%javascript.validate.enable%",markdownDeprecationMessage:"%configuration.validate.enable.unifiedDeprecationMessage%",scope:"window"},"js/ts.reportStyleChecksAsWarnings":{type:"boolean",default:!0,description:"%typescript.reportStyleChecksAsWarnings%",scope:"window",keywords:["TypeScript"]},"typescript.reportStyleChecksAsWarnings":{type:"boolean",default:!0,description:"%typescript.reportStyleChecksAsWarnings%",markdownDeprecationMessage:"%configuration.reportStyleChecksAsWarnings.unifiedDeprecationMessage%",scope:"window"},"js/ts.suggestionActions.enabled":{type:"boolean",default:!0,description:"%configuration.suggestionActions.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggestionActions.enabled":{type:"boolean",default:!0,description:"%javascript.suggestionActions.enabled%",markdownDeprecationMessage:"%configuration.suggestionActions.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggestionActions.enabled":{type:"boolean",default:!0,description:"%typescript.suggestionActions.enabled%",markdownDeprecationMessage:"%configuration.suggestionActions.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.tsserver.experimental.enableProjectDiagnostics":{type:"boolean",default:!1,description:"%configuration.tsserver.experimental.enableProjectDiagnostics%",scope:"window",keywords:["JavaScript","TypeScript","experimental"]},"typescript.tsserver.experimental.enableProjectDiagnostics":{type:"boolean",default:!1,description:"%configuration.tsserver.experimental.enableProjectDiagnostics%",markdownDeprecationMessage:"%configuration.tsserver.experimental.enableProjectDiagnostics.unifiedDeprecationMessage%",scope:"window",keywords:["experimental"]}}},{type:"object",title:"%configuration.implicitProjectConfig%",properties:{"js/ts.implicitProjectConfig.module":{type:"string",markdownDescription:"%configuration.implicitProjectConfig.module%",default:"ESNext",enum:["CommonJS","AMD","System","UMD","ES6","ES2015","ES2020","ESNext","None","ES2022","Node12","NodeNext"],scope:"window"},"js/ts.implicitProjectConfig.target":{type:"string",default:"ES2024",markdownDescription:"%configuration.implicitProjectConfig.target%",enum:["ES3","ES5","ES6","ES2015","ES2016","ES2017","ES2018","ES2019","ES2020","ES2021","ES2022","ES2023","ES2024","ESNext"],scope:"window"},"js/ts.implicitProjectConfig.checkJs":{type:"boolean",default:!1,markdownDescription:"%configuration.implicitProjectConfig.checkJs%",scope:"window"},"js/ts.implicitProjectConfig.experimentalDecorators":{type:"boolean",default:!1,markdownDescription:"%configuration.implicitProjectConfig.experimentalDecorators%",scope:"window"},"js/ts.implicitProjectConfig.strictNullChecks":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strictNullChecks%",scope:"window"},"js/ts.implicitProjectConfig.strictFunctionTypes":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strictFunctionTypes%",scope:"window"},"js/ts.implicitProjectConfig.strict":{type:"boolean",default:!0,markdownDescription:"%configuration.implicitProjectConfig.strict%",scope:"window"}}},{type:"object",title:"%configuration.languageFeatures%",properties:{"js/ts.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",scope:"resource",keywords:["JavaScript","TypeScript"]},"typescript.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",markdownDeprecationMessage:"%configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage%",scope:"resource"},"javascript.updateImportsOnFileMove.enabled":{type:"string",enum:["prompt","always","never"],markdownEnumDescriptions:["%typescript.updateImportsOnFileMove.enabled.prompt%","%typescript.updateImportsOnFileMove.enabled.always%","%typescript.updateImportsOnFileMove.enabled.never%"],default:"prompt",description:"%typescript.updateImportsOnFileMove.enabled%",markdownDeprecationMessage:"%configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.autoClosingTags.enabled":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"typescript.autoClosingTags":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",markdownDeprecationMessage:"%configuration.autoClosingTags.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"javascript.autoClosingTags":{type:"boolean",default:!0,description:"%typescript.autoClosingTags%",markdownDeprecationMessage:"%configuration.autoClosingTags.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.workspaceSymbols.scope":{type:"string",enum:["allOpenProjects","currentProject"],enumDescriptions:["%typescript.workspaceSymbols.scope.allOpenProjects%","%typescript.workspaceSymbols.scope.currentProject%"],default:"allOpenProjects",markdownDescription:"%typescript.workspaceSymbols.scope%",scope:"window",keywords:["TypeScript"]},"typescript.workspaceSymbols.scope":{type:"string",enum:["allOpenProjects","currentProject"],enumDescriptions:["%typescript.workspaceSymbols.scope.allOpenProjects%","%typescript.workspaceSymbols.scope.currentProject%"],default:"allOpenProjects",markdownDescription:"%typescript.workspaceSymbols.scope%",markdownDeprecationMessage:"%configuration.workspaceSymbols.scope.unifiedDeprecationMessage%",scope:"window"},"js/ts.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",scope:"window",keywords:["JavaScript","TypeScript"]},"typescript.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",markdownDeprecationMessage:"%configuration.preferGoToSourceDefinition.unifiedDeprecationMessage%",scope:"window"},"javascript.preferGoToSourceDefinition":{type:"boolean",default:!1,description:"%configuration.preferGoToSourceDefinition%",markdownDeprecationMessage:"%configuration.preferGoToSourceDefinition.unifiedDeprecationMessage%",scope:"window"},"js/ts.workspaceSymbols.excludeLibrarySymbols":{type:"boolean",default:!0,markdownDescription:"%typescript.workspaceSymbols.excludeLibrarySymbols%",scope:"window",keywords:["TypeScript"]},"typescript.workspaceSymbols.excludeLibrarySymbols":{type:"boolean",default:!0,markdownDescription:"%typescript.workspaceSymbols.excludeLibrarySymbols%",markdownDeprecationMessage:"%configuration.workspaceSymbols.excludeLibrarySymbols.unifiedDeprecationMessage%",scope:"window"},"js/ts.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",keywords:["JavaScript","TypeScript"]},"javascript.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",markdownDeprecationMessage:"%configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage%"},"typescript.updateImportsOnPaste.enabled":{scope:"window",type:"boolean",default:!0,markdownDescription:"%configuration.updateImportsOnPaste%",markdownDeprecationMessage:"%configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage%"},"js/ts.hover.maximumLength":{type:"number",default:500,description:"%configuration.hover.maximumLength%",scope:"resource"}}},{type:"object",title:"%configuration.suggest%",properties:{"js/ts.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",markdownDeprecationMessage:"%configuration.suggest.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.enabled":{type:"boolean",default:!0,description:"%typescript.suggest.enabled%",markdownDeprecationMessage:"%configuration.suggest.enabled.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",markdownDeprecationMessage:"%configuration.suggest.autoImports.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.autoImports":{type:"boolean",default:!0,description:"%configuration.suggest.autoImports%",markdownDeprecationMessage:"%configuration.suggest.autoImports.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.names":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.names%",scope:"language-overridable",keywords:["JavaScript"]},"javascript.suggest.names":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.names%",markdownDeprecationMessage:"%configuration.suggest.names.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",markdownDeprecationMessage:"%configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.completeFunctionCalls":{type:"boolean",default:!1,description:"%configuration.suggest.completeFunctionCalls%",markdownDeprecationMessage:"%configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",markdownDeprecationMessage:"%configuration.suggest.paths.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.paths":{type:"boolean",default:!0,description:"%configuration.suggest.paths%",markdownDeprecationMessage:"%configuration.suggest.paths.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.jsdoc.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.completeJSDocs":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",markdownDeprecationMessage:"%configuration.suggest.completeJSDocs.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.completeJSDocs":{type:"boolean",default:!0,description:"%configuration.suggest.jsdoc.enabled%",markdownDeprecationMessage:"%configuration.suggest.completeJSDocs.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",markdownDeprecationMessage:"%configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage%",scope:"language-overridable"},"typescript.suggest.jsdoc.generateReturns":{type:"boolean",default:!0,markdownDescription:"%configuration.suggest.jsdoc.generateReturns%",markdownDeprecationMessage:"%configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage%",scope:"language-overridable"},"js/ts.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",markdownDeprecationMessage:"%configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.includeAutomaticOptionalChainCompletions":{type:"boolean",default:!0,description:"%configuration.suggest.includeAutomaticOptionalChainCompletions%",markdownDeprecationMessage:"%configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",markdownDeprecationMessage:"%configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.includeCompletionsForImportStatements":{type:"boolean",default:!0,description:"%configuration.suggest.includeCompletionsForImportStatements%",markdownDeprecationMessage:"%configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.suggest.classMemberSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.classMemberSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.suggest.objectLiteralMethodSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.objectLiteralMethodSnippets.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.suggest.objectLiteralMethodSnippets.enabled":{type:"boolean",default:!0,description:"%configuration.suggest.objectLiteralMethodSnippets.enabled%",markdownDeprecationMessage:"%configuration.suggest.objectLiteralMethodSnippets.enabled.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.codeLens%",properties:{"js/ts.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",markdownDeprecationMessage:"%configuration.referencesCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"typescript.referencesCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.referencesCodeLens.enabled%",markdownDeprecationMessage:"%configuration.referencesCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",markdownDeprecationMessage:"%configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage%",scope:"window"},"typescript.referencesCodeLens.showOnAllFunctions":{type:"boolean",default:!1,markdownDescription:"%configuration.referencesCodeLens.showOnAllFunctions%",markdownDeprecationMessage:"%configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.implementationsCodeLens.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.enabled":{type:"boolean",default:!1,description:"%configuration.implementationsCodeLens.enabled%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.showOnInterfaceMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnInterfaceMethods%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.showOnInterfaceMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnInterfaceMethods%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.showOnInterfaceMethods.unifiedDeprecationMessage%",scope:"window"},"js/ts.implementationsCodeLens.showOnAllClassMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnAllClassMethods%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.implementationsCodeLens.showOnAllClassMethods":{type:"boolean",default:!1,markdownDescription:"%configuration.implementationsCodeLens.showOnAllClassMethods%",markdownDeprecationMessage:"%configuration.implementationsCodeLens.showOnAllClassMethods.unifiedDeprecationMessage%",scope:"window"}}},{type:"object",title:"%configuration.inlayHints%",properties:{"js/ts.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterNames.enabled":{type:"string",enum:["none","literals","all"],enumDescriptions:["%inlayHints.parameterNames.none%","%inlayHints.parameterNames.literals%","%inlayHints.parameterNames.all%"],default:"none",markdownDescription:"%configuration.inlayHints.parameterNames.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterNames.suppressWhenArgumentMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.parameterTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.parameterTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.variableTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.variableTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.variableTypes.suppressWhenTypeMatchesName":{type:"boolean",default:!0,markdownDescription:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName%",markdownDeprecationMessage:"%configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.propertyDeclarationTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.propertyDeclarationTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",scope:"language-overridable",keywords:["JavaScript","TypeScript"]},"javascript.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"typescript.inlayHints.functionLikeReturnTypes.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.functionLikeReturnTypes.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage%",scope:"resource"},"js/ts.inlayHints.enumMemberValues.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.enumMemberValues.enabled%",scope:"language-overridable",keywords:["TypeScript"]},"typescript.inlayHints.enumMemberValues.enabled":{type:"boolean",default:!1,markdownDescription:"%configuration.inlayHints.enumMemberValues.enabled%",markdownDeprecationMessage:"%configuration.inlayHints.enumMemberValues.enabled.unifiedDeprecationMessage%",scope:"resource"}}},{type:"object",title:"%configuration.serverAdvanced%",properties:{"js/ts.tsdk.promptToUseWorkspaceVersion":{type:"boolean",default:!1,description:"%typescript.enablePromptUseWorkspaceTsdk%",scope:"window",keywords:["TypeScript"]},"typescript.enablePromptUseWorkspaceTsdk":{type:"boolean",default:!1,description:"%typescript.enablePromptUseWorkspaceTsdk%",markdownDeprecationMessage:"%typescript.enablePromptUseWorkspaceTsdk.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.automaticTypeAcquisition.enabled":{type:"boolean",default:!0,markdownDescription:"%configuration.automaticTypeAcquisition.enabled%",scope:"window",keywords:["TypeScript","usesOnlineServices"]},"typescript.disableAutomaticTypeAcquisition":{type:"boolean",default:!1,markdownDescription:"%typescript.disableAutomaticTypeAcquisition%",markdownDeprecationMessage:"%typescript.disableAutomaticTypeAcquisition.unifiedDeprecationMessage%",scope:"window",keywords:["usesOnlineServices"]},"js/ts.tsserver.node.path":{type:"string",markdownDescription:"%configuration.tsserver.nodePath%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.nodePath":{type:"string",markdownDescription:"%configuration.tsserver.nodePath%",markdownDeprecationMessage:"%configuration.tsserver.nodePath.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.npm.path":{type:"string",markdownDescription:"%typescript.npm%",scope:"machine",keywords:["TypeScript"]},"typescript.npm":{type:"string",markdownDescription:"%typescript.npm%",markdownDeprecationMessage:"%typescript.npm.unifiedDeprecationMessage%",scope:"machine"},"js/ts.tsserver.checkNpmIsInstalled":{type:"boolean",default:!0,markdownDescription:"%typescript.check.npmIsInstalled%",scope:"window",keywords:["TypeScript"]},"typescript.check.npmIsInstalled":{type:"boolean",default:!0,markdownDescription:"%typescript.check.npmIsInstalled%",markdownDeprecationMessage:"%typescript.check.npmIsInstalled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.projectWideIntellisense.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.projectWideIntellisense.enabled%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.projectWideIntellisense.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.projectWideIntellisense.enabled%",markdownDeprecationMessage:"%configuration.tsserver.web.projectWideIntellisense.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.projectWideIntellisense.suppressSemanticErrors":{type:"boolean",default:!1,description:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.projectWideIntellisense.suppressSemanticErrors":{type:"boolean",default:!1,description:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors%",markdownDeprecationMessage:"%configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.web.typeAcquisition.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.typeAcquisition.enabled%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.web.typeAcquisition.enabled":{type:"boolean",default:!0,description:"%configuration.tsserver.web.typeAcquisition.enabled%",markdownDeprecationMessage:"%configuration.tsserver.web.typeAcquisition.enabled.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.useSyntaxServer":{type:"string",scope:"window",description:"%configuration.tsserver.useSyntaxServer%",default:"auto",enum:["always","never","auto"],enumDescriptions:["%configuration.tsserver.useSyntaxServer.always%","%configuration.tsserver.useSyntaxServer.never%","%configuration.tsserver.useSyntaxServer.auto%"],keywords:["TypeScript"]},"typescript.tsserver.useSyntaxServer":{type:"string",scope:"window",description:"%configuration.tsserver.useSyntaxServer%",default:"auto",enum:["always","never","auto"],enumDescriptions:["%configuration.tsserver.useSyntaxServer.always%","%configuration.tsserver.useSyntaxServer.never%","%configuration.tsserver.useSyntaxServer.auto%"],markdownDeprecationMessage:"%configuration.tsserver.useSyntaxServer.unifiedDeprecationMessage%"},"js/ts.tsserver.maxMemory":{type:"number",default:3072,markdownDescription:"%configuration.tsserver.maxMemory%",scope:"window",keywords:["TypeScript"]},"js/ts.tsserver.diagnosticDir":{type:"string",markdownDescription:"%configuration.tsserver.diagnosticDir%",scope:"machine",keywords:["TypeScript","diagnostic","memory"]},"typescript.tsserver.maxTsServerMemory":{type:"number",default:3072,markdownDescription:"%configuration.tsserver.maxTsServerMemory%",markdownDeprecationMessage:"%configuration.tsserver.maxTsServerMemory.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.heapSnapshot":{type:"number",default:0,minimum:0,markdownDescription:"%configuration.tsserver.heapSnapshot%",scope:"window",keywords:["TypeScript","memory","diagnostics"]},"js/ts.tsserver.heapProfile":{type:"object",default:{enabled:!1},markdownDescription:"%configuration.tsserver.heapProfile%",scope:"machine",properties:{enabled:{type:"boolean",default:!1,description:"%configuration.tsserver.heapProfile.enabled%"},dir:{type:"string",description:"%configuration.tsserver.heapProfile.dir%"},interval:{type:"number",minimum:1,description:"%configuration.tsserver.heapProfile.interval%"}},keywords:["TypeScript","memory","heap","profile"]},"js/ts.tsserver.watchOptions":{description:"%configuration.tsserver.watchOptions%",scope:"window",default:"vscode",oneOf:[{type:"string",const:"vscode",description:"%configuration.tsserver.watchOptions.vscode%"},{type:"object",properties:{watchFile:{type:"string",description:"%configuration.tsserver.watchOptions.watchFile%",enum:["fixedChunkSizePolling","fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling","useFsEvents","useFsEventsOnParentDirectory"],enumDescriptions:["%configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchFile.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchFile.priorityPollingInterval%","%configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchFile.useFsEvents%","%configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory%"],default:"useFsEvents"},watchDirectory:{type:"string",description:"%configuration.tsserver.watchOptions.watchDirectory%",enum:["fixedChunkSizePolling","fixedPollingInterval","dynamicPriorityPolling","useFsEvents"],enumDescriptions:["%configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchDirectory.useFsEvents%"],default:"useFsEvents"},fallbackPolling:{type:"string",description:"%configuration.tsserver.watchOptions.fallbackPolling%",enum:["fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling"],enumDescriptions:["configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling"]},synchronousWatchDirectory:{type:"boolean",description:"%configuration.tsserver.watchOptions.synchronousWatchDirectory%"}}}],keywords:["TypeScript"]},"typescript.tsserver.watchOptions":{description:"%configuration.tsserver.watchOptions%",scope:"window",default:"vscode",markdownDeprecationMessage:"%configuration.tsserver.watchOptions.unifiedDeprecationMessage%",oneOf:[{type:"string",const:"vscode",description:"%configuration.tsserver.watchOptions.vscode%"},{type:"object",properties:{watchFile:{type:"string",description:"%configuration.tsserver.watchOptions.watchFile%",enum:["fixedChunkSizePolling","fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling","useFsEvents","useFsEventsOnParentDirectory"],enumDescriptions:["%configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchFile.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchFile.priorityPollingInterval%","%configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchFile.useFsEvents%","%configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory%"],default:"useFsEvents"},watchDirectory:{type:"string",description:"%configuration.tsserver.watchOptions.watchDirectory%",enum:["fixedChunkSizePolling","fixedPollingInterval","dynamicPriorityPolling","useFsEvents"],enumDescriptions:["%configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling%","%configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval%","%configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling%","%configuration.tsserver.watchOptions.watchDirectory.useFsEvents%"],default:"useFsEvents"},fallbackPolling:{type:"string",description:"%configuration.tsserver.watchOptions.fallbackPolling%",enum:["fixedPollingInterval","priorityPollingInterval","dynamicPriorityPolling"],enumDescriptions:["configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling"]},synchronousWatchDirectory:{type:"boolean",description:"%configuration.tsserver.watchOptions.synchronousWatchDirectory%"}}}]},"js/ts.tsserver.tracing.enabled":{type:"boolean",default:!1,description:"%typescript.tsserver.enableTracing%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.enableTracing":{type:"boolean",default:!1,description:"%typescript.tsserver.enableTracing%",markdownDeprecationMessage:"%typescript.tsserver.enableTracing.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.log":{type:"string",enum:["off","terse","normal","verbose","requestTime"],default:"off",description:"%typescript.tsserver.log%",scope:"window",keywords:["TypeScript"]},"typescript.tsserver.log":{type:"string",enum:["off","terse","normal","verbose","requestTime"],default:"off",description:"%typescript.tsserver.log%",markdownDeprecationMessage:"%typescript.tsserver.log.unifiedDeprecationMessage%",scope:"window"},"js/ts.tsserver.pluginPaths":{type:"array",items:{type:"string",description:"%typescript.tsserver.pluginPaths.item%"},default:[],description:"%typescript.tsserver.pluginPaths%",scope:"machine",keywords:["TypeScript"]},"typescript.tsserver.pluginPaths":{type:"array",items:{type:"string",description:"%typescript.tsserver.pluginPaths.item%"},default:[],description:"%typescript.tsserver.pluginPaths%",markdownDeprecationMessage:"%typescript.tsserver.pluginPaths.unifiedDeprecationMessage%",scope:"machine"}}}],commands:[{command:"typescript.reloadProjects",title:"%reloadProjects.title%",category:"TypeScript"},{command:"javascript.reloadProjects",title:"%reloadProjects.title%",category:"JavaScript"},{command:"typescript.selectTypeScriptVersion",title:"%typescript.selectTypeScriptVersion.title%",category:"TypeScript"},{command:"typescript.goToProjectConfig",title:"%typescript.goToProjectConfig.title%",category:"TypeScript"},{command:"javascript.goToProjectConfig",title:"%javascript.goToProjectConfig.title%",category:"JavaScript"},{command:"typescript.openTsServerLog",title:"%typescript.openTsServerLog.title%",category:"TypeScript"},{command:"typescript.restartTsServer",title:"%typescript.restartTsServer%",category:"TypeScript"},{command:"typescript.findAllFileReferences",title:"%typescript.findAllFileReferences%",category:"TypeScript"},{command:"typescript.goToSourceDefinition",title:"%typescript.goToSourceDefinition%",category:"TypeScript"},{command:"typescript.sortImports",title:"%typescript.sortImports%",category:"TypeScript"},{command:"javascript.sortImports",title:"%typescript.sortImports%",category:"JavaScript"},{command:"typescript.removeUnusedImports",title:"%typescript.removeUnusedImports%",category:"TypeScript"},{command:"javascript.removeUnusedImports",title:"%typescript.removeUnusedImports%",category:"JavaScript"},{command:"typescript.experimental.enableTsgo",title:"Use TypeScript Go (Experimental)",category:"TypeScript",enablement:"!config.js/ts.experimental.useTsgo && !config.typescript.experimental.useTsgo && config.typescript-go.executablePath"},{command:"typescript.experimental.disableTsgo",title:"Stop using TypeScript Go (Experimental)",category:"TypeScript",enablement:"config.js/ts.experimental.useTsgo || config.typescript.experimental.useTsgo"}],menus:{commandPalette:[{command:"typescript.reloadProjects",when:"editorLangId == typescript && typescript.isManagedFile"},{command:"typescript.reloadProjects",when:"editorLangId == typescriptreact && typescript.isManagedFile"},{command:"javascript.reloadProjects",when:"editorLangId == javascript && typescript.isManagedFile"},{command:"javascript.reloadProjects",when:"editorLangId == javascriptreact && typescript.isManagedFile"},{command:"typescript.goToProjectConfig",when:"editorLangId == typescript && typescript.isManagedFile"},{command:"typescript.goToProjectConfig",when:"editorLangId == typescriptreact && typescript.isManagedFile"},{command:"javascript.goToProjectConfig",when:"editorLangId == javascript && typescript.isManagedFile"},{command:"javascript.goToProjectConfig",when:"editorLangId == javascriptreact && typescript.isManagedFile"},{command:"typescript.selectTypeScriptVersion",when:"typescript.isManagedFile"},{command:"typescript.openTsServerLog",when:"typescript.isManagedFile"},{command:"typescript.restartTsServer",when:"typescript.isManagedFile"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && typescript.isManagedFile"},{command:"typescript.goToSourceDefinition",when:"tsSupportsSourceDefinition && typescript.isManagedFile"},{command:"typescript.sortImports",when:"supportedCodeAction =~ /(\\s|^)source\\.sortImports\\b/ && editorLangId =~ /^typescript(react)?$/"},{command:"javascript.sortImports",when:"supportedCodeAction =~ /(\\s|^)source\\.sortImports\\b/ && editorLangId =~ /^javascript(react)?$/"},{command:"typescript.removeUnusedImports",when:"supportedCodeAction =~ /(\\s|^)source\\.removeUnusedImports\\b/ && editorLangId =~ /^typescript(react)?$/"},{command:"javascript.removeUnusedImports",when:"supportedCodeAction =~ /(\\s|^)source\\.removeUnusedImports\\b/ && editorLangId =~ /^javascript(react)?$/"}],"editor/context":[{command:"typescript.goToSourceDefinition",when:"!config.js/ts.experimental.useTsgo && !config.typescript.experimental.useTsgo && tsSupportsSourceDefinition && (resourceLangId == typescript || resourceLangId == typescriptreact || resourceLangId == javascript || resourceLangId == javascriptreact)",group:"navigation@1.41"}],"explorer/context":[{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescript",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescriptreact",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascript",group:"4_search"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascriptreact",group:"4_search"}],"editor/title/context":[{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascript"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == javascriptreact"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescript"},{command:"typescript.findAllFileReferences",when:"tsSupportsFileReferences && resourceLangId == typescriptreact"}]},breakpoints:[{language:"typescript"},{language:"typescriptreact"}],taskDefinitions:[{type:"typescript",required:["tsconfig"],properties:{tsconfig:{type:"string",description:"%taskDefinition.tsconfig.description%"},option:{type:"string"}},when:"shellExecutionSupported"}],problemPatterns:[{name:"tsc",regexp:"^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*(.*)$",file:1,line:2,column:3,severity:4,code:5,message:6}],problemMatchers:[{name:"tsc",label:"%typescript.problemMatchers.tsc.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc"},{name:"tsgo-watch",label:"%typescript.problemMatchers.tsgo-watch.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc",background:{activeOnStart:!0,beginsPattern:{regexp:"^build starting at .*$"},endsPattern:{regexp:"^build finished in .*$"}}},{name:"tsc-watch",label:"%typescript.problemMatchers.tscWatch.label%",owner:"typescript",source:"ts",applyTo:"closedDocuments",fileLocation:["relative","${cwd}"],pattern:"$tsc",background:{activeOnStart:!0,beginsPattern:{regexp:"^\\s*(?:message TS6032:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(\u251C\\D*\\d{1,2}\\D+\u2524)?(?:\\]| -)) (Starting compilation in watch mode|File change detected\\. Starting incremental compilation)\\.\\.\\."},endsPattern:{regexp:"^\\s*(?:message TS6042:|\\[?\\D*.{1,2}[:.].{1,2}[:.].{1,2}\\D*(\u251C\\D*\\d{1,2}\\D+\u2524)?(?:\\]| -)) (?:Compilation complete\\.|Found \\d+ errors?\\.) Watching for file changes\\."}}}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"JavaScript and TypeScript Language Features",description:"Provides rich language support for JavaScript and TypeScript.",workspaceTrust:"The extension requires workspace trust when the workspace version is used because it executes code specified by the workspace.",virtualWorkspaces:"In virtual workspaces, resolving and finding references across files is not supported.","reloadProjects.title":"Reload Project","configuration.codeLens":"CodeLens","configuration.format":"Formatting","configuration.languageFeatures":"Language Features","configuration.implicitProjectConfig":"Implicit Project Config","configuration.inlayHints":"Inlay Hints","configuration.preferences":"Preferences","configuration.serverAdvanced":"TS Server Advanced Settings","configuration.suggest":"Suggestions","configuration.validation":"Validation","configuration.suggest.completeFunctionCalls":"Complete functions with their parameter signature.","configuration.suggest.completeFunctionCalls.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.completeFunctionCalls#` instead.","configuration.suggest.includeAutomaticOptionalChainCompletions":"Enable/disable showing completions on potentially undefined values that insert an optional chain call. Requires strict null checks to be enabled.","configuration.suggest.includeAutomaticOptionalChainCompletions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.includeAutomaticOptionalChainCompletions#` instead.","configuration.suggest.includeCompletionsForImportStatements":"Enable/disable auto-import-style completions on partially-typed import statements.","configuration.suggest.includeCompletionsForImportStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.includeCompletionsForImportStatements#` instead.","typescript.useTsgo":"Disables TypeScript and JavaScript language features to allow usage of the TypeScript Go experimental extension. Requires TypeScript Go to be installed and configured. Requires reloading extensions after changing this setting.","typescript.useTsgo.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.experimental.useTsgo#` instead.","typescript.tsdk.desc":"Specifies the folder path to the tsserver and `lib*.d.ts` files under a TypeScript install to use for IntelliSense, for example: `./node_modules/typescript/lib`.\n\n- When specified as a user setting, the TypeScript version from `js/ts.tsdk.path` automatically replaces the built-in TypeScript version.\n- When specified as a workspace setting, `js/ts.tsdk.path` allows you to switch to use that workspace version of TypeScript for IntelliSense with the `TypeScript: Select TypeScript version` command.\n\nSee the [TypeScript documentation](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-newer-typescript-versions) for more detail about managing TypeScript versions.","typescript.tsdk.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsdk.path#` instead.","typescript.disableAutomaticTypeAcquisition":"Disables [automatic type acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition). Automatic type acquisition fetches `@types` packages from npm to improve IntelliSense for external libraries.","typescript.disableAutomaticTypeAcquisition.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.automaticTypeAcquisition.enabled#` instead.","configuration.automaticTypeAcquisition.enabled":"Enable [automatic type acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition). Automatic type acquisition fetches `@types` packages from npm to improve IntelliSense for external libraries.","typescript.enablePromptUseWorkspaceTsdk":"Enables prompting of users to use the TypeScript version configured in the workspace for Intellisense.","typescript.enablePromptUseWorkspaceTsdk.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsdk.promptToUseWorkspaceVersion#` instead.","typescript.tsserver.enableTracing":"Enables tracing TS server performance to a directory. These trace files can be used to diagnose TS Server performance issues. The log may contain file paths, source code, and other potentially sensitive information from your project.","typescript.tsserver.enableTracing.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.tracing.enabled#` instead.","typescript.tsserver.log":"Enables logging of the TS server to a file. This log can be used to diagnose TS Server issues. The log may contain file paths, source code, and other potentially sensitive information from your project.","typescript.tsserver.log.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.log#` instead.","typescript.tsserver.pluginPaths":"Additional paths to discover TypeScript Language Service plugins.","typescript.tsserver.pluginPaths.item":"Either an absolute or relative path. Relative path will be resolved against workspace folder(s).","typescript.tsserver.pluginPaths.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.pluginPaths#` instead.","typescript.tsserver.trace":"Enables tracing of messages sent to the TS server. This trace can be used to diagnose TS Server issues. The trace may contain file paths, source code, and other potentially sensitive information from your project.","typescript.validate.enable":"Enable/disable TypeScript validation.","javascript.validate.enable":"Enable/disable JavaScript validation.","configuration.validate.enable":"Enable/disable JavaScript and TypeScript validation.","configuration.validate.enable.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.validate.enabled#` instead.","typescript.format.enable":"Enable/disable default TypeScript formatter.","javascript.format.enable":"Enable/disable default JavaScript formatter.","format.insertSpaceAfterCommaDelimiter":"Defines space handling after a comma delimiter.","format.insertSpaceAfterConstructor":"Defines space handling after the constructor keyword.","format.insertSpaceAfterSemicolonInForStatements":"Defines space handling after a semicolon in a for statement.","format.insertSpaceBeforeAndAfterBinaryOperators":"Defines space handling after a binary operator.","format.insertSpaceAfterKeywordsInControlFlowStatements":"Defines space handling after keywords in a control flow statement.","format.insertSpaceAfterFunctionKeywordForAnonymousFunctions":"Defines space handling after function keyword for anonymous functions.","format.insertSpaceBeforeFunctionParenthesis":"Defines space handling before function argument parentheses.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis":"Defines space handling after opening and before closing non-empty parenthesis.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets":"Defines space handling after opening and before closing non-empty brackets.","format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces":"Defines space handling after opening and before closing non-empty braces.","format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces":"Defines space handling after opening and before closing empty braces.","format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces":"Defines space handling after opening and before closing template string braces.","format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces":"Defines space handling after opening and before closing JSX expression braces.","format.insertSpaceAfterTypeAssertion":"Defines space handling after type assertions in TypeScript.","format.placeOpenBraceOnNewLineForFunctions":"Defines whether an open brace is put onto a new line for functions or not.","format.placeOpenBraceOnNewLineForControlBlocks":"Defines whether an open brace is put onto a new line for control blocks or not.","format.semicolons":"Defines handling of optional semicolons.","format.semicolons.ignore":"Don't insert or remove any semicolons.","format.semicolons.insert":"Insert semicolons at statement ends.","format.semicolons.remove":"Remove unnecessary semicolons.","format.indentSwitchCase":"Indent case clauses in switch statements. Requires using TypeScript 5.1+ in the workspace.","format.enable":"Enable/disable the default JavaScript and TypeScript formatter.","configuration.format.enable.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.enabled#` instead.","configuration.format.insertSpaceAfterCommaDelimiter.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterCommaDelimiter#` instead.","configuration.format.insertSpaceAfterConstructor.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterConstructor#` instead.","configuration.format.insertSpaceAfterSemicolonInForStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterSemicolonInForStatements#` instead.","configuration.format.insertSpaceBeforeAndAfterBinaryOperators.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceBeforeAndAfterBinaryOperators#` instead.","configuration.format.insertSpaceAfterKeywordsInControlFlowStatements.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterKeywordsInControlFlowStatements#` instead.","configuration.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions#` instead.","configuration.format.insertSpaceBeforeFunctionParenthesis.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceBeforeFunctionParenthesis#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces#` instead.","configuration.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces#` instead.","configuration.format.insertSpaceAfterTypeAssertion.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.insertSpaceAfterTypeAssertion#` instead.","configuration.format.placeOpenBraceOnNewLineForFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.placeOpenBraceOnNewLineForFunctions#` instead.","configuration.format.placeOpenBraceOnNewLineForControlBlocks.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.placeOpenBraceOnNewLineForControlBlocks#` instead.","configuration.format.semicolons.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.semicolons#` instead.","configuration.format.indentSwitchCase.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.format.indentSwitchCase#` instead.","javascript.goToProjectConfig.title":"Go to Project Configuration (jsconfig / tsconfig)","typescript.goToProjectConfig.title":"Go to Project Configuration (tsconfig)","configuration.referencesCodeLens.enabled":"Enable/disable references CodeLens in JavaScript and TypeScript files. This CodeLens shows the number of references for classes and exported functions and allows you to peek or navigate to them.","configuration.referencesCodeLens.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.referencesCodeLens.enabled#` instead.","configuration.referencesCodeLens.showOnAllFunctions":"Enable/disable the [references CodeLens](#js/ts.referencesCodeLens.enabled) on all functions in JavaScript and TypeScript files.","configuration.referencesCodeLens.showOnAllFunctions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.referencesCodeLens.showOnAllFunctions#` instead.","configuration.implementationsCodeLens.enabled":"Enable/disable implementations CodeLens in TypeScript files. This CodeLens shows the implementers of TypeScript interfaces.","configuration.implementationsCodeLens.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.enabled#` instead.","configuration.implementationsCodeLens.showOnInterfaceMethods":"Enable/disable [implementations CodeLens](#js/ts.implementationsCodeLens.enabled) on TypeScript interface methods.","configuration.implementationsCodeLens.showOnInterfaceMethods.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.showOnInterfaceMethods#` instead.","configuration.implementationsCodeLens.showOnAllClassMethods":"Enable/disable showing [implementations CodeLens](#js/ts.implementationsCodeLens.enabled) above all TypeScript class methods instead of only on abstract methods.","configuration.implementationsCodeLens.showOnAllClassMethods.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.implementationsCodeLens.showOnAllClassMethods#` instead.","typescript.openTsServerLog.title":"Open TS Server log","typescript.restartTsServer":"Restart TS Server","typescript.selectTypeScriptVersion.title":"Select TypeScript Version...","typescript.reportStyleChecksAsWarnings":"Report style checks as warnings.","configuration.reportStyleChecksAsWarnings.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.reportStyleChecksAsWarnings#` instead.","typescript.npm":"Specifies the path to the npm executable used for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).","typescript.npm.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.npm.path#` instead.","typescript.check.npmIsInstalled":"Check if npm is installed for [Automatic Type Acquisition](https://code.visualstudio.com/docs/nodejs/working-with-javascript#_typings-and-automatic-type-acquisition).","typescript.check.npmIsInstalled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.checkNpmIsInstalled#` instead.","configuration.suggest.names":"Enable/disable including unique names from the file in JavaScript suggestions. Note that name suggestions are always disabled in JavaScript code that is semantically checked using `@ts-check` or `checkJs`.","configuration.suggest.names.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.names#` instead.","typescript.tsc.autoDetect":"Controls auto detection of tsc tasks.","typescript.tsc.autoDetect.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsc.autoDetect#` instead.","typescript.tsc.autoDetect.off":"Disable this feature.","typescript.tsc.autoDetect.on":"Create both build and watch tasks.","typescript.tsc.autoDetect.build":"Only create single run compile tasks.","typescript.tsc.autoDetect.watch":"Only create compile and watch tasks.","typescript.problemMatchers.tsc.label":"TypeScript problems","typescript.problemMatchers.tsgo-watch.label":"TypeScript problems (watch mode)","typescript.problemMatchers.tscWatch.label":"TypeScript problems (watch mode)","configuration.suggest.paths":"Enable/disable suggestions for paths in import statements and require calls.","configuration.suggest.paths.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.paths#` instead.","configuration.tsserver.useSeparateSyntaxServer":"Enable/disable spawning a separate TypeScript server that can more quickly respond to syntax related operations, such as calculating folding or computing document symbols.","configuration.tsserver.useSyntaxServer":"Controls if TypeScript launches a dedicated server to more quickly handle syntax related operations, such as computing code folding.","configuration.tsserver.useSyntaxServer.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.useSyntaxServer#` instead.","configuration.tsserver.useSyntaxServer.always":"Use a lighter weight syntax server to handle all IntelliSense operations. This disables project-wide features including auto-imports, cross-file completions, and go to definition for symbols in other files. Only use this for very large projects where performance is critical.","configuration.tsserver.useSyntaxServer.never":"Don't use a dedicated syntax server. Use a single server to handle all IntelliSense operations.","configuration.tsserver.useSyntaxServer.auto":"Spawn both a full server and a lighter weight server dedicated to syntax operations. The syntax server is used to speed up syntax operations and provide IntelliSense while projects are loading.","configuration.tsserver.maxTsServerMemory":"The maximum amount of memory (in MB) to allocate to the TypeScript server process. To use a memory limit greater than 4 GB, use `#js/ts.tsserver.node.path#` to run TS Server with a custom Node installation.","configuration.tsserver.maxTsServerMemory.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.maxMemory#` instead.","configuration.tsserver.maxMemory":"The maximum amount of memory (in MB) to allocate to the TypeScript server process. To use a memory limit greater than 4 GB, use `#js/ts.tsserver.node.path#` to run TS Server with a custom Node installation.","configuration.tsserver.diagnosticDir":"Directory where TypeScript server writes Node diagnostic output by passing `--diagnostic-dir`.","configuration.tsserver.heapSnapshot":"Controls how many near-heap-limit snapshots TypeScript server writes by passing `--heapsnapshot-near-heap-limit`. Set to `0` to disable.","configuration.tsserver.heapProfile":"Configures heap profiling for TypeScript server.","configuration.tsserver.heapProfile.enabled":"Enable heap profiling for TypeScript server by passing `--heap-prof`.","configuration.tsserver.heapProfile.dir":"Directory where TypeScript server writes heap profiles by passing `--heap-prof-dir`.","configuration.tsserver.heapProfile.interval":"Sampling interval in bytes for TypeScript server heap profiling by passing `--heap-prof-interval`.","configuration.tsserver.experimental.enableProjectDiagnostics":"Enables project wide error reporting.","configuration.tsserver.experimental.enableProjectDiagnostics.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.experimental.enableProjectDiagnostics#` instead.","typescript.locale":"Sets the locale used to report JavaScript and TypeScript errors. Defaults to use VS Code's locale.","typescript.locale.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.locale#` instead.","typescript.locale.auto":"Use VS Code's configured display language.","configuration.implicitProjectConfig.module":"Sets the module system for the program. See more: https://www.typescriptlang.org/tsconfig#module.","configuration.implicitProjectConfig.target":"Set target JavaScript language version for emitted JavaScript and include library declarations. See more: https://www.typescriptlang.org/tsconfig#target.","configuration.implicitProjectConfig.checkJs":"Enable/disable semantic checking of JavaScript files. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.experimentalDecorators":"Enable/disable `experimentalDecorators` in JavaScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strictNullChecks":"Enable/disable [strict null checks](https://www.typescriptlang.org/tsconfig#strictNullChecks) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strictFunctionTypes":"Enable/disable [strict function types](https://www.typescriptlang.org/tsconfig#strictFunctionTypes) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.implicitProjectConfig.strict":"Enable/disable [strict mode](https://www.typescriptlang.org/tsconfig#strict) in JavaScript and TypeScript files that are not part of a project. Existing `jsconfig.json` or `tsconfig.json` files override this setting.","configuration.suggest.jsdoc.generateReturns":"Enable/disable generating `@returns` annotations for JSDoc templates.","configuration.suggest.jsdoc.generateReturns.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.jsdoc.generateReturns#` instead.","configuration.suggest.autoImports":"Enable/disable auto import suggestions.","configuration.suggest.autoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.autoImports#` instead.","configuration.preferGoToSourceDefinition":"Makes `Go to Definition` avoid type declaration files when possible by triggering `Go to Source Definition` instead. This allows `Go to Source Definition` to be triggered with the mouse gesture.","configuration.preferGoToSourceDefinition.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferGoToSourceDefinition#` instead.","inlayHints.parameterNames.none":"Disable parameter name hints.","inlayHints.parameterNames.literals":"Enable parameter name hints only for literal arguments.","inlayHints.parameterNames.all":"Enable parameter name hints for literal and non-literal arguments.","configuration.inlayHints.parameterNames.enabled":{message:"Enable/disable inlay hints for parameter names:\n```typescript\n\nparseInt(/* str: */ '123', /* radix: */ 8)\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.parameterNames.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterNames.enabled#` instead.","configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName":"Suppress parameter name hints on arguments whose text is identical to the parameter name.","configuration.inlayHints.parameterNames.suppressWhenArgumentMatchesName.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterNames.suppressWhenArgumentMatchesName#` instead.","configuration.inlayHints.parameterTypes.enabled":{message:"Enable/disable inlay hints for implicit parameter types:\n```typescript\n\nel.addEventListener('click', e /* :MouseEvent */ => ...)\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.parameterTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.parameterTypes.enabled#` instead.","configuration.inlayHints.variableTypes.enabled":{message:"Enable/disable inlay hints for implicit variable types:\n```typescript\n\nconst foo /* :number */ = Date.now();\n \n```",comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.variableTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.variableTypes.enabled#` instead.","configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName":"Suppress type hints on variables whose name is identical to the type name.","configuration.inlayHints.variableTypes.suppressWhenTypeMatchesName.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.variableTypes.suppressWhenTypeMatchesName#` instead.","configuration.inlayHints.propertyDeclarationTypes.enabled":{message:`Enable/disable inlay hints for implicit types on property declarations:
\`\`\`typescript

class Foo {
	prop /* :number */ = Date.now();
}
 
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.propertyDeclarationTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.propertyDeclarationTypes.enabled#` instead.","configuration.inlayHints.functionLikeReturnTypes.enabled":{message:`Enable/disable inlay hints for implicit return types on function signatures:
\`\`\`typescript

function foo() /* :number */ {
	return Date.now();
} 
 
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.functionLikeReturnTypes.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.functionLikeReturnTypes.enabled#` instead.","configuration.inlayHints.enumMemberValues.enabled":{message:`Enable/disable inlay hints for member values in enum declarations:
\`\`\`typescript

enum MyValue {
	A /* = 0 */;
	B /* = 1 */;
}
 
\`\`\``,comment:["The text inside the ``` block is code and should not be localized."]},"configuration.inlayHints.enumMemberValues.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.inlayHints.enumMemberValues.enabled#` instead.","taskDefinition.tsconfig.description":"The tsconfig file that defines the TS build.","javascript.suggestionActions.enabled":"Enable/disable suggestion diagnostics for JavaScript files in the editor.","typescript.suggestionActions.enabled":"Enable/disable suggestion diagnostics for TypeScript files in the editor.","configuration.suggestionActions.enabled":"Enable/disable suggestion diagnostics for JavaScript and TypeScript files in the editor.","configuration.suggestionActions.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggestionActions.enabled#` instead.","configuration.preferences.quoteStyle.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.quoteStyle#` instead.","configuration.preferences.importModuleSpecifier.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.importModuleSpecifier#` instead.","configuration.preferences.importModuleSpecifierEnding.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.importModuleSpecifierEnding#` instead.","configuration.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#js/ts.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"configuration.preferences.jsxAttributeCompletionStyle.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.jsxAttributeCompletionStyle#` instead.","configuration.preferences.includePackageJsonAutoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.includePackageJsonAutoImports#` instead.","configuration.preferences.autoImportFileExcludePatterns.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.autoImportFileExcludePatterns#` instead.","configuration.preferences.autoImportSpecifierExcludeRegexes.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.autoImportSpecifierExcludeRegexes#` instead.","configuration.preferences.preferTypeOnlyAutoImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.preferTypeOnlyAutoImports#` instead.","configuration.preferences.useAliasesForRenames.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.useAliasesForRenames#` instead.","configuration.preferences.renameMatchingJsxTags.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.renameMatchingJsxTags#` instead.","configuration.preferences.organizeImports.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.preferences.organizeImports#` instead.","typescript.preferences.quoteStyle":"Preferred quote style to use for Quick Fixes.","typescript.preferences.quoteStyle.single":"Always use single quotes: `'`","typescript.preferences.quoteStyle.double":'Always use double quotes: `"`',"typescript.preferences.quoteStyle.auto":"Infer quote type from existing code","typescript.preferences.importModuleSpecifier":"Preferred path style for auto imports.","typescript.preferences.importModuleSpecifier.shortest":"Prefers a non-relative import only if one is available that has fewer path segments than a relative import.","typescript.preferences.importModuleSpecifier.relative":"Prefers a relative path to the imported file location.","typescript.preferences.importModuleSpecifier.nonRelative":"Prefers a non-relative import based on the `baseUrl` or `paths` configured in your `jsconfig.json` / `tsconfig.json`.","typescript.preferences.importModuleSpecifier.projectRelative":"Prefers a non-relative import only if the relative import path would leave the package or project directory.","typescript.preferences.importModuleSpecifierEnding":"Preferred path ending for auto imports.","typescript.preferences.importModuleSpecifierEnding.label.js":".js / .ts","typescript.preferences.importModuleSpecifierEnding.auto":"Use project settings to select a default.","typescript.preferences.importModuleSpecifierEnding.minimal":"Shorten `./component/index.js` to `./component`.","typescript.preferences.importModuleSpecifierEnding.index":"Shorten `./component/index.js` to `./component/index`.","typescript.preferences.importModuleSpecifierEnding.js":"Do not shorten path endings; include the `.js` or `.ts` extension.","typescript.preferences.jsxAttributeCompletionStyle":"Preferred style for JSX attribute completions.","javascript.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#javascript.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"typescript.preferences.jsxAttributeCompletionStyle.auto":'Insert `={}` or `=""` after attribute names based on the prop type. See `#typescript.preferences.quoteStyle#` to control the type of quotes used for string attributes.',"typescript.preferences.jsxAttributeCompletionStyle.braces":"Insert `={}` after attribute names.","typescript.preferences.jsxAttributeCompletionStyle.none":"Only insert attribute names.","typescript.preferences.includePackageJsonAutoImports":"Enable/disable searching `package.json` dependencies for available auto imports.","typescript.preferences.includePackageJsonAutoImports.auto":"Search dependencies based on estimated performance impact.","typescript.preferences.includePackageJsonAutoImports.on":"Always search dependencies.","typescript.preferences.includePackageJsonAutoImports.off":"Never search dependencies.","typescript.preferences.autoImportFileExcludePatterns":"Specify glob patterns of files to exclude from auto imports. Relative paths are resolved relative to the workspace root. Patterns are evaluated using tsconfig.json [`exclude`](https://www.typescriptlang.org/tsconfig#exclude) semantics.","typescript.preferences.autoImportSpecifierExcludeRegexes":"Specify regular expressions to exclude auto imports with matching import specifiers. Examples:\n\n- `^node:`\n- `lib/internal` (slashes don't need to be escaped...)\n- `/lib\\/internal/i` (...unless including surrounding slashes for `i` or `u` flags)\n- `^lodash$` (only allow subpath imports from lodash)","typescript.preferences.preferTypeOnlyAutoImports":"Include the `type` keyword in auto-imports whenever possible. Requires using TypeScript 5.3+ in the workspace.","typescript.workspaceSymbols.excludeLibrarySymbols":"Exclude symbols that come from library files in `Go to Symbol in Workspace` results. Requires using TypeScript 5.3+ in the workspace.","configuration.workspaceSymbols.excludeLibrarySymbols.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.workspaceSymbols.excludeLibrarySymbols#` instead.","typescript.updateImportsOnFileMove.enabled":"Enable/disable automatic updating of import paths when you rename or move a file in VS Code.","typescript.updateImportsOnFileMove.enabled.prompt":"Prompt on each rename.","typescript.updateImportsOnFileMove.enabled.always":"Always update paths automatically.","typescript.updateImportsOnFileMove.enabled.never":"Never rename paths and don't prompt.","configuration.updateImportsOnFileMove.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.updateImportsOnFileMove.enabled#` instead.","typescript.autoClosingTags":"Enable/disable automatic closing of JSX tags.","configuration.autoClosingTags.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.autoClosingTags.enabled#` instead.","typescript.suggest.enabled":"Enable/disable autocomplete suggestions.","configuration.suggest.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.enabled#` instead.","configuration.suggest.jsdoc.enabled":"Enable/disable suggestion to complete JSDoc comments.","configuration.suggest.completeJSDocs.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.jsdoc.enabled#` instead.","configuration.tsserver.useVsCodeWatcher":"Use VS Code's file watchers instead of TypeScript's. Requires using TypeScript 5.4+ in the workspace.","configuration.tsserver.watchOptions":"Configure which watching strategies should be used to keep track of files and directories.","configuration.tsserver.watchOptions.vscode":"Use VS Code's file watchers instead of TypeScript's. Requires using TypeScript 5.4+ in the workspace.","configuration.tsserver.watchOptions.watchFile":"Strategy for how individual files are watched.","configuration.tsserver.watchOptions.watchFile.fixedChunkSizePolling":"Polls files in chunks at regular interval.","configuration.tsserver.watchOptions.watchFile.fixedPollingInterval":"Check every file for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.watchFile.priorityPollingInterval":"Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.","configuration.tsserver.watchOptions.watchFile.dynamicPriorityPolling":"Use a dynamic queue where less-frequently modified files will be checked less often.","configuration.tsserver.watchOptions.watchFile.useFsEvents":"Attempt to use the operating system/file system's native events for file changes.","configuration.tsserver.watchOptions.watchFile.useFsEventsOnParentDirectory":"Attempt to use the operating system/file system's native events to listen for changes on a file's containing directories. This can use fewer file watchers, but might be less accurate.","configuration.tsserver.watchOptions.watchDirectory":"Strategy for how entire directory trees are watched under systems that lack recursive file-watching functionality.","configuration.tsserver.watchOptions.watchDirectory.fixedChunkSizePolling":"Polls directories in chunks at regular interval.","configuration.tsserver.watchOptions.watchDirectory.fixedPollingInterval":"Check every directory for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.watchDirectory.dynamicPriorityPolling":"Use a dynamic queue where less-frequently modified directories will be checked less often.","configuration.tsserver.watchOptions.watchDirectory.useFsEvents":"Attempt to use the operating system/file system's native events for directory changes.","configuration.tsserver.watchOptions.fallbackPolling":"When using file system events, this option specifies the polling strategy that gets used when the system runs out of native file watchers and/or doesn't support native file watchers.","configuration.tsserver.watchOptions.fallbackPolling.fixedPollingInterval":"Check every file for changes several times a second at a fixed interval.","configuration.tsserver.watchOptions.fallbackPolling.priorityPollingInterval":"Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.","configuration.tsserver.watchOptions.fallbackPolling.dynamicPriorityPolling ":"Use a dynamic queue where less-frequently modified files will be checked less often.","configuration.tsserver.watchOptions.synchronousWatchDirectory":"Disable deferred watching on directories. Deferred watching is useful when lots of file changes might occur at once (e.g. a change in node_modules from running npm install), but you might want to disable it with this flag for some less-common setups.","typescript.preferences.useAliasesForRenames":"Enable/disable introducing aliases for object shorthand properties during renames.","typescript.preferences.renameMatchingJsxTags":"When on a JSX tag, try to rename the matching tag instead of renaming the symbol. Requires using TypeScript 5.1+ in the workspace.","typescript.preferences.organizeImports":"Advanced preferences that control how imports are ordered.","javascript.preferences.organizeImports":"Advanced preferences that control how imports are ordered.","typescript.preferences.organizeImports.caseSensitivity":"Specifies how imports should be sorted with regards to case-sensitivity. If `auto` or unspecified, we will detect the case-sensitivity per file","typescript.preferences.organizeImports.caseSensitivity.auto":"Detect case-sensitivity for import sorting.","typescript.preferences.organizeImports.caseSensitivity.insensitive":"Sort imports case-insensitively.","typescript.preferences.organizeImports.caseSensitivity.sensitive":"Sort imports case-sensitively.","typescript.preferences.organizeImports.typeOrder":"Specify how type-only named imports should be sorted.","typescript.preferences.organizeImports.typeOrder.auto":"Detect where type-only named imports should be sorted.","typescript.preferences.organizeImports.typeOrder.last":"Type only named imports are sorted to the end of the import list. E.g. `import { B, Z, type A, type Y } from 'module';`","typescript.preferences.organizeImports.typeOrder.inline":"Named imports are sorted by name only. E.g. `import { type A, B, type Y, Z } from 'module';`","typescript.preferences.organizeImports.typeOrder.first":"Type only named imports are sorted to the beginning of the import list. E.g. `import { type A, type Y, B, Z } from 'module';`","typescript.preferences.organizeImports.unicodeCollation":"Specify whether to sort imports using Unicode or Ordinal collation.","typescript.preferences.organizeImports.unicodeCollation.ordinal":"Sort imports using the numeric value of each code point.","typescript.preferences.organizeImports.unicodeCollation.unicode":"Sort imports using the Unicode code collation.","typescript.preferences.organizeImports.locale":"Requires `organizeImports.unicodeCollation: 'unicode'`. Overrides the locale used for collation. Specify `auto` to use the UI locale.","typescript.preferences.organizeImports.caseFirst":"Requires `organizeImports.unicodeCollation: 'unicode'`, and `organizeImports.caseSensitivity` is not `caseInsensitive`. Indicates whether upper-case will sort before lower-case.","typescript.preferences.organizeImports.caseFirst.default":"Default order given by `locale`.","typescript.preferences.organizeImports.caseFirst.lower":"Lower-case comes before upper-case. E.g.` a, A, z, Z`.","typescript.preferences.organizeImports.caseFirst.upper":"Upper-case comes before lower-case. E.g. ` A, a, B, b`.","typescript.preferences.organizeImports.numericCollation":"Requires `organizeImports.unicodeCollation: 'unicode'`. Sort numeric strings by integer value.","typescript.preferences.organizeImports.accentCollation":"Requires `organizeImports.unicodeCollation: 'unicode'`. Compare characters with diacritical marks as unequal to base character.","typescript.workspaceSymbols.scope":"Controls which files are searched by [Go to Symbol in Workspace](https://code.visualstudio.com/docs/editor/editingevolved#_open-symbol-by-name).","typescript.workspaceSymbols.scope.allOpenProjects":"Search all open JavaScript or TypeScript projects for symbols.","typescript.workspaceSymbols.scope.currentProject":"Only search for symbols in the current JavaScript or TypeScript project.","configuration.workspaceSymbols.scope.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.workspaceSymbols.scope#` instead.","typescript.sortImports":"Sort Imports","typescript.removeUnusedImports":"Remove Unused Imports","typescript.findAllFileReferences":"Find File References","typescript.goToSourceDefinition":"Go to Source Definition","configuration.suggest.classMemberSnippets.enabled":"Enable/disable snippet completions for class members.","configuration.suggest.classMemberSnippets.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.classMemberSnippets.enabled#` instead.","configuration.suggest.objectLiteralMethodSnippets.enabled":"Enable/disable snippet completions for methods in object literals.","configuration.suggest.objectLiteralMethodSnippets.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.suggest.objectLiteralMethodSnippets.enabled#` instead.","configuration.tsserver.web.projectWideIntellisense.enabled":"Enable/disable project-wide IntelliSense on web. Requires that VS Code is running in a trusted context.","configuration.tsserver.web.projectWideIntellisense.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.projectWideIntellisense.enabled#` instead.","configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors":"Suppresses semantic errors on web even when project wide IntelliSense is enabled. This is always on when project wide IntelliSense is not enabled or available. See `#js/ts.tsserver.web.projectWideIntellisense.enabled#`","configuration.tsserver.web.projectWideIntellisense.suppressSemanticErrors.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.projectWideIntellisense.suppressSemanticErrors#` instead.","configuration.tsserver.web.typeAcquisition.enabled":"Enable/disable package acquisition on the web. This enables IntelliSense for imported packages. Requires `#js/ts.tsserver.web.projectWideIntellisense.enabled#`. Currently not supported for Safari.","configuration.tsserver.web.typeAcquisition.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.web.typeAcquisition.enabled#` instead.","configuration.tsserver.nodePath":"Run TS Server on a custom Node installation. This can be a path to a Node executable, or `node` if you want VS Code to detect a Node installation.","configuration.tsserver.nodePath.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.node.path#` instead.","configuration.tsserver.watchOptions.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.tsserver.watchOptions#` instead.","configuration.updateImportsOnPaste":"Automatically update imports when pasting code. Requires TypeScript 5.6+.","configuration.updateImportsOnPaste.enabled.unifiedDeprecationMessage":"This setting is deprecated. Use `#js/ts.updateImportsOnPaste.enabled#` instead.","configuration.hover.maximumLength":"The maximum number of characters in a hover. If the hover is longer than this, it will be truncated. Requires TypeScript 5.9+.","walkthroughs.nodejsWelcome.title":"Get started with JavaScript and Node.js","walkthroughs.nodejsWelcome.description":"Make the most of Visual Studio Code's first-class JavaScript experience.","walkthroughs.nodejsWelcome.downloadNode.forMacOrWindows.title":"Install Node.js","walkthroughs.nodejsWelcome.downloadNode.forMacOrWindows.description":`Node.js is an easy way to run JavaScript code. You can use it to quickly build command-line apps and servers. It also comes with npm, a package manager which makes reusing and sharing JavaScript code easy.
[Install Node.js](https://nodejs.org/en/download/)`,"walkthroughs.nodejsWelcome.downloadNode.forLinux.title":"Install Node.js","walkthroughs.nodejsWelcome.downloadNode.forLinux.description":`Node.js is an easy way to run JavaScript code. You can use it to quickly build command-line apps and servers. It also comes with npm, a package manager which makes reusing and sharing JavaScript code easy.
[Install Node.js](https://nodejs.org/en/download/package-manager/)`,"walkthroughs.nodejsWelcome.makeJsFile.title":"Create a JavaScript File","walkthroughs.nodejsWelcome.makeJsFile.description":"Let's write our first JavaScript file. We'll have to create a new file and save it with the ``.js`` extension at the end of the file name.\n[Create a JavaScript File](command:javascript-walkthrough.commands.createJsFile)","walkthroughs.nodejsWelcome.debugJsFile.title":"Run and Debug your JavaScript","walkthroughs.nodejsWelcome.debugJsFile.description":"Once you've installed Node.js, you can run JavaScript programs at a terminal by entering ``node your-file-name.js``\nAnother easy way to run Node.js programs is by using VS Code's debugger which lets you run your code, pause at different points, and help you understand what's going on step-by-step.\n[Start Debugging](command:javascript-walkthrough.commands.debugJsFile)","walkthroughs.nodejsWelcome.debugJsFile.altText":"Debug and run your JavaScript code in Node.js with Visual Studio Code.","walkthroughs.nodejsWelcome.learnMoreAboutJs.title":"Explore More","walkthroughs.nodejsWelcome.learnMoreAboutJs.description":`Want to get more comfortable with JavaScript, Node.js, and VS Code? Be sure to check out our docs!
We've got lots of resources for learning [JavaScript](https://code.visualstudio.com/docs/nodejs/working-with-javascript) and [Node.js](https://code.visualstudio.com/docs/nodejs/nodejs-tutorial).

[Learn More](https://code.visualstudio.com/docs/nodejs/nodejs-tutorial)`,"walkthroughs.nodejsWelcome.learnMoreAboutJs.altText":"Learn more about JavaScript and Node.js in Visual Studio Code."},readmePath:"typescript-language-features/README.md"},{extensionPath:"vb",packageJSON:{name:"vb",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin textmate/asp.vb.net.tmbundle Syntaxes/ASP%20VB.net.plist ./syntaxes/asp-vb-net.tmLanguage.json"},categories:["Programming Languages"],contributes:{languages:[{id:"vb",extensions:[".vb",".brs",".vbs",".bas",".vba"],aliases:["Visual Basic","vb"],configuration:"./language-configuration.json"}],grammars:[{language:"vb",scopeName:"source.asp.vb.net",path:"./syntaxes/asp-vb-net.tmLanguage.json"}],snippets:[{language:"vb",path:"./snippets/vb.code-snippets"}]},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"Visual Basic Language Basics",description:"Provides snippets, syntax highlighting, bracket matching and folding in Visual Basic files."}},{extensionPath:"xml",packageJSON:{name:"xml",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},categories:["Programming Languages"],contributes:{languages:[{id:"xml",extensions:[".xml",".xsd",".ascx",".atom",".axml",".axaml",".bpmn",".cpt",".csl",".csproj",".csproj.user",".dita",".ditamap",".dtd",".ent",".mod",".dtml",".fsproj",".fxml",".iml",".isml",".jmx",".launch",".menu",".mxml",".nuspec",".opml",".owl",".proj",".props",".pt",".publishsettings",".pubxml",".pubxml.user",".rbxlx",".rbxmx",".rdf",".rng",".rss",".shproj",".slnx",".storyboard",".svg",".targets",".tld",".tmx",".vbproj",".vbproj.user",".vcxproj",".vcxproj.filters",".wsdl",".wxi",".wxl",".wxs",".xaml",".xbl",".xib",".xlf",".xliff",".xpdl",".xul",".xoml"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],configuration:"./xml.language-configuration.json"},{id:"xsl",extensions:[".xsl",".xslt"],aliases:["XSL","xsl"],configuration:"./xsl.language-configuration.json"}],grammars:[{language:"xml",scopeName:"text.xml",path:"./syntaxes/xml.tmLanguage.json"},{language:"xsl",scopeName:"text.xml.xsl",path:"./syntaxes/xsl.tmLanguage.json"}]},scripts:{"update-grammar":"node ../node_modules/vscode-grammar-updater/bin atom/language-xml grammars/xml.cson ./syntaxes/xml.tmLanguage.json grammars/xsl.cson ./syntaxes/xsl.tmLanguage.json"},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"XML Language Basics",description:"Provides syntax highlighting and bracket matching in XML files."}},{extensionPath:"yaml",packageJSON:{name:"yaml",displayName:"%displayName%",description:"%description%",version:"10.0.0",publisher:"vscode",license:"MIT",engines:{vscode:"*"},scripts:{"update-grammar":"node ./build/update-grammar.js"},categories:["Programming Languages"],contributes:{languages:[{id:"dockercompose",aliases:["Compose","compose"],filenamePatterns:["compose.yml","compose.yaml","compose.*.yml","compose.*.yaml","*docker*compose*.yml","*docker*compose*.yaml"],configuration:"./language-configuration.json"},{id:"yaml",aliases:["YAML","yaml"],extensions:[".yaml",".yml",".eyaml",".eyml",".cff",".yaml-tmlanguage",".yaml-tmpreferences",".yaml-tmtheme",".winget"],firstLine:"^#cloud-config",configuration:"./language-configuration.json"}],grammars:[{language:"dockercompose",scopeName:"source.yaml",path:"./syntaxes/yaml.tmLanguage.json"},{scopeName:"source.yaml.1.3",path:"./syntaxes/yaml-1.3.tmLanguage.json"},{scopeName:"source.yaml.1.2",path:"./syntaxes/yaml-1.2.tmLanguage.json"},{scopeName:"source.yaml.1.1",path:"./syntaxes/yaml-1.1.tmLanguage.json"},{scopeName:"source.yaml.1.0",path:"./syntaxes/yaml-1.0.tmLanguage.json"},{scopeName:"source.yaml.embedded",path:"./syntaxes/yaml-embedded.tmLanguage.json"},{language:"yaml",scopeName:"source.yaml",path:"./syntaxes/yaml.tmLanguage.json",unbalancedBracketScopes:["invalid.illegal","meta.scalar.yaml","storage.type.tag.shorthand.yaml","keyword.control.flow"]}],configurationDefaults:{"[yaml]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced","diffEditor.ignoreTrimWhitespace":!1,"editor.defaultColorDecorators":"never","editor.quickSuggestions":{strings:"on"}},"[dockercompose]":{"editor.insertSpaces":!0,"editor.tabSize":2,"editor.autoIndent":"advanced"}}},repository:{type:"git",url:"https://github.com/microsoft/vscode.git"}},packageNLS:{displayName:"YAML Language Basics",description:"Provides syntax highlighting and bracket matching in YAML files."}}];else{let c=ut.document.getElementById("vscode-workbench-builtin-extensions"),u=c?c.getAttribute("data-settings"):void 0;if(u)try{l=JSON.parse(u)}catch{}}this.builtinExtensionsPromises=l.map(async c=>{let u=gf(c.packageJSON.publisher,c.packageJSON.name);return{identifier:{id:u},location:e.extUri.joinPath(s,c.extensionPath),type:0,isBuiltin:!0,manifest:c.packageNLS?await this.localizeManifest(u,c.packageJSON,c.packageNLS):c.packageJSON,readmeUrl:c.readmePath?e.extUri.joinPath(s,c.readmePath):void 0,changelogUrl:c.changelogPath?e.extUri.joinPath(s,c.changelogPath):void 0,targetPlatform:"web",validations:[],isValid:!0,preRelease:!1}})}}}async scanBuiltinExtensions(){return[...await Promise.all(this.builtinExtensionsPromises)]}async localizeManifest(i,e,t){if(!this.nlsUrl)return uAe(this.logService,e,t);let o=A.joinPath(this.nlsUrl,i,"package");try{let n=await this.extensionResourceLoaderService.readExtensionResource(o),r=JSON.parse(n.toString());return uAe(this.logService,e,r,t)}catch(n){return this.logService.error(n),uAe(this.logService,e,t)}}};Xit=I([m(0,Mt),m(1,gt),m(2,aE),m(3,Ze),m(4,re)],Xit);Ce(Rio,Xit,1);var AR=le("extensionRecommendationsService"),RE=le("IExtensionIgnoredRecommendationsService");var cge=".vscode/extensions.json",rq=le("IWorkspaceExtensionsConfigService"),Jit=class extends k{constructor(e,t,o,n,r,s){super();this.workspaceContextService=e;this.fileService=t;this.quickInputService=o;this.modelService=n;this.languageService=r;this.jsonEditingService=s;this._onDidChangeExtensionsConfigs=this._register(new T);this.onDidChangeExtensionsConfigs=this._onDidChangeExtensionsConfigs.event;this._register(e.onDidChangeWorkspaceFolders(l=>this._onDidChangeExtensionsConfigs.fire())),this._register(t.onDidFilesChange(l=>{let c=e.getWorkspace();(c.configuration&&l.affects(c.configuration)||c.folders.some(u=>l.affects(u.toResource(cge))))&&this._onDidChangeExtensionsConfigs.fire()}))}async getExtensionsConfigs(){let e=this.workspaceContextService.getWorkspace(),t=[],o=e.configuration?await this.resolveWorkspaceExtensionConfig(e.configuration):void 0;return o&&t.push(o),t.push(...await Promise.all(e.folders.map(n=>this.resolveWorkspaceFolderExtensionConfig(n)))),t}async getRecommendations(){let e=await this.getExtensionsConfigs();return jo(e.flatMap(t=>t.recommendations?t.recommendations.map(o=>o.toLowerCase()):[]))}async getUnwantedRecommendations(){let e=await this.getExtensionsConfigs();return jo(e.flatMap(t=>t.unwantedRecommendations?t.unwantedRecommendations.map(o=>o.toLowerCase()):[]))}async toggleRecommendation(e){e=e.toLowerCase();let t=this.workspaceContextService.getWorkspace(),o=t.configuration?await this.resolveWorkspaceExtensionConfig(t.configuration):void 0,n=new dt;await Promise.all(t.folders.map(async u=>{let p=await this.resolveWorkspaceFolderExtensionConfig(u);n.set(u.uri,p)}));let r=o&&o.recommendations?.some(u=>u.toLowerCase()===e),s=t.folders.filter(u=>n.get(u.uri)?.recommendations?.some(p=>p.toLowerCase()===e)),l=r||s.length>0,c=l?await this.pickWorkspaceOrFolders(s,r?t:void 0,d(18937,null)):await this.pickWorkspaceOrFolders(t.folders,t.configuration?t:void 0,d(18936,null));for(let u of c)p4(u)?await this.addOrRemoveWorkspaceRecommendation(e,u,o,!l):await this.addOrRemoveWorkspaceFolderRecommendation(e,u,n.get(u.uri),!l)}async toggleUnwantedRecommendation(e){let t=this.workspaceContextService.getWorkspace(),o=t.configuration?await this.resolveWorkspaceExtensionConfig(t.configuration):void 0,n=new dt;await Promise.all(t.folders.map(async u=>{let p=await this.resolveWorkspaceFolderExtensionConfig(u);n.set(u.uri,p)}));let r=o&&o.unwantedRecommendations?.some(u=>u===e),s=t.folders.filter(u=>n.get(u.uri)?.unwantedRecommendations?.some(p=>p===e)),l=r||s.length>0,c=l?await this.pickWorkspaceOrFolders(s,r?t:void 0,d(18937,null)):await this.pickWorkspaceOrFolders(t.folders,t.configuration?t:void 0,d(18936,null));for(let u of c)p4(u)?await this.addOrRemoveWorkspaceUnwantedRecommendation(e,u,o,!l):await this.addOrRemoveWorkspaceFolderUnwantedRecommendation(e,u,n.get(u.uri),!l)}async addOrRemoveWorkspaceFolderRecommendation(e,t,o,n){let r=[];if(n){Array.isArray(o.recommendations)?r.push({path:["recommendations",-1],value:e}):r.push({path:["recommendations"],value:[e]});let s=this.getEditToRemoveValueFromArray(["unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}else if(o.recommendations){let s=this.getEditToRemoveValueFromArray(["recommendations"],o.recommendations,e);s&&r.push(s)}if(r.length)return this.jsonEditingService.write(t.toResource(cge),r,!0)}async addOrRemoveWorkspaceRecommendation(e,t,o,n){let r=[];if(o){if(n){let s=["extensions","recommendations"];Array.isArray(o.recommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["extensions","unwantedRecommendations"],o.unwantedRecommendations,e);l&&r.push(l)}else if(o.recommendations){let s=this.getEditToRemoveValueFromArray(["extensions","recommendations"],o.recommendations,e);s&&r.push(s)}}else n&&r.push({path:["extensions"],value:{recommendations:[e]}});if(r.length)return this.jsonEditingService.write(t.configuration,r,!0)}async addOrRemoveWorkspaceFolderUnwantedRecommendation(e,t,o,n){let r=[];if(n){let s=["unwantedRecommendations"];Array.isArray(o.unwantedRecommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["recommendations"],o.recommendations,e);l&&r.push(l)}else if(o.unwantedRecommendations){let s=this.getEditToRemoveValueFromArray(["unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}if(r.length)return this.jsonEditingService.write(t.toResource(cge),r,!0)}async addOrRemoveWorkspaceUnwantedRecommendation(e,t,o,n){let r=[];if(o){if(n){let s=["extensions","unwantedRecommendations"];Array.isArray(o.recommendations)?r.push({path:[...s,-1],value:e}):r.push({path:s,value:[e]});let l=this.getEditToRemoveValueFromArray(["extensions","recommendations"],o.recommendations,e);l&&r.push(l)}else if(o.unwantedRecommendations){let s=this.getEditToRemoveValueFromArray(["extensions","unwantedRecommendations"],o.unwantedRecommendations,e);s&&r.push(s)}}else n&&r.push({path:["extensions"],value:{unwantedRecommendations:[e]}});if(r.length)return this.jsonEditingService.write(t.configuration,r,!0)}async pickWorkspaceOrFolders(e,t,o){let n=t?[...e,t]:[...e];if(n.length===1)return n;let r=e.map(l=>({label:l.name,description:d(18939,null),workspaceOrFolder:l,iconClasses:Ia(this.modelService,this.languageService,l.uri,2)}));return t&&(r.push({type:"separator"}),r.push({label:d(18938,null),workspaceOrFolder:t})),(await this.quickInputService.pick(r,{placeHolder:o,canPickMany:!0})||[]).map(l=>l.workspaceOrFolder)}async resolveWorkspaceExtensionConfig(e){try{let t=await this.fileService.readFile(e),o=is(t.value.toString()).extensions;return o?this.parseExtensionConfig(o):void 0}catch{}}async resolveWorkspaceFolderExtensionConfig(e){try{let t=await this.fileService.readFile(e.toResource(cge)),o=is(t.value.toString());return this.parseExtensionConfig(o)}catch{}return{}}parseExtensionConfig(e){return{recommendations:jo((e.recommendations||[]).map(t=>t.toLowerCase())),unwantedRecommendations:jo((e.unwantedRecommendations||[]).map(t=>t.toLowerCase()))}}getEditToRemoveValueFromArray(e,t,o){let n=t?.indexOf(o);if(n!==void 0&&n!==-1)return{path:[...e,n],value:void 0}}};Jit=I([m(0,Ae),m(1,ge),m(2,$e),m(3,_t),m(4,Rt),m(5,Zg)],Jit);Ce(rq,Jit,1);var oDi="extensionsAssistant/ignored_recommendations",Zit=class extends k{constructor(e,t){super();this.workspaceExtensionsConfigService=e;this.storageService=t;this._onDidChangeIgnoredRecommendations=this._register(new T);this.onDidChangeIgnoredRecommendations=this._onDidChangeIgnoredRecommendations.event;this._globalIgnoredRecommendations=[];this._onDidChangeGlobalIgnoredRecommendation=this._register(new T);this.onDidChangeGlobalIgnoredRecommendation=this._onDidChangeGlobalIgnoredRecommendation.event;this.ignoredWorkspaceRecommendations=[];this._globalIgnoredRecommendations=this.getCachedIgnoredRecommendations(),this._register(this.storageService.onDidChangeValue(0,oDi,this._store)(()=>this.onDidStorageChange())),this.initIgnoredWorkspaceRecommendations()}get globalIgnoredRecommendations(){return[...this._globalIgnoredRecommendations]}get ignoredRecommendations(){return jo([...this.globalIgnoredRecommendations,...this.ignoredWorkspaceRecommendations])}async initIgnoredWorkspaceRecommendations(){this.ignoredWorkspaceRecommendations=await this.workspaceExtensionsConfigService.getUnwantedRecommendations(),this._onDidChangeIgnoredRecommendations.fire(),this._register(this.workspaceExtensionsConfigService.onDidChangeExtensionsConfigs(async()=>{this.ignoredWorkspaceRecommendations=await this.workspaceExtensionsConfigService.getUnwantedRecommendations(),this._onDidChangeIgnoredRecommendations.fire()}))}toggleGlobalIgnoredRecommendation(e,t){e=e.toLowerCase(),this._globalIgnoredRecommendations.indexOf(e)!==-1!==t&&(this._globalIgnoredRecommendations=t?[...this._globalIgnoredRecommendations,e]:this._globalIgnoredRecommendations.filter(n=>n!==e),this.storeCachedIgnoredRecommendations(this._globalIgnoredRecommendations),this._onDidChangeGlobalIgnoredRecommendation.fire({extensionId:e,isRecommended:!t}),this._onDidChangeIgnoredRecommendations.fire())}getCachedIgnoredRecommendations(){return JSON.parse(this.ignoredRecommendationsValue).map(t=>t.toLowerCase())}onDidStorageChange(){this.ignoredRecommendationsValue!==this.getStoredIgnoredRecommendationsValue()&&(this._ignoredRecommendationsValue=void 0,this._globalIgnoredRecommendations=this.getCachedIgnoredRecommendations(),this._onDidChangeIgnoredRecommendations.fire())}storeCachedIgnoredRecommendations(e){this.ignoredRecommendationsValue=JSON.stringify(e)}get ignoredRecommendationsValue(){return this._ignoredRecommendationsValue||(this._ignoredRecommendationsValue=this.getStoredIgnoredRecommendationsValue()),this._ignoredRecommendationsValue}set ignoredRecommendationsValue(e){this.ignoredRecommendationsValue!==e&&(this._ignoredRecommendationsValue=e,this.setStoredIgnoredRecommendationsValue(e))}getStoredIgnoredRecommendationsValue(){return this.storageService.get(oDi,0,"[]")}setStoredIgnoredRecommendationsValue(e){this.storageService.store(oDi,e,0,0)}};Zit=I([m(0,rq),m(1,de)],Zit);Ce(RE,Zit,1);var nDi="extension.features.state",eot=class extends k{constructor(e,t,o){super();this.storageService=e;this.dialogService=t;this.extensionService=o;this._onDidChangeEnablement=this._register(new T);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._onDidChangeAccessData=this._register(new T);this.onDidChangeAccessData=this._onDidChangeAccessData.event;this.extensionFeaturesState=new Map;this.registry=oe.as(qs.ExtensionFeaturesRegistry),this.extensionFeaturesState=this.loadState(),this.garbageCollectOldRequests(),this._register(e.onDidChangeValue(0,nDi,this._store)(n=>this.onDidStorageChange(n)))}isEnabled(e,t){let o=this.registry.getExtensionFeature(t);if(!o)return!1;let n=this.getExtensionFeatureState(e,t)?.disabled;if(Xa(n))return!n;let r=o.access.extensionsList?.[e._lower];return Xa(r)?r:!o.access.requireUserConsent}setEnablement(e,t,o){if(!this.registry.getExtensionFeature(t))throw new Error(`No feature with id '${t}'`);let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);r.disabled!==!o&&(r.disabled=!o,this._onDidChangeEnablement.fire({extension:e,featureId:t,enabled:o}),this.saveState())}getEnablementData(e){let t=[];if(this.registry.getExtensionFeature(e))for(let[n,r]of this.extensionFeaturesState){let s=r.get(e);s?.disabled!==void 0&&t.push({extension:new hi(n),enabled:!s.disabled})}return t}async getAccess(e,t,o){let n=this.registry.getExtensionFeature(t);if(!n)return!1;let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);if(r.disabled)return!1;if(r.disabled===void 0){let l=!0;if(n.access.requireUserConsent){let c=this.extensionService.extensions.find(p=>hi.equals(p.identifier,e));l=(await this.dialogService.confirm({title:d(18880,null,n.label),message:d(18881,null,c?.displayName??e._lower,n.label),detail:o??n.description,custom:!0,primaryButton:d(18882,null),cancelButton:d(18883,null)})).confirmed}if(this.setEnablement(e,t,l),!l)return!1}let s=new Date;return r.accessData.current={accessTimes:[s].concat(r.accessData.current?.accessTimes??[]),lastAccessed:s,status:r.accessData.current?.status},r.accessData.accessTimes=(r.accessData.accessTimes??[]).concat(s),this.saveState(),this._onDidChangeAccessData.fire({extension:e,featureId:t,accessData:r.accessData}),!0}getAllAccessDataForExtension(e){let t=new Map,o=this.extensionFeaturesState.get(e._lower);if(o)for(let[n,r]of o)t.set(n,r.accessData);return t}getAccessData(e,t){if(this.registry.getExtensionFeature(t))return this.getExtensionFeatureState(e,t)?.accessData}setStatus(e,t,o){if(!this.registry.getExtensionFeature(t))throw new Error(`No feature with id '${t}'`);let r=this.getAndSetIfNotExistsExtensionFeatureState(e,t);r.accessData.current={accessTimes:r.accessData.current?.accessTimes??[],lastAccessed:r.accessData.current?.lastAccessed??new Date,status:o},this._onDidChangeAccessData.fire({extension:e,featureId:t,accessData:this.getAccessData(e,t)})}getExtensionFeatureState(e,t){return this.extensionFeaturesState.get(e._lower)?.get(t)}getAndSetIfNotExistsExtensionFeatureState(e,t){let o=this.extensionFeaturesState.get(e._lower);o||(o=new Map,this.extensionFeaturesState.set(e._lower,o));let n=o.get(t);return n||(n={accessData:{accessTimes:[]}},o.set(t,n)),n}onDidStorageChange(e){if(e.external){let t=this.extensionFeaturesState;this.extensionFeaturesState=this.loadState();for(let o of jo([...t.keys(),...this.extensionFeaturesState.keys()])){let n=new hi(o),r=t.get(o),s=this.extensionFeaturesState.get(o);for(let l of jo([...r?.keys()??[],...s?.keys()??[]])){let c=this.isEnabled(n,l),u=!r?.get(l)?.disabled;c!==u&&this._onDidChangeEnablement.fire({extension:n,featureId:l,enabled:c});let p=this.getAccessData(n,l),h=r?.get(l)?.accessData;Qi(p,h)||this._onDidChangeAccessData.fire({extension:n,featureId:l,accessData:p??{accessTimes:[]}})}}}}loadState(){let e={},t=this.storageService.get(nDi,0,"{}");try{e=JSON.parse(t)}catch{}let o=new Map;for(let n in e){let r=new Map,s=e[n];for(let l in s){let c=s[l];r.set(l,{disabled:c.disabled,accessData:{accessTimes:(c.accessTimes??[]).map(u=>new Date(u))}})}o.set(n.toLowerCase(),r)}return o}saveState(){let e={};this.extensionFeaturesState.forEach((t,o)=>{let n={};t.forEach((r,s)=>{n[s]={disabled:r.disabled,accessTimes:r.accessData.accessTimes.map(l=>l.getTime())}}),e[o]=n}),this.storageService.store(nDi,JSON.stringify(e),0,0)}garbageCollectOldRequests(){let e=new Date,t=new Date(e.setDate(e.getDate()-30)),o=!1;for(let[,n]of this.extensionFeaturesState)for(let[,r]of n){let s=r.accessData.accessTimes.length;r.accessData.accessTimes=r.accessData.accessTimes.filter(l=>l>t),r.accessData.accessTimes.length!==s&&(o=!0)}o&&this.saveState()}};eot=I([m(0,de),m(1,ct),m(2,lt)],eot);Ce(Qy,eot,1);var sq=class extends k{constructor(e){super();this.storageService=e;this.model=this._register(new GWt);this._onDidChangeFilter=this._register(new T);this.onDidChangeFilter=this._onDidChangeFilter.event;this.mapSourceToFilter=(()=>{let t=new Map;for(let o of this.storageService.getObject(sq.PER_SOURCE_FILTER_SETTINGS_KEY,-1,[]))t.set(o.id,o);return t})(),this.globalFilterEnabled=this.storageService.getBoolean(sq.GLOBAL_FILTER_SETTINGS_KEY,-1,!1),this.updateFilters(),this.registerListeners()}registerListeners(){this._register(this.model.onDidChangeNotification(e=>{if(e.kind===0){let t=typeof e.item.sourceId=="string"&&typeof e.item.source=="string"?{id:e.item.sourceId,label:e.item.source}:e.item.source;yX(t)&&(this.mapSourceToFilter.has(t.id)?this.updateSourceFilter(t):this.setFilter({...t,filter:0}))}}))}static{this.GLOBAL_FILTER_SETTINGS_KEY="notifications.doNotDisturbMode"}static{this.PER_SOURCE_FILTER_SETTINGS_KEY="notifications.perSourceDoNotDisturbMode"}setFilter(e){if(typeof e=="number"){if(this.globalFilterEnabled===(e===1))return;this.globalFilterEnabled=e===1,this.storageService.store(sq.GLOBAL_FILTER_SETTINGS_KEY,this.globalFilterEnabled,-1,1),this.updateFilters(),this._onDidChangeFilter.fire()}else{let t=this.mapSourceToFilter.get(e.id);if(t?.filter===e.filter&&t.label===e.label)return;this.mapSourceToFilter.set(e.id,{id:e.id,label:e.label,filter:e.filter}),this.saveSourceFilters(),this.updateFilters()}}getFilter(e){return e?this.mapSourceToFilter.get(e.id)?.filter??0:this.globalFilterEnabled?1:0}updateSourceFilter(e){let t=this.mapSourceToFilter.get(e.id);t&&t.label!==e.label&&(this.mapSourceToFilter.set(e.id,{id:e.id,label:e.label,filter:t.filter}),this.saveSourceFilters())}saveSourceFilters(){this.storageService.store(sq.PER_SOURCE_FILTER_SETTINGS_KEY,JSON.stringify([...this.mapSourceToFilter.values()]),-1,1)}getFilters(){return[...this.mapSourceToFilter.values()]}updateFilters(){this.model.setFilter({global:this.globalFilterEnabled?1:0,sources:new Map([...this.mapSourceToFilter.values()].map(e=>[e.id,e.filter]))})}removeFilter(e){this.mapSourceToFilter.delete(e)&&(this.saveSourceFilters(),this.updateFilters())}info(e){if(Array.isArray(e)){for(let t of e)this.info(t);return}this.model.addNotification({severity:ft.Info,message:e})}warn(e){if(Array.isArray(e)){for(let t of e)this.warn(t);return}this.model.addNotification({severity:ft.Warning,message:e})}error(e){if(Array.isArray(e)){for(let t of e)this.error(t);return}this.model.addNotification({severity:ft.Error,message:e})}notify(e){let t=new O;if(e.neverShowAgain){let n=this.toStorageScope(e.neverShowAgain),r=e.neverShowAgain.id;if(this.storageService.getBoolean(r,n))return new lde;let s=t.add(new it("workbench.notification.neverShowAgain",d(19171,null),void 0,!0,async()=>{o.close(),this.storageService.store(r,!0,n,0)})),l={primary:e.actions?.primary||[],secondary:e.actions?.secondary||[]};e.neverShowAgain.isSecondary?l.secondary=[...l.secondary,s]:l.primary=[s,...l.primary],e.actions=l}let o=this.model.addNotification(e);return U.once(o.onDidClose)(()=>t.dispose()),o}toStorageScope(e){switch(e.scope){case 2:return-1;case 1:return 0;case 0:return 1;default:return-1}}prompt(e,t,o,n){if(n?.neverShowAgain){let h=this.toStorageScope(n.neverShowAgain),g=n.neverShowAgain.id;if(this.storageService.getBoolean(g,h))return new lde;let f={label:d(19171,null),run:()=>this.storageService.store(g,!0,h,0),isSecondary:n.neverShowAgain.isSecondary};n.neverShowAgain.isSecondary?o=[...o,f]:o=[f,...o]}let r=!1,s=new O,l=[],c=[];o.forEach((h,g)=>{let f=new dhe(`workbench.dialog.choice.${g}`,h);h.isSecondary?c.push(f):l.push(f),s.add(f.onDidRun(()=>{r=!0,h.keepOpen||p.close()})),s.add(f)});let u={primary:l,secondary:c},p=this.notify({severity:e,message:t,actions:u,sticky:n?.sticky,priority:n?.priority});return U.once(p.onDidClose)(()=>{s.dispose(),n&&typeof n.onCancel=="function"&&!r&&n.onCancel()}),p}status(e,t){return this.model.showStatusMessage(e,t)}};sq=I([m(0,de)],sq);Ce(Ne,sq,1);var tot=class{constructor(i,e,t,o){this.keybindingsService=i;this.textModelService=e;this.textResourcePropertiesService=t;this.textResourceConfigurationService=o}async resolveDefaultCoreIgnoredSettings(){return eie(!0)}async resolveUserBindings(i){let e={};for(let t of i)e[t]=this.keybindingsService.resolveUserBinding(t).map(o=>o.getUserSettingsLabel()).join(" ");return e}async resolveFormattingOptions(i){try{let e=await this.textModelService.createModelReference(i),{insertSpaces:t,tabSize:o}=e.object.textEditorModel.getOptions(),n=e.object.textEditorModel.getEOL();return e.dispose(),{eol:n,insertSpaces:t,tabSize:o}}catch{}return{eol:this.textResourcePropertiesService.getEOL(i),insertSpaces:!!this.textResourceConfigurationService.getValue(i,"editor.insertSpaces"),tabSize:this.textResourceConfigurationService.getValue(i,"editor.tabSize")}}};tot=I([m(0,Le),m(1,Bt),m(2,BL),m(3,Gn)],tot);Ce(iie,tot,1);function pAe(a,i,e,t){let o=rS(a,i,e,t)[0];return o&&(a=a.substring(0,o.offset)+o.content+a.substring(o.offset+o.length)),a}function v1t(a,i,e){let t=[];e?t=Ynn(e):t=Qnn(i);let o=[],n=[...p1t()];if(Array.isArray(t))for(let r of t)r.startsWith("-")?n.push(r.substring(1)):o.push(r);return jo([...a,...o].filter(r=>!n.includes(r)))}function Qnn(a){let i=a.inspect("settingsSync.ignoredSettings").userValue;return i!==void 0||(i=a.inspect("sync.ignoredSettings").userValue,i!==void 0)?i:a.getValue("settingsSync.ignoredSettings")||[]}function Ynn(a){let i=is(a);return i?i["settingsSync.ignoredSettings"]||i["sync.ignoredSettings"]||[]:[]}function aDi(a,i,e,t){if(e.length){let o=sDi(i),n=is(i)||{},r=is(a);if(!r)return a;let s=[];for(let l of e){let c=n[l],u=r[l];c===void 0?a=pAe(a,[l],void 0,t):u!==void 0?a=pAe(a,[l],c,t):s.push(iot(l,o))}s.sort((l,c)=>l.startOffset-c.startOffset),s.forEach(l=>a=Xnn(l.setting.key,i,a,t))}return a}function Xnn(a,i,e,t){let o=is(i),n=sDi(i),r=sDi(e),s=Jnn(a,n,r);return Znn(e,a,o[a],s,r,t)}function Jnn(a,i,e){let t=i.findIndex(n=>n.setting?.key===a),o=i[t-1];if(o){if(o.setting){let r=iot(o.setting.key,e);if(r)return{index:e.indexOf(r),insertAfter:!0}}else{let r=rDi(t,i);if(r){let s=iot(r.setting.key,e);if(s){let l=f1t(e.indexOf(s),e),c=mAe(i,r,i[t]);if(l){let u=mAe(e,s,l),p=g1t(c,u);return p?{index:e.indexOf(p),insertAfter:!0}:{index:e.indexOf(l),insertAfter:!1}}else{let u=mAe(e,s,e[e.length-1]),p=g1t(c,u);return p?{index:e.indexOf(p),insertAfter:!0}:{index:e.length-1,insertAfter:!0}}}}}let n=i[t+1];if(n)if(n.setting){let r=iot(n.setting.key,e);if(r)return{index:e.indexOf(r),insertAfter:!1}}else{let r=f1t(t,i);if(r){let s=iot(r.setting.key,e);if(s){let l=rDi(e.indexOf(s),e),c=mAe(i,i[t],r);if(l){let u=mAe(e,l,s),p=g1t(c.reverse(),u.reverse());return p?{index:e.indexOf(p),insertAfter:!1}:{index:e.indexOf(l),insertAfter:!0}}else{let u=mAe(e,e[0],s),p=g1t(c.reverse(),u.reverse());return p?{index:e.indexOf(p),insertAfter:!1}:{index:0,insertAfter:!1}}}}}}return{index:e.length-1,insertAfter:!0}}function Znn(a,i,e,t,o,n){let r;return t.index===-1?r=rS(a,[i],e,n):r=ern(a,i,e,t,o,n).map(s=>Jee(a,s,n)[0]),c8(a,r)}function ern(a,i,e,t,o,n){let r=`${JSON.stringify(i)}: ${JSON.stringify(e)}`,s=BCi(n,a),l=o[t.index];if(t.insertAfter){let c=[];if(l.setting)c.push({offset:l.endOffset,length:0,content:","+r});else{let u=f1t(t.index,o),p=rDi(t.index,o),h=p?.setting?.commaOffset;p&&h===void 0&&c.push({offset:p.endOffset,length:0,content:","});let g=h!==void 0&&h>l.endOffset;c.push({offset:g?h+1:l.endOffset,length:0,content:u?s+r+",":s+r})}return c}else{if(l.setting)return[{offset:l.startOffset,length:0,content:r+","}];let c=(o[t.index-1]&&!o[t.index-1].setting?s:"")+r+(f1t(t.index,o)?",":"")+s;return[{offset:l.startOffset,length:0,content:c}]}}function iot(a,i){return i.filter(e=>e.setting?.key===a)[0]}function rDi(a,i){for(let e=a-1;e>=0;e--)if(i[e].setting)return i[e]}function f1t(a,i){for(let e=a+1;e<i.length;e++)if(i[e].setting)return i[e]}function mAe(a,i,e){let t=a.indexOf(i),o=a.indexOf(e);return a.filter((n,r)=>t<r&&r<o)}function g1t(a,i){if(a.length&&i.length){let e=0;for(;e<i.length&&e<a.length;e++)if(a[e].value!==i[e].value)return i[e-1];return i[e-1]}}function sDi(a){let i=[],e=-1,t,o;return rE(a,{onObjectBegin:r=>{e++},onObjectProperty:(r,s,l)=>{e===0&&(t=s,o=r)},onObjectEnd:(r,s)=>{e--,e===0&&i.push({startOffset:t,endOffset:r+s,value:a.substring(t,r+s),setting:{key:o,commaOffset:void 0}})},onArrayBegin:(r,s)=>{e++},onArrayEnd:(r,s)=>{e--,e===0&&i.push({startOffset:t,endOffset:r+s,value:a.substring(t,r+s),setting:{key:o,commaOffset:void 0}})},onLiteralValue:(r,s,l)=>{e===0&&i.push({startOffset:t,endOffset:s+l,value:a.substring(t,s+l),setting:{key:o,commaOffset:void 0}})},onSeparator:(r,s,l)=>{if(e===0&&r===","){let c=i.length-1;for(;c>=0&&!i[c].setting;c--);let u=i[c];u&&i.splice(c,1,{startOffset:u.startOffset,endOffset:u.endOffset,value:u.value,setting:{key:u.setting.key,commaOffset:s}})}},onComment:(r,s)=>{e===0&&i.push({startOffset:r,endOffset:r+s,value:a.substring(r,r+s)})}}),i}var b1t=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(e.settings===null){this.logService.info("Initializing Profile: No settings to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.settingsResource,Ke.fromString(e.settings))}};b1t=I([m(0,gn),m(1,ge),m(2,re)],b1t);var NW=class{constructor(i,e,t){this.fileService=i;this.userDataSyncUtilService=e;this.logService=t}async getContent(i){let e=await this.getSettingsContent(i);return JSON.stringify(e)}async getSettingsContent(i){let e=await this.getLocalFileContent(i);if(e===null)return{settings:null};{let t=this.getIgnoredSettings(),o=await this.userDataSyncUtilService.resolveFormattingOptions(i.settingsResource);return{settings:aDi(e||"{}","{}",t,o)}}}async apply(i,e){let t=JSON.parse(i);if(t.settings===null){this.logService.info(`Importing Profile (${e.name}): No settings to apply...`);return}let o=await this.getLocalFileContent(e),n=await this.userDataSyncUtilService.resolveFormattingOptions(e.settingsResource),r=aDi(t.settings,o||"{}",this.getIgnoredSettings(),n);await this.fileService.writeFile(e.settingsResource,Ke.fromString(r))}getIgnoredSettings(){let i=oe.as($t.Configuration).getConfigurationProperties();return Object.keys(i).filter(t=>i[t]?.scope===2||i[t]?.scope===3||i[t]?.scope===7)}async getLocalFileContent(i){try{return(await this.fileService.readFile(i.settingsResource)).value.toString()}catch(e){if(e instanceof ua&&e.fileOperationResult===1)return null;throw e}}};NW=I([m(0,ge),m(1,iie),m(2,re)],NW);var nQ=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="settings";this.handle="settings";this.label={label:d(19526,null)};this.collapsibleState=2}async getChildren(){return[{handle:this.profile.settingsResource.toString(),resourceUri:this.profile.settingsResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:Xg,title:"",arguments:[this.profile.settingsResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(NW).getSettingsContent(this.profile)).settings!==null}async getContent(){return this.instantiationService.createInstance(NW).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.settings}};nQ=I([m(1,gt),m(2,F)],nQ);var S1t=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(e.keybindings===null){this.logService.info("Initializing Profile: No keybindings to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.keybindingsResource,Ke.fromString(e.keybindings))}};S1t=I([m(0,gn),m(1,ge),m(2,re)],S1t);var OW=class{constructor(i,e){this.fileService=i;this.logService=e}async getContent(i){let e=await this.getKeybindingsResourceContent(i);return JSON.stringify(e)}async getKeybindingsResourceContent(i){return{keybindings:await this.getKeybindingsContent(i),platform:xm}}async apply(i,e){let t=JSON.parse(i);if(t.keybindings===null){this.logService.info(`Importing Profile (${e.name}): No keybindings to apply...`);return}await this.fileService.writeFile(e.keybindingsResource,Ke.fromString(t.keybindings))}async getKeybindingsContent(i){try{return(await this.fileService.readFile(i.keybindingsResource)).value.toString()}catch(e){if(e instanceof ua&&e.fileOperationResult===1)return null;throw e}}};OW=I([m(0,ge),m(1,re)],OW);var rQ=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="keybindings";this.handle="keybindings";this.label={label:d(19524,null)};this.collapsibleState=2}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.keybindings}async getChildren(){return[{handle:this.profile.keybindingsResource.toString(),resourceUri:this.profile.keybindingsResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:Xg,title:"",arguments:[this.profile.keybindingsResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(OW).getKeybindingsResourceContent(this.profile)).keybindings!==null}async getContent(){return this.instantiationService.createInstance(OW).getContent(this.profile)}};rQ=I([m(1,gt),m(2,F)],rQ);var I1t=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.uriIdentityService=t}async initialize(i){let e=JSON.parse(i);for(let t in e.snippets){let o=this.uriIdentityService.extUri.joinPath(this.userDataProfileService.currentProfile.snippetsHome,t);await this.fileService.writeFile(o,Ke.fromString(e.snippets[t]))}}};I1t=I([m(0,gn),m(1,ge),m(2,gt)],I1t);var qN=class{constructor(i,e){this.fileService=i;this.uriIdentityService=e}async getContent(i,e){let t=await this.getSnippets(i,e);return JSON.stringify({snippets:t})}async apply(i,e){let t=JSON.parse(i);for(let o in t.snippets){let n=this.uriIdentityService.extUri.joinPath(e.snippetsHome,o);await this.fileService.writeFile(n,Ke.fromString(t.snippets[o]))}}async getSnippets(i,e){let t={},o=await this.getSnippetsResources(i,e);for(let n of o){let r=this.uriIdentityService.extUri.relativePath(i.snippetsHome,n),s=await this.fileService.readFile(n);t[r]=s.value.toString()}return t}async getSnippetsResources(i,e){let t=[],o;try{o=await this.fileService.resolve(i.snippetsHome)}catch(n){if(n instanceof ua&&n.fileOperationResult===1)return t;throw n}for(let{resource:n}of o.children||[]){if(e?.has(n))continue;let r=this.uriIdentityService.extUri.extname(n);(r===".json"||r===".code-snippets")&&t.push(n)}return t}};qN=I([m(0,ge),m(1,gt)],qN);var sQ=class{constructor(i,e,t){this.profile=i;this.instantiationService=e;this.uriIdentityService=t;this.type="snippets";this.label={label:d(19528,null)};this.collapsibleState=1;this.excludedSnippets=new xn;this.handle=this.profile.snippetsHome.toString()}async getChildren(){let i=await this.instantiationService.createInstance(qN).getSnippetsResources(this.profile),e=this;return i.map(t=>({handle:t.toString(),parent:e,resourceUri:t,collapsibleState:0,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(t)},checkbox:e.checkbox?{get isChecked(){return!e.excludedSnippets.has(t)},set isChecked(o){o?e.excludedSnippets.delete(t):e.excludedSnippets.add(t)},accessibilityInformation:{label:d(19527,null,this.uriIdentityService.extUri.basename(t))}}:void 0,command:{id:Xg,title:"",arguments:[t,void 0,void 0]}}))}async hasContent(){return(await this.instantiationService.createInstance(qN).getSnippetsResources(this.profile)).length>0}async getContent(){return this.instantiationService.createInstance(qN).getContent(this.profile,this.excludedSnippets)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.snippets}};sQ=I([m(1,F),m(2,gt)],sQ);var y1t=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(!e.tasks){this.logService.info("Initializing Profile: No tasks to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.tasksResource,Ke.fromString(e.tasks))}};y1t=I([m(0,gn),m(1,ge),m(2,re)],y1t);var FW=class{constructor(i,e){this.fileService=i;this.logService=e}async getContent(i){let e=await this.getTasksResourceContent(i);return JSON.stringify(e)}async getTasksResourceContent(i){return{tasks:await this.getTasksContent(i)}}async apply(i,e){let t=JSON.parse(i);if(!t.tasks){this.logService.info(`Importing Profile (${e.name}): No tasks to apply...`);return}await this.fileService.writeFile(e.tasksResource,Ke.fromString(t.tasks))}async getTasksContent(i){try{return(await this.fileService.readFile(i.tasksResource)).value.toString()}catch(e){if(e instanceof ua&&e.fileOperationResult===1)return null;throw e}}};FW=I([m(0,ge),m(1,re)],FW);var aQ=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="tasks";this.handle="tasks";this.label={label:d(19529,null)};this.collapsibleState=2}async getChildren(){return[{handle:this.profile.tasksResource.toString(),resourceUri:this.profile.tasksResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.settingsResource)},command:{id:Xg,title:"",arguments:[this.profile.tasksResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(FW).getTasksResourceContent(this.profile)).tasks!==null}async getContent(){return this.instantiationService.createInstance(FW).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.tasks}};aQ=I([m(1,gt),m(2,F)],aQ);var w1t=class extends k{constructor(e,t,o){super();this.channel=e;this.profile=t;this.workspace=o}get applicationShared(){return!1}async getItems(){let e={profile:this.profile,workspace:this.workspace,applicationShared:this.applicationShared},t=await this.channel.call("getItems",e);return new Map(t)}updateItems(e){let t={profile:this.profile,workspace:this.workspace,applicationShared:this.applicationShared};return e.insert&&(t.insert=Array.from(e.insert.entries())),e.delete&&(t.delete=Array.from(e.delete.values())),this.channel.call("updateItems",t)}optimize(){let e={profile:this.profile,workspace:this.workspace,applicationShared:this.applicationShared};return this.channel.call("optimize",e)}},oot=class extends w1t{constructor(e,t){super(e,t,void 0);this._onDidChangeItemsExternal=this._register(new T);this.onDidChangeItemsExternal=this._onDidChangeItemsExternal.event;this.registerListeners()}registerListeners(){this._register(this.channel.listen("onDidChangeStorage",{profile:this.profile,applicationShared:this.applicationShared})(e=>this.onDidChangeStorage(e)))}onDidChangeStorage(e){(Array.isArray(e.changed)||Array.isArray(e.deleted))&&this._onDidChangeItemsExternal.fire({changed:e.changed?new Map(e.changed):void 0,deleted:e.deleted?new Set(e.deleted):void 0})}},hAe=class extends oot{constructor(i){super(i,void 0)}async close(){this.dispose()}},gAe=class extends oot{constructor(i){super(i,void 0)}get applicationShared(){return!0}async close(){this.dispose()}},fAe=class extends oot{async close(){this.dispose()}},C1t=class extends w1t{constructor(e,t){super(e,void 0,t);this.onDidChangeItemsExternal=U.None}async close(){this.dispose()}};var x1t=class extends k{constructor(e){super();this.channel=e;this.onDidChangeItemsExternal=U.None}async getItems(){let e={profile:void 0,workspace:void 0,applicationShared:!0},t=await this.channel.call("getFallbackApplicationStorageItems",e);return new Map(t)}updateItems(){throw new Error("Not supported")}optimize(){throw new Error("Not supported")}close(){throw new Error("Not supported")}};var WW=le("IUserDataProfileStorageService"),not=class extends k{constructor(e,t){super();this.storageService=t;e&&(this.storageServicesMap=this._register(new Ot))}async readStorageData(e){return this.withProfileScopedStorageService(e,async t=>this.getItems(t,e))}async updateStorageData(e,t,o,n=0){return this.withProfileScopedStorageService(e,async r=>this.writeItems(r,t,o,n))}async withProfileScopedStorageService(e,t){if(this.storageService.hasScope(e))return t(this.storageService);let o=this.storageServicesMap?.get(e.id);if(!o){o=new lDi(this.createStorageDatabase(e)),this.storageServicesMap?.set(e.id,o);try{await o.initialize()}catch(n){throw this.storageServicesMap?.has(e.id)?this.storageServicesMap.deleteAndDispose(e.id):o.dispose(),n}}try{let n=await t(o);return await o.flush(),n}finally{this.storageServicesMap?.has(e.id)||o.dispose()}}getItems(e,t){let o=new Map,n=(r,s)=>{for(let l of e.keys(r,s))o.set(l,{value:e.get(l,r),target:s,scope:r})};return n(0,0),n(0,1),t.isDefault&&(n(-2,0),n(-2,1)),o}writeItems(e,t,o,n=0){e.storeAll(Array.from(t.entries()).map(([r,s])=>({key:r,value:s,scope:n,target:o})),!0)}};not=I([m(1,de)],not);var k1t=class extends not{constructor(e,t,o,n,r){super(e,n);this.remoteService=t;let s=t.getChannel("profileStorageListener"),l=this._register(new ue);this._onDidChange=this._register(new T({onWillAddFirstListener:()=>{l.value=s.listen("onDidChange")(c=>{r.trace("profile storage changes",c),this._onDidChange.fire({targetChanges:c.targetChanges.map(u=>iC(u,o.profilesHome.scheme)),valueChanges:c.valueChanges.map(u=>({...u,profile:iC(u.profile,o.profilesHome.scheme)}))})})},onDidRemoveLastListener:()=>l.value=void 0})),this.onDidChange=this._onDidChange.event}async createStorageDatabase(e){let t=this.remoteService.getChannel("storage");return Gke(e)?new hAe(t):new fAe(t,e)}},lDi=class extends Vde{constructor(e){super({flushInterval:100});this.profileStorageDatabase=e}async doInitialize(){let e=await this.profileStorageDatabase,t=new Gk(e);return this._register(t.onDidChangeStorage(o=>{this.emitDidChangeValue(0,o)})),this._register(ee(()=>{t.close(),t.dispose(),Sd(e)&&e.dispose()})),this.profileStorage=t,this.profileStorage.init()}getStorage(e){return e===0?this.profileStorage:void 0}getLogDetails(){}async switchToProfile(){}async switchToWorkspace(){}hasScope(){return!1}};var E1t=class{constructor(i,e,t,o,n){this.userDataProfileService=i;this.extensionManagementService=e;this.extensionGalleryService=t;this.extensionEnablementService=o;this.logService=n}async initialize(i){let e=JSON.parse(i),t=await this.extensionManagementService.getInstalled(void 0,this.userDataProfileService.currentProfile.extensionsResource),o=[],n=[];for(let s of e){let l=this.extensionEnablementService.getDisabledExtensions().some(u=>Ht(u,s.identifier)),c=t.find(u=>Ht(u.identifier,s.identifier));(!c||!c.isBuiltin&&c.preRelease!==s.preRelease)&&n.push(s),l!==!!s.disabled&&o.push({extension:s.identifier,enable:!s.disabled})}let r=t.filter(s=>!s.isBuiltin&&!e.some(({identifier:l})=>Ht(l,s.identifier)));for(let{extension:s,enable:l}of o)l?(this.logService.trace("Initializing Profile: Enabling extension...",s.id),await this.extensionEnablementService.enableExtension(s),this.logService.info("Initializing Profile: Enabled extension...",s.id)):(this.logService.trace("Initializing Profile: Disabling extension...",s.id),await this.extensionEnablementService.disableExtension(s),this.logService.info("Initializing Profile: Disabled extension...",s.id));if(n.length){let s=await this.extensionGalleryService.getExtensions(n.map(l=>({...l.identifier,version:l.version,hasPreRelease:l.version?void 0:l.preRelease})),Ie.None);await Promise.all(n.map(async l=>{let c=s.find(u=>Ht(u.identifier,l.identifier));c&&(await this.extensionManagementService.canInstall(c)===!0?(this.logService.trace("Initializing Profile: Installing extension...",c.identifier.id,c.version),await this.extensionManagementService.installFromGallery(c,{isMachineScoped:!1,donotIncludePackAndDependencies:!0,installGivenVersion:!!l.version,installPreReleaseVersion:l.preRelease,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,context:{[vH]:!0,[CM]:!0}}),this.logService.info("Initializing Profile: Installed extension...",c.identifier.id,c.version)):this.logService.info("Initializing Profile: Skipped installing extension because it cannot be installed.",c.identifier.id))}))}r.length&&await Promise.all(r.map(s=>this.extensionManagementService.uninstall(s)))}};E1t=I([m(0,gn),m(1,xs),m(2,ga),m(3,x2),m(4,re)],E1t);var $N=class{constructor(i,e,t,o,n){this.extensionManagementService=i;this.extensionGalleryService=e;this.userDataProfileStorageService=t;this.instantiationService=o;this.logService=n}async getContent(i,e){let t=await this.getLocalExtensions(i);return this.toContent(t,e)}toContent(i,e){return JSON.stringify(e?.length?i.filter(t=>!e.includes(t.identifier.id.toLowerCase())):i)}async apply(i,e,t,o){return this.withProfileScopedServices(e,async n=>{let r=await this.getProfileExtensions(i),s=await this.extensionManagementService.getInstalled(void 0,e.extensionsResource),l=[],c=[];for(let p of r){let h=n.getDisabledExtensions().some(f=>Ht(f,p.identifier)),g=s.find(f=>Ht(f.identifier,p.identifier));(!g||!g.isBuiltin&&g.preRelease!==p.preRelease)&&c.push(p),h!==!!p.disabled&&l.push({extension:p.identifier,enable:!p.disabled})}let u=s.filter(p=>!p.isBuiltin&&!r.some(({identifier:h})=>Ht(h,p.identifier))&&!p.isApplicationScoped);for(let{extension:p,enable:h}of l)h?(this.logService.trace(`Importing Profile (${e.name}): Enabling extension...`,p.id),await n.enableExtension(p),this.logService.info(`Importing Profile (${e.name}): Enabled extension...`,p.id)):(this.logService.trace(`Importing Profile (${e.name}): Disabling extension...`,p.id),await n.disableExtension(p),this.logService.info(`Importing Profile (${e.name}): Disabled extension...`,p.id));if(c.length){this.logService.info(`Importing Profile (${e.name}): Started installing extensions.`);let p=await this.extensionGalleryService.getExtensions(c.map(g=>({...g.identifier,version:g.version,hasPreRelease:g.version?void 0:g.preRelease})),Ie.None),h=[];if(await Promise.all(c.map(async g=>{let f=p.find(v=>Ht(v.identifier,g.identifier));f&&(await this.extensionManagementService.canInstall(f)===!0?h.push({extension:f,options:{isMachineScoped:!1,donotIncludePackAndDependencies:!0,installGivenVersion:!!g.version,installPreReleaseVersion:g.preRelease,profileLocation:e.extensionsResource,context:{[vH]:!0}}}):this.logService.info(`Importing Profile (${e.name}): Skipped installing extension because it cannot be installed.`,f.identifier.id))})),h.length)if(o){await this.extensionManagementService.requestPublisherTrust(h);for(let g of h){if(o.isCancellationRequested)return;t?.(d(19522,null,g.extension.displayName??g.extension.identifier.id)),await this.extensionManagementService.installFromGallery(g.extension,g.options)}}else await this.extensionManagementService.installGalleryExtensions(h);this.logService.info(`Importing Profile (${e.name}): Finished installing extensions.`)}u.length&&await Promise.all(u.map(p=>this.extensionManagementService.uninstall(p)))})}async copy(i,e,t){await this.extensionManagementService.copyExtensions(i.extensionsResource,e.extensionsResource);let o=await this.withProfileScopedServices(i,async n=>n.getDisabledExtensions());if(t){let n=await this.extensionManagementService.getInstalled(1,e.extensionsResource);for(let r of n)o.push(r.identifier)}await this.withProfileScopedServices(e,async n=>Promise.all(o.map(r=>n.disableExtension(r))))}async getLocalExtensions(i){return this.withProfileScopedServices(i,async e=>{let t=new Map,o=await this.extensionManagementService.getInstalled(void 0,i.extensionsResource),n=e.getDisabledExtensions();for(let r of o){let{identifier:s,preRelease:l}=r,c=n.some(h=>Ht(h,s));if(r.isBuiltin&&!c||!r.isBuiltin&&!r.identifier.uuid)continue;t.get(s.id.toLowerCase())?.disabled&&t.delete(s.id.toLowerCase());let p={identifier:s,displayName:r.manifest.displayName};c&&(p.disabled=!0),!r.isBuiltin&&r.pinned&&(p.version=r.manifest.version),!p.version&&l&&(p.preRelease=!0),p.applicationScoped=r.isApplicationScoped,t.set(p.identifier.id.toLowerCase(),p)}return[...t.values()]})}async getProfileExtensions(i){return JSON.parse(i)}async withProfileScopedServices(i,e){return this.userDataProfileStorageService.withProfileScopedStorageService(i,async t=>{let o=new O,n=o.add(this.instantiationService.createChild(new Po([de,t]))),r=o.add(n.createInstance(iq));try{return await e(r)}finally{o.dispose()}})}};$N=I([m(0,Dd),m(1,ga),m(2,WW),m(3,F),m(4,re)],$N);var bAe=class{constructor(){this.type="extensions";this.handle="extensions";this.label={label:d(19521,null)};this.collapsibleState=2;this.contextValue="extensions";this.excludedExtensions=new Set}async getChildren(){let i=(await this.getExtensions()).sort((t,o)=>(t.displayName??t.identifier.id).localeCompare(o.displayName??o.identifier.id)),e=this;return i.map(t=>({...t,handle:t.identifier.id.toLowerCase(),parent:this,label:{label:t.displayName||t.identifier.id},description:t.applicationScoped?d(19519,null):void 0,collapsibleState:0,checkbox:e.checkbox?{get isChecked(){return!e.excludedExtensions.has(t.identifier.id.toLowerCase())},set isChecked(o){o?e.excludedExtensions.delete(t.identifier.id.toLowerCase()):e.excludedExtensions.add(t.identifier.id.toLowerCase())},tooltip:d(19520,null,t.displayName||t.identifier.id),accessibilityInformation:{label:d(19520,null,t.displayName||t.identifier.id)}}:void 0,themeIcon:L.extensions,command:{id:"extension.open",title:"",arguments:[t.identifier.id,void 0,!0]}}))}async hasContent(){return(await this.getExtensions()).length>0}},lQ=class extends bAe{constructor(e,t){super();this.profile=e;this.instantiationService=t}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.extensions}getExtensions(){return this.instantiationService.createInstance($N).getLocalExtensions(this.profile)}async getContent(){return this.instantiationService.createInstance($N).getContent(this.profile,[...this.excludedExtensions.values()])}};lQ=I([m(1,F)],lQ);var vAe=class extends bAe{constructor(e,t){super();this.content=e;this.instantiationService=t}isFromDefaultProfile(){return!1}getExtensions(){return this.instantiationService.createInstance($N).getProfileExtensions(this.content)}async getContent(){let e=this.instantiationService.createInstance($N),t=await e.getProfileExtensions(this.content);return e.toContent(t,[...this.excludedExtensions.values()])}};vAe=I([m(1,F)],vAe);var T1t=class{constructor(i){this.storageService=i}async initialize(i){let e=JSON.parse(i),t=Object.keys(e.storage);if(t.length){let o=[];for(let n of t)o.push({key:n,value:e.storage[n],scope:0,target:0});this.storageService.storeAll(o,!0)}}};T1t=I([m(0,de)],T1t);var cQ=class{constructor(i,e,t){this.storageService=i;this.userDataProfileStorageService=e;this.logService=t}async getContent(i){let e=await this.getGlobalState(i);return JSON.stringify(e)}async apply(i,e){let t=JSON.parse(i);await this.writeGlobalState(t,e)}async getGlobalState(i){let e={},t=await this.userDataProfileStorageService.readStorageData(i);for(let[o,n]of t)n.value!==void 0&&n.target===0&&(e[o]=n.value);return{storage:e}}async writeGlobalState(i,e){let t=Object.keys(i.storage);if(t.length){let o=new Map,n=[...this.storageService.keys(-1,1),...this.storageService.keys(1,0),...this.storageService.keys(1,1)];for(let r of t)n.includes(r)?this.logService.info(`Importing Profile (${e.name}): Ignoring global state key '${r}' because it is not a profile key.`):o.set(r,i.storage[r]);await this.userDataProfileStorageService.updateStorageData(e,o,0)}}};cQ=I([m(0,de),m(1,WW),m(2,re)],cQ);var IAe=class{constructor(i,e){this.resource=i;this.uriIdentityService=e;this.type="globalState";this.handle="globalState";this.label={label:d(19523,null)};this.collapsibleState=1}async getChildren(){return[{handle:this.resource.toString(),resourceUri:this.resource,collapsibleState:0,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.resource)},parent:this,command:{id:Xg,title:"",arguments:[this.resource,void 0,void 0]}}]}},SAe=class extends IAe{constructor(e,t,o,n){super(t,o);this.profile=e;this.instantiationService=n}async hasContent(){let e=await this.instantiationService.createInstance(cQ).getGlobalState(this.profile);return Object.keys(e.storage).length>0}async getContent(){return this.instantiationService.createInstance(cQ).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.globalState}};SAe=I([m(2,gt),m(3,F)],SAe);var _1t=class extends IAe{constructor(e,t,o){super(t,o);this.content=e}async getContent(){return this.content}isFromDefaultProfile(){return!1}};_1t=I([m(2,gt)],_1t);var rot=class{constructor(i){this.type=1,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=i}},nie=class{constructor(i){this.type=2,this.ctime=Date.now(),this.mtime=Date.now(),this.size=0,this.name=i,this.entries=new Map}},PU=class extends k{constructor(){super(...arguments);this.memoryFdCounter=0;this.fdMemory=new Map;this._onDidChangeCapabilities=this._register(new T);this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this._capabilities=525318;this.root=new nie("");this._onDidChangeFile=this._register(new T);this.onDidChangeFile=this._onDidChangeFile.event;this._bufferedChanges=[]}get capabilities(){return this._capabilities}setReadOnly(e){let t=!!(this._capabilities&2048);e!==t&&(this._capabilities=525314|(e?2048:0),this._onDidChangeCapabilities.fire())}async stat(e){return this._lookup(e,!1)}async readdir(e){let t=this._lookupAsDirectory(e,!1),o=[];return t.entries.forEach((n,r)=>o.push([r,n.type])),o}async readFile(e){let t=this._lookupAsFile(e,!1).data;if(t)return t;throw Ys("file not found","EntryNotFound")}readFileStream(e){let t=this._lookupAsFile(e,!1).data,o=Ty(n=>Ke.concat(n.map(r=>Ke.wrap(r))).buffer);return o.end(t),o}async writeFile(e,t,o){let n=Be(e),r=this._lookupParentDirectory(e),s=r.entries.get(n);if(s instanceof nie)throw Ys("file is directory","EntryIsADirectory");if(!s&&!o.create)throw Ys("file not found","EntryNotFound");if(s&&o.create&&!o.overwrite)throw Ys("file exists already","EntryExists");if(s||(s=new rot(n),r.entries.set(n,s),this._fireSoon({type:1,resource:e})),s.mtime=Date.now(),o.append){s.size+=t.byteLength;let l=s.data??new Uint8Array(0),c=new Uint8Array(l.byteLength+t.byteLength);c.set(l,0),c.set(t,l.byteLength),s.data=c}else s.size=t.byteLength,s.data=t;this._fireSoon({type:0,resource:e})}open(e,t){let o=this._lookup(e,!0),n=fYi(t),r=n&&!!t.append;if(o){if(o instanceof nie)throw Ys("file is directory","EntryIsADirectory")}else{if(!n)throw Ys("file not found","EntryNotFound");let l=Be(e),c=this._lookupParentDirectory(e);o=new rot(l),o.data=new Uint8Array(0),c.entries.set(l,o),this._fireSoon({type:1,resource:e})}o.data||(o.data=new Uint8Array(0));let s=this.memoryFdCounter++;return this.fdMemory.set(s,{file:o,resource:e,write:n,append:r}),Promise.resolve(s)}close(e){let t=this.fdMemory.get(e);return t?.write&&(t.file.mtime=Date.now(),t.file.size=t.file.data?.byteLength??0,this._fireSoon({type:0,resource:t.resource})),this.fdMemory.delete(e),Promise.resolve()}read(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Ys("No file with that descriptor open","Unavailable");if(!s.file.data)return Promise.resolve(0);let l=Ke.wrap(s.file.data).slice(t,t+r);return o.set(l.buffer,n),Promise.resolve(l.byteLength)}write(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Ys("No file with that descriptor open","Unavailable");let l=Ke.wrap(o).slice(n,n+r);s.file.data??=new Uint8Array(0);let c=s.append?s.file.data.byteLength:t,u=c+l.byteLength;if(u>s.file.data.byteLength){let p=new Uint8Array(u);p.set(s.file.data,0),s.file.data=p}return s.file.data.set(l.buffer,c),Promise.resolve(l.byteLength)}async rename(e,t,o){if(!o.overwrite&&this._lookup(t,!0))throw Ys("file exists already","EntryExists");let n=this._lookup(e,!1),r=this._lookupParentDirectory(e),s=this._lookupParentDirectory(t),l=Be(t);r.entries.delete(n.name),n.name=l,s.entries.set(l,n),this._fireSoon({type:2,resource:e},{type:1,resource:t})}async delete(e,t){let o=ai(e),n=Be(e),r=this._lookupAsDirectory(o,!1);r.entries.delete(n)&&(r.mtime=Date.now(),r.size-=1,this._fireSoon({type:0,resource:o},{resource:e,type:2}))}async mkdir(e){if(this._lookup(e,!0))throw Ys("file exists already","EntryExists");let t=Be(e),o=ai(e),n=this._lookupAsDirectory(o,!1),r=new nie(t);n.entries.set(r.name,r),n.mtime=Date.now(),n.size+=1,this._fireSoon({type:0,resource:o},{type:1,resource:e})}_lookup(e,t){let o=e.path.split("/"),n=this.root;for(let r of o){if(!r)continue;let s;if(n instanceof nie&&(s=n.entries.get(r)),!s){if(t)return;throw Ys("file not found","EntryNotFound")}n=s}return n}_lookupAsDirectory(e,t){let o=this._lookup(e,t);if(o instanceof nie)return o;throw Ys("file not a directory","EntryNotADirectory")}_lookupAsFile(e,t){let o=this._lookup(e,t);if(o instanceof rot)return o;throw Ys("file is a directory","EntryIsADirectory")}_lookupParentDirectory(e){let t=ai(e);return this._lookupAsDirectory(t,!1)}watch(e,t){return k.None}_fireSoon(...e){this._bufferedChanges.push(...e),this._fireSoonHandle&&clearTimeout(this._fireSoonHandle),this._fireSoonHandle=setTimeout(()=>{this._onDidChangeFile.fire(this._bufferedChanges),this._bufferedChanges.length=0},5)}dispose(){super.dispose(),this.fdMemory.clear()}};function trn(a){let i=a;return!!(i&&typeof i=="object"&&i.name&&typeof i.name=="string"&&(bn(i.icon)||typeof i.icon=="string")&&(bn(i.settings)||typeof i.settings=="string")&&(bn(i.globalState)||typeof i.globalState=="string")&&(bn(i.extensions)||typeof i.extensions=="string"))}var sot=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.instantiationService=e;this.userDataProfileService=t;this.userDataProfileManagementService=o;this.userDataProfilesService=n;this.extensionService=r;this.quickInputService=s;this.progressService=l;this.dialogService=c;this.clipboardService=u;this.openerService=p;this.requestService=h;this.productService=g;this.uriIdentityService=f;this.profileContentHandlers=new Map;this.registerProfileContentHandler(Q.file,this.fileUserDataProfileContentHandler=e.createInstance(aot))}registerProfileContentHandler(e,t){if(this.profileContentHandlers.has(e))throw new Error(`Profile content handler with id '${e}' already registered.`);return this.profileContentHandlers.set(e,t),ee(()=>this.unregisterProfileContentHandler(e))}unregisterProfileContentHandler(e){this.profileContentHandlers.delete(e)}async createFromProfile(e,t,o){let n=new O,r;n.add(o.onCancellationRequested(()=>r.cancel()));let s;return this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async l=>{let c=u=>l.report({message:d(19533,null,u)});r=Hn(async u=>{let h=await n.add(this.instantiationService.createInstance(pge,e,{...t?.resourceTypeFlags,extensions:!1})).getProfileTemplate(t.name??e.name,t?.icon);s=await this.getProfileToImport({...h,name:t.name??h.name},!!t.transient,t),s&&(u.isCancellationRequested||await this.applyProfileTemplate(h,s,t,c,u))});try{await r,s&&(t?.resourceTypeFlags?.extensions??!0)&&(c(d(19544,null)),await this.instantiationService.createInstance($N).copy(e,s,!1))}catch{s&&(await this.userDataProfilesService.removeProfile(s),s=void 0)}return s},()=>r.cancel()).finally(()=>n.dispose())}async createProfileFromTemplate(e,t,o){let n=new O,r;n.add(o.onCancellationRequested(()=>r.cancel()));let s;return this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async l=>{let c=u=>l.report({message:d(19533,null,u)});r=Hn(async u=>{s=await this.getProfileToImport({...e,name:t.name??e.name},!!t.transient,t),s&&(u.isCancellationRequested||await this.applyProfileTemplate(e,s,t,c,u))});try{await r}catch{s&&(await this.userDataProfilesService.removeProfile(s),s=void 0)}return s},()=>r.cancel()).finally(()=>n.dispose())}async applyProfileTemplate(e,t,o,n,r){e.settings&&(o.resourceTypeFlags?.settings??!0)&&!t.useDefaultFlags?.settings&&(n(d(19537,null)),await this.instantiationService.createInstance(NW).apply(e.settings,t)),!r.isCancellationRequested&&(e.keybindings&&(o.resourceTypeFlags?.keybindings??!0)&&!t.useDefaultFlags?.keybindings&&(n(d(19534,null)),await this.instantiationService.createInstance(OW).apply(e.keybindings,t)),!r.isCancellationRequested&&(e.tasks&&(o.resourceTypeFlags?.tasks??!0)&&!t.useDefaultFlags?.tasks&&(n(d(19536,null)),await this.instantiationService.createInstance(FW).apply(e.tasks,t)),!r.isCancellationRequested&&(e.snippets&&(o.resourceTypeFlags?.snippets??!0)&&!t.useDefaultFlags?.snippets&&(n(d(19535,null)),await this.instantiationService.createInstance(qN).apply(e.snippets,t)),!r.isCancellationRequested&&(e.globalState&&!t.useDefaultFlags?.globalState&&(n(d(19530,null)),await this.instantiationService.createInstance(cQ).apply(e.globalState,t)),!r.isCancellationRequested&&e.extensions&&(o.resourceTypeFlags?.extensions??!0)&&!t.useDefaultFlags?.extensions&&(n(d(19544,null)),await this.instantiationService.createInstance($N).apply(e.extensions,t,n,r))))))}async exportProfile(e,t){let o=new O;try{let n=o.add(this.instantiationService.createInstance(pge,e,t));await this.doExportProfile(n,15)}finally{o.dispose()}}async createTroubleshootProfile(){let e=this.instantiationService.createInstance(pge,this.userDataProfileService.currentProfile,void 0);try{let t=await e.getProfileTemplate(d(19563,null),void 0);await this.progressService.withProgress({location:15,delay:1e3,sticky:!0},async o=>{let n=s=>o.report({message:d(19564,null,s)}),r=await this.doCreateProfile(t,!0,!1,{useDefaultFlags:this.userDataProfileService.currentProfile.useDefaultFlags},n);r&&(n(d(19553,null)),await this.instantiationService.createInstance($N).copy(this.userDataProfileService.currentProfile,r,!0),n(d(19562,null)),await this.userDataProfileManagementService.switchProfile(r))})}finally{e.dispose()}}async doExportProfile(e,t){let o=await e.getProfileToExport();if(!o)return;let n=new O;try{await this.progressService.withProgress({location:t,title:d(19552,null,z0.value)},async r=>{let s=await this.pickProfileContentHandler(o.name);if(!s)return;let l=this.profileContentHandlers.get(s);if(!l)return;let c=await l.saveProfile(o.name.replace("/","-"),JSON.stringify(o),Ie.None);if(!c)return;let u=d(19541,null,o.name);if(l.extensionId){let p=[],h=this.productService.webUrl?`${this.productService.webUrl}/${YYe}/${s}/${c.id}`:Oao(`/${s}/${c.id}`,this.productService).toString();p.push({label:d(19532,null),run:()=>this.clipboardService.writeText(h)}),this.productService.webUrl?p.push({label:d(19547,null),run:async()=>{await this.openerService.open(h)}}):p.push({label:d(19548,null,l.name),run:async()=>{await this.openerService.open(c.link.toString())}}),await this.dialogService.prompt({type:wt.Info,message:u,buttons:p,cancelButton:d(19531,null)})}else await this.dialogService.info(u)})}finally{n.dispose()}}async resolveProfileTemplate(e,t){let o=await this.resolveProfileContent(e);if(o===null)return null;let n;try{n=JSON.parse(o)}catch{throw new Error(d(19545,null))}return trn(n)?(t?.name&&(n.name=t.name),t?.icon&&(n.icon=t.icon),t?.resourceTypeFlags?.settings===!1&&(n.settings=void 0),t?.resourceTypeFlags?.keybindings===!1&&(n.keybindings=void 0),t?.resourceTypeFlags?.snippets===!1&&(n.snippets=void 0),t?.resourceTypeFlags?.tasks===!1&&(n.tasks=void 0),t?.resourceTypeFlags?.globalState===!1&&(n.globalState=void 0),t?.resourceTypeFlags?.extensions===!1&&(n.extensions=void 0),n):null}async doCreateProfile(e,t,o,n,r){let s=await this.getProfileToImport(e,t,n);if(s)return e.settings&&!s.useDefaultFlags?.settings&&(r(d(19556,null)),await this.instantiationService.createInstance(NW).apply(e.settings,s)),e.keybindings&&!s.useDefaultFlags?.keybindings&&(r(d(19555,null)),await this.instantiationService.createInstance(OW).apply(e.keybindings,s)),e.tasks&&!s.useDefaultFlags?.tasks&&(r(d(19558,null)),await this.instantiationService.createInstance(FW).apply(e.tasks,s)),e.snippets&&!s.useDefaultFlags?.snippets&&(r(d(19557,null)),await this.instantiationService.createInstance(qN).apply(e.snippets,s)),e.globalState&&!s.useDefaultFlags?.globalState&&(r(d(19554,null)),await this.instantiationService.createInstance(cQ).apply(e.globalState,s)),e.extensions&&o&&!s.useDefaultFlags?.extensions&&(r(d(19553,null)),await this.instantiationService.createInstance($N).apply(e.extensions,s)),s}async resolveProfileContent(e){if(await this.fileUserDataProfileContentHandler.canHandle(e))return this.fileUserDataProfileContentHandler.readProfile(e,Ie.None);if(pDe(e)){let o,n;e.authority===YYe?(n=this.uriIdentityService.extUri.basename(e),o=this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(e))):(o=e.authority.substring(fSi.length),n=A.parse(e.path.substring(1))),await this.extensionService.activateByEvent(`onProfile:${o}`);let r=this.profileContentHandlers.get(o);if(r)return r.readProfile(n,Ie.None)}await this.extensionService.activateByEvent("onProfile");for(let o of this.profileContentHandlers.values()){let n=await o.readProfile(e,Ie.None);if(n!==null)return n}let t=await this.requestService.request({type:"GET",url:e.toString(!0),callSite:"userDataProfileImportExportService.resolveContent"},Ie.None);if(t.res.statusCode===200)return await jD(t);{let o=await jD(t);throw new Error(`Failed to get profile from URL: ${e.toString()}. Status code: ${t.res.statusCode}. Message: ${o}`)}}async pickProfileContentHandler(e){if(await this.extensionService.activateByEvent("onProfile"),this.profileContentHandlers.size===1)return this.profileContentHandlers.keys().next().value;let t=[];for(let[n,r]of this.profileContentHandlers)t.push({id:n,label:r.name,description:r.description});return(await this.quickInputService.pick(t.reverse(),{title:d(19561,null,e),hideInput:!0}))?.id}async getProfileToImport(e,t,o){let n=e.name,r=this.userDataProfilesService.profiles.find(s=>s.name===n);if(r){if(t)return this.userDataProfilesService.createNamedProfile(`${n} ${this.getProfileNameIndex(n)}`,{...o,transient:t});let{confirmed:s}=await this.dialogService.confirm({type:wt.Info,message:d(19550,null,n),primaryButton:d(19549,null)});return s?r.isDefault?r:this.userDataProfilesService.updateProfile(r,o):void 0}else return this.userDataProfilesService.createNamedProfile(n,{...o,transient:t})}getProfileNameIndex(e){let t=new RegExp(`${Ss(e)}\\s(\\d+)`),o=0;for(let n of this.userDataProfilesService.profiles){let r=t.exec(n.name),s=r?parseInt(r[1]):0;o=s>o?s:o}return o+1}};sot=I([m(0,F),m(1,gn),m(2,s_),m(3,hn),m(4,lt),m(5,$e),m(6,Go),m(7,ct),m(8,Bi),m(9,Je),m(10,Ra),m(11,Ze),m(12,gt)],sot);var aot=class{constructor(i,e,t,o,n){this.fileDialogService=i;this.uriIdentityService=e;this.fileService=t;this.productService=o;this.textFileService=n;this.name=d(19546,null);this.description=d(19542,null)}async saveProfile(i,e,t){let o=await this.fileDialogService.showSaveDialog({title:d(19538,null),filters:JYe,defaultUri:this.uriIdentityService.extUri.joinPath(await this.fileDialogService.defaultFilePath(),`${i}.${XYe}`)});return o?(await this.textFileService.create([{resource:o,value:e,options:{overwrite:!0}}]),{link:o,id:o.toString()}):null}async canHandle(i){return i.scheme!==Q.http&&i.scheme!==Q.https&&i.scheme!==this.productService.urlProtocol&&await this.fileService.canHandleResource(i)}async readProfile(i,e){return await this.canHandle(i)?(await this.fileService.readFile(i,void 0,e)).value.toString():null}async selectProfile(){let i=await this.fileDialogService.showOpenDialog({canSelectFolders:!1,canSelectFiles:!0,canSelectMany:!1,filters:JYe,title:d(19560,null)});return i?i[0]:null}};aot=I([m(0,nn),m(1,gt),m(2,ge),m(3,Ze),m(4,Uo)],aot);var uge="userdataprofileexport",ibo="userdataprofileexportpreview",lot=class extends k{constructor(e){super();this.quickInputService=e;this._onDidChangeRoots=this._register(new T);this.onDidChangeRoots=this._onDidChangeRoots.event;this.roots=[]}async getChildren(e){if(e){let t=await e.getChildren();if(t)for(let o of t)o.parent.checkbox&&o.checkbox&&(o.checkbox.isChecked=o.parent.checkbox.isChecked&&o.checkbox.isChecked);return t}else return this.rootsPromise=void 0,this._onDidChangeRoots.fire(),this.getRoots()}getRoots(){return this.rootsPromise||(this.rootsPromise=(async()=>{this.roots=await this.fetchRoots();for(let e of this.roots){let t=yr(e.label.label)?e.label.label.value:e.label.label;e.checkbox={isChecked:!e.isFromDefaultProfile(),tooltip:d(19559,null,t),accessibilityInformation:{label:d(19559,null,t)}},e.isFromDefaultProfile()&&(e.description=d(19543,null))}return this.roots})()),this.rootsPromise}isEnabled(e){return e!==void 0?this.roots.some(t=>t.type===e&&this.isSelected(t)):this.roots.some(t=>this.isSelected(t))}async getProfileTemplate(e,t){let o=await this.getRoots(),n,r,s,l,c,u;for(let p of o)this.isSelected(p)&&(p instanceof nQ?n=await p.getContent():p instanceof rQ?r=await p.getContent():p instanceof aQ?s=await p.getContent():p instanceof sQ?l=await p.getContent():p instanceof bAe?c=await p.getContent():p instanceof IAe&&(u=await p.getContent()));return{name:e,icon:t,settings:n,keybindings:r,tasks:s,snippets:l,extensions:c,globalState:u}}isSelected(e){return e.checkbox?e.checkbox.isChecked||!!e.children?.some(t=>t.checkbox?.isChecked):!0}};lot=I([m(0,$e)],lot);var pge=class extends lot{constructor(e,t,o,n,r){super(o);this.profile=e;this.exportFlags=t;this.fileService=n;this.instantiationService=r;this.disposables=this._register(new O)}async fetchRoots(){this.disposables.clear(),this.disposables.add(this.fileService.registerProvider(uge,this._register(new PU)));let e=this._register(new PU);this.disposables.add(this.fileService.registerProvider(ibo,e));let t=[],o=this.createExportPreviewProfile(this.profile);if(this.exportFlags?.settings??!0){let n=this.instantiationService.createInstance(NW),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(nQ,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.keybindings??!0){let n=this.instantiationService.createInstance(OW),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(rQ,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.snippets??!0){let n=this.instantiationService.createInstance(qN),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(sQ,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.tasks??!0){let n=this.instantiationService.createInstance(FW),r=await n.getContent(this.profile);await n.apply(r,o);let s=this.instantiationService.createInstance(aQ,o);await s.hasContent()&&t.push(s)}if(this.exportFlags?.globalState??!0){let n=Ve(o.globalStorageHome,"globalState.json").with({scheme:ibo}),r=this.instantiationService.createInstance(SAe,o,n),s=await r.getContent();s&&(await this.fileService.writeFile(n,Ke.fromString(JSON.stringify(JSON.parse(s),null,"	"))),t.push(r))}if(this.exportFlags?.extensions??!0){let n=this.instantiationService.createInstance(lQ,o);await n.hasContent()&&t.push(n)}return e.setReadOnly(!0),t}createExportPreviewProfile(e){return{id:e.id,name:e.name,location:e.location,isDefault:e.isDefault,icon:e.icon,globalStorageHome:e.globalStorageHome,settingsResource:e.settingsResource.with({scheme:uge}),keybindingsResource:e.keybindingsResource.with({scheme:uge}),tasksResource:e.tasksResource.with({scheme:uge}),mcpResource:e.mcpResource.with({scheme:uge}),snippetsHome:e.snippetsHome.with({scheme:uge}),promptsHome:e.promptsHome.with({scheme:uge}),extensionsResource:e.extensionsResource,cacheHome:e.cacheHome,agentPluginsHome:e.agentPluginsHome,useDefaultFlags:e.useDefaultFlags,isTransient:e.isTransient}}async getProfileToExport(){let e=this.profile.name;return this.profile.isDefault&&(e=await this.quickInputService.input({placeHolder:d(19539,null),title:d(19540,null),async validateInput(t){if(!t.trim())return d(19551,null)}}),!e)?null:super.getProfileTemplate(e,this.profile.icon)}};pge=I([m(2,$e),m(3,ge),m(4,F)],pge);Ce(MH,sot,1);var cot=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.userDataProfilesService=e;this.userDataProfileService=t;this.hostService=o;this.dialogService=n;this.workspaceContextService=r;this.extensionService=s;this.environmentService=l;this.productService=c;this.requestService=u;this.configurationService=p;this.uriIdentityService=h;this.logService=g;this._register(t.onDidChangeCurrentProfile(f=>this.onDidChangeCurrentProfile(f))),this._register(e.onDidChangeProfiles(f=>{if(f.removed.some(b=>b.id===this.userDataProfileService.currentProfile.id)){let b=this.getProfileToUseForCurrentWorkspace();this.switchProfile(b),this.changeCurrentProfile(b,d(19569,null));return}let v=f.updated.find(b=>this.userDataProfileService.currentProfile.id===b.id);if(v){let b=this.getProfileToUseForCurrentWorkspace();b?.id!==v.id?(this.switchProfile(b),this.changeCurrentProfile(b,d(19570,null))):this.changeCurrentProfile(v,d(19571,null))}}))}async onDidChangeCurrentProfile(e){e.previous.isTransient&&await this.userDataProfilesService.cleanUpTransientProfiles()}getWorkspaceUri(){let e=this.workspaceContextService.getWorkspace();return e.configuration??e.folders[0]?.uri}getProfileToUseForCurrentWorkspace(){let e=this.getWorkspaceUri();if(e){let t=this.userDataProfilesService.profiles.find(o=>o.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,e)));if(t)return t}else{let t=this.userDataProfilesService.profiles.find(o=>o.id===this.userDataProfileService.currentProfile.id);if(t)return t}return this.getDefaultProfileToUse()}getDefaultProfileToUse(){let e=this.configurationService.getValue(fN);if(e){let t=this.userDataProfilesService.profiles.find(o=>o.name===e);if(t)return t}return this.userDataProfilesService.defaultProfile}async createProfile(e,t){return this.userDataProfilesService.createNamedProfile(e,t)}async createAndEnterProfile(e,t){let o=await this.userDataProfilesService.createNamedProfile(e,t,pf(this.workspaceContextService.getWorkspace()));return await this.changeCurrentProfile(o),o}async createAndEnterTransientProfile(){let e=await this.userDataProfilesService.createTransientProfile(pf(this.workspaceContextService.getWorkspace()));return await this.changeCurrentProfile(e),e}async updateProfile(e,t){if(!this.userDataProfilesService.profiles.some(n=>n.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(e.isDefault)throw new Error(d(19566,null));return await this.userDataProfilesService.updateProfile(e,t)}async removeProfile(e){if(!this.userDataProfilesService.profiles.some(t=>t.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(e.isDefault)throw new Error(d(19565,null));await this.userDataProfilesService.removeProfile(e)}async switchProfile(e){if(!this.userDataProfilesService.profiles.some(n=>n.id===e.id))throw new Error(`Profile ${e.name} does not exist`);if(this.userDataProfileService.currentProfile.id===e.id)return;let t=this.getWorkspaceUri();if(t&&e.workspaces?.some(n=>this.uriIdentityService.extUri.isEqual(n,t)))return;let o=pf(this.workspaceContextService.getWorkspace());await this.userDataProfilesService.setProfileForWorkspace(o,e),u4(o)&&await this.changeCurrentProfile(e)}async getBuiltinProfileTemplates(){if(this.productService.profileTemplatesUrl)try{let e=await this.requestService.request({type:"GET",url:this.productService.profileTemplatesUrl,callSite:"userDataProfileManagement.getProfileTemplates"},Ie.None);if(e.res.statusCode===200)return await Th(e)||[];this.logService.error("Could not get profile templates.",e.res.statusCode)}catch(e){this.logService.error(e)}return[]}async changeCurrentProfile(e,t){let o=!!this.environmentService.remoteAuthority,n=this.userDataProfileService.currentProfile.id!==e.id||!Qi(this.userDataProfileService.currentProfile.useDefaultFlags,e.useDefaultFlags);if(n&&!o&&!await this.extensionService.stopExtensionHosts(d(19572,null)))throw this.userDataProfilesService.profiles.some(r=>r.id===this.userDataProfileService.currentProfile.id)&&await this.userDataProfilesService.setProfileForWorkspace(pf(this.workspaceContextService.getWorkspace()),this.userDataProfileService.currentProfile),new qi;if(await this.userDataProfileService.updateCurrentProfile(e),n)if(o){let{confirmed:r}=await this.dialogService.confirm({message:t??d(19568,null),primaryButton:d(19567,null)});r&&await this.hostService.reload()}else await this.extensionService.startExtensionHosts()}};cot=I([m(0,hn),m(1,gn),m(2,ti),m(3,ct),m(4,Ae),m(5,lt),m(6,Mt),m(7,Ze),m(8,Ra),m(9,B),m(10,gt),m(11,re)],cot);Ce(s_,cot,0);function obo(a){return a.toJSON()}var D1t=class{constructor(i){this._uriTransformer=i}transformIncoming(i){let e=this._uriTransformer.transformIncoming(i);return e===i?i:obo(A.from(e))}transformOutgoing(i){let e=this._uriTransformer.transformOutgoing(i);return e===i?i:obo(A.from(e))}transformOutgoingURI(i){let e=this._uriTransformer.transformOutgoing(i);return e===i?i:A.from(e)}transformOutgoingScheme(i){return this._uriTransformer.transformOutgoingScheme(i)}},R1t=new class{transformIncoming(a){return a}transformOutgoing(a){return a}transformOutgoingURI(a){return a}transformOutgoingScheme(a){return a}};function cDi(a,i,e,t){if(!a||t>200)return null;if(typeof a=="object"){if(a.$mid===1)return e?A.revive(i.transformIncoming(a)):i.transformIncoming(a);if(a instanceof Ke)return null;for(let o in a)if(Object.hasOwnProperty.call(a,o)){let n=cDi(a[o],i,e,t+1);n!==null&&(a[o]=n)}}return null}function mge(a,i){let e=cDi(a,i,!1,0);return e===null?a:e}function L1t(a,i){let e=cDi(a,i,!0,0);return e===null?a:e}var yAe=class extends k{constructor(e,t,o){super();this.profilesHome=t;this.channel=o;this._profiles=[];this._onDidChangeProfiles=this._register(new T);this.onDidChangeProfiles=this._onDidChangeProfiles.event;this._profiles=e.map(n=>iC(n,this.profilesHome.scheme)),this._register(this.channel.listen("onDidChangeProfiles")(n=>{let r=n.added.map(c=>iC(c,this.profilesHome.scheme)),s=n.removed.map(c=>iC(c,this.profilesHome.scheme)),l=n.updated.map(c=>iC(c,this.profilesHome.scheme));this._profiles=n.all.map(c=>iC(c,this.profilesHome.scheme)),this._onDidChangeProfiles.fire({added:r,removed:s,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,t,o){let n=await this.channel.call("createNamedProfile",[e,t,o]);return iC(n,this.profilesHome.scheme)}async createProfile(e,t,o,n){let r=await this.channel.call("createProfile",[e,t,o,n]);return iC(r,this.profilesHome.scheme)}async createTransientProfile(e){let t=await this.channel.call("createTransientProfile",[e]);return iC(t,this.profilesHome.scheme)}async setProfileForWorkspace(e,t){await this.channel.call("setProfileForWorkspace",[e,t])}removeProfile(e){return this.channel.call("removeProfile",[e])}async updateProfile(e,t){let o=await this.channel.call("updateProfile",[e,t]);return iC(o,this.profilesHome.scheme)}resetWorkspaces(){return this.channel.call("resetWorkspaces")}cleanUp(){return this.channel.call("cleanUp")}cleanUpTransientProfiles(){return this.channel.call("cleanUpTransientProfiles")}};var dDi="associatedRemoteProfiles",jN=le("IRemoteUserDataProfilesService"),dot=class extends k{constructor(e,t,o,n,r,s){super();this.environmentService=e;this.remoteAgentService=t;this.userDataProfilesService=o;this.userDataProfileService=n;this.storageService=r;this.logService=s;this.initPromise=this.init()}async init(){let e=this.remoteAgentService.getConnection();if(!e)return;let t=await this.remoteAgentService.getEnvironment();if(!t)return;this.remoteUserDataProfilesService=new yAe(t.profiles.all,t.profiles.home,e.getChannel("userDataProfiles")),this._register(this.userDataProfilesService.onDidChangeProfiles(n=>this.onDidChangeLocalProfiles(n)));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 t of e.removed){let o=this.remoteUserDataProfilesService?.profiles.find(n=>n.id===t.id);o&&await this.remoteUserDataProfilesService?.removeProfile(o)}}async getRemoteProfiles(){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new ka("Remote profiles service not available in the current window");return this.remoteUserDataProfilesService.profiles}async getRemoteProfile(e){if(await this.initPromise,!this.remoteUserDataProfilesService)throw new ka("Remote profiles service not available in the current window");return this.getAssociatedRemoteProfile(e,this.remoteUserDataProfilesService)}async getAssociatedRemoteProfile(e,t){if(e.isDefault)return t.defaultProfile;let o=t.profiles.find(n=>n.id===e.id);return o||(o=await t.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 t=this.parseAssociatedRemoteProfiles();e=jo(e),e.length?t[this.environmentService.remoteAuthority]=e:delete t[this.environmentService.remoteAuthority],Object.keys(t).length?this.storageService.store(dDi,JSON.stringify(t),-1,1):this.storageService.remove(dDi,-1)}}parseAssociatedRemoteProfiles(){if(this.environmentService.remoteAuthority){let e=this.storageService.get(dDi,-1);try{return e?JSON.parse(e):{}}catch(t){this.logService.error(t)}}return{}}async cleanUp(){let e=[];for(let t of this.getAssociatedRemoteProfiles()){let o=this.remoteUserDataProfilesService?.profiles.find(r=>r.id===t);if(!o)continue;let n=this.userDataProfilesService.profiles.find(r=>r.id===t);if(n){n.name!==o.name&&await this.remoteUserDataProfilesService?.updateProfile(o,{name:n.name}),e.push(t);continue}o&&await this.remoteUserDataProfilesService?.removeProfile(o)}this.setAssociatedRemoteProfiles(e)}};dot=I([m(0,Mt),m(1,bo),m(2,hn),m(3,gn),m(4,de),m(5,re)],dot);Ce(jN,dot,1);var aq=le("IRemoteExtensionsScannerService"),nbo="remoteExtensionsScanner";var AU=le("localizationService"),M1t=le("activeLanguageService");var uot=class{constructor(i,e,t,o,n,r,s){this.remoteAgentService=i;this.environmentService=e;this.userDataProfileService=t;this.remoteUserDataProfilesService=o;this.activeLanguagePackService=n;this.extensionManagementService=r;this.logService=s}whenExtensionsReady(){return this.withChannel(i=>i.call("whenExtensionsReady"),{failed:[]})}async scanExtensions(){try{let i=await this.activeLanguagePackService.getExtensionIdProvidingCurrentLocale();return await this.withChannel(async e=>{let t=this.userDataProfileService.currentProfile.isDefault?void 0:(await this.remoteUserDataProfilesService.getRemoteProfile(this.userDataProfileService.currentProfile)).extensionsResource,o=await e.call("scanExtensions",[Kr,t,this.extensionManagementService.getInstalledWorkspaceExtensionLocations(),this.environmentService.extensionDevelopmentLocationURI,i]);return o.forEach(n=>{n.extensionLocation=A.revive(n.extensionLocation)}),o},[])}catch(i){return this.logService.error(i),[]}}withChannel(i,e){let t=this.remoteAgentService.getConnection();return t?t.withChannel(nbo,o=>i(o)):Promise.resolve(e)}};uot=I([m(0,bo),m(1,Mt),m(2,gn),m(3,jN),m(4,M1t),m(5,Dd),m(6,re)],uot);Ce(aq,uot,1);var mDi=le("embedderTerminalService"),uDi=class{constructor(){this._onDidCreateTerminal=new T;this.onDidCreateTerminal=U.buffer(this._onDidCreateTerminal.event,"onDidCreateTerminal")}createTerminal(i){let e={name:i.name,isFeatureTerminal:!0,customPtyImplementation(t,o,n){return new pDi(t,i.pty)}};this._onDidCreateTerminal.fire(e)}},pDi=class extends k{constructor(e,t){super();this.id=e;this.shouldPersist=!1;this._onProcessReady=this._register(new T);this.onProcessReady=this._onProcessReady.event;this._onDidChangeProperty=this._register(new T);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new T);this.onProcessExit=this._onProcessExit.event;this._pty=t,this.onProcessData=this._pty.onDidWrite,this._pty.onDidClose&&this._register(this._pty.onDidClose(o=>this._onProcessExit.fire(o||void 0))),this._pty.onDidChangeName&&this._register(this._pty.onDidChangeName(o=>this._onDidChangeProperty.fire({type:"title",value:o})))}async start(){this._onProcessReady.fire({pid:-1,cwd:"",windowsPty:void 0}),this._pty.open()}shutdown(){this._pty.close()}input(){}sendSignal(){}async processBinary(){}resize(){}clearBuffer(){}acknowledgeDataEvent(){}async setUnicodeVersion(){}async getInitialCwd(){return""}async getCwd(){return""}refreshProperty(e){throw new Error(`refreshProperty is not suppported in EmbedderTerminalProcess. property: ${e}`)}updateProperty(e,t){throw new Error(`updateProperty is not suppported in EmbedderTerminalProcess. property: ${e}, value: ${t}`)}};Ce(mDi,uDi,1);function hDi(a){return`${a}.hidden`}var pot=class extends k{constructor(e,t,o,n){super();this.viewContainerName=t;this.storageService=o;this._onDidChangeStoredState=this._register(new T);this.onDidChangeStoredState=this._onDidChangeStoredState.event;this.logger=new uo(()=>n.createLogger(qXe,{name:$Xe,group:eP})),this.globalViewsStateStorageId=hDi(e),this.workspaceViewsStateStorageId=e,this._register(this.storageService.onDidChangeValue(0,this.globalViewsStateStorageId,this._store)(()=>this.onDidStorageChange())),this.state=this.initialize()}set(e,t){this.state.set(e,t)}get(e){return this.state.get(e)}updateState(e){this.updateWorkspaceState(e),this.updateGlobalState(e)}updateWorkspaceState(e){let t=this.getStoredWorkspaceState();for(let o of e){let n=this.get(o.id);n&&(t[o.id]={collapsed:!!n.collapsed,isHidden:!n.visibleWorkspace,size:n.size,order:o.workspace&&n?n.order:void 0})}Object.keys(t).length>0?this.storageService.store(this.workspaceViewsStateStorageId,JSON.stringify(t),1,1):this.storageService.remove(this.workspaceViewsStateStorageId,1)}updateGlobalState(e){let t=this.getStoredGlobalState();for(let o of e){let n=this.get(o.id);t.set(o.id,{id:o.id,isHidden:n&&o.canToggleVisibility?!n.visibleGlobal:!1,order:!o.workspace&&n?n.order:void 0})}this.setStoredGlobalState(t)}onDidStorageChange(){if(this.globalViewsStatesValue!==this.getStoredGlobalViewsStatesValue()){this._globalViewsStatesValue=void 0;let e=this.getStoredGlobalState(),t=this.getStoredWorkspaceState(),o=[];for(let[n,r]of e){let s=this.get(n);if(s)s.visibleGlobal!==!r.isHidden&&(r.isHidden||this.logger.value.trace(`View visibility state changed: ${n} is now visible`,this.viewContainerName),o.push({id:n,visible:!r.isHidden}));else{let l=t[n];this.set(n,{active:!1,visibleGlobal:!r.isHidden,visibleWorkspace:bn(l?.isHidden)?void 0:!l?.isHidden,collapsed:l?.collapsed,order:l?.order,size:l?.size})}}if(o.length){this._onDidChangeStoredState.fire(o);for(let n of o){let r=this.get(n.id);r&&(r.visibleGlobal=n.visible)}}}}initialize(){let e=new Map,t=this.getStoredWorkspaceState();for(let l of Object.keys(t)){let c=t[l];e.set(l,{active:!1,visibleGlobal:void 0,visibleWorkspace:bn(c.isHidden)?void 0:!c.isHidden,collapsed:c.collapsed,order:c.order,size:c.size})}let o=this.storageService.get(this.globalViewsStateStorageId,1,"[]"),{state:n}=this.parseStoredGlobalState(o);if(n.size>0){for(let{id:l,isHidden:c}of n.values()){let u=e.get(l);u?bn(u.visibleWorkspace)&&(u.visibleWorkspace=!c):e.set(l,{active:!1,collapsed:void 0,visibleGlobal:void 0,visibleWorkspace:!c})}this.storageService.remove(this.globalViewsStateStorageId,1)}let{state:r,hasDuplicates:s}=this.parseStoredGlobalState(this.globalViewsStatesValue);s&&this.setStoredGlobalState(r);for(let{id:l,isHidden:c,order:u}of r.values()){let p=e.get(l);p?(p.visibleGlobal=!c,bn(u)||(p.order=u)):e.set(l,{active:!1,visibleGlobal:!c,order:u,collapsed:void 0,visibleWorkspace:void 0})}return e}getStoredWorkspaceState(){return JSON.parse(this.storageService.get(this.workspaceViewsStateStorageId,1,"{}"))}getStoredGlobalState(){return this.parseStoredGlobalState(this.globalViewsStatesValue).state}setStoredGlobalState(e){this.globalViewsStatesValue=JSON.stringify([...e.values()])}parseStoredGlobalState(e){let t=JSON.parse(e),o=!1;return{state:t.reduce((r,s)=>(typeof s=="string"?(o=o||r.has(s),r.set(s,{id:s,isHidden:!0})):(o=o||r.has(s.id),r.set(s.id,s)),r),new Map),hasDuplicates:o}}get globalViewsStatesValue(){return this._globalViewsStatesValue||(this._globalViewsStatesValue=this.getStoredGlobalViewsStatesValue()),this._globalViewsStatesValue}set globalViewsStatesValue(e){this.globalViewsStatesValue!==e&&(this._globalViewsStatesValue=e,this.setStoredGlobalViewsStatesValue(e))}getStoredGlobalViewsStatesValue(){return this.storageService.get(this.globalViewsStateStorageId,0,"[]")}setStoredGlobalViewsStatesValue(e){this.storageService.store(this.globalViewsStateStorageId,e,0,0)}};pot=I([m(2,de),m(3,Ol)],pot);var wAe=class extends k{constructor(e,t,o,n){super();this.viewContainer=e;this.contextKeyService=o;this.contextKeys=new Wye;this.viewDescriptorItems=[];this._onDidChangeContainerInfo=this._register(new T);this.onDidChangeContainerInfo=this._onDidChangeContainerInfo.event;this._onDidChangeAllViewDescriptors=this._register(new T);this.onDidChangeAllViewDescriptors=this._onDidChangeAllViewDescriptors.event;this._onDidChangeActiveViewDescriptors=this._register(new T);this.onDidChangeActiveViewDescriptors=this._onDidChangeActiveViewDescriptors.event;this._onDidAddVisibleViewDescriptors=this._register(new T);this.onDidAddVisibleViewDescriptors=this._onDidAddVisibleViewDescriptors.event;this._onDidRemoveVisibleViewDescriptors=this._register(new T);this.onDidRemoveVisibleViewDescriptors=this._onDidRemoveVisibleViewDescriptors.event;this._onDidMoveVisibleViewDescriptors=this._register(new T);this.onDidMoveVisibleViewDescriptors=this._onDidMoveVisibleViewDescriptors.event;this.logger=new uo(()=>n.createLogger(qXe,{name:$Xe,group:eP})),this._register(U.filter(o.onDidChangeContext,r=>r.affectsSome(this.contextKeys))(()=>this.onDidChangeContext())),this.viewDescriptorsState=this._register(t.createInstance(pot,e.storageId||`${e.id}.state`,typeof e.title=="string"?e.title:e.title.original)),this._register(this.viewDescriptorsState.onDidChangeStoredState(r=>this.updateVisibility(r))),this.updateContainerInfo()}get title(){return this._title}get icon(){return this._icon}get keybindingId(){return this._keybindingId}get allViewDescriptors(){return this.viewDescriptorItems.map(e=>e.viewDescriptor)}get activeViewDescriptors(){return this.viewDescriptorItems.filter(e=>e.state.active).map(e=>e.viewDescriptor)}get visibleViewDescriptors(){return this.viewDescriptorItems.filter(e=>this.isViewDescriptorVisible(e)).map(e=>e.viewDescriptor)}updateContainerInfo(){let e=this.viewContainer.alwaysUseContainerInfo||this.visibleViewDescriptors.length===0||this.visibleViewDescriptors.some(c=>oe.as(Kn.ViewsRegistry).getViewContainer(c.id)===this.viewContainer),t=e?typeof this.viewContainer.title=="string"?this.viewContainer.title:this.viewContainer.title.value:this.visibleViewDescriptors[0]?.containerTitle||this.visibleViewDescriptors[0]?.name?.value||"",o=!1;this._title!==t&&(this._title=t,o=!0);let n=e?this.viewContainer.icon:this.visibleViewDescriptors[0]?.containerIcon||GDe,r=!1;this.isEqualIcon(n)||(this._icon=n,r=!0);let s=this.viewContainer.openCommandActionDescriptor?.id??this.activeViewDescriptors.find(c=>c.openCommandActionDescriptor)?.openCommandActionDescriptor?.id,l=!1;this._keybindingId!==s&&(this._keybindingId=s,l=!0),(o||r||l)&&this._onDidChangeContainerInfo.fire({title:o,icon:r,keybindingId:l})}isEqualIcon(e){return A.isUri(e)?A.isUri(this._icon)&&ze(e,this._icon):q.isThemeIcon(e)?q.isThemeIcon(this._icon)&&q.isEqual(e,this._icon):e===this._icon}isVisible(e){let t=this.viewDescriptorItems.find(o=>o.viewDescriptor.id===e);if(!t)throw new Error(`Unknown view ${e}`);return this.isViewDescriptorVisible(t)}setVisible(e,t){this.updateVisibility([{id:e,visible:t}])}updateVisibility(e){let t=ui(e.filter(({visible:r})=>!r).map(({id:r})=>this.findAndIgnoreIfNotFound(r))),o=[];for(let{viewDescriptorItem:r,visibleIndex:s}of t)this.updateViewDescriptorItemVisibility(r,!1)&&o.push({viewDescriptor:r.viewDescriptor,index:s});o.length&&this.broadCastRemovedVisibleViewDescriptors(o);let n=[];for(let{id:r,visible:s}of e){if(!s)continue;let l=this.findAndIgnoreIfNotFound(r);if(!l)continue;let{viewDescriptorItem:c,visibleIndex:u}=l;this.updateViewDescriptorItemVisibility(c,!0)&&n.push({index:u,viewDescriptor:c.viewDescriptor,size:c.state.size,collapsed:!!c.state.collapsed})}n.length&&this.broadCastAddedVisibleViewDescriptors(n)}updateViewDescriptorItemVisibility(e,t){return!e.viewDescriptor.canToggleVisibility||this.isViewDescriptorVisibleWhenActive(e)===t?!1:(e.viewDescriptor.workspace?e.state.visibleWorkspace=t:(e.state.visibleGlobal=t,t&&this.logger.value.trace(`Showing view ${e.viewDescriptor.id} in the container ${this.viewContainer.id}`)),this.isViewDescriptorVisible(e)===t)}isCollapsed(e){return!!this.find(e).viewDescriptorItem.state.collapsed}setCollapsed(e,t){let{viewDescriptorItem:o}=this.find(e);o.state.collapsed!==t&&(o.state.collapsed=t),this.viewDescriptorsState.updateState(this.allViewDescriptors)}getSize(e){return this.find(e).viewDescriptorItem.state.size}setSizes(e){for(let{id:t,size:o}of e){let{viewDescriptorItem:n}=this.find(t);n.state.size!==o&&(n.state.size=o)}this.viewDescriptorsState.updateState(this.allViewDescriptors)}move(e,t){let o=this.viewDescriptorItems.findIndex(l=>l.viewDescriptor.id===e),n=this.viewDescriptorItems.findIndex(l=>l.viewDescriptor.id===t),r=this.viewDescriptorItems[o],s=this.viewDescriptorItems[n];G4i(this.viewDescriptorItems,o,n);for(let l=0;l<this.viewDescriptorItems.length;l++)this.viewDescriptorItems[l].state.order=l;this.broadCastMovedViewDescriptors({index:o,viewDescriptor:r.viewDescriptor},{index:n,viewDescriptor:s.viewDescriptor})}add(e){let t=[];for(let r of e){let s=r.viewDescriptor;if(s.when)for(let c of s.when.keys())this.contextKeys.add(c);let l=this.viewDescriptorsState.get(s.id);if(l){if(s.workspace)l.visibleWorkspace=mr(r.visible)?mr(l.visibleWorkspace)?!s.hideByDefault:l.visibleWorkspace:r.visible;else{let c=l.visibleGlobal;l.visibleGlobal=mr(r.visible)?mr(l.visibleGlobal)?!s.hideByDefault:l.visibleGlobal:r.visible,l.visibleGlobal&&!c&&this.logger.value.trace(`Added view ${s.id} in the container ${this.viewContainer.id} and showing it.`,`${c}`,`${s.hideByDefault}`,`${r.visible}`)}l.collapsed=mr(r.collapsed)?mr(l.collapsed)?!!s.collapsed:l.collapsed:r.collapsed}else l={active:!1,visibleGlobal:mr(r.visible)?!s.hideByDefault:r.visible,visibleWorkspace:mr(r.visible)?!s.hideByDefault:r.visible,collapsed:mr(r.collapsed)?!!s.collapsed:r.collapsed};this.viewDescriptorsState.set(s.id,l),l.active=this.contextKeyService.contextMatchesRules(s.when),t.push({viewDescriptor:s,state:l})}this.viewDescriptorItems.push(...t),this.viewDescriptorItems.sort(this.compareViewDescriptors.bind(this)),this._onDidChangeAllViewDescriptors.fire({added:t.map(({viewDescriptor:r})=>r),removed:[]});let o=[];for(let r of t)r.state.active&&o.push({viewDescriptorItem:r,visible:this.isViewDescriptorVisible(r)});o.length&&this._onDidChangeActiveViewDescriptors.fire({added:o.map(({viewDescriptorItem:r})=>r.viewDescriptor),removed:[]});let n=[];for(let{viewDescriptorItem:r,visible:s}of o)if(s&&this.isViewDescriptorVisible(r)){let{visibleIndex:l}=this.find(r.viewDescriptor.id);n.push({index:l,viewDescriptor:r.viewDescriptor,size:r.state.size,collapsed:!!r.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(n)}remove(e){let t=[],o=[],n=[],r=[];for(let s of e){if(s.when)for(let c of s.when.keys())this.contextKeys.delete(c);let l=this.viewDescriptorItems.findIndex(c=>c.viewDescriptor.id===s.id);if(l!==-1){t.push(s);let c=this.viewDescriptorItems[l];if(c.state.active&&n.push(c.viewDescriptor),this.isViewDescriptorVisible(c)){let{visibleIndex:u}=this.find(c.viewDescriptor.id);r.push({index:u,viewDescriptor:c.viewDescriptor})}o.push(c)}}o.forEach(s=>this.viewDescriptorItems.splice(this.viewDescriptorItems.indexOf(s),1)),this.broadCastRemovedVisibleViewDescriptors(r),n.length&&this._onDidChangeActiveViewDescriptors.fire({added:[],removed:n}),t.length&&this._onDidChangeAllViewDescriptors.fire({added:[],removed:t})}onDidChangeContext(){let e=[],t=[];for(let r of this.viewDescriptorItems){let s=r.state.active,l=this.contextKeyService.contextMatchesRules(r.viewDescriptor.when);s!==l&&(l?e.push({item:r,visibleWhenActive:this.isViewDescriptorVisibleWhenActive(r)}):t.push(r))}let o=[];for(let r of t)if(this.isViewDescriptorVisible(r)){let{visibleIndex:s}=this.find(r.viewDescriptor.id);o.push({index:s,viewDescriptor:r.viewDescriptor})}t.forEach(r=>r.state.active=!1),e.forEach(({item:r})=>r.state.active=!0),this.broadCastRemovedVisibleViewDescriptors(o),(e.length||t.length)&&this._onDidChangeActiveViewDescriptors.fire({added:e.map(({item:r})=>r.viewDescriptor),removed:t.map(r=>r.viewDescriptor)});let n=[];for(let{item:r,visibleWhenActive:s}of e)if(s&&this.isViewDescriptorVisible(r)){let{visibleIndex:l}=this.find(r.viewDescriptor.id);n.push({index:l,viewDescriptor:r.viewDescriptor,size:r.state.size,collapsed:!!r.state.collapsed})}this.broadCastAddedVisibleViewDescriptors(n)}broadCastAddedVisibleViewDescriptors(e){e.length&&(this._onDidAddVisibleViewDescriptors.fire(e.sort((t,o)=>t.index-o.index)),this.updateState(`Added views:${e.map(t=>t.viewDescriptor.id).join(",")} in ${this.viewContainer.id}`))}broadCastRemovedVisibleViewDescriptors(e){e.length&&(this._onDidRemoveVisibleViewDescriptors.fire(e.sort((t,o)=>o.index-t.index)),this.updateState(`Removed views:${e.map(t=>t.viewDescriptor.id).join(",")} from ${this.viewContainer.id}`))}broadCastMovedViewDescriptors(e,t){this._onDidMoveVisibleViewDescriptors.fire({from:e,to:t}),this.updateState(`Moved view ${e.viewDescriptor.id} to ${t.viewDescriptor.id} in ${this.viewContainer.id}`)}updateState(e){this.logger.value.trace(e),this.viewDescriptorsState.updateState(this.allViewDescriptors),this.updateContainerInfo()}isViewDescriptorVisible(e){return e.state.active?this.isViewDescriptorVisibleWhenActive(e):!1}isViewDescriptorVisibleWhenActive(e){return e.viewDescriptor.workspace?!!e.state.visibleWorkspace:!!e.state.visibleGlobal}find(e){let t=this.findAndIgnoreIfNotFound(e);if(t)return t;throw new Error(`view descriptor ${e} not found`)}findAndIgnoreIfNotFound(e){for(let t=0,o=0;t<this.viewDescriptorItems.length;t++){let n=this.viewDescriptorItems[t];if(n.viewDescriptor.id===e)return{index:t,visibleIndex:o,viewDescriptorItem:n};this.isViewDescriptorVisible(n)&&o++}}compareViewDescriptors(e,t){return e.viewDescriptor.id===t.viewDescriptor.id?0:this.getViewOrder(e)-this.getViewOrder(t)||this.getGroupOrderResult(e.viewDescriptor,t.viewDescriptor)}getViewOrder(e){let t=typeof e.state.order=="number"?e.state.order:e.viewDescriptor.order;return typeof t=="number"?t:Number.MAX_VALUE}getGroupOrderResult(e,t){return!e.group||!t.group||e.group===t.group?0:e.group<t.group?-1:1}};wAe=I([m(1,F),m(2,X),m(3,Ol)],wAe);function rbo(a){return`${a}.state`}var pP=class extends k{constructor(e,t,o,n,r,s,l){super();this.instantiationService=e;this.contextKeyService=t;this.storageService=o;this.extensionService=n;this.telemetryService=r;this._onDidChangeContainer=this._register(new T);this.onDidChangeContainer=this._onDidChangeContainer.event;this._onDidChangeLocation=this._register(new T);this.onDidChangeLocation=this._onDidChangeLocation.event;this._onDidChangeContainerLocation=this._register(new T);this.onDidChangeContainerLocation=this._onDidChangeContainerLocation.event;this.viewContainerModels=this._register(new Ot);this.viewsVisibilityActionDisposables=this._register(new Ot);this.canRegisterViewsVisibilityActions=!1;this._onDidChangeViewContainers=this._register(new T);this.onDidChangeViewContainers=this._onDidChangeViewContainers.event;this.logger=new uo(()=>s.createLogger(qXe,{name:$Xe,group:eP})),this.isSessionsWindow=l.isSessionsWindow,this.activeViewContextKeys=new Map,this.movableViewContextKeys=new Map,this.defaultViewLocationContextKeys=new Map,this.defaultViewContainerLocationContextKeys=new Map,this.viewContainersRegistry=oe.as(Kn.ViewContainersRegistry),this.viewsRegistry=oe.as(Kn.ViewsRegistry),this.migrateToViewsCustomizationsStorage(),this.viewContainersCustomLocations=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),this.viewDescriptorsCustomLocations=new Map(Object.entries(this.viewCustomizations.viewLocations)),this.viewContainerBadgeEnablementStates=new Map(Object.entries(this.viewCustomizations.viewContainerBadgeEnablementStates)),this.viewContainers.forEach(c=>this.onDidRegisterViewContainer(c)),this._register(this.viewsRegistry.onViewsRegistered(c=>this.onDidRegisterViews(c))),this._register(this.viewsRegistry.onViewsDeregistered(({views:c,viewContainer:u})=>this.onDidDeregisterViews(c,u))),this._register(this.viewsRegistry.onDidChangeContainer(({views:c,from:u,to:p})=>this.onDidChangeDefaultContainer(c,u,p))),this._register(this.viewContainersRegistry.onDidRegister(({viewContainer:c})=>{this.isViewContainerEnabled(c)&&(this.onDidRegisterViewContainer(c),this._onDidChangeViewContainers.fire({added:[{container:c,location:this.getViewContainerLocation(c)}],removed:[]}))})),this._register(this.viewContainersRegistry.onDidDeregister(({viewContainer:c,viewContainerLocation:u})=>{this.isViewContainerEnabled(c)&&(this.onDidDeregisterViewContainer(c),this._onDidChangeViewContainers.fire({removed:[{container:c,location:u}],added:[]}))})),this._register(this.storageService.onDidChangeValue(0,pP.VIEWS_CUSTOMIZATIONS,this._store)(()=>this.onDidStorageChange())),this.extensionService.whenInstalledExtensionsRegistered().then(()=>this.whenExtensionsRegistered())}static{this.VIEWS_CUSTOMIZATIONS="views.customizations"}static{this.COMMON_CONTAINER_ID_PREFIX="workbench.views.service"}get viewContainers(){return this.viewContainersRegistry.all.filter(e=>this.isViewContainerEnabled(e))}migrateToViewsCustomizationsStorage(){if(this.storageService.get(pP.VIEWS_CUSTOMIZATIONS,0))return;let e=this.storageService.get("views.cachedViewContainerLocations",0),t=this.storageService.get("views.cachedViewPositions",0);if(!e&&!t)return;let o=e?JSON.parse(e):[],n=t?JSON.parse(t):[],r={viewContainerLocations:o.reduce((s,[l,c])=>(s[l]=c,s),{}),viewLocations:n.reduce((s,[l,{containerId:c}])=>(s[l]=c,s),{}),viewContainerBadgeEnablementStates:{}};this.storageService.store(pP.VIEWS_CUSTOMIZATIONS,JSON.stringify(r),0,0),this.storageService.remove("views.cachedViewContainerLocations",0),this.storageService.remove("views.cachedViewPositions",0)}registerGroupedViews(e){for(let[t,o]of e.entries()){let n=this.getViewContainerById(t);if(!n||!this.viewContainerModels.has(n)){if(this.isGeneratedContainerId(t)){let s=this.viewContainersCustomLocations.get(t);s!==void 0&&this.registerGeneratedViewContainer(s,t)}continue}let r=o.filter(s=>this.getViewContainerModel(n).allViewDescriptors.filter(l=>l.id===s.id).length===0);this.addViews(n,r)}}deregisterGroupedViews(e){for(let[t,o]of e.entries()){let n=this.getViewContainerById(t);!n||!this.viewContainerModels.has(n)||this.removeViews(n,o)}}moveOrphanViewsToDefaultLocation(){for(let[e,t]of this.viewDescriptorsCustomLocations.entries()){if(this.getViewContainerById(t))continue;let o=this.viewsRegistry.getViewContainer(e),n=this.getViewDescriptorById(e);o&&n&&this.addViews(o,[n])}}whenExtensionsRegistered(){this.moveOrphanViewsToDefaultLocation();for(let e of[...this.viewContainersCustomLocations.keys()])this.cleanUpGeneratedViewContainer(e);this.saveViewCustomizations();for(let[e,t]of this.viewContainerModels)this.registerViewsVisibilityActions(e,t);this.canRegisterViewsVisibilityActions=!0}onDidRegisterViews(e){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(({views:t,viewContainer:o})=>{let n=this.regroupViews(o.id,t);this.registerGroupedViews(n),t.forEach(r=>this.getOrCreateMovableViewContextKey(r).set(!!r.canMoveView))})})}isGeneratedContainerId(e){return e.startsWith(pP.COMMON_CONTAINER_ID_PREFIX)}onDidDeregisterViews(e,t){let o=this.regroupViews(t.id,e);this.deregisterGroupedViews(o),this.contextKeyService.bufferChangeEvents(()=>{e.forEach(n=>this.getOrCreateMovableViewContextKey(n).set(!1))})}regroupViews(e,t){let o=new Map;for(let n of t){let r=this.viewDescriptorsCustomLocations.get(n.id)??e,s=o.get(r);s||o.set(r,s=[]),s.push(n)}return o}getViewDescriptorById(e){let t=this.viewsRegistry.getView(e);return t&&!this.isViewEnabled(t)?null:t}getViewLocationById(e){let t=this.getViewContainerByViewId(e);return t===null?null:this.getViewContainerLocation(t)}getViewContainerByViewId(e){let t=this.viewsRegistry.getView(e);if(t&&!this.isViewEnabled(t))return null;let o=this.viewDescriptorsCustomLocations.get(e);return o?this.getViewContainerById(o):this.getDefaultContainerById(e)}getViewContainerLocation(e){let t=this.viewContainersCustomLocations.get(e.id)??this.getDefaultViewContainerLocation(e);return this.getEffectiveViewContainerLocation(t)}getDefaultViewContainerLocation(e){return this.getEffectiveViewContainerLocation(this.viewContainersRegistry.getViewContainerLocation(e))}getEffectiveViewContainerLocation(e){return!this.isSessionsWindow&&e===3?2:e}getDefaultContainerById(e){return this.viewsRegistry.getViewContainer(e)??null}getViewContainerModel(e){return this.getOrRegisterViewContainerModel(e)}getViewContainerById(e){return this.viewContainers.find(t=>t.id===e)??null}getViewContainersByLocation(e){return this.viewContainers.filter(t=>this.getViewContainerLocation(t)===e)}isViewContainerEnabled(e){return this.isEnabled(e.windowEnablement)}isViewEnabled(e){return this.isEnabled(e.windowEnablement)}isEnabled(e){return this.isSessionsWindow?e===2||e===3:!e||e===1||e===3}getDefaultViewContainer(e){return this.viewContainersRegistry.getDefaultViewContainers(e).find(o=>this.isViewContainerEnabled(o))}canMoveViews(){return!this.isSessionsWindow}moveViewContainerToLocation(e,t,o,n){this.canMoveViews()&&(this.logger.value.trace(`moveViewContainerToLocation: viewContainer:${e.id} location:${t} reason:${n}`),this.moveViewContainerToLocationWithoutSaving(e,t,o),this.saveViewCustomizations())}getViewContainerBadgeEnablementState(e){return this.viewContainerBadgeEnablementStates.get(e)??!0}setViewContainerBadgeEnablementState(e,t){this.viewContainerBadgeEnablementStates.set(e,t),this.saveViewCustomizations()}moveViewToLocation(e,t,o){if(!this.canMoveViews())return;this.logger.value.trace(`moveViewToLocation: view:${e.id} location:${t} reason:${o}`);let n=this.registerGeneratedViewContainer(t);this.moveViewsToContainer([e],n)}moveViewsToContainer(e,t,o,n){if(!e.length||!this.canMoveViews())return;this.logger.value.trace(`moveViewsToContainer: views:${e.map(l=>l.id).join(",")} viewContainer:${t.id} reason:${n}`);let r=this.getViewContainerByViewId(e[0].id),s=t;r&&s&&r!==s&&(this.moveViewsWithoutSaving(e,r,s,o),this.cleanUpGeneratedViewContainer(r.id),this.saveViewCustomizations(),this.reportMovedViews(e,r,s))}reset(){for(let e of this.viewContainers){let t=this.getViewContainerModel(e);for(let r of t.allViewDescriptors){let s=this.getDefaultContainerById(r.id),l=this.getViewContainerByViewId(r.id);l&&s&&l!==s&&this.moveViewsWithoutSaving([r],l,s)}let o=this.getDefaultViewContainerLocation(e),n=this.getViewContainerLocation(e);o!==null&&n!==o&&this.moveViewContainerToLocationWithoutSaving(e,o),this.cleanUpGeneratedViewContainer(e.id)}this.viewContainersCustomLocations.clear(),this.viewDescriptorsCustomLocations.clear(),this.saveViewCustomizations()}isViewContainerRemovedPermanently(e){return this.isGeneratedContainerId(e)&&!this.viewContainersCustomLocations.has(e)}onDidChangeDefaultContainer(e,t,o){let n=e.filter(r=>!this.viewDescriptorsCustomLocations.has(r.id)||!this.viewContainers.includes(t)&&this.viewDescriptorsCustomLocations.get(r.id)===t.id);n.length&&this.moveViewsWithoutSaving(n,t,o)}reportMovedViews(e,t,o){let n=g=>g.id.startsWith(pP.COMMON_CONTAINER_ID_PREFIX)?"custom":g.extensionId?"extension":g.id,r=this.getViewContainerLocation(t),s=this.getViewContainerLocation(o),l=e.length,c=n(t),u=n(o),p=r===1?"panel":"sidebar",h=s===1?"panel":"sidebar";this.telemetryService.publicLog2("viewDescriptorService.moveViews",{viewCount:l,fromContainer:c,toContainer:u,fromLocation:p,toLocation:h})}moveViewsWithoutSaving(e,t,o,n=1){this.removeViews(t,e),this.addViews(o,e,n);let r=this.getViewContainerLocation(t),s=this.getViewContainerLocation(o);r!==s&&this._onDidChangeLocation.fire({views:e,from:r,to:s}),this._onDidChangeContainer.fire({views:e,from:t,to:o})}moveViewContainerToLocationWithoutSaving(e,t,o){let n=this.getViewContainerLocation(e),r=t;if(n!==r){let s=this.isGeneratedContainerId(e.id),l=r===this.getDefaultViewContainerLocation(e);s||!l?this.viewContainersCustomLocations.set(e.id,r):this.viewContainersCustomLocations.delete(e.id),this.getOrCreateDefaultViewContainerLocationContextKey(e).set(s||l),e.requestedIndex=o,this._onDidChangeContainerLocation.fire({viewContainer:e,from:n,to:r});let c=this.getViewsByContainer(e);this._onDidChangeLocation.fire({views:c,from:n,to:r})}}cleanUpGeneratedViewContainer(e){if(!this.isGeneratedContainerId(e))return;let t=this.getViewContainerById(e);t&&this.getViewContainerModel(t)?.allViewDescriptors.length||[...this.viewDescriptorsCustomLocations.values()].includes(e)||(t&&this.viewContainersRegistry.deregisterViewContainer(t),this.viewContainersCustomLocations.delete(e),this.viewContainerBadgeEnablementStates.delete(e),this.storageService.remove(hDi(t?.storageId||rbo(e)),0))}registerGeneratedViewContainer(e,t){let o=t||this.generateContainerId(e),n=this.viewContainersRegistry.registerViewContainer({id:o,ctorDescriptor:new Vt(Qc,[o,{mergeViewWithContainerWhenSingleView:!0}]),title:{value:d(19623,null),original:"User View Container"},icon:e===0?GDe:void 0,storageId:rbo(o),hideIfEmpty:!0},e,{doNotRegisterOpenCommand:!0});return this.viewContainersCustomLocations.get(n.id)!==e&&this.viewContainersCustomLocations.set(n.id,e),this.getOrCreateDefaultViewContainerLocationContextKey(n).set(!0),n}onDidStorageChange(){JSON.stringify(this.viewCustomizations)!==this.getStoredViewCustomizationsValue()&&this.onDidViewCustomizationsStorageChange()}onDidViewCustomizationsStorageChange(){this._viewCustomizations=void 0;let e=new Map(Object.entries(this.viewCustomizations.viewContainerLocations)),t=new Map(Object.entries(this.viewCustomizations.viewLocations)),o=[],n=[];for(let[r,s]of e.entries()){let l=this.getViewContainerById(r);l?s!==this.getViewContainerLocation(l)&&o.push([l,s]):this.isGeneratedContainerId(r)&&this.registerGeneratedViewContainer(s,r)}for(let r of this.viewContainers)if(!e.has(r.id)){let s=this.getViewContainerLocation(r),l=this.getDefaultViewContainerLocation(r);s!==l&&o.push([r,l])}for(let[r,s]of t.entries()){let l=this.getViewDescriptorById(r);if(l){let c=this.getViewContainerByViewId(r),u=this.getViewContainerById(s);c&&u&&u!==c&&n.push({views:[l],from:c,to:u})}}for(let r of this.viewContainers){let s=this.getViewContainerModel(r);for(let l of s.allViewDescriptors)if(!t.has(l.id)){let c=this.getViewContainerByViewId(l.id),u=this.getDefaultContainerById(l.id);c&&u&&c!==u&&n.push({views:[l],from:c,to:u})}}for(let[r,s]of o)this.moveViewContainerToLocationWithoutSaving(r,s);for(let{views:r,from:s,to:l}of n)this.moveViewsWithoutSaving(r,s,l,0);this.viewContainersCustomLocations=e,this.viewDescriptorsCustomLocations=t}generateContainerId(e){return`${pP.COMMON_CONTAINER_ID_PREFIX}.${wC(e)}.${ht()}`}saveViewCustomizations(){let e={viewContainerLocations:{},viewLocations:{},viewContainerBadgeEnablementStates:{}};for(let[t,o]of this.viewContainersCustomLocations){let n=this.getViewContainerById(t);n&&!this.isGeneratedContainerId(t)&&o===this.getDefaultViewContainerLocation(n)||(e.viewContainerLocations[t]=o)}for(let[t,o]of this.viewDescriptorsCustomLocations){let n=this.getViewContainerById(o);n&&this.getDefaultContainerById(t)?.id===n.id||(e.viewLocations[t]=o)}for(let[t,o]of this.viewContainerBadgeEnablementStates)o===!1&&(e.viewContainerBadgeEnablementStates[t]=o);this.viewCustomizations=e}get viewCustomizations(){return this._viewCustomizations||(this._viewCustomizations=JSON.parse(this.getStoredViewCustomizationsValue()),this._viewCustomizations.viewContainerLocations=this._viewCustomizations.viewContainerLocations??{},this._viewCustomizations.viewLocations=this._viewCustomizations.viewLocations??{},this._viewCustomizations.viewContainerBadgeEnablementStates=this._viewCustomizations.viewContainerBadgeEnablementStates??{}),this._viewCustomizations}set viewCustomizations(e){let t=JSON.stringify(e);JSON.stringify(this.viewCustomizations)!==t&&(this._viewCustomizations=e,this.setStoredViewCustomizationsValue(t))}getStoredViewCustomizationsValue(){return this.isSessionsWindow?"{}":this.storageService.get(pP.VIEWS_CUSTOMIZATIONS,0,"{}")}setStoredViewCustomizationsValue(e){this.isSessionsWindow||this.storageService.store(pP.VIEWS_CUSTOMIZATIONS,e,0,0)}getViewsByContainer(e){let t=this.viewsRegistry.getViews(e).filter(o=>(this.viewDescriptorsCustomLocations.get(o.id)??e.id)===e.id);for(let[o,n]of this.viewDescriptorsCustomLocations.entries()){if(n!==e.id||this.viewsRegistry.getViewContainer(o)===e)continue;let r=this.getViewDescriptorById(o);r&&t.push(r)}return t}onDidRegisterViewContainer(e){let t=this.isGeneratedContainerId(e.id)?!0:this.getViewContainerLocation(e)===this.getDefaultViewContainerLocation(e);this.getOrCreateDefaultViewContainerLocationContextKey(e).set(t),this.getOrRegisterViewContainerModel(e)}getOrRegisterViewContainerModel(e){let t=this.viewContainerModels.get(e)?.viewContainerModel;if(!t){let o=new O;t=o.add(this.instantiationService.createInstance(wAe,e)),this.onDidChangeActiveViews({added:t.activeViewDescriptors,removed:[]}),t.onDidChangeActiveViewDescriptors(s=>this.onDidChangeActiveViews(s),this,o),this.onDidChangeVisibleViews({added:[...t.visibleViewDescriptors],removed:[]}),t.onDidAddVisibleViewDescriptors(s=>this.onDidChangeVisibleViews({added:s.map(({viewDescriptor:l})=>l),removed:[]}),this,o),t.onDidRemoveVisibleViewDescriptors(s=>this.onDidChangeVisibleViews({added:[],removed:s.map(({viewDescriptor:l})=>l)}),this,o),o.add(ee(()=>this.viewsVisibilityActionDisposables.deleteAndDispose(e))),o.add(this.registerResetViewContainerAction(e));let n={viewContainerModel:t,disposables:o,dispose:()=>o.dispose()};this.viewContainerModels.set(e,n),this.onDidRegisterViews([{views:this.viewsRegistry.getViews(e),viewContainer:e}]);let r=this.getViewsByContainer(e).filter(s=>this.getDefaultContainerById(s.id)!==e);r.length&&(this.addViews(e,r),this.contextKeyService.bufferChangeEvents(()=>{r.forEach(s=>this.getOrCreateMovableViewContextKey(s).set(!!s.canMoveView))})),this.canRegisterViewsVisibilityActions&&this.registerViewsVisibilityActions(e,n)}return t}onDidDeregisterViewContainer(e){this.viewContainerModels.deleteAndDispose(e),this.viewsVisibilityActionDisposables.deleteAndDispose(e)}onDidChangeActiveViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(o=>this.getOrCreateActiveViewContextKey(o).set(!0)),t.forEach(o=>this.getOrCreateActiveViewContextKey(o).set(!1))})}onDidChangeVisibleViews({added:e,removed:t}){this.contextKeyService.bufferChangeEvents(()=>{e.forEach(o=>this.getOrCreateVisibleViewContextKey(o).set(!0)),t.forEach(o=>this.getOrCreateVisibleViewContextKey(o).set(!1))})}registerViewsVisibilityActions(e,{viewContainerModel:t,disposables:o}){this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t)),o.add(U.any(t.onDidChangeActiveViewDescriptors,t.onDidAddVisibleViewDescriptors,t.onDidRemoveVisibleViewDescriptors,t.onDidMoveVisibleViewDescriptors)(n=>{this.viewsVisibilityActionDisposables.deleteAndDispose(e),this.viewsVisibilityActionDisposables.set(e,this.registerViewsVisibilityActionsForContainer(t))}))}registerViewsVisibilityActionsForContainer(e){let t=new O;return e.activeViewDescriptors.forEach((o,n)=>{o.remoteAuthority||(t.add(W(class extends zZe{constructor(){super({id:`${o.id}.toggleVisibility`,viewPaneContainerId:e.viewContainer.id,precondition:o.canToggleVisibility&&(!e.isVisible(o.id)||e.visibleViewDescriptors.length>1)?C.true():C.false(),toggled:C.has(`${o.id}.visible`),title:o.name,metadata:{description:P(19622,"Toggles the visibility of the {0} view if the view container it is located in is visible",o.name.value)},menu:[{id:p8,when:C.equals("viewContainer",e.viewContainer.id),order:n},{id:R.ViewContainerTitleContext,when:C.equals("viewContainer",e.viewContainer.id),order:n,group:"1_toggleVisibility"},{id:R.ViewTitleContext,when:C.or(...e.visibleViewDescriptors.map(r=>C.equals("view",r.id))),order:n,group:"2_toggleVisibility"}]})}async runInViewPaneContainer(r,s){s.toggleViewVisibility(o.id)}})),t.add(W(class extends zZe{constructor(){super({id:`${o.id}.removeView`,viewPaneContainerId:e.viewContainer.id,title:d(19619,null,o.name.value),metadata:{description:P(19620,"Hides the {0} view if it is visible and the view container it is located in is visible",o.name.value)},precondition:o.canToggleVisibility&&(!e.isVisible(o.id)||e.visibleViewDescriptors.length>1)?C.true():C.false(),menu:[{id:R.ViewTitleContext,when:C.and(C.equals("view",o.id),C.has(`${o.id}.visible`)),group:"1_hide",order:1}]})}async runInViewPaneContainer(r,s){s.getView(o.id)?.isVisible()&&s.toggleViewVisibility(o.id)}})))}),t}registerResetViewContainerAction(e){let t=this;return W(class extends z{constructor(){super({id:`${e.id}.resetViewContainerLocation`,title:P(19621,"Reset Location"),menu:[{id:R.ViewContainerTitleContext,group:"1_viewActions",when:C.or(C.and(C.equals("viewContainer",e.id),C.equals(`${e.id}.defaultViewContainerLocation`,!1)))}]})}run(n){t.moveViewContainerToLocation(e,t.getDefaultViewContainerLocation(e),void 0,this.desc.id),n.get(Gt).openViewContainer(e.id,!0)}})}addViews(e,t,o=0){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(n=>{let r=this.getDefaultContainerById(n.id)===e;this.getOrCreateDefaultViewLocationContextKey(n).set(r),r?this.viewDescriptorsCustomLocations.delete(n.id):this.viewDescriptorsCustomLocations.set(n.id,e.id)})}),this.getViewContainerModel(e).add(t.map(n=>({viewDescriptor:n,collapsed:o===0?void 0:!1,visible:o===0?void 0:!0})))}removeViews(e,t){this.contextKeyService.bufferChangeEvents(()=>{t.forEach(o=>{this.viewDescriptorsCustomLocations.get(o.id)===e.id&&this.viewDescriptorsCustomLocations.delete(o.id),this.getOrCreateDefaultViewLocationContextKey(o).set(!1)})}),this.getViewContainerModel(e).remove(t)}getOrCreateActiveViewContextKey(e){let t=`${e.id}.active`,o=this.activeViewContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,o)),o}getOrCreateVisibleViewContextKey(e){let t=`${e.id}.visible`,o=this.activeViewContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.activeViewContextKeys.set(t,o)),o}getOrCreateMovableViewContextKey(e){let t=`${e.id}.canMove`,o=this.movableViewContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.movableViewContextKeys.set(t,o)),o}getOrCreateDefaultViewLocationContextKey(e){let t=`${e.id}.defaultViewLocation`,o=this.defaultViewLocationContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.defaultViewLocationContextKeys.set(t,o)),o}getOrCreateDefaultViewContainerLocationContextKey(e){let t=`${e.id}.defaultViewContainerLocation`,o=this.defaultViewContainerLocationContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.defaultViewContainerLocationContextKeys.set(t,o)),o}};pP=I([m(0,F),m(1,X),m(2,de),m(3,lt),m(4,_e),m(5,Ol),m(6,Mt)],pP);Ce(ji,pP,1);var rie=class extends Qc{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,{mergeViewWithContainerWhenSingleView:!1},l,o,n,u,r,p,c,s,h,g,f);this.constantViewDescriptors=new Map;this.allViews=new Map;this._register(t(v=>{this.filterValue=v,this.onFilterChanged(v)})),this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(()=>{this.updateAllViews(this.viewContainerModel.activeViewDescriptors)}))}updateAllViews(e){e.forEach(t=>{let o=this.getFilterOn(t);o&&(this.allViews.has(o)||this.allViews.set(o,new Map),this.allViews.get(o).set(t.id,t),this.filterValue&&!this.filterValue.includes(o)&&this.panes.find(n=>n.id===t.id)&&this.viewContainerModel.setVisible(t.id,!1))})}addConstantViewDescriptors(e){e.forEach(t=>this.constantViewDescriptors.set(t.id,t))}onFilterChanged(e){this.allViews.size===0&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),this.getViewsNotForTarget(e).forEach(t=>this.viewContainerModel.setVisible(t.id,!1)),this.getViewsForTarget(e).forEach(t=>this.viewContainerModel.setVisible(t.id,!0))}getViewsForTarget(e){let t=[];for(let o=0;o<e.length;o++)this.allViews.has(e[o])&&t.push(...Array.from(this.allViews.get(e[o]).values()));return t}getViewsNotForTarget(e){let t=this.allViews.keys(),o=t.next(),n=[];for(;!o.done;){let r=!1;e.forEach(s=>{o.value===s&&(r=!0)}),r||(n=n.concat(this.getViewsForTarget([o.value]))),o=t.next()}return n}onDidAddViewDescriptors(e){let t=super.onDidAddViewDescriptors(e);for(let o=0;o<e.length;o++)this.constantViewDescriptors.has(e[o].viewDescriptor.id)&&t[o].setExpanded(!1);return this.allViews.size===0&&this.updateAllViews(this.viewContainerModel.activeViewDescriptors),t}openView(e,t){let o=super.openView(e,t);if(o){let n=Array.from(this.allViews.entries()).find(r=>r[1].has(e));n&&!this.filterValue?.includes(n[0])&&this.setFilter(n[1].get(e))}return o}};rie=I([m(2,B),m(3,wi),m(4,_e),m(5,de),m(6,F),m(7,Pe),m(8,Xe),m(9,lt),m(10,Ae),m(11,ji),m(12,re)],rie);var mot=class extends k{constructor(e,t,o,n,r){super();this.viewDescriptorService=e;this.paneCompositeService=t;this.contextKeyService=o;this.layoutService=n;this.editorService=r;this._onDidChangeViewVisibility=this._register(new T);this.onDidChangeViewVisibility=this._onDidChangeViewVisibility.event;this._onDidChangeViewContainerVisibility=this._register(new T);this.onDidChangeViewContainerVisibility=this._onDidChangeViewContainerVisibility.event;this._onDidChangeFocusedView=this._register(new T);this.onDidChangeFocusedView=this._onDidChangeFocusedView.event;this.viewContainerDisposables=this._register(new Ot);this.viewDisposable=new Map,this.enabledViewContainersContextKeys=new Map,this.visibleViewContextKeys=new Map,this.viewPaneContainers=new Map,this._register(ee(()=>{this.viewDisposable.forEach(s=>s.dispose()),this.viewDisposable.clear()})),this.viewDescriptorService.viewContainers.forEach(s=>this.onDidRegisterViewContainer(s,this.viewDescriptorService.getViewContainerLocation(s))),this._register(this.viewDescriptorService.onDidChangeViewContainers(({added:s,removed:l})=>this.onDidChangeContainers(s,l))),this._register(this.viewDescriptorService.onDidChangeContainerLocation(({viewContainer:s,from:l,to:c})=>this.onDidChangeContainerLocation(s,l,c))),this._register(this.paneCompositeService.onDidPaneCompositeOpen(s=>this._onDidChangeViewContainerVisibility.fire({id:s.composite.getId(),visible:!0,location:s.viewContainerLocation}))),this._register(this.paneCompositeService.onDidPaneCompositeClose(s=>this._onDidChangeViewContainerVisibility.fire({id:s.composite.getId(),visible:!1,location:s.viewContainerLocation}))),this.focusedViewContextKey=rc.bindTo(o)}onViewsAdded(e){for(let t of e)this.onViewsVisibilityChanged(t,t.isBodyVisible())}onViewsVisibilityChanged(e,t){this.getOrCreateActiveViewContextKey(e).set(t),this._onDidChangeViewVisibility.fire({id:e.id,visible:t})}onViewsRemoved(e){for(let t of e)this.onViewsVisibilityChanged(t,!1)}getOrCreateActiveViewContextKey(e){let t=xYe(e.id),o=this.visibleViewContextKeys.get(t);return o||(o=new Y(t,!1).bindTo(this.contextKeyService),this.visibleViewContextKeys.set(t,o)),o}onDidChangeContainers(e,t){for(let{container:o,location:n}of t)this.onDidDeregisterViewContainer(o,n);for(let{container:o,location:n}of e)this.onDidRegisterViewContainer(o,n)}onDidRegisterViewContainer(e,t){this.registerPaneComposite(e,t);let o=new O,n=this.viewDescriptorService.getViewContainerModel(e);this.onViewDescriptorsAdded(n.allViewDescriptors,e),o.add(n.onDidChangeAllViewDescriptors(({added:r,removed:s})=>{this.onViewDescriptorsAdded(r,e),this.onViewDescriptorsRemoved(s)})),this.updateViewContainerEnablementContextKey(e),o.add(n.onDidChangeActiveViewDescriptors(()=>this.updateViewContainerEnablementContextKey(e))),o.add(this.registerOpenViewContainerAction(e)),this.viewContainerDisposables.set(e.id,o)}onDidDeregisterViewContainer(e,t){this.deregisterPaneComposite(e,t),this.viewContainerDisposables.deleteAndDispose(e.id)}onDidChangeContainerLocation(e,t,o){this.deregisterPaneComposite(e,t),this.registerPaneComposite(e,o),this.layoutService.isVisible(this.paneCompositeService.getPartId(o))&&this.viewDescriptorService.getViewContainersByLocation(o).filter(n=>this.isViewContainerActive(n.id)).length===1&&this.openViewContainer(e.id)}onViewDescriptorsAdded(e,t){if(this.viewDescriptorService.getViewContainerLocation(t)!==null)for(let n of e){let r=new O;r.add(this.registerOpenViewAction(n)),r.add(this.registerFocusViewAction(n,t.title)),r.add(this.registerResetViewLocationAction(n)),this.viewDisposable.set(n,r)}}onViewDescriptorsRemoved(e){for(let t of e){let o=this.viewDisposable.get(t);o&&(o.dispose(),this.viewDisposable.delete(t))}}updateViewContainerEnablementContextKey(e){let t=this.enabledViewContainersContextKeys.get(e.id);t||(t=this.contextKeyService.createKey(fDi(e.id),!1),this.enabledViewContainersContextKeys.set(e.id,t)),t.set(!(e.hideIfEmpty&&this.viewDescriptorService.getViewContainerModel(e).activeViewDescriptors.length===0))}async openComposite(e,t,o){return this.paneCompositeService.openPaneComposite(e,t,o)}getComposite(e,t){return this.paneCompositeService.getPaneComposite(e,t)}isViewContainerVisible(e){let t=this.viewDescriptorService.getViewContainerById(e);if(!t)return!1;let o=this.viewDescriptorService.getViewContainerLocation(t);return o===null?!1:this.paneCompositeService.getActivePaneComposite(o)?.getId()===e}isViewContainerActive(e){let t=this.viewDescriptorService.getViewContainerById(e);return t?t.hideIfEmpty?this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0:!0:!1}getVisibleViewContainer(e){let t=this.paneCompositeService.getActivePaneComposite(e)?.getId();return t?this.viewDescriptorService.getViewContainerById(t):null}getActiveViewPaneContainerWithId(e){let t=this.viewDescriptorService.getViewContainerById(e);return t?this.getActiveViewPaneContainer(t):null}async openViewContainer(e,t){let o=this.viewDescriptorService.getViewContainerById(e);if(o){let n=this.viewDescriptorService.getViewContainerLocation(o);if(n!==null)return await this.paneCompositeService.openPaneComposite(e,n,t)||null}return null}async closeViewContainer(e){let t=this.viewDescriptorService.getViewContainerById(e);if(t){let o=this.viewDescriptorService.getViewContainerLocation(t),n=o!==null&&this.paneCompositeService.getActivePaneComposite(o);if(o!==null)return n?this.layoutService.setPartHidden(!0,this.paneCompositeService.getPartId(o)):void 0}}isViewVisible(e){return this.getActiveViewWithId(e)?.isBodyVisible()||!1}getActiveViewWithId(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.getActiveViewPaneContainer(t);if(o)return o.getView(e)}return null}getViewWithId(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.viewPaneContainers.get(t.id);if(o)return o.getView(e)}return null}getFocusedView(){let e=this.contextKeyService.getContextKeyValue(rc.key)??"";return this.viewDescriptorService.getViewDescriptorById(e.toString())}getFocusedViewName(){let e=this.editorService.activeTextEditorControl?.hasTextFocus()?d(19624,null):void 0;return this.getFocusedView()?.name?.value??e??""}async openView(e,t){let o=this.viewDescriptorService.getViewContainerByViewId(e);if(!o||!this.viewDescriptorService.getViewContainerModel(o).activeViewDescriptors.some(s=>s.id===e))return null;let n=this.viewDescriptorService.getViewContainerLocation(o),r=this.getComposite(o.id,n);if(r){let s=await this.openComposite(r.id,n);if(s?.openView)return s.openView(e,t)||null;t&&s?.focus()}return null}closeView(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(t){let o=this.getActiveViewPaneContainer(t);if(o){let n=o.getView(e);if(n)if(o.views.length===1){let r=this.viewDescriptorService.getViewContainerLocation(t);r===0?this.layoutService.setPartHidden(!0,"workbench.parts.sidebar"):(r===1||r===2)&&this.paneCompositeService.hideActivePaneComposite(r),this.focusedViewContextKey.get()===e&&this.focusedViewContextKey.reset()}else n.setExpanded(!1)}}}getActiveViewPaneContainer(e){let t=this.viewDescriptorService.getViewContainerLocation(e);if(t===null)return null;let o=this.paneCompositeService.getActivePaneComposite(t);return o?.getId()===e.id&&o.getViewPaneContainer()||null}getViewProgressIndicator(e){let t=this.viewDescriptorService.getViewContainerByViewId(e);if(!t)return;let o=this.viewPaneContainers.get(t.id);if(!o)return;let n=o.getView(e);if(n)return o.isViewMergedWithContainer()?this.getViewContainerProgressIndicator(t):n.getProgressIndicator()}getViewContainerProgressIndicator(e){let t=this.viewDescriptorService.getViewContainerLocation(e);if(t!==null)return this.paneCompositeService.getProgressIndicator(e.id,t)}registerOpenViewContainerAction(e){let t=new O;if(e.openCommandActionDescriptor){let{id:o,mnemonicTitle:n,keybindings:r,order:s}=e.openCommandActionDescriptor??{id:e.id},l=e.openCommandActionDescriptor.title??e.title,c=this;if(t.add(W(class extends z{constructor(){super({id:o,get title(){let p=c.viewDescriptorService.getViewContainerLocation(e),h=typeof l=="string"?l:l.value,g=typeof l=="string"?l:l.original;return p===0?{value:d(19629,null,h),original:`Show ${g}`}:{value:d(19630,null,h),original:`Toggle ${g}`}},category:Fe.View,precondition:C.has(fDi(e.id)),keybinding:r?{...r,weight:200}:void 0,f1:!0})}async run(p){let h=p.get(kt),g=p.get(ji),f=p.get(wi),v=p.get(Gt),b=g.getViewContainerLocation(e);switch(b){case 2:case 0:{let S=b===0?"workbench.parts.sidebar":"workbench.parts.auxiliarybar";!v.isViewContainerVisible(e.id)||!f.hasFocus(S)?await v.openViewContainer(e.id,!0):h.activeGroup.focus();break}case 1:!v.isViewContainerVisible(e.id)||!f.hasFocus("workbench.parts.panel")?await v.openViewContainer(e.id,!0):v.closeViewContainer(e.id);break}}})),n){let u=this.viewDescriptorService.getDefaultViewContainerLocation(e);t.add(be.appendMenuItem(R.MenubarViewMenu,{command:{id:o,title:n},group:u===0?"3_sidebar":u===2?"4_auxbar":"5_panel",when:C.has(fDi(e.id)),order:s??Number.MAX_VALUE}))}}return t}registerOpenViewAction(e){let t=new O,o=e.openCommandActionDescriptor?.title??e.name,n=e.openCommandActionDescriptor?.id??`${e.id}.open`,r=this;if(t.add(W(class extends z{constructor(){super({id:n,get title(){let l=r.viewDescriptorService.getViewLocationById(e.id),c=typeof o=="string"?o:o.value,u=typeof o=="string"?o:o.original;return l===0?{value:d(19629,null,c),original:`Show ${u}`}:{value:d(19630,null,c),original:`Toggle ${u}`}},category:Fe.View,precondition:C.has(`${e.id}.active`),keybinding:e.openCommandActionDescriptor?.keybindings?{...e.openCommandActionDescriptor.keybindings,weight:200}:void 0,f1:e.openCommandActionDescriptor?!0:void 0,metadata:{description:d(19626,null,e.name.value),args:[{name:"options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1,description:d(19627,null)}}}}]}})}async run(l,c){let u=l.get(kt),p=l.get(ji),h=l.get(wi),g=l.get(Gt),f=l.get(X);if(rc.getValue(f)===e.id&&!c?.preserveFocus){let b=p.getViewLocationById(e.id);p.getViewLocationById(e.id)===0?u.activeGroup.focus():b!==null&&h.setPartHidden(!0,r.paneCompositeService.getPartId(b))}else await g.openView(e.id,!c?.preserveFocus)}})),e.openCommandActionDescriptor?.mnemonicTitle){let s=this.viewDescriptorService.getDefaultContainerById(e.id);if(s){let l=this.viewDescriptorService.getDefaultViewContainerLocation(s);t.add(be.appendMenuItem(R.MenubarViewMenu,{command:{id:n,title:e.openCommandActionDescriptor.mnemonicTitle},group:l===0?"3_sidebar":l===2?"4_auxbar":"5_panel",when:C.has(`${e.id}.active`),order:e.openCommandActionDescriptor.order??Number.MAX_VALUE}))}}return t}registerFocusViewAction(e,t){return W(class extends z{constructor(){let n=P(19625,"Focus on {0} View",e.name.value);super({id:e.focusCommand?e.focusCommand.id:`${e.id}.focus`,title:n,category:t,menu:[{id:R.CommandPalette,when:e.when}],keybinding:{when:C.has(`${e.id}.active`),weight:200,primary:e.focusCommand?.keybindings?.primary,secondary:e.focusCommand?.keybindings?.secondary,linux:e.focusCommand?.keybindings?.linux,mac:e.focusCommand?.keybindings?.mac,win:e.focusCommand?.keybindings?.win},metadata:{description:n.value,args:[{name:"focusOptions",description:"Focus Options",schema:{type:"object",properties:{preserveFocus:{type:"boolean",default:!1}}}}]}})}run(n,r){n.get(Gt).openView(e.id,!r?.preserveFocus)}})}registerResetViewLocationAction(e){return W(class extends z{constructor(){super({id:`${e.id}.resetViewLocation`,title:P(19628,"Reset Location"),menu:[{id:R.ViewTitleContext,when:C.or(C.and(C.equals("view",e.id),C.equals(`${e.id}.defaultViewLocation`,!1))),group:"1_hide",order:2}]})}run(o){let n=o.get(ji),r=n.getDefaultContainerById(e.id),s=n.getViewContainerModel(r);if(r.hideIfEmpty&&s.visibleViewDescriptors.length===0){let l=n.getDefaultViewContainerLocation(r);n.moveViewContainerToLocation(r,l,void 0,this.desc.id)}n.moveViewsToContainer([e],r,void 0,this.desc.id),o.get(Gt).openView(e.id,!0)}})}registerPaneComposite(e,t){let o=this,n=class extends HMe{constructor(s,l,c,u,p,h,g){super(e.id,s,c,u,p,h,g,l)}createViewPaneContainer(s){let l=this._register(new O),c=o.createViewPaneContainer(s,e,t,l,this.instantiationService);return c instanceof rie||l.add(U.any(c.onDidAddViews,c.onDidRemoveViews,c.onTitleAreaUpdate)(()=>{this.updateTitleArea()})),c}};n=I([m(0,_e),m(1,Ae),m(2,de),m(3,F),m(4,Pe),m(5,Xe),m(6,lt)],n),oe.as(this.paneCompositeService.getRegistryId(t)).registerPaneComposite(DVt.create(n,e.id,typeof e.title=="string"?e.title:e.title.value,We(e.icon)?e.icon:void 0,e.order,e.requestedIndex,e.icon instanceof A?e.icon:void 0))}deregisterPaneComposite(e,t){oe.as(this.paneCompositeService.getRegistryId(t)).deregisterPaneComposite(e.id)}createViewPaneContainer(e,t,o,n,r){let s=r.createInstance(t.ctorDescriptor.ctor,...t.ctorDescriptor.staticArguments||[]);return this.viewPaneContainers.set(s.getId(),s),n.add(ee(()=>this.viewPaneContainers.delete(s.getId()))),n.add(s.onDidAddViews(l=>this.onViewsAdded(l))),n.add(s.onDidChangeViewVisibility(l=>this.onViewsVisibilityChanged(l,l.isBodyVisible()))),n.add(s.onDidRemoveViews(l=>this.onViewsRemoved(l))),n.add(s.onDidFocusView(l=>{this.focusedViewContextKey.get()!==l.id&&(this.focusedViewContextKey.set(l.id),this._onDidChangeFocusedView.fire())})),n.add(s.onDidBlurView(l=>{this.focusedViewContextKey.get()===l.id&&(this.focusedViewContextKey.reset(),this._onDidChangeFocusedView.fire())})),s}};mot=I([m(0,ji),m(1,Es),m(2,X),m(3,wi),m(4,ie)],mot);function fDi(a){return`viewContainer.${a}.enabled`}Ce(Gt,mot,0);var CAe=class extends k{constructor(e,t,o){super();this.quickInputService=e;this.instantiationService=t;this.contextKeyService=o;this.registry=oe.as(Bu.Quickaccess);this.mapProviderToDescriptor=new Map;this.lastAcceptedPickerValues=new Map;this.visibleQuickAccess=void 0;this._register(ee(()=>{for(let n of this.mapProviderToDescriptor.values())Sd(n)&&n.dispose();this.visibleQuickAccess?.picker.dispose()}))}pick(e="",t){return this.doShowOrPick(e,!0,t)}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,o){let[n,r]=this.getOrInstantiateProvider(e,o?.enabledProviderPrefixes),s=this.visibleQuickAccess,l=s?.descriptor;if(s&&r&&l===r){e!==r.prefix&&!o?.preserveValue&&(s.picker.value=e),this.adjustValueSelection(s.picker,r,o);return}if(r&&!o?.preserveValue){let v;if(s&&l&&l!==r){let b=s.value.substr(l.prefix.length);b&&(v=`${r.prefix}${b}`)}if(!v){let b=n?.defaultFilterValue;b===1?v=this.lastAcceptedPickerValues.get(r):typeof b=="string"&&(v=`${r.prefix}${b}`)}typeof v=="string"&&(e=v)}let c=s?.picker?.valueSelection,u=s?.picker?.value,p=new O,h=p.add(this.quickInputService.createQuickPick({useSeparators:!0}));h.value=e,this.adjustValueSelection(h,r,o),h.placeholder=o?.placeholder??r?.placeholder,h.quickNavigate=o?.quickNavigateConfiguration,h.hideInput=!!h.quickNavigate&&!s,(typeof o?.itemActivation=="number"||o?.quickNavigateConfiguration)&&(h.itemActivation=o?.itemActivation??2),h.contextKey=r?.contextKey,h.filterValue=v=>v.substring(r?r.prefix.length:0);let g;t&&(g=new Mo,p.add(U.once(h.onWillAccept)(v=>{v.veto(),h.hide()}))),p.add(this.registerPickerListeners(h,n,r,e,o));let f=p.add(new qe);if(n&&p.add(n.provide(h,f.token,o?.providerOptions)),U.once(h.onDidHide)(()=>{h.selectedItems.length===0&&f.cancel(),p.dispose(),g?.complete(h.selectedItems.slice(0))}),h.show(),c&&u===e&&(h.valueSelection=c),t)return g?.p}adjustValueSelection(e,t,o){let n;o?.preserveValue?n=[e.value.length,e.value.length]:n=[t?.prefix.length??0,e.value.length],e.valueSelection=n}registerPickerListeners(e,t,o,n,r){let s=new O,l=this.visibleQuickAccess={picker:e,descriptor:o,value:n};return s.add(ee(()=>{l===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),s.add(e.onDidChangeValue(c=>{let[u]=this.getOrInstantiateProvider(c,r?.enabledProviderPrefixes);u!==t?this.show(c,{enabledProviderPrefixes:r?.enabledProviderPrefixes,preserveValue:!0,providerOptions:r?.providerOptions}):l.value=c})),o&&s.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(o,e.value)})),s}getOrInstantiateProvider(e,t){let o=this.registry.getQuickAccessProvider(e,this.contextKeyService);if(!o||t&&!t?.includes(o.prefix))return[void 0,void 0];let n=this.mapProviderToDescriptor.get(o);return n||(n=this.instantiationService.createInstance(o.ctor),this.mapProviderToDescriptor.set(o,n)),[n,o]}};CAe=I([m(0,$e),m(1,F),m(2,X)],CAe);var irn=_,A1t=class extends k{constructor(e,t,o){super();this.parent=e;this._listFocusMode=!1;this.onDidChange=e=>this.findInput.onDidChange(e);this.container=D(this.parent,irn(".quick-input-box")),this.findInput=this._register(new QK(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:o,actionViewItemProvider:jK(o),hideHoverOnValueChange:!0}))}get onKeyDown(){return this.findInput.onKeyDown}get onMouseDown(){return this.findInput.onMouseDown}get value(){return this.findInput.getValue()}set value(e){this.findInput.setValue(e)}select(e=null){this.findInput.inputBox.select(e)}getSelection(){return this.findInput.inputBox.getSelection()}isSelectionAtEnd(){return this.findInput.inputBox.isSelectionAtEnd()}setPlaceholder(e){this.findInput.inputBox.setPlaceHolder(e)}get placeholder(){return this.findInput.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.findInput.inputBox.setPlaceHolder(e)}get password(){return this.findInput.inputBox.inputElement.type==="password"}set password(e){this.findInput.inputBox.inputElement.type=e?"password":"text"}set enabled(e){this.findInput.inputBox.inputElement.toggleAttribute("readonly",!e)}set toggles(e){this.findInput.setAdditionalToggles(e)}set actions(e){this.setActions(e)}setActions(e,t){this.findInput.setActions(e,t)}get ariaLabel(){return this.findInput.inputBox.inputElement.getAttribute("aria-label")||""}set ariaLabel(e){this.findInput.inputBox.inputElement.setAttribute("aria-label",e)}hasFocus(){return this.findInput.inputBox.hasFocus()}setAttribute(e,t){this.findInput.inputBox.inputElement.setAttribute(e,t)}removeAttribute(e){this.findInput.inputBox.inputElement.removeAttribute(e)}setListFocusMode(e){if(this._listFocusMode===e)return;this._listFocusMode=e;let t=this.findInput.inputBox.inputElement;e?(t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","list")):(t.removeAttribute("aria-haspopup"),t.removeAttribute("aria-autocomplete"))}showDecoration(e){e===wt.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===wt.Info?1:e===wt.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===wt.Info?1:e===wt.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}};var lq=_,N1t=class{constructor(i,e,t){this.index=i;this.hasCheckbox=e;this._hidden=!1;this._init=new uo(()=>{let o=t.label??"",n=MA(o).text.trim(),r=t.ariaLabel||[o,this.saneDescription,this.saneDetail].map(s=>AK(s)).filter(s=>!!s).join(", ");return{saneLabel:o,saneSortLabel:n,saneAriaLabel:r}}),this._saneDescription=t.description,this._saneTooltip=t.tooltip}get saneLabel(){return this._init.value.saneLabel}get saneSortLabel(){return this._init.value.saneSortLabel}get saneAriaLabel(){return this._init.value.saneAriaLabel}get element(){return this._element}set element(i){this._element=i}get hidden(){return this._hidden}set hidden(i){this._hidden=i}get saneDescription(){return this._saneDescription}set saneDescription(i){this._saneDescription=i}get saneDetail(){return this._saneDetail}set saneDetail(i){this._saneDetail=i}get saneTooltip(){return this._saneTooltip}set saneTooltip(i){this._saneTooltip=i}get labelHighlights(){return this._labelHighlights}set labelHighlights(i){this._labelHighlights=i}get descriptionHighlights(){return this._descriptionHighlights}set descriptionHighlights(i){this._descriptionHighlights=i}get detailHighlights(){return this._detailHighlights}set detailHighlights(i){this._detailHighlights=i}},rI=class extends N1t{constructor(e,t,o,n,r,s,l){super(e,o,s);this.childIndex=t;this.fireButtonTriggered=n;this._onChecked=r;this.item=s;this._separator=l;this._checked=!1;this.onChecked=o?U.map(U.filter(this._onChecked.event,c=>c.element===this),c=>c.checked):U.None,this._saneDetail=s.detail,this._labelHighlights=s.highlights?.label,this._descriptionHighlights=s.highlights?.description,this._detailHighlights=s.highlights?.detail}get separator(){return this._separator}set separator(e){this._separator=e}get checked(){return this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire({element:this,checked:e}))}get checkboxDisabled(){return!!this.item.disabled}};var dQ=class extends N1t{constructor(e,t,o){super(e,!1,o);this.fireSeparatorButtonTriggered=t;this.separator=o;this.children=new Array;this.focusInsideSeparator=0}},vDi=class{getHeight(i){return i instanceof dQ?30:i.saneDetail?44:22}getTemplateId(i){return i instanceof rI?aie.ID:lie.ID}},bDi=class{getWidgetAriaLabel(){return d(2515,null)}getAriaLabel(i){return i.separator?.label?`${i.saneAriaLabel}, ${i.separator.label}`:i.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(i){return i.hasCheckbox?"checkbox":"option"}isChecked(i){if(!(!i.hasCheckbox||!(i instanceof rI)))return{get value(){return i.checked},onDidChange:e=>i.onChecked(()=>e())}}},O1t=class extends k{constructor(e,t,o){super();this.hoverDelegate=e;this.toggleStyles=t;this.contextMenuService=o;this._onDidDisposeFocusedElement=this._register(new T);this.onDidDisposeFocusedElement=this._onDidDisposeFocusedElement.event}renderTemplate(e){let t=Object.create(null);t.toDisposeElement=new O,t.toDisposeTemplate=new O,t.entry=D(e,lq(".quick-input-list-entry"));let o=D(t.entry,lq("label.quick-input-list-label"));t.outerLabel=o,t.checkbox=t.toDisposeTemplate.add(new ue),t.toDisposeTemplate.add(Yo(o,ne.CLICK,u=>{if(t.checkbox.value&&!u.defaultPrevented&&t.checkbox.value.enabled){let p=!t.checkbox.value.checked;t.checkbox.value.checked=p,t.element.checked=p}}));let n=D(o,lq(".quick-input-list-rows")),r=D(n,lq(".quick-input-list-row")),s=D(n,lq(".quick-input-list-row"));t.label=new ld(r,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.label),t.icon=CI(t.label.element,lq(".quick-input-list-icon"));let l=D(r,lq(".quick-input-list-entry-keybinding"));t.keybinding=new ah(l,Ao),t.toDisposeTemplate.add(t.keybinding);let c=D(s,lq(".quick-input-list-label-meta"));return t.detail=new ld(c,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.detail),t.separator=D(t.entry,lq(".quick-input-list-separator")),t.toolBar=new Kp(t.entry,this.contextMenuService,{...this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0,actionViewItemProvider:jK(this.toggleStyles),icon:!0,label:!1}),t.toolBar.getElement().classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.add(t.toolBar),t}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}disposeElement(e,t,o){Is(o.entry)&&this._onDidDisposeFocusedElement.fire(),o.toDisposeElement.clear(),o.toolBar.setActions([])}},aie=class extends O1t{constructor(e,t,o,n){super(e,t,o);this.themeService=n;this._itemsWithSeparatorsFrequency=new Map}static{this.ID="quickpickitem"}get templateId(){return aie.ID}ensureCheckbox(e,t){if(!e.hasCheckbox){t.checkbox.value?.domNode.remove(),t.checkbox.clear();return}let o=t.checkbox.value;o?o.setTitle(e.saneLabel):(o=new qf(e.saneLabel,e.checked,{...Ag,size:15}),t.checkbox.value=o,t.outerLabel.prepend(o.domNode),o.domNode.tabIndex=-1),e.checkboxDisabled?o.disable():o.enable(),o.checked=e.checked,t.toDisposeElement.add(e.onChecked(n=>o.checked=n)),t.toDisposeElement.add(o.onChange(()=>e.checked=o.checked))}renderElement(e,t,o){let n=e.element;o.element=n,n.element=o.entry??void 0;let r=n.item;n.element.classList.toggle("not-pickable",n.item.pickable===!1),this.ensureCheckbox(n,o);let{labelHighlights:s,descriptionHighlights:l,detailHighlights:c}=n;if(r.iconPath){let g=cm(this.themeService.getColorTheme().type)?r.iconPath.dark:r.iconPath.light??r.iconPath.dark,f=A.revive(g);o.icon.className="quick-input-list-icon",o.icon.style.backgroundImage=cl(f)}else o.icon.style.backgroundImage="",o.icon.className=r.iconClass?`quick-input-list-icon ${r.iconClass}`:"";let u;!n.saneTooltip&&n.saneDescription&&(u={markdown:{value:Cr(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});let p={matches:s||[],descriptionTitle:u,descriptionMatches:l||[],labelEscapeNewLines:!0};if(p.extraClasses=r.iconClasses,p.italic=r.italic,p.strikethrough=r.strikethrough,o.entry.classList.remove("quick-input-list-separator-as-item"),o.label.setLabel(n.saneLabel,n.saneDescription,p),o.keybinding.set(r.keybinding),n.saneDetail){let g;n.saneTooltip||(g={markdown:{value:Cr(n.saneDetail),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDetail}),o.detail.element.style.display="",o.detail.setLabel(n.saneDetail,void 0,{matches:c,title:g,labelEscapeNewLines:!0})}else o.detail.element.style.display="none";n.separator?.label?(o.separator.textContent=n.separator.label,o.separator.style.display="",this.addItemWithSeparator(n)):o.separator.style.display="none",o.entry.classList.toggle("quick-input-list-separator-border",!!n.separator&&n.childIndex!==0);let h=r.buttons;if(h&&h.length){let{primary:g,secondary:f}=M8(h,"quick-input-item",v=>n.fireButtonTriggered({button:v,item:n.item}));o.toolBar.setActions(g,f),o.entry.classList.add("has-actions")}else o.toolBar.setActions([]),o.entry.classList.remove("has-actions")}disposeElement(e,t,o){this.removeItemWithSeparator(e.element),super.disposeElement(e,t,o)}isItemWithSeparatorVisible(e){return this._itemsWithSeparatorsFrequency.has(e)}addItemWithSeparator(e){this._itemsWithSeparatorsFrequency.set(e,(this._itemsWithSeparatorsFrequency.get(e)||0)+1)}removeItemWithSeparator(e){let t=this._itemsWithSeparatorsFrequency.get(e)||0;t>1?this._itemsWithSeparatorsFrequency.set(e,t-1):this._itemsWithSeparatorsFrequency.delete(e)}};aie=I([m(2,Xe),m(3,Pe)],aie);var lie=class extends O1t{constructor(e,t,o){super(e,t,o);this._visibleSeparatorsFrequency=new Map}static{this.ID="quickpickseparator"}get templateId(){return lie.ID}get visibleSeparators(){return[...this._visibleSeparatorsFrequency.keys()]}isSeparatorVisible(e){return this._visibleSeparatorsFrequency.has(e)}renderElement(e,t,o){let n=e.element;o.element=n,n.element=o.entry??void 0,n.element.classList.toggle("focus-inside",!!n.focusInsideSeparator);let r=n.separator,{labelHighlights:s,descriptionHighlights:l}=n;o.icon.style.backgroundImage="",o.icon.className="";let c;!n.saneTooltip&&n.saneDescription&&(c={markdown:{value:Cr(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});let u={matches:s||[],descriptionTitle:c,descriptionMatches:l||[],labelEscapeNewLines:!0};o.entry.classList.add("quick-input-list-separator-as-item"),o.label.setLabel(n.saneLabel,n.saneDescription,u),o.separator.style.display="none",o.entry.classList.add("quick-input-list-separator-border");let p=r.buttons;if(p&&p.length){let{primary:h,secondary:g}=M8(p,"quick-input-separator",f=>n.fireSeparatorButtonTriggered({button:f,separator:n.separator}));o.toolBar.setActions(h,g),o.entry.classList.add("has-actions")}else o.toolBar.setActions([]),o.entry.classList.remove("has-actions");this.addSeparator(n)}disposeElement(e,t,o){this.removeSeparator(e.element),this.isSeparatorVisible(e.element)||e.element.element?.classList.remove("focus-inside"),super.disposeElement(e,t,o)}addSeparator(e){this._visibleSeparatorsFrequency.set(e,(this._visibleSeparatorsFrequency.get(e)||0)+1)}removeSeparator(e){let t=this._visibleSeparatorsFrequency.get(e)||0;t>1?this._visibleSeparatorsFrequency.set(e,t-1):this._visibleSeparatorsFrequency.delete(e)}};lie=I([m(2,Xe)],lie);var sie=class extends k{constructor(e,t,o,n,r,s,l){super();this.parent=e;this.hoverDelegate=t;this.linkOpenerDelegate=o;this.styles=r;this.accessibilityService=l;this._onKeyDown=this._register(new T);this.onKeyDown=this._onKeyDown.event;this._onLeave=this._register(new T);this.onLeave=this._onLeave.event;this._visibleCountObservable=De("VisibleCount",0);this.onChangedVisibleCount=U.fromObservable(this._visibleCountObservable,this._store);this._allVisibleCheckedObservable=De("AllVisibleChecked",!1);this.onChangedAllVisibleChecked=U.fromObservable(this._allVisibleCheckedObservable,this._store);this._checkedCountObservable=De("CheckedCount",0);this.onChangedCheckedCount=U.fromObservable(this._checkedCountObservable,this._store);this._checkedElementsObservable=Xm({equalsFn:eo},new Array);this.onChangedCheckedElements=U.fromObservable(this._checkedElementsObservable,this._store);this._onButtonTriggered=this._register(new T);this.onButtonTriggered=this._onButtonTriggered.event;this._onSeparatorButtonTriggered=this._register(new T);this.onSeparatorButtonTriggered=this._onSeparatorButtonTriggered.event;this._elementChecked=this._register(new T);this._elementCheckedEventBufferer=new JO;this._hasCheckboxes=!1;this._inputElements=new Array;this._elementTree=new Array;this._itemElements=new Array;this._elementDisposable=this._register(new O);this._matchOnDescription=!1;this._matchOnDetail=!1;this._matchOnLabel=!0;this._matchOnLabelMode="fuzzy";this._matchOnMeta=!0;this._sortByLabel=!0;this._shouldLoop=!0;this._container=D(this.parent,lq(".quick-input-list")),this._separatorRenderer=this._register(s.createInstance(lie,t,this.styles.toggle)),this._itemRenderer=this._register(s.createInstance(aie,t,this.styles.toggle)),this._tree=this._register(s.createInstance(hf,"QuickInput",this._container,new vDi,[this._itemRenderer,this._separatorRenderer],{filter:{filter(c){return c.hidden?0:c instanceof dQ?2:1}},sorter:{compare:(c,u)=>{if(!this.sortByLabel||!this._lastQueryString)return 0;let p=this._lastQueryString.toLowerCase();return nrn(c,u,p)}},accessibilityProvider:new bDi,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none",findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=n,this._register(this._itemRenderer.onDidDisposeFocusedElement(()=>this._tree.domFocus())),this._register(this._separatorRenderer.onDidDisposeFocusedElement(()=>this._tree.domFocus())),this._registerListeners()}get onDidChangeFocus(){return U.map(this._tree.onDidChangeFocus,e=>e.elements.filter(t=>t instanceof rI).map(t=>t.item),this._store)}get onDidChangeSelection(){return U.map(this._tree.onDidChangeSelection,e=>({items:e.elements.filter(t=>t instanceof rI).map(t=>t.item),event:e.browserEvent}),this._store)}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get ariaLabel(){return this._tree.ariaLabel}set ariaLabel(e){this._tree.ariaLabel=e??""}set enabled(e){this._tree.getHTMLElement().style.pointerEvents=e?"":"none"}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e}get matchOnMeta(){return this._matchOnMeta}set matchOnMeta(e){this._matchOnMeta=e}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}get shouldLoop(){return this._shouldLoop}set shouldLoop(e){this._shouldLoop=e}_registerListeners(){this._registerOnContainerClick(),this._registerOnMouseMiddleClick(),this._registerOnTreeModelChanged(),this._registerOnElementChecked(),this._registerOnContextMenu(),this._registerHoverListeners(),this._registerSelectionChangeListener(),this._registerSeparatorActionShowingListeners()}_registerOnContainerClick(){this._register($(this._container,ne.CLICK,e=>{(e.x||e.y)&&this._onLeave.fire()}))}_registerOnMouseMiddleClick(){this._register($(this._container,ne.AUXCLICK,e=>{e.button===1&&this._onLeave.fire()}))}_registerOnTreeModelChanged(){this._register(this._tree.onDidChangeModel(()=>{let e=this._itemElements.filter(t=>!t.hidden).length;this._visibleCountObservable.set(e,void 0),this._hasCheckboxes&&this._updateCheckedObservables()}))}_registerOnElementChecked(){this._register(this._elementCheckedEventBufferer.wrapEvent(this._elementChecked.event,(e,t)=>t)(e=>this._updateCheckedObservables()))}_registerOnContextMenu(){this._register(this._tree.onContextMenu(e=>{e.element&&(e.browserEvent.preventDefault(),this._tree.setSelection([e.element]))}))}_registerHoverListeners(){let e=this._register(new Aa(typeof this.hoverDelegate.delay=="function"?this.hoverDelegate.delay():this.hoverDelegate.delay));this._register(this._tree.onMouseOver(async t=>{if(L4e(t.browserEvent.target)){e.cancel();return}if(!(!L4e(t.browserEvent.relatedTarget)&&ms(t.browserEvent.relatedTarget,t.element?.element)))try{await e.trigger(async()=>{t.element instanceof rI&&this.showHover(t.element)})}catch(o){if(!Yi(o))throw o}})),this._register(this._tree.onMouseOut(t=>{ms(t.browserEvent.relatedTarget,t.element?.element)||e.cancel()}))}_registerSeparatorActionShowingListeners(){this._register(this._tree.onDidChangeFocus(e=>{let t=e.elements[0]?this._tree.getParentElement(e.elements[0]):null;for(let o of this._separatorRenderer.visibleSeparators){let n=o===t;!!(o.focusInsideSeparator&2)!==n&&(n?o.focusInsideSeparator|=2:o.focusInsideSeparator&=-3,this._tree.rerender(o))}})),this._register(this._tree.onMouseOver(e=>{let t=e.element?this._tree.getParentElement(e.element):null;for(let o of this._separatorRenderer.visibleSeparators){if(o!==t)continue;o.focusInsideSeparator&1||(o.focusInsideSeparator|=1,this._tree.rerender(o))}})),this._register(this._tree.onMouseOut(e=>{let t=e.element?this._tree.getParentElement(e.element):null;for(let o of this._separatorRenderer.visibleSeparators){if(o!==t)continue;o.focusInsideSeparator&1&&(o.focusInsideSeparator&=-2,this._tree.rerender(o))}}))}_registerSelectionChangeListener(){this._register(this._tree.onDidChangeSelection(e=>{let t=e.elements.filter(o=>o instanceof rI);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof dQ&&(this._tree.setFocus([e.elements[0].children[0]]),this._tree.reveal(e.elements[0],0)),this._tree.setSelection(t))}))}setAllVisibleChecked(e){this._elementCheckedEventBufferer.bufferEvents(()=>{this._itemElements.forEach(t=>{!t.hidden&&!t.checkboxDisabled&&t.item.pickable!==!1&&(t.checked=e)})})}setElements(e){this._elementDisposable.clear(),this._lastQueryString=void 0,this._inputElements=e,this._hasCheckboxes=this.parent.classList.contains("show-checkboxes");let t;this._itemElements=new Array,this._elementTree=e.reduce((o,n,r)=>{let s;if(n.type==="separator"){if(!n.buttons)return o;t=new dQ(r,l=>this._onSeparatorButtonTriggered.fire(l),n),s=t}else{let l=r>0?e[r-1]:void 0,c;l&&l.type==="separator"&&!l.buttons&&(c=l);let u=new rI(r,t?.children?t.children.length:r,this._hasCheckboxes&&n.pickable!==!1,p=>this._onButtonTriggered.fire(p),this._elementChecked,n,c);if(this._itemElements.push(u),t)return t.children.push(u),o;s=u}return o.push(s),o},new Array),this._setElementsToTree(this._elementTree),this.accessibilityService.isScreenReaderOptimized()&&setTimeout(()=>{let o=this._tree.getHTMLElement().querySelector(".monaco-list-row.focused"),n=o?.parentNode;if(o&&n){let r=o.nextSibling;o.remove(),n.insertBefore(o,r)}},0)}setFocusedElements(e){let t=e.map(o=>this._itemElements.find(n=>n.item===o)).filter(o=>!!o).filter(o=>!o.hidden);if(this._tree.setFocus(t),e.length>0){let o=this._tree.getFocus()[0];o&&this._tree.reveal(o)}}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){let t=e.map(o=>this._itemElements.find(n=>n.item===o)).filter(o=>!!o);this._tree.setSelection(t)}getCheckedElements(){return this._itemElements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){this._elementCheckedEventBufferer.bufferEvents(()=>{let t=new Set;for(let o of e)t.add(o);for(let o of this._itemElements)o.checked=t.has(o.item)})}focus(e){if(this._itemElements.length)switch(e===2&&this._itemElements.length<2&&(e=1),e){case 1:this._tree.scrollTop=0,this._tree.focusFirst(void 0,t=>t.element instanceof rI);break;case 2:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,o=>o.element instanceof rI?t?!0:(t=!t,!1):!1);break}case 3:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,t=>t.element instanceof rI);break;case 4:{let t=this._tree.getFocus();this._tree.focusNext(void 0,this._shouldLoop,void 0,n=>n.element instanceof rI?(this._tree.reveal(n.element),!0):!1);let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 5:{let t=this._tree.getFocus();this._tree.focusPrevious(void 0,this._shouldLoop,void 0,n=>{if(!(n.element instanceof rI))return!1;let r=this._tree.getParentElement(n.element);return r===null||r.children[0]!==n.element?this._tree.reveal(n.element):this._tree.reveal(r),!0});let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 6:this._tree.focusNextPage(void 0,t=>t.element instanceof rI?(this._tree.reveal(t.element),!0):!1);break;case 7:this._tree.focusPreviousPage(void 0,t=>{if(!(t.element instanceof rI))return!1;let o=this._tree.getParentElement(t.element);return o===null||o.children[0]!==t.element?this._tree.reveal(t.element):this._tree.reveal(o),!0});break;case 8:{let t=!1,o=this._tree.getFocus()[0];this._tree.focusNext(void 0,!0,void 0,r=>{if(t)return!0;if(r.element instanceof dQ)t=!0,this._separatorRenderer.isSeparatorVisible(r.element)?this._tree.reveal(r.element.children[0]):this._tree.reveal(r.element,0);else if(r.element instanceof rI){if(r.element.separator)return this._itemRenderer.isItemWithSeparatorVisible(r.element)?this._tree.reveal(r.element):this._tree.reveal(r.element,0),!0;if(r.element===this._elementTree[0])return this._tree.reveal(r.element,0),!0}return!1});let n=this._tree.getFocus()[0];o===n&&(this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,r=>r.element instanceof rI));break}case 9:{let t,o=!!this._tree.getFocus()[0]?.separator;this._tree.focusPrevious(void 0,!0,void 0,n=>{if(n.element instanceof dQ)o?t||(this._separatorRenderer.isSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element.children[0]):o=!0;else if(n.element instanceof rI&&!t){if(n.element.separator)this._itemRenderer.isItemWithSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element;else if(n.element===this._elementTree[0])return this._tree.reveal(n.element,0),!0}return!1}),t&&this._tree.setFocus([t]);break}}}clearFocus(){this._tree.setFocus([])}domFocus(){this._tree.domFocus()}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}filter(e){if(this._lastQueryString=e,!(this._sortByLabel||this._matchOnLabel||this._matchOnDescription||this._matchOnDetail))return this._tree.layout(),!1;let t=e;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this._itemElements.forEach(o=>{o.labelHighlights=void 0,o.descriptionHighlights=void 0,o.detailHighlights=void 0,o.hidden=!1;let n=o.index&&this._inputElements[o.index-1];o.item&&(o.separator=n&&n.type==="separator"&&!n.buttons?n:void 0)});else{let o;this._itemElements.forEach(n=>{let r;this.matchOnLabelMode==="fuzzy"?r=this.matchOnLabel?zB(e,MA(n.saneLabel))??void 0:void 0:r=this.matchOnLabel?orn(t,MA(n.saneLabel))??void 0:void 0;let s=this.matchOnDescription?zB(e,MA(n.saneDescription||""))??void 0:void 0,l=this.matchOnDetail?zB(e,MA(n.saneDetail||""))??void 0:void 0;if(r||s||l?(n.labelHighlights=r,n.descriptionHighlights=s,n.detailHighlights=l,n.hidden=!1):(n.labelHighlights=void 0,n.descriptionHighlights=void 0,n.detailHighlights=void 0,n.hidden=n.item?!n.item.alwaysShow:!0),n.item?n.separator=void 0:n.separator&&(n.hidden=!0),!this.sortByLabel){let c=n.index&&this._inputElements[n.index-1]||void 0;c?.type==="separator"&&!c.buttons&&(o=c),o&&!n.hidden&&(n.separator=o,o=void 0)}})}return this._setElementsToTree(this._sortByLabel&&e?this._itemElements:this._elementTree),this._tree.layout(),!0}toggleCheckbox(){this._elementCheckedEventBufferer.bufferEvents(()=>{let e=this._tree.getFocus().filter(o=>o instanceof rI),t=this._allVisibleChecked(e);for(let o of e)o.checkboxDisabled||(o.checked=!t)})}style(e){this._tree.style(e)}toggleHover(){let e=this._tree.getFocus()[0];if(!e?.saneTooltip||!(e instanceof rI))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);let t=new O;t.add(this._tree.onDidChangeFocus(o=>{o.elements[0]instanceof rI&&this.showHover(o.elements[0])})),this._lastHover&&t.add(this._lastHover),this._elementDisposable.add(t)}_setElementsToTree(e){let t=new Array;for(let o of e)o instanceof dQ?t.push({element:o,collapsible:!1,collapsed:!1,children:o.children.map(n=>({element:n,collapsible:!1,collapsed:!1}))}):t.push({element:o,collapsible:!1,collapsed:!1});this._tree.setChildren(null,t)}_allVisibleChecked(e,t=!0){for(let o=0,n=e.length;o<n;o++){let r=e[o];if(!r.hidden&&r.item.pickable!==!1)if(r.checked)t=!0;else return!1}return t}_updateCheckedObservables(){Ki(e=>{this._allVisibleCheckedObservable.set(this._allVisibleChecked(this._itemElements,!1),e);let t=this._itemElements.filter(o=>o.checked).length;this._checkedCountObservable.set(t,e),this._checkedElementsObservable.set(this.getCheckedElements(),e)})}showHover(e){this._lastHover&&!this._lastHover.isDisposed&&(this.hoverDelegate.onDidHideHover?.(),this._lastHover?.dispose()),!(!e.element||!e.saneTooltip)&&(this._lastHover=this.hoverDelegate.showHover({content:e.saneTooltip,target:e.element,linkHandler:t=>{this.linkOpenerDelegate(t)},appearance:{showPointer:!0},container:this._container,position:{hoverPosition:1}},!1))}};I([bi],sie.prototype,"onDidChangeFocus",1),I([bi],sie.prototype,"onDidChangeSelection",1),sie=I([m(5,F),m(6,Ai)],sie);function orn(a,i){let{text:e,iconOffsets:t}=i;if(!t||t.length===0)return sbo(a,e);let o=ax(e," "),n=e.length-o.length,r=sbo(a,o);if(r)for(let s of r){let l=t[s.start+n]+n;s.start+=l,s.end+=l}return r}function sbo(a,i){let e=i.toLowerCase().indexOf(a.toLowerCase());return e!==-1?[{start:e,end:e+a.length}]:null}function nrn(a,i,e){let t=a.labelHighlights||[],o=i.labelHighlights||[];return t.length&&!o.length?-1:!t.length&&o.length?1:t.length===0&&o.length===0?0:GMe(a.saneSortLabel,i.saneSortLabel,e)}function rrn(a,i={}){xt.registerCommandAndKeybindingRule({weight:200,when:CMe,metadata:{description:d(2504,null)},...a,secondary:SDi(a.primary,a.secondary??[],i)})}function LE(a,i={}){xt.registerCommandAndKeybindingRule({weight:200,when:C.and(C.or(C.equals(gte,"quickPick"),C.equals(gte,"quickTree")),CMe),metadata:{description:d(2507,null)},...a,secondary:SDi(a.primary,a.secondary??[],i)})}var hge=et?256:2048;function SDi(a,i,e={}){return e.withAltMod&&i.push(512+a),e.withCtrlMod&&(i.push(hge+a),e.withAltMod&&i.push(512+hge+a)),e.withShiftMod&&(i.push(1024+a),e.withAltMod&&i.push(1536+a),e.withCtrlMod&&(i.push(hge+1024+a),e.withAltMod&&i.push(512+hge+1024+a))),e.withCmdMod&&et&&(i.push(2048+a),e.withCtrlMod&&i.push(2304+a),e.withAltMod&&(i.push(2560+a),e.withCtrlMod&&i.push(2816+a))),i}function mP(a,i){return e=>{let t=e.get($e).currentQuickInput;if(t)return i&&t.quickNavigate?t.focus(i):t.focus(a)}}LE({id:"quickInput.pageNext",primary:12,handler:mP(6)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});LE({id:"quickInput.pagePrevious",primary:11,handler:mP(7)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});LE({id:"quickInput.first",primary:hge+14,handler:mP(1)},{withAltMod:!0,withCmdMod:!0});LE({id:"quickInput.last",primary:hge+13,handler:mP(3)},{withAltMod:!0,withCmdMod:!0});LE({id:"quickInput.next",primary:18,handler:mP(4)},{withCtrlMod:!0});LE({id:"quickInput.previous",primary:16,handler:mP(5)},{withCtrlMod:!0});var abo=d(2505,null),lbo=d(2506,null);et?(LE({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:2066,handler:mP(8,4),metadata:{description:abo}}),LE({id:"quickInput.nextSeparator",primary:2578,secondary:[2322],handler:mP(8)},{withCtrlMod:!0}),LE({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:2064,handler:mP(9,5),metadata:{description:lbo}}),LE({id:"quickInput.previousSeparator",primary:2576,secondary:[2320],handler:mP(9)},{withCtrlMod:!0})):(LE({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:530,handler:mP(8,4),metadata:{description:abo}}),LE({id:"quickInput.nextSeparator",primary:2578,handler:mP(8)}),LE({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:528,handler:mP(9,5),metadata:{description:lbo}}),LE({id:"quickInput.previousSeparator",primary:2576,handler:mP(9)}));xt.registerCommandAndKeybindingRule({id:"quickInput.accept",primary:3,weight:200,when:C.and(C.notEquals(gte,"quickWidget"),CMe,C.not("isComposing")),metadata:{description:d(2503,null)},handler:a=>{a.get($e).currentQuickInput?.accept()},secondary:SDi(3,[],{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0,withShiftMod:!0})});LE({id:"quickInput.acceptInBackground",when:C.and(CMe,C.equals(gte,"quickPick"),C.or(Wg.negate(),Eho)),primary:17,weight:250,handler:a=>{a.get($e).currentQuickInput?.accept(!0)}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});rrn({id:"quickInput.hide",primary:9,handler:a=>{a.get($e).currentQuickInput?.hide()}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0});LE({id:"quickInput.toggleCheckbox",when:C.and(CMe,C.or(C.equals(gte,"quickPick"),C.equals(gte,"quickTree")),Wg.negate()),primary:10,handler:a=>{a.get($e).toggle()}});LE({id:"quickInput.toggleHover",primary:hge|10,handler:a=>{a.get($e).toggleHover()}});var hot=_,F1t=class extends k{constructor(){super(...arguments);this._onDidChangeCheckboxState=this._register(new T);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event}setCheckboxState(e,t){this._onDidChangeCheckboxState.fire({item:e,checked:t})}},cq=class extends k{constructor(e,t,o,n,r,s,l){super();this._hoverDelegate=e;this._buttonTriggeredEmitter=t;this.onCheckedEvent=o;this._checkboxStateHandler=n;this._toggleStyles=r;this._contextMenuService=s;this._themeService=l;this.templateId=cq.ID;this._onDidDisposeFocusedElement=this._register(new T);this.onDidDisposeFocusedElement=this._onDidDisposeFocusedElement.event}static{this.ID="quickInputTreeElement"}renderTemplate(e){let t=new O,o=D(e,hot(".quick-input-tree-entry")),n=t.add(new $K("",!1,{...Ag,size:15}));o.appendChild(n.domNode);let r=D(o,hot("label.quick-input-tree-label")),s=D(r,hot(".quick-input-tree-rows")),l=D(s,hot(".quick-input-tree-row")),c=CI(l,hot(".quick-input-tree-icon")),u=t.add(new ld(l,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this._hoverDelegate})),p=t.add(new Kp(o,this._contextMenuService,{actionViewItemProvider:jK(this._toggleStyles),hoverDelegate:this._hoverDelegate,icon:!0,label:!1}));return p.getElement().classList.add("quick-input-tree-entry-action-bar"),{toDisposeTemplate:t,entry:o,checkbox:n,icon:c,label:u,actionBar:p,toDisposeElement:new O}}renderElement(e,t,o,n){let r=o.toDisposeElement,s=e.element;if(s.pickable===!1)o.checkbox.domNode.style.display="none";else{let h=o.checkbox;h.domNode.style.display="",h.checked=s.checked??!1,r.add(U.filter(this.onCheckedEvent,g=>g.item===s)(g=>h.checked=g.checked)),s.disabled&&h.disable(),r.add(h.onChange(g=>this._checkboxStateHandler.setCheckboxState(s,h.checked)))}if(s.iconPath){let h=cm(this._themeService.getColorTheme().type)?s.iconPath.dark:s.iconPath.light??s.iconPath.dark,g=A.revive(h);o.icon.className="quick-input-tree-icon",o.icon.style.backgroundImage=cl(g)}else o.icon.style.backgroundImage="",o.icon.className=s.iconClass?`quick-input-tree-icon ${s.iconClass}`:"";let{labelHighlights:l,descriptionHighlights:c}=e.filterData||{},u;s.description&&(u={markdown:{value:Cr(s.description),supportThemeIcons:!0},markdownNotSupportedFallback:s.description}),o.label.setLabel(s.label,s.description,{matches:l,descriptionMatches:c,extraClasses:s.iconClasses,italic:s.italic,strikethrough:s.strikethrough,labelEscapeNewLines:!0,descriptionTitle:u});let p=s.buttons;if(p&&p.length){let{primary:h,secondary:g}=M8(p,"quick-input-tree",f=>this._buttonTriggeredEmitter.fire({item:s,button:f}));o.actionBar.setActions(h,g),o.entry.classList.add("has-actions")}else o.actionBar.setActions([]),o.entry.classList.remove("has-actions")}disposeElement(e,t,o,n){Is(o.entry)&&this._onDidDisposeFocusedElement.fire(),o.toDisposeElement.clear(),o.actionBar.setActions([])}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}};cq=I([m(5,Xe),m(6,Pe)],cq);var W1t=class{getHeight(i){return 22}getTemplateId(i){return cq.ID}};function kAe(a){let i=!1,e=!1,t=!1;for(let n of a){switch(n.element?.checked){case"mixed":t=!0;break;case!0:i=!0;break;default:e=!0;break}if(i&&e&&t)break}return e?t||i?"mixed":!1:t?"mixed":i}var V1t=class{constructor(i){this.onCheckedEvent=i}getWidgetAriaLabel(){return d(2520,null)}getAriaLabel(i){return i.ariaLabel||[i.label,i.description].map(e=>AK(e)).filter(e=>!!e).join(", ")}getWidgetRole(){return"tree"}getRole(i){return"checkbox"}isChecked(i){return{get value(){return i.checked==="mixed"?"mixed":!!i.checked},onDidChange:e=>U.filter(this.onCheckedEvent,t=>t.item===i)(t=>e())}}};var B1t=class{constructor(){this.filterValue="";this.matchOnLabel=!0;this.matchOnDescription=!1}filter(i,e){if(!this.filterValue||!(this.matchOnLabel||this.matchOnDescription))return i.children?{visibility:2,data:{}}:{visibility:1,data:{}};let t=this.matchOnLabel?zB(this.filterValue,MA(i.label))??void 0:void 0,o=this.matchOnDescription?zB(this.filterValue,MA(i.description||""))??void 0:void 0;return{visibility:e===1?1:t||o?1:i.children?2:0,data:{labelHighlights:t,descriptionHighlights:o}}}};var H1t=class extends k{constructor(){super(...arguments);this._sortByLabel=!0}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}compare(e,t){if(!this._sortByLabel)return 0;if(e.label<t.label)return-1;if(e.label>t.label)return 1;if(e.description&&t.description){if(e.description<t.description)return-1;if(e.description>t.description)return 1}else{if(e.description)return-1;if(t.description)return 1}return 0}};var srn=_,arn="quick-input-tree-flat",IDi=class{constructor(){this._elementIds=new WeakMap;this._counter=0}getId(i){let e=i.id;return e!==void 0||(e=this._elementIds.get(i),e!==void 0)||(e=`__generated_${this._counter++}`,this._elementIds.set(i,e)),e}},EAe=class extends k{constructor(e,t,o,n){super();this.instantiationService=n;this._onDidTriggerButton=this._register(new T);this.onDidTriggerButton=this._onDidTriggerButton.event;this._onDidChangeCheckboxState=this._register(new T);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidCheckedLeafItemsChange=this._register(new T);this.onDidChangeCheckedLeafItems=this._onDidCheckedLeafItemsChange.event;this._onLeave=this._register(new T);this.onLeave=this._onLeave.event;this._onDidAccept=this._register(new T);this.onDidAccept=this._onDidAccept.event;this._container=D(e,srn(".quick-input-tree")),this._checkboxStateHandler=this._register(new F1t),this._renderer=this._register(this.instantiationService.createInstance(cq,t,this._onDidTriggerButton,this.onDidChangeCheckboxState,this._checkboxStateHandler,o.toggle)),this._filter=this.instantiationService.createInstance(B1t),this._sorter=this._register(new H1t),this._tree=this._register(this.instantiationService.createInstance(hf,"QuickInputTree",this._container,new W1t,[this._renderer],{accessibilityProvider:new V1t(this.onDidChangeCheckboxState),horizontalScrolling:!1,multipleSelectionSupport:!1,findWidgetEnabled:!1,alwaysConsumeMouseWheel:!0,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none",expandOnDoubleClick:!0,expandOnlyOnTwistieClick:!0,disableExpandOnSpacebar:!0,sorter:this._sorter,filter:this._filter,identityProvider:new IDi})),this._register(this._renderer.onDidDisposeFocusedElement(()=>{this._tree.domFocus()})),this.registerCheckboxStateListeners(),this.registerOnDidChangeFocus()}get tree(){return this._tree}get renderer(){return this._renderer}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get sortByLabel(){return this._sorter.sortByLabel}set sortByLabel(e){this._sorter.sortByLabel=e,this._tree.resort(null,!0)}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}filter(e){this._filter.filterValue=e,this._tree.refilter()}updateFilterOptions(e){e.matchOnLabel!==void 0&&(this._filter.matchOnLabel=e.matchOnLabel),e.matchOnDescription!==void 0&&(this._filter.matchOnDescription=e.matchOnDescription),this._tree.refilter()}setTreeData(e){let t=!1,o=r=>{let s;return r.children&&r.children.length>0&&(t=!0,s=r.children.map(l=>o(l)),r.checked=kAe(s)),{element:r,children:s,collapsible:!!s,collapsed:r.collapsed?3:2}},n=e.map(r=>o(r));this._tree.setChildren(null,n),this._container.classList.toggle(arn,!t)}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}focus(e){switch(e){case 1:this._tree.scrollTop=0,this._tree.focusFirst();break;case 2:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,o=>t?!0:(t=!t,!1));break}case 3:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast();break;case 4:{let t=this._tree.getFocus();this._tree.focusNext(void 0,!1,void 0,n=>(this._tree.reveal(n.element),!0));let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 5:{let t=this._tree.getFocus();this._tree.focusPrevious(void 0,!1,void 0,n=>(this._tree.reveal(n.element),!0));let o=this._tree.getFocus();t.length&&t[0]===o[0]&&this._onLeave.fire();break}case 6:this._tree.focusNextPage(void 0,t=>(this._tree.reveal(t.element),!0));break;case 7:this._tree.focusPreviousPage(void 0,t=>(this._tree.reveal(t.element),!0));break;case 8:case 9:return}}registerCheckboxStateListeners(){this._register(this._tree.onDidOpen(e=>{let t=e.element;if(!t||t.disabled)return;if(t.pickable===!1){this._tree.setFocus([t]),this._onDidAccept.fire();return}let o=e.browserEvent?.target;o&&o.classList.contains(qf.CLASS_NAME)||this.updateCheckboxState(t,t.checked===!0)})),this._register(this._checkboxStateHandler.onDidChangeCheckboxState(e=>{this.updateCheckboxState(e.item,e.checked===!0,!0),this._tree.setFocus([e.item]),this._tree.setSelection([e.item])}))}updateCheckboxState(e,t,o=!1){if((e.checked??!1)===t)return;e.checked=t,o||this._tree.rerender(e);let n=new Set,r=[...this._tree.getNode(e).children];for(;r.length;){let l=r.shift();l?.element&&!n.has(l.element)&&(n.add(l.element),(l.element.checked??!1)!==e.checked&&(l.element.checked=e.checked,this._tree.rerender(l.element)),r.push(...l.children))}let s=this._tree.getParentElement(e);for(;s;){let l=[...this._tree.getNode(s).children],c=kAe(l);(s.checked??!1)!==c&&(s.checked=c,this._tree.rerender(s)),s=this._tree.getParentElement(s)}this._onDidChangeCheckboxState.fire({item:e,checked:e.checked??!1}),this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}registerOnDidChangeFocus(){this._register(this._tree.onDidChangeFocus(e=>{let t=this._tree.getFocus().findLast(o=>o!==null);this._tree.setSelection(t?[t]:[],e.browserEvent)}))}getCheckedLeafItems(){let e=new Set,t=[...this._tree.getNode().children],o=new Array;for(;t.length;){let n=t.shift();!n?.element||e.has(n.element)||n.element.checked&&(e.add(n.element),t.push(...n.children),n.element.children||o.push(n.element))}return o}getActiveItems(){return this._tree.getFocus().filter(e=>e!==null)}toggleCheckbox(){for(let e of this.getActiveItems())e.pickable!==!1&&!e.disabled&&this.updateCheckboxState(e,e.checked!==!0)}checkAll(e){let t=new Set,o=[...this._tree.getNode().children],n=!1;for(;o.length;){let r=o.shift();!r?.element||t.has(r.element)||r.element.checked!==e&&(n=!0,r.element.checked=e,o.push(...r.children),t.add(r.element),this._tree.rerender(r.element),this._onDidChangeCheckboxState.fire({item:r.element,checked:r.element.checked}))}n&&this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}};EAe=I([m(3,F)],EAe);var got=class a extends mte{constructor(e){super(e);this.type="quickTree";this._value=De("value","");this._ariaLabel=De("ariaLabel",void 0);this._placeholder=De("placeholder",void 0);this._matchOnDescription=De("matchOnDescription",!1);this._matchOnLabel=De("matchOnLabel",!0);this._sortByLabel=De("sortByLabel",!0);this._activeItems=De("activeItems",[]);this._itemTree=De("itemTree",[]);this.onDidChangeValue=U.fromObservable(this._value,this._store);this.onDidChangeActive=U.fromObservable(this._activeItems,this._store);this._onDidChangeCheckedLeafItems=this._register(new T);this.onDidChangeCheckedLeafItems=this._onDidChangeCheckedLeafItems.event;this._onDidChangeCheckboxState=this._register(new T);this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event;this._onDidAcceptEmitter=this._register(new T);this.onDidAccept=U.any(e.onDidAccept,this._onDidAcceptEmitter.event),this._registerAutoruns(),this._register(e.tree.onDidChangeCheckedLeafItems(t=>this._onDidChangeCheckedLeafItems.fire(t))),this._register(e.tree.onDidChangeCheckboxState(t=>this._onDidChangeCheckboxState.fire(t.item))),this._register(e.tree.tree.onDidChangeFocus(t=>{this._activeItems.set(e.tree.getActiveItems(),void 0)}))}static{this.DEFAULT_ARIA_LABEL=d(2521,null)}get value(){return this._value.get()}set value(e){this._value.set(e,void 0)}get ariaLabel(){return this._ariaLabel.get()}set ariaLabel(e){this._ariaLabel.set(e,void 0)}get placeholder(){return this._placeholder.get()}set placeholder(e){this._placeholder.set(e,void 0)}get matchOnDescription(){return this._matchOnDescription.get()}set matchOnDescription(e){this._matchOnDescription.set(e,void 0)}get matchOnLabel(){return this._matchOnLabel.get()}set matchOnLabel(e){this._matchOnLabel.set(e,void 0)}get sortByLabel(){return this._sortByLabel.get()}set sortByLabel(e){this._sortByLabel.set(e,void 0)}get activeItems(){return this._activeItems.get()}set activeItems(e){this._activeItems.set(e,void 0)}get itemTree(){return this._itemTree.get()}get onDidTriggerItemButton(){return this.ui.tree.onDidTriggerButton}get checkedLeafItems(){return this.ui.tree.getCheckedLeafItems()}setItemTree(e){this._itemTree.set(e,void 0)}getParent(e){return this.ui.tree.tree.getParentElement(e)??void 0}expand(e){this.ui.tree.tree.expand(e)}collapse(e){this.ui.tree.tree.collapse(e)}isCollapsed(e){return this.ui.tree.tree.isCollapsed(e)}focusOnInput(){this.ui.inputBox.setFocus()}reveal(e){this.ui.tree.tree.reveal(e),this.ui.tree.tree.setFocus([e])}show(){if(!this.visible){let t={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description,checkAll:!0,checkBox:!0,inputBox:!0,progressBar:!0,visibleCount:!0,count:!0,ok:!0,list:!1,tree:!0,message:!!this.validationMessage,customButton:!1};this.ui.setVisibilities(t),this.visibleDisposables.add(this.ui.inputBox.onDidChange(o=>{this._value.set(o,void 0)})),this.visibleDisposables.add(this.ui.tree.onDidChangeCheckboxState(o=>{let n=kAe([...this.ui.tree.tree.getNode().children]);this.ui.checkAll.checked!==n&&(this.ui.checkAll.checked=n)})),this.visibleDisposables.add(this.ui.checkAll.onChange(o=>{let n=this.ui.checkAll.checked;this.ui.tree.checkAll(n)})),this.visibleDisposables.add(this.ui.tree.onDidChangeCheckedLeafItems(o=>{this.ui.count.setCount(o.length)}))}super.show(),ox(()=>this.ui.count.setCount(this.ui.tree.getCheckedLeafItems().length));let e=kAe([...this.ui.tree.tree.getNode().children]);this.ui.checkAll.checked!==e&&(this.ui.checkAll.checked=e)}update(){if(!this.visible)return;let e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description,checkAll:!0,checkBox:!0,inputBox:!0,progressBar:!0,visibleCount:!0,count:!0,ok:!0,tree:!0,message:!!this.validationMessage};this.ui.setVisibilities(e),super.update()}_registerListeners(){}_registerAutoruns(){this.registerVisibleAutorun(e=>{let t=this._value.read(e);this.ui.inputBox.value=t,this.ui.tree.filter(t)}),this.registerVisibleAutorun(e=>{let t=this._ariaLabel.read(e);t||(t=this.placeholder||a.DEFAULT_ARIA_LABEL,this.title&&(t+=` - ${this.title}`)),this.ui.list.ariaLabel!==t&&(this.ui.list.ariaLabel=t??null),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t??"input")}),this.registerVisibleAutorun(e=>{let t=this._placeholder.read(e);this.ui.inputBox.placeholder!==t&&(this.ui.inputBox.placeholder=t??"")}),this.registerVisibleAutorun(e=>{let t=this._matchOnLabel.read(e),o=this._matchOnDescription.read(e);this.ui.tree.updateFilterOptions({matchOnLabel:t,matchOnDescription:o})}),this.registerVisibleAutorun(e=>{let t=this._sortByLabel.read(e);this.ui.tree.sortByLabel=t}),this.registerVisibleAutorun(e=>{let t=this._itemTree.read(e);this.ui.tree.setTreeData(t)})}registerVisibleAutorun(e){this._register(ve(t=>{this._visible.read(t)&&e(t)}))}focus(e){this.ui.tree.focus(e),this.ui.tree.tree.domFocus()}accept(e){this._onDidAcceptEmitter.fire()}};var hP=_,yDi="workbench.quickInput.viewState",cie=class extends k{constructor(e,t,o,n,r,s){super();this.options=e;this.layoutService=t;this.instantiationService=o;this.storageService=r;this.contextMenuService=s;this.enabled=!0;this.onDidAcceptEmitter=this._register(new T);this.onDidCustomEmitter=this._register(new T);this.onDidTriggerButtonEmitter=this._register(new T);this.keyMods={ctrlCmd:!1,alt:!1,shift:!1};this.controller=null;this.onShowEmitter=this._register(new T);this.onShow=this.onShowEmitter.event;this.onHideEmitter=this._register(new T);this.onHide=this.onHideEmitter.event;this._alignment=De(this,"top");this.alignment=this._alignment;this.backButton=eVt;this.inQuickInputContext=who.bindTo(n),this.quickInputTypeContext=Cho.bindTo(n),this.endOfQuickInputBoxContext=kho.bindTo(n),this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(U.runAndSubscribe(Of,({window:l,disposables:c})=>this.registerKeyModsListeners(l,c),{window:ut,disposables:this._store})),this._register(oQi(l=>{this.ui&&Me(this.ui.container)===l&&(this.reparentUI(this.layoutService.mainContainer),this.layout(this.layoutService.mainContainerDimension,this.layoutService.mainContainerOffset.quickPickTop))})),this.viewState=this.loadViewState()}static{this.MAX_WIDTH=600}get currentQuickInput(){return this.controller??void 0}get container(){return this._container}registerKeyModsListeners(e,t){let o=n=>{this.keyMods.ctrlCmd=n.ctrlKey||n.metaKey,this.keyMods.alt=n.altKey,this.keyMods.shift=n.shiftKey};for(let n of[ne.KEY_DOWN,ne.KEY_UP,ne.MOUSE_DOWN])t.add($(e,n,o,!0))}getUI(e){if(this.ui)return e&&Me(this._container)!==Me(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;let t=D(this._container,hP(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";let o=Pr(t),n=D(t,hP(".quick-input-titlebar")),r=this._register(new Kp(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:jK(this.styles.toggle),icon:!0,label:!1}));r.getElement().classList.add("quick-input-left-action-bar");let s=D(n,hP(".quick-input-title")),l=this._register(new Kp(n,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:jK(this.styles.toggle),icon:!0,label:!1}));l.getElement().classList.add("quick-input-right-action-bar");let c=D(t,hP(".quick-input-header")),u=this._register(new $K(d(2512,null),!1,{...Ag,size:15}));D(c,u.domNode),this._register(u.onChange(()=>{let Se=u.checked;se.setAllVisibleChecked(Se===!0)})),this._register($(u.domNode,ne.CLICK,Se=>{(Se.x||Se.y)&&f.setFocus()}));let p=D(c,hP(".quick-input-description")),h=D(c,hP(".quick-input-and-message")),g=D(h,hP(".quick-input-filter")),f=this._register(new A1t(g,this.styles.inputBox,this.styles.toggle));f.setAttribute("aria-describedby",`${this.idPrefix}message`);let v=D(g,hP(".quick-input-visible-count"));v.setAttribute("aria-live","polite"),v.setAttribute("aria-atomic","true");let b=this._register(new eb(v,{countFormat:d(2514,null)},this.styles.countBadge)),S=D(g,hP(".quick-input-count"));S.setAttribute("aria-live","polite");let y=this._register(new eb(S,{countFormat:d(2513,null)},this.styles.countBadge)),w=this._register(new Kp(c,this.contextMenuService,{hoverDelegate:this.options.hoverDelegate,actionViewItemProvider:jK(this.styles.toggle),icon:!0,label:!1}));w.getElement().classList.add("quick-input-inline-action-bar");let x=D(c,hP(".quick-input-action")),E=this._register(new Pi(x,this.styles.button));E.label=d(2509,null),this._register(E.onDidClick(Se=>{this.onDidAcceptEmitter.fire()}));let M=D(c,hP(".quick-input-action")),N=this._register(new Pi(M,{...this.styles.button,supportIcons:!0}));N.label=d(2508,null),this._register(N.onDidClick(Se=>{this.onDidCustomEmitter.fire()}));let V=D(h,hP(`#${this.idPrefix}message.quick-input-message`)),H=this._register(new Cv(t,this.styles.progressBar));H.getContainer().classList.add("quick-input-progress");let K=D(t,hP(".quick-input-html-widget"));K.tabIndex=-1;let j=D(t,hP(".quick-input-description")),J=this.idPrefix+"list",se=this._register(this.instantiationService.createInstance(sie,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,J,this.styles));f.setAttribute("aria-controls",J),this._register(se.onDidChangeFocus(()=>{if(f.hasFocus()){let Se=se.getActiveDescendant();Se?(f.setAttribute("aria-activedescendant",Se),f.setListFocusMode(!0)):(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))}})),this._register(se.onChangedAllVisibleChecked(Se=>{u.checked=Se})),this._register(se.onChangedVisibleCount(Se=>{b.setCount(Se)})),this._register(se.onChangedCheckedCount(Se=>{ox(()=>y.setCount(Se))})),this._register(se.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),this.controller instanceof hte&&this.controller.canSelectMany&&se.clearFocus())},0)}));let ae=this._register(this.instantiationService.createInstance(EAe,t,this.options.hoverDelegate,this.styles));this._register(ae.tree.onDidChangeFocus(()=>{if(f.hasFocus()){let Se=ae.getActiveDescendant();Se?(f.setAttribute("aria-activedescendant",Se),f.setListFocusMode(!0)):(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))}})),this._register(ae.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),ae.tree.setFocus([]))},0)})),this._register(ae.onDidAccept(()=>{this.onDidAcceptEmitter.fire()})),this._register(ae.tree.onDidChangeContentHeight(()=>this.updateLayout()));let ce=nr(t);return this._register(ce),this._register($(t,ne.FOCUS,Se=>{let Re=this.getUI();if(ms(Se.relatedTarget,Re.inputContainer)){let xe=Re.inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==xe&&this.endOfQuickInputBoxContext.set(xe)}ms(Se.relatedTarget,Re.container)||(this.inQuickInputContext.set(!0),this.previousFocusElement=go(Se.relatedTarget)?Se.relatedTarget:void 0)},!0)),this._register(ce.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(1),this.inQuickInputContext.set(!1),this.endOfQuickInputBoxContext.set(!1),this.previousFocusElement=void 0})),this._register(f.onKeyDown(Se=>{let Re=this.getUI().inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==Re&&this.endOfQuickInputBoxContext.set(Re),eF(Se.keyCode)||(f.removeAttribute("aria-activedescendant"),f.setListFocusMode(!1))})),this._register($(t,ne.FOCUS,Se=>{f.setFocus()})),this.dndController=this._register(this.instantiationService.createInstance(fot,this._container,t,[{node:n,includeChildren:!0,excludeNodes:[r.getElement(),l.getElement()]},{node:c,includeChildren:!1}],this.viewState)),this._register(ve(Se=>{let Re=this.dndController?.dndViewState.read(Se);Re&&(Re.top!==void 0&&Re.left!==void 0?this.viewState={...this.viewState,top:Re.top,left:Re.left}:this.viewState=void 0,this.updateLayout(),Re.done&&this.saveViewState(this.viewState))})),this._register(ve(Se=>{this._alignment.set(this.dndController.alignment.read(Se),void 0)})),this.ui={container:t,styleSheet:o,leftActionBar:r,titleBar:n,title:s,description1:j,description2:p,widget:K,rightActionBar:l,inlineActionBar:w,checkAll:u,inputContainer:h,filterContainer:g,inputBox:f,visibleCountContainer:v,visibleCount:b,countContainer:S,count:y,okContainer:x,ok:E,message:V,customButtonContainer:M,customButton:N,list:se,tree:ae,progressBar:H,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:Se=>this.show(Se),hide:()=>this.hide(),setVisibilities:Se=>this.setVisibilities(Se),setEnabled:Se=>this.setEnabled(Se),setContextKey:Se=>this.options.setContextKey(Se),linkOpenerDelegate:Se=>this.options.linkOpenerDelegate(Se)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,D(this._container,this.ui.container),this.dndController?.reparentUI(this._container))}pick(e,t={},o=Ie.None){return new Promise((n,r)=>{let s=p=>{s=n,t.onKeyMods?.(l.keyMods),n(p)};if(o.isCancellationRequested){s(void 0);return}let l=this.createQuickPick({useSeparators:!0}),c,u=[l,l.onDidAccept(()=>{if(l.canSelectMany)s(l.selectedItems.slice()),l.hide();else{let p=l.activeItems[0];p&&(s(p),l.hide())}}),l.onDidChangeActive(p=>{let h=p[0];h&&t.onDidFocus&&t.onDidFocus(h)}),l.onDidChangeSelection(p=>{if(!l.canSelectMany){let h=p[0];h&&(s(h),l.hide())}}),l.onDidTriggerItemButton(p=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton({...p,removeItem:()=>{let h=l.items.indexOf(p.item);if(h!==-1){let g=l.items.slice(),f=g.splice(h,1),v=l.activeItems.filter(S=>S!==f[0]),b=l.keepScrollPosition;l.keepScrollPosition=!0,l.items=g,v&&(l.activeItems=v),l.keepScrollPosition=b}}})),l.onDidTriggerSeparatorButton(p=>t.onDidTriggerSeparatorButton?.(p)),l.onDidChangeValue(p=>{c&&!p&&(l.activeItems.length!==1||l.activeItems[0]!==c)&&(l.activeItems=[c])}),o.onCancellationRequested(()=>{l.hide()}),l.onDidHide(()=>{je(u),s(void 0)})];l.title=t.title,t.value&&(l.value=t.value),l.canSelectMany=!!t.canPickMany,l.placeholder=t.placeHolder,l.prompt=t.prompt,l.ignoreFocusOut=!!t.ignoreFocusLost,l.matchOnDescription=!!t.matchOnDescription,l.matchOnDetail=!!t.matchOnDetail,t.sortByLabel!==void 0&&(l.sortByLabel=t.sortByLabel),l.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,l.quickNavigate=t.quickNavigate,l.hideInput=!!t.hideInput,l.contextKey=t.contextKey,l.anchor=t.anchor,l.busy=!0,Promise.all([e,t.activeItem]).then(([p,h])=>{c=h,l.busy=!1,l.items=p,l.canSelectMany&&(l.selectedItems=p.filter(g=>g.type!=="separator"&&g.picked)),c&&(l.activeItems=[c])}),l.show(),Promise.resolve(e).then(void 0,p=>{r(p),l.hide()})})}setValidationOnInput(e,t){t&&We(t)?(e.severity=wt.Error,e.validationMessage=t):t&&!We(t)?(e.severity=t.severity,e.validationMessage=t.content):(e.severity=wt.Ignore,e.validationMessage=void 0)}input(e={},t=Ie.None){return new Promise(o=>{if(t.isCancellationRequested){o(void 0);return}let n=this.createInputBox(),r=e.validateInput||(()=>Promise.resolve(void 0)),s=U.debounce(n.onDidChangeValue,(p,h)=>h,100),l=e.value||"",c=Promise.resolve(r(l)),u=[n,s(p=>{p!==l&&(c=Promise.resolve(r(p)),l=p),c.then(h=>{p===l&&this.setValidationOnInput(n,h)})}),n.onDidAccept(()=>{let p=n.value;p!==l&&(c=Promise.resolve(r(p)),l=p),c.then(h=>{!h||!We(h)&&h.severity!==wt.Error?(o(p),n.hide()):p===l&&this.setValidationOnInput(n,h)})}),t.onCancellationRequested(()=>{n.hide()}),n.onDidHide(()=>{je(u),o(void 0)})];n.title=e.title,n.value=e.value||"",n.valueSelection=e.valueSelection,n.prompt=e.prompt,n.placeholder=e.placeHolder,n.password=!!e.password,n.ignoreFocusOut=!!e.ignoreFocusLost,n.show()})}createQuickPick(e={useSeparators:!1}){let t=this.getUI(!0);return new hte(t)}createInputBox(){let e=this.getUI(!0);return new XWt(e)}setAlignment(e){this.controller?.anchor||this.dndController?.setAlignment(e)}createQuickWidget(){let e=this.getUI(!0);return new JWt(e)}createQuickTree(){let e=this.getUI(!0);return new got(e)}show(e){let t=this.getUI(!0),o=this.controller;this.controller=e,o?.didHide(),this.setEnabled(!0),t.leftActionBar.setActions([]),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",Ii(t.widget),t.rightActionBar.setActions([]),t.inlineActionBar.setActions([]),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(wt.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),t.countContainer.style.right="4px",Ii(t.message),t.progressBar.stop(),t.progressBar.getContainer().setAttribute("aria-hidden","true"),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.tree.updateFilterOptions({matchOnDescription:!1,matchOnLabel:!0}),t.tree.sortByLabel=!0,t.ignoreFocusOut=!1,t.inputBox.toggles=void 0,t.inputBox.actions=void 0;let n=this.options.backKeybindingLabel();eVt.tooltip=n?d(2511,null,n):d(2510,null),t.container.style.display="",this.updateLayout(),this.dndController?.setEnabled(!e.anchor),this.dndController?.layoutContainer(),e.anchor?this._alignment.set("custom",void 0):this._alignment.set(this.dndController?.alignment.get()??"top",void 0),this.onShowEmitter.fire(),t.inputBox.setFocus(),this.quickInputTypeContext.set(e.type)}isVisible(){return!!this.ui&&this.ui.container.style.display!=="none"}setVisibilities(e){let t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=e.description&&!(e.inputBox||e.checkAll)?"":"none",t.checkAll.domNode.style.display=e.checkAll?"":"none",t.inputContainer.style.display=e.inputBox?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.displayed=!!e.list,t.tree.displayed=!!e.tree,t.container.classList.toggle("show-checkboxes",!!e.checkBox),t.container.classList.toggle("hidden-input",!e.inputBox&&!e.description),this.updateLayout()}setEnabled(e){if(e!==this.enabled){this.enabled=e;let t=this.getUI();for(let o=0;o<t.leftActionBar.getItemsLength();o++){let n=t.leftActionBar.getItemAction(o);n&&(n.enabled=e)}for(let o=0;o<t.rightActionBar.getItemsLength();o++){let n=t.rightActionBar.getItemAction(o);n&&(n.enabled=e)}e?t.checkAll.enable():t.checkAll.disable(),t.inputBox.enabled=e,t.ok.enabled=e,t.list.enabled=e}}hide(e){let t=this.controller;if(!t)return;t.willHide(e);let o=this.ui?.container,n=o&&!Is(o);if(this.controller=null,this.onHideEmitter.fire(),o&&(o.style.display="none"),!n){let r=this.previousFocusElement;for(;r&&!r.offsetParent;)r=r.parentElement??void 0;r?.offsetParent?(r.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}t.didHide(e)}focus(){if(this.isVisible()){let e=this.getUI();e.inputBox.enabled?e.inputBox.setFocus():e.list.domFocus()}}toggle(){this.isVisible()&&(this.controller instanceof hte&&this.controller.canSelectMany?this.getUI().list.toggleCheckbox():this.controller instanceof got&&this.getUI().tree.toggleCheckbox())}toggleHover(){this.isVisible()&&this.controller instanceof hte&&this.getUI().list.toggleHover()}navigate(e,t){this.isVisible()&&this.getUI().list.displayed&&(this.getUI().list.focus(e?4:5),t&&this.controller instanceof hte&&(this.controller.quickNavigate=t))}async accept(e={alt:!1,ctrlCmd:!1,shift:!1}){this.keyMods.alt=e.alt,this.keyMods.ctrlCmd=e.ctrlCmd,this.keyMods.shift=e.shift,this.onDidAcceptEmitter.fire()}async back(){this.onDidTriggerButtonEmitter.fire(this.backButton)}async cancel(e){this.hide(e)}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui&&this.isVisible()){let e=this.ui.container.style,t=Math.min(this.dimension.width*.62,cie.MAX_WIDTH);e.width=t+"px";let o=this.dimension&&this.dimension.height*.4;if(this.controller?.anchor){let n=this.layoutService.getContainer(zi()).getBoundingClientRect(),r=lQe(this.controller.anchor);t=380,o=this.dimension?Math.min(this.dimension.height*.2,200):200;let s=Math.floor(o)+6+26+16,{top:l,left:c,right:u,bottom:p,anchorAlignment:h,anchorPosition:g}=nkt(n,{width:t,height:s},r,{anchorPosition:1});h===1?(e.right=`${u}px`,e.left="initial"):(e.left=`${c}px`,e.right="initial"),g===1?(e.bottom=`${p}px`,e.top="initial"):(e.top=`${l}px`,e.bottom="initial"),e.width=`${t}px`,e.height=""}else e.top=`${this.viewState?.top!==void 0?Math.round(this.dimension.height*this.viewState.top):this.titleBarOffset}px`,e.left=`${Math.round(this.dimension.width*(this.viewState?.left??.5)-t/2)}px`,e.right="",e.bottom="",e.height="";this.ui.inputBox.layout(),this.ui.list.layout(o),this.ui.tree.layout(o)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){let{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:o,widgetBorder:n}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e??"",this.ui.container.style.backgroundColor=t??"",this.ui.container.style.color=o??"",this.ui.container.style.border=n?`1px solid ${n}`:"",this.ui.list.style(this.styles.list),this.ui.tree.tree.style(this.styles.list);let r=[];this.styles.pickerGroup.pickerGroupBorder&&r.push(`.quick-input-list .quick-input-list-entry { border-top-color:  ${this.styles.pickerGroup.pickerGroupBorder}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(`.quick-input-list .quick-input-list-separator { color:  ${this.styles.pickerGroup.pickerGroupForeground}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(".quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }"),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(r.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&r.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&r.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&r.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&r.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&r.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),r.push("}"));let s=r.join(`
`);s!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=s)}}loadViewState(){try{let e=JSON.parse(this.storageService.get(yDi,-1,"{}"));if(e.top!==void 0||e.left!==void 0)return e}catch{}}saveViewState(e){this.layoutService.activeContainer===this.layoutService.mainContainer&&(e!==void 0?this.storageService.store(yDi,JSON.stringify(e),-1,1):this.storageService.remove(yDi,-1))}};cie=I([m(1,Kl),m(2,F),m(3,X),m(4,de),m(5,Xe)],cie);var fot=class extends k{constructor(e,t,o,n,r,s,l){super();this._container=e;this._quickInputContainer=t;this._quickInputDragAreas=o;this._layoutService=r;this.configurationService=l;this.dndViewState=De(this,void 0);this._enabled=!0;this._snapThreshold=20;this._snapLineHorizontalRatio=.25;this._alignment=De(this,"top");this.alignment=this._alignment;this._quickInputAlignmentContext=jet.bindTo(s);let c=_Qe(this.configurationService)==="custom";this._controlsOnLeft=c&&xm===1,this._controlsOnRight=c&&(xm===3||xm===2),this._registerLayoutListener(),this.registerMouseListeners(),this.dndViewState.set({...n,done:!0},void 0),n?.top!==void 0&&n?.left!==void 0&&this._setAlignmentState(void 0)}reparentUI(e){this._container=e}layoutContainer(e=this._layoutService.activeContainerDimension){if(!this._enabled)return;let t=this.dndViewState.get(),o=this._quickInputContainer.getBoundingClientRect();if(t?.top!==void 0&&t?.left!==void 0){let n=Math.round(t.left*100)/100,r=e.width,s=o.width,l=n*r-s/2;this._layout(t.top*e.height,l)}}setEnabled(e){this._enabled=e,this._quickInputContainer.classList.toggle("no-drag",!e)}_setAlignmentState(e){this._quickInputAlignmentContext.set(e),this._alignment.set(e??"custom",void 0)}setAlignment(e,t=!0){e==="top"?(this.dndViewState.set({top:this._getTopSnapValue()/this._container.clientHeight,left:(this._getCenterXSnapValue()+this._quickInputContainer.clientWidth/2)/this._container.clientWidth,done:t},void 0),this._setAlignmentState("top")):e==="center"?(this.dndViewState.set({top:this._getCenterYSnapValue()/this._container.clientHeight,left:(this._getCenterXSnapValue()+this._quickInputContainer.clientWidth/2)/this._container.clientWidth,done:t},void 0),this._setAlignmentState("center")):(this.dndViewState.set({top:e.top,left:e.left,done:t},void 0),this._setAlignmentState(void 0))}_registerLayoutListener(){this._register(U.filter(this._layoutService.onDidLayoutContainer,e=>e.container===this._container)(e=>this.layoutContainer(e.dimension)))}registerMouseListeners(){let e=this._quickInputContainer;this._register(Yle(e,t=>{if(!this._enabled)return;let o=new Ln(Me(e),t);if(o.detail!==2)return;let n=this._quickInputDragAreas.find(({node:r,includeChildren:s})=>s?ms(o.target,r):o.target===r);!n||n.excludeNodes?.some(r=>ms(o.target,r))||(this.dndViewState.set({top:void 0,left:void 0,done:!0},void 0),this._setAlignmentState("top"))})),this._register(ML(e,t=>{if(!this._enabled)return;let o=Me(this._layoutService.activeContainer),n=new Ln(o,t),r=this._quickInputDragAreas.find(({node:g,includeChildren:f})=>f?ms(n.target,g):n.target===g);if(!r||r.excludeNodes?.some(g=>ms(n.target,g)))return;let s=this._quickInputContainer.getBoundingClientRect(),l=n.browserEvent.clientX-s.left,c=n.browserEvent.clientY-s.top,u=!1,p=Lwe(o,g=>{new Ln(o,g).preventDefault(),u||(u=!0),this._layout(g.clientY-c,g.clientX-l)}),h=Yle(o,g=>{if(u){let f=this.dndViewState.get();this.dndViewState.set({top:f?.top,left:f?.left,done:!0},void 0)}p.dispose(),h.dispose()})}))}_layout(e,t){let o=this._getTopSnapValue(),n=this._getCenterYSnapValue(),r=this._getCenterXSnapValue();e=Math.max(0,Math.min(e,this._container.clientHeight-this._quickInputContainer.clientHeight)),e<this._layoutService.activeContainerOffset.top&&(this._controlsOnLeft?t=Math.max(t,80/uv(zi())):this._controlsOnRight&&(t=Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth-140/uv(zi()))));let s=Math.abs(e-o)<this._snapThreshold;e=s?o:e;let l=Math.abs(e-n)<this._snapThreshold;e=l?n:e;let c=e/this._container.clientHeight;t=Math.max(0,Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth));let u=Math.abs(t-r)<this._snapThreshold;t=u?r:t;let p=this._container.clientWidth,h=this._quickInputContainer.clientWidth,f=(t+h/2)/p;if(this.dndViewState.set({top:c,left:f,done:!1},void 0),u){if(s){this._setAlignmentState("top");return}else if(l){this._setAlignmentState("center");return}}this._setAlignmentState(void 0)}_getTopSnapValue(){return this._layoutService.activeContainerOffset.quickPickTop}_getCenterYSnapValue(){return Math.round(this._container.clientHeight*this._snapLineHorizontalRatio)}_getCenterXSnapValue(){return Math.round(this._container.clientWidth/2)-Math.round(this._quickInputContainer.clientWidth/2)}};fot=I([m(4,Kl),m(5,X),m(6,B)],fot);var TAe=class extends ju{constructor(e,t,o,n,r){super(o);this.instantiationService=e;this.contextKeyService=t;this.layoutService=n;this.configurationService=r;this._alignment=De(this,"top");this.alignment=this._alignment;this._onShow=this._register(new T);this.onShow=this._onShow.event;this._onHide=this._register(new T);this.onHide=this._onHide.event;this.contexts=new Map}get backButton(){return this.controller.backButton}get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get hasController(){return!!this._controller}get currentQuickInput(){return this.controller.currentQuickInput}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(CAe))),this._quickAccess}createController(e=this.layoutService,t){let o={idPrefix:"quickInput_",container:e.activeContainer,ignoreFocusOut:()=>!1,backKeybindingLabel:()=>{},setContextKey:r=>this.setContextKey(r),linkOpenerDelegate:r=>{this.instantiationService.invokeFunction(s=>{s.get(Je).open(r,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(yMe))},n=this._register(this.instantiationService.createInstance(cie,{...o,...t}));return n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(r=>{Me(e.activeContainer)===Me(n.container)&&n.layout(r,e.activeContainerOffset.quickPickTop)})),this._register(e.onDidChangeActiveContainer(()=>{n.isVisible()||n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop)})),this._register(n.onShow(()=>{this.resetContextKeys(),this._onShow.fire()})),this._register(n.onHide(()=>{this.resetContextKeys(),this._onHide.fire()})),this._register(ve(r=>{this._alignment.set(n.alignment.read(r),void 0)})),n}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new Y(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t?.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t,o=Ie.None){return this.controller.pick(e,t,o)}input(e={},t=Ie.None){return this.controller.input(e,t)}createQuickPick(e={useSeparators:!1}){return this.controller.createQuickPick(e)}createInputBox(){return this.controller.createInputBox()}createQuickWidget(){return this.controller.createQuickWidget()}createQuickTree(){return this.controller.createQuickTree()}focus(){this.controller.focus()}toggle(){this.controller.toggle()}navigate(e,t){this.controller.navigate(e,t)}accept(e){return this.controller.accept(e)}back(){return this.controller.back()}cancel(e){return this.controller.cancel(e)}setAlignment(e){this.controller.setAlignment(e)}toggleHover(){this.hasController&&this.controller.toggleHover()}updateStyles(){this.hasController&&this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:{quickInputBackground:Tt(zCe),quickInputForeground:Tt(dyt),quickInputTitleBackground:Tt(eYi),widgetBorder:Tt(SD),widgetShadow:Tt(_F)},inputBox:Wl,toggle:zh,countBadge:VI,button:Ro,progressBar:oC,keybindingLabel:qk,list:WS({listBackground:zCe,listFocusBackground:nK,listFocusForeground:oK,listInactiveFocusForeground:oK,listInactiveSelectionIconForeground:KCe,listInactiveFocusBackground:nK,listInactiveSelectionBackground:nK,listInactiveSelectionForeground:oK,listFocusOutline:la,listInactiveFocusOutline:la,treeStickyScrollBackground:zCe}),pickerGroup:{pickerGroupBorder:Tt(tYi),pickerGroupForeground:Tt(uyt)}}}};TAe=I([m(0,F),m(1,X),m(2,Pe),m(3,Kl),m(4,B)],TAe);var vot=class extends TAe{constructor(e,t,o,n,r,s){super(t,n,r,s,e);this.keybindingService=o;this.inQuickInputContext=Xho.bindTo(this.contextKeyService);this.registerListeners()}registerListeners(){this._register(this.onShow(()=>this.inQuickInputContext.set(!0))),this._register(this.onHide(()=>this.inQuickInputContext.set(!1)))}createController(){return super.createController(this.layoutService,{ignoreFocusOut:()=>!this.configurationService.getValue("workbench.quickOpen.closeOnFocusLost"),backKeybindingLabel:()=>this.keybindingService.lookupKeybinding("workbench.action.quickInputBack")?.getLabel()||void 0})}};vot=I([m(0,B),m(1,F),m(2,Le),m(3,X),m(4,Pe),m(5,Kl)],vot);Ce($e,vot,1);var ry=le("IUserDataSyncWorkbenchService");function wb(a){switch(a){case"settings":return d(19612,null);case"keybindings":return d(19608,null);case"snippets":return d(19613,null);case"prompts":return d(19611,null);case"tasks":return d(19616,null);case"mcp":return d(19609,null);case"extensions":return d(19607,null);case"globalState":return d(19617,null);case"profiles":return d(19610,null);case"workspaceState":return d(19618,null)}}var ug=P(19614,"Settings Sync"),cbo=Oe("settings-sync-view-icon",L.sync,d(19615,null)),bw=new Y("syncStatus","uninitialized"),NR=new Y("syncEnabled",!1),NU=new Y("userDataSyncAccountStatus","uninitialized"),gge=new Y("enableSyncActivityViews",!1),U1t=new Y("enableSyncConflictsView",!1),die=new Y("hasConflicts",!1),bot="workbench.userDataSync.actions.configure",BW="workbench.userDataSync.actions.showLog",OU="workbench.view.sync",uie="workbench.views.sync.conflicts",z1t={id:"workbench.userDataSync.actions.downloadSyncActivity",title:P(19606,"Download Settings Sync Activity"),category:Fe.Developer,f1:!0,precondition:C.and(NU.isEqualTo("available"),bw.notEqualsTo("uninitialized"))};var dbo="configurationSync.store",wDi="sync.previous.store",CDi="sync.donot-make-requests-until",K1t="sync.user-session-id",xDi="sync.machine-session-id",crn=100,drn=1e3*60*5,fge=class extends k{constructor(e,t,o){super();this.productService=e;this.configurationService=t;this.storageService=o;this._onDidChangeUserDataSyncStore=this._register(new T);this.onDidChangeUserDataSyncStore=this._onDidChangeUserDataSyncStore.event;this.updateUserDataSyncStore();let n=this._register(new O);this._register(U.filter(o.onDidChangeValue(-1,MU,n),()=>this.userDataSyncStoreType!==this.userDataSyncStore?.type,n)(()=>this.updateUserDataSyncStore()))}get userDataSyncStore(){return this._userDataSyncStore}get userDataSyncStoreType(){return this.storageService.get(MU,-1)}set userDataSyncStoreType(e){this.storageService.store(MU,e,-1,Ft?0:1)}updateUserDataSyncStore(){this._userDataSyncStore=this.toUserDataSyncStore(this.productService[dbo]),this._onDidChangeUserDataSyncStore.fire()}toUserDataSyncStore(e){if(e&&(e=Ft&&e.web?{...e,...e.web}:e,We(e.url)&&Di(e.authenticationProviders)&&Object.keys(e.authenticationProviders).every(t=>Array.isArray(e.authenticationProviders[t].scopes)))){let t=e,o=!!t.canSwitch,n=t.url===t.insidersUrl?"insiders":"stable",r=(o?this.userDataSyncStoreType:void 0)||n,s=r==="insiders"?t.insidersUrl:r==="stable"?t.stableUrl:t.url;return{url:A.parse(s),type:r,defaultType:n,defaultUrl:A.parse(t.url),stableUrl:A.parse(t.stableUrl),insidersUrl:A.parse(t.insidersUrl),canSwitch:o,authenticationProviders:Object.keys(t.authenticationProviders).reduce((l,c)=>(l.push({id:c,scopes:t.authenticationProviders[c].scopes}),l),[])}}}};fge=I([m(0,Ze),m(1,B),m(2,de)],fge);var G1t=class extends fge{constructor(i,e,t){super(i,e,t);let o=this.storageService.get(wDi,-1);o&&(this.previousConfigurationSyncStore=JSON.parse(o));let n=this.productService[dbo];n?this.storageService.store(wDi,JSON.stringify(n),-1,1):this.storageService.remove(wDi,-1)}async switch(i){i!==this.userDataSyncStoreType&&(this.userDataSyncStoreType=i,this.updateUserDataSyncStore())}async getPreviousUserDataSyncStore(){return this.toUserDataSyncStore(this.previousConfigurationSyncStore)}};G1t=I([m(0,Ze),m(1,B),m(2,de)],G1t);var FU=class extends k{constructor(e,t,o,n,r,s,l){super();this.requestService=o;this.logService=n;this.storageService=l;this._onTokenFailed=this._register(new T);this.onTokenFailed=this._onTokenFailed.event;this._onTokenSucceed=this._register(new T);this.onTokenSucceed=this._onTokenSucceed.event;this._donotMakeRequestsUntil=void 0;this._onDidChangeDonotMakeRequestsUntil=this._register(new T);this.onDidChangeDonotMakeRequestsUntil=this._onDidChangeDonotMakeRequestsUntil.event;this.resetDonotMakeRequestsUntilPromise=void 0;this.updateUserDataSyncStoreUrl(e),this.commonHeadersPromise=k0(r,s,l).then(c=>{let u={"X-Client-Name":`${t.applicationName}${Ft?"-web":""}`,"X-Client-Version":t.version};return t.commit&&(u["X-Client-Commit"]=t.commit),u}),this.session=new kDi(crn,drn,this.requestService,this.logService),this.initDonotMakeRequestsUntil(),this._register(ee(()=>{this.resetDonotMakeRequestsUntilPromise&&(this.resetDonotMakeRequestsUntilPromise.cancel(),this.resetDonotMakeRequestsUntilPromise=void 0)}))}get donotMakeRequestsUntil(){return this._donotMakeRequestsUntil}setAuthToken(e,t){this.authToken={token:e,type:t}}updateUserDataSyncStoreUrl(e){this.userDataSyncStoreUrl=e?Ve(e,"v1"):void 0}initDonotMakeRequestsUntil(){let e=this.storageService.getNumber(CDi,-1);e&&Date.now()<e&&this.setDonotMakeRequestsUntil(new Date(e))}setDonotMakeRequestsUntil(e){this._donotMakeRequestsUntil?.getTime()!==e?.getTime()&&(this._donotMakeRequestsUntil=e,this.resetDonotMakeRequestsUntilPromise&&(this.resetDonotMakeRequestsUntilPromise.cancel(),this.resetDonotMakeRequestsUntilPromise=void 0),this._donotMakeRequestsUntil?(this.storageService.store(CDi,this._donotMakeRequestsUntil.getTime(),-1,1),this.resetDonotMakeRequestsUntilPromise=Hn(t=>Li(this._donotMakeRequestsUntil.getTime()-Date.now(),t).then(()=>this.setDonotMakeRequestsUntil(void 0))),this.resetDonotMakeRequestsUntilPromise.then(null,t=>null)):this.storageService.remove(CDi,-1),this._onDidChangeDonotMakeRequestsUntil.fire())}async getAllCollections(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=Ve(this.userDataSyncStoreUrl,"collection").toString();e={...e},e["Content-Type"]="application/json";let o=await this.request(t,{type:"GET",headers:e,callSite:"userDataSync.getAllCollections"},[],Ie.None);return(await Th(o))?.map(({id:n})=>n)||[]}async createCollection(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=Ve(this.userDataSyncStoreUrl,"collection").toString();e={...e},e["Content-Type"]=cr.text;let o=await this.request(t,{type:"POST",headers:e,callSite:"userDataSync.createCollection"},[],Ie.None),n=await gC(o);if(!n)throw new mh("Server did not return the collection id",t,"NoCollection",o.res.statusCode,o.res.headers[LU]);return n}async deleteCollection(e,t={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=e?Ve(this.userDataSyncStoreUrl,"collection",e).toString():Ve(this.userDataSyncStoreUrl,"collection").toString();t={...t},await this.request(o,{type:"DELETE",headers:t,callSite:"userDataSync.deleteCollection"},[],Ie.None)}async getAllResourceRefs(e,t){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=this.getResourceUrl(this.userDataSyncStoreUrl,t,e),n={},r=await this.request(o.toString(),{type:"GET",headers:n,callSite:"userDataSync.getAllResourceRefs"},[],Ie.None);return(await Th(r)||[]).map(({url:l,created:c})=>({ref:lu(o,o.with({path:l})),created:c*1e3}))}async resolveResourceContent(e,t,o,n={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let r=Ve(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),t).toString();n={...n},n["Cache-Control"]="no-cache";let s=await this.request(r,{type:"GET",headers:n,callSite:"userDataSync.resolveResourceContent"},[],Ie.None);return await gC(s)}async deleteResource(e,t,o){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let n=t!==null?Ve(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),t).toString():this.getResourceUrl(this.userDataSyncStoreUrl,o,e).toString(),r={};await this.request(n,{type:"DELETE",headers:r,callSite:"userDataSync.deleteResource"},[],Ie.None)}async deleteResources(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let e=Ve(this.userDataSyncStoreUrl,"resource").toString(),t={"Content-Type":cr.text};await this.request(e,{type:"DELETE",headers:t,callSite:"userDataSync.deleteResources"},[],Ie.None)}async readResource(e,t,o,n={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let r=Ve(this.getResourceUrl(this.userDataSyncStoreUrl,o,e),"latest").toString();n={...n},n["Cache-Control"]="no-cache",t&&(n["If-None-Match"]=t.ref);let s=await this.request(r,{type:"GET",headers:n,callSite:"userDataSync.readResource"},[304],Ie.None),l=null;if(s.res.statusCode===304&&(l=t),l===null){let c=s.res.headers.etag;if(!c)throw new mh("Server did not return the ref",r,"NoRef",s.res.statusCode,s.res.headers[LU]);let u=await gC(s);if(!u&&s.res.statusCode===304)throw new mh("Empty response",r,"EmptyResponse",s.res.statusCode,s.res.headers[LU]);l={ref:c,content:u}}return l}async writeResource(e,t,o,n,r={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let s=this.getResourceUrl(this.userDataSyncStoreUrl,n,e).toString();r={...r},r["Content-Type"]=cr.text,o&&(r["If-Match"]=o);let l=await this.request(s,{type:"POST",data:t,headers:r,callSite:"userDataSync.writeResource"},[],Ie.None),c=l.res.headers.etag;if(!c)throw new mh("Server did not return the ref",s,"NoRef",l.res.statusCode,l.res.headers[LU]);return c}async manifest(e,t={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let o=Ve(this.userDataSyncStoreUrl,"manifest").toString();t={...t},t["Content-Type"]="application/json",e&&(t["If-None-Match"]=e.ref);let n=await this.request(o,{type:"GET",headers:t,callSite:"userDataSync.manifest"},[304],Ie.None),r=null;if(n.res.statusCode===304&&(r=e),!r){let l=n.res.headers.etag;if(!l)throw new mh("Server did not return the ref",o,"NoRef",n.res.statusCode,n.res.headers[LU]);let c=await gC(n);if(!c&&n.res.statusCode===304)throw new mh("Empty response",o,"EmptyResponse",n.res.statusCode,n.res.headers[LU]);c&&(r={...JSON.parse(c),ref:l})}let s=this.storageService.get(K1t,-1);return s&&r&&s!==r.session&&this.clearSession(),r===null&&s&&this.clearSession(),r&&this.storageService.store(K1t,r.session,-1,1),r}async clear(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");await this.deleteCollection(),await this.deleteResources(),this.clearSession()}async getLatestData(e={}){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let t=Ve(this.userDataSyncStoreUrl,"download","latest").toString();e={...e},e["Content-Type"]="application/json";let o=await this.request(t,{type:"GET",headers:e,callSite:"userDataSync.getLatestData"},[],Ie.None);if(!pE(o))throw new mh("Server returned "+o.res.statusCode,t,"EmptyResponse",o.res.statusCode,o.res.headers[LU]);let n=await Th(o);if(!n)return null;let r={};if(n.resources){r.resources={};for(let s in n.resources){let[l]=n.resources[s];r.resources[s]={content:l.content,ref:l.ref}}}if(n.collections){r.collections={};for(let s in n.collections){let l={};r.collections[s]={resources:l};for(let c in n.collections[s].resources){let[u]=n.collections[s].resources[c];l[c]={content:u.content,ref:u.ref}}}}return r}async getActivityData(){if(!this.userDataSyncStoreUrl)throw new Error("No settings sync store url configured.");let e=Ve(this.userDataSyncStoreUrl,"download").toString(),t={},o=await this.request(e,{type:"GET",headers:t,callSite:"userDataSync.getActivityData"},[],Ie.None);if(!pE(o))throw new mh("Server returned "+o.res.statusCode,e,"EmptyResponse",o.res.statusCode,o.res.headers[LU]);if(BMt(o))throw new mh("Empty response",e,"EmptyResponse",o.res.statusCode,o.res.headers[LU]);return o.stream}getResourceUrl(e,t,o){return t?Ve(e,"collection",t,"resource",o):Ve(e,"resource",o)}clearSession(){this.storageService.remove(K1t,-1),this.storageService.remove(xDi,-1)}async request(e,t,o,n){if(!this.authToken)throw new mh("No Auth Token Available",e,"Unauthorized",void 0,void 0);if(this._donotMakeRequestsUntil&&Date.now()<this._donotMakeRequestsUntil.getTime())throw new mh(`${t.type} request '${e}' failed because of too many requests (429).`,e,"TooManyRequestsAndRetryAfter",void 0,void 0);this.setDonotMakeRequestsUntil(void 0);let r=await this.commonHeadersPromise;t.headers={...t.headers||{},...r,"X-Account-Type":this.authToken.type,authorization:`Bearer ${this.authToken.token}`},this.addSessionHeaders(t.headers),this.logService.trace("Sending request to server",{url:e,type:t.type,headers:{...t.headers,authorization:void 0}});let s;try{s=await this.session.request(e,t,n)}catch(h){if(!(h instanceof mh)){let g="RequestFailed",f=Dn(h).toLowerCase();f.includes("xhr timeout")?g="RequestTimeout":f.includes("protocol")&&f.includes("not supported")?g="RequestProtocolNotSupported":f.includes("request path contains unescaped characters")?g="RequestPathNotEscaped":f.includes("headers must be an object")?g="RequestHeadersNotObject":Yi(h)&&(g="RequestCanceled"),h=new mh(`Connection refused for the request '${e}'.`,e,g,void 0,void 0)}throw this.logService.info("Request failed",e),h}let l=s.res.headers[LU],c={url:e,status:s.res.statusCode,"execution-id":t.headers[eDi],"operation-id":l},u=pE(s)||s.res.statusCode&&o.includes(s.res.statusCode),p="";if(u?this.logService.trace("Request succeeded",c):(p=await jD(s)||"",this.logService.info("Request failed",c,p)),s.res.statusCode===401||s.res.statusCode===403){if(this.authToken=void 0,s.res.statusCode===401)throw this._onTokenFailed.fire("Unauthorized"),new mh(`${t.type} request '${e}' failed because of Unauthorized (401).`,e,"Unauthorized",s.res.statusCode,l);if(s.res.statusCode===403)throw this._onTokenFailed.fire("Forbidden"),new mh(`${t.type} request '${e}' failed because the access is forbidden (403).`,e,"Forbidden",s.res.statusCode,l)}if(this._onTokenSucceed.fire(),s.res.statusCode===404)throw new mh(`${t.type} request '${e}' failed because the requested resource is not found (404).`,e,"NotFound",s.res.statusCode,l);if(s.res.statusCode===405)throw new mh(`${t.type} request '${e}' failed because the requested endpoint is not found (405). ${p}`,e,"MethodNotFound",s.res.statusCode,l);if(s.res.statusCode===409)throw new mh(`${t.type} request '${e}' failed because of Conflict (409). There is new data for this resource. Make the request again with latest data.`,e,"Conflict",s.res.statusCode,l);if(s.res.statusCode===410)throw new mh(`${t.type} request '${e}' failed because the requested resource is not longer available (410).`,e,"Gone",s.res.statusCode,l);if(s.res.statusCode===412)throw new mh(`${t.type} request '${e}' failed because of Precondition Failed (412). There is new data for this resource. Make the request again with latest data.`,e,"PreconditionFailed",s.res.statusCode,l);if(s.res.statusCode===413)throw new mh(`${t.type} request '${e}' failed because of too large payload (413).`,e,"TooLarge",s.res.statusCode,l);if(s.res.statusCode===426)throw new mh(`${t.type} request '${e}' failed with status Upgrade Required (426). Please upgrade the client and try again.`,e,"UpgradeRequired",s.res.statusCode,l);if(s.res.statusCode===429){let h=s.res.headers["retry-after"];throw h?(this.setDonotMakeRequestsUntil(new Date(Date.now()+parseInt(h)*1e3)),new mh(`${t.type} request '${e}' failed because of too many requests (429).`,e,"TooManyRequestsAndRetryAfter",s.res.statusCode,l)):new mh(`${t.type} request '${e}' failed because of too many requests (429).`,e,"RemoteTooManyRequests",s.res.statusCode,l)}if(!u)throw new mh("Server returned "+s.res.statusCode,e,"Unknown",s.res.statusCode,l);return s}addSessionHeaders(e){let t=this.storageService.get(xDi,-1);t===void 0&&(t=ht(),this.storageService.store(xDi,t,-1,1)),e["X-Machine-Session-Id"]=t;let o=this.storageService.get(K1t,-1);o!==void 0&&(e["X-User-Session-Id"]=o)}};FU=I([m(1,Ze),m(2,Ra),m(3,vw),m(4,ko),m(5,ge),m(6,de)],FU);var q1t=class extends FU{constructor(i,e,t,o,n,r,s){super(i.userDataSyncStore?.url,e,t,o,n,r,s),this._register(i.onDidChangeUserDataSyncStore(()=>this.updateUserDataSyncStoreUrl(i.userDataSyncStore?.url)))}};q1t=I([m(0,uP),m(1,Ze),m(2,Ra),m(3,vw),m(4,ko),m(5,ge),m(6,de)],q1t);var kDi=class{constructor(i,e,t,o){this.limit=i;this.interval=e;this.requestService=t;this.logService=o;this.requests=[];this.startTime=void 0}request(i,e,t){if(this.isExpired()&&this.reset(),e.url=i,this.requests.length>=this.limit)throw this.logService.info("Too many requests",...this.requests),new mh(`Too many requests. Only ${this.limit} requests allowed in ${this.interval/(1e3*60)} minutes.`,i,"LocalTooManyRequests",void 0,void 0);return this.startTime=this.startTime||new Date,this.requests.push(i),this.requestService.request(e,t)}isExpired(){return this.startTime!==void 0&&new Date().getTime()-this.startTime.getTime()>this.interval}reset(){this.requests=[],this.startTime=void 0}};function prn(a){return!!(a&&a.ref!==void 0&&typeof a.ref=="string"&&a.ref!==""&&a.syncData!==void 0&&(a.syncData===null||Iot(a.syncData)))}function Iot(a){return!!(a&&a.version!==void 0&&typeof a.version=="number"&&a.content!==void 0&&typeof a.content=="string"&&(Object.keys(a).length===2||Object.keys(a).length===3&&a.machineId!==void 0&&typeof a.machineId=="string"))}function _Ae(a,i){return`${Ale(a)}${i.isDefault?"":` (${i.name})`}`}var WU=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.syncResource=e;this.collection=t;this.fileService=o;this.environmentService=n;this.storageService=r;this.userDataSyncStoreService=s;this.userDataSyncLocalStoreService=l;this.userDataSyncEnablementService=c;this.telemetryService=u;this.logService=p;this.configurationService=h;this.syncPreviewPromise=null;this._status="idle";this._onDidChangStatus=this._register(new T);this.onDidChangeStatus=this._onDidChangStatus.event;this._conflicts=[];this._onDidChangeConflicts=this._register(new T);this.onDidChangeConflicts=this._onDidChangeConflicts.event;this.localChangeTriggerThrottler=this._register(new Aa(50));this._onDidChangeLocal=this._register(new T);this.onDidChangeLocal=this._onDidChangeLocal.event;this.hasSyncResourceStateVersionChanged=!1;this.syncHeaders={};this.lastSyncUserDataStateKey=`${t?`${t}.`:""}${e.syncResource}.lastSyncUserData`,this.resource=e.syncResource,this.syncResourceLogLabel=_Ae(e.syncResource,e.profile),this.extUri=g.extUri,this.syncFolder=this.extUri.joinPath(n.userDataSyncHome,...Z_i(e.profile.isDefault?void 0:e.profile.id,e.syncResource)),this.syncPreviewFolder=this.extUri.joinPath(this.syncFolder,tbo),this.lastSyncResource=qit(e.profile.isDefault?void 0:e.profile.id,e.syncResource,n,this.extUri),this.currentMachineIdPromise=k0(n,o,r)}get status(){return this._status}get conflicts(){return{...this.syncResource,conflicts:this._conflicts}}triggerLocalChange(){this.localChangeTriggerThrottler.trigger(()=>this.doTriggerLocalChange())}async doTriggerLocalChange(){if(this.status==="hasConflicts"){this.logService.info(`${this.syncResourceLogLabel}: In conflicts state and local change detected. Syncing again...`);let e=await this.syncPreviewPromise;this.syncPreviewPromise=null;let t=await this.performSync(e.remoteUserData,e.lastSyncUserData,"merge",this.getUserDataSyncConfiguration());this.setStatus(t)}else{this.logService.trace(`${this.syncResourceLogLabel}: Checking for local changes...`);let e=await this.getLastSyncUserData();(!e||await this.hasRemoteChanged(e))&&this._onDidChangeLocal.fire()}}setStatus(e){this._status!==e&&(this._status=e,this._onDidChangStatus.fire(e))}async sync(e,t=!1,o=this.getUserDataSyncConfiguration(),n={}){try{if(this.syncHeaders={...n},this.status==="hasConflicts")return this.logService.info(`${this.syncResourceLogLabel}: Skipped synchronizing ${this.resource.toLowerCase()} as there are conflicts.`),this.syncPreviewPromise;if(this.status==="syncing")return this.logService.info(`${this.syncResourceLogLabel}: Skipped synchronizing ${this.resource.toLowerCase()} as it is running already.`),this.syncPreviewPromise;this.logService.trace(`${this.syncResourceLogLabel}: Started synchronizing ${this.resource.toLowerCase()}...`),this.setStatus("syncing");let r="idle";try{let s=await this.getLastSyncUserData(),l=await this.getLatestRemoteUserData(e,s);return r=await this.performSync(l,s,t?"preview":"merge",o),r==="hasConflicts"?this.logService.info(`${this.syncResourceLogLabel}: Detected conflicts while synchronizing ${this.resource.toLowerCase()}.`):r==="idle"&&this.logService.trace(`${this.syncResourceLogLabel}: Finished synchronizing ${this.resource.toLowerCase()}.`),this.syncPreviewPromise||null}finally{this.setStatus(r)}}finally{this.syncHeaders={}}}async apply(e,t={}){try{this.syncHeaders={...t};let o=await this.doApply(e);return this.setStatus(o),this.syncPreviewPromise}finally{this.syncHeaders={}}}async replace(e){let t=this.parseSyncData(e);if(!t)return!1;await this.stop();try{this.logService.trace(`${this.syncResourceLogLabel}: Started resetting ${this.resource.toLowerCase()}...`),this.setStatus("syncing");let o=await this.getLastSyncUserData(),n=await this.getLatestRemoteUserData(null,o),r=await this.isRemoteDataFromCurrentMachine(n),s=await this.generateSyncPreview({ref:n.ref,syncData:t},o,r,this.getUserDataSyncConfiguration(),Ie.None),l=[];for(let c of s){let u=await this.getAcceptResult(c,c.remoteResource,void 0,Ie.None),{remoteChange:p}=await this.getAcceptResult(c,c.previewResource,c.remoteContent,Ie.None);l.push([c,{...u,remoteChange:p!==0?p:2}])}await this.applyResult(n,o,l,!1),this.logService.info(`${this.syncResourceLogLabel}: Finished resetting ${this.resource.toLowerCase()}.`)}finally{this.setStatus("idle")}return!0}async isRemoteDataFromCurrentMachine(e){let t=await this.currentMachineIdPromise;return!!e.syncData?.machineId&&e.syncData.machineId===t}async getLatestRemoteUserData(e,t){return e===null?{ref:Zvo,syncData:null}:We(e)?t?.ref===e?t:this.getRemoteUserData(t):this.toRemoteUserData(e)}async performSync(e,t,o,n){if(e.syncData&&e.syncData.version>this.version)throw new Cf(d(2958,null,this.resource,this.version,e.syncData.version),"IncompatibleLocalContent",this.resource);try{return await this.doSync(e,t,o,n)}catch(r){if(r instanceof Cf)switch(r.code){case"LocalPreconditionFailed":return this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize ${this.syncResourceLogLabel} as there is a new local version available. Synchronizing again...`),this.performSync(e,t,o,n);case"Conflict":case"PreconditionFailed":return this.logService.info(`${this.syncResourceLogLabel}: Failed to synchronize as there is a new remote version available. Synchronizing again...`),e=await this.getRemoteUserData(null),t=await this.getLastSyncUserData(),this.performSync(e,t,"merge",n)}throw r}}async doSync(e,t,o,n){try{let r=await this.isRemoteDataFromCurrentMachine(e),s=!r&&t===null&&this.getStoredLastSyncUserDataStateContent()!==void 0,l=o==="preview"||o==="merge"&&!s,c=o==="merge"||o==="pull-push";this.syncPreviewPromise||(this.syncPreviewPromise=Hn(p=>this.doGenerateSyncResourcePreview(e,t,r,l,n,p)));let u=await this.syncPreviewPromise;if(o==="merge"&&s){this.logService.info(`${this.syncResourceLogLabel}: Accepting remote because it was synced before and the last sync data is not available.`);for(let p of u.resourcePreviews)u=await this.accept(p.remoteResource)||u}else if(o==="pull-push")for(let p of u.resourcePreviews)p.mergeState!=="accepted"&&(e.ref===t?.ref||r?u=await this.accept(p.localResource)??u:u=await this.accept(p.remoteResource)??u);return this.updateConflicts(u.resourcePreviews),u.resourcePreviews.some(({mergeState:p})=>p==="conflict")?"hasConflicts":c?await this.doApply(!1):"syncing"}catch(r){throw this.syncPreviewPromise=null,r}}async accept(e,t){return await this.updateSyncResourcePreview(e,async o=>{let n=await this.getAcceptResult(o,e,t,Ie.None);return o.acceptResult=n,o.mergeState="accepted",o.localChange=n.localChange,o.remoteChange=n.remoteChange,o}),this.syncPreviewPromise}async discard(e){return await this.updateSyncResourcePreview(e,async t=>{let o=await this.getMergeResult(t,Ie.None);return await this.fileService.writeFile(t.previewResource,Ke.fromString(o.content||"")),t.acceptResult=void 0,t.mergeState="preview",t.localChange=o.localChange,t.remoteChange=o.remoteChange,t}),this.syncPreviewPromise}async updateSyncResourcePreview(e,t){if(!this.syncPreviewPromise)return;let o=await this.syncPreviewPromise,n=o.resourcePreviews.findIndex(({localResource:r,remoteResource:s,previewResource:l})=>this.extUri.isEqual(r,e)||this.extUri.isEqual(s,e)||this.extUri.isEqual(l,e));n!==-1&&(this.syncPreviewPromise=Hn(async r=>{let s=[...o.resourcePreviews];return s[n]=await t(s[n]),{...o,resourcePreviews:s}}),o=await this.syncPreviewPromise,this.updateConflicts(o.resourcePreviews),o.resourcePreviews.some(({mergeState:r})=>r==="conflict")?this.setStatus("hasConflicts"):this.setStatus("syncing"))}async doApply(e){if(!this.syncPreviewPromise)return"idle";let t=await this.syncPreviewPromise;return t.resourcePreviews.some(({mergeState:o})=>o==="conflict")?"hasConflicts":t.resourcePreviews.some(({mergeState:o})=>o!=="accepted")?"syncing":(await this.applyResult(t.remoteUserData,t.lastSyncUserData,t.resourcePreviews.map(o=>[o,o.acceptResult]),e),this.syncPreviewPromise=null,await this.clearPreviewFolder(),"idle")}async clearPreviewFolder(){try{await this.fileService.del(this.syncPreviewFolder,{recursive:!0})}catch{}}updateConflicts(e){let t=e.filter(({mergeState:o})=>o==="conflict");eo(this._conflicts,t,(o,n)=>this.extUri.isEqual(o.previewResource,n.previewResource))||(this._conflicts=t,this._onDidChangeConflicts.fire(this.conflicts))}async hasPreviouslySynced(){let e=await this.getLastSyncUserData();return!!e&&e.syncData!==null}async resolvePreviewContent(e){let t=this.syncPreviewPromise?await this.syncPreviewPromise:null;if(t)for(let o of t.resourcePreviews){if(this.extUri.isEqual(o.acceptedResource,e))return o.acceptResult?o.acceptResult.content:null;if(this.extUri.isEqual(o.remoteResource,e))return o.remoteContent;if(this.extUri.isEqual(o.localResource,e))return o.localContent;if(this.extUri.isEqual(o.baseResource,e))return o.baseContent}return null}async resetLocal(){this.storageService.remove(this.lastSyncUserDataStateKey,-1);try{await this.fileService.del(this.lastSyncResource)}catch(e){rp(e)!==1&&this.logService.error(e)}}async doGenerateSyncResourcePreview(e,t,o,n,r,s){let l=await this.generateSyncPreview(e,t,o,r,s),c=[];for(let u of l){let p=u.previewResource.with({scheme:lk,authority:"accepted"});if(u.localChange===0&&u.remoteChange===0)c.push({...u,acceptedResource:p,acceptResult:{content:null,localChange:0,remoteChange:0},mergeState:"accepted"});else{let h=n?await this.getMergeResult(u,s):void 0;if(s.isCancellationRequested)break;await this.fileService.writeFile(u.previewResource,Ke.fromString(h?.content||""));let g=h&&!h.hasConflicts?await this.getAcceptResult(u,u.previewResource,void 0,s):void 0;c.push({...u,acceptResult:g,mergeState:h?.hasConflicts?"conflict":g?"accepted":"preview",localChange:g?g.localChange:h?h.localChange:u.localChange,remoteChange:g?g.remoteChange:h?h.remoteChange:u.remoteChange})}}return{syncResource:this.resource,profile:this.syncResource.profile,remoteUserData:e,lastSyncUserData:t,resourcePreviews:c,isLastSyncFromCurrentMachine:o}}async getLastSyncUserData(){let e=this.getStoredLastSyncUserDataStateContent();if(!e)return this.logService.info(`${this.syncResourceLogLabel}: Last sync data state does not exist.`),null;let t=JSON.parse(e),o=this.userDataSyncEnablementService.getResourceSyncStateVersion(this.resource);if(this.hasSyncResourceStateVersionChanged=!!t.version&&!!o&&t.version!==o,this.hasSyncResourceStateVersionChanged)return this.logService.info(`${this.syncResourceLogLabel}: Reset last sync state because last sync state version ${t.version} is not compatible with current sync state version ${o}.`),await this.resetLocal(),null;let n,r=1;for(;n===void 0&&r++<6;)try{let s=await this.readLastSyncStoredRemoteUserData();s&&(s.ref===t.ref?n=s.syncData:this.logService.info(`${this.syncResourceLogLabel}: Last sync data stored locally is not same as the last sync state.`));break}catch(s){if(s instanceof ua&&s.fileOperationResult===1){this.logService.info(`${this.syncResourceLogLabel}: Last sync resource does not exist locally.`);break}else{if(s instanceof Cf)throw s;this.logService.error(s,r)}}if(n===void 0)try{let s=await this.userDataSyncStoreService.resolveResourceContent(this.resource,t.ref,this.collection,this.syncHeaders);n=s===null?null:this.parseSyncData(s),await this.writeLastSyncStoredRemoteUserData({ref:t.ref,syncData:n})}catch(s){if(s instanceof Cf&&s.code==="NotFound")this.logService.info(`${this.syncResourceLogLabel}: Last sync resource does not exist remotely.`);else throw s}return n===void 0?null:{...t,syncData:n}}async updateLastSyncUserData(e,t={}){if(t.ref||t.version)throw new Error("Cannot have core properties as additional");let o=this.userDataSyncEnablementService.getResourceSyncStateVersion(this.resource),n={ref:e.ref,version:o,...t};this.storageService.store(this.lastSyncUserDataStateKey,JSON.stringify(n),-1,1),await this.writeLastSyncStoredRemoteUserData(e)}getStoredLastSyncUserDataStateContent(){return this.storageService.get(this.lastSyncUserDataStateKey,-1)}async readLastSyncStoredRemoteUserData(){let e=(await this.fileService.readFile(this.lastSyncResource)).value.toString();try{let t=e?JSON.parse(e):void 0;if(prn(t))return t}catch(t){this.logService.error(t)}}async writeLastSyncStoredRemoteUserData(e){await this.fileService.writeFile(this.lastSyncResource,Ke.fromString(JSON.stringify(e)))}async getRemoteUserData(e){let t=await this.getUserData(e);return this.toRemoteUserData(t)}toRemoteUserData({ref:e,content:t}){let o=null;return t!==null&&(o=this.parseSyncData(t)),{ref:e,syncData:o}}parseSyncData(e){try{let t=JSON.parse(e);if(Iot(t))return t}catch(t){this.logService.error(t)}throw new Cf(d(2959,null),"IncompatibleRemoteContent",this.resource)}async getUserData(e){let t=e?{ref:e.ref,content:e.syncData?JSON.stringify(e.syncData):null}:null;return this.userDataSyncStoreService.readResource(this.resource,t,this.collection,this.syncHeaders)}async updateRemoteUserData(e,t){let o=await this.currentMachineIdPromise,n={version:this.version,machineId:o,content:e};try{return t=await this.userDataSyncStoreService.writeResource(this.resource,JSON.stringify(n),t,this.collection,this.syncHeaders),{ref:t,syncData:n}}catch(r){throw r instanceof Cf&&r.code==="TooLarge"&&(r=new Cf(r.message,r.code,this.resource)),r}}async backupLocal(e){let t={version:this.version,content:e};return this.userDataSyncLocalStoreService.writeResource(this.resource,JSON.stringify(t),new Date,this.syncResource.profile.isDefault?void 0:this.syncResource.profile.id)}async stop(){this.status!=="idle"&&(this.logService.trace(`${this.syncResourceLogLabel}: Stopping synchronizing ${this.resource.toLowerCase()}.`),this.syncPreviewPromise&&(this.syncPreviewPromise.cancel(),this.syncPreviewPromise=null),this.updateConflicts([]),await this.clearPreviewFolder(),this.setStatus("idle"),this.logService.info(`${this.syncResourceLogLabel}: Stopped synchronizing ${this.resource.toLowerCase()}.`))}getUserDataSyncConfiguration(){return this.configurationService.getValue(Xvo)}};WU=I([m(2,ge),m(3,ko),m(4,de),m(5,AW),m(6,tie),m(7,Yl),m(8,_e),m(9,vw),m(10,B),m(11,gt)],WU);var Sot=class extends WU{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(t,o,n,r,s,l,c,u,p,h,g,f);this.file=e;this._register(this.fileService.watch(this.extUri.dirname(e))),this._register(this.fileService.onDidFilesChange(v=>this.onFileChanges(v)))}async getLocalFileContent(){try{return await this.fileService.readFile(this.file)}catch{return null}}async updateLocalFileContent(e,t,o){try{t?await this.fileService.writeFile(this.file,Ke.fromString(e),o?void 0:t):await this.fileService.createFile(this.file,Ke.fromString(e),{overwrite:o})}catch(n){throw n instanceof ua&&n.fileOperationResult===1||n instanceof ua&&n.fileOperationResult===3?new Cf(n.message,"LocalPreconditionFailed"):n}}async deleteLocalFile(){try{await this.fileService.del(this.file)}catch(e){if(!(e instanceof ua&&e.fileOperationResult===1))throw e}}onFileChanges(e){e.contains(this.file)&&this.triggerLocalChange()}};Sot=I([m(3,ge),m(4,ko),m(5,de),m(6,AW),m(7,tie),m(8,Yl),m(9,_e),m(10,vw),m(11,B),m(12,gt)],Sot);var $1t=class extends Sot{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(e,t,o,n,r,s,l,c,u,p,h,f,v);this.userDataSyncUtilService=g;this._formattingOptions=void 0}hasErrors(e,t){let o=[],n=is(e,o,{allowEmptyContent:!0,allowTrailingComma:!0});return o.length>0||!bn(n)&&t!==Array.isArray(n)}getFormattingOptions(){return this._formattingOptions||(this._formattingOptions=this.userDataSyncUtilService.resolveFormattingOptions(this.file)),this._formattingOptions}};$1t=I([m(3,ge),m(4,ko),m(5,de),m(6,AW),m(7,tie),m(8,Yl),m(9,_e),m(10,vw),m(11,iie),m(12,B),m(13,gt)],$1t);var pie=class{constructor(i,e,t,o,n,r,s){this.resource=i;this.userDataProfilesService=e;this.environmentService=t;this.logService=o;this.fileService=n;this.storageService=r;this.extUri=s.extUri,this.lastSyncResource=qit(void 0,this.resource,t,this.extUri)}async initialize({ref:i,content:e}){if(!e){this.logService.info("Remote content does not exist.",this.resource);return}let t=this.parseSyncData(e);if(t)try{await this.doInitialize({ref:i,syncData:t})}catch(o){this.logService.error(o)}}parseSyncData(i){try{let e=JSON.parse(i);if(Iot(e))return e}catch(e){this.logService.error(e)}this.logService.info("Cannot parse sync data as it is not compatible with the current version.",this.resource)}async updateLastSyncUserData(i,e={}){if(e.ref||e.version)throw new Error("Cannot have core properties as additional");let t={ref:i.ref,version:void 0,...e};this.storageService.store(`${this.resource}.lastSyncUserData`,JSON.stringify(t),-1,1),await this.fileService.writeFile(this.lastSyncResource,Ke.fromString(JSON.stringify(i)))}};pie=I([m(1,hn),m(2,ko),m(3,re),m(4,ge),m(5,de),m(6,gt)],pie);function yot(a,i,e,t,o){if(!i)return{remote:{added:Object.keys(a),removed:[],updated:[],all:Object.keys(a).length>0?a:null},local:{added:{},removed:[],updated:{}}};let n=j1t(a,i);if(n.added.size===0&&n.removed.size===0&&n.updated.size===0)return{remote:{added:[],removed:[],updated:[],all:null},local:{added:{},removed:[],updated:{}}};let r=e?j1t(e,i):{added:Object.keys(i).reduce((h,g)=>(h.add(g),h),new Set),removed:new Set,updated:new Set},s=e?j1t(e,a):{added:Object.keys(a).reduce((h,g)=>(h.add(g),h),new Set),removed:new Set,updated:new Set},l={added:{},removed:[],updated:{}},c=io(i),u=!e;for(let h of s.added.values())h!==MU&&u&&r.added.has(h)||(c[h]=a[h]);for(let h of s.updated.values())c[h]=a[h];for(let h of s.removed.values())t.unregistered.includes(h)||delete c[h];for(let h of r.added.values()){let g=i[h];if(t.machine.includes(h)){o.info(`GlobalState: Skipped adding ${h} in local storage because it is declared as machine scoped.`);continue}if(e&&s.added.has(h))continue;let f=a[h];f&&f.value===g.value||h===MU&&u&&s.added.has(h)||(f?l.updated[h]=g:l.added[h]=g)}for(let h of r.updated.values()){let g=i[h];if(t.machine.includes(h)){o.info(`GlobalState: Skipped updating ${h} in local storage because it is declared as machine scoped.`);continue}if(s.updated.has(h)||s.removed.has(h))continue;let f=a[h];f&&f.value===g.value||(l.updated[h]=g)}for(let h of r.removed.values()){if(t.machine.includes(h)){o.trace(`GlobalState: Skipped removing ${h} in local storage because it is declared as machine scoped.`);continue}s.updated.has(h)||s.removed.has(h)||l.removed.push(h)}let p=j1t(i,c);return{local:l,remote:{added:[...p.added],updated:[...p.updated],removed:[...p.removed],all:p.added.size===0&&p.removed.size===0&&p.updated.size===0?null:c}}}function j1t(a,i){let e=Object.keys(a),t=Object.keys(i),o=t.filter(s=>!e.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),n=e.filter(s=>!t.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),r=new Set;for(let s of e){if(n.has(s))continue;let l=a[s],c=i[s];Qi(l,c)||r.add(s)}return{added:o,removed:n,updated:r}}var vge="globalState.argv.",mrn=["locale"];function wot(a,i){let e=a.storage?Object.keys(a.storage).sort():[],t={};return e.forEach(o=>t[o]=a.storage[o]),a.storage=t,i?dW(a,{}):JSON.stringify(a)}var TDi=1,Q1t=class extends WU{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super({syncResource:"globalState",profile:e},t,n,c,g,r,s,u,p,l,h,f);this.userDataProfileStorageService=o;this.version=TDi;this.previewResource=this.extUri.joinPath(this.syncPreviewFolder,"globalState.json");this.baseResource=this.previewResource.with({scheme:lk,authority:"base"});this.localResource=this.previewResource.with({scheme:lk,authority:"local"});this.remoteResource=this.previewResource.with({scheme:lk,authority:"remote"});this.acceptedResource=this.previewResource.with({scheme:lk,authority:"accepted"});this.localGlobalStateProvider=v.createInstance(Cot),this._register(n.watch(this.extUri.dirname(this.environmentService.argvResource))),this._register(U.any(U.filter(n.onDidFilesChange,b=>b.contains(this.environmentService.argvResource)),U.filter(o.onDidChange,b=>!!(b.targetChanges.some(S=>this.syncResource.profile.id===S.id)||b.valueChanges.some(({profile:S,changes:y})=>this.syncResource.profile.id===S.id&&y.some(w=>w.target===0)))))((()=>this.triggerLocalChange())))}async generateSyncPreview(e,t,o){let n=e.syncData?JSON.parse(e.syncData.content):null;t=t===null&&o?e:t;let r=t&&t.syncData?JSON.parse(t.syncData.content):null,s=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile);n?this.logService.trace(`${this.syncResourceLogLabel}: Merging remote ui state with local ui state...`):this.logService.trace(`${this.syncResourceLogLabel}: Remote ui state does not exist. Synchronizing ui state for the first time.`);let l=await this.getStorageKeys(r),{local:c,remote:u}=yot(s.storage,n?n.storage:null,r?r.storage:null,l,this.logService),p={content:null,local:c,remote:u,localChange:Object.keys(c.added).length>0||Object.keys(c.updated).length>0||c.removed.length>0?2:0,remoteChange:u.all!==null?2:0},h=wot(s,!1);return[{baseResource:this.baseResource,baseContent:r?wot(r,!1):h,localResource:this.localResource,localContent:h,localUserData:s,remoteResource:this.remoteResource,remoteContent:n?wot(n,!1):null,previewResource:this.previewResource,previewResult:p,localChange:p.localChange,remoteChange:p.remoteChange,acceptedResource:this.acceptedResource,storageKeys:l}]}async hasRemoteChanged(e){let t=e.syncData?JSON.parse(e.syncData.content):null;if(t===null)return!0;let o=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile),n=await this.getStorageKeys(t),{remote:r}=yot(o.storage,t.storage,t.storage,n,this.logService);return r.all!==null}async getMergeResult(e,t){return{...e.previewResult,hasConflicts:!1}}async getAcceptResult(e,t,o,n){if(this.extUri.isEqual(t,this.localResource))return this.acceptLocal(e);if(this.extUri.isEqual(t,this.remoteResource))return this.acceptRemote(e);if(this.extUri.isEqual(t,this.previewResource))return e.previewResult;throw new Error(`Invalid Resource: ${t.toString()}`)}async acceptLocal(e){if(e.remoteContent!==null){let t=JSON.parse(e.remoteContent),{local:o,remote:n}=yot(e.localUserData.storage,t.storage,t.storage,e.storageKeys,this.logService);return{content:e.remoteContent,local:o,remote:n,localChange:0,remoteChange:n.all!==null?2:0}}else return{content:e.localContent,local:{added:{},removed:[],updated:{}},remote:{added:Object.keys(e.localUserData.storage),removed:[],updated:[],all:e.localUserData.storage},localChange:0,remoteChange:2}}async acceptRemote(e){if(e.remoteContent!==null){let t=JSON.parse(e.remoteContent),{local:o,remote:n}=yot(e.localUserData.storage,t.storage,e.localUserData.storage,e.storageKeys,this.logService);return{content:e.remoteContent,local:o,remote:n,localChange:Object.keys(o.added).length>0||Object.keys(o.updated).length>0||o.removed.length>0?2:0,remoteChange:0}}else return{content:e.remoteContent,local:{added:{},removed:[],updated:{}},remote:{added:[],removed:[],updated:[],all:null},localChange:0,remoteChange:0}}async applyResult(e,t,o,n){let{localUserData:r}=o[0][0],{local:s,remote:l,localChange:c,remoteChange:u}=o[0][1];if(c===0&&u===0&&this.logService.info(`${this.syncResourceLogLabel}: No changes found during synchronizing ui state.`),c!==0&&(this.logService.trace(`${this.syncResourceLogLabel}: Updating local ui state...`),await this.backupLocal(JSON.stringify(r)),await this.localGlobalStateProvider.writeLocalGlobalState(s,this.syncResource.profile),this.logService.info(`${this.syncResourceLogLabel}: Updated local ui state`)),u!==0){this.logService.trace(`${this.syncResourceLogLabel}: Updating remote ui state...`);let p=JSON.stringify({storage:l.all});e=await this.updateRemoteUserData(p,n?null:e.ref),this.logService.info(`${this.syncResourceLogLabel}: Updated remote ui state.${l.added.length?` Added: ${l.added}.`:""}${l.updated.length?` Updated: ${l.updated}.`:""}${l.removed.length?` Removed: ${l.removed}.`:""}`)}t?.ref!==e.ref&&(this.logService.trace(`${this.syncResourceLogLabel}: Updating last synchronized ui state...`),await this.updateLastSyncUserData(e),this.logService.info(`${this.syncResourceLogLabel}: Updated last synchronized ui state`))}async resolveContent(e){if(this.extUri.isEqual(this.remoteResource,e)||this.extUri.isEqual(this.baseResource,e)||this.extUri.isEqual(this.localResource,e)||this.extUri.isEqual(this.acceptedResource,e)){let t=await this.resolvePreviewContent(e);return t&&wot(JSON.parse(t),!0)}return null}async hasLocalData(){try{let{storage:e}=await this.localGlobalStateProvider.getLocalGlobalState(this.syncResource.profile);if(Object.keys(e).length>1||e[`${vge}.locale`]?.value!=="en")return!0}catch{}return!1}async getStorageKeys(e){let t=await this.userDataProfileStorageService.readStorageData(this.syncResource.profile),o=[],n=[];for(let[l,c]of t)c.target===0?o.push(l):c.target===1&&n.push(l);let r=[...o,...n],s=e?.storage?Object.keys(e.storage).filter(l=>!l.startsWith(vge)&&!r.includes(l)&&t.get(l)!==void 0):[];if(!Ft){let l=[...rge.map(c=>sge(c)),MU];s.push(...l),n.push(...l)}return{user:o,machine:n,unregistered:s}}};Q1t=I([m(2,WW),m(3,ge),m(4,AW),m(5,tie),m(6,vw),m(7,ko),m(8,Yl),m(9,_e),m(10,B),m(11,de),m(12,gt),m(13,F)],Q1t);var Cot=class{constructor(i,e,t,o){this.fileService=i;this.environmentService=e;this.userDataProfileStorageService=t;this.logService=o}async getLocalGlobalState(i){let e={};if(i.isDefault){let o=await this.getLocalArgvContent(),n=is(o);for(let r of mrn)n[r]!==void 0&&(e[`${vge}${r}`]={version:1,value:n[r]})}let t=await this.userDataProfileStorageService.readStorageData(i);for(let[o,n]of t)n.value&&n.target===0&&(e[o]={version:1,value:n.value,scope:n.scope});return{storage:e}}async getLocalArgvContent(){try{this.logService.debug("GlobalStateSync#getLocalArgvContent",this.environmentService.argvResource);let i=await this.fileService.readFile(this.environmentService.argvResource);return this.logService.debug("GlobalStateSync#getLocalArgvContent - Resolved",this.environmentService.argvResource),i.value.toString()}catch(i){this.logService.debug(Dn(i))}return"{}"}async writeLocalGlobalState({added:i,removed:e,updated:t},o){let n=_Ae("globalState",o),r={},s=new Map,l=o.isDefault?new Map:void 0,c=await this.userDataProfileStorageService.readStorageData(o),u=(p,h)=>{for(let g of p){if(g.startsWith(vge)){r[g.substring(vge.length)]=h?h[g].value:void 0;continue}if(h){let f=h[g];f.value!==c.get(g)?.value&&(l&&f.scope===-2?l:s).set(g,f.value)}else c.get(g)!==void 0&&(l&&c.get(g)?.scope===-2?l:s).set(g,void 0)}};if(u(Object.keys(i),i),u(Object.keys(t),t),u(e),Object.keys(r).length){this.logService.trace(`${n}: Updating locale...`);let p=await this.getLocalArgvContent(),h=p;for(let g of Object.keys(r))h=pAe(h,[g],r[g],{});p!==h&&(this.logService.trace(`${n}: Updating locale...`),await this.fileService.writeFile(this.environmentService.argvResource,Ke.fromString(h)),this.logService.info(`${n}: Updated locale.`)),this.logService.info(`${n}: Updated locale`)}s.size&&(this.logService.trace(`${n}: Updating global state...`),await this.userDataProfileStorageService.updateStorageData(o,s,0),this.logService.info(`${n}: Updated global state`,[...s.keys()])),l?.size&&(this.logService.trace(`${n}: Updating application shared state...`),await this.userDataProfileStorageService.updateStorageData(o,l,0,-2),this.logService.info(`${n}: Updated application shared state`,[...l.keys()]))}};Cot=I([m(0,ge),m(1,ko),m(2,WW),m(3,vw)],Cot);var Y1t=class extends pie{constructor(i,e,t,o,n,r){super("globalState",t,o,n,e,i,r)}async doInitialize(i){let e=i.syncData?JSON.parse(i.syncData.content):null;if(!e){this.logService.info("Skipping initializing global state because remote global state does not exist.");return}let t={},o=this.storageService.hasScope(this.userDataProfilesService.defaultProfile),n={};for(let r of Object.keys(e.storage))if(r.startsWith(vge))t[r.substring(vge.length)]=e.storage[r].value;else{let s=e.storage[r].scope===-2;if(s&&!o)continue;let l=s?-2:0;this.storageService.get(r,l)===void 0&&(n[r]={value:e.storage[r].value,scope:l})}if(Object.keys(t).length){let r="{}";try{r=(await this.fileService.readFile(this.environmentService.argvResource)).value.toString()}catch{}for(let s of Object.keys(t))r=pAe(r,[s],t[s],{});await this.fileService.writeFile(this.environmentService.argvResource,Ke.fromString(r))}if(Object.keys(n).length){let r=[];for(let s of Object.keys(n))r.push({key:s,value:n[s].value,scope:n[s].scope,target:0});this.storageService.storeAll(r,!0)}}};Y1t=I([m(0,de),m(1,ge),m(2,hn),m(3,ko),m(4,vw),m(5,gt)],Y1t);var DAe=class{constructor(i,e,t,o,n){this.userDataSyncStoreClient=i;this.storageService=e;this.environmentService=t;this.fileService=o;this.logService=n}getSyncStoreType(i){return this.parseGlobalState(i)?.storage[MU]?.value}async sync(i){let e=$it(ht());try{return await this.doSync(i,e)}catch(t){if(t instanceof Cf&&t.code==="PreconditionFailed")return this.logService.info("Failed to synchronize UserDataSyncStoreType as there is a new remote version available. Synchronizing again..."),this.doSync(i,e);throw t}}async doSync(i,e){let t=await this.userDataSyncStoreClient.readResource("globalState",null,void 0,e),o=this.parseGlobalState(t)||{storage:{}};o.storage[MU]={value:i,version:TDi};let n=await k0(this.environmentService,this.fileService,this.storageService),r={version:TDi,machineId:n,content:wot(o,!1)};await this.userDataSyncStoreClient.writeResource("globalState",JSON.stringify(r),t.ref,void 0,e)}parseGlobalState({content:i}){if(!i)return null;let e=JSON.parse(i);if(Iot(e))return e?JSON.parse(e.content):null;throw new Error("Invalid remote data")}};DAe=I([m(1,de),m(2,ko),m(3,ge),m(4,re)],DAe);var mie=le("IUserDataSyncMachinesService"),_Di="sync.currentMachineName",pbo="Safari",mbo="Chrome",hbo="Edge",gbo="Firefox",fbo="Android";function vbo(a){switch(a){case pbo:case mbo:case hbo:case gbo:case fbo:case oD(0):return!0}return!1}function ubo(){return qye?pbo:bz?mbo:$ye?hbo:Gye?gbo:Nvt?fbo:oD(Ft?0:xm)}var HW=class extends k{constructor(e,t,o,n,r,s){super();this.storageService=o;this.userDataSyncStoreService=n;this.logService=r;this.productService=s;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.userData=null;this.currentMachineIdPromise=k0(e,t,o)}static{this.VERSION=1}static{this.RESOURCE="machines"}async getMachines(e){let t=await this.currentMachineIdPromise;return(await this.readMachinesData(e)).machines.map(n=>({...n,isCurrent:n.id===t}))}async addCurrentMachine(e){let t=await this.currentMachineIdPromise,o=await this.readMachinesData(e);o.machines.some(({id:n})=>n===t)||(o.machines.push({id:t,name:this.computeCurrentMachineName(o.machines),platform:ubo()}),await this.writeMachinesData(o))}async removeCurrentMachine(e){let t=await this.currentMachineIdPromise,o=await this.readMachinesData(e),n=o.machines.filter(({id:r})=>r!==t);n.length!==o.machines.length&&(o.machines=n,await this.writeMachinesData(o))}async renameMachine(e,t,o){let n=await this.readMachinesData(o),r=n.machines.find(({id:s})=>s===e);if(r){r.name=t,await this.writeMachinesData(n);let s=await this.currentMachineIdPromise;e===s&&this.storageService.store(_Di,t,-1,1)}}async setEnablements(e){let t=await this.readMachinesData();for(let[o,n]of e){let r=t.machines.find(s=>s.id===o);r&&(r.disabled=n?void 0:!0)}await this.writeMachinesData(t)}computeCurrentMachineName(e){let t=this.storageService.get(_Di,-1);if(t){if(!e.some(s=>s.name===t))return t;this.storageService.remove(_Di,-1)}let o=`${this.productService.embedderIdentifier?`${this.productService.embedderIdentifier} - `:""}${ubo()} (${this.productService.nameShort})`,n=new RegExp(`${Ss(o)}\\s#(\\d+)`),r=0;for(let s of e){let l=n.exec(s.name),c=l?parseInt(l[1]):0;r=c>r?c:r}return`${o} #${r+1}`}async readMachinesData(e){this.userData=await this.readUserData(e);let t=this.parse(this.userData);if(t.version!==HW.VERSION)throw new Error(d(2973,null,this.productService.nameLong));return t}async writeMachinesData(e){let t=JSON.stringify(e),o=await this.userDataSyncStoreService.writeResource(HW.RESOURCE,t,this.userData?.ref||null);this.userData={ref:o,content:t},this._onDidChange.fire()}async readUserData(e){if(this.userData){let t=e&&e.latest?e.latest[HW.RESOURCE]:void 0;if(this.userData.ref===t)return this.userData;if(t===void 0&&this.userData.content===null)return this.userData}return this.userDataSyncStoreService.readResource(HW.RESOURCE,this.userData)}parse(e){if(e.content!==null)try{return JSON.parse(e.content)}catch(t){this.logService.error(t)}return{version:HW.VERSION,machines:[]}}};HW=I([m(0,ko),m(1,ge),m(2,de),m(3,AW),m(4,vw),m(5,Ze)],HW);var X1t=class{constructor(i,e){this.authenticationProviderId=i;this.session=e}get sessionId(){return this.session.id}get accountName(){return this.session.account.label}get accountId(){return this.session.account.id}get token(){return this.session.idToken||this.session.accessToken}};function hrn(a){let i=a;return A.isUri(i?.base)&&A.isUri(i?.input1?.uri)&&A.isUri(i?.input2?.uri)&&A.isUri(i?.result)}var OR=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J){super();this.userDataSyncService=e;this.uriIdentityService=t;this.authenticationService=o;this.userDataSyncAccountService=n;this.quickInputService=r;this.storageService=s;this.userDataSyncEnablementService=l;this.userDataAutoSyncService=c;this.logService=u;this.productService=p;this.extensionService=h;this.environmentService=g;this.secretStorageService=f;this.notificationService=v;this.progressService=b;this.dialogService=S;this.viewsService=w;this.viewDescriptorService=x;this.userDataSyncStoreManagementService=E;this.lifecycleService=M;this.instantiationService=N;this.editorService=V;this.userDataInitializationService=H;this.fileService=K;this.fileDialogService=j;this.userDataSyncMachinesService=J;this._authenticationProviders=[];this._accountStatus="uninitialized";this._onDidChangeAccountStatus=this._register(new T);this.onDidChangeAccountStatus=this._onDidChangeAccountStatus.event;this._onDidTurnOnSync=this._register(new T);this.onDidTurnOnSync=this._onDidTurnOnSync.event;this.turnOnSyncCancellationToken=void 0;this._cachedCurrentAuthenticationProviderId=null;this._cachedCurrentSessionId=null;this.syncEnablementContext=NR.bindTo(y),this.syncStatusContext=bw.bindTo(y),this.accountStatusContext=NU.bindTo(y),this.activityViewsEnablementContext=gge.bindTo(y),this.hasConflicts=die.bindTo(y),this.enableConflictsViewContext=U1t.bindTo(y),this.userDataSyncStoreManagementService.userDataSyncStore&&(this.syncStatusContext.set(this.userDataSyncService.status),this._register(e.onDidChangeStatus(se=>this.syncStatusContext.set(se))),this.syncEnablementContext.set(l.isEnabled()),this._register(l.onDidChangeEnablement(se=>this.syncEnablementContext.set(se))),this.waitAndInitialize())}static{this.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY="userDataSyncAccount.donotUseWorkbenchSession"}static{this.CACHED_AUTHENTICATION_PROVIDER_KEY="userDataSyncAccountProvider"}static{this.CACHED_SESSION_STORAGE_KEY="userDataSyncAccountPreference"}get enabled(){return!!this.userDataSyncStoreManagementService.userDataSyncStore}get authenticationProviders(){return this._authenticationProviders}get accountStatus(){return this._accountStatus}get current(){return this._current}updateAuthenticationProviders(){let e=this._authenticationProviders;return this._authenticationProviders=(this.userDataSyncStoreManagementService.userDataSyncStore?.authenticationProviders||[]).filter(({id:t})=>this.authenticationService.declaredProviders.some(o=>o.id===t)),this.logService.trace("Settings Sync: Authentication providers updated",this._authenticationProviders.map(({id:t})=>t)),eo(e,this._authenticationProviders,(t,o)=>t.id===o.id)}isSupportedAuthenticationProviderId(e){return this.authenticationProviders.some(({id:t})=>t===e)}async waitAndInitialize(){try{await Promise.all([this.extensionService.whenInstalledExtensionsRegistered(),this.userDataInitializationService.whenInitializationFinished()]),await this.initialize()}catch(e){this.environmentService.extensionTestsLocationURI||this.logService.error(e)}}async initialize(){if(Ft){let t=await ite(this.secretStorageService,this.productService);this.currentSessionId===void 0&&t?.id&&(this.environmentService.options?.settingsSyncOptions?.authenticationProvider&&this.environmentService.options.settingsSyncOptions.enabled?this.currentSessionId=t.id:this.useWorkbenchSessionId&&(this.currentSessionId=t.id),this.useWorkbenchSessionId=!1)}let e=this.update("initialize");this._register(this.authenticationService.onDidChangeDeclaredProviders(()=>{this.updateAuthenticationProviders()&&e.finally(()=>this.update("declared authentication providers changed"))})),await e,this._register(U.filter(U.any(this.authenticationService.onDidRegisterAuthenticationProvider,this.authenticationService.onDidUnregisterAuthenticationProvider),t=>this.isSupportedAuthenticationProviderId(t.id))(()=>this.update("authentication provider change"))),this._register(U.filter(this.userDataSyncAccountService.onTokenFailed,t=>!t)(()=>this.update("token failure"))),this._register(U.filter(this.authenticationService.onDidChangeSessions,t=>this.isSupportedAuthenticationProviderId(t.providerId))(({event:t})=>this.onDidChangeSessions(t))),this._register(this.storageService.onDidChangeValue(-1,OR.CACHED_SESSION_STORAGE_KEY,this._store)(()=>this.onDidChangeStorage())),this._register(U.filter(this.userDataSyncAccountService.onTokenFailed,t=>t)(()=>this.onDidAuthFailure())),this.hasConflicts.set(this.userDataSyncService.conflicts.length>0),this._register(this.userDataSyncService.onDidChangeConflicts(t=>{this.hasConflicts.set(t.length>0),t.length||this.enableConflictsViewContext.reset(),this.editorService.editors.filter(o=>(qD(o)?o.original.resource:hrn(o)?o.input1.uri:void 0)?.scheme!==lk?!1:!this.userDataSyncService.conflicts.some(({conflicts:r})=>r.some(({previewResource:s})=>this.uriIdentityService.extUri.isEqual(s,o.resource)))).forEach(o=>o.dispose())}))}async update(e){this.logService.trace(`Settings Sync: Updating due to ${e}`),this.updateAuthenticationProviders(),await this.updateCurrentAccount(),this._current&&(this.currentAuthenticationProviderId=this._current.authenticationProviderId),await this.updateToken(this._current),this.updateAccountStatus(this._current?"available":"unavailable")}async updateCurrentAccount(){this.logService.trace("Settings Sync: Updating the current account");let e=this.currentSessionId,t=this.currentAuthenticationProviderId;if(e){let o=t?this.authenticationProviders.filter(({id:n})=>n===t):this.authenticationProviders;for(let{id:n,scopes:r}of o){let s=await this.authenticationService.getSessions(n,r)||[];for(let l of s)if(l.id===e){this._current=new X1t(n,l),this.logService.trace("Settings Sync: Updated the current account",this._current.accountName);return}}}this._current=void 0}async updateToken(e){let t;if(e)try{t={token:e.token,authenticationProviderId:e.authenticationProviderId}}catch(o){this.logService.error(o)}await this.userDataSyncAccountService.updateAccount(t)}updateAccountStatus(e){if(this.logService.trace(`Settings Sync: Updating the account status to ${e}`),this._accountStatus!==e){let o=`Settings Sync: Account status changed from ${this._accountStatus} to ${e}`;Sp.VSCODE_DEV?this.logService.trace(o):this.logService.info(o),this._accountStatus=e,this.accountStatusContext.set(e),this._onDidChangeAccountStatus.fire(e)}}async turnOn(){if(!this.authenticationProviders.length)throw new Error(d(19585,null));if(this.userDataSyncEnablementService.isEnabled())return;if(this.userDataSyncService.status!=="idle")throw new Error("Cannot turn on sync while syncing");if(!await this.pick())throw new qi;if(this.accountStatus!=="available")throw new Error(d(19584,null));let t=this.turnOnSyncCancellationToken=new qe,o=Ft?k.None:this.lifecycleService.onBeforeShutdown(n=>n.veto((async()=>{let{confirmed:r}=await this.dialogService.confirm({type:"warning",message:d(19601,null),title:d(19597,null),primaryButton:d(19605,null),cancelButton:d(19583,null)});return r&&t.cancel(),!r})(),"veto.settingsSync"));try{await this.doTurnOnSync(t.token)}finally{o.dispose(),this.turnOnSyncCancellationToken=void 0}await this.userDataAutoSyncService.turnOn(),this.userDataSyncStoreManagementService.userDataSyncStore?.canSwitch&&await this.synchroniseUserDataSyncStoreType(),this.currentAuthenticationProviderId=this.current?.authenticationProviderId,this.environmentService.options?.settingsSyncOptions?.enablementHandler&&this.currentAuthenticationProviderId&&this.environmentService.options.settingsSyncOptions.enablementHandler(!0,this.currentAuthenticationProviderId),this.notificationService.info(d(19602,null,ug.value)),this._onDidTurnOnSync.fire()}async turnoff(e){this.userDataSyncEnablementService.isEnabled()&&(await this.userDataAutoSyncService.turnOff(e),this.environmentService.options?.settingsSyncOptions?.enablementHandler&&this.currentAuthenticationProviderId&&this.environmentService.options.settingsSyncOptions.enablementHandler(!1,this.currentAuthenticationProviderId)),this.turnOnSyncCancellationToken&&this.turnOnSyncCancellationToken.cancel()}async synchroniseUserDataSyncStoreType(){if(!this.userDataSyncAccountService.account)throw new Error("Cannot update because you are signed out from settings sync. Please sign in and try again.");if(!Ft||!this.userDataSyncStoreManagementService.userDataSyncStore)return;let e=this.userDataSyncStoreManagementService.userDataSyncStore.type==="insiders"?this.userDataSyncStoreManagementService.userDataSyncStore.stableUrl:this.userDataSyncStoreManagementService.userDataSyncStore.insidersUrl,t=this.instantiationService.createInstance(FU,e);t.setAuthToken(this.userDataSyncAccountService.account.token,this.userDataSyncAccountService.account.authenticationProviderId),await this.instantiationService.createInstance(DAe,t).sync(this.userDataSyncStoreManagementService.userDataSyncStore.type)}syncNow(){return this.userDataAutoSyncService.triggerSync(["Sync Now"],{immediately:!0,disableCache:!0})}async doTurnOnSync(e){let t=new O,o=await this.userDataSyncService.createManualSyncTask();try{await this.progressService.withProgress({location:10,title:ug.value,command:BW,delay:500},async n=>{n.report({message:d(19604,null)}),t.add(this.userDataSyncService.onDidChangeStatus(r=>{r==="hasConflicts"?n.report({message:d(19596,null)}):n.report({message:d(19603,null)})})),await o.merge(),this.userDataSyncService.status==="hasConflicts"&&await this.handleConflictsWhileTurningOn(e),await o.apply()})}catch(n){throw await o.stop(),n}finally{t.dispose()}}async handleConflictsWhileTurningOn(e){let t=this.userDataSyncService.conflicts,o=d(19577,null),n="";for(let s=0;s<t.length;s++)s===t.length-1&&s!==0?n+=o:s!==0&&(n+=", "),n+=wb(t[s].syncResource);let r=t.length===1?wb(t[0].syncResource):void 0;await this.dialogService.prompt({type:ft.Warning,message:d(19579,null,n),detail:d(19595,null),buttons:[{label:d(19598,null),run:async()=>{let s=Ym(U.toPromise(U.filter(this.userDataSyncService.onDidChangeConflicts,l=>l.length===0)),e);await this.showConflicts(this.userDataSyncService.conflicts[0]?.conflicts[0]),await s}},{label:r?d(19589,null,r):d(19588,null),run:async()=>this.replace(!0)},{label:r?d(19591,null,r):d(19590,null),run:()=>this.replace(!1)}],cancelButton:{run:()=>{throw new qi}}})}async replace(e){for(let t of this.userDataSyncService.conflicts)for(let o of t.conflicts)await this.accept({syncResource:t.syncResource,profile:t.profile},e?o.remoteResource:o.localResource,void 0,{force:!0})}async accept(e,t,o,n){return this.userDataSyncService.accept(e,t,o,n)}async showConflicts(e){if(!this.userDataSyncService.conflicts.length)return;this.enableConflictsViewContext.set(!0);let t=await this.viewsService.openView(uie);t&&e&&await t.open(e)}async resetSyncedData(){let{confirmed:e}=await this.dialogService.confirm({type:"info",message:d(19592,null),title:d(19593,null),primaryButton:d(19594,null)});e&&await this.userDataSyncService.resetRemote()}async getAllLogResources(){let e=[],t=await this.fileService.resolve(this.uriIdentityService.extUri.dirname(this.environmentService.logsHome));t.children&&e.push(...t.children.filter(n=>n.isDirectory&&/^\d{8}T\d{6}$/.test(n.name)).sort().reverse().map(n=>n.resource));let o=[];for(let n of e){let s=(await this.fileService.resolve(n)).children?.find(l=>this.uriIdentityService.extUri.basename(l.resource).startsWith(`${age}.`));s&&o.push(s.resource)}return o}async showSyncActivity(){this.activityViewsEnablementContext.set(!0),await this.waitForActiveSyncViews(),await this.viewsService.openViewContainer(OU)}async downloadSyncActivity(){let e=await this.fileDialogService.showOpenDialog({title:d(19581,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,openLabel:d(19580,null)});if(e?.[0])return this.progressService.withProgress({location:10},async()=>{let o=(await this.userDataSyncMachinesService.getMachines()).find(u=>u.isCurrent),n=(o?o.name+" - ":"")+"Settings Sync Activity",r=await this.fileService.resolve(e[0]),s=new RegExp(`${Ss(n)}\\s(\\d+)`),l=[];for(let u of r.children??[])if(u.name===n)l.push(0);else{let p=s.exec(u.name);p&&l.push(parseInt(p[1]))}l.sort((u,p)=>u-p);let c=this.uriIdentityService.extUri.joinPath(e[0],l[0]!==0?n:`${n} ${l[l.length-1]+1}`);return await Promise.all([this.userDataSyncService.saveRemoteActivityData(this.uriIdentityService.extUri.joinPath(c,"remoteActivity.json")),(async()=>{let u=await this.getAllLogResources();await Promise.all(u.map(async p=>this.fileService.copy(p,this.uriIdentityService.extUri.joinPath(c,"logs",`${this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(p))}.log`))))})(),this.fileService.copy(this.environmentService.userDataSyncHome,this.uriIdentityService.extUri.joinPath(c,"localActivity"))]),c})}async waitForActiveSyncViews(){let e=this.viewDescriptorService.getViewContainerById(OU);if(e){let t=this.viewDescriptorService.getViewContainerModel(e);t.activeViewDescriptors.length||await U.toPromise(U.filter(t.onDidChangeActiveViewDescriptors,o=>t.activeViewDescriptors.length>0))}}async signIn(){let e=this.currentAuthenticationProviderId,t=e?this.authenticationProviders.find(o=>o.id===e):void 0;if(t)await this.doSignIn(t);else{if(!this.authenticationProviders.length)throw new Error(d(19586,null));await this.pick()}}async pick(){let e=await this.doPick();return e?(await this.doSignIn(e),!0):!1}async doPick(){if(this.authenticationProviders.length===0)return;let e=[...this.authenticationProviders].sort(({id:l})=>l===this.currentAuthenticationProviderId?-1:1),t=new Map;if(e.length===1){let l=await this.getAccounts(e[0].id,e[0].scopes);if(l.length)t.set(e[0].id,l);else return e[0]}let o,n=new O,r=n.add(this.quickInputService.createQuickPick({useSeparators:!0})),s=new Promise(l=>{n.add(r.onDidHide(()=>{n.dispose(),l(o)}))});if(r.title=ug.value,r.ok=!1,r.ignoreFocusOut=!0,r.placeholder=d(19578,null),r.show(),e.length>1){r.busy=!0;for(let{id:l,scopes:c}of e){let u=await this.getAccounts(l,c);u.length&&t.set(l,u)}r.busy=!1}return r.items=this.createQuickpickItems(e,t),n.add(r.onDidAccept(()=>{o=r.selectedItems[0]?.account?r.selectedItems[0]?.account:r.selectedItems[0]?.authenticationProvider,r.hide()})),s}async getAccounts(e,t){let o=new Map,n=null,r=await this.authenticationService.getSessions(e,t)||[];for(let s of r){let l=new X1t(e,s);o.set(l.accountId,l),l.sessionId===this.currentSessionId&&(n=l)}return n&&o.set(n.accountId,n),n?[...o.values()]:[...o.values()].sort(({sessionId:s})=>s===this.currentSessionId?-1:1)}createQuickpickItems(e,t){let o=[];if(t.size){o.push({type:"separator",label:d(19600,null)});for(let n of e){let r=(t.get(n.id)||[]).sort(({sessionId:l})=>l===this.currentSessionId?-1:1),s=this.authenticationService.getProvider(n.id).label;for(let l of r)o.push({label:`${l.accountName} (${s})`,description:l.sessionId===this.current?.sessionId?d(19582,null):void 0,account:l,authenticationProvider:n})}o.push({type:"separator",label:d(19587,null)})}for(let n of e){let r=this.authenticationService.getProvider(n.id);if(!t.has(n.id)||r.supportsMultipleAccounts){let s=r.label;o.push({label:d(19599,null,s),authenticationProvider:n})}}return o}async doSignIn(e){let t;ebo(e)?(this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.id===e.id?t=await this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.signIn():t=(await this.authenticationService.createSession(e.id,e.scopes)).id,this.currentAuthenticationProviderId=e.id):(this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.id===e.authenticationProviderId?t=await this.environmentService.options?.settingsSyncOptions?.authenticationProvider?.signIn():t=e.sessionId,this.currentAuthenticationProviderId=e.authenticationProviderId),this.currentSessionId=t,await this.update("sign in")}async onDidAuthFailure(){this.currentSessionId=void 0,await this.update("auth failure")}onDidChangeSessions(e){this.currentSessionId&&e.removed?.find(t=>t.id===this.currentSessionId)&&(this.currentSessionId=void 0),this.update("change in sessions")}onDidChangeStorage(){this.currentSessionId!==this.getStoredCachedSessionId()&&(this._cachedCurrentSessionId=null,this.update("change in storage"))}get currentAuthenticationProviderId(){return this._cachedCurrentAuthenticationProviderId===null&&(this._cachedCurrentAuthenticationProviderId=this.storageService.get(OR.CACHED_AUTHENTICATION_PROVIDER_KEY,-1)),this._cachedCurrentAuthenticationProviderId}set currentAuthenticationProviderId(e){this._cachedCurrentAuthenticationProviderId!==e&&(this._cachedCurrentAuthenticationProviderId=e,e===void 0?this.storageService.remove(OR.CACHED_AUTHENTICATION_PROVIDER_KEY,-1):this.storageService.store(OR.CACHED_AUTHENTICATION_PROVIDER_KEY,e,-1,1))}get currentSessionId(){return this._cachedCurrentSessionId===null&&(this._cachedCurrentSessionId=this.getStoredCachedSessionId()),this._cachedCurrentSessionId}set currentSessionId(e){this._cachedCurrentSessionId!==e&&(this._cachedCurrentSessionId=e,e===void 0?(this.logService.info("Settings Sync: Reset current session"),this.storageService.remove(OR.CACHED_SESSION_STORAGE_KEY,-1)):(this.logService.info("Settings Sync: Updated current session",e),this.storageService.store(OR.CACHED_SESSION_STORAGE_KEY,e,-1,1)))}getStoredCachedSessionId(){return this.storageService.get(OR.CACHED_SESSION_STORAGE_KEY,-1)}get useWorkbenchSessionId(){return!this.storageService.getBoolean(OR.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY,-1,!1)}set useWorkbenchSessionId(e){this.storageService.store(OR.DONOT_USE_WORKBENCH_SESSION_STORAGE_KEY,!e,-1,1)}};OR=I([m(0,ny),m(1,gt),m(2,ks),m(3,dAe),m(4,$e),m(5,de),m(6,Yl),m(7,T_),m(8,re),m(9,Ze),m(10,lt),m(11,Od),m(12,fC),m(13,Ne),m(14,Go),m(15,ct),m(16,X),m(17,Gt),m(18,ji),m(19,uP),m(20,to),m(21,F),m(22,ie),m(23,tQ),m(24,ge),m(25,nn),m(26,mie)],OR);Ce(ry,OR,0);var RAe=" ",xot=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.activityService=e;this.storageService=t;this.dialogService=o;this.quickInputService=n;this._productService=r;this._authenticationService=s;this._authenticationUsageService=l;this._authenticationAccessService=c;this._signInRequestItems=new Map;this._sessionAccessRequestItems=new Map;this._accountBadgeDisposable=this._register(new ue);this._onDidAccountPreferenceChange=this._register(new T);this.onDidChangeAccountPreference=this._onDidAccountPreferenceChange.event;this._inheritAuthAccountPreferenceParentToChildren=this._productService.inheritAuthAccountPreference||{},this._inheritAuthAccountPreferenceChildToParent=Object.entries(this._inheritAuthAccountPreferenceParentToChildren).reduce((u,[p,h])=>(h.forEach(g=>{u[g]=p}),u),{}),this.registerListeners()}registerListeners(){this._register(this._authenticationService.onDidChangeSessions(e=>{e.event.added?.length&&this.updateNewSessionRequests(e.providerId,e.event.added),e.event.removed?.length&&this.updateAccessRequests(e.providerId,e.event.removed)})),this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this._sessionAccessRequestItems.get(e.id)||{};Object.keys(t).forEach(o=>{this.removeAccessRequest(e.id,o)})}))}updateNewSessionRequests(e,t){let o=this._signInRequestItems.get(e);o&&Object.keys(o).forEach(n=>{let r=n.split(RAe);t.some(s=>N0t(s.scopes,r))&&(o[n]?.disposables.forEach(l=>l.dispose()),delete o[n],Object.keys(o).length===0?this._signInRequestItems.delete(e):this._signInRequestItems.set(e,o),this.updateBadgeCount())})}updateAccessRequests(e,t){let o=this._sessionAccessRequestItems.get(e);o&&Object.keys(o).forEach(n=>{t.forEach(r=>{let s=o[n].possibleSessions.findIndex(l=>l.id===r.id);s&&o[n].possibleSessions.splice(s,1)}),o[n].possibleSessions.length||this.removeAccessRequest(e,n)})}updateBadgeCount(){this._accountBadgeDisposable.clear();let e=0;if(this._signInRequestItems.forEach(t=>{Object.keys(t).forEach(o=>{e+=t[o].requestingExtensionIds.length})}),this._sessionAccessRequestItems.forEach(t=>{e+=Object.keys(t).length}),e>0){let t=new eu(e,()=>d(18671,null));this._accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:t})}}removeAccessRequest(e,t){let o=this._sessionAccessRequestItems.get(e)||{};o[t]&&(je(o[t].disposables),delete o[t],this.updateBadgeCount())}updateAccountPreference(e,t,o){let n=hi.toKey(e),r=this._inheritAuthAccountPreferenceChildToParent[n]??n,s=this._getKey(r,t);this.storageService.store(s,o.label,1,1),this.storageService.store(s,o.label,-1,1);let l=this._inheritAuthAccountPreferenceParentToChildren[r],c=l?[r,...l]:[r];this._onDidAccountPreferenceChange.fire({extensionIds:c,providerId:t})}getAccountPreference(e,t){let o=hi.toKey(e),n=this._getKey(this._inheritAuthAccountPreferenceChildToParent[o]??o,t);return this.storageService.get(n,1)??this.storageService.get(n,-1)}removeAccountPreference(e,t){let o=hi.toKey(e),n=this._getKey(this._inheritAuthAccountPreferenceChildToParent[o]??o,t);this.storageService.remove(n,1),this.storageService.remove(n,-1)}_getKey(e,t){return`${e}-${t}`}updateSessionPreference(e,t,o){let r=`${hi.toKey(t)}-${e}-${o.scopes.join(RAe)}`;this.storageService.store(r,o.id,1,1),this.storageService.store(r,o.id,-1,1)}getSessionPreference(e,t,o){let r=`${hi.toKey(t)}-${e}-${o.join(RAe)}`;return this.storageService.get(r,1)??this.storageService.get(r,-1)}removeSessionPreference(e,t,o){let r=`${hi.toKey(t)}-${e}-${o.join(RAe)}`;this.storageService.remove(r,1),this.storageService.remove(r,-1)}_updateAccountAndSessionPreferences(e,t,o){this.updateAccountPreference(t,e,o.account),this.updateSessionPreference(e,t,o)}async showGetSessionPrompt(e,t,o,n){let r;(p=>(p[p.Allow=0]="Allow",p[p.Deny=1]="Deny",p[p.Cancel=2]="Cancel"))(r||={});let{result:s}=await this.dialogService.prompt({type:ft.Info,message:d(18667,null,n,e.label,t),buttons:[{label:d(18666,null),run:()=>0},{label:d(18668,null),run:()=>1}],cancelButton:{run:()=>2}});return s!==2&&(this._authenticationAccessService.updateAllowedExtensions(e.id,t,[{id:o,name:n,allowed:s===0}]),this.removeAccessRequest(e.id,o)),s===0}async selectSession(e,t,o,n,r){let s=await this._authenticationService.getAccounts(e);if(!s.length)throw new Error("No accounts available");let l=new O,c=l.add(this.quickInputService.createQuickPick());c.ignoreFocusOut=!0;let u=new Set,p=r.filter(h=>!u.has(h.account.label)&&u.add(h.account.label)).map(h=>({label:h.account.label,session:h}));return s.forEach(h=>{u.has(h.label)||p.push({label:h.label,account:h})}),p.push({label:d(18673,null)}),c.items=p,c.title=d(18670,null,o,this._authenticationService.getProvider(e).label),c.placeholder=d(18669,null,o),await new Promise((h,g)=>{l.add(c.onDidAccept(async f=>{c.dispose();let v=c.selectedItems[0].session;if(!v){let S=c.selectedItems[0].account;try{v=await this._authenticationService.createSession(e,n,{account:S})}catch(y){g(y);return}}let b=v.account.label;this._authenticationAccessService.updateAllowedExtensions(e,b,[{id:t,name:o,allowed:!0}]),this._updateAccountAndSessionPreferences(e,t,v),this.removeAccessRequest(e,t),h(v)})),l.add(c.onDidHide(f=>{c.selectedItems[0]||g("User did not consent to account access"),l.dispose()})),c.show()})}async completeSessionAccessRequest(e,t,o,n){let s=(this._sessionAccessRequestItems.get(e.id)||{})[t];if(!s||!e)return;let l=s.possibleSessions,c;if(e.supportsMultipleAccounts)try{c=await this.selectSession(e.id,t,o,n,l)}catch{}else await this.showGetSessionPrompt(e,l[0].account.label,t,o)&&(c=l[0]);c&&this._authenticationUsageService.addAccountUsage(e.id,c.account.label,c.scopes,t,o)}requestSessionAccess(e,t,o,n,r){let s=this._sessionAccessRequestItems.get(e)||{};if(s[t])return;let c=this._authenticationService.getProvider(e),u=be.appendMenuItem(R.AccountsContext,{group:"3_accessRequests",command:{id:`${e}${t}Access`,title:d(18665,null,c.label,o)}}),p=Ge.registerCommand({id:`${e}${t}Access`,handler:async h=>{this.completeSessionAccessRequest(c,t,o,n)}});s[t]={possibleSessions:r,disposables:[u,p]},this._sessionAccessRequestItems.set(e,s),this.updateBadgeCount()}async requestNewSession(e,t,o,n){this._authenticationService.isAuthenticationProviderRegistered(e)||await new Promise((g,f)=>{let v=this._authenticationService.onDidRegisterAuthenticationProvider(b=>{b.id===e&&(v.dispose(),g())})});let r;try{r=this._authenticationService.getProvider(e)}catch{return}let s=this._signInRequestItems.get(e),l=Lpe(t)?`${t.wwwAuthenticate}:${t.fallbackScopes?.join(RAe)??""}`:`${t.join(RAe)}`;if(s&&s[l]&&s[l].requestingExtensionIds.includes(o))return;let u=`${e}:${o}:signIn${Object.keys(s||[]).length}`,p=be.appendMenuItem(R.AccountsContext,{group:"2_signInRequests",command:{id:u,title:d(18672,null,r.label,n)}}),h=Ge.registerCommand({id:u,handler:async g=>{let v=await g.get(ks).createSession(e,t);this._authenticationAccessService.updateAllowedExtensions(e,v.account.label,[{id:o,name:n,allowed:!0}]),this._updateAccountAndSessionPreferences(e,o,v)}});if(s){let g=s[l]||{disposables:[],requestingExtensionIds:[]};s[l]={disposables:[...g.disposables,p,h],requestingExtensionIds:[...g.requestingExtensionIds,o]},this._signInRequestItems.set(e,s)}else this._signInRequestItems.set(e,{[l]:{disposables:[p,h],requestingExtensionIds:[o]}});this.updateBadgeCount()}};xot=I([m(0,Al),m(1,de),m(2,ct),m(3,$e),m(4,Ze),m(5,ks),m(6,RN),m(7,mE)],xot);Ce(xZ,xot,1);var hie=class extends k{constructor(e,t,o){super();this.storageService=e;this.secretStorageService=t;this.logService=o;this._onDidChangeTokens=this._register(new T);this.onDidChangeTokens=this._onDidChangeTokens.event;let n=new Hh;this._register(this.secretStorageService.onDidChangeSecret(async r=>{let s;try{s=JSON.parse(r)}catch{}s?.isDynamicAuthProvider&&n.queue(async()=>{let l=await this.getSessionsForDynamicAuthProvider(s.authProviderId,s.clientId);this._onDidChangeTokens.fire({authProviderId:s.authProviderId,clientId:s.clientId,tokens:l})})}))}static{this.PROVIDERS_STORAGE_KEY="dynamicAuthProviders"}async getClientRegistration(e){let t=`dynamicAuthProvider:clientRegistration:${e}`,o=await this.secretStorageService.get(t);if(o)try{let s=JSON.parse(o);if(s&&(s.clientId||s.clientSecret))return s}catch{await this.secretStorageService.delete(t)}let r=this._getStoredProviders().find(s=>s.providerId===e);return r?.clientId?{clientId:r.clientId}:void 0}getClientId(e){return this._getStoredProviders().find(n=>n.providerId===e)?.clientId}async storeClientRegistration(e,t,o,n,r){this._trackProvider(e,t,o,r);let s=`dynamicAuthProvider:clientRegistration:${e}`,l={clientId:o,clientSecret:n};await this.secretStorageService.set(s,JSON.stringify(l))}_trackProvider(e,t,o,n){let r=this._getStoredProviders(),s=r.findIndex(l=>l.providerId===e);if(s===-1){let l={providerId:e,label:n||e,authorizationServer:t,clientId:o};r.push(l),this._storeProviders(r)}else{let l=r[s],c={providerId:e,label:n||l.label,authorizationServer:t,clientId:o};r[s]=c,this._storeProviders(r)}}_getStoredProviders(){let e=this.storageService.get(hie.PROVIDERS_STORAGE_KEY,-1,"[]");try{let t=JSON.parse(e);for(let o of t)o.authorizationServer||(o.authorizationServer=o.issuer);return t}catch{return[]}}_storeProviders(e){this.storageService.store(hie.PROVIDERS_STORAGE_KEY,JSON.stringify(e),-1,1)}getInteractedProviders(){return this._getStoredProviders()}async removeDynamicProvider(e){let t=this._getStoredProviders(),o=t.find(s=>s.providerId===e),n=t.filter(s=>s.providerId!==e);if(this._storeProviders(n),o){let s=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:o.clientId});await this.secretStorageService.delete(s)}let r=`dynamicAuthProvider:clientRegistration:${e}`;await this.secretStorageService.delete(r)}async getSessionsForDynamicAuthProvider(e,t){let o=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:t}),n=await this.secretStorageService.get(o);if(n){let r=JSON.parse(n);if(!Array.isArray(r)||!r.every(s=>typeof s.created_at=="number"&&vmo(s))){this.logService.error(`Invalid session data for ${e} (${t}) in secret storage:`,r),await this.secretStorageService.delete(o);return}return r}}async setSessionsForDynamicAuthProvider(e,t,o){let n=JSON.stringify({isDynamicAuthProvider:!0,authProviderId:e,clientId:t}),r=JSON.stringify(o);await this.secretStorageService.set(n,r),this.logService.trace(`Set session data for ${e} (${t}) in secret storage:`,o)}};hie=I([m(0,de),m(1,fC),m(2,re)],hie);Ce(ote,hie,1);var gP=le("IAuthenticationQueryService");var VU=class{constructor(i,e){this.providerId=i;this.queryService=e}},Eot=class extends VU{constructor(e,t,o,n){super(e,n);this.accountName=t;this.extensionId=o}isAccessAllowed(){return this.queryService.authenticationAccessService.isAccessAllowed(this.providerId,this.accountName,this.extensionId)}setAccessAllowed(e,t){this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,[{id:this.extensionId,name:t||this.extensionId,allowed:e}])}addUsage(e,t){this.queryService.authenticationUsageService.addAccountUsage(this.providerId,this.accountName,e,this.extensionId,t)}getUsage(){return this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).filter(t=>t.extensionId===hi.toKey(this.extensionId)).map(t=>({extensionId:t.extensionId,extensionName:t.extensionName,scopes:t.scopes||[],lastUsed:t.lastUsed}))}removeUsage(){let t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).filter(o=>o.extensionId!==this.extensionId);this.queryService.authenticationUsageService.removeAccountUsage(this.providerId,this.accountName);for(let o of t)this.queryService.authenticationUsageService.addAccountUsage(this.providerId,this.accountName,o.scopes||[],o.extensionId,o.extensionName)}setAsPreferred(){this.queryService.authenticationExtensionsService.updateAccountPreference(this.extensionId,this.providerId,{label:this.accountName,id:this.accountName})}isPreferred(){return this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,this.providerId)===this.accountName}isTrusted(){return this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).find(o=>o.id===this.extensionId)?.trusted===!0}},J1t=class extends VU{constructor(e,t,o,n){super(e,n);this.accountName=t;this.mcpServerId=o}isAccessAllowed(){return this.queryService.authenticationMcpAccessService.isAccessAllowed(this.providerId,this.accountName,this.mcpServerId)}setAccessAllowed(e,t){this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,[{id:this.mcpServerId,name:t||this.mcpServerId,allowed:e}])}addUsage(e,t){this.queryService.authenticationMcpUsageService.addAccountUsage(this.providerId,this.accountName,e,this.mcpServerId,t)}getUsage(){return this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).filter(t=>t.mcpServerId===this.mcpServerId).map(t=>({mcpServerId:t.mcpServerId,mcpServerName:t.mcpServerName,scopes:t.scopes||[],lastUsed:t.lastUsed}))}removeUsage(){let t=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).filter(o=>o.mcpServerId!==this.mcpServerId);this.queryService.authenticationMcpUsageService.removeAccountUsage(this.providerId,this.accountName);for(let o of t)this.queryService.authenticationMcpUsageService.addAccountUsage(this.providerId,this.accountName,o.scopes||[],o.mcpServerId,o.mcpServerName)}setAsPreferred(){this.queryService.authenticationMcpService.updateAccountPreference(this.mcpServerId,this.providerId,{label:this.accountName,id:this.accountName})}isPreferred(){return this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,this.providerId)===this.accountName}isTrusted(){return this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).find(o=>o.id===this.mcpServerId)?.trusted===!0}},Tot=class extends VU{constructor(e,t,o){super(e,o);this.accountName=t}getAllowedExtensions(){let e=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName),t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName);return e.filter(o=>o.allowed!==!1).map(o=>{let n=t.filter(c=>c.extensionId===o.id),r=n.length>0?Math.max(...n.map(c=>c.lastUsed)):void 0,l=new Eot(this.providerId,this.accountName,o.id,this.queryService).isTrusted();return{id:o.id,name:o.name,allowed:o.allowed,lastUsed:r,trusted:l}})}allowAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!0}));this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,t)}removeAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!1}));this.queryService.authenticationAccessService.updateAllowedExtensions(this.providerId,this.accountName,t)}forEach(e){let t=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName),o=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName),n=new Set;t.forEach(r=>n.add(r.extensionId)),o.forEach(r=>n.add(r.id));for(let r of n){let s=new Eot(this.providerId,this.accountName,r,this.queryService);e(s)}}},_ot=class extends VU{constructor(e,t,o){super(e,o);this.accountName=t}getAllowedMcpServers(){return this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).filter(e=>e.allowed!==!1)}allowAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!0}));this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,t)}removeAccess(e){let t=e.map(o=>({id:o,name:o,allowed:!1}));this.queryService.authenticationMcpAccessService.updateAllowedMcpServers(this.providerId,this.accountName,t)}forEach(e){let t=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName),o=this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName),n=new Set;t.forEach(r=>n.add(r.mcpServerId)),o.forEach(r=>n.add(r.id));for(let r of n){let s=new J1t(this.providerId,this.accountName,r,this.queryService);e(s)}}},DDi=class extends VU{constructor(e,t,o){super(e,o);this.accountName=t}hasAnyUsage(){return!!(this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName).length>0||this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName).length>0||this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).some(r=>r.allowed!==!1)||this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).some(r=>r.allowed!==!1))}getEntityCount(){let e=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,this.accountName),t=this.queryService.authenticationAccessService.readAllowedExtensions(this.providerId,this.accountName).filter(u=>u.allowed),o=new Set;e.forEach(u=>o.add(u.extensionId)),t.forEach(u=>o.add(u.id));let n=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,this.accountName),r=this.queryService.authenticationMcpAccessService.readAllowedMcpServers(this.providerId,this.accountName).filter(u=>u.allowed),s=new Set;n.forEach(u=>s.add(u.mcpServerId)),r.forEach(u=>s.add(u.id));let l=o.size,c=s.size;return{extensions:l,mcpServers:c,total:l+c}}removeAllAccess(){let e=new Tot(this.providerId,this.accountName,this.queryService),o=e.getAllowedExtensions().map(l=>l.id);o.length>0&&e.removeAccess(o);let n=new _ot(this.providerId,this.accountName,this.queryService),s=n.getAllowedMcpServers().map(l=>l.id);s.length>0&&n.removeAccess(s)}forEach(e){new Tot(this.providerId,this.accountName,this.queryService).forEach(n=>{e(n.extensionId,"extension")}),new _ot(this.providerId,this.accountName,this.queryService).forEach(n=>{e(n.mcpServerId,"mcpServer")})}},Z1t=class extends VU{constructor(e,t,o){super(e,o);this.accountName=t}extension(e){return new Eot(this.providerId,this.accountName,e,this.queryService)}mcpServer(e){return new J1t(this.providerId,this.accountName,e,this.queryService)}extensions(){return new Tot(this.providerId,this.accountName,this.queryService)}mcpServers(){return new _ot(this.providerId,this.accountName,this.queryService)}entities(){return new DDi(this.providerId,this.accountName,this.queryService)}remove(){this.queryService.authenticationAccessService.removeAllowedExtensions(this.providerId,this.accountName),this.queryService.authenticationUsageService.removeAccountUsage(this.providerId,this.accountName),this.queryService.authenticationMcpAccessService.removeAllowedMcpServers(this.providerId,this.accountName),this.queryService.authenticationMcpUsageService.removeAccountUsage(this.providerId,this.accountName)}},ezt=class extends VU{constructor(e,t,o){super(e,o);this.extensionId=t}getPreferredAccount(){return this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,this.providerId)}setPreferredAccount(e){this.queryService.authenticationExtensionsService.updateAccountPreference(this.extensionId,this.providerId,e)}removeAccountPreference(){this.queryService.authenticationExtensionsService.removeAccountPreference(this.extensionId,this.providerId)}},tzt=class extends VU{constructor(e,t,o){super(e,o);this.mcpServerId=t}async getLastUsedAccount(){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId),t,o=0;for(let n of e){let s=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,n.label).filter(l=>l.mcpServerId===this.mcpServerId);for(let l of s)l.lastUsed>o&&(o=l.lastUsed,t=n.label)}return t}catch{return}}getPreferredAccount(){return this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,this.providerId)}setPreferredAccount(e){this.queryService.authenticationMcpService.updateAccountPreference(this.mcpServerId,this.providerId,e)}removeAccountPreference(){this.queryService.authenticationMcpService.removeAccountPreference(this.mcpServerId,this.providerId)}async getUsedAccounts(){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId),t=[];for(let o of e)this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,o.label).some(r=>r.mcpServerId===this.mcpServerId)&&t.push(o.label);return t}catch{return[]}}},RDi=class extends VU{constructor(i,e){super(i,e)}account(i){return new Z1t(this.providerId,i,this.queryService)}extension(i){return new ezt(this.providerId,i,this.queryService)}mcpServer(i){return new tzt(this.providerId,i,this.queryService)}async getActiveEntities(){let i=[],e=[];try{let t=await this.queryService.authenticationService.getAccounts(this.providerId);for(let o of t){let n=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,o.label);for(let s of n)i.includes(s.extensionId)||i.push(s.extensionId);let r=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,o.label);for(let s of r)e.includes(s.mcpServerId)||e.push(s.mcpServerId)}}catch{}return{extensions:i,mcpServers:e}}async getAccountNames(){try{return(await this.queryService.authenticationService.getAccounts(this.providerId)).map(e=>e.label)}catch{return[]}}async getUsageStats(){let i=[],e=0,t=0;try{let o=await this.queryService.authenticationService.getAccounts(this.providerId);t=o.length;for(let n of o){let r=this.queryService.authenticationUsageService.readAccountUsages(this.providerId,n.label),s=this.queryService.authenticationMcpUsageService.readAccountUsages(this.providerId,n.label),l=[...r,...s],c=l.length,u=Math.max(...l.map(p=>p.lastUsed),0);c>0&&i.push({accountName:n.label,lastUsed:u,usageCount:c})}i.sort((n,r)=>r.lastUsed-n.lastUsed),e=i.reduce((n,r)=>n+r.usageCount,0)}catch{}return{totalSessions:e,totalAccounts:t,recentActivity:i}}async forEachAccount(i){try{let e=await this.queryService.authenticationService.getAccounts(this.providerId);for(let t of e){let o=new Z1t(this.providerId,t.label,this.queryService);i(o)}}catch{}}},LDi=class{constructor(i,e){this.extensionId=i;this.queryService=e}async getProvidersWithAccess(i){let e=[],t=this.queryService.authenticationService.getProviderIds();for(let o of t)if(!(!i&&o.startsWith(iN)))try{(await this.queryService.authenticationService.getAccounts(o)).some(s=>this.queryService.authenticationAccessService.isAccessAllowed(o,s.label,this.extensionId)===!0)&&e.push(o)}catch{}return e}getAllAccountPreferences(i){let e=new Map,t=this.queryService.authenticationService.getProviderIds();for(let o of t){if(!i&&o.startsWith(iN))continue;let n=this.queryService.authenticationExtensionsService.getAccountPreference(this.extensionId,o);n&&e.set(o,n)}return e}provider(i){return new ezt(i,this.extensionId,this.queryService)}},MDi=class{constructor(i,e){this.mcpServerId=i;this.queryService=e}async getProvidersWithAccess(i){let e=[],t=this.queryService.authenticationService.getProviderIds();for(let o of t)if(!(!i&&o.startsWith(iN)))try{(await this.queryService.authenticationService.getAccounts(o)).some(s=>this.queryService.authenticationMcpAccessService.isAccessAllowed(o,s.label,this.mcpServerId)===!0)&&e.push(o)}catch{}return e}getAllAccountPreferences(i){let e=new Map,t=this.queryService.authenticationService.getProviderIds();for(let o of t){if(!i&&o.startsWith(iN))continue;let n=this.queryService.authenticationMcpService.getAccountPreference(this.mcpServerId,o);n&&e.set(o,n)}return e}provider(i){return new tzt(i,this.mcpServerId,this.queryService)}},kot=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.authenticationService=e;this.authenticationUsageService=t;this.authenticationMcpUsageService=o;this.authenticationAccessService=n;this.authenticationMcpAccessService=r;this.authenticationExtensionsService=s;this.authenticationMcpService=l;this.logService=c;this._onDidChangePreferences=this._register(new T);this.onDidChangePreferences=this._onDidChangePreferences.event;this._onDidChangeAccess=this._register(new T);this.onDidChangeAccess=this._onDidChangeAccess.event;this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(u=>{this._onDidChangePreferences.fire({providerId:u.providerId,entityType:"extension",entityIds:u.extensionIds})})),this._register(this.authenticationMcpService.onDidChangeAccountPreference(u=>{this._onDidChangePreferences.fire({providerId:u.providerId,entityType:"mcpServer",entityIds:u.mcpServerIds})})),this._register(this.authenticationAccessService.onDidChangeExtensionSessionAccess(u=>{this._onDidChangeAccess.fire({providerId:u.providerId,accountName:u.accountName})})),this._register(this.authenticationMcpAccessService.onDidChangeMcpSessionAccess(u=>{this._onDidChangeAccess.fire({providerId:u.providerId,accountName:u.accountName})}))}provider(e){return new RDi(e,this)}extension(e){return new LDi(e,this)}mcpServer(e){return new MDi(e,this)}getProviderIds(e){return this.authenticationService.getProviderIds().filter(t=>e||!t.startsWith(iN))}async clearAllData(e,t=!0){if(e!=="CLEAR_ALL_AUTH_DATA")throw new Error("Must provide confirmation string to clear all authentication data");let o=this.getProviderIds(t);for(let n of o)try{let r=await this.authenticationService.getAccounts(n);for(let s of r)this.authenticationAccessService.removeAllowedExtensions(n,s.label),this.authenticationUsageService.removeAccountUsage(n,s.label),this.authenticationMcpAccessService.removeAllowedMcpServers(n,s.label),this.authenticationMcpUsageService.removeAccountUsage(n,s.label)}catch(r){this.logService.error(`Error clearing data for provider ${n}:`,r)}this.logService.info("All authentication data cleared")}};kot=I([m(0,ks),m(1,RN),m(2,ihe),m(3,mE),m(4,the),m(5,xZ),m(6,fet),m(7,re)],kot);Ce(gP,kot,1);var dq=_;var LAe=class extends ll{constructor(e,t,o,n,r){super();this._keybindingService=t;this._configurationService=o;this._markdownRenderer=n;this._accessibilityService=r;this._messageListeners=new O;this._isDisposed=!1;this._forcePosition=!1;this._x=0;this._y=0;this._isLocked=!1;this._enableFocusTraps=!1;this._addedFocusTrap=!1;this._maxHeightRatioRelativeToWindow=.5;this._onDispose=this._register(new T);this._onRequestLayout=this._register(new T);if(this._linkHandler=e.linkHandler,this._target="targetElements"in e.target?e.target:new PDi(e.target),e.style)switch(e.style){case 1:{e.appearance??={},e.appearance.compact??=!0,e.appearance.showPointer??=!0;break}case 2:{e.appearance??={},e.appearance.compact??=!0;break}}this._hoverPointer=e.appearance?.showPointer?dq("div.workbench-hover-pointer"):void 0,this._hover=this._register(new XX(!e.appearance?.skipFadeInAnimation)),this._hover.containerDomNode.classList.add("workbench-hover"),e.appearance?.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),this._hoverPointer&&this._hover.containerDomNode.classList.add("with-pointer"),e.additionalClasses&&this._hover.containerDomNode.classList.add(...e.additionalClasses),e.position?.forcePosition&&(this._forcePosition=!0),e.trapFocus&&(this._enableFocusTraps=!0);let s=e.appearance?.maxHeightRatio;s!==void 0&&s>0&&s<=1&&(this._maxHeightRatioRelativeToWindow=s),this._hoverPosition=e.position?.hoverPosition===void 0?3:on(e.position.hoverPosition)?e.position.hoverPosition:2,this.onmousedown(this._hover.containerDomNode,g=>g.stopPropagation()),this.onkeydown(this._hover.containerDomNode,g=>{g.equals(9)&&this.dispose()}),this._register($(this._targetWindow,"blur",()=>this.dispose()));let l=dq("div.hover-row.markdown-hover"),c=dq("div.hover-contents");if(typeof e.content=="string")c.textContent=e.content,c.style.whiteSpace="pre-wrap";else if(go(e.content)){c.appendChild(e.content),c.classList.add("html-hover-contents");let g=new ResizeObserver(()=>{this.layout(),this._onRequestLayout.fire()});g.observe(c),this._register(ee(()=>g.disconnect()))}else{let g=e.content,{element:f}=this._register(this._markdownRenderer.render(g,{actionHandler:this._linkHandler,asyncRenderCallback:()=>{c.classList.add("code-hover-contents"),this.layout(),this._onRequestLayout.fire()}}));c.appendChild(f)}if(l.appendChild(c),this._hover.contentsDomNode.appendChild(l),e.actions&&e.actions.length>0){let g=dq("div.hover-row.status-bar"),f=dq("div.actions");e.actions.forEach(v=>{let b=this._keybindingService.lookupKeybinding(v.commandId),S=b?b.getLabel():null;this._register(JX.render(f,{label:v.label,commandId:v.commandId,run:y=>{v.run(y),this.dispose()},iconClass:v.iconClass},S))}),g.appendChild(f),this._hover.containerDomNode.appendChild(g)}this._hoverContainer=dq("div.workbench-hover-container"),this._hoverPointer&&this._hoverContainer.appendChild(this._hoverPointer),this._hoverContainer.appendChild(this._hover.containerDomNode);let u;if(e.actions&&e.actions.length>0?u=!1:e.persistence?.hideOnHover===void 0?u=typeof e.content=="string"||yr(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes("</a>"):u=e.persistence.hideOnHover,e.appearance?.showHoverHint){let g=dq("div.hover-row.status-bar"),f=dq("div.info");f.textContent=d(2365,null,et?"Option":"Alt"),g.appendChild(f),this._hover.containerDomNode.appendChild(g)}let p=[...this._target.targetElements];u||p.push(this._hoverContainer);let h=this._mouseTracker=this._register(new izt(p));if(this._register(h.onMouseOut(()=>{this._isLocked||this.dispose()})),u){let g=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new izt(g)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=h}get _targetWindow(){return Me(this._target.targetElements[0])}get _targetDocumentElement(){return Me(this._target.targetElements[0]).document.documentElement}get isDisposed(){return this._isDisposed}get isMouseIn(){return this._lockMouseTracker.isMouseIn}get domNode(){return this._hover.containerDomNode}get onDispose(){return this._onDispose.event}get onRequestLayout(){return this._onRequestLayout.event}get anchor(){return this._hoverPosition===2?0:1}get x(){return this._x}get y(){return this._y}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this._hoverContainer.classList.toggle("locked",this._isLocked))}addMouseTrackingElement(e){return this._lockMouseTracker.addElement(e)}addFocusTrap(){if(!this._enableFocusTraps||this._addedFocusTrap)return;this._addedFocusTrap=!0;let e=this._hover.containerDomNode,t=this.findLastFocusableChild(this._hover.containerDomNode);if(t){let o=CI(this._hoverContainer,dq("div")),n=D(this._hoverContainer,dq("div"));o.tabIndex=0,n.tabIndex=0,this._register($(n,"focus",r=>{e.focus(),r.preventDefault()})),this._register($(o,"focus",r=>{t.focus(),r.preventDefault()}))}}findLastFocusableChild(e){if(e.hasChildNodes())for(let t=0;t<e.childNodes.length;t++){let o=e.childNodes.item(e.childNodes.length-t-1);if(o.nodeType===o.ELEMENT_NODE){let r=o;if(typeof r.tabIndex=="number"&&r.tabIndex>=0)return r}let n=this.findLastFocusableChild(o);if(n)return n}}render(e){e.appendChild(this._hoverContainer);let o=this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement)&&Skt(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel());o&&Er(o),this.layout(),this.addFocusTrap()}layout(){this._mouseTracker?.suppressPendingMouseOut(),this._lockMouseTracker!==this._mouseTracker&&this._lockMouseTracker?.suppressPendingMouseOut(),this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";let e=p=>{let h=CY(p),g=p.getBoundingClientRect();return{top:g.top*h,bottom:g.bottom*h,right:g.right*h,left:g.left*h}},t=this._target.targetElements.map(p=>e(p)),{top:o,right:n,bottom:r,left:s}=t[0],l=n-s,c=r-o,u={top:o,right:n,bottom:r,left:s,width:l,height:c,center:{x:s+l/2,y:o+c/2}};if(this.adjustHorizontalHoverPosition(u),this.adjustVerticalHoverPosition(u),this.adjustHoverMaxHeight(u),this._hoverContainer.style.padding="",this._hoverContainer.style.margin="",this._hoverPointer){switch(this._hoverPosition){case 1:u.left+=3,u.right+=3,this._hoverContainer.style.paddingLeft="3px",this._hoverContainer.style.marginLeft="-3px";break;case 0:u.left-=3,u.right-=3,this._hoverContainer.style.paddingRight="3px",this._hoverContainer.style.marginRight="-3px";break;case 2:u.top+=3,u.bottom+=3,this._hoverContainer.style.paddingTop="3px",this._hoverContainer.style.marginTop="-3px";break;case 3:u.top-=3,u.bottom-=3,this._hoverContainer.style.paddingBottom="3px",this._hoverContainer.style.marginBottom="-3px";break}u.center.x=u.left+l/2,u.center.y=u.top+c/2}this.computeXCordinate(u),this.computeYCordinate(u),this._hoverPointer&&(this._hoverPointer.classList.remove("top"),this._hoverPointer.classList.remove("left"),this._hoverPointer.classList.remove("right"),this._hoverPointer.classList.remove("bottom"),this.setHoverPointerPosition(u)),this._hover.onContentsChanged()}computeXCordinate(e){let t=this._hover.containerDomNode.clientWidth+2;this._target.x!==void 0?this._x=this._target.x:this._hoverPosition===1?this._x=e.right:this._hoverPosition===0?this._x=e.left-t:(this._hoverPointer?this._x=e.center.x-this._hover.containerDomNode.clientWidth/2:this._x=e.left,this._x+t>=this._targetDocumentElement.clientWidth&&(this._hover.containerDomNode.classList.add("right-aligned"),this._x=Math.max(this._targetDocumentElement.clientWidth-t-2,this._targetDocumentElement.clientLeft))),this._x<this._targetDocumentElement.clientLeft&&(this._x=e.left+2)}computeYCordinate(e){this._target.y!==void 0?this._y=this._target.y:this._hoverPosition===3?this._y=e.top:this._hoverPosition===2?this._y=e.bottom-2:this._hoverPointer?this._y=e.center.y+this._hover.containerDomNode.clientHeight/2:this._y=e.bottom,this._y>this._targetWindow.innerHeight&&(this._y=e.bottom)}adjustHorizontalHoverPosition(e){if(this._target.x!==void 0)return;let t=this._hoverPointer?3:0;if(this._forcePosition){let o=t+2;this._hoverPosition===1?this._hover.containerDomNode.style.maxWidth=`${this._targetDocumentElement.clientWidth-e.right-o}px`:this._hoverPosition===0&&(this._hover.containerDomNode.style.maxWidth=`${e.left-o}px`);return}this._hoverPosition===1?this._targetDocumentElement.clientWidth-e.right<this._hover.containerDomNode.clientWidth+t&&(e.left>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=0:this._hoverPosition=2):this._hoverPosition===0&&(e.left<this._hover.containerDomNode.clientWidth+t&&(this._targetDocumentElement.clientWidth-e.right>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=1:this._hoverPosition=2),e.left-this._hover.containerDomNode.clientWidth-t<=this._targetDocumentElement.clientLeft&&(this._hoverPosition=1))}adjustVerticalHoverPosition(e){if(this._target.y!==void 0||this._forcePosition)return;let t=this._hoverPointer?3:0;this._hoverPosition===3?e.top-this._hover.containerDomNode.clientHeight-t<0&&(this._hoverPosition=2):this._hoverPosition===2&&e.bottom+this._hover.containerDomNode.offsetHeight+t>this._targetWindow.innerHeight&&(this._hoverPosition=3)}adjustHoverMaxHeight(e){let t=this._targetWindow.innerHeight*this._maxHeightRatioRelativeToWindow;if(this._forcePosition){let o=(this._hoverPointer?3:0)+2;this._hoverPosition===3?t=Math.min(t,e.top-o):this._hoverPosition===2&&(t=Math.min(t,this._targetWindow.innerHeight-e.bottom-o))}if(this._hover.containerDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.clientHeight<this._hover.contentsDomNode.scrollHeight){let o=`${this._hover.scrollbar.options.verticalScrollbarSize}px`;this._hover.contentsDomNode.style.paddingRight!==o&&(this._hover.contentsDomNode.style.paddingRight=o)}}setHoverPointerPosition(e){if(this._hoverPointer)switch(this._hoverPosition){case 0:case 1:{this._hoverPointer.classList.add(this._hoverPosition===0?"right":"left");let t=this._hover.containerDomNode.clientHeight;t>e.height?this._hoverPointer.style.top=`${e.center.y-(this._y-t)-3}px`:this._hoverPointer.style.top=`${Math.round(t/2)-3}px`;break}case 3:case 2:{this._hoverPointer.classList.add(this._hoverPosition===3?"bottom":"top");let t=this._hover.containerDomNode.clientWidth,o=Math.round(t/2)-3,n=this._x+o;(n<e.left||n>e.right)&&(o=e.center.x-this._x-3),this._hoverPointer.style.left=`${o}px`;break}}}focus(){this._hover.containerDomNode.focus()}hide(){this.dispose()}dispose(){this._isDisposed||(this._onDispose.fire(),this._target.dispose?.(),this._hoverContainer.remove(),this._messageListeners.dispose(),super.dispose()),this._isDisposed=!0}};LAe=I([m(1,Le),m(2,B),m(3,_n),m(4,Ai)],LAe);var izt=class extends ll{constructor(e,t=200){super();this._elements=e;this._eventDebounceDelay=t;this._isMouseIn=!0;this._suppressNextMouseOut=!1;this._mouseTimer=this._register(new ue);this._onMouseOut=this._register(new T);for(let o of this._elements)this.onmouseover(o,()=>this._onTargetMouseOver()),this.onmouseleave(o,()=>this._onTargetMouseLeave())}get onMouseOut(){return this._onMouseOut.event}get isMouseIn(){return this._isMouseIn}_onTargetMouseOver(){this._isMouseIn=!0,this._suppressNextMouseOut=!1,this._mouseTimer.clear()}_onTargetMouseLeave(){this._isMouseIn=!1,this._mouseTimer.value=new Nl(()=>this._fireIfMouseOutside(),this._eventDebounceDelay)}_fireIfMouseOutside(){!this._isMouseIn&&!this._suppressNextMouseOut&&this._onMouseOut.fire()}suppressPendingMouseOut(){this._isMouseIn||(this._suppressNextMouseOut=!0)}addElement(e){if(this._elements.includes(e))return k.None;this._elements.push(e);let t=new O;return t.add($(e,ne.MOUSE_OVER,()=>this._onTargetMouseOver())),t.add($(e,ne.MOUSE_LEAVE,()=>this._onTargetMouseLeave())),t.add(ee(()=>{let o=this._elements.indexOf(e);o>=0&&this._elements.splice(o,1)})),t}},PDi=class{constructor(i){this._element=i;this.targetElements=[this._element]}dispose(){}};var ozt=class{constructor(i,e,t){this.hoverDelegate=i;this.target=e;this.fadeInAnimation=t}onDidHide(){this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0)}async update(i,e,t){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let o;if(We(i)||go(i)||i===void 0)o=i;else{this._cancellationTokenSource=new qe;let n=this._cancellationTokenSource.token,r;if(bEe(i)?bL(i.markdown)?r=i.markdown(n).then(s=>s??i.markdownNotSupportedFallback):r=i.markdown??i.markdownNotSupportedFallback:r=i.element(n),r instanceof Promise?(this._hoverWidget||this.show(d(2366,null),e,t),o=await r):o=r,this.isDisposed||n.isCancellationRequested)return}this.show(o,e,t)}show(i,e,t){let o=this._hoverWidget;if(this.hasContent(i)){let n={content:i,target:this.target,actions:t?.actions,linkHandler:t?.linkHandler,trapFocus:t?.trapFocus,appearance:{showPointer:this.hoverDelegate.placement==="element",skipFadeInAnimation:!this.fadeInAnimation||!!o,showHoverHint:t?.appearance?.showHoverHint},position:{hoverPosition:2}};this._hoverWidget=this.hoverDelegate.showHover(n,e)}o?.dispose()}hasContent(i){return i?yr(i)?!!i.value:!0:!1}get isDisposed(){return this._hoverWidget?.isDisposed}dispose(){this._hoverWidget?.dispose(),this._cancellationTokenSource?.dispose(!0),this._cancellationTokenSource=void 0}};var frn=3,Dot=class extends k{constructor(e,t,o,n,r,s){super();this._instantiationService=e;this._configurationService=t;this._keybindingService=n;this._layoutService=r;this._accessibilityService=s;this._hoverStack=[];this._currentDelayedHoverWasShown=!1;this._delayedHovers=new Map;this._managedHovers=new Map;this._register(o.onDidShowContextMenu(()=>this.hideHover())),this._register(xt.registerCommandAndKeybindingRule({id:"workbench.action.showHover",weight:0,primary:Gi(2089,2087),handler:()=>{this._showAndFocusHoverForActiveElement()}}))}get _currentHover(){return this._hoverStack.at(-1)?.hover}get _currentHoverOptions(){return this._hoverStack.at(-1)?.options}_getContainingHoverIndex(e){let t=go(e)?[e]:e.targetElements;for(let o=this._hoverStack.length-1;o>=0;o--)for(let n of t)if(ms(n,this._hoverStack[o].hover.domNode))return o;return-1}showInstantHover(e,t,o,n){let r=this._createHover(e,o);if(r)return this._showHover(r,e,t),r.hover}showDelayedHover(e,t){if(e.id===void 0&&(e.id=Sbo(e.content)),!this._currentDelayedHover||this._currentDelayedHoverWasShown){if(this._currentHover?.isLocked&&this._getContainingHoverIndex(e.target)<0)return;if(MAe(this._currentHoverOptions)===MAe(e))return this._currentHover;if(this._currentHover&&!this._currentHover.isDisposed&&this._currentDelayedHoverGroupId!==void 0&&this._currentDelayedHoverGroupId===t?.groupId)return this.showInstantHover({...e,appearance:{...e.appearance,skipFadeInAnimation:!0}})}else if(this._currentDelayedHover&&MAe(this._currentHoverOptions)===MAe(e))return this._currentDelayedHover;let o=this._createHover(e,void 0);if(!o){this._currentDelayedHover=void 0,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=void 0;return}this._currentDelayedHover=o.hover,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=t?.groupId;let n=t?.reducedDelay?this._configurationService.getValue("workbench.hover.reducedDelay"):this._configurationService.getValue("workbench.hover.delay");return Li(n).then(()=>{o.hover&&!o.hover.isDisposed&&(this._currentDelayedHoverWasShown=!0,this._showHover(o,e))}),o.hover}setupDelayedHover(e,t,o){let n=r=>{let s={...typeof t=="function"?t():t,target:e};return s.style===2&&r&&(s.target=ybo(e,r)),s};return this._setupDelayedHover(e,n,o)}setupDelayedHoverAtMouse(e,t,o){let n=r=>({...typeof t=="function"?t():t,target:r?ybo(e,r):e});return this._setupDelayedHover(e,n,o)}_setupDelayedHover(e,t,o){let n=new O;return n.add($(e,ne.MOUSE_OVER,r=>{this.showDelayedHover(t(r),{groupId:o?.groupId,reducedDelay:o?.reducedDelay})})),o?.setupKeyboardEvents&&n.add($(e,ne.KEY_DOWN,r=>{let s=new mi(r);(s.equals(10)||s.equals(3))&&this.showInstantHover(t(),!0)})),this._delayedHovers.set(e,{show:r=>{this.showInstantHover(t(),r)}}),n.add(ee(()=>this._delayedHovers.delete(e))),n}_createHover(e,t){if(this._currentDelayedHover?.dispose(),this._currentDelayedHover=void 0,e.content==="")return;if(e.id===void 0&&(e.id=Sbo(e.content)),this._getContainingHoverIndex(e.target)>=0){if(this._hoverStack.length>=frn)return}else if(this._currentHover?.isLocked||MAe(this._currentHoverOptions)===MAe(e))return;this._lastHoverOptions=e;let r=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),s=Un(),l;t||r&&s&&(s.classList.contains("monaco-hover")||(l=s));let c=new O,u=this._instantiationService.createInstance(LAe,e);if(e.persistence?.sticky&&(u.isLocked=!0),e.position?.hoverPosition&&!on(e.position.hoverPosition)&&(e.target={targetElements:go(e.target)?[e.target]:e.target.targetElements,x:e.position.hoverPosition.x+10}),u.onDispose(()=>{let p=this._hoverStack.findIndex(h=>h.hover===u);if(p>=0){let h=this._hoverStack[p];for(Is(u.domNode)&&h.lastFocusedElementBeforeOpen&&h.lastFocusedElementBeforeOpen.focus();this._hoverStack.length>p+1;){let f=this._hoverStack.pop();f.contextView.dispose(),f.hover.dispose()}this._hoverStack.splice(p,1),h.contextView.dispose()}c.dispose()},void 0,c),!e.container){let p=go(e.target)?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(Me(p))}if(c.add($(Me(e.container).document,ne.MOUSE_DOWN,p=>{ms(p.target,u.domNode)||this._hideHoverAndDescendants(u)})),!e.persistence?.sticky){if("targetElements"in e.target)for(let h of e.target.targetElements)c.add($(h,ne.CLICK,()=>this._hideHoverAndDescendants(u)));else c.add($(e.target,ne.CLICK,()=>this._hideHoverAndDescendants(u)));let p=Un();if(p){let h=Me(p).document;c.add($(p,ne.KEY_DOWN,g=>this._keyDown(g,u,!!e.persistence?.hideOnKeyDown))),c.add($(h,ne.KEY_DOWN,g=>this._keyDown(g,u,!!e.persistence?.hideOnKeyDown))),c.add($(p,ne.KEY_UP,g=>this._keyUp(g,u))),c.add($(h,ne.KEY_UP,g=>this._keyUp(g,u)))}}if("IntersectionObserver"in ut){let p=new IntersectionObserver(g=>this._intersectionChange(g,u),{threshold:0}),h="targetElements"in e.target?e.target.targetElements[0]:e.target;p.observe(h),c.add(ee(()=>p.disconnect()))}return{hover:u,lastFocusedElementBeforeOpen:l,store:c}}_showHover(e,t,o){let{hover:n,lastFocusedElementBeforeOpen:r,store:s}=e,l=this._getContainingHoverIndex(t.target),c=l>=0;if(!c)this._hideAllHovers();else{for(let f=this._hoverStack.length-1;f>l;f--)this._hoverStack[f].hover.dispose();this._hoverStack.length=l+1}if(c)for(let f=0;f<=l;f++)s.add(this._hoverStack[f].hover.addMouseTrackingElement(n.domNode));let u=t.container??this._layoutService.getContainer(Me(go(t.target)?t.target:t.target.targetElements[0])),p=new kke(u,1),h={hover:n,options:t,contextView:p,lastFocusedElementBeforeOpen:r};this._hoverStack.push(h);let g=new NDi(n,o,this._hoverStack.length);p.show(g),s.add(n.onRequestLayout(()=>p.layout())),t.onDidShow?.()}_hideHoverAndDescendants(e){let t=this._hoverStack.findIndex(o=>o.hover===e);if(!(t<0)){for(let o=this._hoverStack.length-1;o>=t;o--)this._hoverStack[o].hover.dispose();this._hoverStack.length=t}}_hideAllHovers(){for(let e=this._hoverStack.length-1;e>=0;e--)this._hoverStack[e].hover.dispose();this._hoverStack.length=0}hideHover(e){this._hoverStack.length!==0&&(!e&&this._currentHover?.isLocked||this.doHideHover())}doHideHover(){let e=this._hoverStack.length;this._hoverStack[e-1]?.hover.dispose(),this._hoverStack.length=e-1}_intersectionChange(e,t){e[e.length-1].isIntersecting||t.dispose()}showAndFocusLastHover(){this._lastHoverOptions&&this.showInstantHover(this._lastHoverOptions,!0,!0)}_showAndFocusHoverForActiveElement(){let e=Un();for(;e;){let t=this._delayedHovers.get(e)??this._managedHovers.get(e);if(t){t.show(!0);return}e=e.parentElement}}_keyDown(e,t,o){if(e.key==="Alt"){for(let s of this._hoverStack)s.hover.isLocked=!0;return}let n=new mi(e);if(!(this._keybindingService.resolveKeyboardEvent(n).getSingleModifierDispatchChords().some(s=>!!s)||this._keybindingService.softDispatch(n,n.target).kind!==0)&&o&&(!this._currentHoverOptions?.trapFocus||e.key!=="Tab")){let s=this._hoverStack.find(l=>l.hover===t);this._hideHoverAndDescendants(t),s?.lastFocusedElementBeforeOpen?.focus()}}_keyUp(e,t){if(e.key==="Alt"){for(let n of this._hoverStack)n.options.persistence?.sticky||(n.hover.isLocked=!1);if(!this._hoverStack.some(n=>n.hover.isMouseIn)){let n=this._hoverStack[this._hoverStack.length-1];this._hideAllHovers(),n?.lastFocusedElementBeforeOpen?.focus()}}}setupManagedHover(e,t,o,n){if(e.showNativeHover)return vrn(t,o);t.setAttribute("custom-hover","true"),t.title!==""&&(console.warn("HTML element already has a title attribute, which will conflict with the custom hover. Please remove the title attribute."),t.title="");let r,s,l=(f,v)=>{let b=s!==void 0;f&&(s?.dispose(),s=void 0),v&&(r?.dispose(),r=void 0),b&&(e.onDidHideHover?.(),s=void 0)},c=(f,v,b,S)=>new Nl(async()=>{(!s||s.isDisposed)&&(s=new ozt(e,b||t,f>0),await s.update(typeof o=="function"?o():o,v,{...n,trapFocus:S}))},f),u=new O,p=!1;u.add($(t,ne.MOUSE_DOWN,()=>{p=!0,l(!0,!0)},!0)),u.add($(t,ne.MOUSE_UP,()=>{p=!1},!0)),u.add($(t,ne.MOUSE_LEAVE,f=>{p=!1,l(!1,f.fromElement===t)},!0)),u.add($(t,ne.MOUSE_OVER,f=>{if(r)return;let v=new O,b={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){let S=y=>{b.x=y.x+10,ADi(y,t)||l(!0,!0)};v.add($(t,ne.MOUSE_MOVE,S,!0))}r=v,ADi(f,t)&&v.add(c(typeof e.delay=="function"?e.delay(o):e.delay,!1,b))},!0));let h=f=>{if(p||r||(s?.isDisposed&&(s=void 0),go(f.relatedTarget)&&f.relatedTarget.closest(".monaco-hover")||!f.relatedTarget)||!ADi(f,t))return;let b={targetElements:[t],dispose:()=>{}},S=new O,y=()=>l(!0,!0);S.add($(t,ne.BLUR,y,!0)),S.add(c(typeof e.delay=="function"?e.delay(o):e.delay,!1,b)),r=S};Ch(t)||u.add($(t,ne.FOCUS,h,!0));let g={show:f=>{l(!1,!0),c(0,f,void 0,f)},hide:()=>{l(!0,!0)},update:async(f,v)=>{o=f,await s?.update(o,void 0,v)},dispose:()=>{this._managedHovers.delete(t),u.dispose(),l(!0,!0)}};return this._managedHovers.set(t,g),g}showManagedHover(e){let t=this._managedHovers.get(e);t&&t.show(!0)}dispose(){this._managedHovers.forEach(e=>e.dispose()),super.dispose()}};Dot=I([m(0,F),m(1,B),m(2,Xe),m(3,Le),m(4,Kl),m(5,Ai)],Dot);function MAe(a){if(a!==void 0)return a?.id??a}function Sbo(a){if(!go(a))return typeof a=="string"?a.toString():a.value}function Ibo(a){let i=typeof a=="function"?a():a;if(We(i))return Du(i);if(bEe(i))return i.markdownNotSupportedFallback}function vrn(a,i){function e(t){t?a.setAttribute("title",t):a.removeAttribute("title")}return e(Ibo(i)),{update:t=>e(Ibo(t)),show:()=>{},hide:()=>{},dispose:()=>e(void 0)}}var NDi=class{constructor(i,e=!1,t=1){this._hover=i;this._focus=e;this.layer=t}get anchorPosition(){return this._hover.anchor}render(i){return this._hover.render(i),this._focus&&this._hover.focus(),this._hover}getAnchor(){return{x:this._hover.x,y:this._hover.y}}layout(){this._hover.layout()}};function ADi(a,i){return go(a.target)&&brn(a.target,i)===i}function brn(a,i){for(i=i??Me(a).document.body;!a.hasAttribute("custom-hover")&&a!==i;)a=a.parentElement;return a}function ybo(a,i){return{targetElements:[a],x:i.x+10}}Ce(ot,Dot,1);hs((a,i)=>{let e=a.getColor(eK);e&&(i.addRule(`.monaco-hover.workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-hover.workbench-hover hr { border-top: 1px solid ${e.transparent(.5)}; }`))});var ODi=class{constructor(){this._modifierObservables=new WeakMap}readModifierKeyStatus(i,e){let t=i instanceof Window?i:Me(i),o=this._modifierObservables.get(t);if(!o){let n=Ab.getInstance();o=vi(this,n.event,()=>({ctrlKey:n.keyStatus.ctrlKey,shiftKey:n.keyStatus.shiftKey,altKey:n.keyStatus.altKey,metaKey:n.keyStatus.metaKey})),this._modifierObservables.set(t,o)}return o.read(e)}createFocusTracker(i,e){let t=e.add(nr(i)),n=De("isFocused",(r=>{if(r instanceof Window)return r.document.hasFocus();let s=r.getRootNode()instanceof ShadowRoot?r.getRootNode():null,l=s?s.activeElement:r.ownerDocument.activeElement;return r.contains(l)})(i));return e.add(t.onDidFocus(()=>n.set(!0,void 0))),e.add(t.onDidBlur(()=>n.set(!1,void 0))),n}createHoverTracker(i,e){let t=De("isHovered",!1),o=()=>t.set(!0,void 0),n=()=>t.set(!1,void 0);return i.addEventListener("mouseenter",o),i.addEventListener("mouseleave",n),e.add({dispose:()=>{i.removeEventListener("mouseenter",o),i.removeEventListener("mouseleave",n)}}),t}createDomFocusTracker(i){return nr(i)}};Ce(ET,ODi,1);var FDi=class{constructor(){this._factories=new ra;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}canCreateOutline(i){for(let e of this._factories)if(e.matches(i))return!0;return!1}async createOutline(i,e,t){for(let o of this._factories)if(o.matches(i))return await o.createOutline(i,e,t)}registerOutlineCreator(i){let e=this._factories.push(i);return this._onDidChange.fire(),ee(()=>{e(),this._onDidChange.fire()})}};Ce(sP,FDi,1);var Srn="diagnosticsService",PAe=le(Srn);function UW(a){let i=a;return!!i?.hostName&&!!i?.errorMessage}var nzt=class a{static{this.CHANNEL_NAME="languageDetectionWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};var rzt=12,Irn=`${nF}/vscode-regexp-languagedetection`,yrn=`${hY}/vscode-regexp-languagedetection`,WDi=`${nF}/@vscode/vscode-languagedetection`,VDi=`${hY}/@vscode/vscode-languagedetection`,QN=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._environmentService=e;this._configurationService=o;this._diagnosticsService=n;this._workspaceContextService=r;this._editorService=l;this._logService=p;this.hasResolvedWorkspaceLanguageIds=!1;this.workspaceLanguageIds=new Set;this.sessionOpenedLanguageIds=new Set;this.historicalGlobalOpenedLanguageIds=new Ua(rzt);this.historicalWorkspaceOpenedLanguageIds=new Ua(rzt);this.dirtyBiases=!0;this.langBiases={};let g=oG&&this._environmentService.isBuilt&&!Ft;this._languageDetectionWorkerClient=this._register(new BDi(s,t,c,h,g?In.asBrowserUri(`${VDi}/dist/lib/index.js`).toString(!0):In.asBrowserUri(`${WDi}/dist/lib/index.js`).toString(!0),g?In.asBrowserUri(`${VDi}/model/model.json`).toString(!0):In.asBrowserUri(`${WDi}/model/model.json`).toString(!0),g?In.asBrowserUri(`${VDi}/model/group1-shard1of1.bin`).toString(!0):In.asBrowserUri(`${WDi}/model/group1-shard1of1.bin`).toString(!0),g?In.asBrowserUri(`${yrn}/dist/index.js`).toString(!0):In.asBrowserUri(`${Irn}/dist/index.js`).toString(!0))),this.initEditorOpenedListeners(u)}static{this.enablementSettingKey="workbench.editor.languageDetection"}static{this.historyBasedEnablementConfig="workbench.editor.historyBasedLanguageDetection"}static{this.preferHistoryConfig="workbench.editor.preferHistoryBasedLanguageDetection"}static{this.workspaceOpenedLanguagesStorageKey="workbench.editor.languageDetectionOpenedLanguages.workspace"}static{this.globalOpenedLanguagesStorageKey="workbench.editor.languageDetectionOpenedLanguages.global"}async resolveWorkspaceLanguageIds(){if(this.hasResolvedWorkspaceLanguageIds)return;this.hasResolvedWorkspaceLanguageIds=!0;let e=await this._diagnosticsService.getWorkspaceFileExtensions(this._workspaceContextService.getWorkspace()),t=0;for(let o of e.extensions){let n=this._languageDetectionWorkerClient.getLanguageId(o);if(n&&t<rzt&&(this.workspaceLanguageIds.add(n),t++,t>rzt))break}this.dirtyBiases=!0}isEnabledForLanguage(e){return!!e&&this._configurationService.getValue(QN.enablementSettingKey,{overrideIdentifier:e})}getLanguageBiases(){if(!this.dirtyBiases)return this.langBiases;let e={};return this.sessionOpenedLanguageIds.forEach(t=>e[t]=(e[t]??0)+7),this.workspaceLanguageIds.forEach(t=>e[t]=(e[t]??0)+5),[...this.historicalWorkspaceOpenedLanguageIds.keys()].forEach(t=>e[t]=(e[t]??0)+3),[...this.historicalGlobalOpenedLanguageIds.keys()].forEach(t=>e[t]=(e[t]??0)+1),this._logService.trace("Session Languages:",JSON.stringify([...this.sessionOpenedLanguageIds])),this._logService.trace("Workspace Languages:",JSON.stringify([...this.workspaceLanguageIds])),this._logService.trace("Historical Workspace Opened Languages:",JSON.stringify([...this.historicalWorkspaceOpenedLanguageIds.keys()])),this._logService.trace("Historical Globally Opened Languages:",JSON.stringify([...this.historicalGlobalOpenedLanguageIds.keys()])),this._logService.trace("Computed Language Detection Biases:",JSON.stringify(e)),this.dirtyBiases=!1,this.langBiases=e,e}async detectLanguage(e,t){let o=this._configurationService.getValue(QN.historyBasedEnablementConfig),n=this._configurationService.getValue(QN.preferHistoryConfig);o&&await this.resolveWorkspaceLanguageIds();let r=o?this.getLanguageBiases():void 0;return this._languageDetectionWorkerClient.detectLanguage(e,r,n,t)}initEditorOpenedListeners(e){try{let t=JSON.parse(e.get(QN.globalOpenedLanguagesStorageKey,0,"[]"));this.historicalGlobalOpenedLanguageIds.fromJSON(t)}catch(t){console.error(t)}try{let t=JSON.parse(e.get(QN.workspaceOpenedLanguagesStorageKey,1,"[]"));this.historicalWorkspaceOpenedLanguageIds.fromJSON(t)}catch(t){console.error(t)}this._register(this._editorService.onDidActiveEditorChange(()=>{let t=this._editorService.activeTextEditorLanguageId;t&&this._editorService.activeEditor?.resource?.scheme!==Q.untitled&&(this.sessionOpenedLanguageIds.add(t),this.historicalGlobalOpenedLanguageIds.set(t,!0),this.historicalWorkspaceOpenedLanguageIds.set(t,!0),e.store(QN.globalOpenedLanguagesStorageKey,JSON.stringify(this.historicalGlobalOpenedLanguageIds.toJSON()),0,1),e.store(QN.workspaceOpenedLanguagesStorageKey,JSON.stringify(this.historicalWorkspaceOpenedLanguageIds.toJSON()),1,1),this.dirtyBiases=!0)}))}};QN=I([m(0,Mt),m(1,Rt),m(2,B),m(3,PAe),m(4,Ae),m(5,_t),m(6,ie),m(7,_e),m(8,de),m(9,re),m(10,Bw)],QN);var BDi=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._modelService=e;this._languageService=t;this._telemetryService=o;this._webWorkerService=n;this._indexJsUri=r;this._modelJsonUri=s;this._weightsUri=l;this._regexpModelUri=c}_getOrCreateLanguageDetectionWorker(){if(!this.worker){let e=this._register(this._webWorkerService.createWorkerClient(new Ak({esmModuleLocation:In.asBrowserUri("vs/workbench/services/languageDetection/browser/languageDetectionWebWorkerMain.js"),label:"LanguageDetectionWorker"})));nzt.setChannel(e,{$getIndexJsUri:async()=>this.getIndexJsUri(),$getLanguageId:async o=>this.getLanguageId(o),$sendTelemetryEvent:async(o,n,r)=>this.sendTelemetryEvent(o,n,r),$getRegexpModelUri:async()=>this.getRegexpModelUri(),$getModelJsonUri:async()=>this.getModelJsonUri(),$getWeightsUri:async()=>this.getWeightsUri()});let t=this._register(YY.create(e,this._modelService));this.worker={workerClient:e,workerTextModelSyncClient:t}}return this.worker}_guessLanguageIdByUri(e){let t=this._languageService.guessLanguageIdByFilepathOrFirstLine(e);if(t&&t!=="unknown")return t}async getIndexJsUri(){return this._indexJsUri}getLanguageId(e){if(!e)return;if(this._languageService.isRegisteredLanguageId(e))return e;let t=this._guessLanguageIdByUri(A.file(`file.${e}`));if(!(!t||t==="unknown"))return t}async getModelJsonUri(){return this._modelJsonUri}async getWeightsUri(){return this._weightsUri}async getRegexpModelUri(){return this._regexpModelUri}async sendTelemetryEvent(e,t,o){this._telemetryService.publicLog2(rco,{languages:e.join(","),confidences:t.join(","),timeSpent:o})}async detectLanguage(e,t,o,n){let r=Date.now(),s=this._guessLanguageIdByUri(e);if(s)return s;let{workerClient:l,workerTextModelSyncClient:c}=this._getOrCreateLanguageDetectionWorker();c.ensureSyncedResources([e]);let u=await l.proxy.$detectLanguage(e.toString(),t,o,n),p=this.getLanguageId(u);return this._telemetryService.publicLog2("automaticlanguagedetection.perf",{timeSpent:Date.now()-r,detection:p||"unknown"}),p}};Ce(jS,QN,0);var HDi=class{constructor(){this.referenceProvider=new Yd(this._score.bind(this));this.renameProvider=new Yd(this._score.bind(this));this.newSymbolNamesProvider=new Yd(this._score.bind(this));this.codeActionProvider=new Yd(this._score.bind(this));this.definitionProvider=new Yd(this._score.bind(this));this.typeDefinitionProvider=new Yd(this._score.bind(this));this.declarationProvider=new Yd(this._score.bind(this));this.implementationProvider=new Yd(this._score.bind(this));this.documentSymbolProvider=new Yd(this._score.bind(this));this.inlayHintsProvider=new Yd(this._score.bind(this));this.colorProvider=new Yd(this._score.bind(this));this.codeLensProvider=new Yd(this._score.bind(this));this.documentFormattingEditProvider=new Yd(this._score.bind(this));this.documentRangeFormattingEditProvider=new Yd(this._score.bind(this));this.onTypeFormattingEditProvider=new Yd(this._score.bind(this));this.signatureHelpProvider=new Yd(this._score.bind(this));this.hoverProvider=new Yd(this._score.bind(this));this.documentHighlightProvider=new Yd(this._score.bind(this));this.multiDocumentHighlightProvider=new Yd(this._score.bind(this));this.selectionRangeProvider=new Yd(this._score.bind(this));this.foldingRangeProvider=new Yd(this._score.bind(this));this.linkProvider=new Yd(this._score.bind(this));this.inlineCompletionsProvider=new Yd(this._score.bind(this));this.completionProvider=new Yd(this._score.bind(this));this.linkedEditingRangeProvider=new Yd(this._score.bind(this));this.inlineValuesProvider=new Yd(this._score.bind(this));this.evaluatableExpressionProvider=new Yd(this._score.bind(this));this.documentRangeSemanticTokensProvider=new Yd(this._score.bind(this));this.documentSemanticTokensProvider=new Yd(this._score.bind(this));this.documentDropEditProvider=new Yd(this._score.bind(this));this.documentPasteEditProvider=new Yd(this._score.bind(this))}setNotebookTypeResolver(i){this._notebookTypeResolver=i}_score(i){return this._notebookTypeResolver?.(i)}};Ce(Jt,HDi,1);var Rot=class extends k{constructor(e,t,o){super();this._themeService=e;this._logService=t;this._languageService=o;this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}getStyling(e){return this._caches.has(e)||this._caches.set(e,new qTe(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};Rot=I([m(0,Pe),m(1,re),m(2,Rt)],Rot);Ce(Uue,Rot,1);var pQ=le("textMateTokenizationFeature");var szt=class extends k{constructor(e,t,o,n,r,s,l){super();this._grammar=e;this._initialState=t;this._containsEmbeddedLanguages=o;this._createBackgroundTokenizer=n;this._backgroundTokenizerShouldOnlyVerifyTokens=r;this._reportTokenizationTime=s;this._reportSlowTokenization=l;this._seenLanguages=[];this._onDidEncounterLanguage=this._register(new T)}get onDidEncounterLanguage(){return this._onDidEncounterLanguage.event}get backgroundTokenizerShouldOnlyVerifyTokens(){return this._backgroundTokenizerShouldOnlyVerifyTokens()}getInitialState(){return this._initialState}tokenize(e,t,o){throw new Error("Not supported!")}createBackgroundTokenizer(e,t){if(this._createBackgroundTokenizer)return this._createBackgroundTokenizer(e,t)}tokenizeEncoded(e,t,o){let n=Math.random()*1e4<1,r=this._reportSlowTokenization||n,s=r?new On(!0):void 0,l=this._grammar.tokenizeLine2(e,o,500);if(r){let u=s.elapsed();(n||u>32)&&this._reportTokenizationTime(u,e.length,n)}if(l.stoppedEarly)return console.warn(`Time limit reached when tokenizing line: ${e.substring(0,100)}`),new Tce(l.tokens,l.fonts,o);if(this._containsEmbeddedLanguages){let u=this._seenLanguages,p=l.tokens;for(let h=0,g=p.length>>>1;h<g;h++){let f=p[(h<<1)+1],v=Vp.getLanguageId(f);u[v]||(u[v]=!0,this._onDidEncounterLanguage.fire(v))}}let c;return o.equals(l.ruleStack)?c=o:c=l.ruleStack,new Tce(l.tokens,l.fonts,c)}};var azt=class extends k{constructor(e,t,o,n){super();this._encodedLanguageId=e;this._actual=t;this._maxTokenizationLineLength=n;this._register(Dz(this._maxTokenizationLineLength)),this._register(o)}get backgroundTokenizerShouldOnlyVerifyTokens(){return this._actual.backgroundTokenizerShouldOnlyVerifyTokens}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,o){throw new Error("Not supported!")}tokenizeEncoded(e,t,o){return e.length>=this._maxTokenizationLineLength.get()?ike(this._encodedLanguageId,o):this._actual.tokenizeEncoded(e,t,o)}createBackgroundTokenizer(e,t){if(this._actual.createBackgroundTokenizer)return this._actual.createBackgroundTokenizer(e,t)}};var lzt=class a{static{this.CHANNEL_NAME="textMateWorkerHost"}static getChannel(i){return i.getChannel(a.CHANNEL_NAME)}static setChannel(i,e){i.setChannel(a.CHANNEL_NAME,e)}};var Lot=class a{constructor(i){this.transformation=i;this.idx=0;this.offset=0}static fromMany(i){let e=i.map(t=>new a(t));return new UDi(e)}transform(i){let e=this.transformation.replacements.at(this.idx);for(;e&&e.replaceRange.endExclusive<=i;)this.offset+=e.getLengthDelta(),this.idx++,e=this.transformation.replacements.at(this.idx);if(!(e&&e.replaceRange.start<=i))return i+this.offset}},UDi=class{constructor(i){this.transformers=i}transform(i){for(let e of this.transformers){let t=e.transform(i);if(t===void 0)return;i=t}return i}};var czt=class a extends k{constructor(e,t,o,n,r,s){super();this._model=e;this._worker=t;this._languageIdCodec=o;this._backgroundTokenizationStore=n;this._configurationService=r;this._maxTokenizationLineLength=s;this.controllerId=a._id++,this._pendingChanges=[],this._states=new _8e,this._loggingEnabled=hr("editor.experimental.asyncTokenizationLogging",!1,this._configurationService),this._register(Dz(this._loggingEnabled)),this._register(this._model.onDidChangeContent(u=>{this._shouldLog&&console.log("model change",{fileName:this._model.uri.fsPath.split("\\").pop(),changes:zDi(u.changes)}),this._worker.$acceptModelChanged(this.controllerId,u),this._pendingChanges.push(u)})),this._register(this._model.onDidChangeLanguage(u=>{let p=this._model.getLanguageId(),h=this._languageIdCodec.encodeLanguageId(p);this._worker.$acceptModelLanguageChanged(this.controllerId,p,h)}));let l=this._model.getLanguageId(),c=this._languageIdCodec.encodeLanguageId(l);this._worker.$acceptNewModel({uri:this._model.uri,versionId:this._model.getVersionId(),lines:this._model.getLinesContent(),EOL:this._model.getEOL(),languageId:l,encodedLanguageId:c,maxTokenizationLineLength:this._maxTokenizationLineLength.get(),controllerId:this.controllerId}),this._register(ve(u=>{let p=this._maxTokenizationLineLength.read(u);this._worker.$acceptMaxTokenizationLineLength(this.controllerId,p)}))}static{this._id=0}dispose(){super.dispose(),this._worker.$acceptRemovedModel(this.controllerId)}requestTokens(e,t){this._worker.$retokenize(this.controllerId,e,t)}async setTokensAndStates(e,t,o,n,r){if(this.controllerId!==e)return;let s=yK.deserialize(new Uint8Array(o)),l=eke.deserialize(n,kXi());if(this._shouldLog&&console.log("received background tokenization result",{fileName:this._model.uri.fsPath.split("\\").pop(),updatedTokenLines:s.map(u=>u.getLineRange()).join(" & "),updatedStateLines:r.map(u=>new vo(u.startLineNumber,u.startLineNumber+u.stateDeltas.length).toString()).join(" & ")}),this._shouldLog){let u=this._pendingChanges.filter(p=>p.versionId<=t).map(p=>p.changes).map(p=>zDi(p)).join(" then ");console.log("Applying changes to local states",u)}for(;this._pendingChanges.length>0&&this._pendingChanges[0].versionId<=t;){let u=this._pendingChanges.shift();this._states.acceptChanges(u.changes)}if(this._pendingChanges.length>0){if(this._shouldLog){let h=this._pendingChanges.map(g=>g.changes).map(g=>zDi(g)).join(" then ");console.log("Considering non-processed changes",h)}let u=Lot.fromMany(this._pendingChanges.map(h=>xli(h.changes))),p=new yK;for(let h of s)for(let g=h.startLineNumber;g<=h.endLineNumber;g++)u.transform(g-1)!==void 0&&p.add(g,h.getLineTokens(g));s=p.finalize();for(let h of this._pendingChanges)for(let g of h.changes)for(let f=0;f<s.length;f++)s[f].applyEdit(g.range,g.text);l.rebase(this._stringEditFromChanges(this._model,this._pendingChanges))}let c=Lot.fromMany(this._pendingChanges.map(u=>xli(u.changes)));if(!this._applyStateStackDiffFn||!this._initialState){let{applyStateStackDiff:u,INITIAL:p}=await vf("vscode-textmate","release/main.js");this._applyStateStackDiffFn=u,this._initialState=p}for(let u of r){let p=u.startLineNumber<=1?this._initialState:this._states.getEndState(u.startLineNumber-1);for(let h=0;h<u.stateDeltas.length;h++){let g=u.stateDeltas[h],f;g?(f=this._applyStateStackDiffFn(p,g),this._states.setEndState(u.startLineNumber+h,f)):f=this._states.getEndState(u.startLineNumber+h);let v=c.transform(u.startLineNumber+h-1);v!==void 0&&this._backgroundTokenizationStore.setEndState(v+1,f),u.startLineNumber+h>=this._model.getLineCount()-1&&this._backgroundTokenizationStore.backgroundTokenizationFinished(),p=f}}this._backgroundTokenizationStore.setTokens(s),this._backgroundTokenizationStore.setFontInfo(l)}_stringEditFromChanges(e,t){let o=[];for(let n of t)for(let r of n.changes){let s=G.lift(r.range),l=r.text,c=e.getOffsetAt(s.getStartPosition()),u=e.getOffsetAt(s.getEndPosition());o.push(Ad.replace(new gi(c,u),l))}return Ad.compose(o)}get _shouldLog(){return this._loggingEnabled.get()}};function zDi(a){return a.map(i=>G.lift(i.range).toString()+" => "+i.text).join(" & ")}var mQ=class{constructor(i,e,t,o,n,r,s,l,c){this._reportTokenizationTime=i;this._shouldTokenizeAsync=e;this._extensionResourceLoaderService=t;this._configurationService=o;this._languageService=n;this._environmentService=r;this._notificationService=s;this._telemetryService=l;this._webWorkerService=c;this._workerProxyPromise=null;this._worker=null;this._workerProxy=null;this._workerTokenizerControllers=new Map;this._currentTheme=null;this._currentTokenColorMap=null;this._grammarDefinitions=[]}static{this._reportedMismatchingTokens=!1}dispose(){this._disposeWorker()}createBackgroundTokenizer(i,e,t){if(!this._shouldTokenizeAsync()||i.isTooLargeForSyncing())return;let o=new O,n=this._getWorkerProxy().then(r=>{if(o.isDisposed||!r)return;let s={controller:void 0,worker:this._worker};return o.add(wrn(i,()=>{let l=new czt(i,r,this._languageService.languageIdCodec,e,this._configurationService,t);return s.controller=l,this._workerTokenizerControllers.set(l.controllerId,l),ee(()=>{s.controller=void 0,this._workerTokenizerControllers.delete(l.controllerId),l.dispose()})})),s});return{dispose(){o.dispose()},requestTokens:async(r,s)=>{let l=await n;l?.controller&&l.worker===this._worker&&l.controller.requestTokens(r,s)},reportMismatchingTokens:r=>{mQ._reportedMismatchingTokens||(mQ._reportedMismatchingTokens=!0,this._notificationService.error({message:"Async Tokenization Token Mismatch in line "+r,name:"Async Tokenization Token Mismatch"}),this._telemetryService.publicLog2("asyncTokenizationMismatchingTokens",{}))}}}setGrammarDefinitions(i){this._grammarDefinitions=i,this._disposeWorker()}acceptTheme(i,e){this._currentTheme=i,this._currentTokenColorMap=e,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap)}_getWorkerProxy(){return this._workerProxyPromise||(this._workerProxyPromise=this._createWorkerProxy()),this._workerProxyPromise}async _createWorkerProxy(){let i=`${nF}/vscode-oniguruma`,e=`${hY}/vscode-oniguruma`,n=`${oG&&this._environmentService.isBuilt&&!Ft?e:i}/release/onig.wasm`,r={grammarDefinitions:this._grammarDefinitions,onigurumaWASMUri:In.asBrowserUri(n).toString(!0)},s=this._worker=this._webWorkerService.createWorkerClient(new Ak({esmModuleLocation:In.asBrowserUri("vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.workerMain.js"),label:"TextMateWorker"}));return lzt.setChannel(s,{$readFile:async l=>{let c=A.revive(l);return this._extensionResourceLoaderService.readExtensionResource(c)},$setTokensAndStates:async(l,c,u,p,h)=>{let g=this._workerTokenizerControllers.get(l);g&&g.setTokensAndStates(l,c,u,p,h)},$reportTokenizationTime:(l,c,u,p,h)=>{this._reportTokenizationTime(l,c,u,p,h)}}),await s.proxy.$init(r),this._worker!==s?null:(this._workerProxy=s.proxy,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap),s.proxy)}_disposeWorker(){for(let i of this._workerTokenizerControllers.values())i.dispose();this._workerTokenizerControllers.clear(),this._worker&&(this._worker.dispose(),this._worker=null),this._workerProxy=null,this._workerProxyPromise=null}};mQ=I([m(2,aE),m(3,B),m(4,Rt),m(5,ko),m(6,Ne),m(7,_e),m(8,Bw)],mQ);function wrn(a,i){let e=new O,t=e.add(new O);function o(){a.isAttachedToEditor()?t.add(i()):t.clear()}return o(),e.add(a.onDidChangeAttached(()=>{o()})),e}var dzt=class{constructor(){this._scopeNameToLanguageRegistration=Object.create(null)}reset(){this._scopeNameToLanguageRegistration=Object.create(null)}register(i){if(this._scopeNameToLanguageRegistration[i.scopeName]){let e=this._scopeNameToLanguageRegistration[i.scopeName];ze(e.location,i.location)||console.warn(`Overwriting grammar scope name to file mapping for scope ${i.scopeName}.
Old grammar file: ${e.location.toString()}.
New grammar file: ${i.location.toString()}`)}this._scopeNameToLanguageRegistration[i.scopeName]=i}getGrammarDefinition(i){return this._scopeNameToLanguageRegistration[i]||null}};var Mot="No TM Grammar registered for this language.",uzt=class extends k{constructor(i,e,t,o){super(),this._host=i,this._initialState=t.INITIAL,this._scopeRegistry=new dzt,this._injections={},this._injectedEmbeddedLanguages={},this._languageToScope=new Map,this._grammarRegistry=this._register(new t.Registry({onigLib:o,loadGrammar:async n=>{let r=this._scopeRegistry.getGrammarDefinition(n);if(!r)return this._host.logTrace(`No grammar found for scope ${n}`),null;let s=r.location;try{let l=await this._host.readFile(s);return t.parseRawGrammar(l,s.path)}catch(l){return this._host.logError(`Unable to load and parse grammar for scope ${n} from ${s}`,l),null}},getInjections:n=>{let r=n.split("."),s=[];for(let l=1;l<=r.length;l++){let c=r.slice(0,l).join(".");s=[...s,...this._injections[c]||[]]}return s}}));for(let n of e){if(this._scopeRegistry.register(n),n.injectTo){for(let r of n.injectTo){let s=this._injections[r];s||(this._injections[r]=s=[]),s.push(n.scopeName)}if(n.embeddedLanguages)for(let r of n.injectTo){let s=this._injectedEmbeddedLanguages[r];s||(this._injectedEmbeddedLanguages[r]=s=[]),s.push(n.embeddedLanguages)}}n.language&&this._languageToScope.set(n.language,n.scopeName)}}has(i){return this._languageToScope.has(i)}setTheme(i,e){this._grammarRegistry.setTheme(i,e)}getColorMap(){return this._grammarRegistry.getColorMap()}async createGrammar(i,e){let t=this._languageToScope.get(i);if(typeof t!="string")throw new Error(Mot);let o=this._scopeRegistry.getGrammarDefinition(t);if(!o)throw new Error(Mot);let n=o.embeddedLanguages;if(this._injectedEmbeddedLanguages[t]){let l=this._injectedEmbeddedLanguages[t];for(let c of l)for(let u of Object.keys(c))n[u]=c[u]}let r=Object.keys(n).length>0,s;try{s=await this._grammarRegistry.loadGrammarWithConfiguration(t,e,{embeddedLanguages:n,tokenTypes:o.tokenTypes,balancedBracketSelectors:o.balancedBracketSelectors,unbalancedBracketSelectors:o.unbalancedBracketSelectors})}catch(l){throw l.message&&l.message.startsWith("No grammar provided for")?new Error(Mot):l}return{languageId:i,grammar:s,initialState:this._initialState,containsEmbeddedLanguages:r,sourceExtensionId:o.sourceExtensionId}}};var BU=zn.registerExtensionPoint({extensionPoint:"grammars",deps:[l8],jsonSchema:{description:d(19302,null),type:"array",defaultSnippets:[{body:[{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}}],properties:{language:{description:d(19306,null),type:"string"},scopeName:{description:d(19308,null),type:"string"},path:{description:d(19307,null),type:"string"},embeddedLanguages:{description:d(19304,null),type:"object"},tokenTypes:{description:d(19309,null),type:"object",additionalProperties:{enum:["string","comment","other","regex"]}},injectTo:{description:d(19305,null),type:"array",items:{type:"string"}},balancedBracketScopes:{description:d(19303,null),type:"array",items:{type:"string"},default:["*"]},unbalancedBracketScopes:{description:d(19310,null),type:"array",items:{type:"string"},default:[]}},required:["scopeName","path"]}}});var HU=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._languageService=e;this._themeService=t;this._extensionResourceLoaderService=o;this._notificationService=n;this._logService=r;this._configurationService=s;this._progressService=l;this._environmentService=c;this._instantiationService=u;this._telemetryService=p;this._createdModes=[],this._encounteredLanguages=[],this._debugMode=!1,this._debugModePrintFunc=()=>{},this._grammarDefinitions=null,this._grammarFactory=null,this._tokenizersRegistrations=this._register(new O),this._currentTheme=null,this._currentTokenColorMap=null,this._currentTokenFontMap=null,this._threadedBackgroundTokenizerFactory=this._instantiationService.createInstance(mQ,(h,g,f,v,b)=>this._reportTokenizationTime(h,g,f,v,!0,b),()=>this.getAsyncTokenizationEnabled()),this._vscodeOniguruma=null,this._styleElement=Pr(),this._styleElement.className="vscode-tokens-styles",BU.setHandler(h=>this._handleGrammarsExtPoint(h)),this._updateTheme(this._themeService.getColorTheme(),!0),this._register(this._themeService.onDidColorThemeChange(()=>{this._updateTheme(this._themeService.getColorTheme(),!1)})),this._register(this._languageService.onDidRequestRichLanguageFeatures(h=>{this._createdModes.push(h)}))}static{this.reportTokenizationTimeCounter={sync:0,async:0}}getAsyncTokenizationEnabled(){return!!this._configurationService.getValue("editor.experimental.asyncTokenization")}getAsyncTokenizationVerification(){return!!this._configurationService.getValue("editor.experimental.asyncTokenizationVerification")}_handleGrammarsExtPoint(e){this._grammarDefinitions=null,this._grammarFactory&&(this._grammarFactory.dispose(),this._grammarFactory=null),this._tokenizersRegistrations.clear(),this._grammarDefinitions=[];for(let t of e){let o=t.value;for(let n of o){let r=this._validateGrammarDefinition(t,n);if(r&&(this._grammarDefinitions.push(r),r.language)){let s=new xIt(()=>this._createTokenizationSupport(r.language));this._tokenizersRegistrations.add(s),this._tokenizersRegistrations.add(vc.registerFactory(r.language,s))}}}this._threadedBackgroundTokenizerFactory.setGrammarDefinitions(this._grammarDefinitions);for(let t of this._createdModes)vc.getOrCreate(t)}_validateGrammarDefinition(e,t){if(!krn(e.description.extensionLocation,t,e.collector,this._languageService))return null;let o=Ve(e.description.extensionLocation,t.path),n=Object.create(null);if(t.embeddedLanguages){let c=Object.keys(t.embeddedLanguages);for(let u=0,p=c.length;u<p;u++){let h=c[u],g=t.embeddedLanguages[h];typeof g=="string"&&this._languageService.isRegisteredLanguageId(g)&&(n[h]=this._languageService.languageIdCodec.encodeLanguageId(g))}}let r=Object.create(null);if(t.tokenTypes){let c=Object.keys(t.tokenTypes);for(let u of c)switch(t.tokenTypes[u]){case"string":r[u]=2;break;case"other":r[u]=0;break;case"comment":r[u]=1;break;case"regex":r[u]=3;break}}let s=t.language&&this._languageService.isRegisteredLanguageId(t.language)?t.language:void 0;function l(c,u){return!Array.isArray(c)||!c.every(p=>typeof p=="string")?u:c}return{location:o,language:s,scopeName:t.scopeName,embeddedLanguages:n,tokenTypes:r,injectTo:t.injectTo,balancedBracketSelectors:l(t.balancedBracketScopes,["*"]),unbalancedBracketSelectors:l(t.unbalancedBracketScopes,[]),sourceExtensionId:e.description.id}}startDebugMode(e,t){if(this._debugMode){this._notificationService.error(d(19291,null));return}this._debugModePrintFunc=e,this._debugMode=!0,this._debugMode&&this._progressService.withProgress({location:15,buttons:[d(19301,null)]},o=>(o.report({message:d(19299,null)}),this._getVSCodeOniguruma().then(n=>(n.setDefaultDebugCall(!0),o.report({message:d(19300,null)}),new Promise((r,s)=>{})))),o=>{this._getVSCodeOniguruma().then(n=>{this._debugModePrintFunc=()=>{},this._debugMode=!1,n.setDefaultDebugCall(!1),t()})})}_canCreateGrammarFactory(){return!!this._grammarDefinitions}async _getOrCreateGrammarFactory(){if(this._grammarFactory)return this._grammarFactory;let[e,t]=await Promise.all([vf("vscode-textmate","release/main.js"),this._getVSCodeOniguruma()]),o=Promise.resolve({createOnigScanner:n=>t.createOnigScanner(n),createOnigString:n=>t.createOnigString(n)});return this._grammarFactory?this._grammarFactory:(this._grammarFactory=new uzt({logTrace:n=>this._logService.trace(n),logError:(n,r)=>this._logService.error(n,r),readFile:n=>this._extensionResourceLoaderService.readExtensionResource(n)},this._grammarDefinitions||[],e,o),this._updateTheme(this._themeService.getColorTheme(),!0),this._grammarFactory)}async _createTokenizationSupport(e){if(!this._languageService.isRegisteredLanguageId(e)||!this._canCreateGrammarFactory())return null;try{let t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;let o=this._languageService.languageIdCodec.encodeLanguageId(e),n=await t.createGrammar(e,o);if(!n.grammar)return null;let r=Ern("editor.maxTokenizationLineLength",e,-1,this._configurationService),s=new O,l=s.add(new szt(n.grammar,n.initialState,n.containsEmbeddedLanguages,(c,u)=>this._threadedBackgroundTokenizerFactory.createBackgroundTokenizer(c,u,r),()=>this.getAsyncTokenizationVerification(),(c,u,p)=>{this._reportTokenizationTime(c,e,n.sourceExtensionId,u,!1,p)},!0));return s.add(l.onDidEncounterLanguage(c=>{if(!this._encounteredLanguages[c]){let u=this._languageService.languageIdCodec.decodeLanguageId(c);this._encounteredLanguages[c]=!0,this._languageService.requestBasicLanguageFeatures(u)}})),new azt(o,l,s,r)}catch(t){return t.message&&t.message===Mot||mt(t),null}}_updateTheme(e,t){if(!t&&this._currentTheme&&this._currentTokenColorMap&&xrn(this._currentTheme.settings,e.tokenColors)&&eo(this._currentTokenColorMap,e.tokenColorMap)&&this._currentTokenFontMap&&eo(this._currentTokenFontMap,e.tokenFontMap))return;this._currentTheme={name:e.label,settings:e.tokenColors},this._currentTokenColorMap=e.tokenColorMap,this._currentTokenFontMap=e.tokenFontMap,this._grammarFactory?.setTheme(this._currentTheme,this._currentTokenColorMap);let o=Crn(this._currentTokenColorMap),n=ED(o),r=eJi(this._currentTokenFontMap);this._styleElement.textContent=n+r,vc.setColorMap(o),this._currentTheme&&this._currentTokenColorMap&&this._threadedBackgroundTokenizerFactory.acceptTheme(this._currentTheme,this._currentTokenColorMap)}async createTokenizer(e){if(!this._languageService.isRegisteredLanguageId(e))return null;let t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;let o=this._languageService.languageIdCodec.encodeLanguageId(e),{grammar:n}=await t.createGrammar(e,o);return n}_getVSCodeOniguruma(){return this._vscodeOniguruma||(this._vscodeOniguruma=(async()=>{let[e,t]=await Promise.all([vf("vscode-oniguruma","release/main.js"),this._loadVSCodeOnigurumaWASM()]);return await e.loadWASM({data:t,print:o=>{this._debugModePrintFunc(o)}}),e})()),this._vscodeOniguruma}async _loadVSCodeOnigurumaWASM(){return Ft?await(await fetch(gNt("vscode-oniguruma","release/onig.wasm"))).arrayBuffer():await fetch(oG&&this._environmentService.isBuilt?In.asBrowserUri(`${sbt}/vscode-oniguruma/release/onig.wasm`).toString(!0):In.asBrowserUri(`${nF}/vscode-oniguruma/release/onig.wasm`).toString(!0))}_reportTokenizationTime(e,t,o,n,r,s){let l=r?"async":"sync";HU.reportTokenizationTimeCounter[l]>50||(HU.reportTokenizationTimeCounter[l]===0&&setTimeout(()=>{HU.reportTokenizationTimeCounter[l]=0},1e3*60*60),HU.reportTokenizationTimeCounter[l]++,this._telemetryService.publicLog2("editor.tokenizedLine",{timeMs:e,languageId:t,lineLength:n,fromWorker:r,sourceExtensionId:o,isRandomSample:s,tokenizationSetting:this.getAsyncTokenizationEnabled()?this.getAsyncTokenizationVerification()?2:1:0}))}};HU=I([m(0,Rt),m(1,ep),m(2,aE),m(3,Ne),m(4,re),m(5,B),m(6,Go),m(7,Mt),m(8,F),m(9,_e)],HU);function Crn(a){let i=[null];for(let e=1,t=a.length;e<t;e++)i[e]=Ue.fromHex(a[e]);return i}function xrn(a,i){if(!i||!a||i.length!==a.length)return!1;for(let e=i.length-1;e>=0;e--){let t=i[e],o=a[e];if(t.scope!==o.scope)return!1;let n=t.settings,r=o.settings;if(n&&r){if(n.fontStyle!==r.fontStyle||n.foreground!==r.foreground||n.background!==r.background||n.lineHeight!==r.lineHeight||n.fontSize!==r.fontSize||n.fontFamily!==r.fontFamily)return!1}else if(!n||!r)return!1}return!0}function krn(a,i,e,t){if(i.language&&(typeof i.language!="string"||!t.isRegisteredLanguageId(i.language)))return e.error(d(19294,null,BU.name,String(i.language))),!1;if(!i.scopeName||typeof i.scopeName!="string")return e.error(d(19297,null,BU.name,String(i.scopeName))),!1;if(!i.path||typeof i.path!="string")return e.error(d(19295,null,BU.name,String(i.path))),!1;if(i.injectTo&&(!Array.isArray(i.injectTo)||i.injectTo.some(n=>typeof n!="string")))return e.error(d(19293,null,BU.name,JSON.stringify(i.injectTo))),!1;if(i.embeddedLanguages&&!Di(i.embeddedLanguages))return e.error(d(19292,null,BU.name,JSON.stringify(i.embeddedLanguages))),!1;if(i.tokenTypes&&!Di(i.tokenTypes))return e.error(d(19298,null,BU.name,JSON.stringify(i.tokenTypes))),!1;let o=Ve(a,i.path);return Yr(o,a)||e.warn(d(19296,null,BU.name,o.path,a.path)),!0}function Ern(a,i,e,t){return vi(o=>t.onDidChangeConfiguration(n=>{n.affectsConfiguration(a,{overrideIdentifier:i})&&o(n)}),()=>t.getValue(a,{overrideIdentifier:i})??e)}var AAe=class{static{this.ID="workbench.contrib.textMateTokenizationInstantiator"}constructor(i){}};AAe=I([m(0,pQ)],AAe);Ce(pQ,HU,0);bt(AAe.ID,AAe,vt.BlockRestore);Ge.registerCommand("_workbench.colorizeTextMateTokens",async(a,i)=>{let e=a.get(Uo),t=i?(await e.files.resolve(i)).textEditorModel:void 0;if(!t)throw new Error(`Cannot resolve text model for resource ${i}`);let o=await vc.getOrCreate(t.getLanguageId());if(!o)throw new Error(`Cannot resolve tokenizer for language ${t.getLanguageId()}`);let n=new On,r=o.getInitialState();for(let s=1;s<=t.getLineCount();s++)r=o.tokenizeEncoded(t.getLineContent(s),!0,r).endState;return n.stop(),{tokenizeTime:n.elapsed()}});var Trn="editor.experimental.preferTreeSitter";var _rn="@vscode/tree-sitter-wasm/wasm",Drn="tree-sitter.wasm";function wbo(a){return`${oG&&a.isBuilt?sbt:nF}/${_rn}`}var NAe=class extends k{constructor(e,t,o){super();this._configurationService=e;this._fileService=t;this._environmentService=o;this.isTest=!1;this._treeSitterImport=new uo(async()=>{let e=await vf("@vscode/tree-sitter-wasm","wasm/tree-sitter.js"),t=this._environmentService,o=this.isTest;return await e.Parser.init({locateFile(n,r){let s=`${wbo(t)}/${Drn}`;return o?In.asFileUri(s).toString(!0):In.asBrowserUri(s).toString(!0)}}),e});this._supportsLanguage=new xy(e=>hr(`${Trn}.${e}`,!1,this._configurationService));this._languagesCache=new xy(e=>Uc.fromFn(async()=>{let t=wbo(this._environmentService),o=`tree-sitter-${e}`,n=`${t}/${o}.wasm`,[r,s]=await Promise.all([this._treeSitterImport.value,this._fileService.readFile(In.asFileUri(n))]);return await r.Language.load(s.value.buffer)}));this._injectionQueries=new xy({getCacheKey:JSON.stringify},e=>{let t=async()=>{let o=`vs/editor/common/languages/${e.kind}/${e.languageId}.scm`,n=In.asFileUri(o);if(!this._fileService.hasProvider(n))return;let r=await Rrn(this._fileService,n);if(r!==void 0)return r.value.toString()};return Uc.fromFn(async()=>{let[o,n,r]=await Promise.all([t(),this._languagesCache.get(e.languageId).promise,this._treeSitterImport.value]);if(o===void 0)return null;let s=r.Query;return new s(n,o)}).resolvedValue})}supportsLanguage(e,t){return this._supportsLanguage.get(e).read(t)}async getParserClass(){return(await this._treeSitterImport.value).Parser}getLanguage(e,t,o){return!t&&!this.supportsLanguage(e,o)?void 0:this._languagesCache.get(e).resolvedValue.read(o)}async getLanguagePromise(e){return this._languagesCache.get(e).promise}getInjectionQueries(e,t){return this.supportsLanguage(e,t)?this._injectionQueries.get({languageId:e,kind:"injections"}).read(t):void 0}getHighlightingQueries(e,t){return this.supportsLanguage(e,t)?this._injectionQueries.get({languageId:e,kind:"highlights"}).read(t):void 0}async createQuery(e,t){let o=await this._treeSitterImport.value;return new o.Query(e,t)}};NAe=I([m(0,B),m(1,ge),m(2,ko)],NAe);async function Rrn(a,i){try{return await a.readFile(i)}catch(e){if(rp(e)===1)return;throw e}}var OAe=class{constructor(i){this._themeService=i;this._colorTheme=vi(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),this.onChange=ke(this,e=>{this._colorTheme.read(e),e.reportChange(void 0)})}findMetadata(i,e,t,o){return $Ut(this._colorTheme.read(o),i,e,t)}};OAe=I([m(0,ep)],OAe);Ce(NX,NAe,0);Ce(qCt,OAe,0);var Lrn=3e4,KDi=2,GDi={passive:!0,capture:!0},pzt=class extends k{constructor(i){super();let e=KDi,t=this._register(new LL),o=this._register(new ue);o.value=i.markActive();let n=()=>{++e===KDi&&(o.clear(),t.cancel())},r=s=>{e===KDi&&(o.value=i.markActive(),t.cancelAndSet(n,Lrn,s)),e=0};this._register(U.runAndSubscribe(Of,({window:s,disposables:l})=>{l.add($(s.document,"touchstart",()=>r(s),GDi)),l.add($(s.document,"mousedown",()=>r(s),GDi)),l.add($(s.document,"keydown",()=>r(s),GDi))},{window:ut,disposables:this._store})),r(ut)}};bFt.add(pzt);var mzt=class extends k{constructor(e){super();this.value=e;this._totalTime=0;this._startTime=void 0;this._register(ve(t=>{if(this.value.read(t))this._startTime=Date.now();else if(this._startTime!==void 0){let n=Date.now()-this._startTime;this._totalTime+=n,this._startTime=void 0}}))}totalTimeMs(){return this._startTime!==void 0?this._totalTime+(Date.now()-this._startTime):this._totalTime}fireWhenTimeIncreasedBy(e,t){let o=new O,n=0,r;return o.add(ve(s=>{if(this.value.read(s)){r=Date.now();let c=e-n;if(c<=0){t(),o.dispose();return}let u=setTimeout(()=>{n+=Date.now()-r,r=void 0,t(),o.dispose()},c);s.store.add(ee(()=>{clearTimeout(u),r!==void 0&&(n+=Date.now()-r,r=void 0)}))}})),o}};function Cbo(a,i,e){let t=De("wasTrueRecently",!1),o;return e.add(ve(n=>{a.read(n)?(t.set(!0,void 0),o!==void 0&&(clearTimeout(o),o=void 0)):o=setTimeout(()=>{t.set(!1,void 0),o=void 0},i)})),e.add(ee(()=>{o!==void 0&&clearTimeout(o)})),t}var hzt=le("userAttentionService");var Mrn=6e4,Pot=class extends k{constructor(e,t){super();this._logService=t;let o=this._register(e.createInstance(Aot));this.isVsCodeFocused=o.isVsCodeFocused,this.isUserActive=o.isUserActive,this._isTracingEnabled=vi(this,this._logService.onDidChangeLogLevel,()=>this._logService.getLevel()===1);let n=Cbo(this.isUserActive,Mrn,this._store);this.hasUserAttention=ke(this,r=>n.read(r)),this._timeKeeper=this._register(new mzt(this.hasUserAttention)),this._register(ve(r=>{this._isTracingEnabled.read(r)&&(r.store.add(ve(s=>{let l=this.isVsCodeFocused.read(s);this._logService.trace(`[UserAttentionService] VS Code focus changed: ${l}`)})),r.store.add(ve(s=>{let l=this.hasUserAttention.read(s);this._logService.trace(`[UserAttentionService] User attention changed: ${l}`)})))}))}fireAfterGivenFocusTimePassed(e,t){return this._timeKeeper.fireWhenTimeIncreasedBy(e,t)}get totalFocusTimeMs(){return this._timeKeeper.totalTimeMs()}};Pot=I([m(0,F),m(1,re)],Pot);var Aot=class extends k{constructor(e,t){super();this._hostService=e;this._logService=t;this._isUserActive=De(this,!1);this.isVsCodeFocused=vi(this,this._hostService.onDidChangeFocus,()=>this._hostService.hasFocus),this.isUserActive=this._isUserActive;let o=()=>{this._markUserActivity()};this._register(U.runAndSubscribe(Of,({window:n,disposables:r})=>{r.add($(n.document,"keydown",o,gzt)),r.add($(n.document,"mousemove",o,gzt)),r.add($(n.document,"mousedown",o,gzt)),r.add($(n.document,"touchstart",o,gzt))},{window:ut,disposables:this._store})),this._hostService.hasFocus&&this._markUserActivity()}_markUserActivity(){this._activityDebounceTimeout!==void 0?clearTimeout(this._activityDebounceTimeout):(this._logService.trace("[UserAttentionService] User activity detected"),this._isUserActive.set(!0,void 0)),this._activityDebounceTimeout=setTimeout(()=>{this._isUserActive.set(!1,void 0),this._activityDebounceTimeout=void 0},500)}};Aot=I([m(0,ti),m(1,re)],Aot);var gzt={passive:!0,capture:!0};Ce(hzt,Pot,1);var qDi=class{constructor(){this.onWillInstantiateEditorPane=os.onWillInstantiateEditorPane}didInstantiateEditorPane(i){return os.didInstantiateEditorPane(i)}};Ce(kRt,qDi,1);var $Di=class extends k{constructor(){super();this._onDidSendData=this._register(new T);this.onDidSendData=this._onDidSendData.event}getDataChannel(e){return new jDi(e,this._onDidSendData)}},jDi=class{constructor(i,e){this.channelId=i;this._onDidSendData=e}sendData(i){this._onDidSendData.fire({channelId:this.channelId,data:i})}};Ce(MJ,$Di,1);var fzt="chat.agentHost.localFilePermissions";var hQ=le("agentHostPermissionService");var Not=class extends k{constructor(e,t,o){super();this._configurationService=e;this._fileService=t;this._logService=o;this._inMemoryGrants=new Map;this._pending=De("agentHostPermissions.pending",[]);this.allPending=this._pending}async check(e,t,o){let n=db(e),r=await this._canonicalize(t);return this._isCovered(n,r,o)}async request(e,t){let o=db(e),n=await this._canonicalize(A.parse(t.uri)),r=t.write===!0;(t.read===!0||!r)&&!await this._isCovered(o,n,"read")&&await this._enqueue(o,n,"read"),r&&!await this._isCovered(o,n,"write")&&await this._enqueue(o,n,"write")}pendingFor(e){let t=db(e);return ke(o=>this._pending.read(o).filter(n=>n.address===t))}findPending(e){return this._pending.get().find(t=>t.id===e)}grantImplicitRead(e,t){let o=ht(),n=Jn.normalizePath(t),r=this._fileService.realpath(n).then(s=>s??n,()=>n);return this._inMemoryGrants.set(o,{address:db(e),realpath:r,mode:"r"}),ee(()=>this._inMemoryGrants.delete(o))}connectionClosed(e){let t=db(e);for(let[r,s]of this._inMemoryGrants)s.address===t&&this._inMemoryGrants.delete(r);let o=new qi,n=[];for(let r of this._pending.get())r.address===t?r.deferred.error(o):n.push(r);n.length!==this._pending.get().length&&this._pending.set(n,void 0)}async _canonicalize(e){let t=Jn.normalizePath(e),o=await this._fileService.realpath(t).catch(()=>{});if(o)return o;let n=Jn.dirname(t);if(Jn.isEqual(n,t))return t;let r=await this._fileService.realpath(n).catch(()=>{});return r?Jn.joinPath(r,Jn.basename(t)):t}async _isCovered(e,t,o){let n=o==="write";for(let l of this._readPersistedGrants(e))if(!(n&&l.mode!=="rw")&&Jn.isEqualOrParent(t,l.uri))return!0;let r=[];for(let l of this._inMemoryGrants.values())l.address===e&&(n&&l.mode!=="rw"||r.push(l.realpath));return(await Promise.all(r)).some(l=>Jn.isEqualOrParent(t,l))}_enqueue(e,t,o){let n=this._pending.get().find(l=>l.address===e&&l.mode===o&&Jn.isEqual(l.uri,t));if(n)return n.deferred.p;let r=new Mo,s={id:ht(),address:e,uri:t,mode:o,deferred:r,allow:()=>this._resolve(s,"memory"),allowAlways:()=>this._resolve(s,"persist"),deny:()=>{this._dropPending(s),r.error(new qi)}};return this._pending.set([...this._pending.get(),s],void 0),r.p}_resolve(e,t){let o=e.mode==="write"?"rw":"r";this._inMemoryGrants.set(ht(),{address:e.address,realpath:Promise.resolve(e.uri),mode:o}),t==="persist"&&this._persistGrant(e.address,e.uri,e.mode).catch(n=>{this._logService.warn("[AgentHostPermissionService] Failed to persist grant",n)}),this._dropPending(e),e.deferred.complete()}_dropPending(e){let t=this._pending.get().filter(o=>o!==e);t.length!==this._pending.get().length&&this._pending.set(t,void 0)}*_readPersistedGrants(e){let t=this._configurationService.getValue(fzt)?.[e];if(t){for(let[o,n]of Object.entries(t))if(!(n!=="r"&&n!=="rw"))try{yield{uri:A.parse(o),mode:n}}catch{}}}async _persistGrant(e,t,o){let n=o==="write"?"rw":"r";for(let u of this._readPersistedGrants(e))if((u.mode==="rw"||n==="r")&&Jn.isEqualOrParent(t,u.uri))return;let{target:r,value:s}=this._inspectScopedSetting(),l={...s[e]??{}},c=t.toString();l[c]!=="rw"&&(l[c]=n,await this._configurationService.updateValue(fzt,{...s,[e]:l},r))}_inspectScopedSetting(){let e=this._configurationService.inspect(fzt);return e.applicationValue!==void 0?{target:1,value:e.applicationValue}:e.userLocalValue!==void 0?{target:3,value:e.userLocalValue}:e.userRemoteValue!==void 0?{target:4,value:e.userRemoteValue}:e.userValue!==void 0?{target:2,value:e.userValue}:{target:1,value:{}}}};Not=I([m(0,B),m(1,ge),m(2,re)],Not);Ce(hQ,Not,1);var FR=le("IDefaultLogLevelsService"),Oot=class extends k{constructor(e,t,o,n,r){super();this.environmentService=e;this.fileService=t;this.jsonEditingService=o;this.logService=n;this.loggerService=r;this._onDidChangeDefaultLogLevels=this._register(new T);this.onDidChangeDefaultLogLevels=this._onDidChangeDefaultLogLevels.event;this._defaultLogLevels={default:this._getDefaultLogLevelFromEnv(),extensions:this._getExtensionsDefaultLogLevelsFromEnv()},this._register(this.fileService.onDidFilesChange(s=>{s.contains(this.environmentService.argvResource)&&this.onDidChangeArgv()}))}async onDidChangeArgv(){let e=await this._parseLogLevelsFromArgv();this.updateDefaultLogLevels(e)}get defaultLogLevels(){return this._defaultLogLevels}updateDefaultLogLevels(e){let t={default:e?.default??this._getDefaultLogLevelFromEnv(),extensions:e?.extensions??this._getExtensionsDefaultLogLevelsFromEnv()};Qi(this._defaultLogLevels,t)||(this._defaultLogLevels=t,this._onDidChangeDefaultLogLevels.fire(this._defaultLogLevels))}getDefaultLogLevel(e){return e?(e=e.toLowerCase(),this._getDefaultLogLevel(this._defaultLogLevels,e)):this._getDefaultLogLevel(this._defaultLogLevels)}async setDefaultLogLevel(e,t){let o=await this._parseLogLevelsFromArgv()??{};if(t){t=t.toLowerCase();let n=this._getDefaultLogLevel(o,t);o.extensions=o.extensions??[];let r=o.extensions.find(([l])=>l===t);r?r[1]=e:o.extensions.push([t,e]),await this._writeLogLevelsToArgv(o);let s=[...this.loggerService.getRegisteredLoggers()].filter(l=>l.extensionId&&l.extensionId.toLowerCase()===t);for(let{resource:l}of s)this.loggerService.getLogLevel(l)===n&&this.loggerService.setLogLevel(l,e)}else{let n=this._getDefaultLogLevel(o);o.default=e,await this._writeLogLevelsToArgv(o),this.loggerService.getLogLevel()===n&&this.loggerService.setLogLevel(e)}this.updateDefaultLogLevels(o)}_getDefaultLogLevel(e,t){if(t){let o=e.extensions?.find(([n])=>n===t);if(o)return o[1]}return e.default??Boi(this.environmentService)}async _writeLogLevelsToArgv(e){let t=[];bn(e.default)||t.push(ux(e.default));for(let[o,n]of e.extensions??[])t.push(`${o}=${ux(n)}`);await this.jsonEditingService.write(this.environmentService.argvResource,[{path:["log-level"],value:t.length?t:void 0}],!0)}async _parseLogLevelsFromArgv(){let e={extensions:[]},t=await this._readLogLevelsFromArgv();for(let o of t){let n=vpe.exec(o);if(n&&n[1]&&n[2]){let r=oce(n[2]);bn(r)||e.extensions?.push([n[1].toLowerCase(),r])}else{let r=oce(o);bn(r)||(e.default=r)}}return!bn(e.default)||e.extensions?.length?e:void 0}async _readLogLevelsFromArgv(){try{let e=await this.fileService.readFile(this.environmentService.argvResource),t=is(e.value.toString());return We(t["log-level"])?[t["log-level"]]:Array.isArray(t["log-level"])?t["log-level"]:[]}catch(e){rp(e)!==1&&this.logService.error(e)}return[]}_getDefaultLogLevelFromEnv(){return Boi(this.environmentService)}_getExtensionsDefaultLogLevelsFromEnv(){let e=[];for(let[t,o]of this.environmentService.extensionLogLevel??[]){let n=oce(o);bn(n)||e.push([t,n])}return e}};Oot=I([m(0,Mt),m(1,ge),m(2,Zg),m(3,re),m(4,Ol)],Oot);Ce(FR,Oot,1);var Fot=class extends k{constructor(e){super();this.layoutService=e;this.contextView=this._register(new kke(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,o){let n;t?t===this.layoutService.getContainer(Me(t))?n=1:o?n=3:n=2:n=1,this.contextView.setContainer(t??this.layoutService.activeContainer,n),this.contextView.show(e);let r={close:()=>{this.openContextView===r&&this.hideContextView()}};return this.openContextView=r,r}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e),this.openContextView=void 0}};Fot=I([m(0,Kl)],Fot);var vzt=class extends Fot{getContextViewElement(){return this.contextView.getViewElement()}};var FAe=class extends k{constructor(e,t){super();this._markerService=t;this._onDidChangeMarker=this._register(new T);this.onDidChangeMarker=this._onDidChangeMarker.event;this._suppressedRanges=new dt;this._markerDecorations=new dt;e.getModels().forEach(o=>this._onModelAdded(o)),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach(e=>e.dispose()),this._markerDecorations.clear()}getMarker(e,t){let o=this._markerDecorations.get(e);return o&&o.getMarker(t)||null}getLiveMarkers(e){let t=this._markerDecorations.get(e);return t?t.getMarkers():[]}addMarkerSuppression(e,t){let o=this._suppressedRanges.get(e);return o||(o=new Set,this._suppressedRanges.set(e,o)),o.add(t),this._handleMarkerChange([e]),ee(()=>{let n=this._suppressedRanges.get(e);n&&(n.delete(t),n.size===0&&this._suppressedRanges.delete(e),this._handleMarkerChange([e]))})}_handleMarkerChange(e){e.forEach(t=>{let o=this._markerDecorations.get(t);o&&this._updateDecorations(o)})}_onModelAdded(e){let t=new QDi(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){let t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===Q.inMemory||e.uri.scheme===Q.internal||e.uri.scheme===Q.vscode)&&this._markerService?.read({resource:e.uri}).map(o=>o.owner).forEach(o=>this._markerService.remove(o,[e.uri]))}_updateDecorations(e){let t=this._markerService.read({resource:e.model.uri,take:500}),o=this._suppressedRanges.get(e.model.uri);o&&(t=t.filter(n=>!yt.some(o,r=>G.areIntersectingOrTouching(r,n)))),e.update(t)&&this._onDidChangeMarker.fire(e.model)}};FAe=I([m(0,_t),m(1,ha)],FAe);var QDi=class extends k{constructor(e){super();this.model=e;this._map=new xvt;this._register(ee(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){let{added:t,removed:o}=cz(new Set(this._map.keys()),new Set(e));if(t.length===0&&o.length===0)return!1;let n=o.map(l=>this._map.get(l)),r=t.map(l=>({range:this._createDecorationRange(this.model,l),options:this._createDecorationOption(l)})),s=this.model.deltaDecorations(n,r);for(let l of o)this._map.delete(l);for(let l=0;l<s.length;l++)this._map.set(t[l],s[l]);return!0}getMarker(e){return this._map.getKey(e.id)}getMarkers(){let e=[];return this._map.forEach((t,o)=>{let n=this.model.getDecorationRange(t);n&&e.push([n,o])}),e}_createDecorationRange(e,t){let o=G.lift(t);if(t.severity===1&&!this._hasMarkerTag(t,1)&&!this._hasMarkerTag(t,2)&&(o=o.setEndPosition(o.startLineNumber,o.startColumn+2)),o=e.validateRange(o),o.isEmpty()){let n=e.getLineLastNonWhitespaceColumn(o.startLineNumber)||e.getLineMaxColumn(o.startLineNumber);if(n===1||o.endColumn>=n)return o;let r=e.getWordAtPosition(o.getStartPosition());r&&(o=new G(o.startLineNumber,r.startColumn,o.endLineNumber,r.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&o.startLineNumber===o.endLineNumber){let n=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);n<o.endColumn&&(o=new G(o.startLineNumber,n,o.endLineNumber,o.endColumn),t.startColumn=n)}return o}_createDecorationOption(e){let t,o,n,r,s;switch(e.severity){case 1:this._hasMarkerTag(e,2)?t=void 0:this._hasMarkerTag(e,1)?t="squiggly-unnecessary":t="squiggly-hint",n=0;break;case 2:t="squiggly-info",o=_s(SX),n=10,s={color:_s(c7i),position:1};break;case 4:t="squiggly-warning",o=_s(eXi),n=20,s={color:_s(d7i),position:1};break;case 8:default:t="squiggly-error",o=_s(ode),n=30,s={color:_s(u7i),position:1};break}return e.tags&&(e.tags.indexOf(1)!==-1&&(r="squiggly-inline-unnecessary"),e.tags.indexOf(2)!==-1&&(r="squiggly-inline-deprecated")),{description:"marker-decoration",stickiness:1,className:t,showIfCollapsed:!0,overviewRuler:{color:o,position:4},minimap:s,zIndex:n,inlineClassName:r}}_hasMarkerTag(e,t){return e.tags?e.tags.indexOf(t)>=0:!1}};var bge=new Set([Q.inMemory,Q.vscodeSourceControl,Q.walkThrough,Q.walkThroughSnippet,Q.vscodeChatCodeBlock,Q.vscodeTerminal]),YDi=class{constructor(){this._byResource=new dt;this._byOwner=new Map}set(i,e,t){let o=this._byResource.get(i);o||(o=new Map,this._byResource.set(i,o)),o.set(e,t);let n=this._byOwner.get(e);n||(n=new dt,this._byOwner.set(e,n)),n.set(i,t)}get(i,e){return this._byResource.get(i)?.get(e)}delete(i,e){let t=!1,o=!1,n=this._byResource.get(i);n&&(t=n.delete(e));let r=this._byOwner.get(e);if(r&&(o=r.delete(i)),t!==o)throw new Error("illegal state");return t&&o}values(i){return typeof i=="string"?this._byOwner.get(i)?.values()??yt.empty():A.isUri(i)?this._byResource.get(i)?.values()??yt.empty():yt.map(yt.concat(...this._byOwner.values()),e=>e[1])}},XDi=class{constructor(i){this.errors=0;this.infos=0;this.warnings=0;this.unknowns=0;this._data=new dt;this._service=i,this._subscription=i.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(i){for(let e of i){let t=this._data.get(e);t&&this._substract(t);let o=this._resourceStats(e);this._add(o),this._data.set(e,o)}}_resourceStats(i){let e={errors:0,warnings:0,infos:0,unknowns:0};if(bge.has(i.scheme))return e;for(let{severity:t}of this._service.read({resource:i}))t===8?e.errors+=1:t===4?e.warnings+=1:t===2?e.infos+=1:e.unknowns+=1;return e}_substract(i){this.errors-=i.errors,this.warnings-=i.warnings,this.infos-=i.infos,this.unknowns-=i.unknowns}_add(i){this.errors+=i.errors,this.warnings+=i.warnings,this.infos+=i.infos,this.unknowns+=i.unknowns}},bzt=class a{constructor(){this._onMarkerChanged=new aY({merge:a._merge});this.onMarkerChanged=this._onMarkerChanged.event;this._data=new YDi;this._stats=new XDi(this);this._filteredResources=new dt}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}getStatistics(){return this._stats}remove(i,e){for(let t of e||[])this.changeOne(i,t,[])}changeOne(i,e,t){if(YO(t))this._data.delete(e,i)&&this._onMarkerChanged.fire([e]);else{let o=[];for(let n of t){let r=a._toMarker(i,e,n);r&&o.push(r)}this._data.set(e,i,o),this._onMarkerChanged.fire([e])}}installResourceFilter(i,e){let t=this._filteredResources.get(i);return t||(t=[],this._filteredResources.set(i,t)),t.push(e),this._onMarkerChanged.fire([i]),ee(()=>{let o=this._filteredResources.get(i);if(!o)return;let n=o.indexOf(e);n!==-1&&(o.splice(n,1),o.length===0&&this._filteredResources.delete(i),this._onMarkerChanged.fire([i]))})}static _toMarker(i,e,t){let{code:o,severity:n,message:r,source:s,startLineNumber:l,startColumn:c,endLineNumber:u,endColumn:p,relatedInformation:h,modelVersionId:g,tags:f,origin:v}=t;if(r)return l=l>0?l:1,c=c>0?c:1,u=u>=l?u:l,p=p>0?p:c,{resource:e,owner:i,code:o,severity:n,message:r,source:s,startLineNumber:l,startColumn:c,endLineNumber:u,endColumn:p,relatedInformation:h,modelVersionId:g,tags:f,origin:v}}changeAll(i,e){let t=[],o=this._data.values(i);if(o)for(let n of o){let r=yt.first(n);r&&(t.push(r.resource),this._data.delete(r.resource,i))}if(Rr(e)){let n=new dt;for(let{resource:r,marker:s}of e){let l=a._toMarker(i,r,s);if(!l)continue;let c=n.get(r);c?c.push(l):(n.set(r,[l]),t.push(r))}for(let[r,s]of n)this._data.set(r,i,s)}t.length>0&&this._onMarkerChanged.fire(t)}_createFilteredMarker(i,e){let t=e.length===1?d(2417,null,e[0]):d(2418,null,e[0],e.length-1);return{owner:"markersFilter",resource:i,severity:2,message:t,startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1}}read(i=Object.create(null)){let{owner:e,resource:t,severities:o,take:n}=i;if((!n||n<0)&&(n=-1),e&&t){let r=i.ignoreResourceFilters?void 0:this._filteredResources.get(t);if(r?.length)return[this._createFilteredMarker(t,r)];let s=this._data.get(t,e);if(!s)return[];let l=[];for(let c of s){if(n>0&&l.length===n)break;let u=i.ignoreResourceFilters?void 0:this._filteredResources.get(t);u?.length?l.push(this._createFilteredMarker(t,u)):a._accept(c,o)&&l.push(c)}return l}else{let r=!e&&!t?this._data.values():this._data.values(t??e),s=[],l=new xn;for(let c of r)for(let u of c){if(l.has(u.resource))continue;if(n>0&&s.length===n)break;let p=i.ignoreResourceFilters?void 0:this._filteredResources.get(u.resource);p?.length?(s.push(this._createFilteredMarker(u.resource,p)),l.add(u.resource)):a._accept(u,o)&&s.push(u)}return s}}static _accept(i,e){return e===void 0||(e&i.severity)===i.severity}static _merge(i){let e=new dt;for(let t of i)for(let o of t)e.set(o,!0);return Array.from(e.keys())}};var Wot="data-keybinding-context",Vot=class{constructor(i,e){this._id=i,this._parent=e,this._value=Object.create(null),this._value._contextId=i}get value(){return{...this._value}}setValue(i,e){return Qi(this._value[i],e)?!1:(this._value[i]=e,!0)}removeValue(i){return i in this._value?(delete this._value[i],!0):!1}getValue(i){let e=this._value[i];return typeof e>"u"&&this._parent?this._parent.getValue(i):e}updateParent(i){this._parent=i}collectAllValues(){let i=this._parent?this._parent.collectAllValues():Object.create(null);return i={...i,...this._value},delete i._contextId,i}},VAe=class a extends Vot{static{this.INSTANCE=new a}constructor(){super(-1,null)}setValue(i,e){return!1}removeValue(i){return!1}getValue(i){}collectAllValues(){return Object.create(null)}},JDi=class a extends Vot{constructor(e,t,o){super(e,null);this._configurationService=t;this._values=Hp.forConfigKeys();this._listener=this._configurationService.onDidChangeConfiguration(n=>{if(n.source===7){let r=Array.from(this._values,([s])=>s);this._values.clear(),o.fire(new Bot(r))}else{let r=[];for(let s of n.affectedKeys){let l=`config.${s}`,c=this._values.findSuperstr(l);c!==void 0&&(r.push(...yt.map(c,([u])=>u)),this._values.deleteSuperstr(l)),this._values.has(l)&&(r.push(l),this._values.delete(l))}o.fire(new Bot(r))}})}static{this._keyPrefix="config."}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(a._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);let t=e.substr(a._keyPrefix.length),o=this._configurationService.getValue(t),n;switch(typeof o){case"number":case"boolean":case"string":n=o;break;default:Array.isArray(o)?n=JSON.stringify(o):n=o}return this._values.set(e,n),n}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}collectAllValues(){let e=Object.create(null);return this._values.forEach((t,o)=>e[o]=t),{...e,...super.collectAllValues()}}},ZDi=class{constructor(i,e,t){this._service=i,this._key=e,this._defaultValue=t,this.reset()}set(i){this._service.setContext(this._key,i)}reset(){typeof this._defaultValue>"u"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}},Szt=class{constructor(i){this.key=i}affectsSome(i){return i.has(this.key)}allKeysContainedIn(i){return this.affectsSome(i)}},Bot=class{constructor(i){this.keys=i}affectsSome(i){for(let e of this.keys)if(i.has(e))return!0;return!1}allKeysContainedIn(i){return this.keys.every(e=>i.has(e))}},eRi=class{constructor(i){this.events=i}affectsSome(i){for(let e of this.events)if(e.affectsSome(i))return!0;return!1}allKeysContainedIn(i){return this.events.every(e=>e.allKeysContainedIn(i))}};function Prn(a,i){return a.allKeysContainedIn(new Set(Object.keys(i)))}var Izt=class extends k{constructor(e){super();this._onDidChangeContext=this._register(new Ih({merge:e=>new eRi(e)}));this._isDisposed=!1,this._myContextId=e}get onDidChangeContext(){return this._onDidChangeContext.event}get contextId(){return this._myContextId}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new ZDi(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new tRi(this,e)}createOverlay(e=yt.empty()){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new iRi(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");let t=this.getContextValuesContainer(this._myContextId);return e?e.evaluate(t):!0}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;let o=this.getContextValuesContainer(this._myContextId);o&&o.setValue(e,t)&&this._onDidChangeContext.fire(new Szt(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new Szt(e))}getContext(e){return this._isDisposed?VAe.INSTANCE:this.getContextValuesContainer(Arn(e))}dispose(){super.dispose(),this._isDisposed=!0}},WAe=class extends Izt{constructor(e){super(0);this._contexts=new Map;this._lastContextId=0,this.inputFocusedContext=Wg.bindTo(this);let t=this._register(new JDi(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t),this._register(U.runAndSubscribe(Of,({window:o,disposables:n})=>{let r=n.add(new ue);n.add($(o,ne.FOCUS_IN,()=>{r.value=new O,this.updateInputContextKeys(o.document,r.value)},!0))},{window:ut,disposables:this._store}))}updateInputContextKeys(e,t){function o(){return!!e.activeElement&&Ch(e.activeElement)}let n=o();if(this.inputFocusedContext.set(n),n){let r=t.add(nr(e.activeElement));U.once(r.onDidBlur)(()=>{zi().document===e&&this.inputFocusedContext.set(o()),r.dispose()},void 0,t)}}getContextValuesContainer(e){return this._isDisposed?VAe.INSTANCE:this._contexts.get(e)||VAe.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");let t=++this._lastContextId;return this._contexts.set(t,new Vot(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}updateParent(e){throw new Error("Cannot update parent of root ContextKeyService")}};WAe=I([m(0,B)],WAe);var tRi=class extends Izt{constructor(e,t){super(e.createChildContext());this._parentChangeListener=this._register(new ue);if(this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(Wot)){let o="";this._domNode.classList&&(o=Array.from(this._domNode.classList.values()).join(", ")),console.error(`Element already has context attribute${o?": "+o:""}`)}this._domNode.setAttribute(Wot,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{let o=this._parent.getContextValuesContainer(this._myContextId).value;Prn(e,o)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parentChangeListener.clear(),this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(Wot),super.dispose())}getContextValuesContainer(e){return this._isDisposed?VAe.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._parent.disposeContext(e)}updateParent(e){if(this._parent===e)return;let t=this._parent.getContextValuesContainer(this._myContextId),o=t.collectAllValues();this._parent=e,this._updateParentChangeListener();let n=this._parent.getContextValuesContainer(this._parent.contextId);t.updateParent(n);let r=t.collectAllValues(),s={...q4e(o,r),...q4e(r,o)},l=Object.keys(s);this._onDidChangeContext.fire(new Bot(l))}},yzt=class{constructor(i,e){this.parent=i;this.overlay=e}getValue(i){return this.overlay.has(i)?this.overlay.get(i):this.parent.getValue(i)}},iRi=class a{constructor(i,e){this.parent=i;this.overlay=new Map(e)}get contextId(){return this.parent.contextId}get onDidChangeContext(){return this.parent.onDidChangeContext}bufferChangeEvents(i){this.parent.bufferChangeEvents(i)}createKey(){throw new Error("Not supported.")}getContext(i){return new yzt(this.parent.getContext(i),this.overlay)}getContextValuesContainer(i){let e=this.parent.getContextValuesContainer(i);return new yzt(e,this.overlay)}contextMatchesRules(i){let e=this.getContextValuesContainer(this.contextId);return i?i.evaluate(e):!0}getContextKeyValue(i){return this.overlay.has(i)?this.overlay.get(i):this.parent.getContextKeyValue(i)}createScoped(){throw new Error("Not supported.")}createOverlay(i=yt.empty()){return new a(this,i)}updateParent(){throw new Error("Not supported.")}};function Arn(a){for(;a;){if(a.hasAttribute(Wot)){let i=a.getAttribute(Wot);return i?parseInt(i,10):NaN}a=a.parentElement}return 0}function Nrn(a,i,e){a.get(X).createKey(String(i),Orn(e))}function Orn(a){return Dk(a,i=>{if(typeof i=="object"&&i.$mid===1)return A.revive(i).toString();if(i instanceof A)return i.toString()})}Ge.registerCommand("_setContext",Nrn);Ge.registerCommand({id:"getContextKeyInfo",handler(){return[...Y.all()].sort((a,i)=>a.key.localeCompare(i.key))},metadata:{description:d(2101,null),args:[]}});Ge.registerCommand("_generateContextKeyInfo",function(){let a=[],i=new Set;for(let e of Y.all())i.has(e.key)||(i.add(e.key),a.push(e));a.sort((e,t)=>e.key.localeCompare(t.key)),console.log(JSON.stringify(a,void 0,2))});var BAe=class extends k{constructor(e,t,o){super();this.configurationService=e;this.modelService=t;this.languageService=o;this._onDidChangeConfiguration=this._register(new T);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._register(this.configurationService.onDidChangeConfiguration(n=>this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(n))))}getValue(e,t,o){return typeof o=="string"?this._getValue(e,ye.isIPosition(t)?t:null,o):this._getValue(e,null,typeof t=="string"?t:void 0)}updateValue(e,t,o,n){let r=e?this.getLanguage(e,null):null,s=this.configurationService.inspect(t,{resource:e,overrideIdentifier:r});n===void 0&&(n=this.deriveConfigurationTarget(s,r));let l=r&&s.overrideIdentifiers?.includes(r)?r:void 0;return this.configurationService.updateValue(t,o,{resource:e,overrideIdentifier:l},n)}deriveConfigurationTarget(e,t){if(t){if(e.memory?.override!==void 0)return 8;if(e.workspaceFolder?.override!==void 0)return 6;if(e.workspace?.override!==void 0)return 5;if(e.userRemote?.override!==void 0)return 4;if(e.userLocal?.override!==void 0)return 3}return e.memory?.value!==void 0?8:e.workspaceFolder?.value!==void 0?6:e.workspace?.value!==void 0?5:e.userRemote?.value!==void 0?4:3}_getValue(e,t,o){let n=e?this.getLanguage(e,t):void 0;return typeof o>"u"?this.configurationService.getValue({resource:e,overrideIdentifier:n}):this.configurationService.getValue(o,{resource:e,overrideIdentifier:n})}inspect(e,t,o){let n=e?this.getLanguage(e,t):void 0;return this.configurationService.inspect(o,{resource:e,overrideIdentifier:n})}getLanguage(e,t){let o=this.modelService.getModel(e);return o?t?o.getLanguageIdAtPosition(t.lineNumber,t.column):o.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}toResourceConfigurationChangeEvent(e){return{affectedKeys:e.affectedKeys,affectsConfiguration:(t,o)=>{let n=t?this.getLanguage(t,null):void 0;return e.affectsConfiguration(o,{resource:t,overrideIdentifier:n})?!0:n?e.affectedKeys.has(`[${n}]`):!1}}}};BAe=I([m(0,B),m(1,_t),m(2,Rt)],BAe);var HAe=class{constructor(i,e){this.requestService=i;this.fileService=e}async download(i,e,t,o=Ie.None){if(i.scheme===Q.file||i.scheme===Q.vscodeRemote){await this.fileService.copy(i,e);return}let n={type:"GET",url:i.toString(!0),callSite:t},r=await this.requestService.request(n,o);if(r.res.statusCode===200)await this.fileService.writeFile(e,r.stream);else{let s=await gC(r);throw new Error(`Expected 200, got back ${r.res.statusCode} instead.

${s}`)}}};HAe=I([m(0,Ra),m(1,ge)],HAe);var Hot=class{constructor(i){this._commandService=i}async open(i,e){if(!hc(i,Q.command))return!1;if(!e?.allowCommands||(typeof i=="string"&&(i=A.parse(i)),Array.isArray(e.allowCommands)&&!e.allowCommands.includes(i.path)))return!0;let t=[];try{t=Dm(decodeURIComponent(i.query))}catch{try{t=Dm(i.query)}catch{}}return Array.isArray(t)||(t=[t]),await this._commandService.executeCommand(i.path,...t),!0}};Hot=I([m(0,fe)],Hot);var Uot=class{constructor(i){this._editorService=i}async open(i,e){typeof i=="string"&&(i=A.parse(i));let{selection:t,uri:o}=cxe(i);return i=o,i.scheme===Q.file&&(i=Jj(i)),await this._editorService.openCodeEditor({resource:i,options:{selection:t,source:e?.fromUserGesture?1:0,...e?.editorOptions}},this._editorService.getFocusedCodeEditor(),e?.openToSide),!0}};Uot=I([m(0,Qt)],Uot);var UAe=class{constructor(i,e){this._openers=new ra;this._validators=new ra;this._resolvers=new ra;this._resolvedUriTargets=new dt(i=>i.with({path:null,fragment:null,query:null}).toString());this._externalOpeners=new ra;this._defaultExternalOpener={openExternal:async t=>(gB(t,Q.http,Q.https)?M4e(t):ut.location.href=t,!0)},this._openers.push({open:async(t,o)=>o?.openExternal||gB(t,Q.mailto,Q.http,Q.https,Q.vsls)?(await this._doOpenExternal(t,o),!0):!1}),this._openers.push(new Hot(e)),this._openers.push(new Uot(i))}registerOpener(i){return{dispose:this._openers.unshift(i)}}registerValidator(i){return{dispose:this._validators.push(i)}}registerExternalUriResolver(i){return{dispose:this._resolvers.push(i)}}setDefaultExternalOpener(i){this._defaultExternalOpener=i}registerExternalOpener(i){return{dispose:this._externalOpeners.push(i)}}async open(i,e){let t=typeof i=="string"?A.parse(i):i;if(t.scheme===Q.internal)return!1;if(!e?.skipValidation){let o=this._resolvedUriTargets.get(t)??i;for(let n of this._validators)if(!await n.shouldOpen(o,e))return!1}for(let o of this._openers)if(await o.open(i,e))return!0;return!1}async resolveExternalUri(i,e){for(let t of this._resolvers)try{let o=await t.resolveExternalUri(i,e);if(o)return this._resolvedUriTargets.has(o.resolved)||this._resolvedUriTargets.set(o.resolved,i),o}catch{}throw new Error("Could not resolve external URI: "+i.toString())}async _doOpenExternal(i,e){let t=typeof i=="string"?A.parse(i):i,o;try{o=(await this.resolveExternalUri(t,e)).resolved}catch{o=t}let n;if(typeof i=="string"&&t.toString()===o.toString()?n=i:n=encodeURI(o.toString(!0)),e?.allowContributedOpeners){let r=typeof e?.allowContributedOpeners=="string"?e?.allowContributedOpeners:void 0;for(let s of this._externalOpeners)if(await s.openExternal(n,{sourceUri:t,preferredOpenerId:r},Ie.None))return!0}return this._defaultExternalOpener.openExternal(n,{sourceUri:t},Ie.None)}dispose(){this._validators.clear()}};UAe=I([m(0,Qt),m(1,fe)],UAe);var uq=le("IIgnoredExtensionsManagementService"),zAe=class{constructor(i){this.configurationService=i}hasToNeverSyncExtension(i){return this.getConfiguredIgnoredExtensions().includes(i.toLowerCase())}hasToAlwaysSyncExtension(i){return this.getConfiguredIgnoredExtensions().includes(`-${i.toLowerCase()}`)}updateIgnoredExtensions(i,e){let t=[...this.configurationService.getValue("settingsSync.ignoredExtensions")].map(o=>o.toLowerCase());return t=t.filter(o=>o!==i&&o!==`-${i}`),e&&t.push(i.toLowerCase()),this.configurationService.updateValue("settingsSync.ignoredExtensions",t.length?t:void 0,2)}updateSynchronizedExtensions(i,e){let t=[...this.configurationService.getValue("settingsSync.ignoredExtensions")].map(o=>o.toLowerCase());return t=t.filter(o=>o!==i&&o!==`-${i}`),e&&t.push(`-${i.toLowerCase()}`),this.configurationService.updateValue("settingsSync.ignoredExtensions",t.length?t:void 0,2)}getIgnoredExtensions(i){let e=i.filter(r=>r.isMachineScoped).map(r=>r.identifier.id.toLowerCase()),t=this.getConfiguredIgnoredExtensions().map(r=>r.toLowerCase()),o=[],n=[];if(Array.isArray(t))for(let r of t)r.startsWith("-")?n.push(r.substring(1)):o.push(r);return jo([...e,...o].filter(r=>!n.includes(r)))}getConfiguredIgnoredExtensions(){return(this.configurationService.getValue("settingsSync.ignoredExtensions")||[]).map(i=>i.toLowerCase())}};zAe=I([m(0,B)],zAe);var KAe=class extends Mz{constructor(i,e){super(),this.logger=this._register(i.createLogger(Ve(e.logsHome,`${age}.log`),{id:age,name:d(2972,null)}))}trace(i,...e){this.logger.trace(i,...e)}debug(i,...e){this.logger.debug(i,...e)}info(i,...e){this.logger.info(i,...e)}warn(i,...e){this.logger.warn(i,...e)}error(i,...e){this.logger.error(i,...e)}flush(){this.logger.flush()}};KAe=I([m(0,Ol),m(1,ko)],KAe);function Frn(a){return a.type==="gallery"}function Wrn(a){return a.type===1||a.type===0}var Vrn=/^(?<version>\d+\.\d+\.\d+(-.*)?)(@(?<platform>.+))?$/,GAe=class extends k{constructor(e,t){super();this.configurationService=t;this._onDidChangeAllowedExtensions=this._register(new T);this.onDidChangeAllowedExtensionsConfigValue=this._onDidChangeAllowedExtensions.event;this.publisherOrgs=e.extensionPublisherOrgs?.map(o=>o.toLowerCase())??[],this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(Xue)&&(this._allowedExtensionsConfigValue=this.getAllowedExtensionsValue(),this._onDidChangeAllowedExtensions.fire())}))}get allowedExtensionsConfigValue(){return this._allowedExtensionsConfigValue}getAllowedExtensionsValue(){let e=this.configurationService.getValue(Xue);if(!Di(e)||Array.isArray(e))return;let t=Object.entries(e).map(([o,n])=>[o.toLowerCase(),n]);if(!(t.length===1&&t[0][0]==="*"&&t[0][1]===!0))return Object.fromEntries(t)}isAllowed(e){if(!this._allowedExtensionsConfigValue)return!0;let t,o,n,r,s,l;Frn(e)?(t=e.identifier.id.toLowerCase(),o=e.version,r=e.properties.isPreReleaseVersion,s=e.publisher.toLowerCase(),l=e.publisherDisplayName.toLowerCase(),n=e.properties.targetPlatform):Wrn(e)?(t=e.identifier.id.toLowerCase(),o=e.manifest.version,r=e.preRelease,s=e.manifest.publisher.toLowerCase(),l=e.publisherDisplayName?.toLowerCase(),n=e.targetPlatform):(t=e.id.toLowerCase(),o=e.version??"*",n=e.targetPlatform??"universal",r=e.prerelease??!1,s=e.id.substring(0,e.id.indexOf(".")).toLowerCase(),l=e.publisherDisplayName?.toLowerCase());let c=nc("workbench.action.openSettings",{query:`@id:${Xue}`}).toString(),u=this._allowedExtensionsConfigValue[t],p=new he(d(2223,null,c));if(!bn(u))return Xa(u)?u?!0:p:u==="stable"&&r?new he(d(2220,null,c)):o!=="*"&&Array.isArray(u)&&!u.some(f=>{let v=Vrn.exec(f);if(v&&v.groups){let{platform:b,version:S}=v.groups;return!(S!==o||n!=="universal"&&b&&n!==b)}return!1})?new he(d(2224,null,o,c)):!0;let h=l&&this.publisherOrgs.includes(l)?l:s,g=this._allowedExtensionsConfigValue[h];return bn(g)?this._allowedExtensionsConfigValue["*"]===!0?!0:p:Xa(g)?g?!0:new he(d(2222,null,h,c)):g==="stable"&&r?new he(d(2221,null,h,c)):!0}};GAe=I([m(0,Ze),m(1,B)],GAe);var pq=le("IMcpGalleryService"),kbo=le("IMcpManagementService"),fP=le("IAllowedMcpServersService"),sy="chat.mcp.access",gQ="chat.mcp.gallery.serviceUrl",mq="chat.mcp.gallery.enabled",gie="chat.mcp.autostart",wzt="chat.mcp.apps.enabled";var Tbo;(o=>{o.VERSION="v0-2025-07-09",o.SCHEMA="https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json";class e{toRawGalleryMcpServerResult(r){if(!r||typeof r!="object"||!Array.isArray(r.servers))return;let s=r,l=[];for(let c of s.servers){let u=this.toRawGalleryMcpServer(c);if(!u)return;l.push(u)}return{metadata:{count:s.metadata.count??0,nextCursor:s.metadata?.next_cursor},servers:l}}toRawGalleryMcpServer(r){if(!r||typeof r!="object")return;let s=r;if(!s.name||!We(s.name)||!s.description||!We(s.description)||!s.version||!We(s.version)||s.$schema&&s.$schema!==o.SCHEMA)return;let l=s._meta?.["io.modelcontextprotocol.registry/official"];function c(b){return{...b,isRequired:b.is_required,isSecret:b.is_secret}}function u(b){let S={};for(let[y,w]of Object.entries(b))S[y]=c(w);return S}function p(b){return b.type==="positional"?{...b,valueHint:b.value_hint,isRepeated:b.is_repeated,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}:{...b,isRepeated:b.is_repeated,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}}function h(b){return{...b,isRequired:b.is_required,isSecret:b.is_secret,variables:b.variables?u(b.variables):void 0}}function g(b){switch(b.type){case"stdio":return{type:"stdio"};case"streamable-http":return{type:"streamable-http",url:b.url,headers:b.headers?.map(h)};case"sse":return{type:"sse",url:b.url,headers:b.headers?.map(h)};default:return{type:"stdio"}}}function f(b){switch(b){case"npm":return"npm";case"docker":case"docker-hub":case"oci":return"oci";case"pypi":return"pypi";case"nuget":return"nuget";case"mcpb":return"mcpb";default:return"npm"}}let v=s._meta["io.modelcontextprotocol.registry/publisher-provided"]?.github;return{id:l.id,name:s.name,description:s.description,repository:s.repository?{url:s.repository.url,source:s.repository.source,id:s.repository.id}:void 0,readme:s.repository?.readme,version:s.version,createdAt:s.created_at,updatedAt:s.updated_at,packages:s.packages?.map(b=>({identifier:b.identifier??b.name,registryType:f(b.registry_type??b.registry_name),version:b.version,fileSha256:b.file_sha256,registryBaseUrl:b.registry_base_url,transport:b.transport?g(b.transport):{type:"stdio"},packageArguments:b.package_arguments?.map(p),runtimeHint:b.runtime_hint,runtimeArguments:b.runtime_arguments?.map(p),environmentVariables:b.environment_variables?.map(h)})),remotes:s.remotes?.map(b=>({type:(b.type??b.transport_type??b.transport)==="sse"?"sse":"streamable-http",url:b.url,headers:b.headers?.map(h)})),registryInfo:{isLatest:l.is_latest,publishedAt:l.published_at,updatedAt:l.updated_at},githubInfo:v?{name:v.name,nameWithOwner:v.name_with_owner,displayName:v.display_name,isInOrganization:v.is_in_organization,license:v.license,opengraphImageUrl:v.opengraph_image_url,ownerAvatarUrl:v.owner_avatar_url,primaryLanguage:v.primary_language,primaryLanguageColor:v.primary_language_color,pushedAt:v.pushed_at,stargazerCount:v.stargazer_count,topics:v.topics,usesCustomOpengraphImage:v.uses_custom_opengraph_image}:void 0}}}o.SERIALIZER=new e})(Tbo||={});var Czt;(t=>{t.VERSION="v0.1";class i{toRawGalleryMcpServerResult(n){if(!n||typeof n!="object"||!Array.isArray(n.servers))return;let r=n,s=[];for(let l of r.servers){let c=this.toRawGalleryMcpServer(l);if(!c){if(s.length===0)return;continue}s.push(c)}return{metadata:r.metadata,servers:s}}toRawGalleryMcpServer(n){if(!n||typeof n!="object")return;let r=n;if(!r.server||!Di(r.server)||!r.server.name||!We(r.server.name)||!r.server.description||!We(r.server.description)||!r.server.version||!We(r.server.version))return;let{"io.modelcontextprotocol.registry/official":s,...l}=r._meta,c=r.server._meta?.["io.modelcontextprotocol.registry/publisher-provided"]?.github;return{name:r.server.name,description:r.server.description,version:r.server.version,title:r.server.title,repository:r.server.repository?{url:r.server.repository.url,source:r.server.repository.source,id:r.server.repository.id}:void 0,readme:c?.readme,icons:r.server.icons,websiteUrl:r.server.websiteUrl,packages:r.server.packages,remotes:r.server.remotes,status:s?.status,registryInfo:s,githubInfo:c,apicInfo:l}}}t.SERIALIZER=new i})(Czt||={});var oRi;(t=>{t.VERSION="v0";class i{constructor(){this.galleryMcpServerDataSerializers=[];this.galleryMcpServerDataSerializers.push(Czt.SERIALIZER),this.galleryMcpServerDataSerializers.push(Tbo.SERIALIZER)}toRawGalleryMcpServerResult(n){for(let r of this.galleryMcpServerDataSerializers){let s=r.toRawGalleryMcpServerResult(n);if(s)return s}}toRawGalleryMcpServer(n){for(let r of this.galleryMcpServerDataSerializers){let s=r.toRawGalleryMcpServer(n);if(s)return s}}}t.SERIALIZER=new i})(oRi||={});var Brn=50,Hrn={pageSize:Brn},nRi=class a{constructor(i=Hrn){this.state=i}get pageSize(){return this.state.pageSize}get searchText(){return this.state.searchText}get cursor(){return this.state.cursor}withPage(i,e=this.pageSize){return new a({...this.state,pageSize:e,cursor:i})}withSearchText(i){return new a({...this.state,searchText:i})}},qAe=class extends k{constructor(e,t,o,n){super();this.requestService=e;this.fileService=t;this.logService=o;this.mcpGalleryManifestService=n;this.galleryMcpServerDataSerializers=new Map,this.galleryMcpServerDataSerializers.set(oRi.VERSION,oRi.SERIALIZER),this.galleryMcpServerDataSerializers.set(Czt.VERSION,Czt.SERIALIZER)}isEnabled(){return this.mcpGalleryManifestService.mcpGalleryManifestStatus==="available"}async query(e,t=Ie.None){let o=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(!o)return{firstPage:{items:[],hasMore:!1},getNextPage:async()=>({items:[],hasMore:!1})};let n=new nRi;e?.text&&(n=n.withSearchText(e.text.trim()));let{servers:r,metadata:s}=await this.queryGalleryMcpServers(n,o,t),l=s.nextCursor;return{firstPage:{items:r,hasMore:!!s.nextCursor},getNextPage:async c=>{if(c.isCancellationRequested)throw new qi;if(!l)return{items:[],hasMore:!1};let{servers:u,metadata:p}=await this.queryGalleryMcpServers(n.withPage(l).withSearchText(void 0),o,c);return l=p.nextCursor,{items:u,hasMore:!!p.nextCursor}}}}async getMcpServersFromGallery(e){let t=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(!t)return[];let o=[];return await Promise.allSettled(e.map(async n=>{let r=await this.getMcpServerByName(n,t);r&&o.push(r)})),o}async getMcpServerByName({name:e,id:t},o){let n=this.getLatestServerVersionUrl(e,o);if(n){let l=await this.getMcpServer(n);if(l)return l}let r=this.getNamedServerUrl(e,o);if(r){let l=await this.getMcpServer(r);if(l)return l}let s=t?this.getServerIdUrl(t,o):void 0;if(s){let l=await this.getMcpServer(s);if(l)return l}}async getReadme(e,t){let o=e.readmeUrl;if(!o)return Promise.resolve(d(2420,null));let n=A.parse(o);if(n.scheme===Q.file)try{return(await this.fileService.readFile(n)).value.toString()}catch(l){this.logService.error(`Failed to read file from ${n}: ${l}`)}if(n.authority!=="raw.githubusercontent.com")return new he(d(2421,null,o)).value;let r=await this.requestService.request({type:"GET",url:o,callSite:"mcpGalleryService.getReadme"},t),s=await jD(r);if(!s)throw new Error(`Failed to fetch README from ${o}`);return s}toGalleryMcpServer(e,t){let o="",n=e.title;if(e.githubInfo?.name)n||(n=e.githubInfo.name.split("-").map(c=>c.toLowerCase()==="mcp"?"MCP":c.toLowerCase()==="github"?"GitHub":Ale(c)).join(" ")),o=e.githubInfo.nameWithOwner.split("/")[0];else{let c=e.name.split("/");if(c.length>0){let u=c[0].split(".");u.length>0&&(o=u[u.length-1])}n||(n=c[c.length-1].split("-").map(u=>Ale(u)).join(" "))}e.githubInfo?.displayName&&(n=e.githubInfo.displayName);let r;if(e.githubInfo?.preferredImage)r={light:e.githubInfo.preferredImage,dark:e.githubInfo.preferredImage};else if(e.githubInfo?.ownerAvatarUrl)r={light:e.githubInfo.ownerAvatarUrl,dark:e.githubInfo.ownerAvatarUrl};else if(e.apicInfo?.["x-ms-icon"])r={light:e.apicInfo["x-ms-icon"],dark:e.apicInfo["x-ms-icon"]};else if(e.icons&&e.icons.length>0){let c=e.icons.find(p=>p.theme==="light")??e.icons[0],u=e.icons.find(p=>p.theme==="dark")??c;r={light:c.src,dark:u.src}}let s=t?this.getWebUrl(e.name,t):void 0,l=t?this.getPublisherUrl(o,t):void 0;return{id:e.id,name:e.name,displayName:n,galleryUrl:t?.url,webUrl:s,description:e.description,status:e.status??"active",version:e.version,isLatest:e.registryInfo?.isLatest??!0,publishDate:e.registryInfo?.publishedAt?Date.parse(e.registryInfo.publishedAt):void 0,lastUpdated:e.githubInfo?.pushedAt?Date.parse(e.githubInfo.pushedAt):e.registryInfo?.updatedAt?Date.parse(e.registryInfo.updatedAt):void 0,repositoryUrl:e.repository?.url,readme:e.readme,icon:r,publisher:o,publisherUrl:l,license:e.githubInfo?.license,starsCount:e.githubInfo?.stargazerCount,topics:e.githubInfo?.topics,configuration:{packages:e.packages,remotes:e.remotes}}}async queryGalleryMcpServers(e,t,o){let{servers:n,metadata:r}=await this.queryRawGalleryMcpServers(e,t,o);return{servers:n.map(s=>this.toGalleryMcpServer(s,t)),metadata:r}}async queryRawGalleryMcpServers(e,t,o){let n=this.getMcpGalleryUrl(t);if(!n)return{servers:[],metadata:{count:0}};let r=A.parse(n);if(r.scheme===Q.file)try{let h=(await this.fileService.readFile(r)).value.toString();return JSON.parse(h)}catch(p){this.logService.error(`Failed to read file from ${r}: ${p}`)}let s=`${n}?limit=${e.pageSize}&version=latest`;if(e.cursor&&(s+=`&cursor=${e.cursor}`),e.searchText){let p=encodeURIComponent(e.searchText);s+=`&search=${p}`}let l;try{l=await this.requestService.request({type:"GET",url:s,callSite:"mcpGalleryService.queryMcpServers"},o)}catch(p){if(Yi(p))throw p;return this.logService.error(`Failed to query MCP gallery: ${p}`),{servers:[],metadata:{count:0}}}let c=await Th(l);if(!c)return{servers:[],metadata:{count:0}};let u=this.serializeMcpServersResult(c,t);if(!u)throw new Error(`Failed to serialize MCP servers result from ${n}`,c);return u}async getMcpServer(e,t){let o=await this.requestService.request({type:"GET",url:e,callSite:"mcpGalleryService.getMcpServer"},Ie.None);if(o.res.statusCode&&o.res.statusCode>=400&&o.res.statusCode<500)return;let n=await Th(o);if(!n)return;t||(t=await this.mcpGalleryManifestService.getMcpGalleryManifest()),t=t&&e.startsWith(t.url)?t:null;let r=this.serializeMcpServer(n,t);if(!r)throw new Error(`Failed to serialize MCP server from ${e}`,n);return this.toGalleryMcpServer(r,t)}serializeMcpServer(e,t){return this.getSerializer(t)?.toRawGalleryMcpServer(e)}serializeMcpServersResult(e,t){return this.getSerializer(t)?.toRawGalleryMcpServerResult(e)}getSerializer(e){let t=e?.version??"v0";return this.galleryMcpServerDataSerializers.get(t)}getNamedServerUrl(e,t){let o=J3(t,"McpServerNamedResourceUriTemplate");if(o)return rD(o,{name:e})}getServerIdUrl(e,t){let o=J3(t,"McpServerIdUriTemplate");if(o)return rD(o,{id:e})}getLatestServerVersionUrl(e,t){let o=J3(t,"McpServerLatestVersionUriTemplate");if(o)return rD(o,{name:encodeURIComponent(e)})}getWebUrl(e,t){let o=J3(t,"McpServerWebUriTemplate");if(o)return rD(o,{name:e})}getPublisherUrl(e,t){let o=J3(t,"PublisherUriTemplate");if(o)return rD(o,{name:e})}getMcpGalleryUrl(e){return J3(e,"McpServersQueryService")}};qAe=I([m(0,Ra),m(1,ge),m(2,re),m(3,KH)],qAe);var $Ae=class extends k{constructor(e){super();this.configurationService=e;this._onDidChangeAllowedMcpServers=this._register(new T);this.onDidChangeAllowedMcpServers=this._onDidChangeAllowedMcpServers.event;this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(sy)&&this._onDidChangeAllowedMcpServers.fire()}))}isAllowed(e){if(this.configurationService.getValue(sy)!=="none")return!0;let t=nc("workbench.action.openSettings",{query:`@id:${sy}`}).toString();return new he(d(2419,null,t))}};$Ae=I([m(0,B)],$Ae);var Sge="workbench.actions.accounts.signIn";var Urn=new Y("defaultAccountStatus","uninitialized"),xzt="defaultAccount.cachedPolicyData",sRi=3600*1e3;function _bo(a){return{preferredExtensions:[a.chatExtensionId,a.extensionId],authenticationProvider:{default:{id:a.provider.default.id,name:a.provider.default.name},enterprise:{id:a.provider.enterprise.id,name:a.provider.enterprise.name},enterpriseProviderConfig:`${a.completionsAdvancedSetting}.authProvider`,enterpriseProviderUriSetting:a.providerUriSetting,scopes:a.providerScopes},entitlementUrl:a.entitlementUrl,tokenEntitlementUrl:a.tokenEntitlementUrl,mcpRegistryDataUrl:a.mcpRegistryDataUrl}}var QAe=class extends k{constructor(e){super();this.defaultAccount=null;this.initBarrier=new ip;this._onDidChangeDefaultAccount=this._register(new T);this.onDidChangeDefaultAccount=this._onDidChangeDefaultAccount.event;this._onDidChangePolicyData=this._register(new T);this.onDidChangePolicyData=this._onDidChangePolicyData.event;this._onDidChangeCopilotTokenInfo=this._register(new T);this.onDidChangeCopilotTokenInfo=this._onDidChangeCopilotTokenInfo.event;this.defaultAccountProvider=null;this.defaultAccountConfig=_bo(e.defaultChatAgent)}get currentDefaultAccount(){return this.defaultAccount}get policyData(){return this.defaultAccountProvider?.policyData??null}get copilotTokenInfo(){return this.defaultAccountProvider?.copilotTokenInfo??null}async getDefaultAccount(){return await this.initBarrier.wait(),this.defaultAccount}getDefaultAccountAuthenticationProvider(){return this.defaultAccountProvider?this.defaultAccountProvider.getDefaultAccountAuthenticationProvider():{...this.defaultAccountConfig.authenticationProvider.default,enterprise:!1}}setDefaultAccountProvider(e){if(this.defaultAccountProvider)throw new Error("Default account provider is already set");this.defaultAccountProvider=e,this.defaultAccountProvider.policyData&&this._onDidChangePolicyData.fire(this.defaultAccountProvider.policyData),e.refresh().then(t=>{this.defaultAccount=t}).finally(()=>{this.initBarrier.open(),this._register(e.onDidChangeDefaultAccount(t=>this.setDefaultAccount(t))),this._register(e.onDidChangePolicyData(t=>this._onDidChangePolicyData.fire(t))),this._register(e.onDidChangeCopilotTokenInfo(t=>this._onDidChangeCopilotTokenInfo.fire(t)))})}async refresh(e){await this.initBarrier.wait();let t=await this.defaultAccountProvider?.refresh(e);return this.setDefaultAccount(t??null),this.defaultAccount}async signIn(e){return await this.initBarrier.wait(),this.defaultAccountProvider?.signIn(e)??null}async signOut(){await this.initBarrier.wait(),await this.defaultAccountProvider?.signOut()}resolveGitHubUrl(e){return this.defaultAccountProvider?this.defaultAccountProvider.resolveGitHubUrl(e):`https://github.com/${e}`}setDefaultAccount(e){Qi(this.defaultAccount,e)||(this.defaultAccount=e,this._onDidChangeDefaultAccount.fire(this.defaultAccount))}};QAe=I([m(0,Ze)],QAe);var zot=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.defaultAccountConfig=e;this.configurationService=t;this.authenticationService=o;this.authenticationExtensionsService=n;this.telemetryService=r;this.extensionService=s;this.requestService=l;this.logService=c;this.environmentService=u;this.storageService=h;this.hostService=g;this.commandService=f;this._defaultAccount=null;this._policyData=null;this._copilotTokenInfo=null;this._onDidChangeDefaultAccount=this._register(new T);this.onDidChangeDefaultAccount=this._onDidChangeDefaultAccount.event;this._onDidChangePolicyData=this._register(new T);this.onDidChangePolicyData=this._onDidChangePolicyData.event;this._onDidChangeCopilotTokenInfo=this._register(new T);this.onDidChangeCopilotTokenInfo=this._onDidChangeCopilotTokenInfo.event;this.initialized=!1;this.updateThrottler=this._register(new Aa(100));this.accountDataPollScheduler=this._register(new Dt(()=>this.refetchDefaultAccount(),sRi));this.accountStatusContext=Urn.bindTo(p);let v=this.getCachedAccountData();this._policyData=v?.accountPolicyData??null,this._copilotTokenInfo=v?.copilotTokenInfo??null,this.initPromise=this.init().finally(()=>{this.telemetryService.publicLog2("defaultaccount:status",{status:this.defaultAccount?"available":"unavailable",initial:!0}),this.initialized=!0})}get defaultAccount(){return this._defaultAccount?.defaultAccount??null}get policyData(){return this._policyData?.policyData??null}get copilotTokenInfo(){return this._copilotTokenInfo}getCachedAccountData(){let e=this.storageService.get(xzt,-1);if(e)try{let t=JSON.parse(e),{accountId:o,policyData:n,tokenEntitlementsFetchedAt:r,mcpRegistryDataFetchedAt:s,copilotTokenInfo:l}=t;if(o&&n){this.logService.debug("[DefaultAccount] Initializing with cached policy data (migrating old format)");let p={accountPolicyData:{accountId:o,policyData:n,tokenEntitlementsFetchedAt:r,mcpRegistryDataFetchedAt:s},copilotTokenInfo:l};return this.storageService.store(xzt,JSON.stringify(p),-1,1),p}let{accountPolicyData:c,copilotTokenInfo:u}=t;if(c?.accountId&&c?.policyData)return this.logService.debug("[DefaultAccount] Initializing with cached policy data"),{accountPolicyData:c,copilotTokenInfo:u}}catch(t){this.logService.error("[DefaultAccount] Failed to parse cached policy data",Dn(t))}return null}async init(){if(Ft&&!this.environmentService.remoteAuthority&&!this.environmentService.isSessionsWindow){this.logService.debug("[DefaultAccount] Running in web without remote, skipping initialization");return}try{await this.extensionService.whenInstalledExtensionsRegistered(),this.logService.debug("[DefaultAccount] Installed extensions registered.")}catch(e){this.logService.error("[DefaultAccount] Error while waiting for installed extensions to be registered",Dn(e))}this.logService.debug("[DefaultAccount] Starting initialization"),await this.doUpdateDefaultAccount(),this.logService.debug("[DefaultAccount] Initialization complete"),this._register(this.onDidChangeDefaultAccount(e=>{this.telemetryService.publicLog2("defaultaccount:status",{status:e?"available":"unavailable",initial:!1})})),this._register(this.authenticationService.onDidChangeSessions(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.providerId===t.id&&(this.defaultAccount&&e.event.removed?.some(o=>o.id===this.defaultAccount?.sessionId)?this.setDefaultAccount(null):(this.logService.debug("[DefaultAccount] Sessions changed for default account provider, updating default account"),this.updateDefaultAccount()))})),this._register(this.authenticationExtensionsService.onDidChangeAccountPreference(async e=>{let t=this.getDefaultAccountAuthenticationProvider();e.providerId===t.id&&(this.logService.debug("[DefaultAccount] Account preference changed for default account provider, updating default account"),this.updateDefaultAccount())})),this._register(this.authenticationService.onDidRegisterAuthenticationProvider(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.id===t.id&&(this.logService.debug("[DefaultAccount] Default account provider registered, updating default account"),this.updateDefaultAccount())})),this._register(this.authenticationService.onDidUnregisterAuthenticationProvider(e=>{let t=this.getDefaultAccountAuthenticationProvider();e.id===t.id&&(this.logService.debug("[DefaultAccount] Default account provider unregistered, updating default account"),this.updateDefaultAccount())})),this._register(this.hostService.onDidChangeFocus(e=>{e&&this.refetchDefaultAccount()}))}async refresh(e){return this.initialized?(this.logService.debug("[DefaultAccount] Refreshing default account"),await this.updateDefaultAccount(e),this.defaultAccount):(await this.initPromise,this.defaultAccount)}async refetchDefaultAccount(){if(this.accountDataPollScheduler.isScheduled()&&this.accountDataPollScheduler.cancel(),!this.hostService.hasFocus||!this._defaultAccount){this.scheduleAccountDataPoll(),this.logService.debug("[DefaultAccount] Skipping refetching default account. Host is not focused or default account is not set");return}this.logService.debug("[DefaultAccount] Refetching default account"),await this.updateDefaultAccount()}async updateDefaultAccount(e){await this.updateThrottler.trigger(()=>this.doUpdateDefaultAccount(e))}async doUpdateDefaultAccount(e){try{let t=await this.fetchDefaultAccount(e);this.setDefaultAccount(t),this.scheduleAccountDataPoll()}catch(t){this.logService.error("[DefaultAccount] Error while updating default account",Dn(t))}}async fetchDefaultAccount(e){let t=this.getDefaultAccountAuthenticationProvider();return this.logService.debug("[DefaultAccount] Default account provider ID:",t.id),this.authenticationService.declaredProviders.find(n=>n.id===t.id)?await this.getDefaultAccountForAuthenticationProvider(t,e):(this.logService.info("[DefaultAccount] Authentication provider is not declared.",t),null)}setDefaultAccount(e){Qi(this._defaultAccount,e)||(this.logService.trace("[DefaultAccount] Updating default account:",e),e?(this._defaultAccount=e,this.setCopilotTokenInfo(e.copilotTokenInfo),this.setPolicyData(e.policyData),this._onDidChangeDefaultAccount.fire(this._defaultAccount.defaultAccount),this.accountStatusContext.set("available"),this.logService.debug("[DefaultAccount] Account status set to Available")):(this._defaultAccount=null,this.setPolicyData(null),this.setCopilotTokenInfo(null),this._onDidChangeDefaultAccount.fire(null),this.accountDataPollScheduler.cancel(),this.accountStatusContext.set("unavailable"),this.logService.debug("[DefaultAccount] Account status set to Unavailable")))}setPolicyData(e){Qi(this._policyData,e)||(this._policyData=e,this.cachePolicyData(e),this._onDidChangePolicyData.fire(this._policyData?.policyData??null))}setCopilotTokenInfo(e){Qi(this._copilotTokenInfo,e)||(this._copilotTokenInfo=e,this._onDidChangeCopilotTokenInfo.fire(this._copilotTokenInfo))}cachePolicyData(e){if(e){this.logService.debug("[DefaultAccount] Caching policy data for account:",e.accountId);let t={accountPolicyData:e,copilotTokenInfo:this._copilotTokenInfo??void 0};this.storageService.store(xzt,JSON.stringify(t),-1,1)}else this.logService.debug("[DefaultAccount] Removing cached policy data"),this.storageService.remove(xzt,-1)}scheduleAccountDataPoll(){this._defaultAccount&&this.accountDataPollScheduler.schedule(sRi)}extractFromToken(e){let t=new Map,n=e?.split(":")[0]?.split(";");for(let r of n){let[s,l]=r.split("=");t.set(s,l)}return this.logService.debug(`[DefaultAccount] extractFromToken: ${JSON.stringify(Object.fromEntries(t))}`),t}async getDefaultAccountForAuthenticationProvider(e,t){try{this.logService.debug("[DefaultAccount] Getting Default Account from authenticated sessions for provider:",e.id);let o=await this.findMatchingProviderSession(e.id,this.defaultAccountConfig.authenticationProvider.scopes);return o?.length?this.getDefaultAccountFromAuthenticatedSessions(e,o,t):(this.logService.debug("[DefaultAccount] No matching session found for provider:",e.id),null)}catch(o){return this.logService.error("[DefaultAccount] Failed to get default account for provider:",e.id,Dn(o)),null}}async getDefaultAccountFromAuthenticatedSessions(e,t,o){try{let n=t[0].account.id,r=this._policyData?.accountId===n?this._policyData:void 0,s=await this.getEntitlements(t,r,o),l=s?.data,c=s?.fetchedAt,u=l?.chat_enabled?await this.getTokenEntitlements(t,r,o):void 0,p=u?.fetchedAt,h,g=r?.policyData?{...r.policyData}:void 0;if(u?.data){let b=u.data;if(g=g??{},g.chat_agent_enabled=b.policyData.chat_agent_enabled,g.chat_preview_features_enabled=b.policyData.chat_preview_features_enabled,g.cloud_session_storage_enabled=b.policyData.cloud_session_storage_enabled,g.mcp=b.policyData.mcp,g.mcp){let S=await this.getMcpRegistryProvider(t,r,o);h=S?.fetchedAt,g.mcpRegistryUrl=S?.data?.url,g.mcpAccess=S?.data?.registry_access}else g.mcpRegistryUrl=void 0,g.mcpAccess=void 0}let f={authenticationProvider:e,accountName:t[0].account.label,sessionId:t[0].id,enterprise:e.enterprise||t[0].account.label.includes("_"),entitlementsData:l};return this.logService.debug("[DefaultAccount] Successfully created default account for provider:",e.id),{defaultAccount:f,accountId:n,policyData:g||c?{accountId:n,policyData:g??{},entitlementsFetchedAt:c,tokenEntitlementsFetchedAt:p,mcpRegistryDataFetchedAt:h}:null,copilotTokenInfo:u?.data?.copilotTokenInfo??null}}catch(n){return this.logService.error("[DefaultAccount] Failed to create default account for provider:",e.id,Dn(n)),null}}async findMatchingProviderSession(e,t){let o=await this.getSessions(e),n=[];for(let r of o){this.logService.debug("[DefaultAccount] Checking session with scopes",r.scopes);for(let s of t)this.scopesMatch(r.scopes,s)&&n.push(r)}return n.length>0?n:void 0}async getSessions(e){for(let t=1;t<=3;t++)try{let o,n;for(let r of this.defaultAccountConfig.preferredExtensions)if(n=this.authenticationExtensionsService.getAccountPreference(r,e),n)break;for(let r of await this.authenticationService.getAccounts(e))if(r.label===n){o=r;break}return await this.authenticationService.getSessions(e,void 0,{account:o},!0)}catch(o){if(this.logService.warn(`[DefaultAccount] Attempt ${t} to get sessions failed:`,Dn(o)),t===3)throw o;await Li(500)}throw new Error("Unable to get sessions after multiple attempts")}scopesMatch(e,t){return t.every(o=>e.includes(o))}async getTokenEntitlements(e,t,o){return!o?.forceRefresh&&t?.tokenEntitlementsFetchedAt&&!this.isDataStale(t.tokenEntitlementsFetchedAt)?(this.logService.debug("[DefaultAccount] Using last fetched token entitlements data"),{data:{policyData:t.policyData,copilotTokenInfo:this._copilotTokenInfo??{}},fetchedAt:t.tokenEntitlementsFetchedAt}):{data:await this.requestTokenEntitlements(e),fetchedAt:Date.now()}}async requestTokenEntitlements(e){let t=this.getTokenEntitlementUrl();if(!t){this.logService.debug("[DefaultAccount] No token entitlements URL found");return}this.logService.debug("[DefaultAccount] Fetching token entitlements from:",t);let o=await this.request(t,"GET",void 0,e,Ie.None,"defaultAccount.tokenEntitlements");if(o){if(o.res.statusCode&&o.res.statusCode!==200){this.logService.trace(`[DefaultAccount] unexpected status code ${o.res.statusCode} while fetching token entitlements`);return}try{let n=await Th(o);if(n){let r=this.extractFromToken(n.token);return{policyData:{chat_preview_features_enabled:r.get("editor_preview_features")!=="0",chat_agent_enabled:r.get("agent_mode")!=="0",mcp:r.get("mcp")==="1",cloud_session_storage_enabled:r.has("cloud_session_storage_enabled")?r.get("cloud_session_storage_enabled")==="1":void 0},copilotTokenInfo:{sn:r.get("sn"),fcv1:r.get("fcv1")}}}this.logService.error("Failed to fetch token entitlements","No data returned")}catch(n){this.logService.error("Failed to fetch token entitlements",Dn(n))}}}async getEntitlements(e,t,o){let n=e[0].account.id,r=this._defaultAccount?.accountId===n?this._defaultAccount?.defaultAccount.entitlementsData:void 0;if(!o?.forceRefresh&&r&&t?.entitlementsFetchedAt&&!this.isDataStale(t.entitlementsFetchedAt))return this.logService.debug("[DefaultAccount] Using last fetched entitlements data"),{data:r,fetchedAt:t.entitlementsFetchedAt};let s=this.getEntitlementUrl();if(!s)return this.logService.debug("[DefaultAccount] No chat entitlements URL found"),{data:void 0,fetchedAt:void 0};this.logService.debug("[DefaultAccount] Fetching entitlements from:",s);let l=await this.request(s,"GET",void 0,e,Ie.None,"defaultAccount.entitlements");if(!l)return{data:void 0,fetchedAt:Date.now()};if(l.res.statusCode&&l.res.statusCode!==200)return this.logService.trace(`[DefaultAccount] unexpected status code ${l.res.statusCode} while fetching entitlements`),{data:l.res.statusCode===401||l.res.statusCode===404?null:void 0,fetchedAt:Date.now()};try{let c=await Th(l);if(c)return{data:c,fetchedAt:Date.now()};this.logService.error("[DefaultAccount] Failed to fetch entitlements","No data returned")}catch(c){this.logService.error("[DefaultAccount] Failed to fetch entitlements",Dn(c))}return{data:void 0,fetchedAt:Date.now()}}async getMcpRegistryProvider(e,t,o){if(!o?.forceRefresh&&t?.mcpRegistryDataFetchedAt&&!this.isDataStale(t.mcpRegistryDataFetchedAt))return this.logService.debug("[DefaultAccount] Using last fetched MCP registry data"),{data:t.policyData.mcpRegistryUrl&&t.policyData.mcpAccess?{url:t.policyData.mcpRegistryUrl,registry_access:t.policyData.mcpAccess}:null,fetchedAt:t.mcpRegistryDataFetchedAt};let n=await this.requestMcpRegistryProvider(e);return bn(n)?void 0:{data:n,fetchedAt:Date.now()}}async requestMcpRegistryProvider(e){let t=this.getMcpRegistryDataUrl();if(!t)return this.logService.debug("[DefaultAccount] No MCP registry data URL found"),null;this.logService.debug("[DefaultAccount] Fetching MCP registry data from:",t);let o=await this.request(t,"GET",void 0,e,Ie.None,"defaultAccount.mcpRegistryProvider");if(o){if(!pE(o)){if(Cpe(o))return this.logService.debug(`[DefaultAccount] Received ${o.res.statusCode} for MCP registry data, treating as no registry available.`),null;this.logService.debug(`[DefaultAccount] unexpected status code ${o.res.statusCode} while fetching MCP registry data`);return}try{let n=await Th(o);return n?(this.logService.debug("Fetched MCP registry providers",n.mcp_registries),n.mcp_registries[0]??null):(this.logService.debug("No MCP registry providers content found in response"),null)}catch(n){this.logService.error("Failed to fetch MCP registry providers",Dn(n));return}}}async request(e,t,o,n,r,s){let l;for(let c of n){if(r.isCancellationRequested)return l;try{let u=await this.requestService.request({type:t,url:e,data:t==="POST"?JSON.stringify(o):void 0,disableCache:!0,headers:{Authorization:`Bearer ${c.accessToken}`},callSite:s},r),p=u.res.statusCode;if(p===401||p===404){this.logService.debug(`[DefaultAccount] Received ${p} for URL ${e} with session ${c.id}, likely due to expired/revoked token or insufficient permissions.`,"Trying next session if available."),l=u;continue}return u}catch(u){r.isCancellationRequested||this.logService.error(`[DefaultAccount] request: error ${u}`,e)}}if(!l){this.logService.trace("[DefaultAccount]: No response received for request",e);return}return l}isDataStale(e){return Date.now()-e>=sRi}getEntitlementUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot_internal/user`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.entitlementUrl}getTokenEntitlementUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot_internal/v2/token`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.tokenEntitlementUrl}getMcpRegistryDataUrl(){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let e=this.getEnterpriseUrl();return e?`${e.protocol}//api.${e.hostname}${e.port?":"+e.port:""}/copilot/mcp_registry`:void 0}catch(e){this.logService.error(e)}return this.defaultAccountConfig.mcpRegistryDataUrl}getDefaultAccountAuthenticationProvider(){return this.configurationService.getValue(this.defaultAccountConfig.authenticationProvider.enterpriseProviderConfig)===this.defaultAccountConfig.authenticationProvider.enterprise.id?{...this.defaultAccountConfig.authenticationProvider.enterprise,enterprise:!0}:{...this.defaultAccountConfig.authenticationProvider.default,enterprise:!1}}resolveGitHubUrl(e){if(this.getDefaultAccountAuthenticationProvider().enterprise)try{let t=this.getEnterpriseUrl();if(t)return`${t.protocol}//${t.host}/${e}`}catch{}return`https://github.com/${e}`}getEnterpriseUrl(){let e=this.configurationService.getValue(this.defaultAccountConfig.authenticationProvider.enterpriseProviderUriSetting);if(We(e))return new URL(e)}async signIn(e){let t=this.getDefaultAccountAuthenticationProvider();if(!t)throw new Error("No default account provider configured");let{additionalScopes:o,...n}=e??{},r=this.defaultAccountConfig.authenticationProvider.scopes[0],s=o?jo([...r,...o]):r,l=await this.authenticationService.createSession(t.id,s,n);for(let c of this.defaultAccountConfig.preferredExtensions)this.authenticationExtensionsService.updateAccountPreference(c,t.id,l.account);return await this.updateDefaultAccount(),this.defaultAccount}async signOut(){this.defaultAccount&&await this.commandService.executeCommand("_signOutOfAccount",{providerId:this.defaultAccount.authenticationProvider.id,accountLabel:this.defaultAccount.accountName})}};zot=I([m(1,B),m(2,ks),m(3,xZ),m(4,_e),m(5,lt),m(6,Ra),m(7,re),m(8,Mt),m(9,X),m(10,de),m(11,ti),m(12,fe)],zot);var YAe=class extends k{static{this.ID="workbench.contributions.defaultAccountProvider"}constructor(i,e,t){super();let o=this._register(e.createInstance(zot,_bo(i.defaultChatAgent)));t.setDefaultAccountProvider(o)}};YAe=I([m(0,Ze),m(1,F),m(2,Nd)],YAe);W(class extends z{constructor(){super({id:Sge,title:P(18523,"Sign In")})}async run(a){await a.get(Nd).signIn()}});bt(YAe.ID,YAe,vt.BlockStartup);var Dbo="accountPolicy.gateNotificationDismissed",Ige=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.gateService=e;this.chatEntitlementService=o;this.defaultAccountService=n;this.logService=r;this.notificationService=s;this.commandService=l;this.openerService=c;this.storageService=u;this.telemetryService=p;this.notificationHandle=this._register(new ue);this.initialised=!1;this.contextKey=sPt.bindTo(t),this.lastInfo=this.gateService.gateInfo,this.apply(this.lastInfo,!0,!1),this._register(this.gateService.onDidChangeGateInfo(h=>{this.initialised=!0,this.apply(h,!1,!0)})),this._register(Zo(()=>{this.initialised||(this.initialised=!0,this.apply(this.lastInfo,!1,!0))},5e3))}static{this.ID="workbench.contrib.accountPolicyGate"}apply(e,t,o){let n=t||e.state!==this.lastInfo.state||e.reason!==this.lastInfo.reason;this.lastInfo=e;let r=e.state==="restricted"&&e.reason!=="policyNotResolved";if(this.contextKey.set(r),this.chatEntitlementService.setForceHidden(r),this.logService.info(`[AccountPolicyGate] apply: state=${e.state}, reason=${e.reason}, isRestricted=${r}`),n&&this.telemetryService.publicLog2("accountPolicy.gateState",{gateActive:e.state!=="inactive",gateSatisfied:e.state==="satisfied",reasonNotSatisfied:e.reason}),e.state!=="restricted"){this.notificationHandle.clear(),this.dismissedKey=void 0,this.storageService.remove(Dbo,-1);return}if(!o||e.reason==="policyNotResolved")return;let s=this.defaultAccountService.currentDefaultAccount?.accountName,l=`${e.reason??""}:${s??""}`;this.dismissedKey!==void 0&&this.dismissedKey!==l&&(this.notificationHandle.clear(),this.dismissedKey=void 0),this.maybeShowNotification(e,l)}maybeShowNotification(e,t){if(this.notificationHandle.value||this.dismissedKey===t||this.storageService.get(Dbo,-1)===t)return;let n=this.defaultAccountService.currentDefaultAccount?.accountName,r=e.approvedOrganizations??[],s=r.length>0&&!r.includes("*"),l=r.join(", "),c;n&&s?c=d(19173,null,l,n):n?c=d(19174,null,n):s?c=d(19177,null,l):c=d(19175,null);let u=new O,p=this.notificationService.prompt(ft.Warning,c,[{label:d(19176,null),run:()=>this.commandService.executeCommand(Sge)},{label:d(19172,null),run:()=>this.openerService.open(A.parse("https://code.visualstudio.com/docs/enterprise/overview"))}],{sticky:!0});u.add(p.onDidClose(()=>{this.dismissedKey=t,this.notificationHandle.clear()})),u.add({dispose:()=>p.close()}),this.notificationHandle.value=u}};Ige=I([m(0,j_e),m(1,X),m(2,dr),m(3,Nd),m(4,re),m(5,Ne),m(6,fe),m(7,Je),m(8,de),m(9,_e)],Ige);bt(Ige.ID,Ige,vt.AfterRestored);var Rbo;(i=>{function a(e,t){return e.callstack<t.callstack?-1:e.callstack>t.callstack?1:0}i.compare=a})(Rbo||={});function zrn(a){if(!a||typeof a!="object")return{callstack:void 0,msg:gF(a)};let i=Array.isArray(a.stack)?a.stack.join(`
`):a.stack,e=a.message?a.message:gF(a);return{callstack:i,msg:e}}var Kot=class a{constructor(i,e=a.ERROR_FLUSH_TIMEOUT){this._flushHandle=void 0;this._buffer=[];this._disposables=new O;this._telemetryService=i,this._flushDelay=e;let t=J7.addListener(o=>this._onErrorEvent(o));this._disposables.add(ee(t)),this.installErrorListeners()}static{this.ERROR_FLUSH_TIMEOUT=5*1e3}dispose(){clearTimeout(this._flushHandle),this._flushBuffer(),this._disposables.dispose()}installErrorListeners(){}_onErrorEvent(i){if(!i||i.code||(i.detail&&i.detail.stack&&(i=i.detail),ka.isErrorNoTelemetry(i)||i instanceof ua||pvt.is(i)||typeof i?.message=="string"&&i.message.includes("Unable to read file")))return;let{callstack:e,msg:t}=zrn(i);if(!e)return;let o={msg:t,callstack:e};Jye.is(i)&&(o.kind=i.kind,o.listenerCount=i.listenerCount),this._enqueue(o)}_enqueue(i){let e=Ek(this._buffer,i,Rbo.compare);e<0?(i.count=1,this._buffer.splice(~e,0,i)):(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 i of this._buffer)this._telemetryService.publicLogError2("UnhandledError",i);this._buffer.length=0}};var Got=class extends Kot{installErrorListeners(){let i,e=this;typeof ut.onerror=="function"&&(i=ut.onerror),ut.onerror=function(t,o,n,r,s){e._onUncaughtError(t,o,n,r,s),i?.apply(this,[t,o,n,r,s])},this._disposables.add(ee(()=>{i&&(ut.onerror=i)}))}_onUncaughtError(i,e,t,o,n){let r={callstack:i,msg:i,file:e,line:t,column:o};if(n){if(ka.isErrorNoTelemetry(n))return;let{name:l,message:c,stack:u}=n;r.uncaught_error_name=l,c&&(r.uncaught_error_msg=c),u&&(r.callstack=Array.isArray(n.stack)?n.stack=n.stack.join(`
`):n.stack)}let s=wQi(i);s&&(r.msg=s,r.callstack=s),this._enqueue(r)}};var fie=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.telemetryService=e;this.contextService=t;this.userDataProfileService=c;this.loggerService=h;this.outputService=g;let{filesToOpenOrCreate:v,filesToDiff:b,filesToMerge:S}=l,y=u.getActivePaneComposite(0);e.publicLog2("workspaceLoad",{windowSize:{innerHeight:ut.innerHeight,innerWidth:ut.innerWidth,outerHeight:ut.outerHeight,outerWidth:ut.outerWidth},emptyWorkbench:t.getWorkbenchState()===1,"workbench.filesToOpenOrCreate":v&&v.length||0,"workbench.filesToDiff":b&&b.length||0,"workbench.filesToMerge":S&&S.length||0,customKeybindingsCount:r.customKeybindingsCount(),theme:s.getColorTheme().id,language:Kr,pinnedViewlets:u.getPinnedPaneCompositeIds(0),restoredViewlet:y?y.getId():void 0,restoredEditors:n.visibleEditors.length,startupKind:o.startupKind}),this._register(new Got(e)),this._register(f.files.onDidResolve(w=>this.onTextFileModelResolved(w))),this._register(f.files.onDidSave(w=>this.onTextFileModelSaved(w))),this._register(o.onDidShutdown(()=>this.dispose())),EM(p,l)&&this.handleTelemetryOutputVisibility()}static{this.ALLOWLIST_JSON=["package.json","package-lock.json","tsconfig.json","jsconfig.json","bower.json",".eslintrc.json","tslint.json","composer.json"]}static{this.ALLOWLIST_WORKSPACE_JSON=["settings.json","extensions.json","tasks.json","launch.json"]}onTextFileModelResolved(e){this.getTypeIfSettings(e.model.resource)||this.telemetryService.publicLog2("fileGet",this.getTelemetryData(e.model.resource,e.reason))}onTextFileModelSaved(e){this.getTypeIfSettings(e.model.resource)||this.telemetryService.publicLog2("filePUT",this.getTelemetryData(e.model.resource,e.reason))}getTypeIfSettings(e){if(Ts(e)!==".json")return"";if(ze(e,this.userDataProfileService.currentProfile.settingsResource))return"global-settings";if(ze(e,this.userDataProfileService.currentProfile.keybindingsResource))return"keybindings";if(Yr(e,this.userDataProfileService.currentProfile.snippetsHome))return"snippets";let t=this.contextService.getWorkspace().folders;for(let o of t)if(Yr(e,o.toResource(".vscode"))){let n=Be(e);if(fie.ALLOWLIST_WORKSPACE_JSON.indexOf(n)>-1)return`.vscode/${n}`}return""}getTelemetryData(e,t){let o=Ts(e),n=o.indexOf("?");o=n!==-1?o.substr(0,n):o;let r=Be(e),s=e.scheme===Q.file?e.fsPath:e.path,l={mimeType:new lh(aLe(e).join(", ")),ext:o,path:Lr(s),reason:t,allowlistedjson:void 0};return o===".json"&&fie.ALLOWLIST_JSON.indexOf(r)>-1&&(l.allowlistedjson=r),l}async handleTelemetryOutputVisibility(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.action.showTelemetry",title:P(15912,"Show Telemetry"),category:Fe.Developer,f1:!0})}async run(){for(let o of e.loggerService.getRegisteredLoggers())o.group?.id===zRt.id&&(e.loggerService.setLogLevel(o.resource,1),e.loggerService.setVisibility(o.resource,!0));e.outputService.showChannel(zRt.id)}})),[...this.loggerService.getRegisteredLoggers()].find(o=>o.id===Zue)||await U.toPromise(U.filter(this.loggerService.onDidChangeLoggers,o=>[...o.added].some(n=>n.id===Zue)));let t=!1;for(let o of this.loggerService.getRegisteredLoggers())if(o.id===Zue){t=this.loggerService.getLogLevel()===1||!o.hidden,t&&this.loggerService.setVisibility(o.id,!0);break}if(t){let o=n=>{for(let r of n)r.group?.id===zRt.id&&(e.loggerService.setLogLevel(r.resource,1),this.loggerService.setVisibility(r.id,!0))};o(this.loggerService.getRegisteredLoggers()),this._register(this.loggerService.onDidChangeLoggers(n=>o(n.added)))}}};fie=I([m(0,_e),m(1,Ae),m(2,to),m(3,ie),m(4,Le),m(5,ep),m(6,Mt),m(7,gn),m(8,Es),m(9,Ze),m(10,Ol),m(11,Tl),m(12,Uo)],fie);var qot=class extends k{constructor(e,t,o){super();this.configurationService=e;this.userDataProfilesService=t;this.telemetryService=o;this.configurationRegistry=oe.as($t.Configuration);let{user:n,workspace:r}=e.keys();for(let s of n)this.reportTelemetry(s,3);for(let s of r)this.reportTelemetry(s,5)}getValueToReport(e,t){let o=this.configurationService.inspect(e),n=t===3?o.user?.value:o.workspace?.value;if(on(n)||Xa(n))return n.toString();let r=this.configurationRegistry.getConfigurationProperties()[e];if(We(n))return r?.enum?.includes(n)?n:void 0;if(Array.isArray(n)&&n.every(s=>on(s)||Xa(s)||We(s)&&r?.enum?.includes(s)))return JSON.stringify(n)}reportTelemetry(e,t){let o=HY(t);switch(e){case"workbench.activityBar.location":this.telemetryService.publicLog2("workbench.activityBar.location",{settingValue:this.getValueToReport(e,t),source:o});return;case JI:this.telemetryService.publicLog2("extensions.autoUpdate",{settingValue:this.getValueToReport(e,t),source:o});return;case"editor.stickyScroll.enabled":this.telemetryService.publicLog2("editor.stickyScroll.enabled",{settingValue:this.getValueToReport(e,t),source:o});return;case"typescript.experimental.expandableHover":this.telemetryService.publicLog2("typescript.experimental.expandableHover",{settingValue:this.getValueToReport(e,t),source:o});return;case"window.titleBarStyle":this.telemetryService.publicLog2("window.titleBarStyle",{settingValue:this.getValueToReport(e,t),source:o});return;case"workbench.secondarySideBar.defaultVisibility":this.telemetryService.publicLog2("workbench.secondarySideBar.defaultVisibility",{settingValue:this.getValueToReport(e,t),source:o});return;case JTe:this.telemetryService.publicLog2("extensions.verifySignature",{settingValue:this.getValueToReport(e,t),source:o});return;case"window.newWindowProfile":{let n=this.getValueToReport(e,t),r=n===null?"null":n===this.userDataProfilesService.defaultProfile.name?"default":"custom";this.telemetryService.publicLog2("window.newWindowProfile",{settingValue:r,source:o});return}case UH:this.telemetryService.publicLog2("extensions.autoRestart",{settingValue:this.getValueToReport(e,t),source:o});return;case Yp.OutputLocation:this.telemetryService.publicLog2("terminal.integrated.chatAgentTools.outputLocation",{settingValue:this.getValueToReport(e,t),source:o});return;case Yp.SuggestEnabled:this.telemetryService.publicLog2("terminal.integrated.suggest.enabled",{settingValue:this.getValueToReport(e,t),source:o});return;case Yp.AgentSandboxEnabled:case Yp.DeprecatedAgentSandboxEnabled:this.telemetryService.publicLog2("chat.agent.sandbox",{settingValue:this.getValueToReport(e,t),source:o});return}}};qot=I([m(0,B),m(1,hn),m(2,_e)],qot);var Lbo=oe.as(Zi.Workbench);Lbo.registerWorkbenchContribution(fie,3);Lbo.registerWorkbenchContribution(qot,4);var Ezt=le("preferencesSearchService");var Mbo=new Y("inPreferencesSearch",!1),Tzt="settings.action.clearSearchResults",Pbo="settings.action.showAIResults",_zt="settings.action.toggleAiSearch",Dzt="settings.action.showContextMenu",Abo="settings.action.suggestFilters",WR=new Y("inSettingsEditor",!1),aRi=new Y("inSettingsJSONEditor",!1),yge=new Y("inSettingsSearch",!1),Rzt=new Y("settingsTocRowFocus",!1),$ot=new Y("settingRowFocus",!1),xf=new Y("inKeybindings",!1),XAe=new Y("inKeybindingsSearch",!1),Lzt=new Y("keybindingsSearchHasValue",!1),zW=new Y("keybindingFocus",!1),wge=new Y("whenFocus",!1),Mzt=new Y("aiSettingResultsAvailable",!1),Nbo="keybindings.editor.searchKeybindings",Pzt="keybindings.editor.clearSearchResults",Obo="keybindings.editor.clearSearchHistory",Azt="keybindings.editor.recordSearchKeys",Nzt="keybindings.editor.toggleSortByPrecedence",JAe="keybindings.editor.defineKeybinding",Ozt="keybindings.editor.addKeybinding",Fzt="keybindings.editor.defineWhenExpression",Fbo="keybindings.editor.acceptWhenExpression",Wbo="keybindings.editor.rejectWhenExpression",Wzt="keybindings.editor.removeKeybinding",Vzt="keybindings.editor.resetKeybinding",Bzt="keybindings.editor.copyKeybindingEntry",Hzt="keybindings.editor.copyCommandKeybindingEntry",Uzt="keybindings.editor.copyCommandTitle",zzt="keybindings.editor.showConflicts",Vbo="keybindings.editor.focusKeybindings",Bbo="keybindings.editor.showDefaultKeybindings",Hbo="keybindings.editor.showUserKeybindings",Ubo="keybindings.editor.showExtensionKeybindings",hq="modified",ZAe="ext:",ME="feature:",jot="id:",KW="lang:",zbo="tag:",UU="hasPolicy",Cge="override:agentsWindow",fQ="workspaceTrust",eNe="requireTrustedWorkspace",vQ="advanced";var Kzt=!0,lRi=!0,cRi=1e3,Gzt="local",qzt="tfIdf",Kbo="filterModel",$zt="embeddingsFull",jzt="llmRanked";var kzt;async function Gbo(a,i,e){if(lRi&&i.isEnabled()&&!(a.sentiment.hidden||a.sentiment.disabled)){if(kzt)return kzt;if(e.extensionRecommendations){let t={};Object.keys(e.extensionRecommendations).forEach(n=>{let r=e.extensionRecommendations[n];r.onSettingsEditorOpen&&(t[n]=r)});let o={};for(let n in t){let r=n,s=e.quality==="stable";try{let l=await Uu(i.getExtensions([{id:r,preRelease:!s}],Ie.None),cRi);if(l?.length===1)o[n]=l[0];else return}catch{return}}return kzt={settingsEditorRecommendedExtensions:t,recommendedExtensionsGalleryInfo:o},kzt}}}function xge(a,i){let e=a??Number.MAX_SAFE_INTEGER,t=i??Number.MAX_SAFE_INTEGER;return e<t?-1:e>t?1:0}var Qzt=d(14427,null),Yzt=d(14426,null),qbo=d(14425,null),$bo=new Set;["css","html","scss","less","json","js","ts","ie","id","php","scm"].forEach(a=>$bo.add(a));var gq=new Map;gq.set("power shell","PowerShell");gq.set("powershell","PowerShell");gq.set("javascript","JavaScript");gq.set("typescript","TypeScript");gq.set("github","GitHub");gq.set("jet brains","JetBrains");gq.set("jetbrains","JetBrains");gq.set("re sharper","ReSharper");gq.set("resharper","ReSharper");function dRi(a){a=a.replace(/\.([a-z0-9])/g,(i,e)=>` \u203A ${e.toUpperCase()}`).replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]{1,})([A-Z][a-z])/g,"$1 $2").replace(/^[a-z]/g,i=>i.toUpperCase()).replace(/\b\w+\b/g,i=>$bo.has(i.toLowerCase())?i.toUpperCase():i);for(let[i,e]of gq)a=a.replace(new RegExp(`\\b${i}\\b`,"gi"),e);return a}var tNe=oe.as(Ta.JSONContribution),GW=class extends k{constructor(e,t){super();this.preferencesService=e;this.logService=t;this._onDidChangeFile=this._register(new T);this.onDidChangeFile=this._onDidChangeFile.event;this.capabilities=2050;this.onDidChangeCapabilities=U.None;this._register(tNe.onDidChangeSchema(o=>{this._onDidChangeFile.fire([{resource:A.parse(o),type:0}])})),this._register(tNe.onDidChangeSchemaAssociations(()=>{this._onDidChangeFile.fire([{resource:GW.SCHEMA_ASSOCIATIONS,type:0}])})),this._register(e.onDidDefaultSettingsContentChanged(o=>{this._onDidChangeFile.fire([{resource:o,type:0}])}))}static{this.SCHEMA=Q.vscode}static{this.SCHEMA_ASSOCIATIONS=A.parse(`${Q.vscode}://schemas-associations/schemas-associations.json`)}async readFile(e){if(e.scheme!==GW.SCHEMA)throw new Pj;let t;if(e.authority==="schemas"?t=this.getSchemaContent(e):e.authority===GW.SCHEMA_ASSOCIATIONS.authority?t=JSON.stringify(tNe.getSchemaAssociations()):e.authority==="defaultsettings"&&(t=this.preferencesService.getDefaultSettingsContent(e)),t)return Ke.fromString(t).buffer;throw"EntryNotFound"}async stat(e){if(tNe.hasSchemaContent(e.toString())||this.preferencesService.hasDefaultSettingsContent(e)){let t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:0}}if(ze(e,GW.SCHEMA_ASSOCIATIONS)){let t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:0}}throw"EntryNotFound"}watch(e,t){return k.None}async mkdir(e){}async readdir(e){return[]}async rename(e,t,o){}async delete(e,t){}async writeFile(){throw new Pj}getSchemaContent(e){let t=Date.now(),o=tNe.getSchemaContent(e.toString())??"{}",n=this.logService.getLevel();if(n===2||n===1){let r=Date.now(),s=JSON.stringify(tNe.getSchemaContributions().schemas[e.toString()]);this.logService.debug(`${e.toString()}: ${s.length} -> ${o.length} (${Math.round((s.length-o.length)/s.length*100)}%) Took ${r-t}ms`)}return o}};GW=I([m(0,Qo),m(1,re)],GW);var kge=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.instantiationService=t;this.preferencesService=o;this.userDataProfileService=n;this.workspaceService=r;this.configurationService=s;this.editorResolverService=l;this.textEditorService=c;this._register(this.configurationService.onDidChangeConfiguration(p=>{(p.affectsConfiguration(IZe)||p.affectsConfiguration(SZe))&&this.handleSettingsEditorRegistration()})),this.handleSettingsEditorRegistration();let u=this._register(this.instantiationService.createInstance(GW));this._register(e.registerProvider(GW.SCHEMA,u))}static{this.ID="workbench.contrib.preferences"}handleSettingsEditorRegistration(){je(this.editorOpeningListener),(this.configurationService.getValue(IZe)||this.configurationService.getValue(SZe))&&(this.editorOpeningListener=this.editorResolverService.registerEditor("**/settings.json",{id:ja.ID,label:d(14432,null),priority:"builtin"},{},{createEditorInput:({resource:e,options:t})=>{if(ze(e,this.userDataProfileService.currentProfile.settingsResource))return{editor:this.preferencesService.createSplitJsonEditorInput(3,e),options:t};let o=this.workspaceService.getWorkbenchState();if(o===2){let n=this.workspaceService.getWorkspace().folders;if(ze(e,n[0].toResource(zRe)))return{editor:this.preferencesService.createSplitJsonEditorInput(5,e),options:t}}else if(o===3){let n=this.workspaceService.getWorkspace().folders;for(let r of n)if(ze(e,r.toResource(zRe)))return{editor:this.preferencesService.createSplitJsonEditorInput(6,e),options:t}}return{editor:this.textEditorService.createTextEditor({resource:e}),options:t}}}))}dispose(){je(this.editorOpeningListener),super.dispose()}};kge=I([m(0,ge),m(1,F),m(2,Qo),m(3,gn),m(4,Ae),m(5,B),m(6,il),m(7,TE)],kge);var Krn=oe.as($t.Configuration);Krn.registerConfiguration({...jd,properties:{"workbench.settings.enableNaturalLanguageSearch":{type:"boolean",description:d(14428,null),default:!0,scope:4,tags:["usesOnlineServices"]},"workbench.settings.settingsSearchTocBehavior":{type:"string",enum:["hide","filter"],enumDescriptions:[d(14431,null),d(14430,null)],description:d(14429,null),default:"filter",scope:4}}});var jbo=Oe("settings-folder-dropdown",L.chevronDown,d(14211,null)),Qbo=Oe("settings-more-action",L.gear,d(14209,null)),Ybo=Oe("keybindings-record-keys",L.recordKeys,d(14201,null)),Xbo=Oe("keybindings-sort",L.sortPrecedence,d(14202,null)),Jbo=Oe("keybindings-edit",L.edit,d(14200,null)),Zbo=Oe("keybindings-add",L.add,d(14199,null)),Ege=Oe("settings-edit",L.edit,d(14207,null)),uRi=Oe("settings-remove",L.close,d(14210,null)),eSo=Oe("settings-discard",L.discard,d(14205,null)),iNe=Oe("preferences-clear-input",L.clearAll,d(14204,null)),tSo=Oe("preferences-ai-results",L.sparkle,d(14203,null)),iSo=Oe("preferences-filter",L.filter,d(14208,null)),bQ=Oe("preferences-open-settings",L.goToFile,d(14206,null));var Qot=class extends Ja{constructor(e,t,o,n){super(null,e);this.contextService=t;this.contextMenuService=o;this.hoverService=n;this._folderSettingCounts=new Map;let r=this.contextService.getWorkspace();this._folder=r.folders.length===1?r.folders[0]:null,this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.onWorkspaceFoldersChanged()))}get folder(){return this._folder}set folder(e){this._folder=e,this.update()}setCount(e,t){let o=this.contextService.getWorkspaceFolder(e);if(!o)throw new Error("unknown folder");let n=o.uri;this._folderSettingCounts.set(n.toString(),t),this.update()}render(e){this.element=e,this.container=e,this.labelElement=_(".action-title"),this.detailsElement=_(".action-details"),this.dropDownElement=_(".dropdown-icon.hide"+q.asCSSSelector(jbo)),this.anchorElement=_("a.action-label.folder-settings",{role:"button","aria-haspopup":"true",tabindex:"0"},this.labelElement,this.detailsElement,this.dropDownElement),this.anchorElementHover=this._register(this.hoverService.setupManagedHover(yi("mouse"),this.anchorElement,"")),this._register($(this.anchorElement,ne.MOUSE_DOWN,t=>Kt.stop(t))),this._register($(this.anchorElement,ne.CLICK,t=>this.onClick(t))),this._register($(this.container,ne.KEY_UP,t=>this.onKeyUp(t))),D(this.container,this.anchorElement),this.update()}onKeyUp(e){switch(new mi(e).keyCode){case 3:case 10:this.onClick(e);return}}onClick(e){Kt.stop(e,!0),!this.folder||this._action.checked?this.showMenu():this._action.run(this._folder)}updateEnabled(){this.update()}updateChecked(){this.update()}onWorkspaceFoldersChanged(){let e=this._folder,t=this.contextService.getWorkspace();e&&(this._folder=t.folders.filter(o=>ze(o.uri,e.uri))[0]||t.folders[0]),this._folder=this._folder?this._folder:t.folders.length===1?t.folders[0]:null,this.update(),this._action.checked&&this._action.run(this._folder)}update(){let e=0;this._folderSettingCounts.forEach(o=>e+=o);let t=this.contextService.getWorkspace();if(this._folder){this.labelElement.textContent=this._folder.name,this.anchorElementHover.update(this._folder.name);let o=this.labelWithCount(this._action.label,e);this.detailsElement.textContent=o,this.dropDownElement.classList.toggle("hide",t.folders.length===1||!this._action.checked)}else{let o=this.labelWithCount(this._action.label,e);this.labelElement.textContent=o,this.detailsElement.textContent="",this.anchorElementHover.update(this._action.label),this.dropDownElement.classList.remove("hide")}this.anchorElement.classList.toggle("checked",this._action.checked),this.container.classList.toggle("disabled",!this._action.enabled)}showMenu(){this.contextMenuService.showContextMenu({getAnchor:()=>this.container,getActions:()=>this.getDropdownMenuActions(),getActionViewItem:()=>{},onHide:()=>{this.anchorElement.blur()}})}getDropdownMenuActions(){let e=[],t=this.contextService.getWorkspace().folders;return this.contextService.getWorkbenchState()===3&&t.length>0&&e.push(...t.map((o,n)=>{let r=this._folderSettingCounts.get(o.uri.toString());return{id:"folderSettingsTarget"+n,label:this.labelWithCount(o.name,r),tooltip:this.labelWithCount(o.name,r),checked:!!this.folder&&ze(this.folder.uri,o.uri),enabled:!0,class:void 0,run:()=>this._action.run(o)}})),e}labelWithCount(e,t){return t&&(e+=` (${t})`),e}};Qot=I([m(1,Ae),m(2,Xe),m(3,ot)],Qot);var oNe=class extends ll{constructor(e,t,o,n,r,s,l){super();this.contextService=o;this.instantiationService=n;this.environmentService=r;this.labelService=s;this.languageService=l;this._settingsTarget=null;this._onDidTargetChange=this._register(new T);this.onDidTargetChange=this._onDidTargetChange.event;this.options=t??{},this.create(e),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onWorkbenchStateChanged())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.update()))}resetLabels(){let e=this.environmentService.remoteAuthority,t=e&&this.labelService.getHostLabel(Q.vscodeRemote,e);this.userLocalSettings.label=d(14233,null),this.userRemoteSettings.label=d(14234,null)+(t?` [${t}]`:""),this.workspaceSettings.label=this.contextService.getWorkspace().name||d(14235,null),this.folderSettingsAction.label=d(14231,null)}create(e){let t=D(e,_(".settings-tabs-widget"));this.settingsSwitcherBar=this._register(new oo(t,{orientation:0,focusOnlyEnabledItems:!0,ariaLabel:d(14232,null),ariaRole:"tablist",actionViewItemProvider:(r,s)=>r.id==="folderSettings"?this.folderSettings:void 0})),this.userLocalSettings=this._register(new it("userSettings","",".settings-tab",!0,()=>this.updateTarget(3))),this.userLocalSettings.tooltip=d(14233,null),this.userRemoteSettings=this._register(new it("userSettingsRemote","",".settings-tab",!0,()=>this.updateTarget(4)));let o=this.environmentService.remoteAuthority,n=o&&this.labelService.getHostLabel(Q.vscodeRemote,o);this.userRemoteSettings.tooltip=d(14234,null)+(n?` [${n}]`:""),this.workspaceSettings=this._register(new it("workspaceSettings","",".settings-tab",!1,()=>this.updateTarget(5))),this.folderSettingsAction=this._register(new it("folderSettings","",".settings-tab",!1,async r=>{this.updateTarget(eC(r)?r.uri:3)})),this.folderSettings=this._register(this.instantiationService.createInstance(Qot,this.folderSettingsAction)),this.resetLabels(),this.update(),this.settingsSwitcherBar.push([this.userLocalSettings,this.userRemoteSettings,this.workspaceSettings,this.folderSettingsAction])}get settingsTarget(){return this._settingsTarget}set settingsTarget(e){this._settingsTarget=e,this.userLocalSettings.checked=3===this.settingsTarget,this.userRemoteSettings.checked=4===this.settingsTarget,this.workspaceSettings.checked=5===this.settingsTarget,this.settingsTarget instanceof A?(this.folderSettings.action.checked=!0,this.folderSettings.folder=this.contextService.getWorkspaceFolder(this.settingsTarget)):this.folderSettings.action.checked=!1}setResultCount(e,t){if(e===5){let o=this.contextService.getWorkspace().name??d(14235,null);t&&(o+=` (${t})`),this.workspaceSettings.label=o}else if(e===3){let o=d(14233,null);t&&(o+=` (${t})`),this.userLocalSettings.label=o}else e instanceof A&&this.folderSettings.setCount(e,t)}updateLanguageFilterIndicators(e){if(this.resetLabels(),e){let t=this.languageService.getLanguageName(e);if(t){let o=` [${t}]`;this.userLocalSettings.label+=o,this.userRemoteSettings.label+=o,this.workspaceSettings.label+=o,this.folderSettingsAction.label+=o}}}onWorkbenchStateChanged(){this.folderSettings.folder=null,this.update(),this.settingsTarget===5&&this.contextService.getWorkbenchState()===3&&this.updateTarget(3)}updateTarget(e){return this.settingsTarget===e||e instanceof A&&this.settingsTarget instanceof A&&ze(this.settingsTarget,e)||(this.settingsTarget=e,this._onDidTargetChange.fire(this.settingsTarget)),Promise.resolve(void 0)}async update(){this.settingsSwitcherBar.domNode.classList.toggle("empty-workbench",this.contextService.getWorkbenchState()===1),this.userRemoteSettings.enabled=!!(this.options.enableRemoteSettings&&this.environmentService.remoteAuthority),this.workspaceSettings.enabled=this.contextService.getWorkbenchState()!==1,this.folderSettings.action.enabled=this.contextService.getWorkbenchState()===3&&this.contextService.getWorkspace().folders.length>0,this.workspaceSettings.tooltip=d(14235,null)}};oNe=I([m(2,Ae),m(3,F),m(4,Mt),m(5,nt),m(6,Rt)],oNe);var vie=class extends ll{constructor(e,t,o,n,r,s){super();this.options=t;this.contextViewService=o;this.instantiationService=n;this.contextKeyService=r;this.keybindingService=s;this._onDidChange=this._register(new T);this._onFocus=this._register(new T);this.create(e)}get onDidChange(){return this._onDidChange.event}get onFocus(){return this._onFocus.event}create(e){this.domNode=D(e,_("div.settings-header-widget")),this.createSearchContainer(D(this.domNode,_("div.settings-search-container"))),this.controlsDiv=D(this.domNode,_("div.settings-search-controls")),this.options.showResultCount&&(this.countElement=D(this.controlsDiv,_(".settings-count-widget")),this.countElement.style.backgroundColor=Tt(Gv),this.countElement.style.color=Tt(gx),this.countElement.style.border=`1px solid ${Tt(Ei)}`),this.inputBox.inputElement.setAttribute("aria-live",this.options.ariaLive||"off"),this.options.ariaLabelledBy&&this.inputBox.inputElement.setAttribute("aria-labelledBy",this.options.ariaLabelledBy);let t=this._register(nr(this.inputBox.inputElement));this._register(t.onDidFocus(()=>this._onFocus.fire()));let o=this.options.focusKey;o&&(this._register(t.onDidFocus(()=>o.set(!0))),this._register(t.onDidBlur(()=>o.set(!1))))}createSearchContainer(e){this.searchContainer=e;let t=D(this.searchContainer,_("div.settings-search-input"));this.inputBox=this._register(this.createInputBox(t)),this._register(this.inputBox.onDidChange(o=>this._onDidChange.fire(o)))}createInputBox(e){let t=()=>mM(this.keybindingService);return new YK(e,this.contextViewService,{...this.options,showHistoryHint:t},this.contextKeyService)}showMessage(e){this.countElement&&e!==this.countElement.textContent&&(this.countElement.textContent=e,this.inputBox.inputElement.setAttribute("aria-label",e),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}layout(e){e.width<400?(this.countElement?.classList.add("hide"),this.inputBox.inputElement.style.paddingRight="0px"):(this.countElement?.classList.remove("hide"),this.inputBox.inputElement.style.paddingRight=this.getControlsWidth()+"px")}getControlsWidth(){return(this.countElement?Dc(this.countElement):0)+20}focus(){this.inputBox.focus(),this.getValue()&&this.inputBox.select()}hasFocus(){return this.inputBox.hasFocus()}clear(){this.inputBox.value=""}getValue(){return this.inputBox.value}setValue(e){return this.inputBox.value=e}dispose(){this.options.focusKey?.set(!1),super.dispose()}};vie=I([m(2,qn),m(3,F),m(4,X),m(5,Le)],vie);var Yot=class extends k{constructor(e){super();this.editor=e;this._line=-1;this._preferences=[];this._onClick=this._register(new T);this.onClick=this._onClick.event;this._editPreferenceDecoration=this.editor.createDecorationsCollection(),this._register(this.editor.onMouseDown(t=>{t.target.type!==2||t.target.detail.isAfterLines||!this.isVisible()||this._onClick.fire(t)}))}get preferences(){return this._preferences}getLine(){return this._line}show(e,t,o){this._preferences=o;let n=[];this._line=e,n.push({options:{description:"edit-preference-widget-decoration",glyphMarginClassName:q.asClassName(Ege),glyphMarginHoverMessage:new he().appendText(t),stickiness:1},range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1}}),this._editPreferenceDecoration.set(n)}hide(){this._editPreferenceDecoration.clear()}isVisible(){return this._editPreferenceDecoration.length>0}dispose(){this.hide(),super.dispose()}};var Tge=class extends vie{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this.recordDisposables=this._register(new O);this._onKeybinding=this._register(new T);this.onKeybinding=this._onKeybinding.event;this._onEnter=this._register(new T);this.onEnter=this._onEnter.event;this._onEscape=this._register(new T);this.onEscape=this._onEscape.event;this._onBlur=this._register(new T);this.onBlur=this._onBlur.event;this._register(ee(()=>this.stopRecordingKeys())),this._chords=null,this._inputValue=""}clear(){this._chords=null,super.clear()}startRecordingKeys(){this.recordDisposables.add($(this.inputBox.inputElement,ne.KEY_DOWN,e=>this._onKeyDown(new mi(e)))),this.recordDisposables.add($(this.inputBox.inputElement,ne.BLUR,()=>this._onBlur.fire())),this.recordDisposables.add($(this.inputBox.inputElement,ne.INPUT,()=>{this.setInputValue(this._inputValue)}))}stopRecordingKeys(){this._chords=null,this.recordDisposables.clear()}setInputValue(e){this._inputValue=e,this.inputBox.value=this._inputValue}_onKeyDown(e){if(e.preventDefault(),e.stopPropagation(),!this.options.recordEnter&&e.equals(3)){this._onEnter.fire();return}if(e.equals(9)){this._onEscape.fire();return}this.printKeybinding(e)}printKeybinding(e){let t=this.keybindingService.resolveKeyboardEvent(e),o=`code: ${e.browserEvent.code}, keyCode: ${e.browserEvent.keyCode}, key: ${e.browserEvent.key} => UI: ${t.getAriaLabel()}, user settings: ${t.getUserSettingsLabel()}, dispatch: ${t.getDispatchChords()[0]}`,n=this.options;this._chords||(this._chords=[]),this._chords.length>0&&this._chords[this._chords.length-1].getDispatchChords()[0]===null?this._chords[this._chords.length-1]=t:(this._chords.length===2&&(this._chords=[]),this._chords.push(t));let s=this._chords.map(l=>l.getUserSettingsLabel()||"").join(" ");this.setInputValue(n.quoteRecordedKeys?`"${s}"`:s),this.inputBox.inputElement.title=o,this._onKeybinding.fire(this._chords)}};Tge=I([m(2,qn),m(3,F),m(4,X),m(5,Le)],Tge);var qW=class extends ll{constructor(e,t){super();this.instantiationService=t;this._keybindingDisposables=this._register(new O);this._chords=null;this._isVisible=!1;this._onHide=this._register(new T);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onShowExistingKeybindings=this._register(new T);this.onShowExistingKeybidings=this._onShowExistingKeybindings.event;this._domNode=Ir(document.createElement("div")),this._domNode.setDisplay("none"),this._domNode.setClassName("defineKeybindingWidget"),this._domNode.setWidth(qW.WIDTH),this._domNode.setHeight(qW.HEIGHT);let o=d(14148,null);D(this._domNode.domNode,_(".message",void 0,o)),this._domNode.domNode.style.backgroundColor=Tt(qu),this._domNode.domNode.style.color=Tt(vT),this._keybindingInputWidget=this._register(this.instantiationService.createInstance(Tge,this._domNode.domNode,{ariaLabel:o,history:new Set([]),inputBoxStyles:Wl})),this._keybindingInputWidget.startRecordingKeys(),this._register(this._keybindingInputWidget.onKeybinding(n=>this.onKeybinding(n))),this._register(this._keybindingInputWidget.onEnter(()=>this.hide())),this._register(this._keybindingInputWidget.onEscape(()=>this.clearOrHide())),this._register(this._keybindingInputWidget.onBlur(()=>this.onCancel())),this._outputNode=D(this._domNode.domNode,_(".output")),this._showExistingKeybindingsNode=D(this._domNode.domNode,_(".existing")),e&&D(e,this._domNode.domNode)}static{this.WIDTH=400}static{this.HEIGHT=110}get domNode(){return this._domNode.domNode}define(){return this._keybindingInputWidget.clear(),vn.withAsyncBody(async e=>{this._isVisible||(this._isVisible=!0,this._domNode.setDisplay("block"),this._chords=null,this._keybindingInputWidget.setInputValue(""),St(this._outputNode),St(this._showExistingKeybindingsNode),await Li(0),this._keybindingInputWidget.focus());let t=this._onHide.event(()=>{e(this.getUserSettingsLabel()),t.dispose()})})}layout(e){let t=Math.round((e.height-qW.HEIGHT)/2);this._domNode.setTop(t);let o=Math.round((e.width-qW.WIDTH)/2);this._domNode.setLeft(o)}printExisting(e){if(e>0){let t=_("span.existingText"),o=e===1?d(14149,null,e):d(14147,null,e);D(t,document.createTextNode(o)),cn(o),this._showExistingKeybindingsNode.appendChild(t),t.onmousedown=n=>{n.preventDefault()},t.onmouseup=n=>{n.preventDefault()},t.onclick=()=>{this._onShowExistingKeybindings.fire(this.getUserSettingsLabel())}}}onKeybinding(e){if(this._keybindingDisposables.clear(),this._chords=e,St(this._outputNode),St(this._showExistingKeybindingsNode),this._keybindingDisposables.add(new ah(this._outputNode,Ao,qk)).set(this._chords?.[0]??void 0),this._chords)for(let n=1;n<this._chords.length;n++)this._outputNode.appendChild(document.createTextNode(d(14146,null))),this._keybindingDisposables.add(new ah(this._outputNode,Ao,qk)).set(this._chords[n]);let o=this.getUserSettingsLabel();o&&this._onDidChange.fire(o)}getUserSettingsLabel(){let e=null;return this._chords&&(e=this._chords.map(t=>t.getUserSettingsLabel()).join(" ")),e}onCancel(){this._chords=null,this.hide()}clearOrHide(){this._chords===null?this.hide():(this._chords=null,this._keybindingInputWidget.clear(),St(this._outputNode),St(this._showExistingKeybindingsNode))}hide(){this._domNode.setDisplay("none"),this._isVisible=!1,this._onHide.fire()}};qW=I([m(1,F)],qW);var bie=class extends k{constructor(e,t){super();this._editor=e;this._widget=this._register(t.createInstance(qW,null)),this._editor.addOverlayWidget(this)}static{this.ID="editor.contrib.defineKeybindingWidget"}getId(){return bie.ID}getDomNode(){return this._widget.domNode}getPosition(){return{preference:null}}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}start(){this._editor.hasModel()&&this._editor.revealPositionInCenterIfOutsideViewport(this._editor.getPosition(),0);let e=this._editor.getLayoutInfo();return this._widget.layout(new di(e.width,e.height)),this._widget.define()}};bie=I([m(1,F)],bie);function ay(a){return{wordWrap:"on",overviewRulerLanes:0,glyphMargin:!1,lineNumbers:"off",folding:!1,selectOnLineNumbers:!1,hideCursorInOverviewRuler:!0,selectionHighlight:!1,scrollbar:{horizontal:"hidden",alwaysConsumeMouseWheel:!1},lineDecorationsWidth:0,overviewRulerBorder:!1,scrollBeyondLastLine:!1,renderLineHighlight:"none",fixedOverflowWidgets:!0,acceptSuggestionOnEnter:"smart",dragAndDrop:!1,revealHorizontalRightPadding:5,minimap:{enabled:!1},guides:{indentation:!1},wordSegmenterLocales:a.getValue("editor.wordSegmenterLocales"),accessibilitySupport:a.getValue("editor.accessibilitySupport"),cursorBlinking:a.getValue("editor.cursorBlinking"),editContext:a.getValue("editor.editContext"),defaultColorDecorators:"never",allowVariableLineHeights:!1,allowVariableFonts:!1,allowVariableFontsInAccessibilityMode:!1}}function nNe(){return{isSimpleWidget:!0,contributions:ml.getSomeEditorContributions([dw.ID,mw,Vg.ID,Sc.ID,ss.ID,pw.ID])}}function rNe(a){return hs((i,e)=>{let t=i.getColor(KIt);if(t){let o=i.getColor(Hf);o&&(e.addRule(`${a} .monaco-editor-background { background-color: ${o}; } `),e.addRule(`${a} .monaco-editor .selected-text { background-color: ${o.transparent(.4)}; }`));let n=i.getColor(IT);n&&e.addRule(`${a} .monaco-editor .view-line span.inline-selected-text { color: ${n}; }`),e.addRule(`${a} .monaco-editor .focused .selected-text { background-color: ${t}; }`)}else e.addRule(`${a} .monaco-editor .focused .selected-text { background-color: ${i.getColor(qv)}; }`)})}var YN=class extends ll{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._onShouldFocusResults=this._register(new T);this.onShouldFocusResults=this._onShouldFocusResults.event;this._onInputDidChange=this._register(new T);this.onInputDidChange=this._onInputDidChange.event;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new T);this.onDidBlur=this._onDidBlur.event;this.stylingContainer=D(t,_(".suggest-input-container")),this.element=t,this.placeholderText=D(this.stylingContainer,_(".suggest-input-placeholder",void 0,s.placeholderText||""));let g=Cp(ay(h),Grn(n));g.overflowWidgetsDomNode=s.overflowWidgetsDomNode;let f=this.getScopedContextKeyService(u),v=f?this._register(l.createChild(new Po([X,f]))):l;this.inputWidget=this._register(v.createInstance(us,this.stylingContainer,g,{contributions:ml.getSomeEditorContributions([Sc.ID,ss.ID,Vg.ID,dw.ID,mw]),isSimpleWidget:!0})),this._register(h.onDidChangeConfiguration(x=>{if(x.affectsConfiguration("editor.accessibilitySupport")||x.affectsConfiguration("editor.cursorBlinking")){let E=h.getValue("editor.accessibilitySupport"),M=h.getValue("editor.cursorBlinking");this.inputWidget.updateOptions({accessibilitySupport:E,cursorBlinking:M})}})),this._register(this.inputWidget.onDidFocusEditorText(()=>this._onDidFocus.fire())),this._register(this.inputWidget.onDidBlurEditorText(()=>this._onDidBlur.fire()));let b=A.parse(r);this.inputModel=c.createModel("",null,b,!0),this._register(this.inputModel),this.inputWidget.setModel(this.inputModel),this._register(this.inputWidget.onDidPaste(()=>this.setValue(this.getValue()))),this._register(this.inputWidget.onDidFocusEditorText(()=>{s.focusContextKey&&s.focusContextKey.set(!0),this.stylingContainer.classList.add("synthetic-focus")})),this._register(this.inputWidget.onDidBlurEditorText(()=>{s.focusContextKey&&s.focusContextKey.set(!1),this.stylingContainer.classList.remove("synthetic-focus")})),this._register(U.chain(this.inputWidget.onKeyDown,x=>x.filter(E=>E.keyCode===3))(x=>{x.preventDefault()},this)),this._register(U.chain(this.inputWidget.onKeyDown,x=>x.filter(E=>E.keyCode===18&&(et?E.metaKey:E.ctrlKey)))(()=>this._onShouldFocusResults.fire(),this));let S=this.getValue(),y=this.inputWidget.getModel();y&&this._register(y.onDidChangeContent(()=>{let x=this.getValue();this.placeholderText.style.visibility=x?"hidden":"visible",S.trim()!==x.trim()&&(this._onInputDidChange.fire(void 0),S=x)}));let w={provideResults:o.provideResults,sortKey:o.sortKey||(x=>x),triggerCharacters:o.triggerCharacters||[],wordDefinition:o.wordDefinition?c5(o.wordDefinition):void 0,alwaysShowSuggestions:!!o.alwaysShowSuggestions};this.setValue(s.value||""),this._register(p.completionProvider.register({scheme:b.scheme,pattern:"**/"+b.path,hasAccessToAllModels:!0},{_debugDisplayName:`suggestEnabledInput/${e}`,triggerCharacters:w.triggerCharacters,provideCompletionItems:(x,E,M)=>{let N=x.getValue(),V=E.column-1,H=0,K=0;if(w.wordDefinition){let j=Rk(E.column,w.wordDefinition,N,0);H=j?.word.length??0,K=j?j.startColumn-1:0}else K=N.lastIndexOf(" ",V-1)+1,H=V-K;return!w.alwaysShowSuggestions&&H>0&&w.triggerCharacters?.indexOf(N[K])===-1?{suggestions:[]}:{suggestions:o.provideResults(N).map(j=>{let J,se;return typeof j=="string"?J=j:(J=j.label,se=j),{label:J,insertText:J,range:G.fromPositions(E.delta(0,-H),E),sortText:w.sortKey(J),kind:17,...se}})}}})),this.style(s.styleOverrides||{})}getScopedContextKeyService(e){}updateAriaLabel(e){this.inputWidget.updateOptions({ariaLabel:e})}setValue(e){e=e.replace(/\s/g," ");let t=this.inputModel.getFullModelRange();this.inputWidget.executeEdits("suggestEnabledInput.setValue",[Qn.replace(t,e)]),this.inputWidget.setScrollTop(0),this.inputWidget.setPosition(new ye(1,e.length+1))}getValue(){return this.inputWidget.getValue()}style(e){this.stylingContainer.style.backgroundColor=Tt(e.inputBackground??Hf),this.stylingContainer.style.color=Tt(e.inputForeground??IT),this.placeholderText.style.color=Tt(e.inputPlaceholderForeground??cX),this.stylingContainer.style.borderWidth="1px",this.stylingContainer.style.borderStyle="solid",this.stylingContainer.style.borderColor=tX(e.inputBorder??LI,"transparent");let t=this.stylingContainer.getElementsByClassName("cursor")[0];t&&(t.style.backgroundColor=Tt(e.inputForeground??IT))}focus(e){this.inputWidget.focus(),e&&this.inputWidget.getValue()&&this.selectAll()}onHide(){this.inputWidget.onHide()}layout(e){this.inputWidget.layout(e),this.placeholderText.style.width=`${e.width-2}px`}selectAll(){this.inputWidget.setSelection(new G(1,1,1,this.getValue().length+1))}};YN=I([m(6,F),m(7,_t),m(8,X),m(9,Jt),m(10,B)],YN);var Xot=class extends YN{constructor({id:i,parent:e,ariaLabel:t,suggestionProvider:o,resourceHandle:n,suggestOptions:r,history:s},l,c,u,p,h){super(i,e,o,t,n,r,l,c,u,p,h),this.history=this._register(new bJ(new Set(s),100))}addToHistory(){let i=this.getValue();i&&i!==this.getCurrentValue()&&this.history.add(i)}getHistory(){return this.history.getHistory()}showNextValue(){this.history.has(this.getValue())||this.addToHistory();let i=this.getNextValue();i&&(i=i===this.getValue()?this.getNextValue():i),this.setValue(i??"")}showPreviousValue(){this.history.has(this.getValue())||this.addToHistory();let i=this.getPreviousValue();i&&(i=i===this.getValue()?this.getPreviousValue():i),i&&(this.setValue(i),this.inputWidget.setPosition({lineNumber:0,column:0}))}clearHistory(){this.history.clear()}getCurrentValue(){let i=this.history.current();return i||(i=this.history.last(),this.history.next()),i}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}};Xot=I([m(1,F),m(2,_t),m(3,X),m(4,Jt),m(5,B)],Xot);var sNe=class extends Xot{constructor(i,e,t,o,n,r){super(i,e,t,o,n,r);let{historyNavigationBackwardsEnablement:s,historyNavigationForwardsEnablement:l}=this.historyContext;this._register(this.inputWidget.onDidChangeCursorPosition(({position:c})=>{let u=this.inputWidget._getViewModel(),p=u.getLineCount(),h=u.getLineLength(p)+1,g=u.coordinatesConverter.convertModelPositionToViewPosition(c);s.set(g.lineNumber===1&&g.column===1),l.set(g.lineNumber===p&&g.column===h)}))}getScopedContextKeyService(i){let e=this._register(i.createScoped(this.element));return this.historyContext=this._register(JB(e,this)),e}};sNe=I([m(1,F),m(2,_t),m(3,X),m(4,Jt),m(5,B)],sNe);rNe(".suggest-input-container");function Grn(a){return{fontSize:13,lineHeight:20,wordWrap:"off",scrollbar:{vertical:"hidden"},roundedSelection:!1,guides:{indentation:!1},cursorWidth:1,fontFamily:WF,ariaLabel:a||"",snippetSuggestions:"none",suggest:{filterGraceful:!1,showIcons:!1},autoClosingBrackets:"never"}}var Jot=te("settings.headerForeground",{light:"#444444",dark:"#e7e7e7",hcDark:"#ffffff",hcLight:"#292929"},d(14434,null)),pRi=te("settings.settingsHeaderHoverForeground",ni(Jot,.7),d(14449,null)),rau=te("settings.modifiedItemIndicator",{light:new Ue(new Ut(102,175,224)),dark:new Ue(new Ut(12,125,157)),hcDark:new Ue(new Ut(0,73,122)),hcLight:new Ue(new Ut(102,175,224))},d(14435,null)),oSo=te("settings.headerBorder",ob,d(14448,null)),Zot=te("settings.sashBorder",ob,d(14450,null)),Xzt=te("settings.dropdownBackground",iK,d(14444,null)),Jzt=te("settings.dropdownForeground",Kce,d(14446,null)),Zzt=te("settings.dropdownBorder",RF,d(14445,null)),eKt=te("settings.dropdownListBorder",bT,d(14447,null)),sau=te("settings.checkboxBackground",HCe,d(14441,null)),aau=te("settings.checkboxForeground",UCe,d(14443,null)),lau=te("settings.checkboxBorder",cyt,d(14442,null)),aNe=te("settings.textInputBackground",Hf,d(14451,null)),lNe=te("settings.textInputForeground",IT,d(14453,null)),__=te("settings.textInputBorder",LI,d(14452,null)),nSo=te("settings.numberInputBackground",Hf,d(14436,null)),rSo=te("settings.numberInputForeground",IT,d(14438,null)),sSo=te("settings.numberInputBorder",LI,d(14437,null)),cau=te("settings.focusedRowBackground",{dark:ni(ST,.6),light:ni(ST,.6),hcDark:null,hcLight:null},d(14433,null)),dau=te("settings.rowHoverBackground",{dark:ni(ST,.3),light:ni(ST,.3),hcDark:null,hcLight:null},d(14440,null)),uau=te("settings.focusedRowBorder",Kc,d(14439,null));var sI=_,pg=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(pg.ID,e,t,o,g);this.keybindingsService=n;this.contextMenuService=r;this.keybindingEditingService=s;this.contextKeyService=l;this.notificationService=c;this.clipboardService=u;this.instantiationService=p;this.editorService=h;this.configurationService=f;this.accessibilityService=v;this._onDefineWhenExpression=this._register(new T);this.onDefineWhenExpression=this._onDefineWhenExpression.event;this._onRejectWhenExpression=this._register(new T);this.onRejectWhenExpression=this._onRejectWhenExpression.event;this._onAcceptWhenExpression=this._register(new T);this.onAcceptWhenExpression=this._onAcceptWhenExpression.event;this._onLayout=this._register(new T);this.onLayout=this._onLayout.event;this.keybindingsEditorModel=null;this.unAssignedKeybindingItemToRevealAndFocus=null;this.tableEntries=[];this.dimension=null;this.latestEmptyFilters=[];this.delayedFiltering=this._register(new rn(300)),this._register(n.onDidUpdateKeybindings(()=>this.render(!!this.keybindingFocusContextKey.get()))),this.keybindingsEditorContextKey=xf.bindTo(this.contextKeyService),this.searchFocusContextKey=XAe.bindTo(this.contextKeyService),this.keybindingFocusContextKey=zW.bindTo(this.contextKeyService),this.searchHasValueContextKey=Lzt.bindTo(this.contextKeyService),this.searchHistoryDelayer=this._register(new rn(500)),this.recordKeysAction=this._register(new it(Azt,d(14131,null),q.asClassName(Ybo))),this.recordKeysAction.checked=!1,this.sortByPrecedenceAction=this._register(new it(Nzt,d(14139,null),q.asClassName(Xbo))),this.sortByPrecedenceAction.checked=!1,this.overflowWidgetsDomNode=sI(".keybindings-overflow-widgets-container.monaco-editor")}static{this.ID="workbench.editor.keybindings"}create(e){super.create(e),this._register(p_({name:"keybindingsEditor",focusNotifiers:[this],focusNextWidget:()=>{this.searchWidget.hasFocus()&&this.focusKeybindings()},focusPreviousWidget:()=>{this.searchWidget.hasFocus()||this.focusSearch()}}))}createEditor(e){let t=D(e,sI("div",{class:"keybindings-editor"}));this.createAriaLabelElement(t),this.createOverlayContainer(t),this.createHeader(t),this.createBody(t)}setInput(e,t,o,n){return this.keybindingsEditorContextKey.set(!0),super.setInput(e,t,o,n).then(()=>this.render(!!(t&&t.preserveFocus)))}clearInput(){super.clearInput(),this.keybindingsEditorContextKey.reset(),this.keybindingFocusContextKey.reset()}layout(e){this.dimension=e,this.layoutSearchWidget(e),this.overlayContainer.style.width=e.width+"px",this.overlayContainer.style.height=e.height+"px",this.defineKeybindingWidget.layout(this.dimension),this.layoutKeybindingsTable(),this._onLayout.fire()}focus(){super.focus();let e=this.activeKeybindingEntry;e?this.selectEntry(e):Tc||this.searchWidget.focus()}get activeKeybindingEntry(){let e=this.keybindingsTable.getFocusedElements()[0];return e&&e.templateId===Y8?e:null}async defineKeybinding(e,t){this.selectEntry(e),this.showOverlayContainer();try{let o=await this.defineKeybindingWidget.define();o&&await this.updateKeybinding(e,o,e.keybindingItem.when,t)}catch(o){this.onKeybindingEditingError(o)}finally{this.hideOverlayContainer(),this.selectEntry(e)}}defineWhenExpression(e){e.keybindingItem.keybinding&&(this.selectEntry(e),this._onDefineWhenExpression.fire(e))}rejectWhenExpression(e){this._onRejectWhenExpression.fire(e)}acceptWhenExpression(e){this._onAcceptWhenExpression.fire(e)}async updateKeybinding(e,t,o,n){((e.keybindingItem.keybinding?e.keybindingItem.keybinding.getUserSettingsLabel():"")!==t||e.keybindingItem.when!==o)&&(n?await this.keybindingEditingService.addKeybinding(e.keybindingItem.keybindingItem,t,o||void 0):await this.keybindingEditingService.editKeybinding(e.keybindingItem.keybindingItem,t,o||void 0),e.keybindingItem.keybinding||(this.unAssignedKeybindingItemToRevealAndFocus=e))}async removeKeybinding(e){if(this.selectEntry(e),e.keybindingItem.keybinding)try{await this.keybindingEditingService.removeKeybinding(e.keybindingItem.keybindingItem),this.focus()}catch(t){this.onKeybindingEditingError(t),this.selectEntry(e)}}async resetKeybinding(e){this.selectEntry(e);try{await this.keybindingEditingService.resetKeybinding(e.keybindingItem.keybindingItem),e.keybindingItem.keybinding||(this.unAssignedKeybindingItemToRevealAndFocus=e),this.selectEntry(e)}catch(t){this.onKeybindingEditingError(t),this.selectEntry(e)}}async copyKeybinding(e){this.selectEntry(e);let t={key:e.keybindingItem.keybinding&&e.keybindingItem.keybinding.getUserSettingsLabel()||"",command:e.keybindingItem.command};e.keybindingItem.when&&(t.when=e.keybindingItem.when),await this.clipboardService.writeText(JSON.stringify(t,null,"  "))}async copyKeybindingCommand(e){this.selectEntry(e),await this.clipboardService.writeText(e.keybindingItem.command)}async copyKeybindingCommandTitle(e){this.selectEntry(e),await this.clipboardService.writeText(e.keybindingItem.commandLabel)}focusSearch(){this.searchWidget.focus()}search(e){this.focusSearch(),this.searchWidget.setValue(e),this.selectEntry(0)}clearSearchResults(){this.searchWidget.clear(),this.searchHasValueContextKey.set(!1)}showSimilarKeybindings(e){let t=`"${e.keybindingItem.keybinding.getAriaLabel()}"`;t!==this.searchWidget.getValue()&&this.searchWidget.setValue(t)}createAriaLabelElement(e){this.ariaLabelElement=D(e,_("")),this.ariaLabelElement.setAttribute("id","keybindings-editor-aria-label-element"),this.ariaLabelElement.setAttribute("aria-live","assertive"),this.ariaLabelElement.style.position="absolute",this.ariaLabelElement.style.width="1px",this.ariaLabelElement.style.height="1px",this.ariaLabelElement.style.overflow="hidden",this.ariaLabelElement.style.clip="rect(1px, 1px, 1px, 1px)",this.ariaLabelElement.style.clipPath="inset(50%)",this.ariaLabelElement.style.whiteSpace="nowrap"}createOverlayContainer(e){this.overlayContainer=D(e,sI(".overlay-container")),this.overlayContainer.style.position="absolute",this.overlayContainer.style.zIndex="40",this.defineKeybindingWidget=this._register(this.instantiationService.createInstance(qW,this.overlayContainer)),this._register(this.defineKeybindingWidget.onDidChange(t=>this.defineKeybindingWidget.printExisting(this.keybindingsEditorModel.fetch(`"${t}"`).length))),this._register(this.defineKeybindingWidget.onShowExistingKeybidings(t=>this.searchWidget.setValue(`"${t}"`))),this.hideOverlayContainer()}showOverlayContainer(){this.overlayContainer.style.display="block"}hideOverlayContainer(){this.overlayContainer.style.display="none"}createHeader(e){this.headerContainer=D(e,sI(".keybindings-header"));let t=d(14134,null),o=d(14135,null),n=this._register(new it(Pzt,d(14115,null),q.asClassName(iNe),!1,async()=>this.clearSearchResults())),r=D(this.headerContainer,sI(".search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(Tge,r,{ariaLabel:t,placeholder:t,focusKey:this.searchFocusContextKey,ariaLabelledBy:"keybindings-editor-aria-label-element",recordEnter:!0,quoteRecordedKeys:!0,history:new Set(this.getMemento(0,0).searchHistory??[]),inputBoxStyles:MD({inputBorder:__})})),this._register(this.searchWidget.onDidChange(u=>{let p=!!u;n.enabled=p,this.searchHasValueContextKey.set(p),this.delayedFiltering.trigger(()=>this.filterKeybindings()),this.updateSearchOptions()})),this._register(this.searchWidget.onEscape(()=>this.recordKeysAction.checked=!1)),this.actionsContainer=D(r,_(".keybindings-search-actions-container"));let s=this.createRecordingBadge(this.actionsContainer);this._register(this.sortByPrecedenceAction.onDidChange(u=>{u.checked!==void 0&&this.renderKeybindingsEntries(!1),this.updateSearchOptions()})),this._register(this.recordKeysAction.onDidChange(u=>{u.checked!==void 0&&(s.classList.toggle("disabled",!u.checked),u.checked?(this.searchWidget.inputBox.setPlaceHolder(o),this.searchWidget.inputBox.setAriaLabel(o),this.searchWidget.startRecordingKeys(),this.searchWidget.focus()):(this.searchWidget.inputBox.setPlaceHolder(t),this.searchWidget.inputBox.setAriaLabel(t),this.searchWidget.stopRecordingKeys(),this.searchWidget.focus()),this.updateSearchOptions())}));let l=[this.recordKeysAction,this.sortByPrecedenceAction,n],c=this._register(new Kp(this.actionsContainer,this.contextMenuService,{actionViewItemProvider:(u,p)=>{if(u.id===this.sortByPrecedenceAction.id||u.id===this.recordKeysAction.id)return new eue(null,u,{...p,keybinding:this.keybindingsService.lookupKeybinding(u.id)?.getLabel(),toggleStyles:zh})},getKeyBinding:u=>this.keybindingsService.lookupKeybinding(u.id)}));c.setActions(l),this._register(this.keybindingsService.onDidUpdateKeybindings(()=>c.setActions(l)))}updateSearchOptions(){let e=this.input;e&&(e.searchOptions={searchValue:this.searchWidget.getValue(),recordKeybindings:!!this.recordKeysAction.checked,sortByPrecedence:!!this.sortByPrecedenceAction.checked})}createRecordingBadge(e){let t=D(e,_(".recording-badge.monaco-count-badge.long.disabled"));return t.textContent=d(14130,null),t.style.backgroundColor=Tt(Gv),t.style.color=Tt(gx),t.style.border=`1px solid ${Tt(Ei)}`,t}layoutSearchWidget(e){this.searchWidget.layout(e),this.headerContainer.classList.toggle("small",e.width<400),this.searchWidget.inputBox.inputElement.style.paddingRight=`${Dc(this.actionsContainer)+12}px`}createBody(e){let t=D(e,sI(".keybindings-body"));this.createTable(t)}createTable(e){this.keybindingsTableContainer=D(e,sI(".keybindings-table-container")),this.keybindingsTable=this._register(this.instantiationService.createInstance(Cx,"KeybindingsEditor",this.keybindingsTableContainer,new mRi,[{label:"",tooltip:"",weight:0,minimumWidth:40,maximumWidth:40,templateId:Sie.TEMPLATE_ID,project(t){return t}},{label:d(14116,null),tooltip:"",weight:.3,templateId:Iie.TEMPLATE_ID,project(t){return t}},{label:d(14124,null),tooltip:"",weight:.2,templateId:tKt.TEMPLATE_ID,project(t){return t}},{label:d(14142,null),tooltip:"",weight:.35,templateId:wie.TEMPLATE_ID,project(t){return t}},{label:d(14140,null),tooltip:"",weight:.15,templateId:yie.TEMPLATE_ID,project(t){return t}}],[this.instantiationService.createInstance(Sie,this),this.instantiationService.createInstance(Iie),this.instantiationService.createInstance(tKt),this.instantiationService.createInstance(wie,this),this.instantiationService.createInstance(yie)],{identityProvider:{getId:t=>t.id},horizontalScrolling:!1,accessibilityProvider:new hRi(this.configurationService),keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.keybindingItem.commandLabel||t.keybindingItem.command},overrideStyles:{listBackground:Bo},multipleSelectionSupport:!1,setRowLineHeight:!1,openOnSingleClick:!1,transformOptimization:!1})),this._register(this.keybindingsTable.onContextMenu(t=>this.onContextMenu(t))),this._register(this.keybindingsTable.onDidChangeFocus(t=>this.onFocusChange())),this._register(this.keybindingsTable.onDidFocus(()=>{this.keybindingsTable.getHTMLElement().classList.add("focused"),this.onFocusChange()})),this._register(this.keybindingsTable.onDidBlur(()=>{this.keybindingsTable.getHTMLElement().classList.remove("focused"),this.keybindingFocusContextKey.reset()})),this._register(this.keybindingsTable.onDidOpen(t=>{if(t.browserEvent?.defaultPrevented)return;let o=this.activeKeybindingEntry;o&&this.defineKeybinding(o,!1)})),D(this.keybindingsTableContainer,this.overflowWidgetsDomNode)}async render(e){if(this.input){let t=this.input;this.keybindingsEditorModel=await t.resolve(),await this.keybindingsEditorModel.resolve(this.getActionsLabels()),this.renderKeybindingsEntries(!1,e),t.searchOptions?(this.recordKeysAction.checked=t.searchOptions.recordKeybindings,this.sortByPrecedenceAction.checked=t.searchOptions.sortByPrecedence,this.searchWidget.setValue(t.searchOptions.searchValue)):this.updateSearchOptions()}}getActionsLabels(){let e=new Map;for(let t of ml.getEditorActions())e.set(t.id,t.label);for(let t of be.getMenuItems(R.CommandPalette))if(cT(t)){let o=typeof t.command.title=="string"?t.command.title:t.command.title.value,n=t.command.category?typeof t.command.category=="string"?t.command.category:t.command.category.value:void 0;e.set(t.command.id,n?`${n}: ${o}`:o)}return e}filterKeybindings(){this.renderKeybindingsEntries(this.searchWidget.hasFocus()),this.searchHistoryDelayer.trigger(()=>{this.searchWidget.inputBox.addToHistory(),this.getMemento(0,0).searchHistory=this.searchWidget.inputBox.getHistory(),this.saveState()})}clearKeyboardShortcutSearchHistory(){this.searchWidget.inputBox.clearHistory(),this.getMemento(0,0).searchHistory=this.searchWidget.inputBox.getHistory(),this.saveState()}renderKeybindingsEntries(e,t){if(this.keybindingsEditorModel){let o=this.searchWidget.getValue(),n=this.keybindingsEditorModel.fetch(o,this.sortByPrecedenceAction.checked),r=this.getAriaLabel(n);this.accessibilityService.alert(r),this.ariaLabelElement.textContent=r,n.length===0&&this.latestEmptyFilters.push(o);let s=this.keybindingsTable.getSelection()[0];if(this.tableEntries=n,this.keybindingsTable.splice(0,this.keybindingsTable.length,this.tableEntries),this.layoutKeybindingsTable(),e)this.keybindingsTable.setSelection([]),this.keybindingsTable.setFocus([]);else if(this.unAssignedKeybindingItemToRevealAndFocus){let l=this.getNewIndexOfUnassignedKeybinding(this.unAssignedKeybindingItemToRevealAndFocus);l!==-1&&(this.keybindingsTable.reveal(l,.2),this.selectEntry(l)),this.unAssignedKeybindingItemToRevealAndFocus=null}else s!==-1&&s<this.tableEntries.length?this.selectEntry(s,t):this.editorService.activeEditorPane===this&&!t&&this.focus()}}getAriaLabel(e){let t;if(this.sortByPrecedenceAction.checked?t=d(14137,null,e.length):t=d(14136,null,e.length),this.configurationService.getValue("accessibility.verbosity.keybindingsEditor")){let o=this.keybindingsService.lookupKeybinding("widgetNavigation.focusNext")?.getAriaLabel();o&&(t+=". "+d(14127,null,o))}return t}layoutKeybindingsTable(){if(!this.dimension)return;let e=this.dimension.height-(ur(this.headerContainer).height+12);this.keybindingsTableContainer.style.height=`${e}px`,this.keybindingsTable.layout(e)}getIndexOf(e){let t=this.tableEntries.indexOf(e);if(t===-1){for(let o=0;o<this.tableEntries.length;o++)if(this.tableEntries[o].id===e.id)return o}return t}getNewIndexOfUnassignedKeybinding(e){for(let t=0;t<this.tableEntries.length;t++){let o=this.tableEntries[t];if(o.templateId===Y8&&o.keybindingItem.command===e.keybindingItem.command)return t}return-1}selectEntry(e,t=!0){let o=typeof e=="number"?e:this.getIndexOf(e);o!==-1&&o<this.keybindingsTable.length&&(t&&(this.keybindingsTable.domFocus(),this.keybindingsTable.setFocus([o])),this.keybindingsTable.setSelection([o]))}focusKeybindings(){this.keybindingsTable.domFocus();let e=this.keybindingsTable.getFocus();this.keybindingsTable.setFocus([e.length?e[0]:0])}selectKeybinding(e){this.selectEntry(e)}recordSearchKeys(){this.recordKeysAction.checked=!0}toggleSortByPrecedence(){this.sortByPrecedenceAction.checked=!this.sortByPrecedenceAction.checked}onContextMenu(e){if(e.element&&e.element.templateId===Y8){let t=e.element;this.selectEntry(t),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[this.createCopyAction(t),this.createCopyCommandAction(t),this.createCopyCommandTitleAction(t),new oi,...t.keybindingItem.keybinding?[this.createDefineKeybindingAction(t),this.createAddKeybindingAction(t)]:[this.createDefineKeybindingAction(t)],new oi,this.createRemoveAction(t),this.createResetAction(t),new oi,this.createDefineWhenExpressionAction(t),new oi,this.createShowConflictsAction(t)]})}}onFocusChange(){this.keybindingFocusContextKey.reset();let e=this.keybindingsTable.getFocusedElements()[0];e&&e.templateId===Y8&&this.keybindingFocusContextKey.set(!0)}createDefineKeybindingAction(e){return{label:e.keybindingItem.keybinding?d(14114,null):d(14113,null),enabled:!0,id:JAe,run:()=>this.defineKeybinding(e,!1)}}createAddKeybindingAction(e){return{label:d(14113,null),enabled:!0,id:Ozt,run:()=>this.defineKeybinding(e,!0)}}createDefineWhenExpressionAction(e){return{label:d(14121,null),enabled:!!e.keybindingItem.keybinding,id:Fzt,run:()=>this.defineWhenExpression(e)}}createRemoveAction(e){return{label:d(14132,null),enabled:!!e.keybindingItem.keybinding,id:Wzt,run:()=>this.removeKeybinding(e)}}createResetAction(e){return{label:d(14133,null),enabled:!e.keybindingItem.keybindingItem.isDefault,id:Vzt,run:()=>this.resetKeybinding(e)}}createShowConflictsAction(e){return{label:d(14138,null),enabled:!!e.keybindingItem.keybinding,id:zzt,run:()=>this.showSimilarKeybindings(e)}}createCopyAction(e){return{label:d(14119,null),enabled:!0,id:Bzt,run:()=>this.copyKeybinding(e)}}createCopyCommandAction(e){return{label:d(14117,null),enabled:!0,id:Hzt,run:()=>this.copyKeybindingCommand(e)}}createCopyCommandTitleAction(e){return{label:d(14118,null),enabled:!!e.keybindingItem.commandLabel,id:Uzt,run:()=>this.copyKeybindingCommandTitle(e)}}onKeybindingEditingError(e){this.notificationService.error(typeof e=="string"?e:d(14122,null,`${e}`))}};pg=I([m(1,_e),m(2,Pe),m(3,Le),m(4,Xe),m(5,n_i),m(6,X),m(7,Ne),m(8,Bi),m(9,F),m(10,ie),m(11,de),m(12,B),m(13,Ai)],pg);var mRi=class{constructor(){this.headerRowHeight=30}getHeight(i){if(i.templateId===Y8){let e=i.keybindingItem.commandLabel&&i.commandIdMatches,t=!!i.commandDefaultLabelMatches,o=!!i.extensionIdMatches;if(e&&t)return 60;if(o||e||t)return 40}return 24}},Sie=class{constructor(i,e){this.keybindingsEditor=i;this.keybindingsService=e;this.templateId=Sie.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=D(i,sI(".actions"));return{actionBar:new oo(e)}}renderElement(i,e,t){t.actionBar.clear();let o=[];i.keybindingItem.keybinding?o.push(this.createEditAction(i)):o.push(this.createAddAction(i)),t.actionBar.push(o,{icon:!0})}createEditAction(i){return{class:q.asClassName(Jbo),enabled:!0,id:"editKeybinding",tooltip:this.keybindingsService.appendKeybinding(d(14120,null),JAe),run:()=>this.keybindingsEditor.defineKeybinding(i,!1)}}createAddAction(i){return{class:q.asClassName(Zbo),enabled:!0,id:"addKeybinding",tooltip:this.keybindingsService.appendKeybinding(d(14112,null),JAe),run:()=>this.keybindingsEditor.defineKeybinding(i,!1)}}disposeTemplate(i){i.actionBar.dispose()}};Sie=I([m(1,Le)],Sie);var Iie=class{constructor(i){this._hoverService=i;this.templateId=Iie.TEMPLATE_ID}static{this.TEMPLATE_ID="commands"}renderTemplate(i){let e=D(i,sI(".command")),t=this._hoverService.setupManagedHover(yi("mouse"),e,""),o=D(e,sI(".command-label")),n=new ul(o),r=D(e,sI(".command-default-label")),s=new ul(r),l=D(e,sI(".command-id.code")),c=new ul(l);return{commandColumn:e,commandColumnHover:t,commandLabelContainer:o,commandLabel:n,commandDefaultLabelContainer:r,commandDefaultLabel:s,commandIdLabelContainer:l,commandIdLabel:c}}renderElement(i,e,t){let o=i.keybindingItem,n=!!(o.commandLabel&&i.commandIdMatches),r=!!i.commandDefaultLabelMatches;t.commandColumn.classList.toggle("vertical-align-column",n||r);let s=o.commandLabel?d(14141,null,o.commandLabel,o.command):o.command;t.commandColumn.setAttribute("aria-label",s),t.commandColumnHover.update(s),o.commandLabel?(t.commandLabelContainer.classList.remove("hide"),t.commandLabel.set(o.commandLabel,i.commandLabelMatches)):(t.commandLabelContainer.classList.add("hide"),t.commandLabel.set(void 0)),i.commandDefaultLabelMatches?(t.commandDefaultLabelContainer.classList.remove("hide"),t.commandDefaultLabel.set(o.commandDefaultLabel,i.commandDefaultLabelMatches)):(t.commandDefaultLabelContainer.classList.add("hide"),t.commandDefaultLabel.set(void 0)),i.commandIdMatches||!o.commandLabel?(t.commandIdLabelContainer.classList.remove("hide"),t.commandIdLabel.set(o.command,i.commandIdMatches)):(t.commandIdLabelContainer.classList.add("hide"),t.commandIdLabel.set(void 0))}disposeTemplate(i){i.commandColumnHover.dispose(),i.commandDefaultLabel.dispose(),i.commandIdLabel.dispose(),i.commandLabel.dispose()}};Iie=I([m(0,ot)],Iie);var tKt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="keybindings"}renderTemplate(i){let e=D(i,sI(".keybinding"));return{keybindingLabel:new ah(D(e,sI("div.keybinding-label")),Ao,qk)}}renderElement(i,e,t){i.keybindingItem.keybinding?t.keybindingLabel.set(i.keybindingItem.keybinding,i.keybindingMatches):t.keybindingLabel.set(void 0,void 0)}disposeTemplate(i){i.keybindingLabel.dispose()}};function qrn(a,i){let e=new O;return e.add($(a,ne.CLICK,Nwe(i))),e.add($(a,ne.KEY_UP,t=>{let o=new mi(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var yie=class{constructor(i,e){this.extensionsWorkbenchService=i;this.hoverService=e;this.templateId=yie.TEMPLATE_ID}static{this.TEMPLATE_ID="source"}renderTemplate(i){let e=D(i,sI(".source")),t=this.hoverService.setupManagedHover(yi("mouse"),e,""),o=new ul(D(e,sI(".source-label"))),n=D(e,sI(".extension-container")),r=D(n,sI("a.extension-label",{tabindex:0})),s=new ul(D(n,sI(".extension-id-container.code")));return{sourceColumn:e,sourceColumnHover:t,sourceLabel:o,extensionLabel:r,extensionContainer:n,extensionId:s,disposables:new O}}renderElement(i,e,t){if(t.disposables.clear(),We(i.keybindingItem.source))t.extensionContainer.classList.add("hide"),t.sourceLabel.element.classList.remove("hide"),t.sourceColumnHover.update(""),t.sourceLabel.set(i.keybindingItem.source||"-",i.sourceMatches);else{t.extensionContainer.classList.remove("hide"),t.sourceLabel.element.classList.add("hide");let o=i.keybindingItem.source,n=o.displayName??o.identifier.value;t.sourceColumnHover.update(d(14123,null,n)),t.extensionLabel.textContent=n,t.disposables.add(qrn(t.extensionLabel,()=>{this.extensionsWorkbenchService.open(o.identifier.value)})),i.extensionIdMatches?(t.extensionId.element.classList.remove("hide"),t.extensionId.set(o.identifier.value,i.extensionIdMatches)):(t.extensionId.element.classList.add("hide"),t.extensionId.set(void 0))}}disposeTemplate(i){i.sourceColumnHover.dispose(),i.disposables.dispose(),i.sourceLabel.dispose(),i.extensionId.dispose()}};yie=I([m(0,Ui),m(1,ot)],yie);var ent=class extends k{constructor(e,t,o,n){super();this._onDidAccept=this._register(new T);this.onDidAccept=this._onDidAccept.event;this._onDidReject=this._register(new T);this.onDidReject=this._onDidReject.event;let r=wge.bindTo(n);this.input=this._register(o.createInstance(YN,"keyboardshortcutseditor#wheninput",e,{provideResults:()=>{let s=[];for(let l of Y.all())s.push({label:l.key,documentation:l.description,detail:l.type,kind:14});return s},triggerCharacters:["!"," "],wordDefinition:/[a-zA-Z.]+/,alwaysShowSuggestions:!0},"","keyboardshortcutseditor#wheninput",{focusContextKey:r,overflowWidgetsDomNode:t.overflowWidgetsDomNode})),this._register($(this.input.element,ne.DBLCLICK,s=>Kt.stop(s))),this._register(ee(()=>r.reset())),this._register(t.onAcceptWhenExpression(()=>this._onDidAccept.fire(this.input.getValue()))),this._register(U.any(t.onRejectWhenExpression,this.input.onDidBlur)(()=>this._onDidReject.fire()))}layout(e){this.input.layout(e)}show(e){this.input.setValue(e),this.input.focus(!0)}};ent=I([m(2,F),m(3,X)],ent);var wie=class{constructor(i,e,t){this.keybindingsEditor=i;this.hoverService=e;this.instantiationService=t;this.templateId=wie.TEMPLATE_ID}static{this.TEMPLATE_ID="when"}renderTemplate(i){let e=D(i,sI(".when")),t=D(e,sI("div.when-label")),o=new ul(t),n=D(e,sI("div.when-input-container"));return{element:e,whenLabelContainer:t,whenLabel:o,whenInputContainer:n,disposables:new O}}renderElement(i,e,t){t.disposables.clear();let o=t.disposables.add(new O);t.disposables.add(this.keybindingsEditor.onDefineWhenExpression(n=>{if(i===n){t.element.classList.add("input-mode");let r=o.add(this.instantiationService.createInstance(ent,t.whenInputContainer,this.keybindingsEditor));r.layout(new di(t.element.parentElement.clientWidth,18)),r.show(i.keybindingItem.when||"");let s=()=>{o.clear(),t.element.classList.remove("input-mode"),t.element.parentElement.style.paddingLeft="10px",St(t.whenInputContainer)};o.add(r.onDidAccept(l=>{s(),this.keybindingsEditor.updateKeybinding(i,i.keybindingItem.keybinding&&i.keybindingItem.keybinding.getUserSettingsLabel()||"",l),this.keybindingsEditor.selectKeybinding(i)})),o.add(r.onDidReject(()=>{s(),this.keybindingsEditor.selectKeybinding(i)})),t.element.parentElement.style.paddingLeft="0px"}})),t.whenLabelContainer.classList.toggle("code",!!i.keybindingItem.when),t.whenLabelContainer.classList.toggle("empty",!i.keybindingItem.when),i.keybindingItem.when?(t.whenLabel.set(i.keybindingItem.when,i.whenMatches,i.keybindingItem.when),t.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.element,i.keybindingItem.when))):t.whenLabel.set("-")}disposeTemplate(i){i.disposables.dispose(),i.whenLabel.dispose()}};wie=I([m(1,ot),m(2,F)],wie);var hRi=class{constructor(i){this.configurationService=i}getWidgetAriaLabel(){return d(14125,null)}getAriaLabel({keybindingItem:i}){let e=[i.commandLabel?i.commandLabel:i.command,i.keybinding?.getAriaLabel()||d(14128,null),i.when?i.when:d(14129,null),We(i.source)?i.source:i.source.description??i.source.identifier.value];if(this.configurationService.getValue("accessibility.verbosity.keybindingsEditor")){let t=d(14126,null);e.push(t)}return e.join(", ")}};te("keybindingTable.headerBackground",W3e,"Background color for the keyboard shortcuts table header.");te("keybindingTable.rowsBackground",W3e,"Background color for the keyboard shortcuts table alternating rows.");hs((a,i)=>{let e=a.getColor(xo);if(e){let p=e.transparent(.8).makeOpaque(_0(a));i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let t=a.getColor(ID),o=a.getColor(Kw);if(t&&o){let p=t.transparent(.8).makeOpaque(o);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row.selected .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let n=a.getColor(eyt),r=a.getColor(bv);if(n&&r){let p=n.transparent(.8).makeOpaque(r);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table .monaco-list-row.selected .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let s=a.getColor(FCe),l=a.getColor(lX);if(s&&l){let p=s.transparent(.8).makeOpaque(l);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row.focused .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}let c=a.getColor(WCe),u=a.getColor(ST);if(c&&u){let p=c.transparent(.8).makeOpaque(u);i.addRule(`.keybindings-editor > .keybindings-body > .keybindings-table-container .monaco-table.focused .monaco-list-row:hover:not(.focused):not(.selected) .monaco-table-tr .monaco-table-td .code { color: ${p}; }`)}});var fq=class extends it{constructor(e,t,o,n,r,s){super(e,t);this.modelService=o;this.languageService=n;this.quickInputService=r;this.preferencesService=s}static{this.ID="workbench.action.configureLanguageBasedSettings"}static{this.LABEL=P(14194,"Configure Language Specific Settings...")}async run(){let t=this.languageService.getSortedRegisteredLanguageNames().map(({languageName:o,languageId:n})=>{let r=d(14195,null,n),s,l=this.languageService.getExtensions(n);if(l.length)s=A.file(l[0]);else{let c=this.languageService.getFilenames(n);c.length&&(s=A.file(c[0]))}return{label:o,iconClasses:Ia(this.modelService,this.languageService,s),description:r}});await this.quickInputService.pick(t,{placeHolder:d(14196,null)}).then(o=>{if(o){let n=this.languageService.getLanguageIdByLanguageName(o.label);if(typeof n=="string")return this.preferencesService.openLanguageSpecificSettings(n)}})}};fq=I([m(2,_t),m(3,Rt),m(4,$e),m(5,Qo)],fq);Ge.registerCommand({id:"_getAllSettings",handler:()=>oe.as($t.Configuration).getConfigurationProperties()});Ge.registerCommand({id:"_developer.getConfigurationInformation",handler:async(a,i)=>{let e=oe.as($t.Configuration),t=a.get(ge),o=a.get(lt),n=a.get(Dd),r=a.get(As);await o.whenInstalledExtensionsRegistered();let l=(await n.getInstalled()).filter(g=>g.isBuiltin&&r.canChangeEnablement(g)&&!r.isEnabled(g));if(l.length){let g=new HS(l.map(b=>b.identifier.id));for(let b of o.extensions)g.delete(b.identifier);let f,v=g.size===0?Promise.resolve():new Promise(b=>{f=o.onDidChangeExtensions(({added:S})=>{for(let y of S)g.delete(y.identifier);g.size===0&&b()})});try{await r.setEnablement(l,12),await Promise.race([v,Li(15e3)])}finally{f?.dispose()}await o.whenInstalledExtensionsRegistered()}let c=e.getConfigurationProperties(),u=Object.fromEntries(Object.entries(c).map(([g,f])=>{let{defaultValueSource:v,...b}=f;return[g,b]})),p=JSON.stringify(u);if(!i)return p;let h=A.isUri(i)?i:/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(i)?A.parse(i):A.file(i);return await t.writeFile(h,Ke.fromString(p)),h}});Ge.registerCommand("_getAllCommands",function(a,i){let e=a.get(Le),t=a.get(X),o=[];for(let n of ml.getEditorActions()){let r=e.lookupKeybinding(n.id);i&&!t.contextMatchesRules(n.precondition)||o.push({command:n.id,label:n.label,description:d4(n.metadata?.description)?n.metadata.description.value:n.metadata?.description,precondition:n.precondition?.serialize(),keybinding:r?.getLabel()??"Not set"})}for(let n of be.getMenuItems(R.CommandPalette))if(cT(n)){if(i&&!t.contextMatchesRules(n.when))continue;let r=typeof n.command.title=="string"?n.command.title:n.command.title.value,s=n.command.category?typeof n.command.category=="string"?n.command.category:n.command.category.value:void 0,l=s?`${s}: ${r}`:r,c=d4(n.command.metadata?.description)?n.command.metadata.description.value:n.command.metadata?.description,u=e.lookupKeybinding(n.command.id);o.push({command:n.command.id,label:l,description:c,precondition:n.when?.serialize(),keybinding:u?.getLabel()??"Not set"})}return o});var iKt;(i=>i.PreferencesEditorPane="workbench.registry.preferences.editorPanes")(iKt||={});var gRi=class extends k{constructor(){super();this.descriptors=new Map;this._onDidRegisterPreferencesEditorPanes=this._register(new T);this.onDidRegisterPreferencesEditorPanes=this._onDidRegisterPreferencesEditorPanes.event;this._onDidDeregisterPreferencesEditorPanes=this._register(new T);this.onDidDeregisterPreferencesEditorPanes=this._onDidDeregisterPreferencesEditorPanes.event}registerPreferencesEditorPane(e){if(this.descriptors.has(e.id))throw new Error(`PreferencesEditorPane with id ${e.id} already registered`);return this.descriptors.set(e.id,e),this._onDidRegisterPreferencesEditorPanes.fire([e]),{dispose:()=>{this.descriptors.delete(e.id)&&this._onDidDeregisterPreferencesEditorPanes.fire([e])}}}getPreferencesEditorPanes(){return[...this.descriptors.values()].sort((e,t)=>e.order-t.order)}};oe.add(iKt.PreferencesEditorPane,new gRi);var fRi=class extends it{constructor(e,t){super(e.id,e.title,"",!0,t);this.descriptor=e}},SQ=class extends zs{constructor(e,t,o,n,r,s){super(SQ.ID,e,t,o,n);this.instantiationService=r;this.editorPanesRegistry=oe.as(iKt.PreferencesEditorPane);this.preferencesTabActions=[];this.preferencesEditorPane=this._register(new ue);this.searchFocusContextKey=Mbo.bindTo(s),this.element=_(".preferences-editor");let l=D(this.element,_(".preferences-editor-header")),c=D(l,_(".search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(vie,c,{focusKey:this.searchFocusContextKey,inputBoxStyles:MD({inputBorder:__})})),this._register(U.debounce(this.searchWidget.onDidChange,()=>{},300)(()=>{this.preferencesEditorPane.value?.search(this.searchWidget.getValue())}));let u=D(l,_(".preferences-tabs-container"));this.preferencesTabActionBar=this._register(new oo(u,{orientation:0,focusOnlyEnabledItems:!0,ariaLabel:d(14198,null),ariaRole:"tablist"})),this.onDidChangePreferencesEditorPane(this.editorPanesRegistry.getPreferencesEditorPanes(),[]),this._register(this.editorPanesRegistry.onDidRegisterPreferencesEditorPanes(p=>this.onDidChangePreferencesEditorPane(p,[]))),this._register(this.editorPanesRegistry.onDidDeregisterPreferencesEditorPanes(p=>this.onDidChangePreferencesEditorPane([],p))),this.bodyElement=D(this.element,_(".preferences-editor-body"))}static{this.ID="workbench.editor.preferences"}createEditor(e){D(e,this.element)}layout(e){this.dimension=e,this.searchWidget.layout(e),this.searchWidget.inputBox.inputElement.style.paddingRight="12px",this.preferencesEditorPane.value?.layout(new di(this.bodyElement.clientWidth,e.height-87))}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.preferencesTabActions.length&&this.onDidSelectPreferencesEditorPane(this.preferencesTabActions[0].id)}onDidChangePreferencesEditorPane(e,t){for(let o of t){let n=this.preferencesTabActions.findIndex(r=>r.id===o.id);n!==-1&&(this.preferencesTabActionBar.pull(n),this.preferencesTabActions[n].dispose(),this.preferencesTabActions.splice(n,1))}if(e.length>0){let o=this.editorPanesRegistry.getPreferencesEditorPanes();for(let n of e){let r=o.findIndex(s=>s.id===n.id);if(r!==-1){let s=new fRi(n,()=>this.onDidSelectPreferencesEditorPane(n.id));this.preferencesTabActions.splice(r,0,s),this.preferencesTabActionBar.push(s,{index:r})}}}}onDidSelectPreferencesEditorPane(e){let t;for(let o of this.preferencesTabActions)o.id===e?(o.checked=!0,t=o):o.checked=!1;t&&(this.searchWidget.inputBox.setPlaceHolder(d(14197,null,t.descriptor.title)),this.searchWidget.inputBox.setAriaLabel(d(14197,null,t.descriptor.title))),this.renderBody(t?.descriptor),this.dimension&&this.layout(this.dimension)}renderBody(e){if(this.preferencesEditorPane.value=void 0,St(this.bodyElement),e){let t=this.instantiationService.createInstance(e.ctorDescriptor.ctor);this.preferencesEditorPane.value=t,this.bodyElement.appendChild(t.getDomNode())}}dispose(){super.dispose(),this.preferencesTabActions.forEach(e=>e.dispose())}};SQ=I([m(1,_e),m(2,Pe),m(3,de),m(4,F),m(5,X)],SQ);var tnt=class extends ll{constructor(e){super();this.label=e;this._onClick=this._register(new T);this.onClick=this._onClick.event;this._domNode=_(".floating-click-widget"),this._domNode.style.padding="6px 11px",this._domNode.style.borderRadius="2px",this._domNode.style.cursor="pointer",this._domNode.style.zIndex="1"}getDomNode(){return this._domNode}render(){St(this._domNode),this._domNode.style.backgroundColor=tX(th,Tt(Bo)),this._domNode.style.color=tX(Fk,Tt(Vd)),this._domNode.style.border=`1px solid ${Tt(Ei)}`,D(this._domNode,_("")).textContent=this.label,this.onclick(this._domNode,()=>this._onClick.fire())}},_ge=class extends k{constructor(e,t,o){super();this.renderEmitter=this._register(new T);this.menu=this._register(t.createMenu(e,o))}get onDidRender(){return this.renderEmitter.event}render(){let e=this._register(new O),t=()=>{if(e.clear(),!this.isVisible())return;let o=Ng(this.menu.getActions({renderShortTitle:!0,shouldForwardArgs:!0}));if(o.length===0)return;let[n]=o,r=this.createWidget(n,e);e.add(r),e.add(r.onClick(()=>n.run(this.getActionArg()))),r.render()};this._register(this.menu.onDidChange(t)),t()}getActionArg(){}isVisible(){return!0}};_ge=I([m(1,Yt),m(2,X)],_ge);var cNe=class extends _ge{constructor(e,t,o,n){super(e.menuId,o,n);this.options=e;this.instantiationService=t;this.render()}createWidget(e,t){let o=this.instantiationService.createInstance(tnt,e.label),n=o.getDomNode();return this.options.container.appendChild(n),t.add(ee(()=>n.remove())),o}getActionArg(){return this.options.getActionArg()}};cNe=I([m(1,F),m(2,Yt),m(3,X)],cNe);var $W=class extends k{constructor(e){super();this.editorService=e;this._onHighlightRemoved=this._register(new T);this.onHighlightRemoved=this._onHighlightRemoved.event;this.rangeHighlightDecorationId=null;this.editor=null;this.editorDisposables=this._register(new O)}removeHighlightRange(){if(this.editor&&this.rangeHighlightDecorationId){let e=this.rangeHighlightDecorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e)}),this._onHighlightRemoved.fire()}this.rangeHighlightDecorationId=null}highlightRange(e,t){t=t??this.getEditor(e),fn(t)?this.doHighlightRange(t,e):CF(t)&&fn(t.activeCodeEditor)&&this.doHighlightRange(t.activeCodeEditor,e)}doHighlightRange(e,t){this.removeHighlightRange(),e.changeDecorations(o=>{this.rangeHighlightDecorationId=o.addDecoration(t.range,this.createRangeHighlightDecoration(t.isWholeLine))}),this.setEditor(e)}getEditor(e){let t=this.editorService.activeEditor?.resource;if(t&&ze(t,e.resource)&&fn(this.editorService.activeTextEditorControl))return this.editorService.activeTextEditorControl}setEditor(e){this.editor!==e&&(this.editorDisposables.clear(),this.editor=e,this.editorDisposables.add(this.editor.onDidChangeCursorPosition(t=>{(t.reason===0||t.reason===3||t.reason===5||t.reason===6)&&this.removeHighlightRange()})),this.editorDisposables.add(this.editor.onDidChangeModel(()=>{this.removeHighlightRange()})),this.editorDisposables.add(this.editor.onDidDispose(()=>{this.removeHighlightRange(),this.editor=null})))}static{this._WHOLE_LINE_RANGE_HIGHLIGHT=So.register({description:"codeeditor-range-highlight-whole",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._RANGE_HIGHLIGHT=So.register({description:"codeeditor-range-highlight",stickiness:1,className:"rangeHighlight"})}createRangeHighlightDecoration(e=!0){return e?$W._WHOLE_LINE_RANGE_HIGHLIGHT:$W._RANGE_HIGHLIGHT}dispose(){super.dispose(),this.editor?.getModel()&&(this.removeHighlightRange(),this.editor=null)}};$W=I([m(0,ie)],$W);var Dge=class extends tnt{constructor(e,t,o,n){super(n.appendKeybinding(t,o));this.editor=e}getId(){return"editor.overlayWidget.floatingClickWidget"}getPosition(){return{preference:1}}render(){super.render(),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}};Dge=I([m(3,Le)],Dge);var Cie=class extends _ge{constructor(e,t,o,n){super(R.EditorContent,o,n);this.editor=e;this.instantiationService=t;this.render()}static{this.ID="editor.contrib.floatingClickMenu"}createWidget(e){return this.instantiationService.createInstance(Dge,this.editor,e.label,e.id)}isVisible(){return!(this.editor instanceof Ed)&&this.editor?.hasModel()&&!this.editor.getOption(70)}getActionArg(){return this.editor.getModel()?.uri}};Cie=I([m(1,F),m(2,Yt),m(3,X)],Cie);var vRi=d(18769,null),bRi=d(18774,null),aSo=d(18768,null),lSo=d(18767,null),dNe={definitions:{inputs:{type:"array",description:d(18778,null),items:{oneOf:[{type:"object",required:["id","type","description"],additionalProperties:!1,properties:{id:{type:"string",description:vRi},type:{type:"string",description:bRi,enum:["promptString"],enumDescriptions:[d(18777,null)]},description:{type:"string",description:aSo},default:{type:"string",description:lSo},password:{type:"boolean",description:d(18771,null)}}},{type:"object",required:["id","type","description","options"],additionalProperties:!1,properties:{id:{type:"string",description:vRi},type:{type:"string",description:bRi,enum:["pickString"],enumDescriptions:[d(18776,null)]},description:{type:"string",description:aSo},default:{type:"string",description:lSo},options:{type:"array",description:d(18770,null),items:{oneOf:[{type:"string"},{type:"object",required:["value"],additionalProperties:!1,properties:{label:{type:"string",description:d(18772,null)},value:{type:"string",description:d(18773,null)}}}]}}}},{type:"object",required:["id","type","command"],additionalProperties:!1,properties:{id:{type:"string",description:vRi},type:{type:"string",description:bRi,enum:["command"],enumDescriptions:[d(18775,null)]},command:{type:"string",description:d(18766,null)},args:{oneOf:[{type:"object",description:d(18765,null)},{type:"array",description:d(18765,null)},{type:"string",description:d(18765,null)}]}}}]}}}};var $rn="onMcpCollection:",int=a=>$rn+a;var uNe=Object.keys({"claude-desktop":!0,windsurf:!0,"cursor-global":!0,"cursor-workspace":!0}),dSo={"claude-desktop":d(13208,null),windsurf:d(13214,null),"cursor-global":d(13210,null),"cursor-workspace":d(13212,null)},uSo={"claude-desktop":d(13209,null),windsurf:d(13215,null),"cursor-global":d(13211,null),"cursor-workspace":d(13213,null)},jW="mcp",xie="chat.mcp.discovery.enabled",ont="chat.mcp.serverSampling",oKt="chat.mcp.collisionBehavior";var pSo={"mcp-server-time":{command:"python",args:["-m","mcp_server_time","--local-timezone=America/Los_Angeles"],env:{}}},cSo={"my-mcp-server":{url:"http://localhost:3001/mcp",headers:{}}},mSo=a=>({dev:{type:"object",markdownDescription:d(13181,null),examples:[{watch:"src/**/*.ts",debug:{type:"node"}}],properties:{watch:{description:d(13186,null),examples:["src/**/*.ts"],oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},...a&&{debug:{markdownDescription:d(13182,null),oneOf:[{type:"object",required:["type"],properties:{type:{type:"string",enum:["node"],description:d(13184,null)}},additionalProperties:!1},{type:"object",required:["type"],properties:{type:{type:"string",enum:["debugpy"],description:d(13185,null)},debugpyPath:{type:"string",description:d(13183,null)}},additionalProperties:!1}]}}}}}),nnt={type:"object",additionalProperties:!1,examples:[pSo["mcp-server-time"]],properties:{type:{type:"string",enum:["stdio"],description:d(13204,null)},sandboxEnabled:{type:"boolean",default:!1,description:d(13202,null)},command:{type:"string",description:d(13189,null)},cwd:{type:"string",description:d(13190,null),examples:["${workspaceFolder}"]},args:{type:"array",description:d(13180,null),items:{type:"string"}},envFile:{type:"string",description:d(13188,null),examples:["${workspaceFolder}/.env"]},env:{description:d(13187,null),additionalProperties:{anyOf:[{type:"null"},{type:"string"},{type:"number"}]}},...mSo(!0)}},hSo={id:VMe,type:"object",title:d(13203,null),allowTrailingCommas:!0,allowComments:!0,additionalProperties:!1,properties:{sandbox:{description:d(13194,null),type:"object",additionalProperties:!1,properties:{network:{description:d(13199,null),type:"object",additionalProperties:!1,properties:{allowedDomains:{description:d(13200,null),type:"array",items:{type:"string"},default:[]},deniedDomains:{description:d(13201,null),type:"array",items:{type:"string"},default:[]}}},filesystem:{description:d(13195,null),type:"object",additionalProperties:!1,properties:{denyRead:{description:d(13197,null),type:"array",items:{type:"string"},default:[]},allowWrite:{description:d(13196,null),type:"array",items:{type:"string"},default:[]},denyWrite:{description:d(13198,null),type:"array",items:{type:"string"},default:[]}}}}},servers:{examples:[pSo,cSo],additionalProperties:{oneOf:[nnt,{type:"object",additionalProperties:!1,required:["url"],examples:[cSo["my-mcp-server"]],properties:{type:{type:"string",enum:["http","sse"],description:d(13204,null)},url:{type:"string",format:"uri",pattern:"^https?:\\/\\/.+",patternErrorMessage:d(13206,null),description:d(13205,null)},headers:{type:"object",description:d(13191,null),additionalProperties:{type:"string"}},oauth:{type:"object",description:d(13192,null),additionalProperties:!1,minProperties:1,properties:{clientId:{type:"string",minLength:1,description:d(13193,null)}}},...mSo(!1)}}]}},inputs:dNe.definitions.inputs}},gSo={extensionPoint:"mcpServerDefinitionProviders",activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield int(i.id))},jsonSchema:{description:d(13218,null),type:"array",defaultSnippets:[{body:[{id:"",label:""}]}],items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{id:"",label:""}}],properties:{id:{description:d(13219,null),type:"string"},label:{description:d(13220,null),type:"string"},when:{description:d(13221,null),type:"string"}}}}},SRi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.mcpServerDefinitionProviders&&Array.isArray(e.contributes.mcpServerDefinitionProviders)&&e.contributes.mcpServerDefinitionProviders.length>0}render(e){let t=e.contributes?.mcpServerDefinitionProviders??[],o=[d(13207,null),d(13217,null)],n=t.map(r=>[new he().appendMarkdown(`\`${r.id}\``),r.label]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:jW,label:d(13216,null),access:{canToggle:!1},renderer:new Vt(SRi)});var Rge=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.preferencesModel=t;this.preferencesService=o;this.configurationService=n;this.instantiationService=r;this.modelChangeDelayer=this._register(new rn(200));this.settingHighlighter=this._register(r.createInstance(snt,e)),this.editSettingActionRenderer=this._register(this.instantiationService.createInstance(rnt,this.editor,this.preferencesModel,this.settingHighlighter)),this._register(this.editSettingActionRenderer.onUpdateSetting(({key:s,value:l,source:c})=>this.updatePreference(s,l,c))),this._register(this.editor.getModel().onDidChangeContent(()=>this.modelChangeDelayer.trigger(()=>this.onModelChanged()))),this.unsupportedSettingsRenderer=this._register(r.createInstance(ant,e,t)),this.mcpSettingsRenderer=this._register(r.createInstance(lnt,e,t))}render(){this.editSettingActionRenderer.render(this.preferencesModel.settingsGroups,this.associatedPreferencesModel),this.unsupportedSettingsRenderer.render(),this.mcpSettingsRenderer.render()}updatePreference(e,t,o){let n=o.overrideOf?Hz(o.overrideOf.key):null,r=this.preferencesModel.uri;this.configurationService.updateValue(e,t,{overrideIdentifiers:n,resource:r},this.preferencesModel.configurationTarget).then(()=>this.onSettingUpdated(o))}onModelChanged(){this.editor.hasModel()&&this.render()}onSettingUpdated(e){this.editor.focus(),e=this.getSetting(e),e&&(this.editor.setSelection(e.valueRange),this.settingHighlighter.highlight(e,!0))}getSetting(e){let{key:t,overrideOf:o}=e;if(o){let n=this.getSetting(o);for(let r of n.overrides)if(r.key===t)return r;return}return this.preferencesModel.getPreference(t)}focusPreference(e){let t=this.getSetting(e);t?(this.settingHighlighter.highlight(t,!0),this.editor.setPosition({lineNumber:t.keyRange.startLineNumber,column:t.keyRange.startColumn})):this.settingHighlighter.clear(!0)}clearFocus(e){this.settingHighlighter.clear(!0)}editPreference(e){let t=this.getSetting(e);return!!(t&&this.editSettingActionRenderer.activateOnSetting(t))}};Rge=I([m(2,Qo),m(3,B),m(4,F)],Rge);var pNe=class extends Rge{constructor(i,e,t,o,n){super(i,e,t,o,n),this.workspaceConfigurationRenderer=this._register(n.createInstance(kie,i,e))}render(){super.render(),this.workspaceConfigurationRenderer.render()}};pNe=I([m(2,Qo),m(3,B),m(4,F)],pNe);var rnt=class extends k{constructor(e,t,o,n,r,s){super();this.editor=e;this.primarySettingsModel=t;this.settingHighlighter=o;this.configurationService=n;this.instantiationService=r;this.contextMenuService=s;this.settingsGroups=[];this._onUpdateSetting=this._register(new T);this.onUpdateSetting=this._onUpdateSetting.event;this.editPreferenceWidgetForCursorPosition=this._register(this.instantiationService.createInstance(Yot,e)),this.editPreferenceWidgetForMouseMove=this._register(this.instantiationService.createInstance(Yot,e)),this.toggleEditPreferencesForMouseMoveDelayer=this._register(new rn(75)),this._register(this.editPreferenceWidgetForCursorPosition.onClick(l=>this.onEditSettingClicked(this.editPreferenceWidgetForCursorPosition,l))),this._register(this.editPreferenceWidgetForMouseMove.onClick(l=>this.onEditSettingClicked(this.editPreferenceWidgetForMouseMove,l))),this._register(this.editor.onDidChangeCursorPosition(l=>this.onPositionChanged(l))),this._register(this.editor.onMouseMove(l=>this.onMouseMoved(l))),this._register(this.editor.onDidChangeConfiguration(()=>this.onConfigurationChanged()))}render(e,t){this.editPreferenceWidgetForCursorPosition.hide(),this.editPreferenceWidgetForMouseMove.hide(),this.settingsGroups=e,this.associatedPreferencesModel=t;let o=this.getSettings(this.editor.getPosition().lineNumber);o.length&&this.showEditPreferencesWidget(this.editPreferenceWidgetForCursorPosition,o)}isDefaultSettings(){return this.primarySettingsModel instanceof ZPe}onConfigurationChanged(){this.editor.getOption(66)||(this.editPreferenceWidgetForCursorPosition.hide(),this.editPreferenceWidgetForMouseMove.hide())}onPositionChanged(e){this.editPreferenceWidgetForMouseMove.hide();let t=this.getSettings(e.position.lineNumber);t.length?this.showEditPreferencesWidget(this.editPreferenceWidgetForCursorPosition,t):this.editPreferenceWidgetForCursorPosition.hide()}onMouseMoved(e){let t=this.getEditPreferenceWidgetUnderMouse(e);if(t){this.onMouseOver(t);return}this.settingHighlighter.clear(),this.toggleEditPreferencesForMouseMoveDelayer.trigger(()=>this.toggleEditPreferenceWidgetForMouseMove(e))}getEditPreferenceWidgetUnderMouse(e){if(e.target.type===2){let t=e.target.position.lineNumber;if(this.editPreferenceWidgetForMouseMove.getLine()===t&&this.editPreferenceWidgetForMouseMove.isVisible())return this.editPreferenceWidgetForMouseMove;if(this.editPreferenceWidgetForCursorPosition.getLine()===t&&this.editPreferenceWidgetForCursorPosition.isVisible())return this.editPreferenceWidgetForCursorPosition}}toggleEditPreferenceWidgetForMouseMove(e){let t=e.target.position?this.getSettings(e.target.position.lineNumber):null;t&&t.length?this.showEditPreferencesWidget(this.editPreferenceWidgetForMouseMove,t):this.editPreferenceWidgetForMouseMove.hide()}showEditPreferencesWidget(e,t){let o=t[0].valueRange.startLineNumber;this.editor.getOption(66)&&this.marginFreeFromOtherDecorations(o)&&(e.show(o,d(14215,null),t),(e===this.editPreferenceWidgetForCursorPosition?this.editPreferenceWidgetForMouseMove:this.editPreferenceWidgetForCursorPosition).hide())}marginFreeFromOtherDecorations(e){let t=this.editor.getLineDecorations(e);if(t){for(let{options:o}of t)if(o.glyphMarginClassName&&o.glyphMarginClassName.indexOf(q.asClassName(Ege))===-1)return!1}return!0}getSettings(e){let t=this.getConfigurationsMap();return this.getSettingsAtLineNumber(e).filter(o=>{let n=t[o.key];if(n){if(n.policy&&this.configurationService.inspect(o.key).policyValue!==void 0)return!1;if(this.isDefaultSettings())return o.key!=="launch";if((n.type==="boolean"||n.enum)&&(this.primarySettingsModel.configurationTarget!==6||n.scope===5||n.scope===6))return!0}return!1})}getSettingsAtLineNumber(e){let t=0,o=[];for(let n of this.settingsGroups){if(n.range.startLineNumber>e)break;if(e>=n.range.startLineNumber&&e<=n.range.endLineNumber)for(let r of n.sections)for(let s of r.settings){if(s.range.startLineNumber>e)break;if(e>=s.range.startLineNumber&&e<=s.range.endLineNumber)if(!this.isDefaultSettings()&&s.overrides.length)for(let l of s.overrides)e>=l.range.startLineNumber&&e<=l.range.endLineNumber&&o.push({...l,index:t,groupId:n.id});else o.push({...s,index:t,groupId:n.id});t++}}return o}onMouseOver(e){this.settingHighlighter.highlight(e.preferences[0])}onEditSettingClicked(e,t){Kt.stop(t.event,!0);let o=this.getSettings(e.getLine()).length===1?this.getActions(e.preferences[0],this.getConfigurationsMap()[e.preferences[0].key]):e.preferences.map(n=>new sa(`preferences.submenu.${n.key}`,n.key,this.getActions(n,this.getConfigurationsMap()[n.key])));this.contextMenuService.showContextMenu({getAnchor:()=>t.event,getActions:()=>o})}activateOnSetting(e){let t=e.keyRange.startLineNumber,o=this.getSettings(t);if(!o.length)return!1;this.editPreferenceWidgetForMouseMove.show(t,"",o);let n=this.getActions(this.editPreferenceWidgetForMouseMove.preferences[0],this.getConfigurationsMap()[this.editPreferenceWidgetForMouseMove.preferences[0].key]);return this.contextMenuService.showContextMenu({getAnchor:()=>this.toAbsoluteCoords(new ye(t,1)),getActions:()=>n}),!0}toAbsoluteCoords(e){let t=this.editor.getScrolledVisiblePosition(e),o=ur(this.editor.getDomNode()),n=o.left+t.left,r=o.top+t.top+t.height;return{x:n,y:r+10}}getConfigurationsMap(){return oe.as($t.Configuration).getConfigurationProperties()}getActions(e,t){return t.type==="boolean"?[{id:"truthyValue",label:"true",tooltip:"true",enabled:!0,run:()=>this.updateSetting(e.key,!0,e),class:void 0},{id:"falsyValue",label:"false",tooltip:"false",enabled:!0,run:()=>this.updateSetting(e.key,!1,e),class:void 0}]:t.enum?t.enum.map(o=>({id:o,label:JSON.stringify(o),tooltip:JSON.stringify(o),enabled:!0,run:()=>this.updateSetting(e.key,o,e),class:void 0})):this.getDefaultActions(e)}getDefaultActions(e){if(this.isDefaultSettings()){let t=this.associatedPreferencesModel.getPreference(e.key);return[{id:"setDefaultValue",label:t?d(14221,null):d(14213,null),tooltip:t?d(14221,null):d(14213,null),enabled:!0,run:()=>this.updateSetting(e.key,e.value,e),class:void 0}]}return[]}updateSetting(e,t,o){this._onUpdateSetting.fire({key:e,value:t,source:o})}};rnt=I([m(3,B),m(4,F),m(5,Xe)],rnt);var snt=class extends k{constructor(e,t){super();this.editor=e;this.fixedHighlighter=this._register(t.createInstance($W)),this.volatileHighlighter=this._register(t.createInstance($W))}highlight(e,t=!1){this.volatileHighlighter.removeHighlightRange(),this.fixedHighlighter.removeHighlightRange(),(t?this.fixedHighlighter:this.volatileHighlighter).highlightRange({range:e.valueRange,resource:this.editor.getModel().uri},this.editor),this.editor.revealLineInCenterIfOutsideViewport(e.valueRange.startLineNumber,0)}clear(e=!1){this.volatileHighlighter.removeHighlightRange(),e&&this.fixedHighlighter.removeHighlightRange()}};snt=I([m(1,F)],snt);var ant=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editor=e;this.settingsEditorModel=t;this.markerService=o;this.environmentService=n;this.configurationService=r;this.workspaceTrustManagementService=s;this.uriIdentityService=l;this.userDataProfileService=u;this.userDataProfilesService=p;this.renderingDelayer=this._register(new rn(200));this.codeActions=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this._register(this.editor.getModel().onDidChangeContent(()=>this.delayedRender())),this._register(U.filter(this.configurationService.onDidChangeConfiguration,h=>h.source===7)(()=>this.delayedRender())),this._register(c.codeActionProvider.register({pattern:t.uri.path},this)),this._register(u.onDidChangeCurrentProfile(()=>this.delayedRender()))}delayedRender(){this.renderingDelayer.trigger(()=>this.render())}render(){this.codeActions.clear();let e=this.generateMarkerData();e.length?this.markerService.changeOne("UnsupportedSettingsRenderer",this.settingsEditorModel.uri,e):this.markerService.remove("UnsupportedSettingsRenderer",[this.settingsEditorModel.uri])}async provideCodeActions(e,t,o,n){let r=[],s=this.codeActions.get(e.uri);if(s)for(let[l,c]of s)l.containsRange(t)&&r.push(...c);return{actions:r,dispose:()=>{}}}generateMarkerData(){let e=[],t=oe.as($t.Configuration).getConfigurationProperties();for(let o of this.settingsEditorModel.settingsGroups)for(let n of o.sections)for(let r of n.settings){if(af.test(r.key)){r.overrides&&this.handleOverrides(r.overrides,t,e);continue}let s=t[r.key];if(s){if(this.handleUnstableSettingConfiguration(r,s,e),this.handlePolicyConfiguration(r,s,e))continue;switch(this.settingsEditorModel.configurationTarget){case 3:this.handleLocalUserConfiguration(r,s,e);break;case 4:this.handleRemoteUserConfiguration(r,s,e);break;case 5:this.handleWorkspaceConfiguration(r,s,e);break;case 6:this.handleWorkspaceFolderConfiguration(r,s,e);break}}else e.push(this.generateUnknownConfigurationMarker(r))}return e}handlePolicyConfiguration(e,t,o){return!t.policy||this.configurationService.inspect(e.key).policyValue===void 0||this.settingsEditorModel.configurationTarget===7?!1:(o.push({severity:1,tags:[1],...e.range,message:d(14225,null)}),!0)}handleOverrides(e,t,o){for(let n of e||[]){let r=t[n.key];r?r.scope!==6&&o.push({severity:1,tags:[1],...n.range,message:d(14229,null)}):o.push(this.generateUnknownConfigurationMarker(n))}}handleLocalUserConfiguration(e,t,o){!this.userDataProfileService.currentProfile.isDefault&&!this.userDataProfileService.currentProfile.useDefaultFlags?.settings&&(ze(this.userDataProfilesService.defaultProfile.settingsResource,this.settingsEditorModel.uri)&&!this.configurationService.isSettingAppliedForAllProfiles(e.key)?o.push({severity:1,tags:[1],...e.range,message:d(14214,null)}):ze(this.userDataProfileService.currentProfile.settingsResource,this.settingsEditorModel.uri)&&(t.scope&&MC.includes(t.scope)?o.push(this.generateUnsupportedApplicationSettingMarker(e)):this.configurationService.isSettingAppliedForAllProfiles(e.key)&&o.push({severity:1,tags:[1],...e.range,message:d(14212,null,gw)}))),this.environmentService.remoteAuthority&&(t.scope===2||t.scope===3||t.scope===7)&&o.push({severity:1,tags:[1],...e.range,message:d(14227,null)})}handleRemoteUserConfiguration(e,t,o){t.scope===1&&o.push(this.generateUnsupportedApplicationSettingMarker(e))}handleWorkspaceConfiguration(e,t,o){if(t.scope&&MC.includes(t.scope)&&o.push(this.generateUnsupportedApplicationSettingMarker(e)),t.scope===2&&o.push(this.generateUnsupportedMachineSettingMarker(e)),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&t.restricted){let n=this.generateUntrustedSettingMarker(e);o.push(n);let r=this.generateUntrustedSettingCodeActions([n]);this.addCodeActions(n,r)}}handleWorkspaceFolderConfiguration(e,t,o){if(t.scope&&MC.includes(t.scope)&&o.push(this.generateUnsupportedApplicationSettingMarker(e)),t.scope===2&&o.push(this.generateUnsupportedMachineSettingMarker(e)),t.scope===4&&o.push({severity:1,tags:[1],...e.range,message:d(14228,null)}),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&t.restricted){let n=this.generateUntrustedSettingMarker(e);o.push(n);let r=this.generateUntrustedSettingCodeActions([n]);this.addCodeActions(n,r)}}handleUnstableSettingConfiguration(e,t,o){t.tags?.includes("preview")?o.push(this.generatePreviewSettingMarker(e)):t.tags?.includes("experimental")&&o.push(this.generateExperimentalSettingMarker(e))}generateUnsupportedApplicationSettingMarker(e){return{severity:1,tags:[1],...e.range,message:d(14223,null)}}generateUnsupportedMachineSettingMarker(e){return{severity:1,tags:[1],...e.range,message:d(14224,null)}}generateUntrustedSettingMarker(e){return{severity:4,...e.range,message:d(14230,null)}}generateUnknownConfigurationMarker(e){return{severity:1,tags:[1],...e.range,message:d(14222,null)}}generateUntrustedSettingCodeActions(e){return[{title:d(14216,null),command:{id:"workbench.trust.manage",title:d(14216,null)},diagnostics:e,kind:Nr.QuickFix.value}]}generatePreviewSettingMarker(e){return{severity:1,...e.range,message:Qzt}}generateExperimentalSettingMarker(e){return{severity:1,...e.range,message:Yzt}}addCodeActions(e,t){let o=this.codeActions.get(this.settingsEditorModel.uri);o||(o=[],this.codeActions.set(this.settingsEditorModel.uri,o)),o.push([G.lift(e),t])}dispose(){this.markerService.remove("UnsupportedSettingsRenderer",[this.settingsEditorModel.uri]),this.codeActions.clear(),super.dispose()}};ant=I([m(2,ha),m(3,Mt),m(4,Yg),m(5,Or),m(6,gt),m(7,Jt),m(8,gn),m(9,hn)],ant);var lnt=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.settingsEditorModel=t;this.markerService=o;this.uriIdentityService=n;this.renderingDelayer=this._register(new rn(200));this.codeActions=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this._register(this.editor.getModel().onDidChangeContent(()=>this.delayedRender())),this._register(r.codeActionProvider.register({pattern:t.uri.path},this))}delayedRender(){this.renderingDelayer.trigger(()=>this.render())}render(){this.codeActions.clear();let e=this.generateMarkerData();e.length?this.markerService.changeOne("McpSettingsRenderer",this.settingsEditorModel.uri,e):this.markerService.remove("McpSettingsRenderer",[this.settingsEditorModel.uri])}async provideCodeActions(e,t,o,n){let r=[],s=this.codeActions.get(e.uri);if(s)for(let[l,c]of s)l.containsRange(t)&&r.push(...c);return{actions:r,dispose:()=>{}}}generateMarkerData(){let e=[];if(this.settingsEditorModel.configurationTarget!==3&&this.settingsEditorModel.configurationTarget!==4)return e;for(let t of this.settingsEditorModel.settingsGroups)for(let o of t.sections)for(let n of o.settings)if(n.key===jW){let r=this.generateMcpConfigurationMarker(n);e.push(r);let s=this.generateMcpConfigurationCodeActions([r]);this.addCodeActions(n.range,s)}return e}generateMcpConfigurationMarker(e){let o=this.settingsEditorModel.configurationTarget===4?d(14219,null):d(14220,null);return{severity:4,...e.range,message:o}}generateMcpConfigurationCodeActions(e){let t=this.settingsEditorModel.configurationTarget===4,o=t?d(14217,null):d(14218,null),n=t?"workbench.mcp.openRemoteUserMcpJson":"workbench.mcp.openUserMcpJson";return[{title:o,command:{id:n,title:o},diagnostics:e,kind:Nr.QuickFix.value}]}addCodeActions(e,t){let o=this.codeActions.get(this.settingsEditorModel.uri);o||(o=[],this.codeActions.set(this.settingsEditorModel.uri,o)),o.push([G.lift(e),t])}dispose(){this.markerService.remove("McpSettingsRenderer",[this.settingsEditorModel.uri]),this.codeActions.clear(),super.dispose()}};lnt=I([m(2,ha),m(3,gt),m(4,Jt)],lnt);var kie=class extends k{constructor(e,t,o,n){super();this.editor=e;this.workspaceSettingsEditorModel=t;this.workspaceContextService=o;this.markerService=n;this.renderingDelayer=this._register(new rn(200));this.decorations=this.editor.createDecorationsCollection(),this._register(this.editor.getModel().onDidChangeContent(()=>this.renderingDelayer.trigger(()=>this.render())))}static{this.supportedKeys=["folders","tasks","launch","extensions","settings","remoteAuthority","transient"]}render(){let e=[];if(this.workspaceContextService.getWorkbenchState()===3&&this.workspaceSettingsEditorModel instanceof qhe){let t=[];for(let o of this.workspaceSettingsEditorModel.configurationGroups)for(let n of o.sections)for(let r of n.settings)kie.supportedKeys.includes(r.key)||e.push({severity:1,tags:[1],...r.range,message:d(14226,null)});this.decorations.set(t.map(o=>this.createDecoration(o)))}e.length?this.markerService.changeOne("WorkspaceConfigurationRenderer",this.workspaceSettingsEditorModel.uri,e):this.markerService.remove("WorkspaceConfigurationRenderer",[this.workspaceSettingsEditorModel.uri])}static{this._DIM_CONFIGURATION_=So.register({description:"dim-configuration",stickiness:1,inlineClassName:"dim-configuration"})}createDecoration(e){return{range:e,options:kie._DIM_CONFIGURATION_}}dispose(){this.markerService.remove("WorkspaceConfigurationRenderer",[this.workspaceSettingsEditorModel.uri]),this.decorations.clear(),super.dispose()}};kie=I([m(2,Ae),m(3,ha)],kie);var jrn=["editor.fontSize","editor.formatOnSave","files.autoSave","GitHub.copilot-chat.manageExtension","editor.defaultFormatter","editor.fontFamily","editor.wordWrap","chat.agent.maxRequests","files.exclude","workbench.colorTheme","editor.tabSize","editor.mouseWheelZoom","editor.formatOnPaste"];function fSo(a){let i=new Map;for(let t of a)for(let o of t.sections)for(let n of o.settings)i.set(n.key,n);let e=[];for(let t of jrn){let o=i.get(t);o&&e.push(o)}return{id:"commonlyUsed",label:d(14307,null),settings:e}}var cnt={id:"root",label:"root",children:[{id:"editor",label:d(14344,null),settings:["editor.*"],children:[{id:"editor/cursor",label:d(14308,null),settings:["editor.cursor*"]},{id:"editor/find",label:d(14317,null),settings:["editor.find.*"]},{id:"editor/font",label:d(14318,null),settings:["editor.font*"]},{id:"editor/format",label:d(14319,null),settings:["editor.format*"]},{id:"editor/diffEditor",label:d(14310,null),settings:["diffEditor.*"]},{id:"editor/multiDiffEditor",label:d(14324,null),settings:["multiDiffEditor.*"]},{id:"editor/minimap",label:d(14323,null),settings:["editor.minimap.*"]},{id:"editor/suggestions",label:d(14339,null),settings:["editor.*suggest*"]},{id:"editor/files",label:d(14316,null),settings:["files.*"]}]},{id:"workbench",label:d(14348,null),settings:["workbench.*"],children:[{id:"workbench/appearance",label:d(14293,null),settings:["workbench.activityBar.*","workbench.*color*","workbench.fontAliasing","workbench.iconTheme","workbench.sidebar.location","workbench.*.visible","workbench.tips.enabled","workbench.tree.*","workbench.view.*"]},{id:"workbench/breadcrumbs",label:d(14295,null),settings:["breadcrumbs.*"]},{id:"workbench/editor",label:d(14311,null),settings:["workbench.editor.*"]},{id:"workbench/settings",label:d(14337,null),settings:["workbench.settings.*"]},{id:"workbench/zenmode",label:d(14350,null),settings:["zenmode.*"]},{id:"workbench/screencastmode",label:d(14334,null),settings:["screencastMode.*"]},{id:"workbench/browser",label:d(14296,null),settings:["workbench.browser.*"]}]},{id:"window",label:d(14347,null),settings:["window.*"],children:[{id:"window/newWindow",label:d(14326,null),settings:["window.*newwindow*"]}]},{id:"chat",label:d(14297,null),children:[{id:"chat/agent",label:d(14298,null),settings:["chat.agent.*","chat.checkpoints.*","chat.editRequests","chat.requestQueuing.*","chat.undoRequests.*","chat.customAgentInSubagent.*","chat.editing.autoAcceptDelay","chat.editing.confirmEditRequest*","chat.planAgent.defaultModel"]},{id:"chat/appearance",label:d(14299,null),settings:["chat.editor.*","chat.fontFamily","chat.fontSize","chat.math.*","chat.agentsControl.*","chat.alternativeToolAction.*","chat.codeBlock.*","chat.editing.explainChanges.enabled","chat.editMode.hidden","chat.editorAssociations","chat.extensionUnification.*","chat.inlineReferences.*","chat.notifyWindow*","chat.statusWidget.*","chat.tips.*","chat.unifiedAgentsBar.*","accessibility.signals.chatUserActionRequired","accessibility.signals.chatResponseReceived"]},{id:"chat/sessions",label:d(14304,null),settings:["chat.agentSessionProjection.*","chat.sessions.*","chat.viewProgressBadge.*","chat.viewSessions.*","chat.restoreLastPanelSession","chat.exitAfterDelegation","chat.repoInfo.*"]},{id:"chat/tools",label:d(14305,null),settings:["chat.tools.*","chat.extensionTools.*"]},{id:"chat/mcp",label:d(14302,null),settings:["mcp","chat.mcp.*","mcp.*"]},{id:"chat/context",label:d(14300,null),settings:["chat.detectParticipant.*","chat.experimental.detectParticipant.*","chat.implicitContext.*","chat.promptFilesLocations","chat.instructionsFilesLocations","chat.modeFilesLocations","chat.agentFilesLocations","chat.agentSkillsLocations","chat.hookFilesLocations","chat.promptFilesRecommendations","chat.useAgentsMdFile","chat.useNestedAgentsMdFiles","chat.useAgentSkills","chat.experimental.useSkillAdherencePrompt","chat.useHooks","chat.includeApplyingInstructions","chat.includeReferencedInstructions","chat.sendElementsToChat.*","chat.useClaudeMdFile"]},{id:"chat/inlineChat",label:d(14301,null),settings:["inlineChat.*"]},{id:"chat/miscellaneous",label:d(14303,null),settings:["chat.disableAIFeatures","chat.allowAnonymousAccess"]}]},{id:"features",label:d(14314,null),children:[{id:"features/accessibilitySignals",label:d(14292,null),settings:["accessibility.signal*"]},{id:"features/accessibility",label:d(14291,null),settings:["accessibility.*"]},{id:"features/explorer",label:d(14315,null),settings:["explorer.*","outline.*"]},{id:"features/search",label:d(14335,null),settings:["search.*"]},{id:"features/debug",label:d(14309,null),settings:["debug.*","launch"]},{id:"features/testing",label:d(14343,null),settings:["testing.*"]},{id:"features/scm",label:d(14333,null),settings:["scm.*"]},{id:"features/extensions",label:d(14313,null),settings:["extensions.*"]},{id:"features/terminal",label:d(14342,null),settings:["terminal.*"]},{id:"features/task",label:d(14340,null),settings:["task.*"]},{id:"features/problems",label:d(14330,null),settings:["problems.*"]},{id:"features/output",label:d(14329,null),settings:["output.*"]},{id:"features/comments",label:d(14306,null),settings:["comments.*"]},{id:"features/remote",label:d(14332,null),settings:["remote.*"]},{id:"features/timeline",label:d(14345,null),settings:["timeline.*"]},{id:"features/notebook",label:d(14327,null),settings:["notebook.*","interactiveWindow.*"]},{id:"features/mergeEditor",label:d(14322,null),settings:["mergeEditor.*"]},{id:"features/issueReporter",label:d(14320,null),settings:["issueReporter.*"],hide:!Ft}]},{id:"application",label:d(14294,null),children:[{id:"application/http",label:d(14331,null),settings:["http.*"]},{id:"application/keyboard",label:d(14321,null),settings:["keyboard.*"]},{id:"application/update",label:d(14346,null),settings:["update.*"]},{id:"application/telemetry",label:d(14341,null),settings:["telemetry.*"]},{id:"application/settingsSync",label:d(14338,null),settings:["settingsSync.*"]},{id:"application/network",label:d(14325,null),settings:["network.*"]},{id:"application/experimental",label:d(14312,null),settings:["application.experimental.*"]},{id:"application/other",label:d(14328,null),settings:["application.*"],hide:ii}]},{id:"security",label:d(14336,null),settings:["security.*"],children:[{id:"security/workspace",label:d(14349,null),settings:["security.workspace.*"]}]}]};var mNe=class extends rh{constructor(e,t,o,n,r){super(e,{getActions:()=>this.getActions()},r,{...t,actionRunner:o,classNames:e.class,anchorAlignmentProvider:()=>1,menuAsChild:!0});this.searchWidget=n;this.suggestController=Sc.get(this.searchWidget.inputWidget)}render(e){super.render(e)}doSearchWidgetAction(e,t){this.searchWidget.setValue(this.searchWidget.getValue().trimEnd()+" "+e),this.searchWidget.focus(),t&&this.suggestController&&this.suggestController.triggerSuggest()}createAction(e,t,o,n,r){return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,run:()=>{this.doSearchWidgetAction(n,r)}}}createToggleAction(e,t,o,n){let s=this.searchWidget.getValue().split(" ").includes(n);return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,checked:s,run:()=>{if(s){let l=this.searchWidget.getValue().split(" ").filter(c=>c!==n).join(" ");this.searchWidget.setValue(l)}else{let l=this.searchWidget.getValue().trimEnd(),c=l?l+" "+n:n;this.searchWidget.setValue(c)}this.searchWidget.focus()}}}createMutuallyExclusiveToggleAction(e,t,o,n,r){let s=this.searchWidget.getValue().split(" ").includes(n);return{id:e,label:t,tooltip:o,class:void 0,enabled:!0,checked:s,run:()=>{if(s){let l=this.searchWidget.getValue().split(" ").filter(c=>c!==n).join(" ");this.searchWidget.setValue(l)}else{let l=this.searchWidget.getValue().split(" ").filter(c=>!r.includes(c)&&c!==n).join(" ").trimEnd();l=l?l+" "+n:n,this.searchWidget.setValue(l)}this.searchWidget.focus()}}}getActions(){return[this.createToggleAction("modifiedSettingsSearch",d(14363,null),d(14364,null),`@${hq}`),new oi,this.createAction("extSettingsSearch",d(14355,null),d(14356,null),`@${ZAe}`,!0),this.createAction("featuresSettingsSearch",d(14357,null),d(14358,null),`@${ME}`,!0),this.createAction("tagSettingsSearch",d(14373,null),d(14374,null),`@${zbo}`,!0),this.createAction("langSettingsSearch",d(14361,null),d(14362,null),`@${KW}`,!0),this.createAction("idSettingsSearch",d(14359,null),d(14360,null),`@${jot}`,!1),new oi,this.createToggleAction("onlineSettingsSearch",d(14365,null),d(14366,null),"@tag:usesOnlineServices"),this.createToggleAction("policySettingsSearch",d(14367,null),d(14368,null),`@${UU}`),new oi,this.createMutuallyExclusiveToggleAction("stableSettingsSearch",d(14371,null),d(14372,null),"@stable",["@tag:preview","@tag:experimental"]),this.createMutuallyExclusiveToggleAction("previewSettingsSearch",d(14369,null),d(14370,null),"@tag:preview",["@stable","@tag:experimental"]),this.createMutuallyExclusiveToggleAction("experimentalSettingsSearch",d(14353,null),d(14354,null),"@tag:experimental",["@stable","@tag:preview"]),new oi,this.createToggleAction("advancedSettingsSearch",d(14351,null),d(14352,null),`@tag:${vQ}`)]}};mNe=I([m(4,Xe)],mNe);var zU=_,vSo=new Set,IRi=[],Lge=class{constructor(i,e,t,o,n,r){this.configurationService=e;this.hoverService=t;this.userDataSyncEnablementService=o;this.languageService=n;this.commandService=r;this.isolatedIndicators=[];this.keybindingListeners=new O;this.focusedIndex=0;this.defaultHoverOptions={trapFocus:!0,style:1,position:{hoverPosition:2}};this.indicatorsContainerElement=D(i,zU(".setting-indicators-container")),this.indicatorsContainerElement.style.display="inline",this.previewIndicator=this.createPreviewIndicator(),this.advancedIndicator=this.createAdvancedIndicator(),this.isolatedIndicators=[this.previewIndicator,this.advancedIndicator],this.workspaceTrustIndicator=this.createWorkspaceTrustIndicator(),this.scopeOverridesIndicator=this.createScopeOverridesIndicator(),this.syncIgnoredIndicator=this.createSyncIgnoredIndicator(),this.defaultOverrideIndicator=this.createDefaultOverrideIndicator(),this.parenthesizedIndicators=[this.workspaceTrustIndicator,this.scopeOverridesIndicator,this.syncIgnoredIndicator,this.defaultOverrideIndicator]}createWorkspaceTrustIndicator(){let i=new O,e=zU("span.setting-indicator.setting-item-workspace-trust"),t=i.add(new ak(e));t.text="$(shield) "+d(14290,null);let o=d(14286,null);return i.add(this.hoverService.setupDelayedHover(e,()=>({...this.defaultHoverOptions,content:o,actions:[{label:d(14272,null),commandId:"workbench.trust.manage",run:n=>{this.commandService.executeCommand("workbench.trust.manage")}}]}),{setupKeyboardEvents:!0})),{element:e,label:t,disposables:i}}createScopeOverridesIndicator(){let i=new O,e=zU("span.setting-item-overrides"),t=i.add(new ak(e));return{element:e,label:t,disposables:i}}createSyncIgnoredIndicator(){let i=new O,e=zU("span.setting-indicator.setting-item-ignored"),t=i.add(new ak(e));t.text=d(14270,null);let o=d(14285,null);return i.add(this.hoverService.setupDelayedHover(e,{...this.defaultHoverOptions,content:o},{setupKeyboardEvents:!0})),{element:e,label:t,disposables:i}}createDefaultOverrideIndicator(){let i=new O,e=zU("span.setting-indicator.setting-item-default-overridden"),t=i.add(new ak(e));return t.text=d(14267,null),{element:e,label:t,disposables:i}}createPreviewIndicator(){let i=new O,e=zU("span.setting-indicator.setting-item-preview"),t=i.add(new ak(e));return{element:e,label:t,disposables:i}}createAdvancedIndicator(){let i=new O,e=zU("span.setting-indicator.setting-item-preview"),t=i.add(new ak(e));return t.text=d(14253,null),i.add(this.hoverService.setupDelayedHover(e,{...this.defaultHoverOptions,content:qbo},{setupKeyboardEvents:!0})),{element:e,label:t,disposables:i}}render(){this.indicatorsContainerElement.innerText="",this.indicatorsContainerElement.style.display="none";let i=this.isolatedIndicators.filter(t=>t.element.style.display!=="none");if(i.length){this.indicatorsContainerElement.style.display="inline";for(let t=0;t<i.length;t++)D(this.indicatorsContainerElement,i[t].element)}let e=this.parenthesizedIndicators.filter(t=>t.element.style.display!=="none");if(e.length){this.indicatorsContainerElement.style.display="inline",D(this.indicatorsContainerElement,zU("span",void 0,"("));for(let t=0;t<e.length-1;t++)D(this.indicatorsContainerElement,e[t].element),D(this.indicatorsContainerElement,zU("span.comma",void 0," \u2022 "));D(this.indicatorsContainerElement,e[e.length-1].element),D(this.indicatorsContainerElement,zU("span",void 0,")"))}this.resetIndicatorNavigationKeyBindings([...i,...e])}resetIndicatorNavigationKeyBindings(i){if(this.keybindingListeners.clear(),this.indicatorsContainerElement.role=i.length>=1?"toolbar":"button",!i.length)return;let e=i[0].focusElement??i[0].element;e.tabIndex=0,this.keybindingListeners.add($(this.indicatorsContainerElement,"keydown",t=>{let o=new mi(t),n=!0;if(o.equals(14))this.focusIndicatorAt(i,0);else if(o.equals(13))this.focusIndicatorAt(i,i.length-1);else if(o.equals(17)){let r=(this.focusedIndex+1)%i.length;this.focusIndicatorAt(i,r)}else if(o.equals(15)){let r=this.focusedIndex?this.focusedIndex-1:i.length-1;this.focusIndicatorAt(i,r)}else n=!1;n&&(t.preventDefault(),t.stopPropagation())}))}focusIndicatorAt(i,e){if(e===this.focusedIndex)return;let t=i[e],o=t.focusElement??t.element;o.tabIndex=0,o.focus();let n=i[this.focusedIndex],r=n.focusElement??n.element;r.tabIndex=-1,this.focusedIndex=e}updateWorkspaceTrust(i){this.workspaceTrustIndicator.element.style.display=i.isUntrusted?"inline":"none",this.render()}updateSyncIgnored(i,e){this.syncIgnoredIndicator.element.style.display=this.userDataSyncEnablementService.isEnabled()&&e.includes(i.setting.key)?"inline":"none",this.render(),IRi!==e&&(IRi=e,vSo=new Set(IRi))}updatePreviewIndicator(i){let e=i.tags?.has("preview"),t=i.tags?.has("experimental");this.previewIndicator.element.style.display=e||t?"inline":"none",this.previewIndicator.label.text=e?d(14282,null):d(14269,null);let o=e?Qzt:Yzt;this.previewIndicator.disposables.add(this.hoverService.setupDelayedHover(this.previewIndicator.element,{...this.defaultHoverOptions,content:o},{setupKeyboardEvents:!0})),this.render()}updateAdvancedIndicator(i){let e=i.tags?.has("advanced");this.advancedIndicator.element.style.display=e?"inline":"none",this.render()}getInlineScopeDisplayText(i){let[e,t]=i.split(":"),o=e==="user"?d(14287,null):e==="workspace"?d(14288,null):d(14283,null);return t?`${this.languageService.getLanguageName(t)} > ${o}`:o}dispose(){this.keybindingListeners.dispose();for(let i of this.isolatedIndicators)i.disposables.dispose();for(let i of this.parenthesizedIndicators)i.disposables.dispose()}updateScopeOverrides(i,e,t){if(this.scopeOverridesIndicator.disposables.clear(),this.scopeOverridesIndicator.element.innerText="",this.scopeOverridesIndicator.element.style.display="none",this.scopeOverridesIndicator.focusElement=this.scopeOverridesIndicator.element,i.hasPolicyValue){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator"),this.scopeOverridesIndicator.label.text="$(briefcase) "+d(14281,null);let o=d(14278,null);this.scopeOverridesIndicator.disposables.add(this.hoverService.setupDelayedHover(this.scopeOverridesIndicator.element,()=>({...this.defaultHoverOptions,content:o,actions:[{label:d(14280,null),commandId:"_settings.action.viewPolicySettings",run:n=>{t.fire(`@${UU}`)}}]}),{setupKeyboardEvents:!0}))}else if(i.isAgentsWindowReadOnly){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator"),this.scopeOverridesIndicator.label.text="$(lock) "+d(14256,null);let o=d(14255,null);this.scopeOverridesIndicator.disposables.add(this.hoverService.setupDelayedHover(this.scopeOverridesIndicator.element,{...this.defaultHoverOptions,content:o},{setupKeyboardEvents:!0}))}else if(i.settingsTarget===3&&this.configurationService.isSettingAppliedForAllProfiles(i.setting.key)){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator"),this.scopeOverridesIndicator.label.text=d(14260,null);let o=d(14261,null);this.scopeOverridesIndicator.disposables.add(this.hoverService.setupDelayedHover(this.scopeOverridesIndicator.element,{...this.defaultHoverOptions,content:o},{setupKeyboardEvents:!0}))}else if(i.overriddenScopeList.length||i.overriddenDefaultsLanguageList.length)if(i.overriddenScopeList.length===1&&!i.overriddenDefaultsLanguageList.length){this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.remove("setting-indicator");let o=i.isConfigured?d(14258,null):d(14264,null);this.scopeOverridesIndicator.label.text=`${o} `;let n=i.overriddenScopeList[0],r=D(this.scopeOverridesIndicator.element,zU("a.modified-scope",void 0,this.getInlineScopeDisplayText(n)));r.tabIndex=-1,this.scopeOverridesIndicator.focusElement=r;let s=l=>{let[c,u]=n.split(":");e.fire({settingKey:i.setting.key,scope:c,language:u}),l.preventDefault(),l.stopPropagation()};this.scopeOverridesIndicator.disposables.add($(r,ne.CLICK,l=>{s(l)})),this.scopeOverridesIndicator.disposables.add($(r,ne.KEY_DOWN,l=>{let c=new mi(l);(c.equals(10)||c.equals(3))&&s(l)}))}else{this.scopeOverridesIndicator.element.style.display="inline",this.scopeOverridesIndicator.element.classList.add("setting-indicator");let o=i.isConfigured?d(14257,null):d(14263,null);this.scopeOverridesIndicator.label.text=o;let n="";if(i.overriddenScopeList.length){n=i.isConfigured?d(14259,null):d(14275,null);for(let l of i.overriddenScopeList){let c=this.getInlineScopeDisplayText(l);n+=`
- `+Yxt(c,nKt.create(l).toString(),Qrn(l,this.languageService))}}if(i.overriddenDefaultsLanguageList.length){n&&(n+=`

`);let s=d(14271,null);n+=s;for(let l of i.overriddenDefaultsLanguageList){let c=this.languageService.getLanguageName(l);n+=`
- `+Yxt(c??l,nKt.create(`default:${l}`).toString())}}let r={value:n,isTrusted:!1,supportHtml:!1};this.scopeOverridesIndicator.disposables.add(this.hoverService.setupDelayedHover(this.scopeOverridesIndicator.element,()=>({...this.defaultHoverOptions,content:r,linkHandler:s=>{let[l,c]=nKt.parse(s).split(":");e.fire({settingKey:i.setting.key,scope:l,language:c})}}),{setupKeyboardEvents:!0}))}this.render()}updateDefaultOverrideIndicator(i){this.defaultOverrideIndicator.element.style.display="none";let e=bSo(i);if(e!==void 0){this.defaultOverrideIndicator.element.style.display="inline",this.defaultOverrideIndicator.disposables.clear(),Array.isArray(e)&&e.length===1&&(e=e[0]);let t;Array.isArray(e)?(e=e.map(o=>`\`${o}\``),t=d(14276,null,e.slice(0,-1).join(", ")+" & "+e.slice(-1))):t=d(14265,null,e),this.defaultOverrideIndicator.disposables.add(this.hoverService.setupDelayedHover(this.defaultOverrideIndicator.element,()=>({content:new he().appendMarkdown(t),style:1,position:{hoverPosition:2}}),{setupKeyboardEvents:!0}))}this.render()}};Lge=I([m(1,Yg),m(2,ot),m(3,Yl),m(4,Rt),m(5,fe)],Lge);function bSo(a){let i,e=a.defaultValueSource;if(e)if(e instanceof Map){i=[];for(let[,t]of e){let o=typeof t!="string"?t.displayName??t.id:t;i.includes(o)||i.push(o)}}else typeof e=="string"?i=e:i=e.displayName??e.id;return i}function Qrn(a,i){let[e,t]=a.split(":"),o=e==="user"?d(14287,null):e==="workspace"?d(14288,null):d(14283,null);return t?d(14273,null,o,i.getLanguageName(t)):o}function Yrn(a,i){let[e,t]=a.split(":"),o=e==="user"?d(14287,null):e==="workspace"?d(14288,null):d(14283,null);return t?d(14274,null,o.toLowerCase(),i.getLanguageName(t)):o}function SSo(a,i,e,t){let o=[];if(a.tags?.has("preview")?o.push(d(14282,null)):a.tags?.has("experimental")&&o.push(d(14269,null)),a.tags?.has("advanced")&&o.push(d(14253,null)),a.isUntrusted&&o.push(d(14289,null)),a.hasPolicyValue)o.push(d(14279,null));else if(a.isAgentsWindowReadOnly)o.push(d(14254,null));else if(a.settingsTarget===3&&i.isSettingAppliedForAllProfiles(a.setting.key))o.push(d(14262,null));else{let l=a.isConfigured?d(14258,null):d(14264,null),c=a.overriddenScopeList.map(u=>Yrn(u,t)).join(", ");a.overriddenScopeList.length&&o.push(`${l} ${c}`)}vSo.has(a.setting.key)&&o.push(d(14284,null));let n=bSo(a);if(n!==void 0){Array.isArray(n)&&n.length===1&&(n=n[0]);let l;Array.isArray(n)?l=d(14277,null,n.slice(0,-1).join(", ")+" & "+n.slice(-1)):l=d(14266,null,n),o.push(l)}let r=a.overriddenDefaultsLanguageList.map(l=>t.getLanguageName(l)).join(", ");if(a.overriddenDefaultsLanguageList.length){let l=d(14268,null,r);o.push(l)}return o.join(". ")}var nKt;(e=>{function a(t){return A.from({scheme:Q.internal,path:"/",query:encodeURIComponent(t)})}e.create=a;function i(t){let o=A.parse(t);return decodeURIComponent(o.query)}e.parse=i})(nKt||={});var dnt=class extends k{constructor(e){super();this._tabbable=!1;this._onDidChangeTabbable=this._register(new T);this.id=e}get onDidChangeTabbable(){return this._onDidChangeTabbable.event}get tabbable(){return this._tabbable}set tabbable(e){this._tabbable=e,this._onDidChangeTabbable.fire()}},Lv=class extends dnt{constructor(e,t,o,n,r){super(e);this._childSettingKeys=new Set;this._children=[];this.count=t,this.label=o,this.level=n,this.isFirstGroup=r}get children(){return this._children}set children(e){this._children=e,this._childSettingKeys=new Set,this._children.forEach(t=>{t instanceof NC&&this._childSettingKeys.add(t.setting.key)})}containsSetting(e){return this._childSettingKeys.has(e)}},hNe=class extends dnt{constructor(e,t){super(e);this.extensionIds=t}},NC=class a extends dnt{constructor(e,t,o,n,r,s,l,c,u,p){super(Xrn(t.id+"_"+e.key));this.settingsTarget=o;this.isWorkspaceTrusted=n;this.languageFilter=r;this.languageService=s;this.productService=l;this.userDataProfileService=c;this.configurationService=u;this.isSessionsWindow=p;this._displayCategory=null;this._displayLabel=null;this.isConfigured=!1;this.isUntrusted=!1;this.hasPolicyValue=!1;this.isAgentsWindowReadOnly=!1;this.overriddenScopeList=[];this.overriddenDefaultsLanguageList=[];this.languageOverrideValues=new Map;this.setting=e,this.parent=t,this.initSettingDescription(),this.initSettingValueType()}static{this.MAX_DESC_LINES=20}get displayCategory(){return this._displayCategory||this.initLabels(),this._displayCategory}get displayLabel(){return this._displayLabel||this.initLabels(),this._displayLabel}initLabels(){if(this.setting.title){this._displayLabel=this.setting.title,this._displayCategory=this.setting.categoryLabel??null;return}let e=IQ(this.setting.key,this.parent.id,this.setting.isLanguageTagSetting);this._displayLabel=e.label,this._displayCategory=e.category}initSettingDescription(){if(this.setting.description.length>a.MAX_DESC_LINES){let e=this.setting.description.slice(0,a.MAX_DESC_LINES);e.push("[...]"),this.description=e.join(`
`)}else this.description=this.setting.description.join(`
`)}initSettingValueType(){if(Zrn(this.setting,this.productService))this.valueType="extension-toggle";else if(this.setting.enum&&(!this.setting.type||nsn(this.setting.type)))this.valueType="enum";else if(this.setting.type==="string")this.setting.editPresentation==="multilineText"?this.valueType="multiline-string":this.valueType="string";else if(esn(this.setting))this.valueType="exclude";else if(tsn(this.setting))this.valueType="include";else if(this.setting.type==="integer")this.valueType="integer";else if(this.setting.type==="number")this.valueType="number";else if(this.setting.type==="boolean")this.valueType="boolean";else if(this.setting.type==="array"&&this.setting.arrayItemType&&["string","enum","number","integer"].includes(this.setting.arrayItemType))this.valueType="array";else if(Array.isArray(this.setting.type)&&this.setting.type.includes("null")&&this.setting.type.length===2)this.setting.type.includes("integer")?this.valueType="nullable-integer":this.setting.type.includes("number")?this.valueType="nullable-number":this.valueType="complex";else{let e=osn(this.setting);e?this.setting.allKeysAreBoolean?this.valueType="boolean-object":e==="simple"?this.valueType="object":this.valueType="complex-object":this.setting.isLanguageTagSetting?this.valueType="language-tag":this.valueType="complex"}}inspectSelf(){let e=this.getTargetToInspect(this.setting),t=yRi(this.setting.key,e,this.languageFilter,this.configurationService);this.update(t,this.isWorkspaceTrusted)}getTargetToInspect(e){if(!this.userDataProfileService.currentProfile.isDefault&&!this.userDataProfileService.currentProfile.useDefaultFlags?.settings){if(e.scope===1)return 1;if(this.configurationService.isSettingAppliedForAllProfiles(e.key)&&this.settingsTarget===3)return 1}return this.settingsTarget}update(e,t){let{isConfigured:o,inspected:n,targetSelector:r,inspectedLanguageOverrides:s,languageSelector:l}=e;switch(r){case"workspaceFolderValue":case"workspaceValue":this.isUntrusted=!!this.setting.restricted&&!t;break}let c=o?n[r]:n.defaultValue,u=[],p=[];if((l||r!=="workspaceValue")&&typeof n.workspaceValue<"u"&&u.push("workspace:"),(l||r!=="userRemoteValue")&&typeof n.userRemoteValue<"u"&&u.push("remote:"),(l||r!=="userLocalValue")&&typeof n.userLocalValue<"u"&&u.push("user:"),n.overrideIdentifiers)for(let g of n.overrideIdentifiers){let f=s.get(g);f&&(this.languageService.isRegisteredLanguageId(g)&&(l!==g&&typeof f.default?.override<"u"&&p.push(g),(l!==g||r!=="workspaceValue")&&typeof f.workspace?.override<"u"&&u.push(`workspace:${g}`),(l!==g||r!=="userRemoteValue")&&typeof f.userRemote?.override<"u"&&u.push(`remote:${g}`),(l!==g||r!=="userLocalValue")&&typeof f.userLocal?.override<"u"&&u.push(`user:${g}`)),this.languageOverrideValues.set(g,f))}if(this.overriddenScopeList=u,this.overriddenDefaultsLanguageList=p,this.defaultValueSource=this.setting.nonLanguageSpecificDefaultValueSource,n.policyValue!==void 0)this.hasPolicyValue=!0,o=!1,c=n.policyValue,this.scopeValue=n.policyValue,this.defaultValue=n.defaultValue;else if(l&&this.languageOverrideValues.has(l)){let g=this.languageOverrideValues.get(l);c=(o?g[r]:g.defaultValue)??c,this.scopeValue=o&&g[r],this.defaultValue=g.defaultValue??n.defaultValue;let v=oe.as($t.Configuration).getConfigurationDefaultsOverrides().get(`[${l}]`)?.source,b=v instanceof Map?v.get(this.setting.key):void 0;b&&(this.defaultValueSource=b)}else this.scopeValue=o&&n[r],this.defaultValue=n.defaultValue;let h=!1;if(this.isSessionsWindow){let g=oe.as($t.Configuration).getConfigurationProperties()[this.setting.key];h=!!g?.agentsWindow,this.isAgentsWindowReadOnly=!!g?.agentsWindow?.readOnly,this.isAgentsWindowReadOnly&&(o=!1)}this.value=c,this.isConfigured=o,(o||this.setting.tags||this.tags||this.setting.restricted||this.hasPolicyValue||h)&&(this.tags=new Set,o&&this.tags.add(hq),this.setting.tags?.forEach(g=>this.tags.add(g)),this.setting.restricted&&this.tags.add(eNe),this.hasPolicyValue&&this.tags.add(UU),h&&this.tags.add(Cge))}matchesAllTags(e){if(!e?.size)return!0;if(this.tags||this.inspectSelf(),e.has("stable")){if(this.tags?.has("preview")||this.tags?.has("experimental"))return!1;let t=new Set(Array.from(e).filter(o=>o!=="stable"));return t.size===0?!0:!!this.tags?.size&&Array.from(t).every(o=>this.tags.has(o))}return!!this.tags?.size&&Array.from(e).every(t=>this.tags.has(t))}matchesScope(e,t){let o=A.isUri(e)?6:e;return this.setting.scope?o===1?MC.includes(this.setting.scope):o===6?yte.includes(this.setting.scope):o===5?N8.includes(this.setting.scope):o===4?BMe.includes(this.setting.scope)||Gbi.includes(this.setting.key):o===3&&t?EVt.includes(this.setting.scope)||Gbi.includes(this.setting.key):!0:!0}matchesAnyExtension(e){return!e||!e.size?!0:this.setting.extensionInfo?Array.from(e).some(t=>t.toLowerCase()===this.setting.extensionInfo.id.toLowerCase()):!1}matchesAnyFeature(e){if(!e||!e.size)return!0;if(this.setting.extensionInfo)return!1;if(e.has("chat")){let o=cnt.children.find(n=>n.id==="chat");if(o?.children&&o.children.flatMap(r=>r.settings??[]).map(r=>ISo(r)).some(r=>r.test(this.setting.key)))return!0}let t=cnt.children.find(o=>o.id==="features");return Array.from(e).some(o=>{if(t?.children){let n=t.children.find(r=>"features/"+o===r.id);return n?.settings?n.settings.map(s=>ISo(s)).some(s=>s.test(this.setting.key)):!1}else return!1})}matchesAnyId(e){if(!e||!e.size||e.has(this.setting.key))return!0;for(let t of e)if(t.endsWith("*")){let o=t.slice(0,-1);if(this.setting.key.startsWith(o))return!0}return!1}matchesAllLanguages(e){return e?this.languageService.isRegisteredLanguageId(e)?this.setting.scope===6:!1:!0}};function ISo(a){return a=Ss(a).replace(/\\\*/g,".*"),new RegExp(`^${a}$`,"i")}var Mge=class{constructor(i,e,t,o,n,r,s){this._viewState=i;this._isWorkspaceTrusted=e;this._configurationService=t;this._languageService=o;this._userDataProfileService=n;this._productService=r;this._environmentService=s;this._treeElementsBySettingName=new Map}get root(){return this._root}update(i=this._tocRoot){this._treeElementsBySettingName.clear();let e=this.createSettingsTreeGroupElement(i);e.children[0]instanceof Lv&&(e.children[0].isFirstGroup=!0),this._root?(this.disposeChildren(this._root.children),this._root.children=e.children,e.dispose()):this._root=e}updateWorkspaceTrust(i){this._isWorkspaceTrusted=i,this.updateRequireTrustedTargetElements()}disposeChildren(i){for(let e of i)this.disposeChildAndRecurse(e)}disposeChildAndRecurse(i){i instanceof Lv&&this.disposeChildren(i.children),i.dispose()}getElementsByName(i){return this._treeElementsBySettingName.get(i)??null}updateElementsByName(i){this._treeElementsBySettingName.has(i)&&this.reinspectSettings(this._treeElementsBySettingName.get(i))}updateRequireTrustedTargetElements(){this.reinspectSettings([...this._treeElementsBySettingName.values()].flat().filter(i=>i.isUntrusted))}reinspectSettings(i){for(let e of i)e.inspectSelf()}createSettingsTreeGroupElement(i,e){let t=e?this.getDepth(e)+1:0,o=new Lv(i.id,void 0,i.label,t,!1);o.parent=e;let n=[];if(i.settings){let r=i.settings.map(s=>this.createSettingsTreeSettingElement(s,o));for(let s of r)s.setting.deprecationMessage?(s.inspectSelf(),s.isConfigured?n.push(s):s.dispose()):n.push(s)}if(i.children){let r=i.children.map(s=>this.createSettingsTreeGroupElement(s,o));n.push(...r)}return o.children=n,o}getDepth(i){return i.parent?1+this.getDepth(i.parent):0}createSettingsTreeSettingElement(i,e){let t=new NC(i,e,this._viewState.settingsTarget,this._isWorkspaceTrusted,this._viewState.languageFilter,this._languageService,this._productService,this._userDataProfileService,this._configurationService,this._environmentService.isSessionsWindow),o=this._treeElementsBySettingName.get(i.key)??[];return o.push(t),this._treeElementsBySettingName.set(i.key,o),t}dispose(){this._treeElementsBySettingName.clear(),this.disposeChildAndRecurse(this._root)}};Mge=I([m(2,Yg),m(3,Rt),m(4,gn),m(5,Ze),m(6,Mt)],Mge);function yRi(a,i,e,t){let o=A.isUri(i)?{resource:i}:void 0,n=t.inspect(a,o),r=i===1?"applicationValue":i===3?"userLocalValue":i===4?"userRemoteValue":i===5?"workspaceValue":"workspaceFolderValue",s=i===1?"application":i===3?"userLocal":i===4?"userRemote":i===5?"workspace":"workspaceFolder",l=typeof n[r]<"u",c=n.overrideIdentifiers,u=new Map;if(e&&(l=!1),c){for(let p of c)u.set(p,t.inspect(a,{overrideIdentifier:p}));e&&u.has(e)&&typeof u.get(e)[s]?.override<"u"&&(l=!0)}return{isConfigured:l,inspected:n,targetSelector:r,inspectedLanguageOverrides:u,languageSelector:e}}function Xrn(a){return a.replace(/[\.\/]/g,"_")}function IQ(a,i="",e=!1){let t=a.lastIndexOf("."),o="";t>=0&&(o=a.substring(0,t),a=a.substring(t+1)),i=i.replace(/\//g,"."),o=Jrn(o,i),o=dRi(o),e&&(a=eCe(a),a="$(bracket) "+a);let n=dRi(a);return{category:o,label:n}}function Jrn(a,i){let e=o=>{/insiders$/i.test(a)||(i=i.replace(/-?insiders$/i,""));let n=i.split(".").map(r=>r.replace(/-/g,"").toLowerCase()===a.toLowerCase()?r.replace(/-/g,""):r);for(;n.length;){let r=new RegExp(`^${n.join("\\.")}(\\.|$)`,"i");if(r.test(a))return a.replace(r,"");o?n.pop():n.shift()}return null},t=e(!0);return t===null&&(t=e(!1)),t===null&&(t=a),t}function Zrn(a,i){return lRi&&!!i.extensionRecommendations&&!!a.displayExtensionId}function esn(a){return a.key==="files.exclude"||a.key==="search.exclude"||a.key==="workbench.localHistory.exclude"||a.key==="explorer.autoRevealExclude"||a.key==="files.readonlyExclude"||a.key==="files.watcherExclude"}function tsn(a){return a.key==="files.readonlyInclude"}function sKt(a){return a==="workbench.editor.customLabels.patterns"}function rKt(a){return a==="string"||a==="boolean"||a==="integer"||a==="number"}function isn(a,i){let{type:e}=a;if(Array.isArray(e)){if(sKt(i)&&e.length===2&&e.includes("null")&&(e.includes("string")||e.includes("boolean")||e.includes("integer")||e.includes("number")))return"simple";for(let t of e)if(!rKt(t))return!1;return"complex"}if(rKt(e))return"simple";if(e==="array"){if(a.items){let t=Array.isArray(a.items)?a.items:[a.items];for(let{type:o}of t){if(Array.isArray(o)){for(let n of o)if(!rKt(n))return!1;return"complex"}return rKt(o)?"complex":!1}}return!1}return!1}function osn({key:a,type:i,objectProperties:e,objectPatternProperties:t,objectAdditionalProperties:o}){if(i!=="object"||mr(e)&&mr(t)&&mr(o)||(o===!0||o===void 0)&&!Object.keys(t??{}).includes(".*"))return!1;let n=[...Object.values(e??{}),...Object.values(t??{})];o&&typeof o=="object"&&n.push(o);let r="simple";for(let s of n)for(let l of Array.isArray(s.anyOf)?s.anyOf:[s]){let c=isn(l,a);if(c===!1)return!1;c==="complex"&&(r="complex")}return r}function nsn(a){let i=["string","boolean","null","integer","number"];return(Array.isArray(a)?a:[a]).every(t=>i.includes(t))}var Pge=class extends Mge{constructor(e,t,o,n,r,s,l,c){super(e,o,n,s,l,c,r);this.environmentService=r;this.rawSearchResults=null;this.newExtensionSearchResults=null;this.searchResultCount=null;this.aiFilterEnabled=!1;this.id="searchResultModel";this.settingsOrderByTocIndex=t,this.cachedUniqueSearchResults=new Map,this.update({id:"searchResultModel",label:""})}set showAiResults(e){this.aiFilterEnabled=e,this.updateChildren()}sortResults(e){if(this.settingsOrderByTocIndex)for(let t of e)t.setting.internalOrder=this.settingsOrderByTocIndex.get(t.setting.key);return this._viewState.query?(e.sort((t,o)=>t.matchType!==o.matchType?o.matchType-t.matchType:t.matchType&16||t.matchType&32?o.keyMatchScore-t.keyMatchScore||xge(t.setting.internalOrder,o.setting.internalOrder):t.matchType===2?o.score-t.score:xge(t.setting.internalOrder,o.setting.internalOrder)),jo(e,t=>t.setting.key)):e.sort((t,o)=>xge(t.setting.internalOrder,o.setting.internalOrder))}getUniqueSearchResults(){let e=this.cachedUniqueSearchResults.get(this.aiFilterEnabled);if(e)return e;if(!this.rawSearchResults)return null;let t=[];if(this.aiFilterEnabled){let l=new Set,c=this.rawSearchResults[4];c&&(c.filterMatches.forEach(h=>l.add(h.setting.key)),t=c.filterMatches);let u=this.rawSearchResults[3];u&&(u.filterMatches=u.filterMatches.filter(h=>!l.has(h.setting.key)),t=t.concat(u.filterMatches));let p={filterMatches:t,exactMatch:!1};return this.cachedUniqueSearchResults.set(!0,p),p}let o=new Set,n=this.rawSearchResults[0];n&&(n.filterMatches.forEach(l=>o.add(l.setting.key)),t=n.filterMatches);let r=this.rawSearchResults[1];r&&(r.filterMatches=r.filterMatches.filter(l=>!o.has(l.setting.key)),t=t.concat(r.filterMatches),this.newExtensionSearchResults=this.rawSearchResults[2]),t=this.sortResults(t);let s={filterMatches:t,exactMatch:n.exactMatch};return this.cachedUniqueSearchResults.set(!1,s),s}getRawResults(){return this.rawSearchResults??[]}getUniqueSearchResultSettings(){return this.getUniqueSearchResults()?.filterMatches.map(e=>e.setting)??[]}updateChildren(){this.update({id:"searchResultModel",label:"searchResultModel",settings:this.getUniqueSearchResultSettings()});let e=!!this.environmentService.remoteAuthority,t=[];for(let o of this.root.children)o instanceof NC&&o.matchesAllTags(this._viewState.tagFilters)&&o.matchesScope(this._viewState.settingsTarget,e)&&o.matchesAnyExtension(this._viewState.extensionFilters)&&o.matchesAnyId(this._viewState.idFilters)&&o.matchesAnyFeature(this._viewState.featureFilters)&&o.matchesAllLanguages(this._viewState.languageFilter)?t.push(o):o.dispose();if(this.root.children=t,this.searchResultCount=this.root.children.length,this.newExtensionSearchResults?.filterMatches.length){let o=this.newExtensionSearchResults.filterMatches.map(n=>n.setting).filter(n=>n.extensionName&&n.extensionPublisher).map(n=>`${n.extensionPublisher}.${n.extensionName}`);if(o=jo(o),o.length){let n=new hNe("newExtensions",o);n.parent=this._root,this._root.children.push(n)}}}setResult(e,t){if(this.cachedUniqueSearchResults.clear(),this.newExtensionSearchResults=null,this.rawSearchResults&&e===0&&delete this.rawSearchResults[1],this.rawSearchResults??=[],!t){delete this.rawSearchResults[e];return}this.rawSearchResults[e]=t,this.updateChildren()}getUniqueResultsCount(){return this.searchResultCount??0}};Pge=I([m(3,Yg),m(4,Mt),m(5,Rt),m(6,gn),m(7,Ze)],Pge);var rsn=/(^|\s)@tag:("([^"]*)"|[^"]\S*)/g,ssn=/(^|\s)@ext:("([^"]*)"|[^"]\S*)?/g,asn=/(^|\s)@feature:("([^"]*)"|[^"]\S*)?/g,lsn=/(^|\s)@id:("([^"]*)"|[^"]\S*)?/g,csn=/(^|\s)@lang:("([^"]*)"|[^"]\S*)?/g;function aKt(a){function i(s,l,c){return s.replace(l,(u,p,h,g)=>{let f=g||h;return f&&c.push(...f.split(",").map(v=>v.trim()).filter(v=>!_c(v))),""})}let e=[];a=a.replace(rsn,(s,l,c,u)=>(e.push(u||c),"")),a=a.replace(`@${hq}`,()=>(e.push(hq),"")),a=a.replace(`@${UU}`,()=>(e.push(UU),"")),a=a.replace(`@${Cge}`,()=>(e.push(Cge),"")),a=a.replace(/@stable/g,()=>(e.push("stable"),""));let t=[],o=[],n=[],r=[];return a=i(a,ssn,t),a=i(a,asn,o),a=i(a,lsn,n),Kzt&&(a=i(a,csn,r)),a=a.trim(),{tags:e,extensionFilters:t,featureFilters:o,idFilters:n,languageFilter:r.length?r[0]:void 0,query:a}}var mS=_,wRi=class{constructor(i){this._dataItems=[];this._editKey=null;this._selectedIdx=null;this._newDataItem=i}get items(){let i=this._dataItems.map((e,t)=>{let o=typeof this._editKey=="number"&&this._editKey===t;return{...e,editing:o,selected:t===this._selectedIdx||o}});return this._editKey==="create"&&i.push({editing:!0,selected:!0,...this._newDataItem}),i}setEditKey(i){this._editKey=i}setValue(i){this._dataItems=i}select(i){this._selectedIdx=i}getSelected(){return this._selectedIdx}selectNext(){typeof this._selectedIdx=="number"?this._selectedIdx=Math.min(this._selectedIdx+1,this._dataItems.length-1):this._selectedIdx=0}selectPrevious(){typeof this._selectedIdx=="number"?this._selectedIdx=Math.max(this._selectedIdx-1,0):this._selectedIdx=0}},Age=class extends k{constructor(e,t,o,n){super();this.container=e;this.themeService=t;this.contextViewService=o;this.configurationService=n;this.rowElements=[];this._onDidChangeList=this._register(new T);this.model=new wRi(this.getEmptyItem());this.listDisposables=this._register(new O);this.onDidChangeList=this._onDidChangeList.event;this.listElement=D(e,mS("div")),this.listElement.setAttribute("role","list"),this.getContainerClasses().forEach(r=>this.listElement.classList.add(r)),D(e,this.renderAddButton()),this.renderList(),this._register($(this.listElement,ne.POINTER_DOWN,r=>this.onListClick(r))),this._register($(this.listElement,ne.DBLCLICK,r=>this.onListDoubleClick(r))),this._register(Yo(this.listElement,"keydown",r=>{if(r.equals(16))this.selectPreviousRow();else if(r.equals(18))this.selectNextRow();else return;r.preventDefault(),r.stopPropagation()}))}get domNode(){return this.listElement}get items(){return this.model.items}get isReadOnly(){return!1}setValue(e){this.model.setValue(e),this.renderList()}renderHeader(){}isAddButtonVisible(){return!0}renderList(){let e=Is(this.listElement);St(this.listElement),this.listDisposables.clear();let t=this.model.items.some(n=>!!(n.editing&&this.isItemNew(n)));this.container.classList.toggle("setting-list-hide-add-button",!this.isAddButtonVisible()||t),this.model.items.length?this.listElement.tabIndex=0:this.listElement.removeAttribute("tabIndex");let o=this.renderHeader();o&&this.listElement.appendChild(o),this.rowElements=this.model.items.map((n,r)=>this.renderDataOrEditItem(n,r,e)),this.rowElements.forEach(n=>this.listElement.appendChild(n))}createBasicSelectBox(e){let t=e.options.map(({value:s,description:l})=>({text:s,description:l})),o=e.options.findIndex(s=>e.data===s.value),n=Tkt({selectBackground:Xzt,selectForeground:Jzt,selectBorder:Zzt,selectListBorder:eKt});return new Jw(t,o,this.contextViewService,n,{useCustomDrawn:!BI(this.configurationService)||!(Tc&&of.pointerEvents)})}editSetting(e){this.model.setEditKey(e),this.renderList()}cancelEdit(){this.model.setEditKey("none"),this.renderList()}handleItemChange(e,t,o){this.model.setEditKey("none"),this.isItemNew(e)?this._onDidChangeList.fire({type:"add",newItem:t,targetIndex:o}):this._onDidChangeList.fire({type:"change",originalItem:e,newItem:t,targetIndex:o}),this.renderList()}renderDataOrEditItem(e,t,o){let n=e.editing?this.renderEdit(e,t):this.renderDataItem(e,t,o);return n.setAttribute("role","listitem"),n}renderDataItem(e,t,o){let n=this.renderItem(e,t),r=n.rowElement;r.setAttribute("data-index",t+""),r.setAttribute("tabindex",e.selected?"0":"-1"),r.classList.toggle("selected",e.selected);let s=new oo(r);return this.listDisposables.add(s),s.push(this.getActionsForItem(e,t),{icon:!0,label:!0}),this.addTooltipsToRow(n,e),e.selected&&o&&Zo(()=>r.focus(),void 0,this.listDisposables),this.listDisposables.add($(r,"click",l=>{l.stopPropagation()})),r}renderAddButton(){let e=mS(".setting-list-new-row"),t=this._register(new Pi(e,Ro));return t.label=this.getLocalizedStrings().addButtonLabel,t.element.classList.add("setting-list-addButton"),this._register(t.onDidClick(()=>{this.model.setEditKey("create"),this.renderList()})),e}onListClick(e){let t=this.getClickedItemIndex(e);t<0||(e.preventDefault(),e.stopImmediatePropagation(),this.model.getSelected()!==t&&this.selectRow(t))}onListDoubleClick(e){let t=this.getClickedItemIndex(e);if(t<0||this.isReadOnly)return;this.model.items[t]&&(this.editSetting(t),e.preventDefault(),e.stopPropagation())}getClickedItemIndex(e){if(!e.target||rf(e.target,"monaco-action-bar"))return-1;let o=rf(e.target,"setting-list-row");if(!o)return-1;let n=o.getAttribute("data-index");return n?parseInt(n):-1}selectRow(e){this.model.select(e),this.rowElements.forEach(o=>o.classList.remove("selected"));let t=this.rowElements[this.model.getSelected()];t.classList.add("selected"),t.focus()}selectNextRow(){this.model.selectNext(),this.selectRow(this.model.getSelected())}selectPreviousRow(){this.model.selectPrevious(),this.selectRow(this.model.getSelected())}};Age=I([m(1,Pe),m(2,qn),m(3,B)],Age);var Eie=class extends Age{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.showAddButton=!0;this.isEditable=!0}setValue(e,t){this.keyValueSuggester=t?.keySuggester,this.isEditable=t?.isReadOnly===void 0?!0:!t.isReadOnly,this.showAddButton=this.isEditable?t?.showAddButton??!0:!1,super.setValue(e)}getEmptyItem(){return{value:{type:"string",data:""}}}isAddButtonVisible(){return this.showAddButton}getContainerClasses(){return["setting-list-widget"]}getActionsForItem(e,t){return this.isReadOnly?[]:[{class:q.asClassName(Ege),enabled:!0,id:"workbench.action.editListItem",tooltip:this.getLocalizedStrings().editActionTooltip,run:()=>this.editSetting(t)},{class:q.asClassName(uRi),enabled:!0,id:"workbench.action.removeListItem",tooltip:this.getLocalizedStrings().deleteActionTooltip,run:()=>this._onDidChangeList.fire({type:"remove",originalItem:e,targetIndex:t})}]}renderItem(e,t){let o=mS(".setting-list-row"),n=D(o,mS(".setting-list-value")),r=D(o,mS(".setting-list-sibling"));return n.textContent=e.value.data.toString(),e.sibling?r.textContent=`when: ${e.sibling}`:(r.textContent=null,n.classList.add("no-sibling")),this.addDragAndDrop(o,e,t),{rowElement:o,keyElement:n,valueElement:r}}addDragAndDrop(e,t,o){this.model.items.every(r=>!r.editing)?(e.draggable=!0,e.classList.add("draggable")):(e.draggable=!1,e.classList.remove("draggable")),this.listDisposables.add($(e,ne.DRAG_START,r=>{this.dragDetails={element:e,item:t,itemIndex:o},LA(r,e,t.value.data)})),this.listDisposables.add($(e,ne.DRAG_OVER,r=>this.dragDetails?(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="move"),!0):!1));let n=0;this.listDisposables.add($(e,ne.DRAG_ENTER,r=>{n++,e.classList.add("drag-hover")})),this.listDisposables.add($(e,ne.DRAG_LEAVE,r=>{n--,n||e.classList.remove("drag-hover")})),this.listDisposables.add($(e,ne.DROP,r=>this.dragDetails?(r.preventDefault(),n=0,this.dragDetails.element!==e&&this._onDidChangeList.fire({type:"move",originalItem:this.dragDetails.item,sourceIndex:this.dragDetails.itemIndex,newItem:t,targetIndex:o}),!0):!1)),this.listDisposables.add($(e,ne.DRAG_END,r=>{n=0,e.classList.remove("drag-hover"),r.dataTransfer?.clearData(),this.dragDetails&&(this.dragDetails=void 0)}))}renderEdit(e,t){let o=mS(".setting-list-edit-row"),n,r,s;if(this.keyValueSuggester){let f=this.keyValueSuggester(this.model.items.map(({value:{data:v}})=>v),t);e={...e,value:{type:"enum",data:e.value.data,options:f?f.options:[]}}}switch(e.value.type){case"string":n=this.renderInputBox(e.value,o);break;case"enum":n=this.renderDropdown(e.value,o),s=e.value.options,e.value.options.length&&(r=this.isItemNew(e)?s[0].value:e.value.data);break}let l=()=>({value:{type:"string",data:n.value},sibling:p?.value}),c=f=>({value:{type:"enum",data:f,options:s??[]}}),u=f=>{f.equals(3)?this.handleItemChange(e,l(),t):f.equals(9)&&(this.cancelEdit(),f.preventDefault(),f.stopPropagation()),o?.focus()};if(e.value.type!=="string"){let f=n;this.listDisposables.add(f.onDidSelect(({selected:v})=>{r=v}))}else{let f=n;this.listDisposables.add(Yo(f.inputElement,ne.KEY_DOWN,u))}let p;mr(e.sibling)?n instanceof ad&&n.element.classList.add("no-sibling"):(p=new ad(o,this.contextViewService,{placeholder:this.getLocalizedStrings().siblingInputPlaceholder,inputBoxStyles:MD({inputBackground:aNe,inputForeground:lNe,inputBorder:__})}),p.element.classList.add("setting-list-siblingInput"),this.listDisposables.add(p),p.value=e.sibling,this.listDisposables.add(Yo(p.inputElement,ne.KEY_DOWN,u)));let h=this.listDisposables.add(new Pi(o,Ro));h.label=d(14418,null),h.element.classList.add("setting-list-ok-button"),this.listDisposables.add(h.onDidClick(()=>{e.value.type==="string"?this.handleItemChange(e,l(),t):this.handleItemChange(e,c(r),t)}));let g=this.listDisposables.add(new Pi(o,{secondary:!0,...Ro}));return g.label=d(14395,null),g.element.classList.add("setting-list-cancel-button"),this.listDisposables.add(g.onDidClick(()=>this.cancelEdit())),this.listDisposables.add(Zo(()=>{n.focus(),n instanceof ad&&n.select()})),o}isItemNew(e){return e.value.data===""}addTooltipsToRow(e,{value:t,sibling:o}){let n=mr(o)?d(14411,null,t.data):d(14409,null,t.data,o),{rowElement:r}=e;this.listDisposables.add(this.hoverService.setupDelayedHover(r,{content:n})),r.setAttribute("aria-label",n)}getLocalizedStrings(){return{deleteActionTooltip:d(14421,null),editActionTooltip:d(14398,null),addButtonLabel:d(14393,null),inputPlaceholder:d(14408,null),siblingInputPlaceholder:d(14410,null)}}renderInputBox(e,t){let o=new ad(t,this.contextViewService,{placeholder:this.getLocalizedStrings().inputPlaceholder,inputBoxStyles:MD({inputBackground:aNe,inputForeground:lNe,inputBorder:__})});return o.element.classList.add("setting-list-valueInput"),this.listDisposables.add(o),o.value=e.data.toString(),o}renderDropdown(e,t){if(e.type!=="enum")throw new Error("Valuetype must be enum.");let o=this.createBasicSelectBox(e),n=mS(".setting-list-object-list-row");return o.render(n),t.appendChild(n),o}};Eie=I([m(1,Pe),m(2,qn),m(3,ot),m(4,B)],Eie);var lKt=class extends Eie{getContainerClasses(){return["setting-list-include-exclude-widget"]}addDragAndDrop(i,e,t){}addTooltipsToRow(i,e){let t=mr(e.sibling)?d(14400,null,e.value.data):d(14402,null,e.value.data,e.sibling);e.source&&(t+=d(14399,null,e.source));let o=new he().appendMarkdown(t),{rowElement:n}=i;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:o})),n.setAttribute("aria-label",t)}getLocalizedStrings(){return{deleteActionTooltip:d(14419,null),editActionTooltip:d(14396,null),addButtonLabel:d(14394,null),inputPlaceholder:d(14401,null),siblingInputPlaceholder:d(14403,null)}}},cKt=class extends Eie{getContainerClasses(){return["setting-list-include-exclude-widget"]}addDragAndDrop(i,e,t){}addTooltipsToRow(i,e){let t=mr(e.sibling)?d(14404,null,e.value.data):d(14406,null,e.value.data,e.sibling);e.source&&(t+=d(14399,null,e.source));let o=new he().appendMarkdown(t),{rowElement:n}=i;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:o})),n.setAttribute("aria-label",t)}getLocalizedStrings(){return{deleteActionTooltip:d(14420,null),editActionTooltip:d(14397,null),addButtonLabel:d(14394,null),inputPlaceholder:d(14405,null),siblingInputPlaceholder:d(14407,null)}}},Nge=class extends Age{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.editable=!0;this.currentSettingKey="";this.showAddButton=!0;this.keySuggester=()=>{};this.valueSuggester=()=>{}}setValue(e,t){this.editable=!t?.isReadOnly,this.showAddButton=t?.showAddButton??this.showAddButton,this.keySuggester=t?.keySuggester??this.keySuggester,this.valueSuggester=t?.valueSuggester??this.valueSuggester,this.propertyNames=t?.propertyNames,so(t)&&t.settingKey!==this.currentSettingKey&&(this.model.setEditKey("none"),this.model.select(null),this.currentSettingKey=t.settingKey),super.setValue(e)}isItemNew(e){return e.key.data===""&&e.value.data===""}isAddButtonVisible(){return this.showAddButton}get isReadOnly(){return!this.editable}getEmptyItem(){return{key:{type:"string",data:""},value:{type:"string",data:""},removable:!0,resetable:!1}}getContainerClasses(){return["setting-list-object-widget"]}getActionsForItem(e,t){if(this.isReadOnly)return[];let o=[{class:q.asClassName(Ege),enabled:!0,id:"workbench.action.editListItem",label:"",tooltip:this.getLocalizedStrings().editActionTooltip,run:()=>this.editSetting(t)}];return e.resetable&&o.push({class:q.asClassName(eSo),enabled:!0,id:"workbench.action.resetListItem",label:"",tooltip:this.getLocalizedStrings().resetActionTooltip,run:()=>this._onDidChangeList.fire({type:"reset",originalItem:e,targetIndex:t})}),e.removable&&o.push({class:q.asClassName(uRi),enabled:!0,id:"workbench.action.removeListItem",label:"",tooltip:this.getLocalizedStrings().deleteActionTooltip,run:()=>this._onDidChangeList.fire({type:"remove",originalItem:e,targetIndex:t})}),o}renderHeader(){let e=mS(".setting-list-row-header"),t=D(e,mS(".setting-list-object-key")),o=D(e,mS(".setting-list-object-value")),{keyHeaderText:n,valueHeaderText:r}=this.getLocalizedStrings();return t.textContent=n,o.textContent=r,e}renderItem(e,t){let o=mS(".setting-list-row");o.classList.add("setting-list-object-row"),this.propertyNames&&e.key.data&&!dvo(this.propertyNames,e.key.data)&&o.classList.add("invalid-key");let n=D(o,mS(".setting-list-object-key")),r=D(o,mS(".setting-list-object-value"));return n.textContent=e.key.data,r.textContent=e.value.data.toString(),{rowElement:o,keyElement:n,valueElement:r}}renderEdit(e,t){let o=mS(".setting-list-edit-row.setting-list-object-row"),n={...e},r=v=>{n.key=v,g.enabled=v.data!=="";let b=this.valueSuggester(v.data)??e.value;this.shouldUseSuggestion(e.value,n.value,b)&&(s(b),h())},s=v=>{n.value=v},l,c;if(this.showAddButton){if(this.isItemNew(e)){let S=this.keySuggester(this.model.items.map(({key:{data:y}})=>y));if(so(S)){n.key=S;let y=this.valueSuggester(n.key.data);s(y??n.value)}}let{widget:v,element:b}=this.renderEditWidget(n.key,{idx:t,isKey:!0,originalItem:e,changedItem:n,update:r});l=v,c=b}else c=mS(".setting-list-object-key"),c.textContent=e.key.data;let u,p=mS(".setting-list-object-value-container"),h=()=>{let{widget:v,element:b}=this.renderEditWidget(n.value,{idx:t,isKey:!1,originalItem:e,changedItem:n,update:s});u=v,St(p),p.append(b)};h(),o.append(c,p);let g=this.listDisposables.add(new Pi(o,Ro));g.enabled=n.key.data!=="",g.label=d(14418,null),g.element.classList.add("setting-list-ok-button"),this.listDisposables.add(g.onDidClick(()=>this.handleItemChange(e,n,t)));let f=this.listDisposables.add(new Pi(o,{secondary:!0,...Ro}));return f.label=d(14395,null),f.element.classList.add("setting-list-cancel-button"),this.listDisposables.add(f.onDidClick(()=>this.cancelEdit())),this.listDisposables.add(Zo(()=>{let v=l??u;v.focus(),v instanceof ad&&v.select()})),o}renderEditWidget(e,t){switch(e.type){case"string":return this.renderStringEditWidget(e,t);case"enum":return this.renderEnumEditWidget(e,t);case"boolean":return this.renderEnumEditWidget({type:"enum",data:e.data.toString(),options:[{value:"true"},{value:"false"}]},t)}}renderStringEditWidget(e,{idx:t,isKey:o,originalItem:n,changedItem:r,update:s}){let l=mS(o?".setting-list-object-input-key":".setting-list-object-input-value"),c=new ad(l,this.contextViewService,{placeholder:o?d(14413,null):d(14417,null),inputBoxStyles:MD({inputBackground:aNe,inputForeground:lNe,inputBorder:__})});c.element.classList.add("setting-list-object-input"),this.listDisposables.add(c),c.value=e.data,this.listDisposables.add(c.onDidChange(p=>s({...e,data:p})));let u=p=>{p.equals(3)?this.handleItemChange(n,r,t):p.equals(9)&&(this.cancelEdit(),p.preventDefault(),p.stopPropagation())};return this.listDisposables.add(Yo(c.inputElement,ne.KEY_DOWN,u)),{widget:c,element:l}}renderEnumEditWidget(e,{isKey:t,changedItem:o,update:n}){let r=this.createBasicSelectBox(e),s=t?o.key:o.value;this.listDisposables.add(r.onDidSelect(({selected:u})=>n(s.type==="boolean"?{...s,data:u==="true"}:{...s,data:u})));let l=mS(".setting-list-object-input");return l.classList.add(t?"setting-list-object-input-key":"setting-list-object-input-value"),r.render(l),e.options.findIndex(u=>e.data===u.value)===-1&&e.options.length?n(s.type==="boolean"?{...s,data:!0}:{...s,data:e.options[0].value}):s.type==="boolean"&&n({...s,data:e.data==="true"}),{widget:r,element:l}}shouldUseSuggestion(e,t,o){if(o.type!=="enum"&&o.type===t.type&&o.data===t.data)return!1;if(e.data==="")return!0;if(t.type===o.type&&o.type!=="enum")return!1;if(t.type==="enum"&&o.type==="enum"){let n=new Set(t.options.map(({value:r})=>r));if(o.options.forEach(({value:r})=>n.delete(r)),n.size===0)return!1}return!0}addTooltipsToRow(e,t){let{keyElement:o,valueElement:n,rowElement:r}=e,s;t.source?s=d(14415,null,t.key.data,t.value.data,t.source):s=d(14414,null,t.key.data,t.value.data);let l=new he().appendMarkdown(s),c=this.getEnumDescription(t.key)??t.keyDescription??l;this.listDisposables.add(this.hoverService.setupDelayedHover(o,{content:c}));let u=this.getEnumDescription(t.value)??l;this.listDisposables.add(this.hoverService.setupDelayedHover(n,{content:u})),r.setAttribute("aria-label",s)}getEnumDescription(e){return e.type==="enum"?e.options.find(({value:o})=>e.data===o)?.description:void 0}getLocalizedStrings(){return{deleteActionTooltip:d(14421,null),resetActionTooltip:d(14422,null),editActionTooltip:d(14398,null),addButtonLabel:d(14393,null),keyHeaderText:d(14412,null),valueHeaderText:d(14416,null)}}};Nge=I([m(1,Pe),m(2,qn),m(3,ot),m(4,B)],Nge);var Oge=class extends Age{constructor(e,t,o,n,r){super(e,t,o,r);this.hoverService=n;this.currentSettingKey=""}setValue(e,t){so(t)&&t.settingKey!==this.currentSettingKey&&(this.model.setEditKey("none"),this.model.select(null),this.currentSettingKey=t.settingKey),super.setValue(e)}isItemNew(e){return!e.key.data&&!e.value.data}getEmptyItem(){return{key:{type:"string",data:""},value:{type:"boolean",data:!1},removable:!1,resetable:!0}}getContainerClasses(){return["setting-list-object-widget"]}getActionsForItem(e,t){return[]}isAddButtonVisible(){return!1}renderHeader(){}renderDataOrEditItem(e,t,o){let n=this.renderEdit(e,t);return n.setAttribute("role","listitem"),n}renderItem(e,t){let o=mS(".blank-row"),n=mS(".blank-row-key");return{rowElement:o,keyElement:n}}renderEdit(e,t){let o=mS(".setting-list-edit-row.setting-list-object-row.setting-item-bool"),n={...e},r=h=>{n.value.data=h,this.handleItemChange(e,n,t)},s=e.keyDescription?`${e.keyDescription} (${e.key.data})`:e.key.data,{element:l,widget:c}=this.renderEditWidget(n.value.data,s,r);o.appendChild(l);let u=D(o,mS(".setting-list-object-value"));u.textContent=s;let p={rowElement:o,keyElement:u,valueElement:c.domNode};return this.addTooltipsToRow(p,e),this._register($(u,ne.MOUSE_DOWN,h=>{h.target.tagName.toLowerCase()!=="a"&&(c.checked=!c.checked,r(c.checked)),Kt.stop(h)})),o}renderEditWidget(e,t,o){let n=new Lm({icon:L.check,actionClassName:"setting-value-checkbox",isChecked:e,title:t,...fJ});this.listDisposables.add(n);let r=mS(".setting-list-object-input");return r.classList.add("setting-list-object-input-key-checkbox"),n.domNode.classList.add("setting-value-checkbox"),r.appendChild(n.domNode),this._register($(r,ne.MOUSE_DOWN,s=>{n.checked=!n.checked,o(n.checked),s.stopImmediatePropagation()})),{widget:n,element:r}}addTooltipsToRow(e,t){let o=d(14414,null,t.key.data,t.value.data),n=t.keyDescription??o,{rowElement:r,keyElement:s,valueElement:l}=e;this.listDisposables.add(this.hoverService.setupDelayedHover(s,{content:n})),l.setAttribute("aria-label",o),r.setAttribute("aria-label",o)}getLocalizedStrings(){return{deleteActionTooltip:d(14421,null),resetActionTooltip:d(14422,null),editActionTooltip:d(14398,null),addButtonLabel:d(14393,null),keyHeaderText:d(14412,null),valueHeaderText:d(14416,null)}}};Oge=I([m(1,Pe),m(2,qn),m(3,ot),m(4,B)],Oge);var Im=_,dsn=new Set(["accessibility.signals.chatUserActionRequired","accessibility.signals.chatResponseReceived"]);function usn(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=a.isConfigured?{...i,...a.scopeValue}:i;return Object.keys(e).filter(t=>!!e[t]).map(t=>{let o=i[t],n;if(o===e[t]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let l=a.defaultValueSource.get(`${a.setting.key}.${t}`);n=typeof l=="string"?l:l?.displayName}let r=e[t],s=typeof r=="boolean"?void 0:r.when;return{value:{type:"string",data:t},sibling:s,elementType:a.valueType,source:n}})}function psn(a,i){let e=new Set(a);return i.forEach(({key:t})=>e.delete(t.data)),e.size===0}function pnt(a){if(a.anyOf)return a.anyOf.map(pnt).flat();let i=a.enumDescriptions??[];return(a.enum??[]).map((e,t)=>{let o=t<i.length?i[t]:void 0;return{value:e,description:o}})}function mnt(a){return a.anyOf?a.anyOf.map(mnt).some(e=>e==="enum")?"enum":"string":a.type==="boolean"?"boolean":a.type==="string"&&so(a.enum)&&a.enum.length>0?"enum":"string"}function CRi(a,i,e){return a==="boolean"?{type:a,data:!!i}:a==="enum"?{type:a,data:""+i,options:e}:{type:a,data:""+i}}function kSo(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=typeof a.scopeValue=="object"?a.scopeValue??{}:{},t=a.isConfigured?{...i,...e}:a.hasPolicyValue||a.isAgentsWindowReadOnly?a.scopeValue:i,{objectProperties:o,objectPatternProperties:n,objectAdditionalProperties:r}=a.setting,s=Object.entries(n??{}).map(([c,u])=>({pattern:new RegExp(c),schema:u})),l=Object.entries(o??{}).map(([c,u])=>({value:c,description:u.description}));return Object.keys(t).map(c=>{let u=i[c],p;if(u===t[c]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let b=a.defaultValueSource.get(`${a.setting.key}.${c}`);p=typeof b=="string"?b:b?.displayName}if(so(o)&&c in o){let b=pnt(o[c]);return{key:{type:"enum",data:c,options:l},value:CRi(mnt(o[c]),t[c],b),keyDescription:o[c].description,removable:mr(u),resetable:!mr(u),source:p}}let h=u===void 0||sKt(a.setting.key),g=!!u&&u!==t[c],f=s.find(({pattern:b})=>b.test(c))?.schema;if(f){let b=pnt(f);return{key:{type:"string",data:c},value:CRi(mnt(f),t[c],b),keyDescription:f.description,removable:h,resetable:g,source:p}}let v=pnt(typeof r=="boolean"?{}:r??{});return{key:{type:"string",data:c},value:CRi(typeof r=="object"?mnt(r):"string",t[c],v),keyDescription:typeof r=="object"?r.description:void 0,removable:h,resetable:g,source:p}}).filter(c=>!mr(c.value.data))}function msn(a){let i=typeof a.defaultValue=="object"?a.defaultValue??{}:{},e=typeof a.scopeValue=="object"?a.scopeValue??{}:{},t=a.isConfigured?{...i,...e}:i,{objectProperties:o}=a.setting,n=[];for(let r in o){let s=i[r],l;if(s===t[r]&&a.setting.type==="object"&&a.defaultValueSource instanceof Map){let c=a.defaultValueSource.get(r);l=typeof c=="string"?c:c?.displayName}n.push({key:{type:"string",data:r},value:{type:"boolean",data:!!t[r]},keyDescription:o[r].description,removable:!1,resetable:!0,source:l})}return n}function hsn(a){return(i,e)=>{let t=[];return a.setting.enum&&a.setting.enum.forEach((o,n)=>{if(!a.setting.uniqueItems||e!==void 0&&o===i[e]||!i.includes(o)){let r=a.setting.enumDescriptions?.[n];t.push({value:o,description:r})}}),t.length>0?{type:"enum",data:t[0].value,options:t}:void 0}}function gsn(a){let{objectProperties:i}=a.setting,e=Object.keys(i??{});return t=>{let o=new Set(t),n=[];return e.forEach(r=>{o.has(r)||n.push({value:r,description:i[r].description})}),n.length>0?{type:"enum",data:n[0].value,options:n}:void 0}}function fsn(a){let{objectProperties:i,objectPatternProperties:e,objectAdditionalProperties:t}=a.setting,o=Object.entries(e??{}).map(([n,r])=>({pattern:new RegExp(n),schema:r}));return n=>{let r;so(i)&&n in i&&(r=i[n]);let s=r??o.find(({pattern:l})=>l.test(n))?.schema;if(so(s)?r=s:so(t)&&typeof t=="object"&&(r=t),so(r)){let l=mnt(r);if(l==="boolean")return{type:l,data:r.default??!0};if(l==="enum"){let c=pnt(r);return{type:l,data:r.default??c[0].value,options:c}}else return{type:l,data:r.default??""}}}}function dKt(a){return a==="number"||a==="integer"}function vsn(a,i){let e={};for(let t in i){let o,n=a.setting.objectPatternProperties,r=a.setting.objectProperties,s=a.setting.objectAdditionalProperties;if(r){for(let l in r)if(l===t){o=dKt(r[l].type);break}}if(o===void 0&&n){for(let l in n)if(t.match(l)){o=dKt(n[l].type);break}}o===void 0&&s&&typeof s!="boolean"&&dKt(s.type)&&(o=!0),e[t]=o?Number(i[t]):i[t]}return e}function bsn(a){if(!a.value||!Array.isArray(a.value))return[];if(a.setting.arrayItemType==="enum"){let i=[];return a.setting.enum&&(i=a.setting.enum.map((e,t)=>({value:e,description:a.setting.enumDescriptions?.[t]}))),a.value.map(e=>({value:{type:"enum",data:e,options:i}}))}else return a.value.map(i=>({value:{type:"string",data:i}}))}function Ssn(a,i){return a.setting.enum&&a.setting.uniqueItems?a.setting.enum.length-i.length>0:!0}function ESo(a,i,e,t){let o=MSo(i);return{tree:DSo(a,o,e,t),leftoverSettings:o}}function TSo(a,i,e,t){return[...MSo(a)].filter(n=>n.restricted&&yRi(n.key,i,e,t).isConfigured)}async function _So(a,i,e){let t=new Map,o=(s,l,c)=>{if(!t.has(s)){let u={id:s,label:l,children:[]};t.set(s,u)}t.get(s).children.push(c)},n=async s=>{let l=s.sections.map(v=>v.settings).flat(),c=e?LSo(new Set(l),e):l;RSo(c);let u=s.extensionInfo.id,p=await a.getExtension(u),h=p?.displayName??p?.name??u,f={id:s.id&&s.id!==u?s.id:s.title,label:s.title,order:s.order,settings:c};o(u,h,f)},r=i.map(s=>n(s));return Promise.all(r).then(()=>{let s=[];for(let l of t.values())if(l.children.length===1)s.push({id:l.id,label:l.children[0].label,settings:l.children[0].settings});else{l.children.sort((u,p)=>xge(u.order,p.order));let c=l.children.find(u=>u.label===l.label);if(c&&!c.children){let u=l.children.filter(p=>p!==c);s.push({id:l.id,label:l.label,settings:c.settings,children:u})}else s.push(l)}return s.sort((l,c)=>l.label.localeCompare(c.label)),{id:"extensions",label:d(14382,null),children:s}})}function DSo(a,i,e,t){let o;a.children&&(o=a.children.filter(r=>r.hide!==!0).map(r=>DSo(r,i,e,t)).filter(r=>r.children?.length||r.settings?.length));let n;if((e||a.settings)&&(n=LSo(i,{include:{keyPatterns:[...e?.include?.keyPatterns??[],...a.settings??[]],tags:e?.include?.tags?[...e.include.tags]:[]},exclude:e?.exclude??{}}),RSo(n)),!o&&!n)throw new Error(`TOC node has no child groups or settings: ${a.id}`);return{id:a.id,label:a.label,children:o,settings:n}}function RSo(a){let o=n=>n.tags?.includes("experimental")?2:n.tags?.includes("preview")?1:0;a.sort((n,r)=>{let s=o(n),l=o(r);if(s!==l)return s-l;let c=xge(n.order,r.order);return c!==0?c:n.key.localeCompare(r.key)})}function LSo(a,i){let e=[];return a.forEach(t=>{let o=!1,n=!1;i.include?.keyPatterns?o=i.include.keyPatterns.some(r=>{if(r.startsWith("@tag:")){let s=r.substring(5);return t.tags?.includes(s)}else return CSo(t,r)}):o=!0,o&&i.include?.tags?.length&&(o=i.include.tags.some(r=>t.tags?.includes(r))),i.exclude?.keyPatterns&&(n=i.exclude.keyPatterns.some(r=>{if(r.startsWith("@tag:")){let s=r.substring(5);return t.tags?.includes(s)}else return CSo(t,r)})),!n&&i.exclude?.tags?.length&&(n=i.exclude.tags.some(r=>t.tags?.includes(r))),o&&!n&&(e.push(t),dsn.has(t.key)||a.delete(t))}),e}var wSo=new Map;function Isn(a){return a=Ss(a).replace(/\\\*/g,".*"),new RegExp(`^${a}$`,"i")}function CSo(a,i){let e=wSo.get(i);return e||(e=Isn(i),wSo.set(i,e)),e.test(a.key)}function MSo(a){let i=new Set;for(let e of a)for(let t of e.sections)for(let o of t.settings)(!o.overrides||!o.overrides.length)&&i.add(o);return i}var PSo="settings.text.template",ASo="settings.multilineText.template",NSo="settings.number.template",OSo="settings.enum.template",FSo="settings.bool.template",WSo="settings.array.template",VSo="settings.exclude.template",BSo="settings.include.template",HSo="settings.object.template",USo="settings.boolObject.template",uKt="settings.complex.template",zSo="settings.complexObject.template",KSo="settings.newExtensions.template",GSo="settings.group.template",qSo="settings.extensionToggle.template";function ysn(a){a.querySelectorAll(`
		[tabindex="0"],
		input:not([tabindex="-1"]),
		select:not([tabindex="-1"]),
		textarea:not([tabindex="-1"]),
		a:not([tabindex="-1"]),
		button:not([tabindex="-1"]),
		area:not([tabindex="-1"])
	`).forEach(e=>{e.setAttribute(tu.ELEMENT_FOCUSABLE_ATTR,"true"),e.setAttribute("tabindex","-1")})}function wsn(a){a.querySelectorAll(`[${tu.ELEMENT_FOCUSABLE_ATTR}="true"]`).forEach(e=>{e.removeAttribute(tu.ELEMENT_FOCUSABLE_ATTR),e.setAttribute("tabindex","0")})}var tu=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.settingActions=e;this.disposableActionFactory=t;this._themeService=o;this._contextViewService=n;this._openerService=r;this._instantiationService=s;this._commandService=l;this._contextMenuService=c;this._keybindingService=u;this._configService=p;this._extensionsService=h;this._extensionsWorkbenchService=g;this._productService=f;this._telemetryService=v;this._hoverService=b;this._markdownRendererService=S;this._onDidClickOverrideElement=this._register(new T);this.onDidClickOverrideElement=this._onDidClickOverrideElement.event;this._onDidChangeSetting=this._register(new T);this.onDidChangeSetting=this._onDidChangeSetting.event;this._onDidOpenSettings=this._register(new T);this.onDidOpenSettings=this._onDidOpenSettings.event;this._onDidClickSettingLink=this._register(new T);this.onDidClickSettingLink=this._onDidClickSettingLink.event;this._onDidFocusSetting=this._register(new T);this.onDidFocusSetting=this._onDidFocusSetting.event;this._onDidChangeIgnoredSettings=this._register(new T);this.onDidChangeIgnoredSettings=this._onDidChangeIgnoredSettings.event;this._onDidChangeSettingHeight=this._register(new T);this.onDidChangeSettingHeight=this._onDidChangeSettingHeight.event;this._onApplyFilter=this._register(new T);this.onApplyFilter=this._onApplyFilter.event;this.ignoredSettings=v1t(eie(),this._configService),this._register(this._configService.onDidChangeConfiguration(y=>{this.ignoredSettings=v1t(eie(),this._configService),this._onDidChangeIgnoredSettings.fire()}))}static{this.CONTROL_CLASS="setting-control-focus-target"}static{this.CONTROL_SELECTOR="."+this.CONTROL_CLASS}static{this.CONTENTS_CLASS="setting-item-contents"}static{this.CONTENTS_SELECTOR="."+this.CONTENTS_CLASS}static{this.ALL_ROWS_SELECTOR=".monaco-list-row"}static{this.SETTING_KEY_ATTR="data-key"}static{this.SETTING_ID_ATTR="data-id"}static{this.ELEMENT_FOCUSABLE_ATTR="data-focusable"}renderCommonTemplate(e,t,o){t.classList.add("setting-item"),t.classList.add("setting-item-"+o);let n=new O,r=D(t,Im(tu.CONTENTS_SELECTOR));r.classList.add("settings-row-inner-container");let s=D(r,Im(".setting-item-title")),l=D(s,Im(".setting-item-cat-label-container")),c=D(l,Im("span.setting-item-category")),u=D(l,Im("span.setting-item-label")),p=n.add(new ak(u)),h=n.add(this._instantiationService.createInstance(Lge,s)),g=D(r,Im(".setting-item-description")),f=D(r,Im(".setting-item-modified-indicator"));n.add(this._hoverService.setupDelayedHover(f,{content:d(14383,null)}));let v=D(r,Im(".setting-item-value")),b=D(v,Im("div.setting-item-control")),S=D(r,Im(".setting-item-deprecation-message")),y=D(r,Im(".setting-toolbar-container")),w=this.renderSettingToolbar(y),x={toDispose:n,elementDisposables:n.add(new O),containerElement:r,categoryElement:c,labelElement:p,descriptionElement:g,controlElement:b,deprecationWarningElement:S,indicatorsLabel:h,toolbar:w};return n.add($(b,ne.MOUSE_DOWN,E=>E.stopPropagation())),n.add($(s,ne.MOUSE_ENTER,E=>r.classList.add("mouseover"))),n.add($(s,ne.MOUSE_LEAVE,E=>r.classList.remove("mouseover"))),x}addSettingElementFocusHandler(e){let t=nr(e.containerElement);e.toDispose.add(t),e.toDispose.add(t.onDidBlur(()=>{e.containerElement.classList.contains("focused")&&e.containerElement.classList.remove("focused")})),e.toDispose.add(t.onDidFocus(()=>{e.containerElement.classList.add("focused"),e.context&&this._onDidFocusSetting.fire(e.context)}))}renderSettingToolbar(e){let t=this._keybindingService.appendKeybinding(d(14389,null),Dzt);return new Kp(e,this._contextMenuService,{toggleMenuTitle:t,renderDropdownAsChildElement:!Tc,moreIcon:Qbo})}renderSettingElement(e,t,o){let n=e.element;n.inspectSelf(),o.context=n,o.toolbar.context=n;let r=this.disposableActionFactory(n.setting,n.settingsTarget);r.forEach(p=>Sd(p)&&o.elementDisposables.add(p)),o.toolbar.setActions([],[...this.settingActions,...r]);let s=n.setting;o.containerElement.classList.toggle("is-configured",n.isConfigured),o.containerElement.setAttribute(tu.SETTING_KEY_ATTR,n.setting.key),o.containerElement.setAttribute(tu.SETTING_ID_ATTR,n.id);let l=s.key+(n.isConfigured?" - Modified":"");if(o.categoryElement.textContent=n.displayCategory?n.displayCategory+": ":"",o.elementDisposables.add(this._hoverService.setupDelayedHover(o.categoryElement,{content:l})),o.labelElement.text=n.displayLabel,o.labelElement.title=l,o.descriptionElement.innerText="",n.setting.descriptionIsMarkdown){let p=this.renderSettingMarkdown(n,o.containerElement,n.description,o.elementDisposables);o.descriptionElement.appendChild(p)}else o.descriptionElement.innerText=n.description;o.indicatorsLabel.updateScopeOverrides(n,this._onDidClickOverrideElement,this._onApplyFilter),o.elementDisposables.add(this._configService.onDidChangeConfiguration(p=>{p.affectsConfiguration(gw)&&o.indicatorsLabel.updateScopeOverrides(n,this._onDidClickOverrideElement,this._onApplyFilter)}));let c=p=>this._onDidChangeSetting.fire({key:n.setting.key,value:p,type:o.context.valueType,manualReset:!1,scope:n.setting.scope}),u=n.setting.deprecationMessage||"";u&&n.setting.deprecationMessageIsMarkdown?(o.deprecationWarningElement.innerText="",o.deprecationWarningElement.appendChild(this.renderSettingMarkdown(n,o.containerElement,n.setting.deprecationMessage,o.elementDisposables))):o.deprecationWarningElement.innerText=u,o.deprecationWarningElement.prepend(Im(".codicon.codicon-error")),o.containerElement.classList.toggle("is-deprecated",!!u),this.renderValue(n,o,c),o.indicatorsLabel.updateWorkspaceTrust(n),o.indicatorsLabel.updateSyncIgnored(n,this.ignoredSettings),o.indicatorsLabel.updateDefaultOverrideIndicator(n),o.indicatorsLabel.updatePreviewIndicator(n),o.indicatorsLabel.updateAdvancedIndicator(n),o.elementDisposables.add(this.onDidChangeIgnoredSettings(()=>{o.indicatorsLabel.updateSyncIgnored(n,this.ignoredSettings)})),this.updateSettingTabbable(n,o),o.elementDisposables.add(n.onDidChangeTabbable(()=>{this.updateSettingTabbable(n,o)}))}updateSettingTabbable(e,t){e.tabbable?wsn(t.containerElement):ysn(t.containerElement)}renderSettingMarkdown(e,t,o,n){o=BRi(o);let r=n.add(this._markdownRendererService.render({value:o,isTrusted:!0},{actionHandler:s=>{if(s.startsWith("#")){let l={source:e,targetKey:s.substring(1)};this._onDidClickSettingLink.fire(l)}else this._openerService.open(s,{allowCommands:!0}).catch(mt)},asyncRenderCallback:()=>{let s=t.clientHeight;s&&this._onDidChangeSettingHeight.fire({element:e,height:s})}}));return r.element.classList.add("setting-item-markdown"),$So(r.element),r.element}disposeTemplate(e){e.toDispose.dispose()}disposeElement(e,t,o){o.elementDisposables?.clear()}};tu=I([m(2,Pe),m(3,qn),m(4,Je),m(5,F),m(6,fe),m(7,Xe),m(8,Le),m(9,B),m(10,lt),m(11,Ui),m(12,Ze),m(13,_e),m(14,ot),m(15,_n)],tu);var xRi=class{constructor(){this.templateId=GSo}renderTemplate(i){return i.classList.add("group-title"),{parent:i,toDispose:new O}}renderElement(i,e,t){t.parent.innerText="";let o=D(t.parent,Im("div.settings-group-title-label.settings-row-inner-container"));o.classList.add(`settings-group-level-${i.element.level}`),o.textContent=i.element.label,i.element.isFirstGroup&&o.classList.add("settings-group-first")}disposeTemplate(i){i.toDispose.dispose()}},unt=class{constructor(i){this._commandService=i;this.templateId=KSo}renderTemplate(i){let e=new O;i.classList.add("setting-item-new-extensions");let t=new Pi(i,{title:!0,...Ro});e.add(t),e.add(t.onDidClick(()=>{o.context&&this._commandService.executeCommand("workbench.extensions.action.showExtensionsWithIds",o.context.extensionIds)})),t.label=d(14384,null),t.element.classList.add("settings-new-extensions-button");let o={button:t,toDispose:e};return o}renderElement(i,e,t){t.context=i.element}disposeTemplate(i){i.toDispose.dispose()}};unt=I([m(0,fe)],unt);var pKt=class a extends tu{constructor(){super(...arguments);this.templateId=uKt}static{this.EDIT_IN_JSON_LABEL=d(14380,null)}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"complex"),o=D(t.controlElement,Im("a.edit-in-settings-button"));o.classList.add(tu.CONTROL_CLASS),o.role="button";let n=Im(".setting-item-validation-message");t.containerElement.appendChild(n);let r={...t,button:o,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=eCe(e.setting.key),r=d(14381,null,n),s=e.setting.isLanguageTagSetting;t.button.textContent=s?r:a.EDIT_IN_JSON_LABEL;let l=c=>{s?this._onApplyFilter.fire(`@${KW}${n.replaceAll(" ","")}`):this._onDidOpenSettings.fire(e.setting.key),c.preventDefault(),c.stopPropagation()};t.elementDisposables.add($(t.button,ne.CLICK,c=>{l(c)})),t.elementDisposables.add($(t.button,ne.KEY_DOWN,c=>{let u=new mi(c);(u.equals(10)||u.equals(3))&&l(c)})),this.renderValidations(e,t),s?t.button.setAttribute("aria-label",r):t.button.setAttribute("aria-label",`${a.EDIT_IN_JSON_LABEL}: ${e.setting.key}`)}renderValidations(e,t){let o=e.isConfigured&&h_i(e.value,e.setting.type);if(o){t.containerElement.classList.add("invalid-input"),t.validationErrorMessageElement.innerText=o;return}t.containerElement.classList.remove("invalid-input")}},kRi=class extends pKt{constructor(){super(...arguments);this.templateId=zSo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=t.toDispose.add(this._instantiationService.createInstance(Nge,t.controlElement));o.domNode.classList.add(tu.CONTROL_CLASS);let n=D(D(t.controlElement,Im(".complex-object-edit-in-settings-button-container")),Im("a.complex-object.edit-in-settings-button"));n.classList.add(tu.CONTROL_CLASS),n.role="button";let r=Im(".setting-item-validation-message");t.containerElement.appendChild(r);let s={...t,button:n,validationErrorMessageElement:r,objectSettingWidget:o};return this.addSettingElementFocusHandler(s),s}renderValue(e,t,o){let n=kSo(e);t.objectSettingWidget.setValue(n,{settingKey:e.setting.key,showAddButton:!1,isReadOnly:!0}),t.button.parentElement?.classList.toggle("hide",e.hasPolicyValue||e.isAgentsWindowReadOnly),super.renderValue(e,t,o)}},ERi=class extends tu{constructor(){super(...arguments);this.templateId=WSo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=t.containerElement.querySelector(".setting-item-description"),n=Im(".setting-item-validation-message");o.after(n);let r=this._instantiationService.createInstance(Eie,t.controlElement);r.domNode.classList.add(tu.CONTROL_CLASS),t.toDispose.add(r);let s={...t,listWidget:r,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(s),t.toDispose.add(r.onDidChangeList(l=>{let c=this.computeNewList(s,l);s.onChange?.(c)})),s}computeNewList(e,t){if(e.context){let o=[];if(Array.isArray(e.context.scopeValue)?o=[...e.context.scopeValue]:Array.isArray(e.context.value)&&(o=[...e.context.value]),t.type==="move"){let n=t.sourceIndex,r=t.targetIndex,s=o.splice(n,1)[0];o.splice(r,0,s)}else if(t.type==="remove"||t.type==="reset")o.splice(t.targetIndex,1);else if(t.type==="change"){let n=t.newItem.value.data.toString();t.targetIndex>-1?o[t.targetIndex]=n:o.push(n)}else t.type==="add"&&o.push(t.newItem.value.data.toString());return e.context.defaultValue&&Array.isArray(e.context.defaultValue)&&e.context.defaultValue.length===o.length&&e.context.defaultValue.join()===o.join()?void 0:o}}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=bsn(e),r=e.setting.enum?hsn(e):void 0;t.listWidget.setValue(n,{showAddButton:Ssn(e,n),keySuggester:r}),t.context=e,t.elementDisposables.add(ee(()=>{t.listWidget.cancelEdit()})),t.onChange=s=>{if(s&&!vKt(e,t,s,!1)){let l=e.setting.arrayItemType,c=dKt(l)?s.map(u=>+u):s;o(c)}else o(s)},vKt(e,t,n.map(s=>s.value.data.toString()),!0)}},mKt=class extends tu{renderTemplateWithWidget(i,e){e.domNode.classList.add(tu.CONTROL_CLASS),i.toDispose.add(e);let t=i.containerElement.querySelector(".setting-item-description"),o=Im(".setting-item-validation-message");t.after(o);let n={...i,validationErrorMessageElement:o};return e instanceof Oge?n.objectCheckboxWidget=e:n.objectDropdownWidget=e,this.addSettingElementFocusHandler(n),n}renderElement(i,e,t){super.renderSettingElement(i,e,t)}},TRi=class extends mKt{constructor(){super(...arguments);this.templateId=HSo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=this._instantiationService.createInstance(Nge,t.controlElement),n=this.renderTemplateWithWidget(t,o);return t.toDispose.add(o.onDidChangeList(r=>{this.onDidChangeObject(n,r)})),n}onDidChangeObject(e,t){let o=e.objectDropdownWidget;if(e.context){let n=sKt(e.context.setting.key),r=typeof e.context.defaultValue=="object"?e.context.defaultValue??{}:{},s=typeof e.context.scopeValue=="object"?e.context.scopeValue??{}:{},l={...e.context.scopeValue},c=[];if(o.items.forEach((p,h)=>{(t.type==="change"||t.type==="move")&&t.targetIndex===h?(t.originalItem.key.data!==t.newItem.key.data&&n&&t.originalItem.key.data in r?l[t.originalItem.key.data]=null:delete l[t.originalItem.key.data],l[t.newItem.key.data]=t.newItem.value.data,c.push(t.newItem)):(t.type!=="change"&&t.type!=="move"||t.newItem.key.data!==p.key.data)&&(l[p.key.data]=p.value.data,c.push(p))}),t.type==="remove"||t.type==="reset"){let p=t.originalItem.key.data,h=t.type==="remove"&&n&&r[p]===t.originalItem.value.data;h?l[p]=null:delete l[p];let g=c.findIndex(v=>v.key.data===p),f=r[p];h||mr(r[p])&&g>-1?c.splice(g,1):!h&&g>-1&&(c[g].value.data=f)}else t.type==="add"&&(l[t.newItem.key.data]=t.newItem.value.data,c.push(t.newItem));Object.entries(l).forEach(([p,h])=>{s[p]!==h&&r[p]===h&&!(n&&h===null)&&delete l[p]});let u=Object.keys(l).length===0?void 0:l;e.objectDropdownWidget.setValue(c),e.onChange?.(u)}}renderValue(e,t,o){let n=kSo(e),{key:r,objectProperties:s,objectPatternProperties:l,objectAdditionalProperties:c,propertyNames:u}=e.setting;t.objectDropdownWidget.setValue(n,{settingKey:r,showAddButton:c===!1?!psn(Object.keys(s??{}),n)||so(l):!0,keySuggester:gsn(e),valueSuggester:fsn(e),propertyNames:u}),t.context=e,t.elementDisposables.add(ee(()=>{t.objectDropdownWidget.cancelEdit()})),t.onChange=p=>{if(p&&!vKt(e,t,p,!1)){let h=vsn(e,p);o(h)}else o(p)},vKt(e,t,e.value,!0)}},_Ri=class extends mKt{constructor(){super(...arguments);this.templateId=USo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"list"),o=this._instantiationService.createInstance(Oge,t.controlElement),n=this.renderTemplateWithWidget(t,o);return t.toDispose.add(o.onDidChangeList(r=>{this.onDidChangeObject(n,r)})),n}onDidChangeObject(e,t){if(e.context){let o=e.objectCheckboxWidget,n=typeof e.context.defaultValue=="object"?e.context.defaultValue??{}:{},r=typeof e.context.scopeValue=="object"?e.context.scopeValue??{}:{},s={...e.context.scopeValue},l=[];if(t.type!=="change"){console.warn("Unexpected event type",t.type,"for bool object setting",e.context.setting.key);return}o.items.forEach((u,p)=>{t.targetIndex===p?(s[t.newItem.key.data]=t.newItem.value.data,l.push(t.newItem)):t.newItem.key.data!==u.key.data&&(s[u.key.data]=u.value.data,l.push(u))}),Object.entries(s).forEach(([u,p])=>{r[u]!==p&&n[u]===p&&delete s[u]});let c=Object.keys(s).length===0?void 0:s;e.objectCheckboxWidget.setValue(l),e.onChange?.(c),this._onDidFocusSetting.fire(e.context)}}renderValue(e,t,o){let n=msn(e),{key:r}=e.setting;t.objectCheckboxWidget.setValue(n,{settingKey:r}),t.context=e,t.onChange=s=>{o(s)}}},hKt=class extends tu{renderTemplate(i){let e=this.renderCommonTemplate(null,i,"list"),t=this._instantiationService.createInstance(this.isExclude()?lKt:cKt,e.controlElement);t.domNode.classList.add(tu.CONTROL_CLASS),e.toDispose.add(t);let o={...e,includeExcludeWidget:t};return this.addSettingElementFocusHandler(o),e.toDispose.add(t.onDidChangeList(n=>this.onDidChangeIncludeExclude(o,n))),o}onDidChangeIncludeExclude(i,e){if(i.context){let o=function(n){let r=Object.keys(n).sort((l,c)=>l.localeCompare(c)),s={};for(let l of r)s[l]=n[l];return s},t={...i.context.scopeValue};e.type!=="add"&&(e.originalItem.value.data.toString()in i.context.defaultValue?t[e.originalItem.value.data.toString()]=!1:delete t[e.originalItem.value.data.toString()]),(e.type==="change"||e.type==="add"||e.type==="move")&&(e.newItem.value.data.toString()in i.context.defaultValue&&!e.newItem.sibling?delete t[e.newItem.value.data.toString()]:t[e.newItem.value.data.toString()]=e.newItem.sibling?{when:e.newItem.sibling}:!0),this._onDidChangeSetting.fire({key:i.context.setting.key,value:Object.keys(t).length===0?void 0:o(t),type:i.context.valueType,manualReset:!1,scope:i.context.setting.scope})}}renderElement(i,e,t){super.renderSettingElement(i,e,t)}renderValue(i,e,t){let o=usn(i);e.includeExcludeWidget.setValue(o,{isReadOnly:i.hasPolicyValue||i.isAgentsWindowReadOnly}),e.context=i,e.elementDisposables.add(ee(()=>{e.includeExcludeWidget.cancelEdit()}))}},DRi=class extends hKt{constructor(){super(...arguments);this.templateId=VSo}isExclude(){return!0}},RRi=class extends hKt{constructor(){super(...arguments);this.templateId=BSo}isExclude(){return!1}},Csn=MD({inputBackground:aNe,inputForeground:lNe,inputBorder:__}),gKt=class extends tu{constructor(){super(...arguments);this.MULTILINE_MAX_HEIGHT=150}renderTemplate(e,t){let o=this.renderCommonTemplate(null,e,"text"),n=D(o.containerElement,Im(".setting-item-validation-message")),r={flexibleHeight:t,flexibleWidth:!1,flexibleMaxHeight:this.MULTILINE_MAX_HEIGHT,inputBoxStyles:Csn},s=new ad(o.controlElement,this._contextViewService,r);o.toDispose.add(s),o.toDispose.add(s.onDidChange(c=>{l.onChange?.(c)})),o.toDispose.add(s),s.inputElement.classList.add(tu.CONTROL_CLASS),s.inputElement.tabIndex=0;let l={...o,inputBox:s,validationErrorMessageElement:n};return this.addSettingElementFocusHandler(l),l}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.onChange=void 0,t.inputBox.value=e.value,t.inputBox.setEnabled(!e.hasPolicyValue&&!e.isAgentsWindowReadOnly),t.inputBox.setAriaLabel(e.setting.key),t.onChange=n=>{fKt(e,t,!1)||o(n)},fKt(e,t,!0)}},LRi=class extends gKt{constructor(){super(...arguments);this.templateId=PSo}renderTemplate(e){let t=super.renderTemplate(e,!1);return t.toDispose.add(Yo(t.inputBox.inputElement,ne.KEY_DOWN,o=>{(o.equals(16)||o.equals(18))&&o.preventDefault()})),t}},MRi=class extends gKt{constructor(){super(...arguments);this.templateId=ASo}renderTemplate(e){return super.renderTemplate(e,!0)}renderValue(e,t,o){let n=r=>{e.value=r,o(r)};super.renderValue(e,t,n),t.elementDisposables.add(t.inputBox.onDidHeightChange(r=>{t.containerElement.clientHeight&&this._onDidChangeSettingHeight.fire({element:e,height:t.containerElement.clientHeight})})),t.inputBox.layout()}},PRi=class extends tu{constructor(){super(...arguments);this.templateId=OSo}renderTemplate(e){let t=this.renderCommonTemplate(null,e,"enum"),o=Tkt({selectBackground:Xzt,selectForeground:Jzt,selectBorder:Zzt,selectListBorder:eKt}),n=new Jw([],0,this._contextViewService,o,{useCustomDrawn:!BI(this._configService)||!(Tc&&of.pointerEvents)});t.toDispose.add(n),n.render(t.controlElement);let r=t.controlElement.querySelector("select");r&&(r.classList.add(tu.CONTROL_CLASS),r.tabIndex=0),t.toDispose.add(n.onDidSelect(c=>{l.onChange?.(c.index)}));let s=t.containerElement.insertBefore(Im(".setting-item-enumDescription"),t.descriptionElement.nextSibling),l={...t,selectBox:n,selectElement:r,enumDescriptionElement:s};return this.addSettingElementFocusHandler(l),l}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=e.setting.enumItemLabels?[...e.setting.enumItemLabels]:[],r=e.setting.enumDescriptions?[...e.setting.enumDescriptions]:[],s=[...e.setting.enum],l=e.setting.enumDescriptionsAreMarkdown,c=new O;t.elementDisposables.add(c);let u=!1;s.includes(e.defaultValue)||(s.unshift(e.defaultValue),r.unshift(""),n.unshift(""),u=!0);let p=xSo(String(e.defaultValue)),h=s.map(String).map(xSo).map((f,v)=>{let b=r[v]&&(l?BRi(r[v],!1):r[v]);return{text:n[v]?n[v]:f,detail:n[v]?f:"",description:b,descriptionIsMarkdown:l,descriptionMarkdownActionHandler:S=>{this._openerService.open(S).catch(mt)},decoratorRight:f===p||u&&v===0?d(14387,null):""}});t.selectBox.setOptions(h),t.selectBox.setAriaLabel(e.setting.key),t.selectBox.setEnabled(!e.hasPolicyValue&&!e.isAgentsWindowReadOnly);let g=s.indexOf(e.value);g===-1&&(g=0),t.onChange=void 0,t.selectBox.select(g),t.onChange=f=>{o(u&&f===0?e.defaultValue:s[f])},t.enumDescriptionElement.innerText=""}},xsn=MD({inputBackground:nSo,inputForeground:rSo,inputBorder:sSo}),ARi=class extends tu{constructor(){super(...arguments);this.templateId=NSo}renderTemplate(e){let t=super.renderCommonTemplate(null,e,"number"),o=D(t.containerElement,Im(".setting-item-validation-message")),n=new ad(t.controlElement,this._contextViewService,{type:"number",inputBoxStyles:xsn});t.toDispose.add(n),t.toDispose.add(n.onDidChange(s=>{r.onChange?.(s)})),t.toDispose.add(n),n.inputElement.classList.add(tu.CONTROL_CLASS),n.inputElement.tabIndex=0;let r={...t,inputBox:n,validationErrorMessageElement:o};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){let n=e.valueType==="integer"||e.valueType==="nullable-integer"?parseInt:parseFloat,r=e.valueType==="nullable-integer"||e.valueType==="nullable-number"?(s=>s===""?null:n(s)):n;t.onChange=void 0,t.inputBox.value=typeof e.value=="number"?e.value.toString():"",t.inputBox.step=e.valueType.includes("integer")?"1":"any",t.inputBox.setAriaLabel(e.setting.key),t.inputBox.setEnabled(!e.hasPolicyValue&&!e.isAgentsWindowReadOnly),t.onChange=s=>{fKt(e,t,!1)||o(r(s))},fKt(e,t,!0)}},NRi=class extends tu{constructor(){super(...arguments);this.templateId=FSo}renderTemplate(e){e.classList.add("setting-item"),e.classList.add("setting-item-bool");let t=new O,o=D(e,Im(tu.CONTENTS_SELECTOR));o.classList.add("settings-row-inner-container");let n=D(o,Im(".setting-item-title")),r=D(n,Im("span.setting-item-category")),s=D(n,Im("span.setting-item-label")),l=t.add(new ak(s)),c=t.add(this._instantiationService.createInstance(Lge,n)),u=D(o,Im(".setting-item-value-description")),p=D(u,Im(".setting-item-bool-control")),h=D(u,Im(".setting-item-description")),g=D(o,Im(".setting-item-modified-indicator"));t.add(this._hoverService.setupDelayedHover(g,{content:d(14383,null)}));let f=D(o,Im(".setting-item-deprecation-message")),v=new Lm({icon:L.check,actionClassName:"setting-value-checkbox",isChecked:!0,title:"",...fJ});p.appendChild(v.domNode),t.add(v),t.add(v.onChange(()=>{y.onChange(v.checked)})),v.domNode.classList.add(tu.CONTROL_CLASS);let b=D(o,Im(".setting-toolbar-container")),S=this.renderSettingToolbar(b);t.add(S);let y={toDispose:t,elementDisposables:t.add(new O),containerElement:o,categoryElement:r,labelElement:l,controlElement:p,checkbox:v,descriptionElement:h,deprecationWarningElement:f,indicatorsLabel:c,toolbar:S};return this.addSettingElementFocusHandler(y),t.add($(p,"mousedown",w=>w.stopPropagation())),t.add($(n,ne.MOUSE_ENTER,w=>o.classList.add("mouseover"))),t.add($(n,ne.MOUSE_LEAVE,w=>o.classList.remove("mouseover"))),y}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.onChange=void 0,t.checkbox.checked=e.value,e.hasPolicyValue||e.isAgentsWindowReadOnly?(t.checkbox.disable(),t.descriptionElement.classList.add("disabled")):(t.checkbox.enable(),t.descriptionElement.classList.remove("disabled"),t.elementDisposables.add($(t.descriptionElement,ne.MOUSE_DOWN,n=>{let r=n.target instanceof Element?n.target:null;(!r||!r.closest("a"))&&(t.checkbox.checked=!t.checkbox.checked,t.onChange(t.checkbox.checked)),Kt.stop(n)}))),t.checkbox.setTitle(e.setting.key),t.onChange=o}},ORi=class extends tu{constructor(){super(...arguments);this.templateId=qSo;this._onDidDismissExtensionSetting=this._register(new T);this.onDidDismissExtensionSetting=this._onDidDismissExtensionSetting.event}renderTemplate(e){let t=super.renderCommonTemplate(null,e,"extension-toggle"),o=new Pi(t.containerElement,{title:!1,...Ro});o.element.classList.add("setting-item-extension-toggle-button"),o.label=d(14390,null);let n=new Pi(t.containerElement,{title:!1,secondary:!0,...Ro});n.element.classList.add("setting-item-extension-dismiss-button"),n.label=d(14379,null);let r={...t,actionButton:o,dismissButton:n};return this.addSettingElementFocusHandler(r),r}renderElement(e,t,o){super.renderSettingElement(e,t,o)}renderValue(e,t,o){t.elementDisposables.clear();let n=e.setting.displayExtensionId;t.elementDisposables.add(t.actionButton.onDidClick(async()=>{this._telemetryService.publicLog2("ManageExtensionClick",{extensionId:n}),this._commandService.executeCommand("extension.open",n)})),t.elementDisposables.add(t.dismissButton.onDidClick(async()=>{this._telemetryService.publicLog2("DismissExtensionClick",{extensionId:n}),this._onDidDismissExtensionSetting.fire(n)}))}},gNe=class extends k{constructor(e,t,o,n){super();this._instantiationService=e;this._contextMenuService=t;this._contextViewService=o;this._userDataSyncEnablementService=n;this._onDidChangeSetting=this._register(new T);this.settingActions=[new it("settings.resetSetting",d(14385,null),void 0,void 0,async u=>{u instanceof NC&&(u.isUntrusted||this._onDidChangeSetting.fire({key:u.setting.key,value:void 0,type:u.setting.type,manualReset:!0,scope:u.setting.scope}))}),new oi,this._instantiationService.createInstance(Tie),this._instantiationService.createInstance(_ie),this._instantiationService.createInstance(Die)];let r=(u,p)=>this.getActionsForSetting(u,p),s=u=>[],l=this._instantiationService.createInstance(ORi,[],s),c=[this._instantiationService.createInstance(NRi,this.settingActions,r),this._instantiationService.createInstance(ARi,this.settingActions,r),this._instantiationService.createInstance(ERi,this.settingActions,r),this._instantiationService.createInstance(pKt,this.settingActions,r),this._instantiationService.createInstance(kRi,this.settingActions,r),this._instantiationService.createInstance(LRi,this.settingActions,r),this._instantiationService.createInstance(MRi,this.settingActions,r),this._instantiationService.createInstance(DRi,this.settingActions,r),this._instantiationService.createInstance(RRi,this.settingActions,r),this._instantiationService.createInstance(PRi,this.settingActions,r),this._instantiationService.createInstance(TRi,this.settingActions,r),this._instantiationService.createInstance(_Ri,this.settingActions,r),l];this.onDidClickOverrideElement=U.any(...c.map(u=>u.onDidClickOverrideElement)),this.onDidChangeSetting=U.any(...c.map(u=>u.onDidChangeSetting),this._onDidChangeSetting.event),this.onDidDismissExtensionSetting=l.onDidDismissExtensionSetting,this.onDidOpenSettings=U.any(...c.map(u=>u.onDidOpenSettings)),this.onDidClickSettingLink=U.any(...c.map(u=>u.onDidClickSettingLink)),this.onDidFocusSetting=U.any(...c.map(u=>u.onDidFocusSetting)),this.onDidChangeSettingHeight=U.any(...c.map(u=>u.onDidChangeSettingHeight)),this.onApplyFilter=U.any(...c.map(u=>u.onApplyFilter)),this.allRenderers=[...c,this._instantiationService.createInstance(xRi),this._instantiationService.createInstance(unt)]}getActionsForSetting(e,t){let o=[];return!(e.scope&&MC.includes(e.scope))&&t===3&&o.push(this._instantiationService.createInstance(Lie,e)),this._userDataSyncEnablementService.isEnabled()&&!e.disallowSyncIgnore&&o.push(this._instantiationService.createInstance(Rie,e)),o.length&&o.splice(0,0,new oi),o}cancelSuggesters(){this._contextViewService.hideContextView()}showContextMenu(e,t){let o=t.querySelector(".monaco-toolbar");o&&this._contextMenuService.showContextMenu({getActions:()=>this.settingActions,getAnchor:()=>o,getActionsContext:()=>e})}getSettingDOMElementForDOMElement(e){let t=rf(e,tu.CONTENTS_CLASS);return t||null}getDOMElementsForSettingKey(e,t){return e.querySelectorAll(`[${tu.SETTING_KEY_ATTR}="${t}"]`)}getKeyForDOMElementInSetting(e){let t=this.getSettingDOMElementForDOMElement(e);return t&&t.getAttribute(tu.SETTING_KEY_ATTR)}getIdForDOMElementInSetting(e){let t=this.getSettingDOMElementForDOMElement(e);return t&&t.getAttribute(tu.SETTING_ID_ATTR)}dispose(){super.dispose(),this.settingActions.forEach(e=>{Sd(e)&&e.dispose()}),this.allRenderers.forEach(e=>{Sd(e)&&e.dispose()})}};gNe=I([m(0,F),m(1,Xe),m(2,qn),m(3,Yl)],gNe);function fKt(a,i,e){if(a.setting.validator){let t=a.setting.validator(i.inputBox.value);if(t){i.containerElement.classList.add("invalid-input"),i.validationErrorMessageElement.innerText=t;let o=d(14392,null);return i.inputBox.inputElement.parentElement.setAttribute("aria-label",[o,t].join(" ")),e||Er(o+" "+t),!0}else i.inputBox.inputElement.parentElement.removeAttribute("aria-label")}return i.containerElement.classList.remove("invalid-input"),!1}function vKt(a,i,e,t){if(i.containerElement.classList.add("invalid-input"),a.setting.validator){let o=a.setting.validator(e);if(o&&o!==""){i.containerElement.classList.add("invalid-input"),i.validationErrorMessageElement.innerText=o;let n=d(14392,null);return i.containerElement.setAttribute("aria-label",[a.setting.key,n,o].join(" ")),t||Er(n+" "+o),!0}else i.containerElement.setAttribute("aria-label",a.setting.key),i.containerElement.classList.remove("invalid-input")}return!1}function $So(a){for(let i=0;i<a.childNodes.length;i++){let e=a.childNodes.item(i);(e.tagName&&e.tagName.toLowerCase())==="img"?e.remove():$So(e)}}function BRi(a,i=!0){return a.replace(/`#([^#\s`]+)#`|'#([^#\s']+)#'/g,(e,t,o)=>{let n=t??o,r=IQ(n),s=`${r.category}: ${r.label}`;return i?`[${s}](#${n} "${n}")`:`"${s}"`})}function xSo(a){return a&&a.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Fge=class{constructor(i,e,t){this.viewState=i;this.isFilteringGroups=e;this.environmentService=t}filter(i,e){if(this.viewState.categoryFilter&&i instanceof NC&&!this.settingContainedInGroup(i.setting,this.viewState.categoryFilter))return!1;if(i instanceof NC&&this.viewState.settingsTarget!==3){let t=!!this.environmentService.remoteAuthority;if(!i.matchesScope(this.viewState.settingsTarget,t))return!1}return i instanceof Lv?this.isFilteringGroups&&this.viewState.categoryFilter?this.groupIsRelatedToCategory(i,this.viewState.categoryFilter)?2:!1:typeof i.count=="number"?i.count>0:2:!(i instanceof hNe&&(this.viewState.tagFilters?.size||this.viewState.categoryFilter))}settingContainedInGroup(i,e){return e.children.some(t=>t instanceof Lv?this.settingContainedInGroup(i,t):t instanceof NC?t.setting.key===i.key:!1)}groupIsRelatedToCategory(i,e){if(i.id===e.id)return!0;let t=i.parent;for(;t;){if(t.id===e.id)return!0;t=t.parent}let o=e.parent;for(;o;){if(o.id===i.id)return!0;o=o.parent}return!1}};Fge=I([m(2,Mt)],Fge);var FRi=class extends LK{getTemplateId(i){if(i instanceof Lv)return GSo;if(i instanceof NC)return i.valueType==="extension-toggle"?qSo:i.isConfigured&&h_i(i.value,i.setting.type)?uKt:i.valueType==="boolean"?FSo:i.valueType==="integer"||i.valueType==="number"||i.valueType==="nullable-integer"||i.valueType==="nullable-number"?NSo:i.valueType==="multiline-string"?ASo:i.valueType==="string"?PSo:i.valueType==="enum"?OSo:i.valueType==="array"?WSo:i.valueType==="exclude"?VSo:i.valueType==="include"?BSo:i.valueType==="object"?HSo:i.valueType==="boolean-object"?USo:i.valueType==="complex-object"?zSo:(i.valueType==="language-tag",uKt);if(i instanceof hNe)return KSo;throw new Error("unknown element type: "+i)}hasDynamicHeight(i){return!(i instanceof Lv)}estimateHeight(i){return i instanceof Lv?42:i instanceof NC&&i.valueType==="boolean"?78:104}},WRi=class extends n2{isCollapsible(i){return!1}setCollapsed(i,e,t){return!1}},VRi=class{constructor(i,e,t){this.configurationService=i;this.languageService=e;this.userDataProfilesService=t}getAriaLabel(i){if(i instanceof NC){let e=[];if(e.push(`${i.displayCategory} ${i.displayLabel}.`),i.isConfigured){let n=d(14388,null);e.push(n)}let t=SSo(i,this.configurationService,this.userDataProfilesService,this.languageService);t.length&&e.push(`${t}.`);let o=ma({value:BRi(i.description,!1)});return o.length&&e.push(o),e.join(" ")}else return i instanceof Lv?i.label:i.id}getWidgetAriaLabel(){return d(14386,null)}},fNe=class extends hf{constructor(i,e,t,o,n,r,s,l,c){super("SettingsTree",i,new FRi,t,{horizontalScrolling:!1,supportDynamicHeights:!0,scrollToActiveElement:!0,identityProvider:{getId(u){return u.id}},accessibilityProvider:new VRi(r,l,c),styleController:u=>new wde(Pr(i),u),filter:s.createInstance(Fge,e,!0),smoothScrolling:r.getValue("workbench.list.smoothScrolling"),multipleSelectionSupport:!1,findWidgetEnabled:!1,renderIndentGuides:"none",transformOptimization:!1},s,o,n,r),this.getHTMLElement().classList.add("settings-editor-tree"),this.style(WS({listBackground:Bo,listActiveSelectionBackground:Bo,listActiveSelectionForeground:xo,listFocusAndSelectionBackground:Bo,listFocusAndSelectionForeground:xo,listFocusBackground:Bo,listFocusForeground:xo,listHoverForeground:xo,listHoverBackground:Bo,listHoverOutline:Bo,listFocusOutline:Bo,listInactiveSelectionBackground:Bo,listInactiveSelectionForeground:xo,listInactiveFocusBackground:Bo,listInactiveFocusOutline:Bo,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0})),this.disposables.add(r.onDidChangeConfiguration(u=>{u.affectsConfiguration("workbench.list.smoothScrolling")&&this.updateOptions({smoothScrolling:r.getValue("workbench.list.smoothScrolling")})}))}createModel(i,e){return new WRi(i,e)}};fNe=I([m(3,X),m(4,Co),m(5,Yg),m(6,F),m(7,Rt),m(8,hn)],fNe);var Tie=class extends it{constructor(e){super(Tie.ID,Tie.LABEL);this.clipboardService=e}static{this.ID="settings.copySettingId"}static{this.LABEL=d(14378,null)}async run(e){return e&&await this.clipboardService.writeText(e.setting.key),Promise.resolve(void 0)}};Tie=I([m(0,Bi)],Tie);var _ie=class extends it{constructor(e){super(_ie.ID,_ie.LABEL);this.clipboardService=e}static{this.ID="settings.copySettingAsJSON"}static{this.LABEL=d(14376,null)}async run(e){if(e){let t=`"${e.setting.key}": ${JSON.stringify(e.value,void 0,"  ")}`;await this.clipboardService.writeText(t)}return Promise.resolve(void 0)}};_ie=I([m(0,Bi)],_ie);var Die=class extends it{constructor(e,t){super(Die.ID,Die.LABEL);this.clipboardService=e;this.productService=t}static{this.ID="settings.copySettingAsURL"}static{this.LABEL=d(14377,null)}async run(e){if(e){let t=e.setting.key,o=this.productService.urlProtocol,n=A.from({scheme:o,authority:KRe,path:`/${t}`},!0);await this.clipboardService.writeText(n.toString())}return Promise.resolve(void 0)}};Die=I([m(0,Bi),m(1,Ze)],Die);var Rie=class extends it{constructor(e,t){super(Rie.ID,Rie.LABEL);this.setting=e;this.configService=t;this._register(U.filter(t.onDidChangeConfiguration,o=>o.affectsConfiguration("settingsSync.ignoredSettings"))(()=>this.update())),this.update()}static{this.ID="settings.stopSyncingSetting"}static{this.LABEL=d(14391,null)}async update(){let e=v1t(eie(),this.configService);this.checked=!e.includes(this.setting.key)}async run(){let e=[...this.configService.getValue("settingsSync.ignoredSettings")];e=e.filter(r=>r!==this.setting.key&&r!==`-${this.setting.key}`);let o=eie().includes(this.setting.key),n=!this.checked;return n&&o&&e.push(`-${this.setting.key}`),!n&&!o&&e.push(this.setting.key),this.configService.updateValue("settingsSync.ignoredSettings",e.length?e:void 0,2),Promise.resolve(void 0)}};Rie=I([m(1,B)],Rie);var Lie=class extends it{constructor(e,t){super(Lie.ID,Lie.LABEL);this.setting=e;this.configService=t;this._register(U.filter(t.onDidChangeConfiguration,o=>o.affectsConfiguration(gw))(()=>this.update())),this.update()}static{this.ID="settings.applyToAllProfiles"}static{this.LABEL=d(14375,null)}update(){let e=this.configService.getValue(gw);this.checked=e.includes(this.setting.key)}async run(){let e=this.configService.getValue(gw)??[];this.checked?e.splice(e.indexOf(this.setting.key),1):e.push(this.setting.key);let t=jo(e);this.checked?(await this.configService.updateValue(this.setting.key,this.configService.inspect(this.setting.key).application?.value,3),await this.configService.updateValue(gw,t.length?t:void 0,3)):(await this.configService.updateValue(gw,t.length?t:void 0,3),await this.configService.updateValue(this.setting.key,this.configService.inspect(this.setting.key).userLocal?.value,3))}};Lie=I([m(1,Yg)],Lie);var jSo=_,vNe=class{constructor(i,e){this._viewState=i;this.environmentService=e;this._currentSearchModel=null}get settingsTreeRoot(){return this._settingsTreeRoot}set settingsTreeRoot(i){this._settingsTreeRoot=i,this.update()}get currentSearchModel(){return this._currentSearchModel}set currentSearchModel(i){this._currentSearchModel=i,this.update()}get children(){return this._settingsTreeRoot.children}update(){this._settingsTreeRoot&&this.updateGroupCount(this._settingsTreeRoot)}updateGroupCount(i){i.children.forEach(t=>{t instanceof Lv&&this.updateGroupCount(t)});let e=i.children.filter(t=>t instanceof Lv).reduce((t,o)=>t+o.count,0);i.count=e+this.getGroupCount(i)}getGroupCount(i){return i.children.filter(e=>{if(!(e instanceof NC)||this._currentSearchModel&&!this._currentSearchModel.root.containsSetting(e.setting.key))return!1;let t=!!this.environmentService.remoteAuthority;return e.matchesScope(this._viewState.settingsTarget,t)&&e.matchesAllTags(this._viewState.tagFilters)&&e.matchesAnyFeature(this._viewState.featureFilters)&&e.matchesAnyExtension(this._viewState.extensionFilters)&&e.matchesAnyId(this._viewState.idFilters)}).length}};vNe=I([m(1,Mt)],vNe);var QSo="settings.toc.entry",HRi=class{constructor(i){this._hoverService=i;this.templateId=QSo}renderTemplate(i){return{labelElement:D(i,jSo(".settings-toc-entry")),countElement:D(i,jSo(".settings-toc-count")),elementDisposables:new O}}renderElement(i,e,t){t.elementDisposables.clear();let o=i.element,n=o.count,r=o.label;t.labelElement.textContent=r,t.elementDisposables.add(this._hoverService.setupDelayedHover(t.labelElement,{content:r})),n?t.countElement.textContent=` (${n})`:t.countElement.textContent=""}disposeTemplate(i){i.elementDisposables.dispose()}},URi=class{getTemplateId(i){return QSo}getHeight(i){return 22}};function KRi(a,i){let e=a.children.filter(t=>t instanceof Lv);return yt.map(e,t=>{let o=t.children.some(n=>n instanceof Lv);return{element:t,collapsed:void 0,collapsible:o,children:t instanceof Lv?KRi(t,i):void 0}})}var zRi=class{getWidgetAriaLabel(){return d(14424,null)}getAriaLabel(i){return i&&i instanceof Lv?d(14423,null,i.label):""}getAriaLevel(i){let e=1;for(;i instanceof Lv&&i.parent;)e++,i=i.parent;return e}},bNe=class extends hf{constructor(i,e,t,o,n,r,s){let c={filter:s.createInstance(Fge,e,!1),multipleSelectionSupport:!1,identityProvider:{getId(u){return u.id}},styleController:u=>new wde(Pr(i),u),accessibilityProvider:s.createInstance(zRi),collapseByDefault:!0,horizontalScrolling:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:"none"};super("SettingsTOC",i,new URi,[new HRi(r)],c,s,t,o,n),this.style(WS({listBackground:Bo,listFocusOutline:Kc,listActiveSelectionBackground:Bo,listActiveSelectionForeground:Jot,listFocusAndSelectionBackground:Bo,listFocusAndSelectionForeground:Jot,listFocusBackground:Bo,listFocusForeground:pRi,listHoverForeground:pRi,listHoverBackground:Bo,listInactiveSelectionBackground:Bo,listInactiveSelectionForeground:Jot,listInactiveFocusBackground:Bo,listInactiveFocusOutline:Bo,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0}))}};bNe=I([m(2,X),m(3,Co),m(4,B),m(5,ot),m(6,F)],bNe);function JSo(a){return yt.map(a.children,i=>({element:i,children:i instanceof Lv?JSo(i):void 0}))}var VR=_,GRi=d(14247,null),YSo="workbench.settings.settingsSearchTocBehavior",ksn=d(14251,null),XSo=d(14250,null),Esn="settingsEditorState",fd=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K){super(fd.ID,e,t,r,h);this.configurationService=o;this.preferencesService=s;this.instantiationService=l;this.preferencesSearchService=c;this.logService=u;this.storageService=h;this.editorGroupService=g;this.userDataSyncWorkbenchService=f;this.userDataSyncEnablementService=v;this.workspaceTrustManagementService=b;this.extensionService=S;this.languageService=y;this.extensionManagementService=w;this.productService=x;this.extensionGalleryService=E;this.editorProgressService=M;this.keybindingService=V;this.chatEntitlementService=H;this.environmentService=K;this.searchContainer=null;this.settingsTreeModel=this._register(new ue);this.searchInProgress=null;this.aiSearchPromise=null;this.showAiResultsAction=null;this.pendingSettingUpdate=null;this._searchResultModel=this._register(new ue);this.searchResultLabel=null;this.lastSyncedLabel=null;this.settingsOrderByTocIndex=null;this._currentFocusContext=0;this.hasWarnedMissingSettings=!1;this.tocTreeDisposed=!1;this.tocFocusedElement=null;this.treeFocusedElement=null;this.settingsTreeScrollTop=0;this.installedExtensionIds=[];this.dismissedExtensionSettings=[];this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY="settingsEditor2.dismissedExtensionSettings";this.DISMISSED_EXTENSION_SETTINGS_DELIMITER="	";this.searchInputActionBar=null;this.searchDelayer=this._register(new rn(200)),this.viewState={settingsTarget:3},this.settingFastUpdateDelayer=this._register(new rn(fd.SETTING_UPDATE_FAST_DEBOUNCE)),this.settingSlowUpdateDelayer=this._register(new rn(fd.SETTING_UPDATE_SLOW_DEBOUNCE)),this.searchInputDelayer=this._register(new rn(fd.SEARCH_DEBOUNCE)),this.updatedConfigSchemaDelayer=this._register(new rn(fd.CONFIG_SCHEMA_UPDATE_DELAYER)),this.inSettingsEditorContextKey=WR.bindTo(p),this.searchFocusContextKey=yge.bindTo(p),this.tocRowFocused=Rzt.bindTo(p),this.settingRowFocused=$ot.bindTo(p),this.aiResultsAvailable=Mzt.bindTo(p),this.scheduledRefreshes=new Map,this.editorMemento=this.getEditorMemento(g,n,Esn),this.dismissedExtensionSettings=this.storageService.get(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,0,"").split(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),this._register(o.onDidChangeConfiguration(j=>{(j.affectedKeys.has("workbench.settings.showAISearchToggle")||j.affectedKeys.has("workbench.settings.enableNaturalLanguageSearch"))&&this.updateAiSearchToggleVisibility(),j.affectsConfiguration(Gwi)&&this.onConfigUpdate(void 0,!0,!0),j.source!==7&&this.onConfigUpdate(j.affectedKeys)})),this._register(H.onDidChangeSentiment(()=>{this.updateAiSearchToggleVisibility()})),this._register(N.onDidChangeCurrentProfile(j=>{j.join(this.whenCurrentProfileChanged())})),this._register(b.onDidChangeTrust(()=>{this.searchResultModel?.updateWorkspaceTrust(b.isWorkspaceTrusted()),this.settingsTreeModel.value&&(this.settingsTreeModel.value.updateWorkspaceTrust(b.isWorkspaceTrusted()),this.renderTree())})),this._register(o.onDidChangeRestrictedSettings(j=>{j.default.length&&this.currentSettingsModel&&this.updateElementsByKey(new Set(j.default))})),this._register(w.onDidInstallExtensions(()=>{this.refreshInstalledExtensionsList()})),this._register(w.onDidUninstallExtension(()=>{this.refreshInstalledExtensionsList()})),this.modelDisposables=this._register(new O),Kzt&&!fd.SUGGESTIONS.includes(`@${KW}`)&&fd.SUGGESTIONS.push(`@${KW}`),this.environmentService.isSessionsWindow&&!fd.SUGGESTIONS.includes(`@${Cge}`)&&fd.SUGGESTIONS.push(`@${Cge}`),this.inputChangeListener=this._register(new ue)}static{this.ID="workbench.editor.settings2"}static{this.NUM_INSTANCES=0}static{this.SEARCH_DEBOUNCE=200}static{this.SETTING_UPDATE_FAST_DEBOUNCE=200}static{this.SETTING_UPDATE_SLOW_DEBOUNCE=1e3}static{this.CONFIG_SCHEMA_UPDATE_DELAYER=500}static{this.TOC_MIN_WIDTH=100}static{this.TOC_RESET_WIDTH=200}static{this.EDITOR_MIN_WIDTH=500}static{this.NARROW_TOTAL_WIDTH=this.TOC_RESET_WIDTH+this.EDITOR_MIN_WIDTH}static{this.SUGGESTIONS=[`@${hq}`,"@tag:notebookLayout","@tag:notebookOutputLayout",`@tag:${eNe}`,`@tag:${fQ}`,"@tag:sync","@tag:usesOnlineServices","@tag:telemetry","@tag:accessibility","@tag:preview","@tag:experimental",`@tag:${vQ}`,`@${jot}`,`@${ZAe}`,`@${ME}scm`,`@${ME}explorer`,`@${ME}search`,`@${ME}debug`,`@${ME}extensions`,`@${ME}terminal`,`@${ME}task`,`@${ME}problems`,`@${ME}output`,`@${ME}comments`,`@${ME}remote`,`@${ME}timeline`,`@${ME}notebook`,`@${ME}chat`,`@${UU}`]}static shouldSettingUpdateFast(e){return Array.isArray(e)?!1:e==="enum"||e==="array"||e==="boolean-object"||e==="object"||e==="complex"||e==="boolean"||e==="exclude"||e==="include"}async whenCurrentProfileChanged(){this.updatedConfigSchemaDelayer.trigger(()=>{this.dismissedExtensionSettings=this.storageService.get(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,0,"").split(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),this.onConfigUpdate(void 0,!0)})}canShowAdvancedSettings(){return this.configurationService.getValue(Gwi)??!1?!0:this.viewState.tagFilters?.has(vQ)??!1}shouldShowSetting(e){return!!(!e.tags?.includes(vQ)||this.viewState.idFilters?.has(e.key)||this.viewState.query?.toLowerCase().includes(e.key.toLowerCase())||this.viewState.tagFilters?.has(UU))}disableAiSearchToggle(){this.showAiResultsAction&&(this.showAiResultsAction.checked=!1,this.showAiResultsAction.enabled=!1,this.aiResultsAvailable.set(!1),this.showAiResultsAction.label=XSo)}updateAiSearchToggleVisibility(){if(!this.searchContainer||!this.showAiResultsAction||!this.searchInputActionBar)return;let e=this.configurationService.getValue("workbench.settings.showAISearchToggle"),t=this.configurationService.getValue("workbench.settings.enableNaturalLanguageSearch"),o=this.chatEntitlementService.sentiment.hidden||this.chatEntitlementService.sentiment.disabled,n=e&&t&&!o,r=this.searchInputActionBar.hasAction(this.showAiResultsAction);!r&&n?(this.searchInputActionBar.push(this.showAiResultsAction,{index:0,label:!1,icon:!0}),this.searchContainer.classList.add("with-ai-toggle")):r&&(this.searchInputActionBar.pull(0),this.searchContainer.classList.remove("with-ai-toggle"),this.showAiResultsAction.checked=!1)}get minimumWidth(){return fd.EDITOR_MIN_WIDTH}get maximumWidth(){return Number.POSITIVE_INFINITY}get minimumHeight(){return 180}set minimumWidth(e){}set maximumWidth(e){}get currentSettingsModel(){return this.searchResultModel||this.settingsTreeModel.value}get searchResultModel(){return this._searchResultModel.value??null}set searchResultModel(e){this._searchResultModel.value=e??void 0,this.rootElement.classList.toggle("search-mode",!!this._searchResultModel.value)}get focusedSettingDOMElement(){let e=this.settingsTree.getFocus()[0];if(e instanceof NC)return this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e.setting.key)[0]}get currentFocusContext(){return this._currentFocusContext}createEditor(e){e.setAttribute("tabindex","-1"),this.rootElement=D(e,VR(".settings-editor",{tabindex:"-1"})),this.createHeader(this.rootElement),this.createBody(this.rootElement),this.addCtrlAInterceptor(this.rootElement),this.updateStyles(),this._register(p_({name:"settingsEditor2",focusNotifiers:[this],focusNextWidget:()=>{this.searchWidget.inputWidget.hasWidgetFocus()&&this.focusTOC()},focusPreviousWidget:()=>{this.searchWidget.inputWidget.hasWidgetFocus()||this.focusSearch()}}))}async setInput(e,t,o,n){if(this.inSettingsEditorContextKey.set(!0),await super.setInput(e,t,o,n),!this.input)return;let r=await this.input.resolve();if(!(n.isCancellationRequested||!(r instanceof Yte))){if(this.modelDisposables.clear(),this.modelDisposables.add(r.onDidChangeGroups(()=>{this.updatedConfigSchemaDelayer.trigger(()=>{this.onConfigUpdate(void 0,!1,!0)})})),this.defaultSettingsEditorModel=r,t=t||URe({}),!this.viewState.settingsTarget||!this.settingsTargetsWidget.settingsTarget){let s=t.viewState&&t.viewState.settingsTarget;!t.target&&!s&&(t.target=3)}this._setOptions(t),this.onConfigUpdate(void 0,!0).then(()=>{this.inputChangeListener.value=e.onWillDispose(()=>{this.searchWidget.setValue("")}),this.updateTreeScrollSync()}),await this.refreshInstalledExtensionsList()}}async refreshInstalledExtensionsList(){let e=await this.extensionManagementService.getInstalled();this.installedExtensionIds=e.filter(t=>t.manifest.contributes?.configuration).map(t=>t.identifier.id)}restoreCachedState(){let e=this.input&&this.editorMemento.loadEditorState(this.group,this.input);if(e&&typeof e.target=="object"&&(e.target=A.revive(e.target)),e){let t=e.target;this.settingsTargetsWidget.settingsTarget=t,this.viewState.settingsTarget=t,this.searchWidget.getValue()||this.searchWidget.setValue(e.searchQuery)}return this.input&&this.editorMemento.clearEditorState(this.input,this.group),e??null}getViewState(){return this.viewState}setOptions(e){super.setOptions(e),e&&this._setOptions(e)}_setOptions(e){e.focusSearch&&!Tc&&this.focusSearch();let t=e.viewState?e.viewState:void 0,o=t?.query??e.query;o!==void 0&&(this.searchWidget.setValue(o),this.viewState.query=o);let n=e.folderUri??t?.settingsTarget??e.target;n&&this.settingsTargetsWidget.updateTarget(n)}clearInput(){this.inSettingsEditorContextKey.set(!1),super.clearInput()}layout(e){if(this.dimension=e,!this.isVisible())return;this.layoutSplitView(e);let o=Math.min(this.headerContainer.clientWidth,e.width)-48-10-this.controlsElement.clientWidth-12;this.searchWidget.layout(new di(o,20)),this.rootElement.classList.toggle("narrow-width",e.width<fd.NARROW_TOTAL_WIDTH)}focus(){if(super.focus(),this._currentFocusContext===0)Tc||this.focusSearch();else if(this._currentFocusContext===3){let e=this.focusedSettingDOMElement;if(e){let t=e.querySelector(tu.CONTROL_SELECTOR);if(t){t.focus();return}}}else this._currentFocusContext===2?this.settingsTree.domFocus():this._currentFocusContext===1&&this.tocTree.domFocus()}setEditorVisible(e){super.setEditorVisible(e),e||setTimeout(()=>{this.searchWidget.onHide(),this.settingRenderers.cancelSuggesters()},0)}focusSettings(e=!1){if(this.settingsTree.getFocus().length||this.settingsTree.focusFirst(),this.settingsTree.domFocus(),e){let o=this.settingsTree.getHTMLElement().querySelector(`.focused ${tu.CONTROL_SELECTOR}`);o&&o.focus()}}focusTOC(){this.tocTree.domFocus()}showContextMenu(){let e=this.settingsTree.getFocus()[0],t=this.focusedSettingDOMElement;t&&e instanceof NC&&this.settingRenderers.showContextMenu(e,t)}focusSearch(e,t=!0){e&&this.searchWidget&&this.searchWidget.setValue(e),this.searchWidget.focus(t&&!this.searchInputDelayer.isTriggered)}clearSearchResults(){this.disableAiSearchToggle(),this.searchWidget.setValue(""),this.focusSearch()}clearSearchFilters(){let t=this.searchWidget.getValue().split(" ").filter(o=>o.length&&!fd.SUGGESTIONS.some(n=>o.startsWith(n)));this.searchWidget.setValue(t.join(" "))}updateInputAriaLabel(){let e=GRi;this.searchResultLabel&&(e+=`. ${this.searchResultLabel}`),this.lastSyncedLabel&&(e+=`. ${this.lastSyncedLabel}`),this.searchWidget.updateAriaLabel(e)}createHeader(e){this.headerContainer=D(e,VR(".settings-header")),this.searchContainer=D(this.headerContainer,VR(".search-container"));let t=this._register(new it(Tzt,d(14236,null),q.asClassName(iNe),!1,async()=>this.clearSearchResults())),o=["action-label",q.asClassName(tSo)];this.showAiResultsAction=this._register(new it(Pbo,XSo,o.join(" "),!0)),this._register(this.showAiResultsAction.onDidChange(async()=>{await this.onDidToggleAiSearch()}));let n=this._register(new it(Abo,d(14238,null),q.asClassName(iSo)));this.searchWidget=this._register(this.instantiationService.createInstance(YN,`${fd.ID}.searchbox`,this.searchContainer,{triggerCharacters:["@",":"],provideResults:c=>{let u=c.split(/\s/g);return u[u.length-1].startsWith(`@${KW}`)?this.languageService.getRegisteredLanguageIds().map(h=>`@${KW}${h} `).sort().filter(h=>!c.includes(h)):u[u.length-1].startsWith(`@${ZAe}`)?this.installedExtensionIds.map(h=>`@${ZAe}${h} `).sort().filter(h=>!c.includes(h)):c===""||u[u.length-1].startsWith("@")?fd.SUGGESTIONS.filter(p=>!c.includes(p)).map(p=>p.endsWith(":")?p:p+" "):[]}},GRi,"settingseditor:searchinput"+fd.NUM_INSTANCES++,{placeholderText:GRi,focusContextKey:this.searchFocusContextKey,styleOverrides:{inputBorder:__}})),this._register(this.searchWidget.onDidFocus(()=>{this._currentFocusContext=0})),this._register(this.searchWidget.onInputDidChange(()=>{let c=this.searchWidget.getValue();t.enabled=!!c,this.searchInputDelayer.trigger(()=>this.onSearchInputChanged(!0))}));let r=D(this.headerContainer,VR(".settings-header-controls"));r.style.borderColor=Tt(oSo);let s=D(r,VR(".settings-target-container"));if(this.settingsTargetsWidget=this._register(this.instantiationService.createInstance(oNe,s,{enableRemoteSettings:!0})),this.settingsTargetsWidget.settingsTarget=3,this._register(this.settingsTargetsWidget.onDidTargetChange(c=>this.onDidSettingsTargetChange(c))),this._register($(s,ne.KEY_DOWN,c=>{new mi(c).keyCode===18&&this.focusSettings()})),this.userDataSyncWorkbenchService.enabled&&this.userDataSyncEnablementService.canToggleEnablement()){let c=this._register(this.instantiationService.createInstance(hnt,this.window,r));this._register(c.onDidChangeLastSyncedLabel(u=>{this.lastSyncedLabel=u,this.updateInputAriaLabel()}))}this.controlsElement=D(this.searchContainer,_(".search-container-widgets")),this.countElement=D(this.controlsElement,_(".settings-count-widget.monaco-count-badge.long")),this.searchInputActionBar=this._register(new oo(this.controlsElement,{actionViewItemProvider:(c,u)=>{if(c.id===n.id)return this.instantiationService.createInstance(mNe,c,u,this.actionRunner,this.searchWidget);if(this.showAiResultsAction&&c.id===this.showAiResultsAction.id){let p=this.keybindingService.lookupKeybinding(_zt)?.getLabel();return new eue(null,c,{...u,keybinding:p,toggleStyles:zh})}}}));let l=[t,n];this.searchInputActionBar.push(l,{label:!1,icon:!0}),this.disableAiSearchToggle(),this.updateAiSearchToggleVisibility()}toggleAiSearch(){this.searchInputActionBar&&this.showAiResultsAction&&this.searchInputActionBar.hasAction(this.showAiResultsAction)&&(this.showAiResultsAction.enabled||Er(d(14242,null)),this.showAiResultsAction.checked=!this.showAiResultsAction.checked)}async onDidToggleAiSearch(){this.searchResultModel&&this.showAiResultsAction&&(this.searchResultModel.showAiResults=this.showAiResultsAction.checked??!1,this.renderResultCountMessages(!1),this.onDidFinishSearch(!0,void 0))}onDidSettingsTargetChange(e){this.viewState.settingsTarget=e,this.onConfigUpdate(void 0,!0)}onDidDismissExtensionSetting(e){this.dismissedExtensionSettings.includes(e)||this.dismissedExtensionSettings.push(e),this.storageService.store(this.DISMISSED_EXTENSION_SETTINGS_STORAGE_KEY,this.dismissedExtensionSettings.join(this.DISMISSED_EXTENSION_SETTINGS_DELIMITER),0,0),this.onConfigUpdate(void 0,!0)}onDidClickSetting(e,t){let o=this.currentSettingsModel?.getElementsByName(e.targetKey)?.[0],n=!1;if(o){let r=.5;try{let s=this.settingsTree.getRelativeTop(e.source);s!==null&&(r=s)}catch{}this.viewState.categoryFilter&&e.source.displayCategory!==o.displayCategory&&this.tocTree.setFocus([]);try{this.settingsTree.reveal(o,r)}catch{n=!0}if(!n){setTimeout(()=>{this.settingsTree.setFocus([o])},50);let s=this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e.targetKey);if(s&&s[0]){let l=s[0].querySelector(tu.CONTROL_SELECTOR);l&&l.focus()}}}if(!t&&(!o||n)){let r=`@id:${e.targetKey}`;this.searchWidget.setValue(r),this.searchInputDelayer.cancel(),this.triggerSearch(r,!0).then(()=>{this.onDidClickSetting(e,!0)})}}switchToSettingsFile(){let e=aKt(this.searchWidget.getValue()).query;return this.openSettingsFile({query:e})}async openSettingsFile(e){let t=this.settingsTargetsWidget.settingsTarget,o={jsonEditor:!0,groupId:this.group.id,...e};if(t===3){if(e?.revealSetting){let r=oe.as($t.Configuration).getConfigurationProperties()[e?.revealSetting.key]?.scope;if(r&&MC.includes(r))return this.preferencesService.openApplicationSettings(o)}return this.preferencesService.openUserSettings(o)}else{if(t===4)return this.preferencesService.openRemoteSettings(o);if(t===5)return this.preferencesService.openWorkspaceSettings(o);if(A.isUri(t))return this.preferencesService.openFolderSettings({folderUri:t,...o})}}createBody(e){this.bodyContainer=D(e,VR(".settings-body")),this.noResultsMessage=D(this.bodyContainer,VR(".no-results-message")),this.noResultsMessage.innerText=d(14243,null),this.clearFilterLinkContainer=VR("span.clear-search-filters"),this.clearFilterLinkContainer.textContent=" - ";let t=D(this.clearFilterLinkContainer,VR("a.pointer.prominent",{tabindex:0},d(14237,null)));this._register($(t,ne.CLICK,r=>{Kt.stop(r,!1),this.clearSearchFilters()})),D(this.noResultsMessage,this.clearFilterLinkContainer),this.noResultsMessage.style.color=Tt(Vd),this.tocTreeContainer=VR(".settings-toc-container"),this.settingsTreeContainer=VR(".settings-tree-container"),this.createTOC(this.tocTreeContainer),this.createSettingsTree(this.settingsTreeContainer),this.splitView=this._register(new Gp(this.bodyContainer,{orientation:1,proportionalLayout:!0}));let o=this.storageService.getNumber("settingsEditor2.splitViewWidth",0,fd.TOC_RESET_WIDTH);this.splitView.addView({onDidChange:U.None,element:this.tocTreeContainer,minimumSize:fd.TOC_MIN_WIDTH,maximumSize:Number.POSITIVE_INFINITY,layout:(r,s,l)=>{this.tocTreeContainer.style.width=`${r}px`,this.tocTree.layout(l,r)}},o,void 0,!0),this.splitView.addView({onDidChange:U.None,element:this.settingsTreeContainer,minimumSize:fd.EDITOR_MIN_WIDTH,maximumSize:Number.POSITIVE_INFINITY,layout:(r,s,l)=>{this.settingsTreeContainer.style.width=`${r}px`,this.settingsTree.layout(l,r)}},Ac.Distribute,void 0,!0),this._register(this.splitView.onDidSashReset(()=>{let r=this.splitView.getViewSize(0)+this.splitView.getViewSize(1);this.splitView.resizeView(0,fd.TOC_RESET_WIDTH),this.splitView.resizeView(1,r-fd.TOC_RESET_WIDTH)})),this._register(this.splitView.onDidSashChange(()=>{let r=this.splitView.getViewSize(0);this.storageService.store("settingsEditor2.splitViewWidth",r,0,0)}));let n=this.theme.getColor(Zot);this.splitView.style({separatorBorder:n})}addCtrlAInterceptor(e){this._register(Yo(e,ne.KEY_DOWN,t=>{t.keyCode===31&&(et?t.metaKey:t.ctrlKey)&&!Ch(t.target)&&(t.browserEvent.stopPropagation(),t.browserEvent.preventDefault())}))}createTOC(e){this.tocTreeModel=this.instantiationService.createInstance(vNe,this.viewState),this.tocTree=this._register(this.instantiationService.createInstance(bNe,D(e,VR(".settings-toc-wrapper",{role:"navigation","aria-label":d(14248,null)})),this.viewState)),this.tocTreeDisposed=!1,this._register(this.tocTree.onDidFocus(()=>{this._currentFocusContext=1})),this._register(this.tocTree.onDidChangeFocus(t=>{let o=t.elements?.[0]??null;this.tocFocusedElement!==o&&(this.tocFocusedElement=o,this.tocTree.setSelection(o?[o]:[]),this.viewState.categoryFilter!==o&&(this.viewState.categoryFilter=o??void 0,this.renderTree(void 0,!0),this.settingsTree.scrollTop=0))})),this._register(this.tocTree.onDidFocus(()=>{this.tocRowFocused.set(!0)})),this._register(this.tocTree.onDidBlur(()=>{this.tocRowFocused.set(!1)})),this._register(this.tocTree.onDidDispose(()=>{this.tocTreeDisposed=!0}))}applyFilter(e){if(this.searchWidget&&!this.searchWidget.getValue().includes(e)){let t=`${e} ${this.searchWidget.getValue().trimStart()}`;this.focusSearch(t,!1)}}removeLanguageFilters(){if(this.searchWidget&&this.searchWidget.getValue().includes(`@${KW}`)){let t=this.searchWidget.getValue().split(" ").filter(o=>!o.startsWith(`@${KW}`)).join(" ");this.focusSearch(t,!1)}}createSettingsTree(e){this.settingRenderers=this._register(this.instantiationService.createInstance(gNe)),this._register(this.settingRenderers.onDidChangeSetting(t=>this.onDidChangeSetting(t.key,t.value,t.type,t.manualReset,t.scope))),this._register(this.settingRenderers.onDidDismissExtensionSetting(t=>this.onDidDismissExtensionSetting(t))),this._register(this.settingRenderers.onDidOpenSettings(t=>{this.openSettingsFile({revealSetting:{key:t,edit:!0}})})),this._register(this.settingRenderers.onDidClickSettingLink(t=>this.onDidClickSetting(t))),this._register(this.settingRenderers.onDidFocusSetting(t=>{this.settingsTree.setFocus([t]),this._currentFocusContext=3,this.settingRowFocused.set(!1)})),this._register(this.settingRenderers.onDidChangeSettingHeight(t=>{let{element:o,height:n}=t;try{this.settingsTree.updateElementHeight(o,n)}catch{}})),this._register(this.settingRenderers.onApplyFilter(t=>this.applyFilter(t))),this._register(this.settingRenderers.onDidClickOverrideElement(t=>{this.removeLanguageFilters(),t.language&&this.applyFilter(`@${KW}${t.language}`),t.scope==="workspace"?this.settingsTargetsWidget.updateTarget(5):t.scope==="user"?this.settingsTargetsWidget.updateTarget(3):t.scope==="remote"&&this.settingsTargetsWidget.updateTarget(4),this.applyFilter(`@${jot}${t.settingKey}`)})),this.settingsTree=this._register(this.instantiationService.createInstance(fNe,e,this.viewState,this.settingRenderers.allRenderers)),this._register(this.settingsTree.onDidScroll(()=>{this.settingsTree.scrollTop!==this.settingsTreeScrollTop&&(this.settingsTreeScrollTop=this.settingsTree.scrollTop,setTimeout(()=>{this.updateTreeScrollSync()},0))})),this._register(this.settingsTree.onDidFocus(()=>{let t=e.ownerDocument.activeElement?.classList;t&&t.contains("monaco-list")&&t.contains("settings-editor-tree")&&(this._currentFocusContext=2,this.settingRowFocused.set(!0),this.treeFocusedElement??=this.settingsTree.firstVisibleElement??null,this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!0))})),this._register(this.settingsTree.onDidBlur(()=>{this.settingRowFocused.set(!1),this.treeFocusedElement=null})),this._register(this.settingsTree.onDidChangeFocus(t=>{let o=t.elements[0];this.treeFocusedElement!==o&&(this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!1),this.treeFocusedElement=o,this.treeFocusedElement&&(this.treeFocusedElement.tabbable=!0),this.settingsTree.setSelection(o?[o]:[]))}))}onDidChangeSetting(e,t,o,n,r){let l=aKt(this.searchWidget.getValue()).languageFilter;(n||this.pendingSettingUpdate&&this.pendingSettingUpdate.key!==e)&&this.updateChangedSetting(e,t,n,l,r),this.pendingSettingUpdate={key:e,value:t,languageFilter:l},fd.shouldSettingUpdateFast(o)?this.settingFastUpdateDelayer.trigger(()=>this.updateChangedSetting(e,t,n,l,r)):this.settingSlowUpdateDelayer.trigger(()=>this.updateChangedSetting(e,t,n,l,r))}updateTreeScrollSync(){this.settingRenderers.cancelSuggesters()}updateChangedSetting(e,t,o,n,r){let s=this.settingsTargetsWidget.settingsTarget,l=A.isUri(s)?s:void 0,c=(l?6:s)??3,u={resource:l,overrideIdentifiers:n?[n]:void 0},h=c===5||c===6||!!n,g=h?o:t===void 0,f=this.configurationService.inspect(e,u);return!h&&f.defaultValue===t&&(t=void 0),this.configurationService.updateValue(e,t,u,c,{handleDirtyFile:"save"}).then(()=>{let v=this.searchWidget.getValue();v.includes(`@${hq}`)&&this.refreshTOCTree(),this.renderTree(e,g),this.pendingSettingUpdate=null;let b={key:e,query:v,searchResults:this.searchResultModel?.getUniqueSearchResults()??null,rawResults:this.searchResultModel?.getRawResults()??null,showConfiguredOnly:!!this.viewState.tagFilters&&this.viewState.tagFilters.has(hq),isReset:typeof t>"u",settingsTarget:this.settingsTargetsWidget.settingsTarget};return this.reportModifiedSetting(b)})}reportModifiedSetting(e){let t,o,n,r;if(e.searchResults&&(r=e.searchResults.filterMatches.findIndex(c=>c.setting.key===e.key),this.searchResultModel)){o=e.searchResults.filterMatches.find(u=>u.setting.key===e.key)?.providerName;let c=this.searchResultModel.getRawResults();if(c[0]&&r>=0&&(t=c[0].filterMatches.some(p=>p.setting.key===e.key)?"local":"remote"),c[1]){let u=c[1].filterMatches.findIndex(p=>p.setting.key===e.key);n=u>=0?u:void 0}}let s=e.settingsTarget===3?"user":e.settingsTarget===4?"user_remote":e.settingsTarget===5?"workspace":"folder",l={key:e.key,groupId:t,providerName:o,nlpIndex:n,displayIndex:r,showConfiguredOnly:e.showConfiguredOnly,isReset:e.isReset,target:s};this.telemetryService.publicLog2("settingsEditor.settingModified",l)}scheduleRefresh(e,t=""){if(t&&this.scheduledRefreshes.has(t))return;t||(je(this.scheduledRefreshes.values()),this.scheduledRefreshes.clear());let o=new O,n=nr(e);o.add(n),o.add(n.onDidBlur(()=>{this.scheduledRefreshes.get(t)?.dispose(),this.scheduledRefreshes.delete(t),this.onConfigUpdate(new Set([t]))})),this.scheduledRefreshes.set(t,o)}createSettingsOrderByTocIndex(e){let t=new Map;function o(n,r=0){if(n.settings)for(let s of n.settings)t.has(s.key)||t.set(s.key,r++);if(n.children)for(let s of n.children)r=o(s,r);return r}return o(e),t}refreshModels(e){this.settingsTreeModel.value.update(e),this.tocTreeModel.settingsTreeRoot=this.settingsTreeModel.value.root,this.settingsOrderByTocIndex=this.createSettingsOrderByTocIndex(e)}async onConfigUpdate(e,t=!1,o=!1){if(e&&this.settingsTreeModel)return this.updateElementsByKey(e);if(!this.defaultSettingsEditorModel)return;let n=this.defaultSettingsEditorModel.settingsGroups.slice(1),r=[],s=[];for(let b of n)b.extensionInfo?s.push(b):r.push(b);let l=this.canShowAdvancedSettings()?void 0:{exclude:{tags:[vQ]}},c=ESo(cnt,r,l,this.logService),u=c.tree;if(c.leftoverSettings.size&&!this.hasWarnedMissingSettings){let b=[];c.leftoverSettings.forEach(S=>{b.push(S.key)}),this.logService.warn(`SettingsEditor2: Settings not included in settingsLayout.ts: ${b.join(", ")}`),this.hasWarnedMissingSettings=!0}let p=[],h=!1,g=await Gbo(this.chatEntitlementService,this.extensionGalleryService,this.productService);if(g&&n.filter(b=>b.extensionInfo).length&&Object.keys(g.settingsEditorRecommendedExtensions).length){await this.refreshInstalledExtensionsList();for(let b in g.settingsEditorRecommendedExtensions){let S=g.recommendedExtensionsGalleryInfo[b];if(!S)continue;let y=S.identifier.id,w=this.installedExtensionIds.includes(y),x=n.findIndex(se=>se.extensionInfo&&se.extensionInfo.id.toLowerCase()===y.toLowerCase()&&se.sections.length===1&&se.sections[0].settings.length===1&&se.sections[0].settings[0].displayExtensionId);if(w||this.dismissedExtensionSettings.includes(y)){x!==-1&&(n.splice(x,1),h=!0);continue}if(x!==-1)continue;let E=null;try{E=await Uu(this.extensionGalleryService.getManifest(S,Ie.None),cRi)??null}catch{continue}if(E===null)continue;let M=E?.contributes?.configuration,N;Array.isArray(M)?M.length===1&&(N=M[0].title):N=M?.title;let V=g.settingsEditorRecommendedExtensions[b],H=S.displayName??S.name??y,K=`${b}.manageExtension`,j={range:wf,key:K,keyRange:wf,value:null,valueRange:wf,description:[V.onSettingsEditorOpen?.descriptionOverride??S.description],descriptionIsMarkdown:!1,descriptionRanges:[],scope:4,type:"null",displayExtensionId:y,extensionGroupTitle:N??H,categoryLabel:"Extensions",title:H},J={sections:[{settings:[j]}],id:y,title:j.extensionGroupTitle,titleRange:wf,range:wf,extensionInfo:{id:y,displayName:S.displayName}};n.push(J),p.push(J),h=!0}}if(u.children.push(await _So(this.extensionService,s,l)),u.children.unshift(fSo(n)),g&&h&&this.defaultSettingsEditorModel.setAdditionalGroups(p),!this.workspaceTrustManagementService.isWorkspaceTrusted()&&(this.viewState.settingsTarget instanceof A||this.viewState.settingsTarget===5)){let b=TSo(n,this.viewState.settingsTarget,this.viewState.languageFilter,this.configurationService);b.length&&u.children.unshift({id:"workspaceTrust",label:d(14249,null),settings:b})}this.searchResultModel?.updateChildren();let f=this.settingsTree.firstVisibleElement,v;if(f instanceof NC?v=f.setting.key:f instanceof Lv&&(v=f.id),this.settingsTreeModel.value){if(this.refreshModels(u),o&&this.searchResultModel)return await this.onSearchInputChanged(!1);if(this.refreshTOCTree(),this.renderTree(void 0,t),v){let b=this.settingsTreeModel.value,S,y=b.getElementsByName(v);if(y&&y.length>0)S=y[0];else{let w=x=>{for(let E of x){if(E.id===v)return E;if(E.children){for(let M of E.children)if(M instanceof Lv){let N=w([M]);if(N)return N}}}};S=w([b.root])}if(S)try{this.settingsTree.reveal(S,0)}catch{}}}else if(this.settingsTreeModel.value=this.instantiationService.createInstance(Mge,this.viewState,this.workspaceTrustManagementService.isWorkspaceTrusted()),this.refreshModels(u),(this.viewState.query?void 0:this.restoreCachedState())?.searchQuery||this.searchWidget.getValue())await this.onSearchInputChanged(!0);else{this.refreshTOCTree();let S=this.settingsTreeModel.value.root.children;if(Array.isArray(S)&&S.length>0){let y=S[0];y instanceof Lv&&(this.viewState.categoryFilter=y,this.tocTree.setFocus([y]),this.tocTree.setSelection([y]))}this.refreshTree(),this.tocTree.collapseAll()}}updateElementsByKey(e){e.size?(this.searchResultModel&&e.forEach(t=>this.searchResultModel.updateElementsByName(t)),this.settingsTreeModel.value&&e.forEach(t=>this.settingsTreeModel.value.updateElementsByName(t)),e.forEach(t=>this.renderTree(t))):this.renderTree()}getActiveControlInSettingsTree(){let e=this.settingsTree.getHTMLElement(),t=e.ownerDocument.activeElement;return t&&Is(e)?t:null}renderTree(e,t=!1){if(!t&&e&&this.scheduledRefreshes.has(e)){this.updateModifiedLabelForKey(e);return}if(this.contextViewFocused()){let r=this.window.document.querySelector(".context-view");r&&this.scheduleRefresh(r,e);return}let o=this.getActiveControlInSettingsTree(),n=o&&this.settingRenderers.getSettingDOMElementForDOMElement(o);if(n&&!t)if(e){if(n.getAttribute(tu.SETTING_KEY_ATTR)===e&&n.parentElement&&!n.parentElement.classList.contains("setting-item-list")){this.updateModifiedLabelForKey(e),this.scheduleRefresh(n,e);return}}else{this.scheduleRefresh(n);return}if(this.renderResultCountMessages(!1),e){let r=this.currentSettingsModel?.getElementsByName(e);if(r?.length)r.length>=2&&console.warn("More than one setting with key "+e+" found"),this.refreshSingleElement(r[0]);else return}else this.refreshTree()}contextViewFocused(){return!!rf(this.rootElement.ownerDocument.activeElement,"context-view")}refreshSingleElement(e){this.isVisible()&&this.settingsTree.hasElement(e)&&(!e.setting.deprecationMessage||e.isConfigured)&&this.settingsTree.rerender(e)}refreshTree(){this.isVisible()&&this.currentSettingsModel&&this.settingsTree.setChildren(null,JSo(this.currentSettingsModel.root))}refreshTOCTree(){this.isVisible()&&(this.tocTreeModel.update(),this.tocTree.setChildren(null,KRi(this.tocTreeModel,this.tocTree)))}updateModifiedLabelForKey(e){if(!this.currentSettingsModel)return;let t=this.currentSettingsModel.getElementsByName(e),o=t&&t[0]&&t[0].isConfigured,n=this.settingRenderers.getDOMElementsForSettingKey(this.settingsTree.getHTMLElement(),e);n&&n[0]&&n[0].classList.toggle("is-configured",!!o)}async onSearchInputChanged(e){if(!this.currentSettingsModel)return;let t=this.searchWidget.getValue().trim();this.viewState.query=t,await this.triggerSearch(t.replace(/\u203A/g," "),e)}parseSettingFromJSON(e){let t=e.match(/"([a-zA-Z.]+)": /);return t&&t[1]}toggleTocBySearchBehaviorType(){this.configurationService.getValue(YSo)==="hide"?(this.splitView.setViewVisible(0,!1),this.splitView.style({separatorBorder:Ue.transparent})):this.layoutSplitView(this.dimension)}async triggerSearch(e,t){let o=this.editorProgressService.show(!0,800),n=this.viewState.tagFilters?.has(vQ);if(this.viewState.tagFilters=new Set,this.viewState.extensionFilters=new Set,this.viewState.featureFilters=new Set,this.viewState.idFilters=new Set,this.viewState.languageFilter=void 0,e){let r=aKt(e);e=r.query,r.tags.forEach(s=>this.viewState.tagFilters.add(s)),r.extensionFilters.forEach(s=>this.viewState.extensionFilters.add(s)),r.featureFilters.forEach(s=>this.viewState.featureFilters.add(s)),r.idFilters.forEach(s=>this.viewState.idFilters.add(s)),this.viewState.languageFilter=r.languageFilter}n!==this.viewState.tagFilters?.has(vQ)&&await this.onConfigUpdate(),this.settingsTargetsWidget.updateLanguageFilterIndicators(this.viewState.languageFilter),e&&e!=="@"?(e=this.parseSettingFromJSON(e)||e,await this.triggerFilterPreferences(e,t,o),this.toggleTocBySearchBehaviorType()):(this.viewState.tagFilters.size||this.viewState.extensionFilters.size||this.viewState.featureFilters.size||this.viewState.idFilters.size||this.viewState.languageFilter?this.searchResultModel=this.createFilterModel():this.searchResultModel=null,this.searchDelayer.cancel(),this.searchInProgress&&(this.searchInProgress.dispose(!0),this.searchInProgress=null),t&&(this.tocTree.setFocus([]),this.viewState.categoryFilter=void 0),this.tocTreeModel.currentSearchModel=this.searchResultModel,this.searchResultModel?(t&&(this.tocTree.setSelection([]),this.tocTree.expandAll()),this.refreshTOCTree(),this.renderResultCountMessages(!1),this.refreshTree(),this.toggleTocBySearchBehaviorType()):this.tocTreeDisposed||(this.tocTree.collapseAll(),this.refreshTOCTree(),this.renderResultCountMessages(!1),this.refreshTree(),this.layoutSplitView(this.dimension)),o.done())}createFilterModel(){let e=this.instantiationService.createInstance(Pge,this.viewState,this.settingsOrderByTocIndex,this.workspaceTrustManagementService.isWorkspaceTrusted()),t={filterMatches:[],exactMatch:!1},o=this.canShowAdvancedSettings();for(let n of this.defaultSettingsEditorModel.settingsGroups.slice(1))for(let r of n.sections)for(let s of r.settings)!o&&!this.shouldShowSetting(s)||t.filterMatches.push({setting:s,matches:[],matchType:0,keyMatchScore:0,score:0,providerName:Kbo});return e.setResult(0,t),e}async triggerFilterPreferences(e,t,o){this.searchInProgress&&(this.searchInProgress.dispose(!0),this.searchInProgress=null);let n=this.searchInProgress=new qe;return this.searchDelayer.trigger(async()=>{if(n.token.isCancellationRequested)return;this.disableAiSearchToggle();let r=await this.doLocalSearch(e,n.token);!this.searchResultModel||n.token.isCancellationRequested||(this.searchResultModel.showAiResults=!1,r&&r.filterMatches.length>0&&this.onDidFinishSearch(t,void 0),(!r||!r.exactMatch)&&await this.doRemoteSearch(e,n.token),!n.token.isCancellationRequested&&(this.aiSearchPromise&&this.aiSearchPromise.cancel(),this.searchInputActionBar&&this.showAiResultsAction&&this.searchInputActionBar.hasAction(this.showAiResultsAction)&&(this.aiSearchPromise=Hn(s=>this.doAiSearch(e,s).then(l=>{l&&this.showAiResultsAction&&(this.showAiResultsAction.enabled=!0,this.aiResultsAvailable.set(!0),this.showAiResultsAction.label=ksn,this.renderResultCountMessages(!0))}).catch(l=>{Yi(l)||this.logService.trace("Error during AI settings search:",l)}))),this.onDidFinishSearch(t,o)))})}onDidFinishSearch(e,t){this.tocTreeModel.currentSearchModel=this.searchResultModel,e&&(this.tocTree.setFocus([]),this.viewState.categoryFilter=void 0,this.tocTree.expandAll(),this.settingsTree.scrollTop=0),this.refreshTOCTree(),this.renderTree(void 0,!0),t?.done()}doLocalSearch(e,t){let o=this.preferencesSearchService.getLocalSearchProvider(e);return this.searchWithProvider(0,o,Gzt,t)}doRemoteSearch(e,t){let o=this.preferencesSearchService.getRemoteSearchProvider(e);return o?this.searchWithProvider(1,o,qzt,t):Promise.resolve(null)}async doAiSearch(e,t){let o=this.preferencesSearchService.getAiSearchProvider(e);if(!o)return null;let n=await this.searchWithProvider(3,o,$zt,t);if(!n||t.isCancellationRequested)return null;let r=await this.getLLMRankedResults(e,t);return t.isCancellationRequested?null:{filterMatches:n.filterMatches.concat(r?.filterMatches??[]),exactMatch:!1}}async getLLMRankedResults(e,t){let o=this.preferencesSearchService.getAiSearchProvider(e);if(!o)return null;let n=new On(!1),r=await o.getLLMRankedResults(t);if(n.stop(),t.isCancellationRequested)return null;if(r&&r.filterMatches.length>0){let s=n.elapsed();this.logSearchPerformance(jzt,s)}return this.searchResultModel.setResult(4,r),r}async searchWithProvider(e,t,o,n){let r=new On(!1),s=await this._searchPreferencesModel(this.defaultSettingsEditorModel,t,n);if(r.stop(),n.isCancellationRequested)return null;if(s&&!this.canShowAdvancedSettings()&&(s.filterMatches=s.filterMatches.filter(l=>this.shouldShowSetting(l.setting))),s&&s.filterMatches.length>0){let l=r.elapsed();this.logSearchPerformance(o,l)}return this.searchResultModel??=this.instantiationService.createInstance(Pge,this.viewState,this.settingsOrderByTocIndex,this.workspaceTrustManagementService.isWorkspaceTrusted()),this.searchResultModel.setResult(e,s),s}logSearchPerformance(e,t){this.telemetryService.publicLog2("settingsEditor.searchPerformance",{providerName:e,elapsedMs:t})}renderResultCountMessages(e){if(this.currentSettingsModel)if(this.clearFilterLinkContainer.style.display=this.viewState.tagFilters&&this.viewState.tagFilters.size>0?"initial":"none",this.searchResultModel){let t=this.searchResultModel.getUniqueResultsCount(),o;if(e)switch(t){case 0:o=d(14244,null);break;case 1:o=d(14246,null);break;default:o=d(14241,null,t)}else switch(t){case 0:o=d(14243,null);break;case 1:o=d(14245,null);break;default:o=d(14240,null,t)}this.searchResultLabel=o,this.updateInputAriaLabel(),this.countElement.innerText=o,Er(o),this.countElement.style.display!=="block"&&(this.countElement.style.display="block"),this.layout(this.dimension),this.rootElement.classList.toggle("no-results",t===0),this.splitView.el.style.visibility=t===0?"hidden":"visible"}else{this.countElement.style.display!=="none"&&(this.searchResultLabel=null,this.updateInputAriaLabel(),this.countElement.style.display="none",this.countElement.innerText="",this.layout(this.dimension)),this.rootElement.classList.remove("no-results"),this.splitView.el.style.visibility="visible";return}}async _searchPreferencesModel(e,t,o){try{return await t.searchModel(e,o)}catch(n){return Yi(n)?Promise.reject(n):null}}layoutSplitView(e){if(!this.isVisible())return;let t=e.height-97;if(this.splitView.el.style.height=`${t}px`,this.splitView.layout(this.bodyContainer.clientWidth,t),!(this.configurationService.getValue(YSo)==="hide"&&this.searchResultModel)){let r=this.splitView.isViewVisible(0),s=this.bodyContainer.clientWidth>=fd.NARROW_TOTAL_WIDTH;this.splitView.setViewVisible(0,s),!r&&s&&this.bodyContainer.clientWidth>=fd.EDITOR_MIN_WIDTH+fd.TOC_RESET_WIDTH&&this.splitView.resizeView(0,fd.TOC_RESET_WIDTH),this.splitView.style({separatorBorder:s?this.theme.getColor(Zot):Ue.transparent})}}saveState(){if(this.isVisible()){let e=this.searchWidget.getValue().trim(),t=this.settingsTargetsWidget.settingsTarget;this.input&&this.editorMemento.saveEditorState(this.group,this.input,{searchQuery:e,target:t})}else this.input&&this.editorMemento.clearEditorState(this.input,this.group);super.saveState()}};fd=I([m(1,_e),m(2,Yg),m(3,Gn),m(4,Pe),m(5,Qo),m(6,F),m(7,Ezt),m(8,re),m(9,X),m(10,de),m(11,kt),m(12,ry),m(13,Yl),m(14,Or),m(15,lt),m(16,Rt),m(17,xs),m(18,Ze),m(19,ga),m(20,Hd),m(21,gn),m(22,Le),m(23,dr),m(24,Mt)],fd);var hnt=class extends k{constructor(e,t,o,n,r,s){super();this.commandService=o;this.userDataSyncService=n;this.userDataSyncEnablementService=r;this._onDidChangeLastSyncedLabel=this._register(new T);this.onDidChangeLastSyncedLabel=this._onDidChangeLastSyncedLabel.event;let l=D(t,VR(".settings-right-controls")),c=D(l,VR(".turn-on-sync"));this.turnOnSyncButton=this._register(new Pi(c,{title:!0,...Ro})),this.lastSyncedLabel=D(l,VR(".last-synced-label")),Wi(this.lastSyncedLabel),this.turnOnSyncButton.enabled=!0,this.turnOnSyncButton.label=d(14252,null),Wi(this.turnOnSyncButton.element),this._register(this.turnOnSyncButton.onDidClick(async()=>{await this.commandService.executeCommand("workbench.userDataSync.actions.turnOn")})),this.updateLastSyncedTime(),this._register(this.userDataSyncService.onDidChangeLastSyncTime(()=>{this.updateLastSyncedTime()})),this._register(new LL).cancelAndSet(()=>this.updateLastSyncedTime(),60*1e3,e),this.update(),this._register(this.userDataSyncService.onDidChangeStatus(()=>{this.update()})),this._register(this.userDataSyncEnablementService.onDidChangeEnablement(()=>{this.update()}))}updateLastSyncedTime(){let e=this.userDataSyncService.lastSyncTime,t;if(typeof e=="number"){let o=ea(e,!0,void 0,!0);t=d(14239,null,o)}else t="";this.lastSyncedLabel.textContent=t,this._onDidChangeLastSyncedLabel.fire(t)}update(){this.userDataSyncService.status!=="uninitialized"&&(this.userDataSyncEnablementService.isEnabled()||this.userDataSyncService.status!=="idle"?(Xo(this.lastSyncedLabel),Wi(this.turnOnSyncButton.element)):(Wi(this.lastSyncedLabel),Xo(this.turnOnSyncButton.element)))}};hnt=I([m(2,fe),m(3,ny),m(4,Yl),m(5,_e)],hnt);var Tsn="settings.action.search",_sn="settings.action.focusSettingsFile",Dsn="settings.action.focusSettingsFromSearch",Rsn="settings.action.focusSettingsList",Lsn="settings.action.focusTOC",Msn="settings.action.focusSettingControl",Psn="settings.action.focusLevelUp",Asn="settings.switchToJSON",Nsn="settings.filterByOnline",Osn="settings.filterUntrusted",Fsn="workbench.action.openSettings",Wsn="settings.filterByTelemetry";oe.as(en.EditorPane).registerEditorPane(os.create(fd,fd.ID,d(14189,null)),[new Vt(PR)]);oe.as(en.EditorPane).registerEditorPane(os.create(SQ,SQ.ID,d(14178,null)),[new Vt(Qte)]);var $Ri=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(Qte)}};oe.as(en.EditorPane).registerEditorPane(os.create(pg,pg.ID,d(14154,null)),[new Vt(MR)]);var jRi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(MR)}},QRi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(PR)}};oe.as(en.EditorFactory).registerEditorSerializer(Qte.ID,$Ri);oe.as(en.EditorFactory).registerEditorSerializer(MR.ID,jRi);oe.as(en.EditorFactory).registerEditorSerializer(PR.ID,QRi);var gnt=P(14172,"Open Settings (UI)"),Vsn=P(14174,"Open User Settings (JSON)"),Bsn=P(14161,"Open Application Settings (JSON)"),Sw=Fe.Preferences;function qRi(a){return Xa(a)?a:void 0}function Hsn(a){return We(a)?a:void 0}function QW(a){Di(a)||(a={});let i={focusSearch:qRi(a?.focusSearch),openToSide:qRi(a?.openToSide),query:Hsn(a?.query)};return We(a?.revealSetting?.key)&&(i={...i,revealSetting:{key:a.revealSetting.key,edit:qRi(a.revealSetting?.edit)}}),i}var SNe=class extends k{constructor(e,t,o,n,r,s,l){super();this.environmentService=e;this.userDataProfileService=t;this.preferencesService=o;this.workspaceContextService=n;this.labelService=r;this.extensionService=s;this.userDataProfilesService=l;this.registerSettingsActions(),this.registerKeybindingsActions(),this.updatePreferencesEditorMenuItem(),this._register(n.onDidChangeWorkbenchState(()=>this.updatePreferencesEditorMenuItem())),this._register(n.onDidChangeWorkspaceFolders(()=>this.updatePreferencesEditorMenuItemForWorkspaceFolders()))}static{this.ID="workbench.contrib.preferencesActions"}registerSettingsActions(){this._register(W(class extends z{constructor(){super({id:Fsn,title:{...P(14179,"Settings"),mnemonicTitle:d(14157,null)},keybinding:{weight:200,when:null,primary:2135},menu:[{id:R.GlobalActivity,group:"2_configuration",order:2},{id:R.MenubarPreferencesMenu,group:"2_configuration",order:2}]})}run(t,o){let n=typeof o=="string"?{query:o}:QW(o);return t.get(Qo).openSettings({...n})}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openSettings2",title:P(14172,"Open Settings (UI)"),category:Sw,f1:!0})}run(t,o){return o=QW(o),t.get(Qo).openSettings({jsonEditor:!1,...o})}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openSettingsJson",title:Vsn,metadata:{description:P(14193,"Opens the JSON file containing the current user profile settings")},category:Sw,f1:!0})}run(t,o){return o=QW(o),t.get(Qo).openSettings({jsonEditor:!0,...o})}}));let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.action.openApplicationSettingsJson",title:Bsn,category:Sw,menu:{id:R.CommandPalette,when:C.notEquals(ZYe.key,e.userDataProfilesService.defaultProfile.id)}})}run(t,o){return o=QW(o),t.get(Qo).openApplicationSettings({jsonEditor:!0,...o})}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openGlobalSettings",title:P(14168,"Open User Settings"),category:Sw,f1:!0})}run(t,o){return o=QW(o),t.get(Qo).openUserSettings(o)}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openRawDefaultSettings",title:P(14169,"Open Default Settings (JSON)"),category:Sw,f1:!0})}run(t){return t.get(Qo).openRawDefaultSettings()}})),this._register(W(class extends z{constructor(){super({id:fq.ID,title:fq.LABEL,category:Sw,f1:!0})}run(t){return t.get(F).createInstance(fq,fq.ID,fq.LABEL.value).run()}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openWorkspaceSettings",title:P(14175,"Open Workspace Settings"),category:Sw,menu:{id:R.CommandPalette,when:el.notEqualsTo("empty")}})}run(t,o){return o=typeof o=="string"?{query:o}:QW(o),t.get(Qo).openWorkspaceSettings(o)}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openAccessibilitySettings",title:P(14160,"Open Accessibility Settings"),category:Sw,menu:{id:R.CommandPalette,when:el.notEqualsTo("empty")}})}async run(t){await t.get(Qo).openSettings({jsonEditor:!1,query:"@tag:accessibility"})}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openWorkspaceSettingsFile",title:P(14176,"Open Workspace Settings (JSON)"),category:Sw,menu:{id:R.CommandPalette,when:el.notEqualsTo("empty")}})}run(t,o){return o=QW(o),t.get(Qo).openWorkspaceSettings({jsonEditor:!0,...o})}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openFolderSettings",title:P(14163,"Open Folder Settings"),category:Sw,menu:{id:R.CommandPalette,when:el.isEqualTo("workspace")}})}async run(t,o){let n=t.get(fe),r=t.get(Qo),s=await n.executeCommand(iP);s&&(o=QW(o),await r.openFolderSettings({folderUri:s.uri,...o}))}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openFolderSettingsFile",title:P(14165,"Open Folder Settings (JSON)"),category:Sw,menu:{id:R.CommandPalette,when:el.isEqualTo("workspace")}})}async run(t,o){let n=t.get(fe),r=t.get(Qo),s=await n.executeCommand(iP);s&&(o=QW(o),await r.openFolderSettings({folderUri:s.uri,jsonEditor:!0,...o}))}})),this._register(W(class extends z{constructor(){super({id:"_workbench.action.openFolderSettings",title:d(14164,null),category:Sw,menu:{id:R.ExplorerContext,group:"2_workspace",order:20,when:C.and(nk,gu)}})}async run(t,o){if(A.isUri(o))await t.get(Qo).openFolderSettings({folderUri:o});else{let n=t.get(fe),r=t.get(Qo),s=await n.executeCommand(iP);s&&await r.openFolderSettings({folderUri:s.uri})}}})),this._register(W(class extends z{constructor(){super({id:Nsn,title:d(14156,null),menu:{id:R.MenubarPreferencesMenu,group:"3_settings",order:1}})}run(t){let o=t.get(ie).activeEditorPane;o instanceof fd?o.focusSearch("@tag:usesOnlineServices"):t.get(Qo).openSettings({jsonEditor:!1,query:"@tag:usesOnlineServices"})}})),this._register(W(class extends z{constructor(){super({id:_zt,precondition:WR,keybinding:{primary:2087,weight:100,when:Mzt},category:Sw,f1:!0,title:P(14188,"Toggle AI Settings Search")})}run(t){let o=t.get(ie).activeEditorPane;o instanceof fd&&o.toggleAiSearch()}})),this._register(W(class extends z{constructor(){super({id:Osn,title:P(14153,"Show untrusted workspace settings")})}run(t){t.get(Qo).openWorkspaceSettings({jsonEditor:!1,query:`@tag:${eNe}`})}})),this._register(W(class extends z{constructor(){super({id:Wsn,title:d(14158,null)})}run(t){let o=t.get(ie).activeEditorPane;o instanceof fd?o.focusSearch("@tag:telemetry"):t.get(Qo).openSettings({jsonEditor:!1,query:"@tag:telemetry"})}})),this.registerSettingsEditorActions(),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{let t=this.environmentService.remoteAuthority,o=this.labelService.getHostLabel(Q.vscodeRemote,t)||t;this._register(W(class extends z{constructor(){super({id:"workbench.action.openRemoteSettings",title:P(14170,"Open Remote Settings ({0})",o),category:Sw,menu:{id:R.CommandPalette,when:Qb.notEqualsTo("")}})}run(n,r){return r=QW(r),n.get(Qo).openRemoteSettings(r)}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openRemoteSettingsFile",title:P(14171,"Open Remote Settings (JSON) ({0})",o),category:Sw,menu:{id:R.CommandPalette,when:Qb.notEqualsTo("")}})}run(n,r){return r=QW(r),n.get(Qo).openRemoteSettings({jsonEditor:!0,...r})}}))})}registerSettingsEditorActions(){function e(o){let n=o.get(ie).activeEditorPane;return n instanceof fd?n:null}function t(o){e(o)?.focusSearch()}this._register(W(class extends z{constructor(){super({id:Tsn,precondition:WR,keybinding:{primary:2084,weight:100,when:null},category:Sw,f1:!0,title:P(14183,"Focus Settings Search")})}run(o){t(o)}})),this._register(W(class extends z{constructor(){super({id:Tzt,precondition:WR,keybinding:{primary:9,weight:100,when:yge},category:Sw,f1:!0,title:P(14180,"Clear Settings Search Results")})}run(o){e(o)?.clearSearchResults()}})),this._register(W(class extends z{constructor(){super({id:_sn,precondition:C.and(yge,ar.Visible.toNegated()),keybinding:{primary:18,weight:100,when:null},title:d(14181,null)})}run(o){e(o)?.focusSettings()}})),this._register(W(class extends z{constructor(){super({id:Dsn,precondition:C.and(yge,ar.Visible.toNegated()),keybinding:{primary:18,weight:200,when:null},title:d(14181,null)})}run(o){e(o)?.focusSettings()}})),this._register(W(class extends z{constructor(){super({id:Rsn,precondition:C.and(WR,Rzt),keybinding:{primary:3,weight:200,when:null},title:d(14185,null)})}run(o){let n=e(o);n instanceof fd&&n.focusSettings()}})),this._register(W(class extends z{constructor(){super({id:Lsn,precondition:WR,f1:!0,keybinding:[{primary:15,weight:200,when:$ot}],category:Sw,title:P(14186,"Focus Settings Table of Contents")})}run(o){let n=e(o);n instanceof fd&&n.focusTOC()}})),this._register(W(class extends z{constructor(){super({id:Msn,precondition:C.and(WR,$ot),keybinding:{primary:3,weight:200},title:d(14184,null)})}run(o){let n=e(o);if(!(n instanceof fd))return;n.getContainer()?.ownerDocument.activeElement?.classList.contains("monaco-list")&&n.focusSettings(!0)}})),this._register(W(class extends z{constructor(){super({id:Dzt,precondition:WR,keybinding:{primary:1091,weight:200,when:null},f1:!0,category:Sw,title:P(14187,"Show Setting Context Menu")})}run(o){let n=e(o);n instanceof fd&&n.showContextMenu()}})),this._register(W(class extends z{constructor(){super({id:Psn,precondition:C.and(WR,yge.toNegated(),aRi.toNegated()),keybinding:{primary:9,weight:200,when:null},f1:!0,category:Sw,title:P(14182,"Move Focus Up One Level")})}run(o){let n=e(o);n instanceof fd&&(n.currentFocusContext===3?n.focusSettings():n.currentFocusContext===2?n.focusTOC():n.currentFocusContext===1&&n.focusSearch())}}))}registerKeybindingsActions(){let e=this,t=P(14177,"Preferences"),o="workbench.action.openGlobalKeybindings";this._register(W(class extends z{constructor(){super({id:o,title:P(14166,"Open Keyboard Shortcuts"),shortTitle:d(14155,null),category:t,icon:bQ,keybinding:{when:null,weight:200,primary:Gi(2089,2097)},menu:[{id:R.CommandPalette},{id:R.EditorTitle,when:Ho.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString()),group:"navigation",order:1},{id:R.ModalEditorEditorTitle,when:Ho.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString()),group:"navigation",order:1},{id:R.GlobalActivity,group:"2_configuration",order:4}]})}run(n,...r){let s=typeof r[0]=="string"?r[0]:void 0,l=Mie(n,r)?.id;return n.get(Qo).openGlobalKeybindingSettings(!1,{query:s,groupId:l})}})),this._register(be.appendMenuItem(R.MenubarPreferencesMenu,{command:{id:o,title:d(14155,null)},group:"2_configuration",order:4})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openDefaultKeybindingsFile",title:P(14162,"Open Default Keyboard Shortcuts (JSON)"),category:t,menu:{id:R.CommandPalette}})}run(n){return n.get(Qo).openDefaultKeybindingsFile()}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.openGlobalKeybindingsFile",title:P(14167,"Open Keyboard Shortcuts (JSON)"),category:t,icon:bQ,menu:[{id:R.CommandPalette},{id:R.EditorTitle,when:C.and(xf),group:"navigation"},{id:R.ModalEditorEditorTitle,when:C.and(xf),group:"navigation"}]})}run(n,...r){let s=Mie(n,r)?.id;return n.get(Qo).openGlobalKeybindingSettings(!0,{groupId:s})}})),this._register(W(class extends z{constructor(){super({id:Bbo,title:P(14190,"Show System Keybindings"),menu:[{id:R.EditorTitle,when:C.and(xf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=Mie(n,r)?.activeEditorPane;l instanceof pg&&l.search("@source:system")}})),this._register(W(class extends z{constructor(){super({id:Ubo,title:P(14191,"Show Extension Keybindings"),menu:[{id:R.EditorTitle,when:C.and(xf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=Mie(n,r)?.activeEditorPane;l instanceof pg&&l.search("@source:extension")}})),this._register(W(class extends z{constructor(){super({id:Hbo,title:P(14192,"Show User Keybindings"),menu:[{id:R.EditorTitle,when:C.and(xf),group:"1_keyboard_preferences_actions"}]})}run(n,...r){let l=Mie(n,r)?.activeEditorPane;l instanceof pg&&l.search("@source:user")}})),this._register(W(class extends z{constructor(){super({id:Pzt,title:d(14150,null),keybinding:{weight:200,when:C.and(xf,XAe,Lzt),primary:9}})}run(n){let r=n.get(ie).activeEditorPane;r instanceof pg&&r.clearSearchResults()}})),this._register(W(class extends z{constructor(){super({id:Obo,title:d(14151,null),category:t,menu:[{id:R.CommandPalette,when:C.and(xf)}]})}run(n){let r=n.get(ie).activeEditorPane;r instanceof pg&&r.clearKeyboardShortcutSearchHistory()}})),this.registerKeybindingEditorActions()}registerKeybindingEditorActions(){let e=this;xt.registerCommandAndKeybindingRule({id:JAe,weight:200,when:C.and(xf,zW,wge.toNegated()),primary:3,handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.defineKeybinding(s.activeKeybindingEntry,!1)}}),xt.registerCommandAndKeybindingRule({id:Ozt,weight:200,when:C.and(xf,zW),primary:Gi(2089,2079),handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.defineKeybinding(s.activeKeybindingEntry,!0)}}),xt.registerCommandAndKeybindingRule({id:Fzt,weight:200,when:C.and(xf,zW),primary:Gi(2089,2083),handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.activeKeybindingEntry.keybindingItem.keybinding&&s.defineWhenExpression(s.activeKeybindingEntry)}}),xt.registerCommandAndKeybindingRule({id:Wzt,weight:200,when:C.and(xf,zW,Wg.toNegated()),primary:20,mac:{primary:2049},handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.removeKeybinding(s.activeKeybindingEntry)}}),xt.registerCommandAndKeybindingRule({id:Vzt,weight:200,when:C.and(xf,zW),primary:0,handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.resetKeybinding(s.activeKeybindingEntry)}}),xt.registerCommandAndKeybindingRule({id:Nbo,weight:200,when:C.and(xf),primary:2084,handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.focusSearch()}}),xt.registerCommandAndKeybindingRule({id:Azt,weight:200,when:C.and(xf,XAe),primary:553,mac:{primary:2601},handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.recordSearchKeys()}}),xt.registerCommandAndKeybindingRule({id:Nzt,weight:200,when:C.and(xf),primary:558,mac:{primary:2606},handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.toggleSortByPrecedence()}}),xt.registerCommandAndKeybindingRule({id:zzt,weight:200,when:C.and(xf,zW),primary:0,handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.showSimilarKeybindings(s.activeKeybindingEntry)}}),xt.registerCommandAndKeybindingRule({id:Bzt,weight:200,when:C.and(xf,zW,wge.negate()),primary:2081,handler:async(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&await s.copyKeybinding(s.activeKeybindingEntry)}}),xt.registerCommandAndKeybindingRule({id:Hzt,weight:200,when:C.and(xf,zW),primary:0,handler:async(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&await s.copyKeybindingCommand(s.activeKeybindingEntry)}}),xt.registerCommandAndKeybindingRule({id:Uzt,weight:200,when:C.and(xf,zW),primary:0,handler:async(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&await s.copyKeybindingCommandTitle(s.activeKeybindingEntry)}}),xt.registerCommandAndKeybindingRule({id:Vbo,weight:200,when:C.and(xf,XAe),primary:2066,handler:(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.focusKeybindings()}}),xt.registerCommandAndKeybindingRule({id:Wbo,weight:200,when:C.and(xf,wge,ar.Visible.toNegated()),primary:9,handler:async(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.rejectWhenExpression(s.activeKeybindingEntry)}}),xt.registerCommandAndKeybindingRule({id:Fbo,weight:200,when:C.and(xf,wge,ar.Visible.toNegated()),primary:3,handler:async(n,r)=>{let s=n.get(ie).activeEditorPane;s instanceof pg&&s.acceptWhenExpression(s.activeKeybindingEntry)}});let t=this._register(new O),o=()=>{t.clear(),t.add(W(class extends z{constructor(){let r=Ho.Resource.isEqualTo(e.userDataProfileService.currentProfile.keybindingsResource.toString());super({id:"editor.action.defineKeybinding",title:P(14152,"Define Keybinding"),f1:!0,precondition:r,keybinding:{weight:200,when:r,primary:Gi(2089,2089)},menu:{id:R.EditorContent,when:r}})}async run(r){let s=r.get(ie).activeTextEditorControl;fn(s)&&s.getContribution(fFt)?.showDefineKeybindingWidget()}}))};o(),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>o()))}updatePreferencesEditorMenuItem(){let e="_workbench.openWorkspaceSettingsEditor";if(this.workspaceContextService.getWorkbenchState()===3&&!Ge.getCommand(e)){Ge.registerCommand(e,()=>this.preferencesService.openWorkspaceSettings({jsonEditor:!1}));let t=C.and(Ho.Resource.isEqualTo(this.preferencesService.workspaceSettingsResource.toString()),el.isEqualTo("workspace"),C.not("isInDiffEditor"));be.appendMenuItem(R.EditorTitle,{command:{id:e,title:gnt,icon:bQ},when:t,group:"navigation",order:1}),be.appendMenuItem(R.ModalEditorEditorTitle,{command:{id:e,title:gnt,icon:bQ},when:t,group:"navigation",order:1})}this.updatePreferencesEditorMenuItemForWorkspaceFolders()}updatePreferencesEditorMenuItemForWorkspaceFolders(){for(let e of this.workspaceContextService.getWorkspace().folders){let t=`_workbench.openFolderSettings.${e.uri.toString()}`;if(!Ge.getCommand(t)){Ge.registerCommand(t,(n,...r)=>{let s=Mie(n,r)?.id;return this.workspaceContextService.getWorkbenchState()===2?this.preferencesService.openWorkspaceSettings({jsonEditor:!1,groupId:s}):this.preferencesService.openFolderSettings({folderUri:e.uri,jsonEditor:!1,groupId:s})});let o=C.and(Ho.Resource.isEqualTo(this.preferencesService.getFolderSettingsResource(e.uri).toString()),C.not("isInDiffEditor"));be.appendMenuItem(R.EditorTitle,{command:{id:t,title:gnt,icon:bQ},when:o,group:"navigation",order:1}),be.appendMenuItem(R.ModalEditorEditorTitle,{command:{id:t,title:gnt,icon:bQ},when:o,group:"navigation",order:1})}}}};SNe=I([m(0,Mt),m(1,gn),m(2,Qo),m(3,Ae),m(4,nt),m(5,lt),m(6,hn)],SNe);var INe=class extends k{constructor(e,t){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.registerSettingsEditorTitleActions()}static{this.ID="workbench.contrib.settingsEditorTitleBarActions"}registerSettingsEditorTitleActions(){let e=this._register(new ue),t=()=>{let n=C.and(WR.toNegated(),C.or(Ho.Resource.isEqualTo(this.userDataProfileService.currentProfile.settingsResource.toString()),Ho.Resource.isEqualTo(this.userDataProfilesService.defaultProfile.settingsResource.toString())),C.not("isInDiffEditor"));e.clear(),e.value=W(class extends z{constructor(){super({id:"_workbench.openUserSettingsEditor",title:gnt,icon:bQ,menu:[{id:R.EditorTitle,when:n,group:"navigation",order:1},{id:R.ModalEditorEditorTitle,when:n,group:"navigation",order:1}]})}run(r,...s){let l=QW(s[0]),c=Mie(r,s)?.id;return r.get(Qo).openUserSettings({jsonEditor:!1,...l,groupId:c})}})};t(),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>{t()}));let o=C.and(aRi.toNegated(),WR);this._register(W(class extends z{constructor(){super({id:Asn,title:P(14173,"Open Settings (JSON)"),icon:bQ,menu:[{id:R.EditorTitle,when:o,group:"navigation",order:1},{id:R.ModalEditorEditorTitle,when:o,group:"navigation",order:1}]})}run(n,...r){let l=Mie(n,r)?.activeEditorPane;return l instanceof fd?l.switchToSettingsFile():null}}))}};INe=I([m(0,gn),m(1,hn)],INe);var yNe=class extends k{constructor(e,t,o,n){super();this.editor=e;this.instantiationService=t;this.preferencesService=o;this.workspaceContextService=n;this.disposables=this._register(new O);this._createPreferencesRenderer(),this._register(this.editor.onDidChangeModel(r=>this._createPreferencesRenderer())),this._register(this.workspaceContextService.onDidChangeWorkbenchState(()=>this._createPreferencesRenderer()))}static{this.ID="editor.contrib.settings"}async _createPreferencesRenderer(){this.disposables.clear(),this.currentRenderer=void 0;let e=this.editor.getModel();if(e&&/\.(json|code-workspace)$/.test(e.uri.path)){let t=await this.preferencesService.createPreferencesEditorModel(e.uri);t instanceof Ghe&&this.editor.getModel()&&(this.disposables.add(t),t.configurationTarget===5?this.currentRenderer=this.disposables.add(this.instantiationService.createInstance(pNe,this.editor,t)):this.currentRenderer=this.disposables.add(this.instantiationService.createInstance(Rge,this.editor,t))),this.currentRenderer?.render()}}};yNe=I([m(1,F),m(2,Qo),m(3,Ae)],yNe);function Mie(a,i){return Zp(i,a.get(ie),a.get(kt),a.get(Co)).groupedEditors[0]?.group}bt(SNe.ID,SNe,vt.BlockStartup);bt(kge.ID,kge,vt.BlockStartup);bt(INe.ID,INe,vt.AfterRestored);Eo(yNe.ID,yNe,1);be.appendMenuItem(R.MenubarFileMenu,{title:d(14159,null),submenu:R.MenubarPreferencesMenu,group:"5_autosave",order:2,when:Zk.toNegated()});var bKt=class{static hasOpenBrace(i){for(;i.scan()!==17;)if(i.getToken()===1)return!0;return!1}static offsetToPosition(i,e){let t=0,o=i.getEOL().length,n=i.getLineCount();for(let r=1;r<=n;r++){let s=i.getLineLength(r)+o,l=t+s;if(l>e)return new ye(r,e-t+1);t=l}return new ye(n,i.getLineMaxColumn(n))}static insertSnippet(i,e){let t=i.getValueLengthInRange(new G(1,1,e.lineNumber,e.column)),o;(b=>(b[b.INVALID=0]="INVALID",b[b.AFTER_OBJECT=1]="AFTER_OBJECT",b[b.BEFORE_OBJECT=2]="BEFORE_OBJECT"))(o||={});let n=0,r=-1,s=0,l=Jue(i.getValue()),c=0,u=0,p=(g,f)=>{f!==0&&c===1&&u===0?(n=f,r=g,s=f):n!==0&&(n=0,r=l.getTokenOffset())};for(;l.scan()!==17;){let g=l.getPosition(),f=l.getToken(),v=!1;switch(f){case 3:v=!0,c++,p(g,2);break;case 4:v=!0,c--,p(g,0);break;case 5:v=!0,p(g,2);break;case 1:v=!0,u++,p(g,0);break;case 2:v=!0,u--,p(g,1);break;case 15:case 14:v=!0}if(g>=t&&(n!==0||r!==-1)){let b,S;return n!==0?(b=v?g:l.getTokenOffset(),S=n):(b=r,S=s),S===1?{position:this.offsetToPosition(i,b),prepend:",",append:""}:(l.setPosition(b),{position:this.offsetToPosition(i,b),prepend:"",append:this.hasOpenBrace(l)?",":""})}}let h=i.getLineCount();return{position:new ye(h,i.getLineMaxColumn(h)),prepend:`
[`,append:"]"}}};var Pie=class extends rwe{constructor(i,e){if(super(),e.length===0)throw ls("chords");this._os=i,this._chords=e}getLabel(){return nM.toLabel(this._os,this._chords,i=>this._getLabel(i))}getAriaLabel(){return ykt.toLabel(this._os,this._chords,i=>this._getAriaLabel(i))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:oeo.toLabel(this._os,this._chords,i=>this._getElectronAccelerator(i))}getUserSettingsLabel(){return Hke.toLabel(this._os,this._chords,i=>this._getUserSettingsLabel(i))}isWYSIWYG(){return this._chords.every(i=>this._isWYSIWYG(i))}hasMultipleChords(){return this._chords.length>1}getChords(){return this._chords.map(i=>this._getChord(i))}_getChord(i){return new Uvt(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,this._getLabel(i),this._getAriaLabel(i))}getDispatchChords(){return this._chords.map(i=>this._getChordDispatch(i))}getSingleModifierDispatchChords(){return this._chords.map(i=>this._getSingleModifierChordDispatch(i))}};var Usn=!1;function zsn(a){Usn&&console.info(a)}var Aie=class extends Pie{constructor(i,e){super(1,e),this._mapper=i}_getLabel(i){return i.isDuplicateModifierCase()?"":this._mapper.getUILabelForKeyCode(i.keyCode)}_getUSLabelForKeybinding(i){return i.isDuplicateModifierCase()?"":sm.toString(i.keyCode)}getUSLabel(){return nM.toLabel(this._os,this._chords,i=>this._getUSLabelForKeybinding(i))}_getAriaLabel(i){return i.isDuplicateModifierCase()?"":this._mapper.getAriaLabelForKeyCode(i.keyCode)}_getElectronAccelerator(i){return this._mapper.getElectronAcceleratorForKeyBinding(i)}_getUserSettingsLabel(i){if(i.isDuplicateModifierCase())return"";let e=this._mapper.getUserSettingsLabelForKeyCode(i.keyCode);return e&&e.toLowerCase()}_isWYSIWYG(i){return this.__isWYSIWYG(i.keyCode)}__isWYSIWYG(i){if(i===15||i===16||i===17||i===18)return!0;let e=this._mapper.getAriaLabelForKeyCode(i),t=this._mapper.getUserSettingsLabelForKeyCode(i);return e===t}_getChordDispatch(i){if(i.isModifierKey())return null;let e="";return i.ctrlKey&&(e+="ctrl+"),i.shiftKey&&(e+="shift+"),i.altKey&&(e+="alt+"),i.metaKey&&(e+="meta+"),e+=sm.toString(i.keyCode),e}_getSingleModifierChordDispatch(i){return i.keyCode===5&&!i.shiftKey&&!i.altKey&&!i.metaKey?"ctrl":i.keyCode===4&&!i.ctrlKey&&!i.altKey&&!i.metaKey?"shift":i.keyCode===6&&!i.ctrlKey&&!i.shiftKey&&!i.metaKey?"alt":i.keyCode===57&&!i.ctrlKey&&!i.shiftKey&&!i.altKey?"meta":null}static getProducedCharCode(i,e){return e?i.ctrlKey&&i.shiftKey&&i.altKey?e.withShiftAltGr:i.ctrlKey&&i.altKey?e.withAltGr:i.shiftKey?e.withShift:e.value:null}static getProducedChar(i,e){let t=this.getProducedCharCode(i,e);return t===null||t.length===0?" --- ":"  "+t+"  "}},wNe=class{constructor(i,e,t){this._isUSStandard=i;this._mapAltGrToCtrlAlt=t;this._keyCodeToLabel=[];this._scanCodeToKeyCode=[],this._keyCodeToLabel=[],this._keyCodeExists=[],this._keyCodeToLabel[0]=sm.toString(0);for(let s=0;s<193;s++){let l=Fw[s];l!==-1&&(this._scanCodeToKeyCode[s]=l,this._keyCodeToLabel[l]=sm.toString(l),this._keyCodeExists[l]=!0)}let o=[],n=!1;this._codeInfo=[];for(let s in e)if(e.hasOwnProperty(s)){let l=DS.toEnum(s);if(l===0){zsn(`Unknown scanCode ${s} in mapping.`);continue}let c=e[s],u=Fw[l];if(u!==-1){let S=Bvt[c.vkey]||0;if(S===0||u===S||l!==134)continue}let p=c.value,h=c.withShift,g=c.withAltGr,f=c.withShiftAltGr,v=Bvt[c.vkey]||0,b={scanCode:l,keyCode:v,value:p,withShift:h,withAltGr:g,withShiftAltGr:f};if(this._codeInfo[l]=b,this._scanCodeToKeyCode[l]=v,v===0)continue;if(this._keyCodeExists[v]=!0,p.length===0)this._keyCodeToLabel[v]=null;else if(p.length>1)this._keyCodeToLabel[v]=p;else{let S=p.charCodeAt(0);if(S>=97&&S<=122){let y=65+(S-97);o[y]=!0,n=!0,this._keyCodeToLabel[v]=String.fromCharCode(65+(S-97))}else S>=65&&S<=90?(o[S]=!0,n=!0,this._keyCodeToLabel[v]=p):this._keyCodeToLabel[v]=p}}let r=(s,l)=>{o[s]||(this._keyCodeToLabel[l]=String.fromCharCode(s))};if(r(65,31),r(66,32),r(67,33),r(68,34),r(69,35),r(70,36),r(71,37),r(72,38),r(73,39),r(74,40),r(75,41),r(76,42),r(77,43),r(78,44),r(79,45),r(80,46),r(81,47),r(82,48),r(83,49),r(84,50),r(85,51),r(86,52),r(87,53),r(88,54),r(89,55),r(90,56),!n){let s=(l,c)=>{this._keyCodeToLabel[l]=String.fromCharCode(c)};s(85,59),s(86,61),s(87,44),s(88,45),s(89,46),s(90,47),s(91,96),s(92,91),s(93,92),s(94,93),s(95,39)}}dumpDebugInfo(){let i=[],e=[88,104],t=0;i.push("-----------------------------------------------------------------------------------------------------------------------------------------");for(let o=0;o<193;o++){if(Fw[o]!==-1&&e.indexOf(o)===-1)continue;t%6===0&&(i.push("|       HW Code combination      |  Key  |    KeyCode combination    |          UI label         |        User settings       | WYSIWYG |"),i.push("-----------------------------------------------------------------------------------------------------------------------------------------")),t++;let n=this._codeInfo[o],r=DS.toString(o),s=[0,2,5,7];for(let l of s){let c=!!(l&1),u=!!(l&2),p=!!(l&4),h=new IL(c,u,p,!1,o),g=this._resolveChord(h),f=g?sm.toString(g.keyCode):null,v=g?new Aie(this,[g]):null,b=`${c?"Ctrl+":""}${u?"Shift+":""}${p?"Alt+":""}${r}`,S=v?v.getAriaLabel():null,y=S?S.replace(/Control\+/,"Ctrl+"):null,w=v?v.getUserSettingsLabel():null,x=Aie.getProducedChar(h,n),E=f?`${c?"Ctrl+":""}${u?"Shift+":""}${p?"Alt+":""}${f}`:null,N=(v?v.isWYSIWYG():!1)?"       ":"   NO  ";i.push(`| ${this._leftPad(b,30)} | ${x} | ${this._leftPad(E,25)} | ${this._leftPad(y,25)} |  ${this._leftPad(w,25)} | ${N} |`)}i.push("-----------------------------------------------------------------------------------------------------------------------------------------")}return i.join(`
`)}_leftPad(i,e){for(i===null&&(i="null");i.length<e;)i=" "+i;return i}getUILabelForKeyCode(i){return this._getLabelForKeyCode(i)}getAriaLabelForKeyCode(i){return this._getLabelForKeyCode(i)}getUserSettingsLabelForKeyCode(i){return this._isUSStandard?sm.toUserSettingsUS(i):sm.toUserSettingsGeneral(i)}getElectronAcceleratorForKeyBinding(i){return sm.toElectronAccelerator(i.keyCode)}_getLabelForKeyCode(i){return this._keyCodeToLabel[i]||sm.toString(0)}resolveKeyboardEvent(i){let e=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,t=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,o=new RS(e,i.shiftKey,t,i.metaKey,i.keyCode);return new Aie(this,[o])}_resolveChord(i){if(!i)return null;if(i instanceof RS)return this._keyCodeExists[i.keyCode]?i:null;let e=this._scanCodeToKeyCode[i.scanCode]||0;return e===0||!this._keyCodeExists[e]?null:new RS(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,e)}resolveKeybinding(i){let e=jPe(i.chords.map(t=>this._resolveChord(t)));return e.length>0?[new Aie(this,e)]:[]}};var Ksn=d(14143,null),fnt=class extends k{constructor(e,t,o){super();this._editor=e;this._instantiationService=t;this._userDataProfileService=o;this._keybindingDecorationRenderer=this._register(new ue);this._defineWidget=this._register(this._instantiationService.createInstance(bie,this._editor)),this._register(this._editor.onDidChangeModel(n=>this._update())),this._update()}_update(){this._keybindingDecorationRenderer.value=ZSo(this._editor,this._userDataProfileService)?this._instantiationService.createInstance(Wge,this._editor):void 0}showDefineKeybindingWidget(){ZSo(this._editor,this._userDataProfileService)&&this._defineWidget.start().then(e=>this._onAccepted(e))}_onAccepted(e){if(this._editor.focus(),e&&this._editor.hasModel()){new RegExp(/\\/g).test(e)&&(e=e.slice(0,-1)+"\\\\");let n=["{",'	"key": '+JSON.stringify(e)+",",'	"command": "${1:commandId}",','	"when": "${2:editorTextFocus}"',"}$0"].join(`
`),r=bKt.insertSnippet(this._editor.getModel(),this._editor.getPosition());n=r.prepend+n+r.append,this._editor.setPosition(r.position),ss.get(this._editor)?.insert(n,{overwriteBefore:0,overwriteAfter:0})}}};fnt=I([m(1,F),m(2,gn)],fnt);var Wge=class extends k{constructor(e,t){super();this._editor=e;this._keybindingService=t;this._dec=this._editor.createDecorationsCollection(),this._updateDecorations=this._register(new Dt(()=>this._updateDecorationsNow(),500));let o=Ti(this._editor.getModel());this._register(o.onDidChangeContent(()=>this._updateDecorations.schedule())),this._register(this._keybindingService.onDidUpdateKeybindings(()=>this._updateDecorations.schedule())),this._register({dispose:()=>{this._dec.clear(),this._updateDecorations.cancel()}}),this._updateDecorations.schedule()}_updateDecorationsNow(){let e=Ti(this._editor.getModel()),t=[],o=xM(e.getValue());if(o&&Array.isArray(o.children))for(let n=0,r=o.children.length;n<r;n++){let s=o.children[n],l=this._getDecorationForEntry(e,s);l!==null&&t.push(l)}this._dec.set(t)}_getDecorationForEntry(e,t){if(!Array.isArray(t.children))return null;for(let o=0,n=t.children.length;o<n;o++){let r=t.children[o];if(r.type!=="property"||!Array.isArray(r.children)||r.children.length!==2||r.children[0].value!=="key")continue;let l=r.children[1];if(l.type!=="string")continue;let c=this._keybindingService.resolveUserBinding(l.value);if(c.length===0)return this._createDecoration(!0,null,null,e,l);let u=c[0],p=null;if(u instanceof Aie&&(p=u.getUSLabel()),!u.isWYSIWYG()){let g=u.getLabel();return typeof g=="string"&&l.value.toLowerCase()===g.toLowerCase()?null:this._createDecoration(!1,u.getLabel(),p,e,l)}if(/abnt_|oem_/.test(l.value))return this._createDecoration(!1,u.getLabel(),p,e,l);let h=u.getUserSettingsLabel();return typeof h=="string"&&!Wge._userSettingsFuzzyEquals(l.value,h)?this._createDecoration(!1,u.getLabel(),p,e,l):null}return null}static _userSettingsFuzzyEquals(e,t){if(e=e.trim().toLowerCase(),t=t.trim().toLowerCase(),e===t)return!0;let o=dP.parseKeybinding(e),n=dP.parseKeybinding(t);return o===null&&n===null?!0:!o||!n?!1:o.equals(n)}_createDecoration(e,t,o,n,r){let s,l,c;e?(s=new he().appendText(Ksn),l="keybindingError",c=_s(ode)):(o&&t!==o?s=new he(d(14144,null,t,o)):s=new he(d(14145,null,t)),l="keybindingInfo",c=_s(SX));let u=n.getPositionAt(r.offset),p=n.getPositionAt(r.offset+r.length);return{range:new G(u.lineNumber,u.column,p.lineNumber,p.column),options:{description:"keybindings-widget",stickiness:1,className:l,hoverMessage:s,overviewRuler:{color:c,position:4}}}}};Wge=I([m(1,Le)],Wge);function ZSo(a,i){let e=a.getModel();return e?ze(e.uri,i.currentProfile.keybindingsResource):!1}Eo(fFt,fnt,1);function Gsn(a){let i=new Map;for(let e of a)i.set(e,(i.get(e)??0)+1);return i}var CNe=class a{constructor(){this.chunkCount=0;this.chunkOccurrences=new Map;this.documents=new Map}calculateScores(i,e){let t=this.computeEmbedding(i),o=new Map,n=[];for(let[r,s]of this.documents){if(e.isCancellationRequested)return[];for(let l of s.chunks){let c=this.computeSimilarityScore(l,t,o);c>0&&n.push({key:r,score:c})}}return n}static termFrequencies(i){return Gsn(a.splitTerms(i))}static*splitTerms(i){let e=t=>t.toLowerCase();for(let[t]of i.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield e(t);let o=t.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(o.length>1)for(let n of o)n.length>2&&/\p{Letter}{3,}/gu.test(n)&&(yield e(n))}}updateDocuments(i){for(let{key:e}of i)this.deleteDocument(e);for(let e of i){let t=[];for(let o of e.textChunks){let n=a.termFrequencies(o);for(let r of n.keys())this.chunkOccurrences.set(r,(this.chunkOccurrences.get(r)??0)+1);t.push({text:o,tf:n})}this.chunkCount+=t.length,this.documents.set(e.key,{chunks:t})}return this}deleteDocument(i){let e=this.documents.get(i);if(e){this.documents.delete(i),this.chunkCount-=e.chunks.length;for(let t of e.chunks)for(let o of t.tf.keys()){let n=this.chunkOccurrences.get(o);if(typeof n=="number"){let r=n-1;r<=0?this.chunkOccurrences.delete(o):this.chunkOccurrences.set(o,r)}}}}computeSimilarityScore(i,e,t){let o=0;for(let[n,r]of Object.entries(e)){let s=i.tf.get(n);if(!s)continue;let l=t.get(n);typeof l!="number"&&(l=this.computeIdf(n),t.set(n,l));let c=s*l;o+=c*r}return o}computeEmbedding(i){let e=a.termFrequencies(i);return this.computeTfidf(e)}computeIdf(i){let e=this.chunkOccurrences.get(i)??0;return e>0?Math.log((this.chunkCount+1)/e):0}computeTfidf(i){let e=Object.create(null);for(let[t,o]of i){let n=this.computeIdf(t);n>0&&(e[t]=o*n)}return e}};function eIo(a){let i=a.slice(0);i.sort((t,o)=>o.score-t.score);let e=i[0]?.score??0;if(e>0)for(let t of i)t.score/=e;return i}var vnt=class extends k{constructor(e,t){super();this.instantiationService=e;this.configurationService=t}getLocalSearchProvider(e){return this.instantiationService.createInstance(bnt,e)}get remoteSearchAllowed(){return this.configurationService.getValue().workbench.settings.enableNaturalLanguageSearch}getRemoteSearchProvider(e){if(this.remoteSearchAllowed)return this._remoteSearchProvider??=this.instantiationService.createInstance(ZRi),this._remoteSearchProvider.setFilter(e),this._remoteSearchProvider}getAiSearchProvider(e){if(this.remoteSearchAllowed)return this._aiSearchProvider??=this.instantiationService.createInstance(Snt),this._aiSearchProvider.setFilter(e),this._aiSearchProvider}};vnt=I([m(0,F),m(1,B)],vnt);function eLi(a){return a.replace(/[":]/g," ").replace(/  /g," ").trim()}var bnt=class{constructor(i,e){this._filter=i;this.configurationService=e;this._filter=eLi(this._filter)}searchModel(i,e){if(!this._filter)return Promise.resolve(null);let t=l=>{let{matches:c,matchType:u,keyMatchScore:p}=new YRi(this._filter,l,!0,this.configurationService);return u===0||c.length===0?null:(xr(this._filter,l.key)&&(u=256),{matches:c,matchType:u,keyMatchScore:p,score:0})},o=i.filterSettings(this._filter,this.getGroupFilter(this._filter),t),n=Math.max(...o.map(l=>l.matchType&cpo)),r=9,s=o.filter(l=>l.matchType&n||l.matchType&r||l.matchType===256).map(l=>({...l,providerName:Gzt}));return Promise.resolve({filterMatches:s,exactMatch:s.some(l=>l.matchType===256)})}getGroupFilter(i){let e=Yj(i,!1,{global:!0});return t=>t.id!=="defaultOverrides"&&e.test(t.title)}};bnt=I([m(1,B)],bnt);var YRi=class{constructor(i,e,t,o){this.searchDescription=t;this.configurationService=o;this.matchType=0;this.keyMatchScore=0;this.matches=jo(this._findMatchesInSetting(i,e),n=>`${n.startLineNumber}_${n.startColumn}_${n.endLineNumber}_${n.endColumn}_`)}_findMatchesInSetting(i,e){return this._doFindMatchesInSetting(i,e)}_keyToLabel(i){return i.replace(/[-._]/g," ").replace(/([a-z]+)([A-Z])/g,"$1 $2").replace(/([A-Za-z]+)(\d+)/g,"$1 $2").replace(/(\d+)([A-Za-z]+)/g,"$1 $2").toLowerCase()}_toAlphaNumeric(i){return i.replace(/[^\p{L}\p{N}]+/gu,"")}_doFindMatchesInSetting(i,e){let t=new Map,o=new Map,n=new Map,r=this._keyToLabel(e.key),s=new Set(i.split(" "));for(let v of s){let b=Qw(v,r,!0);b?.length&&o.set(v,b.map(S=>this.toKeyRange(e,S)))}o.size===s.size?this.matchType|=128:o.size>=2&&(this.matchType|=32,this.keyMatchScore=o.size);let l=this._toAlphaNumeric(i),c=this._toAlphaNumeric(e.key),u=zF(l,c);if(u?.length&&(o.set(e.key,u.map(v=>this.toKeyRange(e,v))),this.matchType|=64),this.matchType===0){o.clear();for(let v of s){let b=Qw(v,r,!1);b?.length&&o.set(v,b.map(S=>this.toKeyRange(e,S)))}if(o.size>=2||o.size===1&&s.size===1)this.matchType|=16,this.keyMatchScore=o.size;else{let v=U8e(l,c);v?.length&&(o.set(e.key,v.map(b=>this.toKeyRange(e,b))),this.matchType|=4)}}if(e.overrides?.length&&this.matchType!==0)return this.matchType=1,[...o.size?Array.from(o.values()).flat():[]];let p=this.matchType>=32;if(this.searchDescription&&!p){let v=e.keywords?.length?[...e.description,e.keywords.join(" ")]:e.description;for(let b of s)for(let S=0;S<v.length;S++){let y=HX(b,v[S]);y?.length&&t.set(b,y.map(w=>this.toDescriptionRange(e,w,S)))}t.size===s.size?this.matchType|=8:t.clear()}if(!p)if(e.enum?.length){for(let v of e.enum)if(typeof v=="string"){n.clear();for(let b of s){let S=zF(b,v);S?.length&&n.set(b,S.map(y=>this.toValueRange(e,y)))}if(n.size===s.size){this.matchType|=8;break}else n.clear()}}else{let v=this.configurationService.getValue(e.key);if(typeof v=="string"){for(let b of s){let S=zF(b,v);S?.length&&n.set(b,S.map(y=>this.toValueRange(e,y)))}n.size===s.size?this.matchType|=8:n.clear()}}let h=t.size?Array.from(t.values()).flat():[],g=o.size?Array.from(o.values()).flat():[],f=n.size?Array.from(n.values()).flat():[];return[...h,...g,...f]}toKeyRange(i,e){return{startLineNumber:i.keyRange.startLineNumber,startColumn:i.keyRange.startColumn+e.start,endLineNumber:i.keyRange.startLineNumber,endColumn:i.keyRange.startColumn+e.end}}toDescriptionRange(i,e,t){let o=i.descriptionRanges[t];return o?{startLineNumber:o.startLineNumber,startColumn:o.startColumn+e.start,endLineNumber:o.endLineNumber,endColumn:o.startColumn+e.end}:wf}toValueRange(i,e){return{startLineNumber:i.valueRange.startLineNumber,startColumn:i.valueRange.startColumn+e.start+1,endLineNumber:i.valueRange.startLineNumber,endColumn:i.valueRange.startColumn+e.end+1}}},SKt=class{constructor(){this._settingsRecord={}}updateModel(i){i!==this._currentPreferencesModel&&(this._currentPreferencesModel=i,this.refresh())}refresh(){if(this._settingsRecord={},!!this._currentPreferencesModel){for(let i of this._currentPreferencesModel.settingsGroups)if(i.id!=="mostCommonlyUsed")for(let e of i.sections)for(let t of e.settings)this._settingsRecord[t.key]=t}}getSettingsRecord(){return this._settingsRecord}},XRi=class a{constructor(i){this._aiSettingsSearchService=i;this._filter="";this._recordProvider=new SKt}static{this.EMBEDDINGS_SETTINGS_SEARCH_MAX_PICKS=10}setFilter(i){this._filter=eLi(i)}async searchModel(i,e){return!this._filter||!this._aiSettingsSearchService.isEnabled()?null:(this._recordProvider.updateModel(i),this._aiSettingsSearchService.startSearch(this._filter,e),{filterMatches:await this.getEmbeddingsItems(e),exactMatch:!1})}async getEmbeddingsItems(i){let e=this._recordProvider.getSettingsRecord(),t=[],o=await this._aiSettingsSearchService.getEmbeddingsResults(this._filter,i);if(!o)return[];let n=$zt;for(let r of o){if(t.length===a.EMBEDDINGS_SETTINGS_SEARCH_MAX_PICKS)break;t.push({setting:e[r],matches:[e[r].range],matchType:2,keyMatchScore:0,score:0,providerName:n})}return t}},JRi=class a{constructor(){this._filter="";this._documents=[];this._settingsRecord={}}static{this.TF_IDF_PRE_NORMALIZE_THRESHOLD=50}static{this.TF_IDF_POST_NORMALIZE_THRESHOLD=.7}static{this.TF_IDF_MAX_PICKS=5}setFilter(i){this._filter=eLi(i)}keyToLabel(i){return i.replace(/[-._]/g," ").replace(/([a-z]+)([A-Z])/g,"$1 $2").replace(/([A-Za-z]+)(\d+)/g,"$1 $2").replace(/(\d+)([A-Za-z]+)/g,"$1 $2").toLowerCase()}settingItemToEmbeddingString(i){let e=`Setting Id: ${i.key}
`;return e+=`Label: ${this.keyToLabel(i.key)}
`,e+=`Description: ${i.description}
`,e}async searchModel(i,e){if(!this._filter)return null;if(this._currentPreferencesModel!==i){this._currentPreferencesModel=i,this._documents=[],this._settingsRecord={};for(let t of i.settingsGroups)if(t.id!=="mostCommonlyUsed")for(let o of t.sections)for(let n of o.settings)this._documents.push({key:n.key,textChunks:[this.settingItemToEmbeddingString(n)]}),this._settingsRecord[n.key]=n}return{filterMatches:await this.getTfIdfItems(e),exactMatch:!1}}async getTfIdfItems(i){let e=[],t=new CNe;t.updateDocuments(this._documents);let o=t.calculateScores(this._filter,i);o.sort((r,s)=>s.score-r.score);let n=o[0].score;if(n<a.TF_IDF_PRE_NORMALIZE_THRESHOLD)return[];for(let r of o){if(r.score/n<a.TF_IDF_POST_NORMALIZE_THRESHOLD||e.length===a.TF_IDF_MAX_PICKS)break;let s=r.key;e.push({setting:this._settingsRecord[s],matches:[this._settingsRecord[s].range],matchType:2,keyMatchScore:0,score:r.score,providerName:qzt})}return e}},ZRi=class{constructor(){this._filter="";this._tfIdfSearchProvider=new JRi}setFilter(i){this._filter=i,this._tfIdfSearchProvider.setFilter(i)}async searchModel(i,e){return this._filter?await this._tfIdfSearchProvider.searchModel(i,e):null}},Snt=class{constructor(i){this.aiSettingsSearchService=i;this._filter="";this._embeddingsSearchProvider=new XRi(this.aiSettingsSearchService),this._recordProvider=new SKt}setFilter(i){this._filter=i,this._embeddingsSearchProvider.setFilter(i)}async searchModel(i,e){return!this._filter||!this.aiSettingsSearchService.isEnabled()?null:(this._recordProvider.updateModel(i),await this._embeddingsSearchProvider.searchModel(i,e))}async getLLMRankedResults(i){return!this._filter||!this.aiSettingsSearchService.isEnabled()?null:{filterMatches:await this.getLLMRankedItems(i),exactMatch:!1}}async getLLMRankedItems(i){let e=this._recordProvider.getSettingsRecord(),t=[],o=await this.aiSettingsSearchService.getLLMRankedResults(this._filter,i);if(!o)return[];for(let n of o)e[n]&&t.push({setting:e[n],matches:[e[n].range],matchType:2,keyMatchScore:0,score:0,providerName:jzt});return t}};Snt=I([m(0,SRe)],Snt);Ce(Ezt,vnt,1);var tLi=class{constructor(i,e){this.key=i;this.data=e;this.incoming=new Map;this.outgoing=new Map}},Int=class{constructor(i){this._hashFn=i;this._nodes=new Map}roots(){let i=[];for(let e of this._nodes.values())e.outgoing.size===0&&i.push(e);return i}insertEdge(i,e){let t=this.lookupOrInsertNode(i),o=this.lookupOrInsertNode(e);t.outgoing.set(o.key,o),o.incoming.set(t.key,t)}removeNode(i){let e=this._hashFn(i);this._nodes.delete(e);for(let t of this._nodes.values())t.outgoing.delete(e),t.incoming.delete(e)}lookupOrInsertNode(i){let e=this._hashFn(i),t=this._nodes.get(e);return t||(t=new tLi(e,i),this._nodes.set(e,t)),t}lookup(i){return this._nodes.get(this._hashFn(i))}isEmpty(){return this._nodes.size===0}toString(){let i=[];for(let[e,t]of this._nodes)i.push(`${e}
	(-> incoming)[${[...t.incoming.keys()].join(", ")}]
	(outgoing ->)[${[...t.outgoing.keys()].join(",")}]
`);return i.join(`
`)}findCycleSlow(){for(let[i,e]of this._nodes){let t=new Set([i]),o=this._findCycle(e,t);if(o)return o}}_findCycle(i,e){for(let[t,o]of i.outgoing){if(e.has(t))return[...e,t].join(" -> ");e.add(t);let n=this._findCycle(o,e);if(n)return n;e.delete(t)}}};var qsn=!1,IKt=class extends Error{constructor(i){super("cyclic dependency between services"),this.message=i.findCycleSlow()??`UNABLE to detect cycle, dumping graph: 
${i.toString()}`}},xNe=class a{constructor(i=new Po,e=!1,t,o=qsn){this._services=i;this._strict=e;this._parent=t;this._enableTracing=o;this._isDisposed=!1;this._servicesToMaybeDispose=new Set;this._children=new Set;this._activeInstantiations=new Set;this._services.set(F,this),this._globalGraph=o?t?._globalGraph??new Int(n=>n):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,je(this._children),this._children.clear();for(let i of this._servicesToMaybeDispose)Sd(i)&&i.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(i,e){this._throwIfDisposed();let t=this,o=new class extends a{dispose(){t._children.delete(o),super.dispose()}}(i,this._strict,this,this._enableTracing);return this._children.add(o),e?.add(o),o}invokeFunction(i,...e){this._throwIfDisposed();let t=Nie.traceInvocation(this._enableTracing,i),o=!1;try{return i({get:r=>{if(o)throw Nye("service accessor is only valid during the invocation of its target method");let s=this._getOrCreateServiceInstance(r,t);return s||this._throwIfStrict(`[invokeFunction] unknown service '${r}'`,!1),s}},...e)}finally{o=!0,t.stop()}}createInstance(i,...e){this._throwIfDisposed();let t,o;return i instanceof Vt?(t=Nie.traceCreation(this._enableTracing,i.ctor),o=this._createInstance(i.ctor,i.staticArguments.concat(e),t)):(t=Nie.traceCreation(this._enableTracing,i),o=this._createInstance(i,e,t)),t.stop(),o}_createInstance(i,e=[],t){let o=wB.getServiceDependencies(i).sort((s,l)=>s.index-l.index),n=[];for(let s of o){let l=this._getOrCreateServiceInstance(s.id,t);l||this._throwIfStrict(`[createInstance] ${i.name} depends on UNKNOWN service ${s.id}.`,!1),n.push(l)}let r=o.length>0?o[0].index:e.length;if(e.length!==r){console.trace(`[createInstance] First service dependency of ${i.name} at position ${r+1} conflicts with ${e.length} static arguments`);let s=r-e.length;s>0?e=e.concat(new Array(s)):e=e.slice(0,r)}return Reflect.construct(i,e.concat(n))}_setCreatedServiceInstance(i,e){if(this._services.get(i)instanceof Vt)this._services.set(i,e);else if(this._parent)this._parent._setCreatedServiceInstance(i,e);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(i){let e=this._services.get(i);return!e&&this._parent?this._parent._getServiceInstanceOrDescriptor(i):e}_getOrCreateServiceInstance(i,e){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(i));let t=this._getServiceInstanceOrDescriptor(i);return t instanceof Vt?this._safeCreateAndCacheServiceInstance(i,t,e.branch(i,!0)):(e.branch(i,!1),t)}_safeCreateAndCacheServiceInstance(i,e,t){if(this._activeInstantiations.has(i))throw new Error(`illegal state - RECURSIVELY instantiating service '${i}'`);this._activeInstantiations.add(i);try{return this._createAndCacheServiceInstance(i,e,t)}finally{this._activeInstantiations.delete(i)}}_createAndCacheServiceInstance(i,e,t){let o=new Int(l=>l.id.toString()),n=0,r=[{id:i,desc:e,_trace:t}],s=new Set;for(;r.length;){let l=r.pop();if(!s.has(String(l.id))){if(s.add(String(l.id)),o.lookupOrInsertNode(l),n++>1e3)throw new IKt(o);for(let c of wB.getServiceDependencies(l.desc.ctor)){let u=this._getServiceInstanceOrDescriptor(c.id);if(u||this._throwIfStrict(`[createInstance] ${i} depends on ${c.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(l.id),String(c.id)),u instanceof Vt){let p={id:c.id,desc:u,_trace:l._trace.branch(c.id,!0)};o.insertEdge(l,p),r.push(p)}}}}for(;;){let l=o.roots();if(l.length===0){if(!o.isEmpty())throw new IKt(o);break}for(let{data:c}of l){if(this._getServiceInstanceOrDescriptor(c.id)instanceof Vt){let p=this._createServiceInstanceWithOwner(c.id,c.desc.ctor,c.desc.staticArguments,c.desc.supportsDelayedInstantiation,c._trace);this._setCreatedServiceInstance(c.id,p)}o.removeNode(c)}}return this._getServiceInstanceOrDescriptor(i)}_createServiceInstanceWithOwner(i,e,t=[],o,n){if(this._services.get(i)instanceof Vt)return this._createServiceInstance(i,e,t,o,n,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(i,e,t,o,n);throw new Error(`illegalState - creating UNKNOWN service instance ${e.name}`)}_createServiceInstance(i,e,t=[],o,n,r){if(o){let s=new a(void 0,this._strict,this,this._enableTracing);s._globalGraphImplicitDependency=String(i);let l=new Map,c=new i5(()=>{let u=s._createInstance(e,t,n);for(let[p,h]of l){let g=u[p];if(typeof g=="function")for(let f of h)f.disposable=g.apply(u,f.listener)}return l.clear(),r.add(u),u});return new Proxy(Object.create(null),{get(u,p){if(!c.isInitialized&&typeof p=="string"&&(p.startsWith("onDid")||p.startsWith("onWill"))){let f=l.get(p);return f||(f=new ra,l.set(p,f)),(b,S,y)=>{if(c.isInitialized)return c.value[p](b,S,y);{let w={listener:[b,S,y],disposable:void 0},x=f.push(w);return ee(()=>{x(),w.disposable?.dispose()})}}}if(p in u)return u[p];let h=c.value,g=h[p];return typeof g!="function"||(g=g.bind(h),u[p]=g),g},set(u,p,h){return c.value[p]=h,!0},getPrototypeOf(u){return e.prototype}})}else{let s=this._createInstance(e,t,n);return r.add(s),s}}_throwIfStrict(i,e){if(e&&console.warn(i),this._strict)throw new Error(i)}};var Nie=class a{constructor(i,e){this.type=i;this.name=e;this._start=Date.now();this._dep=[]}static{this.all=new Set}static{this._None=new class extends a{constructor(){super(0,null)}stop(){}branch(){return this}}}static traceInvocation(i,e){return i?new a(2,e.name||new Error().stack.split(`
`).slice(3,4).join(`
`)):a._None}static traceCreation(i,e){return i?new a(1,e.name):a._None}static{this._totals=0}branch(i,e){let t=new a(3,i.toString());return this._dep.push([i,e,t]),t}stop(){let i=Date.now()-this._start;a._totals+=i;let e=!1;function t(n,r){let s=[],l=new Array(n+1).join("	");for(let[c,u,p]of r._dep)if(u&&p){e=!0,s.push(`${l}CREATES -> ${c}`);let h=t(n+1,p);h&&s.push(h)}else s.push(`${l}uses -> ${c}`);return s.join(`
`)}let o=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${t(1,this)}`,`DONE, took ${i.toFixed(2)}ms (grand total ${a._totals.toFixed(2)}ms)`];(i>2||e)&&a.all.add(o.join(`
`))}};var kNe=class extends k{constructor(e,t){super();this._configurationService=e;this._telemetryService=t;let o=hr("telemetry.performance.inputLatencySamplingProbability",0,this._configurationService),n=Math.random(),r=ke(l=>n<o.read(l)),s=soi(ke(l=>({sampleCount:hx.sampleCount.read(l),shouldReport:r.read(l)})),6e4);this._register(ve(l=>{let{shouldReport:c}=s.read(l),u=hx.getAndClearMeasurements();u&&c&&this._logSamples(u)}))}_logSamples(e){let t=performance.memory,o=t?.usedJSHeapSize??-1,n=t?.jsHeapSizeLimit??-1,r=o>=0&&n>0?Math.round(o/n*100):-1;this._telemetryService.publicLog2("performance.inputLatency",{keydown:e.keydown,input:e.input,render:e.render,total:e.total,sampleCount:e.sampleCount,gpuAcceleration:this._configurationService.getValue("editor.experimentalGpuAcceleration")==="on",usedJSHeapSize:o,jsHeapSizeLimit:n,jsHeapUsagePercentage:r})}};kNe=I([m(0,B),m(1,_e)],kNe);var tIo="transientWordWrapState",oLi="isWordWrapMinified",nLi="isDominatedByLongLines",iIo=new Y("canToggleWordWrap",!1,!0),oIo=new Y("editorWordWrap",!1,d(10154,null));function XN(a,i,e){e.setTransientModelProperty(a,tIo,i)}function Oie(a,i){return i.getTransientModelProperty(a,tIo)}var yKt="editor.action.toggleWordWrap",iLi=class extends Mi{constructor(){super({id:yKt,label:P(10156,"View: Toggle Word Wrap"),precondition:void 0,kbOpts:{kbExpr:null,primary:568,weight:100}})}run(i,e){let t=i.get(Qt),o=i.get(F);if(!DNe(t,e))return;let n=e.getModel(),r=Oie(n,t),s;r?s=null:s={wordWrapOverride:e.getOption(166).wrappingColumn===-1?"on":"off"},XN(n,s,t);let l=o.invokeFunction($kt,e);if(l){let c=l.getOriginalEditor(),u=l.getModifiedEditor(),p=c===e?u:c;DNe(t,p)&&(XN(p.getModel(),s,t),l.updateOptions({}))}}},ENe=class extends k{constructor(e,t,o){super();this._editor=e;this._contextKeyService=t;this._codeEditorService=o;let r=this._editor.getOptions().get(166),s=this._contextKeyService.createKey(oLi,r.isWordWrapMinified),l=this._contextKeyService.createKey(nLi,r.isDominatedByLongLines),c=!1;this._register(e.onDidChangeConfiguration(p=>{if(!p.hasChanged(166))return;let g=this._editor.getOptions().get(166);s.set(g.isWordWrapMinified),l.set(g.isDominatedByLongLines),c||u()})),this._register(e.onDidChangeModel(p=>{u()})),this._register(o.onDidChangeTransientModelProperty(()=>{u()}));let u=()=>{if(!DNe(this._codeEditorService,this._editor))return;let p=Oie(this._editor.getModel(),this._codeEditorService);try{c=!0,this._applyWordWrapState(p)}finally{c=!1}}}static{this.ID="editor.contrib.toggleWordWrapController"}_applyWordWrapState(e){let t=e?e.wordWrapOverride:"inherit";this._editor.updateOptions({wordWrapOverride2:t})}};ENe=I([m(1,X),m(2,Qt)],ENe);var TNe=class extends k{constructor(e,t){super();this._diffEditor=e;this._codeEditorService=t;this._register(this._diffEditor.onDidChangeModel(()=>{this._ensureSyncedWordWrapToggle()}))}static{this.ID="diffeditor.contrib.toggleWordWrapController"}_ensureSyncedWordWrapToggle(){let e=this._diffEditor.getOriginalEditor(),t=this._diffEditor.getModifiedEditor();if(!e.hasModel()||!t.hasModel())return;let o=Oie(e.getModel(),this._codeEditorService),n=Oie(t.getModel(),this._codeEditorService);o&&!n&&DNe(this._codeEditorService,e)&&(XN(t.getModel(),o,this._codeEditorService),this._diffEditor.updateOptions({})),!o&&n&&DNe(this._codeEditorService,t)&&(XN(e.getModel(),n,this._codeEditorService),this._diffEditor.updateOptions({}))}};TNe=I([m(1,Qt)],TNe);function DNe(a,i){if(!i||i.isSimpleWidget||!i.getModel())return!1;if(i.getOption(70)){for(let t of a.listDiffEditors())if(t.getOriginalEditor()===i&&!t.renderSideBySide)return!1}return!0}var _Ne=class extends k{constructor(e,t,o){super();this._editorService=e;this._codeEditorService=t;this._contextService=o;this._register(U.runAndSubscribe(Of,({window:n,disposables:r})=>{r.add($(n,"focus",()=>this._update(),!0)),r.add($(n,"blur",()=>this._update(),!0))},{window:ut,disposables:this._store})),this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._canToggleWordWrap=iIo.bindTo(this._contextService),this._editorWordWrap=oIo.bindTo(this._contextService),this._activeEditor=null,this._activeEditorListener=this._register(new O),this._update()}static{this.ID="workbench.contrib.editorWordWrapContextKeyTracker"}_update(){let e=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();this._activeEditor!==e&&(this._activeEditorListener.clear(),this._activeEditor=e,e&&(this._activeEditorListener.add(e.onDidChangeModel(()=>this._updateFromCodeEditor())),this._activeEditorListener.add(e.onDidChangeConfiguration(t=>{t.hasChanged(166)&&this._updateFromCodeEditor()})),this._updateFromCodeEditor()))}_updateFromCodeEditor(){if(DNe(this._codeEditorService,this._activeEditor)){let e=this._activeEditor.getOption(166);this._setValues(!0,e.wrappingColumn!==-1)}else return this._setValues(!1,!1)}_setValues(e,t){this._canToggleWordWrap.set(e),this._editorWordWrap.set(t)}};_Ne=I([m(0,ie),m(1,Qt),m(2,X)],_Ne);bt(_Ne.ID,_Ne,vt.AfterRestored);Eo(ENe.ID,ENe,0);aSt(TNe.ID,TNe);ri(iLi);be.appendMenuItem(R.EditorTitle,{command:{id:yKt,title:d(10157,null),icon:L.wordWrap},group:"navigation",order:1,when:C.and(C.has(nLi),C.has(oLi))});be.appendMenuItem(R.EditorTitle,{command:{id:yKt,title:d(10158,null),icon:L.wordWrap},group:"navigation",order:1,when:C.and(me.inDiffEditor.negate(),C.has(nLi),C.not(oLi))});be.appendMenuItem(R.MenubarViewMenu,{command:{id:yKt,title:d(10155,null),toggled:oIo,precondition:iIo},order:1,group:"6_editor"});var JN=class{constructor(i,e){this._instaService=i;this._inputUri=A.from({scheme:"perf",path:"Startup Performance"});this._registration=e.registerTextModelContentProvider("perf",i.createInstance(ynt))}static get(){return ERt(JN.ID)}static{this.ID="workbench.contrib.perfview"}dispose(){this._registration.dispose()}getInputUri(){return this._inputUri}getEditorInput(){return this._instaService.createInstance(bq)}};JN=I([m(0,F),m(1,Bt)],JN);var bq=class extends Vx{static{this.Id="PerfviewInput"}get typeId(){return bq.Id}constructor(i,e,t,o,n,r,s,l){super(JN.get().getInputUri(),d(14103,null),void 0,void 0,void 0,i,e,t,o,n,r,s,l)}};bq=I([m(0,Bt),m(1,Uo),m(2,ie),m(3,ge),m(4,nt),m(5,fr),m(6,Gn),m(7,nb)],bq);var ynt=class{constructor(i,e,t,o,n,r,s,l,c){this._modelService=i;this._languageService=e;this._editorService=t;this._lifecycleService=o;this._timerService=n;this._extensionService=r;this._productService=s;this._remoteAgentService=l;this._terminalService=c;this._modelDisposables=[]}provideTextContent(i){if(!this._model||this._model.isDisposed()){je(this._modelDisposables);let e=this._languageService.createById("markdown");this._model=this._modelService.getModel(i)||this._modelService.createModel("Loading...",e,i),this._modelDisposables.push(e.onDidChange(t=>{this._model?.setLanguage(t)})),this._modelDisposables.push(this._extensionService.onDidChangeExtensionsStatus(this._updateModel,this)),XN(this._model,{wordWrapOverride:"off"},this._editorService)}return this._updateModel(),Promise.resolve(this._model)}_updateModel(){Promise.all([this._timerService.whenReady(),this._lifecycleService.when(4),this._extensionService.whenInstalledExtensionsRegistered(),Ft&&!this._remoteAgentService.getConnection()?.remoteAuthority?Promise.resolve():this._terminalService.whenConnected]).then(()=>{if(this._model&&!this._model.isDisposed()){let i=new rLi;this._addSummary(i),i.blank(),this._addSummaryTable(i),i.blank(),this._addExtensionsTable(i),i.blank(),this._addPerfMarksTable("Terminal Stats",i,this._timerService.getPerformanceMarks().find(e=>e[0]==="renderer")?.[1].filter(e=>e.name.startsWith("code/terminal/"))),i.blank(),this._addWorkbenchContributionsPerfMarksTable(i),i.blank(),this._addRawPerfMarks(i),i.blank(),this._addResourceTimingStats(i),this._model.setValue(i.value)}})}_addSummary(i){let e=this._timerService.startupMetrics;i.heading(2,"System Info"),i.li(`${this._productService.nameShort}: ${this._productService.version} (${this._productService.commit||"0000000"})`),i.li(`OS: ${e.platform}(${e.release})`),e.cpus&&i.li(`CPUs: ${e.cpus.model}(${e.cpus.count} x ${e.cpus.speed})`),typeof e.totalmem=="number"&&typeof e.freemem=="number"&&i.li(`Memory(System): ${(e.totalmem/Ml.GB).toFixed(2)} GB(${(e.freemem/Ml.GB).toFixed(2)}GB free)`),e.meminfo&&i.li(`Memory(Process): ${(e.meminfo.workingSetSize/Ml.KB).toFixed(2)} MB working set(${(e.meminfo.privateBytes/Ml.KB).toFixed(2)}MB private, ${(e.meminfo.sharedBytes/Ml.KB).toFixed(2)}MB shared)`),i.li(`VM(likelihood): ${e.isVMLikelyhood}%`),i.li(`Initial Startup: ${e.initialStartup}`),i.li(`Has ${e.windowCount-1} other windows`),i.li(`Screen Reader Active: ${e.hasAccessibilitySupport}`),i.li(`Empty Workspace: ${e.emptyWorkbench}`)}_addSummaryTable(i){let e=this._timerService.startupMetrics,t=oe.as(Zi.Workbench).timings,o=[];o.push(["import(main.js)",e.timers.ellapsedLoadMainBundle,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["start => app.isReady",e.timers.ellapsedAppReady,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["nls:start => nls:end",e.timers.ellapsedNlsGeneration,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["run main.js",e.timers.ellapsedRunMainBundle,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["start crash reporter",e.timers.ellapsedCrashReporter,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["serve main IPC handle",e.timers.ellapsedMainServer,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["create window",e.timers.ellapsedWindowCreate,"[main]",`initial startup: ${e.initialStartup}, ${e.initialStartup?`state: ${e.timers.ellapsedWindowRestoreState}ms, widget: ${e.timers.ellapsedBrowserWindowCreate}ms, show: ${e.timers.ellapsedWindowMaximize}ms`:""}`]),o.push(["app.isReady => window.loadUrl()",e.timers.ellapsedWindowLoad,"[main]",`initial startup: ${e.initialStartup}`]),o.push(["window.loadUrl() => begin to import(workbench.desktop.main.js)",e.timers.ellapsedWindowLoadToRequire,"[main->renderer]",xRt(e.windowKind)]),o.push(["import(workbench.desktop.main.js)",e.timers.ellapsedRequire,"[renderer]",`cached data: ${e.didUseCachedData?"YES":"NO"}`]),o.push(["wait for window config",e.timers.ellapsedWaitForWindowConfig,"[renderer]",void 0]),o.push(["init storage (global & workspace)",e.timers.ellapsedStorageInit,"[renderer]",void 0]),o.push(["init workspace service",e.timers.ellapsedWorkspaceServiceInit,"[renderer]",void 0]),Ft&&(o.push(["init settings and global state from settings sync service",e.timers.ellapsedRequiredUserDataInit,"[renderer]",void 0]),o.push(["init keybindings, snippets & extensions from settings sync service",e.timers.ellapsedOtherUserDataInit,"[renderer]",void 0])),o.push(["register extensions & spawn extension host",e.timers.ellapsedExtensions,"[renderer]",void 0]),o.push(["restore primary viewlet",e.timers.ellapsedViewletRestore,"[renderer]",e.viewletId]),o.push(["restore secondary viewlet",e.timers.ellapsedAuxiliaryViewletRestore,"[renderer]",e.auxiliaryViewletId]),o.push(["restore panel",e.timers.ellapsedPanelRestore,"[renderer]",e.panelId]),o.push(["restore & resolve visible editors",e.timers.ellapsedEditorRestore,"[renderer]",`${e.editorIds.length}: ${e.editorIds.join(", ")}`]),o.push(["create workbench contributions",e.timers.ellapsedWorkbenchContributions,"[renderer]",`${(t.get(1)?.length??0)+(t.get(2)?.length??0)} blocking startup`]),o.push(["overall workbench load",e.timers.ellapsedWorkbench,"[renderer]",void 0]),o.push(["workbench ready",e.ellapsed,"[main->renderer]",void 0]),o.push(["renderer ready",e.timers.ellapsedRenderer,"[renderer]",void 0]),o.push(["shared process connection ready",e.timers.ellapsedSharedProcesConnected,"[renderer->sharedprocess]",void 0]),o.push(["extensions registered",e.timers.ellapsedExtensionsReady,"[renderer]",void 0]),i.heading(2,"Performance Marks"),i.table(["What","Duration","Process","Info"],o)}_addExtensionsTable(i){let e=[],t=[],o=this._extensionService.getExtensionsStatus();for(let r in o){let{activationTimes:s}=o[r];s&&(s.activationReason.startup?e.push([r,s.activationReason.startup,s.codeLoadingTime,s.activateCallTime,s.activateResolvedTime,s.activationReason.activationEvent,s.activationReason.extensionId.value]):t.push([r,s.activationReason.startup,s.codeLoadingTime,s.activateCallTime,s.activateResolvedTime,s.activationReason.activationEvent,s.activationReason.extensionId.value]))}let n=e.concat(t);n.length>0&&(i.heading(2,"Extension Activation Stats"),i.table(["Extension","Eager","Load Code","Call Activate","Finish Activate","Event","By"],n))}_addPerfMarksTable(i,e,t){if(!t)return;let o=[],n=-1,r=0;for(let{name:s,startTime:l}of t){let c=n!==-1?l-n:0;r+=c,o.push([s,Math.round(l),Math.round(c),Math.round(r)]),n=l}i&&e.heading(2,i),e.table(["Name","Timestamp","Delta","Total"],o)}_addWorkbenchContributionsPerfMarksTable(i){i.heading(2,"Workbench Contributions Blocking Restore");let e=oe.as(Zi.Workbench).timings;i.li(`Total (LifecyclePhase.Starting): ${e.get(1)?.length} (${e.get(1)?.reduce((o,n)=>o+n[1],0)}ms)`),i.li(`Total (LifecyclePhase.Ready): ${e.get(2)?.length} (${e.get(2)?.reduce((o,n)=>o+n[1],0)}ms)`),i.blank();let t=this._timerService.getPerformanceMarks().find(o=>o[0]==="renderer")?.[1].filter(o=>o.name.startsWith("code/willCreateWorkbenchContribution/1")||o.name.startsWith("code/didCreateWorkbenchContribution/1")||o.name.startsWith("code/willCreateWorkbenchContribution/2")||o.name.startsWith("code/didCreateWorkbenchContribution/2"));this._addPerfMarksTable(void 0,i,t)}_addRawPerfMarks(i){for(let[e,t]of this._timerService.getPerformanceMarks()){i.heading(2,`Raw Perf Marks: ${e}`),i.value+="```\n",i.value+=`Name	Timestamp	Delta	Total
`;let o=-1,n=0;for(let{name:r,startTime:s}of t){let l=o!==-1?s-o:0;n+=l,i.value+=`${r}	${s}	${l}	${n}
`,o=s}i.value+="```\n"}}_addResourceTimingStats(i){let e=performance.getEntriesByType("resource").map(t=>[t.name,t.duration]);e.length&&(i.heading(2,"Resource Timing Stats"),i.table(["Name","Duration"],e))}};ynt=I([m(0,_t),m(1,Rt),m(2,Qt),m(3,to),m(4,Kx),m(5,lt),m(6,Ze),m(7,bo),m(8,an)],ynt);var rLi=class{constructor(){this.value=""}heading(i,e){return this.value+=`${"#".repeat(i)} ${e}

`,this}blank(){return this.value+=`
`,this}li(i){return this.value+=`* ${i}
`,this}table(i,e){this.value+=this.toMarkdownTable(i,e)}toMarkdownTable(i,e){let t="",o=[];return i.forEach((n,r)=>{o[r]=n.length}),e.forEach(n=>{n.forEach((r,s)=>{typeof r>"u"&&(r=n[s]="-");let l=r.toString().length;o[s]=Math.max(l,o[s])})}),i.forEach((n,r)=>{t+=`| ${n+" ".repeat(o[r]-n.toString().length)} `}),t+=`|
`,i.forEach((n,r)=>{t+=`| ${"-".repeat(o[r])} `}),t+=`|
`,e.forEach(n=>{n.forEach((r,s)=>{typeof r<"u"&&(t+=`| ${r+" ".repeat(o[s]-r.toString().length)} `)}),t+=`|
`}),t}};bt(JN.ID,JN,{lazy:!0});oe.as(en.EditorFactory).registerEditorSerializer(bq.Id,class{canSerialize(){return!0}serialize(){return""}deserialize(a){return a.createInstance(bq)}});W(class extends z{constructor(){super({id:"perfview.show",title:P(14101,"Startup Performance"),category:Fe.Developer,f1:!0})}run(a){let i=a.get(ie),e=JN.get();return i.openEditor(e.getEditorInput(),{pinned:!0})}});W(class extends z{constructor(){super({id:"perf.insta.printAsyncCycles",title:P(14097,"Print Service Cycles"),category:Fe.Developer,f1:!0})}run(i){let e=i.get(F);if(e instanceof xNe){let t=e._globalGraph?.findCycleSlow();t?console.warn("CYCLE",t):console.warn("YEAH, no more cycles")}}});W(class extends z{constructor(){super({id:"perf.insta.printTraces",title:P(14099,"Print Service Traces"),category:Fe.Developer,f1:!0})}run(){if(Nie.all.size===0){console.log("Enable via `instantiationService.ts#_enableAllTracing`");return}for(let i of Nie.all)console.log(i)}});W(class extends z{constructor(){super({id:"perf.event.profiling",title:P(14098,"Print Emitter Profiles"),category:Fe.Developer,f1:!0})}run(){if(Yye.all.size===0){console.log("USE `EmitterOptions._profName` to enable profiling");return}for(let i of Yye.all)console.log(`${i.name}: ${i.invocationCount} invocations COST ${i.elapsedOverall}ms, ${i.listenerCount} listeners, avg cost is ${i.durations.reduce((e,t)=>e+t,0)/i.durations.length}ms`)}});oe.as(Zi.Workbench).registerWorkbenchContribution(kNe,4);oe.as($t.Configuration).registerConfiguration({id:"performance",order:101,title:d(14100,null),type:"object",properties:{"telemetry.performance.inputLatencySamplingProbability":{type:"number",default:0,minimum:0,maximum:1,tags:["experimental"],markdownDescription:d(14102,null),experiment:{mode:"auto"}}}});var RNe=class{static{this.Id="perf.disposableTracking"}constructor(i){!i.isBuilt&&!i.extensionTestsLocationURI&&Hye(new Evt)}};RNe=I([m(0,ko)],RNe);bt(RNe.Id,RNe,vt.Eventually);var nIo=new Y("userHasOpenedNotebook",!1),wKt=new Y("notebookFindWidgetFocused",!1),CKt=new Y("interactiveWindowOpen",!1),yQ=new Y("mostRecentReplEditor",void 0),nl=C.equals("activeEditor",_M),wnt=C.equals("activeEditor",nZ),sLi=C.equals("activeEditor",s_e),rIo=C.or(nl,wnt,sLi),aI=new Y("isCompositeNotebook",!1),wr=new Y("notebookEditorFocused",!1),Ap=new Y("notebookCellListFocused",!1),vP=new Y("notebookOutputFocused",!1),Fie=new Y("notebookOutputInputFocused",!1),cc=new Y("notebookEditable",!0),wQ=new Y("notebookHasRunningCell",!1),KU=new Y("notebookHasSomethingRunning",!1),Cnt=new Y("notebookUseConsolidatedOutputButton",!1),Yyu=new Y("notebookBreakpointMargin",!1),sIo=new Y("notebookCellToolbarLocation","left"),xnt=new Y("notebookCursorNavigationMode",!1),LNe=new Y("notebookLastCellFailed",!1),aIo=new Y("notebookType",void 0),lI=new Y("notebookCellType",void 0),OC=new Y("notebookCellEditable",!1),Vge=new Y("notebookCellFocused",!1),bP=new Y("notebookCellEditorFocused",!1),Wie=new Y("notebookCellMarkdownEditMode",!1),knt=new Y("notebookCellLineNumbers","inherit"),Bge=new Y("notebookCellExecutionState",void 0),xKt=new Y("notebookCellExecuting",!1),PE=new Y("notebookCellHasOutputs",!1),kKt=new Y("notebookCellIsFirstOutput",!1),EKt=new Y("hasHiddenOutputs",!1),MNe=new Y("notebookCellOutputMimeType",void 0),PNe=new Y("notebookCellInputIsCollapsed",!1),Ent=new Y("notebookCellOutputIsCollapsed",!1),lIo=new Y("notebookCellResource",""),Hge=new Y("notebookCellHasErrorDiagnostics",!1),aLi=new Y("notebookCellOutputMimeTypeListForChat",[]),ANe=new Y("notebookKernel",void 0),Vie=new Y("notebookKernelCount",0),NNe=new Y("notebookKernelSourceCount",0),cIo=new Y("notebookKernelSelected",!1),GU=new Y("notebookInterruptibleKernel",!1),TKt=new Y("notebookMissingKernelExtension",!1),_Kt=new Y("notebookHasOutputs",!1),ONe=new Y("kernelHasVariableProvider",!1);var D_="_notebook.selectKernel",Ph=P(13604,"Notebook"),YW="inline/cell",dIo="inline/output",ov=100,uIo=201;function Uge(a){let i=lr(a.activeEditorPane);if(!i||!i.hasModel())return;let e=i.getActiveCell(),t=i.getSelectionViewModels();return{cell:e,selectedCells:t,notebookEditor:i}}function $sn(a,i){let t=a.get(hd).listNotebookEditors().find(o=>o.hasModel()&&o.textModel.uri.toString()===i.toString());if(t&&t.hasModel())return t}function DKt(a,i){let e=A.revive(i);if(e){let t=$sn(a,e);if(t)return{notebookEditor:t}}}function Bie(a,i){let e;for(let[,t]of a.notebookEditor.codeEditors)if(ze(t.getModel()?.uri,i.uri)){e=t;break}return e}var Np=class extends z{constructor(i){if(i.f1!==!1){i.f1=!1;let e={id:R.CommandPalette,when:C.or(nl,wnt,sLi)};i.menu?Array.isArray(i.menu)||(i.menu=[i.menu]):i.menu=[],i.menu=[...i.menu,e]}i.category=Ph,super(i)}async run(i,e,...t){if(cLi(i,this.desc.id,e),!(!this.isNotebookActionContext(e)&&(e=this.getEditorContextFromArgsOrActive(i,e,...t),!e)))return this.runWithContext(i,e)}isNotebookActionContext(i){return!!i&&!!i.notebookEditor}getEditorContextFromArgsOrActive(i,e,...t){return Uge(i.get(ie))}},kf=class extends z{constructor(i){if(i.f1!==!1){i.f1=!1;let e={id:R.CommandPalette,when:nl};i.menu?Array.isArray(i.menu)||(i.menu=[i.menu]):i.menu=[],i.menu=[...i.menu,e]}i.category=Ph,super(i)}parseArgs(i,...e){}async run(i,...e){let t=e[0];if(cLi(i,this.desc.id,t),pIo(t))return this.runWithContext(i,t);let n=this.parseArgs(i,...e);if(n)return this.runWithContext(i,n);let r=FNe(i);if(r){let s=r.getSelections().length===0?[r.getFocus()]:r.getSelections();return this.runWithContext(i,{ui:!1,notebookEditor:r,selectedCells:fYe(r,s)})}}},iu=class extends Np{isCellActionContext(i){return!!i&&!!i.notebookEditor&&!!i.cell}getCellContextFromArgs(i,e,...t){}async run(i,e,...t){if(cLi(i,this.desc.id,e),this.isCellActionContext(e))return this.runWithContext(i,e);let o=this.getCellContextFromArgs(i,e,...t);if(o)return this.runWithContext(i,o);let n=this.getEditorContextFromArgsOrActive(i);if(this.isCellActionContext(n))return this.runWithContext(i,n)}},lLi=C.or(C.greater(Vie.key,0),C.greater(NNe.key,0));function cLi(a,i,e){if(e){let t=a.get(_e);if(e.source)t.publicLog2("workbenchActionExecuted",{id:i,from:e.source});else if(A.isUri(e))t.publicLog2("workbenchActionExecuted",{id:i,from:"cellEditorContextMenu"});else if(e&&"from"in e&&e.from==="cellContainer")t.publicLog2("workbenchActionExecuted",{id:i,from:"cellContainer"});else{let o=pIo(e)?"cellToolbar":Spe(e)?"editorToolbar":"other";t.publicLog2("workbenchActionExecuted",{id:i,from:o})}}}function pIo(a){return!!a&&!!a.notebookEditor&&a.$mid===13}function jsn(a){if(a===void 0)return!1;let i=a.ranges;return!(!i||!Array.isArray(i)||i.some(e=>!Wbi(e))||a.document&&!A.revive(a.document))}function FNe(a,i){let e=DKt(a,i)?.notebookEditor;if(e)return e;let t=lr(a.get(ie).activeEditorPane);if(!(!t||!t.hasModel()))return t}function Sq(a,...i){let e=i[0];if(jsn(e)){let o=FNe(a,e.document);if(!o)return;let r=e.ranges.map(l=>o.getCellsInRange(l).slice(0)).flat(),s=e.autoReveal;return{ui:!1,notebookEditor:o,selectedCells:r,autoReveal:s}}if(Wbi(e)){let o=i[1],n=FNe(a,o);return n?{ui:!1,notebookEditor:n,selectedCells:n.getCellsInRange(e)}:void 0}let t=Uge(a.get(ie));return t?{ui:!1,notebookEditor:t.notebookEditor,selectedCells:t.selectedCells??[],cell:t.cell}:void 0}var Tnt=[{isOptional:!0,name:"options",description:"The cell range options",schema:{type:"object",required:["ranges"],properties:{ranges:{type:"array",items:[{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}]},document:{type:"object",description:"The document uri"},autoReveal:{type:"boolean",description:"Whether the cell should be revealed into view automatically"}}}}];be.appendMenuItem(R.NotebookCellTitle,{submenu:R.NotebookCellInsert,title:d(13606,null),group:"2_insert",when:cc.isEqualTo(!0)});be.appendMenuItem(R.EditorContext,{submenu:R.NotebookCellTitle,title:d(13605,null),group:"2_insert",when:wr});be.appendMenuItem(R.NotebookCellTitle,{title:d(13603,null),submenu:R.EditorContextShare,group:"4_share"});var zge=Oe("notebook-kernel-select",L.serverEnvironment,d(13912,null)),Iq=Oe("notebook-execute",L.play,d(13899,null)),mIo=Oe("notebook-execute-above",L.runAbove,d(13896,null)),hIo=Oe("notebook-execute-below",L.runBelow,d(13898,null)),RKt=Oe("notebook-stop",L.primitiveSquare,d(13915,null)),gIo=Oe("notebook-delete-cell",L.trash,d(13893,null)),fIo=Oe("notebook-execute-all",L.runAll,d(13897,null)),vIo=Oe("notebook-edit",L.pencil,d(13894,null)),bIo=Oe("notebook-stop-edit",L.check,d(13914,null)),SIo=Oe("notebook-move-up",L.arrowUp,d(13904,null)),IIo=Oe("notebook-move-down",L.arrowDown,d(13903,null)),dLi=Oe("notebook-clear",L.clearAll,d(13890,null)),yIo=Oe("notebook-split-cell",L.splitVertical,d(13913,null)),LKt=Oe("notebook-state-success",L.check,d(13916,null)),WNe=Oe("notebook-state-error",L.error,d(13895,null)),MKt=Oe("notebook-state-pending",L.clock,d(13907,null)),FC=Oe("notebook-state-executing",L.sync,d(13900,null)),PKt=Oe("notebook-collapsed",L.chevronRight,d(13891,null)),AKt=Oe("notebook-expanded",L.chevronDown,d(13901,null)),wIo=Oe("notebook-open-as-text",L.fileCode,d(13906,null)),Hie=Oe("notebook-revert",L.discard,d(13910,null)),CIo=Oe("notebook-diff-cell-toggle-whitespace",L.whitespace,d(13917,null)),xIo=Oe("notebook-render-output",L.preview,d(13909,null)),NKt=Oe("notebook-mimetype",L.code,d(13902,null)),_nt=Oe("notebook-copy",L.copy,d(13892,null)),kIo=Oe("notebook-save",L.save,d(13911,null)),EIo=Oe("notebook-diff-editor-previous-change",L.arrowUp,d(13908,null)),TIo=Oe("notebook-diff-editor-next-change",L.arrowDown,d(13905,null)),OKt=Oe("variables-view-icon",L.variableGroup,d(13918,null));function Dnt(a){return"kernel"in a}function Qsn(a){return"kernels"in a}function FKt(a){return"action"in a}function DIo(a){return a.id==="installSuggested"&&"extensionIds"in a}function RIo(a){return a.id==="install"}function _Io(a){return"command"in a}function Ysn(a){return"autoRun"in a&&!!a.autoRun}var LIo=200;function uLi(a,i){let e={kernel:a,picked:a.id===i?.id,label:a.label,description:a.description,detail:a.detail};return a.id===i?.id&&(e.description?e.description=d(13964,null,e.description):e.description=d(13963,null)),e}var pLi=class{constructor(i,e,t,o,n,r,s,l,c){this._notebookKernelService=i;this._productService=e;this._quickInputService=t;this._labelService=o;this._logService=n;this._extensionWorkbenchService=r;this._extensionService=s;this._commandService=l;this._extensionManagementServerService=c}async showQuickPick(i,e,t){let o=i.textModel,n=i.scopedContextKeyService,r=this._getMatchingResult(o),{selected:s,all:l}=r,c;if(e){for(let S of l)if(S.id===e){c=S;break}if(!c)return this._logService.warn(`wanted kernel DOES NOT EXIST, wanted: ${e}, all: ${l.map(S=>S.id)}`),!1}if(c)return this._selecteKernel(o,c),!0;let u=new O,p=u.add(this._quickInputService.createQuickPick({useSeparators:!0})),h=this._getKernelPickerQuickPickItems(o,r,this._notebookKernelService,n);if(h.length===1&&Ysn(h[0])&&!t){let S=await this._handleQuickPick(i,h[0],h);return u.dispose(),S}p.items=h,p.canSelectMany=!1,p.placeholder=s?d(13969,null,this._labelService.getUriLabel(o.uri,{relative:!0})):d(13970,null,this._labelService.getUriLabel(o.uri,{relative:!0})),p.busy=this._notebookKernelService.getKernelDetectionTasks(o).length>0;let g=this._notebookKernelService.onDidChangeKernelDetectionTasks(()=>{p.busy=this._notebookKernelService.getKernelDetectionTasks(o).length>0}),f=h.length===0?Hn(S=>this._showInstallKernelExtensionRecommendation(o,p,this._extensionWorkbenchService,S)):void 0,v=U.debounce(U.any(this._notebookKernelService.onDidChangeSourceActions,this._notebookKernelService.onDidAddKernel,this._notebookKernelService.onDidRemoveKernel,this._notebookKernelService.onDidChangeNotebookAffinity),(S,y)=>S,LIo)(async()=>{p.busy=!1,f?.cancel();let S=p.activeItems,y=this._getMatchingResult(o),w=this._getKernelPickerQuickPickItems(o,y,this._notebookKernelService,n);p.keepScrollPosition=!0;let x=[];for(let E of S)if(Dnt(E)){let M=E.kernel.id,N=w.find(V=>Dnt(V)&&V.kernel.id===M);N&&x.push(N)}else if(FKt(E)){let M=w.find(N=>FKt(N)&&N.action.action.id===E.action.action.id);M&&x.push(M)}p.items=w,p.activeItems=x},this),b=await new Promise((S,y)=>{u.add(p.onDidAccept(()=>{let w=p.selectedItems[0];S(w?{selected:w,items:p.items}:{selected:void 0,items:p.items}),p.hide()})),u.add(p.onDidHide(()=>{g.dispose(),v.dispose(),p.dispose(),S({selected:void 0,items:p.items})})),p.show()});return u.dispose(),b.selected?await this._handleQuickPick(i,b.selected,b.items):!1}_getMatchingResult(i){return this._notebookKernelService.getMatchingKernel(i)}async _handleQuickPick(i,e,t){if(Dnt(e)){let o=e.kernel;return this._selecteKernel(i.textModel,o),!0}return RIo(e)?await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,i.textModel.viewType,[]):DIo(e)?await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,i.textModel.viewType,e.extensionIds,this._productService.quality!=="stable"):FKt(e)&&e.action.runAction(),!0}_selecteKernel(i,e){this._notebookKernelService.selectKernelForNotebook(e,i)}async _showKernelExtension(i,e,t,o,n,r){let s=[],l=[],c=[];for(let p of n){let h=(await i.getExtensions([{id:p}],Ie.None))[0];if(h.enablementState===10||h.enablementState===11||h.enablementState===2)c.push(h);else if(!i.installed.some(g=>Ht(g.identifier,h.identifier)))await i.canInstall(h)===!0&&s.push(h);else if(t.remoteExtensionManagementServer){if(i.installed.some(g=>Ht(g.identifier,h.identifier)&&g.server===t.remoteExtensionManagementServer))continue;await i.canInstall(h)&&l.push(h)}}if(s.length||c.length||l.length){await Promise.all([...s.map(async p=>{await i.install(p,{installPreReleaseVersion:r??!1,context:{skipWalkthrough:!0}},15)}),...c.map(async p=>{switch(p.enablementState){case 11:await i.setEnablement([p],13);return;case 10:await i.setEnablement([p],12);return;case 2:await i.setEnablement([p],3);return;default:break}}),...l.map(async p=>{await i.installInServer(p,this._extensionManagementServerService.remoteExtensionManagementServer)})]),await e.activateByEvent(`onNotebook:${o}`);return}let u=o.split(/[^a-z0-9]/ig).map(Ale).join("");await i.openSearch(`@tag:notebookKernel${u}`)}async _showInstallKernelExtensionRecommendation(i,e,t,o){e.busy=!0;let n=await this._getKernelRecommendationsQuickPickItems(i,t);e.busy=!1,!o.isCancellationRequested&&n&&e.items.length===0&&(e.items=n)}async _getKernelRecommendationsQuickPickItems(i,e){let t=[],o=this.getSuggestedLanguage(i),n=o?this.getSuggestedKernelFromLanguage(i.viewType,o):void 0;if(n){if(await e.queryLocal(),e.installed.filter(s=>(s.enablementState===3||s.enablementState===12||s.enablementState===13)&&n.extensionIds.includes(s.identifier.id)).length===n.extensionIds.length)return;t.push({id:"installSuggested",description:n.displayName??n.extensionIds.join(", "),label:`$(${L.lightbulb.id}) `+d(13965,null),extensionIds:n.extensionIds})}return t.push({id:"install",label:d(13971,null)}),t}getSuggestedLanguage(i){let o=i.metadata?.metadata?.language_info?.name;if(!o){let n=i.cells.map(r=>r.language).filter(r=>r!=="markdown");if(n.length>1){let r=n[0];n.every(s=>s===r)&&(o=r)}}return o}getSuggestedKernelFromLanguage(i,e){return OMt.get(i)?.get(e)}},xQ=class extends pLi{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,u,c);this._notebookKernelHistoryService=p;this._openerService=h}_getKernelPickerQuickPickItems(e,t,o,n){let r=[];if(t.selected){let l=uLi(t.selected,t.selected);r.push(l)}t.suggestions.filter(l=>l.id!==t.selected?.id).map(l=>uLi(l,t.selected)).forEach(l=>{r.push(l)});let s=r.length===0;return r.length>0&&r.push({type:"separator"}),r.push({id:"selectAnother",label:d(13974,null),autoRun:s}),r}_selecteKernel(e,t){let o=this._notebookKernelService.getMatchingKernel(e);o.selected&&this._notebookKernelHistoryService.addMostRecentKernel(o.selected),super._selecteKernel(e,t),this._notebookKernelHistoryService.addMostRecentKernel(t)}_getMatchingResult(e){let{selected:t,all:o}=this._notebookKernelHistoryService.getKernels(e),n=this._notebookKernelService.getMatchingKernel(e);return{selected:t,all:n.all,suggestions:o,hidden:[]}}async _handleQuickPick(e,t,o){return t.id==="selectAnother"?this.displaySelectAnotherQuickPick(e,o.length===1&&o[0]===t):super._handleQuickPick(e,t,o)}async displaySelectAnotherQuickPick(e,t){let o=e.textModel,n=new O,r=n.add(this._quickInputService.createQuickPick({useSeparators:!0})),s=await new Promise(l=>{r.title=t?d(13972,null):d(13973,null),r.placeholder=d(13975,null),r.busy=!0,r.buttons=[this._quickInputService.backButton],r.show(),n.add(r.onDidTriggerButton(c=>{c===this._quickInputService.backButton&&l(c)})),n.add(r.onDidTriggerItemButton(async c=>{if(_Io(c.item)&&c.item.documentation!==void 0){let u=A.isUri(c.item.documentation)?A.parse(c.item.documentation):await this._commandService.executeCommand(c.item.documentation);u&&this._openerService.open(u,{openExternal:!0})}})),n.add(r.onDidAccept(async()=>{l(r.selectedItems[0])})),n.add(r.onDidHide(()=>{l(void 0)})),this._calculdateKernelSources(e).then(c=>{r.items=c,r.items.length>0&&(r.busy=!1)}),n.add(U.debounce(U.any(this._notebookKernelService.onDidChangeSourceActions,this._notebookKernelService.onDidAddKernel,this._notebookKernelService.onDidRemoveKernel),(c,u)=>c,LIo)(async()=>{r.busy=!0;let c=await this._calculdateKernelSources(e);r.items=c,r.busy=!1}))});if(r.hide(),n.dispose(),s===this._quickInputService.backButton)return this.showQuickPick(e,void 0,!0);if(s){let l=s;if(_Io(l))try{let c=await this._executeCommand(o,l.command);if(c){let{all:u}=await this._getMatchingResult(o),p=u.find(h=>h.id===`ms-toolsai.jupyter/${c}`);return p&&await this._selecteKernel(o,p),!0}else return this.displaySelectAnotherQuickPick(e,!1)}catch{return!1}else{if(Dnt(l))return await this._selecteKernel(o,l.kernel),!0;if(Qsn(l))return await this._selectOneKernel(o,l.label,l.kernels),!0;if(FKt(l))try{return await l.action.runAction(),!0}catch{return!1}else{if(RIo(l))return await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,e.textModel.viewType,[]),!0;if(DIo(l))return await this._showKernelExtension(this._extensionWorkbenchService,this._extensionService,this._extensionManagementServerService,e.textModel.viewType,l.extensionIds,this._productService.quality!=="stable"),this.displaySelectAnotherQuickPick(e,!1)}}}return!1}async _calculdateKernelSources(e){let t=e.textModel,o=this._notebookKernelService.getSourceActions(t,e.scopedContextKeyService),n=await this._notebookKernelService.getKernelSourceActions2(t),r=this._getMatchingResult(t);if(o.length===0&&r.all.length===0&&n.length===0)return await this._getKernelRecommendationsQuickPickItems(t,this._extensionWorkbenchService)??[];let s=r.all.filter(u=>u.extension.value!==W_e),l=[];for(let u of Lf(s,(p,h)=>p.extension.value===h.extension.value?0:1)){let p=this._extensionService.extensions.find(g=>g.identifier.value===u[0].extension.value),h=p?.displayName??p?.description??u[0].extension.value;u.length>1?l.push({label:h,kernels:u}):l.push({label:u[0].label,kernel:u[0]})}let c=n.filter(u=>u.command);l.push(...c.map(u=>{let p=u.documentation?[{iconClass:q.asClassName(L.info),tooltip:d(13968,null)}]:[];return{id:typeof u.command=="string"?u.command:u.command.id,label:u.label,description:u.description,command:u.command,documentation:u.documentation,buttons:p}}));for(let u of o){let p={action:u,picked:!1,label:u.action.label,tooltip:u.action.tooltip};l.push(p)}return l}async _selectOneKernel(e,t,o){let n=o.map(l=>uLi(l,void 0)),r=new O,s=r.add(this._quickInputService.createQuickPick({useSeparators:!0}));s.items=n,s.canSelectMany=!1,s.title=d(13976,null,t),r.add(s.onDidAccept(async()=>{s.selectedItems&&s.selectedItems.length>0&&Dnt(s.selectedItems[0])&&await this._selecteKernel(e,s.selectedItems[0].kernel),s.hide(),s.dispose()})),r.add(s.onDidHide(()=>{r.dispose()})),s.show()}async _executeCommand(e,t){let o=typeof t=="string"?t:t.id,n=typeof t=="string"?[]:t.arguments??[];return(typeof t=="string"||!t.arguments||!Array.isArray(t.arguments)||t.arguments.length===0)&&n.unshift({uri:e.uri,$mid:14}),typeof t=="string"?this._commandService.executeCommand(o):this._commandService.executeCommand(o,...n)}static updateKernelStatusAction(e,t,o,n){if(o.getKernelDetectionTasks(e).length){let u=o.getMatchingKernel(e);if(t.enabled=!0,t.class=q.asClassName(q.modify(FC,"spin")),u.selected){t.label=u.selected.label;let p=u.selected.description??u.selected.detail;t.tooltip=p?d(13967,null,p):d(13966,null)}else t.label=d(13966,null);return}let s=o.getRunningSourceActions(e),l=(u,p)=>{let h=u.action;t.class=p?q.asClassName(q.modify(FC,"spin")):q.asClassName(zge),t.label=h.label,t.enabled=!0};if(s.length)return l(s[0],!0);let{selected:c}=n.getKernels(e);c?(t.label=c.label,t.class=q.asClassName(zge),t.tooltip=c.description??c.detail??""):(t.label=d(13972,null),t.class=q.asClassName(zge),t.tooltip="")}static async resolveKernel(e,t,o,n){let r=o.getKernels(e);if(r.selected)return r.selected;await n.executeCommand(D_);let{selected:s}=o.getKernels(e);return s}};xQ=I([m(0,Ql),m(1,Ze),m(2,$e),m(3,nt),m(4,re),m(5,Ui),m(6,lt),m(7,$c),m(8,fe),m(9,XM),m(10,Je)],xQ);function Xsn(a,i){let e;if(i!==void 0&&"notebookEditorId"in i){let t=i.notebookEditorId,o=a.visibleEditorPanes.find(n=>lr(n)?.getId()===t);e=lr(o)}else i!==void 0&&"notebookEditor"in i?e=i?.notebookEditor:e=lr(a.activeEditorPane);return e}function Jsn(a,i,e,t){return!!(a&&(t&&"skipIfAlreadySelected"in t&&t.skipIfAlreadySelected||i&&a.id===i&&hi.equals(a.extension,e)))}W(class extends z{constructor(){super({id:D_,category:Ph,title:P(13977,"Select Notebook Kernel"),icon:zge,f1:!0,precondition:nl,menu:[{id:R.EditorTitle,when:C.and(nl,C.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:-10},{id:R.NotebookToolbar,when:C.equals("config.notebook.globalToolbar",!0),group:"status",order:-10},{id:R.InteractiveToolbar,when:Vie.notEqualsTo(0),group:"status",order:-10}],metadata:{description:d(13978,null),args:[{name:"kernelInfo",description:"The kernel info",schema:{type:"object",required:["id","extension"],properties:{id:{type:"string"},extension:{type:"string"},notebookEditorId:{type:"string"}}}}]}})}async run(a,i){let e=a.get(F),t=a.get(ie),o=Xsn(t,i);if(!o||!o.hasModel())return!1;let n=i&&"id"in i?i.id:void 0,r=i&&"extension"in i?i.extension:void 0;n&&(typeof n!="string"||typeof r!="string")&&(n=void 0,r=void 0);let s=o.textModel,l=a.get(Ql),{selected:c}=l.getMatchingKernel(s);if(Jsn(c,n,r,i))return!0;let u=n?`${r}/${n}`:void 0;return e.createInstance(xQ).showQuickPick(o,u)}});var qU=class extends ts{constructor(e,t,o,n,r){let s=new it("fakeAction",void 0,q.asClassName(zge),!0,l=>e.run(l));super(void 0,s,{...o,label:!1,icon:!0});this._editor=t;this._notebookKernelService=n;this._notebookKernelHistoryService=r;this._register(s),this._register(t.onDidChangeModel(this._update,this)),this._register(n.onDidAddKernel(this._update,this)),this._register(n.onDidRemoveKernel(this._update,this)),this._register(n.onDidChangeNotebookAffinity(this._update,this)),this._register(n.onDidChangeSelectedNotebooks(this._update,this)),this._register(n.onDidChangeSourceActions(this._update,this)),this._register(n.onDidChangeKernelDetectionTasks(this._update,this))}render(e){this._update(),super.render(e),e.classList.add("kernel-action-view-item"),this._kernelLabel=document.createElement("a"),e.appendChild(this._kernelLabel),this.updateLabel()}updateLabel(){this._kernelLabel&&(this._kernelLabel.classList.add("kernel-label"),this._kernelLabel.innerText=this._action.label)}_update(){let e=this._editor.textModel;if(!e){this._resetAction();return}xQ.updateKernelStatusAction(e,this._action,this._notebookKernelService,this._notebookKernelHistoryService),this.updateClass()}_resetAction(){this._action.enabled=!1,this._action.label="",this._action.class=""}};qU=I([m(3,Ql),m(4,XM)],qU);var WKt=class{constructor(){this._marks={}}get value(){return{...this._marks}}mark(i){if(this._marks[i]){console.error(`Skipping overwrite of notebook perf value: ${i}`);return}this._marks[i]=Date.now()}};var mLi="vscode://schemas/extensions",MIo={id:mLi,allowComments:!0,allowTrailingCommas:!0,type:"object",title:d(11894,null),additionalProperties:!1,properties:{recommendations:{type:"array",description:d(11893,null),items:{type:"string",pattern:w0,errorMessage:d(11892,null)}},unwantedRecommendations:{type:"array",description:d(11895,null),items:{type:"string",pattern:w0,errorMessage:d(11892,null)}}}},hLi=["{","	// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.","	// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp","","	// List of extensions which should be recommended for users of this workspace.",'	"recommendations": [',"		","	],","	// List of extensions recommended by VS Code that should not be recommended for users of this workspace.",'	"unwantedRecommendations": [',"		","	]","}"].join(`
`);var PIo=Oe("extensions-view-icon",L.extensions,d(11694,null)),Kge=Oe("extensions-manage",L.gear,d(11701,null)),AIo=Oe("extensions-clear-search-results",L.clearAll,d(11691,null)),NIo=Oe("extensions-refresh",L.refresh,d(11704,null)),VKt=Oe("extensions-filter",L.filter,d(11695,null)),OIo=Oe("extensions-install-local-in-remote",L.cloudDownload,d(11698,null)),gLi=Oe("extensions-install-workspace-recommended",L.cloudDownload,d(11699,null)),FIo=Oe("extensions-configure-recommended",L.pencil,d(11692,null)),WIo=Oe("extensions-sync-enabled",L.sync,d(11711,null)),Rnt=Oe("extensions-sync-ignored",L.syncIgnored,d(11712,null)),VIo=Oe("extensions-remote",L.remote,d(11705,null)),fLi=Oe("extensions-install-count",L.cloudDownload,d(11697,null)),vLi=Oe("extensions-private",L.lock,d(11700,null)),BIo=Oe("extensions-rating",L.star,d(11703,null)),bLi=Oe("extensions-pre-release",L.versions,d(11702,null)),Lnt=Oe("extensions-sponsor",L.heartFilled,d(11707,null)),Mnt=Oe("extensions-star-full",L.starFull,d(11709,null)),HIo=Oe("extensions-star-half",L.starHalf,d(11710,null)),BKt=Oe("extensions-star-empty",L.starEmpty,d(11708,null)),cI=Oe("extensions-error-message",L.error,d(11693,null)),fp=Oe("extensions-warning-message",L.warning,d(11714,null)),Ef=Oe("extensions-info-message",L.info,d(11696,null)),SP=Oe("extension-workspace-trust",L.shield,d(11713,null)),UIo=Oe("extension-activation-time",L.history,d(11690,null)),zIo=Oe("extension-restart-required",L.refresh,d(11706,null));var yq=le("issueFormService"),R_=le("workbenchIssueService");var Uie=class extends it{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super("extension.promptExtensionInstallFailure");this.extension=e;this.options=t;this.version=o;this.installOperation=n;this.error=r;this.productService=s;this.openerService=l;this.notificationService=c;this.dialogService=u;this.commandService=p;this.logService=h;this.extensionManagementServerService=g;this.instantiationService=f;this.galleryService=v;this.extensionManifestPropertiesService=b;this.workbenchIssueService=S}async run(){if(Yi(this.error))return;if(this.logService.error(this.error),this.error.name==="Unsupported"){let s=Ft?d(11675,null,this.productService.nameLong):this.productService.nameLong,l=d(11522,null,this.extension.displayName||this.extension.identifier.id,s),{confirmed:c}=await this.dialogService.confirm({type:ft.Info,message:l,primaryButton:d(11623,null),cancelButton:d(11524,null)});c&&this.openerService.open(Ft?A.parse("https://aka.ms/vscode-web-extensions-guide"):A.parse("https://aka.ms/vscode-remote"));return}if("ReleaseVersionNotFound"===this.error.name){await this.dialogService.prompt({type:"error",message:Dn(this.error),buttons:[{label:d(11602,null),run:()=>{let s=this.instantiationService.createInstance(WC,{installPreReleaseVersion:!0});return s.extension=this.extension,s.run()}}],cancelButton:d(11520,null)});return}if(["Incompatible","IncompatibleApi","IncompatibleTargetPlatform","Malicious","Deprecated"].includes(this.error.name)){await this.dialogService.info(Dn(this.error));return}if("PackageNotSigned"===this.error.name){await this.dialogService.prompt({type:"error",message:d(11626,null,this.extension.displayName),detail:Dn(this.error),buttons:[{label:d(11588,null),run:()=>{let s=this.instantiationService.createInstance(WC,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}if("SignatureVerificationFailed"===this.error.name){await this.dialogService.prompt({type:"error",message:d(11674,null,this.extension.displayName,this.productService.nameLong),detail:Dn(this.error),buttons:[{label:d(11615,null),run:()=>this.openerService.open("https://code.visualstudio.com/docs/editor/extension-marketplace#_the-extension-signature-cannot-be-verified-by-vs-code")},{label:d(11591,null),run:()=>{let s=this.instantiationService.createInstance(WC,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}if("SignatureVerificationInternal"===this.error.name){await this.dialogService.prompt({type:"error",message:d(11674,null,this.extension.displayName,this.productService.nameLong),detail:Dn(this.error),buttons:[{label:d(11615,null),run:()=>this.openerService.open("https://code.visualstudio.com/docs/editor/extension-marketplace#_the-extension-signature-cannot-be-verified-by-vs-code")},{label:d(11632,null),run:()=>this.workbenchIssueService.openReporter({issueTitle:d(11634,null,this.extension.displayName),issueBody:d(11633,null)})},{label:d(11591,null),run:()=>{let s=this.instantiationService.createInstance(WC,{...this.options,donotVerifySignature:!0});return s.extension=this.extension,s.run()}}],cancelButton:!0});return}let e=this.installOperation===3?d(11666,null,this.extension.displayName||this.extension.identifier.id):d(11599,null,this.extension.displayName||this.extension.identifier.id),t,o=[],n=await this.getDownloadUrl();n&&(t=d(11523,null,nc(OG).toString()),o.push({label:d(11551,null),run:()=>this.openerService.open(n).then(()=>{this.notificationService.prompt(ft.Info,d(11606,null,this.extension.identifier.id),[{label:d(11614,null),run:()=>this.commandService.executeCommand(KNt)}])})}));let r=`${e}${t?` ${t}`:""}`;this.notificationService.prompt(ft.Error,r,o)}async getDownloadUrl(){if(Tc||!this.extension.gallery||!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer)return;let e=this.extension.gallery.properties.targetPlatform;if(e!=="universal"&&e!=="undefined"&&this.extensionManagementServerService.remoteExtensionManagementServer)try{let o=await this.galleryService.getManifest(this.extension.gallery,Ie.None);o&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(o)&&(e=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getTargetPlatform())}catch(o){this.logService.error(o);return}if(e==="unknown")return;let[t]=await this.galleryService.getExtensions([{...this.extension.identifier,version:this.version}],{targetPlatform:e},Ie.None);if(t)return A.parse(t.assets.download.uri)}};Uie=I([m(5,Ze),m(6,Je),m(7,Ne),m(8,ct),m(9,fe),m(10,re),m(11,$c),m(12,F),m(13,ga),m(14,hm),m(15,R_)],Uie);var Ks=class a extends it{constructor(){super(...arguments);this._onDidChange=this._register(new T);this._extension=null;this._hidden=!1;this.hideOnDisabled=!0}get onDidChange(){return this._onDidChange.event}static{this.EXTENSION_ACTION_CLASS="extension-action"}static{this.TEXT_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} text`}static{this.LABEL_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} label`}static{this.ICON_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} icon`}get extension(){return this._extension}set extension(e){this._extension=e,this.update()}get hidden(){return this._hidden}set hidden(e){this._hidden!==e&&(this._hidden=e,this._onDidChange.fire({hidden:e}))}_setEnabled(e){super._setEnabled(e),this.hideOnDisabled&&(this.hidden=!e)}},Tq=class extends Ks{constructor(e,t,o){t=`${t} action-dropdown`;super(e,void 0,t);this.actionsGroups=o;this.menuActionClassNames=[];this._menuActions=[];this.menuActionClassNames=t.split(" "),this.hideOnDisabled=!1,this.extensionActions=o.flat(),this.update(),this._register(U.any(...this.extensionActions.map(n=>n.onDidChange))(()=>this.update(!0))),this.extensionActions.forEach(n=>this._register(n))}get menuActions(){return[...this._menuActions]}get extension(){return super.extension}set extension(e){this.extensionActions.forEach(t=>t.extension=e),super.extension=e}update(e){e||this.extensionActions.forEach(n=>n.update());let t=this.actionsGroups.map(n=>n.filter(r=>!r.hidden)),o=[];for(let n of t)n.length&&(o=[...o,...n,new oi]);o=o.length?o.slice(0,o.length-1):o,this.primaryAction=o[0],this._menuActions=o.length>1?o:[],this._onDidChange.fire({menuActions:this._menuActions}),this.primaryAction?(this.hidden=!1,this.enabled=this.primaryAction.enabled,this.label=this.getLabel(this.primaryAction),this.tooltip=this.primaryAction.tooltip):(this.hidden=!0,this.enabled=!1)}async run(){this.enabled&&await this.primaryAction?.run()}getLabel(e){return e.label}},GNe=class extends ZX{constructor(i,e,t){super(null,i,e,t),this._register(i.onDidChange(o=>{(o.hidden!==void 0||o.menuActions!==void 0)&&this.updateClass()}))}render(i){super.render(i),this.updateClass()}updateClass(){if(super.updateClass(),this.element&&this.dropdownMenuActionViewItem?.element){this.element.classList.toggle("hide",this._action.hidden);let i=this._action.menuActions.length===0;this.element.classList.toggle("empty",i),this.dropdownMenuActionViewItem.element.classList.toggle("hide",i)}}},WC=class extends Ks{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super("extensions.install",d(11586,null),WC.CLASS,!1);this.extensionsWorkbenchService=t;this.instantiationService=o;this.runtimeExtensionService=n;this.workbenchThemeService=r;this.labelService=s;this.dialogService=l;this.preferencesService=c;this.telemetryService=u;this.contextService=p;this.allowedExtensionsService=h;this.extensionGalleryManifestService=g;this._manifest=null;this.updateThrottler=this._register(new am);this.hideOnDisabled=!1,this.options={isMachineScoped:!1,...e},this.update(),this._register(h.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this._register(this.labelService.onDidChangeFormatters(()=>this.updateLabel(),this))}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}set manifest(e){this._manifest=e,this.updateLabel()}update(){this.updateThrottler.queue(()=>this.computeAndUpdateEnablement())}async computeAndUpdateEnablement(){this.enabled=!1,this.class=WC.HIDE,this.hidden=!0,this.extension&&(this.extension.isBuiltin||this.extensionsWorkbenchService.canSetLanguage(this.extension)||this.extension.state===3&&(this.options.installPreReleaseVersion&&(!this.extension.hasPreReleaseVersion||this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName,prerelease:!0})!==!0)||!this.options.installPreReleaseVersion&&!this.extension.hasReleaseVersion||(this.hidden=!1,this.class=WC.CLASS,await this.extensionsWorkbenchService.canInstall(this.extension)===!0&&(this.enabled=!0,this.updateLabel()))))}async run(){if(!this.extension)return;if(this.extension.gallery&&!this.extension.gallery.isSigned&&f7e(this.extension.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest())){let{result:t}=await this.dialogService.prompt({type:ft.Warning,message:d(11626,null,this.extension.displayName),detail:d(11627,null),buttons:[{label:d(11588,null),run:()=>(this.options.donotVerifySignature=!0,!0)}],cancelButton:{run:()=>!1}});if(!t)return}if(this.extension.deprecationInfo){let t=d(11531,null),o;(p=>(p[p.InstallAnyway=0]="InstallAnyway",p[p.ShowAlternateExtension=1]="ShowAlternateExtension",p[p.ConfigureSettings=2]="ConfigureSettings",p[p.Cancel=3]="Cancel"))(o||={});let n=[{label:d(11588,null),run:()=>0}];if(this.extension.deprecationInfo.extension){t=d(11533,null,this.extension.deprecationInfo.extension.displayName);let s=this.extension.deprecationInfo.extension;n.push({label:d(11648,null,this.extension.deprecationInfo.extension.displayName),run:async()=>{let[l]=await this.extensionsWorkbenchService.getExtensions([{id:s.id,preRelease:s.preRelease}],Ie.None);return await this.extensionsWorkbenchService.open(l),1}})}else if(this.extension.deprecationInfo.settings){t=d(11535,null);let s=this.extension.deprecationInfo.settings;n.push({label:d(11525,null),run:async()=>(await this.preferencesService.openSettings({query:s.map(l=>`@id:${l}`).join(" ")}),2)})}else this.extension.deprecationInfo.additionalInfo&&(t=new he(`${t} ${this.extension.deprecationInfo.additionalInfo}`));let{result:r}=await this.dialogService.prompt({type:ft.Warning,message:d(11590,null,this.extension.displayName),detail:We(t)?t:void 0,custom:We(t)?void 0:{markdownDetails:[{markdown:t}]},buttons:n,cancelButton:{run:()=>3}});if(r!==0)return}this.extensionsWorkbenchService.open(this.extension,{showPreReleaseVersion:this.options.installPreReleaseVersion}),cn(d(11610,null,this.extension.displayName)),this.telemetryService.publicLog("extensions:action:install",{...this.extension.telemetryData,actionId:this.id});let e=await this.install(this.extension);if(e?.local){cn(d(11609,null,this.extension.displayName));let t=await this.getRunningExtension(e.local);if(t&&!(t.activationEvents&&t.activationEvents.some(o=>o.startsWith("onLanguage")))){let o=await this.getThemeAction(e);if(o){o.extension=e;try{return o.run({showCurrentTheme:!0,ignoreFocusLost:!0})}finally{o.dispose()}}}}}async getThemeAction(e){if((await this.workbenchThemeService.getColorThemes()).some(r=>Eq(r,e)))return this.instantiationService.createInstance(AE);if((await this.workbenchThemeService.getFileIconThemes()).some(r=>Eq(r,e)))return this.instantiationService.createInstance(NE);if((await this.workbenchThemeService.getProductIconThemes()).some(r=>Eq(r,e)))return this.instantiationService.createInstance(OE)}async install(e){try{return await this.extensionsWorkbenchService.install(e,this.options)}catch(t){await this.instantiationService.createInstance(Uie,e,this.options,e.latestVersion,2,t).run();return}}async getRunningExtension(e){let t=await this.runtimeExtensionService.getExtension(e.identifier.id);return t||(this.runtimeExtensionService.canAddExtension(C0(e))?new Promise((o,n)=>{let r=this.runtimeExtensionService.onDidChangeExtensions(async()=>{let s=await this.runtimeExtensionService.getExtension(e.identifier.id);s&&(r.dispose(),o(s))})}):null)}updateLabel(){this.label=this.getLabel()}getLabel(e){return this.extension?.isWorkspaceScoped&&this.extension.resourceExtension&&this.contextService.isInsideWorkspace(this.extension.resourceExtension.location)?d(11607,null):this.options.installPreReleaseVersion&&this.extension?.hasPreReleaseVersion?e?d(11600,null):d(11601,null):this.extension?.hasPreReleaseVersion?e?d(11586,null):d(11604,null):d(11586,null)}};WC=I([m(1,Ui),m(2,F),m(3,lt),m(4,ep),m(5,nt),m(6,ct),m(7,Qo),m(8,_e),m(9,Ae),m(10,Mm),m(11,tb)],WC);var zie=class extends Tq{set manifest(i){this.extensionActions.forEach(e=>e.manifest=i),this.update()}constructor(i,e){super("extensions.installActions",WC.CLASS,[[i.createInstance(WC,{installPreReleaseVersion:e.preferPreReleases}),i.createInstance(WC,{installPreReleaseVersion:!e.preferPreReleases})]])}getLabel(i){return i.getLabel(!0)}};zie=I([m(0,F),m(1,Dd)],zie);var qNe=class a extends Ks{static{this.LABEL=d(11611,null)}static{this.CLASS=`${Ks.LABEL_ACTION_CLASS} install installing`}constructor(){super("extension.installing",a.LABEL,a.CLASS,!1)}update(){this.class=`${a.CLASS}${this.extension&&this.extension.state===0?"":" hide"}`}},IP=class extends Ks{constructor(e,t,o,n,r,s){super(e,IP.INSTALL_LABEL,IP.Class,!1);this.server=t;this.canInstallAnyWhere=o;this.extensionsWorkbenchService=n;this.extensionManagementServerService=r;this.extensionManifestPropertiesService=s;this.updateWhenCounterExtensionChanges=!0;this.update()}static{this.INSTALL_LABEL=d(11586,null)}static{this.INSTALLING_LABEL=d(11611,null)}static{this.Class=`${Ks.LABEL_ACTION_CLASS} prominent install-other-server`}static{this.InstallingClass=`${Ks.LABEL_ACTION_CLASS} install-other-server installing`}update(){if(this.enabled=!1,this.class=IP.Class,this.canInstall()){let e=this.extensionsWorkbenchService.installed.filter(t=>Ht(t.identifier,this.extension.identifier)&&t.server===this.server)[0];e?e.state===0&&!e.local&&(this.enabled=!0,this.label=IP.INSTALLING_LABEL,this.class=IP.InstallingClass):(this.enabled=!0,this.label=this.getInstallLabel())}}canInstall(){return!this.extension||!this.server||!this.extension.local||this.extension.state!==1||this.extension.type!==1||this.extension.enablementState===2||this.extension.enablementState===0||this.extension.enablementState===5?!1:!!(gM(this.extension.local.manifest)||this.server===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)||this.server===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)||this.server===this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWeb(this.extension.local.manifest)||this.canInstallAnyWhere&&(this.server===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnUI(this.extension.local.manifest)||this.server===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(this.extension.local.manifest)))}async run(){if(this.extension?.local&&this.extension?.server&&this.server)return this.extensionsWorkbenchService.open(this.extension),cn(d(11610,null,this.extension.displayName)),this.extensionsWorkbenchService.installInServer(this.extension,this.server)}};IP=I([m(3,Ui),m(4,$c),m(5,hm)],IP);var kQ=class extends IP{constructor(i,e,t,o){super("extensions.remoteinstall",t.remoteExtensionManagementServer,i,e,t,o)}getInstallLabel(){return this.extensionManagementServerService.remoteExtensionManagementServer?d(11593,null,this.extensionManagementServerService.remoteExtensionManagementServer.label):IP.INSTALL_LABEL}};kQ=I([m(1,Ui),m(2,$c),m(3,hm)],kQ);var Kie=class extends IP{constructor(i,e,t){super("extensions.localinstall",e.localExtensionManagementServer,!1,i,e,t)}getInstallLabel(){return d(11598,null)}};Kie=I([m(0,Ui),m(1,$c),m(2,hm)],Kie);var Gie=class extends IP{constructor(i,e,t){super("extensions.webInstall",e.webExtensionManagementServer,!1,i,e,t)}getInstallLabel(){return d(11589,null)}};Gie=I([m(0,Ui),m(1,$c),m(2,hm)],Gie);var L_=class extends Ks{constructor(e,t,o){super("extensions.uninstall",L_.UninstallLabel,L_.UninstallClass,!1);this.extensionsWorkbenchService=e;this.userDataProfilesService=t;this.dialogService=o;this.update()}static{this.UninstallLabel=d(11659,null)}static{this.UninstallingLabel=d(11664,null)}static{this.UninstallClass=`${Ks.LABEL_ACTION_CLASS} uninstall`}static{this.UnInstallingClass=`${Ks.LABEL_ACTION_CLASS} uninstall uninstalling`}update(){if(!this.extension){this.enabled=!1;return}let e=this.extension.state;if(e===2){this.label=L_.UninstallingLabel,this.class=L_.UnInstallingClass,this.enabled=!1;return}if(this.label=this.extension.local?.isApplicationScoped&&this.userDataProfilesService.profiles.length>1?d(11660,null):L_.UninstallLabel,this.class=L_.UninstallClass,this.tooltip=L_.UninstallLabel,e!==1){this.enabled=!1;return}if(this.extension.isBuiltin){this.enabled=!1;return}this.enabled=!0}async run(){if(this.extension){cn(d(11663,null,this.extension.displayName));try{await this.extensionsWorkbenchService.uninstall(this.extension),cn(d(11662,null,this.extension.displayName))}catch(e){Yi(e)||this.dialogService.error(Dn(e))}}}};L_=I([m(0,Ui),m(1,hn),m(2,ct)],L_);var ZN=class extends Ks{constructor(e,t,o,n,r){super("extensions.update",d(11665,null),ZN.DisabledClass,!1);this.verbose=e;this.extensionsWorkbenchService=t;this.dialogService=o;this.openerService=n;this.instantiationService=r;this.updateThrottler=this._register(new am);this.update()}static{this.EnabledClass=`${this.LABEL_ACTION_CLASS} update`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.updateThrottler.queue(()=>this.computeAndUpdateEnablement()),this.extension&&(this.label=this.verbose?d(11668,null,this.extension.latestVersion):d(11665,null))}async computeAndUpdateEnablement(){if(this.enabled=!1,this.class=ZN.DisabledClass,!this.extension||this.extension.deprecationInfo)return;let e=await this.extensionsWorkbenchService.canInstall(this.extension),t=this.extension.state===1;this.enabled=e===!0&&t&&this.extension.outdated,this.class=this.enabled?ZN.EnabledClass:ZN.DisabledClass}async run(){if(!this.extension)return;let e=await this.extensionsWorkbenchService.shouldRequireConsentToUpdate(this.extension);if(e){let{result:o}=await this.dialogService.prompt({type:"warning",title:d(11672,null,this.extension.displayName),message:d(11671,null,e),buttons:[{label:d(11665,null),run:()=>"update"},{label:d(11638,null),run:()=>"review"},{label:d(11520,null),run:()=>"cancel"}]});if(o==="cancel")return;if(o==="review")return this.extension.hasChangelog()?this.extensionsWorkbenchService.open(this.extension,{tab:"changelog"}):this.extension.repository?this.openerService.open(this.extension.repository):this.extensionsWorkbenchService.open(this.extension)}let t={};this.extension.local?.source==="vsix"&&this.extension.local.pinned&&(t.pinned=!1),this.extension.local?.preRelease&&(t.installPreReleaseVersion=!0);try{cn(d(11673,null,this.extension.displayName,this.extension.latestVersion)),await this.extensionsWorkbenchService.install(this.extension,t),cn(d(11670,null,this.extension.displayName,this.extension.latestVersion))}catch(o){this.instantiationService.createInstance(Uie,this.extension,t,this.extension.latestVersion,3,o).run()}}};ZN=I([m(1,Ui),m(2,ct),m(3,Je),m(4,F)],ZN);var ck=class extends Ks{constructor(e,t,o,n){super(ck.ID,ck.LABEL.value,ck.DisabledClass);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.allowedExtensionsService=o;this._register(n.onDidChangeConfiguration(r=>{r.affectsConfiguration(JI)&&this.update()})),this._register(o.onDidChangeAllowedExtensionsConfigValue(r=>this.update())),this.update()}static{this.ID="workbench.extensions.action.toggleAutoUpdateForExtension"}static{this.LABEL=P(11557,"Auto Update")}static{this.EnabledClass=`${Ks.EXTENSION_ACTION_CLASS} auto-update`}static{this.DisabledClass=`${this.EnabledClass} hide`}update(){if(this.enabled=!1,this.class=ck.DisabledClass,!this.extension||this.extension.isBuiltin||this.extension.deprecationInfo?.disallowInstall)return;let e=this.extension.local??this.extension.gallery;e&&this.allowedExtensionsService.isAllowed(e)!==!0||this.extensionsWorkbenchService.getAutoUpdateValue()==="onlyEnabledExtensions"&&!this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)||(this.enabled=!0,this.class=ck.EnabledClass,this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension))}async run(){if(!this.extension)return;let e=!this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension);await this.extensionsWorkbenchService.updateAutoUpdateEnablementFor(this.extension,e),e?cn(d(11556,null,this.extension.displayName)):cn(d(11541,null,this.extension.displayName))}};ck=I([m(0,Ui),m(1,As),m(2,Mm),m(3,B)],ck);var XW=class extends Ks{constructor(e){super(XW.ID,XW.LABEL);this.extensionsWorkbenchService=e}static{this.ID="workbench.extensions.action.toggleAutoUpdatesForPublisher"}static{this.LABEL=d(11654,null)}update(){}async run(){if(!this.extension)return;cn(d(11585,null,this.extension.publisherDisplayName));let e=!this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension.publisher);await this.extensionsWorkbenchService.updateAutoUpdateEnablementFor(this.extension.publisher,e),e?cn(d(11556,null,this.extension.displayName)):cn(d(11541,null,this.extension.displayName))}};XW=I([m(0,Ui)],XW);var JW=class extends Ks{constructor(e,t){super("extensionsAction.migrateDeprecatedExtension",d(11621,null),JW.DisabledClass,!1);this.small=e;this.extensionsWorkbenchService=t;this.update()}static{this.EnabledClass=`${Ks.LABEL_ACTION_CLASS} migrate`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){if(this.enabled=!1,this.class=JW.DisabledClass,!this.extension?.local||this.extension.state!==1||!this.extension.deprecationInfo?.extension)return;let e=this.extension.deprecationInfo.extension.id;this.extensionsWorkbenchService.local.some(t=>Ht(t.identifier,{id:e}))||(this.enabled=!0,this.class=JW.EnabledClass,this.tooltip=d(11620,null,this.extension.deprecationInfo.extension.displayName),this.label=this.small?d(11619,null):this.tooltip)}async run(){if(!this.extension?.deprecationInfo?.extension)return;let e=this.extension.local;await this.extensionsWorkbenchService.uninstall(this.extension);let[t]=await this.extensionsWorkbenchService.getExtensions([{id:this.extension.deprecationInfo.extension.id,preRelease:this.extension.deprecationInfo?.extension?.preRelease}],Ie.None);await this.extensionsWorkbenchService.install(t,{isMachineScoped:e?.isMachineScoped})}};JW=I([m(1,Ui)],JW);var $U=class extends Ks{constructor(e,t,o,n,r){super(e,t,o,n);this.instantiationService=r;this._actionViewItem=null}createActionViewItem(e){return this._actionViewItem=this.instantiationService.createInstance(Pnt,this,e),this._actionViewItem}run(e){return this._actionViewItem?.showMenu(e),Promise.resolve()}};$U=I([m(4,F)],$U);var Pnt=class extends ts{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!0});this.contextMenuService=o}showMenu(e){if(this.element){let t=this.getActions(e),o=ur(this.element),n={x:o.left,y:o.top+o.height+10};this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>t,actionRunner:this.actionRunner,onHide:()=>gz(t)})}}getActions(e){let t=[];for(let o of e)t=[...t,...o,new oi];return t.length?t.slice(0,t.length-1):t}};Pnt=I([m(2,Xe)],Pnt);async function KIo(a,i,e){return e.invokeFunction(async t=>{let o=t.get(Ui),n=t.get(As),r=t.get(Yt),s=t.get(AR),l=t.get(RE),c=t.get(ep),u=t.get(RN),p=t.get(Mm),h=[];if(a){switch(h.push(["extension",a.identifier.id]),h.push(["isBuiltinExtension",a.isBuiltin]),h.push(["isDefaultApplicationScopedExtension",a.local&&O4(a.local.manifest)]),h.push(["isApplicationScopedExtension",a.local&&a.local.isApplicationScoped]),h.push(["isWorkspaceScopedExtension",a.isWorkspaceScoped]),h.push(["isGalleryExtension",!!a.identifier.uuid]),a.local&&h.push(["extensionSource",a.local.source]),h.push(["extensionHasConfiguration",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes.configuration]),h.push(["extensionHasKeybindings",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes.keybindings]),h.push(["extensionHasCommands",a.local&&!!a.local.manifest.contributes&&!!a.local.manifest.contributes?.commands]),h.push(["isExtensionRecommended",!!s.getAllRecommendationsWithReason()[a.identifier.id.toLowerCase()]]),h.push(["isExtensionWorkspaceRecommended",s.getAllRecommendationsWithReason()[a.identifier.id.toLowerCase()]?.reasonId===0]),h.push(["isUserIgnoredRecommendation",l.globalIgnoredRecommendations.some(y=>y===a.identifier.id.toLowerCase())]),h.push(["isExtensionPinned",a.pinned]),h.push(["isExtensionEnabled",n.isEnabledEnablementState(a.enablementState)]),a.state){case 0:h.push(["extensionStatus","installing"]);break;case 1:h.push(["extensionStatus","installed"]);break;case 2:h.push(["extensionStatus","uninstalling"]);break;case 3:h.push(["extensionStatus","uninstalled"]);break}h.push(["installedExtensionIsPreReleaseVersion",!!a.local?.isPreReleaseVersion]),h.push(["installedExtensionIsOptedToPreRelease",!!a.local?.preRelease]),h.push(["galleryExtensionIsPreReleaseVersion",!!a.gallery?.properties.isPreReleaseVersion]),h.push(["galleryExtensionHasPreReleaseVersion",a.gallery?.hasPreReleaseVersion]),h.push(["extensionHasPreReleaseVersion",a.hasPreReleaseVersion]),h.push(["extensionHasReleaseVersion",a.hasReleaseVersion]),h.push(["extensionDisallowInstall",a.isMalicious||a.deprecationInfo?.disallowInstall]),h.push(["isExtensionAllowed",p.isAllowed({id:a.identifier.id,publisherDisplayName:a.publisherDisplayName})===!0]),h.push(["isPreReleaseExtensionAllowed",p.isAllowed({id:a.identifier.id,publisherDisplayName:a.publisherDisplayName,prerelease:!0})===!0]),h.push(["extensionIsUnsigned",a.gallery&&!a.gallery.isSigned]),h.push(["extensionIsPrivate",a.gallery?.private]);let[f,v,b,S]=await Promise.all([c.getColorThemes(),c.getFileIconThemes(),c.getProductIconThemes(),u.extensionUsesAuth(a.identifier.id.toLowerCase())]);h.push(["extensionHasColorThemes",f.some(y=>Eq(y,a))]),h.push(["extensionHasFileIconThemes",v.some(y=>Eq(y,a))]),h.push(["extensionHasProductIconThemes",b.some(y=>Eq(y,a))]),h.push(["extensionHasAccountPreferences",S]),h.push(["canSetLanguage",o.canSetLanguage(a)]),h.push(["isActiveLanguagePackExtension",a.gallery&&Kr===pZ(a.gallery)])}return r.getMenuActions(R.ExtensionContext,i.createOverlay(h),{shouldForwardArgs:!0})})}function Ant(a,i){let e=[];for(let[,t]of a)e.push(t.map(o=>o instanceof sa?o:i.createInstance(Nnt,o)));return e}async function yLi(a,i,e){let t=await KIo(a,i,e);return Ant(t,e)}var eO=class extends $U{constructor(e,t,o,n){super(eO.ID,"","",!0,e);this.extensionService=t;this.contextKeyService=o;this.productService=n;this.tooltip=d(11617,null),this.update()}static{this.ID="extensions.manage"}static{this.Class=`${Ks.ICON_ACTION_CLASS} manage `+q.asClassName(Kge)}static{this.HideManageExtensionClass=`${this.Class} hide`}async getActionGroups(){let e=[],t=await KIo(this.extension,this.contextKeyService,this.instantiationService),o=[],n=[],r=[],s=[];for(let[c,u]of t)c===Iee?n.push(...Ant([[c,u]],this.instantiationService)[0]):c===xJe?r.push(...Ant([[c,u]],this.instantiationService)[0]):c===pRe?o.push(...Ant([[c,u]],this.instantiationService)[0]):s.push(...Ant([[c,u]],this.instantiationService));return o.length&&e.push(o),this.extension&&hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId)?(e.push([this.instantiationService.createInstance(RQ),this.instantiationService.createInstance(LQ)]),e.push([this.instantiationService.createInstance(MQ),this.instantiationService.createInstance(PQ)])):(e.push([this.instantiationService.createInstance(TQ),this.instantiationService.createInstance(EQ)]),e.push([this.instantiationService.createInstance(DQ),this.instantiationService.createInstance(_Q)])),r.length&&e.push(r),e.push([...n.length?n:[],this.instantiationService.createInstance(M_,this.extension,!1),this.instantiationService.createInstance(L_)]),s.forEach(c=>e.push(c)),e.forEach(c=>c.forEach(u=>{u instanceof Ks&&(u.extension=this.extension)})),e}async run(){return await this.extensionService.whenInstalledExtensionsRegistered(),super.run(await this.getActionGroups())}update(){if(this.class=eO.HideManageExtensionClass,this.enabled=!1,this.extension){let e=this.extension.state;this.enabled=e===1,this.class=this.enabled||e===2?eO.Class:eO.HideManageExtensionClass}}};eO=I([m(0,F),m(1,lt),m(2,X),m(3,Ze)],eO);var HKt=class extends $U{constructor(e,t){super("extensionEditor.manageExtension","",`${Ks.ICON_ACTION_CLASS} manage ${q.asClassName(Kge)}`,!0,t);this.contextKeyService=e;this.tooltip=d(11617,null)}update(){}async run(){let e=[];return(await yLi(this.extension,this.contextKeyService,this.instantiationService)).forEach(t=>e.push(t)),e.forEach(t=>t.forEach(o=>{o instanceof Ks&&(o.extension=this.extension)})),super.run(e)}},Nnt=class extends Ks{constructor(e,t){super(e.id,e.label);this.action=e;this.extensionsWorkbenchService=t}get enabled(){return this.action.enabled}set enabled(e){this.action.enabled=e}update(){this.extension&&(this.action.id===zNt?this.checked=!this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension):this.action.id===ck.ID?this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension):this.action.id===XW.ID?this.checked=this.extensionsWorkbenchService.isAutoUpdateEnabledFor(this.extension.publisher):this.checked=this.action.checked)}async run(){if(this.extension){let e=this.extension.local?zS(this.extension.local.manifest.publisher,this.extension.local.manifest.name):this.extension.gallery?zS(this.extension.gallery.publisher,this.extension.gallery.name):this.extension.identifier.id,t={id:this.extension.identifier.id,version:this.extension.version,location:this.extension.local?.location,galleryLink:this.extension.url};await this.action.run(e,t)}}};Nnt=I([m(1,Ui)],Nnt);var HR=class extends Ks{constructor(e,t){super(HR.ID,HR.LABEL,HR.DisabledClass);this.extensionsWorkbenchService=e;this.allowedExtensionsService=t;this._register(t.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.update()}static{this.ID="workbench.extensions.action.togglePreRlease"}static{this.LABEL=d(11657,null)}static{this.EnabledClass=`${Ks.LABEL_ACTION_CLASS} prominent pre-release`}static{this.DisabledClass=`${this.EnabledClass} hide`}update(){this.enabled=!1,this.class=HR.DisabledClass,this.extension&&(this.extension.isBuiltin||this.extension.state===1&&this.extension.hasPreReleaseVersion&&this.extension.gallery&&(this.extension.preRelease&&(!this.extension.isPreReleaseVersion||this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName})!==!0)||!this.extension.preRelease&&(!this.extension.gallery.hasPreReleaseVersion||this.allowedExtensionsService.isAllowed(this.extension.gallery)!==!0)||(this.enabled=!0,this.class=HR.EnabledClass,this.extension.preRelease?(this.label=d(11655,null),this.tooltip=d(11656,null)):(this.label=d(11650,null),this.tooltip=d(11651,null)))))}async run(){this.extension&&(this.extensionsWorkbenchService.open(this.extension,{showPreReleaseVersion:!this.extension.preRelease}),await this.extensionsWorkbenchService.togglePreRelease(this.extension))}};HR=I([m(0,Ui),m(1,Mm)],HR);var M_=class extends Ks{constructor(e,t,o,n,r,s,l,c,u){super(M_.ID,M_.LABEL,Ks.LABEL_ACTION_CLASS);this.whenInstalled=t;this.extensionsWorkbenchService=o;this.extensionManagementService=n;this.extensionGalleryService=r;this.quickInputService=s;this.instantiationService=l;this.dialogService=c;this.allowedExtensionsService=u;this._register(u.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.extension=e,this.update()}static{this.ID="workbench.extensions.action.install.anotherVersion"}static{this.LABEL=d(11587,null)}update(){this.enabled=!!this.extension&&!this.extension.isBuiltin&&!!this.extension.identifier.uuid&&!this.extension.deprecationInfo&&this.allowedExtensionsService.isAllowed({id:this.extension.identifier.id,publisherDisplayName:this.extension.publisherDisplayName})===!0,this.enabled&&this.whenInstalled&&(this.enabled=!!this.extension?.local&&!!this.extension.server&&this.extension.state===1)}async run(){if(!this.enabled||!this.extension)return;let e=this.extension.server?await this.extension.server.extensionManagementService.getTargetPlatform():await this.extensionManagementService.getTargetPlatform(),t=await this.extensionGalleryService.getAllCompatibleVersions(this.extension.identifier,this.extension.local?.preRelease??this.extension.gallery?.properties.isPreReleaseVersion??!1,e);if(!t.length){await this.dialogService.info(d(11625,null));return}let o=t.map((r,s)=>({id:r.version,label:r.version,description:`${ea(new Date(Date.parse(r.date)),!0)}${r.isPreReleaseVersion?` (${d(11630,null)})`:""}${r.version===this.extension?.local?.manifest.version?` (${d(11528,null)})`:""}`,ariaLabel:`${r.isPreReleaseVersion?"Pre-Release version":"Release version"} ${r.version}`,isPreReleaseVersion:r.isPreReleaseVersion})),n=await this.quickInputService.pick(o,{placeHolder:d(11646,null),matchOnDetail:!0});if(n){if(this.extension.local?.manifest.version===n.id)return;let r={installPreReleaseVersion:n.isPreReleaseVersion,version:n.id};try{await this.extensionsWorkbenchService.install(this.extension,r)}catch(s){this.instantiationService.createInstance(Uie,this.extension,r,n.id,2,s).run()}}return null}};M_=I([m(2,Ui),m(3,Dd),m(4,ga),m(5,$e),m(6,F),m(7,ct),m(8,Mm)],M_);var EQ=class extends Ks{constructor(e,t,o){super(EQ.ID,EQ.LABEL,Ks.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.productService=o;this.tooltip=d(11564,null),this.update()}static{this.ID="extensions.enableForWorkspace"}static{this.LABEL=d(11563,null)}update(){if(this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped){if(hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId))return;this.enabled=this.extension.state===1&&!this.extensionEnablementService.isEnabled(this.extension.local)&&this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local)}}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,13)}};EQ=I([m(0,Ui),m(1,As),m(2,Ze)],EQ);var TQ=class extends Ks{constructor(e,t,o){super(TQ.ID,TQ.LABEL,Ks.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.productService=o;this.tooltip=d(11566,null),this.update()}static{this.ID="extensions.enableGlobally"}static{this.LABEL=d(11565,null)}update(){if(this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped){if(hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId))return;this.enabled=this.extension.state===1&&this.extensionEnablementService.isDisabledGlobally(this.extension.local)&&this.extensionEnablementService.canChangeEnablement(this.extension.local)}}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,12)}};TQ=I([m(0,Ui),m(1,As),m(2,Ze)],TQ);var _Q=class extends Ks{constructor(e,t,o,n,r){super(_Q.ID,_Q.LABEL,Ks.LABEL_ACTION_CLASS);this.workspaceContextService=e;this.extensionsWorkbenchService=t;this.extensionEnablementService=o;this.extensionService=n;this.productService=r;this.tooltip=d(11547,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableForWorkspace"}static{this.LABEL=d(11546,null)}update(){if(this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&this.extensionService.extensions.some(e=>Ht({id:e.identifier.value,uuid:e.uuid},this.extension.identifier)&&this.workspaceContextService.getWorkbenchState()!==1)){if(hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId))return;this.enabled=this.extension.state===1&&(this.extension.enablementState===12||this.extension.enablementState===13)&&this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local)}}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,11)}};_Q=I([m(0,Ae),m(1,Ui),m(2,As),m(3,lt),m(4,Ze)],_Q);var DQ=class extends Ks{constructor(e,t,o,n){super(DQ.ID,DQ.LABEL,Ks.LABEL_ACTION_CLASS);this.extensionsWorkbenchService=e;this.extensionEnablementService=t;this.extensionService=o;this.productService=n;this.tooltip=d(11549,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableGlobally"}static{this.LABEL=d(11548,null)}update(){if(this.enabled=!1,this.extension&&this.extension.local&&!this.extension.isWorkspaceScoped&&this.extensionService.extensions.some(e=>Ht({id:e.identifier.value,uuid:e.uuid},this.extension.identifier))){if(hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId))return;this.enabled=this.extension.state===1&&(this.extension.enablementState===12||this.extension.enablementState===13)&&this.extensionEnablementService.canChangeEnablement(this.extension.local)}}async run(){if(this.extension)return this.extensionsWorkbenchService.setEnablement(this.extension,10)}};DQ=I([m(0,Ui),m(1,As),m(2,lt),m(3,Ze)],DQ);var wq="chat.disableAIFeatures",RQ=class extends Ks{constructor(e,t){super(RQ.ID,RQ.LABEL,Ks.LABEL_ACTION_CLASS);this.productService=e;this.configurationService=t;this.tooltip=d(11553,null),this.update(),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(wq)&&this.update()}))}static{this.ID="extensions.enableAIGlobally"}static{this.LABEL=d(11552,null)}update(){if(this.enabled=!1,!this.extension?.local||!hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId)||this.extension.enablementState===11||this.extension.enablementState===13)return;let e=this.configurationService.inspect(wq);e?.workspaceValue!==!0&&(this.enabled=e.value===!0)}async run(){await this.configurationService.updateValue(wq,!1)}};RQ=I([m(0,Ze),m(1,B)],RQ);var LQ=class extends Ks{constructor(e,t,o,n){super(LQ.ID,LQ.LABEL,Ks.LABEL_ACTION_CLASS);this.productService=e;this.extensionsWorkbenchService=t;this.configurationService=o;this.extensionEnablementService=n;this.tooltip=d(11555,null),this.update(),this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration(wq)&&this.update()}))}static{this.ID="extensions.enableAIInWorkspace"}static{this.LABEL=d(11554,null)}update(){if(this.enabled=!1,!this.extension?.local||!hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId)||!this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local))return;let e=this.configurationService.inspect(wq);if(e.value!==!1){if(e?.workspaceValue===!0){this.enabled=!0;return}this.extension.enablementState!==13&&(this.enabled=!0)}}async run(){this.extension&&(await this.extensionsWorkbenchService.setEnablement(this.extension,13),this.configurationService.getValue(wq)===!0&&await this.configurationService.updateValue(wq,!1,5))}};LQ=I([m(0,Ze),m(1,Ui),m(2,B),m(3,As)],LQ);var MQ=class extends Ks{constructor(e,t){super(MQ.ID,MQ.LABEL,Ks.LABEL_ACTION_CLASS);this.productService=e;this.configurationService=t;this.tooltip=d(11538,null),this.update(),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(wq)&&this.update()}))}static{this.ID="extensions.disableAIGlobally"}static{this.LABEL=d(11537,null)}update(){this.enabled=!1,this.extension&&hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId)&&(this.enabled=this.extension.state===1&&this.configurationService.getValue(wq)!==!0&&this.extension.enablementState!==11)}async run(){await this.configurationService.updateValue(wq,!0)}};MQ=I([m(0,Ze),m(1,B)],MQ);var PQ=class extends Ks{constructor(e,t,o,n){super(PQ.ID,PQ.LABEL,Ks.LABEL_ACTION_CLASS);this.productService=e;this.extensionsWorkbenchService=t;this.extensionEnablementService=o;this.extensionService=n;this.tooltip=d(11540,null),this.update(),this._register(this.extensionService.onDidChangeExtensions(()=>this.update()))}static{this.ID="extensions.disableAIInWorkspace"}static{this.LABEL=d(11539,null)}update(){this.enabled=!1,this.extension&&this.extension.local&&hi.equals(this.extension.identifier.id,this.productService.defaultChatAgent?.chatExtensionId)&&(this.enabled=this.extension.state===1&&(this.extension.enablementState===12||this.extension.enablementState===13)&&this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local))}async run(){this.extension&&(await this.extensionsWorkbenchService.setEnablement(this.extension,11),await this.extensionsWorkbenchService.updateRunningExtensions(d(11637,null)))}};PQ=I([m(0,Ze),m(1,Ui),m(2,As),m(3,lt)],PQ);var VNe=class extends Tq{constructor(i){super("extensions.enable",Ks.LABEL_ACTION_CLASS,[[i.createInstance(TQ),i.createInstance(EQ)],[i.createInstance(RQ),i.createInstance(LQ)]])}};VNe=I([m(0,F)],VNe);var BNe=class extends Tq{constructor(i){super("extensions.disable",Ks.LABEL_ACTION_CLASS,[[i.createInstance(DQ),i.createInstance(_Q)],[i.createInstance(MQ),i.createInstance(PQ)]])}};BNe=I([m(0,F)],BNe);var Cq=class extends Ks{constructor(e,t,o,n,r,s){super("extensions.runtimeState","",Cq.DisabledClass,!1);this.hostService=e;this.extensionsWorkbenchService=t;this.updateService=o;this.extensionService=n;this.productService=r;this.telemetryService=s;this.updateWhenCounterExtensionChanges=!0;this._register(this.extensionService.onDidChangeExtensions(()=>this.update())),this.update()}static{this.EnabledClass=`${Ks.LABEL_ACTION_CLASS} prominent reload`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){if(this.enabled=!1,this.tooltip="",this.class=Cq.DisabledClass,!this.extension)return;let e=this.extension.state;if(e===0||e===2||this.extension.local&&this.extension.local.manifest&&this.extension.local.manifest.contributes&&this.extension.local.manifest.contributes.localizations&&this.extension.local.manifest.contributes.localizations.length>0)return;let t=this.extension.runtimeState;t&&(this.enabled=!0,this.class=Cq.EnabledClass,this.tooltip=t.reason,this.label=t.action==="reloadWindow"?d(11631,null):t.action==="restartExtensions"?d(11635,null):t.action==="quitAndInstall"?d(11636,null):t.action==="applyUpdate"||t.action==="downloadUpdate"?d(11667,null,this.productService.nameShort):"")}async run(){let e=this.extension?.runtimeState;if(e?.action){if(this.telemetryService.publicLog2("extensions:runtimestate:action",{action:e.action}),e?.action==="reloadWindow")return this.hostService.reload();if(e?.action==="restartExtensions")return this.extensionsWorkbenchService.updateRunningExtensions();if(e?.action==="downloadUpdate")return this.updateService.downloadUpdate(!0);if(e?.action==="applyUpdate")return this.updateService.applyUpdate();if(e?.action==="quitAndInstall")return this.updateService.quitAndInstall()}}};Cq=I([m(0,ti),m(1,Ui),m(2,Lp),m(3,lt),m(4,Ze),m(5,_e)],Cq);function Eq(a,i){return!!(i&&a.extensionData&&hi.equals(a.extensionData.extensionId,i.identifier.id))}function wLi(a,i,e,t){let o=[];for(let n of a)Eq(n,e)&&!(t&&n===i)&&o.push({label:n.label,id:n.id});return t&&(o.push({type:"separator",label:d(11528,null)}),o.push({label:i.label,id:i.id})),o}var AE=class extends Ks{constructor(e,t,o,n){super(AE.ID,AE.TITLE.value,AE.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(U.any(e.onDidChangeExtensions,t.onDidColorThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setColorTheme"}static{this.TITLE=P(11677,"Set Color Theme")}static{this.EnabledClass=`${Ks.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getColorThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?AE.EnabledClass:AE.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>Eq(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getColorThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getColorTheme(),r=new rn(100),s=wLi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(11641,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setColorTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setColorTheme(l?l.id:n.id,"auto")}};AE=I([m(0,lt),m(1,ep),m(2,$e),m(3,As)],AE);var NE=class extends Ks{constructor(e,t,o,n){super(NE.ID,NE.TITLE.value,NE.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(U.any(e.onDidChangeExtensions,t.onDidFileIconThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setFileIconTheme"}static{this.TITLE=P(11679,"Set File Icon Theme")}static{this.EnabledClass=`${Ks.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getFileIconThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?NE.EnabledClass:NE.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>Eq(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getFileIconThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getFileIconTheme(),r=new rn(100),s=wLi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(11643,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setFileIconTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setFileIconTheme(l?l.id:n.id,"auto")}};NE=I([m(0,lt),m(1,ep),m(2,$e),m(3,As)],NE);var OE=class extends Ks{constructor(e,t,o,n){super(OE.ID,OE.TITLE.value,OE.DisabledClass,!1);this.workbenchThemeService=t;this.quickInputService=o;this.extensionEnablementService=n;this._register(U.any(e.onDidChangeExtensions,t.onDidProductIconThemeChange)(()=>this.update(),this)),this.update()}static{this.ID="workbench.extensions.action.setProductIconTheme"}static{this.TITLE=P(11680,"Set Product Icon Theme")}static{this.EnabledClass=`${Ks.LABEL_ACTION_CLASS} theme`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.workbenchThemeService.getProductIconThemes().then(e=>{this.enabled=this.computeEnablement(e),this.class=this.enabled?OE.EnabledClass:OE.DisabledClass})}computeEnablement(e){return!!this.extension&&this.extension.state===1&&this.extensionEnablementService.isEnabledEnablementState(this.extension.enablementState)&&e.some(t=>Eq(t,this.extension))}async run({showCurrentTheme:e,ignoreFocusLost:t}={showCurrentTheme:!1,ignoreFocusLost:!1}){let o=await this.workbenchThemeService.getProductIconThemes();if(!this.computeEnablement(o))return;let n=this.workbenchThemeService.getProductIconTheme(),r=new rn(100),s=wLi(o,n,this.extension,e),l=await this.quickInputService.pick(s,{placeHolder:d(11644,null),onDidFocus:c=>r.trigger(()=>this.workbenchThemeService.setProductIconTheme(c.id,void 0)),ignoreFocusLost:t});return this.workbenchThemeService.setProductIconTheme(l?l.id:n.id,"auto")}};OE=I([m(0,lt),m(1,ep),m(2,$e),m(3,As)],OE);var yP=class extends Ks{constructor(e){super(yP.ID,yP.TITLE.value,yP.DisabledClass,!1);this.extensionsWorkbenchService=e;this.update()}static{this.ID="workbench.extensions.action.setDisplayLanguage"}static{this.TITLE=P(11678,"Set Display Language")}static{this.EnabledClass=`${Ks.LABEL_ACTION_CLASS} language`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.enabled=!1,this.class=yP.DisabledClass,this.extension&&this.extensionsWorkbenchService.canSetLanguage(this.extension)&&(this.extension.gallery&&Kr===pZ(this.extension.gallery)||(this.enabled=!0,this.class=yP.EnabledClass))}async run(){return this.extension&&this.extensionsWorkbenchService.setLanguage(this.extension)}};yP=I([m(0,Ui)],yP);var dk=class extends Ks{constructor(e,t){super(dk.ID,dk.TITLE.value,dk.DisabledClass,!1);this.extensionsWorkbenchService=e;this.localeService=t;this.update()}static{this.ID="workbench.extensions.action.clearLanguage"}static{this.TITLE=P(11676,"Clear Display Language")}static{this.EnabledClass=`${Ks.LABEL_ACTION_CLASS} language`}static{this.DisabledClass=`${this.EnabledClass} disabled`}update(){this.enabled=!1,this.class=dk.DisabledClass,this.extension&&this.extensionsWorkbenchService.canSetLanguage(this.extension)&&(this.extension.gallery&&Kr!==pZ(this.extension.gallery)||(this.enabled=!0,this.class=dk.EnabledClass))}async run(){return this.extension&&this.localeService.clearLocalePreference()}};dk=I([m(0,Ui),m(1,AU)],dk);var Gge=class extends it{constructor(e,t){super(Gge.ID,Gge.LABEL,void 0,!1);this.extensionWorkbenchService=t;this.extensionId=e}static{this.ID="workbench.extensions.action.showRecommendedExtension"}static{this.LABEL=d(11649,null)}async run(){await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`);let[e]=await this.extensionWorkbenchService.getExtensions([{id:this.extensionId}],{source:"install-recommendation"},Ie.None);return e?this.extensionWorkbenchService.open(e):null}};Gge=I([m(1,Ui)],Gge);var tO=class extends it{constructor(e,t,o){super(tO.ID,tO.LABEL,void 0,!1);this.instantiationService=t;this.extensionWorkbenchService=o;this.extensionId=e}static{this.ID="workbench.extensions.action.installRecommendedExtension"}static{this.LABEL=d(11613,null)}async run(){await this.extensionWorkbenchService.openSearch(`@id:${this.extensionId}`);let[e]=await this.extensionWorkbenchService.getExtensions([{id:this.extensionId}],{source:"install-recommendation"},Ie.None);if(e){await this.extensionWorkbenchService.open(e);try{await this.extensionWorkbenchService.install(e)}catch(t){this.instantiationService.createInstance(Uie,e,void 0,e.latestVersion,2,t).run()}}}};tO=I([m(1,F),m(2,Ui)],tO);var qge=class extends it{constructor(e,t){super(qge.ID,"Ignore Recommendation");this.extension=e;this.extensionRecommendationsManagementService=t;this.class=qge.Class,this.tooltip=d(11584,null),this.enabled=!0}static{this.ID="extensions.ignore"}static{this.Class=`${Ks.LABEL_ACTION_CLASS} ignore`}run(){return this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id,!0),Promise.resolve()}};qge=I([m(1,RE)],qge);var $ge=class extends it{constructor(e,t){super($ge.ID,"Undo");this.extension=e;this.extensionRecommendationsManagementService=t;this.class=$ge.Class,this.tooltip=d(11658,null),this.enabled=!0}static{this.ID="extensions.ignore"}static{this.Class=`${Ks.LABEL_ACTION_CLASS} undo-ignore`}run(){return this.extensionRecommendationsManagementService.toggleGlobalIgnoredRecommendation(this.extension.identifier.id,!1),Promise.resolve()}};$ge=I([m(1,RE)],$ge);var HNe=class extends it{constructor(e,t,o,n,r,s,l,c){super(e,t);this.contextService=o;this.fileService=n;this.textFileService=r;this.editorService=s;this.jsonEditingService=l;this.textModelResolverService=c}openExtensionsFile(e){return this.getOrCreateExtensionsFile(e).then(({created:t,content:o})=>this.getSelectionPosition(o,e,["recommendations"]).then(n=>this.editorService.openEditor({resource:e,options:{pinned:t,selection:n}})),t=>Promise.reject(new Error(d(11629,null,t))))}openWorkspaceConfigurationFile(e){return this.getOrUpdateWorkspaceConfigurationFile(e).then(t=>this.getSelectionPosition(t.value.toString(),t.resource,["extensions","recommendations"])).then(t=>this.editorService.openEditor({resource:e,options:{selection:t,forceReload:!0}}))}getOrUpdateWorkspaceConfigurationFile(e){return Promise.resolve(this.fileService.readFile(e)).then(t=>{let o=is(t.value.toString()).extensions;return!o||!o.recommendations?this.jsonEditingService.write(e,[{path:["extensions"],value:{recommendations:[]}}],!0).then(()=>this.fileService.readFile(e)):t})}getSelectionPosition(e,t,o){let n=xM(e),r=Tx(n,o);if(r&&r.parent&&r.parent.children){let s=r.parent.children[1],l=s.children&&s.children.length?s.children[s.children.length-1]:null,c=l?l.offset+l.length:s.offset+1;return Promise.resolve(this.textModelResolverService.createModelReference(t)).then(u=>{let p=u.object.textEditorModel.getPositionAt(c);return u.dispose(),{startLineNumber:p.lineNumber,startColumn:p.column,endLineNumber:p.lineNumber,endColumn:p.column}})}return Promise.resolve(void 0)}getOrCreateExtensionsFile(e){return Promise.resolve(this.fileService.readFile(e)).then(t=>({created:!1,extensionsFileResource:e,content:t.value.toString()}),t=>this.textFileService.write(e,hLi).then(()=>({created:!0,extensionsFileResource:e,content:hLi})))}};HNe=I([m(2,Ae),m(3,ge),m(4,Uo),m(5,ie),m(6,Zg),m(7,Bt)],HNe);var xq=class extends HNe{static{this.ID="workbench.extensions.action.configureWorkspaceRecommendedExtensions"}static{this.LABEL=d(11527,null)}constructor(i,e,t,o,n,r,s,l){super(i,e,n,t,o,r,s,l),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.update(),this)),this.update()}update(){this.enabled=this.contextService.getWorkbenchState()!==1}run(){switch(this.contextService.getWorkbenchState()){case 2:return this.openExtensionsFile(this.contextService.getWorkspace().folders[0].toResource(cge));case 3:return this.openWorkspaceConfigurationFile(this.contextService.getWorkspace().configuration)}return Promise.resolve()}};xq=I([m(2,ge),m(3,Uo),m(4,Ae),m(5,ie),m(6,Zg),m(7,Bt)],xq);var kq=class extends HNe{constructor(e,t,o,n,r,s,l,c,u){super(e,t,r,o,n,s,l,c);this.commandService=u}static{this.ID="workbench.extensions.action.configureWorkspaceFolderRecommendedExtensions"}static{this.LABEL=d(11526,null)}run(){let t=this.contextService.getWorkspace().folders.length===1?Promise.resolve(this.contextService.getWorkspace().folders[0]):this.commandService.executeCommand(iP);return Promise.resolve(t).then(o=>o?this.openExtensionsFile(o.toResource(cge)):null)}};kq=I([m(2,ge),m(3,Uo),m(4,Ae),m(5,ie),m(6,Zg),m(7,Bt),m(8,fe)],kq);var ZW=class extends it{constructor(e,t,o){super("extensions.action.statusLabel","",ZW.DISABLED_CLASS,!1);this.extensionService=e;this.extensionManagementServerService=t;this.extensionEnablementService=o;this.initialStatus=null;this.status=null;this.version=null;this.enablementState=null;this._extension=null}static{this.ENABLED_CLASS=`${Ks.TEXT_ACTION_CLASS} extension-status-label`}static{this.DISABLED_CLASS=`${this.ENABLED_CLASS} hide`}get extension(){return this._extension}set extension(e){this._extension&&e&&Ht(this._extension.identifier,e.identifier)||(this.initialStatus=null,this.status=null,this.enablementState=null),this._extension=e,this.update()}update(){let e=this.computeLabel();this.label=e||"",this.class=e?ZW.ENABLED_CLASS:ZW.DISABLED_CLASS}computeLabel(){if(!this.extension)return null;let e=this.status,t=this.version,o=this.enablementState;this.status=this.extension.state,this.version=this.extension.version,this.initialStatus===null&&(this.initialStatus=this.status),this.enablementState=this.extension.enablementState;let n=()=>{let s=this.extensionService.extensions.filter(l=>Ht({id:l.identifier.value,uuid:l.uuid},this.extension.identifier))[0];return this.extension.local?s&&this.extension.version===s.version?!0:this.extensionService.canAddExtension(C0(this.extension.local)):!1},r=()=>this.extension.local?this.extensionService.extensions.every(s=>!(Ht({id:s.identifier.value,uuid:s.uuid},this.extension.identifier)&&this.extension.server===this.extensionManagementServerService.getExtensionManagementServer(YT(s))))?!0:this.extensionService.canRemoveExtension(C0(this.extension.local)):!1;if(e!==null){if(e===0&&this.status===1)return this.initialStatus===3&&n()?d(11608,null):this.initialStatus===1&&this.version!==t&&n()?d(11669,null):null;if(e===2&&this.status===3)return this.initialStatus=this.status,r()?d(11661,null):null}if(o!==null){let s=this.extensionEnablementService.isEnabledEnablementState(o),l=this.extensionEnablementService.isEnabledEnablementState(this.enablementState);if(!s&&l)return n()?d(11558,null):null;if(s&&!l)return r()?d(11542,null):null}return null}run(){return Promise.resolve()}};ZW=I([m(0,lt),m(1,$c),m(2,As)],ZW);var qie=class extends $U{constructor(e,t,o,n){super("extensions.sync","",qie.SYNC_CLASS,!1,n);this.configurationService=e;this.extensionsWorkbenchService=t;this.userDataSyncEnablementService=o;this._register(U.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration("settingsSync.ignoredExtensions"))(()=>this.update())),this._register(o.onDidChangeEnablement(()=>this.update())),this.update()}static{this.IGNORED_SYNC_CLASS=`${Ks.ICON_ACTION_CLASS} extension-sync ${q.asClassName(Rnt)}`}static{this.SYNC_CLASS=`${this.ICON_ACTION_CLASS} extension-sync ${q.asClassName(WIo)}`}update(){if(this.enabled=!!this.extension&&this.userDataSyncEnablementService.isEnabled()&&this.extension.state===1,this.extension){let e=this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension);this.class=e?qie.IGNORED_SYNC_CLASS:qie.SYNC_CLASS,this.tooltip=e?d(11583,null):d(11653,null)}}async run(){return super.run([[new it("extensions.syncignore",this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension)?d(11652,null):d(11550,null),void 0,!0,()=>this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(this.extension))]])}};qie=I([m(0,B),m(1,Ui),m(2,Yl),m(3,F)],qie);var BR=class extends Ks{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("extensions.status","",`${BR.CLASS} hide`,!1);this.extensionManagementServerService=e;this.labelService=t;this.commandService=o;this.workspaceTrustEnablementService=n;this.workspaceTrustService=r;this.extensionsWorkbenchService=s;this.extensionService=l;this.extensionManifestPropertiesService=c;this.contextService=u;this.productService=p;this.allowedExtensionsService=h;this.workbenchExtensionEnablementService=g;this.extensionFeaturesManagementService=f;this.extensionGalleryManifestService=v;this.updateWhenCounterExtensionChanges=!0;this._status=[];this._onDidChangeStatus=this._register(new T);this.onDidChangeStatus=this._onDidChangeStatus.event;this.updateThrottler=this._register(new am);this._register(this.labelService.onDidChangeFormatters(()=>this.update(),this)),this._register(this.extensionService.onDidChangeExtensions(()=>this.update())),this._register(this.extensionFeaturesManagementService.onDidChangeAccessData(()=>this.update())),this._register(h.onDidChangeAllowedExtensionsConfigValue(()=>this.update())),this.update()}static{this.CLASS=`${Ks.ICON_ACTION_CLASS} extension-status`}get status(){return this._status}update(){this.updateThrottler.queue(()=>this.computeAndUpdateStatus())}async computeAndUpdateStatus(){if(this.updateStatus(void 0,!0),this.enabled=!1,!this.extension)return;if(this.extension.isMalicious){this.updateStatus({icon:fp,message:new he(d(11616,null))},!0);return}if(this.extension.state===3&&this.extension.gallery&&!this.extension.gallery.isSigned&&f7e(this.extension.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest())){this.updateStatus({icon:fp,message:new he(d(11628,null))},!0);return}if(this.extension.deprecationInfo){if(this.extension.deprecationInfo.extension){let r=`[${this.extension.deprecationInfo.extension.displayName}](${nc("extension.open",this.extension.deprecationInfo.extension.id)})`;this.updateStatus({icon:fp,message:new he(d(11534,null,r))},!0)}else if(this.extension.deprecationInfo.settings){let r=`[${d(11647,null)}](${nc("workbench.action.openSettings",this.extension.deprecationInfo.settings.map(s=>`@id:${s}`).join(" "))}})`;this.updateStatus({icon:fp,message:new he(d(11536,null,r))},!0)}else{let r=new he(d(11532,null));this.extension.deprecationInfo.additionalInfo&&r.appendMarkdown(` ${this.extension.deprecationInfo.additionalInfo}`),this.updateStatus({icon:fp,message:r},!0)}return}if(this.extension.missingFromGallery){this.updateStatus({icon:fp,message:new he(d(11622,null))},!0);return}if(this.extensionsWorkbenchService.canSetLanguage(this.extension))return;if(this.extension.outdated){let r=await this.extensionsWorkbenchService.shouldRequireConsentToUpdate(this.extension);if(r){let s=new he;s.appendMarkdown(`${r} `),s.appendMarkdown(d(11519,null,this.extension.hasChangelog()?nc("extension.open",this.extension.identifier.id,"changelog").toString():this.extension.repository?this.extension.repository:nc("extension.open",this.extension.identifier.id).toString())),this.updateStatus({icon:fp,message:s},!0)}}if(this.extension.gallery&&this.extension.state===3){let r=await this.extensionsWorkbenchService.canInstall(this.extension);if(r!==!0){this.updateStatus({icon:fp,message:r},!0);return}}if(!this.extension.local||!this.extension.server||this.extension.state!==1)return;if(this.extension.enablementState===7){let r=this.allowedExtensionsService.isAllowed(this.extension.local);if(r!==!0){this.updateStatus({icon:fp,message:new he(d(11543,null,r.value))},!0);return}}if(this.extension.enablementState===2){this.updateStatus({message:new he(d(11545,null))},!0);return}if(this.extension.enablementState===3){this.updateStatus({message:new he(d(11559,null))},!0);return}if(this.extension.enablementState===5){let r=Cue(this.extension.local.manifest.capabilities?.virtualWorkspaces);this.updateStatus({icon:Ef,message:new he(r?Ru(r):d(11544,null))},!0);return}if(R0(this.contextService.getWorkspace())){let r=this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(this.extension.local.manifest),s=Cue(this.extension.local.manifest.capabilities?.virtualWorkspaces);if(r==="limited"||s){this.updateStatus({icon:fp,message:new he(s?Ru(s):d(11572,null))},!0);return}}if(this.extension.enablementState===9){this.updateStatus({icon:Ef,message:new he(d(11569,null,"`chat.extensionUnification.enabled`"))},!0);return}if(!this.workspaceTrustService.isWorkspaceTrusted()&&(this.extension.enablementState===0||this.extension.enablementState===8&&this.workbenchExtensionEnablementService.getDependenciesEnablementStates(this.extension.local).every(([,r])=>this.workbenchExtensionEnablementService.isEnabledEnablementState(r)||r===0))){this.enabled=!0;let r=Cue(this.extension.local.manifest.capabilities?.untrustedWorkspaces);this.updateStatus({icon:SP,message:new he(r?Ru(r):d(11568,null))},!0);return}if(this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&!this.workspaceTrustService.isWorkspaceTrusted()){let r=this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(this.extension.local.manifest),s=Cue(this.extension.local.manifest.capabilities?.untrustedWorkspaces);if(r==="limited"||s){this.enabled=!0,this.updateStatus({icon:SP,message:new he(s?Ru(s):d(11571,null))},!0);return}}if(this.extension.enablementState===1&&!this.extensionsWorkbenchService.installed.some(r=>Ht(r.identifier,this.extension.identifier)&&r.server!==this.extension.server)){let r;this.extensionManagementServerService.localExtensionManagementServer===this.extension.server?this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)&&this.extensionManagementServerService.remoteExtensionManagementServer&&(r=new he(`${d(11594,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)} [${d(11615,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)):this.extensionManagementServerService.remoteExtensionManagementServer===this.extension.server?this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)&&(this.extensionManagementServerService.localExtensionManagementServer?r=new he(`${d(11592,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)} [${d(11615,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`):Ft&&(r=new he(`${d(11529,null,this.productService.nameLong)} [${d(11615,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`))):this.extensionManagementServerService.webExtensionManagementServer===this.extension.server&&(r=new he(`${d(11521,null,this.productService.nameLong)} [${d(11615,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)),r&&this.updateStatus({icon:fp,message:r},!0);return}let e=new hi(this.extension.identifier.id),t=oe.as(qs.ExtensionFeaturesRegistry).getExtensionFeatures();for(let r of t){let s=this.extensionFeaturesManagementService.getAccessData(e,r.id)?.current?.status,l=`[${d(11618,null)}](${nc("extension.open",this.extension.identifier.id,"features",!1,r.id)})`;if(s?.severity===ft.Error){this.updateStatus({icon:cI,message:new he().appendText(s.message).appendMarkdown(` ${l}`)},!0);return}if(s?.severity===ft.Warning){this.updateStatus({icon:fp,message:new he().appendText(s.message).appendMarkdown(` ${l}`)},!0);return}}if(this.extensionManagementServerService.remoteExtensionManagementServer){if(gM(this.extension.local.manifest)){if(!this.extensionsWorkbenchService.installed.some(l=>Ht(l.identifier,this.extension.identifier)&&l.server!==this.extension.server)){let l=this.extension.server===this.extensionManagementServerService.localExtensionManagementServer?new he(d(11595,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)):new he(d(11596,null));this.updateStatus({icon:Ef,message:l},!0)}return}let r=this.extensionService.extensions.filter(l=>Ht({id:l.identifier.value,uuid:l.uuid},this.extension.identifier))[0],s=r?this.extensionManagementServerService.getExtensionManagementServer(YT(r)):null;if(this.extension.server===this.extensionManagementServerService.localExtensionManagementServer&&s===this.extensionManagementServerService.remoteExtensionManagementServer){this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(this.extension.local.manifest)&&this.updateStatus({icon:Ef,message:new he(`${d(11562,null)} [${d(11615,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}if(this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer&&s===this.extensionManagementServerService.localExtensionManagementServer){this.extensionManifestPropertiesService.prefersExecuteOnUI(this.extension.local.manifest)&&this.updateStatus({icon:Ef,message:new he(`${d(11561,null)} [${d(11615,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}if(this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer&&s===this.extensionManagementServerService.webExtensionManagementServer){this.extensionManifestPropertiesService.canExecuteOnWeb(this.extension.local.manifest)&&this.updateStatus({icon:Ef,message:new he(`${d(11560,null)} [${d(11615,null)}](https://code.visualstudio.com/api/advanced-topics/remote-extensions#architecture-and-extension-kinds)`)},!0);return}}if(this.extension.enablementState===8){this.updateStatus({icon:fp,message:new he(d(11567,null)).appendMarkdown(`&nbsp;[${d(11530,null)}](${nc("extension.open",this.extension.identifier.id,"dependencies")})`)},!0);return}if(!this.extension.local.isValid){let r=this.extension.local.validations.filter(([s])=>s===ft.Error).map(([,s])=>s);this.updateStatus({icon:fp,message:new he(r.join(" ").trim())},!0);return}let o=this.workbenchExtensionEnablementService.isEnabled(this.extension.local),n=this.extensionService.extensions.some(r=>Ht({id:r.identifier.value,uuid:r.uuid},this.extension.identifier));if(!this.extension.isWorkspaceScoped&&o&&n){if(this.extension.enablementState===13){this.updateStatus({message:new he(d(11682,null))},!0);return}if(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer&&this.extension.server===this.extensionManagementServerService.remoteExtensionManagementServer){this.updateStatus({message:new he(d(11570,null,this.extension.server.label))},!0);return}if(this.extension.enablementState===12)return}if(!o&&!n){if(this.extension.enablementState===10){this.updateStatus({message:new he(d(11582,null))},!0);return}if(this.extension.enablementState===11){this.updateStatus({message:new he(d(11681,null))},!0);return}}}updateStatus(e,t){if(e){if(this._status.some(o=>o.message.value===e.message.value&&o.icon?.id===e.icon?.id))return}else{if(this._status.length===0)return;this._status=[]}e&&(this._status.push(e),this._status.sort((o,n)=>n.icon===SP?-1:o.icon===SP?1:n.icon===cI?-1:o.icon===cI?1:n.icon===fp?-1:o.icon===fp?1:n.icon===Ef?-1:o.icon===Ef?1:0)),t&&(e?.icon===cI?this.class=`${BR.CLASS} extension-status-error ${q.asClassName(cI)}`:e?.icon===fp?this.class=`${BR.CLASS} extension-status-warning ${q.asClassName(fp)}`:e?.icon===Ef?this.class=`${BR.CLASS} extension-status-info ${q.asClassName(Ef)}`:e?.icon===SP?this.class=`${BR.CLASS} ${q.asClassName(SP)}`:this.class=`${BR.CLASS} hide`),this._onDidChangeStatus.fire()}async run(){if(this._status[0]?.icon===SP)return this.commandService.executeCommand("workbench.trust.manage")}};BR=I([m(0,$c),m(1,nt),m(2,fe),m(3,yM),m(4,Or),m(5,Ui),m(6,lt),m(7,hm),m(8,Ae),m(9,Ze),m(10,Mm),m(11,As),m(12,Qy),m(13,tb)],BR);var iO=class extends it{constructor(e=iO.ID,t=iO.LABEL,o,n,r,s){super(e,t);this.extensionsWorkbenchService=o;this.quickInputService=n;this.instantiationService=r;this.extensionEnablementService=s}static{this.ID="workbench.extensions.action.install.specificVersion"}static{this.LABEL=d(11603,null)}get enabled(){return this.extensionsWorkbenchService.local.some(e=>this.isEnabled(e))}async run(){let e=await this.quickInputService.pick(this.getExtensionEntries(),{placeHolder:d(11645,null),matchOnDetail:!0});e&&e.extension&&(await this.instantiationService.createInstance(M_,e.extension,!0).run(),await this.extensionsWorkbenchService.openSearch(e.extension.identifier.id))}isEnabled(e){return this.instantiationService.createInstance(M_,e,!0).enabled&&!!e.local&&this.extensionEnablementService.isEnabled(e.local)}async getExtensionEntries(){let e=await this.extensionsWorkbenchService.queryLocal(),t=[];for(let o of e)this.isEnabled(o)&&t.push({id:o.identifier.id,label:o.displayName||o.identifier.id,description:o.identifier.id,extension:o});return t.sort((o,n)=>o.extension.displayName.localeCompare(n.extension.displayName))}};iO=I([m(2,Ui),m(3,$e),m(4,F),m(5,As)],iO);var UNe=class extends it{constructor(e,t,o,n,r){super(e);this.extensionsWorkbenchService=t;this.quickInputService=o;this.notificationService=n;this.progressService=r;this.extensions=void 0;this.update(),this.extensionsWorkbenchService.queryLocal().then(()=>this.updateExtensions()),this._register(this.extensionsWorkbenchService.onChange(()=>{this.extensions&&this.updateExtensions()}))}updateExtensions(){this.extensions=this.extensionsWorkbenchService.local,this.update()}update(){this.enabled=!!this.extensions&&this.getExtensionsToInstall(this.extensions).length>0,this.tooltip=this.label}async run(){return this.selectAndInstallExtensions()}async queryExtensionsToInstall(){let e=await this.extensionsWorkbenchService.queryLocal();return this.getExtensionsToInstall(e)}async selectAndInstallExtensions(){let e=this.quickInputService.createQuickPick();e.busy=!0;let t=e.onDidAccept(()=>{t.dispose(),e.hide(),e.dispose(),this.onDidAccept(e.selectedItems)});e.show();let o=await this.queryExtensionsToInstall();e.busy=!1,o.length?(e.title=this.getQuickPickTitle(),e.placeholder=d(11642,null),e.canSelectMany=!0,o.sort((n,r)=>n.displayName.localeCompare(r.displayName)),e.items=o.map(n=>({extension:n,label:n.displayName,description:n.version}))):(e.hide(),e.dispose(),this.notificationService.notify({severity:ft.Info,message:d(11624,null)}))}async onDidAccept(e){if(e.length){let t=e.filter(o=>!!o.extension).map(o=>o.extension);t.length&&(await this.progressService.withProgress({location:15,title:d(11612,null)},()=>this.installExtensions(t)),this.notificationService.info(d(11581,null)))}}};UNe=I([m(1,Ui),m(2,$e),m(3,Ne),m(4,Go)],UNe);var zNe=class extends UNe{constructor(e,t,o,n,r,s,l,c,u){super("workbench.extensions.actions.installLocalExtensionsInRemote",e,t,n,o);this.extensionManagementServerService=r;this.extensionGalleryService=s;this.instantiationService=l;this.fileService=c;this.logService=u}get label(){return this.extensionManagementServerService&&this.extensionManagementServerService.remoteExtensionManagementServer?d(11639,null,this.extensionManagementServerService.remoteExtensionManagementServer.label):""}getQuickPickTitle(){return d(11597,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)}getExtensionsToInstall(e){return e.filter(t=>{let o=this.instantiationService.createInstance(kQ,!0);return o.extension=t,o.enabled})}async installExtensions(e){let t=[],o=[],n=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getTargetPlatform();await vn.settled(e.map(async r=>{if(this.extensionGalleryService.isEnabled()){let l=(await this.extensionGalleryService.getExtensions([{...r.identifier,preRelease:!!r.local?.preRelease}],{targetPlatform:n,compatible:!0},Ie.None))[0];if(l){t.push(l);return}}let s=await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.zip(r.local);o.push(s)})),await vn.settled(t.map(r=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(r)));try{await vn.settled(o.map(r=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.install(r)))}finally{try{await Promise.allSettled(o.map(r=>this.fileService.del(r)))}catch(r){this.logService.error(r)}}}};zNe=I([m(0,Ui),m(1,$e),m(2,Go),m(3,Ne),m(4,$c),m(5,ga),m(6,F),m(7,ge),m(8,re)],zNe);var KNe=class extends UNe{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,r,n);this.extensionManagementServerService=s;this.extensionGalleryService=l;this.fileService=c;this.logService=u}get label(){return d(11640,null)}getQuickPickTitle(){return d(11605,null)}getExtensionsToInstall(e){return e.filter(t=>t.type===1&&t.server!==this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionsWorkbenchService.installed.some(o=>o.server===this.extensionManagementServerService.localExtensionManagementServer&&Ht(o.identifier,t.identifier)))}async installExtensions(e){let t=[],o=[],n=await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getTargetPlatform();await vn.settled(e.map(async r=>{if(this.extensionGalleryService.isEnabled()){let l=(await this.extensionGalleryService.getExtensions([{...r.identifier,preRelease:!!r.local?.preRelease}],{targetPlatform:n,compatible:!0},Ie.None))[0];if(l){t.push(l);return}}let s=await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.zip(r.local);o.push(s)})),await vn.settled(t.map(r=>this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromGallery(r)));try{await vn.settled(o.map(r=>this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.install(r)))}finally{try{await Promise.allSettled(o.map(r=>this.fileService.del(r)))}catch(r){this.logService.error(r)}}}};KNe=I([m(1,Ui),m(2,$e),m(3,Go),m(4,Ne),m(5,$c),m(6,ga),m(7,ge),m(8,re)],KNe);Ge.registerCommand("workbench.extensions.action.showExtensionsForLanguage",function(a,i){return a.get(Ui).openSearch(`ext:${i.replace(/^\./,"")}`)});var jNe="workbench.extensions.action.showExtensionsWithIds";Ge.registerCommand(jNe,function(a,i){return a.get(Ui).openSearch(i.map(t=>`@id:${t}`).join(" "))});te("extensionButton.background",{dark:_5,light:_5,hcDark:null,hcLight:null},d(11573,null));te("extensionButton.foreground",{dark:Gce,light:Gce,hcDark:null,hcLight:null},d(11575,null));te("extensionButton.hoverBackground",{dark:qce,light:qce,hcDark:null,hcLight:null},d(11576,null));te("extensionButton.border",{dark:dX,light:dX,hcDark:Ei,hcLight:Ei},d(11574,null));te("extensionButton.separator",lyt,d(11580,null));var GIo=te("extensionButton.prominentBackground",{dark:th,light:th,hcDark:null,hcLight:null},d(11577,null));te("extensionButton.prominentForeground",{dark:Fk,light:Fk,hcDark:null,hcLight:null},d(11578,null));te("extensionButton.prominentHoverBackground",{dark:T5,light:T5,hcDark:null,hcLight:null},d(11579,null));hs((a,i)=>{let e=a.getColor($v);e&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(cI)} { color: ${e}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(cI)} { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(cI)} { color: ${e}; }`));let t=a.getColor(Tg);t&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(fp)} { color: ${t}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(fp)} { color: ${t}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(fp)} { color: ${t}; }`));let o=a.getColor(eh);o&&(i.addRule(`.extension-editor .header .actions-status-container > .status ${q.asCSSSelector(Ef)} { color: ${o}; }`),i.addRule(`.extension-editor .body .subcontent .runtime-status ${q.asCSSSelector(Ef)} { color: ${o}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(Ef)} { color: ${o}; }`))});var Zsn="NotebookEditorViewState",UR=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(UR.ID,e,t,o,r);this._instantiationService=n;this._editorService=s;this._editorGroupService=l;this._notebookWidgetService=c;this._contextKeyService=u;this._fileService=p;this._editorProgressService=g;this._notebookService=f;this._extensionsWorkbenchService=v;this._workingCopyBackupService=b;this.logService=S;this._preferencesService=y;this._groupListener=this._register(new O);this._widgetDisposableStore=this._register(new O);this._widget={value:void 0};this._inputListener=this._register(new ue);this._onDidFocusWidget=this._register(new T);this._onDidBlurWidget=this._register(new T);this._onDidChangeModel=this._register(new T);this.onDidChangeModel=this._onDidChangeModel.event;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new T);this.onDidChangeScroll=this._onDidChangeScroll.event;this._editorMemento=this.getEditorMemento(l,h,Zsn),this._register(this._fileService.onDidChangeFileSystemProviderCapabilities(w=>this._onDidChangeFileSystemProvider(w.scheme))),this._register(this._fileService.onDidChangeFileSystemProviderRegistrations(w=>this._onDidChangeFileSystemProvider(w.scheme)))}static{this.ID=_M}get onDidFocus(){return this._onDidFocusWidget.event}get onDidBlur(){return this._onDidBlurWidget.event}_onDidChangeFileSystemProvider(e){this.input instanceof Ga&&this.input.resource?.scheme===e&&this._updateReadonly(this.input)}_onDidChangeInputCapabilities(e){this.input===e&&this._updateReadonly(e)}_updateReadonly(e){this._widget.value?.setOptions({isReadOnly:!!e.isReadonly()})}get textModel(){return this._widget.value?.textModel}get minimumWidth(){return 220}get maximumWidth(){return Number.POSITIVE_INFINITY}set minimumWidth(e){}set maximumWidth(e){}get scopedContextKeyService(){return this._widget.value?.scopedContextKeyService}createEditor(e){this._rootElement=D(e,_(".notebook-editor")),this._rootElement.id=`notebook-editor-element-${ht()}`}getActionViewItem(e,t){if(e.id===D_)return this._register(this._instantiationService.createInstance(qU,e,this,t))}getControl(){return this._widget.value}setVisible(e){super.setVisible(e),e||this._widget.value?.onWillHide()}setEditorVisible(e){super.setEditorVisible(e),this._groupListener.clear(),this._groupListener.add(this.group.onWillCloseEditor(t=>this._saveEditorViewState(t.editor))),this._groupListener.add(this.group.onDidModelChange(()=>{this._editorGroupService.activeGroup!==this.group&&this._widget?.value?.updateEditorFocus()})),e||(this._saveEditorViewState(this.input),this.input&&this._widget.value&&this._widget.value.onWillHide())}focus(){super.focus(),this._widget.value?.focus()}hasFocus(){let e=this._widget.value;return e?!!e&&Is(e.getDomNode()||Is(e.getOverflowContainerDomNode())):!1}async setInput(e,t,o,n,r){try{let s=!1,l=Li(1e4);l.then(()=>{s=!0,this._handlePerfMark(c,e)});let c=new WKt;c.mark("startTime"),this._inputListener.value=e.onDidChangeCapabilities(()=>this._onDidChangeInputCapabilities(e)),this._widgetDisposableStore.clear(),this._widget.value?.onWillHide(),this._widget=this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget,this.group.id,e,void 0,this._pagePosition?.dimension,this.window),this._rootElement&&this._widget.value.getDomNode()&&(this._rootElement.setAttribute("aria-flowto",this._widget.value.getDomNode().id||""),AL(this._widget.value.getDomNode(),this._rootElement)),this._widgetDisposableStore.add(this._widget.value.onDidChangeModel(()=>this._onDidChangeModel.fire())),this._widgetDisposableStore.add(this._widget.value.onDidChangeActiveCell(()=>this._onDidChangeSelection.fire({reason:2}))),this._pagePosition&&this._widget.value.layout(this._pagePosition.dimension,this._rootElement,this._pagePosition.position),await super.setInput(e,t,o,n);let u=await e.resolve(t,c);if(c.mark("inputLoaded"),n.isCancellationRequested)return;if(!this._widget.value)return r?void 0:this.setInput(e,t,o,n,!0);if(u===null){let g=this._notebookService.getViewTypeProvider(e.viewType);if(!g)throw new Error(d(13827,null,e.viewType));await this._extensionsWorkbenchService.whenInitialized;let f=this._extensionsWorkbenchService.local.find(v=>v.identifier.id===g);throw b3(new Error(d(13828,null,e.viewType)),[li({id:"workbench.notebook.action.installOrEnableMissing",label:f?d(13830,null,e.viewType):d(13831,null,e.viewType),run:async()=>{let v=this._notebookService.onAddViewType(S=>{S===e.viewType&&(this._editorService.openEditor({resource:e.resource}),v.dispose())}),b=this._extensionsWorkbenchService.local.find(S=>S.identifier.id===g);try{b?await this._extensionsWorkbenchService.setEnablement(b,b.enablementState===11?13:12):await this._instantiationService.createInstance(tO,g).run()}catch(S){this.logService.error(`Failed to install or enable extension ${g}`,S),v.dispose()}}}),li({id:"workbench.notebook.action.openAsText",label:d(13829,null),run:async()=>{let v=await this._workingCopyBackupService.resolve({resource:e.resource,typeId:E0.create(e.viewType)});if(v){let b=await yI(v.value);this._editorService.openEditor({resource:void 0,contents:b.toString()})}else this._editorService.openEditor({resource:e.resource,options:{override:Da.id,pinned:!0}})}})],{allowDialog:!0})}this._widgetDisposableStore.add(u.notebook.onDidChangeContent(()=>this._onDidChangeSelection.fire({reason:3})));let p=t?.viewState??this._loadNotebookEditorViewState(e);this._widget.value.setParentContextKeyService(this._contextKeyService),this._widget.value.setEditorProgressService(this._editorProgressService),await this._widget.value.setModel(u.notebook,p,c);let h=!!e.isReadonly();if(await this._widget.value.setOptions({...t,isReadOnly:h}),this._widgetDisposableStore.add(this._widget.value.onDidFocusWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._widget.value.onDidBlurWidget(()=>this._onDidBlurWidget.fire())),this._widgetDisposableStore.add(this._editorGroupService.createEditorDropTarget(this._widget.value.getDomNode(),{containsGroup:g=>this.group.id===g.id})),this._widgetDisposableStore.add(this._widget.value.onDidScroll(()=>{this._onDidChangeScroll.fire()})),c.mark("editorLoaded"),l.cancel(),s)return;this._handlePerfMark(c,e,u.notebook),this._onDidChangeControl.fire()}catch(s){if(this.logService.warn("NotebookEditorWidget#setInput failed",s),v3(s))throw s;if(s.fileOperationResult===7){let c;throw s instanceof NF?c=d(13834,null,Ml.formatSize(s.size)):c=d(13833,null),A_e(this.group,e,t,c,this._preferencesService)}throw b3(s instanceof Error?s:new Error(s?s.message:""),[li({id:"workbench.notebook.action.openInTextEditor",label:d(13832,null),run:async()=>{let c=this._editorService.activeEditorPane;if(!c)return;let u=po.getCanonicalUri(c.input);if(u&&u.toString()===e.resource?.toString())return this._editorService.openEditor({resource:u,options:{override:Da.id,pinned:!0}})}})],{allowDialog:!0})}}_handlePerfMark(e,t,o){let n=e.value,r=n.startTime,s=n.extensionActivated,l=n.inputLoaded,c=n.webviewCommLoaded,u=n.customMarkdownLoaded,p=n.editorLoaded,h=-1,g=-1,f=-1,v=-1,b=-1;r!==void 0&&s!==void 0&&(h=s-r,l!==void 0&&(g=l-s),c!==void 0&&(f=c-s),u!==void 0&&(v=u-r),p!==void 0&&(b=p-r));let S,y,w,x,E,M,N;if(o){let V=new On;for(let H of o.cells)H.cellKind===2?(S=(S||0)+1,E=(E||0)+H.getTextLength(),w=(w||0)+H.outputs.length,x=(x||0)+H.outputs.reduce((K,j)=>K+j.outputs.reduce((J,se)=>J+se.data.byteLength,0),0)):(y=(y||0)+1,M=(E||0)+H.getTextLength());N=V.elapsed()}this.logService.trace(`[NotebookEditor] open notebook perf ${o?.uri.toString()??""} - extensionActivation: ${h}, inputLoad: ${g}, webviewComm: ${f}, customMarkdown: ${v}, editorLoad: ${b}`),this.telemetryService.publicLog2("notebook/editorOpenPerf",{scheme:t.resource.scheme,ext:Ts(t.resource),viewType:t.viewType,extensionActivated:h,inputLoaded:g,webviewCommLoaded:f,customMarkdownLoaded:v,editorLoaded:b,codeCellCount:S,mdCellCount:y,outputCount:w,outputBytes:x,codeLength:E,markdownLength:M,notebookStatsLoaded:N})}clearInput(){this._inputListener.clear(),this._widget.value&&(this._saveEditorViewState(this.input),this._widget.value.onWillHide()),super.clearInput()}setOptions(e){this._widget.value?.setOptions(e),super.setOptions(e)}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof Ga)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}getSelection(){if(this._widget.value){let e=this._widget.value.getActiveCell();if(e){let t=e.uri;return new CLi(t,e.getSelections())}}}getScrollPosition(){let e=this.getControl();if(!e)throw new Error("Notebook widget has not yet been initialized");return{scrollTop:e.scrollTop,scrollLeft:0}}setScrollPosition(e){let t=this.getControl();if(!t)throw new Error("Control has not yet been initialized");t.setScrollTop(e.scrollTop)}_saveEditorViewState(e){if(this._widget.value&&e instanceof Ga){if(this._widget.value.isDisposed)return;let t=this._widget.value.getEditorViewState();this._editorMemento.saveEditorState(this.group,e.resource,t)}}_loadNotebookEditorViewState(e){let t=this._editorMemento.loadEditorState(this.group,e.resource);if(t)return t;for(let o of this._editorGroupService.getGroups(1))if(o.activeEditorPane!==this&&o.activeEditorPane instanceof UR&&o.activeEditor?.matches(e))return o.activeEditorPane._widget.value?.getEditorViewState()}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600),this._pagePosition={dimension:e,position:t},!(!this._widget.value||!(this.input instanceof Ga))&&(this.input.resource.toString()!==this.textModel?.uri.toString()&&this._widget.value?.hasModel()||this.isVisible()&&this._widget.value.layout(e,this._rootElement,t))}};UR=I([m(1,_e),m(2,Pe),m(3,F),m(4,de),m(5,ie),m(6,kt),m(7,hd),m(8,X),m(9,ge),m(10,Gn),m(11,Hd),m(12,kn),m(13,Ui),m(14,Om),m(15,re),m(16,Qo)],UR);var CLi=class a{constructor(i,e){this.cellUri=i;this.selections=e}compare(i){return i instanceof a?ze(this.cellUri,i.cellUri)?1:3:3}restore(i){let e={cellOptions:{resource:this.cellUri,options:{selection:this.selections[0]}}};return Object.assign(e,i),e}log(){return this.cellUri.fragment}};function qIo(a,i){if(a?.getId()===UR.ID){let e=a.getControl();if(e){for(let[t,o]of e.codeEditors)if(o===i)return!0}}return!1}var jge=Object.freeze({type:"type",displayName:"displayName",selector:"selector",priority:"priority"}),oO=Object.freeze({id:"id",displayName:"displayName",mimeTypes:"mimeTypes",entrypoint:"entrypoint",hardDependencies:"dependencies",optionalDependencies:"optionalDependencies",requiresMessaging:"requiresMessaging"}),Fnt=Object.freeze({type:"type",entrypoint:"entrypoint",localResourceRoots:"localResourceRoots"}),tan={description:d(13859,null),type:"array",defaultSnippets:[{body:[{type:"",displayName:"",selector:[{filenamePattern:""}]}]}],items:{type:"object",required:[jge.type,jge.displayName,jge.selector],properties:{[jge.type]:{type:"string",description:d(13863,null)},[jge.displayName]:{type:"string",description:d(13860,null)},[jge.selector]:{type:"array",description:d(13861,null),items:{type:"object",properties:{filenamePattern:{type:"string",description:d(13862,null)},excludeFileNamePattern:{type:"string",description:d(13876,null)}}}},[jge.priority]:{type:"string",markdownDeprecationMessage:d(13881,null),enum:["default","option"],markdownEnumDescriptions:[d(13882,null),d(13883,null)],default:"default"}}}},$Io=Object.freeze({id:"",displayName:"",mimeTypes:[""],entrypoint:""}),ian={description:d(13864,null),type:"array",defaultSnippets:[{body:[$Io]}],items:{defaultSnippets:[{body:$Io}],allOf:[{type:"object",required:[oO.id,oO.displayName],properties:{[oO.id]:{type:"string",description:d(13874,null)},[oO.displayName]:{type:"string",description:d(13865,null)},[oO.hardDependencies]:{type:"array",uniqueItems:!0,items:{type:"string"},markdownDescription:d(13868,null)},[oO.optionalDependencies]:{type:"array",uniqueItems:!0,items:{type:"string"},markdownDescription:d(13869,null)},[oO.requiresMessaging]:{default:"never",enum:["always","optional","never"],enumDescriptions:[d(13871,null),d(13873,null),d(13872,null)],description:d(13870,null)}}},{oneOf:[{required:[oO.entrypoint,oO.mimeTypes],properties:{[oO.mimeTypes]:{type:"array",description:d(13875,null),items:{type:"string"}},[oO.entrypoint]:{description:d(13866,null),type:"string"}}},{required:[oO.entrypoint],properties:{[oO.entrypoint]:{description:d(13866,null),type:"object",required:["extends","path"],properties:{extends:{type:"string",description:d(13867,null)},path:{type:"string",description:d(13866,null)}}}}}]}]}},oan={description:d(13879,null),type:"array",defaultSnippets:[{body:[{type:"",entrypoint:""}]}],items:{type:"object",required:[Fnt.type,Fnt.entrypoint],properties:{[Fnt.type]:{type:"string",description:d(13880,null)},[Fnt.entrypoint]:{type:"string",description:d(13877,null)},[Fnt.localResourceRoots]:{type:"array",items:{type:"string"},description:d(13878,null)}}}},jIo=zn.registerExtensionPoint({extensionPoint:"notebooks",jsonSchema:tan,activationEventsGenerator:function*(a){for(let i of a)i.type&&(yield`onNotebookSerializer:${i.type}`)}}),QIo=zn.registerExtensionPoint({extensionPoint:"notebookRenderer",jsonSchema:ian,activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onRenderer:${i.id}`)}}),YIo=zn.registerExtensionPoint({extensionPoint:"notebookPreload",jsonSchema:oan}),xLi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.notebooks}render(e){let t=e.contributes?.notebooks||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(13884,null),d(13886,null)],n=t.sort((r,s)=>r.type.localeCompare(s.type)).map(r=>[r.type,r.displayName]);return{data:{headers:o,rows:n},dispose:()=>{}}}},kLi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.notebookRenderer}render(e){let t=e.contributes?.notebookRenderer||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(13887,null),d(13885,null)],n=t.sort((r,s)=>r.displayName.localeCompare(s.displayName)).map(r=>[r.displayName,r.mimeTypes.join(",")]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"notebooks",label:d(13889,null),access:{canToggle:!1},renderer:new Vt(xLi)});oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"notebookRenderer",label:d(13888,null),access:{canToggle:!1},renderer:new Vt(kLi)});var ELi=class extends Zh{constructor(e,t){super();this.original=e;this.modified=t}},VC=class extends Ba{constructor(e,t,o,n,r,s){super(e,t,o,n,void 0,s);this.original=o;this.modified=n;this.viewType=r;this._modifiedTextModel=null;this._originalTextModel=null;this._cachedModel=void 0}static create(e,t,o,n,r,s){let l=Ga.getOrCreate(e,r,void 0,s),c=Ga.getOrCreate(e,t,void 0,s);return e.createInstance(VC,o,n,l,c,s)}static{this.ID="workbench.input.diffNotebookInput"}get resource(){return this.modified.resource}get editorId(){return this.viewType}get typeId(){return VC.ID}async resolve(){let[e,t]=await Promise.all([this.original.resolve(),this.modified.resolve()]);if(this._cachedModel?.dispose(),!t)throw new Error(`Fail to resolve modified editor model for resource ${this.modified.resource} with notebookType ${this.viewType}`);if(!e)throw new Error(`Fail to resolve original editor model for resource ${this.original.resource} with notebookType ${this.viewType}`);return this._originalTextModel=e,this._modifiedTextModel=t,this._cachedModel=new ELi(this._originalTextModel,this._modifiedTextModel),this._cachedModel}toUntyped(){let e={resource:this.original.resource},t={resource:this.resource};return{original:e,modified:t,primary:t,secondary:e,options:{override:this.viewType}}}matches(e){return this===e?!0:e instanceof VC?this.modified.matches(e.modified)&&this.original.matches(e.original)&&this.viewType===e.viewType:Ug(e)?this.modified.matches(e.modified)&&this.original.matches(e.original)&&this.editorId!==void 0&&(this.editorId===e.options?.override||e.options?.override===void 0):!1}dispose(){super.dispose(),this._cachedModel?.dispose(),this._cachedModel=void 0,this.original.dispose(),this.modified.dispose(),this._originalTextModel=null,this._modifiedTextModel=null}};VC=I([m(5,ie)],VC);var UKt=class{constructor(i,e,t,o,n,r,s){this.resource=i;this.fromIndex=e;this.length=t;this.toIndex=o;this.editingDelegate=n;this.beforedSelections=r;this.endSelections=s;this.type=0;this.code="undoredo.textBufferEdit"}get label(){return this.length===1?"Move Cell":"Move Cells"}undo(){if(!this.editingDelegate.moveCell)throw new Error("Notebook Move Cell not implemented for Undo/Redo");this.editingDelegate.moveCell(this.toIndex,this.length,this.fromIndex,this.endSelections,this.beforedSelections)}redo(){if(!this.editingDelegate.moveCell)throw new Error("Notebook Move Cell not implemented for Undo/Redo");this.editingDelegate.moveCell(this.fromIndex,this.length,this.toIndex,this.beforedSelections,this.endSelections)}},zKt=class{constructor(i,e,t,o,n){this.resource=i;this.diffs=e;this.editingDelegate=t;this.beforeHandles=o;this.endHandles=n;this.type=0;this.code="undoredo.textBufferEdit"}get label(){return this.diffs.length===1&&this.diffs[0][1].length===0?this.diffs[0][2].length>1?"Insert Cells":"Insert Cell":this.diffs.length===1&&this.diffs[0][2].length===0?this.diffs[0][1].length>1?"Delete Cells":"Delete Cell":"Insert Cell"}undo(){if(!this.editingDelegate.replaceCell)throw new Error("Notebook Replace Cell not implemented for Undo/Redo");this.diffs.forEach(i=>{this.editingDelegate.replaceCell(i[0],i[2].length,i[1],this.beforeHandles)})}redo(){if(!this.editingDelegate.replaceCell)throw new Error("Notebook Replace Cell not implemented for Undo/Redo");this.diffs.reverse().forEach(i=>{this.editingDelegate.replaceCell(i[0],i[1].length,i[2],this.endHandles)})}},KKt=class{constructor(i,e,t,o,n){this.resource=i;this.index=e;this.oldMetadata=t;this.newMetadata=o;this.editingDelegate=n;this.type=0;this.label="Update Cell Metadata";this.code="undoredo.textBufferEdit"}undo(){this.editingDelegate.updateCellMetadata&&this.editingDelegate.updateCellMetadata(this.index,this.oldMetadata)}redo(){this.editingDelegate.updateCellMetadata&&this.editingDelegate.updateCellMetadata(this.index,this.newMetadata)}};var jie=class extends k{constructor(e){super();this._rawOutput=e;this._onDidChangeData=this._register(new T);this.onDidChangeData=this._onDidChangeData.event;this._versionId=0;this.versionedBufferLengths={};this._alternativeOutputId=this._rawOutput.outputId}get outputs(){return this._rawOutput.outputs||[]}get metadata(){return this._rawOutput.metadata}get outputId(){return this._rawOutput.outputId}get alternativeOutputId(){return this._alternativeOutputId}get versionId(){return this._versionId}replaceData(e){this.versionedBufferLengths={},this._rawOutput=e,this.optimizeOutputItems(),this._versionId=this._versionId+1,this._onDidChangeData.fire()}appendData(e){this.trackBufferLengths(),this._rawOutput.outputs.push(...e),this.optimizeOutputItems(),this._versionId=this._versionId+1,this._onDidChangeData.fire()}trackBufferLengths(){this.outputs.forEach(e=>{FL(e.mime)&&(this.versionedBufferLengths[e.mime]||(this.versionedBufferLengths[e.mime]={}),this.versionedBufferLengths[e.mime][this.versionId]=e.data.byteLength)})}appendedSinceVersion(e,t){let o=this.versionedBufferLengths[t]?.[e],n=this.outputs.find(r=>r.mime===t);if(o&&n)return n.data.slice(o)}optimizeOutputItems(){if(this.outputs.length>1&&this.outputs.every(e=>FL(e.mime))){let e=new Map,t=[];this.outputs.forEach(o=>{let n;e.has(o.mime)?n=e.get(o.mime):(n=[],e.set(o.mime,n),t.push(o.mime)),n.push(o.data.buffer)}),this.outputs.length=0,t.forEach(o=>{let n=dro(e.get(o));this.outputs.push({mime:o,data:n.data}),n.didCompression&&(this.versionedBufferLengths={})})}}asDto(){return{metadata:this._rawOutput.metadata,outputs:this._rawOutput.outputs,outputId:this._rawOutput.outputId}}bumpVersion(){this._versionId=this._versionId+1}};var AQ=class a extends k{constructor(e,t,o,n,r,s,l,c=void 0,u){super();this.uri=e;this.handle=t;this.transientOptions=n;this._languageService=r;this._defaultEOL=s;this._languageDetectionService=c;this._notebookLoggingService=u;this._onDidChangeTextModel=this._register(new T);this.onDidChangeTextModel=this._onDidChangeTextModel.event;this._onDidChangeOutputs=this._register(new T);this.onDidChangeOutputs=this._onDidChangeOutputs.event;this._onDidChangeOutputItems=this._register(new T);this.onDidChangeOutputItems=this._onDidChangeOutputItems.event;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeMetadata=this._register(new T);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidChangeInternalMetadata=this._register(new T);this.onDidChangeInternalMetadata=this._onDidChangeInternalMetadata.event;this._onDidChangeLanguage=this._register(new T);this.onDidChangeLanguage=this._onDidChangeLanguage.event;this._textBufferHash=null;this._hash=null;this._versionId=1;this._alternativeId=1;this._textModelDisposables=this._register(new O);this._textModel=void 0;this.autoDetectLanguageThrottler=this._register(new Aa(a.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY));this._autoLanguageDetectionEnabled=!1;this._hasLanguageSetExplicitly=!1;this._source=o.source,this._language=o.language,this._mime=o.mime,this.cellKind=o.cellKind;let p=o.cellKind===2?l?.codeCell:l?.markupCell;this.collapseState=o.collapseState??p??void 0,this._outputs=o.outputs.map(h=>new jie(h)),this._metadata=o.metadata??{},this._internalMetadata=o.internalMetadata??{}}get outputs(){return this._outputs}get metadata(){return this._metadata}set metadata(e){this._metadata=e,this._hash=null,this._onDidChangeMetadata.fire()}get internalMetadata(){return this._internalMetadata}set internalMetadata(e){let t=this._internalMetadata.lastRunSuccess!==e.lastRunSuccess;e={...e,runStartTimeAdjustment:nan(this._internalMetadata,e)},this._internalMetadata=e,this._hash=null,this._onDidChangeInternalMetadata.fire({lastRunSuccessChanged:t})}get language(){return this._language}set language(e){this._textModel&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(e)&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(this.language)||(this._hasLanguageSetExplicitly=!0,this._setLanguageInternal(e))}get mime(){return this._mime}set mime(e){this._mime!==e&&(this._mime=e,this._hash=null,this._onDidChangeContent.fire("mime"))}get textBuffer(){return this._textBuffer?this._textBuffer:(this._textBuffer=this._register(xK(this._source,this._defaultEOL).textBuffer),this._register(this._textBuffer.onDidChangeContent(()=>{this._hash=null,this._textModel||this._onDidChangeContent.fire("content"),this.autoDetectLanguage()})),this._textBuffer)}get alternativeId(){return this._alternativeId}get textModel(){return this._textModel}set textModel(e){this._textModel!==e&&(this._textModelDisposables.clear(),this._textModel=e,this._textModel&&(this.setRegisteredLanguage(this._languageService,this._textModel.getLanguageId(),this.language),this._textModelDisposables.add(this._textModel.onDidChangeLanguage(t=>this.setRegisteredLanguage(this._languageService,t.newLanguage,this.language))),this._textModelDisposables.add(this._textModel.onWillDispose(()=>this.textModel=void 0)),this._textModelDisposables.add(this._textModel.onDidChangeContent(t=>{this._textModel&&(this._versionId=this._textModel.getVersionId(),this._alternativeId=this._textModel.getAlternativeVersionId()),this._textBufferHash=null,this._onDidChangeContent.fire("content"),this._onDidChangeContent.fire({type:"model",event:t})})),this._textModel._overwriteVersionId(this._versionId),this._textModel._overwriteAlternativeVersionId(this._versionId),this._onDidChangeTextModel.fire()))}setRegisteredLanguage(e,t,o){let n=t===es||t==="jupyter";!e.isRegisteredLanguageId(o)&&n?this._onDidChangeLanguage.fire(o):this.language=t}static{this.AUTO_DETECT_LANGUAGE_THROTTLE_DELAY=600}get hasLanguageSetExplicitly(){return this._hasLanguageSetExplicitly}enableAutoLanguageDetection(){this._autoLanguageDetectionEnabled=!0,this.autoDetectLanguage()}async autoDetectLanguage(){this._autoLanguageDetectionEnabled&&this.autoDetectLanguageThrottler.trigger(()=>this._doAutoDetectLanguage())}async _doAutoDetectLanguage(){if(this.hasLanguageSetExplicitly)return;let e=await this._languageDetectionService?.detectLanguage(this.uri);e&&(this._textModel&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(e)&&this._textModel.getLanguageId()===this._languageService.getLanguageIdByLanguageName(this.language)||this._setLanguageInternal(e))}_setLanguageInternal(e){let t=this._languageService.getLanguageIdByLanguageName(e);if(t!==null){if(this._textModel){let o=this._languageService.createById(t);this._textModel.setLanguage(o.languageId)}this._language!==e&&(this._language=e,this._hash=null,this._onDidChangeLanguage.fire(e),this._onDidChangeContent.fire("language"))}}resetTextBuffer(e){this._textBuffer=e}getValue(){let e=this.getFullModelRange();return this.textBuffer.getEOL()===`
`?this.textBuffer.getValueInRange(e,1):this.textBuffer.getValueInRange(e,2)}getTextBufferHash(){if(this._textBufferHash!==null)return this._textBufferHash;let e=new wI,t=this.textBuffer.createSnapshot(!1),o;for(;o=t.read();)e.update(o);return this._textBufferHash=e.digest(),this._textBufferHash}getHashValue(){return this._hash!==null?this._hash:(this._hash=Lr([Lr(this.language),this.getTextBufferHash(),this._getPersisentMetadata(),this.transientOptions.transientOutputs?[]:this._outputs.map(e=>({outputs:e.outputs.map(t=>({mime:t.mime,data:Array.from(t.data.buffer)})),metadata:e.metadata}))]),this._hash)}_getPersisentMetadata(){return Dq(this.transientOptions.transientCellMetadata,this.metadata,this.language)}getTextLength(){return this.textBuffer.getLength()}getFullModelRange(){let e=this.textBuffer.getLineCount();return new G(1,1,e,this.textBuffer.getLineLength(e)+1)}spliceNotebookCellOutputs(e){if(this._notebookLoggingService.trace("textModelEdits",`splicing outputs at ${e.start} length: ${e.deleteCount} with ${e.newOutputs.length} new outputs`),e.deleteCount>0&&e.newOutputs.length>0){let t=Math.min(e.deleteCount,e.newOutputs.length);for(let n=0;n<t;n++){let r=this.outputs[e.start+n],s=e.newOutputs[n];this.replaceOutput(r.outputId,s)}this.outputs.splice(e.start+t,e.deleteCount-t,...e.newOutputs.slice(t)).forEach(n=>n.dispose()),this._onDidChangeOutputs.fire({start:e.start+t,deleteCount:e.deleteCount-t,newOutputs:e.newOutputs.slice(t)})}else this.outputs.splice(e.start,e.deleteCount,...e.newOutputs).forEach(o=>o.dispose()),this._onDidChangeOutputs.fire(e)}replaceOutput(e,t){let o=this.outputs.findIndex(r=>r.outputId===e);return o<0?!1:(this._notebookLoggingService.trace("textModelEdits",`replacing an output item at index ${o}`),this.outputs[o].replaceData({outputs:t.outputs,outputId:t.outputId,metadata:t.metadata}),t.dispose(),this._onDidChangeOutputItems.fire(),!0)}changeOutputItems(e,t,o){let n=this.outputs.findIndex(s=>s.outputId===e);if(n<0)return!1;let r=this.outputs[n];return this._notebookLoggingService.trace("textModelEdits",`${t?"appending":"replacing"} ${o.length} output items to for output index ${n}`),t?r.appendData(o):r.replaceData({outputId:e,outputs:o,metadata:r.metadata}),this._onDidChangeOutputItems.fire(),!0}_outputNotEqualFastCheck(e,t){if(e.length!==t.length)return!1;for(let o=0;o<this.outputs.length;o++){let n=e[o],r=t[o];if(n.outputs.length!==r.outputs.length)return!1;for(let s=0;s<n.outputs.length;s++)if(n.outputs[s].mime!==r.outputs[s].mime||n.outputs[s].data.byteLength!==r.outputs[s].data.byteLength)return!1}return!0}equal(e){return this.language!==e.language||this.outputs.length!==e.outputs.length||this.getTextLength()!==e.getTextLength()||!this.transientOptions.transientOutputs&&!this._outputNotEqualFastCheck(this.outputs,e.outputs)?!1:this.getHashValue()===e.getHashValue()}fastEqual(e,t){if(this.language!==e.language||this.mime!==e.mime||this.cellKind!==e.cellKind||!t&&(this.internalMetadata?.executionOrder!==e.internalMetadata?.executionOrder||this.internalMetadata?.lastRunSuccess!==e.internalMetadata?.lastRunSuccess||this.internalMetadata?.runStartTime!==e.internalMetadata?.runStartTime||this.internalMetadata?.runStartTimeAdjustment!==e.internalMetadata?.runStartTimeAdjustment||this.internalMetadata?.runEndTime!==e.internalMetadata?.runEndTime))return!1;if(this._textBuffer){if(!a.linesAreEqual(this.textBuffer.getLinesContent(),e.source))return!1}else if(this._source!==e.source)return!1;return!0}static linesAreEqual(e,t){let o=Hc(t);if(e.length!==o.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==o[n])return!1;return!0}dispose(){je(this._outputs);let e=new PX([],"",`
`,!1,!1,!0,!0);e.dispose(),this._textBuffer=e,super.dispose()}};function _q(a){return{source:a.getValue(),language:a.language,mime:a.mime,cellKind:a.cellKind,outputs:a.outputs.map(i=>({outputs:i.outputs,outputId:ht()})),metadata:{}}}function nan(a,i){if(a.runStartTime!==i.runStartTime&&typeof i.runStartTime=="number"){let e=Date.now()-i.runStartTime;return e<0?Math.abs(e):0}else return i.runStartTimeAdjustment}function Dq(a,i,e,t){let o={};if(a){let s=new Set([...Object.keys(i)]);for(let l of s)a[l]||(o[l]=i[l])}else o=i;let n={language:e,...o};return e&&(n.language=e),dW(t?TLi(n):n,{})}function TLi(a){return Array.isArray(a)?a.map(TLi):a!=null&&typeof a=="object"&&Object.keys(a).length>0?Object.keys(a).sort().reduce((i,e)=>(i[e]=TLi(a[e]),i),{}):a}var _Li=class{constructor(i,e,t,o,n,r){this.textModel=i;this.undoRedoGroup=e;this._pauseableEmitter=t;this._postUndoRedo=o;this.tag="notebookUndoRedoElement";this._operations=[];this._beginSelectionState=void 0;this._resultSelectionState=void 0;this.type=1,this._beginSelectionState=n,this._beginAlternativeVersionId=r,this._resultAlternativeVersionId=r}get code(){return this._operations.length===1?this._operations[0].code:"undoredo.notebooks.stackOperation"}get label(){return this._operations.length===1?this._operations[0].label:"edit"}get resources(){return[this.textModel.uri]}get isEmpty(){return this._operations.length===0}pushEndState(i,e){this._resultAlternativeVersionId=i,this._resultSelectionState=e||this._resultSelectionState}pushEditOperation(i,e,t,o){this._operations.length===0&&(this._beginSelectionState=this._beginSelectionState??e),this._operations.push(i),this._resultSelectionState=t,this._resultAlternativeVersionId=o}async undo(){this._pauseableEmitter.pause();try{for(let i=this._operations.length-1;i>=0;i--)await this._operations[i].undo();this._postUndoRedo(this._beginAlternativeVersionId),this._pauseableEmitter.fire({rawEvents:[],synchronous:void 0,versionId:this.textModel.versionId,endSelectionState:this._beginSelectionState})}finally{this._pauseableEmitter.resume()}}async redo(){this._pauseableEmitter.pause();try{for(let i=0;i<this._operations.length;i++)await this._operations[i].redo();this._postUndoRedo(this._resultAlternativeVersionId),this._pauseableEmitter.fire({rawEvents:[],synchronous:void 0,versionId:this.textModel.versionId,endSelectionState:this._resultSelectionState})}finally{this._pauseableEmitter.resume()}}},DLi=class{constructor(i,e,t,o){this._textModel=i;this._undoService=e;this._pauseableEmitter=t;this._postUndoRedo=o;this._pendingStackOperation=null;this._isAppending=!1}isUndoStackEmpty(){return this._pendingStackOperation===null||this._pendingStackOperation.isEmpty}pushStackElement(i,e){this._pendingStackOperation&&!this._pendingStackOperation.isEmpty&&(this._pendingStackOperation.pushEndState(i,e),this._isAppending||this._undoService.pushElement(this._pendingStackOperation,this._pendingStackOperation.undoRedoGroup)),this._isAppending=!1,this._pendingStackOperation=null}_getOrCreateEditStackElement(i,e,t){return this._pendingStackOperation??=new _Li(this._textModel,e,this._pauseableEmitter,this._postUndoRedo,i,t||"")}appendPreviousOperation(){let i=this._undoService.getLastElement(this._textModel.uri);return i&&i.tag==="notebookUndoRedoElement"?(this._pendingStackOperation=i,this._isAppending=!0,!0):!1}pushEditOperation(i,e,t,o,n){this._getOrCreateEditStackElement(e,n,o).pushEditOperation(i,e,t,o)}},RLi=class extends Ih{get isEmpty(){return this._eventQueue.isEmpty()}isDirtyEvent(){for(let i of this._eventQueue)for(let e=0;e<i.rawEvents.length;e++)if(!i.rawEvents[e].transient)return!0;return!1}},Qie=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.viewType=e;this.uri=t;this._undoService=s;this._modelService=l;this._languageService=c;this._languageDetectionService=u;this._notebookExecutionStateService=p;this._notebookLoggingService=h;this._isDisposed=!1;this._onWillDispose=this._register(new T);this._onWillAddRemoveCells=this._register(new T);this._onDidChangeContent=this._register(new T);this.onWillDispose=this._onWillDispose.event;this.onWillAddRemoveCells=this._onWillAddRemoveCells.event;this.onDidChangeContent=this._onDidChangeContent.event;this._cellhandlePool=0;this._cellListeners=new Map;this._cells=[];this.metadata={};this.transientOptions={transientCellMetadata:{},transientDocumentMetadata:{},transientOutputs:!1,cellContentMetadata:{}};this._versionId=0;this._notebookSpecificAlternativeId=0;this._alternativeVersionId="1";this.newCellsFromLastEdit=new Set;this.transientOptions=r,this.metadata=n,this._initialize(o);let g=f=>{if(f.uri.scheme===Q.vscodeNotebookCell&&f instanceof Tp){let v=sn.parse(f.uri);if(v&&ze(v.notebook,this.uri)){let b=this._getCellIndexByHandle(v.handle);if(b>=0){let S=this.cells[b];S&&(S.textModel=f)}}}};this._register(l.onModelAdded(f=>g(f))),this._pauseableEmitter=this._register(new RLi({merge:f=>{let v=f[0],b=v.rawEvents,S=v.versionId,y=v.endSelectionState,w=v.synchronous;for(let x=1;x<f.length;x++)b.push(...f[x].rawEvents),S=f[x].versionId,y=f[x].endSelectionState!==void 0?f[x].endSelectionState:y,w=f[x].synchronous!==void 0?f[x].synchronous:w;return{rawEvents:b,versionId:S,endSelectionState:y,synchronous:w}}})),this._register(this._pauseableEmitter.event(f=>{f.rawEvents.length&&this._onDidChangeContent.fire(f)})),this._operationManager=new DLi(this,this._undoService,this._pauseableEmitter,f=>{this._increaseVersionId(!0),this._overwriteAlternativeVersionId(f)}),this._notebookLoggingService.trace("notebookTextModel",`Initialized notebook text model for ${t.toString()}`)}get length(){return this._cells.length}get cells(){return this._cells}get versionId(){return this._versionId}get alternativeVersionId(){return this._alternativeVersionId}get notebookType(){return this.viewType}setCellCollapseDefault(e){this._defaultCollapseConfig=e}_initialize(e,t){this._cells=[],this._versionId=0,this._notebookSpecificAlternativeId=0;let o=e.map(n=>{let r=this._cellhandlePool++,s=sn.generate(this.uri,r);return new AQ(s,r,n,this.transientOptions,this._languageService,this._modelService.getCreationOptions(n.language,s,!1).defaultEOL,this._defaultCollapseConfig,this._languageDetectionService,this._notebookLoggingService)});for(let n=0;n<o.length;n++){let r=o[n].onDidChangeContent(s=>{this._bindCellContentHandler(o[n],s)});this._cellListeners.set(o[n].handle,r),this._register(o[n])}this._cells.splice(0,0,...o),this._alternativeVersionId=this._generateAlternativeId(),t&&this._pauseableEmitter.fire({rawEvents:[{kind:100,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_bindCellContentHandler(e,t){switch(this._increaseVersionId(t==="content"||typeof t=="object"&&t.type==="model"),t){case"content":this._pauseableEmitter.fire({rawEvents:[{kind:10,index:this._getCellIndexByHandle(e.handle),transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;case"language":this._pauseableEmitter.fire({rawEvents:[{kind:5,index:this._getCellIndexByHandle(e.handle),language:e.language,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;case"mime":this._pauseableEmitter.fire({rawEvents:[{kind:13,index:this._getCellIndexByHandle(e.handle),mime:e.mime,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break;default:typeof t=="object"&&t.type==="model"&&this._pauseableEmitter.fire({rawEvents:[{kind:10,index:this._getCellIndexByHandle(e.handle),transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0});break}}_generateAlternativeId(){return`${this._notebookSpecificAlternativeId}_`+this.cells.map(e=>e.handle+","+e.alternativeId).join(";")}dispose(){this._isDisposed||(this._isDisposed=!0,this._onWillDispose.fire(),this._undoService.removeElements(this.uri),je(this._cellListeners.values()),this._cellListeners.clear(),je(this._cells),this._cells=[],super.dispose())}pushStackElement(){}_getCellIndexByHandle(e){return this.cells.findIndex(t=>t.handle===e)}_getCellIndexWithOutputIdHandleFromEdits(e,t){let o=t.find(n=>yo(n,{outputs:!0})&&n.outputs.some(r=>r.outputId===e));if(o){if(yo(o,{index:!0}))return o.index;if(yo(o,{handle:!0})){let n=this._getCellIndexByHandle(o.handle);return this._assertIndex(n),n}}return-1}_getCellIndexWithOutputIdHandle(e){return this.cells.findIndex(t=>!!t.outputs.find(o=>o.outputId===e))}reset(e,t,o){this.transientOptions=o;let r=this._notebookExecutionStateService.getCellExecutionsForNotebook(this.uri).filter(l=>l.state===3).map(l=>l.cellHandle),s=Qie.computeEdits(this,e,r);this.applyEdits([...s,{editType:5,metadata:t}],!0,void 0,()=>{},void 0,!1)}createSnapshot(e){let t=e.transientOptions??this.transientOptions,o={metadata:yA(this.metadata,r=>!t.transientDocumentMetadata[r]),cells:[]},n=0;for(let r of this.cells){let s={cellKind:r.cellKind,language:r.language,mime:r.mime,source:r.getValue(),outputs:[],internalMetadata:r.internalMetadata};if(e.context===2&&e.outputSizeLimit>0&&(r.outputs.forEach(l=>{l.outputs.forEach(c=>{n+=c.data.byteLength})}),n>e.outputSizeLimit))throw new Error("Notebook too large to backup");s.outputs=t.transientOutputs?[]:r.outputs,s.metadata=yA(r.metadata,l=>!t.transientCellMetadata[l]),o.cells.push(s)}return o}restoreSnapshot(e,t){this.reset(e.cells,e.metadata,t??this.transientOptions)}static computeEdits(e,t,o=[]){let n=[],r=c=>o.includes(c.handle),s=this._commonPrefix(e.cells,e.cells.length,0,t,t.length,0,r);if(s>0)for(let c=0;c<s;c++)n.push({editType:3,index:c,metadata:t[c].metadata??{}},...this._computeOutputEdit(c,e.cells[c].outputs,t[c].outputs));if(e.cells.length===t.length&&s===e.cells.length)return n;let l=this._commonSuffix(e.cells,e.cells.length-s,s,t,t.length-s,s,r);if(l>0?n.push({editType:1,index:s,count:e.cells.length-s-l,cells:t.slice(s,t.length-l)}):s>0?n.push({editType:1,index:s,count:e.cells.length-s,cells:t.slice(s)}):n.push({editType:1,index:0,count:e.cells.length,cells:t}),l>0)for(let c=l;c>0;c--)n.push({editType:3,index:e.cells.length-c,metadata:t[t.length-c].metadata??{}},...this._computeOutputEdit(e.cells.length-c,e.cells[e.cells.length-c].outputs,t[t.length-c].outputs));return n}static _computeOutputEdit(e,t,o){return t.length!==o.length?[{editType:2,index:e,outputs:o,append:!1}]:t.length===0?[]:o.map((n,r)=>({editType:7,outputId:t[r].outputId,items:n.outputs,append:!1}))}static _commonPrefix(e,t,o,n,r,s,l){let c=Math.min(t,r),u=0;for(let p=0;p<c&&e[o+p].fastEqual(n[s+p],l(e[o+p]));p++)u++;return u}static _commonSuffix(e,t,o,n,r,s,l){let c=Math.min(t,r),u=0;for(let p=0;p<c&&e[o+t-p-1].fastEqual(n[s+r-p-1],l(e[o+t-p-1]));p++)u++;return u}isOnlyEditingMetadataOnNewCells(e){for(let t of e)if(t.editType!==9&&(t.editType!==3&&t.editType!==8||yo(t,{index:!0})&&!this.newCellsFromLastEdit.has(this.cells[t.index].handle)||yo(t,{handle:!0})&&!this.newCellsFromLastEdit.has(t.handle)))return!1;return!0}applyEdits(e,t,o,n,r,s){this._notebookLoggingService.trace("textModelEdits",`Begin applying ${e.length} raw edits`),this._pauseableEmitter.pause();try{this._operationManager.pushStackElement(this._alternativeVersionId,void 0),s&&this.isOnlyEditingMetadataOnNewCells(e)?this._operationManager.appendPreviousOperation()||(s=!1):s&&this.newCellsFromLastEdit.clear();try{return this._doApplyEdits(e,t,s,o,r),!0}catch(l){throw this._notebookLoggingService.error("textModelEdits",`Error while applying edits: ${l}`),l}finally{if(!this._pauseableEmitter.isEmpty){let l=n();this._increaseVersionId(this._operationManager.isUndoStackEmpty()&&!this._pauseableEmitter.isDirtyEvent()),this._operationManager.pushStackElement(this._alternativeVersionId,l),this._pauseableEmitter.fire({rawEvents:[],versionId:this.versionId,synchronous:t,endSelectionState:l}),this._notebookLoggingService.trace("textModelEdits",`End applying ${e.length} raw edits`)}}}finally{this._pauseableEmitter.resume()}}_doApplyEdits(e,t,o,n,r){let s=e.map((u,p)=>{let h=-1;if(yo(u,{index:!0}))h=u.index;else if(yo(u,{handle:!0}))h=this._getCellIndexByHandle(u.handle),this._assertIndex(h,`editType: ${u.editType}, key: handle`);else if(yo(u,{outputId:!0})){if(h=this._getCellIndexWithOutputIdHandle(u.outputId),this._indexIsInvalid(h)&&(h=this._getCellIndexWithOutputIdHandleFromEdits(u.outputId,e.slice(0,p))),this._indexIsInvalid(h))return null}else if(u.editType!==5)throw new Error("Invalid cell edit: "+JSON.stringify(u));return{edit:u,cellIndex:h,end:u.editType===5?void 0:u.editType===1?u.index+u.count:h,originalIndex:p}}).filter(so),c=this._mergeCellEdits(s).sort((u,p)=>u.end===void 0?-1:p.end===void 0?1:p.end-u.end||p.originalIndex-u.originalIndex).reduce((u,p)=>{if(!u.length)u.push([p]);else{let h=u[u.length-1],g=h[0].cellIndex;p.cellIndex===g?h.push(p):u.push([p])}return u},[]).map(u=>{let p=[],h=[];return u.forEach(g=>{g.edit.editType===1?p.push(g):h.push(g)}),[...h.reverse(),...p]}).flat();for(let{edit:u,cellIndex:p}of c)switch(u.editType){case 1:this._replaceCells(u.index,u.count,u.cells,t,o,n,r);break;case 2:{this._assertIndex(p);let h=this._cells[p];u.append?this._spliceNotebookCellOutputs(h,{start:h.outputs.length,deleteCount:0,newOutputs:u.outputs.map(g=>new jie(g))},!0,o):this._spliceNotebookCellOutputs2(h,u.outputs,o);break}case 7:{this._assertIndex(p);let h=this._cells[p];u.append?this._appendNotebookCellOutputItems(h,u.outputId,u.items):this._replaceNotebookCellOutputItems(h,u.outputId,u.items)}break;case 3:this._assertIndex(u.index),this._changeCellMetadata(this._cells[u.index],u.metadata,o,n,r);break;case 8:this._assertIndex(p),this._changeCellMetadataPartial(this._cells[p],u.metadata,o,n,r);break;case 9:this._assertIndex(p),this._changeCellInternalMetadataPartial(this._cells[p],u.internalMetadata);break;case 4:this._assertIndex(u.index),this._changeCellLanguage(this._cells[u.index],u.language,o,n,r);break;case 5:this._updateNotebookCellMetadata(u.metadata,o,n,r);break;case 6:this._moveCellToIdx(u.index,u.length,u.newIdx,t,o,n,void 0,r);break}}_mergeCellEdits(e){let t=[];return e.forEach(o=>{if(t.length){let n=t[t.length-1];n.edit.editType===2&&n.edit.append&&o.edit.editType===2&&o.edit.append&&n.cellIndex===o.cellIndex?n.edit.outputs=[...n.edit.outputs,...o.edit.outputs]:n.edit.editType===2&&!n.edit.append&&n.edit.outputs.length===0&&o.edit.editType===2&&o.edit.append&&n.cellIndex===o.cellIndex?(n.edit.append=!1,n.edit.outputs=o.edit.outputs):t.push(o)}else t.push(o)}),t}_replaceCells(e,t,o,n,r,s,l){if(t===0&&o.length===0)return;let c=this._cells.slice(0),u=new Set;c.forEach(v=>{u.add(v.handle)});for(let v=e;v<Math.min(e+t,this._cells.length);v++){let b=this._cells[v];this._cellListeners.get(b.handle)?.dispose(),this._cellListeners.delete(b.handle)}let p=o.map(v=>{let b=this._cellhandlePool++,S=sn.generate(this.uri,b);v.outputs||(v.outputs=[]);let y=new AQ(S,b,v,this.transientOptions,this._languageService,this._modelService.getCreationOptions(v.language,S,!1).defaultEOL,this._defaultCollapseConfig,this._languageDetectionService,this._notebookLoggingService),w=this._modelService.getModel(S);w&&w instanceof Tp&&(y.textModel=w,y.language=v.language,y.textModel.setValue(v.source),y.resetTextBuffer(y.textModel.getTextBuffer()));let x=y.onDidChangeContent(E=>{this._bindCellContentHandler(y,E)});return this.newCellsFromLastEdit.add(y.handle),this._cellListeners.set(y.handle,x),this._register(y),y}),h=this._cells.slice(0);h.splice(e,t,...p);let g=T7e(this._cells,h,v=>u.has(v.handle)).map(v=>[v.start,v.deleteCount,v.toInsert]);this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:g}}),this._cells=h;let f=g.map(v=>{let b=c.slice(v[0],v[0]+v[1]);return[v[0],b,v[2]]});r&&this._operationManager.pushEditOperation(new zKt(this.uri,f,{insertCell:(v,b,S)=>{this._insertNewCell(v,[b],!0,S)},deleteCell:(v,b)=>{this._removeCell(v,1,!0,b)},replaceCell:(v,b,S,y)=>{this._replaceNewCells(v,b,S,!0,y)}},void 0,void 0),s,void 0,this._alternativeVersionId,l),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:g,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:void 0})}_increaseVersionId(e){this._versionId=this._versionId+1,e||(this._notebookSpecificAlternativeId=this._versionId),this._alternativeVersionId=this._generateAlternativeId()}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e,this._notebookSpecificAlternativeId=Number(e.substring(0,e.indexOf("_")))}_updateNotebookCellMetadata(e,t,o,n){let r=this.metadata,s=this._isDocumentMetadataChanged(this.metadata,e);if(s&&t){let l=this;this._operationManager.pushEditOperation(new class{constructor(){this.type=0;this.label="Update Cell Metadata";this.code="undoredo.textBufferEdit"}get resource(){return l.uri}undo(){l._updateNotebookCellMetadata(r,!1,o,n)}redo(){l._updateNotebookCellMetadata(e,!1,o,n)}},o,void 0,this._alternativeVersionId,n)}this.metadata=e,this._pauseableEmitter.fire({rawEvents:[{kind:11,metadata:this.metadata,transient:!s}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_insertNewCell(e,t,o,n){for(let s=0;s<t.length;s++){let l=t[s].onDidChangeContent(c=>{this._bindCellContentHandler(t[s],c)});this._cellListeners.set(t[s].handle,l)}let r=[[e,0,t]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:r}}),this._cells.splice(e,0,...t),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:r,transient:!1}],versionId:this.versionId,synchronous:o,endSelectionState:n})}_removeCell(e,t,o,n){for(let s=e;s<e+t;s++){let l=this._cells[s];this._cellListeners.get(l.handle)?.dispose(),this._cellListeners.delete(l.handle)}let r=[[e,t,[]]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:r}}),this._cells.splice(e,t),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:r,transient:!1}],versionId:this.versionId,synchronous:o,endSelectionState:n})}_replaceNewCells(e,t,o,n,r){for(let l=e;l<e+t;l++){let c=this._cells[l];this._cellListeners.get(c.handle)?.dispose(),this._cellListeners.delete(c.handle)}for(let l=0;l<o.length;l++){let c=o[l].onDidChangeContent(u=>{this._bindCellContentHandler(o[l],u)});this._cellListeners.set(o[l].handle,c)}let s=[[e,t,o]];this._onWillAddRemoveCells.fire({rawEvent:{kind:1,changes:s}}),this._cells.splice(e,t,...o),this._pauseableEmitter.fire({rawEvents:[{kind:1,changes:s,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:r})}_isDocumentMetadataChanged(e,t){let o=new Set([...Object.keys(e||{}),...Object.keys(t||{})]);for(let n of o)if(n==="custom"){if(!this._customMetadataEqual(e[n],t[n])&&!this.transientOptions.transientDocumentMetadata[n])return!0}else if(e[n]!==t[n]&&!this.transientOptions.transientDocumentMetadata[n])return!0;return!1}_isCellMetadataChanged(e,t){let o=new Set([...Object.keys(e||{}),...Object.keys(t||{})]);for(let n of o)if(e[n]!==t[n]&&!this.transientOptions.transientCellMetadata[n])return!0;return!1}_customMetadataEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;let o=Object.getOwnPropertyNames(e),n=Object.getOwnPropertyNames(t);if(o.length!==n.length)return!1;for(let r=0;r<o.length;r++){let s=o[r];if(e[s]!==t[s])return!1}return!0}_changeCellMetadataPartial(e,t,o,n,r){let s={...e.metadata},l;for(l in t){let c=t[l]??void 0;s[l]=c}return this._changeCellMetadata(e,s,o,n,r)}_changeCellMetadata(e,t,o,n,r){let s=this._isCellMetadataChanged(e.metadata,t);if(s&&o){let l=this._cells.indexOf(e);this._operationManager.pushEditOperation(new KKt(this.uri,l,Object.freeze(e.metadata),Object.freeze(t),{updateCellMetadata:(c,u)=>{let p=this._cells[c];p&&this._changeCellMetadata(p,u,!1,n,r)}}),n,void 0,this._alternativeVersionId,r)}e.metadata=t,this._pauseableEmitter.fire({rawEvents:[{kind:7,index:this._cells.indexOf(e),metadata:e.metadata,transient:!s}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_changeCellInternalMetadataPartial(e,t){let o={...e.internalMetadata},n;for(n in t){let r=t[n]??void 0;o[n]=r}e.internalMetadata=o,this._pauseableEmitter.fire({rawEvents:[{kind:12,index:this._cells.indexOf(e),internalMetadata:e.internalMetadata,transient:!0}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_changeCellLanguage(e,t,o,n,r){if(e.language===t)return;let s=e.language;if(e.language=t,o){let l=this;this._operationManager.pushEditOperation(new class{constructor(){this.type=0;this.label="Update Cell Language";this.code="undoredo.textBufferEdit"}get resource(){return l.uri}undo(){l._changeCellLanguage(e,s,!1,n,r)}redo(){l._changeCellLanguage(e,t,!1,n,r)}},n,void 0,this._alternativeVersionId,r)}this._pauseableEmitter.fire({rawEvents:[{kind:5,index:this._cells.indexOf(e),language:t,transient:!1}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_spliceNotebookCellOutputs2(e,t,o){if(t.length===0&&e.outputs.length===0)return;if(t.length<=1){this._spliceNotebookCellOutputs(e,{start:0,deleteCount:e.outputs.length,newOutputs:t.map(l=>new jie(l))},!1,o);return}new kA(new GKt(e.outputs),new GKt(t)).ComputeDiff(!1).changes.map(l=>({start:l.originalStart,deleteCount:l.originalLength,newOutputs:t.slice(l.modifiedStart,l.modifiedStart+l.modifiedLength).map(c=>new jie(c))})).reverse().forEach(l=>{this._spliceNotebookCellOutputs(e,l,!1,o)})}_spliceNotebookCellOutputs(e,t,o,n){e.spliceNotebookCellOutputs(t),this._pauseableEmitter.fire({rawEvents:[{kind:8,index:this._cells.indexOf(e),outputs:e.outputs.map(r=>r.asDto())??[],append:o,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_appendNotebookCellOutputItems(e,t,o){e.changeOutputItems(t,!0,o)&&this._pauseableEmitter.fire({rawEvents:[{kind:9,index:this._cells.indexOf(e),outputId:t,outputItems:o,append:!0,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_replaceNotebookCellOutputItems(e,t,o){e.changeOutputItems(t,!1,o)&&this._pauseableEmitter.fire({rawEvents:[{kind:9,index:this._cells.indexOf(e),outputId:t,outputItems:o,append:!1,transient:this.transientOptions.transientOutputs}],versionId:this.versionId,synchronous:!0,endSelectionState:void 0})}_moveCellToIdx(e,t,o,n,r,s,l,c){r&&this._operationManager.pushEditOperation(new UKt(this.uri,e,t,o,{moveCell:(p,h,g,f,v)=>{this._moveCellToIdx(p,h,g,!0,!1,f,v,c)}},s,l),s,l,this._alternativeVersionId,c),this._assertIndex(e),this._assertIndex(o);let u=this._cells.splice(e,t);return this._cells.splice(o,0,...u),this._pauseableEmitter.fire({rawEvents:[{kind:2,index:e,length:t,newIdx:o,cells:u,transient:!1}],versionId:this.versionId,synchronous:n,endSelectionState:l}),!0}_assertIndex(e,t){if(this._indexIsInvalid(e))throw new Error(`model index out of range ${e} (cellCount: ${this._cells.length}${t?`, ${t}`:""})`)}_indexIsInvalid(e){return e<0||e>=this._cells.length}findNextMatch(e,t,o,n,r,s){this._assertIndex(t.cellIndex);let c=new Uw(e,o,n,r).parseSearchRequest();if(!c)return null;let u=t.cellIndex,p=t.position,h=this._cells.length;for(;u<h;){let g=this._cells[u],f=s&&u===s.cellIndex&&p.isBefore(s.position),v=new G(p.lineNumber,p.column,f?s.position.lineNumber:g.textBuffer.getLineCount(),f?s.position.column:g.textBuffer.getLineMaxColumn(g.textBuffer.getLineCount())),b=g.textBuffer.findMatchesLineByLine(v,c,!1,1);if(b.length>0)return{cell:g,match:b[0]};if(f)break;u++,s&&u>=this._cells.length&&(u=0,h=s.cellIndex+1),p=new ye(1,1)}return null}findMatches(e,t,o,n){let s=new Uw(e,t,o,n).parseSearchRequest();if(!s)return[];let l=[];for(let c of this._cells){let u=new G(1,1,c.textBuffer.getLineCount(),c.textBuffer.getLineMaxColumn(c.textBuffer.getLineCount())),p=c.textBuffer.findMatchesLineByLine(u,s,!1,1e3);p.length>0&&l.push({cell:c,matches:p})}return l}};Qie=I([m(5,wl),m(6,_t),m(7,Rt),m(8,jS),m(9,Ns),m(10,Sb)],Qie);var GKt=class{constructor(i){this.outputs=i}getElements(){return this.outputs.map(i=>Lr(i.outputs.map(e=>({mime:e.mime,data:e.data}))))}};var qKt=class{constructor(i){this.value=new Set(i),this.defined=this.value.size>0}matches(i){return i.some(e=>this.value.has(e))}},$Kt=class{constructor(i){this.id=i.id,this.extensionId=i.extension.identifier,this.extensionLocation=i.extension.extensionLocation,this.isBuiltin=i.extension.isBuiltin,typeof i.entrypoint=="string"?this.entrypoint={extends:void 0,path:Ve(this.extensionLocation,i.entrypoint)}:this.entrypoint={extends:i.entrypoint.extends,path:Ve(this.extensionLocation,i.entrypoint.path)},this.displayName=i.displayName,this.mimeTypes=i.mimeTypes,this.mimeTypeGlobs=this.mimeTypes.map(e=>Eh(e,{ignoreCase:!0})),this.hardDependencies=new qKt(i.dependencies??yt.empty()),this.optionalDependencies=new qKt(i.optionalDependencies??yt.empty()),this.messaging=i.requiresMessaging??"never"}matchesWithoutKernel(i){return this.matchesMimeTypeOnly(i)?this.hardDependencies.defined?0:this.optionalDependencies.defined?1:2:3}matches(i,e){return this.matchesMimeTypeOnly(i)?this.hardDependencies.defined?this.hardDependencies.matches(e)?0:3:this.optionalDependencies.matches(e)?1:2:3}matchesMimeTypeOnly(i){return this.entrypoint.extends?!1:this.mimeTypeGlobs.some(e=>e(i))||this.mimeTypes.some(e=>e===i)}},jKt=class{constructor(i){this.type=i.type,this.entrypoint=Ve(i.extension.extensionLocation,i.entrypoint),this.extensionLocation=i.extension.extensionLocation,this.localResourceRoots=i.localResourceRoots.map(e=>Ve(i.extension.extensionLocation,e))}};var Yie=class a{get selectors(){return this._selectors}get options(){return this._options}constructor(i){this.extension=i.extension,this.id=i.id,this.displayName=i.displayName,this._selectors=i.selectors?.map(e=>({include:e.filenamePattern,exclude:e.excludeFileNamePattern||""}))||i._selectors||[],this.priority=i.priority,this.providerDisplayName=i.providerDisplayName,this._options={transientCellMetadata:{},transientDocumentMetadata:{},transientOutputs:!1,cellContentMetadata:{}}}update(i){i.selectors&&(this._selectors=i.selectors),i.options&&(this._options=i.options)}matches(i){return this.selectors?.some(e=>a.selectorMatches(e,i))}static selectorMatches(i,e){if((typeof i=="string"||GA(i))&&qd(i,Jo(e.fsPath),{ignoreCase:!0}))return!0;if(!aLt(i))return!1;let t=i.include,o=i.exclude;return qd(t,Jo(e.fsPath),{ignoreCase:!0})?!(o&&qd(o,Jo(e.fsPath),{ignoreCase:!0})):!1}static possibleFileEnding(i){for(let e of i){let t=a._possibleFileEnding(e);if(t)return t}}static _possibleFileEnding(i){let e=/^.*(\.[a-zA-Z0-9_-]+)$/,t;if(typeof i=="string")t=i;else if(GA(i))t=i.pattern;else if(i.include)return a._possibleFileEnding(i.include);if(t){let o=e.exec(t);if(o)return o[1]}}};var aan="multi-cell-notebook-diff-editor",Qge=class a extends VC{static{this.ID="workbench.input.multiDiffNotebookInput"}static create(i,e,t,o,n,r){let s=Ga.getOrCreate(i,n,void 0,r),l=Ga.getOrCreate(i,e,void 0,r);return i.createInstance(a,t,o,s,l,r)}},Xie=class extends Ou{constructor(e,t,o,n,r,s,l){super(e,void 0,void 0,!0,o,n,r,s,l);this.notebookDiffViewModel=t;this._register(s.registerResolver(this))}static createInput(e,t){let o=A.parse(`${aan}:${new Date().getMilliseconds().toString()+Math.random().toString()}`);return t.createInstance(Xie,o,e)}canHandleUri(e){return e.toString()===this.multiDiffSource.toString()}async resolveDiffSource(e){return{resources:this.notebookDiffViewModel}}};Xie=I([m(2,Bt),m(3,Gn),m(4,F),m(5,rG),m(6,Uo)],Xie);var rO=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._editorResolverService=o;this._configurationService=n;this._accessibilityService=r;this._instantiationService=s;this._fileService=l;this._notebookEditorModelResolverService=c;this.uriIdentService=u;this._handled=!1;this._contributedEditors=new Map;this._contributedEditorDisposables=this._register(new O);this._memento=new $l(rO.CUSTOM_EDITORS_STORAGE_ID,e);let p=this._memento.getMemento(0,1);this._editorResolverService.bufferChangeEvents(()=>{for(let h of p[rO.CUSTOM_EDITORS_ENTRY_ID]||[])this.add(new Yie(h),!1)}),this._register(t.onDidRegisterExtensions(()=>{this._handled||(this._clear(),p[rO.CUSTOM_EDITORS_ENTRY_ID]=[],this._memento.saveMemento())})),jIo.setHandler(h=>this._setupHandler(h))}static{this.CUSTOM_EDITORS_STORAGE_ID="notebookEditors"}static{this.CUSTOM_EDITORS_ENTRY_ID="editors"}dispose(){this._clear(),super.dispose()}_setupHandler(e){this._handled=!0;let t=[...this._contributedEditors.values()].filter(r=>!r.extension);this._clear();let o=new Map;t.forEach(r=>{o.set(r.id,this.add(r))});for(let r of e)for(let s of r.value){if(!s.type){r.collector.error("Notebook does not specify type-property");continue}let l=this.get(s.type);if(l)if(!l.extension&&r.description.isBuiltin&&t.find(c=>c.id===s.type))o.get(s.type)?.dispose();else{r.collector.error(`Notebook type '${s.type}' already used`);continue}this.add(new Yie({extension:r.description.identifier,id:s.type,displayName:s.displayName,selectors:s.selector||[],priority:this._convertPriority(s.priority),providerDisplayName:r.description.displayName??r.description.identifier.value}))}let n=this._memento.getMemento(0,1);n[rO.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento()}clearEditorCache(){let e=this._memento.getMemento(0,1);e[rO.CUSTOM_EDITORS_ENTRY_ID]=[],this._memento.saveMemento()}_convertPriority(e){return e?e==="default"?"default":"option":"default"}_registerContributionPoint(e){let t=new O;for(let o of e.selectors){let n=o.include||o,r={id:e.id,label:e.displayName,detail:e.providerDisplayName,priority:e.priority},s={canHandleDiff:()=>!!this._configurationService.getValue(Ct.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized(),canSupportResource:f=>f.scheme===Q.vscodeNotebookCellOutput?new URLSearchParams(f.query).get("openIn")==="notebook":f.scheme===Q.untitled||f.scheme===Q.vscodeNotebookCell||this._fileService.hasProvider(f)},l=async({resource:f,options:v})=>{let b;if(f.scheme===Q.vscodeNotebookCellOutput){let M=sn.parseCellOutputUri(f);if(!M||!M.notebook||M.cellHandle===void 0)throw new Error("Invalid cell output uri");b={notebook:M.notebook,handle:M.cellHandle}}else b=sn.parse(f);let S,y;b?(S=this.uriIdentService.asCanonicalUri(b.notebook),y={resource:f,options:v}):S=this.uriIdentService.asCanonicalUri(f),y||(y=v?.cellOptions);let w;if(f.scheme===Q.vscodeNotebookCellOutput){if(b?.handle===void 0||!b?.notebook)throw new Error("Invalid cell handle");y={resource:sn.generate(b.notebook,b.handle),options:v};let N=await this._notebookEditorModelResolverService.resolve(S).then(H=>H.object.notebook.cells.findIndex(K=>K.handle===b?.handle)).then(H=>H>=0?H:0),V=[{start:N,end:N+1}];w={...v,cellOptions:y,viewState:void 0,cellSelections:V}}else w={...v,cellOptions:y,viewState:void 0};let x=y?.resource;return{editor:Ga.getOrCreate(this._instantiationService,S,x,e.id),options:w}},c=async({resource:f,options:v})=>{let b=await this._notebookEditorModelResolverService.resolve({untitledResource:f},e.id);return U.once(b.object.notebook.onWillDispose)(()=>{b.dispose()}),{editor:Ga.getOrCreate(this._instantiationService,b.object.resource,void 0,e.id),options:v}},u=(f,v)=>{let{modified:b,original:S,label:y,description:w}=f;return this._configurationService.getValue("notebook.experimental.enableNewDiffEditor")?{editor:Qge.create(this._instantiationService,b.resource,y,w,S.resource,e.id)}:{editor:VC.create(this._instantiationService,b.resource,y,w,S.resource,e.id)}},h={createEditorInput:l,createDiffEditorInput:u,createUntitledEditorInput:c,createMergeEditorInput:f=>({editor:this._instantiationService.createInstance(Zb,f.base.resource,{uri:f.input1.resource,title:f.input1.label??Be(f.input1.resource),description:f.input1.description??"",detail:f.input1.detail},{uri:f.input2.resource,title:f.input2.label??Be(f.input2.resource),description:f.input2.description??"",detail:f.input2.detail},f.result.resource)})},g={createEditorInput:l,createDiffEditorInput:u};t.add(this._configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(Ct.textDiffEditorPreview)&&(!!this._configurationService.getValue(Ct.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized()?(h.createDiffEditorInput=u,g.createDiffEditorInput=u):(h.createDiffEditorInput=void 0,g.createDiffEditorInput=void 0))})),t.add(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{!!this._configurationService.getValue(Ct.textDiffEditorPreview)&&!this._accessibilityService.isScreenReaderOptimized()?(h.createDiffEditorInput=u,g.createDiffEditorInput=u):(h.createDiffEditorInput=void 0,g.createDiffEditorInput=void 0)})),t.add(this._editorResolverService.registerEditor(n,r,s,h)),t.add(this._editorResolverService.registerEditor(`${Q.vscodeNotebookCell}:/**/${n}`,{...r,priority:"exclusive"},s,g))}return t}_clear(){this._contributedEditors.clear(),this._contributedEditorDisposables.clear()}get(e){return this._contributedEditors.get(e)}add(e,t=!0){if(this._contributedEditors.has(e.id))throw new Error(`notebook type '${e.id}' ALREADY EXISTS`);this._contributedEditors.set(e.id,e);let o;if(e.extension&&(o=this._registerContributionPoint(e),this._contributedEditorDisposables.add(o)),t){let n=this._memento.getMemento(0,1);n[rO.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento()}return this._register(ee(()=>{let n=this._memento.getMemento(0,1);n[rO.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._contributedEditors.values()),this._memento.saveMemento(),o?.dispose(),this._contributedEditors.delete(e.id)}))}getContributedNotebook(e){let t=[];for(let o of this._contributedEditors.values())o.matches(e)&&t.push(o);return t.length===0&&e.scheme===Q.untitled?Array.from(this._contributedEditors.values()):t}[Symbol.iterator](){return this._contributedEditors.values()}};rO=I([m(0,de),m(1,lt),m(2,il),m(3,B),m(4,Ai),m(5,F),m(6,ge),m(7,Yh),m(8,gt)],rO);var Wnt=class{constructor(i){this.contributedRenderers=new Map;this.preferredMimetype=new uo(()=>this.preferredMimetypeMemento.getMemento(1,1));this.preferredMimetypeMemento=new $l("workbench.editor.notebook.preferredRenderer2",i)}clear(){this.contributedRenderers.clear()}get(i){return this.contributedRenderers.get(i)}getAll(){return Array.from(this.contributedRenderers.values())}add(i){this.contributedRenderers.has(i.id)||this.contributedRenderers.set(i.id,i)}setPreferred(i,e,t){let o=this.preferredMimetype.value,n=o[i.id];n?n[e]=t:o[i.id]={[e]:t},this.preferredMimetypeMemento.saveMemento()}findBestRenderers(i,e,t){let o;(g=>(g[g.PreviouslySelected=256]="PreviouslySelected",g[g.SameExtensionAsNotebook=512]="SameExtensionAsNotebook",g[g.OtherRenderer=768]="OtherRenderer",g[g.BuiltIn=1024]="BuiltIn"))(o||={});let n=i&&this.preferredMimetype.value[i.id]?.[e],r=i?.extension?.value,s=i?.id,l=Array.from(this.contributedRenderers.values()).map(c=>{let u=t===void 0?c.matchesWithoutKernel(e):c.matches(e,t);if(u===3)return;let p=c.extensionId.value,h=n===c.id?256:p===r||cro.get(p)?.has(s)?512:c.isBuiltin?1024:768;return{ordered:{mimeType:e,rendererId:c.id,isTrusted:!0},score:h|u}}).filter(so);return l.length===0?[{mimeType:e,rendererId:T2,isTrusted:!0}]:l.sort((c,u)=>c.score-u.score).map(c=>c.ordered)}};Wnt=I([m(0,de)],Wnt);var LLi=class{constructor(i,e){this.model=i;this._modelEventListeners=new O;this._modelEventListeners.add(i.onWillDispose(()=>e(i)))}get uri(){return this.model.uri}getCellIndex(i){return this.model.cells.findIndex(e=>ze(e.uri,i))}dispose(){this._modelEventListeners.dispose()}},Jie=class extends k{constructor(e,t,o,n,r,s){super();this._extensionService=e;this._configurationService=t;this._accessibilityService=o;this._instantiationService=n;this._storageService=r;this._notebookDocumentService=s;this._notebookProviders=new Map,this._notebookProviderInfoStore=void 0,this._notebookRenderersInfoStore=this._instantiationService.createInstance(Wnt),this._onDidChangeOutputRenderers=this._register(new T),this.onDidChangeOutputRenderers=this._onDidChangeOutputRenderers.event,this._notebookStaticPreloadInfoStore=new Set,this._models=new dt,this._onWillAddNotebookDocument=this._register(new T),this._onDidAddNotebookDocument=this._register(new T),this._onWillRemoveNotebookDocument=this._register(new T),this._onDidRemoveNotebookDocument=this._register(new T),this.onWillAddNotebookDocument=this._onWillAddNotebookDocument.event,this.onDidAddNotebookDocument=this._onDidAddNotebookDocument.event,this.onDidRemoveNotebookDocument=this._onDidRemoveNotebookDocument.event,this.onWillRemoveNotebookDocument=this._onWillRemoveNotebookDocument.event,this._onAddViewType=this._register(new T),this.onAddViewType=this._onAddViewType.event,this._onWillRemoveViewType=this._register(new T),this.onWillRemoveViewType=this._onWillRemoveViewType.event,this._onDidChangeEditorTypes=this._register(new T),this.onDidChangeEditorTypes=this._onDidChangeEditorTypes.event,this._lastClipboardIsCopy=!0,QIo.setHandler(c=>{this._notebookRenderersInfoStore.clear();for(let u of c)for(let p of u.value){if(!p.entrypoint){u.collector.error("Notebook renderer does not specify entry point");continue}let h=p.id;if(!h){u.collector.error("Notebook renderer does not specify id-property");continue}this._notebookRenderersInfoStore.add(new $Kt({id:h,extension:u.description,entrypoint:p.entrypoint,displayName:p.displayName,mimeTypes:p.mimeTypes||[],dependencies:p.dependencies,optionalDependencies:p.optionalDependencies,requiresMessaging:p.requiresMessaging}))}this._onDidChangeOutputRenderers.fire()}),YIo.setHandler(c=>{this._notebookStaticPreloadInfoStore.clear();for(let u of c)if(Va(u.description,"contribNotebookStaticPreloads"))for(let p of u.value){if(!p.entrypoint){u.collector.error("Notebook preload does not specify entry point");continue}let h=p.type;if(!h){u.collector.error("Notebook preload does not specify type-property");continue}this._notebookStaticPreloadInfoStore.add(new jKt({type:h,extension:u.description,entrypoint:p.entrypoint,localResourceRoots:p.localResourceRoots??[]}))}});let l=()=>{this._displayOrder=new sLt(this._configurationService.getValue(Ct.displayOrder)||[],this._accessibilityService.isScreenReaderOptimized()?lro:Ibi)};l(),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(Ct.displayOrder)&&l()})),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{l()})),this._memento=new $l(Jie._storageNotebookViewTypeProvider,this._storageService),this._viewTypeCache=this._memento.getMemento(1,1)}static{this._storageNotebookViewTypeProvider="notebook.viewTypeProvider"}get notebookProviderInfoStore(){return this._notebookProviderInfoStore||(this._notebookProviderInfoStore=this._register(this._instantiationService.createInstance(rO))),this._notebookProviderInfoStore}getEditorTypes(){return[...this.notebookProviderInfoStore].map(e=>({id:e.id,displayName:e.displayName,providerDisplayName:e.providerDisplayName}))}clearEditorCache(){this.notebookProviderInfoStore.clearEditorCache()}_postDocumentOpenActivation(e){this._extensionService.activateByEvent(`onNotebook:${e}`),this._extensionService.activateByEvent("onNotebook:*")}async canResolve(e){return this._notebookProviders.has(e)?!0:(await this._extensionService.whenInstalledExtensionsRegistered(),await this._extensionService.activateByEvent(`onNotebookSerializer:${e}`),this._notebookProviders.has(e))}registerContributedNotebookType(e,t){let o=new Yie({extension:t.extension,id:e,displayName:t.displayName,providerDisplayName:t.providerDisplayName,priority:t.priority||"default",selectors:[]});o.update({selectors:t.filenamePattern});let n=this.notebookProviderInfoStore.add(o);return this._onDidChangeEditorTypes.fire(),ee(()=>{n.dispose(),this._onDidChangeEditorTypes.fire()})}_registerProviderData(e,t){if(this._notebookProviders.has(e))throw new Error(`notebook provider for viewtype '${e}' already exists`);return this._notebookProviders.set(e,t),this._onAddViewType.fire(e),ee(()=>{this._onWillRemoveViewType.fire(e),this._notebookProviders.delete(e)})}registerNotebookSerializer(e,t,o){return this.notebookProviderInfoStore.get(e)?.update({options:o.options}),this._viewTypeCache[e]=t.id.value,this._persistMementos(),this._registerProviderData(e,new LM(e,o,t))}async withNotebookDataProvider(e){let t=this.notebookProviderInfoStore.get(e);if(!t){let n=this.getViewTypeProvider(e),r=n?[li({id:"workbench.notebook.action.installMissingViewType",label:d(13929,null,e),run:async()=>{await this._instantiationService.createInstance(tO,n).run()}})]:[];throw Rz(`UNKNOWN notebook type '${e}'`,r)}await this.canResolve(t.id);let o=this._notebookProviders.get(t.id);if(!o)throw new Error(`NO provider registered for view type: '${t.id}'`);return o}tryGetDataProviderSync(e){let t=this.notebookProviderInfoStore.get(e);if(t)return this._notebookProviders.get(t.id)}_persistMementos(){this._memento.saveMemento()}getViewTypeProvider(e){return this._viewTypeCache[e]}getRendererInfo(e){return this._notebookRenderersInfoStore.get(e)}updateMimePreferredRenderer(e,t,o,n){let r=this.notebookProviderInfoStore.get(e);r&&this._notebookRenderersInfoStore.setPreferred(r,t,o),this._displayOrder.prioritize(t,n)}saveMimeDisplayOrder(e){this._configurationService.updateValue(Ct.displayOrder,this._displayOrder.toArray(),e)}getRenderers(){return this._notebookRenderersInfoStore.getAll()}*getStaticPreloads(e){for(let t of this._notebookStaticPreloadInfoStore)t.type===e&&(yield t)}async createNotebookTextModel(e,t,o){if(this._models.has(t))throw new Error(`notebook for ${t} already exists`);let n=await this.withNotebookDataProvider(e);if(!(n instanceof LM))throw new Error("CANNOT open file notebook with this provider");let r=o?await yI(o):Ke.fromByteArray([]),s=await n.serializer.dataToNotebook(r),l=this._instantiationService.createInstance(Qie,n.viewType,t,s.cells,s.metadata,n.serializer.options),c=new LLi(l,this._onWillDisposeDocument.bind(this));return this._models.set(t,c),this._notebookDocumentService.addNotebookDocument(c),this._onWillAddNotebookDocument.fire(l),this._onDidAddNotebookDocument.fire(l),this._postDocumentOpenActivation(n.viewType),l}async createNotebookTextDocumentSnapshot(e,t,o){let n=this.getNotebookTextModel(e);if(!n)throw new Error(`notebook for ${e} doesn't exist`);let r=await this.withNotebookDataProvider(n.viewType);if(!(r instanceof LM))throw new Error("CANNOT open file notebook with this provider");let s=r.serializer,l=this._configurationService.getValue(Ct.outputBackupSizeLimit)*1024,c=n.createSnapshot({context:t,outputSizeLimit:l,transientOptions:s.options}),u=n.metadata.indentAmount;typeof u=="string"&&u&&(c.metadata.indentAmount=u);let p=await s.notebookToData(c);if(o.isCancellationRequested)throw new qi;return lD(p)}async restoreNotebookTextModelFromSnapshot(e,t,o){let n=this.getNotebookTextModel(e);if(!n)throw new Error(`notebook for ${e} doesn't exist`);let r=await this.withNotebookDataProvider(n.viewType);if(!(r instanceof LM))throw new Error("CANNOT open file notebook with this provider");let s=r.serializer,l=await yI(o),c=await r.serializer.dataToNotebook(l);return n.restoreSnapshot(c,s.options),n}getNotebookTextModel(e){return this._models.get(e)?.model}getNotebookTextModels(){return yt.map(this._models.values(),e=>e.model)}listNotebookDocuments(){return[...this._models].map(e=>e[1].model)}_onWillDisposeDocument(e){let t=this._models.get(e.uri);t&&(this._onWillRemoveNotebookDocument.fire(t.model),this._models.delete(e.uri),this._notebookDocumentService.removeNotebookDocument(t),t.dispose(),this._onDidRemoveNotebookDocument.fire(t.model))}getOutputMimeTypeInfo(e,t,o){let n=this._displayOrder.sort(new Set(o.outputs.map(s=>s.mime))),r=this.notebookProviderInfoStore.get(e.viewType);return n.flatMap(s=>this._notebookRenderersInfoStore.findBestRenderers(r,s,t)).sort((s,l)=>(s.rendererId===T2?1:0)-(l.rendererId===T2?1:0))}getContributedNotebookTypes(e){return e?this.notebookProviderInfoStore.getContributedNotebook(e):[...this.notebookProviderInfoStore]}hasSupportedNotebooks(e){if(this._models.has(e))return!0;let t=this.notebookProviderInfoStore.getContributedNotebook(e);return t.length?t.some(o=>o.matches(e)&&(o.priority==="default"||o.priority==="exclusive")):!1}getContributedNotebookType(e){return this.notebookProviderInfoStore.get(e)}getNotebookProviderResourceRoots(){let e=[];return this._notebookProviders.forEach(t=>{t.extensionData.location&&e.push(A.revive(t.extensionData.location))}),e}setToCopy(e,t){this._cutItems=e,this._lastClipboardIsCopy=t}getToCopy(){if(this._cutItems)return{items:this._cutItems,isCopy:this._lastClipboardIsCopy}}};Jie=I([m(0,lt),m(1,B),m(2,Ai),m(3,F),m(4,de),m(5,s3)],Jie);function XIo(a){let i=a.style.getPropertyValue("anchor-name");if(i)return i;let e=`--overlay-anchor-${ht()}`;return a.style.setProperty("anchor-name",e),e}var QNe=class{constructor(){this.content=document.createElement("div"),this.content.style.position="absolute",this.content.style.overflow="hidden",this._root=document.createElement("div"),this._root.appendChild(this.content),this.reapplyLayoutStyles()}reapplyLayoutStyles(){this.content.style.position="fixed",this.content.style.top="anchor(top)",this.content.style.left="anchor(left)",this.content.style.width="anchor-size(width)",this.content.style.height="anchor-size(height)",this.content.style.pointerEvents="auto",this._root.style.position="absolute",this._root.style.pointerEvents="none"}dispose(){this.root.remove()}get root(){return this._root}setAnchorElement(i,e){if(this._currentAnchor?.element!==i){let t=XIo(i);this.content.style.setProperty("position-anchor",t),AL(this.content,i),this._currentAnchor={element:i,name:t}}this._updateClipping(e?.clippingContainer),this._updateZIndex(i)}_updateZIndex(i){let e="";for(let t=i;t;t=t.parentElement){let o=mF(t).zIndex;if(o&&o!=="auto"){e=String(Number(o)+1);break}}this.content.style.zIndex=e}_updateClipping(i){if(this._clippingAnchor?.element===i)return;this._root.style.removeProperty("position-anchor");let e=this._root.style;if(i){let t=XIo(i);e.clipPath="content-box",e.setProperty("position-anchor",t),e.setProperty("top","anchor(top)"),e.setProperty("left","anchor(left)"),e.setProperty("width","anchor-size(width)"),e.setProperty("height","anchor-size(height)"),this._clippingAnchor={element:i,name:t}}else e.clipPath="",e.setProperty("top","0"),e.setProperty("left","0"),e.setProperty("right","0"),e.setProperty("bottom","0"),this._clippingAnchor=void 0}};var QKt=(c=>(c[c.Base=0]="Base",c[c.Sash=35]="Sash",c[c.SuggestWidget=40]="SuggestWidget",c[c.Hover=50]="Hover",c[c.DragImage=1e3]="DragImage",c[c.MenubarMenuItemsHolder=2e3]="MenubarMenuItemsHolder",c[c.ContextView=2500]="ContextView",c[c.ModalDialog=2600]="ModalDialog",c[c.PaneDropOverlay=1e4]="PaneDropOverlay",c))(QKt||{}),lan=Object.keys(QKt).filter(a=>!isNaN(Number(a))).map(a=>Number(a)).sort((a,i)=>i-a);function can(a){for(let i of lan)if(a>=i)return i;return-1}var MLi=class{constructor(){this.styleSheet=Pr(),this.zIndexMap=new Map,this.scheduler=new Dt(()=>this.updateStyleElement(),200)}registerZIndex(i,e,t){if(this.zIndexMap.get(t))throw new Error(`z-index with name ${t} has already been registered.`);let o=i+e;if(can(o)!==i)throw new Error(`Relative layer: ${i} + z-index: ${e} exceeds next layer ${o}.`);return this.zIndexMap.set(t,o),this.scheduler.schedule(),this.getVarName(t)}getVarName(i){return`--z-index-${i}`}updateStyleElement(){St(this.styleSheet);let i="";this.zIndexMap.forEach((e,t)=>{i+=`${this.getVarName(t)}: ${e};
`}),Eg(":root",i,this.styleSheet)}},dan=new MLi;function FE(a,i,e){return dan.registerZIndex(a,i,e)}var PLi=Oe("debug-console-view-icon",L.debugConsole,d(10793,null)),ALi=Oe("run-view-icon",L.debugAlt,d(10813,null)),JIo=Oe("variables-view-icon",L.debugAlt,d(10814,null)),ZIo=Oe("watch-view-icon",L.debugAlt,d(10820,null)),eyo=Oe("callstack-view-icon",L.debugAlt,d(10767,null)),YKt=Oe("breakpoints-view-icon",L.debugAlt,d(10766,null)),tyo=Oe("loaded-scripts-view-icon",L.debugAlt,d(10812,null)),eV={regular:Oe("debug-breakpoint",L.debugBreakpoint,d(10769,null)),disabled:Oe("debug-breakpoint-disabled",L.debugBreakpointDisabled,d(10776,null)),unverified:Oe("debug-breakpoint-unverified",L.debugBreakpointUnverified,d(10786,null)),pending:Oe("debug-breakpoint-pending",L.debugBreakpointPending,d(10784,null))},NLi={regular:Oe("debug-breakpoint-function",L.debugBreakpointFunction,d(10777,null)),disabled:Oe("debug-breakpoint-function-disabled",L.debugBreakpointFunctionDisabled,d(10778,null)),unverified:Oe("debug-breakpoint-function-unverified",L.debugBreakpointFunctionUnverified,d(10779,null))},OLi={regular:Oe("debug-breakpoint-conditional",L.debugBreakpointConditional,d(10770,null)),disabled:Oe("debug-breakpoint-conditional-disabled",L.debugBreakpointConditionalDisabled,d(10771,null)),unverified:Oe("debug-breakpoint-conditional-unverified",L.debugBreakpointConditionalUnverified,d(10772,null))},FLi={regular:Oe("debug-breakpoint-data",L.debugBreakpointData,d(10773,null)),disabled:Oe("debug-breakpoint-data-disabled",L.debugBreakpointDataDisabled,d(10774,null)),unverified:Oe("debug-breakpoint-data-unverified",L.debugBreakpointDataUnverified,d(10775,null))},XKt={regular:Oe("debug-breakpoint-log",L.debugBreakpointLog,d(10781,null)),disabled:Oe("debug-breakpoint-log-disabled",L.debugBreakpointLogDisabled,d(10782,null)),unverified:Oe("debug-breakpoint-log-unverified",L.debugBreakpointLogUnverified,d(10783,null))},Vnt=Oe("debug-hint",L.debugHint,d(10780,null)),JKt=Oe("debug-breakpoint-unsupported",L.debugBreakpointUnsupported,d(10785,null)),ZKt=[eV,NLi,OLi,FLi,XKt],Yge=Oe("debug-stackframe",L.debugStackframe,d(10804,null)),Xge=Oe("debug-stackframe-focused",L.debugStackframeFocused,d(10805,null)),iyo=Oe("debug-gripper",L.gripper,d(10796,null)),Bnt=Oe("debug-restart-frame",L.debugRestartFrame,d(10801,null)),NQ=Oe("debug-stop",L.debugStop,d(10811,null)),tV=Oe("debug-disconnect",L.debugDisconnect,d(10795,null)),Jge=Oe("debug-restart",L.debugRestart,d(10800,null)),Zge=Oe("debug-step-over",L.debugStepOver,d(10810,null)),Zie=Oe("debug-step-into",L.debugStepInto,d(10808,null)),eoe=Oe("debug-step-out",L.debugStepOut,d(10809,null)),Hnt=Oe("debug-step-back",L.debugStepBack,d(10807,null)),efe=Oe("debug-pause",L.debugPause,d(10798,null)),tfe=Oe("debug-continue",L.debugContinue,d(10794,null)),Unt=Oe("debug-reverse-continue",L.debugReverseContinue,d(10802,null)),oyo=Oe("debug-run",L.run,d(10803,null)),e2t=Oe("debug-start",L.debugStart,d(10806,null)),YNe=Oe("debug-configure",L.gear,d(10788,null)),rLu=Oe("debug-console",L.gear,d(10789,null)),nyo=Oe("debug-remove-config",L.trash,d(10799,null)),sLu=Oe("debug-collapse-all",L.collapseAll,d(10787,null)),ryo=Oe("callstack-view-session",L.bug,d(10768,null)),syo=Oe("debug-console-clear-all",L.clearAll,d(10790,null)),ayo=Oe("watch-expressions-remove-all",L.closeAll,d(10819,null)),lyo=Oe("watch-expression-remove",L.removeClose,d(10815,null)),cyo=Oe("watch-expressions-add",L.add,d(10816,null)),dyo=Oe("watch-expressions-add-function-breakpoint",L.add,d(10818,null)),uyo=Oe("watch-expressions-add-data-breakpoint",L.variableGroup,d(10817,null)),pyo=Oe("breakpoints-remove-all",L.closeAll,d(10765,null)),myo=Oe("breakpoints-activate",L.activateBreakpoints,d(10764,null)),hyo=Oe("debug-console-evaluation-input",L.arrowSmallRight,d(10791,null)),gyo=Oe("debug-console-evaluation-prompt",L.chevronRight,d(10792,null)),t2t=Oe("debug-inspect-memory",L.fileBinary,d(10797,null));var fyo=te("debugToolBar.background",{dark:"#333333",light:"#F3F3F3",hcDark:"#000000",hcLight:"#FFFFFF"},d(10688,null)),vyo=te("debugToolBar.border",null,d(10689,null)),XNe=te("debugIcon.startForeground",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#388A34"},d(10682,null));function byo(){let a=te("debugTokenExpression.name",{dark:"#c586c0",light:"#9b46b0",hcDark:xo,hcLight:xo},"Foreground color for the token names shown in the debug views (ie. the Variables or Watch view)."),i=te("debugTokenExpression.type",{dark:"#4A90E2",light:"#4A90E2",hcDark:xo,hcLight:xo},"Foreground color for the token types shown in the debug views (ie. the Variables or Watch view)."),e=te("debugTokenExpression.value",{dark:"#cccccc99",light:"#6c6c6ccc",hcDark:xo,hcLight:xo},"Foreground color for the token values shown in the debug views (ie. the Variables or Watch view)."),t=te("debugTokenExpression.string",{dark:"#ce9178",light:"#a31515",hcDark:"#f48771",hcLight:"#a31515"},"Foreground color for strings in the debug views (ie. the Variables or Watch view)."),o=te("debugTokenExpression.boolean",{dark:"#4e94ce",light:"#0000ff",hcDark:"#75bdfe",hcLight:"#0000ff"},"Foreground color for booleans in the debug views (ie. the Variables or Watch view)."),n=te("debugTokenExpression.number",{dark:"#b5cea8",light:"#098658",hcDark:"#89d185",hcLight:"#098658"},"Foreground color for numbers in the debug views (ie. the Variables or Watch view)."),r=te("debugTokenExpression.error",{dark:"#f48771",light:"#e51400",hcDark:"#f48771",hcLight:"#e51400"},"Foreground color for expression errors in the debug views (ie. the Variables or Watch view) and for error logs shown in the debug console."),s=te("debugView.exceptionLabelForeground",{dark:xo,light:"#FFF",hcDark:xo,hcLight:xo},"Foreground color for a label shown in the CALL STACK view when the debugger breaks on an exception."),l=te("debugView.exceptionLabelBackground",{dark:"#6C2022",light:"#A31515",hcDark:"#6C2022",hcLight:"#A31515"},"Background color for a label shown in the CALL STACK view when the debugger breaks on an exception."),c=te("debugView.stateLabelForeground",xo,"Foreground color for a label in the CALL STACK view showing the current session's or thread's state."),u=te("debugView.stateLabelBackground","#88888844","Background color for a label in the CALL STACK view showing the current session's or thread's state."),p=te("debugView.valueChangedHighlight","#569CD6","Color used to highlight value changes in the debug views (ie. in the Variables view)."),h=te("debugConsole.infoForeground",{dark:eh,light:eh,hcDark:xo,hcLight:xo},"Foreground color for info messages in debug REPL console."),g=te("debugConsole.warningForeground",{dark:Tg,light:Tg,hcDark:"#008000",hcLight:Tg},"Foreground color for warning messages in debug REPL console."),f=te("debugConsole.errorForeground",Hce,"Foreground color for error messages in debug REPL console."),v=te("debugConsole.sourceForeground",xo,"Foreground color for source filenames in debug REPL console."),b=te("debugConsoleInputIcon.foreground",xo,"Foreground color for debug console input marker icon."),S=te("debugIcon.pauseForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(10680,null)),y=te("debugIcon.stopForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#A1260D"},d(10687,null)),w=te("debugIcon.disconnectForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#A1260D"},d(10679,null)),x=te("debugIcon.restartForeground",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#388A34"},d(10681,null)),E=te("debugIcon.stepOverForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(10686,null)),M=te("debugIcon.stepIntoForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(10684,null)),N=te("debugIcon.stepOutForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(10685,null)),V=te("debugIcon.continueForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(10678,null)),H=te("debugIcon.stepBackForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},d(10683,null));hs((K,j)=>{let J=K.getColor(Gv),se=K.getColor(gx),ae=K.getColor(nyt),ce=K.getColor(s),Se=K.getColor(l),Re=K.getColor(c),xe=K.getColor(u),He=K.getColor(p),Ee=K.getColor(x5);j.addRule(`
			/* Text colour of the call stack row's filename */
			.debug-pane .debug-call-stack .monaco-list-row:not(.selected) .stack-frame > .file .file-name {
				color: ${ae}
			}

			/* Line & column number "badge" for selected call stack row */
			.debug-pane .monaco-list-row.selected .line-number {
				background-color: ${J};
				color: ${se};
			}

			/* Line & column number "badge" for unselected call stack row (basically all other rows) */
			.debug-pane .line-number {
				background-color: ${J.transparent(.6)};
				color: ${se.transparent(.6)};
			}

			/* State "badge" displaying the active session's current state.
			* Only visible when there are more active debug sessions/threads running.
			*/
			.debug-pane .debug-call-stack .thread > .state.label,
			.debug-pane .debug-call-stack .session > .state.label {
				background-color: ${xe};
				color: ${Re};
			}

			/* State "badge" displaying the active session's current state.
			* Only visible when there are more active debug sessions/threads running
			* and thread paused due to a thrown exception.
			*/
			.debug-pane .debug-call-stack .thread > .state.label.exception,
			.debug-pane .debug-call-stack .session > .state.label.exception {
				background-color: ${Se};
				color: ${ce};
			}

			/* Info "badge" shown when the debugger pauses due to a thrown exception. */
			.debug-pane .call-stack-state-message > .label.exception {
				background-color: ${Se};
				color: ${ce};
			}

			/* Animation of changed values in Debug viewlet */
			@keyframes debugViewletValueChanged {
				0%   { background-color: ${He.transparent(0)} }
				5%   { background-color: ${He.transparent(.9)} }
				100% { background-color: ${He.transparent(.3)} }
			}

			.debug-pane .monaco-list-row .expression .value.changed {
				background-color: ${He.transparent(.3)};
				animation-name: debugViewletValueChanged;
				animation-duration: 1s;
				animation-fill-mode: forwards;
			}

			.monaco-list-row .expression .lazy-button:hover {
				background-color: ${Ee}
			}
		`);let Te=K.getColor(Ei);Te&&j.addRule(`
			.debug-pane .line-number {
				border: 1px solid ${Te};
			}
			`),Uf(K.type)&&j.addRule(`
			.debug-pane .line-number {
				background-color: ${J};
				color: ${se};
			}`);let It=K.getColor(a),tt=K.getColor(i),Oi=K.getColor(e),zt=K.getColor(t),mo=K.getColor(o),dn=K.getColor(r),No=K.getColor(n);j.addRule(`
			.monaco-workbench .monaco-list-row .expression .name {
				color: ${It};
			}

			.monaco-workbench .monaco-list-row .expression .type {
				color: ${tt};
			}

			.monaco-workbench .monaco-list-row .expression .value,
			.monaco-workbench .debug-hover-widget .value {
				color: ${Oi};
			}

			.monaco-workbench .monaco-list-row .expression .value.string,
			.monaco-workbench .debug-hover-widget .value.string {
				color: ${zt};
			}

			.monaco-workbench .monaco-list-row .expression .value.boolean,
			.monaco-workbench .debug-hover-widget .value.boolean {
				color: ${mo};
			}

			.monaco-workbench .monaco-list-row .expression .error,
			.monaco-workbench .debug-hover-widget .error,
			.monaco-workbench .debug-pane .debug-variables .scope .error {
				color: ${dn};
			}

			.monaco-workbench .monaco-list-row .expression .value.number,
			.monaco-workbench .debug-hover-widget .value.number {
				color: ${No};
			}
		`);let _i=K.getColor(LI)||Ue.fromHex("#80808060"),ln=K.getColor(h),Tn=K.getColor(g),Ko=K.getColor(f),Bn=K.getColor(v),Mr=K.getColor(b);j.addRule(`
			.repl .repl-input-wrapper {
				border-top: 1px solid ${_i};
			}

			.monaco-workbench .repl .repl-tree .output .expression .value.info {
				color: ${ln};
			}

			.monaco-workbench .repl .repl-tree .output .expression .value.warn {
				color: ${Tn};
			}

			.monaco-workbench .repl .repl-tree .output .expression .value.error {
				color: ${Ko};
			}

			.monaco-workbench .repl .repl-tree .output .expression .source {
				color: ${Bn};
			}

			.monaco-workbench .repl .repl-tree .monaco-tl-contents .arrow {
				color: ${Mr};
			}
		`),K.defines(b)||j.addRule(`
				.monaco-workbench.vs .repl .repl-tree .monaco-tl-contents .arrow {
					opacity: 0.25;
				}

				.monaco-workbench.vs-dark .repl .repl-tree .monaco-tl-contents .arrow {
					opacity: 0.4;
				}

				.monaco-workbench.hc-black .repl .repl-tree .monaco-tl-contents .arrow,
				.monaco-workbench.hc-light .repl .repl-tree .monaco-tl-contents .arrow {
					opacity: 1;
				}
			`);let va=K.getColor(XNe);va&&j.addRule(`.monaco-workbench ${q.asCSSSelector(e2t)} { color: ${va}; }`);let $s=K.getColor(S);$s&&j.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(efe)}, .monaco-workbench ${q.asCSSSelector(efe)} { color: ${$s}; }`);let _l=K.getColor(y);_l&&j.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(NQ)},.monaco-workbench ${q.asCSSSelector(NQ)} { color: ${_l}; }`);let mc=K.getColor(w);mc&&j.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(tV)},.monaco-workbench .debug-view-content ${q.asCSSSelector(tV)}, .monaco-workbench .debug-toolbar ${q.asCSSSelector(tV)}, .monaco-workbench .command-center-center ${q.asCSSSelector(tV)} { color: ${mc}; }`);let su=K.getColor(x);su&&j.addRule(`.monaco-workbench ${q.asCSSSelector(Jge)}, .monaco-workbench ${q.asCSSSelector(Bnt)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Jge)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Bnt)} { color: ${su}; }`);let yu=K.getColor(E);yu&&j.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Zge)}, .monaco-workbench ${q.asCSSSelector(Zge)} { color: ${yu}; }`);let sr=K.getColor(M);sr&&j.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Zie)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Zie)}, .monaco-workbench ${q.asCSSSelector(Zie)} { color: ${sr}; }`);let Lo=K.getColor(N);Lo&&j.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(eoe)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(eoe)}, .monaco-workbench ${q.asCSSSelector(eoe)} { color: ${Lo}; }`);let kc=K.getColor(V);kc&&j.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(tfe)}, .monaco-workbench ${q.asCSSSelector(tfe)}, .monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Unt)}, .monaco-workbench ${q.asCSSSelector(Unt)} { color: ${kc}; }`);let Cn=K.getColor(H);Cn&&j.addRule(`.monaco-workbench .part > .title > .title-actions .action-label${q.asCSSSelector(Hnt)}, .monaco-workbench ${q.asCSSSelector(Hnt)} { color: ${Cn}; }`)})}var znt=class a{static{this.INSTANCE=new a}constructor(){this.editorContributions=[]}registerEditorContribution(i,e){this.editorContributions.push({id:i,ctor:e})}getEditorContributions(){return this.editorContributions.slice(0)}};function Hm(a,i){znt.INSTANCE.registerEditorContribution(a,i)}var OQ;(e=>{function a(){return znt.INSTANCE.getEditorContributions()}e.getEditorContributions=a;function i(t){return znt.INSTANCE.getEditorContributions().filter(o=>t.indexOf(o.id)>=0)}e.getSomeEditorContributions=i})(OQ||={});var WLi=class{constructor(){this._frameId=0;this._domFrameLog()}_domFrameLog(){}debug(...i){let e=new Date;console.log(`${e.getSeconds()}:${e.getMilliseconds().toString().padStart(3,"0")}`,`frame #${this._frameId}: `,...i)}},uan=new WLi;function Syo(...a){uan.debug(...a)}var Knt=class{constructor(i,e){this.source=i;this.value=e;this.type=1}},i2t=class{constructor(i){this.source=i;this.type=2}},o2t=class{constructor(i,e){this.source=i;this.cell=e;this.type=3}};var em=class extends k{constructor(){super();this.cellDisposables=this._register(new O)}prepareRenderCell(e){}renderCell(e){this.currentCell=e,wP(()=>this.didRenderCell(e))}didRenderCell(e){}unrenderCell(e){this.currentCell=void 0,this.cellDisposables.clear()}prepareLayout(){}updateInternalLayoutNow(e){}updateState(e,t){}updateForExecutionState(e,t){}},Gnt=class extends k{constructor(){super();this.cellDisposables=this._register(new O)}prepareRenderCell(e){}renderCell(e){this.currentCell=e,this.didRenderCell(e)}didRenderCell(e){}unrenderCell(e){this.currentCell=void 0,this.cellDisposables.clear()}updateInternalLayoutNow(e){}updateState(e,t){}updateForExecutionState(e,t){}};function wP(a){try{return a()}catch(i){return mt(i),null}}var qnt=class a extends k{constructor(e,t,o){super();this.targetWindow=e;this.contentParts=t;this.overlayParts=o;this._scheduledOverlayRendering=this._register(new ue);this._scheduledOverlayUpdateState=this._register(new ue);this._scheduledOverlayUpdateExecutionState=this._register(new ue)}concatContentPart(e,t){return new a(t,this.contentParts.concat(e),this.overlayParts)}concatOverlayPart(e,t){return new a(t,this.contentParts,this.overlayParts.concat(e))}scheduleRenderCell(e){for(let t of this.contentParts)wP(()=>t.prepareRenderCell(e));for(let t of this.overlayParts)wP(()=>t.prepareRenderCell(e));for(let t of this.contentParts)wP(()=>t.renderCell(e));this._scheduledOverlayRendering.value=wY(this.targetWindow,()=>{for(let t of this.overlayParts)wP(()=>t.renderCell(e))})}unrenderCell(e){for(let t of this.contentParts)wP(()=>t.unrenderCell(e));this._scheduledOverlayRendering.value=void 0,this._scheduledOverlayUpdateState.value=void 0,this._scheduledOverlayUpdateExecutionState.value=void 0;for(let t of this.overlayParts)wP(()=>t.unrenderCell(e))}updateInternalLayoutNow(e){for(let t of this.contentParts)wP(()=>t.updateInternalLayoutNow(e));for(let t of this.overlayParts)wP(()=>t.updateInternalLayoutNow(e))}prepareLayout(){for(let e of this.contentParts)wP(()=>e.prepareLayout())}updateState(e,t){for(let o of this.contentParts)wP(()=>o.updateState(e,t));this._scheduledOverlayUpdateState.value=wY(this.targetWindow,()=>{for(let o of this.overlayParts)wP(()=>o.updateState(e,t))})}updateForExecutionState(e,t){for(let o of this.contentParts)wP(()=>o.updateForExecutionState(e,t));this._scheduledOverlayUpdateExecutionState.value=wY(this.targetWindow,()=>{for(let o of this.overlayParts)wP(()=>o.updateForExecutionState(e,t))})}};var pan=0,toe=class extends k{constructor(e,t,o){super();this.cellViewModel=e;this._outputRawData=t;this._notebookService=o;this._onDidResetRendererEmitter=this._register(new T);this.onDidResetRenderer=this._onDidResetRendererEmitter.event;this.alwaysShow=!1;this.visible=De("outputVisible",!1);this.outputHandle=pan++}setVisible(e=!0,t=!1){!e&&this.alwaysShow||(t&&e&&(this.alwaysShow=!0),this.visible.set(e,void 0))}get model(){return this._outputRawData}get pickedMimeType(){return this._pickedMimeType}set pickedMimeType(e){this._pickedMimeType=e}hasMultiMimeType(){if(this._outputRawData.outputs.length<2)return!1;let e=this._outputRawData.outputs[0].mime;return this._outputRawData.outputs.some(t=>t.mime!==e)}resolveMimeTypes(e,t){let o=this._notebookService.getOutputMimeTypeInfo(e,t,this.model),n=o.findIndex(r=>r.rendererId!==T2&&r.isTrusted);return[o,Math.max(n,0)]}resetRenderer(){this._pickedMimeType=void 0,this.model.bumpVersion(),this._onDidResetRendererEmitter.fire()}toRawJSON(){return{outputs:this._outputRawData.outputs}}};var JNe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.viewType=e;this.model=t;this.id=o;this._viewContext=n;this._configurationService=r;this._modelService=s;this._undoRedoService=l;this._codeEditorService=c;this._inlineChatSessionService=u;this._onDidChangeEditorAttachState=this._register(new T);this.onDidChangeEditorAttachState=this._onDidChangeEditorAttachState.event;this._onDidChangeState=this._register(new T);this.onDidChangeState=this._onDidChangeState.event;this._editState=0;this._lineNumbers="inherit";this._focusMode=0;this._editorListeners=[];this._editorViewStates=null;this._editorTransientState=null;this._resolvedCellDecorations=new Map;this._textModelRefChangeDisposable=this._register(new ue);this._cellDecorationsChanged=this._register(new T);this.onCellDecorationsChanged=this._cellDecorationsChanged.event;this._resolvedDecorations=new Map;this._lastDecorationId=0;this._cellStatusBarItems=new Map;this._onDidChangeCellStatusBarItems=this._register(new T);this.onDidChangeCellStatusBarItems=this._onDidChangeCellStatusBarItems.event;this._lastStatusBarId=0;this._dragging=!1;this._inputCollapsed=!1;this._outputCollapsed=!1;this._commentHeight=0;this._isDisposed=!1;this._isReadonly=!1;this._editStateSource="";this._register(t.onDidChangeMetadata(()=>{this._onDidChangeState.fire({metadataChanged:!0})})),this._register(t.onDidChangeInternalMetadata(p=>{this._onDidChangeState.fire({internalMetadataChanged:!0}),p.lastRunSuccessChanged&&this.layoutChange({})})),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("notebook.lineNumbers")&&(this.lineNumbers="inherit")})),this.model.collapseState?.inputCollapsed&&(this._inputCollapsed=!0),this.model.collapseState?.outputCollapsed&&(this._outputCollapsed=!0),this._commentOptions=this._configurationService.getValue("editor.comments",{overrideIdentifier:this.language}),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("editor.comments")&&(this._commentOptions=this._configurationService.getValue("editor.comments",{overrideIdentifier:this.language}))}))}get handle(){return this.model.handle}get uri(){return this.model.uri}get lineCount(){return this.model.textBuffer.getLineCount()}get metadata(){return this.model.metadata}get internalMetadata(){return this.model.internalMetadata}get language(){return this.model.language}get mime(){return typeof this.model.mime=="string"?this.model.mime:this.language==="markdown"?cr.markdown:cr.text}get lineNumbers(){return this._lineNumbers}set lineNumbers(e){e!==this._lineNumbers&&(this._lineNumbers=e,this._onDidChangeState.fire({cellLineNumberChanged:!0}))}get commentOptions(){return this._commentOptions}set commentOptions(e){this._commentOptions=e}get focusMode(){return this._focusMode}set focusMode(e){this._focusMode!==e&&(this._focusMode=e,this._onDidChangeState.fire({focusModeChanged:!0}))}get editorAttached(){return!!this._textEditor}get textModel(){return this.model.textModel}hasModel(){return!!this.textModel}get dragging(){return this._dragging}set dragging(e){this._dragging=e,this._onDidChangeState.fire({dragStateChanged:!0})}get isInputCollapsed(){return this._inputCollapsed}set isInputCollapsed(e){this._inputCollapsed=e,this._onDidChangeState.fire({inputCollapsedChanged:!0})}get isOutputCollapsed(){return this._outputCollapsed}set isOutputCollapsed(e){this._outputCollapsed=e,this._onDidChangeState.fire({outputCollapsedChanged:!0})}set commentHeight(e){this._commentHeight!==e&&(this._commentHeight=e,this.layoutChange({commentHeight:!0},"BaseCellViewModel#commentHeight"))}updateOptions(e){this._textEditor&&typeof e.readonly=="boolean"&&this._textEditor.updateOptions({readOnly:e.readonly}),typeof e.readonly=="boolean"&&(this._isReadonly=e.readonly)}assertTextModelAttached(){return!!(this.textModel&&this._textEditor&&this._textEditor.getModel()===this.textModel)}attachTextEditor(e,t){if(!e.hasModel())throw new Error("Invalid editor: model is missing");if(this._textEditor===e){this._editorListeners.length===0&&(this._editorListeners.push(this._textEditor.onDidChangeCursorSelection(()=>{this._onDidChangeState.fire({selectionChanged:!0})})),this._onDidChangeState.fire({selectionChanged:!0}));return}this._textEditor=e,this._isReadonly&&e.updateOptions({readOnly:this._isReadonly}),this._editorViewStates?this._restoreViewState(this._editorViewStates):t&&this._restoreViewState({contributionsState:{},cursorState:[],viewState:{scrollLeft:0,firstPosition:{lineNumber:1,column:1},firstPositionDeltaTop:this._viewContext.notebookOptions.getLayoutConfiguration().editorTopPadding}}),this._editorTransientState&&XN(e.getModel(),this._editorTransientState,this._codeEditorService),!this._isDisposed&&(e.changeDecorations(o=>{this._resolvedDecorations.forEach((n,r)=>{if(r.startsWith("_lazy_")){let s=o.addDecoration(n.options.range,n.options.options);this._resolvedDecorations.get(r).id=s}else{let s=o.addDecoration(n.options.range,n.options.options);this._resolvedDecorations.get(r).id=s}})}),this._editorListeners.push(e.onDidChangeCursorSelection(()=>{this._onDidChangeState.fire({selectionChanged:!0})})),this._editorListeners.push(this._inlineChatSessionService.onWillStartSession(o=>{o===this._textEditor&&this.textBuffer.getLength()===0&&this.enableAutoLanguageDetection()})),this._onDidChangeState.fire({selectionChanged:!0}),this._onDidChangeEditorAttachState.fire())}detachTextEditor(){this.saveViewState(),this.saveTransientState(),this._textEditor?.changeDecorations(e=>{this._resolvedDecorations.forEach(t=>{let o=t.id;o&&e.removeDecoration(o)})}),this._textEditor=void 0,je(this._editorListeners),this._editorListeners=[],this._onDidChangeEditorAttachState.fire(),this._textModelRef&&(this._textModelRef.dispose(),this._textModelRef=void 0),this._textModelRefChangeDisposable.clear()}getText(){return this.model.getValue()}getAlternativeId(){return this.model.alternativeId}getTextLength(){return this.model.getTextLength()}enableAutoLanguageDetection(){this.model.enableAutoLanguageDetection()}saveViewState(){this._textEditor&&(this._editorViewStates=this._textEditor.saveViewState())}saveTransientState(){!this._textEditor||!this._textEditor.hasModel()||(this._editorTransientState=Oie(this._textEditor.getModel(),this._codeEditorService))}saveEditorViewState(){return this._textEditor&&(this._editorViewStates=this._textEditor.saveViewState()),this._editorViewStates}restoreEditorViewState(e,t){this._editorViewStates=e}_restoreViewState(e){e&&this._textEditor?.restoreViewState(e)}addModelDecoration(e){if(!this._textEditor){let o=++this._lastDecorationId,n=`_lazy_${this.id};${o}`;return this._resolvedDecorations.set(n,{options:e}),n}let t;return this._textEditor.changeDecorations(o=>{t=o.addDecoration(e.range,e.options),this._resolvedDecorations.set(t,{id:t,options:e})}),t}removeModelDecoration(e){let t=this._resolvedDecorations.get(e);this._textEditor&&t&&t.id!==void 0&&this._textEditor.changeDecorations(o=>{o.removeDecoration(t.id)}),this._resolvedDecorations.delete(e)}deltaModelDecorations(e,t){return e.forEach(n=>{this.removeModelDecoration(n)}),t.map(n=>this.addModelDecoration(n))}_removeCellDecoration(e){let t=this._resolvedCellDecorations.get(e);if(this._resolvedCellDecorations.delete(e),t){for(let o of this._resolvedCellDecorations.values())t.className===o.className&&(t.className=void 0),t.outputClassName===o.outputClassName&&(t.outputClassName=void 0),t.gutterClassName===o.gutterClassName&&(t.gutterClassName=void 0),t.topClassName===o.topClassName&&(t.topClassName=void 0);this._cellDecorationsChanged.fire({added:[],removed:[t]})}}_addCellDecoration(e){let t=++this._lastDecorationId,o=`_cell_${this.id};${t}`;return this._resolvedCellDecorations.set(o,e),this._cellDecorationsChanged.fire({added:[e],removed:[]}),o}getCellDecorations(){return[...this._resolvedCellDecorations.values()]}getCellDecorationRange(e){return this._textEditor?this._textEditor.getModel()?.getDecorationRange(e)??null:null}deltaCellDecorations(e,t){return e.forEach(n=>{this._removeCellDecoration(n)}),t.map(n=>this._addCellDecoration(n))}deltaCellStatusBarItems(e,t){e.forEach(n=>{this._cellStatusBarItems.get(n)&&this._cellStatusBarItems.delete(n)});let o=t.map(n=>{let r=++this._lastStatusBarId,s=`_cell_${this.id};${r}`;return this._cellStatusBarItems.set(s,n),s});return this._onDidChangeCellStatusBarItems.fire(),o}getCellStatusBarItems(){return Array.from(this._cellStatusBarItems.values())}revealRangeInCenter(e){this._textEditor?.revealRangeInCenter(e,1)}setSelection(e){this._textEditor?.setSelection(e)}setSelections(e){e.length&&(this._textEditor?this._textEditor?.setSelections(e):this._editorViewStates&&(this._editorViewStates.cursorState=e.map(t=>({inSelectionMode:!t.isEmpty(),selectionStart:t.getStartPosition(),position:t.getEndPosition()}))))}getSelections(){return this._textEditor?.getSelections()??this._editorViewStates?.cursorState.map(e=>new ei(e.selectionStart.lineNumber,e.selectionStart.column,e.position.lineNumber,e.position.column))??[]}getSelectionsStartPosition(){return this._textEditor?this._textEditor.getSelections()?.map(t=>t.getStartPosition()):this._editorViewStates?.cursorState?.map(t=>t.selectionStart)}getLineScrollTopOffset(e){if(!this._textEditor)return 0;let t=this._viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return this._textEditor.getTopForLineNumber(e)+t.top}getPositionScrollTopOffset(e){if(!this._textEditor)return 0;let t=e instanceof ei?e.getPosition():e.getStartPosition(),o=this._viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return this._textEditor.getTopForPosition(t.lineNumber,t.column)+o.top}cursorAtLineBoundary(){if(!this._textEditor||!this.textModel||!this._textEditor.hasTextFocus())return 0;let e=this._textEditor.getSelection();if(!e||!e.isEmpty())return 0;let t=this.textModel.getLineLength(e.startLineNumber);if(t===0)return 3;switch(e.startColumn){case 1:return 1;case t+1:return 2;default:return 0}}cursorAtBoundary(){if(!this._textEditor)return 0;if(!this.textModel)return 0;let e=this._textEditor.getSelection();if(!e||!e.isEmpty())return 0;let t=this._textEditor.getTopForPosition(1,1),o=this._textEditor.getTopForPosition(this.textModel.getLineCount(),this.textModel.getLineLength(this.textModel.getLineCount())),n=this._textEditor.getTopForPosition(e.startLineNumber,e.startColumn);return n===o?n===t?3:2:n===t?1:0}get editStateSource(){return this._editStateSource}updateEditState(e,t){e!==this._editState&&(this._editStateSource=t,this._editState=e,this._onDidChangeState.fire({editStateChanged:!0}),this._editState===0&&(this.focusMode=0))}getEditState(){return this._editState}get textBuffer(){return this.model.textBuffer}async resolveTextModel(){if(!this._textModelRef||!this.textModel){if(this._textModelRef=await this._modelService.createModelReference(this.uri),this._isDisposed)return this.textModel;if(!this._textModelRef)throw new Error(`Cannot resolve text model for ${this.uri}`);this._textModelRefChangeDisposable.value=this.textModel.onDidChangeContent(()=>this.onDidChangeTextModelContent())}return this.textModel}cellStartFind(e,t){let o=[],n=this.textBuffer.getLineCount(),r=t.findScope?.selectedTextRanges??[new G(1,1,n,this.textBuffer.getLineLength(n)+1)];if(this.assertTextModelAttached())o=this.textModel.findMatches(e,r,t.regex||!1,t.caseSensitive||!1,t.wholeWord&&t.wordSeparators||null,t.regex||!1);else{let l=new Uw(e,t.regex||!1,t.caseSensitive||!1,t.wholeWord&&t.wordSeparators||null).parseSearchRequest();if(!l)return null;r.forEach(c=>{o.push(...this.textBuffer.findMatchesLineByLine(new G(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn),l,t.regex||!1,1e3))})}return o}dispose(){this._isDisposed=!0,super.dispose(),je(this._editorListeners),this._undoRedoService.getUriComparisonKey(this.uri)===this.uri.toString()&&this._undoRedoService.removeElements(this.uri),this._textModelRef?.dispose()}toJSON(){return{handle:this.handle}}};var cy=le("IInlineChatSessionService");async function gan(a,i,e,t){let o=a.get(Lt),n=a.get(si);if(!i)return;let r=n.startNewLocalSession("panel");r.object.inputModel.setState({...e,mode:{id:"agent",kind:"agent"}});let l=await o.openSession(r.object.sessionResource);r.dispose(),l&&t&&!t.selection.isEmpty()&&await l.attachmentModel.addFile(t.uri,t.selection),l?.acceptInput(i.message.text)}async function Iyo(a,i){let e=i.chatModel.getRequests().at(-1);e&&(await gan(a,e,i.chatModel.inputModel.state.get(),{uri:i.uri,selection:i.initialSelection}),i.dispose())}function yyo(a,i){let e=i.chatModel.getRequests().at(-1);if(e)return a.get(si).removeRequest(i.chatModel.sessionResource,e.id),i.chatModel.inputModel.setState({inputText:e.message.text}),i.setTerminationState(void 0),e.message.text}var ZNe=500,Ah=class extends JNe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,ht(),n,r,l,c,u,p);this.viewContext=n;this._notebookService=s;this.cellKind=2;this._onLayoutInfoRead=this._register(new T);this.onLayoutInfoRead=this._onLayoutInfoRead.event;this._onDidStartExecution=this._register(new T);this.onDidStartExecution=this._onDidStartExecution.event;this._onDidStopExecution=this._register(new T);this.onDidStopExecution=this._onDidStopExecution.event;this._onDidChangeOutputs=this._register(new T);this.onDidChangeOutputs=this._onDidChangeOutputs.event;this._onDidRemoveOutputs=this._register(new T);this.onDidRemoveOutputs=this._onDidRemoveOutputs.event;this._outputCollection=[];this._outputsTop=null;this._pauseableEmitter=this._register(new Ih);this.onDidChangeLayout=this._pauseableEmitter.event;this._editorHeight=0;this._chatHeight=0;this._hoveringOutput=!1;this._focusOnOutput=!1;this._focusInputInOutput=!1;this._outputMinHeight=0;this.executionErrorDiagnostic=De("excecutionError",void 0);this._hasFindResult=this._register(new T);this.hasFindResult=this._hasFindResult.event;this._outputViewModels=this.model.outputs.map(g=>new toe(this,g,this._notebookService)),this._register(this.model.onDidChangeOutputs(g=>{let f=[],v=!1;for(let b=g.start;b<g.start+g.deleteCount;b++)this._outputCollection[b]!==void 0&&this._outputCollection[b]!==0&&(v=!0);this._outputCollection.splice(g.start,g.deleteCount,...g.newOutputs.map(()=>0)),f.push(...this._outputViewModels.splice(g.start,g.deleteCount,...g.newOutputs.map(b=>new toe(this,b,this._notebookService)))),this._outputsTop=null,this._onDidChangeOutputs.fire(g),this._onDidRemoveOutputs.fire(f),v&&this.layoutChange({outputHeight:!0},"CodeCellViewModel#model.onDidChangeOutputs"),this._outputCollection.length||this.executionErrorDiagnostic.set(void 0,void 0),je(f)})),this._outputCollection=new Array(this.model.outputs.length);let h=this.viewContext.notebookOptions.getLayoutConfiguration();this._layoutInfo={fontInfo:o?.fontInfo||null,editorHeight:0,editorWidth:o?this.viewContext.notebookOptions.computeCodeCellEditorWidth(o.width):0,chatHeight:0,statusBarHeight:0,commentOffset:0,commentHeight:0,outputContainerOffset:0,outputTotalHeight:0,outputShowMoreContainerHeight:0,outputShowMoreContainerOffset:0,totalHeight:this.computeTotalHeight(17,0,0,0),codeIndicatorHeight:0,outputIndicatorHeight:0,bottomToolbarOffset:0,layoutState:0,estimatedHasHorizontalScrolling:!1,outlineWidth:1,topMargin:h.cellTopMargin,bottomMargin:h.cellBottomMargin}}set editorHeight(e){this._editorHeight!==e&&(this._editorHeight=e,this.layoutChange({editorHeight:!0},"CodeCellViewModel#editorHeight"))}get editorHeight(){throw new Error("editorHeight is write-only")}set chatHeight(e){this._chatHeight!==e&&(this._chatHeight=e,this.layoutChange({chatHeight:!0},"CodeCellViewModel#chatHeight"))}get chatHeight(){return this._chatHeight}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e,this._onDidChangeState.fire({outputIsHoveredChanged:!0})}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e,this._onDidChangeState.fire({outputIsFocusedChanged:!0})}get inputInOutputIsFocused(){return this._focusInputInOutput}set inputInOutputIsFocused(e){this._focusInputInOutput=e}get outputMinHeight(){return this._outputMinHeight}set outputMinHeight(e){this._outputMinHeight=e}get layoutInfo(){return this._layoutInfo}get outputsViewModels(){return this._outputViewModels}updateExecutionState(e){e.changed?(this.executionErrorDiagnostic.set(void 0,void 0),this._onDidStartExecution.fire(e)):this._onDidStopExecution.fire(e)}updateOptions(e){super.updateOptions(e),(e.cellStatusBarVisibility||e.insertToolbarPosition||e.cellToolbarLocation)&&this.layoutChange({})}pauseLayout(){this._pauseableEmitter.pause()}resumeLayout(){this._pauseableEmitter.resume()}layoutChange(e,t){this._ensureOutputsTop();let o=this.viewContext.notebookOptions.getLayoutConfiguration(),n=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),r=e.outputShowMoreContainerHeight?e.outputShowMoreContainerHeight:this._layoutInfo.outputShowMoreContainerHeight,s=Math.max(this._outputMinHeight,this.isOutputCollapsed?o.collapsedIndicatorHeight:this._outputsTop.getTotalSum()),l=e.commentHeight?this._commentHeight:this._layoutInfo.commentHeight,c=this.layoutInfo;if(this.isInputCollapsed){let u=o.collapsedIndicatorHeight,p=s+r,h=e.chatHeight?this._chatHeight:this._layoutInfo.chatHeight,g=o.cellTopMargin+o.collapsedIndicatorHeight,f=o.cellTopMargin+o.collapsedIndicatorHeight+o.cellBottomMargin+n.bottomToolbarGap+h+l+s+r,v=f-n.bottomToolbarGap-n.bottomToolbarHeight/2-r,b=this.viewContext.notebookOptions.computeBottomToolbarOffset(f,this.viewType),S=e.outerWidth!==void 0?this.viewContext.notebookOptions.computeCodeCellEditorWidth(e.outerWidth):this._layoutInfo?.editorWidth;this._layoutInfo={fontInfo:e.font??this._layoutInfo.fontInfo??null,editorHeight:this._layoutInfo.editorHeight,editorWidth:S,chatHeight:h,statusBarHeight:0,outputContainerOffset:g,outputTotalHeight:s,outputShowMoreContainerHeight:r,outputShowMoreContainerOffset:v,commentOffset:g+s,commentHeight:l,totalHeight:f,codeIndicatorHeight:u,outputIndicatorHeight:p,bottomToolbarOffset:b,layoutState:this._layoutInfo.layoutState,estimatedHasHorizontalScrolling:!1,outlineWidth:1,topMargin:o.cellTopMargin,bottomMargin:o.cellBottomMargin}}else{let u,p,h,g=!1,f=e.chatHeight?this._chatHeight:this._layoutInfo.chatHeight;if(!e.editorHeight&&this._layoutInfo.layoutState===2&&!e.outputHeight){let M=this.estimateEditorHeight(e.font?.lineHeight??this._layoutInfo.fontInfo?.lineHeight);p=M.editorHeight,g=M.hasHorizontalScrolling,h=this._layoutInfo.totalHeight,u=2}else if(e.editorHeight||this._layoutInfo.layoutState===3)p=this._editorHeight,h=this.computeTotalHeight(this._editorHeight,s,r,f),u=3,g=this._layoutInfo.estimatedHasHorizontalScrolling;else{let M=this.estimateEditorHeight(e.font?.lineHeight??this._layoutInfo.fontInfo?.lineHeight);p=M.editorHeight,g=M.hasHorizontalScrolling,h=this.computeTotalHeight(p,s,r,f),u=1}let v=this.viewContext.notebookOptions.computeEditorStatusbarHeight(this.internalMetadata,this.uri),b=p+v,S=s+r,y=o.editorToolbarHeight+o.cellTopMargin+f+p+v,w=h-n.bottomToolbarGap-n.bottomToolbarHeight/2-r,x=this.viewContext.notebookOptions.computeBottomToolbarOffset(h,this.viewType),E=e.outerWidth!==void 0?this.viewContext.notebookOptions.computeCodeCellEditorWidth(e.outerWidth):this._layoutInfo?.editorWidth;this._layoutInfo={fontInfo:e.font??this._layoutInfo.fontInfo??null,chatHeight:f,editorHeight:p,editorWidth:E,statusBarHeight:v,outputContainerOffset:y,outputTotalHeight:s,outputShowMoreContainerHeight:r,outputShowMoreContainerOffset:w,commentOffset:y+s,commentHeight:l,totalHeight:h,codeIndicatorHeight:b,outputIndicatorHeight:S,bottomToolbarOffset:x,layoutState:u,estimatedHasHorizontalScrolling:g,topMargin:o.cellTopMargin,bottomMargin:o.cellBottomMargin,outlineWidth:1}}this._fireOnDidChangeLayout({...e,totalHeight:this.layoutInfo.totalHeight!==c.totalHeight,source:t})}_fireOnDidChangeLayout(e){this._pauseableEmitter.fire(e)}restoreEditorViewState(e,t){super.restoreEditorViewState(e),t!==void 0&&this._layoutInfo.layoutState!==3&&(this._layoutInfo={...this._layoutInfo,totalHeight:t,layoutState:2})}getDynamicHeight(){return this._onLayoutInfoRead.fire(),this._layoutInfo.totalHeight}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.estimateEditorHeight(e);return this.computeTotalHeight(t.editorHeight,0,0,0)}else return this._layoutInfo.totalHeight}estimateEditorHeight(e=20){let t=!1,o=this.viewContext.getBaseCellEditorOptions(this.language);if(this.layoutInfo.fontInfo&&o.value.wordWrap==="off"){for(let l=0;l<this.lineCount;l++)if(this.textBuffer.getLineLastNonWhitespaceColumn(l+1)*(this.layoutInfo.fontInfo.typicalHalfwidthCharacterWidth+this.layoutInfo.fontInfo.letterSpacing)>this.layoutInfo.editorWidth){t=!0;break}}let n=t?12:0,r=this.viewContext.notebookOptions.computeEditorPadding(this.internalMetadata,this.uri);return{editorHeight:this.lineCount*e+r.top+r.bottom+n,hasHorizontalScrolling:t}}computeTotalHeight(e,t,o,n){let r=this.viewContext.notebookOptions.getLayoutConfiguration(),{bottomToolbarGap:s}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType);return r.editorToolbarHeight+r.cellTopMargin+n+e+this.viewContext.notebookOptions.computeEditorStatusbarHeight(this.internalMetadata,this.uri)+this._commentHeight+t+o+s+r.cellBottomMargin}onDidChangeTextModelContent(){this.getEditState()!==1&&(this.updateEditState(1,"onDidChangeTextModelContent"),this._onDidChangeState.fire({contentChanged:!0}))}onDeselect(){this.updateEditState(0,"onDeselect")}updateOutputShowMoreContainerHeight(e){this.layoutChange({outputShowMoreContainerHeight:e},"CodeCellViewModel#updateOutputShowMoreContainerHeight")}updateOutputMinHeight(e){this.outputMinHeight=e}unlockOutputHeight(){this.outputMinHeight=0,this.layoutChange({outputHeight:!0})}updateOutputHeight(e,t,o){if(e>=this._outputCollection.length)throw new Error("Output index out of range!");this._ensureOutputsTop();try{e===0||t>0?this._outputViewModels[e].setVisible(!0):t===0&&this._outputViewModels[e].setVisible(!1)}catch(n){let r=`Failed to update output height for cell ${this.handle}, output ${e}. this.outputCollection.length: ${this._outputCollection.length}, this._outputViewModels.length: ${this._outputViewModels.length}`;throw new Error(`${r}.
 Error: ${n.message}`)}this._outputViewModels[e].visible.get()&&t<28&&(t=28),this._outputCollection[e]=t,this._outputsTop.setValue(e,t)&&this.layoutChange({outputHeight:!0},o)}getOutputOffsetInContainer(e){if(this._ensureOutputsTop(),e>=this._outputCollection.length)throw new Error("Output index out of range!");return this._outputsTop.getPrefixSum(e-1)}getOutputOffset(e){return this.layoutInfo.outputContainerOffset+this.getOutputOffsetInContainer(e)}spliceOutputHeights(e,t,o){if(this._ensureOutputsTop(),this._outputsTop.removeValues(e,t),o.length){let n=new Uint32Array(o.length);for(let r=0;r<o.length;r++)n[r]=o[r];this._outputsTop.insertValues(e,n)}this.layoutChange({outputHeight:!0},"CodeCellViewModel#spliceOutputs")}_ensureOutputsTop(){if(!this._outputsTop){let e=new Uint32Array(this._outputCollection.length);for(let t=0;t<this._outputCollection.length;t++)e[t]=this._outputCollection[t];this._outputsTop=new fD(e)}}startFind(e,t){let o=super.cellStartFind(e,t);return o===null?null:{cell:this,contentMatches:o}}dispose(){super.dispose(),this._outputCollection=[],this._outputsTop=null,je(this._outputViewModels)}};Ah=I([m(4,B),m(5,kn),m(6,Bt),m(7,wl),m(8,Qt),m(9,cy)],Ah);var hS=class extends JNe{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,ht(),r,s,l,c,u,p);this.foldingDelegate=n;this.viewContext=r;this.cellKind=1;this._previewHeight=0;this._chatHeight=0;this._editorHeight=0;this._statusBarHeight=0;this._onDidChangeLayout=this._register(new T);this.onDidChangeLayout=this._onDidChangeLayout.event;this._hoveringOutput=!1;this._focusOnOutput=!1;this._hoveringCell=!1;this.outputsViewModels=[];this._hasFindResult=this._register(new T);this.hasFindResult=this._hasFindResult.event;let{bottomToolbarGap:h}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),g=this.viewContext.notebookOptions.getLayoutConfiguration();this._layoutInfo={chatHeight:0,editorHeight:0,previewHeight:0,fontInfo:o?.fontInfo||null,editorWidth:o?.width?this.viewContext.notebookOptions.computeMarkdownCellEditorWidth(o.width):0,commentOffset:0,commentHeight:0,bottomToolbarOffset:h,totalHeight:100,layoutState:0,foldHintHeight:0,statusBarHeight:0,outlineWidth:1,bottomMargin:g.markdownCellBottomMargin,topMargin:g.markdownCellTopMargin},this._register(this.onDidChangeState(f=>{this.viewContext.eventDispatcher.emit([new o2t(f,this.model)]),f.foldingStateChanged&&this._updateTotalHeight(this._computeTotalHeight(),0)}))}get renderedHtml(){return this._renderedHtml}set renderedHtml(e){this._renderedHtml!==e&&(this._renderedHtml=e,this._onDidChangeState.fire({contentChanged:!0}))}get layoutInfo(){return this._layoutInfo}set renderedMarkdownHeight(e){this._previewHeight=e,this._updateTotalHeight(this._computeTotalHeight())}set chatHeight(e){this._chatHeight=e,this._updateTotalHeight(this._computeTotalHeight())}get chatHeight(){return this._chatHeight}set editorHeight(e){this._editorHeight=e,this._statusBarHeight=this.viewContext.notebookOptions.computeStatusBarHeight(),this._updateTotalHeight(this._computeTotalHeight())}get editorHeight(){throw new Error("MarkdownCellViewModel.editorHeight is write only")}get foldingState(){return this.foldingDelegate.getFoldingState(this.foldingDelegate.getCellIndex(this))}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e}get inputInOutputIsFocused(){return!1}set inputInOutputIsFocused(e){}get cellIsHovered(){return this._hoveringCell}set cellIsHovered(e){this._hoveringCell=e,this._onDidChangeState.fire({cellIsHoveredChanged:!0})}_computeTotalHeight(){let e=this.viewContext.notebookOptions.getLayoutConfiguration(),{bottomToolbarGap:t}=this.viewContext.notebookOptions.computeBottomToolbarDimensions(this.viewType),o=this._computeFoldHintHeight();return this.getEditState()===1?this._editorHeight+e.markdownCellTopMargin+e.markdownCellBottomMargin+t+this._statusBarHeight+this._commentHeight:Math.max(1,this._previewHeight+t+o+this._commentHeight)}_computeFoldHintHeight(){return this.getEditState()===1||this.foldingState!==2?0:this.viewContext.notebookOptions.getLayoutConfiguration().markdownFoldHintHeight}updateOptions(e){super.updateOptions(e),(e.cellStatusBarVisibility||e.insertToolbarPosition||e.cellToolbarLocation)&&this._updateTotalHeight(this._computeTotalHeight())}getOutputOffset(e){return-1}updateOutputHeight(e,t){}triggerFoldingStateChange(){this._onDidChangeState.fire({foldingStateChanged:!0})}_updateTotalHeight(e,t){e!==this.layoutInfo.totalHeight&&this.layoutChange({totalHeight:e,context:t})}layoutChange(e){let t,o;this.isInputCollapsed?(t=this.viewContext.notebookOptions.computeCollapsedMarkdownCellHeight(this.viewType),e.totalHeight=t,o=0):(t=e.totalHeight===void 0?this._layoutInfo.layoutState===0?100:this._layoutInfo.totalHeight:e.totalHeight,o=this._computeFoldHintHeight());let n,r=this.viewContext.notebookOptions.getLayoutConfiguration();this.getEditState()===1?n=r.editorToolbarHeight+r.cellTopMargin+this._chatHeight+this._editorHeight+this._statusBarHeight:n=this._previewHeight,this._layoutInfo={fontInfo:e.font||this._layoutInfo.fontInfo,editorWidth:e.outerWidth!==void 0?this.viewContext.notebookOptions.computeMarkdownCellEditorWidth(e.outerWidth):this._layoutInfo.editorWidth,chatHeight:this._chatHeight,editorHeight:this._editorHeight,statusBarHeight:this._statusBarHeight,previewHeight:this._previewHeight,bottomToolbarOffset:this.viewContext.notebookOptions.computeBottomToolbarOffset(t,this.viewType),totalHeight:t,layoutState:3,foldHintHeight:o,commentOffset:n,commentHeight:e.commentHeight?this._commentHeight:this._layoutInfo.commentHeight,outlineWidth:1,bottomMargin:r.markdownCellBottomMargin,topMargin:r.markdownCellTopMargin},this._onDidChangeLayout.fire(e)}restoreEditorViewState(e,t){super.restoreEditorViewState(e),t!==void 0&&this.layoutInfo.layoutState===0&&(this._layoutInfo={...this.layoutInfo,totalHeight:t,chatHeight:this._chatHeight,editorHeight:this._editorHeight,statusBarHeight:this._statusBarHeight,layoutState:2},this.layoutChange({}))}getDynamicHeight(){return null}getHeight(e){return this._layoutInfo.layoutState===0?100:this._layoutInfo.totalHeight}onDidChangeTextModelContent(){this._onDidChangeState.fire({contentChanged:!0})}onDeselect(){}startFind(e,t){let o=super.cellStartFind(e,t);return o===null?null:{cell:this,contentMatches:o}}dispose(){super.dispose(),this.foldingDelegate=null}};hS=I([m(5,B),m(6,Bt),m(7,wl),m(8,Qt),m(9,cy)],hS);var nfe=class extends em{constructor(e,t){super();this.instantiationService=t;this.cellContextKeyManager=this._register(this.instantiationService.createInstance(rfe,e,void 0))}didRenderCell(e){this.cellContextKeyManager.updateForElement(e)}};nfe=I([m(1,F)],nfe);var rfe=class extends k{constructor(e,t,o,n){super();this.notebookEditor=e;this.element=t;this._contextKeyService=o;this._notebookExecutionStateService=n;this.elementDisposables=this._register(new O);this._contextKeyService.bufferChangeEvents(()=>{this.cellType=lI.bindTo(this._contextKeyService),this.cellEditable=OC.bindTo(this._contextKeyService),this.cellFocused=Vge.bindTo(this._contextKeyService),this.cellEditorFocused=bP.bindTo(this._contextKeyService),this.markdownEditMode=Wie.bindTo(this._contextKeyService),this.cellRunState=Bge.bindTo(this._contextKeyService),this.cellExecuting=xKt.bindTo(this._contextKeyService),this.cellHasOutputs=PE.bindTo(this._contextKeyService),this.cellContentCollapsed=PNe.bindTo(this._contextKeyService),this.cellOutputCollapsed=Ent.bindTo(this._contextKeyService),this.cellLineNumbers=knt.bindTo(this._contextKeyService),this.cellResource=lIo.bindTo(this._contextKeyService),this.cellHasErrorDiagnostics=Hge.bindTo(this._contextKeyService),t&&this.updateForElement(t)}),this._register(this._notebookExecutionStateService.onDidChangeExecution(r=>{r.type===0&&this.element&&r.affectsCell(this.element.uri)&&this.updateForExecutionState()}))}updateForElement(e){this.elementDisposables.clear(),this.element=e,e&&(this.elementDisposables.add(e.onDidChangeState(t=>this.onDidChangeState(t))),e instanceof Ah&&(this.elementDisposables.add(e.onDidChangeOutputs(()=>this.updateForOutputs())),this.elementDisposables.add(ve(t=>{this.cellHasErrorDiagnostics.set(!!t.readObservable(e.executionErrorDiagnostic))}))),this.elementDisposables.add(this.notebookEditor.onDidChangeActiveCell(()=>this.updateForFocusState())),this.element instanceof hS?this.cellType.set("markup"):this.element instanceof Ah&&this.cellType.set("code"),this._contextKeyService.bufferChangeEvents(()=>{this.updateForFocusState(),this.updateForExecutionState(),this.updateForEditState(),this.updateForCollapseState(),this.updateForOutputs(),this.cellLineNumbers.set(this.element.lineNumbers),this.cellResource.set(this.element.uri.toString())}))}onDidChangeState(e){this._contextKeyService.bufferChangeEvents(()=>{e.internalMetadataChanged&&this.updateForExecutionState(),e.editStateChanged&&this.updateForEditState(),e.focusModeChanged&&this.updateForFocusState(),e.cellLineNumberChanged&&this.cellLineNumbers.set(this.element.lineNumbers),(e.inputCollapsedChanged||e.outputCollapsedChanged)&&this.updateForCollapseState()})}updateForFocusState(){if(!this.element)return;let e=this.notebookEditor.getActiveCell();this.cellFocused.set(this.notebookEditor.getActiveCell()===this.element),e===this.element?this.cellEditorFocused.set(this.element.focusMode===1):this.cellEditorFocused.set(!1)}updateForExecutionState(){if(!this.element)return;let e=this.element.internalMetadata;this.cellEditable.set(!this.notebookEditor.isReadOnly);let t=this._notebookExecutionStateService.getCellExecution(this.element.uri);this.element instanceof hS?(this.cellRunState.reset(),this.cellExecuting.reset()):t?.state===3?(this.cellRunState.set("executing"),this.cellExecuting.set(!0)):t?.state===2||t?.state===1?(this.cellRunState.set("pending"),this.cellExecuting.set(!0)):e.lastRunSuccess===!0?(this.cellRunState.set("succeeded"),this.cellExecuting.set(!1)):e.lastRunSuccess===!1?(this.cellRunState.set("failed"),this.cellExecuting.set(!1)):(this.cellRunState.set("idle"),this.cellExecuting.set(!1))}updateForEditState(){this.element&&(this.element instanceof hS?this.markdownEditMode.set(this.element.getEditState()===1):this.markdownEditMode.set(!1))}updateForCollapseState(){this.element&&(this.cellContentCollapsed.set(!!this.element.isInputCollapsed),this.cellOutputCollapsed.set(!!this.element.isOutputCollapsed))}updateForOutputs(){this.element instanceof Ah?this.cellHasOutputs.set(this.element.outputsViewModels.length>0):this.cellHasOutputs.set(!1)}};rfe=I([m(2,X),m(3,Ns)],rfe);var fan=_,Cyo="cell-dragging",VLi="global-drag-active",$nt=class extends em{constructor(e){super();this.container=e}didRenderCell(e){this.update(e)}updateState(e,t){t.dragStateChanged&&this.update(e)}update(e){this.container.classList.toggle(Cyo,e.dragging)}},n2t=class extends k{constructor(e,t){super();this.notebookEditor=e;this.notebookListContainer=t;this.draggedCells=[];this.isScrolling=!1;this.listOnWillScrollListener=this._register(new ue);this.listInsertionIndicator=D(t,fan(".cell-list-insertion-indicator")),this._register($(t.ownerDocument.body,ne.DRAG_START,this.onGlobalDragStart.bind(this),!0)),this._register($(t.ownerDocument.body,ne.DRAG_END,this.onGlobalDragEnd.bind(this),!0));let o=(n,r,s=!1)=>{this._register($(e.getDomNode(),n,l=>{let c=this.toCellDragEvent(l);c&&r(c)},s))};o(ne.DRAG_OVER,n=>{this.currentDraggedCell&&(n.browserEvent.preventDefault(),this.onCellDragover(n))},!0),o(ne.DROP,n=>{this.currentDraggedCell&&(n.browserEvent.preventDefault(),this.onCellDrop(n))}),o(ne.DRAG_LEAVE,n=>{n.browserEvent.preventDefault(),this.onCellDragLeave(n)}),this.scrollingDelayer=this._register(new rn(200))}setList(e){this.list=e,this.listOnWillScrollListener.value=this.list.onWillScroll(t=>{t.scrollTopChanged&&(this.setInsertIndicatorVisibility(!1),this.isScrolling=!0,this.scrollingDelayer.trigger(()=>{this.isScrolling=!1}))})}setInsertIndicatorVisibility(e){this.listInsertionIndicator.style.opacity=e?"1":"0"}toCellDragEvent(e){let t=this.notebookListContainer.getBoundingClientRect().top,o=this.list.scrollTop+e.clientY-t,n=this.list.elementAt(o);if(!n)return;let r=this.list.getCellViewScrollTop(n),s=this.list.elementHeight(n),c=(o-r)/s;return{browserEvent:e,draggedOverCell:n,cellTop:r,cellHeight:s,dragPosRatio:c}}clearGlobalDragState(){this.notebookEditor.getDomNode().classList.remove(VLi)}onGlobalDragStart(){this.notebookEditor.getDomNode().classList.add(VLi)}onGlobalDragEnd(){this.notebookEditor.getDomNode().classList.remove(VLi)}onCellDragover(e){if(!e.browserEvent.dataTransfer)return;if(!this.currentDraggedCell){e.browserEvent.dataTransfer.dropEffect="none";return}if(this.isScrolling||this.currentDraggedCell===e.draggedOverCell){this.setInsertIndicatorVisibility(!1);return}let t=this.getDropInsertDirection(e.dragPosRatio),o=t==="above"?e.cellTop:e.cellTop+e.cellHeight;this.updateInsertIndicator(t,o)}updateInsertIndicator(e,t){let{bottomToolbarGap:o}=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),n=t-this.list.scrollTop+o/2;n>=0?(this.listInsertionIndicator.style.top=`${n}px`,this.setInsertIndicatorVisibility(!0)):this.setInsertIndicatorVisibility(!1)}getDropInsertDirection(e){return e<.5?"above":"below"}onCellDrop(e){let t=this.currentDraggedCell;if(this.isScrolling||this.currentDraggedCell===e.draggedOverCell)return;this.dragCleanup();let o=this.getDropInsertDirection(e.dragPosRatio);this._dropImpl(t,o,e.browserEvent,e.draggedOverCell)}getCellRangeAroundDragTarget(e){let t=this.notebookEditor.getSelections(),n=vZ(this.notebookEditor,t).find(r=>r.start<=e&&e<r.end);return n||{start:e,end:e+1}}_dropImpl(e,t,o,n){let r=this.list.getCellViewScrollTop(n),s=this.list.elementHeight(n),l=t==="above"?r:r+s,{bottomToolbarGap:c}=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),u=l-this.list.scrollTop+c/2,p=this.notebookEditor.getDomNode().getBoundingClientRect().height;if(u<0||u>p)return;let h=o.ctrlKey&&!et||o.altKey&&et;if(!this.notebookEditor.hasModel())return;let g=this.notebookEditor.textModel;if(h){let f=this.notebookEditor.getCellIndex(e),v=this.getCellRangeAroundDragTarget(f),b=this.notebookEditor.getCellIndex(n);if(t==="below"){let w=this.notebookEditor.getCellIndex(n);b=this.notebookEditor.getNextVisibleCellIndex(w)}let S,y;if(b<=v.start)S={start:b,end:b+v.end-v.start},y={start:b+f-v.start,end:b+f-v.start+1};else{let w=b-v.start;S={start:v.start+w,end:v.end+w},y={start:f+w,end:f+w+1}}g.applyEdits([{editType:1,index:b,count:0,cells:yv([v]).map(w=>_q(this.notebookEditor.cellAt(w).model))}],!0,{kind:1,focus:this.notebookEditor.getFocus(),selections:this.notebookEditor.getSelections()},()=>({kind:1,focus:y,selections:[S]}),void 0,!0),this.notebookEditor.revealCellRangeInView(S)}else van(this.notebookEditor,e,t,n)}onCellDragLeave(e){(!e.browserEvent.relatedTarget||!ms(e.browserEvent.relatedTarget,this.notebookEditor.getDomNode()))&&this.setInsertIndicatorVisibility(!1)}dragCleanup(){this.currentDraggedCell&&(this.draggedCells.forEach(e=>e.dragging=!1),this.currentDraggedCell=void 0,this.draggedCells=[]),this.setInsertIndicatorVisibility(!1)}registerDragHandle(e,t,o,n){let r=e.container;for(let c of o)c.setAttribute("draggable","true");let s=()=>{!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly||(r.classList.remove(Cyo),this.dragCleanup())};for(let c of o)e.templateDisposables.add($(c,ne.DRAG_END,s));let l=c=>{if(!c.dataTransfer||!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly)return;this.currentDraggedCell=e.currentRenderedCell,this.draggedCells=this.notebookEditor.getSelections().map(p=>this.notebookEditor.getCellsInRange(p)).flat(),this.draggedCells.forEach(p=>p.dragging=!0);let u=n();t.parentElement.appendChild(u),c.dataTransfer.setDragImage(u,0,0),setTimeout(()=>u.remove(),0)};for(let c of o)e.templateDisposables.add($(c,ne.DRAG_START,l))}startExplicitDrag(e,t){!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly||(this.currentDraggedCell=e,this.setInsertIndicatorVisibility(!0))}explicitDrag(e,t){if(!this.notebookEditor.notebookOptions.getDisplayOptions().dragAndDropEnabled||this.notebookEditor.isReadOnly)return;let o=this.list.elementAt(t);if(o&&o!==e){let u=this.list.getCellViewScrollTop(o),p=this.list.elementHeight(o),h=this.getExplicitDragDropDirection(t,u,p),g=h==="above"?u:u+p;this.updateInsertIndicator(h,g)}if(this.currentDraggedCell!==e)return;let n=this.notebookEditor.getDomNode().getBoundingClientRect(),r=t-this.list.scrollTop,s=.2,l=20,c=r/n.height;c<s?this.list.scrollTop-=l*(1-c/s):c>1-s&&(this.list.scrollTop+=l*(1-(1-c)/s))}endExplicitDrag(e){this.setInsertIndicatorVisibility(!1)}explicitDrop(e,t){this.currentDraggedCell=void 0,this.setInsertIndicatorVisibility(!1);let o=this.list.elementAt(t.dragOffsetY);if(!o||o===e)return;let n=this.list.getCellViewScrollTop(o),r=this.list.elementHeight(o),s=this.getExplicitDragDropDirection(t.dragOffsetY,n,r);this._dropImpl(e,s,t,o)}getExplicitDragDropDirection(e,t,o){let r=(e-t)/o;return this.getDropInsertDirection(r)}dispose(){this.notebookEditor=null,super.dispose()}};function van(a,i,e,t){let o=a.getCellIndex(i),n=a.getCellIndex(t);if(typeof o!="number"||typeof n!="number")return;e==="below"&&(n=a.getNextVisibleCellIndex(n)??n);let r=a.getSelections();r.length||(r=[a.getFocus()]);let s=a.getFocus().start;r.some(b=>b.start<=o&&b.end>o)||(r=[{start:o,end:o+1}],s=o);let l=r.find(b=>b.start<=n&&b.end>n);l&&(n=l.start);let c=0,u=n,p=n;r.sort((b,S)=>S.start-b.start);let h=r.map(b=>{let S=b.end-b.start,y=0;b.end<=p&&(y=-S);let w=p+y;if(s>=b.start&&s<=b.end){let M=s-b.start;u=w+M}let x=b.start>=n?c:0,E={editType:6,index:b.start+x,length:S,newIdx:w};return c+=S,b.end<p&&(p-=S),E}),g=h[h.length-1],f={start:g.newIdx,end:g.newIdx+c},v={start:u,end:u+1};a.textModel.applyEdits(h,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:v,selections:[f]}),void 0,!0),a.revealCellRangeInView(f)}var r2t=class{constructor(i){this._items=[];this._whitespace=[];this._prefixSumComputer=new xCe([]);this._size=0;this._paddingTop=0;this._paddingTop=i??0,this._size=this._paddingTop}get paddingTop(){return this._paddingTop}set paddingTop(i){this._size=this._size+i-this._paddingTop,this._paddingTop=i}get count(){return this._items.length}get size(){return this._size}getWhitespaces(){return this._whitespace}restoreWhitespace(i){this._whitespace=i,this._size=this._paddingTop+this._items.reduce((e,t)=>e+t.size,0)+this._whitespace.reduce((e,t)=>e+t.size,0)}splice(i,e,t){let o=t??[];this._items.splice(i,e,...o),this._size=this._paddingTop+this._items.reduce((r,s)=>r+s.size,0)+this._whitespace.reduce((r,s)=>r+s.size,0),this._prefixSumComputer.removeValues(i,e);let n=[];for(let r=0;r<o.length;r++){let s=r+i,l=this._whitespace.filter(c=>c.afterPosition===s+1);l.length>0?n.push(o[r].size+l.reduce((c,u)=>c+u.size,0)):n.push(o[r].size)}this._prefixSumComputer.insertValues(i,n);for(let r=i;r<this._items.length;r++){let s=this._whitespace.filter(l=>l.afterPosition===r+1);s.length>0?this._prefixSumComputer.setValue(r,this._items[r].size+s.reduce((l,c)=>l+c.size,0)):this._prefixSumComputer.setValue(r,this._items[r].size)}}insertWhitespace(i,e,t){let o=0,n=this._whitespace.filter(r=>r.afterPosition===e);if(n.length>0&&(o=Math.max(...n.map(r=>r.priority))+1),this._whitespace.push({id:i,afterPosition:e,size:t,priority:o}),this._size+=t,this._whitespace.sort((r,s)=>r.afterPosition===s.afterPosition?r.priority-s.priority:r.afterPosition-s.afterPosition),e>0){let r=e-1,l=this._items[r].size+t;this._prefixSumComputer.setValue(r,l)}}changeOneWhitespace(i,e,t){let o=this._whitespace.findIndex(n=>n.id===i);if(o!==-1){let n=this._whitespace[o],r=n.afterPosition;n.afterPosition=e;let s=n.size,l=t-s;if(n.size=t,this._size+=l,r>0&&r<=this._items.length){let c=r-1,p=this._items[c].size;this._prefixSumComputer.setValue(c,p)}if(e>0&&e<=this._items.length){let c=e-1,p=this._items[c].size+t;this._prefixSumComputer.setValue(c,p)}}}removeWhitespace(i){let e=this._whitespace.findIndex(t=>t.id===i);if(e!==-1){let t=this._whitespace[e];if(this._whitespace.splice(e,1),this._size-=t.size,t.afterPosition>0){let o=t.afterPosition-1,n=this._items[o].size,r=this._whitespace.filter(l=>l.afterPosition===t.afterPosition),s=n+r.reduce((l,c)=>l+c.size,0);this._prefixSumComputer.setValue(o,s)}}}getWhitespacePosition(i){let e=this._whitespace.find(l=>l.id===i);if(!e)throw new Error("Whitespace not found");let t=e.afterPosition;if(t===0)return this._whitespace.filter(c=>c.afterPosition===t&&c.priority<e.priority).reduce((c,u)=>c+u.size,0)+this.paddingTop;let o=this._whitespace.filter(l=>l.afterPosition===0).reduce((l,c)=>l+c.size,0),n=t-1,r=this._prefixSumComputer.getPrefixSum(n),s=this._items[n].size;return r+s+o+this.paddingTop}indexAt(i){if(i<0)return-1;let e=this._whitespace.filter(o=>o.afterPosition===0).reduce((o,n)=>o+n.size,0),t=i-(this._paddingTop+e);return t<=0?0:t>=this._size-this._paddingTop-e?this.count:this._prefixSumComputer.getIndexOf(Math.trunc(t)).index}indexAfter(i){let e=this.indexAt(i);return Math.min(e+1,this._items.length)}positionAt(i){if(i<0||this.count===0||i>=this.count)return-1;let e=this._whitespace.filter(t=>t.afterPosition===0).reduce((t,o)=>t+o.size,0);return this._prefixSumComputer.getPrefixSum(i)+this._paddingTop+e}},s2t=class extends fke{constructor(){super(...arguments);this._lastWhitespaceId=0;this._renderingStack=0}get inRenderingTransaction(){return this._renderingStack>0}get notebookRangeMap(){return this.rangeMap}render(e,t,o,n,r,s){this._renderingStack++,super.render(e,t,o,n,r,s),this._renderingStack--}_rerender(e,t,o){this._renderingStack++,super._rerender(e,t,o),this._renderingStack--}createRangeMap(e){let t=this.rangeMap;if(t){let o=new r2t(e);return o.restoreWhitespace(t.getWhitespaces()),o}else return new r2t(e)}insertWhitespace(e,t){let o=this.scrollTop,n=`${++this._lastWhitespaceId}`,r=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),s=this.elementTop(e),l=o>s;this.notebookRangeMap.insertWhitespace(n,e,t);let c=l?o+t:o;return this.render(r,c,this.lastRenderHeight,void 0,void 0,!1),this._rerender(c,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions(),n}changeOneWhitespace(e,t,o){let n=this.scrollTop,r=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.notebookRangeMap.getWhitespacePosition(e)>n?(this.notebookRangeMap.changeOneWhitespace(e,t,o),this.render(r,n,this.lastRenderHeight,void 0,void 0,!1),this._rerender(n,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions()):(this.notebookRangeMap.changeOneWhitespace(e,t,o),this.eventuallyUpdateScrollDimensions())}removeWhitespace(e){let t=this.scrollTop,o=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.notebookRangeMap.removeWhitespace(e),this.render(o,t,this.lastRenderHeight,void 0,void 0,!1),this._rerender(t,this.renderHeight,!1),this.eventuallyUpdateScrollDimensions()}getWhitespacePosition(e){return this.notebookRangeMap.getWhitespacePosition(e)}};var a2t=class{constructor(i,e,t){this.notebookExecutionStateService=i;this.configurationService=e;this.scrollEvent=t;this.stopAnchoring=!1}shouldAnchor(i,e,t,o){if(i.element(e).focusMode===1)return!0;if(this.stopAnchoring)return!1;let n=i.elementTop(e)+i.elementHeight(e)+t,s=i.renderHeight+i.getScrollTop()>n,l=this.configurationService.getValue(Ct.scrollToRevealCell)!=="none",c=t>0;return l&&c&&!s?(this.watchAchorDuringExecution(o),!0):!1}watchAchorDuringExecution(i){if(!this.executionWatcher&&i.cellKind===2){let e=this.notebookExecutionStateService.getCellExecution(i.uri);e&&e.state===3&&(this.executionWatcher=i.onDidStopExecution(()=>{this.executionWatcher?.dispose(),this.executionWatcher=void 0,this.scrollWatcher?.dispose(),this.stopAnchoring=!1}),this.scrollWatcher=this.scrollEvent(t=>{t.scrollTop<t.oldScrollTop&&(this.stopAnchoring=!0,this.scrollWatcher?.dispose())}))}}dispose(){this.executionWatcher?.dispose(),this.scrollWatcher?.dispose()}};var BLi=()=>{throw new Error("Invalid notebook view zone change accessor")},l2t=class extends k{constructor(e,t){super();this.listView=e;this.coordinator=t;this.domNode=Ir(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setWidth("100%"),this._zones={},this.listView.containerDomNode.appendChild(this.domNode.domNode)}changeViewZones(e){let t=!1,o={addZone:n=>(t=!0,this._addZone(n)),removeZone:n=>{t=!0,this._removeZone(n)},layoutZone:n=>{t=!0,this._layoutZone(n)}};return ban(e,o),o.addZone=BLi,o.removeZone=BLi,o.layoutZone=BLi,t}getViewZoneLayoutInfo(e){let t=this._zones[e];if(!t)return null;let o=this.listView.getWhitespacePosition(t.whitespaceId);return{height:t.zone.heightInPx,top:o}}onCellsChanged(e){e.splices.slice().reverse().forEach(o=>{let[n,r,s]=o,l=n,c=n+r;for(let u in this._zones){let p=this._zones[u].zone,h=p.afterModelPosition-1;if(h>=l&&h<c)p.afterModelPosition=l,this._updateWhitespace(this._zones[u]);else if(h>=c){let f=s.length-r;p.afterModelPosition+=f,this._updateWhitespace(this._zones[u])}}})}onHiddenRangesChange(){for(let e in this._zones)this._updateWhitespace(this._zones[e])}_updateWhitespace(e){let t=e.whitespaceId,o=this.coordinator.convertModelIndexToViewIndex(e.zone.afterModelPosition),n=this._isInHiddenRanges(e.zone);e.isInHiddenArea=n,this.listView.changeOneWhitespace(t,o,n?0:e.zone.heightInPx)}layout(){for(let e in this._zones)this._layoutZone(e)}_addZone(e){let t=this.coordinator.convertModelIndexToViewIndex(e.afterModelPosition),o=this.listView.insertWhitespace(t,e.heightInPx),n=this._isInHiddenRanges(e),r={whitespaceId:o,zone:e,domNode:Ir(e.domNode),isInHiddenArea:n};return this._zones[o]=r,r.domNode.setPosition("absolute"),r.domNode.domNode.style.width="100%",r.domNode.setDisplay("none"),r.domNode.setAttribute("notebook-view-zone",o),this.domNode.appendChild(r.domNode),o}_removeZone(e){this.listView.removeWhitespace(e);let t=this._zones[e];if(t)try{this.domNode.removeChild(t.domNode)}catch{}delete this._zones[e]}_layoutZone(e){let t=this._zones[e];if(!t)return;if(this._updateWhitespace(this._zones[e]),this._isInHiddenRanges(t.zone))t.domNode.setDisplay("none");else{let n=this.listView.getWhitespacePosition(t.whitespaceId);t.domNode.setTop(n),t.domNode.setDisplay("block"),t.domNode.setHeight(t.zone.heightInPx)}}_isInHiddenRanges(e){let t=e.afterModelPosition;return!this.coordinator.modelIndexIsVisible(t)}dispose(){super.dispose(),this._zones={}}};function ban(a,i){try{a(i)}catch(e){mt(e)}}var HLi=class a extends z{static{this.viewZoneIds=[]}constructor(){super({id:"notebook.developer.addViewZones",title:P(13979,"Toggle Notebook View Zones"),category:Fe.Developer,precondition:_4,f1:!0})}async run(i){let e=i.get(ie),t=lr(e.activeEditorPane);t&&(a.viewZoneIds.length>0?t.changeViewZones(o=>{a.viewZoneIds.reverse().forEach(n=>{o.removeZone(n)}),a.viewZoneIds=[]}):t.changeViewZones(o=>{let n=t.getCellsInRange();if(n.length===0)return;let r=[];for(let s=0;s<n.length;s++){let l=document.createElement("div");l.innerText=`View Zone ${s}`,l.style.backgroundColor="rgba(0, 255, 0, 0.5)";let c=o.addZone({afterModelPosition:s,heightInPx:200,domNode:l});r.push(c)}a.viewZoneIds=r}))}};W(HLi);var c2t=class extends k{constructor(e){super();this.listView=e;this._lastOverlayId=0;this._overlays=Object.create(null);this.domNode=Ir(document.createElement("div")),this.domNode.setClassName("cell-overlays"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setWidth("100%"),this.listView.containerDomNode.appendChild(this.domNode.domNode)}changeCellOverlays(e){let t=!1;return e({addOverlay:n=>(t=!0,this._addOverlay(n)),removeOverlay:n=>{t=!0,this._removeOverlay(n)},layoutOverlay:n=>{t=!0,this._layoutOverlay(n)}}),t}onCellsChanged(e){this.layout()}onHiddenRangesChange(){this.layout()}layout(){for(let e in this._overlays)this._layoutOverlay(e)}_addOverlay(e){let t=`${++this._lastOverlayId}`,o={overlayId:t,overlay:e,domNode:Ir(e.domNode)};return this._overlays[t]=o,o.domNode.setClassName("cell-overlay"),o.domNode.setPosition("absolute"),this.domNode.appendChild(o.domNode),t}_removeOverlay(e){let t=this._overlays[e];if(t){try{this.domNode.removeChild(t.domNode)}catch{}delete this._overlays[e]}}_layoutOverlay(e){let t=this._overlays[e];if(!t)return;if(this._isInHiddenRanges(t)){t.domNode.setDisplay("none");return}t.domNode.setDisplay("block");let n=this.listView.indexOf(t.overlay.cell);if(n===-1)return;let r=this.listView.elementTop(n);t.domNode.setTop(r)}_isInHiddenRanges(e){return this.listView.indexOf(e.overlay.cell)===-1}};function ULi(a,i){if(!i.length)return a;let e=0,t=0,o=[];for(;e<a.length&&t<i.length;)e<i[t].start&&o.push(...a.slice(e,i[t].start)),e=i[t].end+1,t++;return e<a.length&&o.push(...a.slice(e)),o}var sfe=5e3;function Ian(a){let i=0-(parseInt(a.style.top,10)||0);return i>=0&&i<=sfe*2}var eOe=class extends bc{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,n,r,l,s,c,u,p);this.listUser=e;this.notebookOptions=o;this._previousFocusedElements=[];this._localDisposableStore=new O;this._viewModelStore=new O;this._onDidRemoveOutputs=this._localDisposableStore.add(new T);this.onDidRemoveOutputs=this._onDidRemoveOutputs.event;this._onDidHideOutputs=this._localDisposableStore.add(new T);this.onDidHideOutputs=this._onDidHideOutputs.event;this._onDidRemoveCellsFromView=this._localDisposableStore.add(new T);this.onDidRemoveCellsFromView=this._onDidRemoveCellsFromView.event;this._viewModel=null;this._hiddenRangeIds=[];this.hiddenRangesPrefixSum=null;this._onDidChangeVisibleRanges=this._localDisposableStore.add(new T);this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._visibleRanges=[];this._isDisposed=!1;this._isInLayout=!1;this._webviewElement=null;Ap.bindTo(this.contextKeyService).set(!0),this._previousFocusedElements=this.getFocusedElements(),this._localDisposableStore.add(this.onDidChangeFocus(w=>{this._previousFocusedElements.forEach(x=>{w.elements.indexOf(x)<0&&x.onDeselect()}),this._previousFocusedElements=w.elements}));let g=ape.bindTo(s);g.set("none");let f=lpe.bindTo(s);f.set("none");let v=this._localDisposableStore.add(new ue),b=this._localDisposableStore.add(new ue);this._notebookCellAnchor=new a2t(h,u,this.onDidScroll);let S=w=>{switch(w.cursorAtBoundary()){case 3:g.set("both");break;case 1:g.set("top");break;case 2:g.set("bottom");break;default:g.set("none");break}switch(w.cursorAtLineBoundary()){case 3:f.set("both");break;case 1:f.set("start");break;case 2:f.set("end");break;default:f.set("none");break}};this._localDisposableStore.add(this.onDidChangeFocus(w=>{if(w.elements.length){let x=w.elements[0];v.value=x.onDidChangeState(E=>{E.selectionChanged&&S(x)}),b.value=x.onDidChangeEditorAttachState(()=>{x.editorAttached&&S(x)}),S(x);return}g.set("none")}));let y=()=>{if(!this.view.length)return;let w=this.getViewScrollTop(),x=this.getViewScrollBottom();if(w>=x)return;let E=jn(this.view.indexAt(w),0,this.view.length-1),M=this.view.element(E),N=this._viewModel.getCellIndex(M),V=jn(this.view.indexAt(x),0,this.view.length-1),H=this.view.element(V),K=this._viewModel.getCellIndex(H);K-N===V-E?this.visibleRanges=[{start:N,end:K+1}]:this.visibleRanges=this._getVisibleRangesFromIndex(E,N,V,K)};this._localDisposableStore.add(this.view.onDidChangeContentHeight(()=>{this._isInLayout&&kr(Me(t),()=>{y()}),y()})),this._localDisposableStore.add(this.view.onDidScroll(()=>{this._isInLayout&&kr(Me(t),()=>{y()}),y()}))}get onWillScroll(){return this.view.onWillScroll}get rowsContainer(){return this.view.containerDomNode}get scrollableElement(){return this.view.scrollableElementDomNode}get viewModel(){return this._viewModel}get visibleRanges(){return this._visibleRanges}set visibleRanges(e){hYe(this._visibleRanges,e)||(this._visibleRanges=e,this._onDidChangeVisibleRanges.fire())}get isDisposed(){return this._isDisposed}get webviewElement(){return this._webviewElement}get inRenderingTransaction(){return this.view.inRenderingTransaction}createListView(e,t,o,n){let r=new s2t(e,t,o,n);return this.viewZones=new l2t(r,this),this.cellOverlays=new c2t(r),r}_getView(){return this.view}attachWebview(e){e.style.top=`-${sfe}px`,this.rowsContainer.insertAdjacentElement("afterbegin",e),this._webviewElement=new Kv(e)}elementAt(e){if(!this.view.length)return;let t=this.view.indexAt(e),o=jn(t,0,this.view.length-1);return this.element(o)}elementHeight(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw this._getViewIndexUpperBound(e),new tM(this.listUser,`Invalid index ${t}`);return this.view.elementHeight(t)}detachViewModel(){this._viewModelStore.clear(),this._viewModel=null,this.hiddenRangesPrefixSum=null}attachViewModel(e){this._viewModel=e,this._viewModelStore.add(e.onDidChangeViewCells(r=>{if(this._isDisposed)return;this.viewZones.onCellsChanged(r),this.cellOverlays.onCellsChanged(r);let s=this._hiddenRangeIds.map(h=>this._viewModel.getTrackedRange(h)).filter(h=>h!==null),l=ULi(this._viewModel.viewCells,s),c=[],u=new Set;for(let h=0;h<this.length;h++)c.push(this.element(h)),u.add(this.element(h).uri.toString());let p=T7e(c,l,h=>u.has(h.uri.toString()));r.synchronous?this._updateElementsInWebview(p):this._viewModelStore.add(kr(Me(this.rowsContainer),()=>{this._isDisposed||this._updateElementsInWebview(p)}))})),this._viewModelStore.add(e.onDidChangeSelection(r=>{if(r==="view")return;let s=yv(e.getSelections()).map(c=>e.cellAt(c)).filter(c=>!!c).map(c=>this._getViewIndexUpperBound(c));this.setSelection(s,void 0,!0);let l=yv([e.getFocus()]).map(c=>e.cellAt(c)).filter(c=>!!c).map(c=>this._getViewIndexUpperBound(c));l.length&&this.setFocus(l,void 0,!0)}));let t=e.getHiddenRanges();this.setHiddenAreas(t,!1);let o=M0(t),n=e.viewCells.slice(0);o.reverse().forEach(r=>{let s=n.splice(r.start,r.end-r.start+1);this._onDidRemoveCellsFromView.fire(s)}),this.splice2(0,0,n)}_updateElementsInWebview(e){e.reverse().forEach(t=>{let o=[],n=[],r=[];for(let s=t.start;s<t.start+t.deleteCount;s++){let l=this.element(s);l.cellKind===2?this._viewModel.hasCell(l)?o.push(...l?.outputsViewModels):n.push(...l?.outputsViewModels):r.push(l)}this.splice2(t.start,t.deleteCount,t.toInsert),this._onDidHideOutputs.fire(o),this._onDidRemoveOutputs.fire(n),this._onDidRemoveCellsFromView.fire(r)})}clear(){super.splice(0,this.length)}setHiddenAreas(e,t){if(!this._viewModel)return!1;let o=M0(e),n=this._hiddenRangeIds.map(s=>this._viewModel.getTrackedRange(s)).filter(s=>s!==null);if(o.length===n.length){let s=!1;for(let l=0;l<o.length;l++)if(!(o[l].start===n[l].start&&o[l].end===n[l].end)){s=!0;break}if(!s)return this._updateHiddenRangePrefixSum(o),this.viewZones.onHiddenRangesChange(),this.viewZones.layout(),this.cellOverlays.onHiddenRangesChange(),this.cellOverlays.layout(),!1}this._hiddenRangeIds.forEach(s=>this._viewModel.setTrackedRange(s,null,3));let r=o.map(s=>this._viewModel.setTrackedRange(null,s,3)).filter(s=>s!==null);return this._hiddenRangeIds=r,this._updateHiddenRangePrefixSum(o),this.viewZones.onHiddenRangesChange(),this.cellOverlays.onHiddenRangesChange(),t&&this.updateHiddenAreasInView(n,o),this.viewZones.layout(),this.cellOverlays.layout(),!0}_updateHiddenRangePrefixSum(e){let t=0,o=0,n=[];for(;o<e.length;){for(let s=t;s<e[o].start-1;s++)n.push(1);n.push(e[o].end-e[o].start+1+1),t=e[o].end+1,o++}for(let s=t;s<this._viewModel.length;s++)n.push(1);let r=new Uint32Array(n.length);for(let s=0;s<n.length;s++)r[s]=n[s];this.hiddenRangesPrefixSum=new fD(r)}updateHiddenAreasInView(e,t){let o=ULi(this._viewModel.viewCells,e),n=new Set;o.forEach(l=>{n.add(l.uri.toString())});let r=ULi(this._viewModel.viewCells,t),s=T7e(o,r,l=>n.has(l.uri.toString()));this._updateElementsInWebview(s)}splice2(e,t,o=[]){if(e<0||e>this.view.length)return;let n=Is(this.rowsContainer);super.splice(e,t,o),n&&this.domFocus();let r=[];this.getSelectedElements().forEach(s=>{this._viewModel.hasCell(s)&&r.push(s.handle)}),!r.length&&this._viewModel.viewCells.length&&this._viewModel.updateSelectionsState({kind:1,focus:{start:0,end:1},selections:[{start:0,end:1}]}),this.viewZones.layout(),this.cellOverlays.layout()}getModelIndex(e){let t=this.indexOf(e);return this.getModelIndex2(t)}getModelIndex2(e){return this.hiddenRangesPrefixSum?this.hiddenRangesPrefixSum.getPrefixSum(e-1):e}getViewIndex(e){let t=this._viewModel.getCellIndex(e);return this.getViewIndex2(t)}getViewIndex2(e){if(!this.hiddenRangesPrefixSum)return e;let t=this.hiddenRangesPrefixSum.getIndexOf(e);return t.remainder!==0?e>=this.hiddenRangesPrefixSum.getTotalSum()?e-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):void 0:t.index}convertModelIndexToViewIndex(e){return this.hiddenRangesPrefixSum?e>=this.hiddenRangesPrefixSum.getTotalSum()?Math.min(this.length,this.hiddenRangesPrefixSum.getTotalSum()):this.hiddenRangesPrefixSum.getIndexOf(e).index:e}modelIndexIsVisible(e){return this.hiddenRangesPrefixSum&&this.hiddenRangesPrefixSum.getIndexOf(e).remainder!==0?e>=this.hiddenRangesPrefixSum.getTotalSum():!0}_getVisibleRangesFromIndex(e,t,o,n){let r=[],s=[],l=e,c=t;for(;l<=o;){let u=this.hiddenRangesPrefixSum.getPrefixSum(l);u===c+1?(r.length&&(r[r.length-1]===c-1?s.push({start:r[r.length-1],end:c+1}):s.push({start:r[r.length-1],end:r[r.length-1]+1})),r.push(c),l++,c++):(r.length&&(r[r.length-1]===c-1?s.push({start:r[r.length-1],end:c+1}):s.push({start:r[r.length-1],end:r[r.length-1]+1})),r.push(c),l++,c=u)}return r.length&&s.push({start:r[r.length-1],end:r[r.length-1]+1}),M0(s)}getVisibleRangesPlusViewportAboveAndBelow(){if(this.view.length<=0)return[];let e=Math.max(this.getViewScrollTop()-this.renderHeight,0),t=this.view.indexAt(e),o=this.view.element(t),n=this._viewModel.getCellIndex(o),r=jn(this.getViewScrollBottom()+this.renderHeight,0,this.scrollHeight),s=jn(this.view.indexAt(r),0,this.view.length-1),l=this.view.element(s),c=this._viewModel.getCellIndex(l);return c-n===s-t?[{start:n,end:c}]:this._getVisibleRangesFromIndex(t,n,s,c)}_getViewIndexUpperBound(e){if(!this._viewModel)return-1;let t=this._viewModel.getCellIndex(e);if(t===-1)return-1;if(!this.hiddenRangesPrefixSum)return t;let o=this.hiddenRangesPrefixSum.getIndexOf(t);return o.remainder!==0&&t>=this.hiddenRangesPrefixSum.getTotalSum()?t-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):o.index}_getViewIndexUpperBound2(e){if(!this.hiddenRangesPrefixSum)return e;let t=this.hiddenRangesPrefixSum.getIndexOf(e);return t.remainder!==0&&e>=this.hiddenRangesPrefixSum.getTotalSum()?e-(this.hiddenRangesPrefixSum.getTotalSum()-this.hiddenRangesPrefixSum.getCount()):t.index}focusElement(e){let t=this._getViewIndexUpperBound(e);if(t>=0&&this._viewModel){let o=this.element(t).handle;this._viewModel.updateSelectionsState({kind:0,primary:o,selections:[o]},"view"),this.setFocus([t],void 0,!1)}}selectElements(e){let t=e.map(o=>this._getViewIndexUpperBound(o)).filter(o=>o>=0);this.setSelection(t)}getCellViewScrollTop(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw new tM(this.listUser,`Invalid index ${t}`);return this.view.elementTop(t)}getCellViewScrollBottom(e){let t=this._getViewIndexUpperBound(e);if(t===void 0||t<0||t>=this.length)throw new tM(this.listUser,`Invalid index ${t}`);let o=this.view.elementTop(t),n=this.view.elementHeight(t);return o+n}setFocus(e,t,o){if(o){super.setFocus(e,t);return}if(e.length){if(this._viewModel){let n=this.element(e[0]).handle;this._viewModel.updateSelectionsState({kind:0,primary:n,selections:this.getSelection().map(r=>this.element(r).handle)},"view")}}else if(this._viewModel){if(this.length)return;this._viewModel.updateSelectionsState({kind:0,primary:null,selections:[]},"view")}super.setFocus(e,t)}setSelection(e,t,o){if(o){super.setSelection(e,t);return}e.length?this._viewModel&&this._viewModel.updateSelectionsState({kind:0,primary:this.getFocusedElements()[0]?.handle??null,selections:e.map(n=>this.element(n)).map(n=>n.handle)},"view"):this._viewModel&&this._viewModel.updateSelectionsState({kind:0,primary:this.getFocusedElements()[0]?.handle??null,selections:[]},"view"),super.setSelection(e,t)}revealCells(e){let t=this._getViewIndexUpperBound2(e.start);if(t<0)return;let o=this._getViewIndexUpperBound2(e.end-1),n=this.getViewScrollTop(),r=this.getViewScrollBottom(),s=this.view.elementTop(t);if(s>=n&&s<r){let l=this.view.elementTop(o),c=this.view.elementHeight(o);if(l+c<=r)return;if(l>=r)return this._revealInternal(o,!1,2);if(l<r)return l+c-r<s-n?this.view.setScrollTop(n+l+c-r):this._revealInternal(t,!1,0)}this._revealInViewWithMinimalScrolling(t)}_revealInViewWithMinimalScrolling(e,t){let o=this.view.firstMostlyVisibleIndex,n=this.view.elementHeight(e);e<=o||!t&&n>=this.view.renderHeight?this._revealInternal(e,!0,0):this._revealInternal(e,!0,2,t)}scrollToBottom(){let e=this.view.scrollHeight,t=this.getViewScrollTop(),o=this.getViewScrollBottom();this.view.setScrollTop(e-(o-t))}async revealCell(e,t){let o=this._getViewIndexUpperBound(e);if(!(o<0)){switch(t){case 2:this._revealInternal(o,!1,0);break;case 3:this._revealInternal(o,!1,1);break;case 4:this._revealInternal(o,!0,1);break;case 5:this._revealInternal(o,!0,3);break;case 6:this._revealInViewWithMinimalScrolling(o,!0);break;case 1:this._revealInViewWithMinimalScrolling(o);break}if((e.getEditState()===1||t===6&&e.cellKind===2)&&!e.editorAttached)return jnt(e)}}_revealInternal(e,t,o,n){if(e>=this.view.length)return;let r=this.getViewScrollTop(),s=this.getViewScrollBottom(),l=this.view.elementTop(e),c=this.view.elementHeight(e)+l;if(!(t&&l>=r&&c<s))switch(o){case 0:this.view.setScrollTop(l),this.view.setScrollTop(this.view.elementTop(e));break;case 1:case 3:{this.view.setScrollTop(l-this.view.renderHeight/2);let u=this.view.elementTop(e),p=this.view.elementHeight(e),h=this.getViewScrollBottom()-this.getViewScrollTop();p>=h?this.view.setScrollTop(u):o===1?this.view.setScrollTop(u+p/2-h/2):o===3&&this.view.setScrollTop(u-h/5)}break;case 2:if(n){let u=this.viewModel?.layoutInfo?.fontInfo.lineHeight??15,p=this.notebookOptions.getLayoutConfiguration().cellTopMargin+this.notebookOptions.getLayoutConfiguration().editorTopPadding,h=l+u+p;if(h<s)return;this.view.setScrollTop(this.scrollTop+(h-s));break}this.view.setScrollTop(this.scrollTop+(c-s)),this.view.setScrollTop(this.scrollTop+(this.view.elementTop(e)+this.view.elementHeight(e)-this.getViewScrollBottom()));break;default:break}}async revealRangeInCell(e,t,o){let n=this._getViewIndexUpperBound(e);if(!(n<0))switch(o){case 1:return this._revealRangeInternalAsync(n,t);case 2:return this._revealRangeInCenterInternalAsync(n,t);case 3:return this._revealRangeInCenterIfOutsideViewportInternalAsync(n,t)}}async _revealRangeInternalAsync(e,t){let o=this.getViewScrollTop(),n=this.getViewScrollBottom(),r=this.view.elementTop(e),s=this.view.element(e);if(s.editorAttached)this._revealRangeCommon(e,t);else{let l=this.view.elementHeight(e),c;return r+l<=o?(this.view.setScrollTop(r),c="top"):r>=n&&(this.view.setScrollTop(r-this.view.renderHeight/2),c="bottom"),new Promise((p,h)=>{U.once(s.onDidChangeEditorAttachState)(()=>{s.editorAttached?p():h()})}).then(()=>{this._revealRangeCommon(e,t,c)})}}async _revealRangeInCenterInternalAsync(e,t){let o=(l,c)=>{let u=this.view.element(l),p=u.getPositionScrollTopOffset(c),h=this.view.elementTop(l)+p;this.view.setScrollTop(h-this.view.renderHeight/2),u.revealRangeInCenter(c)},r=this.view.elementTop(e);this.view.setScrollTop(r-this.view.renderHeight/2);let s=this.view.element(e);if(s.editorAttached)o(e,t);else return jnt(s).then(()=>o(e,t))}async _revealRangeInCenterIfOutsideViewportInternalAsync(e,t){let o=(p,h)=>{let g=this.view.element(p),f=g.getPositionScrollTopOffset(h),v=this.view.elementTop(p)+f;this.view.setScrollTop(v-this.view.renderHeight/2),g.revealRangeInCenter(h)},n=this.getViewScrollTop(),r=this.getViewScrollBottom(),l=this.view.elementTop(e),c=this.view.element(e),u=l+c.getPositionScrollTopOffset(t);if(u<n||u>r){this.view.setScrollTop(u-this.view.renderHeight/2);let p=this.view.elementTop(e)+c.getPositionScrollTopOffset(t);if(this.view.setScrollTop(p-this.view.renderHeight/2),!c.editorAttached)return jnt(c).then(()=>o(e,t))}else if(c.editorAttached)c.revealRangeInCenter(t);else return jnt(c).then(()=>o(e,t))}_revealRangeCommon(e,t,o){let n=this.view.element(e),r=this.getViewScrollTop(),s=this.getViewScrollBottom(),l=n.getPositionScrollTopOffset(t),c=this.view.elementHeight(e);if(l>=c){let h=n.layoutInfo.totalHeight;this.updateElementHeight(e,h)}let p=this.view.elementTop(e)+l;p<r?this.view.setScrollTop(p-30):p>s?this.view.setScrollTop(r+p-s+30):o==="bottom"?this.view.setScrollTop(r+p-s+30):o==="top"&&this.view.setScrollTop(p-30)}revealCellOffsetInCenter(e,t){let o=this._getViewIndexUpperBound(e);if(o>=0){let n=this.view.element(o),r=this.view.elementTop(o);if(n instanceof hS)return this._revealInCenterIfOutsideViewport(o);{let s=n.layoutInfo.outputContainerOffset+Math.min(t,n.layoutInfo.outputTotalHeight);this.view.setScrollTop(r-this.view.renderHeight/2),this.view.setScrollTop(r+s-this.view.renderHeight/2)}}}revealOffsetInCenterIfOutsideViewport(e){let t=this.getViewScrollTop(),o=this.getViewScrollBottom();if(e<t||e>o){let n=Math.max(0,e-this.view.renderHeight/2);this.view.setScrollTop(n)}}_revealInCenterIfOutsideViewport(e){this._revealInternal(e,!0,1)}domElementOfElement(e){let t=this._getViewIndexUpperBound(e);return t>=0&&t<this.length?this.view.domElement(t):null}focusView(){this.view.domNode.focus()}triggerScrollFromMouseWheelEvent(e){this.view.delegateScrollFromMouseWheelEvent(e)}delegateVerticalScrollbarPointerDown(e){this.view.delegateVerticalScrollbarPointerDown(e)}isElementAboveViewport(e){return this.view.elementTop(e)+this.view.elementHeight(e)<this.scrollTop}updateElementHeight2(e,t,o=null){let n=this._getViewIndexUpperBound(e);if(n===void 0||n<0||n>=this.length)return;if(this.isElementAboveViewport(n)){let c=this.elementHeight(e)-t;this._webviewElement&&U.once(this.view.onWillScroll)(()=>{let u=parseInt(this._webviewElement.domNode.style.top,10);Ian(this._webviewElement.domNode)?this._webviewElement.setTop(u-c):this._webviewElement.setTop(-sfe)}),this.view.updateElementHeight(n,t,o),this.viewZones.layout(),this.cellOverlays.layout();return}if(o!==null){this.view.updateElementHeight(n,t,o),this.viewZones.layout(),this.cellOverlays.layout();return}let r=this.getFocus(),s=r.length?r[0]:null;if(s){let l=t-this.view.elementHeight(n);if(this._notebookCellAnchor.shouldAnchor(this.view,s,l,this.element(n))){this.view.updateElementHeight(n,t,s),this.viewZones.layout(),this.cellOverlays.layout();return}}this.view.updateElementHeight(n,t,null),this.viewZones.layout(),this.cellOverlays.layout()}changeViewZones(e){this.viewZones.changeViewZones(e)&&this.viewZones.layout()}changeCellOverlays(e){this.cellOverlays.changeCellOverlays(e)&&this.cellOverlays.layout()}getViewZoneLayoutInfo(e){return this.viewZones.getViewZoneLayoutInfo(e)}domFocus(){let e=this.getFocusedElements()[0],t=e&&this.domElementOfElement(e);this.view.domNode.ownerDocument.activeElement&&t&&t.contains(this.view.domNode.ownerDocument.activeElement)||!et&&this.view.domNode.ownerDocument.activeElement&&rf(this.view.domNode.ownerDocument.activeElement,"context-view")||super.domFocus()}focusContainer(e){e&&(this._viewModel?.updateSelectionsState({kind:0,primary:null,selections:[]},"view"),this.setFocus([],void 0,!0),this.setSelection([],void 0,!0)),super.domFocus()}getViewScrollTop(){return this.view.getScrollTop()}getViewScrollBottom(){return this.getViewScrollTop()+this.view.renderHeight}setCellEditorSelection(e,t){let o=e;o.editorAttached?o.setSelection(t):jnt(o).then(()=>{o.setSelection(t)})}style(e){let t=this.view.domId;this.styleElement||(this.styleElement=Pr(this.view.domNode));let o=t&&`.${t}`,n=[];e.listBackground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&n.push(`.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listFocusAndSelectionBackground&&n.push(`
				.monaco-drag-image${o},
				.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; }
			`),e.listFocusAndSelectionForeground&&n.push(`
				.monaco-drag-image${o},
				.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color: ${e.listFocusAndSelectionForeground}; }
			`),e.listInactiveFocusBackground&&(n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color:  ${e.listInactiveFocusBackground}; }`),n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color:  ${e.listInactiveFocusBackground}; }`)),e.listInactiveSelectionBackground&&(n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color:  ${e.listInactiveSelectionBackground}; }`),n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color:  ${e.listInactiveSelectionBackground}; }`)),e.listInactiveSelectionForeground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${e.listInactiveSelectionForeground}; }`),e.listHoverBackground&&n.push(`.monaco-list${o}:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color:  ${e.listHoverBackground}; }`),e.listHoverForeground&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color:  ${e.listHoverForeground}; }`),e.listSelectionOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listFocusOutline&&n.push(`
				.monaco-drag-image${o},
				.monaco-list${o}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }
			`),e.listInactiveFocusOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted ${e.listInactiveFocusOutline}; outline-offset: -1px; }`),e.listHoverOutline&&n.push(`.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${e.listHoverOutline}; outline-offset: -1px; }`),e.listDropOverBackground&&n.push(`
				.monaco-list${o}.drop-target,
				.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
				.monaco-list${o} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${e.listDropOverBackground} !important; color: inherit !important; }
			`);let r=n.join(`
`);r!==this.styleElement.textContent&&(this.styleElement.textContent=r)}getRenderHeight(){return this.view.renderHeight}getScrollHeight(){return this.view.scrollHeight}layout(e,t){this._isInLayout=!0,super.layout(e,t),this.renderHeight===0?this.view.domNode.style.visibility="hidden":this.view.domNode.style.visibility="initial",this._isInLayout=!1}dispose(){this._isDisposed=!0,this._viewModelStore.dispose(),this._localDisposableStore.dispose(),this._notebookCellAnchor.dispose(),this.viewZones.dispose(),this.cellOverlays.dispose(),super.dispose(),this._previousFocusedElements=[],this._viewModel=null,this._hiddenRangeIds=[],this.hiddenRangesPrefixSum=null,this._visibleRanges=[]}};eOe=I([m(7,Co),m(8,B),m(9,F),m(10,Ns)],eOe);var d2t=class extends k{constructor(e){super();this.list=e}getViewIndex(e){return this.list.getViewIndex(e)??-1}getViewHeight(e){return this.list.viewModel?this.list.elementHeight(e):-1}getCellRangeFromViewRange(e,t){if(!this.list.viewModel)return;let o=this.list.getModelIndex2(e);if(o===void 0)throw new Error(`startIndex ${e} out of boundary`);if(t>=this.list.length){let n=this.list.viewModel.length;return{start:o,end:n}}else{let n=this.list.getModelIndex2(t);if(n===void 0)throw new Error(`endIndex ${t} out of boundary`);return{start:o,end:n}}}getCellsFromViewRange(e,t){if(!this.list.viewModel)return[];let o=this.getCellRangeFromViewRange(e,t);return o?this.list.viewModel.getCellsInRange(o):[]}getCellsInRange(e){return this.list.viewModel?.getCellsInRange(e)??[]}getVisibleRangesPlusViewportAboveAndBelow(){return this.list?.getVisibleRangesPlusViewportAboveAndBelow()??[]}};function jnt(a){return new Promise((i,e)=>{U.once(a.onDidChangeEditorAttachState)(()=>a.editorAttached?i():e())})}async function yan(a){let e=navigator.userAgent.indexOf("Chrome")>=0,t=new TextEncoder,o=new TextDecoder;function n(){let Ye,we;return{promise:new Promise((Pt,qt)=>{Ye=Pt,we=qt}),resolve:Ye,reject:we}}let r=a.options,s=a.isWorkspaceTrusted,l=a.renderOptions,c=_i(),u=globalThis.acquireVsCodeApi,p=u();delete globalThis.acquireVsCodeApi;let h=new CSSStyleSheet;h.replaceSync(a.style.tokenizationCss);let g=typeof requestIdleCallback!="function"||typeof cancelIdleCallback!="function"?Ye=>{setTimeout(()=>{if(we)return;let Qe=Date.now()+15;Ye(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,Qe-Date.now())}}))});let we=!1;return{dispose(){we||(we=!0)}}}:(Ye,we)=>{let Qe=requestIdleCallback(Ye,typeof we=="number"?{timeout:we}:void 0),Pt=!1;return{dispose(){Pt||(Pt=!0,cancelIdleCallback(Qe))}}};function f(Ye){for(let we of Ye.composedPath())if(we instanceof HTMLElement&&we.classList.contains("output"))return{id:we.id}}let v,b=Ye=>{let we=Ye&&f(Ye);we&&(v=void 0,setTimeout(()=>{v?.id!==we.id&&_o("outputBlur",we)},0))},S=(Ye,we=document)=>{let Qe=we.activeElement;return!!(Qe&&Ye.contains(Qe)&&(Qe.matches(":read-write")||Qe.tagName.toLowerCase()==="select"||Qe.shadowRoot&&S(Qe.shadowRoot,Qe.shadowRoot)))},y=Ye=>{v=f(Ye);let we=window.document.activeElement;if(!we)return;let Qe=v?.id;Qe&&S(we,window.document)&&(_o("outputInputFocus",{inputFocused:!0,id:Qe}),we.addEventListener("blur",()=>{_o("outputInputFocus",{inputFocused:!1,id:Qe})},{once:!0}))},w=Ye=>{if(!Ye||!Ye.view||!Ye.view.document)return;let we=v=f(Ye);for(let Qe of Ye.composedPath())if(Qe instanceof HTMLAnchorElement&&Qe.href){if(Qe.href.startsWith("blob:"))we&&_o("outputFocus",we),K(Qe.href,Qe.download);else if(Qe.href.startsWith("data:"))we&&_o("outputFocus",we),H(Qe.href,Qe.download);else if(Qe.getAttribute("href")?.trim().startsWith("#")){if(!Qe.hash){_o("scroll-to-reveal",{scrollTop:0});return}let Pt=Qe.hash.substring(1),qt=Ye.view.document.getElementById(Pt);if(!qt){for(let Oo of Ye.view.document.querySelectorAll(".preview"))if(qt=Oo.shadowRoot?.getElementById(Pt),qt)break}if(qt){let Oo=qt.getBoundingClientRect().top+Ye.view.scrollY;_o("scroll-to-reveal",{scrollTop:Oo});return}}else{let Pt=Qe.getAttribute("href");Pt&&(Pt.startsWith("command:")&&we&&_o("outputFocus",we),_o("clicked-link",{href:Pt}))}Ye.preventDefault(),Ye.stopPropagation();return}we&&_o("outputFocus",we)},x=()=>{let Ye=window.getSelection();Ye&&Ye.removeAllRanges()},E=Ye=>{let we=window.getSelection();if(!we)return;let Qe=window.document.getElementById(Ye);if(!Qe)return;we.removeAllRanges();let Pt=document.createRange();Pt.selectNode(Qe),we.addRange(Pt)},M=Ye=>{if(!window.document.getElementById(Ye))return;let Qe=window.document.activeElement;Qe&&S(Qe,window.document)&&Qe.select()},N=Ye=>{if(!v?.id||!Ye.shiftKey)return;if(Ye.shiftKey&&(Ye.code==="ArrowUp"||Ye.code==="ArrowDown")){Ye.stopPropagation();return}if(!(Ye.code==="PageUp"||Ye.code==="PageDown")&&!(Ye.metaKey&&(Ye.code==="ArrowDown"||Ye.code==="ArrowUp")))return;let we=window.document.getElementById(v.id),Qe=window.getSelection();if(!we||!Qe?.anchorNode)return;let Pt=window.document.activeElement;if(Pt&&S(Pt,window.document))return;Ye.stopPropagation(),Ye.preventDefault();let{anchorNode:qt,anchorOffset:Oo}=Qe,ho=document.createRange();Ye.code==="PageDown"||Ye.code==="ArrowDown"?(ho.setStart(qt,Oo),ho.setEnd(we,1)):(ho.setStart(we,0),ho.setEnd(qt,Oo)),Qe.removeAllRanges(),Qe.addRange(ho)},V=Ye=>{if(!v?.id)return;let we=window.document.activeElement;if(!(we&&S(we,window.document))&&(Ye.key==="a"&&Ye.ctrlKey||Ye.metaKey&&Ye.key==="a")){Ye.preventDefault();return}},H=async(Ye,we)=>{_o("clicked-data-url",{data:Ye,downloadName:we})},K=async(Ye,we)=>{try{let Pt=await(await fetch(Ye)).blob(),qt=new FileReader;qt.addEventListener("load",()=>{H(qt.result,we)}),qt.readAsDataURL(Pt)}catch(Qe){console.error(Qe.message)}};window.document.body.addEventListener("click",w),window.document.body.addEventListener("focusin",y),window.document.body.addEventListener("focusout",b),window.document.body.addEventListener("keydown",N),window.document.body.addEventListener("keydown",V);function j(){return Object.freeze({onDidReceiveKernelMessage:Mr.event,postKernelMessage:Ye=>_o("customKernelMessage",{message:Ye})})}async function J(Ye){try{return await se(Ye)}catch(we){throw console.error(we),we}}async function se(Ye){let we=await __import(Ye);if(!we.activate){console.error(`Notebook preload '${Ye}' was expected to be a module but it does not export an 'activate' function`);return}return we.activate(j())}let ae=new class{constructor(){this.pending=new Map}updateHeight(Ye,we,Qe){this.pending.size||setTimeout(()=>{this.updateImmediately()},0);let Pt=this.pending.get(Ye);Pt&&Pt.isOutput?this.pending.set(Ye,{id:Ye,height:we,init:Pt.init,isOutput:Pt.isOutput}):this.pending.set(Ye,{id:Ye,height:we,...Qe})}updateImmediately(){this.pending.size&&(_o("dimension",{updates:Array.from(this.pending.values())}),this.pending.clear())}};function ce(Ye){return Ye>2.1}let Se=new class{constructor(){this._observedElements=new WeakMap;this._observer=new ResizeObserver(Ye=>{for(let we of Ye){if(!window.document.body.contains(we.target))continue;let Qe=this._observedElements.get(we.target);if(!Qe||(this.postResizeMessage(Qe.cellId),we.target.id!==Qe.id)||!we.contentRect)continue;if(!Qe.output){this.updateHeight(Qe,we.target.offsetHeight);continue}let Pt=ce(we.contentRect.height);Pt&&Qe.lastKnownPadding===0||!Pt&&Qe.lastKnownPadding!==0?window.requestAnimationFrame(()=>{Pt?we.target.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}px`:we.target.style.padding="0px",this.updateHeight(Qe,Pt?we.target.offsetHeight:0)}):this.updateHeight(Qe,Pt?we.target.offsetHeight:0)}})}updateHeight(Ye,we){Ye.lastKnownHeight!==we&&(Ye.lastKnownHeight=we,ae.updateHeight(Ye.id,we,{isOutput:Ye.output}))}observe(Ye,we,Qe,Pt){this._observedElements.has(Ye)||(this._observedElements.set(Ye,{id:we,output:Qe,lastKnownPadding:a.style.outputNodePadding,lastKnownHeight:-1,cellId:Pt}),this._observer.observe(Ye))}postResizeMessage(Ye){clearTimeout(this._outputResizeTimer),this._outputResizeTimer=setTimeout(()=>{_o("outputResized",{cellId:Ye})},250)}},Re,xe,He,Ee;function Te(Ye,we){if(He=Ye,we===void 0)return Ee=Date.now(),Re=void 0,Ye.setAttribute("recentlyScrolled","true"),clearTimeout(xe),xe=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},300),!0;if(Ye.hasAttribute("recentlyScrolled")){if(Ee&&Date.now()-Ee>400){if(Re&&we<0&&we<Re-8)return clearTimeout(xe),He?.removeAttribute("recentlyScrolled"),!1;if(Re&&we>0&&we>Re+8)return clearTimeout(xe),He?.removeAttribute("recentlyScrolled"),!1;clearTimeout(xe),xe=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},50)}else clearTimeout(xe),xe=setTimeout(()=>{He?.removeAttribute("recentlyScrolled")},300);return Re=we,!0}return!1}function It(Ye){for(let we=Ye.target;we;we=we.parentNode){if(!(we instanceof Element)||we.id==="container"||we.classList.contains("cell_container")||we.classList.contains("markup")||we.classList.contains("output_container"))return!1;if(Ye.deltaY<0&&we.scrollTop>0)return Te(we),!0;if(Ye.deltaY>0&&we.scrollTop+we.clientHeight<we.scrollHeight){if(we.scrollHeight-we.scrollTop-we.clientHeight<2||window.getComputedStyle(we).overflowY==="hidden"||window.getComputedStyle(we).overflowY==="visible")continue;return Te(we),!0}if(Te(we,Ye.deltaY))return!0}return!1}let tt=Ye=>{Ye.defaultPrevented||It(Ye)||_o("did-scroll-wheel",{payload:{deltaMode:Ye.deltaMode,deltaX:Ye.deltaX,deltaY:Ye.deltaY,deltaZ:Ye.deltaZ,wheelDelta:Ye.wheelDelta&&e?Ye.wheelDelta/window.devicePixelRatio:Ye.wheelDelta,wheelDeltaX:Ye.wheelDeltaX&&e?Ye.wheelDeltaX/window.devicePixelRatio:Ye.wheelDeltaX,wheelDeltaY:Ye.wheelDeltaY&&e?Ye.wheelDeltaY/window.devicePixelRatio:Ye.wheelDeltaY,detail:Ye.detail,shiftKey:Ye.shiftKey,type:Ye.type}})};function Oi(Ye,we){let Qe=window.document.getElementById(Ye)??(we?window.document.getElementById(we):void 0);if(Qe){if(Qe.contains(window.document.activeElement))return;let Pt=Qe.querySelector('[tabindex="0"], [href], button, input, option, select, textarea');Pt||(Pt=Qe,Pt.tabIndex=-1),v?.id!==Qe.id&&(v=Qe,_o("outputFocus",{id:Qe.id})),Pt.focus()}}function zt(Ye,we){let Qe=document.createElement("div");return Qe.id=`focus-sink-${Ye}`,Qe.tabIndex=0,Qe.addEventListener("focus",()=>{_o("focus-editor",{cellId:Ye,focusNext:we})}),Qe}function mo(Ye,we="mark",Qe={}){function Pt(Zr){if(!Zr.startContainer.ownerDocument)return[];if(Zr.startContainer.nodeType===Node.TEXT_NODE&&Zr.startOffset>0){let Lw=Zr.startContainer,Y7=Zr.endOffset,lz=Lw.splitText(Zr.startOffset);Zr.endContainer===Lw&&Zr.setEnd(lz,Y7-Zr.startOffset),Zr.setStart(lz,0)}Zr.endContainer.nodeType===Node.TEXT_NODE&&Zr.endOffset<Zr.endContainer.length&&Zr.endContainer.splitText(Zr.endOffset);let Sl=Zr.startContainer.ownerDocument.createTreeWalker(Zr.commonAncestorContainer,NodeFilter.SHOW_TEXT,Lw=>Zr.intersectsNode(Lw)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT);Sl.currentNode=Zr.startContainer;let au=[];for(Sl.currentNode.nodeType===Node.TEXT_NODE&&au.push(Sl.currentNode);Sl.nextNode()&&Zr.comparePoint(Sl.currentNode,0)!==1;)Sl.currentNode.nodeType===Node.TEXT_NODE&&au.push(Sl.currentNode);return au}function qt(Zr,Sl,au){let Lw=Zr.ownerDocument.createElement(Sl);Object.keys(au).forEach(lz=>{Lw.setAttribute(lz,au[lz])});let Y7=Zr.ownerDocument.createRange();return Y7.selectNode(Zr),Y7.surroundContents(Lw),Lw}if(Ye.collapsed)return{remove:()=>{},update:()=>{}};let Oo=Pt(Ye),ho=[];for(let Zr in Oo){let Sl=qt(Oo[Zr],we,Qe);ho.push(Sl)}function zr(Zr){if(Zr.childNodes.length===1)Zr.replaceWith(Zr.firstChild);else{for(;Zr.firstChild;)Zr.parentNode?.insertBefore(Zr.firstChild,Zr);Zr.remove()}}function Fs(){for(let Zr in ho)zr(ho[Zr])}function as(Zr,Sl={}){Object.keys(Sl).forEach(au=>{Zr.setAttribute(au,Sl[au])})}function Ha(Zr){for(let Sl in ho)as(ho[Sl],Zr)}return{remove:Fs,update:Ha}}function dn(Ye){let we=window.getSelection();if(we)try{we.removeAllRanges();let Qe=document.createRange();Qe.setStart(Ye.startContainer,Ye.startOffset),Qe.setEnd(Ye.endContainer,Ye.endOffset),we.addRange(Qe)}catch(Qe){console.log(Qe)}}function No(Ye,we,Qe="mark",Pt={}){if(we){let qt=mo(Ye,Qe,Pt);return{range:Ye,dispose:qt.remove,update:(Oo,ho)=>{ho===void 0?qt.update({style:`background-color: ${Oo}`}):qt.update({class:ho})}}}else{window.document.execCommand("hiliteColor",!1,$s);let qt=window.getSelection().getRangeAt(0).cloneRange(),Oo={collapsed:qt.collapsed,commonAncestorContainer:qt.commonAncestorContainer,endContainer:qt.endContainer,endOffset:qt.endOffset,startContainer:qt.startContainer,startOffset:qt.startOffset};return{range:Oo,dispose:()=>{dn(Oo);try{document.designMode="On",window.document.execCommand("removeFormat",!1,void 0),document.designMode="Off",window.getSelection()?.removeAllRanges()}catch(ho){console.log(ho)}},update:(ho,zr)=>{dn(Oo);try{document.designMode="On",window.document.execCommand("removeFormat",!1,void 0),window.document.execCommand("hiliteColor",!1,ho),document.designMode="Off",window.getSelection()?.removeAllRanges()}catch(Fs){console.log(Fs)}}}}}function _i(Ye=()=>{}){let we=new Set;return{fire(Qe){for(let Pt of[...we])Pt.fn.call(Pt.thisArg,Qe)},event(Qe,Pt,qt){let Oo={fn:Qe,thisArg:Pt},ho={dispose:()=>{we.delete(Oo),Ye(we)}};return we.add(Oo),Ye(we),qt instanceof Array?qt.push(ho):qt&&qt.add(ho),ho}}}function ln(Ye,we,Qe){we.innerText=Ye;let Pt=document.createElement("ul");for(let qt of Qe){console.error(qt);let Oo=document.createElement("li");Oo.innerText=qt.message,Pt.appendChild(Oo)}we.appendChild(Pt)}let Tn=new class{constructor(){this._requestPool=0;this._requests=new Map}getOutputItem(Ye,we){let Qe=this._requestPool++,{promise:Pt,resolve:qt}=n();return this._requests.set(Qe,{resolve:qt}),_o("getOutputItem",{requestId:Qe,outputId:Ye,mime:we}),Pt}resolveOutputItem(Ye,we){let Qe=this._requests.get(Ye);Qe&&(this._requests.delete(Ye),Qe.resolve(we))}},Ko=!1;function Bn(Ye,we,Qe,Pt,qt,Oo){function ho(Ha,Zr,Sl,au,Lw){return Object.freeze({id:Ha,mime:Zr,metadata:Sl,appendedText(){if(Lw)return o.decode(Lw.valueBytes)},data(){return au},text(){return o.decode(au)},json(){return JSON.parse(this.text())},blob(){return new Blob([au],{type:this.mime})},get _allOutputItems(){return Ko||(Ko=!0,console.warn("'_allOutputItems' is proposed API. DO NOT ship an extension that depends on it!")),Fs}})}let zr=new Map,Fs=Object.freeze(qt.map(Ha=>{let Zr=Ha.mime;return Object.freeze({mime:Zr,getItem(){let Sl=zr.get(Zr);if(Sl)return Sl;let au=Tn.getOutputItem(Ye,Zr).then(Lw=>Lw?ho(Ye,Lw.mime,Qe,Lw.valueBytes):void 0);return zr.set(Zr,au),au}})})),as=ho(Ye,we,Qe,Pt,Oo);return zr.set(we,Promise.resolve(as)),as}let Mr=_i(),va=window.trustedTypes?.createPolicy("notebookRenderer",{createHTML:Ye=>Ye,createScript:Ye=>Ye});window.addEventListener("wheel",tt);let $s=window.getComputedStyle(window.document.getElementById("_defaultColorPalatte")).color,_l=window.getComputedStyle(window.document.getElementById("_defaultColorPalatte")).backgroundColor;class mc{constructor(){this._activeHighlightInfo=new Map}addHighlights(we,Qe){for(let qt=we.length-1;qt>=0;qt--){let Oo=we[qt],ho=No(Oo.originalRange,!0,"mark",Oo.isShadow?{style:"background-color: "+$s+";"}:{class:"find-match"});Oo.highlightResult=ho}let Pt={matches:we,currentMatchIndex:-1};this._activeHighlightInfo.set(Qe,Pt)}removeHighlights(we){this._activeHighlightInfo.get(we)?.matches.forEach(Qe=>{Qe.highlightResult?.dispose()}),this._activeHighlightInfo.delete(we)}highlightCurrentMatch(we,Qe){let Pt=this._activeHighlightInfo.get(Qe);if(!Pt){console.error("Modified current highlight match before adding highlight list.");return}let qt=Pt.matches[Pt.currentMatchIndex];qt?.highlightResult?.update($s,qt.isShadow?void 0:"find-match");let Oo=Pt.matches[we];Pt.currentMatchIndex=we;let ho=window.getSelection();if(Oo&&ho&&Oo.highlightResult){let zr=0;try{let Fs=window.document.getElementById(Oo.id).getBoundingClientRect().top,as=document.createRange();as.selectNode(Oo.highlightResult.range.startContainer),Oo.highlightResult.range.startContainer.parentElement?.scrollIntoView({behavior:"auto",block:"end",inline:"nearest"});let Ha=as.getBoundingClientRect().top;as.detach(),zr=Ha-Fs}catch(Fs){console.error(Fs)}Oo.highlightResult?.update(_l,Oo.isShadow?void 0:"current-find-match"),window.document.getSelection()?.removeAllRanges(),_o("didFindHighlightCurrent",{offset:zr})}}unHighlightCurrentMatch(we,Qe){let Pt=this._activeHighlightInfo.get(Qe);if(!Pt)return;let qt=Pt.matches[we];qt&&qt.highlightResult&&qt.highlightResult.update($s,qt.isShadow?void 0:"find-match")}dispose(){window.document.getSelection()?.removeAllRanges(),this._activeHighlightInfo.forEach(we=>{we.matches.forEach(Qe=>{Qe.highlightResult?.dispose()})})}}class su{constructor(){this._activeHighlightInfo=new Map,this._matchesHighlight=new Highlight,this._matchesHighlight.priority=1,this._currentMatchesHighlight=new Highlight,this._currentMatchesHighlight.priority=2,CSS.highlights?.set("find-highlight",this._matchesHighlight),CSS.highlights?.set("current-find-highlight",this._currentMatchesHighlight)}_refreshRegistry(we=!0){we&&this._matchesHighlight.clear(),this._currentMatchesHighlight.clear(),this._activeHighlightInfo.forEach(Qe=>{if(we)for(let Pt=0;Pt<Qe.matches.length;Pt++)this._matchesHighlight.add(Qe.matches[Pt].originalRange);Qe.currentMatchIndex<Qe.matches.length&&Qe.currentMatchIndex>=0&&this._currentMatchesHighlight.add(Qe.matches[Qe.currentMatchIndex].originalRange)})}addHighlights(we,Qe){for(let qt=0;qt<we.length;qt++)this._matchesHighlight.add(we[qt].originalRange);let Pt={matches:we,currentMatchIndex:-1};this._activeHighlightInfo.set(Qe,Pt)}highlightCurrentMatch(we,Qe){let Pt=this._activeHighlightInfo.get(Qe);if(!Pt){console.error("Modified current highlight match before adding highlight list.");return}Pt.currentMatchIndex=we;let qt=Pt.matches[we];if(qt){let Oo=0;try{let ho=window.document.getElementById(qt.id).getBoundingClientRect().top;qt.originalRange.startContainer.parentElement?.scrollIntoView({behavior:"auto",block:"end",inline:"nearest"}),Oo=qt.originalRange.getBoundingClientRect().top-ho,_o("didFindHighlightCurrent",{offset:Oo})}catch(ho){console.error(ho)}}this._refreshRegistry(!1)}unHighlightCurrentMatch(we,Qe){let Pt=this._activeHighlightInfo.get(Qe);Pt&&(Pt.currentMatchIndex=-1)}removeHighlights(we){this._activeHighlightInfo.delete(we),this._refreshRegistry()}dispose(){window.document.getSelection()?.removeAllRanges(),this._currentMatchesHighlight.clear(),this._matchesHighlight.clear()}}let yu=CSS.highlights?new su:new mc;function sr(Ye){let Qe=Ye.getRangeAt(0).cloneRange(),Pt=Ye.toString().length;Ye.collapseToStart(),Ye.modify("move","backward","lineboundary"),Ye.modify("extend","forward","lineboundary");let qt=Ye.toString(),Oo=Lo(Ye.getRangeAt(0),Qe),ho={start:Oo,end:Oo+Pt};return Ye.removeAllRanges(),Ye.addRange(Qe),{line:qt,range:ho}}function Lo(Ye,we){let Qe=kc(Ye.startContainer,we.startContainer),Pt=xa(Qe,Ye.startContainer)+Ye.startOffset;return xa(Qe,we.startContainer)+we.startOffset-Pt}function kc(Ye,we){let Qe=new Range;return Qe.setStart(Ye,0),Qe.setEnd(we,0),Qe.commonAncestorContainer}function Cn(Ye){let we=0;if(Ye.nodeType===Node.TEXT_NODE)we+=Ye.textContent?.length||0;else for(let Qe of Ye.childNodes)we+=Cn(Qe);return we}function xa(Ye,we){if(!we)return 0;let Qe=0;if(we===Ye||!Ye.contains(we))return Qe;let Pt=we.previousSibling;for(;Pt;)Qe+=Cn(Pt),Pt=Pt.previousSibling;return Qe+xa(Ye,we.parentNode)}let Os=(Ye,we)=>{let Qe=!0,Pt=[],qt=document.createRange();qt.selectNodeContents(window.document.getElementById("findStart"));let Oo=window.getSelection();Oo?.removeAllRanges(),Oo?.addRange(qt),Fi.toggleDragDropEnabled(!1);try{for(document.designMode="On";Qe&&Pt.length<500;)if(Qe=window.find(Ye,!!we.caseSensitive,!1,!1,!!we.wholeWord,!0,!1),Qe){let ho=window.getSelection();if(!ho){console.log("no selection");break}if(we.includeMarkup&&ho.rangeCount>0&&ho.getRangeAt(0).startContainer.nodeType===1&&ho.getRangeAt(0).startContainer.classList.contains("markup")){let Fs=ho.anchorNode?.firstChild,as=Fs.shadowRoot,Ha=as?.getSelection?as?.getSelection():null;Ha&&Ha.anchorNode&&Pt.push({type:"preview",id:Fs.id,cellId:Fs.id,container:Fs,isShadow:!0,originalRange:Ha.getRangeAt(0),searchPreviewInfo:we.shouldGetSearchPreviewInfo?sr(Ha):void 0})}if(we.includeOutput&&ho.rangeCount>0&&ho.getRangeAt(0).startContainer.nodeType===1&&ho.getRangeAt(0).startContainer.classList.contains("output_container")){let Fs=ho.getRangeAt(0).startContainer.parentElement.id,as=ho.anchorNode?.firstChild,Ha=as.shadowRoot,Zr=Ha?.getSelection?Ha?.getSelection():null;Zr&&Zr.anchorNode&&Pt.push({type:"output",id:as.id,cellId:Fs,container:as,isShadow:!0,originalRange:Zr.getRangeAt(0),searchPreviewInfo:we.shouldGetSearchPreviewInfo?sr(Zr):void 0})}let zr=ho.anchorNode?.parentElement;if(zr){let Fs=Pt.length?Pt[Pt.length-1]:null;if(Fs&&Fs.container.contains(zr)&&we.includeOutput)Pt.push({type:Fs.type,id:Fs.id,cellId:Fs.cellId,container:Fs.container,isShadow:!1,originalRange:ho.getRangeAt(0),searchPreviewInfo:we.shouldGetSearchPreviewInfo?sr(ho):void 0});else for(let as=zr;as&&as instanceof Element;as=as.parentElement){if(as.classList.contains("output")&&we.includeOutput){let Ha=as.parentElement?.parentElement?.id;Ha&&Pt.push({type:"output",id:as.id,cellId:Ha,container:as,isShadow:!1,originalRange:ho.getRangeAt(0),searchPreviewInfo:we.shouldGetSearchPreviewInfo?sr(ho):void 0});break}if(as.id==="container"||as===window.document.body)break}}else break}}catch(ho){console.log(ho)}Pt=Pt.filter(ho=>we.findIds.length?we.findIds.includes(ho.cellId):!0),yu.addHighlights(Pt,we.ownerID),window.document.getSelection()?.removeAllRanges(),Fi.toggleDragDropEnabled(r.dragAndDropEnabled),document.designMode="Off",_o("didFind",{matches:Pt.map((ho,zr)=>({type:ho.type,id:ho.id,cellId:ho.cellId,index:zr,searchPreviewInfo:ho.searchPreviewInfo}))})},rl=async(Ye,we,Qe,Pt=5)=>{if(!window.document.hasFocus()&&Pt>0){setTimeout(()=>{rl(Ye,we,Qe,Pt-1)},50);return}try{let qt=window.document.getElementById(Ye)??window.document.getElementById(we),Oo=qt?.querySelector("img");if(!Oo){let ho=qt?.querySelector("svg.output-image")??qt?.querySelector("div.svgContainerStyle > svg");ho&&(Oo=new Image,Oo.src="data:image/svg+xml,"+encodeURIComponent(ho.outerHTML))}if(Oo){let zr=await(as=>new Promise((Ha,Zr)=>{as.complete&&as.naturalWidth>0?Ha(as):(as.onload=()=>Ha(as),as.onerror=()=>Zr(new Error("Failed to load image")),setTimeout(()=>Zr(new Error("Image load timeout")),5e3))}))(Oo),Fs={"image/png":new Promise(as=>{let Ha=document.createElement("canvas");Ha.width=zr.naturalWidth,Ha.height=zr.naturalHeight,Ha.getContext("2d").drawImage(zr,0,0),Ha.toBlob(Sl=>{Sl?as(Sl):console.error("No blob data to write to clipboard"),Ha.remove()},"image/png")})};if(Qe)for(let as of Qe)Fs[as.mimeType]=as.content;await navigator.clipboard.write([new ClipboardItem(Fs)])}else console.error("Could not find image element to copy for output with id",Ye)}catch(qt){console.error("Could not copy image:",qt)}};window.addEventListener("message",async Ye=>{let we=Ye;switch(we.data.type){case"initializeMarkup":{try{await Promise.all(we.data.cells.map(Qe=>Fi.ensureMarkupCell(Qe)))}finally{ae.updateImmediately(),_o("initializedMarkup",{requestId:we.data.requestId})}break}case"createMarkupCell":Fi.ensureMarkupCell(we.data.cell);break;case"showMarkupCell":Fi.showMarkupCell(we.data.id,we.data.top,we.data.content,we.data.metadata);break;case"hideMarkupCells":for(let Qe of we.data.ids)Fi.hideMarkupCell(Qe);break;case"unhideMarkupCells":for(let Qe of we.data.ids)Fi.unhideMarkupCell(Qe);break;case"deleteMarkupCell":for(let Qe of we.data.ids)Fi.deleteMarkupCell(Qe);break;case"updateSelectedMarkupCells":Fi.updateSelectedCells(we.data.selectedCellIds);break;case"html":{let Qe=we.data;Qe.createOnIdle?TS.enqueueIdle(Qe.outputId,Pt=>Fi.renderOutputCell(Qe,Pt)):TS.enqueue(Qe.outputId,Pt=>Fi.renderOutputCell(Qe,Pt));break}case"view-scroll":{we.data.widgets.forEach(Qe=>{TS.enqueue(Qe.outputId,()=>{Fi.updateOutputsScroll([Qe])})}),Fi.updateMarkupScrolls(we.data.markupCells);break}case"clear":jt.clearAll(),Fi.clearAll(),window.document.getElementById("container").innerText="";break;case"clearOutput":{let{cellId:Qe,rendererId:Pt,outputId:qt}=we.data;TS.cancelOutput(qt),Fi.clearOutput(Qe,qt,Pt);break}case"hideOutput":{let{cellId:Qe,outputId:Pt}=we.data;TS.enqueue(Pt,()=>{Fi.hideOutput(Qe)});break}case"showOutput":{let{outputId:Qe,cellTop:Pt,cellId:qt,content:Oo}=we.data;TS.enqueue(Qe,()=>{Fi.showOutput(qt,Qe,Pt),Oo&&Fi.updateAndRerender(qt,Qe,Oo)});break}case"copyImage":{await rl(we.data.outputId,we.data.altOutputId,we.data.textAlternates);break}case"ack-dimension":{for(let{cellId:Qe,outputId:Pt,height:qt}of we.data.updates)Fi.updateOutputHeight(Qe,Pt,qt);break}case"preload":{let Qe=we.data.resources;for(let{uri:Pt}of Qe)Cm.load(Pt);break}case"updateRenderers":{let{rendererData:Qe}=we.data;jt.updateRendererData(Qe);break}case"focus-output":Oi(we.data.cellOrOutputId,we.data.alternateId);break;case"blur-output":x();break;case"select-output-contents":E(we.data.cellOrOutputId);break;case"select-input-contents":M(we.data.cellOrOutputId);break;case"decorations":{let Qe=window.document.getElementById(we.data.cellId);Qe||(Fi.ensureOutputCell(we.data.cellId,-1e5,!0),Qe=window.document.getElementById(we.data.cellId)),Qe?.classList.add(...we.data.addedClassNames),Qe?.classList.remove(...we.data.removedClassNames);break}case"markupDecorations":{let Qe=window.document.getElementById(we.data.cellId);Qe&&(Qe?.classList.add(...we.data.addedClassNames),Qe?.classList.remove(...we.data.removedClassNames));break}case"customKernelMessage":Mr.fire(we.data.message);break;case"customRendererMessage":jt.getRenderer(we.data.rendererId)?.receiveMessage(we.data.message);break;case"notebookStyles":{let Qe=window.document.documentElement.style;for(let Pt=Qe.length-1;Pt>=0;Pt--){let qt=Qe[Pt];qt&&qt.startsWith("--notebook-")&&Qe.removeProperty(qt)}for(let[Pt,qt]of Object.entries(we.data.styles))Qe.setProperty(`--${Pt}`,qt);break}case"notebookOptions":r=we.data.options,Fi.toggleDragDropEnabled(r.dragAndDropEnabled),l=we.data.renderOptions,c.fire(l);break;case"tokenizedCodeBlock":{let{codeBlockId:Qe,html:Pt}=we.data;lo.highlightCodeBlock(Qe,Pt);break}case"tokenizedStylesChanged":{h.replaceSync(we.data.css);break}case"find":{yu.removeHighlights(we.data.options.ownerID),Os(we.data.query,we.data.options);break}case"findHighlightCurrent":{yu?.highlightCurrentMatch(we.data.index,we.data.ownerID);break}case"findUnHighlightCurrent":{yu?.unHighlightCurrentMatch(we.data.index,we.data.ownerID);break}case"findStop":{yu.removeHighlights(we.data.ownerID);break}case"returnOutputItem":Tn.resolveOutputItem(we.data.requestId,we.data.output)}});let js="vscode.fallbackToNextRenderer";class Fh{constructor(we){this.data=we;this._onMessageEvent=_i()}receiveMessage(we){this._onMessageEvent.fire(we)}async renderOutputItem(we,Qe,Pt){try{await this.load()}catch(qt){Pt.aborted||ln(`Error loading renderer '${this.data.id}'`,Qe,qt instanceof Error?[qt]:[]);return}if(!this._api){Pt.aborted||ln(`Renderer '${this.data.id}' does not implement renderOutputItem`,Qe,[]);return}try{let qt=performance.now();await this._api.renderOutputItem(we,Qe,Pt),this.postDebugMessage("Rendered output item",{id:we.id,duration:`${performance.now()-qt}ms`})}catch(qt){if(Pt.aborted)return;if(qt instanceof Error&&qt.name===js)throw qt;ln(`Error rendering output item using '${this.data.id}'`,Qe,qt instanceof Error?[qt]:[]),this.postDebugMessage("Rendering output item failed",{id:we.id,error:qt+""})}}disposeOutputItem(we){this._api?.disposeOutputItem?.(we)}createRendererContext(){let{id:we,messaging:Qe}=this.data,Pt={setState:qt=>p.setState({...p.getState(),[we]:qt}),getState:()=>{let qt=p.getState();return typeof qt=="object"&&qt?qt[we]:void 0},getRenderer:async qt=>{let Oo=jt.getRenderer(qt);if(Oo)return Oo._api?Oo._api:Oo.load()},workspace:{get isTrusted(){return s}},settings:{get lineLimit(){return l.lineLimit},get outputScrolling(){return l.outputScrolling},get outputWordWrap(){return l.outputWordWrap},get linkifyFilePaths(){return l.linkifyFilePaths},get minimalError(){return l.minimalError}},get onDidChangeSettings(){return c.event}};return Qe&&(Pt.onDidReceiveMessage=this._onMessageEvent.event,Pt.postMessage=qt=>_o("customRendererMessage",{rendererId:we,message:qt})),Object.freeze(Pt)}load(){return this._loadPromise??=this._load(),this._loadPromise}async _load(){this.postDebugMessage("Start loading renderer");try{await Cm.waitForAllCurrent();let we=performance.now(),Qe=await __import(this.data.entrypoint.path);if(this.postDebugMessage("Imported renderer",{duration:`${performance.now()-we}ms`}),!Qe)return;this._api=await Qe.activate(this.createRendererContext()),this.postDebugMessage("Activated renderer",{duration:`${performance.now()-we}ms`});let Pt=a.rendererData.filter(qt=>qt.entrypoint.extends===this.data.id);return Pt.length&&this.postDebugMessage("Activating dependant renderers",{dependents:Pt.map(qt=>qt.id).join(", ")}),await Promise.all(Pt.map(async qt=>{let Oo=jt.getRenderer(qt.id);if(!Oo)throw new Error(`Could not find extending renderer: ${qt.id}`);try{return await Oo.load()}catch(ho){console.error(ho),this.postDebugMessage("Activating dependant renderer failed",{dependent:qt.id,error:ho+""});return}})),this._api}catch(we){throw this.postDebugMessage("Loading renderer failed"),we}}postDebugMessage(we,Qe){_o("logRendererDebugMessage",{message:`[renderer ${this.data.id}] - ${we}`,data:Qe})}}let Cm=new class{constructor(){this.preloads=new Map}waitFor(Ye){return this.preloads.get(Ye)||Promise.resolve(new Error(`Preload not ready: ${Ye}`))}load(Ye){let we=Promise.all([J(Ye),this.waitForAllCurrent()]);return this.preloads.set(Ye,we),we}waitForAllCurrent(){return Promise.all([...this.preloads.values()].map(Ye=>Ye.catch(we=>we)))}},TS=new class{constructor(){this.outputs=new Map;this.pendingOutputCreationRequest=new Map}enqueue(Ye,we){this.pendingOutputCreationRequest.get(Ye)?.dispose(),this.pendingOutputCreationRequest.delete(Ye);let Qe=this.outputs.get(Ye);if(Qe)Qe.queue=Qe.queue.then(async Pt=>{Qe.abort.signal.aborted||await we(Qe.abort.signal)});else{let Pt=new AbortController;this.outputs.set(Ye,{abort:Pt,queue:new Promise(qt=>qt(we(Pt.signal)))})}}enqueueIdle(Ye,we){this.pendingOutputCreationRequest.get(Ye)?.dispose(),TS.pendingOutputCreationRequest.set(Ye,g(()=>{TS.enqueue(Ye,we),TS.pendingOutputCreationRequest.delete(Ye)}))}cancelAll(){this.pendingOutputCreationRequest.forEach(Ye=>Ye.dispose()),this.pendingOutputCreationRequest.clear();for(let{abort:Ye}of this.outputs.values())Ye.abort();this.outputs.clear()}cancelOutput(Ye){this.pendingOutputCreationRequest.get(Ye)?.dispose(),this.pendingOutputCreationRequest.delete(Ye);let we=this.outputs.get(Ye);we&&(we.abort.abort(),this.outputs.delete(Ye))}},jt=new class{constructor(){this._renderers=new Map;for(let Ye of a.rendererData)this.addRenderer(Ye)}getRenderer(Ye){return this._renderers.get(Ye)}rendererEqual(Ye,we){if(Ye.id!==we.id||Ye.entrypoint.path!==we.entrypoint.path||Ye.entrypoint.extends!==we.entrypoint.extends||Ye.messaging!==we.messaging||Ye.mimeTypes.length!==we.mimeTypes.length)return!1;for(let Qe=0;Qe<Ye.mimeTypes.length;Qe++)if(Ye.mimeTypes[Qe]!==we.mimeTypes[Qe])return!1;return!0}updateRendererData(Ye){let we=new Set(this._renderers.keys()),Qe=new Set(Ye.map(Pt=>Pt.id));for(let Pt of Ye){let qt=this._renderers.get(Pt.id);qt&&this.rendererEqual(qt.data,Pt)||this.addRenderer(Pt)}for(let Pt of we)Qe.has(Pt)||this._renderers.delete(Pt)}addRenderer(Ye){this._renderers.set(Ye.id,new Fh(Ye))}clearAll(){TS.cancelAll();for(let Ye of this._renderers.values())Ye.disposeOutputItem()}clearOutput(Ye,we){TS.cancelOutput(we),this._renderers.get(Ye)?.disposeOutputItem(we)}async render(Ye,we,Qe,Pt){let qt=this.findRenderer(we,Ye);if(!qt){let ho=(window.document.documentElement.style.getPropertyValue("--notebook-cell-renderer-not-found-error")||"").replace("$0",()=>Ye.mime);this.showRenderError(Ye,Qe,ho);return}if(!(await this._doRender(Ye,Qe,qt,Pt)).continue)return;for(let ho of Ye._allOutputItems){if(ho.mime===Ye.mime)continue;let zr=await ho.getItem();if(Pt.aborted)return;if(zr){let Fs=this.findRenderer(void 0,zr);if(Fs&&!(await this._doRender(zr,Qe,Fs,Pt)).continue)return}}let Oo=(window.document.documentElement.style.getPropertyValue("--notebook-cell-renderer-fallbacks-exhausted")||"").replace("$0",()=>Ye.mime);this.showRenderError(Ye,Qe,Oo)}async _doRender(Ye,we,Qe,Pt){try{return await Qe.renderOutputItem(Ye,we,Pt),{continue:!1}}catch(qt){if(Pt.aborted)return{continue:!1};if(qt instanceof Error&&qt.name===js)return{continue:!0};throw qt}}findRenderer(Ye,we){let Qe;if(typeof Ye=="string")Qe=Array.from(this._renderers.values()).find(Pt=>Pt.data.id===Ye);else{let Pt=Array.from(this._renderers.values()).filter(qt=>qt.data.mimeTypes.includes(we.mime)&&!qt.data.entrypoint.extends);Pt.length&&(Pt.sort((qt,Oo)=>+qt.data.isBuiltin-+Oo.data.isBuiltin),Qe=Pt[0])}return Qe}showRenderError(Ye,we,Qe){let Pt=document.createElement("div"),qt=document.createElement("div");qt.className="no-renderer-error",qt.innerText=Qe;let Oo=document.createElement("div");Oo.innerText=Ye.text(),Pt.appendChild(qt),Pt.appendChild(Oo),we.innerText="",we.appendChild(Pt)}},Fi=new class{constructor(){this._markupCells=new Map;this._outputCells=new Map}clearAll(){for(let we of this._markupCells.values())we.dispose();this._markupCells.clear();for(let we of this._outputCells.values())we.dispose();this._outputCells.clear()}async createMarkupCell(we,Qe,Pt){let qt=this._markupCells.get(we.cellId);if(qt)return console.error(`Trying to create markup that already exists: ${we.cellId}`),qt;let Oo=new rs(we.cellId,we.mime,we.content,Qe,we.metadata);return Oo.element.style.visibility=Pt?"":"hidden",this._markupCells.set(we.cellId,Oo),await Oo.ready,Oo}async ensureMarkupCell(we){let Qe=this._markupCells.get(we.cellId);Qe?(Qe.element.style.visibility=we.visible?"":"hidden",await Qe.updateContentAndRender(we.content,we.metadata)):Qe=await this.createMarkupCell(we,we.offset,we.visible)}deleteMarkupCell(we){let Qe=this.getExpectedMarkupCell(we);Qe&&(Qe.remove(),Qe.dispose(),this._markupCells.delete(we))}async updateMarkupContent(we,Qe,Pt){await this.getExpectedMarkupCell(we)?.updateContentAndRender(Qe,Pt)}showMarkupCell(we,Qe,Pt,qt){this.getExpectedMarkupCell(we)?.show(Qe,Pt,qt)}hideMarkupCell(we){this.getExpectedMarkupCell(we)?.hide()}unhideMarkupCell(we){this.getExpectedMarkupCell(we)?.unhide()}getExpectedMarkupCell(we){let Qe=this._markupCells.get(we);if(!Qe){console.log(`Could not find markup cell '${we}'`);return}return Qe}updateSelectedCells(we){let Qe=new Set(we);for(let Pt of this._markupCells.values())Pt.setSelected(Qe.has(Pt.id))}toggleDragDropEnabled(we){for(let Qe of this._markupCells.values())Qe.toggleDragDropEnabled(we)}updateMarkupScrolls(we){for(let{id:Qe,top:Pt}of we){let qt=this._markupCells.get(Qe);qt&&(qt.element.style.top=`${Pt}px`)}}async renderOutputCell(we,Qe){let Pt=await Promise.all(we.requiredPreloads.map(Oo=>Cm.waitFor(Oo.uri).then(()=>{},ho=>ho)));return Qe.aborted?void 0:this.ensureOutputCell(we.cellId,we.cellTop,!1).renderOutputElement(we,Pt,Qe)}ensureOutputCell(we,Qe,Pt){let qt=this._outputCells.get(we),Oo=!!qt;return qt||(qt=new Pa(we),this._outputCells.set(we,qt)),Oo&&Pt||(qt.element.style.top=Qe+"px"),qt}clearOutput(we,Qe,Pt){this._outputCells.get(we)?.clearOutput(Qe,Pt)}showOutput(we,Qe,Pt){this._outputCells.get(we)?.show(Qe,Pt)}updateAndRerender(we,Qe,Pt){this._outputCells.get(we)?.updateContentAndRerender(Qe,Pt)}hideOutput(we){this._outputCells.get(we)?.hide()}updateOutputHeight(we,Qe,Pt){this._outputCells.get(we)?.updateOutputHeight(Qe,Pt)}updateOutputsScroll(we){for(let Qe of we)this._outputCells.get(Qe.cellId)?.updateScroll(Qe)}};class lo{static{this.pendingCodeBlocksToHighlight=new Map}static highlightCodeBlock(we,Qe){let Pt=lo.pendingCodeBlocksToHighlight.get(we);if(!Pt)return;let qt=va?.createHTML(Qe)??Qe;Pt.innerHTML=qt;let Oo=Pt.getRootNode();Oo instanceof ShadowRoot&&(Oo.adoptedStyleSheets.includes(h)||Oo.adoptedStyleSheets.push(h))}static requestHighlightCodeBlock(we){let Qe=[],Pt=0;for(let qt of we.querySelectorAll(".vscode-code-block")){let Oo=qt.getAttribute("data-vscode-code-block-lang");if(qt.textContent&&Oo){let ho=`${Date.now()}-${Pt++}`;Qe.push({value:qt.textContent,lang:Oo,id:ho}),lo.pendingCodeBlocksToHighlight.set(ho,qt)}}return Qe}}class rs{constructor(we,Qe,Pt,qt,Oo){this._isDisposed=!1;let ho=this;this.id=we,this._content={value:Pt,version:0,metadata:Oo};let{promise:zr,resolve:Fs,reject:as}=n();this.ready=zr;let Ha;this.outputItem=Object.freeze({id:we,mime:Qe,get metadata(){return ho._content.metadata},text:()=>this._content.value,json:()=>{},data:()=>{if(Ha?.version===this._content.version)return Ha.value;let au=t.encode(this._content.value);return Ha={version:this._content.version,value:au},au},blob(){return new Blob([this.data()],{type:this.mime})},_allOutputItems:[{mime:Qe,getItem:async()=>this.outputItem}]});let Zr=window.document.getElementById("container"),Sl=document.createElement("div");Sl.className="markup",Sl.style.position="absolute",Sl.style.width="100%",this.element=document.createElement("div"),this.element.id=this.id,this.element.classList.add("preview"),this.element.style.position="absolute",this.element.style.top=qt+"px",this.toggleDragDropEnabled(r.dragAndDropEnabled),Sl.appendChild(this.element),Zr.appendChild(Sl),this.addEventListeners(),this.updateContentAndRender(this._content.value,this._content.metadata).then(()=>{this._isDisposed||Se.observe(this.element,this.id,!1,this.id),Fs()},()=>as())}dispose(){this._isDisposed=!0,this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0}addEventListeners(){this.element.addEventListener("dblclick",()=>{_o("toggleMarkupPreview",{cellId:this.id})}),this.element.addEventListener("click",we=>{_o("clickMarkupCell",{cellId:this.id,altKey:we.altKey,ctrlKey:we.ctrlKey,metaKey:we.metaKey,shiftKey:we.shiftKey})}),this.element.addEventListener("contextmenu",we=>{_o("contextMenuMarkupCell",{cellId:this.id,clientX:we.clientX,clientY:we.clientY})}),this.element.addEventListener("mouseenter",()=>{_o("mouseEnterMarkupCell",{cellId:this.id})}),this.element.addEventListener("mouseleave",()=>{_o("mouseLeaveMarkupCell",{cellId:this.id})}),this.element.addEventListener("dragstart",we=>{Wt.startDrag(we,this.id)}),this.element.addEventListener("drag",we=>{Wt.updateDrag(we,this.id)}),this.element.addEventListener("dragend",we=>{Wt.endDrag(we,this.id)})}async updateContentAndRender(we,Qe){this._content={value:we,version:this._content.version+1,metadata:Qe},this.renderTaskAbort?.abort();let Pt=new AbortController;this.renderTaskAbort=Pt;try{await jt.render(this.outputItem,void 0,this.element,this.renderTaskAbort.signal)}finally{this.renderTaskAbort===Pt&&(this.renderTaskAbort=void 0)}let qt=this.element.shadowRoot??this.element,Oo=[];for(let zr of qt.children)switch(zr.tagName){case"LINK":case"SCRIPT":case"STYLE":break;default:Oo.push(zr.outerHTML);break}let ho=lo.requestHighlightCodeBlock(qt);_o("renderedMarkup",{cellId:this.id,html:Oo.join(""),codeBlocks:ho}),ae.updateHeight(this.id,this.element.offsetHeight,{isOutput:!1})}show(we,Qe,Pt){this.element.style.visibility="",this.element.style.top=`${we}px`,typeof Qe=="string"||Pt?this.updateContentAndRender(Qe??this._content.value,Pt??this._content.metadata):this.updateMarkupDimensions()}hide(){this.element.style.visibility="hidden"}unhide(){this.element.style.visibility="",this.updateMarkupDimensions()}remove(){this.element.remove()}async updateMarkupDimensions(){ae.updateHeight(this.id,this.element.offsetHeight,{isOutput:!1})}setSelected(we){this.element.classList.toggle("selected",we)}toggleDragDropEnabled(we){we?(this.element.classList.add("draggable"),this.element.setAttribute("draggable","true")):(this.element.classList.remove("draggable"),this.element.removeAttribute("draggable"))}}class Pa{constructor(we){this.outputElements=new Map;let Qe=window.document.getElementById("container"),Pt=zt(we);Qe.appendChild(Pt),this.element=document.createElement("div"),this.element.style.position="absolute",this.element.style.outline="0",this.element.id=we,this.element.classList.add("cell_container"),Qe.appendChild(this.element),this.element=this.element;let qt=zt(we,!0);Qe.appendChild(qt)}dispose(){for(let we of this.outputElements.values())we.dispose();this.outputElements.clear()}createOutputElement(we){let Qe=this.outputElements.get(we.outputId);return Qe||(Qe=new Df(we.outputId),this.element.appendChild(Qe.element),this.outputElements.set(we.outputId,Qe)),Qe.createOutputElement(we.outputId,we.outputOffset,we.left,we.cellId)}async renderOutputElement(we,Qe,Pt){let qt=Date.now(),Oo=this.createOutputElement(we);if(await Oo.render(we.content,we.rendererId,Qe,Pt),Oo.element.style.visibility=we.initiallyHidden?"hidden":"",we.executionId&&we.rendererId){let ho;we.content.type===1&&(ho=we.content.output.valueBytes.length),ho!==void 0&&ho>0&&ho<100*1024&&_o("notebookPerformanceMessage",{cellId:we.cellId,executionId:we.executionId,duration:Date.now()-qt,rendererId:we.rendererId,outputSize:ho})}}clearOutput(we,Qe){let Pt=this.outputElements.get(we);Pt?.clear(Qe),Pt?.dispose(),this.outputElements.delete(we)}show(we,Qe){this.outputElements.get(we)&&(this.element.style.visibility="",this.element.style.top=`${Qe}px`)}hide(){this.element.style.visibility="hidden"}updateContentAndRerender(we,Qe){this.outputElements.get(we)?.updateContentAndRender(Qe)}updateOutputHeight(we,Qe){this.outputElements.get(we)?.updateHeight(Qe)}updateScroll(we){this.element.style.top=`${we.cellTop}px`;let Qe=this.outputElements.get(we.outputId);Qe&&(Qe.updateScroll(we.outputOffset),we.forceDisplay&&Qe.outputNode&&(Qe.outputNode.element.style.visibility="")),we.forceDisplay&&(this.element.style.visibility="")}}class Df{constructor(we){this.outputId=we;this.element=document.createElement("div"),this.element.classList.add("output_container"),this.element.setAttribute("data-vscode-context",JSON.stringify({preventDefaultContextMenuItems:!0})),this.element.style.position="absolute",this.element.style.overflow="hidden"}get outputNode(){return this._outputNode}dispose(){this._outputNode?.dispose()}clear(we){we&&jt.clearOutput(we,this.outputId),this.element.remove()}updateHeight(we){this.element.style.maxHeight=`${we}px`,this.element.style.height=`${we}px`}updateScroll(we){this.element.style.top=`${we}px`}createOutputElement(we,Qe,Pt,qt){return this.element.innerText="",this.element.style.maxHeight="0px",this.element.style.top=`${Qe}px`,this._outputNode?.dispose(),this._outputNode=new mn(we,Pt,qt),this.element.appendChild(this._outputNode.element),this._outputNode}updateContentAndRender(we){this._outputNode?.updateAndRerender(we)}}p.postMessage({__vscode_notebook_message:!0,type:"initialized"});for(let Ye of a.staticPreloadsData)Cm.load(Ye.entrypoint);function _o(Ye,we){p.postMessage({__vscode_notebook_message:!0,type:Ye,...we})}class mn{constructor(we,Qe,Pt){this.outputId=we;this.cellId=Pt;this.hasResizeObserver=!1;this.isImageOutput=!1;this.element=document.createElement("div"),this.element.id=we,this.element.classList.add("output"),this.element.style.position="absolute",this.element.style.top="0px",this.element.style.left=Qe+"px",this.element.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}`,this.element.addEventListener("mouseenter",()=>{_o("mouseenter",{id:we})}),this.element.addEventListener("mouseleave",()=>{_o("mouseleave",{id:we})}),this.element.addEventListener("dragstart",qt=>{if(!qt.dataTransfer)return;let Oo={outputId:this.outputId};qt.dataTransfer.setData("notebook-cell-output",JSON.stringify(Oo))}),window.addEventListener("keydown",qt=>{qt.altKey&&(this.element.draggable=!0)}),window.addEventListener("keyup",qt=>{qt.altKey||(this.element.draggable=this.isImageOutput)}),window.addEventListener("blur",()=>{this.element.draggable=this.isImageOutput})}dispose(){this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0}async render(we,Qe,Pt,qt){if(this.renderTaskAbort?.abort(),this.renderTaskAbort=void 0,this._content={preferredRendererId:Qe,preloadErrors:Pt},we.type===0){let Zr=va?.createHTML(we.htmlContent)??we.htmlContent;this.element.innerHTML=Zr}else if(Pt.some(Zr=>Zr instanceof Error)){let Zr=Pt.filter(Sl=>Sl instanceof Error);ln("Error loading preloads",this.element,Zr)}else{let Zr=["image/png","image/jpeg","image/svg"];this.isImageOutput=Zr.includes(we.output.mime),this.element.draggable=this.isImageOutput;let Sl=Bn(this.outputId,we.output.mime,we.metadata,we.output.valueBytes,we.allOutputs,we.output.appended),au=new AbortController;this.renderTaskAbort=au,qt?.addEventListener("abort",()=>au.abort());try{await jt.render(Sl,Qe,this.element,au.signal)}finally{this.renderTaskAbort===au&&(this.renderTaskAbort=void 0)}}this.hasResizeObserver||(this.hasResizeObserver=!0,Se.observe(this.element,this.outputId,!0,this.cellId));let Oo=this.element.offsetHeight,ho=document.defaultView.getComputedStyle(this.element),zr=parseFloat(ho.paddingTop)+parseFloat(ho.paddingBottom),Fs=Oo-zr;ce(Fs)&&ho.padding==="0px"?(ae.updateHeight(this.outputId,Oo+a.style.outputNodePadding*2,{isOutput:!0,init:!0}),this.element.style.padding=`${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodePadding}px ${a.style.outputNodeLeftPadding}`):ce(Fs)?(ae.updateHeight(this.outputId,this.element.offsetHeight,{isOutput:!0,init:!0}),this.element.style.padding=`0 ${a.style.outputNodePadding}px 0 ${a.style.outputNodeLeftPadding}`):ae.updateHeight(this.outputId,0,{isOutput:!0,init:!0});let as=this.element.shadowRoot??this.element,Ha=lo.requestHighlightCodeBlock(as);Ha.length>0&&_o("renderedCellOutput",{codeBlocks:Ha})}updateAndRerender(we){this._content&&this.render(we,this._content.preferredRendererId,this._content.preloadErrors)}}let Wt=new class{constructor(){window.document.addEventListener("dragover",we=>{we.preventDefault()}),window.document.addEventListener("drop",we=>{we.preventDefault();let Qe=this.currentDrag;Qe&&(this.currentDrag=void 0,_o("cell-drop",{cellId:Qe.cellId,ctrlKey:we.ctrlKey,altKey:we.altKey,dragOffsetY:we.clientY}))})}startDrag(we,Qe){if(!we.dataTransfer||!r.dragAndDropEnabled)return;this.currentDrag={cellId:Qe,clientY:we.clientY};let Pt=9999;this.dragOverlay||(this.dragOverlay=document.createElement("div"),this.dragOverlay.style.position="absolute",this.dragOverlay.style.top="0",this.dragOverlay.style.left="0",this.dragOverlay.style.zIndex=`${Pt}`,this.dragOverlay.style.width="100%",this.dragOverlay.style.height="100%",this.dragOverlay.style.background="transparent",window.document.body.appendChild(this.dragOverlay)),we.target.style.zIndex=`${Pt+1}`,we.target.classList.add("dragging"),_o("cell-drag-start",{cellId:Qe,dragOffsetY:we.clientY});let qt=()=>{this.currentDrag?.cellId===Qe&&(_o("cell-drag",{cellId:Qe,dragOffsetY:this.currentDrag.clientY}),window.requestAnimationFrame(qt))};window.requestAnimationFrame(qt)}updateDrag(we,Qe){Qe!==this.currentDrag?.cellId?this.currentDrag=void 0:this.currentDrag={cellId:Qe,clientY:we.clientY}}endDrag(we,Qe){this.currentDrag=void 0,we.target.classList.remove("dragging"),_o("cell-drag-end",{cellId:Qe}),this.dragOverlay&&(this.dragOverlay.remove(),this.dragOverlay=void 0),we.target.style.zIndex=""}}}function kyo(a,i,e,t,o,n,r){return`
		const __import = (x) => import(x);
		(${yan})(
			JSON.parse(decodeURIComponent("${encodeURIComponent(JSON.stringify({style:a,options:i,renderOptions:e,rendererData:t,staticPreloadsData:o,isWorkspaceTrusted:n,nonce:r}))}"))
		)
//# sourceURL=notebookWebviewPreloads.js
`}var wan=new Map([["theme-font-family","vscode-font-family"],["theme-font-weight","vscode-font-weight"],["theme-font-size","vscode-font-size"],["theme-code-font-family","vscode-editor-font-family"],["theme-code-font-weight","vscode-editor-font-weight"],["theme-code-font-size","vscode-editor-font-size"],["theme-scrollbar-background","vscode-scrollbarSlider-background"],["theme-scrollbar-hover-background","vscode-scrollbarSlider-hoverBackground"],["theme-scrollbar-active-background","vscode-scrollbarSlider-activeBackground"],["theme-quote-background","vscode-textBlockQuote-background"],["theme-quote-border","vscode-textBlockQuote-border"],["theme-code-foreground","vscode-textPreformat-foreground"],["theme-code-background","vscode-textPreformat-background"],["theme-background","vscode-editor-background"],["theme-foreground","vscode-editor-foreground"],["theme-ui-foreground","vscode-foreground"],["theme-link","vscode-textLink-foreground"],["theme-link-active","vscode-textLink-activeForeground"],["theme-button-background","vscode-button-background"],["theme-button-hover-background","vscode-button-hoverBackground"],["theme-button-foreground","vscode-button-foreground"],["theme-button-secondary-background","vscode-button-secondaryBackground"],["theme-button-secondary-hover-background","vscode-button-secondaryHoverBackground"],["theme-button-secondary-foreground","vscode-button-secondaryForeground"],["theme-button-hover-foreground","vscode-button-foreground"],["theme-button-focus-foreground","vscode-button-foreground"],["theme-button-secondary-hover-foreground","vscode-button-secondaryForeground"],["theme-button-secondary-focus-foreground","vscode-button-secondaryForeground"],["theme-input-background","vscode-input-background"],["theme-input-foreground","vscode-input-foreground"],["theme-input-placeholder-foreground","vscode-input-placeholderForeground"],["theme-input-focus-border-color","vscode-focusBorder"],["theme-menu-background","vscode-menu-background"],["theme-menu-foreground","vscode-menu-foreground"],["theme-menu-hover-background","vscode-menu-selectionBackground"],["theme-menu-focus-background","vscode-menu-selectionBackground"],["theme-menu-hover-foreground","vscode-menu-selectionForeground"],["theme-menu-focus-foreground","vscode-menu-selectionForeground"],["theme-error-background","vscode-inputValidation-errorBackground"],["theme-error-foreground","vscode-foreground"],["theme-warning-background","vscode-inputValidation-warningBackground"],["theme-warning-foreground","vscode-foreground"],["theme-info-background","vscode-inputValidation-infoBackground"],["theme-info-foreground","vscode-foreground"],["theme-notebook-output-background","vscode-notebook-outputContainerBackgroundColor"],["theme-notebook-output-border","vscode-notebook-outputContainerBorderColor"],["theme-notebook-cell-selected-background","vscode-notebook-selectedCellBackground"],["theme-notebook-symbol-highlight-background","vscode-notebook-symbolHighlightBackground"],["theme-notebook-diff-removed-background","vscode-diffEditor-removedTextBackground"],["theme-notebook-diff-inserted-background","vscode-diffEditor-insertedTextBackground"]]),Can={"theme-input-border-width":"1px","theme-button-primary-hover-shadow":"none","theme-button-secondary-hover-shadow":"none","theme-input-border-color":"transparent"},Eyo=a=>{let i={...a,...Can};for(let[e,t]of wan)i[e]=a[t];return i};var Tyo="vscode-cdn.net",zLi=`vscode-resource.${Tyo}`,afe=`'self' https://*.${Tyo}`;function ioe(a,i){return a.scheme===Q.http||a.scheme===Q.https?a:(i&&i.authority&&i.isRemote&&a.scheme===Q.file&&(a=A.from({scheme:Q.vscodeRemote,authority:i.authority,path:a.path})),A.from({scheme:Q.https,authority:`${a.scheme}+${xan(a.authority)}.${zLi}`,path:a.path,fragment:a.fragment,query:a.query}))}function xan(a){return a.replace(/./g,i=>{let e=i.charCodeAt(0);return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57?i:"-"+e.toString(16).padStart(4,"0")})}function _yo(a){return a.replace(/-([0-9a-f]{4})/g,(i,e)=>String.fromCharCode(parseInt(e,16)))}function iOe(a,i,e=!1){let t=[];for(let n=0;n<i.outputsViewModels.length;n++){let r=i.outputsViewModels[n],s=i.model.outputs[n],[l,c]=r.resolveMimeTypes(a,void 0),u=l[c].mimeType,p=s.outputs.find(g=>g.mime===u);if((!p||u.startsWith("image"))&&(p=s.outputs.find(g=>!g.mime.startsWith("image"))),!p)continue;let h="";if(FL(u)){let{text:g,count:f}=u2t(r);h=g,f>1&&(n+=f-1)}else h=p2t(u,p,e);t.push(h)}let o;return t.length>1?o=t.map((n,r)=>`Cell output ${r+1} of ${t.length}
${n}`).join(`
`):o=t[0]??"",o}function u2t(a){let i="",e=a.cellViewModel,t=e.outputsViewModels.indexOf(a),o=0;for(;t<e.model.outputs.length;){let r=e.model.outputs[t].outputs.find(s=>FL(s.mime));if(!r)break;i=i+Dyo.decode(r.data.buffer),t=t+1,o++}return{text:i.trim(),count:o}}var Dyo=new TextDecoder;function p2t(a,i,e=!1){let t=`${a}`,o=1e5;if(t=Dyo.decode(i.data.slice(0,o).buffer),i.data.byteLength>o)t=t+"...(truncated)";else if(a==="application/vnd.code.notebook.error"){t=t.replace(/\\u001b\[[0-9;]*m/gi,"");try{let n=JSON.parse(t);!n.stack||e?t=`${n.name}: ${n.message}`:t=n.stack}catch{}}return t.trim()}async function Ryo(a,i,e,t){let o=i.model,n=a&&tOe.includes(a)?o.outputs.find(s=>s.mime===a):o.outputs.find(s=>tOe.includes(s.mime));if(a=n?.mime,!a||!n)return;let r=FL(a)?u2t(i).text:p2t(a,n);try{await e.writeText(r)}catch(s){t.error(`Failed to copy content: ${s}`)}}var tOe=["text/latex","text/html","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","text/plain","text/markdown","application/json"];var kan=/:([\d]+)(?::([\d]+))?$/,Ean=/line=(\d+)$/,Tan=/^(.*)#([^#]*)$/,sO=class extends ju{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K){super(H);this.notebookEditor=e;this.id=t;this.notebookViewType=o;this.documentUri=n;this.options=r;this.rendererMessaging=s;this.webviewService=l;this.openerService=c;this.notebookService=u;this.contextService=p;this.environmentService=h;this.fileDialogService=g;this.fileService=f;this.contextMenuService=v;this.contextKeyService=b;this.workspaceTrustManagementService=S;this.configurationService=y;this.languageService=w;this.workspaceContextService=x;this.editorGroupService=E;this.storageService=M;this.pathService=N;this.notebookLogService=V;this.telemetryService=K;this.webview=void 0;this.insetMapping=new Map;this.pendingWebviewIdleCreationRequest=new Map;this.pendingWebviewIdleInsetMapping=new Map;this.reversedPendingWebviewIdleInsetMapping=new Map;this.markupPreviewMapping=new Map;this.hiddenInsetMapping=new Set;this.reversedInsetMapping=new Map;this.localResourceRootsCache=void 0;this._onMessage=this._register(new T);this._preloadsCache=new Set;this.onMessage=this._onMessage.event;this._disposed=!1;this.firstInit=!0;this.nonce=ht();this._logRendererDebugMessage("Creating backlayer webview for notebook"),this.element=document.createElement("div"),this.element.style.height="1400px",this.element.style.position="absolute",s&&(this._register(s),s.receiveMessageHandler=(j,J)=>!this.webview||this._disposed?Promise.resolve(!1):(this._sendMessageToWebview({__vscode_notebook_message:!0,type:"customRendererMessage",rendererId:j,message:J}),Promise.resolve(!0))),this._register(S.onDidChangeTrust(j=>{let J=this.asWebviewUri(this.getNotebookBaseUri(),void 0),se=this.generateContent(J.toString());this.webview?.setHtml(se)})),this._register(vc.onDidChange(()=>{this._sendMessageToWebview({type:"tokenizedStylesChanged",css:Myo()})}))}static getOriginStore(e){return this._originStore??=new N3("notebook.backlayerWebview.origins",e),this._originStore}updateOptions(e){this.options=e,this._updateStyles(),this._updateOptions()}_logRendererDebugMessage(e){this.notebookLogService.debug("BacklayerWebview",`${this.documentUri} (${this.id}) - ${e}`)}_updateStyles(){this._sendMessageToWebview({type:"notebookStyles",styles:this._generateStyles()})}_updateOptions(){this._sendMessageToWebview({type:"notebookOptions",options:{dragAndDropEnabled:this.options.dragAndDropEnabled},renderOptions:{lineLimit:this.options.outputLineLimit,outputScrolling:this.options.outputScrolling,outputWordWrap:this.options.outputWordWrap,linkifyFilePaths:this.options.outputLinkifyFilePaths,minimalError:this.options.minimalError}})}_generateStyles(){return{"notebook-output-left-margin":`${this.options.leftMargin+this.options.runGutter}px`,"notebook-output-width":`calc(100% - ${this.options.leftMargin+this.options.rightMargin+this.options.runGutter}px)`,"notebook-output-node-padding":`${this.options.outputNodePadding}px`,"notebook-run-gutter":`${this.options.runGutter}px`,"notebook-preview-node-padding":`${this.options.previewNodePadding}px`,"notebook-markdown-left-margin":`${this.options.markdownLeftMargin}px`,"notebook-output-node-left-padding":`${this.options.outputNodeLeftPadding}px`,"notebook-markdown-min-height":`${this.options.previewNodePadding*2}px`,"notebook-markup-font-size":typeof this.options.markupFontSize=="number"&&this.options.markupFontSize>0?`${this.options.markupFontSize}px`:`calc(${this.options.fontSize}px * 1.2)`,"notebook-markdown-line-height":typeof this.options.markdownLineHeight=="number"&&this.options.markdownLineHeight>0?`${this.options.markdownLineHeight}px`:"normal","notebook-cell-output-font-size":`${this.options.outputFontSize||this.options.fontSize}px`,"notebook-cell-output-line-height":`${this.options.outputLineHeight}px`,"notebook-cell-output-max-height":`${this.options.outputLineHeight*this.options.outputLineLimit+2}px`,"notebook-cell-output-font-family":this.options.outputFontFamily||this.options.fontFamily,"notebook-cell-markup-empty-content":d(13957,null),"notebook-cell-renderer-not-found-error":d(13959,null),"notebook-cell-renderer-fallbacks-exhausted":d(13958,null),"notebook-markup-font-family":this.options.markupFontFamily}}generateContent(e){let t=this.getRendererData(),o=this.getStaticPreloadsData(),n={lineLimit:this.options.outputLineLimit,outputScrolling:this.options.outputScrolling,outputWordWrap:this.options.outputWordWrap,linkifyFilePaths:this.options.outputLinkifyFilePaths,minimalError:this.options.minimalError},r=kyo({...this.options,tokenizationCss:Myo()},{dragAndDropEnabled:this.options.dragAndDropEnabled},n,t,o,this.workspaceTrustManagementService.isWorkspaceTrusted(),this.nonce),s=this.configurationService.getValue("notebook.experimental.enableCsp"),l=this.getColor(Uce),c=this.getColor(NS);return`
		<html lang="en">
			<head>
				<meta charset="UTF-8">
				<base href="${e}/" />
				${s?`<meta http-equiv="Content-Security-Policy" content="
					default-src 'none';
					script-src ${afe} 'unsafe-inline' 'unsafe-eval';
					style-src ${afe} 'unsafe-inline';
					img-src ${afe} https: http: data:;
					font-src ${afe} https:;
					connect-src https:;
					child-src https: data:;
				">`:""}
				<style nonce="${this.nonce}">
					::highlight(find-highlight) {
						background-color: var(--vscode-editor-findMatchBackground, ${c});
					}

					::highlight(current-find-highlight) {
						background-color: var(--vscode-editor-findMatchHighlightBackground, ${l});
					}

					#container .cell_container {
						width: 100%;
					}

					#container .output_container {
						width: 100%;
					}

					#container .cell_container.nb-insertHighlight div.output_container div.output {
						background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
					}

					#container > div > div > div.output {
						font-size: var(--notebook-cell-output-font-size);
						width: var(--notebook-output-width);
						margin-left: var(--notebook-output-left-margin);
						background-color: var(--theme-notebook-output-background);
						padding-top: var(--notebook-output-node-padding);
						padding-right: var(--notebook-output-node-padding);
						padding-bottom: var(--notebook-output-node-padding);
						padding-left: var(--notebook-output-node-left-padding);
						box-sizing: border-box;
						border-top: none;
					}

					/* markdown */
					#container div.preview {
						width: 100%;
						padding-right: var(--notebook-preview-node-padding);
						padding-left: var(--notebook-markdown-left-margin);
						padding-top: var(--notebook-preview-node-padding);
						padding-bottom: var(--notebook-preview-node-padding);

						box-sizing: border-box;
						white-space: nowrap;
						overflow: hidden;
						white-space: initial;

						font-size: var(--notebook-markup-font-size);
						line-height: var(--notebook-markdown-line-height);
						color: var(--theme-ui-foreground);
						font-family: var(--notebook-markup-font-family);
					}

					#container div.preview.draggable {
						user-select: none;
						-webkit-user-select: none;
						-ms-user-select: none;
						cursor: grab;
					}

					#container div.preview.selected {
						background: var(--theme-notebook-cell-selected-background);
					}

					#container div.preview.dragging {
						background-color: var(--theme-background);
						opacity: 0.5 !important;
					}

					.monaco-workbench.vs-dark .notebookOverlay .cell.markdown .latex img,
					.monaco-workbench.vs-dark .notebookOverlay .cell.markdown .latex-block img {
						filter: brightness(0) invert(1)
					}

					#container .markup > div.nb-symbolHighlight {
						background-color: var(--theme-notebook-symbol-highlight-background);
					}

					#container .markup > div.nb-insertHighlight {
						background-color: var(--vscode-diffEditor-insertedLineBackground, var(--vscode-diffEditor-insertedTextBackground));
					}

					#container .nb-symbolHighlight .output_container .output {
						background-color: var(--theme-notebook-symbol-highlight-background);
					}

					#container .markup > div.nb-multiCellHighlight {
						background-color: var(--theme-notebook-symbol-highlight-background);
					}

					#container .nb-multiCellHighlight .output_container .output {
						background-color: var(--theme-notebook-symbol-highlight-background);
					}

					#container .nb-chatGenerationHighlight .output_container .output {
						background-color: var(--vscode-notebook-selectedCellBackground);
					}

					#container > div.nb-cellDeleted .output_container {
						background-color: var(--theme-notebook-diff-removed-background);
					}

					#container > div.nb-cellAdded .output_container {
						background-color: var(--theme-notebook-diff-inserted-background);
					}

					#container > div > div:not(.preview) > div {
						overflow-x: auto;
					}

					#container .no-renderer-error {
						color: var(--vscode-editorError-foreground);
					}

					body {
						padding: 0px;
						height: 100%;
						width: 100%;
					}

					table, thead, tr, th, td, tbody {
						border: none;
						border-color: transparent;
						border-spacing: 0;
						border-collapse: collapse;
					}

					table, th, tr {
						vertical-align: middle;
						text-align: right;
					}

					thead {
						font-weight: bold;
						background-color: rgba(130, 130, 130, 0.16);
					}

					th, td {
						padding: 4px 8px;
					}

					tr:nth-child(even) {
						background-color: rgba(130, 130, 130, 0.08);
					}

					tbody th {
						font-weight: normal;
					}

					.find-match {
						background-color: var(--vscode-editor-findMatchHighlightBackground);
					}

					.current-find-match {
						background-color: var(--vscode-editor-findMatchBackground);
					}

					#_defaultColorPalatte {
						color: var(--vscode-editor-findMatchHighlightBackground);
						background-color: var(--vscode-editor-findMatchBackground);
					}
				</style>
			</head>
			<body style="overflow: hidden;">
				<div id='findStart' tabIndex=-1></div>
				<div id='container' class="widgetarea" style="position: absolute;width:100%;top: 0px"></div>
				<div id="_defaultColorPalatte"></div>
				<script type="module">${r}</script>
			</body>
		</html>`}getRendererData(){return this.notebookService.getRenderers().map(e=>{let t={extends:e.entrypoint.extends,path:this.asWebviewUri(e.entrypoint.path,e.extensionLocation).toString()};return{id:e.id,entrypoint:t,mimeTypes:e.mimeTypes,messaging:e.messaging!=="never"&&!!this.rendererMessaging,isBuiltin:e.isBuiltin}})}getStaticPreloadsData(){return Array.from(this.notebookService.getStaticPreloads(this.notebookViewType),e=>({entrypoint:this.asWebviewUri(e.entrypoint,e.extensionLocation).toString().toString()}))}asWebviewUri(e,t){return ioe(e,t?.scheme===Q.vscodeRemote?{isRemote:!0,authority:t.authority}:void 0)}postKernelMessage(e){this._sendMessageToWebview({__vscode_notebook_message:!0,type:"customKernelMessage",message:e})}resolveOutputId(e){let t=this.reversedInsetMapping.get(e);return t?{cellInfo:this.insetMapping.get(t).cellInfo,output:t}:void 0}isResolved(){return!!this.webview}createWebview(e){let t=this.asWebviewUri(this.getNotebookBaseUri(),void 0),o=this.generateContent(t.toString());return this._initialize(o,e)}getNotebookBaseUri(){if(this.documentUri.scheme===Q.untitled){let e=this.workspaceContextService.getWorkspaceFolder(this.documentUri);if(e)return e.uri;let t=this.workspaceContextService.getWorkspace().folders;if(t.length)return t[0].uri}return ai(this.documentUri)}getBuiltinLocalResourceRoots(){return this.documentUri.path.toLowerCase().endsWith(".ipynb")?Ft?[]:[ai(In.asFileUri("vs/nls.js"))]:[]}_initialize(e,t){if(!Me(this.element).document.body.contains(this.element))throw new Error("Element is already detached from the DOM tree");this.webview=this._createInset(this.webviewService,e),this.webview.mountTo(this.element,t),this._register(this.webview),this._register(new dee(t,()=>this.webview));let o=new Mo;return this._register(this.webview.onFatalError(n=>{o.error(new Error(`Could not initialize webview: ${n.message}}`))})),this._register(this.webview.onMessage(async n=>{let r=n.message;if(!this._disposed&&r.__vscode_notebook_message)switch(r.type){case"initialized":{o.complete(),this.initializeWebViewState();break}case"initializedMarkup":{this.initializeMarkupPromise?.requestId===r.requestId&&(this.initializeMarkupPromise?.p.complete(),this.initializeMarkupPromise=void 0);break}case"dimension":{for(let s of r.updates){let l=s.height;if(s.isOutput){let c=this.resolveOutputId(s.id);if(c){let{cellInfo:u,output:p}=c;this.notebookEditor.updateOutputHeight(u,p,l,!!s.init,"webview#dimension"),this.notebookEditor.scheduleOutputHeightAck(u,s.id,l)}else if(s.init){let u=this.reversedPendingWebviewIdleInsetMapping.get(s.id);if(u){let p=this.pendingWebviewIdleInsetMapping.get(u);this.pendingWebviewIdleCreationRequest.delete(u),this.pendingWebviewIdleCreationRequest.delete(u);let h=p.cellInfo;this.reversedInsetMapping.set(s.id,u),this.insetMapping.set(u,p),this.notebookEditor.updateOutputHeight(h,u,l,!!s.init,"webview#dimension"),this.notebookEditor.scheduleOutputHeightAck(h,s.id,l)}this.reversedPendingWebviewIdleInsetMapping.delete(s.id)}{if(!s.init)continue;let u=this.reversedInsetMapping.get(s.id);if(!u)continue;let p=this.insetMapping.get(u);p.initialized=!0}}else this.notebookEditor.updateMarkupCellHeight(s.id,l,!!s.init)}break}case"mouseenter":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsHovered=!0)}break}case"mouseleave":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsHovered=!1)}break}case"outputFocus":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsFocused=!0,this.notebookEditor.focusNotebookCell(l,"output",{outputId:s.output.model.outputId,skipReveal:!0,outputWebviewFocused:!0}))}break}case"outputBlur":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.outputIsFocused=!1,l.inputInOutputIsFocused=!1)}break}case"scroll-ack":break;case"scroll-to-reveal":{this.notebookEditor.setScrollTop(r.scrollTop-sfe);break}case"did-scroll-wheel":{this.notebookEditor.triggerScroll({...r.payload,preventDefault:()=>{},stopPropagation:()=>{}});break}case"focus-editor":{let s=this.notebookEditor.getCellById(r.cellId);s&&(r.focusNext?this.notebookEditor.focusNextNotebookCell(s,"editor"):await this.notebookEditor.focusNotebookCell(s,"editor"));break}case"clicked-data-url":{this._onDidClickDataLink(r);break}case"clicked-link":{if(hc(r.href,Q.command)){let s=A.parse(r.href);if(s.path==="workbench.action.openLargeOutput"){let l=s.query,c=this.editorGroupService.activeGroup;c&&c.activeEditor&&c.pinEditor(c.activeEditor),this.openerService.open(sn.generateCellOutputUriWithId(this.documentUri,l));return}if(s.path==="cellOutput.enableScrolling"){let l=s.query,c=this.reversedInsetMapping.get(l);c&&(this.telemetryService.publicLog2("workbenchActionExecuted",{id:"notebook.cell.toggleOutputScrolling",from:"inlineLink"}),c.cellViewModel.outputsViewModels.forEach(u=>{u.model.metadata&&(u.model.metadata.scrollable=!0,u.resetRenderer())}));return}this.openerService.open(r.href,{fromUserGesture:!0,fromWorkspace:!0,allowCommands:["github-issues.authNow","workbench.extensions.search","workbench.action.openSettings","_notebook.selectKernel","jupyter.viewOutput","jupyter.createPythonEnvAndSelectController"]});return}if(gB(r.href,Q.http,Q.https,Q.mailto))this.openerService.open(r.href,{fromUserGesture:!0,fromWorkspace:!0});else if(hc(r.href,Q.vscodeNotebookCell)){let s=A.parse(r.href);await this._handleNotebookCellResource(s)}else/^[\w\-]+:/.test(r.href)?Jl(r.href)?this._openUri(A.file(r.href)):this._openUri(A.parse(r.href)):await this._handleResourceOpening(_an(r.href));break}case"customKernelMessage":{this._onMessage.fire({message:r.message});break}case"customRendererMessage":{this.rendererMessaging?.postMessage(r.rendererId,r.message);break}case"clickMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s&&(r.shiftKey||(et?r.metaKey:r.ctrlKey)?this.notebookEditor.toggleNotebookCellSelection(s,r.shiftKey):await this.notebookEditor.focusNotebookCell(s,"container",{skipReveal:!0}));break}case"contextMenuMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);if(s){await this.notebookEditor.focusNotebookCell(s,"container",{skipReveal:!0});let l=this.element.getBoundingClientRect();this.contextMenuService.showContextMenu({menuId:R.NotebookCellTitle,contextKeyService:this.contextKeyService,getAnchor:()=>({x:l.x+r.clientX,y:l.y+r.clientY})})}break}case"toggleMarkupPreview":{let s=this.notebookEditor.getCellById(r.cellId);s&&!this.notebookEditor.creationOptions.isReadOnly&&(this.notebookEditor.setMarkupCellEditState(r.cellId,1),await this.notebookEditor.focusNotebookCell(s,"editor",{skipReveal:!0}));break}case"mouseEnterMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof hS&&(s.cellIsHovered=!0);break}case"mouseLeaveMarkupCell":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof hS&&(s.cellIsHovered=!1);break}case"cell-drag-start":{this.notebookEditor.didStartDragMarkupCell(r.cellId,r);break}case"cell-drag":{this.notebookEditor.didDragMarkupCell(r.cellId,r);break}case"cell-drop":{this.notebookEditor.didDropMarkupCell(r.cellId,{dragOffsetY:r.dragOffsetY,ctrlKey:r.ctrlKey,altKey:r.altKey});break}case"cell-drag-end":{this.notebookEditor.didEndDragMarkupCell(r.cellId);break}case"renderedMarkup":{let s=this.notebookEditor.getCellById(r.cellId);s instanceof hS&&(s.renderedHtml=r.html),this._handleHighlightCodeBlock(r.codeBlocks);break}case"renderedCellOutput":{this._handleHighlightCodeBlock(r.codeBlocks);break}case"outputResized":{this.notebookEditor.didResizeOutput(r.cellId);break}case"getOutputItem":{let l=this.resolveOutputId(r.outputId)?.output.model.outputs.find(c=>c.mime===r.mime);this._sendMessageToWebview({type:"returnOutputItem",requestId:r.requestId,output:l?{mime:l.mime,valueBytes:l.data.buffer}:void 0});break}case"logRendererDebugMessage":{this._logRendererDebugMessage(`${r.message}${r.data?" "+JSON.stringify(r.data,null,4):""}`);break}case"notebookPerformanceMessage":{this.notebookEditor.updatePerformanceMetadata(r.cellId,r.executionId,r.duration,r.rendererId),r.outputSize&&r.rendererId==="vscode.builtin-renderer"&&this._sendPerformanceData(r.outputSize,r.duration);break}case"outputInputFocus":{let s=this.resolveOutputId(r.id);if(s){let l=this.notebookEditor.getCellByInfo(s.cellInfo);l&&(l.inputInOutputIsFocused=r.inputFocused)}this.notebookEditor.didFocusOutputInputChange(r.inputFocused)}}})),o.p}_sendPerformanceData(e,t){let o={outputSize:e,renderTime:t};this.telemetryService.publicLog2("NotebookCellOutputRender",o)}_handleNotebookCellResource(e){let t=e.path.length>0?e:this.documentUri,o=/(?:^|&)line=([^&]+)/.exec(e.query),n;if(o){let l=parseInt(o[1],10);isNaN(l)||(n={selection:{startLineNumber:l,startColumn:1}})}let r=/(?:^|&)execution_count=([^&]+)/.exec(e.query);if(r){let l=parseInt(r[1],10);if(!isNaN(l)){let u=this.notebookService.getNotebookTextModel(t)?.cells.slice().reverse().find(p=>p.internalMetadata.executionOrder===l);if(u?.uri)return this.openerService.open(u.uri,{fromUserGesture:!0,fromWorkspace:!0,editorOptions:n})}}let s=/\?line=(\d+)$/.exec(e.fragment);if(s){let l=parseInt(s[1],10);if(!isNaN(l)){let c=l+1,u=e.fragment.substring(0,s.index),p={selection:{startLineNumber:c,startColumn:1,endLineNumber:c,endColumn:1}};return this.openerService.open(t.with({fragment:u}),{fromUserGesture:!0,fromWorkspace:!0,editorOptions:p})}}return this.openerService.open(t,{fromUserGesture:!0,fromWorkspace:!0})}async _handleResourceOpening(e){let t,o,n=Tan.exec(e);if(n&&(e=n[1],o=n[2]),e.startsWith("/")){t=await this.pathService.fileURI(e);let r=this.workspaceContextService.getWorkspace().folders;r.length&&(t=t.with({scheme:r[0].uri.scheme,authority:r[0].uri.authority}))}else if(e.startsWith("~")){let r=await this.pathService.userHome();r&&(t=A.joinPath(r,e.substring(2)))}else if(this.documentUri.scheme===Q.untitled){let r=this.workspaceContextService.getWorkspace().folders;if(!r.length)return;t=A.joinPath(r[0].uri,e)}else t=A.joinPath(ai(this.documentUri),e);t&&(o&&(t=t.with({fragment:o})),this._openUri(t))}_openUri(e){let t,o,n=kan.exec(e.path);n&&(e=e.with({path:e.path.slice(0,n.index),fragment:`L${n[0].slice(1)}`}),t=parseInt(n[1],10),o=parseInt(n[2],10));let r=Ean.exec(e.query);if(r){let l=parseInt(r[1],10);isNaN(l)||(t=l+1,o=1,e=e.with({fragment:`L${t}`}))}e=e.with({query:null});let s;for(let l of this.editorGroupService.groups){let c=l.editors.find(u=>u.resource&&ze(u.resource,e,!0));if(c){s={group:l,editor:c};break}}if(s){let l=t!==void 0&&o!==void 0?{startLineNumber:t,startColumn:o}:void 0,c={selection:l};s.group.openEditor(s.editor,l?c:void 0)}else this.openerService.open(e,{fromUserGesture:!0,fromWorkspace:!0})}_handleHighlightCodeBlock(e){for(let{id:t,value:o,lang:n}of e){let r=this.languageService.getLanguageIdByLanguageName(n);r&&EK(this.languageService,o,r).then(s=>{this._disposed||this._sendMessageToWebview({type:"tokenizedCodeBlock",html:s,codeBlockId:t})})}}async _onDidClickDataLink(e){if(typeof e.data!="string")return;let[t,o]=e.data.split(";base64,");if(!o||!t)return;let n=Ts(this.documentUri)===".interactive"?this.workspaceContextService.getWorkspace().folders[0]?.uri??await this.fileDialogService.defaultFilePath():ai(this.documentUri),r;if(e.downloadName)r=e.downloadName;else{let u=t.replace(/^data:/,""),p=u&&wA(u);r=p?`download${p}`:"download"}let s=Ve(n,r),l=await this.fileDialogService.showSaveDialog({defaultUri:s});if(!l)return;let c=Ws(o);await this.fileService.writeFile(l,c),await this.openerService.open(l)}_createInset(e,t){this.localResourceRootsCache=this._getResourceRootsCache();let o=e.createWebviewElement({origin:sO.getOriginStore(this.storageService).getOrigin(this.notebookViewType,void 0),title:d(13960,null),options:{purpose:"notebookRenderer",enableFindWidget:!1,transformCssVariables:Eyo},contentOptions:{allowMultipleAPIAcquire:!0,allowScripts:!0,localResourceRoots:this.localResourceRootsCache},extension:void 0,providedViewType:"notebook.output"});return o.setHtml(t),o.setContextKeyService(this.contextKeyService),o}_getResourceRootsCache(){let e=this.contextService.getWorkspace().folders.map(o=>o.uri),t=this.getNotebookBaseUri();return[this.notebookService.getNotebookProviderResourceRoots(),this.notebookService.getRenderers().map(o=>ai(o.entrypoint.path)),...Array.from(this.notebookService.getStaticPreloads(this.notebookViewType),o=>[ai(o.entrypoint),...o.localResourceRoots]),e,t,this.getBuiltinLocalResourceRoots()].flat()}initializeWebViewState(){this._preloadsCache.clear(),this._currentKernel&&this._updatePreloadsFromKernel(this._currentKernel);for(let[e,t]of this.insetMapping.entries())this._sendMessageToWebview({...t.cachedCreation,initiallyHidden:this.hiddenInsetMapping.has(e)});if(!this.initializeMarkupPromise?.isFirstInit){let e=[...this.markupPreviewMapping.values()];this.markupPreviewMapping.clear(),this.initializeMarkup(e)}this._updateStyles(),this._updateOptions()}shouldUpdateInset(e,t,o,n){if(this._disposed||"isOutputCollapsed"in e&&e.isOutputCollapsed)return!1;if(this.hiddenInsetMapping.has(t))return!0;let r=this.insetMapping.get(t);return!(!r||n===r.cachedCreation.outputOffset&&o===r.cachedCreation.cellTop)}ackHeight(e){this._sendMessageToWebview({type:"ack-dimension",updates:e})}updateScrollTops(e,t){if(this._disposed)return;let o=ui(e.map(n=>{let r=this.insetMapping.get(n.output);if(!r||!n.forceDisplay&&!this.shouldUpdateInset(n.cell,n.output,n.cellTop,n.outputOffset))return;let s=r.outputId;return r.cachedCreation.cellTop=n.cellTop,r.cachedCreation.outputOffset=n.outputOffset,this.hiddenInsetMapping.delete(n.output),{cellId:n.cell.id,outputId:s,cellTop:n.cellTop,outputOffset:n.outputOffset,forceDisplay:n.forceDisplay}}));!o.length&&!t.length||this._sendMessageToWebview({type:"view-scroll",widgets:o,markupCells:t})}async createMarkupPreview(e){if(!this._disposed){if(this.markupPreviewMapping.has(e.cellId)){console.error("Trying to create markup preview that already exists");return}this.markupPreviewMapping.set(e.cellId,e),this._sendMessageToWebview({type:"createMarkupCell",cell:e})}}async showMarkupPreview(e){if(this._disposed)return;let t=this.markupPreviewMapping.get(e.cellId);if(!t)return this.createMarkupPreview(e);let o=e.content===t.content,n=Qi(e.metadata,t.metadata);(!o||!n||!t.visible)&&this._sendMessageToWebview({type:"showMarkupCell",id:e.cellId,handle:e.cellHandle,content:o?void 0:e.content,top:e.offset,metadata:n?void 0:e.metadata}),t.metadata=e.metadata,t.content=e.content,t.offset=e.offset,t.visible=!0}async hideMarkupPreviews(e){if(this._disposed)return;let t=[];for(let o of e){let n=this.markupPreviewMapping.get(o);n&&n.visible&&(t.push(o),n.visible=!1)}t.length&&this._sendMessageToWebview({type:"hideMarkupCells",ids:t})}async unhideMarkupPreviews(e){if(this._disposed)return;let t=[];for(let o of e){let n=this.markupPreviewMapping.get(o);n?n.visible||(n.visible=!0,t.push(o)):console.error(`Trying to unhide a preview that does not exist: ${o}`)}this._sendMessageToWebview({type:"unhideMarkupCells",ids:t})}async deleteMarkupPreviews(e){if(!this._disposed){for(let t of e)this.markupPreviewMapping.has(t)||console.error(`Trying to delete a preview that does not exist: ${t}`),this.markupPreviewMapping.delete(t);e.length&&this._sendMessageToWebview({type:"deleteMarkupCell",ids:e})}}async updateMarkupPreviewSelections(e){this._disposed||this._sendMessageToWebview({type:"updateSelectedMarkupCells",selectedCellIds:e.filter(t=>this.markupPreviewMapping.has(t))})}async initializeMarkup(e){if(this._disposed)return;this.initializeMarkupPromise?.p.complete();let t=ht();this.initializeMarkupPromise={p:new Mo,requestId:t,isFirstInit:this.firstInit},this.firstInit=!1;for(let o of e)this.markupPreviewMapping.set(o.cellId,o);return this._sendMessageToWebview({type:"initializeMarkup",cells:e,requestId:t}),this.initializeMarkupPromise.p.p}_cachedInsetEqual(e,t){return t.type===1?e.renderer?.id===t.renderer.id:e.cachedCreation.type==="html"}requestCreateOutputWhenWebviewIdle(e,t,o,n){this._disposed||this.insetMapping.has(t.source)||this.pendingWebviewIdleCreationRequest.has(t.source)||this.pendingWebviewIdleInsetMapping.has(t.source)||this.pendingWebviewIdleCreationRequest.set(t.source,TL(()=>{let{message:r,renderer:s,transfer:l}=this._createOutputCreationMessage(e,t,o,n,!0,!0);this._sendMessageToWebview(r,l),this.pendingWebviewIdleInsetMapping.set(t.source,{outputId:r.outputId,versionId:t.source.model.versionId,cellInfo:e,renderer:s,cachedCreation:r}),this.reversedPendingWebviewIdleInsetMapping.set(r.outputId,t.source),this.pendingWebviewIdleCreationRequest.delete(t.source)}))}createOutput(e,t,o,n){if(this._disposed)return;let r=this.insetMapping.get(t.source);if(this.pendingWebviewIdleCreationRequest.get(t.source)?.dispose(),this.pendingWebviewIdleCreationRequest.delete(t.source),this.pendingWebviewIdleInsetMapping.delete(t.source),r&&this.reversedPendingWebviewIdleInsetMapping.delete(r.outputId),r&&this._cachedInsetEqual(r,t)){this.hiddenInsetMapping.delete(t.source),this._sendMessageToWebview({type:"showOutput",cellId:r.cellInfo.cellId,outputId:r.outputId,cellTop:o,outputOffset:n});return}let{message:s,renderer:l,transfer:c}=this._createOutputCreationMessage(e,t,o,n,!1,!1);this._sendMessageToWebview(s,c),this.insetMapping.set(t.source,{outputId:s.outputId,versionId:t.source.model.versionId,cellInfo:e,renderer:l,cachedCreation:s}),this.hiddenInsetMapping.delete(t.source),this.reversedInsetMapping.set(s.outputId,t.source)}createMetadata(e,t){if(t.startsWith("image")){let o=e.outputs.find(n=>n.mime==="text/plain")?.data.buffer;if(o?.length&&o?.length>0){let n=new TextDecoder().decode(o);return{...e.metadata,vscode_altText:n}}}return e.metadata}_createOutputCreationMessage(e,t,o,n,r,s){let l={type:"html",executionId:e.executionId,cellId:e.cellId,cellTop:o,outputOffset:n,left:0,requiredPreloads:[],createOnIdle:r},c=[],u,p;if(t.type===1){let h=t.source.model;p=t.renderer;let g=h.outputs.find(b=>b.mime===t.mimeType),f=this.createMetadata(h,t.mimeType),v=Lyo(g.data.buffer,c);u={...l,outputId:h.outputId,rendererId:t.renderer.id,content:{type:1,outputId:h.outputId,metadata:f,output:{mime:g.mime,valueBytes:v},allOutputs:h.outputs.map(b=>({mime:b.mime}))},initiallyHidden:s}}else u={...l,outputId:ht(),content:{type:t.type,htmlContent:t.htmlContent},initiallyHidden:s};return{message:u,renderer:p,transfer:c}}updateOutput(e,t,o,n){if(this._disposed)return;if(!this.insetMapping.has(t.source)){this.createOutput(e,t,o,n);return}let r=this.insetMapping.get(t.source);if(r.versionId===t.source.model.versionId)return;this.hiddenInsetMapping.delete(t.source);let s,l=[];if(t.type===1){let c=t.source.model,u=c.outputs.find(f=>f.mime===t.mimeType),p=c.appendedSinceVersion(r.versionId,t.mimeType),h=p?{valueBytes:p.buffer,previousVersion:r.versionId}:void 0,g=Lyo(u.data.buffer,l);s={type:1,outputId:r.outputId,metadata:c.metadata,output:{mime:t.mimeType,valueBytes:g,appended:h},allOutputs:c.outputs.map(f=>({mime:f.mime}))}}this._sendMessageToWebview({type:"showOutput",cellId:r.cellInfo.cellId,outputId:r.outputId,cellTop:o,outputOffset:n,content:s},l),r.versionId=t.source.model.versionId}async copyImage(e){let t=[],o=e.model;for(let n of o.outputs)if(tOe.includes(n.mime)){let r=FL(n.mime)?u2t(e).text:p2t(n.mime,n);t.push({mimeType:n.mime,content:r})}this._sendMessageToWebview({type:"copyImage",outputId:e.model.outputId,altOutputId:e.model.alternativeOutputId,textAlternates:t.length>0?t:void 0})}removeInsets(e){if(!this._disposed)for(let t of e){let o=this.insetMapping.get(t);if(!o)continue;let n=o.outputId;this._sendMessageToWebview({type:"clearOutput",rendererId:o.cachedCreation.rendererId,cellUri:o.cellInfo.cellUri.toString(),outputId:n,cellId:o.cellInfo.cellId}),this.insetMapping.delete(t),this.pendingWebviewIdleCreationRequest.get(t)?.dispose(),this.pendingWebviewIdleCreationRequest.delete(t),this.pendingWebviewIdleInsetMapping.delete(t),this.reversedPendingWebviewIdleInsetMapping.delete(n),this.reversedInsetMapping.delete(n)}}hideInset(e){if(this._disposed)return;let t=this.insetMapping.get(e);t&&(this.hiddenInsetMapping.add(e),this._sendMessageToWebview({type:"hideOutput",outputId:t.outputId,cellId:t.cellInfo.cellId}))}focusWebview(){this._disposed||this.webview?.focus()}selectOutputContents(e){if(this._disposed)return;let t=e.outputsViewModels.find(n=>n.model.outputId===e.focusedOutputId),o=t?this.insetMapping.get(t)?.outputId:void 0;this._sendMessageToWebview({type:"select-output-contents",cellOrOutputId:o||e.id})}selectInputContents(e){if(this._disposed)return;let t=e.outputsViewModels.find(n=>n.model.outputId===e.focusedOutputId),o=t?this.insetMapping.get(t)?.outputId:void 0;this._sendMessageToWebview({type:"select-input-contents",cellOrOutputId:o||e.id})}focusOutput(e,t,o){this._disposed||(o||this.webview?.focus(),this._sendMessageToWebview({type:"focus-output",cellOrOutputId:e,alternateId:t}))}blurOutput(){this._disposed||this._sendMessageToWebview({type:"blur-output"})}async find(e,t){if(e==="")return this._sendMessageToWebview({type:"findStop",ownerID:t.ownerID}),[];let o=new Promise(r=>{let s=this.webview?.onMessage(l=>{l.message.type==="didFind"&&(r(l.message.matches),s?.dispose())})});return this._sendMessageToWebview({type:"find",query:e,options:t}),await o}findStop(e){this._sendMessageToWebview({type:"findStop",ownerID:e})}async findHighlightCurrent(e,t){let o=new Promise(r=>{let s=this.webview?.onMessage(l=>{l.message.type==="didFindHighlightCurrent"&&(r(l.message.offset),s?.dispose())})});return this._sendMessageToWebview({type:"findHighlightCurrent",index:e,ownerID:t}),await o}async findUnHighlightCurrent(e,t){this._sendMessageToWebview({type:"findUnHighlightCurrent",index:e,ownerID:t})}deltaCellOutputContainerClassNames(e,t,o){this._sendMessageToWebview({type:"decorations",cellId:e,addedClassNames:t,removedClassNames:o})}deltaMarkupPreviewClassNames(e,t,o){this.markupPreviewMapping.get(e)&&this._sendMessageToWebview({type:"markupDecorations",cellId:e,addedClassNames:t,removedClassNames:o})}updateOutputRenderers(){if(!this.webview)return;let e=this.getRendererData();this.localResourceRootsCache=this._getResourceRootsCache();let t=[...this.localResourceRootsCache||[],...this._currentKernel?[this._currentKernel.localResourceRoot]:[]];this.webview.localResourcesRoot=t,this._sendMessageToWebview({type:"updateRenderers",rendererData:e})}async updateKernelPreloads(e){if(this._disposed||e===this._currentKernel)return;let t=this._currentKernel;this._currentKernel=e,t&&t.preloadUris.length>0?this.webview?.reload():e&&this._updatePreloadsFromKernel(e)}_updatePreloadsFromKernel(e){let t=[];for(let o of e.preloadUris){let n=this.environmentService.isExtensionDevelopment&&(o.scheme==="http"||o.scheme==="https")?o:this.asWebviewUri(o,void 0);this._preloadsCache.has(n.toString())||(t.push({uri:n.toString(),originalUri:o.toString()}),this._preloadsCache.add(n.toString()))}t.length&&this._updatePreloads(t)}_updatePreloads(e){if(!this.webview)return;let t=[...this.localResourceRootsCache||[],...this._currentKernel?[this._currentKernel.localResourceRoot]:[]];this.webview.localResourcesRoot=t,this._sendMessageToWebview({type:"preload",resources:e})}_sendMessageToWebview(e,t){this._disposed||this.webview?.postMessage(e,t)}dispose(){this._disposed=!0,this.webview?.dispose(),this.webview=void 0,this.notebookEditor=null,this.insetMapping.clear(),this.pendingWebviewIdleCreationRequest.clear(),super.dispose()}};sO=I([m(6,Pu),m(7,Je),m(8,kn),m(9,Ae),m(10,Mt),m(11,nn),m(12,ge),m(13,Xe),m(14,X),m(15,Or),m(16,B),m(17,Rt),m(18,Ae),m(19,kt),m(20,de),m(21,Pn),m(22,Sb),m(23,Pe),m(24,_e)],sO);function Lyo(a,i){if(a.byteLength===a.buffer.byteLength)return a;{let e=new Uint8Array(a);return i.push(e.buffer),e}}function Myo(){let a=vc.getColorMap();return a?ED(a):""}function _an(a){try{return decodeURIComponent(a)}catch{return a}}var Ynt=class extends em{get activeCell(){return this.currentCell}constructor(i,e){super()}didRenderCell(i){super.didRenderCell(i)}unrenderCell(i){super.unrenderCell(i)}updateInternalLayoutNow(i){}dispose(){super.dispose()}};var lfe=class extends em{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.container=t;this.contextKeyService=o;this.themeService=n;this.commentService=r;this.instantiationService=s;this.container.classList.add("review-widget"),this._register(this._commentThreadWidgets=new Ot),this._register(this.themeService.onDidColorThemeChange(this._applyTheme,this)),this._applyTheme()}async initialize(e){this.currentElement!==e&&(this.currentElement=e,await this._updateThread())}async _createCommentTheadWidget(e,t){let o=new O,n=this.instantiationService.createInstance(Qee,this.container,this.notebookEditor,e,this.notebookEditor.textModel.uri,this.contextKeyService,this.instantiationService,t,void 0,void 0,{},void 0,{actionRunner:()=>{},collapse:async()=>!0});o.add(n),this._commentThreadWidgets.set(t.threadId,{widget:n,dispose:()=>o.dispose()});let r=this.notebookEditor.getLayoutInfo();await n.display(r.fontInfo.lineHeight,!0),this._applyTheme(),o.add(n.onDidResize(()=>{this.currentElement&&(this.currentElement.commentHeight=this._calculateCommentThreadHeight(n.getDimensions().height))}))}_bindListeners(){this.cellDisposables.add(this.commentService.onDidUpdateCommentThreads(async()=>this._updateThread()))}async _updateThread(){if(!this.currentElement)return;let e=await this._getCommentThreadsForCell(this.currentElement),t=new Set(this._commentThreadWidgets.keys()),o=this.currentElement.layoutInfo;this.container.style.top=`${o.commentOffset}px`;for(let n of e)if(n)for(let r of n.threads){t.delete(r.threadId);let s=this._commentThreadWidgets.get(r.threadId)?.widget;s?await s.updateCommentThread(r):await this._createCommentTheadWidget(n.uniqueOwner,r)}for(let n of t)this._commentThreadWidgets.deleteAndDispose(n);this._updateHeight()}_calculateCommentThreadHeight(e){let t=this.notebookEditor.getLayoutInfo(),o=Math.ceil(t.fontInfo.lineHeight*1.2),n=t.fontInfo.lineHeight,r=Math.round(n/3),s=Math.round(n/9)*2;return o+e+r+s+8}_updateHeight(){if(!this.currentElement)return;let e=0;for(let{widget:t}of this._commentThreadWidgets.values())e+=this._calculateCommentThreadHeight(t.getDimensions().height);this.currentElement.commentHeight=e}async _getCommentThreadsForCell(e){return this.notebookEditor.hasModel()?ui(await this.commentService.getNotebookComments(e.uri)):[]}_applyTheme(){let e=this.notebookEditor.getLayoutInfo().fontInfo;for(let{widget:t}of this._commentThreadWidgets.values())t.applyTheme(e)}didRenderCell(e){this.initialize(e),this._bindListeners()}prepareLayout(){this._updateHeight()}updateInternalLayoutNow(e){this.currentElement&&(this.container.style.top=`${e.layoutInfo.commentOffset}px`)}};lfe=I([m(2,X),m(3,Pe),m(4,Wm),m(5,F)],lfe);var Xnt=class extends em{constructor(e,t,o){super();this.notebookEditor=e;this.rootContainer=t;this.decorationContainer=o}didRenderCell(e){let t=[];this.rootContainer.classList.forEach(n=>{/^nb\-.*$/.test(n)&&t.push(n)}),t.forEach(n=>{this.rootContainer.classList.remove(n)}),this.decorationContainer.innerText="";let o=()=>{this.decorationContainer.innerText="",e.getCellDecorations().filter(n=>n.topClassName!==void 0).forEach(n=>{this.decorationContainer.append(_(`.${n.topClassName}`))})};this.cellDisposables.add(e.onCellDecorationsChanged(n=>{(n.added.find(s=>s.topClassName)||n.removed.find(s=>s.topClassName))&&o()})),o(),this.registerDecorations()}registerDecorations(){this.currentCell&&(this.cellDisposables.add(this.currentCell.onCellDecorationsChanged(e=>{e.added.forEach(t=>{t.className&&this.currentCell&&this.rootContainer.classList.add(t.className)}),e.removed.forEach(t=>{t.className&&this.currentCell&&this.rootContainer.classList.remove(t.className)})})),this.currentCell.getCellDecorations().forEach(e=>{e.className&&this.currentCell&&(this.rootContainer.classList.add(e.className),this.notebookEditor.deltaCellContainerClassNames(this.currentCell.id,[e.className],[],this.currentCell.cellKind)),e.outputClassName&&this.currentCell&&this.notebookEditor.deltaCellContainerClassNames(this.currentCell.id,[e.outputClassName],[],this.currentCell.cellKind)}))}};var KLi=class a{static{this._ttPolicy=zf("cellRendererEditorText",{createHTML(i){return i}})}getRichText(i,e){let t=i.getModel();if(!t)return null;let o=this.getDefaultColorMap(),n=i.getOptions().get(59),r="--notebook-editor-font-family",s="--notebook-editor-font-size",l="--notebook-editor-font-weight",c=`color: ${o[1]};background-color: ${o[2]};font-family: var(${r});font-weight: var(${l});font-size: var(${s});line-height: ${n.lineHeight}px;white-space: pre;`,u=_("div",{style:c}),p=n.fontSize,h=n.fontWeight;u.style.setProperty(r,n.fontFamily),u.style.setProperty(s,`${p}px`),u.style.setProperty(l,h);let g=this.getRichTextLinesAsHtml(t,e,o);return u.innerHTML=g,u}getRichTextLinesAsHtml(i,e,t){let o=e.startLineNumber,n=e.startColumn,r=e.endLineNumber,s=e.endColumn,l=i.getOptions().tabSize,c="";for(let u=o;u<=r;u++){let p=i.tokenization.getLineTokens(u),h=p.getLineContent(),g=u===o?n-1:0,f=u===r?s-1:h.length;h===""?c+="<br>":c+=bxt(h,p.inflate(),t,g,f,l,ii)}return a._ttPolicy?.createHTML(c)??c}getDefaultColorMap(){let i=vc.getColorMap(),e=["#000000"];if(i)for(let t=1,o=i.length;t<o;t++)e[t]=Ue.Format.CSS.formatHex(i[t]);return e}},m2t=class{getDragImage(i,e,t){let o=this.getDragImageImpl(i,e,t);return o||(o=document.createElement("div"),o.textContent="1 cell"),o}getDragImageImpl(i,e,t){let o=i.container.cloneNode(!0);o.classList.forEach(s=>o.classList.remove(s)),o.classList.add("cell-drag-image","monaco-list-row","focused",`${t}-cell-row`);let n=o.querySelector(".cell-editor-container");if(!n)return null;let r=new KLi().getRichText(e,new G(1,1,1,1e3));return r?(Ii(n,r),o):null}};var oV=class extends em{constructor(e,t,o){super();this.base=e;this.notebookOptions=t;this.configurationService=o;this._lineNumbers="inherit";this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(e.onDidChange(()=>{this._recomputeOptions()})),this._value=this._computeEditorOptions()}set tabSize(e){this._tabSize!==e&&(this._tabSize=e,this._onDidChange.fire())}get tabSize(){return this._tabSize}set indentSize(e){this._indentSize!==e&&(this._indentSize=e,this._onDidChange.fire())}get indentSize(){return this._indentSize}set insertSpaces(e){this._insertSpaces!==e&&(this._insertSpaces=e,this._onDidChange.fire())}get insertSpaces(){return this._insertSpaces}updateState(e,t){t.cellLineNumberChanged&&this.setLineNumbers(e.lineNumbers)}_recomputeOptions(){this._value=this._computeEditorOptions(),this._onDidChange.fire()}_computeEditorOptions(){let e=this.base.value,t=this.notebookOptions.getDisplayOptions().editorOptionsCustomizations,o=t?.["editor.indentSize"];o!==void 0&&(this.indentSize=o);let n=t?.["editor.insertSpaces"];n!==void 0&&(this.insertSpaces=n);let r=t?.["editor.tabSize"];r!==void 0&&(this.tabSize=r);let s=e.lineNumbers;switch(this._lineNumbers){case"inherit":this.configurationService.getValue("notebook.lineNumbers")==="on"?e.lineNumbers==="off"&&(s="on"):s="off";break;case"on":e.lineNumbers==="off"&&(s="on");break;case"off":s="off";break}let l={};return e.lineNumbers!==s&&(l.lineNumbers=s),this.notebookOptions.getLayoutConfiguration().disableRulers&&(l.rulers=[]),{...e,...l}}getUpdatedValue(e,t){let o=this.getValue(e,t);return delete o.hover,o}getValue(e,t){return{...this._value,padding:this.notebookOptions.computeEditorPadding(e,t)}}getDefaultValue(){return{...this._value,padding:{top:12,bottom:12}}}setLineNumbers(e){this._lineNumbers=e,this._recomputeOptions()}};oe.as($t.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.lineNumbers":{type:"string",enum:["off","on"],default:"off",markdownDescription:d(13931,null)}}});W(class extends z{constructor(){super({id:"notebook.toggleLineNumbers",title:P(13933,"Toggle Notebook Line Numbers"),shortTitle:P(13934,"Line Numbers"),precondition:wr,menu:[{id:R.NotebookToolbar,group:"notebookLayout",order:2,when:C.equals("config.notebook.globalToolbar",!0)}],category:Ph,f1:!0,toggled:{condition:C.notEquals("config.notebook.lineNumbers","off"),title:d(13932,null)}})}async run(i){let e=i.get(B);e.getValue("notebook.lineNumbers")==="on"?e.updateValue("notebook.lineNumbers","off"):e.updateValue("notebook.lineNumbers","on")}});W(class extends kf{constructor(){super({id:"notebook.cell.toggleLineNumbers",title:d(13930,null),precondition:Tr.isEqualTo(_M),menu:[{id:R.NotebookCellTitle,group:"View",order:1}],toggled:C.or(knt.isEqualTo("on"),C.and(knt.isEqualTo("inherit"),C.equals("config.notebook.lineNumbers","on")))})}async runWithContext(i,e){if(e.ui)this.updateCell(i.get(B),e.cell);else{let t=i.get(B);e.selectedCells.forEach(o=>{this.updateCell(t,o)})}}updateCell(i,e){let t=i.getValue("notebook.lineNumbers")==="on",o=e.lineNumbers;o==="on"||o==="inherit"&&t?e.lineNumbers="off":e.lineNumbers="on"}});var Dan=200,oOe=class extends em{constructor(e,t,o){super();this._notebookEditor=e;this._executionOrderLabel=t;this._notebookExecutionStateService=o;this.kernelDisposables=this._register(new O);this._executionOrderLabel.classList.add("cell-execution-order"),this._executionOrderContent=D(this._executionOrderLabel,_("div")),this._register(this._notebookExecutionStateService.onDidChangeExecution(n=>{this.currentCell&&yo(n,{affectsCell:!0})&&n.affectsCell(this.currentCell.uri)&&this._updatePosition()})),this._register(this._notebookEditor.onDidChangeActiveKernel(()=>{this.currentCell&&(this.kernelDisposables.clear(),this._notebookEditor.activeKernel&&this.kernelDisposables.add(this._notebookEditor.activeKernel.onDidChange(()=>{this.currentCell&&this.updateExecutionOrder(this.currentCell.internalMetadata)})),this.updateExecutionOrder(this.currentCell.internalMetadata))})),this._register(this._notebookEditor.onDidScroll(()=>{this._updatePosition()}))}didRenderCell(e){this.updateExecutionOrder(e.internalMetadata,!0)}updateState(e,t){t.internalMetadataChanged&&this.updateExecutionOrder(e.internalMetadata)}updateExecutionOrder(e,t=!1){if(this._notebookEditor.activeKernel?.implementsExecutionOrder||!this._notebookEditor.activeKernel&&typeof e.executionOrder=="number"){if(typeof e.executionOrder!="number"&&!t&&this._notebookExecutionStateService.getCellExecution(this.currentCell.uri)){let n=this.currentCell;Zo(()=>{this.currentCell===n&&(this.updateExecutionOrder(this.currentCell.internalMetadata,!0),this._updatePosition())},Dan,this.cellDisposables);return}let o=typeof e.executionOrder=="number"?`[${e.executionOrder}]`:"[ ]";this._executionOrderContent.innerText=o,this._updatePosition()}else this._executionOrderContent.innerText=""}updateInternalLayoutNow(e){this._updatePosition()}_updatePosition(){if(!this.currentCell)return;if(this.currentCell.isInputCollapsed){Wi(this._executionOrderLabel);return}let e=!!this._notebookExecutionStateService.getCellExecution(this.currentCell.uri),t=this._executionOrderLabel.classList.contains("sticky");if(!e&&(this._executionOrderLabel.classList.remove("sticky"),t)){let n=this.currentCell.internalMetadata.executionOrder,r=typeof n=="number"?`[${n}]`:"[ ]";this._executionOrderContent.innerText=r}Xo(this._executionOrderLabel);let o=this.currentCell.layoutInfo.editorHeight-22+this.currentCell.layoutInfo.statusBarHeight;if(this.currentCell instanceof Ah){let r=this._notebookEditor.getAbsoluteTopOfElement(this.currentCell)+this.currentCell.layoutInfo.outputContainerOffset,s=this._notebookEditor.scrollBottom,l=22,c=this.currentCell.layoutInfo.statusBarHeight>0,u=r-s;if(o-=u,o=jn(o,l+12,this.currentCell.layoutInfo.editorHeight-l+this.currentCell.layoutInfo.statusBarHeight),s<=r&&e){if(!this._executionOrderContent.classList.contains("sticky-spinner")){this._executionOrderLabel.classList.add("sticky-spinner"),St(this._executionOrderContent);let h=q.modify(FC,"spin");D(this._executionOrderContent,...ir(`$(${h.id})`))}}else if(!c&&e){let p=this._executionOrderLabel.classList.contains("sticky");this._executionOrderLabel.classList.remove("sticky"),o=this.currentCell.layoutInfo.editorHeight-l;let h=this._executionOrderContent.querySelector(".codicon")!==null;if(p||h){let g=this.currentCell.internalMetadata.executionOrder,f=typeof g=="number"?`[${g}]`:"[ ]";this._executionOrderContent.innerText=f}}else{let p=this._executionOrderLabel.classList.contains("sticky");if(this._executionOrderLabel.classList.remove("sticky"),p){let h=this.currentCell.internalMetadata.executionOrder,g=typeof h=="number"?`[${h}]`:"[ ]";this._executionOrderContent.innerText=g}}}this._executionOrderLabel.style.top=`${o}px`}};oOe=I([m(2,Ns)],oOe);var Jnt=class extends em{constructor(i,e,t){super(),this._register($(i,ne.FOCUS,()=>{this.currentCell&&t.focusElement(this.currentCell)},!0)),e&&this._register($(e,ne.FOCUS,()=>{this.currentCell&&this.currentCell.outputsViewModels.length&&t.focusNotebookCell(this.currentCell,"output")}))}};var Znt=class extends em{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.titleToolbar=t;this.top=o;this.left=n;this.right=r;this.bottom=s;this.codeFocusIndicator=new Kv(D(this.left.domNode,_(".codeOutput-focus-indicator-container",void 0,_(".codeOutput-focus-indicator.code-focus-indicator")))),this.outputFocusIndicator=new Kv(D(this.left.domNode,_(".codeOutput-focus-indicator-container",void 0,_(".codeOutput-focus-indicator.output-focus-indicator")))),this._register($(this.codeFocusIndicator.domNode,ne.CLICK,()=>{this.currentCell&&(this.currentCell.isInputCollapsed=!this.currentCell.isInputCollapsed)})),this._register($(this.outputFocusIndicator.domNode,ne.CLICK,()=>{this.currentCell&&(this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed)})),this._register($(this.left.domNode,ne.DBLCLICK,l=>{if(!this.currentCell||!this.notebookEditor.hasModel()||l.target!==this.left.domNode)return;l.offsetY<this.currentCell.layoutInfo.outputContainerOffset?this.currentCell.isInputCollapsed=!this.currentCell.isInputCollapsed:this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed})),this._register(this.titleToolbar.onDidUpdateActions(()=>{this.updateFocusIndicatorsForTitleMenu()}))}updateInternalLayoutNow(e){if(e.cellKind===1){let t=this.notebookEditor.notebookOptions.computeIndicatorPosition(e.layoutInfo.totalHeight,e.layoutInfo.foldHintHeight,this.notebookEditor.textModel?.viewType);this.bottom.domNode.style.transform=`translateY(${t.bottomIndicatorTop+6}px)`,this.left.setHeight(t.verticalIndicatorHeight),this.right.setHeight(t.verticalIndicatorHeight),this.codeFocusIndicator.setHeight(t.verticalIndicatorHeight-this.getIndicatorTopMargin()*2-e.layoutInfo.chatHeight)}else{let t=e,o=this.notebookEditor.notebookOptions.getLayoutConfiguration(),n=this.notebookEditor.notebookOptions.computeBottomToolbarDimensions(this.notebookEditor.textModel?.viewType),r=t.layoutInfo.codeIndicatorHeight+t.layoutInfo.outputIndicatorHeight+t.layoutInfo.commentHeight;this.left.setHeight(r),this.right.setHeight(r),this.codeFocusIndicator.setHeight(t.layoutInfo.codeIndicatorHeight),this.outputFocusIndicator.setHeight(Math.max(t.layoutInfo.outputIndicatorHeight-t.viewContext.notebookOptions.getLayoutConfiguration().focusIndicatorGap,0)),this.bottom.domNode.style.transform=`translateY(${t.layoutInfo.totalHeight-n.bottomToolbarGap-o.cellBottomMargin}px)`}this.updateFocusIndicatorsForTitleMenu()}updateFocusIndicatorsForTitleMenu(){let e=(this.currentCell?.layoutInfo.chatHeight??0)+this.getIndicatorTopMargin();this.left.domNode.style.transform=`translateY(${e}px)`,this.right.domNode.style.transform=`translateY(${e}px)`}getIndicatorTopMargin(){let e=this.notebookEditor.notebookOptions.getLayoutConfiguration();return this.titleToolbar.hasActions?e.editorToolbarHeight+e.cellTopMargin:e.cellTopMargin}};var nOe=class extends em{constructor(e,t,o){super();this._notebookExecutionStateService=o;this._progressBar=this._register(new Cv(e,oC)),this._progressBar.hide(),this._collapsedProgressBar=this._register(new Cv(t,oC)),this._collapsedProgressBar.hide()}didRenderCell(e){this._updateForExecutionState(e)}updateForExecutionState(e,t){this._updateForExecutionState(e,t)}updateState(e,t){if((t.metadataChanged||t.internalMetadataChanged)&&this._updateForExecutionState(e),t.inputCollapsedChanged){let o=this._notebookExecutionStateService.getCellExecution(e.uri);e.isInputCollapsed?(this._progressBar.hide(),o?.state===3&&this._updateForExecutionState(e)):(this._collapsedProgressBar.hide(),o?.state===3&&this._updateForExecutionState(e))}}_updateForExecutionState(e,t){let o=t?.changed??this._notebookExecutionStateService.getCellExecution(e.uri),n=e.isInputCollapsed?this._collapsedProgressBar:this._progressBar;o?.state===3&&(!o.didPause||e.isInputCollapsed)?Ran(n):n.hide()}};nOe=I([m(2,Ns)],nOe);function Ran(a){a.infinite().show(500)}var rOe=_,cfe=class extends em{constructor(e,t,o,n,r,s,l,c){super();this._notebookEditor=e;this._cellContainer=t;this._editor=n;this._instantiationService=r;this._themeService=c;this.leftItems=[];this.rightItems=[];this.width=0;this._onDidClick=this._register(new T);this.onDidClick=this._onDidClick.event;this.statusBarContainer=D(o,rOe(".cell-statusbar-container")),this.statusBarContainer.tabIndex=-1;let u=D(this.statusBarContainer,rOe(".cell-status-left")),p=D(this.statusBarContainer,rOe(".cell-status-right"));this.leftItemsContainer=D(u,rOe(".cell-contributed-items.cell-contributed-items-left")),this.rightItemsContainer=D(p,rOe(".cell-contributed-items.cell-contributed-items-right")),this.itemsDisposable=this._register(new O),this.hoverDelegate=new class{constructor(){this._lastHoverHideTime=0;this.showHover=h=>(h.position=h.position??{},h.position.hoverPosition=3,s.showInstantHover(h));this.placement="element"}get delay(){return Date.now()-this._lastHoverHideTime<200?0:l.getValue("workbench.hover.delay")}onDidHideHover(){this._lastHoverHideTime=Date.now()}},this._register(this._themeService.onDidColorThemeChange(()=>this.currentContext&&this.updateContext(this.currentContext))),this._register($(this.statusBarContainer,ne.CLICK,h=>{if(h.target===u||h.target===p||h.target===this.statusBarContainer)this._onDidClick.fire({type:0,event:h});else{let g=h.target,f=!1;if(g&&go(g)){let v=g;(v.classList.contains("cell-status-item-has-command")||v.parentElement&&v.parentElement.classList.contains("cell-status-item-has-command"))&&(f=!0)}f?this._onDidClick.fire({type:2,event:h}):this._onDidClick.fire({type:1,event:h})}}))}didRenderCell(e){if(this._notebookEditor.hasModel()){let t={ui:!0,cell:e,notebookEditor:this._notebookEditor,$mid:13};this.updateContext(t)}if(this._editor){let t=()=>{if(this._editor&&(this._editor.hasWidgetFocus()||this.statusBarContainer.ownerDocument.activeElement&&this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement)))e.focusMode=1;else{let o=e.focusMode;o===3?e.focusMode=3:o===2&&this._notebookEditor.hasWebviewFocus()?e.focusMode=2:e.focusMode=0}};this.cellDisposables.add(this._editor.onDidFocusEditorWidget(()=>{t()})),this.cellDisposables.add(this._editor.onDidBlurEditorWidget(()=>{this._notebookEditor.hasEditorFocus()&&!(this.statusBarContainer.ownerDocument.activeElement&&this.statusBarContainer.contains(this.statusBarContainer.ownerDocument.activeElement))&&t()})),this.cellDisposables.add(this.onDidClick(o=>{if(this.currentCell instanceof Ah&&o.type!==2&&this._editor){let n=this._editor.getTargetAtClientPoint(o.event.clientX,o.event.clientY-this._notebookEditor.notebookOptions.computeEditorStatusbarHeight(this.currentCell.internalMetadata,this.currentCell.uri));n?.position&&(this._editor.setPosition(n.position),this._editor.focus())}}))}}updateInternalLayoutNow(e){this._cellContainer.classList.toggle("cell-statusbar-hidden",this._notebookEditor.notebookOptions.computeEditorStatusbarHeight(e.internalMetadata,e.uri)===0);let o=e.layoutInfo.editorWidth;if(!o)return;this.width=o,this.statusBarContainer.style.width=`${o}px`;let n=this.getMaxItemWidth();this.leftItems.forEach(r=>r.maxWidth=n),this.rightItems.forEach(r=>r.maxWidth=n)}getMaxItemWidth(){return this.width/2}updateContext(e){this.currentContext=e,this.itemsDisposable.clear(),this.currentContext&&(this.itemsDisposable.add(this.currentContext.cell.onDidChangeLayout(()=>{this.currentContext&&this.updateInternalLayoutNow(this.currentContext.cell)})),this.itemsDisposable.add(this.currentContext.cell.onDidChangeCellStatusBarItems(()=>this.updateRenderedItems())),this.itemsDisposable.add(this.currentContext.notebookEditor.onDidChangeActiveCell(()=>this.updateActiveCell())),this.updateInternalLayoutNow(this.currentContext.cell),this.updateActiveCell(),this.updateRenderedItems())}updateActiveCell(){let e=this.currentContext.notebookEditor.getActiveCell()===this.currentContext?.cell;this.statusBarContainer.classList.toggle("is-active-cell",e)}updateRenderedItems(){let e=this.currentContext.cell.getCellStatusBarItems();e.sort((s,l)=>(l.priority??0)-(s.priority??0));let t=this.getMaxItemWidth(),o=e.filter(s=>s.alignment===1),n=e.filter(s=>s.alignment===2).reverse(),r=(s,l,c)=>{if(s.length>l.length){let u=s.splice(l.length,s.length-l.length);for(let p of u)p.container.remove(),p.dispose()}l.forEach((u,p)=>{let h=s[p];if(h)h.updateItem(u,t);else{let g=this._instantiationService.createInstance(ert,this.currentContext,this.hoverDelegate,this._editor,u,t);s.push(g),c.appendChild(g.container)}})};r(this.leftItems,o,this.leftItemsContainer),r(this.rightItems,n,this.rightItemsContainer)}dispose(){super.dispose(),je(this.leftItems),je(this.rightItems)}};cfe=I([m(4,F),m(5,ot),m(6,B),m(7,Pe)],cfe);var ert=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._context=e;this._hoverDelegate=t;this._editor=o;this._telemetryService=s;this._commandService=l;this._notificationService=c;this._themeService=u;this._hoverService=p;this.container=rOe(".cell-status-item");this._itemDisposables=this._register(new O);this.updateItem(n,r)}set maxWidth(e){this.container.style.maxWidth=e+"px"}updateItem(e,t){this._itemDisposables.clear(),(!this._currentItem||this._currentItem.text!==e.text)&&(this._itemDisposables.add(new ak(this.container)).text=e.text.replace(/\n/g," "));let o=s=>cCe(s)?this._themeService.getColorTheme().getColor(s.id)?.toString()||"":s;this.container.style.color=e.color?o(e.color):"",this.container.style.backgroundColor=e.backgroundColor?o(e.backgroundColor):"",this.container.style.opacity=e.opacity?e.opacity:"",this.container.classList.toggle("cell-status-item-show-when-active",!!e.onlyShowWhenActive),typeof t=="number"&&(this.maxWidth=t);let n,r;if(e.accessibilityInformation?(n=e.accessibilityInformation.label,r=e.accessibilityInformation.role):n=e.text?Du(e.text).trim():"",this.container.setAttribute("aria-label",n),this.container.setAttribute("role",r||""),e.tooltip){let s=typeof e.tooltip=="string"?e.tooltip:{markdown:e.tooltip,markdownNotSupportedFallback:void 0};this._itemDisposables.add(this._hoverService.setupManagedHover(this._hoverDelegate,this.container,s))}this.container.classList.toggle("cell-status-item-has-command",!!e.command),e.command?(this.container.tabIndex=0,this._itemDisposables.add($(this.container,ne.CLICK,s=>{this.executeCommand()})),this._itemDisposables.add($(this.container,ne.KEY_DOWN,s=>{let l=new mi(s);(l.equals(10)||l.equals(3))&&this.executeCommand()}))):this.container.removeAttribute("tabIndex"),this._currentItem=e}async executeCommand(){let e=this._currentItem.command;if(!e)return;let t=typeof e=="string"?e:e.id,o=typeof e=="string"?[]:e.arguments??[];(typeof e=="string"||!e.arguments||!Array.isArray(e.arguments)||e.arguments.length===0)&&o.unshift(this._context),this._telemetryService.publicLog2("workbenchActionExecuted",{id:t,from:"cell status bar"});try{this._editor?.focus(),await this._commandService.executeCommand(t,...o)}catch(n){this._notificationService.error(Mn(n))}}};ert=I([m(5,_e),m(6,fe),m(7,Ne),m(8,Pe),m(9,ot)],ert);var CP=class extends Cl{updateLabel(){this.options.label&&this.label&&Ii(this.label,...ir(this._commandAction.label??""))}},sOe=class extends Cl{render(i){super.render(i),i.classList.add("notebook-action-view-item"),this._actionLabel=document.createElement("a"),i.appendChild(this._actionLabel),this.updateLabel()}updateLabel(){this._actionLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label)}},FQ=class extends FT{constructor(e,t,o,n,r,s,l,c,u){super(e,{...t,hoverDelegate:t?.hoverDelegate??yi("element")},s,l,c);this._renderLabel=o;this.subActionProvider=n;this.subActionViewItemProvider=r;this._hoverService=u}render(e){super.render(e),e.classList.add("notebook-action-view-item"),e.classList.add("notebook-action-view-item-unified"),this._actionLabel=document.createElement("a"),e.appendChild(this._actionLabel),this._hover=this._register(this._hoverService.setupManagedHover(this.options.hoverDelegate??yi("element"),this._actionLabel,"")),this.updateLabel();for(let t of[ne.CLICK,ne.MOUSE_DOWN,Vn.Tap])this._register($(e,t,o=>this.onClick(o,!0)))}onClick(e,t=!1){Kt.stop(e,!0);let o=mr(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._primaryAction??this._action,o)}updateLabel(){let e=this.subActionProvider.getActions();if(this._actionLabel){let t=e[0];if(this._primaryAction=t,t&&t instanceof Do){let o=this.element;if(o&&t.item.icon&&q.isThemeIcon(t.item.icon)){let n=q.asClassNameArray(t.item.icon);o.classList.forEach(r=>{r.startsWith("codicon-")&&o.classList.remove(r)}),o.classList.add(...n)}this._renderLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label,this._hover?.update(t.tooltip.length?t.tooltip:t.label))}else this._renderLabel&&(this._actionLabel.classList.add("notebook-label"),this._actionLabel.innerText=this._action.label,this._hover?.update(this._action.tooltip.length?this._action.tooltip:this._action.label))}}};FQ=I([m(5,Le),m(6,Xe),m(7,Pe),m(8,ot)],FQ);function h2t(a,i,e,t){let o=t?.extraOffset??0,n=t?.min??0,r=()=>{if(i.isInputCollapsed)e.style.top="";else{let l=a.scrollTop,c=a.getAbsoluteTopOfElement(i),u=l-c+o,p=i.layoutInfo.editorHeight+i.layoutInfo.statusBarHeight-45,h=p>20?jn(n,u,p):n;e.style.top=`${h}px`}};r();let s=[];return s.push(a.onDidScroll(()=>r()),a.onDidChangeLayout(()=>r())),Fn(...s)}var dfe=class extends Gnt{constructor(e,t,o,n,r,s,l){super();this._notebookEditor=e;this._bottomCellToolbarContainer=o;this.instantiationService=n;this.contextMenuService=r;this.contextKeyService=s;this.menuService=l}_initialize(){if(this._betweenCellToolbar)return this._betweenCellToolbar;let e=this._register(new Kp(this._bottomCellToolbarContainer,this.contextMenuService,{actionViewItemProvider:(n,r)=>{if(n instanceof Do)return this._notebookEditor.notebookOptions.getDisplayOptions().insertToolbarAlignment==="center"?this.instantiationService.createInstance(CP,n,{hoverDelegate:r.hoverDelegate}):this.instantiationService.createInstance(Cl,n,{hoverDelegate:r.hoverDelegate})}}));this._betweenCellToolbar=e;let t=this._register(this.menuService.createMenu(this._notebookEditor.creationOptions.menuIds.cellInsertToolbar,this.contextKeyService)),o=()=>{let n=trt(t);e.setActions(n.primary,n.secondary)};return this._register(t.onDidChange(()=>o())),this._register(this._notebookEditor.notebookOptions.onDidChangeOptions(n=>{n.insertToolbarAlignment&&o()})),o(),e}didRenderCell(e){let t=this._initialize();this._notebookEditor.hasModel()&&(t.context={ui:!0,cell:e,notebookEditor:this._notebookEditor,source:"insertToolbar",$mid:13}),this.updateInternalLayoutNow(e)}updateInternalLayoutNow(e){let t=e.layoutInfo.bottomToolbarOffset;this._bottomCellToolbarContainer.style.transform=`translateY(${t}px)`}};dfe=I([m(3,F),m(4,Xe),m(5,X),m(6,Yt)],dfe);var ufe=class extends Gnt{constructor(e,t,o,n,r,s,l,c){super();this.toolbarContainer=e;this._rootClassDelegate=t;this.toolbarId=o;this.deleteToolbarId=n;this._notebookEditor=r;this.contextKeyService=s;this.menuService=l;this.instantiationService=c;this._onDidUpdateActions=this._register(new T);this.onDidUpdateActions=this._onDidUpdateActions.event}get hasActions(){return this._model?this._model.actions.primary.length+this._model.actions.secondary.length+this._model.deleteActions.primary.length+this._model.deleteActions.secondary.length>0:!1}_initializeModel(){if(this._model)return this._model;let e=this._register(this.menuService.createMenu(this.toolbarId,this.contextKeyService)),t=this._register(this.menuService.createMenu(this.deleteToolbarId,this.contextKeyService)),o=trt(e),n=trt(t);return this._model={titleMenu:e,actions:o,deleteMenu:t,deleteActions:n},this._model}_initialize(e,t){if(this._view)return this._view;let o=this._register(Dg()),n=this._register(this.instantiationService.createInstance(dl,this.toolbarContainer,{actionViewItemProvider:(s,l)=>ta(this.instantiationService,s,l),renderDropdownAsChildElement:!0,hoverDelegate:o})),r=this._register(this.instantiationService.invokeFunction(s=>Lan(s,this.toolbarContainer,o,"cell-delete-toolbar")));return(e.deleteActions.primary.length!==0||e.deleteActions.secondary.length!==0)&&r.setActions(e.deleteActions.primary,e.deleteActions.secondary),this.setupChangeListeners(n,e.titleMenu,e.actions),this.setupChangeListeners(r,e.deleteMenu,e.deleteActions),this._view={toolbar:n,deleteToolbar:r},this._view}prepareRenderCell(e){this._initializeModel()}didRenderCell(e){let t=this._initializeModel(),o=this._initialize(t,e);if(this.cellDisposables.add(h2t(this._notebookEditor,e,this.toolbarContainer,{extraOffset:4,min:-14})),this._notebookEditor.hasModel()){let n={ui:!0,cell:e,notebookEditor:this._notebookEditor,source:"cellToolbar",$mid:13};this.updateContext(o,n)}}updateContext(e,t){e.toolbar.context=t,e.deleteToolbar.context=t}setupChangeListeners(e,t,o){let n=!1,r;this.updateActions(e,o),this._register(t.onDidChange(()=>{if(n){let l=trt(t);r=()=>this.updateActions(e,l);return}let s=trt(t);this.updateActions(e,s)})),this._rootClassDelegate.toggle("cell-toolbar-dropdown-active",!1),this._register(e.onDidChangeDropdownVisibility(s=>{n=s,this._rootClassDelegate.toggle("cell-toolbar-dropdown-active",s),r&&!s&&(Zo(()=>{r?.()},0,this._store),r=void 0)}))}updateActions(e,t){let o=Is(e.getElement());e.setActions(t.primary,t.secondary),o&&this._notebookEditor.focus(),t.primary.length||t.secondary.length?(this._rootClassDelegate.toggle("cell-has-toolbar-actions",!0),this._onDidUpdateActions.fire()):(this._rootClassDelegate.toggle("cell-has-toolbar-actions",!1),this._onDidUpdateActions.fire())}};ufe=I([m(5,X),m(6,Yt),m(7,F)],ufe);function trt(a){return xl(a.getActions({shouldForwardArgs:!0}),i=>/^inline/.test(i))}function Lan(a,i,e,t){let o=a.get(Xe),n=a.get(Le),r=a.get(F),s=new Kp(i,o,{getKeyBinding:l=>n.lookupKeybinding(l.id),actionViewItemProvider:(l,c)=>ta(r,l,c),renderDropdownAsChildElement:!0,hoverDelegate:e});return t&&s.getElement().classList.add(t),s}var irt=zf("collapsedCellPreview",{createHTML:a=>a});var GLi="notebook.cellOutput.copy";W(class extends z{constructor(){super({id:"notebook.cellOuput.showEmptyOutputs",title:d(13588,null),menu:{id:R.NotebookOutputToolbar,when:C.and(PE,EKt)},f1:!1,category:Ph})}run(i,e){let t=e.cell;if(t&&t.cellKind===2)for(let o=1;o<t.outputsViewModels.length;o++)t.outputsViewModels[o].visible.get()||(t.outputsViewModels[o].setVisible(!0,!0),t.updateOutputHeight(o,1,"command"))}});W(class extends z{constructor(){super({id:GLi,title:d(13584,null),menu:{id:R.NotebookOutputToolbar,when:PE},category:Ph,icon:_nt})}async run(i,e){let t=i.get(ie),o=i.get(Bi),n=i.get(re),r=g2t(t,e);if(!r)return;let s=f2t(e,r);if(!s)return;let l=s.pickedMimeType?.mimeType;if(l?.startsWith("image/")){let c={skipReveal:!0,outputId:s.model.outputId,altOutputId:s.model.alternativeOutputId};await r.focusNotebookCell(s.cellViewModel,"output",c),r.copyOutputImage(s)}else Ryo(l,s,o,n)}});function ort(a,i){let e=i.getViewModel();if(e){let t=e.viewCells.filter(o=>o.cellKind===2);for(let o of t){let n=o.outputsViewModels.find(r=>r.model.outputId===a||r.model.alternativeOutputId===a);if(n)return n}}}function g2t(a,i){return i&&"notebookEditor"in i?i.notebookEditor:lr(a.activeEditorPane)}function f2t(a,i){let e;if(a&&"outputId"in a&&typeof a.outputId=="string"?e=ort(a.outputId,i):a&&"outputViewModel"in a&&(e=a.outputViewModel),!e){let t=i.getActiveCell();if(!t)return;t.focusedOutputId!==void 0?e=t.outputsViewModels.find(o=>o.model.outputId===t.focusedOutputId):e=t.outputsViewModels.find(o=>o.pickedMimeType?.isTrusted)}return e}var Man="notebook.cellOutput.openInTextEditor";W(class extends z{constructor(){super({id:Man,title:d(13585,null),f1:!1,category:Ph,icon:_nt})}async run(i,e){let t=i.get(ie),o=i.get(Yh),n=i.get(Je),r=g2t(t,e);if(!r)return;let s=f2t(e,r);if(s?.model.outputId&&r.textModel?.uri){let l=await o.resolve(r.textModel.uri);await n.open(sn.generateCellOutputUriWithId(r.textModel.uri,s.model.outputId)),l.dispose()}}});var Pan="notebook.cellOutput.saveImage";W(class extends z{constructor(){super({id:Pan,title:d(13587,null),menu:{id:R.NotebookOutputToolbar,when:C.regex(MNe.key,/^image\//)},f1:!1,category:Ph,icon:kIo})}async run(i,e){let t=i.get(ie),o=i.get(nn),n=i.get(ge),r=i.get(re),s=g2t(t,e);if(!s)return;let l=f2t(e,s);if(!l)return;let c=l.pickedMimeType?.mimeType;if(!c?.startsWith("image/"))return;let u=l.model.outputs.find(b=>b.mime===c);if(!u){r.error("Could not find output item with mime type",c);return}let h={"image/png":"png","image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[c]||"png",g=`image.${h}`,f=s.textModel?.uri?A.joinPath(A.file(s.textModel.uri.fsPath),"..",g):void 0,v=await o.showSaveDialog({defaultUri:f,filters:[{name:d(13583,null),extensions:[h]}]});if(v)try{let b=u.data;await n.writeFile(v,b),r.info("Saved image output to",v.toString())}catch(b){r.error("Failed to save image output",b)}}});var Aan="notebook.cellOutput.openInOutputPreview";W(class extends z{constructor(){super({id:Aan,title:d(13586,null),menu:{id:R.NotebookOutputToolbar,when:C.and(PE,C.equals("config.notebook.output.openInPreviewEditor.enabled",!0))},f1:!1,category:Ph})}async run(i,e){let t=i.get(ie),o=i.get(Je),n=g2t(t,e);if(!n)return;let r=f2t(e,n);if(!r)return;let s=r.cellViewModel;if(!s)return;let l=n.getCellByHandle(s.handle);if(!l)return;let c=n.getCellIndex(l);if(c===void 0)return;let u=s.outputsViewModels.indexOf(r);if(u===-1||!n.textModel)return;let p=sn.generateOutputEditorUri(n.textModel.uri,l.id,c,r.model.outputId,u);o.open(p,{openToSide:!0})}});var WQ=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.notebookEditor=e;this.viewCell=t;this.cellOutputContainer=o;this.outputContainer=n;this.output=r;this.notebookService=s;this.quickInputService=l;this.menuService=u;this.extensionsWorkbenchService=p;this.instantiationService=h;this.toolbarDisposables=this._register(new O);this.toolbarAttached=!1;this._outputHeightTimer=null;this.contextKeyService=c,this._register(this.output.model.onDidChangeData(()=>{this.rerender()})),this._register(this.output.onDidResetRenderer(()=>{this.rerender()}))}detach(){this.renderedOutputContainer?.remove();let e=0;if(this.innerContainer){for(let t=0;t<this.innerContainer.childNodes.length&&(this.innerContainer.childNodes[t].className==="rendered-output"&&e++,!(e>1));t++);e===0&&this.innerContainer.remove()}this.notebookEditor.removeInset(this.output)}updateDOMTop(e){this.innerContainer&&(this.innerContainer.style.top=`${e}px`)}rerender(){if(this.notebookEditor.hasModel()&&this.innerContainer&&this.renderResult&&this.renderResult.type===1){let[e,t]=this.output.resolveMimeTypes(this.notebookEditor.textModel,this.notebookEditor.activeKernel?.preloadProvides),o=e[t];if(o.mimeType===this.renderResult.mimeType&&o.rendererId===this.renderResult.renderer.id){let n=this.viewCell.outputsViewModels.indexOf(this.output);this.notebookEditor.updateOutput(this.viewCell,this.renderResult,this.viewCell.getOutputOffset(n));return}}if(this.innerContainer){let e=this.innerContainer.nextElementSibling;this.toolbarDisposables.clear();let t=this.innerContainer;t&&(t.remove(),this.notebookEditor.removeInset(this.output)),this.render(e)}else{let e=this.cellOutputContainer.renderedOutputEntries.findIndex(o=>o.element===this),t=e>0&&this.cellOutputContainer.renderedOutputEntries[e-1].element.innerContainer?.parentElement?this.cellOutputContainer.renderedOutputEntries[e-1].element.innerContainer:void 0;this.render(t)}this._relayoutCell()}_generateInnerOutputContainer(e,t){return this.innerContainer=_(".output-inner-container"),e&&e.nextElementSibling?this.outputContainer.domNode.insertBefore(this.innerContainer,e.nextElementSibling):this.outputContainer.domNode.appendChild(this.innerContainer),this.innerContainer.setAttribute("output-mime-type",t.mimeType),this.innerContainer}render(e){let t=this.viewCell.outputsViewModels.indexOf(this.output);if(this.viewCell.isOutputCollapsed||!this.notebookEditor.hasModel()){this.cellOutputContainer.flagAsStale();return}if(!sn.parse(this.viewCell.uri)?.notebook)return;let n=this.notebookEditor.textModel,[r,s]=this.output.resolveMimeTypes(n,this.notebookEditor.activeKernel?.preloadProvides),l=r[s];if(!r.find(h=>h.isTrusted)||r.length===0){this.viewCell.updateOutputHeight(t,0,"CellOutputElement#noMimeType");return}let c=r[s],u=this.notebookService.getRendererInfo(c.rendererId);!u&&c.mimeType.indexOf("text/")>-1&&(u=this.notebookService.getRendererInfo("vscode.builtin-renderer"));let p=this._generateInnerOutputContainer(e,c);if(t===0||this.output.visible.get()?this._attachToolbar(p,n,this.notebookEditor.activeKernel,t,l,r):(this._register(ve(h=>{let g=h.readObservable(this.output.visible);g&&!this.toolbarAttached?this._attachToolbar(p,n,this.notebookEditor.activeKernel,t,l,r):g||this.toolbarDisposables.clear(),this.cellOutputContainer.checkForHiddenOutputs()})),this.cellOutputContainer.hasHiddenOutputs.set(!0,void 0)),this.renderedOutputContainer=D(p,_(".rendered-output")),this.renderResult=u?{type:1,renderer:u,source:this.output,mimeType:c.mimeType}:this._renderMissingRenderer(this.output,c.mimeType),this.output.pickedMimeType=c,!this.renderResult){this.viewCell.updateOutputHeight(t,0,"CellOutputElement#renderResultUndefined");return}return this.notebookEditor.createOutput(this.viewCell,this.renderResult,this.viewCell.getOutputOffset(t),!1),p.classList.add("background"),{initRenderIsSynchronous:!1}}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(13936,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(13938,null,n))}return this._renderSearchForMimetype(e,t)}_renderSearchForMimetype(e,t){let o=`@tag:notebookRenderer ${t}`,n=_("p",void 0,`No renderer could be found for mimetype "${t}", but one might be available on the Marketplace.`),r=_("a",{href:`command:workbench.extensions.search?%22${o}%22`,class:"monaco-button monaco-text-button",tabindex:0,role:"button",style:"padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"},"Search Marketplace");return{type:0,source:e,htmlContent:n.outerHTML+r.outerHTML}}_renderMessage(e,t){let o=_("p",void 0,t);return{type:0,source:e,htmlContent:o.outerHTML}}shouldEnableCopy(e){if(!e.find(t=>tOe.indexOf(t.mimeType)||t.mimeType.startsWith("image/")))return!1;if(FL(e[0].mimeType)){let t=this.output.cellViewModel,o=t.outputsViewModels.indexOf(this.output);if(o>0){let n=t.model.outputs[o-1];return!FL(n.outputs[0].mime)}}return!0}async _attachToolbar(e,t,o,n,r,s){let l=s.filter(w=>w.isTrusted).length>1,c=this.shouldEnableCopy(s);if(n>0&&!l&&!c||!this.notebookEditor.hasModel())return;e.style.position="relative";let u=_(".cell-output-toolbar");e.appendChild(u);let p=this.toolbarDisposables.add(this.instantiationService.createInstance(dl,u,{renderDropdownAsChildElement:!1}));p.context={ui:!0,cell:this.output.cellViewModel,outputViewModel:this.output,notebookEditor:this.notebookEditor,$mid:13};let h=this.toolbarDisposables.add(new it("notebook.output.pickMimetype",d(13939,null),q.asClassName(NKt),void 0,async w=>this._pickActiveMimeTypeRenderer(e,t,o,this.output))),g=this.toolbarDisposables.add(this.contextKeyService.createScoped(e)),f=EKt.bindTo(g),v=kKt.bindTo(g),b=MNe.bindTo(g);v.set(n===0),b.set(r.mimeType),this.toolbarDisposables.add(ve(w=>{f.set(this.cellOutputContainer.hasHiddenOutputs.read(w))}));let S=this.toolbarDisposables.add(this.menuService.createMenu(R.NotebookOutputToolbar,g)),y=()=>{let{secondary:w}=xl(S.getActions({shouldForwardArgs:!0}),()=>!1);c||(w=w.filter(x=>x.id!==GLi)),l&&(w=[h,...w]),p.setActions([],w)};y(),this.toolbarDisposables.add(S.onDidChange(y))}async _pickActiveMimeTypeRenderer(e,t,o,n){let[r,s]=n.resolveMimeTypes(t,o?.preloadProvides),l=[],c=[];r.forEach((S,y)=>{S.isTrusted&&(S.rendererId===T2?c:l).push({label:S.mimeType,id:S.mimeType,index:y,picked:y===s,detail:this._generateRendererInfo(S.rendererId),description:y===s?d(13935,null):void 0})}),c.some(S=>Nan.includes(S.id))&&c.push({label:d(13937,null),id:"installRenderers",index:r.length});let u=new O,p=u.add(this.quickInputService.createQuickPick({useSeparators:!0}));p.items=[...l,{type:"separator"},...c],p.activeItems=l.filter(S=>!!S.picked),p.placeholder=l.length!==r.length?d(13941,null):d(13940,null);let h=await new Promise(S=>{u.add(p.onDidAccept(()=>{S(p.selectedItems.length===1?p.selectedItems[0]:void 0),u.dispose()})),p.show()});if(h===void 0||h.index===s)return;if(h.id==="installRenderers"){this._showJupyterExtension();return}let g=e.nextElementSibling;this.toolbarDisposables.clear();let f=this.innerContainer;f&&(f.remove(),this.notebookEditor.removeInset(n)),n.pickedMimeType=r[h.index],this.viewCell.updateOutputMinHeight(this.viewCell.layoutInfo.outputTotalHeight);let{mimeType:v,rendererId:b}=r[h.index];this.notebookService.updateMimePreferredRenderer(t.viewType,v,b,r.map(S=>S.mimeType)),this.render(g),this._validateFinalOutputHeight(!1),this._relayoutCell()}async _showJupyterExtension(){await this.extensionsWorkbenchService.openSearch(`@id:${W_e}`)}_generateRendererInfo(e){let t=this.notebookService.getRendererInfo(e);return t?`${t.displayName!==""?t.displayName:t.id} (${t.extensionId.value})`:d(13942,null)}_validateFinalOutputHeight(e){this._outputHeightTimer!==null&&clearTimeout(this._outputHeightTimer),e?this.viewCell.unlockOutputHeight():this._outputHeightTimer=setTimeout(()=>{this.viewCell.unlockOutputHeight()},1e3)}_relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this._outputHeightTimer&&(this.viewCell.unlockOutputHeight(),clearTimeout(this._outputHeightTimer)),super.dispose()}};WQ=I([m(5,kn),m(6,$e),m(7,X),m(8,Yt),m(9,Ui),m(10,F)],WQ);var pfe=class{constructor(i,e){this.model=i;this.element=e}};var aOe=class extends em{constructor(e,t,o,n,r,s,l){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.options=n;this.openerService=r;this._notebookExecutionStateService=s;this.instantiationService=l;this._outputEntries=[];this._hasStaleOutputs=!1;this.hasHiddenOutputs=De("hasHiddenOutputs",!1);this._outputHeightTimer=null;this._register(t.onDidStartExecution(()=>{t.updateOutputMinHeight(t.layoutInfo.outputTotalHeight)})),this._register(t.onDidStopExecution(()=>{this._validateFinalOutputHeight(!1)})),this._register(t.onDidChangeOutputs(c=>{let p=this._notebookExecutionStateService.getCellExecution(t.uri)?1:2;this._updateOutputs(c,p)})),this._register(t.onDidChangeLayout(()=>{this.updateInternalLayoutNow(t)}))}checkForHiddenOutputs(){this._outputEntries.find(e=>!e.model.visible.get())?this.hasHiddenOutputs.set(!0,void 0):this.hasHiddenOutputs.set(!1,void 0)}get renderedOutputEntries(){return this._outputEntries}updateInternalLayoutNow(e){this.templateData.outputContainer.setTop(e.layoutInfo.outputContainerOffset),this.templateData.outputShowMoreContainer.setTop(e.layoutInfo.outputShowMoreContainerOffset),this._outputEntries.forEach(t=>{let o=this.viewCell.outputsViewModels.indexOf(t.model);if(o>=0){let n=this.viewCell.getOutputOffsetInContainer(o);t.element.updateDOMTop(n)}})}render(){try{this._doRender()}finally{this._relayoutCell()}}flagAsStale(){this._hasStaleOutputs=!0}_doRender(){if(this.viewCell.outputsViewModels.length>0){this.viewCell.layoutInfo.outputTotalHeight!==0&&this.viewCell.updateOutputMinHeight(this.viewCell.layoutInfo.outputTotalHeight),Xo(this.templateData.outputContainer.domNode);for(let e=0;e<Math.min(this.options.limit,this.viewCell.outputsViewModels.length);e++){let t=this.viewCell.outputsViewModels[e],o=this.instantiationService.createInstance(WQ,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,t);this._outputEntries.push(new pfe(t,o)),o.render(void 0)}this.viewCell.outputsViewModels.length>this.options.limit&&(Xo(this.templateData.outputShowMoreContainer.domNode),this.viewCell.updateOutputShowMoreContainerHeight(46)),this._validateFinalOutputHeight(!1)}else Wi(this.templateData.outputContainer.domNode);this.templateData.outputShowMoreContainer.domNode.innerText="",this.viewCell.outputsViewModels.length>this.options.limit?this.templateData.outputShowMoreContainer.domNode.appendChild(this._generateShowMoreElement(this.templateData.templateDisposables)):(Wi(this.templateData.outputShowMoreContainer.domNode),this.viewCell.updateOutputShowMoreContainerHeight(0))}viewUpdateShowOutputs(e){this._hasStaleOutputs&&(this._hasStaleOutputs=!1,this._outputEntries.forEach(t=>{t.element.rerender()}));for(let t=0;t<this._outputEntries.length;t++){let n=this._outputEntries[t].element;n.renderResult?this.notebookEditor.createOutput(this.viewCell,n.renderResult,this.viewCell.getOutputOffset(t),!1):n.render(void 0)}this._relayoutCell()}viewUpdateHideOuputs(){for(let e=0;e<this._outputEntries.length;e++)this.notebookEditor.hideInset(this._outputEntries[e].model)}_validateFinalOutputHeight(e){this._outputHeightTimer!==null&&clearTimeout(this._outputHeightTimer);let t=this._notebookExecutionStateService.getCellExecution(this.viewCell.uri);e?this.viewCell.unlockOutputHeight():t?.state!==3&&(this._outputHeightTimer=setTimeout(()=>{this.viewCell.unlockOutputHeight()},200))}_updateOutputs(e,t=2){let o=this.viewCell.layoutInfo.outputTotalHeight;this.viewCell.updateOutputMinHeight(o),this.viewCell.outputsViewModels.length?Xo(this.templateData.outputContainer.domNode):Wi(this.templateData.outputContainer.domNode),this.viewCell.spliceOutputHeights(e.start,e.deleteCount,e.newOutputs.map(n=>0)),this._renderNow(e,t)}_renderNow(e,t){if(e.start>=this.options.limit)return;let o=this._outputEntries.slice(0,e.start),n=this._outputEntries.slice(e.start,e.start+e.deleteCount),r=this._outputEntries.slice(e.start+e.deleteCount),s=this.viewCell.outputsViewModels.slice(e.start,e.start+e.newOutputs.length);if(o.length+s.length+r.length>this.options.limit)if(o.length+s.length>this.options.limit){[...n,...r].forEach(c=>{c.element.detach(),c.element.dispose()}),s=s.slice(0,this.options.limit-o.length);let l=s.map(c=>new pfe(c,this.instantiationService.createInstance(WQ,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,c)));this._outputEntries=[...o,...l];for(let c=o.length;c<this._outputEntries.length;c++)this._outputEntries[c].element.render(void 0)}else{let l=r.slice(this.options.limit-o.length-s.length);[...n,...l].forEach(p=>{p.element.detach(),p.element.dispose()});let c=o.length+s.length,u=s.map(p=>new pfe(p,this.instantiationService.createInstance(WQ,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,p)));this._outputEntries=[...o,...u,...r.slice(0,this.options.limit-o.length-s.length)];for(let p=o.length;p<c;p++){let h=p-1>=0&&this._outputEntries[p-1]&&this._outputEntries[p-1].element.innerContainer?.parentElement?this._outputEntries[p-1].element.innerContainer:void 0;this._outputEntries[p].element.render(h)}}else{n.forEach(p=>{p.element.detach(),p.element.dispose()});let l=o.length+s.length,c=s.map(p=>new pfe(p,this.instantiationService.createInstance(WQ,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,p))),u=[];if(o.length+c.length+r.length<this.viewCell.outputsViewModels.length){let p=Math.min(this.options.limit,this.viewCell.outputsViewModels.length);u=this.viewCell.outputsViewModels.slice(o.length+c.length+r.length,p).map(h=>new pfe(h,this.instantiationService.createInstance(WQ,this.notebookEditor,this.viewCell,this,this.templateData.outputContainer,h)))}this._outputEntries=[...o,...c,...r,...u];for(let p=o.length;p<l;p++){let h=p-1>=0&&this._outputEntries[p-1]&&this._outputEntries[p-1].element.innerContainer?.parentElement?this._outputEntries[p-1].element.innerContainer:void 0;this._outputEntries[p].element.render(h)}for(let p=0;p<u.length;p++)this._outputEntries[o.length+s.length+r.length+p].element.render(void 0)}this.viewCell.outputsViewModels.length>this.options.limit?(Xo(this.templateData.outputShowMoreContainer.domNode),this.templateData.outputShowMoreContainer.domNode.hasChildNodes()||this.templateData.outputShowMoreContainer.domNode.appendChild(this._generateShowMoreElement(this.templateData.templateDisposables)),this.viewCell.updateOutputShowMoreContainerHeight(46)):Wi(this.templateData.outputShowMoreContainer.domNode),this._relayoutCell(),this._validateFinalOutputHeight(t===2&&this.viewCell.outputsViewModels.length===0)}_generateShowMoreElement(e){let t={value:`There are more than ${this.options.limit} outputs, [show more (open the raw output data in a text editor) ...](command:workbench.action.openLargeOutput)`,isTrusted:!0,supportThemeIcons:!0},o=e.add(Lg(t,{actionHandler:n=>{n==="command:workbench.action.openLargeOutput"&&this.openerService.open(sn.generateCellOutputUriWithId(this.notebookEditor.textModel.uri))}}));return o.element.classList.add("output-show-more"),o.element}_relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this.viewCell.updateOutputMinHeight(0),this._outputHeightTimer&&clearTimeout(this._outputHeightTimer),this._outputEntries.forEach(e=>{e.element.dispose()}),super.dispose()}};aOe=I([m(4,Je),m(5,Ns),m(6,F)],aOe);var Nan=["application/geo+json","application/vdom.v1+json","application/vnd.dataresource+json","application/vnd.plotly.v1+json","application/vnd.vega.v2+json","application/vnd.vega.v3+json","application/vnd.vega.v4+json","application/vnd.vega.v5+json","application/vnd.vegalite.v1+json","application/vnd.vegalite.v2+json","application/vnd.vegalite.v3+json","application/vnd.vegalite.v4+json","application/x-nteract-model-debug+json","image/svg+xml","text/latex","text/vnd.plotly.v1+html","application/vnd.jupyter.widget-view+json","application/vnd.code.notebook.error"];var lOe=class extends k{constructor(e,t,o,n){super();this._cell=t;this._element=o;this._executionStateService=n;this._visible=!1;this._update(),this._register(this._executionStateService.onDidChangeExecution(r=>{r.type===0&&r.affectsCell(this._cell.uri)&&this._update()})),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update()))}setVisibility(e){this._visible=e,this._update()}_update(){if(!this._visible)return;let e=this._executionStateService.getCellExecution(this._cell.uri),t=this._getItemForState(e,this._cell.model.internalMetadata);t?(this._element.style.display="",Ii(this._element,...ir(t.text)),this._element.title=t.tooltip??""):(this._element.style.display="none",Ii(this._element))}_getItemForState(e,t){let o=e?.state,{lastRunSuccess:n}=t;if(!o&&n)return{text:`$(${LKt.id})`,tooltip:d(13948,null)};if(!o&&n===!1)return{text:`$(${WNe.id})`,tooltip:d(13946,null)};if(o===2||o===1)return{text:`$(${MKt.id})`,tooltip:d(13947,null)};if(o===3)return{text:`$(${q.modify(FC,"spin").id})`,tooltip:d(13945,null)}}};lOe=I([m(3,Ns)],lOe);var cOe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.editorPool=n;this.instantiationService=r;this.keybindingService=s;this.languageService=l;this.configurationService=c;this._isDisposed=!1;this._useNewApproachForEditorLayout=!0;this._pointerDownInEditor=!1;this._pointerDraggingInEditor=!1;let g=`[Cell ${this.notebookEditor.getCellIndex(this.viewCell)}]`,f=this._debug=S=>{p.debug("CellLayout",`${g} ${S}`)};this._cellEditorOptions=this._register(new oV(this.notebookEditor.getBaseCellEditorOptions(t.language),this.notebookEditor.notebookOptions,this.configurationService)),this._outputContainerRenderer=this.instantiationService.createInstance(aOe,e,t,o,{limit:ZNe}),this.cellParts=this._register(o.cellParts.concatContentPart([this._cellEditorOptions,this._outputContainerRenderer],Me(e.getDomNode())));let v={height:this.calculateInitEditorHeight(),width:this.viewCell.layoutInfo.editorWidth};this._cellLayout=new qLi(this._useNewApproachForEditorLayout,e,t,o,{debug:f},v),this.initializeEditor(v),this._renderedInputCollapseState=!1,this.registerNotebookEditorListeners(),this.registerViewCellLayoutChange(),this.registerCellEditorEventListeners(),this.registerMouseListener(),this._register(U.any(this.viewCell.onDidStartExecution,this.viewCell.onDidStopExecution)(S=>{this.cellParts.updateForExecutionState(this.viewCell,S)})),this._register(this.viewCell.onDidChangeState(S=>{if(this.cellParts.updateState(this.viewCell,S),S.outputIsHoveredChanged&&this.updateForOutputHover(),S.outputIsFocusedChanged&&this.updateForOutputFocus(),(S.metadataChanged||S.internalMetadataChanged)&&this.updateEditorOptions(),S.inputCollapsedChanged||S.outputCollapsedChanged){this.viewCell.pauseLayout();let y=this.updateForCollapseState();this.viewCell.resumeLayout(),y&&this.relayoutCell()}S.focusModeChanged&&this.updateEditorForFocusModeChange(!0)})),this.updateEditorOptions(),this.updateEditorForFocusModeChange(!1),this.updateForOutputHover(),this.updateForOutputFocus(),this.cellParts.scheduleRenderCell(this.viewCell),this._register(ee(()=>{this.cellParts.unrenderCell(this.viewCell)})),this.viewCell.editorHeight=v.height,this._outputContainerRenderer.render(),this._renderedOutputCollapseState=!1,this.initialViewUpdateExpanded(),this._register(this.viewCell.onLayoutInfoRead(()=>{this.cellParts.prepareLayout()}));let b=D(this.templateData.cellInputCollapsedContainer,_(".collapsed-execution-icon"));this._register(ee(()=>{b.remove()})),this._collapsedExecutionIcon=this._register(this.instantiationService.createInstance(lOe,this.notebookEditor,this.viewCell,b)),this.updateForCollapseState(),this._register(U.runAndSubscribe(t.onDidChangeOutputs,this.updateForOutputs.bind(this))),this._register(U.runAndSubscribe(t.onDidChangeLayout,this.updateForLayout.bind(this))),this._cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers),o.editor.updateOptions(this._cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri))}updateCodeCellOptions(e){e.editor.updateOptions(this._cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri));let t=new qe;this._register({dispose(){t.dispose(!0)}}),Ea(this.viewCell.resolveTextModel(),t.token).then(o=>{this._isDisposed||o&&o.updateOptions({indentSize:this._cellEditorOptions.indentSize,tabSize:this._cellEditorOptions.tabSize,insertSpaces:this._cellEditorOptions.insertSpaces})})}updateForLayout(){this._pendingLayout?.dispose(),this._pendingLayout=wY(Me(this.notebookEditor.getDomNode()),()=>{this.cellParts.updateInternalLayoutNow(this.viewCell)})}updateForOutputHover(){this.templateData.container.classList.toggle("cell-output-hover",this.viewCell.outputIsHovered)}updateForOutputFocus(){this.templateData.container.classList.toggle("cell-output-focus",this.viewCell.outputIsFocused)}calculateInitEditorHeight(){let e=this.viewCell.lineCount,t=this.viewCell.layoutInfo.fontInfo?.lineHeight||17,o=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri);return this.viewCell.layoutInfo.editorHeight===0?e*t+o.top+o.bottom:this.viewCell.layoutInfo.editorHeight}initializeEditor(e){this._debug(`Initialize Editor ${e.height} x ${e.width}, Scroll Top = ${this.notebookEditor.scrollTop}`),this._cellLayout.layoutEditor("init"),this.layoutEditor(e);let t=new qe;this._register({dispose(){t.dispose(!0)}}),Ea(this.viewCell.resolveTextModel(),t.token).then(o=>{if(!(this._isDisposed||o?.isDisposed())){if(o&&this.templateData.editor){if(this._reigsterModelListeners(o),this.templateData.editor.setModel(o),this._isDisposed)return;o.updateOptions({indentSize:this._cellEditorOptions.indentSize,tabSize:this._cellEditorOptions.tabSize,insertSpaces:this._cellEditorOptions.insertSpaces}),this.viewCell.attachTextEditor(this.templateData.editor,this.viewCell.layoutInfo.estimatedHasHorizontalScrolling);let n=()=>{this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)&&this.templateData.editor.focus()};if(n(),this.templateData.editor.getContentHeight()!==e.height&&this.onCellEditorHeightChange("onDidResolveTextModel"),this._isDisposed)return;n()}this._register(this._cellEditorOptions.onDidChange(()=>this.updateCodeCellOptions(this.templateData)))}})}updateForOutputs(){Md(this.viewCell.outputsViewModels.length>0,this.templateData.focusSinkElement)}updateEditorOptions(){let e=this.templateData.editor;if(!e)return;let t=this.notebookEditor.isReadOnly,o=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri),n=e.getOptions();(n.get(104)!==t||n.get(96)!==o)&&e.updateOptions({readOnly:this.notebookEditor.isReadOnly,padding:this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri)})}registerNotebookEditorListeners(){this._register(this.notebookEditor.onDidScroll(()=>{this.adjustEditorPosition(),this._cellLayout.layoutEditor("nbDidScroll")})),this._register(this.notebookEditor.onDidChangeLayout(()=>{this.adjustEditorPosition(),this.onCellWidthChange("nbLayoutChange")}))}adjustEditorPosition(){if(this._useNewApproachForEditorLayout)return;let e=-7,t=0,o=this.notebookEditor.scrollTop,n=this.notebookEditor.getAbsoluteTopOfElement(this.viewCell),r=o-n+e,s=this.notebookEditor.getLayoutInfo(),l=s.height-s.stickyHeight-26,c=this.viewCell.layoutInfo.editorHeight-l,u=c>20?jn(t,r,c):t;this.templateData.editorPart.style.top=`${u}px`,this.templateData.editor.setScrollTop(u)}registerViewCellLayoutChange(){this._register(this.viewCell.onDidChangeLayout(e=>{e.outerWidth!==void 0&&this.templateData.editor.getLayoutInfo().width!==this.viewCell.layoutInfo.editorWidth&&(this.onCellWidthChange("viewCellLayoutChange"),this.adjustEditorPosition())}))}registerCellEditorEventListeners(){this._register(this.templateData.editor.onDidContentSizeChange(e=>{e.contentHeightChanged&&this.viewCell.layoutInfo.editorHeight!==e.contentHeight&&(this.onCellEditorHeightChange("onDidContentSizeChange"),this.adjustEditorPosition())})),this._useNewApproachForEditorLayout&&this._register(this.templateData.editor.onDidScrollChange(e=>{if(this._pointerDownInEditor||this._pointerDraggingInEditor||this._cellLayout.editorVisibility==="Invisible"||!this.templateData.editor.hasTextFocus()||this._cellLayout._lastChangedEditorScrolltop===e.scrollTop||this._cellLayout.isUpdatingLayout)return;let t=this.notebookEditor.scrollTop,o=e.scrollTop-(this._cellLayout._lastChangedEditorScrolltop??0);if(this._cellLayout.editorVisibility==="Full (Small Viewport)"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number")this._debug(`Scroll Change (1) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setEditorScrollTop: ${e.scrollTop})`);else if(this._cellLayout.editorVisibility==="Bottom Clipped"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number")this._debug(`Scroll Change (2) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setNotebookScrollTop: ${t+e.scrollTop})`),this.notebookEditor.setScrollTop(t+e.scrollTop);else if(this._cellLayout.editorVisibility==="Top Clipped"&&typeof this._cellLayout._lastChangedEditorScrolltop=="number"){let n=t+o-1;this._debug(`Scroll Change (3) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t}, setNotebookScrollTop?: ${n})`),t!==n&&this.notebookEditor.setScrollTop(n)}else this._debug(`Scroll Change (4) = ${e.scrollTop} changed by ${o} (notebook scrollTop: ${t})`),this._cellLayout._lastChangedEditorScrolltop=void 0})),this._register(this.templateData.editor.onDidChangeCursorSelection(e=>{if(e.source==="restoreState"||e.oldModelVersionId===0||!this.templateData.editor.hasTextFocus()||(this._pointerDownInEditor||this._pointerDraggingInEditor)&&this._useNewApproachForEditorLayout)return;let t=this.templateData.editor.getSelections();if(t?.length){let o=this.templateData.editor.getContentHeight(),n=this.viewCell.layoutInfo.editorHeight;if(o!==n&&(this._useNewApproachForEditorLayout||(this._debug("onDidChangeCursorSelection"),this.onCellEditorHeightChange("onDidChangeCursorSelection")),this._isDisposed))return;let r=t[t.length-1];this.notebookEditor.revealRangeInViewAsync(this.viewCell,r)}})),this._register(this.templateData.editor.onDidBlurEditorWidget(()=>{Rm.get(this.templateData.editor)?.hideLightBulbWidget()}))}_reigsterModelListeners(e){this._register(e.onDidChangeTokens(()=>{if(this.viewCell.isInputCollapsed&&this._inputCollapseElement){let t=this._getRichTextFromLineTokens(e);this._inputCollapseElement.innerHTML=irt?.createHTML(t)??t,this._attachInputExpandButton(this._inputCollapseElement)}}))}registerMouseListener(){let e=()=>{this._pointerDownInEditor=!1,this._pointerDraggingInEditor=!1,this._cellLayout.setPointerDown(!1)};if(this._register(this.templateData.editor.onMouseDown(t=>{t.event.rightButton&&t.event.preventDefault(),this._useNewApproachForEditorLayout&&t.event.leftButton&&(this._pointerDownInEditor=!0,this._pointerDraggingInEditor=!1,this._cellLayout.setPointerDown(!1))})),this._useNewApproachForEditorLayout&&this._register(this.templateData.editor.onMouseMove(t=>{if(this._pointerDownInEditor){if(!t.event.leftButton){e();return}this._pointerDraggingInEditor||(this._pointerDraggingInEditor=!0,this._cellLayout.setPointerDown(!0))}})),this._useNewApproachForEditorLayout){let t=Me(this.notebookEditor.getDomNode());this._register($(t,"mouseup",e)),this._register($(t,"pointerup",e)),this._register($(t,"pointercancel",e)),this._register($(t,"blur",e)),this._register($(t,"keydown",o=>{o.key==="Escape"&&(this._pointerDownInEditor||this._pointerDraggingInEditor)&&e()}))}}shouldPreserveEditor(){return this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)}updateEditorForFocusModeChange(e){this.shouldPreserveEditor()&&(e?this.templateData.editor.focus():this._register(Cg(Me(this.templateData.container),()=>{this.templateData.editor.focus()}))),this.templateData.container.classList.toggle("cell-editor-focus",this.viewCell.focusMode===1),this.templateData.container.classList.toggle("cell-output-focus",this.viewCell.focusMode===2)}updateForCollapseState(){return this.viewCell.isOutputCollapsed===this._renderedOutputCollapseState&&this.viewCell.isInputCollapsed===this._renderedInputCollapseState?!1:(this.viewCell.layoutChange({editorHeight:!0}),this.viewCell.isInputCollapsed?this._collapseInput():this._showInput(),this.viewCell.isOutputCollapsed?this._collapseOutput():this._showOutput(!1),this.relayoutCell(),this._renderedOutputCollapseState=this.viewCell.isOutputCollapsed,this._renderedInputCollapseState=this.viewCell.isInputCollapsed,!0)}_collapseInput(){Wi(this.templateData.editorPart),this.templateData.container.classList.toggle("input-collapsed",!0),this._removeInputCollapsePreview(),this._collapsedExecutionIcon.setVisibility(!0);let e=this.templateData.editor.hasModel()?this._getRichTextFromLineTokens(this.templateData.editor.getModel()):this._getRichText(this.viewCell.textBuffer,this.viewCell.language),t=_("div.cell-collapse-preview");t.innerHTML=irt?.createHTML(e)??e,this._inputCollapseElement=t,this.templateData.cellInputCollapsedContainer.appendChild(t),this._attachInputExpandButton(t),Xo(this.templateData.cellInputCollapsedContainer)}_attachInputExpandButton(e){let t=_("span.expandInputIcon"),o=this.keybindingService.lookupKeybinding(F_e);o&&(e.title=d(13944,null,o.getLabel()),t.title=d(13943,null,o.getLabel())),t.classList.add(...q.asClassNameArray(L.more)),e.appendChild(t)}_showInput(){this._collapsedExecutionIcon.setVisibility(!1),Xo(this.templateData.editorPart),Wi(this.templateData.cellInputCollapsedContainer)}_getRichText(e,t){return vxt(this.languageService,e.getLineContent(1),t)}_getRichTextFromLineTokens(e){let t='<div class="monaco-tokenized-source">',n=e.tokenization.getLineTokens(1).inflate(),r=e.getLineContent(1),s=0;for(let l=0,c=n.getCount();l<c;l++){let u=n.getClassName(l),p=n.getEndOffset(l);t+=`<span class="${u}">${Cr(r.substring(s,p))}</span>`,s=p}return t+="</div>",t}_removeInputCollapsePreview(){let e=this.templateData.cellInputCollapsedContainer.children,t=[];for(let o=0;o<e.length;o++)e[o].classList.contains("cell-collapse-preview")&&t.push(e[o]);t.forEach(o=>{o.remove()})}_updateOutputInnerContainer(e){let t=this.templateData.outputContainer.domNode.children;for(let o=0;o<t.length;o++)t[o].classList.contains("output-inner-container")&&Md(!e,t[o])}_collapseOutput(){this.templateData.container.classList.toggle("output-collapsed",!0),Xo(this.templateData.cellOutputCollapsedContainer),this._updateOutputInnerContainer(!0),this._outputContainerRenderer.viewUpdateHideOuputs()}_showOutput(e){this.templateData.container.classList.toggle("output-collapsed",!1),Wi(this.templateData.cellOutputCollapsedContainer),this._updateOutputInnerContainer(!1),this._outputContainerRenderer.viewUpdateShowOutputs(e)}initialViewUpdateExpanded(){this.templateData.container.classList.toggle("input-collapsed",!1),Xo(this.templateData.editorPart),Wi(this.templateData.cellInputCollapsedContainer),this.templateData.container.classList.toggle("output-collapsed",!1),this._showOutput(!0)}layoutEditor(e){if(this._useNewApproachForEditorLayout)return;let t=this.notebookEditor.getLayoutInfo(),o=Math.min(t.height-t.stickyHeight-26,e.height);this._debug(`Layout Editor: Width = ${e.width}, Height = ${o} (Requested: ${e.height}, Editor Layout Height: ${t.height}, Sticky: ${t.stickyHeight})`),this.templateData.editor.layout({width:e.width,height:o},!0)}onCellWidthChange(e){this._debug(`Cell Editor Width Change, ${e}, Content Height = ${this.templateData.editor.getContentHeight()}`);let t=this.templateData.editor.getContentHeight();this.templateData.editor.hasModel()?(this._debug(`**** Updating Cell Editor Height (1), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height} ****`),this.viewCell.editorHeight=t,this.relayoutCell(),this.layoutEditor({width:this.viewCell.layoutInfo.editorWidth,height:t})):this._debug(`Cell Editor Width Change without model, return (1), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height}`),this._cellLayout.layoutEditor(e)}onCellEditorHeightChange(e){let t=this.templateData.editor.getContentHeight();this.templateData.editor.hasModel()||this._debug(`Cell Editor Height Change without model, return (2), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo()}`),this._debug(`Cell Editor Height Change (${e}): ${t}`),this._debug(`**** Updating Cell Editor Height (2), ContentHeight: ${t}, CodeCellLayoutInfo.EditorWidth ${this.viewCell.layoutInfo.editorWidth}, EditorLayoutInfo ${this.templateData.editor.getLayoutInfo().height} ****`);let o=this.templateData.editor.getLayoutInfo();this.viewCell.editorHeight=t,this.relayoutCell(),this.layoutEditor({width:o.width,height:t}),this._cellLayout.layoutEditor(e)}relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight)}dispose(){this._isDisposed=!0,this.shouldPreserveEditor()&&this.editorPool.preserveFocusedEditor(this.viewCell),this.viewCell.detachTextEditor(),this._removeInputCollapsePreview(),this._outputContainerRenderer.dispose(),this._pendingLayout?.dispose(),super.dispose()}};cOe=I([m(4,F),m(5,Le),m(6,Rt),m(7,B),m(8,Ns),m(9,Sb)],cOe);var qLi=class{constructor(i,e,t,o,n,r){this._enabled=i;this.notebookEditor=e;this.viewCell=t;this.templateData=o;this._logService=n;this._initialEditorDimension=r;this._initialized=!1;this._pointerDown=!1}get editorVisibility(){return this._editorVisibility}get isUpdatingLayout(){return this._isUpdatingLayout}setPointerDown(i){this._pointerDown=i}layoutEditor(i){if(!this._enabled)return;let e=this.templateData.editorPart;if(this.viewCell.isInputCollapsed){e.style.top="";return}let t=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight,o=this.viewCell.layoutInfo.topMargin,n=this.viewCell.layoutInfo.outlineWidth,r=this.viewCell.layoutInfo.statusBarHeight,s=this.templateData.editor,l=this.templateData.editor.getLayoutInfo(),c=this._initialized&&(i==="nbLayoutChange"||i==="viewCellLayoutChange")?this.viewCell.layoutInfo.editorWidth:l.width,u=this.viewCell.layoutInfo.editorHeight,p=this.notebookEditor.scrollTop,h=this.notebookEditor.getAbsoluteTopOfElement(this.viewCell),g=this.notebookEditor.getAbsoluteBottomOfElement(this.viewCell),f=this.notebookEditor.getHeightOfElement(this.viewCell),v;if(!this._initialized&&i==="init")v=this._initialEditorDimension.height,this._establishedContentHeight=v;else{let K=s.getContentHeight(),j=K===-1?Math.max(s.getLayoutInfo().height,this._initialEditorDimension.height):K;!this._initialized||i==="onDidContentSizeChange"||i==="viewCellLayoutChange"||i==="nbLayoutChange"?(v=j,this._establishedContentHeight=v):v=this._establishedContentHeight??j}let S=h+this.viewCell.layoutInfo.outputContainerOffset,y=this.notebookEditor.scrollBottom,w=y-p===0?this.notebookEditor.getLayoutInfo().height:y-p,x=this.viewCell.layoutInfo.outputContainerOffset,E=typeof this._previousScrollBottom=="number"&&y<this._previousScrollBottom?"up":"down";this._previousScrollBottom=y;let M=Math.max(0,p-h-o-n),N=u-M;N<t&&(M=M-(t-N)-n);let V=v,H=0;if(p<=h+o){let K=t+this.notebookEditor.notebookOptions.getLayoutConfiguration().editorTopPadding;y>=S?(V=jn(v,K,v),this._editorVisibility="Full"):(V=jn(y-(h+o)-r,K,v)+2*n,this._editorVisibility="Bottom Clipped",H=0)}else if(w<=v&&y<=S){let K=t+this.notebookEditor.notebookOptions.getLayoutConfiguration().editorTopPadding;V=jn(w-r,K,v-r)+2*n,this._editorVisibility="Full (Small Viewport)",H=M}else{let K=t;V=jn(v-(p-(h+o)),K,v),p>S?this._editorVisibility="Invisible":this._editorVisibility="Top Clipped",H=v-V}this._logService.debug(`${i} (${this._editorVisibility}, ${this._initialized})`),this._logService.debug(`=> Editor Top = ${M}px (editHeight = ${u}, editContentHeight: ${v})`),this._logService.debug(`=> eleTop = ${h}, eleBottom = ${g}, eleHeight = ${f}`),this._logService.debug(`=> scrollTop = ${p}, top = ${M}`),this._logService.debug(`=> cellTopMargin = ${o}, cellBottomMargin = ${this.viewCell.layoutInfo.topMargin}, cellOutline = ${n}`),this._logService.debug(`=> scrollBottom: ${y}, editBottom: ${S}, viewport: ${w}, scroll: ${E}, contOffset: ${x})`),this._logService.debug(`=> Editor Height = ${V}px, Width: ${c}px, Initial Width: ${this._initialEditorDimension.width}, EditorScrollTop = ${H}px, StatusbarHeight = ${r}, lineHeight = ${this.notebookEditor.getLayoutInfo().fontInfo.lineHeight}`);try{this._isUpdatingLayout=!0,e.style.top=`${M}px`,s.layout({width:this._initialized?c:this._initialEditorDimension.width,height:V},!0),!this._pointerDown&&H>=0&&(this._lastChangedEditorScrolltop=H,s.setScrollTop(H))}finally{this._initialized=!0,this._isUpdatingLayout=!1,this._logService.debug("Updated Editor Layout")}}};var BC=class extends Ja{constructor(e,t,o,n,r,s,l,c,u,p,h){super(null,e,{hoverDelegate:r?.hoverDelegate});this._options=r;this._contextMenuProvider=s;this._container=null;this._dropdownContainer=null;this._primaryAction=new Cl(e,{hoverDelegate:r?.hoverDelegate},l,c,u,p,s,h),r?.actionRunner&&(this._primaryAction.actionRunner=r.actionRunner),this._dropdown=new rh(t,o,this._contextMenuProvider,{menuAsChild:r?.menuAsChild??!0,classNames:n?["codicon","codicon-chevron-down",n]:["codicon","codicon-chevron-down"],actionRunner:this._options?.actionRunner,keybindingProvider:this._options?.getKeyBinding??(g=>l.lookupKeybinding(g.id)),hoverDelegate:r?.hoverDelegate,skipTelemetry:r?.skipTelemetry})}get onDidChangeDropdownVisibility(){return this._dropdown.onDidChangeVisibility}set actionRunner(e){super.actionRunner=e,this._primaryAction.actionRunner=e,this._dropdown.actionRunner=e}get actionRunner(){return super.actionRunner}setActionContext(e){super.setActionContext(e),this._primaryAction.setActionContext(e),this._dropdown.setActionContext(e)}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-primary");let t=_(".action-container");t.role="button",t.ariaDisabled=String(!this.action.enabled),this._primaryAction.render(D(this._container,t)),this._dropdownContainer=_(".dropdown-action-container"),this._dropdown.render(D(this._container,this._dropdownContainer)),this._register($(t,ne.KEY_DOWN,o=>{if(!this.action.enabled)return;let n=new mi(o);n.equals(17)&&(this._primaryAction.element.tabIndex=-1,this._dropdown.focus(),n.stopPropagation())})),this._register($(this._dropdownContainer,ne.KEY_DOWN,o=>{if(!this.action.enabled)return;let n=new mi(o);n.equals(15)&&(this._primaryAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._primaryAction.element?.focus(),n.stopPropagation())})),this.updateEnabled()}focus(e){e?this._dropdown.focus():(this._primaryAction.element.tabIndex=0,this._primaryAction.element.focus())}blur(){this._primaryAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._primaryAction.element.tabIndex=0:(this._primaryAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}updateEnabled(){let e=!this.action.enabled;this.element?.classList.toggle("disabled",e)}update(e,t,o){this._dropdown.dispose(),this._dropdown=new rh(e,t,this._contextMenuProvider,{menuAsChild:this._options?.menuAsChild??!0,classNames:["codicon",o||"codicon-chevron-down"],actionRunner:this._options?.actionRunner,hoverDelegate:this._options?.hoverDelegate,keybindingProvider:this._options?.getKeyBinding}),this._dropdownContainer&&this._dropdown.render(this._dropdownContainer)}showDropdown(){this._dropdown.show()}dispose(){this._primaryAction.dispose(),this._dropdown.dispose(),super.dispose()}};BC=I([m(5,Xe),m(6,Le),m(7,Ne),m(8,X),m(9,Pe),m(10,Ai)],BC);var dOe=class extends em{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.contextKeyService=t;this.cellContainer=o;this.runButtonContainer=n;this.keybindingService=c;this.contextMenuService=u;this.instantiationService=p;this.primaryMenu=this._register(l.createMenu(r,t)),this.secondaryMenu=this._register(l.createMenu(s,t)),this.createRunCellToolbar(n,o,t);let h=()=>{let f=this.getCellToolbarActions(this.primaryMenu).primary[0];this.toolbar.setActions(f?[f]:[])};h(),this._register(this.primaryMenu.onDidChange(h)),this._register(this.secondaryMenu.onDidChange(h)),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(h))}didRenderCell(e){if(this.cellDisposables.add(h2t(this.notebookEditor,e,this.runButtonContainer)),this.notebookEditor.hasModel()){let t={ui:!0,cell:e,notebookEditor:this.notebookEditor,$mid:13};this.toolbar.context=t}}getCellToolbarActions(e){return xl(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}createRunCellToolbar(e,t,o){let n=this._register(new O),r=this._register(new it("notebook.moreRunActions",d(13949,null),"codicon-chevron-down",!0)),s=c=>this.keybindingService.lookupKeybinding(c.id,l),l=this._register(Oan(o));this.toolbar=this._register(new Kp(e,this.contextMenuService,{getKeyBinding:s,actionViewItemProvider:(c,u)=>{n.clear();let p=this.getCellToolbarActions(this.primaryMenu).primary[0];if(!(p instanceof Do))return;let h=this.getCellToolbarActions(this.secondaryMenu).secondary;if(!h.length)return;let g=this.instantiationService.createInstance(BC,p,r,h,"notebook-cell-run-toolbar",{...u,getKeyBinding:s});return n.add(g.onDidChangeDropdownVisibility(f=>{t.classList.toggle("cell-run-toolbar-dropdown-active",f)})),g},renderDropdownAsChildElement:!0}))}};dOe=I([m(6,Yt),m(7,Le),m(8,Xe),m(9,F)],dOe);function Oan(a){let i=a.createScoped(document.createElement("div"));return Wg.bindTo(i).set(!0),me.editorTextFocus.bindTo(i).set(!0),me.focus.bindTo(i).set(!0),me.textInputFocus.bindTo(i).set(!0),Bge.bindTo(i).set("idle"),Ap.bindTo(i).set(!0),wr.bindTo(i).set(!0),lI.bindTo(i).set("code"),i}var nrt=class extends em{constructor(e,t){super();this.notebookEditor=e;this._register($(t,ne.DBLCLICK,o=>{!this.currentCell||!this.notebookEditor.hasModel()||(this.currentCell.isInputCollapsed?this.currentCell.isInputCollapsed=!1:this.currentCell.isOutputCollapsed=!1)})),this._register($(t,ne.CLICK,o=>{if(!this.currentCell||!this.notebookEditor.hasModel())return;let n=o.target;n&&n.classList&&n.classList.contains("expandInputIcon")&&(this.currentCell.isInputCollapsed=!1)}))}};var Pyo=_,uOe=class extends em{constructor(e,t,o){super();this.notebookEditor=e;let n=D(t,Pyo("span.expandOutputPlaceholder"));n.textContent=d(13952,null);let r=D(t,Pyo("span.expandOutputIcon"));r.classList.add(...q.asClassNameArray(L.more));let s=o.lookupKeybinding(NMt);s&&(n.title=d(13951,null,s.getLabel()),t.title=d(13950,null,s.getLabel())),Wi(t),this._register($(r,ne.CLICK,()=>this.expand())),this._register($(t,ne.DBLCLICK,()=>this.expand()))}expand(){!this.currentCell||!this.currentCell||this.notebookEditor.textModel.cells.indexOf(this.currentCell.model)<0||(this.currentCell.isOutputCollapsed=!this.currentCell.isOutputCollapsed)}};uOe=I([m(2,Le)],uOe);var Fan={limit:5e3,update:()=>{}},v2t=class{constructor(){this._viewModel=null;this._viewModelStore=new O;this._onDidFoldingRegionChanges=new T;this.onDidFoldingRegionChanged=this._onDidFoldingRegionChanges.event;this._foldingRangeDecorationIds=[];this._regions=new $y(new Uint32Array(0),new Uint32Array(0))}get regions(){return this._regions}dispose(){this._onDidFoldingRegionChanges.dispose(),this._viewModelStore.dispose()}detachViewModel(){this._viewModelStore.clear(),this._viewModel=null}attachViewModel(i){this._viewModel=i,this._viewModelStore.add(this._viewModel.onDidChangeViewCells(()=>{this.recompute()})),this._viewModelStore.add(this._viewModel.onDidChangeSelection(()=>{if(!this._viewModel)return;let e=yv(this._viewModel.getSelections()),t=!1;e.forEach(o=>{let n=this.regions.findRange(o+1);for(;n!==-1;)this._regions.isCollapsed(n)&&o>this._regions.getStartLineNumber(n)-1&&(this._regions.setCollapsed(n,!1),t=!0),n=this._regions.getParentIndex(n)}),t&&this._onDidFoldingRegionChanges.fire()})),this.recompute()}getRegionAtLine(i){if(this._regions){let e=this._regions.findRange(i);if(e>=0)return this._regions.toRegion(e)}return null}getRegionsInside(i,e){let t=[],o=i?i.regionIndex+1:0,n=i?i.endLineNumber:Number.MAX_VALUE;if(e&&e.length===2){let r=[];for(let s=o,l=this._regions.length;s<l;s++){let c=this._regions.toRegion(s);if(this._regions.getStartLineNumber(s)<n){for(;r.length>0&&!c.containedBy(r[r.length-1]);)r.pop();r.push(c),e(c,r.length)&&t.push(c)}else break}}else for(let r=o,s=this._regions.length;r<s;r++){let l=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<n)(!e||e(l))&&t.push(l);else break}return t}getAllRegionsAtLine(i,e){let t=[];if(this._regions){let o=this._regions.findRange(i),n=1;for(;o>=0;){let r=this._regions.toRegion(o);(!e||e(r,n))&&t.push(r),n++,o=r.parentIndex}}return t}setCollapsed(i,e){this._regions.setCollapsed(i,e)}recompute(){if(!this._viewModel)return;let i=this._viewModel,e=i.viewCells,t=[];for(let p=0;p<e.length;p++){let h=e[p];if(h.cellKind!==1||h.language!=="markdown")continue;let g=Math.min(7,...Array.from($Li(h.getText()),f=>f.depth));g<7&&t.push({index:p,level:g,endIndex:0})}let o=t.map((p,h)=>{let g;for(let v=h+1;v<t.length;++v)if(t[v].level<=p.level){g=t[v].index-1;break}let f=g!==void 0?g:e.length-1;return{start:p.index+1,end:f+1,rank:1}}).filter(p=>p.start!==p.end),n=qmi(o,Fan),r=0,s=()=>{for(;r<this._regions.length;){let p=this._regions.isCollapsed(r);if(r++,p)return r-1}return-1},l=0,c=s();for(;c!==-1&&l<n.length;){let p=i.getTrackedRange(this._foldingRangeDecorationIds[c]);if(p){let h=p.start;for(;l<n.length;){let g=n.getStartLineNumber(l)-1;if(h>=g)n.setCollapsed(l,h===g),l++;else break}}c=s()}for(;l<n.length;)n.setCollapsed(l,!1),l++;let u=[];for(let p=0;p<n.length;p++){let h=n.toRegion(p);u.push({start:h.startLineNumber-1,end:h.endLineNumber-1})}this._foldingRangeDecorationIds.forEach(p=>i.setTrackedRange(p,null,3)),this._foldingRangeDecorationIds=u.map(p=>i.setTrackedRange(null,p,3)).filter(p=>p!==null),this._regions=n,this._onDidFoldingRegionChanges.fire()}getMemento(){let i=[],e=0;for(;e<this._regions.length;){if(this._regions.isCollapsed(e)){let o=this._regions.toRegion(e);i.push({start:o.startLineNumber-1,end:o.endLineNumber-1})}e++}return i}applyMemento(i){if(!this._viewModel)return!1;let e=0,t=0;for(;t<i.length&&e<this._regions.length;){if(this._viewModel.getTrackedRange(this._foldingRangeDecorationIds[e])){let n=i[t].start;for(;e<this._regions.length;){let r=this._regions.getStartLineNumber(e)-1;if(n>=r)this._regions.setCollapsed(e,n===r),e++;else break}}t++}for(;e<this._regions.length;)this._regions.setCollapsed(e,!1),e++;return!0}};function*$Li(a){for(let i of zl.lexer(a,{gfm:!0}))i.type==="heading"&&(yield{depth:i.depth,text:ma({value:i.raw}).trim()})}var xP=class extends k{constructor(e){super();this._notebookEditor=e;this._foldingModel=null;this._localStore=this._register(new O);this._register(this._notebookEditor.onMouseUp(t=>{this.onMouseUp(t)})),this._register(this._notebookEditor.onDidChangeModel(()=>{this._localStore.clear(),this._notebookEditor.hasModel()&&(this._localStore.add(this._notebookEditor.onDidChangeCellState(t=>{t.source.editStateChanged&&t.cell.cellKind===1&&this._foldingModel?.recompute()})),this._foldingModel=new v2t,this._localStore.add(this._foldingModel),this._foldingModel.attachViewModel(this._notebookEditor.getViewModel()),this._localStore.add(this._foldingModel.onDidFoldingRegionChanged(()=>{this._updateEditorFoldingRanges()})))}))}static{this.id="workbench.notebook.foldingController"}saveViewState(){return this._foldingModel?.getMemento()||[]}restoreViewState(e){this._foldingModel?.applyMemento(e||[]),this._updateEditorFoldingRanges()}setFoldingStateDown(e,t,o){let n=t===2,r=this._foldingModel.getRegionAtLine(e+1),s=[];if(r&&(r.isCollapsed!==n&&s.push(r),o>1)){let l=this._foldingModel.getRegionsInside(r,(c,u)=>c.isCollapsed!==n&&u<o);s.push(...l)}s.forEach(l=>this._foldingModel.setCollapsed(l.regionIndex,t===2)),this._updateEditorFoldingRanges()}setFoldingStateUp(e,t,o){if(!this._foldingModel)return;this._foldingModel.getAllRegionsAtLine(e+1,(r,s)=>r.isCollapsed!==(t===2)&&s<=o).forEach(r=>this._foldingModel.setCollapsed(r.regionIndex,t===2)),this._updateEditorFoldingRanges()}_updateEditorFoldingRanges(){if(!this._foldingModel||!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getViewModel();e.updateFoldingRanges(this._foldingModel.regions);let t=e.getHiddenRanges();this._notebookEditor.setHiddenAreas(t)}onMouseUp(e){if(!e.event.target||!this._notebookEditor.hasModel())return;let t=this._notebookEditor.getViewModel(),o=e.event.target;if(o.classList.contains("codicon-notebook-collapsed")||o.classList.contains("codicon-notebook-expanded")){if(!o.parentElement.classList.contains("notebook-folding-indicator"))return;let r=e.target,s=t.getCellIndex(r),l=t.getFoldingState(s);if(l===0)return;this.setFoldingStateUp(s,l===2?1:2,1),this._notebookEditor.focusElement(r)}}recompute(){this._foldingModel?.recompute()}};Hm(xP.id,xP);var Wan=d(13646,null),Ayo=P(13648,"Unfold Cell"),Nyo={args:[{isOptional:!0,name:"index",description:"The cell index",schema:{type:"object",required:["index","direction"],properties:{index:{type:"number"},direction:{type:"string",enum:["up","down"],default:"down"},levels:{type:"number",default:1}}}}]};W(class extends z{constructor(){super({id:"notebook.fold",title:P(13647,"Fold Cell"),category:Ph,keybinding:{when:C.and(wr,C.not(Dp)),primary:3164,mac:{primary:2652,secondary:[15]},secondary:[15],weight:200},metadata:{description:Wan,args:Nyo.args},precondition:nl,f1:!0})}async run(a,i){let e=a.get(ie),t=lr(e.activeEditorPane);if(!t||!t.hasModel())return;let o=i&&i.levels||1,n=i&&i.direction==="up"?"up":"down",r;if(i)r=i.index;else{let l=t.getActiveCell();if(!l)return;r=t.getCellIndex(l)}let s=t.getContribution(xP.id);if(r!==void 0){if((r<0||r>=t.getLength()?void 0:t.cellAt(r))?.cellKind===2&&n==="down")return;n==="up"?s.setFoldingStateUp(r,2,o):s.setFoldingStateDown(r,2,o);let c=t.getViewModel().getNearestVisibleCellIndexUpwards(r);t.focusElement(t.cellAt(c))}}});W(class extends z{constructor(){super({id:"notebook.unfold",title:Ayo,category:Ph,keybinding:{when:C.and(wr,C.not(Dp)),primary:3166,mac:{primary:2654,secondary:[17]},secondary:[17],weight:200},metadata:{description:Ayo,args:Nyo.args},precondition:nl,f1:!0})}async run(a,i){let e=a.get(ie),t=lr(e.activeEditorPane);if(!t)return;let o=i&&i.levels||1,n=i&&i.direction==="up"?"up":"down",r;if(i)r=i.index;else{let l=t.getActiveCell();if(!l)return;r=t.getCellIndex(l)}let s=t.getContribution(xP.id);r!==void 0&&(n==="up"?s.setFoldingStateUp(r,1,o):s.setFoldingStateDown(r,1,o))}});var pOe=class extends em{constructor(e,t,o){super();this._notebookEditor=e;this._container=t;this._notebookExecutionStateService=o;this._runButtonListener=this._register(new ue);this._cellExecutionListener=this._register(new ue)}didRenderCell(e){this.update(e)}update(e){if(!this._notebookEditor.hasModel()){this._cellExecutionListener.clear(),this._runButtonListener.clear();return}if(e.isInputCollapsed||e.getEditState()===1)this._cellExecutionListener.clear(),this._runButtonListener.clear(),Wi(this._container);else if(e.foldingState===2){let t=this._notebookEditor.getViewModel().getCellIndex(e),o=this._notebookEditor.getViewModel().getFoldedLength(t),n=this.getRunFoldedSectionButton({start:t,end:t+o+1});n?Ii(this._container,n,this.getHiddenCellsLabel(o),this.getHiddenCellHintButton(e)):Ii(this._container,this.getHiddenCellsLabel(o),this.getHiddenCellHintButton(e)),Xo(this._container);let r=e.layoutInfo.previewHeight;this._container.style.top=`${r}px`}else this._cellExecutionListener.clear(),this._runButtonListener.clear(),Wi(this._container)}getHiddenCellsLabel(e){let t=e===1?d(13953,null):d(13954,null,e);return _("span.notebook-folded-hint-label",void 0,t)}getHiddenCellHintButton(e){let t=_("span.cell-expand-part-button");return t.classList.add(...q.asClassNameArray(L.more)),this._register($(t,ne.CLICK,()=>{let o=this._notebookEditor.getContribution(xP.id),n=this._notebookEditor.getCellIndex(e);typeof n=="number"&&o.setFoldingStateDown(n,1,1)})),t}getRunFoldedSectionButton(e){let t=_("span.folded-cell-run-section-button"),o=this._notebookEditor.getCellsInRange(e);if(!o.some(l=>l.cellKind===2))return;let s=o.some(l=>{let c=this._notebookExecutionStateService.getCellExecution(l.uri);return c&&c.state===3})?q.modify(FC,"spin"):L.play;return t.classList.add(...q.asClassNameArray(s)),this._runButtonListener.value=$(t,ne.CLICK,()=>{this._notebookEditor.executeNotebookCells(o)}),this._cellExecutionListener.value=this._notebookExecutionStateService.onDidChangeExecution(()=>{let c=o.some(u=>{let p=this._notebookExecutionStateService.getCellExecution(u.uri);return p&&p.state===3})?q.modify(FC,"spin"):L.play;t.className="",t.classList.add("folded-cell-run-section-button",...q.asClassNameArray(c))}),t}updateInternalLayoutNow(e){this.update(e)}};pOe=I([m(2,Ns)],pOe);var mOe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.viewCell=t;this.templateData=o;this.renderedEditors=n;this.accessibilityService=r;this.contextKeyService=s;this.instantiationService=l;this.languageService=c;this.configurationService=u;this.keybindingService=p;this.editor=null;this.localDisposables=this._register(new O);this.focusSwitchDisposable=this._register(new ue);this.editorDisposables=this._register(new O);this._isDisposed=!1;this.constructDOM(),this.editorPart=o.editorPart,this.cellEditorOptions=this._register(new oV(this.notebookEditor.getBaseCellEditorOptions(t.language),this.notebookEditor.notebookOptions,this.configurationService)),this.cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers),this.editorOptions=this.cellEditorOptions.getValue(this.viewCell.internalMetadata,this.viewCell.uri),this._register(ee(()=>n.delete(this.viewCell))),this.registerListeners(),this.templateData.cellParts.scheduleRenderCell(this.viewCell),this._register(ee(()=>{this.templateData.cellParts.unrenderCell(this.viewCell)})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>{this.viewUpdate()})),this.updateForHover(),this.updateForFocusModeChange(),this.foldingState=t.foldingState,this.layoutFoldingIndicator(),this.updateFoldingIconShowClass(),this.viewCell.layoutInfo.totalHeight>0&&this.relayoutCell(),this.viewUpdate(),this.layoutCellParts(),this._register(this.viewCell.onDidChangeLayout(()=>{this.layoutCellParts()}))}layoutCellParts(){this.templateData.cellParts.updateInternalLayoutNow(this.viewCell)}constructDOM(){let e=`aria-markup-cell-${this.viewCell.id}`;this.markdownAccessibilityContainer=this.templateData.cellContainer,this.markdownAccessibilityContainer.id=e,this.markdownAccessibilityContainer.style.height="1px",this.markdownAccessibilityContainer.style.overflow="hidden",this.markdownAccessibilityContainer.style.position="absolute",this.markdownAccessibilityContainer.style.top="100000px",this.markdownAccessibilityContainer.style.left="10000px",this.markdownAccessibilityContainer.ariaHidden="false",this.templateData.rootContainer.setAttribute("aria-describedby",e),this.templateData.container.classList.toggle("webview-backed-markdown-cell",!0)}registerListeners(){this._register(this.viewCell.onDidChangeState(e=>{this.templateData.cellParts.updateState(this.viewCell,e)})),this._register(this.viewCell.model.onDidChangeMetadata(()=>{this.viewUpdate()})),this._register(this.viewCell.onDidChangeState(e=>{if((e.editStateChanged||e.contentChanged)&&this.viewUpdate(),e.focusModeChanged&&this.updateForFocusModeChange(),e.foldingStateChanged){let t=this.viewCell.foldingState;t!==this.foldingState&&(this.foldingState=t,this.layoutFoldingIndicator())}e.cellIsHoveredChanged&&this.updateForHover(),e.inputCollapsedChanged&&(this.updateCollapsedState(),this.viewUpdate()),e.cellLineNumberChanged&&this.cellEditorOptions.setLineNumbers(this.viewCell.lineNumbers)})),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(e=>{e.showFoldingControls&&this.updateFoldingIconShowClass()})),this._register(this.viewCell.onDidChangeLayout(e=>{let t=this.editor?.getLayoutInfo();e.outerWidth&&this.viewCell.getEditState()===1&&t&&t.width!==this.viewCell.layoutInfo.editorWidth&&this.onCellEditorWidthChange()})),this._register(this.cellEditorOptions.onDidChange(()=>this.updateMarkupCellOptions()))}updateMarkupCellOptions(){if(this.updateEditorOptions(this.cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri)),this.editor){this.editor.updateOptions(this.cellEditorOptions.getUpdatedValue(this.viewCell.internalMetadata,this.viewCell.uri));let e=new qe;this._register({dispose(){e.dispose(!0)}}),Ea(this.viewCell.resolveTextModel(),e.token).then(t=>{this._isDisposed||t&&t.updateOptions({indentSize:this.cellEditorOptions.indentSize,tabSize:this.cellEditorOptions.tabSize,insertSpaces:this.cellEditorOptions.insertSpaces})})}}updateCollapsedState(){this.viewCell.isInputCollapsed?this.notebookEditor.hideMarkupPreviews([this.viewCell]):this.notebookEditor.unhideMarkupPreviews([this.viewCell])}updateForHover(){this.templateData.container.classList.toggle("markdown-cell-hover",this.viewCell.cellIsHovered)}updateForFocusModeChange(){this.viewCell.focusMode===1&&this.focusEditorIfNeeded(),this.templateData.container.classList.toggle("cell-editor-focus",this.viewCell.focusMode===1)}dispose(){this._isDisposed=!0,this.notebookEditor.getActiveCell()===this.viewCell&&this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)&&this.notebookEditor.focusContainer(),this.viewCell.detachTextEditor(),super.dispose()}updateFoldingIconShowClass(){let e=this.notebookEditor.notebookOptions.getDisplayOptions().showFoldingControls;this.templateData.foldingIndicator.classList.remove("mouseover","always"),this.templateData.foldingIndicator.classList.add(e)}viewUpdate(){this.viewCell.isInputCollapsed?this.viewUpdateCollapsed():this.viewCell.getEditState()===1?this.viewUpdateEditing():this.viewUpdatePreview()}viewUpdateCollapsed(){Xo(this.templateData.cellInputCollapsedContainer),Wi(this.editorPart),this.templateData.cellInputCollapsedContainer.innerText="",D(this.templateData.cellInputCollapsedContainer,_("span")).classList.add(...q.asClassNameArray(L.markdown));let t=_("div");t.classList.add("cell-collapse-preview");let o=this.getRichText(this.viewCell.textBuffer,this.viewCell.language);t.innerText=o,t.innerHTML=irt?.createHTML(o)??o,this.templateData.cellInputCollapsedContainer.appendChild(t);let n=D(t,_("span.expandInputIcon"));n.classList.add(...q.asClassNameArray(L.more));let r=this.keybindingService.lookupKeybinding(F_e);r&&(t.title=d(13956,null,r.getLabel()),n.title=d(13955,null,r.getLabel())),this.markdownAccessibilityContainer.ariaHidden="true",this.templateData.container.classList.toggle("input-collapsed",!0),this.viewCell.renderedMarkdownHeight=0,this.viewCell.layoutChange({})}getRichText(e,t){return vxt(this.languageService,e.getLineContent(1),t)}viewUpdateEditing(){let e;if(Xo(this.editorPart),this.markdownAccessibilityContainer.ariaHidden="true",Wi(this.templateData.cellInputCollapsedContainer),this.notebookEditor.hideMarkupPreviews([this.viewCell]),this.templateData.container.classList.toggle("input-collapsed",!1),this.templateData.container.classList.toggle("markdown-cell-edit-mode",!0),this.editor&&this.editor.hasModel())e=this.editor.getContentHeight(),this.viewCell.attachTextEditor(this.editor),this.focusEditorIfNeeded(),this.bindEditorListeners(this.editor),this.editor.layout({width:this.viewCell.layoutInfo.editorWidth,height:e});else{this.editorDisposables.clear();let t=this.notebookEditor.notebookOptions.computeMarkdownCellEditorWidth(this.notebookEditor.getLayoutInfo().width),o=this.viewCell.lineCount,n=this.viewCell.layoutInfo.fontInfo?.lineHeight||17,r=this.notebookEditor.notebookOptions.computeEditorPadding(this.viewCell.internalMetadata,this.viewCell.uri);e=Math.max(o,1)*n+r.top+r.bottom,this.templateData.editorContainer.innerText="";let s=this.contextKeyService.createScoped(this.templateData.editorPart);me.inCompositeEditor.bindTo(s).set(!0);let l=this.editorDisposables.add(this.instantiationService.createChild(new Po([X,s])));this.editorDisposables.add(s),this.editor=this.editorDisposables.add(l.createInstance(us,this.templateData.editorContainer,{...this.editorOptions,dimension:{width:t,height:e},allowVariableLineHeights:!1},{contributions:this.notebookEditor.creationOptions.cellEditorContributions})),this.templateData.currentEditor=this.editor,this.editorDisposables.add(this.editor.onDidBlurEditorWidget(()=>{this.editor&&US.get(this.editor)?.stopHighlighting()})),this.editorDisposables.add(this.editor.onDidFocusEditorWidget(()=>{this.editor&&US.get(this.editor)?.restoreViewState(!0)}));let c=new qe;this.editorDisposables.add({dispose(){c.dispose(!0)}}),Ea(this.viewCell.resolveTextModel(),c.token).then(u=>{if(!u)return;this.editor.setModel(u),u.updateOptions({indentSize:this.cellEditorOptions.indentSize,tabSize:this.cellEditorOptions.tabSize,insertSpaces:this.cellEditorOptions.insertSpaces});let p=this.editor.getContentHeight();p!==e&&(this.editor.layout({width:t,height:p}),e=p),this.viewCell.attachTextEditor(this.editor),this.viewCell.getEditState()===1&&this.focusEditorIfNeeded(),this.bindEditorListeners(this.editor),this.viewCell.editorHeight=e})}this.viewCell.editorHeight=e,this.focusEditorIfNeeded(),this.renderedEditors.set(this.viewCell,this.editor)}viewUpdatePreview(){this.viewCell.detachTextEditor(),Wi(this.editorPart),Wi(this.templateData.cellInputCollapsedContainer),this.markdownAccessibilityContainer.ariaHidden="false",this.templateData.container.classList.toggle("input-collapsed",!1),this.templateData.container.classList.toggle("markdown-cell-edit-mode",!1),this.renderedEditors.delete(this.viewCell),this.markdownAccessibilityContainer.innerText="",this.viewCell.renderedHtml&&(this.accessibilityService.isScreenReaderOptimized()?AA(this.markdownAccessibilityContainer,this.viewCell.renderedHtml):St(this.markdownAccessibilityContainer)),this.notebookEditor.createMarkupPreview(this.viewCell)}focusEditorIfNeeded(){if(this.viewCell.focusMode===1&&(this.notebookEditor.hasEditorFocus()||this.notebookEditor.getDomNode().ownerDocument.activeElement===this.notebookEditor.getDomNode().ownerDocument.body)){if(!this.editor)return;this.editor.focus();let e=this.editor.getSelection();if(!e)return;this.notebookEditor.revealRangeInViewAsync(this.viewCell,e)}}layoutEditor(e){this.editor?.layout(e)}onCellEditorWidthChange(){let e=this.editor.getContentHeight();this.layoutEditor({width:this.viewCell.layoutInfo.editorWidth,height:e})}relayoutCell(){this.notebookEditor.layoutNotebookCell(this.viewCell,this.viewCell.layoutInfo.totalHeight),this.layoutFoldingIndicator()}updateEditorOptions(e){this.editorOptions=e,this.editor?.updateOptions(this.editorOptions)}layoutFoldingIndicator(){switch(this.foldingState){case 0:this.templateData.foldingIndicator.style.display="none",this.templateData.foldingIndicator.innerText="";break;case 2:this.templateData.foldingIndicator.style.display="",Ii(this.templateData.foldingIndicator,un(PKt));break;case 1:this.templateData.foldingIndicator.style.display="",Ii(this.templateData.foldingIndicator,un(AKt));break;default:break}}bindEditorListeners(e){this.localDisposables.clear(),this.focusSwitchDisposable.clear(),this.localDisposables.add(e.onDidContentSizeChange(o=>{o.contentHeightChanged&&this.onCellEditorHeightChange(e,o.contentHeight)})),this.localDisposables.add(e.onDidChangeCursorSelection(o=>{if(o.source==="restoreState")return;let n=e.getSelections();if(n?.length){let r=e.getContentHeight(),s=this.viewCell.layoutInfo.editorHeight;r!==s&&this.onCellEditorHeightChange(e,r);let l=n[n.length-1];this.notebookEditor.revealRangeInViewAsync(this.viewCell,l)}}));let t=()=>this.viewCell.focusMode=e.hasWidgetFocus()?1:0;this.localDisposables.add(e.onDidFocusEditorWidget(()=>{t()})),this.localDisposables.add(e.onDidBlurEditorWidget(()=>{this.templateData.container.ownerDocument.activeElement?.contains(this.templateData.container)?this.focusSwitchDisposable.value=Zo(()=>t(),300):t()})),t()}onCellEditorHeightChange(e,t){let o=e.getLayoutInfo();this.viewCell.editorHeight=t,e.layout({width:o.width,height:t})}};mOe=I([m(4,Ai),m(5,X),m(6,F),m(7,Rt),m(8,B),m(9,Le)],mOe);var Nh=_,hOe=class extends k{constructor(e,t){super();this.configurationService=t;let o=this.configurationService.getValue("editor");this.lineHeight=RI(o,Gu.getInstance(e).value).lineHeight}getHeight(e){return e.getHeight(this.lineHeight)}getDynamicHeight(e){return e.getDynamicHeight()}getTemplateId(e){return e.cellKind===1?VQ.TEMPLATE_ID:BQ.TEMPLATE_ID}};hOe=I([m(1,B)],hOe);var b2t=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.instantiationService=e;this.notebookEditor=t;this.contextMenuService=o;this.menuService=n;this.keybindingService=s;this.notificationService=l;this.contextKeyServiceProvider=c;this.dndController=p;this.editorOptions=this._register(new oV(this.notebookEditor.getBaseCellEditorOptions(u),this.notebookEditor.notebookOptions,r))}dispose(){super.dispose(),this.dndController=void 0}},VQ=class extends b2t{constructor(e,t,o,n,r,s,l,c,u,p,h){super(s,e,l,c,r,u,p,n,"markdown",t);this.renderedEditors=o;this._notebookExecutionStateService=h}static{this.TEMPLATE_ID="markdown_cell"}get templateId(){return VQ.TEMPLATE_ID}renderTemplate(e){e.classList.add("markdown-cell-row");let t=D(e,_(".cell-inner-container")),o=new O,n=o.add(this.contextKeyServiceProvider(t)),r=D(e,Nh(".cell-decoration")),s=D(t,Nh(".cell-title-toolbar")),l=new Kv(D(t,Nh(".cell-focus-indicator.cell-focus-indicator-top"))),c=new Kv(D(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left"))),u=D(c.domNode,_(".notebook-folding-indicator")),p=new Kv(D(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-right"))),h=D(t,Nh(".cell.code")),g=D(h,Nh(".cell-editor-part")),f=D(g,Nh(".cell-chat-part")),v=D(h,Nh(".input-collapse-container"));v.style.display="none";let b=D(g,Nh(".cell-editor-container"));g.style.display="none";let S=D(t,Nh(".cell-comment-container")),y=D(t,Nh(".cell.markdown")),w=D(t,Nh(".cell-bottom-toolbar-container")),x=o.add(this.instantiationService.createChild(new Po([X,n]))),E={toggle:(K,j)=>t.classList.toggle(K,j)},M=o.add(x.createInstance(ufe,s,E,this.notebookEditor.creationOptions.menuIds.cellTitleToolbar,this.notebookEditor.creationOptions.menuIds.cellDeleteToolbar,this.notebookEditor)),N=new Kv(D(t,Nh(".cell-focus-indicator.cell-focus-indicator-bottom"))),V=new qnt(Me(e),[o.add(x.createInstance(Ynt,this.notebookEditor,f)),o.add(x.createInstance(cfe,this.notebookEditor,t,g,void 0)),o.add(new Znt(this.notebookEditor,M,l,c,p,N)),o.add(new pOe(this.notebookEditor,D(t,Nh(".notebook-folded-hint")),this._notebookExecutionStateService)),o.add(new Xnt(this.notebookEditor,e,r)),o.add(x.createInstance(lfe,this.notebookEditor,S)),o.add(new nrt(this.notebookEditor,v)),o.add(new Jnt(t,void 0,this.notebookEditor)),o.add(new $nt(t)),o.add(x.createInstance(nfe,this.notebookEditor))],[M,o.add(x.createInstance(dfe,this.notebookEditor,s,w))]);return o.add(V),{rootContainer:e,cellInputCollapsedContainer:v,instantiationService:x,container:t,cellContainer:y,editorPart:g,editorContainer:b,foldingIndicator:u,templateDisposables:o,elementDisposables:o.add(new O),cellParts:V,toJSON:()=>({})}}renderElement(e,t,o,n){if(!this.notebookEditor.hasModel())throw new Error("The notebook editor is not attached with view model yet.");o.currentRenderedCell=e,o.currentEditor=void 0,o.editorPart.style.display="none",o.cellContainer.innerText="",n?.height!==void 0&&o.elementDisposables.add(o.instantiationService.createInstance(mOe,this.notebookEditor,e,o,this.renderedEditors))}disposeTemplate(e){e.templateDisposables.dispose()}disposeElement(e,t,o){o.elementDisposables.clear()}};VQ=I([m(4,B),m(5,F),m(6,Xe),m(7,Yt),m(8,Le),m(9,Ne),m(10,Ns)],VQ);var BQ=class extends b2t{constructor(e,t,o,n,r,s,l,c,u,p,h){super(u,e,l,c,s,p,h,r,es,n);this.renderedEditors=t;this.editorPool=o}static{this.TEMPLATE_ID="code_cell"}get templateId(){return BQ.TEMPLATE_ID}renderTemplate(e){e.classList.add("code-cell-row");let t=D(e,_(".cell-inner-container")),o=new O,n=o.add(this.contextKeyServiceProvider(t)),r=D(e,Nh(".cell-decoration")),s=new Kv(D(t,Nh(".cell-focus-indicator.cell-focus-indicator-top"))),l=D(t,Nh(".cell-title-toolbar")),c=new Kv(D(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left"))),u=D(t,Nh(".cell-chat-part")),p=D(t,Nh(".cell.code")),h=D(p,Nh(".run-button-container")),g=D(p,Nh(".input-collapse-container"));g.style.display="none";let f=D(c.domNode,Nh("div.execution-count-label"));f.title=d(13961,null);let v=D(p,Nh(".cell-editor-part")),b=D(v,Nh(".cell-editor-container")),S=D(t,Nh(".cell-comment-container")),y=o.add(this.contextKeyServiceProvider(v)),w=o.add(this.instantiationService.createChild(new Po([X,y])));me.inCompositeEditor.bindTo(y).set(!0);let x=w.createInstance(us,b,{...this.editorOptions.getDefaultValue(),allowVariableLineHeights:!1,dimension:{width:0,height:0},scrollbar:{vertical:"hidden",horizontal:"auto",handleMouseWheel:!1,useShadows:!1}},{contributions:this.notebookEditor.creationOptions.cellEditorContributions});o.add(x);let E=new Kv(D(t,Nh(".output"))),M=D(E.domNode,Nh(".output-collapse-container")),N=new Kv(D(t,Nh(".output-show-more-container"))),V=new Kv(D(t,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-right"))),H=D(t,Nh(".cell-editor-focus-sink"));H.setAttribute("tabindex","0");let K=D(t,Nh(".cell-bottom-toolbar-container")),j=new Kv(D(t,Nh(".cell-focus-indicator.cell-focus-indicator-bottom"))),J=o.add(this.instantiationService.createChild(new Po([X,n]))),se={toggle:(It,tt)=>t.classList.toggle(It,tt)},ae=o.add(J.createInstance(ufe,l,se,this.notebookEditor.creationOptions.menuIds.cellTitleToolbar,this.notebookEditor.creationOptions.menuIds.cellDeleteToolbar,this.notebookEditor)),ce=o.add(new Znt(this.notebookEditor,ae,s,c,V,j)),Se=[ce,o.add(J.createInstance(Ynt,this.notebookEditor,u)),o.add(J.createInstance(cfe,this.notebookEditor,t,v,x)),o.add(J.createInstance(nOe,v,g)),o.add(new Xnt(this.notebookEditor,e,r)),o.add(J.createInstance(lfe,this.notebookEditor,S)),o.add(J.createInstance(oOe,this.notebookEditor,f)),o.add(J.createInstance(uOe,this.notebookEditor,M)),o.add(new nrt(this.notebookEditor,g)),o.add(new Jnt(t,H,this.notebookEditor)),o.add(new $nt(t)),o.add(J.createInstance(nfe,this.notebookEditor))],{cellExecutePrimary:Re,cellExecuteToolbar:xe}=this.notebookEditor.creationOptions.menuIds;Re&&xe&&Se.push(o.add(J.createInstance(dOe,this.notebookEditor,n,t,h,Re,xe)));let He=new qnt(Me(e),Se,[ae,o.add(J.createInstance(dfe,this.notebookEditor,l,K))]);o.add(He);let Ee={rootContainer:e,editorPart:v,cellInputCollapsedContainer:g,cellOutputCollapsedContainer:M,instantiationService:J,container:t,cellContainer:p,focusSinkElement:H,outputContainer:E,outputShowMoreContainer:N,editor:x,templateDisposables:o,elementDisposables:o.add(new O),cellParts:He,toJSON:()=>({})},Te=[c.domNode,ce.codeFocusIndicator.domNode,ce.outputFocusIndicator.domNode];return this.dndController?.registerDragHandle(Ee,e,Te,()=>new m2t().getDragImage(Ee,Ee.editor,"code")),Ee}renderElement(e,t,o,n){if(!this.notebookEditor.hasModel())throw new Error("The notebook editor is not attached with view model yet.");o.currentRenderedCell=e,n?.height!==void 0&&(o.outputContainer.domNode.innerText="",o.outputContainer.domNode.appendChild(o.cellOutputCollapsedContainer),o.elementDisposables.add(o.instantiationService.createInstance(cOe,this.notebookEditor,e,o,this.editorPool)),this.renderedEditors.set(e,o.editor))}disposeTemplate(e){e.templateDisposables.dispose()}disposeElement(e,t,o){o.elementDisposables.clear(),this.renderedEditors.delete(e)}};BQ=I([m(5,B),m(6,Xe),m(7,Yt),m(8,F),m(9,Le),m(10,Ne)],BQ);var gOe=class extends k{constructor(){super(...arguments);this._onDidChangeLayout=this._register(new T);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeMetadata=this._register(new T);this.onDidChangeMetadata=this._onDidChangeMetadata.event;this._onDidChangeCellState=this._register(new T);this.onDidChangeCellState=this._onDidChangeCellState.event}emit(e){for(let t=0,o=e.length;t<o;t++){let n=e[t];switch(n.type){case 1:this._onDidChangeLayout.fire(n);break;case 2:this._onDidChangeMetadata.fire(n);break;case 3:this._onDidChangeCellState.fire(n);break}}}};var fOe=class extends k{constructor(e,t){super();this._notebookEditor=e;this.ownerID=t;this._allMatchesDecorations=[];this._currentMatchCellDecorations=[];this._allMatchesCellDecorations=[];this._currentMatchDecorations=null}get currentMatchDecorations(){return this._currentMatchDecorations}clearDecorations(){this.clearCurrentFindMatchDecoration(),this.setAllFindMatchesDecorations([])}async highlightCurrentFindMatchDecorationInCell(e,t){return this.clearCurrentFindMatchDecoration(),this._notebookEditor.changeModelDecorations(o=>{let n=w4._CURRENT_FIND_MATCH_DECORATION,r=[{range:t,options:n}],s={ownerId:e.handle,decorations:r};this._currentMatchDecorations={kind:"input",decorations:o.deltaDecorations(this._currentMatchDecorations?.kind==="input"?this._currentMatchDecorations.decorations:[],[s])}}),this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[{handle:e.handle,options:{overviewRuler:{color:NCe,modelRanges:[t],includeOutput:!1,position:2}}}]),null}async highlightCurrentFindMatchDecorationInWebview(e,t){this.clearCurrentFindMatchDecoration();let o=await this._notebookEditor.findHighlightCurrent(t,this.ownerID);return this._currentMatchDecorations={kind:"output",index:t},this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[{handle:e.handle,options:{overviewRuler:{color:NCe,modelRanges:[],includeOutput:!0,position:2}}}]),o}clearCurrentFindMatchDecoration(){this._currentMatchDecorations?.kind==="input"?this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this._currentMatchDecorations?.kind==="input"?this._currentMatchDecorations.decorations:[],[]),this._currentMatchDecorations=null}):this._currentMatchDecorations?.kind==="output"&&this._notebookEditor.findUnHighlightCurrent(this._currentMatchDecorations.index,this.ownerID),this._currentMatchCellDecorations=this._notebookEditor.deltaCellDecorations(this._currentMatchCellDecorations,[])}setAllFindMatchesDecorations(e){this._notebookEditor.changeModelDecorations(t=>{let o=w4._FIND_MATCH_DECORATION,n=e.map(r=>{let s=new Array(r.contentMatches.length);for(let l=0;l<r.contentMatches.length;l++)s[l]={range:r.contentMatches[l].range,options:o};return{ownerId:r.cell.handle,decorations:s}});this._allMatchesDecorations=t.deltaDecorations(this._allMatchesDecorations,n)}),this._allMatchesCellDecorations=this._notebookEditor.deltaCellDecorations(this._allMatchesCellDecorations,e.map(t=>({ownerId:t.cell.handle,handle:t.cell.handle,options:{overviewRuler:{color:DF,modelRanges:t.contentMatches.map(o=>o.range),includeOutput:t.webviewMatches.length>0,position:2}}})))}stopWebviewFind(){this._notebookEditor.findStop(this.ownerID)}dispose(){this.clearDecorations(),super.dispose()}};var HQ=class{get length(){return this._contentMatches.length+this._webviewMatches.length}get contentMatches(){return this._contentMatches}get webviewMatches(){return this._webviewMatches}constructor(i,e,t,o){this.cell=i,this.index=e,this._contentMatches=t,this._webviewMatches=o}getMatch(i){if(i>=this.length)throw new Error("NotebookCellFindMatch: index out of range");return i<this._contentMatches.length?this._contentMatches[i]:this._webviewMatches[i-this._contentMatches.length]}},bOe=class extends k{constructor(e,t,o){super();this._notebookEditor=e;this._state=t;this._configurationService=o;this._findMatches=[];this._findMatchesStarts=null;this._currentMatch=-1;this._computePromise=null;this._modelDisposable=this._register(new O);this._throttledDelayer=this._register(new rn(20)),this._computePromise=null,this._register(t.onFindReplaceStateChange(n=>{this._updateCellStates(n),(n.searchString||n.isRegex||n.matchCase||n.searchScope||n.wholeWord||n.isRevealed&&this._state.isRevealed||n.filters||n.isReplaceRevealed)&&this.research(),n.isRevealed&&!this._state.isRevealed&&this.clear()})),this._register(this._notebookEditor.onDidChangeModel(n=>{this._registerModelListener(n)})),this._register(this._notebookEditor.onDidChangeCellState(n=>{n.cell.cellKind===1&&n.source.editStateChanged&&this.research()})),this._notebookEditor.hasModel()&&this._registerModelListener(this._notebookEditor.textModel),this._findMatchDecorationModel=new fOe(this._notebookEditor,this._notebookEditor.getId())}get findMatches(){return this._findMatches}get currentMatch(){return this._currentMatch}_updateCellStates(e){if(!this._state.filters?.markupInput||!this._state.filters?.markupPreview||!this._state.filters?.findScope)return;let t=()=>{let o=this._notebookEditor.getViewModel();if(!o)return;let n=this._configurationService.inspect("editor.wordSeparators").value,r={regex:this._state.isRegex,wholeWord:this._state.wholeWord,caseSensitive:this._state.matchCase,wordSeparators:n,includeMarkupInput:!0,includeCodeInput:!1,includeMarkupPreview:!1,includeOutput:!1,findScope:this._state.filters?.findScope},s=o.find(this._state.searchString,r);for(let l=0;l<o.length;l++){let c=o.cellAt(l);if(c&&c.cellKind===1){let p=s.find(g=>g.cell.handle===c.handle&&g.contentMatches.length>0)?1:0,h=c.getEditState();if(h===1&&c.editStateSource!=="find")continue;h!==p&&c.updateEditState(p,"find")}}};if(e.isReplaceRevealed&&!this._state.isReplaceRevealed){let o=this._notebookEditor.getViewModel();if(!o)return;for(let n=0;n<o.length;n++){let r=o.cellAt(n);r&&r.cellKind===1&&r.getEditState()===1&&r.editStateSource==="find"&&r.updateEditState(0,"find")}return}(e.isReplaceRevealed||(e.filters||e.isRevealed||e.searchString||e.replaceString)&&this._state.isRevealed&&this._state.isReplaceRevealed)&&t()}ensureFindMatches(){this._findMatchesStarts||this.set(this._findMatches,!0)}getCurrentMatch(){let e=this._findMatchesStarts.getIndexOf(this._currentMatch),t=this._findMatches[e.index].cell,o=this._findMatches[e.index].getMatch(e.remainder);return{cell:t,match:o,isModelMatch:e.remainder<this._findMatches[e.index].contentMatches.length}}refreshCurrentMatch(e){let t=this.findMatches.findIndex(s=>s.cell===e.cell);if(t===-1)return;let n=this.findMatches[t].contentMatches.findIndex(s=>s.range.intersectRanges(e.range)!==null);if(n===void 0)return;let r=t===0?0:this._findMatchesStarts?.getPrefixSum(t-1)??0;this._currentMatch=r+n,this.highlightCurrentFindMatchDecoration(t,n).then(async s=>{await this.revealCellRange(t,n,s),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((l,c)=>l+c.length,0),void 0)})}find(e){if(!this.findMatches.length)return;if(!this._findMatchesStarts)this.set(this._findMatches,!0),yo(e,{index:!0})&&(this._currentMatch=e.index);else{let o=this._findMatchesStarts.getTotalSum();if(yo(e,{index:!0}))this._currentMatch=e.index;else if(this._currentMatch===-1)this._currentMatch=e.previous?o-1:0;else{let n=(this._currentMatch+(e.previous?-1:1)+o)%o;this._currentMatch=n}}let t=this._findMatchesStarts.getIndexOf(this._currentMatch);this.highlightCurrentFindMatchDecoration(t.index,t.remainder).then(async o=>{await this.revealCellRange(t.index,t.remainder,o),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((n,r)=>n+r.length,0),void 0)})}async revealCellRange(e,t,o){let n=this._findMatches[e];if(t>=n.contentMatches.length)this._notebookEditor.focusElement(n.cell),this._notebookEditor.getCellIndex(n.cell)!==void 0&&this._notebookEditor.revealCellOffsetInCenter(n.cell,o??0);else{let r=n.getMatch(t);n.cell.getEditState()!==1&&n.cell.updateEditState(1,"find"),n.cell.isInputCollapsed=!1,this._notebookEditor.focusElement(n.cell),this._notebookEditor.setCellEditorSelection(n.cell,r.range),await this._notebookEditor.revealInView(n.cell),this._notebookEditor.revealRangeInCenterIfOutsideViewportAsync(n.cell,r.range)}}_registerModelListener(e){this._modelDisposable.clear(),e&&this._modelDisposable.add(e.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===10||o.kind===1)&&this.research()})),this.research()}async research(){return this._throttledDelayer.trigger(async()=>{this._state.change({isSearching:!0},!1),await this._research(),this._state.change({isSearching:!1},!1)})}async _research(){if(this._computePromise?.cancel(),!this._state.isRevealed||!this._notebookEditor.hasModel()){this.set([],!1);return}this._computePromise=Hn(l=>this._compute(l));let e=await this._computePromise;if(!e){this.set([],!1);return}if(e.length===0){this.set([],!1);return}let t=l=>{let c=Mw(e.map(u=>u.index),u=>u>=l);this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c))};if(this._currentMatch===-1)if(this._notebookEditor.getLength()===0){this.set(e,!1);return}else{let l=this._notebookEditor.getFocus().start;t(l),this.set(e,!1);return}let o=this._findMatchesStarts.getIndexOf(this._currentMatch),n=this._findMatches[o.index].cell,r=this._notebookEditor.getCellIndex(n);if(r<0){if(this._notebookEditor.getLength()===0){this.set(e,!1);return}t(r);return}let s=this._notebookEditor.cellAt(r);if(s.cellKind===1&&s.getEditState()===0){t(r);return}if(!this._findMatchDecorationModel.currentMatchDecorations){t(r);return}if(this._findMatchDecorationModel.currentMatchDecorations.kind==="input"){let l=this._findMatchDecorationModel.currentMatchDecorations.decorations.find(u=>u.ownerId===s.handle);if(!l){t(r);return}let c=Mw(e,u=>u.index>=r)%e.length;if(e[c].index>r){this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c));return}else{let u=s.editorAttached&&l.decorations[0]?s.getCellDecorationRange(l.decorations[0]):null;if(u===null&&o.remainder<this._findMatches[o.index].contentMatches.length&&(u=this._findMatches[o.index].getMatch(o.remainder).range),u!==null){let p=e[c],h=Mw(p.contentMatches,g=>G.compareRangesUsingStarts(g.range,u)>=0);this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c)+h)}else{this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,c));return}}}else{let l=Mw(e.map(c=>c.index),c=>c>=r)%e.length;this._updateCurrentMatch(e,this._matchesCountBeforeIndex(e,l))}}set(e,t){if(!e||!e.length){this._findMatches=[],this._findMatchDecorationModel.setAllFindMatchesDecorations([]),this.constructFindMatchesStarts(),this._currentMatch=-1,this._findMatchDecorationModel.clearCurrentFindMatchDecoration(),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((o,n)=>o+n.length,0),void 0);return}this._findMatches=e,this._findMatchDecorationModel.setAllFindMatchesDecorations(e||[]),this.constructFindMatchesStarts(),t&&(this._currentMatch=0,this.highlightCurrentFindMatchDecoration(0,0)),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((o,n)=>o+n.length,0),void 0)}async _compute(e){if(!this._notebookEditor.hasModel())return null;let t=null,o=this._state.searchString,n=this._configurationService.inspect("editor.wordSeparators").value,r={regex:this._state.isRegex,wholeWord:this._state.wholeWord,caseSensitive:this._state.matchCase,wordSeparators:n,includeMarkupInput:this._state.filters?.markupInput??!0,includeCodeInput:this._state.filters?.codeInput??!0,includeMarkupPreview:!!this._state.filters?.markupPreview,includeOutput:!!this._state.filters?.codeOutput,findScope:this._state.filters?.findScope};return t=await this._notebookEditor.find(o,r,e),e.isCancellationRequested?null:t}_updateCurrentMatch(e,t){this._currentMatch=t%e.length,this.set(e,!1);let o=this._findMatchesStarts.getIndexOf(this._currentMatch);this.highlightCurrentFindMatchDecoration(o.index,o.remainder),this._state.changeMatchInfo(this._currentMatch,this._findMatches.reduce((n,r)=>n+r.length,0),void 0)}_matchesCountBeforeIndex(e,t){let o=0;for(let n=0;n<t;n++)o+=e[n].length;return o}constructFindMatchesStarts(){if(this._findMatches&&this._findMatches.length){let e=new Uint32Array(this._findMatches.length);for(let t=0;t<this._findMatches.length;t++)e[t]=this._findMatches[t].length;this._findMatchesStarts=new fD(e)}else this._findMatchesStarts=null}async highlightCurrentFindMatchDecoration(e,t){let o=this._findMatches[e].cell,n=this._findMatches[e].getMatch(t);return t<this._findMatches[e].contentMatches.length?this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInCell(o,n.range):this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInWebview(o,n.index)}clear(){this._computePromise?.cancel(),this._throttledDelayer.cancel(),this.set([],!1)}dispose(){this._findMatchDecorationModel.dispose(),super.dispose()}};bOe=I([m(2,B)],bOe);var S2t=class extends k{constructor(){super(...arguments);this._onDidChangeSelection=this._register(new T);this._primary={start:0,end:0};this._selections=[{start:0,end:0}]}get onDidChangeSelection(){return this._onDidChangeSelection.event}get selections(){return this._selections}get focus(){return this._primary}setState(e,t,o,n){let r=e??{start:0,end:0},s=t.length>0?t:[{start:0,end:0}],l=!hYe([r],[this._primary])||!hYe(this._selections,s);this._primary=r,this._selections=s,(l||o)&&this._onDidChangeSelection.fire(n)}setSelections(e,t,o){this.setState(this._primary,e,t,o)}};var Van=()=>{throw new Error("Invalid change accessor")},QLi=class{constructor(){this._decorationsTree=new _X}intervalSearch(i,e,t,o,n,r,s=!1){return this._decorationsTree.intervalSearch(i,e,t,o,n,r,s)}search(i,e,t,o,n,r){return this._decorationsTree.search(i,e,t,n,r)}collectNodesFromOwner(i){return this._decorationsTree.collectNodesFromOwner(i)}collectNodesPostOrder(){return this._decorationsTree.collectNodesPostOrder()}insert(i){this._decorationsTree.insert(i)}delete(i){this._decorationsTree.delete(i)}resolveNode(i,e){this._decorationsTree.resolveNode(i,e)}acceptReplace(i,e,t,o){this._decorationsTree.acceptReplace(i,e,t,o)}},Oyo=[So.register({description:"notebook-view-model-tracked-range-always-grows-when-typing-at-edges",stickiness:0}),So.register({description:"notebook-view-model-tracked-range-never-grows-when-typing-at-edges",stickiness:1}),So.register({description:"notebook-view-model-tracked-range-grows-only-when-typing-before",stickiness:2}),So.register({description:"notebook-view-model-tracked-range-grows-only-when-typing-after",stickiness:3})];function Ban(a){return a instanceof So?a:So.createDynamic(a)}var jLi=0,ooe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.viewType=e;this._notebook=t;this._viewContext=o;this._layoutInfo=n;this._options=r;this._instantiationService=s;this._bulkEditService=l;this._undoService=c;this._textModelService=u;this.notebookExecutionStateService=p;this._localStore=this._register(new O);this._handleToViewCellMapping=new Map;this._onDidChangeOptions=this._register(new T);this._viewCells=[];this._onDidChangeViewCells=this._register(new T);this._lastNotebookEditResource=[];this._onDidChangeSelection=this._register(new T);this._selectionCollection=this._register(new S2t);this._decorationsTree=new QLi;this._decorations=Object.create(null);this._lastDecorationId=0;this._foldingRanges=null;this._onDidFoldingStateChanged=this._register(new T);this.onDidFoldingStateChanged=this._onDidFoldingStateChanged.event;this._hiddenRanges=[];this._focused=!0;this._decorationIdToCellMap=new Map;this._statusBarItemIdToCellMap=new Map;this._lastOverviewRulerDecorationId=0;this._overviewRulerDecorations=new Map;jLi++,this.id="$notebookViewModel"+jLi,this._instanceId=pwe(jLi);let h=(f,v)=>{let b=f.map(x=>[x[0],x[1],x[2].map(E=>Fyo(this._instantiationService,this,E,this._viewContext))]);b.reverse().forEach(x=>{let E=this._viewCells.splice(x[0],x[1],...x[2]);this._decorationsTree.acceptReplace(x[0],x[1],x[2].length,!0),E.forEach(M=>{this._handleToViewCellMapping.delete(M.handle),M.dispose()}),x[2].forEach(M=>{this._handleToViewCellMapping.set(M.handle,M),this._localStore.add(M)})});let S=this.selectionHandles;this._onDidChangeViewCells.fire({synchronous:v,splices:b});let y=[];if(S.length){let x=S[0],E=this._viewCells.indexOf(this.getCellByHandle(x));y=[x];let M=0;for(let N=0;N<b.length;N++){let V=b[0];if(V[0]+V[1]<=E){M+=V[2].length-V[1];continue}if(V[0]>E){y=[x];break}if(V[0]+V[1]>E){y=[this._viewCells[V[0]+M].handle];break}}}let w=y.map(x=>this._viewCells.findIndex(E=>E.handle===x));this._selectionCollection.setState(wpe([w[0]])[0],wpe(w),!0,"model")};this._register(this._notebook.onDidChangeContent(f=>{for(let v=0;v<f.rawEvents.length;v++){let b=f.rawEvents[v],S=[],y=f.synchronous??!0;if(b.kind===1||b.kind===6){S=b.changes,h(S,y);continue}else if(b.kind===2)h([[b.index,b.length,[]]],y),h([[b.newIdx,0,b.cells]],y);else continue}})),this._register(this._notebook.onDidChangeContent(f=>{f.rawEvents.forEach(v=>{v.kind===11&&this._viewContext.eventDispatcher.emit([new i2t(this._notebook.metadata)])}),f.endSelectionState&&this.updateSelectionsState(f.endSelectionState)})),this._register(this._viewContext.eventDispatcher.onDidChangeLayout(f=>{this._layoutInfo=f.value,this._viewCells.forEach(v=>{v.cellKind===1?(f.source.width||f.source.fontInfo)&&v.layoutChange({outerWidth:f.value.width,font:f.value.fontInfo}):f.source.width!==void 0&&v.layoutChange({outerWidth:f.value.width,font:f.value.fontInfo})})})),this._register(this._viewContext.notebookOptions.onDidChangeOptions(f=>{for(let v=0;v<this.length;v++)this._viewCells[v].updateOptions(f)})),this._register(p.onDidChangeExecution(f=>{if(f.type!==0)return;let v=this.getCellByHandle(f.cellHandle);v instanceof Ah&&v.updateExecutionState(f)})),this._register(this._selectionCollection.onDidChangeSelection(f=>{this._onDidChangeSelection.fire(f)}));let g=this.isRepl?this._notebook.cells.length-1:this._notebook.cells.length;for(let f=0;f<g;f++)this._viewCells.push(Fyo(this._instantiationService,this,this._notebook.cells[f],this._viewContext));this._viewCells.forEach(f=>{this._handleToViewCellMapping.set(f.handle,f)})}get options(){return this._options}get onDidChangeOptions(){return this._onDidChangeOptions.event}get viewCells(){return this._viewCells}get length(){return this._viewCells.length}get notebookDocument(){return this._notebook}get uri(){return this._notebook.uri}get metadata(){return this._notebook.metadata}get isRepl(){return this.viewType==="repl"}get onDidChangeViewCells(){return this._onDidChangeViewCells.event}get lastNotebookEditResource(){return this._lastNotebookEditResource.length?this._lastNotebookEditResource[this._lastNotebookEditResource.length-1]:null}get layoutInfo(){return this._layoutInfo}get onDidChangeSelection(){return this._onDidChangeSelection.event}get selectionHandles(){let e=new Set,t=[];return yv(this._selectionCollection.selections).map(o=>o<this.length?this.cellAt(o):void 0).forEach(o=>{o&&!e.has(o.handle)&&(e.add(o.handle),t.push(o.handle))}),t}set selectionHandles(e){let t=e.map(o=>this._viewCells.findIndex(n=>n.handle===o));this._selectionCollection.setSelections(wpe(t),!0,"model")}get focused(){return this._focused}updateOptions(e){this._options={...this._options,...e},this._viewCells.forEach(t=>t.updateOptions({readonly:this._options.isReadOnly})),this._onDidChangeOptions.fire()}getFocus(){return this._selectionCollection.focus}getSelections(){return this._selectionCollection.selections}getMostRecentlyExecutedCell(){let e=this.notebookExecutionStateService.getLastCompletedCellForNotebook(this._notebook.uri);return e!==void 0?this.getCellByHandle(e):void 0}setEditorFocus(e){this._focused=e}validateRange(e){if(!e)return null;let t=jn(e.start,0,this.length),o=jn(e.end,0,this.length);return t<=o?{start:t,end:o}:{start:o,end:t}}updateSelectionsState(e,t="model"){if(this._focused||t==="model")if(e.kind===0){let o=e.primary!==null?this.getCellIndexByHandle(e.primary):null,n=o!==null?this.validateRange({start:o,end:o+1}):null,r=wpe(e.selections.map(s=>this.getCellIndexByHandle(s))).map(s=>this.validateRange(s)).filter(s=>s!==null);this._selectionCollection.setState(n,M0(r),!0,t)}else{let o=this.validateRange(e.focus),n=e.selections.map(r=>this.validateRange(r)).filter(r=>r!==null);this._selectionCollection.setState(o,M0(n),!0,t)}}getFoldingStartIndex(e){if(!this._foldingRanges)return-1;let t=this._foldingRanges.findRange(e+1);return this._foldingRanges.getStartLineNumber(t)-1}getFoldingState(e){if(!this._foldingRanges)return 0;let t=this._foldingRanges.findRange(e+1);return this._foldingRanges.getStartLineNumber(t)-1!==e?0:this._foldingRanges.isCollapsed(t)?2:1}getFoldedLength(e){if(!this._foldingRanges)return 0;let t=this._foldingRanges.findRange(e+1),o=this._foldingRanges.getStartLineNumber(t)-1;return this._foldingRanges.getEndLineNumber(t)-1-o}updateFoldingRanges(e){this._foldingRanges=e;let t=!1,o=[],n=0,r=0,s=Number.MAX_VALUE,l=-1;for(;n<e.length;n++){if(!e.isCollapsed(n))continue;let c=e.getStartLineNumber(n)+1,u=e.getEndLineNumber(n);s<=c&&u<=l||(!t&&r<this._hiddenRanges.length&&this._hiddenRanges[r].start+1===c&&this._hiddenRanges[r].end+1===u?(o.push(this._hiddenRanges[r]),r++):(t=!0,o.push({start:c-1,end:u-1})),s=c,l=u)}(t||r<this._hiddenRanges.length)&&(this._hiddenRanges=o,this._onDidFoldingStateChanged.fire()),this._viewCells.forEach(c=>{c.cellKind===1&&c.triggerFoldingStateChange()})}getHiddenRanges(){return this._hiddenRanges}getOverviewRulerDecorations(){return Array.from(this._overviewRulerDecorations.values())}getCellByHandle(e){return this._handleToViewCellMapping.get(e)}getCellIndexByHandle(e){return this._viewCells.findIndex(t=>t.handle===e)}getCellIndex(e){return this._viewCells.indexOf(e)}cellAt(e){return this._viewCells[e]}getCellsInRange(e){if(!e)return this._viewCells.slice(0);let t=this.validateRange(e);if(t){let o=[];for(let n=t.start;n<t.end;n++)o.push(this._viewCells[n]);return o}return[]}getNearestVisibleCellIndexUpwards(e){for(let t=this._hiddenRanges.length-1;t>=0;t--){let o=this._hiddenRanges[t],n=o.start-1,r=o.end;if(!(n>e)){if(n<=e&&r>=e)return e;break}}return e}getNextVisibleCellIndex(e){for(let t=0;t<this._hiddenRanges.length;t++){let o=this._hiddenRanges[t],n=o.start-1,r=o.end;if(!(r<e)){if(n<=e)return r+1;break}}return e+1}getPreviousVisibleCellIndex(e){for(let t=this._hiddenRanges.length-1;t>=0;t--){let o=this._hiddenRanges[t],n=o.start-1;if(o.end<e)return e;if(n<=e)return n}return e}hasCell(e){return this._handleToViewCellMapping.has(e.handle)}getVersionId(){return this._notebook.versionId}getAlternativeId(){return this._notebook.alternativeVersionId}getTrackedRange(e){return this._getDecorationRange(e)}_getDecorationRange(e){let t=this._decorations[e];if(!t)return null;let o=this.getVersionId();return t.cachedVersionId!==o&&this._decorationsTree.resolveNode(t,o),t.range===null?{start:t.cachedAbsoluteStart-1,end:t.cachedAbsoluteEnd-1}:{start:t.range.startLineNumber-1,end:t.range.endLineNumber-1}}setTrackedRange(e,t,o){let n=e?this._decorations[e]:null;return n?t?(this._decorationsTree.delete(n),n.reset(this.getVersionId(),t.start,t.end+1,new G(t.start+1,1,t.end+1,1)),n.setOptions(Oyo[o]),this._decorationsTree.insert(n),n.id):(this._decorationsTree.delete(n),delete this._decorations[n.id],null):t?this._deltaCellDecorationsImpl(0,[],[{range:new G(t.start+1,1,t.end+1,1),options:Oyo[o]}])[0]:null}_deltaCellDecorationsImpl(e,t,o){let n=this.getVersionId(),r=t.length,s=0,l=o.length,c=0,u=new Array(l);for(;s<r||c<l;){let p=null;if(s<r){do p=this._decorations[t[s++]];while(!p&&s<r);p&&this._decorationsTree.delete(p)}if(c<l){if(!p){let v=++this._lastDecorationId,b=`${this._instanceId};${v}`;p=new pde(b,0,0),this._decorations[b]=p}let h=o[c],g=h.range,f=Ban(h.options);p.ownerId=e,p.reset(n,g.startLineNumber,g.endLineNumber,G.lift(g)),p.setOptions(f),this._decorationsTree.insert(p),u[c]=p.id,c++}else p&&delete this._decorations[p.id]}return u}deltaCellDecorations(e,t){e.forEach(n=>{let r=this._decorationIdToCellMap.get(n);r!==void 0&&(this.getCellByHandle(r)?.deltaCellDecorations([n],[]),this._decorationIdToCellMap.delete(n)),this._overviewRulerDecorations.delete(n)});let o=[];return t.forEach(n=>{if(Pso(n)){let s=this.getCellByHandle(n.handle)?.deltaCellDecorations([],[n.options])||[];s.forEach(l=>{this._decorationIdToCellMap.set(l,n.handle)}),o.push(...s)}else{let r=++this._lastOverviewRulerDecorationId,s=`_overview_${this.id};${r}`;this._overviewRulerDecorations.set(s,n),o.push(s)}}),o}deltaCellStatusBarItems(e,t){let o=yy(e,r=>this._statusBarItemIdToCellMap.get(r)??-1),n=[];t.forEach(r=>{let s=this.getCellByHandle(r.handle),l=o[r.handle]??[];delete o[r.handle],l.forEach(u=>this._statusBarItemIdToCellMap.delete(u));let c=s?.deltaCellStatusBarItems(l,r.items)||[];c.forEach(u=>{this._statusBarItemIdToCellMap.set(u,r.handle)}),n.push(...c)});for(let r in o){let s=parseInt(r),l=o[s];this.getCellByHandle(s)?.deltaCellStatusBarItems(l,[]),l.forEach(u=>this._statusBarItemIdToCellMap.delete(u))}return n}nearestCodeCellIndex(e){let t=this.viewCells.slice(0,e).reverse().findIndex(o=>o.cellKind===2);if(t>-1)return e-t-1;{let o=this.viewCells.slice(e+1).findIndex(n=>n.cellKind===2);return o>-1?e+1+o:-1}}getEditorViewState(){let e={},t={},o={},n={};this._viewCells.forEach((s,l)=>{s.getEditState()===1&&(e[l]=!0),s.isInputCollapsed&&(t[l]=!0),s instanceof Ah&&s.isOutputCollapsed&&(o[l]=!0),s.lineNumbers!=="inherit"&&(n[l]=s.lineNumbers)});let r={};return this._viewCells.map(s=>({handle:s.model.handle,state:s.saveEditorViewState()})).forEach((s,l)=>{s.state&&(r[l]=s.state)}),{editingCells:e,editorViewStates:r,cellLineNumberStates:n,collapsedInputCells:t,collapsedOutputCells:o}}restoreEditorViewState(e){e&&this._viewCells.forEach((t,o)=>{let n=e.editingCells&&e.editingCells[o],r=e.editorViewStates&&e.editorViewStates[o];t.updateEditState(n?1:0,"viewState");let s=e.cellTotalHeights?e.cellTotalHeights[o]:void 0;t.restoreEditorViewState(r,s),e.collapsedInputCells&&e.collapsedInputCells[o]&&(t.isInputCollapsed=!0),e.collapsedOutputCells&&e.collapsedOutputCells[o]&&t instanceof Ah&&(t.isOutputCollapsed=!0),e.cellLineNumberStates&&e.cellLineNumberStates[o]&&(t.lineNumbers=e.cellLineNumberStates[o])})}changeModelDecorations(e){let t={deltaDecorations:(n,r)=>this._deltaModelDecorationsImpl(n,r)},o=null;try{o=e(t)}catch(n){mt(n)}return t.deltaDecorations=Van,o}_deltaModelDecorationsImpl(e,t){let o=new Map;e.forEach(r=>{let s=r.ownerId;if(!o.has(s)){let c=this._viewCells.find(u=>u.handle===s);c&&o.set(s,{cell:c,oldDecorations:[],newDecorations:[]})}let l=o.get(s);l&&(l.oldDecorations=r.decorations)}),t.forEach(r=>{let s=r.ownerId;if(!o.has(s)){let c=this._viewCells.find(u=>u.handle===s);c&&o.set(s,{cell:c,oldDecorations:[],newDecorations:[]})}let l=o.get(s);l&&(l.newDecorations=r.decorations)});let n=[];return o.forEach((r,s)=>{let l=r.cell.deltaModelDecorations(r.oldDecorations,r.newDecorations);n.push({ownerId:s,decorations:l})}),n}find(e,t){let o=[],n=[];if(t.findScope&&(t.findScope.findScopeType==="cells"||t.findScope.findScopeType==="text")){let r=t.findScope.selectedCellRanges?.map(l=>this.validateRange(l)).filter(l=>!!l)??[];n=yv(r).map(l=>this._viewCells[l])}else n=this._viewCells;return n.forEach((r,s)=>{let l=r.startFind(e,t);l&&o.push(new HQ(l.cell,s,l.contentMatches,[]))}),o.filter(r=>r.cell.cellKind===2?t.includeCodeInput:(r.cell.getEditState()===1||!t.includeMarkupPreview)&&t.includeMarkupInput)}replaceOne(e,t,o){let n=e;return this._lastNotebookEditResource.push(n.uri),n.resolveTextModel().then(()=>{this._bulkEditService.apply([new hl(e.uri,{range:t,text:o})],{quotableLabel:"Notebook Replace"})})}async replaceAll(e,t){if(!e.length)return;let o=[];return this._lastNotebookEditResource.push(e[0].cell.uri),e.forEach(n=>{n.contentMatches.forEach((r,s)=>{o.push({versionId:void 0,textEdit:{range:r.range,text:t[s]},resource:n.cell.uri})})}),Promise.all(e.map(n=>n.cell.resolveTextModel())).then(async()=>{this._bulkEditService.apply({edits:o},{quotableLabel:"Notebook Replace All"})})}async _withElement(e,t){let o=this._viewCells.filter(r=>e.matchesResource(r.uri)),n=await Promise.all(o.map(r=>this._textModelService.createModelReference(r.uri)));await t(),n.forEach(r=>r.dispose())}async undo(){let e=this._undoService.getElements(this.uri),t=e.past.length?e.past[e.past.length-1]:void 0;return t&&t instanceof JL||t instanceof UB?(await this._withElement(t,async()=>{await this._undoService.undo(this.uri)}),t instanceof JL?[t.resource]:t.resources):(await this._undoService.undo(this.uri),[])}async redo(){let t=this._undoService.getElements(this.uri).future[0];return t&&t instanceof JL||t instanceof UB?(await this._withElement(t,async()=>{await this._undoService.redo(this.uri)}),t instanceof JL?[t.resource]:t.resources):(await this._undoService.redo(this.uri),[])}equal(e){return this._notebook===e}dispose(){this._localStore.clear(),this._viewCells.forEach(e=>{e.dispose()}),super.dispose()}};ooe=I([m(5,F),m(6,Ka),m(7,wl),m(8,Bt),m(9,Ns)],ooe);function Fyo(a,i,e,t){return e.cellKind===2?a.createInstance(Ah,i.viewType,e,i.layoutInfo,t):a.createInstance(hS,i.viewType,e,i.layoutInfo,i,t)}var SOe=class{constructor(i,e,t){this.notebookOptions=i;this.eventDispatcher=e;this.getBaseCellEditorOptions=t}};var YLi=21,Han=21,UQ=8,XLi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===D_)return this.instantiationService.createInstance(qU,i,this.notebookEditor,e);if(i instanceof Do)return this.instantiationService.createInstance(sOe,i,{hoverDelegate:e.hoverDelegate});if(i instanceof id&&i.item.submenu.id===R.NotebookCellExecuteGoTo.id)return this.instantiationService.createInstance(FQ,i,{hoverDelegate:e.hoverDelegate},!0,{getActions:()=>this.goToMenu.getActions().find(([t])=>t==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this))}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=Wyo(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},JLi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===D_)return this.instantiationService.createInstance(qU,i,this.notebookEditor,e);if(i instanceof Do)return this.instantiationService.createInstance(Cl,i,{hoverDelegate:e.hoverDelegate});if(i instanceof id)return i.item.submenu.id===R.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(FQ,i,{hoverDelegate:e.hoverDelegate},!1,{getActions:()=>this.goToMenu.getActions().find(([t])=>t==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):this.instantiationService.createInstance(FT,i,{hoverDelegate:e.hoverDelegate})}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=Wyo(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},ZLi=class{constructor(i,e,t,o){this.notebookEditor=i;this.editorToolbar=e;this.goToMenu=t;this.instantiationService=o}actionProvider(i,e){if(i.id===D_)return this.instantiationService.createInstance(qU,i,this.notebookEditor,e);let t=this.editorToolbar.primaryActions.find(o=>o.action.id===i.id);return!t||t.renderLabel?i instanceof Do?this.instantiationService.createInstance(sOe,i,{hoverDelegate:e.hoverDelegate}):i instanceof id&&i.item.submenu.id===R.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(FQ,i,{hoverDelegate:e.hoverDelegate},!0,{getActions:()=>this.goToMenu.getActions().find(([o])=>o==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):void 0:i instanceof Do?this.instantiationService.createInstance(Cl,i,{hoverDelegate:e.hoverDelegate}):i instanceof id?i.item.submenu.id===R.NotebookCellExecuteGoTo.id?this.instantiationService.createInstance(FQ,i,{hoverDelegate:e.hoverDelegate},!1,{getActions:()=>this.goToMenu.getActions().find(([o])=>o==="navigation/execute")?.[1]??[]},this.actionProvider.bind(this)):this.instantiationService.createInstance(FT,i,{hoverDelegate:e.hoverDelegate}):void 0}calculateActions(i){let e=this.editorToolbar.primaryActions,t=this.editorToolbar.secondaryActions,o=Uan(e,t,i);return{primaryActions:o.primaryActions.map(n=>n.action),secondaryActions:o.secondaryActions}}},IOe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.notebookEditor=e;this.contextKeyService=t;this.notebookOptions=o;this.domNode=n;this.instantiationService=r;this.configurationService=s;this.contextMenuService=l;this.menuService=c;this.editorService=u;this.keybindingService=p;this._useGlobalToolbar=!1;this._renderLabel=0;this._visible=!1;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._dimension=null;this._primaryActions=[],this._secondaryActions=[],this._buildBody(),this._register(U.debounce(this.editorService.onDidActiveEditorChange,(h,g)=>h,200)(this._updatePerEditorChange,this)),this._registerNotebookActionsToolbar(),this._register($(this.domNode,ne.CONTEXT_MENU,h=>{let g=new Ln(Me(this.domNode),h);this.contextMenuService.showContextMenu({menuId:R.NotebookToolbarContext,getAnchor:()=>g,menuActionOptions:{renderShortTitle:!0}})}))}get primaryActions(){return this._primaryActions}get secondaryActions(){return this._secondaryActions}set visible(e){this._visible!==e&&(this._visible=e,this._onDidChangeVisibility.fire(e))}get useGlobalToolbar(){return this._useGlobalToolbar}_buildBody(){this._notebookTopLeftToolbarContainer=document.createElement("div"),this._notebookTopLeftToolbarContainer.classList.add("notebook-toolbar-left"),this._leftToolbarScrollable=new Ar(this._notebookTopLeftToolbarContainer,{vertical:2,horizontal:3,horizontalScrollbarSize:3,useShadows:!1,scrollYToX:!0}),this._register(this._leftToolbarScrollable),D(this.domNode,this._leftToolbarScrollable.getDomNode()),this._notebookTopRightToolbarContainer=document.createElement("div"),this._notebookTopRightToolbarContainer.classList.add("notebook-toolbar-right"),D(this.domNode,this._notebookTopRightToolbarContainer)}_updatePerEditorChange(){if(this.editorService.activeEditorPane?.getId()===_M&&this.editorService.activeEditorPane.getControl()===this.notebookEditor){this._showNotebookActionsinEditorToolbar();return}}_registerNotebookActionsToolbar(){this._notebookGlobalActionsMenu=this._register(this.menuService.createMenu(this.notebookEditor.creationOptions.menuIds.notebookToolbar,this.contextKeyService)),this._executeGoToActionsMenu=this._register(this.menuService.createMenu(R.NotebookCellExecuteGoTo,this.contextKeyService)),this._useGlobalToolbar=this.notebookOptions.getDisplayOptions().globalToolbar,this._renderLabel=this._convertConfiguration(this.configurationService.getValue(Ct.globalToolbarShowLabel)),this._updateStrategy();let e={ui:!0,notebookEditor:this.notebookEditor,source:"notebookToolbar"},t=(l,c)=>{if(l.id===D_)return this.instantiationService.createInstance(qU,l,this.notebookEditor,c);if(this._renderLabel!==1){let u=this._primaryActions.find(p=>p.action.id===l.id);return u&&u.renderLabel?l instanceof Do?this.instantiationService.createInstance(sOe,l,{hoverDelegate:c.hoverDelegate}):void 0:l instanceof Do?this.instantiationService.createInstance(Cl,l,{hoverDelegate:c.hoverDelegate}):void 0}else return l instanceof Do?this.instantiationService.createInstance(Cl,l,{hoverDelegate:c.hoverDelegate}):void 0},o=this._register(this.instantiationService.createInstance(Kf,"element",{instantHover:!0},{}));o.setInstantHoverTimeLimit(600);let n={hiddenItemStrategy:1,resetMenu:R.NotebookToolbar,actionViewItemProvider:(l,c)=>this._strategy.actionProvider(l,c),getKeyBinding:l=>this.keybindingService.lookupKeybinding(l.id),renderDropdownAsChildElement:!0,hoverDelegate:o};this._notebookLeftToolbar=this.instantiationService.createInstance(dl,this._notebookTopLeftToolbarContainer,n),this._register(this._notebookLeftToolbar),this._notebookLeftToolbar.context=e,this._notebookRightToolbar=new Kp(this._notebookTopRightToolbarContainer,this.contextMenuService,{getKeyBinding:l=>this.keybindingService.lookupKeybinding(l.id),actionViewItemProvider:t,renderDropdownAsChildElement:!0,hoverDelegate:o}),this._register(this._notebookRightToolbar),this._notebookRightToolbar.context=e,this._showNotebookActionsinEditorToolbar();let r=!1,s;this._register(this._notebookGlobalActionsMenu.onDidChange(()=>{if(r){s=()=>this._showNotebookActionsinEditorToolbar();return}this.notebookEditor.isVisible&&this._showNotebookActionsinEditorToolbar()})),this._register(this._notebookLeftToolbar.onDidChangeDropdownVisibility(l=>{r=l,s&&!l&&(setTimeout(()=>{s?.()},0),s=void 0)})),this._register(this.notebookOptions.onDidChangeOptions(l=>{l.globalToolbar!==void 0&&(this._useGlobalToolbar=this.notebookOptions.getDisplayOptions().globalToolbar,this._showNotebookActionsinEditorToolbar())})),this._register(this.configurationService.onDidChangeConfiguration(l=>{if(l.affectsConfiguration(Ct.globalToolbarShowLabel)){this._renderLabel=this._convertConfiguration(this.configurationService.getValue(Ct.globalToolbarShowLabel)),this._updateStrategy(),this._notebookLeftToolbar.getElement().remove(),this._notebookLeftToolbar.dispose(),this._notebookLeftToolbar=this.instantiationService.createInstance(dl,this._notebookTopLeftToolbarContainer,n),this._register(this._notebookLeftToolbar),this._notebookLeftToolbar.context=e,this._showNotebookActionsinEditorToolbar();return}}))}_updateStrategy(){switch(this._renderLabel){case 0:this._strategy=new XLi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break;case 1:this._strategy=new JLi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break;case 2:this._strategy=new ZLi(this.notebookEditor,this,this._executeGoToActionsMenu,this.instantiationService);break}}_convertConfiguration(e){switch(e){case!0:return 0;case!1:return 1;case"always":return 0;case"never":return 1;case"dynamic":return 2}}_showNotebookActionsinEditorToolbar(){if(!this.notebookEditor.hasModel()){this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0,this.visible=!1;return}this._deferredActionUpdate||(this._useGlobalToolbar?this._deferredActionUpdate=Zo(async()=>{await this._setNotebookActions(),this.visible=!0,this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0},50):(this.domNode.style.display="none",this._deferredActionUpdate=void 0,this.visible=!1))}async _setNotebookActions(){let e=this._notebookGlobalActionsMenu.getActions({shouldForwardArgs:!0,renderShortTitle:!0});this.domNode.style.display="flex";let t=e.filter(l=>/^navigation/.test(l[0])),o=[];t.sort((l,c)=>l[0]==="navigation"?1:c[0]==="navigation"?-1:0).forEach((l,c)=>{o.push(...l[1]),c<t.length-1&&o.push(new oi)});let n=e.find(l=>/^status/.test(l[0])),r=n?n[1]:[],s=e.filter(l=>!/^navigation/.test(l[0])&&!/^status/.test(l[0])).reduce((l,c)=>(l.push(...c[1]),l),[]);this._notebookLeftToolbar.setActions([],[]),this._primaryActions=o.map(l=>({action:l,size:l instanceof oi?1:0,renderLabel:!0,visible:!0})),this._notebookLeftToolbar.setActions(o,s),this._secondaryActions=s,this._notebookRightToolbar.setActions(r,[]),this._secondaryActions=s,this._dimension&&this._dimension.width>=0&&this._dimension.height>=0&&this._cacheItemSizes(this._notebookLeftToolbar),this._computeSizes()}_cacheItemSizes(e){for(let t=0;t<e.getItemsLength();t++){let o=e.getItemAction(t);if(o&&o.id!=="toolbar.toggle.more"){let n=this._primaryActions.find(r=>r.action.id===o.id);n&&(n.size=e.getItemWidth(t))}}}_computeSizes(){let e=this._notebookLeftToolbar,t=this._notebookRightToolbar;if(e&&t&&this._dimension&&this._dimension.height>=0&&this._dimension.width>=0){if(this._primaryActions.length===0&&e.getItemsLength()!==this._primaryActions.length&&this._cacheItemSizes(this._notebookLeftToolbar),this._primaryActions.length===0)return;let o=(t.getItemsLength()?t.getItemWidth(0):0)+UQ,n=this._dimension.width-o-(UQ+Han)-UQ-UQ,r=this._strategy.calculateActions(n);this._notebookLeftToolbar.setActions(r.primaryActions,r.secondaryActions)}}layout(e){this._dimension=e,this._useGlobalToolbar?this.domNode.style.display="flex":this.domNode.style.display="none",this._computeSizes()}dispose(){this._notebookLeftToolbar.context=void 0,this._notebookRightToolbar.context=void 0,this._notebookLeftToolbar.dispose(),this._notebookRightToolbar.dispose(),this._notebookLeftToolbar=null,this._notebookRightToolbar=null,this._deferredActionUpdate?.dispose(),this._deferredActionUpdate=void 0,super.dispose()}};IOe=I([m(4,F),m(5,B),m(6,Xe),m(7,Yt),m(8,ie),m(9,Le)],IOe);function Wyo(a,i,e){return I2t(a,i,e,!1)}function Uan(a,i,e){if(a.length===0)return{primaryActions:[],secondaryActions:i};let t=a.filter(s=>s.size!==0).length;if(a.map(s=>s.size).reduce((s,l)=>s+l,0)+(t-1)*UQ<=e)return a.forEach(s=>{s.renderLabel=!0}),I2t(a,i,e,!1);if(t*YLi+(t-1)*UQ>e)return a.forEach(s=>{s.renderLabel=!1}),I2t(a,i,e,!0);let n=0,r=-1;for(let s=0;s<a.length;s++)if(n+=a[s].size+UQ,a[s].action instanceof oi){let l=a.slice(s+1).filter(u=>u.size!==0);n+(l.length===0?0:l.length*YLi+(l.length-1)*UQ)<=e&&(r=s)}else continue;return r<0?(a.forEach(s=>{s.renderLabel=!1}),I2t(a,i,e,!0)):(a.slice(0,r+1).forEach(s=>{s.renderLabel=!0}),a.slice(r+1).forEach(s=>{s.renderLabel=!1}),{primaryActions:a,secondaryActions:i})}function I2t(a,i,e,t){let o=[],n=[],r=0,s=!1,l=!1;if(a.length===0)return{primaryActions:[],secondaryActions:i};for(let c=0;c<a.length;c++){let u=a[c],p=t?u.size===0?0:YLi:u.size;if(!(u.action instanceof oi&&o.length>0&&o[o.length-1].action instanceof oi)&&!(u.action instanceof oi&&!s))if(r+p<=e&&!l)r+=UQ+p,o.push(u),p!==0&&(s=!0),u.action instanceof oi&&(s=!1);else if(l=!0,p===0)o.push(u);else{if(u.action instanceof oi)continue;n.push(u.action)}}for(let c=o.length-1;c>0;c--){let u=o[c];if(u.size!==0){u.action instanceof oi&&o.splice(c,1);break}}if(o.length&&o[o.length-1].action instanceof oi&&o.pop(),n.length!==0&&n.push(new oi),t){let c=o.findIndex(u=>u.action.id==="notebook.cell.insertMarkdownCellBelow");c!==-1&&o.splice(c,1)}return{primaryActions:o,secondaryActions:[...n,...i]}}var yOe=class{constructor(i,e,t,o,n){this._editor=i;this._notebookKernelService=e;this._extensionService=o;this._notebookExecutionStateService=n;this._disposables=new O;this._viewModelDisposables=new O;this._cellOutputsListeners=[];this._selectedKernelDisposables=new O;this._notebookKernel=ANe.bindTo(t),this._notebookKernelCount=Vie.bindTo(t),this._notebookKernelSelected=cIo.bindTo(t),this._interruptibleKernel=GU.bindTo(t),this._hasVariableProvider=ONe.bindTo(t),this._someCellRunning=wQ.bindTo(t),this._kernelRunning=KU.bindTo(t),this._useConsolidatedOutputButton=Cnt.bindTo(t),this._hasOutputs=_Kt.bindTo(t),this._viewType=aIo.bindTo(t),this._missingKernelExtension=TKt.bindTo(t),this._notebookKernelSourceCount=NNe.bindTo(t),this._cellToolbarLocation=sIo.bindTo(t),this._lastCellFailed=LNe.bindTo(t),this._handleDidChangeModel(),this._updateForNotebookOptions(),this._disposables.add(i.onDidChangeModel(this._handleDidChangeModel,this)),this._disposables.add(e.onDidAddKernel(this._updateKernelContext,this)),this._disposables.add(e.onDidChangeSelectedNotebooks(this._updateKernelContext,this)),this._disposables.add(e.onDidChangeSourceActions(this._updateKernelContext,this)),this._disposables.add(i.notebookOptions.onDidChangeOptions(this._updateForNotebookOptions,this)),this._disposables.add(o.onDidChangeExtensions(this._updateForInstalledExtension,this)),this._disposables.add(n.onDidChangeExecution(this._updateForExecution,this)),this._disposables.add(n.onDidChangeLastRunFailState(this._updateForLastRunFailState,this))}dispose(){this._disposables.dispose(),this._viewModelDisposables.dispose(),this._selectedKernelDisposables.dispose(),this._notebookKernelCount.reset(),this._notebookKernelSourceCount.reset(),this._interruptibleKernel.reset(),this._hasVariableProvider.reset(),this._someCellRunning.reset(),this._kernelRunning.reset(),this._viewType.reset(),je(this._cellOutputsListeners),this._cellOutputsListeners.length=0}_handleDidChangeModel(){if(this._updateKernelContext(),this._updateForNotebookOptions(),this._viewModelDisposables.clear(),je(this._cellOutputsListeners),this._cellOutputsListeners.length=0,!this._editor.hasModel())return;let i=()=>{let o=!1;if(this._editor.hasModel()){for(let n=0;n<this._editor.getLength();n++)if(this._editor.cellAt(n).outputsViewModels.length>0){o=!0;break}}this._hasOutputs.set(o)},e=this._viewModelDisposables.add(new O),t=o=>o.model.onDidChangeOutputs(()=>{e.clear(),e.add(kr(Me(this._editor.getDomNode()),()=>{i()}))});for(let o=0;o<this._editor.getLength();o++){let n=this._editor.cellAt(o);this._cellOutputsListeners.push(t(n))}i(),this._updateForInstalledExtension(),this._viewModelDisposables.add(this._editor.onDidChangeViewCells(o=>{[...o.splices].reverse().forEach(n=>{let[r,s,l]=n,c=this._cellOutputsListeners.splice(r,s,...l.map(t));je(c)})})),this._viewType.set(this._editor.textModel.viewType)}_updateForExecution(i){if(this._editor.textModel){let e=this._notebookExecutionStateService.getExecution(this._editor.textModel.uri),t=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._editor.textModel.uri);this._kernelRunning.set(t.length>0||!!e),i.type===0&&this._someCellRunning.set(t.length>0)}else this._kernelRunning.set(!1),i.type===0&&this._someCellRunning.set(!1)}_updateForLastRunFailState(i){i.notebook===this._editor.textModel?.uri&&this._lastCellFailed.set(i.visible)}async _updateForInstalledExtension(){if(!this._editor.hasModel())return;let i=this._editor.textModel.viewType,e=Mso.get(i);this._missingKernelExtension.set(!!e&&!await this._extensionService.getExtension(e))}_updateKernelContext(){if(!this._editor.hasModel()){this._notebookKernelCount.reset(),this._notebookKernelSourceCount.reset(),this._interruptibleKernel.reset(),this._hasVariableProvider.reset();return}let{selected:i,all:e}=this._notebookKernelService.getMatchingKernel(this._editor.textModel),t=this._notebookKernelService.getSourceActions(this._editor.textModel,this._editor.scopedContextKeyService);this._notebookKernelCount.set(e.length),this._notebookKernelSourceCount.set(t.length),this._interruptibleKernel.set(i?.implementsInterrupt??!1),this._hasVariableProvider.set(i?.hasVariableProvider??!1),this._notebookKernelSelected.set(!!i),this._notebookKernel.set(i?.id??""),this._selectedKernelDisposables.clear(),i&&this._selectedKernelDisposables.add(i.onDidChange(()=>{this._interruptibleKernel.set(i?.implementsInterrupt??!1)}))}_updateForNotebookOptions(){let i=this._editor.notebookOptions.getDisplayOptions();this._useConsolidatedOutputButton.set(i.consolidatedOutputButton),this._cellToolbarLocation.set(this._editor.notebookOptions.computeCellToolbarLocation(this._editor.textModel?.viewType))}};yOe=I([m(1,Ql),m(2,X),m(3,lt),m(4,Ns)],yOe);var wOe=class extends ju{constructor(e,t,o){super(o);this.notebookEditor=e;this._lanes=3;this._domNode=Ir(document.createElement("canvas")),this._domNode.setPosition("relative"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),t.appendChild(this._domNode.domNode),this._register(e.onDidChangeDecorations(()=>{this.layout()})),this._register(Gu.getInstance(Me(this._domNode.domNode)).onDidChange(()=>{this.layout()}))}layout(){let t=this.notebookEditor.getLayoutInfo(),o=t.scrollHeight,n=t.height,r=Gu.getInstance(Me(this._domNode.domNode)).value;this._domNode.setWidth(10),this._domNode.setHeight(n),this._domNode.domNode.width=10*r,this._domNode.domNode.height=n*r;let s=this._domNode.domNode.getContext("2d");s.clearRect(0,0,10*r,n*r),this._render(s,10*r,n*r,o*r,r)}_render(e,t,o,n,r){let s=this.notebookEditor.getViewModel(),l=this.notebookEditor.getLayoutInfo().fontInfo,c=t/this._lanes,u=0;if(s){for(let h=0;h<s.viewCells.length;h++){let g=s.viewCells[h],f=g.textBuffer,v=g.getCellDecorations(),b=g.layoutInfo.totalHeight/n*r*o;v.filter(S=>S.overviewRuler).forEach(S=>{let y=S.overviewRuler,w=this.getColor(y.color)??"#000000",x=Math.min(l.lineHeight,g.layoutInfo.editorHeight/n/f.getLineCount()*r*o),E=y.modelRanges.map(V=>V.startLineNumber).reduce((V,H)=>((V.length===0||V[V.length-1]!==H)&&V.push(H),V),[]),M=0;switch(y.position){case 1:M=0;break;case 2:M=c;break;case 4:M=c*2;break;default:break}let N=y.position===7?c*3:c;for(let V=0;V<E.length;V++){e.fillStyle=w;let K=(E[V]-1)*x;e.fillRect(M,u+K,N,x)}if(y.includeOutput){e.fillStyle=w;let V=g.layoutInfo.editorHeight/n*r*o,H=l.lineHeight/n*r*o;e.fillRect(c,u+V,c,H)}}),u+=b}let p=s.getOverviewRulerDecorations();for(let h=0;h<p.length;h++){let g=p[h];if(!g.options.overviewRuler)continue;let f=this.notebookEditor.getViewZoneLayoutInfo(g.viewZoneId);if(!f)continue;let v=this.getColor(g.options.overviewRuler.color)??"#000000",b=0;switch(g.options.overviewRuler.position){case 1:b=0;break;case 2:b=c;break;case 4:b=c*2;break;default:break}let S=g.options.overviewRuler.position===7?c*3:c;e.fillStyle=v;let y=f.height/n*r*o,w=f.top/n*r*o;e.fillRect(b,w,S,y)}}}};wOe=I([m(2,Pe)],wOe);var COe=class extends k{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.notebookOptions=t;this.instantiationService=o;this.contextMenuService=n;this.menuService=r;this.viewZone=this._register(new ue);this._modelDisposables=this._register(new O);this.topCellToolbarContainer=_("div"),this.topCellToolbar=_(".cell-list-top-cell-toolbar-container"),this.topCellToolbarContainer.appendChild(this.topCellToolbar),this._register(this.notebookEditor.onDidAttachViewModel(()=>{this.updateTopToolbar()})),this._register(this.notebookOptions.onDidChangeOptions(s=>{(s.insertToolbarAlignment||s.insertToolbarPosition||s.cellToolbarLocation)&&this.updateTopToolbar()}))}updateTopToolbar(){let e=this.notebookOptions.getLayoutConfiguration();if(this.viewZone.value=new O,e.insertToolbarPosition==="hidden"||e.insertToolbarPosition==="notebookToolbar"){let t=this.notebookOptions.computeTopInsertToolbarHeight(this.notebookEditor.textModel?.viewType);t!==0&&this.notebookEditor.changeViewZones(o=>{let n=o.addZone({afterModelPosition:0,heightInPx:t,domNode:_("div")});o.layoutZone(n),this.viewZone.value?.add({dispose:()=>{this.notebookEditor.isDisposed||this.notebookEditor.changeViewZones(r=>{r.removeZone(n)})}})});return}this.notebookEditor.changeViewZones(t=>{let o=this.notebookOptions.computeTopInsertToolbarHeight(this.notebookEditor.textModel?.viewType),n=t.addZone({afterModelPosition:0,heightInPx:o,domNode:this.topCellToolbarContainer});t.layoutZone(n),this.viewZone.value?.add({dispose:()=>{this.notebookEditor.isDisposed||this.notebookEditor.changeViewZones(s=>{s.removeZone(n)})}}),St(this.topCellToolbar);let r=this.instantiationService.createInstance(pr,this.topCellToolbar,this.notebookEditor.creationOptions.menuIds.cellTopInsertToolbar,{actionViewItemProvider:(s,l)=>{if(s instanceof Do)return this.instantiationService.createInstance(CP,s,{hoverDelegate:l.hoverDelegate})},menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:s=>/^inline/.test(s)},hiddenItemStrategy:0});this.notebookEditor.hasModel()&&(r.context={notebookEditor:this.notebookEditor}),this.viewZone.value?.add(r),this.viewZone.value?.add(this.notebookEditor.onDidChangeModel(()=>{this._modelDisposables.clear(),this.notebookEditor.hasModel()&&(this._modelDisposables.add(this.notebookEditor.onDidChangeViewCells(()=>{this.updateClass()})),this.updateClass())})),this.updateClass()})}updateClass(){this.notebookEditor.hasModel()&&this.notebookEditor.getLength()===0?this.topCellToolbar.classList.add("emptyNotebook"):this.topCellToolbar.classList.remove("emptyNotebook")}};COe=I([m(2,F),m(3,Xe),m(4,Yt)],COe);var Vyo=18,eMi=4,Byo=Object.freeze({codeCellLeftMargin:28,cellRunGutter:32,markdownCellTopMargin:8,markdownCellBottomMargin:8,markdownCellLeftMargin:0,markdownCellGutter:32,focusIndicatorLeftMargin:4}),Hyo=Object.freeze({codeCellLeftMargin:8,cellRunGutter:36,markdownCellTopMargin:6,markdownCellBottomMargin:6,markdownCellLeftMargin:8,markdownCellGutter:36,focusIndicatorLeftMargin:4}),P_=class extends k{constructor(e,t,o,n,r,s){super();this.targetWindow=e;this.isReadonly=t;this.overrides=o;this.configurationService=n;this.notebookExecutionStateService=r;this.codeEditorService=s;this._onDidChangeOptions=this._register(new T);this.onDidChangeOptions=this._onDidChangeOptions.event;this._editorTopPadding=12;this.previousModelToCompare=De("previousModelToCompare",void 0);let l=this.configurationService.getValue(Ct.showCellStatusBar),c=o?.globalToolbar??this.configurationService.getValue(Ct.globalToolbar)??!0,u=o?.stickyScrollEnabled??this.configurationService.getValue(Ct.stickyScrollEnabled)??!1,p=this._computeStickyScrollModeOption(),h=this.configurationService.getValue(Ct.consolidatedOutputButton)??!0,g=this.configurationService.getValue(Ct.consolidatedRunButton)??!1,f=o?.dragAndDropEnabled??this.configurationService.getValue(Ct.dragAndDropEnabled)??!0,v=this.configurationService.getValue(Ct.cellToolbarLocation)??{default:"right"},b=o?.cellToolbarInteraction??this.configurationService.getValue(Ct.cellToolbarVisibility),S=this.configurationService.getValue(Ct.compactView)??!0,y=this._computeFocusIndicatorOption(),w=this._computeInsertToolbarPositionOption(this.isReadonly),x=this._computeInsertToolbarAlignmentOption(),E=this._computeShowFoldingControlsOption(),M=this.configurationService.getValue("editor.fontSize"),N=this.configurationService.getValue(Ct.markupFontSize),V=this.configurationService.getValue(Ct.markdownLineHeight),H=this.configurationService.getValue(Ct.cellEditorOptionsCustomizations)??{};H=Di(H)?H:{};let K=this.configurationService.getValue(Ct.interactiveWindowCollapseCodeCells),j,J=this.configurationService.getValue(Ct.outputLineHeightDeprecated);J!==void 0?(this._migrateDeprecatedSetting(Ct.outputLineHeightDeprecated,Ct.outputLineHeight),j=J):j=this.configurationService.getValue(Ct.outputLineHeight);let se,ae=this.configurationService.getValue(Ct.outputFontSizeDeprecated);ae!==void 0?(this._migrateDeprecatedSetting(Ct.outputFontSizeDeprecated,Ct.outputFontSize),se=ae):se=this.configurationService.getValue(Ct.outputFontSize)||M;let ce,Se=this.configurationService.getValue(Ct.outputFontFamilyDeprecated);Se!==void 0?(this._migrateDeprecatedSetting(Ct.outputFontFamilyDeprecated,Ct.outputFontFamily),ce=Se):ce=this.configurationService.getValue(Ct.outputFontFamily);let Re,xe=this.configurationService.getValue(Ct.outputScrollingDeprecated);xe!==void 0?(this._migrateDeprecatedSetting(Ct.outputScrollingDeprecated,Ct.outputScrolling),Re=xe):Re=this.configurationService.getValue(Ct.outputScrolling);let He=this._computeOutputLineHeight(j,se),Ee=this.configurationService.getValue(Ct.outputWordWrap),Te=this.configurationService.getValue(Ct.textOutputLineLimit)??30,It=this.configurationService.getValue(Ct.LinkifyOutputFilePaths)??!0,tt=this.configurationService.getValue(Ct.minimalErrorRendering),Oi=this.configurationService.getValue(Ct.markupFontFamily),zt=this._computeEditorTopPadding();this._layoutConfiguration={...S?Hyo:Byo,cellTopMargin:6,cellBottomMargin:6,cellRightMargin:16,cellStatusBarHeight:22,cellOutputPadding:8,markdownPreviewPadding:8,editorToolbarHeight:0,editorTopPadding:zt,editorBottomPadding:4,editorBottomPaddingWithoutStatusBar:12,collapsedIndicatorHeight:28,showCellStatusBar:l,globalToolbar:c,stickyScrollEnabled:u,stickyScrollMode:p,consolidatedOutputButton:h,consolidatedRunButton:g,dragAndDropEnabled:f,cellToolbarLocation:v,cellToolbarInteraction:b,compactView:S,focusIndicator:y,insertToolbarPosition:w,insertToolbarAlignment:x,showFoldingControls:E,fontSize:M,outputFontSize:se,outputFontFamily:ce,outputLineHeight:He,markupFontSize:N,markdownLineHeight:V,editorOptionsCustomizations:H,focusIndicatorGap:3,interactiveWindowCollapseCodeCells:K,markdownFoldHintHeight:22,outputScrolling:Re,outputWordWrap:Ee,outputLineLimit:Te,outputLinkifyFilePaths:It,outputMinimalError:tt,markupFontFamily:Oi,disableRulers:o?.disableRulers},this._register(this.configurationService.onDidChangeConfiguration(mo=>{this._updateConfiguration(mo)}))}updateOptions(e){this.isReadonly!==e&&(this.isReadonly=e,this._updateConfiguration({affectsConfiguration(t){return t===Ct.insertToolbarLocation},source:7,affectedKeys:new Set([Ct.insertToolbarLocation]),change:{keys:[Ct.insertToolbarLocation],overrides:[]}}))}_computeEditorTopPadding(){let e=!1,t=r=>{this._editorTopPadding=r;let s=Object.assign({},this._layoutConfiguration);s.editorTopPadding=this._editorTopPadding,this._layoutConfiguration=s,this._onDidChangeOptions.fire({editorTopPadding:!0})},o=new Set,n=r=>{if(!e&&!o.has(r))try{let s=this.codeEditorService.resolveDecorationOptions(r,!0);if(s.afterContentClassName||s.beforeContentClassName){let l=this.codeEditorService.resolveDecorationCSSRules(r);if(l!==null){for(let c=0;c<l.length;c++)if((l[c].selectorText.endsWith("::after")||l[c].selectorText.endsWith("::after"))&&l[c].cssText.indexOf("top:")>-1){let u=this.configurationService.getValue("editor");t(RI(u,Gu.getInstance(this.targetWindow).value).lineHeight+2),e=!0;break}}}o.add(r)}catch{}};return this._register(this.codeEditorService.onDecorationTypeRegistered(n)),this.codeEditorService.listDecorationTypes().forEach(n),this._editorTopPadding}_migrateDeprecatedSetting(e,t){let o=this.configurationService.inspect(e);o.application!==void 0&&(this.configurationService.updateValue(e,void 0,1),this.configurationService.updateValue(t,o.application.value,1)),o.user!==void 0&&(this.configurationService.updateValue(e,void 0,2),this.configurationService.updateValue(t,o.user.value,2)),o.userLocal!==void 0&&(this.configurationService.updateValue(e,void 0,3),this.configurationService.updateValue(t,o.userLocal.value,3)),o.userRemote!==void 0&&(this.configurationService.updateValue(e,void 0,4),this.configurationService.updateValue(t,o.userRemote.value,4)),o.workspace!==void 0&&(this.configurationService.updateValue(e,void 0,5),this.configurationService.updateValue(t,o.workspace.value,5)),o.workspaceFolder!==void 0&&(this.configurationService.updateValue(e,void 0,6),this.configurationService.updateValue(t,o.workspaceFolder.value,6))}_computeOutputLineHeight(e,t){if(e===0){let n=this.configurationService.getValue("editor");e=zw.readFontInfo(this.targetWindow,RI(n,Gu.getInstance(this.targetWindow).value)).lineHeight}else if(e<9){let n=t;n===0&&(n=this.configurationService.getValue("editor.fontSize")),e=e*n}return e=Math.round(e),e<9&&(e=9),e}_updateConfiguration(e){let t=e.affectsConfiguration(Ct.showCellStatusBar),o=e.affectsConfiguration(Ct.cellToolbarLocation),n=e.affectsConfiguration(Ct.cellToolbarVisibility),r=e.affectsConfiguration(Ct.compactView),s=e.affectsConfiguration(Ct.focusIndicator),l=e.affectsConfiguration(Ct.insertToolbarLocation),c=e.affectsConfiguration(Ct.experimentalInsertToolbarAlignment),u=e.affectsConfiguration(Ct.globalToolbar),p=e.affectsConfiguration(Ct.stickyScrollEnabled),h=e.affectsConfiguration(Ct.stickyScrollMode),g=e.affectsConfiguration(Ct.consolidatedOutputButton),f=e.affectsConfiguration(Ct.consolidatedRunButton),v=e.affectsConfiguration(Ct.showFoldingControls),b=e.affectsConfiguration(Ct.dragAndDropEnabled),S=e.affectsConfiguration("editor.fontSize"),y=e.affectsConfiguration(Ct.outputFontSize),w=e.affectsConfiguration(Ct.markupFontSize),x=e.affectsConfiguration(Ct.markdownLineHeight),E=e.affectsConfiguration("editor.fontFamily"),M=e.affectsConfiguration(Ct.outputFontFamily),N=e.affectsConfiguration(Ct.cellEditorOptionsCustomizations),V=e.affectsConfiguration(Ct.interactiveWindowCollapseCodeCells),H=e.affectsConfiguration(Ct.outputLineHeight),K=e.affectsConfiguration(Ct.outputScrolling),j=e.affectsConfiguration(Ct.outputWordWrap),J=e.affectsConfiguration(Ct.LinkifyOutputFilePaths),se=e.affectsConfiguration(Ct.minimalErrorRendering),ae=e.affectsConfiguration(Ct.markupFontFamily);if(!t&&!o&&!n&&!r&&!s&&!l&&!c&&!u&&!p&&!h&&!g&&!f&&!v&&!b&&!S&&!y&&!w&&!x&&!E&&!M&&!N&&!V&&!H&&!K&&!j&&!J&&!se&&!ae)return;let ce=Object.assign({},this._layoutConfiguration);if(t&&(ce.showCellStatusBar=this.configurationService.getValue(Ct.showCellStatusBar)),o&&(ce.cellToolbarLocation=this.configurationService.getValue(Ct.cellToolbarLocation)??{default:"right"}),n&&!this.overrides?.cellToolbarInteraction&&(ce.cellToolbarInteraction=this.configurationService.getValue(Ct.cellToolbarVisibility)),s&&(ce.focusIndicator=this._computeFocusIndicatorOption()),r){let Se=this.configurationService.getValue(Ct.compactView)??!0;ce=Object.assign(ce,{...Se?Hyo:Byo}),ce.compactView=Se}if(c&&(ce.insertToolbarAlignment=this._computeInsertToolbarAlignmentOption()),l&&(ce.insertToolbarPosition=this._computeInsertToolbarPositionOption(this.isReadonly)),u&&this.overrides?.globalToolbar===void 0&&(ce.globalToolbar=this.configurationService.getValue(Ct.globalToolbar)??!0),p&&this.overrides?.stickyScrollEnabled===void 0&&(ce.stickyScrollEnabled=this.configurationService.getValue(Ct.stickyScrollEnabled)??!1),h&&(ce.stickyScrollMode=this.configurationService.getValue(Ct.stickyScrollMode)??"flat"),g&&(ce.consolidatedOutputButton=this.configurationService.getValue(Ct.consolidatedOutputButton)??!0),f&&(ce.consolidatedRunButton=this.configurationService.getValue(Ct.consolidatedRunButton)??!0),v&&(ce.showFoldingControls=this._computeShowFoldingControlsOption()),b&&(ce.dragAndDropEnabled=this.configurationService.getValue(Ct.dragAndDropEnabled)??!0),S&&(ce.fontSize=this.configurationService.getValue("editor.fontSize")),(y||S)&&(ce.outputFontSize=this.configurationService.getValue(Ct.outputFontSize)||ce.fontSize),w&&(ce.markupFontSize=this.configurationService.getValue(Ct.markupFontSize)),x&&(ce.markdownLineHeight=this.configurationService.getValue(Ct.markdownLineHeight)),M&&(ce.outputFontFamily=this.configurationService.getValue(Ct.outputFontFamily)),N&&(ce.editorOptionsCustomizations=this.configurationService.getValue(Ct.cellEditorOptionsCustomizations)),V&&(ce.interactiveWindowCollapseCodeCells=this.configurationService.getValue(Ct.interactiveWindowCollapseCodeCells)),H||S||y){let Se=this.configurationService.getValue(Ct.outputLineHeight);ce.outputLineHeight=this._computeOutputLineHeight(Se,ce.outputFontSize)}j&&(ce.outputWordWrap=this.configurationService.getValue(Ct.outputWordWrap)),K&&(ce.outputScrolling=this.configurationService.getValue(Ct.outputScrolling)),J&&(ce.outputLinkifyFilePaths=this.configurationService.getValue(Ct.LinkifyOutputFilePaths)),se&&(ce.outputMinimalError=this.configurationService.getValue(Ct.minimalErrorRendering)),ae&&(ce.markupFontFamily=this.configurationService.getValue(Ct.markupFontFamily)),this._layoutConfiguration=Object.freeze(ce),this._onDidChangeOptions.fire({cellStatusBarVisibility:t,cellToolbarLocation:o,cellToolbarInteraction:n,compactView:r,focusIndicator:s,insertToolbarPosition:l,insertToolbarAlignment:c,globalToolbar:u,stickyScrollEnabled:p,stickyScrollMode:h,showFoldingControls:v,consolidatedOutputButton:g,consolidatedRunButton:f,dragAndDropEnabled:b,fontSize:S,outputFontSize:y,markupFontSize:w,markdownLineHeight:x,fontFamily:E,outputFontFamily:M,editorOptionsCustomizations:N,interactiveWindowCollapseCodeCells:V,outputLineHeight:H,outputScrolling:K,outputWordWrap:j,outputLinkifyFilePaths:J,minimalError:se,markupFontFamily:ae})}_computeInsertToolbarPositionOption(e){return e?"hidden":this.configurationService.getValue(Ct.insertToolbarLocation)??"both"}_computeInsertToolbarAlignmentOption(){return this.configurationService.getValue(Ct.experimentalInsertToolbarAlignment)??"center"}_computeShowFoldingControlsOption(){return this.configurationService.getValue(Ct.showFoldingControls)??"mouseover"}_computeFocusIndicatorOption(){return this.configurationService.getValue(Ct.focusIndicator)??"gutter"}_computeStickyScrollModeOption(){return this.configurationService.getValue(Ct.stickyScrollMode)??"flat"}getCellCollapseDefault(){return this._layoutConfiguration.interactiveWindowCollapseCodeCells==="never"?{codeCell:{inputCollapsed:!1}}:{codeCell:{inputCollapsed:!0}}}getLayoutConfiguration(){return this._layoutConfiguration}getDisplayOptions(){return this._layoutConfiguration}getCellEditorContainerLeftMargin(){let{codeCellLeftMargin:e,cellRunGutter:t}=this._layoutConfiguration;return e+t}computeCollapsedMarkdownCellHeight(e){let{bottomToolbarGap:t}=this.computeBottomToolbarDimensions(e);return this._layoutConfiguration.markdownCellTopMargin+this._layoutConfiguration.collapsedIndicatorHeight+t+this._layoutConfiguration.markdownCellBottomMargin}computeBottomToolbarOffset(e,t){let{bottomToolbarGap:o,bottomToolbarHeight:n}=this.computeBottomToolbarDimensions(t);return e-o-n/2}computeCodeCellEditorWidth(e){return e-(this._layoutConfiguration.codeCellLeftMargin+this._layoutConfiguration.cellRunGutter+this._layoutConfiguration.cellRightMargin)}computeMarkdownCellEditorWidth(e){return e-this._layoutConfiguration.markdownCellGutter-this._layoutConfiguration.markdownCellLeftMargin-this._layoutConfiguration.cellRightMargin}computeStatusBarHeight(){return this._layoutConfiguration.cellStatusBarHeight}_computeBottomToolbarDimensions(e,t,o,n){return o==="left"||n!=="hidden"?{bottomToolbarGap:18,bottomToolbarHeight:18}:t==="betweenCells"||t==="both"?e?{bottomToolbarGap:12,bottomToolbarHeight:20}:{bottomToolbarGap:20,bottomToolbarHeight:20}:{bottomToolbarGap:0,bottomToolbarHeight:0}}computeBottomToolbarDimensions(e){let t=this._layoutConfiguration,o=this.computeCellToolbarLocation(e),{bottomToolbarGap:n,bottomToolbarHeight:r}=this._computeBottomToolbarDimensions(t.compactView,t.insertToolbarPosition,t.insertToolbarAlignment,o);return{bottomToolbarGap:n,bottomToolbarHeight:r}}computeCellToolbarLocation(e){let t=this._layoutConfiguration.cellToolbarLocation;if(typeof t=="string"){if(t==="left"||t==="right"||t==="hidden")return t}else if(e){let o=t[e]??t.default,n="right";switch(o){case"left":n="left";break;case"right":n="right";break;case"hidden":n="hidden";break;default:n="right";break}return n}return"right"}computeTopInsertToolbarHeight(e){if(this._layoutConfiguration.insertToolbarPosition==="betweenCells"||this._layoutConfiguration.insertToolbarPosition==="both")return Vyo;let t=this.computeCellToolbarLocation(e);return t==="left"||t==="right"?Vyo:0}computeEditorPadding(e,t){return{top:this._editorTopPadding,bottom:this.statusBarIsVisible(e,t)?this._layoutConfiguration.editorBottomPadding:this._layoutConfiguration.editorBottomPaddingWithoutStatusBar}}computeEditorStatusbarHeight(e,t){return this.statusBarIsVisible(e,t)?this.computeStatusBarHeight():0}statusBarIsVisible(e,t){let o=this.notebookExecutionStateService.getCellExecution(t);return this._layoutConfiguration.showCellStatusBar==="visible"?!0:this._layoutConfiguration.showCellStatusBar==="visibleAfterExecute"?typeof e.lastRunSuccess=="boolean"||o!==void 0:!1}computeWebviewOptions(){return{outputNodePadding:this._layoutConfiguration.cellOutputPadding,outputNodeLeftPadding:this._layoutConfiguration.cellOutputPadding,previewNodePadding:this._layoutConfiguration.markdownPreviewPadding,markdownLeftMargin:this._layoutConfiguration.markdownCellGutter+this._layoutConfiguration.markdownCellLeftMargin,leftMargin:this._layoutConfiguration.codeCellLeftMargin,rightMargin:this._layoutConfiguration.cellRightMargin,runGutter:this._layoutConfiguration.cellRunGutter,dragAndDropEnabled:this._layoutConfiguration.dragAndDropEnabled,fontSize:this._layoutConfiguration.fontSize,outputFontSize:this._layoutConfiguration.outputFontSize,outputFontFamily:this._layoutConfiguration.outputFontFamily,markupFontSize:this._layoutConfiguration.markupFontSize,markdownLineHeight:this._layoutConfiguration.markdownLineHeight,outputLineHeight:this._layoutConfiguration.outputLineHeight,outputScrolling:this._layoutConfiguration.outputScrolling,outputWordWrap:this._layoutConfiguration.outputWordWrap,outputLineLimit:this._layoutConfiguration.outputLineLimit,outputLinkifyFilePaths:this._layoutConfiguration.outputLinkifyFilePaths,minimalError:this._layoutConfiguration.outputMinimalError,markupFontFamily:this._layoutConfiguration.markupFontFamily}}computeDiffWebviewOptions(){return{outputNodePadding:this._layoutConfiguration.cellOutputPadding,outputNodeLeftPadding:0,previewNodePadding:this._layoutConfiguration.markdownPreviewPadding,markdownLeftMargin:0,leftMargin:32,rightMargin:0,runGutter:0,dragAndDropEnabled:!1,fontSize:this._layoutConfiguration.fontSize,outputFontSize:this._layoutConfiguration.outputFontSize,outputFontFamily:this._layoutConfiguration.outputFontFamily,markupFontSize:this._layoutConfiguration.markupFontSize,markdownLineHeight:this._layoutConfiguration.markdownLineHeight,outputLineHeight:this._layoutConfiguration.outputLineHeight,outputScrolling:this._layoutConfiguration.outputScrolling,outputWordWrap:this._layoutConfiguration.outputWordWrap,outputLineLimit:this._layoutConfiguration.outputLineLimit,outputLinkifyFilePaths:!1,minimalError:!1,markupFontFamily:this._layoutConfiguration.markupFontFamily}}computeIndicatorPosition(e,t,o){let{bottomToolbarGap:n}=this.computeBottomToolbarDimensions(o);return{bottomIndicatorTop:e-n-this._layoutConfiguration.cellBottomMargin-t,verticalIndicatorHeight:e-n-t}}};P_=I([m(3,B),m(4,Ns),m(5,Qt)],P_);var y2t=class a extends k{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookOptions=t;this.configurationService=o;this.language=n;this._localDisposableStore=this._register(new O);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(o.onDidChangeConfiguration(r=>{(r.affectsConfiguration("editor")||r.affectsConfiguration("notebook"))&&this._recomputeOptions()})),this._register(t.onDidChangeOptions(r=>{(r.cellStatusBarVisibility||r.editorTopPadding||r.editorOptionsCustomizations)&&this._recomputeOptions()})),this._register(this.notebookEditor.onDidChangeModel(()=>{this._localDisposableStore.clear(),this.notebookEditor.hasModel()&&(this._localDisposableStore.add(this.notebookEditor.onDidChangeOptions(()=>{this._recomputeOptions()})),this._recomputeOptions())})),this.notebookEditor.hasModel()&&this._localDisposableStore.add(this.notebookEditor.onDidChangeOptions(()=>{this._recomputeOptions()})),this._value=this._computeEditorOptions()}static{this.fixedEditorOptions={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},renderLineHighlightOnlyWhenFocus:!0,overviewRulerLanes:0,lineDecorationsWidth:0,folding:!0,fixedOverflowWidgets:!0,minimap:{enabled:!1},renderValidationDecorations:"on",lineNumbersMinChars:3}}get value(){return this._value}_recomputeOptions(){this._value=this._computeEditorOptions(),this._onDidChange.fire()}_computeEditorOptions(){let e=io(this.configurationService.getValue("editor",{overrideIdentifier:this.language})),t=this.notebookOptions.getDisplayOptions().editorOptionsCustomizations,o={};if(t)for(let r in t)r.indexOf("editor.")===0&&(o[r.substring(7)]=t[r]);return Object.freeze({...e,...a.fixedEditorOptions,...o,padding:{top:12,bottom:12},readOnly:this.notebookEditor.isReadOnly})}};var mfe=class{constructor(i,e,t,o,n,r,s,l){this.index=i;this.level=e;this.cell=t;this.label=o;this.isExecuting=n;this.isPaused=r;this.range=s;this.symbolKind=l;this._children=[]}get icon(){return this.symbolKind?Zm.toIcon(this.symbolKind):this.isExecuting&&this.isPaused?FC:this.isExecuting?q.modify(FC,"spin"):this.cell.cellKind===1?L.markdown:L.code}addChild(i){this._children.push(i),i._parent=this}get parent(){return this._parent}get children(){return this._children}get markerInfo(){return this._markerInfo}get position(){if(this.range)return{startLineNumber:this.range.startLineNumber,startColumn:this.range.startColumn}}updateMarkers(i){if(this.cell.cellKind===2){let e=i.read({resource:this.cell.uri,severities:12});if(e.length===0)this._markerInfo=void 0;else{let t=e.find(o=>o.severity===8)?.severity??4;this._markerInfo={topSev:t,count:e.length}}}else{let e;for(let t of this.children)t.updateMarkers(i),t.markerInfo&&(e=e?Math.max(t.markerInfo.topSev,e):t.markerInfo.topSev);this._markerInfo=e&&{topSev:e,count:0}}}clearMarkers(){this._markerInfo=void 0;for(let i of this.children)i.clearMarkers()}find(i,e){if(i.id===this.cell.id)return this;e.push(this);for(let t of this.children){let o=t.find(i,e);if(o)return o}e.pop()}asFlatList(i){i.push(this);for(let e of this.children)e.asFlatList(i)}};function zan(a){let i=Array.from($Li(a));if(i.length)return i;let e=a.match(/<h([1-6]).*>(.*)<\/h\1>/i);if(e){let t=parseInt(e[1]),o=e[2].trim();i.push({depth:t,text:o})}return i}var w2t=le("INotebookOutlineEntryFactory"),xOe=class{constructor(i,e,t){this.executionStateService=i;this.outlineModelService=e;this.textModelService=t;this.cellOutlineEntryCache={};this.cachedMarkdownOutlineEntries=new WeakMap}getOutlineEntries(i,e){let t=[],o=i.cellKind===1,n=Kan(i),r=!1;if(o){let s=i.getText().substring(0,1e4),l=this.cachedMarkdownOutlineEntries.get(i),c=l?.alternativeId===i.getAlternativeId()?l.headers:Array.from(zan(s));this.cachedMarkdownOutlineEntries.set(i,{alternativeId:i.getAlternativeId(),headers:c});for(let{depth:u,text:p}of c)r=!0,t.push(new mfe(e++,u,i,p,!1,!1));r||(n=ma({value:n}))}if(!r){let s=!o&&this.executionStateService.getCellExecution(i.uri),l=n.trim();if(!o){let c=this.cellOutlineEntryCache[i.id];c&&(t.push(new mfe(e++,7,i,l,!!s,s?s.isPaused:!1)),c.forEach(u=>{t.push(new mfe(e++,u.level,i,u.name,!1,!1,u.range,u.kind))}))}t.length===0&&(l.length===0&&(l=d(13962,null)),t.push(new mfe(e++,7,i,l,!!s,s?s.isPaused:!1)))}return t}async cacheSymbols(i,e){if(i.cellKind===1)return;let t=await this.textModelService.createModelReference(i.uri);try{let o=t.object.textEditorModel,n=await this.outlineModelService.getOrCreate(o,e),r=Uyo(n.getTopLevelSymbols(),8);this.cellOutlineEntryCache[i.id]=r}finally{t.dispose()}}};xOe=I([m(0,Ns),m(1,kx),m(2,Bt)],xOe);function Uyo(a,i){let e=[];return a.forEach(t=>{e.push({name:t.name,range:t.range,level:i,kind:t.kind}),t.children&&e.push(...Uyo(t.children,i+1))}),e}function Kan(a){let i=a.textBuffer;for(let e=0;e<i.getLineCount();e++){let t=i.getLineFirstNonWhitespaceColumn(e+1),o=i.getLineLength(e+1);if(t<o)return i.getLineContent(e+1)}return a.getText().substring(0,100)}var kOe=class{constructor(i,e,t,o){this._editor=i;this._markerService=e;this._configurationService=t;this._outlineEntryFactory=o;this._disposables=new O;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._entries=[];this.recomputeState()}get activeElement(){return this._activeEntry}get entries(){return this._entries}get isEmpty(){return this._entries.length===0}get uri(){return this._uri}async computeFullSymbols(i){try{let t=this._editor?.getViewModel()?.viewCells.filter(o=>o.cellKind===2);if(t){let o=[];for(let n of t.slice(0,50))o.push(this._outlineEntryFactory.cacheSymbols(n,i));await Promise.allSettled(o)}this.recomputeState()}catch(e){console.error("Failed to compute notebook outline symbols:",e),this.recomputeState()}}recomputeState(){if(this._disposables.clear(),this._activeEntry=void 0,this._uri=void 0,!this._editor.hasModel())return;this._uri=this._editor.textModel.uri;let i=this._editor;if(i.getLength()===0)return;let e=i.getViewModel().viewCells,t=[];for(let s of e)t.push(...this._outlineEntryFactory.getOutlineEntries(s,t.length));if(t.length>0){let s=[t[0]],l=[t[0]];for(let c=1;c<t.length;c++){let u=t[c];for(;;){let p=l.length;if(p===0){s.push(u),l.push(u);break}else{let h=l[p-1];if(h.level<u.level){h.addChild(u),l.push(u);break}else l.pop()}}}this._entries=s}let o=new ue;this._disposables.add(o);let n=()=>{if(i.isDisposed)return;let s=u=>{for(let p of this._entries)u?p.clearMarkers():p.updateMarkers(this._markerService)},l=this._configurationService.getValue("problems.visibility");if(l===void 0)return;let c=this._configurationService.getValue("outline.problems.enabled");l&&c?(o.value=this._markerService.onMarkerChanged(u=>{if(i.isDisposed){console.error("notebook editor is disposed");return}u.some(p=>i.getCellsInRange().some(h=>ze(h.uri,p)))&&(s(!1),this._onDidChange.fire({}))}),s(!1)):(o.clear(),s(!0))};n(),this._disposables.add(this._configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration("problems.visibility")||s.affectsConfiguration("outline.problems.enabled"))&&(n(),this._onDidChange.fire({}))}));let{changeEventTriggered:r}=this.recomputeActive();r||this._onDidChange.fire({})}recomputeActive(){let i,e=this._editor;if(e&&e.hasModel()&&e.getLength()>0){let t=e.cellAt(e.getFocus().start);if(t){for(let o of this._entries)if(i=o.find(t,[]),i)break}}return i!==this._activeEntry?(this._activeEntry=i,this._onDidChange.fire({affectOnlyActiveElement:!0}),{changeEventTriggered:!0}):{changeEventTriggered:!1}}dispose(){this._entries.length=0,this._activeEntry=void 0,this._disposables.dispose(),this._onDidChange.dispose()}};kOe=I([m(1,ha),m(2,B),m(3,w2t)],kOe);var srt=class extends ix{constructor(e){super();this.instantiationService=e}createReferencedObject(e,t){return this.instantiationService.createInstance(kOe,t)}destroyReferencedObject(e,t){t.dispose()}};srt=I([m(0,F)],srt);var TOe=le("INotebookCellOutlineDataSourceFactory"),EOe=class{constructor(i){this._data=i.createInstance(srt)}getOrCreate(i){return this._data.acquire(i.getId(),i)}};EOe=I([m(0,F)],EOe);var x2t=class a extends k{constructor(e,t,o,n,r){super();this.element=e;this.foldingIcon=t;this.header=o;this.entry=n;this.notebookEditor=r;this._register($(this.header,ne.CLICK||Vn.Tap,()=>{this.focusCell()})),this._register($(this.foldingIcon.domNode,ne.CLICK||Vn.Tap,()=>{if(this.entry.cell.cellKind===1){let s=this.entry.cell.foldingState;this.toggleFoldRange(s)}}))}toggleFoldRange(e){let t=this.notebookEditor.getContribution(xP.id),o=this.entry.index,n=this.entry.level,r=e===2?1:2;t.setFoldingStateDown(o,r,n),this.focusCell()}focusCell(){this.notebookEditor.focusNotebookCell(this.entry.cell,"container");let e=this.notebookEditor.getAbsoluteTopOfElement(this.entry.cell),t=a.getParentCount(this.entry);this.notebookEditor.setScrollTop(e-(t+1.1)*22)}static getParentCount(e){let t=0;for(;e.parent;)t++,e=e.parent;return t}},tMi=class{constructor(i,e){this.isCollapsed=i;this.dimension=e;this.domNode=document.createElement("div"),this.domNode.style.width=`${e}px`,this.domNode.style.height=`${e}px`,this.domNode.className=q.asClassName(i?Iue:Sue)}setVisible(i){this.domNode.style.cursor=i?"pointer":"default",this.domNode.style.opacity=i?"1":"0"}},Iw=class extends k{constructor(e,t,o,n,r,s){super();this.domNode=e;this.notebookEditor=t;this.notebookCellList=o;this.layoutFn=n;this._contextMenuService=r;this.instantiationService=s;this._disposables=new O;this.currentStickyLines=new Map;this._onDidChangeNotebookStickyScroll=this._register(new T);this.onDidChangeNotebookStickyScroll=this._onDidChangeNotebookStickyScroll.event;this._layoutDisposableStore=this._register(new O);this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled&&this.init().catch(console.error),this._register(this.notebookEditor.notebookOptions.onDidChangeOptions(l=>{(l.stickyScrollEnabled||l.stickyScrollMode)&&this.updateConfig(l)})),this._register($(this.domNode,ne.CONTEXT_MENU,async l=>{this.onContextMenu(l)})),this._register($(this.domNode,ne.WHEEL,l=>{this.notebookCellList.triggerScrollFromMouseWheelEvent(l)}))}getDomNode(){return this.domNode}getCurrentStickyHeight(){let e=0;return this.currentStickyLines.forEach(t=>{t.rendered&&(e+=22)}),e}setCurrentStickyLines(e){this.currentStickyLines=e}compareStickyLineMaps(e,t){if(e.size!==t.size)return!1;for(let[o,n]of e){let r=t.get(o);if(!r||n.rendered!==r.rendered)return!1}return!0}onContextMenu(e){let t=new Ln(Me(this.domNode),e),o=t.target.parentElement,n=Array.from(this.currentStickyLines.values()).find(s=>s.line.element.contains(o))?.line.entry;if(!n)return;let r={outlineEntry:n,notebookEditor:this.notebookEditor};this._contextMenuService.showContextMenu({menuId:R.NotebookStickyScrollContext,getAnchor:()=>t,menuActionOptions:{shouldForwardArgs:!0,arg:r,renderShortTitle:!0}})}updateConfig(e){e.stickyScrollEnabled?this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled?this.init().catch(console.error):(this._disposables.clear(),this.notebookCellOutlineReference?.dispose(),this.disposeCurrentStickyLines(),St(this.domNode),this.updateDisplay()):e.stickyScrollMode&&this.notebookEditor.notebookOptions.getDisplayOptions().stickyScrollEnabled&&this.notebookCellOutlineReference?.object&&this.updateContent(art(this.notebookEditor,this.notebookCellList,this.notebookCellOutlineReference?.object?.entries,this.getCurrentStickyHeight()))}async init(){let{object:e}=this.notebookCellOutlineReference=this.instantiationService.invokeFunction(o=>o.get(TOe).getOrCreate(this.notebookEditor));this._register(this.notebookCellOutlineReference),await e.computeFullSymbols(Ie.None);let t=art(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.updateContent(t),this._disposables.add(e.onDidChange(()=>{let o=art(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.compareStickyLineMaps(o,this.currentStickyLines)?this.disposeStickyLineMap(o):this.updateContent(o)})),this._disposables.add(this.notebookEditor.onDidAttachViewModel(async()=>{await e.computeFullSymbols(Ie.None);let o=art(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.updateContent(o)})),this._disposables.add(this.notebookEditor.onDidScroll(()=>{let o=new rn(100);o.trigger(()=>{o.dispose();let n=art(this.notebookEditor,this.notebookCellList,e.entries,this.getCurrentStickyHeight());this.compareStickyLineMaps(n,this.currentStickyLines)?this.disposeStickyLineMap(n):this.updateContent(n)})}))}disposeStickyLineMap(e){e.forEach(t=>{t.line&&t.line.dispose()})}static getVisibleOutlineEntry(e,t){let o=0,n=t.length-1;for(;o<=n;){let r=Math.floor((o+n)/2);if(t[r].index===e){let s=t[r],l=[];return s.asFlatList(l),l.find(c=>c.index===e)}else t[r].index<e?o=r+1:n=r-1}if(n>=0){let r=t[n],s=[];return r.asFlatList(s),s.find(l=>l.index===e)}}updateContent(e){St(this.domNode),this.disposeCurrentStickyLines(),this.renderStickyLines(e,this.domNode);let t=this.getCurrentStickyHeight();this.setCurrentStickyLines(e);let o=this.getCurrentStickyHeight()-t;if(o!==0){this._onDidChangeNotebookStickyScroll.fire(o);let n=this._layoutDisposableStore.add(kr(Me(this.getDomNode()),()=>{this.layoutFn(o),this.updateDisplay(),this._layoutDisposableStore.delete(n)}))}else this.updateDisplay()}updateDisplay(){this.getCurrentStickyHeight()>0?this.domNode.style.display="block":this.domNode.style.display="none"}static computeStickyHeight(e){let t=0;for(e.cell.cellKind===1&&e.level<7&&(t+=22);e.parent;)t+=22,e=e.parent;return t}static checkCollapsedStickyLines(e,t,o){let n=e,r=new Map,s=[];for(;n;){if(n.level>=7){n=n.parent;continue}let l=Iw.createStickyElement(n,o);r.set(n,{line:l,rendered:!1}),s.unshift(l),n=n.parent}for(let l=0;l<s.length&&!(l>=t);l++)r.set(s[l].entry,{line:s[l],rendered:!0});return r}renderStickyLines(e,t){let o=Array.from(e.entries()).reverse();for(let[,n]of o)n.rendered&&t.append(n.line.element)}static createStickyElement(e,t){let o=document.createElement("div");o.classList.add("notebook-sticky-scroll-element"),t.notebookOptions.getLayoutConfiguration().stickyScrollMode==="indented"&&(o.style.paddingLeft=x2t.getParentCount(e)*10+"px");let r=!1;e.cell.cellKind===1&&(r=e.cell.foldingState===2);let s=new tMi(r,16);s.domNode.classList.add("notebook-sticky-scroll-folding-icon"),s.setVisible(!0);let l=document.createElement("div");return l.classList.add("notebook-sticky-scroll-header"),l.innerText=e.label,o.append(s.domNode,l),new x2t(o,s,l,e,t)}disposeCurrentStickyLines(){this.currentStickyLines.forEach(e=>{e.line.dispose()})}dispose(){this._disposables.dispose(),this.disposeCurrentStickyLines(),this.notebookCellOutlineReference?.dispose(),super.dispose()}};Iw=I([m(4,Xe),m(5,F)],Iw);function art(a,i,e,t){let o=a.scrollTop-t,n=a.visibleRanges[0];if(!n)return new Map;if(n.start===0){let h=a.cellAt(0),g=Iw.getVisibleOutlineEntry(0,e);if(h&&g&&h.cellKind===1&&g.level<7&&a.scrollTop>22)return Iw.checkCollapsedStickyLines(g,100,a)}let r,s,l=n.start-1;for(let h=l;h<n.end;h++){if(r=a.cellAt(h),!r)return new Map;if(s=Iw.getVisibleOutlineEntry(h,e),!s)continue;let g=a.cellAt(h+1);if(!g){let v=a.getLayoutInfo().scrollHeight,b=Math.floor(v/22);return Iw.checkCollapsedStickyLines(s,b,a)}let f=Iw.getVisibleOutlineEntry(h+1,e);if(f&&g.cellKind===1&&f.level<7){let v=i.getCellViewScrollTop(g),b=Iw.computeStickyHeight(s),S=Iw.computeStickyHeight(f);if(o+b<v){let y=Math.floor((v-o)/22);return Iw.checkCollapsedStickyLines(s,y,a)}else{if(S>=b)return Iw.checkCollapsedStickyLines(f,100,a);if(S<b){let y=v-o;if(y>=S){let w=Math.floor(y/22);return Iw.checkCollapsedStickyLines(s,w,a)}else return Iw.checkCollapsedStickyLines(f,100,a)}}}}let c=a.getLayoutInfo().scrollHeight,u=Math.floor((c-o)/22);return Iw.checkCollapsedStickyLines(s,u,a)}var k2t=class{constructor(){this.priority=105;this.name="webview-find";this.type="help";this.when=K2}getProvider(i){return new iMi}},iMi=class extends k{constructor(){super(...arguments);this.id="webviewFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){}provideContent(){let e=[];return e.push(d(17803,null)),e.push(d(17798,null)),e.push(""),e.push(d(17825,null)),e.push(d(17824,null)),e.push(""),e.push(d(17812,null)),e.push(d(17811,null)),e.push(""),e.push(d(17808,null)),e.push(d(17807,null)),e.push(d(17804,null)),e.push(d(17805,null)),e.push(d(17806,null)),e.push(""),e.push(d(17802,null)),e.push(d(17799,null)),e.push(d(17800,null)),e.push(d(17801,null)),e.push(""),e.push(d(17813,null)),e.push(""),e.push(d(17815,null)),e.push(d(17814,null)),e.push(d(17816,null)),e.push(""),e.push(d(17819,null)),e.push(d(17817,null)),e.push(d(17820,null)),e.push(d(17818,null)),e.push(""),e.push(d(17810,null)),e.push(d(17809,null)),e.push(""),e.push(d(17822,null,"<keybinding:workbench.action.openSettings>")),e.push(d(17821,null)),e.push(d(17823,null)),e.push(""),e.push(d(17797,null)),e.push(d(17796,null)),e.join(`
`)}};var Gan=100;function _Oe(a,i){a?.addImplementation(Gan,"webview",e=>{let o=e.get(Pu).activeWebview;if(o?.isFocused)return i(o),!0;if(Un()?.classList.contains("action-menu-item")){let n=e.get(ie);if(n.activeEditor instanceof up)return i(n.activeEditor.webview),!0}return!1})}_Oe(pD,a=>a.undo());_Oe(mD,a=>a.redo());_Oe(lSt,a=>a.selectAll());_Oe(WA,a=>a.copy());_Oe(FA,a=>a.paste());_Oe(QB,a=>a.cut());var lrt="preventDefaultContextMenuItems";QB&&be.appendMenuItem(R.WebviewContext,{command:{id:QB.id,title:d(17793,null)},group:"5_cutcopypaste",order:1,when:C.not(lrt)});WA&&be.appendMenuItem(R.WebviewContext,{command:{id:WA.id,title:d(17792,null)},group:"5_cutcopypaste",order:2,when:C.not(lrt)});FA&&be.appendMenuItem(R.WebviewContext,{command:{id:FA.id,title:d(17794,null)},group:"5_cutcopypaste",order:3,when:C.not(lrt)});_a.register(new k2t);var DOe=class extends k{constructor(e,t,o,n,r,s){super();this.viewModel=e;this.isReplHistory=t;this.notebookExecutionStateService=o;this.keybindingService=n;this.configurationService=r;this.accessibilityService=s;this._onDidAriaLabelChange=this._register(new T);this.onDidAriaLabelChange=this._onDidAriaLabelChange.event;this._register(U.debounce(this.notebookExecutionStateService.onDidChangeExecution,(l,c)=>this.mergeEvents(l,c),100)(l=>{if(!l.length)return;let c=this.viewModel();if(c){for(let p of l){let h=c.getCellByHandle(p.cellHandle);h&&this._onDidAriaLabelChange.fire(h)}let u=l[l.length-1];if(this.shouldReadCellOutputs(u.state)){let p=c.getCellByHandle(u.cellHandle);if(p&&p.outputsViewModels.length){let h=iOe(c.notebookDocument,p,!0);cn(h)}}}},this))}shouldReadCellOutputs(e){return e===void 0&&this.isReplHistory&&this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("accessibility.replEditor.readLastExecutionOutput")}get verbositySettingId(){return this.isReplHistory?"accessibility.verbosity.replEditor":"accessibility.verbosity.notebook"}getAriaLabel(e){let t=U.filter(this.onDidAriaLabelChange,o=>o===e);return vi(this,t,()=>{let o=this.viewModel();return o&&o.getCellIndex(e)>=0?this.getLabel(e):""})}createItemLabel(e,t){return this.isReplHistory?`cell${e}`:`${t===1?"markdown":"code"} cell${e}`}getLabel(e){let t=this.notebookExecutionStateService.getCellExecution(e.uri)?.state,o=t===3?", executing":t===2?", pending":"";return this.createItemLabel(o,e.cellKind)}get widgetAriaLabelName(){return this.isReplHistory?d(13826,null):d(13823,null)}getWidgetAriaLabel(){let e=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return this.configurationService.getValue(this.verbositySettingId)?e?d(13824,null,this.widgetAriaLabelName,e):d(13825,null,this.widgetAriaLabelName):this.widgetAriaLabelName}mergeEvents(e,t){let o=this.viewModel(),n=e||[];if(o&&t.type===0&&t.affectsNotebook(o.uri)){let r=n.findIndex(s=>s.cellHandle===t.cellHandle);r>=0&&n.splice(r,1),n.push({cellHandle:t.cellHandle,state:t.changed?.state})}return n}};DOe=I([m(2,Ns),m(3,Le),m(4,B),m(5,Ai)],DOe);var E2t=class extends k{constructor(e,t){super();this._notebookEditor=e;this._listViewScrollablement=t;this._register($(this._listViewScrollablement,ne.MOUSE_WHEEL,o=>{let n=o.deltaX,r=o.deltaY,s=o.wheelDeltaX,l=o.wheelDeltaY,c=o.wheelDelta;if(!et&&o.shiftKey&&!n&&(n=r,r=0,s=l,l=0),n===0)return;let p=this._notebookEditor.codeEditors.find(f=>{let v=f[1].getLayoutInfo();if(v.contentWidth===v.width)return!1;let b=f[1].getDomNode();return!!(b&&b.contains(o.target))});if(!p)return;let h=Me(o),g={deltaMode:o.deltaMode,deltaX:n,deltaY:0,deltaZ:0,wheelDelta:c&&bz?c/h.devicePixelRatio:c,wheelDeltaX:s&&bz?s/h.devicePixelRatio:s,wheelDeltaY:0,detail:o.detail,shiftKey:o.shiftKey,type:o.type,defaultPrevented:!1,preventDefault:()=>{},stopPropagation:()=>{}};p[1].delegateScrollFromMouseWheelEvent(g)}))}};var ROe=class extends k{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.contextKeyServiceProvider=t;this.textModelService=o;this._configurationService=n;this._instantiationService=r;this._editorDisposable=this._register(new ue);this._isInitialized=!1;this._isDisposed=!1;this._focusedEditorDOM=this.notebookEditor.getDomNode().appendChild(_(".cell-editor-part-cache")),this._focusedEditorDOM.style.position="absolute",this._focusedEditorDOM.style.top="-50000px",this._focusedEditorDOM.style.width="1px",this._focusedEditorDOM.style.height="1px"}_initializeEditor(e){this._editorContextKeyService=this._register(this.contextKeyServiceProvider(this._focusedEditorDOM));let t=CI(this._focusedEditorDOM,_(".cell-editor-container")),o=this._register(this._instantiationService.createChild(new Po([X,this._editorContextKeyService])));me.inCompositeEditor.bindTo(this._editorContextKeyService).set(!0);let n=new oV(this.notebookEditor.getBaseCellEditorOptions(e.language),this.notebookEditor.notebookOptions,this._configurationService);this._editor=this._register(o.createInstance(us,t,{...n.getDefaultValue(),dimension:{width:0,height:0},scrollbar:{vertical:"hidden",horizontal:"auto",handleMouseWheel:!1,useShadows:!1},allowVariableLineHeights:!1},{contributions:this.notebookEditor.creationOptions.cellEditorContributions})),n.dispose(),this._isInitialized=!0}preserveFocusedEditor(e){this._isInitialized||this._initializeEditor(e),this._editorDisposable.clear(),this._focusEditorCancellablePromise?.cancel(),this._focusEditorCancellablePromise=Hn(async t=>{let o=await this.textModelService.createModelReference(e.uri);if(this._isDisposed||t.isCancellationRequested){o.dispose();return}let n=new O;n.add(o),this._editor.setModel(o.object.textEditorModel),this._editor.setSelections(e.getSelections()),this._editor.focus();let r=()=>{let s=this._editor.getSelections();s&&e.setSelections(s),this.notebookEditor.revealInView(e),this._editor.setModel(null),o.dispose()};n.add(this._editor.onDidChangeModelContent(s=>{r()})),n.add(this._editor.onDidChangeCursorSelection(s=>{(s.source==="keyboard"||s.source==="mouse")&&r()})),n.add(this.notebookEditor.onDidChangeActiveEditor(()=>{let s=this.notebookEditor.getActiveCell();(s!==e||s.focusMode!==1)&&(this._editorDisposable.clear(),this._editor.setModel(null),o.dispose())})),this._editorDisposable.value=n})}dispose(){this._isDisposed=!0,this._focusEditorCancellablePromise?.cancel(),super.dispose()}};ROe=I([m(2,Bt),m(3,B),m(4,F)],ROe);var T2t=class extends k{constructor(e,t,o){super();this.notebookWidget=e;this._list=t;this.loggingService=o;this._pendingLayouts=new WeakMap;this._layoutDisposables=new Set;this._layoutStack=[];this._isDisposed=!1}checkStackDepth(){if(this._layoutStack.length>30){let e=this._layoutStack.join(" -> ");throw new Error("NotebookCellLayoutManager: layout stack is too deep: "+e)}}async layoutNotebookCell(e,t){let o=`cell:${e.handle}, height:${t}`;if(this.loggingService.debug("cell layout",o),this._list.getViewIndex(e)===void 0)return;if(this._pendingLayouts?.has(e)){let l=this._pendingLayouts.get(e);l.dispose(),this._layoutDisposables.delete(l)}let r=new Mo,s=()=>{let l=this._pendingLayouts?.get(e);this._pendingLayouts?.delete(e),this._layoutStack.push(o);try{if(this._isDisposed||!this.notebookWidget.viewModel?.hasCell(e)||this._list.getViewIndex(e)===void 0||this._list.elementHeight(e)===t)return;if(this.checkStackDepth(),!this.notebookWidget.hasEditorFocus()){let c=this.notebookWidget.viewModel?.getCellIndex(e),u=this.notebookWidget.visibleRanges;if(c!==void 0&&u&&u.length&&u[0].start===c&&this._list.scrollTop>this.notebookWidget.getAbsoluteTopOfElement(e))return this._list.updateElementHeight2(e,t,Math.min(c+1,this.notebookWidget.getLength()-1))}this._list.updateElementHeight2(e,t)}finally{this._layoutStack.pop(),r.complete(void 0),l&&(l.dispose(),this._layoutDisposables.delete(l))}};if(this._list.inRenderingTransaction){let l=kr(Me(this.notebookWidget.getDomNode()),s),c=ee(()=>{l.dispose(),r.complete(void 0)});this._pendingLayouts?.set(e,c),this._layoutDisposables.add(c)}else s();return r.p}dispose(){super.dispose(),this._isDisposed=!0,this._layoutDisposables.forEach(e=>e.dispose())}};var $an=_;function roe(){let a=["editor.contrib.review",Cie.ID,fH.ID,"editor.contrib.dirtydiff","editor.contrib.testingOutputPeek","editor.contrib.testingDecorations","store.contrib.stickyScrollController","editor.contrib.findController","editor.contrib.emptyTextEditorHint"],i=ml.getEditorContributions().filter(e=>a.indexOf(e.id)===-1);return{menuIds:{notebookToolbar:R.NotebookToolbar,cellTitleToolbar:R.NotebookCellTitle,cellDeleteToolbar:R.NotebookCellDelete,cellInsertToolbar:R.NotebookCellBetween,cellTopInsertToolbar:R.NotebookCellListTop,cellExecuteToolbar:R.NotebookCellExecute,cellExecutePrimary:R.NotebookCellExecutePrimary},cellEditorContributions:i}}var Lq=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.creationOptions=e;this.editorGroupsService=n;this.notebookRendererMessaging=r;this.notebookEditorService=s;this.notebookKernelService=l;this._notebookService=c;this.configurationService=u;this.layoutService=h;this.contextMenuService=g;this.telemetryService=f;this.notebookExecutionService=v;this.editorProgressService=b;this.logService=S;this._onDidChangeCellState=this._register(new T);this.onDidChangeCellState=this._onDidChangeCellState.event;this._onDidChangeViewCells=this._register(new T);this.onDidChangeViewCells=this._onDidChangeViewCells.event;this._onWillChangeModel=this._register(new T);this.onWillChangeModel=this._onWillChangeModel.event;this._onDidChangeModel=this._register(new T);this.onDidChangeModel=this._onDidChangeModel.event;this._onDidAttachViewModel=this._register(new T);this.onDidAttachViewModel=this._onDidAttachViewModel.event;this._onDidChangeOptions=this._register(new T);this.onDidChangeOptions=this._onDidChangeOptions.event;this._onDidChangeDecorations=this._register(new T);this.onDidChangeDecorations=this._onDidChangeDecorations.event;this._onDidScroll=this._register(new T);this.onDidScroll=this._onDidScroll.event;this._onDidChangeLayout=this._register(new T);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeActiveCell=this._register(new T);this.onDidChangeActiveCell=this._onDidChangeActiveCell.event;this._onDidChangeFocus=this._register(new T);this.onDidChangeFocus=this._onDidChangeFocus.event;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeVisibleRanges=this._register(new T);this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event;this._onDidFocusEmitter=this._register(new T);this.onDidFocusWidget=this._onDidFocusEmitter.event;this._onDidBlurEmitter=this._register(new T);this.onDidBlurWidget=this._onDidBlurEmitter.event;this._onDidChangeActiveEditor=this._register(new T);this.onDidChangeActiveEditor=this._onDidChangeActiveEditor.event;this._onDidChangeActiveKernel=this._register(new T);this.onDidChangeActiveKernel=this._onDidChangeActiveKernel.event;this._onMouseUp=this._register(new T);this.onMouseUp=this._onMouseUp.event;this._onMouseDown=this._register(new T);this.onMouseDown=this._onMouseDown.event;this._onDidReceiveMessage=this._register(new T);this.onDidReceiveMessage=this._onDidReceiveMessage.event;this._onDidRenderOutput=this._register(new T);this.onDidRenderOutput=this._onDidRenderOutput.event;this._onDidRemoveOutput=this._register(new T);this.onDidRemoveOutput=this._onDidRemoveOutput.event;this._onDidResizeOutputEmitter=this._register(new T);this.onDidResizeOutput=this._onDidResizeOutputEmitter.event;this._webview=null;this._webviewResolvePromise=null;this._webviewTransparentCover=null;this._listDelegate=null;this._dndController=null;this._listTopCellToolbar=null;this._renderedEditors=new Map;this._localStore=this._register(new O);this._localCellStateListeners=[];this._contributions=new Map;this._insetModifyQueueByOutputId=new II;this._cellContextKeyManager=null;this._uuid=ht();this._webviewFocused=!1;this._isVisible=!1;this._isDisposed=!1;this._baseCellEditorOptions=new Map;this._debugFlag=!1;this._backgroundMarkdownRenderRunning=!1;this._lastCellWithEditorFocus=null;this._pendingOutputHeightAcks=new Map;this._dimension=t,this.isReplHistory=e.isReplHistory??!1,this._readOnly=e.isReadOnly??!1,this._overlayLayout=this._register(new QNe),this._overlayContainer=this._overlayLayout.content,this.scopedContextKeyService=this._register(p.createScoped(this._overlayContainer)),this.instantiationService=this._register(o.createChild(new Po([X,this.scopedContextKeyService]))),this._notebookOptions=e.options??this.instantiationService.createInstance(P_,this.creationOptions?.codeWindow??ut,this._readOnly,void 0),this._register(this._notebookOptions);let y=this._register(new gOe);this._viewContext=new SOe(this._notebookOptions,y,M=>this.getBaseCellEditorOptions(M)),this._register(this._viewContext.eventDispatcher.onDidChangeLayout(()=>{this._onDidChangeLayout.fire()})),this._register(this._viewContext.eventDispatcher.onDidChangeCellState(M=>{this._onDidChangeCellState.fire(M)})),this._register(c.onDidChangeOutputRenderers(()=>{this._updateOutputRenderers()})),this._register(this.instantiationService.createInstance(yOe,this)),this._register(l.onDidChangeSelectedNotebooks(M=>{ze(M.notebook,this.viewModel?.uri)&&(this._loadKernelPreloads(),this._onDidChangeActiveKernel.fire())})),this._scrollBeyondLastLine=this.configurationService.getValue("editor.scrollBeyondLastLine"),this._register(this.configurationService.onDidChangeConfiguration(M=>{M.affectsConfiguration("editor.scrollBeyondLastLine")&&(this._scrollBeyondLastLine=this.configurationService.getValue("editor.scrollBeyondLastLine"),this._dimension&&this._isVisible&&this.layout(this._dimension))})),this._register(this._notebookOptions.onDidChangeOptions(M=>{(M.cellStatusBarVisibility||M.cellToolbarLocation||M.cellToolbarInteraction)&&this._updateForNotebookConfiguration(),M.fontFamily&&this._generateFontInfo(),(M.compactView||M.focusIndicator||M.insertToolbarPosition||M.cellToolbarLocation||M.dragAndDropEnabled||M.fontSize||M.markupFontSize||M.markdownLineHeight||M.fontFamily||M.insertToolbarAlignment||M.outputFontSize||M.outputLineHeight||M.outputFontFamily||M.outputWordWrap||M.outputScrolling||M.outputLinkifyFilePaths||M.minimalError)&&(this._styleElement?.remove(),this._createLayoutStyles(),this._webview?.updateOptions({...this.notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()})),this._dimension&&this._isVisible&&this.layout(this._dimension)}));let w=e.codeWindow?this.layoutService.getContainer(e.codeWindow):this.layoutService.mainContainer;this.notebookEditorService.addNotebookEditor(this);let x=ht();this._overlayContainer.id=`notebook-${x}`,this._overlayContainer.className="notebookOverlay",this._overlayContainer.classList.add("notebook-editor"),this._overlayContainer.inert=!0,this._overlayContainer.style.visibility="hidden",w.appendChild(this._overlayLayout.root),this._createBody(this._overlayContainer),this._generateFontInfo(),this._isVisible=!0,this._editorFocus=wr.bindTo(this.scopedContextKeyService),this._outputFocus=vP.bindTo(this.scopedContextKeyService),this._outputInputFocus=Fie.bindTo(this.scopedContextKeyService),this._editorEditable=cc.bindTo(this.scopedContextKeyService),this._cursorNavMode=xnt.bindTo(this.scopedContextKeyService),new Y(lrt,!1).bindTo(this.scopedContextKeyService).set(!0),this._editorEditable.set(!e.isReadOnly);let E;Array.isArray(this.creationOptions.contributions)?E=this.creationOptions.contributions:E=OQ.getEditorContributions();for(let M of E){let N;try{N=this.instantiationService.createInstance(M.ctor,this)}catch(V){mt(V)}if(N)if(!this._contributions.has(M.id))this._contributions.set(M.id,N);else throw N.dispose(),new Error(`DUPLICATE notebook editor contribution: '${M.id}'`)}this._updateForNotebookConfiguration()}get isVisible(){return this._isVisible}get isDisposed(){return this._isDisposed}set viewModel(e){this._onWillChangeModel.fire(this._notebookViewModel?.notebookDocument),this._notebookViewModel=e,this._onDidChangeModel.fire(e?.notebookDocument)}get viewModel(){return this._notebookViewModel}get textModel(){return this._notebookViewModel?.notebookDocument}get isReadOnly(){return this._notebookViewModel?.options.isReadOnly??!1}get activeCodeEditor(){if(this._isDisposed)return;let[e]=this._list.getFocusedElements();return this._renderedEditors.get(e)}get activeCellAndCodeEditor(){if(this._isDisposed)return;let[e]=this._list.getFocusedElements(),t=this._renderedEditors.get(e);if(t)return[e,t]}get codeEditors(){return[...this._renderedEditors]}get visibleRanges(){return this._list?this._list.visibleRanges||[]:[]}get notebookOptions(){return this._notebookOptions}_debug(...e){this._debugFlag&&Syo(...e)}getId(){return this._uuid}getViewModel(){return this.viewModel}getLength(){return this.viewModel?.length??0}getSelections(){return this.viewModel?.getSelections()??[{start:0,end:0}]}setSelections(e){if(!this.viewModel)return;let t=this.viewModel.getFocus();this.viewModel.updateSelectionsState({kind:1,focus:t,selections:e})}getFocus(){return this.viewModel?.getFocus()??{start:0,end:0}}setFocus(e){if(!this.viewModel)return;let t=this.viewModel.getSelections();this.viewModel.updateSelectionsState({kind:1,focus:e,selections:t})}getSelectionViewModels(){if(!this.viewModel)return[];let e=new Set;return this.viewModel.getSelections().map(t=>this.viewModel.viewCells.slice(t.start,t.end)).reduce((t,o)=>(o.forEach(n=>{e.has(n.handle)||(e.add(n.handle),t.push(n))}),t),[])}hasModel(){return!!this._notebookViewModel}showProgress(){this._currentProgress=this.editorProgressService.show(!0)}hideProgress(){this._currentProgress&&(this._currentProgress.done(),this._currentProgress=void 0)}getBaseCellEditorOptions(e){let t=this._baseCellEditorOptions.get(e);if(t)return t;{let o=new y2t(this,this.notebookOptions,this.configurationService,e);return this._baseCellEditorOptions.set(e,o),o}}_updateForNotebookConfiguration(){if(!this._overlayContainer)return;this._overlayContainer.classList.remove("cell-title-toolbar-left"),this._overlayContainer.classList.remove("cell-title-toolbar-right"),this._overlayContainer.classList.remove("cell-title-toolbar-hidden");let e=this._notebookOptions.computeCellToolbarLocation(this.viewModel?.viewType);this._overlayContainer.classList.add(`cell-title-toolbar-${e}`);let t=this._notebookOptions.getDisplayOptions().cellToolbarInteraction,o="hover";this._overlayContainer.classList.remove("cell-toolbar-hover"),this._overlayContainer.classList.remove("cell-toolbar-click"),(t==="hover"||t==="click")&&(o=t),this._overlayContainer.classList.add(`cell-toolbar-${o}`)}_generateFontInfo(){let e=this.configurationService.getValue("editor"),t=Me(this.getDomNode());this._fontInfo=zw.readFontInfo(t,RI(e,Gu.getInstance(t).value))}_createBody(e){this._notebookTopToolbarContainer=document.createElement("div"),this._notebookTopToolbarContainer.classList.add("notebook-toolbar-container"),this._notebookTopToolbarContainer.style.display="none",D(e,this._notebookTopToolbarContainer),this._notebookStickyScrollContainer=document.createElement("div"),this._notebookStickyScrollContainer.classList.add("notebook-sticky-scroll-container"),D(e,this._notebookStickyScrollContainer),this._body=document.createElement("div"),D(e,this._body),this._body.classList.add("cell-list-container"),this._createLayoutStyles(),this._createCellList(),this._notebookOverviewRulerContainer=document.createElement("div"),this._notebookOverviewRulerContainer.classList.add("notebook-overview-ruler-container"),this._list.scrollableElement.appendChild(this._notebookOverviewRulerContainer),this._registerNotebookOverviewRuler(),this._register(this.instantiationService.createInstance(E2t,this,this._list.scrollableElement)),this._overflowContainer=document.createElement("div"),this._overflowContainer.classList.add("notebook-overflow-widget-container","monaco-editor"),D(e,this._overflowContainer)}_generateFontFamily(){return this._fontInfo?.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}_createLayoutStyles(){this._styleElement=Pr(this._body);let{cellRightMargin:e,cellTopMargin:t,cellRunGutter:o,cellBottomMargin:n,codeCellLeftMargin:r,markdownCellGutter:s,markdownCellLeftMargin:l,markdownCellBottomMargin:c,markdownCellTopMargin:u,collapsedIndicatorHeight:p,focusIndicator:h,insertToolbarPosition:g,outputFontSize:f,focusIndicatorLeftMargin:v,focusIndicatorGap:b}=this._notebookOptions.getLayoutConfiguration(),{insertToolbarAlignment:S,compactView:y,fontSize:w}=this._notebookOptions.getDisplayOptions(),x=this._notebookOptions.getCellEditorContainerLeftMargin(),{bottomToolbarGap:E,bottomToolbarHeight:M}=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType),N=[];this._fontInfo||this._generateFontInfo();let V=this._generateFontFamily();N.push(`
		.notebook-editor {
			--notebook-cell-output-font-size: ${f}px;
			--notebook-cell-input-preview-font-size: ${w}px;
			--notebook-cell-input-preview-font-family: ${V};
		}
		`),y?N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row div.cell.code { margin-left: ${x}px; }`):N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row div.cell.code { margin-left: ${r}px; }`),h==="border"?(N.push(`
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-top:before,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom:before,
			.monaco-workbench .notebookOverlay .monaco-list .markdown-cell-row .cell-inner-container:before,
			.monaco-workbench .notebookOverlay .monaco-list .markdown-cell-row .cell-inner-container:after {
				content: "";
				position: absolute;
				width: 100%;
				height: 1px;
			}

			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left:before,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-right:before {
				content: "";
				position: absolute;
				width: 1px;
				height: 100%;
				z-index: 10;
			}

			/* top border */
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-top:before {
				border-top: 1px solid transparent;
			}

			/* left border */
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left:before {
				border-left: 1px solid transparent;
			}

			/* bottom border */
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom:before {
				border-bottom: 1px solid transparent;
			}

			/* right border */
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-right:before {
				border-right: 1px solid transparent;
			}
			`),N.push(`
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.focused .cell-focus-indicator-left:before,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.code-cell-row.focused .cell-focus-indicator-right:before,
			.monaco-workbench .notebookOverlay .monaco-list.selection-multiple .monaco-list-row.code-cell-row.selected .cell-focus-indicator-left:before,
			.monaco-workbench .notebookOverlay .monaco-list.selection-multiple .monaco-list-row.code-cell-row.selected .cell-focus-indicator-right:before {
				top: -${t}px; height: calc(100% + ${t+n}px)
			}`)):(N.push(`
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left .codeOutput-focus-indicator {
				border-left: 3px solid transparent;
				border-radius: 4px;
				width: 0px;
				margin-left: ${v}px;
				border-color: var(--vscode-notebook-inactiveFocusedCellBorder) !important;
			}

			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.focused .cell-focus-indicator-left .codeOutput-focus-indicator-container,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-output-hover .cell-focus-indicator-left .codeOutput-focus-indicator-container,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .markdown-cell-hover .cell-focus-indicator-left .codeOutput-focus-indicator-container,
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row:hover .cell-focus-indicator-left .codeOutput-focus-indicator-container {
				display: block;
			}

			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-left .codeOutput-focus-indicator-container:hover .codeOutput-focus-indicator {
				border-left: 5px solid transparent;
				margin-left: ${v-1}px;
			}
			`),N.push(`
			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row.focused .cell-inner-container.cell-output-focus .cell-focus-indicator-left .codeOutput-focus-indicator,
			.monaco-workbench .notebookOverlay .monaco-list:focus-within .monaco-list-row.focused .cell-inner-container .cell-focus-indicator-left .codeOutput-focus-indicator {
				border-color: var(--vscode-notebook-focusedCellBorder) !important;
			}

			.monaco-workbench .notebookOverlay .monaco-list .monaco-list-row .cell-inner-container .cell-focus-indicator-left .output-focus-indicator {
				margin-top: ${b}px;
			}
			`)),g==="betweenCells"||g==="both"?(N.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { display: flex; }"),N.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container { display: flex; }")):(N.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container { display: none; }"),N.push(".monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container { display: none; }")),S==="left"&&(N.push(`
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .action-item:first-child,
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .action-item:first-child, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .action-item:first-child {
				margin-right: 0px !important;
			}`),N.push(`
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .monaco-toolbar .action-label,
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container .monaco-toolbar .action-label, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .monaco-toolbar .action-label {
				padding: 0px !important;
				justify-content: center;
				border-radius: 4px;
			}`),N.push(`
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container,
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container, .monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container {
				align-items: flex-start;
				justify-content: left;
				margin: 0 16px 0 ${8+r}px;
			}`),N.push(`
			.monaco-workbench .notebookOverlay .cell-list-top-cell-toolbar-container,
			.notebookOverlay .cell-bottom-toolbar-container .action-item {
				border: 0px;
			}`)),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .code-cell-row div.cell.code { margin-left: ${x}px; }`),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .code-cell-row div.cell.code { margin-left: ${x}px; }`),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .code-cell-row div.cell { margin-right: ${e}px; }`),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row div.cell { margin-right: ${e}px; }`),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row > .cell-inner-container { padding-top: ${t}px; }`),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .cell-inner-container { padding-bottom: ${c}px; padding-top: ${u}px; }`),N.push(".notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .cell-inner-container.webview-backed-markdown-cell { padding: 0; }"),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .markdown-cell-row > .webview-backed-markdown-cell.markdown-cell-edit-mode .cell.code { padding-bottom: ${c}px; padding-top: ${u}px; }`),N.push(`.notebookOverlay .output { margin: 0px ${e}px 0px ${x}px; }`),N.push(`.notebookOverlay .output { width: calc(100% - ${x+e}px); }`),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-comment-container { left: ${x}px; }`),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-comment-container { width: calc(100% - ${x+e}px); }`),N.push(`.monaco-workbench .notebookOverlay .output .output-collapse-container .expandButton { left: -${o}px; }`),N.push(`.monaco-workbench .notebookOverlay .output .output-collapse-container .expandButton {
			position: absolute;
			width: ${o}px;
			padding: 6px 0px;
		}`),N.push(`.notebookOverlay .output-show-more-container { margin: 0px ${e}px 0px ${x}px; }`),N.push(`.notebookOverlay .output-show-more-container { width: calc(100% - ${x+e}px); }`),N.push(`.notebookOverlay .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row div.cell.markdown { padding-left: ${o}px; }`),N.push(`.monaco-workbench .notebookOverlay > .cell-list-container .notebook-folding-indicator { left: ${(s-20)/2+l}px; }`),N.push(`.notebookOverlay > .cell-list-container .notebook-folded-hint { left: ${s+l+8}px; }`),N.push(`.notebookOverlay .monaco-list .monaco-list-row :not(.webview-backed-markdown-cell) .cell-focus-indicator-top { height: ${t}px; }`),N.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-side { bottom: ${E}px; }`),N.push(`.notebookOverlay .monaco-list .monaco-list-row.code-cell-row .cell-focus-indicator-left { width: ${x}px; }`),N.push(`.notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row .cell-focus-indicator-left { width: ${r}px; }`),N.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator.cell-focus-indicator-right { width: ${e}px; }`),N.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-focus-indicator-bottom { height: ${n}px; }`),N.push(`.notebookOverlay .monaco-list .monaco-list-row .cell-shadow-container-bottom { top: ${n}px; }`),N.push(`
			.notebookOverlay .monaco-list.selection-multiple .monaco-list-row:has(+ .monaco-list-row.selected) .cell-focus-indicator-bottom {
				height: ${E+n}px;
			}
		`),N.push(`
			.notebookOverlay .monaco-list .monaco-list-row.code-cell-row.nb-multiCellHighlight:has(+ .monaco-list-row.nb-multiCellHighlight) .cell-focus-indicator-bottom {
				height: ${E+n}px;
				background-color: var(--vscode-notebook-symbolHighlightBackground) !important;
			}

			.notebookOverlay .monaco-list .monaco-list-row.markdown-cell-row.nb-multiCellHighlight:has(+ .monaco-list-row.nb-multiCellHighlight) .cell-focus-indicator-bottom {
				height: ${E+n-6}px;
				background-color: var(--vscode-notebook-symbolHighlightBackground) !important;
			}
		`),N.push(`
			.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .input-collapse-container .cell-collapse-preview {
				line-height: ${p}px;
			}

			.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .input-collapse-container .cell-collapse-preview .monaco-tokenized-source {
				max-height: ${p}px;
			}
		`),N.push(`.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-bottom-toolbar-container .monaco-toolbar { height: ${M}px }`),N.push(`.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .view-zones .cell-list-top-cell-toolbar-container .monaco-toolbar { height: ${M}px }`),N.push(`.monaco-workbench .notebookOverlay.cell-title-toolbar-right > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
			right: ${e+26}px;
		}
		.monaco-workbench .notebookOverlay.cell-title-toolbar-left > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
			left: ${x+16}px;
		}
		.monaco-workbench .notebookOverlay.cell-title-toolbar-hidden > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .cell-title-toolbar {
			display: none;
		}`),N.push(`
		.monaco-workbench .notebookOverlay .output > div.foreground.output-inner-container {
			padding: ${eMi}px 8px;
		}
		.monaco-workbench .notebookOverlay > .cell-list-container > .monaco-list > .monaco-scrollable-element > .monaco-list-rows > .monaco-list-row .output-collapse-container {
			padding: ${eMi}px 8px;
		}
		`),N.push(`
		.monaco-workbench .notebookOverlay .cell-chat-part {
			margin: 0 ${e}px 6px 4px;
		}
		`),this._styleElement.textContent=N.join(`
`)}_createCellList(){this._body.classList.add("cell-list-container"),this._dndController=this._register(new n2t(this,this._body));let e=n=>this._list.contextKeyService.createScoped(n);this._editorPool=this._register(this.instantiationService.createInstance(ROe,this,e));let t=[this.instantiationService.createInstance(BQ,this,this._renderedEditors,this._editorPool,this._dndController,e),this.instantiationService.createInstance(VQ,this,this._dndController,this._renderedEditors,e)];t.forEach(n=>{this._register(n)}),this._listDelegate=this.instantiationService.createInstance(hOe,Me(this.getDomNode())),this._register(this._listDelegate);let o=this.instantiationService.createInstance(DOe,()=>this.viewModel,this.isReplHistory);this._register(o),this._list=this.instantiationService.createInstance(eOe,"NotebookCellList",this._body,this._viewContext.notebookOptions,this._listDelegate,t,this.scopedContextKeyService,{setRowLineHeight:!1,setRowHeight:!1,supportDynamicHeights:!0,horizontalScrolling:!1,keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!0,selectionNavigation:!0,typeNavigationEnabled:!0,paddingTop:0,paddingBottom:0,transformOptimization:!1,initialSize:this._dimension,styleController:n=>this._list,overrideStyles:{listBackground:noe,listActiveSelectionBackground:noe,listActiveSelectionForeground:xo,listFocusAndSelectionBackground:noe,listFocusAndSelectionForeground:xo,listFocusBackground:noe,listFocusForeground:xo,listHoverForeground:xo,listHoverBackground:noe,listHoverOutline:Kc,listFocusOutline:Kc,listInactiveSelectionBackground:noe,listInactiveSelectionForeground:xo,listInactiveFocusBackground:noe,listInactiveFocusOutline:noe},accessibilityProvider:o}),this._cellLayoutManager=new T2t(this,this._list,this.logService),this._dndController.setList(this._list),this._register(this._list),this._listViewInfoAccessor=new d2t(this._list),this._register(this._listViewInfoAccessor),this._register(Fn(...t)),this._listTopCellToolbar=this._register(this.instantiationService.createInstance(COe,this,this.notebookOptions)),this._webviewTransparentCover=D(this._list.rowsContainer,$an(".webview-cover")),this._webviewTransparentCover.style.display="none",this._register(Rwe(this._overlayContainer,n=>{n.target.classList.contains("slider")&&this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="block")})),this._register(Abt(this._overlayContainer,()=>{this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="none")})),this._register(this._list.onMouseDown(n=>{n.element&&this._onMouseDown.fire({event:n.browserEvent,target:n.element})})),this._register(this._list.onMouseUp(n=>{n.element&&this._onMouseUp.fire({event:n.browserEvent,target:n.element})})),this._register(this._list.onDidChangeFocus(n=>{this._onDidChangeActiveEditor.fire(this),this._onDidChangeActiveCell.fire(),this._onDidChangeFocus.fire(),this._cursorNavMode.set(!1)})),this._register(this._list.onContextMenu(n=>{this.showListContextMenu(n)})),this._register(this._list.onDidChangeVisibleRanges(()=>{this._onDidChangeVisibleRanges.fire()})),this._register(this._list.onDidScroll(n=>{n.scrollTop!==n.oldScrollTop&&(this._onDidScroll.fire(),this.clearActiveCellWidgets()),n.scrollTop===n.oldScrollTop&&n.scrollHeightChanged&&this._onDidChangeLayout.fire()})),this._focusTracker=this._register(nr(this.getDomNode())),this._register(this._focusTracker.onDidBlur(()=>{this._editorFocus.set(!1),this.viewModel?.setEditorFocus(!1),this._onDidBlurEmitter.fire()})),this._register(this._focusTracker.onDidFocus(()=>{this._editorFocus.set(!0),this.viewModel?.setEditorFocus(!0),this._onDidFocusEmitter.fire()})),this._registerNotebookActionsToolbar(),this._registerNotebookStickyScroll(),this._register(this.configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration(o.verbositySettingId)&&(this._list.ariaLabel=o?.getWidgetAriaLabel())}))}showListContextMenu(e){this.contextMenuService.showContextMenu({menuId:R.NotebookCellTitle,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:this.scopedContextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>({from:"cellContainer"})})}_registerNotebookOverviewRuler(){this._notebookOverviewRuler=this._register(this.instantiationService.createInstance(wOe,this,this._notebookOverviewRulerContainer))}_registerNotebookActionsToolbar(){this._notebookTopToolbar=this._register(this.instantiationService.createInstance(IOe,this,this.scopedContextKeyService,this._notebookOptions,this._notebookTopToolbarContainer)),this._register(this._notebookTopToolbar.onDidChangeVisibility(()=>{this._dimension&&this._isVisible&&this.layout(this._dimension)}))}_registerNotebookStickyScroll(){this._notebookStickyScroll=this._register(this.instantiationService.createInstance(Iw,this._notebookStickyScrollContainer,this,this._list,e=>{this.isDisposed||(this._dimension&&this._isVisible&&(e>0?(this.layout(this._dimension),this.setScrollTop(this.scrollTop+e)):e<0&&(this.setScrollTop(this.scrollTop+e),this.layout(this._dimension))),this._onDidScroll.fire())}))}_updateOutputRenderers(){!this.viewModel||!this._webview||(this._webview.updateOutputRenderers(),this.viewModel.viewCells.forEach(e=>{e.outputsViewModels.forEach(t=>{t.pickedMimeType?.rendererId===T2&&t.resetRenderer()})}))}getDomNode(){return this._overlayContainer}getOverflowContainerDomNode(){return this._overflowContainer}getInnerWebview(){return this._webview?.webview}setEditorProgressService(e){this.editorProgressService=e}setParentContextKeyService(e){this.scopedContextKeyService.updateParent(e)}async setModel(e,t,o,n){if(this.viewModel===void 0||!this.viewModel.equal(e)){let r=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);this._detachModel(),await this._attachModel(e,n??e.viewType,t,o);let s=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);(r.bottomToolbarGap!==s.bottomToolbarGap||r.bottomToolbarHeight!==s.bottomToolbarHeight)&&(this._styleElement?.remove(),this._createLayoutStyles(),this._webview?.updateOptions({...this.notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()})),this.telemetryService.publicLog2("notebook/editorOpened",{scheme:e.uri.scheme,ext:Ts(e.uri),viewType:e.viewType,isRepl:this.isReplHistory})}else this.restoreListViewState(t);this._restoreSelectedKernel(t),this._loadKernelPreloads(),this._dndController?.clearGlobalDragState(),this._localStore.add(this._list.onDidChangeFocus(()=>{this.updateContextKeysOnFocusChange()})),this.updateContextKeysOnFocusChange(),this._backgroundMarkdownRendering()}_backgroundMarkdownRendering(){this._backgroundMarkdownRenderRunning||(this._backgroundMarkdownRenderRunning=!0,Ff(Me(this.getDomNode()),e=>{this._backgroundMarkdownRenderingWithDeadline(e)}))}_backgroundMarkdownRenderingWithDeadline(e){let t=Date.now()+e.timeRemaining(),o=()=>{try{if(this._backgroundMarkdownRenderRunning=!0,this._isDisposed||!this.viewModel)return;let n=this.viewModel.viewCells.find(r=>r.cellKind===1&&!this._webview?.markupPreviewMapping.has(r.id)&&!this.cellIsHidden(r));if(!n)return;this.createMarkupPreview(n)}finally{this._backgroundMarkdownRenderRunning=!1}Date.now()<t?ox(o):this._backgroundMarkdownRendering()};o()}updateContextKeysOnFocusChange(){if(!this.viewModel)return;let e=this._list.getFocusedElements()[0];e&&(this._cellContextKeyManager||(this._cellContextKeyManager=this._localStore.add(this.instantiationService.createInstance(rfe,this,e))),this._cellContextKeyManager.updateForElement(e))}async setOptions(e){if(e?.isReadOnly!==void 0&&(this._readOnly=e?.isReadOnly),!this.viewModel)return;this.viewModel.updateOptions({isReadOnly:this._readOnly}),this.notebookOptions.updateOptions(this._readOnly);let t=e?.cellOptions??this._parseIndexedCellOptions(e);if(t){let o=this.viewModel.viewCells.find(n=>n.uri.toString()===t.resource.toString());if(o){this.focusElement(o);let n=t.options?.selection;n?(o.updateEditState(1,"setOptions"),o.focusMode=1,await this.revealRangeInCenterIfOutsideViewportAsync(o,new G(n.startLineNumber,n.startColumn,n.endLineNumber||n.startLineNumber,n.endColumn||n.startColumn))):this._list.revealCell(o,e?.cellRevealType??4);let r=this._renderedEditors.get(o);if(r){if(t.options?.selection){let{selection:s}=t.options,l=new G(s.startLineNumber,s.startColumn,s.endLineNumber||s.startLineNumber,s.endColumn||s.startColumn);r.setSelection(l),r.revealPositionInCenterIfOutsideViewport({lineNumber:s.startLineNumber,column:s.startColumn}),await this.revealRangeInCenterIfOutsideViewportAsync(o,l)}t.options?.preserveFocus||r.focus()}}}if(e?.cellSelections){let o=e.cellSelections[0].start,n=this.viewModel.cellAt(o);n&&(this.viewModel.updateSelectionsState({kind:1,focus:{start:o,end:o+1},selections:e.cellSelections}),this.revealInCenterIfOutsideViewport(n))}this._updateForOptions(),this._onDidChangeOptions.fire()}_parseIndexedCellOptions(e){if(e?.indexedCellOptions){let t=this.cellAt(e.indexedCellOptions.index);if(t)return{resource:t.uri,options:{selection:e.indexedCellOptions.selection,preserveFocus:!1}}}}_detachModel(){this._localStore.clear(),je(this._localCellStateListeners),this._list.detachViewModel(),this.viewModel?.dispose(),this.viewModel=void 0,this._webview?.dispose(),this._webview?.element.remove(),this._webview=null,this._list.clear()}_updateForOptions(){this.viewModel&&(this._editorEditable.set(!this.viewModel.options.isReadOnly),this._overflowContainer.classList.toggle("notebook-editor-editable",!this.viewModel.options.isReadOnly),this.getDomNode().classList.toggle("notebook-editor-editable",!this.viewModel.options.isReadOnly))}async _resolveWebview(){return this.textModel?this._webviewResolvePromise?this._webviewResolvePromise:(this._webview||this._ensureWebview(this.getId(),this.textModel.viewType,this.textModel.uri),this._webviewResolvePromise=(async()=>{if(!this._webview)throw new Error("Notebook output webview object is not created successfully.");if(await this._webview.createWebview(this.creationOptions.codeWindow??ut),!this._webview.webview)throw new Error("Notebook output webview element was not created successfully.");return this._localStore.add(this._webview.webview.onDidBlur(()=>{this._outputFocus.set(!1),this._webviewFocused=!1,this.updateEditorFocus(),this.updateCellFocusMode()})),this._localStore.add(this._webview.webview.onDidFocus(()=>{this._outputFocus.set(!0),this.updateEditorFocus(),this._webviewFocused=!0})),this._localStore.add(this._webview.onMessage(e=>{this._onDidReceiveMessage.fire(e)})),this._webview})(),this._webviewResolvePromise):null}_ensureWebview(e,t,o){if(this._webview)return;let n=this;this._webview=this.instantiationService.createInstance(sO,{get creationOptions(){return n.creationOptions},setScrollTop(r){n._list.scrollTop=r},triggerScroll(r){n._list.triggerScrollFromMouseWheelEvent(r)},getCellByInfo:n.getCellByInfo.bind(n),getCellById:n._getCellById.bind(n),toggleNotebookCellSelection:n._toggleNotebookCellSelection.bind(n),focusNotebookCell:n.focusNotebookCell.bind(n),focusNextNotebookCell:n.focusNextNotebookCell.bind(n),updateOutputHeight:n._updateOutputHeight.bind(n),scheduleOutputHeightAck:n._scheduleOutputHeightAck.bind(n),updateMarkupCellHeight:n._updateMarkupCellHeight.bind(n),setMarkupCellEditState:n._setMarkupCellEditState.bind(n),didStartDragMarkupCell:n._didStartDragMarkupCell.bind(n),didDragMarkupCell:n._didDragMarkupCell.bind(n),didDropMarkupCell:n._didDropMarkupCell.bind(n),didEndDragMarkupCell:n._didEndDragMarkupCell.bind(n),didResizeOutput:n._didResizeOutput.bind(n),updatePerformanceMetadata:n._updatePerformanceMetadata.bind(n),didFocusOutputInputChange:n._didFocusOutputInputChange.bind(n)},e,t,o,{...this._notebookOptions.computeWebviewOptions(),fontFamily:this._generateFontFamily()},this.notebookRendererMessaging.getScoped(this._uuid)),this._webview.element.style.width="100%",this._list.attachWebview(this._webview.element)}async _attachModel(e,t,o,n){this._ensureWebview(this.getId(),e.viewType,e.uri),this.viewModel=this.instantiationService.createInstance(ooe,t,e,this._viewContext,this.getLayoutInfo(),{isReadOnly:this._readOnly}),this._viewContext.eventDispatcher.emit([new Knt({width:!0,fontInfo:!0},this.getLayoutInfo())]),this.notebookOptions.updateOptions(this._readOnly),this._updateForOptions(),this._updateForNotebookConfiguration();{this.viewModel.restoreEditorViewState(o);let l=o?.contributionsState||{};for(let[c,u]of this._contributions)typeof u.restoreViewState=="function"&&u.restoreViewState(l[c])}this._localStore.add(this.viewModel.onDidChangeViewCells(l=>{this._onDidChangeViewCells.fire(l)})),this._localStore.add(this.viewModel.onDidChangeSelection(()=>{this._onDidChangeSelection.fire(),this.updateSelectedMarkdownPreviews()})),this._localStore.add(this._list.onWillScroll(l=>{this._webview?.isResolved()&&(this._webviewTransparentCover.style.transform=`translateY(${l.scrollTop})`)}));let r=!1,s=this._localStore.add(new ue);this._localStore.add(this._list.onDidChangeContentHeight(()=>{r||(r=!0,s.value=kr(Me(this.getDomNode()),()=>{r=!1,this._updateScrollHeight()},100))})),this._localStore.add(this._list.onDidRemoveOutputs(l=>{l.forEach(c=>this.removeInset(c))})),this._localStore.add(this._list.onDidHideOutputs(l=>{l.forEach(c=>this.hideInset(c))})),this._localStore.add(this._list.onDidRemoveCellsFromView(l=>{let c=[],u=[];for(let p of l)if(p.cellKind===1){let h=p;this.viewModel?.viewCells.find(g=>g.handle===h.handle)?c.push(h):u.push(h)}this.hideMarkupPreviews(c),this.deleteMarkupPreviews(u)})),await this._warmupWithMarkdownRenderer(this.viewModel,o,n),n?.mark("customMarkdownLoaded"),this._localCellStateListeners=this.viewModel.viewCells.map(l=>this._bindCellListener(l)),this._lastCellWithEditorFocus=this.viewModel.viewCells.find(l=>this.getActiveCell()===l&&l.focusMode===1)??null,this._localStore.add(this.viewModel.onDidChangeViewCells(l=>{this._isDisposed||([...l.splices].reverse().forEach(c=>{let[u,p,h]=c,g=this._localCellStateListeners.splice(u,p,...h.map(f=>this._bindCellListener(f)));je(g)}),l.splices.some(c=>c[2].some(u=>u.cellKind===1))&&this._backgroundMarkdownRendering())})),this._dimension?this._list.layout(this.getBodyHeight(this._dimension.height),this._dimension.width):this._list.layout(),this._dndController?.clearGlobalDragState(),this.restoreListViewState(o)}_bindCellListener(e){let t=new O;return t.add(e.onDidChangeLayout(o=>{(o.totalHeight||o.outerWidth)&&this.layoutNotebookCell(e,e.layoutInfo.totalHeight,o.context)})),e.cellKind===2&&t.add(e.onDidRemoveOutputs(o=>{o.forEach(n=>this.removeInset(n))})),t.add(e.onDidChangeState(o=>{o.inputCollapsedChanged&&e.isInputCollapsed&&e.cellKind===1&&this.hideMarkupPreviews([e]),o.outputCollapsedChanged&&e.isOutputCollapsed&&e.cellKind===2&&e.outputsViewModels.forEach(n=>this.hideInset(n)),o.focusModeChanged&&this._validateCellFocusMode(e)})),t.add(e.onCellDecorationsChanged(o=>{o.added.forEach(n=>{n.className&&this.deltaCellContainerClassNames(e.id,[n.className],[],e.cellKind),n.outputClassName&&this.deltaCellContainerClassNames(e.id,[n.outputClassName],[],e.cellKind)}),o.removed.forEach(n=>{n.className&&this.deltaCellContainerClassNames(e.id,[],[n.className],e.cellKind),n.outputClassName&&this.deltaCellContainerClassNames(e.id,[],[n.outputClassName],e.cellKind)})})),t}_validateCellFocusMode(e){e.focusMode===1&&(this._lastCellWithEditorFocus&&this._lastCellWithEditorFocus!==e&&(this._lastCellWithEditorFocus.focusMode=0),this._lastCellWithEditorFocus=e)}async _warmupWithMarkdownRenderer(e,t,o){this.logService.debug("NotebookEditorWidget","warmup "+this.viewModel?.uri.toString()),await this._resolveWebview(),o?.mark("webviewCommLoaded"),this.logService.debug("NotebookEditorWidget","warmup - webview resolved"),this._webview.element.style.visibility="hidden",await this._warmupViewportMarkdownCells(e,t),this.logService.debug("NotebookEditorWidget","warmup - viewport warmed up"),this._list.layout(0,0),this._list.attachViewModel(e),this._list.scrollTop=t?.scrollPosition?.top??0,this._debug("finish initial viewport warmup and view state restore."),this._webview.element.style.visibility="visible",this.logService.debug("NotebookEditorWidget","warmup - list view model attached, set to visible"),this._onDidAttachViewModel.fire()}async _warmupViewportMarkdownCells(e,t){if(t&&t.cellTotalHeights){let o=t.cellTotalHeights,n=t.scrollPosition?.top??0,r=n+Math.max(this._dimension?.height??0,1080),s=0,l=[];for(let c=0;c<e.length;c++){let u=e.cellAt(c),p=o[c]??0;if(s+p<n){s+=p;continue}if(u.cellKind===1&&l.push([u,s]),s+=p,s>r)break}await this._webview.initializeMarkup(l.map(([c,u])=>this.createMarkupCellInitialization(c,u)))}else{let o=e.viewCells.filter(l=>l.cellKind===1).slice(0,5).map(l=>this.createMarkupCellInitialization(l,-1e4));await this._webview.initializeMarkup(o);let n=0,r=[],s=Math.max(this._dimension?.height??0,1080);for(let l of e.viewCells)if(l.cellKind===1&&r.push({id:l.id,top:n}),n+=l.getHeight(this.getLayoutInfo().fontInfo.lineHeight),n>s)break;this._webview?.updateScrollTops([],r)}}createMarkupCellInitialization(e,t){return{mime:e.mime,cellId:e.id,cellHandle:e.handle,content:e.getText(),offset:t,visible:!1,metadata:e.metadata}}restoreListViewState(e){if(!this.viewModel)return;e?.scrollPosition!==void 0?(this._list.scrollTop=e.scrollPosition.top,this._list.scrollLeft=e.scrollPosition.left):(this._list.scrollTop=0,this._list.scrollLeft=0);let t=typeof e?.focus=="number"?e.focus:0;if(t<this.viewModel.length){let o=this.viewModel.cellAt(t);o&&this.viewModel?.updateSelectionsState({kind:0,primary:o.handle,selections:[o.handle]})}else this._list.length>0&&this.viewModel.updateSelectionsState({kind:1,focus:{start:0,end:1},selections:[{start:0,end:1}]});if(e?.editorFocused){let o=this.viewModel.cellAt(t);o&&(o.focusMode=1)}}_restoreSelectedKernel(e){if(e?.selectedKernelId&&this.textModel){let t=this.notebookKernelService.getMatchingKernel(this.textModel),o=t.all.find(n=>n.id===e.selectedKernelId);o&&!t.selected&&this.notebookKernelService.selectKernelForNotebook(o,this.textModel)}}getEditorViewState(){let e=this.viewModel?.getEditorViewState();if(!e)return{editingCells:{},cellLineNumberStates:{},editorViewStates:{},collapsedInputCells:{},collapsedOutputCells:{}};if(this._list){e.scrollPosition={left:this._list.scrollLeft,top:this._list.scrollTop};let o={};for(let n=0;n<this.viewModel.length;n++){let r=this.viewModel.cellAt(n);o[n]=r.layoutInfo.totalHeight}if(e.cellTotalHeights=o,this.viewModel){let n=this.viewModel.getFocus(),r=this.viewModel.cellAt(n.start);if(r){let s=this._list.domElementOfElement(r),l=r.getEditState()===1&&!!(s&&s.ownerDocument.activeElement&&s.contains(s.ownerDocument.activeElement));e.editorFocused=l,e.focus=n.start}}}let t={};for(let[o,n]of this._contributions)typeof n.saveViewState=="function"&&(t[o]=n.saveViewState());return e.contributionsState=t,this.textModel?.uri.scheme===Q.untitled&&(e.selectedKernelId=this.activeKernel?.id),e}_allowScrollBeyondLastLine(){return this._scrollBeyondLastLine&&!this.isReplHistory}getBodyHeight(e){return Math.max(e-(this._notebookTopToolbar?.useGlobalToolbar?26:0),0)}layout(e,t,o){if(!t&&!this._shadowElement){this._dimension=e;return}if(e.width<=0||e.height<=0){this.onWillHide();return}let n=this.layoutService.whenContainerStylesLoaded(Me(this.getDomNode()));n?n.then(()=>this.layoutNotebook(e,t)):this.layoutNotebook(e,t)}layoutNotebook(e,t){t&&(this._shadowElement=t),this._dimension=e;let o=this.getBodyHeight(e.height)-this.getLayoutInfo().stickyHeight;PL(this._body,e.width,o);let n=o;this._list.getRenderHeight()<n?(this._list.updateOptions({paddingBottom:this._allowScrollBeyondLastLine()?Math.max(0,n-50):0,paddingTop:0}),this._list.layout(n,e.width)):(this._list.layout(n,e.width),this._list.updateOptions({paddingBottom:this._allowScrollBeyondLastLine()?Math.max(0,n-50):0,paddingTop:0})),this._overlayContainer.inert=!1,this.layoutContainerOverShadowElement(t??this._shadowElement),this._webviewTransparentCover&&(this._webviewTransparentCover.style.height=`${e.height}px`,this._webviewTransparentCover.style.width=`${e.width}px`),this._notebookTopToolbar.layout(this._dimension),this._notebookOverviewRuler.layout(),this._viewContext?.eventDispatcher.emit([new Knt({width:!0,fontInfo:!0},this.getLayoutInfo())])}layoutContainerOverShadowElement(e){if(!e)return;let t=this.editorGroupsService.activeModalEditorPart?.modalElement,n=go(t)&&t.contains(e)?void 0:this.layoutService.getContainer(Me(this.getDomNode()),"workbench.parts.editor");this._overlayContainer.style.visibility="visible",this._overlayLayout.setAnchorElement(e,{clippingContainer:n}),this._overlayLayout.reapplyLayoutStyles()}focus(){if(this._isVisible=!0,this._editorFocus.set(!0),this._webviewFocused)this._webview?.focusWebview();else{if(this.viewModel){let e=this.viewModel.getFocus(),t=this.viewModel.cellAt(e.start);if(this.hasEditorFocus()||(this.focusContainer(),this.updateEditorFocus()),t&&t.focusMode===1){t.updateEditState(1,"editorWidget.focus"),t.focusMode=1,this.focusEditor(t);return}}this._list.domFocus()}this._currentProgress&&this.showProgress()}onShow(){this._isVisible=!0}focusEditor(e){for(let[t,o]of this._renderedEditors.entries())if(t===e){o.focus();return}}focusContainer(e=!1){this._webviewFocused?this._webview?.focusWebview():this._list.focusContainer(e)}selectOutputContent(e){this._webview?.selectOutputContents(e)}selectInputContents(e){this._webview?.selectInputContents(e)}onWillHide(){this._isVisible=!1,this._editorFocus.set(!1),this._overlayContainer.inert=!0,this._overlayContainer.style.visibility="hidden",this._overlayContainer.style.left="-50000px",this._notebookTopToolbarContainer.style.display="none",this.clearActiveCellWidgets()}clearActiveCellWidgets(){this._renderedEditors.forEach((e,t)=>{this.getActiveCell()===t&&e&&(Sc.get(e)?.cancelSuggestWidget(),Gh.get(e)?.clearWidgets(),Ju.get(e)?.clearWidgets())}),this._renderedEditors.forEach((e,t)=>{cd.get(e)?.model.get()?.inlineEditState.get()&&e.render(!0)})}editorHasDomFocus(){return Is(this.getDomNode())}updateEditorFocus(){this._focusTracker.refreshState();let e=this.editorHasDomFocus();this._editorFocus.set(e),this.viewModel?.setEditorFocus(e)}updateCellFocusMode(){let e=this.getActiveCell();e?.focusMode===2&&!this._webviewFocused&&(e.focusMode=0)}hasEditorFocus(){return this.updateEditorFocus(),this.editorHasDomFocus()}hasWebviewFocus(){return this._webviewFocused}hasOutputTextSelection(){if(!this.hasEditorFocus())return!1;let e=Me(this.getDomNode()).getSelection();if(e?.rangeCount!==1)return!1;let t=e.getRangeAt(0);if(t.startContainer===t.endContainer&&t.endOffset-t.startOffset===0)return!1;let o=t.commonAncestorContainer;if(!this._body.contains(o))return!1;for(;o&&o!==this._body;){if(o.classList&&o.classList.contains("output"))return!0;o=o.parentNode}return!1}_didFocusOutputInputChange(e){this._outputInputFocus.set(e)}focusElement(e){this.viewModel?.updateSelectionsState({kind:0,primary:e.handle,selections:[e.handle]})}get scrollTop(){return this._list.scrollTop}get scrollBottom(){return this._list.scrollTop+this._list.getRenderHeight()}getAbsoluteTopOfElement(e){return this._list.getCellViewScrollTop(e)}getAbsoluteBottomOfElement(e){return this._list.getCellViewScrollBottom(e)}getHeightOfElement(e){return this._list.elementHeight(e)}scrollToBottom(){this._list.scrollToBottom()}setScrollTop(e){this._list.scrollTop=e}revealCellRangeInView(e){return this._list.revealCells(e)}revealInView(e){return this._list.revealCell(e,1)}revealInViewAtTop(e){this._list.revealCell(e,2)}revealInCenter(e){this._list.revealCell(e,3)}async revealInCenterIfOutsideViewport(e){await this._list.revealCell(e,4)}async revealFirstLineIfOutsideViewport(e){await this._list.revealCell(e,6)}async revealLineInViewAsync(e,t){return this._list.revealRangeInCell(e,new G(t,1,t,1),1)}async revealLineInCenterAsync(e,t){return this._list.revealRangeInCell(e,new G(t,1,t,1),2)}async revealLineInCenterIfOutsideViewportAsync(e,t){return this._list.revealRangeInCell(e,new G(t,1,t,1),3)}async revealRangeInViewAsync(e,t){return this._list.revealRangeInCell(e,t,1)}async revealRangeInCenterAsync(e,t){return this._list.revealRangeInCell(e,t,2)}async revealRangeInCenterIfOutsideViewportAsync(e,t){return this._list.revealRangeInCell(e,t,3)}revealCellOffsetInCenter(e,t){return this._list.revealCellOffsetInCenter(e,t)}revealOffsetInCenterIfOutsideViewport(e){return this._list.revealOffsetInCenterIfOutsideViewport(e)}getViewIndexByModelIndex(e){if(!this._listViewInfoAccessor)return-1;let t=this.viewModel?.viewCells[e];return t?this._listViewInfoAccessor.getViewIndex(t):-1}getViewHeight(e){return this._listViewInfoAccessor?this._listViewInfoAccessor.getViewHeight(e):-1}getCellRangeFromViewRange(e,t){return this._listViewInfoAccessor.getCellRangeFromViewRange(e,t)}getCellsInRange(e){return this._listViewInfoAccessor.getCellsInRange(e)}setCellEditorSelection(e,t){this._list.setCellEditorSelection(e,t)}setHiddenAreas(e){return this._list.setHiddenAreas(e,!0)}getVisibleRangesPlusViewportAboveAndBelow(){return this._listViewInfoAccessor.getVisibleRangesPlusViewportAboveAndBelow()}deltaCellDecorations(e,t){let o=this.viewModel?.deltaCellDecorations(e,t)||[];return this._onDidChangeDecorations.fire(),o}deltaCellContainerClassNames(e,t,o,n){n===1?this._webview?.deltaMarkupPreviewClassNames(e,t,o):this._webview?.deltaCellOutputContainerClassNames(e,t,o)}changeModelDecorations(e){return this.viewModel?.changeModelDecorations(e)||null}changeViewZones(e){this._list.changeViewZones(e),this._onDidChangeLayout.fire()}getViewZoneLayoutInfo(e){return this._list.getViewZoneLayoutInfo(e)}changeCellOverlays(e){this._list.changeCellOverlays(e)}async _loadKernelPreloads(){if(!this.hasModel())return;let{selected:e}=this.notebookKernelService.getMatchingKernel(this.textModel);this._webview?.isResolved()||await this._resolveWebview(),this._webview?.updateKernelPreloads(e)}get activeKernel(){return this.textModel&&this.notebookKernelService.getSelectedOrSuggestedKernel(this.textModel)}async cancelNotebookCells(e){if(!(!this.viewModel||!this.hasModel()))return e||(e=this.viewModel.viewCells),this.notebookExecutionService.cancelNotebookCellHandles(this.textModel,Array.from(e).map(t=>t.handle))}async executeNotebookCells(e){if(!this.viewModel||!this.hasModel()){this.logService.info("notebookEditorWidget","No NotebookViewModel, cannot execute cells");return}return e||(e=this.viewModel.viewCells),this.notebookExecutionService.executeNotebookCells(this.textModel,Array.from(e).map(t=>t.model),this.scopedContextKeyService)}async layoutNotebookCell(e,t,o){return this._cellLayoutManager?.layoutNotebookCell(e,t)}getActiveCell(){let e=this._list.getFocusedElements();if(e&&e.length)return e[0]}_toggleNotebookCellSelection(e,t){let o=this._list.getSelectedElements(),n=o.includes(e),r=t?o[o.length-1]??e:e,s=this._list.getViewIndex(e),l=this._list.getViewIndex(r),c=this.getCellsInViewRange(s,l);n?this._list.selectElements(o.filter(u=>!c.includes(u))):(this.focusElement(e),this._list.selectElements([...o.filter(u=>!c.includes(u)),...c]))}getCellsInViewRange(e,t){let o=[];for(let n=0;n<this._list.length;++n){let r=this._list.element(n);r&&(n>=e&&n<=t||n>=t&&n<=e)&&o.push(r)}return o}async focusNotebookCell(e,t,o){if(!this._isDisposed)if(e.focusedOutputId=void 0,t==="editor"){if(e.isInputCollapsed=!1,this.focusElement(e),this._list.focusView(),e.updateEditState(1,"focusNotebookCell"),e.focusMode=1,!o?.skipReveal)if(typeof o?.focusEditorLine=="number"){this._cursorNavMode.set(!0),await this.revealLineInViewAsync(e,o.focusEditorLine);let n=this._renderedEditors.get(e),r=o.focusEditorLine;n?.setSelection({startLineNumber:r,startColumn:1,endLineNumber:r,endColumn:1})}else{let n=e.getSelectionsStartPosition();if(n?.length){let r=n[0];await this.revealRangeInViewAsync(e,G.fromPositions(r,r))}else await this.revealInView(e)}}else if(t==="output"){if(this.focusElement(e),this.hasEditorFocus()||this._list.focusView(),!this._webview)return;let n=e.outputsViewModels.find(s=>s.model.alternativeOutputId)?.model.alternativeOutputId,r=o?.outputId??n??e.id;this._webview.focusOutput(r,o?.altOutputId,o?.outputWebviewFocused||this._webviewFocused),e.updateEditState(0,"focusNotebookCell"),e.focusMode=2,e.focusedOutputId=o?.outputId,this._outputFocus.set(!0),o?.skipReveal||this.revealInCenterIfOutsideViewport(e)}else{let n=this._list.domElementOfElement(e);n&&n.ownerDocument.activeElement&&n.contains(n.ownerDocument.activeElement)&&n.ownerDocument.activeElement.blur(),this._webview?.blurOutput(),e.updateEditState(0,"focusNotebookCell"),e.focusMode=0,this.focusElement(e),o?.skipReveal||(typeof o?.focusEditorLine=="number"?(this._cursorNavMode.set(!0),await this.revealInView(e)):o?.revealBehavior===1?await this.revealFirstLineIfOutsideViewport(e):o?.revealBehavior===0?await this.revealInView(e):await this.revealInCenterIfOutsideViewport(e)),this._list.focusView(),this.updateEditorFocus()}}async focusNextNotebookCell(e,t){let o=this.viewModel?.getCellIndex(e);if(typeof o!="number")return;let n=this.viewModel?.cellAt(o+1);n&&await this.focusNotebookCell(n,t)}async _warmupCell(e){if(e.isOutputCollapsed)return;let t=e.outputsViewModels;for(let o of t.slice(0,ZNe)){let[n,r]=o.resolveMimeTypes(this.textModel,void 0);if(!n.find(p=>p.isTrusted)||n.length===0)continue;let s=n[r];if(!s)return;let l=this._notebookService.getRendererInfo(s.rendererId);if(!l)return;let c={type:1,renderer:l,source:o,mimeType:s.mimeType},u=this._webview?.insetMapping.get(c.source);if(!u||!u.initialized){let p=new Promise(h=>{this._register(U.any(this.onDidRenderOutput,this.onDidRemoveOutput)(g=>{g.model===c.source.model&&h()}))});this.createOutput(e,c,0,!1),await p}else this.createOutput(e,c,0,!1);return}}async _warmupAll(e){if(!this.hasModel()||!this.viewModel)return;let t=this.viewModel.viewCells,o=[];for(let n=0;n<t.length;n++)t[n].cellKind===1&&!this._webview.markupPreviewMapping.has(t[n].id)&&o.push(this.createMarkupPreview(t[n]));if(e&&this._list)for(let n=0;n<this._list.length;n++){let r=this._list.element(n);r?.cellKind===2&&o.push(this._warmupCell(r))}return Promise.all(o)}async _warmupSelection(e,t){if(!this.hasModel()||!this.viewModel)return;let o=this.viewModel.viewCells,n=[];for(let r of t)for(let s=r.start;s<r.end;s++)o[s].cellKind===1&&!this._webview.markupPreviewMapping.has(o[s].id)&&n.push(this.createMarkupPreview(o[s]));if(e&&this._list)for(let r of t)for(let s=r.start;s<r.end;s++){let l=this._list.element(s);l?.cellKind===2&&n.push(this._warmupCell(l))}return Promise.all(n)}async find(e,t,o,n=!1,r=!1,s){if(!this._notebookViewModel)return[];s||(s=this.getId());let l=this._notebookViewModel.find(e,t).filter(p=>p.length>0);if(!t.includeMarkupPreview&&!t.includeOutput||t.findScope?.findScopeType==="text")return this._webview?.findStop(s),l;let c={};if(l.forEach(p=>{c[p.cell.id]=p}),this._webview){let p=Date.now();t.findScope&&t.findScope.findScopeType==="cells"&&t.findScope.selectedCellRanges?await this._warmupSelection(!!t.includeOutput,t.findScope.selectedCellRanges):await this._warmupAll(!!t.includeOutput);let h=Date.now();if(this.logService.debug("Find",`Warmup time: ${h-p}ms`),o.isCancellationRequested)return[];let g=[];t.findScope&&t.findScope.findScopeType==="cells"&&t.findScope.selectedCellRanges&&(g=yv(t.findScope.selectedCellRanges).map(b=>this._notebookViewModel?.viewCells[b].id??""));let f=await this._webview.find(e,{caseSensitive:t.caseSensitive,wholeWord:t.wholeWord,includeMarkup:!!t.includeMarkupPreview,includeOutput:!!t.includeOutput,shouldGetSearchPreviewInfo:r,ownerID:s,findIds:g});if(o.isCancellationRequested)return[];f.forEach(v=>{let b=this._notebookViewModel.viewCells.find(y=>y.id===v.cellId);if(!b)return;if(v.type==="preview"){if(b.getEditState()===0&&!t.includeMarkupPreview||b.getEditState()===1&&t.includeMarkupInput)return}else if(!t.includeOutput)return;let S=c[v.cellId];S?S.webviewMatches.push(v):c[v.cellId]=new HQ(this._notebookViewModel.viewCells.find(y=>y.id===v.cellId),this._notebookViewModel.viewCells.findIndex(y=>y.id===v.cellId),[],[v])})}let u=[];return this._notebookViewModel.viewCells.forEach((p,h)=>{c[p.id]&&u.push(new HQ(p,h,c[p.id].contentMatches,c[p.id].webviewMatches))}),u}async findHighlightCurrent(e,t){return this._webview?this._webview?.findHighlightCurrent(e,t??this.getId()):0}async findUnHighlightCurrent(e,t){if(this._webview)return this._webview?.findUnHighlightCurrent(e,t??this.getId())}findStop(e){this._webview?.findStop(e??this.getId())}getLayoutInfo(){if(!this._list)throw new Error("Editor is not initalized successfully");this._fontInfo||this._generateFontInfo();let e=0;return this._dimension&&(e=(this._notebookTopToolbar?.useGlobalToolbar?26:0)+(this._notebookStickyScroll?.getCurrentStickyHeight()??0)),{width:this._dimension?.width??0,height:this._dimension?.height??0,scrollHeight:this._list?.getScrollHeight()??0,fontInfo:this._fontInfo,stickyHeight:this._notebookStickyScroll?.getCurrentStickyHeight()??0,listViewOffsetTop:e}}async createMarkupPreview(e){if(!this._webview||(this._webview.isResolved()||await this._resolveWebview(),!this._webview||!this._list.webviewElement)||!this.viewModel||!this._list.viewModel||this.viewModel.getCellIndex(e)===-1||this.cellIsHidden(e))return;let t=parseInt(this._list.webviewElement.domNode.style.top,10),o=t?0-t:0,n=this._list.getCellViewScrollTop(e);await this._webview.showMarkupPreview({mime:e.mime,cellHandle:e.handle,cellId:e.id,content:e.getText(),offset:n+o,visible:!0,metadata:e.metadata})}cellIsHidden(e){let t=this.viewModel.getCellIndex(e);return this.viewModel.getHiddenRanges().some(n=>t>=n.start&&t<=n.end)}async unhideMarkupPreviews(e){this._webview&&(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.unhideMarkupPreviews(e.map(t=>t.id)))}async hideMarkupPreviews(e){!this._webview||!e.length||(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.hideMarkupPreviews(e.map(t=>t.id)))}async deleteMarkupPreviews(e){this._webview&&(this._webview.isResolved()||await this._resolveWebview(),await this._webview?.deleteMarkupPreviews(e.map(t=>t.id)))}async updateSelectedMarkdownPreviews(){if(!this._webview)return;this._webview.isResolved()||await this._resolveWebview();let e=this.getSelectionViewModels().map(t=>t.id);await this._webview?.updateMarkupPreviewSelections(e.length>1?e:[])}async createOutput(e,t,o,n){this._insetModifyQueueByOutputId.queue(t.source.model.outputId,async()=>{if(this._isDisposed||!this._webview||(this._webview.isResolved()||await this._resolveWebview(),!this._webview)||!this._list.webviewElement)return;t.type===1&&this.notebookRendererMessaging.prepare(t.renderer.id);let r=parseInt(this._list.webviewElement.domNode.style.top,10),s=r?0-r:0,l=this._list.getCellViewScrollTop(e)+s,c=this._webview.insetMapping.get(t.source);if(!c||!c.renderer&&t.type===1)n?this._webview.requestCreateOutputWhenWebviewIdle({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o):this._webview.createOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o);else if(c.renderer&&t.type===1&&c.renderer.id!==t.renderer.id)this._webview.removeInsets([t.source]),this._webview.createOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri},t,l,o);else if(c.versionId!==t.source.model.versionId)this._webview.updateOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri,executionId:e.internalMetadata.executionId},t,l,o);else{let u=e.outputsViewModels.indexOf(t.source),p=e.getOutputOffset(u);this._webview.updateScrollTops([{cell:e,output:t.source,cellTop:l,outputOffset:p,forceDisplay:!e.isOutputCollapsed}],[])}})}async updateOutput(e,t,o){this._insetModifyQueueByOutputId.queue(t.source.model.outputId,async()=>{if(this._isDisposed||!this._webview||e.isOutputCollapsed||(this._webview.isResolved()||await this._resolveWebview(),!this._webview||!this._list.webviewElement))return;if(!this._webview.insetMapping.has(t.source))return this.createOutput(e,t,o,!1);t.type===1&&this.notebookRendererMessaging.prepare(t.renderer.id);let n=parseInt(this._list.webviewElement.domNode.style.top,10),r=n?0-n:0,s=this._list.getCellViewScrollTop(e)+r;this._webview.updateOutput({cellId:e.id,cellHandle:e.handle,cellUri:e.uri},t,s,o)})}async copyOutputImage(e){this._webview?.copyImage(e)}removeInset(e){this._insetModifyQueueByOutputId.queue(e.model.outputId,async()=>{this._isDisposed||!this._webview||(this._webview?.isResolved()&&this._webview.removeInsets([e]),this._onDidRemoveOutput.fire(e))})}hideInset(e){this._insetModifyQueueByOutputId.queue(e.model.outputId,async()=>{this._isDisposed||!this._webview||this._webview?.isResolved()&&this._webview.hideInset(e)})}postMessage(e){this._webview?.isResolved()&&this._webview.postKernelMessage(e)}addClassName(e){this._overlayContainer.classList.add(e)}removeClassName(e){this._overlayContainer.classList.remove(e)}cellAt(e){return this.viewModel?.cellAt(e)}getCellByInfo(e){let{cellHandle:t}=e;return this.viewModel?.viewCells.find(o=>o.handle===t)}getCellByHandle(e){return this.viewModel?.getCellByHandle(e)}getCellIndex(e){return this.viewModel?.getCellIndexByHandle(e.handle)}getNextVisibleCellIndex(e){return this.viewModel?.getNextVisibleCellIndex(e)}getPreviousVisibleCellIndex(e){return this.viewModel?.getPreviousVisibleCellIndex(e)}_updateScrollHeight(){if(this._isDisposed||!this._webview?.isResolved()||!this._list.webviewElement)return;let e=this._list.scrollHeight;this._webview.element.style.height=`${e+sfe*2}px`;let t=parseInt(this._list.webviewElement.domNode.style.top,10),o=t?0-t:0,n=[],r=[];this._webview?.insetMapping.forEach((l,c)=>{let u=this.viewModel?.getCellByHandle(l.cellInfo.cellHandle);if(!u||!(u instanceof Ah)||this._list.getViewIndex(u)===void 0)return;let h=u.outputsViewModels.indexOf(c);if(h<0){r.push(c);return}let g=this._list.getCellViewScrollTop(u),f=u.getOutputOffset(h);n.push({cell:u,output:c,cellTop:g+o,outputOffset:f,forceDisplay:!1})}),this._webview.removeInsets(r);let s=[];for(let l of this._webview.markupPreviewMapping.keys()){let c=this.viewModel?.viewCells.find(u=>u.id===l);if(c){let u=this._list.getCellViewScrollTop(c);s.push({id:l,top:u+o})}}(s.length||n.length)&&(this._debug("_list.onDidChangeContentHeight/markdown",s),this._webview?.updateScrollTops(n,s))}_updateOutputHeight(e,t,o,n,r){let s=this.viewModel?.viewCells.find(l=>l.handle===e.cellHandle);if(s&&s instanceof Ah){let l=s.outputsViewModels.indexOf(t);l>-1?(this._debug("update cell output",s.handle,o),s.updateOutputHeight(l,o,r),this.layoutNotebookCell(s,s.layoutInfo.totalHeight),n&&this._onDidRenderOutput.fire(t)):this._debug("tried to update cell output that does not exist")}}_scheduleOutputHeightAck(e,t,o){let n=this._pendingOutputHeightAcks.size===0;this._pendingOutputHeightAcks.set(t,{cellId:e.cellId,outputId:t,height:o}),n&&kr(Me(this.getDomNode()),()=>{this._debug("ack height"),this._updateScrollHeight(),this._webview?.ackHeight([...this._pendingOutputHeightAcks.values()]),this._pendingOutputHeightAcks.clear()},-1)}_getCellById(e){return this.viewModel?.viewCells.find(t=>t.id===e)}_updateMarkupCellHeight(e,t,o){let n=this._getCellById(e);if(n&&n instanceof hS){let{bottomToolbarGap:r}=this._notebookOptions.computeBottomToolbarDimensions(this.viewModel?.viewType);this._debug("updateMarkdownCellHeight",n.handle,t+r,o),n.renderedMarkdownHeight=t}}_setMarkupCellEditState(e,t){let o=this._getCellById(e);o instanceof hS&&(this.revealInView(o),o.updateEditState(t,"setMarkdownCellEditState"))}_didStartDragMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof hS){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;this._dndController?.startExplicitDrag(o,t.dragOffsetY-n)}}_didDragMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof hS){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;this._dndController?.explicitDrag(o,t.dragOffsetY-n)}}_didDropMarkupCell(e,t){let o=this._getCellById(e);if(o instanceof hS){let n=this._list.webviewElement?-parseInt(this._list.webviewElement.domNode.style.top,10):0;t.dragOffsetY-=n,this._dndController?.explicitDrop(o,t)}}_didEndDragMarkupCell(e){let t=this._getCellById(e);t instanceof hS&&this._dndController?.endExplicitDrag(t)}_didResizeOutput(e){let t=this._getCellById(e);t&&this._onDidResizeOutputEmitter.fire(t)}_updatePerformanceMetadata(e,t,o,n){if(!this.hasModel())return;let r=this._getCellById(e),s=r?this.getCellIndex(r):void 0;if(r?.internalMetadata.executionId===t&&s!==void 0){let l=r.internalMetadata.renderDuration||{};l[n]=(l[n]??0)+o,this.textModel.applyEdits([{editType:9,index:s,internalMetadata:{executionId:t,renderDuration:l}}],!0,void 0,()=>{},void 0,!1)}}getContribution(e){return this._contributions.get(e)||null}dispose(){this._isDisposed=!0,this._webview?.dispose(),this._webview=null,this.notebookEditorService.removeNotebookEditor(this),je(this._contributions.values()),this._contributions.clear(),this._localStore.clear(),je(this._localCellStateListeners),this._list.dispose(),this._cellLayoutManager?.dispose(),this._listTopCellToolbar?.dispose(),this._overlayContainer.remove(),this.viewModel?.dispose(),this._renderedEditors.clear(),this._baseCellEditorOptions.forEach(e=>e.dispose()),this._baseCellEditorOptions.clear(),this._notebookOverviewRulerContainer.remove(),super.dispose(),this._webview=null,this._webviewResolvePromise=null,this._webviewTransparentCover=null,this._dndController=null,this._listTopCellToolbar=null,this._notebookViewModel=void 0,this._cellContextKeyManager=null,this._notebookTopToolbar=null,this._list=null,this._listViewInfoAccessor=null,this._listDelegate=null}toJSON(){return{notebookUri:this.viewModel?.uri}}};Lq=I([m(2,F),m(3,kt),m(4,CLe),m(5,hd),m(6,Ql),m(7,kn),m(8,B),m(9,X),m(10,wi),m(11,Xe),m(12,_e),m(13,LZ),m(14,Hd),m(15,Sb)],Lq);FE(0,5,"notebook-progress-bar");FE(0,10,"notebook-list-insertion-indicator");FE(0,20,"notebook-cell-editor-outline");FE(0,25,"notebook-scrollbar");FE(0,26,"notebook-cell-status");FE(0,26,"notebook-folding-indicator");FE(0,27,"notebook-output");FE(0,28,"notebook-cell-bottom-toolbar-container");FE(0,29,"notebook-run-button-container");FE(0,29,"notebook-input-collapse-condicon");FE(0,30,"notebook-cell-output-toolbar");FE(35,1,"notebook-cell-expand-part-button");FE(35,2,"notebook-cell-toolbar");FE(35,3,"notebook-cell-toolbar-dropdown-active");var oMi=te("notebook.cellBorderColor",{dark:ni(bv,1),light:ni(bv,1),hcDark:ob,hcLight:ob},d(13836,null)),X$u=te("notebook.focusedEditorBorder",Kc,d(13844,null)),Kyo=te("notebookStatusSuccessIcon.foreground",XNe,d(13857,null)),Gyo=te("notebookEditorOverviewRuler.runningCellForeground",XNe,d(13851,null)),qyo=te("notebookStatusErrorIcon.foreground",Hce,d(13855,null)),J$u=te("notebookStatusRunningIcon.foreground",xo,d(13856,null)),Z$u=te("notebook.outputContainerBorderColor",null,d(13848,null)),eju=te("notebook.outputContainerBackgroundColor",null,d(13847,null)),tju=te("notebook.cellToolbarSeparator",{dark:Ue.fromHex("#808080").transparent(.35),light:Ue.fromHex("#808080").transparent(.35),hcDark:Ei,hcLight:Ei},d(13841,null)),zyo=te("notebook.focusedCellBackground",null,d(13835,null)),iju=te("notebook.selectedCellBackground",{dark:bv,light:bv,hcDark:null,hcLight:null},d(13858,null)),oju=te("notebook.cellHoverBackground",{dark:ni(zyo,.5),light:ni(zyo,.7),hcDark:null,hcLight:null},d(13838,null)),nju=te("notebook.selectedCellBorder",{dark:oMi,light:oMi,hcDark:Ei,hcLight:Ei},d(13849,null)),rju=te("notebook.inactiveSelectedCellBorder",{dark:null,light:null,hcDark:Kc,hcLight:Kc},d(13846,null)),sju=te("notebook.focusedCellBorder",Kc,d(13843,null)),aju=te("notebook.inactiveFocusedCellBorder",oMi,d(13845,null)),lju=te("notebook.cellStatusBarItemHoverBackground",{light:new Ue(new Ut(0,0,0,.08)),dark:new Ue(new Ut(255,255,255,.15)),hcDark:new Ue(new Ut(255,255,255,.15)),hcLight:new Ue(new Ut(0,0,0,.08))},d(13840,null)),cju=te("notebook.cellInsertionIndicator",Kc,d(13839,null)),dju=te("notebookScrollbarSlider.background",iX,d(13853,null)),uju=te("notebookScrollbarSlider.hoverBackground",Jz,d(13854,null)),pju=te("notebookScrollbarSlider.activeBackground",Zz,d(13852,null)),mju=te("notebook.symbolHighlightBackground",{dark:Ue.fromHex("#ffffff0b"),light:Ue.fromHex("#fdff0033"),hcDark:null,hcLight:null},d(13850,null)),hju=te("notebook.cellEditorBackground",{light:ch,dark:ch,hcDark:null,hcLight:null},d(13837,null)),noe=te("notebook.editorBackground",{light:iYe,dark:iYe,hcDark:null,hcLight:null},d(13842,null));var jan={top:24,bottom:24},$yo={top:12,bottom:12};function aO(a){return a===1?jan:$yo}var LOe={padding:$yo,scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",vertical:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},renderLineHighlightOnlyWhenFocus:!0,overviewRulerLanes:0,overviewRulerBorder:!1,selectOnLineNumbers:!1,wordWrap:"off",lineNumbers:"off",glyphMargin:!0,fixedOverflowWidgets:!0,minimap:{enabled:!1},renderValidationDecorations:"on",renderLineHighlight:"none",readOnly:!0},MOe={...LOe,glyphMargin:!0,enableSplitViewResizing:!1,renderIndicators:!0,renderMarginRevertIcon:!1,readOnly:!1,isInEmbeddedEditor:!0,renderOverviewRuler:!1,wordWrap:"off",diffWordWrap:"off",diffAlgorithm:"advanced",renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1};var hfe=class extends k{constructor(e,t){super();this.textModel=e;this._notebookService=t;this._onDidChangeState=this._register(new T);this._hoveringOutput=!1;this._focusOnOutput=!1;this._focusInputInOutput=!1;this._outputCollection=[];this._outputsTop=null;this._onDidChangeOutputLayout=this._register(new T);this.onDidChangeOutputLayout=this._onDidChangeOutputLayout.event;this._id=ht(),this._outputViewModels=this.textModel.outputs.map(o=>new toe(this,o,this._notebookService)),this._register(this.textModel.onDidChangeOutputs(o=>{this._outputCollection.splice(o.start,o.deleteCount,...o.newOutputs.map(()=>0)),this._outputViewModels.splice(o.start,o.deleteCount,...o.newOutputs.map(r=>new toe(this,r,this._notebookService))).forEach(r=>r.dispose()),this._outputsTop=null,this._onDidChangeOutputLayout.fire()})),this._outputCollection=new Array(this.textModel.outputs.length)}get id(){return this._id}get outputs(){return this.textModel.outputs}get language(){return this.textModel.language}get metadata(){return this.textModel.metadata}get uri(){return this.textModel.uri}get handle(){return this.textModel.handle}get outputIsHovered(){return this._hoveringOutput}set outputIsHovered(e){this._hoveringOutput=e,this._onDidChangeState.fire({outputIsHoveredChanged:!0})}get outputIsFocused(){return this._focusOnOutput}set outputIsFocused(e){this._focusOnOutput=e,this._onDidChangeState.fire({outputIsFocusedChanged:!0})}get inputInOutputIsFocused(){return this._focusInputInOutput}set inputInOutputIsFocused(e){this._focusInputInOutput=e}get outputsViewModels(){return this._outputViewModels}_ensureOutputsTop(){if(!this._outputsTop){let e=new Uint32Array(this._outputCollection.length);for(let t=0;t<this._outputCollection.length;t++)e[t]=this._outputCollection[t];this._outputsTop=new fD(e)}}getOutputOffset(e){if(this._ensureOutputsTop(),e>=this._outputCollection.length)throw new Error("Output index out of range!");return this._outputsTop.getPrefixSum(e-1)}updateOutputHeight(e,t){if(e>=this._outputCollection.length)throw new Error("Output index out of range!");this._ensureOutputsTop(),this._outputCollection[e]=t,this._outputsTop.setValue(e,t)&&this._onDidChangeOutputLayout.fire()}getOutputTotalHeight(){return this._ensureOutputsTop(),this._outputsTop?.getTotalSum()??0}dispose(){super.dispose(),this._outputViewModels.forEach(e=>{e.dispose()})}};hfe=I([m(1,kn)],hfe);var _2t=class{constructor(i,e){this.source=i;this.value=e;this.type=1}};var POe=class extends k{constructor(){super(...arguments);this._onDidChangeLayout=this._register(new T);this.onDidChangeLayout=this._onDidChangeLayout.event;this._onDidChangeCellLayout=this._register(new T);this.onDidChangeCellLayout=this._onDidChangeCellLayout.event}emit(e){for(let t=0,o=e.length;t<o;t++){let n=e[t];switch(n.type){case 1:this._onDidChangeLayout.fire(n);break;case 2:this._onDidChangeCellLayout.fire(n);break}}}};var zR=16,gfe=new Y("notebook.diffEditor.cell.inputChanged",!1),crt=new Y("notebook.diffEditor.metadataChanged",!1),nMi="notebook.diffEditor.cell.ignoreWhitespace",jyo=new Y(nMi,!1),ffe=new Y("notebook.diffEditor.cell.property.changed",!1),D2t=new Y("notebook.diffEditor.cell.property.expanded",!1),Qyo=new Y("notebook.diffEditor.allCollapsed",void 0,d(13736,null)),vfe=new Y("notebook.diffEditor.hasUnchangedCells",void 0,d(13737,null)),drt=new Y("notebook.diffEditor.unchangedCellsAreHidden",void 0,d(13740,null)),zQ=new Y("notebook.diffEditor.item.kind",void 0,d(13738,null)),KQ=new Y("notebook.diffEditor.item.state",void 0,d(13739,null));function R2t(a,i){let e={};if(a){let o=new Set([...Object.keys(i)]);for(let n of o)a[n]||(e[n]=i[n])}else e=i;return dW(e,{})}var urt=class extends k{constructor(e){super();this.notebookModel=e;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._textBufferHash=null;this.uri=E7e.generate(this.notebookModel.uri),this._register(this.notebookModel.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===11||o.kind===1)&&(this._textBuffer?.dispose(),this._textBuffer=void 0,this._textBufferHash=null,this._onDidChange.fire())}))}get metadata(){return this.notebookModel.metadata}get textBuffer(){if(this._textBuffer)return this._textBuffer;let e=R2t(this.notebookModel.transientOptions.transientDocumentMetadata,this.metadata);return this._textBuffer=this._register(xK(e,1).textBuffer),this._register(this._textBuffer.onDidChangeContent(()=>{this._onDidChange.fire()})),this._textBuffer}getHash(){if(this._textBufferHash!==null)return this._textBufferHash;let e=new wI,t=this.textBuffer.createSnapshot(!1),o;for(;o=t.read();)e.update(o);return this._textBufferHash=e.digest(),this._textBufferHash}getValue(){let e=this.getFullModelRange();return this.textBuffer.getEOL()===`
`?this.textBuffer.getValueInRange(e,1):this.textBuffer.getValueInRange(e,2)}getFullModelRange(){let e=this.textBuffer.getLineCount();return new G(1,1,e,this.textBuffer.getLineLength(e)+1)}};var L2t=25,Yyo=24,Xyo=17;var hrt=1440,prt=class extends k{constructor(e,t,o){super();this.mainDocumentTextModel=e;this.editorEventDispatcher=t;this.initData=o;this._layoutInfoEmitter=this._register(new T);this.onDidLayoutChange=this._layoutInfoEmitter.event;this._register(this.editorEventDispatcher.onDidChangeLayout(n=>this._layoutInfoEmitter.fire({outerWidth:!0})))}},M2t=class extends prt{constructor(e,t,o){super(e,t,o);this.type="placeholder";this.hiddenCells=[];this._unfoldHiddenCells=this._register(new T);this.onUnfoldHiddenCells=this._unfoldHiddenCells.event;this.renderOutput=!1}get totalHeight(){return 24+2*zR}getHeight(e){return this.totalHeight}layoutChange(){}showHiddenCells(){this._unfoldHiddenCells.fire()}},AOe=class extends prt{constructor(e,t,o,n,r,s,l){super(e,n,r);this.originalDocumentTextModel=e;this.modifiedDocumentTextModel=t;this.type=o;this.editorHeightCalculator=l;this.renderOutput=!1;this._sourceEditorViewState=null;let c=L2t;this._layoutInfo={width:0,editorHeight:0,editorMargin:0,metadataHeight:0,cellStatusHeight:c,metadataStatusHeight:0,rawOutputHeight:0,outputTotalHeight:0,outputStatusHeight:0,outputMetadataHeight:0,bodyMargin:32,totalHeight:82+c+0,layoutState:0},this.cellFoldingState=o==="modifiedMetadata"?0:1,this.originalMetadata=this._register(new urt(e)),this.modifiedMetadata=this._register(new urt(t))}set editorHeight(e){this._layout({editorHeight:e})}get editorHeight(){throw new Error("Use Cell.layoutInfo.editorHeight")}set editorMargin(e){this._layout({editorMargin:e})}get editorMargin(){throw new Error("Use Cell.layoutInfo.editorMargin")}get layoutInfo(){return this._layoutInfo}get totalHeight(){return this.layoutInfo.totalHeight}async computeHeights(){if(this.type==="unchangedMetadata")this.editorHeight=this.editorHeightCalculator.computeHeightFromLines(this.originalMetadata.textBuffer.getLineCount());else{let e=this.originalMetadata.uri,t=this.modifiedMetadata.uri;this.editorHeight=await this.editorHeightCalculator.diffAndComputeHeight(e,t)}}layoutChange(){this._layout({recomputeOutput:!0})}_layout(e){let t=e.width!==void 0?e.width:this._layoutInfo.width,o=e.editorHeight!==void 0?e.editorHeight:this._layoutInfo.editorHeight,n=e.editorMargin!==void 0?e.editorMargin:this._layoutInfo.editorMargin,r=e.cellStatusHeight!==void 0?e.cellStatusHeight:this._layoutInfo.cellStatusHeight,s=e.bodyMargin!==void 0?e.bodyMargin:this._layoutInfo.bodyMargin,l=o+n+r+s,c={width:t,editorHeight:o,editorMargin:n,metadataHeight:0,cellStatusHeight:r,metadataStatusHeight:0,outputTotalHeight:0,outputStatusHeight:0,bodyMargin:s,rawOutputHeight:0,outputMetadataHeight:0,totalHeight:l,layoutState:3},u=!1,p={};c.width!==this._layoutInfo.width&&(p.width=!0,u=!0),c.editorHeight!==this._layoutInfo.editorHeight&&(p.editorHeight=!0,u=!0),c.editorMargin!==this._layoutInfo.editorMargin&&(p.editorMargin=!0,u=!0),c.cellStatusHeight!==this._layoutInfo.cellStatusHeight&&(p.cellStatusHeight=!0,u=!0),c.bodyMargin!==this._layoutInfo.bodyMargin&&(p.bodyMargin=!0,u=!0),c.totalHeight!==this._layoutInfo.totalHeight&&(p.totalHeight=!0,u=!0),u&&(this._layoutInfo=c,this._fireLayoutChangeEvent(p))}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.cellFoldingState===1?0:this.computeInputEditorHeight(e);return this._computeTotalHeight(t)}else return this._layoutInfo.totalHeight}_computeTotalHeight(e){return e+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputTotalHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.outputMetadataHeight+this._layoutInfo.bodyMargin}computeInputEditorHeight(e){return this.editorHeightCalculator.computeHeightFromLines(Math.max(this.originalMetadata.textBuffer.getLineCount(),this.modifiedMetadata.textBuffer.getLineCount()))}_fireLayoutChangeEvent(e){this._layoutInfoEmitter.fire(e),this.editorEventDispatcher.emit([{type:2,source:this._layoutInfo}])}getComputedCellContainerWidth(e,t,o){return o?e.width-2*zR+(t?_p.ENTIRE_DIFF_OVERVIEW_WIDTH:0)-2:(e.width-2*zR+(t?_p.ENTIRE_DIFF_OVERVIEW_WIDTH:0))/2-18-2}getSourceEditorViewState(){return this._sourceEditorViewState}saveSpirceEditorViewState(e){this._sourceEditorViewState=e}},P2t=class extends prt{constructor(e,t,o,n,r,s,l,c,u,p){super(e,r,s);this.type=n;this.index=c;this.configurationService=u;this.diffEditorHeightCalculator=p;this._stateChangeEmitter=this._register(new T);this.onDidStateChange=this._stateChangeEmitter.event;this._hideUnchangedCells=this._register(new T);this.onHideUnchangedCells=this._hideUnchangedCells.event;this._renderOutput=!0;this._sourceEditorViewState=null;this._outputEditorViewState=null;this._metadataEditorViewState=null;this.original=t?this._register(new hfe(t,l)):void 0,this.modified=o?this._register(new hfe(o,l)):void 0;let h=this._estimateEditorHeight(s.fontInfo),g=L2t;this._layoutInfo={width:0,editorHeight:h,editorMargin:0,metadataHeight:0,cellStatusHeight:g,metadataStatusHeight:this.ignoreMetadata?0:L2t,rawOutputHeight:0,outputTotalHeight:0,outputStatusHeight:this.ignoreOutputs?0:L2t,outputMetadataHeight:0,bodyMargin:32,totalHeight:82+g+h,layoutState:0},this.cellFoldingState=o?.getTextBufferHash()!==t?.getTextBufferHash()?0:1,this.metadataFoldingState=1,this.outputFoldingState=1}hideUnchangedCells(){this._hideUnchangedCells.fire()}set rawOutputHeight(e){this._layout({rawOutputHeight:Math.min(hrt,e)})}get rawOutputHeight(){throw new Error("Use Cell.layoutInfo.rawOutputHeight")}set outputStatusHeight(e){this._layout({outputStatusHeight:e})}get outputStatusHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set outputMetadataHeight(e){this._layout({outputMetadataHeight:e})}get outputMetadataHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set editorHeight(e){this._layout({editorHeight:e})}get editorHeight(){throw new Error("Use Cell.layoutInfo.editorHeight")}set editorMargin(e){this._layout({editorMargin:e})}get editorMargin(){throw new Error("Use Cell.layoutInfo.editorMargin")}set metadataStatusHeight(e){this._layout({metadataStatusHeight:e})}get metadataStatusHeight(){throw new Error("Use Cell.layoutInfo.outputStatusHeight")}set metadataHeight(e){this._layout({metadataHeight:e})}get metadataHeight(){throw new Error("Use Cell.layoutInfo.metadataHeight")}set renderOutput(e){this._renderOutput=e,this._layout({recomputeOutput:!0}),this._stateChangeEmitter.fire({renderOutput:this._renderOutput})}get renderOutput(){return this._renderOutput}get layoutInfo(){return this._layoutInfo}get totalHeight(){return this.layoutInfo.totalHeight}get ignoreOutputs(){return this.configurationService.getValue("notebook.diff.ignoreOutputs")||!!this.mainDocumentTextModel?.transientOptions.transientOutputs}get ignoreMetadata(){return this.configurationService.getValue("notebook.diff.ignoreMetadata")}layoutChange(){this._layout({recomputeOutput:!0})}_estimateEditorHeight(e){let t=e?.lineHeight??17;switch(this.type){case"unchanged":case"insert":{let o=this.modified.textModel.textBuffer.getLineCount();return o*t+aO(o).top+aO(o).bottom}case"delete":case"modified":{let o=this.original.textModel.textBuffer.getLineCount();return o*t+aO(o).top+aO(o).bottom}}}_layout(e){let t=e.width!==void 0?e.width:this._layoutInfo.width,o=e.editorHeight!==void 0?e.editorHeight:this._layoutInfo.editorHeight,n=e.editorMargin!==void 0?e.editorMargin:this._layoutInfo.editorMargin,r=e.metadataHeight!==void 0?e.metadataHeight:this._layoutInfo.metadataHeight,s=e.cellStatusHeight!==void 0?e.cellStatusHeight:this._layoutInfo.cellStatusHeight,l=e.metadataStatusHeight!==void 0?e.metadataStatusHeight:this._layoutInfo.metadataStatusHeight,c=e.rawOutputHeight!==void 0?e.rawOutputHeight:this._layoutInfo.rawOutputHeight,u=e.outputStatusHeight!==void 0?e.outputStatusHeight:this._layoutInfo.outputStatusHeight,p=e.bodyMargin!==void 0?e.bodyMargin:this._layoutInfo.bodyMargin,h=e.outputMetadataHeight!==void 0?e.outputMetadataHeight:this._layoutInfo.outputMetadataHeight,g=this.ignoreOutputs?0:e.recomputeOutput||e.rawOutputHeight!==void 0||e.outputMetadataHeight!==void 0?this._getOutputTotalHeight(c,h):this._layoutInfo.outputTotalHeight,f=o+n+s+r+l+g+u+p,v={width:t,editorHeight:o,editorMargin:n,metadataHeight:r,cellStatusHeight:s,metadataStatusHeight:l,outputTotalHeight:g,outputStatusHeight:u,bodyMargin:p,rawOutputHeight:c,outputMetadataHeight:h,totalHeight:f,layoutState:3},b=!1,S={};v.width!==this._layoutInfo.width&&(S.width=!0,b=!0),v.editorHeight!==this._layoutInfo.editorHeight&&(S.editorHeight=!0,b=!0),v.editorMargin!==this._layoutInfo.editorMargin&&(S.editorMargin=!0,b=!0),v.metadataHeight!==this._layoutInfo.metadataHeight&&(S.metadataHeight=!0,b=!0),v.cellStatusHeight!==this._layoutInfo.cellStatusHeight&&(S.cellStatusHeight=!0,b=!0),v.metadataStatusHeight!==this._layoutInfo.metadataStatusHeight&&(S.metadataStatusHeight=!0,b=!0),v.outputTotalHeight!==this._layoutInfo.outputTotalHeight&&(S.outputTotalHeight=!0,b=!0),v.outputStatusHeight!==this._layoutInfo.outputStatusHeight&&(S.outputStatusHeight=!0,b=!0),v.bodyMargin!==this._layoutInfo.bodyMargin&&(S.bodyMargin=!0,b=!0),v.outputMetadataHeight!==this._layoutInfo.outputMetadataHeight&&(S.outputMetadataHeight=!0,b=!0),v.totalHeight!==this._layoutInfo.totalHeight&&(S.totalHeight=!0,b=!0),b&&(this._layoutInfo=v,this._fireLayoutChangeEvent(S))}getHeight(e){if(this._layoutInfo.layoutState===0){let t=this.cellFoldingState===1?0:this.computeInputEditorHeight(e);return this._computeTotalHeight(t)}else return this._layoutInfo.totalHeight}_computeTotalHeight(e){return e+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputTotalHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.outputMetadataHeight+this._layoutInfo.bodyMargin}computeInputEditorHeight(e){let t=Math.max(this.original?.textModel.textBuffer.getLineCount()??1,this.modified?.textModel.textBuffer.getLineCount()??1);return this.diffEditorHeightCalculator.computeHeightFromLines(t)}_getOutputTotalHeight(e,t){return this.outputFoldingState===1?0:this.renderOutput?this.isOutputEmpty()?24:this.getRichOutputTotalHeight()+t:e}_fireLayoutChangeEvent(e){this._layoutInfoEmitter.fire(e),this.editorEventDispatcher.emit([{type:2,source:this._layoutInfo}])}getComputedCellContainerWidth(e,t,o){return o?e.width-2*zR+(t?_p.ENTIRE_DIFF_OVERVIEW_WIDTH:0)-2:(e.width-2*zR+(t?_p.ENTIRE_DIFF_OVERVIEW_WIDTH:0))/2-18-2}getOutputEditorViewState(){return this._outputEditorViewState}saveOutputEditorViewState(e){this._outputEditorViewState=e}getMetadataEditorViewState(){return this._metadataEditorViewState}saveMetadataEditorViewState(e){this._metadataEditorViewState=e}getSourceEditorViewState(){return this._sourceEditorViewState}saveSpirceEditorViewState(e){this._sourceEditorViewState=e}},uk=class extends P2t{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,o,n,r,s,l,c,p,u,h);this.otherDocumentTextModel=t;this.type=r,this.cellFoldingState=this.modified.textModel.getValue()!==this.original.textModel.getValue()?0:1,this.metadataFoldingState=1,this.outputFoldingState=1,this.checkMetadataIfModified()&&(this.metadataFoldingState=0),this.checkIfOutputsModified()&&(this.outputFoldingState=0),this._register(this.original.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})})),this._register(this.modified.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})})),this._register(this.modified.textModel.onDidChangeContent(()=>{if(e.transientOptions.cellContentMetadata){let g=[...Object.keys(e.transientOptions.cellContentMetadata)],f=Object.assign({},this.modified.metadata),v=this.original.metadata;for(let b of g)Object.hasOwn(v,b)&&(f[b]=v[b]);this.modified.textModel.metadata=f}}))}get originalDocument(){return this.otherDocumentTextModel}get modifiedDocument(){return this.mainDocumentTextModel}checkIfInputModified(){return this.original.textModel.getTextBufferHash()===this.modified.textModel.getTextBufferHash()?!1:{reason:"Cell content has changed"}}checkIfOutputsModified(){if(this.mainDocumentTextModel.transientOptions.transientOutputs||this.ignoreOutputs)return!1;let e=Qan(this.original?.outputs??[],this.modified?.outputs??[]);return e===0?!1:{reason:e===1?"Output metadata has changed":void 0,kind:e}}checkMetadataIfModified(){return this.ignoreMetadata?!1:Lr(Dq(this.mainDocumentTextModel.transientOptions.transientCellMetadata,this.original?.metadata||{},this.original?.language))!==Lr(Dq(this.mainDocumentTextModel.transientOptions.transientCellMetadata,this.modified?.metadata??{},this.modified?.language))?{reason:void 0}:!1}updateOutputHeight(e,t,o){e===0?this.original.updateOutputHeight(t,o):this.modified.updateOutputHeight(t,o)}getOutputOffsetInContainer(e,t){return e===0?this.original.getOutputOffset(t):this.modified.getOutputOffset(t)}getOutputOffsetInCell(e,t){let o=this.getOutputOffsetInContainer(e,t);return this._layoutInfo.editorHeight+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.bodyMargin/2+o}isOutputEmpty(){return this.mainDocumentTextModel.transientOptions.transientOutputs?!0:this.checkIfOutputsModified()?!1:(this.original?.outputs||[]).length===0}getRichOutputTotalHeight(){return Math.max(this.original.getOutputTotalHeight(),this.modified.getOutputTotalHeight())}getNestedCellViewModel(e){return e===0?this.original:this.modified}getCellByUri(e){return e.toString()===this.original.uri.toString()?this.original:this.modified}computeInputEditorHeight(e){return this.type==="modified"&&typeof this.editorHeightWithUnchangedLinesCollapsed=="number"&&this.checkIfInputModified()?this.editorHeightWithUnchangedLinesCollapsed:super.computeInputEditorHeight(e)}async computeModifiedInputEditorHeight(){this.checkIfInputModified()&&(this.editorHeightWithUnchangedLinesCollapsed=this._layoutInfo.editorHeight=await this.diffEditorHeightCalculator.diffAndComputeHeight(this.original.uri,this.modified.uri))}async computeModifiedMetadataEditorHeight(){if(this.checkMetadataIfModified()){let e=sn.generateCellPropertyUri(this.originalDocument.uri,this.original.handle,Q.vscodeNotebookCellMetadata),t=sn.generateCellPropertyUri(this.modifiedDocument.uri,this.modified.handle,Q.vscodeNotebookCellMetadata);this._layoutInfo.metadataHeight=await this.diffEditorHeightCalculator.diffAndComputeHeight(e,t)}}async computeEditorHeights(){this.type!=="unchanged"&&await Promise.all([this.computeModifiedInputEditorHeight(),this.computeModifiedMetadataEditorHeight()])}},mrt=class extends P2t{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,o,n,r,s,l,c,h,u,p);this.otherDocumentTextModel=t;this.type=r,this._register(this.cellViewModel.onDidChangeOutputLayout(()=>{this._layout({recomputeOutput:!0})}))}get cellViewModel(){return this.type==="insert"?this.modified:this.original}get originalDocument(){return this.type==="insert"?this.otherDocumentTextModel:this.mainDocumentTextModel}get modifiedDocument(){return this.type==="insert"?this.mainDocumentTextModel:this.otherDocumentTextModel}checkIfInputModified(){return{reason:"Cell content has changed"}}getNestedCellViewModel(e){return this.type==="insert"?this.modified:this.original}checkIfOutputsModified(){return!1}checkMetadataIfModified(){return!1}updateOutputHeight(e,t,o){this.cellViewModel?.updateOutputHeight(t,o)}getOutputOffsetInContainer(e,t){return this.cellViewModel.getOutputOffset(t)}getOutputOffsetInCell(e,t){let o=this.cellViewModel.getOutputOffset(t);return this._layoutInfo.editorHeight+this._layoutInfo.editorMargin+this._layoutInfo.metadataHeight+this._layoutInfo.cellStatusHeight+this._layoutInfo.metadataStatusHeight+this._layoutInfo.outputStatusHeight+this._layoutInfo.bodyMargin/2+o}isOutputEmpty(){return this.mainDocumentTextModel.transientOptions.transientOutputs?!0:(this.original?.outputs||this.modified?.outputs||[]).length===0}getRichOutputTotalHeight(){return this.cellViewModel?.getOutputTotalHeight()??0}getCellByUri(e){return this.cellViewModel}};function Jyo(a,i){if(Lr(a.metadata)===Lr(i.metadata))return 2;for(let e=0;e<a.outputs.length;e++){let t=a.outputs[e],o=i.outputs[e];if(t.mime!==o.mime||t.data.buffer.length!==o.data.buffer.length)return 2;for(let n=0;n<t.data.buffer.length;n++)if(t.data.buffer[n]!==o.data.buffer[n])return 2}return 1}function Qan(a,i){if(a.length!==i.length)return 2;let e=a.length;for(let t=0;t<e;t++){let o=a[t],n=i[t];if(Lr(o.metadata)!==Lr(n.metadata))return 1;if(o.outputs.length!==n.outputs.length)return 2;for(let r=0;r<o.outputs.length;r++){let s=o.outputs[r],l=n.outputs[r];if(s.mime!==l.mime||s.data.buffer.length!==l.data.buffer.length)return 2;for(let c=0;c<s.data.buffer.length;c++)if(s.data.buffer[c]!==l.data.buffer[c])return 2}}return 0}function sMi(a){if(!a.length)return null;let e=a[0].mime;return a.find(o=>o.mime!==e)?null:a.map(o=>o.data.toString()).join("")}function soe(a){if(a.length===1){let i=sMi(a[0].outputs);if(i)return i}return JSON.stringify(a.map(i=>({metadata:i.metadata,outputItems:i.outputs.map(e=>({mimeType:e.mime,data:e.data.toString()}))})),void 0,"	")}var aMi=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._notebookEditor=e;this._notebookTextModel=t;this._notebookService=o;this._quickInputService=n;this._diffElementViewModel=r;this._diffSide=s;this._nestedCell=l;this._outputContainer=c;this.output=u;this.resizeListener=this._register(new O)}render(e,t){let o=document.createElement("div"),n,[r,s]=this.output.resolveMimeTypes(this._notebookTextModel,void 0),l=this.output.pickedMimeType||r[s];if(r.length>1){o.style.position="relative";let u=_(".multi-mimetype-output");u.classList.add(...q.asClassNameArray(NKt)),u.tabIndex=0,u.title=d(13711,null,r.map(p=>p.mimeType).join(", ")),o.appendChild(u),this.resizeListener.add(Yo(u,"mousedown",async p=>{p.leftButton&&(p.preventDefault(),p.stopPropagation(),await this.pickActiveMimeTypeRenderer(this._notebookTextModel,this.output))})),this.resizeListener.add($(u,ne.KEY_DOWN,async p=>{let h=new mi(p);(h.equals(3)||h.equals(10))&&(p.preventDefault(),p.stopPropagation(),await this.pickActiveMimeTypeRenderer(this._notebookTextModel,this.output))}))}let c=_(".output-inner-container");if(D(o,c),r.length!==0){let u=this._notebookService.getRendererInfo(l.rendererId);n=u?{type:1,renderer:u,source:this.output,mimeType:l.mimeType}:this._renderMissingRenderer(this.output,l.mimeType),this.output.pickedMimeType=l}this.domNode=o,this.renderResult=n,n&&(t?this._outputContainer.insertBefore(o,t):this._outputContainer.appendChild(o),this._notebookEditor.createOutput(this._diffElementViewModel,this._nestedCell,n,()=>this.getOutputOffsetInCell(e),this._diffElementViewModel instanceof uk?this._diffSide:this._diffElementViewModel.type==="insert"?1:0))}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(13710,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(13712,null,n))}return this._renderSearchForMimetype(e,t)}_renderSearchForMimetype(e,t){let o=`@tag:notebookRenderer ${t}`,n=_("p",void 0,`No renderer could be found for mimetype "${t}", but one might be available on the Marketplace.`),r=_("a",{href:`command:workbench.extensions.search?%22${o}%22`,class:"monaco-button monaco-text-button",tabindex:0,role:"button",style:"padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"},"Search Marketplace");return{type:0,source:e,htmlContent:n.outerHTML+r.outerHTML}}_renderMessage(e,t){let o=_("p",void 0,t);return{type:0,source:e,htmlContent:o.outerHTML}}async pickActiveMimeTypeRenderer(e,t){let[o,n]=t.resolveMimeTypes(e,void 0),r=o.filter(u=>u.isTrusted).map((u,p)=>({label:u.mimeType,id:u.mimeType,index:p,picked:p===n,detail:this.generateRendererInfo(u.rendererId),description:p===n?d(13709,null):void 0})),s=new O,l=s.add(this._quickInputService.createQuickPick());l.items=r,l.activeItems=r.filter(u=>!!u.picked),l.placeholder=r.length!==o.length?d(13714,null):d(13713,null);let c=await new Promise(u=>{s.add(l.onDidAccept(()=>{u(l.selectedItems.length===1?l.selectedItems[0].index:void 0),s.dispose()})),l.show()});if(c!==void 0&&c!==n){let u=this._nestedCell.outputsViewModels.indexOf(t),p=this.domNode.nextElementSibling;this.resizeListener.clear();let h=this.domNode;h&&(h.remove(),this._notebookEditor.removeInset(this._diffElementViewModel,this._nestedCell,t,this._diffSide)),t.pickedMimeType=o[c],this.render(u,p)}}generateRendererInfo(e){let t=this._notebookService.getRendererInfo(e);return t?`${t.displayName!==""?t.displayName:t.id} (${t.extensionId.value})`:d(13708,null)}getCellOutputCurrentIndex(){return this._diffElementViewModel.getNestedCellViewModel(this._diffSide).outputs.indexOf(this.output.model)}updateHeight(e,t){this._diffElementViewModel.updateOutputHeight(this._diffSide,e,t)}getOutputOffsetInContainer(e){return this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide,e)}getOutputOffsetInCell(e){return this._diffElementViewModel.getOutputOffsetInCell(this._diffSide,e)}},GQ=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._editor=e;this._notebookTextModel=t;this._diffElementViewModel=o;this._nestedCellViewModel=n;this._diffSide=r;this._outputContainer=s;this._notebookService=l;this._quickInputService=c;this._outputEntries=new Map;this._register(this._diffElementViewModel.onDidLayoutChange(()=>{this._outputEntries.forEach((u,p)=>{let h=n.outputs.indexOf(p.model);if(h>=0){let g=this._diffElementViewModel.getOutputOffsetInContainer(this._diffSide,h);u.domNode.style.top=`${g}px`}})})),this._register(this._nestedCellViewModel.textModel.onDidChangeOutputs(u=>{this._updateOutputs(u)}))}_updateOutputs(e){let t=[];this._outputEntries.forEach((r,s)=>{this._nestedCellViewModel.outputsViewModels.indexOf(s)<0&&(t.push(s),r.domNode.remove(),this._editor.removeInset(this._diffElementViewModel,this._nestedCellViewModel,s,this._diffSide))}),t.forEach(r=>{this._outputEntries.get(r)?.dispose(),this._outputEntries.delete(r)});let o;this._nestedCellViewModel.outputsViewModels.reverse().forEach(r=>{if(this._outputEntries.has(r)){o=this._outputEntries.get(r).domNode;return}let s=this._nestedCellViewModel.outputsViewModels.indexOf(r);this._renderOutput(r,s,o),o=this._outputEntries.get(r)?.domNode})}render(){for(let e=0;e<this._nestedCellViewModel.outputsViewModels.length;e++){let t=this._nestedCellViewModel.outputsViewModels[e];this._renderOutput(t,e,void 0)}}showOutputs(){for(let e=0;e<this._nestedCellViewModel.outputsViewModels.length;e++){let t=this._nestedCellViewModel.outputsViewModels[e];this._editor.showInset(this._diffElementViewModel,t.cellViewModel,t,this._diffSide)}}hideOutputs(){this._outputEntries.forEach((e,t)=>{this._editor.hideInset(this._diffElementViewModel,this._nestedCellViewModel,t)})}_renderOutput(e,t,o){this._outputEntries.has(e)||this._outputEntries.set(e,new aMi(this._editor,this._notebookTextModel,this._notebookService,this._quickInputService,this._diffElementViewModel,this._diffSide,this._nestedCellViewModel,this._outputContainer,e)),this._outputEntries.get(e).render(t,o)}};GQ=I([m(6,kn),m(7,$e)],GQ);function A2t(a){return Yan(a)}function Yan(a){let i=new O,e=i.add(new T),t={options:{enabled:a.getValue("diffEditor.hideUnchangedRegions.enabled"),minimumLineCount:a.getValue("diffEditor.hideUnchangedRegions.minimumLineCount"),contextLineCount:a.getValue("diffEditor.hideUnchangedRegions.contextLineCount"),revealLineCount:a.getValue("diffEditor.hideUnchangedRegions.revealLineCount")},onDidChangeEnablement:e.event.bind(e),dispose:()=>i.dispose()};return i.add(a.onDidChangeConfiguration(o=>{o.affectsConfiguration("diffEditor.hideUnchangedRegions.minimumLineCount")&&(t.options.minimumLineCount=a.getValue("diffEditor.hideUnchangedRegions.minimumLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.contextLineCount")&&(t.options.contextLineCount=a.getValue("diffEditor.hideUnchangedRegions.contextLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.revealLineCount")&&(t.options.revealLineCount=a.getValue("diffEditor.hideUnchangedRegions.revealLineCount")),o.affectsConfiguration("diffEditor.hideUnchangedRegions.enabled")&&(t.options.enabled=a.getValue("diffEditor.hideUnchangedRegions.enabled"),e.fire(t.options.enabled))})),t}function qQ(){return{isSimpleWidget:!1,contributions:ml.getSomeEditorContributions([dw.ID,mw,Vg.ID,Sc.ID,ss.ID,pw.ID])}}var N2t=class extends k{constructor(i,e){super(),e.body.classList.remove("left","right","full");let t=i.hiddenCells.length===1?d(13704,null,i.hiddenCells.length):d(13705,null,i.hiddenCells.length);e.placeholder.innerText=t,this._register($(e.placeholder,"dblclick",o=>{o.button===0&&(o.preventDefault(),i.showHiddenCells())})),this._register(e.marginOverlay.onAction(()=>i.showHiddenCells())),e.marginOverlay.show()}},jU=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.cell=e;this.propertyHeaderContainer=t;this.notebookEditor=o;this.accessor=n;this.contextMenuService=r;this.keybindingService=s;this.commandService=l;this.notificationService=c;this.menuService=u;this.contextKeyService=p;this.themeService=h;this.telemetryService=g;this.accessibilityService=f}buildHeader(){this._foldingIndicator=D(this.propertyHeaderContainer,_(".property-folding-indicator")),this._foldingIndicator.classList.add(this.accessor.prefix);let e=D(this.propertyHeaderContainer,_("div.property-status"));this._statusSpan=D(e,_("span")),this._description=D(e,_("span.property-description"));let t=D(this.propertyHeaderContainer,_("div.property-toolbar"));this._toolbar=this._register(new dl(t,{actionViewItemProvider:(n,r)=>{if(n instanceof Do)return new CP(n,{hoverDelegate:r.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)}},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService)),this._toolbar.context=this.cell;let o=this.contextKeyService.createScoped(t);this._register(o),this._propertyChanged=ffe.bindTo(o),this._propertyExpanded=D2t.bindTo(o),this._menu=this._register(this.menuService.createMenu(this.accessor.menuId,o)),this._register(this._menu.onDidChange(()=>this.updateMenu())),this._register(this.notebookEditor.onMouseUp(n=>{if(!n.event.target||n.target!==this.cell)return;let r=n.event.target;if(r===this.propertyHeaderContainer||r===this._foldingIndicator||this._foldingIndicator.contains(r)||r===e||e.contains(r)){let s=this.accessor.getFoldingState();this.accessor.updateFoldingState(s===0?1:0),this._updateFoldingIcon(),this.accessor.updateInfoRendering(this.cell.renderOutput)}})),this.refresh(),this.accessor.updateInfoRendering(this.cell.renderOutput)}refresh(){this.updateMenu(),this._updateFoldingIcon();let e=this.accessor.checkIfModified();this._propertyChanged&&this._propertyChanged.set(!!e),e?(this._statusSpan.textContent=this.accessor.changedLabel,this._statusSpan.style.fontWeight="bold",e.reason&&(this._description.textContent=e.reason),this.propertyHeaderContainer.classList.add("modified")):(this._statusSpan.textContent=this.accessor.unChangedLabel,this._statusSpan.style.fontWeight="normal",this._description.textContent="",this.propertyHeaderContainer.classList.remove("modified"))}updateMenu(){if(this.accessor.checkIfModified()){let t=Ng(this._menu.getActions({shouldForwardArgs:!0}));this._toolbar.setActions(t)}else this._toolbar.setActions([])}_updateFoldingIcon(){this.accessor.getFoldingState()===1?(Ii(this._foldingIndicator,un(PKt)),this._propertyExpanded?.set(!1)):(Ii(this._foldingIndicator,un(AKt)),this._propertyExpanded?.set(!0))}};jU=I([m(4,Xe),m(5,Le),m(6,fe),m(7,Ne),m(8,Yt),m(9,X),m(10,Pe),m(11,_e),m(12,Ai)],jU);var NOe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.notebookEditor=e;this.viewModel=t;this.templateData=o;this.instantiationService=n;this.textModelService=r;this.menuService=s;this.contextKeyService=l;this.textConfigurationService=c;this.configurationService=u;this._editor=o.sourceEditor,this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._editorContainer=this.templateData.editorContainer,this._diffEditorContainer=this.templateData.diffEditorContainer,this._editorViewStateChanged=!1,this._register(t.onDidLayoutChange(p=>{this.layout(p),this.updateBorders()})),this.buildBody(),this.updateBorders()}buildBody(){let e=this.templateData.body;e.classList.remove("full"),e.classList.add("full"),this.updateSourceEditor(),this.viewModel instanceof AOe&&this._register(this.viewModel.modifiedMetadata.onDidChange(t=>{this._cellHeader.refresh()}))}layoutNotebookCell(){this.notebookEditor.layoutNotebookCell(this.viewModel,this.viewModel.layoutInfo.totalHeight)}updateBorders(){this.templateData.leftBorder.style.height=`${this.viewModel.layoutInfo.totalHeight-32}px`,this.templateData.rightBorder.style.height=`${this.viewModel.layoutInfo.totalHeight-32}px`,this.templateData.bottomBorder.style.top=`${this.viewModel.layoutInfo.totalHeight-32}px`}updateSourceEditor(){this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="",this._editorContainer.classList.add("diff");let e=()=>{if(this.viewModel.cellFoldingState===1){this._editorContainer.style.display="none",this.viewModel.editorHeight=0;return}let s=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,l=this.viewModel.layoutInfo.editorHeight!==0?this.viewModel.layoutInfo.editorHeight:this.viewModel.computeInputEditorHeight(s);this._editorContainer.style.height=`${l}px`,this._editorContainer.style.display="block";let c=this._editor.getContentHeight();return c>=0&&(this.viewModel.editorHeight=c),l},t=()=>{let s=e();if(!s)return;let l=this.viewModel.modifiedMetadata.textBuffer.getLineCount(),c={padding:aO(l)},u=this._register(A2t(this.configurationService));u.options.enabled&&(c.hideUnchangedRegions=u.options),this._editor.updateOptions(c),this._register(u.onDidChangeEnablement(()=>{c.hideUnchangedRegions=u.options,this._editor.updateOptions(c)})),this._editor.layout({width:this.notebookEditor.getLayoutInfo().width-2*zR,height:s}),this._register(this._editor.onDidContentSizeChange(p=>{this.viewModel.cellFoldingState===0&&p.contentHeightChanged&&this.viewModel.layoutInfo.editorHeight!==p.contentHeight&&(this.viewModel.editorHeight=p.contentHeight)})),this._initializeSourceDiffEditor()};this._cellHeader=this._register(this.instantiationService.createInstance(jU,this.viewModel,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>t(),checkIfModified:()=>this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash()?{reason:void 0}:!1,getFoldingState:()=>this.viewModel.cellFoldingState,updateFoldingState:s=>this.viewModel.cellFoldingState=s,unChangedLabel:"Notebook Metadata",changedLabel:"Notebook Metadata changed",prefix:"metadata",menuId:R.NotebookDiffDocumentMetadata})),this._cellHeader.buildHeader(),t();let o=this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);this._register(o);let n=crt.bindTo(o);n.set(this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash()),this._toolbar=this.templateData.toolbar,this._toolbar.context=this.viewModel;let r=()=>{let s=this.viewModel.originalMetadata.getHash()!==this.viewModel.modifiedMetadata.getHash();if(n.set(s),s){let l=this.menuService.getMenuActions(R.NotebookDiffDocumentMetadata,o,{shouldForwardArgs:!0}),c=Ng(l);this._toolbar.setActions(c)}else this._toolbar.setActions([])};this._register(this.viewModel.modifiedMetadata.onDidChange(()=>{r()})),r()}async _initializeSourceDiffEditor(){let[e,t]=await Promise.all([this.textModelService.createModelReference(this.viewModel.originalMetadata.uri),this.textModelService.createModelReference(this.viewModel.modifiedMetadata.uri)]);if(this._store.isDisposed){e.dispose(),t.dispose();return}this._register(e),this._register(t);let o=this._register(this._editor.createViewModel({original:e.object.textEditorModel,modified:t.object.textEditorModel}));await o.waitForDiff(),this._editor.setModel(o);let n=()=>{this._editorViewStateChanged=!0},r=c=>{(c.scrollTopChanged||c.scrollLeftChanged)&&(this._editorViewStateChanged=!0)};this.updateEditorOptionsForWhitespace(),this._register(this._editor.getOriginalEditor().onDidChangeCursorSelection(n)),this._register(this._editor.getOriginalEditor().onDidScrollChange(r)),this._register(this._editor.getModifiedEditor().onDidChangeCursorSelection(n)),this._register(this._editor.getModifiedEditor().onDidScrollChange(r));let s=this.viewModel.getSourceEditorViewState();s&&this._editor.restoreViewState(s);let l=this._editor.getContentHeight();this.viewModel.editorHeight=l}updateEditorOptionsForWhitespace(){let e=this._editor,t=e.getModel()?.modified.uri||e.getModel()?.original.uri;if(!t)return;let o=this.textConfigurationService.getValue(t,"diffEditor.ignoreTrimWhitespace");e.updateOptions({ignoreTrimWhitespace:o}),this._register(this.textConfigurationService.onDidChangeConfiguration(n=>{if(n.affectsConfiguration(t,"diffEditor")&&n.affectedKeys.has("diffEditor.ignoreTrimWhitespace")){let r=this.textConfigurationService.getValue(t,"diffEditor.ignoreTrimWhitespace");e.updateOptions({ignoreTrimWhitespace:r})}}))}layout(e){kr(Me(this._diffEditorContainer),()=>{e.editorHeight&&(this._editorContainer.style.height=`${this.viewModel.layoutInfo.editorHeight}px`,this._editor.layout({width:this._editor.getViewWidth(),height:this.viewModel.layoutInfo.editorHeight})),e.outerWidth&&(this._editorContainer.style.height=`${this.viewModel.layoutInfo.editorHeight}px`,this._editor.layout()),this.layoutNotebookCell()})}dispose(){this._editor.setModel(null),this._editorViewStateChanged&&this.viewModel.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};NOe=I([m(3,F),m(4,Bt),m(5,Yt),m(6,X),m(7,Gn),m(8,B)],NOe);var O2t=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.notebookEditor=e;this.cell=t;this.templateData=o;this.style=n;this.instantiationService=r;this.languageService=s;this.modelService=l;this.textModelService=c;this.contextMenuService=u;this.keybindingService=p;this.notificationService=h;this.menuService=g;this.contextKeyService=f;this.configurationService=v;this.textConfigurationService=b;this._metadataLocalDisposable=this._register(new O);this._outputLocalDisposable=this._register(new O);this._ignoreMetadata=!1;this._ignoreOutputs=!1;this._isDisposed=!1,this._metadataEditorDisposeStore=this._register(new O),this._outputEditorDisposeStore=this._register(new O),this._register(t.onDidLayoutChange(S=>{this.layout(S)})),this._register(t.onDidLayoutChange(S=>this.updateBorders())),this.init(),this.buildBody(),this._register(t.onDidStateChange(()=>{this.updateOutputRendering(this.cell.renderOutput)}))}buildBody(){let e=this.templateData.body;switch(this._diffEditorContainer=this.templateData.diffEditorContainer,e.classList.remove("left","right","full"),this.style){case"left":e.classList.add("left");break;case"right":e.classList.add("right");break;default:e.classList.add("full");break}this.styleContainer(this._diffEditorContainer),this.updateSourceEditor(),this.cell.modified&&this._register(this.cell.modified.textModel.onDidChangeContent(()=>this._cellHeader.refresh())),this._ignoreMetadata=this.configurationService.getValue("notebook.diff.ignoreMetadata"),this._ignoreMetadata?this._disposeMetadata():this._buildMetadata(),this._ignoreOutputs=this.configurationService.getValue("notebook.diff.ignoreOutputs")||!!this.notebookEditor.textModel?.transientOptions.transientOutputs,this._ignoreOutputs?this._disposeOutput():this._buildOutput(),this._register(this.configurationService.onDidChangeConfiguration(t=>{let o=!1,n=!1;if(t.affectsConfiguration("notebook.diff.ignoreMetadata")){let r=this.configurationService.getValue("notebook.diff.ignoreMetadata");r!==void 0&&this._ignoreMetadata!==r&&(this._ignoreMetadata=r,this._metadataLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():(this.cell.metadataStatusHeight=25,this._buildMetadata(),this.updateMetadataRendering(),o=!0))}if(t.affectsConfiguration("notebook.diff.ignoreOutputs")){let r=this.configurationService.getValue("notebook.diff.ignoreOutputs");r!==void 0&&this._ignoreOutputs!==(r||this.notebookEditor.textModel?.transientOptions.transientOutputs)&&(this._ignoreOutputs=r||!!this.notebookEditor.textModel?.transientOptions.transientOutputs,this._outputLocalDisposable.clear(),this._ignoreOutputs?(this._disposeOutput(),this.cell.layoutChange()):(this.cell.outputStatusHeight=25,this._buildOutput(),n=!0))}(o||n)&&this.layout({metadataHeight:o,outputTotalHeight:n})}))}updateMetadataRendering(){this.cell.metadataFoldingState===0?(this._metadataInfoContainer.style.display="block",!this._metadataEditorContainer||!this._metadataEditor?(this._metadataEditorContainer=D(this._metadataInfoContainer,_(".metadata-editor-container")),this._buildMetadataEditor()):this.cell.metadataHeight=this._metadataEditor.getContentHeight()):(this._metadataInfoContainer.style.display="none",this.cell.metadataHeight=0)}updateOutputRendering(e){this.cell.outputFoldingState===0?(this._outputInfoContainer.style.display="block",e?(this._hideOutputsRaw(),this._buildOutputRendererContainer(),this._showOutputsRenderer(),this._showOutputsEmptyView()):(this._hideOutputsRenderer(),this._buildOutputRawContainer(),this._showOutputsRaw())):(this._outputInfoContainer.style.display="none",this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView())}_buildOutputRawContainer(){this._outputEditorContainer||(this._outputEditorContainer=D(this._outputInfoContainer,_(".output-editor-container")),this._buildOutputEditor())}_showOutputsRaw(){this._outputEditorContainer&&(this._outputEditorContainer.style.display="block",this.cell.rawOutputHeight=this._outputEditor.getContentHeight())}_showOutputsEmptyView(){this.cell.layoutChange()}_hideOutputsRaw(){this._outputEditorContainer&&(this._outputEditorContainer.style.display="none",this.cell.rawOutputHeight=0)}_hideOutputsEmptyView(){this.cell.layoutChange()}_applySanitizedMetadataChanges(e,t){let o={};try{let n=JSON.parse(t),r=new Set([...Object.keys(n)]);for(let l of r)switch(l){case"inputCollapsed":case"outputCollapsed":typeof n[l]=="boolean"?o[l]=n[l]:o[l]=e[l];break;default:o[l]=n[l];break}let s=this.notebookEditor.textModel.cells.indexOf(this.cell.modified.textModel);if(s<0)return;this.notebookEditor.textModel.applyEdits([{editType:3,index:s,metadata:o}],!0,void 0,()=>{},void 0,!0)}catch{}}async _buildMetadataEditor(){if(this._metadataEditorDisposeStore.clear(),this.cell instanceof uk){this._metadataEditor=this.instantiationService.createInstance(_p,this._metadataEditorContainer,{...MOe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!1,originalEditable:!1,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:this.cell.layoutInfo.metadataHeight,width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!0,!0)}},{originalEditor:qQ(),modifiedEditor:qQ()});let e=this._register(A2t(this.configurationService));e.options.enabled&&this._metadataEditor.updateOptions({hideUnchangedRegions:e.options}),this._metadataEditorDisposeStore.add(e.onDidChangeEnablement(()=>{this._metadataEditor&&this._metadataEditor.updateOptions({hideUnchangedRegions:e.options})})),this.layout({metadataHeight:!0}),this._metadataEditorDisposeStore.add(this._metadataEditor),this._metadataEditorContainer?.classList.add("diff");let[t,o]=await Promise.all([this.textModelService.createModelReference(sn.generateCellPropertyUri(this.cell.originalDocument.uri,this.cell.original.handle,Q.vscodeNotebookCellMetadata)),this.textModelService.createModelReference(sn.generateCellPropertyUri(this.cell.modifiedDocument.uri,this.cell.modified.handle,Q.vscodeNotebookCellMetadata))]);if(this._isDisposed){t.dispose(),o.dispose();return}this._metadataEditorDisposeStore.add(t),this._metadataEditorDisposeStore.add(o);let n=this._metadataEditor.createViewModel({original:t.object.textEditorModel,modified:o.object.textEditorModel});if(this._metadataEditor.setModel(n),await n.waitForDiff(),this._isDisposed)return;this.cell.metadataHeight=this._metadataEditor.getContentHeight(),this._metadataEditorDisposeStore.add(this._metadataEditor.onDidContentSizeChange(s=>{s.contentHeightChanged&&this.cell.metadataFoldingState===0&&(this.cell.metadataHeight=s.contentHeight)}));let r=!1;this._metadataEditorDisposeStore.add(o.object.textEditorModel.onDidChangeContent(()=>{r=!0;let s=o.object.textEditorModel.getValue();this._applySanitizedMetadataChanges(this.cell.modified.metadata,s),this._metadataHeader.refresh(),r=!1})),this._metadataEditorDisposeStore.add(this.cell.modified.textModel.onDidChangeMetadata(()=>{if(r)return;let s=Dq(this.notebookEditor.textModel?.transientOptions.transientCellMetadata,this.cell.modified?.metadata||{},this.cell.modified?.language,!0);o.object.textEditorModel.setValue(s)}));return}else{this._metadataEditor=this.instantiationService.createInstance(us,this._metadataEditorContainer,{...LOe,dimension:{width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight},overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!1,allowVariableLineHeights:!1},{}),this.layout({metadataHeight:!0}),this._metadataEditorDisposeStore.add(this._metadataEditor);let e=this.languageService.createById("jsonc"),t=Dq(this.notebookEditor.textModel?.transientOptions.transientCellMetadata,this.cell.type==="insert"?this.cell.modified.metadata||{}:this.cell.original.metadata||{},void 0,!0),o=this.cell.type==="insert"?this.cell.modified.uri:this.cell.original.uri,n=this.cell.type==="insert"?this.cell.modified.handle:this.cell.original.handle,r=sn.generateCellPropertyUri(o,n,Q.vscodeNotebookCellMetadata),s=this.modelService.createModel(t,e,r,!1);this._metadataEditor.setModel(s),this._metadataEditorDisposeStore.add(s),this.cell.metadataHeight=this._metadataEditor.getContentHeight(),this._metadataEditorDisposeStore.add(this._metadataEditor.onDidContentSizeChange(l=>{l.contentHeightChanged&&this.cell.metadataFoldingState===0&&(this.cell.metadataHeight=l.contentHeight)}))}}_buildOutputEditor(){if(this._outputEditorDisposeStore.clear(),(this.cell.type==="modified"||this.cell.type==="unchanged")&&!this.notebookEditor.textModel.transientOptions.transientOutputs){let n=soe(this.cell.original?.outputs||[]),r=soe(this.cell.modified?.outputs||[]);if(n!==r){let s=this.languageService.createById("json"),l=this.modelService.createModel(n,s,void 0,!0),c=this.modelService.createModel(r,s,void 0,!0);this._outputEditorDisposeStore.add(l),this._outputEditorDisposeStore.add(c);let u=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,p=Math.max(l.getLineCount(),c.getLineCount());this._outputEditor=this.instantiationService.createInstance(_p,this._outputEditorContainer,{...MOe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!0,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:Math.min(hrt,this.cell.layoutInfo.rawOutputHeight||u*p),width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0)},accessibilityVerbose:this.configurationService.getValue("accessibility.verbosity.diffEditor")??!1},{originalEditor:qQ(),modifiedEditor:qQ()}),this._outputEditorDisposeStore.add(this._outputEditor),this._outputEditorContainer?.classList.add("diff"),this._outputEditor.setModel({original:l,modified:c}),this._outputEditor.restoreViewState(this.cell.getOutputEditorViewState()),this.cell.rawOutputHeight=this._outputEditor.getContentHeight(),this._outputEditorDisposeStore.add(this._outputEditor.onDidContentSizeChange(h=>{h.contentHeightChanged&&this.cell.outputFoldingState===0&&(this.cell.rawOutputHeight=h.contentHeight)})),this._outputEditorDisposeStore.add(this.cell.modified.textModel.onDidChangeOutputs(()=>{let h=soe(this.cell.modified?.outputs||[]);c.setValue(h),this._outputHeader.refresh()}));return}}this._outputEditor=this.instantiationService.createInstance(us,this._outputEditorContainer,{...LOe,dimension:{width:Math.min(hrt,this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,this.cell.type==="unchanged"||this.cell.type==="modified")-32),height:this.cell.layoutInfo.rawOutputHeight},overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),allowVariableLineHeights:!1},{}),this._outputEditorDisposeStore.add(this._outputEditor);let e=this.languageService.createById("json"),t=soe(this.notebookEditor.textModel.transientOptions.transientOutputs?[]:this.cell.type==="insert"?this.cell.modified?.outputs||[]:this.cell.original?.outputs||[]),o=this.modelService.createModel(t,e,void 0,!0);this._outputEditorDisposeStore.add(o),this._outputEditor.setModel(o),this._outputEditor.restoreViewState(this.cell.getOutputEditorViewState()),this.cell.rawOutputHeight=this._outputEditor.getContentHeight(),this._outputEditorDisposeStore.add(this._outputEditor.onDidContentSizeChange(n=>{n.contentHeightChanged&&this.cell.outputFoldingState===0&&(this.cell.rawOutputHeight=n.contentHeight)}))}layoutNotebookCell(){this.notebookEditor.layoutNotebookCell(this.cell,this.cell.layoutInfo.totalHeight)}updateBorders(){this.templateData.leftBorder.style.height=`${this.cell.layoutInfo.totalHeight-32}px`,this.templateData.rightBorder.style.height=`${this.cell.layoutInfo.totalHeight-32}px`,this.templateData.bottomBorder.style.top=`${this.cell.layoutInfo.totalHeight-32}px`}dispose(){this._outputEditor&&this.cell.saveOutputEditorViewState(this._outputEditor.saveViewState()),this._metadataEditor&&this.cell.saveMetadataEditorViewState(this._metadataEditor.saveViewState()),this._metadataEditorDisposeStore.dispose(),this._outputEditorDisposeStore.dispose(),this._isDisposed=!0,super.dispose()}},F2t=class extends O2t{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v),this.cell=e,this.templateData=t,this.updateBorders()}init(){this._diagonalFill=this.templateData.diagonalFill}buildBody(){let i=this.templateData.body;switch(this._diffEditorContainer=this.templateData.diffEditorContainer,i.classList.remove("left","right","full"),this.style){case"left":i.classList.add("left");break;case"right":i.classList.add("right");break;default:i.classList.add("full");break}this.styleContainer(this._diffEditorContainer),this.updateSourceEditor(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():this._buildMetadata(),this.configurationService.getValue("notebook.diff.ignoreOutputs")||this.notebookEditor.textModel?.transientOptions.transientOutputs?this._disposeOutput():this._buildOutput(),this._register(this.configurationService.onDidChangeConfiguration(e=>{let t=!1,o=!1;e.affectsConfiguration("notebook.diff.ignoreMetadata")&&(this._metadataLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreMetadata")?this._disposeMetadata():(this.cell.metadataStatusHeight=25,this._buildMetadata(),this.updateMetadataRendering(),t=!0)),e.affectsConfiguration("notebook.diff.ignoreOutputs")&&(this._outputLocalDisposable.clear(),this.configurationService.getValue("notebook.diff.ignoreOutputs")||this.notebookEditor.textModel?.transientOptions.transientOutputs?this._disposeOutput():(this.cell.outputStatusHeight=25,this._buildOutput(),o=!0)),(t||o)&&this.layout({metadataHeight:t,outputTotalHeight:o})}))}updateSourceEditor(){this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="",this._editorContainer=this.templateData.editorContainer,this._editorContainer.classList.add("diff");let i=()=>{if(this.cell.cellFoldingState===1){this._editorContainer.style.display="none",this.cell.editorHeight=0;return}let e=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,t=this.cell.computeInputEditorHeight(e);if(this._editorContainer.style.height=`${t}px`,this._editorContainer.style.display="block",this._editor){let o=this._editor.getContentHeight();o>=0&&(this.cell.editorHeight=o);return}this._editor=this.templateData.sourceEditor,this._editor.layout({width:(this.notebookEditor.getLayoutInfo().width-2*zR)/2-18,height:t}),this._editor.updateOptions({readOnly:this.readonly}),this.cell.editorHeight=t,this._register(this._editor.onDidContentSizeChange(o=>{this.cell.cellFoldingState===0&&o.contentHeightChanged&&this.cell.layoutInfo.editorHeight!==o.contentHeight&&(this.cell.editorHeight=o.contentHeight)})),this._initializeSourceDiffEditor(this.nestedCellViewModel)};this._cellHeader=this._register(this.instantiationService.createInstance(jU,this.cell,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>i(),checkIfModified:()=>({reason:void 0}),getFoldingState:()=>this.cell.cellFoldingState,updateFoldingState:e=>this.cell.cellFoldingState=e,unChangedLabel:"Input",changedLabel:"Input",prefix:"input",menuId:R.NotebookDiffCellInputTitle})),this._cellHeader.buildHeader(),i(),this._initializeSourceDiffEditor(this.nestedCellViewModel)}calculateDiagonalFillHeight(){return this.cell.layoutInfo.cellStatusHeight+this.cell.layoutInfo.editorHeight+this.cell.layoutInfo.editorMargin+this.cell.layoutInfo.metadataStatusHeight+this.cell.layoutInfo.metadataHeight+this.cell.layoutInfo.outputTotalHeight+this.cell.layoutInfo.outputStatusHeight}async _initializeSourceDiffEditor(i){let e=await this.textModelService.createModelReference(i.uri);if(this._isDisposed)return;let t=e.object.textEditorModel;this._register(e),this._editor.setModel(t);let o=this.cell.getSourceEditorViewState();o&&this._editor.restoreViewState(o);let n=this._editor.getContentHeight();this.cell.editorHeight=n;let r=`${this.calculateDiagonalFillHeight()}px`;this._diagonalFill.style.height!==r&&(this._diagonalFill.style.height=r)}_disposeMetadata(){this.cell.metadataStatusHeight=0,this.cell.metadataHeight=0,this.templateData.cellHeaderContainer.style.display="none",this.templateData.metadataHeaderContainer.style.display="none",this.templateData.metadataInfoContainer.style.display="none",this._metadataEditor=void 0}_buildMetadata(){this._metadataHeaderContainer=this.templateData.metadataHeaderContainer,this._metadataInfoContainer=this.templateData.metadataInfoContainer,this._metadataHeaderContainer.style.display="flex",this._metadataInfoContainer.style.display="block",this._metadataHeaderContainer.innerText="",this._metadataInfoContainer.innerText="",this._metadataHeader=this.instantiationService.createInstance(jU,this.cell,this._metadataHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateMetadataRendering.bind(this),checkIfModified:()=>this.cell.checkMetadataIfModified(),getFoldingState:()=>this.cell.metadataFoldingState,updateFoldingState:i=>{this.cell.metadataFoldingState=i},unChangedLabel:"Metadata",changedLabel:"Metadata changed",prefix:"metadata",menuId:R.NotebookDiffCellMetadataTitle}),this._metadataLocalDisposable.add(this._metadataHeader),this._metadataHeader.buildHeader()}_buildOutput(){this.templateData.outputHeaderContainer.style.display="flex",this.templateData.outputInfoContainer.style.display="block",this._outputHeaderContainer=this.templateData.outputHeaderContainer,this._outputInfoContainer=this.templateData.outputInfoContainer,this._outputHeaderContainer.innerText="",this._outputInfoContainer.innerText="",this._outputHeader=this.instantiationService.createInstance(jU,this.cell,this._outputHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateOutputRendering.bind(this),checkIfModified:()=>this.cell.checkIfOutputsModified(),getFoldingState:()=>this.cell.outputFoldingState,updateFoldingState:i=>{this.cell.outputFoldingState=i},unChangedLabel:"Outputs",changedLabel:"Outputs changed",prefix:"output",menuId:R.NotebookDiffCellOutputsTitle}),this._outputLocalDisposable.add(this._outputHeader),this._outputHeader.buildHeader()}_disposeOutput(){this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView(),this.cell.rawOutputHeight=0,this.cell.outputMetadataHeight=0,this.cell.outputStatusHeight=0,this.templateData.outputHeaderContainer.style.display="none",this.templateData.outputInfoContainer.style.display="none",this._outputViewContainer=void 0}},OOe=class extends F2t{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"left",s,o,n,r,l,c,u,p,h,g,f)}get nestedCellViewModel(){return this.cell.original}get readonly(){return!0}styleContainer(i){i.classList.remove("inserted"),i.classList.add("removed")}layout(i){kr(Me(this._diffEditorContainer),()=>{(i.editorHeight||i.outerWidth)&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.metadataHeight}),(i.outputTotalHeight||i.outerWidth)&&this._outputEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.outputTotalHeight}),this._diagonalFill&&(this._diagonalFill.style.height=`${this.calculateDiagonalFillHeight()}px`),this.layoutNotebookCell()})}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=D(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=D(this._outputViewContainer,_(".output-empty-view"));let i=D(this._outputEmptyElement,_("span"));i.innerText="No outputs to render",this.cell.original?.outputs.length?this._outputEmptyElement.style.display="none":this._outputEmptyElement.style.display="block",this.cell.layoutChange(),this._outputLeftView=this.instantiationService.createInstance(GQ,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.original,0,this._outputViewContainer),this._register(this._outputLeftView),this._outputLeftView.render();let e=this.notebookEditor.onDidDynamicOutputRendered(t=>{t.cell.uri.toString()===this.cell.original.uri.toString()&&(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),e.dispose())});this._register(e)}this._outputViewContainer.style.display="block"}_decorate(){this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[])}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputLeftView?.showOutputs(),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputLeftView?.hideOutputs())}dispose(){this._editor&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};OOe=I([m(3,Rt),m(4,_t),m(5,Bt),m(6,F),m(7,Xe),m(8,Le),m(9,Ne),m(10,Yt),m(11,X),m(12,B),m(13,Gn)],OOe);var FOe=class extends F2t{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"right",o,n,r,s,l,c,u,p,h,g,f)}get nestedCellViewModel(){return this.cell.modified}get readonly(){return!1}styleContainer(i){i.classList.remove("removed"),i.classList.add("inserted")}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=D(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=D(this._outputViewContainer,_(".output-empty-view")),this._outputEmptyElement.innerText="No outputs to render",this.cell.modified?.outputs.length?this._outputEmptyElement.style.display="none":this._outputEmptyElement.style.display="block",this.cell.layoutChange(),this._outputRightView=this.instantiationService.createInstance(GQ,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.modified,1,this._outputViewContainer),this._register(this._outputRightView),this._outputRightView.render();let i=this.notebookEditor.onDidDynamicOutputRendered(e=>{e.cell.uri.toString()===this.cell.modified.uri.toString()&&(this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[]),i.dispose())});this._register(i)}this._outputViewContainer.style.display="block"}_decorate(){this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[])}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputRightView?.showOutputs(),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputRightView?.hideOutputs())}layout(i){kr(Me(this._diffEditorContainer),()=>{(i.editorHeight||i.outerWidth)&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight}),(i.outputTotalHeight||i.outerWidth)&&this._outputEditor?.layout({width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!1),height:this.cell.layoutInfo.outputTotalHeight}),this.layoutNotebookCell(),this._diagonalFill&&(this._diagonalFill.style.height=`${this.calculateDiagonalFillHeight()}px`)})}dispose(){this._editor&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};FOe=I([m(3,F),m(4,Rt),m(5,_t),m(6,Bt),m(7,Xe),m(8,Le),m(9,Ne),m(10,Yt),m(11,X),m(12,B),m(13,Gn)],FOe);var bfe=class extends O2t{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super(i,e,t,"full",o,n,r,s,l,c,u,p,h,g,f),this.cell=e,this.templateData=t,this._editorViewStateChanged=!1,this.updateBorders()}init(){}styleContainer(i){i.classList.remove("inserted","removed")}buildBody(){super.buildBody(),this.cell.displayIconToHideUnmodifiedCells?(this._register(this.templateData.marginOverlay.onAction(()=>this.cell.hideUnchangedCells())),this.templateData.marginOverlay.show()):this.templateData.marginOverlay.hide()}_disposeMetadata(){this.cell.metadataStatusHeight=0,this.cell.metadataHeight=0,this.templateData.metadataHeaderContainer.style.display="none",this.templateData.metadataInfoContainer.style.display="none",this._metadataEditor=void 0}_buildMetadata(){this._metadataHeaderContainer=this.templateData.metadataHeaderContainer,this._metadataInfoContainer=this.templateData.metadataInfoContainer,this._metadataHeaderContainer.style.display="flex",this._metadataInfoContainer.style.display="block",this._metadataHeaderContainer.innerText="",this._metadataInfoContainer.innerText="",this._metadataHeader=this.instantiationService.createInstance(jU,this.cell,this._metadataHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateMetadataRendering.bind(this),checkIfModified:()=>this.cell.checkMetadataIfModified(),getFoldingState:()=>this.cell.metadataFoldingState,updateFoldingState:i=>{this.cell.metadataFoldingState=i},unChangedLabel:"Metadata",changedLabel:"Metadata changed",prefix:"metadata",menuId:R.NotebookDiffCellMetadataTitle}),this._metadataLocalDisposable.add(this._metadataHeader),this._metadataHeader.buildHeader()}_disposeOutput(){this._hideOutputsRaw(),this._hideOutputsRenderer(),this._hideOutputsEmptyView(),this.cell.rawOutputHeight=0,this.cell.outputMetadataHeight=0,this.cell.outputStatusHeight=0,this.templateData.outputHeaderContainer.style.display="none",this.templateData.outputInfoContainer.style.display="none",this._outputViewContainer=void 0}_buildOutput(){this.templateData.outputHeaderContainer.style.display="flex",this.templateData.outputInfoContainer.style.display="block",this._outputHeaderContainer=this.templateData.outputHeaderContainer,this._outputInfoContainer=this.templateData.outputInfoContainer,this._outputHeaderContainer.innerText="",this._outputInfoContainer.innerText="",this.cell.checkIfOutputsModified()?this._outputInfoContainer.classList.add("modified"):this._outputInfoContainer.classList.remove("modified"),this._outputHeader=this.instantiationService.createInstance(jU,this.cell,this._outputHeaderContainer,this.notebookEditor,{updateInfoRendering:this.updateOutputRendering.bind(this),checkIfModified:()=>this.cell.checkIfOutputsModified(),getFoldingState:()=>this.cell.outputFoldingState,updateFoldingState:i=>{this.cell.outputFoldingState=i},unChangedLabel:"Outputs",changedLabel:"Outputs changed",prefix:"output",menuId:R.NotebookDiffCellOutputsTitle}),this._outputLocalDisposable.add(this._outputHeader),this._outputHeader.buildHeader()}_buildOutputRendererContainer(){if(!this._outputViewContainer){this._outputViewContainer=D(this._outputInfoContainer,_(".output-view-container")),this._outputEmptyElement=D(this._outputViewContainer,_(".output-empty-view")),this._outputEmptyElement.innerText="No outputs to render",!this.cell.checkIfOutputsModified()&&this.cell.modified.outputs.length===0?this._outputEmptyElement.style.display="block":this._outputEmptyElement.style.display="none",this.cell.layoutChange(),this._register(this.cell.modified.textModel.onDidChangeOutputs(()=>{!this.cell.checkIfOutputsModified()&&this.cell.modified.outputs.length===0?this._outputEmptyElement.style.display="block":this._outputEmptyElement.style.display="none",this._decorate()})),this._outputLeftContainer=D(this._outputViewContainer,_(".output-view-container-left")),this._outputRightContainer=D(this._outputViewContainer,_(".output-view-container-right")),this._outputMetadataContainer=D(this._outputViewContainer,_(".output-view-container-metadata"));let i=this.cell.checkIfOutputsModified(),e=i&&i.kind===1&&this.cell.original.outputs.length===1&&this.cell.modified.outputs.length===1&&Jyo(this.cell.original.outputs[0],this.cell.modified.outputs[0])===1;if(i&&!e){let t=this.notebookEditor.onDidDynamicOutputRendered(n=>{n.cell.uri.toString()===this.cell.original.uri.toString()&&this.cell.checkIfOutputsModified()&&(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),t.dispose())}),o=this.notebookEditor.onDidDynamicOutputRendered(n=>{n.cell.uri.toString()===this.cell.modified.uri.toString()&&this.cell.checkIfOutputsModified()&&(this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[]),o.dispose())});this._register(t),this._register(o)}if(this._outputLeftView=this.instantiationService.createInstance(GQ,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.original,0,this._outputLeftContainer),this._outputLeftView.render(),this._register(this._outputLeftView),this._outputRightView=this.instantiationService.createInstance(GQ,this.notebookEditor,this.notebookEditor.textModel,this.cell,this.cell.modified,1,this._outputRightContainer),this._outputRightView.render(),this._register(this._outputRightView),i&&!e&&this._decorate(),e){this._outputMetadataContainer.style.top=`${this.cell.layoutInfo.rawOutputHeight}px`,this._outputMetadataEditor=this.instantiationService.createInstance(_p,this._outputMetadataContainer,{...MOe,overflowWidgetsDomNode:this.notebookEditor.getOverflowContainerDomNode(),readOnly:!0,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:hrt,width:this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0)}},{originalEditor:qQ(),modifiedEditor:qQ()}),this._register(this._outputMetadataEditor);let t=JSON.stringify(this.cell.original.outputs[0].metadata??{},void 0,"	"),o=JSON.stringify(this.cell.modified.outputs[0].metadata??{},void 0,"	"),n=this.languageService.createById("json"),r=this.modelService.createModel(t,n,void 0,!0),s=this.modelService.createModel(o,n,void 0,!0);this._outputMetadataEditor.setModel({original:r,modified:s}),this.cell.outputMetadataHeight=this._outputMetadataEditor.getContentHeight(),this._register(this._outputMetadataEditor.onDidContentSizeChange(l=>{this.cell.outputMetadataHeight=l.contentHeight}))}}this._outputViewContainer.style.display="block"}_decorate(){this.cell.checkIfOutputsModified()?(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,["nb-cellDeleted"],[]),this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,["nb-cellAdded"],[])):(this.notebookEditor.deltaCellOutputContainerClassNames(0,this.cell.original.id,[],["nb-cellDeleted"]),this.notebookEditor.deltaCellOutputContainerClassNames(1,this.cell.modified.id,[],["nb-cellAdded"]))}_showOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="block",this._outputLeftView?.showOutputs(),this._outputRightView?.showOutputs(),this._outputMetadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputMetadataHeight}),this._decorate())}_hideOutputsRenderer(){this._outputViewContainer&&(this._outputViewContainer.style.display="none",this._outputLeftView?.hideOutputs(),this._outputRightView?.hideOutputs())}updateSourceEditor(){this._cellHeaderContainer=this.templateData.cellHeaderContainer,this._cellHeaderContainer.style.display="flex",this._cellHeaderContainer.innerText="";let i=this.cell.modified;this._editorContainer=this.templateData.editorContainer,this._editorContainer.classList.add("diff");let e=()=>{if(this.cell.cellFoldingState===1){this._editorContainer.style.display="none",this.cell.editorHeight=0;return}let l=i.textModel.textBuffer.getLineCount(),c=this.notebookEditor.getLayoutInfo().fontInfo.lineHeight||17,u=this.cell.layoutInfo.editorHeight!==0?this.cell.layoutInfo.editorHeight:this.cell.computeInputEditorHeight(c);if(this._editorContainer.style.height=`${u}px`,this._editorContainer.style.display="block",this._editor){let g=this._editor.getContentHeight();g>=0&&(this.cell.editorHeight=g);return}this._editor=this.templateData.sourceEditor;let p={padding:aO(l)},h=this._register(A2t(this.configurationService));h.options.enabled&&(p.hideUnchangedRegions=h.options),this._editor.updateOptions(p),this._register(h.onDidChangeEnablement(()=>{p.hideUnchangedRegions=h.options,this._editor?.updateOptions(p)})),this._editor.layout({width:this.notebookEditor.getLayoutInfo().width-2*zR,height:u}),this._register(this._editor.onDidContentSizeChange(g=>{this.cell.cellFoldingState===0&&g.contentHeightChanged&&this.cell.layoutInfo.editorHeight!==g.contentHeight&&(this.cell.editorHeight=g.contentHeight)})),this._initializeSourceDiffEditor()};this._cellHeader=this._register(this.instantiationService.createInstance(jU,this.cell,this._cellHeaderContainer,this.notebookEditor,{updateInfoRendering:()=>e(),checkIfModified:()=>this.cell.modified?.textModel.getTextBufferHash()!==this.cell.original?.textModel.getTextBufferHash()?{reason:void 0}:!1,getFoldingState:()=>this.cell.cellFoldingState,updateFoldingState:l=>this.cell.cellFoldingState=l,unChangedLabel:"Input",changedLabel:"Input changed",prefix:"input",menuId:R.NotebookDiffCellInputTitle})),this._cellHeader.buildHeader(),e();let t=this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);this._register(t);let o=gfe.bindTo(t);o.set(this.cell.modified.textModel.getTextBufferHash()!==this.cell.original.textModel.getTextBufferHash());let n=jyo.bindTo(t),r=this.textConfigurationService.getValue(this.cell.modified.uri,"diffEditor.ignoreTrimWhitespace");n.set(r),this._toolbar=this.templateData.toolbar,this._toolbar.context=this.cell;let s=()=>{let l=this.textConfigurationService.getValue(this.cell.modified.uri,"diffEditor.ignoreTrimWhitespace");n.set(l);let c=this.cell.modified.textModel.getTextBufferHash()!==this.cell.original.textModel.getTextBufferHash();if(o.set(c),c){let u=this.menuService.getMenuActions(R.NotebookDiffCellInputTitle,t,{shouldForwardArgs:!0}),p=Ng(u);this._toolbar.setActions(p)}else this._toolbar.setActions([])};this._register(this.cell.modified.textModel.onDidChangeContent(()=>s())),this._register(this.textConfigurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(this.cell.modified.uri,"diffEditor")&&l.affectedKeys.has("diffEditor.ignoreTrimWhitespace")&&s()})),s()}async _initializeSourceDiffEditor(){let[i,e]=await Promise.all([this.textModelService.createModelReference(this.cell.original.uri),this.textModelService.createModelReference(this.cell.modified.uri)]);if(this._register(i),this._register(e),this._isDisposed){i.dispose(),e.dispose();return}let t=this._register(this._editor.createViewModel({original:i.object.textEditorModel,modified:e.object.textEditorModel}));await t.waitForDiff(),this._editor.setModel(t);let o=()=>{this._editorViewStateChanged=!0},n=l=>{(l.scrollTopChanged||l.scrollLeftChanged)&&(this._editorViewStateChanged=!0)};this.updateEditorOptionsForWhitespace(),this._register(this._editor.getOriginalEditor().onDidChangeCursorSelection(o)),this._register(this._editor.getOriginalEditor().onDidScrollChange(n)),this._register(this._editor.getModifiedEditor().onDidChangeCursorSelection(o)),this._register(this._editor.getModifiedEditor().onDidScrollChange(n));let r=this.cell.getSourceEditorViewState();r&&this._editor.restoreViewState(r);let s=this._editor.getContentHeight();this.cell.editorHeight=s}updateEditorOptionsForWhitespace(){let i=this._editor;if(!i)return;let e=i.getModel()?.modified.uri||i.getModel()?.original.uri;if(!e)return;let t=this.textConfigurationService.getValue(e,"diffEditor.ignoreTrimWhitespace");i.updateOptions({ignoreTrimWhitespace:t}),this._register(this.textConfigurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(e,"diffEditor")&&o.affectedKeys.has("diffEditor.ignoreTrimWhitespace")){let n=this.textConfigurationService.getValue(e,"diffEditor.ignoreTrimWhitespace");i.updateOptions({ignoreTrimWhitespace:n})}}))}layout(i){kr(Me(this._diffEditorContainer),()=>{i.editorHeight&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout({width:this._editor.getViewWidth(),height:this.cell.layoutInfo.editorHeight})),i.outerWidth&&this._editor&&(this._editorContainer.style.height=`${this.cell.layoutInfo.editorHeight}px`,this._editor.layout()),(i.metadataHeight||i.outerWidth)&&this._metadataEditorContainer&&(this._metadataEditorContainer.style.height=`${this.cell.layoutInfo.metadataHeight}px`,this._metadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.metadataHeight})),(i.outputTotalHeight||i.outerWidth)&&(this._outputEditorContainer&&(this._outputEditorContainer.style.height=`${this.cell.layoutInfo.outputTotalHeight}px`,this._outputEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputTotalHeight})),this._outputMetadataContainer&&(this._outputMetadataContainer.style.height=`${this.cell.layoutInfo.outputMetadataHeight}px`,this._outputMetadataContainer.style.top=`${this.cell.layoutInfo.outputTotalHeight-this.cell.layoutInfo.outputMetadataHeight}px`,this._outputMetadataEditor?.layout({width:this._editor?.getViewWidth()||this.cell.getComputedCellContainerWidth(this.notebookEditor.getLayoutInfo(),!1,!0),height:this.cell.layoutInfo.outputMetadataHeight}))),this.layoutNotebookCell()})}dispose(){this._editor&&this._editor.setModel(null),this._editor&&this._editorViewStateChanged&&this.cell.saveSpirceEditorViewState(this._editor.saveViewState()),super.dispose()}};bfe=I([m(3,F),m(4,Rt),m(5,_t),m(6,Bt),m(7,Xe),m(8,Le),m(9,Ne),m(10,Yt),m(11,X),m(12,B),m(13,Gn)],bfe);var W2t=class extends k{constructor(e){super();this.container=e;this._nodes=st("div.diff-hidden-cells",[st("div.center@content",{style:{display:"flex"}},[_("a",{title:d(13707,null),role:"button",onclick:()=>{this._action.fire()}},...ir("$(unfold)"))])]);this._action=this._register(new T);this.onAction=this._action.event;this._nodes.root.style.display="none",e.appendChild(this._nodes.root)}show(){this._nodes.root.style.display="block"}hide(){this._nodes.root.style.display="none"}dispose(){this.hide(),this.container.removeChild(this._nodes.root),Ii(this._nodes.root),super.dispose()}},grt=class extends k{constructor(e){super();this.container=e;this._nodes=st("div.diff-hidden-cells",[st("div.center@content",{style:{display:"flex"}},[_("a",{title:d(13706,null),role:"button",onclick:()=>{this._action.fire()}},...ir("$(fold)"))])]);this._action=this._register(new T);this.onAction=this._action.event;this._nodes.root.style.display="none",e.appendChild(this._nodes.root)}show(){this._nodes.root.style.display="block"}hide(){this._nodes.root.style.display="none"}dispose(){this.hide(),this.container.removeChild(this._nodes.root),Ii(this._nodes.root),super.dispose()}};var WOe=class{constructor(i,e){this.configurationService=e;let t=this.configurationService.getValue("editor");this.lineHeight=RI(t,Gu.getInstance(i).value).lineHeight}getHeight(i){return i.getHeight(this.lineHeight)}hasDynamicHeight(i){return!1}getTemplateId(i){switch(i.type){case"delete":case"insert":return QQ.TEMPLATE_ID;case"modified":case"unchanged":return YQ.TEMPLATE_ID;case"placeholder":return $Q.TEMPLATE_ID;case"modifiedMetadata":case"unchangedMetadata":return jQ.TEMPLATE_ID}}};WOe=I([m(1,B)],WOe);var $Q=class{constructor(i,e){this.notebookEditor=i;this.instantiationService=e}static{this.TEMPLATE_ID="cell_diff_placeholder"}get templateId(){return $Q.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-placeholder-body");D(i,e);let t=new O,o=new W2t(e),n=D(e,_(".contents")),r=D(n,_("span.text",{title:d(13741,null)}));return{body:e,container:i,placeholder:r,marginOverlay:o,elementDisposables:t}}renderElement(i,e,t){t.body.classList.remove("left","right","full"),t.elementDisposables.add(this.instantiationService.createInstance(N2t,i,t))}disposeTemplate(i){i.container.innerText=""}disposeElement(i,e,t){t.elementDisposables.clear()}};$Q=I([m(1,F)],$Q);var jQ=class{constructor(i,e,t,o,n,r,s,l,c){this.notebookEditor=i;this.instantiationService=e;this.contextMenuService=t;this.keybindingService=o;this.menuService=n;this.contextKeyService=r;this.notificationService=s;this.themeService=l;this.accessibilityService=c}static{this.TEMPLATE_ID="notebook_metadata_diff_side_by_side"}get templateId(){return jQ.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");D(i,e);let t=_(".cell-diff-editor-container");D(e,t);let o=D(t,_(".input-header-container")),n=D(t,_(".source-container")),{editor:r,editorContainer:s}=this._buildSourceEditor(n),l=D(n,_(".editor-input-toolbar-container")),c=D(l,_("div.property-toolbar")),u=this.instantiationService.createInstance(dl,c,{actionViewItemProvider:(y,w)=>{if(y instanceof Do)return new CP(y,{hoverDelegate:w.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)},highlightToggledItems:!0}),p=D(e,_(".border-container")),h=D(p,_(".left-border")),g=D(p,_(".right-border")),f=D(p,_(".top-border")),v=D(p,_(".bottom-border")),b=new grt(e),S=new O;return{body:e,container:i,diffEditorContainer:t,cellHeaderContainer:o,sourceEditor:r,editorContainer:s,inputToolbarContainer:l,toolbar:u,leftBorder:h,rightBorder:g,topBorder:f,bottomBorder:v,marginOverlay:b,elementDisposables:S}}_buildSourceEditor(i){return Zyo(this.instantiationService,this.notebookEditor,i,{readOnly:!0})}renderElement(i,e,t){t.body.classList.remove("full"),t.elementDisposables.add(this.instantiationService.createInstance(NOe,this.notebookEditor,i,t))}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.toolbar?.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.toolbar&&(t.toolbar.context=void 0),t.elementDisposables.clear()}};jQ=I([m(1,F),m(2,Xe),m(3,Le),m(4,Yt),m(5,X),m(6,Ne),m(7,Pe),m(8,Ai)],jQ);var QQ=class{constructor(i,e){this.notebookEditor=i;this.instantiationService=e}static{this.TEMPLATE_ID="cell_diff_single"}get templateId(){return QQ.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");D(i,e);let t=_(".cell-diff-editor-container");D(e,t);let o=D(e,_(".diagonal-fill")),n=D(t,_(".input-header-container")),r=D(t,_(".source-container")),{editor:s,editorContainer:l}=this._buildSourceEditor(r),c=D(t,_(".metadata-header-container")),u=D(t,_(".metadata-info-container")),p=D(t,_(".output-header-container")),h=D(t,_(".output-info-container")),g=D(e,_(".border-container")),f=D(g,_(".left-border")),v=D(g,_(".right-border")),b=D(g,_(".top-border")),S=D(g,_(".bottom-border"));return{body:e,container:i,editorContainer:l,diffEditorContainer:t,diagonalFill:o,cellHeaderContainer:n,sourceEditor:s,metadataHeaderContainer:c,metadataInfoContainer:u,outputHeaderContainer:p,outputInfoContainer:h,leftBorder:f,rightBorder:v,topBorder:b,bottomBorder:S,elementDisposables:new O}}_buildSourceEditor(i){return Xan(this.instantiationService,this.notebookEditor,i)}renderElement(i,e,t){switch(t.body.classList.remove("left","right","full"),i.type){case"delete":t.elementDisposables.add(this.instantiationService.createInstance(OOe,this.notebookEditor,i,t));return;case"insert":t.elementDisposables.add(this.instantiationService.createInstance(FOe,this.notebookEditor,i,t));return;default:break}}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.elementDisposables.clear()}};QQ=I([m(1,F)],QQ);var YQ=class{constructor(i,e,t,o,n,r,s,l,c){this.notebookEditor=i;this.instantiationService=e;this.contextMenuService=t;this.keybindingService=o;this.menuService=n;this.contextKeyService=r;this.notificationService=s;this.themeService=l;this.accessibilityService=c}static{this.TEMPLATE_ID="cell_diff_side_by_side"}get templateId(){return YQ.TEMPLATE_ID}renderTemplate(i){let e=_(".cell-body");D(i,e);let t=_(".cell-diff-editor-container");D(e,t);let o=D(t,_(".input-header-container")),n=D(t,_(".source-container")),{editor:r,editorContainer:s}=this._buildSourceEditor(n),l=D(n,_(".editor-input-toolbar-container")),c=D(l,_("div.property-toolbar")),u=this.instantiationService.createInstance(dl,c,{actionViewItemProvider:(M,N)=>{if(M instanceof Do)return new CP(M,{hoverDelegate:N.hoverDelegate},this.keybindingService,this.notificationService,this.contextKeyService,this.themeService,this.contextMenuService,this.accessibilityService)},highlightToggledItems:!0}),p=D(t,_(".metadata-header-container")),h=D(t,_(".metadata-info-container")),g=D(t,_(".output-header-container")),f=D(t,_(".output-info-container")),v=D(e,_(".border-container")),b=D(v,_(".left-border")),S=D(v,_(".right-border")),y=D(v,_(".top-border")),w=D(v,_(".bottom-border")),x=new grt(e),E=new O;return{body:e,container:i,diffEditorContainer:t,cellHeaderContainer:o,sourceEditor:r,editorContainer:s,inputToolbarContainer:l,toolbar:u,metadataHeaderContainer:p,metadataInfoContainer:h,outputHeaderContainer:g,outputInfoContainer:f,leftBorder:b,rightBorder:S,topBorder:y,bottomBorder:w,marginOverlay:x,elementDisposables:E}}_buildSourceEditor(i){return Zyo(this.instantiationService,this.notebookEditor,i)}renderElement(i,e,t){switch(t.body.classList.remove("left","right","full"),i.type){case"unchanged":t.elementDisposables.add(this.instantiationService.createInstance(bfe,this.notebookEditor,i,t));return;case"modified":t.elementDisposables.add(this.instantiationService.createInstance(bfe,this.notebookEditor,i,t));return;default:break}}disposeTemplate(i){i.container.innerText="",i.sourceEditor.dispose(),i.toolbar?.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.toolbar&&(t.toolbar.context=void 0),t.elementDisposables.clear()}};YQ=I([m(1,F),m(2,Xe),m(3,Le),m(4,Yt),m(5,X),m(6,Ne),m(7,Pe),m(8,Ai)],YQ);var lMi=class extends yde{onViewPointer(i){if(zX(i.browserEvent.target)){let e=typeof i.index>"u"?[]:[i.index];this.list.setFocus(e,i.browserEvent)}else super.onViewPointer(i)}},VOe=class extends bc{get rowsContainer(){return this.view.containerDomNode}constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,r,n,s,l,c)}createMouseController(i){return new lMi(this)}getCellViewScrollTop(i){let e=this.indexOf(i);return this.view.elementTop(e)}getScrollHeight(){return this.view.scrollHeight}triggerScrollFromMouseWheelEvent(i){this.view.delegateScrollFromMouseWheelEvent(i)}delegateVerticalScrollbarPointerDown(i){this.view.delegateVerticalScrollbarPointerDown(i)}clear(){super.splice(0,this.length)}updateElementHeight2(i,e){let t=this.indexOf(i),o=this.getFocus();this.view.updateElementHeight(t,e,o.length?o[0]:null)}style(i){let e=this.view.domId;this.styleElement||(this.styleElement=Pr(this.view.domNode));let t=e&&`.${e}`,o=[];i.listBackground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows { background: ${i.listBackground}; }`),i.listFocusBackground&&(o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color: ${i.listFocusBackground}; }`),o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color: ${i.listFocusBackground}; }`)),i.listFocusForeground&&o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { color: ${i.listFocusForeground}; }`),i.listActiveSelectionBackground&&(o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color: ${i.listActiveSelectionBackground}; }`),o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color: ${i.listActiveSelectionBackground}; }`)),i.listActiveSelectionForeground&&o.push(`.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${i.listActiveSelectionForeground}; }`),i.listFocusAndSelectionBackground&&o.push(`
				.monaco-drag-image${t},
				.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { background-color: ${i.listFocusAndSelectionBackground}; }
			`),i.listFocusAndSelectionForeground&&o.push(`
				.monaco-drag-image${t},
				.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected.focused { color: ${i.listFocusAndSelectionForeground}; }
			`),i.listInactiveFocusBackground&&(o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { background-color:  ${i.listInactiveFocusBackground}; }`),o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused:hover { background-color:  ${i.listInactiveFocusBackground}; }`)),i.listInactiveSelectionBackground&&(o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { background-color:  ${i.listInactiveSelectionBackground}; }`),o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected:hover { background-color:  ${i.listInactiveSelectionBackground}; }`)),i.listInactiveSelectionForeground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { color: ${i.listInactiveSelectionForeground}; }`),i.listHoverBackground&&o.push(`.monaco-list${t}:not(.drop-target) > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { background-color:  ${i.listHoverBackground}; }`),i.listHoverForeground&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover:not(.selected):not(.focused) { color:  ${i.listHoverForeground}; }`),i.listSelectionOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.selected { outline: 1px dotted ${i.listSelectionOutline}; outline-offset: -1px; }`),i.listFocusOutline&&o.push(`
				.monaco-drag-image${t},
				.monaco-list${t}:focus > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px solid ${i.listFocusOutline}; outline-offset: -1px; }
			`),i.listInactiveFocusOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row.focused { outline: 1px dotted ${i.listInactiveFocusOutline}; outline-offset: -1px; }`),i.listHoverOutline&&o.push(`.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows > .monaco-list-row:hover { outline: 1px dashed ${i.listHoverOutline}; outline-offset: -1px; }`),i.listDropOverBackground&&o.push(`
				.monaco-list${t}.drop-target,
				.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-rows.drop-target,
				.monaco-list${t} > div.monaco-scrollable-element > .monaco-list-row.drop-target { background-color: ${i.listDropOverBackground} !important; color: inherit !important; }
			`);let n=o.join(`
`);n!==this.styleElement.textContent&&(this.styleElement.textContent=n)}};VOe=I([m(6,Co),m(7,B),m(8,F)],VOe);function Zyo(a,i,e,t={}){let o=D(e,_(".editor-container"));return{editor:a.createInstance(_p,o,{...MOe,overflowWidgetsDomNode:i.getOverflowContainerDomNode(),originalEditable:!1,ignoreTrimWhitespace:!1,automaticLayout:!1,dimension:{height:0,width:0},renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1,...t},{originalEditor:qQ(),modifiedEditor:qQ()}),editorContainer:o}}function Xan(a,i,e,t={}){let o=D(e,_(".editor-container")),n=["editor.contrib.emptyTextEditorHint"];return{editor:a.createInstance(us,o,{...LOe,glyphMargin:!1,dimension:{width:(i.getLayoutInfo().width-2*zR)/2-18,height:0},automaticLayout:!1,overflowWidgetsDomNode:i.getOverflowContainerDomNode(),allowVariableLineHeights:!1,readOnly:!0},{contributions:ml.getEditorContributions().filter(s=>n.indexOf(s.id)===-1)}),editorContainer:o}}var Jan="notebookEditorWorkerService",Mq=le(Jan);var Zan=20,BOe=class extends ju{constructor(e,t,o,n){super(n);this.notebookEditor=e;this.width=t;this._diffElementViewModels=[];this._lanes=2;this._insertColor=null,this._removeColor=null,this._insertColorHex=null,this._removeColorHex=null,this._disposables=this._register(new O),this._renderAnimationFrame=null,this._domNode=Ir(document.createElement("canvas")),this._domNode.setPosition("relative"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),o.appendChild(this._domNode.domNode),this._overviewViewportDomElement=Ir(document.createElement("div")),this._overviewViewportDomElement.setClassName("diffViewport"),this._overviewViewportDomElement.setPosition("absolute"),this._overviewViewportDomElement.setWidth(t),o.appendChild(this._overviewViewportDomElement.domNode),this._register(Gu.getInstance(Me(this._domNode.domNode)).onDidChange(()=>{this._scheduleRender()})),this._register(this.themeService.onDidColorThemeChange(r=>{this.applyColors(r)&&this._scheduleRender()})),this.applyColors(this.themeService.getColorTheme()),this._register(this.notebookEditor.onDidScroll(()=>{this._renderOverviewViewport()})),this._register(Yo(o,ne.POINTER_DOWN,r=>{this.notebookEditor.delegateVerticalScrollbarPointerDown(r)}))}applyColors(e){let t=e.getColor(QIt)||(e.getColor(_g)||RCe).transparent(2),o=e.getColor(YIt)||(e.getColor(df)||LCe).transparent(2),n=!t.equals(this._insertColor)||!o.equals(this._removeColor);return this._insertColor=t,this._removeColor=o,this._insertColor&&(this._insertColorHex=Ue.Format.CSS.formatHexA(this._insertColor)),this._removeColor&&(this._removeColorHex=Ue.Format.CSS.formatHexA(this._removeColor)),n}layout(){this._layoutNow()}updateViewModels(e,t){this._disposables.clear(),this._diffElementViewModels=e,t&&(this._disposables.add(t.onDidChangeLayout(()=>{this._scheduleRender()})),this._disposables.add(t.onDidChangeCellLayout(()=>{this._scheduleRender()}))),this._scheduleRender()}_scheduleRender(){this._renderAnimationFrame===null&&(this._renderAnimationFrame=Cg(Me(this._domNode.domNode),this._onRenderScheduled.bind(this),16))}_onRenderScheduled(){this._renderAnimationFrame=null,this._layoutNow()}_layoutNow(){let t=this.notebookEditor.getLayoutInfo().height,o=this._diffElementViewModels.map(s=>s.totalHeight).reduce((s,l)=>s+l,0),n=Gu.getInstance(Me(this._domNode.domNode)).value;this._domNode.setWidth(this.width),this._domNode.setHeight(t),this._domNode.domNode.width=this.width*n,this._domNode.domNode.height=t*n;let r=this._domNode.domNode.getContext("2d");r.clearRect(0,0,this.width*n,t*n),this._renderCanvas(r,this.width*n,t*n,o*n,n),this._renderOverviewViewport()}_renderOverviewViewport(){let e=this._computeOverviewViewport();e?(this._overviewViewportDomElement.setTop(e.top),this._overviewViewportDomElement.setHeight(e.height)):(this._overviewViewportDomElement.setTop(0),this._overviewViewportDomElement.setHeight(0))}_computeOverviewViewport(){let e=this.notebookEditor.getLayoutInfo();if(!e)return null;let t=this.notebookEditor.getScrollTop(),o=this.notebookEditor.getScrollHeight(),n=Math.max(0,e.height),r=Math.max(0,n-0),s=e.height,l=Math.round(Math.max(Zan,Math.floor(s*r/o))),c=(r-l)/(o-s),u=Math.round(t*c);return{height:l,top:u}}_renderCanvas(e,t,o,n,r){if(!this._insertColorHex||!this._removeColorHex)return;let s=t/this._lanes,l=0;for(let c=0;c<this._diffElementViewModels.length;c++){let u=this._diffElementViewModels[c],p=Math.round(u.totalHeight/n*r*o);switch(u.type){case"insert":e.fillStyle=this._insertColorHex,e.fillRect(s,l,s,p);break;case"delete":e.fillStyle=this._removeColorHex,e.fillRect(0,l,s,p);break;case"unchanged":case"unchangedMetadata":break;case"modified":case"modifiedMetadata":e.fillStyle=this._removeColorHex,e.fillRect(0,l,s,p),e.fillStyle=this._insertColorHex,e.fillRect(s,l,s,p);break}l+=p}}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),super.dispose()}};BOe=I([m(3,Pe)],BOe);function HOe(a,i,e){let t=e.cellsDiff.changes,o=[],n=0,r=0,s=-1;for(let l=0;l<t.length;l++){let c=t[l];for(let p=0;p<c.originalStart-n;p++){let h=a.cells[n+p],g=i.cells[r+p];h.getHashValue()===g.getHashValue()?o.push({originalCellIndex:n+p,modifiedCellIndex:r+p,type:"unchanged"}):(s===-1&&(s=o.length),o.push({originalCellIndex:n+p,modifiedCellIndex:r+p,type:"modified"}))}let u=eln(c,a,i);u.length&&s===-1&&(s=o.length),o.push(...u),n=c.originalStart+c.originalLength,r=c.modifiedStart+c.modifiedLength}for(let l=n;l<a.cells.length;l++)o.push({originalCellIndex:l,modifiedCellIndex:l-n+r,type:"unchanged"});return{cellDiffInfo:o,firstChangeIndex:s}}function eln(a,i,e){let t=[],o=Math.min(a.originalLength,a.modifiedLength);for(let n=0;n<o;n++){let r=i.cells[a.originalStart+n],s=e.cells[a.modifiedStart+n];if(r.cellKind!==s.cellKind)t.push({originalCellIndex:a.originalStart+n,type:"delete"}),t.push({modifiedCellIndex:a.modifiedStart+n,type:"insert"});else{let l=r.equal(s);t.push({originalCellIndex:a.originalStart+n,modifiedCellIndex:a.modifiedStart+n,type:l?"unchanged":"modified"})}}for(let n=o;n<a.originalLength;n++)t.push({originalCellIndex:a.originalStart+n,type:"delete"});for(let n=o;n<a.modifiedLength;n++)t.push({modifiedCellIndex:a.modifiedStart+n,type:"insert"});return t}var UOe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.model=e;this.notebookEditorWorkerService=t;this.configurationService=o;this.eventDispatcher=n;this.notebookService=r;this.diffEditorHeightCalculator=s;this.fontInfo=l;this.excludeUnchangedPlaceholder=c;this.placeholderAndRelatedCells=new Map;this._items=[];this._onDidChangeItems=this._register(new T);this.onDidChangeItems=this._onDidChangeItems.event;this.disposables=this._register(new O);this._onDidChange=this._register(new T);this.diffEditorItems=[];this.onDidChange=this._onDidChange.event;this.originalCellViewModels=[];this.hideOutput=this.model.modified.notebook.transientOptions.transientOutputs||this.configurationService.getValue("notebook.diff.ignoreOutputs"),this.ignoreMetadata=this.configurationService.getValue("notebook.diff.ignoreMetadata"),this._register(this.configurationService.onDidChangeConfiguration(u=>{let p=!1,h=!1;if(u.affectsConfiguration("notebook.diff.ignoreMetadata")){let g=this.configurationService.getValue("notebook.diff.ignoreMetadata");g!==void 0&&this.ignoreMetadata!==g&&(this.ignoreMetadata=g,p=!0,h=!0)}if(u.affectsConfiguration("notebook.diff.ignoreOutputs")){let g=this.configurationService.getValue("notebook.diff.ignoreOutputs");g!==void 0&&this.hideOutput!==(g||this.model.modified.notebook.transientOptions.transientOutputs)&&(this.hideOutput=g||!!this.model.modified.notebook.transientOptions.transientOutputs,p=!0)}h&&this.toggleNotebookMetadata(),p&&this._onDidChange.fire()}))}get items(){return this._items}get value(){return this.diffEditorItems.filter(e=>e.type!=="placeholder").filter(e=>this._includeUnchanged?!0:e instanceof Sfe||e instanceof aoe||e instanceof loe?!(e.type==="unchanged"&&e.containerType==="unchanged"):!0).filter(e=>e instanceof loe?!this.hideOutput:!0).filter(e=>e instanceof aoe?!this.ignoreMetadata:!0)}get hasUnchangedCells(){return this._hasUnchangedCells===!0}get includeUnchanged(){return this._includeUnchanged===!0}set includeUnchanged(e){this._includeUnchanged=e,this._onDidChange.fire()}dispose(){this.clear(),super.dispose()}clear(){this.disposables.clear(),je(Array.from(this.placeholderAndRelatedCells.keys())),this.placeholderAndRelatedCells.clear(),je(this.originalCellViewModels),this.originalCellViewModels=[],je(this._items),this._items.splice(0,this._items.length)}async computeDiff(e){let t=await Ea(this.notebookEditorWorkerService.computeDiff(this.model.original.resource,this.model.modified.resource),e);if(!t||e.isCancellationRequested)return;tln(this.model.original.notebook,this.model.modified.notebook,t.cellsDiff);let{cellDiffInfo:o,firstChangeIndex:n}=HOe(this.model.original.notebook,this.model.modified.notebook,t);if(!iln(o,this.originalCellViewModels,this.model)){if(await Ea(this.updateViewModels(o,t.metadataChanged,n),e),e.isCancellationRequested)return;this.updateDiffEditorItems()}}toggleNotebookMetadata(){this.notebookMetadataViewModel&&(this.ignoreMetadata?this._items.length&&this._items[0]===this.notebookMetadataViewModel&&(this._items.splice(0,1),this._onDidChangeItems.fire({start:0,deleteCount:1,elements:[]})):(!this._items.length||this._items[0]!==this.notebookMetadataViewModel)&&(this._items.splice(0,0,this.notebookMetadataViewModel),this._onDidChangeItems.fire({start:0,deleteCount:0,elements:[this.notebookMetadataViewModel]})))}updateDiffEditorItems(){this.diffEditorItems=[];let e=this.model.original.resource,t=this.model.modified.resource;this._hasUnchangedCells=!1,this.items.forEach(o=>{switch(o.type){case"delete":{this.diffEditorItems.push(new Sfe(o.original.uri,void 0,o.type,o.type));let n=sn.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellMetadata);this.diffEditorItems.push(new aoe(n,void 0,o.type,o.type));let r=sn.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellOutput);this.diffEditorItems.push(new loe(r,void 0,o.type,o.type));break}case"insert":{this.diffEditorItems.push(new Sfe(void 0,o.modified.uri,o.type,o.type));let n=sn.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellMetadata);this.diffEditorItems.push(new aoe(void 0,n,o.type,o.type));let r=sn.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellOutput);this.diffEditorItems.push(new loe(void 0,r,o.type,o.type));break}case"modified":{let n=o.checkIfInputModified()?o.type:"unchanged",r=o.checkIfInputModified()||o.checkMetadataIfModified()||o.checkIfOutputsModified()?o.type:"unchanged";this.diffEditorItems.push(new Sfe(o.original.uri,o.modified.uri,n,r));let s=sn.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellMetadata),l=sn.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellMetadata);this.diffEditorItems.push(new aoe(s,l,o.checkMetadataIfModified()?o.type:"unchanged",r));let c=sn.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellOutput),u=sn.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellOutput);this.diffEditorItems.push(new loe(c,u,o.checkIfOutputsModified()?o.type:"unchanged",r));break}case"unchanged":{this._hasUnchangedCells=!0,this.diffEditorItems.push(new Sfe(o.original.uri,o.modified.uri,o.type,o.type));let n=sn.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellMetadata),r=sn.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellMetadata);this.diffEditorItems.push(new aoe(n,r,o.type,o.type));let s=sn.generateCellPropertyUri(e,o.original.handle,Q.vscodeNotebookCellOutput),l=sn.generateCellPropertyUri(t,o.modified.handle,Q.vscodeNotebookCellOutput);this.diffEditorItems.push(new loe(s,l,o.type,o.type));break}}}),this._onDidChange.fire()}async updateViewModels(e,t,o){let n=await this.createDiffViewModels(e,t),r=this._items.length;this.clear(),this._items.splice(0,r);let s;this.originalCellViewModels=n,n.forEach((l,c)=>{if(l.type==="unchanged"&&!this.excludeUnchangedPlaceholder){if(!s){l.displayIconToHideUnmodifiedCells=!0,s=new M2t(l.mainDocumentTextModel,l.editorEventDispatcher,l.initData),this._items.push(s);let p=s;this.disposables.add(p.onUnfoldHiddenCells(()=>{let h=this.placeholderAndRelatedCells.get(p);if(!Array.isArray(h))return;let g=this._items.indexOf(p);this._items.splice(g,1,...h),this._onDidChangeItems.fire({start:g,deleteCount:1,elements:h})})),this.disposables.add(l.onHideUnchangedCells(()=>{let h=this.placeholderAndRelatedCells.get(p);if(!Array.isArray(h))return;let g=this._items.indexOf(l);this._items.splice(g,h.length,p),this._onDidChangeItems.fire({start:g,deleteCount:h.length,elements:[p]})}))}let u=this.placeholderAndRelatedCells.get(s)||[];u.push(l),this.placeholderAndRelatedCells.set(s,u),s.hiddenCells.push(l)}else s=void 0,this._items.push(l)}),this._onDidChangeItems.fire({start:0,deleteCount:r,elements:this._items,firstChangeIndex:o})}async createDiffViewModels(e,t){let o=this.model.original.notebook,n=this.model.modified.notebook,r={metadataStatusHeight:this.configurationService.getValue("notebook.diff.ignoreMetadata")?0:25,outputStatusHeight:this.configurationService.getValue("notebook.diff.ignoreOutputs")||n.transientOptions.transientOutputs?0:25,fontInfo:this.fontInfo},s=[];return this.notebookMetadataViewModel=this._register(new AOe(this.model.original.notebook,this.model.modified.notebook,t?"modifiedMetadata":"unchangedMetadata",this.eventDispatcher,r,this.notebookService,this.diffEditorHeightCalculator)),this.ignoreMetadata||(t&&await this.notebookMetadataViewModel.computeHeights(),s.push(this.notebookMetadataViewModel)),(await Promise.all(e.map(async c=>{switch(c.type){case"delete":return new mrt(o,n,o.cells[c.originalCellIndex],void 0,"delete",this.eventDispatcher,r,this.notebookService,this.configurationService,this.diffEditorHeightCalculator,c.originalCellIndex);case"insert":return new mrt(n,o,void 0,n.cells[c.modifiedCellIndex],"insert",this.eventDispatcher,r,this.notebookService,this.configurationService,this.diffEditorHeightCalculator,c.modifiedCellIndex);case"modified":{let u=new uk(this.model.modified.notebook,this.model.original.notebook,o.cells[c.originalCellIndex],n.cells[c.modifiedCellIndex],"modified",this.eventDispatcher,r,this.notebookService,this.configurationService,c.originalCellIndex,this.diffEditorHeightCalculator);return await u.computeEditorHeights(),u}case"unchanged":return new uk(this.model.modified.notebook,this.model.original.notebook,o.cells[c.originalCellIndex],n.cells[c.modifiedCellIndex],"unchanged",this.eventDispatcher,r,this.notebookService,this.configurationService,c.originalCellIndex,this.diffEditorHeightCalculator)}}))).forEach(c=>s.push(c)),s}};function tln(a,i,e){let t=e.changes;for(let o=0;o<e.changes.length-1;o++){let n=t[o],r=t[o+1],s=n.originalStart,l=n.modifiedStart;n.originalLength===1&&n.modifiedLength===0&&r.originalStart===s+2&&r.originalLength===0&&r.modifiedStart===l+1&&r.modifiedLength===1&&a.cells[s].getHashValue()===i.cells[l+1].getHashValue()&&a.cells[s+1].getHashValue()===i.cells[l].getHashValue()&&(n.originalStart=s,n.originalLength=0,n.modifiedStart=l,n.modifiedLength=1,r.originalStart=s+1,r.originalLength=1,r.modifiedStart=l+2,r.modifiedLength=0,o++)}}function iln(a,i,e){if(a.length!==i.length)return!1;let t=e.original.notebook,o=e.modified.notebook;for(let n=0;n<i.length;n++){let r=a[n],s=i[n];if(r.type!==s.type)return!1;switch(r.type){case"delete":{if(t.cells[r.originalCellIndex].handle!==s.original?.handle)return!1;continue}case"insert":{if(o.cells[r.modifiedCellIndex].handle!==s.modified?.handle)return!1;continue}default:{if(t.cells[r.originalCellIndex].handle!==s.original?.handle||o.cells[r.modifiedCellIndex].handle!==s.modified?.handle)return!1;continue}}}return!0}var frt=class extends wE{constructor(e,t,o,n,r,s,l){super(e,t,o,void 0,l);this.type=n;this.containerType=r;this.kind=s}},Sfe=class extends frt{constructor(i,e,t,o){super(i,e,e||i,t,o,"Cell",{[zQ.key]:"Cell",[KQ.key]:t})}},aoe=class extends frt{constructor(i,e,t,o){super(i,e,e||i,t,o,"Metadata",{[zQ.key]:"Metadata",[KQ.key]:t})}},loe=class extends frt{constructor(i,e,t,o){super(i,e,e||i,t,o,"Output",{[zQ.key]:"Output",[KQ.key]:t})}};var coe=class{constructor(i,e,t,o){this.lineHeight=i;this.textModelResolverService=e;this.editorWorkerService=t;this.configurationService=o}async diffAndComputeHeight(i,e){let[t,o]=await Promise.all([this.textModelResolverService.createModelReference(i),this.textModelResolverService.createModelReference(e)]);try{let n=await this.editorWorkerService.computeDiff(i,e,{ignoreTrimWhitespace:!0,maxComputationTimeMs:0,computeMoves:!1},"advanced").then(y=>y?.changes||[]),r=this.configurationService.getValue("diffEditor.hideUnchangedRegions.enabled"),s=this.configurationService.getValue("diffEditor.hideUnchangedRegions.minimumLineCount"),l=this.configurationService.getValue("diffEditor.hideUnchangedRegions.contextLineCount"),c=t.object.textEditorModel.getLineCount(),u=o.object.textEditorModel.getLineCount(),p=r?jX.fromDiffs(n,c,u,s??3,l??3):[],h=n.reduce((y,w)=>w.original.isEmpty&&!w.modified.isEmpty?y+w.modified.length:!w.original.isEmpty&&!w.modified.isEmpty&&w.modified.length>w.original.length?y+w.modified.length-w.original.length:y,0),g=t.object.textEditorModel.getLineCount(),f=p.reduce((y,w)=>y+w.lineCount,0),b=p.length*Yyo,S=g+h-f;return S*this.lineHeight+aO(S).top+aO(S).bottom+b}finally{t.dispose(),o.dispose()}}computeHeightFromLines(i){return i*this.lineHeight+aO(i).top+aO(i).bottom}};coe=I([m(1,Bt),m(2,Qs),m(3,B)],coe);var V2t=le("INotebookOriginalCellModelFactory"),vrt=class extends ix{constructor(e,t){super();this.modelService=e;this._languageService=t}createReferencedObject(e,t,o,n,r){let s=`${t.scheme}-chat-edit`,l=A.from({scheme:s,fragment:t.fragment,path:t.path}),c=this._languageService.getLanguageIdByLanguageName(n)?this._languageService.createById(n):r===1?this._languageService.createById("markdown"):null;return this.modelService.createModel(o,c,l)}destroyReferencedObject(e,t){t.dispose()}};vrt=I([m(0,_t),m(1,Rt)],vrt);var zOe=class{constructor(i){this._data=i.createInstance(vrt)}getOrCreate(i,e,t,o){return this._data.acquire(i.toString(),i,e,t,o)}};zOe=I([m(0,F)],zOe);var KOe=class extends O{constructor(e,t,o,n,r,s){super();this.modifiedCell=t;this.originalCell=o;this.editor=n;this._editorWorkerService=r;this.originalCellModelFactory=s;this._viewZones=[];this.throttledDecorator=this.add(new Aa(50));this.perEditorDisposables=this.add(new O);let l=vi(e.onDidChangeVisibleRanges,()=>e.visibleRanges),c=ke(u=>{if(!l.read(u).map(f=>e.getCellsInRange(f)).flat().map(f=>f.handle).includes(t.handle))return;let g=e.codeEditors.find(f=>f[0].handle===t.handle)?.[1];if(g?.getModel()===this.modifiedCell.textModel)return g});this.add(Rl((u,p)=>{let h=c.read(u);this.perEditorDisposables.clear(),h&&(p.add(h.onDidChangeModel(()=>{this.perEditorDisposables.clear()})),p.add(h.onDidChangeModelContent(()=>{this.update(h)})),p.add(h.onDidChangeConfiguration(g=>{(g.hasChanged(59)||g.hasChanged(75))&&this.update(h)})),this.update(h))}))}update(e){this.throttledDecorator.trigger(()=>this._updateImpl(e))}async _updateImpl(e){if(this.isDisposed)return;if(e.getOption(70)){this.perEditorDisposables.clear();return}let t=e.getModel();if(!t||t!==this.modifiedCell.textModel){this.perEditorDisposables.clear();return}let o=this.getOrCreateOriginalModel(e);if(!o){this.perEditorDisposables.clear();return}let n=t.getVersionId(),r=await this._editorWorkerService.computeDiff(o.uri,t.uri,{computeMoves:!0,ignoreTrimWhitespace:!1,maxComputationTimeMs:Number.MAX_SAFE_INTEGER},"advanced");this.isDisposed||(r&&!r.identical&&this.modifiedCell.textModel&&o&&t===e.getModel()&&e.getModel()?.getVersionId()===n?this._updateWithDiff(e,o,r,this.modifiedCell.textModel):this.perEditorDisposables.clear())}getOrCreateOriginalModel(e){if(!this._originalModel){let t=e.getModel();if(!t)return;this._originalModel=this.add(this.originalCellModelFactory.getOrCreate(t.uri,this.originalCell.getValue(),t.getLanguageId(),this.modifiedCell.cellKind)).object}return this._originalModel}_updateWithDiff(e,t,o,n){if(oln(o,this.diffForPreviouslyAppliedDecorators))return;this.perEditorDisposables.clear();let r=e.createDecorationsCollection();this.perEditorDisposables.add(ee(()=>{e.changeViewZones(g=>{for(let f of this._viewZones)g.removeZone(f)}),this._viewZones=[],r.clear(),this.diffForPreviouslyAppliedDecorators=void 0})),this.diffForPreviouslyAppliedDecorators=o;let s=So.createDynamic({...Mde,stickiness:1}),l=So.createDynamic({...Mke,stickiness:1}),c=(g,f)=>So.createDynamic({description:"chat-editing-decoration",overviewRuler:{color:wp(g),position:1},minimap:{color:wp(f),position:2}}),u=c(ZZ,WDe),p=c(eee,VDe),h=c(tee,BDe);e.changeViewZones(g=>{for(let w of this._viewZones)g.removeZone(w);this._viewZones=[];let f=[],v=t.mightContainNonBasicASCII(),b=t.mightContainRTL(),S=NT.fromEditor(this.editor),y=n.getLineCount();for(let w of o.changes){let x=w.original;t.tokenization.forceTokenization(Math.max(1,x.endLineNumberExclusive-1));let E=new AT(x.mapToLineArray(K=>t.tokenization.getLineTokens(K)),[],v,b),M=[];for(let K of w.innerChanges||[])M.push(new wT(K.originalRange.delta(-(w.original.startLineNumber-1)),c4.className,0)),!(K.originalRange.isEmpty()&&K.originalRange.startLineNumber===1&&K.modifiedRange.endLineNumber===y)&&!K.modifiedRange.isEmpty()&&f.push({range:K.modifiedRange,options:s});let N=M.length===1&&M[0].range.isEmpty()&&w.original.startLineNumber===1;!w.modified.isEmpty&&!(N&&w.modified.endLineNumberExclusive-1===y)&&f.push({range:w.modified.toInclusiveRange(),options:l}),w.original.isEmpty?f.push({range:w.modified.toInclusiveRange(),options:p}):w.modified.isEmpty?f.push({range:new G(w.modified.startLineNumber-1,1,w.modified.startLineNumber,1),options:h}):f.push({range:w.modified.toInclusiveRange(),options:u});let V=document.createElement("div");V.className="chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text";let H=oM(E,S,M,V);if(!N){let K={afterLineNumber:w.modified.startLineNumber-1,heightInLines:H.heightInLines,domNode:V,ordinal:50002};this._viewZones.push(g.addZone(K))}}r.set(f)})}};KOe=I([m(4,Qs),m(5,V2t)],KOe);function oln(a,i){return a&&i?!(a.changes.length!==i.changes.length||a.moves.length!==i.moves.length||!ewo(a.changes,i.changes)||!a.moves.some((e,t)=>{let o=i.moves[t];return!ewo(e.changes,o.changes)||e.lineRangeMapping.changedLineCount!==o.lineRangeMapping.changedLineCount||!e.lineRangeMapping.modified.equals(o.lineRangeMapping.modified)||!e.lineRangeMapping.original.equals(o.lineRangeMapping.original)})):!a&&!i}function ewo(a,i){return!(a.length!==i.length||a.some((e,t)=>{let o=i[t];return!!(e.changedLineCount!==o.changedLineCount||(e.innerChanges||[]).length!==(o.innerChanges||[]).length||(e.innerChanges||[]).some((n,r)=>{let s=o.innerChanges[r];return!n.modifiedRange.equalsRange(s.modifiedRange)||!n.originalRange.equalsRange(s.originalRange)}))}))}var nln=zf("notebookRenderer",{createHTML:a=>a}),doe=class extends k{constructor(e,t,o,n){super();this._notebookEditor=e;this.toolbar=t;this.languageService=o;this.instantiationService=n;this.zoneRemover=this._register(new O);this.createdViewZones=new Map;this.deletedCellInfos=new Map}getTop(e){let t=this.deletedCellInfos.get(e);if(!t)return;if(t.previousIndex===-1)return 0;let o=this._notebookEditor.getCellsInRange({start:t.previousIndex,end:t.previousIndex+1});if(!o.length)return this._notebookEditor.getLayoutInfo().height+t.offset;let n=o[0],r=this._notebookEditor.getHeightOfElement(n);return this._notebookEditor.getAbsoluteTopOfElement(n)+r+t.offset}reveal(e){let t=this.getTop(e);if(typeof t=="number"){this._notebookEditor.focusContainer(),this._notebookEditor.revealOffsetInCenterIfOutsideViewport(t);let o=this.deletedCellInfos.get(e);if(o){let n=o.previousIndex===-1?0:o.previousIndex;this._notebookEditor.setFocus({start:n,end:n}),this._notebookEditor.setSelections([{start:n,end:n}])}}}apply(e,t){this.clear();let o=-1,n={cells:[],index:0};e.forEach(r=>{if(r.type==="delete"){let s=t.cells[r.originalCellIndex];s&&(n.cells.push({cell:s,originalIndex:r.originalCellIndex,previousIndex:o}),n.index=o)}else n.cells.length&&(this._createWidget(n.index+1,n.cells),n.cells.length=0),o=r.modifiedCellIndex}),n.cells.length&&this._createWidget(n.index+1,n.cells)}clear(){this.deletedCellInfos.clear(),this.zoneRemover.clear()}_createWidget(e,t){this._createWidgetImpl(e,t)}async _createWidgetImpl(e,t){let o=document.createElement("div"),n=[],r=await Promise.all(t.map(async l=>{let c=new brt(this._notebookEditor,this.toolbar,l.cell.getValue(),l.cell.language,o,l.originalIndex,this.languageService,this.instantiationService);n.push(c);let u=await c.render();return this.deletedCellInfos.set(l.originalIndex,{height:u,previousIndex:l.previousIndex,offset:0}),u}));Array.from(this.deletedCellInfos.keys()).sort((l,c)=>l-c).forEach(l=>{let c=this.deletedCellInfos.get(l-1);if(c){let u=this.deletedCellInfos.get(l);u&&(u.offset=c.height+c.offset)}});let s=r.reduce((l,c)=>l+c,0);this._notebookEditor.changeViewZones(l=>{let c={afterModelPosition:e,heightInPx:s+4,domNode:o},u=l.addZone(c);l.layoutZone(u),this.createdViewZones.set(e,u);let p=this._notebookEditor.deltaCellDecorations([],[{viewZoneId:u,options:{overviewRuler:{color:tee,position:2}}}]);this.zoneRemover.add(ee(()=>{this.createdViewZones.get(e)===u&&this.createdViewZones.delete(e),this._notebookEditor.isDisposed||(this._notebookEditor.changeViewZones(h=>{h.removeZone(u),je(n)}),this._notebookEditor.deltaCellDecorations(p,[]))}))})}};doe=I([m(2,Rt),m(3,F)],doe);var brt=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._notebookEditor=e;this._toolbarOptions=t;this.code=o;this.language=n;this._originalIndex=s;this.languageService=l;this.instantiationService=c;this.container=D(r,document.createElement("div")),this._register(ee(()=>{r.removeChild(this.container)}))}async render(){let e=this.code,t=this.language,o=await EK(this.languageService,e,t),n=this._notebookEditor.getBaseCellEditorOptions(t).value,r="--notebook-editor-font-family",s="--notebook-editor-font-size",l="--notebook-editor-font-weight",u=this._notebookEditor.codeEditors.map(E=>E[1]).find(E=>E)?.getOptions().get(165),p=`font-family: var(${r});font-weight: var(${l});font-size: var(${s});`+n.lineHeight?`line-height: ${n.lineHeight}px;`:""+u?.contentLeft?`margin-left: ${u}px;`:"white-space: pre;",h=this.container;if(h.classList.add("code-cell-row"),this._toolbarOptions){let E=document.createElement("div");E.className=this._toolbarOptions.className,h.appendChild(E);let N=this._register(this.instantiationService.createChild(new Po([X,this._notebookEditor.scopedContextKeyService]))).createInstance(pr,E,this._toolbarOptions.menuId,{telemetrySource:this._toolbarOptions.telemetrySource,hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{renderShortTitle:!0,arg:this._toolbarOptions.argFactory(this._originalIndex)},actionViewItemProvider:this._toolbarOptions.actionViewItemProvider});this._store.add(N),E.style.position="absolute",E.style.right="40px",E.style.zIndex="10",E.classList.add("hover")}let g=D(h,_(".cell-inner-container"));g.style.position="relative";let f=D(g,_(".cell-focus-indicator.cell-focus-indicator-side.cell-focus-indicator-left")),v=D(g,_(".cell.code"));D(f,_("div.execution-count-label"));let b=D(v,_(".cell-editor-part")),S=D(b,_(".cell-editor-container"));return S=D(S,_(".code",{style:p})),n.fontFamily&&S.style.setProperty(r,n.fontFamily),n.fontSize&&S.style.setProperty(s,`${n.fontSize}px`),n.fontWeight&&S.style.setProperty(l,n.fontWeight),S.innerHTML=nln?.createHTML(o)||o,Hc(e).length*(n.lineHeight||Xyo)+12+12+16+16}};brt=I([m(6,Rt),m(7,F)],brt);var GOe=class extends k{constructor(e){super();this.notebookEditor=e;this.decorators=this._register(new O)}apply(e){let t=this.notebookEditor.textModel;if(!t)return;let o=e.filter(r=>r.type==="insert").map(r=>t.cells[r.modifiedCellIndex]),n=this.notebookEditor.deltaCellDecorations([],o.map(r=>({handle:r.handle,options:{className:"nb-insertHighlight",outputClassName:"nb-insertHighlight",overviewRuler:{color:eee,modelRanges:[],includeOutput:!0,position:7}}})));this.clear(),this.decorators.add(ee(()=>{this.notebookEditor.isDisposed||this.notebookEditor.deltaCellDecorations(n,[])}))}clear(){this.decorators.clear()}};var two=le("INotebookOriginalModelReferenceFactory"),Srt=class extends ix{constructor(e,t){super();this.notebookService=e;this.modelService=t;this.modelsToDispose=new Set}async createReferencedObject(e,t,o){this.modelsToDispose.delete(e);let n=t.originalURI,r=this.notebookService.getNotebookTextModel(n);if(r)return r;let s=await this.modelService.createModelReference(n),l=Ke.fromString(s.object.textEditorModel.getValue()),c=lD(l);return s.dispose(),this.notebookService.createNotebookTextModel(o,n,c)}destroyReferencedObject(e,t){this.modelsToDispose.add(e),(async()=>{try{let o=await t;if(!this.modelsToDispose.has(e))return;o.dispose()}catch{}finally{this.modelsToDispose.delete(e)}})()}};Srt=I([m(0,kn),m(1,Bt)],Srt);var qOe=class{constructor(i){this.instantiationService=i;this._resourceModelCollection=void 0;this._asyncModelCollection=void 0}get resourceModelCollection(){return this._resourceModelCollection||(this._resourceModelCollection=this.instantiationService.createInstance(Srt)),this._resourceModelCollection}get asyncModelCollection(){return this._asyncModelCollection||(this._asyncModelCollection=new Vye(this.resourceModelCollection)),this._asyncModelCollection}getOrCreate(i,e){return this.asyncModelCollection.acquire(i.originalURI.toString(),i,e)}};qOe=I([m(0,F)],qOe);var uoe=class extends k{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookEditorWorkerService=t;this.instantiationService=o;this.logService=n;this.cellDecorators=new Map;this.listeners=[];this.logService.debug("inlineDiff","Watching for previous model"),this._register(ve(r=>{this.previous=this.notebookEditor.notebookOptions.previousModelToCompare.read(r),this.previous&&(this.logService.debug("inlineDiff","Previous model set"),this.notebookEditor.hasModel()?this.initialize():(this.logService.debug("inlineDiff","Waiting for model to attach"),this.listeners.push(U.once(this.notebookEditor.onDidAttachViewModel)(()=>this.initialize()))))}))}static{this.ID="workbench.notebook.inlineDiffDecoration"}clear(){this.listeners.forEach(e=>e.dispose()),this.cellDecorators.forEach((e,t)=>{e.dispose(),this.cellDecorators.delete(t)}),this.insertedCellDecorator?.dispose(),this.deletedCellDecorator?.dispose(),this.cachedNotebookDiff=void 0,this.listeners=[],this.logService.debug("inlineDiff","Cleared decorations and listeners")}dispose(){this.logService.debug("inlineDiff","Disposing"),this.clear(),super.dispose()}initialize(){if(this.clear(),!this.previous)return;this.insertedCellDecorator=this.instantiationService.createInstance(GOe,this.notebookEditor),this.deletedCellDecorator=this.instantiationService.createInstance(doe,this.notebookEditor,void 0),this._update();let e=U.debounce(this.notebookEditor.onDidChangeVisibleRanges,t=>t,100,void 0,void 0,void 0,this._store);if(this.listeners.push(e(()=>this._update())),this.listeners.push(this.notebookEditor.onDidChangeModel(()=>this._update())),this.notebookEditor.textModel){let t=U.debounce(this.notebookEditor.textModel.onDidChangeContent,(n,r)=>r,100,void 0,void 0,void 0,this._store),o=U.debounce(this.previous.onDidChangeContent,(n,r)=>r,100,void 0,void 0,void 0,this._store);this.listeners.push(t(()=>this._update())),this.listeners.push(o(()=>this._update()))}this.logService.debug("inlineDiff","Initialized")}async _update(){let e=this.notebookEditor.getViewModel()?.notebookDocument;if(!this.previous||!e){this.logService.debug("inlineDiff","Update skipped - no original or current document");return}if(!this.cachedNotebookDiff||this.cachedNotebookDiff.originalVersion!==this.previous.versionId||this.cachedNotebookDiff.version!==e.versionId){let t={cellDiffInfo:[]};try{let o=await this.notebookEditorWorkerService.computeDiff(this.previous.uri,e.uri);t=HOe(this.previous,e,o)}catch(o){this.logService.error("inlineDiff",`Error computing diff:
`+o);return}this.cachedNotebookDiff={cellDiffInfo:t.cellDiffInfo,originalVersion:this.previous.versionId,version:e.versionId},this.insertedCellDecorator?.apply(t.cellDiffInfo),this.deletedCellDecorator?.apply(t.cellDiffInfo,this.previous)}await this.updateCells(this.previous,e,this.cachedNotebookDiff.cellDiffInfo)}async updateCells(e,t,o){let n=new Set;o.forEach(r=>{if(r.type==="modified"){let s=t.cells[r.modifiedCellIndex],l=e.cells[r.originalCellIndex],c=this.notebookEditor.codeEditors.find(([u])=>u.handle===s.handle)?.[1];if(c){let u=this.cellDecorators.get(s);if(u?.modifiedCell!==s||u?.originalCell!==l){u?.dispose();let p=this.instantiationService.createInstance(KOe,this.notebookEditor,s,l,c);this.cellDecorators.set(s,p),n.add(p),this._register(c.onDidDispose(()=>{p.dispose(),this.cellDecorators.get(s)===p&&this.cellDecorators.delete(s)}))}else u&&n.add(u)}}}),this.cellDecorators.forEach((r,s)=>{n.has(r)||(r.dispose(),this.cellDecorators.delete(s))})}};uoe=I([m(1,Mq),m(2,F),m(3,Sb)],uoe);Hm(uoe.ID,uoe);Ce(two,qOe,1);Ce(V2t,zOe,1);var $Oe=class extends k{constructor(e,t,o,n,r,s,l){super();this.rootElement=e;this.groupId=t;this.window=o;this.options=n;this.dimension=r;this.instantiationService=s;this.widgetService=l;this.widget={value:void 0}}get editorWidget(){return this.widget.value}async show(e,t,o,n){this.widget.value||this.createNotebookWidget(e,this.groupId,this.rootElement),this.dimension&&this.widget.value?.layout(this.dimension,this.rootElement,this.position),t&&(await this.widget.value?.setOptions({...n}),this.widget.value?.notebookOptions.previousModelToCompare.set(o,void 0),await this.widget.value.setModel(t,n?.viewState))}hide(){this.widget.value&&(this.widget.value.notebookOptions.previousModelToCompare.set(void 0,void 0),this.widget.value.onWillHide())}setLayout(e,t){this.dimension=e,this.position=t}createNotebookWidget(e,t,o){let n=OQ.getSomeEditorContributions([uoe.ID]),r={notebookToolbar:R.NotebookToolbar,cellTitleToolbar:R.NotebookCellTitle,cellDeleteToolbar:R.NotebookCellDelete,cellInsertToolbar:R.NotebookCellBetween,cellTopInsertToolbar:R.NotebookCellListTop,cellExecuteToolbar:R.NotebookCellExecute,cellExecutePrimary:void 0},s=["editor.contrib.review","editor.contrib.floatingClickMenu","editor.contrib.dirtydiff","editor.contrib.testingOutputPeek","editor.contrib.testingDecorations","store.contrib.stickyScrollController","editor.contrib.findController","editor.contrib.emptyTextEditorHint"],l=ml.getEditorContributions().filter(c=>s.indexOf(c.id)===-1);this.widget=this.instantiationService.invokeFunction(this.widgetService.retrieveWidget,t,e,{contributions:n,menuIds:r,cellEditorContributions:l,options:this.options},this.dimension,this.window),this.rootElement&&this.widget.value.getDomNode()&&(this.rootElement.setAttribute("aria-flowto",this.widget.value.getDomNode().id||""),AL(this.widget.value.getDomNode(),this.rootElement))}dispose(){super.dispose(),this.widget.value&&this.widget.value.dispose()}};$Oe=I([m(5,F),m(6,hd)],$Oe);var rln=_,cMi=class a{constructor(i){this.selections=i}compare(i){if(!(i instanceof a))return 3;if(this.selections.length!==i.selections.length)return 3;for(let e=0;e<this.selections.length;e++)if(this.selections[e]!==i.selections[e])return 3;return 1}restore(i){let e={cellSelections:wpe(this.selections)};return Object.assign(e,i),e}},Oh=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p){super(Oh.ID,e,l,o,c);this.instantiationService=t;this.contextKeyService=n;this.notebookEditorWorkerService=r;this.configurationService=s;this.notebookService=u;this.editorService=p;this.creationOptions=roe();this._dimension=void 0;this._modifiedWebview=null;this._originalWebview=null;this._webviewTransparentCover=null;this._inlineView=!1;this._onMouseUp=this._register(new T);this.onMouseUp=this._onMouseUp.event;this._onDidScroll=this._register(new T);this.onDidScroll=this._onDidScroll.event;this.onDidChangeScroll=this._onDidScroll.event;this._model=null;this._modifiedResourceDisposableStore=this._register(new O);this._insetModifyQueueByOutputId=new II;this._onDidDynamicOutputRendered=this._register(new T);this.onDidDynamicOutputRendered=this._onDidDynamicOutputRendered.event;this._localStore=this._register(new O);this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._isDisposed=!1;this._currentChangedIndex=De(this,-1);this.currentChangedIndex=this._currentChangedIndex;this.pendingLayouts=new WeakMap;this.diffEditorCalcuator=this.instantiationService.createInstance(coe,this.fontInfo.lineHeight),this._notebookOptions=t.createInstance(P_,this.window,!1,void 0),this._register(this._notebookOptions),this._revealFirst=!0}static{this.ENTIRE_DIFF_OVERVIEW_WIDTH=30}static{this.ID=oZ}get textModel(){return this._model?.modified.notebook}get inlineNotebookEditor(){if(this._inlineView)return this.inlineDiffWidget?.editorWidget}get notebookOptions(){return this._notebookOptions}get isDisposed(){return this._isDisposed}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}createFontInfo(){let e=this.configurationService.getValue("editor");return zw.readFontInfo(this.window,RI(e,Gu.getInstance(this.window).value))}isOverviewRulerEnabled(){return this.configurationService.getValue(Ct.diffOverviewRuler)??!1}getSelection(){let e=this._list.getFocus();return new cMi(e)}toggleNotebookCellSelection(e){}updatePerformanceMetadata(e,t,o,n){}async focusNotebookCell(e,t){}async focusNextNotebookCell(e,t){}didFocusOutputInputChange(e){}getScrollTop(){return this._list?.scrollTop??0}getScrollHeight(){return this._list?.scrollHeight??0}getScrollPosition(){return{scrollTop:this.getScrollTop(),scrollLeft:this._list?.scrollLeft??0}}setScrollPosition(e){this._list&&(this._list.scrollTop=e.scrollTop,e.scrollLeft!==void 0&&(this._list.scrollLeft=e.scrollLeft))}delegateVerticalScrollbarPointerDown(e){this._list?.delegateVerticalScrollbarPointerDown(e)}updateOutputHeight(e,t,o,n){let r=e.diffElement,s=this.getCellByInfo(e),l=s.outputsViewModels.indexOf(t);if(r instanceof uk){let c=sn.parse(e.cellUri);if(!c)return;r.updateOutputHeight(c.notebook.toString()===this._model?.original.resource.toString()?0:1,l,o)}else r.updateOutputHeight(r.type==="insert"?1:0,l,o);n&&this._onDidDynamicOutputRendered.fire({cell:s,output:t})}setMarkupCellEditState(e,t){}didStartDragMarkupCell(e,t){}didDragMarkupCell(e,t){}didEndDragMarkupCell(e){}didDropMarkupCell(e){}didResizeOutput(e){}async toggleInlineView(){this._layoutCancellationTokenSource?.dispose(),this._inlineView=!this._inlineView,this._lastLayoutProperties&&(this._inlineView?(this.layout(this._lastLayoutProperties?.dimension,this._lastLayoutProperties?.position),this.inlineDiffWidget?.show(this.input,this._model?.modified.notebook,this._model?.original.notebook,this._options)):(this.layout(this._lastLayoutProperties?.dimension,this._lastLayoutProperties?.position),this.inlineDiffWidget?.hide()),this._layoutCancellationTokenSource=new qe,this.updateLayout(this._layoutCancellationTokenSource.token))}createEditor(e){this._rootElement=D(e,_(".notebook-text-diff-editor")),this._overflowContainer=document.createElement("div"),this._overflowContainer.classList.add("notebook-overflow-widget-container","monaco-editor"),D(e,this._overflowContainer);let t=[this.instantiationService.createInstance(QQ,this),this.instantiationService.createInstance(YQ,this),this.instantiationService.createInstance($Q,this),this.instantiationService.createInstance(jQ,this)];this._listViewContainer=D(this._rootElement,_(".notebook-diff-list-view")),this._list=this.instantiationService.createInstance(VOe,"NotebookTextDiff",this._listViewContainer,this.instantiationService.createInstance(WOe,this.window),t,this.contextKeyService,{setRowLineHeight:!1,setRowHeight:!1,supportDynamicHeights:!0,horizontalScrolling:!1,keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1,typeNavigationEnabled:!0,paddingBottom:0,styleController:o=>this._list,overrideStyles:{listBackground:Bo,listActiveSelectionBackground:Bo,listActiveSelectionForeground:xo,listFocusAndSelectionBackground:Bo,listFocusAndSelectionForeground:xo,listFocusBackground:Bo,listFocusForeground:xo,listHoverForeground:xo,listHoverBackground:Bo,listHoverOutline:Kc,listFocusOutline:Kc,listInactiveSelectionBackground:Bo,listInactiveSelectionForeground:xo,listInactiveFocusBackground:Bo,listInactiveFocusOutline:Bo},accessibilityProvider:{getAriaLabel(){return null},getWidgetAriaLabel(){return d(13735,null)}}}),this.inlineDiffWidget=this._register(this.instantiationService.createInstance($Oe,this._rootElement,this.group.id,this.window,this.notebookOptions,this._dimension)),this._register(this._list),this._register(this._list.onMouseUp(o=>{o.element&&(typeof o.index=="number"&&this._list.setFocus([o.index]),this._onMouseUp.fire({event:o.browserEvent,target:o.element}))})),this._register(this._list.onDidScroll(()=>{this._onDidScroll.fire()})),this._register(this._list.onDidChangeFocus(()=>this._onDidChangeSelection.fire({reason:2}))),this._overviewRulerContainer=document.createElement("div"),this._overviewRulerContainer.classList.add("notebook-overview-ruler-container"),this._rootElement.appendChild(this._overviewRulerContainer),this._registerOverviewRuler(),this._webviewTransparentCover=D(this._list.rowsContainer,rln(".webview-cover")),this._webviewTransparentCover.style.display="none",this._register(Rwe(this._overflowContainer,o=>{o.target.classList.contains("slider")&&this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="block")})),this._register(Abt(this._overflowContainer,()=>{this._webviewTransparentCover&&(this._webviewTransparentCover.style.display="none")})),this._register(this._list.onDidScroll(o=>{this._webviewTransparentCover.style.top=`${o.scrollTop}px`}))}_registerOverviewRuler(){this._overviewRuler=this._register(this.instantiationService.createInstance(BOe,this,Oh.ENTIRE_DIFF_OVERVIEW_WIDTH,this._overviewRulerContainer))}_updateOutputsOffsetsInWebview(e,t,o,n,r){if(o.element.style.height=`${t}px`,o.insetMapping){let s=[],l=[];o.insetMapping.forEach((c,u)=>{let p=n(c.cellInfo.diffElement);if(!(!p||this._list.indexOf(c.cellInfo.diffElement)===void 0))if(p.outputsViewModels.indexOf(u)<0)l.push(u);else{let g=this._list.getCellViewScrollTop(c.cellInfo.diffElement),f=p.outputsViewModels.indexOf(u),v=c.cellInfo.diffElement.getOutputOffsetInCell(r,f);s.push({cell:p,output:u,cellTop:g,outputOffset:v,forceDisplay:!1})}}),o.removeInsets(l),s.length&&o.updateScrollTops(s,[])}}async setInput(e,t,o,n){this.inlineDiffWidget?.hide(),await super.setInput(e,t,o,n);let r=await e.resolve();this._model!==r&&(this._detachModel(),this._attachModel(r)),this._model=r,this._model!==null&&(this._inlineView?(this._listViewContainer.style.display="none",this.inlineDiffWidget?.show(e,r.modified.notebook,r.original.notebook,t)):(this._listViewContainer.style.display="block",this.inlineDiffWidget?.hide()),this._revealFirst=!0,this._modifiedResourceDisposableStore.clear(),this._layoutCancellationTokenSource=new qe,this._modifiedResourceDisposableStore.add(U.any(this._model.original.notebook.onDidChangeContent,this._model.modified.notebook.onDidChangeContent)(s=>{this._model!==null&&this.editorService.activeEditor!==e&&(this._layoutCancellationTokenSource?.dispose(),this._layoutCancellationTokenSource=new qe,this.updateLayout(this._layoutCancellationTokenSource.token))})),await this._createOriginalWebview(ht(),this._model.original.viewType,this._model.original.resource),this._originalWebview&&this._modifiedResourceDisposableStore.add(this._originalWebview),await this._createModifiedWebview(ht(),this._model.modified.viewType,this._model.modified.resource),this._modifiedWebview&&this._modifiedResourceDisposableStore.add(this._modifiedWebview),await this.updateLayout(this._layoutCancellationTokenSource.token,t?.cellSelections?yv(t.cellSelections):void 0))}setVisible(e){super.setVisible(e),e||this.inlineDiffWidget?.hide()}_detachModel(){this._localStore.clear(),this._originalWebview?.dispose(),this._originalWebview?.element.remove(),this._originalWebview=null,this._modifiedWebview?.dispose(),this._modifiedWebview?.element.remove(),this._modifiedWebview=null,this.notebookDiffViewModel?.dispose(),this.notebookDiffViewModel=void 0,this._modifiedResourceDisposableStore.clear(),this._list.clear()}_attachModel(e){this._model=e,this._eventDispatcher=new POe;let t=()=>{kr(this.window,()=>{this._isDisposed||(this._modifiedWebview&&this._updateOutputsOffsetsInWebview(this._list.scrollTop,this._list.scrollHeight,this._modifiedWebview,n=>n.modified,1),this._originalWebview&&this._updateOutputsOffsetsInWebview(this._list.scrollTop,this._list.scrollHeight,this._originalWebview,n=>n.original,0))})};this._localStore.add(this._list.onDidChangeContentHeight(()=>{t()})),this._localStore.add(this._list.onDidChangeFocus(n=>{if(n.indexes.length&&this.notebookDiffViewModel&&n.indexes[0]<this.notebookDiffViewModel.items.length){let r=this.notebookDiffViewModel.items[n.indexes[0]],s=this.notebookDiffViewModel.items.filter(l=>l.type!=="unchanged"&&l.type!=="unchangedMetadata"&&l.type!=="placeholder");if(r&&r?.type!=="placeholder"&&r?.type!=="unchanged"&&r?.type!=="unchangedMetadata")return this._currentChangedIndex.set(s.indexOf(r),void 0)}return this._currentChangedIndex.set(-1,void 0)})),this._localStore.add(this._eventDispatcher.onDidChangeCellLayout(()=>{t()}));let o=this.notebookDiffViewModel=this._register(new UOe(this._model,this.notebookEditorWorkerService,this.configurationService,this._eventDispatcher,this.notebookService,this.diffEditorCalcuator,this.fontInfo,void 0));this._localStore.add(this.notebookDiffViewModel.onDidChangeItems(n=>{this._originalWebview?.removeInsets([...this._originalWebview?.insetMapping.keys()]),this._modifiedWebview?.removeInsets([...this._modifiedWebview?.insetMapping.keys()]),this._revealFirst&&typeof n.firstChangeIndex=="number"&&n.firstChangeIndex>-1&&n.firstChangeIndex<this._list.length&&(this._revealFirst=!1,this._list.setFocus([n.firstChangeIndex]),this._list.reveal(n.firstChangeIndex,.3)),this._list.splice(n.start,n.deleteCount,n.elements),this.isOverviewRulerEnabled()&&this._overviewRuler.updateViewModels(o.items,this._eventDispatcher)}))}async _createModifiedWebview(e,t,o){this._modifiedWebview?.dispose(),this._modifiedWebview=this.instantiationService.createInstance(sO,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),this._list.rowsContainer.insertAdjacentElement("afterbegin",this._modifiedWebview.element),this._modifiedWebview.createWebview(this.window),this._modifiedWebview.element.style.width="calc(50% - 16px)",this._modifiedWebview.element.style.left="calc(50%)"}_generateFontFamily(){return this.fontInfo.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}async _createOriginalWebview(e,t,o){this._originalWebview?.dispose(),this._originalWebview=this.instantiationService.createInstance(sO,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),this._list.rowsContainer.insertAdjacentElement("afterbegin",this._originalWebview.element),this._originalWebview.createWebview(this.window),this._originalWebview.element.style.width="calc(50% - 16px)",this._originalWebview.element.style.left="16px"}setOptions(e){let t=e?.cellSelections?yv(e.cellSelections):void 0;t&&this._list.setFocus(t)}async updateLayout(e,t){!this._model||!this.notebookDiffViewModel||(await this.notebookDiffViewModel.computeDiff(e),!e.isCancellationRequested&&t&&this._list.setFocus(t))}scheduleOutputHeightAck(e,t,o){let n=e.diffElement,r=0;if(n instanceof uk){let l=sn.parse(e.cellUri);if(!l)return;r=l.notebook.toString()===this._model?.original.resource.toString()?0:1}else r=n.type==="insert"?1:0;let s=r===1?this._modifiedWebview:this._originalWebview;kr(this.window,()=>{s?.ackHeight([{cellId:e.cellId,outputId:t,height:o}])},10)}layoutNotebookCell(e,t){let o=(l,c)=>{this._list.updateElementHeight2(l,c)},n=this.pendingLayouts.get(e);n&&this._localStore.delete(n);let r,s=kr(this.window,()=>{this.pendingLayouts.delete(e),o(e,t),r()});return n=ee(()=>{s.dispose(),r()}),this._localStore.add(n),this.pendingLayouts.set(e,n),new Promise(l=>{r=l})}setScrollTop(e){this._list.scrollTop=e}triggerScroll(e){this._list.triggerScrollFromMouseWheelEvent(e)}firstChange(){if(!this.notebookDiffViewModel)return;let t=this.notebookDiffViewModel.items.findIndex(o=>o.type!=="unchanged"&&o.type!=="unchangedMetadata"&&o.type!=="placeholder");t>=0&&(this._list.setFocus([t]),this._list.reveal(t))}lastChange(){if(!this.notebookDiffViewModel)return;let e=this.notebookDiffViewModel.items,t=e.slice().reverse().find(n=>n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder"),o=t?e.indexOf(t):-1;o>=0&&(this._list.setFocus([o]),this._list.reveal(o))}previousChange(){if(!this.notebookDiffViewModel)return;let e=this._list.getFocus()[0];(isNaN(e)||e<0)&&(e=0);let t=e-1,o=this.notebookDiffViewModel.items;for(;t>=0;){let n=o[t];if(n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder")break;t--}if(t>=0)this._list.setFocus([t]),this._list.reveal(t);else{let n=o.findLastIndex(r=>r.type!=="unchanged"&&r.type!=="unchangedMetadata"&&r.type!=="placeholder");n>=0&&(this._list.setFocus([n]),this._list.reveal(n))}}nextChange(){if(!this.notebookDiffViewModel)return;let e=this._list.getFocus()[0];(isNaN(e)||e<0)&&(e=0);let t=e+1,o=this.notebookDiffViewModel.items;for(;t<o.length;){let n=o[t];if(n.type!=="unchanged"&&n.type!=="unchangedMetadata"&&n.type!=="placeholder")break;t++}if(t<o.length)this._list.setFocus([t]),this._list.reveal(t);else{let n=o.findIndex(r=>r.type!=="unchanged"&&r.type!=="unchangedMetadata"&&r.type!=="placeholder");n>=0&&(this._list.setFocus([n]),this._list.reveal(n))}}createOutput(e,t,o,n,r){this._insetModifyQueueByOutputId.queue(o.source.model.outputId+(r===1?"-right":"left"),async()=>{let s=r===1?this._modifiedWebview:this._originalWebview;if(s)if(s.insetMapping.has(o.source)){let l=this._list.getCellViewScrollTop(e),c=t.outputsViewModels.indexOf(o.source),u=e.getOutputOffsetInCell(r,c);s.updateScrollTops([{cell:t,output:o.source,cellTop:l,outputOffset:u,forceDisplay:!0}],[])}else{let l=this._list.getCellViewScrollTop(e);await s.createOutput({diffElement:e,cellHandle:t.handle,cellId:t.id,cellUri:t.uri},o,l,n())}})}updateMarkupCellHeight(){}getCellByInfo(e){return e.diffElement.getCellByUri(e.cellUri)}getCellById(e){throw new Error("Not implemented")}removeInset(e,t,o,n){this._insetModifyQueueByOutputId.queue(o.model.outputId+(n===1?"-right":"left"),async()=>{let r=n===1?this._modifiedWebview:this._originalWebview;r&&r.insetMapping.has(o)&&r.removeInsets([o])})}showInset(e,t,o,n){this._insetModifyQueueByOutputId.queue(o.model.outputId+(n===1?"-right":"left"),async()=>{let r=n===1?this._modifiedWebview:this._originalWebview;if(!r||!r.insetMapping.has(o))return;let s=this._list.getCellViewScrollTop(e),l=t.outputsViewModels.indexOf(o),c=e.getOutputOffsetInCell(n,l);r.updateScrollTops([{cell:t,output:o,cellTop:s,outputOffset:c,forceDisplay:!0}],[])})}hideInset(e,t,o){this._modifiedWebview?.hideInset(o),this._originalWebview?.hideInset(o)}getDomNode(){return this._rootElement}getOverflowContainerDomNode(){return this._overflowContainer}getControl(){return this}clearInput(){this.inlineDiffWidget?.hide(),super.clearInput(),this._modifiedResourceDisposableStore.clear(),this._list?.splice(0,this._list?.length||0),this._model=null,this.notebookDiffViewModel?.dispose(),this.notebookDiffViewModel=void 0}deltaCellOutputContainerClassNames(e,t,o,n){e===0?this._originalWebview?.deltaCellOutputContainerClassNames(t,o,n):this._modifiedWebview?.deltaCellOutputContainerClassNames(t,o,n)}getLayoutInfo(){if(!this._list)throw new Error("Editor is not initalized successfully");return{width:this._dimension.width,height:this._dimension.height,fontInfo:this.fontInfo,scrollHeight:this._list?.getScrollHeight()??0,stickyHeight:0,listViewOffsetTop:0}}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600);let o=this.isOverviewRulerEnabled();this._dimension=e.with(e.width-(o?Oh.ENTIRE_DIFF_OVERVIEW_WIDTH:0)),this._listViewContainer.style.height=`${e.height}px`,this._listViewContainer.style.width=`${this._dimension.width}px`,this._inlineView?(this._listViewContainer.style.display="none",this.inlineDiffWidget?.setLayout(e,t)):(this.inlineDiffWidget?.hide(),this._listViewContainer.style.display="block",this._list?.layout(this._dimension.height,this._dimension.width),this._modifiedWebview&&(this._modifiedWebview.element.style.width="calc(50% - 16px)",this._modifiedWebview.element.style.left="calc(50%)"),this._originalWebview&&(this._originalWebview.element.style.width="calc(50% - 16px)",this._originalWebview.element.style.left="16px"),this._webviewTransparentCover&&(this._webviewTransparentCover.style.height=`${this._dimension.height}px`,this._webviewTransparentCover.style.width=`${this._dimension.width}px`),o&&this._overviewRuler.layout()),this._lastLayoutProperties={dimension:e,position:t},this._eventDispatcher?.emit([new _2t({width:!0,fontInfo:!0},this.getLayoutInfo())])}dispose(){this._isDisposed=!0,this._layoutCancellationTokenSource?.dispose(),this._detachModel(),super.dispose()}};Oh=I([m(1,F),m(2,Pe),m(3,X),m(4,Mq),m(5,B),m(6,_e),m(7,de),m(8,kn),m(9,ie)],Oh);FE(0,10,"notebook-diff-view-viewport-slider");hs((a,i)=>{let e=a.getColor(t7i);i.addRule(`
	.notebook-text-diff-editor .diagonal-fill {
		background-image: linear-gradient(
			-45deg,
			${e} 12.5%,
			#0000 12.5%, #0000 50%,
			${e} 50%, ${e} 62.5%,
			#0000 62.5%, #0000 100%
		);
		background-size: 8px 8px;
	}
	`),i.addRule(`.notebook-text-diff-editor .cell-body { margin: ${zR}px; }`),i.addRule(`.notebook-text-diff-editor .cell-placeholder-body { margin: ${zR}px 0; }`)});var jOe=class extends k{constructor(i,e,t){super(),this._workerManager=this._register(new dMi(i,e,t))}canComputeDiff(i,e){throw new Error("Method not implemented.")}computeDiff(i,e){return this._workerManager.withWorker().then(t=>t.computeDiff(i,e))}canPromptRecommendation(i){return this._workerManager.withWorker().then(e=>e.canPromptRecommendation(i))}};jOe=I([m(0,kn),m(1,_t),m(2,Bw)],jOe);var dMi=class extends k{constructor(e,t,o){super();this._notebookService=e;this._modelService=t;this._webWorkerService=o;this._editorWorkerClient=null}withWorker(){return this._editorWorkerClient||(this._editorWorkerClient=new pMi(this._notebookService,this._modelService,this._webWorkerService),this._register(this._editorWorkerClient)),Promise.resolve(this._editorWorkerClient)}},uMi=class extends k{constructor(e,t,o){super();this._proxy=e;this._notebookService=t;this._modelService=o;this._syncedModels=Object.create(null);this._syncedModelsLastUsedTime=Object.create(null)}ensureSyncedResources(e){for(let t of e){let o=t.toString();this._syncedModels[o]||this._beginModelSync(t),this._syncedModels[o]&&(this._syncedModelsLastUsedTime[o]=new Date().getTime())}}_beginModelSync(e){let t=this._notebookService.listNotebookDocuments().find(c=>c.uri.toString()===e.toString());if(!t)return;let o=e.toString();this._proxy.$acceptNewModel(t.uri.toString(),t.metadata,t.transientOptions.transientDocumentMetadata,t.cells.map(c=>({handle:c.handle,url:c.uri.toString(),source:c.textBuffer.getLinesContent(),eol:c.textBuffer.getEOL(),versionId:c.textModel?.getVersionId()??0,language:c.language,mime:c.mime,cellKind:c.cellKind,outputs:c.outputs.map(u=>({outputId:u.outputId,outputs:u.outputs})),metadata:c.metadata,internalMetadata:c.internalMetadata})));let n=new O,r=c=>({handle:c.handle,url:c.uri.toString(),source:c.textBuffer.getLinesContent(),eol:c.textBuffer.getEOL(),versionId:0,language:c.language,cellKind:c.cellKind,outputs:c.outputs.map(u=>({outputId:u.outputId,outputs:u.outputs})),metadata:c.metadata,internalMetadata:c.internalMetadata}),s=new Set,l=c=>{s.add(c),n.add(c.onDidChangeContent(u=>{typeof u=="object"&&u.type==="model"&&this._proxy.$acceptCellModelChanged(o,c.handle,u.event)}))};t.cells.forEach(c=>l(c)),t.cells.length!==s.size&&n.add(this._modelService.onModelAdded(c=>{if(c.uri.scheme!==Q.vscodeNotebookCell||!(c instanceof Tp))return;let u=sn.parse(c.uri);if(!u||!ze(u.notebook,t.uri))return;let p=t.cells.find(h=>h.handle===u.handle);p&&l(p)})),n.add(t.onDidChangeContent(c=>{let u=[];c.rawEvents.forEach(p=>{switch(p.kind){case 1:case 6:{u.push({kind:p.kind,changes:p.changes.map(h=>[h[0],h[1],h[2].map(g=>r(g))])});for(let h of p.changes)for(let g of h[2])l(g);break}case 2:{u.push({kind:2,index:p.index,length:p.length,newIdx:p.newIdx,cells:p.cells.map(h=>r(h))});break}case 10:break;case 11:u.push({kind:p.kind,metadata:p.metadata});default:u.push(p)}}),this._proxy.$acceptModelChanged(o.toString(),{rawEvents:u,versionId:c.versionId})})),n.add(t.onWillDispose(()=>{this._stopModelSync(o)})),n.add(ee(()=>{this._proxy.$acceptRemovedModel(o)})),this._syncedModels[o]=n}_stopModelSync(e){let t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],je(t)}},pMi=class extends k{constructor(e,t,o){super();this._notebookService=e;this._modelService=t;this._webWorkerService=o;this._worker=null,this._modelManager=null}computeDiff(e,t){return this._ensureSyncedResources([e,t]).$computeDiff(e.toString(),t.toString())}canPromptRecommendation(e){return this._ensureSyncedResources([e]).$canPromptRecommendation(e.toString())}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new uMi(e,this._notebookService,this._modelService))),this._modelManager}_ensureSyncedResources(e){let t=this._getOrCreateWorker().proxy;return this._getOrCreateModelManager(t).ensureSyncedResources(e),t}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(this._webWorkerService.createWorkerClient(new Ak({esmModuleLocation:In.asBrowserUri("vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain.js"),label:"NotebookEditorWorker"})))}catch(e){throw e}return this._worker}};var B2t=class extends k{constructor(){super(...arguments);this._onDidChangeProviders=this._register(new T);this.onDidChangeProviders=this._onDidChangeProviders.event;this._onDidChangeItems=this._register(new T);this.onDidChangeItems=this._onDidChangeItems.event;this._providers=[]}registerCellStatusBarItemProvider(e){this._providers.push(e);let t;return e.onDidChangeStatusBarItems&&(t=e.onDidChangeStatusBarItems(()=>this._onDidChangeItems.fire())),this._onDidChangeProviders.fire(),ee(()=>{t?.dispose();let o=this._providers.findIndex(n=>n===e);this._providers.splice(o,1)})}async getStatusBarItemsForCell(e,t,o,n){let r=this._providers.filter(s=>s.viewType===o||s.viewType==="*");return await Promise.all(r.map(async s=>{try{return await s.provideCellStatusBarItems(e,t,n)??{items:[]}}catch(l){return vs(l),{items:[]}}}))}};var QOe=class{constructor(i,e,t,o){this.editorGroupService=i;this.instantiationService=o;this._tokenPool=1;this._disposables=new O;this._notebookEditors=new Map;this.groupListener=new Map;this._onNotebookEditorAdd=new T;this._onNotebookEditorsRemove=new T;this.onDidAddNotebookEditor=this._onNotebookEditorAdd.event;this.onDidRemoveNotebookEditor=this._onNotebookEditorsRemove.event;this._borrowableEditors=new Map;let n=s=>{let{id:l}=s,c=[];c.push(s.onDidCloseEditor(u=>{let p=this._borrowableEditors.get(s.id);if(!p)return;(u.editor instanceof Ga||u.editor instanceof VC?[u.editor]:S3(u.editor)?u.editor.editorInputs:[]).forEach(g=>{let f=p.get(g.resource),v=f?.findIndex(S=>S.editorType===g.typeId);if(!f||v===void 0||v===-1)return;let b=f.splice(v,1)[0];b.token=void 0,this._disposeWidget(b.widget),b.disposableStore.dispose(),b.widget=void 0})})),c.push(s.onWillMoveEditor(u=>{mYe(u.editor)&&this._allowWidgetMove(u.editor,u.groupId,u.target),S3(u.editor)&&u.editor.editorInputs.forEach(p=>{this._allowWidgetMove(p,u.groupId,u.target)})})),this.groupListener.set(l,c)};this._disposables.add(i.onDidAddGroup(n)),i.whenReady.then(()=>i.groups.forEach(n)),this._disposables.add(i.onDidRemoveGroup(s=>{let l=this.groupListener.get(s.id);l&&(l.forEach(u=>u.dispose()),this.groupListener.delete(s.id));let c=this._borrowableEditors.get(s.id);if(this._borrowableEditors.delete(s.id),c)for(let u of c.values())for(let p of u)p.token=void 0,this._disposeWidget(p.widget),p.disposableStore.dispose()})),this._mostRecentRepl=yQ.bindTo(t);let r=CKt.bindTo(t);this._disposables.add(e.onDidEditorsChange(s=>{s.event.kind===5&&!r.get()?e.editors.find(l=>S3(l))&&r.set(!0):s.event.kind===6&&r.get()&&(e.editors.find(l=>S3(l))||r.set(!1))}))}dispose(){this._disposables.dispose(),this._onNotebookEditorAdd.dispose(),this._onNotebookEditorsRemove.dispose(),this.groupListener.forEach(i=>{i.forEach(e=>e.dispose())}),this.groupListener.clear(),this._borrowableEditors.forEach(i=>{i.forEach(e=>{e.forEach(t=>t.disposableStore.dispose())})})}_disposeWidget(i){i.onWillHide();let e=i.getDomNode();i.dispose(),e.remove()}_allowWidgetMove(i,e,t){let o=this.editorGroupService.getPart(e),n=this.editorGroupService.getPart(t);if(o.windowId!==n.windowId)return;let r=this._borrowableEditors.get(t)?.get(i.resource)?.findIndex(p=>p.editorType===i.typeId);if(r!==void 0&&r!==-1)return;let s=this._borrowableEditors.get(e)?.get(i.resource)?.find(p=>p.editorType===i.typeId);if(!s)throw new Error("no widget at source group");let l=this._borrowableEditors.get(e)?.get(i.resource);if(l){let p=l.findIndex(h=>h.editorType===i.typeId);p!==-1&&l.splice(p,1)}let c=this._borrowableEditors.get(t);c||(c=new dt,this._borrowableEditors.set(t,c));let u=c.get(i.resource)??[];u?.push(s),c.set(i.resource,u)}retrieveExistingWidgetFromURI(i){for(let e of this._borrowableEditors.values()){let t=e.get(i);if(t&&t.length>0)return this._createBorrowValue(t[0].token,t[0])}}retrieveAllExistingWidgets(){let i=[];for(let e of this._borrowableEditors.values())for(let t of e.values())for(let o of t)i.push(this._createBorrowValue(o.token,o));return i}retrieveWidget(i,e,t,o,n,r){let s=this._borrowableEditors.get(e)?.get(t.resource)?.find(l=>l.editorType===t.typeId);if(s)s.token=this._tokenPool++;else{let l=i.get(X),c=i.get(Hd),u=new O,p=this.createWidget(l,u,c,o,r,n),h=this._tokenPool++;s={widget:p,editorType:t.typeId,token:h,disposableStore:u};let g=this._borrowableEditors.get(e);g||(g=new dt,this._borrowableEditors.set(e,g));let f=g.get(t.resource)??[];f.push(s),g.set(t.resource,f)}return this._createBorrowValue(s.token,s)}createWidget(i,e,t,o,n,r){let s=e.add(this.instantiationService.createChild(new Po([X,i],[Hd,t]))),l=o??roe();return s.createInstance(Lq,{...l,codeWindow:n??l.codeWindow},r)}_createBorrowValue(i,e){return{get value(){return e.token===i?e.widget:void 0}}}addNotebookEditor(i){this._notebookEditors.set(i.getId(),i),this._onNotebookEditorAdd.fire(i)}removeNotebookEditor(i){let e=i.getViewModel()?.notebookDocument.uri;this._notebookEditors.delete(i.getId())&&this._onNotebookEditorsRemove.fire(i),this._mostRecentRepl.get()===e?.toString()&&this._mostRecentRepl.reset()}getNotebookEditor(i){return this._notebookEditors.get(i)}listNotebookEditors(){return[...this._notebookEditors].map(i=>i[1])}getNotebookForPossibleCell(i){for(let e of this._notebookEditors.values())for(let[,t]of e.codeEditors)if(t===i)return e}updateReplContextKey(i){this._mostRecentRepl.set(i)}};QOe=I([m(0,kt),m(1,ie),m(2,X),m(3,F)],QOe);var poe=class extends k{constructor(e,t,o){super();this.fileService=e;this.logService=t;this.workingCopyBackupService=o;this._onDidCreate=this._register(new T);this.onDidCreate=this._onDidCreate.event;this.mapResourceToWorkingCopy=new dt;this.mapResourceToDisposeListener=new dt}has(e){return this.mapResourceToWorkingCopy.has(e)}add(e,t){this.get(e)!==t&&(this.mapResourceToWorkingCopy.set(e,t),this.mapResourceToDisposeListener.get(e)?.dispose(),this.mapResourceToDisposeListener.set(e,t.onWillDispose(()=>this.remove(e))),this._onDidCreate.fire(t))}remove(e){let t=this.mapResourceToDisposeListener.get(e);return t&&(je(t),this.mapResourceToDisposeListener.delete(e)),this.mapResourceToWorkingCopy.delete(e)}get workingCopies(){return[...this.mapResourceToWorkingCopy.values()]}get(e){return this.mapResourceToWorkingCopy.get(e)}dispose(){super.dispose(),this.mapResourceToWorkingCopy.clear(),je(this.mapResourceToDisposeListener.values()),this.mapResourceToDisposeListener.clear()}async destroy(){try{await vn.settled(this.workingCopies.map(async e=>{e.isDirty()&&await this.saveWithFallback(e)}))}catch(e){this.logService.error(e)}je(this.mapResourceToWorkingCopy.values()),this.dispose()}async saveWithFallback(e){let t=!1;try{t=await e.save()}catch{}if(!t||e.isDirty()){let o=await this.workingCopyBackupService.resolve(e);o&&await this.fileService.writeFile(e.resource,o.value,{unlock:!0})}}};poe=I([m(0,ge),m(1,re),m(2,Om)],poe);var YOe=class extends poe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(o,s,c);this.workingCopyTypeId=e;this.modelFactory=t;this.lifecycleService=n;this.labelService=r;this.workingCopyFileService=l;this.uriIdentityService=u;this.filesConfigurationService=p;this.workingCopyService=h;this.notificationService=g;this.workingCopyEditorService=f;this.editorService=v;this.elevatedFileService=b;this.progressService=S;this._onDidResolve=this._register(new T);this.onDidResolve=this._onDidResolve.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeReadonly=this._register(new T);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this._onDidChangeOrphaned=this._register(new T);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidSaveError=this._register(new T);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new T);this.onDidRevert=this._onDidRevert.event;this._onDidRemove=this._register(new T);this.onDidRemove=this._onDidRemove.event;this.mapResourceToWorkingCopyListeners=new dt;this.mapResourceToPendingWorkingCopyResolve=new dt;this.workingCopyResolveQueue=this._register(new Tz);this.mapCorrelationIdToWorkingCopiesToRestore=new Map;this.registerListeners()}registerListeners(){this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onDidChangeFileSystemProviderCapabilities(e))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onDidChangeFileSystemProviderRegistrations(e))),this._register(this.workingCopyFileService.onWillRunWorkingCopyFileOperation(e=>this.onWillRunWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidFailWorkingCopyFileOperation(e=>this.onDidFailWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidRunWorkingCopyFileOperation(e=>this.onDidRunWorkingCopyFileOperation(e))),Ft?this._register(this.lifecycleService.onBeforeShutdown(e=>e.veto(this.onBeforeShutdownWeb(),"veto.fileWorkingCopyManager"))):this._register(this.lifecycleService.onWillShutdown(e=>e.join(this.onWillShutdownDesktop(),{id:"join.fileWorkingCopyManager",label:d(19660,null)})))}onBeforeShutdownWeb(){return!!this.workingCopies.some(e=>e.hasState(2))}async onWillShutdownDesktop(){let e;for(;(e=this.workingCopies.filter(t=>t.hasState(2))).length>0;)await vn.settled(e.map(t=>t.joinState(2)))}onDidChangeFileSystemProviderCapabilities(e){this.queueWorkingCopyReloads(e.scheme)}onDidChangeFileSystemProviderRegistrations(e){e.added&&this.queueWorkingCopyReloads(e.scheme)}onDidFilesChange(e){this.queueWorkingCopyReloads(e)}queueWorkingCopyReloads(e){for(let t of this.workingCopies){if(t.isDirty())continue;let o=!1;typeof e=="string"?o=e===t.resource.scheme:o=e.contains(t.resource,0,1),o&&this.queueWorkingCopyReload(t)}}queueWorkingCopyReload(e){this.workingCopyResolveQueue.queueSize(e.resource)<=1&&this.workingCopyResolveQueue.queueFor(e.resource,async()=>{try{await this.reload(e)}catch(o){this.logService.error(o)}})}onWillRunWorkingCopyFileOperation(e){(e.operation===2||e.operation===3)&&e.waitUntil((async()=>{let t=[];for(let{source:o,target:n}of e.files)if(o){if(this.uriIdentityService.extUri.isEqual(o,n))continue;let r=[];for(let s of this.workingCopies)this.uriIdentityService.extUri.isEqualOrParent(s.resource,o)&&r.push(s);for(let s of r){let l=s.resource,c;this.uriIdentityService.extUri.isEqual(l,o)?c=n:c=Ve(n,l.path.substr(o.path.length+1)),t.push({source:l,target:c,snapshot:s.isDirty()?await s.model?.snapshot(1,Ie.None):void 0})}}this.mapCorrelationIdToWorkingCopiesToRestore.set(e.correlationId,t)})())}onDidFailWorkingCopyFileOperation(e){if(e.operation===2||e.operation===3){let t=this.mapCorrelationIdToWorkingCopiesToRestore.get(e.correlationId);if(t){this.mapCorrelationIdToWorkingCopiesToRestore.delete(e.correlationId);for(let o of t)o.snapshot&&this.get(o.source)?.markModified()}}}onDidRunWorkingCopyFileOperation(e){switch(e.operation){case 0:e.waitUntil((async()=>{for(let{target:t}of e.files){let o=this.get(t);o&&!o.isDisposed()&&await o.revert()}})());break;case 2:case 3:e.waitUntil((async()=>{let t=this.mapCorrelationIdToWorkingCopiesToRestore.get(e.correlationId);t&&(this.mapCorrelationIdToWorkingCopiesToRestore.delete(e.correlationId),await vn.settled(t.map(async o=>{let n=this.uriIdentityService.asCanonicalUri(o.target);await this.resolve(n,{reload:{async:!1},contents:o.snapshot})})))})());break}}async reload(e){await this.joinPendingResolves(e.resource),!(e.isDirty()||e.isDisposed()||!this.has(e.resource))&&await this.doResolve(e,{reload:{async:!1}})}async resolve(e,t){let o=this.joinPendingResolves(e);return o&&await o,this.doResolve(e,t)}async doResolve(e,t){let o,n;A.isUri(e)?(n=e,o=this.get(n)):(n=e.resource,o=e);let r,s=!1,l={contents:t?.contents,forceReadFromFile:t?.reload?.force,limits:t?.limits};o?t?.contents?r=o.resolve(l):t?.reload?t.reload.async?(r=Promise.resolve(),(async()=>{try{await o.resolve(l)}catch(c){o.isDisposed()||mt(c)}})()):r=o.resolve(l):r=Promise.resolve():(s=!0,o=new m8(this.workingCopyTypeId,n,this.labelService.getUriBasenameLabel(n),this.modelFactory,async c=>{await this.resolve(n,{...c,reload:{async:!1}})},this.fileService,this.logService,this.workingCopyFileService,this.filesConfigurationService,this.workingCopyBackupService,this.workingCopyService,this.notificationService,this.workingCopyEditorService,this.editorService,this.elevatedFileService,this.progressService),r=o.resolve(l),this.registerWorkingCopy(o)),this.mapResourceToPendingWorkingCopyResolve.set(n,r),this.add(n,o),s&&o.isDirty()&&this._onDidChangeDirty.fire(o);try{await r}catch(c){throw s&&o.dispose(),c}finally{this.mapResourceToPendingWorkingCopyResolve.delete(n)}return s&&o.isDirty()&&this._onDidChangeDirty.fire(o),o}joinPendingResolves(e){if(this.mapResourceToPendingWorkingCopyResolve.get(e))return this.doJoinPendingResolves(e)}async doJoinPendingResolves(e){let t;for(;this.mapResourceToPendingWorkingCopyResolve.has(e);){let o=this.mapResourceToPendingWorkingCopyResolve.get(e);if(o===t)return;t=o;try{await o}catch{}}}registerWorkingCopy(e){let t=new O;t.add(e.onDidResolve(()=>this._onDidResolve.fire(e))),t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire(e))),t.add(e.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire(e))),t.add(e.onDidSaveError(()=>this._onDidSaveError.fire(e))),t.add(e.onDidSave(o=>this._onDidSave.fire({workingCopy:e,...o}))),t.add(e.onDidRevert(()=>this._onDidRevert.fire(e))),this.mapResourceToWorkingCopyListeners.set(e.resource,t)}remove(e){let t=super.remove(e),o=this.mapResourceToWorkingCopyListeners.get(e);return o&&(je(o),this.mapResourceToWorkingCopyListeners.delete(e)),t&&this._onDidRemove.fire(e),t}canDispose(e){return e.isDisposed()||!this.mapResourceToPendingWorkingCopyResolve.has(e.resource)&&!e.isDirty()?!0:this.doCanDispose(e)}async doCanDispose(e){let t=this.joinPendingResolves(e.resource);return t?(await t,this.canDispose(e)):e.isDirty()?(await U.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}dispose(){super.dispose(),this.mapResourceToPendingWorkingCopyResolve.clear(),je(this.mapResourceToWorkingCopyListeners.values()),this.mapResourceToWorkingCopyListeners.clear()}};YOe=I([m(2,ge),m(3,to),m(4,nt),m(5,re),m(6,gm),m(7,Om),m(8,gt),m(9,fr),m(10,$a),m(11,Ne),m(12,If),m(13,ie),m(14,pW),m(15,Go)],YOe);var Pq=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.typeId=e;this.resource=t;this.name=o;this.hasAssociatedFilePath=n;this.isScratchpad=r;this.initialContents=s;this.modelFactory=l;this.saveDelegate=c;this.workingCopyBackupService=p;this.logService=h;this._model=void 0;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new T);this.onDidRevert=this._onDidRevert.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this.capabilities=this.isScratchpad?6:2,this.modified=this.hasAssociatedFilePath||!!(this.initialContents&&this.initialContents.markModified!==!1),this._register(u.registerWorkingCopy(this))}get model(){return this._model}isDirty(){return this.modified&&!this.isScratchpad}isModified(){return this.modified}setModified(e){this.modified!==e&&(this.modified=e,this.isScratchpad||this._onDidChangeDirty.fire())}async resolve(){if(this.trace("resolve()"),this.isResolved()){this.trace("resolve() - exit (already resolved)");return}let e,t=await this.workingCopyBackupService.resolve(this);t?(this.trace("resolve() - with backup"),e=t.value):this.initialContents?.value?(this.trace("resolve() - with initial contents"),e=this.initialContents.value):(this.trace("resolve() - empty"),e=I8i()),await this.doCreateModel(e),this.setModified(this.hasAssociatedFilePath||!!t||!!(this.initialContents&&this.initialContents.markModified!==!1)),(t||this.initialContents)&&this._onDidChangeContent.fire()}async doCreateModel(e){this.trace("doCreateModel()"),this._model=this._register(await this.modelFactory.createModel(this.resource,e,Ie.None)),this.installModelListeners(this._model)}installModelListeners(e){this._register(e.onDidChangeContent(t=>this.onModelContentChanged(t))),this._register(e.onWillDispose(()=>this.dispose()))}onModelContentChanged(e){!this.hasAssociatedFilePath&&e.isInitial?this.setModified(!1):this.setModified(!0),this._onDidChangeContent.fire()}isResolved(){return!!this.model}get backupDelay(){return this.model?.configuration?.backupDelay}async backup(e){let t;return this.isResolved()?t=await Ea(this.model.snapshot(2,e),e):this.initialContents&&(t=this.initialContents.value),{content:t}}async save(e){this.trace("save()");let t=await this.saveDelegate(this,e);return t&&this._onDidSave.fire({reason:e?.reason,source:e?.source}),t}async revert(){this.trace("revert()"),this.setModified(!1),this._onDidRevert.fire(),this.dispose()}dispose(){this.trace("dispose()"),this._onWillDispose.fire(),super.dispose()}trace(e){this.logService.trace(`[untitled file working copy] ${e}`,this.resource.toString(),this.typeId)}};Pq=I([m(8,$a),m(9,Om),m(10,re)],Pq);var XOe=class extends poe{constructor(e,t,o,n,r,s,l,c){super(n,s,l);this.workingCopyTypeId=e;this.modelFactory=t;this.saveDelegate=o;this.labelService=r;this.workingCopyService=c;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this.mapResourceToWorkingCopyListeners=new dt}async resolve(e){let t=this.doCreateOrGet(e);return await t.resolve(),t}doCreateOrGet(e=Object.create(null)){let t=this.massageOptions(e);if(t.untitledResource){let o=this.get(t.untitledResource);if(o)return o}return this.doCreate(t)}massageOptions(e){let t=Object.create(null);return e.associatedResource?(t.untitledResource=A.from({scheme:Q.untitled,authority:e.associatedResource.authority,fragment:e.associatedResource.fragment,path:e.associatedResource.path,query:e.associatedResource.query}),t.associatedResource=e.associatedResource):(e.untitledResource?.scheme===Q.untitled&&(t.untitledResource=e.untitledResource),t.isScratchpad=e.isScratchpad),t.contents=e.contents,t}doCreate(e){let t=e.untitledResource;if(!t){let n=1;do t=A.from({scheme:Q.untitled,path:e.isScratchpad?`Scratchpad-${n}`:`Untitled-${n}`,query:this.workingCopyTypeId?`typeId=${this.workingCopyTypeId}`:void 0}),n++;while(this.has(t))}let o=new Pq(this.workingCopyTypeId,t,this.labelService.getUriBasenameLabel(t),!!e.associatedResource,!!e.isScratchpad,e.contents,this.modelFactory,this.saveDelegate,this.workingCopyService,this.workingCopyBackupService,this.logService);return this.registerWorkingCopy(o),o}registerWorkingCopy(e){let t=new O;t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onWillDispose(()=>this._onWillDispose.fire(e))),this.mapResourceToWorkingCopyListeners.set(e.resource,t),this.add(e.resource,e),e.isDirty()&&this._onDidChangeDirty.fire(e)}remove(e){let t=super.remove(e),o=this.mapResourceToWorkingCopyListeners.get(e);return o&&(je(o),this.mapResourceToWorkingCopyListeners.delete(e)),t}dispose(){super.dispose(),je(this.mapResourceToWorkingCopyListeners.values()),this.mapResourceToWorkingCopyListeners.clear()}notifyDidSave(e,t){this._onDidSave.fire({source:e,target:t})}};XOe=I([m(3,ge),m(4,nt),m(5,re),m(6,Om),m(7,$a)],XOe);var XQ=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N){super();this.workingCopyTypeId=e;this.storedWorkingCopyModelFactory=t;this.untitledWorkingCopyModelFactory=o;this.fileService=n;this.logService=l;this.workingCopyFileService=c;this.uriIdentityService=p;this.fileDialogService=h;this.filesConfigurationService=g;this.pathService=w;this.environmentService=x;this.dialogService=E;this.decorationsService=M;this.stored=this._register(new YOe(this.workingCopyTypeId,this.storedWorkingCopyModelFactory,n,r,s,l,c,u,p,g,f,v,b,S,y,N)),this.untitled=this._register(new XOe(this.workingCopyTypeId,this.untitledWorkingCopyModelFactory,async(V,H)=>!!await this.saveAs(V.resource,void 0,H),n,s,l,u,f)),this.onDidCreate=U.any(this.stored.onDidCreate,this.untitled.onDidCreate),this.provideDecorations()}static{this.FILE_WORKING_COPY_SAVE_CREATE_SOURCE=Qh.registerSource("fileWorkingCopyCreate.source",d(19635,null))}static{this.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE=Qh.registerSource("fileWorkingCopyReplace.source",d(19637,null))}provideDecorations(){let e=this._register(new class extends k{constructor(o){super();this.stored=o;this.label=d(19636,null);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.registerListeners()}registerListeners(){this._register(this.stored.onDidResolve(o=>{(o.isReadonly()||o.hasState(4))&&this._onDidChange.fire([o.resource])})),this._register(this.stored.onDidRemove(o=>this._onDidChange.fire([o]))),this._register(this.stored.onDidChangeReadonly(o=>this._onDidChange.fire([o.resource]))),this._register(this.stored.onDidChangeOrphaned(o=>this._onDidChange.fire([o.resource])))}provideDecorations(o){let n=this.stored.get(o);if(!n||n.isDisposed())return;let r=n.isReadonly(),s=n.hasState(4);if(r&&s)return{color:Ok,letter:L.lockSmall,strikethrough:!0,tooltip:d(19641,null)};if(r)return{letter:L.lockSmall,tooltip:d(19640,null)};if(s)return{color:Ok,strikethrough:!0,tooltip:d(19634,null)}}}(this.stored));this._register(this.decorationsService.registerDecorationsProvider(e))}get workingCopies(){return[...this.stored.workingCopies,...this.untitled.workingCopies]}get(e){return this.stored.get(e)??this.untitled.get(e)}resolve(e,t){return A.isUri(e)?e.scheme===Q.untitled?this.untitled.resolve({untitledResource:e}):this.stored.resolve(e,t):this.untitled.resolve(e)}async saveAs(e,t,o){if(!t){let n=this.get(e);n instanceof Pq&&n.hasAssociatedFilePath?t=await this.suggestSavePath(e):t=await this.fileDialogService.pickFileToSave(await this.suggestSavePath(o?.suggestedTarget??e),o?.availableFileSystems)}if(t){if(this.filesConfigurationService.isReadonly(t))if(await this.confirmMakeWriteable(t))this.filesConfigurationService.updateReadonly(t,!1);else return;return this.fileService.hasProvider(e)&&ze(e,t)?this.doSave(e,{...o,force:!0}):this.fileService.hasProvider(e)&&this.uriIdentityService.extUri.isEqual(e,t)&&await this.fileService.exists(e)?(await this.workingCopyFileService.move([{file:{source:e,target:t}}],Ie.None),await this.doSave(e,o)??await this.doSave(t,o)):this.doSaveAs(e,t,o)}}async doSave(e,t){let o=this.stored.get(e);if(o&&await o.save(t))return o}async doSaveAs(e,t,o){let n,r=this.get(e);r?.isResolved()?n=await r.model.snapshot(1,Ie.None):n=(await this.fileService.readFileStream(e)).value;let{targetFileExists:s,targetStoredFileWorkingCopy:l}=await this.doResolveSaveTarget(e,t);if(!(r instanceof Pq&&r.hasAssociatedFilePath&&s&&this.uriIdentityService.extUri.isEqual(t,Nf(r.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme))&&!await this.confirmOverwrite(t)||(await l.model?.update(n,Ie.None),o?.source||(o={...o,source:s?XQ.FILE_WORKING_COPY_SAVE_REPLACE_SOURCE:XQ.FILE_WORKING_COPY_SAVE_CREATE_SOURCE}),!await l.save({...o,from:e,force:!0})))){try{await r?.revert()}catch(u){this.logService.error(u)}return e.scheme===Q.untitled&&this.untitled.notifyDidSave(e,t),l}}async doResolveSaveTarget(e,t){let o=!1,n=this.stored.get(t);return n?.isResolved()?o=!0:(o=await this.fileService.exists(t),o||await this.workingCopyFileService.create([{resource:t}],Ie.None),this.uriIdentityService.extUri.isEqual(e,t)&&this.get(e)?n=await this.stored.resolve(e):n=await this.stored.resolve(t)),{targetFileExists:o,targetStoredFileWorkingCopy:n}}async confirmOverwrite(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(19633,null,Be(e)),detail:d(19639,null,Be(e),Be(ai(e))),primaryButton:d(19642,null)});return t}async confirmMakeWriteable(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(19631,null,Be(e)),detail:d(19632,null),primaryButton:d(19638,null)});return t}async suggestSavePath(e){if(this.fileService.hasProvider(e))return e;let t=this.get(e);if(t instanceof Pq&&t.hasAssociatedFilePath)return Nf(e,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);let o=await this.fileDialogService.defaultFilePath();if(t){let n=Ve(o,t.name);if(await this.pathService.hasValidBasename(n,t.name))return n}return Ve(o,Be(e))}async destroy(){await vn.settled([this.stored.destroy(),this.untitled.destroy()])}};XQ=I([m(3,ge),m(4,to),m(5,nt),m(6,re),m(7,gm),m(8,Om),m(9,gt),m(10,nn),m(11,fr),m(12,$a),m(13,Ne),m(14,If),m(15,ie),m(16,pW),m(17,Pn),m(18,Mt),m(19,ct),m(20,mb),m(21,Go)],XQ);var Irt=class extends ix{constructor(e,t,o,n,r){super();this._instantiationService=e;this._notebookService=t;this._configurationService=o;this._telemetryService=n;this._notebookLoggingService=r;this._disposables=new O;this._workingCopyManagers=new Map;this._modelListener=new Map;this._onDidSaveNotebook=new T;this.onDidSaveNotebook=this._onDidSaveNotebook.event;this._onDidChangeDirty=new T;this.onDidChangeDirty=this._onDidChangeDirty.event;this._dirtyStates=new dt;this.modelsToDispose=new Set}dispose(){this._disposables.dispose(),this._onDidSaveNotebook.dispose(),this._onDidChangeDirty.dispose(),je(this._modelListener.values()),je(this._workingCopyManagers.values())}isDirty(e){return this._dirtyStates.get(e)??!1}isListeningToModel(e){for(let t of this._modelListener.keys())if(t.resource.toString()===e.toString())return!0;return!1}async createReferencedObject(e,t,o,n,r,s){this.modelsToDispose.delete(e);let l=A.parse(e),c=E0.create(t,s),u=this._workingCopyManagers.get(c);if(!u){let v=new kLe(t,this._notebookService,this._configurationService,this._telemetryService,this._notebookLoggingService);u=this._instantiationService.createInstance(XQ,c,v,v),this._workingCopyManagers.set(c,u)}let p=r||t==="interactive"&&this._configurationService.getValue(Ct.InteractiveWindowPromptToSave)!==!0,g=await this._instantiationService.createInstance(mW,l,o,t,u,p).load({limits:n}),f;return this._modelListener.set(g,Fn(g.onDidSave(()=>this._onDidSaveNotebook.fire(g.resource)),g.onDidChangeDirty(()=>{let v=g.isDirty();this._dirtyStates.set(g.resource,v),v&&!f?f=this.acquire(e,t):f&&(f.dispose(),f=void 0),this._onDidChangeDirty.fire(g)}),ee(()=>f?.dispose()))),g}destroyReferencedObject(e,t){this.modelsToDispose.add(e),(async()=>{try{let o=await t;if(!this.modelsToDispose.has(e)||(o instanceof mW&&await o.canDispose(),!this.modelsToDispose.has(e)))return;this._modelListener.get(o)?.dispose(),this._modelListener.delete(o),o.dispose()}catch(o){this._notebookLoggingService.error("NotebookModelCollection","FAILED to destory notebook - "+o)}finally{this.modelsToDispose.delete(e)}})()}};Irt=I([m(0,F),m(1,kn),m(2,B),m(3,_e),m(4,Sb)],Irt);var JOe=class{constructor(i,e,t,o){this._notebookService=e;this._extensionService=t;this._uriIdentService=o;this._onWillFailWithConflict=new sY;this.onWillFailWithConflict=this._onWillFailWithConflict.event;this._data=i.createInstance(Irt),this.onDidSaveNotebook=this._data.onDidSaveNotebook,this.onDidChangeDirty=this._data.onDidChangeDirty}dispose(){this._data.dispose()}isDirty(i){return this._data.isDirty(i)}createUntitledUri(i){let e=this._notebookService.getContributedNotebookType(Ti(i));if(!e)throw new Error("UNKNOWN notebook type: "+i);let t=Yie.possibleFileEnding(e.selectors)??"";for(let o=1;;o++){let n=A.from({scheme:Q.untitled,path:`Untitled-${o}${t}`,query:i});if(!this._notebookService.getNotebookTextModel(n)&&!this._data.isListeningToModel(n))return n}}async validateResourceViewType(i,e){if(!i&&!e)throw new Error("Must provide at least one of resource or viewType");if(i?.scheme===sn.scheme){let n=i;if(i=r_e(i)?.notebook,!i)throw new Error(`CANNOT open a cell-uri as notebook. Tried with ${n.toString()}`)}let t=this._uriIdentService.asCanonicalUri(i??this.createUntitledUri(e)),o=this._notebookService.getNotebookTextModel(t);if(!e)if(o)e=o.viewType;else{await this._extensionService.whenInstalledExtensionsRegistered();let n=this._notebookService.getContributedNotebookTypes(t);e=n.find(r=>r.priority==="exclusive")?.id??n.find(r=>r.priority==="default")?.id??n[0]?.id}if(!e)throw new Error(`Missing viewType for '${t}'`);if(o&&o.viewType!==e){await this._onWillFailWithConflict.fireAsync({resource:t,viewType:e},Ie.None);let n=this._notebookService.getNotebookTextModel(t)?.viewType;if(n&&n!==e)throw new Error(`A notebook with view type '${n}' already exists for '${t}', CANNOT create another notebook with view type ${e}`)}return{resource:t,viewType:e}}async createUntitledNotebookTextModel(i){let e=this._uriIdentService.asCanonicalUri(this.createUntitledUri(i));return await this._notebookService.createNotebookTextModel(i,e)}async resolve(i,e,t){let o,n;A.isUri(i)?o=i:i.untitledResource&&(i.untitledResource.scheme===Q.untitled?o=i.untitledResource:(o=i.untitledResource.with({scheme:Q.untitled}),n=!0));let r=await this.validateResourceViewType(o,e),s=this._data.acquire(r.resource.toString(),r.viewType,n,t?.limits,t?.scratchpad,t?.viewType);try{return{object:await s.object,dispose(){s.dispose()}}}catch(l){throw s.dispose(),l}}};JOe=I([m(0,F),m(1,kn),m(2,lt),m(3,gt)],JOe);var mMi=class a{constructor(i){this.notebookPriorities=new dt;this.kernel=i,this.score=-1,this.time=a._logicClock++}static{this._logicClock=0}},Aq=class{static str(i){return`${i.notebookType}/${i.uri.toString()}`}static obj(i){let e=i.indexOf("/");return{notebookType:i.substring(0,e),uri:A.parse(i.substring(e+1))}}},hMi=class extends k{constructor(e,t,o){super();this.action=e;this.model=t;this.isPrimary=o;this._onDidChangeState=this._register(new T);this.onDidChangeState=this._onDidChangeState.event}async runAction(){if(this.execution)return this.execution;this.execution=this._runAction(),this._onDidChangeState.fire(),await this.execution,this.execution=void 0,this._onDidChangeState.fire()}async _runAction(){try{await this.action.run({uri:this.model.uri,$mid:14})}catch(e){console.warn(`Kernel source command failed: ${e}`)}}},QU=class extends k{constructor(e,t,o,n){super();this._notebookService=e;this._storageService=t;this._menuService=o;this._contextKeyService=n;this._kernels=new Map;this._notebookBindings=new Ua(1e3,.7);this._onDidChangeNotebookKernelBinding=this._register(new T);this._onDidAddKernel=this._register(new T);this._onDidRemoveKernel=this._register(new T);this._onDidChangeNotebookAffinity=this._register(new T);this._onDidChangeSourceActions=this._register(new T);this._onDidNotebookVariablesChange=this._register(new T);this._kernelSources=new Map;this._kernelSourceActionsUpdates=new Map;this._kernelDetectionTasks=new Map;this._onDidChangeKernelDetectionTasks=this._register(new T);this._kernelSourceActionProviders=new Map;this.onDidChangeSelectedNotebooks=this._onDidChangeNotebookKernelBinding.event;this.onDidAddKernel=this._onDidAddKernel.event;this.onDidRemoveKernel=this._onDidRemoveKernel.event;this.onDidChangeNotebookAffinity=this._onDidChangeNotebookAffinity.event;this.onDidChangeSourceActions=this._onDidChangeSourceActions.event;this.onDidChangeKernelDetectionTasks=this._onDidChangeKernelDetectionTasks.event;this.onDidNotebookVariablesUpdate=this._onDidNotebookVariablesChange.event;this._register(e.onDidAddNotebookDocument(this._tryAutoBindNotebook,this)),this._register(e.onWillRemoveNotebookDocument(r=>{let s=Aq.str(r);this._notebookBindings.get(s)&&r.uri.scheme===Q.untitled&&this.selectKernelForNotebook(void 0,r),this._kernelSourceActionsUpdates.get(s)?.dispose(),this._kernelSourceActionsUpdates.delete(s)}));try{let r=JSON.parse(this._storageService.get(QU._storageNotebookBinding,1,"[]"));this._notebookBindings.fromJSON(r)}catch{}}static{this._storageNotebookBinding="notebook.controller2NotebookBindings"}dispose(){this._kernels.clear(),this._kernelSources.forEach(e=>{e.menu.dispose(),e.actions.forEach(t=>t[1].dispose())}),this._kernelSourceActionsUpdates.forEach(e=>{e.dispose()}),this._kernelSourceActionsUpdates.clear(),super.dispose()}_persistMementos(){this._persistSoonHandle?.dispose(),this._persistSoonHandle=Ff(zi(),()=>{this._storageService.store(QU._storageNotebookBinding,JSON.stringify(this._notebookBindings),1,1)},100)}static _score(e,t){return e.viewType==="*"?5:e.viewType===t.notebookType?10:0}_tryAutoBindNotebook(e,t){let o=this._notebookBindings.get(Aq.str(e));if(!o)return;let n=this._kernels.get(o);!n||!QU._score(n.kernel,e)||(!t||n.kernel===t)&&this._onDidChangeNotebookKernelBinding.fire({notebook:e.uri,oldKernel:void 0,newKernel:n.kernel.id})}notifyVariablesChange(e){this._onDidNotebookVariablesChange.fire(e)}registerKernel(e){if(this._kernels.has(e.id))throw new Error(`NOTEBOOK CONTROLLER with id '${e.id}' already exists`);this._kernels.set(e.id,new mMi(e)),this._onDidAddKernel.fire(e);for(let t of this._notebookService.getNotebookTextModels())this._tryAutoBindNotebook(t,e);return ee(()=>{this._kernels.delete(e.id)&&this._onDidRemoveKernel.fire(e);for(let[t,o]of Array.from(this._notebookBindings))o===e.id&&this._onDidChangeNotebookKernelBinding.fire({notebook:Aq.obj(t).uri,oldKernel:e.id,newKernel:void 0})})}getMatchingKernel(e){let t=[];for(let c of this._kernels.values()){let u=QU._score(c.kernel,e);u&&t.push({score:u,kernel:c.kernel,instanceAffinity:c.notebookPriorities.get(e.uri)??1})}t.sort((c,u)=>u.instanceAffinity-c.instanceAffinity||c.score-u.score||c.kernel.label.localeCompare(u.kernel.label));let o=t.map(c=>c.kernel),n=this._notebookBindings.get(Aq.str(e)),r=n?this._kernels.get(n)?.kernel:void 0,s=t.filter(c=>c.instanceAffinity>1).map(c=>c.kernel),l=t.filter(c=>c.instanceAffinity<0).map(c=>c.kernel);return{all:o,selected:r,suggestions:s,hidden:l}}getSelectedOrSuggestedKernel(e){let t=this.getMatchingKernel(e);if(t.selected)return t.selected;let o=t.all.filter(n=>this._kernels.get(n.id)?.notebookPriorities.get(e.uri)===2);return o.length===1?o[0]:t.all.length===1?t.all[0]:void 0}selectKernelForNotebook(e,t){let o=Aq.str(t),n=this._notebookBindings.get(o);n!==e?.id&&(e?this._notebookBindings.set(o,e.id):this._notebookBindings.delete(o),this._onDidChangeNotebookKernelBinding.fire({notebook:t.uri,oldKernel:n,newKernel:e?.id}),this._persistMementos())}preselectKernelForNotebook(e,t){let o=Aq.str(t);this._notebookBindings.get(o)!==e?.id&&(this._notebookBindings.set(o,e.id),this._persistMementos())}updateKernelNotebookAffinity(e,t,o){let n=this._kernels.get(e.id);if(!n)throw new Error(`UNKNOWN kernel '${e.id}'`);o===void 0?n.notebookPriorities.delete(t):n.notebookPriorities.set(t,o),this._onDidChangeNotebookAffinity.fire()}getRunningSourceActions(e){let t=Aq.str(e),o=this._kernelSources.get(t);return o?o.actions.filter(n=>n[0].execution).map(n=>n[0]):[]}getSourceActions(e,t){t=t??this._contextKeyService;let o=Aq.str(e),n=this._kernelSources.get(o);if(n)return n.actions.map(c=>c[0]);let r=this._register(this._menuService.createMenu(R.NotebookKernelSource,t)),s={menu:r,actions:[]},l=(c,u)=>{let p=c.getActions({shouldForwardArgs:!0}),h=[];p.forEach(g=>{let f=/^primary/.test(g[0]);g[1].forEach(v=>{let b=new hMi(v,u,f),S=b.onDidChangeState(()=>{this._onDidChangeSourceActions.fire({notebook:u.uri,viewType:u.notebookType})});h.push([b,S])})}),s.actions=h,this._kernelSources.set(o,s),this._onDidChangeSourceActions.fire({notebook:u.uri,viewType:u.notebookType})};return this._kernelSourceActionsUpdates.get(o)?.dispose(),this._kernelSourceActionsUpdates.set(o,r.onDidChange(()=>{l(r,e)})),l(r,e),s.actions.map(c=>c[0])}registerNotebookKernelDetectionTask(e){let t=e.notebookType,o=this._kernelDetectionTasks.get(t)??[];return o.push(e),this._kernelDetectionTasks.set(t,o),this._onDidChangeKernelDetectionTasks.fire(t),ee(()=>{let n=this._kernelDetectionTasks.get(t)??[],r=n.indexOf(e);r>=0&&(n.splice(r,1),this._kernelDetectionTasks.set(t,n),this._onDidChangeKernelDetectionTasks.fire(t))})}getKernelDetectionTasks(e){return this._kernelDetectionTasks.get(e.notebookType)??[]}registerKernelSourceActionProvider(e,t){let o=this._kernelSourceActionProviders.get(e)??[];o.push(t),this._kernelSourceActionProviders.set(e,o),this._onDidChangeSourceActions.fire({viewType:e});let n=t.onDidChangeSourceActions?.(()=>{this._onDidChangeSourceActions.fire({viewType:e})});return ee(()=>{let r=this._kernelSourceActionProviders.get(e)??[],s=r.indexOf(t);s>=0&&(r.splice(s,1),this._kernelSourceActionProviders.set(e,r)),n?.dispose()})}getKernelSourceActions2(e){let t=e.notebookType,n=(this._kernelSourceActionProviders.get(t)??[]).map(r=>r.provideKernelSourceActions());return Promise.all(n).then(r=>r.reduce((s,l)=>s.concat(l),[]))}};QU=I([m(0,kn),m(1,de),m(2,Yt),m(3,X)],QU);var ZOe=class extends k{constructor(e){super();this.extensionService=e;this.activations=new Map;this.scopedMessaging=new Map;this.postMessageEmitter=this._register(new T);this.onShouldPostMessage=this.postMessageEmitter.event}receiveMessage(e,t,o){if(e===void 0){let n=[...this.scopedMessaging.values()].map(r=>r.receiveMessageHandler?.(t,o));return Promise.all(n).then(r=>r.some(s=>!!s))}return this.scopedMessaging.get(e)?.receiveMessageHandler?.(t,o)??Promise.resolve(!1)}prepare(e){if(this.activations.has(e))return;let t=[];this.activations.set(e,t),this.extensionService.activateByEvent(`onRenderer:${e}`).then(()=>{for(let o of t)this.postMessageEmitter.fire(o);this.activations.set(e,void 0)})}getScoped(e){let t=this.scopedMessaging.get(e);if(t)return t;let o={postMessage:(n,r)=>this.postMessage(e,n,r),dispose:()=>this.scopedMessaging.delete(e)};return this.scopedMessaging.set(e,o),o}postMessage(e,t,o){this.activations.has(t)||this.prepare(t);let n=this.activations.get(t),r={rendererId:t,editorId:e,message:o};n===void 0?this.postMessageEmitter.fire(r):n.push(r)}};ZOe=I([m(0,lt)],ZOe);async function eFe(a,i,e,t){let{notebookEditor:o}=i;if(o.hasModel()&&!o.isReadOnly){if(i.ui&&i.cell){let{cell:n}=i;if(n.cellKind===a)return;let r=n.getText(),s=o.getCellIndex(n);e===void 0&&(e=(o.activeKernel?.supportedLanguages??[])[0]??es),o.textModel.applyEdits([{editType:1,index:s,count:1,cells:[{cellKind:a,source:r,language:e,mime:t??n.mime,outputs:n.model.outputs,metadata:n.metadata}]}],!0,{kind:1,focus:o.getFocus(),selections:o.getSelections()},()=>({kind:1,focus:o.getFocus(),selections:o.getSelections()}),void 0,!0);let l=o.cellAt(s);await o.focusNotebookCell(l,n.getEditState()===1?"editor":"container")}else if(i.selectedCells){let n=i.selectedCells,r=[];n.forEach(s=>{if(s.cellKind===a)return;let l=s.getText(),c=o.getCellIndex(s);e===void 0&&(e=(o.activeKernel?.supportedLanguages??[])[0]??es),r.push({editType:1,index:c,count:1,cells:[{cellKind:a,source:l,language:e,mime:t??s.mime,outputs:s.model.outputs,metadata:s.metadata}]})}),o.textModel.applyEdits(r,!0,{kind:1,focus:o.getFocus(),selections:o.getSelections()},()=>({kind:1,focus:o.getFocus(),selections:o.getSelections()}),void 0,!0)}}}function owo(a,i){let e=a.textModel,t=a.getSelections(),o=a.getCellIndex(i),n=t.find(s=>s.start<=o&&o<s.end),r=!a.isReadOnly||e.viewType==="interactive";if(n){let s=t.reverse().map(c=>({editType:1,index:c.start,count:c.end-c.start,cells:[]})),l=n.end>=a.getLength()?void 0:a.cellAt(n.end);e.applyEdits(s,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>{if(l){let c=e.cells.findIndex(u=>u.handle===l.handle);return{kind:1,focus:{start:c,end:c+1},selections:[{start:c,end:c+1}]}}else if(e.length){let c=e.length-1;return{kind:1,focus:{start:c,end:c+1},selections:[{start:c,end:c+1}]}}else return{kind:1,focus:{start:0,end:0},selections:[{start:0,end:0}]}},void 0,r)}else{let s=a.getFocus(),l=[{editType:1,index:o,count:1,cells:[]}],c=[];for(let u=0;u<t.length;u++){let p=t[u];p.end<=o?c.push(p):p.start>o?c.push({start:p.start-1,end:p.end-1}):c.push({start:o,end:o+1})}if(a.cellAt(s.start)===i){let u=s.end===e.length?{start:s.start-1,end:s.end-1}:s;e.applyEdits(l,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:u,selections:c}),void 0,r)}else{let u=s.start>o?{start:s.start-1,end:s.end-1}:s;e.applyEdits(l,!0,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>({kind:1,focus:u,selections:c}),void 0,r)}}}async function gMi(a,i){if(!a.notebookEditor.hasModel())return;let e=a.notebookEditor,t=e.textModel;if(e.isReadOnly)return;let o;if(a.cell){let n=e.getCellIndex(a.cell);o={start:n,end:n+1}}else{let n=e.getSelections();o=vZ(e,n)[0]}if(!(!o||o.start===o.end))if(i==="up"){if(o.start===0)return;let n=o.start-1,r={start:o.start-1,end:o.end-1},s=a.notebookEditor.getFocus(),l=PMt(o,s)?{start:s.start-1,end:s.end-1}:{start:o.start-1,end:o.start};t.applyEdits([{editType:6,index:n,length:1,newIdx:o.end-1}],!0,{kind:1,focus:e.getFocus(),selections:e.getSelections()},()=>({kind:1,focus:l,selections:[r]}),void 0,!0);let c=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(c)}else{if(o.end>=t.length)return;let n=o.end,r={start:o.start+1,end:o.end+1},s=e.getFocus(),l=PMt(o,s)?{start:s.start+1,end:s.end+1}:{start:o.start+1,end:o.start+2};t.applyEdits([{editType:6,index:n,length:1,newIdx:o.start}],!0,{kind:1,focus:e.getFocus(),selections:e.getSelections()},()=>({kind:1,focus:l,selections:[r]}),void 0,!0);let c=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(c)}}async function fMi(a,i){let e=a.notebookEditor;if(!e.hasModel())return;let t=e.textModel;if(e.isReadOnly)return;let o;if(a.ui){let n=a.cell,r=e.getCellIndex(n);o={start:r,end:r+1}}else{let n=e.getSelections();o=vZ(e,n)[0]}if(!(!o||o.start===o.end))if(i==="up"){let n=e.getFocus(),r=e.getSelections();t.applyEdits([{editType:1,index:o.end,count:0,cells:yv([o]).map(s=>_q(e.cellAt(s).model))}],!0,{kind:1,focus:n,selections:r},()=>({kind:1,focus:n,selections:r}),void 0,!0)}else{let n=e.getFocus(),r=e.getSelections(),l=yv([o]).map(h=>_q(e.cellAt(h).model)).length,c=a.ui?n:{start:n.start+l,end:n.end+l},u=a.ui?r:[{start:o.start+l,end:o.end+l}];t.applyEdits([{editType:1,index:o.end,count:0,cells:yv([o]).map(h=>_q(e.cellAt(h).model))}],!0,{kind:1,focus:n,selections:r},()=>({kind:1,focus:c,selections:u}),void 0,!0);let p=e.getSelections()[0]??e.getFocus();e.revealCellRangeInView(p)}}async function nwo(a,i,e){let t=e.notebookEditor;if(t.isReadOnly)return;let o=[],n=[];for(let p of t.getSelections())n.push(...t.getCellsInRange(p));if(n.length<=1)return;let r=n[0].cellKind;if(!n.every(p=>p.cellKind===r)){let p=d(13581,null);return i.warn(p)}let l=n[0],c=n.map(p=>p.getText()).join(l.textBuffer.getEOL()),u=t.getSelections()[0];o.push(new rb(t.textModel.uri,{editType:1,index:u.start,count:u.end-u.start,cells:[{cellKind:l.cellKind,source:c,language:l.language,mime:l.mime,outputs:l.model.outputs,metadata:l.metadata}]}));for(let p of t.getSelections().slice(1))o.push(new rb(t.textModel.uri,{editType:1,index:p.start,count:p.end-p.start,cells:[]}));o.length&&await a.apply(o,{quotableLabel:d(13582,null)})}async function iwo(a,i,e,t){if(a.isReadOnly)return null;let o=a.textModel,n=a.getCellsInRange(i);if(!n.length||i.start===0&&e==="above"||i.end===o.length&&e==="below")return null;for(let r=0;r<n.length;r++){let s=n[r];if(t&&s.cellKind!==t)return null}if(e==="above"){let r=a.cellAt(i.start-1);if(t&&r.cellKind!==t)return null;let s=n.map(u=>(u.textBuffer.getEOL()??"")+u.getText()).join(""),l=r.textBuffer.getLineCount(),c=r.textBuffer.getLineLength(l);return{edits:[new hl(r.uri,{range:new G(l,c+1,l,c+1),text:s}),new rb(o.uri,{editType:1,index:i.start,count:i.end-i.start,cells:[]})],cell:r,endFocus:{start:i.start-1,end:i.start},endSelections:[{start:i.start-1,end:i.start}]}}else{let r=a.cellAt(i.end);if(t&&r.cellKind!==t)return null;let s=n[0],c=[...n.slice(1),r].map(h=>(h.textBuffer.getEOL()??"")+h.getText()).join(""),u=s.textBuffer.getLineCount(),p=s.textBuffer.getLineLength(u);return{edits:[new hl(s.uri,{range:new G(u,p+1,u,p+1),text:c}),new rb(o.uri,{editType:1,index:i.start+1,count:i.end-i.start,cells:[]})],cell:s,endFocus:{start:i.start,end:i.start+1},endSelections:[{start:i.start,end:i.start+1}]}}}async function vMi(a,i,e){let t=i.notebookEditor,o=t.textModel,n=t.getViewModel(),r=null;if(i.ui){let s=i.cell.focusMode,l=t.getCellIndex(i.cell);if(r=await iwo(t,{start:l,end:l+1},e),!r)return;await a.apply(r?.edits,{quotableLabel:"Join Notebook Cells"}),n.updateSelectionsState({kind:1,focus:r.endFocus,selections:r.endSelections}),r.cell.updateEditState(1,"joinCellsWithSurrounds"),t.revealCellRangeInView(t.getFocus()),s===1&&(r.cell.focusMode=1)}else{let s=t.getSelections();if(!s.length)return;let l=t.getFocus(),c=t.cellAt(l.start)?.focusMode,u=[],p=null,h=[];for(let f=s.length-1;f>=0;f--){let v=s[f],b=PMt(v,l);if(v.end>=o.length&&e==="below"||v.start===0&&e==="above"){b&&(p=t.cellAt(l.start)),h.push(...t.getCellsInRange(v));continue}let S=await iwo(t,v,e);if(!S)return;u.push(...S.edits),h.push(S.cell),b&&(p=S.cell)}if(!u.length||!p||!h.length)return;await a.apply(u,{quotableLabel:"Join Notebook Cells"}),h.forEach(f=>{f.updateEditState(1,"joinCellsWithSurrounds")}),n.updateSelectionsState({kind:0,primary:p.handle,selections:h.map(f=>f.handle)}),t.revealCellRangeInView(t.getFocus());let g=t.cellAt(t.getFocus().start);c===1&&g&&(g.focusMode=1)}}function sln(a,i){let e=[],t=i.getLineCount(),o=s=>i.getLineLength(s);a=a.sort((s,l)=>{let c=s.lineNumber-l.lineNumber,u=s.column-l.column;return c!==0?c:u});for(let s of a)o(s.lineNumber)+1===s.column&&s.column!==1&&s.lineNumber<t&&(s=new ye(s.lineNumber+1,1)),aln(e,s);if(e.length===0)return null;let n=new ye(1,1),r=new ye(t,o(t)+1);return[n,...e,r]}function aln(a,i){let e=a.length>0?a[a.length-1]:void 0;(!e||e.lineNumber!==i.lineNumber||e.column!==i.column)&&a.push(i)}function rwo(a,i){let e=sln(i,a.textBuffer);if(!e)return null;let t=[];for(let o=1;o<e.length;o++){let n=e[o-1],r=e[o];t.push(a.textBuffer.getValueInRange(new G(n.lineNumber,n.column,r.lineNumber,r.column),0))}return t}function YU(a,i,e,t,o="above",n="",r=!1,s){let l=i.getViewModel(),c=i.activeKernel;if(l.options.isReadOnly)return null;let u=i.cellAt(e),p=r?l.getNextVisibleCellIndex(e):e+1,h;if(t===2){let f=c?.supportedLanguages??a.getRegisteredLanguageIds(),v=f[0]||es;if(u?.cellKind===2)h=u.language;else if(u?.cellKind===1){let b=l.nearestCodeCellIndex(e);b>-1?h=l.cellAt(b).language:h=v}else if(!u&&l.length===0){let b=s?.getKernels(l.notebookDocument);b?.all.length?h=b.all[0].supportedLanguages[0]||v:h=v}else u===void 0&&o==="above"?h=l.viewCells.find(b=>b.cellKind===2)?.language||v:h=v;f.includes(h)||(h=v)}else h="markdown";return lln(l,u?o==="above"?e:p:e,n,h,t,void 0,[],!0,!0)}function lln(a,i,e,t,o,n,r,s,l){let c={kind:1,focus:{start:i,end:i+1},selections:[{start:i,end:i+1}]};return a.notebookDocument.applyEdits([{editType:1,index:i,count:0,cells:[{cellKind:o,language:t,mime:void 0,outputs:r,metadata:n,source:e}]}],s,{kind:1,focus:a.getFocus(),selections:a.getSelections()},()=>c,void 0,l&&!a.options.isReadOnly),a.cellAt(i)}var cln="notebook.cell.insertCodeCellAbove",H2t="notebook.cell.insertCodeCellBelow",dln="notebook.cell.insertCodeCellAboveAndFocusContainer",uln="notebook.cell.insertCodeCellBelowAndFocusContainer",bMi="notebook.cell.insertCodeCellAtTop",pln="notebook.cell.insertMarkdownCellAbove",SMi="notebook.cell.insertMarkdownCellBelow",swo="notebook.cell.insertMarkdownCellAtTop";function IMi(a,i,e,t,o){let n=null;i.ui&&i.notebookEditor.focus();let r=a.get(Rt),s=a.get(XM);if(i.cell){let l=i.notebookEditor.getCellIndex(i.cell);n=YU(r,i.notebookEditor,l,e,t,void 0,!0,s)}else{let l=i.notebookEditor.getFocus(),c=Math.max(l.end-1,0);n=YU(r,i.notebookEditor,c,e,t,void 0,!0,s)}return n}var moe=class extends Np{constructor(e,t,o,n){super(e);this.kind=t;this.direction=o;this.focusEditor=n}async runWithContext(e,t){let o=await IMi(e,t,this.kind,this.direction,this.focusEditor);o&&await t.notebookEditor.focusNotebookCell(o,this.focusEditor?"editor":"container")}};W(class extends moe{constructor(){super({id:cln,title:d(13649,null),keybinding:{primary:3075,when:C.and(Ap,Wg.toNegated()),weight:200},menu:{id:R.NotebookCellInsert,order:0}},2,"above",!0)}});W(class extends moe{constructor(){super({id:dln,title:d(13650,null)},2,"above",!1)}});W(class extends moe{constructor(){super({id:H2t,title:d(13652,null),keybinding:{primary:2051,when:C.and(Ap,Wg.toNegated()),weight:200},menu:{id:R.NotebookCellInsert,order:1}},2,"below",!0)}});W(class extends moe{constructor(){super({id:uln,title:d(13653,null)},2,"below",!1)}});W(class extends moe{constructor(){super({id:pln,title:d(13654,null),menu:{id:R.NotebookCellInsert,order:2}},1,"above",!0)}});W(class extends moe{constructor(){super({id:SMi,title:d(13656,null),menu:{id:R.NotebookCellInsert,order:3}},1,"below",!0)}});W(class extends Np{constructor(){super({id:bMi,title:d(13651,null),f1:!1})}async run(i,e){e=e??this.getEditorContextFromArgsOrActive(i),e&&this.runWithContext(i,e)}async runWithContext(i,e){let t=i.get(Rt),o=i.get(XM),n=YU(t,e.notebookEditor,0,2,"above",void 0,!0,o);n&&await e.notebookEditor.focusNotebookCell(n,"editor")}});W(class extends Np{constructor(){super({id:swo,title:d(13655,null),f1:!1})}async run(i,e){e=e??this.getEditorContextFromArgsOrActive(i),e&&this.runWithContext(i,e)}async runWithContext(i,e){let t=i.get(Rt),o=i.get(XM),n=YU(t,e.notebookEditor,0,1,"above",void 0,!0,o);n&&await e.notebookEditor.focusNotebookCell(n,"editor")}});be.appendMenuItem(R.NotebookCellBetween,{command:{id:H2t,title:"$(add) "+d(13657,null),tooltip:d(13661,null)},order:0,group:"inline",when:C.and(cc.isEqualTo(!0),C.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});be.appendMenuItem(R.NotebookCellBetween,{command:{id:H2t,title:d(13659,null),icon:L.add,tooltip:d(13661,null)},order:0,group:"inline",when:C.and(cc.isEqualTo(!0),C.equals("config.notebook.experimental.insertToolbarAlignment","left"))});be.appendMenuItem(R.NotebookToolbar,{command:{id:H2t,icon:L.add,title:d(13660,null),tooltip:d(13661,null)},order:-5,group:"navigation/add",when:C.and(cc.isEqualTo(!0),C.notEquals("config.notebook.insertToolbarLocation","betweenCells"),C.notEquals("config.notebook.insertToolbarLocation","hidden"))});be.appendMenuItem(R.NotebookCellListTop,{command:{id:bMi,title:"$(add) "+d(13657,null),tooltip:d(13661,null)},order:0,group:"inline",when:C.and(cc.isEqualTo(!0),C.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});be.appendMenuItem(R.NotebookCellListTop,{command:{id:bMi,title:d(13658,null),icon:L.add,tooltip:d(13661,null)},order:0,group:"inline",when:C.and(cc.isEqualTo(!0),C.equals("config.notebook.experimental.insertToolbarAlignment","left"))});be.appendMenuItem(R.NotebookCellBetween,{command:{id:SMi,title:"$(add) "+d(13662,null),tooltip:d(13664,null)},order:1,group:"inline",when:C.and(cc.isEqualTo(!0),C.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});be.appendMenuItem(R.NotebookToolbar,{command:{id:SMi,icon:L.add,title:d(13663,null),tooltip:d(13664,null)},order:-5,group:"navigation/add",when:C.and(cc.isEqualTo(!0),C.notEquals("config.notebook.insertToolbarLocation","betweenCells"),C.notEquals("config.notebook.insertToolbarLocation","hidden"),C.notEquals(`config.${Ct.globalToolbarShowLabel}`,!1),C.notEquals(`config.${Ct.globalToolbarShowLabel}`,"never"))});be.appendMenuItem(R.NotebookCellListTop,{command:{id:swo,title:"$(add) "+d(13662,null),tooltip:d(13664,null)},order:1,group:"inline",when:C.and(cc.isEqualTo(!0),C.notEquals("config.notebook.experimental.insertToolbarAlignment","left"))});oe.as($t.Configuration).registerConfiguration({id:"editor",properties:{"inlineChat.notebookAgent":{markdownDescription:d(12471,null),default:!1,type:"boolean",tags:["experimental"],experiment:{mode:"startup"}},"inlineChat.affordance":{description:d(12439,null),default:"off",type:"string",enum:["off","editor"],enumDescriptions:[d(12441,null),d(12440,null)],experiment:{mode:"auto"},tags:["experimental"],agentsWindow:{default:"editor"}},"inlineChat.fixDiagnostics":{description:d(12446,null),default:!0,type:"boolean",experiment:{mode:"auto"},tags:["experimental"]},"inlineChat.askInChat":{description:d(12442,null),default:!0,type:"boolean"}}});var tFe="editor.contrib.inlineChatController",U2t=new Y("inlineChatPossible",!1,d(12461,null)),yMi=new Y("inlineChatHasEditsAgent",!1,d(12458,null)),awo=new Y("inlineChatHasNotebookInline",!1,d(12460,null)),wMi=new Y("inlineChatHasNotebookAgent",!1,d(12459,null)),XU=new Y("inlineChatVisible",!1,d(12470,null)),Nq=new Y("inlineChatFocused",!1,d(12457,null)),lZu=new Y("inlineChatEditing",!0,d(12454,null)),z2t=new Y("inlineChatResponseFocused",!1,d(12468,null)),cZu=new Y("inlineChatEmpty",!1,d(12455,null)),yrt=new Y("inlineChatOuterCursorPosition","",d(12466,null)),lwo=new Y("inlineChatRequestInProgress",!1,d(12467,null)),kP=new Y("inlineChatFileBelongsToChat",!1,d(12456,null)),Ife=new Y("inlineChatTerminated",!1,d(12469,null)),K2t=new Y("inlineChatAffordanceVisible",!1,d(12451,null)),yfe=C.or(yMi,C.and(nl,wMi)),wrt=C.equals("config.inlineChat.fixDiagnostics",!0),hoe=C.equals("config.inlineChat.askInChat",!0),JQ="inlineChat.start",G2t="inlineChat.askInChat",JU=R.for("inlineChatWidget.secondary"),cwo=R.for("inlineChatWidget.side"),dwo=te("inlineChat.foreground",vT,d(12449,null)),CMi=te("inlineChat.background",qu,d(12447,null)),dZu=te("inlineChat.border",bT,d(12448,null)),uZu=te("inlineChat.shadow",_F,d(12450,null)),pZu=te("inlineChatInput.border",bT,d(12463,null)),mZu=te("inlineChatInput.focusBorder",Kc,d(12464,null)),hZu=te("inlineChatInput.placeholderForeground",cX,d(12465,null)),gZu=te("inlineChatInput.background",Hf,d(12462,null)),fZu=te("inlineChatDiff.inserted",ni(_g,.5),d(12452,null)),vZu=te("editorOverviewRuler.inlineChatInserted",{dark:ni(_g,.6),light:ni(_g,.8),hcDark:ni(_g,.6),hcLight:ni(_g,.8)},d(12444,null)),bZu=te("editorMinimap.inlineChatInserted",{dark:ni(_g,.6),light:ni(_g,.8),hcDark:ni(_g,.6),hcLight:ni(_g,.8)},d(12443,null)),SZu=te("inlineChatDiff.removed",ni(df,.5),d(12453,null)),IZu=te("editorOverviewRuler.inlineChatRemoved",{dark:ni(df,.6),light:ni(df,.8),hcDark:ni(df,.6),hcLight:ni(df,.8)},d(12445,null));var mln="notebook.execute",hln="notebook.cancelExecution",gln="notebook.interruptExecution",fln="notebook.cell.cancelExecution",vln="notebook.cell.executeAndFocusContainer",uwo="notebook.cell.executeAndSelectBelow",pwo="notebook.cell.executeAndInsertBelow",bln="notebook.cell.executeCellAndBelow",Sln="notebook.cell.executeCellsAbove",Iln="notebook.renderAllMarkdownCells",yln="notebook.revealRunningCell",wln="notebook.revealLastFailedCell",wfe=C.and(lI.isEqualTo("code"),C.or(C.greater(Vie.key,0),C.greater(NNe.key,0),TKt)),Crt=C.and(wfe,xKt.toNegated()),gwo=C.and(lI.isEqualTo("markup"));function fwo(a){for(let i=0;i<a.notebookEditor.getLength();i++){let e=a.notebookEditor.cellAt(i);e.cellKind===1&&e.updateEditState(0,"renderAllMarkdownCells")}}async function $2t(a,i,e){let t=a.activeGroup;if(t&&t.activeEditor&&t.pinEditor(t.activeEditor),i.autoReveal&&(i.cell||i.selectedCells?.length)&&e&&e.openEditor({resource:i.notebookEditor.textModel.uri,options:{revealIfOpened:!0}}),i.ui&&i.cell)i.autoReveal&&mwo(i.cell,i.notebookEditor),await i.notebookEditor.executeNotebookCells(yt.single(i.cell));else if(i.selectedCells?.length||i.cell){let n=i.selectedCells?.length?i.selectedCells:[i.cell],r=n[0];r&&i.autoReveal&&mwo(r,i.notebookEditor),await i.notebookEditor.executeNotebookCells(n)}let o;for(let[,n]of i.notebookEditor.codeEditors)if(ze(n.getModel()?.uri,(i.cell??i.selectedCells?.[0])?.uri)){o=n;break}}var Cln=20,xln=60;function mwo(a,i){if(i.focusNotebookCell(a,"container",{skipReveal:!0}),a.cellKind===1){let v=i.getCellIndex(a);i.revealCellRangeInView({start:v,end:v+1});return}if(!(a instanceof Ah))return;let e=i.getAbsoluteTopOfElement(a),t=e+a.layoutInfo.outputContainerOffset,o=a.layoutInfo.outputTotalHeight,n=i.getAbsoluteBottomOfElement(a),r=i.getLayoutInfo().height,s=r*.34,l=r*.66,c=a.layoutInfo.totalHeight,u=e>=i.scrollTop&&n<=i.scrollBottom,p=t-25>=i.scrollTop&&t+25<=i.scrollBottom,h=v=>{i.setScrollTop(v-Cln)},g=v=>{i.setScrollTop(v)},f=v=>{i.setScrollTop(v+xln)};if(!u){if(c<=r&&!p){h(e);return}c>r&&!p&&(o>0&&o>=l?g(t-s):o>0?f(n-r):g(t-l))}}W(class extends Np{constructor(){super({id:Iln,title:d(13641,null)})}async runWithContext(i,e){fwo(e)}});W(class extends Np{constructor(){super({id:mln,title:d(13639,null),icon:fIo,metadata:{description:d(13639,null),args:[{name:"uri",description:"The document uri"}]},menu:[{id:R.EditorTitle,order:-1,group:"navigation",when:C.and(nl,C.or(GU.toNegated(),KU.toNegated()),C.notEquals("config.notebook.globalToolbar",!0))},{id:R.NotebookToolbar,order:-1,group:"navigation/execute",when:C.and(C.or(GU.toNegated(),KU.toNegated()),C.and(KU,GU.toNegated())?.negate(),C.equals("config.notebook.globalToolbar",!0))}]})}getEditorContextFromArgsOrActive(i,e){return DKt(i,e)??Uge(i.get(ie))}async runWithContext(i,e){fwo(e);let o=i.get(ie).findEditors({resource:e.notebookEditor.textModel.uri,typeId:Ga.ID,editorId:e.notebookEditor.textModel.viewType}).at(0),n=i.get(kt);return o&&n.getGroup(o.groupId)?.pinEditor(o.editor),e.notebookEditor.executeNotebookCells()}});W(class extends kf{constructor(){super({id:Lso,precondition:Crt,title:d(13633,null),keybinding:{when:Ap,primary:259,win:{primary:2563},weight:ov},menu:{id:R.NotebookCellExecutePrimary,when:Crt,group:"inline"},metadata:{description:d(13633,null),args:Tnt},icon:Iq})}parseArgs(i,...e){return Sq(i,...e)}async runWithContext(i,e){let t=i.get(kt),o=i.get(ie);e.ui&&await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0}),await $2t(t,e,o)}});W(class extends kf{constructor(){super({id:Sln,precondition:wfe,title:d(13634,null),menu:[{id:R.NotebookCellExecute,when:C.and(wfe,C.equals(`config.${Ct.consolidatedRunButton}`,!0))},{id:R.NotebookCellTitle,order:2,group:YW,when:C.and(wfe,C.equals(`config.${Ct.consolidatedRunButton}`,!1))}],icon:mIo})}parseArgs(i,...e){return Sq(i,...e)}async runWithContext(i,e){let t;if(e.ui?(t=e.notebookEditor.getCellIndex(e.cell),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})):t=Math.min(...e.selectedCells.map(o=>e.notebookEditor.getCellIndex(o))),typeof t=="number"){let o={start:0,end:t},n=e.notebookEditor.getCellsInRange(o);e.notebookEditor.executeNotebookCells(n)}}});W(class extends kf{constructor(){super({id:bln,precondition:wfe,title:d(13638,null),menu:[{id:R.NotebookCellExecute,when:C.and(wfe,C.equals(`config.${Ct.consolidatedRunButton}`,!0))},{id:R.NotebookCellTitle,order:3,group:YW,when:C.and(wfe,C.equals(`config.${Ct.consolidatedRunButton}`,!1))}],icon:hIo})}parseArgs(i,...e){return Sq(i,...e)}async runWithContext(i,e){let t;if(e.ui?(t=e.notebookEditor.getCellIndex(e.cell),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})):t=Math.min(...e.selectedCells.map(o=>e.notebookEditor.getCellIndex(o))),typeof t=="number"){let o={start:t,end:e.notebookEditor.getLength()},n=e.notebookEditor.getCellsInRange(o);e.notebookEditor.executeNotebookCells(n)}}});W(class extends kf{constructor(){super({id:vln,precondition:Crt,title:d(13635,null),metadata:{description:d(13635,null),args:Tnt},icon:Iq})}parseArgs(i,...e){return Sq(i,...e)}async runWithContext(i,e){let t=i.get(kt),o=i.get(ie);if(e.ui)await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0});else{let n=e.selectedCells[0];n&&await e.notebookEditor.focusNotebookCell(n,"container",{skipReveal:!0})}await $2t(t,e,o)}});var hwo=C.or(C.equals(Bge.key,"executing"),C.equals(Bge.key,"pending"));W(class extends kf{constructor(){super({id:fln,precondition:hwo,title:d(13631,null),icon:RKt,menu:{id:R.NotebookCellExecutePrimary,when:hwo,group:"inline"},metadata:{description:d(13631,null),args:[{name:"options",description:"The cell range options",schema:{type:"object",required:["ranges"],properties:{ranges:{type:"array",items:[{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}]},document:{type:"object",description:"The document uri"}}}}]}})}parseArgs(i,...e){return Sq(i,...e)}async runWithContext(i,e){return e.ui?(await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0}),e.notebookEditor.cancelNotebookCells(yt.single(e.cell))):e.notebookEditor.cancelNotebookCells(e.selectedCells)}});W(class extends iu{constructor(){super({id:uwo,precondition:C.or(Crt,lI.isEqualTo("markup")),title:d(13637,null),keybinding:{when:C.and(Ap,Nq.negate()),primary:1027,weight:ov}})}async runWithContext(i,e){let t=i.get(kt),o=i.get(ie),n=e.notebookEditor.getCellIndex(e.cell);if(typeof n!="number")return;let r=i.get(Rt),l=i.get(B).getValue(Ct.scrollToRevealCell),c;if(l==="none"?c={skipReveal:!0}:c={revealBehavior:l==="fullCell"?0:1},e.cell.cellKind===1){let u=e.notebookEditor.cellAt(n+1);if(e.cell.updateEditState(0,uwo),u)await e.notebookEditor.focusNotebookCell(u,"container",c);else{let p=YU(r,e.notebookEditor,n,1,"below");p&&await e.notebookEditor.focusNotebookCell(p,"editor",c)}return}else{let u=e.notebookEditor.cellAt(n+1);if(u)await e.notebookEditor.focusNotebookCell(u,"container",c);else{let p=YU(r,e.notebookEditor,n,2,"below");p&&await e.notebookEditor.focusNotebookCell(p,"editor",c)}return $2t(t,e,o)}}});W(class extends iu{constructor(){super({id:pwo,precondition:C.or(Crt,lI.isEqualTo("markup")),title:d(13636,null),keybinding:{when:Ap,primary:515,weight:ov}})}async runWithContext(i,e){let t=i.get(kt),o=i.get(ie),n=e.notebookEditor.getCellIndex(e.cell),r=i.get(Rt),s=e.cell.focusMode===1?"editor":"container",l=YU(r,e.notebookEditor,n,e.cell.cellKind,"below");l&&await e.notebookEditor.focusNotebookCell(l,s),e.cell.cellKind===1?e.cell.updateEditState(0,pwo):$2t(t,e,o)}});var q2t=class extends Np{getEditorContextFromArgsOrActive(i,e){return DKt(i,e)??Uge(i.get(ie))}async runWithContext(i,e){return e.notebookEditor.cancelNotebookCells()}};W(class extends q2t{constructor(){super({id:hln,title:P(13632,"Stop Execution"),icon:RKt,menu:[{id:R.EditorTitle,order:-1,group:"navigation",when:C.and(nl,KU,GU.toNegated(),C.notEquals("config.notebook.globalToolbar",!0))},{id:R.NotebookToolbar,order:-1,group:"navigation/execute",when:C.and(KU,GU.toNegated(),C.equals("config.notebook.globalToolbar",!0))}]})}});W(class extends q2t{constructor(){super({id:gln,title:P(13640,"Interrupt"),precondition:C.and(KU,GU),icon:RKt,menu:[{id:R.EditorTitle,order:-1,group:"navigation",when:C.and(nl,KU,GU,C.notEquals("config.notebook.globalToolbar",!0))},{id:R.NotebookToolbar,order:-1,group:"navigation/execute",when:C.and(KU,GU,C.equals("config.notebook.globalToolbar",!0))},{id:R.InteractiveToolbar,group:"navigation/execute"}]})}});be.appendMenuItem(R.NotebookToolbar,{title:d(13645,null),submenu:R.NotebookCellExecuteGoTo,group:"navigation/execute",order:20,icon:q.modify(FC,"spin")});W(class extends Np{constructor(){super({id:yln,title:d(13644,null),tooltip:d(13644,null),shortTitle:d(13644,null),precondition:wQ,menu:[{id:R.EditorTitle,when:C.and(nl,wQ,C.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:R.NotebookCellExecuteGoTo,when:C.and(nl,wQ,C.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:20},{id:R.InteractiveToolbar,when:C.and(wQ,C.equals("activeEditor","workbench.editor.interactive")),group:"navigation",order:10}],icon:q.modify(FC,"spin")})}async runWithContext(i,e){let t=i.get(Ns),o=e.notebookEditor.textModel.uri,n=t.getCellExecutionsForNotebook(o);if(n[0]){let s=this.findCellAtTopFrame(i,o)??n[0].cellHandle,l=e.notebookEditor.getCellByHandle(s);l&&e.notebookEditor.focusNotebookCell(l,"container")}}findCellAtTopFrame(i,e){let t=i.get(Hi);for(let o of t.getModel().getSessions())for(let n of o.getAllThreads()){let r=n.getTopStackFrame();if(r){let s=sn.parse(r.source.uri);if(s&&s.notebook.toString()===e.toString())return s.handle}}}});W(class extends Np{constructor(){super({id:wln,title:d(13642,null),tooltip:d(13642,null),shortTitle:d(13643,null),precondition:LNe,menu:[{id:R.EditorTitle,when:C.and(nl,LNe,wQ.toNegated(),C.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:R.NotebookCellExecuteGoTo,when:C.and(nl,LNe,wQ.toNegated(),C.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:20}],icon:WNe})}async runWithContext(i,e){let t=i.get(Ns),o=e.notebookEditor.textModel.uri,n=t.getLastFailedCellForNotebook(o);if(n!==void 0){let r=e.notebookEditor.getCellByHandle(n);r&&e.notebookEditor.focusNotebookCell(r,"container")}}});var yw;(i=>i.Id="outline")(yw||={});var j2t=new Y("outlineFollowsCursor",!1),Q2t=new Y("outlineFiltersOnType",!1),iFe=new Y("outlineSortMode",0),xrt=new Y("outlineAllCollapsed",!1),vwo=new Y("outlineFocused",!0);var Rrt=class{constructor(i,e,t,o,n,r){this.container=i;this.iconClass=e;this.iconLabel=t;this.decoration=o;this.actionMenu=n;this.elementDisposables=r}static{this.templateId="NotebookOutlineRenderer"}},krt=class{constructor(i,e,t,o,n,r,s,l){this._editor=i;this._target=e;this._themeService=t;this._configurationService=o;this._contextMenuService=n;this._contextKeyService=r;this._menuService=s;this._instantiationService=l;this.templateId=Rrt.templateId}renderTemplate(i){let e=new O;i.classList.add("notebook-outline-element","show-file-icons");let t=document.createElement("div");i.append(t);let o=new ld(i,{supportHighlights:!0}),n=document.createElement("div");n.className="element-decoration",i.append(n);let r=document.createElement("div");return r.className="action-menu",i.append(r),new Rrt(i,t,o,n,r,e)}renderElement(i,e,t){let o=[],n={matches:Wa(i.filterData),labelEscapeNewLines:!0,extraClasses:o},r=i.element.cell.cellKind===2;i.element.level>=8?t.iconClass.className="element-icon "+q.asClassNameArray(i.element.icon).join(" "):r&&this._themeService.getFileIconTheme().hasFileIcons&&!i.element.isExecuting?(t.iconClass.className="",o.push(...v2(i.element.cell.language??""))):t.iconClass.className="element-icon "+q.asClassNameArray(i.element.icon).join(" "),t.iconLabel.setLabel(" "+i.element.label,void 0,n);let{markerInfo:s}=i.element;if(t.container.style.removeProperty("--outline-element-color"),t.decoration.innerText="",s){let l=this._configurationService.getValue("problems.visibility");!this._configurationService.getValue("outline.problems.badges")||!l?(t.decoration.classList.remove("bubble"),t.decoration.innerText=""):s.count===0?(t.decoration.classList.add("bubble"),t.decoration.innerText="\uEA71"):(t.decoration.classList.remove("bubble"),t.decoration.innerText=s.count>9?"9+":String(s.count));let u=this._themeService.getColorTheme().getColor(s.topSev===8?Ok:tK);if(l===void 0)return;!this._configurationService.getValue("outline.problems.colors")||!l?(t.container.style.removeProperty("--outline-element-color"),t.decoration.style.setProperty("--outline-element-color",u?.toString()??"inherit")):t.container.style.setProperty("--outline-element-color",u?.toString()??"inherit")}if(this._target===1){if(!this._editor)return;let l=i.element.cell,c=this._editor.getViewModel();if(!c)return;let u=c.getCellIndex(l),p=r?0:c.getFoldedLength(u),h=t.elementDisposables.add(this._contextKeyService.createScoped(t.container));Mv.CellKind.bindTo(h).set(r?2:1),Mv.CellHasChildren.bindTo(h).set(p>0),Mv.CellHasHeader.bindTo(h).set(i.element.level!==7),Mv.OutlineElementTarget.bindTo(h).set(this._target),this.setupFolding(r,c,h,t,l);let g=t.elementDisposables.add(new Kp(t.actionMenu,this._contextMenuService,{actionViewItemProvider:b=>{if(b instanceof Do)return this._instantiationService.createInstance(Cl,b,void 0)}})),f=t.elementDisposables.add(this._menuService.createMenu(R.NotebookOutlineActionMenu,h)),v=kMi(f,{notebookEditor:this._editor,outlineEntry:i.element});g.setActions(v.primary,v.secondary),this.setupToolbarListeners(this._editor,g,f,v,i.element,t),t.actionMenu.style.padding="0 0.8em 0 0.4em"}}disposeTemplate(i){i.iconLabel.dispose(),i.elementDisposables.dispose()}disposeElement(i,e,t){t.elementDisposables.clear(),St(t.actionMenu)}setupFolding(i,e,t,o,n){let r=i?0:n.foldingState,s=Mv.CellFoldingState.bindTo(t);s.set(r),i||o.elementDisposables.add(e.onDidFoldingStateChanged(()=>{let l=n.foldingState;Mv.CellFoldingState.bindTo(t).set(l),s.set(l)}))}setupToolbarListeners(i,e,t,o,n,r){let s=!1,l;e.setActions(o.primary,o.secondary),r.elementDisposables.add(t.onDidChange(()=>{if(s){let u=kMi(t,{notebookEditor:i,outlineEntry:n});l=()=>e.setActions(u.primary,u.secondary);return}let c=kMi(t,{notebookEditor:i,outlineEntry:n});e.setActions(c.primary,c.secondary)})),r.container.classList.remove("notebook-outline-toolbar-dropdown-active"),r.elementDisposables.add(e.onDidChangeDropdownVisibility(c=>{s=c,c?r.container.classList.add("notebook-outline-toolbar-dropdown-active"):r.container.classList.remove("notebook-outline-toolbar-dropdown-active"),l&&!c&&(Zo(()=>{l?.()},0,r.elementDisposables),l=void 0)}))}};krt=I([m(2,Pe),m(3,B),m(4,Xe),m(5,X),m(6,Yt),m(7,F)],krt);function kMi(a,i){return xl(a.getActions({shouldForwardArgs:!0,arg:i}),e=>/^inline/.test(e))}var EMi=class{getAriaLabel(i){return i.label}getWidgetAriaLabel(){return""}},TMi=class{getKeyboardNavigationLabel(i){return i.label}},_Mi=class{getHeight(i){return 22}getTemplateId(i){return Rrt.templateId}},Ert=class{constructor(i,e,t){this.notebookCellOutlineDataSourceRef=i;this._configurationService=e;this._themeService=t;this._disposables=new O;this.gotoShowCodeCellSymbols=this._configurationService.getValue(Ct.gotoSymbolsAllSymbols),this._disposables.add(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(Ct.gotoSymbolsAllSymbols)&&(this.gotoShowCodeCellSymbols=this._configurationService.getValue(Ct.gotoSymbolsAllSymbols))}))}getQuickPickElements(){let i=[];for(let r of this.notebookCellOutlineDataSourceRef?.object?.entries??[])r.asFlatList(i);let e=[],{hasFileIcons:t}=this._themeService.getFileIconTheme(),o=r=>!!r.symbolKind,n=r=>r.cell.cellKind===2&&r.level===7;for(let r=0;r<i.length;r++){let s=i[r],l=i[r+1];if(!this.gotoShowCodeCellSymbols&&o(s)||this.gotoShowCodeCellSymbols&&n(s)&&l&&o(l))continue;let c=t&&!s.symbolKind;e.push({element:s,label:c?s.label:`$(${s.icon.id}) ${s.label}`,ariaLabel:s.label,iconClasses:c?v2(s.cell.language??""):void 0})}return e}dispose(){this._disposables.dispose()}};Ert=I([m(1,B),m(2,Pe)],Ert);function DMi(a,i,e,t){return!!(i&&a.cell.cellKind===1&&a.level===7||!e&&a.cell.cellKind===2||!t&&a.cell.cellKind===2&&a.level>7)}var Trt=class{constructor(i,e){this.outlineDataSourceRef=i;this._configurationService=e;this._disposables=new O;this.showCodeCells=this._configurationService.getValue(Ct.outlineShowCodeCells),this.showCodeCellSymbols=this._configurationService.getValue(Ct.outlineShowCodeCellSymbols),this.showMarkdownHeadersOnly=this._configurationService.getValue(Ct.outlineShowMarkdownHeadersOnly),this._disposables.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(Ct.outlineShowCodeCells)&&(this.showCodeCells=this._configurationService.getValue(Ct.outlineShowCodeCells)),t.affectsConfiguration(Ct.outlineShowCodeCellSymbols)&&(this.showCodeCellSymbols=this._configurationService.getValue(Ct.outlineShowCodeCellSymbols)),t.affectsConfiguration(Ct.outlineShowMarkdownHeadersOnly)&&(this.showMarkdownHeadersOnly=this._configurationService.getValue(Ct.outlineShowMarkdownHeadersOnly))}))}getActiveEntry(){let i=this.outlineDataSourceRef?.object?.activeElement;if(!i)return;if(!DMi(i,this.showMarkdownHeadersOnly,this.showCodeCells,this.showCodeCellSymbols))return i;let e=i.parent;for(;e;)if(DMi(e,this.showMarkdownHeadersOnly,this.showCodeCells,this.showCodeCellSymbols))e=e.parent;else return e}*getChildren(i){let t=i instanceof oFe?this.outlineDataSourceRef?.object?.entries??[]:i.children;for(let o of t)o.cell.cellKind===1?this.showMarkdownHeadersOnly?o.level<7&&(yield o):yield o:this.showCodeCells&&o.cell.cellKind===2&&(this.showCodeCellSymbols?yield o:o.level===7&&(yield o))}dispose(){this._disposables.dispose()}};Trt=I([m(1,B)],Trt);var _rt=class{constructor(i,e){this.outlineDataSourceRef=i;this._configurationService=e;this._disposables=new O;this.showCodeCells=this._configurationService.getValue(Ct.breadcrumbsShowCodeCells),this._disposables.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(Ct.breadcrumbsShowCodeCells)&&(this.showCodeCells=this._configurationService.getValue(Ct.breadcrumbsShowCodeCells))}))}getBreadcrumbElements(){let i=[],e=this.outlineDataSourceRef?.object?.activeElement;for(;e;)(this.showCodeCells||e.cell.cellKind!==2)&&i.unshift({element:e,label:e.label}),e=e.parent;return i}dispose(){this._disposables.dispose()}};_rt=I([m(1,B)],_rt);var RMi=class{constructor(){this._collator=nd.Collator(void 0,{numeric:!0})}compareByPosition(i,e){return i.index-e.index}compareByType(i,e){return i.cell.cellKind-e.cell.cellKind||this._collator.value.compare(i.label,e.label)}compareByName(i,e){return this._collator.value.compare(i.label,e.label)}},oFe=class{constructor(i,e,t,o,n,r,s,l){this._editor=i;this._target=e;this._themeService=t;this._editorService=o;this._instantiationService=n;this._configurationService=r;this._languageFeaturesService=s;this._notebookExecutionStateService=l;this.outlineKind="notebookCells";this._disposables=new O;this._modelDisposables=new O;this._dataSourceDisposables=new O;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this.delayerRecomputeState=this._disposables.add(new rn(300));this.delayerRecomputeActive=this._disposables.add(new rn(200));this.delayerRecomputeSymbols=this._disposables.add(new rn(2e3));this.outlineShowCodeCells=this._configurationService.getValue(Ct.outlineShowCodeCells),this.outlineShowCodeCellSymbols=this._configurationService.getValue(Ct.outlineShowCodeCellSymbols),this.outlineShowMarkdownHeadersOnly=this._configurationService.getValue(Ct.outlineShowMarkdownHeadersOnly),this.initializeOutline();let c=new _Mi,u=[this._instantiationService.createInstance(krt,this._editor.getControl(),this._target)],p=new RMi,h={collapseByDefault:this._target===2||this._target===1&&this._configurationService.getValue("outline.collapseItems")==="alwaysCollapse",expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,accessibilityProvider:new EMi,identityProvider:{getId:g=>g.cell.uri.toString()},keyboardNavigationLabelProvider:new TMi};this.config={treeDataSource:this._treeDataSource,quickPickDataSource:this._quickPickDataSource,breadcrumbsDataSource:this._breadcrumbsDataSource,delegate:c,renderers:u,comparator:p,options:h}}get activeElement(){if(this.checkDelayer(),this._target===1)return this.config.treeDataSource.getActiveEntry();console.error("activeElement should not be called outside of the OutlinePane")}get entries(){return this.checkDelayer(),this._outlineDataSourceReference?.object?.entries??[]}get uri(){return this._outlineDataSourceReference?.object?.uri}get isEmpty(){return this._outlineDataSourceReference?.object?.entries?!this._outlineDataSourceReference.object.entries.some(i=>!DMi(i,this.outlineShowMarkdownHeadersOnly,this.outlineShowCodeCells,this.outlineShowCodeCellSymbols)):!0}checkDelayer(){this.delayerRecomputeState.isTriggered()&&(this.delayerRecomputeState.cancel(),this.recomputeState())}initializeOutline(){this.setDataSources(),this.setModelListeners(),this._disposables.add(this._editor.onDidChangeModel(()=>{this.setDataSources(),this.setModelListeners(),this.computeSymbols()})),this._disposables.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this.delayedComputeSymbols()})),this._disposables.add(this._editor.onDidChangeSelection(()=>{this.delayedRecomputeActive()})),this._disposables.add(this._configurationService.onDidChangeConfiguration(i=>{(i.affectsConfiguration(Ct.outlineShowMarkdownHeadersOnly)||i.affectsConfiguration(Ct.outlineShowCodeCells)||i.affectsConfiguration(Ct.outlineShowCodeCellSymbols)||i.affectsConfiguration(Ct.breadcrumbsShowCodeCells))&&(this.outlineShowCodeCells=this._configurationService.getValue(Ct.outlineShowCodeCells),this.outlineShowCodeCellSymbols=this._configurationService.getValue(Ct.outlineShowCodeCellSymbols),this.outlineShowMarkdownHeadersOnly=this._configurationService.getValue(Ct.outlineShowMarkdownHeadersOnly),this.delayedRecomputeState())})),this._disposables.add(this._notebookExecutionStateService.onDidChangeExecution(i=>{i.type===0&&this._editor.textModel&&i.affectsNotebook(this._editor.textModel?.uri)&&this.delayedRecomputeState()})),this._disposables.add(this._configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(Ct.outlineShowCodeCellSymbols)&&(this.outlineShowCodeCellSymbols=this._configurationService.getValue(Ct.outlineShowCodeCellSymbols),this.computeSymbols())})),this._disposables.add(this._themeService.onDidFileIconThemeChange(()=>{this._onDidChange.fire({})})),this.recomputeState()}setDataSources(){let i=this._editor.getControl();this._outlineDataSourceReference?.dispose(),this._dataSourceDisposables.clear(),i?.hasModel()?(this._outlineDataSourceReference=this._dataSourceDisposables.add(this._instantiationService.invokeFunction(e=>e.get(TOe).getOrCreate(i))),this._dataSourceDisposables.add(this._outlineDataSourceReference.object.onDidChange(()=>{this._onDidChange.fire({})}))):this._outlineDataSourceReference=void 0,this._treeDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(Trt,this._outlineDataSourceReference)),this._quickPickDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(Ert,this._outlineDataSourceReference)),this._breadcrumbsDataSource=this._dataSourceDisposables.add(this._instantiationService.createInstance(_rt,this._outlineDataSourceReference))}setModelListeners(){this._modelDisposables.clear(),this._editor.textModel&&(this.entries.length||this.computeSymbols(),this._modelDisposables.add(this._editor.textModel.onDidChangeContent(i=>{i.rawEvents.some(e=>e.kind===10||e.kind===12||e.kind===2||e.kind===1)&&this.delayedRecomputeState()})))}async computeSymbols(i=Ie.None){this._target===1&&this.outlineShowCodeCellSymbols&&this.doComputeSymbols(i)}async doComputeSymbols(i){await this._outlineDataSourceReference?.object?.computeFullSymbols(i)}async delayedComputeSymbols(){this.delayerRecomputeState.cancel(),this.delayerRecomputeActive.cancel(),this.delayerRecomputeSymbols.trigger(()=>{this.computeSymbols()})}recomputeState(){this._outlineDataSourceReference?.object?.recomputeState()}delayedRecomputeState(){this.delayerRecomputeActive.cancel(),this.delayerRecomputeState.trigger(()=>{this.recomputeState()})}recomputeActive(){this._outlineDataSourceReference?.object?.recomputeActive()}delayedRecomputeActive(){this.delayerRecomputeActive.trigger(()=>{this.recomputeActive()})}async reveal(i,e,t){let o={...e,override:this._editor.input?.editorId,cellRevealType:2,selection:i.position,viewState:void 0};await this._editorService.openEditor({resource:i.cell.uri,options:o},t?En:void 0)}preview(i){let e=this._editor.getControl();if(!e)return k.None;if(i.range){let n=G.lift(i.range);e.revealRangeInCenterIfOutsideViewportAsync(i.cell,n)}else e.revealInCenterIfOutsideViewport(i.cell);let t=e.deltaCellDecorations([],[{handle:i.cell.handle,options:{className:"nb-symbolHighlight",outputClassName:"nb-symbolHighlight"}}]),o;return e.changeModelDecorations(n=>{if(i.range){let r=[{range:i.range,options:{description:"document-symbols-outline-range-highlight",className:"rangeHighlight",isWholeLine:!0}}],s={ownerId:i.cell.handle,decorations:r};o=n.deltaDecorations([],[s])}}),ee(()=>{e.deltaCellDecorations(t,[]),o?.length&&e.changeModelDecorations(n=>{n.deltaDecorations(o,[])})})}captureViewState(){let i=this._editor.getControl(),e=i?.getEditorViewState();return ee(()=>{e&&i?.restoreListViewState(e)})}dispose(){this._onDidChange.dispose(),this._disposables.dispose(),this._modelDisposables.dispose(),this._dataSourceDisposables.dispose(),this._outlineDataSourceReference?.dispose()}};oFe=I([m(2,Pe),m(3,ie),m(4,F),m(5,B),m(6,Jt),m(7,Ns)],oFe);var Drt=class{constructor(i,e){this._instantiationService=e;let t=i.registerOutlineCreator(this);this.dispose=()=>t.dispose()}matches(i){return i.getId()===UR.ID}async createOutline(i,e,t){let o=this._instantiationService.createInstance(oFe,i,e);return e===4&&await o.doComputeSymbols(t),o}};Drt=I([m(0,sP),m(1,F)],Drt);var Mv={CellKind:new Y("notebookCellKind",void 0),CellHasChildren:new Y("notebookCellHasChildren",!1),CellHasHeader:new Y("notebookCellHasHeader",!1),CellFoldingState:new Y("notebookCellFoldingState",0),OutlineElementTarget:new Y("notebookOutlineElementTarget",void 0)};oe.as(Zi.Workbench).registerWorkbenchContribution(Drt,4);oe.as($t.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{[Ct.outlineShowMarkdownHeadersOnly]:{type:"boolean",default:!0,markdownDescription:d(13563,null)},[Ct.outlineShowCodeCells]:{type:"boolean",default:!1,markdownDescription:d(13561,null)},[Ct.outlineShowCodeCellSymbols]:{type:"boolean",default:!0,markdownDescription:d(13562,null)},[Ct.breadcrumbsShowCodeCells]:{type:"boolean",default:!0,markdownDescription:d(13558,null)},[Ct.gotoSymbolsAllSymbols]:{type:"boolean",default:!0,markdownDescription:d(13560,null)}}});be.appendMenuItem(R.ViewTitle,{submenu:R.NotebookOutlineFilter,title:d(13559,null),icon:L.filter,group:"navigation",order:-1,when:C.and(C.equals("view",yw.Id),nl)});W(class extends z{constructor(){super({id:"notebook.outline.toggleShowMarkdownHeadersOnly",title:d(13566,null),f1:!1,toggled:{condition:C.equals("config.notebook.outline.showMarkdownHeadersOnly",!0)},menu:{id:R.NotebookOutlineFilter,group:"0_markdown_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(Ct.outlineShowMarkdownHeadersOnly);t.updateValue(Ct.outlineShowMarkdownHeadersOnly,!o)}});W(class extends z{constructor(){super({id:"notebook.outline.toggleCodeCells",title:d(13564,null),f1:!1,toggled:{condition:C.equals("config.notebook.outline.showCodeCells",!0)},menu:{id:R.NotebookOutlineFilter,order:1,group:"1_code_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(Ct.outlineShowCodeCells);t.updateValue(Ct.outlineShowCodeCells,!o)}});W(class extends z{constructor(){super({id:"notebook.outline.toggleCodeCellSymbols",title:d(13565,null),f1:!1,toggled:{condition:C.equals("config.notebook.outline.showCodeCellSymbols",!0)},menu:{id:R.NotebookOutlineFilter,order:2,group:"1_code_cells"}})}run(i,...e){let t=i.get(B),o=t.getValue(Ct.outlineShowCodeCellSymbols);t.updateValue(Ct.outlineShowCodeCellSymbols,!o)}});var LMi=class extends z{constructor(){super({id:"notebook.section.runSingleCell",title:{...P(13699,"Run Cell"),mnemonicTitle:d(13697,null)},shortTitle:d(13700,null),icon:Iq,menu:[{id:R.NotebookOutlineActionMenu,group:"inline",order:1,when:C.and(Mv.CellKind.isEqualTo(2),Mv.OutlineElementTarget.isEqualTo(1),Mv.CellHasChildren.toNegated(),Mv.CellHasHeader.toNegated())}]})}async run(i,e){Y2t(e)&&e.notebookEditor.executeNotebookCells([e.outlineEntry.cell])}},MMi=class extends z{constructor(){super({id:"notebook.section.runCells",title:{...P(13701,"Run Cells In Section"),mnemonicTitle:d(13698,null)},shortTitle:d(13702,null),icon:Iq,menu:[{id:R.NotebookStickyScrollContext,group:"notebookExecution",order:1},{id:R.NotebookOutlineActionMenu,group:"inline",order:1,when:C.and(Mv.CellKind.isEqualTo(1),Mv.OutlineElementTarget.isEqualTo(1),Mv.CellHasChildren,Mv.CellHasHeader)},{id:R.NotebookCellTitle,order:0,group:YW,when:gwo}]})}async run(i,e){let t;if(Y2t(e))t=e.outlineEntry.cell;else if(Eln(e))t=e.cell;else return;t.getEditState()===1&&e.notebookEditor.getContribution(xP.id).recompute();let o=e.notebookEditor.getViewModel()?.getCellIndex(t);if(o===void 0)return;let n=e.notebookEditor.getViewModel()?.getFoldingStartIndex(o);if(n===void 0)return;let r=e.notebookEditor.getViewModel()?.getFoldedLength(n);if(r===void 0)return;let s=e.notebookEditor.getCellsInRange({start:n,end:n+r+1});e.notebookEditor.executeNotebookCells(s)}},PMi=class extends z{constructor(){super({id:"notebook.section.foldSection",title:{...P(13693,"Fold Section"),mnemonicTitle:d(13696,null)},shortTitle:d(13694,null),menu:[{id:R.NotebookOutlineActionMenu,group:"notebookFolding",order:2,when:C.and(Mv.CellKind.isEqualTo(1),Mv.OutlineElementTarget.isEqualTo(1),Mv.CellHasChildren,Mv.CellHasHeader,Mv.CellFoldingState.isEqualTo(1))}]})}async run(i,e){Y2t(e)&&this.toggleFoldRange(e.outlineEntry,e.notebookEditor)}toggleFoldRange(i,e){let t=e.getContribution(xP.id),o=i.index,n=i.level,r=2;t.setFoldingStateDown(o,r,n)}},AMi=class extends z{constructor(){super({id:"notebook.section.expandSection",title:{...P(13691,"Expand Section"),mnemonicTitle:d(13695,null)},shortTitle:d(13692,null),menu:[{id:R.NotebookOutlineActionMenu,group:"notebookFolding",order:2,when:C.and(Mv.CellKind.isEqualTo(1),Mv.OutlineElementTarget.isEqualTo(1),Mv.CellHasChildren,Mv.CellHasHeader,Mv.CellFoldingState.isEqualTo(2))}]})}async run(i,e){Y2t(e)&&this.toggleFoldRange(e.outlineEntry,e.notebookEditor)}toggleFoldRange(i,e){let t=e.getContribution(xP.id),o=i.index,n=i.level,r=1;t.setFoldingStateDown(o,r,n)}};function Y2t(a){return!!(a&&a.notebookEditor&&a.outlineEntry)}function Eln(a){return!!(a&&a.notebookEditor&&a.cell)}W(LMi);W(MMi);W(PMi);W(AMi);W(class extends z{constructor(){super({id:"workbench.notebook.layout.select",title:P(13682,"Select between Notebook Layouts"),f1:!0,precondition:C.equals(`config.${Ct.openGettingStarted}`,!0),category:Ph,menu:[{id:R.EditorTitle,group:"notebookLayout",when:C.and(nl,C.notEquals("config.notebook.globalToolbar",!0),C.equals(`config.${Ct.openGettingStarted}`,!0)),order:0},{id:R.NotebookToolbar,group:"notebookLayout",when:C.and(C.equals("config.notebook.globalToolbar",!0),C.equals(`config.${Ct.openGettingStarted}`,!0)),order:0}]})}run(i){i.get(fe).executeCommand("workbench.action.openWalkthrough",{category:"notebooks",step:"notebookProfile"},!0)}});W(class extends z{constructor(){super({id:"workbench.notebook.layout.configure",title:P(13681,"Customize Notebook Layout"),f1:!0,category:Ph,menu:[{id:R.NotebookToolbar,group:"notebookLayout",when:C.equals("config.notebook.globalToolbar",!0),order:1}]})}run(i){i.get(Qo).openSettings({jsonEditor:!1,query:"@tag:notebookLayout"})}});W(class extends z{constructor(){super({id:"workbench.notebook.layout.configure.editorTitle",title:P(13681,"Customize Notebook Layout"),f1:!1,category:Ph,menu:[{id:R.NotebookEditorLayoutConfigure,group:"notebookLayout",when:nl,order:1}]})}run(i){i.get(Qo).openSettings({jsonEditor:!1,query:"@tag:notebookLayout"})}});be.appendMenuItem(R.EditorTitle,{submenu:R.NotebookEditorLayoutConfigure,title:P(13666,"Customize Notebook..."),icon:L.gear,group:"navigation",order:-1,when:nl});W(class extends z{constructor(){super({id:"notebook.toggleLineNumbersFromEditorTitle",title:P(13674,"Toggle Notebook Line Numbers"),shortTitle:P(13675,"Line Numbers"),precondition:wr,menu:[{id:R.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:1,when:nl}],category:Ph,f1:!0,toggled:{condition:C.notEquals("config.notebook.lineNumbers","off"),title:d(13670,null)}})}async run(i){return i.get(fe).executeCommand("notebook.toggleLineNumbers")}});W(class extends z{constructor(){super({id:"notebook.toggleCellToolbarPositionFromEditorTitle",title:P(13673,"Toggle Cell Toolbar Position"),menu:[{id:R.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:3}],category:Ph,f1:!1})}async run(i,...e){return i.get(fe).executeCommand("notebook.toggleCellToolbarPosition",...e)}});W(class extends z{constructor(){super({id:"breadcrumbs.toggleFromEditorTitle",title:P(13671,"Toggle Breadcrumbs"),shortTitle:P(13672,"Breadcrumbs"),toggled:{condition:C.equals("config.breadcrumbs.enabled",!0),title:d(13665,null)},menu:[{id:R.NotebookEditorLayoutConfigure,group:"notebookLayoutDetails",order:2}],category:Ph,f1:!1})}async run(i){return i.get(fe).executeCommand("breadcrumbs.toggle")}});W(class extends z{constructor(){super({id:"notebook.saveMimeTypeOrder",title:P(13669,"Save Mimetype Display Order"),f1:!0,category:Ph,precondition:nl})}run(i){let e=i.get(kn),t=new O,o=t.add(i.get($e).createQuickPick());o.placeholder=d(13668,null),o.items=[{target:2,label:d(13677,null)},{target:5,label:d(13678,null)}],t.add(o.onDidAccept(()=>{let n=o.selectedItems[0]?.target;n!==void 0&&e.saveMimeDisplayOrder(n),o.dispose()})),t.add(o.onDidHide(()=>t.dispose())),o.show()}});W(class extends z{constructor(){super({id:"workbench.notebook.layout.webview.reset",title:P(13683,"Reset Notebook Webview"),f1:!1,category:Ph})}run(i,e){let t=i.get(ie);if(e){let o=A.revive(e),r=i.get(hd).listNotebookEditors().filter(s=>s.hasModel()&&s.textModel.uri.toString()===o.toString());for(let s of r)s.hasModel()&&s.getInnerWebview()?.reload()}else{let o=lr(t.activeEditorPane);if(!o)return;o.getInnerWebview()?.reload()}}});W(class extends z{constructor(){super({id:"notebook.action.toggleNotebookStickyScroll",title:{...P(13679,"Toggle Notebook Sticky Scroll"),mnemonicTitle:d(13667,null)},shortTitle:P(13680,"Sticky Scroll"),category:Fe.View,toggled:{condition:C.equals("config.notebook.stickyScroll.enabled",!0),title:d(13676,null),mnemonicTitle:d(13667,null)},menu:[{id:R.CommandPalette},{id:R.NotebookStickyScrollContext,group:"notebookView",order:2},{id:R.NotebookToolbarContext,group:"notebookView",order:2}]})}async run(i){let e=i.get(B),t=!e.getValue("notebook.stickyScroll.enabled");return e.updateValue("notebook.stickyScroll.enabled",t)}});var Lrt=class extends Cl{$d=this._store.add(new ue);$e;$f;constructor(i,e,t,o,n,r,s,l,c){let u=new class extends Do{constructor(){super(i.item,i.alt?.item,{},i.hideActions,i.menuKeybinding,n,c);this.elementGetter=()=>{}}async run(...h){let g=Rm.get(e),f=g?.lightBulbState.get(),v=this.elementGetter();if(g&&f&&v){let{bottom:b,left:S}=v.getBoundingClientRect();await g.showCodeActions(f.trigger,f.actions,{x:S,y:b})}}};super(u,{draggable:!1},t,o,n,r,s,l),this.$f=e,u.elementGetter=()=>this.element}render(i){super.render(i),this.$g()}getTooltip(){return this.$e??super.getTooltip()}$g(){let i=Rm.get(this.$f);if(!i)return;let e=new O;this.$d.value=e,e.add(ve(t=>{let o=i.lightBulbState.read(t);if(this.label){let n=o?.icon??L.lightBulb,r=q.asClassNameArray(n);this.label.className="",this.label.classList.add("codicon","action-label",...r)}this.$e=o?.title,this.updateTooltip()}))}};Lrt=I([m(2,Le),m(3,Ne),m(4,X),m(5,Pe),m(6,Xe),m(7,Ai),m(8,fe)],Lrt);var Mrt=class extends Cl{$h;constructor(i,e,t,o,n,r,s){super(i,{draggable:!1},e,t,o,n,r,s),this.options.label=!0,this.options.icon=!1,this.$h=e.lookupKeybinding(i.id)?.getLabel()??void 0}updateLabel(){this.label&&Ii(this.label,this.action.label,...this.$h?[_("span.inline-chat-keybinding",void 0,this.$h)]:[])}};Mrt=I([m(1,Le),m(2,Ne),m(3,X),m(4,Pe),m(5,Xe),m(6,Ai)],Mrt);var goe=class extends k{constructor(e,t,o){super();this.$j=`inline-chat-content-widget-${goe.$i++}`;this.$l=null;this.$m=!1;this.$n=this._store.add(new T);this.onDidRunAction=this.$n.event;this.allowEditorOverflow=!0;this.suppressMouseDown=!1;this.$o=e,this.$k=_(".inline-chat-content-widget");let n=this._store.add(o.createInstance(pr,this.$k,R.InlineChatEditorAffordance,{telemetrySource:"inlineChatEditorAffordance",hiddenItemStrategy:0,menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},actionViewItemProvider:r=>{if(r instanceof Do&&r.id===UK)return o.createInstance(Lrt,r,this.$o);if(r instanceof Do&&(r.id===JQ||r.id===G2t||r.id==="inlineChat.fixDiagnostics"))return o.createInstance(Mrt,r)}}));this._store.add(n.actionRunner.onDidRun(r=>{this.$n.fire(r.action.id),this.$t()})),this._store.add(ve(r=>{let s=t.read(r);s?this.$p(s):this.$t()})),this._store.add(this.$o.onDidScrollChange(()=>{let r=t.get();if(!r)return;let s=this.$s();s&&!this.$m?this.$p(r):!s&&this.$m&&this.$t()}))}static $i=0;$j;$k;$l;$m;$n;$o;$p(e){e.isEmpty()?this.$r(e.getPosition().lineNumber):this.$q(e),this.$m?this.$o.layoutContentWidget(this):(this.$o.addContentWidget(this),this.$m=!0)}$q(e){let t=e.getPosition(),n=e.getDirection()===1?1:2;this.$l={position:t,preference:[n]}}$r(e){let t=this.$o.getModel();if(!t)return;let o=t.getOptions().tabSize,n=this.$o.getOptions().get(59),r=t.getLineContent(e),s=H5(r,o),l=s<0?!0:n.spaceWidth*s>22,c=e;if(!l){let p=g=>{let f=t.getLineContent(g);return/^\s*$|^\s+/.test(f)},h=t.getLineCount();e>1&&p(e-1)?c=e-1:e<h&&p(e+1)&&(c=e+1)}let u=/^\S\s*$/.test(t.getLineContent(c))?2:1;this.$l={position:{lineNumber:c,column:u},preference:[0]}}$s(){let e=this.$l?.position;if(!e||!this.$o.getVisibleRanges().some(s=>e.lineNumber>=s.startLineNumber&&e.lineNumber<=s.endLineNumber))return!1;let n=this.$o.getScrolledVisiblePosition(e);if(!n)return!1;let r=this.$o.getOptions().get(165);return n.left>=0&&n.left<=r.width}$t(){this.$m&&(this.$m=!1,this.$o.removeContentWidget(this))}getId(){return this.$j}getDomNode(){return this.$k}getPosition(){return this.$l}beforeRender(){let e=this.$o.getPosition(),t=e?this.$o.getLineHeightForPosition(e):this.$o.getOption(75);return this.$k.style.setProperty("--vscode-inline-chat-affordance-height",`${t}px`),null}dispose(){this.$m&&this.$o.removeContentWidget(this),super.dispose()}};goe=I([m(2,F)],goe);var nFe=class extends k{$u;$v;$w=De(this,void 0);constructor(i,e,t,o,n,r,s){super(),this.$u=i,this.$v=e;let l=Ds(this.$u),c=hr("inlineChat.affordance","off",t),u=vA(l.cursorSelection,500),p=this.$w,h=K2t.bindTo(s);this._store.add({dispose:()=>h.reset()});let g=!1,f;this._store.add(Zs(l.selections,(S,y,w)=>{g=w.every(x=>x.reason===3),(!S||S.length!==1||S[0].isEmpty()||!g)&&p.set(void 0,void 0)})),this._store.add(ve(S=>{let y=u.read(S);if(!y||y.isEmpty()||!g||this.$u.getModel()?.getValueInRange(y).match(/^\s+$/)){p.set(void 0,void 0),f=void 0;return}f=ht();let w=c.read(void 0);w==="editor"&&r.publicLog2("inlineChatAffordance/shown",{mode:w,id:f,commandId:""}),p.set(y,void 0)})),this._store.add(ve(S=>{o.sentimentObs.read(S).hidden&&p.set(void 0,void 0)}));let v=ke(S=>{qr(this,n.onDidChangeSessions).read(S);let y=l.model.read(S);return y?n.getSessionByTextModel(y.uri)!==void 0:!1});this._store.add(ve(S=>{v.read(S)&&p.set(void 0,void 0)})),this._store.add(this.$u.onContextMenu(()=>{p.set(void 0,void 0)})),this._store.add(ve(S=>{l.isFocused.read(S)||p.set(void 0,void 0)})),this._store.add(ve(S=>{let y=p.read(S),w=c.read(S);h.set(y!==void 0&&w==="editor")}));let b=this.$v.createInstance(goe,this.$u,ke(S=>c.read(S)==="editor"?p.read(S):void 0));this._store.add(b),this._store.add(b.onDidRunAction(S=>{f&&r.publicLog2("inlineChatAffordance/selected",{mode:c.get(),id:f,commandId:S})})),this._store.add(ve(S=>{let w=c.read(S)==="editor",x=Rm.get(this.$u);x&&(x.onlyLightBulbWithEmptySelection=w)}))}dismiss(){this.$w.set(void 0,void 0)}};nFe=I([m(1,F),m(2,B),m(3,dr),m(4,cy),m(5,_e),m(6,X)],nFe);var Prt=class extends sC{constructor(e,t,o,n,r,s){super(e);this._options=t;this._contextMenuService=o;this._keybindingService=n;this._hoverService=s;this._store=new O;this._updateStore=new O;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._actionRunner=this._store.add(new cs),t?.telemetrySource&&this._actionRunner.onDidRun(l=>{r.publicLog2("workbenchActionExecuted",{id:l.action.id,from:t.telemetrySource})},void 0,this._store)}get onWillRun(){return this._actionRunner.onWillRun}get onDidRun(){return this._actionRunner.onDidRun}dispose(){this._onDidChange.dispose(),this._updateStore.dispose(),this._store.dispose(),super.dispose()}update(e,t){let o=this._options?.buttonConfigProvider??(()=>({showLabel:!0}));this._updateStore.clear(),this.clear();let n=this._updateStore.add(Dg());for(let r=0;r<e.length;r++){let s=r>0,l=e[r],c,u,p;if(l instanceof sa&&l.actions.length>1){let[x,...E]=l.actions;c=x,p=c.tooltip||c.label,p=this._keybindingService.appendKeybinding(p,c.id),u=this.addButtonWithDropdown({secondary:o(c,r)?.isSecondary??s,actionRunner:this._actionRunner,actions:E,contextMenuProvider:this._contextMenuService,ariaLabel:p,supportIcons:!0,small:this._options?.small})}else c=l instanceof sa&&l.actions.length===1?l.actions[0]:l,p=c.tooltip||c.label,p=this._keybindingService.appendKeybinding(p,c.id),u=this.addButton({secondary:o(c,r)?.isSecondary??s,ariaLabel:p,supportIcons:!0,small:this._options?.small});u.enabled=c.enabled,u.checked=c.checked??!1,u.element.classList.add("default-colors");let h=o(c,r),g=h?.showLabel??!0,f=h?.showIcon,v=h?.customClass,b=h?.customLabel,S=h?.customLabelObs;v&&u.element.classList.add(v);let y=x=>f&&c instanceof Do&&q.isThemeIcon(c.item.icon)&&g?yr(x)?new he(`$(${c.item.icon.id}) ${x.value}`,{isTrusted:x.isTrusted,supportThemeIcons:!0,supportHtml:x.supportHtml}):`$(${c.item.icon.id}) ${x}`:x,w=x=>{g&&(u.label=y(x));let E=Du(ma(x)),M=this._keybindingService.appendKeybinding(E,c.id);u.setTitle(M),u.setAriaLabel(M)};g?u.label=y(b??c.label):u.element.classList.add("monaco-text-button"),f&&(c instanceof Do&&q.isThemeIcon(c.item.icon)?g||(u.icon=c.item.icon):c.class&&u.element.classList.add(...c.class.split(" "))),S&&this._updateStore.add(ve(x=>{let E=S.read(x);w(E??b??c.label)})),this._updateStore.add(this._hoverService.setupManagedHover(n,u.element,p)),this._updateStore.add(u.onDidClick(async()=>{if(this._options?.disableWhileRunning){u.enabled=!1;try{await this._actionRunner.run(c)}finally{u.enabled=c.enabled}}else this._actionRunner.run(c)}))}if(t.length>0){let r=this.addButton({secondary:!0,ariaLabel:d(1821,null),small:this._options?.small});r.icon=L.dropDownButton,r.element.classList.add("default-colors","monaco-text-button"),r.enabled=!0,this._updateStore.add(this._hoverService.setupManagedHover(n,r.element,d(1821,null))),this._updateStore.add(r.onDidClick(async()=>{this._contextMenuService.showContextMenu({getAnchor:()=>r.element,getActions:()=>t,actionRunner:this._actionRunner,onHide:()=>r.element.setAttribute("aria-expanded","false")}),r.element.setAttribute("aria-expanded","true")}))}this._onDidChange.fire(this)}};Prt=I([m(2,Xe),m(3,Le),m(4,_e),m(5,ot)],Prt);var Oq=class extends Prt{constructor(i,e,t,o,n,r,s,l,c){super(i,t,r,s,l,c);let u=o.createMenu(e,n);this._store.add(u);let p=()=>{this.clear();let h=xl(u.getActions(t?.menuOptions),t?.toolbarOptions?.primaryGroup);super.update(h.primary,h.secondary)};this._store.add(u.onDidChange(p)),p()}dispose(){super.dispose()}update(i){throw new Error("Use Menu or WorkbenchButtonBar")}};Oq=I([m(3,Yt),m(4,X),m(5,Xe),m(6,Le),m(7,_e),m(8,ot)],Oq);var X2t=le("chatLayoutService");var Art=["text/plain","text/html","application/vnd.code.notebook.error","application/vnd.code.notebook.stdout","application/x.notebook.stdout","application/x.notebook.stream","application/vnd.code.notebook.stderr","application/x.notebook.stderr","image/png","image/jpeg","image/svg"];function J2t(a,i,e){let t=a.cellViewModel.handle,o=e.textModel,n=e.getCellByHandle(t);if(!n||n.outputsViewModels.length===0||!o)return;let r=o.uri,s=n.uri,l=o.cells.indexOf(n.model),c=a?.model.outputId,u=0;c!==void 0&&(u=n.outputsViewModels.findIndex(f=>f.model.outputId===c));let p=sn.generateCellOutputUriWithIndex(r,s,u),h=dm(sl(r));return{value:p,id:p.toString(),name:d(13486,null,h,`${l+1}`,`${u+1}`),icon:i==="application/vnd.code.notebook.error"?q.fromId("error"):void 0,kind:"notebookOutput",outputIndex:u,mimeType:i}}var Cfe="application/vnd.code.additional-editor-data",Nrt=class{constructor(i,e,t,o,n){this.chatWidgetService=i;this.extensionService=e;this.fileService=t;this.environmentService=o;this.logService=n;this.kind=new Rs("chat.attach.image");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=["image/*"];this.imagesFolder=Ve(this.environmentService.workspaceStorageHome,"vscode-chat-images"),Nso(this.fileService,this.logService,this.imagesFolder)}async provideDocumentPasteEdits(i,e,t,o,n){if(!this.extensionService.extensions.some(w=>Va(w,"chatReferenceBinaryData")))return;let r=["image/png","image/jpeg","image/jpg","image/bmp","image/gif","image/tiff"],s,l;for(let w of r)if(l=t.get(w),l){s=w;break}if(!l||!s)return;let c=await l.asFile()?.data();if(n.isCancellationRequested||!c)return;let u=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!u)return;let p=u.attachmentModel.attachments,h=d(9177,null),g=h;for(let w=2;p.some(x=>x.name===g);w++)g=`${h} ${w}`;let f=await Aso(this.fileService,this.imagesFolder,c,s);if(n.isCancellationRequested||!f)return;let v=await JA(c);if(n.isCancellationRequested||!v)return;let b=await Tln(v,s,n,g,f);if(n.isCancellationRequested||!b||u.attachmentModel.getAttachmentIDs().has(b.id))return;let y=Swo(i,[b],s,this.kind,d(9176,null),this.chatWidgetService);return Z2t(y)}};Nrt=I([m(2,ge),m(3,ko),m(4,re)],Nrt);async function Tln(a,i,e,t,o){let n=await Wrt(a);if(!e.isCancellationRequested)return{kind:"image",value:a,id:n,name:t,icon:L.fileMedia,mimeType:i,isPasted:!0,references:[{reference:o,kind:"reference"}]}}async function Wrt(a){let i=await crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(i)).map(t=>t.toString(16).padStart(2,"0")).join("")}function bwo(a){return a.length<4?!1:Object.values({png:[137,80,78,71,13,10,26,10],jpeg:[255,216,255],bmp:[66,77],gif:[71,73,70,56],tiff:[73,73,42,0]}).some(e=>e.every((t,o)=>a[o]===t))}var Ort=class{constructor(i,e,t){this.modelService=i;this.languageFeaturesService=e;this.outlineModelService=t;this.providedPasteEditKinds=[];this.copyMimeTypes=[Cfe];this.pasteMimeTypes=[]}async prepareDocumentPaste(i,e,t,o){if(i.uri.scheme===Q.vscodeChatInput)return;let n=new Wk,r={range:e[0],uri:i.uri.toJSON()};n.append(Cfe,MF(JSON.stringify(r)));let s=t.get(cr.text);return s&&e.length&&this.primeSymbolReferenceCache(i,e[0],s,o),n}async primeSymbolReferenceCache(i,e,t,o){let n=i.getValueInRange(e);e.startLineNumber===e.endLineNumber&&(o.isCancellationRequested||!Iwo.test(n)||Lln(i.uri,e,n,wwo(this.modelService,this.languageFeaturesService,this.outlineModelService,i.uri,e,n,o)))}};Ort=I([m(0,_t),m(1,Jt),m(2,kx)],Ort);var ZU=class{constructor(i){this.chatWidgetService=i;this.kind=new Rs("chat.attach.attachments");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[ZU.ATTACHMENT_MIME_TYPE];this.pasteMimeTypes=[ZU.ATTACHMENT_MIME_TYPE]}static{this.ATTACHMENT_MIME_TYPE="application/vnd.chat.attachment+json"}async prepareDocumentPaste(i,e,t,o){let n=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!n||!n.viewModel)return;let r=n.attachmentModel.attachments,s=O2(n);if(r.length===0&&s.length===0)return;let l=new Wk;return l.append(ZU.ATTACHMENT_MIME_TYPE,MF(JSON.stringify({attachments:r,dynamicVariables:s}))),l}async provideDocumentPasteEdits(i,e,t,o,n){let r=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!r||!r.viewModel)return;let s=r.getContrib(ab.ID);if(!s)return;let l=t.get(cr.text),u=await t.get(ZU.ATTACHMENT_MIME_TYPE)?.asString(),p=await l?.asString();if(p===void 0||u===void 0||n.isCancellationRequested)return;let h;try{h=er(JSON.parse(u))}catch{}if(!Array.isArray(h?.attachments)&&!Array.isArray(h?.dynamicVariables))return;let g={insertText:p,title:d(9174,null),kind:this.kind,handledMimeType:ZU.ATTACHMENT_MIME_TYPE,additionalEdit:{edits:[]}};return g.additionalEdit?.edits.push({resource:i.uri,redo:()=>{r.attachmentModel.addContext(...h.attachments);for(let f of h.dynamicVariables)s?.addReference(f);r.refreshParsedInput()},undo:()=>{r.attachmentModel.delete(...h.attachments.map(f=>f.id)),r.refreshParsedInput()}}),Z2t(g)}};ZU=I([m(0,Lt)],ZU);var OMi=class{constructor(i,e){this.chatWidgetService=i;this.modelService=e;this.kind=new Rs("chat.attach.text");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=[Cfe]}async provideDocumentPasteEdits(i,e,t,o,n){if(i.uri.scheme!==Q.vscodeChatInput)return;let r=t.get(cr.text),s=t.get("vscode-editor-data"),l=t.get(Cfe);if(!s||!r||!l)return;let c=await r.asString(),u=JSON.parse(await s.asString()),p=JSON.parse(await l.asString()),h=this.chatWidgetService.getWidgetByInputUri(i.uri);if(!h)return;let g=p.range.startLineNumber,f=p.range.endLineNumber;if(g===f){let y=this.modelService.getModel(A.revive(p.uri));if(!y||y.getLineContent(g)!==c)return}let v=_ln(c,A.revive(p.uri),u.mode,p.range);if(n.isCancellationRequested||!v||h.attachmentModel.getAttachmentIDs().has(v.id))return;let S=Swo(i,[v],cr.text,this.kind,d(9175,null),this.chatWidgetService);return S.yieldTo=[{kind:Rs.Empty.append("text","plain")}],Z2t(S)}};function _ln(a,i,e,t){let o=Be(i),n=t.startLineNumber,r=t.endLineNumber,s=`Copied Selection of Code: 


 From the file: ${o} From lines ${n} to ${r} 
 \`\`\`${a}\`\`\``,l=n===r?d(9173,null):d(9172,null,r+1-n);return{kind:"paste",value:s,id:`${o}${n}${r}${t.startColumn}${t.endColumn}`,name:`${o} ${l}`,icon:L.code,pastedLines:l,language:e,fileName:i.toString(),copiedFrom:{uri:i,range:t},code:a,references:[{reference:i,kind:"reference"}]}}function Swo(a,i,e,t,o,n){let r=i.length===1?i[0].name:d(9171,null,i[0].name,i.length-1),s=i.length===1&&SC(i[0]),l={resource:a.uri,variable:i,undo:()=>{let c=n.getWidgetByInputUri(a.uri);if(!c)throw new Error("No widget found for undo");c.attachmentModel.delete(...i.map(u=>u.id))},redo:()=>{let c=n.getWidgetByInputUri(a.uri);if(!c)throw new Error("No widget found for redo");c.attachmentModel.addContext(...i),s&&cn(d(9170,null))},metadata:{needsConfirmation:!1,label:r}};return{insertText:"",title:o,kind:t,handledMimeType:e,additionalEdit:{edits:[l]}}}function Z2t(a){return{edits:[a],dispose:()=>{}}}var Iwo=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Dln=3,rFe=[];function ywo(a,i,e){return`${a.toString()}|${i.startLineNumber}:${i.startColumn}-${i.endLineNumber}:${i.endColumn}|${e}`}async function Rln(a,i,e){let t=ywo(a,i,e);return rFe.find(o=>o.key===t)?.promise}function Lln(a,i,e,t){let o={key:ywo(a,i,e),promise:t};for(rFe.unshift(o);rFe.length>Dln;)rFe.pop();t.catch(()=>{let n=rFe.indexOf(o);n!==-1&&rFe.splice(n,1)})}async function wwo(a,i,e,t,o,n,r){let s=a.getModel(t);if(!s)return;let l=new ye(o.startLineNumber,o.startColumn),c=await d0(i.definitionProvider,s,l,!1,r);if(r.isCancellationRequested||!c.length)return;let u=c[0],p=u.targetSelectionRange??u.range,h={uri:u.uri,range:p},g=L.symbolProperty,f=a.getModel(u.uri);if(f)try{let v=await e.getOrCreate(f,r);if(!r.isCancellationRequested){let b=v.getItemEnclosingPosition({lineNumber:p.startLineNumber,column:p.startColumn});b&&(g=Zm.toIcon(b.symbol.kind))}}catch{}if(!r.isCancellationRequested)return{id:`vscode.symbol/${JSON.stringify(h)}`,fullName:n,data:h,icon:g}}var Frt=class{constructor(i,e,t,o){this.chatWidgetService=i;this.modelService=e;this.languageFeaturesService=t;this.outlineModelService=o;this.kind=new Rs("chat.attach.symbol");this.providedPasteEditKinds=[this.kind];this.copyMimeTypes=[];this.pasteMimeTypes=[Cfe]}async provideDocumentPasteEdits(i,e,t,o,n){if(i.uri.scheme!==Q.vscodeChatInput)return;let r=t.get(cr.text),s=t.get(Cfe);if(!r||!s)return;let l=await r.asString();if(!Iwo.test(l))return;let c;try{c=JSON.parse(await s.asString())}catch{return}let u=A.revive(c.uri),p=c.range;if(!this.chatWidgetService.getWidgetByInputUri(i.uri))return;let f=await Rln(u,p,l);if(f||(f=await wwo(this.modelService,this.languageFeaturesService,this.outlineModelService,u,p,l,n)),!f||n.isCancellationRequested)return;let v=`${dp}sym:${l}`,b=e[0],S=`${v} `,y={startLineNumber:b.startLineNumber,startColumn:b.startColumn,endLineNumber:b.startLineNumber,endColumn:b.startColumn+v.length},w={id:f.id,fullName:f.fullName,range:y,data:f.data,icon:f.icon},x={insertText:S,title:d(9178,null),kind:this.kind,handledMimeType:Cfe,additionalEdit:{edits:[{resource:i.uri,redo:()=>{this.chatWidgetService.getWidgetByInputUri(i.uri)?.getContrib(ab.ID)?.addReference(w)},undo:()=>{}}]}};return x.yieldTo=[{kind:new Rs("chat.attach.text")}],Z2t(x)}};Frt=I([m(0,Lt),m(1,_t),m(2,Jt),m(3,kx)],Frt);var sFe=class extends k{constructor(i,e,t,o,n,r,s,l){super(),this._register(e.documentPasteEditProvider.register({scheme:Q.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},i.createInstance(ZU))),this._register(e.documentPasteEditProvider.register({scheme:Q.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},new Nrt(t,o,n,s,l))),this._register(e.documentPasteEditProvider.register({scheme:Q.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},new OMi(t,r))),this._register(e.documentPasteEditProvider.register({scheme:Q.vscodeChatInput,pattern:"*",hasAccessToAllModels:!0},i.createInstance(Frt))),this._register(e.documentPasteEditProvider.register("*",i.createInstance(Ort)))}};sFe=I([m(0,F),m(1,Jt),m(2,Lt),m(3,lt),m(4,ge),m(5,_t),m(6,ko),m(7,re)],sFe);var nV=le("IChatAttachmentResolveService"),aFe=class{constructor(i,e,t,o,n){this.fileService=i;this.editorService=e;this.extensionService=t;this.dialogService=o;this.browserViewService=n}async resolveEditorAttachContext(i){if(P_e(i))return await this.resolveUntitledEditorAttachContext(i);if(!i.resource)return;let e=cS.parse(i.resource);if(e)return await this.resolveBrowserViewAttachContext(e.id);let t;try{t=await this.fileService.stat(i.resource)}catch{return}if(!t.isDirectory&&!t.isFile)return;let o=await this.resolveImageEditorAttachContext(i.resource);return o?this.extensionService.extensions.some(n=>Va(n,"chatReferenceBinaryData"))?o:void 0:await this.resolveResourceAttachContext(i.resource,t.isDirectory)}async resolveUntitledEditorAttachContext(i){if(i.resource)return await this.resolveResourceAttachContext(i.resource,!1);let e=this.editorService.editors.filter(t=>t instanceof Jg);for(let t of e)if((await t.resolve()).textEditorModel?.getValue()===i.contents)return await this.resolveResourceAttachContext(t.resource,!1)}async resolveResourceAttachContext(i,e){let t=0;return e||/\.(svg)$/i.test(i.path)&&(t=2),{kind:e?"directory":"file",value:i,id:i.toString(),name:Be(i),omittedState:t}}async resolveBrowserViewAttachContext(i){let t=this.browserViewService.getKnownBrowserViews().get(i);if(!t)return;t.model||await t.resolve();let o=t.model;if(o&&!(o.sharingState==="notShared"&&!await o.setSharedWithAgent(!0)))return{kind:"browserView",id:t.resource.toString(),name:t.getName(),value:t.resource,browserId:t.id,modelDescription:`Browser page: ${t.getTitle()}. The pageId is "${t.id}".`}}async resolveImageEditorAttachContext(i,e,t){if(!i)return;if(t){if(!R8(t))return}else{let l=Cwo.exec(i.path);if(!l)return;t=Pln(l)}let o=Be(i),n;if(e)n=e;else{let l;try{l=await this.fileService.stat(i)}catch{return}let c=await this.fileService.readFile(i);if(l.size>30*1024*1024)throw this.dialogService.error(d(7284,null),d(7285,null,o)),new Error("Image is too large");n=c.value}let r=/\.gif$/i.test(i.path);return(await this.resolveImageAttachContext([{id:i.toString(),name:o,data:n.buffer,icon:L.fileMedia,resource:i,mimeType:t,omittedState:r?1:0}]))[0]}resolveImageAttachContext(i){return Promise.all(i.map(async e=>({id:e.id||await Wrt(e.data),name:e.name,fullName:e.resource?e.resource.path:void 0,value:await JA(e.data,e.mimeType),icon:e.icon,kind:"image",isFile:!1,isDirectory:!1,omittedState:e.omittedState||0,references:e.resource?[{reference:e.resource,kind:"reference"}]:[]})))}resolveMarkerAttachContext(i){return i.map(e=>{let t;return"severity"in e?t=nN.fromMarker(e):t={filterUri:A.revive(e.uri),filterSeverity:4},nN.toEntry(t)})}resolveSymbolsAttachContext(i){return i.map(e=>{let t=A.file(e.fsPath);return{kind:"symbol",id:Mln(t,e.range),value:{uri:t,range:e.range},symbolKind:e.kind,icon:Zm.toIcon(e.kind),fullName:e.name,name:e.name}})}resolveNotebookOutputAttachContext(i){let e=lr(this.editorService.activeEditorPane);if(!e)return[];let t=ort(i.outputId,e);if(!t)return[];let o=t.pickedMimeType?.mimeType;if(o&&Art.includes(o)){let n=J2t(t,o,e);return n?[n]:[]}return[]}async resolveDirectoryImages(i){let e=[];return await this._collectDirectoryImages(i,e),e}async _collectDirectoryImages(i,e){let t;try{t=await this.fileService.resolve(i)}catch{return}if(!t.children)return;let o=[];for(let n of t.children)n.isDirectory&&!n.isSymbolicLink?o.push(this._collectDirectoryImages(n.resource,e)):n.isFile&&!n.isSymbolicLink&&Cwo.test(n.resource.path)&&o.push(this.resolveImageEditorAttachContext(n.resource).then(r=>{r&&e.push(r)}).catch(()=>{}));await Promise.all(o)}resolveSourceControlHistoryItemAttachContext(i){return i.map(e=>({id:e.historyItem.id,name:e.name,value:A.revive(e.resource),historyItem:{...e.historyItem,references:[]},kind:"scmHistoryItem"}))}};aFe=I([m(0,ge),m(1,ie),m(2,lt),m(3,ct),m(4,Bm)],aFe);function Mln(a,i){let e="";return i&&(e=`:${i.startLineNumber}`,i.startLineNumber!==i.endLineNumber&&(e+=`-${i.endLineNumber}`)),a.fsPath+e}var Cwo=new RegExp(`\\.(${Object.keys(RWt).join("|")})$`,"i");function Pln(a){let i=a[1].toLowerCase();return RWt[i]}var lFe=class extends k{constructor(e,t,o,n){super();this.configurationService=e;this.contextMenuService=t;this.chatSessionsService=o;this.contextKeyService=n;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this._onDidSelectPrompt=this._register(new T);this.onDidSelectPrompt=this._onDidSelectPrompt.event;this.buttonDisposables=new Map;this.domNode=this.createSuggestNextWidget()}get height(){return this.domNode.style.display==="none"?0:this.domNode.offsetHeight}getCurrentMode(){return this._currentMode}createSuggestNextWidget(){let e=_(".chat-suggest-next-widget.chat-welcome-view-suggested-prompts");return e.style.display="none",this.titleElement=D(e,_(".chat-welcome-view-suggested-prompts-title")),this.promptsContainer=e,e}render(e){let t=e.handOffs?.get();if(!t||t.length===0){this.hide();return}this._currentMode=e;let o=e.name.get()||e.label.get()||d(8850,null);this.titleElement.textContent=d(8851,null,o);let n=[];for(let c=1;c<this.promptsContainer.children.length;c++)n.push(this.promptsContainer.children[c]);for(let c of n){let u=this.buttonDisposables.get(c);u&&(u.dispose(),this.buttonDisposables.delete(c)),this.promptsContainer.removeChild(c)}let r=this.configurationService.getValue("chat.autopilot.enabled")!==!1,s=this.configurationService.inspect("chat.tools.global.autoApprove").policyValue===!1,l=r&&!s?t.find(c=>c.send):void 0;for(let c of t){let u=this.createPromptButton(c);if(this.promptsContainer.appendChild(u),c===l){let p=this.createAutopilotButton(c);this.promptsContainer.appendChild(p)}}this.domNode.style.display="flex",this._onDidChangeHeight.fire()}createPromptButton(e){let t=new O,o=e.label,n=()=>this._currentMode?.handOffs?.get()?.find(g=>g.label===o)??e,r=_(".chat-welcome-view-suggested-prompt");r.setAttribute("tabindex","0"),r.setAttribute("role","button"),r.setAttribute("aria-label",d(8852,null,e.label));let s=D(r,_(".chat-welcome-view-suggested-prompt-title"));s.textContent=e.label;let l=e.showContinueOn??!0,c=this.contextKeyService.getContextKeyValue(Z.chatSessionType.key),p=this.chatSessionsService.getAllChatSessionContributions().filter(h=>{if(!h.canDelegate||h.type===c)return!1;let g=Kg(h.type);return g!==void 0&&uPt(g)});if(l&&p.length>0){r.classList.add("chat-suggest-next-has-dropdown");let h=D(r,_(".chat-suggest-next-dropdown"));h.setAttribute("tabindex","0"),h.setAttribute("role","button"),h.setAttribute("aria-label",d(8853,null,e.label)),h.setAttribute("aria-haspopup","true"),D(h,_(".chat-suggest-next-separator")).setAttribute("aria-hidden","true"),D(h,_(".codicon.codicon-chevron-down.dropdown-chevron")).setAttribute("aria-hidden","true");let v=(b,S)=>{b.preventDefault(),b.stopPropagation();let y=p.map(w=>{let x=Kg(w.type),E=n_(x),M=sb(x);return new it(w.type,d(8855,null,M),q.isThemeIcon(E)?q.asClassName(E):void 0,!0,()=>{let N=n();N&&this._onDidSelectPrompt.fire({handoff:N,agentId:w.name})})});this.contextMenuService.showContextMenu({getAnchor:()=>S||h,getActions:()=>y,autoSelectFirstItem:!0})};t.add($(h,"click",b=>{v(b,h)})),t.add($(h,"keydown",b=>{(b.key==="Enter"||b.key===" ")&&v(b,h)})),t.add($(r,"click",b=>{if(go(b.target)&&b.target.closest(".chat-suggest-next-dropdown"))return;let S=n();S&&this._onDidSelectPrompt.fire({handoff:S})}))}else t.add($(r,"click",()=>{let h=n();h&&this._onDidSelectPrompt.fire({handoff:h})}));return t.add($(r,"keydown",h=>{if(h.key==="Enter"||h.key===" "){h.preventDefault();let g=n();g&&this._onDidSelectPrompt.fire({handoff:g})}})),this.buttonDisposables.set(r,t),r}createAutopilotButton(e){let t=new O,o=e.label,n=()=>this._currentMode?.handOffs?.get()?.find(u=>u.label===o)??e,r=d(8854,null),s=_(".chat-welcome-view-suggested-prompt");s.setAttribute("tabindex","0"),s.setAttribute("role","button"),s.setAttribute("aria-label",r);let l=D(s,_(".chat-welcome-view-suggested-prompt-title"));return l.textContent=r,t.add($(s,"click",()=>{let c=n();c&&this._onDidSelectPrompt.fire({handoff:c,withAutopilot:!0})})),t.add($(s,"keydown",c=>{if(c.key==="Enter"||c.key===" "){c.preventDefault();let u=n();u&&this._onDidSelectPrompt.fire({handoff:u,withAutopilot:!0})}})),this.buttonDisposables.set(s,t),s}hide(){this.domNode.style.display!=="none"&&(this._currentMode=void 0,this.domNode.style.display="none",this._onDidChangeHeight.fire())}dispose(){for(let e of this.buttonDisposables.values())e.dispose();this.buttonDisposables.clear(),super.dispose()}};lFe=I([m(0,B),m(1,Xe),m(2,Ms),m(3,X)],lFe);var cFe=le("IWebContentExtractorService"),foe=le("ISharedWebContentExtractorService");function xwo(a,i,e,t){return i&&i!=="local"&&tGt(a,i)?a.filter(o=>o.metadata?.targetChatSessionType===i&&o.metadata?.isUserSelectable!==!1):a.filter(o=>!o.metadata?.targetChatSessionType&&o.metadata?.isUserSelectable!==!1&&FMi(o,e)&&WMi(o,t))}function FMi(a,i){return i==="agent"?Mx.suitableForAgentMode(a.metadata):!0}function WMi(a,i){return i!=="editor"?!0:!!a.metadata.capabilities?.toolCalling}function tGt(a,i){return i?a.some(e=>e.metadata.targetChatSessionType===i):!1}function iGt(a,i,e){return tGt(i,e)?a.metadata.targetChatSessionType===e:!a.metadata.targetChatSessionType}function kwo(a,i){return a.find(e=>e.metadata.isDefaultForLocation[i])||a[0]}function VMi(a,i,e,t){let o=e.find(n=>n.identifier===a);return o?!i||o.metadata.isDefaultForLocation[t]?{shouldRestore:!0,model:o}:{shouldRestore:!1,model:o}:{shouldRestore:!1,model:void 0}}function Ewo(a,i,e,t){return!a||!i.some(o=>o.identifier===a.identifier)||!FMi(a,e.currentModeKind)||!WMi(a,e.location)||!iGt(a,t,e.sessionType)}function Two(a,i,e,t,o){if(i&&i.identifier===a.identifier)return{action:"keep"};if(!iGt(a,e,t))return{action:"default"};if(o){if(!FMi(a,o.currentModeKind))return{action:"default"};if(!WMi(a,o.location))return{action:"default"}}return{action:"apply"}}function _wo(a,i,e,t){if(e.size===0&&a.length===0)return i;let o=new Set(a.map(r=>r.metadata.vendor)),n=i.filter(r=>e.has(r.metadata.vendor)&&!o.has(r.metadata.vendor)&&!t?.has(r.metadata.vendor));return[...a,...n]}function Dwo(a,i){return a?!i.some(e=>e.identifier===a):!0}function Rwo(a,i,e,t){return e.metadata.isUserSelectable===!1?!1:VMi(a,i,[e],t).shouldRestore}function xfe(a){return!!a&&A.isUri(a.sessionResource)&&a.$mid===19}var lO=class extends z{constructor(i){super({category:fi,...i})}run(i,...e){let t=Tfe(i,e);if(!(!t||!t.editingSession))return this.runEditingSessionAction(i,t.editingSession,t.chatWidget,...e)}};function Tfe(a,i){let e=i.at(0),t=xfe(e)?e:void 0,o=a.get(Lt),n=a.get(mu),r=t?o.getWidgetBySessionResource(t.sessionResource):void 0;return r||(r=o.lastFocusedWidget??o.getWidgetsByLocations("panel").find(l=>l.supportsChangingModes)),r?.viewModel?{editingSession:n.getEditingSession(r.viewModel.model.sessionResource),chatWidget:r}:void 0}var Vrt=class extends lO{runEditingSessionAction(i,e,t,...o){let n=[];if(A.isUri(o[0])?n.push(o[0]):t&&n.push(...t.input.selectedElements),!!n.length)return this.runWorkingSetAction(i,e,t,...n)}};W(class extends Vrt{constructor(){super({id:"chatEditing.openFileInDiff",title:P(7939,"Open Changes in Diff Editor"),icon:L.diffSingle,menu:[{id:R.ChatEditingWidgetModifiedFilesToolbar,when:C.equals(tG.key,0),order:2,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){let n=i.get(ie);for(let r of o){let s=n.activeEditorPane;if(s||(s=await n.openEditor({resource:r})),!s)return;e.getEntry(r)?.getEditorIntegration(s).toggleDiff(void 0,!0)}}});W(class extends Vrt{constructor(){super({id:"chatEditing.acceptFile",title:P(7907,"Keep"),icon:L.check,menu:[{when:C.and(C.equals("resourceScheme",eG),C.notIn(HDe.key,VXe.key)),id:R.MultiDiffEditorFileToolbar,order:0,group:"navigation"},{id:R.ChatEditingWidgetModifiedFilesToolbar,when:C.equals(tG.key,0),order:0,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){await e.accept(...o)}});W(class extends Vrt{constructor(){super({id:"chatEditing.discardFile",title:P(7936,"Undo"),icon:L.discard,menu:[{when:C.and(C.equals("resourceScheme",eG),C.notIn(HDe.key,VXe.key)),id:R.MultiDiffEditorFileToolbar,order:2,group:"navigation"},{id:R.ChatEditingWidgetModifiedFilesToolbar,when:C.equals(tG.key,0),order:1,group:"navigation"}]})}async runWorkingSetAction(i,e,t,...o){await e.reject(...o)}});var BMi=class extends lO{constructor(){super({id:"chatEditing.acceptAllFiles",title:d(7906,null),icon:L.check,tooltip:d(7908,null),precondition:dR,keybinding:{primary:2051,when:C.and(dR,Z.inChatInput),weight:200},menu:[{id:R.ChatEditingWidgetToolbar,group:"navigation",order:0,when:C.and(W3.negate(),C.and(dR))}]})}async runEditingSessionAction(i,e,t,...o){await e.accept()}};W(BMi);var HMi=class extends lO{constructor(){super({id:"chatEditing.discardAllFiles",title:d(7935,null),icon:L.discard,tooltip:d(7937,null),precondition:dR,menu:[{id:R.ChatEditingWidgetToolbar,group:"navigation",order:1,when:C.and(W3.negate(),dR)}],keybinding:{when:C.and(dR,Z.inChatInput,Z.inputHasText.negate()),weight:200,primary:2049}})}async runEditingSessionAction(i,e,t,...o){await Aln(i,e)}};W(HMi);var UMi=class a extends lO{static{this.ID="chatEditing.toggleExplanationWidget"}constructor(){super({id:a.ID,title:d(7938,null),tooltip:d(7940,null),precondition:dR,menu:[{id:R.ChatEditingWidgetToolbar,group:"navigation",order:2,when:C.and(dR,C.has("config.chat.editing.explainChanges.enabled"))}]})}async runEditingSessionAction(i,e,t,...o){e.hasExplanations()?e.clearExplanations():await e.triggerExplanationGeneration()}};W(UMi);async function Aln(a,i){let e=a.get(ct),t=i.entries.get().filter(o=>o.state.get()===0);return t.length>0&&!(await e.confirm({title:d(7913,null),message:t.length===1?d(7911,null,Be(t[0].modifiedURI)):d(7910,null,t.length),primaryButton:d(7912,null),type:"info"})).confirmed?!1:(await i.reject(),!0)}var kfe=class a extends lO{static{this.ID="chatEditing.viewChanges"}static{this.LABEL=d(7933,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:a.LABEL},tooltip:a.LABEL,f1:!0,icon:L.diffMultiple,precondition:dR,menu:[{id:R.ChatEditingWidgetToolbar,group:"navigation",order:4,when:C.and(W3.negate(),C.and(BXe,dR))}]})}async runEditingSessionAction(i,e,t,...o){await e.show()}};W(kfe);function Lwo(a){return a?.length?a.filter(i=>!IPt(i)&&!rDe(i)&&!N2(i)&&!(tR(i)&&i.automaticallyAdded)&&!(B0(i)&&i.automaticallyAdded)):[]}async function Mwo(a,i,e){let t=a.get(B),o=a.get(ct),r=a.get(Lt).getWidgetBySessionResource(i),s=a.get(si),l=s.getSession(i);if(!l)return!1;let c=l.editingSession;if(!c)return!1;let u=l.getRequests(),p=u.findIndex(x=>x.id===e);if(p===-1)return!1;let h=u.length-p,g=u.slice(p),f=new Set(g.map(x=>x.id)),v=c.entries.get().filter(x=>f.has(x.lastModifyingRequestId))??[],b=v.length>0&&t.getValue("chat.editing.confirmEditRequestRemoval")===!0,S;h===1?v.length===1?S=d(7922,null,Be(v[0].modifiedURI)):S=d(7923,null,v.length):v.length===1?S=d(7918,null,Be(v[0].modifiedURI)):S=d(7919,null,v.length);let y=b?await o.confirm({title:h===1?d(7924,null):d(7921,null,h),message:S,primaryButton:d(7920,null),checkbox:{label:d(7917,null),checked:!1},type:"info"}):{confirmed:!0};if(!y.confirmed)return r?.viewModel?.model.setCheckpoint(void 0),!1;y.checkboxChecked&&await t.updateValue("chat.editing.confirmEditRequestRemoval",!1),await s.cancelCurrentRequestForSession(i,"restoreCheckpoint");let w=u[p].id;return await c.restoreSnapshot(w,void 0),!0}async function zMi(a,i){let e=_r(i)?i.id:Ni(i)?i.requestId:void 0;return e?Mwo(a,i.sessionResource,e):!1}W(class extends z{constructor(){super({id:"workbench.action.chat.undoEdits",title:P(7931,"Undo Requests"),f1:!1,category:fi,icon:L.discard,keybinding:{primary:20,mac:{primary:2049},when:C.and(Z.inChatSession,me.textInputFocus.negate(),Z.inChatQuestionCarousel.negate()),weight:200},menu:[{id:R.ChatMessageTitle,group:"navigation",order:2,when:C.and(C.equals("config.chat.editRequests","input").negate(),C.equals("config.chat.checkpoints.enabled",!1),C.or(Z.lockedToCodingAgent.negate(),Lx.isAgentHostSession))}]})}async run(i,...e){let t=e[0],o=i.get(Lt),n=i.get(B),r=EE(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;if(!Ni(t)&&!_r(t)&&(t=r?.getFocus()),!t)return;if(await zMi(i,t)&&_r(t)&&n.getValue("chat.undoRequests.restoreInput")){r?.focusInput(),r?.input.setValue(t.messageText,!1);let l=Lwo(t.attachedContext);l.length&&await r?.input.restoreAttachments(l)}}});W(class extends z{constructor(){super({id:"workbench.action.chat.restoreCheckpoint",title:P(7925,"Restore Checkpoint"),tooltip:P(7927,"Restores workspace and chat to this point"),f1:!1,category:fi,keybinding:{primary:20,mac:{primary:2049},when:C.and(Z.inChatSession,me.textInputFocus.negate(),Z.inChatQuestionCarousel.negate()),weight:200},menu:[{id:R.ChatMessageCheckpoint,group:"navigation",order:2,when:C.and(Z.isRequest,C.or(Z.lockedToCodingAgent.negate(),Lx.isAgentHostSession),Z.isFirstRequest.negate())}]})}async run(i,...e){let t=e[0],o=i.get(Lt),n=EE(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;if(!Ni(t)&&!_r(t)&&(t=n?.getFocus()),!t)return;let r=_r(t)?Lwo(t.attachedContext):[];_r(t)&&(n?.focusInput(),n?.input.setValue(t.messageText,!1)),n?.viewModel?.model.setCheckpoint(t.id),await zMi(i,t)&&r.length&&await n?.input.restoreAttachments(r)}});W(class extends z{constructor(){super({id:"workbench.action.chat.startOver",title:P(7929,"Start Over"),tooltip:P(7930,"Clears the chat and undoes all changes"),f1:!1,category:fi,menu:[{id:R.ChatMessageCheckpoint,group:"navigation",order:2,when:C.and(Z.isRequest,C.or(Z.lockedToCodingAgent.negate(),Lx.isAgentHostSession),Z.isFirstRequest)}]})}async run(i,...e){let t=e[0],o=i.get(Lt),n=EE(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Ni(t)&&!_r(t)&&(t=n?.getFocus()),t&&(n?.viewModel?.model.setCheckpoint(t.id),await zMi(i,t))}});W(class extends z{constructor(){super({id:"workbench.action.chat.restoreLastCheckpoint",title:P(7928,"Restore to Last Checkpoint"),f1:!0,category:fi,icon:L.discard,precondition:C.and(Z.inChatSession,C.equals("config.chat.checkpoints.enabled",!0),C.or(Z.lockedToCodingAgent.negate(),Lx.isAgentHostSession))})}async run(i,...e){let t=e[0],o=i.get(Lt),n=i.get(si),r=EE(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Ni(t)&&!_r(t)&&(t=r?.getFocus());let s=r?.viewModel?.sessionResource??(EE(t)?t.sessionResource:void 0);if(!s)return;let l=n.getSession(s);if(!l?.editingSession)return;let c=l.checkpoint;if(!c){cn(d(7926,null));return}r?.viewModel?.model.setCheckpoint(c.id),r?.focusInput(),r?.input.setValue(c.message.text,!1),await Mwo(i,s,c.id)}});W(class extends z{constructor(){super({id:"workbench.action.chat.editRequests",title:P(7914,"Edit Request"),f1:!1,category:fi,icon:L.edit,keybinding:{primary:3,when:C.and(Z.inChatSession,me.textInputFocus.negate()),weight:200},menu:[{id:R.ChatMessageTitle,group:"navigation",order:2,when:C.and(C.or(C.equals("config.chat.editRequests","hover"),C.equals("config.chat.editRequests","input")))}]})}async run(i,...e){let t=e[0],o=i.get(Lt),n=EE(t)&&o.getWidgetBySessionResource(t.sessionResource)||o.lastFocusedWidget;!Ni(t)&&!_r(t)&&(t=n?.getFocus()),t&&_r(t)&&n?.startEditing(t.id)}});W(class Pwo extends z{static{this.id="chat.openFileUpdatedBySnapshot"}constructor(){super({id:Pwo.id,title:d(7915,null),menu:[{id:R.ChatEditingCodeBlockContext,group:"navigation",order:0}]})}async run(i,...e){let t=e[0];if(!t?.sessionResource)return;await i.get(ie).openEditor({resource:t.uri})}});W(class Awo extends z{static{this.id="chat.openFileSnapshot"}constructor(){super({id:Awo.id,title:d(7916,null),menu:[{id:R.ChatEditingCodeBlockContext,group:"navigation",order:1}]})}async run(i,...e){let t=e[0];if(!t?.sessionResource)return;let o=i.get(si),n=i.get(mu),r=i.get(ie),s=o.getSession(t.sessionResource);if(!s)return;let l=n.getEditingSession(s.sessionResource)?.getSnapshotUri(t.requestId,t.uri,t.stopId);if(l){let c=await r.openEditor({resource:l,label:d(7932,null,Be(t.uri)),options:{activation:1}});fn(c)&&c.updateOptions({readOnly:!0})}}});W(class extends lO{constructor(){super({id:"workbench.action.edits.addFilesFromReferences",title:P(7909,"Add Files From References"),f1:!1,category:fi,menu:{id:R.ChatInputSymbolAttachmentContext,group:"navigation",order:1,when:C.and(Z.chatModeKind.isEqualTo("ask"),me.hasReferenceProvider)}})}async runEditingSessionAction(i,e,t,...o){if(o.length===0||!Bp(o[0]))return;let n=i.get(Bt),r=i.get(Jt),s=o[0],l=await n.createModelReference(s.uri);try{let c=l.object.textEditorModel;if(!c)return;let u=new ye(s.range.startLineNumber,s.range.startColumn),[p,h,g]=await Promise.all([this.getReferences(u,c,r),this.getDefinitions(u,c,r),this.getImplementations(u,c,r)]),f=[];for(let v of[...h,...g,...p])f.push(t.attachmentModel.asFileVariableEntry(v.uri));t.attachmentModel.addContext(...f)}finally{l.dispose()}}async getReferences(i,e,t){let o=t.referenceProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideReferences(e,i,{includeDeclaration:!0},Ie.None)??[]))).flat()}async getDefinitions(i,e,t){let o=t.definitionProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideDefinition(e,i,Ie.None)??[]))).flat()}async getImplementations(i,e,t){let o=t.implementationProvider.all(e);return(await Promise.all(o.map(async r=>await r.provideImplementation(e,i,Ie.None)??[]))).flat()}});var Efe=class a extends lO{static{this.Id="chatEditing.viewPreviousEdits"}static{this.Label=d(7934,null)}constructor(){super({id:a.Id,title:{value:a.Label,original:a.Label},tooltip:a.Label,f1:!0,icon:L.diffMultiple,precondition:C.and(Z.enabled,dR.negate()),menu:[{id:R.ChatEditingWidgetToolbar,group:"navigation",order:4,when:C.and(W3.negate(),C.and(BXe,dR.negate()))}]})}async runEditingSessionAction(i,e,t,...o){await e.show(!0)}};W(Efe);Ge.registerCommand("_chat.editSessions.accept",async(a,i)=>{if(i.length===0)return;let e=i.map(o=>A.revive(o)),t=a.get(mu);for(let o of t.editingSessionsObs.get())await o.accept(...e)});var dFe=new Y("chatEdits.isGlobalEditingSession",void 0,d(7964,null)),Cb=new Y("chatEdits.hasEditorModifications",void 0,d(7967,null)),voe=new Y("chatEdits.isCurrentlyBeingModified",void 0,d(7968,null)),Dfe=new Y("chatEdits.isReviewModeEnabled",!0,d(7966,null)),EP=new Y("chatEdits.isRequestInProgress",!1,d(7965,null)),Nln=new Y("chatEdits.requestCount",0,d(7969,null)),oGt=new Y("chatEdits.cursorInChangeRange",!1,d(7963,null)),_fe=class{constructor(i,e){this._store=new O;let t=this._store.add(new Ot),o=vi(this,U.any(e.onDidAddGroup,e.onDidRemoveGroup),()=>e.groups);this._store.add(ve(n=>{let r=new Set(t.keys());for(let s of o.read(n))r.delete(s),!t.has(s)&&t.set(s,i.createInstance(Brt,s));for(let s of r)t.deleteAndDispose(s)}))}static{this.ID="chat.edits.editorContextKeys"}dispose(){this._store.dispose()}};_fe=I([m(0,F),m(1,kt)],_fe);var Brt=class{constructor(i,e,t,o){this._store=new O;this._ctxIsGlobalEditingSession=dFe.bindTo(i.scopedContextKeyService),this._ctxHasEditorModification=Cb.bindTo(i.scopedContextKeyService),this._ctxIsCurrentlyBeingModified=voe.bindTo(i.scopedContextKeyService),this._ctxHasRequestInProgress=EP.bindTo(i.scopedContextKeyService),this._ctxReviewModeEnabled=Dfe.bindTo(i.scopedContextKeyService),this._ctxRequestCount=Nln.bindTo(i.scopedContextKeyService);let n=vi(this,i.onDidModelChange,()=>i.activeEditor),r=ke(s=>{let l=n.read(s),c=po.getOriginalUri(l,{supportSideBySide:1});if(!c){this._reset();return}return new Hrt(c,t,e).value.read(s)});this._store.add(ve(s=>{let l=r.read(s);if(!l){this._reset();return}let{session:c,entry:u}=l,p=o.getSession(c.chatSessionResource);this._ctxHasEditorModification.set(u?.state.read(s)===0),this._ctxIsGlobalEditingSession.set(c.isGlobalEditingSession),this._ctxReviewModeEnabled.set(u?u.reviewMode.read(s):!1),this._ctxHasRequestInProgress.set(p?.requestInProgress.read(s)??!1),this._ctxIsCurrentlyBeingModified.set(!!u?.isCurrentlyBeingModifiedBy.read(s));let h=p?vi(this,p.onDidChange,()=>p.getRequests().length):Fo(0);this._ctxRequestCount.set(h.read(s))}))}_reset(){this._ctxIsGlobalEditingSession.reset(),this._ctxHasEditorModification.reset(),this._ctxHasRequestInProgress.reset(),this._ctxReviewModeEnabled.reset(),this._ctxRequestCount.reset()}dispose(){this._store.dispose(),this._reset()}};Brt=I([m(1,cy),m(2,mu),m(3,si)],Brt);var Hrt=class{constructor(i,e,t){let o=vi(this,t.onDidChangeSessions,()=>t.getSessionByTextModel(i)),n=e.editingSessionsObs.map((r,s)=>{for(let l of r){let c=l.readEntry(i,s);if(c)return{session:l,entry:c,isInlineChat:!1}}});this.value=ke(r=>{let s=o.read(r);return s?{session:s.editingSession,entry:s.editingSession.readEntry(i,r),isInlineChat:!0}:n.read(r)})}};Hrt=I([m(1,mu),m(2,cy)],Hrt);var uFe=class extends CQe{constructor(e,t,o,n,r){super(e,t);this._options=t;this.actionWidgetService=o;this.keybindingService=n;this.telemetryService=r;this._enabled=!0}show(){if(!this._enabled)return;let e=this._options.actionBarActions??this._options.actionBarActionProvider?.getActions()??[],t=this._options.actions??this._options.actionProvider?.getActions()??[],o=t.find(g=>g.checked),n=o,r=[],s=new Map;for(let g of t){let f=g.category;f||(f={label:"",order:Number.MIN_SAFE_INTEGER}),s.has(f.label)||s.set(f.label,[]),s.get(f.label).push(g)}let l=Array.from(s.entries()).sort((g,f)=>{let v=g[1][0]?.category?.order??Number.MAX_SAFE_INTEGER,b=f[1][0]?.category?.order??Number.MAX_SAFE_INTEGER;return v-b});for(let g=0;g<l.length;g++){let[f,v]=l[g];(v[0]?.category?.showHeader??!1)&&f&&r.push({kind:"header",label:f,canPreview:!1,disabled:!1,hideIcon:!1});for(let S of v)r.push({item:S,tooltip:S.tooltip,description:S.description,detail:S.detail,hover:S.hover,toolbarActions:S.toolbarActions,kind:"action",canPreview:!1,group:{title:"",icon:S.icon??q.fromId(S.checked?L.check.id:L.blank.id)},disabled:!S.enabled,hideIcon:!1,label:S.label,keybinding:this._options.showItemKeybindings?S.keybinding??this.keybindingService.lookupKeybinding(S.id):void 0});g<l.length-1&&r.push({label:"",kind:"separator",canPreview:!1,disabled:!1,hideIcon:!1})}let c=Un(),u=new Set(e.map(g=>g.id)),p={onSelect:(g,f)=>{u.has(g.id)||(n=g),this.actionWidgetService.hide(),g.run()},onHide:()=>{this.hide(),go(c)&&c.focus(),this._emitCloseEvent(o,n)}};if(e.length){r.length&&r.push({label:"",kind:"separator",canPreview:!1,disabled:!1,hideIcon:!1});for(let g of e)r.push({item:g,tooltip:g.tooltip,kind:"action",canPreview:!1,group:{title:"",icon:q.fromId(L.blank.id)},disabled:!g.enabled,hideIcon:!1,label:g.label})}let h={isChecked(g){return g.kind==="action"&&!!g?.item?.checked},getRole:g=>{switch(g.kind){case"action":return g.item&&u.has(g.item.id)?"menuitem":"menuitemcheckbox";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"menu"};super.show(),this.actionWidgetService.show(this._options.label??"",!1,r,p,this._options.getAnchor?.()??this.element,void 0,[],h,this._options.listOptions)}setEnabled(e){this._enabled=e}_emitCloseEvent(e,t){let o=e,n=t;this._options.reporter&&this.telemetryService.publicLog2("actionWidgetDropdownClosed",{id:this._options.reporter.id,name:this._options.reporter.name,selectionChanged:o?.id!==n?.id,optionIdBefore:this._options.reporter.includeOptions?o?.id:void 0,optionIdAfter:this._options.reporter.includeOptions?n?.id:void 0,optionLabelBefore:this._options.reporter.includeOptions?o?.label:void 0,optionLabelAfter:this._options.reporter.includeOptions?n?.label:void 0})}};uFe=I([m(2,kd),m(3,Le),m(4,_e)],uFe);var rV=class extends Ja{constructor(e,t,o,n,r,s){super(void 0,e);this.actionWidgetOptions=t;this._actionWidgetService=o;this._keybindingService=n;this._contextKeyService=r;this._telemetryService=s;this.actionItem=null}render(e){this.actionItem=e;let t=o=>(this.element=D(o,_("a.action-label")),this.renderLabel(this.element));this.actionWidgetDropdown=this._register(new uFe(e,{...this.actionWidgetOptions,labelRenderer:t},this._actionWidgetService,this._keybindingService,this._telemetryService)),this._register(this.actionWidgetDropdown.onDidChangeVisibility(o=>{this.element?.setAttribute("aria-expanded",`${o}`)})),this.updateTooltip(),this.updateEnabled()}renderLabel(e){return e.classList.add("codicon"),this._action.label&&this._register(sp().setupManagedHover(this.options.hoverDelegate??yi("mouse"),e,this._action.label)),null}updateAriaLabel(){this.element&&this.setAriaLabelAttributes(this.element)}setAriaLabelAttributes(e){e.setAttribute("role","button"),e.setAttribute("aria-haspopup","true"),e.setAttribute("aria-expanded","false"),e.ariaLabel=this.getTooltip()+" - "+(e.textContent||this._action.label)||""}getTooltip(){let e=this.action.tooltip??this.action.label;return this._keybindingService.appendKeybinding(e,this.action.id,this._contextKeyService)}show(){this.actionWidgetDropdown?.show()}updateEnabled(){let e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e),this.actionWidgetDropdown?.setEnabled(!e)}};rV=I([m(2,kd),m(3,Le),m(4,X),m(5,_e)],rV);function rGt(a){let i=a.match(/(?:github\.com)[/:](?<owner>[^/]+)\/(?<repo>[^/.]+)/);if(i?.groups)return`${i.groups.owner}/${i.groups.repo}`}async function Nwo(a,i){try{let e=`${a}/.git`,t=A.file(e),o;try{if((await i.stat(t)).isDirectory)o=A.file(`${e}/config`);else{let u=(await i.readFile(t)).value.toString().trim().replace(/^gitdir:\s*/,""),h=(u.startsWith("/")?u:`${a}/${u}`).replace(/\/worktrees\/[^/]+$/,"");o=A.file(`${h}/config`)}}catch{return}let s=(await i.readFile(o)).value.toString().match(/\[remote\s+"origin"\][^[]*url\s*=\s*(.+)/m);if(s?.[1])return rGt(s[1].trim())}catch{}}var KMi=class a extends z{static{this.ID="workbench.action.chat.continueChatInSession"}constructor(){super({id:a.ID,title:P(6472,"Continue Chat in..."),tooltip:d(6473,null),precondition:C.and(Z.enabled,Z.requestInProgress.negate(),Z.remoteJobCreating.negate(),Z.hasCanDelegateProviders),menu:[{id:R.ChatExecute,group:"navigation",order:3.4,when:C.and(Z.lockedToCodingAgent.negate(),Z.hasCanDelegateProviders)},{id:R.EditorContent,group:"continueIn",when:C.and(C.equals(Ho.Scheme.key,Q.untitled),C.equals(Ho.LangId.key,r_),C.notEquals(tG.key,0),Cb.negate(),Z.hasCanDelegateProviders)}]})}async run(){}},boe=class extends rV{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{actionProvider:boe.actionProvider(s,l,p,h,t),actionBarActions:boe.getActionBarActions(c),reporter:{id:"ChatContinueInSession",name:"ChatContinueInSession",includeOptions:!0}},o,r,n,u);this.location=t;this.contextKeyService=n}static getActionBarActions(e){let t="https://aka.ms/vscode-continue-chat-in";return[{id:"workbench.action.chat.continueChatInSession.learnMore",label:d(6471,null),tooltip:d(6471,null),class:void 0,enabled:!0,run:async()=>{await e.open(A.parse(t))}}]}static actionProvider(e,t,o,n,r){return{getActions:()=>{let s=[],l=e.getAllChatSessionContributions(),c=n.getWorkspace().folders,u=!1;if(c.length>0){for(let g of o.repositories)if(g.provider.rootUri&&n.getWorkspaceFolder(g.provider.rootUri)){u=!0;break}}let p=l.find(g=>g.type===zo.Background);p&&p.canDelegate&&s.push(this.toAction(zo.Background,p,t,r));let h=l.find(g=>g.type===zo.Cloud);return h&&h.canDelegate&&s.push(this.toAction(zo.Cloud,h,t,r,u)),s.length===0&&(s.push(this.toSetupAction(zo.Background,t)),s.push(this.toSetupAction(zo.Cloud,t))),s}}}static toAction(e,t,o,n,r=!0){return{id:t.type,enabled:r,icon:n_(e),class:void 0,description:`@${t.name}`,label:sb(e),tooltip:d(6476,null,sb(e)),category:{label:d(6474,null),order:0,showHeader:!0},run:()=>o.invokeFunction(s=>n==="editor"?new qMi().run(s,t):new Urt().run(s,t))}}static toSetupAction(e,t){return{id:e,enabled:!0,icon:n_(e),class:void 0,label:sb(e),tooltip:d(6476,null,sb(e)),category:{label:d(6474,null),order:0,showHeader:!0},run:()=>t.invokeFunction(o=>o.get(fe).executeCommand(aS))}}renderLabel(e){if(this.location==="editor"){let t=st("span.action-widget-delegate-label",[st("span",{className:q.asClassName(L.forward)}),st("span",[d(6475,null)])]);return e.appendChild(t.root),null}else{let t=this.contextKeyService.contextMatchesRules(Z.remoteJobCreating)?L.sync:L.forward;return e.classList.add(...q.asClassNameArray(t)),super.renderLabel(e)}}};boe=I([m(2,kd),m(3,X),m(4,Le),m(5,Ms),m(6,F),m(7,Je),m(8,_e),m(9,lc),m(10,Ae)],boe);var GMi="workbench.action.chat.openNewSessionEditor",Urt=class{constructor(){}openUntitledEditor(i,e){i.executeCommand(`${GMi}.${e.type}`)}async extractRepoNwoFromSession(i,e,t,o,n){let r=n.repoData;if(r?.remoteUrl){let l=rGt(r.remoteUrl);if(l)return l}let s=i.getSession(o);if(s?.metadata){let l=s.metadata,c=l.owner,u=l.name;if(c&&u)return`${c}/${u}`;let p=l.repositoryNwo;if(p?.includes("/"))return p;let h=l.repositoryUrl;if(h){let f=rGt(h);if(f)return f}let g=l.workingDirectoryPath??l.repositoryPath??l.worktreePath;if(g){let f=await Nwo(g,t);if(f)return f}}for(let l of["repositories","repository"]){let c=e.getSessionOption(o,l);if(c){let u=typeof c=="string"?c:c.id;if(u){if(u.split("/").filter(Boolean).length===2)return u;let h=rGt(u);if(h)return h;try{let g=A.parse(u);if(g.authority==="github"){let f=g.path.split("/").filter(Boolean);if(f.length>=2)return`${f[0]}/${f[1]}`}}catch{}if(Jl(u)){let g=await Nwo(u,t);if(g)return g}}}}}async run(i,e,t){let o=i.get(X),n=i.get(fe),r=i.get(Lt),s=i.get(gr),l=i.get(si),c=i.get(ie),u=i.get(Vc),p=i.get(Ms),h=i.get(ge),g=Z.remoteJobCreating.bindTo(o);try{g.set(!0);let f=t??r.lastFocusedWidget;if(!f||!f.viewModel)return this.openUntitledEditor(n,e);let v=f.viewModel.model;if(!v)return;let b=f.viewModel.sessionResource,S=v.getRequests(),y=f.getInput();if(!y){if(!S.length)return this.openUntitledEditor(n,e);y="implement this."}let w=f.input.getAttachedAndImplicitContext();if(f.input.acceptInput(!0),f.location==="editor"){let ae=c.activeTextEditorControl;if(ae){let ce=ae.getModel(),Se;ce&&VY(ce)&&(Se=ce.uri);let Re=ae.getSelection();Se&&Re&&w.add({kind:"file",id:"vscode.implicit.selection",name:Be(Se),value:{uri:Se,range:Re}})}}let x=e.type,E=qo.getValue(o),M=Kg(b);if(E&&M&&M!==x){let ce=tw(f.viewContext)?`workbench.action.chat.openNewSessionSidebar.${x}`:`${GMi}.${x}`,Se=2e4,Re=S.map(Te=>{let It=`User: ${Te.message.text}`,tt=Te.response?.response?`Assistant: ${Te.response.response.getMarkdown()}`:"";return tt?`${It}
${tt}`:It}).join(`

`);Re.length>Se&&(Re=Re.substring(Re.length-Se));let xe=Re?`The following is the conversation history from a previous ${sb(M)} session. Continue working on it.

${Re}

User: ${y}`:y,He=new Map,Ee=await this.extractRepoNwoFromSession(u,p,h,b,v);Ee&&He.set("repositories",Ee),await n.executeCommand(ce,{prompt:xe,attachedContext:w.asArray(),initialSessionOptions:He.size>0?He:void 0});return}let N=s.getDefaultAgent("panel"),H=i.get(F).createInstance(nR),K={sessionType:yn(b)},j=H.parseChatRequestWithReferences(O2(f),RZ(f),y,"panel",K),J=v.addRequest(j,{variables:w.asArray()},0,void 0,N);await l.removeRequest(b,J.id);let se=await l.sendRequest(b,y,{agentIdSilent:x,attachedContext:w.asArray(),userSelectedModelId:f.input.currentLanguageModel,...f.getModeRequestOptions()});R3.isSent(se)&&await f.handleDelegationExitIfNeeded(N,se.data.agent)}catch(f){throw console.error("[Delegation] Error creating remote coding agent job",f),f}finally{g.set(!1)}}},qMi=class{constructor(){}async run(i,e){try{let o=i.get(ie).activeTextEditorControl,n=i.get(fe);if(!o)return;let r=o.getModel();if(!r||!VY(r))return;let s=r.uri,l=[H0(s,"vscode.prompt.file",void 0,!1,[])],c=`Follow instructions in [${Be(s)}](${s.toString()}).`;await n.executeCommand(`${GMi}.${e.type}`,{prompt:c,attachedContext:l})}catch(t){throw console.error("Error creating remote agent job from editor",t),t}}},nGt=class extends k{static{this.ID="chat.continueChatInSessionActionRendering"}constructor(i,e){super();let t=i.register(R.EditorContent,KMi.ID,(o,n,r)=>{if(o instanceof Do)return e.createInstance(boe,o,"editor")});bp(t)}};nGt=I([m(0,sh),m(1,F)],nGt);var sGt=class extends z{async run(i,...e){let t=e[0],o=i.get(_e),n=i.get(Lt),r=t?.widget??n.lastFocusedWidget,s=r?.input.pendingDelegationTarget;if(s&&s!==zo.Local)return await this.handleDelegation(i,r,s);if(r?.viewModel?.editing){let l=i.get(B),c=i.get(ct),p=i.get(si).getSession(r.viewModel.sessionResource);if(!p)return;let h=p.editingSession;if(!h)return;let g=r.viewModel?.editing.id;if(g){let f=p.getRequests(),v=f.findIndex(V=>V.id===g),b=f.length-v,S=f.slice(v),y=new Set(S.map(V=>V.id)),w=h.entries.get().filter(V=>y.has(V.lastModifyingRequestId))??[],x=w.length>0&&l.getValue("chat.editing.confirmEditRequestRemoval")===!0,E;b===1?w.length===1?E=d(6501,null,Be(w[0].modifiedURI)):E=d(6502,null,w.length):w.length===1?E=d(6497,null,Be(w[0].modifiedURI)):E=d(6498,null,w.length);let M=x?await c.confirm({title:b===1?d(6503,null):d(6500,null,b),message:E,primaryButton:d(6499,null),checkbox:{label:d(6496,null),checked:!1},type:"info"}):{confirmed:!0};if(M.confirmed)b>0&&o.publicLog2("chat.undoEditsConfirmation",{editRequestType:l.getValue("chat.editRequests"),outcome:"applied",editsUndoCount:b});else{o.publicLog2("chat.undoEditsConfirmation",{editRequestType:l.getValue("chat.editRequests"),outcome:"cancelled",editsUndoCount:b});return}M.checkboxChecked&&await l.updateValue("chat.editing.confirmEditRequestRemoval",!1);let N=f[v].id;await h.restoreSnapshot(N,void 0)}}else r?.viewModel?.model.checkpoint&&r.viewModel.model.setCheckpoint(void 0);r?.acceptInput(t?.inputValue)}async handleDelegation(i,e,t){let r=i.get(Ms).getAllChatSessionContributions().find(s=>Kg(s.type)===t);if(!r)throw new Error(`No contribution found for delegation target: ${t}`);if(r.canDelegate===!1)throw new Error(`The contribution for delegation target: ${t} does not support delegation.`);return new Urt().run(i,r,e)}},$Mi=Z.hasActiveRequest.negate(),sPi=Z.requestInProgress.negate(),cO=class a extends sGt{static{this.ID="workbench.action.chat.submit"}constructor(){let i=Z.chatModeKind.isEqualTo("ask"),e=C.and(Z.inputHasText,C.or(sPi,Z.editingRequestType.isEqualTo(Z.EditingRequestType.Sent)),Z.chatSessionOptionsValid);super({id:a.ID,title:P(6516,"Send"),f1:!1,category:fi,icon:L.arrowUp,precondition:e,toggled:{condition:Z.lockedToCodingAgent,icon:L.arrowUp,tooltip:d(6522,null)},keybinding:{when:C.and(Z.inChatInput,Z.withinEditSessionDiff.negate()),primary:3,weight:100},menu:[{id:R.ChatExecute,order:4,when:C.and($Mi,i,Z.withinEditSessionDiff.negate()),group:"navigation",alt:{id:"workbench.action.chat.sendToNewChat",title:P(6495,"Send to New Chat"),icon:L.plus}},{id:R.ChatEditorInlineExecute,group:"navigation",order:4,when:C.and(C.or(Cb.negate(),Z.inputHasText),$Mi,i)}]})}},aPi="workbench.action.chat.toggleAgentMode",jMi=class a extends z{static{this.ID=aPi}constructor(){super({id:a.ID,title:P(6520,"Switch to Next Agent"),f1:!0,category:fi,precondition:C.and(Z.enabled,Z.requestInProgress.negate())})}async run(i,...e){let t=i.get(fe),o=i.get(F),n=i.get(_e),r=i.get(Lt),s=e.at(0),l;if(s?.sessionResource?l=r.getWidgetBySessionResource(s.sessionResource):l=Tfe(i,e)?.chatWidget,!l)return;let u=l.viewModel?.model?.getRequests().length??0,p=l.input.currentChatModesObs.get(),h=(s&&(p.findModeById(s.modeId)||p.findModeByName(s.modeId)))??this.getNextMode(l,u,p),g=l.input.currentModeObs.get();if(h.id===g.id)return;let f=await o.invokeFunction(Met,l.input.currentModeKind,h.kind,u,l.viewModel?.model);if(!f)return;let v=h.source?.storage??"builtin",b=h.source?.storage==="extension"?h.source.extensionId.value:void 0,S=h.customTools?.get()?.length??0,y=h.handOffs?.get()?.length??0,w=h.uri?.get(),x=w?HPt(w):void 0;n.publicLog2("chat.modeChange",{fromMode:x8(g),mode:x8(h),requestCount:u,storage:v,extensionId:b,toolsCount:S,handoffsCount:y,isClaudeAgent:x}),l.input.setChatMode(h.id),f.needToClearSession&&await t.executeCommand(Mh)}getNextMode(i,e,t){let o=[...t.builtin.filter(s=>s.kind!=="edit"||e===0),...t.custom??[]],n=o.findIndex(s=>s.id===i.input.currentModeObs.get().id);return o[(n+1)%o.length]}},QMi=class a extends z{static{this.ID="workbench.action.chat.switchToNextModel"}constructor(){super({id:a.ID,title:P(6518,"Switch to Next Model"),category:fi,f1:!0,precondition:Z.enabled})}run(i,...e){i.get(Lt).lastFocusedWidget?.input.switchToNextModel()}},YMi=class a extends z{static{this.ID="workbench.action.chat.switchToNextPinnedModel"}constructor(){super({id:a.ID,title:P(6519,"Switch to Next Pinned Model"),category:fi,f1:!0,precondition:Z.enabled})}run(i,...e){i.get(Lt).lastFocusedWidget?.input.switchToNextPinnedModel()}},Soe=class a extends z{static{this.ID="workbench.action.chat.openModelPicker"}constructor(){super({id:a.ID,title:P(6511,"Open Model Picker"),category:fi,f1:!1,keybinding:{primary:2649,weight:200,when:Z.inChatInput},precondition:Z.enabled,menu:{id:R.ChatInput,order:3,group:"navigation",when:C.and(C.or(Z.lockedToCodingAgent.negate(),Z.chatSessionHasTargetedModels),C.or(C.equals(Z.location.key,"panel"),C.equals(Z.location.key,"editor"),C.equals(Z.location.key,"notebook"),C.equals(Z.location.key,"terminal")),C.or(Z.inAgentSessionsWelcome.negate(),Z.chatSessionHasTargetedModels,Z.agentSessionType.isEqualTo(zo.Local)))}})}async run(i,...e){let t=i.get(Lt),o=t.lastFocusedWidget;o&&(await t.reveal(o),o.input.openModelPicker())}},zrt=class a extends z{static{this.ID="workbench.action.chat.openPermissionPicker"}constructor(){super({id:a.ID,title:P(6513,"Open Permission Picker"),tooltip:d(6524,null),category:fi,f1:!1,precondition:Z.enabled,menu:{id:R.ChatInputSecondary,order:1,group:"navigation",when:C.and(Z.enabled,Z.location.isEqualTo("panel"),Z.chatModeKind.notEqualsTo("ask"),Z.inQuickChat.negate(),C.or(Z.lockedToCodingAgent.negate(),Z.lockedCodingAgentId.isEqualTo(zo.Background),Z.lockedCodingAgentId.isEqualTo(zo.Claude)))}})}async run(i){let t=i.get(Lt).lastFocusedWidget;t&&t.input.openPermissionPicker()}},ZQ=class a extends z{static{this.ID="workbench.action.chat.openModePicker"}constructor(){super({id:a.ID,title:P(6512,"Open Agent Picker"),tooltip:d(6523,null),category:fi,f1:!1,precondition:Z.enabled,keybinding:{when:C.and(Z.inChatInput,Z.location.isEqualTo("panel")),primary:2137,weight:100},menu:[{id:R.ChatInput,order:1,when:C.and(Z.enabled,Z.location.isEqualTo("panel"),Z.inQuickChat.negate(),C.or(Z.lockedToCodingAgent.negate(),Z.chatSessionHasCustomAgentTarget),C.or(Z.inAgentSessionsWelcome.negate(),Z.chatSessionHasCustomAgentTarget,Z.agentSessionType.isEqualTo(zo.Local))),group:"navigation"}]})}async run(i,...e){let o=i.get(Lt).lastFocusedWidget;o&&o.input.openModePicker()}},Ioe=class a extends z{static{this.ID="workbench.action.chat.openSessionTargetPicker"}constructor(){super({id:a.ID,title:P(6514,"Open Session Target Picker"),tooltip:d(6525,null),category:fi,f1:!1,precondition:C.and(Z.enabled,C.or(Z.chatSessionIsEmpty,Z.inAgentSessionsWelcome),Z.currentlyEditingInput.negate(),Z.currentlyEditing.negate()),menu:[{id:R.ChatInput,order:0,when:C.and(Z.enabled,Z.location.isEqualTo("panel"),Z.inQuickChat.negate(),Z.chatSessionIsEmpty,qo),group:"navigation"},{id:R.ChatInputSecondary,order:0,when:C.and(Z.enabled,Z.location.isEqualTo("panel"),Z.inQuickChat.negate(),qo.negate(),Z.chatSessionIsEmpty),group:"navigation"}]})}async run(i,...e){let o=i.get(Lt).lastFocusedWidget;o&&o.input.openSessionTargetPicker()}},pFe=class a extends z{static{this.ID="workbench.action.chat.openDelegationPicker"}constructor(){super({id:a.ID,title:P(6510,"Open Delegation Picker"),tooltip:d(6504,null),category:fi,f1:!1,precondition:C.and(Z.enabled,Z.chatSessionIsEmpty.negate(),Z.currentlyEditingInput.negate(),Z.currentlyEditing.negate()),menu:[{id:R.ChatInputSecondary,order:.5,when:C.and(Z.enabled,Z.location.isEqualTo("panel"),Z.inQuickChat.negate(),Z.chatSessionSupportsDelegation,Z.chatSessionIsEmpty.negate()),group:"navigation"}]})}async run(i,...e){let o=i.get(Lt).lastFocusedWidget;o&&o.input.openDelegationPicker()}},Krt=class a extends z{static{this.ID="workbench.action.chat.openWorkspacePicker"}constructor(){super({id:a.ID,title:P(6515,"Open Workspace Picker"),tooltip:d(6521,null),category:fi,f1:!1,precondition:C.and(Z.enabled,Z.inAgentSessionsWelcome),menu:[{id:R.ChatInputSecondary,order:.6,when:C.and(Z.inAgentSessionsWelcome,Z.chatSessionType.isEqualTo(kl)),group:"navigation"}]})}async run(i,...e){}},mFe=class a extends z{static{this.ID="workbench.action.chat.chatSessionPrimaryPicker"}constructor(){super({id:a.ID,title:P(6509,"Open Primary Session Picker"),category:fi,f1:!1,precondition:Z.enabled,menu:[{id:R.ChatInput,order:4,group:"navigation",when:C.and(Z.chatSessionHasModels,Z.chatSessionType.isEqualTo(zo.Cloud),C.or(Z.lockedToCodingAgent,C.and(Z.inAgentSessionsWelcome,Z.chatSessionType.notEqualsTo("local"))))},{id:R.ChatInputSecondary,order:4,group:"navigation",when:C.and(Z.chatSessionHasModels,Z.chatSessionType.notEqualsTo(zo.Cloud),C.or(qo.negate(),Z.chatSessionType.notEqualsTo(zo.Background)),C.or(Z.lockedToCodingAgent,C.and(Z.inAgentSessionsWelcome,Z.chatSessionType.notEqualsTo("local"))))}]})}async run(i,...e){let o=i.get(Lt).lastFocusedWidget;o&&o.input.openChatSessionPicker()}},Oln="workbench.action.chat.changeModel",XMi=class a extends z{static{this.ID=Oln}constructor(){super({id:a.ID,title:P(6508,"Change Model"),category:fi,f1:!1,precondition:Z.enabled})}run(i,...e){let t=e[0];To(typeof t.vendor=="string"&&typeof t.id=="string"&&typeof t.family=="string");let n=i.get(Lt).getAllWidgets();for(let r of n)r.input.switchModel(t)}},JMi=class a extends sGt{static{this.ID="workbench.action.edits.submit"}constructor(){let i=C.and(C.or($Mi,Z.editingRequestType.isEqualTo(Z.EditingRequestType.Sent)),Z.editingRequestType.notEqualsTo(Z.EditingRequestType.Queue),Z.editingRequestType.notEqualsTo(Z.EditingRequestType.Steer)),e=Z.chatModeKind.notEqualsTo("ask"),t=C.and(Z.inputHasText,i,Z.chatSessionOptionsValid);super({id:a.ID,title:P(6505,"Send"),f1:!1,category:fi,icon:L.arrowUp,precondition:t,menu:[{id:R.ChatExecute,order:4,when:C.and(i,e),group:"navigation",alt:{id:"workbench.action.chat.sendToNewChat",title:P(6495,"Send to New Chat"),icon:L.plus}}]})}},ZMi=class a extends z{static{this.ID="workbench.action.chat.submitWithoutDispatching"}constructor(){let i=C.and(Z.inputHasText,sPi,Z.chatModeKind.isEqualTo("ask"));super({id:a.ID,title:P(6517,"Send"),f1:!1,category:fi,precondition:i,keybinding:{when:Z.inChatInput,primary:1539,weight:100}})}run(i,...e){let t=e[0],o=i.get(Lt);(t?.widget??o.lastFocusedWidget)?.acceptInput(t?.inputValue,{noCommandDetection:!0})}},ePi=class a extends z{static{this.ID="workbench.action.chat.submitWithCodebase"}constructor(){let i=C.and(Z.inputHasText,sPi);super({id:a.ID,title:P(6492,"Send with {0}",`${dp}codebase`),precondition:i,keybinding:{when:Z.inChatInput,primary:2051,weight:100}})}run(i,...e){let t=e[0],o=i.get(Lt),n=t?.widget??o.lastFocusedWidget;if(!n)return;let s=i.get(Wn).getToolByName("codebase");s&&(n.input.attachmentModel.addContext({id:s.id,name:s.displayName??"",fullName:s.displayName??"",value:void 0,icon:q.isThemeIcon(s.icon)?s.icon:void 0,kind:"tool"}),n.acceptInput())}},tPi=class extends z{constructor(){let i=Z.inputHasText;super({id:"workbench.action.chat.sendToNewChat",title:P(6495,"Send to New Chat"),precondition:i,category:fi,f1:!1,keybinding:{weight:200,primary:3075,when:Z.inChatInput}})}async run(i,...e){let t=e[0],o=i.get(Lt),n=i.get(Gt),r=i.get(ct),s=i.get(si),l=t?.widget??o.lastFocusedWidget;if(!l)return;let c=l.getInput();l.viewModel&&await s.cancelCurrentRequestForSession(l.viewModel.sessionResource,"newSessionAction"),!(l.viewModel?.model&&!await Let(l.viewModel.model,void 0,r))&&(l.setInput(""),await xWt(l,n),l.acceptInput(c,{storeToHistory:!0}))}},Grt="workbench.action.chat.cancel",iPi=class a extends z{static{this.ID=Grt}constructor(){super({id:a.ID,title:P(6506,"Cancel"),f1:!1,category:fi,icon:L.stopCircle,menu:[{id:R.ChatExecute,when:C.and(Z.hasActiveRequest,Z.remoteJobCreating.negate(),Z.currentlyEditing.negate()),order:4,group:"navigation"},{id:R.ChatEditorInlineExecute,when:C.and(dFe.negate(),EP),order:4,group:"navigation"}],keybinding:{weight:200,primary:2057,when:C.and(Z.hasActiveRequest,Z.remoteJobCreating.negate()),win:{primary:513}}})}async run(i,...e){let t=e[0],o=i.get(Lt),n=i.get(re),r=i.get(_e),s=t?.widget??o.lastFocusedWidget;if(!s){r.publicLog2(HYe,{source:"cancelAction",reason:"noWidget",requestInProgress:"unknown",pendingRequests:0}),n.info("ChatCancelAction#run: No focused chat widget was found");return}let l=i.get(si);s.viewModel?await l.cancelCurrentRequestForSession(s.viewModel.sessionResource,"cancelAction"):(r.publicLog2(HYe,{source:"cancelAction",reason:"noViewModel",requestInProgress:"unknown",pendingRequests:0}),n.info("ChatCancelAction#run: Canceled chat widget has no view model"))}},Fln="workbench.edit.chat.cancel",oPi=class a extends z{static{this.ID=Fln}constructor(){super({id:a.ID,title:P(6507,"Cancel Edit"),f1:!1,category:fi,icon:L.x,menu:[{id:R.ChatMessageTitle,group:"navigation",order:1,when:C.and(Z.isRequest,Z.currentlyEditing,C.equals("config.chat.editRequests","input"))}],keybinding:{primary:9,when:C.and(Z.inChatInput,me.hoverVisible.toNegated(),me.hasNonEmptySelection.toNegated(),me.hasMultipleSelections.toNegated(),C.or(Z.currentlyEditing,Z.currentlyEditingInput)),weight:95}})}run(i,...e){let t=e[0],o=i.get(Lt),n=t?.widget??o.lastFocusedWidget;n&&n.finishedEditing()}},Wln="workbench.action.chat.getHandoffs",nPi=class a extends z{static{this.ID=Wln}constructor(){super({id:a.ID,title:P(6494,"Get Handoffs"),f1:!1,category:fi})}async run(i,...e){let t=i.get(kE),o=e.at(0),{builtin:n,custom:r}=await t.getLocalModes(),s=[...n,...r];if(o?.sourceCustomAgent){let l=o.sourceCustomAgent;s=s.filter(c=>c.name.get().toLowerCase()===l.toLowerCase())}return Amo(s)}},Vln="workbench.action.chat.executeHandoff",rPi=class a extends z{static{this.ID=Vln}constructor(){super({id:a.ID,title:P(6493,"Execute Handoff"),f1:!1,category:fi})}async run(i,...e){let t=i.get(Lt),o=e.at(0);if(!o?.id&&!o?.label)return{success:!1,error:"Either id or label is required"};let n;if(o.sessionResource){let c;try{c=A.parse(o.sessionResource)}catch{return{success:!1,error:`Invalid sessionResource URI: '${o.sessionResource}'`}}n=t.getWidgetBySessionResource(c)}else n=t.lastFocusedWidget;if(!n)return{success:!1,error:"No chat widget found. Provide sessionResource or focus a chat widget."};let r;if(o.sourceCustomAgent){let c=o.sourceCustomAgent.toLowerCase(),{builtin:u,custom:p}=n.input.currentChatModesObs.get();r=[...u,...p].find(h=>h.name.get().toLowerCase()===c||h.id.toLowerCase()===c)}r||(r=n.input.currentModeObs.get());let s=r?.handOffs?.get();if(!s||s.length===0)return{success:!1,error:`No handoffs available for mode '${r?.name.get()}'`};let l=o.id?s.find(c=>Axi(c)===o.id):void 0;if(!l&&o.label){let c=o.label.trim().toLowerCase();l=s.find(u=>u.label.trim().toLowerCase()===c)}return l?(await n.executeHandoff(l),{success:!0,targetMode:l.agent}):{success:!1,error:`No handoff with identifier '${o.id??o.label}' found for mode '${r?.name.get()}'`}}};function Owo(){let a=new O;return a.add(W(cO)),a.add(W(JMi)),a.add(W(ZMi)),a.add(W(iPi)),a.add(W(tPi)),a.add(W(ePi)),a.add(W(jMi)),a.add(W(QMi)),a.add(W(YMi)),a.add(W(Soe)),a.add(W(zrt)),a.add(W(ZQ)),a.add(W(Ioe)),a.add(W(pFe)),a.add(W(Krt)),a.add(W(mFe)),a.add(W(XMi)),a.add(W(oPi)),a.add(W(nPi)),a.add(W(rPi)),a}var hFe=class extends k{constructor(e,t,o){super();this.fileService=e;this.webContentExtractorService=t;this.chatAttachmentResolveService=o;this._attachments=new Map;this._fileWatchers=this._register(new Ot);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event}get attachments(){return Array.from(this._attachments.values())}get size(){return this._attachments.size}get fileAttachments(){return this.attachments.filter(e=>e.kind==="file"&&A.isUri(e.value)).map(e=>e.value)}getAttachmentIDs(){return new Set(this._attachments.keys())}async addFile(e,t){if(/\.(png|jpe?g|gif|bmp|webp)$/i.test(e.path)){let o=await this.asImageVariableEntry(e);o&&this.addContext(o);return}else if(e.scheme===Q.vscodeBrowser){let o=await this.chatAttachmentResolveService.resolveEditorAttachContext({resource:e});o&&this.addContext(o);return}else this.addContext(this.asFileVariableEntry(e,t))}addFolder(e){let t={kind:"directory",value:e,id:e.toString(),name:Be(e)};this.addContext(t)}clear(e=!1){if(e){let t=Array.from(this._attachments.keys());this._attachments.clear(),this._fileWatchers.clearAndDisposeAll(),this._onDidChange.fire({deleted:t,added:[],updated:[]})}else{let t=[],o=Array.from(this._attachments.keys());for(let n of o){let r=this._attachments.get(n);r&&!tR(r)&&(this._attachments.delete(n),this._fileWatchers.deleteAndDispose(n),t.push(n))}this._onDidChange.fire({deleted:t,added:[],updated:[]})}}addContext(...e){e=e.filter(t=>!this._attachments.has(t.id)),this.updateContext(yt.empty(),e)}clearAndSetContext(...e){this.updateContext(Array.from(this._attachments.keys()),e)}delete(...e){this.updateContext(e,yt.empty())}updateContext(e,t){let o=[],n=[],r=[];for(let s of e)this._attachments.get(s)&&(this._attachments.delete(s),o.push(s),this._fileWatchers.deleteAndDispose(s));for(let s of t){let l=this._attachments.get(s.id);l?Qi(l,s)||(this._fileWatchers.deleteAndDispose(s.id),this._attachments.set(s.id,s),r.push(s),this._watchAttachment(s),this._maybeResolveDirectoryImageCount(s)):(this._attachments.set(s.id,s),n.push(s),this._watchAttachment(s),this._maybeResolveDirectoryImageCount(s))}(o.length>0||n.length>0||r.length>0)&&this._onDidChange.fire({deleted:o,added:n,updated:r})}_maybeResolveDirectoryImageCount(e){if(e.kind!=="directory"||typeof e.imageCount=="number"||!A.isUri(e.value))return;let t=e.value;this.chatAttachmentResolveService.resolveDirectoryImages(t).then(o=>{let n=this._attachments.get(e.id);n&&n.kind==="directory"&&n.value?.toString()===t.toString()&&this.updateContext(yt.empty(),[{...n,imageCount:o.length}])},()=>{})}_watchAttachment(e){let t=eR.toUri(e);if(!t||t.scheme!==Q.file)return;let o=this.fileService.createWatcher(t,{recursive:!1,excludes:[]}),n=o.onDidChange(r=>{r.contains(t,2)&&this.updateContext([e.id],yt.empty())});this._fileWatchers.set(e.id,Fn(n,o))}asFileVariableEntry(e,t){return{kind:"file",value:t?{uri:e,range:t}:e,id:e.toString()+(t?.toString()??""),name:Be(e)}}async asImageVariableEntry(e){if(e.scheme===Q.file&&await this.fileService.canHandleResource(e))return await this.chatAttachmentResolveService.resolveImageEditorAttachContext(e);if(e.scheme===Q.http||e.scheme===Q.https){let t=await this.webContentExtractorService.readImage(e,Ie.None);if(t)return await this.chatAttachmentResolveService.resolveImageEditorAttachContext(e,t)}}};hFe=I([m(0,ge),m(1,foe),m(2,nV)],hFe);var gFe=le("chatAttachmentWidgetRegistry"),aGt=class{constructor(){this._factories=new Map}registerFactory(i,e){return this._factories.set(i,e),{dispose:()=>{this._factories.get(i)===e&&this._factories.delete(i)}}}createWidget(i,e,t){let o=this._factories.get(i.kind);if(o)return o(i,e,t)}};function qrt(a,i){let e=new O;return e.add($(a,ne.CLICK,t=>{t.detail!==2&&(Kt.stop(t,!0),i(lPi(new Ln(Me(a),t))))})),e.add($(a,ne.DBLCLICK,t=>{Kt.stop(t,!0),i(lPi(new Ln(Me(a),t),!0))})),e.add($(a,ne.KEY_DOWN,t=>{let o=lPi(new mi(t));o&&(Kt.stop(t,!0),i(o))})),e}function lPi(a,i){if(a instanceof mi){let e;return a.equals(3)||et&&a.equals(2066)?e=!1:a.equals(10)&&(e=!0),typeof e>"u"?void 0:{editorOptions:{preserveFocus:e,pinned:!e},openToSide:!1}}else return{editorOptions:{preserveFocus:!i,pinned:i||a.middleButton},openToSide:a.ctrlKey||a.metaKey||a.altKey}}var sV="revealInExplorer",fFe="workbench.action.files.revert",lGt="explorer.openToSide",cGt="explorer.openWith",dGt="selectForCompare",uGt="compareSelected",pGt="compareFiles",$rt="workbench.files.action.compareWithSaved",Rfe="copyFilePath",Lfe="copyRelativeFilePath",jrt="workbench.action.files.saveAs",mGt=P(12148,"Save As..."),vFe="workbench.action.files.save",cPi=P(12146,"Save"),hGt="workbench.action.files.saveWithoutFormatting",Fwo=P(12149,"Save without Formatting"),bFe="saveAll",Wwo=P(12147,"Save All"),Mfe="workbench.files.action.saveAllInGroup",gGt="workbench.action.files.saveFiles",e6=new Y("groupFocusedInOpenEditors",!1),SFe=new Y("dirtyEditorFocusedInOpenEditors",!1),Qrt=new Y("readonlyEditorFocusedInOpenEditors",!1),fGt=new Y("openEditorsSelectedFileOrUntitled",!0),Yrt=new Y("resourceSelectedForCompare",!1),vGt="removeRootFolder",Vwo=d(12145,null),Bwo="previousCompressedFolder",Hwo="nextCompressedFolder",Uwo="firstCompressedFolder",zwo="lastCompressedFolder",aV="workbench.action.files.newUntitledFile",bGt=P(12144,"New Untitled Text File"),Kwo="workbench.action.files.newFile";var SGt=class{constructor(i){this.root=new IGt;for(let[e,t]of i)for(let o of t)this.root.add(e,o)}toString(){return this.root.toString()}getAttributes(i,e){let t=i.lastIndexOf(".");return t<1?{dirname:e,basename:i,extname:""}:{dirname:e,basename:i.substring(0,t),extname:i.substring(t+1)}}nest(i,e){let t=new IGt;for(let r of i){let s=this.getAttributes(r,e),l=this.root.get(r,s);for(let c of l)t.add(c,r)}let o=(r,s=new Set)=>{if(s.has(r))return[];s.add(r);let l=this.getAttributes(r,e),c=t.get(r,l);return c.length===0?[r]:c.length===1&&c[0]===r?[r]:c.flatMap(u=>o(u,s))},n=new Map;for(let r of i){let s=o(r);s.length===0&&(s=[r]);for(let l of s){let c=n.get(l);c||n.set(l,c=new Set),r!==l&&c.add(r)}}return n}},IGt=class a{constructor(){this.value=new dPi;this.map=new Map}add(i,e){if(i==="")this.value.add(i,e);else if(i[0]==="*")this.value.add(i,e);else{let t=i[0],o=i.slice(1),n=this.map.get(t);n||this.map.set(t,n=new a),n.add(o,e)}}get(i,e){let t=[];t.push(...this.value.get(i,e));let o=i[0],n=i.slice(1),r=this.map.get(o);return r&&t.push(...r.get(n,e)),t}toString(i=""){let e=[];return this.value.hasItems&&e.push(`* => 
`+this.value.toString(i+"  ")),[...this.map.entries()].map(([t,o])=>e.push("^"+t+` => 
`+o.toString(i+"  "))),e.map(t=>i+t).join(`
`)}},dPi=class a{constructor(){this.star=[];this.epsilon=[];this.map=new Map;this.hasItems=!1}add(i,e){if(this.hasItems=!0,i==="*")this.star.push(new yGt(e));else if(i==="")this.epsilon.push(new yGt(e));else{let t=i[i.length-1],o=i.slice(0,i.length-1);if(t==="*")throw Error("Unexpected star in SufTrie key: "+i);{let n=this.map.get(t);n||this.map.set(t,n=new a),n.add(o,e)}}}get(i,e){let t=[];i===""&&t.push(...this.epsilon.map(s=>s.substitute(e))),this.star.length&&t.push(...this.star.map(s=>s.substitute(e,i)));let o=i[i.length-1],n=i.slice(0,i.length-1),r=this.map.get(o);return r&&t.push(...r.get(n,e)),t}toString(i=""){let e=[];return this.star.length&&e.push("* => "+this.star.join("; ")),this.epsilon.length&&e.push("\u03B5 => "+this.epsilon.join("; ")),[...this.map.entries()].map(([t,o])=>e.push(t+`$ => 
`+o.toString(i+"  "))),e.map(t=>i+t).join(`
`)}};var Gwo=/\$[({](capture|basename|dirname|extname)[)}]/g,yGt=class{constructor(i){this.tokens=[];Gwo.lastIndex=0;let e,t=0;for(;e=Gwo.exec(i);){let o=i.slice(t,e.index);this.tokens.push(o);let n=e[1];switch(n){case"basename":case"dirname":case"extname":case"capture":this.tokens.push({capture:n});break;default:throw Error("unknown substitution type: "+n)}t=e.index+e[0].length}if(t!==i.length){let o=i.slice(t,i.length);this.tokens.push(o)}}substitute(i,e){return this.tokens.map(t=>{if(typeof t=="string")return t;switch(t.capture){case"basename":return i.basename;case"dirname":return i.dirname;case"extname":return i.extname;case"capture":return e||""}}).join("")}};var wGt=class{constructor(i,e,t,o,n){this.contextService=i;this.uriIdentityService=e;this._onDidChangeRoots=new T;let r=()=>this._roots=this.contextService.getWorkspace().folders.map(s=>new Tf(s.uri,t,o,n,void 0,!0,!1,!1,!1,s.name));r(),this._listener=this.contextService.onDidChangeWorkspaceFolders(()=>{r(),this._onDidChangeRoots.fire()})}get roots(){return this._roots}get onDidChangeRoots(){return this._onDidChangeRoots.event}findAll(i){return ui(this.roots.map(e=>e.find(i)))}findClosest(i){let e=this.contextService.getWorkspaceFolder(i);if(e){let t=this.roots.find(o=>this.uriIdentityService.extUri.isEqual(o.resource,e.uri));if(t)return t.find(i)}return null}dispose(){this._onDidChangeRoots.dispose(),je(this._listener)}},yoe=class yoe{constructor(i,e,t,o,n,r,s,l,c,u=sl(i),p,h=!1){this.resource=i;this.fileService=e;this.configService=t;this.filesConfigService=o;this._parent=n;this._isDirectory=r;this._isSymbolicLink=s;this._readonly=l;this._locked=c;this._name=u;this._mtime=p;this._unknown=h;this.error=void 0;this._isExcluded=!1;this.markedAsFindResult=!1;this._isDirectoryResolved=!1}get isExcluded(){return this._isExcluded?!0:this._parent?this._parent.isExcluded:!1}set isExcluded(i){this._isExcluded=i}hasChildren(i){return this.hasNests?this.nestedChildren?.some(e=>i(e))??!1:this.isDirectory}get hasNests(){return!!this.nestedChildren?.length}get isDirectoryResolved(){return this._isDirectoryResolved}get isSymbolicLink(){return!!this._isSymbolicLink}get isDirectory(){return!!this._isDirectory}get isReadonly(){return this.filesConfigService.isReadonly(this.resource,{resource:this.resource,name:this.name,readonly:this._readonly,locked:this._locked})}get mtime(){return this._mtime}get name(){return this._name}get isUnknown(){return this._unknown}get parent(){return this._parent}get root(){return this._parent?this._parent.root:this}get children(){return new Map}updateName(i){this._parent?.removeChild(this),this._name=i,this._parent?.addChild(this)}getId(){let i=this.root.resource.toString()+"::"+this.resource.toString();return this.isMarkedAsFiltered()&&(i+="::findFilterResult"),i}toString(){return`ExplorerItem: ${this.name}`}get isRoot(){return this===this.root}static create(i,e,t,o,n,r){let s=new yoe(o.resource,i,e,t,n,o.isDirectory,o.isSymbolicLink,o.readonly,o.locked,o.name,o.mtime,!o.isFile&&!o.isDirectory);if(s.isDirectory&&(s._isDirectoryResolved=!!o.children||!!r&&r.some(l=>Yr(l,s.resource)),o.children))for(let l=0,c=o.children.length;l<c;l++){let u=yoe.create(i,e,t,o.children[l],s,r);s.addChild(u)}return s}static mergeLocalWithDisk(i,e){if(i.resource.toString()!==e.resource.toString())return;let t=i.isDirectory||e.isDirectory;if(!(t&&e._isDirectoryResolved&&!i._isDirectoryResolved)&&(e.resource=i.resource,e.isRoot||e.updateName(i.name),e._isDirectory=i.isDirectory,e._mtime=i.mtime,e._isDirectoryResolved=i._isDirectoryResolved,e._isSymbolicLink=i.isSymbolicLink,e.error=i.error,t&&i._isDirectoryResolved)){let o=new dt;e.children.forEach(n=>{o.set(n.resource,n)}),e.children.clear(),i.children.forEach(n=>{let r=o.get(n.resource);r?(yoe.mergeLocalWithDisk(n,r),e.addChild(r),o.delete(n.resource)):e.addChild(n)}),o.forEach(n=>{n instanceof t6&&e.addChild(n)})}}addChild(i){i._parent=this,i.updateResource(!1),this.children.set(this.getPlatformAwareName(i.name),i)}getChild(i){return this.children.get(this.getPlatformAwareName(i))}fetchChildren(i){let e=this.configService.getValue({resource:this.root.resource}).explorer.fileNesting;return e.enabled&&this.nestedChildren?this.nestedChildren:(async()=>{if(!this._isDirectoryResolved){let o=i==="modified";this.error=void 0;try{let n=await this.fileService.resolve(this.resource,{resolveSingleChildDescendants:!0,resolveMetadata:o}),r=yoe.create(this.fileService,this.configService,this.filesConfigService,n,this);yoe.mergeLocalWithDisk(r,this)}catch(n){throw this.error=n,n}this._isDirectoryResolved=!0}let t=[];if(e.enabled){let o=[],n=[];for(let s of this.children.entries())s[1].nestedParent=void 0,s[1].isDirectory?n.push(s):o.push(s);let r=this.fileNester.nest(o.map(([s])=>s),this.getPlatformAwareName(this.name));for(let[s,l]of o){let c=r.get(s);if(c!==void 0){l.nestedChildren=[];for(let u of c.keys()){let p=Ti(this.children.get(u));l.nestedChildren.push(p),p.nestedParent=l}t.push(l)}else l.nestedChildren=void 0}for(let[s,l]of n.values())t.push(l)}else this.children.forEach(o=>{t.push(o)});return t})()}get fileNester(){if(!this.root._fileNester){let i=this.configService.getValue({resource:this.root.resource}).explorer.fileNesting,e=Object.entries(i.patterns).filter(t=>typeof t[0]=="string"&&typeof t[1]=="string"&&t[0]&&t[1]).map(([t,o])=>[this.getPlatformAwareName(t.trim()),o.split(",").map(n=>this.getPlatformAwareName(n.trim().replace(/\u200b/g,"").trim())).filter(n=>n!=="")]);this.root._fileNester=new SGt(e)}return this.root._fileNester}removeChild(i){this.nestedChildren=void 0,this.children.delete(this.getPlatformAwareName(i.name))}forgetChildren(){this.children.clear(),this.nestedChildren=void 0,this._isDirectoryResolved=!1,this._fileNester=void 0}getPlatformAwareName(i){return this.fileService.hasCapability(this.resource,1024)?i:i.toLowerCase()}move(i){this.nestedParent?.removeChild(this),this._parent?.removeChild(this),i.removeChild(this),i.addChild(this),this.updateResource(!0)}updateResource(i){this._parent&&(this.resource=Ve(this._parent.resource,this.name)),i&&this.isDirectory&&this.children.forEach(e=>{e.updateResource(!0)})}rename(i){this.updateName(i.name),this._mtime=i.mtime,this.updateResource(!0)}find(i){let e=!this.fileService.hasCapability(i,1024);return i&&this.resource.scheme===i.scheme&&xr(this.resource.authority,i.authority)&&(e?aT(i.path,this.resource.path):i.path.startsWith(this.resource.path))?this.findByPath(Bh(i.path,Vo.sep),this.resource.path.length,e):null}findByPath(i,e,t){if(t8i(Bh(this.resource.path,Vo.sep),i,t))return this;if(this.isDirectory){for(;e<i.length&&i[e]===Vo.sep;)e++;let o=i.indexOf(Vo.sep,e);o===-1&&(o=i.length);let n=i.substring(e,o),r=this.children.get(this.getPlatformAwareName(n));if(r)return r.findByPath(i,o,t)}return null}isMarkedAsFiltered(){return this.markedAsFindResult}markItemAndParentsAsFiltered(){this.markedAsFindResult=!0,this.parent?.markItemAndParentsAsFiltered()}unmarkItemAndChildren(){this.markedAsFindResult=!1,this.children.forEach(i=>i.unmarkItemAndChildren())}};I([bi],yoe.prototype,"children",1);var Tf=yoe,t6=class extends Tf{constructor(i,e,t,o,n){super(A.file(""),i,e,t,o,n),this._isDirectoryResolved=!0}};var Qa=le("explorerService");function Bln(a){let i=a.lastFocusedList,e=i?.getHTMLElement();if(e&&Na(e)){let t;if(i instanceof Gc){let o=i.getFocusedElements();o.length&&(t=o[0])}else if(i instanceof Zv){let o=i.getFocus();o.length&&(t=o[0])}return t}}function Pfe(a,i,e){if(A.isUri(a))return a;let t=Bln(e);return t instanceof Tf?t.resource:t instanceof dg?t.getResource():po.getOriginalUri(i.activeEditor,{supportSideBySide:1})}function lV(a,i,e,t,o){let n=i.lastFocusedList,r=n?.getHTMLElement();if(r&&Na(r)){if(n instanceof Zv&&n.getFocus().every(u=>u instanceof Tf)){let u=o.getContext(!0,!0);if(u.length)return u.map(p=>p.resource)}if(n instanceof Gc){let u=ui(n.getSelectedElements().filter(v=>v instanceof dg).map(v=>v.getResource())),p=n.getFocusedElements(),h=p.length?p[0]:void 0,g;if(A.isUri(a))g=a.toString();else if(h instanceof dg){let v=h.getResource();g=v?v.toString():void 0}let f=u.findIndex(v=>v.toString()===g);if(f!==-1){let v=u[f];return u.splice(f,1),u.unshift(v),u}}}let l=t.activeGroup.selectedEditors;if(l.length>1&&A.isUri(a)){let u=l.findIndex(p=>p.matches({resource:a}));if(u!==-1){let p=l[u];return l.splice(u,1),l.unshift(p),l.map(h=>po.getOriginalUri(h)).filter(h=>!!h)}}let c=Pfe(a,e,i);return c?[c]:[]}function uPi(a){let i=a.get(Co).lastFocusedList,e=i?.getHTMLElement();if(e&&Na(e)&&i instanceof Gc){let t=ui(i.getSelectedElements().filter(s=>s instanceof dg)),o=i.getFocusedElements(),n=o.length?o[0]:void 0,r;return n instanceof dg&&(r=n),t.some(s=>s===r)?t:r?[r]:void 0}}var e1=class{constructor(i,e,t,o,n){this.progressService=i;this.dialogService=e;this.explorerService=t;this.editorService=o;this.fileService=n}static{this.MAX_PARALLEL_UPLOADS=20}upload(i,e){let t=new qe,o=this.progressService.withProgress({location:10,delay:800,cancellable:!0,title:d(12178,null)},async n=>this.doUpload(i,this.toTransfer(e),n,t.token),()=>t.dispose(!0));return this.progressService.withProgress({location:pS,delay:500},()=>o),o}toTransfer(i){if(mQi(i))return i.dataTransfer;let e={items:[]};for(let t of i)e.items.push({webkitGetAsEntry:()=>({name:t.name,isDirectory:!1,isFile:!0,createReader:()=>{throw new Error("Unsupported for files")},file:o=>o(t)})});return e}async doUpload(i,e,t,o){let n=e.items,r=[];for(let p of n)r.push(p.webkitGetAsEntry());let s=[],l={startTime:Date.now(),progressScheduler:new hA(p=>{t.report(p[p.length-1])},1e3),filesTotal:r.length,filesUploaded:0,totalBytesUploaded:0},c=new _k(e1.MAX_PARALLEL_UPLOADS);await vn.settled(r.map(p=>c.queue(async()=>{if(o.isCancellationRequested)return;if(i&&p.name&&i.getChild(p.name)){let{confirmed:g}=await this.dialogService.confirm(mPi(p.name));if(!g||(await this.explorerService.applyBulkEdit([new Yu(Ve(i.resource,p.name),void 0,{recursive:!0,folder:i.getChild(p.name)?.isDirectory})],{undoLabel:d(12175,null,p.name),progressLabel:d(12176,null,p.name)}),o.isCancellationRequested))return}let h=await this.doUploadEntry(p,i.resource,i,t,l,o);h&&s.push(h)}))),l.progressScheduler.dispose();let u=s[0];!o.isCancellationRequested&&u?.isFile&&await this.editorService.openEditor({resource:u.resource,options:{pinned:!0}})}async doUploadEntry(i,e,t,o,n,r){if(r.isCancellationRequested||!i.name||!i.isFile&&!i.isDirectory)return;let s=0,l=(u,p)=>{s+=p,n.totalBytesUploaded+=p;let h=n.totalBytesUploaded/((Date.now()-n.startTime)/1e3),g;u<Ml.MB?n.filesTotal===1?g=`${i.name}`:g=d(12180,null,n.filesUploaded,n.filesTotal,Ml.formatSize(h)):g=d(12179,null,i.name,Ml.formatSize(s),Ml.formatSize(u),Ml.formatSize(h)),n.progressScheduler.work({message:g})};n.filesUploaded++,l(0,0);let c=Ve(e,i.name);if(i.isFile){let u=await new Promise((p,h)=>i.file(p,h));return r.isCancellationRequested?void 0:(typeof u.stream=="function"&&u.size>Ml.MB?await this.doUploadFileBuffered(c,u,l,r):await this.doUploadFileUnbuffered(c,u,l),{isFile:!0,resource:c})}else{if(await this.fileService.createFolder(c),r.isCancellationRequested)return;let u=i.createReader(),p=[],h=!1;do{let S=await new Promise((y,w)=>u.readEntries(y,w));S.length>0?p.push(...S):h=!0}while(!h&&!r.isCancellationRequested);n.filesTotal+=p.length;let g=t?.getChild(i.name)||void 0,f=[],v=[];for(let S of p)S.isFile?f.push(S):S.isDirectory&&v.push(S);let b=new _k(e1.MAX_PARALLEL_UPLOADS);await vn.settled(f.map(S=>b.queue(()=>this.doUploadEntry(S,c,g,o,n,r))));for(let S of v)await this.doUploadEntry(S,c,g,o,n,r);return{isFile:!1,resource:c}}}async doUploadFileBuffered(i,e,t,o){let n=ywe({highWaterMark:10}),r=this.fileService.writeFile(i,n);try{let s=e.stream().getReader(),l=await s.read();for(;!l.done&&!o.isCancellationRequested;){let c=Ke.wrap(l.value);if(await n.write(c),o.isCancellationRequested)break;t(e.size,c.byteLength),l=await s.read()}n.end(void 0)}catch(s){n.error(s),n.end()}o.isCancellationRequested||await r}doUploadFileUnbuffered(i,e,t){return new Promise((o,n)=>{let r=new FileReader;r.onload=async s=>{try{if(s.target?.result instanceof ArrayBuffer){let l=Ke.wrap(new Uint8Array(s.target.result));await this.fileService.writeFile(i,l),t(e.size,l.byteLength)}else throw new Error("Could not read from dropped file.");o()}catch(l){n(l)}},r.readAsArrayBuffer(e)})}};e1=I([m(0,Go),m(1,ct),m(2,Qa),m(3,ie),m(4,ge)],e1);var IFe=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.fileService=i;this.hostService=e;this.contextService=t;this.configurationService=o;this.dialogService=n;this.workspaceEditingService=r;this.explorerService=s;this.editorService=l;this.progressService=c;this.notificationService=u;this.instantiationService=p}async import(i,e,t){let o=new qe,n=this.progressService.withProgress({location:10,delay:800,cancellable:!0,title:d(12160,null)},async()=>await this.doImport(i,e,t,o.token),()=>o.dispose(!0));return this.progressService.withProgress({location:pS,delay:500},()=>n),n}async doImport(i,e,t,o){let n=ui((await this.instantiationService.invokeFunction(c=>dxe(c,e))).map(c=>c.resource));await Promise.all(n.map(c=>this.fileService.activateProvider(c.scheme)));let r=ui(n.filter(c=>this.fileService.hasProvider(c))),s=await this.fileService.resolveAll(r.map(c=>({resource:c})));if(o.isCancellationRequested)return;this.hostService.focus(t);let l=s.filter(c=>c.success&&c.stat?.isDirectory).map(c=>({uri:c.stat.resource}));if(l.length>0&&i.isRoot){let c;(b=>(b[b.Copy=1]="Copy",b[b.Add=2]="Add"))(c||={});let u=[{label:l.length>1?d(12158,null):d(12156,null),run:()=>1}],p,h=this.contextService.getWorkspace().folders.map(f=>f.uri.scheme);l.some(f=>h.indexOf(f.uri.scheme)>=0)?(u.unshift({label:l.length>1?d(12151,null):d(12150,null),run:()=>2}),p=l.length>1?d(12169,null):d(12168,null,Be(l[0].uri))):p=l.length>1?d(12157,null):d(12155,null,Be(l[0].uri));let{result:g}=await this.dialogService.prompt({type:ft.Info,message:p,buttons:u,cancelButton:!0});if(g===2)return this.workspaceEditingService.addFolders(l);if(g===1)return this.importResources(i,r,o)}else if(i instanceof Tf)return this.importResources(i,r,o)}async importResources(i,e,t){if(e&&e.length>0){let o=await this.fileService.resolve(i.resource);if(t.isCancellationRequested)return;let n=new Set,r=this.fileService.hasCapability(i.resource,1024);o.children&&o.children.forEach(h=>{n.add(r?h.name:h.name.toLowerCase())});let s=0,l=ui(await vn.settled(e.map(async h=>{if(!await this.fileService.exists(h)){s++;return}if(!(n.has(r?Be(h):Be(h).toLowerCase())&&!(await this.dialogService.confirm(mPi(Be(h)))).confirmed))return h})));s>0&&this.notificationService.error(s>1?d(12171,null):d(12170,null));let c=l.map(h=>{let g=Be(h),f=Ve(i.resource,g);return new Yu(h,f,{overwrite:!0,copy:!0})}),u=this.configurationService.getValue().explorer.confirmUndo;if(await this.explorerService.applyBulkEdit(c,{undoLabel:l.length===1?d(12172,null,Be(l[0])):d(12173,null,l.length),progressLabel:l.length===1?d(12159,null,Be(l[0])):d(12161,null,l.length),progressLocation:10,confirmBeforeUndo:u==="verbose"||u==="default"}),this.configurationService.getValue().explorer.autoOpenDroppedFile&&c.length===1){let h=this.explorerService.findClosest(c[0].newResource);h&&!h.isDirectory&&this.editorService.openEditor({resource:h.resource,options:{pinned:!0}})}}}};IFe=I([m(0,ge),m(1,ti),m(2,Ae),m(3,B),m(4,ct),m(5,iS),m(6,Qa),m(7,ie),m(8,Go),m(9,Ne),m(10,F)],IFe);var i6=class{constructor(i,e,t,o,n,r){this.fileService=i;this.explorerService=e;this.progressService=t;this.logService=o;this.fileDialogService=n;this.storageService=r}static{this.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY="workbench.explorer.downloadPath"}download(i){let e=new qe,t=this.progressService.withProgress({location:10,delay:800,cancellable:Ft,title:d(12165,null)},async o=>this.doDownload(i,o,e),()=>e.dispose(!0));return this.progressService.withProgress({location:pS,delay:500},()=>t),t}async doDownload(i,e,t){for(let o of i){if(t.token.isCancellationRequested)return;Ft?await this.doDownloadBrowser(o.resource,e,t):await this.doDownloadNative(o,e,t)}}async doDownloadBrowser(i,e,t){let o=await this.fileService.resolve(i,{resolveMetadata:!0});if(t.token.isCancellationRequested)return;let n=32*Ml.MB,r=o.isDirectory||o.size>n,s=zi();if(r&&Vk.supported(s))try{let l=await s.showDirectoryPicker(),c={startTime:Date.now(),progressScheduler:new hA(u=>{e.report(u[u.length-1])},1e3),filesTotal:o.isDirectory?0:1,filesDownloaded:0,totalBytesDownloaded:0,fileBytesDownloaded:0};if(o.isDirectory){let u=await l.getDirectoryHandle(o.name,{create:!0});await this.downloadFolderBrowser(o,u,c,t.token)}else await this.downloadFileBrowser(l,o,c,t.token);c.progressScheduler.dispose()}catch(l){this.logService.warn(l),t.cancel()}else if(o.isFile){let l;try{l=(await this.fileService.readFile(o.resource,{limits:{size:n}},t.token)).value.buffer}catch{l=In.uriToBrowserUri(o.resource)}t.token.isCancellationRequested||IQi(l,o.name)}}async downloadFileBufferedBrowser(i,e,t,o){let n=await this.fileService.readFileStream(i,void 0,o);if(o.isCancellationRequested){e.close();return}return new Promise((r,s)=>{let l=n.value,c=new O;c.add(ee(()=>e.close())),c.add(bd(o.onCancellationRequested)(()=>{c.dispose(),s(wy())})),_L(l,{onData:u=>{e.write(u.buffer),this.reportProgress(n.name,n.size,u.byteLength,t)},onError:u=>{c.dispose(),s(u)},onEnd:()=>{c.dispose(),r()}},o)})}async downloadFileUnbufferedBrowser(i,e,t,o){let n=await this.fileService.readFile(i,void 0,o);o.isCancellationRequested||(e.write(n.value.buffer),this.reportProgress(n.name,n.size,n.value.byteLength,t)),e.close()}async downloadFileBrowser(i,e,t,o){t.filesDownloaded++,t.fileBytesDownloaded=0,this.reportProgress(e.name,0,0,t);let r=await(await i.getFileHandle(e.name,{create:!0})).createWritable();return e.size>Ml.MB?this.downloadFileBufferedBrowser(e.resource,r,t,o):this.downloadFileUnbufferedBrowser(e.resource,r,t,o)}async downloadFolderBrowser(i,e,t,o){if(i.children){t.filesTotal+=i.children.map(n=>n.isFile).length;for(let n of i.children){if(o.isCancellationRequested)return;if(n.isFile)await this.downloadFileBrowser(e,n,t,o);else{let r=await e.getDirectoryHandle(n.name,{create:!0}),s=await this.fileService.resolve(n.resource,{resolveMetadata:!0});await this.downloadFolderBrowser(s,r,t,o)}}}}reportProgress(i,e,t,o){o.fileBytesDownloaded+=t,o.totalBytesDownloaded+=t;let n=o.totalBytesDownloaded/((Date.now()-o.startTime)/1e3),r;e<Ml.MB?o.filesTotal===1?r=i:r=d(12167,null,o.filesDownloaded,o.filesTotal,Ml.formatSize(n)):r=d(12166,null,i,Ml.formatSize(o.fileBytesDownloaded),Ml.formatSize(e),Ml.formatSize(n)),o.progressScheduler.work({message:r})}async doDownloadNative(i,e,t){e.report({message:i.name});let o,n=this.storageService.get(i6.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY,-1);n?o=Ve(A.file(n),i.name):o=Ve(i.isDirectory?await this.fileDialogService.defaultFolderPath(Q.file):await this.fileDialogService.defaultFilePath(Q.file),i.name);let r=await this.fileDialogService.showSaveDialog({availableFileSystems:[Q.file],saveLabel:d(12163,null),title:d(12152,null),defaultUri:o});r?(this.storageService.store(i6.LAST_USED_DOWNLOAD_PATH_STORAGE_KEY,ai(r).fsPath,-1,1),await this.explorerService.applyBulkEdit([new Yu(i.resource,r,{overwrite:!0,copy:!0})],{undoLabel:d(12162,null,i.name),progressLabel:d(12164,null,i.name),progressLocation:10})):t.cancel()}};i6=I([m(0,ge),m(1,Qa),m(2,Go),m(3,re),m(4,nn),m(5,de)],i6);function mPi(a){return{message:d(12154,null,a),detail:d(12174,null),primaryButton:d(12177,null),type:"warning"}}function $wo(a){return a.length>1?{message:d(12153,null,a.length),detail:fx(a)+`
`+d(12174,null),primaryButton:d(12177,null),type:"warning"}:mPi(Be(a[0]))}var Nfe="explorer.newFile",hPi=P(12066,"New File..."),CFe="explorer.newFolder",gPi=P(12067,"New Folder..."),Qwo=d(12076,null),Ywo=d(12035,null),Xwo=d(12029,null),Jwo=d(12072,null),AGt=new Y("fileCopied",!1),fPi="explorer.download",Zwo=d(12050,null),vPi="explorer.upload",eCo=d(12098,null),jwo="explorer.confirmDelete",Hln=5e6;async function tCo(a,i){a&&(a.indexOf("/")>=0||a.indexOf("\\")>=0)&&await i.refresh()}async function bPi(a,i,e,t,o,n,r,s=!1,l=!1){let c;r?c=ii?d(12038,null):d(12039,null):c=d(12037,null);let u=p4e(n,f=>f.resource),p=new Set;for(let f of u)for(let v of i.getDirty(f.resource))p.add(v);if(p.size){let f;if(u.length>1?f=d(12045,null):u[0].isDirectory?p.size===1?f=d(12047,null,u[0].name):f=d(12046,null,u[0].name,p.size):f=d(12044,null,u[0].name),(await e.confirm({type:"warning",message:f,detail:d(12048,null),primaryButton:c})).confirmed)s=!0;else return}if(!s){let f=u.filter(v=>o.isReadonly(v.resource));if(f.length){let v;if(f.length>1?v=d(12073,null):f[0].isDirectory?v=d(12075,null,u[0].name):v=d(12074,null,u[0].name),!(await e.confirm({type:"warning",message:v,detail:d(12027,null),primaryButton:d(12026,null)})).confirmed)return}}let h,g=u.some(f=>f.isDirectory)?d(12061,null):u.length>1?d(12082,null):d(12081,null);if(s||t.getValue(jwo)===!1)h={confirmed:!0};else if(r){let{message:f,detail:v}=Uln(u);v+=v?`
`:"",ii?v+=u.length>1?d(12095,null):d(12094,null):v+=u.length>1?d(12097,null):d(12096,null),h=await e.confirm({message:f,detail:v,primaryButton:c,checkbox:{label:d(12049,null)}})}else{let{message:f,detail:v}=zln(u);v+=v?`
`:"",v+=g,h=await e.confirm({type:"warning",message:f,detail:v,primaryButton:c})}if(h.confirmed&&h.checkboxChecked===!0&&await t.updateValue(jwo,!1),!!h.confirmed)try{let f=u.map(b=>new Yu(b.resource,void 0,{recursive:!0,folder:b.isDirectory,ignoreIfNotExists:l,skipTrashBin:!r,maxSize:Hln})),v={undoLabel:u.length>1?d(12036,null,u.length):d(12040,null,u[0].name),progressLabel:u.length>1?d(12042,null,u.length):d(12043,null,u[0].name)};await a.applyBulkEdit(f,v)}catch(f){let v,b,S;if(r?(v=ii?d(12005,null):d(12093,null),b=g,S=d(12041,null)):(v=Mn(f,!1),S=d(12084,null)),(await e.confirm({type:"warning",message:v,detail:b,primaryButton:S})).confirmed)return r&&(r=!1),s=!0,l=!0,bPi(a,i,e,t,o,n,r,s,l)}}function Uln(a){return iCo(a)?{message:d(12019,null,a.length),detail:fx(a.map(i=>i.resource))}:a.length>1?a[0].isDirectory?{message:d(12022,null,a.length),detail:fx(a.map(i=>i.resource))}:{message:d(12021,null,a.length),detail:fx(a.map(i=>i.resource))}:a[0].isDirectory&&!a[0].isSymbolicLink?{message:d(12020,null,a[0].name),detail:""}:{message:d(12018,null,a[0].name),detail:""}}function zln(a){return iCo(a)?{message:d(12014,null,a.length),detail:fx(a.map(i=>i.resource))}:a.length>1?a[0].isDirectory?{message:d(12017,null,a.length),detail:fx(a.map(i=>i.resource))}:{message:d(12016,null,a.length),detail:fx(a.map(i=>i.resource))}:a[0].isDirectory?{message:d(12015,null,a[0].name),detail:""}:{message:d(12013,null,a[0].name),detail:""}}function iCo(a){let i=a.find(t=>t.isDirectory),e=a.find(t=>!t.isDirectory);return!!i&&!!e}async function CGt(a,i,e,t,o,n){let r=typeof o.resource=="string"?o.resource:sl(o.resource),s=Ve(t.resource,r);if(!(n==="disabled"&&!await Gln(i,e,s))){for(;!o.allowOverwrite&&a.findClosest(s);)n!=="disabled"&&(r=Kln(r,!!o.isDirectory,n)),s=Ve(t.resource,r);return s}}function Kln(a,i,e){if(e==="simple"){let p=a,h="";i||(h=km(a),p=Jo(a,h));let g=/^(.+ copy)( \d+)?$/;return g.test(p)?p.replace(g,(f,v,b)=>{let S=b?parseInt(b):1;return S===0?`${v}`:S<1073741824?`${v} ${S+1}`:`${v}${b} copy`})+h:`${p} copy${h}`}let t="[\\.\\-_]",o=1073741824,n=RegExp("(.*"+t+")(\\d+)(\\..*)$");if(!i&&a.match(n))return a.replace(n,(p,h,g,f)=>{let v=parseInt(g);return v<o?h+String(v+1).padStart(g.length,"0")+f:`${h}${g}.1${f}`});let r=RegExp("(\\d+)("+t+".*)(\\..*)$");if(!i&&a.match(r))return a.replace(r,(p,h,g,f)=>{let v=parseInt(h);return v<o?String(v+1).padStart(h.length,"0")+g+f:`${h}${g}.1${f}`});let s=RegExp("(\\d+)(\\..*)$");if(!i&&a.match(s))return a.replace(s,(p,h,g)=>{let f=parseInt(h);return f<o?String(f+1).padStart(h.length,"0")+g:`${h}.1${g}`});let l=a.lastIndexOf(".");if(!i&&l>=0)return`${a.substr(0,l)}.1${a.substr(l)}`;let c=RegExp("(\\d+)$");if(!i&&l===-1&&a.match(c))return a.replace(c,(p,h)=>{let g=parseInt(h);return g<o?String(g+1).padStart(h.length,"0"):`${h}.1`});let u=RegExp("(.*)(\\d*)$");return!i&&l===-1&&a.match(u)?a.replace(u,(p,h,g)=>{let f=parseInt(g);return isNaN(f)&&(f=0),f<o?h+String(f+1).padStart(g.length,"0"):`${h}${g}.1`}):i&&a.match(/(\d+)$/)?a.replace(/(\d+)$/,(p,...h)=>{let g=parseInt(h[0]);return g<o?String(g+1).padStart(h[0].length,"0"):`${h[0]}.1`}):i&&a.match(/^(\d+)/)?a.replace(/^(\d+)(.*)$/,(p,...h)=>{let g=parseInt(h[0]);return g<o?String(g+1).padStart(h[0].length,"0")+h[1]:`${h[0]}${h[1]}.1`}):`${a}.1`}async function Gln(a,i,e){if(!await a.exists(e))return!0;let{confirmed:o}=await i.confirm({type:ft.Warning,message:d(12024,null,Jo(e.path)),primaryButton:d(12079,null)});return o}var xGt=class a extends z{static{this.ID="workbench.files.action.compareFileWith"}static{this.LABEL=P(12059,"Compare Active File With...")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Fe.File,precondition:C.and(Tr,qo.negate()),metadata:{description:P(12008,"Opens a picker to select a file to diff with the active editor.")}})}async run(i){let e=i.get(ie),t=i.get(Bt),o=i.get($e),n=e.activeEditor,r=po.getOriginalUri(n);if(r&&t.canHandleResource(r)){let s=await o.quickAccess.pick("",{itemActivation:2});if(s?.length===1){let l=s[0].resource;A.isUri(l)&&t.canHandleResource(l)&&e.openEditor({original:{resource:r},modified:{resource:l},options:{pinned:!0}})}}}},Zrt=class a extends z{static{this.ID="workbench.action.toggleAutoSave"}constructor(){super({id:a.ID,title:P(12091,"Toggle Auto Save"),f1:!0,category:Fe.File,precondition:qo.negate(),metadata:{description:P(12092,"Toggle the ability to save files automatically after typing")}})}run(i){return i.get(fr).toggleAutoSave()}},Xrt=class extends it{constructor(e,t,o,n,r){super(e,t);this.commandService=o;this.notificationService=n;this.workingCopyService=r;this.lastDirtyState=this.workingCopyService.hasDirty,this.enabled=this.lastDirtyState,this.registerListeners()}registerListeners(){this._register(this.workingCopyService.onDidChangeDirty(e=>this.updateEnablement(e)))}updateEnablement(e){let t=e.isDirty()||this.workingCopyService.hasDirty;this.lastDirtyState!==t&&(this.enabled=t,this.lastDirtyState=this.enabled)}async run(e){try{await this.doRun(e)}catch(t){this.notificationService.error(Mn(t,!1))}}};Xrt=I([m(2,fe),m(3,Ne),m(4,$a)],Xrt);var yFe=class extends Xrt{static{this.ID="workbench.files.action.saveAllInGroup"}static{this.LABEL=d(12085,null)}get class(){return"explorer-action "+q.asClassName(L.saveAll)}doRun(i){return this.commandService.executeCommand(Mfe,{},i)}},woe=class extends it{constructor(e,t,o){super(e,t,q.asClassName(L.closeAll));this.commandService=o}static{this.ID="workbench.files.action.closeGroup"}static{this.LABEL=d(12007,null)}run(e){return this.commandService.executeCommand(mtt,{},e)}};woe=I([m(2,fe)],woe);var kGt=class a extends z{static{this.ID="workbench.files.action.focusFilesExplorer"}static{this.LABEL=P(12057,"Focus on Files Explorer")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Fe.File,precondition:qo.negate(),metadata:{description:P(12058,"Moves focus to the file explorer view container.")}})}async run(i){await i.get(Es).openPaneComposite(Dv,0,!0)}},EGt=class a extends z{static{this.ID="workbench.files.action.showActiveFileInExplorer"}static{this.LABEL=P(12088,"Reveal Active File in Explorer View")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Fe.File,precondition:qo.negate(),metadata:{description:P(12089,"Reveals and selects the active file within the explorer view.")}})}async run(i){let e=i.get(fe),t=i.get(ie),o=po.getOriginalUri(t.activeEditor,{supportSideBySide:1});o&&e.executeCommand(sV,o)}},TGt=class a extends z{static{this.ID="workbench.action.files.showOpenedFileInNewWindow"}static{this.LABEL=P(12068,"Open Active Editor in New Empty Workspace")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Fe.File,precondition:C.and(SZ,qo.negate()),metadata:{description:P(12069,"Opens the active editor in a new window with no folders open.")}})}async run(i){let e=i.get(ie),t=i.get(ti),o=i.get(ct),n=i.get(ge),r=po.getOriginalUri(e.activeEditor,{supportSideBySide:1});r&&n.hasProvider(r)?t.openWindow([{fileUri:r}],{forceNewWindow:!0}):o.error(d(12070,null))}};function oCo(a,i,e,t){if(e=$ln(e),!e||e.length===0||/^\s+$/.test(e))return{content:d(12051,null),severity:ft.Error};if(e[0]==="/"||e[0]==="\\")return{content:d(12055,null),severity:ft.Error};let o=ui(e.split(/[\\/]/)),n=i.parent;if(e!==i.name){let r=n?.getChild(e);if(r&&r!==i)return{content:d(12054,null,e),severity:ft.Error}}if(o.some(r=>!a.hasValidBasename(i.resource,t,r))){let r=e.replace(/\*/g,"\\*");return{content:d(12060,null,qln(r)),severity:ft.Error}}return o.some(r=>/^\s|\s$/.test(r))?{content:d(12056,null),severity:ft.Warning}:null}function qln(a){return a?.length>255?`${a.substr(0,255)}...`:a}function $ln(a){return a&&(a=CL(a,"	"),a=Bh(a,"/"),a=Bh(a,"\\"),a)}var _Gt=class a extends z{static{this.ID="workbench.files.action.compareNewUntitledTextFiles"}static{this.LABEL=P(12009,"Compare New Untitled Text Files")}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Fe.File,precondition:qo.negate(),metadata:{description:P(12010,"Opens a new diff editor with two untitled files.")}})}async run(i){await i.get(ie).openEditor({original:{resource:void 0},modified:{resource:void 0},options:{pinned:!0}})}},DGt=class a extends z{static{this.ID="workbench.files.action.compareWithClipboard"}static{this.LABEL=P(12011,"Compare Active File with Clipboard")}static{this.SCHEME_COUNTER=0}constructor(){super({id:a.ID,title:a.LABEL,f1:!0,category:Fe.File,precondition:qo.negate(),keybinding:{primary:Gi(2089,33),weight:200},metadata:{description:P(12012,"Opens a new diff editor to compare the active file with the contents of the clipboard.")}})}async run(i){let e=i.get(ie),t=i.get(F),o=i.get(Bt),n=i.get(ge),r=po.getOriginalUri(e.activeEditor,{supportSideBySide:1}),s=`clipboardCompare${a.SCHEME_COUNTER++}`;if(r&&(n.hasProvider(r)||r.scheme===Q.untitled)){if(!this.registrationDisposal){let u=t.createInstance(Jrt);this.registrationDisposal=o.registerTextModelContentProvider(s,u)}let l=Be(r),c=d(12006,null,l);await e.openEditor({original:{resource:r.with({scheme:s})},modified:{resource:r},label:c,options:{pinned:!0}}).finally(()=>{je(this.registrationDisposal),this.registrationDisposal=void 0})}}dispose(){je(this.registrationDisposal),this.registrationDisposal=void 0}},Jrt=class{constructor(i,e,t){this.clipboardService=i;this.languageService=e;this.modelService=t}async provideTextContent(i){let e=await this.clipboardService.readText();return this.modelService.createModel(e,this.languageService.createByFilepathOrFirstLine(i),i)}};Jrt=I([m(0,Bi),m(1,Rt),m(2,_t)],Jrt);function jln(a,i,e){a.prompt(ft.Error,Mn(i,!1),[{label:d(12083,null),run:()=>e()}])}async function nCo(a,i){let e=a.get(Qa),t=a.get(ge),o=a.get(B),n=a.get(fr),r=a.get(ie),s=a.get(Gt),l=a.get(Ne),c=a.get(bo),u=a.get(fe),p=a.get(Pn),h=!s.isViewVisible(pS),g=await s.openView(pS,!0);if(h&&await Li(500),!g){if(i)throw new Error("Open a folder or workspace first.");return u.executeCommand(aV)}let f=e.getContext(!1),v=f.length>0?f[0]:void 0,b;if(v?b=v.isDirectory?v:v.parent||e.roots[0]:b=e.roots[0],b.isReadonly)throw new Error("Parent folder is readonly.");let S=new t6(t,o,n,b,i);b.addChild(S);let y=async x=>{try{let E=Ve(b.resource,x);x.endsWith("/")&&(i=!0),await e.applyBulkEdit([new Yu(void 0,E,{folder:i})],{undoLabel:d(12033,null,x),progressLabel:d(12034,null,x),confirmBeforeUndo:!0}),await tCo(x,e),i?await e.select(E,!0):await r.openEditor({resource:E,options:{pinned:!0}})}catch(E){jln(l,E,()=>y(x))}},w=(await c.getEnvironment())?.os??Ao;await e.setEditable(S,{validationMessage:x=>oCo(p,S,x,w),onFinish:async(x,E)=>{b.removeChild(S),await e.setEditable(S,null),E&&y(x)}})}Ge.registerCommand({id:Nfe,handler:async a=>{await nCo(a,!1)}});Ge.registerCommand({id:CFe,handler:async a=>{await nCo(a,!0)}});var rCo=async a=>{let i=a.get(Qa),e=a.get(Ne),t=a.get(bo),o=a.get(Pn),n=a.get(B),r=i.getContext(!1),s=r.length>0?r[0]:void 0;if(!s)return;let l=(await t.getEnvironment())?.os??Ao;await i.setEditable(s,{validationMessage:c=>oCo(o,s,c,l),onFinish:async(c,u)=>{if(u){let p=s.parent.resource,h=Ve(p,c);if(s.resource.toString()!==h.toString())try{await i.applyBulkEdit([new Yu(s.resource,h)],{confirmBeforeUndo:n.getValue().explorer.confirmUndo==="verbose",undoLabel:d(12077,null,s.name,c),progressLabel:d(12078,null,s.name,c)}),await tCo(c,i)}catch(g){e.error(g)}}await i.setEditable(s,null)}})},sCo=async a=>{let e=a.get(Qa).getContext(!0).filter(t=>!t.isRoot);e.length&&await bPi(a.get(Qa),a.get(gm),a.get(ct),a.get(B),a.get(fr),e,!0)},SPi=async a=>{let e=a.get(Qa).getContext(!0).filter(t=>!t.isRoot);e.length&&await bPi(a.get(Qa),a.get(gm),a.get(ct),a.get(B),a.get(fr),e,!1)},Afe=!1,aCo=async a=>{let i=a.get(Qa),e=i.getContext(!0);e.length>0&&(await i.setToCopy(e,!1),Afe=!1)},lCo=async a=>{let i=a.get(Qa),e=i.getContext(!0);e.length>0&&(await i.setToCopy(e,!0),Afe=!0)},Qln=async a=>{let i=a.get(Qa),e=a.get(Ne),t=a.get(F),o=i.getContext(!0),n=o.length?o:i.roots,r=t.createInstance(i6);try{await r.download(n)}catch(s){throw e.error(s),s}};Ge.registerCommand({id:fPi,handler:Qln});var Yln=async a=>{let i=a.get(Qa),e=a.get(Ne),t=a.get(F),o=i.getContext(!1),n=o.length?o[0]:i.roots[0];try{let r=await yQi();r&&await t.createInstance(e1).upload(n,r)}catch(r){throw e.error(r),r}};Ge.registerCommand({id:vPi,handler:Yln});var cCo=async(a,i)=>{let e=a.get(Bi),t=a.get(Qa),o=a.get(ge),n=a.get(Ne),r=a.get(ie),s=a.get(B),l=a.get(gt),c=a.get(ct),u=a.get(ti),p=t.getContext(!1),g=i&&i.length>0&&s.getValue("explorer.confirmPasteNative"),f=await Xln(i,e,u);if(g&&f.files.length>=1){let w=f.files.length>1?d(12023,null,f.files.length):d(12025,null,Jo(f.type==="paths"?f.files[0].fsPath:f.files[0].name)),x=f.files.length>1?fx(f.files.map(M=>{if(A.isUri(M))return M.fsPath;if(f.type==="paths"){let N=wD(M);if(N)return N}return M.name})):void 0,E=await c.confirm({message:w,detail:x,checkbox:{label:d(12049,null)},primaryButton:d(12071,null)});if(!E.confirmed)return;E.checkboxChecked===!0&&await s.updateValue("explorer.confirmPasteNative",!1)}let v=p.length?p[0]:t.roots[0],b=s.getValue().explorer.incrementalNaming;if(t.getEditable())return;try{let w=[];if(f.type==="paths"){let x=ui(await Promise.all(f.files.map(async E=>{if(v.resource.toString()!==E.toString()&&Yr(v.resource,E))throw new Error(d(12053,null));let M=await o.stat(E),N;l.extUri.isEqual(v.resource,E)?N=v.parent:N=v.isDirectory?v:v.parent;let V=await CGt(t,o,c,N,{resource:E,isDirectory:M.isDirectory,allowOverwrite:Afe||b==="disabled"},b);if(V)return{source:E,target:V}})));if(x.length>=1)if(Afe){let E=x.map(N=>new Yu(N.source,N.target,{overwrite:b==="disabled"})),M={confirmBeforeUndo:s.getValue().explorer.confirmUndo==="verbose",progressLabel:x.length>1?d(12064,null,x.length):d(12065,null,sl(x[0].target)),undoLabel:x.length>1?d(12062,null,x.length):d(12063,null,sl(x[0].target))};await t.applyBulkEdit(E,M)}else{let E=x.map(M=>new Yu(M.source,M.target,{copy:!0,overwrite:b==="disabled"}));await y(x.map(M=>M.target),E)}w=x.map(E=>E.target)}else{let x=ui(await Promise.all(f.files.map(async E=>{let M=v.isDirectory?v:v.parent,N=await CGt(t,o,c,M,{resource:E.name,isDirectory:!1,allowOverwrite:Afe||b==="disabled"},b);if(N)return{target:N,edit:new Yu(void 0,N,{overwrite:b==="disabled",contents:(async()=>Ke.wrap(new Uint8Array(await E.arrayBuffer())))()})}})));await y(x.map(E=>E.target),x.map(E=>E.edit)),w=x.map(E=>E.target)}if(w.length){let x=w[0];if(await t.select(x),w.length===1){let E=t.findClosest(x);E&&!E.isDirectory&&await r.openEditor({resource:E.resource,options:{pinned:!0,preserveFocus:!0}})}}}catch(w){n.error(Mn(new Error(d(12052,null,Dn(w))),!1))}finally{Afe&&(await t.setToCopy([],!1),Afe=!1)}async function y(w,x){let E=s.getValue().explorer.confirmUndo,M={confirmBeforeUndo:E==="default"||E==="verbose",progressLabel:w.length>1?d(12031,null,w.length):d(12032,null,sl(w[0])),undoLabel:w.length>1?d(12028,null,w.length):d(12030,null,sl(w[0]))};await t.applyBulkEdit(x,M)}};async function Xln(a,i,e){if(a&&a.length>0){let t=[...a].map(o=>wD(o)).filter(o=>!!o&&Jl(o)).map(o=>A.file(o));return t.length?{type:"paths",files:t}:{type:"data",files:[...a].filter(o=>!wD(o))}}else return{type:"paths",files:p4e(await i.readResources(),t=>t)}}var dCo=async a=>{let i=a.get(ie),t=a.get(Qa).getContext(!0);await i.openEditors(t.filter(o=>!o.isDirectory).map(o=>({resource:o.resource,options:{preserveFocus:!0}})))},wFe=class extends z{constructor(e,t,o){super({id:e,title:t,f1:!0,category:Fe.File,precondition:C.and(GMt,qo.negate())});this.newReadonlyState=o}async run(e){let t=e.get(ie),o=e.get(fr),n=po.getOriginalUri(t.activeEditor,{supportSideBySide:1});n&&await o.updateReadonly(n,this.newReadonlyState)}},RGt=class a extends wFe{static{this.ID="workbench.action.files.setActiveEditorReadonlyInSession"}static{this.LABEL=P(12086,"Set Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,!0)}},LGt=class a extends wFe{static{this.ID="workbench.action.files.setActiveEditorWriteableInSession"}static{this.LABEL=P(12087,"Set Active Editor Writeable in Session")}constructor(){super(a.ID,a.LABEL,!1)}},MGt=class a extends wFe{static{this.ID="workbench.action.files.toggleActiveEditorReadonlyInSession"}static{this.LABEL=P(12090,"Toggle Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,"toggle")}},PGt=class a extends wFe{static{this.ID="workbench.action.files.resetActiveEditorReadonlyInSession"}static{this.LABEL=P(12080,"Reset Active Editor Read-only in Session")}constructor(){super(a.ID,a.LABEL,"reset")}};var dy=class extends IE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,v,u,h,g,f,S,y);this.instantiationService=c;this.textModelService=p;this.pathService=b;this.forceOpenAs=0;this.model=void 0;this.cachedTextFileModelReference=void 0;this.modelListeners=this._register(new O);this.model=this.textFileService.files.get(e),o&&this.setPreferredName(o),n&&this.setPreferredDescription(n),r&&this.setPreferredEncoding(r),s&&this.setPreferredLanguageId(s),typeof l=="string"&&this.setPreferredContents(l),this._register(this.textFileService.files.onDidCreate(w=>this.onDidCreateTextFileModel(w))),this.model&&this.registerModelListeners(this.model)}get typeId(){return khe}get editorId(){return Da.id}get capabilities(){let e=32;return this.model?this.model.isReadonly()&&(e|=2):this.fileService.hasProvider(this.resource)?this.filesConfigurationService.isReadonly(this.resource)&&(e|=2):e|=4,e&2||(e|=128),e}onDidCreateTextFileModel(e){ze(e.resource,this.resource)&&(this.model=e,this.registerModelListeners(e))}registerModelListeners(e){this.modelListeners.clear(),this.modelListeners.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire())),this.modelListeners.add(e.onDidChangeReadonly(()=>this._onDidChangeCapabilities.fire())),this.modelListeners.add(e.onDidSaveError(()=>this._onDidChangeDirty.fire())),this.modelListeners.add(U.once(e.onWillDispose)(()=>{this.modelListeners.clear(),this.model=void 0}))}getName(){return this.preferredName||super.getName()}setPreferredName(e){this.allowLabelOverride()&&this.preferredName!==e&&(this.preferredName=e,this._onDidChangeLabel.fire())}allowLabelOverride(){return this.resource.scheme!==this.pathService.defaultUriScheme&&this.resource.scheme!==Q.vscodeUserData&&this.resource.scheme!==Q.file&&this.resource.scheme!==Q.vscodeRemote}getPreferredName(){return this.preferredName}isReadonly(){return this.model?this.model.isReadonly():this.filesConfigurationService.isReadonly(this.resource)}getDescription(e){return this.preferredDescription||super.getDescription(e)}setPreferredDescription(e){this.allowLabelOverride()&&this.preferredDescription!==e&&(this.preferredDescription=e,this._onDidChangeLabel.fire())}getPreferredDescription(){return this.preferredDescription}getTitle(e){let t=super.getTitle(e),o=this.getPreferredTitle();return o&&(t=`${o} (${t})`),t}getPreferredTitle(){if(this.preferredName&&this.preferredDescription)return`${this.preferredName} ${this.preferredDescription}`;if(this.preferredName||this.preferredDescription)return this.preferredName??this.preferredDescription}getEncoding(){return this.model?this.model.getEncoding():this.preferredEncoding}getPreferredEncoding(){return this.preferredEncoding}async setEncoding(e,t){return this.setPreferredEncoding(e),this.model?.setEncoding(e,t)}setPreferredEncoding(e){this.preferredEncoding=e,this.setForceOpenAsText()}getLanguageId(){return this.model?this.model.getLanguageId():this.preferredLanguageId}getPreferredLanguageId(){return this.preferredLanguageId}setLanguageId(e,t){this.setPreferredLanguageId(e),this.model?.setLanguageId(e,t)}setPreferredLanguageId(e){this.preferredLanguageId=e,this.setForceOpenAsText()}setPreferredContents(e){this.preferredContents=e,this.setForceOpenAsText()}setForceOpenAsText(){this.forceOpenAs=1}setForceOpenAsBinary(){this.forceOpenAs=2}isDirty(){return!!this.model?.isDirty()}isSaving(){return this.model?.hasState(0)||this.model?.hasState(3)||this.model?.hasState(5)?!1:this.filesConfigurationService.hasShortAutoSaveDelay(this)?!0:super.isSaving()}prefersEditorPane(e){return this.forceOpenAs===2?e.find(t=>t.typeId===nBt):e.find(t=>t.typeId===EW)}resolve(e){return this.forceOpenAs===2?this.doResolveAsBinary():this.doResolveAsText(e)}async doResolveAsText(e){try{let t=this.preferredContents;this.preferredContents=void 0,await this.textFileService.files.resolve(this.resource,{languageId:this.preferredLanguageId,encoding:this.preferredEncoding,contents:typeof t=="string"?t4(t):void 0,reload:{async:!0},allowBinary:this.forceOpenAs===1,reason:1,limits:this.ensureLimits(e)}),this.cachedTextFileModelReference||(this.cachedTextFileModelReference=await this.textModelService.createModelReference(this.resource));let o=this.cachedTextFileModelReference.object;return this.isDisposed()&&this.disposeModelReference(),o}catch(t){if(t.textFileOperationResult===0)return this.doResolveAsBinary();throw t}}async doResolveAsBinary(){let e=this.instantiationService.createInstance($G,this.preferredResource,this.getName());return await e.resolve(),e}isResolved(){return!!this.model}async rename(e,t){return{editor:{resource:t,encoding:this.getEncoding(),options:{viewState:h3(this,e,this.editorService)}}}}toUntyped(e){let t={resource:this.preferredResource,forceFile:!0,options:{override:this.editorId}};return typeof e?.preserveViewState=="number"&&(t.encoding=this.getEncoding(),t.languageId=this.getLanguageId(),t.contents=(()=>{let o=this.textFileService.files.get(this.resource);if(o?.isDirty()&&!o.textEditorModel.isTooLargeForHeapOperation())return o.textEditorModel.getValue()})(),t.options={...t.options,viewState:h3(this,e.preserveViewState,this.editorService)}),t}matches(e){return this===e?!0:e instanceof dy?ze(e.resource,this.resource):zg(e)?super.matches(e):!1}dispose(){this.model=void 0,this.disposeModelReference(),super.dispose()}disposeModelReference(){je(this.cachedTextFileModelReference),this.cachedTextFileModelReference=void 0}};dy=I([m(7,F),m(8,Uo),m(9,Bt),m(10,nt),m(11,ge),m(12,fr),m(13,ie),m(14,Pn),m(15,Gn),m(16,nb)],dy);var TPi="saveConflictResolutionContext",IPi="conflictResolution",_Pi="learnMoreDirtyWriteError",uCo=d(11991,null),Ofe=class extends k{constructor(e,t,o,n,r,s,l){super();this.notificationService=e;this.textFileService=t;this.editorService=n;this.instantiationService=s;this.storageService=l;this.messages=new dt;this.activeConflictResolutionResource=void 0;this.conflictResolutionContext=new Y(TPi,!1,!0).bindTo(o);let c=this._register(s.createInstance(oP));this._register(r.registerTextModelContentProvider(IPi,c)),this.textFileService.files.saveErrorHandler=this,this.registerListeners()}static{this.ID="workbench.contrib.textFileSaveErrorHandler"}registerListeners(){this._register(this.textFileService.files.onDidSave(e=>this.onFileSavedOrReverted(e.model.resource))),this._register(this.textFileService.files.onDidRevert(e=>this.onFileSavedOrReverted(e.resource))),this._register(this.editorService.onDidActiveEditorChange(()=>this.onActiveEditorChanged()))}onActiveEditorChanged(){let e=!1,t,o=this.editorService.activeEditor;o instanceof Ba&&o.original.resource?.scheme===IPi&&(e=!0,t=o.modified.resource),this.conflictResolutionContext.set(e),this.activeConflictResolutionResource=t}onFileSavedOrReverted(e){let t=this.messages.get(e);t&&(t.close(),this.messages.delete(e))}onSaveError(e,t,o){let n=e,r=t.resource,s,l=[],c=[];if(n.fileOperationResult===3)if(this.activeConflictResolutionResource&&ze(this.activeConflictResolutionResource,t.resource)){if(this.storageService.getBoolean(_Pi,-1))return;s=uCo,l.push(this.instantiationService.createInstance(xFe)),c.push(this.instantiationService.createInstance(est))}else s=d(11990,null,Be(r)),l.push(this.instantiationService.createInstance(tst,t)),l.push(this.instantiationService.createInstance(EPi,t,o)),c.push(this.instantiationService.createInstance(ost));else{let h=n.fileOperationResult===5,g=h&&n.options?.unlock,f=n.fileOperationResult===6,v=r.scheme===Q.file;v&&(f||g)?l.push(this.instantiationService.createInstance(wPi,t,o,!!g)):h?l.push(this.instantiationService.createInstance(kPi,t,o)):l.push(this.instantiationService.createInstance(CPi,t,o)),l.push(this.instantiationService.createInstance(ist,t)),l.push(this.instantiationService.createInstance(xPi,t)),h?g&&v?s=ii?d(11983,null,Be(r)):d(11984,null,Be(r)):s=d(11982,null,Be(r)):v&&f?s=ii?d(11980,null,Be(r)):d(11981,null,Be(r)):s=d(11975,null,Be(r),Mn(e,!1))}let u={primary:l,secondary:c},p=this.notificationService.notify({id:`${Lr(t.resource.toString())}`,severity:ft.Error,message:s,actions:u});U.once(p.onDidClose)(()=>{je(l),je(c)}),this.messages.set(t.resource,p)}dispose(){super.dispose(),this.messages.clear()}};Ofe=I([m(0,Ne),m(1,Uo),m(2,X),m(3,ie),m(4,Bt),m(5,F),m(6,de)],Ofe);var yPi=[];function Jln(){for(;yPi.length>0;)yPi.pop()?.close()}var xFe=class extends it{constructor(e){super("workbench.files.action.resolveConflictLearnMore",d(11976,null));this.openerService=e}async run(){await this.openerService.open(A.parse("https://go.microsoft.com/fwlink/?linkid=868264"))}};xFe=I([m(0,Je)],xFe);var est=class extends it{constructor(e){super("workbench.files.action.resolveConflictLearnMoreDoNotShowAgain",d(11974,null));this.storageService=e}async run(e){this.storageService.store(_Pi,!0,-1,0),e.dispose()}};est=I([m(0,de)],est);var tst=class extends it{constructor(e,t,o,n,r){super("workbench.files.action.resolveConflict",d(11972,null));this.model=e;this.editorService=t;this.notificationService=o;this.instantiationService=n;this.productService=r}async run(){if(!this.model.isDisposed()){let e=this.model.resource,t=Be(e),o=d(11987,null,t,t,this.productService.nameLong);await oP.open(e,IPi,o,this.editorService,{pinned:!0});let n={primary:[this.instantiationService.createInstance(xFe)]},r=this.notificationService.notify({id:`${Lr(e.toString())}`,severity:ft.Info,message:uCo,actions:n,neverShowAgain:{id:_Pi,isSecondary:!0}});U.once(r.onDidClose)(()=>je(n.primary)),yPi.push(r)}}};tst=I([m(1,ie),m(2,Ne),m(3,F),m(4,Ze)],tst);var wPi=class extends it{constructor(e,t,o){super("workbench.files.action.saveModelElevated",o?ii?d(11978,null):d(11979,null):ii?d(11988,null):d(11989,null));this.model=e;this.options=t;this.triedToUnlock=o}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeElevated:!0,writeUnlock:this.triedToUnlock,reason:1})}},CPi=class extends it{constructor(e,t){super("workbench.files.action.saveModel",d(11985,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,reason:1})}},xPi=class extends it{constructor(e){super("workbench.files.action.revertModel",d(11986,null));this.model=e}async run(){this.model.isDisposed()||await this.model.revert()}},ist=class extends it{constructor(e,t){super("workbench.files.action.saveModelAs",mGt.value);this.model=e;this.editorService=t}async run(){if(!this.model.isDisposed()){let e=this.findEditor();e&&await this.editorService.save(e,{saveAs:!0,reason:1})}}findEditor(){let e,t=this.editorService.findEditors(this.model.resource,{supportSideBySide:1});for(let o of t)if(o.editor instanceof dy){e=o;break}else e||(e=o);return e}};ist=I([m(1,ie)],ist);var kPi=class extends it{constructor(e,t){super("workbench.files.action.unlock",d(11977,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,writeUnlock:!0,reason:1})}},EPi=class extends it{constructor(e,t){super("workbench.files.action.saveIgnoreModifiedSince",d(11977,null));this.model=e;this.options=t}async run(){this.model.isDisposed()||await this.model.save({...this.options,ignoreModifiedSince:!0,reason:1})}},ost=class extends it{constructor(e){super("workbench.files.action.configureSaveConflict",d(11973,null));this.preferencesService=e}async run(){this.preferencesService.openSettings({query:"files.saveConflictResolution"})}};ost=I([m(0,Qo)],ost);var pCo=(a,i)=>hCo(a,i,!0),mCo=(a,i)=>hCo(a,i,!1);async function hCo(a,i,e){let t=a.get(ie);if(!A.isUri(i))return;let o=t.activeEditorPane;if(!o)return;let n=o.input,r=o.group;if(Jln(),e){let s={ignoreModifiedSince:!0,reason:1};await t.save({editor:n,groupId:r.id},s)}else await t.revert({editor:n,groupId:r.id});return await t.openEditor({resource:i},r),r.closeEditor(n)}var OGt=_,HC=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,l,n,s,c,o,t,v,u,h);this.editorGroupService=r;this.telemetryService=p;this.workingCopyService=g;this.filesConfigurationService=f;this.fileService=b;this.needsRefresh=!1;this.elements=[];this.blockFocusActiveEditorTracking=!1;this.structuralRefreshDelay=0,this.sortOrder=s.getValue("explorer.openEditors.sortOrder"),this.registerUpdateEvents(),this._register(this.configurationService.onDidChangeConfiguration(S=>this.onConfigurationChange(S))),this._register(this.workingCopyService.onDidChangeDirty(S=>this.updateDirtyIndicator(S)))}static{this.DEFAULT_VISIBLE_OPEN_EDITORS=9}static{this.DEFAULT_MIN_VISIBLE_OPEN_EDITORS=0}static{this.ID="workbench.explorer.openEditorsView"}static{this.NAME=P(12325,"Open Editors")}registerUpdateEvents(){let e=()=>{if(!this.isBodyVisible()||!this.list){this.needsRefresh=!0;return}this.listRefreshScheduler?.schedule(this.structuralRefreshDelay)},t=this._register(new Ot),o=n=>{let r=n.onDidModelChange(s=>{if(this.listRefreshScheduler?.isScheduled())return;if(!this.isBodyVisible()||!this.list){this.needsRefresh=!0;return}let l=this.getIndex(n,s.editor);switch(s.kind){case 8:this.focusActiveEditor();break;case 1:case 2:l>=0&&this.list.splice(l,1,[n]);break;case 14:case 13:case 10:case 11:case 9:this.list.splice(l,1,[new dg(s.editor,n)]),this.focusActiveEditor();break;case 5:case 7:case 6:e();break}});t.set(n.id,r)};this.editorGroupService.groups.forEach(n=>o(n)),this._register(this.editorGroupService.onDidAddGroup(n=>{o(n),e()})),this._register(this.editorGroupService.onDidMoveGroup(()=>e())),this._register(this.editorGroupService.onDidChangeActiveGroup(()=>this.focusActiveEditor())),this._register(this.editorGroupService.onDidRemoveGroup(n=>{t.deleteAndDispose(n.id),e()}))}renderHeaderTitle(e){super.renderHeaderTitle(e,this.title);let t=D(e,OGt(".open-editors-dirty-count-container"));this.dirtyCountElement=D(t,OGt(".dirty-count.monaco-count-badge.long")),this.dirtyCountElement.style.backgroundColor=Tt(Gv),this.dirtyCountElement.style.color=Tt(gx),this.dirtyCountElement.style.border=`1px solid ${Tt(Ei)}`,this.updateDirtyIndicator()}renderBody(e){super.renderBody(e),e.classList.add("open-editors"),e.classList.add("show-file-icons");let t=new nst;this.list&&this.list.dispose(),this.listLabels&&this.listLabels.clear(),this.dnd=new NGt(this.sortOrder,this.instantiationService,this.editorGroupService),this.listLabels=this.instantiationService.createInstance(jl,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this.list=this.instantiationService.createInstance(bc,"OpenEditors",e,t,[new FGt(this.keybindingService,this.instantiationService),new WGt(this.listLabels,this.instantiationService,this.keybindingService,this.configurationService)],{identityProvider:{getId:r=>r instanceof dg?r.getId():r.id.toString()},dnd:this.dnd,overrideStyles:this.getLocationBasedColors().listOverrideStyles,accessibilityProvider:new RPi}),this._register(this.list),this._register(this.listLabels);let o=[];this.listRefreshScheduler=this._register(new Dt(()=>{if(!this.list)return;o=je(o);let r=this.list.length,s=this.getElements();this.list.splice(0,this.list.length,s),this.focusActiveEditor(),r!==this.list.length&&this.updateSize(),this.needsRefresh=!1,(this.sortOrder==="alphabetical"||this.sortOrder==="fullPath")&&s.forEach(l=>{l instanceof dg&&o.push(l.editor.onDidChangeLabel(()=>this.listRefreshScheduler?.schedule()))})},this.structuralRefreshDelay)),this.updateSize(),this.handleContextKeys(),this._register(this.list.onContextMenu(r=>this.onListContextMenu(r))),this._register(this.list.onMouseMiddleClick(r=>{if(r&&r.element instanceof dg){if(N_e(r.element.group,r.element.editor,2,this.editorGroupService.partOptions))return;r.element.group.closeEditor(r.element.editor,{preserveFocus:!0})}})),this._register(this.list.onDidOpen(r=>{let s=r.element;if(s)if(s instanceof dg){if(Wp(r.browserEvent)&&r.browserEvent.button===1)return;this.withActiveEditorFocusTrackingDisabled(()=>{this.openEditor(s,{preserveFocus:r.editorOptions.preserveFocus,pinned:r.editorOptions.pinned,sideBySide:r.sideBySide})})}else this.withActiveEditorFocusTrackingDisabled(()=>{this.editorGroupService.activateGroup(s),r.editorOptions.preserveFocus||s.focus()});else return})),this.listRefreshScheduler.schedule(0),this._register(this.onDidChangeBodyVisibility(r=>{r&&this.needsRefresh&&this.listRefreshScheduler?.schedule(0)}));let n=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id));this._register(n.onDidChangeAllViewDescriptors(()=>{this.updateSize()}))}handleContextKeys(){if(!this.list)return;tfo.bindTo(this.list.contextKeyService),Itt.bindTo(this.list.contextKeyService);let e=e6.bindTo(this.contextKeyService),t=SFe.bindTo(this.contextKeyService),o=Qrt.bindTo(this.contextKeyService),n=fGt.bindTo(this.contextKeyService),r=this.instantiationService.createInstance(Ho);this._register(r),this._register(this.list.onDidChangeFocus(s=>{r.reset(),e.reset(),t.reset(),o.reset();let l=s.elements.length?s.elements[0]:void 0;if(l instanceof dg){let c=l.getResource();t.set(l.editor.isDirty()&&!l.editor.isSaving()),o.set(!!l.editor.isReadonly()),r.set(c??null)}else l&&e.set(!0)})),this._register(this.list.onDidChangeSelection(s=>{let l=s.elements.every(c=>{if(c instanceof dg){let u=c.getResource();return u&&(u.scheme===Q.untitled||this.fileService.hasProvider(u))}return!1});n.set(l)}))}focus(){super.focus(),this.list?.domFocus()}layoutBody(e,t){super.layoutBody(e,t),this.list?.layout(e,t)}get showGroups(){return this.editorGroupService.groups.length>1}getElements(){return this.elements=[],this.editorGroupService.getGroups(2).forEach(e=>{this.showGroups&&this.elements.push(e);let t=e.editors.map(o=>new dg(o,e));this.sortOrder==="alphabetical"?t=t.sort((o,n)=>utt(o.editor.getName(),n.editor.getName())):this.sortOrder==="fullPath"&&(t=t.sort((o,n)=>{let r=o.editor.resource,s=n.editor.resource;if(r===void 0&&s===void 0)return utt(o.editor.getName(),n.editor.getName());if(r===void 0)return-1;if(s===void 0)return 1;{let l=r.scheme,c=s.scheme;return l!==Q.file&&c!==Q.file?Tk.compare(r,s):l!==Q.file?-1:c!==Q.file?1:Tk.compare(r,s)}})),this.elements.push(...t)}),this.elements}getIndex(e,t){return t?this.elements.findIndex(o=>o instanceof dg&&o.editor===t&&o.group.id===e.id):this.elements.findIndex(o=>!(o instanceof dg)&&o.id===e.id)}openEditor(e,t){e&&(this.telemetryService.publicLog2("workbenchActionExecuted",{id:"workbench.files.openFile",from:"openEditors"}),t.sideBySide&&t.preserveFocus||this.editorGroupService.activateGroup(e.group),(t.sideBySide?this.editorGroupService.sideGroup:e.group).openEditor(e.editor,t))}onListContextMenu(e){if(!e.element)return;let t=e.element;this.contextMenuService.showContextMenu({menuId:R.OpenEditorsContext,menuActionOptions:{shouldForwardArgs:!0,arg:t instanceof dg?po.getOriginalUri(t.editor):{}},contextKeyService:this.list?.contextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>t instanceof dg?{groupId:t.groupId,editorIndex:t.group.getIndexOfEditor(t.editor)}:{groupId:t.id}})}withActiveEditorFocusTrackingDisabled(e){this.blockFocusActiveEditorTracking=!0;try{e()}finally{this.blockFocusActiveEditorTracking=!1}}focusActiveEditor(){if(!(!this.list||this.blockFocusActiveEditorTracking)){if(this.list.length&&this.editorGroupService.activeGroup){let e=this.getIndex(this.editorGroupService.activeGroup,this.editorGroupService.activeGroup.activeEditor);if(e>=0){try{this.list.setFocus([e]),this.list.setSelection([e]),this.list.reveal(e)}catch{}return}}this.list.setFocus([]),this.list.setSelection([])}}onConfigurationChange(e){e.affectsConfiguration("explorer.openEditors")&&this.updateSize(),(e.affectsConfiguration("explorer.decorations")||e.affectsConfiguration("explorer.openEditors.sortOrder"))&&(this.sortOrder=this.configurationService.getValue("explorer.openEditors.sortOrder"),this.dnd&&(this.dnd.sortOrder=this.sortOrder),this.listRefreshScheduler?.schedule())}updateSize(){this.minimumBodySize=this.orientation===0?this.getMinExpandedBodySize():170,this.maximumBodySize=this.orientation===0?this.getMaxExpandedBodySize():Number.POSITIVE_INFINITY}updateDirtyIndicator(e){if(e&&e.isDirty()&&!(e.capabilities&2)&&this.filesConfigurationService.hasShortAutoSaveDelay(e.resource))return;let t=this.workingCopyService.dirtyCount;t===0?this.dirtyCountElement.classList.add("hidden"):(this.dirtyCountElement.textContent=d(12320,null,t),this.dirtyCountElement.classList.remove("hidden"))}get elementCount(){return this.editorGroupService.groups.map(e=>e.count).reduce((e,t)=>e+t,this.showGroups?this.editorGroupService.groups.length:0)}getMaxExpandedBodySize(){let e=this.configurationService.getValue("explorer.openEditors.minVisible");return typeof e!="number"&&(e=HC.DEFAULT_MIN_VISIBLE_OPEN_EDITORS),this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id)).visibleViewDescriptors.length<=1?Number.POSITIVE_INFINITY:Math.max(this.elementCount,e)*nst.ITEM_HEIGHT}getMinExpandedBodySize(){let e=this.configurationService.getValue("explorer.openEditors.visible");return typeof e!="number"&&(e=HC.DEFAULT_VISIBLE_OPEN_EDITORS),this.computeMinExpandedBodySize(e)}computeMinExpandedBodySize(e=HC.DEFAULT_VISIBLE_OPEN_EDITORS){return Math.min(Math.max(e,1),this.elementCount)*nst.ITEM_HEIGHT}setStructuralRefreshDelay(e){this.structuralRefreshDelay=e}getOptimalWidth(){if(!this.list)return super.getOptimalWidth();let e=this.list.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".open-editor > a"));return Pwe(e,t)}};HC=I([m(1,F),m(2,ji),m(3,Xe),m(4,kt),m(5,B),m(6,Le),m(7,X),m(8,Pe),m(9,_e),m(10,ot),m(11,$a),m(12,fr),m(13,Je),m(14,ge)],HC);var DPi=class extends cs{async run(i){if(this.editor)return super.run(i,{groupId:this.editor.groupId,editorIndex:this.editor.group.getIndexOfEditor(this.editor.editor)})}},nst=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return i instanceof dg?WGt.ID:FGt.ID}},FGt=class a{constructor(i,e){this.keybindingService=i;this.instantiationService=e}static{this.ID="editorgroup"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);e.root=D(i,OGt(".editor-group")),e.name=D(e.root,OGt("span.name")),e.actionBar=new oo(i);let t=this.instantiationService.createInstance(yFe,yFe.ID,yFe.LABEL),o=this.keybindingService.lookupKeybinding(t.id);e.actionBar.push(t,{icon:!0,label:!1,keybinding:o?o.getLabel():void 0});let n=this.instantiationService.createInstance(woe,woe.ID,woe.LABEL),r=this.keybindingService.lookupKeybinding(n.id);return e.actionBar.push(n,{icon:!0,label:!1,keybinding:r?r.getLabel():void 0}),e}renderElement(i,e,t){t.editorGroup=i,t.name.textContent=i.label,t.actionBar.context={groupId:i.id}}disposeTemplate(i){i.actionBar.dispose()}},WGt=class a{constructor(i,e,t,o){this.labels=i;this.instantiationService=e;this.keybindingService=t;this.configurationService=o;this.closeEditorAction=this.instantiationService.createInstance(Ate,Ate.ID,Ate.LABEL),this.unpinEditorAction=this.instantiationService.createInstance(_W,_W.ID,_W.LABEL)}static{this.ID="openeditor"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);return e.container=i,e.actionRunner=new DPi,e.actionBar=new oo(i,{actionRunner:e.actionRunner}),e.root=this.labels.create(i),e}renderElement(i,e,t){let o=i.editor;t.actionRunner.editor=i,t.container.classList.toggle("dirty",o.isDirty()&&!o.isSaving()),t.container.classList.toggle("sticky",i.isSticky()),t.root.setResource({resource:po.getOriginalUri(o,{supportSideBySide:3}),name:o.getName(),description:o.getDescription(1)},{italic:i.isPreview(),extraClasses:["open-editor"].concat(i.editor.getLabelExtraClasses()),fileDecorations:this.configurationService.getValue().explorer.decorations,title:o.getTitle(2),icon:o.getIcon()});let n=i.isSticky()?this.unpinEditorAction:this.closeEditorAction;t.actionBar.hasAction(n)||(t.actionBar.isEmpty()||t.actionBar.clear(),t.actionBar.push(n,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(n.id)?.getLabel()}))}disposeTemplate(i){i.actionBar.dispose(),i.root.dispose(),i.actionRunner.dispose()}},NGt=class{constructor(i,e,t){this.instantiationService=e;this.editorGroupService=t;this._sortOrder=i}set sortOrder(i){this._sortOrder=i}get dropHandler(){return this.instantiationService.createInstance(uW,{allowWorkspaceOpen:!1})}getDragURI(i){if(i instanceof dg){let e=i.getResource();if(e)return e.toString()}return null}getDragLabel(i){if(i.length>1)return String(i.length);let e=i[0];return e instanceof dg?e.editor.getName():e.label}onDragStart(i,e){let t=i.elements,o=[];if(t)for(let n of t)n instanceof dg&&o.push(n);o.length&&this.instantiationService.invokeFunction(kv,o,e)}onDragOver(i,e,t,o,n){if(i instanceof PK&&!Up(n,Fl.FILES,Mc.FILES))return!1;if(this._sortOrder!=="editorOrder")return i instanceof Yw?!1:{accept:!0,effect:{type:1},feedback:[-1]};let r;switch(o){case 0:case 1:r=t===0&&e instanceof oy?"drop-target-after":"drop-target-before";break;case 2:case 3:r="drop-target-after";break}return{accept:!0,effect:{type:1,position:r},feedback:[t]}}drop(i,e,t,o,n){let r=e instanceof dg?e.group:e||this.editorGroupService.groups[this.editorGroupService.count-1],s=e instanceof dg?e.group.getIndexOfEditor(e.editor):0;switch(o){case 0:case 1:e instanceof oy&&r.index!==0&&(r=this.editorGroupService.groups[r.index-1],s=r.count);break;case 3:case 2:e instanceof dg&&s++;break}if(i instanceof Yw){for(let l of i.elements){let c=l.group.getIndexOfEditor(l.editor);l.group===r&&c<s&&s--,l.group.moveEditor(l.editor,r,{index:s,preserveFocus:!0}),s++}this.editorGroupService.activateGroup(r)}else this.dropHandler.handleDrop(n,ut,()=>r,()=>r.focus(),{index:s})}dispose(){}};I([bi],NGt.prototype,"dropHandler",1);var RPi=class{getWidgetAriaLabel(){return d(12326,null)}getAriaLabel(i){return i instanceof dg?`${i.editor.getName()}, ${i.editor.getDescription()}`:i.ariaLabel}},Zln="workbench.action.toggleEditorGroupLayout";W(class extends z{constructor(){super({id:"workbench.action.toggleEditorGroupLayout",title:P(12321,"Toggle Vertical/Horizontal Editor Layout"),f1:!0,keybinding:{primary:1557,mac:{primary:2581},weight:200},icon:L.editorLayout,menu:{id:R.ViewTitle,group:"navigation",when:C.and(C.equals("view",HC.ID),qS),order:10}})}async run(a){let i=a.get(kt),e=i.orientation===1?0:1;i.setGroupOrientation(e),i.activeGroup.focus()}});be.appendMenuItem(R.MenubarLayoutMenu,{group:"5_flip",command:{id:Zln,title:{...P(12323,"Flip Layout"),mnemonicTitle:d(12322,null)}},order:1});W(class extends z{constructor(){super({id:"workbench.action.files.saveAll",title:Wwo,f1:!0,icon:L.saveAll,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",HC.ID),order:20}})}async run(a){await a.get(fe).executeCommand(bFe)}});W(class extends z{constructor(){super({id:"openEditors.closeAll",title:Rhe.LABEL,f1:!1,icon:L.closeAll,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",HC.ID),order:30}})}async run(a){let i=a.get(F),e=new Rhe;await i.invokeFunction(t=>e.run(t))}});W(class extends z{constructor(){super({id:"openEditors.newUntitledFile",title:P(12324,"New Untitled Text File"),f1:!1,icon:L.newFile,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",HC.ID),order:5}})}async run(a){await a.get(fe).executeCommand(aV)}});var fCo=(a,i,e)=>{if(Array.isArray(i)){let t=a.get(ti),o=a.get(ko);i=i.map(n=>$ke(n)&&n.workspaceUri.scheme===Q.untitled?{workspaceUri:Ve(o.untitledWorkspacesHome,n.workspaceUri.path,ceo)}:n),t.openWindow(i,e)}},vCo=(a,i)=>{a.get(ti).openWindow(i)};xt.registerCommandAndKeybindingRule({weight:200,when:ofo,primary:2051,mac:{primary:259},id:lGt,handler:async(a,i)=>{let e=a.get(ie),t=a.get(ge),o=a.get(Qa),n=lV(i,a.get(Co),e,a.get(kt),o);if(n.length){let r=n.filter(p=>p.scheme===Q.untitled),s=n.filter(p=>p.scheme!==Q.untitled),u=(await Promise.all(s.map(async p=>{let h=o.findClosest(p);return h||await t.stat(p)}))).filter(p=>!p.isDirectory).map(p=>({resource:p.resource,options:{pinned:!0}})).concat(...r.map(p=>({resource:p,options:{pinned:!0}})));await e.openEditors(u,En)}}});xt.registerCommandAndKeybindingRule({weight:210,when:C.and(rk,gu.toNegated()),primary:3,mac:{primary:2066},id:"explorer.openAndPassFocus",handler:async(a,i)=>{let e=a.get(ie),o=a.get(Qa).getContext(!0);o.length&&await e.openEditors(o.map(n=>({resource:n.resource,options:{preserveFocus:!1,pinned:!0}})))}});var LPi="showModifications",Coe=[];xt.registerCommandAndKeybindingRule({id:$rt,when:void 0,weight:200,primary:Gi(2089,34),handler:async(a,i)=>{let e=a.get(F),t=a.get(Bt),o=a.get(ie),n=a.get(ge),r=a.get(Co),s=!1;if(Coe.length===0){s=!0;let c=e.createInstance(oP);Coe.push(c),Coe.push(t.registerTextModelContentProvider(LPi,c))}let l=Pfe(i,o,r);if(l&&n.hasProvider(l)){let c=Be(l),u=d(12139,null,c,c);try{await oP.open(l,LPi,u,o,{pinned:!0}),s&&Coe.push(o.onDidVisibleEditorsChange(()=>{o.editors.some(p=>!!po.getCanonicalUri(p,{supportSideBySide:2,filterByScheme:LPi}))||(Coe=je(Coe))}))}catch{Coe=je(Coe)}}}});var PPi,MPi;Ge.registerCommand({id:dGt,handler:(a,i)=>{PPi=Pfe(i,a.get(ie),a.get(Co)),MPi||(MPi=Yrt.bindTo(a.get(X))),MPi.set(!0)}});Ge.registerCommand({id:uGt,handler:async(a,i)=>{let e=a.get(ie),t=lV(i,a.get(Co),e,a.get(kt),a.get(Qa));return t.length===2?e.openEditor({original:{resource:t[0]},modified:{resource:t[1]},options:{pinned:!0}}):!0}});Ge.registerCommand({id:pGt,handler:(a,i)=>{let e=a.get(ie),t=Pfe(i,e,a.get(Co));PPi&&t&&e.openEditor({original:{resource:PPi},modified:{resource:t},options:{pinned:!0}})}});async function APi(a,i,e,t,o){if(a.length){let n=ii?`\r
`:`
`,r,s=i?"explorer.copyRelativePathSeparator":"explorer.copyPathSeparator",l=o.getValue(s);(l==="/"||l==="\\")&&(r=l);let c=a.map(u=>t.getUriLabel(u,{relative:i,noPrefix:!0,separator:r})).join(n);await e.writeText(c)}}var bCo=async(a,i)=>{let e=lV(i,a.get(Co),a.get(ie),a.get(kt),a.get(Qa));await APi(e,!1,a.get(Bi),a.get(nt),a.get(B))};xt.registerCommandAndKeybindingRule({weight:200,when:me.focus.toNegated(),primary:2593,win:{primary:1569},id:Rfe,handler:bCo});xt.registerCommandAndKeybindingRule({weight:200,when:me.focus,primary:Gi(2089,2593),win:{primary:1569},id:Rfe,handler:bCo});var SCo=async(a,i)=>{let e=lV(i,a.get(Co),a.get(ie),a.get(kt),a.get(Qa));await APi(e,!0,a.get(Bi),a.get(nt),a.get(B))};xt.registerCommandAndKeybindingRule({weight:200,when:me.focus.toNegated(),primary:3617,win:{primary:Gi(2089,3105)},id:Lfe,handler:SCo});xt.registerCommandAndKeybindingRule({weight:200,when:me.focus,primary:Gi(2089,3617),win:{primary:Gi(2089,3105)},id:Lfe,handler:SCo});xt.registerCommandAndKeybindingRule({weight:200,when:void 0,primary:Gi(2089,46),id:"workbench.action.files.copyPathOfActiveFile",handler:async a=>{let e=a.get(ie).activeEditor,t=po.getOriginalUri(e,{supportSideBySide:1});await APi(t?[t]:[],!1,a.get(Bi),a.get(nt),a.get(B))}});Ge.registerCommand({id:sV,handler:async(a,i)=>{let e=a.get(Gt),t=a.get(Ae),o=a.get(Qa),n=a.get(ie),r=a.get(Co),s=Pfe(i,n,r);if(s&&t.isInsideWorkspace(s)){let l=await e.openView(pS,!1);if(l){let c=l.autoReveal;l.autoReveal=!1,l.setExpanded(!0),await o.select(s,"force"),l.focus(),l.autoReveal=c}}else{let l=e.getViewWithId(HC.ID);l&&(l.setExpanded(!0),l.focus())}}});Ge.registerCommand({id:cGt,handler:async(a,i)=>{let e=a.get(ie),t=a.get(Co),o=Pfe(i,e,t);if(o)return e.openEditor({resource:o,options:{override:0,source:1}})}});async function NPi(a,i){let e=a.get(kt),t=a.get(Qt),o=a.get(Uo),n=uPi(a);if(!n){let s=e.activeGroup;s.activeEditor&&(n=[],s.activeEditor instanceof ja&&!i?.saveAs&&!(s.activeEditor.primary.hasCapability(4)||s.activeEditor.secondary.hasCapability(4))&&s.activeEditor.secondary.isModified()?(n.push({groupId:s.id,editor:s.activeEditor.primary}),n.push({groupId:s.id,editor:s.activeEditor.secondary})):n.push({groupId:s.id,editor:s.activeEditor}))}if(!n||n.length===0)return;await OPi(a,n,i);let r=t.getFocusedCodeEditor();if(r instanceof Ed&&!r.isSimpleWidget){let s=r.getModel()?.uri;s&&!n.some(({editor:l})=>ze(po.getCanonicalUri(l,{supportSideBySide:1}),s))&&(o.files.get(s)?.isReadonly()||await o.save(s,i))}}function ICo(a,i,e){let t=[];for(let o of i)for(let n of o.getEditors(0))n.isDirty()&&t.push({groupId:o.id,editor:n});return OPi(a,t,e)}async function OPi(a,i,e){let t=a.get(ie),o=a.get(Ne),n=a.get(F);try{await t.save(i,e)}catch(r){if(!Yi(r)){let s=[li({id:"workbench.action.files.saveEditors",label:d(12141,null),run:()=>n.invokeFunction(c=>OPi(c,i,e))})],l=i.filter(({editor:c})=>!c.hasCapability(4));l.length>0&&s.push(li({id:"workbench.action.files.revertEditors",label:l.length>1?d(12143,null):d(12142,null),run:()=>t.revert(l)})),o.notify({id:i.map(({editor:c})=>Lr(c.resource?.toString())).join(),severity:ft.Error,message:d(12138,null,i.map(({editor:c})=>c.getName()).join(", "),Mn(r,!1)),actions:{primary:s}})}}}xt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:2097,id:vFe,handler:a=>NPi(a,{reason:1,force:!0})});xt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:Gi(2089,49),win:{primary:Gi(2089,3121)},id:hGt,handler:a=>NPi(a,{reason:1,force:!0,skipSaveParticipants:!0})});xt.registerCommandAndKeybindingRule({id:jrt,weight:200,when:void 0,primary:3121,handler:a=>NPi(a,{reason:1,saveAs:!0})});xt.registerCommandAndKeybindingRule({when:void 0,weight:200,primary:void 0,mac:{primary:2609},win:{primary:Gi(2089,49)},id:bFe,handler:a=>ICo(a,a.get(kt).getGroups(1),{reason:1})});Ge.registerCommand({id:Mfe,handler:(a,i,e)=>{let t=a.get(kt),o=Zp([e],a.get(ie),t,a.get(Co)),n;return o.groupedEditors.length?n=o.groupedEditors.map(({group:r})=>r):n=t.getGroups(1),ICo(a,n,{reason:1})}});Ge.registerCommand({id:gGt,handler:async a=>(await a.get(ie).saveAll({includeUntitled:!1,reason:1})).success});Ge.registerCommand({id:fFe,handler:async a=>{let i=a.get(kt),e=a.get(ie),t=uPi(a);if(!t){let o=i.activeGroup;o.activeEditor&&(t=[{groupId:o.id,editor:o.activeEditor}])}if(!(!t||t.length===0))try{await e.revert(t.filter(({editor:o})=>!o.hasCapability(4)),{force:!0})}catch(o){a.get(Ne).error(d(12137,null,t.map(({editor:r})=>r.getName()).join(", "),Mn(o,!1)))}}});Ge.registerCommand({id:vGt,handler:(a,i)=>{let e=a.get(Ae),t=a.get(gt),o=e.getWorkspace(),n=lV(i,a.get(Co),a.get(ie),a.get(kt),a.get(Qa)).filter(s=>o.folders.some(l=>t.extUri.isEqual(l.uri,s)));return n.length===0?a.get(fe).executeCommand(att.ID):a.get(iS).removeFolders(n)}});xt.registerCommandAndKeybindingRule({weight:210,when:C.and(rk,xhe,ytt.negate()),primary:15,id:Bwo,handler:a=>{let e=a.get(Es).getActivePaneComposite(0);if(e?.getId()!==Dv)return;e.getViewPaneContainer().getExplorerView().previousCompressedStat()}});xt.registerCommandAndKeybindingRule({weight:210,when:C.and(rk,xhe,wtt.negate()),primary:17,id:Hwo,handler:a=>{let e=a.get(Es).getActivePaneComposite(0);if(e?.getId()!==Dv)return;e.getViewPaneContainer().getExplorerView().nextCompressedStat()}});xt.registerCommandAndKeybindingRule({weight:210,when:C.and(rk,xhe,ytt.negate()),primary:14,id:Uwo,handler:a=>{let e=a.get(Es).getActivePaneComposite(0);if(e?.getId()!==Dv)return;e.getViewPaneContainer().getExplorerView().firstCompressedStat()}});xt.registerCommandAndKeybindingRule({weight:210,when:C.and(rk,xhe,wtt.negate()),primary:13,id:zwo,handler:a=>{let e=a.get(Es).getActivePaneComposite(0);if(e?.getId()!==Dv)return;e.getViewPaneContainer().getExplorerView().lastCompressedStat()}});xt.registerCommandAndKeybindingRule({weight:200,when:null,primary:Ft?ii?Gi(2089,44):2604:2092,secondary:Ft?[2092]:void 0,id:aV,metadata:{description:bGt,args:[{isOptional:!0,name:"New Untitled Text File arguments",description:"The editor view type or language ID if known",schema:{type:"object",properties:{viewType:{type:"string"},languageId:{type:"string"}}}}]},handler:async(a,i)=>{await a.get(ie).openEditor({resource:void 0,options:{override:i?.viewType,pinned:!0},languageId:i?.languageId})}});Ge.registerCommand({id:Kwo,handler:async(a,i)=>{let e=a.get(ie),t=a.get(nn),o=a.get(ge),n=d(12140,null),r=Ve(await t.defaultFilePath(),i?.fileName??"Untitled.txt"),s=await t.showSaveDialog({saveLabel:n,title:n,defaultUri:r});s&&(await o.createFile(s,void 0,{overwrite:!0}),await e.openEditor({resource:s,options:{override:i?.viewType,pinned:!0},languageId:i?.languageId}))}});W(xGt);W(kGt);W(EGt);W(DGt);W(_Gt);W(Zrt);W(TGt);W(RGt);W(LGt);W(MGt);W(PGt);Ge.registerCommand("_files.windowOpen",fCo);Ge.registerCommand("_files.newWindow",vCo);var o6=10,yCo="renameFile";xt.registerCommandAndKeybindingRule({id:yCo,weight:200+o6,when:C.and(rk,nk.toNegated(),kW),primary:60,mac:{primary:3},handler:rCo});var wCo="moveFileToTrash";xt.registerCommandAndKeybindingRule({id:wCo,weight:200+o6,when:C.and(rk,Che),primary:20,mac:{primary:2049,secondary:[20]},handler:sCo});var VGt="deleteFile";xt.registerCommandAndKeybindingRule({id:VGt,weight:200+o6,when:rk,primary:1044,mac:{primary:2561},handler:SPi});xt.registerCommandAndKeybindingRule({id:VGt,weight:200+o6,when:C.and(rk,Che.toNegated()),primary:20,mac:{primary:2049},handler:SPi});var CCo="filesExplorer.cut";xt.registerCommandAndKeybindingRule({id:CCo,weight:200+o6,when:C.and(rk,nk.toNegated(),kW),primary:2102,handler:lCo});var xCo="filesExplorer.copy";xt.registerCommandAndKeybindingRule({id:xCo,weight:200+o6,when:C.and(rk,nk.toNegated()),primary:2081,handler:aCo});var FPi="filesExplorer.paste";Ge.registerCommand(FPi,cCo);xt.registerKeybindingRule({id:`^${FPi}`,weight:200+o6,when:C.and(rk,kW),primary:2100});xt.registerCommandAndKeybindingRule({id:"filesExplorer.cancelCut",weight:200+o6,when:C.and(rk,iBt),primary:9,handler:async a=>{await a.get(Qa).setToCopy([],!0)}});xt.registerCommandAndKeybindingRule({id:"filesExplorer.openFilePreserveFocus",weight:200+o6,when:C.and(rk,gu.toNegated()),primary:10,handler:dCo});var rst={id:Rfe,title:d(12110,null)},sst={id:Lfe,title:d(12112,null)},kFe={id:sV,title:d(12130,null)};ast(Rfe,rst.title,Ho.IsFileSystemResource,"1_cutcopypaste",!0);ast(Lfe,sst.title,Ho.IsFileSystemResource,"1_cutcopypaste",!0);ast(kFe.id,kFe.title,Ho.IsFileSystemResource,"2_files",!1,1);function ast(a,i,e,t,o,n){let r=o!==!0?I3.negate():void 0;be.appendMenuItem(R.EditorTitleContext,{command:{id:a,title:i,precondition:r},when:e,group:t,order:n})}kCo("workbench.files.action.acceptLocalChanges",d(12099,null),L.check,-10,pCo);kCo("workbench.files.action.revertLocalChanges",d(12133,null),L.discard,-9,mCo);function kCo(a,i,e,t,o){Ge.registerCommand(a,o),be.appendMenuItem(R.EditorTitle,{command:{id:a,title:i,icon:e},when:C.equals(TPi,!0),group:"navigation",order:t})}function TP({id:a,title:i,category:e,metadata:t},o){be.appendMenuItem(R.CommandPalette,{command:{id:a,title:i,category:e,metadata:t},when:o})}TP({id:Rfe,title:P(12111,"Copy Path of Active File"),category:Fe.File},qo.negate());TP({id:Lfe,title:P(12113,"Copy Relative Path of Active File"),category:Fe.File},qo.negate());TP({id:vFe,title:cPi,category:Fe.File});TP({id:hGt,title:Fwo,category:Fe.File});TP({id:Mfe,title:P(12135,"Save All in Group"),category:Fe.File},qo.negate());TP({id:gGt,title:P(12136,"Save All Files"),category:Fe.File},qo.negate());TP({id:fFe,title:P(12131,"Revert File"),category:Fe.File},qo.negate());TP({id:$rt,title:P(12104,"Compare Active File with Saved"),category:Fe.File,metadata:{description:P(12105,"Opens a new diff editor to compare the active file with the version on disk.")}});TP({id:jrt,title:mGt,category:Fe.File},qo.negate());TP({id:Nfe,title:hPi,category:Fe.File},C.and(i_.notEqualsTo("0"),qo.negate()));TP({id:CFe,title:gPi,category:Fe.File,metadata:{description:P(12126,"Create a new folder or directory")}},C.and(i_.notEqualsTo("0"),qo.negate()));TP({id:aV,title:bGt,category:Fe.File},qo.negate());var WPi=C.or(Ho.IsFileSystemResource,Ho.Scheme.isEqualTo(Q.untitled)),BGt={id:lGt,title:d(12128,null)};be.appendMenuItem(R.OpenEditorsContext,{group:"navigation",order:10,command:BGt,when:WPi});be.appendMenuItem(R.OpenEditorsContext,{group:"1_open",order:10,command:{id:jMe,title:d(12129,null)},when:C.and(A0,e6.toNegated())});be.appendMenuItem(R.OpenEditorsContext,{group:"1_cutcopypaste",order:10,command:rst,when:Ho.IsFileSystemResource});be.appendMenuItem(R.OpenEditorsContext,{group:"1_cutcopypaste",order:20,command:sst,when:Ho.IsFileSystemResource});be.appendMenuItem(R.OpenEditorsContext,{group:"2_save",order:10,command:{id:vFe,title:cPi,precondition:SFe},when:C.or(Ho.Scheme.isEqualTo(Q.untitled),C.and(e6.toNegated(),Qrt.toNegated(),pYe.toNegated()))});be.appendMenuItem(R.OpenEditorsContext,{group:"2_save",order:20,command:{id:fFe,title:d(12132,null),precondition:SFe},when:C.and(e6.toNegated(),Qrt.toNegated(),Ho.Scheme.notEqualsTo(Q.untitled),pYe.toNegated())});be.appendMenuItem(R.OpenEditorsContext,{group:"2_save",order:30,command:{id:Mfe,title:d(12134,null),precondition:bYe},when:e6});be.appendMenuItem(R.OpenEditorsContext,{group:"3_compare",order:10,command:{id:$rt,title:d(12108,null),precondition:SFe},when:C.and(Ho.IsFileSystemResource,pYe.toNegated(),oH.toNegated())});var ECo={id:pGt,title:d(12109,null)};be.appendMenuItem(R.OpenEditorsContext,{group:"3_compare",order:20,command:ECo,when:C.and(Ho.HasResource,Yrt,WPi,oH.toNegated())});var TCo={id:dGt,title:d(12107,null)};be.appendMenuItem(R.OpenEditorsContext,{group:"3_compare",order:30,command:TCo,when:C.and(Ho.HasResource,WPi,oH.toNegated())});var VPi={id:uGt,title:d(12106,null)};be.appendMenuItem(R.OpenEditorsContext,{group:"3_compare",order:30,command:VPi,when:C.and(Ho.HasResource,oH,fGt)});be.appendMenuItem(R.EditorTitleContext,{group:"1_compare",order:30,command:VPi,when:C.and(Ho.HasResource,QMt,YMt)});be.appendMenuItem(R.OpenEditorsContext,{group:"4_close",order:10,command:{id:ok,title:d(12100,null)},when:e6.toNegated()});be.appendMenuItem(R.OpenEditorsContext,{group:"4_close",order:20,command:{id:$Me,title:d(12102,null)},when:e6.toNegated()});be.appendMenuItem(R.OpenEditorsContext,{group:"4_close",order:30,command:{id:whe,title:d(12103,null)}});be.appendMenuItem(R.OpenEditorsContext,{group:"4_close",order:40,command:{id:F8,title:d(12101,null)}});be.appendMenuItem(R.ExplorerContext,{group:"navigation",order:4,command:{id:Nfe,title:hPi,precondition:kW},when:gu});be.appendMenuItem(R.ExplorerContext,{group:"navigation",order:6,command:{id:CFe,title:gPi,precondition:kW},when:gu});be.appendMenuItem(R.ExplorerContext,{group:"navigation",order:10,command:BGt,when:C.and(gu.toNegated(),Ho.HasResource)});be.appendMenuItem(R.ExplorerContext,{group:"navigation",order:20,command:{id:cGt,title:d(12116,null)},when:C.and(gu.toNegated(),tBt)});be.appendMenuItem(R.ExplorerContext,{group:"3_compare",order:20,command:ECo,when:C.and(gu.toNegated(),Ho.HasResource,Yrt,oH.toNegated())});be.appendMenuItem(R.ExplorerContext,{group:"3_compare",order:30,command:TCo,when:C.and(gu.toNegated(),Ho.HasResource,oH.toNegated())});be.appendMenuItem(R.ExplorerContext,{group:"3_compare",order:30,command:VPi,when:C.and(gu.toNegated(),Ho.HasResource,oH)});be.appendMenuItem(R.ExplorerContext,{group:"5_cutcopypaste",order:8,command:{id:CCo,title:d(12114,null)},when:C.and(nk.toNegated(),kW)});be.appendMenuItem(R.ExplorerContext,{group:"5_cutcopypaste",order:10,command:{id:xCo,title:Xwo},when:nk.toNegated()});be.appendMenuItem(R.ExplorerContext,{group:"5_cutcopypaste",order:20,command:{id:FPi,title:Jwo,precondition:C.and(kW,AGt)},when:gu});be.appendMenuItem(R.ExplorerContext,{group:"5b_importexport",order:10,command:{id:fPi,title:Zwo},when:C.or(C.and(Mu.toNegated(),Ho.Scheme.notEqualsTo(Q.file)),C.and(Mu,gu.toNegated(),nk.toNegated()),C.and(Mu,UMt))});be.appendMenuItem(R.ExplorerContext,{group:"5b_importexport",order:20,command:{id:vPi,title:eCo},when:C.and(Mu,gu,kW)});be.appendMenuItem(R.ExplorerContext,{group:"6_copypath",order:10,command:rst,when:Ho.IsFileSystemResource});be.appendMenuItem(R.ExplorerContext,{group:"6_copypath",order:20,command:sst,when:Ho.IsFileSystemResource});be.appendMenuItem(R.ExplorerContext,{group:"2_workspace",order:10,command:{id:MMe,title:yVt},when:C.and(nk,C.or(QD,el.isEqualTo("workspace")))});be.appendMenuItem(R.ExplorerContext,{group:"2_workspace",order:30,command:{id:vGt,title:Vwo},when:C.and(nk,gu,C.and(i_.notEqualsTo("0"),C.or(QD,el.isEqualTo("workspace"))))});be.appendMenuItem(R.ExplorerContext,{group:"7_modification",order:10,command:{id:yCo,title:Qwo,precondition:kW},when:nk.toNegated()});be.appendMenuItem(R.ExplorerContext,{group:"7_modification",order:20,command:{id:wCo,title:Ywo},alt:{id:VGt,title:d(12115,null)},when:C.and(nk.toNegated(),Che)});be.appendMenuItem(R.ExplorerContext,{group:"7_modification",order:20,command:{id:VGt,title:d(12115,null)},when:C.and(nk.toNegated(),Che.toNegated())});for(let a of[R.EmptyEditorGroupContext,R.EditorTabsBarContext])be.appendMenuItem(a,{command:{id:aV,title:d(12125,null)},group:"1_file",order:10}),be.appendMenuItem(a,{command:{id:"workbench.action.quickOpen",title:d(12127,null)},group:"1_file",order:20});be.appendMenuItem(R.MenubarFileMenu,{group:"1_new",command:{id:aV,title:d(12120,null)},order:1});be.appendMenuItem(R.MenubarFileMenu,{group:"4_save",command:{id:vFe,title:d(12122,null),precondition:C.or(Tr,C.and(z8,xH))},order:1});be.appendMenuItem(R.MenubarFileMenu,{group:"4_save",command:{id:jrt,title:d(12124,null),precondition:C.or(Tr,C.and(z8,xH))},order:2});be.appendMenuItem(R.MenubarFileMenu,{group:"4_save",command:{id:bFe,title:d(12123,null),precondition:bYe},order:3});be.appendMenuItem(R.MenubarFileMenu,{group:"5_autosave",command:{id:Zrt.ID,title:d(12117,null),toggled:C.notEquals("config.files.autoSave","off")},order:1});be.appendMenuItem(R.MenubarFileMenu,{group:"6_close",command:{id:fFe,title:d(12121,null),precondition:C.or(C.and(qMt),C.and(Ho.Scheme.notEqualsTo(Q.untitled),z8,xH))},order:1});be.appendMenuItem(R.MenubarFileMenu,{group:"6_close",command:{id:ok,title:d(12118,null),precondition:C.or(Tr,C.and(z8,xH))},order:2});be.appendMenuItem(R.MenubarGoMenu,{group:"3_global_nav",command:{id:"workbench.action.quickOpen",title:d(12119,null)},order:1});be.appendMenuItem(R.ChatAttachmentsContext,{group:"navigation",order:10,command:BGt,when:C.and(Ho.IsFileSystemResource,gu.toNegated())});be.appendMenuItem(R.ChatAttachmentsContext,{group:"navigation",order:20,command:kFe,when:Ho.IsFileSystemResource});be.appendMenuItem(R.ChatAttachmentsContext,{group:"1_cutcopypaste",order:10,command:rst,when:Ho.IsFileSystemResource});be.appendMenuItem(R.ChatAttachmentsContext,{group:"1_cutcopypaste",order:20,command:sst,when:Ho.IsFileSystemResource});for(let a of[R.ChatInlineResourceAnchorContext,R.ChatInputResourceAttachmentContext])be.appendMenuItem(a,{group:"navigation",order:10,command:BGt,when:C.and(Ho.HasResource,gu.toNegated())}),be.appendMenuItem(a,{group:"navigation",order:20,command:kFe,when:Ho.IsFileSystemResource}),be.appendMenuItem(a,{group:"1_cutcopypaste",order:10,command:rst,when:Ho.IsFileSystemResource}),be.appendMenuItem(a,{group:"1_cutcopypaste",order:20,command:sst,when:Ho.IsFileSystemResource});function cst(a){return Array.isArray(a.repositories)&&Array.isArray(a.visibleRepositories)}function ou(a){return!!a.provider&&!!a.input}function dO(a){return!!a.validateInput&&typeof a.value=="string"}function uO(a){return a.type==="actionButton"}function ww(a){return!!a.provider&&!!a.resources}function pO(a){return!!a.sourceUri&&ww(a.resourceGroup)}function n6(a){return Fm.isResourceNode(a)&&ww(a.context)}function mO(a){return a.type==="historyItemViewModel"}function EFe(a){return a.type==="historyItemLoadMore"}function r6(a){return a.type==="historyItemChangeViewModel"}function TFe(a){return Fm.isResourceNode(a)&&mO(a.context)}function t1(a){return a.type==="artifactGroup"}function s6(a){return Fm.isResourceNode(a)&&t1(a.context)}function _P(a){return a.type==="artifact"}var _Co=(a,i)=>a instanceof Do&&i instanceof Do?a.id===i.id&&a.enabled===i.enabled&&a.hideActions?.isHidden===i.hideActions?.isHidden:a.id===i.id&&a.enabled===i.enabled;function xoe(a,i,e,t){let o=[],n=[],r=()=>{let{primary:s,secondary:l}=xl(a.getActions({arg:t,shouldForwardArgs:!0}),e);eo(o,s,_Co)&&eo(n,l,_Co)||(o=s,n=l,i(s,l))};return r(),a.onDidChange(r)}function a6(a,i){return um(a.getActions({arg:i,shouldForwardArgs:!0}),"inline").secondary}var lst=class extends it{constructor(e,t){super(`statusbaraction{${e.id}}`,HPi(e),"",!0);this.command=e;this.commandService=t;this.commandTitle=e.title,this.tooltip=e.tooltip||""}run(){return this.commandService.executeCommand(this.command.id,...this.command.arguments||[])}},BPi=class extends ts{constructor(i,e){super(null,i,{...e,icon:!1,label:!0}),this._commandTitle=i.commandTitle}render(i){i.classList.add("scm-status-bar-action"),super.render(i)}updateLabel(){if(this.options.label&&this.label){let i=ir(this._commandTitle??this.action.label).map(e=>{if(typeof e=="string"){let t=document.createElement("span");return t.textContent=e,t}return e});Ii(this.label,...i)}}};function koe(a){return(i,e)=>i instanceof lst?new BPi(i,e):ta(a,i,e)}function l6(a){return`${a.providerId}:${a.label}${a.rootUri?`:${a.rootUri.toString()}`:""}`}function HGt(a){return a.groups.reduce((i,e)=>i+e.resources.length,0)}function UGt(a){return`${a.displayId??a.id} - ${a.subject}`}function zGt(a,i){return q.isThemeIcon(i.provider.iconPath)?a?.pinned===!0&&a?.repository.id===i.id&&i.provider.iconPath.id===L.repo.id?L.repoPinned:i.provider.iconPath:L.repo}function HPi(a){let i;if(typeof a.arguments?.[0]=="string"){let e=a.arguments[0].lastIndexOf("/");if(i=e!==-1?a.arguments[0].substring(0,e):a.arguments[0],i=i.replace(/^(?:git\.|remoteHub\.)/,"").trim(),i.length===0)return;i=i[0].toLocaleUpperCase()+i.slice(1)}return i}async function DCo(a,i){let e=[];for(let n of a.response.value)if(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized"){let r=dst(n,a.sessionResource);e.push(...r);let s=await ecn(n,i);e.push(...s)}else if(n.kind==="inlineReference"){let r=await icn(n,i);r&&e.push(r)}let t=a.session.getItems().find(n=>_r(n)&&n.id===a.requestId),o=t?t.messageText:d(9325,null);return{id:a.sessionResource.toString()+"_"+a.id,title:o,images:e}}function dst(a,i){let e=[],t=pi.resultDetails(a),o=a.pastTenseMessage??a.invocationMessage,n=o?typeof o=="string"?o:o.value:void 0,r=(s,l,c)=>{let u=wA(s),p=u?`file${u}`:"file.bin",h=v_.createUri(i,a.toolCallId,c,p);e.push({id:`${a.toolCallId}_${c}`,uri:h,name:d(9326,null,e.length+1),mimeType:s,data:l,source:d(9328,null,a.toolId),caption:n})};if(oR(t))for(let s=0;s<t.output.length;s++){let l=t.output[s];l.type==="embed"&&l.mimeType?.startsWith("image/")&&!l.isText&&r(l.mimeType,Ws(l.value),s)}else if(RH(t)){let s=t.output;if(s.mimeType?.startsWith("image/")){let l=tcn(t,a);l&&r(s.mimeType,l,0)}}return e}async function ecn(a,i){let e=a.pastTenseMessage??a.invocationMessage;if(!e||typeof e=="string"||!e.uris||Object.keys(e.uris).length===0)return[];let t=[];for(let o of Object.values(e.uris)){let n=A.revive(o),r=Py(n.path);if(r?.startsWith("image/")){let s;try{s=await i(n)}catch{continue}let l=n.path.split("/").pop()??"image";t.push({id:n.toString(),uri:n,name:l,mimeType:r,data:s,source:d(9328,null,a.toolId),caption:e.value})}}return t}function tcn(a,i){if(i.kind==="toolInvocationSerialized"){let e=a;return e.output.base64Data?Ws(e.output.base64Data):void 0}else return a.output.value}async function icn(a,i){let e=a.inlineReference,t=A.isUri(e)?e:Bp(e)?e.uri:e.location.uri,o=Py(t.path);if(!o?.startsWith("image/"))return;let n;try{n=await i(t)}catch{return}let r=a.name??t.path.split("/").pop()??"image";return{id:t.toString(),uri:t,name:r,mimeType:o,data:n,source:d(9327,null),caption:void 0}}function ust(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):a&&typeof a=="object"&&!Array.isArray(a)?new Uint8Array(Object.keys(a).sort((i,e)=>Number(i)-Number(e)).map(i=>a[i])):void 0}function UPi(a){let i=[];for(let e of a.variables){if(!SC(e))continue;let t=ust(e.value);if(!t)continue;let o=e.mimeType??Py(e.name)??"image/png",n=e.references?.[0]?.reference,r=A.isUri(n)?n:A.from({scheme:"data",path:`${e.id}/${encodeURIComponent(e.name)}`});i.push({id:r.toString(),uri:r,name:e.name,mimeType:o,data:Ke.wrap(t),source:d(9329,null),caption:void 0})}return i}var Eoe=le("chatImageCarouselService");async function ocn(a,i){let e=[],t=new Map;for(let n of a)_r(n)&&t.set(n.id,n);for(let n of a){if(!Ni(n))continue;let{title:r,images:s}=await DCo(n,async h=>Ke.wrap(await i(h))),l=t.get(n.requestId),u=[...l?UPi(l):[],...s],p=RCo(u);p.length>0&&e.push({title:l?.messageText??r,images:p.map(({uri:h,name:g,mimeType:f,data:v,caption:b})=>({id:h.toString(),name:g,mimeType:f,data:v.buffer,caption:b}))})}let o=new Set(a.filter(Ni).map(n=>n.requestId));for(let n of a){if(!_r(n)||o.has(n.id))continue;let r=UPi(n),s=RCo(r);s.length>0&&e.push({title:n.messageText,images:s.map(({uri:l,name:c,mimeType:u,data:p,caption:h})=>({id:l.toString(),name:c,mimeType:u,data:p.buffer,caption:h}))})}return e}function RCo(a){return a.filter((i,e)=>e===0?!0:!ze(a[e-1].uri,i.uri))}function ncn(a,i,e){let t=0;for(let o of a){let n=rcn(o.images,i);if(n>=0)return t+n;t+=o.images.length}if(!e)return-1;t=0;for(let o of a){let n=scn(o.images,e);if(n>=0)return t+n;t+=o.images.length}return-1}function rcn(a,i){let e=i.toString(),t=a.findIndex(n=>n.id===e);if(t>=0)return t;let o=a.findIndex(n=>{try{return ze(A.parse(n.id),i)}catch{return!1}});return o>=0?o:-1}function scn(a,i){let e=Ke.wrap(i);return a.findIndex(t=>Ke.wrap(t.data).equals(e))}function acn(a,i,e){let t=e.toString()+"_carousel",o=d(8003,null);return{collection:{id:t,title:a.length===1&&a[0].title||o,sections:a},startIndex:i}}function lcn(a,i){let e=a.path.split("/").pop()??"image",t=Py(a.path)??Py(e)??"image/png";return{name:e,mimeType:t,data:i,title:e}}var LCo="workbench.action.chat.openImageInCarousel",_Fe=class{constructor(i,e,t){this.chatWidgetService=i;this.commandService=e;this.fileService=t}async openCarouselAtResource(i,e){let t=this.chatWidgetService.lastFocusedWidget;if(!t?.viewModel){await this.openSingleImage(i,e);return}let o=t.viewModel.getItems().filter(c=>_r(c)||Ni(c)),r=await ocn(o,async c=>(await this.fileService.readFile(c)).value.buffer),s=ncn(r,i,e);if(s===-1||r.length===0){await this.openSingleImage(i,e);return}let l=acn(r,s,t.viewModel.sessionResource);await this.commandService.executeCommand(LCo,l)}async openSingleImage(i,e){e||(e=(await this.fileService.readFile(i)).value.buffer);let t=lcn(i,e);await this.commandService.executeCommand(LCo,t)}};_Fe=I([m(0,Lt),m(1,fe),m(2,ge)],_Fe);var i1={style:1,position:{hoverPosition:2},trapFocus:!0},Fq={groupId:"chat-attachments"},MCo=["display","position","margin","padding","font-size","font-family","color","background-color"],pk=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.attachment=e;this.options=t;this.currentLanguageModel=r;this.commandService=s;this.openerService=l;this.configurationService=c;this.terminalService=u;this._onDidDelete=this._register(new T);this._onDidOpen=this._register(new T);this._hasClearButton=!1;this.element=D(o,_(".chat-attached-context-attachment.show-file-icons")),this.attachClearButton(),this.label=n.create(this.element,{supportIcons:!0,hoverTargetOverride:this.element}),this._register(this.label),this.element.tabIndex=0,this.element.role="button",this._register($(this.element,ne.AUXCLICK,p=>{p.button===1&&this.options.supportsDeletion&&!this.attachment.range&&(p.preventDefault(),p.stopPropagation(),this._onDidDelete.fire(p))}))}get onDidDelete(){return this._onDidDelete.event}get onDidOpen(){return this._onDidOpen.event}modelSupportsVision(){return PCo(this.currentLanguageModel)}appendDeletionHint(e){return this._hasClearButton?d(7288,null,e):e}attachClearButton(){if(this.attachment.range||!this.options.supportsDeletion)return;this._hasClearButton=!0;let e=new Pi(this.element,{supportIcons:!0,hoverDelegate:Dg(),title:d(7287,null)});e.element.tabIndex=-1,e.icon=L.close,this._register(e),this._register(U.once(e.onDidClick)(t=>{this._onDidDelete.fire(t)})),this._register(Yo(this.element,ne.KEY_DOWN,t=>{(t.keyCode===1||t.keyCode===20)&&(t.preventDefault(),t.stopPropagation(),this._onDidDelete.fire(t.browserEvent))}))}addResourceOpenHandlers(e,t){this.element.style.cursor="pointer",this._register(qrt(this.element,async o=>{this.attachment.kind==="directory"?await this.openResource(e,o,!0):await this.openResource(e,o,!1,t)}))}async openResource(e,t,o,n){if(o){this.commandService.executeCommand(kFe.id,e);return}if(e.scheme===Q.vscodeTerminal){this.terminalService?.openResource(e);return}let r=n?{selection:n}:void 0,s={fromUserGesture:!0,openToSide:t.openToSide,editorOptions:{...r,...t.editorOptions}};await this.openerService.open(e,s),this._onDidOpen.fire(),this.element.focus()}};pk=I([m(5,fe),m(6,Je),m(7,B),m(8,an)],pk);function PCo(a){return a?.metadata.capabilities?.vision??!1}var Toe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(o,s,l,c,r,u,p,h);this.themeService=g;this.hoverService=f;this.languageModelsService=v;this.instantiationService=b;let S=Jo(e.path),y=yd(e.path),w=`${S} ${y}`,x=t?d(7307,null,w,t.startLineNumber,t.endLineNumber):d(7305,null,w);if(o.omittedState===2)x=d(7318,null,o.name),this.renderOmittedWarning(w,x);else{let E={hidePath:!0,title:n?.options?.status?.description};if(this.label.setFile(e,o.kind==="file"?{...E,fileKind:0,range:t}:{...E,fileKind:1,icon:this.themeService.getFileIconTheme().hasFolderIcons?void 0:W5}),o.kind==="directory"&&typeof o.imageCount=="number"){let M=Ape(r?.metadata);M!==void 0&&o.imageCount>M&&this.renderFolderImageLimitWarning(o.imageCount,M)}}this.element.ariaLabel=this.appendDeletionHint(x),this.instantiationService.invokeFunction(E=>{this._register(DFe(E,this.element,e))}),this.addResourceOpenHandlers(e,t)}renderOmittedWarning(e,t){let o=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-warning")),n=_("span.chat-attached-context-custom-text",{},e);this.element.appendChild(o),this.element.appendChild(n);let r=_("div.chat-attached-context-hover");r.setAttribute("aria-label",t),this.element.classList.add("warning"),r.textContent=d(7306,null,this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name:this.currentLanguageModel??"This model"),this._register(this.hoverService.setupDelayedHover(this.element,{...i1,content:r},Fq))}renderFolderImageLimitWarning(e,t){this.element.classList.add("warning");let o=_("div.chat-attached-context-hover");o.textContent=d(7308,null,e,t),this._register(this.hoverService.setupDelayedHover(this.element,{...i1,content:o},Fq))}};Toe=I([m(8,fe),m(9,Je),m(10,B),m(11,Pe),m(12,ot),m(13,Gr),m(14,F)],Toe);var _oe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c,p);this.hoverService=u;this.terminalService=p;let h=d(7324,null,e.command),g=()=>this.openResource(e.resource,{editorOptions:{preserveFocus:!0}},!1,void 0);this._register(ccn(this.element,e,h,this.hoverService,g)),this._register($(this.element,ne.KEY_DOWN,async f=>{let v=new mi(f);(v.equals(3)||v.equals(10))&&(Kt.stop(f,!0),await g())})),this.element.ariaLabel=this.appendDeletionHint(h)}};_oe=I([m(5,fe),m(6,Je),m(7,B),m(8,ot),m(9,an)],_oe);function ccn(a,i,e,t,o){let n=new O;a.ariaLabel=e,a.style.cursor="pointer";let r=_("span");r.classList.add(...q.asClassNameArray(L.terminal));let s=_("div.chat-attached-context-pill",{},r),l=_("span.chat-attached-context-custom-text",{},i.command);return a.appendChild(s),a.appendChild(l),n.add($(a,ne.CLICK,c=>{c.preventDefault(),c.stopPropagation(),o()})),n.add(t.setupDelayedHover(a,()=>dcn(e,i),Fq)),n}function dcn(a,i){{let e=_("div.chat-attached-context-hover");e.setAttribute("aria-label",a);let t=_("div",{},typeof i.exitCode=="number"?d(7326,null,i.command,i.exitCode):d(7325,null));t.classList.add("attachment-additional-info");let o=_("pre.chat-terminal-command-block");if(e.append(t,o),i.output&&i.output.trim().length>0){let n=_("div",{},d(7327,null));n.classList.add("attachment-additional-info");let r=_("pre.chat-terminal-command-output"),s=i.output.split(`
`),l=[];for(let c of s){if(l.length>=5){l.push("...");break}let u=c.trim();u.length!==0&&(u.length>80?l.push(`${u.slice(0,80)}...`):l.push(u))}r.textContent=l.join(`
`),e.append(n,r)}return{...i1,content:e}}}var Doe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(t,n,r,s,o,l,c,u);this.hoverService=p;this.languageModelsService=h;this.labelService=f;this.chatEntitlementService=v;this.chatImageCarouselService=b;let S;t.omittedState===2?S=d(7319,null,t.name):t.omittedState===1?S=d(7321,null,t.name):t.omittedState===3?S=d(7313,null,t.name):S=d(7309,null,t.name);let y=t.references?.[0]?.reference;e=y&&A.isUri(y)?y:void 0;let w=ust(t.value),x=async()=>{(e||w)&&u.getValue("imageCarousel.chat.enabled")?await this.openInCarousel(t.id,t.name,w,e):e&&await this.openResource(e,{editorOptions:{preserveFocus:!0}},!1,void 0)},E=this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name??this.currentLanguageModel.identifier:"Current model",M=e?this.labelService.getUriLabel(e):t.fullName||t.name;this._register(ACo(e,t.name,M,this.element,w??t.value,this.hoverService,S,E,x,this.currentLanguageModel,t.omittedState,this.chatEntitlementService.previewFeaturesDisabled)),this.element.ariaLabel=this.appendDeletionHint(S),(w&&u.getValue("imageCarousel.chat.enabled")||e)&&(this.element.style.cursor="pointer",this._register(qrt(this.element,async()=>{await x()}))),e&&g.invokeFunction(V=>{this._register(DFe(V,this.element,e))})}async openInCarousel(e,t,o,n){let r=n??A.from({scheme:"data",path:`${e}/${encodeURIComponent(t)}`});await this.chatImageCarouselService.openCarouselAtResource(r,o)}};Doe=I([m(6,fe),m(7,Je),m(8,B),m(9,ot),m(10,Gr),m(11,F),m(12,nt),m(13,dr),m(14,Eoe)],Doe);function ACo(a,i,e,t,o,n,r,s,l,c,u,p){let h=new O;u===1&&t.classList.add("partial-warning"),t.ariaLabel=r,t.style.position="relative",a&&(t.style.cursor="pointer");let g=PCo(c),f=_("div.chat-attached-context-pill",{},_(g&&!p?"span.codicon.codicon-file-media":"span.codicon.codicon-warning")),v=_("span.chat-attached-context-custom-text",{},i);t.appendChild(f),t.appendChild(v);let b=_("div.chat-attached-context-hover");if(b.setAttribute("aria-label",r),p)t.classList.add("warning"),b.textContent=d(7311,null),h.add(n.setupDelayedHover(t,{content:b,style:1}));else if(!g&&c||u===2)t.classList.add("warning"),b.textContent=d(7310,null,s??"This model"),h.add(n.setupDelayedHover(t,{content:b,style:1}));else if(u===3){t.classList.add("warning");let S=Ape(c?.metadata);b.textContent=S!==void 0?d(7314,null,S):d(7315,null),h.add(n.setupDelayedHover(t,{content:b,style:1}))}else{h.add(n.setupDelayedHover(t,{content:b,style:1}));let S=new Blob([o],{type:"image/png"}),y=URL.createObjectURL(S),w=_("img.chat-attached-context-pill-image",{src:y,alt:""}),x=_("div.chat-attached-context-pill",{},w),E=t.querySelector(".chat-attached-context-pill");E&&E.replaceWith(x);let M=_("img.chat-attached-context-image",{src:y,alt:""}),N=_("div.chat-attached-context-image-container",{},M);if(b.appendChild(N),a){let V=_("a.chat-attached-context-url",{},u===1?d(7312,null):e),H=_("div.chat-attached-context-url-separator");h.add($(V,"click",()=>l())),b.append(H,V)}M.onload=()=>{URL.revokeObjectURL(y)},M.onerror=()=>{let V=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-file-media")),H=_("div.chat-attached-context-pill",{},V),K=t.querySelector(".chat-attached-context-pill");K&&K.replaceWith(H)}}return h}var Roe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.hoverService=u;this.instantiationService=p;let h=d(7286,null,e.name);this.element.ariaLabel=this.appendDeletionHint(h);let g=["file-icon",`${e.language}-lang-file-icon`],f,v;if(e.copiedFrom){f=e.copiedFrom.uri,v=e.copiedFrom.range;let w=Jo(f.path);this.label.setLabel(w,void 0,{extraClasses:g})}else this.label.setLabel(e.fileName,void 0,{extraClasses:g});this.element.appendChild(_("span.attachment-additional-info",{},`Pasted ${e.pastedLines}`)),this.element.style.position="relative";let b=e.copiedFrom?.uri,S=new he(`${b?this.instantiationService.invokeFunction(w=>w.get(nt).getUriLabel(b,{relative:!0})):e.fileName}

---

\`\`\`${e.language}

${e.code}
\`\`\``);this._register(this.hoverService.setupDelayedHover(this.element,{...i1,content:S},Fq));let y=e.copiedFrom?.uri;y&&(this._register(this.instantiationService.invokeFunction(DFe,this.element,y)),this.addResourceOpenHandlers(y,v))}};Roe=I([m(5,fe),m(6,Je),m(7,B),m(8,ot),m(9,F)],Roe);var Loe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(o,s,l,c,r,u,p,h);this.contextKeyService=g;this.instantiationService=f;this.hoverService=v;this.modelService=b;this.languageService=S;this._tooltipHover=this._register(new ue);let y=o.fullName??o.name;if(N2(o)&&o.icon&&(q.isFile(o.icon)||q.isFolder(o.icon))&&o.resourceUri){let w=q.isFolder(o.icon)?1:0,x=Ia(this.modelService,this.languageService,o.resourceUri,w);this.label.setLabel(y,n?.options?.status?.description,{extraClasses:x})}else{let w=o.icon?.id?`$(${o.icon.id})\xA0${y}`:y;this.label.setLabel(w,n?.options?.status?.description)}if(this.element.ariaLabel=this.appendDeletionHint(d(7286,null,o.name)),o.kind==="diagnostic"&&(o.filterUri?(e=o.filterUri?A.revive(o.filterUri):void 0,t=o.filterRange):(this.element.style.cursor="pointer",this._register($(this.element,ne.CLICK,()=>{this.commandService.executeCommand("workbench.panel.markers.view.focus")})))),o.kind==="symbol"&&this._register(this.instantiationService.invokeFunction(zPi,this.element,this.contextKeyService,{...o,kind:o.symbolKind},R.ChatInputSymbolAttachmentContext)),N2(o)&&o.commandId){this.element.style.cursor="pointer";let w=o.handle;this._register($(this.element,ne.CLICK,async()=>{await this.instantiationService.invokeFunction(E=>E.get(SR)).executeChatContextItemCommand(w)}))}o.kind==="debugEvents"&&(this.element.style.cursor="pointer",this._register($(this.element,ne.CLICK,()=>{let w=new Date(o.snapshotTime),x=`before:${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")}T${String(w.getHours()).padStart(2,"0")}:${String(w.getMinutes()).padStart(2,"0")}:${String(w.getSeconds()).padStart(2,"0")}`;this.commandService.executeCommand("workbench.action.chat.openAgentDebugPanelForSession",o.sessionResource,x)}))),(N2(o)||o.kind==="generic")&&o.tooltip&&this._setupTooltipHover(o.tooltip),e&&this.addResourceOpenHandlers(e,t)}_setupTooltipHover(e){this._tooltipHover.value=this.hoverService.setupDelayedHover(this.element,{content:e,appearance:{showPointer:!0}})}};Loe=I([m(8,fe),m(9,Je),m(10,B),m(11,X),m(12,F),m(13,ot),m(14,_t),m(15,Rt)],Loe);var Moe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.labelService=u;this.instantiationService=p;this.hintElement=D(this.element,_("span.prompt-type")),this.updateLabel(e),this.instantiationService.invokeFunction(h=>{this._register(DFe(h,this.element,e.value))}),this.addResourceOpenHandlers(e.value,void 0)}updateLabel(e){let t=e.value,o=Jo(t.path),n=yd(t.path),r=`${o} ${n}`,s=e.id.startsWith("vscode.prompt.file"),l=s?d(7323,null,r):d(7316,null,r),c=s?d(7330,null):d(7328,null),u=this.labelService.getUriLabel(t)+(e.originLabel?`
${e.originLabel}`:"");this.element.classList.remove("warning","error");let p=Xb(t);this.label.setFile(A.file(p),{fileKind:0,hidePath:!0,range:void 0,title:u,icon:q.fromId(L.bookmark.id),extraClasses:[]}),this.hintElement.innerText=c,this.element.ariaLabel=this.appendDeletionHint(l)}};Moe=I([m(5,fe),m(6,Je),m(7,B),m(8,nt),m(9,F)],Moe);var Poe=class extends pk{constructor(i,e,t,o,n,r,s,l,c,u){if(super(i,t,o,n,e,r,s,l),i.settingId){let p=()=>c.openSettings({jsonEditor:!1,query:`@id:${i.settingId}`});this.element.style.cursor="pointer",this._register($(this.element,ne.CLICK,async h=>{Kt.stop(h,!0),p()})),this._register($(this.element,ne.KEY_DOWN,async h=>{let g=new mi(h);(g.equals(3)||g.equals(10))&&(Kt.stop(h,!0),p())}))}this.label.setLabel(d(7329,null),void 0,void 0),this.element.ariaLabel=this.appendDeletionHint(d(7286,null,i.name)),this._register(u.setupDelayedHover(this.element,{...i1,content:i.value},Fq))}};Poe=I([m(5,fe),m(6,Je),m(7,B),m(8,Qo),m(9,ot)],Poe);var Aoe=class extends pk{constructor(i,e,t,o,n,r,s,l,c,u){super(i,t,o,n,e,s,l,c);let p=yt.find(r.getTools(e?.metadata),v=>v.id===i.id)??yt.find(r.getToolSetsForModel(e?.metadata),v=>v.id===i.id),h=i.name,g=i.icon??L.tools;_h(p)?h=p.referenceName:p&&(h=p.toolReferenceName??h),this.label.setLabel(`$(${g.id})\xA0${h}`,void 0),this.element.style.cursor="pointer",this.element.ariaLabel=this.appendDeletionHint(d(7286,null,h));let f;_h(p)?f=d(7333,null,p.description??p.referenceName,p.source.label):p&&(f=d(7332,null,p.userDescription??p.modelDescription,p.source.label)),f&&this._register(u.setupDelayedHover(this.element,{...i1,content:f},Fq))}};Aoe=I([m(5,Wn),m(6,fe),m(7,Je),m(8,B),m(9,ot)],Aoe);var Noe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(t,n,r,s,o,l,c,u);this.hoverService=p;this.languageModelsService=h;this.notebookService=g;this.instantiationService=f;this.chatEntitlementService=v;switch(t.mimeType){case"application/vnd.code.notebook.error":{this.renderErrorOutput(e,t);break}case"image/png":case"image/jpeg":case"image/svg":{this.renderImageOutput(e,t);break}default:this.renderGenericOutput(e,t)}this.instantiationService.invokeFunction(b=>{this._register(DFe(b,this.element,e))}),this.addResourceOpenHandlers(e,void 0)}getAriaLabel(e){return d(7317,null,e.name)}renderErrorOutput(e,t){let o=t.name,n=t.icon?.id?`$(${t.icon.id})\xA0${o}`:o,r=this.getOutputItem(e,t)?.data.buffer??new Uint8Array,s;try{let l=JSON.parse(new TextDecoder().decode(r));l.name&&l.message&&(s=`${l.name}: ${l.message}`)}catch{}this.label.setLabel(n,void 0,{title:s}),this.element.ariaLabel=this.appendDeletionHint(this.getAriaLabel(t))}renderGenericOutput(e,t){this.element.ariaLabel=this.appendDeletionHint(this.getAriaLabel(t)),this.label.setFile(e,{hidePath:!0,icon:q.fromId("output")})}renderImageOutput(e,t){let o;t.omittedState===2?o=d(7320,null,t.name):t.omittedState===1?o=d(7322,null,t.name):o=this.getAriaLabel(t);let n=async()=>await this.openResource(e,{editorOptions:{preserveFocus:!0}},!1,void 0),r=this.currentLanguageModel?this.languageModelsService.lookupLanguageModel(this.currentLanguageModel.identifier)?.name??this.currentLanguageModel.identifier:void 0,s=this.getOutputItem(e,t)?.data.buffer??new Uint8Array;this._register(ACo(e,t.name,t.name,this.element,s,this.hoverService,o,r,n,this.currentLanguageModel,t.omittedState,this.chatEntitlementService.previewFeaturesDisabled)),this.element.ariaLabel=this.appendDeletionHint(o)}getOutputItem(e,t){let o=sn.parseCellOutputUri(e);if(!o||typeof o.cellHandle!="number"||typeof o.outputIndex!="number")return;let n=this.notebookService.getNotebookTextModel(o.notebook);if(!n)return;let r=n.cells.find(l=>l.handle===o.cellHandle);return r?(r.outputs.length>o.outputIndex?r.outputs[o.outputIndex]:void 0)?.outputs.find(l=>l.mime===t.mimeType):void 0}};Noe=I([m(6,fe),m(7,Je),m(8,B),m(9,ot),m(10,Gr),m(11,kn),m(12,F),m(13,dr)],Noe);var Ooe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p){super(e,o,n,r,t,s,l,c);this.editorService=u;this.hoverService=p;let h=d(7297,null,e.name);this.element.ariaLabel=this.appendDeletionHint(h),this.element.style.position="relative",this.element.style.cursor="pointer";let g=e.name,f=e.icon?.id?`$(${e.icon.id})\xA0${g}`:g;this.label.setLabel(f,void 0,{title:d(7296,null,g)}),this._register(this.hoverService.setupDelayedHover(this.element,this.getHoverContent(e),Fq)),this._register($(this.element,ne.CLICK,async()=>{await this.openElementAttachment(e)}))}getHoverContent(e){if(!this.shouldRenderRichElementHover(e))return this.getSimpleHoverContent(e);let t=_("div.chat-attached-context-hover.chat-element-hover"),o=_("div.chat-element-hover-content"),n=[];{let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(7300,null));c.appendChild(u);let p=_("pre.chat-element-hover-code"),h=_("code"),g=this.formatElementTag(e);h.textContent=g,p.appendChild(h);let f=this._register(new Ar(p,{horizontal:1,vertical:2}));n.push(f),c.appendChild(f.getDomNode()),o.appendChild(c)}let r=this.getComputedStyleEntriesForHover(e.computedStyles);if(r.length>0){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(7299,null));c.appendChild(u);let p=_("div.chat-element-hover-table");for(let[g,f]of r){let v=_("div.chat-element-hover-row");v.appendChild(_("span.chat-element-hover-label",{},`${g}:`));let b=_("span.chat-element-hover-value");if((g==="color"||g==="background-color")&&f){let S=_("span.chat-element-hover-color-swatch");S.style.backgroundColor=f,b.appendChild(S)}b.appendChild(document.createTextNode(f)),v.appendChild(b),p.appendChild(v)}c.appendChild(p);let h=_("button.chat-element-hover-show-more",{type:"button"},d(7304,null));this._register($(h,ne.CLICK,async g=>{Kt.stop(g,!0),await this.openElementAttachment(e)})),c.appendChild(h),o.appendChild(c)}if(e.ancestors&&e.ancestors.length>1){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(7301,null));c.appendChild(u);let p=[];for(let v=0;v<e.ancestors.length;v++){let b=e.ancestors[v],S="  ".repeat(v),y=this.formatAncestorTag(b);p.push(`${S}${y}`)}let h=_("pre.chat-element-hover-code"),g=_("code");g.textContent=p.join(`
`),h.appendChild(g);let f=this._register(new Ar(h,{horizontal:1,vertical:2}));n.push(f),c.appendChild(f.getDomNode()),o.appendChild(c)}if(e.attributes&&Object.keys(e.attributes).length>0){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(7298,null));c.appendChild(u);let p=_("div.chat-element-hover-table");for(let[h,g]of Object.entries(e.attributes)){let f=_("div.chat-element-hover-row");f.appendChild(_("span.chat-element-hover-label",{},`${h}:`)),f.appendChild(_("span.chat-element-hover-value",{},g)),p.appendChild(f)}c.appendChild(p),o.appendChild(c)}if(e.dimensions){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(7303,null));c.appendChild(u);let p=_("div.chat-element-hover-table"),h=[["top:",e.dimensions.top],["left:",e.dimensions.left],["width:",e.dimensions.width],["height:",e.dimensions.height]];for(let[g,f]of h){let v=_("div.chat-element-hover-row");v.appendChild(_("span.chat-element-hover-label",{},g)),v.appendChild(_("span.chat-element-hover-value",{},`${Math.round(f)}px`)),p.appendChild(v)}c.appendChild(p),o.appendChild(c)}if(e.innerText){let c=_("div.chat-element-hover-section"),u=_("div.chat-element-hover-header",{},d(7302,null));c.appendChild(u),c.appendChild(_("div.chat-element-hover-text",{},e.innerText)),o.appendChild(c)}let s=this._register(new Ar(o,{vertical:1,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0})),l=s.getDomNode();return l.classList.add("chat-element-hover-scrollable"),t.appendChild(l),{...i1,content:t,additionalClasses:["chat-element-data-hover"],onDidShow:()=>{for(let c of n)c.scanDomNode();s.scanDomNode()}}}shouldRenderRichElementHover(e){return!!(e.dimensions||e.innerText||e.ancestors&&e.ancestors.length>0||e.attributes&&Object.keys(e.attributes).length>0||e.computedStyles&&Object.keys(e.computedStyles).length>0)}getSimpleHoverContent(e){let t=e.value?.toString()??"",o=new he;return o.appendText(e.fullName??e.name),t.trim().length>0&&(o.appendMarkdown(`

`),o.appendCodeblock("text",t)),{...i1,content:o}}getComputedStyleEntriesForHover(e){if(!e)return[];let t=[];for(let o of MCo){if(o==="margin"||o==="padding"){let r=this.getBoxShorthandValue(e,o);if(typeof r=="string"){t.push([o,r]);continue}}let n=e[o];typeof n=="string"&&t.push([o,n])}return t.length>0?t:Object.entries(e).slice(0,MCo.length)}getBoxShorthandValue(e,t){let o=e[`${t}-top`],n=e[`${t}-right`],r=e[`${t}-bottom`],s=e[`${t}-left`];return typeof o=="string"&&typeof n=="string"&&typeof r=="string"&&typeof s=="string"?`${o} ${n} ${r} ${s}`:e[t]}async openElementAttachment(e){let t=e.value?.toString()||"";await this.editorService.openEditor({resource:void 0,contents:t,options:{pinned:!0}})}formatElementTag(e){let t=e.value?.toString()??"",o=t.match(/\n\n(<[^>]+>)/);if(o)return o[1];let n=t.match(/<([^>]+)>/);return n?`<${n[1]}>`:`<${e.name}>`}formatAncestorTag(e){let t=[`<${e.tagName}`];return e.classNames?.length&&t.push(` class="${e.classNames.join(" ")}"`),e.id&&t.push(` id="${e.id}"`),t.join("")+">"}};Ooe=I([m(5,fe),m(6,Je),m(7,B),m(8,ie),m(9,ot)],Ooe);var Foe=class extends pk{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,t,o,n,e,r,c,u),this.label.setLabel(i.name,void 0),this.element.style.cursor="pointer",this.element.ariaLabel=this.appendDeletionHint(d(7286,null,i.name));let{content:h,disposables:g}=sZe(s,i.historyItem,!1);this._store.add(l.setupDelayedHover(this.element,{...i1,content:h},Fq)),this._store.add(g),this._store.add($(this.element,ne.CLICK,f=>{Kt.stop(f,!0),this._openAttachment(i)})),this._store.add($(this.element,ne.KEY_DOWN,f=>{let v=new mi(f);(v.equals(3)||v.equals(10))&&(Kt.stop(f,!0),this._openAttachment(i))}))}async _openAttachment(i){await this.commandService.executeCommand("_workbench.openMultiDiffEditor",{title:UGt(i.historyItem),multiDiffSourceUri:i.value})}};Foe=I([m(5,fe),m(6,_n),m(7,ot),m(8,Je),m(9,B),m(10,Pe)],Foe);var Woe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,o,n,r,t,s,u,p);this.editorService=g;let f=`\xA0$(${L.gitCommit.id})${e.historyItem.displayId??e.historyItem.id}`;this.label.setFile(e.value,{fileKind:0,hidePath:!0,nameSuffix:f}),this.element.ariaLabel=this.appendDeletionHint(d(7286,null,e.name));let{content:v,disposables:b}=sZe(c,e.historyItem,!1);this._store.add(l.setupDelayedHover(this.element,{...i1,content:v},Fq)),this._store.add(b),this.addResourceOpenHandlers(e.value,void 0)}async openResource(e,t,o,n){let s=this.attachment.historyItem;await this.editorService.openEditor({resource:e,label:`${Jo(e.path)} (${s.displayId??s.id})`,options:{...t.editorOptions}},t.openToSide?En:void 0)}};Woe=I([m(5,fe),m(6,ot),m(7,_n),m(8,Je),m(9,B),m(10,Pe),m(11,ie)],Woe);var Voe=class extends pk{constructor(e,t,o,n,r,s,l,c,u){super(e,o,n,r,t,s,l,c);this.editorService=u;let p=e.historyItemChangeStart.historyItem.displayId??e.historyItemChangeStart.historyItem.id,h=e.historyItemChangeEnd.historyItem.displayId??e.historyItemChangeEnd.historyItem.id,g=`\xA0$(${L.gitCommit.id})${p}..${h}`;this.label.setFile(e.value,{fileKind:0,hidePath:!0,nameSuffix:g}),this.element.ariaLabel=this.appendDeletionHint(d(7286,null,e.name)),this.addResourceOpenHandlers(e.value,void 0)}async openResource(e,t,o,n){let r=this.attachment,s=r.historyItemChangeStart,l=r.historyItemChangeEnd,c=`${Jo(s.uri.fsPath)} (${s.historyItem.displayId??s.historyItem.id})`,u=`${Jo(l.uri.fsPath)} (${l.historyItem.displayId??l.historyItem.id})`;await this.editorService.openEditor({original:{resource:s.uri},modified:{resource:l.uri},label:`${c} \u2194 ${u}`,options:{...t.editorOptions}},t.openToSide?En:void 0)}};Voe=I([m(5,fe),m(6,Je),m(7,B),m(8,ie)],Voe);var Boe=class extends pk{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,o,n,r,t,s,l,c);this._attachment=e;this._options=o;this._browserViewService=u;this._hoverService=p;this._editorService=h;this._instantiationService=g;this._inputListeners=this._register(new O);this._resolveInput(),this._register(this._browserViewService.onDidChangeBrowserViews(()=>this._resolveInput())),this._register(this._browserViewService.onDidChangeSharingAvailable(()=>this._updateLabel())),this._register(this._hoverService.setupDelayedHover(this.element,()=>({...i1,content:this._input?{shared:this._input.getTitle()??"",notShared:d(7294,null),unavailable:d(7289,null)}[this._input.model?.sharingState??"shared"]:d(7292,null)}),Fq)),this._instantiationService.invokeFunction(f=>{this._register(DFe(f,this.element,e.value))}),this.addResourceOpenHandlers(e.value,void 0)}_resolveInput(){let e=this._browserViewService.getKnownBrowserViews().get(this._attachment.browserId);this._input!==e&&(this._inputListeners.clear(),this._input=e,e&&(this._inputListeners.add(e.onWillDispose(()=>{this._input=void 0,this._inputListeners.clear(),this._updateLabel()})),this._options.supportsDeletion&&this._inputListeners.add(e.onDidChangeLabel(()=>this._updateLabel())),e.model?this._inputListeners.add(e.model.onDidChangeSharingState(()=>this._updateLabel())):this._inputListeners.add(e.onDidResolveModel(()=>{this._inputListeners.add(e.model.onDidChangeSharingState(()=>this._updateLabel())),this._updateLabel()}))),this._updateLabel())}_updateLabel(){let e=this._input?.getName()??this._attachment.name,t=this._input?.model?.sharingState??"shared",o=!!this._input&&t==="shared";this.element.classList.toggle("warning",!o),this.label.setLabel(e,void 0,{iconPath:L.globe,strikethrough:!o}),this.element.ariaLabel=this.appendDeletionHint(this._input?{shared:d(7291,null,e),notShared:d(7295,null,e),unavailable:d(7290,null,e)}[t]:d(7293,null,e))}async openResource(e,t,o,n){this._input&&await this._editorService.openEditor(this._input,t.editorOptions,t.openToSide?En:void 0)}};Boe=I([m(5,fe),m(6,Je),m(7,B),m(8,Bm),m(9,ot),m(10,ie),m(11,F)],Boe);function DFe(a,i,e){let t=a.get(X),o=a.get(F),n=new O,r=n.add(t.createScoped(i));return NCo(a,r,e),i.draggable=!0,n.add($(i,"dragstart",s=>{o.invokeFunction(l=>kv(l,[e],s)),s.dataTransfer?.setDragImage(i,0,0)})),n.add(ucn(a,i,r,R.ChatInputResourceAttachmentContext,e)),n}function zPi(a,i,e,t,o){let n=a.get(F),r=a.get(Jt),s=a.get(Bt),l=a.get(Xe),c=a.get(Yt),u=new O;i.draggable=!0,u.add($(i,"dragstart",b=>{n.invokeFunction(S=>kv(S,[{resource:t.value.uri,selection:t.value.range}],b)),uxe([{fsPath:t.value.uri.fsPath,range:t.value.range,name:t.name,kind:t.kind}],b),b.dataTransfer?.setDragImage(i,0,0)}));let p,h,g=()=>(p||(p=u.add(e.createScoped(i)),pst.bindTo(p).set(t.value.uri.toString()),NCo(a,p,t.value.uri)),p),f=()=>{let b=g();h||(h=[[me.hasDefinitionProvider.bindTo(b),r.definitionProvider],[me.hasReferenceProvider.bindTo(b),r.referenceProvider],[me.hasImplementationProvider.bindTo(b),r.implementationProvider],[me.hasTypeDefinitionProvider.bindTo(b),r.typeDefinitionProvider]])},v=async()=>{f();let b=await s.createModelReference(t.value.uri);try{let S=b.object.textEditorModel;for(let[y,w]of h)y.set(w.has(S))}finally{b.dispose()}};return u.add($(i,ne.CONTEXT_MENU,async b=>{let S=new Ln(Me(b),b);Kt.stop(b,!0);let y=g();try{await v()}catch(w){console.error(w)}l.showContextMenu({contextKeyService:y,getAnchor:()=>S,getActions:()=>{let w=c.getMenuActions(o,y,{arg:t.value});return Lu(w)}})})),u}function NCo(a,i,e){let t=a.get(ge),o=a.get(Rt),n=a.get(_t);new bZ(i,t,o,n).set(e)}function ucn(a,i,e,t,o,n){let r=a.get(Xe),s=a.get(Yt);return $(i,ne.CONTEXT_MENU,async l=>{let c=new Ln(Me(l),l);Kt.stop(l,!0);try{await n?.()}catch(u){console.error(u)}r.showContextMenu({contextKeyService:e,getAnchor:()=>c,getActions:()=>{let u=s.getMenuActions(t,e,{arg:o});return Lu(u)}})})}var pst=new Y("chatAttachmentResource",void 0,{type:"URI",description:d(7331,null)});var Ffe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.codeEditorService=e;this.editorService=t;this.chatWidgetService=o;this.chatService=n;this.chatEditingService=r;this.configurationService=s;this.ignoredFilesService=l;this.chatContextService=c;this._currentCancelTokenSource=this._register(new ue),this._implicitContextEnablement=this.configurationService.getValue("chat.implicitContext.enabled");let u=this._register(new O);this._register(U.runAndSubscribe(t.onDidActiveEditorChange,(()=>{u.clear();let p=this.findActiveCodeEditor();p&&u.add(U.debounce(U.any(p.onDidChangeModel,p.onDidChangeModelLanguage,p.onDidChangeCursorSelection,p.onDidScrollChange),()=>{},500)(()=>this.updateImplicitContext()));let h=this.findActiveNotebookEditor();if(h){let f=u.add(new O);u.add(h.onDidChangeActiveCell(()=>{f.clear();let v=this.codeEditorService.getActiveCodeEditor();v&&v.getModel()?.uri.scheme===Q.vscodeNotebookCell&&f.add(U.debounce(U.any(v.onDidChangeModel,v.onDidChangeCursorSelection,v.onDidScrollChange),()=>{},500)(()=>this.updateImplicitContext()))})),u.add(U.debounce(U.any(h.onDidChangeModel,h.onDidChangeActiveCell),()=>{},500)(()=>this.updateImplicitContext()))}let g=this.findActiveWebviewEditor();g&&u.add(U.debounce(g.input.webview.onMessage,()=>{},500)(()=>{this.updateImplicitContext()})),this.updateImplicitContext()}))),this._register(ve(p=>{this.chatEditingService.editingSessionsObs.read(p),this.updateImplicitContext()})),this._register(this.configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("chat.implicitContext.enabled")&&(this._implicitContextEnablement=this.configurationService.getValue("chat.implicitContext.enabled"),this.updateImplicitContext())})),this._register(this.chatService.onDidSubmitRequest(({chatSessionResource:p})=>{let h=this.chatWidgetService.getWidgetBySessionResource(p);h?.input.implicitContext&&this._implicitContextEnablement[h.location]==="first"&&h.viewModel?.getItems().length!==0&&h.input.implicitContext.setValues([])})),this._register(this.chatWidgetService.onDidAddWidget(async p=>{await this.updateImplicitContext(p)}))}static{this.ID="chat.implicitContext"}findActiveCodeEditor(){let e=this.codeEditorService.getActiveCodeEditor();if(e){let t=e.getModel();if(t?.uri.scheme===Q.vscodeNotebookCell)return;if(t)return e}for(let t of this.editorService.getVisibleTextEditorControls(0)){let o=da(t);if(!o)continue;if(o.getModel())return o}}findActiveWebviewEditor(){let e=this.editorService.activeEditorPane;if(e?.input instanceof up)return e}findActiveBrowserEditor(){let e=this.editorService.activeEditorPane;if(e?.input instanceof gd)return e.input}findActiveNotebookEditor(){return lr(this.editorService.activeEditorPane)}async updateImplicitContext(e){let t=this._currentCancelTokenSource.value=new qe,o=this.findActiveCodeEditor(),n=o?.getModel(),r=o?.getSelection(),s=this.configurationService.getValue("chat.implicitContext.suggestedContext"),l,c=!1,u,p;if(n){if(u=n.getLanguageId(),r&&!r.isEmpty())l={uri:n.uri,range:r},c=!0;else if(s)l=n.uri;else{let S=o?.getVisibleRanges();if(S&&S.length>0){let y=S[0];S.slice(1).forEach(w=>{y=y.plusRange(w)}),l={uri:n.uri,range:y}}else l=n.uri}p=await this.chatContextService.contextForResource(n.uri,u)}let h=this.findActiveNotebookEditor();if(h?.isReplHistory)l=void 0;else if(h){let S=h.getActiveCell();if(S){let y=this.codeEditorService.getActiveCodeEditor(),w=y?.getSelection(),x=y?.getVisibleRanges()||[];l=S.uri;let E=y?.getModel();if(E&&ze(E.uri,S.uri)){if(w&&!w.isEmpty())l={uri:S.uri,range:w},c=!0;else if(x.length>0&&!pcn(E,x)){let M=x[0];x.slice(1).forEach(N=>{M=M.plusRange(N)}),l={uri:S.uri,range:M}}}}else l=h.textModel?.uri}let g=this.findActiveWebviewEditor();if(g?.input?.resource){let S=await this.chatContextService.contextForResource(g.input.resource);S&&(l=S)}let f=this.findActiveBrowserEditor();f?.isSharingAvailable&&s&&(l=f.resource);let v=l instanceof A?l:hE(l)?void 0:l?.uri;if(v&&(await this.ignoredFilesService.fileIsIgnored(v,t.token)||v.path.endsWith(".copilotmd"))&&(l=void 0),t.token.isCancellationRequested)return;let b=e?[e]:[...this.chatWidgetService.getWidgetsByLocations("panel"),...this.chatWidgetService.getWidgetsByLocations("editor")];for(let S of b){if(!S.input.implicitContext)continue;let y=this._implicitContextEnablement[S.location],w=S.viewModel?.getItems().length===0;if(y==="always"||y==="first"&&w){let x=!!this.editorService.activeEditor;(l!==void 0||!S.input.implicitContext.hasValue||!x)&&S.input.implicitContext.setValues([{value:l,isSelection:c},{value:p,isSelection:!1}])}else S.input.implicitContext.setValues([])}}};Ffe=I([m(0,Qt),m(1,ie),m(2,Lt),m(3,si),m(4,mu),m(5,B),m(6,H_e),m(7,SR)],Ffe);function pcn(a,i){return i.length===1&&i[0].startLineNumber===1&&i[0].startColumn===1&&i[0].endLineNumber===a.getLineCount()&&i[0].endColumn===a.getLineMaxColumn(i[0].endLineNumber)}var KGt=class extends k{constructor(){super(...arguments);this._onDidChangeValue=this._register(new T);this.onDidChangeValue=this._onDidChangeValue.event;this._values=this._register(new Ot);this._valuesDisposables=this._register(new O);this._enabled=!1}setValues(e){if(this._valuesDisposables.clear(),this._values.clearAndDisposeAll(),!e||e.length===0){this._onDidChangeValue.fire();return}let t=e.filter(o=>o.value!==void 0);for(let o of t){let n=new KPi;n.setValue(o.value,o.isSelection),n.enabled=this._enabled;let r=new O;r.add(n.onDidChangeValue(()=>{this._onDidChangeValue.fire()})),r.add(n),this._values.set(n,r)}this._onDidChangeValue.fire()}get values(){return Array.from(this._values.keys())}get hasEnabled(){return Array.from(this._values.keys()).some(e=>e.enabled)}setEnabled(e){this._enabled=e,this.values.forEach(t=>t.enabled=e)}get hasValue(){return this.values.some(e=>e.value!==void 0)}get hasNonUri(){return this.values.some(e=>e.value!==void 0&&!A.isUri(e.value))}getLocations(){return this.values.filter(e=>Bp(e.value)).map(e=>e.value)}getUris(){return this.values.filter(e=>A.isUri(e.value)).map(e=>e.value)}get hasNonStringContext(){return this.values.some(e=>e.value!==void 0&&!hE(e.value))}enabledBaseEntries(e){return this.values.flatMap(t=>t.enabled||e&&Bp(t.value)?t.toBaseEntries():[])}},KPi=class extends k{constructor(){super(...arguments);this.kind="implicit";this.isFile=!0;this._isSelection=!1;this._onDidChangeValue=this._register(new T);this.onDidChangeValue=this._onDidChangeValue.event;this._enabled=!1}get id(){return A.isUri(this.value)?"vscode.implicit.file":hE(this.value)?"vscode.implicit.string":this.value?this._isSelection?"vscode.implicit.selection":"vscode.implicit.viewport":"vscode.implicit"}get name(){if(A.isUri(this.value))return this.value.scheme===Q.vscodeBrowser?"browser":`file:${Be(this.value)}`;if(Bp(this.value))return`file:${Be(this.value.uri)}`;if(hE(this.value)){if(this.value.name===void 0&&this.value.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");return this.value.name??Be(this.value.resourceUri)}return"implicit"}get modelDescription(){if(A.isUri(this.value))return"User's active file";if(hE(this.value)){if(this.value.name===void 0&&this.value.resourceUri===void 0)throw new Error("ChatContextItem must have either a label or a resourceUri");let e=this.value.name??Be(this.value.resourceUri);return this.value.modelDescription??`User's active context from ${e}`}else return this._isSelection?"User's active selection":"User's current visible code"}get isSelection(){return this._isSelection}get value(){return this._value}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._onDidChangeValue.fire()}get uri(){return hE(this.value)?this.value.uri:this._uri}get icon(){if(hE(this.value))return this.value.icon}setValue(e,t){hE(e)?this._value=e:(this._value=e,this._uri=A.isUri(e)?e:e?.uri),this._isSelection=t,this._onDidChangeValue.fire()}toBaseEntries(){return this.value?A.isUri(this.value)&&this.value.scheme===Q.vscodeBrowser?[]:hE(this.value)?[{kind:"string",id:this.id,name:this.name,value:this.value.value??this.name,modelDescription:this.modelDescription,icon:this.value.icon,uri:this.value.uri,resourceUri:this.value.resourceUri,handle:this.value.handle,commandId:this.value.commandId}]:[{kind:"file",id:this.id,name:this.name,value:this.value,modelDescription:this.modelDescription}]:[]}};var RFe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.widgetRef=e;this.isAttachmentAlreadyAttached=t;this.attachment=o;this.resourceLabels=n;this.attachmentModel=r;this.domNode=s;this.contextKeyService=l;this.contextMenuService=c;this.labelService=u;this.menuService=p;this.fileService=h;this.languageService=g;this.modelService=f;this.hoverService=v;this.configService=b;this.chatContextService=S;this.browserViewService=y;this.renderDisposables=this._register(new O);this.renderedCount=0;this.render()}render(){this.renderDisposables.clear(),this.renderedCount=0;for(let e of this.attachment.values){let t=e.uri,o=Bp(e.value)?e.value.range:void 0,n=hE(e.value)?e.value.handle:void 0;this.isAttachmentAlreadyAttached(t,o,n)||(this.renderMainContext(e,e.isSelection),this.renderedCount++)}}get hasRenderedContexts(){return this.renderedCount>0}renderMainContext(e,t){let o=_(".chat-attached-context-attachment.show-file-icons.implicit");this.domNode.appendChild(o),o.tabIndex=0,o.classList.toggle("disabled",!e.enabled);let n=e.uri,r=n?.scheme===Q.vscodeNotebookCell?d(7336,null):d(7345,null),s=e.name??(n?Be(n):d(7346,null));if(this.configService.getValue("chat.implicitContext.suggestedContext")){if(t){let f=d(7349,null),v=this.renderDisposables.add(new Pi(o,{supportIcons:!0,title:f}));v.icon=L.pinned,this.renderDisposables.add(v.onDidClick(async b=>{b.stopPropagation(),b.preventDefault(),await this.pinSelection()}))}else{let f=e.enabled?d(7342,null,r,s):d(7335,null,s),v=this.renderDisposables.add(new Pi(o,{supportIcons:!0,title:f}));v.icon=e.enabled?L.x:L.plus,this.renderDisposables.add(v.onDidClick(async b=>{b.stopPropagation(),b.preventDefault(),e.enabled||await this.convertToRegularAttachment(e),e.enabled=!1}))}!e.enabled&&t&&o.classList.remove("disabled"),this.renderDisposables.add($(o,ne.CLICK,async f=>{!e.enabled&&!t&&await this.convertToRegularAttachment(e)})),this.renderDisposables.add($(o,ne.KEY_DOWN,async f=>{let v=new mi(f);(v.equals(3)||v.equals(10))&&!e.enabled&&!t&&(f.preventDefault(),f.stopPropagation(),await this.convertToRegularAttachment(e))}))}else{let f=e.enabled?d(7341,null,r):d(7343,null,r),v=this.renderDisposables.add(new Pi(o,{supportIcons:!0,title:f}));v.icon=e.enabled?L.eye:L.eyeClosed,this.renderDisposables.add(v.onDidClick(b=>{b.stopPropagation(),e.enabled=!e.enabled}))}let c=this.resourceLabels.create(o,{supportIcons:!0}),u,p;hE(e.value)?(p=e.value.tooltip,u=this.renderString(c,e.name,e.icon,e.value.resourceUri,p,d(7348,null)),o.ariaLabel=d(7340,null,e.name)):u=this.renderResource(e.value,e.isSelection,e.enabled,c,o),(p||u)&&this.renderDisposables.add(this.hoverService.setupDelayedHover(o,{content:p??u,appearance:{showPointer:!0}}));let h=this.renderDisposables.add(this.contextKeyService.createScoped(o));this.renderDisposables.add(new Ho(h,this.fileService,this.languageService,this.modelService)).set(n),this.renderDisposables.add($(o,ne.CONTEXT_MENU,async f=>{let v=new Ln(Me(f),f);Kt.stop(f,!0),this.contextMenuService.showContextMenu({contextKeyService:h,getAnchor:()=>v,getActions:()=>{let b=this.menuService.getMenuActions(R.ChatInputResourceAttachmentContext,h,{arg:n});return Lu(b)}})}))}renderString(e,t,o,n,r,s){let l=r?void 0:s;if(o&&(q.isFile(o)||q.isFolder(o))&&n){let c=q.isFolder(o)?1:0,u=Ia(this.modelService,this.languageService,n,c);e.setLabel(t,void 0,{extraClasses:u,title:l})}else e.setLabel(t,void 0,{iconPath:o,title:l});return l}renderResource(e,t,o,n,r){let s=A.isUri(e)?e:e.uri,l=A.isUri(e)||!t?void 0:e.range;if(s.scheme===Q.vscodeBrowser)return this.renderBrowserResource(s,n,r);let c=s.scheme===Q.vscodeNotebookCell?d(7336,null):d(7345,null),u=Be(s),p=ai(s),h=`${u} ${p}`,g=l?d(7339,null,c,h,l.startLineNumber,l.endLineNumber):d(7338,null,c,h),f=this.labelService.getUriLabel(s,{relative:!0}),v=d(7347,null,c),b=d(7344,null,c),y=`${o||t?v:b}
${f}`;return n.setFile(s,{fileKind:0,hidePath:!0,range:l,title:y}),r.ariaLabel=g,y}renderBrowserResource(e,t,o){let n=cS.getId(e),r=n&&this.browserViewService.getKnownBrowserViews().get(n);if(!r)return;let s=()=>{t.setLabel(r.getName(),void 0,{iconPath:L.globe}),o.ariaLabel=d(7337,null,r.getName())};return s(),this.renderDisposables.add(r.onDidChangeLabel(()=>s())),r.getTitle()}async convertToRegularAttachment(e){if(e.value){if(hE(e.value)){e.value.value===void 0&&await this.chatContextService.resolveChatContext(e.value);let t={kind:"string",value:e.value.value,id:e.id,name:e.name,icon:e.value.icon,modelDescription:e.modelDescription,uri:e.value.uri,resourceUri:e.value.resourceUri,tooltip:e.value.tooltip,commandId:e.value.commandId,handle:e.value.handle};this.attachmentModel.addContext(t)}else{let t=A.isUri(e.value)?e.value:e.value.uri;t.scheme===Q.vscodeNotebookCell&&Bp(e.value)?this.attachmentModel.addFile(t,e.value.range):this.attachmentModel.addFile(t)}this.widgetRef()?.focusInput()}}async pinSelection(){for(let e of this.attachment.values)if(!(!e.value||!e.isSelection)&&!A.isUri(e.value)&&!hE(e.value)){let t=e.value;this.attachmentModel.addFile(t.uri,t.range)}this.widgetRef()?.focusInput()}};RFe=I([m(6,X),m(7,Xe),m(8,nt),m(9,Yt),m(10,ge),m(11,Rt),m(12,_t),m(13,ot),m(14,B),m(15,SR),m(16,Bm)],RFe);var LFe=class extends rV{constructor(e,t,o,n,r,s,l,c,u){let{group:p,item:h}=t,g={...e,label:h?.name||p.name,tooltip:h?.description??p.description??p.name,run:()=>{}},f={actionProvider:{getActions:()=>this.getDropdownActions()},actionBarActionProvider:void 0,reporter:{id:p.id,name:`ChatSession:${p.name}`,includeOptions:!1},getAnchor:()=>this._getAnchorElement()};super(g,f,r,l,s,u);this.delegate=o;this._pickerOptions=n;this.commandService=c;this.currentOption=h,this._register(this.delegate.onDidChangeOption(v=>{this.currentOption=v,this.element&&this.renderLabel(this.element),this.updateEnabled()}))}getDropdownActions(){let e=this.delegate.getCurrentOption();if(e?.locked)return[this.createLockedOptionAction(e)];let t=this.delegate.getOptionGroup();if(!t)return[];let o=t.items.map(n=>{let r=n.id===e?.id;return{id:n.id,enabled:!n.locked,icon:n.icon,checked:r,class:void 0,description:n.description,tooltip:n.description??n.name,label:n.name,run:()=>{this.delegate.setOption(n)}}});if(t.commands?.length){let n=o.length>0;for(let r of t.commands){let s=r.arguments?[...r.arguments]:[],l=this.delegate.getSessionResource();l&&s.unshift(l),o.push({id:r.command,enabled:!0,checked:!1,class:void 0,description:void 0,tooltip:r.tooltip??r.title,label:r.title,category:n?{label:"",order:Number.MAX_SAFE_INTEGER}:void 0,run:()=>{this.commandService.executeCommand(r.command,...s)}})}}return o}createLockedOptionAction(e){return{id:e.id,enabled:!1,icon:e.icon,checked:!0,class:void 0,description:e.description,tooltip:e.description??e.name,label:e.name,run:()=>{}}}_getAnchorElement(){return this.element&&zi().document.contains(this.element)?this.element:this._pickerOptions?.getOverflowAnchor?.()??this.element}renderLabel(e){let t=[];e.classList.add("chat-session-option-picker");let o=this.delegate.getOptionGroup(),n=this.currentOption?.default&&this.currentOption?.icon;return this.currentOption?.icon&&t.push(un(this.currentOption.icon)),n||t.push(_("span.chat-session-option-label",void 0,this.currentOption?.name??o?.description??d(8116,null))),t.push(...ir("$(chevron-down)")),Ii(e,...t),this.setAriaLabelAttributes(e),null}render(e){this.container=e,super.render(e),e.classList.add(this.getContainerClass()),this.currentOption?.locked&&e.classList.add("locked")}getContainerClass(){return"chat-sessionPicker-item"}updateEnabled(){let e=this.action.enabled;this.currentOption?.locked&&(this.action.enabled=!1),super.updateEnabled(),this.action.enabled=e,this.container&&this.container.classList.toggle("locked",!!this.currentOption?.locked)}};LFe=I([m(4,kd),m(5,X),m(6,Le),m(7,fe),m(8,_e)],LFe);var mk="chat.agentHost.enabled",GGt="chat.agentHost.ipcLoggingEnabled",MFe="chat.agentHost.ahpJsonlLoggingEnabled",mst="chat.agentHost.customTerminalTool.enabled",OCo="chat.agentHost.claudeAgent.path";var FCo="chat.agentHost.otel.enabled",WCo="chat.agentHost.otel.exporterType",VCo="chat.agentHost.otel.otlpEndpoint",BCo="chat.agentHost.otel.captureContent",HCo="chat.agentHost.otel.outfile",qGt="chat.agentHost.otel.dbSpanExporter.enabled",UCo="agent-host/otel/agent-host-traces.db",SIp=Object.freeze({Enabled:"COPILOT_OTEL_ENABLED",ExporterType:"COPILOT_OTEL_EXPORTER_TYPE",OtlpEndpoint:"OTEL_EXPORTER_OTLP_ENDPOINT",OtlpEndpointAlt:"COPILOT_OTEL_ENDPOINT",OtlpProtocol:"OTEL_EXPORTER_OTLP_PROTOCOL",OtlpHeaders:"OTEL_EXPORTER_OTLP_HEADERS",CaptureContent:"OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT",FilePath:"COPILOT_OTEL_FILE_EXPORTER_PATH",SourceName:"COPILOT_OTEL_SOURCE_NAME",DbSpanExporterEnabled:"COPILOT_OTEL_DB_SPAN_EXPORTER_ENABLED"});var DP;(t=>{function a(o,n){return A.from({scheme:o,path:`/${n}`})}t.uri=a;function i(o){return(typeof o=="string"?A.parse(o):o).path.substring(1)}t.id=i;function e(o){return(typeof o=="string"?A.parse(o):o).scheme||void 0}t.provider=e})(DP||={});var IIp=le("agentService"),hk=le("agentHostService");var $Gt=new Set(["default","autoApprove","autopilot"]);var c6="agenthost:/root";function QGt(a){if(!a.content||a.content.length===0)return;let i=[];for(let e of a.content)yo(e,{type:!0})&&e.type==="text"&&i.push(e);if(i.length!==0)return i.map(e=>e.text).join(`
`)}function PFe(a){if(!a.content||a.content.length===0)return[];let i=[];for(let e of a.content)yo(e,{type:!0})&&e.type==="fileEdit"&&i.push(e);return i}function Wfe(a){if(!(!a.content||a.content.length===0)){for(let i of a.content)if(yo(i,{type:!0})&&i.type==="subagent")return i}}var bcn="subagent",Scn=`/${bcn}/`;function Icn(a){return typeof a=="string"?A.parse(a):a}function ycn(a){let i=Icn(a),e=i.path.endsWith("/")?i.path.slice(0,-1):i.path;return{parent:i,path:`${e}${Scn}`}}function YPi(a,i){let{parent:e,path:t}=ycn(a);return e.with({path:`${t}${i}`}).toString()}var Vfe=le("agentHostSessionWorkingDirectoryResolver"),XPi=class{constructor(){this._resolvers=new Map}registerResolver(i,e,t){let o={resolve:e,isNewSession:t};return this._resolvers.set(i,o),ee(()=>{this._resolvers.get(i)===o&&this._resolvers.delete(i)})}resolve(i){return this._resolvers.get(i.scheme)?.resolve(i)}isNewSession(i){return this._resolvers.get(i.scheme)?.isNewSession?.(i)??!1}};Ce(Vfe,XPi,1);var d6=le("agentHostUntitledProvisionalSessionService"),hst=class extends k{constructor(e,t,o,n,r){super();this._agentHostService=e;this._logService=t;this._configurationService=n;this._environmentService=r;this._entries=new dt;this._pending=new dt;this._rebound=new xn;this._sequencer=new II;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(o.onDidDisposeSession(s=>{for(let l of s.sessionResources)this._entries.has(l)&&this.disposeSession(l),this._rebound.delete(l)}))}get(e){return this._entries.get(e)?.backendSession}async waitForPending(e){let t=this._pending.get(e);return t&&await t,this.get(e)}getOrCreate(e,t,o){let n=this.get(e);if(n)return Promise.resolve(n);if(this._rebound.has(e))return Promise.resolve(void 0);let r=this._pending.get(e);if(r)return r;let s=this._sequencer.queue(e.toString(),async()=>{let l=this.get(e);if(l)return l;let c=this._toBackendUri(e,t),u=this._getInitialConfig();try{let p=await this._agentHostService.createSession({provider:t,session:c,workingDirectory:o,config:u});return this._entries.set(e,{backendSession:p,config:{...u??{}}}),this._onDidChange.fire(e),p}catch(p){this._logService.warn(`[AgentHostProvisional] Failed to create provisional session for ${e.toString()}: ${p instanceof Error?p.message:String(p)}`);return}});return this._pending.set(e,s),s.finally(()=>{this._pending.get(e)===s&&this._pending.delete(e)}),s}async tryRebind(e,t,o,n){let r=this.get(t);if(r)return r;await this.waitForPending(e);let s=this._entries.get(e);if(!s)return;let l=s.config,c=this._toBackendUri(t,o),u;try{u=await this._agentHostService.createSession({provider:o,session:c,workingDirectory:n,config:l})}catch(p){this._logService.warn(`[AgentHostProvisional] Failed to create rebound provisional: ${p instanceof Error?p.message:String(p)}`);return}return this._entries.set(t,{backendSession:u,config:{...l}}),this._entries.delete(e),this._rebound.add(e),this._onDidChange.fire(t),this._agentHostService.disposeSession(s.backendSession).catch(p=>{this._logService.warn(`[AgentHostProvisional] Failed to dispose temporary provisional ${s.backendSession.toString()}: ${p instanceof Error?p.message:String(p)}`)}),u}async disposeSession(e){await this.waitForPending(e);let t=this._entries.get(e);if(t){this._entries.delete(e),this._onDidChange.fire(e);try{await this._agentHostService.disposeSession(t.backendSession)}catch(o){this._logService.warn(`[AgentHostProvisional] Failed to dispose provisional ${t.backendSession.toString()}: ${o instanceof Error?o.message:String(o)}`)}}}dispose(){for(let[,e]of this._entries)this._agentHostService.disposeSession(e.backendSession).catch(()=>{});this._entries.clear(),this._pending.clear(),this._rebound.clear(),super.dispose()}_toBackendUri(e,t){let o=e.path.replace(/^\//,"");return A.from({scheme:t,path:`/${o}`})}getResolvedConfig(e){return this._entries.get(e)?.resolvedConfig}async applyConfigChange(e,t,o,n){let r=this._entries.get(e);r&&(Object.assign(r.config,n),r.resolvedConfig&&(r.resolvedConfig={...r.resolvedConfig,values:{...r.resolvedConfig.values,...n}}));let s=await this.getOrCreate(e,t,o);if(s){if(!r){let l=this._entries.get(e);l&&Object.assign(l.config,n)}return this._agentHostService.dispatch({type:"session/configChanged",session:s.toString(),config:n}),this._sequencer.queue(e.toString(),async()=>{let l=this._entries.get(e);if(!l)return s;try{let c=await this._agentHostService.resolveSessionConfig({provider:t,workingDirectory:o,config:{...l.config}}),u=this._entries.get(e);if(u===l){let p={...c.values},h={...u.config,...p},g=!Qi(u.config,h),f=!Qi(u.resolvedConfig,c);(g||f)&&(u.config=h,u.resolvedConfig=c,this._onDidChange.fire(e))}}catch(c){this._logService.warn(`[AgentHostProvisional] schema re-resolve failed: ${c instanceof Error?c.message:String(c)}`)}return s})}}_getInitialConfig(){if(this._environmentService.isSessionsWindow)return;let e={isolation:"folder"},t=this._configurationService.getValue("chat.permissions.default"),o=this._configurationService.inspect("chat.tools.global.autoApprove").policyValue;if(typeof t=="string"&&$Gt.has(t)){let n=o===!1;e.autoApprove=n?"default":t}return e}};hst=I([m(0,hk),m(1,re),m(2,si),m(3,B),m(4,Mt)],hst);Ce(d6,hst,1);var Ccn=10,$Co="__agentHostChatInputPicker.learnMore__",xcn="https://code.visualstudio.com/docs/copilot/agents/agent-tools#_permission-levels";function QCo(a,i){if(a==="isolation")return i==="folder"?L.folder:i==="worktree"?L.worktree:void 0;if(a==="branch")return L.gitBranch;if(a==="mode")switch(i){case"plan":return L.checklist;case"autopilot":return L.rocket;case"interactive":return L.comment}if(a==="autoApprove")return i==="autopilot"?L.rocket:i==="autoApprove"?L.warning:L.shield}function jCo(a,i,e){return i.map(t=>({kind:"action",label:t.label,description:t.description,group:{title:"",icon:QCo(a,t.value)},item:{...t,label:t.value===e?`${t.label} ${d(6718,null)}`:t.label}}))}function kcn(a,i,e,t){let o=D(a,i?_("span.action-label"):_("a.action-label"));if(i)o.setAttribute("aria-readonly","true");else{o.role="button",o.tabIndex=0,o.setAttribute("aria-haspopup","listbox"),e.add(ds.addTarget(o));for(let n of[ne.CLICK,Vn.Tap])e.add($(o,n,r=>{Kt.stop(r,!0),t()}));e.add($(o,ne.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&(Kt.stop(n,!0),t())}))}return a.classList.toggle("disabled",i),o}function ZPi(a){let i=a.scheme,e="agent-host-";if(!i.startsWith(e))return;let t=i.substring(e.length);if(!t)return;let o=a.path.replace(/^\//,"");return A.from({scheme:t,path:`/${o}`})}function YCo(a){return a.type!=="string"||!Array.isArray(a.enum)||a.enum.length===0||!a.enum.includes("default")?!1:a.enum.every(i=>$Gt.has(i))}var Ecn=new Set(["mode","autoApprove","permissions","permissionMode"]);function XCo(a,i){return a==="autoApprove"?YCo(i):Ecn.has(a)}var Hoe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._widget=e;this._property=t;this._pickerOptions=o;this._agentHostService=n;this._actionWidgetService=r;this._openerService=s;this._workingDirectoryResolver=l;this._workspaceContextService=c;this._provisional=u;this._renderDisposables=this._register(new O);this._filterDelayer=this._register(new rn(200));this._subRef=this._register(new ue);this._initialResolveCts=this._register(new ue);this._register(this._widget.onDidChangeViewModel(()=>{this._reattach()}));let p=this._pickerOptions;p&&this._register(ve(h=>{p.hideChevrons.read(h),this._renderChip()})),this._register(this._provisional.onDidChange(h=>{let g=this._widget.viewModel?.sessionResource;g&&g.toString()===h.toString()&&this._reattach()})),this._reattach()}render(e){this._container=e,e.classList.add("agent-host-chat-input-picker-host"),e.classList.add(`agent-host-chat-input-picker-host-${this._property}`),this._renderChip()}_reattach(){let e=this._widget.viewModel?.sessionResource,t=e?this._provisional.get(e):void 0,o=t??(e?ZPi(e):void 0);if(!e||!o){this._subRef.clear(),this._initialResolved=void 0,this._cancelInitialResolve(),this._renderChip();return}if(ZD(e)&&!t){this._subRef.clear(),(!this._initialResolved||this._initialResolved.sessionResource.toString()!==e.toString())&&(this._initialResolved=void 0,this._refreshInitialResolved(e,o)),this._provisional.getOrCreate(e,o.scheme,this._readWorkingDirectory()),this._renderChip();return}this._initialResolved=void 0,this._cancelInitialResolve();let n=this._agentHostService.getSubscription(1,o),r=n.object,s=r.onDidChange(()=>this._renderChip());this._subRef.value={sub:r,backendSession:o,dispose:()=>{s.dispose(),n.dispose()}},this._renderChip()}_cancelInitialResolve(){this._initialResolveCts.value?.cancel(),this._initialResolveCts.clear()}async _refreshInitialResolved(e,t){this._initialResolveCts.value?.cancel();let o=new qe;this._initialResolveCts.value=o;try{let n=await this._agentHostService.resolveSessionConfig({provider:t.scheme,workingDirectory:this._readWorkingDirectory()});if(o.token.isCancellationRequested||this._widget.viewModel?.sessionResource?.toString()!==e.toString())return;this._initialResolved={sessionResource:e,result:n},this._renderChip()}catch{}}_renderChip(){if(!this._container)return;this._renderDisposables.clear(),St(this._container);let e=this._readContext(),t=this._widget.viewModel?.sessionResource,o=!!t&&!ZD(t);if(!e||o&&e.schema.sessionMutable===!1){this._container.style.display="none",this._container.classList.add("agent-host-chat-input-picker-host-hidden");return}if(this._property==="autoApprove"&&!YCo(e.schema)){this._container.style.display="none",this._container.classList.add("agent-host-chat-input-picker-host-hidden");return}this._container.style.display="",this._container.classList.remove("agent-host-chat-input-picker-host-hidden");let n=D(this._container,_(".agent-host-chat-input-picker-slot"));this._renderDisposables.add({dispose:()=>n.remove()});let r=!!e.schema.readOnly||o&&e.schema.sessionMutable===!1,s=kcn(n,r,this._renderDisposables,()=>this._showPicker(s));this._renderTrigger(s,e.schema,e.value,r)}_renderTrigger(e,t,o,n){St(e);let r=this._pickerOptions?.hideChevrons.get()??!1,s=QCo(this._property,o);s&&D(e,un(s)),this._property==="autoApprove"&&(e.classList.toggle("warning",o==="autopilot"),e.classList.toggle("info",o==="autoApprove"));let l=this._labelFor(t,o);if(!r){let c=D(e,_("span.agent-host-chat-input-picker-label"));c.textContent=l}e.setAttribute("aria-label",n?d(6717,null,t.title,l):d(6716,null,t.title,l)),!n&&!r&&D(e,un(L.chevronDown))}_labelFor(e,t){if(typeof t=="string"){let o=e.enum?.indexOf(t)??-1;return o>=0?e.enumLabels?.[o]??t:t}return e.title}_readContext(){let e=this._widget.viewModel?.sessionResource;if(e){if(this._subRef.value){let t=this._subRef.value.sub.value;if(!t||t instanceof Error)return;let o=this._provisional.getResolvedConfig(e),r=(o?.schema??t.config?.schema)?.properties[this._property];if(!r)return;let s=o?.values?.[this._property]??t.config?.values?.[this._property]??r.default;return{backendSession:this._subRef.value.backendSession,schema:r,value:s}}if(this._initialResolved&&this._initialResolved.sessionResource.toString()===e.toString()){let t=this._initialResolved.result.schema.properties[this._property];if(!t)return;let o=ZPi(e);if(!o)return;let n=this._initialResolved.result.values?.[this._property]??t.default;return{backendSession:o,schema:t,value:n}}}}async _showPicker(e){if(this._actionWidgetService.isVisible)return;let t=this._readContext();if(!t||t.schema.readOnly)return;let o=await this._getItems(t.schema);if(o.length===0)return;let n=t.value,r=jCo(this._property,o,n);(this._property==="permissionMode"||this._property==="autoApprove")&&r.push({kind:"action",label:d(6715,null),group:{title:"",icon:L.blank},item:{value:$Co,label:d(6715,null)}});let s={onSelect:l=>{if(this._actionWidgetService.hide(),l.value===$Co){this._openerService.open(A.parse(xcn));return}this._setValue(t.backendSession,l.value)},onFilter:t.schema.enumDynamic?l=>this._filterDelayer.trigger(async()=>{let c=this._readContext();return c?jCo(this._property,await this._getItems(c.schema,l),c.value):[]}):void 0,onHide:()=>e.focus()};this._actionWidgetService.show(`agentHostChatInputPicker.${this._property}`,!1,r,s,e,void 0,[],{getAriaLabel:l=>l.label??"",getWidgetAriaLabel:()=>d(6713,null,t.schema.title)},r.length>Ccn||t.schema.enumDynamic?{showFilter:!0,filterPlaceholder:d(6714,null)}:void 0)}async _getItems(e,t){let o=this._widget.viewModel?.sessionResource,n=this._subRef.value?.backendSession??(o?ZPi(o):void 0);if(e.enumDynamic&&n)try{return(await this._agentHostService.sessionConfigCompletions({provider:n.scheme,property:this._property,query:t,workingDirectory:this._readWorkingDirectory(),config:this._readCurrentValues()})).items.map(s=>this._fromCompletion(s))}catch{}return(e.enum??[]).map((r,s)=>({value:r,label:e.enumLabels?.[s]??r,description:e.enumDescriptions?.[s]}))}_fromCompletion(e){return{value:e.value,label:e.label,description:e.description}}_readWorkingDirectory(){let e=this._subRef.value?.sub.value;if(e&&!(e instanceof Error)){let o=e.summary.workingDirectory;return typeof o=="string"?A.parse(o):o}let t=this._widget.viewModel?.sessionResource;return(t&&this._workingDirectoryResolver.resolve(t))??this._workspaceContextService.getWorkspace().folders[0]?.uri}_readCurrentValues(){let e=this._subRef.value?.sub.value;return e&&!(e instanceof Error)?e.config?.values:this._initialResolved?.result.values}async _setValue(e,t){let o=this._widget.viewModel?.sessionResource;if(!o)return;let n={[this._property]:t};if(ZD(o)){let r=e.scheme,s=await this._provisional.applyConfigChange(o,r,this._readWorkingDirectory(),n);if(!s)return;(!this._subRef.value||this._subRef.value.backendSession.toString()!==s.toString())&&this._reattach();return}this._agentHostService.dispatch({type:"session/configChanged",session:e.toString(),config:n})}};Hoe=I([m(3,hk),m(4,kd),m(5,Je),m(6,Vfe),m(7,Ae),m(8,d6)],Hoe);var YGt=class extends Ja{constructor(e,t){super(void 0,e);this._picker=t;this._register(this._picker)}render(e){this._picker.render(e)}};var AFe=class a extends z{static{this.ID="workbench.action.chat.openAgentHostModePicker"}constructor(){super({id:a.ID,title:P(6722,"Agent Mode"),f1:!1,precondition:Z.enabled,menu:[{id:R.ChatInputSecondary,group:"navigation",order:.7,when:Lx.isAgentHostSession}]})}async run(){}},Bfe=class a extends z{static{this.ID="workbench.action.chat.openAgentHostAutoApprovePicker"}constructor(){super({id:a.ID,title:P(6719,"Auto-Approve"),f1:!1,precondition:Z.enabled,menu:[{id:R.ChatInputSecondary,group:"navigation",order:.8,when:Lx.isAgentHostSession}]})}async run(){}},Hfe=class a extends z{static{this.ID="workbench.action.chat.openAgentHostPermissionModePicker"}constructor(){super({id:a.ID,title:P(6723,"Approvals"),f1:!1,precondition:Z.enabled,menu:[{id:R.ChatInputSecondary,group:"navigation",order:.9,when:Lx.isAgentHostSession}]})}async run(){}},Ufe=class a extends z{static{this.ID="workbench.action.chat.openAgentHostBranchPicker"}constructor(){super({id:a.ID,title:P(6720,"Branch"),f1:!1,precondition:Z.enabled,menu:[{id:R.ChatInputSecondary,group:"navigation",order:100,when:C.and(Lx.isAgentHostSession,qo)}]})}async run(){}},zfe=class a extends z{static{this.ID="workbench.action.chat.openAgentHostIsolationPicker"}constructor(){super({id:a.ID,title:P(6721,"Isolation"),f1:!1,precondition:Z.enabled,menu:[{id:R.ChatInputSecondary,group:"navigation",order:101,when:C.and(Lx.isAgentHostSession,qo)}]})}async run(){}};W(AFe);W(Bfe);W(Hfe);W(Ufe);W(zfe);function Tcn(a){let i=a.scheme,e="agent-host-";if(!i.startsWith(e))return;let t=i.substring(e.length);if(!t)return;let o=a.path.replace(/^\//,"");return A.from({scheme:t,path:`/${o}`})}var NFe=class extends k{constructor(e,t,o,n,r,s,l){super();this._widget=e;this._pickerOptions=t;this._instantiationService=o;this._agentHostService=n;this._provisional=r;this._workingDirectoryResolver=s;this._workspaceContextService=l;this._chips=this._register(new Ot);this._subRef=this._register(new ue);this._initialResolveCts=this._register(new ue);this._register(this._widget.onDidChangeViewModel(()=>this._reattach())),this._register(this._provisional.onDidChange(c=>{let u=this._widget.viewModel?.sessionResource;u&&u.toString()===c.toString()&&this._reattach()})),this._reattach()}render(e){this._container=e,this._sync()}_reattach(){let e=this._widget.viewModel?.sessionResource,t=e?this._provisional.get(e):void 0,o=t??(e?Tcn(e):void 0);if(!e||!o){this._subRef.clear(),this._initialResolved=void 0,this._cancelInitialResolve(),this._sync();return}if(ZD(e)&&!t){this._subRef.clear(),(!this._initialResolved||this._initialResolved.sessionResource.toString()!==e.toString())&&(this._initialResolved=void 0,this._refreshInitialResolved(e,o)),this._sync();return}this._initialResolved=void 0,this._cancelInitialResolve();let n=this._agentHostService.getSubscription(1,o),r=n.object,s=r.onDidChange(()=>this._sync());this._subRef.value={sub:r,backendSession:o,dispose:()=>{s.dispose(),n.dispose()}},this._sync()}_cancelInitialResolve(){this._initialResolveCts.value?.cancel(),this._initialResolveCts.clear()}async _refreshInitialResolved(e,t){this._initialResolveCts.value?.cancel();let o=new qe;this._initialResolveCts.value=o;try{let n=await this._agentHostService.resolveSessionConfig({provider:t.scheme,workingDirectory:this._readWorkingDirectory()});if(o.token.isCancellationRequested||this._widget.viewModel?.sessionResource?.toString()!==e.toString())return;this._initialResolved={sessionResource:e,result:n},this._sync()}catch{}}_readWorkingDirectory(){let e=this._subRef.value?.sub.value;if(e&&!(e instanceof Error)){let o=e.summary.workingDirectory;return typeof o=="string"?A.parse(o):o}let t=this._widget.viewModel?.sessionResource;return(t&&this._workingDirectoryResolver.resolve(t))??this._workspaceContextService.getWorkspace().folders[0]?.uri}_readSchemaProperties(){let e=this._widget.viewModel?.sessionResource;if(this._subRef.value){let t=this._subRef.value.sub.value;if(!t||t instanceof Error||!t.config)return;let o=e?this._provisional.getResolvedConfig(e):void 0;return Object.entries((o?.schema??t.config.schema).properties)}if(this._initialResolved&&e&&this._initialResolved.sessionResource.toString()===e.toString())return Object.entries(this._initialResolved.result.schema.properties)}_sync(){if(!this._container)return;let e=this._readSchemaProperties(),t=new Set;if(e)for(let[o,n]of e)XCo(o,n)||t.add(o);for(let o of[...this._chips.keys()])t.has(o)||this._chips.deleteAndDispose(o);for(let o of t){if(this._chips.has(o))continue;let n=this._instantiationService.createInstance(Hoe,this._widget,o,this._pickerOptions),r=D(this._container,_(".agent-host-generic-chip-slot.chat-input-picker-item"));n.render(r),this._chips.set(o,{dispose:()=>{n.dispose(),r.remove()}})}}};NFe=I([m(2,F),m(3,hk),m(4,d6),m(5,Vfe),m(6,Ae)],NFe);var JGt=le("chatPhoneInputPresenter"),eAi=class extends k{constructor(){super(...arguments);this._impl=De(this,void 0);this.enabled=ke(this,e=>{let t=this._impl.read(e);return t?t.enabled.read(e):!1})}showCombinedModeAndModelSheet(e,t,o){let n=this._impl.get();return n?n.showCombinedModeAndModelSheet(e,t,o):Promise.resolve()}setImpl(e){return this._impl.set(e,void 0),ee(()=>{this._impl.get()===e&&this._impl.set(void 0,void 0)})}};Ce(JGt,eAi,1);var OFe=class extends Ja{constructor(e,t,o,n){super(void 0,e);this._modeDelegate=t;this._modelDelegate=o;this._presenter=n;this._renderDisposables=this._register(new O)}render(e){this.element=e,e.classList.add("chat-input-picker-item"),this._renderDisposables.clear();let t=D(e,_("a.action-label.chat-phone-input-chip"));t.tabIndex=0,t.role="button",this._triggerElement=t,this._renderDisposables.add(ds.addTarget(t));for(let o of[ne.CLICK,Vn.Tap])this._renderDisposables.add($(t,o,n=>{Kt.stop(n,!0),this._showSheet()}));this._renderDisposables.add($(t,ne.KEY_DOWN,o=>{(o.key==="Enter"||o.key===" ")&&(Kt.stop(o,!0),this._showSheet())})),this._renderDisposables.add(ve(o=>{let n=this._modeDelegate.currentMode.read(o);n.label.read(o),n.icon.read(o),this._modelDelegate.currentModel.read(o),this._updateTrigger()}))}_updateTrigger(){let e=this._triggerElement;if(!e)return;St(e);let t=this._modeDelegate.currentMode.get(),o=t.icon.get();o&&D(e,un(o));let r=this._modelDelegate.currentModel.get()?.metadata.name??d(9146,null),s=D(e,_("span.chat-input-picker-label"));s.textContent=r,D(e,un(L.chevronDown));let l=[],c=t.label.get();c&&l.push(c),l.push(r),e.ariaLabel=d(9147,null,l.join(", "))}onClick(){}async _showSheet(){let e=this._triggerElement;if(e){e.setAttribute("aria-expanded","true");try{await this._presenter.showCombinedModeAndModelSheet(e,this._modeDelegate,this._modelDelegate)}finally{e.setAttribute("aria-expanded","false"),e.focus()}}}};OFe=I([m(3,JGt)],OFe);var Wq=le("planReviewFeedbackService"),ZGt=class extends k{constructor(){super(...arguments);this._registrations=new Map;this._onDidChangeFeedback=this._register(new T);this.onDidChangeFeedback=this._onDidChangeFeedback.event;this._onDidChangeNavigation=this._register(new T);this.onDidChangeNavigation=this._onDidChangeNavigation.event;this._onDidChangeRegistrations=this._register(new T);this.onDidChangeRegistrations=this._onDidChangeRegistrations.event}registerPlanReview(e,t){let o=e.toString();return this._registrations.set(o,{onSubmit:t,items:[],navigationAnchor:void 0}),this._onDidChangeRegistrations.fire(),ee(()=>{this._registrations.delete(o),this._onDidChangeRegistrations.fire()})}isActivePlanReview(e){return this._registrations.has(e.toString())}addFeedback(e,t,o,n){let r=e.toString(),s=this._registrations.get(r);if(!s)return"";let l=ht();return s.items.push({id:l,line:t,column:o,text:n}),s.items.sort((c,u)=>c.line-u.line||c.column-u.column),this._onDidChangeFeedback.fire(e),l}removeFeedback(e,t){let o=e.toString(),n=this._registrations.get(o);if(!n)return;let r=n.items.findIndex(s=>s.id===t);r>=0&&(n.items.splice(r,1),this._onDidChangeFeedback.fire(e))}updateFeedback(e,t,o){let n=e.toString(),r=this._registrations.get(n);if(!r)return;let s=r.items.findIndex(l=>l.id===t);if(s>=0){let l=r.items[s];r.items[s]={id:l.id,line:l.line,column:l.column,text:o},this._onDidChangeFeedback.fire(e)}}getFeedback(e){let t=e.toString();return this._registrations.get(t)?.items??[]}clearFeedback(e){let t=e.toString(),o=this._registrations.get(t);!o||o.items.length===0||(o.items.length=0,o.navigationAnchor=void 0,this._onDidChangeFeedback.fire(e))}getNextFeedback(e,t){let o=e.toString(),n=this._registrations.get(o);if(!n||n.items.length===0)return;let r=n.items,s=n.navigationAnchor?r.findIndex(u=>u.id===n.navigationAnchor):-1,l;s===-1?l=t?0:r.length-1:l=t?(s+1)%r.length:(s-1+r.length)%r.length;let c=r[l];return this.setNavigationAnchor(e,c.id),c}getNavigationBearing(e){let t=e.toString(),o=this._registrations.get(t);if(!o)return{activeIdx:-1,totalCount:0};let n=o.items.length;return o.navigationAnchor?{activeIdx:o.items.findIndex(s=>s.id===o.navigationAnchor),totalCount:n}:{activeIdx:-1,totalCount:n}}setNavigationAnchor(e,t){let o=e.toString(),n=this._registrations.get(o);n&&(n.navigationAnchor=t,this._onDidChangeNavigation.fire(e))}submitAllFeedback(e){let t=e.toString(),o=this._registrations.get(t);if(!o||o.items.length===0)return;let n=this._formatFeedback(o.items);o.onSubmit({rejected:!1,feedback:n})}_formatFeedback(e){let t=["Here's the feedback:"];for(let o of e)o.column>1?t.push(`Line ${o.line}: Column ${o.column}: ${o.text}`):t.push(`Line ${o.line}: ${o.text}`);return t.join(`
`)}};var _cn="/chat-plan-review",Uoe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.review=e;this._options=o;this._markdownRendererService=n;this._contextMenuService=r;this._dialogService=s;this._editorService=l;this._hoverService=c;this._planReviewFeedbackService=u;this._instantiationService=p;this._textFileService=h;this._modelService=g;this._textModelService=f;this._languageService=v;this._configurationService=b;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this._buttonStore=this._register(new O);this._renderedSubmitInlineCount=-1;this._messageContentDisposables=this._register(new ue);this._isCollapsed=!1;this._isExpanded=!1;this._isSubmitted=!1;this._isFeedbackMode=!1;this._planReviewRegistration=this._register(new ue);this._commentRowDisposables=this._register(new O);this._inlineEditorMountId=0;this._suppressFeedbackModeAutoOpen=!1;this._messageEditorDisposables=this._register(new O);this._selectedAction=e.actions.find(M=>M.default)??e.actions[0],e instanceof f_&&typeof e.draftCollapsed=="boolean"&&(this._isCollapsed=e.draftCollapsed);let S=Ni(t.element)&&t.element.isComplete;if(this._isSubmitted=!!e.isUsed||S,e.planUri&&e.canProvideFeedback&&!this._isSubmitted){let M=A.revive(e.planUri),N=M.toString(),V=new O;V.add(this._planReviewFeedbackService.registerPlanReview(M,H=>{this._isSubmitted||(this._isSubmitted=!0,this._options.onSubmit(H),this.markUsed())})),V.add(this._planReviewFeedbackService.onDidChangeFeedback(H=>{let K=H.toString();(K===N||K===this._editingUri?.toString())&&this.onInlineFeedbackChanged()})),this._planReviewRegistration.value=V}let y=st(".chat-confirmation-widget-container.chat-plan-review-container@container",[st(".chat-confirmation-widget2.chat-plan-review@root",[st(".chat-confirmation-widget-title.chat-plan-review-title@title",[st(".chat-plan-review-title-label@titleLabel"),st(".chat-plan-review-inline-actions@inlineActions"),st(".chat-plan-review-title-actions@titleActions")]),st(".chat-confirmation-widget-message.chat-plan-review-body@message"),st(".chat-plan-review-feedback@feedback"),st(".chat-confirmation-widget-buttons.chat-plan-review-footer",[st(".chat-buttons@footerButtons")])])]);if(this.domNode=y.container,this.domNode.id=ht(),this.domNode.setAttribute("role","region"),this.domNode.setAttribute("aria-label",d(8744,null,e.title)),this._titleActionsEl=y.titleActions,this._inlineActionsEl=y.inlineActions,this._footerButtonsEl=y.footerButtons,this._messageEl=y.message,y.titleLabel.textContent=e.title,this._register(this._hoverService.setupDelayedHover(y.titleLabel,{content:e.title})),e.planUri){let M=Be(A.revive(e.planUri)),N=e.canProvideFeedback?d(8773,null,M):d(8768,null,M),V=this._register(new Pi(this._titleActionsEl,{...Ro,secondary:!0,supportIcons:!0,title:N,ariaLabel:N}));V.element.classList.add("chat-plan-review-title-button","chat-plan-review-review-button"),this._reviewButton=V,this._register(V.onDidClick(()=>{this._isFeedbackMode?this.exitFeedbackMode():this.enterReviewMode()}))}this._restoreButton=this._register(new Pi(this._titleActionsEl,{...Ro,secondary:!0,supportIcons:!0})),this._restoreButton.element.classList.add("chat-plan-review-title-button","chat-plan-review-title-icon-button"),this._register(this._restoreButton.onDidClick(()=>this.toggleExpanded())),this._collapseButton=this._register(new Pi(this._titleActionsEl,{...Ro,secondary:!0,supportIcons:!0})),this._collapseButton.element.classList.add("chat-plan-review-title-button","chat-plan-review-title-icon-button"),this._register(this._collapseButton.onDidClick(()=>this.toggleCollapsed()));let w=this._messageEl.parentElement,x=this._messageEl.nextSibling;this._messageScrollable=this._register(new Ar(this._messageEl,{vertical:1,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0})),this._messageScrollable.getDomNode().classList.add("chat-confirmation-widget-message-scrollable","chat-plan-review-body-scrollable"),w.insertBefore(this._messageScrollable.getDomNode(),x);let E=this._register(new zu("ChatPlanReviewPart.messageScrollable",()=>this._messageScrollable.scanDomNode()));this._register(E.observe(this._messageScrollable.getDomNode())),this.renderMarkdown(),e.canProvideFeedback?(this.renderFeedback(y.feedback),this._feedbackSection=y.feedback,e.planUri?Wi(y.feedback):this.domNode.classList.add("chat-plan-review-textarea-mode")):Wi(y.feedback),this.renderActionButtons(this._isCollapsed?this._inlineActionsEl:this._footerButtonsEl,{includeReject:!this._isCollapsed}),this.updateCollapsedPresentation(),this.updateExpandedPresentation(),this._isSubmitted&&this.domNode.classList.add("chat-plan-review-used"),this._feedbackTextarea&&e instanceof f_&&e.draftFeedback&&(this._feedbackTextarea.value=e.draftFeedback,this._feedbackTextarea.style.height="auto",this._feedbackTextarea.style.height=`${this._feedbackTextarea.scrollHeight}px`),!this._isSubmitted&&this.getInlineFeedbackItems().length>0&&this.enterFeedbackMode({focus:!1})}hasSameContent(e,t,o){return e.kind!=="planReview"||!!e.isUsed!=!!this.review.isUsed?!1:this.review.resolveId&&e.resolveId?this.review.resolveId===e.resolveId:e===this.review}renderMarkdown(){St(this._messageEl);let e=new O;this._messageContentDisposables.value=e;let t=e.add(this._markdownRendererService.render(new he(this.review.content,{supportThemeIcons:!0,isTrusted:!1}),{asyncRenderCallback:()=>this._messageScrollable.scanDomNode()}));this._messageEl.append(t.element),this._messageScrollable.scanDomNode()}renderFeedback(e){St(e);let t=D(e,_(".chat-plan-review-feedback-header")),o=D(t,_(".chat-plan-review-feedback-label"));o.textContent=d(8761,null);let n=D(t,_(".chat-plan-review-feedback-header-actions"));if(this.review.planUri){let l=d(8751,null),c=this._register(new Pi(n,{...Ro,secondary:!0,supportIcons:!0,title:l,ariaLabel:l}));c.element.classList.add("chat-plan-review-title-button","chat-plan-review-feedback-clear-all"),c.label=l,this._register(c.onDidClick(()=>this.clearAllInlineFeedback())),this._clearAllButtonEl=c.element}if(this.review.planUri){let l=d(8755,null),c=this._register(new Pi(n,{...Ro,secondary:!0,supportIcons:!0,title:l,ariaLabel:l}));c.element.classList.add("chat-plan-review-title-button","chat-plan-review-title-icon-button","chat-plan-review-feedback-close"),c.label=`$(${L.close.id})`,this._register(c.onDidClick(()=>this.exitFeedbackMode()))}this._commentsListEl=_(".chat-plan-review-comments-list"),this._commentsListScrollable=this._register(new Ar(this._commentsListEl,{vertical:1,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0})),this._commentsListScrollable.getDomNode().classList.add("chat-plan-review-comments-list-scrollable"),D(e,this._commentsListScrollable.getDomNode()),Wi(this._commentsListScrollable.getDomNode()),this.renderCommentsList();let r=D(e,_("textarea.chat-plan-review-feedback-textarea"));r.rows=1,r.placeholder=d(8762,null),this._feedbackTextarea=r;let s=()=>{r.style.height="auto",r.style.height=`${r.scrollHeight}px`,this._onDidChangeHeight.fire()};this._register($(r,ne.INPUT,()=>{s(),this._messageScrollable.scanDomNode(),this.review instanceof f_&&(this.review.draftFeedback=r.value),this.updateSubmitButtonState()})),this.review.planUri&&this._register($(r,ne.KEY_DOWN,l=>{let c=new mi(l);c.keyCode===3&&!c.shiftKey&&(l.preventDefault(),l.stopPropagation(),this.submitFeedback())}))}renderCommentsList(){if(!this._commentsListEl)return;this._commentRowDisposables.clear(),St(this._commentsListEl);let e=this.getInlineFeedbackItems();this._clearAllButtonEl&&(e.length>0?Xo(this._clearAllButtonEl):Wi(this._clearAllButtonEl));let t=this._commentsListScrollable?.getDomNode();if(e.length===0){t&&Wi(t),this._commentsListScrollable?.scanDomNode();return}t&&Xo(t);for(let o of e){let n=D(this._commentsListEl,_(".chat-plan-review-comment-row")),r=d(8757,null,o.line,o.text),s=D(n,_("button.chat-plan-review-comment-reveal"));s.type="button",s.setAttribute("aria-label",r);let l=D(s,_("span.chat-plan-review-comment-line"));l.textContent=d(8758,null,o.line);let c=D(s,_("span.chat-plan-review-comment-text"));c.textContent=o.text,this._commentRowDisposables.add($(s,ne.CLICK,()=>{this.revealInlineComment(o.id,o.line,o.column)}));let u=d(8770,null,o.line),p=D(n,_("button.chat-plan-review-comment-remove"));p.type="button",p.setAttribute("aria-label",u),p.title=u,p.classList.add(...q.asClassNameArray(L.close)),this._commentRowDisposables.add($(p,ne.CLICK,h=>{h.stopPropagation(),this.removeInlineComment(o.id)}))}this._commentsListScrollable?.scanDomNode()}getCommentUri(){return this._editingUri?this._editingUri:this.review.planUri?A.revive(this.review.planUri):void 0}getInlineFeedbackItems(){let e=this._editingUri?this._planReviewFeedbackService.getFeedback(this._editingUri):[],t=this.review.planUri?this._planReviewFeedbackService.getFeedback(A.revive(this.review.planUri)):[];return[...e,...t].sort((o,n)=>o.line-n.line||o.column-n.column)}async revealInlineComment(e,t,o){let n=this.getCommentUri();if(n){if(this._planReviewFeedbackService.setNavigationAnchor(n,e),this._messageEditor){this._messageEditor.revealLineInCenterIfOutsideViewport(t),this._messageEditor.setPosition({lineNumber:t,column:o}),this._messageEditor.focus();return}this.review.planUri&&await this._editorService.openEditor({resource:A.revive(this.review.planUri),options:{selection:{startLineNumber:t,startColumn:o}}})}}removeInlineComment(e){if(!this._isSubmitted)for(let t of this.getFeedbackUris())this._planReviewFeedbackService.removeFeedback(t,e)}async clearAllInlineFeedback(){if(this._isSubmitted)return;let e=this.getInlineFeedbackItems();if(!(e.length===0||!(await this._dialogService.confirm({type:wt.Warning,message:d(8752,null,e.length),detail:d(8754,null),primaryButton:d(8753,null)})).confirmed))for(let o of this.getFeedbackUris())this._planReviewFeedbackService.clearFeedback(o)}getFeedbackUris(){let e=[];return this._editingUri&&e.push(this._editingUri),this.review.planUri&&e.push(A.revive(this.review.planUri)),e}onInlineFeedbackChanged(){if(this._isSubmitted)return;if(this.getInlineFeedbackItems().length>0&&!this._suppressFeedbackModeAutoOpen&&!this._isFeedbackMode&&!this._isCollapsed){this.enterFeedbackMode({focus:!1});return}this.renderCommentsList(),this._isFeedbackMode&&this.updateSubmitButtonState(),this._messageScrollable.scanDomNode(),this._onDidChangeHeight.fire()}renderCurrentActionButtons(){if(this._isSubmitted)return;let e=this._isCollapsed?this._inlineActionsEl:this._footerButtonsEl,t=this._isCollapsed?this._footerButtonsEl:this._inlineActionsEl;St(t),this.renderActionButtons(e,{includeReject:!this._isCollapsed})}renderActionButtons(e,t){let o=t?.includeReject??!0;if(this._buttonStore.clear(),this._submitButton=void 0,this._renderedSubmitInlineCount=-1,St(e),this._isFeedbackMode){let l=this.getInlineFeedbackItems().length,c=new Pi(e,{...Ro,supportIcons:!0});if(c.label=this.computeSubmitLabel(l),c.enabled=this.canSubmitFeedback(),this._submitButton=c,this._renderedSubmitInlineCount=l,this._buttonStore.add(c),this._buttonStore.add(c.onDidClick(()=>{this.submitFeedback()})),o){let u=new Pi(e,{...Ro,secondary:!0});u.label=d(8769,null),this._buttonStore.add(u),this._buttonStore.add(u.onDidClick(()=>this.submitRejection()))}return}let n=this._selectedAction,r=this.review.actions.filter(l=>l!==n),s;if(r.length>0?s=new Jv(e,{...Ro,supportIcons:!0,contextMenuProvider:this._contextMenuService,addPrimaryActionToDropdown:!1,actions:r.map(l=>{let c=new it(l.label,l.label,void 0,!0,()=>(this.submitApproval(l),Promise.resolve()));return c.tooltip=l.description||"",this._buttonStore.add(c)})}):s=new Pi(e,{...Ro,supportIcons:!0}),this._buttonStore.add(s),s.label=n.label,n.description&&(s.element.title=n.description),this._buttonStore.add(s.onDidClick(()=>this.submitApproval(n))),o){let l=new Pi(e,{...Ro,secondary:!0});l.label=d(8769,null),this._buttonStore.add(l),this._buttonStore.add(l.onDidClick(()=>this.submitRejection()))}}canSubmitFeedback(){return this._feedbackTextarea?.value.trim()??""?!0:this.getInlineFeedbackItems().length>0}computeSubmitLabel(e){return e>0?d(8775,null,e):d(8774,null)}updateSubmitButtonState(){if(!this._submitButton||!this._isFeedbackMode)return;this._submitButton.enabled=this.canSubmitFeedback();let e=this.getInlineFeedbackItems().length;e!==this._renderedSubmitInlineCount&&(this._submitButton.label=this.computeSubmitLabel(e),this._renderedSubmitInlineCount=e)}toggleCollapsed(){this._isCollapsed=!this._isCollapsed,this._isCollapsed&&(this._isExpanded=!1),this.review instanceof f_&&(this.review.draftCollapsed=this._isCollapsed),this.updateCollapsedPresentation(),this.updateExpandedPresentation(),this._onDidChangeHeight.fire()}toggleExpanded(){this._isCollapsed&&(this._isCollapsed=!1,this.updateCollapsedPresentation()),this._isExpanded=!this._isExpanded,this.updateExpandedPresentation(),this._onDidChangeHeight.fire()}updateCollapsedPresentation(){this.domNode.classList.toggle("chat-plan-review-collapsed",this._isCollapsed),this._restoreButton.element.classList.toggle("chat-plan-review-hidden",this._isCollapsed),this._collapseButton.label=this._isCollapsed?`$(${L.chevronUp.id})`:`$(${L.chevronDown.id})`;let e=this._isCollapsed?d(8759,null):d(8756,null);if(this._collapseButton.element.setAttribute("aria-label",e),this._collapseButton.element.setAttribute("aria-expanded",String(!this._isCollapsed)),this._collapseButton.setTitle(e),this._reviewButton){let t=this._isCollapsed;this._reviewButton.element.classList.toggle("chat-plan-review-title-icon-button",t);let o,n;if(t){o=`$(${L.edit.id})`;let r=this.review.planUri?Be(A.revive(this.review.planUri)):"";n=this.review.canProvideFeedback?d(8773,null,r):d(8768,null,r)}else if(this._isFeedbackMode)o=d(8749,null),n=d(8750,null);else{let r=this.review.planUri?Be(A.revive(this.review.planUri)):"";this.review.canProvideFeedback?(o=d(8772,null),n=d(8773,null,r)):(o=d(8767,null),n=d(8768,null,r))}this._reviewButton.label=o,this._reviewButton.element.setAttribute("aria-label",n),this._reviewButton.setTitle(n)}this.renderCurrentActionButtons()}updateExpandedPresentation(){this.domNode.classList.toggle("chat-plan-review-expanded",this._isExpanded&&!this._isCollapsed),this._restoreButton.label=this._isExpanded?`$(${L.screenNormal.id})`:`$(${L.screenFull.id})`;let e=this._isExpanded?d(8771,null):d(8760,null);this._restoreButton.element.setAttribute("aria-label",e),this._restoreButton.setTitle(e),this._messageScrollable.scanDomNode(),this._onDidChangeHeight.fire()}async enterReviewMode(){if(!this.review.canProvideFeedback||this._isSubmitted){this.review.planUri&&await this._editorService.openEditor({resource:A.revive(this.review.planUri)});return}this._isCollapsed&&(this._isCollapsed=!1,this.review instanceof f_&&(this.review.draftCollapsed=!1),this.updateCollapsedPresentation(),this.updateExpandedPresentation()),await this.enterFeedbackMode({focus:!0})}async submitApproval(e){if(this._isSubmitted||e.permissionLevel==="autopilot"&&!await this.confirmAutopilot())return;this._isSubmitted=!0;let o=!this.review.planUri?this._feedbackTextarea?.value.trim():void 0;this._options.onSubmit({action:e.label,...e.id?{actionId:e.id}:{},rejected:!1,...o?{feedback:o,feedbackOverall:o}:{}}),this.markUsed()}submitRejection(){if(this._isSubmitted)return;this._isSubmitted=!0;let t=!this.review.planUri?this._feedbackTextarea?.value.trim():void 0;this._options.onSubmit({rejected:!0,...t?{feedback:t,feedbackOverall:t}:{}}),this.markUsed()}async enterFeedbackMode(e){if(this._isFeedbackMode){e?.focus&&this.focusFeedbackInput();return}this._isFeedbackMode=!0,this._feedbackSection&&Xo(this._feedbackSection),this.domNode.classList.add("chat-plan-review-feedback-mode"),this.renderCommentsList(),this.updateCollapsedPresentation();let t=++this._inlineEditorMountId;this.isInlineEditorEnabled()?await this.mountInlineEditor(t):this.review.planUri&&await this._editorService.openEditor({resource:A.revive(this.review.planUri)}),e?.focus!==!1&&this.focusFeedbackInput(),this._messageScrollable.scanDomNode(),this._onDidChangeHeight.fire()}async exitFeedbackMode(){this._isFeedbackMode&&(this._isFeedbackMode=!1,this._feedbackSection&&Wi(this._feedbackSection),this.domNode.classList.remove("chat-plan-review-feedback-mode"),await this.unmountInlineEditor(),this.renderMarkdown(),this.updateCollapsedPresentation(),this._messageScrollable.scanDomNode(),this._onDidChangeHeight.fire())}focusFeedbackInput(){this._messageEditor?this._messageEditor.focus():this._feedbackTextarea?.focus()}async mountInlineEditor(e){if(!this.canContinueInlineEditorMount(e)||!this.review.planUri)return;let t=A.revive(this.review.planUri),o;try{o=(await this._textFileService.read(t)).value}catch{return}if(!this.canContinueInlineEditorMount(e))return;let n=A.from({scheme:Q.inMemory,path:`${_cn}/${ht()}/${Be(t)}`}),r=this._languageService.createByFilepathOrFirstLine(t),s=this._modelService.createModel(o,r,n),l;try{l=await this._textModelService.createModelReference(n)}catch{}if(!this.canContinueInlineEditorMount(e)){l?.dispose(),s.dispose();return}this._messageEditorDisposables.clear(),this._messageContentDisposables.clear(),St(this._messageEl),this._messageEl.classList.add("chat-plan-review-body-editor");let c={wordWrap:"on",lineNumbers:"on",lineNumbersMinChars:2,glyphMargin:!0,folding:!1,minimap:{enabled:!1},scrollBeyondLastLine:!1,overviewRulerLanes:0,overviewRulerBorder:!1,hideCursorInOverviewRuler:!0,lineDecorationsWidth:6,renderLineHighlight:"none",lightbulb:{enabled:"off"},padding:{top:0,bottom:0},automaticLayout:!0,scrollbar:{vertical:"auto",horizontal:"auto",alwaysConsumeMouseWheel:!1}},u;try{u=this._instantiationService.createInstance(us,this._messageEl,c,{isSimpleWidget:!1})}catch{l?.dispose(),s.dispose(),this._messageEl.classList.remove("chat-plan-review-body-editor"),St(this._messageEl),this.renderMarkdown();return}this._messageEditorDisposables.add(ee(()=>u.setModel(null))),this._messageEditorDisposables.add(u),this._messageEditorDisposables.add(s),l&&this._messageEditorDisposables.add(l),this._editingUri=n,this._initialEditorContent=o;let p=this._planReviewFeedbackService.registerPlanReview(n,()=>{this.submitFeedback()});this._messageEditorDisposables.add(p),this._messageEditorDisposables.add(ee(()=>{this._editingUri=void 0}));try{u.setModel(s)}catch{this._messageEditorDisposables.clear(),this._messageEl.classList.remove("chat-plan-review-body-editor"),St(this._messageEl),this.renderMarkdown();return}this._messageEditor=u;let h=this._planReviewFeedbackService.getFeedback(t);if(h.length>0){for(let g of h)this._planReviewFeedbackService.addFeedback(n,g.line,g.column,g.text);this._planReviewFeedbackService.clearFeedback(t)}this._messageScrollable.scanDomNode(),this._onDidChangeHeight.fire(),u.focus()}canContinueInlineEditorMount(e){return this._inlineEditorMountId===e&&!this._messageEditor&&this._isFeedbackMode&&!this._isSubmitted&&!this._messageEditorDisposables.isDisposed}isInlineEditorEnabled(){return this._configurationService.getValue("chat.planReview.inlineEditor.enabled")!==!1}migrateInlineFeedbackToPlan(e,t){let o=[...this._planReviewFeedbackService.getFeedback(e)];if(o.length!==0){this._suppressFeedbackModeAutoOpen=!0;try{for(let n of o)this._planReviewFeedbackService.addFeedback(t,n.line,n.column,n.text);this._planReviewFeedbackService.clearFeedback(e)}finally{this._suppressFeedbackModeAutoOpen=!1}}}async unmountInlineEditor(e){if(this._inlineEditorMountId++,!this._messageEditor)return;let t=this._messageEditor,o=this._editingUri,n=o?this._modelService.getModel(o):void 0,r=this.review.planUri?A.revive(this.review.planUri):void 0,s=this._initialEditorContent,l=n&&!n.isDisposed()?n.getValue():void 0;o&&r&&this.migrateInlineFeedbackToPlan(o,r),this._messageEditor=void 0,this._initialEditorContent=void 0;try{t.setModel(null)}finally{this._messageEditorDisposables.clear(),this._messageEl.classList.remove("chat-plan-review-body-editor"),St(this._messageEl)}if(e?.writeBack&&l!==void 0&&r&&l!==s){this.review instanceof f_&&(this.review.content=l);try{await this._textFileService.write(r,l)}catch{}}}async submitFeedback(){if(this._isSubmitted)return;let e=this._feedbackTextarea?.value.trim(),t=[...this.getInlineFeedbackItems()];if(!e&&t.length===0)return;this._isSubmitted=!0,await this.unmountInlineEditor({writeBack:!0});let o;if(t.length>0){let s=this.review.planUri?A.revive(this.review.planUri):void 0,l=s?Be(s):"",c=l?d(8765,null,l):d(8766,null),u=t.map(p=>`- **${p.column>1?d(8763,null,p.line,p.column):d(8764,null,p.line)}:** ${p.text}`);o=[c,...u].join(`
`)}let n=[];e&&n.push(e),o&&n.push(o);let r=n.join(`

`);this._options.onSubmit({rejected:!1,feedback:r,feedbackOverall:e||void 0,feedbackInlineMarkdown:o}),await this.markUsed()}async confirmAutopilot(){return(await this._dialogService.prompt({type:wt.Warning,message:d(8748,null),buttons:[{label:d(8746,null),run:()=>!0},{label:d(8745,null),run:()=>!1}],custom:{icon:L.rocket,markdownDetails:[{markdown:new he(d(8747,null))}]}})).result===!0}async markUsed(){this.domNode.classList.add("chat-plan-review-used"),this._buttonStore.clear(),this._submitButton=void 0,this._renderedSubmitInlineCount=-1,this._planReviewRegistration.clear(),this._messageEditor&&(await this.unmountInlineEditor({writeBack:!1}),this.renderMarkdown()),this._feedbackTextarea&&(this._feedbackTextarea.disabled=!0)}};Uoe=I([m(3,_n),m(4,Xe),m(5,ct),m(6,ie),m(7,ot),m(8,Wq),m(9,F),m(10,Uo),m(11,_t),m(12,Bt),m(13,Rt),m(14,B)],Uoe);var JCo=/^[\w\/\.-]+$/;function eqt(a,i){switch(i){case"'":return`'${a}'`;case'"':return`"${a}"`}return JCo.test(a)?a:`'${a}'`}function ZCo(a,i){let e=a.items.find(o=>o.type==="scalar"&&JCo.test(o.value)),t=e?i.getValueInRange(e.range).charAt(0):void 0;return t==="'"||t==='"'?t:""}var Vq=class{constructor(i,e,t){this._codeEditorService=i;this._promptsService=e;this._languageModelToolsService=t}async openAndRewriteTools(i,e,t){let o=await this._codeEditorService.openCodeEditor({resource:i},this._codeEditorService.getFocusedCodeEditor());if(!o||!o.hasModel())return;let n=o.getModel(),r=this._promptsService.getParsedPromptFile(n);if(!r.header)return;let s=r.header.getAttribute(no.tools);if(s)if(o.setSelection(s.range),e===void 0){this.rewriteAttribute(n,"",s.range);return}else this.rewriteTools(n,e,s.value.range,s.value.type==="scalar")}rewriteTools(i,e,t,o){let r=this._languageModelToolsService.toFullReferenceNames(e).map(l=>eqt(l)).join(", "),s=o?r:`[${r}]`;this.rewriteAttribute(i,s,t)}rewriteAttribute(i,e,t){i.pushStackElement(),i.pushEditOperations(null,[Qn.replaceMove(t,e)],()=>null),i.pushStackElement()}async openAndRewriteName(i,e,t){let o=await this._codeEditorService.openCodeEditor({resource:i},this._codeEditorService.getFocusedCodeEditor());if(!o||!o.hasModel())return;let n=o.getModel(),r=this._promptsService.getParsedPromptFile(n);if(!r.header)return;let s=r.header.getAttribute(no.name);s&&(s.value.type==="scalar"&&s.value.value===e||(o.setSelection(s.range),this.rewriteAttribute(n,e,s.value.range)))}};Vq=I([m(0,Qt),m(1,jr),m(2,Wn)],Vq);var Kfe;(n=>{function a(r){let s=new Map,l=new Map;for(let[c,u]of r.entries())_h(c)?s.set(c.id,u):l.set(c.id,u);return{toolSets:s,tools:l}}n.fromMap=a;function i(r){return Di(r)&&r.version===void 0&&(r.disabledTools===void 0||Array.isArray(r.disabledTools))&&(r.disabledToolSets===void 0||Array.isArray(r.disabledToolSets))}function e(r){return Di(r)&&r.version===2&&Array.isArray(r.toolSetEntries)&&Array.isArray(r.toolEntries)}function t(r){try{let s=JSON.parse(r);if(e(s))return{toolSets:new Map(s.toolSetEntries),tools:new Map(s.toolEntries)};if(i(s)){let l=s.disabledToolSets?.map(u=>[u,!1]),c=s.disabledTools?.map(u=>[u,!1]);return{toolSets:new Map(l),tools:new Map(c)}}}catch{}return{toolSets:new Map,tools:new Map}}n.fromStorage=t;function o(r){let s={version:2,toolSetEntries:Array.from(r.toolSets.entries()),toolEntries:Array.from(r.tools.entries())};return JSON.stringify(s)}n.toStorage=o})(Kfe||={});var FFe=class extends k{constructor(e,t,o,n,r){super();this._mode=e;this.languageModel=t;this._toolsService=o;this._instantiationService=r;this._sessionStates=new s5;this.entriesMap=ke(e=>{let t=new Map,o=this.languageModel.read(e)?.metadata,n=this._mode.read(e),r=this._sessionStates.observable.read(e).get(n.id);if(!r&&n.kind==="agent"){let s=n.customTools?.read(e);s&&(r=Kfe.fromMap(this._toolsService.toToolAndToolSetEnablementMap(s,o)))}r||(r=this._globalState.read(e));for(let s of this._currentTools.read(e))s.canBeReferencedInPrompt&&t.set(s,r.tools.get(s.id)!==!1);for(let s of this._toolsService.getToolSetsForModel(o,e)){let l=r.toolSets.get(s.id)!==!1;t.set(s,l);for(let c of s.getTools(e))t.set(c,l||r.tools.get(c.id)===!0)}return t});this.userSelectedTools=ke(e=>{let t={},o=this.entriesMap.read(e);for(let[n,r]of o)_h(n)||(t[n.id]=r);return t});let s=sN({key:"chat/selectedTools",defaultValue:{toolSets:new Map,tools:new Map},fromStorage:Kfe.fromStorage,toStorage:Kfe.toStorage});this._globalState=this._store.add(s(0,1,n)),this._currentTools=t.map(l=>o.observeTools(l?.metadata)).map((l,c)=>l.read(c))}get entriesScope(){let e=this._mode.get();return this._sessionStates.has(e.id)?1:e.kind==="agent"&&e.customTools?.get()&&e.uri?e.source?.storage!=="extension"?2:3:0}get currentMode(){return this._mode.get()}resetSessionEnablementState(){let e=this._mode.get();this._sessionStates.delete(e.id)}set(e,t){let o=this._mode.get();if(t||this._sessionStates.has(o.id)){this._sessionStates.set(o.id,Kfe.fromMap(e));return}if(o.kind==="agent"&&o.customTools?.get()&&o.uri)if(o.source?.storage!=="extension"){this.updateCustomModeTools(o.uri.get(),e);return}else{this._sessionStates.set(o.id,Kfe.fromMap(e));return}this._globalState.set(Kfe.fromMap(e),void 0)}async updateCustomModeTools(e,t){await this._instantiationService.createInstance(Vq).openAndRewriteTools(e,t,Ie.None)}};FFe=I([m(2,Wn),m(3,de),m(4,F)],FFe);function tqt(a,i,e=5e3){return new Promise((t,o)=>{let n=new O;n.add(ve(r=>{let l=a.servers.read(r).find(i);l&&(l.start({promptType:"all-untrusted"}).then(c=>{c.state===Sr.Kind.Error&&l.showOutput()}),t(),n.dispose())})),n.add(Zo(()=>{n.dispose(),o(new qi)},e))})}async function cV(a,i,e){let t=await a.start(i),o=new O,n=await new Promise(r=>{if(e?.isCancellationRequested||t.state===Sr.Kind.Error||t.state===Sr.Kind.Stopped)return r(!1);e&&o.add(e.onCancellationRequested(()=>{r(!1)})),o.add(ve(s=>{let l=a.connectionState.read(s).state;(l===Sr.Kind.Error||l===Sr.Kind.Stopped)&&r(!1),a.cacheState.read(s)===5&&r(!0)}))});return o.dispose(),n&&await Li(0),n}function VFe(a,i){let e=a.serverMetadata.read(i);return{type:"mcp",serverLabel:e?.serverName,instructions:e?.serverInstructions,label:a.definition.label,collectionId:a.collection.id,definitionId:a.definition.id}}function exo(a,i){let e=!1;if(a.protocol==="http:"){let t=i?.connection.get()?.launchDefinition;t&&t.type===2&&t.uri.authority.toLowerCase()===a.host.toLowerCase()&&(e=!0)}else a.protocol==="https:"&&(e=!0);return e}function txo(a){return a.task!==void 0}function ixo(a,i,e){return new Promise(t=>{uD(o=>{if(e){if(e.isCancellationRequested){o.dispose(),t(void 0);return}o.store.add(e.onCancellationRequested(()=>{o.dispose(),t(void 0)}))}let r=a.servers.read(o).find(i);r&&(t(r),o.dispose())})})}function iqt(a,i,e=""){let t=typeof i.data=="string"?i.data:JSON.stringify(i.data);switch(i.logger&&(t=`${i.logger}: ${t}`),e&&(t=`${e} ${t}`),i?.level){case"debug":a.debug(t);break;case"info":case"notice":a.info(t);break;case"warning":a.warn(t);break;case"error":case"critical":case"alert":case"emergency":a.error(t);break;default:a.info(t);break}}var Dcn=/("[^"\\]*(?:\\.[^"\\]*)*")|('[^'\\]*(?:\\.[^'\\]*)*')|(\/\*[^\/\*]*(?:(?:\*|\/)[^\/\*]*)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))|(,\s*[}\]])/g;function Rcn(a){return a.replace(Dcn,function(i,e,t,o,n,r){if(o)return"";if(n){let s=n.length;return n[s-1]===`
`?n[s-2]==="\r"?`\r
`:`
`:""}else return r?i.substring(1):i})}function A_(a){let i=Rcn(a);try{return JSON.parse(i)}catch{let t=i.replace(/,\s*([}\]])/g,"$1");return JSON.parse(t)}}var tAi=[],iAi=[],oxo="vscode://schemas/toolsets",Lcn={id:oxo,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(8657,null),body:{"${1:toolSetName}":{tools:["${2:someTool}","${3:anotherTool}"],description:"${4:description}",icon:"${5:tools}"}}}],type:"object",description:d(8662,null),additionalProperties:{type:"object",required:["tools"],additionalProperties:!1,properties:{tools:{description:d(8660,null),type:"array",minItems:1,items:{type:"string",enum:tAi,enumDescriptions:iAi}},icon:{description:d(8659,null),type:"string",enum:Array.from(l5(),a=>a.id),markdownEnumDescriptions:Array.from(l5(),a=>`$(${a.id})`)},description:{description:d(8658,null),type:"string"}}}},Mcn=oe.as(Ta.JSONContribution),gst=class a{static{this.suffix=".toolsets.jsonc"}static isToolSetFileName(i){return Be(i).endsWith(a.suffix)}static from(i,e){if(!Di(i))throw new Error("Invalid tool set data");let t=new Map;for(let[o,n]of Object.entries(i))_c(o)&&e.error("Tool set name cannot be empty"),YO(n.tools)&&e.error(`Tool set '${o}' cannot have an empty tools array`),t.set(o,{name:o,tools:n.tools,description:n.description,icon:n.icon});return new class extends a{}(t)}constructor(i){this.entries=Object.freeze(new Map(i))}},Gfe=class extends k{constructor(e,t,o,n,r,s){super();this._languageModelToolsService=o;this._userDataProfileService=n;this._fileService=r;this._logService=s;Promise.allSettled([e.whenInstalledExtensionsRegistered,t.when(3)]).then(()=>this._initToolSets());let l=vi(this,o.onDidChangeTools,()=>Array.from(o.getAllToolsIncludingDisabled())),c=this._store.add(new O);this._store.add(ve(u=>{let p=l.read(u),h=this._languageModelToolsService.toolSets.read(u),g=[];for(let f of p)f.canBeReferencedInPrompt&&g.push({name:f.toolReferenceName??f.displayName,sourceLabel:wn.classify(f.source).label,sourceOrdinal:wn.classify(f.source).ordinal,description:f.userDescription??f.modelDescription});for(let f of h)g.push({name:f.referenceName,sourceLabel:wn.classify(f.source).label,sourceOrdinal:wn.classify(f.source).ordinal,description:f.description});tAi.length=0,iAi.length=0,g.sort((f,v)=>f.sourceOrdinal!==v.sourceOrdinal?f.sourceOrdinal-v.sourceOrdinal:f.sourceLabel!==v.sourceLabel?f.sourceLabel.localeCompare(v.sourceLabel):f.name.localeCompare(v.name));for(let f of g)tAi.push(f.name),iAi.push(d(8661,null,f.sourceLabel,f.name,f.description));c.clear(),Mcn.registerSchema(oxo,Lcn,c)}))}static{this.ID="chat.userToolSets"}_initToolSets(){let e=vi(this,this._userDataProfileService.onDidChangeCurrentProfile,()=>this._userDataProfileService.currentProfile.promptsHome),t=qr(this,this._languageModelToolsService.onDidChangeTools),o=qr(this,U.filter(this._fileService.onDidFilesChange,s=>s.affects(e.get()))),n=this._store.add(new O),r=async s=>{try{return(await this._fileService.resolve(s)).children??[]}catch{return[]}};this._store.add(ve(async s=>{n.clear(),t.read(s),o.read(s);let l=e.read(s),c=new qe;n.add(ee(()=>c.dispose(!0)));let u=await r(l);if(!c.token.isCancellationRequested)for(let p of u){if(!p.isFile||!gst.isToolSetFileName(p.resource))continue;n.add(this._fileService.watch(p.resource));let h;try{let g=await this._fileService.readFile(p.resource,void 0,c.token),f=A_(g.value.toString());h=gst.from(f,this._logService)}catch(g){this._logService.error(`Error reading tool set file ${p.resource.toString()}:`,g);continue}if(c.token.isCancellationRequested)return;for(let[g,f]of h.entries){let v=[],b=[];if(f.tools.forEach(y=>{let w=this._languageModelToolsService.getToolByName(y);if(w){v.push(w);return}let x=this._languageModelToolsService.getToolSetByName(y);if(x){b.push(x);return}}),v.length===0&&b.length===0)continue;let S=this._languageModelToolsService.createToolSet({type:"user",file:p.resource,label:Be(p.resource)},`user/${p.resource.toString()}/${g}`,g,{icon:f.icon?q.fromId(f.icon):void 0,description:f.description});Ki(y=>{n.add(S),v.forEach(w=>n.add(S.addTool(w,y))),b.forEach(w=>n.add(S.addToolSet(w,y)))})}}}))}};Gfe=I([m(0,lt),m(1,to),m(2,Wn),m(3,gn),m(4,ge),m(5,re)],Gfe);var BFe=class a extends z{static{this.ID="chat.configureToolSets"}constructor(){super({id:a.ID,title:P(8652,"Configure Tool Sets..."),shortTitle:d(8655,null),category:fi,f1:!0,precondition:C.and(Z.enabled,Z.Tools.toolsCount.greater(0)),menu:[{id:LC,when:C.equals("view",Xr),order:11,group:"2_level"},{id:R.ViewTitle,when:C.and(Z.enabled,C.equals("view",Xr)),order:11,group:"2_level"}]})}async run(i){let e=i.get(Wn),t=i.get($e),o=i.get(ie),n=i.get(gn),r=i.get(ge),s=i.get(Uo),l=[];l.push({label:d(8653,null),alwaysShow:!0,iconClass:q.asClassName(L.plus)});for(let p of e.toolSets.get())p.source.type==="user"&&l.push({label:p.referenceName,toolset:p,tooltip:p.description,iconClass:q.asClassName(p.icon)});let c=await t.pick(l,{canPickMany:!1,placeHolder:d(8654,null)});if(!c)return;let u;if(c.toolset)To(c.toolset.source.type==="user"),u=c.toolset.source.file;else{let p=await t.input({placeHolder:d(8656,null),validateInput:async h=>{if(!h)return d(8650,null);if(!Ez(h))return d(8651,null,h)}});if(_c(p))return;u=Ve(n.currentProfile.promptsHome,`${p}${gst.suffix}`),await r.exists(u)||await s.write(u,["// Place your tool sets here...","// Example:","// {",'// 	"toolSetName": {','// 		"tools": [','// 			"someTool",','// 			"anotherTool"',"// 		],",'// 		"description": "description",','// 		"icon": "tools"',"// 	}","// }"].join(`
`))}await o.openEditor({resource:u,options:{pinned:!0}})}};function Acn(a){return a.itemType==="bucket"}function oqt(a){return a.itemType==="toolset"}function fst(a){return a.itemType==="tool"}function Ncn(a){return a.itemType==="callback"}function rxo(a,i=!1){return a?q.isThemeIcon(a)?{iconClass:q.asClassName(a)}:{iconPath:a}:i?{iconClass:q.asClassName(L.tools)}:{}}function nxo(a,i){let e=rxo(a.icon,!0);return{itemType:"tool",tool:a,id:a.id,label:a.toolReferenceName??a.displayName,description:a.userDescription??a.modelDescription,checked:i,...e}}function Ocn(a,i,e){let t=rxo(a.icon),o=[];if(a.source.type==="user"){let n=a.source.file;o.push({iconClass:q.asClassName(L.edit),tooltip:d(6631,null),action:()=>e.openEditor({resource:n})})}return{itemType:"toolset",toolset:a,buttons:o,id:a.id,label:a.referenceName,description:a.description,checked:i,children:void 0,collapsed:!0,...t}}async function nqt(a,i,e,t,o,n,r){let s=a.get($e),l=a.get(Vs),c=a.get(xc),u=a.get(fe),p=a.get(Ui),h=a.get(ie),g=a.get(bf),f=a.get(Wn),v=a.get(IR),b=a.get(_e),S=new Map;for(let J of l.servers.get())for(let se of J.tools.get())S.set(se.id,J);function y(J){let se=o?new Map([...o()].map(([Te,It])=>[Te.id,It])):void 0;if(!se){let Te=new Map;for(let It of f.getTools(n))It.canBeReferencedInPrompt&&Te.set(It,!1);for(let It of f.getToolSetsForModel(n))Te.set(It,!1);se=Te}J?.forEach((Te,It)=>{se.set(It.id,Te)});let ae=[],ce=new Map,Se=Te=>{switch(Te.type){case"mcp":case"extension":return wn.toKey(Te);case"internal":return 1 .toString();case"user":return 0 .toString();case"external":throw new Error("should not be reachable");default:bs(Te)}},Re=new Map(l.servers.get().map(Te=>[Te.definition.id,{server:Te,seen:!1}])),xe=(Te,It)=>{if(Te.type==="mcp"){let tt=Re.get(Te.definitionId);if(!tt)return;tt.seen=!0;let Oi=tt.server,zt=[],mo=c.collections.get().find(Ko=>Ko.id===Oi.collection.id);mo?.source?zt.push({iconClass:q.asClassName(L.settingsGear),tooltip:d(6627,null,mo.label),action:()=>mo.source?mo.source instanceof hi?p.open(mo.source.value,{tab:"features",feature:"mcp"}):g.open(mo.source,{tab:"configuration"}):void 0}):mo?.presentation?.origin&&zt.push({iconClass:q.asClassName(L.settingsGear),tooltip:d(6627,null,mo.label),action:()=>h.openEditor({resource:mo.presentation.origin})}),Oi.connectionState.get().state===Sr.Kind.Error&&zt.push({iconClass:q.asClassName(L.warning),tooltip:d(6633,null),action:()=>Oi.showOutput()});let dn=Oi.cacheState.get(),No=[],_i=!0;(dn===0||dn===2)&&(_i=!1,No.push({itemType:"callback",iconClass:q.asClassName(L.sync),label:d(6634,null),pickable:!1,run:()=>(x.busy=!0,(async()=>{if(!await cV(Oi,{promptType:"all-untrusted"})){Oi.showOutput(),x.hide();return}x.busy=!1,y(E())})(),!1)}));let ln={itemType:"bucket",ordinal:2,id:It,label:Te.label,checked:void 0,collapsed:_i,children:No,buttons:zt,sortOrder:2},Tn=Oi.serverMetadata.get()?.icons.getUrl(22);return Tn?ln.iconPath=Tn:ln.iconClass=q.asClassName(L.mcp),ln}else return Te.type==="extension"?{itemType:"bucket",ordinal:3,id:It,label:Te.label,checked:void 0,children:[],buttons:[],collapsed:!0,iconClass:q.asClassName(L.extensions),sortOrder:3}:Te.type==="internal"?{itemType:"bucket",ordinal:1,id:It,label:d(6630,null),checked:void 0,children:[],buttons:[],collapsed:!1,sortOrder:1}:{itemType:"bucket",ordinal:0,id:It,label:d(6636,null),checked:void 0,children:[],buttons:[],collapsed:!0,sortOrder:4}},He=Te=>{let It=Se(Te),tt=ce.get(It);return tt||(tt=xe(Te,It),tt&&ce.set(It,tt)),tt};for(let Te of f.getToolSetsForModel(n)){if(!se.has(Te.id))continue;let It=He(Te.source);if(!It)continue;let tt=se.get(Te.id)===!0;if(Te.source.type==="mcp")It.toolset=Te,tt&&(It.checked=tt);else{let Oi=Ocn(Te,tt,h);It.children.push(Oi);let zt=[];for(let mo of Te.getTools()){let dn=tt||se.get(mo.id)===!0,No=nxo(mo,dn);zt.push(No)}zt.length>0&&(Oi.children=zt)}}for(let Te of f.getAllToolsIncludingDisabled()){if(!Te.canBeReferencedInPrompt||!se.has(Te.id))continue;let It=He(Te.source);if(!It)continue;let tt=It.checked===!0||se.get(Te.id)===!0,Oi=nxo(Te,tt);It.children.push(Oi)}for(let{server:Te,seen:It}of Re.values()){let tt=Te.cacheState.get();!It&&(tt===0||tt===2)&&He({type:"mcp",definitionId:Te.definition.id,label:Te.definition.label,instructions:"",serverLabel:"",collectionId:Te.collection.id})}let Ee=Array.from(ce.values()).sort((Te,It)=>Te.sortOrder!==It.sortOrder?Te.sortOrder-It.sortOrder:Te.label.localeCompare(It.label));for(let Te of Ee){ae.push(Te),Te.children.sort((It,tt)=>It.label.localeCompare(tt.label));for(let It of Te.children)oqt(It)&&It.children&&It.children.sort((tt,Oi)=>tt.label.localeCompare(Oi.label))}for(let Te of Ee){let It=Te.ordinal===2,tt=Oi=>{if(!v.toolCanManageConfirmation(Oi.tool))return;let zt=Oi.tool,mo=It?Te.children.flatMap(No=>fst(No)?[No.tool]:oqt(No)&&No.children?No.children.filter(fst).map(_i=>_i.tool):[]):[zt],dn=Oi.buttons?[...Oi.buttons]:[];dn.push({iconClass:q.asClassName(L.pass),tooltip:d(6632,null),keepOpen:!0,action:()=>v.manageConfirmationPreferences(mo,{focusToolId:zt.id})}),Oi.buttons=dn};for(let Oi of Te.children)if(fst(Oi))tt(Oi);else if(oqt(Oi)&&Oi.children)for(let zt of Oi.children)fst(zt)&&tt(zt)}ae.length===0?x.placeholder=d(6635,null):x.placeholder=i,x.setItemTree(ae)}let w=new O,x=w.add(s.createQuickTree());x.placeholder=i,x.description=t,x.matchOnDescription=!0,x.matchOnLabel=!0,x.sortByLabel=!1,y(),w.add(x.onDidTriggerItemButton(J=>{J.button&&typeof J.button.action=="function"&&(J.button.action(),w.dispose())}));let E=()=>{let J=new Map,se=ae=>{for(let ce of ae)if(Acn(ce)){if(ce.toolset){let Se=ce.checked===!0;J.set(ce.toolset,Se)}se(ce.children)}else oqt(ce)?(J.set(ce.toolset,ce.checked===!0),ce.children&&se(ce.children)):fst(ce)&&J.set(ce.tool,ce.checked||J.get(ce.tool)===!0)};return se(x.itemTree),J},M=!1,N=w.add(new T);w.add(x.onDidAccept(()=>{let se=x.activeItems.find(Ncn);if(!se){M=!0,x.hide();return}se.run()!==!1&&N.fire()}));let V={iconClass:q.asClassName(L.mcp),tooltip:d(6626,null)},H={iconClass:q.asClassName(L.extensions),tooltip:d(6625,null)},K={iconClass:q.asClassName(L.gear),tooltip:d(6628,null)};x.title=d(6629,null),x.buttons=[V,H,K],w.add(x.onDidTriggerButton(J=>{J===V?u.executeCommand("workbench.mcp.addConfiguration"):J===H?p.openSearch("@tag:language-model-tools"):J===K&&u.executeCommand(BFe.ID),x.hide()})),r&&w.add(r.onCancellationRequested(()=>{x.hide()}));let j=E();return x.show(),await Promise.race([U.toPromise(U.any(x.onDidHide,N.event),w)]),Vcn(e,b,j,E(),c),w.dispose(),M?E():void 0}function Fcn(a,i){let e=a.source;switch(e.type){case"internal":return{category:"builtin",name:a.id};case"extension":return{category:"extension",name:a.id,extensionId:e.extensionId.value};case"mcp":{let t=i.collections.get().find(o=>o.id===e.collectionId);return t?.source instanceof hi?{category:"extension-mcp",extensionId:t.source.value}:{category:"user-mcp"}}case"user":return{category:"user-toolset"};case"external":return{category:"user-toolset"};default:bs(e)}}function Wcn(a,i,e){let t={builtinEnabled:0,builtinDisabled:0,extensionEnabled:0,extensionDisabled:0,extensionMcpEnabled:0,extensionMcpDisabled:0,userMcpEnabled:0,userMcpDisabled:0,userToolsetEnabled:0,userToolsetDisabled:0,details:""},o=[];for(let[n,r]of i){if((a.get(n)??!1)===r)continue;let l=Fcn(n,e),c=r;switch(l.category){case"builtin":c?t.builtinEnabled++:t.builtinDisabled++,o.push({category:"builtin",name:l.name,enabled:c});break;case"extension":c?t.extensionEnabled++:t.extensionDisabled++,o.push({category:"extension",name:l.name,extensionId:l.extensionId,enabled:c});break;case"extension-mcp":c?t.extensionMcpEnabled++:t.extensionMcpDisabled++,o.push({category:"extension-mcp",extensionId:l.extensionId,enabled:c});break;case"user-mcp":c?t.userMcpEnabled++:t.userMcpDisabled++,o.push({category:"user-mcp",enabled:c});break;case"user-toolset":c?t.userToolsetEnabled++:t.userToolsetDisabled++,o.push({category:"user-toolset",enabled:c});break}}return t.details=JSON.stringify(o),t}function Vcn(a,i,e,t,o){let n=Wcn(e,t,o),r=n.builtinEnabled>0||n.builtinDisabled>0||n.extensionEnabled>0||n.extensionDisabled>0||n.extensionMcpEnabled>0||n.extensionMcpDisabled>0||n.userMcpEnabled>0||n.userMcpDisabled>0||n.userToolsetEnabled>0||n.userToolsetDisabled>0;i.publicLog2("chatToolPickerClosed",{source:a,changed:r,builtinEnabled:n.builtinEnabled,builtinDisabled:n.builtinDisabled,extensionEnabled:n.extensionEnabled,extensionDisabled:n.extensionDisabled,extensionMcpEnabled:n.extensionMcpEnabled,extensionMcpDisabled:n.extensionMcpDisabled,userMcpEnabled:n.userMcpEnabled,userMcpDisabled:n.userMcpDisabled,userToolsetEnabled:n.userToolsetEnabled,userToolsetDisabled:n.userToolsetDisabled,details:n.details})}var n1="workbench.action.chat.acceptTool",$fe="workbench.action.chat.skipTool",sxo="workbench.action.chat.acceptToolPostExecution",axo="workbench.action.chat.skipToolPostExecution",rqt=class extends z{run(i,e){let t=i.get(Lt),o=e?.sessionResource?t.getWidgetBySessionResource(e.sessionResource):t.lastFocusedWidget,n=o?.viewModel?.getItems().at(-1);if(Ni(n)){for(let r of n.model.response.value){let s=r.kind==="toolInvocation"?r.state.get():void 0;if(s?.type===pi.StateKind.WaitingForConfirmation||s?.type===pi.StateKind.WaitingForPostApproval){s.confirm(this.getReason());break}}o?.focusInput()}}},oAi=class extends rqt{constructor(){super({id:n1,title:P(6614,"Accept"),f1:!1,category:fi,keybinding:{when:C.and(Z.inChatSession,Z.Editing.hasToolConfirmation),primary:2051,weight:201}})}getReason(){return{type:4}}},nAi=class extends rqt{constructor(){super({id:$fe,title:P(6615,"Skip"),f1:!1,category:fi,keybinding:{when:C.and(Z.inChatSession,Z.Editing.hasToolConfirmation),primary:2563,weight:201}})}getReason(){return{type:5}}},qfe=class a extends z{static{this.ID="workbench.action.chat.configureTools"}constructor(){super({id:a.ID,title:d(6624,null),icon:L.settings,f1:!1,category:fi,precondition:Z.chatModeKind.isEqualTo("agent"),menu:[{when:C.and(Z.chatModeKind.isEqualTo("agent"),Z.lockedToCodingAgent.negate()),id:R.ChatInput,group:"navigation",order:100}]})}async run(i,...e){let t=i.get(F),o=i.get(Lt),n=i.get(_e),r=o.lastFocusedWidget;if(r||(r=this.extractWidget(e)),!r)return;let s=this.extractSource(e)??"chatInput",l,c,{entriesScope:u,entriesMap:p}=r.input.selectedToolsModel;switch(u){case 1:l=d(6623,null),c=d(6619,null);break;case 2:l=d(6620,null),c=d(6616,null,r.input.currentModeObs.get().label.get());break;case 3:l=d(6622,null),c=d(6618,null,r.input.currentModeObs.get().label.get());break;case 0:l=d(6621,null),c=d(6617,null);break}let h=new qe,g=r.input.currentModeObs.get(),f=ve(b=>{g.id!==r.input.currentModeObs.read(b).id&&h.cancel()});try{let b=await t.invokeFunction(nqt,l,s,c,()=>p.get(),r.input.selectedLanguageModel.get()?.metadata,h.token);b&&r.input.selectedToolsModel.set(b,!1)}finally{f.dispose(),h.dispose()}let v=r.input.selectedToolsModel.entriesMap.get();n.publicLog2("chat/selectedTools",{total:v.size,enabled:yt.reduce(v,(b,[S,y])=>y?b+1:b,0)})}extractWidget(i){function e(t){return!!t&&typeof t=="object"&&!!t.widget}for(let t of i)if(e(t))return t.widget}extractSource(i){function e(t){return!!t&&typeof t=="object"&&!!t.source}for(let t of i)if(e(t))return t.source}};function lxo(){let a=new O;return a.add(W(oAi)),a.add(W(nAi)),a.add(W(qfe)),a}var UFe=le("chatToolRiskAssessmentService"),cxo=2e3,Bcn=200,HFe=class{constructor(i,e){this._configurationService=i;this._languageModelsService=e;this._cache=new Ua(Bcn);this._inFlight=new Map}isEnabled(){return this._configurationService.getValue("chat.tools.riskAssessment.enabled")!==!1}getCached(i,e){return this._cache.get(this._cacheKey(i,e))?.assessment}async assess(i,e,t){if(!this.isEnabled())return;let o=this._cacheKey(i,e),n=this._cache.get(o);if(n)return n.assessment;let r=this._inFlight.get(o);if(r)return r;let s=(async()=>{try{let l=await this._invokeModel(i,e,t);return t.isCancellationRequested?void 0:(this._cache.set(o,{assessment:l}),l)}catch{return}finally{this._inFlight.delete(o)}})();return this._inFlight.set(o,s),s}_cacheKey(i,e){return i.id+"::"+YQi(Hcn(i,e))}async _invokeModel(i,e,t){let o=this._configurationService.getValue("chat.tools.riskAssessment.model")||"copilot-utility-small",n=await this._languageModelsService.selectLanguageModels({vendor:"copilot",id:o});if(!n.length||t.isCancellationRequested)return;let r=Ucn(i,e),s=await this._languageModelsService.sendChatRequest(n[0],void 0,[{role:1,content:[{type:"text",value:r}]}],{},t),l="";for await(let c of s.stream){if(t.isCancellationRequested)return;if(Array.isArray(c))for(let u of c)u.type==="text"&&(l+=u.value);else c.type==="text"&&(l+=c.value)}if(await s.result,!t.isCancellationRequested)return zcn(l,i)}};HFe=I([m(0,B),m(1,Gr)],HFe);function Hcn(a,i){return a.id==="run_in_terminal"&&i&&typeof i=="object"?{command:i.command}:i}function Ucn(a,i){let e;try{e=JSON.stringify(i??{})}catch{e="{}"}return e.length>cxo&&(e=e.slice(0,cxo)+"...[truncated]"),["You assess what one terminal command does for a code-editing AI agent, and how risky it is.","Reply with STRICT JSON only (no prose, no markdown fences):","{",'  "risk": "green" | "orange" | "red",','  "explanation": "<one short sentence, <=18 words>"',"}","",'Rules for "risk" \u2014 apply in order; take the FIRST match:',"  1. irreversible deletion of source code or user data (rm -rf on $HOME / source paths,","     find ... -delete on source globs), force-push, drop, format, npm publish        -> red","  2. arbitrary code execution from a remote source (curl ... | bash)                  -> red","  3. modifies remote state (git push, deploy, post)                                   -> orange","  4. modifies local files or installs packages, including recoverable deletions","     such as rm -rf of build output, caches, or node_modules                          -> orange","  5. otherwise (read-only, listing, status, diagnostics, GET requests)                -> green","",'Read-only commands are always GREEN. "rm -rf" is RED only when the target is',"source code or user data; deleting recoverable build artifacts (node_modules,","dist, .cache) is ORANGE.","","Examples:","  ls -lh                              -> green","  cat README.md                       -> green","  git status                          -> green","  git log --oneline -20               -> green","  npm ls                              -> green","  az vm list                          -> green","  kubectl get pods --all-namespaces   -> green","  npm install lodash                  -> orange","  rm -rf node_modules                 -> orange  (recoverable: reinstall)","  rm -rf dist                         -> orange  (recoverable: rebuild)","  git push origin feature             -> orange","  rm -rf $HOME                        -> red","  rm -rf src                          -> red     (irreplaceable source code)","  find . -name '*.test.ts' -delete    -> red","  git push --force origin main        -> red","  npm publish                         -> red","  curl -fsSL https://x.sh | bash      -> red","",'Write "explanation" in this exact shape:','  - green : "<verb> <target>."  e.g. "Lists running VMs in the current Azure subscription."','  - orange: "<verb> <target> \u2014 <consequence>."  e.g. "Installs lodash into node_modules."','  - red   : "<verb> <target> \u2014 <irreversible consequence>."  e.g. "Force-pushes main \u2014 overwrites public history."',"","Strict explanation rules:","  - Cite the ACTUAL paths, commands, URLs, branches, globs from the arguments below.","  - Decode cryptic flags (e.g. -f, -rf, --no-verify).",'  - Never use generic phrases like "may have side effects". Always name WHAT is read or changed.',"  - Plain prose. No quotes around the sentence. No markdown fences.","",`Tool: ${a.displayName} (id: ${a.id})`,`Description: ${a.modelDescription||a.userDescription||""}`,`Arguments (JSON): ${e}`].join(`
`)}function zcn(a,i){let e=a.trim();e.startsWith("```")&&(e=e.replace(/^```(?:json)?\n?/,"").replace(/\n?```$/,""));let t=e.indexOf("{"),o=e.lastIndexOf("}");t>0&&o>t&&(e=e.slice(t,o+1));let n;try{n=JSON.parse(e)}catch{return}if(!n||typeof n!="object")return;let r=n,s=Kcn(r.risk);if(!s)return;let l=typeof r.explanation=="string"?Gcn(r.explanation,140):qcn(s,i);return{risk:s,explanation:l}}function Kcn(a){if(typeof a!="string")return;let i=a.toLowerCase();if(i==="green")return"green";if(i==="orange"||i==="yellow")return"orange";if(i==="red")return"red"}function Gcn(a,i){return a.length<=i?a:a.slice(0,i-1)+"\u2026"}function qcn(a,i){switch(a){case"green":return d(8581,null,i.displayName);case"orange":return d(8582,null,i.displayName);case"red":return d(8583,null,i.displayName)}}var gS=le("chatMarkdownAnchorService"),sqt=class extends k{constructor(){super(...arguments);this._widgets=[];this._lastFocusedWidget=void 0}get lastFocusedAnchor(){return this._lastFocusedWidget}setLastFocusedList(e){this._lastFocusedWidget=e}register(e){if(this._widgets.some(o=>o===e))throw new Error("Cannot register the same widget multiple times");this._widgets.push(e);let t=e.getHTMLElement();return Na(t)&&this.setLastFocusedList(e),Fn($(t,"focus",()=>this.setLastFocusedList(e)),ee(()=>this._widgets.splice(this._widgets.indexOf(e),1)),$(t,"blur",()=>{this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)}))}};function vst(a,i){let e=i.getValue("chat.editorAssociations")??{},t=Object.keys(e).sort((o,n)=>n.length-o.length);for(let o of t)if(cee(o,a))return e[o]}function N_(a,i,e,t){a.querySelectorAll("a").forEach(n=>{let r=n.textContent?.trim(),s=!1,l,c=n.getAttribute("data-href"),u;if(c)try{u=A.parse(c)}catch{}if(!r)s=!0;else if(u){let p=new URLSearchParams(u.query),h=p.get("vscodeLinkType");if(h){l={vscodeLinkType:h,linkText:r},s=!0,p.delete("vscodeLinkType");let g=p.toString();u=u.with({query:g})}}if(s&&u?.scheme){let p=i.createInstance(r1,n,{kind:"inlineReference",inlineReference:u},l);t.add(e.register(p)),t.add(p)}})}var r1=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super();this.element=e;this.inlineReference=t;this.metadata=o;this.chatImageCarouselService=n;this.configurationService=r;this.notebookDocumentService=y;this.openerService=w;this.editorService=x;this.data="uri"in t.inlineReference?t.inlineReference:"name"in t.inlineReference?{kind:"symbol",symbol:t.inlineReference}:{uri:t.inlineReference},e.classList.add(r1.className,"show-file-icons");let E,M,N;if(this.data.kind==="symbol"){let j=this.data.symbol;N=this.data.symbol.location,E=[this.data.symbol.name],M=["codicon",...Ia(v,g,void 0,void 0,Zm.toIcon(j.kind))],this._store.add(p.invokeFunction(J=>zPi(J,e,s,{value:j.location,name:j.name,kind:j.kind},R.ChatInlineSymbolAnchorContext)))}else{N=this.data;let j=this.metadata?.linkText??h.getUriBasenameLabel(N.uri),J;if(N.range&&this.data.kind!=="symbol"){let Te=N.range.startLineNumber===N.range.endLineNumber?`:${N.range.startLineNumber}`:`:${N.range.startLineNumber}-${N.range.endLineNumber}`;E=[j,_("span.label-suffix",void 0,Te)]}else N.uri.scheme==="vscode-notebook-cell"&&this.data.kind!=="symbol"?E=[`${j} \u2022 cell${this.getCellIndex(N.uri)}`]:N.uri.scheme===Q.vscodeBrowser?(J=L.globe,E=[this.editorService.findEditors(N.uri)[0]?.editor?.getName()??gd.DEFAULT_LABEL]):E=[j];let se=N.uri.path.endsWith("/")?1:0,ae=()=>Ia(v,g,N.uri,se,se===1&&!S.getFileIconTheme().hasFolderIcons?W5:J);M=ae();let ce=()=>{V.classList.remove(...M),M=ae(),V.classList.add(...M)},Se=!1;c.stat(N.uri).then(Te=>{Se=Te.isDirectory,Te.isDirectory&&(se=1,ce())}).catch(()=>{});let Re,xe,He=!1,Ee=()=>(Re||(Re=this._register(s.createScoped(e)),pst.bindTo(Re).set(N.uri.toString()),xe=gu.bindTo(Re)),Re);this._register($(e,ne.CONTEXT_MENU,async Te=>{let It=new Ln(Me(Te),Te);Kt.stop(Te,!0);let tt=Ee();He||(He=!0,new bZ(tt,c,g,v).set(N.uri)),xe.set(Se),!this._store.isDisposed&&l.showContextMenu({contextKeyService:tt,getAnchor:()=>It,getActions:()=>{let Oi=f.getMenuActions(R.ChatInlineResourceAnchorContext,tt,{arg:N.uri});return Lu(Oi)}})})),N.range&&(N.range.startLineNumber===N.range.endLineNumber?e.setAttribute("aria-label",d(8710,null,j,N.range.startLineNumber)):e.setAttribute("aria-label",d(8711,null,j,N.range.startLineNumber,N.range.endLineNumber)))}let V=_("span.icon");V.classList.add(...M),e.replaceChildren(V,_("span.icon-label",{},...E));let H=N.range?`${N.range.startLineNumber},${N.range.startColumn}`:"";e.setAttribute("data-href",(H?N.uri.with({fragment:H}):N.uri).toString());let K=h.getUriLabel(N.uri,{relative:!0});this._register(u.setupManagedHover(yi("element"),e,K)),this.data.kind!=="symbol"&&(e.draggable=!0,this._register($(e,"dragstart",j=>{let J={resource:N.uri,selection:N.range};p.invokeFunction(se=>kv(se,[J],j)),j.dataTransfer?.setDragImage(e,0,0)}))),this._register($(e,"click",async j=>{if(Kt.stop(j,!0),Py(N.uri.path)?.startsWith("image/")&&this.configurationService.getValue("imageCarousel.chat.enabled")){await this.chatImageCarouselService.openCarouselAtResource(N.uri);return}let ae={override:vst(N.uri,this.configurationService)};N.range&&(ae.selection=N.range),await this.openerService.open(N.uri,{fromUserGesture:!0,editorOptions:ae})}))}static{this.className="chat-inline-anchor-widget"}getHTMLElement(){return this.element}getCellIndex(e){let o=this.notebookDocumentService.getNotebook(e)?.getCellIndex(e)??-1;return o>=0?` ${o+1}`:""}};r1=I([m(3,Eoe),m(4,B),m(5,X),m(6,Xe),m(7,ge),m(8,ot),m(9,F),m(10,nt),m(11,Rt),m(12,Yt),m(13,_t),m(14,_e),m(15,Pe),m(16,s3),m(17,Je),m(18,ie)],r1);W(class dxo extends z{static{this.id="chat.inlineResourceAnchor.addFileToChat"}constructor(){super({id:dxo.id,title:P(8706,"Add File to Chat"),menu:[{id:R.ChatInlineResourceAnchorContext,group:"chat",order:1,when:gu.negate()}]})}async run(i,e){let o=i.get(Lt).lastFocusedWidget;o&&o.attachmentModel.addFile(e)}});W(class uxo extends z{static{this.id="chat.inlineResourceAnchor.copyResource"}constructor(){super({id:uxo.id,title:P(8707,"Copy"),f1:!1,precondition:pst,keybinding:{weight:200,primary:2081}})}async run(i){let e=i.get(gS),t=i.get(Bi),o=e.lastFocusedAnchor;if(!o)return;let n=o.data.kind==="symbol"?o.data.symbol.location.uri:o.data.uri;t.writeResources([n])}});W(class pxo extends z{static{this.id="chat.inlineResourceAnchor.openToSide"}constructor(){super({id:pxo.id,title:P(8709,"Open to the Side"),f1:!1,precondition:pst,keybinding:{weight:402,primary:2051,mac:{primary:259}},menu:[R.ChatInlineSymbolAnchorContext,R.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"navigation",order:1}))})}async run(i,e){let t=i.get(ie),o=i.get(B),n=this.getTarget(i,e);if(!n)return;let r=A.isUri(n)?n:n.uri,s=vst(r,o),l=A.isUri(n)?{resource:n,options:{override:s}}:{resource:n.uri,options:{override:s,selection:{startColumn:n.range.startColumn,startLineNumber:n.range.startLineNumber}}};await t.openEditors([l],En)}getTarget(i,e){let t=i.get(gS);if(e)return e;let o=t.lastFocusedAnchor;if(o)return o.data.kind==="symbol"?o.data.symbol.location:o.data.uri}});W(class mxo extends z{static{this.id="chat.inlineSymbolAnchor.goToDefinition"}constructor(){super({id:mxo.id,title:{...P(8708,"Go to Definition"),mnemonicTitle:d(8715,null)},menu:[R.ChatInlineSymbolAnchorContext,R.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.1,when:me.hasDefinitionProvider}))})}async run(i,e){let t=i.get(Qt),o=i.get(F);await hxo(t,e);let n=new nH({openToSide:!1,openInPeek:!1,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0});return o.invokeFunction(r=>n.run(r))}});async function hxo(a,i){await a.openCodeEditor({resource:i.uri,options:{selection:{startColumn:i.range.startColumn,startLineNumber:i.range.startLineNumber}}},null)}async function rAi(a,i,e){let t=a.get(Qt),o=a.get(fe);return await hxo(t,e),o.executeCommand(i)}W(class gxo extends z{static{this.id="chat.inlineSymbolAnchor.goToTypeDefinitions"}constructor(){super({id:gxo.id,title:{...P(8714,"Go to Type Definitions"),mnemonicTitle:d(8718,null)},menu:[R.ChatInlineSymbolAnchorContext,R.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.1,when:me.hasTypeDefinitionProvider}))})}async run(i,e){await rAi(i,"editor.action.goToTypeDefinition",e)}});W(class fxo extends z{static{this.id="chat.inlineSymbolAnchor.goToImplementations"}constructor(){super({id:fxo.id,title:{...P(8712,"Go to Implementations"),mnemonicTitle:d(8716,null)},menu:[R.ChatInlineSymbolAnchorContext,R.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.2,when:me.hasImplementationProvider}))})}async run(i,e){await rAi(i,"editor.action.goToImplementation",e)}});W(class vxo extends z{static{this.id="chat.inlineSymbolAnchor.goToReferences"}constructor(){super({id:vxo.id,title:{...P(8713,"Go to References"),mnemonicTitle:d(8717,null)},menu:[R.ChatInlineSymbolAnchorContext,R.ChatInputSymbolAttachmentContext].map(i=>({id:i,group:"4_symbol_nav",order:1.3,when:me.hasReferenceProvider}))})}async run(i,e){await rAi(i,"editor.action.goToReferences",e)}});function bxo(a,i){let e=new O;for(let t of a.querySelectorAll("table")){if(!go(t))continue;jcn(t);let o=t.parentElement,n=t.nextSibling,r=document.createElement("div");r.appendChild(t);let s=e.add(new Ar(r,{vertical:2,horizontal:1})),l=s.getDomNode();l.classList.add("rendered-markdown-table-scroll-wrapper"),o?.insertBefore(l,n),i.value.add(()=>{s.scanDomNode()}),s.scanDomNode()}return e}var $cn=3;function jcn(a){let i=a.rows,e=[];for(let o of i)for(let n=0;n<o.cells.length;n++){let r=o.cells[n].textContent?.length??0;r>(e[n]??0)&&(e[n]=r)}let t=i[0];if(t)for(let o=0;o<t.cells.length;o++){let n=e[o];n!==void 0&&n>1&&(t.cells[o].style.minWidth=Math.min(n,$cn)+"ch")}}var jfe=class{static getSanitizerOptions(i){return{allowedTags:{override:[...i.allowedTags,...Qcn]},allowedAttributes:{override:[...i.allowedAttributes,"stretchy","encoding","accent",Cet,"d","viewBox","preserveAspectRatio","class",{attributeName:"style",shouldKeep:(e,t)=>this.sanitizeKatexStyles(t.attrValue)}]}}}static{this.tempSanitizerRule=new uo(()=>{let i=new CSSStyleSheet;i.insertRule(".temp{}");let e=i.cssRules[0];if(!(e instanceof CSSStyleRule))throw new Error("Invalid CSS rule");return e.style})}static sanitizeStyles(i,e){let t=this.tempSanitizerRule.value;t.cssText=i;let o=[];for(let n=0;n<t.length;n++){let r=t[n];if(e.includes(r)){let s=t.getPropertyValue(r);/^(([\d\.\-]+\w*\s?)+|\w+)$/.test(s)&&o.push(`${r}: ${s}`)}}return o.join("; ")}static sanitizeKatexStyles(i){let e=["display","position","font-family","font-style","font-weight","font-size","height","min-height","max-height","width","min-width","max-width","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","top","left","right","bottom","vertical-align","transform","border","border-top-width","border-right-width","border-bottom-width","border-left-width","color","white-space","text-align","line-height","float","clear"];return this.sanitizeStyles(i,e)}static{this._katexPromise=new uo(async()=>(this._katex=await vf("katex","dist/katex.min.js"),this._katex))}static getExtension(i,e={}){if(this._katex)return this.ensureKatexStyles(i),hWt.extension(this._katex,e)}static async loadExtension(i,e={}){let t=await this._katexPromise.value;return this.ensureKatexStyles(i),hWt.extension(t,e)}static ensureKatexStyles(i){let e=i.document;if(!e.querySelector("link.katex")){let t=document.createElement("link");t.classList.add("katex"),t.rel="stylesheet",t.href=gNt("katex","dist/katex.min.css"),e.head.appendChild(t)}}},Qcn=Object.freeze(["semantics","annotation","math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts","svg","altglyph","altglyphdef","altglyphitem","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]);var lqt="http://_vscodecontentref_";function sAi(a){let i=0,e=[];for(let t of a){let o=e.findLastIndex(r=>r.kind!=="textEditGroup"&&r.kind!=="undoStop"),n=e[o];if(t.kind==="inlineReference"){let r=t.name;r||(A.isUri(t.inlineReference)?r=Be(t.inlineReference):Bp(t.inlineReference)?r=Be(t.inlineReference.uri):r=t.inlineReference.name);let s=n?.kind==="markdownContent"?n.content.value:"";if(Jcn(s))if(n?.kind==="markdownContent"){let l=dte(n.content,new he(r));e[o]={...n,content:l}}else e.push({content:new he(r),kind:"markdownContent"});else{let l=i++,c=A.parse(lqt).with({path:String(l)}),u=`[${r}](${c.toString()})`,p={[l]:t};if(n?.kind==="markdownContent"){let h=dte(n.content,new he(u));e[o]={...n,content:h,inlineReferences:{...p,...n.inlineReferences||{}}}}else e.push({content:new he(u),inlineReferences:p,kind:"markdownContent"})}}else if(t.kind==="markdownContent"&&n?.kind==="markdownContent")if(_Wt(n.content,t.content)){let r=dte(n.content,t.content);e[o]={...n,content:r}}else n.inlineReferences&&Xcn(n.content.value)?e[o]={...n,content:{...t.content,value:n.content.value+t.content.value}}:e.push(t);else if(t.kind==="markdownVuln"){let s=`<vscode_annotation details='${encodeURIComponent(JSON.stringify(t.vulnerabilities))}'>${t.content.value}</vscode_annotation>`;if(n?.kind==="markdownContent"){let l=dte(n.content,new he(s));e[o]={...n,content:l}}else e.push({content:new he(s),kind:"markdownContent"})}else if(t.kind==="codeblockUri"){if(n?.kind==="markdownContent"){let r=t.isEdit?" isEdit":"",s=t.subAgentInvocationId?` subAgentInvocationId="${encodeURIComponent(t.subAgentInvocationId)}"`:"",l=`<vscode_codeblock_uri${r}${s}>${t.uri.toString()}</vscode_codeblock_uri>`,c=dte(n.content,new he(l));e.splice(o,1),e.push({...n,content:c})}}else e.push(t)}return e}var Ycn=new RegExp(`^(\\[.*?\\]\\(${lqt}/\\d+\\))+$`);function Xcn(a){return Ycn.test(a)}function Jcn(a){let i=a.split(`
`),e=!1,t="",o=0,n=[];for(let r of i){let s=r.trimStart();if(e){let c=aqt(s,t);c>=o&&s.substring(c).trim()===""&&(e=!1,n.length=0);continue}let l=s[0];if(l==="`"||l==="~"){let c=aqt(s,l);if(c>=3&&(l==="~"||!s.substring(c).includes("`"))){e=!0,t=l,o=c,n.length=0;continue}}n.push(r)}return e||Zcn(n.join(`
`))}function aqt(a,i){let e=0;for(;e<a.length&&a[e]===i;)e++;return e}function Zcn(a){let i=0;for(;i<a.length;){if(a[i]!=="`"){i++;continue}let e=aqt(a.substring(i),"`");i+=e;let t=!1;for(;i<a.length;){if(a[i]!=="`"){i++;continue}let o=aqt(a.substring(i),"`");if(i+=o,o===e){t=!0;break}}if(!t)return!0}return!1}function bst(a){let i=/<vscode_codeblock_uri( isEdit)?( subAgentInvocationId="([^"]*)")?>([\s\S]*?)<\/vscode_codeblock_uri>/ms.exec(a);if(i){let[e,t,,o,n]=i;if(n){let r;try{r=A.parse(n)}catch{return}let s=a.substring(0,i.index)+a.substring(i.index+e.length),l;if(o)try{l=decodeURIComponent(o)}catch{l=o}return{uri:r,textWithoutResult:s,isEdit:!!t,subAgentInvocationId:l}}}}function Sxo(a){let i=/<vscode_codeblock_uri[^>]* subAgentInvocationId="([^"]*)"/ms.exec(a);if(i)try{return decodeURIComponent(i[1])}catch{return i[1]}}function Ixo(a){return a.includes("<vscode_codeblock_uri")}function yxo(a){return a.includes("<vscode_codeblock_uri isEdit")}function wxo(a){let i=[],e=a,t;for(;(t=/<vscode_annotation details='(.*?)'>(.*?)<\/vscode_annotation>/ms.exec(e))!==null;){let[o,n,r]=t,s=t.index,l=e.substring(0,s),c=l.split(`
`).length-1,u=r.split(`
`).length-1,p=l.lastIndexOf(`
`),h=s-(p+1)+1,g=(l+r).lastIndexOf(`
`),f=s+r.length-(g+1)+1;try{JSON.parse(decodeURIComponent(n)).forEach(({title:b,description:S})=>i.push({title:b,description:S,range:{startLineNumber:c+1,startColumn:h,endLineNumber:c+u+1,endColumn:f}}))}catch{}e=e.substring(0,s)+r+e.substring(s+o.length)}return{newText:e,vulnerabilities:i}}var edn=()=>!1,Sst=Object.freeze(["b","blockquote","br","code","del","em","h1","h2","h3","h4","h5","h6","hr","i","ins","li","ol","p","pre","s","strong","sub","sup","table","tbody","td","th","thead","tr","ul","a","img","span","div","input"]);function aAi(a){return{...a,sanitizerConfig:{replaceWithPlaintext:!0,allowedTags:{override:Sst},...a?.sanitizerConfig,allowedLinkSchemes:{augment:[$i.urlProtocol,"copilot-skill",Q.vscodeBrowser,IC]},remoteImageIsAllowed:edn}}}var zoe=class{constructor(i,e,t,o,n){this.hoverService=o;this.markdownRendererService=n}render(i,e,t){e=aAi(e);let o=i&&i.supportHtml?{...i,value:`<body>

${i.value}

</body>`}:i,n=this.markdownRendererService.render(o,e,t);n.element.normalize();for(let r of n.element.childNodes)r.nodeType===Node.TEXT_NODE&&r.textContent?.trim()&&r.replaceWith(_("p",void 0,r.textContent));return this.attachCustomHover(n)}attachCustomHover(i){let e=new O;return i.element.querySelectorAll("a").forEach(t=>{if(t.title){let o=t.title;t.title="",e.add(this.hoverService.setupManagedHover(yi("element"),t,o))}}),{element:i.element,dispose:()=>{i.dispose(),e.dispose()}}}};zoe=I([m(0,Rt),m(1,Je),m(2,B),m(3,ot),m(4,_n)],zoe);function Cxo(a){let i=a.split(`
`),e=[],t=[];for(let o of i)if(o.startsWith("- "))e.push(o.substring(2));else if(o.startsWith("-"))e.push(o.substring(1));else if(o.startsWith("+ "))t.push(o.substring(2));else if(o.startsWith("+"))t.push(o.substring(1));else if(o.startsWith(" ")){let n=o.substring(1);e.push(n),t.push(n)}else!o.startsWith("@@")&&!o.startsWith("---")&&!o.startsWith("+++")&&!o.startsWith("diff ")&&(e.push(o),t.push(o));return{before:e.join(`
`),after:t.join(`
`)}}var lAi=class extends Zh{constructor(e,t){super();this._original=e;this._modified=t;this.original=this._original.object.textEditorModel,this.modified=this._modified.object.textEditorModel}dispose(){super.dispose(),this._original.dispose(),this._modified.dispose()}},Qfe=class extends k{constructor(e,t,o,n,r,s){super();this.modelService=n;this.textModelService=r;this.languageService=s;this.modelRef=this._register(new ue);this.comparePart=this._register(t.get());let l=A.from({scheme:Q.vscodeChatCodeBlock,path:`/chat-diff-original-${e.codeBlockIndex}-${ht()}`}),c=A.from({scheme:Q.vscodeChatCodeBlock,path:`/chat-diff-modified-${e.codeBlockIndex}-${ht()}`}),u=this.languageService.createById(e.languageId),p=this.modelService.createModel(e.beforeContent,u,l,!1),h=this.modelService.createModel(e.afterContent,u,c,!1),g=new qe,f=!1,v=!1,b=!1,S=()=>{b||(b=!0,p.dispose(),h.dispose())};this._register(ee(()=>{v=!0,g.dispose(!0),f&&S()}));let y=Promise.all([this.textModelService.createModelReference(l),this.textModelService.createModelReference(c)]).then(([x,E])=>{f=!0;let M=new lAi(x,E);if(v){M.dispose(),S();return}return M},x=>{if(f=!0,S(),!v)throw x}),w={element:e.element,isReadOnly:e.isReadOnly,horizontalPadding:e.horizontalPadding,edit:{uri:e.codeBlockResource||c,edits:[],kind:"textEditGroup",done:!0},diffData:y.then(async x=>x?(this.modelRef.value=x,{original:x.original,modified:x.modified,originalSha1:await bB(x.original.getValue())}):void 0)};this.comparePart.object.render(w,o,g.token),this.element=this.comparePart.object.element}layout(e){this.comparePart.object.layout(e)}reset(){this.modelRef.clear()}};Qfe=I([m(3,_t),m(4,Bt),m(5,Rt)],Qfe);var VTp=te("agentStatusIndicator.background",{dark:Ue.white.transparent(.05),light:Ue.black.transparent(.05),hcDark:null,hcLight:null},d(9856,null)),BTp=te("chat.requestBorder",{dark:new Ue(new Ut(255,255,255,.1)),light:new Ue(new Ut(0,0,0,.1)),hcDark:Ei,hcLight:Ei},d(9866,null)),xxo=te("chat.requestBackground",{dark:ni(Bo,.62),light:ni(Bo,.62),hcDark:qu,hcLight:null},d(9865,null)),Koe=te("chat.slashCommandBackground",{dark:"#26477866",light:"#adceff7a",hcDark:Ue.white,hcLight:Gv},d(9870,null)),Goe=te("chat.slashCommandForeground",{dark:"#85b6ff",light:"#26569e",hcDark:Ue.black,hcLight:gx},d(9871,null)),HTp=te("chat.avatarBackground",{dark:"#1f1f1f",light:"#f2f2f2",hcDark:Ue.black,hcLight:Ue.white},d(9857,null)),UTp=te("chat.avatarForeground",xo,d(9858,null)),zTp=te("chat.editedFileForeground",{light:"#895503",dark:"#E2C08D",hcDark:"#E2C08D",hcLight:"#895503"},d(9859,null)),KTp=te("chat.requestCodeBorder",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},d(9869,null),!0),GTp=te("chat.requestBubbleBackground",{light:ni(qv,.3),dark:ni(qv,.3),hcDark:null,hcLight:null},d(9867,null),!0),qTp=te("chat.requestBubbleHoverBackground",{dark:ni(qv,.6),light:ni(qv,.6),hcDark:null,hcLight:null},d(9868,null),!0),$Tp=te("chat.checkpointSeparator",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},d(9873,null)),jTp=te("chat.linesAddedForeground",{dark:"#54B054",light:"#107C10",hcDark:"#54B054",hcLight:"#107C10"},d(9863,null),!0),QTp=te("chat.linesRemovedForeground",{dark:"#FC6A6A",light:"#BC2F32",hcDark:"#F48771",hcLight:"#B5200D"},d(9864,null),!0),YTp=te("chat.thinkingShimmer",{dark:"#ffffff",light:"#000000",hcDark:"#ffffff",hcLight:"#000000"},d(9872,null),!0),XTp=te("chat.inputWorkingBorderColor1",{dark:th,light:th,hcDark:"#FFFFFF",hcLight:"#000000"},d(9860,null),!0),JTp=te("chat.inputWorkingBorderColor2",{dark:Eu(th,.5),light:Eu(th,.3),hcDark:"#A0A0A0",hcLight:"#555555"},d(9861,null),!0),ZTp=te("chat.inputWorkingBorderColor3",{dark:Bf(th,.5),light:Bf(th,.3),hcDark:"#000000",hcLight:"#000000"},d(9862,null),!0);var cqt=Oe("extension-default-icon",L.extensionsLarge,d(18926,null)),dV=Oe("extensions-verified-publisher",L.verifiedFilled,d(18928,null)),Ist=te("extensionIcon.verifiedForeground",AS,d(18927,null),!1);var Bq=class extends k{constructor(e,t,o){super();this.chatAgentService=e;this.extensionService=t;this.chatAgentNameService=o;this._onDidChangeContents=this._register(new T);this.onDidChangeContents=this._onDidChangeContents.event;let n=st(".chat-agent-hover@root",[st(".chat-agent-hover-header",[st(".chat-agent-hover-icon@icon"),st(".chat-agent-hover-details",[st(".chat-agent-hover-name@name"),st(".chat-agent-hover-extension",[st(".chat-agent-hover-extension-name@extensionName"),st(".chat-agent-hover-separator@separator"),st(".chat-agent-hover-publisher@publisher")])])]),st(".chat-agent-hover-warning@warning"),st("span.chat-agent-hover-description@description")]);this.domNode=n.root,this.icon=n.icon,this.name=n.name,this.extensionName=n.extensionName,this.description=n.description,n.separator.textContent="|";let r=_("span.extension-verified-publisher",void 0,un(dV));this.publisherName=_("span.chat-agent-hover-publisher-name"),D(n.publisher,r,this.publisherName),n.warning.appendChild(un(L.warning)),n.warning.appendChild(_("span",void 0,d(8676,null)))}setAgent(e){let t=this.chatAgentService.getAgent(e);if(t.metadata.icon instanceof A){let r=_("img.icon");r.src=In.uriToBrowserUri(t.metadata.icon).toString(!0),this.icon.replaceChildren(_(".avatar",void 0,r))}else if(t.metadata.themeIcon){let r=_(q.asCSSSelector(t.metadata.themeIcon));this.icon.replaceChildren(_(".avatar.codicon-avatar",void 0,r))}this.domNode.classList.toggle("noExtensionName",!!t.isDynamic);let o=this.chatAgentNameService.getAgentNameRestriction(t);this.name.textContent=o?`@${t.name}`:_3(t),this.extensionName.textContent=t.extensionDisplayName,this.publisherName.textContent=t.publisherDisplayName??t.extensionPublisherId;let n=t.description??"";if(n&&(n.match(/[\.\?\!] *$/)||(n+=".")),this.description.textContent=n,this.domNode.classList.toggle("allowedName",o),this.domNode.classList.toggle("verifiedPublisher",!1),!t.isDynamic){let r=this._register(new qe);this.extensionService.getExtensions([{id:t.extensionId.value}],r.token).then(s=>{r.dispose(),s[0]?.publisherDomain?.verified&&(this.domNode.classList.toggle("verifiedPublisher",!0),this._onDidChangeContents.fire())})}}};Bq=I([m(0,gr),m(1,Ui),m(2,P2)],Bq);function zFe(a,i){let e={commandId:jNe,label:d(8677,null),run:()=>{let t=a();t&&i.executeCommand(jNe,[t.extensionId.value])}};return{get actions(){return a()?.isCore?[]:[e]}}}var cAi="http://_vscodedecoration_",dqt="http://_chatagent_",kxo="http://_chatslash_";function dAi(a,i,e,t){let o=t.get(P2),n=t.get(gr),r=o.getAgentNameRestriction(a),s=`${r?a.name:_3(a)}`;r&&n.agentHasDupeName(a.id)&&(s+=` (${a.publisherDisplayName})`);let c={agentId:a.id,sessionResource:i,name:s,isClickable:e};return`[${a.name}](${dqt}?${encodeURIComponent(JSON.stringify(c))})`}function Exo(a,i,e){let t=`${cp}${i.name}`,o={agentId:a.id,command:i.name,sessionResource:e};return`[${t}](${kxo}?${encodeURIComponent(JSON.stringify(o))})`}var qoe=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.keybindingService=i;this.logService=e;this.chatAgentService=t;this.instantiationService=o;this.hoverService=n;this.chatService=r;this.chatWidgetService=s;this.commandService=l;this.labelService=c;this.toolsService=u;this.chatMarkdownAnchorService=p}convertParsedRequestToMarkdown(i,e){let t="";for(let o of e.parts)o instanceof Yb?t+=o.text:o instanceof Qp?t+=this.instantiationService.invokeFunction(n=>dAi(o.agent,i,!1,n)):t+=this.genericDecorationToMarkdown(o);return t}genericDecorationToMarkdown(i){let e=i instanceof FM&&i.data instanceof A?i.data:void 0,o={title:e?this.labelService.getUriLabel(e,{relative:!0}):i instanceof gE?i.slashCommand.detail:i instanceof cb?i.command.description:i instanceof iR?i.name:i instanceof iw?this.toolsService.getTool(i.toolId)?.userDescription:""};return`[${i.text}](${cAi}?${encodeURIComponent(JSON.stringify(o))})`}walkTreeAndAnnotateReferenceLinks(i,e){let t=new O;return e.querySelectorAll("a").forEach(o=>{let n=o.getAttribute("data-href");if(n)if(n.startsWith(dqt)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(dqt.length+1)))}catch(s){this.logService.error("Invalid chat widget render data JSON",Mn(s))}r&&o.replaceWith(this.renderAgentWidget(r,t))}else if(n.startsWith(kxo)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(dqt.length+1)))}catch(s){this.logService.error("Invalid chat slash command render data JSON",Mn(s))}r&&o.replaceWith(this.renderSlashCommandWidget(o.textContent,r,t))}else if(n.startsWith(cAi)){let r;try{r=JSON.parse(decodeURIComponent(n.slice(cAi.length+1)))}catch{}o.replaceWith(this.renderResourceWidget(o.textContent,r,t))}else n.startsWith(lqt)?this.renderFileWidget(i,n,o,t):n.startsWith("command:")&&this.injectKeybindingHint(o,n,this.keybindingService)}),t}renderAgentWidget(i,e){let t=`${pd}${i.name}`,o;if(i.isClickable){o=_("span.chat-agent-widget");let s=e.add(new Pi(o,{buttonBackground:Tt(Koe),buttonForeground:Tt(Goe),buttonHoverBackground:void 0}));s.label=t,e.add(s.onDidClick(()=>{let l=this.chatAgentService.getAgent(i.agentId),c=this.chatWidgetService.getWidgetBySessionResource(i.sessionResource)||this.chatWidgetService.lastFocusedWidget;!c||!l||this.chatService.sendRequest(c.viewModel.sessionResource,l.metadata.sampleRequest??"",{location:c.location,agentId:l.id,userSelectedModelId:c.input.currentLanguageModel,modeInfo:c.input.currentModeInfo})}))}else o=this.renderResourceWidget(t,void 0,e);let n=this.chatAgentService.getAgent(i.agentId),r=new uo(()=>e.add(this.instantiationService.createInstance(Bq)));return e.add(this.hoverService.setupManagedHover(yi("element"),o,()=>(r.value.setAgent(i.agentId),r.value.domNode),n&&zFe(()=>n,this.commandService))),o}renderSlashCommandWidget(i,e,t){let o=_("span.chat-agent-widget.chat-command-widget"),n=this.chatAgentService.getAgent(e.agentId),r=t.add(new Pi(o,{buttonBackground:Tt(Koe),buttonForeground:Tt(Goe),buttonHoverBackground:void 0}));return r.label=i,t.add(r.onDidClick(()=>{let s=this.chatWidgetService.getWidgetBySessionResource(e.sessionResource)||this.chatWidgetService.lastFocusedWidget;if(!s||!n)return;let l=n.slashCommands.find(c=>c.name===e.command);this.chatService.sendRequest(s.viewModel.sessionResource,l?.sampleRequest??"",{location:s.location,agentId:n.id,slashCommand:e.command,userSelectedModelId:s.input.currentLanguageModel,modeInfo:s.input.currentModeInfo})})),o}renderFileWidget(i,e,t,o){let n=A.parse(e),r=i.inlineReferences?.[n.path.slice(1)];if(!r){this.logService.error("Invalid chat widget render data JSON");return}let s=o.add(this.instantiationService.createInstance(r1,t,r,void 0));o.add(this.chatMarkdownAnchorService.register(s))}renderResourceWidget(i,e,t){let o=_("span.chat-resource-widget"),n=_("span",void 0,i);return e?.title&&t.add(this.hoverService.setupManagedHover(yi("element"),o,e.title)),o.appendChild(n),o}injectKeybindingHint(i,e,t){let o=e.match(/command:([^\)]+)/)?.[1];o&&(i.textContent=t.appendKeybinding(i.textContent||"",o))}};qoe=I([m(0,Le),m(1,re),m(2,gr),m(3,F),m(4,ot),m(5,si),m(6,Lt),m(7,fe),m(8,nt),m(9,Wn),m(10,gS)],qoe);function uqt(a,i,e=!0){for(let t=i.length-1;t>=0;t--){let o=i.slice(0,t),n=i[t],r=tdn(a,n,o,e);if(r)return r}return null}function tdn(a,i,e,t){let o=null;for(let n=a.tokenColors.length-1;n>=0;n--){let r=a.tokenColors[n];if(t&&!r.settings.foreground)continue;let s;if(typeof r.scope=="string")s=r.scope.split(/,/).map(l=>l.trim());else if(Array.isArray(r.scope))s=r.scope;else continue;for(let l=0,c=s.length;l<c;l++){let u=s[l],p=new uAi(u,r.settings);p.matches(i,e)&&p.isMoreSpecific(o)&&(o=p)}}return o}var uAi=class a{constructor(i,e){this.rawSelector=i,this.settings=e;let t=this.rawSelector.split(/ /);this.scope=t[t.length-1],this.parentScopes=t.slice(0,t.length-1)}matches(i,e){return a._matches(this.scope,this.parentScopes,i,e)}static _cmp(i,e){if(i===null&&e===null)return 0;if(i===null)return-1;if(e===null)return 1;if(i.scope.length!==e.scope.length)return i.scope.length-e.scope.length;let t=i.parentScopes.length,o=e.parentScopes.length;if(t!==o)return t-o;for(let n=0;n<t;n++){let r=i.parentScopes[n].length,s=e.parentScopes[n].length;if(r!==s)return r-s}return 0}isMoreSpecific(i){return a._cmp(this,i)>0}static _matchesOne(i,e){let t=i+".";return i===e||e.substring(0,t.length)===t}static _matches(i,e,t,o){if(!this._matchesOne(i,t))return!1;let n=e.length-1,r=o.length-1;for(;n>=0&&r>=0;)this._matchesOne(e[n],o[r])&&n--,r--;return n===-1}};var ps=_,uV=class extends k{static{this.ID="editor.contrib.inspectEditorTokens"}static get(i){return i.getContribution(uV.ID)}constructor(i,e,t,o,n,r,s){super(),this._editor=i,this._textMateService=e,this._themeService=o,this._languageService=t,this._notificationService=n,this._configurationService=r,this._languageFeaturesService=s,this._widget=null,this._register(this._editor.onDidChangeModel(l=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(l=>this.stop())),this._register(this._editor.onKeyUp(l=>l.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&this._editor.getModel().uri.scheme!==Q.vscodeNotebookCell&&(this._widget=new mAi(this._editor,this._textMateService,this._languageService,this._themeService,this._notificationService,this._configurationService,this._languageFeaturesService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}toggle(){this._widget?this.stop():this.launch()}};uV=I([m(1,pQ),m(2,Rt),m(3,ep),m(4,Ne),m(5,B),m(6,Jt)],uV);var pAi=class extends Mi{constructor(){super({id:"editor.action.inspectTMScopes",label:P(10102,"Developer: Inspect Editor Tokens and Scopes"),precondition:void 0})}run(i,e){uV.get(e)?.toggle()}};function Txo(a){a.length>40&&(a=a.substr(0,20)+"\u2026"+a.substr(a.length-20));let i="";for(let e=0,t=a.length;e<t;e++){let o=a.charCodeAt(e);switch(o){case 9:i+="\u2192";break;case 32:i+="\xB7";break;default:i+=String.fromCharCode(o)}}return i}var mAi=class a extends k{constructor(e,t,o,n,r,s,l){super();this.allowEditorOverflow=!0;this._isDisposed=!1,this._editor=e,this._languageService=o,this._themeService=n,this._textMateService=t,this._notificationService=r,this._configurationService=s,this._languageFeaturesService=l,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="token-inspect-widget",this._currentRequestCancellationTokenSource=new qe,this._beginCompute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(c=>this._beginCompute(this._editor.getPosition()))),this._register(n.onDidColorThemeChange(c=>this._beginCompute(this._editor.getPosition()))),this._register(s.onDidChangeConfiguration(c=>c.affectsConfiguration("editor.semanticHighlighting.enabled")&&this._beginCompute(this._editor.getPosition()))),this._editor.addContentWidget(this)}static{this._ID="editor.contrib.inspectEditorTokensWidget"}dispose(){this._isDisposed=!0,this._editor.removeContentWidget(this),this._currentRequestCancellationTokenSource.cancel(),super.dispose()}getId(){return a._ID}_beginCompute(e){let t=this._textMateService.createTokenizer(this._model.getLanguageId()),o=this._computeSemanticTokens(e),n=this._model.tokenization.tokens.get(),r=n instanceof wK?n:void 0;St(this._domNode),this._domNode.appendChild(document.createTextNode(d(10103,null))),Promise.all([t,o]).then(([s,l])=>{if(this._isDisposed)return;let c=r?.tree.get();this._compute(s,l,c,e),this._domNode.style.maxWidth=`${Math.max(this._editor.getLayoutInfo().width*.66,500)}px`,this._editor.layoutContentWidget(this)},s=>{this._notificationService.warn(s),setTimeout(()=>{uV.get(this._editor)?.stop()})})}_isSemanticColoringEnabled(){let e=this._configurationService.getValue(zue,{overrideIdentifier:this._model.getLanguageId(),resource:this._model.uri})?.enabled;return typeof e=="boolean"?e:this._themeService.getColorTheme().semanticHighlighting}_compute(e,t,o,n){let r=e&&this._getTokensAtPosition(e,n),s=t&&this._getSemanticTokenAtPosition(t,n),l=o&&this._getTreeSitterTokenAtPosition(o,n);if(!r&&!s&&!l){Ii(this._domNode,"No grammar or semantic tokens available.");return}let c=r?.metadata,u=s?.metadata,p=s&&Txo(this._model.getValueInRange(s.range)),h=r&&Txo(this._model.getLineContent(n.lineNumber).substring(r.token.startIndex,r.token.endIndex)),g=s&&this._model.getValueLengthInRange(s.range),f=r&&r.token.endIndex-r.token.startIndex,v=p||h||"",b=g||f||0;if(Ii(this._domNode,ps("h2.tiw-token",void 0,v,ps("span.tiw-token-length",void 0,`${b} ${b===1?"char":"chars"}`))),D(this._domNode,ps("hr.tiw-metadata-separator",{style:"clear:both"})),D(this._domNode,ps("table.tiw-metadata-table",void 0,ps("tbody",void 0,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"language"),ps("td.tiw-metadata-value",void 0,c?.languageId||"")),ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"standard token type"),ps("td.tiw-metadata-value",void 0,this._tokenTypeToString(c?.tokenType||0))),...this._formatMetadata(u,c)))),s){D(this._domNode,ps("hr.tiw-metadata-separator"));let S=D(this._domNode,ps("table.tiw-metadata-table",void 0)),y=D(S,ps("tbody",void 0,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"semantic token type"),ps("td.tiw-metadata-value",void 0,s.type))));if(s.modifiers.length&&D(y,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"modifiers"),ps("td.tiw-metadata-value",void 0,s.modifiers.join(" ")))),s.metadata){let w=["foreground","bold","italic","underline","strikethrough"],x={},E=new Array;for(let M of w)if(s.metadata[M]!==void 0){let N=s.definitions[M],V=this._renderTokenStyleDefinition(N,M),H=V.map(j=>go(j)?j.outerHTML:j).join(),K=x[H];K||(x[H]=K=[],E.push([V,H])),K.push(M)}for(let[M,N]of E)D(y,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,x[N].join(", ")),ps("td.tiw-metadata-value",void 0,...M)))}}if(r){let S=this._themeService.getColorTheme();D(this._domNode,ps("hr.tiw-metadata-separator"));let y=D(this._domNode,ps("table.tiw-metadata-table")),w=D(y,ps("tbody"));h&&h!==v&&D(w,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"textmate token"),ps("td.tiw-metadata-value",void 0,`${h} (${h.length})`)));let x=new Array;for(let N=r.token.scopes.length-1;N>=0;N--)x.push(r.token.scopes[N]),N>0&&x.push(ps("br"));D(w,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"textmate scopes"),ps("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...x)));let E=uqt(S,r.token.scopes,!1),M=s?.metadata?.foreground;if(E){if(M!==r.metadata.foreground){let N=ps("code.tiw-theme-selector",void 0,E.rawSelector,ps("br"),JSON.stringify(E.settings,null,"	"));M&&(N=ps("s",void 0,N)),D(w,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"foreground"),ps("td.tiw-metadata-value",void 0,N)))}}else M||D(w,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"foreground"),ps("td.tiw-metadata-value",void 0,"No theme selector")))}if(l){let S=l[l.length-1];D(this._domNode,ps("hr.tiw-metadata-separator"));let y=D(this._domNode,ps("table.tiw-metadata-table")),w=D(y,ps("tbody"));D(w,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,`tree-sitter token ${S.id}`),ps("td.tiw-metadata-value",void 0,`${S.text}`)));let x=new Array,E=l.length-1,M=l[E];for(;M.parent||E>0;)x.push(M.type),M=M.parent??l[--E],M&&x.push(ps("br"));D(w,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"tree-sitter tree"),ps("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...x)));let V=this._model.tokenization.tokens.get().tokenizationImpl.get()?.captureAtPosition(n.lineNumber,n.column);V&&V.length>0&&D(w,ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"foreground"),ps("td.tiw-metadata-value",void 0,V.map(H=>H.name).join(" "))))}}_formatMetadata(e,t){let o=new Array;function n(u){let p=e?.[u]||t?.[u];if(p!==void 0){let h=e?.[u]?"tiw-metadata-semantic":"";o.push(ps("tr",void 0,ps("td.tiw-metadata-key",void 0,u),ps(`td.tiw-metadata-value.${h}`,void 0,p)))}return p}let r=n("foreground"),s=n("background");if(r&&s){let u=Ue.fromHex(s),p=Ue.fromHex(r);u.isOpaque()?o.push(ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"contrast ratio"),ps("td.tiw-metadata-value",void 0,u.getContrastRatio(p.makeOpaque(u)).toFixed(2)))):o.push(ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"Contrast ratio cannot be precise for background colors that use transparency"),ps("td.tiw-metadata-value")))}let l=new Array;function c(u){let p;e&&e[u]?p=ps("span.tiw-metadata-semantic",void 0,u):t&&t[u]&&(p=u),p&&(l.length&&l.push(" "),l.push(p))}return c("bold"),c("italic"),c("underline"),c("strikethrough"),l.length&&o.push(ps("tr",void 0,ps("td.tiw-metadata-key",void 0,"font style"),ps("td.tiw-metadata-value",void 0,...l))),o}_decodeMetadata(e){let t=this._themeService.getColorTheme().tokenColorMap,o=Vp.getLanguageId(e),n=Vp.getTokenType(e),r=Vp.getFontStyle(e),s=Vp.getForeground(e),l=Vp.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(o),tokenType:n,bold:r&2?!0:void 0,italic:r&1?!0:void 0,underline:r&4?!0:void 0,strikethrough:r&8?!0:void 0,foreground:t[s],background:t[l]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_getTokensAtPosition(e,t){let o=t.lineNumber,n=this._getStateBeforeLine(e,o),r=e.tokenizeLine(this._model.getLineContent(o),n),s=e.tokenizeLine2(this._model.getLineContent(o),n),l=0;for(let u=r.tokens.length-1;u>=0;u--){let p=r.tokens[u];if(t.column-1>=p.startIndex){l=u;break}}let c=0;for(let u=s.tokens.length>>>1;u>=0;u--)if(t.column-1>=s.tokens[u<<1]){c=u;break}return{token:r.tokens[l],metadata:this._decodeMetadata(s.tokens[(c<<1)+1])}}_getStateBeforeLine(e,t){let o=null;for(let n=1;n<t;n++)o=e.tokenizeLine(this._model.getLineContent(n),o).ruleStack;return o}isSemanticTokens(e){return e&&e.data}async _computeSemanticTokens(e){if(!this._isSemanticColoringEnabled())return null;let t=this._languageFeaturesService.documentSemanticTokensProvider.ordered(this._model);if(t.length){let n=t[0],r=await Promise.resolve(n.provideDocumentSemanticTokens(this._model,null,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(r))return{tokens:r,legend:n.getLegend()}}let o=this._languageFeaturesService.documentRangeSemanticTokensProvider.ordered(this._model);if(o.length){let n=o[0],r=e.lineNumber,s=new G(r,1,r,this._model.getLineMaxColumn(r)),l=await Promise.resolve(n.provideDocumentRangeSemanticTokens(this._model,s,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(l))return{tokens:l,legend:n.getLegend()}}return null}_getSemanticTokenAtPosition(e,t){let o=e.tokens.data,n=this._model.getLanguageId(),r=0,s=0,l=t.lineNumber-1,c=t.column-1;for(let u=0;u<o.length;u+=5){let p=o[u],h=o[u+1],g=o[u+2],f=o[u+3],v=o[u+4],b=r+p,S=p===0?s+h:h;if(l===b&&S<=c&&c<S+g){let y=e.legend.tokenTypes[f]||"not in legend (ignored)",w=[],x=v;for(let j=0;x>0&&j<e.legend.tokenModifiers.length;j++)x&1&&w.push(e.legend.tokenModifiers[j]),x=x>>1;x>0&&w.push("not in legend (ignored)");let E=new G(b+1,S+1,b+1,S+1+g),M={},N=this._themeService.getColorTheme().tokenColorMap,H=this._themeService.getColorTheme().getTokenStyleMetadata(y,w,n,!0,M),K;return H&&(K={languageId:void 0,tokenType:0,bold:H?.bold,italic:H?.italic,underline:H?.underline,strikethrough:H?.strikethrough,foreground:N[H?.foreground||0],background:void 0}),{type:y,modifiers:w,range:E,metadata:K,definitions:M}}r=b,s=S}return null}_walkTreeforPosition(e,t){let o=this._model.getOffsetAt(t);e.gotoFirstChild();let n=!1,r=null;do e.currentNode.startIndex<=o&&o<e.currentNode.endIndex?(n=!0,r=e.currentNode):n=!1;while(n?e.gotoFirstChild():e.gotoNextSibling());return r}_getTreeSitterTokenAtPosition(e,t){let o=[],n=e?.tree.get();for(;n;){let r=n.walk(),s=this._walkTreeforPosition(r,t);r.delete(),s?(o.push(s),e=e?.getInjectionTrees(s.startIndex,e.languageId),n=e?.tree.get()):n=void 0}return o.length>0?o:null}_renderTokenStyleDefinition(e,t){let o=new Array;if(e===void 0)return o;let n=this._themeService.getColorTheme();if(Array.isArray(e)){let r={};n.resolveScopes(e,r);let s=r[t];if(s&&r.scope){let l=ps("ul.tiw-metadata-values"),c=Array.isArray(s.scope)?s.scope:[String(s.scope)];for(let u of c)l.appendChild(ps("li.tiw-metadata-value.tiw-metadata-scopes",void 0,u));return o.push(r.scope.join(" "),l,ps("code.tiw-theme-selector",void 0,JSON.stringify(s.settings,null,"	"))),o}return o}else if(ZTe.is(e)){let r=n.getTokenStylingRuleScope(e);return r==="setting"?(o.push(`User settings: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),o):(r==="theme"&&o.push(`Color theme: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),o)}else{let r=n.resolveTokenStyleValue(e);return o.push(`Default: ${r?this._renderStyleProperty(r,t):""}`),o}}_renderStyleProperty(e,t){return t==="foreground"?e.foreground?Ue.Format.CSS.formatHexA(e.foreground,!0):"":e[t]!==void 0?String(e[t]):""}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};Eo(uV.ID,uV,4);ri(pAi);var pV=_,KFe=10,idn=7,gk=class extends k{constructor(e,t,o,n,r=!1,s,l,c,u,p,h,g,f){super();this.editorOptions=e;this.menuId=t;this.isSimpleWidget=r;this.modelService=c;this.languageService=u;this.configurationService=p;this.accessibilityService=h;this.logService=g;this.textModelService=f;this.currentScrollWidth=0;this._isHovered=!1;this._isDropdownVisible=!1;this.isDisposed=!1;this.element=pV(".interactive-result-code-block"),this.resourceContextKey=s.createInstance(bZ),this.contextKeyService=this._register(l.createScoped(this.element));let v=this._register(s.createChild(new Po([X,this.contextKeyService]))),b=D(this.element,pV(".interactive-result-editor"));this.editor=this.createEditor(v,b,{...ay(this.configurationService),readOnly:!0,lineNumbers:"off",selectOnLineNumbers:!0,scrollBeyondLastLine:!1,lineDecorationsWidth:8,dragAndDrop:!1,padding:{top:this.verticalPadding,bottom:this.verticalPadding},mouseWheelZoom:!1,scrollbar:{vertical:"hidden",alwaysConsumeMouseWheel:!1},definitionLinkOpensInPeek:!1,gotoLocation:{multiple:"goto",multipleDeclarations:"goto",multipleDefinitions:"goto",multipleImplementations:"goto"},ariaLabel:d(8922,null),overflowWidgetsDomNode:n,tabFocusMode:!0,...this.getEditorOptionsFromConfig()});let S=D(this.element,pV(".interactive-result-code-block-toolbar"));this._toolbarElement=S;let y=this._register(this.editor.contextKeyService.createScoped(S)),w=this._register(v.createChild(new Po([X,y])));this._toolbarFactory=()=>w.createInstance(pr,S,t,{menuOptions:{shouldForwardArgs:!0}});let x=D(this.element,pV(".interactive-result-vulns")),E=D(x,pV(".interactive-result-vulns-header",void 0));this.vulnsButton=this._register(new Pi(E,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,supportIcons:!0})),this.vulnsListElement=D(x,pV("ul.interactive-result-vulns-list")),this._register(this.vulnsButton.onDidClick(()=>{let M=this.currentCodeBlockData.element;M.vulnerabilitiesListExpanded=!M.vulnerabilitiesListExpanded,this.vulnsButton.label=this.getVulnerabilitiesLabel(),this.element.classList.toggle("chat-vulnerabilities-collapsed",!M.vulnerabilitiesListExpanded),this.layout()})),this._isHovered=!1,this._register($(this.element,"mouseenter",()=>{this._isHovered=!0,S.classList.add("force-visibility"),this._ensureToolbar()})),this._register($(this.element,"mouseleave",()=>{this._isHovered=!1,this._isDropdownVisible||S.classList.remove("force-visibility")})),this._configureForScreenReader(),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this._configureForScreenReader())),this._register(this.configurationService.onDidChangeConfiguration(M=>{M.affectedKeys.has("accessibility.verbosity.panelChat")&&this._configureForScreenReader()})),this._register(this.editorOptions.onDidChange(()=>{this.editor.updateOptions(this.getEditorOptionsFromConfig())})),this._register(this.editor.onDidScrollChange(M=>{this.currentScrollWidth=M.scrollWidth})),this._register(this.editor.onDidContentSizeChange(M=>{M.contentHeightChanged&&this.layout()})),this._register(this.editor.onDidBlurEditorWidget(()=>{this.element.classList.remove("focused"),US.get(this.editor)?.stopHighlighting(),this.clearWidgets()})),this._register(this.editor.onDidFocusEditorWidget(()=>{this.element.classList.add("focused"),this._ensureToolbar(),US.get(this.editor)?.restoreViewState(!0)})),this._register(U.any(this.editor.onDidChangeModel,this.editor.onDidChangeModelContent)(()=>{this.currentCodeBlockData&&this.updateContexts(this.currentCodeBlockData)})),o.onDidScroll&&this._register(o.onDidScroll(M=>{this.clearWidgets()})),this._textModel=this._register(this.modelService.createModel("",null,A.from({scheme:Q.vscodeChatCodeBlock,path:ht()}),this.isSimpleWidget)),Lvt(this.textModelService.createModelReference(this._textModel.uri),this._store),this.editor.setModel(this._textModel)}static poolKey(e,t){return`${e}/${t}`}get verticalPadding(){return this.currentCodeBlockData?.renderOptions?.verticalPadding??KFe}dispose(){this.isDisposed=!0,super.dispose()}get uri(){return this.editor.getModel()?.uri}createEditor(e,t,o){return this._register(e.createInstance(us,t,o,{isSimpleWidget:this.isSimpleWidget,contributions:ml.getSomeEditorContributions([dw.ID,mw,Vg.ID,US.ID,mH.ID,VK.ID,y0.ID,ql.ID,jf.ID,Xu.ID,BD.ID,Sc.ID,ss.ID,aC.ID,nE.ID,uV.ID])}))}focus(){this.editor.focus()}updatePaddingForLayout(){let e=this.currentScrollWidth>this.editor.getLayoutInfo().contentWidth,t=this.editor.getLayoutInfo().horizontalScrollbarHeight,o=e?Math.max(this.verticalPadding-t,2):this.verticalPadding;this.editor.updateOptions({padding:{top:this.verticalPadding,bottom:o}})}_ensureToolbar(){if(!this.isDisposed&&!this.currentCodeBlockData?.renderOptions?.hideToolbar){if(!this.toolbar){let e=this._toolbarFactory;if(!e)return;this._toolbarFactory=void 0;let t=this._register(e());this.toolbar=t,this._register(t.onDidChangeDropdownVisibility(o=>{this._isDropdownVisible=o,this._toolbarElement.classList.toggle("force-visibility",o||this._isHovered)})),this._pendingToolbarAriaLabel!==void 0&&(t.setAriaLabel(this._pendingToolbarAriaLabel),this._pendingToolbarAriaLabel=void 0),this._pendingToolbarContext!==void 0&&(t.context=this._pendingToolbarContext,this._pendingToolbarContext=void 0)}return this.toolbar}}_configureForScreenReader(){let e=!!this.currentCodeBlockData?.renderOptions?.hideToolbar;this.accessibilityService.isScreenReaderOptimized()?e?Wi(this._toolbarElement):(this._toolbarElement.style.display="block",this.currentCodeBlockData&&this._ensureToolbar()):e?Wi(this._toolbarElement):this._toolbarElement.style.display=""}getEditorOptionsFromConfig(){let e=this.currentCodeBlockData?.renderOptions,t=e?.maxHeightInLines?{vertical:"auto",verticalScrollbarSize:idn,...e?.editorOptions?.scrollbar}:void 0;return{wordWrap:this.editorOptions.configuration.resultEditor.wordWrap,fontLigatures:this.editorOptions.configuration.resultEditor.fontLigatures,bracketPairColorization:this.editorOptions.configuration.resultEditor.bracketPairColorization,fontFamily:this.editorOptions.configuration.resultEditor.fontFamily==="default"?Ku.fontFamily:this.editorOptions.configuration.resultEditor.fontFamily,fontSize:this.editorOptions.configuration.resultEditor.fontSize,fontWeight:this.editorOptions.configuration.resultEditor.fontWeight,lineHeight:this.editorOptions.configuration.resultEditor.lineHeight,...e?.editorOptions,...t?{scrollbar:t}:{}}}layout(e=this.lastLayoutWidth){if(e===void 0)return;this.lastLayoutWidth=e;let t=this.getContentHeight(),o=t;this.currentCodeBlockData?.renderOptions?.maxHeightInLines&&(o=Math.min(t,this.editor.getOption(75)*this.currentCodeBlockData?.renderOptions?.maxHeightInLines)),e=e-2-(this.currentCodeBlockData?.renderOptions?.reserveWidth??0),this.editor.layout({width:_r(this.currentCodeBlockData?.element)?e*.9:e,height:o},!0),this.updatePaddingForLayout()}getContentHeight(){return this.editor.getContentHeight()}render(e,t){if(this.currentCodeBlockData=e,e.parentContextKeyService&&this.contextKeyService.updateParent(e.parentContextKeyService),this.getEditorOptionsFromConfig().wordWrap==="on"&&this.layout(t),!this.updateEditor(e)||this.isDisposed||this.currentCodeBlockData!==e)return;this.editor.updateOptions({...this.getEditorOptionsFromConfig()}),this.editor.getOption(8)||this.editor.updateOptions({ariaLabel:d(8923,null,e.codeBlockIndex+1)}),this.layout(t);let n=d(8924,null,e.codeBlockIndex+1);this.toolbar?this.toolbar.setAriaLabel(n):this._pendingToolbarAriaLabel=n,e.renderOptions?.hideToolbar?Wi(this._toolbarElement):(Xo(this._toolbarElement),this.accessibilityService.isScreenReaderOptimized()&&this._ensureToolbar()),e.vulns?.length&&Ni(e.element)?(St(this.vulnsListElement),this.element.classList.remove("no-vulns"),this.element.classList.toggle("chat-vulnerabilities-collapsed",!e.element.vulnerabilitiesListExpanded),D(this.vulnsListElement,...e.vulns.map(r=>pV("li",void 0,pV("span.chat-vuln-title",void 0,r.title)," "+r.description))),this.vulnsButton.label=this.getVulnerabilitiesLabel()):this.element.classList.add("no-vulns"),this._isHovered&&this._toolbarElement.classList.add("force-visibility"),this.layout(),this.editor.renderAsync(!0)}reset(){this.clearWidgets(),this.currentCodeBlockData=void 0}onDidRemount(){this.currentCodeBlockData&&this.editor.renderAsync(!0)}clearWidgets(){ql.get(this.editor)?.hideContentHover(),jf.get(this.editor)?.hideGlyphHover()}updateEditor(e){return this.isDisposed||this.currentCodeBlockData!==e?!1:(this.setText(e.text),this.setLanguage(e.languageId),this.updateContexts(e),!0)}getVulnerabilitiesLabel(){return!this.currentCodeBlockData||!this.currentCodeBlockData.vulns?"":`${this.currentCodeBlockData.vulns.length>1?d(8933,null,this.currentCodeBlockData.vulns.length):d(8934,null,1)} $(${(o=>o.vulnerabilitiesListExpanded?L.chevronDown:L.chevronRight)(this.currentCodeBlockData.element).id})`}updateContexts(e){let t=this.editor.getModel();if(!t)return;let o={code:t.getTextBuffer().getValueInRange(t.getFullModelRange(),0),codeBlockIndex:e.codeBlockIndex,element:e.element,languageId:t.getLanguageId(),codemapperUri:e.codemapperUri,chatSessionResource:e.chatSessionResource};this.toolbar?this.toolbar.context=o:this._pendingToolbarContext=o,this.resourceContextKey.set(t.uri)}setText(e){let t=this._textModel.getValue(1);if(e!==t)if(e.startsWith(t)){let o=e.slice(t.length),n=this._textModel.getLineCount(),r=this._textModel.getLineMaxColumn(n);this._textModel.applyEdits([{range:new G(n,r,n,r),text:o}])}else this.logService.trace("[CodeBlockPart] setText could not optimize, falling back to setValue"),this._textModel.setValue(e)}setLanguage(e){let t=this.languageService.getLanguageIdByLanguageName(e);t&&t!==this._textModel.getLanguageId()?this._textModel.setLanguage(t):!t&&this._textModel.getLanguageId()!==es&&this._textModel.setLanguage(es)}};gk=I([m(5,F),m(6,X),m(7,_t),m(8,Rt),m(9,B),m(10,Ai),m(11,re),m(12,Bt)],gk);var GFe=class extends k{constructor(e,t){super();this._modelService=t;this._register(e.registerTextModelContentProvider(Q.vscodeChatCodeBlock,{provideTextContent:o=>Promise.resolve(this._modelService.getModel(o))}))}};GFe=I([m(0,Bt),m(1,_t)],GFe);var qFe=class extends k{constructor(e,t,o,n,r=!1,s,l,c,u,p,h,g){super();this.options=e;this.menuId=t;this.isSimpleWidget=r;this.modelService=c;this.configurationService=u;this.accessibilityService=p;this.labelService=h;this.openerService=g;this._lastDiffEditorViewModel=this._store.add(new ue);this.currentScrollWidth=0;this.currentHorizontalPadding=0;this.element=pV(".interactive-result-code-block"),this.element.classList.add("compare"),this.messageElement=D(this.element,pV(".message")),this.messageElement.setAttribute("role","status"),this.messageElement.tabIndex=0,this.contextKeyService=this._register(l.createScoped(this.element));let f=this._register(s.createChild(new Po([X,this.contextKeyService],[Hd,new class{show(w,x){return Nxt}async showWhile(w,x){await w}}]))),v=this.editorHeader=D(this.element,pV(".interactive-result-header.show-file-icons")),b=D(this.element,pV(".interactive-result-editor"));this.diffEditor=this.createDiffEditor(f,b,{...ay(this.configurationService),lineNumbers:"on",selectOnLineNumbers:!0,scrollBeyondLastLine:!1,lineDecorationsWidth:12,dragAndDrop:!1,padding:{top:KFe,bottom:KFe},mouseWheelZoom:!1,scrollbar:{vertical:"hidden",alwaysConsumeMouseWheel:!1},definitionLinkOpensInPeek:!1,gotoLocation:{multiple:"goto",multipleDeclarations:"goto",multipleDefinitions:"goto",multipleImplementations:"goto"},ariaLabel:d(8922,null),overflowWidgetsDomNode:n,...this.getEditorOptionsFromConfig()}),this.resourceLabel=this._register(f.createInstance(CE,v,{supportIcons:!0}));let S=this._register(this.diffEditor.getModifiedEditor().contextKeyService.createScoped(v)),y=this._register(f.createChild(new Po([X,S])));this.toolbar=this._register(y.createInstance(pr,v,t,{menuOptions:{shouldForwardArgs:!0}})),this._configureForScreenReader(),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this._configureForScreenReader())),this._register(this.configurationService.onDidChangeConfiguration(w=>{w.affectedKeys.has("accessibility.verbosity.panelChat")&&this._configureForScreenReader()})),this._register(this.options.onDidChange(()=>{this.diffEditor.updateOptions(this.getEditorOptionsFromConfig())})),this._register(this.diffEditor.getModifiedEditor().onDidScrollChange(w=>{this.currentScrollWidth=w.scrollWidth})),this._register(this.diffEditor.getModifiedEditor().onDidBlurEditorWidget(()=>{this.element.classList.remove("focused"),US.get(this.diffEditor.getModifiedEditor())?.stopHighlighting(),this.clearWidgets()})),this._register(this.diffEditor.getModifiedEditor().onDidFocusEditorWidget(()=>{this.element.classList.add("focused"),US.get(this.diffEditor.getModifiedEditor())?.restoreViewState(!0)})),o.onDidScroll&&this._register(o.onDidScroll(w=>{this.clearWidgets()}))}get uri(){return this.diffEditor.getModifiedEditor().getModel()?.uri}createDiffEditor(e,t,o){let n={isSimpleWidget:this.isSimpleWidget,contributions:ml.getSomeEditorContributions([dw.ID,mw,Vg.ID,US.ID,mH.ID,VK.ID,y0.ID,ql.ID,jf.ID,BD.ID])};return this._register(e.createInstance(_p,t,{scrollbar:{useShadows:!1,alwaysConsumeMouseWheel:!1,ignoreHorizontalScrollbarInContentHeight:!0},renderMarginRevertIcon:!1,diffCodeLens:!1,scrollBeyondLastLine:!1,stickyScroll:{enabled:!1},originalAriaLabel:d(8932,null),modifiedAriaLabel:d(8931,null),diffAlgorithm:"advanced",readOnly:!1,isInEmbeddedEditor:!0,useInlineViewWhenSpaceIsLimited:!0,experimental:{useTrueInlineView:!0},renderSideBySideInlineBreakpoint:300,renderOverviewRuler:!1,compactMode:!0,hideUnchangedRegions:{enabled:!0,contextLineCount:1},renderGutterMenu:!1,lineNumbersMinChars:1,...o},{originalEditor:n,modifiedEditor:n}))}focus(){this.diffEditor.focus()}updatePaddingForLayout(){let e=this.currentScrollWidth>this.diffEditor.getModifiedEditor().getLayoutInfo().contentWidth,t=this.diffEditor.getModifiedEditor().getLayoutInfo().horizontalScrollbarHeight,o=e?Math.max(KFe-t,2):KFe;this.diffEditor.updateOptions({padding:{top:KFe,bottom:o}})}_configureForScreenReader(){let e=this.toolbar.getElement();e.style.display="block",this.accessibilityService.isScreenReaderOptimized()&&(e.ariaLabel=d(8921,null))}getEditorOptionsFromConfig(){return{wordWrap:this.options.configuration.resultEditor.wordWrap,fontLigatures:this.options.configuration.resultEditor.fontLigatures,bracketPairColorization:this.options.configuration.resultEditor.bracketPairColorization,fontFamily:this.options.configuration.resultEditor.fontFamily==="default"?Ku.fontFamily:this.options.configuration.resultEditor.fontFamily,fontSize:this.options.configuration.resultEditor.fontSize,fontWeight:this.options.configuration.resultEditor.fontWeight,lineHeight:this.options.configuration.resultEditor.lineHeight}}layout(e=this.lastLayoutWidth){if(e===void 0)return;this.lastLayoutWidth=e;let t=2,o=Uh(this.editorHeader),n=this.diffEditor.getModel()?this.diffEditor.getContentHeight():Uh(this.messageElement),r=new di(e-t-this.currentHorizontalPadding*2,o+n);this.element.style.width=`${r.width}px`,this.diffEditor.layout(r.with(void 0,n-t)),this.updatePaddingForLayout()}async render(e,t,o){this.currentHorizontalPadding=e.horizontalPadding||0,e.parentContextKeyService&&this.contextKeyService.updateParent(e.parentContextKeyService),this.options.configuration.resultEditor.wordWrap==="on"&&this.layout(t),await this.updateEditor(e,o),this.layout(t),this.diffEditor.updateOptions({ariaLabel:d(8925,null),readOnly:!!e.isReadOnly}),this.resourceLabel.element.setFile(e.edit.uri,{fileKind:0,fileDecorations:{colors:!0,badges:!1}})}reset(){this.clearWidgets()}clearWidgets(){ql.get(this.diffEditor.getOriginalEditor())?.hideContentHover(),ql.get(this.diffEditor.getModifiedEditor())?.hideContentHover(),jf.get(this.diffEditor.getOriginalEditor())?.hideGlyphHover(),jf.get(this.diffEditor.getModifiedEditor())?.hideGlyphHover()}async updateEditor(e,t){if(!Ni(e.element))return;let o=!!(e.edit.state?.applied??0);if(Z.editApplied.bindTo(this.contextKeyService).set(o),this.element.classList.toggle("no-diff",o),o){To(e.edit.state?.applied);let r=this.labelService.getUriLabel(e.edit.uri,{relative:!0,noPrefix:!0}),s;e.edit.state.applied===1?s=d(8926,null,r):e.edit.state.applied<0?s=d(8928,null,r):s=d(8927,null,e.edit.state.applied,r);let l=Jk(s,{renderCodeSegments:!0,actionHandler:{callback:()=>{this.openerService.open(e.edit.uri,{fromUserGesture:!0,allowCommands:!1})},disposables:this._store}});Ii(this.messageElement,l)}let n=await e.diffData;if(!t.isCancellationRequested){if(!o&&n){let r=this.diffEditor.createViewModel({original:n.original,modified:n.modified});if(await r.waitForDiff(),t.isCancellationRequested)return;let s=U.any(n.original.onWillDispose,n.modified.onWillDispose)(()=>{this.diffEditor.setModel(null)});this.diffEditor.setModel(r),this._lastDiffEditorViewModel.value=Fn(s,r)}else this.diffEditor.setModel(null),this._lastDiffEditorViewModel.value=void 0;this.toolbar.context={edit:e.edit,element:e.element,diffEditor:this.diffEditor,toggleDiffViewMode:()=>{let s=!!this.diffEditor.getModifiedEditor().contextKeyService.getContextKeyValue(me.diffEditorInlineMode.key);this.diffEditor.updateOptions({renderSideBySide:s,compactMode:!s,useInlineViewWhenSpaceIsLimited:!1}),this.layout()}}}}};qFe=I([m(5,F),m(6,X),m(7,_t),m(8,B),m(9,Ai),m(10,nt),m(11,Je)],qFe);var $Fe=class{constructor(i,e,t){this.modelService=i;this.editorService=e;this.dialogService=t;this._sha1=new Xhe}async apply(i,e,t){if(!i.response.value.includes(e)||e.state?.applied)return;if(!t)for(let n of this.editorService.listDiffEditors()){if(!n.getContainerDomNode().isConnected)continue;let r=n.getModel();if(!r||!ze(r.original.uri,e.uri)||r.modified.uri.scheme!==Q.vscodeChatCodeCompareBlock){t=n;break}}let o=t?await this._applyWithDiffEditor(t,e):await this._apply(e);i.setEditApplied(e,o)}async _applyWithDiffEditor(i,e){let t=i.getModel();if(!t)return 0;let o=i.getDiffComputationResult();if(!o||o.identical||!await this._checkSha1(t.original,e))return 0;let n=new aM(t.modified),r=o.changes2.map(s=>s.toRangeMapping().toTextEdit(n).toSingleEditOperation());return t.original.pushStackElement(),t.original.pushEditOperations(null,r,()=>null),t.original.pushStackElement(),r.length}async _apply(i){let e=await this.modelService.createModelReference(i.uri);try{if(!await this._checkSha1(e.object.textEditorModel,i))return 0;e.object.textEditorModel.pushStackElement();let t=0;for(let o of i.edits){let n=o.map(hT.asEditOperation);e.object.textEditorModel.pushEditOperations(null,n,()=>null),t+=n.length}return e.object.textEditorModel.pushStackElement(),t}finally{e.dispose()}}async _checkSha1(i,e){return!(e.state?.sha1&&this._sha1.computeSHA1(i)&&this._sha1.computeSHA1(i)!==e.state.sha1&&!(await this.dialogService.confirm({message:d(8929,null),detail:d(8930,null)})).confirmed)}discard(i,e){i.response.value.includes(e)&&(e.state?.applied||i.setEditApplied(e,-1))}};$Fe=I([m(0,Bt),m(1,Qt),m(2,ct)],$Fe);var uy=class extends k{constructor(){super(...arguments);this._extension=null}get extension(){return this._extension}set extension(e){this._extension=e,this.update()}update(){this.render()}};function mV(a,i){let e=new O;return e.add($(a,ne.CLICK,Nwe(i))),e.add($(a,ne.KEY_UP,t=>{let o=new mi(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var Hq=class extends uy{constructor(e){super();this.iconLoadingDisposable=this._register(new ue);this.iconErrorDisposable=this._register(new ue);this.element=D(e,_(".extension-icon")),this.iconElement=D(this.element,_("img.icon",{alt:""})),this.iconElement.style.display="none",this.defaultIconElement=D(this.element,_(q.asCSSSelector(cqt))),this.defaultIconElement.style.display="none",this.render(),this._register(ee(()=>this.clear()))}clear(){this.iconUrl=void 0,this.iconElement.src="",this.iconElement.style.display="none",this.defaultIconElement.style.display="none",this.iconErrorDisposable.clear(),this.iconLoadingDisposable.clear()}render(){if(!this.extension){this.clear();return}this.extension.iconUrl?this.iconUrl!==this.extension.iconUrl&&(this.iconElement.style.display="inherit",this.defaultIconElement.style.display="none",this.iconUrl=this.extension.iconUrl,this.iconErrorDisposable.value=$(this.iconElement,"error",()=>{this.extension?.iconUrlFallback?this.iconElement.src=this.extension.iconUrlFallback:(this.iconElement.style.display="none",this.defaultIconElement.style.display="inherit")},{once:!0}),this.iconElement.src=this.iconUrl,this.iconElement.complete?this.iconElement.style.visibility="inherit":(this.iconElement.style.visibility="hidden",this.iconLoadingDisposable.value=$(this.iconElement,"load",()=>{this.iconElement.style.visibility="inherit"}))):(this.iconUrl=void 0,this.iconElement.style.display="none",this.iconElement.src="",this.defaultIconElement.style.display="inherit",this.iconErrorDisposable.clear(),this.iconLoadingDisposable.clear())}},s1=class extends uy{constructor(e,t,o){super();this.container=e;this.small=t;this.hoverService=o;this.disposables=this._register(new O);this.render(),this._register(ee(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.extension||this.small&&this.extension.state!==3)return;let e=s1.getInstallLabel(this.extension,this.small);if(!e)return;let t=this.small?this.container:D(this.container,_("span.install",{tabIndex:0}));D(t,_("span"+q.asCSSSelector(fLi)));let o=D(t,_("span.count"));o.textContent=e,this.small||this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),this.container,d(11788,null)))}static getInstallLabel(e,t){let o=e.installCount;if(!o)return;let n;return t?o>1e6?n=`${Math.floor(o/1e5)/10}M`:o>1e3?n=`${Math.floor(o/1e3)}K`:n=String(o):n=o.toLocaleString(Kr),n}};s1=I([m(2,ot)],s1);var $oe=class extends uy{constructor(e,t,o,n){super();this.container=e;this.small=t;this.hoverService=o;this.openerService=n;this.disposables=this._register(new O);e.classList.add("extension-ratings"),this.small&&e.classList.add("small"),this.render(),this._register(ee(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.extension||this.small&&this.extension.state!==3||this.extension.rating===void 0||this.small&&!this.extension.ratingCount||!this.extension.url)return;let e=Math.round(this.extension.rating*2)/2;if(this.small){D(this.container,_("span"+q.asCSSSelector(Mnt)));let t=D(this.container,_("span.count"));t.textContent=String(e)}else{let t=D(this.container,_("span.rating.clickable",{tabIndex:0}));for(let o=1;o<=5;o++)e>=o?D(t,_("span"+q.asCSSSelector(Mnt))):e>=o-.5?D(t,_("span"+q.asCSSSelector(HIo))):D(t,_("span"+q.asCSSSelector(BKt)));if(this.extension.ratingCount){let o=D(t,_("span",void 0,` (${this.extension.ratingCount})`));o.style.paddingLeft="1px"}this.containerHover=this._register(this.hoverService.setupManagedHover(yi("mouse"),t,"")),this.containerHover.update(d(11795,null,e)),t.setAttribute("role","link"),this.extension.ratingUrl&&this.disposables.add(mV(t,()=>this.openerService.open(A.parse(this.extension.ratingUrl))))}}};$oe=I([m(2,ot),m(3,Je)],$oe);var joe=class extends uy{constructor(e,t,o,n,r){super();this.container=e;this.small=t;this.extensionsWorkbenchService=o;this.hoverService=n;this.openerService=r;this.disposables=this._register(new O);this.render(),this._register(ee(()=>this.clear()))}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.extension||this.extension.resourceExtension||this.extension.local?.source==="resource")return;this.element=D(this.container,_(".publisher"));let e=_(".publisher-name.ellipsis");e.textContent=this.extension.publisherDisplayName;let t=_(".verified-publisher");if(D(t,_("span.extension-verified-publisher.clickable"),un(dV)),this.small)this.extension.publisherDomain?.verified&&D(this.element,t),D(this.element,e);else{if(this.element.classList.toggle("clickable",!!this.extension.url),this.element.setAttribute("role","button"),this.element.tabIndex=0,this.containerHover=this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),this.element,d(11793,null,this.extension.publisherDisplayName))),D(this.element,e),this.extension.publisherDomain?.verified){D(this.element,t);let o=A.parse(this.extension.publisherDomain.link);t.tabIndex=0,t.setAttribute("role","button"),this.containerHover.update(d(11807,null,this.extension.publisherDomain.link)),t.setAttribute("role","link"),D(t,_("span.extension-verified-publisher-domain",void 0,o.authority.startsWith("www.")?o.authority.substring(4):o.authority)),this.disposables.add(mV(t,()=>this.openerService.open(o)))}this.extension.url&&this.disposables.add(mV(this.element,()=>this.extensionsWorkbenchService.openSearch(`publisher:"${this.extension?.publisherDisplayName}"`)))}}};joe=I([m(2,Ui),m(3,ot),m(4,Je)],joe);var jFe=class extends uy{constructor(e,t,o){super();this.container=e;this.hoverService=t;this.openerService=o;this.disposables=this._register(new O);this.render()}render(){if(Ii(this.container),this.disposables.clear(),!this.extension?.publisherSponsorLink)return;let e=D(this.container,_("span.sponsor.clickable",{tabIndex:0}));this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),e,this.extension?.publisherSponsorLink.toString()??"")),e.setAttribute("role","link");let t=un(Lnt),o=_("span",void 0,d(11800,null));D(e,t,o),this.disposables.add(mV(e,()=>{this.openerService.open(this.extension.publisherSponsorLink)}))}};jFe=I([m(1,ot),m(2,Je)],jFe);var QFe=class extends uy{constructor(e,t){super();this.parent=e;this.extensionRecommendationsService=t;this.disposables=this._register(new O);this.render(),this._register(ee(()=>this.clear())),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>this.render()))}clear(){this.element?.remove(),this.element=void 0,this.disposables.clear()}render(){if(this.clear(),!this.extension||this.extension.state===1||this.extension.deprecationInfo)return;if(this.extensionRecommendationsService.getAllRecommendationsWithReason()[this.extension.identifier.id.toLowerCase()]){this.element=D(this.parent,_("div.extension-bookmark"));let t=D(this.element,_(".recommendation"));D(t,_("span"+q.asCSSSelector(BIo)))}}};QFe=I([m(1,AR)],QFe);var pqt=class extends uy{constructor(e){super();this.parent=e;this.disposables=this._register(new O);this.render(),this._register(ee(()=>this.clear()))}clear(){this.element?.remove(),this.element=void 0,this.disposables.clear()}render(){if(this.clear(),this.extension?.state===1?this.extension.preRelease:this.extension?.hasPreReleaseVersion){this.element=D(this.parent,_("div.extension-bookmark"));let e=D(this.element,_(".pre-release"));D(e,_("span"+q.asCSSSelector(bLi)))}}},Qoe=class extends uy{constructor(e,t,o,n){super();this.tooltip=t;this.extensionManagementServerService=o;this.instantiationService=n;this.remoteBadge=this._register(new ue);this.element=D(e,_("")),this.render(),this._register(ee(()=>this.clear()))}clear(){this.remoteBadge.value?.element.remove(),this.remoteBadge.clear()}render(){if(this.clear(),!this.extension||!this.extension.local||!this.extension.server||!(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer)||this.extension.server!==this.extensionManagementServerService.remoteExtensionManagementServer)return;let e;this.tooltip&&this.extensionManagementServerService.remoteExtensionManagementServer&&(e=d(11797,null,this.extensionManagementServerService.remoteExtensionManagementServer.label)),this.remoteBadge.value=this.instantiationService.createInstance(Yfe,VIo,e),D(this.element,this.remoteBadge.value.element)}};Qoe=I([m(2,$c),m(3,F)],Qoe);var Yfe=class extends k{constructor(e,t,o,n,r){super();this.icon=e;this.tooltip=t;this.labelService=n;this.themeService=r;this.element=_("div.extension-badge.extension-icon-badge"),this.elementHover=this._register(o.setupManagedHover(yi("mouse"),this.element,"")),this.render()}render(){D(this.element,_("span"+q.asCSSSelector(this.icon)));let e=()=>{if(!this.element)return;let t=this.themeService.getColorTheme().getColor(rso),o=this.themeService.getColorTheme().getColor(sso);this.element.style.backgroundColor=t?t.toString():"",this.element.style.color=o?o.toString():""};if(e(),this._register(this.themeService.onDidColorThemeChange(()=>e())),this.tooltip){let t=()=>{this.element&&this.elementHover.update(this.tooltip)};this._register(this.labelService.onDidChangeFormatters(()=>t())),t()}}};Yfe=I([m(2,ot),m(3,nt),m(4,Pe)],Yfe);var mqt=class extends uy{constructor(e){super();this.parent=e;this.render(),this._register(ee(()=>this.clear()))}clear(){this.element?.remove(),this.countBadge?.dispose(),this.countBadge=void 0}render(){this.clear(),!(!this.extension||!this.extension.categories?.some(e=>e.toLowerCase()==="extension packs")||!this.extension.extensionPack.length)&&(this.element=D(this.parent,_(".extension-badge.extension-pack-badge")),this.countBadge=new eb(this.element,{},VI),this.countBadge.setCount(this.extension.extensionPack.length))}},Yoe=class extends uy{constructor(e,t,o,n,r,s,l,c){super();this.container=e;this.small=t;this.hoverService=o;this.contextService=n;this.uriIdentityService=r;this.explorerService=s;this.viewsService=l;this.extensionGalleryManifest=null;this.disposables=this._register(new O);this.render(),this._register(ee(()=>this.clear())),c.getExtensionGalleryManifest().then(u=>{this._store.isDisposed||(this.extensionGalleryManifest=u,this.render())})}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.extension)return;if(this.extension?.private){this.element=D(this.container,_(".extension-kind-indicator")),(!this.small||this.extensionGalleryManifest?.capabilities.extensions?.includePublicExtensions&&this.extensionGalleryManifest?.capabilities.extensions?.includePrivateExtensions)&&D(this.element,_("span"+q.asCSSSelector(vLi))),this.small||D(this.element,_("span.private-extension-label",void 0,d(11792,null)));return}if(!this.small)return;let e=this.extension.resourceExtension?.location??(this.extension.local?.source==="resource"?this.extension.local?.location:void 0);if(!e)return;this.element=D(this.container,_(".extension-kind-indicator"));let t=this.contextService.getWorkspaceFolder(e);t&&this.extension.isWorkspaceScoped?(this.element.textContent=d(11808,null),this.element.classList.add("clickable"),this.element.setAttribute("role","button"),this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),this.element,this.uriIdentityService.extUri.relativePath(t.uri,e))),this.disposables.add(mV(this.element,()=>{this.viewsService.openView(pS,!0).then(()=>this.explorerService.select(e,!0))}))):(this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),this.element,e.path)),this.element.textContent=d(11789,null))}};Yoe=I([m(2,ot),m(3,Ae),m(4,gt),m(5,Qa),m(6,Gt),m(7,tb)],Yoe);var YFe=class extends uy{constructor(e,t,o,n,r){super();this.container=e;this.configurationService=t;this.extensionsWorkbenchService=o;this.hoverService=n;this.userDataSyncEnablementService=r;this.disposables=this._register(new O);this._register(U.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("settingsSync.ignoredExtensions"))(()=>this.render())),this._register(r.onDidChangeEnablement(()=>this.update())),this.render()}render(){if(this.disposables.clear(),this.container.innerText="",this.extension&&this.extension.state===1&&this.userDataSyncEnablementService.isEnabled()&&this.extensionsWorkbenchService.isExtensionIgnoredToSync(this.extension)){let e=D(this.container,_("span.extension-sync-ignored"+q.asCSSSelector(Rnt)));this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),e,d(11802,null))),e.classList.add(...q.asClassNameArray(Rnt))}}};YFe=I([m(1,B),m(2,Ui),m(3,ot),m(4,Yl)],YFe);var XFe=class extends uy{constructor(e,t){super();this.container=e;this.hoverService=t;this.disposables=this._register(new O)}render(){this.disposables.clear(),this.container.innerText="";let e=this.extension?.runtimeState,t=typeof e?.reason=="string"?e.reason:"";if(e&&/restart|reload/i.test(t)){let o=D(this.container,_("span.extension-restart-required"+q.asCSSSelector(zIo)));D(this.container,_("span.extension-restart-required-label",void 0,d(11798,null))),this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),o,t))}}};XFe=I([m(1,ot)],XFe);var JFe=class extends uy{constructor(e,t,o,n,r){super();this.extensionViewState=e;this.container=t;this.extensionFeaturesManagementService=n;this.extensionsWorkbenchService=r;this._register(o.onDidChangeExtensionsStatus(s=>{this.extension&&s.some(l=>Ht({id:l.value},this.extension.identifier))&&this.update()})),this._register(n.onDidChangeAccessData(s=>{this.extension&&hi.equals(this.extension.identifier.id,s.extension)&&this.update()}))}render(){if(this.container.innerText="",!this.extension)return;if(this.extensionViewState.filters.featureId&&this.extension.state===1){let t=this.extensionFeaturesManagementService.getAllAccessDataForExtension(new hi(this.extension.identifier.id)).get(this.extensionViewState.filters.featureId),o=oe.as(qs.ExtensionFeaturesRegistry).getExtensionFeature(this.extensionViewState.filters.featureId);if(o?.icon&&t){let n=D(this.container,_("span.activationTime"));n.textContent=d(11785,null,t.accessTimes.length);let r=D(this.container,_("span"+q.asCSSSelector(o.icon)));r.style.paddingLeft="4px";return}}let e=this.extensionsWorkbenchService.getExtensionRuntimeStatus(this.extension);if(e?.activationTimes){let t=e.activationTimes.codeLoadingTime+e.activationTimes.activateCallTime;D(this.container,_("span"+q.asCSSSelector(UIo)));let o=D(this.container,_("span.activationTime"));o.textContent=`${t}ms`}}};JFe=I([m(2,lt),m(3,Qy),m(4,Ui)],JFe);var Xoe=class extends uy{constructor(e,t,o,n,r,s,l,c,u){super();this.options=e;this.extensionStatusAction=t;this.extensionsWorkbenchService=o;this.extensionFeaturesManagementService=n;this.hoverService=r;this.configurationService=s;this.extensionRecommendationsService=l;this.themeService=c;this.contextService=u;this.hover=this._register(new ue)}render(){this.hover.value=void 0,this.extension&&(this.hover.value=this.hoverService.setupManagedHover({delay:this.configurationService.getValue("workbench.hover.delay"),showHover:(e,t)=>this.hoverService.showInstantHover({...e,additionalClasses:["extension-hover"],position:{hoverPosition:this.options.position(),forcePosition:!0},persistence:{hideOnKeyDown:!0}},t),placement:"element"},this.options.target,{markdown:()=>Promise.resolve(this.getHoverMarkdown()),markdownNotSupportedFallback:void 0},{appearance:{showHoverHint:!0}}))}getHoverMarkdown(){if(!this.extension)return;let e=new he("",{isTrusted:!0,supportThemeIcons:!0});e.appendMarkdown("**").appendText(this.extension.displayName).appendMarkdown("**"),wDe(this.extension.version)&&e.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">**&nbsp;_v${this.extension.version}${this.extension.isPreReleaseVersion?" (pre-release)":""}_**&nbsp;</span>`),e.appendText(`
`);let t=!1;if(this.extension.private&&(e.appendMarkdown(`$(${vLi.id}) ${d(11792,null)}`),t=!0),this.extension.state===1){let p=s1.getInstallLabel(this.extension,!0);if(p&&(t&&e.appendText("  |  "),e.appendMarkdown(`$(${fLi.id}) ${p}`),t=!0),this.extension.rating){t&&e.appendText("  |  ");let h=Math.round(this.extension.rating*2)/2;e.appendMarkdown(`$(${Mnt.id}) [${h}](${this.extension.url}&ssr=false#review-details)`),t=!0}this.extension.publisherSponsorLink&&(t&&e.appendText("  |  "),e.appendMarkdown(`$(${Lnt.id}) [${d(11800,null)}](${this.extension.publisherSponsorLink})`),t=!0)}t&&e.appendText(`
`);let o=this.extension.resourceExtension?.location??(this.extension.local?.source==="resource"?this.extension.local?.location:void 0);if(o&&(this.extension.isWorkspaceScoped&&this.contextService.isInsideWorkspace(o)?e.appendMarkdown(d(11808,null)):e.appendMarkdown(d(11789,null)),e.appendText(`
`)),this.extension.description&&(e.appendText(this.extension.description),e.appendText(`
`)),this.extension.publisherDomain?.verified){let p=this.themeService.getColorTheme().getColor(Ist),h=d(11794,null,`[${A.parse(this.extension.publisherDomain.link).authority}](${this.extension.publisherDomain.link})`);e.appendMarkdown(`<span style="color:${p?Ue.Format.CSS.formatHex(p):"#ffffff"};">$(${dV.id})</span>&nbsp;${h}`),e.appendText(`
`)}this.extension.outdated&&(e.appendMarkdown(d(11806,null)),e.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">**&nbsp;_v${this.extension.latestVersion}_**&nbsp;</span>`),e.appendText(`
`));let n=Xoe.getPreReleaseMessage(this.extension),r=this.extensionsWorkbenchService.getExtensionRuntimeStatus(this.extension),s=this.extensionFeaturesManagementService.getAllAccessDataForExtension(new hi(this.extension.identifier.id)),l=this.extensionStatusAction.status,c=this.extension.runtimeState,u=this.getRecommendationMessage(this.extension);if(r||s.size||l.length||c||u||n){if(e.appendMarkdown("---"),e.appendText(`
`),r){if(r.activationTimes){let p=r.activationTimes.codeLoadingTime+r.activationTimes.activateCallTime;e.appendMarkdown(`${d(11780,null)}${r.activationTimes.activationReason.startup?` (${d(11801,null)})`:""}: \`${p}ms\``),e.appendText(`
`)}if(r.runtimeErrors.length||r.messages.length){let p=r.runtimeErrors.length||r.messages.some(v=>v.type===wt.Error),h=r.messages.some(v=>v.type===wt.Warning),g=r.runtimeErrors.length?`[${r.runtimeErrors.length===1?d(11804,null):d(11805,null,r.runtimeErrors.length)}](${nc("extension.open",this.extension.identifier.id,"features")})`:void 0,f=r.messages.length?`[${r.messages.length===1?d(11790,null):d(11791,null,r.messages.length)}](${nc("extension.open",this.extension.identifier.id,"features")})`:void 0;e.appendMarkdown(`$(${p?cI.id:h?fp.id:Ef.id}) This extension has reported `),g&&f?e.appendMarkdown(`${g} and ${f}`):e.appendMarkdown(`${g||f}`),e.appendText(`
`)}}if(s.size){let p=oe.as(qs.ExtensionFeaturesRegistry);for(let[h,g]of s)if(g?.accessTimes.length){let f=p.getExtensionFeature(h);f&&(e.appendMarkdown(d(11786,null,f.label)),e.appendMarkdown(`: [${d(11803,null,g.accessTimes.length,f.accessDataLabel??f.label)}](${nc("extension.open",this.extension.identifier.id,"features")})`),e.appendText(`
`))}}for(let p of l)p.icon&&e.appendMarkdown(`$(${p.icon.id})&nbsp;`),e.appendMarkdown(p.message.value),e.appendText(`
`);if(c&&(e.appendMarkdown(`$(${Ef.id})&nbsp;`),e.appendMarkdown(`${c.reason}`),e.appendText(`
`)),n){let p=this.themeService.getColorTheme().getColor(ndn);e.appendMarkdown(`<span style="color:${p?Ue.Format.CSS.formatHex(p):"#ffffff"};">$(${bLi.id})</span>&nbsp;${n}`),e.appendText(`
`)}u&&(e.appendMarkdown(u),e.appendText(`
`))}return e}getRecommendationMessage(e){if(e.state===1||e.deprecationInfo)return;let t=this.extensionRecommendationsService.getAllRecommendationsWithReason()[e.identifier.id.toLowerCase()];if(!t?.reasonText)return;let o=this.themeService.getColorTheme().getColor(GIo);return`<span style="color:${o?Ue.Format.CSS.formatHex(o):"#ffffff"};">$(${BKt.id})</span>&nbsp;${t.reasonText}`}static getPreReleaseMessage(e){if(!e.hasPreReleaseVersion||e.isBuiltin||e.isPreReleaseVersion||e.preRelease)return;let t=`[${d(11799,null)}](${nc("workbench.extensions.action.showPreReleaseVersion",e.identifier.id)})`;return d(11787,null,t)}};Xoe=I([m(2,Ui),m(3,Qy),m(4,ot),m(5,B),m(6,AR),m(7,Pe),m(8,Ae)],Xoe);var ZFe=class extends uy{constructor(e,t,o){super();this.container=e;this.extensionStatusAction=t;this.markdownRendererService=o;this.renderDisposables=this._register(new ue);this._onDidRender=this._register(new T);this.onDidRender=this._onDidRender.event;this.render(),this._register(t.onDidChangeStatus(()=>this.render()))}render(){Ii(this.container),this.renderDisposables.value=void 0;let e=new O;this.renderDisposables.value=e;let t=this.extensionStatusAction.status;if(t.length){let o=new he("",{isTrusted:!0,supportThemeIcons:!0});for(let r=0;r<t.length;r++){let s=t[r];s.icon&&o.appendMarkdown(`$(${s.icon.id})&nbsp;`),o.appendMarkdown(s.message.value),r<t.length-1&&o.appendText(`
`)}let n=e.add(this.markdownRendererService.render(o));D(this.container,n.element)}this._onDidRender.fire()}};ZFe=I([m(2,_n)],ZFe);var e0e=class extends uy{constructor(e,t,o){super();this.container=e;this.extensionRecommendationsService=t;this.extensionIgnoredRecommendationsService=o;this._onDidRender=this._register(new T);this.onDidRender=this._onDidRender.event;this.render(),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>this.render()))}render(){Ii(this.container);let e=this.getRecommendationStatus();e&&(e.icon&&D(this.container,_(`div${q.asCSSSelector(e.icon)}`)),D(this.container,_("div.recommendation-text",void 0,e.message))),this._onDidRender.fire()}getRecommendationStatus(){if(!this.extension||this.extension.deprecationInfo||this.extension.state===1)return;let e=this.extensionRecommendationsService.getAllRecommendationsWithReason();if(e[this.extension.identifier.id.toLowerCase()]){let t=e[this.extension.identifier.id.toLowerCase()].reasonText;if(t)return{icon:BKt,message:t}}else if(this.extensionIgnoredRecommendationsService.globalIgnoredRecommendations.indexOf(this.extension.identifier.id.toLowerCase())!==-1)return{icon:void 0,message:d(11796,null)}}};e0e=I([m(1,AR),m(2,RE)],e0e);var odn=te("extensionIcon.starForeground",{light:"#DF6100",dark:"#FF8E00",hcDark:"#FF8E00",hcLight:AS},d(11783,null),!1),ndn=te("extensionIcon.preReleaseForeground",{dark:"#1d9271",light:"#1d9271",hcDark:"#1d9271",hcLight:AS},d(11784,null),!1),oMp=te("extensionIcon.sponsorForeground",{light:"#B51E78",dark:"#D758B3",hcDark:null,hcLight:"#B51E78"},d(11782,null),!1),rdn=te("extensionIcon.privateForeground",{dark:"#ffffff60",light:"#00000060",hcDark:"#ffffff60",hcLight:"#00000060"},d(11781,null));hs((a,i)=>{let e=a.getColor(odn);e&&(i.addRule(`.extension-ratings .codicon-extensions-star-full, .extension-ratings .codicon-extensions-star-half { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(Mnt)} { color: ${e}; }`));let t=a.getColor(Ist);t&&i.addRule(`${q.asCSSSelector(dV)} { color: ${t}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(Lnt)} { color: var(--vscode-extensionIcon-sponsorForeground); }`),i.addRule(`.extension-editor > .header > .details > .subtitle .sponsor ${q.asCSSSelector(Lnt)} { color: var(--vscode-extensionIcon-sponsorForeground); }`);let o=a.getColor(rdn);o&&i.addRule(`.extension-private-badge { color: ${o}; }`)});var sdn=72,t0e=class{getHeight(){return sdn}getTemplateId(){return"extension"}},Xfe=class{constructor(i,e,t,o,n,r,s,l){this.extensionViewState=i;this.options=e;this.instantiationService=t;this.notificationService=o;this.extensionService=n;this.extensionsWorkbenchService=r;this.extensionEnablementService=s;this.contextMenuService=l}get templateId(){return"extension"}renderTemplate(i){let e=this.instantiationService.createInstance(QFe,D(i,_(".extension-bookmark-container"))),t=this.instantiationService.createInstance(pqt,D(i,_(".extension-bookmark-container"))),o=D(i,_(".extension-list-item")),n=D(o,_(".icon-container")),r=this.instantiationService.createInstance(Hq,n),s=this.instantiationService.createInstance(Qoe,n,!1),l=this.instantiationService.createInstance(mqt,n),c=D(o,_(".details")),u=D(c,_(".header-container")),p=D(u,_(".header")),h=D(p,_("span.name")),g=D(p,_("span.restart-required")),f=D(p,_("span.install-count")),v=D(p,_("span.ratings")),b=D(p,_("span.sync-ignored")),S=D(p,_("span")),y=D(p,_("span.activation-status")),w=D(c,_(".description.ellipsis")),x=D(c,_(".footer")),E=this.instantiationService.createInstance(joe,D(x,_(".publisher-container")),!0),M=new oo(x,{actionViewItemProvider:(ae,ce)=>{if(ae instanceof Tq)return new GNe(ae,{...ce,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>ae.menuActions},menuActionClassNames:ae.menuActionClassNames},this.contextMenuService);if(ae instanceof $U)return ae.createActionViewItem(ce)},focusOnlyEnabledItems:!0});M.setFocusable(!1);let N=M.onDidRun(({error:ae})=>ae&&this.notificationService.error(ae)),V=this.instantiationService.createInstance(BR),H=[this.instantiationService.createInstance(ZW),this.instantiationService.createInstance(JW,!0),this.instantiationService.createInstance(ZN,!1),this.instantiationService.createInstance(zie),this.instantiationService.createInstance(qNe),this.instantiationService.createInstance(yP),this.instantiationService.createInstance(dk),this.instantiationService.createInstance(kQ,!1),this.instantiationService.createInstance(Kie),this.instantiationService.createInstance(Gie),V,this.instantiationService.createInstance(eO)],K=this.instantiationService.createInstance(Xoe,{target:i,position:this.options.hoverOptions.position},V),j=[r,e,t,s,l,E,K,this.instantiationService.createInstance(YFe,b),this.instantiationService.createInstance(XFe,g),this.instantiationService.createInstance(JFe,this.extensionViewState,y),this.instantiationService.createInstance(s1,f,!0),this.instantiationService.createInstance($oe,v,!0),this.instantiationService.createInstance(Yoe,S,!0)],J=this.instantiationService.createInstance(bee,[...H,...j]);M.push(H,{icon:!0,label:!0});let se=Fn(...H,...j,M,N,J);return{root:i,element:o,name:h,installCount:f,ratings:v,description:w,disposables:[se],actionbar:M,extensionDisposables:[],set extension(ae){J.extension=ae}}}renderPlaceholder(i,e){e.element.classList.add("loading"),e.root.removeAttribute("aria-label"),e.root.removeAttribute("data-extension-id"),e.extensionDisposables=je(e.extensionDisposables),e.name.textContent="",e.description.textContent="",e.installCount.style.display="none",e.ratings.style.display="none",e.extension=null}renderElement(i,e,t){t.element.classList.remove("loading"),t.root.setAttribute("data-extension-id",i.identifier.id),i.state!==3&&!i.server&&(i=this.extensionsWorkbenchService.local.filter(n=>n.server===i.server&&Ht(n.identifier,i.identifier))[0]||i),t.extensionDisposables=je(t.extensionDisposables);let o=()=>{let n=i.state===1&&!!i.local&&!this.extensionEnablementService.isEnabled(i.local),r=!!i.deprecationInfo;t.element.classList.toggle("deprecated",r),t.root.classList.toggle("disabled",n)};o(),this.extensionService.onDidChangeExtensions(()=>o(),this,t.extensionDisposables),t.name.textContent=i.displayName,t.description.textContent=i.description,t.installCount.style.display="",t.ratings.style.display="",t.extension=i,i.gallery&&i.gallery.properties&&i.gallery.properties.localizedLanguages&&i.gallery.properties.localizedLanguages.length&&(t.description.textContent=i.gallery.properties.localizedLanguages.map(n=>n[0].toLocaleUpperCase()+n.slice(1)).join(", ")),this.extensionViewState.onFocus(n=>{Ht(i.identifier,n.identifier)&&t.actionbar.setFocusable(!0)},this,t.extensionDisposables),this.extensionViewState.onBlur(n=>{Ht(i.identifier,n.identifier)&&t.actionbar.setFocusable(!1)},this,t.extensionDisposables)}disposeElement(i,e,t){t.extensionDisposables=je(t.extensionDisposables)}disposeTemplate(i){i.extensionDisposables=je(i.extensionDisposables),i.disposables=je(i.disposables)}};Xfe=I([m(2,F),m(3,Ne),m(4,lt),m(5,Ui),m(6,As),m(7,Xe)],Xfe);hs((a,i)=>{let e=a.getColor(Ist);if(e){let t=e.transparent(.5).makeOpaque(_0(a));i.addRule(`.extensions-list .monaco-list .monaco-list-row.disabled:not(.selected) .author .verified-publisher ${q.asCSSSelector(dV)} { color: ${t}; }`)}});function _xo(a){return{isResolved:!!a,promise:null,cts:null,promiseIndexes:new Set,elements:a||[]}}function hAi(a){return{firstPage:a,total:a.length,pageSize:a.length,getPage:(i,e)=>Promise.resolve(a)}}var hh=class{constructor(i){this.pages=[];this.onDidIncrementLength=U.None;this.pager=Array.isArray(i)?hAi(i):i;let e=Math.ceil(this.pager.total/this.pager.pageSize);this.pages=[_xo(this.pager.firstPage.slice()),...tf(e-1).map(()=>_xo())]}get length(){return this.pager.total}isResolved(i){let e=Math.floor(i/this.pager.pageSize);return!!this.pages[e].isResolved}get(i){let e=Math.floor(i/this.pager.pageSize),t=i%this.pager.pageSize;return this.pages[e].elements[t]}resolve(i,e){if(e.isCancellationRequested)return Promise.reject(new qi);let t=Math.floor(i/this.pager.pageSize),o=i%this.pager.pageSize,n=this.pages[t];if(n.isResolved)return Promise.resolve(n.elements[o]);n.promise||(n.cts=new qe,n.promise=this.pager.getPage(t,n.cts.token).then(s=>{n.elements=s,n.isResolved=!0,n.promise=null,n.cts=null},s=>(n.isResolved=!1,n.promise=null,n.cts=null,Promise.reject(s))));let r=e.onCancellationRequested(()=>{n.cts&&(n.promiseIndexes.delete(i),n.promiseIndexes.size===0&&n.cts.cancel())});return n.promiseIndexes.add(i),n.promise.then(()=>n.elements[o]).finally(()=>r.dispose())}},u6=class{constructor(i,e=500){this.model=i;this.timeout=e}get length(){return this.model.length}get onDidIncrementLength(){return this.model.onDidIncrementLength}isResolved(i){return this.model.isResolved(i)}get(i){return this.model.get(i)}resolve(i,e){return new Promise((t,o)=>{if(e.isCancellationRequested)return o(new qi);let n=setTimeout(()=>{if(e.isCancellationRequested)return o(new qi);r.dispose(),this.model.resolve(i,e).then(t,o)},this.timeout),r=e.onCancellationRequested(()=>{clearTimeout(n),r.dispose(),o(new qi)})})}};var hqt=class{constructor(i){this.items=[];this._hasNextPage=!0;this._onDidIncrementLength=new T;this.loadingPromise=null;this.pager=i,this.items=[...i.firstPage.items],this._hasNextPage=i.firstPage.hasMore}get onDidIncrementLength(){return this._onDidIncrementLength.event}get length(){return this.items.length+(this._hasNextPage?1:0)}isResolved(i){return i===this.items.length&&this._hasNextPage?!1:i<this.items.length}get(i){if(i<this.items.length)return this.items[i];throw new Error("Item not resolved yet")}async resolve(i,e){if(e.isCancellationRequested)return Promise.reject(new qi);if(i===this.items.length&&this._hasNextPage&&await this.loadNextPage(e),i<this.items.length)return this.items[i];throw new Error("Index out of bounds")}async loadNextPage(i){if(!this._hasNextPage)return;if(this.loadingPromise){await this.loadingPromise;return}let e=this.pager.getNextPage(i);this.loadingPromise=e.then(t=>{this.items.push(...t.items),this._hasNextPage=t.hasMore,this.loadingPromise=null,this._onDidIncrementLength.fire(this.length)},t=>{throw this.loadingPromise=null,t}),await this.loadingPromise}dispose(){this._onDidIncrementLength.dispose()}};function Dxo(a){if(!a)return"";let i=a.publisherDomain?.verified?d(11723,null,a.publisherDisplayName):d(11721,null,a.publisherDisplayName),e=a?.deprecationInfo?d(11720,null):"",t=a?.rating?d(11722,null,a.rating.toFixed(2),a.ratingCount):"";return`${a.displayName}, ${e?`${e}, `:""}${a.version}, ${i}, ${a.description} ${t?`, ${t}`:""}`}var Joe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.extensionsWorkbenchService=r;this.contextMenuService=u;this.contextKeyService=p;this.instantiationService=h;this.logService=g;this.contextMenuActionRunner=this._register(new cs);this.modalNavigationDisposable=this._register(new ue);this._register(this.contextMenuActionRunner.onDidRun(({error:b})=>b&&c.error(b)));let f=new t0e,v=h.createInstance(Xfe,n,{hoverOptions:{position:()=>{let b=s.getViewLocationById(t);return b===0?l.getSideBarPosition()===0?1:0:b===2?l.getSideBarPosition()===0?0:1:1}}});this.list=h.createInstance(r2,`${t}-Extensions`,e,f,[v],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(b){return Dxo(b)},getWidgetAriaLabel(){return d(11724,null)}},overrideStyles:IG(s.getViewLocationById(t)).listOverrideStyles,openOnSingleClick:!0,...o}),this._register(this.list.onContextMenu(b=>this.onContextMenu(b),this)),this._register(this.list),this._register(U.debounce(U.filter(this.list.onDidOpen,b=>b.element!==null),(b,S)=>S,75,!0)(b=>{this.openExtension(b.element,{sideByside:b.sideBySide,...b.editorOptions})}))}setModel(e){this.list.model=new u6(e)}layout(e,t){this.list.layout(e,t)}openExtension(e,t){e=this.extensionsWorkbenchService.local.filter(o=>Ht(o.identifier,e.identifier))[0]||e,this.extensionsWorkbenchService.open(e,{...t,modal:t.sideByside?void 0:vAi(e,()=>this.list.model,(o,n)=>Ht(o.identifier,n.identifier),(o,n)=>this.extensionsWorkbenchService.open(o,{pinned:!1,modal:n}),this.modalNavigationDisposable,this.logService)})}async onContextMenu(e){if(e.element){let t=new O,o=t.add(this.instantiationService.createInstance(eO)),n=e.element&&this.extensionsWorkbenchService.local.find(l=>Ht(l.identifier,e.element.identifier)&&(!e.element.server||e.element.server===l.server))||e.element;o.extension=n;let r=[];o.enabled?r=await o.getActionGroups():n&&(r=await yLi(n,this.contextKeyService,this.instantiationService),r.forEach(l=>l.forEach(c=>{c instanceof Ks&&(c.extension=n)})));let s=[];for(let l of r){for(let c of l)s.push(c),Sd(c)&&t.add(c);s.push(new oi)}s.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,actionRunner:this.contextMenuActionRunner,onHide:()=>t.dispose()})}}};Joe=I([m(4,Ui),m(5,ji),m(6,wi),m(7,Ne),m(8,Xe),m(9,X),m(10,F),m(11,re)],Joe);var i0e=class extends k{constructor(e,t,o){super();this.instantiationService=o;this.element=D(e,_(".extensions-grid-view")),this.renderer=this.instantiationService.createInstance(Xfe,{onFocus:U.None,onBlur:U.None,filters:{}},{hoverOptions:{position(){return 2}}}),this.delegate=t,this.disposableStore=this._register(new O)}setExtensions(e){this.disposableStore.clear(),e.forEach((t,o)=>this.renderExtension(t,o))}renderExtension(e,t){let o=D(this.element,_(".extension-container"));o.style.height=`${this.delegate.getHeight()}px`,o.setAttribute("tabindex","0");let n=this.renderer.renderTemplate(o);this.disposableStore.add(ee(()=>this.renderer.disposeTemplate(n)));let r=this.instantiationService.createInstance(o0e);r.extension=e,n.name.setAttribute("tabindex","0");let s=l=>{l instanceof mi&&l.keyCode!==3||(r.run(l.ctrlKey||l.metaKey),l.stopPropagation(),l.preventDefault())};this.disposableStore.add($(n.name,ne.CLICK,l=>s(new Ln(Me(n.name),l)))),this.disposableStore.add($(n.name,ne.KEY_DOWN,l=>s(new mi(l)))),this.disposableStore.add($(o,ne.KEY_DOWN,l=>s(new mi(l)))),this.renderer.renderElement(e,t,n)}};i0e=I([m(2,F)],i0e);var gAi=class{hasChildren({hasChildren:i}){return i}getChildren(i){return i.getChildren()}},fAi=class{getHeight(i){return 62}getTemplateId({extension:i}){return i?Zoe.TEMPLATE_ID:gqt.TEMPLATE_ID}},Zoe=class{constructor(i){this.instantiationService=i}static{this.TEMPLATE_ID="extension-template"}get templateId(){return Zoe.TEMPLATE_ID}renderTemplate(i){i.classList.add("extension");let e=this.instantiationService.createInstance(Hq,i),t=D(i,_(".details")),o=D(t,_(".header")),n=D(o,_("span.name")),r=this.instantiationService.createInstance(o0e),s=[$(n,"click",p=>{r.run(p.ctrlKey||p.metaKey),p.stopPropagation(),p.preventDefault()}),e,r],l=D(o,_("span.identifier")),c=D(t,_(".footer")),u=D(c,_(".author"));return{name:n,identifier:l,author:u,extensionDisposables:s,set extensionData(p){e.extension=p.extension,r.extension=p.extension}}}renderElement(i,e,t){let o=i.element.extension;t.name.textContent=o.displayName,t.identifier.textContent=o.identifier.id,t.author.textContent=o.publisherDisplayName,t.extensionData=i.element}disposeTemplate(i){i.extensionDisposables=je(i.extensionDisposables)}};Zoe=I([m(0,F)],Zoe);var gqt=class a{static{this.TEMPLATE_ID="unknown-extension-template"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){let e=D(i,_("div.unknown-extension"));return D(e,_("span.error-marker")).textContent=d(11719,null),D(e,_("span.message")).textContent=d(11725,null),{identifier:D(e,_("span.message"))}}renderElement(i,e,t){t.identifier.textContent=i.element.extension.identifier.id}disposeTemplate(i){}},o0e=class extends it{constructor(e){super("extensions.action.openExtension","");this.extensionsWorkdbenchService=e}set extension(e){this._extension=e}run(e){return this._extension?this.extensionsWorkdbenchService.open(this._extension,{sideByside:e}):Promise.resolve()}};o0e=I([m(0,Ui)],o0e);var n0e=class extends Rp{constructor(i,e,t,o,n,r,s,l){let c=new fAi,u=new gAi,p=[r.createInstance(Zoe),r.createInstance(gqt)],h={getId({extension:g,parent:f}){return f?this.getId(f)+"/"+g.identifier.id:g.identifier.id}};super("ExtensionsTree",e,c,p,u,{indent:40,identityProvider:h,multipleSelectionSupport:!1,overrideStyles:t,accessibilityProvider:{getAriaLabel(g){return Dxo(g.extension)},getWidgetAriaLabel(){return d(11724,null)}}},r,o,n,s),this.setInput(i),this.disposables.add(this.onDidChangeSelection(g=>{sf(g.browserEvent)&&l.open(g.elements[0].extension,{sideByside:!1})}))}};n0e=I([m(3,X),m(4,Co),m(5,F),m(6,B),m(7,Ui)],n0e);var fqt=class a{constructor(i,e,t,o){this.extension=i,this.parent=e,this.getChildrenExtensionIds=t,this.extensionsWorkbenchService=o,this.childrenExtensionIds=this.getChildrenExtensionIds(i)}get hasChildren(){return Rr(this.childrenExtensionIds)}async getChildren(){return this.hasChildren?(await yst(this.childrenExtensionIds,this.extensionsWorkbenchService)).map(e=>new a(e,this,this.getChildrenExtensionIds,this.extensionsWorkbenchService)):null}};async function yst(a,i){let e=i.local.reduce((n,r)=>(n.set(r.identifier.id.toLowerCase(),r),n),new Map),t=[],o=[];for(let n of a){let r=n.toLowerCase(),s=e.get(r);s?t.push(s):o.push(r)}if(o.length){let n=await i.getExtensions(o.map(r=>({id:r})),Ie.None);t.push(...n)}return t}function vAi(a,i,e,t,o,n){let r=i();if(!r)return;let s=r.length;if(s<=1)return;let l=-1;for(let h=0;h<s;h++)if(r.isResolved(h)&&e(r.get(h),a)){l=h;break}if(l===-1)return;let c=(h,g)=>{let f=i()?.length??0;t(g,{navigation:{total:f,current:h,navigate:p}})},u,p=h=>{u?.cancel(),u=o.value=new qe;let g=u.token,f=i();!f||h<0||h>=f.length||(f.isResolved(h)?c(h,f.get(h)):f.resolve(h,g).then(v=>{g.isCancellationRequested||c(h,v)},v=>{Yi(v)||n.error(`Error while resolving item at index ${h} for modal navigation`,v)}))};return{navigation:{total:s,current:l,navigate:p}}}hs((a,i)=>{let e=a.getColor(lX);e&&i.addRule(`.extensions-grid-view .extension-container:focus { background-color: ${e}; outline: none; }`);let t=a.getColor(FCe);t&&i.addRule(`.extensions-grid-view .extension-container:focus { color: ${t}; }`);let o=a.getColor(xo),n=a.getColor(Bo);if(o&&n){let r=o.transparent(.9).makeOpaque(n);i.addRule(`.extensions-grid-view .extension-container:not(.disabled) .author { color: ${r}; }`);let s=o.transparent(.5).makeOpaque(n);i.addRule(`.extensions-grid-view .extension-container.disabled { color: ${s}; }`)}});var Uq=class extends k{constructor(e,t,o){super();this.extensionsContent=e;this.domNode=_(".chat-extensions-content-part");let n=D(this.domNode,_(".loading-extensions-element"));D(n,_(q.asCSSSelector(q.modify(L.loading,"spin"))),_("span.loading-message",void 0,d(8701,null)));let r=D(this.domNode,_(".extensions-list")),s=this._register(o.createInstance(Joe,r,Xr,{alwaysConsumeMouseWheel:!1},{onFocus:U.None,onBlur:U.None,filters:{}}));yst(e.extensions,t).then(l=>{n.remove(),!this._store.isDisposed&&(s.setModel(new hh(l)),s.layout())})}get codeblocks(){return[]}get codeblocksPartId(){}hasSameContent(e,t,o){return e.kind==="extensions"&&e.extensions.length===this.extensionsContent.extensions.length&&e.extensions.every(n=>this.extensionsContent.extensions.includes(n))}addDisposable(e){this._register(e)}};Uq=I([m(1,Ui),m(2,F)],Uq);function vqt(a){return a.source?.type==="mcp"||a.toolId.toLowerCase().includes("mcp")}function r0e(a){return vqt(a)?!pi.isComplete(a):(a.toolId==="copilot_askQuestions"||a.toolId==="vscode_askQuestions",!1)}function ene(a){let i=pi.executionConfirmedOrDenied(a);if(!(!i||typeof i=="boolean"))return adn(i)}function adn(a){let i;switch(a.type){case 2:i=d(9021,null,Xw({text:"`"+a.id+"`",id:"workbench.action.openSettings",arguments:[a.id],tooltip:d(9024,null)},!1));break;case 3:i=a.scope==="session"?d(9019,null):a.scope==="workspace"?d(9020,null):d(9018,null),i+=" ("+Xw({text:d(9022,null),id:"workbench.action.chat.editToolApproval",arguments:[a.scope],tooltip:d(9023,null)})+")";break;case 1:return a.reason?typeof a.reason=="string"?new he(a.reason,{isTrusted:!0}):a.reason:void 0;case 4:case 0:default:return}return new he(i,{isTrusted:!0})}var O_=class extends k{constructor(e,t,o,n,r){super();this.title=e;this.hoverMessage=o;this.hoverService=n;this._renderedTitleWithWidgets=this._register(new ue);this._isExpanded=De(this,!1);this._overrideIcon=De(this,void 0);this._contentInitialized=!1;this.element=t.element,this.hasFollowingContent=t.contentIndex+1<t.content.length,this._showCheckmarks=hr("accessibility.chat.showCheckmarks",!1,r)}get icon(){return this._overrideIcon.get()}set icon(e){this._overrideIcon.set(e,void 0)}get domNode(){return this._domNode??=this.init(),this._domNode}init(){let e=this.title,t=_(".chat-used-context-label",void 0),o=this._register(new lM(t,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0}));this._collapseButton=o,this._domNode=_(".chat-used-context",void 0,t),o.label=e;let n=_("span.chat-collapsible-hover-chevron.codicon.codicon-chevron-right",{"aria-hidden":"true"});return o.element.appendChild(n),this.hoverMessage&&this._register(this.hoverService.setupDelayedHover(o.iconElement,{content:this.hoverMessage,style:1})),this._register(o.onDidClick(()=>{let r=this._isExpanded.get();this._isExpanded.set(!r,void 0)})),this._isExpanded.set(this.isExpanded(),void 0),this._register(ve(r=>{let s=this._isExpanded.read(r),l=this._overrideIcon.read(r),c=this._showCheckmarks.read(r);l&&(o.icon=l),this._domNode?.classList.toggle("show-checkmarks",c),n.classList.toggle("codicon-chevron-right",!s),n.classList.toggle("codicon-chevron-down",s),this._domNode?.classList.toggle("chat-used-context-collapsed",!s),this.updateAriaLabel(o.element,typeof e=="string"?e:e.value,s),(s||this.shouldInitEarly())&&!this._contentInitialized&&(this._contentInitialized=!0,this._contentElement=this.initContent(),this._domNode?.appendChild(this._contentElement))})),this._domNode}shouldInitEarly(){return!1}updateAriaLabel(e,t,o){e.ariaLabel=t,e.ariaExpanded=String(o)}addDisposable(e){this._register(e)}get expanded(){return this._isExpanded}isExpanded(){return this._isExpanded.get()}setExpanded(e){this._isExpanded.set(e,void 0)}setTitle(e){this.title=e,this._collapseButton&&(this._collapseButton.label=e,this.updateAriaLabel(this._collapseButton.element,e,this.isExpanded()))}setTitleWithWidgets(e,t,o,n){if(this._store.isDisposed||!this._collapseButton)return;let r=n.render(e);r.element.classList.add("collapsible-title-content"),N_(r.element,t,o,this._store);let s=this._collapseButton.labelElement;s.textContent="",s.appendChild(r.element);let l=r.element.textContent||"";this.updateAriaLabel(this._collapseButton.element,l,this.isExpanded()),this._renderedTitleWithWidgets.value=r}};O_=I([m(3,ot),m(4,B)],O_);var ine=class extends k{constructor(e,t,o,n){super();this.instantiationService=t;this.languageModelsService=o;this.chatAttachmentWidgetRegistry=n;this.attachedContextDisposables=this._register(new O);this._onDidChangeVisibility=this._register(new T);this._showingAll=!1;this._variables=e.variables,this.contentReferences=e.contentReferences??[],this.modelId=e.modelId,this.limit=e.limit,this.domNode=e.domNode??_(".chat-attached-context"),this._contextResourceLabels=this._register(this.instantiationService.createInstance(jl,{onDidChangeVisibility:this._onDidChangeVisibility.event})),this.initAttachedContext(this.domNode),this.domNode.childElementCount||(this.domNode=void 0)}updateVariables(e){this._variables=e,this.domNode&&this.initAttachedContext(this.domNode)}initAttachedContext(e){St(e),this.attachedContextDisposables.clear();let t=this.getVisibleAttachments(),o=this.limit&&this._variables.length>this.limit&&!this._showingAll;this.markImageLimitExceeded(this._variables);for(let n of t)this.renderAttachment(n,e);o&&this.renderShowMoreButton(e)}getVisibleAttachments(){return!this.limit||this._showingAll?this._variables:this._variables.slice(0,this.limit)}markImageLimitExceeded(e){let t=e.filter(SC),o=this.getImageLimitForCurrentModel();if(o===void 0)return;if(t.length<=o){for(let r of t)r.omittedState===3&&(r.omittedState=0);return}let n=t.length-o;for(let r=0;r<n;r++)(t[r].omittedState===0||t[r].omittedState===3)&&(t[r].omittedState=3);for(let r=n;r<t.length;r++)t[r].omittedState===3&&(t[r].omittedState=0)}getImageLimitForCurrentModel(){if(this.modelId)return Ape(this.languageModelsService.lookupLanguageModel(this.modelId))}renderShowMoreButton(e){let t=this._variables.length-(this.limit??0),o=_("div.chat-attached-context-attachment.chat-attachments-show-more-button");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.style.cursor="pointer";let n=_("div.chat-attached-context-pill",{},_("span.codicon.codicon-ellipsis")),r=_("span.chat-attached-context-custom-text");r.textContent=`${t} more`,o.appendChild(n),o.appendChild(r);let s=()=>{this._showingAll=!0,this.initAttachedContext(e)};this.attachedContextDisposables.add($(o,"click",s)),this.attachedContextDisposables.add($(o,"keydown",l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),s())})),e.appendChild(o),this.attachedContextDisposables.add({dispose:()=>o.remove()})}renderAttachment(e,t){let o=A.isUri(e.value)?e.value:e.value&&typeof e.value=="object"&&"uri"in e.value&&A.isUri(e.value.uri)?e.value.uri:void 0,n=e.value&&typeof e.value=="object"&&"range"in e.value&&G.isIRange(e.value.range)?e.value.range:void 0,r=this.contentReferences.find(h=>typeof h.reference=="object"&&"variableName"in h.reference&&h.reference.variableName===e.name||A.isUri(h.reference)&&Jo(h.reference.path)===e.name),l=r?.options?.status?.kind===3||r?.options?.status?.kind===2,c;if(e.kind==="tool"||e.kind==="toolset")c=this.instantiationService.createInstance(Aoe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(CPt(e))c=this.instantiationService.createInstance(Ooe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(SC(e))e.omittedState=l?2:e.omittedState,c=this.instantiationService.createInstance(Doe,o,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(tR(e)){if(e.automaticallyAdded)return;c=this.instantiationService.createInstance(Moe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}else if(B0(e)){if(e.automaticallyAdded)return;c=this.instantiationService.createInstance(Poe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}else if(o&&(e.kind==="file"||e.kind==="directory"))c=this.instantiationService.createInstance(Toe,o,n,e,r,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(yao(e))c=this.instantiationService.createInstance(_oe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(yPt(e))c=this.instantiationService.createInstance(Roe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(o&&wPt(e))c=this.instantiationService.createInstance(Noe,o,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(xPt(e))c=this.instantiationService.createInstance(Foe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(kPt(e))c=this.instantiationService.createInstance(Woe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(EPt(e))c=this.instantiationService.createInstance(Voe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else if(SPt(e))c=this.instantiationService.createInstance(Boe,e,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels);else{if(rDe(e))return;c=this.chatAttachmentWidgetRegistry.createWidget(e,{shouldFocusClearButton:!1,supportsDeletion:!1},t)??this.instantiationService.createInstance(Loe,o,n,e,r,void 0,{shouldFocusClearButton:!1,supportsDeletion:!1},t,this._contextResourceLabels)}let u=null;l&&c.element.classList.add("warning");let p=r?.options?.status?.description;if(l){u=`${u}${p?` ${p}`:""}`;for(let h of[".monaco-icon-suffix-container",".monaco-icon-name-container"]){let g=c.label?.element.querySelector(h);g&&g.classList.add("warning")}}if(this._register($(c.element,"contextmenu",h=>this.contextMenuHandler?.(e,h))),this.attachedContextDisposables.isDisposed){c.dispose();return}u&&(c.element.ariaLabel=u),this.attachedContextDisposables.add(c)}};ine=I([m(1,F),m(2,Gr),m(3,gFe)],ine);var cdn=100,hV=class extends k{constructor(e,t,o,n){super();this._instantiationService=t;this._contextMenuService=o;this._fileService=n;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;let r=st(".chat-collapsible-io-resource-group",[st(".chat-collapsible-io-resource-items@items"),st(".chat-collapsible-io-resource-actions@actions")]);this.domNode=r.root,this._fillInResourceGroup(e,r.items,r.actions)}async _fillInResourceGroup(e,t,o){let n=[],r=[];for(let c=0;c<e.length;c++){let u=e[c];if(u.mimeType&&R8(u.mimeType))if(u.base64Value)n.push({kind:"file",id:ht(),name:Be(u.uri),fullName:u.uri.path,value:u.uri}),r.push({index:c,part:u});else if(u.value)n.push({kind:"image",id:ht(),name:Be(u.uri),value:u.value,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]});else{let p=await this._fileService.readFile(u.uri).then(h=>h.value.buffer,()=>{});p?n.push({kind:"image",id:ht(),name:Be(u.uri),value:p,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]}):n.push({kind:"file",id:ht(),name:Be(u.uri),fullName:u.uri.path,value:u.uri})}else n.push({kind:"file",id:ht(),name:Be(u.uri),fullName:u.uri.path,value:u.uri})}if(this._store.isDisposed)return;let s=this._register(this._instantiationService.createInstance(ine,{variables:n,limit:5,contentReferences:void 0,domNode:void 0}));s.contextMenuHandler=(c,u)=>{let p=n.indexOf(c),h=e[p];h&&(u.preventDefault(),u.stopPropagation(),this._contextMenuService.showContextMenu({menuId:R.ChatToolOutputResourceContext,menuActionOptions:{shouldForwardArgs:!0},getAnchor:()=>({x:u.pageX,y:u.pageY}),getActionsContext:()=>({parts:[h]})}))},t.appendChild(s.domNode),this._onDidChangeHeight.fire();let l=this._register(this._instantiationService.createInstance(pr,o,R.ChatToolOutputResourceToolbar,{menuOptions:{shouldForwardArgs:!0}}));l.context={parts:e},r.length>0&&this._register(Zo(()=>{for(let{index:c,part:u}of r)try{let p=Ws(u.base64Value).buffer;n[c]={kind:"image",id:ht(),name:Be(u.uri),value:p,mimeType:u.mimeType,isURL:!1,references:[{kind:"reference",reference:u.uri}]}}catch{}s.updateVariables(n),this._onDidChangeHeight.fire()},cdn))}};hV=I([m(1,F),m(2,Xe),m(3,ge)],hV);var bAi=class a extends z{static{this.ID="chat.toolOutput.save"}constructor(){super({id:a.ID,title:P(8829,"Save..."),icon:L.cloudDownload,menu:[{id:R.ChatToolOutputResourceToolbar,group:"navigation",order:1},{id:R.ChatToolOutputResourceContext}]})}async run(i,e){let t=i.get(nn),o=i.get(ge),n=i.get(Ne),r=i.get(Go),s=i.get(Ae),l=i.get(fe),c=i.get(nt),u=await t.defaultFilePath(),p=async(g,f,v)=>{let b=f?Ve(v,Be(g.uri)):v;try{if(g.kind==="data")await o.copy(g.uri,b,!0);else{let S=await o.readFile(g.uri);await o.writeFile(b,S.value)}}catch(S){n.error(d(8830,null,Be(g.uri),S))}},h=async(g,f)=>{await r.withProgress({location:15,delay:5e3,title:d(8831,null)},async v=>{for(let b of f)await b(),v.report({increment:1,total:f.length})}),s.isInsideWorkspace(g)?l.executeCommand(sV,g):n.info(d(8832,null,c.getUriLabel(g)))};if(e.parts.length===1){let g=e.parts[0],f=await t.pickFileToSave(Ve(u,Be(g.uri)));if(!f)return;await h(f,[()=>p(g,!1,f)])}else{let g=await t.showOpenDialog({title:d(8833,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:s.getWorkspace().folders[0]?.uri});if(!g?.length)return;await h(g[0],e.parts.map(f=>()=>p(f,!0,g[0])))}}};W(bAi);var s0e=class extends k{constructor(e){super();this.instantiationService=e;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this.resourcePartsByToolCallId=new Map;this.resourceGroupWidget=this._register(new ue);this.resourceGroupWidgetHeightListener=this._register(new ue);this.isCollapsed=!0;this.domNode=_(".chat-thinking-external-resources"),Wi(this.domNode)}setToolInvocationParts(e,t){t.length!==0&&(this.resourcePartsByToolCallId.set(e,t),this.rebuild())}removeToolInvocation(e){this.resourcePartsByToolCallId.delete(e)&&this.rebuild()}setCollapsed(e){if(this.isCollapsed=e,!this.resourceGroupWidget.value){Wi(this.domNode);return}this.isCollapsed?Xo(this.domNode):Wi(this.domNode)}rebuild(){let e=[];for(let o of this.resourcePartsByToolCallId.values())e.push(...o);if(this.resourceGroupWidgetHeightListener.clear(),this.resourceGroupWidget.clear(),St(this.domNode),e.length===0){Wi(this.domNode),this._onDidChangeHeight.fire();return}let t=this.instantiationService.createInstance(hV,e);this.resourceGroupWidgetHeightListener.value=t.onDidChangeHeight(()=>this._onDidChangeHeight.fire()),this.resourceGroupWidget.value=t,this.domNode.appendChild(t.domNode),this.setCollapsed(this.isCollapsed),this._onDidChangeHeight.fire()}};s0e=I([m(0,F)],s0e);function Rxo(a){return(Array.isArray(a.value)?a.value.join(""):a.value||"").trim()}function ddn(a){let i=a.toLowerCase();return i.includes("edit")||i.includes("create")||i.includes("replace")||i.includes("patch")}function udn(a){let i=a.toLowerCase();return i.includes("create")||i.includes("notebook")?!1:i.includes("replace")||i.includes("patch")||i.includes("insertedit")||i.includes("insert_edit")||i.includes("editfile")}function IAi(a,i){if(i)return i;let e=a.toLowerCase();return e.includes("search")||e.includes("grep")||e.includes("find")||e.includes("list")||e.includes("semantic")||e.includes("changes")||e.includes("codebase")?L.search:e.includes("read")||e.includes("get_file")||e.includes("problems")?L.book:ddn(a)?L.pencil:e.includes("terminal")?L.terminal:L.tools}function zq(a){let i=_("span.chat-thinking-icon");return i.classList.add(...q.asClassNameArray(a)),i}function Lxo(a){let i=a.match(/^\*\*([^*]+)\*\*/);return i?i[1]:void 0}var Jfe=200,SAi="chat.thinkingTitleCache",Mxo=10080*60*1e3,Pxo=1e3;var yAi=[d(8877,null),d(8878,null),d(8879,null),d(8880,null),d(8881,null),d(8882,null)],pdn=[d(8874,null),d(8875,null),d(8876,null)],mdn=[d(8884,null),d(8885,null),d(8886,null),d(8887,null),d(8888,null)],Axo=[d(8889,null),d(8890,null),d(8891,null),d(8892,null),d(8893,null)],hdn=100;function wAi(){if(Math.floor(Math.random()*hdn)===0)return Axo[Math.floor(Math.random()*Axo.length)]}function wst(a,i){let e=i.getValue("chat.agent.thinking.phrases"),t=Array.isArray(e?.phrases)?e.phrases.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0):[];return t.length>0?e?.mode==="replace"?[...t]:[...a,...t]:[...a]}var WE=class extends O_{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=Rxo(e),f=Lxo(g)??d(8867,null);super(f,t,void 0,u,s);this.chatContentMarkdownRenderer=o;this.streamingCompleted=n;this.instantiationService=r;this.configurationService=s;this.chatMarkdownAnchorService=l;this.languageModelsService=c;this.storageService=p;this._onDidChangeHeight=this._register(new T);this._asyncRenderCallback=()=>this._onDidChangeHeight.fire();this.defaultTitle=d(8866,null);this.workingTitle=d(8868,null);this._markdownResult=this._register(new ue);this.fixedScrollingMode=!1;this.autoScrollEnabled=!0;this.extractedTitles=[];this.toolInvocationCount=0;this.appendedItemCount=0;this.isActive=!0;this.toolInvocations=[];this.allThinkingParts=[];this.hookCount=0;this.lazyItems=[];this.hasExpandedOnce=!1;this.availableMessagesByCategory=new Map;this.toolWrappersByCallId=new Map;this.toolIconsByCallId=new Map;this.toolLabelsByCallId=new Map;this.toolDisposables=this._register(new Ot);this.ownedToolParts=new Map;this.pendingRemovals=[];this.isUpdatingDimensions=!1;this.lastKnownContentHeight=0;this.lastKnownScrollTop=0;this._titleDetailRendered=this._register(new ue);this._pendingAppendRefresh=this._register(new ue);this.diffStatsByPartId=new Map;this._aggregatedDiff={added:0,removed:0};this.id=e.id,this.content=e,this.allThinkingParts.push(e),this.showProgressDetails=this.configurationService.getValue("chat.persistentProgress.enabled")!==!1&&(this.configurationService.getValue("chat.progressBorder.enabled")!==!0||h.isMotionReduced());let v=this.configurationService.getValue("chat.agent.thinkingStyle")??"collapsed";this.fixedScrollingMode=v==="fixedScrolling",this.currentTitle=f,f!==this.defaultTitle&&(this.lastExtractedTitle=f,this.extractedTitles.push(f)),this.currentThinkingValue=g,g.trim()&&this.appendedItemCount++,this.configurationService.getValue("accessibility.verboseChatProgressUpdates")&&cn(d(8873,null)),v==="collapsed"?this.setExpanded(!1):v==="collapsedPreview"?this.setExpanded(!this.streamingCompleted&&!this.element.isComplete):this.setExpanded(!1);let b=this.domNode;if(b.classList.add("chat-thinking-box"),this._externalResourceWidget=this._register(this.instantiationService.createInstance(s0e)),this._register(this._externalResourceWidget.onDidChangeHeight(()=>this._onDidChangeHeight.fire())),b.appendChild(this._externalResourceWidget.domNode),!this.streamingCompleted&&!this.element.isComplete&&(this.fixedScrollingMode||b.classList.add("chat-thinking-active")),!this.fixedScrollingMode&&!this.streamingCompleted&&!this.element.isComplete&&this._collapseButton){let y=this._collapseButton.labelElement;y.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),this.titleShimmerSpan.textContent=f,y.appendChild(this.titleShimmerSpan)}this.fixedScrollingMode&&(b.classList.add("chat-thinking-fixed-mode"),!this.streamingCompleted&&!this.element.isComplete&&this.showProgressDetails&&b.classList.add("chat-thinking-persistent-streaming"),this.currentTitle=this.defaultTitle),this._register(ee(()=>{for(let y of this.ownedToolParts.values())y.dispose();this.ownedToolParts.clear()})),this._register(ve(y=>{let w=this.expanded.read(y);this._collapseButton&&(this.streamingCompleted||this.element.isComplete?this._collapseButton.icon=L.check:this.fixedScrollingMode||(w?this._collapseButton.icon=L.chevronDown:this._collapseButton.icon=L.circleFilled))})),this._register(ve(y=>{let w=this._isExpanded.read(y);if(w&&!this.hasExpandedOnce&&this.lazyItems.length>0){this.hasExpandedOnce=!0,this.processPendingRemovals();for(let x of this.lazyItems)this.materializeLazyItem(x)}if(w&&!this.shouldAllowExpansion()&&(this.streamingCompleted||this.element.isComplete)){this.setExpanded(!1);return}this._externalResourceWidget.setCollapsed(!w),this._onDidChangeHeight.fire()}));let S=this.lastExtractedTitle??"";!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(S),this._collapseButton&&this._register(this._collapseButton.onDidClick(()=>{if(this.streamingCompleted||this.fixedScrollingMode)return;this.isExpanded()?(this.setTitle(this.defaultTitle,!0),this.currentTitle=this.defaultTitle):this.lastExtractedTitle?this.setTitle(this.lastExtractedTitle):(this.setTitle(this.defaultTitle,!0),this.currentTitle=this.defaultTitle)}))}static _codeBlockRendererSync(e,t,o){let n=_("code");return n.textContent=t,n}get aggregatedDiff(){return this._aggregatedDiff}getRandomWorkingMessage(e="tool"){let t=wAi();if(t)return t;let o=this.availableMessagesByCategory.get(e);if(!o||o.length===0){let r;switch(e){case"thinking":r=yAi;break;case"terminal":r=pdn;break;default:r=mdn;break}o=wst(r,this.configurationService),this.availableMessagesByCategory.set(e,o)}let n=Math.floor(Math.random()*o.length);return o.splice(n,1)[0]}shouldInitEarly(){return this.fixedScrollingMode&&!this.streamingCompleted}initContent(){this.wrapper=_(".chat-used-context-list.chat-thinking-collapsible"),this.streamingCompleted||this.wrapper.classList.add("chat-thinking-streaming");let e=this.lazyItems.some(t=>t.kind==="thinking");if(this.currentThinkingValue&&!e&&(this.textContainer=_(".chat-thinking-item.markdown-content"),this.wrapper.appendChild(this.textContainer),this.renderMarkdown(this.currentThinkingValue)),!this.streamingCompleted&&!this.element.isComplete&&!(this.fixedScrollingMode&&this.showProgressDetails)){this.workingSpinnerElement=_(".chat-thinking-item.chat-thinking-spinner-item");let t=zq(L.circleFilled);this.workingSpinnerElement.appendChild(t),this.workingSpinnerLabel=_("span.chat-thinking-spinner-label"),this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage("thinking"),this.workingSpinnerElement.appendChild(this.workingSpinnerLabel),this.wrapper.appendChild(this.workingSpinnerElement)}if(this.fixedScrollingMode){this.scrollableElement=this._register(new Ar(this.wrapper,{vertical:1,horizontal:2,handleMouseWheel:!0,alwaysConsumeMouseWheel:!1})),this._register(this.scrollableElement.onScroll(r=>this.handleScroll(r.scrollTop)));let t,o=new MutationObserver(()=>{t||(t=kr(Me(this.wrapper),()=>{t=void 0,!(this.streamingCompleted||!this.domNode.classList.contains("chat-used-context-collapsed"))&&(this.refreshContentHeight(),this.updateScrollDimensionsFromCache())}))});o.observe(this.wrapper,{childList:!0,subtree:!0}),this._register({dispose:()=>{o.disconnect(),t?.dispose()}}),this.childResizeObserver=this._register(new zu("ChatThinkingContentPart.child",()=>{this.streamingCompleted||!this.domNode.classList.contains("chat-used-context-collapsed")||this.syncDimensionsAndScheduleScroll()})),this.textContainer&&this._register(this.childResizeObserver.observe(this.textContainer)),this.workingSpinnerElement&&this._register(this.childResizeObserver.observe(this.workingSpinnerElement));let n=this._register(new zu("ChatThinkingContentPart.wrapper",r=>{r[0]&&(this.lastKnownContentHeight=this.wrapper.scrollHeight,!this.streamingCompleted&&this.domNode.classList.contains("chat-used-context-collapsed")&&this.updateScrollDimensionsFromCache())}));return this.wrapperResizeObserverDisposable=this._register(n.observe(this.wrapper)),this._register(this._onDidChangeHeight.event(()=>{if(!this.streamingCompleted&&this.wrapperResizeObserverDisposable){this.refreshContentHeight(),this.updateScrollDimensionsFromCache();return}this.syncDimensionsAndScheduleScroll()})),this.syncDimensionsAndScheduleScroll(),this.updateDropdownClickability(),this.scrollableElement.getDomNode()}return this.updateDropdownClickability(),this.wrapper}handleScroll(e){if(!this.scrollableElement||this.isUpdatingDimensions)return;this.lastKnownScrollTop=e;let t=this.lastKnownContentHeight,o=Math.min(t,Jfe),n=t-o;this.autoScrollEnabled=n<=0||e>=n-10,this.updateFadeClasses(e,t,o)}updateFadeClasses(e,t,o){if(!this.fixedScrollingMode||this.streamingCompleted){this.domNode.classList.remove("chat-thinking-fade-top","chat-thinking-fade-bottom");return}let n=e??this.lastKnownScrollTop,r=t??this.lastKnownContentHeight,s=o??Math.min(r,Jfe),l=r-s;this.domNode.classList.toggle("chat-thinking-fade-top",n>5),this.domNode.classList.toggle("chat-thinking-fade-bottom",l>0&&n<l-5)}syncDimensionsAndScheduleScroll(){this.pendingScrollDisposable||(this.pendingScrollDisposable=kr(Me(this.domNode),()=>{this.pendingScrollDisposable=void 0,!this._store.isDisposed&&(this.refreshContentHeight(),this.updateScrollDimensionsFromCache())}))}refreshContentHeight(){if(!this.wrapper||!this.scrollableElement)return;let e=this.wrapper.scrollHeight;e&&e!==this.lastKnownContentHeight&&(this.lastKnownContentHeight=e)}updateScrollDimensionsFromCache(){if(!this.scrollableElement||this._store.isDisposed||!this.domNode.classList.contains("chat-used-context-collapsed"))return;let t=this.lastKnownContentHeight;if(!t)return;let o=Math.min(t,Jfe);this.isUpdatingDimensions=!0;try{let n=this.scrollableElement.getDomNode().clientWidth;this.scrollableElement.setScrollDimensions({width:n,scrollWidth:n,height:o,scrollHeight:t}),this.autoScrollEnabled&&this.scrollToBottom(t)}finally{this.isUpdatingDimensions=!1}this.updateFadeClasses(this.lastKnownScrollTop,this.lastKnownContentHeight),this.updateDropdownClickability(t)}scrollToBottom(e){if(!this.scrollableElement)return;let t=Math.min(e,Jfe);if(e>t){let o=e-t;this.lastKnownScrollTop=o,this.scrollableElement.setScrollPosition({scrollTop:o})}}updateScrollDimensionsForCompletion(){if(!this.scrollableElement||!this.fixedScrollingMode)return;let e=this.wrapper.scrollHeight;this.lastKnownContentHeight=e;let t=Math.min(e,Jfe),o=this.scrollableElement.getDomNode().clientWidth;this.scrollableElement.setScrollDimensions({width:o,scrollWidth:o,height:t,scrollHeight:e}),e<=Jfe&&this.scrollableElement.setScrollPosition({scrollTop:0})}renderMarkdown(e,t){if(this._store.isDisposed)return;let o=e.trim();if(!o){this._markdownResult.clear(),this.textContainer&&St(this.textContainer);return}let n=o;o.startsWith("**")&&o.endsWith("**")&&(n=o.slice(2,-2));let r=t?this._markdownResult.value?.element:void 0,s=this.chatContentMarkdownRenderer.render(new he(n),{fillInIncompleteTokens:!0,asyncRenderCallback:this._asyncRenderCallback,codeBlockRendererSync:WE._codeBlockRendererSync},r);this._markdownResult.value=s,r||this.textContainer&&(St(this.textContainer),this.textContainer.appendChild(zq(L.circleFilled)),this.textContainer.appendChild(s.element))}setFinalizedTitle(e){if(!this._collapseButton)return;let t=this._collapseButton.labelElement;t.textContent="";let o=e.indexOf(" ");if(o===-1)t.textContent=e;else{let n=e.substring(0,o),r=e.substring(o),s=_("span");s.textContent=n,t.appendChild(s);let l=_("span.chat-thinking-title-detail-text");l.textContent=r,t.appendChild(l)}if(this.diffStatsByPartId.size>0){let{added:n,removed:r}=this._aggregatedDiff;if(n>0||r>0){let s=_("span.chat-thinking-title-diff");s.appendChild(_("span.label-added",{},`+${n}`)),s.appendChild(_("span.label-removed",{},`-${r}`)),t.appendChild(s);let l=n===1?d(8870,null):d(8869,null,n),c=r===1?d(8859,null):d(8858,null,r);this._collapseButton.element.ariaLabel=d(8883,null,e,l,c)}else this._collapseButton.element.ariaLabel=e}else this._collapseButton.element.ariaLabel=e}setDropdownClickable(e){this._collapseButton&&(this._collapseButton.element.style.pointerEvents=e?"auto":"none"),!e&&this.streamingCompleted&&this.setFinalizedTitle(this.lastExtractedTitle??this.currentTitle)}shouldAllowExpansion(){if(this.toolInvocationCount>0||this.lazyItems.length>0||this.wrapper&&Array.from(this.wrapper.children).filter(s=>s!==this.workingSpinnerElement).length>1)return!0;let e=this.currentThinkingValue.trim(),t=this.lastExtractedTitle??this.currentTitle,n=(r=>r.replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/`(.+?)`/g,"$1").trim())(e);return!(!n||n===t)}updateDropdownClickability(e){let t=this.shouldAllowExpansion();if(t&&this.fixedScrollingMode&&!this.streamingCompleted&&!this.element.isComplete&&this.wrapper){let o=e??this.lastKnownContentHeight;(!o||o<=Jfe)&&(t=!1)}!t&&this.isExpanded()&&(this.streamingCompleted||this.element.isComplete)&&this.setExpanded(!1),this.setDropdownClickable(t)}appendToWrapper(e){this.wrapper&&(this.workingSpinnerElement&&this.workingSpinnerElement.parentNode===this.wrapper?this.wrapper.insertBefore(e,this.workingSpinnerElement):this.wrapper.appendChild(e))}resetId(){this.id=void 0}collapseContent(){this.setExpanded(!1)}updateThinking(e){if(this._store.isDisposed)return;this.content=e;for(let c of this.lazyItems)if(c.kind==="thinking"&&c.content.id===e.id){c.content=e;break}let t=Rxo(e),o=t;if(o===this.currentThinkingValue)return;let n=this.currentThinkingValue,r=!!(this._markdownResult.value&&o.startsWith(n)&&o.length>n.length);this.currentThinkingValue=o,this.renderMarkdown(o,r),this.fixedScrollingMode&&this.scrollableElement&&(this.refreshContentHeight(),this.updateScrollDimensionsFromCache());let s=Lxo(t);if(s&&s!==this.currentTitle&&(this.extractedTitles.includes(s)||this.extractedTitles.push(s),this.lastExtractedTitle=s),!s||s===this.currentTitle)return;let l=this.lastExtractedTitle??"";!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(l),this.updateDropdownClickability()}getIsActive(){return this.isActive}get isFixedScrollingMode(){return this.fixedScrollingMode}isEffectivelyEmpty(){return this.processPendingRemovals(),!(this.toolInvocationCount>0||this.lazyItems.length>0||this.hookCount>0||this.currentThinkingValue.trim().length>0)}markAsInactive(){this.isActive=!1,this.domNode.classList.remove("chat-thinking-active"),this.domNode.classList.remove("chat-thinking-fade-top","chat-thinking-fade-bottom"),this.processPendingRemovals(),this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0);for(let e of this.toolInvocations)e.isAttachedToThinking=!1}finalizeTitleIfDefault(){if(this.processPendingRemovals(),this.wrapper&&this.wrapper.classList.remove("chat-thinking-streaming"),this.domNode.classList.remove("chat-thinking-active"),this.domNode.classList.remove("chat-thinking-persistent-streaming"),this.domNode.classList.remove("chat-thinking-fade-top","chat-thinking-fade-bottom"),this.streamingCompleted=!0,this.wrapperResizeObserverDisposable&&(this.wrapperResizeObserverDisposable.dispose(),this.wrapperResizeObserverDisposable=void 0),this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0),this._collapseButton&&(this._collapseButton.icon=L.check),this.updateScrollDimensionsForCompletion(),this.updateDropdownClickability(),this.content.generatedTitle){this.currentTitle=this.content.generatedTitle,this.setGeneratedTitleOnAllParts(this.content.generatedTitle),this.setFinalizedTitle(this.content.generatedTitle);return}let e=this.toolInvocations.find(n=>n.generatedTitle)?.generatedTitle??this.allThinkingParts.find(n=>n.generatedTitle)?.generatedTitle;if(e){this.currentTitle=e,this.content.generatedTitle=e,this.setGeneratedTitleOnAllParts(e),this.setFinalizedTitle(e);return}if(this.toolInvocations.length>0&&this.toolInvocations.every(n=>n.kind==="toolInvocationSerialized")&&!Br.isLocalSession(this.element.sessionResource)){let n=this.toolInvocations[this.toolInvocations.length-1];if(n){let r=this.getCachedTitle(n.toolCallId);if(r){this.currentTitle=r,this.content.generatedTitle=r,this.setGeneratedTitleOnAllParts(r),this.setFinalizedTitle(r);return}}}if(this.toolInvocationCount===1&&this.hookCount===0&&this.currentThinkingValue.trim()===""){if(!this.singleItemInfo){let r=this.lazyItems.find(s=>s.kind==="tool"&&s.originalParent);if(r&&r.kind==="tool"){let s=r.toolInvocationOrMarkdown&&(r.toolInvocationOrMarkdown.kind==="toolInvocation"||r.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")?r.toolInvocationOrMarkdown:void 0,l=r.lazy.value;if(this.singleItemInfo={element:l.domNode,originalParent:r.originalParent,originalNextSibling:this.domNode,toolInvocation:s},l.disposable){let c=s?.toolCallId;c?this.ownedToolParts.set(c,l.disposable):this._register(l.disposable)}}}if((!this.singleItemInfo?.toolInvocation||pi.isComplete(this.singleItemInfo.toolInvocation))&&this.singleItemInfo&&this.restoreSingleItemToOriginalPosition())return}if(this.extractedTitles.length===1&&this.toolInvocationCount===0){let n=this.extractedTitles[0];this.currentTitle=n,this.content.generatedTitle=n,this.setGeneratedTitleOnAllParts(n),this.setFinalizedTitle(n);return}if(!(this.configurationService.getValue("chat.agent.thinking.generateTitles")??!0)){this.setFallbackTitle();return}this.generateTitleViaLLM()}setGeneratedTitleOnAllParts(e){for(let t of this.toolInvocations)t.generatedTitle=e;for(let t of this.allThinkingParts)t.generatedTitle=e}loadTitleCache(){return this.storageService.getObject(SAi,0)??{}}saveTitleCache(e){Object.keys(e).length===0?this.storageService.remove(SAi,0):this.storageService.store(SAi,JSON.stringify(e),0,1)}getTitleCacheKey(e){return`${jp(this.element.sessionResource)}:${e}`}getCachedTitle(e){let t=this.loadTitleCache()[this.getTitleCacheKey(e)];if(!(!t||Date.now()-t.storedAt>Mxo))return t.title}setCachedTitle(e,t){let o=this.loadTitleCache(),n=Date.now();for(let s of Object.keys(o))n-o[s].storedAt>Mxo&&delete o[s];o[this.getTitleCacheKey(e)]={title:t,storedAt:n};let r=Object.keys(o);if(r.length>Pxo){let s=r.sort((l,c)=>o[l].storedAt-o[c].storedAt);for(let l=0;l<s.length-Pxo;l++)delete o[s[l]]}this.saveTitleCache(o)}async generateTitleViaLLM(){let e=new qe,t=setTimeout(()=>e.cancel(),5e3);try{let o=await this.languageModelsService.selectLanguageModels({vendor:"copilot",id:"copilot-utility-small"});if(!o.length){this.setFallbackTitle();return}if(e.token.isCancellationRequested){this.setFallbackTitle();return}let n;this.extractedTitles.length>0?n=this.extractedTitles.join(", "):n=this.currentThinkingValue.substring(0,1e3);let r=`Summarize the following content in a SINGLE sentence (under 10 words) using past tense. Follow these rules strictly:

			OUTPUT FORMAT:
			- MUST be a single sentence
			- MUST be under 10 words
			- The FIRST word MUST be a past tense verb (e.g. "Updated", "Reviewed", "Created", "Searched", "Analyzed")
			- No quotes, no trailing punctuation

			GENERAL:
			- The content may include tool invocations (file edits, reads, searches, terminal commands), reasoning headers, or raw thinking text
			- For reasoning headers or thinking text (no tool calls), summarize WHAT was considered/analyzed, NOT that thinking occurred
			- For thinking-only summaries, use phrases like: "Considered...", "Planned...", "Analyzed...", "Reviewed..."

			TOOL NAME FILTERING:
			- NEVER include tool names like "Replace String in File", "Multi Replace String in File", "Create File", "Read File", etc. in the output
			- If an action says "Edited X and used Replace String in File", output ONLY the action on X
			- Tool names describe HOW something was done, not WHAT was done - always omit them

			VOCABULARY - Use varied synonyms for natural-sounding summaries:
			- For edits: "Updated", "Modified", "Changed", "Refactored", "Fixed", "Adjusted"
			- For reads: "Reviewed", "Examined", "Checked", "Inspected", "Analyzed", "Explored"
			- For creates: "Created", "Added", "Generated"
			- For searches: "Searched for", "Looked up", "Investigated"
			- For terminal: "Ran command", "Executed"
			- For reasoning/thinking: "Considered", "Planned", "Analyzed", "Reviewed", "Evaluated"
			- Choose the synonym that best fits the context

${this.hookCount>0?`BLOCKED/DENIED CONTENT (hooks detected):
			- Only mention "blocked" if the content explicitly includes hook results that blocked or warned about a tool (e.g. "Blocked terminal" or "Warning for read_file")
			- If blocked items are present alongside normal tool calls, briefly note the block but do NOT let it dominate the summary: e.g. "Updated file.ts, blocked terminal"

			`:`IMPORTANT: Do NOT use words like "blocked", "denied", or "tried" in the summary - there are no hooks or blocked items in this content. Just summarize normally.

			`}RULES FOR TOOL CALLS:
			1. If the SAME file was both edited AND read: Use a combined phrase like "Reviewed and updated <filename>"
			2. If exactly ONE file was edited: Start with an edit synonym + "<filename>" (include actual filename)
			3. If exactly ONE file was read: Start with a read synonym + "<filename>" (include actual filename)
			4. If MULTIPLE files were edited: Start with an edit synonym + "X files"
			5. If MULTIPLE files were read: Start with a read synonym + "X files"
			6. If BOTH edits AND reads occurred on DIFFERENT files: Combine them naturally
			7. For searches: Say "searched for <term>" or "looked up <term>" with the actual search term, NOT "searched for files"
			8. After the file info, you may add a brief summary of other actions if space permits
			9. NEVER say "1 file" - always use the actual filename when there's only one file

			RULES FOR REASONING HEADERS (no tool calls):
			1. If the input contains reasoning/analysis headers without actual tool invocations, summarize the main topic and what was considered
			2. Use past tense verbs that indicate thinking, not doing: "Considered", "Planned", "Analyzed", "Evaluated"
			3. Focus on WHAT was being thought about, not that thinking occurred

			RULES FOR RAW THINKING TEXT:
			1. Extract the main topic or question being considered from the text
			2. Identify any specific files, functions, or concepts mentioned
			3. Summarize as "Analyzed <topic>" or "Considered <specific thing>"
			4. If discussing code structure: "Reviewed <component/architecture>"
			5. If discussing a problem: "Analyzed <problem description>"
			6. If discussing implementation: "Planned <feature/change>"

			EXAMPLES WITH TOOLS:
			- "Read HomePage.tsx, Edited HomePage.tsx" \u2192 "Reviewed and updated HomePage.tsx"
			- "Edited HomePage.tsx" \u2192 "Updated HomePage.tsx"
			- "Edited config.css and used Replace String in File" \u2192 "Modified config.css"
			- "Edited App.tsx, used Multi Replace String in File" \u2192 "Refactored App.tsx"
			- "Read config.json, Read package.json" \u2192 "Reviewed 2 files"
			- "Edited App.tsx, Read utils.ts" \u2192 "Updated App.tsx and checked utils.ts"
			- "Edited App.tsx, Read utils.ts, Read types.ts" \u2192 "Updated App.tsx and reviewed 2 files"
			- "Edited index.ts, Edited styles.css, Ran terminal command" \u2192 "Modified 2 files and ran command"
			- "Read README.md, Searched for AuthService" \u2192 "Checked README.md and searched for AuthService"
			- "Searched for login, Searched for authentication" \u2192 "Searched for login and authentication"
			- "Edited api.ts, Edited models.ts, Read schema.json" \u2192 "Updated 2 files and reviewed schema.json"
			- "Edited Button.tsx, Edited Button.css, Edited index.ts" \u2192 "Modified 3 files"
			- "Searched codebase for error handling" \u2192 "Looked up error handling"

${this.hookCount>0?`EXAMPLES WITH BLOCKED CONTENT (from hooks):
			- "Blocked terminal, Edited config.ts" \u2192 "Edited config.ts, terminal was blocked"
			- "Blocked terminal, Blocked read_file" \u2192 "Two tools were blocked by hooks"
			- "Warning for read_file, Edited utils.ts" \u2192 "Edited utils.ts with a hook warning"

			`:""}EXAMPLES WITH REASONING HEADERS (no tools):
			- "Analyzing component architecture" \u2192 "Considered component architecture"
			- "Planning refactor strategy" \u2192 "Planned refactor strategy"
			- "Reviewing error handling approach, Considering edge cases" \u2192 "Analyzed error handling approach"
			- "Understanding the codebase structure" \u2192 "Reviewed codebase structure"
			- "Thinking about implementation options" \u2192 "Considered implementation options"

			EXAMPLES WITH RAW THINKING TEXT:
			- "I need to understand how the authentication flow works in this app..." \u2192 "Analyzed authentication flow"
			- "Let me think about how to refactor this component to be more maintainable..." \u2192 "Planned component refactoring"
			- "The error seems to be coming from the database connection..." \u2192 "Investigated database connection issue"
			- "Looking at the UserService class, I see it handles..." \u2192 "Reviewed UserService implementation"

			Content: ${n}`,s=await this.languageModelsService.sendChatRequest(o[0],void 0,[{role:1,content:[{type:"text",value:r}]}],{},e.token),l="";for await(let c of s.stream){if(e.token.isCancellationRequested)break;if(Array.isArray(c))for(let u of c)u.type==="text"&&(l+=u.value);else c.type==="text"&&(l+=c.value)}if(e.token.isCancellationRequested){this.setFallbackTitle();return}if(await s.result,l=l.trim(),l.includes("can't assist with that")){this.setFallbackTitle();return}if(l&&!this._store.isDisposed){if(this.currentTitle=l,this.setFinalizedTitle(l),this.content.generatedTitle=l,this.setGeneratedTitleOnAllParts(l),!Br.isLocalSession(this.element.sessionResource)){let c=this.toolInvocations[this.toolInvocations.length-1];c&&this.setCachedTitle(c.toolCallId,l)}return}}catch{}finally{clearTimeout(t),e.dispose()}this.setFallbackTitle()}restoreSingleItemToOriginalPosition(){if(!this.singleItemInfo)return!1;let{element:e,originalParent:t,originalNextSibling:o,toolInvocation:n}=this.singleItemInfo;return e.childElementCount>1?(this.singleItemInfo=void 0,!1):(o&&o.parentNode===t?t.insertBefore(e,o):t.appendChild(e),n&&(n.isAttachedToThinking=!1),Wi(this.domNode),this.singleItemInfo=void 0,!0)}updateAggregatedDiff(){let e=0,t=0;for(let o of this.diffStatsByPartId.values())e+=o.added,t+=o.removed;this._aggregatedDiff={added:e,removed:t},(this.streamingCompleted||this.element.isComplete)&&this.setFinalizedTitle(this.currentTitle)}setFallbackTitle(){let e=this.appendedItemCount>0?this.appendedItemCount===1?d(8865,null):d(8864,null,this.appendedItemCount):d(8863,null);this.currentTitle=e,this.wrapper&&this.wrapper.classList.remove("chat-thinking-streaming"),this.domNode.classList.remove("chat-thinking-active"),this.domNode.classList.remove("chat-thinking-persistent-streaming"),this.streamingCompleted=!0,this._collapseButton&&(this._collapseButton.icon=L.check,this.setFinalizedTitle(e)),this.updateDropdownClickability()}appendItem(e,t,o,n,r,s){if(this.processPendingRemovals(),this.trackToolMetadata(t,o),this.appendedItemCount++,r&&t&&this._register(r(l=>{this.diffStatsByPartId.set(t,l),this.updateAggregatedDiff()})),s&&this._register(s),this.workingSpinnerLabel){let c=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolSpecificData?.kind==="terminal"?"terminal":"tool";this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage(c)}if(this.isExpanded()||this.hasExpandedOnce||this.fixedScrollingMode&&!this.streamingCompleted){let l=e();if(this.appendItemToDOM(l.domNode,t,o,n),l.disposable){let c=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")?o.toolCallId:void 0;c?this.ownedToolParts.set(c,l.disposable):this._register(l.disposable)}}else{let l={kind:"tool",lazy:new uo(e),toolInvocationId:t,toolInvocationOrMarkdown:o,originalParent:n,isHook:!o&&!!t};this.lazyItems.push(l)}this.updateDropdownClickability()}removeMaterializedItem(e){this.toolDisposables.deleteAndDispose(e),this.ownedToolParts.delete(e),this.toolWrappersByCallId.get(e)&&(this.toolWrappersByCallId.delete(e),this.toolIconsByCallId.delete(e)),this.appendedItemCount=Math.max(0,this.appendedItemCount-1),this.toolInvocationCount=Math.max(0,this.toolInvocationCount-1);let o=this.toolInvocations.findIndex(n=>(n.kind==="toolInvocation"||n.kind==="toolInvocationSerialized")&&n.toolCallId===e);if(o!==-1){let n=this.toolLabelsByCallId.get(e);if(n){let r=this.extractedTitles.indexOf(n);r!==-1&&this.extractedTitles.splice(r,1)}this.toolInvocations.splice(o,1)}this.toolLabelsByCallId.delete(e),this._externalResourceWidget.removeToolInvocation(e),this.updateDropdownClickability(),this._onDidChangeHeight.fire()}removeEditPillByPartId(e){let t=!1,o=this.lazyItems.findIndex(n=>n.kind==="tool"&&n.toolInvocationId===e);o!==-1&&(this.lazyItems.splice(o,1),t=!0),this.diffStatsByPartId.delete(e)&&(this.updateAggregatedDiff(),t=!0),t&&(this.appendedItemCount=Math.max(0,this.appendedItemCount-1),this.updateDropdownClickability(),this._onDidChangeHeight.fire())}removeLazyItem(e){let t=this.lazyItems.findIndex(r=>r.kind==="tool"&&r.toolInvocationId===e);if(t===-1)return!1;let o=this.lazyItems[t];if(this.lazyItems.splice(t,1),this.appendedItemCount--,o.kind==="tool"&&o.isHook?this.hookCount=Math.max(0,this.hookCount-1):this.toolInvocationCount--,o.kind==="tool"&&o.toolInvocationOrMarkdown&&(o.toolInvocationOrMarkdown.kind==="toolInvocation"||o.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")){o.toolInvocationOrMarkdown.isAttachedToThinking=!1;let r=o.toolInvocationOrMarkdown.toolCallId;this._externalResourceWidget.removeToolInvocation(r);let s=this.toolLabelsByCallId.get(r);if(s){let l=this.extractedTitles.indexOf(s);l!==-1&&this.extractedTitles.splice(l,1)}this.toolLabelsByCallId.delete(r)}let n=this.toolInvocations.findIndex(r=>(r.kind==="toolInvocation"||r.kind==="toolInvocationSerialized")&&r.toolId===e);return n!==-1&&this.toolInvocations.splice(n,1),this.updateDropdownClickability(),!0}processPendingRemovals(){if(this.pendingRemovalFlushDisposable?.dispose(),this.pendingRemovalFlushDisposable=void 0,this.pendingRemovals.length===0)return;let e=this.pendingRemovals;this.pendingRemovals=[];for(let t of e)this.removeStreamingToolEntry(t.toolCallId,t.toolLabel)}schedulePendingRemovalsFlush(){this.pendingRemovalFlushDisposable||(this.pendingRemovalFlushDisposable=kr(Me(this.domNode),()=>{this.pendingRemovalFlushDisposable=void 0,!this._store.isDisposed&&this.processPendingRemovals()}))}removeStreamingToolEntry(e,t){this.toolDisposables.deleteAndDispose(e),this.ownedToolParts.get(e)?.dispose(),this.ownedToolParts.delete(e);let o=this.toolWrappersByCallId.get(e);o&&(o.remove(),this.toolWrappersByCallId.delete(e),this.toolIconsByCallId.delete(e));let n=this.lazyItems.findIndex(l=>l.kind==="tool"&&l.toolInvocationOrMarkdown&&(l.toolInvocationOrMarkdown.kind==="toolInvocation"||l.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")&&l.toolInvocationOrMarkdown.toolCallId===e);if(n!==-1){let l=this.lazyItems[n];l.kind==="tool"&&l.toolInvocationOrMarkdown&&(l.toolInvocationOrMarkdown.kind==="toolInvocation"||l.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")&&(l.toolInvocationOrMarkdown.isAttachedToThinking=!1),this.lazyItems.splice(n,1)}this.appendedItemCount=Math.max(0,this.appendedItemCount-1),this.toolInvocationCount=Math.max(0,this.toolInvocationCount-1);let r=this.toolInvocations.findIndex(l=>(l.kind==="toolInvocation"||l.kind==="toolInvocationSerialized")&&l.toolCallId===e);r!==-1&&this.toolInvocations.splice(r,1);let s=this.extractedTitles.indexOf(t);s!==-1&&this.extractedTitles.splice(s,1),this.toolLabelsByCallId.delete(e),this._externalResourceWidget.removeToolInvocation(e),this.updateDropdownClickability(),this._onDidChangeHeight.fire()}trackToolMetadata(e,t){if(!e)return;!t?this.hookCount++:this.toolInvocationCount++,this.toolInvocationCount===1&&(this.defaultTitle=this.workingTitle);let n;if(t&&(t.kind==="toolInvocation"||t.kind==="toolInvocationSerialized")&&t.invocationMessage){let s=typeof t.invocationMessage=="string"?t.invocationMessage:t.invocationMessage.value;t.kind==="toolInvocation"&&pi.isStreaming(t)&&udn(t.toolId)?n=d(8862,null):n=s,this.toolInvocations.push(t);let c=t.toolCallId;if(this.toolLabelsByCallId.set(c,n),t.kind==="toolInvocationSerialized"&&(this.updateExternalResourceParts(t),pi.isEffectivelyHidden(t)&&(this.pendingRemovals.push({toolCallId:t.toolCallId,toolLabel:n}),this.schedulePendingRemovalsFlush())),t.kind==="toolInvocation"){let u=n,p=!1,h=pi.isStreaming(t),g=new O;this.toolDisposables.set(t.toolCallId,g);let f=b=>{if(b&&b!==u){let S=this.extractedTitles.indexOf(u),y=this.extractedTitles.indexOf(b);S!==-1?y!==-1&&y!==S?this.extractedTitles.splice(S,1):this.extractedTitles[S]=b:y===-1&&this.extractedTitles.push(b),u=b,this.toolLabelsByCallId.set(c,b),this.lastExtractedTitle=b,!this.fixedScrollingMode&&!this._isExpanded.read(void 0)&&this.setTitle(b)}},v=ve(b=>{if(p)return;let S=t.state.read(b);if(h&&S.type!==pi.StateKind.Streaming){h=!1;let w=t.toolSpecificData;if(w?.kind==="terminal"){let x=this.toolIconsByCallId.get(c);if(x){let E=w.commandLine?.isSandboxWrapped?L.terminalSecure:L.terminal;x.className="chat-thinking-icon",x.classList.add(...q.asClassNameArray(E))}}if(t.presentation==="hidden"){this.pendingRemovals.push({toolCallId:t.toolCallId,toolLabel:u}),this.schedulePendingRemovalsFlush(),p=!0;return}}if(S.type===pi.StateKind.Completed||S.type===pi.StateKind.Cancelled){(t.presentation==="hidden"||t.presentation==="hiddenAfterComplete")&&(this.pendingRemovals.push({toolCallId:t.toolCallId,toolLabel:u}),this.schedulePendingRemovalsFlush()),S.type===pi.StateKind.Completed&&this.updateExternalResourceParts(t),p=!0;return}if(S.type===pi.StateKind.Streaming){h=!0;let w=S.streamingMessage.read(b);if(w){let x=typeof w=="string"?w:w.value;f(x)}return}if(S.type===pi.StateKind.Executing){let w=S.progress.read(b);if(w.message){let x=typeof w.message=="string"?w.message:w.message.value;f(x)}else{let x=t.invocationMessage;if(x){let E=typeof x=="string"?x:x.value;f(E)}}return}let y=t.invocationMessage;if(y){let w=typeof y=="string"?y:y.value;f(w)}});g.add(v)}}else if(t?.kind==="markdownContent"){let s=bst(t.content.value);if(s?.uri){let l=Be(s.uri);n=d(8860,null,l)}else n=d(8861,null)}else n=e;this.extractedTitles.includes(n)||this.extractedTitles.push(n),this.lastExtractedTitle=n,!this.fixedScrollingMode&&!this._isExpanded.get()&&this.setTitle(n)}updateExternalResourceParts(e){let t=dst(e,this.element.sessionResource);if(t.length===0)return;let o=t.map(n=>({kind:"data",value:n.data.buffer,mimeType:n.mimeType,uri:n.uri}));this._externalResourceWidget.setToolInvocationParts(e.toolCallId,o)}appendItemToDOM(e,t,o,n){if(!e.hasChildNodes()||e.textContent?.trim()==="")return;if(this.toolInvocationCount===1&&this.hookCount===0&&n){let f=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")?o:void 0;this.singleItemInfo={element:e,originalParent:n,originalNextSibling:this.domNode,toolInvocation:f}}else this.singleItemInfo=void 0;let r=_(".chat-thinking-tool-wrapper"),s=o?.kind==="markdownContent",l=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolSpecificData?.kind==="terminal",c=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")&&o.toolSpecificData?.kind==="search",u=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized")?o.icon:void 0,p;if(s)p=L.pencil;else if(c)p=L.search;else if(l){let f=o.toolSpecificData,v=f?.terminalCommandState?.exitCode,b=f?.commandLine?.isSandboxWrapped;v!==void 0&&v!==0?p=L.error:b?p=L.terminalSecure:p=u??L.terminal}else e.classList.contains("chat-hook-outcome-blocked")?p=L.error:e.classList.contains("chat-hook-outcome-warning")?p=L.warning:p=t?IAi(t,u):L.tools;let h=zq(p);r.appendChild(h),r.appendChild(e);let g=o&&(o.kind==="toolInvocation"||o.kind==="toolInvocationSerialized");if(g&&o.toolCallId&&(this.toolWrappersByCallId.set(o.toolCallId,r),this.toolIconsByCallId.set(o.toolCallId,h)),this.appendToWrapper(r),this.fixedScrollingMode&&this.scrollableElement){if(this.childResizeObserver&&!this.streamingCompleted){let f=this.childResizeObserver.observe(r),v=g?o.toolCallId:void 0;if(v){let b=this.toolDisposables.get(v);b||(b=new O,this.toolDisposables.set(v,b)),b.add(f)}else this._register(f)}this.scheduleAppendRefresh()}}scheduleAppendRefresh(){this._pendingAppendRefresh.value||(this._pendingAppendRefresh.value=kr(Me(this.wrapper),()=>{this._pendingAppendRefresh.clear(),!this._store.isDisposed&&(this.refreshContentHeight(),this.updateScrollDimensionsFromCache())}))}materializeLazyItem(e){if(e.kind==="thinking"){this.appendToWrapper(e.textContainer),this.textContainer=e.textContainer,this.id=e.content.id,this.updateThinking(e.content);return}if(this.workingSpinnerLabel){let n=e.toolInvocationOrMarkdown&&(e.toolInvocationOrMarkdown.kind==="toolInvocation"||e.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")&&e.toolInvocationOrMarkdown.toolSpecificData?.kind==="terminal"?"terminal":"tool";this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage(n)}if(e.lazy.hasValue){let o=e.lazy.value;o.domNode.parentElement||this.appendItemToDOM(o.domNode,e.toolInvocationId,e.toolInvocationOrMarkdown,e.originalParent);return}let t=e.lazy.value;if(this.appendItemToDOM(t.domNode,e.toolInvocationId,e.toolInvocationOrMarkdown,e.originalParent),t.disposable){let o=e.toolInvocationOrMarkdown&&(e.toolInvocationOrMarkdown.kind==="toolInvocation"||e.toolInvocationOrMarkdown.kind==="toolInvocationSerialized")?e.toolInvocationOrMarkdown.toolCallId:void 0;o?this.ownedToolParts.set(o,t.disposable):this._register(t.disposable)}}setupThinkingContainer(e){if(!this._store.isDisposed){if(this.appendedItemCount++,this.allThinkingParts.push(e),this.textContainer=_(".chat-thinking-item.markdown-content"),this.childResizeObserver&&this.fixedScrollingMode&&!this.streamingCompleted&&this._register(this.childResizeObserver.observe(this.textContainer)),e.value){if(this.isExpanded()||this.hasExpandedOnce||this.fixedScrollingMode&&!this.streamingCompleted)this.appendToWrapper(this.textContainer),this.id=e.id,this.updateThinking(e);else{this.content=e,this.id=e.id;let t={kind:"thinking",textContainer:this.textContainer,content:e};this.lazyItems.push(t)}this.workingSpinnerLabel&&(this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage("thinking"))}this.updateDropdownClickability()}}setTitle(e,t){if(!e||this.element.isComplete)return;if(t){if(this._collapseButton){let s=this._collapseButton.labelElement;s.textContent="";let l=_("span");l.textContent=e,s.appendChild(l),this._collapseButton.element.ariaLabel=e}this.titleShimmerSpan=void 0,this.titleDetailContainer=void 0,this._titleDetailRendered.clear(),this.currentTitle=e;return}this.lastExtractedTitle=e;let o=d(8871,null,this.defaultTitle,e);if(this.currentTitle=o,!this._collapseButton)return;let n=this._collapseButton.labelElement;(!this.titleShimmerSpan||!this.titleShimmerSpan.parentElement)&&(n.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),n.appendChild(this.titleShimmerSpan)),this.titleShimmerSpan.textContent=d(8872,null,this.defaultTitle),this._titleDetailRendered.clear();let r=this.chatContentMarkdownRenderer.render(new he(e));r.element.classList.add("collapsible-title-content","chat-thinking-title-detail"),N_(r.element,this.instantiationService,this.chatMarkdownAnchorService,this._store),this._titleDetailRendered.value=r,this.titleDetailContainer?this.titleDetailContainer.replaceWith(r.element):n.appendChild(r.element),this.titleDetailContainer=r.element,this._collapseButton.element.ariaLabel=o,this._collapseButton.element.ariaExpanded=String(this.isExpanded())}hasSameContent(e,t,o){return o.isComplete||e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized"||e.kind==="markdownContent"||e.kind==="hook"?!0:e.kind!=="thinking"?!1:e?.id!==this.id}dispose(){this.isActive=!1,this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0),this.pendingRemovalFlushDisposable?.dispose(),this.pendingRemovalFlushDisposable=void 0,this.pendingScrollDisposable?.dispose(),super.dispose()}};WE=I([m(4,F),m(5,B),m(6,gS),m(7,Gr),m(8,ot),m(9,de),m(10,Ai)],WE);var KR=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.chatContentMarkdownRenderer=t;this.toolInvocation=l;this.instantiationService=u;this.chatMarkdownAnchorService=p;this.configurationService=h;this.renderedMessage=this._register(new ue);this._fileWidgetStore=this._register(new O);this.currentContent=e.content;let g=o.content.slice(o.contentIndex+1);if(this.showSpinner=n??Oxo(g,o.element),this.isHidden=r!==!0&&g.some(x=>x.kind!=="progressMessage"),this.isHidden){this.domNode=_("");return}this.showSpinner&&this.configurationService.getValue("accessibility.verboseChatProgressUpdates")&&cn(Du(ma(e.content)));let f=s&&q.isEqual(s,q.modify(L.loading,"spin")),v=(c??(!s||f))&&this.showSpinner,b=v?L.check:s??(this.showSpinner?q.modify(L.loading,"spin"):L.check),S=this.chatContentMarkdownRenderer.render(e.content);S.element.classList.add("progress-step"),N_(S.element,this.instantiationService,this.chatMarkdownAnchorService,this._fileWidgetStore);let y=this.createApprovalMessage(),w=this._register(u.createInstance(VE,S.element,b,y));this.domNode=w.domNode,v&&this.domNode.classList.add("shimmer-progress"),this.renderedMessage.value=S}updateMessage(e){if(this.isHidden)return;let t=this._register(this.chatContentMarkdownRenderer.render(e));t.element.classList.add("progress-step"),this._fileWidgetStore.clear(),N_(t.element,this.instantiationService,this.chatMarkdownAnchorService,this._fileWidgetStore),this.renderedMessage.value?this.renderedMessage.value.element.replaceWith(t.element):this.domNode.appendChild(t.element),this.renderedMessage.value=t}hasSameContent(e,t,o){if(t.some(r=>r.kind!=="progressMessage")&&!this.isHidden)return!1;let n=Oxo(t,o);return e.kind==="progressMessage"&&e.content.value!==this.currentContent.value?!1:e.kind==="progressMessage"&&this.showSpinner===n}createApprovalMessage(){return this.toolInvocation&&ene(this.toolInvocation)}};KR=I([m(8,F),m(9,gS),m(10,B)],KR);function Oxo(a,i){return Ni(i)&&!i.isComplete&&a.length===0}var VE=class extends k{constructor(i,e,t,o){super(),this.domNode=_(".progress-container");let n=_("div");n.classList.add(...q.asClassNameArray(e)),t&&(this._register(o.setupDelayedHover(n,{content:t,style:1})),this._register(o.setupDelayedHover(i,{content:t,style:1}))),D(this.domNode,n),i.classList.add("progress-step"),D(this.domNode,i)}};VE=I([m(3,ot)],VE);var Fxo=1200,bqt=new Map;function gdn(a,i){let e=Date.now();for(let[r,s]of bqt)e-s.pickedAt>=Fxo&&bqt.delete(r);let t=bqt.get(a);if(t&&e-t.pickedAt<Fxo)return t.pickedAt=e,t.label;let n=wAi()??(()=>{let r=wst(yAi,i);return r[Math.floor(Math.random()*r.length)]})();return bqt.set(a,{label:n,pickedAt:e}),n}var one=class extends k{constructor(i,e,t,o,n,r,s){super(),this.explicitContent=i.content,this.label=gdn(t.element.id,r),this.domNode=_(".progress-container");let l=_("div"),c=i.state;this.hasState=!!c;let u=c?.isComplete??!1;this.isCompleteState=u,u?l.classList.add(...q.asClassNameArray(L.check)):l.classList.add(...q.asClassNameArray(q.modify(L.loading,"spin"))),D(this.domNode,l);let p=_("div.rendered-markdown.progress-step.chat-working-progress-step");this.labelElement=_("p"),this.statsElement=_("span"),D(p,this.labelElement),D(p,this.statsElement),D(this.domNode,p),u||this.domNode.classList.add("shimmer-progress"),c?this.initializeWithState(c):this.labelElement.textContent=this.explicitContent?ma(this.explicitContent):this.label,this._register(s.onDidPrepareToolCallBecomeUnresponsive(h=>{ze(t.element.sessionResource,h.sessionResource)&&this.updateWorkingContent(new he(d(8776,null,h.toolData.displayName)))}))}initializeWithState(i){i.isComplete?this.renderCompletedProgress(i):this.startLiveProgress(i)}renderCompletedProgress(i){}startLiveProgress(i){this.explicitContent||(this.labelElement.textContent=this.label)}updateWorkingContent(i){this.explicitContent=i,this.labelElement.textContent=ma(i),this.statsElement.textContent=""}hasSameContent(i,e,t){return i.kind!=="working"||!!i.state!==this.hasState||(i.state?.isComplete??!1)!==this.isCompleteState?!1:i.content?.value===this.explicitContent?.value}};one=I([m(3,F),m(4,gS),m(5,B),m(6,Wn)],one);var fdn=40,vdn=2e3,Wxo=80,Vxo=8,a0e=class{constructor(){this.handlesFlush=!0;this._fullMarkdown="";this._revealedWordCount=0;this._lastCommittedMarkdown="";this._needsNextFrame=!1;this._lastCommitTime=0;this._rate=Vxo}get needsNextFrame(){return this._needsNextFrame}setRate(i,e){e?this._rate=typeof i=="number"?Math.max(i,Wxo):Wxo:this._rate=typeof i=="number"?Math.min(Math.max(i,fdn),vdn):Vxo}getRenderable(i,e){return this._fullMarkdown=i,i}filterFlush(i){this._fullMarkdown=i;let e=Date.now();if(this._lastCommitTime===0)this._lastCommitTime=e,this._revealedWordCount=1;else{let o=e-this._lastCommitTime,n=Math.floor(o/1e3*this._rate);n>0&&(this._revealedWordCount+=n,this._lastCommitTime=e)}let t=xet(this._fullMarkdown,this._revealedWordCount);if(t.isFullString)return this._needsNextFrame=!1,this._revealedWordCount=t.returnedWordCount,this._lastCommittedMarkdown=this._fullMarkdown,this._fullMarkdown;if(this._needsNextFrame=!0,!(t.value.length<=this._lastCommittedMarkdown.length))return this._lastCommittedMarkdown=t.value,t.value}};var Sqt=class{constructor(){this.handlesFlush=!1}getRenderable(i,e){return i}};var bdn=4e3;function Sdn(a){let i=-1,e=!1;for(let t=0;t<a.length;t++){if((t===0||a[t-1]===`
`)&&(a[t]==="`"&&a[t+1]==="`"&&a[t+2]==="`"||a[t]==="~"&&a[t+1]==="~"&&a[t+2]==="~")){e=!e,t+=2;continue}!e&&a[t]===`
`&&a[t+1]===`
`&&(i=t)}return i}var Iqt=class{constructor(){this.handlesFlush=!1}getRenderable(i,e){let t=Sdn(i),o=t===-1?i:i.slice(0,t+2);return i.length-o.length>bdn&&(o=i),o}};var yqt={off:a=>new Sqt,word:a=>new a0e,paragraph:a=>new Iqt};var CAi=600,Idn=150,p6=class{constructor(i){this._style=i}animate(i,e,t,o){let n=`chat-smooth-animate-${this._style}`;for(let r=e;r<t;r++){let s=i[r];if(!s.classList)continue;let l=(r-e)*Idn,c=-o+l;s.classList.add(n),s.style.setProperty("--chat-smooth-duration",`${CAi}ms`),s.style.setProperty("--chat-smooth-delay",`${c}ms`),s.addEventListener("animationend",u=>{u.target===s&&(s.classList.remove(n),s.style.removeProperty("--chat-smooth-duration"),s.style.removeProperty("--chat-smooth-delay"))},{once:!0})}}};var wqt={none:()=>({animate(){}}),fade:()=>new p6("fade"),rise:()=>new p6("rise"),blur:()=>new p6("blur"),scale:()=>new p6("scale"),slide:()=>new p6("slide"),reveal:()=>new p6("reveal")};var l0e=class extends k{constructor(e,t){super();this._domNode=e;this._configService=t;this._lastMarkdown="";this._renderedMarkdown="";this._revealedChildCount=0;this._animationStartTime=0;this._batchChildCount=0;this._rafScheduled=!1;this._buffer=this._createBuffer(),this._animation=this._createAnimation(),this._register(this._configService.onDidChangeConfiguration(o=>{o.affectsConfiguration("chat.experimental.incrementalRendering.animationStyle")&&(this._animation=this._createAnimation()),o.affectsConfiguration("chat.experimental.incrementalRendering.buffering")&&(this._buffer.dispose?.(),this._buffer=this._createBuffer())}))}_createBuffer(){let e=this._configService.getValue("chat.experimental.incrementalRendering.buffering");return(Object.prototype.hasOwnProperty.call(yqt,e)?yqt[e]:yqt.paragraph)(this._domNode)}_createAnimation(){let e=this._configService.getValue("chat.experimental.incrementalRendering.animationStyle");return(Object.prototype.hasOwnProperty.call(wqt,e)?wqt[e]:wqt.fade)()}setRenderCallback(e){this._renderCallback=e}updateStreamRate(e,t){this._buffer instanceof a0e&&this._buffer.setRate(e,t),t&&!this._buffer.handlesFlush&&this._lastMarkdown.length>this._renderedMarkdown.length&&(this._pendingMarkdown=this._lastMarkdown,this._scheduleRender())}seed(e,t){if(this._lastMarkdown=e,this._animationStartTime=0,this._buffer.handlesFlush&&e.length>0){for(this._renderedMarkdown="",this._revealedChildCount=0;this._domNode.firstChild;)this._domNode.removeChild(this._domNode.firstChild);this._pendingMarkdown=e,this._scheduleRender();return}this._renderedMarkdown=e,this._revealedChildCount=t?0:this._domNode.children.length,t&&this._animateNewChildren()}tryMorph(e){if(!e.startsWith(this._lastMarkdown))return!1;if(e.slice(this._lastMarkdown.length).length===0)return!0;if(this._lastMarkdown=e,this._buffer.handlesFlush)return this._pendingMarkdown=e,this._scheduleRender(),!0;let o=this._buffer.getRenderable(e,this._renderedMarkdown);return o.length>this._renderedMarkdown.length&&(this._renderedMarkdown=o,this._pendingMarkdown=o,this._scheduleRender()),!0}_scheduleRender(){if(this._rafScheduled)return;this._rafScheduled=!0;let e=Me(this._domNode);this._rafHandle=e.requestAnimationFrame(()=>{this._rafScheduled=!1,this._rafHandle=void 0,this._flushRender()})}_flushRender(){let e=this._pendingMarkdown;if(this._pendingMarkdown=void 0,!(e===void 0||!this._renderCallback)){if(this._buffer.filterFlush){let t=this._buffer.filterFlush(e);if(t===void 0){this._buffer.needsNextFrame&&(this._pendingMarkdown=e,this._scheduleRender());return}e=t}this._renderedMarkdown=e,this._renderCallback(e),this._animateNewChildren(),this._buffer.needsNextFrame&&(this._pendingMarkdown=this._lastMarkdown,this._scheduleRender())}}_animateNewChildren(){let e=this._domNode.children,t=e.length;if(t<=this._revealedChildCount)return;let o=Date.now();if(this._animationStartTime!==0&&o-this._animationStartTime>=CAi&&(this._revealedChildCount=this._batchChildCount,this._animationStartTime=0,this._batchChildCount=0),t<=this._revealedChildCount)return;this._animationStartTime===0&&(this._animationStartTime=o),this._batchChildCount=t;let n=o-this._animationStartTime;this._animation.animate(e,this._revealedChildCount,t,n)}dispose(){this._rafHandle!==void 0&&(Me(this._domNode).cancelAnimationFrame(this._rafHandle),this._rafHandle=void 0),this._rafScheduled=!1,this._pendingMarkdown=void 0,this._renderCallback=void 0,this._buffer.dispose?.(),super.dispose()}};l0e=I([m(1,B)],l0e);var xst=le("IChatOutputPartStateCache"),Bxo="chat/outputPartStateCache",ydn="chat/toolOutputStateCache",wdn=100,Cst=class{constructor(i){this._cache=new Ua(wdn,.75);let e=i.get(Bxo,1,i.get(ydn,1,"{}"));this._deserialize(e);let t=U.filter(i.onWillSaveState,o=>o.reason===1);U.once(t)(()=>{i.store(Bxo,this._serialize(),1,1)})}get(i){return this._cache.get(i)}set(i,e){this._cache.set(i,e)}_serialize(){let i=Object.create(null);for(let[e,t]of this._cache)i[e]=t;return JSON.stringify(i)}_deserialize(i){try{let e=JSON.parse(i);for(let t in e){let o=e[t];typeof o.height=="number"&&this._cache.set(t,{height:o.height,webviewState:typeof o.webviewState=="string"?o.webviewState:void 0})}}catch{}}};Cst=I([m(0,de)],Cst);Ce(xst,Cst,1);var hO=_,UC=class extends k{constructor(e,t,o,n=!1,r=0,s,l,c,u,p,h,g,f,v){super();this.markdown=e;this.editorPool=o;this.rendererOptions=u;this.instantiationService=g;this.aiEditTelemetryService=f;this.chatOutputRendererService=v;this.codeblocksPartId=String(++UC.ID_POOL);this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this._onDidChangeDiff=this._register(new T);this.onDidChangeDiff=this._onDidChangeDiff.event;this.allRefs=[];this._codeblocks=[];this.mathLayoutParticipants=new Set;let b=t.element,S=wu(t.content,N=>N.kind==="undoStop",t.contentIndex)?.id,y=r;this.domNode=hO("div.chat-markdown-part"),this.rendererOptions.accessibilityOptions?.statusMessage&&(this.domNode.ariaLabel=this.rendererOptions.accessibilityOptions.statusMessage,h.getValue("accessibility.verboseChatProgressUpdates")&&Er(this.rendererOptions.accessibilityOptions.statusMessage));let w=h.getValue("chat.math.enabled");h.getValue("chat.experimental.incrementalRendering.enabled")&&Ni(b)&&n&&!b.isComplete&&(this._incrementalMorpher=this._register(g.createInstance(l0e,this.domNode)),this._incrementalMorpher.setRenderCallback(N=>{let V=this.markdown,H=new he(N,this.markdown.content);H.baseUri=A.revive(this.markdown.content.baseUri),H.uris=this.markdown.content.uris,this.markdown={...this.markdown,content:H},M(),this.markdown=V,this._onDidChangeHeight.fire()}));let E=this._register(new ue),M=()=>{if(this._store.isDisposed)return;let N=E.clearAndLeak(),V=new Map;for(let ce of this.allRefs)if(ce.object instanceof a1){let Se=ce;N?.deleteAndLeak(Se),V.set(Se.object.reuseKey,Se)}N?.dispose();let H=new O;E.value=H,St(this.domNode),this.allRefs.length=0,this._codeblocks.length=0,this.mathLayoutParticipants.clear(),y=r;let K=w?ui([jfe.getExtension(Me(t.container),{throwOnError:!1})]):[],j={gfm:!0,breaks:!0},J=H.add(s.render(this.markdown.content,{sanitizerConfig:jfe.getSanitizerOptions({allowedTags:Sst,allowedAttributes:sQe}),fillInIncompleteTokens:n,codeBlockRendererSync:(ce,Se,Re)=>{let xe=!Ni(t.element)||t.element.isComplete||!Re||Cqt(Re),He=!!ce&&this.chatOutputRendererService.hasCodeBlockRenderer(ce);if((!Se||Se.startsWith("<vscode_codeblock_uri")&&!Se.includes(`
`))&&!xe&&!He){let Bn=hO("div");return Bn.style.display="none",Bn}if(ce==="diff"&&Re&&this.rendererOptions.allowInlineDiffs){let Bn=Re.match(/^```diff:(\w+)/);if(Bn&&Ni(t.element)){let Mr=Bn[1],va=bst(Se),{before:$s,after:_l}=Cxo(va?.textWithoutResult??Se),mc={element:t.element,codeBlockIndex:y++,languageId:Mr,beforeContent:$s,afterContent:_l,codeBlockResource:va?.uri,isReadOnly:!0,horizontalPadding:this.rendererOptions.horizontalPadding},su=this.instantiationService.createInstance(Qfe,mc,t.diffEditorPool,t.currentWidth.get()),yu={object:su,isStale:()=>!1,dispose:()=>su.dispose()};return this.allRefs.push(yu),H.add(yu),su.element}}if(ce==="vscode-extensions")return H.add(g.createInstance(Uq,{kind:"extensions",extensions:Se.split(",")})).domNode;let Ee=y++,Te=Se,It=wxo(Se);Te=_dn(It.newText,ce);let tt=It.vulnerabilities,Oi,zt,mo=bst(Te);mo&&(Oi=mo.uri,zt=mo.isEdit,Te=mo.textWithoutResult);let dn=Ni(b)&&b.errorDetails?.responseIsFiltered,No={...this.rendererOptions.codeBlockRenderOptions};dn!==void 0&&(No.hideToolbar=dn);let _i={languageId:ce,text:Te,codeBlockIndex:Ee,element:b,parentContextKeyService:p,vulns:tt,codemapperUri:Oi,renderOptions:No,chatSessionResource:b.sessionResource},ln={ownerMarkdownPartId:this.codeblocksPartId,codeBlockIndex:Ee,elementId:b.id,chatSessionResource:b.sessionResource,languageId:ce,editDeltaInfo:Uy.fromText(Se)};if(b.isCompleteAddedRequest||!Oi||!zt){if(He){let Mr=this.renderChatOutputCodeBlock(ce,Te,Ee,t,xe,V);return this._codeblocks.push({...ln,codemapperUri:_i.codemapperUri,isStreamingEdit:!1,get uri(){},focus(){Mr.object.focus()}}),H.add(Mr),Mr.object.element}let Bn=this.renderCodeBlock(_i,c);return this._codeblocks.push({...ln,codemapperUri:_i.codemapperUri,isStreamingEdit:!1,get uri(){return Bn.object.uri},focus(){Bn.object.focus()}}),H.add(Bn),Bn.object.element}let Tn=_r(b)?b.id:b.requestId,Ko=this.renderCodeBlockPill(b.sessionResource,Tn,S,Oi);return this._codeblocks.push({...ln,codemapperUri:Oi,isStreamingEdit:!xe,get uri(){},focus(){return Ko.object.element.focus()}}),H.add(Ko),Ko.object.element},markedOptions:j,markedExtensions:K,...l},this.domNode));Ni(b)&&!b.model.codeBlockInfos&&b.model.isComplete&&b.model.initializeCodeBlockInfos(this._codeblocks.map(ce=>({suggestionId:this.aiEditTelemetryService.createSuggestionId({presentation:"codeBlock",feature:"sideBarChat",editDeltaInfo:ce.editDeltaInfo,languageId:ce.languageId,modeId:b.model.request?.modeInfo?.modeId,modelId:b.model.request?.modelId,applyCodeBlockSuggestionId:void 0,source:void 0,sourceRequestId:void 0})})));let se=g.createInstance(qoe);H.add(se.walkTreeAndAnnotateReferenceLinks(this.markdown,J.element));let ae=new uo(()=>{let ce=H.add(new zu("ChatMarkdownContentPart.mathLayout",()=>this.mathLayoutParticipants.forEach(Se=>Se())));return H.add(ce.observe(this.domNode)),this.mathLayoutParticipants});for(let ce of this.domNode.querySelectorAll(".katex-display")){if(!go(ce))continue;let Se=new Ar(ce.cloneNode(!0),{vertical:2,horizontal:1});H.add(Se),ce.replaceWith(Se.getDomNode()),ae.value.add(()=>{Se.scanDomNode()}),Se.scanDomNode()}H.add(bxo(this.domNode,ae)),je(V.values())};M(),this._incrementalMorpher?.seed(e.content.value,!0),w&&!jfe.getExtension(Me(t.container))&&jfe.loadExtension(Me(t.container)).then(()=>{M()}).catch(N=>{console.error("Failed to load MarkedKatexSupport extension:",N)})}static{this.ID_POOL=0}get codeblocks(){return this._codeblocks}dispose(){super.dispose(),je(this.allRefs),this.allRefs.length=0}renderCodeBlockPill(e,t,o,n){let r=this.instantiationService.createInstance(Zfe,e,t,o),s=new O,l={object:r,isStale:()=>!1,dispose:()=>{r.dispose(),s.dispose()}};return this.allRefs.push(l),s.add(r.onDidChangeDiff(()=>this.fireAggregatedDiff())),r.render(n),l}renderChatOutputCodeBlock(e,t,o,n,r,s){let l=a1.reuseKey(n.element.id,o,e),c=s.get(l);if(c?.object.hasSameContent(e,t,r))return s.delete(l),this.allRefs.push(c),c;let u=this.instantiationService.createInstance(a1,e,t,o,n,r,()=>this._onDidChangeHeight.fire()),p={object:u,isStale:()=>!1,dispose:()=>u.dispose()};return this.allRefs.push(p),p}fireAggregatedDiff(){let e=0,t=0;for(let o of this.allRefs)o.object instanceof Zfe&&o.object.diff&&(e+=o.object.diff.added,t+=o.object.diff.removed);this._onDidChangeDiff.fire({added:e,removed:t})}renderCodeBlock(e,t){let o=gk.poolKey(e.element.id,e.codeBlockIndex),n=this.editorPool.get(o);return this.allRefs.push(n),n.object.render(e,t),!this._store.isDisposed&&_r(e.element)&&this._onDidChangeHeight.fire(),n}hasSameContent(e){if(e.kind!=="markdownContent")return!1;if(e.content.value===this.markdown.content.value&&Hxo(e.inlineReferences,this.markdown.inlineReferences))return!0;let t=this._codeblocks.at(-1);return t&&t.codemapperUri!==void 0&&t.isStreamingEdit?e.content.value.lastIndexOf("```")===this.markdown.content.value.lastIndexOf("```"):!1}tryIncrementalUpdate(e){if(!this._incrementalMorpher||!Hxo(e.inlineReferences,this.markdown.inlineReferences))return!1;let t=this._incrementalMorpher.tryMorph(e.content.value);return t&&(this.markdown=e),t}updateStreamRate(e,t){this._incrementalMorpher?.updateStreamRate(e,t)}layout(e){this.allRefs.forEach((t,o)=>{if(t.object instanceof gk)t.object.layout(e);else if(t.object instanceof a1)t.object.layout(e);else if(t.object instanceof Qfe)t.object.layout(e);else if(t.object instanceof Zfe){let n=this._codeblocks[o];n.codemapperUri&&!ze(t.object.uri,n.codemapperUri)&&t.object.render(n.codemapperUri)}}),this.mathLayoutParticipants.forEach(t=>t())}onDidRemount(){for(let e of this.allRefs)(e.object instanceof gk||e.object instanceof a1)&&e.object.onDidRemount()}addDisposable(e){this._register(e)}};UC=I([m(9,X),m(10,B),m(11,F),m(12,XS),m(13,a8)],UC);function Hxo(a,i){if(a===i)return!0;if(!a||!i)return!a&&!i;let e=Object.keys(a),t=Object.keys(i);return e.length!==t.length?!1:e.every(o=>Cdn(a[o],i[o]))}function Cdn(a,i){return!a||!i?!a&&!i:a.resolveId===i.resolveId&&a.name===i.name&&kdn(a.inlineReference,i.inlineReference)}var Uxo={name:(a,i)=>a.name===i.name,containerName:(a,i)=>a.containerName===i.containerName,kind:(a,i)=>a.kind===i.kind,tags:(a,i)=>Tdn(a.tags,i.tags),location:(a,i)=>ze(a.location.uri,i.location.uri)&&G.equalsRange(a.location.range,i.location.range)},xdn=Object.keys(Uxo);function kdn(a,i){return A.isUri(a)||A.isUri(i)?A.isUri(a)&&A.isUri(i)&&ze(a,i):Bp(a)||Bp(i)?Bp(a)&&Bp(i)&&ze(a.uri,i.uri)&&G.equalsRange(a.range,i.range):Edn(a,i)}function Edn(a,i){return xdn.every(e=>Uxo[e](a,i))}function Tdn(a,i){return a===i?!0:!a||!i||a.length!==i.length?!1:a.every((e,t)=>e===i[t])}function Cqt(a){return a=a.trim(),!!a.match(/\n```+$/)}var a1=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.identifier=e;this.text=t;this.context=n;this.isComplete=r;this.onDidChangeHeight=s;this.instantiationService=l;this.chatOutputRendererService=c;this.stateCache=u;this._disposeCts=this._register(new qe);this._renderedOutputPart=this._register(new ue);this.reuseKey=a1.reuseKey(n.element.id,o,e);let p=d(8729,null,o+1);this.element=hO(".interactive-result-code-block.chat-output-code-block.tool-output-part"),this.element.tabIndex=-1,this.element.ariaLabel=p;let h=hO(".webview-output");h.style.maxHeight="80vh",h.style.minHeight="38px",this.element.appendChild(h);let g=`codeBlock/${n.element.sessionResource.toString()}/${n.element.id}/${o}/${e.toLowerCase()}`,f=this.stateCache.get(g)??{height:0};this.stateCache.set(g,f),f.height&&(h.style.height=`${f.height}px`);let v=hO("span");v.textContent=d(8728,null);let b=this._register(this.instantiationService.createInstance(VE,v,q.modify(L.loading,"spin"),void 0));if(h.appendChild(b.domNode),!r){this.onDidChangeHeight();return}this.chatOutputRendererService.renderCodeBlock(e,new TextEncoder().encode(t),h,{webviewState:f.webviewState,title:p,chatSessionResource:this.context.element.sessionResource},this._disposeCts.token).then(S=>{if(this._disposeCts.token.isCancellationRequested){S.dispose();return}this._renderedOutputPart.value=S,b.domNode.remove(),h.style.minHeight="",this.onDidChangeHeight(),this._register(S.webview.onDidUpdateState(y=>{f.webviewState=y})),this._register(S.onDidChangeHeight(y=>{f.height=y,this.onDidChangeHeight()})),this._register(this.context.onDidChangeVisibility(y=>{y&&S.reinitialize()}))},S=>{Yi(S)||(console.error("Error rendering chat code block:",S),b.domNode.replaceWith(this.renderError(S)),h.style.minHeight="",this.onDidChangeHeight())})}static reuseKey(e,t,o){return`${e}/${t}/${o.toLowerCase()}`}hasSameContent(e,t,o){return e.toLowerCase()===this.identifier.toLowerCase()&&t===this.text&&o===this.isComplete}dispose(){this._disposeCts.dispose(!0),super.dispose()}layout(e){this.element.style.maxWidth=`${e}px`}onDidRemount(){this._renderedOutputPart.value?.reinitialize()}focus(){let e=this._renderedOutputPart.value?.webview;e?e.focus():this.element.focus()}renderError(e){let t=hO(".output-error"),o=hO(".output-error-header");D(t,o);let n=hO("div");n.classList.add(...q.asClassNameArray(L.error)),o.append(n);let r=hO(".output-error-title");r.textContent=d(8727,null),o.append(r);let s=hO(".output-error-details");return s.textContent=e?.message||String(e),t.append(s),t}};a1=I([m(6,F),m(7,a8),m(8,xst)],a1);var Zfe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.sessionResource=e;this.requestId=t;this.inUndoStop=o;this.labelService=n;this.editorService=r;this.modelService=s;this.languageService=l;this.contextMenuService=c;this.contextKeyService=u;this.menuService=p;this.hoverService=h;this.chatService=g;this.configurationService=f;this.hover=this._register(new ue);this._onDidChangeDiff=this._register(new T);this.onDidChangeDiff=this._onDidChangeDiff.event;this.progressStore=this._store.add(new O);this.element=hO("div.chat-codeblock-pill-container"),this.statusIndicatorContainer=hO("div.status-indicator-container"),this.pillElement=hO(".chat-codeblock-pill-widget"),this.pillElement.tabIndex=0,this.pillElement.classList.add("show-file-icons"),this.pillElement.role="button",this.element.appendChild(this.statusIndicatorContainer),this.element.appendChild(this.pillElement),this.registerListeners()}get uri(){return this._uri}get diff(){return this.currentDiff}registerListeners(){this._register(qrt(this.pillElement,e=>this.showDiff(e))),this._register($(this.pillElement,ne.CONTEXT_MENU,e=>{let t=new Ln(Me(e),e);Kt.stop(e,!0),this.contextMenuService.showContextMenu({contextKeyService:this.contextKeyService,getAnchor:()=>t,getActions:()=>{if(!this.uri)return[];let o=this.menuService.getMenuActions(R.ChatEditingCodeBlockContext,this.contextKeyService,{arg:{sessionResource:this.sessionResource,requestId:this.requestId,uri:this.uri,stopId:this.inUndoStop}});return Lu(o)}})}))}showDiff({editorOptions:e,openToSide:t}){this.currentDiff?this.editorService.openEditor({original:{resource:this.currentDiff.originalURI},modified:{resource:this.currentDiff.modifiedURI},options:e},t?En:void 0):this.uri&&this.editorService.openEditor({resource:this.uri,options:e},t?En:void 0)}render(e){this.progressStore.clear(),this._uri=e;let t=this.chatService.getSession(this.sessionResource),o=this.labelService.getUriBasenameLabel(e),n=_("span.status-icon"),r=_("span.status-label",{},"");this.statusIndicatorContainer.replaceChildren(n,r);let s=_("span.icon"),l=_("span.icon-label",{},o),c=_("span.label-detail",{},""),u=_("span.progress-fill");this.pillElement.replaceChildren(u,s,l,c);let p=this.labelService.getUriLabel(e,{relative:!0});this.updateTooltip(p);let h=t?.editingSession;if(!h)return;let g=ke(S=>{let y=h.readEntry(e,S);return y&&h.getEntryDiffBetweenStops(y.modifiedURI,this.requestId,this.inUndoStop)}).map((S,y)=>S?.read(y)),f=ke(S=>{let w=h.readEntry(e,S)?.isCurrentlyBeingModifiedBy.read(S);return!!w&&w.responseModel.requestId===this.requestId&&w.undoStopId===this.inUndoStop}),v=[],b=[];this.progressStore.add(ve(S=>{if(n.classList.remove(...v),s.classList.remove(...b),f.read(S)){let y=q.modify(L.loading,"spin");v=q.asClassNameArray(y),n.classList.add(...v);let w=h.readEntry(e,S),x=Math.floor((w?.rewriteRatio.read(S)||0)*100);r.textContent=d(8719,null),this.configurationService.getValue("chat.agent.codeBlockProgress")?(u.style.width=`${x}%`,this.pillElement.classList.add("progress-filling"),c.textContent=""):(u.style.width="0%",this.pillElement.classList.remove("progress-filling"),c.textContent=x===0||!x?d(8724,null):d(8720,null,x))}else{let y=L.check;v=q.asClassNameArray(y),n.classList.add(...v),r.textContent=d(8723,null);let w=e.path.endsWith("/")?1:0;b=Ia(this.modelService,this.languageService,e,w),s.classList.add(...b),this.pillElement.classList.remove("progress-filling"),u.style.width="0%",c.textContent=""}})),this.progressStore.add(uD(S=>{let y=g.read(S);if(y===void 0)return;let w=this.pillElement.querySelector(".label-added")??this.pillElement.appendChild(_("span.label-added")),x=this.pillElement.querySelector(".label-removed")??this.pillElement.appendChild(_("span.label-removed"));if(y&&!y?.identical&&!y?.quitEarly){this.currentDiff=y,this._onDidChangeDiff.fire(y),w.textContent=`+${y.added}`,x.textContent=`-${y.removed}`;let E=y.added===1?d(8726,null):d(8725,null,y.added),M=y.removed===1?d(8722,null):d(8721,null,y.removed),N=d(8730,null,o,E,M);this.element.ariaLabel=N,y.isFinal&&S.dispose()}}))}updateTooltip(e){this.tooltip=e,this.hover.value||(this.hover.value=this.hoverService.setupDelayedHover(this.pillElement,()=>({content:this.tooltip,style:1,position:{hoverPosition:2},persistence:{hideOnKeyDown:!0}})))}};Zfe=I([m(3,nt),m(4,ie),m(5,_t),m(6,Rt),m(7,Xe),m(8,X),m(9,Yt),m(10,ot),m(11,si),m(12,B)],Zfe);function _dn(a,i){return i==="php"&&!a.trim().startsWith("<?")?`<?php
${a}`:a}var Kq=class extends k{constructor(e,t,o,n,r,s){super();this.element=e;this._title=t;this._renderer=n;this._instantiationService=r;this._chatMarkdownAnchorService=s;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this._renderedTitle=this._register(new ue);this._fileWidgetStore=this._register(new O);if(e.classList.add("chat-query-title-part"),this._renderedTitle.value=this.renderTitle(t),e.append(this._renderedTitle.value.element),o){let l=this.toMdString(o),c=this._register(n.render(l,this.getRenderOptions())),u=document.createElement("small");u.appendChild(c.element),e.append(u)}}get title(){return this._title}set title(e){this._title=e;let t=this.renderTitle(e),o=this._renderedTitle.value?.element;o?.parentElement?o.replaceWith(t.element):this.element.appendChild(t.element),this._renderedTitle.value=t}toMdString(e){return typeof e=="string"?new he("",{supportThemeIcons:!0}).appendText(e):new he(e.value,{supportThemeIcons:!0,isTrusted:e.isTrusted})}setOptions(e){this.options=e,this.title=this._title}renderTitle(e){let t=this._renderer.render(this.toMdString(e),this.getRenderOptions());return this._fileWidgetStore.clear(),this.options?.renderFileWidgets&&N_(t.element,this._instantiationService,this._chatMarkdownAnchorService,this._fileWidgetStore),t}getRenderOptions(){return{...this.options?.markdownRenderOptions,asyncRenderCallback:()=>this._onDidChangeHeight.fire()}}};Kq=I([m(3,_n),m(4,F),m(5,gS)],Kq);var kst=class extends k{constructor(e,t,o,n,r,s){super();this.context=e;this.instantiationService=o;this._markdownRendererService=n;this._onDidClick=this._register(new T);this.messageContentDisposables=this._register(new ue);let{title:l,subtitle:c,message:u,buttons:p}=t,h=st(".chat-confirmation-widget-container@container",[st(".chat-confirmation-widget@root",[st(".chat-confirmation-widget-title@title"),st(".chat-confirmation-widget-message-container",[st(".chat-confirmation-widget-message@message"),st(".chat-buttons-container@buttonsContainer",[st(".chat-buttons@buttons"),st(".chat-toolbar@toolbar")])])])]);zxo(h.container,l,u),this._domNode=h.root,this._register(o.createInstance(Kq,h.title,l,c)),this.messageElement=h.message;let g=this.messageElement.parentElement,f=this.messageElement.nextSibling;this.messageScrollable=this._register(new Ar(this.messageElement,{vertical:1,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0})),this.messageScrollable.getDomNode().classList.add("chat-confirmation-widget-message-scrollable"),g?.insertBefore(this.messageScrollable.getDomNode(),f);let v=this._register(new zu("BaseSimpleChatConfirmationWidget.message",()=>this.messageScrollable.scanDomNode()));if(this._register(v.observe(this.messageElement)),this._register(v.observe(this.messageScrollable.getDomNode())),p.forEach(b=>{let S={...Ro,small:!0,secondary:b.isSecondary,title:b.tooltip,disabled:b.disabled},y;b.moreActions?y=new Jv(h.buttons,{...S,contextMenuProvider:r,addPrimaryActionToDropdown:!1,actions:b.moreActions.map(w=>w instanceof oi?w:this._register(new it(w.label,w.label,void 0,!w.disabled,()=>(this._onDidClick.fire({button:w,isTouchClick:!1}),Promise.resolve()))))}):y=new Pi(h.buttons,S),this._register(y),y.label=b.label,this._register(y.onDidClick(w=>this._onDidClick.fire({button:b,isTouchClick:!!w&&w.type===Vn.Tap}))),b.onDidChangeDisablement&&this._register(b.onDidChangeDisablement(w=>y.enabled=!w))}),t?.toolbarData){let b=s.createOverlay([["chatConfirmationPartType",t.toolbarData.partType],["chatConfirmationPartSource",t.toolbarData.partSource]]),S=this._register(o.createChild(new Po([X,b])));this._register(S.createInstance(pr,h.toolbar,R.ChatConfirmationMenu,{menuOptions:{arg:t.toolbarData.arg,shouldForwardArgs:!0}}))}}get onDidClick(){return this._onDidClick.event}get domNode(){return this._domNode}setShowButtons(e){this.domNode.classList.toggle("hideButtons",!e)}renderMessage(e){let t=new O,o=t.add(new zu("BaseSimpleChatConfirmationWidget.messageContent",()=>this.messageScrollable.scanDomNode()));t.add(o.observe(e)),this.messageContentDisposables.value=t,this.messageElement.append(e),this.messageScrollable.scanDomNode()}};kst=I([m(2,F),m(3,_n),m(4,Xe),m(5,X)],kst);var c0e=class extends kst{constructor(i,e,t,o,n,r){super(i,e,t,o,n,r),this.updateMessage(e.message)}updateMessage(i){this._renderedMessage?.remove();let e=this._register(this._markdownRendererService.render(typeof i=="string"?new he(i):i));this.renderMessage(e.element),this._renderedMessage=e.element}};c0e=I([m(2,F),m(3,_n),m(4,Xe),m(5,X)],c0e);var d0e=class extends k{constructor(e,t,o,n,r,s,l){super();this._context=e;this.instantiationService=o;this.markdownRendererService=n;this.contextMenuService=r;this.chatMarkdownAnchorService=l;this._onDidClick=this._register(new T);this.messageContentDisposables=this._register(new ue);this.markdownContentPart=this._register(new ue);let{title:c,subtitle:u,message:p,buttons:h,icon:g,footerBanner:f}=t,v=st(".chat-confirmation-widget-container@container",[st(".chat-confirmation-widget2@root",[st(".chat-confirmation-widget-title",[st(".chat-title@title"),st(".chat-toolbar-container@buttonsContainer",[st(".chat-toolbar@toolbar")])]),st(".chat-confirmation-widget-message@message"),st(".chat-confirmation-widget-buttons",[st(".chat-buttons@buttons")])])]);zxo(v.container,c,p,f),this._domNode=v.root,this._buttonsDomNode=v.buttons,this._register(o.createInstance(Kq,v.title,new he(g?`$(${g.id}) ${typeof c=="string"?c:c.value}`:typeof c=="string"?c:c.value),u)),this.messageElement=v.message;let b=this.messageElement.parentElement,S=this.messageElement.nextSibling;this.messageScrollable=this._register(new Ar(this.messageElement,{vertical:1,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0})),this.messageScrollable.getDomNode().classList.add("chat-confirmation-widget-message-scrollable"),b?.insertBefore(this.messageScrollable.getDomNode(),S);let y=this._register(new zu("BaseChatConfirmationWidget.message",()=>this.messageScrollable.scanDomNode()));if(this._register(y.observe(this.messageElement)),this._register(y.observe(this.messageScrollable.getDomNode())),f&&(this.messageScrollable.getDomNode().insertAdjacentElement("afterend",f),f.hasAttribute("aria-live")||f.setAttribute("aria-live","polite")),this.updateButtons(h),t?.toolbarData){let w=s.createOverlay([["chatConfirmationPartType",t.toolbarData.partType],["chatConfirmationPartSource",t.toolbarData.partSource]]),x=this._register(o.createChild(new Po([X,w])));this._register(x.createInstance(pr,v.toolbar,R.ChatConfirmationMenu,{menuOptions:{arg:t.toolbarData.arg,shouldForwardArgs:!0}}))}}get onDidClick(){return this._onDidClick.event}get domNode(){return this._domNode}setShowButtons(e){this.domNode.classList.toggle("hideButtons",!e)}get codeblocksPartId(){return this.markdownContentPart.value?.codeblocksPartId}get codeblocks(){return this.markdownContentPart.value?.codeblocks}updateButtons(e){for(;this._buttonsDomNode.children.length>0;)this._buttonsDomNode.children[0].remove();for(let t of e){let o={...Ro,small:!0,secondary:t.isSecondary,title:t.tooltip,disabled:t.disabled},n;t.moreActions?n=new Jv(this._buttonsDomNode,{...o,contextMenuProvider:this.contextMenuService,addPrimaryActionToDropdown:!1,actions:t.moreActions.map(r=>r instanceof oi?r:this._register(new it(r.label,r.label,void 0,!r.disabled,()=>(this._onDidClick.fire({button:r,isTouchClick:!1}),Promise.resolve()))))}):n=new Pi(this._buttonsDomNode,o),this._register(n),n.label=t.label,this._register(n.onDidClick(r=>this._onDidClick.fire({button:t,isTouchClick:!!r&&r.type===Vn.Tap}))),t.onDidChangeDisablement&&this._register(t.onDidChangeDisablement(r=>n.enabled=!r))}}renderMessage(e){if(this.markdownContentPart.clear(),!go(e)){let n=this._register(this.instantiationService.createInstance(UC,{kind:"markdownContent",content:typeof e=="string"?new he().appendMarkdown(e):e},this._context,this._context.editorPool,!1,this._context.codeBlockStartIndex,this.markdownRendererService,void 0,this._context.currentWidth.get(),{allowInlineDiffs:!0,horizontalPadding:6}));N_(n.domNode,this.instantiationService,this.chatMarkdownAnchorService,this._store),this.markdownContentPart.value=n,e=n.domNode}St(this.messageElement);let t=new O,o=t.add(new zu("BaseChatConfirmationWidget.messageContent",()=>this.messageScrollable.scanDomNode()));t.add(o.observe(e)),this.markdownContentPart.value&&t.add(this.markdownContentPart.value.onDidChangeHeight(()=>this.messageScrollable.scanDomNode())),this.messageContentDisposables.value=t,this.messageElement.append(e),this.messageScrollable.scanDomNode()}};d0e=I([m(2,F),m(3,_n),m(4,Xe),m(5,X),m(6,gS)],d0e);var nne=class extends d0e{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s),this.renderMessage(e.message)}updateMessage(i){this._renderedMessage?.remove();let e=this._register(this.markdownRendererService.render(typeof i=="string"?new he(i):i));this.renderMessage(e.element),this._renderedMessage=e.element}};nne=I([m(2,F),m(3,_n),m(4,Xe),m(5,X),m(6,gS)],nne);var Gq=class extends d0e{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s),this.renderMessage(e.message)}};Gq=I([m(2,F),m(3,_n),m(4,Xe),m(5,X),m(6,gS)],Gq);function zxo(a,i,e,t){a.tabIndex=0;let o=typeof i=="string"?i:i.value,n=typeof e=="string"?e:e&&"value"in e?e.value:e&&"textContent"in e?e.textContent:"",r=t?.textContent?.trim()??"";a.setAttribute("aria-label",r?d(8697,null,o,n,r):d(8696,null,o,n)),a.classList.add("chat-confirmation-widget-container")}var xb=class a extends k{constructor(e){super();this.toolInvocation=e;this._onNeedsRerender=this._register(new T);this.onNeedsRerender=this._onNeedsRerender.event;this._codeBlocksPartId="tool-"+a.idPool++}static{this.idPool=0}get codeblocksPartId(){return this._codeBlocksPartId}getIcon(){let e=this.toolInvocation,t=pi.executionConfirmedOrDenied(e);return t?.type===5?L.circleSlash:t?.type===0?L.error:pi.isComplete(e)?L.check:q.modify(L.loading,"spin")}};var Ddn="tool-risk-badge",rne=class extends k{constructor(e){super();this._hoverService=e;this._hoverStore=this._register(new O);this._detailsHoverStore=this._register(new O);this._onDidHide=this._register(new T);this.onDidHide=this._onDidHide.event;this.domNode=_(`span.${Ddn}`),this._iconEl=_("span.tool-risk-icon"),this._textEl=_("span.tool-risk-text"),this._detailsIconEl=_("span.tool-risk-details-icon"),this._detailsIconEl.classList.add(...q.asClassNameArray(L.info)),this._detailsIconEl.tabIndex=0,this._detailsIconEl.setAttribute("role","button"),this._detailsIconEl.setAttribute("aria-label",d(9033,null)),this.domNode.append(this._iconEl,this._textEl,this._detailsIconEl),this._refreshDetailsHover(),this.setLoading(),this._register($(this._detailsIconEl,ne.CLICK,t=>{t.preventDefault(),t.stopPropagation(),this._hoverService.showManagedHover(this._detailsIconEl)})),this._register($(this._detailsIconEl,ne.KEY_DOWN,t=>{let o=new mi(t);(o.keyCode===3||o.keyCode===10)&&(o.preventDefault(),o.stopPropagation(),this._hoverService.showManagedHover(this._detailsIconEl))}))}get isDisposed(){return this._store.isDisposed}setLoading(){this._setVariant("loading"),this._setIcon(q.modify(L.loading,"spin"));let e=d(9031,null);this._textEl.textContent=e,this._setHover(d(9032,null))}setHidden(){this.domNode.style.display="none",this._onDidHide.fire()}setAssessment(e){switch(e.risk){case"green":this._setVariant("green"),this._setIcon(L.pass);break;case"orange":this._setVariant("orange"),this._setIcon(L.warning);break;case"red":this._setVariant("red"),this._setText("!");break}this.domNode.style.display="",this._textEl.textContent=e.explanation,this._setHover(e.explanation)}setDetails(e){this._details=e,this._refreshDetailsHover()}getDetailsMarkdown(){return this._buildDetailsMarkdown()}_setVariant(e){this.domNode.classList.remove("green","orange","red","loading"),this.domNode.classList.add(e)}_setIcon(e){this._iconEl.textContent="",this._iconEl.className="tool-risk-icon "+q.asClassName(e)}_setText(e){this._iconEl.className="tool-risk-icon",this._iconEl.textContent=e}_setHover(e){this._hoverStore.clear(),this._hoverStore.add(this._hoverService.setupManagedHover(yi("mouse"),this.domNode,e))}_refreshDetailsHover(){this._detailsHoverStore.clear();let e=this._buildDetailsMarkdown(),t=e.value.replace(/\$\([^)]+\)\s?/g,"");this._detailsHoverStore.add(this._hoverService.setupManagedHover(yi("element"),this._detailsIconEl,{markdown:e,markdownNotSupportedFallback:t}))}_buildDetailsMarkdown(){let e=d(9030,null),t=this._details,o=new he(void 0,{supportThemeIcons:!0,isTrusted:typeof t=="object"&&t?t.isTrusted:void 0});return o.appendText(e),t&&(o.appendMarkdown(`

`),typeof t=="string"?o.appendText(t):o.appendMarkdown(t.value)),o}};rne=I([m(0,ot)],rne);var eve=class extends xb{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E){super(e);this.context=o;this.renderer=n;this.editorPool=r;this.currentWidthDelegate=s;this.codeBlockStartIndex=l;this.instantiationService=c;this.dialogService=u;this.keybindingService=p;this.languageService=h;this.configurationService=g;this.contextKeyService=f;this.chatWidgetService=v;this.preferencesService=b;this.storageService=S;this.terminalChatService=y;this.languageModelToolsService=x;this.riskAssessmentService=E;this.codeblocks=[];let M=e.state.get();if(M.type!==pi.StateKind.WaitingForConfirmation||!M.confirmationMessages?.title)throw new Error("Confirmation messages are missing");t=yR(t);let{title:N,message:V,disclaimer:H,terminalCustomActions:K}=M.confirmationMessages,j=t.presentationOverrides?.commandLine??t.confirmation?.commandLine??(t.commandLine.toolEdited??t.commandLine.original).trimStart(),J=t.confirmation?.cdPrefix??"",se=!!t.presentationOverrides,ae=this.configurationService.getValue(Yp.EnableAutoApprove)===!0,ce=this.storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1),Se;if(ae){if(Se=[],!ce&&(Se.push({label:d(8953,null),data:{type:"enable"}}),Se.push(new oi),K))for(let No of K)No instanceof oi||(No.disabled=!0);K&&Se.push(...K),Se.length===0&&(Se=void 0)}let Re={hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:se,tabFocusMode:!0,ariaLabel:typeof N=="string"?N:N.value}},xe=this.languageService.getLanguageIdByLanguageName(t.presentationOverrides?.language??t.language??"sh")??"shellscript",He=gk.poolKey(this.context.element.id,this.codeBlockStartIndex),Ee=this._register(this.editorPool.get(He));Ee.object.render({codeBlockIndex:this.codeBlockStartIndex,element:this.context.element,languageId:xe,text:j,renderOptions:Re,chatSessionResource:this.context.element.sessionResource},this.currentWidthDelegate());let Te=Ee.object.editor.getModel();this.codeblocks.push({codeBlockIndex:this.codeBlockStartIndex,codemapperUri:void 0,elementId:this.context.element.id,focus:()=>Ee.object.focus(),ownerMarkdownPartId:this.codeblocksPartId,uri:Te.uri,chatSessionResource:this.context.element.sessionResource}),this._register(Te.onDidChangeContent(()=>{let No=Te.getValue();No!==j?t.commandLine.userEdited=J+No:t.commandLine.userEdited=void 0}));let It=st(".chat-confirmation-message-terminal",[st(".chat-confirmation-message-terminal-editor@editor"),st(".chat-confirmation-message-terminal-disclaimer@disclaimer")]);D(It.editor,Ee.object.element),this._register(w.setupDelayedHover(It.editor,{content:V||"",style:1,position:{hoverPosition:0}}));let tt=this._createRiskBadge(M.parameters),Oi=this._register(this.instantiationService.createInstance(Gq,this.context,{title:N,icon:L.terminal,message:It.root,footerBanner:tt?.domNode,buttons:this._createButtons(Se)})),zt=[];if(t.requestUnsandboxedExecution){let No=t.requestUnsandboxedExecutionReason&&t.requestUnsandboxedExecutionReason.trim()||d(8959,null),_i=new he(void 0,{supportThemeIcons:!0});_i.appendMarkdown(`$(${L.info.id}) `),_i.appendText(No),zt.push({inline:_i,hoverLabel:d(8958,null),hoverBody:Ru(No),isTrusted:void 0})}if(H){let No=typeof H=="string"?new he(H):H,_i=No.value.replace(/^\s*\$\([^)]+\)\s*/,"");zt.push({inline:No,hoverLabel:d(8957,null),hoverBody:_i,isTrusted:No.isTrusted})}let mo=()=>{It.disclaimer.replaceChildren();for(let No of zt)this._appendMarkdownPart(It.disclaimer,No.inline,Re)};if(tt&&zt.length){let No=new he(void 0,{supportThemeIcons:!0,isTrusted:zt.reduce((_i,ln)=>ln.isTrusted===!0||_i===!0?!0:typeof ln.isTrusted=="object"&&ln.isTrusted?{enabledCommands:[...new Set([...typeof _i=="object"&&_i?.enabledCommands?_i.enabledCommands:[],...ln.isTrusted.enabledCommands])]}:_i,void 0)});zt.forEach((_i,ln)=>{ln>0&&No.appendMarkdown(`

`),No.appendMarkdown(`**${Ru(_i.hoverLabel)}** ${_i.hoverBody}`)}),tt.setDetails(No),this._register(tt.onDidHide(()=>mo()))}else mo();let dn=Z.Editing.hasToolConfirmation.bindTo(this.contextKeyService);dn.set(!0),this._register(ee(()=>dn.reset())),this._register(Oi.onDidClick(async({button:No,isTouchClick:_i})=>{let ln=!0,Tn=No.data,Ko=0;if(typeof Tn=="boolean")Tn&&(Ko=4,t.autoApproveInfo&&(t.autoApproveInfo=void 0));else if(typeof Tn!="boolean")switch(Tn.type){case"enable":{if(await this._showAutoApproveWarning()){if(this.storageService.store("chat.tools.terminal.autoApprove.warningAccepted",!0,-1,0),t.autoApproveInfo)Ko=4;else if(K){for(let Mr of K)Mr instanceof oi||(Mr.disabled=!1);Oi.updateButtons(this._createButtons(K)),ln=!1}}else ln=!1;break}case"skip":{Ko=5;break}case"newRule":{let mc=function(sr,Lo){return sr.map(kc=>{if(Lo==="session")return`\`${kc.key}\``;let Cn=Lo==="workspace"?5:2,xa=nc(aw.OpenTerminalSettingsLink,Cn);return`[\`${kc.key}\`](${xa.toString()} "${d(8966,null)}")`}).join(", ")},Bn=Ec(Tn.rule),Mr=Bn.filter(sr=>sr.scope==="session"),va=Bn.filter(sr=>sr.scope==="workspace"),$s=Bn.filter(sr=>sr.scope==="user"),_l=this.context.element.sessionResource;for(let sr of Mr)this.terminalChatService.addSessionAutoApproveRule(_l,sr.key,sr.value);if(va.length>0){let Lo=this.configurationService.inspect(Yp.AutoApprove).workspaceValue??{};if(Di(Lo)){let kc={...Lo};for(let Cn of va)kc[Cn.key]=Cn.value;await this.configurationService.updateValue(Yp.AutoApprove,kc,5)}else throw this.preferencesService.openSettings({jsonEditor:!0,target:5,revealSetting:{key:Yp.AutoApprove}}),new ka("Cannot add new rule, existing workspace setting is unexpected format")}if($s.length>0){let Lo=this.configurationService.inspect(Yp.AutoApprove).userValue??{};if(Di(Lo)){let kc={...Lo};for(let Cn of $s)kc[Cn.key]=Cn.value;await this.configurationService.updateValue(Yp.AutoApprove,kc,2)}else throw this.preferencesService.openSettings({jsonEditor:!0,target:2,revealSetting:{key:Yp.AutoApprove}}),new ka("Cannot add new rule, existing setting is unexpected format")}let su={isTrusted:{enabledCommands:[aw.OpenTerminalSettingsLink]}},yu=[];Mr.length>0&&yu.push(Mr.length===1?d(8960,null,mc(Mr,"session")):d(8961,null,mc(Mr,"session"))),va.length>0&&yu.push(va.length===1?d(8964,null,mc(va,"workspace")):d(8965,null,mc(va,"workspace"))),$s.length>0&&yu.push($s.length===1?d(8962,null,mc($s,"user")):d(8963,null,mc($s,"user"))),yu.length>0&&(t.autoApproveInfo=new he(yu.join(", "),su)),Ko=4;break}case"configure":{this.preferencesService.openSettings({target:2,query:`@id:${Yp.AutoApprove}`}),ln=!1;break}case"sessionApproval":{let Bn=this.context.element.sessionResource;this.terminalChatService.setChatSessionAutoApproval(Bn,!0);let Mr=nc(aw.DisableSessionAutoApproval,Bn),va={isTrusted:{enabledCommands:[aw.DisableSessionAutoApproval]}};t.autoApproveInfo=new he(`${d(8967,null)} ([${d(8968,null)}](${Mr.toString()}))`,va),Ko=4;break}}ln&&(pi.confirmWith(e,{type:Ko}),_i||this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput())})),this.domNode=Oi.domNode}_createButtons(e){let t=(o,n,r=o)=>{let s=this.keybindingService.appendKeybinding(r,n);return{label:o,tooltip:s}};return[{...t(d(8970,null),n1),data:!0,moreActions:e},{...t(d(8971,null),$fe,d(8969,null)),data:{type:"skip"},isSecondary:!0}]}async _showAutoApproveWarning(){return(await this.dialogService.prompt({type:wt.Info,message:d(8956,null),buttons:[{label:d(8952,null),run:()=>!0}],cancelButton:!0,custom:{icon:L.shield,markdownDetails:[{markdown:new he(d(8954,null))},{markdown:new he(`[${d(8955,null)}](https://code.visualstudio.com/docs/copilot/security#_security-considerations)`)}]}})).result===!0}_createRiskBadge(e){if(!this.riskAssessmentService.isEnabled())return;let t=this.languageModelToolsService.getTool(this.toolInvocation.toolId);if(!t)return;let o=this._register(this.instantiationService.createInstance(rne)),n=this.riskAssessmentService.getCached(t,e);if(n)o.setAssessment(n);else{o.setLoading();let r=new qe;this._register(ee(()=>r.dispose(!0))),(async()=>{try{let s=await this.riskAssessmentService.assess(t,e,r.token);if(r.token.isCancellationRequested||o.isDisposed)return;if(!s){o.setHidden();return}o.setAssessment(s)}catch{o.isDisposed||o.setHidden()}})()}return o}_appendMarkdownPart(e,t,o){let n=this._register(this.instantiationService.createInstance(UC,{kind:"markdownContent",content:typeof t=="string"?new he().appendMarkdown(t):t},this.context,this.editorPool,!1,this.codeBlockStartIndex,this.renderer,void 0,this.currentWidthDelegate(),{codeBlockRenderOptions:o}));D(e,n.domNode)}};eve=I([m(7,F),m(8,ct),m(9,Le),m(10,Rt),m(11,B),m(12,X),m(13,Lt),m(14,Qo),m(15,de),m(16,tg),m(17,ot),m(18,Wn),m(19,UFe)],eve);var Kxo=!1,Rdn=[{commands:[new RegExp(/^python3? -m pip install(\b)/),new RegExp(/^pip3? install(\b)/)],tags:["python environment"]},{commands:[new RegExp(/^python3? -m jupyter(\b)/),new RegExp(/^python3? -m pip install\b.*jupyter\b.*/),new RegExp(/^pip3? install\b.*jupyter\b.*/),new RegExp(/^jupyter(\b)/)],tags:["python environment","jupyter environment"]}];function Gxo(a,i){let e=i.getTools(void 0);if(!e||Kxo)return;let t=new Set,o=[`The terminal command '${a}' was not executed.`,"Try using some of the following tools instead of running a Terminal Command (if unable to use one of these tools as an alternative then run the same terminal command again):"];for(let n of Rdn){if(!n.commands.some(s=>s.test(a)))continue;let r=n.tags;Array.from(e).filter(s=>r.some(l=>s.tags?.includes(l))).forEach(s=>{t.add(s.id)})}if(t.forEach(n=>{o.push(`- ${n}`)}),t.size)return Kxo=!0,o.join(`  
`)}async function qq(a,i){let e=new O,t=new Mo,o=e.add(new Dt(()=>t.complete(),i));return e.add(a(()=>o.schedule())),o.schedule(),t.p.finally(()=>e.dispose())}function Ldn(a){return a.trim().length===0?{detected:!1,reason:"Content is empty or contains only whitespace"}:/PS\s+[A-Z]:\\.*>\s*$/.test(a)?{detected:!0,reason:`PowerShell prompt pattern detected: "${a}"`}:/^[A-Z]:\\.*>\s*$/.test(a)?{detected:!0,reason:`Command Prompt pattern detected: "${a}"`}:/\$\s*$/.test(a)?{detected:!0,reason:`Bash-style prompt pattern detected: "${a}"`}:/#\s*$/.test(a)?{detected:!0,reason:`Root prompt pattern detected: "${a}"`}:/^>>>\s*$/.test(a)?{detected:!0,reason:`Python REPL prompt pattern detected: "${a}"`}:/\u276f\s*$/.test(a)?{detected:!0,reason:`Starship prompt pattern detected: "${a}"`}:/[>%]\s*$/.test(a)?{detected:!0,reason:`Generic prompt pattern detected: "${a}"`}:{detected:!1,reason:`No common prompt pattern found in last line: "${a}"`}}async function qxo(a,i,e,t){await qq(a,e);let o=await i.xtermReadyPromise;if(!o)return{detected:!1,reason:`Xterm not available, using ${e}ms timeout`};let n=Date.now();for(;Date.now()-n<t;){try{let r="",s=o.raw.buffer.active,l=s.getLine(s.baseY+s.cursorY);l&&(r=l.translateToString(!0));let c=Ldn(r);if(c.detected)return c}catch{}await qq(a,Math.min(e,t-(Date.now()-n)))}try{let r="",s=o.raw.buffer.active,l=s.getLine(s.baseY+s.cursorY);return l&&(r=l.translateToString(!0)+`
`),{detected:!1,reason:`Extended timeout reached without prompt detection. Last line: "${r.trim()}"`}}catch(r){return{detected:!1,reason:`Extended timeout reached. Error reading terminal content: ${r}`}}}async function Est(a,i,e,t,o,n){let r=new Mo,s=a.onData,l=o?x=>o.info(`trackIdleOnPrompt: ${x}`):void 0,c;(V=>(V[V.Initial=0]="Initial",V[V.Prompt=1]="Prompt",V[V.Executing=2]="Executing",V[V.PromptAfterExecuting=3]="PromptAfterExecuting"))(c||={});let u={0:"Initial",1:"Prompt",2:"Executing",3:"PromptAfterExecuting"},p=0,h=0;function g(x,E){p!==x&&(l?.(`State ${u[p]} \u2192 ${u[x]} (${E})`),p=x)}let f=e.add(new Dt(()=>{l?.(`Idle scheduler fired, completing (dataEvents=${h})`),r.complete()},i)),v=e.add(new Dt(()=>{if(p===2||p===3){v.cancel();return}l?.(`Prompt fallback fired (dataEvents=${h})`),g(3,"promptFallback"),f.schedule()},t??1e3)),b=n?.disableFallbacks??!1,S=e.add(new Dt(()=>{if(p===2||p===3){l?.(`Initial fallback fired but state is ${u[p]}, skipping`);return}l?.("Initial fallback fired, no data events received"),g(3,"initialFallback"),f.schedule()},1e4));b||S.schedule();let y=e.add(new Dt(()=>{p===2&&(l?.(`Executing fallback fired after 30s data-idle (dataEvents=${h})`),g(3,"executingFallback"),f.schedule())},3e4)),w=e.add(new Dt(()=>{(p===0||p===1)&&(l?.(`Hard cap fired after 5min in state ${u[p]} (dataEvents=${h})`),g(3,"hardCap"),f.schedule())},6e4));return b||w.schedule(),e.add(s(x=>{h++,S.cancel();let E=x.matchAll(/(?:\x1b\]|\x9d)[16]33;(?<type>[ACD])(?:;.*)?(?:\x1b\\|\x07|\x9c)/g);for(let M of E)M.groups?.type==="A"?p===0?g(1,"sequence A"):p===2&&(g(3,"sequence A after executing"),y.cancel()):(M.groups?.type==="C"||M.groups?.type==="D")&&(g(2,`sequence ${M.groups?.type}`),b||y.schedule());p===3?(v.cancel(),y.cancel(),f.schedule()):(f.cancel(),p===0||p===1?b||v.schedule():(v.cancel(),b||y.schedule()))})),r.p}function u0e(a,i,e,t,o){let n=new ue,r=()=>{if(t.isDisposed)return;let s=a.raw.registerMarker();if(i.value=s??void 0,e(s),!s){n.clear();return}n.value=s.onDispose(()=>{o?.("Start marker was disposed, recreating"),r()})};return r(),t.add(ee(()=>{n.dispose(),i.clear(),e(void 0)})),t.add(i),ee(()=>n.dispose())}function p0e(a,i,e){let t=new Mo,o=()=>{t.isSettled||(e?.("Detected alternate buffer entry"),t.complete())};return a.raw.buffer.active===a.raw.buffer.alternate?o():i.add(a.raw.buffer.onBufferChange(()=>{a.raw.buffer.active===a.raw.buffer.alternate&&o()})),t.p}function sne(a,i,e){e?.(`stripCommandEchoAndPrompt input: output length=${a.length}, commandLine length=${i.length}`);let t=$xo(a,i,e);return t.trim().length>0&&jxo(t,i)?$xo(t,i,e):t}function $xo(a,i,e){let t=jxo(a,i,!0),o=t?t.linesAfter:a.split(`
`),n=0,r=t?.contentBefore??"",s=/\w+@[\w.-]+:/.test(r),l=!s&&/[\w.-]+:\S/.test(r),c=s||l,u=/^PS\s/i.test(r),p=!u&&/^[A-Z]:\\/.test(r),h=/\u276f/.test(r),g=/>>>/.test(r),f=c||u||p||h||g,v=o.length,b=0,S=2;for(;v>n;){let w=o[v-1].trimEnd();if(w.length===0){v--;continue}if(b>=S)break;let x=(!f||s)&&/^\s*\w+@[\w.-]+:.*[#$]\s*$/.test(w)||(!f||l)&&/^\s*[\w.-]+:\S.*\s\w+[#$]\s*$/.test(w)||(!f||u)&&/^PS\s+[A-Z]:\\.*>\s*$/.test(w)||(!f||p)&&/^[A-Z]:\\.*>\s*$/.test(w)||(!f||h)&&/\u276f\s*$/.test(w)||(!f||g)&&/^>>>\s*$/.test(w),E=(!f||c)&&/^\s*[\w/.-]+[#$]\s*$/.test(w)||(!f||c)&&/^\[\s*[\w.-]+(@[\w.-]+)?:[~\/]/.test(w)||(!f||c)&&b>0&&/^\s*[\w][-\w.]*(@[\w.-]+)?:\S/.test(w)||(!f||c)&&/\]\s*[#$]\s*$/.test(w);if(x){v--,b++;break}else if(E)v--,b++;else break}let y=o.slice(n,v).join(`
`);return e?.(`stripCommandEchoAndPrompt result: length=${y.length} (startIndex=${n}, endIndex=${v}, totalLines=${o.length})`),y}function jxo(a,i,e){let t=i.trim();if(t.length===0)return;let{strippedOutput:o,indexMapping:n}=Mdn(a),r=o.indexOf(t),s,l;if(r!==-1)l=o.substring(0,r).trim(),s=r+t.length-1;else if(e){let g=0;for(let f=t.length-1;f>=1;f--){let v=t.substring(t.length-f);if(o.startsWith(v)){let b=t[t.length-f-1];b!==void 0&&b!==" "&&b!=="	"&&(g=f);break}}if(g===0)return;l="",s=g-1}else return;let c=n[s],u=a.split(`
`),p=0,h=0;for(let g=0;g<u.length;g++){let f=h+u[g].length;if(h<=c&&c<=f){p=g+1;break}h=f+1}return{contentBefore:l,linesAfter:u.slice(p)}}function Mdn(a){let i=[],e=[];for(let t=0;t<a.length;t++)a[t]!==`
`&&(e.push(a[t]),i.push(t));return{strippedOutput:e.join(""),indexMapping:i}}function $q(a){return!!a&&"sourceText"in a}function xAi(a){return!!a&&"type"in a&&a.type==="npmScript"}function dI(a,i){return i===1?/^(?:powershell|pwsh)(?:-preview)?$/i.test(Gs.basename(a).replace(/\.exe$/i,"")):/^(?:powershell|pwsh)(?:-preview)?$/.test(Vo.basename(a))}function Qxo(a){return a.endsWith("System32\\WindowsPowerShell\\v1.0\\powershell.exe")}function m6(a,i){return i===1?/^zsh(?:\.exe)?$/i.test(Gs.basename(a)):/^zsh$/.test(Vo.basename(a))}function m0e(a,i){return i===1?/^bash(?:\.exe)?$/i.test(Gs.basename(a)):/^bash$/.test(Vo.basename(a))}function h0e(a,i){return i===1?/^fish(?:\.exe)?$/i.test(Gs.basename(a)):/^fish$/.test(Vo.basename(a))}var xqt=`

[... PREVIOUS OUTPUT TRUNCATED ...]

`;function Yxo(a,i){if(a.length<=i)return a;let e=xqt.length;if(e>=i)return xqt.slice(xqt.length-i);let t=i-e,o=a.slice(-t);return xqt+o}function tve(a){return a.replace(/\\(["'\/])/g,"$1")}function ane(a){let i=tve(a).replace(/\r\n|\r|\n/g," ");return i.length>80?i.substring(0,77)+"...":i}function Xxo(a){return a.replace(/\r\n|\r|\n/g," ").trim()}function lne(a){let i=a.replace(/\r\n|\r/g,`
`);return/(?<!\\)\n/.test(i)}function Jxo(a,i,e){let t=[];if(e.subCommandResults.every(n=>n.result!=="denied")&&e.commandLineResult.result!=="denied"){let n=i.filter((h,g)=>e.subCommandResults[g].result!=="approved"),r=new Set(["bash","sh","zsh","fish","ksh","csh","tcsh","dash","pwsh","powershell","powershell.exe","cmd","cmd.exe","python","python3","node","ruby","perl","php","lua","eval","exec","source","sudo","su","doas","curl","wget","invoke-restmethod","invoke-webrequest","irm","iwr"]),s=new Set(["git","npm","npx","yarn","docker","kubectl","cargo","dotnet","mvn","gradle"]),l=new Set(["npm run","yarn run"]),c=(h,g)=>{for(let f=g;f<h.length;f++)if(!h[f].startsWith("-"))return f},u=Array.from(new Set(ui(n.map(h=>{let g=h.trim().split(/\s+/),f=g[0].toLowerCase();if(!r.has(f))if(s.has(f)){let v=c(g,1);if(v!==void 0){let b=`${g[0]} ${g[v]}`.toLowerCase();if(l.has(b)){let S=c(g,v+1);return S!==void 0?g.slice(0,S+1).join(" "):void 0}else return g.slice(0,v+1).join(" ")}return}else return g[0]}))));if(u.length>0){let h;u.length===1?h=`\`${u[0]} \u2026\``:h=`Commands ${u.map(g=>`\`${g} \u2026\``).join(", ")}`,t.push({label:`Allow ${h} in this Session`,data:{type:"newRule",rule:u.map(g=>({key:g,value:!0,scope:"session"}))}}),t.push({label:`Allow ${h} in this Workspace`,data:{type:"newRule",rule:u.map(g=>({key:g,value:!0,scope:"workspace"}))}}),t.push({label:`Always Allow ${h}`,data:{type:"newRule",rule:u.map(g=>({key:g,value:!0,scope:"user"}))}})}t.length>0&&t.push(new oi),(n.length>0?n[0].split(" ")[0]:"")!==a&&!s.has(a)&&!l.has(a)&&(t.push({label:d(16455,null),data:{type:"newRule",rule:{key:`/^${Ss(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"session"}}}),t.push({label:d(16456,null),data:{type:"newRule",rule:{key:`/^${Ss(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"workspace"}}}),t.push({label:d(16454,null),data:{type:"newRule",rule:{key:`/^${Ss(a)}$/`,value:{approve:!0,matchCommandLine:!0},scope:"user"}}}))}return t.length>0&&t.push(new oi),t.push({label:d(16451,null),tooltip:d(16452,null),data:{type:"sessionApproval"}}),t.push(new oi),t.push({label:d(16453,null),data:{type:"configure"}}),t}function kAi(a){return a.filter((i,e,t)=>{if(!$q(i.rule))return!1;let o=i.rule.sourceText;return t.findIndex(n=>$q(n.rule)&&n.rule.sourceText===o)===e})}function kqt(a,i,e){let t=dI(i,e),o=a.match(t?/^(?:cd(?: \/d)?|Set-Location(?: -Path)?) (?<dir>[^\s]+) ?(?:&&|;)\s+(?<suffix>.+)$/i:/^cd (?<dir>[^\s]+) &&\s+(?<suffix>.+)$/),n=o?.groups?.dir,r=o?.groups?.suffix;if(n&&r){let s=n;return s.startsWith('"')&&s.endsWith('"')&&(s=s.slice(1,-1)),{directory:s,command:r}}}function Zxo(a){return typeof a=="object"&&a!==null&&"message"in a}function Pdn(a){return Zxo(a)?`launch error: ${a.message}${a.code!==void 0?`, code=${a.code}`:""}`:`code=${a}`}function Adn(a){if(on(a))return a;if(Zxo(a))return a.code}var g0e=class extends k{constructor(e,t,o,n,r){super();this._instance=e;this._hasReceivedUserInput=t;this._commandDetection=o;this._configurationService=n;this._logService=r;this.type="basic";this._startMarker=this._register(new ue);this._onDidCreateStartMarker=this._register(new T);this.onDidCreateStartMarker=this._onDidCreateStartMarker.event;this._executionStores=this._register(new O)}async execute(e,t,o,n){let r=new O;this._executionStores.add(r);try{if(this._instance.isDisposed)throw this._log("Terminal already disposed at strategy entry"),new Error("The terminal was closed");if(this._instance.exitCode!==void 0)return this._log(`Terminal pty already exited at strategy entry (code=${this._instance.exitCode})`),{output:void 0,exitCode:this._instance.exitCode,additionalInformation:`Command exited with code ${this._instance.exitCode}`};let s=this._configurationService.getValue("chat.tools.terminal.idlePollInterval")??1e3,l=this._commandDetection.executingCommandObject?.marker,c=l?U.filter(this._commandDetection.onCommandFinished,M=>M.marker!==l,r):this._commandDetection.onCommandFinished,u=Est(this._instance,s,r,s,this._logService),p=Promise.race([U.toPromise(c,r).then(M=>(this._log("onDone 1 of 2 via end event, waiting for short idle prompt"),u.then(()=>(this._log("onDone 2 of 2 via short idle prompt"),{type:"success",command:M})))),U.toPromise(t.onCancellationRequested,r).then(()=>{this._log("onDone via cancellation")}),U.toPromise(this._instance.onDisposed,r).then(()=>(this._log("onDone via terminal disposal"),{type:"disposal"})),U.toPromise(this._instance.onExit,r).then(M=>(this._log(`onDone via process exit (${Pdn(M)})`),{type:"processExit",exitCodeOrError:M})),Est(this._instance,s*3,r,s,this._logService).then(()=>{this._log("onDone long idle prompt")})]);this._log("Waiting for xterm");let h=await this._instance.xtermReadyPromise;if(!h)throw new Error("Xterm is not available");let g=p0e(h,r,this._log.bind(this));this._log("Waiting for idle"),await qq(this._instance.onData,s);let f=u0e(h,this._startMarker,M=>this._onDidCreateStartMarker.fire(M),r,this._log.bind(this));this._hasReceivedUserInput()&&(this._commandDetection.executingCommandObject!==void 0?(this._log("Previous command still executing with pending input, sending SIGINT before retrying"),await this._instance.sendText("",!1),await qq(this._instance.onData,100)):(this._log("Prompt is idle; clearing pending input with Ctrl+U instead of SIGINT"),await this._instance.sendText("",!1),await qq(this._instance.onData,100))),o&&this._log(`In basic execute strategy: skipping pre-bound command id ${o} because basic shell integration executes via sendText`),this._log(`Executing command line \`${e}\``),f.dispose();let v=et||lne(e);this._instance.sendText(e,!0,v),this._log("Waiting for done event");let b=await Promise.race([p,g.then(()=>({type:"alternateBuffer"}))]);if(b&&b.type==="disposal")throw new Error("The terminal was closed");if(b&&b.type==="alternateBuffer")return this._log("Detected alternate buffer entry, skipping output capture"),{output:void 0,exitCode:void 0,error:"alternateBuffer",didEnterAltBuffer:!0};let S=b&&b.type==="success"?b.command:void 0;if(S?this._log(`Finished command id=${S.id??"none"} for requested=${o??"none"}`):o&&this._log(`No finished command surfaced for requested=${o}`),b&&b.type==="processExit"||(this._log("Waiting for idle"),await qq(this._instance.onData,s)),t.isCancellationRequested)throw new qi;let y=r.add(h.raw.registerMarker()),w,x=[];if(S){let M=S?.getOutput();M!==void 0&&(this._log("Fetched output via finished command"),w=sne(M,e,this._log.bind(this)))}if(w===void 0)try{w=h.getContentsAsText(this._startMarker.value,y),this._log("Fetched output via markers"),w!==void 0&&(w=sne(w,e,this._log.bind(this)))}catch{this._log("Failed to fetch output via markers"),x.push("Failed to retrieve command output")}w!==void 0&&w.trim().length===0&&x.push("Command produced no output");let E=S?.exitCode;return E===void 0&&b&&b.type==="processExit"&&(E=Adn(b.exitCodeOrError)),on(E)&&E>0&&x.push(`Command exited with code ${E}`),{output:w,additionalInformation:x.length>0?x.join(`
`):void 0,exitCode:E}}finally{this._executionStores.delete(r)}}_log(e){this._logService.debug(`RunInTerminalTool#Basic: ${e}`)}};g0e=I([m(3,B),m(4,wa)],g0e);var f0e=class extends k{constructor(e,t,o,n){super();this._instance=e;this._hasReceivedUserInput=t;this._configurationService=o;this._logService=n;this.type="none";this._startMarker=this._register(new ue);this._onDidCreateStartMarker=this._register(new T);this.onDidCreateStartMarker=this._onDidCreateStartMarker.event}async execute(e,t,o,n){let r=new O;try{if(t.isCancellationRequested)throw new qi;this._log("Waiting for xterm");let s=await this._instance.xtermReadyPromise;if(!s)throw new Error("Xterm is not available");let l=p0e(s,r,this._log.bind(this)),c=this._configurationService.getValue("chat.tools.terminal.idlePollInterval")??1e3;if(this._log("Waiting for idle"),await qq(this._instance.onData,c),t.isCancellationRequested)throw new qi;let u=u0e(s,this._startMarker,y=>this._onDidCreateStartMarker.fire(y),r,this._log.bind(this));this._hasReceivedUserInput()&&(this._log("Sending Ctrl+U to clear any pending input before sending command"),await this._instance.sendText("",!1),await qq(this._instance.onData,100)),this._log(`Executing command line \`${e}\``),u.dispose();let p=this._startMarker.value?.line,h=et||lne(e);if(this._instance.sendText(e,!0,h),p!==void 0){this._log("Waiting for cursor to move past start line");let y=new Promise(E=>{let M=()=>{let V=s.raw.buffer.active;V.baseY+V.cursorY>p&&E()},N=this._instance.onData(()=>M());r.add(N),M()}),w=new Promise(E=>{let M=setTimeout(()=>E("timeout"),1e3);r.add({dispose:()=>clearTimeout(M)})});await Promise.race([y,w])==="timeout"&&this._log("Cursor did not move past start line before timeout, proceeding with idle detection")}this._log("Waiting for idle with prompt heuristics");let g=await Promise.race([qxo(this._instance.onData,this._instance,c,c*10),l.then(()=>"alternateBuffer")]);if(g==="alternateBuffer")return this._log("Detected alternate buffer entry, skipping output capture"),{output:void 0,additionalInformation:void 0,exitCode:void 0,error:"alternateBuffer",didEnterAltBuffer:!0};let f=g;if(this._log(`Prompt detection result: ${f.detected?"detected":"not detected"} - ${f.reason}`),t.isCancellationRequested)throw new qi;let v=r.add(s.raw.registerMarker()),b,S=[];try{b=s.getContentsAsText(this._startMarker.value,v),this._log("Fetched output via markers"),b!==void 0&&(b=sne(b,e,this._log.bind(this)))}catch{this._log("Failed to fetch output via markers"),S.push("Failed to retrieve command output")}return b!==void 0&&b.trim().length===0&&S.push("Command produced no output"),{output:b,additionalInformation:S.length>0?S.join(`
`):void 0,exitCode:void 0}}finally{r.dispose()}}_log(e){this._logService.debug(`RunInTerminalTool#None: ${e}`)}};f0e=I([m(2,B),m(3,wa)],f0e);function eko(a){return typeof a=="object"&&a!==null&&"message"in a}function Ndn(a){return eko(a)?`launch error: ${a.message}${a.code!==void 0?`, code=${a.code}`:""}`:`code=${a}`}function Odn(a){if(on(a))return a;if(eko(a))return a.code}var v0e=class extends k{constructor(e,t,o,n,r){super();this._instance=e;this._commandDetection=t;this._isSyncMode=o;this._configurationService=n;this._logService=r;this.type="rich";this._startMarker=this._register(new ue);this._onDidCreateStartMarker=this._register(new T);this.onDidCreateStartMarker=this._onDidCreateStartMarker.event;this._executionStores=this._register(new O)}async execute(e,t,o,n){let r=new O;this._executionStores.add(r);try{if(this._instance.isDisposed)throw this._log("Terminal already disposed at strategy entry"),new Error("The terminal was closed");if(this._instance.exitCode!==void 0)return this._log(`Terminal pty already exited at strategy entry (code=${this._instance.exitCode})`),{output:void 0,exitCode:this._instance.exitCode,additionalInformation:`Command exited with code ${this._instance.exitCode}`};let s=this._configurationService.getValue("chat.tools.terminal.idlePollInterval")??1e3,l=this._commandDetection.executingCommandObject?.marker,c=l?U.filter(this._commandDetection.onCommandFinished,E=>E.marker!==l,r):this._commandDetection.onCommandFinished,u=Promise.race([U.toPromise(c,r).then(E=>(this._log("onDone via end event"),{type:"success",command:E})),U.toPromise(t.onCancellationRequested,r).then(()=>{this._log("onDone via cancellation")}),U.toPromise(this._instance.onDisposed,r).then(()=>(this._log("onDone via terminal disposal"),{type:"disposal"})),U.toPromise(this._instance.onExit,r).then(E=>(this._log(`onDone via process exit (${Ndn(E)})`),{type:"processExit",exitCodeOrError:E})),...this._isSyncMode?[Est(this._instance,s,r,s,this._logService,{disableFallbacks:!0}).then(()=>{this._log("onDone via idle prompt")})]:[]]);this._log("Waiting for xterm");let p=await this._instance.xtermReadyPromise;if(!p)throw new Error("Xterm is not available");let h=p0e(p,r,this._log.bind(this)),g=u0e(p,this._startMarker,E=>this._onDidCreateStartMarker.fire(E),r,this._log.bind(this));this._log(`Executing command line \`${e}\``),g.dispose();let f=et||lne(e);this._instance.runCommand(e,!0,o,f,n),this._log("Waiting for done event");let v=await Promise.race([u,h.then(()=>({type:"alternateBuffer"}))]);if(v&&v.type==="disposal")throw new Error("The terminal was closed");if(v&&v.type==="alternateBuffer")return this._log("Detected alternate buffer entry, skipping output capture"),{output:void 0,exitCode:void 0,error:"alternateBuffer",didEnterAltBuffer:!0};let b=v&&v.type==="success"?v.command:void 0;if(t.isCancellationRequested)throw new qi;let S=r.add(p.raw.registerMarker()),y,w=[];if(b){let E=b?.getOutput();E!==void 0&&(this._log("Fetched output via finished command"),y=sne(E,e,this._log.bind(this)))}if(y===void 0)try{y=p.getContentsAsText(this._startMarker.value,S),this._log("Fetched output via markers"),y!==void 0&&(y=sne(y,e,this._log.bind(this)))}catch{this._log("Failed to fetch output via markers"),w.push("Failed to retrieve command output")}y!==void 0&&y.trim().length===0&&w.push("Command produced no output");let x=b?.exitCode;return x===void 0&&v&&v.type==="processExit"&&(x=Odn(v.exitCodeOrError)),on(x)&&x>0&&w.push(`Command exited with code ${x}`),{output:y,additionalInformation:w.length>0?w.join(`
`):void 0,exitCode:x}}finally{this._executionStores.delete(r)}}_log(e){let t=`RunInTerminalTool#Rich: ${e}`;Pf?this._logService.info(t):this._logService.debug(t)}};v0e=I([m(3,B),m(4,wa)],v0e);var tko=6e4;function h6(a,i,e){if(!a.xterm||!a.xterm.raw)return"";let t=a.xterm.raw.buffer.active,o=Math.max(i?.line??0,0);for(;o>0&&t.getLine(o)?.isWrapped;)o--;let n=t.length,r=[],s="";for(let c=o;c<n;c++){let u=t.getLine(c);if(!u)continue;let p=!!t.getLine(c+1)?.isWrapped;s+=u.translateToString(!p),p||(r.push(s),s="")}if(s&&r.push(s),e?.lastNLines!==void 0)return r.filter(u=>u.trim().length>0).slice(-e.lastNLines).join(`
`);let l=r.join(`
`);return l.length>tko&&(l=Yxo(l,tko)),l}var Eqt=class{present(i){let e=i.commandLine.forDisplay,t=Fdn(e,i.shell,i.os);if(t)return{commandLine:t,language:"javascript",languageDisplayName:"Node.js"}}};function Fdn(a,i,e){let t=a.match(/^node(?:js)?\s+(?:-e|--eval)\s+"(?<code>.+)"$/s);if(t?.groups?.code){let n=t.groups.code.trim();return dI(i,e)?n=n.replace(/`"/g,'"'):n=n.replace(/\\"/g,'"'),n}let o=a.match(/^node(?:js)?\s+(?:-e|--eval)\s+'(?<code>.+)'$/s);if(o?.groups?.code)return o.groups.code.trim()}var Tqt=class{present(i){let e=i.commandLine.forDisplay,t=Wdn(e,i.shell,i.os);if(t)return{commandLine:t,language:"python",languageDisplayName:"Python"}}};function Wdn(a,i,e){let t=a.match(/^python(?:3)?\s+-c\s+"(?<python>.+)"$/s);if(t?.groups?.python){let n=t.groups.python.trim();return dI(i,e)?n=n.replace(/`"/g,'"'):n=n.replace(/\\"/g,'"'),n}let o=a.match(/^python(?:3)?\s+-c\s+'(?<python>.+)'$/s);if(o?.groups?.python)return o.groups.python.trim()}var _qt=class{present(i){let e=i.commandLine.forDisplay,t=Vdn(e,i.shell,i.os);if(t)return{commandLine:t,language:"ruby",languageDisplayName:"Ruby"}}};function Vdn(a,i,e){let t=a.match(/^ruby\s+-e\s+"(?<code>.+)"$/s);if(t?.groups?.code){let n=t.groups.code.trim();return n?(dI(i,e)?n=n.replace(/`"/g,'"'):n=n.replace(/\\"/g,'"'),n):void 0}let o=a.match(/^ruby\s+-e\s+'(?<code>.+)'$/s);if(o?.groups?.code){let n=o.groups.code.trim();return n||void 0}}var Dqt=le("sandboxHelperService");var gV=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.title=i;this.message=e;this.subtitle=t;this.acceptButtonLabel=o;this.rejectButtonLabel=n;this._accept=r;this.source=l;this.moreActions=c;this.onHide=u;this.riskAssessment=p;this.kind="elicitation2";this.state=De("state","pending");this._isHiddenValue=De("isHidden",!1);this.isHidden=this._isHiddenValue;s&&(this.reject=async()=>{let h=await s();this.state.set(h,void 0)})}accept(i){return this._accept(i).then(e=>{this.state.set(e,void 0)})}hide(){this._isHiddenValue.get()||(this._isHiddenValue.set(!0,void 0,void 0),this.onHide?.(),this.state.get()==="pending"&&this.state.set("rejected",void 0))}toJSON(){let i=this.state.get();return{kind:"elicitationSerialized",title:this.title,message:this.message,state:i==="pending"?"rejected":i,acceptedResult:this.acceptedResult,subtitle:this.subtitle,source:this.source,isHidden:this._isHiddenValue.get()}}};var iko="sandboxHelper";var Rqt=class{constructor(i){this.channel=i}checkSandboxDependencies(){return this.channel.call("checkSandboxDependencies")}};var LP=le("terminalSandboxService");var Lqt=new Set(["-C","-c","--config-env","--exec-path","--git-dir","--html-path","--info-path","--man-path","--namespace","--super-prefix","--work-tree"]);function Mqt(a,i,e){if(!i.keywords.includes(a.keyword.toLowerCase())||i.condition&&(!e||!i.condition(e)))return!1;if(i.subcommands){let t=Bdn(a.args,i.optionsWithValue);if(t===void 0||!i.subcommands.includes(t))return!1}return i.when?.(a)??!0}function Bdn(a,i){for(let e=0;e<a.length;e++){let t=a[e];if(t==="--")return;if(t.startsWith("-")){let o=t.includes("=")?t.substring(0,t.indexOf("=")):t;!t.includes("=")&&i?.has(o)&&e++;continue}return t.toLowerCase()}}var Hdn=new Map([["git","git"],["gh","git"],["node","node"],["npm","node"],["npx","node"],["pnpm","node"],["yarn","node"],["corepack","node"],["bun","node"],["deno","node"],["nvm","node"],["volta","node"],["fnm","node"],["asdf","node"],["mise","node"],["cargo","rust"],["rustc","rust"],["rustup","rust"],["go","go"],["gofmt","go"],["python","python"],["python3","python"],["pip","python"],["pip3","python"],["poetry","python"],["uv","python"],["pipx","python"],["pyenv","python"],["java","java"],["javac","java"],["jar","java"],["mvn","java"],["mvnw","java"],["gradle","java"],["gradlew","java"],["sdk","java"],["dotnet","dotnet"],["nuget","nuget"],["msbuild","msbuild"],["ruby","ruby"],["gem","ruby"],["bundle","ruby"],["bundler","ruby"],["rake","ruby"],["rbenv","ruby"],["rvm","ruby"],["ccache","nativeBuild"],["sccache","nativeBuild"],["cmake","nativeBuild"],["conan","conan"]]);function nko(a,i){switch(a){case"git":switch(i){case 2:case 3:default:return["~/.gitconfig","~/.config/git/config","~/.gitignore","~/.gitignore_global","~/.config/git/ignore","~/.config/git/attributes"]}case"node":switch(i){case 2:return["~/.npm","~/Library/Caches/node","~/Library/Caches/electron","~/Library/Caches/ms-playwright","~/Library/Caches/Yarn","~/Library/Caches/deno","~/Library/pnpm","~/.electron-gyp","~/.node-gyp","~/.yarn/berry","~/.local/share/pnpm","~/.pnpm-store","~/.bun/install/cache","~/.bun/bin","~/.deno","~/.nvm/versions","~/.nvm/alias","~/.volta/bin","~/.volta/tools","~/.fnm","~/.asdf/installs/nodejs","~/.asdf/shims","~/.local/share/mise/installs/node","~/.local/share/mise/shims"];case 3:default:return["~/.npm","~/.cache/node","~/.cache/node/corepack","~/.cache/electron","~/.cache/ms-playwright","~/.cache/yarn","~/.electron-gyp","~/.node-gyp","~/.yarn/berry","~/.local/share/pnpm","~/.pnpm-store","~/.bun/install/cache","~/.bun/bin","~/.deno","~/.cache/deno","~/.nvm/versions","~/.nvm/alias","~/.volta/bin","~/.volta/tools","~/.fnm","~/.asdf/installs/nodejs","~/.asdf/shims","~/.local/share/mise/installs/node","~/.local/share/mise/shims"]}case"rust":switch(i){case 2:case 3:default:return["~/.cargo/bin","~/.cargo/registry","~/.cargo/git","~/.rustup/toolchains"]}case"go":switch(i){case 2:return["~/go/pkg/mod","~/go/bin","~/Library/Caches/go-build"];case 3:default:return["~/go/pkg/mod","~/go/bin","~/.cache/go-build"]}case"python":switch(i){case 2:return["~/Library/Caches/pip","~/Library/Caches/pypoetry","~/Library/Caches/uv","~/.local/bin","~/.local/share/virtualenv","~/.local/share/pipx","~/.pyenv/versions","~/.pyenv/shims"];case 3:default:return["~/.cache/pip","~/.cache/pypoetry","~/.cache/uv","~/.local/bin","~/.local/share/virtualenv","~/.local/share/pipx","~/.pyenv/versions","~/.pyenv/shims"]}case"java":switch(i){case 2:case 3:default:return["~/.m2/repository","~/.gradle/caches","~/.gradle/wrapper/dists","~/.sdkman/candidates"]}case"dotnet":switch(i){case 2:case 3:default:return["~/.dotnet"]}case"nuget":switch(i){case 2:return["~/.nuget/packages","~/Library/Caches/NuGet/v3-cache"];case 3:default:return["~/.nuget/packages","~/.local/share/NuGet/v3-cache"]}case"msbuild":switch(i){case 2:case 3:default:return[]}case"ruby":switch(i){case 2:return["~/.gem","~/.rbenv/versions","~/.rbenv/shims","~/.rvm/rubies"];case 3:default:return["~/.gem","~/.rbenv/versions","~/.rbenv/shims","~/.rvm/rubies"]}case"nativeBuild":switch(i){case 2:return["~/Library/Caches/ccache","~/Library/Caches/sccache"];case 3:default:return["~/.cache/ccache","~/.cache/sccache"]}case"conan":switch(i){case 2:case 3:default:return["~/.conan2/p","~/.conan2/b"]}case"gnupg":switch(i){case 2:case 3:default:return["~/.gnupg"]}}}function oko(a,i){let e=new Set;for(let o of i)for(let n of Udn)Mqt(o,n,{os:a})&&e.add(n.value);let t=[...e].flatMap(o=>nko(o,a));return[...new Set(t)]}var Udn=[{keywords:["gpg","gpg2"],value:"gnupg"},{keywords:["git"],value:"gnupg",subcommands:["commit"],optionsWithValue:Lqt}];function Pqt(a,i,e=[]){if(i.length===0)return oko(a,e);let t=new Set;for(let n of i){let r=Hdn.get(n.toLowerCase());r&&t.add(r)}let o=[...t].flatMap(n=>nko(n,a));return[...new Set([...o,...oko(a,e)])]}var zdn=[{keywords:["node","npm","npx","pnpm","yarn","corepack","bun","deno","nvm","volta","fnm","asdf","mise"],value:"node"},{keywords:["git"],value:"gnupg",subcommands:["commit"],optionsWithValue:Lqt,condition:({os:a})=>a!==1,when:Gdn}];function Kdn(a,i){switch(a){case"gnupg":switch(i){case 1:return{};case 2:case 3:default:return{network:{allowAllUnixSockets:!0},filesystem:{allowRead:["~/.gnupg"],allowWrite:["~/.gnupg"]}}}case"node":switch(i){case 2:case 3:default:return{filesystem:{allowWrite:["~/.volta/"]}}}}}function Aqt(a,i){let e=new Set;for(let o of i)for(let n of zdn)Mqt(o,n,{os:a})&&e.add(n.value);let t={};for(let o of e)sko(t,Kdn(o,a));return t}function Gdn(a){return a.args.some(i=>i==="-S"||i.startsWith("-S")||i==="--gpg-sign"||i.startsWith("--gpg-sign="))}function sko(a,i){for(let[e,t]of Object.entries(i)){if(!Object.prototype.hasOwnProperty.call(a,e)){a[e]=t;continue}let o=a[e];if(Array.isArray(o)&&Array.isArray(t)){a[e]=[...new Set([...o,...t])];continue}rko(o)&&rko(t)&&sko(o,t)}}function rko(a){return typeof a=="object"&&a!==null&&!Array.isArray(a)}var GR=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._configurationService=e;this._fileService=t;this._environmentService=o;this._logService=n;this._remoteAgentService=r;this._workspaceContextService=s;this._productService=l;this._lifecycleService=c;this._sandboxHelperService=u;this._chatService=p;this._srtPathResolved=!1;this._needsForceUpdateConfigFile=!0;this._remoteEnvDetails=null;this._commandAllowListKeywords=[];this._commandAllowListCommandDetails=[];this._os=Ao;this._defaultWritePaths=[];this._pathJoin=(...e)=>(this._os===1?Gs:Vo).join(...e);this._appRoot=yd(In.asFileUri("").path);let h=this._environmentService;this._execPath=h.execPath,this._sandboxSettingsId=ht(),this._remoteEnvDetailsPromise=this._remoteAgentService.getEnvironment(),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,g=>{(g?.affectsConfiguration("chat.agent.sandbox.enabled")||g?.affectsConfiguration("chat.agent.sandbox")||g?.affectsConfiguration("chat.agent.allowedNetworkDomains")||g?.affectsConfiguration("chat.agent.sandbox.allowedNetworkDomains")||g?.affectsConfiguration("chat.agent.sandboxNetwork.allowedDomains")||g?.affectsConfiguration("chat.agent.deniedNetworkDomains")||g?.affectsConfiguration("chat.agent.sandbox.deniedNetworkDomains")||g?.affectsConfiguration("chat.agent.sandboxNetwork.deniedDomains")||g?.affectsConfiguration("chat.agent.sandbox.fileSystem.linux")||g?.affectsConfiguration("chat.agent.sandboxFileSystem.linux")||g?.affectsConfiguration("chat.agent.sandbox.fileSystem.mac")||g?.affectsConfiguration("chat.agent.sandboxFileSystem.mac")||g?.affectsConfiguration("chat.agent.sandbox.advanced.runtime"))&&this.setNeedsForceUpdateConfigFile()})),this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(()=>{this.setNeedsForceUpdateConfigFile()})),this._register(this._lifecycleService.onWillShutdown(g=>{this._tempDir&&g.join(this._cleanupSandboxTempDir(),{id:"join.deleteFilesInSandboxTempDir",label:d(16662,null),order:1})}))}static{this._sandboxTempDirName="tmp"}static{this._urlRegex=/(?:https?|wss?):\/\/[^\s'"`|&;<>]+/gi}static{this._sshRemoteRegex=/(?:^|[\s'"`])(?:[^\s@:'"`]+@)?([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(?::[^\s'"`|&;<>]+)(?=$|[\s'"`|&;<>])/gi}static{this._hostRegex=/(?:^|[\s'"`(=])([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(?::\d+)?(?=(?:\/[^\s'"`|&;<>]*)?(?:$|[\s'"`)\]|,;|&<>]))/gi}async isEnabled(){return await this._isSandboxConfiguredEnabled()}async isSandboxAllowNetworkEnabled(){return await this._isSandboxConfiguredEnabled()?this._isSandboxAllowNetworkConfigured():!1}async getOS(){return this._remoteEnvDetails=await this._remoteEnvDetailsPromise,this._os=this._remoteEnvDetails?this._remoteEnvDetails.os:Ao,this._os}async wrapCommand(e,t,o,n,r){let s=this._normalizeCommandDetails(r??[]),l=this._normalizeCommandKeywords(s.map(w=>w.keyword)),c=Pqt(this._os,this._commandAllowListKeywords,this._commandAllowListCommandDetails),u=Pqt(this._os,l,s),p=Aqt(this._os,this._commandAllowListCommandDetails),h=Aqt(this._os,s);if((this._commandAllowListKeywords.length===0||this._needsForceUpdateConfigFile||!this._areStringArraysEqual(this._commandAllowListKeywords,l)||!this._areStringArraysEqual(c,u)||!this._areObjectsEqual(p,h)||this._commandCwd?.toString()!==n?.toString())&&(this._commandAllowListKeywords=l,this._commandAllowListCommandDetails=s,this._commandCwd=n,await this.getSandboxConfigPath(!0)),!this._sandboxConfigPath||!this._tempDir)throw new Error("Sandbox config path or temp dir not initialized");let f=this._areUnsandboxedCommandsAllowed(),v=t||!f?{blockedDomains:[],deniedDomains:[]}:this._getBlockedDomains(e);if(!t&&f&&v.blockedDomains.length>0)return{command:this._wrapUnsandboxedCommand(e,o),isSandboxWrapped:!1,blockedDomains:v.blockedDomains,deniedDomains:v.deniedDomains,requiresUnsandboxConfirmation:!0};if(t&&f)return{command:this._wrapUnsandboxedCommand(e,o),isSandboxWrapped:!1};if(!this._execPath)throw new Error("Executable path not set to run sandbox commands");if(!this._srtPath)throw new Error("Sandbox runtime path not resolved");if(!this._rgPath)throw new Error("Ripgrep path not resolved");let b=this._getSandboxCommandWithPreservedCwd(e,n),S=`PATH="$PATH:${yd(this._rgPath)}" TMPDIR="${this._tempDir.path}" CLAUDE_TMPDIR="${this._tempDir.path}" "${this._execPath}" "${this._srtPath}" --settings "${this._sandboxConfigPath}" -c ${this._quoteShellArgument(b)}`,y=this._os===3&&n?.path&&n.path!==this._tempDir.path?`cd ${this._quoteShellArgument(this._tempDir.path)}; ${S}`:S;return this._remoteEnvDetails?{command:y,isSandboxWrapped:!0}:{command:`ELECTRON_RUN_AS_NODE=1 ${y}`,isSandboxWrapped:!0}}getTempDir(){return this._tempDir}setNeedsForceUpdateConfigFile(){this._needsForceUpdateConfigFile=!0}async checkForSandboxingPrereqs(e=!1){if(!await this._isSandboxConfiguredEnabled())return{enabled:!1,sandboxConfigPath:void 0,failedCheck:void 0};let t=await this.getSandboxConfigPath(e);return t?await this._checkSandboxDependencies(e)?{enabled:!0,sandboxConfigPath:t,failedCheck:void 0}:{enabled:!0,sandboxConfigPath:t,failedCheck:"dependencies",missingDependencies:await this.getMissingSandboxDependencies()}:{enabled:!0,sandboxConfigPath:t,failedCheck:"config"}}async getSandboxConfigPath(e=!1){if(await this._isSandboxConfiguredEnabled())return await this._resolveSrtPath(),(!this._sandboxConfigPath||e||this._needsForceUpdateConfigFile)&&(this._sandboxConfigPath=await this._createSandboxConfig(),this._needsForceUpdateConfigFile=!1),this._sandboxConfigPath}async _checkSandboxDependencies(e=!1){if(await this.getOS()===1)return!1;let o=await this._resolveSandboxDependencyStatus(e);return this._sandboxDependencyStatus=o,o&&!o.bubblewrapInstalled&&this._logService.warn("TerminalSandboxService: bubblewrap (bwrap) is not installed"),o&&!o.socatInstalled&&this._logService.warn("TerminalSandboxService: socat is not installed"),o?o.bubblewrapInstalled&&o.socatInstalled:!0}async getMissingSandboxDependencies(){if(await this.getOS()===1)return[];(!this._sandboxDependencyStatus||!this._sandboxDependencyStatus.bubblewrapInstalled||!this._sandboxDependencyStatus.socatInstalled)&&(this._sandboxDependencyStatus=await this._resolveSandboxDependencyStatus(!0));let t=[];return this._sandboxDependencyStatus&&!this._sandboxDependencyStatus.bubblewrapInstalled&&t.push("bubblewrap"),this._sandboxDependencyStatus&&!this._sandboxDependencyStatus.socatInstalled&&t.push("socat"),t}async installMissingSandboxDependencies(e,t,o,n){let s=`sudo apt install -y ${e.join(" ")}`,l=await n.createTerminal(),c=!1,u=new Promise(p=>{let h=new O,g=!1,f=y=>{g||(g=!0,h.dispose(),p(y))},v=()=>{let y=l.capabilities.get(2);y&&h.add(y.onCommandFinished(w=>f(w.exitCode)))};v(),h.add(l.capabilities.onDidAddCapability(y=>{y.id===2&&v()})),h.add(l.onDisposed(()=>f(void 0))),h.add(o.onCancellationRequested(()=>f(void 0)));let b=Li(300*1e3);h.add({dispose:()=>b.cancel()}),b.then(()=>f(void 0));let S=this._createMissingDependencyPasswordPrompt(t,{focusTerminal:()=>n.focusTerminal(l),onDidInputData:l.onDidInputData,onDisposed:l.onDisposed,didSendInstallCommand:()=>c},o);h.add(S)});return await l.sendText(s,!0),c=!0,{exitCode:await u}}_createMissingDependencyPasswordPrompt(e,t,o){let n=e&&this._chatService.getSession(e);if(!(n instanceof ty))return new O;let r=n.getRequests().at(-1);if(!r)return new O;let s=new gV(d(16665,null),new he(d(16664,null)),"",d(16663,null),void 0,async()=>(await t.focusTerminal(),"pending"));n.acceptResponseProgress(r,s);let l=new O,c=()=>l.dispose();return l.add({dispose:()=>s.hide()}),l.add(o.onCancellationRequested(c)),l.add(t.onDisposed(c)),l.add(t.onDidInputData(u=>{t.didSendInstallCommand()&&u.length>0&&c()})),l}_quoteShellArgument(e){return`'${e.replace(/'/g,"'\\''")}'`}_getSandboxCommandWithPreservedCwd(e,t){return this._os!==3||!t?.path||t.path===this._tempDir?.path?e:`cd ${this._quoteShellArgument(t.path)} && ${e}`}_wrapUnsandboxedCommand(e,t){return this._tempDir?.path?t?`env TMPDIR="${this._tempDir.path}" ${this._quoteShellArgument(t)} -c ${this._quoteShellArgument(e)}`:`(TMPDIR="${this._tempDir.path}"; export TMPDIR; ${e})`:e}_getBlockedDomains(e){if(this._isSandboxAllowNetworkConfigured())return{blockedDomains:[],deniedDomains:[]};let t=this._extractDomains(e);if(t.length===0)return{blockedDomains:[],deniedDomains:[]};let{allowedDomains:o,deniedDomains:n}=this.getResolvedNetworkDomains(),r=new Set,s=new Set;for(let l of t){if(n.some(c=>Uet(l,c))){r.add(l),s.add(l);continue}o.some(c=>Uet(l,c))||r.add(l)}return{blockedDomains:[...r],deniedDomains:[...s]}}_extractDomains(e){let t=new Set,o;for(GR._urlRegex.lastIndex=0;(o=GR._urlRegex.exec(e))!==null;){let n=this._extractDomainFromUrl(o[0]);n&&t.add(n)}for(GR._sshRemoteRegex.lastIndex=0;(o=GR._sshRemoteRegex.exec(e))!==null;){let n=dMe(o[1],!0);n&&t.add(n)}for(GR._hostRegex.lastIndex=0;(o=GR._hostRegex.exec(e))!==null;){let n=dMe(o[1]);n&&t.add(n)}return[...t]}_extractDomainFromUrl(e){try{let t=A.parse(e).authority;return dMe(t,!0)}catch{return}}_normalizeCommandKeywords(e){return[...new Set(e.map(t=>t.toLowerCase()))].sort()}_normalizeCommandDetails(e){let t=new Set,o=[];for(let n of e){let r={keyword:n.keyword.toLowerCase(),args:[...n.args]},s=JSON.stringify(r);t.has(s)||(t.add(s),o.push(r))}return o.sort((n,r)=>n.keyword.localeCompare(r.keyword)||n.args.join("\0").localeCompare(r.args.join("\0")))}_areStringArraysEqual(e,t){return e.length===t.length&&e.every((o,n)=>o===t[n])}_areObjectsEqual(e,t){return JSON.stringify(e)===JSON.stringify(t)}async _isSandboxConfiguredEnabled(){if(await this.getOS()===1)return!1;let t=this._getSandboxConfiguredEnabledValue();return t===!0||t==="on"||t==="allowNetwork"}async _resolveSrtPath(){if(this._srtPathResolved)return;this._srtPathResolved=!0;let e=this._remoteEnvDetails||await this._remoteEnvDetailsPromise;e&&(this._appRoot=e.appRoot.path,this._execPath=e.execPath),this._srtPath=this._pathJoin(this._appRoot,"node_modules","@vscode","sandbox-runtime","dist","cli.js"),this._rgPath=this._pathJoin(this._appRoot,"node_modules","@vscode","ripgrep","bin","rg")}async _createSandboxConfig(){if(await this.isEnabled()&&!this._tempDir&&await this._initTempDir(),this._tempDir){let e=await this.isSandboxAllowNetworkEnabled(),t=this._os===3?this._getSettingValue("chat.agent.sandbox.fileSystem.linux","chat.agent.sandboxFileSystem.linux")??{}:{},o=this._os===2?this._getSettingValue("chat.agent.sandbox.fileSystem.mac","chat.agent.sandboxFileSystem.mac")??{}:{},n=this._getSettingValue("chat.agent.sandbox.advanced.runtime")??{},r=Aqt(this._os,this._commandAllowListCommandDetails),s=this._getCommandRuntimeFileSystemPaths(r,"allowRead"),l=this._getCommandRuntimeFileSystemPaths(r,"allowWrite"),c=A.joinPath(this._tempDir,`vscode-sandbox-settings-${this._sandboxSettingsId}.json`),u=[],p=[],h=[],g;this._os===2?(u=this._updateAllowWritePathsWithWorkspaceFolders(o.allowWrite,l),p=this._updateAllowReadPathsWithAllowWrite(o.allowRead,u,s),h=this._updateDenyReadPathsWithHome(o.denyRead),g=o.denyWrite):this._os===3&&(u=this._resolveLinuxFileSystemPaths(this._updateAllowWritePathsWithWorkspaceFolders(t.allowWrite,l)),p=this._resolveLinuxFileSystemPaths(this._updateAllowReadPathsWithAllowWrite(t.allowRead,u,s)),h=this._resolveLinuxFileSystemPaths(this._updateDenyReadPathsWithHome(t.denyRead)),g=this._resolveLinuxFileSystemPaths(t.denyWrite));let f={network:e?{allowedDomains:[],deniedDomains:[],enabled:!1}:this.getResolvedNetworkDomains(),filesystem:{denyRead:h,allowRead:p,allowWrite:u,denyWrite:g}};return this._mergeAdditionalSandboxConfigProperties(f,e?this._withoutNetworkRuntimeSetting(n):n),this._mergeAdditionalSandboxConfigProperties(f,r),this._sandboxConfigPath=c.path,await this._fileService.createFile(c,Ke.fromString(JSON.stringify(f,null,"	")),{overwrite:!0}),this._sandboxConfigPath}}_getCommandRuntimeFileSystemPaths(e,t){let o=e.filesystem;if(!this._isObjectForSandboxConfigMerge(o))return[];let n=o[t];return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}_withoutNetworkRuntimeSetting(e){let t={...e};return delete t.network,t}_mergeAdditionalSandboxConfigProperties(e,t){for(let[o,n]of Object.entries(t)){if(!Object.prototype.hasOwnProperty.call(e,o)){e[o]=n;continue}let r=e[o];this._isObjectForSandboxConfigMerge(r)&&this._isObjectForSandboxConfigMerge(n)&&this._mergeAdditionalSandboxConfigProperties(r,n)}}_isObjectForSandboxConfigMerge(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}async _initTempDir(){if(await this.isEnabled()){this._needsForceUpdateConfigFile=!0;let e=this._remoteEnvDetails||await this._remoteEnvDetailsPromise;this._tempDir=this._getSandboxTempDirPath(e),this._tempDir&&(await this._fileService.createFolder(this._tempDir),this._defaultWritePaths.push(this._tempDir.path)),this._tempDir||this._logService.warn("TerminalSandboxService: Cannot create sandbox settings file because no tmpDir is available in this environment")}}async _cleanupSandboxTempDir(){if(this._tempDir)try{await this._fileService.del(this._tempDir,{recursive:!0,useTrash:!1})}catch(e){this._logService.warn("TerminalSandboxService: Failed to delete sandbox temp dir",e)}}_getSandboxTempDirPath(e){let t=this._getSandboxWindowTempDirName();if(e?.userHome){let n=A.joinPath(e.userHome,this._productService.serverDataFolderName??this._productService.dataFolderName,GR._sandboxTempDirName);return t?A.joinPath(n,t):n}let o=this._environmentService;if(o.userHome){let n=A.joinPath(o.userHome,this._productService.dataFolderName,GR._sandboxTempDirName);return t?A.joinPath(n,t):n}}_getSandboxWindowTempDirName(){let t=this._environmentService.window?.id;return typeof t=="number"?`tmp_vscode_${t}`:void 0}getResolvedNetworkDomains(){let e=this._getSettingValue("chat.agent.allowedNetworkDomains","chat.agent.sandbox.allowedNetworkDomains","chat.agent.sandboxNetwork.allowedDomains")??[],t=this._getSettingValue("chat.agent.deniedNetworkDomains","chat.agent.sandbox.deniedNetworkDomains","chat.agent.sandboxNetwork.deniedDomains")??[];return{allowedDomains:e,deniedDomains:t}}_updateAllowWritePathsWithWorkspaceFolders(e,t=[]){let o=this._workspaceContextService.getWorkspace().folders.map(n=>n.uri.path);return[...new Set([...o,...this._defaultWritePaths,...this._getWorkspaceStoragePaths(),...e??[],...t])]}_updateDenyReadPathsWithHome(e){let t=this._getUserHomePath();return[...new Set([...e??[],...t?[t]:[]])]}_updateAllowReadPathsWithAllowWrite(e,t,o=[]){return[...new Set([...e??[],...Pqt(this._os,this._commandAllowListKeywords,this._commandAllowListCommandDetails),...o,...this._getSandboxRuntimeReadPaths(),...t])]}_resolveLinuxFileSystemPaths(e){return(e??[]).map(t=>this._expandHomePath(t))}_expandHomePath(e){let t=this._getUserHomePath();return t?e==="~"?t:e.startsWith("~/")?this._pathJoin(t,e.slice(2)):e:e}_getSandboxRuntimeReadPaths(){let e=[this._appRoot];if(this._execPath)for(let t of[this._execPath,yd(this._execPath)])this._isPathUnderAppRoot(t)||e.push(t);return e}_isPathUnderAppRoot(e){return e===this._appRoot||e.startsWith(`${this._appRoot}${this._os===1?Gs.sep:Vo.sep}`)}_getWorkspaceStoragePaths(){let e=this._remoteEnvDetails?.workspaceStorageHome??this._environmentService.workspaceStorageHome,t=this._workspaceContextService.getWorkspace().id;return[A.joinPath(e,t).path]}_getUserHomePath(){let e=this._environmentService;return this._remoteEnvDetails?.userHome?.path??e.userHome?.path}async _resolveSandboxDependencyStatus(e=!1){if(!e&&this._sandboxDependencyStatus)return this._sandboxDependencyStatus;let t=this._remoteAgentService.getConnection();return t?t.withChannel(iko,o=>new Rqt(o).checkSandboxDependencies()):this._sandboxHelperService.checkSandboxDependencies()}_getSandboxConfiguredEnabledValue(){return this._getSettingValue("chat.agent.sandbox.enabled","chat.agent.sandbox")??"off"}_isSandboxAllowNetworkConfigured(){return this._getSandboxConfiguredEnabledValue()==="allowNetwork"}_areUnsandboxedCommandsAllowed(){return this._getSettingValue("chat.agent.sandbox.allowUnsandboxedCommands")===!0}_getSettingValue(e,...t){let o=this._configurationService.inspect(e);if(o.userValue!==void 0)return o.value;if(t.length>0){let n=this._configurationService.keys().user;for(let r of t){let s=this._configurationService.inspect(r);if(s.userValue!==void 0&&n.includes(r))return this._logService.warn(`TerminalSandboxService: Using deprecated setting ${r} because ${e} is not set. Please update your settings to use ${e} instead.`),s.value}}return o.value}};GR=I([m(0,B),m(1,ge),m(2,ko),m(3,re),m(4,bo),m(5,Ae),m(6,Ze),m(7,to),m(8,Dqt),m(9,si)],GR);var b0e=class{constructor(i){this._sandboxService=i}async present(i){if(await this._sandboxService.isEnabled())return{commandLine:i.commandLine.forDisplay,processOtherPresenters:!0}}};b0e=I([m(0,LP)],b0e);var ive=class extends k{constructor(e,t,o,n,r,s){super();this._xterm=e;this._logService=s;this._state=0;this._commandStartX=0;this._lastUserInput="";this._value="";this._cursorIndex=0;this._ghostTextIndex=-1;this._onDidStartInput=this._register(new T);this.onDidStartInput=this._onDidStartInput.event;this._onDidChangeInput=this._register(new T);this.onDidChangeInput=this._onDidChangeInput.event;this._onDidFinishInput=this._register(new T);this.onDidFinishInput=this._onDidFinishInput.event;this._onDidInterrupt=this._register(new T);this.onDidInterrupt=this._onDidInterrupt.event;this._register(U.any(this._xterm.onCursorMove,this._xterm.onData,this._xterm.onWriteParsed)(()=>this._sync())),this._register(this._xterm.onData(l=>this._handleUserInput(l))),this._register(t(l=>this._handleCommandStart(l))),this._register(o(()=>this._handleCommandStartChanged())),this._register(n(()=>this._handleCommandExecuted())),this._register(r(()=>this._handleCommandFinished())),this._register(this.onDidStartInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidStartInput"))),this._register(this.onDidChangeInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidChangeInput"))),this._register(this.onDidFinishInput(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidFinishInput"))),this._register(this.onDidInterrupt(()=>this._logCombinedStringIfTrace("PromptInputModel#onDidInterrupt")))}get state(){return this._state}get value(){return this._value}get prefix(){return this._value.substring(0,this._cursorIndex)}get suffix(){return this._value.substring(this._cursorIndex,this._ghostTextIndex===-1?void 0:this._ghostTextIndex)}get cursorIndex(){return this._cursorIndex}get ghostTextIndex(){return this._ghostTextIndex}_logCombinedStringIfTrace(e){this._logService.getLevel()===1&&this._logService.trace(e,this.getCombinedString())}setShellType(e){this._shellType=e}setContinuationPrompt(e){this._continuationPrompt=e,this._sync()}setLastPromptLine(e){this._lastPromptLine=e,this._sync()}setConfidentCommandLine(e){this._value!==e&&(this._value=e,this._cursorIndex=-1,this._ghostTextIndex=-1,this._onDidChangeInput.fire(this._createStateObject()))}getCombinedString(e){let t=this._value.replaceAll(`
`,"\u23CE");if(this._cursorIndex===-1)return t;let o=`${t.substring(0,this.cursorIndex)}|`;return this.ghostTextIndex!==-1?(o+=`${t.substring(this.cursorIndex,this.ghostTextIndex)}[`,o+=`${t.substring(this.ghostTextIndex)}]`):o+=t.substring(this.cursorIndex),o==="|"&&e?"":o}serialize(){return{modelState:this._createStateObject(),commandStartX:this._commandStartX,lastPromptLine:this._lastPromptLine,continuationPrompt:this._continuationPrompt,lastUserInput:this._lastUserInput}}deserialize(e){this._value=e.modelState.value,this._cursorIndex=e.modelState.cursorIndex,this._ghostTextIndex=e.modelState.ghostTextIndex,this._commandStartX=e.commandStartX,this._lastPromptLine=e.lastPromptLine,this._continuationPrompt=e.continuationPrompt,this._lastUserInput=e.lastUserInput}_handleCommandStart(e){this._state!==1&&(this._state=1,this._commandStartMarker=e.marker,this._commandStartX=this._xterm.buffer.active.cursorX,this._value="",this._cursorIndex=0,this._onDidStartInput.fire(this._createStateObject()),this._onDidChangeInput.fire(this._createStateObject()),this._lastPromptLine&&this._commandStartX!==this._lastPromptLine.length&&this._xterm.buffer.active.getLine(this._commandStartMarker.line)?.translateToString(!0).startsWith(this._lastPromptLine)&&(this._commandStartX=this._lastPromptLine.length,this._sync()))}_handleCommandStartChanged(){this._state===1&&(this._commandStartX=this._xterm.buffer.active.cursorX,this._onDidChangeInput.fire(this._createStateObject()),this._sync())}_handleCommandExecuted(){if(this._state===2)return;this._cursorIndex=-1,this._ghostTextIndex!==-1&&(this._value=this._value.substring(0,this._ghostTextIndex),this._ghostTextIndex=-1);let e=this._createStateObject();this._lastUserInput===""&&(this._lastUserInput="",this._onDidInterrupt.fire(e)),this._state=2,this._onDidFinishInput.fire(e),this._onDidChangeInput.fire(e)}_handleCommandFinished(){this._value="",this._onDidChangeInput.fire(this._createStateObject())}_sync(){try{this._doSync()}catch(e){this._logService.error("Error while syncing prompt input model",e)}}_doSync(){if(this._state!==1)return;let e=this._commandStartMarker?.line;if(e===void 0)return;let t=this._xterm.buffer.active,o=t.getLine(e),n=t.baseY+t.cursorY,r,s=o?.translateToString(!0,this._commandStartX);if(this._shellType==="fish"&&(!o||!s)&&(e+=1,o=t.getLine(e),o&&(s=o.translateToString(!0),r=n===e?t.cursorX:s?.trimEnd().length)),o===void 0||s===void 0){this._logService.trace("PromptInputModel#_sync: no line");return}let l=s,c=-1;r===void 0&&(n===e?r=Math.min(this._getRelativeCursorIndex(this._commandStartX,t,o),s.length):r=s.trimEnd().length);for(let u=e+1;u<=n;u++){let p=t.getLine(u),h=p?.translateToString(!0);if(h&&p){if(p.isWrapped||n===u&&this._continuationPrompt&&!this._lineContainsContinuationPrompt(h)){l+=`${h}`;let g=this._getRelativeCursorIndex(0,t,p);n===u?r+=g:r+=h.length}else if(this._shellType==="fish")l.endsWith("\\")?(l=l.substring(0,l.length-1),l+=`${h.trim()}`,r+=h.trim().length-1):/^ {6,}/.test(h)?(l+=`
${h.trim()}`,r+=h.trim().length+1):(l+=h,r+=h.length);else if(this._continuationPrompt===void 0||this._lineContainsContinuationPrompt(h)){let g=this._trimContinuationPrompt(h);if(l+=`
${g}`,n===u){let f=this._getContinuationPromptCellWidth(p,h),v=this._getRelativeCursorIndex(f,t,p);r+=v+1}else r+=g.length+1}}}for(let u=n+1;u<t.baseY+this._xterm.rows;u++){let p=t.getLine(u),h=p?.translateToString(!0);if(h&&p)this._shellType==="fish"?l+=`${h}`:this._continuationPrompt===void 0||this._lineContainsContinuationPrompt(h)?l+=`
${this._trimContinuationPrompt(h)}`:l+=h;else break}this._logService.getLevel()===1&&this._logService.trace(`PromptInputModel#_sync: ${this.getCombinedString()}`);{let u=this._value.length-this._value.trimEnd().length;this._lastUserInput==="\x7F"&&(this._lastUserInput="",r===this._cursorIndex-1&&(this._value.trimEnd().length>l.trimEnd().length&&l.trimEnd().length<=r?u=Math.max(this._value.length-1-l.trimEnd().length,0):u=Math.max(u-1,0))),this._lastUserInput==="\x1B[3~"&&(this._lastUserInput="",r===this._cursorIndex&&(u=Math.max(u-1,0)));let p=l.split(`
`),h=p.length>1,g=l.trimEnd();if(!h){g.length<l.length&&(this._lastUserInput===" "&&(this._lastUserInput="",r>g.length&&r>this._cursorIndex&&u++),u=Math.max(r-g.length,u,0));let f=r===0?"":l[r-1];u>0&&r===this._cursorIndex+1&&this._lastUserInput!==""&&f!==" "&&(u=this._value.length-this._cursorIndex)}if(h){p[p.length-1]=p.at(-1)?.trimEnd()??"";let f=(p.length-1)*(this._continuationPrompt?.length??0);u=Math.max(0,r-l.length-f)}l=p.map(f=>f.trimEnd()).join(`
`)+" ".repeat(u)}c=this._scanForGhostText(t,o,r),(this._value!==l||this._cursorIndex!==r||this._ghostTextIndex!==c)&&(this._value=l,this._cursorIndex=r,this._ghostTextIndex=c,this._onDidChangeInput.fire(this._createStateObject()))}_handleUserInput(e){this._lastUserInput=e}_scanForGhostText(e,t,o){if(!this.value.trim().length)return-1;let n=-1,r=!1,s=e.cursorX;for(;s>0;){let l=t.getCell(--s);if(!l)break;if(l.getChars().trim().length>0){r=!this._isCellStyledLikeGhostText(l);break}}if(r){let l=0,c=e.cursorX;for(;c<t.length;){let u=t.getCell(c++);if(!u||u.getCode()===0)break;if(this._isCellStyledLikeGhostText(u)){n=o+l;break}l+=u.getChars().length}}return n===-1&&(n=this._scanForGhostTextAdvanced(e,t,o)),n>-1&&this.value.substring(n).endsWith(" ")&&(this._value=this.value.trim(),this.value.substring(n)||(n=-1)),n}_scanForGhostTextAdvanced(e,t,o){let n=-1,r=e.cursorX,s=new Map,l=t.getCell(r),c=l;for(;c&&r<t.length;){let p=this._getCellStyleAsString(c);s.set(p,[...s.get(p)??[],r]),c=t.getCell(++r),c?.getChars().trim().length&&(l=c)}if(!l?.getChars().trim().length||this._cellStylesMatch(t.getCell(this._commandStartX),l))return-1;let u=s.get(this._getCellStyleAsString(l));if(u){if(u[0]>e.cursorX+1&&this._isPositionRightPrompt(t,u[0]))return-1;for(let p=1;p<u.length;p++)if(u[p]!==u[p-1]+1)return-1;e.baseY+e.cursorY===this._commandStartMarker?.line?n=u[0]-this._commandStartX:n=u[0]}if(n!==-1)for(let p=e.cursorX;p>=this._commandStartX;p--){let h=t.getCell(p);if(h?.getChars.length&&h&&h.getCode()!==0&&this._cellStylesMatch(l,h))return-1}return n>=o?n:-1}_isPositionRightPrompt(e,t){let o=0;for(let n=t-1;n>=this._commandStartX;n--){let r=e.getCell(n);if(!r||r.getChars().trim().length===0){if(o++,o>=5)return!0}else o=0}return!1}_getCellStyleAsString(e){return`${e.getFgColor()}${e.getBgColor()}${e.isBold()}${e.isItalic()}${e.isDim()}${e.isUnderline()}${e.isBlink()}${e.isInverse()}${e.isInvisible()}${e.isStrikethrough()}${e.isOverline()}${e.getFgColorMode()}${e.getBgColorMode()}`}_cellStylesMatch(e,t){return!e||!t?!1:e.getFgColor()===t.getFgColor()&&e.getBgColor()===t.getBgColor()&&e.isBold()===t.isBold()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isUnderline()===t.isUnderline()&&e.isBlink()===t.isBlink()&&e.isInverse()===t.isInverse()&&e.isInvisible()===t.isInvisible()&&e.isStrikethrough()===t.isStrikethrough()&&e.isOverline()===t.isOverline()&&e?.getBgColorMode()===t?.getBgColorMode()&&e?.getFgColorMode()===t?.getFgColorMode()}_trimContinuationPrompt(e){return this._lineContainsContinuationPrompt(e)&&(e=e.substring(this._continuationPrompt.length)),e}_lineContainsContinuationPrompt(e){return!!(this._continuationPrompt&&e.startsWith(this._continuationPrompt.trimEnd()))}_getContinuationPromptCellWidth(e,t){if(!this._continuationPrompt||!t.startsWith(this._continuationPrompt.trimEnd()))return 0;let o="",n=0,r;for(;o!==this._continuationPrompt&&(r=e.getCell(n++),!!r);)o+=r.getChars();return n}_getRelativeCursorIndex(e,t,o){return o?.translateToString(!1,e,t.cursorX).length??0}_isCellStyledLikeGhostText(e){return!!(e.isItalic()||e.isDim())}_createStateObject(){return Object.freeze({value:this._value,prefix:this.prefix,suffix:this.suffix,cursorIndex:this._cursorIndex,ghostTextIndex:this._ghostTextIndex})}};I([DA(0)],ive.prototype,"_sync",1),ive=I([m(5,re)],ive);function lko(a,...i){let e=i.reduce((n,r)=>(n[r]=!0,n),{}),t=[/^ELECTRON_.+$/,/^VSCODE_(?!(PORTABLE|SHELL_LOGIN|ENV_REPLACE|ENV_APPEND|ENV_PREPEND)).+$/,/^SNAP(|_.*)$/,/^GDK_PIXBUF_.+$/];Object.keys(a).filter(n=>!e[n]).forEach(n=>{for(let r=0;r<t.length;r++)if(n.search(t[r])!==-1){delete a[n];break}})}function cko(a){a&&(delete a.DEBUG,delete a.NODE_OPTIONS,Sn&&delete a.LD_PRELOAD)}function TAi(a,i){let e=a;e.includes("\\")&&(e=e.replace(/\\/g,"\\\\"));let t;switch(i){case"bash":case"sh":case"zsh":case"gitbash":t={bothQuotes:n=>`$'${n.replace(/'/g,"\\'")}'`,singleQuotes:n=>`'${n.replace(/'/g,"\\'")}'`,noSingleQuotes:n=>`'${n}'`};break;case"fish":t={bothQuotes:n=>`"${n.replace(/"/g,'\\"')}"`,singleQuotes:n=>`'${n.replace(/'/g,"\\'")}'`,noSingleQuotes:n=>`'${n}'`};break;case"pwsh":t={bothQuotes:n=>`"${n.replace(/"/g,'`"')}"`,singleQuotes:n=>`'${n.replace(/'/g,"''")}'`,noSingleQuotes:n=>`'${n}'`};break;default:t={bothQuotes:n=>`$'${n.replace(/'/g,"\\'")}'`,singleQuotes:n=>`'${n.replace(/'/g,"\\'")}'`,noSingleQuotes:n=>`'${n}'`};break}let o=/[\`\$\|\&\>\~\#\!\^\*\;\<]/g;return e=e.replace(o,""),e.includes("'")&&e.includes('"')?t.bothQuotes(e):e.includes("'")?t.singleQuotes(e):t.noSingleQuotes(e)}function dko(a,i,e){if(!a)return"";if(!i)return a;i.match(/[\/\\]$/)&&(i=i.slice(0,i.length-1));let t=a.replace(/\\/g,"/").toLowerCase(),o=i.replace(/\\/g,"/").toLowerCase();return t.includes(o)?`~${e}${a.slice(i.length+1)}`:a}function Tst(a){return a.match(/^['"].*['"]$/)&&(a=a.substring(1,a.length-1)),Ao===1&&a&&a[1]===":"?a[0].toUpperCase()+a.substring(1):a}function Oqt(a){return!a.strictEnv}function S0e(a,i){if(i)if(ii)for(let e in i){let t=e;for(let n in a)if(e.toLowerCase()===n.toLowerCase()){t=n;break}let o=i[e];o!==void 0&&uko(a,t,o)}else Object.keys(i).forEach(e=>{let t=i[e];t!==void 0&&uko(a,e,t)})}function uko(a,i,e){We(e)?a[i]=e:delete a[i]}function qdn(a,i,e,t){a.TERM_PROGRAM="vscode",i&&(a.TERM_PROGRAM_VERSION=i),$dn(a,t)&&(a.LANG=jdn(e)),a.COLORTERM="truecolor"}function pko(a,i){if(i)for(let e of Object.keys(i)){let t=i[e];t!=null&&(a[e]=t)}}async function mko(a,i){return await Promise.all(Object.entries(i).map(async([e,t])=>{if(We(t))try{i[e]=await a(t)}catch{i[e]=t}})),i}function $dn(a,i){if(i==="on")return!0;if(i==="auto"){let e=a.LANG;return!e||e.search(/\.UTF\-8$/)===-1&&e.search(/\.utf8$/)===-1&&e.search(/\.euc.+/)===-1}return!1}function jdn(a){let i=a?a.split("-"):[],e=i.length;if(e===0)return"en_US.UTF-8";if(e===1){let t={af:"ZA",am:"ET",be:"BY",bg:"BG",ca:"ES",cs:"CZ",da:"DK",de:"DE",el:"GR",en:"US",es:"ES",et:"EE",eu:"ES",fi:"FI",fr:"FR",he:"IL",hr:"HR",hu:"HU",hy:"AM",is:"IS",it:"IT",ja:"JP",kk:"KZ",ko:"KR",lt:"LT",nl:"NL",no:"NO",pl:"PL",pt:"BR",ro:"RO",ru:"RU",sk:"SK",sl:"SI",sr:"YU",sv:"SE",tr:"TR",uk:"UA",zh:"CN"};Object.prototype.hasOwnProperty.call(t,i[0])&&i.push(t[i[0]])}else i[1]=i[1].toUpperCase();return i.join("_")+".UTF-8"}async function gko(a,i,e,t,o,n){if(a.cwd){let s=typeof a.cwd=="object"?a.cwd.fsPath:a.cwd,l=await hko(s,e);return Tst(l||s)}let r;return!a.ignoreConfigurationCwd&&o&&(e&&(o=await hko(o,e,n)),o&&(Jl(o)?r=o:t&&(r=td(t.fsPath,o)))),r||(r=t?t.fsPath:i||""),Tst(r)}async function hko(a,i,e){if(i)try{return await i(a)}catch(t){e?.error("Could not resolve terminal cwd",t);return}return a}function Fqt(a,i,e){if(e)return t=>e.resolveWithEnvironment(i,a,t)}async function Wqt(a,i,e,t,o,n){let r={};if(a.strictEnv)pko(r,a.env);else{pko(r,n);let s={...i};e&&(s&&await mko(e,s),a.env&&await mko(e,a.env)),et&&(r.VSCODE_NODE_OPTIONS&&(r.NODE_OPTIONS=r.VSCODE_NODE_OPTIONS,delete r.VSCODE_NODE_OPTIONS),r.VSCODE_NODE_REPL_EXTERNAL_MODULE&&(r.NODE_REPL_EXTERNAL_MODULE=r.VSCODE_NODE_REPL_EXTERNAL_MODULE,delete r.VSCODE_NODE_REPL_EXTERNAL_MODULE)),lko(r,"VSCODE_IPC_HOOK_CLI"),S0e(r,s),S0e(r,a.env),qdn(r,t,Kr,o)}return r}async function fko(a,i,e,t,o,n,r=ii){let s;if(We(a)?s=a:(s=a.fsPath,r&&n!==1?s=s.replace(/\\/g,"/"):!r&&n===1&&(s=s.replace(/\//g,"\\"))),!i)return s;let l=s.includes(" "),c=s.includes("(")||s.includes(")"),u=Jo(i,".exe"),p=u==="pwsh"||e==="pwsh"||u==="powershell"||e==="powershell";if(p&&(l||s.includes("'")))return`& '${s.replace(/'/g,"''")}'`;if(c&&p)return`& '${s}'`;if(n===1){if(t!==void 0)return t==="gitbash"?TAi(s.replace(/\\/g,"/"),t):t==="wsl"?o?.getWslPath(s,"win-to-unix")||s:l?`"${s}"`:s;let h=i.toLowerCase();return h.includes("wsl")||h.includes("bash.exe")&&!h.toLowerCase().includes("git")?o?.getWslPath(s,"win-to-unix")||s:l?`"${s}"`:s}return TAi(s,t)}function g6(a,i,e){let t=We(a)?A.parse(a):a,o=t?i.getWorkspaceFolder(t)??void 0:void 0;if(!o){let n=e.getLastActiveWorkspaceRoot();o=n?i.getWorkspaceFolder(n)??void 0:void 0}return o}async function vko(a,i,e,t,o=ii){let n=We(a)?a:a.fsPath;return t===1?e==="wsl"?i.getWslPath(n.replaceAll("/","\\"),"win-to-unix"):e==="gitbash"?n.replaceAll("\\","/").replace(/^([a-zA-Z]):\//,"/$1/"):(n=We(a)?n:Ole(a,!0),o?n:n.replaceAll("/","\\")):o?n.replaceAll("\\","/"):n}function Vqt(a,i,e,t){let o=a.getValue("terminal.integrated.shellIntegration.timeout"),n;if(on(o)&&o===-2?n=0:!on(o)||o<0?n=i?5e3:e?3e3:2e3:o===0?n=0:n=Math.max(o,500),t!==void 0){let r=Date.now()-t;n=Math.max(0,n-r)}return n}var l1=class{constructor(i,e,t,o){this._accessibilityService=i;this._configurationService=e;this._logService=t;this._terminalService=o}static{this._lastSuccessfulShell=0}async createTerminal(i,e,t){let o=await this._createCopilotTerminal(i,e),n={instance:o,shellIntegrationQuality:"none"},r=0,s=await Promise.any([o.processReady.then(()=>r=Date.now()),U.toPromise(o.onExit)]);if(!on(s)&&Di(s)&&yo(s,{message:!0}))throw new Error(s.message);let l=this._configurationService.getValue("terminal.integrated.shellIntegration.enabled")===!0,c=Vqt(this._configurationService,l,o.hasRemoteAuthority,r);if(l1._lastSuccessfulShell!==2||l){this._logService.info(`ToolTerminalCreator#createTerminal: Waiting ${c}ms for shell integration`);let u=await this._waitForShellIntegration(o,c);if(t.isCancellationRequested)throw o.dispose(),new qi;if(u==="rich"){let p=o.capabilities.get(2);p?.promptInputModel.state===0&&(this._logService.info("ToolTerminalCreator#createTerminal: Waiting up to 2s for PromptInputModel state to change"),await Uu(U.toPromise(p.onCommandStarted),2e3)||this._logService.info("ToolTerminalCreator#createTerminal: PromptInputModel state did not change within timeout"))}if(u!=="none")return l1._lastSuccessfulShell=1,n.shellIntegrationQuality=u,n}else this._logService.info(`ToolTerminalCreator#createTerminal: Skipping wait for shell integration - last successful launch type ${l1._lastSuccessfulShell}`);return l1._lastSuccessfulShell=2,n}refreshShellIntegrationQuality(i){let e=i.instance.capabilities.get(2);e&&(i.shellIntegrationQuality==="none"||i.shellIntegrationQuality==="basic")&&(i.shellIntegrationQuality=e.hasRichCommandDetection?"rich":"basic")}_createCopilotTerminal(i,e){let t=We(i)?i:i.path,o={COPILOT_AGENT:"1",GIT_PAGER:"cat",GIT_MERGE_AUTOEDIT:"no",GIT_EDITOR:":"};this._configurationService.getValue("chat.tools.terminal.preventShellHistory")===!0&&(m0e(t,e)||m6(t,e)||h0e(t,e)||dI(t,e))&&(o.VSCODE_PREVENT_SHELL_HISTORY="1"),m6(t,e)&&(o.VSCODE_AGENT_ZSH_FIXUPS="1");let r={icon:q.fromId(L.chatSparkle.id),hideFromUser:!0,forcePersist:!0,env:o};return We(i)?r.executable=i:(r.executable=i.path,r.args=i.args,r.icon=i.icon??r.icon,r.color=i.color,r.env={...r.env,...i.env}),this._terminalService.createTerminal({config:r})}_waitForShellIntegration(i,e){let t=new O,o=new Mo,n=this._accessibilityService.isScreenReaderOptimized(),r=e>0&&n?e+3e3:e;this._logService.info(`ToolTerminalCreator#_waitForShellIntegration: base ${e}ms, effective ${r}ms, screenReaderOptimized=${n}`);let s=t.add(new ue);if(s.value=Zo(()=>{this._logService.info(`ToolTerminalCreator#_waitForShellIntegration: Timed out ${r}ms, using no SI`),o.complete("none")},r),i.capabilities.get(2)?.hasRichCommandDetection)s.clear(),this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Rich SI available immediately"),o.complete("rich");else{let l=t.add(this._terminalService.createOnInstanceCapabilityEvent(2,u=>u.onSetRichCommandDetection));t.add(l.event(u=>{u.instance===i&&(s.clear(),this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Rich SI available eventually"),o.complete("rich"))})),i.capabilities.get(2)?(s.clear(),t.add(Zo(()=>{this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Timed out 200ms, using basic SI"),o.complete("basic")},200))):t.add(i.capabilities.onDidAddCommandDetectionCapability(u=>{s.clear(),t.add(Zo(()=>{this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Timed out 200ms, using basic SI (via listener)"),o.complete("basic")},200))}))}return o.p.finally(()=>{this._logService.info("ToolTerminalCreator#_waitForShellIntegration: Promise complete, disposing store"),t.dispose()}),o.p}};l1=I([m(0,Ai),m(1,B),m(2,wa),m(3,an)],l1);var I0e=class{constructor(i,e){this._telemetryService=i;this._configurationService=e}logPrepare(i){let e=i.subCommands.map(t=>{let o=t.split(" ")[0],n=o.toLowerCase();if(!Xdn.has(n))if(/^(?:[A-Z][a-z0-9]+)+(?:-(?:[A-Z][a-z0-9]+))*$/.test(o))n="(unknown:pwsh)";else if(/^[a-z0-9_\-\.\\\/:;]+$/i.test(o)){let r=[];/[a-z]/.test(o)&&r.push("ascii_lower"),/[A-Z]/.test(o)&&r.push("ascii_upper"),/[0-9]/.test(o)&&r.push("numeric");let s=[];for(let l of[".","-","_","/","\\",":",";"])o.includes(l)&&s.push(l);n=`(unknown:${r.join(",")}:${s.join("")})`}else/[^\x00-\x7F]/.test(o)?n="(unknown:unicode)":n="(unknown)";return n});this._telemetryService.publicLog2("toolUse.runInTerminal.prepare",{terminalToolSessionId:i.terminalToolSessionId,subCommands:new lh(JSON.stringify(e)),autoApproveAllowed:i.autoApproveAllowed,autoApproveResult:i.autoApproveResult,autoApproveReason:i.autoApproveReason,autoApproveDefault:i.autoApproveDefault})}logInvoke(i,e){this._telemetryService.publicLog2("toolUse.runInTerminal",{terminalSessionId:i.sessionId,terminalToolSessionId:e.terminalToolSessionId,result:e.error??"success",strategy:e.shellIntegrationQuality==="rich"?2:e.shellIntegrationQuality==="basic"?1:0,userEditedCommand:e.didUserEditCommand?1:0,toolEditedCommand:e.didToolEditCommand?1:0,isBackground:e.isBackground?1:0,isNewSession:e.isNewSession?1:0,isSandbox:e.isSandboxWrapped?1:0,requestUnsandboxedExecutionReason:e.requestUnsandboxedExecutionReason,outputLineCount:e.outputLineCount,nonZeroExitCode:e.exitCode===void 0?-1:e.exitCode===0?0:1,exitCodeValue:e.exitCode??-1,timingConnectMs:e.timingConnectMs,timingExecuteMs:e.timingExecuteMs,pollDurationMs:e.pollDurationMs??0,terminalExecutionIdleBeforeTimeout:e.terminalExecutionIdleBeforeTimeout??!1,inputUserChars:e.inputUserChars,inputUserSigint:e.inputUserSigint,inputToolManualAcceptCount:e.inputToolManualAcceptCount??0,inputToolManualRejectCount:e.inputToolManualRejectCount??0,inputToolManualChars:e.inputToolManualChars??0,inputToolManualShownCount:e.inputToolManualShownCount??0,inputToolFreeFormInputShownCount:e.inputToolFreeFormInputShownCount??0,inputToolFreeFormInputCount:e.inputToolFreeFormInputCount??0,compressOutputEnabled:this._configurationService.getValue("chat.tools.compressOutput.enabled")===!0})}};I0e=I([m(0,_e),m(1,B)],I0e);var Xdn=new Set(["!","@","#","$","%","^","&","*","(",")","~","{","}","<",">",".","7z","alias","assoc","attrib","awk","basename","bg","blkid","bunzip2","bzip2","cat","cd","certutil","chkdsk","chmod","chown","cipher","clear","cls","cmp","column","comm","compact","compress","copy","cp","curl","cut","date","dd","del","df","diff","dig","dir","dirname","diskpart","dism","disown","du","echo","env","erase","eval","expand","export","fc","fdisk","fg","file","find","findstr","fmt","fold","forfiles","format","free","fsck","git","gpupdate","grep","groupadd","groups","gunzip","gzip","hash","head","hexdump","history","host","htop","icacls","id","ifconfig","iostat","ip","ipconfig","iptables","jobs","jq","kill","killall","less","ln","locate","ls","lsblk","lscpu","lsof","man","mkdir","mklink","more","mount","move","mv","nbtstat","nc/netcat","net","netstat","nice","nl","nohup","nslookup","nslookup","od","passwd","paste","pathping","pause","pgrep","ping","pkill","powercfg","pr","printenv","ps","pwd","query","rar","readlink","realpath","reg","rem","ren","rename","renice","rev","rm","rmdir","robocopy","route","rsync","sc","schtasks","scp","sed","seq","set","setx","sfc","shred","shuf","shutdown","sleep","sort","source","split","ss","ssh","stat","strings","su","subst","sudo","systeminfo","tac","tail","tar","tee","telnet","test","time","top","touch","tr","traceroute","tracert","tree","true","truncate","type","type","umask","umount","unalias","uname","uncompress","unexpand","uniq","unlink","unrar","unzip","uptime","useradd","usermod","vmstat","vol","watch","wc","wget","where","whereis","which","who","whoami","wmic","xargs","xcopy","xxd","xz","yes","zcat","zip","zless","zmore","bitbucket","bzr","cvs","gh","git","glab","hg","svn","fossil","p4","adb","ansible","apk","apt-get","apt","aws","az","brew","bundle","cargo","choco","clang","cmake","composer","conan","conda","dnf","docker-compose","docker","dotnet","emacs","esbuild","eslint","flatpak","flutter","fnm","g++","gcc","gcloud","go","gradle","helm","java","javac","jest","julia","kotlin","kubectl","lua","make","mocha","mvn","n","nano","node","npm","nvm","pacman","perl","php","phpunit","pip","pipenv","pnpm","pod","podman","poetry","python","r","rollup","ruby","rustc","rustup","snap","swift","terraform","tsc","tslint","vagrant","vcpkg","vi","vim","vite","vitest","webpack","yarn","yum","zypper","aider","amp","claude","codex","copilot","gemini","toad","q","taskkill","taskkill.exe","add-content","compare-object","convertfrom-json","convertto-json","copy-item","format-custom","format-list","format-table","format-wide","get-childitem","get-command","get-content","get-date","get-help","get-location","get-process","get-random","get-service","invoke-expression","invoke-restmethod","invoke-webrequest","join-path","measure-command","measure-object","move-item","new-item","out-file","remove-item","restart-computer","select-object","select-string","select-xml","set-acl","set-content","set-itemproperty","sort-object","split-path","start-process","start-sleep","stop-process","test-path","write-host","write-output","iex","irm","iwr","rd","ri","sp","spps"]);var Bqt=class{constructor(){this.commandName="sed"}canHandle(i){return i.match(/^sed\s+/)?/(?:^|\s)(-[a-zA-Z]*[iI][a-zA-Z]*\S*|--in-place(?:=\S*)?|(-i|-I)\s*'[^']*'|(-i|-I)\s*"[^"]*")(?:\s|$)/.test(i):!1}extractFileWrites(i){let e=this._tokenizeCommand(i);return this._extractFileTargets(e)}_tokenizeCommand(i){let e=[],t="",o=!1,n=!1,r=!1;for(let s=0;s<i.length;s++){let l=i[s];if(r){t+=l,r=!1;continue}if(l==="\\"&&!o){r=!0,t+=l;continue}if(l==="'"&&!n){o=!o,t+=l;continue}if(l==='"'&&!o){n=!n,t+=l;continue}if(/\s/.test(l)&&!o&&!n){t&&(e.push(t),t="");continue}t+=l}return t&&e.push(t),e}_extractFileTargets(i){if(i.length===0||i[0]!=="sed")return[];let e=[],t=1,o=!1;for(;t<i.length;){let n=i[t];if(n.startsWith("--")){if(n==="--in-place"||n.startsWith("--in-place=")){t++;continue}if(n==="--expression"||n==="--file"){t+=2,o=!0;continue}if(n.startsWith("--expression=")||n.startsWith("--file=")){t++,o=!0;continue}t++;continue}if(n.startsWith("-")&&n.length>1&&n[1]!=="-"){let s=n.slice(1),l=s.indexOf("i"),c=s.indexOf("I"),u=l>=0?l:c;if(u>=0&&u<s.length-1){t++;continue}if((s.endsWith("i")||s.endsWith("I"))&&t+1<i.length){let p=i[t+1];if(p==="''"||p==='""'){t+=2;continue}if(p.startsWith("'")&&p.endsWith("'")||p.startsWith('"')&&p.endsWith('"')){let h=p.slice(1,-1);if(h.startsWith(".")&&h.length<=10&&!h.includes("/")){t+=2;continue}}}if(s.includes("e")||s.includes("f")){let p=s.indexOf("e"),h=s.indexOf("f");if((p>=0?p:h)<s.length-1){o=!0,t++;continue}o=!0,t+=2;continue}t++;continue}if(!o){o=!0,t++;continue}let r=n;(r.startsWith("'")&&r.endsWith("'")||r.startsWith('"')&&r.endsWith('"'))&&(r=r.slice(1,-1)),e.push(r),t++}return e}};var Jdn=/(^|\s)(-{1,2}[\w-]+)=/g;function Zdn(a){return a.replace(Jdn,(i,e,t)=>`${e}${t} `)}var y0e=class extends k{constructor(e){super();this._treeSitterLibraryService=e;this._treeCache=this._register(new _Ai);this._commandFileWriteParsers=[new Bqt];this._parser=new uo(()=>this._treeSitterLibraryService.getParserClass().then(t=>new t))}async extractSubCommands(e,t){if(e==="powershell"){let n=Zdn(t);if(n!==t)return(await this._queryTree(e,n,"(command) @command")).map(s=>t.substring(s.node.startIndex,s.node.endIndex))}return(await this._queryTree(e,t,"(command) @command")).map(n=>n.node.text)}async extractPwshDoubleAmpersandChainOperators(e){return await this._queryTree("powershell",e,["(","  (pipeline","    (pipeline_chain_tail) @double.ampersand)",")"].join(`
`))}async extractCommands(e,t){let o=[];for(let n of await this.extractSubCommands(e,t)){let r=this._parseCommand(n);r&&o.push(r)}return o}async getFileWrites(e,t){let o;switch(e){case"bash":o=["(file_redirect","  destination: [(word) (string (string_content)) (raw_string) (concatenation)] @file)"].join(`
`);break;case"powershell":o=["(redirection","  (redirected_file_name) @file)"].join(`
`);break}return(await this._queryTree(e,t,o)).map(r=>r.node.text.trim())}async getCommandFileWrites(e,t){if(e!=="bash")return[];let n=await this._queryTree(e,t,"(command) @command"),r=[];for(let s of n){let l=s.node.text;for(let c of this._commandFileWriteParsers)c.canHandle(l)&&r.push(...c.extractFileWrites(l))}return r}async _queryTree(e,t,o){let{tree:n,query:r}=await this._doQuery(e,t,o);return r.captures(n.rootNode)}_normalizeCommandKeyword(e){let t=e.replace(/^['"]|['"]$/g,"");return t&&(t.includes("\\")?Gs.basename(t):Vo.basename(t)).toLowerCase().replace(/\.(?:exe|cmd|bat|ps1)$/i,"")||void 0}_parseCommand(e){let t=this._splitCommandTokens(e),o=0;for(;o<t.length&&this._isVariableAssignment(t[o]);)o++;let n=this._normalizeCommandKeyword(t[o]??"");if(n)return{keyword:n,args:t.slice(o+1)}}_splitCommandTokens(e){let t=[],o="",n,r=!1;for(let s of e.trim()){if(r){o+=s,r=!1;continue}if(s==="\\"&&n!=="'"){r=!0;continue}if(n){s===n?n=void 0:o+=s;continue}if(s==="'"||s==='"'){n=s;continue}if(/\s/.test(s)){o&&(t.push(o),o="");continue}o+=s}return r&&(o+="\\"),o&&t.push(o),t}_isVariableAssignment(e){return/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(e)}async _doQuery(e,t,o){let n=await this._treeSitterLibraryService.getLanguagePromise(e);if(!n)throw new ci("Failed to fetch language grammar");let r=this._treeCache.get(e,t);if(!r){let l=await this._parser.value;l.setLanguage(n);let c=l.parse(t);if(!c)throw new ka("Failed to parse tree");r=c,this._treeCache.set(e,t,r)}let s=await this._treeSitterLibraryService.createQuery(n,o);if(!s)throw new ci("Failed to create tree sitter query");return{tree:r,query:s}}};y0e=I([m(0,NX)],y0e);var _Ai=class extends k{constructor(){super();this._cache=new Map;this._clearScheduler=this._register(new ue);this._register(ee(()=>this._cache.clear()))}get(e,t){return this._resetClearTimer(),this._cache.get(this._getCacheKey(e,t))}set(e,t,o){this._resetClearTimer(),this._cache.set(this._getCacheKey(e,t),o)}_getCacheKey(e,t){return`${e}:${t}`}_resetClearTimer(){this._clearScheduler.value=new Dt(()=>{this._cache.clear()},1e4),this._clearScheduler.value.schedule()}};var eun=[/^(?<command>npm)\s+(?:run(?:-script)?)\s+(?<scriptName>[^\s&|;]+)/i,/^(?<command>npm)\s+(?<scriptName>test|start|stop|restart)\b/i,/^(?<command>yarn)\s+(?:run\s+)?(?<scriptName>[^\s&|;]+)/i,/^(?<command>pnpm)\s+(?:run\s+)?(?<scriptName>[^\s&|;]+)/i],tun=new Set(["add","audit","autoclean","bin","cache","check","config","create","dedupe","dlx","exec","explain","generate-lock-entry","global","help","import","info","init","install","licenses","link","list","login","logout","node","outdated","owner","pack","patch","patch-commit","plugin","policies","publish","rebuild","remove","run","search","set","stage","tag","team","unlink","unplug","up","upgrade","upgrade-interactive","version","versions","why","workspace","workspaces"]),iun=new Set(["add","audit","bin","config","dedupe","deploy","dlx","doctor","env","exec","fetch","import","init","install","install-test","licenses","link","list","ln","ls","outdated","pack","patch","patch-commit","patch-remove","prune","publish","rb","rebuild","remove","rm","root","run","server","setup","store","un","uninstall","unlink","up","update","why"]),w0e=class extends k{constructor(e,t,o,n){super();this._configurationService=e;this._fileService=t;this._uriIdentityService=o;this._workspaceContextService=n}async isCommandAutoApproved(e,t){if(!(this._configurationService.getValue("chat.tools.terminal.autoApproveWorkspaceNpmScripts")===!0))return{isAutoApproved:!1};let n=this._extractScriptName(e);if(!n)return{isAutoApproved:!1};let r=await this._getPackageJsonScripts(t);return r?r.scripts.has(n)?{isAutoApproved:!0,scriptName:n,autoApproveInfo:new he(d(16459,null,`\`${n}\``))}:{isAutoApproved:!1}:{isAutoApproved:!1}}_extractScriptName(e){let t=e.trim();for(let o of eun){let n=t.match(o);if(n?.groups?.scriptName){let{command:r,scriptName:s}=n.groups;if(r.toLowerCase()==="yarn"&&tun.has(s.toLowerCase())||r.toLowerCase()==="pnpm"&&iun.has(s.toLowerCase()))continue;return s}}}_isWithinWorkspace(e){return this._workspaceContextService.getWorkspace().folders.some(o=>this._uriIdentityService.extUri.isEqualOrParent(e,o.uri))}async _getPackageJsonScripts(e){if(!e||!this._isWithinWorkspace(e))return;let t=A.joinPath(e,"package.json"),o=await this._readPackageJsonScripts(t);if(o)return{uri:t,scripts:o}}async _readPackageJsonScripts(e){try{if(!await this._fileService.exists(e))return;let n=(await this._fileService.readFile(e)).value.toString();return this._parsePackageJsonScripts(n)}catch{return}}_parsePackageJsonScripts(e){let t=new Set,o=!1,n=0;return rE(e,{onError(){},onObjectBegin(){n++},onObjectEnd(){o&&n===2&&(o=!1),n--},onObjectProperty(s){n===1&&s==="scripts"?o=!0:o&&n===2&&t.add(s)}}),t.size>0?t:void 0}};w0e=I([m(0,B),m(1,ge),m(2,gt),m(3,Ae)],w0e);var DAi=/(?!.*)/,oun=/^[A-Z_][A-Z0-9_]*=/i,C0e=class extends k{constructor(e,t,o){super();this._configurationService=e;this._terminalChatService=o;this._denyListRules=[];this._allowListRules=[];this._allowListCommandLineRules=[];this._denyListCommandLineRules=[];this._npmScriptAutoApprover=this._register(t.createInstance(w0e)),this.updateConfiguration(),this._register(this._configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("chat.tools.terminal.autoApprove")||n.affectsConfiguration("chat.tools.terminal.ignoreDefaultAutoApproveRules")||n.affectsConfiguration("chat.agent.terminal.autoApprove"))&&this.updateConfiguration()}))}updateConfiguration(){let e=this._configurationService.getValue("chat.tools.terminal.autoApprove"),t=this._configurationService.inspect("chat.tools.terminal.autoApprove"),o=this._configurationService.getValue("chat.agent.terminal.autoApprove");o&&typeof o=="object"&&e&&typeof e=="object"&&(e={...e,...o});let{denyListRules:n,allowListRules:r,allowListCommandLineRules:s,denyListCommandLineRules:l}=this._mapAutoApproveConfigToRules(e,t);this._allowListRules=r,this._denyListRules=n,this._allowListCommandLineRules=s,this._denyListCommandLineRules=l}async isCommandAutoApproved(e,t,o,n,r){if(oun.test(e))return{result:"denied",reason:`Command '${e}' is denied because it contains transient environment variables`};for(let l of this._denyListRules)if(this._commandMatchesRule(l,e,t,o))return{result:"denied",rule:l,reason:`Command '${e}' is denied by deny list rule: ${l.sourceText}`};for(let l of this._getSessionRules(r).allowListRules)if(this._commandMatchesRule(l,e,t,o))return{result:"approved",rule:l,reason:`Command '${e}' is approved by session allow list rule: ${l.sourceText}`};for(let l of this._allowListRules)if(this._commandMatchesRule(l,e,t,o))return{result:"approved",rule:l,reason:`Command '${e}' is approved by allow list rule: ${l.sourceText}`};let s=await this._npmScriptAutoApprover.isCommandAutoApproved(e,n);return s.isAutoApproved?{result:"approved",rule:{type:"npmScript",npmScriptResult:s},reason:`Command '${e}' is approved as npm script '${s.scriptName}' is defined in package.json`}:{result:"noMatch",reason:`Command '${e}' has no matching auto approve entries`}}isCommandLineAutoApproved(e,t){for(let o of this._denyListCommandLineRules)if(o.regex.test(e))return{result:"denied",rule:o,reason:`Command line '${e}' is denied by deny list rule: ${o.sourceText}`};for(let o of this._getSessionRules(t).allowListCommandLineRules)if(o.regex.test(e))return{result:"approved",rule:o,reason:`Command line '${e}' is approved by session allow list rule: ${o.sourceText}`};for(let o of this._allowListCommandLineRules)if(o.regex.test(e))return{result:"approved",rule:o,reason:`Command line '${e}' is approved by allow list rule: ${o.sourceText}`};return{result:"noMatch",reason:`Command line '${e}' has no matching auto approve entries`}}_getSessionRules(e){let t=[],o=[],n=[],r=[];if(!e)return{denyListRules:t,allowListRules:o,allowListCommandLineRules:n,denyListCommandLineRules:r};let s=this._terminalChatService.getSessionAutoApproveRules(e);for(let[l,c]of Object.entries(s))if(typeof c=="boolean"){let{regex:u,regexCaseInsensitive:p}=this._convertAutoApproveEntryToRegex(l);c===!0?o.push({regex:u,regexCaseInsensitive:p,sourceText:l,sourceTarget:"session",isDefaultRule:!1}):c===!1&&t.push({regex:u,regexCaseInsensitive:p,sourceText:l,sourceTarget:"session",isDefaultRule:!1})}else if(typeof c=="object"&&c!==null){let u=c;if(typeof u.approve=="boolean"){let{regex:p,regexCaseInsensitive:h}=this._convertAutoApproveEntryToRegex(l);u.approve===!0?u.matchCommandLine===!0?n.push({regex:p,regexCaseInsensitive:h,sourceText:l,sourceTarget:"session",isDefaultRule:!1}):o.push({regex:p,regexCaseInsensitive:h,sourceText:l,sourceTarget:"session",isDefaultRule:!1}):u.approve===!1&&(u.matchCommandLine===!0?r.push({regex:p,regexCaseInsensitive:h,sourceText:l,sourceTarget:"session",isDefaultRule:!1}):t.push({regex:p,regexCaseInsensitive:h,sourceText:l,sourceTarget:"session",isDefaultRule:!1}))}}return{denyListRules:t,allowListRules:o,allowListCommandLineRules:n,denyListCommandLineRules:r}}_commandMatchesRule(e,t,o,n){let r=dI(o,n);return(r?e.regexCaseInsensitive:e.regex).test(t)?!0:!!(r&&t.startsWith("(")&&e.regexCaseInsensitive.test(t.slice(1)))}_mapAutoApproveConfigToRules(e,t){if(!e||typeof e!="object")return{denyListRules:[],allowListRules:[],allowListCommandLineRules:[],denyListCommandLineRules:[]};let o=[],n=[],r=[],s=[],l=this._configurationService.getValue("chat.tools.terminal.ignoreDefaultAutoApproveRules")===!0;for(let[c,u]of Object.entries(e)){let g=function(v){return Di(v)&&Object.prototype.hasOwnProperty.call(v,c)&&cD(v[c],u)},p=t?.default?.value,h=!!(Di(p)&&Object.prototype.hasOwnProperty.call(p,c)&&cD(p[c],u)),f=g(t.workspaceFolderValue)?6:g(t.workspaceValue)?5:g(t.userRemoteValue)?4:g(t.userLocalValue)?3:g(t.userValue)?2:g(t.applicationValue)?1:7;if(!(l&&h&&f===7)){if(typeof u=="boolean"){let{regex:v,regexCaseInsensitive:b}=this._convertAutoApproveEntryToRegex(c);u===!0?n.push({regex:v,regexCaseInsensitive:b,sourceText:c,sourceTarget:f,isDefaultRule:h}):u===!1&&o.push({regex:v,regexCaseInsensitive:b,sourceText:c,sourceTarget:f,isDefaultRule:h})}else if(typeof u=="object"&&u!==null){let v=u;if(typeof v.approve=="boolean"){let{regex:b,regexCaseInsensitive:S}=this._convertAutoApproveEntryToRegex(c);v.approve===!0?v.matchCommandLine===!0?r.push({regex:b,regexCaseInsensitive:S,sourceText:c,sourceTarget:f,isDefaultRule:h}):n.push({regex:b,regexCaseInsensitive:S,sourceText:c,sourceTarget:f,isDefaultRule:h}):v.approve===!1&&(v.matchCommandLine===!0?s.push({regex:b,regexCaseInsensitive:S,sourceText:c,sourceTarget:f,isDefaultRule:h}):o.push({regex:b,regexCaseInsensitive:S,sourceText:c,sourceTarget:f,isDefaultRule:h}))}}}}return{denyListRules:o,allowListRules:n,allowListCommandLineRules:r,denyListCommandLineRules:s}}_convertAutoApproveEntryToRegex(e){let t=this._doConvertAutoApproveEntryToRegex(e);return t.flags.includes("i")?{regex:t,regexCaseInsensitive:t}:{regex:t,regexCaseInsensitive:new RegExp(t.source,t.flags+"i")}}_doConvertAutoApproveEntryToRegex(e){let t=e.match(/^\/(?<pattern>.+)\/(?<flags>[dgimsuvy]*)$/),o=t?.groups?.pattern;if(o){let r=t.groups?.flags;if(r&&(r=r.replaceAll("g","")),o===".*")return new RegExp(o);try{let s=new RegExp(o,r||void 0);return lwe(s)?DAi:s}catch{return DAi}}if(e==="")return DAi;let n;if(e.includes("/")||e.includes("\\")){let r=e.replace(/[/\\]/g,"%%PATH_SEP%%");r=Ss(r),r=r.replace(/%%PATH_SEP%%*/g,"[/\\\\]"),n=`^(?:\\.[/\\\\])?${r}`}else n=Ss(e);return new RegExp(`^${n}\\b`)}};C0e=I([m(0,B),m(1,F),m(2,tg)],C0e);var nun=["curl","wget"],run=["invoke-restmethod","invoke-webrequest","irm","iwr"],ove=class extends k{constructor(e,t,o,n,r,s,l){super();this._treeSitterCommandParser=e;this._telemetry=t;this._log=o;this._configurationService=n;this._storageService=s;this._terminalChatService=l;this._commandLineAutoApprover=this._register(r.createInstance(C0e))}async analyze(e){if(this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")===!0&&e.chatSessionResource&&this._terminalChatService.hasChatSessionAutoApproval(e.chatSessionResource)){this._log("Session has auto approval enabled, auto approving command");let x=nc("workbench.action.terminal.chat.disableSessionAutoApproval",e.chatSessionResource),E={isTrusted:{enabledCommands:["workbench.action.terminal.chat.disableSessionAutoApproval"]}};return{isAutoApproved:!0,isAutoApproveAllowed:!0,disclaimers:[],autoApproveInfo:new he(`${d(16463,null)} ([${d(16464,null)}](${x.toString()}))`,E)}}let o=e.commandLine.trimStart(),n;try{n=await this._treeSitterCommandParser.extractSubCommands(e.treeSitterLanguage,o),this._log(`Parsed sub-commands via ${e.treeSitterLanguage} grammar`,n)}catch(x){console.error(x),this._log(`Failed to parse sub-commands via ${e.treeSitterLanguage} grammar`)}let r=!1,s,l;if(!n?.length)return o.length===0?(this._log("Command line is empty, auto approving"),{isAutoApproved:!0,isAutoApproveAllowed:!0,disclaimers:[]}):(this._log("No sub-commands were parsed, auto approval is not allowed"),{isAutoApproveAllowed:!1,disclaimers:[]});let c=await Promise.all(n.map(x=>this._commandLineAutoApprover.isCommandAutoApproved(x,e.shell,e.os,e.cwd,e.chatSessionResource))),u=this._commandLineAutoApprover.isCommandLineAutoApproved(o,e.chatSessionResource),p=[...c.map(x=>x.reason),u.reason],h=!1,g,f,v=c.find(x=>x.result==="denied");v?(this._log("Sub-command DENIED auto approval"),h=!0,f=$q(v.rule)?v.rule.isDefaultRule:void 0,g="subCommand"):u.result==="denied"?(this._log("Command line DENIED auto approval"),h=!0,f=$q(u.rule)?u.rule.isDefaultRule:void 0,g="commandLine"):c.every(x=>x.result==="approved")?(this._log("All sub-commands auto-approved"),r=!0,g="subCommand",f=c.every(x=>$q(x.rule)&&x.rule.isDefaultRule)):(this._log("All sub-commands NOT auto-approved"),u.result==="approved"?(this._log("Command line auto-approved"),g="commandLine",r=!0,f=$q(u.rule)?u.rule.isDefaultRule:void 0):this._log("Command line NOT auto-approved"));for(let x of p)this._log(`- ${x}`);let b=this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")===!0,S=this._storageService.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1);b&&r?s=this._createAutoApproveInfo(r,h,g,c,u):r=!1,this._telemetry.logPrepare({terminalToolSessionId:e.terminalToolSessionId,subCommands:n,autoApproveAllowed:b?S?"allowed":"needsOptIn":"off",autoApproveResult:r?"approved":h?"denied":"manual",autoApproveReason:g,autoApproveDefault:f});let y=[],w=n.map(x=>x.split(" ")[0].toLowerCase());if(!r&&(w.some(x=>nun.includes(x))||dI(e.shell,e.os)&&w.some(x=>run.includes(x)))&&y.push(d(16470,null)),b&&h){let x=this._createAutoApproveInfo(r,h,g,c,u);x&&y.push(x)}return!r&&b&&(l=Jxo(o,n,{subCommandResults:c,commandLineResult:u})),{isAutoApproved:r,isAutoApproveAllowed:!0,disclaimers:y,autoApproveInfo:s,customActions:l}}_createAutoApproveInfo(e,t,o,n,r){let s=p=>Ec(p).filter(h=>$q(h.rule)).map(h=>{let g=h.rule.sourceText.replaceAll("$","\\$");if(h.rule.sourceTarget==="session")return d(16467,null,`\`${g}\``);let f=nc("workbench.action.terminal.chat.openTerminalSettingsLink",h.rule.sourceTarget),v=d(16468,null),b=g;switch(h.rule?.sourceTarget){case 7:b=`${b} (default)`;break;case 2:case 3:b=`${b} (user)`;break;case 4:b=`${b} (remote)`;break;case 5:case 6:b=`${b} (workspace)`;break}return`[\`${b}\`](${f.toString()} "${v}")`}).join(", "),l={isTrusted:{enabledCommands:["workbench.action.terminal.chat.openTerminalSettingsLink"]}},c=this._configurationService.inspect("chat.tools.global.autoApprove");if(c?.value??c.defaultValue){let p=nc("workbench.action.terminal.chat.openTerminalSettingsLink","global");return new he(`${d(16460,null,`[\`chat.tools.global.autoApprove\`](${p.toString()} "${d(16469,null)}")`)}`,l)}if(e)switch(o){case"commandLine":{if($q(r.rule))return new he(d(16461,null,s(r)),l);break}case"subCommand":{let p=n.find(g=>xAi(g.rule));if(p&&xAi(p.rule)&&p.rule.npmScriptResult.autoApproveInfo)return p.rule.npmScriptResult.autoApproveInfo;let h=kAi(n);if(h.length===1)return new he(d(16461,null,s(h)),l);if(h.length>1)return new he(d(16462,null,s(h)),l);break}}else if(t)switch(o){case"commandLine":{if(r.rule)return new he(d(16465,null,s(r)),l);break}case"subCommand":{let p=kAi(n.filter(h=>h.result==="denied"));if(p.length===1)return new he(d(16465,null,s(p)),l);if(p.length>1)return new he(d(16466,null,s(p)),l);break}}}};ove=I([m(3,B),m(4,F),m(5,de),m(6,tg)],ove);var x0e=Symbol("null device"),k0e=class extends k{constructor(e,t,o,n,r){super();this._treeSitterCommandParser=e;this._log=t;this._configurationService=o;this._labelService=n;this._workspaceContextService=r}async analyze(e){let t;try{t=await this._getFileWrites(e)}catch(o){return console.error(o),this._log("Failed to get file writes via grammar",e.treeSitterLanguage),{isAutoApproveAllowed:!1}}return this._getResult(e,t)}async _getFileWrites(e){let t=[],o=(await this._treeSitterCommandParser.getFileWrites(e.treeSitterLanguage,e.commandLine)).map(this._mapNullDevice.bind(this,e)),n=(await this._treeSitterCommandParser.getCommandFileWrites(e.treeSitterLanguage,e.commandLine)).map(this._mapNullDevice.bind(this,e)),r=[...o,...n];if(r.length){let s=e.cwd;s?(this._log("Detected cwd",s.toString()),t=r.map(l=>l===x0e?l:(/^['"].*['"]$/.test(l)&&(l=this._stripSurroundingQuotes(l)),(e.os===1?Gs.isAbsolute(l):Vo.isAbsolute(l))?s.with({path:l}):A.joinPath(s,l)))):(this._log("Cwd could not be detected"),t=r)}return this._log("File writes detected",t.map(s=>s.toString())),t}_stripSurroundingQuotes(e){return e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'")?e.slice(1,-1):e}_mapNullDevice(e,t){return e.treeSitterLanguage==="powershell"?t==="$null"?x0e:t:t==="/dev/null"?x0e:t}_getResult(e,t){let o=!0;if(t.length>0)switch(this._configurationService.getValue("chat.tools.terminal.blockDetectedFileWrites")){case"all":{o=!1,this._log('File writes blocked due to "all" setting');break}case"outsideWorkspace":{let s=this._workspaceContextService.getWorkspace().folders;if(s.length>0)for(let l of t){if(l===x0e){this._log("File write to null device allowed",A.isUri(l)?l.toString():l);continue}if(We(l)&&!(e.os===1?Gs.isAbsolute(l):Vo.isAbsolute(l))){o=!1,this._log("File write blocked due to unknown terminal cwd",l);break}let c=A.isUri(l)?l:A.file(l);if(c.fsPath.match(/[$\(\){}`~]/)){o=!1,this._log("File write blocked due to likely containing a variable, sub-command, or tilde expansion",c.toString());break}if(!s.some(p=>p.uri.scheme===c.scheme&&(c.path.startsWith(p.uri.path+"/")||c.path===p.uri.path))){if(e.hasSessionAutoApproval&&this._isInTempDirectory(c.path,e.os))continue;o=!1,this._log("File write blocked outside workspace",c.toString());break}}else t.every(c=>c===x0e)||(o=!1,this._log("File writes blocked - no workspace folders"));break}default:break}let n=[];if(t.length>0){let r=t.map(s=>`\`${A.isUri(s)?this._labelService.getUriLabel(s):s===x0e?"/dev/null":s.toString()}\``).join(", ");o?n.push(d(16472,null,r)):n.push(d(16471,null,r))}return{isAutoApproveAllowed:o,disclaimers:n}}_isInTempDirectory(e,t){return t===1?/[\\/]te?mp[\\/].+/i.test(e):e.startsWith("/tmp/")}};k0e=I([m(2,B),m(3,nt),m(4,Ae)],k0e);var E0e=class extends k{constructor(e,t){super();this._sandboxService=e;this._configurationService=t}_isAutoApproveEnabled(){return this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")!==!1}async analyze(e){let t=this._isAutoApproveEnabled();return await this._sandboxService.isEnabled()?{isAutoApproveAllowed:t,forceAutoApproval:!e.requiresUnsandboxConfirmation&&t}:{isAutoApproveAllowed:t}}};E0e=I([m(0,LP),m(1,B)],E0e);var nve=(s=>(s.Initial="Initial",s.Idle="Idle",s.PollingForIdle="PollingForIdle",s.Prompting="Prompting",s.Timeout="Timeout",s.Active="Active",s.Cancelled="Cancelled",s))(nve||{});function RAi(a){if(!a)return"";let i=a.replace(/[\r\n]+$/,"");if(!i)return"";let e=i.lastIndexOf(`
`),t=e===-1?i:i.slice(e+1),o=t.lastIndexOf("\r");return o===-1?t:t.slice(o+1)}var cne=class extends k{constructor(e,t,o,n,r,s,l){super();this._execution=e;this._pollFn=t;this._taskService=s;this._logService=l;this._state="PollingForIdle";this._userInputtedSinceIdleDetected=!1;this._userInputListener=this._register(new ue);this._outputMonitorTelemetryCounters={inputToolManualAcceptCount:0,inputToolManualRejectCount:0,inputToolManualChars:0,inputToolAutoAcceptCount:0,inputToolAutoChars:0,inputToolManualShownCount:0,inputToolFreeFormInputShownCount:0,inputToolFreeFormInputCount:0};this._onDidFinishCommand=this._register(new T);this.onDidFinishCommand=this._onDidFinishCommand.event;this._onDidDetectInputNeeded=this._register(new T);this.onDidDetectInputNeeded=this._onDidDetectInputNeeded.event;this._onDidDetectSensitiveInputNeeded=this._register(new T);this.onDidDetectSensitiveInputNeeded=this._onDidDetectSensitiveInputNeeded.event;this._asyncMode=!1;this._command="";this._didFinish=!1;this._command=r,this._invocationContext=o;let c=new qe(n);this._currentMonitoringCts=c,this._register(ee(()=>{this._currentMonitoringCts?.cancel(),this._currentMonitoringCts?.dispose()})),Li(0).then(()=>{this._currentMonitoringCts===c&&this._startMonitoring(r,o,c.token)})}get state(){return this._state}_formatLastLineForLog(e){if(!e)return"<empty>";let t=RAi(e).trimEnd();return t?this._isSensitivePrompt(t)?"<redacted>":t.length>200?t.slice(0,200)+"\u2026":t:"<empty>"}get pollingResult(){return this._pollingResult}get outputMonitorTelemetryCounters(){return this._outputMonitorTelemetryCounters}_fireFinishedOnce(){this._didFinish||(this._didFinish=!0,this._onDidFinishCommand.fire())}dispose(){this._didFinish||(this._pollingResult??={state:"Cancelled",output:this._execution.getOutput(),pollDurationMs:0,resources:void 0}),this._fireFinishedOnce(),super.dispose()}async _startMonitoring(e,t,o){let n=Date.now(),r,s,l=!1;try{for(;!o.isCancellationRequested;){switch(this._state){case"PollingForIdle":{this._logService.trace(`OutputMonitor: Entering PollingForIdle (extended=${l})`),this._state=await this._waitForIdle(this._execution,l,o),this._logService.trace(`OutputMonitor: PollingForIdle completed -> state=${nve[this._state]}`);continue}case"Timeout":if(this._logService.trace(`OutputMonitor: Entering Timeout state (extended=${l})`),await this._handleTimeoutState(e,t,l,o)){l=!0,this._state="PollingForIdle";continue}else if(this._asyncMode){if(this._logService.trace("OutputMonitor: Async mode - timeout reached, waiting for new terminal data"),l=!1,await this._waitForNewData(o),o.isCancellationRequested)break;this._state="PollingForIdle";continue}else break;case"Cancelled":break;case"Idle":{this._logService.trace("OutputMonitor: Entering Idle handler");let c=await this._handleIdleState(o);if(c.shouldContinuePolling){this._logService.trace("OutputMonitor: Idle handler -> continue polling"),this._state="PollingForIdle";continue}else if(this._asyncMode){if(this._logService.trace("OutputMonitor: Async mode - waiting for new terminal data before next monitoring cycle"),await this._waitForNewData(o),o.isCancellationRequested)break;this._state="PollingForIdle";continue}else this._logService.trace(`OutputMonitor: Idle handler -> stop polling (hasResources=${!!c.resources}, outputLen=${c.output?.length??0})`),r=c.resources,s=c.output;break}}if(this._state==="Idle"||this._state==="Cancelled"||this._state==="Timeout")break}o.isCancellationRequested&&(this._state="Cancelled")}finally{this._logService.trace(`OutputMonitor: Monitoring finished (state=${nve[this._state]}, duration=${Date.now()-n}ms)`),this._pollingResult={state:this._state,output:s??this._execution.getOutput(),pollDurationMs:Date.now()-n,resources:r},this._userInputListener.clear(),this._fireFinishedOnce()}}continueMonitoringAsync(e){this._asyncMode=!0;let t=this._currentMonitoringCts;t?.cancel(),t?.dispose(),this._currentMonitoringCts=new qe(e),this._state="PollingForIdle",this._startMonitoring(this._command,this._invocationContext,this._currentMonitoringCts.token)}_waitForNewData(e){return new Promise(t=>{if(e.isCancellationRequested){t();return}let o=()=>{n.dispose(),r.dispose(),s.dispose()},n=this._execution.instance.onData(()=>{o(),t()}),r=e.onCancellationRequested(()=>{o(),t()}),s=this._execution.instance.onDisposed(()=>{o(),t()})})}async _handleIdleState(e){let t=this._execution.getOutput(),o=t.slice(-1e3),n=RAi(o);if(this._logService.trace(`OutputMonitor: Idle output summary: len=${t.length}, lastLine=${this._formatLastLineForLog(o)}`),wko(n))return this._logService.trace("OutputMonitor: Idle -> non-interactive help pattern detected, stopping"),{shouldContinuePolling:!1,output:t};let r=this._execution.task!==void 0;if(r&&Cko(o))return this._logService.trace("OutputMonitor: Idle -> VS Code task finish message detected, stopping"),{shouldContinuePolling:!1,output:t};if(!r&&cun(o))return this._logService.trace('OutputMonitor: Idle -> generic "press any key" detected, signaling agent'),this._onDidDetectInputNeeded.fire(),this._cleanupIdleInputListener(),{shouldContinuePolling:!1,output:t};if(this._userInputtedSinceIdleDetected)return this._logService.trace("OutputMonitor: User input detected since idle; skipping prompt and continuing polling"),this._cleanupIdleInputListener(),{shouldContinuePolling:!0};let s=sun(n);if(!s&&yko(n)&&(this._execution.isActive?await this._execution.isActive():void 0)===!0&&(s=!0),s&&this._userInputtedSinceIdleDetected)return this._logService.trace("OutputMonitor: User input detected during isActive await; skipping prompt and continuing polling"),this._cleanupIdleInputListener(),{shouldContinuePolling:!0};if(this._asyncMode)return s&&(LAi(n)?(this._logService.trace("OutputMonitor: Async mode - sensitive input prompt detected, signaling sensitive UI"),this._onDidDetectSensitiveInputNeeded.fire()):(this._logService.trace("OutputMonitor: Async mode - input-required pattern detected, signaling agent"),this._onDidDetectInputNeeded.fire())),this._cleanupIdleInputListener(),{shouldContinuePolling:!1,output:t};if(s)return LAi(n)?(this._logService.trace("OutputMonitor: Sensitive input prompt detected, signaling sensitive UI"),this._onDidDetectSensitiveInputNeeded.fire()):(this._logService.trace("OutputMonitor: Input-required pattern detected, signaling agent"),this._onDidDetectInputNeeded.fire()),this._cleanupIdleInputListener(),{shouldContinuePolling:!1,output:t};this._cleanupIdleInputListener();let l=await this._pollFn?.(this._execution,e,this._taskService);return this._logService.trace(`OutputMonitor: Custom poller result: ${l?"provided":"none"}`),{resources:l?.resources,shouldContinuePolling:!1,output:l?.output??t}}async _handleTimeoutState(e,t,o,n){return o?(this._logService.info("OutputMonitor: Extended polling timeout reached after 2 minutes, signaling potential input needed"),this._onDidDetectInputNeeded.fire(),this._state="Cancelled",!1):!0}async _waitForIdle(e,t,o){let n=t?12e4:2e4,r=1e4,s=500,l=0,c=0,u=!1,p=e.instance.onData(h=>{u=!0});try{for(;!o.isCancellationRequested&&l<n;){let h=Math.min(s,n-l);try{await Li(h,o)}catch(w){if(o.isCancellationRequested)return"Cancelled";throw w}l+=h,s=Math.min(s*2,r);let f=e.getOutput().slice(-1e3),v=RAi(f);if(wko(v))return this._logService.trace(`OutputMonitor: waitForIdle -> non-interactive help detected (waited=${l}ms)`),this._state="Idle",this._setupIdleInputListener(),this._state;if(MAi(v))return this._logService.trace(`OutputMonitor: waitForIdle -> high-confidence input pattern detected (waited=${l}ms, lastLine=${this._formatLastLineForLog(f)})`),this._state="Idle",this._setupIdleInputListener(),this._state;u?(c=0,u=!1):c++;let S=c>=2,y=e.isActive?await e.isActive():void 0;if(this._logService.trace(`OutputMonitor: waitForIdle check: waited=${l}ms, recentlyIdle=${S}, isActive=${y}`),S&&y!==!0)return this._logService.trace(`OutputMonitor: waitForIdle -> recentlyIdle && !active (waited=${l}ms, lastLine=${this._formatLastLineForLog(f)})`),this._state="Idle",this._setupIdleInputListener(),this._state;if(S&&y===!0&&yko(v))return this._logService.trace(`OutputMonitor: waitForIdle -> broad input pattern detected while active+idle (waited=${l}ms, lastLine=${this._formatLastLineForLog(f)})`),this._state="Idle",this._setupIdleInputListener(),this._state}}finally{p.dispose()}return o.isCancellationRequested?"Cancelled":"Timeout"}_setupIdleInputListener(){this._store.isDisposed||(this._userInputtedSinceIdleDetected=!1,this._logService.trace("OutputMonitor: Setting up idle input listener"),this._userInputListener.value=this._execution.instance.onDidInputData(()=>{this._userInputtedSinceIdleDetected=!0,this._logService.trace("OutputMonitor: Detected user terminal input while idle")}))}_cleanupIdleInputListener(){this._userInputtedSinceIdleDetected=!1,this._userInputListener.clear()}_isSensitivePrompt(e){return LAi(e)}};cne=I([m(5,yf),m(6,wa)],cne);function LAi(a){return/(password|passphrase|token|api\s*key|secret|verification code|otp\b|one[\s-]?time (?:code|password)|2fa|mfa|pin\s*(?:code|number)?[: ]?\s*$|authentication code)/i.test(a)}function MAi(a){return[/\s*(?:\[[^\]]\][^\[]*)+(?:\(default is\s+"[^"]+"\):)?\s+$/,/(?:\(|\[)\s*(?:y(?:es)?\s*\/\s*n(?:o)?|n(?:o)?\s*\/\s*y(?:es)?)\s*(?:\]|\))\s+$/i,/[?:]\s*(?:\(|\[)?\s*y(?:es)?\s*\/\s*n(?:o)?\s*(?:\]|\))?\s+$/i,/\(y\) +$/i,/:\s+\([^)]*\) +$/,/\(END\)$/,/password(?: for [^:]+)?:\s*$/i,/press a(?:ny)? key/i,/^(?:\s|\x1b\[[0-9;]*m)*\?.*[›❯▸▶]\s*$/].some(i=>i.test(a))}function sun(a){return MAi(a)}function yko(a){return MAi(a)?!0:[/: +$/,/\? *(?:\([a-z\s]+\))? +$/i].some(i=>i.test(a))}function wko(a){return[/press [h?]\s*(?:\+\s*enter)?\s*to (?:show|open|display|get|see)\s*(?:available )?(?:help|commands|options)/i,/press h\s*(?:or\s*\?)?\s*(?:\+\s*enter)?\s*for (?:help|commands|options)/i,/press \?\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:help|commands|options|list)/i,/type\s*[h?]\s*(?:\+\s*enter)?\s*(?:for|to see|to show)\s*(?:help|commands|options)/i,/hit\s*[h?]\s*(?:\+\s*enter)?\s*(?:for|to see|to show)\s*(?:help|commands|options)/i,/press o\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:open|launch)(?:\s*(?:the )?(?:app|application|browser)|\s+in\s+(?:the\s+)?browser)?/i,/press r\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:restart|reload|refresh)(?:\s*(?:the )?(?:server|dev server|service))?/i,/press q\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:quit|exit|stop)(?:\s*(?:the )?(?:server|app|process))?/i,/press u\s*(?:\+\s*enter)?\s*(?:to|for)?\s*(?:show|print|display)\s*(?:the )?(?:server )?urls?/i].some(i=>i.test(a))}var aun=[d(16485,null),d(16488,null),d(16486,null),d(16487,null),d(16489,null)],lun=aun.map(a=>a.replace(/[\s.,:;!?"'`()[\]{}<>\-_/\\]+/g,"").toLowerCase());function Cko(a){let i=a.replace(/[\s.,:;!?"'`()[\]{}<>\-_/\\]+/g,"").toLowerCase();return lun.some(e=>i.includes(e))}function cun(a){return Cko(a)?!1:/press a(?:ny)? key/i.test(a)}var Hqt=class extends k{rewrite(i){if(!i.cwd)return;let e=kqt(i.commandLine,i.shell,i.os);if(e){let t=e.directory.replace(/(?:[\\\/])$/,""),o=i.cwd.fsPath.replace(/(?:[\\\/])$/,"");if(i.os===1&&(t=t.toLowerCase(),o=o.toLowerCase()),t===o)return{rewritten:e.command,reasoning:"Removed redundant cd command"}}}};var T0e=class extends k{constructor(e){super();this._configurationService=e}rewrite(e){if(this._configurationService.getValue("chat.tools.terminal.preventShellHistory")===!0&&(m0e(e.shell,e.os)||m6(e.shell,e.os)))return{rewritten:` ${e.commandLine}`,reasoning:"Prepended with a space to exclude from shell history"}}};T0e=I([m(0,B)],T0e);var Uqt=class extends k{constructor(e){super();this._treeSitterCommandParser=e}async rewrite(e){if(dI(e.shell,e.os)){let t;try{t=await this._treeSitterCommandParser.extractPwshDoubleAmpersandChainOperators(e.commandLine)}catch{}if(t&&t.length>0){let o=e.commandLine;for(let n of t.reverse())o=`${o.substring(0,n.node.startIndex)};${o.substring(n.node.endIndex)}`;return{rewritten:o,reasoning:"&& re-written to ;"}}}}};var _0e=class extends k{constructor(e){super();this._configurationService=e}rewrite(e){if(!this._configurationService.getValue("chat.tools.terminal.detachBackgroundProcesses"))return;let t=e.commandLine.trimEnd(),o=/(?:^|[^&])&$/.test(t);if(!(!e.isBackground&&!o)&&!this._readsFromStdin(e.commandLine))return e.os===1?e.isBackground?this._rewriteForPowerShell(e):void 0:this._rewriteForPosix(e)}_readsFromStdin(e){let t=e.replace(/^\s*(?:[A-Z_][A-Z0-9_]*=\S+\s+)+/,"").replace(/^\s*cd\s+\S+\s*(?:&&|;)\s*/i,"").trimStart();return!!(/^(expect|passwd|vi|vim|nano|less|more|top|htop|sftp|ftp|telnet|gdb|lldb)\b/.test(t)||/^psql\b/.test(t)&&!/\s(-c|-f|--command|--file)\b/.test(t)||/^mysql\b/.test(t)&&!/\s(-e|--execute)\b/.test(t)||/^ssh\b/.test(t)&&!/\s-T\b/.test(t)&&!/\sssh\s+\S+\s+\S/.test(" "+t)||/^sudo\b/.test(t)&&!/\s-n\b/.test(t)&&!/\bSUDO_ASKPASS\b/.test(e))}_rewriteForPosix(e){let t=e.commandLine.trimEnd(),o=/(?:^|[^&])&$/.test(t),n=t;if(this._needsShellCWrapper(t)){let u=o?t.replace(/\s*&$/,""):t;if(h0e(e.shell,e.os)){let p=u.replace(/\\/g,"\\\\").replace(/"/g,'\\"');n=`${e.shell} -c "${p}"`}else{let p=u.replace(/'/g,"'\\''");n=`${e.shell} -c '${p}'`}}let r=!/(?:^|[^&])&$/.test(n),l=m0e(e.shell,e.os)||m6(e.shell,e.os)?" disown":"";return{rewritten:r?`nohup ${n} &${l}`:`nohup ${n}${l}`,reasoning:"Wrapped background command with nohup to survive terminal shutdown",forDisplay:e.commandLine}}_needsShellCWrapper(e){let t=e.trimStart();return/^(for|while|until|if|case|select|function)\b/.test(t)||/^(eval|set|export|source|unset|declare|typeset|local|readonly|alias|cd|exec)\b/.test(t)||/^\.\s/.test(t)||/^[{(]/.test(t)||/^[A-Za-z_][A-Za-z0-9_]*=/.test(t)||/(?:\|\||&&|[|;]|&(?!&)(?!\s*$))/.test(t)}_rewriteForPowerShell(e){if(!dI(e.shell,e.os))return;let t=e.commandLine.replace(/"/g,'\\"');return{rewritten:`Start-Process -WindowStyle Hidden -FilePath "${e.shell}" -ArgumentList "-NoProfile", "-Command", "${t}"`,reasoning:"Wrapped background command with Start-Process to survive terminal shutdown",forDisplay:e.commandLine}}};_0e=I([m(0,B)],_0e);var D0e=class extends k{constructor(e,t){super();this._treeSitterCommandParser=e;this._sandboxService=t}async rewrite(e){let t=await this._sandboxService.checkForSandboxingPrereqs();if(!t.enabled||t.failedCheck==="config")return;let o=await this._parseCommandDetails(e),n=await this._sandboxService.wrapCommand(e.commandLine,e.requestUnsandboxedExecution,e.shell,e.cwd,o);return{rewritten:n.command,reasoning:n.requiresUnsandboxConfirmation?"Switched command to unsandboxed execution because the command includes a domain that is not in the sandbox allowlist":"Wrapped command for sandbox execution",forDisplay:e.commandLine,isSandboxWrapped:n.isSandboxWrapped,requiresUnsandboxConfirmation:n.requiresUnsandboxConfirmation,blockedDomains:n.blockedDomains,deniedDomains:n.deniedDomains}}async _parseCommandDetails(e){try{if(e.requestUnsandboxedExecution===!0)return[];let t=dI(e.shell,e.os)?"powershell":"bash";return await this._treeSitterCommandParser.extractCommands(t,e.commandLine)}catch{return[]}}};D0e=I([m(1,LP)],D0e);var fk=class extends k{constructor(){super(...arguments);this._map=new Map;this._onDidAddCapability=this._register(new T);this._onDidRemoveCapability=this._register(new T)}get onDidAddCapability(){return this._onDidAddCapability.event}get onDidRemoveCapability(){return this._onDidRemoveCapability.event}get onDidChangeCapabilities(){return U.map(U.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return U.map(U.filter(this.onDidAddCapability,e=>e.id===2,this._store),e=>e.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return U.map(U.filter(this.onDidRemoveCapability,e=>e.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return U.map(U.filter(this.onDidAddCapability,e=>e.id===0,this._store),e=>e.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return U.map(U.filter(this.onDidRemoveCapability,e=>e.id===0,this._store),()=>{},this._store)}get items(){return this._map.keys()}createOnDidRemoveCapabilityOfTypeEvent(e){return U.map(U.filter(this.onDidRemoveCapability,t=>t.id===e),t=>t.capability)}createOnDidAddCapabilityOfTypeEvent(e){return U.map(U.filter(this.onDidAddCapability,t=>t.id===e),t=>t.capability)}add(e,t){this._map.set(e,t),this._onDidAddCapability.fire(PAi(e,t))}get(e){return this._map.get(e)}remove(e){let t=this._map.get(e);t&&(this._map.delete(e),this._onDidRemoveCapability.fire(PAi(e,t)))}has(e){return this._map.has(e)}};I([bi],fk.prototype,"onDidChangeCapabilities",1),I([bi],fk.prototype,"onDidAddCommandDetectionCapability",1),I([bi],fk.prototype,"onDidRemoveCommandDetectionCapability",1),I([bi],fk.prototype,"onDidAddCwdDetectionCapability",1),I([bi],fk.prototype,"onDidRemoveCwdDetectionCapability",1);var f6=class extends k{constructor(){super(...arguments);this._stores=[];this._onDidAddCapability=this._register(new T);this._onDidRemoveCapability=this._register(new T)}get onDidAddCapability(){return this._onDidAddCapability.event}get onDidRemoveCapability(){return this._onDidRemoveCapability.event}get onDidChangeCapabilities(){return U.map(U.any(this._onDidAddCapability.event,this._onDidRemoveCapability.event),()=>{},this._store)}get onDidAddCommandDetectionCapability(){return U.map(U.filter(this.onDidAddCapability,e=>e.id===2,this._store),e=>e.capability,this._store)}get onDidRemoveCommandDetectionCapability(){return U.map(U.filter(this.onDidRemoveCapability,e=>e.id===2,this._store),()=>{},this._store)}get onDidAddCwdDetectionCapability(){return U.map(U.filter(this.onDidAddCapability,e=>e.id===0,this._store),e=>e.capability,this._store)}get onDidRemoveCwdDetectionCapability(){return U.map(U.filter(this.onDidRemoveCapability,e=>e.id===0,this._store),()=>{},this._store)}get items(){return this._items()}createOnDidRemoveCapabilityOfTypeEvent(e){return U.map(U.filter(this.onDidRemoveCapability,t=>t.id===e),t=>t.capability)}createOnDidAddCapabilityOfTypeEvent(e){return U.map(U.filter(this.onDidAddCapability,t=>t.id===e),t=>t.capability)}*_items(){for(let e of this._stores)for(let t of e.items)yield t}has(e){for(let t of this._stores)for(let o of t.items)if(o===e)return!0;return!1}get(e){for(let t of this._stores){let o=t.get(e);if(o)return o}}add(e){this._stores.push(e);for(let t of e.items)this._onDidAddCapability.fire(PAi(t,e.get(t)));this._register(e.onDidAddCapability(t=>this._onDidAddCapability.fire(t))),this._register(e.onDidRemoveCapability(t=>this._onDidRemoveCapability.fire(t)))}};I([bi],f6.prototype,"onDidChangeCapabilities",1),I([bi],f6.prototype,"onDidAddCommandDetectionCapability",1),I([bi],f6.prototype,"onDidRemoveCommandDetectionCapability",1),I([bi],f6.prototype,"onDidAddCwdDetectionCapability",1),I([bi],f6.prototype,"onDidRemoveCwdDetectionCapability",1);function PAi(a,i){return{id:a,capability:i}}function tm(a,i,e=!1){_st.INSTANCE.registerTerminalContribution({id:a,ctor:i,canRunInDetachedTerminals:e})}var Dst;(i=>{function a(){return _st.INSTANCE.getTerminalContributions()}i.getTerminalContributions=a})(Dst||={});var _st=class a{constructor(){this._terminalContributions=[]}static{this.INSTANCE=new a}registerTerminalContribution(i){this._terminalContributions.push(i)}getTerminalContributions(){return this._terminalContributions.slice(0)}};oe.add("terminal.contributions",_st.INSTANCE);var R0e=class{constructor(){this._attached=new Map}attachToElement(i){this._container||(this._container=document.createElement("div"),this._container.classList.add("terminal-widget-container"),i.appendChild(this._container))}dispose(){this._container&&(this._container.remove(),this._container=void 0),this._attached.forEach(i=>i.dispose()),this._attached.clear()}attachWidget(i){if(this._container)return this._attached.get(i.id)?.dispose(),i.attach(this._container),this._attached.set(i.id,i),{dispose:()=>{this._attached.get(i.id)===i&&(this._attached.delete(i.id),i.dispose())}}}};var L0e=class extends k{constructor(e,t,o){super();this._xterm=e;this._widgets=this._register(new R0e);this._contributions=new Map;this._attachDisposables=this._register(new ue);this.onData=this._xterm.raw.onData;let n=t.capabilities??new fk;this._register(n),this.capabilities=n,this._register(e);let r=Dst.getTerminalContributions();for(let s of r){if(this._contributions.has(s.id)){mt(new Error(`Cannot have two terminal contributions with the same id ${s.id}`));continue}if(s.canRunInDetachedTerminals===!1)continue;let l;try{l=o.createInstance(s.ctor,{instance:this,processManager:t.processInfo,widgetManager:this._widgets}),this._contributions.set(s.id,l),this._register(l)}catch(c){mt(c)}}this._register(new rn(EL)).trigger(()=>{for(let s of this._contributions.values())s.xtermReady?.(this._xterm)})}get xterm(){return this._xterm}get selection(){return this._xterm&&this.hasSelection()?this._xterm.raw.getSelection():void 0}hasSelection(){return this._xterm.hasSelection()}clearSelection(){this._xterm.clearSelection()}focus(e){(e||!zi().getSelection()?.toString())&&this.xterm.focus()}attachToElement(e,t){this.domElement=e;let o=this._xterm.attachToElement(e,t);this._widgets.attachToElement(o);let n=new O,r=()=>{setTimeout(()=>this.focus(!0),0)};n.add($(e,ne.MOUSE_DOWN,r)),this._attachDisposables.value=n}forceScrollbarVisibility(){this.domElement?.classList.add("force-scrollbar")}resetScrollbarVisibility(){this.domElement?.classList.remove("force-scrollbar")}getContribution(e){return this._contributions.get(e)}};L0e=I([m(2,F)],L0e);var rve=class extends k{constructor(e){super();this.processState=3;this.ptyProcessReady=Promise.resolve();this.initialCwd="";this.shouldPersist=!1;this.hasWrittenData=!1;this.hasChildProcesses=!1;this.shellIntegrationNonce="";Object.assign(this,e),this.capabilities=this._register(new fk)}};function kko(a,i,e){if(e){let n=Ue.fromHex(e);if(n)return n}let t=a.getColor(fee);if(t)return t;let o=Z.inChatEditor.getValue(i);return a.getColor(o?Bo:GI)}function Eko(a,i){let e=0;for(let t=0;t<a.length;t++){let o=a.getLine(t);if(!o)continue;let n=Math.min(o.length,i);for(let r=n-1;r>=0;r--)if(o.getCell(r)?.getChars()){e=Math.max(e,r+1);break}}return e}function dun(a,i,e,t=50){let o=Math.max(0,e-t),n=e;for(let r=o;r<n;r++)if(a.charCodeAt(r)!==i.charCodeAt(r))return!1;return!0}function zqt(a,i){return Math.max(i-a,0)}async function Tko(a,i,e){let t=i.executedMarker,o=i.endMarker;if(!o||o.isDisposed)return;if(!t||t.isDisposed){let c=a.raw,u=c.buffer.active,p=[-(u.baseY+u.cursorY),-u.baseY,0],h;for(let S of p)if(h=c.registerMarker(S),h)break;if(!h||h.isDisposed)return{text:"",lineCount:0};let g=h.line,f;try{f=await a.getRangeAsVT(h,o,!0)}catch(S){e?.("fallback",S);return}finally{h.dispose()}if(!f)return{text:"",lineCount:0};let v=o.line,b=zqt(g,v);return{text:f,lineCount:b}}let n=t.line,r=o.line,s=zqt(n,r),l;try{l=await a.getRangeAsVT(t,o,!0)}catch(c){e?.("primary",c);return}return l?{text:l,lineCount:s}:{text:"",lineCount:0}}var M0e=class extends k{constructor(e,t,o,n){super();this._xtermTerminal=e;this._command=t;this._terminalService=o;this._contextKeyService=n;this._streamingDisposables=this._register(new O);this._onDidUpdateEmitter=this._register(new T);this.onDidUpdate=this._onDidUpdateEmitter.event;this._onDidInputEmitter=this._register(new T);this.onDidInput=this._onDidInputEmitter.event;this._lastVT="";this._lineCount=0;this._maxColumnWidth=0;this._dirtyScheduled=!1;this._isStreaming=!1;this._register(ee(()=>{this._stopStreaming()}))}async attach(e){if(this._store.isDisposed)return;let t;try{t=await this._getOrCreateTerminal()}catch(o){if(o instanceof qi)return;throw o}this._store.isDisposed||this._attachedContainer!==e&&(e.classList.add("chat-terminal-output-terminal"),t.attachToElement(e,{enableGpu:!1}),this._attachedContainer=e)}async renderCommand(){if(this._store.isDisposed)return;let e;try{e=await this._getOrCreateTerminal()}catch(r){if(r instanceof qi)return;throw r}if(this._store.isDisposed)return;let t;try{t=await this._getCommandOutputAsVT(this._xtermTerminal)}catch{}if(!t||this._store.isDisposed)return;await new Promise(r=>{if(!!this._lastVT&&t.text.length>=this._lastVT.length&&this._vtBoundaryMatches(t.text,this._lastVT.length)){let l=t.text.slice(this._lastVT.length);l?e.xterm.write(l,r):r()}else{let l=this._lastVT?`\x1Bc${t.text}`:t.text;l?e.xterm.write(l,r):r()}}),this._lastVT=t.text;let o=this._xtermTerminal.raw;return o&&(this._sourceRaw=o,this._lastUpToDateCursorY=this._getAbsoluteCursorY(o),!this._isStreaming&&(!this._command.endMarker||this._command.endMarker.isDisposed)&&this._startStreaming(o)),this._lineCount=this._getRenderedLineCount(),this._command.endMarker&&!this._command.endMarker.isDisposed&&this._lineCount<=100&&(this._maxColumnWidth=this._computeMaxColumnWidth()),{lineCount:this._lineCount,maxColumnWidth:this._maxColumnWidth}}async _getCommandOutputAsVT(e){if(this._store.isDisposed)return;let t=this._command.executedMarker??this._command.commandExecutedMarker;if(!t)return;let o=this._command.endMarker,n=await e.getRangeAsVT(t,o,o?.line!==t.line);if(!this._store.isDisposed)return n?{text:n}:{text:""}}_getRenderedLineCount(){let e=this._command.endMarker;if(this._command.executedMarker&&e&&!e.isDisposed){let o=this._command.executedMarker.line,n=e.line;return zqt(o,n)}let t=this._command.executedMarker??this._command.commandExecutedMarker;if(t&&this._sourceRaw){let o=this._sourceRaw.buffer.active,n=o.baseY+o.cursorY;return zqt(t.line,n)}return this._lineCount}_computeMaxColumnWidth(){let e=this._detachedTerminal;return e?Eko(e.xterm.buffer.active,e.xterm.cols):0}async _getOrCreateTerminal(){if(this._detachedTerminal)return this._detachedTerminal;if(this._detachedTerminalPromise)return this._detachedTerminalPromise;if(this._store.isDisposed)throw new qi;let e=(async()=>{let t={getBackgroundColor:r=>kko(r,this._contextKeyService)},o=new rve({initialCwd:""}),n=await this._terminalService.createDetachedTerminal({cols:this._xtermTerminal.raw.cols??80,rows:10,readonly:!1,processInfo:o,disableOverviewRuler:!0,colorProvider:t});if(this._store.isDisposed)throw o.dispose(),n.dispose(),new qi;return this._detachedTerminal=n,this._register(o),this._register(n),this._register(n.onData(r=>this._onDidInputEmitter.fire(r))),n})();return this._detachedTerminalPromise=e,e}_startStreaming(e){this._store.isDisposed||this._isStreaming||(this._isStreaming=!0,this._streamingDisposables.add(U.any(e.onCursorMove,e.onLineFeed,e.onWriteParsed)(()=>this._handleCursorEvent())),this._streamingDisposables.add(e.onData(()=>this._handleCursorEvent())))}_stopStreaming(){this._isStreaming&&(this._streamingDisposables.clear(),this._isStreaming=!1,this._lowestDirtyCursorY=void 0,this._sourceRaw=void 0)}_handleCursorEvent(){if(this._store.isDisposed||!this._sourceRaw)return;let e=this._getAbsoluteCursorY(this._sourceRaw);this._lowestDirtyCursorY=this._lowestDirtyCursorY===void 0?e:Math.min(this._lowestDirtyCursorY,e),this._scheduleFlush()}_scheduleFlush(){this._dirtyScheduled||this._store.isDisposed||(this._dirtyScheduled=!0,queueMicrotask(()=>{this._dirtyScheduled=!1,!this._store.isDisposed&&this._flushDirtyRange()}))}_flushDirtyRange(){this._store.isDisposed||this._flushPromise||(this._flushPromise=this._doFlushDirtyRange().finally(()=>{this._flushPromise=void 0}))}async _doFlushDirtyRange(){if(this._store.isDisposed)return;let e=this._xtermTerminal.raw,t=this._detachedTerminal;if(!t)try{t=await this._getOrCreateTerminal()}catch(h){if(h instanceof qi)return;throw h}if(this._store.isDisposed)return;let o=t?.xterm;if(!e||!o)return;this._sourceRaw=e;let n=this._getAbsoluteCursorY(e),r=this._lastUpToDateCursorY??n,s=this._lowestDirtyCursorY??n;this._lowestDirtyCursorY=void 0;let l=Math.min(r,s),c=await this._getCommandOutputAsVT(this._xtermTerminal);if(!c||this._store.isDisposed)return;if(c.text===this._lastVT){this._lastUpToDateCursorY=n,this._command.endMarker&&!this._command.endMarker.isDisposed&&this._stopStreaming();return}let u=!!this._lastVT&&l>=r&&c.text.length>=this._lastVT.length&&this._vtBoundaryMatches(c.text,this._lastVT.length);await new Promise(h=>{if(u){let g=c.text.slice(this._lastVT.length);g?o.write(g,h):h()}else{let g=this._lastVT?`\x1Bc${c.text}`:c.text;g?o.write(g,h):h()}}),this._lastVT=c.text,this._lineCount=this._getRenderedLineCount(),this._lastUpToDateCursorY=n,this._command.endMarker&&!this._command.endMarker.isDisposed&&(this._lineCount<=100&&(this._maxColumnWidth=this._computeMaxColumnWidth()),this._stopStreaming()),this._onDidUpdateEmitter.fire({lineCount:this._lineCount,maxColumnWidth:this._maxColumnWidth})}_getAbsoluteCursorY(e){return e.buffer.active.baseY+e.buffer.active.cursorY}_vtBoundaryMatches(e,t){return dun(e,this._lastVT,t)}};M0e=I([m(2,an),m(3,X)],M0e);var P0e=class extends k{constructor(e,t,o,n){super();this._getTheme=t;this._terminalService=o;this._contextKeyService=n;this._dirty=!0;this._output=e;let r=this._register(new rve({initialCwd:""}));this._detachedTerminal=this._terminalService.createDetachedTerminal({cols:80,rows:10,readonly:!0,processInfo:r,disableOverviewRuler:!0,colorProvider:{getBackgroundColor:s=>{let l=this._getTheme()?.background;return kko(s,this._contextKeyService,l)}}}).then(s=>this._store.isDisposed?(s.dispose(),s):this._register(s))}async _getTerminal(){if(!this._detachedTerminal)throw new Error("Detached terminal not initialized");return this._detachedTerminal}setOutput(e){this._output=e,this._dirty=!0}async attach(e){let t=await this._getTerminal();if(this._store.isDisposed)return;e.classList.add("chat-terminal-output-terminal"),(this._attachedContainer!==e||e.firstChild===null)&&(t.attachToElement(e,{enableGpu:!1}),this._attachedContainer=e),this._container=e,this._applyTheme(e)}async render(){let e=this._output;if(!e)return;if(!this._dirty)return{lineCount:this._lastRenderedLineCount??e.lineCount,maxColumnWidth:this._lastRenderedMaxColumnWidth};let t=await this._getTerminal();if(this._store.isDisposed)return;this._container&&this._applyTheme(this._container);let o=e.text??"",n=e.lineCount??this._estimateLineCount(o);if(!o)return this._dirty=!1,this._lastRenderedLineCount=n,this._lastRenderedMaxColumnWidth=0,{lineCount:0,maxColumnWidth:0};if(await new Promise(r=>t.xterm.write(o,r)),!this._store.isDisposed)return this._dirty=!1,this._lastRenderedLineCount=n,this._shouldComputeMaxColumnWidth(n)&&(this._lastRenderedMaxColumnWidth=this._computeMaxColumnWidth(t)),{lineCount:n,maxColumnWidth:this._lastRenderedMaxColumnWidth}}_computeMaxColumnWidth(e){return Eko(e.xterm.buffer.active,e.xterm.cols)}_estimateLineCount(e){if(!e)return 0;let t=e.replace(/\r/g,""),o=t.split(`
`),n=t.endsWith(`
`)?o.length-1:o.length;return Math.max(n,1)}_shouldComputeMaxColumnWidth(e){return e<=100}_applyTheme(e){let t=this._getTheme();if(!t){e.style.removeProperty("background-color"),e.style.removeProperty("color");return}t.background&&(e.style.backgroundColor=t.background),t.foreground&&(e.style.color=t.foreground)}};P0e=I([m(2,an),m(3,X)],P0e);var A0e=class{constructor(i){this._logService=i}async capture(i,e,t){if(t){try{i.terminalCommandUri=this._createTerminalCommandUri(e,t)}catch(r){this._logService.warn(`RunInTerminalTool: Failed to create terminal command URI for ${t}`,r)}let o=await this._tryGetCommand(e,t);if(o){i.terminalCommandState={exitCode:o.exitCode,timestamp:o.timestamp,duration:o.duration};let r=await this._captureCommandOutput(e,o);r&&(i.terminalCommandOutput=r),this._applyTheme(i,e);return}let n=await this._capturePartialCommandOutput(e,t);n&&(i.terminalCommandOutput=n,this._logService.debug(`RunInTerminalTool: Captured partial command output for ${t}`))}this._applyTheme(i,e)}async _captureCommandOutput(i,e){try{await i.xtermReadyPromise}catch{return}let t=i.xterm;if(t)return Tko(t,e,(o,n)=>{let r=o==="fallback"?" (fallback)":"";this._logService.debug(`RunInTerminalTool: Failed to snapshot command output${r}`,n)})}async _capturePartialCommandOutput(i,e){try{await i.xtermReadyPromise}catch{return}let t=i.xterm;if(!t)return;let n=i.capabilities.get(2)?.currentCommand;if(n&&n.id===e){let r=n.commandExecutedMarker;if(r&&!r.isDisposed)try{let l=t.raw.buffer.active,c=l.baseY+l.cursorY,u=r.line,p=Math.max(c-u,0);if(p>0){let h=await t.getRangeAsVT(r,void 0,!0);if(h)return{text:h,lineCount:p}}}catch(s){this._logService.debug("RunInTerminalTool: Failed to capture partial command output",s)}}}_applyTheme(i,e){let t=e.xterm?.getXtermTheme();t&&(i.terminalTheme={background:t.background,foreground:t.foreground})}_createTerminalCommandUri(i,e){let t=new URLSearchParams(i.resource.query);return t.set("command",e),i.resource.with({query:t.toString()})}async _tryGetCommand(i,e){return i.capabilities.get(2)?.commands.find(o=>o.id===e)}};A0e=I([m(0,wa)],A0e);var N0e=class extends k{constructor(e){super();this._sandboxService=e}async analyze(e){if(!e.isSandboxWrapped)return;let t=e.exitCode!==void 0&&e.exitCode!==0,o=!t&&e.exitCode===void 0&&this._outputLooksSandboxBlocked(e.exitResult);if(!t&&!o)return;let r=await this._sandboxService.getOS()===3?"chat.agent.sandbox.fileSystem.linux":"chat.agent.sandbox.fileSystem.mac";return`${t?"Command failed while running in sandboxed mode. If the command failed due to sandboxing:":"Command ran in sandboxed mode and may have been blocked by the sandbox. If the command failed due to sandboxing:"}
- If it would be reasonable to extend the sandbox rules, work with the user to update allowWrite for file system access problems in ${r}, or to add required domains to chat.agent.allowedNetworkDomains.
- Otherwise, immediately retry the command with requestUnsandboxedExecution=true. Do NOT ask the user \u2014 setting this flag automatically shows a confirmation prompt to the user.

Here is the output of the command:
`}_outputLooksSandboxBlocked(e){return AAi(e)}};N0e=I([m(0,LP)],N0e);function AAi(a){let i=a.replace(/\n/g," ");return/Operation not permitted|Permission denied|Read-only file system|sandbox-exec|bwrap|sandbox_violation/i.test(i)}function sve(a,i,e,t){if(i.inspect("chat.tools.global.autoApprove").policyValue===!1)return!1;let n=e.getWidgetBySessionResource(a)??e.lastFocusedWidget;if(n&&Mpe(n.input.currentModeInfo.permissionLevel))return!0;let s=t.getSession(a)?.getRequests().at(-1);return Mpe(s?.modeInfo?.permissionLevel)}function NAi(a,i,e){let t=i.getValue("chat.tools.eligibleForAutoApproval");if(t&&typeof t=="object"){if(Object.prototype.hasOwnProperty.call(t,a))return t[a];if(e){for(let o of e)if(Object.prototype.hasOwnProperty.call(t,o))return t[o]}}return!0}function _ko(a,i,e,t){let o=NAi(a,i,t),n=i.getValue("chat.tools.terminal.enableAutoApprove")===!0,r=e.getBoolean("chat.tools.terminal.autoApprove.warningAccepted",-1,!1);return o&&n&&r}var Dko="https://aka.ms/vscode-sandboxing",OAi="runInTerminal",FAi=["runCommands/runInTerminal"],uun=5e3;function pun(a,i,e,t){let o=Qxo(a),n=[`This tool allows you to execute ${o?"Windows PowerShell 5.1":"PowerShell"} commands in a persistent terminal session, preserving environment variables, working directory, and other context across multiple commands.`,"","Command Execution:",o?"- Use semicolons ; to chain commands on one line, NEVER use && even when asked explicitly":"- Prefer ; when chaining commands on one line","- Prefer pipelines | for object-based data flow",'- Never create a sub-shell (eg. powershell -c "command") unless explicitly asked',"","Directory Management:","- Prefer relative paths when navigating directories, only use absolute when the path is far away or the current cwd is not expected","- By default (mode=sync), shell and cwd are reused by subsequent sync commands","- Use $PWD or Get-Location for current directory","- Use Push-Location/Pop-Location for directory stack","","Program Execution:","- Supports .NET, Python, Node.js, and other executables","- Install modules via Install-Module, Install-Package","- Use Get-Command to verify cmdlet/function availability","","Async Mode:","- Use mode=async ONLY for processes that should keep running while you do other work (servers, watchers, dev daemons)","- For one-shot long-running commands where you have nothing to do until they finish (package installs, builds, downloads, test suites), use mode=sync with a generous timeout (e.g. 600000 / 10 min for installs, longer for big builds) so the command can complete before your turn ends","- Returns a terminal ID for checking status and runtime later","- Use Start-Job for background PowerShell jobs","","Use send_to_terminal to send commands or input to a terminal session."];return i&&n.push(...Pko(e,t)),n.push("","Output Management:","- Output is automatically truncated if longer than 60KB to prevent context overflow","- Use Select-Object, Where-Object, Format-Table to filter output","- Use -First/-Last parameters to limit results","- For pager commands, add | Out-String or | Format-List","","Best Practices:","- Use proper cmdlet names instead of aliases in scripts",'- Quote paths with spaces: "C:\\Path With Spaces"',"- Prefer PowerShell cmdlets over external commands when available","- Prefer idiomatic PowerShell like Get-ChildItem instead of dir or ls for file listings","- Use Test-Path to check file/directory existence","- Be specific with Select-Object properties to avoid excessive output","- Avoid printing credentials unless absolutely required","- NEVER run Start-Sleep or similar wait commands. You will be automatically notified on your next turn when async terminal commands or timed-out sync commands complete or need input. Do NOT poll for completion.","","Interactive Input Handling:","- When a terminal command is waiting for interactive input, do NOT suggest alternatives or ask the user whether to proceed. Instead, use the vscode_askQuestions tool to collect the needed values from the user, then send them.","- NEVER use vscode_askQuestions to request sensitive input such as passwords, passphrases, API keys, tokens, or other secrets \u2014 answers to that tool are sent through the model. If the prompt requires a secret, tell the user to type it directly into the terminal and stop; do not call vscode_askQuestions or send_to_terminal for that prompt.","- Send exactly one answer per prompt using send_to_terminal. Never send multiple answers in a single send.","- After each send, call get_terminal_output to read the next prompt before sending the next answer.","- Continue one prompt at a time until the command finishes."),n.join(`
`)}function Pko(a,i){let e=["","Sandboxing:","- ATTENTION: Terminal sandboxing is enabled, commands run in a sandbox by default","- When executing commands within the sandboxed environment, all operations requiring a temporary directory must utilize the $TMPDIR environment variable. The /tmp directory is not guaranteed to be accessible or writable and must be avoided","- Tools and scripts should respect the TMPDIR environment variable, which is automatically set to an appropriate path within the sandbox"];if(a?e.push("- When a command fails due to sandbox restrictions, immediately re-run it with requestUnsandboxedExecution=true. Do NOT ask the user for permission \u2014 setting this flag automatically shows a confirmation prompt to the user","- Only set requestUnsandboxedExecution=true when there is evidence of failures caused by the sandbox, e.g. 'Operation not permitted' errors, network failures, or file access errors, etc","- When setting requestUnsandboxedExecution=true, also provide requestUnsandboxedExecutionReason explaining why the command needs unsandboxed access"):e.push("- Running commands outside the sandbox is disabled by the current chat.agent.sandbox.allowUnsandboxedCommands setting. Do not set requestUnsandboxedExecution=true."),i){let t=new Set(i.deniedDomains),o=i.allowedDomains.filter(n=>!t.has(n));o.length===0?e.push("- All network access is blocked in the sandbox"):e.push(`- Only the following domains are accessible in the sandbox (all other network access is blocked): ${o.join(", ")}`),i.deniedDomains.length>0&&e.push(`- The following domains are explicitly blocked in the sandbox: ${i.deniedDomains.join(", ")}`)}return e}function BAi(a,i,e){let t=[`
Command Execution:
- Use && to chain simple commands on one line
- Prefer pipelines | over temporary files for data flow
- Never create a sub-shell (eg. bash -c "command") unless explicitly asked

Directory Management:
- Prefer relative paths when navigating directories, only use absolute when the path is far away or the current cwd is not expected
- By default (mode=sync), shell and cwd are reused by subsequent sync commands
- Use $PWD for current directory references
- Consider using pushd/popd for directory stack management
- Supports directory shortcuts like ~ and -

Program Execution:
- Supports Python, Node.js, and other executables
- Install packages via package managers (brew, apt, etc.)
- Use which or command -v to verify command availability

Async Mode:
- Use mode=async ONLY for processes that should keep running while you do other work (servers, watchers, dev daemons)
- For one-shot long-running commands where you have nothing to do until they finish (package installs, builds, downloads, test suites), use mode=sync with a generous timeout (e.g. 600000 / 10 min for installs, longer for big builds) so the command can complete before your turn ends
- Returns a terminal ID for checking status and runtime later

Use send_to_terminal to send commands or input to a terminal session.`];return a&&t.push(Pko(i,e).join(`
`)),t.push(`

Output Management:
- Output is automatically truncated if longer than 60KB to prevent context overflow
- Use head, tail, grep, awk to filter and limit output size
- For pager commands, disable paging: git --no-pager or add | cat
- Use wc -l to count lines before displaying large outputs

Best Practices:
- Quote variables: "$var" instead of $var to handle spaces
- Use find with -exec or xargs for file operations
- Be specific with commands to avoid excessive output
- Avoid printing credentials unless absolutely required
- NEVER run sleep or similar wait commands in a terminal. You will be automatically notified on your next turn when async terminal commands or timed-out sync commands complete or need input. Do NOT poll for completion.

Interactive Input Handling:
- When a terminal command is waiting for interactive input, do NOT suggest alternatives or ask the user whether to proceed. Instead, use the vscode_askQuestions tool to collect the needed values from the user, then send them.
- NEVER use vscode_askQuestions to request sensitive input such as passwords, passphrases, API keys, tokens, or other secrets \u2014 answers to that tool are sent through the model. If the prompt requires a secret, tell the user to type it directly into the terminal and stop; do not call vscode_askQuestions or send_to_terminal for that prompt.
- Send exactly one answer per prompt using send_to_terminal. Never send multiple answers in a single send.
- After each send, call get_terminal_output to read the next prompt before sending the next answer.
- Continue one prompt at a time until the command finishes.`),t.join("")}function mun(a,i,e){return["This tool allows you to execute shell commands in a persistent bash terminal session, preserving environment variables, working directory, and other context across multiple commands.",BAi(a,i,e),"- Use [[ ]] for conditional tests instead of [ ]","- Prefer $() over backticks for command substitution"].join(`
`)}function hun(a,i,e){return["This tool allows you to execute shell commands in a persistent zsh terminal session, preserving environment variables, working directory, and other context across multiple commands.",BAi(a,i,e),"- Use type to check command type (builtin, function, alias)","- Use jobs, fg, bg for job control","- Use [[ ]] for conditional tests instead of [ ]","- Prefer $() over backticks for command substitution","- Take advantage of zsh globbing features (**, extended globs). Note: unmatched globs fail by default (zsh: no matches found) \u2014 use a glob qualifier like *(N) or quote the glob if it should be literal","","zsh pitfalls \u2014 these WILL cause errors or hangs:","- NEVER use bare == or === as separators (e.g. echo === triggers zsh equals expansion). Quote them: echo '==='","- NEVER use status as a variable name (it is read-only in zsh). Use exit_code or ret instead"].join(`
`)}function gun(a,i,e){return["This tool allows you to execute shell commands in a persistent fish terminal session, preserving environment variables, working directory, and other context across multiple commands.",BAi(a,i,e),"- Use type to check command type (builtin, function, alias)","- Use jobs, fg, bg for job control","- Use test expressions for conditionals (no [[ ]] syntax)","- Prefer command substitution with () syntax","- Variables are arrays by default, use $var[1] for first element","- Take advantage of fish's autosuggestions and completions"].join(`
`)}async function Ako(a){let i=a.get(F),e=a.get(LP),o=a.get(B).getValue("chat.agent.sandbox.allowUnsandboxedCommands")===!0,n=i.createInstance(O0e),[r,s,l,c]=await Promise.all([n.getCopilotShell(),n.osBackend,e.isEnabled(),e.isSandboxAllowNetworkEnabled()]),u=l&&!c?e.getResolvedNetworkDomains():void 0,p;r&&s&&dI(r,s)?p=pun(r,l,o,u):r&&s&&m6(r,s)?p=hun(l,o,u):r&&s&&h0e(r,s)?p=gun(l,o,u):p=mun(l,o,u);let h={command:{type:"string",description:"The command to run in the terminal."},explanation:{type:"string",description:"A one-sentence description of what the command does. This will be shown to the user before the command is run."},goal:{type:"string",description:'A short description of the goal or purpose of the command (e.g., "Install dependencies", "Start development server").'}},g=l?{allowToRunUnsandboxedCommands:{type:"boolean",const:o,default:o,description:"Whether this tool invocation is allowed to run commands outside the terminal sandbox. This value is set by VS Code based on chat.agent.sandbox.allowUnsandboxedCommands."},requestUnsandboxedExecution:{type:"boolean",description:"Request that this command run outside the terminal sandbox. Only set this when the command clearly needs unsandboxed access. The user will be prompted before the command runs unsandboxed."},requestUnsandboxedExecutionReason:{type:"string",description:"A short explanation of why this command must run outside the terminal sandbox. Only provide this when requestUnsandboxedExecution is true."}}:{};return{id:"run_in_terminal",toolReferenceName:OAi,legacyToolReferenceFullNames:FAi,displayName:d(16539,null),modelDescription:`${p}

Execution mode:
- mode='sync': wait for completion (optionally capped by timeout); if still running when timeout elapses, return with a terminal ID.
- mode='async': wait for an initial idle/output signal, then return with terminal output snapshot and ID. Timeout caps how long to wait for the initial idle/output signal.
- Prefer mode='sync' for commands that will prompt for interactive input (e.g., npm init, interactive installers, configuration wizards).

Timeout parameter: For one-shot long-running commands, set a generous timeout as a safety net (e.g. 600000 for installs, longer for big builds). Omit timeout only for processes that should run indefinitely (servers, daemons). If the timeout elapses, you get a terminal ID and can check output later.

Terminal notifications: When an async command finishes or a sync command times out, you will be automatically notified on your next turn with the exit code and terminal output. You will also be notified if the terminal needs input. Do NOT poll or sleep to wait for completion.`,userDescription:d(16540,null),source:wn.Internal,icon:L.terminal,inputSchema:{type:"object",properties:{...h,...g,mode:{type:"string",enum:["sync","async"],enumDescriptions:["Wait for completion up to timeout, then return with collected output. If still running at timeout, the terminal session continues in the background.","Wait for an initial idle/output signal, then return with a terminal ID and output snapshot while the session may continue running."],description:"Execution mode for this command."},isBackground:{type:"boolean",description:'Legacy execution mode flag. Deprecated in favor of "mode". If true, equivalent to mode=async. If false, equivalent to mode=sync.'},timeout:{type:"number",description:"Optional hard cap in milliseconds on how long the tool tracks the command before returning. Omit to let the command run to completion (recommended for package installs, builds, and long-running scripts). Use 0 to explicitly indicate no timeout."}},required:["command","explanation","goal","mode"]}}}function fun(a){return a.allowUnsandboxedCommands&&a.didSandboxWrapCommand&&a.requestUnsandboxedExecution!==!0&&!a.isPersistentSession&&!a.isBackgroundExecution&&!a.didTimeout&&a.exitCode!==0&&AAi(a.output)}var Rko=["\x1B[I","\x1B[O"],Lko=`
`+d(16538,null),ic=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this._chatService=e;this._configurationService=t;this._fileService=o;this._historyService=n;this._instantiationService=r;this._labelService=s;this._languageModelToolsService=l;this._remoteAgentService=c;this._storageService=u;this._terminalChatService=p;this._logService=h;this._terminalService=g;this._terminalSandboxService=f;this._workspaceContextService=v;this._chatWidgetService=b;this._agentSessionsService=S;this._archivedSessionListener=this._register(new ue);this._sessionTerminalAssociations=new dt;this._sessionTerminalInstances=new dt;this._terminalsBeingDisposedBySessionCleanup=new Set;this._backgroundNotifications=this._register(new Ot);this._isShuttingDown=!1;this._register(y.onWillShutdown(()=>{this._isShuttingDown=!0})),this._osBackend=this._remoteAgentService.getEnvironment().then(w=>w?.os??Ao),this._terminalToolCreator=this._instantiationService.createInstance(l1),this._treeSitterCommandParser=this._register(this._instantiationService.createInstance(y0e)),this._telemetry=this._instantiationService.createInstance(I0e),this._commandArtifactCollector=this._instantiationService.createInstance(A0e),this._profileFetcher=this._instantiationService.createInstance(O0e),this._commandLineRewriters=[this._register(this._instantiationService.createInstance(Hqt)),this._register(this._instantiationService.createInstance(Uqt,this._treeSitterCommandParser))],this._enableCommandLineSandboxRewriting&&this._commandLineRewriters.push(this._register(this._instantiationService.createInstance(D0e,this._treeSitterCommandParser))),this._commandLineRewriters.push(this._register(this._instantiationService.createInstance(_0e))),this._commandLineRewriters.push(this._register(this._instantiationService.createInstance(T0e))),this._commandLineAnalyzers=[this._register(this._instantiationService.createInstance(k0e,this._treeSitterCommandParser,(w,x)=>this._logService.info(`RunInTerminalTool#CommandLineFileWriteAnalyzer: ${w}`,x))),this._register(this._instantiationService.createInstance(ove,this._treeSitterCommandParser,this._telemetry,(w,x)=>this._logService.info(`RunInTerminalTool#CommandLineAutoApproveAnalyzer: ${w}`,x)))],this._enableCommandLineSandboxRewriting&&this._commandLineAnalyzers.push(this._register(this._instantiationService.createInstance(E0e))),this._commandLinePresenters=[this._instantiationService.createInstance(b0e),new Eqt,new Tqt,new _qt],this._outputAnalyzers=[this._register(this._instantiationService.createInstance(N0e))],this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,w=>{(!w||w.affectsConfiguration("chat.tools.terminal.enableAutoApprove"))&&this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")!==!0&&this._storageService.remove("chat.tools.terminal.autoApprove.warningAccepted",-1)})),this._restoreTerminalAssociations(),this._register(this._terminalService.onDidDisposeInstance(w=>{this._removeTerminalAssociations(w)})),this._register(this._chatService.onDidDisposeSession(w=>{for(let x of w.sessionResources)this._cleanupSessionTerminals(x)}))}static{this._activeExecutions=new Map}static{this._killedByTool=new Set}static getBackgroundOutput(e){let t=ic._activeExecutions.get(e);if(!t)throw new Error("Invalid terminal ID");return t.getOutput()}static getExecution(e){return ic._activeExecutions.get(e)}static removeExecution(e){let t=ic._activeExecutions.get(e);return t?(t.dispose(),ic._activeExecutions.delete(e),!0):!1}static markKilledByTool(e){ic._killedByTool.add(e)}_resolveExecutionOptions(e){return(e.mode??(e.isBackground?"async":"sync"))==="async"?{mode:"async",persistentSession:!0,waitStrategy:"idle"}:{mode:"sync",persistentSession:!1,waitStrategy:"completion"}}get _allowUnsandboxedCommands(){return this._configurationService.getValue("chat.agent.sandbox.allowUnsandboxedCommands")===!0}get _autoApproveUnsandboxedCommands(){return this._allowUnsandboxedCommands&&this._configurationService.getValue("chat.agent.sandbox.autoApproveUnsandboxedCommands")===!0}get _allowSandboxAutoApprove(){return this._configurationService.getValue("chat.agent.sandbox.allowAutoApprove")===!0}_getAllowToRunUnsandboxedCommands(e){return(e.allowToRunUnsandboxedCommands??this._allowUnsandboxedCommands)===!0&&this._allowUnsandboxedCommands}_shouldRejectUnsandboxedExecutionRequest(e,t,o){return e&&o.requestUnsandboxedExecution===!0&&!t}_getUnsandboxedExecutionDisabledMessage(){return d(16529,null)}get _enableCommandLineSandboxRewriting(){return!0}async handleToolStream(e,t){let o=e.rawInput;if(o&&typeof o=="object"&&o.command){let n=ane(o.command);return{invocationMessage:new he(d(16518,null,Ru(n)))}}return{invocationMessage:d(16519,null)}}async prepareToolInvocation(e,t){let o=e.parameters,n=this._resolveExecutionOptions(o),r=e.chatSessionResource,s;if(r){let Cn=this._sessionTerminalAssociations.get(r);Cn&&!Cn.isBackground&&(s=Cn.instance)}let[l,c,u,p]=await Promise.all([this._osBackend,this._profileFetcher.getCopilotShell(),(async()=>{let Cn=await s?.getCwdResource();if(!Cn){let xa=r?this._chatService.getSession(r):void 0;if(xa?.workingDirectory)Cn=xa.workingDirectory;else{let Os=this._historyService.getLastActiveWorkspaceRoot();Cn=(Os?this._workspaceContextService.getWorkspaceFolder(Os)??void 0:void 0)?.uri}}return Cn})(),this._terminalSandboxService.checkForSandboxingPrereqs()]),h=l===1?"pwsh":"sh",g=p.enabled,f=this._getAllowToRunUnsandboxedCommands(o),v=g&&f&&o.requestUnsandboxedExecution===!0,b=v,S=v?o.requestUnsandboxedExecutionReason:void 0,y=p.failedCheck==="dependencies"&&p.missingDependencies?.length?p.missingDependencies:void 0,w=ht(),x=`tool-${ht()}`;if(this._shouldRejectUnsandboxedExecutionRequest(g,f,o)){let Cn=tve(o.command);return{invocationMessage:new he(d(16528,null,Ru(ane(Cn)))),icon:L.error,confirmationMessages:void 0,toolSpecificData:{kind:"terminal",terminalToolSessionId:w,terminalCommandId:x,commandLine:{original:o.command,forDisplay:Cn},cwd:u,language:h,isBackground:n.persistentSession,requestUnsandboxedExecution:!1,requestUnsandboxedExecutionReason:void 0}}}let E=await this._rewriteCommandLine(o.command,{cwd:u,shell:c,os:l,isBackground:n.persistentSession,requestUnsandboxedExecution:f?b:!1,requestUnsandboxedExecutionReason:S}),M=E.rewrittenCommand,N=E.forDisplayCommand,V=E.isSandboxWrapped;b=E.requiresUnsandboxConfirmation,S=E.requestUnsandboxedExecutionReason;let H=E.blockedDomains,K={kind:"terminal",terminalToolSessionId:w,terminalCommandId:x,commandLine:{original:o.command,toolEdited:M===o.command?void 0:M,forDisplay:N??tve(M??o.command),isSandboxWrapped:V},cwd:u,language:h,isBackground:n.persistentSession,requestUnsandboxedExecution:b,requestUnsandboxedExecutionReason:S,missingSandboxDependencies:y},j;if(y){let Cn=y.join(", ");j={title:d(16505,null),message:new he(d(16504,null,Cn)),customOptions:[{id:"install",label:d(16503,null),kind:"approve"},{id:"cancel",label:d(16500,null),kind:"deny"}]}}let J=Gxo(o.command,this._languageModelToolsService);if(J)return K.alternativeRecommendation=J,{confirmationMessages:void 0,presentation:"hidden",toolSpecificData:K};let se=N??M??o.command,ae=()=>NAi(OAi,this._configurationService,FAi),ce=this._configurationService.getValue("chat.tools.terminal.enableAutoApprove")===!0,Se=_ko(OAi,this._configurationService,this._storageService,FAi),Re={commandLine:se,cwd:u,os:l,shell:c,treeSitterLanguage:dI(c,l)?"powershell":"bash",terminalToolSessionId:w,chatSessionResource:r,requiresUnsandboxConfirmation:b,hasSessionAutoApproval:!!r&&this._terminalChatService.hasChatSessionAutoApproval(r)},xe=r&&sve(r,this._configurationService,this._chatWidgetService,this._chatService),He=xe?this._commandLineAnalyzers.filter(Cn=>!(Cn instanceof ove)):this._commandLineAnalyzers,Ee=await Promise.all(He.map(Cn=>Cn.analyze(Re))),Te=Ee.map(Cn=>Cn.disclaimers).filter(Cn=>!!Cn).flatMap(Cn=>Cn),It;if(Te.length>0){let Cn=Te.map(rl=>typeof rl=="string"?rl:rl.value),Os=Te.some(rl=>typeof rl!="string")?{supportThemeIcons:!0,isTrusted:{enabledCommands:["workbench.action.terminal.chat.openTerminalSettingsLink"]}}:{supportThemeIcons:!0};It=new he(`$(${L.info.id}) `+Cn.join(" "),Os)}let tt=Ee.every(Cn=>Cn.isAutoApproveAllowed),Oi=ae()&&tt?Ee.map(Cn=>Cn.customActions??[]).flat():void 0,zt=Jo(c,".exe");zt==="powershell"&&(zt="pwsh");let mo=Ee.some(Cn=>Cn.isAutoApproved)&&Ee.every(Cn=>Cn.isAutoApproved!==!1)&&tt,dn=Se&&mo,No=g&&b===!0&&this._autoApproveUnsandboxedCommands,_i=g&&K.commandLine.isSandboxWrapped===!0&&this._allowSandboxAutoApprove,ln=No||_i||dn||Ee.some(Cn=>Cn.forceAutoApproval);(ln||ce&&Ee.some(Cn=>Cn.autoApproveInfo))&&(K.autoApproveInfo=Ee.find(Cn=>Cn.autoApproveInfo)?.autoApproveInfo);let Tn=(K.commandLine.forDisplay??K.commandLine.userEdited??K.commandLine.toolEdited??K.commandLine.original).trimStart(),Ko=kqt(Tn,c,l),Bn;if(Ko&&u){let xa=(l===1?Gs.isAbsolute(Ko.directory):Vo.isAbsolute(Ko.directory))?A.from({scheme:u.scheme,authority:u.authority,path:Ko.directory}):A.joinPath(u,Ko.directory),Os=this._labelService.getUriLabel(xa),rl=Tn.substring(0,Tn.length-Ko.command.length);K.confirmation={commandLine:Ko.command,cwdLabel:Os,cdPrefix:rl},Bn=d(16497,null,zt,Os)}else K.confirmation={commandLine:Tn},Bn=d(16493,null,zt);let va=Ko?.command??Tn;for(let Cn of this._commandLinePresenters){let xa=await Cn.present({commandLine:{original:o.command,forDisplay:va},shell:c,os:l});if(xa){if(K.presentationOverrides={commandLine:xa.commandLine,language:xa.language??void 0},Ko&&K.confirmation?.cwdLabel?xa.languageDisplayName?Bn=d(16508,null,xa.languageDisplayName,zt,K.confirmation.cwdLabel):Bn=d(16509,null,zt,K.confirmation.cwdLabel):xa.languageDisplayName?Bn=d(16507,null,xa.languageDisplayName,zt):Bn=d(16510,null,zt),!xa.processOtherPresenters)break;va=xa.commandLine}}b&&(Bn=H?.length?d(16530,null,zt,Dko,this._formatBlockedDomainsForTitle(H)):d(16520,null,zt,Dko));let $s=!ln&&!xe||e.forceConfirmationReason!==void 0,_l=o.explanation||d(16495,null),mc=o.goal||d(16496,null),su=b?new he(d(16526,null,_l,mc,S||d(16527,null))):new he(d(16494,null,_l,mc)),yu=$s?{title:Bn,message:su,disclaimer:It,allowAutoConfirm:void 0,terminalCustomActions:Oi}:void 0,sr=K.commandLine.forDisplay??K.commandLine.toolEdited??K.commandLine.original,Lo=sr.length>80?sr.substring(0,77)+"...":sr;return{invocationMessage:K.commandLine.isSandboxWrapped?new he(d(16499,null,Ru(Lo))):new he(d(16498,null,Ru(Lo))),icon:K.commandLine.isSandboxWrapped?L.terminalSecure:L.terminal,confirmationMessages:j??yu,toolSpecificData:K}}_formatBlockedDomainsForTitle(e){return e.length===1?`\`${e[0]}\``:d(16537,null,e[0],e.length-1)}_getBlockedDomainReason(e,t=[]){return t.length===e.length&&t.length>0?e.length===1?d(16532,null,e[0]):d(16531,null,e[0],e.length-1):t.length>0?e.length===1?d(16534,null,e[0]):d(16533,null,e[0],e.length-1):e.length===1?d(16536,null,e[0]):d(16535,null,e[0],e.length-1)}async _rewriteCommandLine(e,t){let o=e,n,r=!1,s=t.requestUnsandboxedExecution,l=t.requestUnsandboxedExecution?t.requestUnsandboxedExecutionReason:void 0,c;for(let u of this._commandLineRewriters){let p=await u.rewrite({commandLine:o,cwd:t.cwd,shell:t.shell,os:t.os,isBackground:t.isBackground,requestUnsandboxedExecution:s});p&&(o=p.rewritten,n=n??p.forDisplay,p.isSandboxWrapped?r=!0:p.isSandboxWrapped===!1&&(r=!1),p.requiresUnsandboxConfirmation&&(s=!0),p.blockedDomains?.length&&(c=p.blockedDomains,l=this._getBlockedDomainReason(p.blockedDomains,p.deniedDomains)),this._logService.info(`RunInTerminalTool: Command rewritten by ${u.constructor.name}: ${p.reasoning}`))}return{rewrittenCommand:o,forDisplayCommand:n,isSandboxWrapped:r,requiresUnsandboxConfirmation:s,requestUnsandboxedExecutionReason:l,blockedDomains:c}}async _confirmAutomaticUnsandboxRetry(e,t,o,n,r,s){if(this._autoApproveUnsandboxedCommands)return!0;let l=e&&this._chatService.getSession(e);if(!(l instanceof ty))return!1;if(e&&sve(e,this._configurationService,this._chatWidgetService,this._chatService))return!0;let c=l.getRequests().at(-1);if(!c)return!1;let u=Jo(o,".exe");u==="powershell"&&(u="pwsh");let p=new O;return new Promise(h=>{let g=!1,f=b=>{g||(g=!0,p.dispose(),h(b))},v=new gV(this._getAutomaticUnsandboxRetryTitle(u,n),new he(d(16522,null,Ru(ane(t)))),"",d(16492,null),d(16541,null),async()=>(f(!0),v.hide(),"accepted"),async()=>(f(!1),v.hide(),"rejected"),void 0,void 0,()=>f(!1),r);l.acceptResponseProgress(c,v),p.add(s.onCancellationRequested(()=>f(!1))),p.add({dispose:()=>v.hide()})})}_getAutomaticUnsandboxRetryTitle(e,t){return t?.length?new he(d(16523,null,e,this._formatBlockedDomainsForTitle(t))):new he(d(16521,null,e))}_registerSensitiveInputElicitation(e,t,o,n,r){let s=new O,l,c=!1;return s.add(o.onDidDetectSensitiveInputNeeded(()=>{if(l||c)return;let u=e&&sve(e,this._configurationService,this._chatWidgetService,this._chatService),p=e&&this._chatService.getSession(e);if(u){if(c=!0,p instanceof ty){let f=p.getRequests().at(-1);if(f){let v=new gV(new he(d(16512,null)),new he(d(16511,null)),"",d(16514,null),"",async()=>(v.hide(),"accepted"),async()=>(v.hide(),"rejected"),void 0,void 0,void 0,void 0);p.acceptResponseProgress(f,v)}}r?.(),n();return}if(!(p instanceof ty)){this._terminalService.setActiveInstance(t),this._terminalService.revealTerminal(t,!0).catch(()=>{}),t.focus();return}let h=p.getRequests().at(-1);if(!h)return;let g=new gV(new he(d(16517,null)),new he(d(16516,null)),"",d(16515,null),d(16513,null),async()=>{l=void 0,g.hide();try{this._terminalService.setActiveInstance(t),await this._terminalService.revealTerminal(t,!0),t.focus()}catch(f){this._logService.warn("RunInTerminalTool: failed to reveal terminal for sensitive input",f)}return"accepted"},async()=>(l=void 0,g.hide(),n(),"rejected"),void 0,void 0,()=>{l=void 0},void 0);l=g,p.acceptResponseProgress(h,g)})),s}_acceptAutomaticUnsandboxRetryToolInvocationUpdate(e,t,o,n,r){let s=e&&this._chatService.getSession(e);if(!(s instanceof ty))return;let l=s.getRequests().at(-1);if(!l)return;let c=ane(o.commandLine.forDisplay??o.commandLine.toolEdited??o.commandLine.original),u={kind:"externalToolInvocationUpdate",toolCallId:t,toolName:d(16539,null),isComplete:n,invocationMessage:new he(d(16524,null,Ru(c))),pastTenseMessage:r,toolSpecificData:o};s.acceptResponseProgress(l,u)}async invoke(e,t,o,n){let r=e.toolSpecificData;if(!r)throw new Error("toolSpecificData must be provided for this tool");if(!e.context)throw new Error("Invocation context must be provided for this tool");let s=r.terminalCommandId;if(r.alternativeRecommendation)return{content:[{kind:"text",value:r.alternativeRecommendation}]};let l=e.parameters,c=this._getAllowToRunUnsandboxedCommands(l),u=await this._terminalSandboxService.isEnabled();if(this._shouldRejectUnsandboxedExecutionRequest(u,c,l)){let sr=this._getUnsandboxedExecutionDisabledMessage();return{toolResultError:sr,toolResultDetails:{input:l.command,output:[{type:"embed",isText:!0,value:sr}],isError:!0},content:[{kind:"text",value:sr}]}}if(r.missingSandboxDependencies?.length)if(e.selectedCustomButton==="install"){let sr=e.context.sessionResource,{exitCode:Lo}=await this._terminalSandboxService.installMissingSandboxDependencies(r.missingSandboxDependencies,sr,n,{createTerminal:async()=>this._terminalService.createTerminal({}),focusTerminal:async kc=>{this._terminalService.setActiveInstance(kc),await this._terminalService.revealTerminal(kc,!0),kc.focus()}});if(Lo!==void 0&&Lo!==0)return{content:[{kind:"text",value:d(16502,null,Lo)}]};if(Lo===void 0)return{content:[{kind:"text",value:d(16506,null)}]};this._logService.info("RunInTerminalTool: Sandbox dependency installation succeeded, proceeding with command execution")}else return this._logService.info("RunInTerminalTool: User cancelled sandbox dependency installation"),{content:[{kind:"text",value:d(16501,null)}]};let p=this._resolveExecutionOptions(l);this._logService.debug(`RunInTerminalTool: Invoking with options ${JSON.stringify(l)}`);let h;if(l.timeout!==void 0&&(Number.isNaN(l.timeout)||l.timeout<0))return{content:[{kind:"text",value:"Error: timeout must be a non-negative number of milliseconds (use 0 for no timeout)."}]};p.mode==="sync"&&l.timeout===void 0&&(l.timeout=0);let g=e.context.sessionResource,f=!e.subAgentInvocationId,v=r.commandLine.userEdited??r.commandLine.toolEdited??r.commandLine.original,b=r.commandLine.userEdited!==void 0&&r.commandLine.userEdited!==r.commandLine.original,S=!b&&r.commandLine.toolEdited!==void 0&&r.commandLine.toolEdited!==r.commandLine.original&&tve(r.commandLine.toolEdited).trim()!==tve(r.commandLine.original).trim(),y=r.commandLine.isSandboxWrapped===!0,w=u?r.commandLine.forDisplay??r.commandLine.original:void 0;if(n.isCancellationRequested)throw new qi;let x,E=d(16525,null),M=!p.persistentSession&&!this._sessionTerminalAssociations.has(g),N=Date.now(),V=ht(),H=r.terminalToolSessionId,K=new O;this._logService.debug(`RunInTerminalTool: Creating ${p.persistentSession?"background":"foreground"} terminal. termId=${V}, chatSessionResource=${g}`);let j=await this._initTerminal(g,V,H,p.persistentSession,n);this._handleTerminalVisibility(j,g);let J=Date.now()-N,se=await j.instance.xtermReadyPromise;if(!se)throw new Error("Instance was disposed before xterm.js was ready");let ae=j.instance.capabilities.get(2),ce=0,Se=!1;K.add(se.raw.onData(sr=>{Rko.includes(sr)||(ce+=sr.length),Se||=sr===""}));let Re="",xe=-1,He,Ee,Te=!1,It=!1,tt=!1,Oi=!1,zt=p.persistentSession,mo,dn,No,_i,ln=K.add(new qe(n)),Tn=l.timeout!==void 0?jn(l.timeout,0,Number.MAX_SAFE_INTEGER):void 0;Tn!==void 0&&Tn>0&&(p.waitStrategy==="idle"||this._configurationService.getValue("chat.tools.terminal.enforceTimeoutFromModel")===!0)&&(mo=Li(Tn),dn=mo.then(()=>({type:"timeout"})).catch(()=>({type:"timeout"})));let Ko,Bn=new Promise(sr=>{Ko=sr});H&&K.add(this._terminalChatService.onDidContinueInBackground(sr=>{sr===H&&(ic._activeExecutions.get(V)?.setBackground?.(),zt=!0,Ko?.())}));let Mr;try{let sr=this._instantiationService.createInstance(Rst,g,V,j,ae,p.persistentSession);this._logService.info(`RunInTerminalTool: Using \`${sr.strategy.type}\` execute strategy for command \`${v}\``),K.add(sr),ic._activeExecutions.set(V,sr);let Lo=U.toPromise(sr.strategy.onDidCreateStartMarker),kc=p.persistentSession?async Cn=>({output:Cn.getOutput(),state:"Idle"}):void 0;if(K.add(sr.strategy.onDidCreateStartMarker(Cn=>{No||(No=this._instantiationService.createInstance(cne,{instance:j.instance,sessionResource:g,getOutput:xa=>sr.getOutput(xa??Cn)},kc,e.context,n,v))})),Mr=sr.start(v,ln.token,s,w),p.waitStrategy==="idle"){this._logService.debug(`RunInTerminalTool: Starting persistent execution with idle wait strategy \`${v}\``),await Lo;let Cn=!1;if(No&&(dn?(await Promise.race([U.toPromise(No.onDidFinishCommand).then(()=>({type:"idle"})),dn])).type==="timeout"?(Cn=!0,this._logService.debug("RunInTerminalTool: Timeout reached waiting for idle signal, returning output collected so far")):_i=No.pollingResult:(await U.toPromise(No.onDidFinishCommand),_i=No.pollingResult)),await this._commandArtifactCollector.capture(r,j.instance,s),n.isCancellationRequested)throw new qi;let xa=r.terminalCommandState??{};xa.timestamp=xa.timestamp??N,r.terminalCommandState=xa;let Os=y?`Command is now running in terminal with ID=${V}`:b?`Note: The user manually edited the command to \`${v}\`, and that command is now running in terminal with ID=${V}`:S?`Note: The tool simplified the command to \`${v}\`, and that command is now running in terminal with ID=${V}`:`Command is running in terminal with ID=${V}`,rl=_i?.output??(Cn?sr.getOutput():void 0),js=rl?await this._getOutputAnalyzerMessage(void 0,rl,v,y):void 0;Cn?(Os+=`
 Timed out waiting for the command to become idle. The command is still running, with output:
`,js&&(Os+=`${js}
`),Os+=rl??""):_i&&_i.state==="Idle"?(Os+=`
 The command became idle with output:
`,js&&(Os+=`${js}
`),Os+=_i.output,Os+=`
${this._buildInputNeededSteeringText(g,V,"none")}`):_i&&(Os+=`
 The command is still running, with output:
`,js&&(Os+=`${js}
`),Os+=_i.output);let Fh=await j.instance.getCwdResource();return{toolMetadata:{exitCode:void 0,id:V,terminalId:j.instance.instanceId,cwd:Fh?.toString()},content:[{kind:"text",value:Os}]}}else{let Cn=new O;Lo.then(()=>{No&&!Cn.isDisposed&&Cn.add(this._registerSensitiveInputElicitation(g,j.instance,No,()=>ln.cancel(),()=>{Oi=!0}))});let xa=[Mr.then(js=>({type:"completed",result:js})),Bn.then(()=>({type:"background"})),new Promise(js=>{Lo.then(()=>{No&&!Cn.isDisposed&&Cn.add(No.onDidDetectInputNeeded(()=>js({type:"inputNeeded"})))})})];dn&&xa.push(dn);let Os=this._configurationService.getValue("chat.tools.terminal.idleSilenceTimeoutMs")??6e4;if(Os>0){let js=new Mo,Fh=Cn.add(new Dt(()=>js.complete({type:"idleSilence"}),Os));Cn.add(j.instance.onData(()=>Fh.schedule())),Fh.schedule(),xa.push(js.p)}let rl;try{rl=await Promise.race(xa)}finally{Cn.dispose()}if(rl.type==="inputNeeded"){this._logService.debug("RunInTerminalTool: Output monitor detected input needed in foreground terminal, returning output to agent"),x="inputNeeded",tt=!0;let js=sr.getOutput();xe=js?rT(js.trim(),`
`)+1:0,Re=js??""}else if(rl.type==="background"){this._logService.debug("RunInTerminalTool: Continue in background triggered, returning output collected so far"),x="continueInBackground";let js=sr.getOutput();xe=js?rT(js.trim(),`
`)+1:0,Re=js}else if(rl.type==="timeout"){this._logService.debug("RunInTerminalTool: Timeout reached, returning output collected so far"),x="timeout",Te=!0,zt=!0,j.isBackground=!0,r.didContinueInBackground=!0,this._sessionTerminalAssociations.delete(g),await this._associateProcessIdWithSession(j.instance,g,V,j.shellIntegrationQuality,!0);let js=sr.getOutput();xe=js?rT(js.trim(),`
`)+1:0,Re=js??""}else if(rl.type==="idleSilence"){this._logService.debug(`RunInTerminalTool: Idle silence reached (${Os}ms), promoting to background`),x="idleSilence",It=!0,zt=!0,j.isBackground=!0,r.didContinueInBackground=!0,this._sessionTerminalAssociations.delete(g),await this._associateProcessIdWithSession(j.instance,g,V,j.shellIntegrationQuality,!0);let js=sr.getOutput();xe=js?rT(js.trim(),`
`)+1:0,Re=js??""}else{let js=rl.result;if(j.receivedUserInput=!1,n.isCancellationRequested)throw new qi;if(js.didEnterAltBuffer){let Fh=r.terminalCommandState??{};Fh.timestamp=Fh.timestamp??N,r.terminalCommandState=Fh,h=Lko,xe=0,x=js.error??"alternateBuffer";let Cm=await j.instance.getCwdResource();Ee={toolResultMessage:h,toolMetadata:{exitCode:void 0,id:V,terminalId:j.instance.instanceId,cwd:Cm?.toString()},content:[{kind:"text",value:Lko}]}}else{await this._commandArtifactCollector.capture(r,j.instance,s);{let Cm=r.terminalCommandState??{};Cm.timestamp=Cm.timestamp??N,js.exitCode!==void 0&&(Cm.exitCode=js.exitCode,Cm.timestamp!==void 0&&(Cm.duration=Cm.duration??Math.max(0,Date.now()-Cm.timestamp))),r.terminalCommandState=Cm}this._logService.info(`RunInTerminalTool: Finished \`${sr.strategy.type}\` execute strategy with exitCode \`${js.exitCode}\`, result.length \`${js.output?.length}\`, error \`${js.error}\``),xe=js.output===void 0?0:rT(js.output.trim(),`
`)+1,He=js.exitCode,x=js.error;let Fh=[];js.output!==void 0&&Fh.push(js.output),js.additionalInformation&&Fh.push(js.additionalInformation),Re=Fh.join(`

`)}}}}catch(sr){if(Te&&sr instanceof qi){this._logService.debug("RunInTerminalTool: Timeout reached, returning output collected so far"),x="timeout",zt=!0,j.isBackground=!0,r.didContinueInBackground=!0,this._sessionTerminalAssociations.delete(g);let Lo=h6(j.instance,void 0);xe=Lo?rT(Lo.trim(),`
`)+1:0,Re=Lo??""}else{if(this._logService.debug("RunInTerminalTool: Threw exception"),sr instanceof qi){await this._commandArtifactCollector.capture(r,j.instance,s);let Lo=r.terminalCommandState??{};Lo.exitCode===void 0&&(Lo.exitCode=-1,Lo.timestamp=Lo.timestamp??N,Lo.duration=Lo.duration??Math.max(0,Date.now()-Lo.timestamp)),r.terminalCommandState=Lo}throw ic._activeExecutions.get(V)?.dispose(),ic._activeExecutions.delete(V),j.instance.dispose(),x=sr instanceof qi?"canceled":"unexpectedException",sr}}finally{if(mo?.cancel(),(zt||tt)&&Mr)if(Mr.catch(Lo=>{Lo instanceof qi||this._logService.error("RunInTerminalTool: Background execution error",Lo)}),f){let Lo=tt?Re:void 0;this._registerCompletionNotification(j.instance,V,g,v,r,No,Lo)}else No?.dispose();else ic._activeExecutions.get(V)?.dispose(),ic._activeExecutions.delete(V),No?.dispose();K.dispose();let sr=Date.now()-N;this._telemetry.logInvoke(j.instance,{terminalToolSessionId:r.terminalToolSessionId,didUserEditCommand:b,didToolEditCommand:S,isBackground:p.persistentSession,isSandboxWrapped:r.commandLine.isSandboxWrapped===!0,requestUnsandboxedExecutionReason:l.requestUnsandboxedExecutionReason,shellIntegrationQuality:j.shellIntegrationQuality,error:x,isNewSession:M,outputLineCount:xe,exitCode:He,timingExecuteMs:sr,timingConnectMs:J,inputUserChars:ce,inputUserSigint:Se,terminalExecutionIdleBeforeTimeout:_i?.state==="Idle",pollDurationMs:_i?.pollDurationMs,inputToolManualAcceptCount:No?.outputMonitorTelemetryCounters?.inputToolManualAcceptCount,inputToolManualRejectCount:No?.outputMonitorTelemetryCounters?.inputToolManualRejectCount,inputToolManualChars:No?.outputMonitorTelemetryCounters?.inputToolManualChars,inputToolAutoAcceptCount:No?.outputMonitorTelemetryCounters?.inputToolAutoAcceptCount,inputToolAutoChars:No?.outputMonitorTelemetryCounters?.inputToolAutoChars,inputToolManualShownCount:No?.outputMonitorTelemetryCounters?.inputToolManualShownCount,inputToolFreeFormInputCount:No?.outputMonitorTelemetryCounters?.inputToolFreeFormInputCount,inputToolFreeFormInputShownCount:No?.outputMonitorTelemetryCounters?.inputToolFreeFormInputShownCount})}if(Ee)return Ee;if(fun({allowUnsandboxedCommands:c,didSandboxWrapCommand:y,requestUnsandboxedExecution:l.requestUnsandboxedExecution===!0,isPersistentSession:p.persistentSession,isBackgroundExecution:zt||tt,didTimeout:Te,exitCode:He,output:Re})){let sr=c,[Lo,kc]=await Promise.all([this._osBackend,this._profileFetcher.getCopilotShell()]),Cn=E,xa=await this._rewriteCommandLine(l.command,{cwd:r.cwd?A.revive(r.cwd):void 0,shell:kc,os:Lo,isBackground:p.persistentSession,requestUnsandboxedExecution:sr,requestUnsandboxedExecutionReason:Cn}),Os=xa.requestUnsandboxedExecutionReason??Cn,rl=r.presentationOverrides?.commandLine??v,js={toolId:"run_in_terminal",parameters:{...l,command:xa.rewrittenCommand,allowToRunUnsandboxedCommands:c,requestUnsandboxedExecution:sr}};if(await this._confirmAutomaticUnsandboxRetry(e.context.sessionResource,rl,kc,xa.blockedDomains,js,n)){let Cm={...r,terminalCommandId:`tool-${ht()}`,commandLine:{original:l.command,toolEdited:xa.rewrittenCommand===l.command?void 0:xa.rewrittenCommand,forDisplay:xa.forDisplayCommand??tve(xa.rewrittenCommand??l.command),isSandboxWrapped:xa.isSandboxWrapped},requestUnsandboxedExecution:sr,requestUnsandboxedExecutionReason:Os,terminalCommandUri:void 0,terminalCommandOutput:void 0,terminalTheme:void 0,terminalCommandState:void 0,didContinueInBackground:void 0},TS=`automatic-unsandbox-retry-${ht()}`;return this._acceptAutomaticUnsandboxRetryToolInvocationUpdate(e.context.sessionResource,TS,Cm,!1),await this.invoke({...e,parameters:{...l,command:l.command,allowToRunUnsandboxedCommands:c,requestUnsandboxedExecution:sr,requestUnsandboxedExecutionReason:Os},toolSpecificData:Cm},t,o,n)}}this._terminalToolCreator.refreshShellIntegrationQuality(j),this._logService.info(`RunInTerminalTool: shellIntegrationQuality=${j.shellIntegrationQuality} at banner decision time`),!h&&j.shellIntegrationQuality==="none"&&(h="$(info) Enable [shell integration](https://code.visualstudio.com/docs/terminal/shell-integration) to improve command detection");let $s=[];if(!y){if(b)$s.push(`Note: The user manually edited the command to \`${v}\` (terminal ID=${V}), and this is the output of running that command instead:
`);else if(S){let Lo=/(^|\s)nohup\s|Start-Process\b/.test(v)?' Note that stdin is closed for detached background processes; do not try to send input via send_to_terminal \u2014 re-run with mode="sync" instead if interactive input is required.':"";$s.push(`Note: The tool simplified the command to \`${v}\` (terminal ID=${V}).${Lo} This is the output of running that command instead:
`)}zt&&!p.persistentSession&&$s.push(`Note: This terminal execution was moved to the background using the ID ${V}
`)}if(Oi)$s.push(`Note: The command in terminal ID ${V} was prompting for a password, passphrase, or other secret. The user is unavailable (auto-approve / autopilot mode is on, so no human can focus the terminal to type a secret) and the command has been cancelled. Stop, do NOT retry the command, do NOT call send_to_terminal, and do NOT call vscode_askQuestions for the secret. Tell the user to run the command interactively when they are available.

`);else if(tt)$s.push(`Note: The command is running in terminal ID ${V} and may be waiting for input.
${this._buildInputNeededSteeringText(g,V,"none")}

`);else if(Te&&Tn!==void 0&&Tn>0){let sr=f?" You will be automatically notified on your next turn when it completes.":"";$s.push(`Note: Command timed out after ${Tn}ms. The command may still be running in terminal ID ${V}.${sr}
${this._buildInputNeededSteeringText(g,V,"timeout")}

`)}else if(It){let sr=f?" You will be automatically notified on your next turn when it completes.":"";$s.push(`Note: The command produced no new output for an extended period and was moved to background terminal ID ${V}; the process is still running and has not been killed.${sr}
${this._buildInputNeededSteeringText(g,V,"idleSilence")}

`)}let _l=await this._getOutputAnalyzerMessage(He,Re,v,y);_l&&$s.push(`${_l}
`),$s.push(Re);let mc=He!==void 0&&He!==0,su=await j.instance.getCwdResource(),yu=await this._extractImagesFromOutput(Re,su);return{toolResultMessage:h,toolMetadata:{exitCode:He,id:V,terminalId:j.instance.instanceId,cwd:su?.toString(),timedOut:Te||void 0,timeoutMs:Te?Tn:void 0,inputNeeded:tt||void 0},toolResultDetails:mc?{input:v,output:[{type:"embed",isText:!0,value:Re}],isError:!0}:void 0,content:[{kind:"text",value:$s.join("")},...yu]}}_buildInputNeededSteeringText(e,t,o){let n=sve(e,this._configurationService,this._chatWidgetService,this._chatService),r=[];return r.push("This note is not a signal to end the turn \u2014 pick one of the actions below and continue."),n?(r.push(`  1. If the output clearly ends with a non-secret input prompt (Continue? (y/n), Enter selection, etc. \u2014 a normal shell prompt like \`$\` or \`#\` does NOT count), determine the answer and immediately call send_to_terminal with id="${t}" (which returns the next few lines of output). Repeat one prompt at a time. Never guess passwords, passphrases, tokens, or other secrets \u2014 if the prompt requires a secret you do not have, inform the user and stop.`),r.push(`  2. If the command may still be producing output or the shell prompt has not returned, call get_terminal_output with id="${t}" to continue polling.`)):(r.push(`  1. If the command may still be producing output or the shell prompt has not returned, call get_terminal_output with id="${t}" to continue polling. This is the default and safest action when unsure.`),r.push(`  2. Only if the output clearly ends with a real non-secret input prompt (Continue? (y/n), Enter selection, etc. \u2014 a normal shell prompt like \`$\` or \`#\` does NOT count), call the vscode_askQuestions tool to ask the user, then send each answer using send_to_terminal with id="${t}" (which returns the next few lines of output). Repeat one prompt at a time. NEVER route secret prompts (passwords, passphrases, tokens, API keys, etc.) through vscode_askQuestions \u2014 answers to that tool are sent through the model. For secret prompts, tell the user to type the value directly into the terminal and stop.`)),o==="timeout"?r.push(`  3. A timeout does not mean the command failed \u2014 call get_terminal_output with id="${t}" to continue polling. Only call kill_terminal if the command is genuinely hung and you need to retry with a different approach.`):o==="idleSilence"&&r.push(`  3. Producing no output for an extended period does not mean the command failed \u2014 call get_terminal_output with id="${t}" to continue polling. Only call kill_terminal if the command is genuinely hung and you need to retry with a different approach.`),r.join(`
`)}async _getOutputAnalyzerMessage(e,t,o,n){for(let r of this._outputAnalyzers){let s=await r.analyze({exitCode:e,exitResult:t,commandLine:o,isSandboxWrapped:n});if(s)return s}}static{this._maxImageFileSize=5*1024*1024}async _extractImagesFromOutput(e,t){let o=/[^\s/\\]*(?:[/\\][^\s/\\]*)+\.(?:png|jpe?g|gif|webp|bmp)/gi,n=new Set;for(let s of e.split(/\r?\n/))if(!(s.length>1e4))for(let l of s.matchAll(o))n.add(l[0]);if(n.size===0)return[];let r=[];for(let s of n)try{let l=Py(s);if(!l||!l.startsWith("image/"))continue;let c;if(/^\/|^[A-Za-z]:[\\\/]/.test(s))c=A.file(s);else if(t)c=A.joinPath(t,s);else continue;let u=await this._fileService.stat(c).catch(()=>{});if(!u||u.isDirectory||u.size>ic._maxImageFileSize)continue;let p=await this._fileService.readFile(c);r.push({kind:"data",value:{mimeType:l,data:p.value},audience:[1]})}catch{}return r}_handleTerminalVisibility(e,t){let o=!!this._chatWidgetService.getWidgetBySessionResource(t);this._configurationService.getValue("chat.tools.terminal.outputLocation")==="terminal"&&o&&(this._terminalService.setActiveInstance(e.instance),this._terminalService.revealTerminal(e.instance,!0))}async _initTerminal(e,t,o,n,r){if(!n){let u=this._sessionTerminalAssociations.get(e);if(u&&!u.isBackground&&!u.instance.isDisposed)if(u.instance.exitCode!==void 0)this._logService.info(`RunInTerminalTool: Cached terminal shell has exited (code=${u.instance.exitCode}), creating a new terminal`),this._sessionTerminalAssociations.delete(e);else return this._logService.debug(`RunInTerminalTool: Using cached terminal with session resource \`${e}\``),this._terminalToolCreator.refreshShellIntegrationQuality(u),this._terminalChatService.registerTerminalInstanceWithToolSession(o,u.instance),this._backgroundNotifications.deleteAndDispose(u.instance.instanceId),u}this._logService.debug(`RunInTerminalTool: Creating ${n?"background":"foreground"} terminal with ID=${t}`);let s=await this._profileFetcher.getCopilotProfile(),l=await this._osBackend,c=await this._terminalToolCreator.createTerminal(s,l,r);if(c.isBackground=n,this._terminalChatService.registerTerminalInstanceWithToolSession(o,c.instance),this._terminalChatService.registerTerminalInstanceWithChatSession(e,c.instance),this._registerInputListener(c),this._addSessionTerminalAssociation(e,c),r.isCancellationRequested)throw c.instance.dispose(),new qi;return await this._setupProcessIdAssociation(c,e,t,n),c}_registerInputListener(e){let t=e.instance.onData(o=>{Rko.includes(o)||(e.receivedUserInput=o.length>0)});U.once(e.instance.onDisposed)(()=>t.dispose())}_restoreTerminalAssociations(){let e=this._storageService.get("chat.terminalSessions",1,"{}");try{let t=JSON.parse(e);for(let o of this._terminalService.instances)if(o.processId){let n=t[o.processId];if(n){let r=Br.forSession(n.sessionId);this._logService.debug(`RunInTerminalTool: Restored terminal association for PID ${o.processId}, session ${n.sessionId}`);let s={instance:o,shellIntegrationQuality:n.shellIntegrationQuality,isBackground:n.isBackground};this._addSessionTerminalAssociation(r,s),this._terminalChatService.registerTerminalInstanceWithChatSession(r,o),n.id&&ic._activeExecutions.set(n.id,this._register(new WAi(o))),U.once(o.onDisposed)(()=>{this._removeProcessIdAssociation(o.processId),this._removeExecutionAssociations(o)})}}}catch(t){this._logService.debug(`RunInTerminalTool: Failed to restore terminal associations: ${t}`)}}async _setupProcessIdAssociation(e,t,o,n){await this._associateProcessIdWithSession(e.instance,t,o,e.shellIntegrationQuality,n),U.once(e.instance.onDisposed)(()=>{e.instance.processId&&this._removeProcessIdAssociation(e.instance.processId)})}async _associateProcessIdWithSession(e,t,o,n,r){try{let s=await Promise.race([e.processReady.then(()=>e.processId),Li(5e3).then(()=>{throw new Error("Timeout")})]);if(on(s)){let l=this._storageService.get("chat.terminalSessions",1,"{}"),c=JSON.parse(l),u=jp(t),p=c[s]||{};c[s]={...p,sessionId:u,shellIntegrationQuality:n,id:o,isBackground:r},this._storageService.store("chat.terminalSessions",JSON.stringify(c),1,0),this._logService.debug(`RunInTerminalTool: Associated terminal PID ${s} with session ${u}`)}}catch(s){this._logService.debug(`RunInTerminalTool: Failed to associate terminal with session: ${s}`)}}async _removeProcessIdAssociation(e){try{let t=this._storageService.get("chat.terminalSessions",1,"{}"),o=JSON.parse(t);o[e]&&(delete o[e],this._storageService.store("chat.terminalSessions",JSON.stringify(o),1,0),this._logService.debug(`RunInTerminalTool: Removed terminal association for PID ${e}`))}catch(t){this._logService.debug(`RunInTerminalTool: Failed to remove terminal association: ${t}`)}}_cleanupSessionTerminals(e){let t=this._sessionTerminalInstances.get(e),o=this._sessionTerminalAssociations.get(e),n=t??(o?new Set([o.instance]):void 0);if(!n||n.size===0)return;this._logService.debug(`RunInTerminalTool: Cleaning up ${n.size} terminal(s) for ended chat session ${e}`),this._sessionTerminalAssociations.delete(e),this._sessionTerminalInstances.delete(e);for(let s of n)this._terminalsBeingDisposedBySessionCleanup.add(s),s.dispose();let r=[];for(let[s,l]of ic._activeExecutions.entries())n.has(l.instance)&&(l.dispose(),r.push(s));for(let s of r)ic._activeExecutions.delete(s)}_addSessionTerminalAssociation(e,t){this._ensureArchivedSessionListener();let o=this._sessionTerminalInstances.get(e);o||(o=new Set,this._sessionTerminalInstances.set(e,o)),o.add(t.instance),t.isBackground||this._sessionTerminalAssociations.set(e,t)}_ensureArchivedSessionListener(){this._archivedSessionListener.value||(this._archivedSessionListener.value=this._agentSessionsService.onDidChangeSessionArchivedState(e=>{e.isArchived()&&this._cleanupSessionTerminals(e.resource)}))}_removeTerminalAssociations(e){if(this._terminalsBeingDisposedBySessionCleanup.delete(e)){this._removeExecutionAssociations(e);return}for(let[t,o]of this._sessionTerminalAssociations.entries())e===o.instance&&this._sessionTerminalAssociations.delete(t);for(let[t,o]of this._sessionTerminalInstances.entries())o.delete(e)&&o.size===0&&this._sessionTerminalInstances.delete(t);this._removeExecutionAssociations(e)}_removeExecutionAssociations(e){let t=[];for(let[o,n]of ic._activeExecutions.entries())n.instance===e&&(n.dispose(),t.push(o));for(let o of t)ic._activeExecutions.delete(o)}_registerCompletionNotification(e,t,o,n,r,s,l){let c=e.instanceId;this._backgroundNotifications.deleteAndDispose(c);let u=e.capabilities.get(2);if(!u){s?.dispose();return}let p=this._chatService.acquireExistingSession(o,"RunInTerminalTool#completionNotification");if(!p){this._logService.warn(`RunInTerminalTool: Cannot register completion notification for terminal ${t} - session already disposed`),s?.dispose();return}let h=p.object.lastRequest,g={};h&&(g.userSelectedModelId=h.modelId,g.modeInfo=h.modeInfo,h.userSelectedTools&&(g.userSelectedTools=Fo(h.userSelectedTools)));let f=new O,v=!1,b=()=>this._backgroundNotifications.deleteAndDispose(c),S=()=>p.object.lastRequest?.response?.isCanceled?(b(),!0):!1;if(f.add(ve(w=>{let x=p.object.lastRequestObs.read(w);x?.response&&w.store.add(x.response.onDidChange(E=>{E.reason==="completedRequest"&&x.response.isCanceled&&b()}))})),s){let w=l??"",x=l!==void 0?Date.now():0,E=new qe;f.add(ee(()=>{E.cancel(),E.dispose()})),f.add(s),s.continueMonitoringAsync(E.token),f.add(this._registerSensitiveInputElicitation(o,e,s,()=>{ic._activeExecutions.get(t)?.dispose()})),f.add(s.onDidDetectInputNeeded(()=>{if(v){this._logService.debug(`RunInTerminalTool: Suppressing input-needed notification for terminal ${t} because user is replying directly`);return}if(e.isDisposed){this._logService.debug(`RunInTerminalTool: Suppressing input-needed notification for terminal ${t} because the terminal is disposed`);return}if(S())return;let M=ic._activeExecutions.get(t);if(!M)return;let N=M.getOutput(),V=Date.now();if(N===w&&V-x<uun)return;w=N,x=V;let K=this._buildInputNeededSteeringText(o,t,"none"),j=`[Terminal ${t} notification: command may be waiting for input \u2014 assess the output below.]
${K}
Terminal output:
${N}`;this._logService.debug(`RunInTerminalTool: Input needed in background terminal ${t}, notifying chat session`),this._chatService.sendRequest(o,j,{...g,queue:"steering",isSystemInitiated:!0,systemInitiatedLabel:d(16542,null,n),terminalExecutionId:t}).catch(J=>{this._logService.warn(`RunInTerminalTool: Failed to send input-needed notification for terminal ${t}`,J)})}))}f.add(e.onDidInputData(()=>{v||(v=!0,this._dismissPendingCarouselsForTerminal(o,t))})),f.add(p),f.add(u.onCommandFinished(w=>{let x=ic._activeExecutions.get(t);if(!x){b();return}if(S())return;b();let E=w.exitCode,M=E!==void 0?` with exit code ${E}`:"",N=x.getOutput(),H=this._terminalService.foregroundInstances.includes(e)?`[Terminal ${t} notification: command completed${M}. Use send_to_terminal to send another command or kill_terminal to stop it.]
Terminal output:
${N}`:`[Terminal ${t} notification: command completed${M}. The terminal has been cleaned up.]
Terminal output:
${N}`;this._logService.debug(`RunInTerminalTool: Command completed in background terminal ${t}, notifying chat session`),this._chatService.sendRequest(o,H,{...g,queue:"steering",isSystemInitiated:!0,systemInitiatedLabel:d(16543,null,n),terminalExecutionId:t}).catch(K=>{this._logService.warn(`RunInTerminalTool: Failed to send completion notification for terminal ${t}`,K)}),this._commandArtifactCollector.capture(r,e,w.id).then(()=>{if(this._terminalService.foregroundInstances.includes(e)){this._logService.debug(`RunInTerminalTool: Background terminal ${t} was revealed by user, skipping disposal`);return}this._logService.debug(`RunInTerminalTool: Disposing finished background terminal ${t}`),ic._killedByTool.add(t),x.dispose(),ic._activeExecutions.delete(t),e.dispose()})}));let y=ic._activeExecutions.get(t);f.add(e.onDisposed(()=>{if(ic._killedByTool.has(t)){b();return}if(this._isShuttingDown){b();return}if(S())return;let w=y?.getOutput()??"",x=e.exitCode,E=x!==void 0?` with exit code ${x}`:"";b();let M=`[Terminal ${t} notification: terminal exited${E}. The terminal process ended before the command could complete normally; further commands cannot be sent to this terminal ID.]
Terminal output:
${w}`;this._logService.debug(`RunInTerminalTool: Background terminal ${t} disposed${E}, notifying chat session`),this._chatService.sendRequest(o,M,{...g,queue:"steering",isSystemInitiated:!0,systemInitiatedLabel:d(16544,null,n),terminalExecutionId:t}).catch(N=>{this._logService.warn(`RunInTerminalTool: Failed to send terminal-exited notification for terminal ${t}`,N)})})),f.add(p.object.onDidChange(w=>{w.kind==="removeRequest"&&(this._logService.debug(`RunInTerminalTool: Request removed from session, cleaning up background terminal ${t}`),ic._activeExecutions.get(t)?.dispose(),ic._activeExecutions.delete(t),b(),e.dispose())})),this._backgroundNotifications.set(c,f)}_dismissPendingCarouselsForTerminal(e,t){let o=this._chatService.getSession(e);if(!o)return;let n=o.getRequests();for(let r=n.length-1;r>=0;r--){let s=n[r].response;if(!s)continue;let l=s.response.value;for(let c=l.length-1;c>=0;c--){let u=l[c];if(u instanceof nI&&u.terminalId===t&&!u.isUsed){this._logService.debug(`RunInTerminalTool: Dismissing pending carousel for terminal ${t} because user typed directly in terminal`),u.data={},u.isUsed=!0,u.dismissedByTerminalInput=!0,u.completion.complete({answers:void 0});return}}}}};ic=I([m(0,si),m(1,B),m(2,ge),m(3,fa),m(4,F),m(5,nt),m(6,Wn),m(7,bo),m(8,de),m(9,tg),m(10,wa),m(11,an),m(12,LP),m(13,Ae),m(14,Lt),m(15,Vc),m(16,to)],ic);var Rst=class extends k{constructor(e,t,o,n,r,s){super();this.sessionResource=e;this.termId=t;this._instantiationService=s;this._toolTerminal=o,this._isBackground=r,this._completionDeferred=new Mo,this.strategy=this._register(this._createStrategy(n)),this._register(this.strategy.onDidCreateStartMarker(l=>{l&&(this._startMarker=l)}))}get completionPromise(){return this._completionDeferred.p}get isBackground(){return this._isBackground}get startMarker(){return this._startMarker}get instance(){return this._toolTerminal.instance}_createStrategy(e){let t=!this._isBackground;switch(this._toolTerminal.shellIntegrationQuality){case"none":return this._instantiationService.createInstance(f0e,this._toolTerminal.instance,()=>this._toolTerminal.receivedUserInput??!1);case"basic":return this._instantiationService.createInstance(g0e,this._toolTerminal.instance,()=>this._toolTerminal.receivedUserInput??!1,e);case"rich":return this._instantiationService.createInstance(v0e,this._toolTerminal.instance,e,t)}}async start(e,t,o,n){try{let r=await this.strategy.execute(e,t,o,n);return this._completionDeferred.complete(r),r}catch(r){throw this._completionDeferred.error(r),r}}setForeground(){this._isBackground=!1}setBackground(){this._isBackground=!0}getOutput(e){return h6(this.instance,e??this._startMarker)}};Rst=I([m(5,F)],Rst);var WAi=class extends k{constructor(e){super();this.instance=e;this.completionPromise=Promise.resolve({output:void 0,error:"restoredTerminalExecutionNotAwaitable"})}getOutput(e){return h6(this.instance,e)}},O0e=class{constructor(i,e,t){this._configurationService=i;this._terminalProfileResolverService=e;this._remoteAgentService=t;this.osBackend=this._remoteAgentService.getEnvironment().then(o=>o?.os??Ao)}async getCopilotProfile(){let i=await this.osBackend,e=this._getChatTerminalProfile(i);if(e)return e;let t=await this._terminalProfileResolverService.getDefaultProfile({os:i,remoteAuthority:this._remoteAgentService.getConnection()?.remoteAuthority});return Jo(t.path)==="cmd.exe"?{...t,path:"C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",profileName:"PowerShell"}:t.path==="/bin/sh"?{...t,path:"/bin/bash",profileName:"bash"}:{...t,icon:void 0}}async getCopilotShell(){return(await this.getCopilotProfile()).path}_getChatTerminalProfile(i){let e;switch(i){case 1:e="chat.tools.terminal.terminalProfile.windows";break;case 2:e="chat.tools.terminal.terminalProfile.osx";break;case 3:default:e="chat.tools.terminal.terminalProfile.linux";break}let t=this._configurationService.getValue(e);if(this._isValidChatAgentTerminalProfile(t))return t}_isValidChatAgentTerminalProfile(i){return i==null||typeof i!="object"?!1:!!("path"in i&&We(i.path))}};O0e=I([m(0,B),m(1,ig),m(2,bo)],O0e);var vun="workbench.action.chat.previousQuestion",bun="workbench.action.chat.nextQuestion",v6=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.carousel=e;this._options=o;this._markdownRendererService=n;this._hoverService=r;this._accessibilityService=s;this._contextKeyService=l;this._keybindingService=c;this._commandService=u;this._configurationService=p;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this._currentIndex=0;this._answers=new Map;this._isCollapsed=!1;this._isSkipped=!1;this._textInputBoxes=new Map;this._singleSelectItems=new Map;this._multiSelectCheckboxes=new Map;this._freeformTextareas=new Map;this._inputBoxes=this._register(new O);this._questionRenderStore=this._register(new ue);this._interactiveUIStore=this._register(new ue);this.domNode=_(".chat-question-carousel-container"),this.domNode.id=ht(),this._inChatQuestionCarouselContextKey=Z.inChatQuestionCarousel.bindTo(this._contextKeyService),this._chatQuestionCarouselHasTerminalContextKey=Z.chatQuestionCarouselHasTerminal.bindTo(this._contextKeyService);let h=this._register(nr(this.domNode));if(this._register(h.onDidFocus(()=>{this._inChatQuestionCarouselContextKey.set(!0),this._chatQuestionCarouselHasTerminalContextKey.set(!!this.carousel.terminalId)})),this._register(h.onDidBlur(()=>{this._inChatQuestionCarouselContextKey.set(!1),this._chatQuestionCarouselHasTerminalContextKey.reset()})),this._register({dispose:()=>{this._inChatQuestionCarouselContextKey.reset(),this._chatQuestionCarouselHasTerminalContextKey.reset()}}),this.domNode.tabIndex=0,this.domNode.setAttribute("role","region"),this.domNode.setAttribute("aria-roledescription",d(8795,null)),this._updateAriaLabel(),e instanceof nI&&(typeof e.draftCurrentIndex=="number"&&(this._currentIndex=Math.max(0,Math.min(e.draftCurrentIndex,e.questions.length-1))),typeof e.draftCollapsed=="boolean"&&(this._isCollapsed=e.draftCollapsed),e.draftAnswers))for(let[S,y]of Object.entries(e.draftAnswers))this._answers.set(S,y);if(e.data)for(let[S,y]of Object.entries(e.data))this._answers.set(S,y);let g=Ni(t.element)&&t.element.isComplete;if(e.isUsed||g){this._isSkipped=!0,this.domNode.classList.add("chat-question-carousel-used"),this.renderSummary();return}let f=new O;this._interactiveUIStore.value=f,this._questionContainer=_(".chat-question-carousel-content"),this.domNode.append(this._questionContainer),this._headerActionsContainer=_(".chat-question-header-actions");let v=d(8777,null),b=f.add(new Pi(this._headerActionsContainer,{...Ro,secondary:!0,supportIcons:!0}));if(b.element.classList.add("chat-question-collapse-toggle"),b.element.setAttribute("aria-label",v),this._collapseButton=b,e.allowSkip){this._closeButtonContainer=_(".chat-question-close-container");let S=d(8797,null),y=f.add(new Pi(this._closeButtonContainer,{...Ro,secondary:!0,supportIcons:!0}));y.label=`$(${L.close.id})`,y.element.classList.add("chat-question-close"),y.element.setAttribute("aria-label",S),f.add(this._hoverService.setupDelayedHover(y.element,{content:S})),this._skipAllButton=y}if(e.terminalId){this._focusTerminalButtonContainer=_(".chat-question-focus-terminal-container");let S=d(8785,null),y=this._keybindingService.lookupKeybinding("workbench.action.chat.focusQuestionCarouselTerminal")?.getLabel(),w=y?d(8784,null,y):S,x=f.add(new Pi(this._focusTerminalButtonContainer,{...Ro,secondary:!0,supportIcons:!0}));x.label=`$(${L.terminal.id})`,x.element.classList.add("chat-question-focus-terminal"),x.element.setAttribute("aria-label",w),f.add(this._hoverService.setupDelayedHover(x.element,{content:S})),f.add(x.onDidClick(()=>this._focusTerminal()));let E=ic.getExecution(e.terminalId);E&&f.add(E.instance.onDidInputData(()=>{this._isSkipped||(e instanceof nI&&(e.dismissedByTerminalInput=!0),this.ignore())}))}f.add(b.onDidClick(()=>this.toggleCollapsed())),this._skipAllButton&&f.add(this._skipAllButton.onDidClick(()=>this.ignore())),f.add($(this.domNode,ne.KEY_DOWN,S=>{let y=new mi(S);if(y.keyCode===9&&this.carousel.allowSkip)S.preventDefault(),S.stopPropagation(),this.ignore();else if(y.keyCode===3&&(y.metaKey||y.ctrlKey))S.preventDefault(),S.stopPropagation(),this.submit();else if(y.keyCode===3&&!y.shiftKey){let w=S.target,x=w.tagName==="INPUT"&&w.type==="text",E=w.tagName==="TEXTAREA"&&w.classList.contains("chat-question-freeform-textarea");(x||E)&&(S.preventDefault(),S.stopPropagation(),this.handleNextOrSubmit())}else(y.ctrlKey||y.metaKey)&&(y.keyCode===1||y.keyCode===20)&&S.stopPropagation()})),this.renderCurrentQuestion()}saveCurrentAnswer(){let e=this.carousel.questions[this._currentIndex],t=this.getCurrentAnswer();if(t!==void 0?this._answers.set(e.id,t):this._answers.delete(e.id),e?.validation&&typeof t=="string"&&t!==""){let o=this.getValidationError(t,e.validation);o?this.showValidationError(o):this.clearValidationError()}else this.clearValidationError();this.updateFooterState(),this.persistDraftState()}persistDraftState(){this.carousel.isUsed||!(this.carousel instanceof nI)||(this.carousel.draftAnswers=Object.fromEntries(this._answers.entries()),this.carousel.draftCurrentIndex=this._currentIndex,this.carousel.draftCollapsed=this._isCollapsed)}toggleCollapsed(){this._isCollapsed=!this._isCollapsed,this.persistDraftState(),this.updateCollapsedPresentation(),this._onDidChangeHeight.fire()}_focusTerminal(){let e=this.carousel.terminalId;e&&this._commandService.executeCommand("workbench.action.terminal.chat.focusTerminalByExecutionId",e)}updateCollapsedPresentation(){if(this.domNode.classList.toggle("chat-question-carousel-collapsed",this._isCollapsed),this._collapseButton){let e=this._isCollapsed,t=e?d(8783,null):d(8777,null),o=this.domNode.id;this._collapseButton.label=e?`$(${L.chevronUp.id})`:`$(${L.chevronDown.id})`,this._collapseButton.element.setAttribute("aria-label",t),this._collapseButton.element.setAttribute("aria-expanded",String(!e)),this._collapseButton.element.setAttribute("aria-controls",o),this._collapseButton.setTitle(t)}}navigate(e){let t=this._currentIndex+e;t>=0&&t<this.carousel.questions.length&&(this.saveCurrentAnswer(),this._currentIndex=t,this.persistDraftState(),this.renderCurrentQuestion(!0),this.domNode.focus())}handleNextOrSubmit(){if(this.saveCurrentAnswer(),!!this.validateCurrentQuestion())if(this._currentIndex<this.carousel.questions.length-1)this._currentIndex++,this.persistDraftState(),this.renderCurrentQuestion(!0);else{if(!this.validateRequiredFields())return;this._options.onSubmit(this._answers),this.hideAndShowSummary()}}submit(){this.saveCurrentAnswer(),this.validateCurrentQuestion()&&this.validateRequiredFields()&&(this._options.onSubmit(this._answers),this.hideAndShowSummary())}_focusContainerAndAnnounce(){this.domNode.focus();let e=this.carousel.questions[this._currentIndex];if(e){let t=e.message??e.title,o=this.getQuestionText(t),n=this.carousel.questions.length,r=n===1?o:d(8793,null,this._currentIndex+1,n,o);this._accessibilityService.alert(r)}}hideAndShowSummary(){this._isSkipped=!0,this.domNode.classList.add("chat-question-carousel-used"),this.clearInteractiveResources(),St(this.domNode),this.renderSummary(),this._onDidChangeHeight.fire()}clearInteractiveResources(){this._interactiveUIStore.clear(),this._questionRenderStore.clear(),this._inputBoxes.clear(),this._textInputBoxes.clear(),this._singleSelectItems.clear(),this._multiSelectCheckboxes.clear(),this._freeformTextareas.clear(),this._prevButton=void 0,this._nextButton=void 0,this._submitButton=void 0,this._skipAllButton=void 0,this._questionContainer=void 0,this._headerActionsContainer=void 0,this._closeButtonContainer=void 0,this._focusTerminalButtonContainer=void 0,this._collapseButton=void 0,this._footerRow=void 0,this._stepIndicator=void 0,this._submitHint=void 0,this._inputScrollable=void 0}layoutInputScrollable(e){if(!this._questionContainer)return;let t=e.getDomNode(),o=t.firstElementChild;if(!go(o))return;(t.style.height!==""||t.style.maxHeight!=="")&&(t.style.height="",t.style.maxHeight=""),(o.style.height!==""||o.style.maxHeight!=="")&&(o.style.height="",o.style.maxHeight="");let n=this._questionContainer.clientHeight,r=Me(this._questionContainer).getComputedStyle(this._questionContainer),s=Number.parseFloat(r.paddingTop||"0")+Number.parseFloat(r.paddingBottom||"0"),l=Array.from(this._questionContainer.children).filter(g=>g!==t).reduce((g,f)=>g+f.offsetHeight,0),c=Math.floor(n-s-l),u=o.scrollHeight,h=`${Math.max(0,Math.min(c,u))}px`;(t.style.height!==h||t.style.maxHeight!==h)&&(t.style.height=h,t.style.maxHeight=h),(o.style.height!==h||o.style.maxHeight!==h)&&(o.style.height=h,o.style.maxHeight=h),e.scanDomNode()}skip(){if(this._isSkipped||!this.carousel.allowSkip)return!1;let e=this.getDefaultAnswers();this._options.onSubmit(e),this._answers.clear();for(let[t,o]of e)this._answers.set(t,o);return this.hideAndShowSummary(),!0}ignore(){return this._isSkipped||!this.carousel.allowSkip?!1:(this._isSkipped=!0,this._options.onSubmit(void 0),this.clearInteractiveResources(),this.domNode.classList.add("chat-question-carousel-used"),St(this.domNode),this.renderSkippedMessage(),this._onDidChangeHeight.fire(),!0)}getDefaultAnswers(){let e=new Map;for(let t of this.carousel.questions){let o=this.getDefaultAnswerForQuestion(t);o!==void 0&&e.set(t.id,o)}return e}getDefaultAnswerForQuestion(e){switch(e.type){case"text":return typeof e.defaultValue=="string"?e.defaultValue:void 0;case"singleSelect":{let t=typeof e.defaultValue=="string"?e.defaultValue:void 0,n=(t!==void 0?e.options?.find(r=>r.id===t):void 0)?.value;return n!==void 0?{selectedValue:n,freeformValue:void 0}:void 0}case"multiSelect":{let t=Array.isArray(e.defaultValue)?e.defaultValue:typeof e.defaultValue=="string"?[e.defaultValue]:[],o=e.options?.filter(n=>t.includes(n.id)).map(n=>n.value).filter(n=>n!==void 0)??[];return o.length>0?{selectedValues:o,freeformValue:void 0}:void 0}default:return typeof e.defaultValue=="string"?e.defaultValue:Array.isArray(e.defaultValue)?{selectedValues:e.defaultValue}:void 0}}_shouldAutoFocus(){return this._options.shouldAutoFocus===!1?!1:!this._accessibilityService.isScreenReaderOptimized()}_updateAriaLabel(){let e=this.carousel.questions[this._currentIndex];if(!e){this.domNode.setAttribute("aria-label",d(8786,null));return}let t=e.message??e.title,o=this.getQuestionText(t),n=this.carousel.questions.length,r;if(n===1?r=d(8796,null,o):r=d(8789,null,this._currentIndex+1,n,o),this._configurationService.getValue("accessibility.verbosity.chatQuestionCarousel")&&this.carousel.terminalId){let l=this._keybindingService.lookupKeybinding("workbench.action.chat.focusQuestionCarouselTerminal")?.getLabel();l?r=d(8778,null,r,l):r=d(8779,null,r)}this.domNode.setAttribute("aria-label",r)}focus(){this.domNode.focus()}hasFocus(){return Is(this.domNode)}navigateToPreviousQuestion(){return this._currentIndex<=0?!1:(this.navigate(-1),!0)}navigateToNextQuestion(){return this._currentIndex>=this.carousel.questions.length-1?!1:(this.navigate(1),!0)}focusTerminal(){return this.carousel.terminalId?(this._focusTerminal(),!0):!1}renderCurrentQuestion(e=!1){if(!this._questionContainer)return;let t=new O;this._questionRenderStore.value=t,this._inputScrollable=void 0,this._inputBoxes.clear(),this._textInputBoxes.clear(),this._singleSelectItems.clear(),this._multiSelectCheckboxes.clear(),this._freeformTextareas.clear(),St(this._questionContainer);let o=this.carousel.questions[this._currentIndex];if(!o)return;let n=_(".chat-question-header-row"),r=_(".chat-question-title-row");if(this.carousel.message&&this._currentIndex===0){let b=yr(this.carousel.message)?he.lift(this.carousel.message):new he(this.carousel.message),S=_(".chat-question-carousel-message"),y=t.add(this._markdownRendererService.render(b));S.appendChild(y.element),n.appendChild(S)}let s=o.message??o.title;if(s){let b=_(".chat-question-title"),S=this.getQuestionText(s);b.setAttribute("aria-label",S);let y=yr(s)?s.value:s,w=o.required?`${y} *`:y,x=yr(s)?he.lift({...s,value:w}):new he(w),E=t.add(this._markdownRendererService.render(x));b.appendChild(E.element),r.appendChild(b)}if(n.appendChild(r),this._headerActionsContainer&&(St(this._headerActionsContainer),this._focusTerminalButtonContainer&&this._headerActionsContainer.appendChild(this._focusTerminalButtonContainer),this._closeButtonContainer&&this._headerActionsContainer.appendChild(this._closeButtonContainer),this._collapseButton&&this._headerActionsContainer.appendChild(this._collapseButton.element),r.appendChild(this._headerActionsContainer)),this._questionContainer.appendChild(n),o.description){let b=_(".chat-question-description");b.textContent=o.description,this._questionContainer.appendChild(b)}let l=_(".chat-question-input-container");if(o.detailedMessage){let b=yr(o.detailedMessage)?he.lift(o.detailedMessage):new he(o.detailedMessage),S=_(".chat-question-detailed-message"),y=t.add(this._markdownRendererService.render(b));S.appendChild(y.element),l.appendChild(S)}this.renderInput(l,o);let c=t.add(new Ar(l,{vertical:3,horizontal:2,consumeMouseWheelIfScrollbarIsNeeded:!0}));this._inputScrollable=c;let u=c.getDomNode();u.classList.add("chat-question-input-scrollable"),this._questionContainer.appendChild(u),this._validationMessageElement=_(".chat-question-validation-message"),this._validationMessageElement.style.display="none",this._questionContainer.appendChild(this._validationMessageElement),this.carousel.questions.length===1?this.renderSingleQuestionFooter():this.renderFooter();let h=!1,g=t.add(new ue),f=()=>{h||(h=!0,g.value=Cg(Me(this.domNode),()=>{h=!1,this.layoutInputScrollable(c)}))},v=t.add(new zu("ChatQuestionCarouselPart.inputScrollable",()=>f()));t.add(v.observe(u)),t.add(v.observe(l)),t.add($(Me(this.domNode),ne.RESIZE,()=>f())),f(),t.add(Cg(Me(this.domNode),()=>{l.scrollTop=0,l.scrollLeft=0,c.setScrollPosition({scrollTop:0,scrollLeft:0}),c.scanDomNode()})),this._updateAriaLabel(),this.updateCollapsedPresentation(),e&&this._accessibilityService.isScreenReaderOptimized()&&this._focusContainerAndAnnounce(),this._onDidChangeHeight.fire()}renderFooter(){if(!this._footerRow){let e=this._interactiveUIStore.value;if(!e)return;this._footerRow=_(".chat-question-footer-row");let t=_(".chat-question-footer-left.chat-question-carousel-nav");t.setAttribute("role","navigation"),t.setAttribute("aria-label",d(8790,null));let o=_(".chat-question-nav-arrows"),n=this.getLabelWithKeybinding(d(8815,null),vun),r=e.add(new Pi(o,{...Ro,secondary:!0,supportIcons:!0}));r.element.classList.add("chat-question-nav-arrow","chat-question-nav-prev"),r.label=`$(${L.chevronLeft.id})`,r.element.setAttribute("aria-label",n),e.add(this._hoverService.setupDelayedHover(r.element,{content:n})),e.add(r.onDidClick(()=>this.navigate(-1))),this._prevButton=r;let s=this.getLabelWithKeybinding(d(8814,null),bun),l=e.add(new Pi(o,{...Ro,secondary:!0,supportIcons:!0}));l.element.classList.add("chat-question-nav-arrow","chat-question-nav-next"),l.label=`$(${L.chevronRight.id})`,l.element.setAttribute("aria-label",s),e.add(this._hoverService.setupDelayedHover(l.element,{content:s})),e.add(l.onDidClick(()=>this.navigate(1))),this._nextButton=l,t.appendChild(o),this._stepIndicator=_(".chat-question-step-indicator"),t.appendChild(this._stepIndicator),this._footerRow.appendChild(t);let c=_(".chat-question-footer-right"),u=_("span.chat-question-submit-hint");u.textContent=et?d(8800,null):d(8801,null),c.appendChild(u),this._submitHint=u;let p=e.add(new Pi(c,{...Ro}));p.element.classList.add("chat-question-submit-button"),p.label=d(8816,null),e.add(p.onDidClick(()=>this.submit())),this._submitButton=p,this._footerRow.appendChild(c),this.domNode.append(this._footerRow)}this.updateFooterState()}updateFooterState(){if(this._prevButton&&(this._prevButton.enabled=this._currentIndex>0),this._nextButton){let e=this._currentIndex<this.carousel.questions.length-1,t=this.carousel.questions[this._currentIndex],o=this._answers.get(t?.id),n=o!==void 0&&o!=="",r=!!this._currentValidationError;this._nextButton.enabled=e&&(!t?.required||n)&&!r}if(this._stepIndicator&&(this._stepIndicator.textContent=d(8799,null,this._currentIndex+1,this.carousel.questions.length)),this._submitButton){let e=this._currentIndex===this.carousel.questions.length-1;this._submitButton.element.style.display=e?"":"none",this._submitHint&&(this._submitHint.style.display=e?"":"none")}}renderSingleQuestionFooter(){if(!this._footerRow){let e=this._interactiveUIStore.value;if(!e)return;this._footerRow=_(".chat-question-footer-row");let t=_(".chat-question-footer-left.chat-question-carousel-nav");t.setAttribute("role","navigation"),t.setAttribute("aria-label",d(8790,null)),this._footerRow.appendChild(t);let o=_(".chat-question-footer-right"),n=_("span.chat-question-submit-hint");n.textContent=et?d(8800,null):d(8801,null),o.appendChild(n),this._submitHint=n;let r=e.add(new Pi(o,{...Ro}));r.element.classList.add("chat-question-submit-button"),r.label=d(8816,null),e.add(r.onDidClick(()=>this.submit())),this._submitButton=r,this._footerRow.appendChild(o),this.domNode.append(this._footerRow)}}getLabelWithKeybinding(e,t){let o=this._keybindingService.lookupKeybinding(t,this._contextKeyService)?.getLabel();return o?d(8787,null,e,o):e}renderInput(e,t){switch(t.type){case"text":this.renderTextInput(e,t);break;case"singleSelect":this.renderSingleSelect(e,t);break;case"multiSelect":this.renderMultiSelect(e,t);break}}setupTextareaAutoResize(e){let t=()=>{e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,200)}px`,this._inputScrollable&&this.layoutInputScrollable(this._inputScrollable),this._onDidChangeHeight.fire()};return this._inputBoxes.add($(e,ne.INPUT,t)),t}renderTextInput(e,t){let o=this._inputBoxes.add(new ad(e,void 0,{placeholder:d(8782,null),inputBoxStyles:Wl,validationOptions:t.validation?{validation:r=>{if(!r&&!t.required)return null;let s=this.getValidationError(r,t.validation);return s?{type:2,content:s}:null}}:void 0}));this._inputBoxes.add(o.onDidChange(()=>{this.saveCurrentAnswer()}));let n=this._answers.get(t.id);n!==void 0?o.value=String(n):t.defaultValue!==void 0&&(o.value=String(t.defaultValue)),this._textInputBoxes.set(t.id,o),this._shouldAutoFocus()&&this._inputBoxes.add(Cg(Me(o.element),()=>o.focus()))}renderSingleSelect(e,t){let o=this.getOptionsWithDefaultsFirst(t),n=_(".chat-question-list");n.setAttribute("role","listbox"),n.setAttribute("aria-label",t.title),n.tabIndex=0,e.appendChild(n);let r=this._answers.get(t.id),s=typeof r=="object"&&r!==null&&yo(r,{selectedValue:!0})?r:void 0,l=s?.freeformValue,c=s?.selectedValue,u=typeof t.defaultValue=="string"?t.defaultValue:void 0,p=-1;o.forEach(({option:b},S)=>{(c!==void 0&&b.value===c||p===-1&&!l&&u!==void 0&&b.id===u)&&(p=S)});let h=[],g=[],f=b=>{h.forEach((y,w)=>{let x=w===b;y.classList.toggle("selected",x),y.setAttribute("aria-selected",String(x));let E=g[w];E.classList.toggle("codicon",x),E.classList.toggle("codicon-check",x)}),b>=0&&b<h.length&&n.setAttribute("aria-activedescendant",h[b].id);let S=this._singleSelectItems.get(t.id);S&&(S.selectedIndex=b),this.saveCurrentAnswer()};o.forEach(({option:b},S)=>{let y=S===p,w=_(".chat-question-list-item");w.setAttribute("role","option"),w.setAttribute("aria-selected",String(y)),w.setAttribute("aria-label",d(8792,null,S+1,b.label)),w.id=`option-${t.id}-${S}`,w.tabIndex=-1;let x=_(".chat-question-list-number");x.textContent=`${S+1}`,w.appendChild(x);let E=_(".chat-question-list-indicator");y&&E.classList.add("codicon","codicon-check"),g.push(E);let M=_(".chat-question-list-label"),N=b.label.indexOf(" - ");if(N!==-1){w.classList.add("has-description");let V=_("span.chat-question-list-label-title");V.textContent=b.label.substring(0,N),M.appendChild(V);let H=_("span.chat-question-list-label-desc");H.textContent=b.label.substring(N+3),M.appendChild(H)}else M.textContent=b.label;w.appendChild(M),w.appendChild(E),y&&w.classList.add("selected"),this._inputBoxes.add($(w,ne.CLICK,V=>{V.preventDefault(),V.stopPropagation(),f(S);let H=this._freeformTextareas.get(t.id);H&&(H.value=""),this.handleNextOrSubmit()})),this._inputBoxes.add(this._hoverService.setupDelayedHover(w,{content:b.label,position:{hoverPosition:2},appearance:{showPointer:!0}})),n.appendChild(w),h.push(w)}),this._singleSelectItems.set(t.id,{items:h,selectedIndex:p,optionIndices:o.map(b=>b.originalIndex)}),p>=0&&p<h.length&&n.setAttribute("aria-activedescendant",h[p].id);let v;if(t.allowFreeformInput!==!1){let b=_(".chat-question-freeform"),S=_(".chat-question-freeform-number");S.textContent=`${o.length+1}`,b.appendChild(S),v=_("textarea.chat-question-freeform-textarea"),v.placeholder=d(8781,null),v.rows=1,l!==void 0&&(v.value=l);let y=this.setupTextareaAutoResize(v),w=v;this._inputBoxes.add($(w,ne.INPUT,()=>{w.value.length>0?f(-1):this.saveCurrentAnswer()})),b.appendChild(v),e.appendChild(b),this._freeformTextareas.set(t.id,v),l!==void 0&&this._inputBoxes.add(Cg(Me(w),()=>y()))}if(this._inputBoxes.add($(n,ne.KEY_DOWN,b=>{let S=new mi(b),y=this._singleSelectItems.get(t.id);if(!y||!h.length)return;let w=y.selectedIndex;if(S.keyCode===18)b.preventDefault(),w=Math.min(y.selectedIndex+1,h.length-1);else if(S.keyCode===16)b.preventDefault(),w=Math.max(y.selectedIndex-1,0);else if((S.keyCode===3||S.keyCode===10)&&!S.metaKey&&!S.ctrlKey){b.preventDefault(),b.stopPropagation(),this.handleNextOrSubmit();return}else if(S.keyCode>=22&&S.keyCode<=30){let x=S.keyCode-22;x<h.length?(b.preventDefault(),f(x)):v&&x===h.length&&(b.preventDefault(),f(-1),v.focus());return}w!==y.selectedIndex&&w>=0&&f(w)})),this._shouldAutoFocus()){if(v&&l){let b=v;this._inputBoxes.add(Cg(Me(b),()=>{b.focus()}))}else if(h.length>0){let b=p>=0?p:0;p<0&&f(0),this._inputBoxes.add(Cg(Me(n),()=>{h[b]?.focus()}))}}}renderMultiSelect(e,t){let o=this.getOptionsWithDefaultsFirst(t),n=_(".chat-question-list");n.setAttribute("role","listbox"),n.setAttribute("aria-multiselectable","true"),n.setAttribute("aria-label",t.title),n.tabIndex=0,e.appendChild(n);let r=this._answers.get(t.id),s=typeof r=="object"&&r!==null&&yo(r,{selectedValues:!0})?r:void 0,l=s?.freeformValue,c=s?.selectedValues??[],u=Array.isArray(t.defaultValue)?t.defaultValue:typeof t.defaultValue=="string"?[t.defaultValue]:[],p=[],h=[],g=0,f=-1;o.forEach(({option:b},S)=>{let y=!1;c&&c.length>0?y=c.includes(b.value):!l&&u.includes(b.id)&&(y=!0);let w=_(".chat-question-list-item.multi-select");w.setAttribute("role","option"),w.setAttribute("aria-selected",String(y)),w.setAttribute("aria-label",d(8792,null,S+1,b.label)),w.id=`option-${t.id}-${S}`,w.tabIndex=-1;let x=_(".chat-question-list-number");x.textContent=`${S+1}`,w.appendChild(x);let E=this._inputBoxes.add(new qf(b.label,y,Ag));E.domNode.classList.add("chat-question-list-checkbox"),E.domNode.tabIndex=-1,w.appendChild(E.domNode);let M=_(".chat-question-list-label"),N=b.label.indexOf(" - ");if(N!==-1){w.classList.add("has-description");let V=_("span.chat-question-list-label-title");V.textContent=b.label.substring(0,N),M.appendChild(V);let H=_("span.chat-question-list-label-desc");H.textContent=b.label.substring(N+3),M.appendChild(H)}else M.textContent=b.label;w.appendChild(M),y&&(w.classList.add("checked"),f===-1&&(f=S)),this._inputBoxes.add(E.onChange(()=>{w.classList.toggle("checked",E.checked),w.setAttribute("aria-selected",String(E.checked)),this.saveCurrentAnswer()})),this._inputBoxes.add($(w,ne.CLICK,V=>{g=S,V.target!==E.domNode&&!E.domNode.contains(V.target)&&E.domNode.click()})),this._inputBoxes.add(this._hoverService.setupDelayedHover(w,{content:b.label,position:{hoverPosition:2},appearance:{showPointer:!0}})),n.appendChild(w),p.push(E),h.push(w)}),this._multiSelectCheckboxes.set(t.id,{checkboxes:p,optionIndices:o.map(b=>b.originalIndex)});let v;if(t.allowFreeformInput!==!1){let b=_(".chat-question-freeform"),S=_(".chat-question-freeform-number");S.textContent=`${o.length+1}`,b.appendChild(S),v=_("textarea.chat-question-freeform-textarea"),v.placeholder=d(8781,null),v.rows=1,l!==void 0&&(v.value=l);let y=this.setupTextareaAutoResize(v);this._inputBoxes.add($(v,ne.INPUT,()=>this.saveCurrentAnswer())),b.appendChild(v),e.appendChild(b),this._freeformTextareas.set(t.id,v),l!==void 0&&this._inputBoxes.add(Cg(Me(v),()=>y()))}if(this._inputBoxes.add($(n,ne.KEY_DOWN,b=>{let S=new mi(b);if(h.length){if(S.keyCode===18)b.preventDefault(),g=Math.min(g+1,h.length-1),h[g].focus();else if(S.keyCode===16)b.preventDefault(),g=Math.max(g-1,0),h[g].focus();else if(S.keyCode===3&&!S.metaKey&&!S.ctrlKey)b.preventDefault(),b.stopPropagation(),this.handleNextOrSubmit();else if(S.keyCode===10)b.preventDefault(),g>=0&&g<p.length&&p[g].domNode.click();else if(S.keyCode>=22&&S.keyCode<=30){let y=S.keyCode-22;y<p.length?(b.preventDefault(),p[y].domNode.click()):v&&y===p.length&&(b.preventDefault(),v.focus())}}})),this._shouldAutoFocus()){if(v&&l){let b=v;this._inputBoxes.add(Cg(Me(b),()=>{b.focus()}))}else if(h.length>0){let b=f>=0?f:0;g=b,this._inputBoxes.add(Cg(Me(n),()=>{h[b]?.focus()}))}}}getCurrentAnswer(){let e=this.carousel.questions[this._currentIndex];if(e)switch(e.type){case"text":return this._textInputBoxes.get(e.id)?.value??(typeof e.defaultValue=="string"?e.defaultValue:Array.isArray(e.defaultValue)?{selectedValues:e.defaultValue}:void 0);case"singleSelect":{let t=this._singleSelectItems.get(e.id),o;if(t&&t.selectedIndex>=0){let s=t.optionIndices[t.selectedIndex];o=s!==void 0?e.options?.[s]?.value:void 0}o===void 0&&typeof e.defaultValue=="string"&&(o=e.options?.find(l=>l.id===e.defaultValue)?.value);let n=this._freeformTextareas.get(e.id),r=n?.value!==""?n?.value:void 0;return r?{selectedValue:void 0,freeformValue:r}:o!==void 0?{selectedValue:o,freeformValue:void 0}:void 0}case"multiSelect":{let t=this._multiSelectCheckboxes.get(e.id),o=[];t&&t.checkboxes.forEach((s,l)=>{if(s.checked){let c=t.optionIndices[l],u=c!==void 0?e.options?.[c]?.value:void 0;u!==void 0&&o.push(u)}});let n=this._freeformTextareas.get(e.id),r=n?.value!==""?n?.value:void 0;return r||o.length>0?{selectedValues:o,freeformValue:r}:void 0}default:return typeof e.defaultValue=="string"?e.defaultValue:Array.isArray(e.defaultValue)?{selectedValues:e.defaultValue}:void 0}}getOptionsWithDefaultsFirst(e){let o=(e.options??[]).map((c,u)=>({option:c,originalIndex:u})),n=Array.isArray(e.defaultValue)?e.defaultValue:typeof e.defaultValue=="string"?[e.defaultValue]:[];if(n.length===0)return o;let r=new Set(n),s=[],l=[];for(let c of o)r.has(c.option.id)?s.push(c):l.push(c);return[...s,...l]}renderSkippedMessage(){let e=_(".chat-question-carousel-summary"),t=_(".chat-question-summary-skipped"),o=this.carousel instanceof nI&&this.carousel.dismissedByTerminalInput;t.textContent=o?d(8780,null):d(8798,null),e.appendChild(t),this.domNode.appendChild(e)}renderSummary(){if(this._answers.size===0){this.carousel.isUsed&&this.renderSkippedMessage();return}let e=_(".chat-question-carousel-summary");for(let t of this.carousel.questions){let o=this._answers.get(t.id),n=_(".chat-question-summary-item"),r=_("div.chat-question-summary-label"),s=t.message??t.title,l=typeof s=="string"?s:s.value;if(l=l.replace(/[:\s]+$/,""),r.textContent=d(8803,null,l),n.appendChild(r),o!==void 0){let c=this.formatAnswerForSummary(t,o),u=_("div.chat-question-summary-answer-title");u.textContent=d(8802,null,c),n.appendChild(u)}else{let c=_("div.chat-question-summary-unanswered");c.textContent=d(8791,null),n.appendChild(c)}e.appendChild(n)}this.domNode.appendChild(e)}formatAnswerForSummary(e,t){switch(e.type){case"text":return String(t);case"singleSelect":{if(typeof t=="object"){let{selectedValue:n,freeformValue:r}=t,s=n!==void 0?e.options?.find(l=>l.value===n)?.label:void 0;return r||(s??String(n??""))}return e.options?.find(n=>n.value===t)?.label??String(t)}case"multiSelect":{if(typeof t=="object"&&yo(t,{selectedValues:!0})){let{selectedValues:o,freeformValue:n}=t,r=o.map(s=>e.options?.find(l=>l.value===s)?.label??String(s));return n&&r.push(n),r.join(d(8788,null))}return String(t)}default:return String(t)}}getQuestionText(e){let t=typeof e=="string"?new he(e):e;return ma(t)}validateCurrentQuestion(){let e=this.carousel.questions[this._currentIndex];if(!e)return!0;let t=this._answers.get(e.id);if(e.required&&(t===void 0||t===""))return this.showValidationError(d(8794,null)),!1;if(e.type==="text"&&e.validation&&typeof t=="string"&&t!==""){let o=this.getValidationError(t,e.validation);if(o)return this.showValidationError(o),!1}return this.clearValidationError(),!0}validateRequiredFields(){for(let e=0;e<this.carousel.questions.length;e++){let t=this.carousel.questions[e];if(!t.required)continue;let o=this._answers.get(t.id);if(o===void 0||o==="")return this.saveCurrentAnswer(),this._currentIndex=e,this.persistDraftState(),this.renderCurrentQuestion(!0),this.showValidationError(d(8794,null)),!1}return!0}getValidationError(e,t){if(t.minLength!==void 0&&e.length<t.minLength)return d(8811,null,t.minLength);if(t.maxLength!==void 0&&e.length>t.maxLength)return d(8809,null,t.maxLength);if(t.format)switch(t.format){case"email":if(!e.includes("@"))return d(8806,null);break;case"uri":if(!URL.canParse(e))return d(8813,null);break;case"date":{if(!/^\d{4}-\d{2}-\d{2}$/.test(e)||isNaN(new Date(e).getTime()))return d(8804,null);break}case"date-time":if(isNaN(new Date(e).getTime()))return d(8805,null);break}if(t.isInteger!==void 0||t.minimum!==void 0||t.maximum!==void 0){let o=Number(e);if(isNaN(o))return d(8812,null);if(t.isInteger&&!Number.isInteger(o))return d(8807,null);if(t.minimum!==void 0&&o<t.minimum)return d(8810,null,t.minimum);if(t.maximum!==void 0&&o>t.maximum)return d(8808,null,t.maximum)}}showValidationError(e){this._currentValidationError=e,this._validationMessageElement&&(this._validationMessageElement.textContent=e,this._validationMessageElement.style.display="")}clearValidationError(){this._currentValidationError=void 0,this._validationMessageElement&&(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none")}hasSameContent(e,t,o){return!this._isSkipped&&!this.carousel.isUsed&&Ni(o)&&o.isComplete?!1:e.kind==="questionCarousel"&&e===this.carousel}addDisposable(e){this._register(e)}dispose(){!this._isSkipped&&!this.carousel.isUsed&&this.saveCurrentAnswer(),super.dispose()}};v6=I([m(3,_n),m(4,ot),m(5,Ai),m(6,X),m(7,Le),m(8,fe),m(9,B)],v6);var Sun=300,Iun=200,yun=150,Nko=80,wun=".interactive-result-editor, .chat-markdown-part.rendered-markdown",Kqt=class extends k{constructor(e,t,o,n,r){super();this.toolPartFactory=e;this.scrollToSubagent=o;this.initialSubAgentInvocationId=n;this.initialAgentName=r;this._onDidEmpty=this._register(new T);this.onDidEmpty=this._onDidEmpty.event;this.items=[];this.toolCallIds=new Set;this.activeIndex=0;this._isContentExpanded=!1;this.canExpandContent=!1;let s=st(".chat-tool-confirmation-carousel@root",[st(".chat-tool-carousel-overlay@overlay",[st(".chat-tool-carousel-title-group@titleGroup",[st("span.chat-tool-carousel-collapsed-title@collapsedTitle"),st("button.chat-tool-carousel-agent-label@agentLabel")]),st(".chat-tool-carousel-overlay-actions@overlayActions",[st(".chat-tool-carousel-step-indicator@stepIndicator"),st(".chat-tool-carousel-nav-arrows@navArrows")])]),st(".chat-tool-carousel-content@content")]);this.domNode=s.root,this.domNode.tabIndex=-1,this.domNode.setAttribute("role","group"),this.domNode.setAttribute("aria-label",d(9008,null)),this.collapsedTitle=s.collapsedTitle,this.agentLabel=s.agentLabel,this.contentContainer=s.content,this.contentContainer.id=ht(),this.stepIndicator=s.stepIndicator,this.activeContentDisposables=this._register(new O),this.updateContentExpansionStateScheduler=this._register(new IY(this.domNode,()=>this.updateContentExpansionState())),this.contentResizeObserver=this._register(new zu("ChatToolConfirmationCarouselPart.contentExpansion",()=>this.updateContentExpansionStateScheduler.schedule())),this._register(this.contentResizeObserver.observe(this.contentContainer)),this.allowAllButton=this._register(new Pi(s.overlayActions,{...Ro,small:!0})),this.allowAllButton.element.classList.add("chat-tool-carousel-allow-all-button"),this.allowAllButton.label=d(9000,null),this._register(this.allowAllButton.onDidClick(()=>this.allowAll())),this.expandContentButton=this._register(new Pi(s.overlayActions,{...Ro,secondary:!0,supportIcons:!0})),this.expandContentButton.element.classList.add("chat-tool-carousel-header-button","chat-tool-carousel-expand-content-button"),this.expandContentButton.element.setAttribute("aria-controls",this.contentContainer.id),this.updateExpandContentButton(),Wi(this.expandContentButton.element),this._register(this.expandContentButton.onDidClick(()=>this.toggleContentExpanded())),this.dismissButton=this._register(new Pi(s.overlayActions,{...Ro,secondary:!0,supportIcons:!0})),this.dismissButton.element.classList.add("chat-tool-carousel-dismiss-button"),this.dismissButton.label=`$(${L.close.id})`;let l=this.items.length===1?d(9006,null):d(9007,null);this.dismissButton.element.setAttribute("aria-label",l),this.dismissButton.element.title=l,this._register(this.dismissButton.onDidClick(()=>this.skipAll())),this.prevButton=this._register(new Pi(s.navArrows,{...Ro,secondary:!0,supportIcons:!0})),this.prevButton.element.classList.add("chat-tool-carousel-nav-arrow"),this.prevButton.label=`$(${L.chevronLeft.id})`,this.prevButton.element.setAttribute("aria-label",d(9003,null)),this._register(this.prevButton.onDidClick(()=>this.navigateRelative(-1))),this.nextButton=this._register(new Pi(s.navArrows,{...Ro,secondary:!0,supportIcons:!0})),this.nextButton.element.classList.add("chat-tool-carousel-nav-arrow"),this.nextButton.label=`$(${L.chevronRight.id})`,this.nextButton.element.setAttribute("aria-label",d(9002,null)),this._register(this.nextButton.onDidClick(()=>this.navigateRelative(1))),this._register($(this.agentLabel,"click",c=>{c.preventDefault(),this.scrollToActiveSubagent()})),this._register($(this.domNode,"keydown",c=>this.onKeydown(c)));for(let c of t)this.addToolInvocation(c,this.initialSubAgentInvocationId,this.initialAgentName,this.scrollToSubagent)}get pendingCount(){return this.items.length}setMaxHeight(e){this.maxHeight=e,this.updateContentExpansionState()}hasToolInvocation(e){return this.toolCallIds.has(e)}addToolInvocation(e,t,o,n,r){if(this.toolCallIds.has(e.toolCallId)){let c=this.items.find(u=>u.toolCallId===e.toolCallId);c&&r&&!c.toolPart&&this.replaceExternalToolPart(c,r);return}this.toolCallIds.add(e.toolCallId);let s=new O,l={tool:e,toolCallId:e.toolCallId,disposables:s,subAgentInvocationId:t,agentName:o,scrollToSubagent:n,ownsToolPart:!r,toolPart:r};this.items.push(l),r&&this.watchExternalToolPart(l,r),s.add(ve(c=>{e.state.read(c).type!==pi.StateKind.WaitingForConfirmation&&this.removeItem(e.toolCallId)})),this.updateUI(),this.items.length===1&&this.setActiveIndex(0)}replaceExternalToolPart(e,t){e.toolPart!==t&&(e.toolPart&&e.ownsToolPart&&e.toolPart.dispose(),e.toolPart=t,e.ownsToolPart=!1,this.watchExternalToolPart(e,t),this.items[this.activeIndex]===e&&this.renderActiveContent())}watchExternalToolPart(e,t){let o=!0;e.disposables.add(ee(()=>o=!1));let n=new ue;n.value=ee(()=>{!o||e.toolPart!==t||(e.toolPart=void 0,e.ownsToolPart=!0,this.items[this.activeIndex]===e&&this.renderActiveContent())}),t.addDisposable(n),e.disposables.add(ee(()=>n.clear()))}dispose(){for(let e of this.items)e.toolPart&&e.ownsToolPart&&e.toolPart.dispose(),e.disposables.dispose();this.items.splice(0),this.toolCallIds.clear(),super.dispose()}removeItem(e){let t=this.items.findIndex(n=>n.toolCallId===e);if(t<0)return;let[o]=this.items.splice(t,1);if(this.toolCallIds.delete(e),o.toolPart&&o.ownsToolPart&&o.toolPart.dispose(),o.disposables.dispose(),this.items.length===0){Wi(this.domNode),this._onDidEmpty.fire();return}this.activeIndex>=this.items.length&&(this.activeIndex=this.items.length-1),this.updateUI(),this.renderActiveContent()}setActiveIndex(e){this.activeIndex=e,this.updateUI(),this.renderActiveContent()}navigateRelative(e){if(this.items.length<=1)return;let t=(this.activeIndex+e+this.items.length)%this.items.length;this.setActiveIndex(t)}onKeydown(e){if(this.items.length===0||this.shouldIgnoreNavigationKeydown(e.target))return;let t=new mi(e),o=go(e.target)&&this.contentContainer.contains(e.target),n=!1;switch(t.keyCode){case 15:this.navigateRelative(-1),n=!0;break;case 17:this.navigateRelative(1),n=!0;break;case 14:this.setActiveIndex(0),n=!0;break;case 13:this.setActiveIndex(this.items.length-1),n=!0;break}n&&(e.preventDefault(),e.stopPropagation(),o&&this.focusActiveContent())}shouldIgnoreNavigationKeydown(e){return go(e)?!!e.closest('.monaco-editor, .interactive-result-editor, .chat-confirmation-widget-message, input, textarea, select, [contenteditable="true"]'):!1}focusActiveContent(){this.domNode.focus()}updateUI(){let e=this.items[this.activeIndex];this.collapsedTitle.textContent=this.getToolTitle(e)??"",Md(!!this.collapsedTitle.textContent,this.collapsedTitle),e?.agentName?(this.agentLabel.textContent=`\u2014 ${e.agentName}`,this.agentLabel.disabled=!e.subAgentInvocationId||!e.scrollToSubagent,this.agentLabel.title=d(9005,null,e.agentName),this.agentLabel.setAttribute("aria-label",this.agentLabel.title),Xo(this.agentLabel)):(this.agentLabel.textContent="",this.agentLabel.title="",this.agentLabel.removeAttribute("aria-label"),Wi(this.agentLabel)),this.stepIndicator.textContent=`${this.activeIndex+1}/${this.items.length}`;let t=this.items.length>1;this.prevButton.enabled=t,this.nextButton.enabled=t,Md(t,this.stepIndicator),Md(t,this.prevButton.element),Md(t,this.nextButton.element),Md(t,this.allowAllButton.element),Md(this.canExpandContent,this.expandContentButton.element),this.allowAllButton.label=t?d(9000,null):d(8999,null),this.updateExpandContentButton()}renderActiveContent(){St(this.contentContainer),this.activeContentDisposables.clear(),this._isContentExpanded=!1,this.canExpandContent=!1;let e=this.items[this.activeIndex];if(!e){this.updateContentExpansionState();return}e.toolPart||(e.toolPart=this.toolPartFactory(e.tool),e.ownsToolPart&&e.disposables.add(e.toolPart)),this.contentContainer.appendChild(e.toolPart.domNode),this.activeContentDisposables.add(this.contentResizeObserver.observe(e.toolPart.domNode)),this.observeExpandableContentElements(e.toolPart.domNode),this.updateContentExpansionStateScheduler.schedule()}toggleContentExpanded(){this.canExpandContent&&(this._isContentExpanded=!this._isContentExpanded,this.updateContentExpansionState())}updateContentExpansionState(){this.canExpandContent=this.items.length>0&&this.isActiveContentLargerThanCollapsedLimit(),this.canExpandContent||(this._isContentExpanded=!1),this.domNode.classList.toggle("chat-tool-carousel-content-expanded",this.canExpandContent&&this._isContentExpanded),this.updateMaxHeightStyle(),Md(this.canExpandContent,this.expandContentButton.element),this.updateExpandContentButton()}updateMaxHeightStyle(){if(this.maxHeight===void 0){this.domNode.style.removeProperty("max-height");return}let t=this.canExpandContent&&this._isContentExpanded?Math.max(Nko,this.maxHeight):this.getCollapsedMaxHeight();this.domNode.style.maxHeight=`${Math.floor(t)}px`}updateExpandContentButton(){let e=this.canExpandContent&&this._isContentExpanded,t=e?d(9004,null):d(9001,null);this.expandContentButton.label=e?`$(${L.screenNormal.id})`:`$(${L.screenFull.id})`,this.expandContentButton.element.setAttribute("aria-label",t),this.expandContentButton.element.setAttribute("aria-expanded",String(e)),this.expandContentButton.setTitle(t)}isActiveContentLargerThanCollapsedLimit(){let e=this.contentContainer.firstElementChild;return go(e)?this.hasInnerContentLargerThanCollapsedLimit(e):!1}hasInnerContentLargerThanCollapsedLimit(e){if(this.isExpandableContentElement(e)&&this.getElementHeight(e)>this.getExpandableContentHeightLimit(e)+1)return!0;for(let t of e.children)if(go(t)&&this.hasInnerContentLargerThanCollapsedLimit(t))return!0;return!1}isExpandableContentElement(e){return e.matches(wun)}observeExpandableContentElements(e){this.isExpandableContentElement(e)&&this.activeContentDisposables.add(this.contentResizeObserver.observe(e));for(let t of e.children)go(t)&&this.observeExpandableContentElements(t)}getElementHeight(e){return Math.max(e.offsetHeight,e.scrollHeight)}getExpandableContentHeightLimit(e){let t=Me(this.domNode);return e.classList.contains("interactive-result-editor")?Math.min(yun,t.innerHeight*.25):Math.min(Iun,t.innerHeight*.3)}getCollapsedMaxHeight(){let e=this.maxHeight===void 0?Number.POSITIVE_INFINITY:Math.max(Nko,this.maxHeight);return Math.min(e,Sun,Me(this.domNode).innerHeight*.45)}allowAll(){for(let e of[...this.items])pi.confirmWith(e.tool,{type:4})}skipAll(){for(let e of[...this.items])pi.confirmWith(e.tool,{type:5})}getToolTitle(e){if(!e)return;let t=pi.getConfirmationMessages(e.tool);if(t?.title)return this.truncateTitle(this.toPlainText(t.title))}truncateTitle(e){e=e.replace(/\s+/g," ").trim();let t=100;return e.length>t?`${e.substring(0,t)}\u2026`:e}toPlainText(e){return(typeof e=="string"?e:e.value).replace(/\[([^\]]*)\]\(([^)]+)\)/g,(o,n,r)=>n||this.basename(r)).replace(/\*\*([^*]+)\*\*/g,"$1").replace(/__([^_]+)__/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[\\*_#>]/g,"")}basename(e){try{return decodeURIComponent(e.split("?")[0].split("#")[0]).split("/").filter(Boolean).at(-1)??e}catch{return e}}scrollToActiveSubagent(){let e=this.items[this.activeIndex];e?.subAgentInvocationId&&e.scrollToSubagent?.(e.subAgentInvocationId)}activateFirstToolForSubagent(e){let t=this.items.findIndex(o=>o.subAgentInvocationId===e);t>=0&&this.setActiveIndex(t)}};var Gqt=class{constructor(i,e,t,o=!1){this.location=e;this.parent=t;this.ignoreCase=o;if(e[e.length-1]==="\\")throw Error("Unexpected path format, do not use trailing backslashes");e[e.length-1]!=="/"&&(e+="/"),this.isPathIgnored=this.parseIgnoreFile(i,this.location,this.parent)}updateContents(i){this.isPathIgnored=this.parseIgnoreFile(i,this.location,this.parent)}isPathIncludedInTraversal(i,e){if(i[0]!=="/"||i[i.length-1]==="/")throw Error("Unexpected path format, expected to begin with slash and end without. got:"+i);return!this.isPathIgnored(i,e)}isArbitraryPathIgnored(i,e){if(i[0]!=="/"||i[i.length-1]==="/")throw Error("Unexpected path format, expected to begin with slash and end without. got:"+i);let t=i.split("/").filter(r=>r),o=!1,n="";for(let r=0;r<t.length;r++){let s=r===t.length-1,l=t[r];if(n=n+"/"+l,!this.isPathIncludedInTraversal(n,s?e:!0)){o=!0;break}}return o}gitignoreLinesToExpression(i,e,t){let o=i.map(r=>this.gitignoreLineToGlob(r,e)),n=Object.create(null);for(let r of o)n[r]=!0;return Eh(n,{trimForExclusions:t,ignoreCase:this.ignoreCase})}parseIgnoreFile(i,e,t){let o=i.split(`
`).map(v=>v.trim()).filter(v=>v&&v[0]!=="#"),n=o.filter(v=>!v.endsWith("/")),r=n.filter(v=>!v.includes("!")),s=this.gitignoreLinesToExpression(r,e,!0),l=n.filter(v=>v.includes("!")).map(v=>v.replace(/!/g,"")),c=this.gitignoreLinesToExpression(l,e,!1),u=o.filter(v=>!v.includes("!")),p=this.gitignoreLinesToExpression(u,e,!0),h=o.filter(v=>v.includes("!")).map(v=>v.replace(/!/g,"")),g=this.gitignoreLinesToExpression(h,e,!1);return(v,b)=>{if(!(this.ignoreCase?aT(v,e):v.startsWith(e)))return!1;let S=b&&g(v);if(b&&p(v)&&!S)return!0;let y=c(v);return s(v)&&!y?!0:S||y?!1:t?t.isPathIgnored(v,b):!1}}gitignoreLineToGlob(i,e){let t=i.indexOf("/");return t===-1||t===i.length-1?i="**/"+i:(t===0?e.slice(-1)==="/"&&(i=i.slice(1)):e.slice(-1)!=="/"&&(i="/"+i),i=e+i),i}};var HAi=class extends k{constructor(){super(...arguments);this._onDidRegisterDescriptor=this._register(new T);this.onDidRegisterDescriptor=this._onDidRegisterDescriptor.event;this.descriptors=[]}register(e){this.descriptors.push(e),this._onDidRegisterDescriptor.fire(e)}create(e,t,o){return this.descriptors.map(n=>{let r=n.create(e,t);return o.add(r),r})}},qqt=new HAi;oe.add("workbench.registry.explorer.fileContributions",qqt);var Lst=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return b6.ID}},$qt=new T,F0e=class{constructor(i,e,t,o,n,r,s,l,c,u){this.fileFilter=i;this.findProvider=e;this.progressService=t;this.configService=o;this.notificationService=n;this.layoutService=r;this.fileService=s;this.explorerService=l;this.contextService=c;this.filesConfigService=u}getParent(i){if(i.parent)return i.parent;throw new Error("getParent only supported for cached parents")}hasChildren(i){return Array.isArray(i)||i.hasChildren(e=>this.fileFilter.filter(e,1))}getChildren(i){if(Array.isArray(i))return i;if(this.findProvider.isShowingFilterResults())return Array.from(i.children.values());let e=i.error,t=this.explorerService.sortOrderConfiguration.sortOrder,o=i.fetchChildren(t);if(Array.isArray(o))return o;let n=o.then(r=>(i instanceof Tf&&i.isRoot&&!i.error&&e&&this.contextService.getWorkbenchState()!==2&&$qt.fire(i.resource),r),r=>{if(i instanceof Tf&&i.isRoot)if(this.contextService.getWorkbenchState()===2){let s=new Tf(i.resource,this.fileService,this.configService,this.filesConfigService,void 0,void 0,!1);return s.error=r,[s]}else $qt.fire(i.resource);else this.notificationService.error(r);return[]});return this.progressService.withProgress({location:1,delay:this.layoutService.isRestored()?800:1500},r=>n),n}};F0e=I([m(2,Go),m(3,B),m(4,Ne),m(5,wi),m(6,ge),m(7,Qa),m(8,Ae),m(9,fr)],F0e);var jqt=class extends Tf{},UAi=class{constructor(){this._tree=new Map;this._highlightedItems=new Map}get highlightedItems(){return Array.from(this._highlightedItems.values())}get(i){let e=this.find(i);if(e===void 0)return 0;let{treeLayer:t,relPath:o}=e;return this._highlightedItems.set(o,i),t.childMatches}find(i){let e=this._tree.get(i.root.name);if(e===void 0)return;let t=lu(i.root.resource,i.resource);if(t===void 0||t.startsWith(".."))throw new Error("Resource is not a child of the root");if(t==="")return{treeLayer:e,relPath:t};let o=e;for(let n of t.split("/")){if(!o.stats[n])return;o=o.stats[n]}return{treeLayer:o,relPath:t}}add(i,e){let t=lu(e.resource,i);if(t===void 0||t.startsWith(".."))throw new Error("Resource is not a child of the root");let o=this._tree.get(e.name);o||(o={childMatches:0,stats:{},isMatch:!1},this._tree.set(e.name,o)),o.childMatches++;let n=o;for(let r of t.split("/"))n.stats[r]||(n.stats[r]={childMatches:0,stats:{},isMatch:!1}),n=n.stats[r],n.childMatches++;n.childMatches--,n.isMatch=!0}isMatch(i){let e=this.find(i);if(e===void 0)return!1;let{treeLayer:t}=e;return t.isMatch}clear(){this._tree.clear()}},W0e=class{constructor(i,e,t,o,n,r,s,l,c){this.filesFilter=i;this.treeProvider=e;this.searchService=t;this.fileService=o;this.configurationService=n;this.filesConfigService=r;this.progressService=s;this.explorerService=l;this.sessionId=0;this.phantomParents=new Set;this.findHighlightTree=new UAi;this.explorerFindActiveContextKey=oBt.bindTo(c)}get highlightTree(){return this.findHighlightTree}isShowingFilterResults(){return!!this.filterSessionStartState}isVisible(i){return!this.filterSessionStartState||this.explorerService.isEditable(i)?!0:this.filterSessionStartState.rootsWithProviders.has(i.root)?i.isMarkedAsFiltered():!0}startSession(){this.sessionId++}async endSession(){this.filterSessionStartState&&await this.endFilterSession(),this.highlightSessionStartState&&this.endHighlightSession()}async find(i,e,t){let o=this.doFind(i,e,t);return await this.progressService.withProgress({location:1,delay:750},n=>o)}async doFind(i,e,t){return e.findMode===0?(this.filterSessionStartState&&await this.endFilterSession(),this.highlightSessionStartState||this.startHighlightSession(),await this.doHighlightFind(i,e.matchType,t)):(this.highlightSessionStartState&&this.endHighlightSession(),this.filterSessionStartState||this.startFilterSession(),await this.doFilterFind(i,e.matchType,t))}startFilterSession(){let i=this.treeProvider(),e=i.getInput();if(!e)return;let t=this.explorerService.roots.filter(o=>this.searchSupportsScheme(o.resource.scheme));this.filterSessionStartState={viewState:i.getViewState(),input:e,rootsWithProviders:new Set(t)},this.explorerFindActiveContextKey.set(!0)}async doFilterFind(i,e,t){if(!this.filterSessionStartState)throw new Error("ExplorerFindProvider: no session state");let o=Array.from(this.filterSessionStartState.rootsWithProviders),n=await this.getSearchResults(i,o,e,t);if(t.isCancellationRequested)return;this.clearPhantomElements();for(let{explorerRoot:l,files:c,directories:u}of n)this.addWorkspaceFilterResults(l,c,u);await this.treeProvider().setInput(this.filterSessionStartState.input);let s=n.some(({hitMaxResults:l})=>l);return{isMatch:l=>l.isMarkedAsFiltered(),matchCount:n.reduce((l,{files:c,directories:u})=>l+c.length+u.length,0),warningMessage:s?d(12318,null):void 0}}addWorkspaceFilterResults(i,e,t){let o=[...e.map(n=>({resource:n,isDirectory:!1})),...t.map(n=>({resource:n,isDirectory:!0}))];for(let{resource:n,isDirectory:r}of o){let s=i.find(n);if(s&&s.root===i){s.markItemAndParentsAsFiltered();continue}let l=this.createPhantomItems(n,i,r);if(l.length===0)throw new Error("Phantom item was not created even though it is not in the model");let c=l[0].parent;c instanceof jqt||this.phantomParents.add(c),l[l.length-1].markItemAndParentsAsFiltered()}}createPhantomItems(i,e,t){let o=lu(e.resource,i);if(!o)throw new Error("Resource is not a child of the root");let n=[],r=e,s=e.resource,l=o.split("/");for(let c of l){s=s.with({path:`${s.path}/${c}`});let u=r.getChild(c);if(!u){let p=l[l.length-1]===c?t:!0;u=new jqt(s,this.fileService,this.configurationService,this.filesConfigService,r,p),r.addChild(u),n.push(u)}r=u}return n}async endFilterSession(){if(this.clearPhantomElements(),this.explorerFindActiveContextKey.set(!1),!this.filterSessionStartState)throw new Error("ExplorerFindProvider: no session state to restore");await this.treeProvider().setInput(this.filterSessionStartState.input,this.filterSessionStartState.viewState),this.filterSessionStartState=void 0,this.explorerService.refresh()}clearPhantomElements(){for(let i of this.phantomParents)i.forgetChildren();this.phantomParents.clear(),this.explorerService.roots.forEach(i=>i.unmarkItemAndChildren())}startHighlightSession(){let i=this.explorerService.roots.filter(e=>this.searchSupportsScheme(e.resource.scheme));this.highlightSessionStartState={rootsWithProviders:new Set(i)}}async doHighlightFind(i,e,t){if(!this.highlightSessionStartState)throw new Error("ExplorerFindProvider: no highlight session state");let o=Array.from(this.highlightSessionStartState.rootsWithProviders),n=await this.getSearchResults(i,o,e,t);if(t.isCancellationRequested)return;this.clearHighlights();for(let{explorerRoot:s,files:l,directories:c}of n)this.addWorkspaceHighlightResults(s,l.concat(c));let r=n.some(({hitMaxResults:s})=>s);return{isMatch:s=>this.findHighlightTree.isMatch(s)||this.findHighlightTree.get(s)>0&&this.treeProvider().isCollapsed(s),matchCount:n.reduce((s,{files:l,directories:c})=>s+l.length+c.length,0),warningMessage:r?d(12318,null):void 0}}addWorkspaceHighlightResults(i,e){let t=new Set,o=r=>{for(;r;)t.add(r),r=r.parent};for(let r of e){let s=i.find(r);if(s&&s.root===i){this.findHighlightTree.add(r,i),o(s.parent);continue}let l=xun(r,i);l&&(this.findHighlightTree.add(r,i),o(l.parent))}let n=this.treeProvider();for(let r of t)n.hasNode(r)&&n.rerender(r)}endHighlightSession(){this.highlightSessionStartState=void 0,this.clearHighlights()}clearHighlights(){let i=this.treeProvider();for(let e of this.findHighlightTree.highlightedItems)i.hasNode(e)&&i.rerender(e);this.findHighlightTree.clear()}searchSupportsScheme(i){return i!==Q.file&&i!==Q.vscodeRemote?!1:this.searchService.schemeHasFileSearchProvider(i)}async getSearchResults(i,e,t,o){let n=i.toLowerCase(),r=t===0;return await Promise.all(e.map((s,l)=>this.searchInWorkspace(n,s,l,r,o)))}async searchInWorkspace(i,e,t,o,n){let r=o?kun(i):Eun(i),s=PH(this.configurationService.getValue({resource:e.resource}))||{},l={folderQueries:[{folder:e.resource,disregardIgnoreFiles:!this.configurationService.getValue("explorer.excludeGitIgnore")}],type:1,shouldGlobMatchFilePattern:!0,cacheKey:`explorerfindprovider:${e.name}:${t}:${this.sessionId}`,excludePattern:s,ignoreGlobCase:!0},c,u;try{[c,u]=await Promise.all([this.searchService.fileSearch({...l,filePattern:`**/${r}`,maxResults:512},n),this.searchService.fileSearch({...l,filePattern:`**/${r}/**`},n)])}catch(v){if(!Yi(v))throw v}if(!c||!u||n.isCancellationRequested)return{explorerRoot:e,files:[],directories:[],hitMaxResults:!1};let p=c.results.map(v=>v.resource),h=Cun(u.results.map(v=>v.resource),e,r),g=p.filter(v=>!this.filesFilter.isIgnored(v,e.resource,!1)),f=h.filter(v=>!this.filesFilter.isIgnored(v,e.resource,!0));return{explorerRoot:e,files:g,directories:f,hitMaxResults:!!c.limitHit||!!u.limitHit}}};W0e=I([m(2,Gg),m(3,ge),m(4,B),m(5,fr),m(6,Go),m(7,Qa),m(8,X)],W0e);function Cun(a,i,e){let t=new xn;for(let n of a){let r=lu(i.resource,n);if(!r)throw new Error("Resource is not a child of the root");let s=i.resource,l=r.split("/").slice(0,-1);for(let c of l)s=s.with({path:`${s.path}/${c}`}),t.add(s)}let o=[];for(let n of t){let r=n.path.split("/"),s=r[r.length-1];!s||!qd(e,s,{ignoreCase:!0})||o.push(n)}return o}function xun(a,i){let e=lu(i.resource,a);if(!e)throw new Error("Resource is not a child of the root");let t=i,o=i.resource,n=e.split("/");for(let r of n){o=o.with({path:`${o.path}/${r}`});let s=t.getChild(r);if(!s)return t;t=s}}function kun(a){return a?"*"+a.split("").join("*")+"*":"*"}function Eun(a){return a?"*"+a+"*":"*"}var Qqt=class{constructor(i,e,t,o,n){this.id=i;this.items=e;this.depth=o;this.collapsed=n;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._index=e.length-1,this.updateLabels(t),this._updateLabelDisposable=t.label.onDidRender(()=>this.updateLabels(t))}static{this.ID=0}get index(){return this._index}get count(){return this.items.length}get current(){return this.items[this._index]}get currentId(){return`${this.id}_${this.index}`}get labels(){return this._labels}updateLabels(i){this._labels=Array.from(i.container.querySelectorAll(".label-name"));let e="";for(let t=0;t<this.labels.length;t++){let o=e.length?`${this.items[t].name}, compact, ${e}`:this.items[t].name;this.labels[t].setAttribute("aria-label",o),this.labels[t].setAttribute("aria-level",`${this.depth+t}`),e=e.length?`${this.items[t].name} ${e}`:this.items[t].name}this.updateCollapsed(this.collapsed),this._index<this.labels.length&&this.labels[this._index].classList.add("active")}previous(){this._index<=0||this.setIndex(this._index-1)}next(){this._index>=this.items.length-1||this.setIndex(this._index+1)}first(){this._index!==0&&this.setIndex(0)}last(){this._index!==this.items.length-1&&this.setIndex(this.items.length-1)}setIndex(i){i<0||i>=this.items.length||(this.labels[this._index].classList.remove("active"),this._index=i,this.labels[this._index].classList.add("active"),this._onDidChange.fire())}updateCollapsed(i){this.collapsed=i;for(let e=0;e<this.labels.length;e++)this.labels[e].setAttribute("aria-expanded",i?"false":"true")}dispose(){this._onDidChange.dispose(),this._updateLabelDisposable.dispose()}},b6=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.labels=e;this.highlightTree=t;this.updateWidth=o;this.contextViewService=n;this.themeService=r;this.configurationService=s;this.explorerService=l;this.labelService=c;this.contextService=u;this.contextMenuService=p;this.instantiationService=h;this.compressedNavigationControllers=new Map;this._onDidChangeActiveDescendant=new Cy;this.onDidChangeActiveDescendant=this._onDidChangeActiveDescendant.event;this.config=this.configurationService.getValue();let g=()=>{let f=this.configurationService.getValue("workbench.tree.indent"),v=Math.max(22-f,0);i.style.setProperty("--vscode-explorer-align-offset-margin-left",`${v}px`)};this.configListener=this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration("explorer")&&(this.config=this.configurationService.getValue()),f.affectsConfiguration("workbench.tree.indent")&&g()}),g()}static{this.ID="file"}getWidgetAriaLabel(){return d(12319,null)}get templateId(){return b6.ID}renderTemplate(i){let e=new O,t=e.add(this.labels.create(i,{supportHighlights:!0}));e.add(t.onDidRender(()=>{kr(Me(n.container),()=>{try{n.currentContext&&this.updateWidth(n.currentContext)}catch{}})}));let o=qqt.create(this.instantiationService,i,e);e.add(qqt.onDidRegisterDescriptor(r=>{let s=r.create(this.instantiationService,i);o.push(e.add(s)),s.setResource(n.currentContext?.resource)}));let n={templateDisposables:e,elementDisposables:e.add(new O),label:t,container:i,contribs:o};return n}renderElement(i,e,t){let o=i.element;t.currentContext=o;let n=this.explorerService.getEditableData(o);t.label.element.classList.remove("compressed"),n?(t.label.element.style.display="none",t.contribs.forEach(r=>r.setResource(void 0)),t.elementDisposables.add(this.renderInputBox(t.container,o,n))):(t.label.element.style.display="flex",this.renderStat(o,o.name,void 0,i.filterData,t))}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];t.currentContext=o;let n=i.element.elements.filter(s=>this.explorerService.isEditable(s)),r=n.length===0?void 0:this.explorerService.getEditableData(n[0]);if(r)t.label.element.classList.remove("compressed"),t.label.element.style.display="none",t.contribs.forEach(s=>s.setResource(void 0)),t.elementDisposables.add(this.renderInputBox(t.container,n[0],r));else{t.label.element.classList.add("compressed"),t.label.element.style.display="flex";let s=`compressed-explorer_${Qqt.ID++}`,l=i.element.elements.map(h=>h.name),c=i.filterData;if(c&&c.length>2){let h=l.join("/").length-l[l.length-1].length;c=[c[0],c[1]+h,...c.slice(2)]}this.renderStat(o,l,s,c,t);let u=new Qqt(s,i.element.elements,t,i.depth,i.collapsed);t.elementDisposables.add(u);let p=this.compressedNavigationControllers.get(o)??[];this.compressedNavigationControllers.set(o,[...p,u]),t.elementDisposables.add(this._onDidChangeActiveDescendant.add(u.onDidChange)),t.elementDisposables.add($(t.container,"mousedown",h=>{let g=Yqt(h.target);g&&u.setIndex(g.index)})),t.elementDisposables.add(ee(()=>{let h=this.compressedNavigationControllers.get(o)??[],g=h.findIndex(f=>f===u);if(g<0)throw new Error("Disposing unknown navigation controller");h.length===1?this.compressedNavigationControllers.delete(o):h.splice(g,1)}))}}renderStat(i,e,t,o,n){n.label.element.style.display="flex";let r=["explorer-item"];this.explorerService.isCut(i)&&r.push("cut");let s=this.themeService.getFileIconTheme();n.container.parentElement?.parentElement?.querySelector(".monaco-tl-twistie")?.classList.toggle("force-twistie",i.hasNests&&s.hidesExplorerArrows);let c=s.hasFileIcons&&(s.hidesExplorerArrows||!s.hasFolderIcons),u=i.nestedParent&&c;n.contribs.forEach(h=>h.setResource(i.resource)),n.label.setResource({resource:i.resource,name:e},{fileKind:i.isRoot?2:i.isDirectory?1:0,extraClasses:u?[...r,"align-nest-icon-with-parent-icon"]:r,fileDecorations:this.config.explorer.decorations,matches:Wa(o),separator:this.labelService.getSeparator(i.resource.scheme,i.resource.authority),domId:t});let p=i.isDirectory?this.highlightTree.get(i):0;if(p>0){let h=new eb(n.label.element.lastElementChild,{},{...VI,badgeBackground:Tt(x7i),badgeBorder:Tt(k7i)});h.setCount(p),h.setTitleFormat(d(12311,null,p)),n.elementDisposables.add(h)}n.label.element.classList.toggle("highlight-badge",p>0)}renderInputBox(i,e,t){let o=this.labels.create(i),n=["explorer-item","explorer-item-edited"],r=e.isRoot?2:e.isDirectory?1:0,s=this.themeService.getFileIconTheme(),l=s.hasFileIcons&&(s.hidesExplorerArrows||!s.hasFolderIcons),c=e.nestedParent&&l,u={hidePath:!0,hideLabel:!0,fileKind:r,extraClasses:c?[...n,"align-nest-icon-with-parent-icon"]:n},p=e.name?ai(e.resource):e.resource,h=e.name||"";o.setFile(Ve(p,h||" "),u),o.element.firstElementChild.style.display="none";let g=new ad(o.element,this.contextViewService,{validationOptions:{validation:w=>{let x=t.validationMessage(w);return!x||x.severity!==ft.Error?null:{content:x.content,formatContent:!0,type:3}}},ariaLabel:d(12312,null),inputBoxStyles:Wl}),f=h.lastIndexOf("."),v="prefix";g.value=h,g.focus(),g.select({start:0,end:f>0&&!e.isDirectory?f:h.length});let b=bd((w,x)=>{o.element.style.display="none";let E=g.value;je(y),o.element.remove(),x&&t.onFinish(E,w)}),S=()=>{if(g.isInputValid()){let w=t.validationMessage(g.value);w?g.showMessage({content:w.content,formatContent:!0,type:w.severity===ft.Info?1:w.severity===ft.Warning?2:3}):g.hideMessage()}};S();let y=[g,g.onDidChange(w=>{o.setFile(Ve(p,w||" "),u)}),Yo(g.inputElement,ne.KEY_DOWN,w=>{if(w.equals(60)){let x=g.value.lastIndexOf(".");if(e.isDirectory||x===-1)return;v==="prefix"?(v="all",g.select({start:0,end:g.value.length})):v==="all"?(v="suffix",g.select({start:x+1,end:g.value.length})):(v="prefix",g.select({start:0,end:x}))}else w.equals(3)?g.validate()||b(!0,!0):w.equals(9)&&b(!1,!0)}),Yo(g.inputElement,ne.KEY_UP,w=>{S()}),$(g.inputElement,ne.BLUR,async()=>{for(;;){await Li(0);let w=g.inputElement.ownerDocument;if(!w.hasFocus())break;if(Na(g.inputElement))return;if(go(w.activeElement)&&Awe(w.activeElement,"context-view"))await U.toPromise(this.contextMenuService.onDidHideContextMenu);else break}b(g.isInputValid(),!0)}),o];return ee(()=>{b(!1,!1)})}disposeElement(i,e,t){t.currentContext=void 0,t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.currentContext=void 0,t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}getCompressedNavigationController(i){return this.compressedNavigationControllers.get(i)}getAriaLabel(i){return i.name}getAriaLevel(i){let e=0,t=i.parent;for(;t;)t=t.parent,e++;return this.contextService.getWorkbenchState()===3&&(e=e+1),e}getActiveDescendantId(i){return this.compressedNavigationControllers.get(i)?.[0]?.currentId??void 0}dispose(){this.configListener.dispose()}};b6=I([m(4,qn),m(5,Pe),m(6,B),m(7,Qa),m(8,nt),m(9,Ae),m(10,Xe),m(11,F)],b6);var V0e=class{constructor(i,e,t,o,n,r){this.contextService=i;this.configurationService=e;this.explorerService=t;this.editorService=o;this.uriIdentityService=n;this.fileService=r;this.hiddenExpressionPerRoot=new Map;this.editorsAffectingFilter=new Set;this._onDidChange=new T;this.toDispose=[];this.ignoreFileResourcesPerRoot=new Map;this.ignoreTreesPerRoot=new Map;this.toDispose.push(this._onDidChange),this.toDispose.push(this.contextService.onDidChangeWorkspaceFolders(()=>this.updateConfiguration())),this.toDispose.push(this.configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration("files.exclude")||s.affectsConfiguration("explorer.excludeGitIgnore"))&&this.updateConfiguration()})),this.toDispose.push(this.fileService.onDidFilesChange(s=>{for(let[l,c]of this.ignoreFileResourcesPerRoot.entries())c.forEach(async u=>{s.contains(u,0)&&await this.processIgnoreFile(l,u,!0),s.contains(u,2)&&(this.ignoreTreesPerRoot.get(l)?.delete(ai(u)),c.delete(u),this._onDidChange.fire())})})),this.toDispose.push(this.editorService.onDidVisibleEditorsChange(()=>{let s=this.editorService.visibleEditors,l=!1;for(let c of s){if(!c.resource)continue;if(this.explorerService.findClosest(c.resource)?.isExcluded){l=!0;break}}for(let c of this.editorsAffectingFilter)if(!s.includes(c)){l=!0;break}l&&(this.editorsAffectingFilter.clear(),this._onDidChange.fire())})),this.updateConfiguration()}get onDidChange(){return this._onDidChange.event}updateConfiguration(){let i=!1,e=!1;this.contextService.getWorkspace().folders.forEach(t=>{let o=this.configurationService.getValue({resource:t.uri}),n=o?.files?.exclude||Object.create(null),r=o.explorer.excludeGitIgnore;if(r&&!this.ignoreTreesPerRoot.has(t.uri.toString())&&(e=!0,this.ignoreFileResourcesPerRoot.set(t.uri.toString(),new xn),this.ignoreTreesPerRoot.set(t.uri.toString(),Hp.forUris(l=>this.uriIdentityService.extUri.ignorePathCasing(l)))),!r&&this.ignoreTreesPerRoot.has(t.uri.toString())&&(e=!0,this.ignoreFileResourcesPerRoot.delete(t.uri.toString()),this.ignoreTreesPerRoot.delete(t.uri.toString())),!i){let l=this.hiddenExpressionPerRoot.get(t.uri.toString());i=!l||!Qi(l.original,n)}let s=io(n);this.hiddenExpressionPerRoot.set(t.uri.toString(),{original:s,parsed:Eh(s)})}),(i||e)&&(this.editorsAffectingFilter.clear(),this._onDidChange.fire())}async processIgnoreFile(i,e,t){let o=ai(e),n=this.ignoreTreesPerRoot.get(i);if(!n||!t&&n.has(o))return;let r=await this.fileService.readFile(e);if(t)n.get(o)?.updateContents(r.value.toString());else{let s=n.findSubstr(o),l=!this.fileService.hasCapability(e,1024),c=new Gqt(r.value.toString(),o.path,s,l);n.set(o,c),this.ignoreFileResourcesPerRoot.get(i)?.has(e)||this.ignoreFileResourcesPerRoot.get(i)?.add(e)}this._onDidChange.fire()}filter(i,e){return i.name===".gitignore"&&this.ignoreTreesPerRoot.has(i.root.resource.toString())?(this.processIgnoreFile(i.root.resource.toString(),i.resource,!1),!0):this.isVisible(i,e)}isVisible(i,e){if(i.isExcluded=!1,e===0)return i.isExcluded=!0,!1;if(this.explorerService.getEditableData(i))return!0;if((this.hiddenExpressionPerRoot.get(i.root.resource.toString())?.parsed(pA(i.root.resource.path,i.resource.path),i.name,r=>!!i.parent?.getChild(r))?!0:this.isIgnored(i.resource,i.root.resource,i.isDirectory))||i.parent?.isExcluded){i.isExcluded=!0;let s=this.editorService.visibleEditors.find(l=>l.resource&&this.uriIdentityService.extUri.isEqualOrParent(l.resource,i.resource));return s&&i.root===this.explorerService.findClosestRoot(i.resource)?(this.editorsAffectingFilter.add(s),!0):!1}return!0}isIgnored(i,e,t){let n=this.ignoreTreesPerRoot.get(e.toString())?.findSubstr(i)?.isPathIncludedInTraversal(i.path,t);return n===void 0?!1:!n}dispose(){je(this.toDispose)}};V0e=I([m(0,Ae),m(1,B),m(2,Qa),m(3,ie),m(4,gt),m(5,ge)],V0e);var B0e=class{constructor(i,e){this.explorerService=i;this.contextService=e}compare(i,e){if(i.isRoot){if(e.isRoot){let l=this.contextService.getWorkspaceFolder(i.resource),c=this.contextService.getWorkspaceFolder(e.resource);return l&&c?l.index-c.index:-1}return-1}if(e.isRoot)return 1;let t=this.explorerService.sortOrderConfiguration.sortOrder,o=this.explorerService.sortOrderConfiguration.lexicographicOptions;this.explorerService.sortOrderConfiguration.reverse&&([i,e]=[e,i]);let r,s;switch(o){case"upper":r=wgo,s=Ego;break;case"lower":r=Cgo,s=Tgo;break;case"unicode":r=xgo,s=_go;break;default:r=utt,s=kgo}switch(t){case"type":if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;if(i.isDirectory&&e.isDirectory)return r(i.name,e.name);break;case"filesFirst":if(i.isDirectory&&!e.isDirectory)return 1;if(e.isDirectory&&!i.isDirectory)return-1;break;case"foldersNestsFiles":if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;if(i.hasNests&&!e.hasNests)return-1;if(e.hasNests&&!i.hasNests)return 1;break;case"mixed":break;default:if(i.isDirectory&&!e.isDirectory)return-1;if(e.isDirectory&&!i.isDirectory)return 1;break}switch(t){case"type":return s(i.name,e.name);case"modified":return i.mtime!==e.mtime?i.mtime&&e.mtime&&i.mtime<e.mtime?1:-1:r(i.name,e.name);default:return r(i.name,e.name)}}};B0e=I([m(0,Qa),m(1,Ae)],B0e);var F_=class{constructor(i,e,t,o,n,r,s,l,c,u){this.isCollapsed=i;this.explorerService=e;this.editorService=t;this.dialogService=o;this.contextService=n;this.fileService=r;this.configurationService=s;this.instantiationService=l;this.workspaceEditingService=c;this.uriIdentityService=u;this.compressedDropTargetDisposable=k.None;this.disposables=new O;this.dropEnabled=!1;let p=h=>{(!h||h.affectsConfiguration("explorer.enableDragAndDrop"))&&(this.dropEnabled=this.configurationService.getValue("explorer.enableDragAndDrop"))};p(void 0),this.disposables.add(this.configurationService.onDidChangeConfiguration(h=>p(h)))}static{this.CONFIRM_DND_SETTING_KEY="explorer.confirmDragAndDrop"}onDragOver(i,e,t,o,n){if(!this.dropEnabled)return!1;if(e){let r=F_.getCompressedStatFromDragEvent(e,n);if(r){let s=Yqt(n.target);if(s&&s.index<s.count-1){let l=this.handleDragOver(i,r,t,o,n);return l?(s.element!==this.compressedDragOverElement&&(this.compressedDragOverElement=s.element,this.compressedDropTargetDisposable.dispose(),this.compressedDropTargetDisposable=ee(()=>{s.element.classList.remove("drop-target"),this.compressedDragOverElement=void 0}),s.element.classList.add("drop-target")),typeof l=="boolean"?l:{...l,feedback:[]}):(this.compressedDropTargetDisposable.dispose(),!1)}}}return this.compressedDropTargetDisposable.dispose(),this.handleDragOver(i,e,t,o,n)}handleDragOver(i,e,t,o,n){let r=n&&(n.ctrlKey&&!et||n.altKey&&et),s=i instanceof PK,c={type:s||r?0:1,position:"drop-target"};if(s){if(!Up(n,Fl.FILES,Mc.FILES,Fl.RESOURCES))return!1}else{if(i instanceof z8e)return!1;{let u=F_.getStatsFromDragAndDropData(i),p=u.every(h=>h.isRoot);if(!e)return!r&&u.every(h=>!!h.parent&&h.parent.isRoot)?!1:p?{accept:!0,effect:{type:1,position:"drop-target-after"}}:{accept:!0,bubble:0,effect:c,autoExpand:!1};if(!Array.isArray(u)||!r&&u.every(h=>h.isReadonly)||u.some(h=>h.isRoot?!1:!!(this.uriIdentityService.extUri.isEqual(h.resource,e.resource)||!r&&this.uriIdentityService.extUri.isEqual(ai(h.resource),e.resource)||this.uriIdentityService.extUri.isEqualOrParent(e.resource,h.resource))))return!1;if(p){if(!e.isRoot)return!1;let h;switch(o){case 0:case 1:h="drop-target-before";break;case 2:case 3:h="drop-target-after";break}return{accept:!0,effect:{type:1,position:h}}}}}if(e){if(e.isDirectory)return e.isReadonly?!1:{accept:!0,bubble:0,effect:c,autoExpand:!0};if(this.contextService.getWorkspace().folders.every(u=>u.uri.toString()!==e.resource.toString()))return{accept:!0,bubble:1,effect:c}}else return{accept:!0,bubble:0,effect:c};return!1}getDragURI(i){return this.explorerService.isEditable(i)?null:i.resource.toString()}getDragLabel(i,e){return i.length===1?F_.getCompressedStatFromDragEvent(i[0],e).name:String(i.length)}onDragStart(i,e){let t=F_.getStatsFromDragAndDropData(i,e);if(t.length&&e.dataTransfer){this.instantiationService.invokeFunction(n=>kv(n,t,e));let o=t.filter(n=>n.resource.scheme===Q.file).map(n=>n.resource.fsPath);o.length&&e.dataTransfer.setData(Mc.FILES,JSON.stringify(o))}}async drop(i,e,t,o,n){if(this.compressedDropTargetDisposable.dispose(),e){let s=F_.getCompressedStatFromDragEvent(e,n);s&&(e=s)}if(e||(e=this.explorerService.roots[this.explorerService.roots.length-1],o=3),!e.isDirectory&&e.parent&&(e=e.parent),e.isReadonly)return;let r=e;if(r)try{i instanceof PK?!Ft||tC(this.contextService.getWorkspace())&&Vk.supported(ut)?await this.instantiationService.createInstance(IFe).import(r,n,ut):await this.instantiationService.createInstance(e1).upload(e,n):await this.handleExplorerDrop(i,r,t,o,n)}catch(s){this.dialogService.error(Mn(s))}}async handleExplorerDrop(i,e,t,o,n){let r=F_.getStatsFromDragAndDropData(i),s=new Map(r.map(h=>[h,this.isCollapsed(h)]));for(let[h,g]of s)if(g){let f=h.nestedChildren;if(f)for(let v of f)s.set(v,!0)}let l=p4e([...s.keys()],h=>h.resource),c=n.ctrlKey&&!et||n.altKey&&et;if(!c&&this.configurationService.getValue(F_.CONFIRM_DND_SETTING_KEY)){let h=l.length>1&&l.every(v=>v.isRoot)?d(12307,null):l.length>1?d(12305,null,l.length,e.name):l[0].isRoot?d(12306,null,l[0].name):d(12304,null,l[0].name,e.name),g=l.length>1&&!l.every(v=>v.isRoot)?fx(l.map(v=>v.resource)):void 0,f=await this.dialogService.confirm({message:h,detail:g,checkbox:{label:d(12310,null)},primaryButton:d(12314,null)});if(!f.confirmed)return;f.checkboxChecked===!0&&await this.configurationService.updateValue(F_.CONFIRM_DND_SETTING_KEY,!1)}await this.doHandleRootDrop(l.filter(h=>h.isRoot),e,o);let p=l.filter(h=>!h.isRoot);return c?this.doHandleExplorerDropOnCopy(p,e):this.doHandleExplorerDropOnMove(p,e)}async doHandleRootDrop(i,e,t){if(i.length===0)return;let o=this.contextService.getWorkspace().folders,n,r=[],s=[],l=[];for(let c=0;c<o.length;c++){let u={uri:o[c].uri,name:o[c].name};e instanceof Tf&&this.uriIdentityService.extUri.isEqual(o[c].uri,e.resource)&&(n=c);for(let p of i)if(this.uriIdentityService.extUri.isEqual(o[c].uri,p.resource)){r.push(c);break}i.every(p=>p.resource.toString()!==o[c].uri.toString())?s.push(u):l.push(u)}if(n===void 0)n=s.length;else{switch(t){case 3:case 2:n++;break}for(let c of r)c<n&&n--}return s.splice(n,0,...l),this.workspaceEditingService.updateFolders(0,s.length,s)}async doHandleExplorerDropOnCopy(i,e){let t=this.configurationService.getValue().explorer,o=[];for(let{resource:s,isDirectory:l}of i){let c=t.incrementalNaming==="disabled",u=await CGt(this.explorerService,this.fileService,this.dialogService,e,{resource:s,isDirectory:l,allowOverwrite:c},t.incrementalNaming);if(!u)continue;let p=new Yu(s,u,{copy:!0,overwrite:c});o.push(p)}let n=Oko(i);await this.explorerService.applyBulkEdit(o,{confirmBeforeUndo:t.confirmUndo==="default"||t.confirmUndo==="verbose",undoLabel:d(12308,null,n),progressLabel:d(12309,null,n)});let r=o.filter(s=>{let l=s.newResource?this.explorerService.findClosest(s.newResource):void 0;return l&&!l.isDirectory}).map(s=>({resource:s.newResource,options:{pinned:!0}}));await this.editorService.openEditors(r)}async doHandleExplorerDropOnMove(i,e){let t=i.filter(r=>!r.isReadonly).map(r=>new Yu(r.resource,Ve(e.resource,r.name))),o=Oko(i),n={confirmBeforeUndo:this.configurationService.getValue().explorer.confirmUndo==="verbose",undoLabel:d(12313,null,o),progressLabel:d(12315,null,o)};try{await this.explorerService.applyBulkEdit(t,n)}catch(r){if(r.fileOperationResult===4){let s=[];for(let u of t)u.newResource&&await this.fileService.exists(u.newResource)&&s.push(u.newResource);let l=$wo(s),{confirmed:c}=await this.dialogService.confirm(l);c&&await this.explorerService.applyBulkEdit(t.map(u=>new Yu(u.oldResource,u.newResource,{overwrite:!0})),n)}else throw r}}static getStatsFromDragAndDropData(i,e){return i.context?i.context:e&&i.elements.length===1?(i.context=[F_.getCompressedStatFromDragEvent(i.elements[0],e)],i.context):i.elements}static getCompressedStatFromDragEvent(i,e){let t=Me(e).document.elementFromPoint(e.clientX,e.clientY),o=Yqt(t);if(o){let{count:n,index:r}=o,s=n-1;for(;s>r&&i.parent;)i=i.parent,s--;return i}return i}onDragEnd(){this.compressedDropTargetDisposable.dispose()}dispose(){this.compressedDropTargetDisposable.dispose()}};F_=I([m(1,Qa),m(2,ie),m(3,ct),m(4,Ae),m(5,ge),m(6,B),m(7,F),m(8,iS),m(9,gt)],F_);function Yqt(a){if(!go(a))return null;let i=a;for(;i&&!i.classList.contains("monaco-list-row");){if(i.classList.contains("label-name")&&i.hasAttribute("data-icon-label-count")){let e=Number(i.getAttribute("data-icon-label-count")),t=Number(i.getAttribute("data-icon-label-index"));if(on(e)&&on(t))return{element:i,count:e,index:t}}i=i.parentElement}return null}function Fko(a){return!!Yqt(a)}var Xqt=class{isIncompressible(i){return i.isRoot||!i.isDirectory||i instanceof t6||!i.parent||i.parent.isRoot}};function Oko(a){return a.length===1?a[0].name:a.every(i=>i.isDirectory)?d(12317,null,a.length):a.every(i=>!i.isDirectory)?d(12316,null,a.length):`${a.length} files and folders`}function Tun(a){if(a.isRoot&&a.error)return{tooltip:d(12293,null,Mn(a.error)),letter:"!",color:S7i};if(a.isSymbolicLink)return{tooltip:d(12295,null),letter:"\u2937"};if(a.isUnknown)return{tooltip:d(12296,null),letter:"?"};if(a.isExcluded)return{color:nyt}}var H0e=class{constructor(i,e){this.explorerService=i;this.label=d(12294,null);this._onDidChange=new T;this.toDispose=new O;this.toDispose.add(this._onDidChange),this.toDispose.add(e.onDidChangeWorkspaceFolders(t=>{this._onDidChange.fire(t.changed.concat(t.added).map(o=>o.uri))})),this.toDispose.add($qt.event((t=>{this._onDidChange.fire([t])})))}get onDidChange(){return this._onDidChange.event}async provideDecorations(i){let e=this.explorerService.findClosest(i);if(!e)throw new Error("ExplorerItem not found");return Tun(e)}dispose(){this.toDispose.dispose()}};H0e=I([m(0,Qa),m(1,Ae)],H0e);function _un(a,i){for(let e of i)if(a.hasNode(e)&&!a.isCollapsed(e)){for(let[,t]of e.children.entries())if(a.hasNode(t)&&a.isCollapsible(t)&&!a.isCollapsed(t))return!0}return!1}function Dun(a,i){for(let e of i)if(a.hasNode(e)&&!a.isCollapsed(e))return!0;return!1}var Run={getId:a=>a instanceof t6?`new:${a.getId()}`:a.getId()};function Lun(a,i,e,t){let o;o=a.length?a[0]:void 0,e&&i.length>1&&(o=void 0);let n=o&&t.getCompressedNavigationController(o),r=n?.length?n[0]:void 0;o=r?r.current:o;let s=[];for(let l of i){let u=t.getCompressedNavigationController(l)?.at(0);if(u&&o&&u===r){l===o&&s.push(l);continue}u?s.push(...u.items):s.push(l)}return o?e&&s.indexOf(o)>=0?s:[o]:e?s:[]}var fV=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K){super(e,p,t,g,h,o,n,H,b,y);this.contextService=r;this.progressService=s;this.editorService=l;this.editorResolverService=c;this.layoutService=u;this.decorationService=f;this.labelService=v;this.telemetryService=S;this.explorerService=w;this.storageService=x;this.clipboardService=E;this.fileService=M;this.uriIdentityService=N;this.commandService=V;this.accessibilityService=K;this._autoReveal=!1;this.delegate=e.delegate,this.resourceContext=n.createInstance(Ho),this._register(this.resourceContext),this.parentReadonlyContext=eTi.bindTo(h),this.folderContext=gu.bindTo(h),this.readonlyContext=ZEi.bindTo(h),this.availableEditorIdsContext=tBt.bindTo(h),this.rootContext=nk.bindTo(h),this.resourceMoveableToTrash=Che.bindTo(h),this.compressedFocusContext=xhe.bindTo(h),this.compressedFocusFirstContext=ytt.bindTo(h),this.compressedFocusLastContext=wtt.bindTo(h),this.viewHasSomeCollapsibleRootItem=ifo.bindTo(h),this.viewVisibleContextKey=z8.bindTo(h),this.explorerService.registerView(this)}static{this.TREE_VIEW_STATE_STORAGE_KEY="workbench.explorer.treeViewState"}get singleViewPaneContainerTitle(){return this.name}get autoReveal(){return this._autoReveal}set autoReveal(e){this._autoReveal=e}get name(){return this.labelService.getWorkspaceLabel(this.contextService.getWorkspace())}get title(){return this.name}set title(e){}setVisible(e){this.viewVisibleContextKey.set(e),super.setVisible(e)}get fileCopiedContextKey(){return AGt.bindTo(this.contextKeyService)}get resourceCutContextKey(){return iBt.bindTo(this.contextKeyService)}renderHeader(e){super.renderHeader(e),this.dragHandler=new oxe(e,()=>this.setExpanded(!0));let t=e.querySelector(".title"),o=()=>{t.textContent=this.name,this.updateTitle(this.name),this.ariaHeaderLabel=d(12301,null,this.name),t.setAttribute("aria-label",this.ariaHeaderLabel)};this._register(this.contextService.onDidChangeWorkspaceName(o)),this._register(this.labelService.onDidChangeFormatters(o)),o()}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}renderBody(e){super.renderBody(e),this.container=e,this.treeContainer=D(e,_(".explorer-folders-view")),this.createTree(this.treeContainer),this._register(this.labelService.onDidChangeFormatters(()=>{this._onDidChangeTitleArea.fire()})),this.onConfigurationUpdated(void 0),this._register(this.editorService.onDidActiveEditorChange(()=>{this.selectActiveFile()})),this._register(this.configurationService.onDidChangeConfiguration(t=>this.onConfigurationUpdated(t))),this._register(this.onDidChangeBodyVisibility(async t=>{t&&(await this.setTreeInput(),this.updateAnyCollapsedContext(),this.selectActiveFile(!0))})),this._register($(Me(this.container),ne.PASTE,async t=>{!this.hasFocus()||this.readonlyContext.get()||t.clipboardData?.files?.length&&await this.commandService.executeCommand("filesExplorer.paste",t.clipboardData?.files)}))}focus(){if(super.focus(),this.tree.domFocus(),this.tree.getFocusedPart()===0){let e=this.tree.getFocus();e.length===1&&this._autoReveal&&this.tree.reveal(e[0],.5)}}hasFocus(){return Is(this.container)}getFocus(){return this.tree.getFocus()}focusNext(){this.tree.focusNext()}focusLast(){this.tree.focusLast()}getContext(e){let t=this.tree.getFocusedPart()===1?this.tree.getStickyScrollFocus():this.tree.getFocus();return Lun(t,this.tree.getSelection(),e,this.renderer)}isItemVisible(e){return this.filter?this.filter.filter(e,1):!1}isItemCollapsed(e){return this.tree.isCollapsed(e)}async setEditable(e,t){t?(this.horizontalScrolling=this.tree.options.horizontalScrolling,this.horizontalScrolling&&this.tree.updateOptions({horizontalScrolling:!1}),await this.tree.expand(e.parent)):(this.horizontalScrolling!==void 0&&this.tree.updateOptions({horizontalScrolling:this.horizontalScrolling}),this.horizontalScrolling=void 0,this.treeContainer.classList.remove("highlight")),await this.refresh(!1,e.parent,!1),t?(this.treeContainer.classList.add("highlight"),this.tree.reveal(e)):this.tree.domFocus()}async selectActiveFile(e=this._autoReveal){if(this._autoReveal){let t=po.getCanonicalUri(this.editorService.activeEditor,{supportSideBySide:1});if(t){let o=this.tree.getFocus(),n=this.tree.getSelection();return o.length===1&&this.uriIdentityService.extUri.isEqual(o[0].resource,t)&&n.length===1&&this.uriIdentityService.extUri.isEqual(n[0].resource,t)?void 0:this.explorerService.select(t,e)}}}createTree(e){this.filter=this.instantiationService.createInstance(V0e),this._register(this.filter),this._register(this.filter.onDidChange(()=>this.refresh(!0)));let t=this.instantiationService.createInstance(jl,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._register(t),this.findProvider=this.instantiationService.createInstance(W0e,this.filter,()=>this.tree);let o=l=>this.tree.updateWidth(l);this.renderer=this.instantiationService.createInstance(b6,e,t,this.findProvider.highlightTree,o),this._register(this.renderer),this._register(S6(e,this.themeService));let n=()=>{let l=this.configurationService.getValue("explorer.compactFolders");return this.accessibilityService.isScreenReaderOptimized()?!1:l},r=l=>this.configurationService.getValue({resource:l?.root.resource}).explorer.fileNesting;this.tree=this.instantiationService.createInstance(qy,"FileExplorer",e,new Lst,new Xqt,[this.renderer],this.instantiationService.createInstance(F0e,this.filter,this.findProvider),{compressionEnabled:n(),accessibilityProvider:this.renderer,identityProvider:Run,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:l=>{if(!this.explorerService.isEditable(l))return l.name},getCompressedNodeKeyboardNavigationLabel:l=>{if(!l.some(c=>this.explorerService.isEditable(c)))return l.map(c=>c.name).join("/")}},multipleSelectionSupport:!0,filter:this.filter,sorter:this.instantiationService.createInstance(B0e),dnd:this.instantiationService.createInstance(F_,l=>this.isItemCollapsed(l)),collapseByDefault:l=>!(l instanceof Tf&&(l.hasNests&&r(l).expand||this.findProvider.isShowingFilterResults())),autoExpandSingleChildren:!0,expandOnlyOnTwistieClick:l=>{if(l instanceof Tf){if(l.hasNests)return!0;if(this.configurationService.getValue("workbench.tree.expandMode")==="doubleClick")return!0}return!1},paddingBottom:Lst.ITEM_HEIGHT,overrideStyles:this.getLocationBasedColors().listOverrideStyles,findProvider:this.findProvider}),this._register(this.tree),this._register(this.themeService.onDidColorThemeChange(()=>this.tree.rerender()));let s=U.filter(this.configurationService.onDidChangeConfiguration,l=>l.affectsConfiguration("explorer.compactFolders"));this._register(s(l=>this.tree.updateOptions({compressionEnabled:n()}))),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>{this.tree.updateOptions({compressionEnabled:n()})})),tTi.bindTo(this.tree.contextKeyService),Itt.bindTo(this.tree.contextKeyService),this._register(this.tree.onDidChangeFocus(l=>this.onFocusChanged(l.elements))),this.onFocusChanged([]),this._register(this.tree.onDidOpen(async l=>{let c=l.element;if(!c)return;if(!(sf(l.browserEvent)&&l.browserEvent.shiftKey)){if(c.isDirectory||this.explorerService.isEditable(void 0))return;this.telemetryService.publicLog2("workbenchActionExecuted",{id:"workbench.files.openFile",from:"explorer"});try{this.delegate?.willOpenElement(l.browserEvent),await this.editorService.openEditor({resource:c.resource,options:{preserveFocus:l.editorOptions.preserveFocus,pinned:l.editorOptions.pinned,source:1}},l.sideBySide?En:tr)}finally{this.delegate?.didOpenElement()}}})),this._register(this.tree.onContextMenu(l=>this.onContextMenu(l))),this._register(this.tree.onDidScroll(async l=>{let c=this.explorerService.getEditable();l.scrollTopChanged&&c&&this.tree.getRelativeTop(c.stat)===null&&await c.data.onFinish("",!1)})),this._register(this.tree.onDidChangeCollapseState(l=>{let c=l.node.element?.element;c&&this.renderer.getCompressedNavigationController(Array.isArray(c)?c[0]:c)?.forEach(p=>p.updateCollapsed(l.node.collapsed)),this.updateAnyCollapsedContext()})),this.updateAnyCollapsedContext(),this._register(this.tree.onMouseDblClick(l=>{let c=this.configurationService.getValue("workbench.list.scrollByPage");l.element===null&&!c&&this.commandService.executeCommand(Nfe)})),this._register(this.storageService.onWillSaveState(()=>{this.storeTreeViewState()}))}onConfigurationUpdated(e){if(!e||e.affectsConfiguration("explorer.autoReveal")){let t=this.configurationService.getValue();this._autoReveal=t?.explorer?.autoReveal}e&&(e.affectsConfiguration("explorer.decorations.colors")||e.affectsConfiguration("explorer.decorations.badges"))&&this.refresh(!0)}storeTreeViewState(){this.storageService.store(fV.TREE_VIEW_STATE_STORAGE_KEY,JSON.stringify(this.tree.getViewState()),1,1)}setContextKeys(e){let t=this.contextService.getWorkspace().folders,o=e?e.resource:t[t.length-1].uri;if(e=e||this.explorerService.findClosest(o),this.resourceContext.set(o),this.folderContext.set(!!e&&e.isDirectory),this.readonlyContext.set(!!e&&!!e.isReadonly),this.parentReadonlyContext.set(!!e?.parent?.isReadonly),this.rootContext.set(!!e&&e.isRoot),o){let n=o?this.editorResolverService.getEditors(o).map(r=>r.id):[];this.availableEditorIdsContext.set(n.join(","))}else this.availableEditorIdsContext.reset()}async onContextMenu(e){if(Ch(e.browserEvent.target))return;let t=e.element,o=e.anchor;if(go(o)&&t){let l=this.renderer.getCompressedNavigationController(t);l&&l.length>0&&(sf(e.browserEvent)||Fko(e.browserEvent.target)?o=l[0].labels[l[0].index]:l.forEach(c=>c.last()))}this.fileCopiedContextKey.set(await this.clipboardService.hasResources()),this.setContextKeys(t);let n=this.tree.getSelection(),r=this.explorerService.roots,s;if(t instanceof Tf){let l=this.renderer.getCompressedNavigationController(t);s=l?.length?l[0].current.resource:t.resource}else s=r.length===1?r[0].resource:{};this.contextMenuService.showContextMenu({menuId:R.ExplorerContext,menuActionOptions:{arg:s,shouldForwardArgs:!0},contextKeyService:this.tree.contextKeyService,getAnchor:()=>o,onHide:l=>{l&&this.tree.domFocus()},getActionsContext:()=>t&&n&&n.indexOf(t)>=0?n.map(l=>l.resource):t instanceof Tf?[t.resource]:[]})}onFocusChanged(e){let t=e.at(0);if(this.setContextKeys(t),t){let n=!!this.configurationService.getValue().files?.enableTrash,r=this.fileService.hasCapability(t.resource,4096);this.resourceMoveableToTrash.set(n&&r)}else this.resourceMoveableToTrash.reset();let o=t&&this.renderer.getCompressedNavigationController(t);if(!o){this.compressedFocusContext.set(!1);return}this.compressedFocusContext.set(!0),o.forEach(n=>{this.updateCompressedNavigationContextKeys(n)})}refresh(e,t,o=!0){if(!this.tree||!this.isBodyVisible()||t&&!this.tree.hasNode(t)||this.findProvider?.isShowingFilterResults()&&e)return Promise.resolve(void 0);o&&this.explorerService.isEditable(void 0)&&this.tree.domFocus();let n=t||this.tree.getInput();return this.tree.updateChildren(n,e,!!t)}getOptimalWidth(){let e=this.tree.getHTMLElement(),t=[].slice.call(e.querySelectorAll(".explorer-item .label-name"));return Pwe(e,t)}async setTreeInput(){if(!this.isBodyVisible())return Promise.resolve(void 0);this.setTreeInputPromise&&await this.setTreeInputPromise;let e=!this.tree.getInput();e&&Wo("code/willResolveExplorer");let t=this.explorerService.roots,o=t[0];(this.contextService.getWorkbenchState()!==2||t[0].error)&&(o=t);let n;if(this.tree?.getInput())n=this.tree.getViewState();else{let l=this.storageService.get(fV.TREE_VIEW_STATE_STORAGE_KEY,1);l&&(n=JSON.parse(l))}let r=this.tree.getInput(),s=this.setTreeInputPromise=this.tree.setInput(o,n).then(async()=>{if(Array.isArray(o)){if(!n||r instanceof Tf)for(let l=0;l<Math.min(o.length,5);l++)try{await this.tree.expand(o[l])}catch{}if(!r&&o.length===1&&this.configurationService.getValue().explorer.expandSingleFolderWorkspaces&&await this.tree.expand(o[0]).catch(()=>{}),Array.isArray(r)){let l=new dt;r.forEach(c=>l.set(c.resource,!0)),await Promise.all(o.map(async c=>{if(!l.has(c.resource))try{await this.tree.expand(c)}catch{}}))}}e&&Wo("code/didResolveExplorer")});this.progressService.withProgress({location:1,delay:this.layoutService.isRestored()?800:1500},l=>s),await s,this.decorationsProvider||(this.decorationsProvider=new H0e(this.explorerService,this.contextService),this._register(this.decorationService.registerDecorationsProvider(this.decorationsProvider)))}async selectResource(e,t=this._autoReveal,o=0){if(o===2||!e||!this.isBodyVisible())return;this.setTreeInputPromise&&await this.setTreeInputPromise;let n=this.explorerService.findClosestRoot(e);for(;n&&n.resource.toString()!==e.toString();){try{await this.tree.expand(n)}catch{return this.selectResource(e,t,o+1)}if(!n.children.size)n=null;else for(let r of n.children.values()){if(this.uriIdentityService.extUri.isEqualOrParent(e,r.resource)){n=r;break}n=null}}if(n){if(n===this.tree.getInput()){this.tree.setFocus([]),this.tree.setSelection([]);return}try{n.nestedParent&&await this.tree.expand(n.nestedParent),(t===!0||t==="force")&&this.tree.getRelativeTop(n)===null&&this.tree.reveal(n,.5),this.tree.setFocus([n]),this.tree.setSelection([n])}catch{return this.selectResource(e,t,o+1)}}}itemsCopied(e,t,o){this.fileCopiedContextKey.set(e.length>0),this.resourceCutContextKey.set(t&&e.length>0),o?.forEach(n=>this.tree.rerender(n)),t&&e.forEach(n=>this.tree.rerender(n))}expandAll(){this.explorerService.isEditable(void 0)&&this.tree.domFocus(),this.tree.expandAll()}collapseAll(){this.explorerService.isEditable(void 0)&&this.tree.domFocus();let e=this.tree.getInput();if(Array.isArray(e)&&_un(this.tree,e)){e.forEach(t=>{t.children.forEach(o=>this.tree.hasNode(o)&&this.tree.collapse(o,!0))});return}this.tree.collapseAll()}previousCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.previous(),this.updateCompressedNavigationContextKeys(o)})}nextCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.next(),this.updateCompressedNavigationContextKeys(o)})}firstCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.first(),this.updateCompressedNavigationContextKeys(o)})}lastCompressedStat(){let e=this.tree.getFocus();if(!e.length)return;this.renderer.getCompressedNavigationController(e[0]).forEach(o=>{o.last(),this.updateCompressedNavigationContextKeys(o)})}updateCompressedNavigationContextKeys(e){this.compressedFocusFirstContext.set(e.index===0),this.compressedFocusLastContext.set(e.index===e.count-1)}updateAnyCollapsedContext(){let e=this.tree.getInput();if(e===void 0)return;let t=Array.isArray(e)?e:Array.from(e.children.values());this.viewHasSomeCollapsibleRootItem.set(Dun(this.tree,t)),this.storeTreeViewState()}hasPhantomElements(){return!!this.findProvider?.isShowingFilterResults()}dispose(){this.dragHandler?.dispose(),super.dispose()}};I([bi],fV.prototype,"fileCopiedContextKey",1),I([bi],fV.prototype,"resourceCutContextKey",1),fV=I([m(1,Xe),m(2,ji),m(3,F),m(4,Ae),m(5,Go),m(6,ie),m(7,il),m(8,wi),m(9,Le),m(10,X),m(11,B),m(12,mb),m(13,nt),m(14,Pe),m(15,_e),m(16,ot),m(17,Qa),m(18,de),m(19,Bi),m(20,ge),m(21,gt),m(22,fe),m(23,Je),m(24,Ai)],fV);function S6(a,i){a.classList.add("file-icon-themable-tree"),a.classList.add("show-file-icons");let e=t=>{a.classList.toggle("align-icons-and-twisties",t.hasFileIcons&&!t.hasFolderIcons),a.classList.toggle("hide-arrows",t.hidesExplorerArrows===!0)};return e(i.getFileIconTheme()),i.onDidFileIconThemeChange(e)}var Wko=C.or(C.and(gu,kW),C.and(gu.toNegated(),eTi.toNegated()));W(class extends z{constructor(){super({id:"workbench.files.action.createFileFromExplorer",title:d(12299,null),f1:!1,icon:L.newFile,precondition:Wko,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",pS),order:10}})}run(a){a.get(fe).executeCommand(Nfe)}});W(class extends z{constructor(){super({id:"workbench.files.action.createFolderFromExplorer",title:d(12300,null),f1:!1,icon:L.newFolder,precondition:Wko,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",pS),order:20}})}run(a){a.get(fe).executeCommand(CFe)}});W(class extends z{constructor(){super({id:"workbench.files.action.refreshFilesExplorer",title:P(12302,"Refresh Explorer"),f1:!0,icon:L.refresh,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",pS),order:30},metadata:{description:P(12303,"Forces a refresh of the Explorer.")},precondition:oBt.negate()})}async run(a){let i=a.get(Gt),e=a.get(Qa);await i.openView(pS),await e.refresh()}});W(class extends z{constructor(){super({id:"workbench.files.action.collapseExplorerFolders",title:P(12297,"Collapse Folders in Explorer"),f1:!0,icon:L.collapseAll,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",pS),order:40},metadata:{description:P(12298,"Folds all folders in the Explorer.")}})}run(a){let e=a.get(Gt).getViewWithId(pS);e!==null&&e.collapseAll()}});var jq=class{constructor(i,e){this._itemFactory=i;this._options=e;this.pool=[];this._inUse=new Set}get inUse(){return this._inUse}get(){if(this.pool.length>0){let e=this.pool.pop();return this._inUse.add(e),e}let i=this._itemFactory();return this._inUse.add(i),i}release(i){this._inUse.delete(i),this.pool.push(i),this._scheduleTrim()}_scheduleTrim(){let i=this._options?.maxIdleSize;if(i===void 0||this.pool.length<=i)return;this._trimTimer!==void 0&&clearTimeout(this._trimTimer);let e=this._options?.trimIdleDelay??1e4;this._trimTimer=setTimeout(()=>{this._trimTimer=void 0,this._trimIdle()},e)}_trimIdle(){let i=this._options?.maxIdleSize;if(i!==void 0)for(;this.pool.length>i;)this.pool.pop().dispose()}clear(){this._trimTimer!==void 0&&(clearTimeout(this._trimTimer),this._trimTimer=void 0);for(let i of this.pool)i.dispose();this.pool.length=0}dispose(){this.clear();for(let i of this._inUse)i.dispose();this._inUse.clear()}},Jqt=class{constructor(i,e){this._itemFactory=i;this._options=e;this._idle=[];this._inUse=new Set;this._keyToItems=new Map;this._itemToKey=new Map}get inUse(){return this._inUse}get(i){let e=this._keyToItems.get(i);if(e){for(let o of e)if(!this._inUse.has(o)){let n=this._idle.indexOf(o);if(n!==-1)return this._idle.splice(n,1),this._inUse.add(o),o}}if(this._idle.length>0){let o=this._idle.pop();return this._inUse.add(o),o}let t=this._itemFactory();return this._inUse.add(t),t}release(i,e){this._inUse.delete(i),this._idle.push(i);let t=this._itemToKey.get(i);if(t!==void 0&&t!==e){let n=this._keyToItems.get(t);n&&(n.delete(i),n.size===0&&this._keyToItems.delete(t))}this._itemToKey.set(i,e);let o=this._keyToItems.get(e);o||(o=new Set,this._keyToItems.set(e,o)),o.add(i),this._scheduleTrim()}_scheduleTrim(){let i=this._options?.maxIdleSize;if(i===void 0||this._idle.length<=i)return;this._trimTimer!==void 0&&clearTimeout(this._trimTimer);let e=this._options?.trimIdleDelay??1e4;this._trimTimer=setTimeout(()=>{this._trimTimer=void 0,this._trimIdle()},e)}_trimIdle(){let i=this._options?.maxIdleSize;if(i!==void 0)for(;this._idle.length>i;){let e=this._idle.pop();this._removeFromMaps(e),e.dispose()}}_removeFromMaps(i){let e=this._itemToKey.get(i);if(e!==void 0){let t=this._keyToItems.get(e);t&&(t.delete(i),t.size===0&&this._keyToItems.delete(e)),this._itemToKey.delete(i)}}clear(){this._trimTimer!==void 0&&(clearTimeout(this._trimTimer),this._trimTimer=void 0);for(let i of this._idle)i.dispose();this._idle.length=0,this._keyToItems.clear(),this._itemToKey.clear()}dispose(){this.clear();for(let i of this._inUse)i.dispose();this._inUse.clear()}};var zAi=_,I6=class extends O_{constructor(e,t,o,n,r,s,l,c,u,p,h){super(t??(e.length>1?d(8827,null,e.length):d(8828,null,1)),o,r,p,h);this.data=e;this.contentReferencesListPool=n;this.openerService=s;this.menuService=l;this.instantiationService=c;this.contextMenuService=u;this.icon=L.check}initContent(){let t=this._register(this.contentReferencesListPool.get()).object;this._register(t.onDidOpen(l=>{if(l.element&&"reference"in l.element&&typeof l.element.reference=="object"){let c="variableName"in l.element.reference?l.element.reference.value:l.element.reference,u=A.isUri(c)?c:c?.uri;u&&this.openerService.open(u,{fromUserGesture:!0,editorOptions:{...l.editorOptions,selection:c&&"range"in c?c.range:void 0}})}})),this._register(t.onContextMenu(l=>{Kt.stop(l.browserEvent,!0);let c=l.element&&Mst(l.element);c&&this.contextMenuService.showContextMenu({getAnchor:()=>l.anchor,getActions:()=>{let u=this.menuService.getMenuActions(R.ChatAttachmentsContext,t.contextKeyService,{shouldForwardArgs:!0,arg:c});return Lu(u)}})}));let o=this._register(this.instantiationService.createInstance(Ho));this._register(t.onDidChangeFocus(l=>{o.reset();let c=l.elements.length?l.elements[0]:void 0,u=c&&Mst(c);o.set(u??null)}));let s=Math.min(this.data.length,6)*22;return t.layout(s),t.getHTMLElement().style.height=`${s}px`,t.splice(0,t.length,this.data),t.getHTMLElement().parentElement}hasSameContent(e,t,o){return e.kind==="references"&&e.references.length===this.data.length&&!!t.length===this.hasFollowingContent}};I6=I([m(5,Je),m(6,Yt),m(7,F),m(8,Xe),m(9,ot),m(10,B)],I6);var U0e=class extends I6{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,void 0,s,l,c,u,p,h);this.options=r;e.length===0&&Wi(this.domNode)}isExpanded(){let e=this.element;return e.usedReferencesExpanded??!!(this.options.expandedWhenEmptyResponse&&e.response.value.length===0)}setExpanded(e){let t=this.element;t.usedReferencesExpanded=!this.isExpanded()}};U0e=I([m(5,Je),m(6,Yt),m(7,F),m(8,Xe),m(9,ot),m(10,B)],U0e);var dne=class extends k{constructor(e,t,o,n,r,s){super();this._onDidChangeVisibility=e;this.menuId=t;this.listOptions=o;this.instantiationService=n;this.themeService=r;this.labelService=s;this._pool=this._register(new jq(()=>this.listFactory()))}get inUse(){return this._pool.inUse}listFactory(){let e=new O,t=e.add(this.instantiationService.createInstance(jl,{onDidChangeVisibility:this._onDidChangeVisibility})),o=zAi(".chat-used-context-list");return e.add(S6(o,this.themeService)),{list:e.add(this.instantiationService.createInstance(bc,"ChatListRenderer",o,new KAi,[this.instantiationService.createInstance(une,t,this.menuId)],{...this.listOptions,alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:r=>{if(r.kind==="warning")return r.content.value;let s=r.reference;return typeof s=="string"?s:"variableName"in s?s.variableName:A.isUri(s)?Jo(s.path):Jo(s.uri.path)},getWidgetAriaLabel:()=>d(8823,null)},dnd:{getDragURI:r=>Mst(r)?.toString()??null,getDragLabel:(r,s)=>{let l=ui(r.map(Mst));if(l.length)return l.length===1?this.labelService.getUriLabel(l[0],{relative:!0}):`${l.length}`},dispose:()=>{},onDragOver:()=>!1,drop:()=>{},onDragStart:(r,s)=>{try{let l=r.getData(),c=ui(l.map(Mst));this.instantiationService.invokeFunction(u=>kv(u,c,s))}catch{}}}})),dispose:()=>e.dispose()}}get(){let e=this._pool.get(),t=!1;return{object:e.list,isStale:()=>t,dispose:()=>{t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};dne=I([m(3,F),m(4,Pe),m(5,nt)],dne);var KAi=class{getHeight(i){return 22}getTemplateId(i){return une.TEMPLATE_ID}},une=class{constructor(i,e,t,o,n,r){this.labels=i;this.menuId=e;this.themeService=t;this.productService=o;this.instantiationService=n;this.contextKeyService=r;this.templateId=une.TEMPLATE_ID}static{this.TEMPLATE_ID="chatCollapsibleListRenderer"}renderTemplate(i){let e=new O,t=e.add(this.labels.create(i,{supportHighlights:!0,supportIcons:!0})),o=zAi(".working-set-line-counts"),n=_(".working-set-lines-added"),r=_(".working-set-lines-removed");o.appendChild(n),o.appendChild(r),t.element.appendChild(o);let s,l,c;if(this.menuId){l=zAi(".chat-collapsible-list-action-bar"),c=e.add(this.contextKeyService.createScoped(l));let u=e.add(this.instantiationService.createChild(new Po([X,c])));s=e.add(u.createInstance(pr,l,this.menuId,{menuOptions:{shouldForwardArgs:!0,arg:void 0}})),t.element.appendChild(l)}return{templateDisposables:e,label:t,toolbar:s,actionBarContainer:l,contextKeyService:c,fileDiffsContainer:o,addedSpan:n,removedSpan:r}}getReferenceIcon(i){return q.isThemeIcon(i.iconPath)?i.iconPath:cm(this.themeService.getColorTheme().type)&&i.iconPath?.dark?i.iconPath?.dark:i.iconPath?.light}renderElement(i,e,t){if(i.kind==="warning"){t.label.setResource({name:i.content.value},{icon:L.warning});return}let o=i.reference,n=this.getReferenceIcon(i);t.label.element.style.display="flex";let r;if(typeof o=="object"&&"variableName"in o)if(o.value){let s=A.isUri(o.value)?o.value:o.value.uri;t.label.setResource({resource:s,name:sl(s),description:`#${o.variableName}`,range:"range"in o.value?o.value.range:void 0},{icon:n,title:i.options?.status?.description??i.title})}else if(o.variableName.startsWith("kernelVariable")){let l=`${o.variableName.split(":")[1]}`;t.label.setLabel("Kernel variable",l,{title:i.options?.status?.description})}else t.label.setLabel(o.variableName,void 0,{title:i.options?.status?.description??i.title});else if(typeof o=="string")t.label.setLabel(o,void 0,{iconPath:A.isUri(n)?n:void 0,title:i.options?.status?.description??i.title});else{let s="uri"in o?o.uri:o;r=s;let l=i.excluded?["excluded"]:[];if(s.scheme==="https"&&vB(s.authority,"github.com")&&s.path.includes("/tree/"))t.label.setResource(Mun(s),{icon:L.github,title:i.title,strikethrough:i.excluded,extraClasses:l});else if(s.scheme===this.productService.urlProtocol&&vB(s.authority,KRe)){let c=s.path.substring(1);t.label.setResource({resource:s,name:c},{icon:L.settingsGear,title:d(8826,null,c),strikethrough:i.excluded,extraClasses:l})}else gB(s,Q.mailto,Q.http,Q.https)?t.label.setResource({resource:s,name:s.toString(!0)},{icon:n??L.globe,title:i.options?.status?.description??i.title??s.toString(!0),strikethrough:i.excluded,extraClasses:l}):t.label.setFile(s,{fileKind:0,fileDecorations:void 0,range:"range"in o?o.range:void 0,title:i.options?.status?.description??i.title,strikethrough:i.excluded,extraClasses:l})}for(let s of[".monaco-icon-suffix-container",".monaco-icon-name-container"]){let l=t.label.element.querySelector(s);l&&(i.options?.status?.kind===3||i.options?.status?.kind===2?l.classList.add("warning"):l.classList.remove("warning"))}if(i.state!==void 0){if(t.actionBarContainer||i.showModifiedState){let s=i?.options?.diffMeta;if(s){if(!t.fileDiffsContainer||!t.addedSpan||!t.removedSpan)return;t.addedSpan.textContent=`+${s.added}`,t.removedSpan.textContent=`-${s.removed}`,t.fileDiffsContainer.setAttribute("aria-label",d(8824,null,s.added,s.removed))}t.label.element.querySelector(".monaco-icon-name-container")?.classList.add("modified")}t.toolbar&&(t.toolbar.context=r),t.contextKeyService&&i.state!==void 0&&tG.bindTo(t.contextKeyService).set(i.state)}}disposeTemplate(i){i.templateDisposables.dispose()}};une=I([m(2,Pe),m(3,Ze),m(4,F),m(5,X)],une);function Mun(a){let i=a.path.split("/").slice(1,3).join("/"),e=a.path.split("/").slice(5),t=e.at(-1),o=Pun(a);return{resource:a,name:t??e.join("/"),description:[i,...e.slice(0,-1)].join("/"),range:o}}function Pun(a){if(!a.fragment)return;let i=a.fragment.match(/\bL(\d+)(?:-L(\d+))?/);if(!i)return;let e=parseInt(i[1]);if(isNaN(e))return;let t=i[2]?parseInt(i[2]):e;if(!isNaN(t))return{startLineNumber:e,startColumn:1,endLineNumber:t,endColumn:1}}function Mst(a){if(a.kind==="warning")return null;let{reference:i}=a;return typeof i=="string"||"variableName"in i?null:A.isUri(i)?i:i.uri}W(class Vko extends z{static{this.id="workbench.action.chat.addToChatAction"}constructor(){super({id:Vko.id,title:{...P(8822,"Add File to Chat")},f1:!1,menu:[{id:R.ChatAttachmentsContext,group:"chat",order:1,when:C.and(Ho.IsFileSystemResource,gu.negate())}]})}async run(i,e){let t=i.get(Lt);if(!e)return;let o=t.lastFocusedWidget;o&&o.attachmentModel.addFile(e)}});W(class Bko extends z{static{this.id="workbench.action.chat.copyLink"}constructor(){super({id:Bko.id,title:{...P(8825,"Copy Link")},f1:!1,menu:[{id:R.ChatAttachmentsContext,group:"chat",order:0,when:C.or(Ho.Scheme.isEqualTo(Q.http),Ho.Scheme.isEqualTo(Q.https))}]})}async run(i,e){await i.get(Bi).writeResources([e])}});var GAi=class{getHeight(i){return 22}getTemplateId(i){return Zqt.TEMPLATE_ID}},Zqt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="todoListRenderer"}renderTemplate(i){let e=new O,t=D(i,_("li.todo-item"));t.setAttribute("role","listitem");let o=D(t,_(".todo-status-icon.codicon"));o.setAttribute("aria-hidden","true");let n=D(t,_(".todo-content")),r=e.add(new ld(n,{supportIcons:!1}));return{templateDisposables:e,todoElement:t,statusIcon:o,iconLabel:r}}renderElement(i,e,t){let{todoElement:o,statusIcon:n,iconLabel:r}=t;n.className=`todo-status-icon codicon ${this.getStatusIconClass(i.status)}`,n.style.color=this.getStatusIconColor(i.status),r.setLabel(i.title);let s=this.getStatusText(i.status),l=d(8908,null,i.title,s);o.setAttribute("aria-label",l)}disposeTemplate(i){i.templateDisposables.dispose()}getStatusText(i){switch(i){case"completed":return d(8909,null);case"in-progress":return d(8910,null);default:return d(8911,null)}}getStatusIconClass(i){switch(i){case"completed":return"codicon-pass";case"in-progress":return"codicon-record";default:return"codicon-circle-outline"}}getStatusIconColor(i){switch(i){case"completed":return"var(--vscode-charts-green)";case"in-progress":return"var(--vscode-charts-blue)";default:return"var(--vscode-foreground)"}}},z0e=class extends k{constructor(e,t,o,n){super();this.chatTodoListService=e;this.instantiationService=t;this.contextKeyService=o;this.telemetryService=n;this._isExpanded=!1;this._userManuallyExpanded=!1;this._inChatTodoListContextKey=Z.inChatTodoList.bindTo(o),this.domNode=this.createChatTodoWidget();let r=this._register(nr(this.domNode));this._register(r.onDidFocus(()=>this._inChatTodoListContextKey.set(!0))),this._register(r.onDidBlur(()=>this._inChatTodoListContextKey.set(!1))),this._register(this.contextKeyService.onDidChangeContext(s=>{s.affectsSome(new Set([Z.requestInProgress.key]))&&this.updateClearButtonState()}))}get height(){return this.domNode.style.display==="none"?0:this.domNode.offsetHeight}hideWidget(){this.domNode.style.display="none"}createChatTodoWidget(){let e=_(".chat-todo-list-widget");e.style.display="none";let t=_(".todo-list-expand");this.expandoButton=this._register(new Pi(t,{supportIcons:!0})),this.expandoButton.element.setAttribute("aria-expanded",String(this._isExpanded)),this.expandoButton.element.setAttribute("aria-controls","todo-list-container");let o=_(".todo-list-title-section");return this.expandIcon=_(".expand-icon.codicon"),this.expandIcon.classList.add(this._isExpanded?"codicon-chevron-down":"codicon-chevron-right"),this.expandIcon.setAttribute("aria-hidden","true"),this.titleElement=_(".todo-list-title"),this.titleElement.id="todo-list-title",this.titleElement.textContent=d(8912,null),this.clearButtonContainer=_(".todo-clear-button-container"),this.createClearButton(),o.appendChild(this.expandIcon),o.appendChild(this.titleElement),this.expandoButton.element.appendChild(o),this.expandoButton.element.appendChild(this.clearButtonContainer),this.todoListContainer=_(".todo-list-container"),this.todoListContainer.style.display=this._isExpanded?"block":"none",this.todoListContainer.id="todo-list-container",this.todoListContainer.setAttribute("role","list"),this.todoListContainer.setAttribute("aria-labelledby","todo-list-title"),e.appendChild(t),e.appendChild(this.todoListContainer),this._register(this.expandoButton.onDidClick(()=>{this.toggleExpanded()})),e}createClearButton(){this.clearButton=new Pi(this.clearButtonContainer,{supportIcons:!0,ariaLabel:d(8903,null)}),this.clearButton.element.tabIndex=0,this.clearButton.icon=L.clearAll,this._register(this.clearButton),this._register(this.clearButton.onDidClick(()=>{let e=this._currentSessionResource?this.chatTodoListService.getTodos(this._currentSessionResource).length:0;this.telemetryService.publicLog2("chatTodoListWidget",{action:"clear",todoCount:e}),this.clearAllTodos()}))}render(e){if(!e){this.hideWidget();return}ze(this._currentSessionResource,e)||(this._userManuallyExpanded=!1,this._currentSessionResource=e,this.hideWidget()),this.updateTodoDisplay()}clear(e,t=!1){if(!e||this.domNode.style.display==="none")return;let o=this.chatTodoListService.getTodos(e);(t||o.length>0&&!o.some(r=>r.status!=="completed"))&&this.clearAllTodos()}hasTodos(){return this.domNode.classList.contains("has-todos")&&!!this._todoList&&this._todoList.length>0}hasFocus(){return Is(this.todoListContainer)}focus(){return this.hasTodos()?(this._isExpanded||this.toggleExpanded(),this._todoList?.domFocus(),this.hasFocus()):!1}updateTodoDisplay(){if(!this._currentSessionResource)return;let e=this.chatTodoListService.getTodos(this._currentSessionResource);if(!(e.length>0)){this.domNode.classList.remove("has-todos"),this.hideWidget();return}this.domNode.classList.add("has-todos"),this.renderTodoList(e),this.domNode.style.display="block"}renderTodoList(e){this.updateTitleElement(this.titleElement,e),e.every(c=>c.status==="not-started")&&(this._userManuallyExpanded=!1),this._todoList||(this._todoList=this._register(this.instantiationService.createInstance(bc,"ChatTodoListRenderer",this.todoListContainer,new GAi,[new Zqt],{alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:c=>{let u=this.getStatusText(c.status);return d(8908,null,c.title,u)},getWidgetAriaLabel:()=>d(8914,null)}})));let r=Math.min(e.length,6)*22;this._todoList.layout(r),this._todoList.getHTMLElement().style.height=`${r}px`,this._todoList.splice(0,this._todoList.length,e);let s=e.some(c=>c.status==="in-progress"),l=e.some(c=>c.status==="completed");this.updateClearButtonState(),(s||l)&&this._isExpanded&&!this._userManuallyExpanded&&(this._isExpanded=!1,this.expandoButton.element.setAttribute("aria-expanded","false"),this.todoListContainer.style.display="none",this.expandIcon.classList.remove("codicon-chevron-down"),this.expandIcon.classList.add("codicon-chevron-right"),this.updateTitleElement(this.titleElement,e))}toggleExpanded(){this._isExpanded=!this._isExpanded,this._userManuallyExpanded=!0,this.expandIcon.classList.toggle("codicon-chevron-down",this._isExpanded),this.expandIcon.classList.toggle("codicon-chevron-right",!this._isExpanded),this.todoListContainer.style.display=this._isExpanded?"block":"none";let e=this._currentSessionResource?this.chatTodoListService.getTodos(this._currentSessionResource).length:0;if(this.telemetryService.publicLog2("chatTodoListWidget",{action:this._isExpanded?"expand":"collapse",todoCount:e}),this._currentSessionResource){let t=this.chatTodoListService.getTodos(this._currentSessionResource);this.updateTitleElement(this.titleElement,t)}}clearAllTodos(){this._currentSessionResource&&(this.chatTodoListService.setTodos(this._currentSessionResource,[]),this.hideWidget())}updateClearButtonState(){if(!this._currentSessionResource)return;let t=this.chatTodoListService.getTodos(this._currentSessionResource).some(r=>r.status==="in-progress"),n=(Z.requestInProgress.getValue(this.contextKeyService)??!1)&&t;this.clearButton.enabled=!n,n?this.clearButton.setTitle(d(8904,null)):this.clearButton.setTitle(d(8903,null))}updateTitleElement(e,t){e.textContent="";let o=t.filter(h=>h.status==="completed").length,n=t.length,r=t.filter(h=>h.status==="in-progress"),s=r.length>0?r[0]:void 0,l=t.filter(h=>h.status==="not-started"),c=l.length>0?l[0]:void 0,u=r.length>0?o+1:Math.max(1,o),p=this._isExpanded?d(8905,null):d(8907,null);if(this.expandoButton.element.setAttribute("aria-label",p),this.expandoButton.element.setAttribute("aria-expanded",this._isExpanded?"true":"false"),this._isExpanded){let h=_("span");h.textContent=n>0?d(8913,null,u,n):d(8912,null),e.appendChild(h)}else{let h=s||c;if(h){let g=_(".codicon");h===s?(g.classList.add("codicon-record"),g.style.color="var(--vscode-charts-blue)"):(g.classList.add("codicon-circle-outline"),g.style.color="var(--vscode-foreground)"),g.style.marginRight="4px",g.style.verticalAlign="middle",e.appendChild(g);let f=_("span");f.textContent=d(8906,null,h.title,u,n),f.style.verticalAlign="middle",f.style.overflow="hidden",f.style.textOverflow="ellipsis",f.style.whiteSpace="nowrap",f.style.minWidth="0",e.appendChild(f)}else if(o>0&&o===n){let g=_("span");g.textContent=d(8913,null,n,n),g.style.verticalAlign="middle",e.appendChild(g)}}}getStatusText(e){switch(e){case"completed":return d(8909,null);case"in-progress":return d(8910,null);default:return d(8911,null)}}};z0e=I([m(0,vW),m(1,F),m(2,X),m(3,_e)],z0e);var Hko={devServer:L.globe,screenshot:L.file,plan:L.book};function i$t(a){return a.kind==="group"}function Uko(a){return a.kind==="leaf"}var Qq=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._chatArtifactsService=e;this._instantiationService=t;this._openerService=o;this._configurationService=n;this._commandService=r;this._fileService=s;this._fileDialogService=l;this._chatImageCarouselService=c;this._sessionResource=De(this,void 0);this._isCollapsed=De(this,!1);this._currentArtifacts=ke(this,e=>{let t=this._sessionResource.read(e);return t?this._chatArtifactsService.getArtifacts(t):void 0});this._treeData=ke(this,e=>{let t=this._currentArtifacts.read(e);if(!t)return;let o=t.artifactGroups.read(e),n=o.reduce((u,p)=>u+p.artifacts.length,0);if(n===0)return;let r=o.length>1,s=Nun(o,r,u=>this._clearSource(u)),l=zko(s),c=Math.min(l,Qq.MAX_ITEMS_SHOWN);return{totalCount:n,treeElements:s,treeHeight:c*Qq.ELEMENT_HEIGHT}});this.domNode=_(".chat-artifacts-widget"),this.domNode.style.display="none",this._register(ve(u=>{let p=this._currentArtifacts.read(u);if(St(this.domNode),!p){this.domNode.style.display="none";return}let h=u.store,g=_(".chat-artifacts-expand"),f=h.add(new Pi(g,{supportIcons:!0})),v=_(".chat-artifacts-title-section"),b=_(".expand-icon.codicon");b.setAttribute("aria-hidden","true");let S=_(".chat-artifacts-title");v.appendChild(b),v.appendChild(S),f.element.appendChild(v),this.domNode.appendChild(g);let y=_(".chat-artifacts-list");this.domNode.appendChild(y);let w=h.add(this._instantiationService.createInstance(hf,"ChatArtifactsTree",y,new qAi,[new e$t,new t$t(x=>this._saveArtifact(x))],{alwaysConsumeMouseWheel:!1,accessibilityProvider:new $Ai}));h.add(w.onDidOpen(x=>{x.element&&(i$t(x.element)?x.element.onlyShowGroup&&this._openGroupInCarousel(x.element):Uko(x.element)&&this._openLeafArtifact(x.element.artifact))})),h.add(f.onDidClick(()=>{this._isCollapsed.set(!this._isCollapsed.read(void 0),void 0)})),h.add(ve(x=>{let E=this._isCollapsed.read(x);b.classList.toggle("codicon-chevron-down",!E),b.classList.toggle("codicon-chevron-right",E),f.element.setAttribute("aria-expanded",String(!E)),y.style.display=E?"none":"block"})),h.add(ve(x=>{let E=this._treeData.read(x);if(!E){this.domNode.style.display="none";return}this.domNode.style.display="",S.textContent=E.totalCount===1?d(8681,null):d(8679,null,E.totalCount),w.layout(E.treeHeight),w.getHTMLElement().style.height=`${E.treeHeight}px`,w.setChildren(null,E.treeElements)}))}))}static{this.ELEMENT_HEIGHT=22}static{this.MAX_ITEMS_SHOWN=6}setSessionResource(e){this._sessionResource.set(e,void 0)}async _openGroupInCarousel(e){let t=e.artifacts[0];t?.uri&&await this._chatImageCarouselService.openCarouselAtResource(A.parse(t.uri))}_openLeafArtifact(e){if(e.type==="screenshot"&&this._configurationService.getValue("imageCarousel.chat.enabled"))this._openScreenshotInCarousel(e);else if(e.uri){let t=A.parse(e.uri);if(Fet.isChatMemoryFileUri(t))this._openMemoryFileArtifact(t);else{let o=vst(t,this._configurationService);this._openerService.open(t,{fromUserGesture:!0,editorOptions:{override:o}})}}}async _openScreenshotInCarousel(e){e.uri&&await this._chatImageCarouselService.openCarouselAtResource(A.parse(e.uri))}async _openMemoryFileArtifact(e){let{memoryPath:t,sessionResource:o}=Fet.parse(e),n=await this._commandService.executeCommand("github.copilot.chat.tools.memory.resolveMemoryFileUri",t,o);if(n){let r=A.parse(n),s=vst(r,this._configurationService);this._openerService.open(r,{fromUserGesture:!0,editorOptions:{override:s}})}}_clearSource(e){let t=this._currentArtifacts.get();if(t)switch(e.kind){case"agent":t.clearAgentArtifacts();break;case"subagent":t.clearSubagentArtifacts(e.invocationId);break}}async _saveArtifact(e){let t=A.parse(e.uri),o=t.path.split("/").pop()??e.label,n=await this._fileDialogService.defaultFilePath(),r=A.joinPath(n,o),s=await this._fileDialogService.showSaveDialog({defaultUri:r,title:d(8683,null)});if(s){let l=await this._fileService.readFile(t);await this._fileService.writeFile(s,l.value)}}};Qq=I([m(0,LG),m(1,F),m(2,Je),m(3,B),m(4,fe),m(5,ge),m(6,nn),m(7,Eoe)],Qq);function Aun(a){switch(a.kind){case"rules":return d(8685,null);case"agent":return d(8684,null);case"subagent":return a.name??d(8686,null)}}function Nun(a,i,e){let t=[];for(let o of a){let n=i?Aun(o.source):void 0,s=o.source.kind!=="rules"?()=>e(o.source):void 0,l=new Map,c=[];for(let u of o.artifacts)if(u.groupName){let p=l.get(u.groupName);p||(p={config:{groupName:u.groupName,onlyShowGroup:u.onlyShowGroup??!1},artifacts:[]},l.set(u.groupName,p)),p.artifacts.push(u)}else c.push(u);for(let[,u]of l){let p=n?`${n}: ${u.config.groupName}`:u.config.groupName;if(u.artifacts.length===1&&!u.config.onlyShowGroup){t.push({element:{kind:"leaf",artifact:u.artifacts[0],description:p,onClear:s}});continue}let h={kind:"group",groupName:p,artifacts:u.artifacts,onlyShowGroup:u.config.onlyShowGroup,onClear:s};u.config.onlyShowGroup?t.push({element:h,collapsible:!1,collapsed:!1}):t.push({element:h,collapsible:!0,collapsed:!1,children:u.artifacts.map(g=>({element:{kind:"leaf",artifact:g}}))})}if(c.length>0&&n)if(c.length===1)t.push({element:{kind:"leaf",artifact:c[0],description:n,onClear:s}});else{let u={kind:"group",groupName:n,artifacts:c,onlyShowGroup:!1,onClear:s};t.push({element:u,collapsible:!0,collapsed:!1,children:c.map(p=>({element:{kind:"leaf",artifact:p}}))})}else for(let u of c)t.push({element:{kind:"leaf",artifact:u,onClear:s}})}return t}function zko(a){let i=0;for(let e of a)i++,e.children&&!e.collapsed&&(i+=zko([...e.children]));return i}var qAi=class{getHeight(){return Qq.ELEMENT_HEIGHT}getTemplateId(i){return i$t(i)?e$t.TEMPLATE_ID:t$t.TEMPLATE_ID}},$Ai=class{getAriaLabel(i){return i$t(i)?d(8680,null,i.groupName,i.artifacts.length):i.artifact.label}getWidgetAriaLabel(){return d(8687,null)}},e$t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="chatArtifactGroupRenderer"}renderTemplate(i){let e=D(i,_(".chat-artifacts-list-row")),t=D(e,_(".chat-artifacts-list-icon")),o=D(e,_(".chat-artifacts-list-label")),n=D(e,_(".chat-artifacts-list-actions")),r=new O,s=new oo(n);return{container:e,iconElement:t,labelElement:o,actionBar:s,elementDisposables:r}}renderElement(i,e,t){let o=i.element;if(!i$t(o))return;t.elementDisposables.clear();let n=o.artifacts[0]?.type,r=n&&Hko[n]||L.archive;if(t.iconElement.className="chat-artifacts-list-icon "+q.asClassName(r),t.labelElement.textContent=`${o.groupName} (${o.artifacts.length})`,t.container.title=o.groupName,t.actionBar.clear(),o.onClear){let s=o.onClear;t.actionBar.push(li({id:"chatArtifacts.clearSource",label:d(8678,null),class:q.asClassName(L.close),run:()=>s()}),{icon:!0,label:!1})}}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.actionBar.dispose()}},t$t=class a{constructor(i){this._onSave=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="chatArtifactLeafRenderer"}renderTemplate(i){let e=D(i,_(".chat-artifacts-list-row")),t=D(e,_(".chat-artifacts-list-icon")),o=D(e,_(".chat-artifacts-list-label")),n=D(e,_(".chat-artifacts-list-description")),r=D(e,_(".chat-artifacts-list-actions")),s=new O,l=new oo(r);return{container:e,iconElement:t,labelElement:o,descriptionElement:n,actionBar:l,elementDisposables:s}}renderElement(i,e,t){if(!Uko(i.element))return;t.elementDisposables.clear();let{artifact:o,description:n,onClear:r}=i.element,s=o.type&&Hko[o.type]||L.archive;t.iconElement.className="chat-artifacts-list-icon "+q.asClassName(s),t.labelElement.textContent=o.label,t.descriptionElement.textContent=n??"",t.descriptionElement.style.display=n?"":"none",t.container.title=o.uri,t.actionBar.clear();let l=[];if(r){let c=r;l.push(li({id:"chatArtifacts.clearSource",label:d(8678,null),class:q.asClassName(L.close),run:()=>c()}))}l.push(li({id:"chatArtifacts.save",label:d(8682,null),class:q.asClassName(L.save),run:()=>this._onSave(o)})),t.actionBar.push(l,{icon:!0,label:!1})}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.actionBar.dispose()}};var Oun=/^data:image\/[a-z]+;base64,/,Fun=/^https?:\/\/.+/,K0e=class extends ju{constructor(e,t,o,n,r,s,l,c){super(n);this.widgetRef=e;this.attachmentModel=t;this.styles=o;this.extensionService=r;this.webContentExtractorService=s;this.logService=l;this.chatAttachmentResolveService=c;this.overlays=new Map;this.overlayTextBackground="";this.disableOverlay=!1;this.currentActiveTarget=void 0;this.updateStyles(),this._register(ee(()=>{this.overlays.forEach(({overlay:u,disposable:p})=>{p.dispose(),u.remove()}),this.overlays.clear(),this.currentActiveTarget=void 0,this.overlayText?.remove(),this.overlayText=void 0}))}addOverlay(e,t){this.removeOverlay(e);let{overlay:o,disposable:n}=this.createOverlay(e,t);this.overlays.set(e,{overlay:o,disposable:n})}removeOverlay(e){this.currentActiveTarget===e&&(this.currentActiveTarget=void 0);let t=this.overlays.get(e);t&&(t.overlay.remove(),t.disposable.dispose(),this.overlays.delete(e))}setDisabledOverlay(e){this.disableOverlay=e}createOverlay(e,t){let o=document.createElement("div");o.classList.add("chat-dnd-overlay"),this.updateOverlayStyles(o),t.appendChild(o);let n=new wg(e,{onDragOver:r=>{this.disableOverlay||(r.stopPropagation(),r.preventDefault(),e!==this.currentActiveTarget&&(this.currentActiveTarget&&this.setOverlay(this.currentActiveTarget,void 0),this.currentActiveTarget=e,this.onDragEnter(r,e)))},onDragLeave:r=>{this.disableOverlay||(e===this.currentActiveTarget&&(this.currentActiveTarget=void 0),this.onDragLeave(r,e))},onDrop:r=>{this.disableOverlay||(r.stopPropagation(),r.preventDefault(),e===this.currentActiveTarget&&(this.currentActiveTarget=void 0,this.onDrop(r,e)))}});return{overlay:o,disposable:n}}onDragEnter(e,t){let o=this.guessDropType(e);this.updateDropFeedback(e,t,o)}onDragLeave(e,t){this.updateDropFeedback(e,t,void 0)}onDrop(e,t){this.updateDropFeedback(e,t,void 0),this.drop(e)}async drop(e){let t=await this.resolveAttachmentsFromDragEvent(e);t.length!==0&&this.attachmentModel.addContext(...t)}updateDropFeedback(e,t,o){let n=o!==void 0;e.dataTransfer&&(e.dataTransfer.dropEffect=n?"copy":"none"),this.setOverlay(t,o)}guessDropType(e){if(Up(e,Mc.NOTEBOOK_CELL_OUTPUT))return 7;if(Up(e,Mc.SCM_HISTORY_ITEM))return 8;if(Wun(e))return this.extensionService.extensions.some(t=>Va(t,"chatReferenceBinaryData"))?3:void 0;if(Up(e,"text/html"))return 5;if(Up(e,Mc.SYMBOLS))return 4;if(Up(e,Mc.MARKERS))return 6;if(Up(e,Fl.FILES))return 1;if(Up(e,Mc.EDITORS))return 0;if(Up(e,cr.uriList,Mc.FILES,Fl.RESOURCES,Fl.INTERNAL_URI_LIST))return 2}isDragEventSupported(e){return this.guessDropType(e)!==void 0}getDropTypeName(e){switch(e){case 0:return d(9036,null);case 1:return d(9036,null);case 2:return d(9037,null);case 3:return d(9038,null);case 4:return d(9042,null);case 6:return d(9040,null);case 5:return d(9043,null);case 7:return d(9039,null);case 8:return d(9041,null)}}async resolveAttachmentsFromDragEvent(e){if(!this.isDragEventSupported(e))return[];if(Up(e,Mc.NOTEBOOK_CELL_OUTPUT)){let r=EYi(e);if(r)return this.chatAttachmentResolveService.resolveNotebookOutputAttachContext(r)}if(Up(e,Mc.SCM_HISTORY_ITEM)){let r=Pmo(e);if(r)return this.chatAttachmentResolveService.resolveSourceControlHistoryItemAttachContext(r)}let t=xYi(e);if(t)return this.chatAttachmentResolveService.resolveMarkerAttachContext(t);if(Up(e,Mc.SYMBOLS)){let r=CYi(e);return this.chatAttachmentResolveService.resolveSymbolsAttachContext(r)}let o=Hsi(e);if(o.length>0)return ui(await Promise.all(o.map(r=>this.chatAttachmentResolveService.resolveEditorAttachContext(r))));let n=e.dataTransfer?.getData(Fl.INTERNAL_URI_LIST);if(n){let r=$w.parse(n);if(r.length)return ui(await Promise.all(r.map(s=>this.chatAttachmentResolveService.resolveEditorAttachContext({resource:A.parse(s)}))))}return!Up(e,Fl.INTERNAL_URI_LIST)&&Up(e,cr.uriList)&&(Up(e,cr.html)||Up(e,cr.text))?this.resolveHTMLAttachContext(e):[]}async downloadImageAsUint8Array(e){try{let n=await this.webContentExtractorService.readImage(A.parse(e),Ie.None);if(n)return n.buffer}catch(n){this.logService.warn("Fetch failed:",n)}let t=this.widgetRef(),o=t?.inputEditor.getSelection();o&&t&&t.inputEditor.executeEdits("chatInsertUrl",[{range:o,text:e}]),this.logService.warn(`Image URLs must end in .jpg, .png, .gif, .webp, or .bmp. Failed to fetch image from this URL: ${e}`)}async resolveHTMLAttachContext(e){let t=new Set(this.attachmentModel.attachments.map(u=>u.name)),o=()=>{let u=d(9035,null),p=u,h=1;for(;t.has(p);)p=`${u} ${++h}`;return t.add(p),p},n=async u=>{let p=A.parse(u);if(Oun.test(u))return{data:Hbi(u),name:o(),resource:p};if(Fun.test(u)){let h=await this.downloadImageAsUint8Array(u);if(h)return{data:h,name:o(),resource:p,id:u}}},r=async u=>{try{let p=await u.arrayBuffer();return{data:new Uint8Array(p),name:o()}}catch(p){this.logService.error("Error reading file:",p)}},s=[],l=Bun(e);if(l.length){let u=await Promise.all(l.map(p=>r(p)));s.push(...u.filter(p=>!!p))}let c=Vun(e);if(c.length){let u=await Promise.all(c.map(n));s.push(...u.filter(p=>!!p))}return await this.chatAttachmentResolveService.resolveImageAttachContext(s)}setOverlay(e,t){this.overlayText?.remove(),this.overlayText=void 0;let{overlay:o}=this.overlays.get(e);if(t!==void 0){let r=ir(`$(${L.attach.id}) ${this.getOverlayText(t)}`).map(s=>typeof s=="string"?_("span.overlay-text",void 0,s):s);this.overlayText=_("span.attach-context-overlay-text",void 0,...r),this.overlayText.style.backgroundColor=this.overlayTextBackground,o.appendChild(this.overlayText)}o.classList.toggle("visible",t!==void 0)}getOverlayText(e){let t=this.getDropTypeName(e);return d(9034,null,t)}updateOverlayStyles(e){e.style.backgroundColor=this.getColor(this.styles.overlayBackground)||"",e.style.color=this.getColor(this.styles.listForeground)||""}updateStyles(){this.overlays.forEach(e=>this.updateOverlayStyles(e.overlay)),this.overlayTextBackground=this.getColor(this.styles.listBackground)||""}};K0e=I([m(3,Pe),m(4,lt),m(5,foe),m(6,re),m(7,nV)],K0e);function Wun(a){if(Up(a,"image"))return!0;if(Up(a,Fl.FILES)){let i=a.dataTransfer?.files;if(i&&i.length>0)return Array.from(i).some(t=>t.type.startsWith("image/"));let e=a.dataTransfer?.items;if(e&&e.length>0)return Array.from(e).some(t=>t.type.startsWith("image/"))}return!1}function Vun(a,i){let e=a.dataTransfer?.getData("text/uri-list");if(e)try{let t=$w.parse(e);if(t.length>0)return t}catch(t){return i?.error("Error parsing URI list:",t),[]}return[]}function Bun(a){let i=a.dataTransfer?.files;return i?Array.from(i).filter(e=>e.type.startsWith("image/")):[]}var Hun=_,G0e=class extends k{constructor(e,t,o,n,r,s){super();this.location=o;this.options=n;this.clickHandler=r;this.chatAgentService=s;let l=D(e,Hun(".interactive-session-followups"));t.forEach(c=>this.renderFollowup(l,c))}renderFollowup(e,t){if(!this.chatAgentService.getDefaultAgent(this.location))return;let o=RPt(this.chatAgentService,this.location,"",t.agentId,t.subCommand);if(o===void 0)return;let n=t.kind==="reply"?t.title||t.message:t.title,r=t.kind==="reply"?t.message:t.title,s=(o+(t.tooltip||r)).trim(),l=this._register(new Pi(e,{...this.options,title:s}));t.kind==="reply"?l.element.classList.add("interactive-followup-reply"):t.kind==="command"&&l.element.classList.add("interactive-followup-command"),l.element.ariaLabel=d(9089,null,n),l.label=new he(n),this._register(l.onDidClick(()=>this.clickHandler(t)))}};G0e=I([m(5,gr)],G0e);var y6=_,zun={0:"severity-info",1:"severity-warning",2:"severity-error"},Kun={0:L.info,1:L.warning,2:L.error},q0e=class extends k{constructor(e,t,o,n){super();this._notificationService=e;this._commandService=t;this._telemetryService=o;this._markdownRendererService=n;this._contentDisposables=this._register(new O);this.domNode=y6(".chat-input-notification-widget"),this._register(this._notificationService.onDidChange(()=>this._render())),this._render()}_render(){this._contentDisposables.clear(),St(this.domNode);let e=this._notificationService.getActiveNotification();if(!e){this.domNode.parentElement?.classList.remove("has-notification");return}this.domNode.parentElement?.classList.add("has-notification"),this._renderNotification(e)}_renderNotification(e){let t=D(this.domNode,y6(".chat-input-notification"));t.classList.add(zun[e.severity]);let o=D(t,y6(".chat-input-notification-header"));D(o,y6(".chat-input-notification-icon")).appendChild(_(q.asCSSSelector(Kun[e.severity])));let r=D(o,y6(".chat-input-notification-title"));if(yr(e.message)){let c=this._contentDisposables.add(this._markdownRendererService.render(e.message));c.element.classList.add("chat-input-notification-title-markdown"),r.appendChild(c.element)}else r.textContent=e.message;let s=yr(e.message)?e.message.value:e.message;if(e.dismissible){let c=D(o,y6(".chat-input-notification-dismiss"));c.appendChild(_(q.asCSSSelector(L.close))),c.tabIndex=0,c.role="button",c.ariaLabel=d(9090,null),this._contentDisposables.add($(c,ne.CLICK,()=>{this._notificationService.dismissNotification(e.id)})),this._contentDisposables.add($(c,ne.KEY_DOWN,u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),this._notificationService.dismissNotification(e.id))}))}if(e.description||e.actions.length>0){let c=D(t,y6(".chat-input-notification-body"));if(e.description){let u=D(c,y6(".chat-input-notification-description"));u.textContent=e.description}if(e.actions.length>0){let u=D(c,y6(".chat-input-notification-actions"));for(let p=0;p<e.actions.length;p++){let h=e.actions[p],g=p===e.actions.length-1,f=this._contentDisposables.add(new Pi(u,{...Ro,...g?{}:{buttonBackground:void 0,buttonHoverBackground:void 0,buttonForeground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryHoverBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryBorder:void 0},supportIcons:!0,secondary:!g}));f.element.classList.add("chat-input-notification-action-button"),f.label=h.label,f.element.ariaLabel=`${s} ${h.label}`,this._contentDisposables.add(f.onDidClick(async()=>{this._telemetryService.publicLog2("workbenchActionExecuted",{id:h.commandId,from:"chatInputNotification"}),await this._commandService.executeCommand(h.commandId,...h.commandArgs??[])}))}}}}};q0e=I([m(0,w8),m(1,fe),m(2,_e),m(3,_n)],q0e);var vV=class extends rV{constructor(e,t,o,n,r,s,l){let c={...t,getAnchor:()=>this.getAnchorElement()};super(e,c,n,r,s,l);this.pickerOptions=o;this._register(ve(u=>{let p=this.pickerOptions.hideChevrons.read(u);this.element&&(this.element.classList.toggle("hide-chevrons",p),this.renderLabel(this.element))}))}getAnchorElement(){return this.element&&zi().document.contains(this.element)?this.element:this.pickerOptions.getOverflowAnchor?.()??this.element}render(e){super.render(e),e.classList.add("chat-input-picker-item");let t=this.pickerOptions.hideChevrons.get();this.element&&(this.element.classList.toggle("hide-chevrons",t),this.renderLabel(this.element))}};vV=I([m(3,kd),m(4,Le),m(5,X),m(6,_e)],vV);var Gun={label:d(9205,null),order:1},qun={label:d(9206,null),order:2},w6=class extends vV{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{actionProvider:{getActions:()=>{let b=this._getSelectedSessionType(),S=[...this._getAdditionalActions().map(y=>({...e,...y}))];for(let y of this._sessionTypeItems)this._isVisible(y.type)&&S.push({...e,id:y.commandId,label:y.label,checked:b===y.type,icon:this._getSessionIcon(y),enabled:this._isSessionTypeEnabled(y.type),category:this._getSessionCategory(y),description:this._getSessionDescription(y),tooltip:"",hover:{content:y.hoverDescription},run:async()=>{this._run(y)}});return S}},actionBarActionProvider:{getActions:()=>[this._getLearnMore()]},showItemKeybindings:!0,reporter:{id:"ChatSessionTypePicker",name:"ChatSessionTypePicker",includeOptions:!0}},n,r,s,l,h);this.chatSessionPosition=t;this.delegate=o;this.keybindingService=s;this.chatSessionsService=c;this.commandService=u;this.openerService=p;this._sessionTypeItems=[];this._register(this.chatSessionsService.onDidChangeAvailability(()=>{this._updateAgentSessionItems()})),this._updateAgentSessionItems()}_run(e){this.delegate.setActiveSessionProvider?this.delegate.setActiveSessionProvider(e.type):this.commandService.executeCommand(e.commandId,this.chatSessionPosition),this.element&&this.renderLabel(this.element)}_getSelectedSessionType(){return this.delegate.getActiveSessionProvider()}_getAdditionalActions(){return[]}_getLearnMore(){let e="https://code.visualstudio.com/docs/copilot/agents/overview";return{id:"workbench.action.chat.agentOverview.learnMore",label:d(9204,null),tooltip:e,class:void 0,enabled:!0,run:async()=>{await this.openerService.open(A.parse(e))}}}_updateAgentSessionItems(){let t=[{type:zo.Local,label:sb(zo.Local),hoverDescription:Jbi(zo.Local),commandId:`workbench.action.chat.openNewChatSessionInPlace.${zo.Local}`}],o=this.chatSessionsService.getAllChatSessionContributions();for(let n of o){let r=Kg(n.type);r?t.push({type:r,label:sb(r),hoverDescription:Jbi(r),commandId:n.canDelegate?`workbench.action.chat.openNewChatSessionInPlace.${n.type}`:`workbench.action.chat.openNewChatSessionExternal.${n.type}`}):t.push({type:n.type,label:n.displayName??n.name??n.type,hoverDescription:n.description??"",commandId:`workbench.action.chat.openNewChatSessionInPlace.${n.type}`})}this._sessionTypeItems=t}_isVisible(e){return!0}_isSessionTypeEnabled(e){return e===zo.Local?!0:!!this.chatSessionsService.getChatSessionContribution(e)}_getSessionCategory(e){let t=Kg(e.type);return t&&dPt(t)?Gun:qun}_getSessionDescription(e){}_getSessionIcon(e){let t=Kg(e.type);if(t)return n_(t);let o=this.chatSessionsService.getChatSessionContribution(e.type);return o&&q.isThemeIcon(o.icon)?o.icon:L.extensions}render(e){super.render(e),e.classList.add("chat-session-target-picker-item")}renderLabel(e){this.setAriaLabelAttributes(e);let t=this._getSelectedSessionType()??zo.Local,o=Kg(t),n=o?sb(o):this.chatSessionsService.getChatSessionContribution(t)?.displayName??t,r=this._getSessionIcon({type:t,label:n,hoverDescription:"",commandId:""}),s=[];return s.push(...ir(`$(${r.id})`)),s.push(_("span.chat-input-picker-label",void 0,n)),s.push(...ir("$(chevron-down)")),Ii(e,...s),null}};w6=I([m(4,kd),m(5,Le),m(6,X),m(7,Ms),m(8,fe),m(9,Je),m(10,_e)],w6);var ave=class extends w6{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,t,o,n,r,s,l,c,u,p,h);this.gitService=g;this._isSessionsWindow=qo.getValue(l)===!0}_run(e){this.delegate.setPendingDelegationTarget&&this.delegate.setPendingDelegationTarget(e.type),this.element&&this.renderLabel(this.element)}_getSelectedSessionType(){let e=this.delegate.getPendingDelegationTarget?this.delegate.getPendingDelegationTarget():void 0;return e||this.delegate.getActiveSessionProvider()}_isSessionTypeEnabled(e){let o=this.chatSessionsService.getAllChatSessionContributions().find(r=>Kg(r.type)===e),n=this.delegate.getActiveSessionProvider();return!this._isSessionsWindow&&n!==zo.Local||this._isSessionsWindow&&n!==zo.Background||this._isSessionsWindow&&e===zo.Cloud&&!this._hasGitRepository()||o&&!o.canDelegate&&n!==e?!1:this._getSelectedSessionType()!==e}_hasGitRepository(){return this.delegate.hasGitRepository?this.delegate.hasGitRepository():!yt.isEmpty(this.gitService.repositories)}_isVisible(e){return this._isSessionsWindow&&e===zo.Local?!1:this.delegate.getActiveSessionProvider()===e?!0:uPt(e)}_getSessionCategory(e){return dPt(e.type)?{label:d(9158,null),order:1,showHeader:!0}:{label:d(9159,null),order:2,showHeader:!1}}_getSessionDescription(e){}_getLearnMore(){let e="https://aka.ms/vscode-continue-chat-in";return{id:"workbench.action.chat.agentOverview.learnMoreHandOff",label:d(9155,null),tooltip:e,class:void 0,enabled:!0,run:async()=>{await this.openerService.open(A.parse(e))}}}_getAdditionalActions(){return this._isSessionsWindow?[]:[{id:"newChatSession",class:void 0,label:d(9156,null),tooltip:"",hover:{content:""},checked:!1,icon:L.plus,enabled:!0,category:{label:d(9157,null),order:0,showHeader:!1},description:this.keybindingService.lookupKeybinding(Mh)?.getLabel()||void 0,run:async()=>{this.commandService.executeCommand(Mh,this.chatSessionPosition)}}]}};ave=I([m(4,kd),m(5,Le),m(6,X),m(7,Ms),m(8,fe),m(9,Je),m(10,_e),m(11,cMe)],ave);function $0e(a,i){let e=wlo(a);return e?uAt(e,i):!1}function $un(a){let i=new he("",{isTrusted:!0,supportThemeIcons:!0});switch(a){case"available for download":i.appendMarkdown(d(9113,null));break;case"downloaded":case"ready":i.appendMarkdown(d(9119,null));break;default:i.appendMarkdown(d(9112,null));break}return i}var Q0e={Other:"other"};function jun(a,i){let e=a.getVendors().find(t=>t.vendor===i);return e?.displayName?e.displayName:i.charAt(0).toUpperCase()+i.slice(1)}function Kko(a,i){return`${a}\0${i}`}function Qun(a){let i=new Map;for(let e of a.getVendors()){let t=a.getLanguageModelGroups(e.vendor);for(let o of t){let n=o.group?.name??e.displayName;for(let r of o.modelIdentifiers)i.set(r,{vendor:e.vendor,groupName:n})}}return i}function o$t(a,i,e){let t=i.get(a.identifier);return t||{vendor:a.metadata.vendor,groupName:jun(e,a.metadata.vendor)}}function qko(a){return a.metadata.multiplierNumeric!==void 0}function lve(a,i,e,t,o,n,r){let s=i&&e?ipn(i,e,o):void 0;return{item:a,kind:"action",label:a.label,description:a.description,ariaDescription:n,group:{title:"",icon:a.icon??q.fromId(a.checked?L.check.id:L.blank.id)},hideIcon:!1,section:a.section,className:t?"chat-model-picker-inline-source":void 0,badge:t,hover:s?{content:s.element,disposable:s.disposable}:void 0,tooltip:a.tooltip,toolbarActions:r?[r]:void 0,submenuActions:a.toolbarActions?.length?a.toolbarActions:void 0}}function Yun(a,i,e){return li({id:`pin.${a}`,label:i?d(9123,null):d(9117,null),class:q.asClassName(i?L.pinned:L.pin),run:()=>e(a,!i)})}function Xun(a,i,e){let t=a.metadata.configurationSchema;if(!t?.properties)return;let o=e.getModelConfiguration(a.identifier)??{};for(let[n,r]of Object.entries(t.properties)){if(r.group!==i||!r.enum||r.enum.length<2)continue;let s=o[n]??r.default;return{key:n,value:s,schema:r}}}function $ko(a){switch(a){case"low":return d(9129,null);case"medium":return d(9130,null);case"high":return d(9128,null);case"very_high":return d(9131,null);default:return}}function jko(a,i){let e=a.metadata.configurationSchema;if(!e?.properties)return;let t=i.getModelConfiguration(a.identifier)??{},o=[];for(let[n,r]of Object.entries(e.properties)){if(r.group!=="navigation"||!r.enum||r.enum.length<2)continue;let s=t[n]??r.default;if(s===void 0)continue;let l=r.enum?.indexOf(s)??-1,c=r.enumItemLabels?.[l]??String(s);o.push(c)}return o.length>0?o.join(", "):void 0}function j0e(a,i,e,t,o,n,r){let s=qko(a)?a.metadata.pricing:void 0,l=r?$ko(a.metadata.priceCategory):void 0,c=r?void 0:jko(a,t),u=n?void 0:a.metadata.detail,p=[c,u,s].filter(Boolean),h=p.length>0?p.join(" \xB7 "):void 0,g=r?void 0:t.getModelConfigurationActions(a.identifier),f={id:a.identifier,enabled:!0,icon:a.metadata.statusIcon,checked:a.identifier===i,class:void 0,description:h,tooltip:a.metadata.name,label:a.metadata.name,section:o,toolbarActions:g&&g.length>0?g:void 0,run:()=>e(a)},v=l?h?h+" \xB7 "+l:l:void 0;return{action:f,ariaDescription:v}}function Jun(a){return a.hasByokModels||a.entitlement===5||a.entitlement===10||a.entitlement===6||a.entitlement===7||a.entitlement===11||a.entitlement===8||a.entitlement===9||a.isInternal}function Zun(a){return{id:"manageModels",enabled:!0,checked:!1,class:q.asClassName(L.gear),tooltip:d(9106,null),label:d(9105,null),run:()=>{a.executeCommand(TYe)}}}function epn(a,i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){let y=[];if(a.length===0&&y.push(lve({id:"auto",enabled:!0,checked:!0,class:void 0,tooltip:d(9111,null),label:d(9111,null),run:()=>{}})),u){let w=[],x=v?Qun(v):new Map;if(a.length){let E=new Map,M=new Map;for(let Ee of a)E.set(Ee.identifier,Ee),M.set(Ee.metadata.id,Ee);let N=new Set,V=(Ee,Te)=>{N.add(Ee),Te&&N.add(Te)},H=Ee=>E.get(Ee)??M.get(Ee),K=Ee=>h.entitlement===8||h.entitlement===9?Ee.minVSCodeVersion&&!$0e(n,Ee.minVSCodeVersion)?"update":"admin":"upgrade",j=a.find(Ee=>QAi(Ee));if(j){V(j.identifier,j.metadata.id);let{action:Ee,ariaDescription:Te}=j0e(j,i,s,v,void 0,void 0,S);y.push(lve(Ee,j,b,void 0,S,Te))}let se=new Set(a.map(Ee=>{let Te=o$t(Ee,x,v);return Kko(Te.vendor,Te.groupName)})).size>1,ae=Ee=>l?Yun(Ee.identifier,t.includes(Ee.identifier),l):void 0,ce=new Set(t),Se=[];for(let Ee of t){if(N.has(Ee))continue;let Te=H(Ee);Te&&!N.has(Te.identifier)&&(V(Te.identifier,Te.metadata.id),Se.push(Te))}if(Se.length>0){y.push({kind:"separator",label:d(9118,null)});for(let Ee of Se){let Te=se?o$t(Ee,x,v).groupName:void 0,{action:It,ariaDescription:tt}=j0e(Ee,i,s,v,void 0,se,S);y.push(lve(It,Ee,b,Te,S,tt,ae(Ee)))}}let Re=e.filter(Ee=>!ce.has(Ee)).slice(0,3),xe=[],He=Ee=>{if(N.has(Ee))return!1;let Te=H(Ee);if(Te&&!N.has(Te.identifier)){V(Te.identifier,Te.metadata.id);let It=o[Te.metadata.id];return It?.minVSCodeVersion&&!$0e(n,It.minVSCodeVersion)?xe.push({kind:"unavailable",id:Te.metadata.id,entry:It,reason:"update"}):xe.push({kind:"available",model:Te}),!0}if(!Te){let It=o[Ee];if(It&&!It.exists)return V(Ee),xe.push({kind:"unavailable",id:Ee,entry:It,reason:K(It)}),!0}return!1};i&&i!==j?.identifier&&He(i);for(let Ee of Re)He(Ee);if(f)for(let[Ee,Te]of Object.entries(o)){if(!Te.featured||N.has(Ee))continue;let It=H(Ee);It&&!N.has(It.identifier)?Te.minVSCodeVersion&&!$0e(n,Te.minVSCodeVersion)?g&&(V(It.identifier,It.metadata.id),xe.push({kind:"unavailable",id:Ee,entry:Te,reason:"update"})):(V(It.identifier,It.metadata.id),xe.push({kind:"available",model:It})):!It&&!Te.exists&&g&&(V(Ee),xe.push({kind:"unavailable",id:Ee,entry:Te,reason:K(Te)}))}if(xe.length>0){y.length>0&&y.push({kind:"separator"}),xe.sort((Ee,Te)=>{let It=Ee.kind==="available"?0:1,tt=Te.kind==="available"?0:1;if(It!==tt)return It-tt;let Oi=Ee.kind==="available"?Ee.model.metadata.name:Ee.entry.label,zt=Te.kind==="available"?Te.model.metadata.name:Te.entry.label;return Oi.localeCompare(zt)});for(let Ee of xe)if(Ee.kind==="available"){let Te=se?o$t(Ee.model,x,v).groupName:void 0,{action:It,ariaDescription:tt}=j0e(Ee.model,i,s,v,void 0,se,S);y.push(lve(It,Ee.model,b,Te,S,tt,ae(Ee.model)))}else y.push(Gko(Ee.id,Ee.entry,Ee.reason,c,r,h))}if(w=a.filter(Ee=>!N.has(Ee.identifier)&&!N.has(Ee.metadata.id)),w.length>0){y.length>0&&y.push({kind:"separator"});let Ee=p?[li({id:p.id,label:p.tooltip??p.label,class:q.asClassName(L.gear),run:()=>p.run()})]:void 0;y.push({item:{id:"otherModels",enabled:!0,checked:!1,class:void 0,tooltip:d(9116,null),label:d(9116,null),run:()=>{}},kind:"action",label:d(9116,null),group:{title:"",icon:L.chevronDown},hideIcon:!1,section:Q0e.Other,isSectionToggle:!0,toolbarActions:Ee,className:"chat-model-picker-section-toggle"});let Te=new Map;for(let Oi of w){let zt=o$t(Oi,x,v),mo=Kko(zt.vendor,zt.groupName),dn=Te.get(mo);dn||(dn={vendor:zt.vendor,groupName:zt.groupName,models:[]},Te.set(mo,dn)),dn.models.push(Oi)}let It=[...Te.values()].sort((Oi,zt)=>Oi.vendor==="copilot"&&zt.vendor!=="copilot"?-1:zt.vendor==="copilot"&&Oi.vendor!=="copilot"?1:Oi.groupName.localeCompare(zt.groupName)),tt=It.length>1;for(let Oi of It){tt&&y.push({kind:"separator",label:Oi.groupName,section:Q0e.Other});let zt=[...Oi.models].sort((mo,dn)=>{let No=o[mo.metadata.id]??o[mo.identifier],_i=o[dn.metadata.id]??o[dn.identifier],ln=No?.minVSCodeVersion&&!$0e(n,No.minVSCodeVersion)?1:0,Tn=_i?.minVSCodeVersion&&!$0e(n,_i.minVSCodeVersion)?1:0;return ln!==Tn?ln-Tn:mo.metadata.name.localeCompare(dn.metadata.name)});for(let mo of zt){let dn=o[mo.metadata.id]??o[mo.identifier];if(dn?.minVSCodeVersion&&!$0e(n,dn.minVSCodeVersion))y.push(Gko(mo.metadata.id,dn,"update",c,r,h,Q0e.Other));else{let{action:No,ariaDescription:_i}=j0e(mo,i,s,v,Q0e.Other,tt,S);y.push(lve(No,mo,b,void 0,S,_i,ae(mo)))}}}}}p&&!w.length&&(y.push({kind:"separator"}),y.push({item:p,kind:"action",label:p.label,group:{title:"",icon:L.blank},hideIcon:!1,showAlways:!0}))}else{let w=a.find(E=>QAi(E));if(w){let{action:E,ariaDescription:M}=j0e(w,i,s,v,void 0,void 0,S);y.push(lve(E,w,b,void 0,S,M))}let x=a.filter(E=>E!==w).sort((E,M)=>{let N=E.metadata.vendor.localeCompare(M.metadata.vendor);return N!==0?N:E.metadata.name.localeCompare(M.metadata.name)});for(let E of x){let{action:M,ariaDescription:N}=j0e(E,i,s,v,void 0,void 0,S);y.push(lve(M,E,b,void 0,S,N))}}return y}function tpn(){return{getAriaLabel(a){if(a.kind!=="action")return null;let i=a.ariaDescription??(typeof a.description=="string"?a.description:a.description?.value);return[a.label,a.badge,i].filter(e=>!!e).join(", ")},isChecked(a){if(!a.isSectionToggle)return a.kind==="action"?!!a?.item?.checked:void 0},getRole:a=>{if(a.isSectionToggle)return"menuitem";switch(a.kind){case"action":return"menuitemradio";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"menu"}}function Gko(a,i,e,t,o,n,r){let s;e==="upgrade"?s=new he(d(9127,null),{isTrusted:!0}):e==="update"?s=d(9124,null):s=t?new he(d(9109,null,t),{isTrusted:!0}):d(9107,null);let l;return e==="upgrade"?(l=new he("",{isTrusted:!0,supportThemeIcons:!0}),n.entitlement===6?l.appendMarkdown(d(9126,null)):l.appendMarkdown(d(9125,null))):e==="update"?l=$un(o):(l=new he("",{isTrusted:!0,supportThemeIcons:!0}),l.appendMarkdown(d(9108,null))),{item:{id:a,enabled:!1,checked:!1,class:void 0,tooltip:i.label,label:i.label,description:typeof s=="string"?s:void 0,run:()=>{}},kind:"action",label:i.label,description:s,group:{title:"",icon:q.fromId(L.blank.id)},disabled:!0,hideIcon:!1,className:"chat-model-picker-unavailable",section:r,hover:{content:l}}}var Y0e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._delegate=e;this._actionWidgetService=t;this._commandService=o;this._openerService=n;this._telemetryService=r;this._languageModelsService=s;this._productService=l;this._entitlementService=c;this._updateService=u;this._uriIdentityService=p;this._defaultAccountService=h;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._register(this._languageModelsService.onDidChangeLanguageModels(()=>{this._renderLabel()})),this._register(this._entitlementService.onDidChangeUsageBasedBilling(()=>{this._renderLabel()}))}get selectedModel(){return this._selectedModel}get domNode(){return this._domNode}get nameButton(){return this._nameButton}setHideChevrons(e){this._hideChevrons=e,this._register(ve(t=>{let o=e.read(t);this._domNode&&this._domNode.classList.toggle("hide-chevrons",o),this._renderLabel()}))}setSelectedModel(e){this._selectedModel=e,this._renderLabel()}setEnabled(e){this._domNode&&(this._domNode.classList.toggle("disabled",!e),this._domNode.setAttribute("aria-disabled",String(!e)))}setBadge(e){this._badge=e,this._updateBadge()}render(e){this._domNode=D(e,_("div.action-label.model-picker-split")),this._domNode.setAttribute("role","group"),this._hideChevrons?.get()&&this._domNode.classList.toggle("hide-chevrons",!0),this._nameButton=D(this._domNode,_("a.model-picker-section.model-picker-name")),this._nameButton.tabIndex=0,this._nameButton.setAttribute("role","button"),this._nameButton.setAttribute("aria-haspopup","true"),this._nameButton.setAttribute("aria-expanded","false"),this._effortButton=D(this._domNode,_("a.model-picker-section.model-picker-effort")),this._effortButton.tabIndex=0,this._effortButton.setAttribute("role","button"),this._effortButton.setAttribute("aria-haspopup","true"),this._effortButton.setAttribute("aria-expanded","false"),this._effortButton.style.display="none",this._tokensButton=D(this._domNode,_("a.model-picker-section.model-picker-tokens")),this._tokensButton.tabIndex=0,this._tokensButton.setAttribute("role","button"),this._tokensButton.setAttribute("aria-haspopup","true"),this._tokensButton.setAttribute("aria-expanded","false"),this._tokensButton.style.display="none",this._badgeIcon=_("span.model-picker-badge"),this._updateBadge(),this._renderLabel(),this._registerButtonAction(this._nameButton,()=>this.show()),this._registerButtonAction(this._effortButton,()=>this._showEffortPicker()),this._registerButtonAction(this._tokensButton,()=>this._showTokensPicker()),this._register(sp().setupManagedHover(yi("mouse"),this._effortButton,d(9115,null))),this._register(sp().setupManagedHover(yi("mouse"),this._tokensButton,d(9122,null)))}_registerButtonAction(e,t){this._register(ML(e,o=>{o.button===0&&(Kt.stop(o,!0),t())})),this._register($(e,ne.KEY_DOWN,o=>{let n=new mi(o);(n.equals(3)||n.equals(10))&&(Kt.stop(o,!0),t())}))}show(e){let t=e??this._domNode;if(!t||this._domNode?.classList.contains("disabled"))return;let o=this._selectedModel,n=M=>{this._telemetryService.publicLog2("chat.modelChange",{fromModel:o?.metadata.vendor==="copilot"?new lh(o.identifier):"unknown",toModel:M.metadata.vendor==="copilot"?new lh(M.identifier):"unknown"}),this._selectedModel=M,this._renderLabel(),this._onDidChangeSelection.fire(M)},r=this._delegate.getModels(),s=O0(this._entitlementService.entitlement),l=!!this._entitlementService.quotas.usageBasedBilling,c=this._languageModelsService.getModelsControlManifest(),u=s?c.paid:c.free,h=this._delegate.showManageModelsAction()&&Jun(this._entitlementService)?Zun(this._commandService):void 0,g=M=>{this._telemetryService.publicLog2("chat.modelPickerInteraction",{interaction:M})},f=this._defaultAccountService.resolveGitHubUrl(SM.copilotSettings),v=(M,N)=>{N?this._languageModelsService.pinModel(M):this._languageModelsService.unpinModel(M),this._actionWidgetService.hide(),this.show(t)},b=epn(r,this._selectedModel?.identifier,this._languageModelsService.getRecentlyUsedModelIds(),this._languageModelsService.getPinnedModelIds(),u,this._productService.version,this._updateService.state.type,n,v,f,this._delegate.useGroupedModelPicker(),l?h:void 0,this._entitlementService,this._delegate.showUnavailableFeatured(),this._delegate.showFeatured(),this._languageModelsService,this._openerService,l),S=new O;for(let M of b)M.hover?.disposable&&S.add(M.hover.disposable);let y={showFilter:!0,filterPlaceholder:d(9120,null),filterActions:!l&&h?[h]:void 0,focusFilterOnOpen:!0,collapsedByDefault:new Set([Q0e.Other]),onDidToggleSection:(M,N)=>{M===Q0e.Other&&g(N?"otherModelsCollapsed":"otherModelsExpanded")},linkHandler:M=>{M.scheme==="command"&&M.path==="workbench.action.chat.upgradePlan"?g("premiumModelUpgradePlanClicked"):f&&this._uriIdentityService.extUri.isEqual(M,A.parse(f))&&g("disabledModelContactAdminClicked"),this._openerService.open(M,{allowCommands:!0})},minWidth:200},w=Un(),x={onSelect:M=>{this._actionWidgetService.hide(),M.run()},onHide:()=>{S.dispose(),this._nameButton?.setAttribute("aria-expanded","false"),go(w)&&w.focus()}};this._nameButton?.setAttribute("aria-expanded","true"),this._actionWidgetService.show("ChatModelPicker",!1,b,x,t,void 0,[],tpn(),y);let E=Un();Xle(E)&&E.classList.contains("action-list-filter-input")&&E.classList.add("chat-model-picker-filter-input")}_updateBadge(){if(this._badgeIcon)if(this._badge){let e=this._badge==="info"?L.info:L.warning;Ii(this._badgeIcon,un(e)),this._badgeIcon.style.display="",this._badgeIcon.classList.toggle("info",this._badge==="info"),this._badgeIcon.classList.toggle("warning",this._badge==="warning")}else this._badgeIcon.style.display="none"}_renderLabel(){if(!this._domNode||!this._nameButton)return;let{name:e,statusIcon:t}=this._selectedModel?.metadata||{},o=[];t&&o.push(un(t));let n=e??d(9111,null),r=!!this._entitlementService.quotas.usageBasedBilling,s=!r&&this._selectedModel?jko(this._selectedModel,this._languageModelsService):void 0,l=s?`${n} \xB7 ${s}`:n;o.push(_("span.chat-input-picker-label",void 0,l)),this._badgeIcon&&o.push(this._badgeIcon),Ii(this._nameButton,...o);let c=r?this._getConfigProperty("navigation"):void 0;if(c&&this._effortButton){let p=c.schema.enum?.indexOf(c.value)??-1,h=p>=0&&c.schema.enumItemLabels?.[p]?c.schema.enumItemLabels[p]:String(c.value);Ii(this._effortButton,_("span.chat-input-picker-label",void 0,h)),this._effortButton.style.display="",this._effortButton.ariaLabel=d(9114,null,h)}else this._effortButton&&(this._effortButton.style.display="none");let u=r?this._getConfigProperty("tokens"):void 0;if(u&&this._tokensButton){let p=u.schema.enum?.indexOf(u.value)??-1,h=p>=0&&u.schema.enumItemLabels?.[p]?u.schema.enumItemLabels[p]:jAi(Number(u.value));Ii(this._tokensButton,_("span.chat-input-picker-label",void 0,h)),this._tokensButton.style.display="",this._tokensButton.ariaLabel=d(9121,null,h)}else this._tokensButton&&(this._tokensButton.style.display="none");this._domNode.ariaLabel=d(9110,null,l)}_getConfigProperty(e){if(this._selectedModel)return Xun(this._selectedModel,e,this._languageModelsService)}_showEffortPicker(){if(this._domNode?.classList.contains("disabled"))return;let e=this._getConfigProperty("navigation");if(!e||!this._effortButton||!this._selectedModel)return;let t=this._selectedModel.identifier,o=e.schema.enum??[],n=e.schema.enumItemLabels,r=[{kind:"header",label:d(9104,null)}];for(let c=0;c<o.length;c++){let u=o[c],p=n?.[c]??String(u),g=u===e.schema.default?d(9140,null,p):p;r.push({item:{id:`effort.${u}`,enabled:!0,checked:e.value===u,class:void 0,tooltip:e.schema.enumDescriptions?.[c]??"",label:g,run:()=>{this._languageModelsService.setModelConfiguration(t,{[e.key]:u})}},kind:"action",label:g,description:e.schema.enumDescriptions?.[c],group:{title:"",icon:q.fromId(e.value===u?L.check.id:L.blank.id)},hideIcon:!1})}let s=Un(),l={onSelect:c=>{this._actionWidgetService.hide(),c.run()},onHide:()=>{this._effortButton?.setAttribute("aria-expanded","false"),go(s)&&s.focus()}};this._effortButton.setAttribute("aria-expanded","true"),this._actionWidgetService.show("ChatModelEffortPicker",!1,r,l,this._effortButton,void 0,[],{isChecked(c){return c.kind==="action"?!!c?.item?.checked:void 0},getRole:()=>"menuitemradio",getWidgetRole:()=>"menu"},{footerText:d(9103,null)})}_showTokensPicker(){if(this._domNode?.classList.contains("disabled"))return;let e=this._getConfigProperty("tokens");if(!e||!this._tokensButton||!this._selectedModel)return;let t=this._selectedModel.identifier,o=e.schema.enum??[],n=e.schema.enumItemLabels,r=[{kind:"header",label:d(9133,null)}];for(let c=0;c<o.length;c++){let u=o[c],p=n?.[c]??jAi(Number(u)),g=u===e.schema.default?d(9145,null,p):p,f=e.schema.enumDescriptions?.[c];r.push({item:{id:`tokens.${u}`,enabled:!0,checked:e.value===u,class:void 0,tooltip:f??"",label:g,run:()=>{this._languageModelsService.setModelConfiguration(t,{[e.key]:u})}},kind:"action",label:g,description:f,group:{title:"",icon:q.fromId(e.value===u?L.check.id:L.blank.id)},hideIcon:!1})}let s=Un(),l={onSelect:c=>{this._actionWidgetService.hide(),c.run()},onHide:()=>{this._tokensButton?.setAttribute("aria-expanded","false"),go(s)&&s.focus()}};this._tokensButton.setAttribute("aria-expanded","true"),this._actionWidgetService.show("ChatModelTokensPicker",!1,r,l,this._tokensButton,void 0,[],{isChecked(c){return c.kind==="action"?!!c?.item?.checked:void 0},getRole:()=>"menuitemradio",getWidgetRole:()=>"menu"},{footerText:d(9132,null)})}};Y0e=I([m(1,kd),m(2,fe),m(3,Je),m(4,_e),m(5,Gr),m(6,Ze),m(7,dr),m(8,Lp),m(9,gt),m(10,Nd)],Y0e);function ipn(a,i,e){let t=QAi(a),o=_(".chat-model-hover"),n=new O;if(o.appendChild(_(".chat-model-hover-name",void 0,a.metadata.name)),a.metadata.tooltip){o.appendChild(_(".chat-model-hover-separator"));let r=_(".chat-model-hover-description"),s=new he("",{isTrusted:!0,supportThemeIcons:!0});a.metadata.statusIcon&&s.appendMarkdown(`$(${a.metadata.statusIcon.id})&nbsp;`),s.appendMarkdown(a.metadata.tooltip);let l=Lg(s,{actionHandler:c=>{i.open(A.parse(c),{allowCommands:!0})}});n.add(l),r.appendChild(l.element),o.appendChild(r)}if(!t&&e){let r=[];a.metadata.inputCost!==void 0&&r.push({label:d(9141,null),value:a.metadata.inputCost===1?d(9139,null,a.metadata.inputCost):d(9138,null,a.metadata.inputCost)}),a.metadata.cacheCost!==void 0&&r.push({label:d(9134,null),value:a.metadata.cacheCost===1?d(9139,null,a.metadata.cacheCost):d(9138,null,a.metadata.cacheCost)}),a.metadata.outputCost!==void 0&&r.push({label:d(9142,null),value:a.metadata.outputCost===1?d(9139,null,a.metadata.outputCost):d(9138,null,a.metadata.outputCost)});let s=$ko(a.metadata.priceCategory);if(r.length>0){let l=_(".chat-model-hover-cost"),c=_(".chat-model-hover-cost-title-row");c.appendChild(_(".chat-model-hover-cost-title",void 0,d(9144,null))),s&&c.appendChild(_("span.chat-model-hover-cost-tag",void 0,s)),l.appendChild(c);for(let u of r)l.appendChild(_(".chat-model-hover-cost-line",void 0,_("span.chat-model-hover-cost-line-label",void 0,`${u.label}: `),_("span",void 0,u.value)));o.appendChild(l)}else if(s){let l=_(".chat-model-hover-cost"),c=_(".chat-model-hover-cost-title-row");c.appendChild(_(".chat-model-hover-cost-title",void 0,d(9143,null))),c.appendChild(_("span.chat-model-hover-cost-tag",void 0,s)),l.appendChild(c),o.appendChild(l)}else if(a.metadata.pricing&&!qko(a)){let l=_(".chat-model-hover-cost");l.appendChild(_("span",void 0,d(9137,null,a.metadata.pricing))),o.appendChild(l)}}if(!t&&(a.metadata.maxInputTokens||a.metadata.maxOutputTokens)){let r=(a.metadata.maxInputTokens??0)+(a.metadata.maxOutputTokens??0),s=_(".chat-model-hover-context");s.appendChild(_(".chat-model-hover-context-label",void 0,d(9136,null))),s.appendChild(_(".chat-model-hover-context-value",void 0,jAi(r))),o.appendChild(s)}if(!t&&e&&a.metadata.configurationSchema?.properties){let r=[];for(let[,s]of Object.entries(a.metadata.configurationSchema.properties))if(s.enum&&s.enum.length>=2){let l=s.title??s.description;l&&r.push(l)}if(r.length>0){o.appendChild(_(".chat-model-hover-separator"));let s=_(".chat-model-hover-configurable");s.appendChild(_("span.chat-model-hover-configurable-label",void 0,d(9135,null)));for(let l of r)s.appendChild(_("span.chat-model-hover-configurable-tag",void 0,l));o.appendChild(s)}}return o.children.length>0?{element:o,disposable:n}:void 0}function jAi(a){return a>9e5?`${Math.ceil(a/1e6)}M`:a>=1e3?`${Math.round(a/1e3)}K`:a.toString()}function QAi(a){return a.metadata.id==="auto"&&(a.metadata.vendor==="copilot"||a.metadata.vendor==="copilotcli")}var X0e=class extends Ja{constructor(e,t,o,n,r,s){super(void 0,e);this.pickerOptions=o;this._contextKeyService=r;this.keybindingService=s;this._managedHover=this._register(new ue);this._pickerWidget=this._register(n.createInstance(Y0e,t)),this._pickerWidget.setSelectedModel(t.currentModel.get()),this._pickerWidget.setHideChevrons(o.hideChevrons),this._register(ve(l=>{let c=t.currentModel.read(l);this._pickerWidget.setSelectedModel(c),this._updateTooltip()})),this._register(this._pickerWidget.onDidChangeSelection(l=>t.setModel(l)))}render(e){this._pickerWidget.render(e),this.element=this._pickerWidget.domNode,this._updateTooltip(),e.classList.add("chat-input-picker-item")}_getAnchorElement(){return this.element&&zi().document.contains(this.element)?this.element:this.pickerOptions.getOverflowAnchor?.()??this.element}openModelPicker(){this._showPicker()}show(){this._showPicker()}setEnabled(e){this._pickerWidget.setEnabled(e)}_showPicker(){this._pickerWidget.show(this._getAnchorElement())}_updateTooltip(){let e=this._pickerWidget.nameButton;if(!e)return;let t=this._getHoverContents();typeof t=="string"&&t?this._managedHover.value=sp().setupManagedHover(yi("mouse"),e,t):this._managedHover.clear()}_getHoverContents(){let e=d(9179,null),t=this.keybindingService.lookupKeybinding(this._action.id,this._contextKeyService)?.getLabel();t&&(e+=` (${t})`);let{statusIcon:o,tooltip:n}=this._pickerWidget.selectedModel?.metadata||{};return o&&n?`${e} \u2022 ${n}`:e}};X0e=I([m(3,F),m(4,X),m(5,Le)],X0e);function Pst(a,i,e){let t=e.defaultChatAgent?.chatExtensionId;if(!t)return!1;let o=hi.equals(i,t),n=a.path.includes("/github/");return o&&n}function Qko(a,i,e){if(a.storage!=="extension")return!1;let t=e.defaultChatAgent?.chatExtensionId;return!t||!hi.equals(a.extensionId,t)?!1:!Pst(i,a.extensionId,e)}var Yko=a=>{switch(a.name.get().toLowerCase()){case"ask":return L.ask;case"edit":return L.edit;case"plan":return L.tasklist;default:return}},J0e=class extends vV{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){let b=De("modePickerAssignments",{showOldAskMode:!1}),S=()=>t.customAgentTarget?.()??"undefined",y={label:d(9180,null),order:0},w={label:d(9181,null),order:1},x={label:d(9183,null),order:999,showHeader:!0},E=l.inspect("chat.agent.enabled").policyValue===!1,M=(J,se)=>{let ae=J.kind==="agent"&&E,ce=r.getDefaultAgent("panel",J.kind)?.description??e.tooltip,Se=[];if(J.kind==="agent"&&!ae&&J.uri){let Re,xe,He;J.source?.storage==="extension"?(xe=L.file,He=`viewAgent:${J.id}`,Re=d(9184,null,J.label.get())):(xe=L.edit,He=`editAgent:${J.id}`,Re=d(9182,null,J.label.get()));let Ee=J.uri;Se.push({id:He,label:Re,tooltip:Re,class:q.asClassName(xe),enabled:!0,run:async()=>{f.open(Ee.get())}})}return{...e,id:Hxi(J),label:J.label.get(),icon:ae?q.fromId(L.lock.id):J.icon.get(),class:ae?"disabled-by-policy":void 0,enabled:!ae,checked:!ae&&se.id===J.id,tooltip:"",hover:{content:ce},toolbarActions:Se,run:async()=>{if(ae)return;let Re=await p.executeCommand(aPi,{modeId:J.id,sessionResource:this.delegate.sessionResource()});return this.element&&this.renderLabel(this.element),Re},category:ae?x:y}},N=(J,se)=>({...M(J,se),tooltip:"",hover:{content:J.description.get()??r.getDefaultAgent("panel",J.kind)?.description??e.tooltip},icon:J.icon.get()??(Ast(J,this._productService)?Yko(J):void 0),category:E?x:w}),V=J=>{let se=t.currentChatModes.get(),ae=t.currentMode.get(),ce=se.custom.filter(Te=>{let It=Te.target.get();return!(It!==J&&It!=="undefined")}),Se=yy(ce,Te=>Ast(Te,this._productService)?"builtin":"custom"),Re=ae.id===Bc.Agent.id,xe={...M(Bc.Agent,Bc.Agent),checked:Re};xe.category=y;let He=Se.builtin?.map(Te=>{let It=N(Te,ae);return It.category=y,It})??[],Ee=Se.custom?.map(Te=>N(Te,ae))??[];return[xe,...He,...Ee]},H={getActions:()=>{let J=t.currentChatModes.get(),se=t.currentMode.get(),ae=J.builtin.find(Te=>Te.id===Bc.Agent.id),ce=J.builtin.filter(Te=>Te.id!==Bc.Agent.id&&Xko(Te,b.get(),E)),Se=J.custom.filter(Te=>Ast(Te,this._productService)?Xko(Te,b.get(),E):!0),Re=yy(Se,Te=>Ast(Te,this._productService)?"builtin":"custom"),xe=Re.builtin?.map(Te=>{let It=N(Te,se);return It.category=E?x:y,It})??[];xe.sort((Te,It)=>Te.label.localeCompare(It.label));let He=Re.custom?.map(Te=>N(Te,se))??[];return He.sort((Te,It)=>Te.label.localeCompare(It.label)),ui([ae&&M(ae,se),...ce.map(Te=>Te&&M(Te,se)),...xe,...He])}};super(e,{actionProvider:{getActions:()=>{let J=S();return J!=="undefined"?V(J):H.getActions()}},actionBarActionProvider:{getActions:()=>this.getModePickerActionBarActions()},showItemKeybindings:!0,reporter:{id:"ChatModePicker",name:"ChatModePicker",includeOptions:!0}},o,n,s,c,g);this.delegate=t;this.contextKeyService=c;this.menuService=u;this._productService=h;this._register(ve(J=>{this.delegate.currentMode.read(J).label.read(J),this.element&&this.renderLabel(this.element)})),v.getTreatment("chat.showOldAskMode").then(J=>{b.set({showOldAskMode:J==="enabled"},void 0)}),this._register(v.onDidRefetchAssignments(async()=>{b.set({showOldAskMode:await v.getTreatment("chat.showOldAskMode")==="enabled"},void 0)}))}getModePickerActionBarActions(){let e=this.menuService.createMenu(R.ChatModePicker,this.contextKeyService),t=Ng(e.getActions({renderShortTitle:!0}));return e.dispose(),t}render(e){super.render(e),e.classList.add("chat-mode-picker-item")}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.currentMode.get(),o=t.label.get(),n=t.icon.get();!n&&Ast(t,this._productService)&&(n=Yko(t));let r=[],s=this.pickerOptions.hideChevrons.get();return n&&r.push(...ir(`$(${n.id})`)),(!s||!n)&&r.push(_("span.chat-input-picker-label",void 0,o)),Ii(e,...r),null}};J0e=I([m(3,kd),m(4,gr),m(5,Le),m(6,B),m(7,X),m(8,Yt),m(9,fe),m(10,Ze),m(11,_e),m(12,Je),m(13,wN)],J0e);function Ast(a,i){if(a.isBuiltin)return!0;if(a.source?.storage!=="extension")return!1;let e=i.defaultChatAgent?.chatExtensionId;if(!e||a.source.extensionId.value!==e)return!1;let t=a.uri?.get();return t?!Pst(t,a.source.extensionId,i):!0}function Xko(a,i,e){return a.id===Bc.Edit.id||a.name.get().toLowerCase()==="edit"?a.id===Bc.Edit.id?e:!e:a.id===Bc.Ask.id||a.name.get().toLowerCase()==="ask"?a.id===Bc.Ask.id?i.showOldAskMode||e:!(i.showOldAskMode||e):!0}var n$t="chat.permissions.autopilot.dontShowWarningAgain",r$t="chat.permissions.autoApprove.dontShowWarningAgain";var YAi=new Set;function Jko(a){if(a==="autopilot")return n$t;if(a==="autoApprove")return r$t}function Zko(){YAi.clear()}function opn(a,i){if(YAi.has(a))return!0;let e=Jko(a);return!!(e&&i.getBoolean(e,0,!1))}async function XAi(a,i,e){let t=Jko(a);if(!t||opn(a,e))return!0;let o=a==="autopilot",n=await i.prompt({type:wt.Warning,message:o?d(9340,null):d(9336,null),buttons:[{label:o?d(9338,null):d(9334,null),run:()=>!0},{label:o?d(9337,null):d(9333,null),run:()=>!1}],checkbox:{label:d(9341,null),checked:!1},custom:{icon:o?L.rocket:L.warning,markdownDetails:[{markdown:new he(o?d(9339,null,"chat.permissions.default"):d(9335,null,"chat.permissions.default"),{isTrusted:{enabledCommands:["workbench.action.openSettings"]}})}]}});return n.result!==!0?!1:(n.checkboxChecked&&e.store(t,!0,0,0),YAi.add(a),!0)}function JAi(a){return a.replace(/[^a-zA-Z0-9_-]/g,"_")}var Z0e=class extends vV{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=()=>c.inspect("chat.tools.global.autoApprove").policyValue===!1,f=()=>c.getValue("chat.autopilot.enabled")!==!1;super(e,{actionProvider:{getActions:()=>{let b=t.getExtensionPermissions?.();if(b&&b.items.length>0){let x=JAi(b.sessionType),E=JAi(b.groupId);return b.items.map(M=>({...e,id:`chat.permissions.ext.${x}.${E}.${JAi(M.id)}`,label:M.name,detail:M.description,icon:M.icon,checked:b.selectedId===M.id,enabled:!M.locked,tooltip:M.locked?d(9202,null):"",hover:M.description?{content:M.description}:void 0,run:async()=>{t.setExtensionPermission?.(b.groupId,M),this.element&&this.renderLabel(this.element)}}))}let S=t.currentPermissionLevel.get(),y=g(),w=[{...e,id:"chat.permissions.default",label:d(9198,null),detail:d(9201,null),icon:q.fromId(L.shield.id),checked:S==="default",tooltip:"",hover:{content:d(9199,null)},run:async()=>{t.setPermissionLevel("default"),this.element&&this.renderLabel(this.element)}},{...e,id:"chat.permissions.autoApprove",label:d(9186,null),detail:d(9191,null),icon:q.fromId(L.warning.id),checked:S==="autoApprove",enabled:!y,tooltip:y?d(9190,null):"",hover:{content:y?d(9189,null):d(9187,null)},run:async()=>{await XAi("autoApprove",this.dialogService,h)&&(t.setPermissionLevel("autoApprove"),this.element&&this.renderLabel(this.element))}}];return f()&&w.push({...e,id:"chat.permissions.autopilot",label:d(9192,null),detail:d(9197,null),icon:q.fromId(L.rocket.id),checked:S==="autopilot",enabled:!y,tooltip:y?d(9196,null):"",hover:{content:y?d(9195,null):d(9193,null)},run:async()=>{await XAi("autopilot",this.dialogService,h)&&(t.setPermissionLevel("autopilot"),this.element&&this.renderLabel(this.element))}}),w}},actionBarActions:[{id:"chat.permissions.learnMore",label:d(9203,null),tooltip:d(9203,null),class:void 0,enabled:!0,run:async()=>{let S=t.getExtensionPermissions?.()?.sessionType===_d.ClaudeCode?"https://code.claude.com/docs/en/permission-modes#available-modes":"https://code.visualstudio.com/docs/copilot/agents/agent-tools#_permission-levels";await p.open(A.parse(S))}}],reporter:{id:"ChatPermissionPicker",name:"ChatPermissionPicker",includeOptions:!0},listOptions:{minWidth:255,detailItemHeight:44}},o,n,r,s,l);this.delegate=t;this.dialogService=u;this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.getExtensionPermissions?.(),o,n,r=this.delegate.currentPermissionLevel.get();if(t&&t.items.length>0){let l=t.items.find(c=>c.id===t.selectedId)??t.items.find(c=>c.default)??t.items[0];o=l.icon??L.lock,n=l.name}else switch(r){case"autopilot":o=L.rocket,n=d(9194,null);break;case"autoApprove":o=L.warning,n=d(9188,null);break;default:o=L.shield,n=d(9200,null);break}let s=[];return s.push(...ir(`$(${o.id})`)),s.push(_("span.chat-input-picker-label",void 0,n)),s.push(...ir("$(chevron-down)")),Ii(e,...s),e.classList.toggle("warning",!t&&r==="autopilot"),e.classList.toggle("info",!t&&r==="autoApprove"),e.setAttribute("aria-label",d(9185,null,n)),null}refresh(){this.element&&this.renderLabel(this.element)}dispose(){this._store.isDisposed||(this._onDidDispose.fire(),super.dispose())}};Z0e=I([m(3,kd),m(4,Le),m(5,X),m(6,_e),m(7,B),m(8,ct),m(9,Je),m(10,de)],Z0e);var eWe=class extends vV{constructor(e,t,o,n,r,s,l,c){super(e,{actionProvider:{getActions:()=>{let g=this.delegate.getSelectedWorkspace(),v=this.delegate.getWorkspaces().map(b=>({...e,id:`workspace.${b.uri.toString()}`,label:b.label,checked:g?.uri.toString()===b.uri.toString(),icon:b.isFolder?{id:"folder"}:{id:"file-symlink-directory"},enabled:!0,tooltip:b.uri.fsPath,run:async()=>{this.delegate.setSelectedWorkspace(b),this.element&&this.renderLabel(this.element)}}));return v.push({...e,id:"workspace.openFolder",label:d(9207,null),checked:!1,enabled:!0,tooltip:d(9208,null),run:async()=>{this.commandService.executeCommand(this.delegate.openFolderCommand)}}),v}},actionBarActionProvider:{getActions:()=>[]},showItemKeybindings:!1,reporter:{id:"ChatWorkspacePicker",name:"ChatWorkspacePicker",includeOptions:!1}},o,n,r,s,c);this.delegate=t;this.commandService=l;this._register(this.delegate.onDidChangeSelectedWorkspace(()=>{this.element&&this.renderLabel(this.element)})),this._register(this.delegate.onDidChangeWorkspaces(()=>{this.element&&this.renderLabel(this.element)}))}renderLabel(e){this.setAriaLabelAttributes(e);let t=this.delegate.getSelectedWorkspace(),o=[];if(t){let n=t.label||Be(t.uri);o.push(...ir("$(folder)")),o.push(_("span.chat-input-picker-label",void 0,n))}else o.push(...ir("$(folder)")),o.push(_("span.chat-input-picker-label",void 0,d(9209,null)));return this.pickerOptions.hideChevrons.get()||o.push(...ir("$(chevron-down)")),Ii(e,...o),null}};eWe=I([m(3,kd),m(4,Le),m(5,X),m(6,fe),m(7,_e)],eWe);var py=_,tWe=class extends k{constructor(e,t,o){super();this.instantiationService=e;this.menuService=t;this.contextKeyService=o;this.domNode=py(".chat-context-usage-details"),this.quotaItem=this.domNode.appendChild(py(".quota-indicator"));let n=this.domNode.insertBefore(py("div.header"),this.quotaItem);n.textContent=d(9221,null);let r=this.quotaItem.appendChild(py(".quota-label"));this.tokenCountLabel=r.appendChild(py("span")),this.percentageLabel=r.appendChild(py("span.quota-value"));let s=this.quotaItem.appendChild(py(".quota-bar"));this.progressFill=s.appendChild(py(".quota-bit")),this.outputBufferFill=s.appendChild(py(".quota-bit.output-buffer")),this.outputBufferLegend=this.quotaItem.appendChild(py(".output-buffer-legend")),this.outputBufferLegend.appendChild(py(".output-buffer-swatch"));let l=this.outputBufferLegend.appendChild(py("span"));l.textContent=d(9223,null),this.outputBufferLegend.style.display="none",this.tokenDetailsContainer=this.domNode.appendChild(py(".token-details-container")),this.warningMessage=this.domNode.appendChild(py("div.description")),this.warningMessage.textContent=d(9224,null),this.warningMessage.style.display="none",this.actionsSection=this.domNode.appendChild(py(".actions-section"));let c=this.actionsSection.appendChild(py(".button-bar-container"));this._register(this.instantiationService.createInstance(Oq,c,R.ChatContextUsageActions,{toolbarOptions:{primaryGroup:()=>!0},buttonConfigProvider:()=>({isSecondary:!0})}));let u=this._register(this.menuService.createMenu(R.ChatContextUsageActions,this.contextKeyService)),p=()=>{let h=u.getActions(),g=h.length>0&&h.some(([,f])=>f.length>0);this.actionsSection.style.display=g?"":"none"};this._register(u.onDidChange(p)),p()}update(e){let{percentage:t,usedTokens:o,totalContextWindow:n,outputBufferPercentage:r,promptTokenDetails:s}=e;this.tokenCountLabel.textContent=d(9226,null,this.formatTokenCount(o,1),this.formatTokenCount(n,0)),this.percentageLabel.textContent=d(9225,null,Math.min(100,t).toFixed(0));let l=Math.max(0,Math.min(100,t));this.progressFill.style.width=`${l}%`,r!==void 0&&r>0?(this.outputBufferFill.style.width=`${Math.max(0,Math.min(100-l,r))}%`,this.outputBufferFill.style.display="",this.outputBufferLegend.style.display=""):(this.outputBufferFill.style.width="0",this.outputBufferFill.style.display="none",this.outputBufferLegend.style.display="none"),this.quotaItem.classList.remove("warning","error"),t>=90?this.quotaItem.classList.add("error"):t>=75&&this.quotaItem.classList.add("warning"),this.renderTokenDetails(s,t),this.warningMessage.style.display=t>=75?"":"none"}formatTokenCount(e,t){let o=1e6-500*Math.pow(10,-t);return e>=o?`${(e/1e6).toFixed(t)}M`:e>=1e3?`${(e/1e3).toFixed(t)}K`:e.toString()}renderTokenDetails(e,t){if(St(this.tokenDetailsContainer),!e||e.length===0){this.tokenDetailsContainer.style.display="none";return}this.tokenDetailsContainer.style.display="";let o=new Map,n=0;for(let r of e){let s=o.get(r.category)||[];s.push({label:r.label,percentageOfPrompt:r.percentageOfPrompt}),o.set(r.category,s),n+=r.percentageOfPrompt}if(n<100){let r=100-n;o.set(d(9227,null),[{label:d(9222,null),percentageOfPrompt:r}])}for(let[r,s]of o){let l=s.filter(p=>p.percentageOfPrompt/100*t>=.05);if(l.length===0)continue;let c=this.tokenDetailsContainer.appendChild(py(".token-category")),u=c.appendChild(py(".token-category-header"));u.textContent=r;for(let p of l){let h=c.appendChild(py(".token-detail-item")),g=h.appendChild(py(".token-detail-label"));g.textContent=p.label;let f=p.percentageOfPrompt/100*t,v=h.appendChild(py(".token-detail-value"));v.textContent=`${f.toFixed(1)}%`}}}focus(){this.domNode.focus()}};tWe=I([m(0,F),m(1,Yt),m(2,X)],tWe);var ZAi=_,eNi=class a{static{this.CENTER_X=18}static{this.CENTER_Y=18}static{this.RADIUS=14}constructor(){let i=a.RADIUS;this.circumference=2*Math.PI*i,this.domNode=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.domNode.setAttribute("viewBox","0 0 36 36"),this.domNode.classList.add("circular-progress");let e=document.createElementNS("http://www.w3.org/2000/svg","circle");e.setAttribute("cx",String(a.CENTER_X)),e.setAttribute("cy",String(a.CENTER_Y)),e.setAttribute("r",String(i)),e.classList.add("progress-bg"),this.domNode.appendChild(e),this.progressCircle=document.createElementNS("http://www.w3.org/2000/svg","circle"),this.progressCircle.setAttribute("cx",String(a.CENTER_X)),this.progressCircle.setAttribute("cy",String(a.CENTER_Y)),this.progressCircle.setAttribute("r",String(i)),this.progressCircle.classList.add("progress-arc"),this.progressCircle.setAttribute("stroke-dasharray",String(this.circumference)),this.progressCircle.setAttribute("stroke-dashoffset",String(this.circumference)),this.domNode.appendChild(this.progressCircle)}setProgress(i){let e=Math.max(0,Math.min(100,i)),t=this.circumference-e/100*this.circumference;this.progressCircle.setAttribute("stroke-dashoffset",String(t))}},Yq=class extends k{constructor(e,t,o,n,r,s){super();this.hoverService=e;this.instantiationService=t;this.languageModelsService=o;this.contextKeyService=n;this.storageService=r;this.configurationService=s;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._isVisible=De(this,!1);this._lastRequestDisposable=this._register(new ue);this._hoverDisposable=this._register(new ue);this._contextUsageDetails=this._register(new ue);this._hoverOptions={id:Yq._HOVER_ID,appearance:{showPointer:!0,compact:!0},persistence:{hideOnHover:!1},trapFocus:!0};this.domNode=ZAi(".chat-context-usage-widget"),this.domNode.style.display="none",this.domNode.setAttribute("tabindex","0"),this.domNode.setAttribute("role","button"),this.domNode.setAttribute("aria-label",d(9228,null));let l=this.domNode.appendChild(ZAi(".icon-container"));this.progressIndicator=new eNi,l.appendChild(this.progressIndicator.domNode),this.percentageLabel=this.domNode.appendChild(ZAi(".percentage-label")),this._contextUsageOpenedKey=Z.contextUsageHasBeenOpened.bindTo(this.contextKeyService),this.storageService.getBoolean(Yq._OPENED_STORAGE_KEY,1,!1)&&this._contextUsageOpenedKey.set(!0),this._enabled=this.configurationService.getValue("chat.contextUsage.enabled")!==!1,this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("chat.contextUsage.enabled")&&(this._enabled=this.configurationService.getValue("chat.contextUsage.enabled")!==!1,this._enabled?this.currentData&&this.show():this.hide())})),this.setupHover()}get isVisible(){return this._isVisible}static{this._OPENED_STORAGE_KEY="chat.contextUsage.hasBeenOpened"}static{this._HOVER_ID="chat.contextUsage"}showDetails(){let e=this._createDetails();return e?(this.hoverService.showInstantHover({...this._hoverOptions,content:e.domNode,target:this.domNode,persistence:{hideOnHover:!1,sticky:!0}},!0),this._markOpened(),!0):!1}_createDetails(){if(!(!this._isVisible.get()||!this.currentData))return this._contextUsageDetails.value||(this._contextUsageDetails.value=this.instantiationService.createInstance(tWe)),this._contextUsageDetails.value.update(this.currentData),this._contextUsageDetails.value}_markOpened(){this._contextUsageOpenedKey.set(!0),this.storageService.store(Yq._OPENED_STORAGE_KEY,!0,1,1)}setupHover(){this._hoverDisposable.clear();let e=new O;this._hoverDisposable.value=e,e.add(this.hoverService.setupDelayedHover(this.domNode,()=>({...this._hoverOptions,content:this._createDetails()?.domNode??""}))),e.add($(this.domNode,ne.CLICK,t=>{t.stopPropagation(),this.showDetails()})),e.add($(this.domNode,ne.KEY_DOWN,t=>{let o=new mi(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),this.showDetails())}))}update(e){if(this._lastRequestDisposable.clear(),!e){this.currentData=void 0,this.hide();return}if(!e.response||!e.modelId){this.currentData||this.hide();return}let t=e.response,o=e.modelId;this.updateFromResponse(t,o),this._lastRequestDisposable.value=t.onDidChange(()=>{this.updateFromResponse(t,o)})}updateFromResponse(e,t){let o=e.usage,n=this.languageModelsService.lookupLanguageModel(t),r=n?.maxInputTokens,s=n?.maxOutputTokens,l=(r??0)+(s??0);if(!o||l<=0){this.currentData||this.hide();return}let c=o.promptTokens,u=o.completionTokens,p=o.promptTokenDetails,h=o.outputBuffer,g=c+u,f=g/l*100,v=h!==void 0?Math.max(0,h-u)/l*100:void 0;this.render(f,u,g,l,v,p),this.show()}render(e,t,o,n,r,s){this.currentData={usedTokens:o,completionTokens:t,totalContextWindow:n,percentage:e,outputBufferPercentage:r,promptTokenDetails:s},this.progressIndicator.setProgress(e);let l=Math.min(100,Math.round(e));this.percentageLabel.textContent=`${l}%`,this.domNode.setAttribute("aria-label",d(9229,null,l)),this.domNode.classList.remove("warning","error"),e>=90?this.domNode.classList.add("error"):e>=75&&this.domNode.classList.add("warning")}show(){this._enabled&&this.domNode.style.display==="none"&&(this.domNode.style.display="",this._isVisible.set(!0,void 0),this._onDidChangeVisibility.fire())}hide(){this.domNode.style.display!=="none"&&(this.domNode.style.display="none",this._isVisible.set(!1,void 0),this._onDidChangeVisibility.fire())}};Yq=I([m(0,ot),m(1,F),m(2,Gr),m(3,X),m(4,de),m(5,B)],Yq);var iWe=_,eEo=250,tEo=20,s$t={compact:{top:2,bottom:2},default:{top:12,bottom:12}},iEo="chat.cachedLanguageModels.v2",npn=480,rpn="permissionLevel";var spn=sN({defaultValue:void 0,key:"chat.untitledInputState",toStorage:JSON.stringify,fromStorage(a){let i=JSON.parse(a);if(i.selectedModel&&!i.selectedModel.metadata.isDefaultForLocation){let e=i.selectedModel.metadata.isDefault,t={panel:!!e};Cp(i.selectedModel.metadata,{isDefaultForLocation:t}),delete i.selectedModel.metadata.isDefault}return i}}),C6=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce,Se,Re){super();this.location=e;this.options=t;this.inline=n;this.modelService=r;this.instantiationService=s;this.contextKeyService=l;this.configurationService=c;this.keybindingService=u;this.accessibilityService=p;this.languageModelsService=h;this.logService=g;this.fileService=f;this.editorService=v;this.themeService=b;this.textModelResolverService=S;this.storageService=y;this.agentService=w;this.sharedWebExtracterService=x;this.entitlementService=E;this.chatModeService=M;this.toolService=N;this.chatSessionsService=V;this.chatContextService=H;this.agentSessionsService=K;this.workspaceContextService=j;this.scmService=J;this.layoutService=se;this.viewDescriptorService=ae;this._chatAttachmentWidgetRegistry=ce;this.chatInputNotificationService=Se;this.chatPhoneInputPresenter=Re;this._workingSetCollapsed=De("chatInputPart.workingSetCollapsed",!0);this._stableInputPartWidth=De("chatInputPart.stableInputPartWidth",0);this._chatInputTodoListWidget=this._register(new ue);this._chatArtifactsWidget=this._register(new ue);this._chatQuestionCarouselWidgets=this._register(new Ot);this._questionCarouselResponseIds=new Map;this._questionCarouselSessionResources=new Map;this._chatPlanReviewWidgets=this._register(new Ot);this._planReviewResponseIds=new Map;this._planReviewSessionResources=new Map;this._chatToolConfirmationCarousels=this._register(new Ot);this._chatEditingTodosDisposables=this._register(new O);this._onDidLoadInputState=this._register(new T);this.onDidLoadInputState=this._onDidLoadInputState.event;this._toolbarRelayoutScheduler=this._register(new Dt(()=>{typeof this.cachedWidth=="number"&&this.layout(this.cachedWidth)},0));this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new T);this.onDidBlur=this._onDidBlur.event;this._onDidChangeContext=this._register(new T);this.onDidChangeContext=this._onDidChangeContext.event;this._onDidAcceptFollowup=this._register(new T);this.onDidAcceptFollowup=this._onDidAcceptFollowup.event;this._onDidClickOverlay=this._register(new T);this.onDidClickOverlay=this._onDidClickOverlay.event;this._indexOfLastAttachedContextDeletedWithKeyboard=-1;this._indexOfLastOpenedContext=-1;this._onDidChangeVisibility=this._register(new T);this.inputEditorHeight=0;this.followupsDisposables=this._register(new O);this.overlayClickListener=this._register(new ue);this.attachedContextDisposables=this._register(new ue);this._notificationWidget=this._register(new ue);this._contextUsageDisposables=this._register(new ue);this.height=De(this,0);this._forceVisibleScrollbarUntilAccept=!1;this._modelSyncDisposables=this._register(new O);this._currentChatModes=this._register(new ue);this._isSyncingToOrFromInputModel=!1;this.permissionWidgetDisposeListener=this._register(new ue);this.chatSessionPickerWidgets=this._register(new Ot);this._waitForPersistedLanguageModel=this._register(new ue);this._waitForSessionHistoryLanguageModel=this._register(new ue);this._chatSessionOptionEmitters=this._register(new Ot);this._optionContextKeys=new Map;this._currentLanguageModel=De("_currentLanguageModel",void 0);this._onDidChangeCurrentChatMode=this._register(new T);this.onDidChangeCurrentChatMode=this._onDidChangeCurrentChatMode.event;this.inputUri=A.parse(`${Q.vscodeChatInput}:input-${C6._counter++}`);this._workingSetLinesAddedSpan=new uo(()=>_(".working-set-lines-added"));this._workingSetLinesRemovedSpan=new uo(()=>_(".working-set-lines-removed"));this._chatEditsActionsDisposables=this._register(new O);this._chatEditsDisposables=this._register(new O);this._renderingChatEdits=this._register(new ue);this._attemptedWorkingSetEntriesCount=0;this._chatSessionIsEmpty=!1;this._pendingDelegationTarget=void 0;this._currentSessionType=void 0;this._syncTextDebounced=this._register(new Dt(()=>this._syncInputStateToModel(),150)),this._emptyInputState=this._register(spn(1,0,this.storageService)),this._contextResourceLabels=this._register(this.instantiationService.createInstance(jl,{onDidChangeVisibility:this._onDidChangeVisibility.event})),this._currentModeObservable=De("currentMode",this.options.defaultMode??Bc.Agent);let xe=this.chatModeService.createModes(Br.getNewSessionUri());this._currentChatModes.value=xe,this._currentChatModesObservable=De("currentChatModes",xe),this._currentPermissionLevel=De("permissionLevel",this.getDefaultPermissionLevel()),this._register(this.editorService.onDidActiveEditorChange(()=>{this._indexOfLastOpenedContext=-1,this.refreshChatSessionPickers()})),this._register(this.chatSessionsService.onDidChangeSessionOptions(Ee=>{let Te=this._widget?.viewModel?.model.sessionResource;Te&&ze(Te,Ee.sessionResource)&&this.refreshChatSessionPickers()})),this._register(this.chatSessionsService.onDidChangeOptionGroups(Ee=>{let Te=this._widget?.viewModel?.model.sessionResource;if(Te){let It=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();(yn(Te)===Ee||It===Ee)&&this.refreshChatSessionPickers()}})),this.options.sessionTypePickerDelegate?.onDidChangeActiveSessionProvider&&this._register(this.options.sessionTypePickerDelegate.onDidChangeActiveSessionProvider(async Ee=>{this.getVisibleOptionGroupsModeAndUpdateContextKeys(this.getCurrentSessionResource()),this.agentSessionTypeKey.set(Ee),this.chatSessionSupportsDelegationKey.set(this.chatSessionsService.supportsDelegationForSessionType(Ee)),this.updateWidgetLockStateFromSessionType(Ee),this.checkModeInSessionPool(Ee),this.refreshChatSessionPickers()})),this._attachmentModel=this._register(this.instantiationService.createInstance(hFe)),this._register(this._attachmentModel.onDidChange(()=>this._syncInputStateToModel())),this.selectedToolsModel=this._register(this.instantiationService.createInstance(FFe,this.currentModeObs,this._currentLanguageModel)),this.dnd=this._register(this.instantiationService.createInstance(K0e,()=>this._widget,this._attachmentModel,o)),this.inputEditorMaxHeight=this.options.renderStyle==="compact"?eEo/3:eEo;let He=this.options.renderStyle==="compact"?s$t.compact:s$t.default;if(this.inputEditorMinHeight=this.options.inputEditorMinLines?this.options.inputEditorMinLines*tEo+He.top+He.bottom:void 0,this.inputEditorHasText=Z.inputHasText.bindTo(l),this.chatCursorAtTop=Z.inputCursorAtTop.bindTo(l),this.inputEditorHasFocus=Z.inputHasFocus.bindTo(l),this._hasQuestionCarouselContextKey=Z.Editing.hasQuestionCarousel.bindTo(l),this.chatModeKindKey=Z.chatModeKind.bindTo(l),this.chatModeNameKey=Z.chatModeName.bindTo(l),this.chatModelIdKey=Z.chatModelId.bindTo(l),this.permissionLevelKey=Z.chatPermissionLevel.bindTo(l),this.permissionLevelKey.set(this._currentPermissionLevel.get()),this.withinEditSessionKey=Z.withinEditSessionDiff.bindTo(l),this.filePartOfEditSessionKey=Z.filePartOfEditSession.bindTo(l),this.chatSessionHasOptions=Z.chatSessionHasModels.bindTo(l),this.chatSessionOptionsValid=Z.chatSessionOptionsValid.bindTo(l),this.agentSessionTypeKey=Z.agentSessionType.bindTo(l),this.chatSessionSupportsDelegationKey=Z.chatSessionSupportsDelegation.bindTo(l),this.options.sessionTypePickerDelegate?.getActiveSessionProvider){let Ee=this.options.sessionTypePickerDelegate.getActiveSessionProvider();Ee&&(this.agentSessionTypeKey.set(Ee),this.chatSessionSupportsDelegationKey.set(this.chatSessionsService.supportsDelegationForSessionType(Ee)))}this.chatSessionHasCustomAgentTarget=Z.chatSessionHasCustomAgentTarget.bindTo(l),this.chatSessionHasTargetedModels=Z.chatSessionHasTargetedModels.bindTo(l),this.history=this._register(this.instantiationService.createInstance(ZLe,this.location)),this._register(this.configurationService.onDidChangeConfiguration(Ee=>{let Te={};Ee.affectsConfiguration("chat.tools.global.autoApprove")&&this.setPermissionLevel(this._currentPermissionLevel.get()),Ee.affectsConfiguration("chat.permissions.default")&&this._chatSessionIsEmpty&&this.setPermissionLevel(this.getDefaultPermissionLevel()),Ee.affectsConfiguration("accessibility.verbosity.panelChat")&&(Te.ariaLabel=this._getAriaLabel()),Ee.affectsConfiguration("editor.wordSegmenterLocales")&&(Te.wordSegmenterLocales=this.configurationService.getValue("editor.wordSegmenterLocales")),Ee.affectsConfiguration("editor.autoClosingBrackets")&&(Te.autoClosingBrackets=this.configurationService.getValue("editor.autoClosingBrackets")),Ee.affectsConfiguration("editor.autoClosingQuotes")&&(Te.autoClosingQuotes=this.configurationService.getValue("editor.autoClosingQuotes")),Ee.affectsConfiguration("editor.autoSurround")&&(Te.autoSurround=this.configurationService.getValue("editor.autoSurround")),this.inputEditor.updateOptions(Te)})),this._chatEditsListPool=this._register(this.instantiationService.createInstance(dne,this._onDidChangeVisibility.event,R.ChatEditingWidgetModifiedFilesToolbar,{verticalScrollMode:3})),this._hasFileAttachmentContextKey=Z.hasFileAttachments.bindTo(l),this.initSelectedModel(),this._register(this.languageModelsService.onDidChangeLanguageModels(()=>{Dwo(this._currentLanguageModel.get()?.identifier,this.getModels())&&this.setCurrentLanguageModelToDefault()})),this._register(this.onDidChangeCurrentChatMode(()=>{this.accessibilityService.alert(this._currentModeObservable.get().label.get()),this._inputEditor&&this._inputEditor.updateOptions({ariaLabel:this._getAriaLabel()}),this.setImplicitContextEnablement()})),this._register(ve(Ee=>{let Te=this._currentLanguageModel.read(Ee);this.chatModelIdKey.set(Te?.metadata.id.toLowerCase()??""),Te?.metadata.name&&this.accessibilityService.alert(Te.metadata.name),this._inputEditor?.updateOptions({ariaLabel:this._getAriaLabel()})})),this._register(ve(Ee=>{let Te=this._currentChatModesObservable.read(Ee);Ee.store.add(Te.onDidChange(()=>this.validateCurrentChatMode()))})),this._register(ve(Ee=>{let Te=this._currentModeObservable.read(Ee);this.chatModeKindKey.set(Te.kind),this.chatModeNameKey.set(Te.name.read(Ee));let It=Te.model?.read(Ee);It&&this.switchModelByQualifiedName(It)})),this.validateCurrentChatMode()}static{this._counter=0}get attachmentModel(){return this._attachmentModel}getAttachedContext(){let e=new DH;return e.add(...this.attachmentModel.attachments,...this.chatContextService.getWorkspaceContextItems()),e}getAttachedAndImplicitContext(){let e=this.getAttachedContext();if(this.implicitContext){let t=this.implicitContext.enabledBaseEntries(this.configurationService.getValue("chat.implicitContext.suggestedContext"));e.add(...t)}return e}get implicitContext(){return this._implicitContext}get inputContainerElement(){return this.inputContainer}get gettingStartedTipContainerElement(){return this.chatGettingStartedTipContainer}get inputEditor(){return this._inputEditor}get currentLanguageModel(){return this._currentLanguageModel.get()?.identifier}get selectedLanguageModel(){return this._currentLanguageModel}get currentModeKind(){let e=this._currentModeObservable.get();return e.kind==="agent"&&!this.agentService.hasToolsAgent?"edit":e.kind}get currentModeObs(){return this._currentModeObservable}get currentChatModesObs(){return this._currentChatModesObservable}get currentPermissionLevelObs(){return this._currentPermissionLevel}get currentModeInfo(){let e=this._currentModeObservable.get(),t=e.isBuiltin?this.currentModeKind:"custom",o=e.modeInstructions?.get();return{kind:this.currentModeKind,isBuiltin:e.isBuiltin,modeInstructions:o?{uri:e.uri?.get(),name:e.name.get(),content:o.content,toolReferences:this.toolService.toToolReferences(o.toolReferences),metadata:o.metadata,isBuiltin:e.isBuiltin}:void 0,modeId:t,modeName:x8(e),applyCodeBlockSuggestionId:void 0,permissionLevel:this._currentPermissionLevel.get()}}get selectedElements(){let e=[],o=this._chatEditList?.object?.getSelectedElements()??[];for(let n of o)n.kind==="reference"&&A.isUri(n.reference)&&e.push(n.reference);return e}get attemptedWorkingSetEntriesCount(){return this._attemptedWorkingSetEntriesCount}get pendingDelegationTarget(){return this._pendingDelegationTarget}setImplicitContextEnablement(){this.implicitContext&&this.configurationService.getValue("chat.implicitContext.suggestedContext")&&this.implicitContext.setEnabled(this._currentModeObservable.get().name.get().toLowerCase()==="ask")}setIsWithinEditSession(e,t){this.withinEditSessionKey.set(e),this.filePartOfEditSessionKey.set(t)}getSelectedModelStorageKey(){let e=this._currentSessionType;return e&&this.hasModelsTargetingSessionType()?`chat.currentLanguageModel.${this.location}.${e}`:`chat.currentLanguageModel.${this.location}`}getSelectedModelIsDefaultStorageKey(){let e=this._currentSessionType;return e&&this.hasModelsTargetingSessionType()?`chat.currentLanguageModel.${this.location}.${e}.isDefault`:`chat.currentLanguageModel.${this.location}.isDefault`}initSelectedModel(){this._waitForPersistedLanguageModel.clear();let e=this.storageService.get(this.getSelectedModelStorageKey(),-1),t=this.storageService.getBoolean(this.getSelectedModelIsDefaultStorageKey(),-1,!0);if(e){let o=VMi(e,t,this.getModels(),this.location);o.shouldRestore&&o.model?(this.setCurrentLanguageModel(o.model),this.checkModelSupported()):o.model||(this._waitForPersistedLanguageModel.value=this.languageModelsService.onDidChangeLanguageModels(n=>{let r=this.languageModelsService.lookupLanguageModel(e);if(r){this._waitForPersistedLanguageModel.clear();let s={metadata:r,identifier:e};Rwo(e,t,s,this.location)&&(this.setCurrentLanguageModel(s),this.checkModelSupported())}else this.setCurrentLanguageModelToDefault()}))}this._register(this._onDidChangeCurrentChatMode.event(()=>{this.checkModelSupported()}))}setEditing(e,t){this.currentlyEditingInputKey?.set(e),this.editingSentRequestKey?.set(t)}switchModel(e){let o=this.getModels().find(n=>n.metadata.vendor===e.vendor&&n.metadata.id===e.id&&n.metadata.family===e.family);o&&this.setCurrentLanguageModel(o)}switchModelByQualifiedName(e){let t=this.getModels();for(let o of e){let n=t.find(r=>Mx.matchesQualifiedName(o,r.metadata));if(n)return this.setCurrentLanguageModel(n),!0}return this.logService.warn(`[chat] Node of the models "${e.join(", ")}" not found. Use format "<name> (<vendor>)", e.g. "GPT-4o (copilot)".`),!1}switchToNextModel(){let e=this.getModels();if(e.length>0){let o=(e.findIndex(n=>n.identifier===this._currentLanguageModel.get()?.identifier)+1)%e.length;this.setCurrentLanguageModel(e[o])}}switchToNextPinnedModel(){let e=this.getModels();if(e.length===0)return;let t=new Map(e.map(s=>[s.identifier,s])),o=this.languageModelsService.getPinnedModelIds().map(s=>t.get(s)).filter(so);if(o.length===0)return;let r=(o.findIndex(s=>s.identifier===this._currentLanguageModel.get()?.identifier)+1)%o.length;this.setCurrentLanguageModel(o[r])}openModelPicker(){if(this.chatPhoneInputPresenter.enabled.get()){this._showCombinedPhonePickerSheet();return}this.modelWidget?.show()}openModePicker(){if(this.chatPhoneInputPresenter.enabled.get()){this._showCombinedPhonePickerSheet();return}this.modeWidget?.show()}_showCombinedPhonePickerSheet(){let e=this.inputActionsToolbar.getElement();this.chatPhoneInputPresenter.showCombinedModeAndModelSheet(e,this._createModePickerDelegate(),this._createModelPickerDelegate()).catch(t=>this.logService.error("[ChatInputPart] phone picker sheet failed",t))}_createModelPickerDelegate(){return{currentModel:this._currentLanguageModel,setModel:e=>{this._waitForPersistedLanguageModel.clear(),this._waitForSessionHistoryLanguageModel.clear(),this.setCurrentLanguageModel(e),this.renderAttachedContext()},getModels:()=>this.getModels(),useGroupedModelPicker:()=>{let e=this.getCurrentSessionType();return!e||e===kl},showManageModelsAction:()=>{let e=this.getCurrentSessionType();return!e||e===kl},showUnavailableFeatured:()=>{let e=this.getCurrentSessionType();return!e||e===kl},showFeatured:()=>{let e=this.getCurrentSessionType();return!e||e===kl}}}_createModePickerDelegate(){return{currentMode:this._currentModeObservable,currentChatModes:this._currentChatModesObservable,sessionResource:()=>this._widget?.viewModel?.sessionResource,customAgentTarget:()=>{let e=this._widget?.viewModel?.model.sessionResource;return(e&&this.chatSessionsService.getCustomAgentTargetForSessionType(yn(e)))??"undefined"}}}openPermissionPicker(){this.permissionWidget?.show()}setPermissionLevel(e){e=this.getPermittedPermissionLevel(e),this._currentPermissionLevel.set(e,void 0),this.permissionLevelKey.set(e),this.permissionWidget?.refresh();let t=this.getCurrentSessionResource();t&&this.chatSessionsService.setSessionOption(t,rpn,e),this._syncInputStateToModel()}getDefaultPermissionLevel(){let e=this.configurationService.getValue("chat.permissions.default");return nao(e)?e:"default"}getPermittedPermissionLevel(e){return this.configurationService.inspect("chat.tools.global.autoApprove").policyValue===!1&&e!=="default"?"default":e}openSessionTargetPicker(){this.sessionTargetWidget?.show()}openDelegationPicker(){this.delegationWidget?.show()}openChatSessionPicker(){this.chatSessionPickerWidgets?.values()?.next().value?.show()}createChatSessionPickerWidgets(e,t){this._lastSessionPickerAction=e,this._lastSessionPickerOptions=t;let o=this.getCurrentSessionResource(),n=this.getVisibleOptionGroupsModeAndUpdateContextKeys(o);if(!n.length)return[];let r=this.getEffectiveSessionType(o);if(!r)return[];this.chatSessionPickerWidgets.clearAndDisposeAll();let s=[];for(let l of n){let c=this.getCurrentOptionForGroup(l.id),u={group:l,item:c},p={getCurrentOption:()=>this.getCurrentOptionForGroup(l.id),onDidChangeOption:this.getOrCreateOptionEmitter(l.id).event,setOption:g=>{this.updateOptionContextKey(l.id,g.id),this.getOrCreateOptionEmitter(l.id).fire(g);let f=this._widget?.viewModel?.model.sessionResource;f&&this.chatSessionsService.setSessionOption(f,l.id,g),this.refreshChatSessionPickers()},getOptionGroup:()=>this.chatSessionsService.getOptionGroupsForSessionType(r)?.find(f=>f.id===l.id),getSessionResource:()=>this._widget?.viewModel?.model.sessionResource},h=this.instantiationService.createInstance(LFe,e,u,p,t);this.chatSessionPickerWidgets.set(l.id,h),s.push(h)}return s}setInputModel(e,t,o){this._inputModel&&this._syncInputStateToModel(),this._inputModel=e,this._modelSyncDisposables.clear();let n=this.chatModeService.createModes(o);this._currentChatModes.value=n,this._currentChatModesObservable.set(n,void 0),this.selectedToolsModel.resetSessionEnablementState(),this._chatSessionIsEmpty=t,t&&(this._setEmptyModelState(),this._modelSyncDisposables.add(this.configurationService.onDidChangeConfiguration(r=>{this._chatSessionIsEmpty&&r.affectsConfiguration("chat.newSession.defaultMode")&&this._setEmptyModelState()})),this._modelSyncDisposables.add(this._currentChatModesObservable.get().onDidChange(()=>{this._chatSessionIsEmpty&&this._setEmptyModelState()}))),this._modelSyncDisposables.add(ve(r=>{let s=e.state.read(r);!s&&this._chatSessionIsEmpty&&(s=this._emptyInputState.read(void 0)),this._syncFromModel(s,o)}))}_setEmptyModelState(){if(this._inputModel?.state?.get()?.permissionLevel!==this.getDefaultPermissionLevel()&&this.setPermissionLevel(this.getDefaultPermissionLevel()),this.entitlementService.anonymous){this.setChatMode("agent",!1),this.checkModelSupported();return}let e=this.configurationService.getValue("chat.newSession.defaultMode");if(typeof e=="string"){let t=e.trim();if(t){let o=t.toLowerCase(),n=this._currentChatModesObservable.get(),r=n.findModeById(t)??n.findModeByName(t)??n.custom.find(s=>s.name.get().toLowerCase()===o);r&&(this.logService.trace(`[ChatInputPart] Applying default mode from setting: ${t} -> ${r.id}`),this.setChatMode(r.id,!1),this.checkModelSupported())}}}_syncFromModel(e,t){if(!this._isSyncingToOrFromInputModel)try{if(this._isSyncingToOrFromInputModel=!0,e&&this._currentModeObservable.get().id!==e.mode.id&&this.setChatMode(e.mode.id,!1),e?.selectedModel){let n=this.getAllMergedModels(),r=yn(t),s=Two(e.selectedModel,this._currentLanguageModel.get(),n,r,{location:this.location,currentModeKind:this.currentModeKind,sessionType:r});s.action==="apply"?this.setCurrentLanguageModel(e.selectedModel):s.action==="default"&&this.setCurrentLanguageModelToDefault()}let o=this._attachmentModel.attachments;if(e?eo(o,e.attachments)||this._attachmentModel.clearAndSetContext(...e.attachments):this._attachmentModel.clear(),this._inputEditor&&(this._inputEditor.setValue(e?.inputText||""),e?.selections.length&&this._inputEditor.setSelections(e.selections)),!this.configurationService.getValue("chat.tools.global.autoApprove")){let n=this.getPermittedPermissionLevel(e?.permissionLevel??"default");this._currentPermissionLevel.get()!==n&&(this._currentPermissionLevel.set(n,void 0),this.permissionLevelKey.set(n),this.permissionWidget?.refresh())}e&&this._widget?.contribs.forEach(n=>{n.setInputState?.(e.contrib)})}finally{this._isSyncingToOrFromInputModel=!1}}_syncInputStateToModel(){if(this._isSyncingToOrFromInputModel)return;this._isSyncingToOrFromInputModel=!0;let e=this.getCurrentInputState();this._chatSessionIsEmpty&&this._emptyInputState.set(e,void 0),this._inputModel?.setState(e),this._isSyncingToOrFromInputModel=!1,queueMicrotask(()=>this.inputActionsToolbar?.relayout())}flushInputStateToModel(){this._inputModel&&this._syncInputStateToModel()}setCurrentLanguageModel(e){this._currentLanguageModel.set(e,void 0),this.cachedWidth&&this.layout(this.cachedWidth),this.storageService.store(this.getSelectedModelStorageKey(),e.identifier,-1,0),this.storageService.store(this.getSelectedModelIsDefaultStorageKey(),!!e.metadata.isDefaultForLocation[this.location],-1,0),this._syncInputStateToModel()}checkModelSupported(){let e=this._currentLanguageModel.get(),t=this.getAllMergedModels();Ewo(e,this.getModels(),{location:this.location,currentModeKind:this.currentModeKind,sessionType:this.getCurrentSessionType()},t)&&this.setCurrentLanguageModelToDefault()}setChatMode(e,t=!0){if(!this.options.supportsChangingModes)return;let o=this._currentChatModesObservable.get(),n=o.findModeById(e)??o.findModeByName(e)??o.findModeById("agent")??Bc.Ask;this.setChatMode2(n,t)}setChatMode2(e,t=!0){this.options.supportsChangingModes&&(this._currentModeObservable.set(e,void 0),this._onDidChangeCurrentChatMode.fire(),this._syncInputStateToModel())}getAllMergedModels(){let e=this.storageService.getObject(iEo,-1,[]),t=this.languageModelsService.getLanguageModelIds().map(s=>({identifier:s,metadata:this.languageModelsService.lookupLanguageModel(s)})),o=new Set(this.languageModelsService.getVendors().map(s=>s.vendor)),n=new Set;for(let s of o)this.languageModelsService.hasResolvedVendor(s)&&n.add(s);let r=_wo(t,e,o,n);return(t.length>0||n.size>0)&&this.storageService.store(iEo,r,-1,1),r}getModels(){let e=this.getAllMergedModels();return e.sort((t,o)=>t.metadata.name.localeCompare(o.metadata.name)),xwo(e,this.getCurrentSessionType(),this.currentModeKind,this.location)}getCurrentSessionType(){let e=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.();if(e)return e;let t=this._widget?.viewModel?.model.sessionResource;return t?yn(t):void 0}hasModelsTargetingSessionType(){return tGt(this.getAllMergedModels(),this.getCurrentSessionType())}isModelValidForCurrentSession(e){return iGt(e,this.getAllMergedModels(),this.getCurrentSessionType())}checkModelInSessionPool(){let e=this._currentLanguageModel.get();e&&!this.isModelValidForCurrentSession(e)&&this.setCurrentLanguageModelToDefault()}checkModeInSessionPool(e){if(!e){let r=this._widget?.viewModel?.model.sessionResource;if(!r)return;e=yn(r)}let t=this.chatSessionsService.getCustomAgentTargetForSessionType(e);if(!t||t==="undefined")return;let o=this._currentModeObservable.get();if(o.id===Bc.Agent.id)return;if(o.isBuiltin){this.setChatMode("agent",!1);return}let n=o.target.get();n!==t&&n!=="undefined"&&this.setChatMode("agent",!1)}preselectModelFromSessionHistory(){this._waitForSessionHistoryLanguageModel.clear();let e=this._widget?.viewModel?.model,t=e?.sessionResource,o=e?.getRequests();if(!t||!o||o.length===0)return;let n=wu(o,c=>!!c.modeInfo)?.modeInfo;n&&n.modeInstructions?.uri&&this.setChatMode(n.modeInstructions.uri.toString());let r=wu(o,c=>!!c.modelId)?.modelId;if(!r)return;let s=()=>{let c=this.getModels();if(c.length===0||c.length===1&&c[0].metadata.id.toLocaleLowerCase()==="auto")return;let u=c.find(p=>p.identifier===r);return u||(u=c.find(p=>p.metadata.id===r)),u},l=s();if(l){this.setCurrentLanguageModel(l);return}this._waitForSessionHistoryLanguageModel.value=this.languageModelsService.onDidChangeLanguageModels(()=>{let c=this._widget?.viewModel?.model.sessionResource;if(!c||!ze(c,t)){this._waitForSessionHistoryLanguageModel.clear();return}let u=s();u&&(this._waitForSessionHistoryLanguageModel.clear(),this.setCurrentLanguageModel(u))})}setCurrentLanguageModelToDefault(){let e=this.getModels(),t=kwo(e,this.location);t&&this.setCurrentLanguageModel(t)}getCurrentInputState(){let e=this._currentModeObservable.get(),t={inputText:this._inputEditor?.getValue()??"",attachments:this._attachmentModel.attachments,mode:{id:e.id,kind:e.kind},selectedModel:this._currentLanguageModel.get(),selections:this._inputEditor?.getSelections()||[],permissionLevel:this._currentPermissionLevel.get(),contrib:{}};for(let o of this._widget?.contribs||yt.empty())o.getInputState?.(t.contrib);return t}_getAriaLabel(){let e=this.configurationService.getValue("accessibility.verbosity.panelChat"),t;e&&(t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel());let o=this._currentModeObservable.get(),n=this._currentLanguageModel.get()?.metadata.name,r=n?d(9102,null,n):"",s="";if(o.isBuiltin)switch(this.currentModeKind){case"agent":s=d(9098,null);break;case"edit":s=d(9101,null);break;case"ask":default:s=d(9099,null);break}else{let l=this.currentModeObs.get();s=d(9100,null,l.label.get(),l.description.get())}return e?t?d(9091,null,s,r,t):d(9097,null,s,r):d(9096,null,s,r)}validateCurrentChatMode(){let e=this._currentModeObservable.get(),t=this._currentChatModesObservable.get().findModeById(e.id),o=this.configurationService.getValue("chat.agent.enabled");if(!t){this.setChatMode(o?"agent":"ask");return}if(e.kind==="agent"&&!o){this.setChatMode("ask");return}}logInputHistory(){let e=this.history.values.map(t=>JSON.stringify(t)).join(`
`);this.logService.info(`[${this.location}] Chat input history:`,e)}setVisible(e){this._onDidChangeVisibility.fire(e)}get generating(){return this._generating?.defer.p}startGenerating(){return this.logService.trace("ChatWidget#startGenerating"),this._generating?this._generating.rc++:this._generating={rc:1,defer:new Mo},ee(()=>{this.logService.trace("ChatWidget#doneGenerating"),this._generating&&!--this._generating.rc&&(this._generating.defer.complete(),this._generating=void 0)})}get element(){return this.container}async showPreviousValue(){if(this.history.isAtStart())return;let e=this.getCurrentInputState();(e.inputText||e.attachments.length)&&this.history.overlay(e),this.navigateHistory(!0)}async showNextValue(){if(this.history.isAtEnd())return;let e=this.getCurrentInputState();(e.inputText||e.attachments.length)&&this.history.overlay(e),this.navigateHistory(!1)}async restoreAttachments(e){let t=[...e];t.length>0&&(t=(await Promise.all(t.map(async o=>{if(SC(o)&&!o.value&&o.references?.length&&A.isUri(o.references[0].reference)){let n=o.references[0].reference;try{let r=n.toString(!0).startsWith("http")?await this.sharedWebExtracterService.readImage(n,Ie.None):(await this.fileService.readFile(n)).value;if(!r)return;let s={...o};return s.value=SC(o)&&o.isPasted?r.buffer:await JA(r.buffer),s}catch(r){this.logService.error("Failed to fetch and reference.",r);return}}return o}))).filter(so)),this._attachmentModel.clearAndSetContext(...t)}async navigateHistory(e){let t=e?this.history.previous():this.history.next();await this.restoreAttachments(t?.attachments??[]);let o=t?.inputText??"",n=t?.contrib??{};Er(o),this.setValue(o,!0),this._widget?.contribs.forEach(s=>{s.setInputState?.(n)}),this._onDidLoadInputState.fire();let r=this._inputEditor.getModel();r&&(e?this._inputEditor.setPosition({lineNumber:1,column:1}):this._inputEditor.setPosition(tNi(r)))}setValue(e,t){this.inputEditor.setValue(e);let o=this.inputEditor.getModel();o&&this.inputEditor.setPosition(tNi(o))}focus(){this._inputEditor.focus()}hasFocus(){return this._inputEditor.hasWidgetFocus()}focusTodoList(){return this._chatInputTodoListWidget.value?.focus()??!1}isTodoListFocused(){return this._chatInputTodoListWidget.value?.hasFocus()??!1}hasVisibleTodos(){return this._chatInputTodoListWidget.value?.hasTodos()??!1}async acceptInput(e){if(e){let t=this.getCurrentInputState();this.history.append(this._getFilteredEntry(t))}this.resetScrollbarVisibilityAfterAccept(),this.chatInputNotificationService.handleMessageSent(),this._chatSessionIsEmpty&&(this._chatSessionIsEmpty=!1,this._emptyInputState.set(void 0,void 0)),this.attachmentModel.clear(),this._onDidLoadInputState.fire(),this.accessibilityService.isScreenReaderOptimized()&&et?this._acceptInputForVoiceover():(this._inputEditor.focus(),this._inputEditor.setValue(""))}validateAgentMode(){!this.agentService.hasToolsAgent&&this._currentModeObservable.get().kind==="agent"&&this.setChatMode("edit")}_getFilteredEntry(e){let t=e.attachments.map(o=>{if(SC(o)&&o.references?.length&&o.value){let n={...o};return n.value=void 0,n}return o});return{...e,attachments:t}}_acceptInputForVoiceover(){let e=this._inputEditor.getDomNode();e&&(e.remove(),this._inputEditor.setValue(""),this._inputEditorElement.appendChild(e),this._inputEditor.focus())}_handleAttachedContextChange(){this._hasFileAttachmentContextKey.set(!!this._attachmentModel.attachments.find(e=>e.kind==="file")),this.renderAttachedContext()}getOrCreateOptionEmitter(e){let t=this._chatSessionOptionEmitters.get(e);return t||(t=new T,this._chatSessionOptionEmitters.set(e,t)),t}getOrCreateOptionContextKey(e){if(!this._scopedContextKeyService)return;let t=this._optionContextKeys.get(e);return t||(t=new Y(`chatSessionOption.${e}`,"").bindTo(this._scopedContextKeyService),this._optionContextKeys.set(e,t)),t}updateOptionContextKey(e,t){let o=t.trim(),n=this.getOrCreateOptionContextKey(e);n&&n.set(o)}evaluateOptionGroupVisibility(e){if(!e.when||!this._scopedContextKeyService)return!0;let t=C.deserialize(e.when);return t?this._scopedContextKeyService.contextMatchesRules(t):!0}getVisibleOptionGroupsModeAndUpdateContextKeys(e){let t=e&&this.chatSessionsService.getCustomAgentTargetForSessionType(yn(e));this.chatSessionHasCustomAgentTarget.set(t!=="undefined");let o=e&&this.chatSessionsService.requiresCustomModelsForSessionType(yn(e));this.chatSessionHasTargetedModels.set(!!o);let n=this.getVisibleOptionGroups(e);if(this.permissionWidget?.refresh(),!n.length)return this.chatSessionHasOptions.set(!1),this.chatSessionOptionsValid.set(!0),[];let r=e?this.areAllOptionsValid(e,n):!0;return this.chatSessionHasOptions.set(!0),this.chatSessionOptionsValid.set(r),n}getCurrentSessionResource(){return this._widget?.viewModel?.model.sessionResource}areAllOptionsValid(e,t){for(let o of t){let n=this.chatSessionsService.getSessionOption(e,o.id);if(n){let r=typeof n=="string"?n:n.id;if(!o.items.some(s=>s.id===r)&&typeof n=="string")return!1}}return!0}getAllOptionsGroups(e){let o=this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.()??(e?yn(e):void 0);return o?this.chatSessionsService.getOptionGroupsForSessionType(o)??[]:[]}getVisibleOptionGroups(e){let t=this.getAllOptionsGroups(e);if(!t.length)return[];if(e)for(let n of t){let r=this.chatSessionsService.getSessionOption(e,n.id);if(r){let s=typeof r=="string"?r:r.id;this.updateOptionContextKey(n.id,s)}}let o=new Map;for(let n of t){if(n.kind==="permissions")continue;let r=n.items.length>0||(n.commands||[]).length>0,s=this.evaluateOptionGroupVisibility(n),l=!e||this.chatSessionsService.getSessionOption(e,n.id)!==void 0;r&&s&&l&&o.set(n.id,n)}return Array.from(o.values())}getActiveExtensionPermissionGroup(e){return this.getAllOptionsGroups(e).find(o=>o.kind==="permissions"&&o.items.length>0&&this.evaluateOptionGroupVisibility(o))}refreshChatSessionPickers(){let e=this.getCurrentSessionResource(),t=this.getAllOptionsGroups(e),o=this.getVisibleOptionGroupsModeAndUpdateContextKeys(e);if(!t.length||!o.length){this.hideAllSessionPickerWidgets();return}let n=new Set(this.chatSessionPickerWidgets.keys());if((n.size!==o.length||!o.every(s=>n.has(s.id)))&&this._lastSessionPickerAction&&this.chatSessionPickerContainer){let s=this.createChatSessionPickerWidgets(this._lastSessionPickerAction,this._lastSessionPickerOptions);St(this.chatSessionPickerContainer);for(let l of s){let c=_(".action-item.chat-sessionPicker-item");l.render(c),this.chatSessionPickerContainer.appendChild(c)}}if(this.chatSessionPickerContainer&&(this.chatSessionPickerContainer.style.display=""),e)for(let[s]of this.chatSessionPickerWidgets){let l=this.chatSessionsService.getSessionOption(e,s);if(l){let c=t.find(u=>u.id===s);if(c){let u=typeof l=="string"?l:l.id,p=c.items.find(h=>h.id===u);p&&typeof l=="string"?this.getOrCreateOptionEmitter(s).fire(p):typeof l!="string"&&this.getOrCreateOptionEmitter(s).fire(l)}}}}hideAllSessionPickerWidgets(){this.chatSessionPickerContainer&&(this.chatSessionPickerContainer.style.display="none")}getCurrentOptionForGroup(e){let t=this._widget?.viewModel?.model.sessionResource;if(!t||this.chatSessionsService.getSessionOption(t,e)===void 0)return;let o=this.getEffectiveSessionType(t),r=(o?this.chatSessionsService.getOptionGroupsForSessionType(o):void 0)?.find(l=>l.id===e);if(!r||r.items.length===0)return;let s=this.chatSessionsService.getSessionOption(t,e);if(!s)return r.items.find(c=>c.default);if(typeof s=="string"){let l=s.trim();return r.items.find(c=>c.id===l)}else return s}hasWorkspaceScmRepository(){if(this.workspaceContextService.getWorkspace().folders.length===0)return!1;for(let t of this.scmService.repositories)if(t.provider.rootUri&&this.workspaceContextService.getWorkspaceFolder(t.provider.rootUri))return!0;return!1}getEffectiveSessionType(e){return this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.()??(e?yn(e):void 0)}updateAgentSessionTypeContextKey(){let e=this._widget?.viewModel?.model.sessionResource,t=this.options.sessionTypePickerDelegate,n=t?.setActiveSessionProvider&&t?.getActiveSessionProvider?.()||(e?yn(e):"");this.agentSessionTypeKey.set(n),this.chatSessionSupportsDelegationKey.set(this.chatSessionsService.supportsDelegationForSessionType(n))}updateWidgetLockStateFromSessionType(e){if(e===kl){this._widget?.unlockFromCodingAgent();return}let t=this.chatSessionsService.getChatSessionContribution(e);t?this._widget?.lockToCodingAgent(t.name,t.displayName,t.type):this._widget?.unlockFromCodingAgent()}ensureNotificationWidget(){this._notificationWidget.value||(this._notificationWidget.value=this.instantiationService.createInstance(q0e),this.chatInputNotificationContainer.appendChild(this._notificationWidget.value.domNode))}showContextUsageDetails(){return this.contextUsageWidget?.showDetails()??!1}updateContextUsageWidget(){this._contextUsageDisposables.clear();let e=this._widget?.viewModel?.model;if(!e||!this.contextUsageWidget)return;let t=new O;this._contextUsageDisposables.value=t,t.add(e.onDidChange(o=>{(o.kind==="addRequest"||o.kind==="completedRequest")&&this.contextUsageWidget?.update(e.lastRequest)})),this.contextUsageWidget.update(e.lastRequest)}render(e,t,o){this._widget=o,this.getVisibleOptionGroupsModeAndUpdateContextKeys(this.getCurrentSessionResource());let n=this.options.sessionTypePickerDelegate;if(n?.setActiveSessionProvider&&n?.getActiveSessionProvider){let ae=n.getActiveSessionProvider();ae&&this.updateWidgetLockStateFromSessionType(ae)}this._register(o.onDidChangeViewModel(ae=>{this._pendingDelegationTarget=void 0,this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers(),this.ensureNotificationWidget(),this.updateContextUsageWidget();let ce=!1;if(ae.currentSessionResource){for(let xe of this._questionCarouselSessionResources.values())if(ze(xe,ae.currentSessionResource)){ce=!0;break}}this._questionCarouselSessionResources.size>0&&(!ae.currentSessionResource||!ce)&&this.clearQuestionCarousel();let Se=!1;if(ae.currentSessionResource){for(let xe of this._planReviewSessionResources.values())if(ze(xe,ae.currentSessionResource)){Se=!0;break}}this._planReviewSessionResources.size>0&&(!ae.currentSessionResource||!Se)&&this.clearPlanReview(),this._syncToolConfirmationCarouselForSession();let Re=this.getCurrentSessionType();ae.currentSessionResource&&Re!==this._currentSessionType&&(this._currentSessionType=Re,this.initSelectedModel(),this.checkModelInSessionPool(),this.checkModeInSessionPool()),this.preselectModelFromSessionHistory()}));let r;this.options.renderStyle==="compact"?r=st(".interactive-input-part",[st(".interactive-input-and-edit-session",[st(".chat-plan-review-widget-container@chatPlanReviewContainer"),st(".chat-question-carousel-widget-container@chatQuestionCarouselContainer"),st(".chat-tool-confirmation-carousel-container@chatToolConfirmationCarouselContainer"),st(".chat-input-notification-container@chatInputNotificationContainer"),st(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),st(".chat-artifacts-widget-container@chatArtifactsWidgetContainer"),st(".chat-editing-session@chatEditingSessionWidgetContainer"),st(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),st(".interactive-input-and-side-toolbar@inputAndSideToolbar",[st(".chat-input-container@inputContainer",[st(".chat-editor-container@editorContainer"),st(".chat-input-toolbars@inputToolbars")])]),st(".chat-secondary-toolbar@secondaryToolbar",[st(".chat-context-usage-container@contextUsageWidgetContainer")]),st(".chat-attachments-container@attachmentsContainer",[st(".chat-attached-context@attachedContextContainer")]),st(".interactive-input-followups@followupsContainer")])]):r=st(".interactive-input-part",[st(".chat-plan-review-widget-container@chatPlanReviewContainer"),st(".chat-question-carousel-widget-container@chatQuestionCarouselContainer"),st(".chat-tool-confirmation-carousel-container@chatToolConfirmationCarouselContainer"),st(".interactive-input-followups@followupsContainer"),st(".chat-input-notification-container@chatInputNotificationContainer"),st(".chat-todo-list-widget-container@chatInputTodoListWidgetContainer"),st(".chat-artifacts-widget-container@chatArtifactsWidgetContainer"),st(".chat-editing-session@chatEditingSessionWidgetContainer"),st(".chat-getting-started-tip-container@chatGettingStartedTipContainer"),st(".interactive-input-and-side-toolbar@inputAndSideToolbar",[st(".chat-input-container@inputContainer",[st(".chat-attachments-container@attachmentsContainer",[st(".chat-attached-context@attachedContextContainer")]),st(".chat-editor-container@editorContainer"),st(".chat-input-toolbars@inputToolbars")])]),st(".chat-secondary-toolbar@secondaryToolbar",[st(".chat-context-usage-container@contextUsageWidgetContainer")])]),this.container=r.root,this.chatInputOverlay=_(".chat-input-overlay"),e.append(this.container),this.container.append(this.chatInputOverlay),this.container.classList.toggle("compact",this.options.renderStyle==="compact"),this._scopedContextKeyService=this._register(this.contextKeyService.createScoped(this.container)),this.followupsContainer=r.followupsContainer;let s=r.inputAndSideToolbar,l=r.inputContainer;this.inputContainer=l;let c=r.editorContainer;this.attachmentsContainer=r.attachmentsContainer,this.attachedContextContainer=r.attachedContextContainer;let u=r.inputToolbars;this.secondaryToolbarContainer=r.secondaryToolbar,this.options.renderStyle==="compact"&&(this.secondaryToolbarContainer.style.display="none"),this.chatEditingSessionWidgetContainer=r.chatEditingSessionWidgetContainer,this.chatInputTodoListWidgetContainer=r.chatInputTodoListWidgetContainer,this.chatArtifactsWidgetContainer=r.chatArtifactsWidgetContainer,this.chatGettingStartedTipContainer=r.chatGettingStartedTipContainer,this.chatGettingStartedTipContainer.style.display="none",this.chatQuestionCarouselContainer=r.chatQuestionCarouselContainer,this.chatPlanReviewContainer=r.chatPlanReviewContainer,this.chatToolConfirmationCarouselContainer=r.chatToolConfirmationCarouselContainer,Wi(this.chatToolConfirmationCarouselContainer),this.chatInputNotificationContainer=r.chatInputNotificationContainer,this.contextUsageWidgetContainer=r.contextUsageWidgetContainer,(this.options.isSessionsWindow||this.options.renderStyle==="compact")&&u.prepend(this.contextUsageWidgetContainer),this.contextUsageWidget=this._register(this.instantiationService.createInstance(Yq)),this.contextUsageWidgetContainer.appendChild(this.contextUsageWidget.domNode),this.options.enableImplicitContext&&!this._implicitContext?(this._implicitContext=this._register(this.instantiationService.createInstance(KGt)),this.setImplicitContextEnablement(),this._register(this._implicitContext.onDidChangeValue(()=>{this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._handleAttachedContextChange()}))):!this.options.enableImplicitContext&&this._implicitContext&&(this._implicitContext?.dispose(),this._implicitContext=void 0),this.ensureNotificationWidget(),this._register(this._attachmentModel.onDidChange(ae=>{ae.added.length>0&&(this._indexOfLastAttachedContextDeletedWithKeyboard=-1),this._handleAttachedContextChange()})),this.renderChatEditingSessionState(null),this.dnd.addOverlay(this.options.dndContainer??e,this.options.dndContainer??e);let p=this._register(this.contextKeyService.createScoped(l));Z.inChatInput.bindTo(p).set(!0),this.currentlyEditingInputKey=Z.currentlyEditingInput.bindTo(p),this.editingSentRequestKey=Z.editingRequestType.bindTo(this.contextKeyService);let h=this._register(this.instantiationService.createChild(new Po([X,p]))),{historyNavigationBackwardsEnablement:g,historyNavigationForwardsEnablement:f}=this._register(JB(p,this));this.historyNavigationBackwardsEnablement=g,this.historyNavigationForewardsEnablement=f;let v=ay(this.configurationService);v.overflowWidgetsDomNode=this.options.editorOverflowWidgetsDomNode,v.pasteAs=PS.pasteAs.defaultValue,v.readOnly=!1,v.ariaLabel=this._getAriaLabel(),v.fontFamily=WF,v.fontSize=13,v.lineHeight=tEo,v.padding=this.options.renderStyle==="compact"?s$t.compact:s$t.default,v.cursorWidth=1,v.wrappingStrategy="advanced",v.bracketPairColorization={enabled:!1},v.autoClosingBrackets=this.configurationService.getValue("editor.autoClosingBrackets"),v.autoClosingQuotes=this.configurationService.getValue("editor.autoClosingQuotes"),v.autoSurround=this.configurationService.getValue("editor.autoSurround"),v.suggest={showIcons:!0,showSnippets:!1,showWords:!0,showStatusBar:!1,insertMode:"insert"},v.scrollbar=this.options.renderStyle==="compact"?{...v.scrollbar??{},vertical:"hidden"}:{...v.scrollbar??{},vertical:"auto",verticalScrollbarSize:7},v.stickyScroll={enabled:!1},this._inputEditorElement=D(c,iWe(oEo));let b=nNe();b.contributions?.push(...ml.getSomeEditorContributions([ql.ID,jf.ID,Gh.ID,Ju.ID,nE.ID])),this._inputEditor=this._register(h.createInstance(us,this._inputEditorElement,v,b)),Sc.get(this._inputEditor)?.forceRenderingAbove(),v.overflowWidgetsDomNode?.classList.add("hideSuggestTextIcons"),this._inputEditorElement.classList.add("hideSuggestTextIcons"),this._register(this._inputEditor.onKeyDown(ae=>{if(ae.keyCode===3&&!zvt(ae))for(let ce of this.keybindingService.lookupKeybindings(cO.ID)){let Se=ce.getDispatchChords();if(Se.length===1&&Se[0]==="[Enter]"){ae.preventDefault();break}}})),this._register(this._inputEditor.onDidChangeModelContent(()=>{let ae=Math.min(this._inputEditor.getContentHeight(),this._effectiveInputEditorMaxHeight);ae!==this.inputEditorHeight&&(this.inputEditorHeight=ae,this.cachedWidth&&this._layout(this.cachedWidth));let ce=this._inputEditor.getModel(),Se=!!ce&&ce.getValue().trim().length>0;this.inputEditorHasText.set(Se),this._syncTextDebounced.schedule()})),this._register(this._inputEditor.onDidContentSizeChange(ae=>{ae.contentHeightChanged&&(this.inputEditorHeight=this.inline?this.inputEditorHeight:ae.contentHeight,this.cachedWidth&&this._layout(this.cachedWidth))})),this._register(this._inputEditor.onDidFocusEditorText(()=>{this.inputEditorHasFocus.set(!0),this._onDidFocus.fire(),l.classList.toggle("focused",!0)})),this._register(this._inputEditor.onDidBlurEditorText(()=>{this.inputEditorHasFocus.set(!1),l.classList.toggle("focused",!1),this._onDidBlur.fire()})),this._register(this._inputEditor.onDidBlurEditorWidget(()=>{Ju.get(this._inputEditor)?.clearWidgets(),Gh.get(this._inputEditor)?.clearWidgets()}));let S=this._register(Dg()),{location:y}=this.getWidgetLocationInfo(o),w={getOverflowAnchor:()=>this.inputActionsToolbar.getElement(),actionContext:{widget:o},hideChevrons:ke(ae=>this._stableInputPartWidth.read(ae)<npn)},x={...w,getOverflowAnchor:()=>this.secondaryToolbar.getElement()};this._register(Yo(u,ne.CLICK,ae=>this.inputEditor.focus())),this._register(Yo(this.attachmentsContainer,ne.CLICK,ae=>this.inputEditor.focus()));let E=new Set([ZQ.ID,qfe.ID]);this.inputActionsToolbar=this._register(this.instantiationService.createInstance(pr,this.options.renderInputToolbarBelowInput?this.attachmentsContainer:u,R.ChatInput,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1,hoverDelegate:S,responsiveBehavior:{enabled:!0,kind:"last",minItems:1,actionMinWidth:48,getActionMinWidth:ae=>E.has(ae.id)?22:void 0},actionViewItemProvider:(ae,ce)=>{if(this.chatPhoneInputPresenter.enabled.get()){if(ae.id===Soe.ID&&ae instanceof Do){this._currentLanguageModel.get()||this.setCurrentLanguageModelToDefault();let Se=this._createModelPickerDelegate(),Re=this._createModePickerDelegate();return this.instantiationService.createInstance(OFe,ae,Re,Se)}else if(ae.id===ZQ.ID&&ae instanceof Do)return new cve(ae)}if(ae.id===Soe.ID&&ae instanceof Do){this._currentLanguageModel.get()||this.setCurrentLanguageModelToDefault();let Se=this._createModelPickerDelegate();return this.modelWidget=this.instantiationService.createInstance(X0e,ae,Se,w)}else if(ae.id===ZQ.ID&&ae instanceof Do){let Se=this._createModePickerDelegate();return this.modeWidget=this.instantiationService.createInstance(J0e,ae,Se,w)}else if((ae.id===Ioe.ID||ae.id===pFe.ID)&&ae instanceof Do){let Se=()=>{let Ee=this._widget?.viewModel?.sessionResource;return Ee?Kg(Ee)??yn(Ee):void 0},Re=this.options.sessionTypePickerDelegate??{getActiveSessionProvider:()=>Se(),getPendingDelegationTarget:()=>this._pendingDelegationTarget,setPendingDelegationTarget:Ee=>{let Te=Se()===Ee;this._pendingDelegationTarget=Te?void 0:Ee,this.updateWidgetLockStateFromSessionType(Ee),this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers()},hasGitRepository:()=>this.hasWorkspaceScmRepository()},xe=!!this.options.sessionTypePickerDelegate?.setActiveSessionProvider,He=ae.id===Ioe.ID||xe?w6:ave;return this.sessionTargetWidget=this.instantiationService.createInstance(He,ae,y==="editor"?"editor":"sidebar",Re,w)}else if(ae.id===mFe.ID&&ae instanceof Do){let Se=this.createChatSessionPickerWidgets(ae,w);return Se.length===0?new cve(ae):this.instantiationService.createInstance(a$t,ae,Se)}}})),this.inputActionsToolbar.getElement().classList.add("chat-input-toolbar"),this.inputActionsToolbar.context={widget:o},this._register(this.inputActionsToolbar.onDidChangeMenuItems(()=>{let ce=this.inputActionsToolbar.getElement().querySelector(".chat-sessionPicker-container");ce&&(this.chatSessionPickerContainer=ce),this.cachedWidth&&typeof this.cachedInputToolbarWidth=="number"&&this.cachedInputToolbarWidth!==this.inputActionsToolbar.getItemsWidth()&&this._toolbarRelayoutScheduler.schedule()})),this._register(ve(ae=>{w.hideChevrons.read(ae),queueMicrotask(()=>this.inputActionsToolbar.relayout())}));let M=this.chatPhoneInputPresenter.enabled.get();if(this._register(ve(ae=>{let ce=this.chatPhoneInputPresenter.enabled.read(ae);ce!==M&&(M=ce,this.inputActionsToolbar.refresh())})),this.executeToolbar=this._register(this.instantiationService.createInstance(pr,u,this.options.menus.executeToolbar,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hoverDelegate:S,hiddenItemStrategy:-1})),this.executeToolbar.getElement().classList.add("chat-execute-toolbar"),this.executeToolbar.context={widget:o},this._register(this.executeToolbar.onDidChangeMenuItems(()=>{this.cachedWidth&&typeof this.cachedExecuteToolbarWidth=="number"&&this.cachedExecuteToolbarWidth!==this.executeToolbar.getItemsWidth()&&this._toolbarRelayoutScheduler.schedule()})),this.options.menus.inputSideToolbar){let ae=this._register(this.instantiationService.createInstance(pr,s,this.options.menus.inputSideToolbar,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hoverDelegate:S}));this.inputSideToolbarContainer=ae.getElement(),ae.getElement().classList.add("chat-side-toolbar"),ae.context={widget:o}}let N=new Set([AFe.ID,Bfe.ID,Hfe.ID,Ufe.ID,zfe.ID,"sessions.tunnelHost.toggleSharing"]),V=_(".chat-secondary-generic-chips");this._register(this.instantiationService.createInstance(NFe,o,x)).render(V),this.secondaryToolbar=this._register(this.instantiationService.createInstance(pr,this.secondaryToolbarContainer,R.ChatInputSecondary,{telemetrySource:this.options.menus.telemetrySource,menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1,hoverDelegate:S,responsiveBehavior:{enabled:!0,kind:"all",minItems:1,actionMinWidth:48,getActionMinWidth:ae=>N.has(ae.id)?22:void 0},actionViewItemProvider:(ae,ce)=>{if((ae.id===Ioe.ID||ae.id===pFe.ID)&&ae instanceof Do){let Se=()=>{let Ee=this._widget?.viewModel?.sessionResource;return Ee?Kg(Ee)??yn(Ee):void 0},Re=this.options.sessionTypePickerDelegate??{getActiveSessionProvider:()=>Se(),getPendingDelegationTarget:()=>this._pendingDelegationTarget,setPendingDelegationTarget:Ee=>{let Te=Se()===Ee;this._pendingDelegationTarget=Te?void 0:Ee,this.updateWidgetLockStateFromSessionType(Ee),this.updateAgentSessionTypeContextKey(),this.refreshChatSessionPickers()},hasGitRepository:()=>this.hasWorkspaceScmRepository()},xe=!!this.options.sessionTypePickerDelegate?.setActiveSessionProvider,He=ae.id===Ioe.ID||xe?w6:ave;return this.sessionTargetWidget=this.instantiationService.createInstance(He,ae,y==="editor"?"editor":"sidebar",Re,x)}else{if(ae.id===Krt.ID&&ae instanceof Do)return this.workspaceContextService.getWorkbenchState()===1&&this.options.workspacePickerDelegate?this.instantiationService.createInstance(eWe,ae,this.options.workspacePickerDelegate,x):new cve(ae);if(ae.id===zrt.ID&&ae instanceof Do){let Se={currentPermissionLevel:this._currentPermissionLevel,setPermissionLevel:xe=>{this.setPermissionLevel(xe)},getExtensionPermissions:()=>{let xe=this.getCurrentSessionResource(),He=this.getActiveExtensionPermissionGroup(xe);if(!He)return;let Ee=xe?this.chatSessionsService.getSessionOption(xe,He.id):void 0,Te=He.selected?.id??He.items.find(zt=>zt.default)?.id,It=Ee===void 0?Te:typeof Ee=="string"?Ee:Ee.id,tt=It!==void 0&&He.items.some(zt=>zt.id===It)?It:Te;return{sessionType:xe?yn(xe):this.options.sessionTypePickerDelegate?.getActiveSessionProvider?.()??"",groupId:He.id,items:He.items,selectedId:tt}},setExtensionPermission:(xe,He)=>{this.updateOptionContextKey(xe,He.id),this.getOrCreateOptionEmitter(xe).fire(He);let Ee=this.getCurrentSessionResource();Ee&&this.chatSessionsService.setSessionOption(Ee,xe,He),this.permissionWidget?.refresh()}},Re=this.instantiationService.createInstance(Z0e,ae,Se,x);return this.permissionWidget=Re,this.permissionWidgetDisposeListener.value=Re.onDidDispose(()=>{this.permissionWidget===Re&&(this.permissionWidget=void 0),this.permissionWidgetDisposeListener.clear()}),Re}else if((ae.id===AFe.ID||ae.id===Bfe.ID||ae.id===Hfe.ID||ae.id===Ufe.ID||ae.id===zfe.ID)&&ae instanceof Do){if(this.options.isSessionsWindow)return new cve(ae);let Se=ae.id===Ufe.ID?"branch":ae.id===zfe.ID?"isolation":ae.id===Bfe.ID?"autoApprove":ae.id===Hfe.ID?"permissionMode":"mode",Re=this.instantiationService.createInstance(Hoe,o,Se,x);return new YGt(ae,Re)}else if(ae.id===mFe.ID&&ae instanceof Do){let Se=this.createChatSessionPickerWidgets(ae,x);return Se.length===0?new cve(ae):this.instantiationService.createInstance(a$t,ae,Se)}}}})),this.secondaryToolbar.getElement().classList.add("chat-secondary-input-toolbar"),this.secondaryToolbar.context={widget:o},D(this.secondaryToolbarContainer,V),this._register(this.secondaryToolbar.onDidChangeMenuItems(()=>{let ce=this.secondaryToolbar.getElement().querySelector(".chat-sessionPicker-container");go(ce)&&(this.chatSessionPickerContainer=ce)}));let K=this.modelService.getModel(this.inputUri);if(K||(K=this._register(this.modelService.createModel("",null,this.inputUri,!0))),this.textModelResolverService.createModelReference(this.inputUri).then(ae=>{if(this._store.isDisposed){ae.dispose();return}this._register(ae)}),this.inputModel=K,this.inputModel.updateOptions({bracketColorizationOptions:{enabled:!1,independentColorPoolPerBracketType:!1}}),this._inputEditor.setModel(this.inputModel),t){this.inputModel.setValue(t);let ae=this.inputModel.getLineCount();this._inputEditor.setPosition({lineNumber:ae,column:this.inputModel.getLineMaxColumn(ae)})}let j=()=>{let ae=this._inputEditor.getModel();if(!ae)return;let ce=this._inputEditor.getPosition();if(!ce)return;let Se=ce.lineNumber===1&&ce.column===1;this.chatCursorAtTop.set(Se),this.historyNavigationBackwardsEnablement.set(Se),this.historyNavigationForewardsEnablement.set(ce.equals(tNi(ae))),this._syncInputStateToModel()};this._register(this._inputEditor.onDidChangeCursorPosition(ae=>j())),j(),this._register(this.themeService.onDidFileIconThemeChange(()=>{this.renderAttachedContext()})),this.renderAttachedContext();let J=this._register(new IY(this.container,()=>this.updateToolConfirmationCarouselMaxHeight())),se=this._register(new zu("ChatInputPart.containerHeight",()=>{J.schedule();let ae=this.container.offsetHeight;this.height.set(ae,void 0)}));if(this._register(se.observe(this.container)),this.options.renderStyle==="compact"){let ae=this._register(new zu("ChatInputPart.compactToolbars",()=>{this.cachedWidth&&this.layout(this.cachedWidth)}));this._register(ae.observe(u))}}toggleChatInputOverlay(e){this.chatInputOverlay.classList.toggle("disabled",e),e?this.overlayClickListener.value=Yo(this.chatInputOverlay,ne.CLICK,t=>{t.preventDefault(),t.stopPropagation(),this._onDidClickOverlay.fire()}):this.overlayClickListener.clear()}renderAttachedContext(){let e=this.attachedContextContainer,t=new O;this.attachedContextDisposables.value=t,St(e),t.add(Yo(this.attachmentsContainer,ne.KEY_DOWN,p=>{this.handleAttachmentNavigation(p)}));let o=[...this.attachmentModel.attachments.entries()],n=!!o.length,r=!1,l=this.configurationService.getValue("chat.implicitContext.suggestedContext")?this._implicitContext?.hasValue??!1:this._implicitContext?.values.some(p=>p.enabled||p.isSelection)??!1;if(this._implicitContext&&l){let p=(g,f,v)=>this._attachmentModel.attachments.some(b=>{let S=A.isUri(b.value)?b.value:Bp(b.value)?b.value.uri:void 0,y=Bp(b.value)?b.value.range:void 0;return v!==void 0&&N2(b)&&b.handle===v?!0:g&&S&&ze(g,S)?f&&y?G.equalsRange(f,y):!f&&!y:!1}),h=this.instantiationService.createInstance(RFe,()=>this._widget,p,this._implicitContext,this._contextResourceLabels,this._attachmentModel,e);t.add(h),r=h.hasRenderedContexts}Md(!!(this.options.renderInputToolbarBelowInput||n||r),this.attachmentsContainer),Md(n||r,this.attachedContextContainer),o.length||(this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._indexOfLastOpenedContext=-1);let c=Ape(this._currentLanguageModel.get()?.metadata),u=o.filter(([,p])=>SC(p));if(c!==void 0&&u.length>c){let p=u.length-c;for(let h=0;h<p;h++){let g=u[h][1];(g.omittedState===0||g.omittedState===3)&&(g.omittedState=3)}for(let h=p;h<u.length;h++)u[h][1].omittedState===3&&(u[h][1].omittedState=0)}else for(let[,p]of u)p.omittedState===3&&(p.omittedState=0);for(let[p,h]of o){let g=A.isUri(h.value)?h.value:Bp(h.value)?h.value.uri:void 0,f=Bp(h.value)?h.value.range:void 0,v=p===Math.min(this._indexOfLastAttachedContextDeletedWithKeyboard,this.attachmentModel.size-1)&&this._indexOfLastAttachedContextDeletedWithKeyboard>-1,b,S={shouldFocusClearButton:v,supportsDeletion:!0},y=this._currentLanguageModel.get();h.kind==="tool"||h.kind==="toolset"?b=this.instantiationService.createInstance(Aoe,h,y,S,e,this._contextResourceLabels):g&&wPt(h)?b=this.instantiationService.createInstance(Noe,g,h,y,S,e,this._contextResourceLabels):tR(h)?b=this.instantiationService.createInstance(Moe,h,y,S,e,this._contextResourceLabels):B0(h)?b=this.instantiationService.createInstance(Poe,h,void 0,S,e,this._contextResourceLabels):g&&(h.kind==="file"||h.kind==="directory")?b=this.instantiationService.createInstance(Toe,g,f,h,void 0,y,S,e,this._contextResourceLabels):h.kind==="terminalCommand"?b=this.instantiationService.createInstance(_oe,h,y,S,e,this._contextResourceLabels):SC(h)?b=this.instantiationService.createInstance(Doe,g,h,y,S,e,this._contextResourceLabels):CPt(h)?b=this.instantiationService.createInstance(Ooe,h,y,S,e,this._contextResourceLabels):yPt(h)?b=this.instantiationService.createInstance(Roe,h,y,S,e,this._contextResourceLabels):xPt(h)?b=this.instantiationService.createInstance(Foe,h,y,S,e,this._contextResourceLabels):kPt(h)?b=this.instantiationService.createInstance(Woe,h,y,S,e,this._contextResourceLabels):EPt(h)?b=this.instantiationService.createInstance(Voe,h,y,S,e,this._contextResourceLabels):SPt(h)?b=this.instantiationService.createInstance(Boe,h,y,S,e,this._contextResourceLabels):b=this._chatAttachmentWidgetRegistry.createWidget(h,S,e)??this.instantiationService.createInstance(Loe,g,f,h,void 0,y,S,e,this._contextResourceLabels),v&&b.element.focus(),p===Math.min(this._indexOfLastOpenedContext,this.attachmentModel.size-1)&&b.element.focus(),t.add(b),t.add(b.onDidDelete(w=>{this.handleAttachmentDeletion(w,p,h)})),t.add(b.onDidOpen(w=>{this.handleAttachmentOpen(p,h)}))}this._indexOfLastOpenedContext=-1}handleAttachmentDeletion(e,t,o){if(sf(e)&&(this._indexOfLastAttachedContextDeletedWithKeyboard=t),this._attachmentModel.delete(o.id),this.configurationService.getValue("chat.implicitContext.enableImplicitContext"))for(let n of this._implicitContext?.values||[]){let r=A.isUri(n?.value)&&A.isUri(o.value)&&ze(n.value,o.value);n?.isFile&&r&&(n.enabled=!1)}this._attachmentModel.size===0&&this.focus(),this._onDidChangeContext.fire({removed:[o]}),this.renderAttachedContext()}handleAttachmentOpen(e,t){this._indexOfLastOpenedContext=e,this._indexOfLastAttachedContextDeletedWithKeyboard=-1,this._attachmentModel.size===0&&this.focus()}handleAttachmentNavigation(e){if(!e.equals(15)&&!e.equals(17))return;let t=Array.from(this.attachedContextContainer.querySelectorAll(".chat-attached-context-attachment"));if(!t.length)return;let o=Me(this.attachmentsContainer).document.activeElement,n=t.findIndex(s=>s===o),r=n;e.equals(15)?r=n>0?n-1:t.length-1:e.equals(17)&&(r=n<t.length-1?n+1:0),r!==-1&&(t[r].focus(),e.preventDefault(),e.stopPropagation())}async renderChatTodoListWidget(e){if(this.configurationService.getValue("chat.tools.todos.showWidget")!==!1){if(!this._chatInputTodoListWidget.value){let o=this._chatEditingTodosDisposables.add(this.instantiationService.createInstance(z0e));this._chatInputTodoListWidget.value=o,St(this.chatInputTodoListWidgetContainer),D(this.chatInputTodoListWidgetContainer,o.domNode)}this._chatInputTodoListWidget.value.render(e)}}clearTodoListWidget(e,t){this._chatInputTodoListWidget.value?.clear(e,t)}renderArtifactsWidget(e){if(this.configurationService.getValue("chat.artifacts.enabled")){if(!this._chatArtifactsWidget.value){let t=this._register(this.instantiationService.createInstance(Qq));this._chatArtifactsWidget.value=t,St(this.chatArtifactsWidgetContainer),D(this.chatArtifactsWidgetContainer,t.domNode)}this._chatArtifactsWidget.value.setSessionResource(e)}}clearArtifactsWidget(){this._chatArtifactsWidget.value?.setSessionResource(void 0)}renderQuestionCarousel(e,t,o){let n=e.resolveId??`${Ni(t.element)?t.element.requestId:""}_${t.contentIndex}`,r=this._chatQuestionCarouselWidgets.get(n);if(r)return r;Ni(t.element)&&(this._questionCarouselResponseIds.set(n,t.element.requestId),this._questionCarouselSessionResources.set(n,t.element.sessionResource));let s=this.instantiationService.createInstance(v6,e,t,o);return this._chatQuestionCarouselWidgets.set(n,s),this._hasQuestionCarouselContextKey?.set(!0),D(this.chatQuestionCarouselContainer,s.domNode),s}clearQuestionCarousel(e,t){if(t!==void 0){let o=this._chatQuestionCarouselWidgets.get(t);o&&(o.domNode.remove(),this._chatQuestionCarouselWidgets.deleteAndDispose(t)),this._questionCarouselResponseIds.delete(t),this._questionCarouselSessionResources.delete(t)}else if(e!==void 0){for(let[o,n]of this._questionCarouselResponseIds)if(n===e){let r=this._chatQuestionCarouselWidgets.get(o);r&&(r.domNode.remove(),this._chatQuestionCarouselWidgets.deleteAndDispose(o)),this._questionCarouselResponseIds.delete(o),this._questionCarouselSessionResources.delete(o)}}else this._chatQuestionCarouselWidgets.clearAndDisposeAll(),this._questionCarouselResponseIds.clear(),this._questionCarouselSessionResources.clear(),St(this.chatQuestionCarouselContainer);this._hasQuestionCarouselContextKey?.set(this._chatQuestionCarouselWidgets.size>0)}get questionCarousel(){for(let e of this._chatQuestionCarouselWidgets.values())if(e.hasFocus())return e;return this._chatQuestionCarouselWidgets.size>0?this._chatQuestionCarouselWidgets.values().next().value:void 0}focusQuestionCarousel(){let e=this.questionCarousel;return e?(e.focus(),!0):!1}isQuestionCarouselFocused(){for(let e of this._chatQuestionCarouselWidgets.values())if(e.hasFocus())return!0;return!1}navigateToPreviousQuestion(){return this.questionCarousel?.navigateToPreviousQuestion()??!1}navigateToNextQuestion(){return this.questionCarousel?.navigateToNextQuestion()??!1}focusQuestionCarouselTerminal(){return this.questionCarousel?.focusTerminal()??!1}renderPlanReview(e,t,o){let n=e.resolveId??`${Ni(t.element)?t.element.requestId:""}_${t.contentIndex}`,r=this._chatPlanReviewWidgets.get(n);if(r)return r;Ni(t.element)&&(this._planReviewResponseIds.set(n,t.element.requestId),this._planReviewSessionResources.set(n,t.element.sessionResource));let s=this.instantiationService.createInstance(Uoe,e,t,o);return this._chatPlanReviewWidgets.set(n,s),D(this.chatPlanReviewContainer,s.domNode),s}clearPlanReview(e,t){if(t!==void 0){let o=this._chatPlanReviewWidgets.get(t);o&&(o.domNode.remove(),this._chatPlanReviewWidgets.deleteAndDispose(t)),this._planReviewResponseIds.delete(t),this._planReviewSessionResources.delete(t)}else if(e!==void 0){for(let[o,n]of this._planReviewResponseIds)if(n===e){let r=this._chatPlanReviewWidgets.get(o);r&&(r.domNode.remove(),this._chatPlanReviewWidgets.deleteAndDispose(o)),this._planReviewResponseIds.delete(o),this._planReviewSessionResources.delete(o)}}else this._chatPlanReviewWidgets.clearAndDisposeAll(),this._planReviewResponseIds.clear(),this._planReviewSessionResources.clear(),St(this.chatPlanReviewContainer)}get planReview(){return this._chatPlanReviewWidgets.size>0?this._chatPlanReviewWidgets.values().next().value:void 0}get _currentSessionKey(){return this._widget?.viewModel?.model.sessionResource.toString()}get _currentToolConfirmationCarousel(){let e=this._currentSessionKey;return e?this._chatToolConfirmationCarousels.get(e):void 0}renderToolConfirmationCarousel(e,t,o,n,r,s){let l=this._currentToolConfirmationCarousel;if(l)return l.addToolInvocation(e,o,n,r,s),this.updateToolConfirmationCarouselMaxHeight(),l;let c=this._currentSessionKey;if(!c)throw new Error("Cannot render tool confirmation carousel without an active session");let u=new Kqt(t,[],r,o,n);u.addToolInvocation(e,o,n,r,s),this._chatToolConfirmationCarousels.set(c,u),D(this.chatToolConfirmationCarouselContainer,u.domNode),Xo(this.chatToolConfirmationCarouselContainer),this.updateToolConfirmationCarouselMaxHeight();let p=c;return this._register(U.once(u.onDidEmpty)(()=>{this._chatToolConfirmationCarousels.deleteAndDispose(p),this._currentSessionKey===p&&(St(this.chatToolConfirmationCarouselContainer),Wi(this.chatToolConfirmationCarouselContainer))})),u}addToolToConfirmationCarousel(e,t,o,n,r,s){let l=this._currentToolConfirmationCarousel;l?(l.addToolInvocation(e,o,n,r,s),this.updateToolConfirmationCarouselMaxHeight()):this.renderToolConfirmationCarousel(e,t,o,n,r,s)}activateCarouselForSubagent(e){this._currentToolConfirmationCarousel?.activateFirstToolForSubagent(e)}hasToolInConfirmationCarousel(e){return this._currentToolConfirmationCarousel?.hasToolInvocation(e)??!1}get hasActiveToolConfirmationCarousel(){let e=this._currentToolConfirmationCarousel;return!!e&&e.pendingCount>0}clearToolConfirmationCarousel(){let e=this._currentSessionKey;e&&this._chatToolConfirmationCarousels.deleteAndDispose(e),St(this.chatToolConfirmationCarouselContainer),Wi(this.chatToolConfirmationCarouselContainer)}_syncToolConfirmationCarouselForSession(){St(this.chatToolConfirmationCarouselContainer);let e=this._currentToolConfirmationCarousel;e&&e.pendingCount>0?(D(this.chatToolConfirmationCarouselContainer,e.domNode),Xo(this.chatToolConfirmationCarouselContainer),this.updateToolConfirmationCarouselMaxHeight()):Wi(this.chatToolConfirmationCarouselContainer)}setWorkingSetCollapsed(e){this._workingSetCollapsed.set(e,void 0)}renderChatEditingSessionState(e){Md(!!e,this.chatEditingSessionWidgetContainer),e&&(ze(e.chatSessionResource,this._lastEditingSessionResource)||this._workingSetCollapsed.set(!0,void 0),this._lastEditingSessionResource=e.chatSessionResource);let t=Js({equalsFn:eo},l=>{let c=e?.chatSessionResource??this._widget?.viewModel?.model.sessionResource;return c&&yn(c)===zo.Background?[]:e?.entries.read(l).filter(u=>u.state.read(l)===0)||[]}),o=ke(l=>{let c=new xn,u=[];for(let p of t.read(l))if(p.state.read(l)===0&&!c.has(p.modifiedURI)){c.add(p.modifiedURI);let h=p.linesAdded?.read(l),g=p.linesRemoved?.read(l);u.push({reference:p.modifiedURI,state:0,kind:"reference",options:{status:void 0,diffMeta:{added:h??0,removed:g??0},isDeletion:!!p.isDeletion,originalUri:p.isDeletion?p.originalURI:void 0}})}return u.sort((p,h)=>p.kind==="reference"&&h.kind==="reference"?p.state===h.state||p.state===void 0||h.state===void 0?p.reference.toString().localeCompare(h.reference.toString()):p.state-h.state:0),u}),n=vi(this,this.agentSessionsService.model.onDidChangeSessions,()=>{let l=this._widget?.viewModel?.model?.sessionResource;if(!l)return yt.empty();let c=this.agentSessionsService.getSession(l);return c?.changes instanceof Array?c.changes:yt.empty()}),r=ke(l=>n.read(l).map(c=>({reference:oao(c)?c.modifiedUri??c.uri:c.modifiedUri,state:1,kind:"reference",options:{diffMeta:{added:c.insertions,removed:c.deletions},isDeletion:c.modifiedUri===void 0,originalUri:c.originalUri,status:void 0}}))),s=ke(l=>o.read(l).length>0||r.read(l).length>0);this._renderingChatEdits.value=ve(l=>{this.options.renderWorkingSet&&s.read(l)?this.renderChatEditingSessionWithEntries(l.store,e,o,r):(St(this.chatEditingSessionWidgetContainer),this._chatEditsDisposables.clear(),this._chatEditList=void 0)})}renderChatEditingSessionWithEntries(e,t,o,n){let r=this.chatEditingSessionWidgetContainer.querySelector(".chat-editing-session-container.show-file-icons")??D(this.chatEditingSessionWidgetContainer,iWe(".chat-editing-session-container.show-file-icons")),s=r.querySelector(".chat-editing-session-overview")??D(r,iWe(".chat-editing-session-overview")),l=s.querySelector(".working-set-title")??D(s,iWe(".working-set-title"));this._chatEditsActionsDisposables.clear();let c=s.querySelector(".chat-editing-session-actions")??D(s,iWe(".chat-editing-session-actions")),u=t?.chatSessionResource||this._widget?.viewModel?.model.sessionResource,p=this._chatEditsActionsDisposables.add(this.contextKeyService.createScoped(c));u&&p.createKey(Z.agentSessionType.key,yn(u)),this._chatEditsActionsDisposables.add(cu(Z.hasAgentSessionChanges,p,w=>!!n.read(w)?.length));let h=this._chatEditsActionsDisposables.add(this.instantiationService.createChild(new Po([X,p]))),g=r.querySelector(".chat-editing-session-list")??D(r,iWe(".chat-editing-session-list")),f=this._chatEditsActionsDisposables.add(new lM(l,{supportIcons:!0,secondary:!0,ariaLabel:d(9095,null)})),v=ke(w=>{let x=o.read(w),E=n.read(w),M=0,N=0;if(x.length>0)for(let j of x)j.kind==="reference"&&j.options?.diffMeta&&(M+=j.options.diffMeta.added,N+=j.options.diffMeta.removed);else for(let j of E)j.kind==="reference"&&j.options?.diffMeta&&(M+=j.options.diffMeta.added,N+=j.options.diffMeta.removed);let V=x.length>0?x.length:E.length,H=x.length===0&&E.length>0,K=x.length>0||E.length>0;return{files:V,added:M,removed:N,shouldShowEditingSession:K,topLevelIsSessionMenu:H}}),b=v.map(w=>w.topLevelIsSessionMenu);e.add(ve(w=>{let x=b.read(w);w.store.add(h.createInstance(Oq,c,x?R.ChatEditingSessionChangesToolbar:R.ChatEditingWidgetToolbar,{telemetrySource:this.options.menus.telemetrySource,small:!0,menuOptions:u?x?{args:[u,this.agentSessionsService.getSession(u)?.metadata]}:{arg:{$mid:19,sessionResource:u}}:void 0,disableWhileRunning:x,buttonConfigProvider:E=>{if(E.id===kfe.ID||E.id===Efe.Id)return{showIcon:!0,showLabel:!1,isSecondary:!0}}}))})),e.add(ve(w=>{let{files:x,added:E,removed:M,shouldShowEditingSession:N}=v.read(w),V=x===1?d(9094,null):d(9093,null,x);f.label=V,f.element.setAttribute("aria-label",d(9092,null,V,E,M)),this._workingSetLinesAddedSpan.value.textContent=`+${E}`,this._workingSetLinesRemovedSpan.value.textContent=`-${M}`,Md(N,this.chatEditingSessionWidgetContainer)}));let S=_(".working-set-line-counts");f.element.appendChild(S),S.appendChild(this._workingSetLinesAddedSpan.value),S.appendChild(this._workingSetLinesRemovedSpan.value);let y=()=>{this._workingSetCollapsed.set(!this._workingSetCollapsed.get(),void 0)};if(this._chatEditsActionsDisposables.add(f.onDidClick(y)),this._chatEditsActionsDisposables.add($(s,"click",w=>{w.defaultPrevented||w.target.closest(".monaco-button")||y()})),this._chatEditsActionsDisposables.add(ve(w=>{let x=this._workingSetCollapsed.read(w);f.icon=x?L.chevronRight:L.chevronDown,g.classList.toggle("collapsed",x)})),!this._chatEditList){this._chatEditList=this._chatEditsListPool.get();let w=this._chatEditList.object;this._chatEditsDisposables.add(this._chatEditList),this._chatEditsDisposables.add(w.onDidFocus(()=>{this._onDidFocus.fire()})),this._chatEditsDisposables.add(w.onDidOpen(async x=>{if(x.element?.kind==="reference"&&A.isUri(x.element.reference)){let E=x.element.reference,M=x.element.options?.originalUri;if(x.element.options?.isDeletion&&M){await this.editorService.openEditor({resource:M,options:x.editorOptions},x.sideBySide?En:tr);return}if(M){await this.editorService.openEditor({original:{resource:M},modified:{resource:E},options:x.editorOptions},x.sideBySide?En:tr);return}let N=t?.getEntry(E),V=await this.editorService.openEditor({resource:E,options:x.editorOptions},x.sideBySide?En:tr);V&&N?.getEditorIntegration(V).reveal(!0,x.editorOptions.preserveFocus)}})),this._chatEditsDisposables.add($(w.getHTMLElement(),"click",x=>{this.hasFocus()||this._onDidFocus.fire()},!0)),D(g,w.getHTMLElement()),D(r,g)}e.add(ve(w=>{let x=o.read(w),E=n.read(w),M=x.concat(E),H=Math.min(M.length,6)*22,K=this._chatEditList.object;K.layout(H),K.getHTMLElement().style.height=`${H}px`,K.splice(0,K.length,M)}))}async renderFollowups(e,t){this.options.renderFollowups&&(this.followupsDisposables.clear(),St(this.followupsContainer),e&&e.length>0&&this.followupsDisposables.add(this.instantiationService.createInstance(G0e,this.followupsContainer,e,this.location,void 0,o=>this._onDidAcceptFollowup.fire({followup:o,response:t}))))}setMaxHeight(e){this._maxHeight=e,this.updateToolConfirmationCarouselMaxHeight()}updateToolConfirmationCarouselMaxHeight(){let e=this._currentToolConfirmationCarousel;if(!e)return;if(this._maxHeight===void 0){e.setMaxHeight(void 0);return}let t=this.chatToolConfirmationCarouselContainer.offsetHeight,o=Math.max(0,this.container.offsetHeight-t);e.setMaxHeight(this._maxHeight-o)}layout(e){return this.cachedWidth=e,this._stableInputPartWidth.set(e,void 0),this._updateWorkingProgressAnimationDuration(e),this._layout(e)}_updateWorkingProgressAnimationDuration(e){if(!this.inputContainer)return;let t=1.4,o=2.5,n=Math.max(50,e),r=.55+.075*Math.sqrt(n),s=Math.min(o,Math.max(t,r));if(!(this._lastAnimDurationS!==void 0&&Math.abs(this._lastAnimDurationS-s)<.05)&&(this._lastAnimDurationS=s,this.inputContainer.style.setProperty("--chat-input-anim-duration",`${s.toFixed(2)}s`),this.inputContainer.classList.contains("working"))){let l=this.inputContainer;l.classList.add("chat-input-anim-restart"),kr(Me(l),()=>{l.classList.remove("chat-input-anim-restart")})}}get _effectiveInputEditorMaxHeight(){if(this._maxHeight===void 0)return this.inputEditorMaxHeight;let e=this.previousInputEditorDimension?.height??0,t=Math.max(0,this.height.get()-e),o=this._maxHeight-t;return Math.min(this.inputEditorMaxHeight,Math.max(0,o))}_layout(e,t=!0){let o=this.getLayoutData(),n=e-o.inputPartHorizontalPadding;this.followupsContainer.style.width=`${n}px`;let r=this._inputEditor.getScrollWidth(),s=e-o.inputPartHorizontalPadding-o.editorBorder-o.inputPartHorizontalPaddingInside-o.toolbarsWidth-o.sideToolbarWidth,l=this._effectiveInputEditorMaxHeight,c=Math.min(this._inputEditor.getContentHeight(),l),u=this.inputEditorMinHeight?Math.min(Math.max(this.inputEditorMinHeight,c),l):c,p={width:s,height:u};if((!this.previousInputEditorDimension||this.previousInputEditorDimension.width!==p.width||this.previousInputEditorDimension.height!==p.height)&&(this._inputEditor.layout(p),this.previousInputEditorDimension=p),t&&r<10)return this._layout(e,!1)}getLayoutData(){let e=this.inputSideToolbarContainer?Dc(this.inputSideToolbarContainer):0,t=()=>{let n=this.cachedExecuteToolbarWidth=this.executeToolbar.getItemsWidth(),r=this.cachedInputToolbarWidth=this.inputActionsToolbar.getItemsWidth(),s=(this.executeToolbar.getItemsLength()-1)*4,l=this.inputActionsToolbar.getItemsLength()?(this.inputActionsToolbar.getItemsLength()-1)*4:0,c=Dc(this.contextUsageWidgetContainer);return n+s+c+(this.options.renderInputToolbarBelowInput?0:r+l+12)};return{editorBorder:2,inputPartHorizontalPadding:this.options.renderStyle==="compact"?16:24,inputPartHorizontalPaddingInside:this.options.renderStyle==="compact"?12:10,toolbarsWidth:this.options.renderStyle==="compact"?t():0,sideToolbarWidth:e>0?e+4:0}}getWidgetLocationInfo(e){if(Ppe(e.viewContext))return{location:"editor",isMaximized:!1};if(tw(e.viewContext)){let t=this.viewDescriptorService.getViewLocationById(e.viewContext.viewId),o=this.layoutService.getSideBarPosition();switch(t){case 1:return{location:"panel",isMaximized:this.layoutService.isPanelMaximized()};case 2:return{location:o===0?"sidebarRight":"sidebarLeft",isMaximized:this.layoutService.isAuxiliaryBarMaximized()};case 0:default:return{location:o===0?"sidebarLeft":"sidebarRight",isMaximized:!1}}}return{location:"editor",isMaximized:!1}}getDefaultScrollbarOptions(){let e=this._inputEditor.getRawOptions().scrollbar??{};return this.options.renderStyle==="compact"?{...e,vertical:"hidden"}:{...e,vertical:"auto",verticalScrollbarSize:7}}getVisibleScrollbarOptions(){let e=this._inputEditor.getRawOptions().scrollbar??{};return this.options.renderStyle==="compact"?{...e,vertical:"hidden"}:{...e,vertical:"visible",verticalScrollbarSize:7}}updateInputEditorScrollbarOptions(){this._inputEditor.updateOptions({scrollbar:this._forceVisibleScrollbarUntilAccept?this.getVisibleScrollbarOptions():this.getDefaultScrollbarOptions()})}showScrollbarUntilAccept(){this._forceVisibleScrollbarUntilAccept=!0,this.updateInputEditorScrollbarOptions()}resetScrollbarVisibilityAfterAccept(){this._forceVisibleScrollbarUntilAccept&&(this._forceVisibleScrollbarUntilAccept=!1,this.updateInputEditorScrollbarOptions())}};C6=I([m(4,_t),m(5,F),m(6,X),m(7,B),m(8,Le),m(9,Ai),m(10,Gr),m(11,re),m(12,ge),m(13,ie),m(14,Pe),m(15,Bt),m(16,de),m(17,gr),m(18,foe),m(19,dr),m(20,kE),m(21,Wn),m(22,Ms),m(23,SR),m(24,Vc),m(25,Ae),m(26,lc),m(27,wi),m(28,ji),m(29,gFe),m(30,w8),m(31,JGt)],C6);function tNi(a){return{lineNumber:a.getLineCount(),column:a.getLineLength(a.getLineCount())+1}}var oEo=".interactive-input-editor";rNe(oEo);var a$t=class extends ts{constructor(e,t,o){super(null,e,o??{});this.widgets=t}render(e){e.classList.add("chat-sessionPicker-container");for(let t of this.widgets){let o=_(".action-item.chat-sessionPicker-item");t.render(o),e.appendChild(o)}}dispose(){for(let e of this.widgets)e.dispose();super.dispose()}},cve=class extends Ja{constructor(i){super(void 0,i)}render(i){super.render(i),i.style.display="none"}};var iNi=(a,i)=>{let e=a.get(Le),t=a.get(X),o=e.lookupKeybinding(n1,t)?.getAriaLabel(),n=e.lookupKeybinding(Grt,t)?.getAriaLabel(),r=i.map(l=>{let c=l.state.get();if(c.type===pi.StateKind.WaitingForPostApproval){let g=oR(c.resultDetails)?c.resultDetails.input:RH(c.resultDetails)?void 0:MPt(c.contentForModel);return{title:d(6291,null),detail:g}}if(!(c.type===pi.StateKind.WaitingForConfirmation&&c.confirmationMessages?.message))return;let u="";if(l.toolSpecificData)if(l.toolSpecificData.kind==="terminal"){let g=yR(l.toolSpecificData);u=g.commandLine.toolEdited??g.commandLine.original}else l.toolSpecificData.kind==="extensions"?u=JSON.stringify(l.toolSpecificData.extensions):l.toolSpecificData.kind==="input"?u=JSON.stringify(l.toolSpecificData.rawInput):l.toolSpecificData.kind==="modifiedFilesConfirmation"&&(u=d(6277,null,l.toolSpecificData.modifiedFiles.length));let p=c.confirmationMessages?.title;return{title:((typeof p=="string"?p:p?.value||"")+(u?": "+u:"")).trim(),detail:void 0}}).filter(so),s=o&&n?d(6290,null,r.map(l=>l.title).join(", "),o,n):d(6288,null,r.map(l=>l.title).join(", "));return r.some(l=>l.detail)&&(s+=" "+d(6289,null,r.map(l=>l.detail?l.detail:"").join(" "))),s},oWe=class{constructor(i,e){this._accessibleViewService=i;this._instantiationService=e}getWidgetRole(){return"list"}getRole(i){return"listitem"}getWidgetAriaLabel(){return d(6276,null)}getAriaLabel(i){return _r(i)?i.messageText:Ni(i)?this._getLabelWithInfo(i):""}_getLabelWithInfo(i){let e=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.panelChat"),t="",o=i.response.value.filter(g=>g.kind==="toolInvocation"),n="";o.length&&o.filter(f=>{let v=f.state.get().type;return v===pi.StateKind.WaitingForConfirmation||v===pi.StateKind.WaitingForPostApproval}).length&&(n=this._instantiationService.invokeFunction(iNi,o));let r=zl.lexer(i.response.toString()).filter(g=>g.type==="table")?.length??0,s="";switch(r){case 0:break;case 1:s=d(6287,null);break;default:s=d(6281,null,r);break}let l=i.response.value.filter(g=>g.kind==="treeData").length??0,c="";switch(l){case 0:break;case 1:c=d(6286,null);break;default:c=d(6280,null,l);break}let u=i.response.value.filter(g=>g.kind==="elicitation2"||g.kind==="elicitationSerialized"),p="";for(let g of u){let f=typeof g.title=="string"?g.title:g.title.value,v=typeof g.message=="string"?g.message:g.message.value;p+=f+" "+v}let h=zl.lexer(i.response.toString()).filter(g=>g.type==="code")?.length??0;switch(h){case 0:t=e?d(6283,null,n,c,p,s,i.response.toString(),e):d(6282,null,c,p,s,i.response.toString());break;case 1:t=e?d(6285,null,n,c,p,s,i.response.toString(),e):d(6284,null,c,p,s,i.response.toString());break;default:t=e?d(6279,null,n,c,p,s,h,i.response.toString(),e):d(6278,null,c,p,h,s,i.response.toString());break}return t}};oWe=I([m(0,Kd),m(1,F)],oWe);var nEo="workbench.action.chat.markHelpful",apn="workbench.action.chat.markUnhelpful",nWe="config.telemetry.feedback.enabled";function rEo(){W(class extends z{constructor(){super({id:"workbench.action.chat.markHelpful",title:P(6610,"Helpful"),f1:!1,category:fi,icon:L.thumbsup,toggled:Z.responseVote.isEqualTo("up"),menu:[{id:R.ChatMessageFooter,group:"navigation",order:2,when:C.and(Z.extensionParticipantRegistered,Z.isResponse,Z.responseHasError.negate(),C.has(nWe),Z.lockedToCodingAgent.negate())},{id:JU,group:"navigation",order:1,when:C.and(Z.extensionParticipantRegistered,Z.isResponse,Z.responseHasError.negate(),C.has(nWe),Z.lockedToCodingAgent.negate())}]})}run(i,...e){let t=e[0];if(!Ni(t))return;i.get(si).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"vote",direction:1}}),t.setVote(1)}}),W(class extends z{constructor(){super({id:apn,title:P(6613,"Unhelpful"),f1:!1,category:fi,icon:L.thumbsdown,toggled:Z.responseVote.isEqualTo("down"),menu:[{id:R.ChatMessageFooter,group:"navigation",order:3,when:C.and(Z.extensionParticipantRegistered,Z.isResponse,C.has(nWe),Z.lockedToCodingAgent.negate())},{id:JU,group:"navigation",order:2,when:C.and(Z.extensionParticipantRegistered,Z.isResponse,Z.responseHasError.negate(),C.has(nWe),Z.lockedToCodingAgent.negate())}]})}run(i,...e){let t=e[0];if(!Ni(t))return;t.setVote(0),i.get(si).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"vote",direction:0}})}}),W(class extends z{constructor(){super({id:"workbench.action.chat.reportIssueForBug",title:P(6612,"Report Issue"),f1:!1,category:fi,icon:L.report,menu:[{id:R.ChatMessageFooter,group:"navigation",order:4,when:C.and(Z.responseSupportsIssueReporting,Z.isResponse,C.has(nWe))},{id:JU,group:"navigation",order:3,when:C.and(Z.responseSupportsIssueReporting,Z.isResponse,C.has(nWe))}]})}run(i,...e){let t=e[0];if(!Ni(t))return;i.get(si).notifyUserAction({agentId:t.agent?.id,command:t.slashCommand?.name,sessionResource:t.session.sessionResource,requestId:t.requestId,result:t.result,action:{kind:"bug"}})}}),W(class extends z{constructor(){super({id:"workbench.action.chat.retry",title:P(6607,"Retry"),f1:!1,category:fi,icon:L.refresh,menu:[{id:R.ChatMessageFooter,group:"navigation",when:C.and(Z.isResponse,C.in(Z.itemId.key,Z.lastItemId.key),Z.lockedToCodingAgent.negate())},{id:R.ChatEditingWidgetToolbar,group:"navigation",when:C.and(W3,Z.lockedToCodingAgent.negate()),order:0}]})}async run(i,...e){let t=i.get(Lt),o=i.get(F0),n=i.get(si),r=i.get(B),s=i.get(ct),l=e[0];if(tco(l)&&(l=t.getWidgetBySessionResource(l.sessionResource)?.viewModel?.getItems().at(-1)),!Ni(l))return;let c=n.getSession(l.sessionResource),u=c?.getRequests();if(!u)return;let p=u?.findIndex(b=>b.id===l.requestId),h=t.getWidgetBySessionResource(l.sessionResource),g=h?.input.currentModeKind;if(c&&(g==="edit"||g==="agent")){let b=h?.viewModel?.model.editingSession;if(!b)return;let S=b.entries.get().filter(E=>E.lastModifyingRequestId===l.requestId),w=S.length>0&&r.getValue("chat.editing.confirmEditRequestRetry")===!0?await s.confirm({title:d(6609,null),message:S.length===1?d(6605,null,Be(S[0].modifiedURI)):d(6608,null,S.length),primaryButton:d(6606,null),checkbox:{label:d(6604,null),checked:!1},type:"info"}):{confirmed:!0};if(!w.confirmed)return;w.checkboxChecked&&await r.updateValue("chat.editing.confirmEditRequestRetry",!1);let x=u[p];x&&await b.restoreSnapshot(x.id,void 0)}let f=c?.getRequests().find(b=>b.id===l.requestId),v=h?.input.currentLanguageModel;o.acceptRequest(l.sessionResource),n.resendRequest(f,{userSelectedModelId:v,attempt:(f?.attempt??-1)+1,...h?.getModeRequestOptions()})}}),W(class extends z{constructor(){super({id:"workbench.action.chat.insertIntoNotebook",title:P(6611,"Insert into Notebook"),f1:!1,category:fi,icon:L.insert,menu:{id:R.ChatMessageFooter,group:"navigation",isHiddenByDefault:!0,when:C.and(nl,Z.isResponse,Z.responseIsFiltered.negate(),Z.lockedToCodingAgent.negate())}})}async run(i,...e){let t=e[0];if(!Ni(t))return;let o=i.get(ie);if(o.activeEditorPane?.getId()===_M){let n=o.activeEditorPane.getControl();if(!n.hasModel()||n.isReadOnly)return;let r=t.response.toString(),s=lpn(r),l=n.getFocus(),c=Math.max(l.end,0);await i.get(Ka).apply([new rb(n.textModel.uri,{editType:1,index:c,count:0,cells:s.map(p=>{let h=p.type==="markdown"?1:2,g=p.type==="markdown"?"markdown":p.language,f=p.type==="markdown"?"text/markdown":`text/x-${p.language}`;return{cellKind:h,language:g,mime:f,source:p.content,outputs:[],metadata:{}}})})],{quotableLabel:"Insert into Notebook"})}}})}function lpn(a){let e=new zl.Lexer().lex(a),t=[],o="";return e.forEach(n=>{n.type==="code"?(o.trim()&&(t.push({type:"markdown",content:o}),o=""),t.push({type:"code",language:n.lang||"",content:n.text})):o+=n.raw}),o.trim()&&t.push({type:"markdown",content:o}),t}var rWe=class extends k{constructor(e,t,o){super();this._hoverService=o;this.domNode=document.createElement("span");this.domNode.classList.add("chat-agent-command"),this.domNode.setAttribute("aria-label",e.name),this.domNode.setAttribute("role","button");let n=ht(),r=document.createElement("span");this.domNode.appendChild(r),r.innerText=cp+e.name,this._store.add(this._hoverService.setupDelayedHover(r,{content:e.description,style:1},{groupId:n}));let s=d(8688,null,cp,e.name),l=new Pi(this.domNode,{ariaLabel:s});l.icon=L.close,this._store.add(l.onDidClick(()=>t())),this._store.add(l),this._store.add(this._hoverService.setupDelayedHover(l.element,{content:s,style:1},{groupId:n}))}hasSameContent(e,t,o){return!1}};rWe=I([m(2,ot)],rWe);var sWe=class extends k{constructor(e,t,o,n){super();this.content=e;this.domNode=_(".chat-rate-limited-widget"),D(this.domNode,_("span")).classList.add(...q.asClassNameArray(L.info));let s=D(this.domNode,_(".chat-rate-limited-message")),l=D(s,_("div"));l.textContent=d(8689,null);let c=this._register(new Pi(s,{...Ro,supportIcons:!0}));c.label=d(8690,null),c.element.classList.add("chat-rate-limited-button"),this._register(c.onDidClick(async()=>{let u="workbench.action.chat.triggerSetup";o.publicLog2("workbenchActionExecuted",{id:u,from:"chat-response"}),await t.executeCommand(u)}))}hasSameContent(e){return e.kind===this.content.kind&&!!e.errorDetails.isRateLimited}addDisposable(e){this._register(e)}};sWe=I([m(1,fe),m(2,_e),m(3,dr)],sWe);var aWe=class extends k{constructor(e,t,o,n,r,s){super();this.content=e;this.hoverService=o;this.chatService=n;this.editorService=r;this.instantiationService=s;this.ELEMENT_HEIGHT=22;this.MAX_ITEMS_SHOWN=6;this.diffsBetweenRequests=new Map;this.isCollapsed=!0;this.fileChangesDiffsObservable=this.computeFileChangesDiffs(e);let l=_(".checkpoint-file-changes-summary-header");this.domNode=_(".checkpoint-file-changes-summary",void 0,l),this.domNode.tabIndex=0,this._register(this.renderHeader(l)),this._register(this.renderFilesList(this.domNode))}computeFileChangesDiffs({requestId:e,sessionResource:t}){return this.chatService.chatModels.map(o=>yt.find(o,n=>ze(n.sessionResource,t))).map(o=>o?.editingSession?.getDiffsForFilesInRequest(e)).map((o,n)=>o?.read(n)||yt.empty())}getCachedEntryDiffBetweenRequests(e,t,o,n){let r=`${t}\0${o}\0${n}`,s=this.diffsBetweenRequests.get(r);return s||(s=e.getEntryDiffBetweenRequests(t,o,n),this.diffsBetweenRequests.set(r,s)),s}renderHeader(e){let t=e.appendChild(_(".chat-file-changes-label")),o=new lM(t,{});this._register(ve(s=>{let l=this.fileChangesDiffsObservable.read(s);o.label=l.length===1?"Changed 1 file":`Changed ${l.length} files`}));let n=()=>{o.icon=this.isCollapsed?L.chevronRight:L.chevronDown,this.domNode.classList.toggle("chat-file-changes-collapsed",this.isCollapsed)};n();let r=new O;return r.add(o),r.add(o.onDidClick(()=>{this.isCollapsed=!this.isCollapsed,n()})),r.add(this.renderViewAllFileChangesButton(o.element)),ee(()=>r.dispose())}renderViewAllFileChangesButton(e){let t=e.appendChild(_(".chat-view-changes-icon")),o=this.hoverService.setupDelayedHover(t,()=>({content:P(8691,"View All File Changes")}));return t.classList.add(...q.asClassNameArray(L.diffMultiple)),t.setAttribute("role","button"),t.tabIndex=0,Fn(o,$(t,"click",n=>{let r=this.fileChangesDiffsObservable.get().map(c=>({originalUri:c.originalURI,modifiedUri:c.modifiedURI})),s=A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`),l=this.instantiationService.createInstance(Ou,s,"Checkpoint File Changes",r.map(c=>new wE(c.originalUri,c.modifiedUri,void 0)),!1);this.editorService.openEditor(l),Kt.stop(n,!0)}))}renderFilesList(e){let t=new O;this.list=t.add(this.instantiationService.createInstance(Nst)).get();let o=this.list.getHTMLElement();return e.appendChild(o.parentElement),t.add(this.list.onDidOpen(n=>{let r=n.element;if(!r)return;let s={original:{resource:r.originalURI},modified:{resource:r.modifiedURI},options:{preserveFocus:!0}};this.editorService.openEditor(s)})),t.add(this.list.onContextMenu(n=>{Kt.stop(n.browserEvent,!0)})),t.add(ve(n=>{let r=this.fileChangesDiffsObservable.read(n),l=Math.min(r.length,this.MAX_ITEMS_SHOWN)*this.ELEMENT_HEIGHT;this.list.layout(l),o.style.height=l+"px",this.list.splice(0,this.list.length,r)})),t}hasSameContent(e,t,o){return e.kind==="changesSummary"&&e.requestId===this.content.requestId}addDisposable(e){this._register(e)}};aWe=I([m(2,ot),m(3,si),m(4,ie),m(5,F)],aWe);var Nst=class extends k{constructor(e,t){super();this.instantiationService=e;this.themeService=t;this._resourcePool=this._register(new jq(()=>this.listFactory()))}listFactory(){let e=_(".chat-summary-list"),t=new O;t.add(S6(e,this.themeService));let o=t.add(this.instantiationService.createInstance(jl,{onDidChangeVisibility:()=>k.None}));return{list:t.add(this.instantiationService.createInstance(bc,"ChatListRenderer",e,new nNi,[this.instantiationService.createInstance(l$t,o)],{alwaysConsumeMouseWheel:!1})),dispose:()=>{t.dispose()}}}get(){return this._resourcePool.get().list}};Nst=I([m(0,F),m(1,Pe)],Nst);var nNi=class{getHeight(i){return 22}getTemplateId(i){return l$t.TEMPLATE_ID}},l$t=class a{constructor(i){this.labels=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="collapsibleChangesSummaryListRenderer"}static{this.CHANGES_SUMMARY_CLASS_NAME="insertions-and-deletions"}renderTemplate(i){let e=this.labels.create(i,{supportHighlights:!0,supportIcons:!0});return{label:e,dispose:()=>e.dispose()}}renderElement(i,e,t){let o=t.label;o.setFile(i.modifiedURI,{fileKind:0,title:i.modifiedURI.path});let n=o.element;if(t.changesElement?.remove(),!i.identical&&!i.isBusy){let r=n.appendChild(_(`.${a.CHANGES_SUMMARY_CLASS_NAME}`)),s=r.appendChild(_(".insertions"));s.textContent=`+${i.added}`;let l=r.appendChild(_(".deletions"));l.textContent=`-${i.removed}`,t.changesElement=r}}disposeTemplate(i){i.dispose()}};var lWe=class extends k{constructor(e,t,o,n){super();this.editorService=o;this.telemetryService=n;let r=Yxi(e.citations),s=st(".chat-code-citation-message@root",[st("span.chat-code-citation-label@label"),st(".chat-code-citation-button-container@button")]);s.label.textContent=r+" - ";let l=this._register(new Pi(s.button,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0}));l.label=d(8692,null),this._register(l.onDidClick(()=>{let c=`# Code Citations

`+e.citations.map(u=>`## License: ${u.license}
${u.value.toString()}

\`\`\`
${u.snippet}
\`\`\`

`).join(`
`);this.editorService.openEditor({resource:void 0,contents:c,languageId:"markdown"}),this.telemetryService.publicLog2("openedChatCodeCitations")})),this.domNode=s.root}hasSameContent(e,t,o){return e.kind==="codeCitations"}};lWe=I([m(2,ie),m(3,_e)],lWe);var cpn=_,cWe=class extends k{constructor(e,t,o){super();this.commandService=o;this.domNode=cpn(".chat-command-button");let n=!Ni(t.element)||!t.element.isStale;if(this.renderButton(this.domNode,e.command,n),e.additionalCommands)for(let r of e.additionalCommands)this.renderButton(this.domNode,r,n,!0)}renderButton(e,t,o,n){let r=o?t.tooltip:d(8693,null),s=this._register(new Pi(e,{...Ro,supportIcons:!0,title:r,secondary:n}));s.label=t.title,s.enabled=o,this._register(s.onDidClick(()=>this.commandService.executeCommand(t.id,...t.arguments??[])))}hasSameContent(e){return e.kind==="command"}};cWe=I([m(2,fe)],cWe);var dWe=class extends k{constructor(e,t,o,n,r){super();this.instantiationService=o;this.chatService=n;let s=t.element,l=e.buttons?e.buttons.map(u=>({label:u,data:e.data,isSecondary:u!==e.buttons?.[0]})):[{label:d(8694,null),data:e.data},{label:d(8695,null),data:e.data,isSecondary:!0}],c=this._register(this.instantiationService.createInstance(c0e,t,{title:e.title,buttons:l,message:e.message}));c.setShowButtons(!e.isUsed),this._register(c.onDidClick(async({button:u})=>{if(Ni(s)){let p=`${u.label}: "${e.title}"`,h=u.isSecondary?{rejectedConfirmationData:[u.data]}:{acceptedConfirmationData:[u.data]};h.agentId=s.agent?.id,h.slashCommand=s.slashCommand?.name,h.confirmation=u.label;let g=r.getWidgetBySessionResource(s.sessionResource);h.userSelectedModelId=g?.input.currentLanguageModel,h.modeInfo=g?.input.currentModeInfo,h.location=g?.location,Object.assign(h,g?.getModeRequestOptions());let f=await this.chatService.sendRequest(s.sessionResource,p,h);R3.isSent(f)&&(e.isUsed=!0,c.setShowButtons(!1))}})),this.domNode=c.domNode}hasSameContent(e){return e.kind==="confirmation"}addDisposable(e){this._register(e)}};dWe=I([m(2,F),m(3,si),m(4,Lt)],dWe);var dve=class extends k{constructor(e,t,o,n=!1,r){super();this.isSimpleWidget=n;this._pool=this._register(new Jqt(()=>r.createInstance(gk,e,R.ChatCodeBlock,t,o,this.isSimpleWidget),{maxIdleSize:2}))}inUse(){return this._pool.inUse}get(e){let t=this._pool.get(e),o=!1;return{object:t,isStale:()=>o,dispose:bd(()=>{t.reset(),o=!0,this._pool.release(t,e)})}}clear(){this._pool.clear()}};dve=I([m(4,F)],dve);var uWe=class extends k{constructor(e,t,o,n=!1,r){super();this.isSimpleWidget=n;this._pool=this._register(new jq(()=>r.createInstance(qFe,e,R.ChatCompareBlock,t,o,this.isSimpleWidget)))}inUse(){return this._pool.inUse}get(){let e=this._pool.get(),t=!1;return{object:e,isStale:()=>t,dispose:bd(()=>{e.reset(),t=!0,this._pool.release(e)})}}clear(){this._pool.clear()}};uWe=I([m(4,F)],uWe);var pWe=class extends k{constructor(i){super(),this._collection=new rNi(i)}acquire(i,e,t,o){return this._collection.acquire(i.toString(),i,e,t,o)}};pWe=I([m(0,_t)],pWe);var rNi=class extends ix{constructor(e){super();this.modelService=e}createReferencedObject(e,t,o,n,r){return this.modelService.createModel(o,n,t,r)}destroyReferencedObject(e,t){t.dispose()}};var aNi="workbench.action.chat.acceptElicitation",sNi=class extends z{constructor(){super({id:aNi,title:P(6491,"Accept Request"),f1:!1,category:fi,keybinding:{when:C.and(Z.inChatSession,Z.Editing.hasElicitationRequest),primary:2051,weight:201}})}async run(i){let t=i.get(Lt).lastFocusedWidget;if(!t)return;let o=t.viewModel?.getItems();if(o?.length)for(let n=o.length-1;n>=0;n--){let r=o[n];if(Ni(r)){for(let s of r.response.value)if(s.kind==="elicitation2"&&s.state.get()==="pending"){await s.accept(!0),t.focusInput();return}}}}};function sEo(){W(sNi)}var mWe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.elicitation=e;this.instantiationService=o;this.chatAccessibilityService=n;this.contextKeyService=r;this.keybindingService=s;this.languageModelToolsService=l;this.riskAssessmentService=c;let u=[];if(e.kind==="elicitation2"){let g=this.keybindingService.appendKeybinding(e.acceptButtonLabel,aNi);u.push({label:e.acceptButtonLabel,tooltip:g,data:!0,moreActions:e.moreActions?.map(v=>({label:v.label,data:v,run:v.run}))}),e.rejectButtonLabel&&e.reject&&u.push({label:e.rejectButtonLabel,data:!1,isSecondary:!0}),this._register(ve(v=>{e.isHidden?.read(v)&&this.domNode.remove()}));let f=Z.Editing.hasElicitationRequest.bindTo(this.contextKeyService);this._register(ve(v=>{f.set(e.state.read(v)==="pending")})),this._register(ee(()=>f.reset())),this.chatAccessibilityService.acceptElicitation(e)}let p=this._register(this.instantiationService.createInstance(nne,t,{title:e.title,subtitle:e.subtitle,buttons:u,message:this.getMessageToRender(e),footerBanner:this._createRiskBadge(e),toolbarData:{partType:"elicitation",partSource:e.source?.type,arg:e}}));this._confirmWidget=p,p.setShowButtons(e.kind==="elicitation2"&&e.state.get()==="pending"),this._register(p.onDidClick(async({button:g})=>{if(e.kind!=="elicitation2")return;let f;typeof g.data=="boolean"&&g.data===!0||g.data&&typeof g.data=="object"&&"run"in g.data&&"label"in g.data?f=g.data:f=void 0,f!==void 0?await e.accept(f):e.reject&&await e.reject(),p.setShowButtons(!1),p.updateMessage(this.getMessageToRender(e))})),this.domNode=p.domNode,this.domNode.tabIndex=0;let h=this.getMessageToRender(e);this.domNode.ariaLabel=e.title+" "+(typeof h=="string"?h:h.value||"")}get codeblocks(){return this._confirmWidget.codeblocks}get codeblocksPartId(){return this._confirmWidget.codeblocksPartId}getMessageToRender(e){if(!e.acceptedResult)return e.message;let t=yr(e.message)?he.lift(e.message):new he(e.message);return t.appendCodeblock("json",JSON.stringify(e.acceptedResult,null,2)),t}_createRiskBadge(e){if(e.kind!=="elicitation2"||!e.riskAssessment||!this.riskAssessmentService.isEnabled())return;let{toolId:t,parameters:o}=e.riskAssessment,n=this.languageModelToolsService.getTool(t);if(!n)return;let r=this._register(this.instantiationService.createInstance(rne)),s=this.riskAssessmentService.getCached(n,o);if(s)r.setAssessment(s);else{r.setLoading();let l=this._register(new qe);(async()=>{try{let c=await this.riskAssessmentService.assess(n,o,l.token);if(l.token.isCancellationRequested)return;if(!c){r.setHidden();return}r.setAssessment(c)}catch{r.setHidden()}})()}return r.domNode}hasSameContent(e){return e===this.elicitation}addDisposable(e){this._register(e)}};mWe=I([m(2,F),m(3,F0),m(4,X),m(5,Le),m(6,Wn),m(7,UFe)],mWe);var aEo=_,uve=class extends k{constructor(e,t,o,n){super();this.errorDetails=o;this.domNode=this._register(new pve(e,t,n)).domNode}hasSameContent(e){return e.kind===this.errorDetails.kind}},pve=class extends k{constructor(i,e,t){super(),this.domNode=aEo(".chat-notification-widget"),this.domNode.tabIndex=0;let o,n;switch(i){case 1:o=L.warning,n=".chat-warning-codicon";break;case 2:o=L.error,n=".chat-error-codicon";break;case 0:o=L.info,n=".chat-info-codicon";break}this.domNode.appendChild(aEo(n,void 0,un(o)));let r=this._register(t.render(e));this.domNode.appendChild(r.element)}};var cEo=_,hWe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.errorDetails=o;this.chatAccessibilityService=p;let h=s.element;Omo(h),this.domNode=cEo(".chat-error-confirmation"),this.domNode.append(this._register(new pve(e,t,r)).domNode);let g={...Ro},f=D(this.domNode,cEo(".chat-buttons-container"));n.forEach(v=>{let b=this._register(new Pi(f,g));b.label=v.label,this._register(b.onDidClick(async()=>{let S=v.label,y=v.isSecondary?{rejectedConfirmationData:[v.data]}:{acceptedConfirmationData:[v.data]};y.agentId=h.agent?.id,y.slashCommand=h.slashCommand?.name,y.confirmation=v.label;let w=c.getWidgetBySessionResource(h.sessionResource);y.userSelectedModelId=w?.input.currentLanguageModel,Object.assign(y,w?.getModeRequestOptions()),this.chatAccessibilityService.acceptRequest(h.sessionResource),await u.sendRequest(h.sessionResource,S,y)}))})}hasSameContent(e){return e.kind===this.errorDetails.kind&&e.isLast===this.errorDetails.isLast}addDisposable(e){this._register(e)}};hWe=I([m(6,F),m(7,Lt),m(8,si),m(9,F0)],hWe);var gWe=class extends k{constructor(e,t,o,n,r,s){super();this.data=e;this.context=t;this.mcpService=o;this.instantiationService=n;this._openerService=r;this._markdownRendererService=s;this.interactionMd=this._register(new ue);this.showSpecificServersScheduler=this._register(new Dt(()=>this.updateDetailedProgress(this.data.state.get()),2500));this.previousParts=new uo(()=>Ni(this.context.element)?this.context.element.session.getItems().filter((e,t)=>Ni(e)&&t<this.context.elementIndex).flatMap(e=>e.response.value.filter(t=>t.kind==="mcpServersStarting")).map(e=>e.state?.get()):[]);this.domNode=_(".chat-mcp-servers-interaction"),e.state&&this._register(ve(l=>{let c=e.state.read(l);this.updateForState(c)}))}updateForState(e){e.working?this.workingProgressPart?this.workingProgressPart&&this.updateDetailedProgress(e):this.showSpecificServersScheduler.isScheduled()||this.showSpecificServersScheduler.schedule():(this.workingProgressPart?.domNode.remove(),this.workingProgressPart=void 0,this.showSpecificServersScheduler.cancel());let t=e.serversRequiringInteraction.filter(o=>!(this.data.didStartServerIds?.includes(o.id)||this.previousParts.value.some(n=>n?.serversRequiringInteraction.some(r=>o.id===r.id))));t.length>0?this.interactionMd.value?this.updateInteractionRequired(this.interactionMd.value.element,t):this.renderInteractionRequired(t):t.length===0&&this.interactionContainer&&(this.interactionContainer.remove(),this.interactionContainer=void 0)}createServerCommandLinks(e){return e.map(t=>Xw({text:"`"+Ru(t.label)+"`",id:"workbench.mcp.serverOptions",arguments:[t.id],tooltip:d(8731,null,t.label)},!1)).join(", ")}updateDetailedProgress(e){let t=Xw({text:d(8732,null),id:"workbench.mcp.skipAutostart",tooltip:d(8733,null)}),o;if(e.starting.length===0)o=new he(void 0,{isTrusted:!0}).appendText(d(8738,null)+" ").appendMarkdown(t);else{let n=this.createServerCommandLinks(e.starting);o=new he(void 0,{isTrusted:!0}).appendMarkdown(d(8737,null,n)+" ").appendMarkdown(t)}this.workingProgressPart?this.workingProgressPart.updateMessage(o):(this.workingProgressPart=this._register(this.instantiationService.createInstance(KR,{kind:"progressMessage",content:o},this._markdownRendererService,this.context,!0,!0,void 0,void 0,!1)),this.domNode.appendChild(this.workingProgressPart.domNode))}renderInteractionRequired(e){this.interactionContainer=_(".chat-mcp-servers-interaction-hint");let t=_(".chat-mcp-servers-message"),o=_(".chat-mcp-servers-icon");o.classList.add(...q.asClassNameArray(L.mcp));let{messageMd:n}=this.createInteractionMessage(e);t.appendChild(o),t.appendChild(n.element),this.interactionContainer.appendChild(t),this.domNode.prepend(this.interactionContainer)}updateInteractionRequired(e,t){let{messageMd:o}=this.createInteractionMessage(t);e.replaceWith(o.element)}createInteractionMessage(e){let t=e.length,o=this.createServerCommandLinks(e),n=t===1?d(8735,null,o,"#start"):d(8734,null,o,"#start"),r=new he(n,{isTrusted:!0}),s=this.interactionMd.value=this._markdownRendererService.render(r,{actionHandler:c=>c.startsWith("command:")?WT(this._openerService,c,!0):(this._start(l),Promise.resolve(!0))}),l=[...s.element.querySelectorAll("a")].find(c=>!c.getAttribute("data-href")?.startsWith("command:"));return l?(l.setAttribute("role","button"),l.href="",{messageMd:s,startLink:l}):{messageMd:s,startLink:void 0}}async _start(e){e.style.pointerEvents="none",e.style.opacity="0.7";try{if(!this.data.state)return;let o=this.data.state.get().serversRequiringInteraction;for(let n=0;n<o.length;n++){let r=o[n];e.textContent=d(8736,null,r.label);let s=this.mcpService.servers.get().find(l=>l.definition.id===r.id);s&&(await cV(s,{promptType:"all-untrusted"}),this.data.didStartServerIds??=[],this.data.didStartServerIds.push(r.id))}this.interactionContainer&&(this.interactionContainer.remove(),this.interactionContainer=void 0)}catch{e.style.pointerEvents="",e.style.opacity="",e.textContent="Start now?"}}hasSameContent(e){return e.kind==="mcpServersStarting"}addDisposable(e){this._register(e)}};gWe=I([m(2,Vs),m(3,F),m(4,Je),m(5,_n)],gWe);var fWe=class extends k{constructor(e,t,o){super();this._openerService=t;this._markdownRendererService=o;this.domNode=_(".chat-disabled-claude-hooks");let n=_(".chat-disabled-claude-hooks-message"),r=_(".chat-disabled-claude-hooks-icon");r.classList.add(...q.asClassNameArray(L.info));let s=Xw({text:d(8698,null),id:"workbench.action.openSettings",arguments:[El.USE_CLAUDE_HOOKS],tooltip:d(8699,null)}),l=d(8700,null,s),c=new he(l,{isTrusted:!0}),u=this._register(this._markdownRendererService.render(c,{actionHandler:p=>WT(this._openerService,p,!0)}));n.appendChild(r),n.appendChild(u.element),this.domNode.appendChild(n)}hasSameContent(e){return e.kind==="disabledClaudeHooks"}addDisposable(e){this._register(e)}};fWe=I([m(1,Je),m(2,_n)],fWe);var x6=_,dpn=22,upn=6,vWe=class extends k{constructor(e,t,o,n,r,s){super();this.content=e;this._element=t;this.instantiationService=o;this.editorService=n;this.themeService=r;this.contextKeyService=s;this.isCollapsed=!1;this.readOnly=e.readOnly??!1,this.diffData=lF(this.content.multiDiffData)?this.content.multiDiffData.map(c=>c):Fo(this.content.multiDiffData);let l=x6(".checkpoint-file-changes-summary-header");this.domNode=x6(".checkpoint-file-changes-summary",void 0,l),this.domNode.tabIndex=0,this.isCollapsed=e?.collapsed??!1,this._register(this.renderHeader(l)),this._register(this.renderFilesList(this.domNode))}renderHeader(e){let t=e.appendChild(x6(".chat-file-changes-label")),o=new lM(t,{});this._register(ve(s=>{let l=this.diffData.read(s).resources.length;o.label=l===1?d(8741,null):d(8740,null,l)}));let n=()=>{o.icon=this.isCollapsed?L.chevronRight:L.chevronDown,this.domNode.classList.toggle("chat-file-changes-collapsed",this.isCollapsed)};n();let r=new O;return r.add(o),r.add(o.onDidClick(()=>{this.isCollapsed=!this.isCollapsed,n()})),this.readOnly||r.add(this.renderViewAllFileChangesButton(o.element)),r.add(this.renderContributedButtons(o.element)),ee(()=>r.dispose())}renderViewAllFileChangesButton(e){let t=e.appendChild(x6(".chat-view-changes-icon"));return t.classList.add(...q.asClassNameArray(L.diffMultiple)),t.title=d(8742,null),$(t,"click",o=>{let n=A.parse(`multi-diff-editor:${new Date().getMilliseconds().toString()+Math.random().toString()}`),{title:r,resources:s}=this.diffData.get(),l=this.instantiationService.createInstance(Ou,n,r||"Multi-Diff",s.map(u=>new wE(u.originalUri,u.modifiedUri,u.goToFileUri)),!1),c=o.altKey;this.editorService.openEditor(l,c?En:tr),Kt.stop(o,!0)})}renderContributedButtons(e){let t=e.appendChild(x6(".chat-multidiff-contributed-buttons")),o=new O,n=yn(this._element.sessionResource),r=this.contextKeyService.createOverlay([[Z.agentSessionType.key,n]]),s=o.add(this.instantiationService.createChild(new Po([X,r]))),l={...this._element.sessionResource,$mid:1};return o.add(s.createInstance(pr,t,R.ChatMultiDiffContext,{menuOptions:{arg:l,shouldForwardArgs:!0},toolbarOptions:{primaryGroup:()=>!0}})),o}renderFilesList(e){let t=new O,o=e.appendChild(x6(".chat-summary-list"));t.add(S6(o,this.themeService));let n=t.add(this.instantiationService.createInstance(jl,{onDidChangeVisibility:U.None}));return this.list=t.add(this.instantiationService.createInstance(bc,"ChatMultiDiffList",o,new lNi,[this.instantiationService.createInstance(cNi,n)],{identityProvider:{getId:r=>r.uri.toString()},setRowLineHeight:!0,horizontalScrolling:!1,supportDynamicHeights:!1,mouseSupport:!this.readOnly,alwaysConsumeMouseWheel:!1,accessibilityProvider:{getAriaLabel:r=>r.uri.path,getWidgetAriaLabel:()=>d(8743,null)}})),this._register(ve(r=>{let{resources:s}=this.diffData.read(r),l=[];for(let u of s){let p=u.modifiedUri||u.originalUri||u.goToFileUri;if(!p)continue;let h={uri:p};u.originalUri&&u.modifiedUri&&(h.diff={originalURI:u.originalUri,modifiedURI:u.modifiedUri,isFinal:!0,quitEarly:!1,identical:!1,added:u.added||0,removed:u.removed||0,isBusy:!1}),l.push(h)}this.list.splice(0,this.list.length,l);let c=Math.min(l.length,upn)*dpn;this.list.layout(c),o.style.height=`${c}px`})),this.readOnly||t.add(this.list.onDidOpen(r=>{r.element&&(r.element.diff?this.editorService.openEditor({original:{resource:r.element.diff.originalURI},modified:{resource:r.element.diff.modifiedURI},options:{preserveFocus:!0}}):this.editorService.openEditor({resource:r.element.uri,options:{preserveFocus:!0}}))})),t}hasSameContent(e){return e.kind==="multiDiffData"&&this.diffData.get().resources.length===(lF(e.multiDiffData)?e.multiDiffData.get().resources.length:e.multiDiffData.resources.length)}addDisposable(e){this._register(e)}};vWe=I([m(2,F),m(3,ie),m(4,Pe),m(5,X)],vWe);var lNi=class{getHeight(){return 22}getTemplateId(){return"chatMultiDiffItem"}},cNi=class a{constructor(i){this.labels=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="chatMultiDiffItem"}static{this.CHANGES_SUMMARY_CLASS_NAME="insertions-and-deletions"}renderTemplate(i){let e=this.labels.create(i,{supportHighlights:!0,supportIcons:!0});return{label:e,dispose:()=>e.dispose()}}renderElement(i,e,t){t.label.setFile(i.uri,{fileKind:0,title:i.uri.path});let o=t.label.element;if(t.changesElement?.remove(),i.diff?.added||i.diff?.removed){let n=o.appendChild(x6(`.${a.CHANGES_SUMMARY_CLASS_NAME}`)),r=n.appendChild(x6(".insertions"));r.textContent=`+${i.diff.added}`;let s=n.appendChild(x6(".deletions"));s.textContent=`-${i.diff.removed}`,n.setAttribute("aria-label",d(8739,null,i.diff.added,i.diff.removed)),t.changesElement=n}}disposeTemplate(i){i.dispose()}};var bWe=class extends k{constructor(e,t){super();this.pullRequestContent=e;this.commandService=t;this.domNode=_(".chat-pull-request-content-part");let o=D(this.domNode,_(".container")),n=D(o,_(".content-container")),r=D(n,_(".title-container"));D(r,_(".icon")).classList.add(...q.asClassNameArray(L.gitPullRequest));let l=D(r,_("a.title"));l.textContent=`${this.pullRequestContent.title} - ${this.pullRequestContent.author}`,this.pullRequestContent.uri&&(l.href=this.pullRequestContent.uri?.toString()),this._register($(l,"click",c=>{c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(this.pullRequestContent.command.id,...this.pullRequestContent.command.arguments??[])}))}hasSameContent(e,t,o){return e.kind==="pullRequest"}addDisposable(e){this._register(e)}};bWe=I([m(1,fe)],bWe);var c$t=_,dEo=!1,uEo=!1,SWe=class extends k{constructor(e,t,o,n,r,s,l){super();this.content=t;let c=e.errorDetails;To(!!c,"errorDetails"),this.domNode=c$t(".chat-quota-error-widget"),D(this.domNode,c$t("span")).classList.add(...q.asClassNameArray(L.warning));let p=D(this.domNode,c$t(".chat-quota-error-message")),h=this._register(o.render(new he(c.message)));D(p,h.element);let g,f=l.quotas.usageBasedBilling===!0;switch(l.entitlement){case 10:case 6:case 7:case 11:g=f?d(8819,null):d(8818,null);break;case 5:g=d(8820,null);break}let v=!1,b=()=>{!uEo||v||(v=!0,D(p,c$t(".chat-quota-wait-warning",void 0,d(8821,null))))},S=!1,y=()=>{if(!dEo||S)return;S=!0;let w=this._register(new Pi(p,{buttonBackground:void 0,buttonForeground:Tt(AS)}));w.element.classList.add("chat-quota-error-secondary-button"),w.label=d(8817,null),this._register(w.onDidClick(()=>{let x=n.getWidgetBySessionResource(e.sessionResource);x&&(x.rerunLastRequest(),uEo=!0,b())}))};if(g){let w=this._register(new Pi(p,{...Ro,supportIcons:!0}));w.label=g,w.element.classList.add("chat-quota-error-button"),this._register(w.onDidClick(async()=>{let x=l.entitlement===5?"workbench.action.chat.upgradePlan":"workbench.action.chat.manageAdditionalSpend";s.publicLog2("workbenchActionExecuted",{id:x,from:"chat-response"}),await r.executeCommand(x),dEo=!0,y()}))}y(),b()}hasSameContent(e){return e.kind===this.content.kind&&!!e.errorDetails.isQuotaExceeded}addDisposable(e){this._register(e)}};SWe=I([m(3,Lt),m(4,fe),m(5,_e),m(6,dr)],SWe);var IWe=class extends k{constructor(e,t,o,n,r){super();this.task=e;if(e.progress.length){this.isSettled=!0;let s=this._register(r.createInstance(I6,e.progress,e.content.value,n,t,void 0));this.domNode=_(".chat-progress-task"),this.domNode.appendChild(s.domNode)}else{let s=e.kind==="progressTask"?e.isSettled():!0;this.isSettled=s;let l=!s&&!n.element.isComplete,c=this._register(r.createInstance(KR,e,o,n,l,!0,void 0,void 0,void 0));this.domNode=c.domNode}}hasSameContent(e){return e.kind==="progressTask"&&this.task.kind==="progressTask"&&e.isSettled()!==this.isSettled?!1:e.kind===this.task.kind&&e.progress.length===this.task.progress.length}addDisposable(e){this._register(e)}};IWe=I([m(4,F)],IWe);var pEo=_,mEo=le("ICodeCompareModelService"),yWe=class extends k{constructor(e,t,o,n,r,s){super();this.codeCompareModelService=s;let l=t.element;if(To(Ni(l)),o.renderTextEditsAsSummary?.(e.uri))l.response.value.every(c=>c.kind==="textEditGroup")?this.domNode=pEo(".interactive-edits-summary",void 0,l.isComplete?l.isCanceled?d(8856,null):d(8857,null):""):this.domNode=pEo("div");else{let c=new qe,u=!1;this._register(ee(()=>{u=!0,c.dispose(!0)})),this.comparePart=this._register(n.get());let p={element:l,edit:e,diffData:(async()=>{let h=await this.codeCompareModelService.createModel(l,e);if(u){h.dispose();return}return this._register(h),{modified:h.object.modified.textEditorModel,original:h.object.original.textEditorModel,originalSha1:h.object.originalSha1}})()};this.comparePart.object.render(p,r,c.token),this.domNode=this.comparePart.object.element}}layout(e){this.comparePart?.object.layout(e)}hasSameContent(e){return e.kind==="textEditGroup"}addDisposable(e){this._register(e)}};yWe=I([m(5,mEo)],yWe);var Ost=class{constructor(i,e,t){this.textModelService=i;this.modelService=e;this.chatService=t}async createModel(i,e){let t=await this.textModelService.createModelReference(e.uri),o=await this.textModelService.createModelReference(this.modelService.createModel(Uk(t.object.textEditorModel.createSnapshot()),{languageId:t.object.textEditorModel.getLanguageId(),onDidChange:U.None},A.from({scheme:Q.vscodeChatCodeBlock,path:e.uri.path,query:ht()}),!1).uri),n=new hz(ee(()=>{t.dispose(),o.dispose()})),r="";if(e.state)r=e.state.sha1;else{let c=new Xhe;c.canComputeSHA1(t.object.textEditorModel)&&(r=c.computeSHA1(t.object.textEditorModel),e.state={sha1:r,applied:0})}let s=this.chatService.getSession(i.sessionResource),l=[];for(let c of s.getRequests())if(c.response){for(let u of c.response.response.value)if(!(u.kind!=="textEditGroup"||u.state?.applied||!ze(u.uri,e.uri)))for(let p of u.edits){let h=p.map(hT.asEditOperation);l.push(h)}if(c.response===i.model)break}for(let c of l)o.object.textEditorModel.pushEditOperations(null,c,()=>null);return n.acquire(),setTimeout(()=>n.release(),5e3),{object:{originalSha1:r,original:t.object,modified:o.object},dispose(){n.release()}}}};Ost=I([m(0,Bt),m(1,_t),m(2,si)],Ost);Ce(mEo,Ost,1);var mve=class extends O_{constructor(e,t,o,n,r,s){super(e,o,void 0,r,s);this.markdownContent=t;this.chatContentMarkdownRenderer=n;this.icon=L.check}initContent(){let e=_(".chat-collapsible-markdown-content.chat-used-context-list");if(this.markdownContent){this.contentElement=_(".chat-collapsible-markdown-body");let t=this._register(this.chatContentMarkdownRenderer.render(new he(this.markdownContent)));this.contentElement.appendChild(t.element),e.appendChild(this.contentElement)}return e}hasSameContent(e,t,o){return!1}};mve=I([m(4,ot),m(5,B)],mve);var hve=class extends xb{get codeblocks(){return this._confirmWidget?.codeblocks||[]}get codeblocksPartId(){return this._confirmWidget?.codeblocksPartId||"<none>"}constructor(i,e,t,o,n,r,s){if(super(i),i.toolSpecificData?.kind!=="extensions")throw new Error("Tool specific data is missing or not of kind extensions");let l=i.toolSpecificData;this.domNode=_("");let c=this._register(s.createInstance(Uq,l));D(this.domNode,c.domNode);let u=i.state.get();if(u.type===pi.StateKind.WaitingForConfirmation){let p=d(8936,null),h=t.appendKeybinding(p,n1),g=d(8937,null),f=t.appendKeybinding(g,Grt),v=this._register(new T),b=[{label:p,data:{type:4},tooltip:h,disabled:!0,onDidChangeDisablement:v.event},{label:g,data:{type:0},isSecondary:!0,tooltip:f}],S=this._register(s.createInstance(nne,e,{title:u.confirmationMessages?.title??d(8938,null),message:u.confirmationMessages?.message??d(8939,null),buttons:b}));this._confirmWidget=S,D(this.domNode,S.domNode),this._register(S.onDidClick(({button:x,isTouchClick:E})=>{pi.confirmWith(i,x.data),E||n.getWidgetBySessionResource(e.element.sessionResource)?.focusInput()}));let y=Z.Editing.hasToolConfirmation.bindTo(o);y.set(!0),this._register(ee(()=>y.reset()));let w=this._register(r.onInstallExtension(x=>{l.extensions.some(E=>Ht({id:E},x.identifier))&&(w.dispose(),v.fire(!1))}))}}};hve=I([m(2,Le),m(3,X),m(4,Lt),m(5,xs),m(6,F)],hve);var k6=class extends k{constructor(e,t,o,n,r){super();this.context=e;this.parts=t;this._instantiationService=o;this.contextKeyService=n;this._markdownRendererService=r;this._editorReferences=[];this.codeblocks=[];this.domNode=this.createOutputContents()}toMdString(e){return typeof e=="string"?new he("").appendText(e):new he(e.value,{isTrusted:e.isTrusted})}createOutputContents(){let e=_("div");for(let t=0;t<this.parts.length;t++){let o=this.parts[t];if(o.kind==="code"){let r=[o];for(;t+1<this.parts.length&&this.parts[t+1].kind==="code";)r.push(this.parts[++t]);this.addCodeBlock(r,e);continue}let n=[];for(let r=t;r<this.parts.length;r++){let s=this.parts[r];if(s.kind!=="data")break;n.push(s)}this.addResourceGroup(n,e),t+=n.length-1}return e}addResourceGroup(e,t){let o=this._register(this._instantiationService.createInstance(hV,e));t.appendChild(o.domNode)}addCodeBlock(e,t){let o=e[0];if(o.title){let c=_("div.chat-confirmation-widget-title"),u=this._register(this._markdownRendererService.render(this.toMdString(o.title)));c.appendChild(u.element),t.appendChild(c)}let n=e.map(c=>c.data).join(`
`),r={languageId:o.languageId,text:n,codeBlockIndex:o.codeBlockIndex,element:this.context.element,parentContextKeyService:this.contextKeyService,renderOptions:o.options,chatSessionResource:this.context.element.sessionResource},s=gk.poolKey(this.context.element.id,o.codeBlockIndex),l=this._register(this.context.editorPool.get(s));l.object.render(r,this.context.currentWidth.get()),t.appendChild(l.object.element),this._editorReferences.push(l),this.codeblocks.push({ownerMarkdownPartId:o.ownerMarkdownPartId,codeBlockIndex:o.codeBlockIndex,elementId:this.context.element.id,uri:l.object.uri,codemapperUri:void 0,chatSessionResource:this.context.element.sessionResource,focus:()=>{}})}layout(e){this._editorReferences.forEach(t=>t.object.layout(e))}};k6=I([m(2,F),m(3,X),m(4,_n)],k6);var pne=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.context=n;this.input=r;this.output=s;this.contextKeyService=p;this._instantiationService=h;this.configurationService=f;this._editorReferences=[];this._contentInitialized=!1;let v=st(".chat-confirmation-widget-container"),b=st(".chat-confirmation-widget-title-inner"),S=st(".chat-confirmation-widget");this.domNode=v.root,v.root.appendChild(S.root),this._titlePart=this._register(h.createInstance(Kq,b.root,e,t)),this._titlePart.setOptions({markdownRenderOptions:aAi(),renderFileWidgets:!0});let y=document.createElement("span");y.style.flexGrow="1";let w=this._register(new lM(S.root,{}));w.element.classList.add("chat-confirmation-widget-title","monaco-text-button"),w.labelElement.append(b.root);let x=_("span.chat-collapsible-hover-chevron.codicon.codicon-chevron-right");x.setAttribute("aria-hidden","true"),w.element.appendChild(x);let E=hr("accessibility.chat.showCheckmarks",!1,this.configurationService),M=this._expanded=De(this,c);this._register(ve(H=>{let K=M.read(H),j=E.read(H);S.root.classList.toggle("collapsed",!K);let J=!s&&!l;if(l?w.icon=L.error:w.icon=s?L.check:q.modify(L.loading,"spin"),S.root.classList.toggle("shimmer-progress",u&&J),v.root.classList.toggle("show-checkmarks",j),x.classList.toggle("codicon-chevron-right",!K),x.classList.toggle("codicon-chevron-down",K),K&&!this._contentInitialized){this._contentInitialized=!0;let se=st(".chat-confirmation-widget-message");se.root.appendChild(this.createMessageContents()),S.root.appendChild(se.root)}}));let N=H=>{if(!H.defaultPrevented){let K=M.get();M.set(!K,void 0),H.preventDefault()}};this._register(w.onDidClick(N));let V=this.output?.parts.filter(H=>H.kind==="data").filter(H=>!H.audience||H.audience.includes(1));if(V?.length){let K=this._register(this._instantiationService.createInstance(k6,this.context,V)).domNode;K.classList.add("chat-collapsible-top-level-resource-group"),v.root.appendChild(K),this._register(ve(j=>{K.style.display=M.read(j)?"none":""}))}}get codeblocks(){return this._outputSubPart?.codeblocks??[]}set title(e){this._titlePart.title=e}get title(){return this._titlePart.title}get expanded(){return this._expanded.get()}createMessageContents(){let e=st("div",[st("h3@inputTitle"),st("div@input"),st("h3@outputTitle"),st("div@output")]),{input:t,output:o}=this;if(e.inputTitle.textContent=d(8915,null),this.addCodeBlock(t,e.input),!o)e.output.remove(),e.outputTitle.remove();else{e.outputTitle.textContent=d(8916,null);let n=this._register(this._instantiationService.createInstance(k6,this.context,o.parts));this._outputSubPart=n,e.output.appendChild(n.domNode)}return e.root}addCodeBlock(e,t){let o={languageId:e.languageId,text:e.data,codeBlockIndex:e.codeBlockIndex,element:this.context.element,parentContextKeyService:this.contextKeyService,renderOptions:e.options,chatSessionResource:this.context.element.sessionResource},n=gk.poolKey(this.context.element.id,e.codeBlockIndex),r=this._register(this.context.editorPool.get(n));r.object.render(o,this.context.currentWidth.get()||300),t.appendChild(r.object.element),this._editorReferences.push(r)}hasSameContent(e,t,o){return!1}layout(e){this._editorReferences.forEach(t=>t.object.layout(e)),this._outputSubPart?.layout(e)}};pne=I([m(9,X),m(10,F),m(11,ot),m(12,B)],pne);var Xq=class extends xb{static{this._expandedByDefault=new WeakMap}get codeblocks(){return this.collapsibleListPart.codeblocks}constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){super(i);let f=t,v=(x,E="json")=>({kind:"code",data:x,languageId:E,codeBlockIndex:f++,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on"}}}),b=l;typeof l=="string"&&(b=[{type:"embed",value:l,isText:!0}]);let S=this.collapsibleListPart=this._register(u.createInstance(pne,o,n,this.getAutoApproveMessageContent(),e,v(r,s),b&&b.length>0?{parts:b.map((x,E)=>{let M=x.type==="ref"||x.uri?Be(x.uri):x.mimeType&&wA(x.mimeType)?`file${wA(x.mimeType)}`:"file"+(x.isText?".txt":".bin");if(x.type==="ref")return{kind:"data",uri:x.uri,mimeType:x.mimeType};if(x.isText&&!x.asResource)return v(x.value);{let N=v_.createUri(e.element.sessionResource,i.toolCallId,E,M);return x.isText?{kind:"data",value:new TextEncoder().encode(x.value),mimeType:x.mimeType,uri:N,audience:x.audience}:{kind:"data",base64Value:x.value,mimeType:x.mimeType,uri:N,audience:x.audience}}})}:void 0,c,c&&g.getValue("chat.tools.autoExpandFailures")||(Xq._expandedByDefault.get(i)??!1),r0e(i)));this._register(ee(()=>Xq._expandedByDefault.set(i,S.expanded)));let y=i.kind==="toolInvocation"?i.state.map((x,E)=>x.type===pi.StateKind.Executing?x.progress.read(E):void 0):void 0,w=new uo(()=>this._register(new Cv(S.domNode)));y&&this._register(ve(x=>{let E=y?.read(x);E?.message&&(S.title=E.message),E?.progress&&!pi.isComplete(i,x)&&w.value.setWorked(E.progress*100)})),this.domNode=S.domNode}getAutoApproveMessageContent(){return ene(this.toolInvocation)}};Xq=I([m(9,F),m(10,_t),m(11,Rt),m(12,B)],Xq);var Fst=le("chatResponseResourceFileSystemProvider"),wWe=class extends k{constructor(e,t){super();this.chatService=e;this._fileService=t;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None;this.capabilities=19474;this._associated=new dt;this._sessionAssociations=new dt;this._register(this.chatService.onDidDisposeSession(o=>{for(let n of o.sessionResources){let r=this._sessionAssociations.get(n);if(r){for(let s of r)this._associated.delete(s);this._sessionAssociations.delete(n)}}}))}associate(e,t,o){let n=ht(),r=A.from({scheme:v_.scheme,path:`/assoc/${n}`+(o?`/${o}`:"")});this._associated.set(r,t);let s=this._sessionAssociations.get(e);return s||(s=new xn,this._sessionAssociations.set(e,s)),s.add(r),r}readFile(e){return Promise.resolve(this.lookupURI(e))}readFileStream(e){let t=Ty(o=>Ke.concat(o.map(n=>Ke.wrap(n))).buffer);return Promise.resolve(this.lookupURI(e)).then(o=>t.end(o)),t}async stat(e){let t=await this.lookupURI(e);return{type:1,ctime:0,mtime:0,size:t.length}}delete(){throw Ys("fs is readonly","NoPermissions")}watch(){return k.None}mkdir(){throw Ys("fs is readonly","NoPermissions")}readdir(){return Promise.resolve([])}rename(){throw Ys("fs is readonly","NoPermissions")}writeFile(){throw Ys("fs is readonly","NoPermissions")}findMatchingInvocation(e){let t=v_.parseUri(e);if(!t)throw Ys("File not found","EntryNotFound");let{sessionResource:o,toolCallId:n,index:r}=t,s=this.chatService.getSession(o);if(!s)throw Ys("File not found","EntryNotFound");let l=s.getRequests();for(let c=l.length-1;c>=0;c--){let p=l[c].response?.entireResponse.value.find(h=>(h.kind==="toolInvocation"||h.kind==="toolInvocationSerialized")&&h.toolCallId===n);if(p)return{result:p,index:r}}throw Ys("File not found","EntryNotFound")}lookupURI(e){let t=this._associated.get(e);if(t){if(t instanceof Uint8Array)return t;let l=Ws(t.base64).buffer;return this._associated.set(e,l),l}let{result:o,index:n}=this.findMatchingInvocation(e),r=pi.resultDetails(o);if(!oR(r))throw Ys("Tool does not have I/O","EntryNotFound");let s=r.output.at(n);if(!s)throw Ys("Tool does not have part","EntryNotFound");return s.type==="ref"?this._fileService.readFile(s.uri).then(l=>l.value.buffer):s.isText?new TextEncoder().encode(s.value):Ws(s.value).buffer}};wWe=I([m(0,si),m(1,ge)],wWe);var gve=class extends k{static{this.ID="chatResponseResourceWorkbenchContribution"}constructor(i,e){super(),this._register(e.registerProvider(v_.scheme,i))}};gve=I([m(0,Fst),m(1,ge)],gve);function ppn(a){return{transformIncoming:i=>i.scheme==="vscode-remote"?{scheme:"file",path:i.path,query:i.query,fragment:i.fragment}:i.scheme==="file"?{scheme:"vscode-local",path:i.path,query:i.query,fragment:i.fragment}:i,transformOutgoing:i=>i.scheme==="file"?{scheme:"vscode-remote",authority:a,path:i.path,query:i.query,fragment:i.fragment}:i.scheme==="vscode-local"?{scheme:"file",path:i.path,query:i.query,fragment:i.fragment}:i,transformOutgoingScheme:i=>i==="file"?"vscode-remote":i==="vscode-local"?"file":i}}function hEo(a){return new D1t(ppn(a))}var CWe=class extends k{constructor(i,e,t,o,n){super();let r=i.readDefinitions().map(({collection:h})=>h?.presentation?.origin&&n.getWorkspaceFolder(h.presentation?.origin)?.uri),s=async()=>{let h=e.lastModeDebugged;await i.stop(),await i.start({debug:h})},l=!1;this._register(ve(h=>{let g=i.readDefinitions().read(h);if(!g.collection||!g.server||!g.server.devMode){l=!1;return}l||!t.delegates.read(h).some(v=>v.canStart(g.collection,g.server))||(i.start(),l=!0)}));let c=i.readDefinitions().map(h=>!!h.server?.devMode?.debug);this._register(Kle(c,({lastValue:h,newValue:g})=>{g&&!Qi(h,g)&&s()}));let u=Js({equalsFn:eo},h=>{let f=i.readDefinitions().read(h).server?.devMode?.watch;return typeof f=="string"?[f]:f}),p=this._register(new am);this._register(ve(h=>{let g=u.read(h),f=r.read(h);if(!g||!f)return;let v=g.filter(x=>!x.startsWith("!")),b=g.filter(x=>x.startsWith("!")).map(x=>x.slice(1));h.store.add(o.watch(f,{includes:v,excludes:b,recursive:!0}));let S=!o.hasCapability(f,1024),y=v.map(x=>Eh({base:f.fsPath,pattern:x},{ignoreCase:S})),w=b.map(x=>Eh({base:f.fsPath,pattern:x},{ignoreCase:S}));h.store.add(o.onDidFilesChange(x=>{for(let E of[x.rawAdded,x.rawDeleted,x.rawUpdated])for(let M of E)if(y.some(N=>N(M.fsPath))&&!w.some(N=>N(M.fsPath))){p.queue(s);break}}))}))}};CWe=I([m(2,xc),m(3,ge),m(4,Ae)],CWe);var xWe=le("mcpDevModeDebugging"),d$t="127.0.0.1",mne=class{constructor(i,e){this._debugService=i;this._commandService=e}async transform(i,e){if(!i.devMode?.debug||e.type!==1)return e;let t=await this.getDebugPort(),o=`MCP: ${i.label}`,n={startedByUser:!1,suppressDebugView:!0},r={internalConsoleOptions:"neverOpen",suppressMultipleSessionWarning:!0};switch(i.devMode.debug.type){case"node":{if(!/node[0-9]*$/.test(e.command))throw new Error(d(13226,null,e.command));return this._debugService.startDebugging(void 0,{type:"pwa-node",request:"attach",name:o,port:t,host:d$t,timeout:3e4,continueOnAttach:!0,...r},n),{...e,args:[`--inspect-brk=${d$t}:${t}`,...e.args]}}case"debugpy":{if(!/python[0-9.]*$/.test(e.command))throw new Error(d(13227,null,e.command));let s,l=["--wait-for-client","--connect",`${d$t}:${t}`,...e.args];if(i.devMode.debug.debugpyPath)s=i.devMode.debug.debugpyPath;else try{let c=await this._commandService.executeCommand("python.getDebugpyPackagePath");c&&(s=e.command,l=[c,...l])}catch{}return s||(s="debugpy"),await Promise.race([this._debugService.startDebugging(void 0,{type:"debugpy",name:o,request:"attach",listen:{host:d$t,port:t},...r},n),this.ensureListeningOnPort(t)]),{...e,command:s,args:l}}default:bs(i.devMode.debug,`Unknown debug type ${JSON.stringify(i.devMode.debug)}`)}}ensureListeningOnPort(i){return Promise.resolve()}getDebugPort(){return Promise.resolve(9230)}};mne=I([m(0,Hi),m(1,fe)],mne);var gEo=["image/webp","image/png","image/jpeg","image/jpg","image/gif"];function mpn(a,i,e){let t=a.mimeType?.toLowerCase()||Py(a.src);if(!t||!gEo.includes(t)){e.debug(`Ignoring icon with unsupported mime type: ${a.src} (${t}), allowed: ${gEo.join(", ")}`);return}let o=A.parse(a.src);if(o.scheme==="data")return o;if(o.scheme==="https"||o.scheme==="http"){if(i.type!==2){e.debug(`Ignoring icon with HTTP/HTTPS URL: ${a.src} as the MCP server is not launched with HTTP transport.`);return}let n=i.uri.authority.toLowerCase();if(o.authority.toLowerCase()!==n){e.debug(`Ignoring icon with untrusted authority: ${a.src}, expected authority: ${n}`);return}return o}if(o.scheme==="file"){if(i.type!==1){e.debug(`Ignoring icon with file URL: ${a.src} as the MCP server is not launched as a local process.`);return}return o}e.debug(`Ignoring icon with unsupported scheme: ${a.src}. Allowed: data:, http:, https:, file:`)}function fEo(a,i,e){let t=[];for(let o of a.icons||[]){let n=mpn(o,i,e);if(!n)continue;let r=typeof o.sizes=="string"?o.sizes.split(" "):Array.isArray(o.sizes)?o.sizes:[];t.push({src:n,theme:o.theme==="light"?0:o.theme==="dark"?1:2,sizes:r.map(s=>{let[l,c]=s.toLowerCase().split("x");return{width:Number(l)||0,height:Number(c)||0}}).sort((s,l)=>s.width-l.width)})}return t.sort((o,n)=>o.sizes[0]?.width-n.sizes[0]?.width),t}var Jq=class a{constructor(i){this._icons=i}static fromStored(i){return a.fromParsed(i?.map(e=>({src:A.revive(e.src),theme:e.theme,sizes:e.sizes})))}static fromParsed(i){return new a(i||[])}getUrl(i){let e=this.getSizeWithTheme(i,1);if(e?.theme===2)return{dark:e.src};let t=this.getSizeWithTheme(i,0);if(!(!t&&!e))return{dark:(e||t).src,light:t?.src}}getSizeWithTheme(i,e){let t;for(let o of this._icons)if(o.theme===e||o.theme===2||o.theme===void 0){t=o;let n=o.sizes.find(r=>r.width>=i);if(n)return{...o,sizes:[n]}}return t}};var EWe=le("mcpSandboxService"),kWe=class extends k{constructor(e,t,o,n,r){super();this._fileService=e;this._environmentService=t;this._logService=o;this._mcpResourceScannerService=n;this._remoteAgentService=r;this._defaultAllowedDomains=["registry.npmjs.org"];this._defaultAllowWritePaths=["~/.npm"];this._sandboxConfigPerConfigurationTarget=new Map;this._pathJoin=(e,...t)=>(e===1?Gs:Vo).join(...t);this._getPathDelimiter=async e=>await this._getOperatingSystem(e)===1?Gs.delimiter:Vo.delimiter;this._sandboxSettingsId=ht(),this._remoteEnvDetailsPromise=this._remoteAgentService.getEnvironment()}async isEnabled(e,t){return await this._getOperatingSystem(t)===1?!1:!!e.sandboxEnabled}async launchInSandboxIfEnabled(e,t,o,n){if(t.type!==1)return t;if(await this.isEnabled(e,o)){this._logService.trace(`McpSandboxService: Launching with config target ${n}`);let r=await this._resolveSandboxLaunchDetails(n,o,t.sandbox,t.cwd),s=this._quoteShellArgument(t.command),l=t.args.map(p=>this._quoteShellArgument(p)),c=this._getSandboxCommandArgs(s,l,r.sandboxConfigPath),u=await this._getSandboxEnvVariables(t.env,r.tempDir,r.rgPath,o);if(r.srtPath)return r.execPath?{...t,command:r.execPath,args:[r.srtPath,...c],env:u,type:1}:{...t,command:r.srtPath,args:c,env:u,type:1};r.execPath||this._logService.warn("McpSandboxService: execPath is unavailable, launching without sandbox runtime wrapper"),this._logService.debug(`McpSandboxService: launch details for server ${e.label} - command: ${t.command}, args: ${t.args.join(" ")}`)}return t}getSandboxConfigSuggestionMessage(e,t,o){let n=this._getSandboxConfigSuggestions(t,o);if(!n)return;let r=n.allowWrite,s=n.allowedDomains,l=[];if(s.length){let u=s.map(p=>`"${p}"`).join(", ");l.push(d(13257,null,u))}if(r.length){let u=r.map(p=>`"${p}"`).join(", ");l.push(d(13258,null,u))}let c={};return s.length&&(c.network={allowedDomains:[...s]}),r.length&&(c.filesystem={allowWrite:[...r]}),{message:d(13259,null,e,l.join(`
`)),sandboxConfig:c}}async applySandboxConfigSuggestion(e,t,o,n,r){let s=this._toMcpResourceTarget(o),l=!1;return await this._mcpResourceScannerService.updateSandboxConfig(c=>{let u=c.sandbox,p=r?.network?.allowedDomains??[],h=r?.filesystem?.allowWrite??[],g=new Set(u?.network?.allowedDomains??[]);for(let b of p)b&&!g.has(b)&&g.add(b);let f=new Set(u?.filesystem?.allowWrite??[]);for(let b of h)b&&!f.has(b)&&f.add(b);if(p.length===0&&h.length===0)return c;l=!0;let v={};return g.size>0&&(v.network={...u?.network,allowedDomains:[...g]}),f.size>0&&(v.filesystem={...u?.filesystem,allowWrite:[...f]}),{...c,sandbox:v}},t,s),l}_getSandboxConfigSuggestions(e,t){if(!e.length)return;let o=new Set,n=new Set,r=new Set(t?.filesystem?.allowWrite??[]),s=new Set(t?.network?.allowedDomains??[]);for(let l of e)l.kind==="network"&&l.host&&!s.has(l.host)&&n.add(l.host),l.kind==="filesystem"&&l.path&&!r.has(l.path)&&o.add(l.path);if(!(!o.size&&!n.size))return{allowWrite:[...o],allowedDomains:[...n]}}_toMcpResourceTarget(e){switch(e){case 2:case 3:case 4:return 2;case 5:return 5;case 6:return 6;default:return 2}}async _resolveSandboxLaunchDetails(e,t,o,n){let r=await this._getOperatingSystem(t);if(r===1)return{execPath:void 0,srtPath:void 0,rgPath:void 0,sandboxConfigPath:void 0,tempDir:void 0};let s=await this._getAppRoot(t),l=await this._getExecPath(r,s,t),c=await this._getTempDir(t),u=this._pathJoin(r,s,"node_modules","@vscode","sandbox-runtime","dist","cli.js"),p=this._pathJoin(r,s,"node_modules","@vscode","ripgrep","bin","rg"),h=c?await this._updateSandboxConfig(c,e,o,n):void 0;return this._logService.debug(`McpSandboxService: Updated sandbox config path: ${h}`),{execPath:l,srtPath:u,rgPath:p,sandboxConfigPath:h,tempDir:c}}async _getExecPath(e,t,o){if(o)return this._pathJoin(e,t,"node")}async _getSandboxEnvVariables(e,t,o,n){let r={...e};return t&&(r={...r,TMPDIR:t.path,SRT_DEBUG:"true",NODE_USE_ENV_PROXY:"1"}),o&&(r={...r,PATH:r.PATH?`${r.PATH}${await this._getPathDelimiter(n)}${yd(o)}`:yd(o)}),n||(r={...r,ELECTRON_RUN_AS_NODE:"1"}),r.VSCODE_INSPECTOR_OPTIONS=null,r}_getSandboxCommandArgs(e,t,o){let n=[];return o&&(n.push("--settings",o),n.push("--")),n.push(e,...t),n}async _getRemoteEnv(e){return e?this._remoteEnvDetailsPromise:null}async _getOperatingSystem(e){let t=await this._getRemoteEnv(e);return t?t.os:Ao}async _getAppRoot(e){let t=await this._getRemoteEnv(e);return t?t.appRoot.path:yd(In.asFileUri("").path)}async _getTempDir(e){let t=await this._getRemoteEnv(e);if(t)return t.tmpDir;let n=this._environmentService.tmpDir;return n||this._logService.warn("McpSandboxService: Cannot create sandbox settings file because no tmpDir is available in this environment"),n}async _updateSandboxConfig(e,t,o,n){let r=this._withDefaultSandboxConfig(o,n),s,l=HY(t);return this._sandboxConfigPerConfigurationTarget.has(l)?s=A.parse(this._sandboxConfigPerConfigurationTarget.get(l)):(s=A.joinPath(e,`vscode-${l}-mcp-sandbox-settings-${this._sandboxSettingsId}.json`),this._sandboxConfigPerConfigurationTarget.set(l,s.toString())),await this._fileService.createFile(s,Ke.fromString(JSON.stringify(r,null,"	")),{overwrite:!0}),s.path}_withDefaultSandboxConfig(e,t){let o=new Set(e?.filesystem?.allowWrite??[]);for(let r of this._getDefaultAllowWrite(t?[t]:void 0))r&&o.add(r);let n=new Set(e?.network?.allowedDomains??[]);for(let r of this._defaultAllowedDomains)r&&n.add(r);return{...e,network:{allowedDomains:[...n],deniedDomains:e?.network?.deniedDomains??[]},filesystem:{allowWrite:[...o],denyRead:e?.filesystem?.denyRead??[],denyWrite:e?.filesystem?.denyWrite??[]}}}_getDefaultAllowWrite(e){for(let t of e??[]){let o=t.trim();o&&this._defaultAllowWritePaths.push(o)}return this._defaultAllowWritePaths}_quoteShellArgument(e){return`'${e.replace(/'/g,"'\\''")}'`}};kWe=I([m(0,ge),m(1,ko),m(2,re),m(3,$te),m(4,bo)],kWe);var u$t=class extends k{constructor(){super(...arguments);this._serverTasks=this._register(new Ot);this._clientTasks=this._register(new Ot);this._onDidUpdateTask=this._register(new T);this.onDidUpdateTask=this._onDidUpdateTask.event}setHandler(e){for(let t of this._clientTasks.values())t.setHandler(e)}getClientTask(e){return this._clientTasks.get(e)}adoptClientTask(e){this._clientTasks.set(e.id,e)}abandonClientTask(e){this._clientTasks.deleteAndDispose(e)}createTask(e,t){let o=ht(),n=new Date().toISOString(),r=Date.now(),s={taskId:o,status:"working",createdAt:n,ttl:e,lastUpdatedAt:new Date().toISOString(),pollInterval:1e3},l=new O,c=new qe;l.add(ee(()=>c.dispose(!0)));let u=this._executeTask(o,t,c.token);return e?l.add(Zo(()=>this._serverTasks.deleteAndDispose(o),e)):u.finally(()=>{let p=this._register(Zo(()=>{this._serverTasks.deleteAndDispose(o),this._store.delete(p)},6e4))}),this._serverTasks.set(o,{task:s,cts:c,dispose:()=>l.dispose(),createdAtTime:r,executionPromise:u}),{task:s}}async _executeTask(e,t,o){try{let n=await t(o);this._updateTaskStatus(e,"completed",void 0,n)}catch(n){n instanceof qi?this._updateTaskStatus(e,"cancelled","Task was cancelled by the client"):n instanceof eS?this._updateTaskStatus(e,"failed",n.message,void 0,{code:n.code,message:n.message,data:n.data}):n instanceof Error?this._updateTaskStatus(e,"failed",n.message,void 0,{code:vb.INTERNAL_ERROR,message:n.message}):this._updateTaskStatus(e,"failed","Unknown error",void 0,{code:vb.INTERNAL_ERROR,message:"Unknown error"})}}_updateTaskStatus(e,t,o,n,r){let s=this._serverTasks.get(e);s&&(s.task.status=t,s.task.lastUpdatedAt=new Date().toISOString(),o!==void 0&&(s.task.statusMessage=o),n!==void 0&&(s.result=n),r!==void 0&&(s.error=r),this._onDidUpdateTask.fire({...s.task}))}getTask(e){let t=this._serverTasks.get(e);if(!t)throw new eS(vb.INVALID_PARAMS,`Task not found: ${e}`);return{...t.task}}async getTaskResult(e){let t=this._serverTasks.get(e);if(!t)throw new eS(vb.INVALID_PARAMS,`Task not found: ${e}`);(t.task.status==="working"||t.task.status==="input_required")&&await t.executionPromise;let o=this._serverTasks.get(e);if(!o)throw new eS(vb.INVALID_PARAMS,`Task not found: ${e}`);if(o.error)throw new eS(o.error.code,o.error.message,o.error.data);if(!o.result)throw new eS(vb.INTERNAL_ERROR,"Task completed but no result available");return o.result}cancelTask(e){let t=this._serverTasks.get(e);if(!t)throw new eS(vb.INVALID_PARAMS,`Task not found: ${e}`);if(t.task.status==="completed"||t.task.status==="failed"||t.task.status==="cancelled")throw new eS(vb.INVALID_PARAMS,`Cannot cancel task in ${t.task.status} status`);return t.task.status="cancelled",t.task.statusMessage="Task was cancelled by the client",t.cts.cancel(),{...t.task}}listTasks(){let e=[];for(let t of this._serverTasks.values())e.push({...t.task});return{tasks:e}}};var p$t=class a{constructor(i,e){this.template=i;this.template=i,this.components=e}static parse(i){let e=[],t=/\{([^{}]+)\}/g,o,n=0;for(;o=t.exec(i);){let[r,s]=o;if(e.push(i.slice(n,o.index)),n=o.index+r.length,i[o.index-1]==="{"||i[n]==="}"){e.push(s);continue}let l="",c=s;c.length>0&&a._isOperator(c[0])&&(l=c[0],c=c.slice(1));let u=c.split(",").map(p=>{let h=p,g=!1,f=!1,v,b=!1;h.endsWith("*")&&(g=!0,f=!0,h=h.slice(0,-1));let S=h.match(/^(.*?):(\d+)$/);return S&&(h=S[1],v=parseInt(S[2],10)),h.endsWith("?")&&(b=!0,h=h.slice(0,-1)),{explodable:g,name:h,optional:b,prefixLength:v,repeatable:f}});e.push({expression:r,operator:l,variables:u})}return e.push(i.slice(n)),new a(i,e)}static{this._operators=["+","#",".","/",";","?","&"]}static _isOperator(i){return a._operators.includes(i)}resolve(i){let e="";for(let t of this.components)typeof t=="string"?e+=t:e+=this._expand(t,i);return e}_expand(i,e){let t=i.operator,o=i.variables;if(o.length===0)return i.expression;let n=[],r=t===";"||t==="?"||t==="&",s=t==="+"||t==="#",l=t==="#",c=t===".",u=t==="/",p=t==="?",h=t==="&",g=t===";",f="";t==="+"?f="":t==="#"?f="#":t==="."?f=".":t==="/"?f="":t===";"?f=";":t==="?"?f="?":t==="&"&&(f="&");for(let b of o){let S=e[b.name],y=Object.prototype.hasOwnProperty.call(e,b.name);if(S==null||Array.isArray(S)&&S.length===0){if(g){y&&S==null&&n.push(b.name);continue}if(p||h){y&&n.push(a._formPair(b.name,"",r));continue}continue}if(typeof S=="object"&&!Array.isArray(S)){if(b.explodable){let E=[];for(let M in S)if(Object.prototype.hasOwnProperty.call(S,M)){let N=String(S[M]);g||p||h||c?E.push(M+"="+N):u?E.push("/"+M+"="+a._encode(N,s)):E.push(M+"="+a._encode(N,s))}c?n.push(E.join(".")):u?n.push(E.join("")):g?n.push(E.join(";")):p||h?n.push(E.join("&")):n.push(E.join(","))}else{let E=[];for(let N in S)Object.prototype.hasOwnProperty.call(S,N)&&(E.push(N),E.push(String(S[N])));let M=E.join(",");c?n.push(M):g||p||h?n.push(b.name+"="+M):n.push(M)}continue}if(Array.isArray(S)){b.explodable?c?n.push(S.join(".")):u?n.push(S.map(E=>"/"+a._encode(E,s)).join("")):g?n.push(S.map(E=>b.name+"="+String(E)).join(";")):p||h?n.push(S.map(E=>b.name+"="+String(E)).join("&")):n.push(S.map(E=>a._encode(E,s)).join(",")):c?n.push(S.join(",")):g||p||h?n.push(b.name+"="+S.join(",")):n.push(S.map(E=>a._encode(E,s)).join(","));continue}let w=String(S);b.prefixLength!==void 0&&(w=w.substring(0,b.prefixLength));let x=a._encode(w,t==="+"||t==="#");g||p||h?n.push(b.name+"="+x):c?n.push(x):u?n.push("/"+x):n.push(x)}let v="";if(c){let b=n.filter(S=>S!=="");v=b.length?f+b.join("."):""}else if(u){let b=n.filter(S=>S!=="");v=b.length?b.join(""):"",v&&!v.startsWith("/")&&(v="/"+v)}else g?v=n.length?f+n.map(b=>b.replace(/=\s*$/,"")).join(";"):"":p||h?v=n.length?f+n.join("&"):"":l?v=f+n.join(","):v=n.join(",");return v}static _encode(i,e){return e?encodeURI(i):hpn(i)}static _formPair(i,e,t){return t?i+"="+encodeURIComponent(String(e)):encodeURIComponent(String(e))}};function hpn(a){let i="";for(let e=0;e<a.length;e++){let t=a.charCodeAt(e);t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===45||t===46||t===95||t===126?i+=a[e]:i+="%"+t.toString(16).toUpperCase()}return i}var vpn={serverName:void 0,serverIcons:[],serverInstructions:void 0,trustedAtNonce:void 0,nonce:void 0,tools:[],prompts:void 0,capabilities:void 0},vEo=/[^a-z0-9_-]/gi,fve=class extends k{constructor(e,t){super();this.didChange=!1;this.cache=new Ua(128);this.extensionServers=new Map;let o="mcpToolCache";this._register(t.onWillSaveState(()=>{this.didChange&&(t.store(o,{extensionServers:[...this.extensionServers],serverTools:this.cache.toJSON()},e,1),this.didChange=!1)}));try{let n=t.getObject(o,e);this.extensionServers=new Map(n?.extensionServers??[]),n?.serverTools?.forEach(([r,s])=>this.cache.set(r,s))}catch{}}reset(){this.cache.clear(),this.extensionServers.clear(),this.didChange=!0}get(e){return this.cache.get(e)}store(e,t){let o=this.get(e)||vpn;this.cache.set(e,{...o,...t}),this.didChange=!0}getServers(e){return this.extensionServers.get(e)}storeServers(e,t){t?this.extensionServers.set(e,t):this.extensionServers.delete(e),this.didChange=!0}};fve=I([m(1,de)],fve);var TWe=class{constructor(i,e,t,o,n,r){this._definitionId=i;this._cache=e;this._fromStaticDefinition=t;this._fromCache=o;this._toT=n;this.defaultValue=r;this.fromServerPromise=De(this,void 0);this.fromServer=ke(i=>this.fromServerPromise.read(i)?.promiseResult.read(i)?.data);this.value=ke(i=>{let t=this.fromServer.read(i)?.data??this._fromStaticDefinition?.read(i)??this.fromCache?.data??this.defaultValue;return this._toT(t,i)})}get fromCache(){let i=this._cache.get(this._definitionId);return i?{data:this._fromCache(i),nonce:i.nonce}:void 0}hasStaticDefinition(i){return!!this._fromStaticDefinition?.read(i)}},kb=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N){super();this.definition=t;this._requiresExtensionActivation=n;this._primitiveCache=r;this._mcpRegistry=c;this._extensionService=p;this._loggerService=h;this._outputService=g;this._telemetryService=f;this._commandService=v;this._instantiationService=b;this._dialogService=S;this._notificationService=y;this._openerService=w;this._samplingService=x;this._elicitationService=E;this._mcpSandboxService=M;this._taskManager=this._register(new u$t);this._connectionSequencer=new Tm;this._connection=this._register(IB(this,void 0));this.connection=this._connection;this.connectionState=ke(e=>this._connection.read(e)?.state.read(e)??{state:Sr.Kind.Stopped});this.cacheState=ke(e=>{let t=()=>this._fullDefinitions.read(e)?.server?.cacheNonce,o=()=>this._tools.hasStaticDefinition(e)?1:this._tools.fromCache?t()===this._tools.fromCache.nonce?1:2:0,n=this._tools.fromServerPromise.read(e),r=this.connectionState.read(e);if(Sr.canBeStarted(r.state)||!n)return o();let l=n?.promiseResult.read(e);return l?l.error?o():l.data?.nonce===t()?5:2:this._tools.fromCache?4:3});this._lastModeDebugged=!1;this._isQuietStart=!1;this._isSandboxSuggestionDialogVisible=!1;this._potentialSandboxBlocks=[];this._potentialSandboxBlockListener=this._register(new ue);this.runningToolCalls=new Set;this.collection=e,this._fullDefinitions=this._mcpRegistry.getServerDefinition(this.collection,this.definition),this.enablement=ke(J=>l.readEnabled(t.id,J)),this._loggerId=`mcpServer.${t.id}`,this._logger=this._register(h.createLogger(this._loggerId,{hidden:!0,name:`MCP: ${t.label}`}));let V=this;this._register(this._instantiationService.createInstance(CWe,this,{get lastModeDebugged(){return V._lastModeDebugged}})),this._register(ee(()=>h.deregisterLogger(this._loggerId)));let H=o?De(this,o.map(J=>({uri:J,name:Be(J)}))):vi(this,u.onDidChangeWorkspaceFolders,()=>u.getWorkspace().folders),K=N.remoteAuthority?hEo(N.remoteAuthority):void 0;this._register(ve(J=>{let se=this._connection.read(J)?.handler.read(J);se&&(se.roots=H.read(J).filter(ae=>ae.uri.authority===(e.remoteAuthority||"")).map(ae=>{let ce=A.from(K?.transformIncoming(ae.uri)??ae.uri);return ce.scheme===Q.file&&(ce=A.file(dm(ce.fsPath,!0))),{name:ae.name,uri:ce.toString()}}))})),this._register(ve(J=>{let se=this._connection.read(J),ae=se?.handler.read(J);ae?this._populateLiveData(ae,se?.definition.cacheNonce,J.store):this._tools&&this.resetLiveData()})),this._register(ve(J=>{let se=this._connection.read(J);this._potentialSandboxBlockListener.value=se?.onPotentialSandboxBlock(ae=>this.recordPotentialSandboxBlock(ae))}));let j=ke(J=>{let se=this._fullDefinitions.read(J).server;return se&&se.cacheNonce!==this._tools.fromCache?.nonce?se.staticMetadata:void 0});this._tools=new TWe(this.definition.id,this._primitiveCache,j.map(J=>{let se=J?.tools?.filter(ae=>ae.availability===0).map(ae=>ae.definition);return se?.length?new Uc(this._getValidatedTools(se)):void 0}).map((J,se)=>J?.promiseResult.read(se)?.data),J=>J.tools,J=>J.map(se=>this._instantiationService.createInstance(Wst,this,s,se)).sort((se,ae)=>se.compare(ae)),[]),this._prompts=new TWe(this.definition.id,this._primitiveCache,void 0,J=>J.prompts||[],J=>J.map(se=>new dNi(this,se)),[]),this._serverMetadata=new TWe(this.definition.id,this._primitiveCache,j.map(J=>J?this._toStoredMetadata(J?.serverInfo,J?.instructions):void 0),J=>({serverName:J.serverName,serverInstructions:J.serverInstructions,serverIcons:J.serverIcons}),J=>({serverName:J?.serverName,serverInstructions:J?.serverInstructions,icons:Jq.fromStored(J?.serverIcons)}),void 0),this._capabilities=new TWe(this.definition.id,this._primitiveCache,j.map(J=>J?.capabilities!==void 0?bEo(J.capabilities):void 0),J=>J.capabilities,J=>J,void 0)}static async callOn(e,t,o=Ie.None){await e.start({promptType:"all-untrusted"});let n=!1,r,s=new Promise((l,c)=>{r=ve(u=>{let p=e.connection.read(u);if(!p||n)return;let h=p.handler.read(u);if(!h){let g=p.state.read(u);if(g.state===Sr.Kind.Error){c(new DJe(`MCP server could not be started: ${g.message}`));return}else if(g.state===Sr.Kind.Stopped){c(new DJe("MCP server has stopped"));return}else return}l(t(h,p)),n=!0})});return Ym(s,o).finally(()=>r.dispose())}get capabilities(){return this._capabilities.value}get tools(){return this._tools.value}get prompts(){return this._prompts.value}get serverMetadata(){return this._serverMetadata.value}get trustedAtNonce(){return this._primitiveCache.get(this.definition.id)?.trustedAtNonce}set trustedAtNonce(e){this._primitiveCache.store(this.definition.id,{trustedAtNonce:e})}get logger(){return this._logger}readDefinitions(){return this._fullDefinitions}showOutput(e){return this._loggerService.setVisibility(this._loggerId,!0),this._outputService.showChannel(this._loggerId,e)}resources(e){let t=new qe(e);return new Fp(async o=>{await kb.callOn(this,async n=>{for await(let r of n.listResourcesIterable({},t.token))if(o.emitOne(r.map(s=>new uNi(this,s,Jq.fromParsed(this._parseIcons(s))))),t.token.isCancellationRequested)return})},()=>t.dispose(!0))}resourceTemplates(e){return kb.callOn(this,async t=>(await t.listResourceTemplates({},e)).map(n=>new pNi(this,n,Jq.fromParsed(this._parseIcons(n)))),e)}start({interaction:e,autoTrustChanges:t,promptType:o,debug:n,errorOnUserInteraction:r}={}){return e?.participants.set(this.definition.id,{s:"unknown"}),this._connectionSequencer.queue(async()=>{let s=int(this.collection.id.slice(_do.length));if(this._requiresExtensionActivation&&!this._extensionService.activationEventIsDone(s)&&(await this._extensionService.activateByEvent(s),await Promise.all(this._mcpRegistry.delegates.get().map(p=>p.waitForInitialProviderPromises())),this._store.isDisposed))return{state:Sr.Kind.Stopped};let l=this._connection.get();if(this._isQuietStart=!!r,l&&Sr.canBeStarted(l.state.get().state)&&(l.dispose(),l=void 0,this._connection.set(l,void 0)),!l){this._lastModeDebugged=!!n;let p=this;if(l=await this._mcpRegistry.resolveConnection({interaction:e,autoTrustChanges:t,promptType:o,trustNonceBearer:{get trustedAtNonce(){return p.trustedAtNonce},set trustedAtNonce(h){p.trustedAtNonce=h}},logger:this._logger,collectionRef:this.collection,definitionRef:this.definition,debug:n,errorOnUserInteraction:r,taskManager:this._taskManager}),!l)return{state:Sr.Kind.Stopped};if(this._store.isDisposed)return l.dispose(),{state:Sr.Kind.Stopped};this._connection.set(l,void 0),l.definition.devMode&&this.showOutput()}this._potentialSandboxBlocks.length=0;let c=Date.now(),u=await l.start({createMessageRequestHandler:(p,h)=>this._samplingService.sample({isDuringToolCall:this.runningToolCalls.size>0,server:this,params:p},h).then(g=>g.sample),elicitationRequestHandler:async(p,h)=>{let g=l.handler.get()?.serverInfo;g&&this._telemetryService.publicLog2("mcp.elicitationRequested",{serverName:g.name,serverVersion:g.version});let f=await this._elicitationService.elicit(this,yt.first(this.runningToolCalls),p,h||Ie.None);return f.dispose(),f.value}});if(this._telemetryService.publicLog2("mcp/serverBootState",{state:Sr.toKindString(u.state),time:Date.now()-c}),r&&u.state===Sr.Kind.Running){let p;u=await new Promise((h,g)=>{p=ve(f=>{l.handler.read(f)&&h(u);let b=l.state.read(f);b.state===Sr.Kind.Stopped&&b.reason==="needs-user-interaction"&&g(new EC("auth")),Sr.isRunning(b)||h(b)})}).finally(()=>p.dispose())}if(u.state===Sr.Kind.Error){let p;u=await new Promise((h,g)=>{p=ve(f=>{let v=this._connection.read(f),b=v?.state.read(f);v&&b?.state===Sr.Kind.Error&&(this._isQuietStart?g(new EC("start")):this.showInteractiveError(v,b,this._lastModeDebugged))})}).finally(()=>p.dispose())}return u}).finally(()=>{e?.participants.set(this.definition.id,{s:"resolved"})})}showInteractiveError(e,t,o){if(e.definition.sandboxEnabled){this.showSandboxConfigSuggestionFromPotentialBlocks(e,this._potentialSandboxBlocks)||this._notificationService.warn(d(13271,null,e.definition.label,t.message));return}if(t.code==="ENOENT"&&e.launchDefinition.type===1){let n;switch(e.launchDefinition.command){case"uvx":n="https://aka.ms/vscode-mcp-install/uvx";break;case"npx":n="https://aka.ms/vscode-mcp-install/npx";break;case"dnx":n="https://aka.ms/vscode-mcp-install/dnx";break;case"dotnet":n="https://aka.ms/vscode-mcp-install/dotnet";break}let r=[{label:d(13260,null),run:()=>this.showOutput()}];if(e.definition.devMode?.debug?.type==="debugpy"&&o){this._notificationService.prompt(ft.Error,d(13264,null,e.launchDefinition.command,e.definition.label),[...r,{label:d(13274,null),run:()=>this._openerService.open(A.parse("https://aka.ms/vscode-mcp-install/debugpy"))}]);return}n&&r.push({label:d(13272,null,e.launchDefinition.command),run:()=>this._openerService.open(A.parse(n))}),this._notificationService.prompt(ft.Error,d(13273,null,e.launchDefinition.command,e.definition.label),r)}else this._notificationService.warn(d(13271,null,e.definition.label,t.message))}showSandboxConfigSuggestionFromPotentialBlocks(e,t){if(!e.definition.sandboxEnabled||!t.length||this._isSandboxSuggestionDialogVisible)return!1;if(this._isQuietStart)throw new EC("sandbox-suggestion");let o=this._fullDefinitions.get().collection?.sandbox,n=this._mcpSandboxService.getSandboxConfigSuggestionMessage(e.definition.label,t,o);return n?(this._confirmAndApplySandboxConfigSuggestion(e,t,n),!0):(this._removePotentialSandboxBlocks(t),!1)}_confirmAndApplySandboxConfigSuggestion(e,t,o){let n=e.definition.presentation?.origin?.uri??this.collection.presentation?.origin,r=this._fullDefinitions.get().collection?.configTarget;this._isSandboxSuggestionDialogVisible=!0,this._dialogService.confirm({type:"warning",message:d(13268,null,e.definition.label),detail:o.message,primaryButton:d(13270,null),cancelButton:d(13269,null)}).then(async s=>{if(s.confirmed){if(!n||r===void 0){this._notificationService.warn(d(13267,null,e.definition.label));return}try{await this._mcpSandboxService.applySandboxConfigSuggestion(e.definition,n,r,t,o.sandboxConfig)&&(this._removePotentialSandboxBlocks(t),this._notificationService.info(d(13266,null,e.definition.label)))}catch(l){this._notificationService.error(d(13265,null,e.definition.label,l instanceof Error?l.message:String(l)))}}}).finally(()=>{this._isSandboxSuggestionDialogVisible=!1})}recordPotentialSandboxBlock(e){this._potentialSandboxBlocks.push(e),this._potentialSandboxBlocks.length>200&&this._potentialSandboxBlocks.splice(0,this._potentialSandboxBlocks.length-200);let t=this._connection.get();t?.state.get().state===Sr.Kind.Running&&this.showSandboxConfigSuggestionFromPotentialBlocks(t,this._potentialSandboxBlocks)}_removePotentialSandboxBlocks(e){if(!e.length||!this._potentialSandboxBlocks.length)return;let t=new Set(e);this._potentialSandboxBlocks=this._potentialSandboxBlocks.filter(o=>!t.has(o))}stop(){return this._connection.get()?.stop()||Promise.resolve()}awaitToolRefresh(){return new Promise(e=>{uD(t=>{this._tools.fromServerPromise.read(t)?.promiseResult.read(t)&&e()})})}resetLiveData(){Ki(e=>{this._tools.fromServerPromise.set(void 0,e),this._prompts.fromServerPromise.set(void 0,e)})}async _normalizeTool(e){let t=e._meta?.ui,o=3;t?.visibility&&Array.isArray(t.visibility)&&(o&=0,t.visibility.includes("model")&&(o|=1),t.visibility.includes("app")&&(o|=2));let n={...e,serverToolName:e.name,_icons:this._parseIcons(e),visibility:o,uiResourceUri:t?.resourceUri};n.description||(this._logger.warn(`Tool ${n.name} does not have a description. Tools must be accurately described to be called`),n.description="<empty>"),vEo.test(n.name)&&(this._logger.warn(`Tool ${JSON.stringify(n.name)} is invalid. Tools names may only contain [a-z0-9_-]`),n.name=n.name.replace(vEo,"_")),n.inputSchema&&!n.inputSchema.properties&&(n.inputSchema={...n.inputSchema,properties:{}});let r=[],s=JSON.stringify(n.inputSchema);try{let u=A.parse("https://json-schema.org/draft-07/schema");r=await this._commandService.executeCommand("json.validate",u,s)||[]}catch{}if(!r.length)return n;let l=xM(s);return{error:r.map(u=>{let p=pbi(l,u.range[0].character),h=p&&`/${ubi(p).join("/")}`;return u.message+(h?` (at ${h})`:"")})}}async _getValidatedTools(e){let t="",o=await Promise.all(e.map(r=>this._normalizeTool(r))),n=[];for(let[r,s]of o.entries())if("error"in s){t+=d(13263,null,e[r].name)+`
`;for(let l of s.error)t+=`	- ${l}
`;t+=`	- Schema: ${JSON.stringify(e[r].inputSchema)}

`}else n.push(s);return t&&(this._logger.warn(`${e.length-n.length} tools have invalid JSON schemas and will be omitted`),bpn(this._instantiationService,this.definition.label,t)),n}_parseIcons(e){let t=this._connection.get();return t?fEo(e,t.launchDefinition,this._logger):[]}_setServerTools(e,t,o){let n=t.then(async r=>{this._logger.info(`Discovered ${r.length} tools`);let s=await this._getValidatedTools(r);return this._primitiveCache.store(this.definition.id,{tools:s,nonce:e}),{data:s,nonce:e}});return this._tools.fromServerPromise.set(new Uc(n),o),n}_setServerPrompts(e,t,o){let n=t.then(r=>{let s=r.map(l=>({...l,_icons:this._parseIcons(l)}));return this._primitiveCache.store(this.definition.id,{prompts:s,nonce:e}),{data:s,nonce:e}});return this._prompts.fromServerPromise.set(new Uc(n),o),n}_toStoredMetadata(e,t){return{serverName:e?e.title||e.name:void 0,serverInstructions:t,serverIcons:e?this._parseIcons(e):void 0}}_setServerMetadata(e,{serverInfo:t,instructions:o,capabilities:n},r){let s=this._toStoredMetadata(t,o);this._serverMetadata.fromServerPromise.set(Uc.resolved({nonce:e,data:s}),r);let l=bEo(n);this._capabilities.fromServerPromise.set(Uc.resolved({data:l,nonce:e}),r),this._primitiveCache.store(this.definition.id,{...s,nonce:e,capabilities:l})}_populateLiveData(e,t,o){let n=new qe;o.add(ee(()=>n.dispose(!0)));let r=l=>{let c=e.capabilities.tools?e.listTools({},n.token):Promise.resolve([]);return this._setServerTools(t,c,l)},s=l=>{let c=e.capabilities.prompts?e.listPrompts({},n.token):Promise.resolve([]);return this._setServerPrompts(t,c,l)};o.add(e.onDidChangeToolList(()=>{this._logger.info("Tool list changed, refreshing tools..."),r(void 0)})),o.add(e.onDidChangePromptList(()=>{this._logger.info("Prompts list changed, refreshing prompts..."),s(void 0)})),Ki(l=>{this._setServerMetadata(t,{serverInfo:e.serverInfo,instructions:e.serverInstructions,capabilities:e.capabilities},l),s(l),r(l).then(u=>{this._telemetryService.publicLog2("mcp/serverBoot",{supportsLogging:!!e.capabilities.logging,supportsPrompts:!!e.capabilities.prompts,supportsResources:!!e.capabilities.resources,toolCount:u.data.length,serverName:e.serverInfo.name,serverVersion:e.serverInfo.version})})})}};kb=I([m(7,xc),m(8,Ae),m(9,lt),m(10,Ol),m(11,Tl),m(12,_e),m(13,fe),m(14,F),m(15,ct),m(16,Ne),m(17,Je),m(18,Z3),m(19,LJe),m(20,EWe),m(21,Mt)],kb);var dNi=class{constructor(i,e){this._server=i;this._definition=e;this.id=Syi(this._server.definition.label+"."+e.name),this.name=e.name,this.title=e.title,this.description=e.description,this.arguments=e.arguments||[],this.icons=Jq.fromStored(this._definition._icons)}async resolve(i,e){return(await kb.callOn(this._server,o=>o.getPrompt({name:this._definition.name,arguments:i},e),e)).messages}async complete(i,e,t,o){return(await kb.callOn(this._server,r=>r.complete({ref:{type:"ref/prompt",name:this._definition.name},argument:{name:i,value:e},context:{arguments:t}},o),o)).completion.values}};function bEo(a){let i=0;return a.logging&&(i|=1),a.completions&&(i|=2),a.prompts&&(i|=4,a.prompts.listChanged&&(i|=8)),a.resources&&(i|=16,a.resources.subscribe&&(i|=32),a.resources.listChanged&&(i|=64)),a.tools&&(i|=128,a.tools.listChanged&&(i|=256)),i}var Wst=class{constructor(i,e,t,o){this._server=i;this._definition=t;this._elicitationService=o;this.referenceName=t.name.replaceAll(".","_"),this.id=(e+t.name).replaceAll(".","_").slice(0,64),this.icons=Jq.fromStored(this._definition._icons),this.visibility=t.visibility??3}get definition(){return this._definition}get uiResourceUri(){return this._definition.uiResourceUri}async call(i,e,t){e&&this._server.runningToolCalls.add(e);try{return await this._callWithProgress(i,void 0,e,t)}finally{e&&this._server.runningToolCalls.delete(e)}}async callWithProgress(i,e,t,o){t&&this._server.runningToolCalls.add(t);try{return await this._callWithProgress(i,e,t,o)}finally{t&&this._server.runningToolCalls.delete(t)}}_callWithProgress(i,e,t,o=Ie.None,n=!0){let r=this._definition.serverToolName??this._definition.name,s=e?ht():void 0,l=new O;return kb.callOn(this._server,async c=>{e&&l.add(c.onDidReceiveProgressNotification(f=>{f.params.progressToken===s&&e.report({message:f.params.message,progress:f.params.total!==void 0&&f.params.progress!==void 0?f.params.progress/f.params.total:void 0})}));let u={progressToken:s};t?.chatSessionResource&&(u["vscode.conversationId"]=jp(t.chatSessionResource)),t?.chatRequestId&&(u["vscode.requestId"]=t.chatRequestId),t?.traceparent&&(u.traceparent=t.traceparent,t.tracestate&&(u.tracestate=t.tracestate));let p=this._definition.execution?.taskSupport,g=c.capabilities.tasks?.requests?.tools?.call!==void 0&&(p==="required"||p==="optional");try{let f=await c.callTool({name:r,arguments:i,task:g?{}:void 0,_meta:u},o,e?v=>e.report({message:v}):void 0);return await this._server.awaitToolRefresh(),f}catch(f){if(f instanceof Cee&&f.code===vb.URL_ELICITATION_REQUIRED&&n)return await this._handleElicitationErr(f,t,o),this._callWithProgress(i,e,t,o,!1);let v=this._server.connectionState.get();if(n&&v.state===Sr.Kind.Error&&v.shouldRetry)return this._callWithProgress(i,e,t,o,!1);throw f}finally{l.dispose()}},o)}async _handleElicitationErr(i,e,t){let o=i.data?.elicitations;if(Array.isArray(o)&&o.length>0)for(let n of o){let r=await this._elicitationService.elicit(this._server,e,n,t);try{if(r.value.action!=="accept")throw i;r.kind===1&&await r.wait}finally{r.dispose()}}}compare(i){return this._definition.name.localeCompare(i.definition.name)}};Wst=I([m(3,LJe)],Wst);function bpn(a,i,e){a.invokeFunction(t=>{let o=t.get(Ne),n=t.get(ie);o.notify({severity:ft.Warning,message:d(13261,null,i),actions:{primary:[{class:void 0,enabled:!0,id:"mcpBadSchema.show",tooltip:"",label:d(13262,null),run:()=>{n.openEditor({resource:void 0,contents:e})}}]}})})}var uNi=class{constructor(i,e,t){this.icons=t;this.mcpUri=e.uri,this.title=e.title,this.uri=_C.fromServer(i.definition,e.uri),this.name=e.name,this.description=e.description,this.mimeType=e.mimeType,this.sizeInBytes=e.size}},pNi=class{constructor(i,e,t){this._server=i;this._definition=e;this.icons=t;this.name=e.name,this.description=e.description,this.mimeType=e.mimeType,this.title=e.title,this.template=p$t.parse(e.uriTemplate)}resolveURI(i){let e=this.template.resolve(i);return _C.fromServer(this._server.definition,e)}async complete(i,e,t,o){return(await kb.callOn(this._server,r=>r.complete({ref:{type:"ref/resource",uri:this._definition.uriTemplate},argument:{name:i,value:e},context:{arguments:Uwe(t,s=>Array.isArray(s)?s.join("/"):s)}},o),o)).completion.values}};var DWe=class extends k{constructor(e,t,o){super();this._uiData=e;this._mcpService=t;let n=vi(o.onDidColorThemeChange,()=>{let r=o.getColorTheme().type;return r==="dark"||r==="hcDark"?"dark":"light"});this.hostContext=ke(r=>({theme:n.read(r),styles:{variables:{"--color-background-primary":"var(--vscode-editor-background)","--color-background-secondary":"var(--vscode-sideBar-background)","--color-background-tertiary":"var(--vscode-activityBar-background)","--color-background-inverse":"var(--vscode-editor-foreground)","--color-background-ghost":"transparent","--color-background-info":"var(--vscode-inputValidation-infoBackground)","--color-background-danger":"var(--vscode-inputValidation-errorBackground)","--color-background-success":"var(--vscode-diffEditor-insertedTextBackground)","--color-background-warning":"var(--vscode-inputValidation-warningBackground)","--color-background-disabled":"var(--vscode-editor-inactiveSelectionBackground)","--color-text-primary":"var(--vscode-foreground)","--color-text-secondary":"var(--vscode-descriptionForeground)","--color-text-tertiary":"var(--vscode-disabledForeground)","--color-text-inverse":"var(--vscode-editor-background)","--color-text-info":"var(--vscode-textLink-foreground)","--color-text-danger":"var(--vscode-errorForeground)","--color-text-success":"var(--vscode-testing-iconPassed)","--color-text-warning":"var(--vscode-editorWarning-foreground)","--color-text-disabled":"var(--vscode-disabledForeground)","--color-text-ghost":"var(--vscode-descriptionForeground)","--color-border-primary":"var(--vscode-widget-border)","--color-border-secondary":"var(--vscode-editorWidget-border)","--color-border-tertiary":"var(--vscode-panel-border)","--color-border-inverse":"var(--vscode-foreground)","--color-border-ghost":"transparent","--color-border-info":"var(--vscode-inputValidation-infoBorder)","--color-border-danger":"var(--vscode-inputValidation-errorBorder)","--color-border-success":"var(--vscode-testing-iconPassed)","--color-border-warning":"var(--vscode-inputValidation-warningBorder)","--color-border-disabled":"var(--vscode-disabledForeground)","--color-ring-primary":"var(--vscode-focusBorder)","--color-ring-secondary":"var(--vscode-focusBorder)","--color-ring-inverse":"var(--vscode-focusBorder)","--color-ring-info":"var(--vscode-inputValidation-infoBorder)","--color-ring-danger":"var(--vscode-inputValidation-errorBorder)","--color-ring-success":"var(--vscode-testing-iconPassed)","--color-ring-warning":"var(--vscode-inputValidation-warningBorder)","--font-sans":"var(--vscode-font-family)","--font-mono":"var(--vscode-editor-font-family)","--font-weight-normal":"normal","--font-weight-medium":"500","--font-weight-semibold":"600","--font-weight-bold":"bold","--font-text-xs-size":"10px","--font-text-sm-size":"11px","--font-text-md-size":"13px","--font-text-lg-size":"14px","--font-heading-xs-size":"16px","--font-heading-sm-size":"18px","--font-heading-md-size":"20px","--font-heading-lg-size":"24px","--font-heading-xl-size":"32px","--font-heading-2xl-size":"40px","--font-heading-3xl-size":"48px","--border-radius-xs":"2px","--border-radius-sm":"3px","--border-radius-md":"4px","--border-radius-lg":"6px","--border-radius-xl":"8px","--border-radius-full":"9999px","--border-width-regular":"1px","--font-text-xs-line-height":"1.5","--font-text-sm-line-height":"1.5","--font-text-md-line-height":"1.5","--font-text-lg-line-height":"1.5","--font-heading-xs-line-height":"1.25","--font-heading-sm-line-height":"1.25","--font-heading-md-line-height":"1.25","--font-heading-lg-line-height":"1.25","--font-heading-xl-line-height":"1.25","--font-heading-2xl-line-height":"1.25","--font-heading-3xl-line-height":"1.25","--shadow-hairline":"0 0 0 1px var(--vscode-widget-shadow)","--shadow-sm":"0 1px 2px 0 var(--vscode-widget-shadow)","--shadow-md":"0 4px 6px -1px var(--vscode-widget-shadow)","--shadow-lg":"0 10px 15px -3px var(--vscode-widget-shadow)"}},displayMode:"inline",availableDisplayModes:["inline"],locale:Kye,platform:Ft?"web":zye?"mobile":"desktop",deviceCapabilities:{touch:ds.isTouchDevice(),hover:ds.isHoverDevice()}}))}get uiData(){return this._uiData}async log(e){let t=await this._getServer(Ie.None);t&&iqt(t.logger,e,"[App UI]")}async _getServer(e){return ixo(this._mcpService,t=>t.definition.id===this._uiData.serverDefinitionId&&t.collection.id===this._uiData.collectionId,e)}async loadResource(e){let t=await this._getServer(e);if(!t)throw new Error("MCP server not found for UI resource");let o=await kb.callOn(t,c=>c.readResource({uri:this._uiData.resourceUri},e),e);if(!o.contents||o.contents.length===0)throw new Error("UI resource not found on server");let n=o.contents[0],r,s=n.mimeType||"text/html";if(yo(n,{text:!0}))r=n.text;else if(yo(n,{blob:!0}))r=Ws(n.blob).toString();else throw new Error("UI resource has no content");return{...n._meta?.ui,html:r,mimeType:s}}async callTool(e,t,o){let n=await this._getServer(o);if(!n)throw new Error("MCP server not found for tool call");await cV(n,void 0,o);let r=n.tools.get().find(l=>l.definition.name===e);if(!r||!(r.visibility&2))throw new Error(`Tool not found on server: ${e}`);let s=await r.call(t,void 0,o);return{content:s.content,isError:s.isError,_meta:s._meta,structuredContent:s.structuredContent}}async readResource(e,t){let o=await this._getServer(t);if(!o)throw new Error("MCP server not found");return await kb.callOn(o,n=>n.readResource({uri:e},t),t)}};DWe=I([m(1,Vs),m(2,Pe)],DWe);var m$t;(S=>(S.LATEST_PROTOCOL_VERSION="2026-01-26",S.OPEN_LINK_METHOD="ui/open-link",S.MESSAGE_METHOD="ui/message",S.SANDBOX_PROXY_READY_METHOD="ui/notifications/sandbox-proxy-ready",S.SANDBOX_RESOURCE_READY_METHOD="ui/notifications/sandbox-resource-ready",S.SIZE_CHANGED_METHOD="ui/notifications/size-changed",S.TOOL_INPUT_METHOD="ui/notifications/tool-input",S.TOOL_INPUT_PARTIAL_METHOD="ui/notifications/tool-input-partial",S.TOOL_RESULT_METHOD="ui/notifications/tool-result",S.TOOL_CANCELLED_METHOD="ui/notifications/tool-cancelled",S.HOST_CONTEXT_CHANGED_METHOD="ui/notifications/host-context-changed",S.RESOURCE_TEARDOWN_METHOD="ui/resource-teardown",S.INITIALIZE_METHOD="ui/initialize",S.INITIALIZED_METHOD="ui/notifications/initialized",S.REQUEST_DISPLAY_MODE_METHOD="ui/request-display-mode",S.UPDATE_MODEL_CONTEXT_METHOD="ui/update-model-context",S.DOWNLOAD_FILE_METHOD="ui/download-file"))(m$t||={});var Spn="chatMcpApp.origins",E6=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.toolInvocation=e;this.renderData=t;this._container=o;this._instantiationService=s;this._chatWidgetService=l;this._webviewService=c;this._chatResponseResourceFsProvider=p;this._logService=h;this._productService=g;this._openerService=f;this._disposeCts=this._register(new qe);this._announcedCapabilities=!1;this._latestCsp=void 0;this._loadState=De(this,{status:"loading"});this.loadState=this._loadState;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this._downloadParts=De(this,[]);this.downloadParts=this._downloadParts;this._originStore=new N3(Spn,u),this._webviewOrigin=this._originStore.getOrigin("mcpApp",t.serverDefinitionId),this._mcpToolCallUI=this._register(this._instantiationService.createInstance(DWe,t)),this._height=E6.heightCache.get(this.toolInvocation)??300,this._webview=this._register(this._webviewService.createWebviewElement({origin:this._webviewOrigin,title:d(8940,null),options:{purpose:"chatOutputItem",enableFindWidget:!1,disableServiceWorker:!0,retainContextWhenHidden:!0},contentOptions:{allowMultipleAPIAcquire:!0,allowScripts:!0,allowForms:!0},extension:void 0}));let v=Me(this._container);this._webview.mountTo(this._container,v),this.hostContext=this._mcpToolCallUI.hostContext.map((b,S)=>({...b,containerDimensions:{width:r.read(S),maxHeight:n.read(S)},toolCall:{toolCallId:this.toolInvocation.toolCallId,toolName:this.toolInvocation.toolId}})),this._register(ve(b=>{let S=this.hostContext.read(b);this._announcedCapabilities&&this._sendNotification({method:"ui/notifications/host-context-changed",params:S})})),this._register(this._webview.onMessage(async({message:b})=>{await this._handleWebviewMessage(b)})),this._loadContent()}static{this.heightCache=new WeakMap}get height(){return this._height}remount(){this._webview.reinitializeAfterDismount(),this._announcedCapabilities=!1}retry(){this._loadState.set({status:"loading"},void 0),this._loadContent()}async _loadContent(){let e=this._disposeCts.token;try{let t=await this._mcpToolCallUI.loadResource(e);if(e.isCancellationRequested)return;let o=this._injectPreamble(t);this._announcedCapabilities=!1,this._latestCsp=t.csp,this._webview.setHtml(o),this._loadState.set({status:"loaded"},void 0)}catch(t){this._logService.error("[MCP App] Error loading app:",t),this._loadState.set({status:"error",error:t},void 0)}}_injectPreamble({html:e,csp:t}){let o=l=>(l?.join(" ")||"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),r=`<meta http-equiv="Content-Security-Policy" content="${`
			default-src 'none';
			script-src 'self' 'unsafe-inline' ${o(t?.resourceDomains)};
			style-src 'self' 'unsafe-inline' ${o(t?.resourceDomains)};
			connect-src 'self' ${o(t?.connectDomains)};
			img-src 'self' data: ${o(t?.resourceDomains)};
			font-src 'self' ${o(t?.resourceDomains)};
			media-src 'self' data: ${o(t?.resourceDomains)};
			frame-src ${o(t?.frameDomains)||"'none'"};
			object-src 'none';
			base-uri ${o(t?.baseUriDomains)||"'self'"};
		`}">`;return this._prependToHead(e,r+`
			<script>(() => {
				const api = acquireVsCodeApi();
				const setMessageSource = (obj, src) => new Proxy(obj, {
					get: (target, prop) => {
						if (prop === 'source')  {
							return src;
						}
						return target[prop];
					}
				});

				const wrappedFns = new WeakMap();

				let patchedPostMessage = (message, transfer) => api.postMessage(message, transfer);
				const wrap = target => new Proxy(target, {
					set: (obj, prop, value) => {
						if (prop === 'postMessage') {
							patchedPostMessage = (message, transfer) => value.call(target, message, transfer);
						} else {
							obj[prop] = value;
						}
						return true;
					},
					get: (obj, prop) => {
						if (prop === 'postMessage') {
							return patchedPostMessage;
						}
						return obj[prop];
					},
				});

				const originalAddEventListener = window.addEventListener.bind(window);
				window.addEventListener = (type, listener, options) => {
					if (type === 'message') {
						const originalListener = listener;
						const wrappedListener = (event) => {
							if (event.origin === document.location.origin && event.source !== window) { event = setMessageSource(event, window.parent); }
							originalListener(event);
						};
						wrappedFns.set(originalListener, wrappedListener);
						listener = wrappedListener;
					}

					return originalAddEventListener(type, listener, options);
				};

				const originalRemoveEventListener = window.removeEventListener.bind(window);
				window.removeEventListener = (type, listener, options) => {
					const wrappedListener = wrappedFns.get(listener) || listener;
					return originalRemoveEventListener(type, wrappedListener, options);
				};

				window.parent = wrap(window.parent);

				// Scroll boundary detection: bubble wheel events to parent when at scroll boundaries
				const shouldBubbleScroll = (event) => {
					// First check element-level scrolling (for elements with overflow: auto/scroll)
					for (let node = event.target; node; node = node.parentNode) {
						if (!(node instanceof Element)) {
							continue;
						}

						// Skip HTML and BODY - we check document-level scroll separately
						if (node === document.documentElement || node === document.body) {
							continue;
						}

						// Check if the element can actually scroll
						const overflow = window.getComputedStyle(node).overflowY;
						if (overflow === 'hidden' || overflow === 'visible') {
							continue;
						}

						// Scroll up: if there's content above (scrollTop > 0), don't bubble
						if (event.deltaY < 0 && node.scrollTop > 0) {
							return false;
						}

						// Scroll down: if there's content below, don't bubble
						if (event.deltaY > 0 && node.scrollTop + node.clientHeight < node.scrollHeight) {
							// Account for rounding: scrollTop isn't rounded but scrollHeight/clientHeight are
							if (node.scrollHeight - node.scrollTop - node.clientHeight < 2) {
								continue;
							}
							return false;
						}
					}

					// Check document-level scrolling (works even with overflow: visible on html/body)
					const docEl = document.documentElement;
					const scrollTop = window.scrollY || docEl.scrollTop || document.body.scrollTop || 0;
					const scrollHeight = Math.max(docEl.scrollHeight, document.body.scrollHeight);
					const clientHeight = docEl.clientHeight;
					const scrollableDistance = scrollHeight - clientHeight;

					if (scrollableDistance > 2) {
						// Document is scrollable
						if (event.deltaY < 0 && scrollTop > 0) {
							return false;
						}
						if (event.deltaY > 0 && scrollTop < scrollableDistance - 2) {
							return false;
						}
					}

					return true;
				};

				window.addEventListener('wheel', (event) => {
					if (event.defaultPrevented || !shouldBubbleScroll(event)) {
						return;
					}
					api.postMessage({
						method: 'ui/notifications/sandbox-wheel',
						params: {
							deltaMode: event.deltaMode,
							deltaX: event.deltaX,
							deltaY: event.deltaY,
							deltaZ: event.deltaZ,
						}
					});
				}, { passive: true });
			})();</script>
		`)}_prependToHead(e,t){let o=e.match(/<head[^>]*>/i);if(o){let r=o.index+o[0].length;return e.slice(0,r)+`
`+t+e.slice(r)}let n=e.match(/<html[^>]*>/i);if(n){let r=n.index+n[0].length;return e.slice(0,r)+`
<head>`+t+"</head>"+e.slice(r)}return`<!DOCTYPE html><html><head>${t}</head><body>${e}</body></html>`}async _handleWebviewMessage(e){let t=e,o=this._disposeCts.token;try{let n={};switch(t.method){case"ui/initialize":n=await this._handleInitialize(t.params);break;case"tools/call":n=await this._handleToolsCall(t.params,o);break;case"resources/read":n=await this._handleResourcesRead(t.params,o);break;case"ping":break;case"ui/notifications/size-changed":this._handleSizeChanged(t.params);break;case"ui/open-link":n=await this._handleOpenLink(t.params);break;case"ui/download-file":n=await this._handleDownloadFile(t.params);break;case"ui/request-display-mode":n={mode:"inline"};break;case"ui/notifications/initialized":break;case"ui/message":n=await this._handleUiMessage(t.params);break;case"ui/update-model-context":n=await this._handleUpdateModelContext(t.params);break;case"notifications/message":await this._mcpToolCallUI.log(t.params);break;case"ui/notifications/sandbox-wheel":this._handleSandboxWheel(t.params);break;default:{let r=t;r.id!==void 0&&await this._sendError(r.id,-32601,`Method not found: ${r.method}`);return}}yo(t,{id:!0})&&await this._sendResponse(t.id,n)}catch(n){if(this._logService.error(`[MCP App] Error handling ${t.method}:`,n),yo(t,{id:!0})){let r=n instanceof Error?n.message:String(n);await this._sendError(t.id,-32e3,r)}}}async _handleInitialize(e){this._announcedCapabilities=!0;let t;try{t=JSON.parse(this.renderData.input)}catch{t=this.renderData.input}let o=this._register(Zo(async()=>{if(this._store.delete(o),await this._sendNotification({method:"ui/notifications/tool-input",params:{arguments:t}}),this.toolInvocation.kind==="toolInvocationSerialized")this._sendToolResult(this.toolInvocation.resultDetails);else if(this.toolInvocation.kind==="toolInvocation"){let n=this.toolInvocation;this._register(uD(r=>{let s=n.state.read(r);s.type===pi.StateKind.Completed&&(this._sendToolResult(s.resultDetails),r.dispose())}))}}));return{protocolVersion:m$t.LATEST_PROTOCOL_VERSION,hostInfo:{name:this._productService.nameLong,version:this._productService.version},hostCapabilities:{openLinks:{},serverTools:{listChanged:!0},serverResources:{listChanged:!0},logging:{},sandbox:{csp:this._latestCsp,permissions:{clipboardWrite:{}}},updateModelContext:{audio:{},image:{},resourceLink:{},resource:{},structuredContent:{}},downloadFile:{}},hostContext:this.hostContext.get()}}_sendToolResult(e){oR(e)&&e.mcpOutput&&this._sendNotification({method:"ui/notifications/tool-result",params:e.mcpOutput})}async _handleUiMessage(e){let t=this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource);return t?_c(t.getInput())?(t.setInput(e.content.filter(o=>o.type==="text").map(o=>o.text).join(`

`)),t.attachmentModel.clearAndSetContext(...e.content.map((o,n)=>{let r=`mcpui-${n}-${Date.now()}`;if(o.type==="image")return{kind:"image",value:Ws(o.data).buffer,id:r,name:"Image"};if(o.type==="resource_link"){let s=_C.fromServer({id:this.renderData.serverDefinitionId,label:""},o.uri);return{kind:"file",value:s,id:r,name:Be(s)}}else return}).filter(so)),t.focusInput(),{isError:!1}):{isError:!0}:{isError:!0}}async _handleUpdateModelContext(e){let t=this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource);if(!t)return{};let o=`mcpui-context-${Lr(this.renderData.serverDefinitionId)}-`,n=t.attachmentModel.getAttachmentIDs(),r=Array.from(n).filter(c=>c.startsWith(o)),s=[],l=0;if(e.content)for(let c of e.content){let u=`${o}${l++}`;if(c.type==="image")s.push({kind:"image",value:Ws(c.data).buffer,id:u,name:"Image",mimeType:c.mimeType});else if(c.type==="resource_link"){let p=_C.fromServer({id:this.renderData.serverDefinitionId,label:""},c.uri);s.push({kind:"file",value:p,id:u,name:Be(p)})}else if(c.type==="text"){let p=c.text.replaceAll(/\s+/g," ").trim(),h=20;s.push({kind:"generic",value:c.text,id:u,tooltip:new he().appendCodeblock("plaintext",c.text),name:p.length>h?p.slice(0,h)+"\u2026":p})}}if(e.structuredContent&&Object.keys(e.structuredContent).length>0){let c=`${o}structured`,u=JSON.stringify(e.structuredContent,null,2);s.push({kind:"generic",value:u,tooltip:new he().appendCodeblock("json",u),id:c,name:"UI Data"})}return t.attachmentModel.updateContext(r,s),{}}_handleSizeChanged(e){e.height!==void 0&&e.height!==this._height&&(this._height=e.height,E6.heightCache.set(this.toolInvocation,e.height),this._onDidChangeHeight.fire())}_handleSandboxWheel(e){let t=!1,o={wheelDeltaX:e.deltaX,wheelDeltaY:-e.deltaY,wheelDelta:Math.abs(e.deltaY),deltaX:e.deltaX,deltaY:-e.deltaY,deltaZ:e.deltaZ,deltaMode:e.deltaMode,preventDefault:()=>{t=!0},stopPropagation:()=>{},get defaultPrevented(){return t}};this._chatWidgetService.getWidgetBySessionResource(this.renderData.sessionResource)?.delegateScrollFromMouseWheelEvent(o)}async _handleDownloadFile(e){let t=[],o=!1;for(let n of e.contents)try{if(n.type==="resource"){let r=n.resource,s=A.parse(r.uri),l=yo(r,{text:!0})?new TextEncoder().encode(r.text):{base64:r.blob},c=this._chatResponseResourceFsProvider.associate(this.renderData.sessionResource,l,Be(s));t.push({kind:"data",mimeType:r.mimeType,uri:c})}else if(n.type==="resource_link"){let r=_C.fromServer({id:this.renderData.serverDefinitionId,label:""},n.uri);t.push({kind:"data",mimeType:n.mimeType,uri:r})}}catch(r){o=!0,this._logService.warn("[MCP App] Failed to process ui/download-file content",r)}if(t.length>0){let n=this._downloadParts.get();this._downloadParts.set([...n,...t],void 0)}return o?{isError:!0}:{}}async _handleOpenLink(e){return{isError:!await this._openerService.open(e.url)}}async _handleToolsCall(e,t){if(!e?.name)throw new Error("Missing tool name in tools/call request");return this._mcpToolCallUI.callTool(e.name,e.arguments||{},t)}async _handleResourcesRead(e,t){if(!e?.uri)throw new Error("Missing uri in resources/read request");return this._mcpToolCallUI.readResource(e.uri,t)}async _sendResponse(e,t){await this._webview.postMessage({jsonrpc:"2.0",id:e,result:t})}async _sendError(e,t,o){await this._webview.postMessage({jsonrpc:"2.0",id:e,error:{code:t,message:o}})}async _sendNotification(e){await this._webview.postMessage({jsonrpc:"2.0",...e})}dispose(){this._disposeCts.dispose(!0),super.dispose()}};E6=I([m(5,F),m(6,Lt),m(7,Pu),m(8,de),m(9,Fst),m(10,re),m(11,Ze),m(12,Je)],E6);var SEo=.75,RWe=class extends xb{constructor(e,t,o,n,r,s){super(e);this._renderData=n;this._instantiationService=r;this._markdownRendererService=s;this.codeblocks=[];this._progressPart=this._register(new ue);this._downloadWidget=this._register(new ue);this.domNode=_("div.mcp-app-part"),this._webviewContainer=_("div.mcp-app-webview"),this._webviewContainer.style.maxHeight=`${SEo*100}vh`,this._webviewContainer.style.minHeight="100px",this._webviewContainer.style.height="300px",this.domNode.appendChild(this._webviewContainer),this._downloadContainer=_("div.mcp-app-downloads"),this.domNode.appendChild(this._downloadContainer);let l=Me(this.domNode),c=()=>SEo*l.innerHeight,u=De("mcpAppMaxHeight",c());$(l,"resize",()=>u.set(c(),void 0)),this._model=this._register(this._instantiationService.createInstance(E6,e,this._renderData,this._webviewContainer,u,o.currentWidth)),this._updateContainerHeight(),this._register(ve(p=>{let h=this._model.loadState.read(p);this._handleLoadStateChange(this._webviewContainer,h)})),this._register(this._model.onDidChangeHeight(()=>{this._updateContainerHeight()})),this._register(ve(p=>{let h=this._model.downloadParts.read(p);if(h.length===0){this._downloadWidget.clear(),St(this._downloadContainer);return}St(this._downloadContainer);let g=this._instantiationService.createInstance(hV,h);this._downloadWidget.value=g,this._downloadContainer.appendChild(g.domNode)})),this._register(t(()=>{this._model.remount()})),this._register(o.onDidChangeVisibility(p=>{p&&this._model.remount()}))}_handleLoadStateChange(e,t){switch(this._progressPart.value&&this._progressPart.value.domNode.remove(),this._progressPart.clear(),this._errorNode&&(this._errorNode.remove(),this._errorNode=void 0),t.status){case"loading":{e.style.display="none";let o=_("span");o.textContent=d(8941,null);let n=this._instantiationService.createInstance(VE,o,q.modify(L.loading,"spin"),void 0);this._progressPart.value=n,this.domNode.appendChild(n.domNode);break}case"loaded":{e.style.display="";break}case"error":{e.style.display="none",this._showError(this.domNode,t.error);break}}}_updateContainerHeight(){this._webviewContainer.style.height=`${this._model.height}px`}_showError(e,t){let o=_(".mcp-app-error"),n=new he;n.appendText(d(8942,null,t.message||String(t)));let r=this._register(new pve(2,n,this._markdownRendererService));o.appendChild(r.domNode);let s=D(o,_(".chat-buttons-container")),l=this._register(new Pi(s,Ro));l.label=d(8943,null),this._register(l.onDidClick(()=>{this._model.retry()})),e.appendChild(o),this._errorNode=o}};RWe=I([m(4,F),m(5,_n)],RWe);var vve=class extends xb{constructor(e,t,o,n,r,s){super(e);this.codeblocks=[];let l=this._register(s.createInstance(I6,n.map(c=>({kind:"reference",reference:c})),o,t,r,ene(e)));l.icon=L.check,this.domNode=l.domNode}};vve=I([m(5,F)],vve);var T6=class extends xb{static{this._expandedByDefault=new WeakMap}get codeblocks(){return this.collapsibleListPart.codeblocks}constructor(i,e,t,o,n,r,s,l,c,u,p){super(i);let h=t,g=(w,x)=>({kind:"code",data:w,languageId:"plaintext",codeBlockIndex:h++,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on"}}}),f=g(r.input,"Input"),v=r.output?[g(r.output,"Output")]:void 0,b=this.collapsibleListPart=this._register(l.createInstance(pne,o,n,this.getAutoApprovalMessageContent(),e,f,v?{parts:v}:void 0,s,s&&p.getValue("chat.tools.autoExpandFailures")||(T6._expandedByDefault.get(i)??!1),r0e(i)));this._register(ee(()=>T6._expandedByDefault.set(i,b.expanded)));let S=i.kind==="toolInvocation"?i.state.map((w,x)=>w.type===pi.StateKind.Executing?w.progress.read(x):void 0):void 0,y=new uo(()=>this._register(new Cv(b.domNode)));S&&this._register(ve(w=>{let x=S?.read(w);x?.message&&(b.title=x.message),x?.progress&&!pi.isComplete(i,w)&&y.value.setWorked(x.progress*100)})),this.domNode=b.domNode}getAutoApprovalMessageContent(){return ene(this.toolInvocation)}};T6=I([m(7,F),m(8,_t),m(9,Rt),m(10,B)],T6);var bV=class extends xb{constructor(e,t,o,n,r,s,l){super(e);this.toolInvocation=e;this.context=t;this.instantiationService=o;this.keybindingService=n;this.contextKeyService=r;this.chatWidgetService=s;this.languageModelToolsService=l;if(e.kind!=="toolInvocation")throw new Error("Confirmation only works with live tool invocations")}render(e){let{keybindingService:t,languageModelToolsService:o,toolInvocation:n}=this,r=n.state.get(),s=r.type===pi.StateKind.WaitingForConfirmation?r.confirmationMessages?.customOptions:void 0,l;if(s&&s.length>0)l=this.buildCustomOptionButtons(n,s);else{let g=t.appendKeybinding(e.allowLabel,e.allowActionId),f=t.appendKeybinding(e.skipLabel,e.skipActionId),v=this.additionalPrimaryActions(),b=this.useAllowOnceAsPrimary()?void 0:v.find(x=>"scope"in x&&x.scope==="session"),S={label:e.allowLabel,tooltip:g,data:()=>{this.confirmWith(n,{type:4})}},y=b??S,w=b?[S,...v.filter(x=>x!==b)]:v;l=[{label:y.label,tooltip:y.tooltip,data:y.data,moreActions:w.length>0?w:void 0},{label:d(8935,null),tooltip:f,data:()=>{this.confirmWith(n,{type:5})},isSecondary:!0}]}let c=this.createContentElement(),u=o.getTool(n.toolId),p=this._register(this.instantiationService.createInstance(Gq,this.context,{title:this.getTitle(),icon:u?.icon&&"id"in u.icon?u.icon:L.tools,subtitle:e.subtitle,buttons:l,message:c,toolbarData:{arg:n,partType:e.partType,partSource:n.source.type}})),h=Z.Editing.hasToolConfirmation.bindTo(this.contextKeyService);h.set(!0),this._register(p.onDidClick(({button:g,isTouchClick:f})=>{g.data(),f||this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput()})),this._register(ee(()=>h.reset())),this.domNode=p.domNode}confirmWith(e,t){pi.confirmWith(e,t)}buildCustomOptionButtons(e,t){let o=[],n=[];for(let c of t)(c.kind==="deny"?n:o).push(c);let r=c=>({label:c.label,data:()=>{this.confirmWith(e,{type:4,selectedButton:c.id,selectedButtonKind:c.kind})}}),s=(c,u)=>{let[p,...h]=c,g={...r(p),isSecondary:u};if(h.length>0){let f=[],v=p.group;for(let b of h)b.group!==v&&f.push(new oi),f.push(r(b)),v=b.group;g.moreActions=f}return g},l=[];return o.length>0&&l.push(s(o,!1)),n.length>0&&l.push(s(n,o.length>0)),l}additionalPrimaryActions(){return[]}useAllowOnceAsPrimary(){return!1}};bV=I([m(2,F),m(3,Le),m(4,X),m(5,Lt),m(6,Wn)],bV);var bve=class extends bV{constructor(e,t,o,n,r,s,l,c,u){super(e,o,r,s,l,c,u);this.renderer=n;this.codeblocks=[];this.render({allowActionId:n1,skipActionId:$fe,allowLabel:d(8945,null),skipLabel:d(8944,null),partType:"chatMissingSandboxDepsConfirmation"})}createContentElement(){let e=this.toolInvocation.state.get(),t=e.type===pi.StateKind.WaitingForConfirmation?e.confirmationMessages?.message:void 0,o=_(".chat-missing-sandbox-deps-confirmation");if(t){let n=typeof t=="string"?new he(t):t,r=this.renderer.render(n);this._register(r),o.appendChild(r.element)}return o}getTitle(){let e=this.toolInvocation.state.get();return e.type===pi.StateKind.WaitingForConfirmation&&e.confirmationMessages?.title?typeof e.confirmationMessages.title=="string"?e.confirmationMessages.title:e.confirmationMessages.title.value:""}};bve=I([m(4,F),m(5,Le),m(6,X),m(7,Lt),m(8,Wn)],bve);var Sve=class extends bV{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,n,r,s,l,c);this.listPool=o;this.markdownRendererService=u;this.editorService=p;this.commandService=h;this.codeblocks=[];let g=e.state.get();if(g.type!==pi.StateKind.WaitingForConfirmation||!g.confirmationMessages?.title)throw new Error("Modified files confirmation messages are missing");let f=e.toolSpecificData;if(!f||f.kind!=="modifiedFilesConfirmation")throw new Error("Modified files confirmation data is missing");let v=c.getTool(e.toolId),b=this._register(this.instantiationService.createInstance(Gq,this.context,{title:this.getTitle(),icon:v?.icon&&yo(v.icon,{id:!0})?v.icon:L.tools,subtitle:typeof e.originMessage=="string"?e.originMessage:e.originMessage?.value,buttons:this.createButtons(f.options),message:this.createWidgetContentElement(g.confirmationMessages.message,f)})),S=Z.Editing.hasToolConfirmation.bindTo(this.contextKeyService);S.set(!0),this._register(b.onDidClick(({button:y,isTouchClick:w})=>{y.data(),w||this.chatWidgetService.getWidgetBySessionResource(this.context.element.sessionResource)?.focusInput()})),this._register(ee(()=>S.reset())),this.domNode=b.domNode}createButtons(e){let[t,...o]=e;return[{label:t,data:()=>this.confirmWith(this.toolInvocation,{type:4,selectedButton:t}),moreActions:o.map(n=>({label:n,data:()=>this.confirmWith(this.toolInvocation,{type:4,selectedButton:n})}))}]}createWidgetContentElement(e,t){let o=_(".chat-modified-files-confirmation");if(e){let n=this._register(this.markdownRendererService.render(typeof e=="string"?new he(e):e));o.append(n.element)}return o.append(this.createModifiedFilesElement(t)),o}createModifiedFilesElement(e){let t=_(".chat-modified-files-confirmation-list.chat-editing-session-container.show-file-icons"),o=D(t,_(".chat-editing-session-overview")),n=D(o,_(".working-set-title")),r=this._register(new lM(n,{buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,supportIcons:!0})),s=D(o,_(".chat-editing-session-actions")),l=_(".working-set-line-counts"),c=D(l,_(".working-set-lines-added")),u=D(l,_(".working-set-lines-removed"));r.element.appendChild(l);let p=e.modifiedFiles.length===1?d(8950,null):d(8946,null,e.modifiedFiles.length);r.label=p;let h=0,g=0,f=!1;for(let K of e.modifiedFiles)(typeof K.insertions=="number"||typeof K.deletions=="number")&&(f=!0,h+=K.insertions??0,g+=K.deletions??0);f?(c.textContent=`+${h}`,u.textContent=`-${g}`,r.element.setAttribute("aria-label",d(8949,null,p,h,g)),l.setAttribute("aria-label",d(8948,null,h,g))):(l.remove(),r.element.setAttribute("aria-label",p));let v=this._register(new Pi(s,{...Ro,secondary:!0,small:!0,supportIcons:!0,ariaLabel:d(8951,null),title:d(8951,null)}));v.element.classList.add("default-colors"),v.icon=L.diffMultiple,v.label=" ",this._register(v.onDidClick(async()=>{await this.openAllChanges(e)}));let S=this._register(this.listPool.get()).object,y=e.modifiedFiles.map(K=>{let j=A.revive(K.uri),J=K.originalUri?A.revive(K.originalUri):void 0,se=K.modifiedContentUri?A.revive(K.modifiedContentUri):void 0,ae=K.originalContentUri?A.revive(K.originalContentUri):void 0;return{kind:"reference",reference:j,title:K.title,description:K.description,state:1,showModifiedState:!0,options:{diffMeta:typeof K.insertions=="number"||typeof K.deletions=="number"?{added:K.insertions??0,removed:K.deletions??0}:void 0,originalUri:ae??J,modifiedUri:se,status:void 0}}});this._register(S.onDidOpen(async K=>{if(K.element?.kind!=="reference"||!A.isUri(K.element.reference))return;let j=K.element.options,J=j?.modifiedUri??K.element.reference,se=j?.originalUri;if(se){await this.editorService.openEditor({original:{resource:se},modified:{resource:J},options:K.editorOptions});return}await this.editorService.openEditor({resource:J,options:K.editorOptions})}));let E=Math.min(y.length,6)*22,M=D(t,_(".chat-editing-session-list.collapsed"));S.layout(E),S.getHTMLElement().style.height=`${E}px`,S.splice(0,S.length,y),M.append(S.getHTMLElement());let N=!0,V=()=>{r.icon=N?L.chevronRight:L.chevronDown,M.classList.toggle("collapsed",N)};V();let H=()=>{N=!N,V()};return this._register(r.onDidClick(H)),this._register($(o,"click",K=>{K.defaultPrevented||K.target.closest(".monaco-button")||H()})),t}async openAllChanges(e){await this.commandService.executeCommand("_workbench.openMultiDiffEditor",{title:d(8947,null),resources:e.modifiedFiles.map(t=>({originalUri:t.originalContentUri?A.revive(t.originalContentUri):t.originalUri?A.revive(t.originalUri):void 0,modifiedUri:t.modifiedContentUri?A.revive(t.modifiedContentUri):A.revive(t.uri)}))})}createContentElement(){throw new Error("Not used")}getTitle(){let e=this.toolInvocation.state.get();if(e.type!==pi.StateKind.WaitingForConfirmation)return"";let t=e.confirmationMessages?.title;return typeof t=="string"?t:t?.value??""}};Sve=I([m(3,F),m(4,Le),m(5,X),m(6,Lt),m(7,Wn),m(8,_n),m(9,ie),m(10,fe)],Sve);var Vst=class extends k{constructor(e){super();this._options=e;this._commandFinished=!1;this._receivedData=!1;this._onDidRequestExpand=this._register(new T);this.onDidRequestExpand=this._onDidRequestExpand.event;this._setupListeners()}_setupListeners(){let e=this._register(new O);e.add(this._options.onCommandExecuted(()=>{this._options.shouldAutoExpand()&&!this._noDataTimeout&&(this._noDataTimeout=Zo(()=>{this._noDataTimeout=void 0;let t=this._options.shouldAutoExpand(),o=this._options.hasRealOutput();t&&o&&(this._dataEventTimeout?.dispose(),this._dataEventTimeout=void 0,this._onDidRequestExpand.fire())},500,e))})),e.add(this._options.onWillData(()=>{this._receivedData||(this._receivedData=!0,this._options.shouldAutoExpand()&&!this._dataEventTimeout&&(this._dataEventTimeout=Zo(()=>{this._dataEventTimeout=void 0;let t=this._options.shouldAutoExpand(),o=this._options.hasRealOutput();!this._commandFinished&&t&&o&&(this._noDataTimeout?.dispose(),this._noDataTimeout=void 0,this._onDidRequestExpand.fire())},50,e)))})),e.add(this._options.onCommandFinished(()=>{this._commandFinished=!0,this._clearAutoExpandTimeouts()}))}_clearAutoExpandTimeouts(){this._dataEventTimeout?.dispose(),this._dataEventTimeout=void 0,this._noDataTimeout?.dispose(),this._noDataTimeout=void 0}};var hNi=Oe("terminal-view-icon",L.terminal,d(16004,null)),IEo=Oe("terminal-rename",L.edit,d(15995,null)),h$t=Oe("terminal-kill",L.trash,d(15993,null)),yEo=Oe("terminal-new",L.add,d(15994,null)),wEo=Oe("terminal-configure-profile",L.gear,d(15992,null)),CEo=Oe("terminal-decoration-mark",L.circleSmallFilled,d(16002,null)),gNi=Oe("terminal-decoration-incomplete",L.circle,d(16001,null)),xEo=Oe("terminal-decoration-error",L.errorSmall,d(16000,null)),kEo=Oe("terminal-decoration-success",L.circleFilled,d(16003,null)),EEo=Oe("terminal-command-history-remove",L.close,d(15999,null)),TEo=Oe("terminal-command-history-output",L.output,d(15998,null)),_Eo=Oe("terminal-command-history-fuzzy-search",L.searchFuzzy,d(15996,null)),DEo=Oe("terminal-command-history-open-file",L.symbolReference,d(15997,null));function vNi(a,i,e){let t=e?`${d(16130,null)}

---

`:"";if(a)if(a.markProperties||i)if(a.markProperties?.hoverMessage||i)t=a.markProperties?.hoverMessage||i||"";else return"";else if(on(a.duration)){let o=BY(a.duration);a.exitCode?a.exitCode===-1?t+=d(16124,null,ea(a.timestamp,!0),o):t+=d(16126,null,ea(a.timestamp,!0),o,a.exitCode):t+=d(16129,null,ea(a.timestamp,!0),o)}else a.exitCode?a.exitCode===-1?t+=d(16123,null,ea(a.timestamp,!0)):t+=d(16125,null,ea(a.timestamp,!0),a.exitCode):t+=d(16127,null);else if(i)t=i;else return"";return t}var fNi=d(16122,null),REo=d(16121,null);function g$t(a,i){if(a)return vNi(a);if(!i)return"";let e=i.timestamp,t=i.exitCode,o=i.duration;if(typeof e!="number"||e===void 0)return"";let n="",r=ea(e,!0);if(typeof o=="number"){let s=BY(Math.max(o,0));t?t===-1?n+=d(16124,null,r,s):n+=d(16126,null,r,s,t):n+=d(16129,null,r,s)}else t?t===-1?n+=d(16123,null,r):n+=d(16125,null,r,t):n+=d(16128,null,r);return n}function f$t(a,i,e=Date.now()){let t="unknown",o=a?.exitCode??i?.exitCode,n=fNi,r=a?.timestamp??i?.timestamp,s=fNi,l,c=fNi;typeof r=="number"&&(s=new Date(r).toLocaleString()),a?a.exitCode===void 0?(t="running",n=REo,l=r!==void 0?Math.max(0,e-r):void 0):a.exitCode!==0?(t="error",n=String(a.exitCode),l=a.duration??(r!==void 0?Math.max(0,e-r):void 0)):(t="success",n=String(a.exitCode),l=a.duration??(r!==void 0?Math.max(0,e-r):void 0)):i&&(i.exitCode===void 0?(t="running",n=REo,l=r!==void 0?Math.max(0,e-r):void 0):i.exitCode!==0?(t="error",n=String(i.exitCode),l=i.duration):(t="success",n=String(i.exitCode),l=i.duration)),typeof l=="number"&&(c=BY(Math.max(l,0)));let u=[],p=gNi;switch(t){case"running":case"unknown":u.push("default-color","default"),p=gNi;break;case"error":u.push("error"),p=xEo;break;case"success":u.push("success"),p=kEo;break}let h=g$t(a,i);return{status:t,icon:p,classNames:u,exitCode:o,exitCodeText:n,startTimestamp:r,startText:s,duration:l,durationText:c,hoverMessage:h}}function LWe(a,i){if(!i)return;let e=a.inspect("terminal.integrated.fontSize").value,t=a.inspect("terminal.integrated.fontSize").defaultValue,o=a.inspect("terminal.integrated.lineHeight").value;if(on(e)&&on(t)&&on(o)){let n=e/t<=1?e/t:1;i.style.width=`${n*16}px`,i.style.height=`${n*16*o}px`,i.style.fontSize=`${n*16}px`,i.style.marginLeft=`${n*-17}px`}}var Ipn=1,ypn=10,LEo=50,wpn=10,Cpn=100,xpn=2,bNi=new WeakMap;Ge.registerCommand(aw.FocusChatInstanceAction,async(a,i)=>{await i?.focusTerminal()});Ge.registerCommand(aw.ContinueInBackground,async(a,i)=>{i?.continueInBackground()});Ge.registerCommand(aw.ToggleChatTerminalOutput,async(a,i)=>{await i?.toggleOutputFromAction()});var Bst=class extends k{constructor(e,t){super();this._options=e;this._hoverService=t;let o=st("span.chat-terminal-command-decoration@decoration",{role:"img",tabIndex:0});this._element=o.decoration,this._attachElementToContainer()}_attachElementToContainer(){let e=this._options.getCommandBlock();if(!e)return;let t=this._element;if(!t.isConnected||t.parentElement!==e){let o=this._options.getIconElement();o&&o.parentElement===e?o.insertAdjacentElement("afterend",t):e.insertBefore(t,e.firstElementChild??null)}this._register(this._hoverService.setupDelayedHover(t,()=>({content:this._getHoverText()}))),this._attachInteractionHandlers(t)}_getHoverText(){let e=this._options.getResolvedCommand(),t=this._options.terminalData.terminalCommandState;return g$t(e,t)||""}update(e){this._attachElementToContainer();let t=this._element,o=e??this._options.getResolvedCommand();this._apply(t,o)}_apply(e,t){let o=this._options.terminalData,n=o.terminalCommandState;if(t){let u=o.terminalCommandState??{};o.terminalCommandState={...u,exitCode:t.exitCode,timestamp:t.timestamp??u.timestamp,duration:t.duration??u.duration},n=o.terminalCommandState}else if(!n){let u=Date.now();o.terminalCommandState={exitCode:void 0,timestamp:u},n=o.terminalCommandState}let r=f$t(t,n),s=g$t(t,n);e.className="chat-terminal-command-decoration terminal-command-decoration",e.classList.add("codicon");for(let u of r.classNames)e.classList.add(u);e.classList.add(...q.asClassNameArray(r.icon));let l=!e.classList.contains("default");e.tabIndex=l?0:-1,l?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true");let c=s||r.hoverMessage;c?e.setAttribute("aria-label",c):e.removeAttribute("aria-label")}_attachInteractionHandlers(e){this._interactionElement!==e&&(this._interactionElement=e)}};Bst=I([m(1,ot)],Bst);var MWe=class extends xb{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e);this._instantiationService=c;this._terminalChatService=u;this._terminalService=p;this._contextKeyService=h;this._chatWidgetService=g;this._configurationService=f;this._terminalEditorService=v;this._terminalGroupService=b;this._telemetryService=S;this._toolbarHasInstance=!1;this._toolbarCanContinueInBackground=!1;this._toolbarHasOutput=!1;this._toolbarIsHiddenTerminal=!1;this._toolbarOutputExpanded=!1;this._actionBarActions=new O;this._userToggledOutput=!1;this._isInThinkingContainer=!1;this._usesCollapsibleWrapper=!1;this._elementIndex=o.elementIndex,this._contentIndex=o.contentIndex,this._sessionResource=o.element.sessionResource,t=yR(t),this._terminalData=t,this._terminalCommandUri=t.terminalCommandUri?A.revive(t.terminalCommandUri):void 0,this._isSerializedInvocation=e.kind==="toolInvocationSerialized";let y=st(".chat-terminal-content-part@container",[st(".chat-terminal-content-title@title",[st(".chat-terminal-command-block@commandBlock")]),st(".chat-terminal-content-message@message")]);this._titleElement=y.title;let w=(t.commandLine.forDisplay??t.commandLine.userEdited??t.commandLine.toolEdited??t.commandLine.original).trimStart();this._commandText=w,this._terminalOutputContextKey=Z.inChatTerminalToolOutput.bindTo(this._contextKeyService),this._decoration=this._register(this._instantiationService.createInstance(Bst,{terminalData:this._terminalData,getCommandBlock:()=>y.commandBlock,getIconElement:()=>{},getResolvedCommand:()=>this._getResolvedCommand()}));let x=t.presentationOverrides?.commandLine??w,E=t.presentationOverrides?.language??t.language,M=this._register(c.createInstance(Kq,y.commandBlock,new he([`\`\`\`${E}`,`${x.replaceAll("```","\\`\\`\\`")}`,"```"].join(`
`),{supportThemeIcons:!0}),void 0));this._register(M.onDidChangeHeight(()=>{this._decoration.update()})),this._outputView=this._register(this._instantiationService.createInstance(Hst,()=>this._ensureTerminalInstance(),()=>this._getResolvedCommand(),()=>this._terminalData.terminalCommandOutput,()=>this._commandText,()=>this._terminalData.terminalTheme,!!this._terminalData.terminalToolSessionId)),(this._terminalData.terminalToolSessionId||this._terminalData.terminalCommandOutput)&&y.container.append(this._outputView.domNode),this._register(this._outputView.onDidFocus(()=>this._handleOutputFocus())),this._register(this._outputView.onDidBlur(Te=>this._handleOutputBlur(Te))),this._register(ee(()=>this._handleDispose()));let N=st(".chat-terminal-action-bar@actionBar");y.title.append(N.root),this._actionBar=this._register(new oo(N.actionBar)),this._register(this._actionBarActions);let V=!1,H=()=>{V||this._store.isDisposed||(V=!0,this._initializeTerminalActions())};H(),this._terminalService.whenConnected.then(()=>{H()});let K=this._terminalData.terminalToolSessionId;K&&this._register(this._terminalChatService.onDidContinueInBackground(Te=>{Te===K&&(this._terminalData.didContinueInBackground=!0,this._toolbarCanContinueInBackground=!1,this._updateToolbarActions())}));let j;e.pastTenseMessage&&(j=`${typeof e.pastTenseMessage=="string"?e.pastTenseMessage:e.pastTenseMessage.value}`);let se={kind:"markdownContent",content:new he(j,{supportThemeIcons:!0,isTrusted:yr(e.pastTenseMessage)?e.pastTenseMessage.isTrusted:!1})},ce={codeBlockRenderOptions:{hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{wordWrap:"on"}},accessibilityOptions:j?{statusMessage:d(8998,null,Du(j))}:void 0};this.markdownPart=this._register(c.createInstance(UC,se,o,r,!1,l,n,{},s(),ce)),y.message.append(this.markdownPart.domNode);let Se=this._register(c.createInstance(VE,y.container,this.getIcon(),t.autoApproveInfo));this._decoration.update();let Re=this._configurationService.getValue("chat.agent.thinking.terminalTools"),xe=this._configurationService.getValue("chat.tools.terminal.simpleCollapsible"),He=e.kind==="toolInvocation"&&pi.getConfirmationMessages(e);this._isInThinkingContainer=Re&&!He,this._usesCollapsibleWrapper=this._isInThinkingContainer||xe,this._usesCollapsibleWrapper?this.domNode=this._createCollapsibleWrapper(Se.domNode,x,e,o):this.domNode=Se.domNode,this._renderImagePills(e,o,y.container);let Ee=!!t.terminalCommandOutput;(bNi.get(e)||this._isInThinkingContainer&&pi.isComplete(e)&&Ee)&&this._toggleOutput(!0),this._register(this._terminalChatService.registerProgressPart(this))}get codeblocks(){return this.markdownPart?.codeblocks??[]}get elementIndex(){return this._elementIndex}get contentIndex(){return this._contentIndex}_renderImagePills(e,t,o){let n=()=>{let s=dst(e,t.element.sessionResource).map(c=>({kind:"data",value:c.data.buffer,mimeType:c.mimeType,uri:c.uri}));if(s.length===0)return;let l=this._register(this._instantiationService.createInstance(hV,s));if(this._thinkingCollapsibleWrapper){let c=this._thinkingCollapsibleWrapper,u=p=>{p?o.appendChild(l.domNode):c.domNode.appendChild(l.domNode)};u(c.expanded.get()),this._register(ve(p=>{u(c.expanded.read(p))}))}else o.appendChild(l.domNode)};e.kind==="toolInvocationSerialized"?n():this._register(ve(r=>{e.state.read(r).type===pi.StateKind.Completed&&n()}))}_createCollapsibleWrapper(e,t,o,n){let r=t.length>LEo?t.substring(0,LEo)+"...":t,s=pi.isComplete(o),l=this._terminalData.terminalCommandState?.exitCode===void 0,c=s&&l&&(this._terminalData.isBackground===!0||this._terminalData.didContinueInBackground===!0),u=s&&!c,p=pi.executionConfirmedOrDenied(o)?.type===5,g=this._configurationService.getValue("chat.tools.autoExpandFailures")&&this._terminalData.terminalCommandState?.exitCode!==void 0&&this._terminalData.terminalCommandState.exitCode!==0,f=!u||g,v=this._register(this._instantiationService.createInstance(Ust,r,this._terminalData.commandLine.isSandboxWrapped===!0,e,n,f,u,p,c,()=>this.focusTerminal()));this._thinkingCollapsibleWrapper=v;let b=!0;return this._register(ve(S=>{let y=v.expanded.read(S);if(b){b=!1;return}this._toggleOutput(y)})),v.domNode}expandCollapsibleWrapper(){this._thinkingCollapsibleWrapper?.expand()}markCollapsibleWrapperComplete(){this._thinkingCollapsibleWrapper?.markComplete()}async _initializeTerminalActions(){if(this._store.isDisposed)return;let e=this._terminalData.terminalToolSessionId;if(!e){this._updateToolbarContextKeys();return}let t=async n=>{if(this._store.isDisposed)return;if(!n){this._isSerializedInvocation&&this._clearCommandAssociation(),this._updateToolbarContextKeys(void 0,e);return}this._terminalInstance!==n&&(this._terminalInstance=n,this._registerInstanceListener(n)),this._updateToolbarContextKeys(n,e)},o=await this._terminalChatService.getTerminalInstanceByToolSessionId(e);if(await t(o),o||this._updateToolbarContextKeys(void 0,e),!this._store.isDisposed&&!this._terminalSessionRegistration){let n=this._terminalChatService.onDidRegisterTerminalInstanceWithToolSession(async r=>{let s=await this._terminalChatService.getTerminalInstanceByToolSessionId(e);r===s&&(this._terminalSessionRegistration?.dispose(),this._terminalSessionRegistration=void 0,await t(r))});this._terminalSessionRegistration=this._store.add(n)}}_updateToolbarContextKeys(e,t){if(this._store.isDisposed)return;let o=this._getResolvedCommand(e);if(this._toolbarHasInstance=!!e,e&&t?this._toolbarIsHiddenTerminal=this._terminalChatService.isBackgroundTerminal(t):this._toolbarIsHiddenTerminal=!1,e&&t&&!this._terminalData.isBackground&&!this._terminalData.didContinueInBackground){let n=o?.exitCode===void 0&&this._terminalData.terminalCommandState?.exitCode===void 0;this._toolbarCanContinueInBackground=n}else this._toolbarCanContinueInBackground=!1;if(!this._usesCollapsibleWrapper){let n=!!this._terminalData.terminalCommandOutput,r=!!o||n;if(this._toolbarHasOutput=r,r&&!this._outputView.isExpanded){let s=this._configurationService.getValue("chat.tools.autoExpandFailures"),l=o?.exitCode??this._terminalData.terminalCommandState?.exitCode;l!==void 0&&l!==0&&s&&this._toggleOutput(!0)}}this._updateToolbarActions(),this._decoration.update(o)}_updateToolbarActions(){if(!this._actionBar||this._store.isDisposed)return;this._actionBar.clear(),this._actionBarActions.clear();let e=[];if(this._toolbarCanContinueInBackground){let t=new it(aw.ContinueInBackground,d(8993,null),q.asClassName(L.debugContinue),!0,()=>this.continueInBackground());this._actionBarActions.add(t),e.push(t)}if(this._toolbarHasInstance){let t=this._toolbarIsHiddenTerminal?d(8996,null):d(8994,null),o=new it(aw.FocusChatInstanceAction,t,q.asClassName(L.openInProduct),!0,()=>this.focusTerminal());this._actionBarActions.add(o),e.push(o)}if(this._toolbarHasOutput&&!this._usesCollapsibleWrapper){let t=this._toolbarOutputExpanded?L.chevronDown:L.chevronRight,o=this._toolbarOutputExpanded?d(8995,null):d(8997,null),n=new it(aw.ToggleChatTerminalOutput,o,q.asClassName(t),!0,()=>this.toggleOutputFromAction());this._actionBarActions.add(n),e.push(n)}this._actionBar.push(e,{icon:!0,label:!1})}_getResolvedCommand(e){let t=e??this._terminalInstance;if(t)return this._resolveCommand(t)}_clearCommandAssociation(e){this._terminalCommandUri=void 0,e?.clearPersistentData&&(this._terminalData.terminalCommandUri&&delete this._terminalData.terminalCommandUri,this._terminalData.terminalToolSessionId&&delete this._terminalData.terminalToolSessionId),this._decoration.update()}_shouldAutoExpand(){return!this._outputView.isExpanded&&!this._userToggledOutput&&!this._store.isDisposed&&!bNi.get(this.toolInvocation)}_registerInstanceListener(e){let t=this._register(new ue),o=async()=>{let s=this._resolveCommand(e);return this._updateToolbarContextKeys(e,this._terminalData.terminalToolSessionId),s},n=async s=>{if(t.clear(),!s){let g=this._terminalData.terminalToolSessionId?this._terminalChatService.getAhpCommandSource(this._terminalData.terminalToolSessionId):void 0;g&&this._attachAhpCommandSource(e,g,t),await o();return}let l=new O,c=0,u=()=>{if(this._terminalData.terminalCommandOutput?.text?.trim())return!0;let g=this._getResolvedCommand(e);if(!g?.executedMarker||e.isDisposed)return!1;let f=e.xterm?.raw.buffer.active;return f?f.baseY+f.cursorY>g.executedMarker.line?!0:c>xpn:!1},p=l.add(new Vst({onCommandExecuted:U.map(s.onCommandExecuted,()=>{}),onCommandFinished:U.map(s.onCommandFinished,()=>{}),onWillData:e.onWillData,shouldAutoExpand:()=>this._shouldAutoExpand(),hasRealOutput:u}));l.add(p.onDidRequestExpand(()=>{this._usesCollapsibleWrapper&&this.expandCollapsibleWrapper(),this._toggleOutput(!0)})),l.add(e.onWillData(()=>{c++})),l.add(s.onCommandExecuted(()=>{this._updateToolbarContextKeys(e,this._terminalData.terminalToolSessionId)})),l.add(s.onCommandFinished(()=>{this._updateToolbarContextKeys(e,this._terminalData.terminalToolSessionId);let g=this._getResolvedCommand(e);this._handleCommandCompletion(g),g?.endMarker&&t.clear()})),t.value=l;let h=await o();if(h?.endMarker){t.clear(),this._handleCommandCompletion(h);return}};n(e.capabilities.get(2)),this._register(e.capabilities.onDidAddCommandDetectionCapability(s=>n(s)));let r=this._register(e.onDisposed(()=>{this._terminalInstance===e&&(this._terminalInstance=void 0),this._clearCommandAssociation({clearPersistentData:!0}),t.clear(),this._updateToolbarContextKeys(void 0,this._terminalData.terminalToolSessionId),r.dispose()}))}_attachAhpCommandSource(e,t,o){let n=new O,r=()=>this._getResolvedCommand(e)?.hasOutput()?!0:!!this._terminalData.terminalCommandOutput?.text?.trim(),s=n.add(new Vst({onCommandExecuted:U.map(t.onCommandExecuted,()=>{}),onCommandFinished:U.map(t.onCommandFinished,()=>{}),onWillData:e.onWillData,shouldAutoExpand:()=>this._shouldAutoExpand(),hasRealOutput:r}));n.add(s.onDidRequestExpand(()=>{this._usesCollapsibleWrapper&&this.expandCollapsibleWrapper(),this._toggleOutput(!0)})),n.add(t.onCommandExecuted(c=>{!this._terminalData.terminalCommandId&&c.id&&(this._terminalData.terminalCommandId=c.id,this._updateToolbarContextKeys(e,this._terminalData.terminalToolSessionId))})),n.add(t.onCommandFinished(c=>{if(this._terminalData.terminalCommandId===c.id){this._updateToolbarContextKeys(e,this._terminalData.terminalToolSessionId);let u=this._getResolvedCommand(e);this._handleCommandCompletion(u)}})),o.value=n;let l=this._resolveCommand(e);l?.endMarker&&this._handleCommandCompletion(l)}_handleCommandCompletion(e){this.markCollapsibleWrapperComplete(),e?.exitCode===0&&this._outputView.isExpanded&&!this._userToggledOutput&&this._toggleOutput(!1),this._configurationService.getValue("chat.tools.autoExpandFailures")&&e?.exitCode!==void 0&&e.exitCode!==0&&this._thinkingCollapsibleWrapper&&this.expandCollapsibleWrapper()}async _toggleOutput(e){let t=await this._outputView.toggle(e),o=this._outputView.isExpanded;return this._titleElement.classList.toggle("chat-terminal-content-title-no-bottom-radius",o),this._toolbarOutputExpanded=o,this._updateToolbarActions(),t&&bNi.set(this.toolInvocation,o),t}async _ensureTerminalInstance(){return this._terminalInstance?.isDisposed&&(this._terminalInstance=void 0),!this._terminalInstance&&this._terminalData.terminalToolSessionId&&(this._terminalInstance=await this._terminalChatService.getTerminalInstanceByToolSessionId(this._terminalData.terminalToolSessionId),this._terminalInstance?.isDisposed&&(this._terminalInstance=void 0)),this._terminalInstance}_handleOutputFocus(){this._terminalOutputContextKey.set(!0),this._terminalChatService.setFocusedProgressPart(this),this._outputView.updateAriaLabel()}_handleOutputBlur(e){let t=e.relatedTarget;this._outputView.containsElement(t)||(this._terminalOutputContextKey.reset(),this._terminalChatService.clearFocusedProgressPart(this))}_handleDispose(){this._terminalOutputContextKey.reset(),this._terminalChatService.clearFocusedProgressPart(this)}getCommandAndOutputAsText(){return this._outputView.getCommandAndOutputAsText()}focusOutput(){this._outputView.focus()}_focusChatInput(){this._chatWidgetService.getWidgetBySessionResource(this._sessionResource)?.focusInput()}async focusTerminal(){let e=await this._ensureTerminalInstance(),t="none",o="panel";if(e?(t="instance",o=e.target===2?"editor":"panel"):this._terminalCommandUri&&(t="commandUri"),this._telemetryService.publicLog2("terminal/chatFocusInstance",{target:t,location:o}),e){this._terminalService.setActiveInstance(e),e.target===2?this._terminalEditorService.openEditor(e):await this._terminalGroupService.showPanel(!0),this._terminalService.setActiveInstance(e),await e.focusWhenReady(!0);let n=this._getResolvedCommand(e);n&&e.xterm?.markTracker.revealCommand(n);return}this._terminalCommandUri&&this._terminalService.openResource(this._terminalCommandUri)}continueInBackground(){let e=this._terminalData.terminalToolSessionId;e&&this._terminalChatService.continueInBackground(e)}async toggleOutputFromAction(){if(this._userToggledOutput=!0,this._telemetryService.publicLog2("terminal/chatToggleOutput",{previousExpanded:this._outputView.isExpanded}),!this._outputView.isExpanded){await this._toggleOutput(!0);return}await this._toggleOutput(!1)}async toggleOutputFromKeyboard(){if(this._userToggledOutput=!0,!this._outputView.isExpanded){await this._toggleOutput(!0),this.focusOutput();return}await this._collapseOutputAndFocusInput()}async _collapseOutputAndFocusInput(){this._outputView.isExpanded&&await this._toggleOutput(!1),this._focusChatInput()}_resolveCommand(e){if(e.isDisposed)return;let t=this._terminalData.terminalCommandId,o=e.capabilities.get(2);if(o&&t){let r=o.commands;if(r&&r.length>0){let l=r.find(c=>c.id===t);if(l)return l}let s=o.executingCommandObject;if(s&&s.id===t)return s}let n=this._terminalData.terminalToolSessionId;if(n){let r=this._terminalChatService.getAhpCommandSource(n);if(r)return t?r.getCommandById(t):r.executingCommandObject??r.commands[r.commands.length-1]}}};MWe=I([m(7,F),m(8,tg),m(9,an),m(10,X),m(11,Lt),m(12,B),m(13,hb),m(14,Cc),m(15,_e)],MWe);var Hst=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._ensureTerminalInstance=e;this._resolveCommand=t;this._getTerminalCommandOutput=o;this._getCommandText=n;this._getStoredTheme=r;this._hasTerminalSession=s;this._accessibleViewService=l;this._instantiationService=c;this._terminalConfigurationService=u;this._themeService=p;this._contextKeyService=h;this._isAtBottom=!0;this._isProgrammaticScroll=!1;this._onDidFocusEmitter=this._register(new T);this._onDidBlurEmitter=this._register(new T);let g=st(".chat-terminal-output-container@container",[st(".chat-terminal-output-body@body",[st(".chat-terminal-output-content@content",[st(".chat-terminal-output-terminal@terminal"),st(".chat-terminal-output-empty@empty")])])]);this.domNode=g.container,this.domNode.classList.add("collapsed"),this._outputBody=g.body,this._contentContainer=g.content,this._terminalContainer=g.terminal,this._emptyElement=g.empty,this._contentContainer.appendChild(this._emptyElement),this._register($(this.domNode,ne.FOCUS_IN,()=>this._onDidFocusEmitter.fire())),this._register($(this.domNode,ne.FOCUS_OUT,v=>this._onDidBlurEmitter.fire(v)));let f=this._register(new zu("ChatTerminalToolProgressPart.handleResize",()=>this._handleResize()));this._register(f.observe(this.domNode)),this._applyBackgroundColor(),this._register(this._themeService.onDidColorThemeChange(()=>this._applyBackgroundColor()))}get isExpanded(){return this.domNode.classList.contains("expanded")}get onDidFocus(){return this._onDidFocusEmitter.event}get onDidBlur(){return this._onDidBlurEmitter.event}async toggle(e){let t=this.isExpanded;return e===t?(e&&await this._updateTerminalContent(),!1):e?(this._scrollableContainer||await this._createScrollableContainer(),await this._updateTerminalContent(),this._setExpanded(!0),this._layoutOutput(),this._scrollOutputToBottom(),this._scheduleOutputRelayout(),!0):(this._setExpanded(!1),this._isAtBottom=!0,!0)}focus(){this._scrollableContainer?.getDomNode().focus()}containsElement(e){return!!e&&this.domNode.contains(e)}updateAriaLabel(){if(!this._scrollableContainer)return;let t=this._resolveCommand()?.command??this._getCommandText();if(!t)return;let o=d(8990,null,t),n=this._scrollableContainer.getDomNode();n.setAttribute("role","region");let r=this._accessibleViewService.getOpenAriaHint("accessibility.verbosity.terminalChatOutput"),s=r?o+", "+r:o;n.setAttribute("aria-label",s)}getCommandAndOutputAsText(){let e=this._resolveCommand(),t=e?.command??this._getCommandText();if(!t)return;let o=d(8989,null,t);if(e){let l=e.getOutput();if(!l||l.trim().length===0)return`${o}
${d(8987,null)}`;let c=l.split(`
`);return`${o}
${c.join(`
`).trimEnd()}`}let n=this._getTerminalCommandOutput();if(!n)return`${o}
${d(8992,null)}`;let r=Hv(n.text??"");if(!r.trim().length)return`${o}
${d(8987,null)}`;let s=r.trimEnd();return n.truncated&&(s+=`
${d(8991,null)}`),`${o}
${s}`}_setExpanded(e){this.domNode.classList.toggle("expanded",e),this.domNode.classList.toggle("collapsed",!e)}async _createScrollableContainer(){this._scrollableContainer=this._register(new Ar(this._outputBody,{vertical:2,horizontal:2,handleMouseWheel:!0}));let e=this._scrollableContainer.getDomNode();e.tabIndex=0,this.domNode.appendChild(e),this.updateAriaLabel(),this._register($(this.domNode,ne.MOUSE_ENTER,()=>{this._scrollableContainer?.updateOptions({horizontal:1})})),this._register($(this.domNode,ne.MOUSE_LEAVE,()=>{this._scrollableContainer?.updateOptions({horizontal:2})})),this._register($(this.domNode,ne.FOCUS_IN,()=>{this._scrollableContainer?.updateOptions({horizontal:1})})),this._register($(this.domNode,ne.FOCUS_OUT,()=>{this._scrollableContainer?.updateOptions({horizontal:2})})),this._register(this._scrollableContainer.onScroll(()=>{this._isProgrammaticScroll||(this._isAtBottom=this._computeIsAtBottom())}))}async _updateTerminalContent(){let e=await this._resolveLiveTerminal(),t=e?this._resolveCommand():void 0,o=this._getTerminalCommandOutput();if(!(e&&t&&await this._renderLiveOutput(e,t))){if(this._disposeLiveMirror(),o){await this._renderSnapshotOutput(o);return}this._hasTerminalSession&&this._renderUnavailableMessage(e)}}async _renderLiveOutput(e,t){if(this._mirror)return!0;if(await e.xtermReadyPromise,this._store.isDisposed||e.isDisposed||!e.xterm)return this._disposeLiveMirror(),!1;let o=this._register(this._instantiationService.createInstance(M0e,e.xterm,t));this._mirror=o,this._register(o.onDidUpdate(l=>{l.lineCount&&l.lineCount>0&&this._hideEmptyMessage(),this._layoutOutput(l.lineCount),this._isAtBottom&&this._scrollOutputToBottom()})),this._register(o.onDidInput(l=>{e.isDisposed||e.sendText(l,!1)})),await o.attach(this._terminalContainer);let n=await o.renderCommand(),r=!!t.endMarker,s=n&&n.lineCount&&n.lineCount>0;if(!s)for(let l=0;l<wpn&&!s;l++){if(await Li(Cpn),this._store.isDisposed)return!0;if(n=await o.renderCommand(),s=n&&n.lineCount&&n.lineCount>0,r=!!t.endMarker,r)break}return s?this._hideEmptyMessage():r&&this._showEmptyMessage(d(8987,null)),this._layoutOutput(n?.lineCount??0),!0}async _renderSnapshotOutput(e){if(this._snapshotMirror){this._layoutOutput(e.lineCount??this._lastRenderedLineCount??0);return}if(this._store.isDisposed)return;St(this._terminalContainer),this._snapshotMirror=this._register(this._instantiationService.createInstance(P0e,e,this._getStoredTheme)),await this._snapshotMirror.attach(this._terminalContainer),this._snapshotMirror.setOutput(e);let t=await this._snapshotMirror.render();!!e.text&&e.text.length>0?this._hideEmptyMessage():this._showEmptyMessage(d(8987,null));let n=t?.lineCount??e.lineCount??0;this._layoutOutput(n)}_renderUnavailableMessage(e){St(this._terminalContainer),this._lastRenderedLineCount=void 0,e?this._showEmptyMessage(d(8986,null)):this._showEmptyMessage(d(8988,null))}async _resolveLiveTerminal(){let e=await this._ensureTerminalInstance();return e&&!e.isDisposed?e:void 0}_showEmptyMessage(e){this._emptyElement.textContent=e,this._terminalContainer.classList.add("chat-terminal-output-terminal-no-output"),this.domNode.classList.add("chat-terminal-output-container-no-output")}_hideEmptyMessage(){this._emptyElement.textContent="",this._terminalContainer.classList.remove("chat-terminal-output-terminal-no-output"),this.domNode.classList.remove("chat-terminal-output-container-no-output")}_disposeLiveMirror(){this._mirror&&(this._mirror.dispose(),this._mirror=void 0)}_scheduleOutputRelayout(){zi().requestAnimationFrame(()=>{this._layoutOutput(),this._scrollOutputToBottom()})}_handleResize(){this._scrollableContainer&&(this.isExpanded?(this._layoutOutput(),this._scrollOutputToBottom()):this._scrollableContainer.scanDomNode())}_layoutOutput(e){if(!this._scrollableContainer||(e!==void 0?this._lastRenderedLineCount=e:e=this._lastRenderedLineCount,this._scrollableContainer.scanDomNode(),!this.isExpanded||e===void 0))return;let t=this._scrollableContainer.getDomNode(),o=this._computeRowHeightPx(),n=this._getOutputPadding(),r=o*ypn+n,s=this._getOutputContentHeight(e,o,n),l=Math.min(s,r);t.style.height=l<r?`${l}px`:"",this._scrollableContainer.scanDomNode()}_computeIsAtBottom(){if(!this._scrollableContainer)return!0;let e=this._scrollableContainer.getScrollDimensions();return this._scrollableContainer.getScrollPosition().scrollTop>=e.scrollHeight-e.height-5}_scrollOutputToBottom(){if(!this._scrollableContainer)return;this._isProgrammaticScroll=!0;let e=this._scrollableContainer.getScrollDimensions();this._scrollableContainer.setScrollPosition({scrollTop:e.scrollHeight}),this._isProgrammaticScroll=!1}_getOutputContentHeight(e,t,o){return Math.max(e,Ipn)*t+o}_getOutputPadding(){let e=mF(this._outputBody),t=Number.parseFloat(e.paddingTop||"0"),o=Number.parseFloat(e.paddingBottom||"0");return t+o}_computeRowHeightPx(){let e=zi(),t=this._terminalConfigurationService.getFont(e),o=on(t.charHeight)&&t.charHeight>0,n=on(t.fontSize)&&t.fontSize>0,r=on(t.lineHeight)&&t.lineHeight>0,s=(o?t.charHeight:n?t.fontSize:1)??1,l=r?t.lineHeight:1,c=Math.ceil(s*l);return Math.max(c,1)}_applyBackgroundColor(){let e=this._themeService.getColorTheme(),t=Z.inChatEditor.getValue(this._contextKeyService),o=e.getColor(t?Bo:GI);o&&(this.domNode.style.backgroundColor=o.toString())}};Hst=I([m(6,Kd),m(7,F),m(8,mp),m(9,Pe),m(10,X)],Hst);var Ust=class extends O_{constructor(e,t,o,n,r,s,l,c,u,p,h){let g=l?d(8983,null,e):c?d(8978,null,e):s?d(8973,null,e):d(8976,null,e);super(g,n,void 0,p,h);this._showLinkDisposables=this._register(new ue);this._terminalContentElement=o,this._commandText=e,this._isSandboxWrapped=t,this._isComplete=s,this._isSkipped=l,this._isRunningInBackground=c,this._onFocusTerminal=u,this.domNode.classList.add("chat-terminal-thinking-collapsible"),s&&(this.icon=L.check),this._setCodeFormattedTitle(),this._updateShowLink(),this.setExpanded(r)}_setCodeFormattedTitle(){if(!this._collapseButton)return;let e=this._collapseButton.labelElement;if(e.textContent="",this._isSandboxWrapped){let r=this._isSkipped?d(8985,null):this._isComplete?d(8975,null):d(8979,null),s=this._isRunningInBackground?d(8980,null):d(8981,null);e.appendChild(document.createTextNode(r));let l=document.createElement("code");l.textContent=this._commandText,e.appendChild(l),e.appendChild(document.createTextNode(s));return}let t=this._isSkipped?d(8984,null):this._isComplete?d(8974,null):d(8977,null),o=document.createTextNode(t),n=document.createElement("code");n.textContent=this._commandText,e.appendChild(o),e.appendChild(n),this._isRunningInBackground&&e.appendChild(document.createTextNode(d(8972,null)))}_updateShowLink(){if(this._showLinkElement?.remove(),this._showLinkElement=void 0,this._showLinkDisposables.value=void 0,!this._isRunningInBackground||!this._onFocusTerminal||!this._collapseButton)return;let e=this._collapseButton.labelElement,t=new O;this._showLinkDisposables.value=t;let o=_("span.chat-terminal-show-link-container");o.appendChild(document.createTextNode(" \u2014 "));let n=_("span.chat-terminal-show-link");n.textContent=d(8982,null),n.role="button",n.tabIndex=0,t.add($(n,ne.CLICK,r=>{Kt.stop(r,!0),this._onFocusTerminal?.()})),t.add($(n,ne.KEY_DOWN,r=>{let s=new mi(r);(s.equals(3)||s.equals(10))&&(Kt.stop(r,!0),this._onFocusTerminal?.())})),o.appendChild(n),e.appendChild(o),this._showLinkElement=o}markComplete(){this._isComplete||(this._isComplete=!0,this._isRunningInBackground=!1,this.icon=L.check,this._setCodeFormattedTitle(),this._updateShowLink())}initContent(){let e=_(".chat-used-context-list.chat-terminal-thinking-content");return e.appendChild(this._terminalContentElement),e}expand(){this.setExpanded(!0)}hasSameContent(e,t,o){return!1}};Ust=I([m(9,ot),m(10,B)],Ust);var kpn=100,Ive=class extends bV{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){let y=e.state.get();if(y.type!==pi.StateKind.WaitingForConfirmation||!y.confirmationMessages?.title)throw new Error("Confirmation messages are missing");super(e,t,l,c,p,h,v);this.renderer=o;this.editorPool=n;this.currentWidthDelegate=r;this.codeBlockStartIndex=s;this.languageService=u;this.commandService=g;this.markerService=f;this.chatMarkdownAnchorService=b;this.confirmationService=S;this.markdownParts=[];this.render({allowActionId:n1,skipActionId:$fe,allowLabel:y.confirmationMessages.confirmResults?d(9010,null):d(9009,null),skipLabel:d(9015,null),partType:"chatToolConfirmation",subtitle:typeof e.originMessage=="string"?e.originMessage:e.originMessage?.value})}get codeblocks(){return this.markdownParts.flatMap(e=>e.codeblocks)}additionalPrimaryActions(){let e=super.additionalPrimaryActions(),t=this.toolInvocation.state.get();if(t.type!==pi.StateKind.WaitingForConfirmation)return e;if(t.confirmationMessages?.allowAutoConfirm!==!1){let o=t.confirmationMessages?.approveCombination,n=o?{label:typeof o.label=="string"?o.label:o.label.value,key:o.key,arguments:o.arguments}:void 0,r=this.confirmationService.getPreConfirmActions({toolId:this.toolInvocation.toolId,source:this.toolInvocation.source,parameters:t.parameters,chatSessionResource:this.context.element.sessionResource,combination:n});for(let s of r)s.divider&&e.push(new oi),e.push({label:s.label,tooltip:s.detail,scope:s.scope,data:async()=>{await s.select()&&this.confirmWith(this.toolInvocation,{type:4})}})}return t.confirmationMessages?.confirmResults&&e.unshift({label:d(9011,null),data:()=>{t.confirmationMessages.confirmResults=void 0,this.confirmWith(this.toolInvocation,{type:4})}},new oi),e}useAllowOnceAsPrimary(){let e=this.toolInvocation.state.get();return e.type===pi.StateKind.WaitingForConfirmation?!!e.confirmationMessages?.approveCombination:!1}createContentElement(){let e=this.toolInvocation.state.get();if(e.type!==pi.StateKind.WaitingForConfirmation)return"";let{message:t,disclaimer:o}=e.confirmationMessages,n=this.toolInvocation;if(typeof t=="string"&&!o)return t;{let r={hideToolbar:!0,reserveWidth:19,verticalPadding:5,editorOptions:{tabFocusMode:!0,ariaLabel:this.getTitle()}},s=st("div",[st(".message@messageContainer",[st(".message-wrapper@message"),st(".see-more@showMore",[st("a",[d(9014,null)])])]),st(".editor@editor"),st(".disclaimer@disclaimer")]);if(n.toolSpecificData?.kind==="input"&&n.toolSpecificData.rawInput&&!dv(n.toolSpecificData.rawInput)){let p=document.createElement("h3");p.textContent=d(9012,null),s.editor.appendChild(p);let h=n.toolSpecificData,g={hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"off",readOnly:!1,ariaLabel:this.getTitle()}},f=this.languageService.getLanguageIdByLanguageName("json"),v=JSON.stringify(h.rawInput??{},null,1),b=rT(v,`
`)>2,S=v.replace(/\n */g," "),y=gk.poolKey(this.context.element.id,this.codeBlockStartIndex),w=this._register(this.editorPool.get(y));w.object.render({codeBlockIndex:this.codeBlockStartIndex,element:this.context.element,languageId:f??"json",text:S,renderOptions:g,chatSessionResource:this.context.element.sessionResource},this.currentWidthDelegate());let x=w.object.editor.getModel(),E=ht(),M=VYe(n.toolId),N=new Dt(async()=>{let V=[],H=await this.commandService.executeCommand("json.validate",M,x.getValue());for(let K of H??[])K.range&&K.message&&V.push({severity:K.severity==="Error"?8:4,message:K.message,startLineNumber:K.range[0].line+1,startColumn:K.range[0].character+1,endLineNumber:K.range[1].line+1,endColumn:K.range[1].character+1,code:K.code?String(K.code):void 0});this.markerService.changeOne(E,x.uri,V)},500);if(N.schedule(),this._register(x.onDidChangeContent(()=>N.schedule())),this._register(ee(()=>this.markerService.remove(E,[x.uri]))),this._register(N),this.codeblocks.push({codeBlockIndex:this.codeBlockStartIndex,codemapperUri:void 0,elementId:this.context.element.id,focus:()=>w.object.focus(),ownerMarkdownPartId:this.codeblocksPartId,uri:x.uri,chatSessionResource:this.context.element.sessionResource}),this._register(x.onDidChangeContent(V=>{try{h.rawInput=JSON.parse(x.getValue())}catch{}})),s.editor.append(w.object.element),b){let V=st("div.see-more",[st("a@link")]);V.link.textContent=d(9013,null),this._register(ML(V.link,()=>{try{let H=JSON.parse(x.getValue());x.setValue(JSON.stringify(H,null,2)),w.object.editor.updateOptions({tabFocusMode:!1}),w.object.editor.updateOptions({wordWrap:"on"})}catch{}V.root.remove()})),s.editor.append(V.root)}}let l=this._makeMarkdownPart(s.message,t,r),c=this._register(new ZY(l.domNode,void 0)),u=()=>{let p=c.getHeight()>kpn;s.messageContainer.classList.contains("can-see-more")!==p&&s.messageContainer.classList.toggle("can-see-more",p)};return this._register($(s.showMore,"click",()=>{s.messageContainer.classList.toggle("can-see-more",!1),c.dispose()})),this._register(c.onDidChange(u)),c.startObserving(),o?this._makeMarkdownPart(s.disclaimer,o,r):s.disclaimer.remove(),s.root}}getTitle(){let e=this.toolInvocation.state.get();if(e.type!==pi.StateKind.WaitingForConfirmation)return"";let t=e.confirmationMessages?.title;return t?typeof t=="string"?t:t.value:""}_makeMarkdownPart(e,t,o){let n=this._register(this.instantiationService.createInstance(UC,{kind:"markdownContent",content:typeof t=="string"?new he().appendMarkdown(t):t},this.context,this.editorPool,!1,this.codeBlockStartIndex,this.renderer,void 0,this.currentWidthDelegate(),{codeBlockRenderOptions:o}));return N_(n.domNode,this.instantiationService,this.chatMarkdownAnchorService,this._store),e.append(n.domNode),n}};Ive=I([m(6,F),m(7,Le),m(8,Rt),m(9,X),m(10,Lt),m(11,fe),m(12,ha),m(13,Wn),m(14,gS),m(15,IR)],Ive);var PWe=class extends xb{constructor(e,t,o,n,r,s){super(e);this.context=t;this.onDidRemount=o;this.chatOutputItemRendererService=n;this.instantiationService=r;this.stateCache=s;this.codeblocks=[];this._disposeCts=this._register(new qe);let l=e.kind==="toolInvocation"?pi.resultDetails(e):{output:{type:"data",mimeType:e.resultDetails.output.mimeType,value:Ws(e.resultDetails.output.base64Data)}};if(this.domNode=_("div.tool-output-part"),e.invocationMessage){let c=_(".output-title");if(this.domNode.appendChild(c),typeof e.invocationMessage=="string")c.textContent=e.invocationMessage;else{let u=this._register(Lg(e.invocationMessage));c.appendChild(u.element)}}this.domNode.appendChild(this.createOutputPart(e,l))}dispose(){this._disposeCts.dispose(!0),super.dispose()}createOutputPart(e,t){let o=_("div.webview-output");o.style.maxHeight="80vh";let n=this.stateCache.get(e.toolCallId)??{height:0};this.stateCache.set(e.toolCallId,n),n.height&&(o.style.height=`${n.height}px`);let r=_("span");r.textContent=d(9017,null);let s=this._register(this.instantiationService.createInstance(VE,r,q.modify(L.loading,"spin"),void 0));return o.appendChild(s.domNode),this.chatOutputItemRendererService.renderOutputPart(t.output.mimeType,t.output.value.buffer,o,{webviewState:n.webviewState,chatSessionResource:this.context.element.sessionResource},this._disposeCts.token).then(l=>{this._disposeCts.token.isCancellationRequested||(this._register(l),s.domNode.remove(),this._register(l.webview.onDidUpdateState(c=>{n.webviewState=c})),this._register(l.onDidChangeHeight(c=>{n.height=c})),this._register(this.context.onDidChangeVisibility(c=>{c&&l.reinitialize()})),this._register(this.onDidRemount(()=>{l.reinitialize()})))},l=>{if(Yi(l))return;console.error("Error rendering tool output:",l);let c=_(".output-error"),u=_(".output-error-header");D(c,u);let p=_("div");p.classList.add(...q.asClassNameArray(L.error)),u.append(p);let h=_(".output-error-title");h.textContent=d(9016,null),u.append(h);let g=_(".output-error-details");g.textContent=l?.message||String(l),c.append(g),s.domNode.replaceWith(c)}),o}};PWe=I([m(3,a8),m(4,F),m(5,xst)],PWe);var yve=class extends bV{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,s,l);this.confirmationService=c;this._codeblocks=[];let u=e.pastTenseMessage||e.invocationMessage;this.render({allowActionId:sxo,skipActionId:axo,allowLabel:d(9025,null),skipLabel:d(9029,null),partType:"chatToolPostConfirmation",subtitle:typeof u=="string"?u:u?.value})}get codeblocks(){return this._codeblocks}createContentElement(){if(this.toolInvocation.kind!=="toolInvocation")throw new Error("post-approval not supported for serialized data");let e=this.toolInvocation.state.get();if(e.type!==pi.StateKind.WaitingForPostApproval)throw new Error("Tool invocation is not waiting for post-approval");return this.createResultsDisplay(this.toolInvocation,e.contentForModel)}getTitle(){return d(9026,null)}additionalPrimaryActions(){let e=super.additionalPrimaryActions(),t=this.toolInvocation.state.get();if(t.type!==pi.StateKind.WaitingForPostApproval)return e;let o=this.confirmationService.getPostConfirmActions({toolId:this.toolInvocation.toolId,source:this.toolInvocation.source,parameters:t.parameters});for(let n of o)n.divider&&e.push(new oi),e.push({label:n.label,tooltip:n.detail,scope:n.scope,data:async()=>{await n.select()&&this.confirmWith(this.toolInvocation,{type:4})}});return e}createResultsDisplay(e,t){let o=_(".tool-postconfirm-display");if(!t||t.length===0)return o.textContent=d(9028,null),o;let n=[];for(let[r,s]of t.entries())if(s.kind==="text")n.push({kind:"code",title:s.title,data:s.value,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}});else if(s.kind==="promptTsx"){let l=WYe(s);n.push({kind:"code",data:l,languageId:"json",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}else if(s.kind==="data"){let l=s.value.mimeType,c=s.value.data;if(l?.startsWith("image/")){let u=wA(l)?`image${wA(l)}`:"image.bin",p=v_.createUri(this.context.element.sessionResource,e.toolCallId,r,u);n.push({kind:"data",value:c.buffer,mimeType:l,uri:p,audience:s.audience})}else{let u=new TextDecoder("utf-8",{fatal:!0});try{let p=u.decode(c.buffer);n.push({kind:"code",data:p,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}catch{let p=c.toString();n.push({kind:"code",data:p,languageId:"plaintext",codeBlockIndex:r,ownerMarkdownPartId:this.codeblocksPartId,options:{hideToolbar:!0,reserveWidth:19,maxHeightInLines:13,verticalPadding:5,editorOptions:{wordWrap:"on",readOnly:!0}}})}}}if(n.length>0){let r=this._register(this.instantiationService.createInstance(k6,this.context,n));return this._codeblocks.push(...r.codeblocks),r.domNode.classList.add("tool-postconfirm-display"),r.domNode}return o.textContent=d(9027,null),o}};yve=I([m(2,F),m(3,Le),m(4,X),m(5,Lt),m(6,Wn),m(7,IR)],yve);var AWe=class extends xb{constructor(e,t,o,n,r,s){super(e);this.context=t;this.renderer=o;this.announcedToolProgressKeys=n;this.instantiationService=r;this.configurationService=s;this.codeblocks=[];this.domNode=this.createProgressPart()}createProgressPart(){if(pi.isComplete(this.toolInvocation)&&this.toolIsConfirmed&&(this.toolInvocation.pastTenseMessage||this.toolInvocation.invocationMessage)){let t=this.getAnnouncementKey("complete"),o=this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage;if(!this.hasMeaningfulContent(o))return document.createElement("div");let n=this.toolInvocation.kind==="toolInvocation"&&this.hasMeaningfulContent(o)?this.computeShouldAnnounce(t):!1,r=this.renderProgressContent(o,n);return this._register(r),r.domNode}else{let t=document.createElement("div");return this._register(ve(o=>{let n,r=this.getAnnouncementKey("progress");if(this.toolInvocation.kind==="toolInvocation"){let c=this.toolInvocation.state.read(o);if(c.type===pi.StateKind.Cancelled&&c.reasonMessage)n=c.reasonMessage;else if(c.type===pi.StateKind.Executing){let u=c.progress.read(o)?.message;n=this.hasMeaningfulContent(u)?u:this.toolInvocation.invocationMessage}else n=this.toolInvocation.invocationMessage}else n=this.toolInvocation.invocationMessage;if(!this.hasMeaningfulContent(n)){St(t);return}let s=this.toolInvocation.kind==="toolInvocation"&&this.hasMeaningfulContent(n)?this.computeShouldAnnounce(r):!1,l=o.store.add(this.renderProgressContent(n,s));Ii(t,l.domNode)})),t}}get toolIsConfirmed(){let e=pi.executionConfirmedOrDenied(this.toolInvocation);return!!e&&e.type!==0}renderProgressContent(e,t){typeof e=="string"&&(e=new he().appendText(e));let o={kind:"progressMessage",content:e};return t&&this.provideScreenReaderStatus(e),this.instantiationService.createInstance(KR,o,this.renderer,this.context,void 0,!0,this.getIcon(),this.toolInvocation,r0e(this.toolInvocation))}getAnnouncementKey(e){return`${e}:${this.toolInvocation.toolCallId}`}computeShouldAnnounce(e){return!this.announcedToolProgressKeys||!this.configurationService.getValue("accessibility.verboseChatProgressUpdates")||this.announcedToolProgressKeys.has(e)?!1:(this.announcedToolProgressKeys.add(e),!0)}provideScreenReaderStatus(e){let t=typeof e=="string"?e:Du(ma(e,{useLinkFormatter:!0}));Er(t)}hasMeaningfulContent(e){return e?(typeof e=="string"?e:e.value).trim().length>0:!1}};AWe=I([m(4,F),m(5,B)],AWe);var NWe=class extends xb{constructor(e,t,o,n){super(e);this.context=t;this.renderer=o;this.instantiationService=n;this.codeblocks=[];this.domNode=this.createStreamingPart()}createStreamingPart(){let e=document.createElement("div");if(this.toolInvocation.kind!=="toolInvocation")return e;let t=this.toolInvocation;return t.state.get().type!==pi.StateKind.Streaming||this._register(ve(n=>{let r=t.state.read(n);if(r.type!==pi.StateKind.Streaming){St(e),this._onNeedsRerender.fire();return}let l=r.streamingMessage.read(n)??t.invocationMessage,c=typeof l=="string"?l:l.value;if(!c||c.trim().length===0){St(e);return}let p={kind:"progressMessage",content:typeof l=="string"?new he().appendText(l):l},h=n.store.add(this.instantiationService.createInstance(KR,p,this.renderer,this.context,void 0,!0,this.getIcon(),t,!1));Ii(e,h.domNode)})),e}};NWe=I([m(3,F)],NWe);var c1=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.toolInvocation=e;this.context=t;this.renderer=o;this.listPool=n;this.editorPool=r;this.currentWidthDelegate=s;this.announcedToolProgressKeys=l;this.codeBlockStartIndex=c;this.instantiationService=u;this.chatTodoListService=p;this._onDidRemount=this._register(new T);if(this.domNode=_(".chat-tool-invocation-part"),e.presentation==="hidden")return;if(e.toolSpecificData?.kind==="todoList"){let b=t.element.sessionResource,S=e.toolSpecificData.todoList.map((y,w)=>{let x=parseInt(y.id,10);return{id:Number.isNaN(x)?w+1:x,title:y.title,status:y.status}});this.chatTodoListService.setTodos(b,S)}if(e.kind==="toolInvocation"){let b=e.state.get().type,S=e.toolSpecificDataKind.get();this._register(ve(y=>{let w=e.state.read(y).type!==b,x=e.toolSpecificDataKind.read(y)!==S;(w||x)&&f()}))}let h=this._register(new O),g=document.createElement("div");this.domNode.appendChild(g);let f=()=>{if(h.clear(),e.presentation==="hidden"||e.presentation==="hiddenAfterComplete"&&pi.isComplete(e)){Wi(this.domNode);return}Xo(this.domNode),this.subPart=h.add(this.createToolInvocationSubPart()),g.replaceWith(this.subPart.domNode),g=this.subPart.domNode;let b=this.subPart instanceof Ive||this.subPart instanceof eve||this.subPart instanceof Sve||this.subPart instanceof bve||this.subPart instanceof hve||this.subPart instanceof yve;this.domNode.classList.toggle("has-confirmation",b),h.add(this.subPart.onNeedsRerender(f))},v=this.getMcpAppRenderData();if(v){let b=ke(y=>{let w=pi.executionConfirmedOrDenied(e,y);return!!w&&w.type!==0&&w.type!==5}),S=document.createElement("div");this.domNode.appendChild(S),this._register(ve(y=>{b.read(y)?(this.mcpAppPart=y.store.add(this.instantiationService.createInstance(RWe,this.toolInvocation,this._onDidRemount.event,t,v)),S.replaceWith(this.mcpAppPart.domNode),S=this.mcpAppPart.domNode):(this.mcpAppPart=void 0,St(S))}))}f()}get toolCallId(){return this.toolInvocation.toolCallId}get codeblocks(){let e=this.subPart?.codeblocks??[];return this.mcpAppPart&&e.push(...this.mcpAppPart.codeblocks),e}get codeblocksPartId(){return this.subPart?.codeblocksPartId}createToolInvocationSubPart(){if(this.toolInvocation.kind==="toolInvocation"){if(this.toolInvocation.toolSpecificData?.kind==="extensions")return this.instantiationService.createInstance(hve,this.toolInvocation,this.context);let t=this.toolInvocation.state.get();if(t.type===pi.StateKind.Streaming)return this.instantiationService.createInstance(NWe,this.toolInvocation,this.context,this.renderer);if(t.type===pi.StateKind.WaitingForConfirmation)return this.toolInvocation.toolSpecificData?.kind==="terminal"&&!cDe(this.toolInvocation.toolSpecificData)&&this.toolInvocation.toolSpecificData.missingSandboxDependencies?.length?this.instantiationService.createInstance(bve,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer):this.toolInvocation.toolSpecificData?.kind==="terminal"?this.instantiationService.createInstance(eve,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockStartIndex):this.toolInvocation.toolSpecificData?.kind==="modifiedFilesConfirmation"?this.instantiationService.createInstance(Sve,this.toolInvocation,this.context,this.listPool):this.instantiationService.createInstance(Ive,this.toolInvocation,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockStartIndex);if(t.type===pi.StateKind.WaitingForPostApproval)return this.instantiationService.createInstance(yve,this.toolInvocation,this.context)}if(this.toolInvocation.toolSpecificData?.kind==="terminal")return this.instantiationService.createInstance(MWe,this.toolInvocation,this.toolInvocation.toolSpecificData,this.context,this.renderer,this.editorPool,this.currentWidthDelegate,this.codeBlockStartIndex);if(this.toolInvocation.toolSpecificData?.kind==="resources"&&this.toolInvocation.toolSpecificData.values.length>0)return this.instantiationService.createInstance(vve,this.toolInvocation,this.context,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.toolSpecificData.values,this.listPool);if(this.toolInvocation.toolSpecificData?.kind==="simpleToolInvocation")return this.instantiationService.createInstance(T6,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,this.toolInvocation.toolSpecificData,!1);let e=pi.resultDetails(this.toolInvocation);return Array.isArray(e)&&e.length?this.instantiationService.createInstance(vve,this.toolInvocation,this.context,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,e,this.listPool):RH(e)?this.instantiationService.createInstance(PWe,this.toolInvocation,this.context,this._onDidRemount.event):oR(e)?this.instantiationService.createInstance(Xq,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.pastTenseMessage??this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,e.input,e.inputLanguage,e.output,!!e.isError):this.toolInvocation.kind==="toolInvocation"&&this.toolInvocation.toolSpecificData?.kind==="input"&&!pi.isComplete(this.toolInvocation)?this.instantiationService.createInstance(Xq,this.toolInvocation,this.context,this.codeBlockStartIndex,this.toolInvocation.invocationMessage,this.toolInvocation.originMessage,typeof this.toolInvocation.toolSpecificData.rawInput=="string"?this.toolInvocation.toolSpecificData.rawInput:JSON.stringify(this.toolInvocation.toolSpecificData.rawInput,null,2),void 0,void 0,!1):this.instantiationService.createInstance(AWe,this.toolInvocation,this.context,this.renderer,this.announcedToolProgressKeys)}getMcpAppRenderData(){let e=this.toolInvocation.toolSpecificData;if(e?.kind==="input"&&e.mcpAppData){let t=typeof e.rawInput=="string"?e.rawInput:JSON.stringify(e.rawInput,null,2);return{resourceUri:e.mcpAppData.resourceUri,serverDefinitionId:e.mcpAppData.serverDefinitionId,collectionId:e.mcpAppData.collectionId,input:t,sessionResource:this.context.element.sessionResource}}}onDidRemount(){this._onDidRemount.fire()}hasSameContent(e,t,o){return(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&this.toolInvocation.toolCallId===e.toolCallId}addDisposable(e){this._register(e)}};c1=I([m(8,F),m(9,vW)],c1);var zst=100,Epn=[d(8841,null),d(8842,null),d(8843,null),d(8844,null),d(8845,null)],qR=class extends O_{constructor(e,t,o,n,r,s,l,c,u,p,h,g){let{description:f,isDefaultDescription:v,agentName:b,prompt:S,modelName:y}=qR.extractSubagentInfo(t),w=b||d(8839,null),E=`${w.charAt(0).toUpperCase()+w.slice(1)}: ${f}`;super(E,o,void 0,h,g);this.subAgentInvocationId=e;this.context=o;this.chatContentMarkdownRenderer=n;this.listPool=r;this.editorPool=s;this.currentWidthDelegate=l;this.announcedToolProgressKeys=c;this.instantiationService=u;this.chatMarkdownAnchorService=p;this.configurationService=g;this.isActive=!0;this.hasToolItems=!1;this.lazyItems=[];this.hasExpandedOnce=!1;this.pendingPromptRender=!1;this._hoverDisposable=this._register(new ue);this.toolsWaitingForConfirmation=0;this.userManuallyExpanded=!1;this.autoExpandedForConfirmation=!1;this._confirmationPlaceholderDisposable=this._register(new ue);this._useCarouselForConfirmations=!1;this.toolsWaitingForCarouselConfirmation=0;this._titleDetailRendered=this._register(new ue);this.description=ibt(f,zst),this._isDefaultDescription=v,this.agentName=b,this.prompt=S,this.modelName=y,this.isInitiallyComplete=this.element.isComplete;let M=this.domNode;if(M.classList.add("chat-thinking-box","chat-thinking-fixed-mode","chat-subagent-part"),this.element.isComplete||M.classList.add("chat-thinking-active"),!this.element.isComplete&&this._collapseButton){let N=this._collapseButton.labelElement;N.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),this.titleShimmerSpan.textContent=E,N.appendChild(this.titleShimmerSpan)}this._collapseButton&&!this.element.isComplete&&(this._collapseButton.icon=L.circleFilled),this._register(ve(N=>{this.expanded.read(N),this._collapseButton&&(!this.element.isComplete&&this.isActive?this._collapseButton.icon=L.circleFilled:this._collapseButton.icon=L.check)})),this._register(ve(N=>{this._isExpanded.read(N)&&!this.hasExpandedOnce&&(this.hasExpandedOnce=!0,this.materializePendingContent())})),this.setExpanded(!1),this._register(ve(N=>{this._isExpanded.read(N)?this.autoExpandedForConfirmation||(this.userManuallyExpanded=!0):(this.autoExpandedForConfirmation&&(this.autoExpandedForConfirmation=!1),this.userManuallyExpanded&&(this.userManuallyExpanded=!1))})),this.layoutScheduler=this._register(new IY(this.domNode,()=>this.performLayout())),this.updateHover(),this.renderPromptSection(),this.watchToolCompletion(t)}static isParentSubagentTool(e){return e.toolSpecificData?.kind==="subagent"&&!e.subAgentInvocationId}static extractSubagentInfo(e){let t=d(8835,null);if(!qR.isParentSubagentTool(e))return{description:t,isDefaultDescription:!0,agentName:void 0,prompt:void 0,modelName:void 0};if(e.toolSpecificData?.kind==="subagent"){let o=!!e.toolSpecificData.description;return{description:e.toolSpecificData.description??t,isDefaultDescription:!o,agentName:e.toolSpecificData.agentName,prompt:e.toolSpecificData.prompt,modelName:e.toolSpecificData.modelName}}if(e.kind==="toolInvocation"){let o=e.state.get(),n=o.type!==pi.StateKind.Streaming?o.parameters:void 0,r=!!n?.description;return{description:n?.description??t,isDefaultDescription:!r,agentName:n?.agentName,prompt:n?.prompt,modelName:void 0}}return{description:t,isDefaultDescription:!0,agentName:void 0,prompt:void 0,modelName:void 0}}getRandomWorkingMessage(){(!this.availableMessages||this.availableMessages.length===0)&&(this.availableMessages=wst(Epn,this.configurationService));let e=Math.floor(Math.random()*this.availableMessages.length);return this.availableMessages.splice(e,1)[0]}createWorkingSpinner(){if(this.workingSpinnerElement||!this.wrapper)return;this.workingSpinnerElement=_(".chat-thinking-item.chat-thinking-spinner-item");let e=zq(L.circleFilled);this.workingSpinnerElement.appendChild(e),this.workingSpinnerLabel=_("span.chat-thinking-spinner-label"),this.workingSpinnerLabel.textContent=this.getRandomWorkingMessage(),this.workingSpinnerElement.appendChild(this.workingSpinnerLabel),this.wrapper.appendChild(this.workingSpinnerElement)}removeWorkingSpinner(){this.workingSpinnerElement&&(this.workingSpinnerElement.remove(),this.workingSpinnerElement=void 0,this.workingSpinnerLabel=void 0)}showWorkingSpinner(){this.workingSpinnerElement?this.workingSpinnerElement.style.display="":this.createWorkingSpinner()}initContent(){this.wrapper=_(".chat-used-context-list.chat-thinking-collapsible"),this.hasToolItems||(this.wrapper.style.display="none"),this.materializePendingContent(),this.isActive&&!this.isInitiallyComplete&&!this.hasToolsWaitingForConfirmation&&this.showWorkingSpinner();let e=this._register(new zu("ChatSubagentContentPart.layout",()=>this.layoutScheduler.schedule()));return this._register(e.observe(this.wrapper)),this.wrapper}renderPromptSection(){if(!(!this.prompt||this.promptContainer)){if(!this.wrapper||this.isInitiallyComplete&&!this.isExpanded()&&!this.hasExpandedOnce){this.pendingPromptRender=!0;return}this.pendingPromptRender=!1,this.doRenderPromptSection()}}doRenderPromptSection(){if(!this.prompt||this.promptContainer)return;let e=this.prompt.split(`
`),t=e[0]||d(8840,null),o=e.slice(1).join(`
`).trim(),n=ibt(t,zst),s=t.length>zst?n+"\u2026":n,l=t.length>n.length?t.slice(n.length).trim():"",c=l?l+(o?`
`+o:""):o||this.prompt,u=this._register(this.instantiationService.createInstance(mve,s,c,this.context,this.chatContentMarkdownRenderer));this.promptContainer=_(".chat-thinking-tool-wrapper.chat-subagent-section");let p=zq(L.comment);this.promptContainer.appendChild(p),this.promptContainer.appendChild(u.domNode),this.wrapper&&(this.wrapper.firstChild?this.wrapper.insertBefore(this.promptContainer,this.wrapper.firstChild):D(this.wrapper,this.promptContainer),this.wrapper.style.display==="none"&&(this.wrapper.style.display=""))}getIsActive(){return this.isActive}get hasToolsWaitingForConfirmation(){return this.toolsWaitingForConfirmation>0}enableCarouselMode(e,t,o){this._useCarouselForConfirmations=!0,this._navigateToCarousel=e,this._addToolToCarousel=t,this._shouldUseCarouselForTool=o}getAgentLabel(){return this.agentName?this.agentName:!this._isDefaultDescription&&this.description?this.description:d(8839,null)}markAsInactive(){this.isActive=!1,this.domNode.classList.remove("chat-thinking-active"),this._collapseButton&&(this._collapseButton.icon=L.check),this.removeWorkingSpinner(),this.hideConfirmationPlaceholder(),this._isDefaultDescription&&(this.description=d(8834,null)),this.finalizeTitle(),this.setExpanded(!1)}finalizeTitle(){this.updateTitle(),this._collapseButton&&(this._collapseButton.icon=L.check)}updateTitle(){let e=this.agentName||d(8839,null),t=e.charAt(0).toUpperCase()+e.slice(1),o=`${t}: ${this.description}`,n=this.currentRunningToolMessage&&this.isActive?` \u2014 ${this.currentRunningToolMessage}`:"";if(!this._collapseButton)return;let r=this._collapseButton.labelElement;if(!this.isActive){r.textContent="",this.titleShimmerSpan=void 0,this._titleDetailRendered.clear(),this.titleDetailContainer=void 0;let l=_("span");l.textContent=`${t}:`,r.appendChild(l);let c=_("span.chat-thinking-title-detail-text");c.textContent=` ${this.description}`,r.appendChild(c),this._collapseButton.element.ariaLabel=o,this._collapseButton.element.ariaExpanded=String(this.isExpanded());return}if((!this.titleShimmerSpan||!this.titleShimmerSpan.parentElement)&&(r.textContent="",this.titleShimmerSpan=_("span.chat-thinking-title-shimmer"),r.appendChild(this.titleShimmerSpan)),this.titleShimmerSpan.textContent=o,this._titleDetailRendered.clear(),!n)this.titleDetailContainer&&(this.titleDetailContainer.remove(),this.titleDetailContainer=void 0);else{let l=this.chatContentMarkdownRenderer.render(new he(n));l.element.classList.add("collapsible-title-content","chat-thinking-title-detail"),N_(l.element,this.instantiationService,this.chatMarkdownAnchorService,this._store),this._titleDetailRendered.value=l,this.titleDetailContainer?this.titleDetailContainer.replaceWith(l.element):r.appendChild(l.element),this.titleDetailContainer=l.element}let s=`${o}${n}`;this._collapseButton.element.ariaLabel=s,this._collapseButton.element.ariaExpanded=String(this.isExpanded())}updateHover(){!this.modelName||!this._collapseButton||(this._hoverDisposable.value=this.hoverService.setupDelayedHover(this._collapseButton.element,{content:d(8836,null,this.modelName)}))}trackToolState(e){if(e.kind!=="toolInvocation")return;let t=e.invocationMessage,o=typeof t=="string"?t:t.value;this.currentRunningToolMessage=o,this.updateTitle();let n=this._addToolToCarousel,r=this._shouldUseCarouselForTool,s=!1,l=!1;this._register(ve(c=>{let u=e.state.read(c),p=u.type===pi.StateKind.WaitingForConfirmation||u.type===pi.StateKind.WaitingForPostApproval,h=!!n&&r?.(e,u)===!0;p&&!s?(this.toolsWaitingForConfirmation++,this.isExpanded()||(this.autoExpandedForConfirmation=!0,this.setExpanded(!0)),this.removeWorkingSpinner()):!p&&s&&(this.toolsWaitingForConfirmation--,this.toolsWaitingForConfirmation===0&&this.autoExpandedForConfirmation&&!this.userManuallyExpanded&&(this.autoExpandedForConfirmation=!1,this.setExpanded(!1)),this.toolsWaitingForConfirmation===0&&this.isActive&&this.showWorkingSpinner()),h&&!l?(this.toolsWaitingForCarouselConfirmation++,n(e),this.showConfirmationPlaceholder()):!h&&l&&(this.toolsWaitingForCarouselConfirmation--,this.toolsWaitingForCarouselConfirmation===0?this.hideConfirmationPlaceholder():this.updateConfirmationPlaceholderLabel()),s=p,l=h}))}getConfirmationPlaceholderText(){let e=this.toolsWaitingForCarouselConfirmation;return e===1?d(8837,null):d(8838,null,e)}updateConfirmationPlaceholderLabel(){this._confirmationPlaceholderLabel&&(this._confirmationPlaceholderLabel.textContent=this.getConfirmationPlaceholderText())}showConfirmationPlaceholder(){if(this._confirmationPlaceholder){this.updateConfirmationPlaceholderLabel();return}let e=_("button.chat-subagent-confirmation-placeholder"),t=_("span.chat-subagent-placeholder-label");t.textContent=this.getConfirmationPlaceholderText(),e.appendChild(t),this._confirmationPlaceholder=e,this._confirmationPlaceholderLabel=t;let o=new O;o.add($(e,"click",n=>{n.preventDefault(),n.stopPropagation(),this._navigateToCarousel?.(this.subAgentInvocationId)})),this._confirmationPlaceholderDisposable.value=o,this.hasToolItems||(this.hasToolItems=!0,this.wrapper&&(this.wrapper.style.display="")),this.isExpanded()||(this.autoExpandedForConfirmation=!0,this.setExpanded(!0)),this.wrapper&&this.wrapper.appendChild(e),this.layoutScheduler.schedule()}hideConfirmationPlaceholder(){this._confirmationPlaceholder&&(this._confirmationPlaceholder.remove(),this._confirmationPlaceholder=void 0,this._confirmationPlaceholderLabel=void 0,this._confirmationPlaceholderDisposable.clear(),this.layoutScheduler.schedule())}ensurePlaceholderAtBottom(){this._confirmationPlaceholder?.parentElement===this.wrapper&&this.wrapper.appendChild(this._confirmationPlaceholder)}watchToolCompletion(e){if(qR.isParentSubagentTool(e))if(e.kind==="toolInvocation"){let t=e.state.get().type===pi.StateKind.Streaming;this._register(ve(o=>{let n=e.state.read(o);if(n.type===pi.StateKind.Completed){t=!1;let r=(n.contentForModel||[]).filter(s=>s.kind==="text").map(s=>s.value);r.length>0&&this.renderResultText(r.join(`
`)),e.toolSpecificData?.kind==="subagent"&&(e.toolSpecificData.description&&(this.description=e.toolSpecificData.description,this._isDefaultDescription=!1),e.toolSpecificData.modelName&&(this.modelName=e.toolSpecificData.modelName,this.updateHover())),this.markAsInactive()}else if(t&&n.type!==pi.StateKind.Streaming){t=!1;let{description:r,isDefaultDescription:s,agentName:l,prompt:c,modelName:u}=qR.extractSubagentInfo(e);this.description=r,this._isDefaultDescription=s,this.agentName=l,this.prompt=c,u&&(this.modelName=u,this.updateHover()),this.renderPromptSection(),this.updateTitle()}else if(e.toolSpecificData?.kind==="subagent"){let{description:r,isDefaultDescription:s,agentName:l}=qR.extractSubagentInfo(e),c=this._isDefaultDescription&&!s,u=!!l&&l!==this.agentName;(c||u)&&(c&&(this.description=r,this._isDefaultDescription=s),u&&(this.agentName=l),this.updateTitle())}}))}else e.toolSpecificData?.kind==="subagent"&&e.toolSpecificData.result&&(this.renderResultText(e.toolSpecificData.result),this.markAsInactive())}renderResultText(e){if(!(this.resultContainer||!e)){if(!this.wrapper||this.isInitiallyComplete&&!this.isExpanded()&&!this.hasExpandedOnce){this.pendingResultText=e;return}this.pendingResultText=void 0,this.doRenderResultText(e)}}doRenderResultText(e){if(this.resultContainer||!e)return;let t=e.split(`
`),o=t[0]||"",n=t.slice(1).join(`
`).trim(),r=ibt(o,zst),l=o.length>zst?r+"\u2026":r,c=o.length>r.length?o.slice(r.length).trim():"",u=c?c+(n?`
`+n:""):n,p=this._register(this.instantiationService.createInstance(mve,l,u,this.context,this.chatContentMarkdownRenderer));this.resultContainer=_(".chat-thinking-tool-wrapper.chat-subagent-section");let h=zq(L.check);this.resultContainer.appendChild(h),this.resultContainer.appendChild(p.domNode),this.wrapper&&(D(this.wrapper,this.resultContainer),this.wrapper.style.display==="none"&&(this.wrapper.style.display=""))}appendToolInvocation(e,t){if(this.hasToolItems||(this.hasToolItems=!0,this.wrapper&&(this.wrapper.style.display="")),this.trackToolState(e),this.isExpanded()||this.hasExpandedOnce){let o=this.createToolPart(e,t);this.appendToolPartToDOM(o,e)}else{let o={kind:"tool",lazy:new uo(()=>this.createToolPart(e,t)),toolInvocation:e,codeBlockStartIndex:t};this.lazyItems.push(o)}}appendMarkdownItem(e,t,o,n,r){if(r&&this._register(r),this.isExpanded()||this.hasExpandedOnce){let s=e();this.appendMarkdownItemToDOM(s.domNode),s.disposable&&s.disposable!==r&&this._register(s.disposable)}else{let s={kind:"markdown",lazy:new uo(e),eagerlyRegistered:!!r};this.lazyItems.push(s)}}appendHookItem(e,t){let o=t.stopReason?t.toolDisplayName?d(8846,null,t.toolDisplayName):d(8847,null):t.toolDisplayName?d(8848,null,t.toolDisplayName):d(8849,null);if(this.currentRunningToolMessage=o,this.updateTitle(),this.isExpanded()||this.hasExpandedOnce){let n=e();this.appendHookItemToDOM(n.domNode,t),n.disposable&&this._register(n.disposable)}else{let n={kind:"hook",lazy:new uo(e),hookPart:t};this.lazyItems.push(n)}}appendHookItemToDOM(e,t){let o=_(".chat-thinking-tool-wrapper"),n=t.stopReason?L.error:L.warning,r=zq(n);o.appendChild(r),o.appendChild(e),this.hasToolItems||(this.hasToolItems=!0,this.wrapper&&(this.wrapper.style.display="")),this.wrapper&&(this.resultContainer?this.wrapper.insertBefore(o,this.resultContainer):this.wrapper.appendChild(o)),this.lastItemWrapper=o,this.layoutScheduler.schedule()}appendMarkdownItemToDOM(e){if(!e.hasChildNodes()||e.textContent?.trim()==="")return;let t=_(".chat-thinking-tool-wrapper"),o=zq(L.edit);t.appendChild(e),t.insertBefore(o,t.firstChild),this.wrapper&&(this.resultContainer?this.wrapper.insertBefore(t,this.resultContainer):this.wrapper.appendChild(t)),this.lastItemWrapper=t,this.layoutScheduler.schedule()}shouldInitEarly(){return!1}createToolPart(e,t){let o=this.instantiationService.createInstance(c1,e,this.context,this.chatContentMarkdownRenderer,this.listPool,this.editorPool,this.currentWidthDelegate,this.announcedToolProgressKeys,t);return this._register(o),o}appendToolPartToDOM(e,t){let o=e.domNode;if(!o.hasChildNodes()||o.textContent?.trim()==="")return;let n=_(".chat-thinking-tool-wrapper"),r=IAi(t.toolId,t.icon),s=zq(r);if(n.appendChild(o),t.kind==="toolInvocation"){let l=this._shouldUseCarouselForTool;this._register(ve(c=>{let u=t.state.read(c),p=u.type===pi.StateKind.WaitingForConfirmation||u.type===pi.StateKind.WaitingForPostApproval,h=l?.(t,u)===!0;p?(s.remove(),h?n.style.display="none":n.style.display=""):(s.parentElement||n.insertBefore(s,n.firstChild),this._useCarouselForConfirmations&&(n.style.display="",this.ensurePlaceholderAtBottom()))}))}else n.insertBefore(s,n.firstChild);if(this.wrapper){let l=this._confirmationPlaceholder??this.workingSpinnerElement??this.resultContainer;l?this.wrapper.insertBefore(n,l):this.wrapper.appendChild(n)}this.lastItemWrapper=n,this.layoutScheduler.schedule()}materializeLazyItem(e){if(!e.lazy.hasValue){if(e.kind==="tool"){let t=e.lazy.value;this.appendToolPartToDOM(t,e.toolInvocation)}else if(e.kind==="markdown"){let t=e.lazy.value;this.appendMarkdownItemToDOM(t.domNode),t.disposable&&!e.eagerlyRegistered&&this._register(t.disposable)}else if(e.kind==="hook"){let t=e.lazy.value;this.appendHookItemToDOM(t.domNode,e.hookPart),t.disposable&&this._register(t.disposable)}}}materializePendingContent(){if(this.wrapper){this.pendingPromptRender&&(this.pendingPromptRender=!1,this.doRenderPromptSection());for(let e of this.lazyItems)this.materializeLazyItem(e);if(this.pendingResultText){let e=this.pendingResultText;this.pendingResultText=void 0,this.doRenderResultText(e)}}}performLayout(){if(this.lastItemWrapper&&this.wrapper){let e=this.lastItemWrapper.offsetHeight;e>0&&this.wrapper.style.setProperty("--chat-subagent-last-item-height",`${e}px`)}if(this.isActive&&!this.isInitiallyComplete&&this.wrapper){let e=this.wrapper.scrollHeight;this.wrapper.scrollTop=e}}hasSameContent(e,t,o){if(e.kind==="markdownContent")return!0;if(e.kind==="hook"&&e.subAgentInvocationId)return this.subAgentInvocationId===e.subAgentInvocationId;if((e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&(e.subAgentInvocationId||qR.isParentSubagentTool(e))){let n=e.subAgentInvocationId??e.toolCallId;return this.subAgentInvocationId&&n?this.subAgentInvocationId===n:!this.subAgentInvocationId&&!n}return!1}};qR=I([m(8,F),m(9,gS),m(10,ot),m(11,B)],qR);var Tpn=_,wve=class extends k{constructor(e,t,o){super();this.openerService=o;let n=this._register(t.get());this.tree=n.object,this.onDidFocus=this.tree.onDidFocus,this._register(this.tree.onDidOpen(r=>{r.element&&!("children"in r.element)&&this.openerService.open(r.element.uri)})),this._register(this.tree.onContextMenu(r=>{r.browserEvent.preventDefault(),r.browserEvent.stopPropagation()})),this.tree.setInput(e).then(()=>{n.isStale()||this.tree.layout()}),this.domNode=this.tree.getHTMLElement().parentElement}domFocus(){this.tree.domFocus()}hasSameContent(e){return e.kind==="treeData"}addDisposable(e){this._register(e)}};wve=I([m(2,Je)],wve);var OWe=class extends k{constructor(e,t,o,n){super();this._onDidChangeVisibility=e;this.instantiationService=t;this.configService=o;this.themeService=n;this._pool=this._register(new jq(()=>this.treeFactory()))}get inUse(){return this._pool.inUse}treeFactory(){let e=new O,t=e.add(this.instantiationService.createInstance(jl,{onDidChangeVisibility:this._onDidChangeVisibility})),o=Tpn(".interactive-response-progress-tree");return e.add(S6(o,this.themeService)),{tree:this.instantiationService.createInstance(qy,"ChatListRenderer",o,new SNi,new INi,[new yNi(t,this.configService.getValue("explorer.decorations"))],new wNi,{collapseByDefault:()=>!1,expandOnlyOnTwistieClick:()=>!1,identityProvider:{getId:r=>r.uri.toString()},accessibilityProvider:{getAriaLabel:r=>r.label,getWidgetAriaLabel:()=>d(8917,null)},alwaysConsumeMouseWheel:!1}),dispose:()=>e.dispose()}}get(){let e=this._pool.get(),t=!1;return{object:e.tree,isStale:()=>t,dispose:()=>{t=!0,this._pool.release(e)}}}clear(){this._pool.clear()}};OWe=I([m(1,F),m(2,B),m(3,Pe)],OWe);var SNi=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){return"chatListTreeTemplate"}},INi=class{isIncompressible(i){return!i.children}},yNi=class{constructor(i,e){this.labels=i;this.decorations=e;this.templateId="chatListTreeTemplate"}renderCompressedElements(i,e,t){t.label.element.style.display="flex";let o=i.element.elements.map(n=>n.label);t.label.setResource({resource:i.element.elements[0].uri,name:o},{title:i.element.elements[0].label,fileKind:i.children?1:0,extraClasses:["explorer-item"],fileDecorations:this.decorations})}renderTemplate(i){let e=new O,t=e.add(this.labels.create(i,{supportHighlights:!0}));return{templateDisposables:e,label:t}}renderElement(i,e,t){t.label.element.style.display="flex",!i.children.length&&i.element.type!==2?t.label.setFile(i.element.uri,{fileKind:0,hidePath:!0,fileDecorations:this.decorations}):t.label.setResource({resource:i.element.uri,name:i.element.label},{title:i.element.label,fileKind:1,fileDecorations:this.decorations})}disposeTemplate(i){i.templateDisposables.dispose()}},wNi=class{hasChildren(i){return!!i.children}async getChildren(i){return i.children??[]}};var FWe=class extends k{constructor(e,t,o,n,r,s){super();this.workspaceEdit=e;this.instantiationService=n;this.chatMarkdownAnchorService=r;this.labelService=s;this.domNode=_(".chat-workspace-edit-content-part");let l=(c,u)=>{let p=this._register(o.render(new he(c,{isTrusted:!0})));p.element.classList.add("progress-step"),N_(p.element,this.instantiationService,this.chatMarkdownAnchorService,this._store);let h=this._register(this.instantiationService.createInstance(VE,p.element,u,void 0));D(this.domNode,h.domNode)};for(let c of e.edits)c.oldResource&&!c.newResource?l(d(8919,null,this.labelService.getUriBasenameLabel(c.oldResource)),L.trash):!c.oldResource&&c.newResource?l(d(8918,null,c.newResource.toString()),L.newFile):c.oldResource&&c.newResource&&l(d(8920,null,this.labelService.getUriBasenameLabel(c.oldResource),c.newResource.toString()),L.arrowRight)}hasSameContent(e,t,o){if(e.kind!=="workspaceEdit"||e.edits.length!==this.workspaceEdit.edits.length)return!1;for(let n=0;n<e.edits.length;n++){let r=e.edits[n],s=this.workspaceEdit.edits[n];if(r.oldResource?.toString()!==s.oldResource?.toString()||r.newResource?.toString()!==s.newResource?.toString())return!1}return!0}};FWe=I([m(3,F),m(4,gS),m(5,nt)],FWe);function _pn(a){return yC[a]?.label??a}var hne=class extends O_{constructor(e,t,o,n){let r=_pn(e.hookType),s=!!e.stopReason,l=!!e.systemMessage,c=e.toolDisplayName,u=s?c?d(8703,null,c,r):d(8702,null,r):c?d(8705,null,c,r):d(8704,null,r);super(u,t,void 0,o,n);this.hookPart=e;this.icon=s?L.error:l?L.warning:L.check,s?this.domNode.classList.add("chat-hook-outcome-blocked"):l&&this.domNode.classList.add("chat-hook-outcome-warning"),this.setExpanded(!1)}initContent(){let e=_(".chat-hook-details.chat-used-context-list");if(this.hookPart.stopReason){let o=_(".chat-hook-reason",void 0,this.hookPart.stopReason);e.appendChild(o)}let t=this.hookPart.hookType==="PreToolUse"||this.hookPart.hookType==="PostToolUse";if(this.hookPart.systemMessage&&(t||!this.hookPart.stopReason)){let o=_(".chat-hook-message",void 0,this.hookPart.systemMessage);e.appendChild(o)}return e}hasSameContent(e,t,o){return e.kind!=="hook"?!1:e.hookType===this.hookPart.hookType&&e.stopReason===this.hookPart.stopReason&&e.systemMessage===this.hookPart.systemMessage&&e.toolDisplayName===this.hookPart.toolDisplayName}};hne=I([m(2,ot),m(3,B)],hne);var nv=_,PEo="GitHub Copilot",Dpn=50,Rpn=!1,Lpn="chat-most-recent-response";function Mpn(a){switch(a){case"confetti":return 1;case"floatingThumbs":return 2;case"pulseWave":return 3;case"radiantLines":return 4;default:return}}var _6=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super();this.rendererOptions=t;this.delegate=o;this.viewModel=r;this.instantiationService=s;this.configService=l;this.logService=c;this.contextKeyService=u;this.themeService=p;this.commandService=h;this.hoverService=g;this.chatWidgetService=f;this.chatEntitlementService=v;this.chatService=b;this.accessibilitySignalService=S;this.accessibilityService=y;this.environmentService=w;this.telemetryService=x;this.codeBlocksByResponseId=new Map;this.codeBlocksByEditorUri=new dt;this.fileTreesByResponseId=new Map;this.focusedFileTreesByResponseId=new Map;this.templateDataByRequestId=new Map;this.responseTemplateDataByRequestId=new Map;this.pendingQuestionCarousels=new dt;this._notifiedQuestionCarousels=new Set;this.workingProgressConfirmationEndListeners=new WeakSet;this._onDidClickFollowup=this._register(new T);this.onDidClickFollowup=this._onDidClickFollowup.event;this._onDidClickRerunWithAgentOrCommandDetection=this._register(new T);this.onDidClickRerunWithAgentOrCommandDetection=this._onDidClickRerunWithAgentOrCommandDetection.event;this._onDidClickRequest=this._register(new T);this.onDidClickRequest=this._onDidClickRequest.event;this._onDidRerender=this._register(new T);this.onDidRerender=this._onDidRerender.event;this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event;this._onDidFocusOutside=this._register(new T);this.onDidFocusOutside=this._onDidFocusOutside.event;this._onDidChangeItemHeight=this._register(new T);this.onDidChangeItemHeight=this._onDidChangeItemHeight.event;this._onDidUpdateViewModel=this._register(new T);this._currentLayoutWidth=De(this,0);this._isVisible=!0;this._onDidChangeVisibility=this._register(new T);this._incrementalRenderingTelemetryLogged=!1;this._announcedToolProgressKeys=new Set;this.chatContentMarkdownRenderer=this.instantiationService.createInstance(zoe),this.markdownDecorationsRenderer=this.instantiationService.createInstance(qoe),this._editorPool=this._register(this.instantiationService.createInstance(dve,e,o,n,!0)),this._toolEditorPool=this._register(this.instantiationService.createInstance(dve,e,o,n,!0)),this._diffEditorPool=this._register(this.instantiationService.createInstance(uWe,e,o,n,!0)),this._treePool=this._register(this.instantiationService.createInstance(OWe,this._onDidChangeVisibility.event)),this._contentReferencesListPool=this._register(this.instantiationService.createInstance(dne,this._onDidChangeVisibility.event,void 0,void 0)),this._inlineTextModels=this._register(this.instantiationService.createInstance(pWe)),this._register(this.instantiationService.createInstance(GFe)),this._register(this.chatService.onDidSubmitRequest(E=>{let M=this.pendingQuestionCarousels.get(E.chatSessionResource);if(M){for(let N of M)N.skip();M.clear()}})),this._register(this.configService.onDidChangeConfiguration(E=>{if(E.affectsConfiguration("chat.autoReply")&&this.configService.getValue("chat.autoReply"))for(let[,M]of this.pendingQuestionCarousels){for(let N of M)N.skip();M.clear()}}))}static{this.ID="item"}set pendingDragController(e){this._pendingDragController=e}updateOptions(e){this.rendererOptions={...this.rendererOptions,...e}}get templateId(){return _6.ID}editorsInUse(){return yt.concat(this._editorPool.inUse(),this._toolEditorPool.inUse())}traceLayout(e,t){Rpn?this.logService.info(`ChatListItemRenderer#${e}: ${t}`):this.logService.trace(`ChatListItemRenderer#${e}: ${t}`)}fireItemHeightChange(e,t){if(!e.currentElement||!e.rowContainer.isConnected)return;let o=t??e.rowContainer.getBoundingClientRect().height;if(o===0||!o)return;let n=Math.ceil(o);if(n===e.currentElement.currentRenderedHeight)return;let r=e.currentElement.currentRenderedHeight;e.currentElement.currentRenderedHeight=n,e.currentElement!==this._elementBeingRendered&&typeof r=="number"&&this._onDidChangeItemHeight.fire({element:e.currentElement,height:n})}getProgressiveRenderRate(e){let t;(l=>(l[l.Min=40]="Min",l[l.Max=2e3]="Max"))(t||={});let o=80,n=e.contentUpdateTimings?.impliedWordLoadRate;return e.isComplete?typeof n=="number"?jn(n,80,2e3):80:typeof n=="number"?jn(n,40,2e3):8}getCodeBlockInfosForResponse(e){return this.codeBlocksByResponseId.get(e.id)??[]}updateViewModel(e){this.viewModel=e,this._announcedToolProgressKeys.clear(),this._notifiedQuestionCarousels.clear(),this.codeBlocksByEditorUri.clear(),this.codeBlocksByResponseId.clear(),this.fileTreesByResponseId.clear(),this.focusedFileTreesByResponseId.clear(),this.responseTemplateDataByRequestId.clear(),this.templateDataByRequestId.clear(),this._onDidUpdateViewModel.fire(),this._editorPool.clear(),this._toolEditorPool.clear(),this._diffEditorPool.clear(),this._treePool.clear(),this._contentReferencesListPool.clear()}getCodeBlockInfoForEditor(e){return this.codeBlocksByEditorUri.get(e)}getFileTreeInfosForResponse(e){return this.fileTreesByResponseId.get(e.id)??[]}getLastFocusedFileTreeForResponse(e){let t=this.fileTreesByResponseId.get(e.id),o=this.focusedFileTreesByResponseId.get(e.id);if(t?.length&&o!==void 0&&o<t.length)return t[o]}getTemplateDataForRequestId(e){if(!e)return;let t=this.templateDataByRequestId.get(e);if(t&&t.currentElement?.id===e)return t;t&&this.templateDataByRequestId.delete(e)}setVisible(e){this._isVisible=e,this._onDidChangeVisibility.fire(e)}layout(e){let t=e-40;if(t!==this._currentLayoutWidth.get()){this._currentLayoutWidth.set(t,void 0);for(let o of this._editorPool.inUse())o.layout(t);for(let o of this._toolEditorPool.inUse())o.layout(t);for(let o of this._diffEditorPool.inUse())o.layout(t)}}renderTemplate(e){let t=new O,o=D(e,nv(".chat-row-disabled-overlay")),n=D(e,nv(".interactive-item-container"));this.rendererOptions.renderStyle==="compact"&&n.classList.add("interactive-item-compact");let r=n,s=n,l;if(this.rendererOptions.renderStyle==="minimal"){n.classList.add("interactive-item-compact"),n.classList.add("minimal");let Ee=D(n,nv(".column.left")),Te=D(n,nv(".column.right"));r=Ee,l=Te,s=Te}let c=D(r,nv(".header")),u=t.add(this.contextKeyService.createScoped(n)),p=t.add(this.instantiationService.createChild(new Po([X,u]))),h=D(n,nv(".request-hover")),g;this.rendererOptions.noHeader?c.classList.add("hidden"):g=t.add(p.createInstance(pr,h,R.ChatMessageTitle,{menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ee=>Ee.actions.length<=1}})),this.hoverHidden(h);let f=D(n,nv(".checkpoint-container"));D(f,nv(".checkpoint-line-left"));let v=t.add(p.createInstance(pr,f,R.ChatMessageCheckpoint,{actionViewItemProvider:(Ee,Te)=>{if(Ee instanceof Do)return this.instantiationService.createInstance(CP,Ee,{hoverDelegate:Te.hoverDelegate})},renderDropdownAsChildElement:!0,menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ee=>Ee.actions.length<=1}}));D(f,nv(".checkpoint-line-right"));let b=D(c,nv(".user")),S=D(b,nv(".avatar-container")),y=D(b,nv("h3.username"));y.tabIndex=0;let w=D(l??b,nv("span.detail-container")),x=D(w,nv("span.detail"));D(w,nv("span.chat-animated-ellipsis"));let E=D(s,nv(".value")),M=t.add(new O),N=D(n,nv(".chat-footer-toolbar"));this.rendererOptions.noFooter&&N.classList.add("hidden");let V=t.add(p.createInstance(pr,N,R.ChatMessageFooter,{menuOptions:{shouldForwardArgs:!0,renderShortTitle:!0},toolbarOptions:{shouldInlineSubmenu:Ee=>Ee.actions.length<=1},actionViewItemProvider:(Ee,Te)=>{if(Ee instanceof Do&&Ee.item.id===nEo){let It=Mpn(this.configService.getValue("chat.upvoteAnimation"));return p.createInstance(Cl,Ee,{...Te,onClickAnimation:It})}return ta(p,Ee,Te)}})),H=D(V.getElement(),nv(".chat-footer-details"));H.tabIndex=0;let K=D(n,nv(".checkpoint-restore-container"));D(K,nv(".checkpoint-line-left"));let j=D(K,nv("span.checkpoint-label-text"));j.textContent=d(9056,null);let J=D(K,nv("span.checkpoint-dot-separator"));J.textContent="\xB7",J.setAttribute("aria-hidden","true");let se=t.add(p.createInstance(pr,K,R.ChatMessageRestoreCheckpoint,{actionViewItemProvider:(Ee,Te)=>{if(Ee instanceof Do)return this.instantiationService.createInstance(CP,Ee,{hoverDelegate:Te.hoverDelegate})},renderDropdownAsChildElement:!0,menuOptions:{shouldForwardArgs:!0},toolbarOptions:{shouldInlineSubmenu:Ee=>Ee.actions.length<=1}}));D(K,nv(".checkpoint-line-right"));let ae=t.add(this.instantiationService.createInstance(Bq)),ce=()=>{if(Ni(xe.currentElement)&&xe.currentElement.agent&&!xe.currentElement.agent.isDefault)return ae.setAgent(xe.currentElement.agent.id),ae.domNode},Se=zFe(()=>Ni(xe.currentElement)?xe.currentElement.agent:void 0,this.commandService);t.add(this.hoverService.setupManagedHover(yi("element"),b,ce,Se)),t.add($(b,ne.KEY_DOWN,Ee=>{let Te=new mi(Ee);if(Te.equals(10)||Te.equals(3)){let It=ce();It&&this.hoverService.showInstantHover({content:It,target:b,trapFocus:!0,actions:Se.actions},!0)}else Te.equals(9)&&this.hoverService.hideHover()}));let Re=document.createElement("connection-observer");D(e,Re);let xe={header:c,avatarContainer:S,requestHover:h,username:y,detail:x,value:E,rowContainer:n,elementDisposables:M,templateDisposables:t,contextKeyService:u,instantiationService:p,agentHover:ae,titleToolbar:g,footerToolbar:V,footerDetailsContainer:H,disabledOverlay:o,checkpointToolbar:v,checkpointRestoreToolbar:se,checkpointContainer:f,checkpointRestoreContainer:K};Re.onDidDisconnect=()=>{xe.renderedPartsMounted=!1},t.add(this._onDidUpdateViewModel.event(()=>{(!xe.currentElement||!this.viewModel?.sessionResource||!ze(xe.currentElement.sessionResource,this.viewModel.sessionResource))&&this.clearRenderedParts(xe)})),t.add($(o,ne.CLICK,Ee=>{if(!this.viewModel?.editing)return;let Te=xe.currentElement;!Te||Te.id===this.viewModel.editing.id||o.classList.contains("disabled")&&(Ee.preventDefault(),Ee.stopPropagation(),this._onDidFocusOutside.fire())}));let He=t.add(new zu("ChatListItemRenderer.itemHeight",Ee=>{let Te=Ee[0];Te&&this.fireItemHeightChange(xe,Te.borderBoxSize.at(0)?.blockSize)}));return t.add(He.observe(n)),xe}renderElement(e,t,o){this._elementBeingRendered=e.element;try{this.renderChatTreeItem(e.element,t,o)}finally{this._elementBeingRendered=void 0}}clearRenderedParts(e){e.renderedParts?(je(ui(e.renderedParts)),e.renderedParts=void 0,St(e.value)):ket(e.currentElement)&&St(e.value),e.movedOutToolParts?.dispose(),e.movedOutToolParts=void 0,e.titleToolbar&&(e.titleToolbar.context=void 0),e.footerToolbar.context=void 0,e.checkpointToolbar.context=void 0,e.checkpointRestoreToolbar.context=void 0,e.currentElement=void 0}renderChatTreeItem(e,t,o){if(o.currentElement&&o.currentElement.id!==e.id){this.traceLayout("renderChatTreeItem",`Rendering a different element into the template, index=${t}`);let x=this.templateDataByRequestId.get(o.currentElement.id);x&&x.currentElement?.id!==o.currentElement.id&&this.templateDataByRequestId.delete(o.currentElement.id),this.clearRenderedParts(o)}if(o.currentElement=e,this.templateDataByRequestId.set(e.id,o),o.rowContainer.classList.remove("pending-item","pending-divider","pending-request","chat-pending-dragging"),o.dragHandle?.remove(),o.dragHandle=void 0,delete o.rowContainer.dataset.pendingRequestId,delete o.rowContainer.dataset.pendingKind,ket(e)){this.renderPendingDivider(e,o);return}let n=_r(e)?"request":Ni(e)?"response":ket(e)?"pendingDivider":"welcome";this.traceLayout("renderElement",`${n}, index=${t}`),Z.isResponse.bindTo(o.contextKeyService).set(Ni(e)),Z.itemId.bindTo(o.contextKeyService).set(e.id),Z.isRequest.bindTo(o.contextKeyService).set(_r(e)),Z.isFirstRequest.bindTo(o.contextKeyService).set(_r(e)&&this.viewModel?.model.getRequests()[0]?.id===e.id),Z.isPendingRequest.bindTo(o.contextKeyService).set(_r(e)&&!!e.pendingKind),Z.responseDetectedAgentCommand.bindTo(o.contextKeyService).set(Ni(e)&&e.agentOrSlashCommandDetected),Ni(e)?(Z.responseSupportsIssueReporting.bindTo(o.contextKeyService).set(!!e.agent?.metadata.supportIssueReporting),Z.responseVote.bindTo(o.contextKeyService).set(e.vote===1?"up":e.vote===0?"down":"")):Z.responseVote.bindTo(o.contextKeyService).set(""),o.titleToolbar&&(o.titleToolbar.context=e),o.footerToolbar.context=e,Ni(e)&&e.result?.details?(o.footerDetailsContainer.textContent=e.result.details,o.footerDetailsContainer.classList.remove("hidden")):o.footerDetailsContainer.classList.add("hidden"),Z.responseHasError.bindTo(o.contextKeyService).set(Ni(e)&&!!e.errorDetails);let r=!!(Ni(e)&&e.errorDetails?.responseIsFiltered);Z.responseIsFiltered.bindTo(o.contextKeyService).set(r);let s=this.chatWidgetService.getWidgetBySessionResource(e.sessionResource)?.location;o.rowContainer.classList.toggle("editing-session",s==="panel"),o.rowContainer.classList.toggle("interactive-request",_r(e)),o.rowContainer.classList.toggle("interactive-response",Ni(e));let l=cte(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse);o.rowContainer.classList.toggle("show-detail-progress",Ni(e)&&!e.isComplete&&!e.progressMessages.length&&!l),o.rowContainer.classList.toggle("chat-progress-reservable",Ni(e)&&!e.isComplete&&!!l);let c=()=>o.rowContainer.classList.toggle("show-checkmarks",!!this.configService.getValue("accessibility.chat.showCheckmarks"));c(),o.elementDisposables.add(this.configService.onDidChangeConfiguration(x=>{x.affectsConfiguration("accessibility.chat.showCheckmarks")&&c()})),this.rendererOptions.noHeader||this.renderAvatar(e,o);let u=_r(e)&&!!e.isSystemInitiated;o.username.textContent=e.username,o.username.classList.toggle("hidden",e.username===PEo||this.environmentService.isSessionsWindow||u),o.avatarContainer.classList.toggle("hidden",e.username===PEo||this.environmentService.isSessionsWindow||u),this.hoverHidden(o.requestHover),St(o.detail),Ni(e)&&this.renderDetail(e,o),o.checkpointToolbar.context=e;let p=this.rendererOptions.supportsFork||(this.rendererOptions.restorable??!0),h=this.configService.getValue("chat.checkpoints.enabled")&&p,g=_r(e)&&!!e.pendingKind;if(o.checkpointContainer.classList.toggle("hidden",Ni(e)||g||u||!h),o.footerToolbar.refresh(),o.checkpointToolbar.refresh(),o.checkpointRestoreToolbar.refresh(),Ni(e)&&(this.responseTemplateDataByRequestId.set(e.requestId,o),o.elementDisposables.add(ee(()=>this.responseTemplateDataByRequestId.delete(e.requestId)))),!g){let x=E=>{let M=_r(e)?e.id:Ni(e)?e.requestId:void 0;if(!M)return;let N=this.templateDataByRequestId.get(M),V=this.responseTemplateDataByRequestId.get(M);N?.checkpointContainer.classList.toggle("group-hovered",E),V?.rowContainer.classList.toggle("group-hovered",E)};o.elementDisposables.add($(o.rowContainer,ne.MOUSE_ENTER,()=>x(!0))),o.elementDisposables.add($(o.rowContainer,ne.MOUSE_LEAVE,()=>x(!1))),o.elementDisposables.add(ee(()=>x(!1)))}let f=this.viewModel?.model.checkpoint&&!this.viewModel?.editing&&t===this.delegate.getListLength()-1&&!g;o.checkpointRestoreContainer.classList.toggle("hidden",!(f&&h));let v=e.id===this.viewModel?.editing?.id,b=this.configService.getValue("chat.editRequests")==="input";o.elementDisposables.add(ve(x=>{let E=e.shouldBeBlocked.read(x);o.disabledOverlay.classList.toggle("disabled",E&&!v&&this.viewModel?.editing!==void 0)})),o.rowContainer.classList.toggle("editing",v&&!b),o.rowContainer.classList.toggle("editing-input",v&&b),o.requestHover.classList.toggle("editing",v&&b),o.requestHover.classList.toggle("hidden",!!this.viewModel?.editing&&!v||Ni(e)||!this.rendererOptions.editable||u),o.requestHover.classList.toggle("expanded",this.configService.getValue("chat.editRequests")==="hover"),o.requestHover.classList.toggle("checkpoints-enabled",h),o.elementDisposables.add(Yo(o.rowContainer,ne.CLICK,x=>{let E=o.currentElement;E&&this.viewModel?.editing&&E.id!==this.viewModel.editing.id&&(x.stopPropagation(),x.preventDefault(),this._onDidFocusOutside.fire())}));let S=o.rowContainer.parentElement?.parentElement?.parentElement;S?.classList.toggle("request",_r(e)),S?.classList.toggle("response",Ni(e)),o.rowContainer.classList.toggle(Lpn,t===this.delegate.getListLength()-1),o.rowContainer.classList.toggle("confirmation-message",_r(e)&&!!e.confirmation);let y=Ni(e)&&!this.rendererOptions.noHeader&&!u;o.header?.classList.toggle("header-disabled",!y),_r(e)&&e.confirmation&&this.renderConfirmationAction(e,o);let w=this.configService.getValue("chat.experimental.incrementalRendering.enabled");if(Ni(e)&&t===this.delegate.getListLength()-1&&(!e.isComplete||e.renderData))if(this.traceLayout("renderElement",`start progressive render, index=${t}`),w&&!e.renderData)this.logIncrementalRenderingTelemetry(),this.doIncrementalRender(e,t,o);else{let x=o.elementDisposables.add(new LL),E=M=>{try{this.doNextProgressiveRender(e,t,o,!!M)&&x.cancel()}catch(N){x.cancel(),this.logService.error(N)}};x.cancelAndSet(E,50,Me(o.rowContainer)),E(!0)}else if(Ni(e)){if(w){let x=this.getProgressiveRenderRate(e);this._updateMorpherRate(o,x,!0)}this.renderChatResponseBasic(e,t,o)}else _r(e)&&this.renderChatRequest(e,t,o);o.renderedPartsMounted=!0}renderPendingDivider(e,t){t.rowContainer.classList.add("pending-item"),t.rowContainer.classList.add("pending-divider"),t.rowContainer.classList.remove("interactive-request","interactive-response","pending-request"),t.avatarContainer.classList.add("hidden"),t.username.classList.add("hidden"),t.requestHover.classList.add("hidden"),t.checkpointContainer.classList.add("hidden"),t.checkpointRestoreContainer.classList.add("hidden"),t.footerToolbar.getElement().classList.add("hidden"),t.titleToolbar&&t.titleToolbar.getElement().classList.add("hidden"),St(t.value),St(t.detail);let o=_(".pending-divider-content"),n=D(o,_("span.pending-divider-label"));e.dividerKind==="steering"?e.isSystemInitiated?(n.textContent=d(9069,null),n.title=d(9070,null)):(n.textContent=d(9067,null),n.title=d(9068,null)):(n.textContent=d(9063,null),n.title=d(9064,null)),t.value.appendChild(o)}renderDetail(e,t){if(St(t.detail),e.agentOrSlashCommandDetected){let o=e.slashCommand?d(9072,null,`${cp}${e.slashCommand.name}`):d(9071,null);Ii(t.detail,Jk(o,{actionHandler:{disposables:t.elementDisposables,callback:n=>{this._onDidClickRerunWithAgentOrCommandDetection.fire(e)}}},nv("span.agentOrSlashCommandDetected")))}else this.rendererOptions.renderStyle!=="minimal"&&!e.isComplete&&!cte(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse)&&(t.detail.textContent=d(9073,null))}renderConfirmationAction(e,t){St(t.detail),e.confirmation&&(D(t.detail,nv("span.codicon.codicon-check",{"aria-hidden":"true"})),D(t.detail,nv("span.confirmation-text",void 0,d(9055,null,e.confirmation))),t.header?.classList.remove("header-disabled"),t.header?.classList.add("partially-disabled"))}renderAvatar(e,t){if(ket(e))return;let o;if(Ni(e)?o=this.getAgentIcon(e.agent?.metadata):_r(e)?o=e.avatarIcon??L.account:o=L.account,o instanceof A){let n=_("img.icon");n.src=In.uriToBrowserUri(o).toString(!0),t.avatarContainer.replaceChildren(_(".avatar",void 0,n))}else{let n=_(q.asCSSSelector(o));t.avatarContainer.replaceChildren(_(".avatar.codicon-avatar",void 0,n))}}getAgentIcon(e){return e?.themeIcon?e.themeIcon:e?.iconDark&&cm(this.themeService.getColorTheme().type)?e.iconDark:e?.icon?e.icon:L.chatSparkle}renderChatResponseBasic(e,t,o){o.rowContainer.classList.toggle("chat-response-loading",Ni(e)&&!e.isComplete),this.finalizeCompletedResponseParts(e,o);let n=[];e.errorDetails?.responseIsFiltered||(n.push({kind:"references",references:e.contentReferences}),n.push(...sAi(e.response.value)),e.codeCitations.length&&n.push({kind:"codeCitations",citations:e.codeCitations})),e.model.response===e.model.entireResponse&&e.errorDetails?.message&&e.errorDetails.message!==X7&&n.push({kind:"errorDetails",errorDetails:e.errorDetails,isLast:t===this.delegate.getListLength()-1});let s=this.getChatFileChangesSummaryPart(e);s&&n.push(s);let l=this.shouldShowWorkingProgress(e,n,!1,o);l&&n.push(l);let c=this.diff(o.renderedParts??[],n,e);this.renderChatContentDiff(c,n,e,t,o),this.finalizeCompletedResponseParts(e,o)}finalizeCompletedResponseParts(e,t){if(!e.isComplete&&!e.isCanceled)return;let o=this.getLastThinkingPart(t.renderedParts);o?.domNode&&o.getIsActive()&&(o.finalizeTitleIfDefault(),o.markAsInactive()),this.finalizeAllSubagentParts(t)}shouldShowWorkingProgress(e,t,o,n){if(e.agentOrSlashCommandDetected||this.rendererOptions.renderStyle==="minimal"||t.some(h=>h.kind==="planReview"&&!h.isUsed))return;let r=this.configService.getValue("chat.persistentProgress.enabled")!==!1&&(this.configService.getValue("chat.progressBorder.enabled")!==!0||this.accessibilityService.isMotionReduced());if(e.isComplete)return;let s={confirmationAdjustedTimestamp:e.confirmationAdjustedTimestamp,completionTokenCountObs:e.completionTokenCountObs,isComplete:e.isComplete,completedAt:e.model.completedAt,elapsedMs:e.model.elapsedMs};if(!cte(this.delegate.currentChatMode(),this.rendererOptions.progressMessageAtBottomOfResponse))return;if(Ni(e)&&this.chatWidgetService.getWidgetBySessionResource(e.sessionResource)?.inputPart.hasActiveToolConfirmationCarousel){let g=this.getPendingToolConfirmationCount(t,!1);return g>0?{kind:"working",content:new he().appendText(this.getConfirmationPendingLabel(g))}:this.getPendingToolConfirmationCount(t,!0)>0||this.getSubagentPart(n.renderedParts)?void 0:{kind:"working",content:new he().appendText(this.getConfirmationPendingLabel(1))}}let l;for(let h=t.length-1;h>=0;h--){let g=t[h];if(g.kind!=="markdownContent"||g.content.value.trim().length>0){l=g;break}}if(r){let h=this.getLastThinkingPart(n.renderedParts);return h?.getIsActive()&&!h.isFixedScrollingMode||l?.kind==="progressMessage"?void 0:{kind:"working",state:s}}if(t.some(h=>h.kind==="toolInvocation"&&pi.isStreaming(h))||t.some(h=>h.kind==="toolInvocation"&&!pi.isComplete(h)&&vqt(h))||this.getLastThinkingPart(n.renderedParts))return;if(l&&(l.kind==="toolInvocation"||l.kind==="toolInvocationSerialized")){if(l.isAttachedToThinking)return;let h=pi.isEffectivelyHidden(l),g=this.configService.getValue("chat.agent.thinking.collapsedTools");if(!h&&g!=="off"&&this.shouldPinPart(l,Ni(e)?e:void 0))return}let u=(n.renderedParts??[]).some(h=>h instanceof WE),p=t.some(h=>h.kind==="markdownContent"&&this.hasEditCodeblockUri(h));if(!(u&&p)&&!this.getSubagentPart(n.renderedParts)&&(!l||l.kind==="references"||l.kind==="markdownContent"&&!o&&this.hasBeenCaughtUpLongEnough(e)||(l.kind==="toolInvocation"||l.kind==="toolInvocationSerialized")&&(pi.isComplete(l)||pi.isEffectivelyHidden(l))||(l.kind==="textEditGroup"||l.kind==="notebookEditGroup")&&l.done&&!t.some(h=>h.kind==="toolInvocation"&&!pi.isComplete(h))||l.kind==="progressTask"&&l.deferred.isSettled||l.kind==="mcpServersStarting"||l.kind==="disabledClaudeHooks"||l.kind==="hook"))return{kind:"working"}}getPendingToolConfirmationCount(e,t){return e.filter(o=>{if(o.kind!=="toolInvocation")return!1;let n=o.state.get();return n.type===pi.StateKind.WaitingForConfirmation&&!!n.confirmationMessages?.title&&o.presentation!=="hidden"&&o.source.type!=="mcp"&&CNi(o)===t}).length}getConfirmationPendingLabel(e){return e===1?d(9057,null):d(9058,null,e)}removeWorkingProgressContentPart(e){let t=e.renderedParts;if(t)for(let o=t.length-1;o>=0;o--){let n=t[o];if(n instanceof one){n.dispose(),n.domNode?.remove(),t.splice(o,1),this.fireItemHeightChange(e);return}}}updateWorkingProgressForPendingConfirmations(e){let t=e.currentElement;queueMicrotask(()=>{e.currentElement===t&&this.doUpdateWorkingProgressForPendingConfirmations(e)})}doUpdateWorkingProgressForPendingConfirmations(e){let t=e.currentElement;if(!Ni(t)||t.isComplete&&this.configService.getValue("chat.persistentProgress.enabled")!==!1&&(this.configService.getValue("chat.progressBorder.enabled")!==!0||this.accessibilityService.isMotionReduced()))return;let o=this.getPendingToolConfirmationCount(t.response.value,!1);if(o===0){this.removeWorkingProgressContentPart(e);return}let n=this.getWorkingProgressContentPart(e);n&&n.updateWorkingContent(new he().appendText(this.getConfirmationPendingLabel(o)))}getWorkingProgressContentPart(e){let t=e.renderedParts;if(t)for(let o=t.length-1;o>=0;o--){let n=t[o];if(n instanceof one)return n}}createUpdateWorkingProgressOnConfirmationEnd(e,t){if(this.workingProgressConfirmationEndListeners.has(e))return;this.workingProgressConfirmationEndListeners.add(e);let o=!1,n=ve(r=>{let l=e.state.read(r).type===pi.StateKind.WaitingForConfirmation;o&&!l&&(this.updateWorkingProgressForPendingConfirmations(t),this.workingProgressConfirmationEndListeners.delete(e),n.dispose()),o=l});return ee(()=>{this.workingProgressConfirmationEndListeners.delete(e),n.dispose()})}hasBeenCaughtUpLongEnough(e){let t=e.renderData?.lastRenderTime;return typeof t!="number"||t===0?!1:Date.now()-t>=Dpn}getChatFileChangesSummaryPart(e){if(this.shouldShowFileChangesSummary(e)&&e.model.entireResponse.value.some(t=>t.kind==="textEditGroup"||t.kind==="notebookEditGroup"))return{kind:"changesSummary",requestId:e.requestId,sessionResource:e.sessionResource}}renderChatRequest(e,t,o){if(o.rowContainer.classList.toggle("chat-response-loading",!1),o.rowContainer.classList.toggle("pending-request",!!e.pendingKind),o.rowContainer.classList.toggle("system-initiated-request",!!e.isSystemInitiated),e.isSystemInitiated){this.renderSystemInitiatedRequest(e,o);return}if(e.pendingKind&&this._pendingDragController&&(o.rowContainer.dataset.pendingRequestId=e.id,o.rowContainer.dataset.pendingKind=e.pendingKind,(this.viewModel?.model.getPendingRequests()??[]).filter(u=>u.kind===e.pendingKind).length>1)){let u=_(".chat-pending-drag-handle"+q.asCSSSelector(L.gripper));o.rowContainer.prepend(u),o.dragHandle=u,this._pendingDragController.attachDragHandle(e,u,o.rowContainer,o.elementDisposables)}e.id===this.viewModel?.editing?.id&&this._onDidRerender.fire(o),this.configService.getValue("chat.editRequests")!=="none"&&this.rendererOptions.editable&&o.elementDisposables.add($(o.rowContainer,ne.KEY_DOWN,c=>{let u=new mi(c);(u.equals(10)||u.equals(3))&&this.viewModel?.editing?.id!==e.id&&(u.preventDefault(),u.stopPropagation(),this._onDidClickRequest.fire(o))}));let n=[];if(!e.confirmation){let c=Rao(e.message)?e.message.message:this.markdownDecorationsRenderer.convertParsedRequestToMarkdown(e.sessionResource,e.message);n=[{content:new he(c),kind:"markdownContent"}],this.rendererOptions.renderStyle==="minimal"&&!e.isComplete?(o.value.classList.add("inline-progress"),o.elementDisposables.add(ee(()=>o.value.classList.remove("inline-progress"))),n.push({content:new he("<span></span>",{supportHtml:!0}),kind:"markdownContent"})):o.value.classList.remove("inline-progress")}St(o.value);let r=[],s=!1,l=0;if(n.forEach((c,u)=>{let p={element:e,elementIndex:t,contentIndex:u,content:n,container:o.rowContainer,editorPool:this._editorPool,diffEditorPool:this._diffEditorPool,currentWidth:this._currentLayoutWidth,onDidChangeVisibility:this._onDidChangeVisibility.event,inlineTextModels:this._inlineTextModels,codeBlockStartIndex:l,treeStartIndex:0},h=this.renderChatContentPart(c,o,p);if(h){if(this.rendererOptions.renderDetectedCommandsWithRequest&&!s&&e.agentOrSlashCommandDetected&&e.slashCommand&&c.kind==="markdownContent"){h.domNode&&(h.domNode.style.display="inline-flex");let g=this.instantiationService.createInstance(rWe,e.slashCommand,()=>this._onDidClickRerunWithAgentOrCommandDetection.fire({sessionResource:e.sessionResource,requestId:e.id}));o.value.appendChild(g.domNode),r.push(g),s=!0}h.domNode&&!h.domNode.parentElement&&o.value.appendChild(h.domNode),r.push(h),l+=h.codeblocks?.length??0}}),o.renderedParts&&je(o.renderedParts),o.renderedParts=r,e.variables.length){let c=this.renderAttachments(e.variables,e.contentReferences,e.modelId,o);c.domNode&&o.value.appendChild(c.domNode),o.elementDisposables.add(c)}}renderSystemInitiatedRequest(e,t){St(t.value),t.renderedParts&&je(t.renderedParts),t.renderedParts=[];let o=e.systemInitiatedLabel??e.messageText,n=this.chatContentMarkdownRenderer.render(new he(o));t.elementDisposables.add(n),n.element.classList.add("progress-step");let r=this.instantiationService.createInstance(VE,n.element,L.check,void 0);t.elementDisposables.add(r),t.value.appendChild(r.domNode)}doIncrementalRender(e,t,o){if(!this._isVisible)return;let n=this.getProgressiveRenderRate(e);if(this._updateMorpherRate(o,n,e.isComplete||e.isCanceled),e.isCanceled||e.isComplete){e.renderData=void 0,o.rowContainer.classList.toggle("chat-response-loading",!1),this.renderChatResponseBasic(e,t,o);return}o.rowContainer.classList.toggle("chat-response-loading",!0);let r=this.getNextProgressiveRenderContent(e,o),s=this.diff(o.renderedParts??[],r.content,e);s.every(c=>c===null)||this.renderChatContentDiff(s,r.content,e,t,o)}_updateMorpherRate(e,t,o){let n=e.renderedParts;if(n)for(let r of n)r instanceof UC&&r.updateStreamRate(t,o)}logIncrementalRenderingTelemetry(){this._incrementalRenderingTelemetryLogged||(this._incrementalRenderingTelemetryLogged=!0,this.telemetryService.publicLog2("chatIncrementalRenderingSettings",{animationStyle:this.configService.getValue("chat.experimental.incrementalRendering.animationStyle")??"none",buffering:this.configService.getValue("chat.experimental.incrementalRendering.buffering")??"word"}))}doNextProgressiveRender(e,t,o,n){if(!this._isVisible)return!0;if(e.isCanceled)return this.traceLayout("doNextProgressiveRender",`canceled, index=${t}`),e.renderData=void 0,this.renderChatResponseBasic(e,t,o),!0;o.rowContainer.classList.toggle("chat-response-loading",!0),this.traceLayout("doNextProgressiveRender",`START progressive render, index=${t}`);let r=this.getNextProgressiveRenderContent(e,o),s=this.diff(o.renderedParts??[],r.content,e);return s.every(c=>c===null)?r.moreContentAvailable?(this.traceLayout("doNextProgressiveRender","not rendering any new content this tick, but more available"),!1):e.isComplete?(this.traceLayout("doNextProgressiveRender",`END progressive render, index=${t} and clearing renderData, response is complete`),e.renderData=void 0,this.renderChatResponseBasic(e,t,o),!0):(this.traceLayout("doNextProgressiveRender","caught up with the stream- no new content to render"),!0):(this.traceLayout("doNextProgressiveRender",`doing progressive render, ${s.length} parts to render`),this.renderChatContentDiff(s,r.content,e,t,o),!1)}renderChatContentDiff(e,t,o,n,r){let s=r.renderedParts??[];r.renderedParts=s;let l=0,c=0;e.forEach((u,p)=>{if(p>0){let b=s[p-1];b&&(l+=b.codeblocks?.length??0,b instanceof wve&&c++)}let h=r.renderedParts?.[p];if(!u){r.renderedPartsMounted||h?.onDidRemount?.();return}if(h){if(u.kind==="thinking"&&h instanceof WE){Array.isArray(u.value)||h.updateThinking(u),s[p]=h;return}else if(h instanceof WE&&this.shouldPinPart(u,o)){s[p]=h;return}if(u.kind==="markdownContent"&&h instanceof UC&&this.configService.getValue("chat.experimental.incrementalRendering.enabled")&&h.tryIncrementalUpdate(u)){s[p]=h;return}if(h.dispose(),h.domNode){let b=rf(h.domNode,"chat-thinking-tool-wrapper");b&&b.replaceWith(h.domNode)}}let g={element:o,elementIndex:n,content:t,contentIndex:p,container:r.rowContainer,editorPool:this._editorPool,diffEditorPool:this._diffEditorPool,currentWidth:this._currentLayoutWidth,onDidChangeVisibility:this._onDidChangeVisibility.event,inlineTextModels:this._inlineTextModels,codeBlockStartIndex:l,treeStartIndex:c},f=this.getLastThinkingPart(s);if(f&&(u.kind==="toolInvocation"||u.kind==="toolInvocationSerialized"||u.kind==="markdownContent"||u.kind==="textEditGroup"||u.kind==="hook")&&this.shouldPinPart(u,o)){h instanceof UC&&f.removeEditPillByPartId(h.codeblocksPartId);let b=this.renderChatContentPart(u,r,g);b&&(s[p]=b,h?.domNode?.remove());return}let v=this.renderChatContentPart(u,r,g);if(v){s[p]=v;try{h?.domNode?v.domNode?h.domNode.replaceWith(v.domNode):h.domNode.remove():v.domNode&&!v.domNode.parentElement&&r.value.appendChild(v.domNode)}catch(b){this.logService.error("ChatListItemRenderer#renderChatContentDiff: error replacing part",b)}}else h?.domNode?.remove()});for(let u=e.length;u<s.length;u++){let p=s[u];p&&(p.dispose(),p.domNode?.remove(),delete s[u])}}getNextProgressiveRenderContent(e,t){let o=this.getDataForProgressiveRender(e),n=this.configService.getValue("chat.experimental.renderMarkdownImmediately")===!0,r=this.configService.getValue("chat.experimental.incrementalRendering.enabled")===!0,s=sAi(e.response.value);this.traceLayout("getNextProgressiveRenderContent",`Want to render ${o.numWordsToRender} at ${o.rate} words/s, counting...`);let l=o.numWordsToRender,c=[];c.push({kind:"references",references:e.contentReferences});let u=!1;for(let b=0;b<s.length;b++){let S=s[b];if(S.kind==="markdownContent"&&!n&&!r){let y=xet(S.content.value,l);if(this.traceLayout("getNextProgressiveRenderContent",`  Chunk ${b}: Want to render ${l} words and found ${y.returnedWordCount} words. Total words in chunk: ${y.totalWordCount}`),l-=y.returnedWordCount,y.isFullString){c.push(S);for(let w of s.slice(b+1))if(w.kind!=="markdownContent")b++,c.push(w);else break}else u=!0,c.push({...S,content:new he(y.value,S.content)});if(l<=0){s.slice(b+1).some(w=>w.kind==="markdownContent")&&(u=!0);break}}else c.push(S)}let p=e.contentUpdateTimings?.lastWordCount??0,h=o.numWordsToRender-l,g=p-h;this.traceLayout("getNextProgressiveRenderContent",`Want to render ${o.numWordsToRender} words. Rendering ${h} words. Buffer: ${g} words`),h>0&&h!==e.renderData?.renderedWordCount&&(e.renderData={lastRenderTime:Date.now(),renderedWordCount:h,renderedParts:c});let f=this.shouldShowWorkingProgress(e,c,u,t);f&&c.push(f);let v=this.getChatFileChangesSummaryPart(e);return v&&c.push(v),{content:c,moreContentAvailable:u}}shouldShowFileChangesSummary(e){let t=yn(e.sessionResource),o=t===kl||x3(t);return e.isComplete&&o&&this.configService.getValue("chat.checkpoints.showFileChanges")}getDataForProgressiveRender(e){let t=e.response.value.some(s=>s.kind==="markdownContent"&&s.content.value.trim().length>0);if(!e.isComplete&&t&&(e.contentUpdateTimings?e.contentUpdateTimings.lastWordCount:0)===0)return{numWordsToRender:Number.MAX_SAFE_INTEGER,rate:Number.MAX_SAFE_INTEGER};let o=e.renderData??{lastRenderTime:0,renderedWordCount:0},n=this.getProgressiveRenderRate(e);return{numWordsToRender:o.lastRenderTime===0?1:o.renderedWordCount+Math.floor((Date.now()-o.lastRenderTime)/1e3*n),rate:n}}diff(e,t,o){let n=[];for(let r=0;r<t.length;r++){let s=t[r],l=e[r];!l||!l.hasSameContent(s,t.slice(r+1),o)?n.push(s):n.push(null)}return n}hasEditCodeblockUri(e){return e.kind!=="markdownContent"?!1:yxo(e.content.value)}isCodeblockComplete(e,t){return e.kind!=="markdownContent"?!0:!Ni(t)||t.isComplete||Cqt(e.content.value)}shouldPinPart(e,t){let o=this.configService.getValue("chat.agent.thinking.collapsedTools");if(e.kind==="thinking"||e.kind==="working"||e.kind==="undoStop")return!0;if(e.kind==="hook")return e.subAgentInvocationId?!1:e.hookType==="PreToolUse"||e.hookType==="PostToolUse";if(o==="off")return!1;if(this.hasEditCodeblockUri(e)||e.kind==="textEditGroup")return!0;if((e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&vqt(e)||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&e.toolId.toLowerCase().includes("mermaid")||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&(e.toolId==="copilot_askQuestions"||e.toolId==="vscode_askQuestions")||(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&CNi(e))return!1;let l=(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&e.toolSpecificData?.kind==="terminal",c=t&&t.sessionResource.scheme!==Q.vscodeChatInput&&yn(t.sessionResource)!==kl&&e.kind==="toolInvocationSerialized"&&e.toolSpecificData?.kind==="terminal";if(l&&!c)return e.kind==="toolInvocation"&&pi.getConfirmationMessages(e)?!1:!!this.configService.getValue("chat.agent.thinking.terminalTools");if(e.kind==="toolInvocation"){if(pi.isStreaming(e))return!0;let u=e.state.get();return u.type===pi.StateKind.WaitingForConfirmation||u.type===pi.StateKind.WaitingForPostApproval?!1:!pi.getConfirmationMessages(e)}return e.kind==="toolInvocationSerialized"}getLastThinkingPart(e){if(!(!e||e.length===0))for(let t=e.length-1;t>=0;t--){let o=e[t];if(o instanceof WE&&o.getIsActive())return o}}isThinkingLookAheadComplete(e,t){if(t?.isComplete)return!0;for(let o=e.contentIndex+1;o<e.content.length;o++){let n=e.content[o];if(!this.shouldPinPart(n,t))return!0}return!1}getSubagentPart(e,t){if(!(!e||e.length===0))for(let o=e.length-1;o>=0;o--){let n=e[o];if(n instanceof qR&&(t&&n.subAgentInvocationId===t||!t&&n.getIsActive()))return n}}finalizeAllSubagentParts(e){if(e.renderedParts)for(let t of e.renderedParts)t instanceof qR&&t.getIsActive()&&!t.hasToolsWaitingForConfirmation&&t.markAsInactive()}handleSubagentToolGrouping(e,t,o,n,r){this.finalizeCurrentThinkingPart(o,n);let s=this.getSubagentPart(n.renderedParts,t);if(s)return this.maybeRouteSubagentToolToCarousel(e,s,o,n,r),v$t(e)||s.appendToolInvocation(e,r),s;let l=this.instantiationService.createInstance(qR,t,e,o,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._announcedToolProgressKeys);return this.maybeRouteSubagentToolToCarousel(e,l,o,n,r),v$t(e)||l.appendToolInvocation(e,r),l}maybeRouteSubagentToolToCarousel(e,t,o,n,r){if(!this.configService.getValue("chat.tools.confirmationCarousel.enabled")||e.kind!=="toolInvocation"||!Ni(o.element)||v$t(e)||e.presentation==="hidden"||e.source.type==="mcp"||this.viewModel?.editing)return;let s=this.chatWidgetService.getWidgetBySessionResource(o.element.sessionResource);if(!s)return;let l=t.subAgentInvocationId,c=t.getAgentLabel(),u=b=>{let S=this.getTemplateDataForRequestId(o.element.id);(this.getSubagentPart(S?.renderedParts,b)??t).domNode.scrollIntoView({behavior:"smooth",block:"center"})},p=b=>{s.inputPart.activateCarouselForSubagent(b)},h=b=>this.instantiationService.createInstance(c1,b,o,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._announcedToolProgressKeys,r),g=b=>{s.inputPart.addToolToConfirmationCarousel(b,h,l,c,u);let S=this.createUpdateWorkingProgressOnConfirmationEnd(b,n);S&&n.elementDisposables.add(S)},f=(b,S)=>this.configService.getValue("chat.tools.confirmationCarousel.enabled")&&!this.viewModel?.editing&&b.presentation!=="hidden"&&b.source.type!=="mcp"&&S.type===pi.StateKind.WaitingForConfirmation&&!!S.confirmationMessages?.title;t.enableCarouselMode(p,g,f);let v=e.state.get();v.type===pi.StateKind.WaitingForConfirmation&&v.confirmationMessages?.title&&g(e)}finalizeCurrentThinkingPart(e,t){let o=this.getLastThinkingPart(t.renderedParts);if(!o)return;this.configService.getValue("chat.agent.thinkingStyle")==="collapsedPreview"&&o.collapseContent(),o.finalizeTitleIfDefault(),o.resetId(),o.markAsInactive()}renderChatContentPart(e,t,o){try{if(e.kind==="thinking"&&(Array.isArray(e.value)?e.value.length===0:e.value===""))return this.getLastThinkingPart(t.renderedParts)?.resetId(),this.renderNoContent(c=>e.kind===c.kind);let n=Ni(o.element),r=this.shouldPinPart(e,n?o.element:void 0);if(o.element.isComplete&&!r){let l=this.getTemplateDataForRequestId(o.element.id);l?.renderedParts&&this.getLastThinkingPart(l.renderedParts)?.getIsActive()&&this.finalizeCurrentThinkingPart(o,l)}let s=(e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized")&&CNi(e);if(o.element.isComplete&&!s){let l=this.getTemplateDataForRequestId(o.element.id);l&&this.finalizeAllSubagentParts(l)}return e.kind==="treeData"?this.renderTreeData(e,t,o):e.kind==="multiDiffData"?this.renderMultiDiffData(e,t,o):e.kind==="progressMessage"?this.instantiationService.createInstance(KR,e,this.chatContentMarkdownRenderer,o,void 0,void 0,void 0,void 0,e.shimmer):e.kind==="working"?this.instantiationService.createInstance(one,e,this.chatContentMarkdownRenderer,o):e.kind==="progressTask"||e.kind==="progressTaskSerialized"?this.renderProgressTask(e,t,o):e.kind==="command"?this.instantiationService.createInstance(cWe,e,o):e.kind==="textEditGroup"?this.renderTextEdit(o,e,t):e.kind==="confirmation"?this.renderConfirmation(o,e,t):e.kind==="warning"?this.instantiationService.createInstance(uve,1,e.content,e,this.chatContentMarkdownRenderer):e.kind==="info"?this.instantiationService.createInstance(uve,0,e.content,e,this.chatContentMarkdownRenderer):e.kind==="hook"?this.renderHookPart(e,o,t):e.kind==="markdownContent"?this.renderMarkdown(e,t,o):e.kind==="references"?Ni(o.element)&&o.element.agent?.isDefault&&!o.element.agent.modes.includes("ask")?this.renderNoContent(l=>l.kind===e.kind):this.renderContentReferencesListData(e,void 0,o,t):e.kind==="codeCitations"?this.renderCodeCitations(e,o,t):e.kind==="toolInvocation"||e.kind==="toolInvocationSerialized"?this.renderToolInvocation(e,o,t):e.kind==="extensions"?this.renderExtensionsContent(e,o,t):e.kind==="pullRequest"?this.renderPullRequestContent(e,o,t):e.kind==="undoStop"?this.renderUndoStop(e):e.kind==="errorDetails"?this.renderChatErrorDetails(o,e,t):e.kind==="elicitation2"||e.kind==="elicitationSerialized"?this.renderElicitation(o,e,t):e.kind==="questionCarousel"?this.renderQuestionCarousel(o,e,t):e.kind==="planReview"?this.renderPlanReview(o,e,t):e.kind==="changesSummary"?this.renderChangesSummary(e,o,t):e.kind==="mcpServersStarting"?this.renderMcpServersInteractionRequired(e,o,t):e.kind==="disabledClaudeHooks"?this.renderDisabledClaudeHooks(e,o):e.kind==="thinking"?this.renderThinkingPart(e,o,t):e.kind==="workspaceEdit"?this.instantiationService.createInstance(FWe,e,o,this.chatContentMarkdownRenderer):this.renderNoContent(l=>e.kind===l.kind)}catch(n){cn(`Chat error: ${Mn(n,!1)}`),this.logService.error("ChatListItemRenderer#renderChatContentPart: error rendering content",Mn(n,!0));let r=this.instantiationService.createInstance(uve,2,new he(d(9065,null)+`: ${Mn(n,!1)}`),e,this.chatContentMarkdownRenderer);return{dispose:()=>r.dispose(),domNode:r.domNode,hasSameContent:(s=>e.kind===s.kind)}}}dispose(){this._announcedToolProgressKeys.clear(),super.dispose()}renderChatErrorDetails(e,t,o){if(!Ni(e.element))return this.renderNoContent(r=>t.kind===r.kind);let n=e.elementIndex===this.delegate.getListLength()-1;if(t.errorDetails.isQuotaExceeded)return this.instantiationService.createInstance(SWe,e.element,t,this.chatContentMarkdownRenderer);if(t.errorDetails.isRateLimited&&this.chatEntitlementService.anonymous)return this.instantiationService.createInstance(sWe,t);if(t.errorDetails.confirmationButtons&&n){let r=t.errorDetails.level??2;return this.instantiationService.createInstance(hWe,r,new he(t.errorDetails.message),t,t.errorDetails.confirmationButtons,this.chatContentMarkdownRenderer,e)}else{let r=t.errorDetails.level??2;return this.instantiationService.createInstance(uve,r,new he(t.errorDetails.message),t,this.chatContentMarkdownRenderer)}}renderUndoStop(e){return this.renderNoContent(t=>t.kind===e.kind&&t.id===e.id)}renderNoContent(e){return{dispose:()=>{},domNode:void 0,hasSameContent:e}}renderTreeData(e,t,o){let n=e.treeData,r=this.instantiationService.createInstance(wve,n,this._treePool);if(Ni(o.element)){let s={treeDataId:n.uri.toString(),treeIndex:o.treeStartIndex,focus(){r.domFocus()}};r.addDisposable(r.onDidFocus(()=>{this.focusedFileTreesByResponseId.set(o.element.id,s.treeIndex)}));let l=this.fileTreesByResponseId.get(o.element.id)??[];l.push(s),this.fileTreesByResponseId.set(o.element.id,jo(l,c=>c.treeDataId)),r.addDisposable(ee(()=>this.fileTreesByResponseId.set(o.element.id,l.filter(c=>c.treeDataId!==n.uri.toString()))))}return r}renderMultiDiffData(e,t,o){return this.instantiationService.createInstance(vWe,e,o.element)}renderContentReferencesListData(e,t,o,n){return this.instantiationService.createInstance(U0e,e.references,t,o,this._contentReferencesListPool,{expandedWhenEmptyResponse:cte(this.delegate.currentChatMode(),this.rendererOptions.referencesExpandedWhenEmptyResponse)})}renderCodeCitations(e,t,o){return this.instantiationService.createInstance(lWe,e,t)}handleRenderedCodeblocks(e,t,o){if(!t.addDisposable||t.codeblocksPartId===void 0)return;let n=this.codeBlocksByResponseId.get(e.id)??[];this.codeBlocksByResponseId.set(e.id,n),t.addDisposable(ee(()=>{let r=this.codeBlocksByResponseId.get(e.id);r&&t.codeblocks?.forEach((s,l)=>{r[o+l]?.ownerMarkdownPartId===t.codeblocksPartId&&delete r[o+l]})})),t.codeblocks?.forEach((r,s)=>{n[o+s]=r;let l=r.uri;l&&(this.codeBlocksByEditorUri.set(l,r),t.addDisposable(ee(()=>{this.codeBlocksByEditorUri.get(l)?.ownerMarkdownPartId===t.codeblocksPartId&&this.codeBlocksByEditorUri.delete(l)})))})}renderToolInvocation(e,t,o){if(pi.isComplete(e)&&pi.isEffectivelyHidden(e)){let p=e.pastTenseMessage??e.invocationMessage,h=typeof p=="string"?p:p?.value;if(!h||h.trim().length===0)return this.renderNoContent(g=>(g.kind==="toolInvocation"||g.kind==="toolInvocationSerialized")&&g.toolCallId===e.toolCallId)}this.configService.getValue("chat.agent.thinking.collapsedTools")==="off"&&this.finalizeCurrentThinkingPart(t,o);let n=t.codeBlockStartIndex,r,s=()=>(r=this.instantiationService.createInstance(c1,e,t,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._announcedToolProgressKeys,n),this.handleRenderedCodeblocks(t.element,r,n),{domNode:r.domNode,disposable:r,part:r}),l=this.configService.getValue("chat.agent.thinking.collapsedTools");if(Ni(t.element)&&l!=="off"){let p=this.getLastThinkingPart(o.renderedParts);if(!p&&!pi.isEffectivelyHidden(e)&&this.shouldPinPart(e,t.element)&&l==="always"){let h=this.renderThinkingPart({kind:"thinking"},t,o);return h instanceof WE&&(e.isAttachedToThinking=!0,h.appendItem(s,e.toolId,e,o.value),this.setupConfirmationTransitionWatcher(e,h,()=>r,s,t,o)),h}if(this.shouldPinPart(e,t.element)){if(p&&!pi.isEffectivelyHidden(e))return e.isAttachedToThinking=!0,p.appendItem(s,e.toolId,e,o.value),this.setupConfirmationTransitionWatcher(e,p,()=>r,s,t,o),this.renderNoContent((h,g,f)=>r?r.hasSameContent(h,g,f):e.kind===h.kind)}else this.finalizeCurrentThinkingPart(t,o)}let c=AEo(e);if(c&&Ni(t.element)&&!pi.isEffectivelyHidden(e))return this.handleSubagentToolGrouping(e,c,t,o,n);let{part:u}=s();if(this.configService.getValue("chat.tools.confirmationCarousel.enabled")&&e.kind==="toolInvocation"&&Ni(t.element)&&e.source.type!=="mcp"&&!this.viewModel?.editing){let p=this.chatWidgetService.getWidgetBySessionResource(t.element.sessionResource);if(p){let h=b=>this.instantiationService.createInstance(c1,b,t,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._announcedToolProgressKeys,n),g=()=>(p.inputPart.addToolToConfirmationCarousel(e,h),Wi(u.domNode),!0),f=!1,v=()=>{f||(f=!0,u.addDisposable(kr(Me(u.domNode),()=>{f=!1;let b=e.state.get();b.type===pi.StateKind.WaitingForConfirmation&&b.confirmationMessages?.title&&e.presentation!=="hidden"&&e.source.type!=="mcp"&&!this.viewModel?.editing&&g()})))};u.addDisposable(ve(b=>{let S=e.state.read(b);S.type===pi.StateKind.WaitingForConfirmation&&!!S.confirmationMessages?.title&&e.presentation!=="hidden"&&e.source.type!=="mcp"&&!this.viewModel?.editing?g()||(Wi(u.domNode),v()):pi.isEffectivelyHidden(e,b)?(this.updateWorkingProgressForPendingConfirmations(o),Wi(u.domNode)):(this.updateWorkingProgressForPendingConfirmations(o),Xo(u.domNode))}))}}return u}setupConfirmationTransitionWatcher(e,t,o,n,r,s){if(e.kind!=="toolInvocation")return;let l=()=>{let f=o();e.isAttachedToThinking=!1;let v;if(f?.domNode){v=f;let b=f.domNode.parentElement;b?.classList.contains("chat-thinking-tool-wrapper")&&b.remove(),s.value.appendChild(f.domNode),t.removeMaterializedItem(e.toolCallId),(s.movedOutToolParts??=new Ot).set(e.toolCallId,f)}else{t.removeLazyItem(e.toolId);let{domNode:b,part:S}=n();v=S,(s.movedOutToolParts??=new Ot).set(e.toolCallId,S),s.value.appendChild(b)}return this.finalizeCurrentThinkingPart(r,s),t.isEffectivelyEmpty()&&(t.domNode?.remove(),t.dispose()),v},c=f=>f===pi.StateKind.Streaming||f===pi.StateKind.Executing,u=()=>{if(!this.configService.getValue("chat.tools.confirmationCarousel.enabled")||!Ni(r.element)||this.viewModel?.editing||e.presentation==="hidden"||e.source.type==="mcp")return!1;let f=e.state.get();if(f.type!==pi.StateKind.WaitingForConfirmation||!f.confirmationMessages?.title)return!1;let v=this.chatWidgetService.getWidgetBySessionResource(r.element.sessionResource);if(!v)return!1;let b=l(),S=y=>this.instantiationService.createInstance(c1,y,r,this.chatContentMarkdownRenderer,this._contentReferencesListPool,this._toolEditorPool,()=>this._currentLayoutWidth.get(),this._announcedToolProgressKeys,r.codeBlockStartIndex);return b.addDisposable(ve(y=>{let w=e.state.read(y);w.type===pi.StateKind.WaitingForConfirmation&&w.confirmationMessages?.title?(v.inputPart.addToolToConfirmationCarousel(e,S),Wi(b.domNode)):pi.isEffectivelyHidden(e,y)?(this.updateWorkingProgressForPendingConfirmations(s),Wi(b.domNode)):(this.updateWorkingProgressForPendingConfirmations(s),Xo(b.domNode))})),!0},p=e.state.get();if(p.type===pi.StateKind.WaitingForConfirmation){u()||l();return}if(p.type===pi.StateKind.WaitingForPostApproval){l();return}if(!c(p.type))return;let h=!1,g=ve(f=>{let v=e.state.read(f);if(v.type===pi.StateKind.WaitingForConfirmation||v.type===pi.StateKind.WaitingForPostApproval){if(h)return;h=!0,g.dispose(),(v.type!==pi.StateKind.WaitingForConfirmation||!u())&&l()}});t.addDisposable(g)}renderExtensionsContent(e,t,o){return this.instantiationService.createInstance(Uq,e)}renderHookPart(e,t,o){if(!(e.stopReason||e.systemMessage))return this.renderNoContent(s=>s.kind==="hook"&&s.hookType===e.hookType);if(e.subAgentInvocationId){let s=this.getSubagentPart(o.renderedParts,e.subAgentInvocationId);if(s)return s.appendHookItem(()=>{let l=this.instantiationService.createInstance(hne,e,t);return{domNode:l.domNode,disposable:l}},e),this.renderNoContent(l=>l.kind==="hook"&&l.hookType===e.hookType&&l.subAgentInvocationId===e.subAgentInvocationId)}if(e.hookType==="PreToolUse"||e.hookType==="PostToolUse"){let s=e.stopReason?e.toolDisplayName?d(9059,null,e.toolDisplayName):d(9060,null):e.toolDisplayName?d(9061,null,e.toolDisplayName):d(9062,null),l=this.getLastThinkingPart(o.renderedParts);if(!l){let c=this.renderThinkingPart({kind:"thinking"},t,o);c instanceof WE&&(l=c)}if(l)return l.appendItem(()=>{let c=this.instantiationService.createInstance(hne,e,t);return{domNode:c.domNode,disposable:c}},s,void 0,o.value),l}return this.instantiationService.createInstance(hne,e,t)}renderPullRequestContent(e,t,o){return this.instantiationService.createInstance(bWe,e)}renderProgressTask(e,t,o){return Ni(o.element)?(this.finalizeCurrentThinkingPart(o,t),this.instantiationService.createInstance(IWe,e,this._contentReferencesListPool,this.chatContentMarkdownRenderer,o)):void 0}renderConfirmation(e,t,o){return this.instantiationService.createInstance(dWe,t,e)}renderElicitation(e,t,o){return(t.kind==="elicitationSerialized"?t.isHidden:t.isHidden?.get())?this.renderNoContent(r=>t.kind===r.kind):(this.finalizeCurrentThinkingPart(e,o),this.instantiationService.createInstance(mWe,t,e))}renderQuestionCarousel(e,t,o){if(this.finalizeCurrentThinkingPart(e,o),this._notifyOnQuestionCarousel(e,t),!t.terminalId&&Ni(e.element)){let f=e.element,b=this.chatService.getSession(f.sessionResource)?.getRequests().find(S=>S.id===f.requestId);b?.terminalExecutionId?(t.terminalId=b.terminalExecutionId,this.logService.trace(`ChatListItemRenderer#renderQuestionCarousel: backfilled terminalId=${t.terminalId} for request=${f.requestId}`)):this.logService.trace(`ChatListItemRenderer#renderQuestionCarousel: no terminalExecutionId to backfill for request=${f.requestId}`)}let n=Ni(e.element)?this.chatWidgetService.getWidgetBySessionResource(e.element.sessionResource):void 0,r=n?n.getInput()==="":!0,s=Ni(e.element)?e.element.requestId:void 0,l=t.resolveId??`${s??""}_${e.contentIndex}`,c=async(f,v)=>{let b=f?Object.fromEntries(f):void 0;t.data=b??{},t.isUsed=!0,t instanceof nI&&(t.draftAnswers=void 0,t.draftCurrentIndex=void 0,t.completion.complete({answers:b})),Ni(e.element)&&t.resolveId&&this.chatService.notifyQuestionCarouselAnswer(e.element.requestId,t.resolveId,b),this.removeCarouselFromTracking(e,v),n?.input.clearQuestionCarousel(void 0,l)},u=Ni(e.element)&&e.element.isComplete,p=n?.input.questionCarousel!==void 0;if(t.isUsed||u){u&&!t.isUsed&&Ni(e.element)&&t.resolveId&&(t.data={},t.isUsed=!0,t instanceof nI&&(t.draftAnswers=void 0,t.draftCurrentIndex=void 0,t.completion.complete({answers:void 0})),this.chatService.notifyQuestionCarouselAnswer(e.element.requestId,t.resolveId,void 0),this.pendingQuestionCarousels.get(e.element.sessionResource)?.clear()),p&&(t.isUsed?n?.input.clearQuestionCarousel(void 0,l):u&&s&&n?.input.clearQuestionCarousel(s));let f=this.instantiationService.createInstance(v6,t,e,{shouldAutoFocus:!1,onSubmit:async v=>c(v,f)});return f}let g=!!this.viewModel?.editing?void 0:n?.input.renderQuestionCarousel(t,e,{shouldAutoFocus:r,onSubmit:async f=>c(f,g)});if(!g){let f=this.instantiationService.createInstance(v6,t,e,{shouldAutoFocus:r,onSubmit:async v=>c(v,f)});return f}if(Ni(e.element)&&t.allowSkip&&!t.isUsed){let f=this.pendingQuestionCarousels.get(e.element.sessionResource);f||(f=new Set,this.pendingQuestionCarousels.set(e.element.sessionResource,f)),f.has(g)||(f.add(g),g.addDisposable({dispose:()=>this.removeCarouselFromTracking(e,g)}))}return this.renderNoContent((f,v,b)=>{if(t.isUsed||Ni(b)&&b.isComplete)return!1;if(f.kind==="questionCarousel"){let S=f;return t.resolveId&&S.resolveId?t.resolveId===S.resolveId:f===t}return!1})}_getCarouselStableKey(e,t){let o=Ni(e.element)?e.element.requestId:void 0;if(!(!o||!t.resolveId))return`${o}::${t.resolveId}`}_notifyOnQuestionCarousel(e,t){if(t.isUsed)return;let o=this._getCarouselStableKey(e,t);if(o&&this._notifiedQuestionCarousels.has(o))return;let n=t.questions.length,r=t.questions.length>0&&t.questions[0].message?t.questions[0].message:d(9052,null),s=typeof r=="string"?r:r.value,l=n===1?d(9051,null,s):d(9050,null,n,s);this.accessibilityService.alert(l),o&&this._notifiedQuestionCarousels.add(o);let c=n===1?d(9054,null):d(9053,null,n);this.accessibilitySignalService.playSignal(tn.chatUserActionRequired,{allowManyInParallel:!0,customAlertMessage:c})}renderPlanReview(e,t,o){let n=Ni(e.element)?this.chatWidgetService.getWidgetBySessionResource(e.element.sessionResource):void 0,r=Ni(e.element)?e.element.requestId:void 0,s=t.resolveId??`${r??""}_${e.contentIndex}`;this.finalizeCurrentThinkingPart(e,o);let l=g=>{t.data=g,t.isUsed=!0,t instanceof f_&&t.completion.complete(g),n?.input.clearPlanReview(void 0,s)},c=Ni(e.element)&&e.element.isComplete;c&&!t.isUsed&&(t.isUsed=!0,t instanceof f_&&t.completion.complete(void 0)),c&&r&&n?.input.clearPlanReview(r);let u=()=>{let g=this.getPlanReviewProgressMessage(t);if(!g)return this.renderNoContent(E=>E.kind==="planReview");let f=!!t.isUsed,v=!f,b=f&&!t.data?.rejected?t.data:void 0,S=b?.feedbackOverall?.trim(),y=b?.feedbackInlineMarkdown?.trim();!S&&!y&&b?.feedback&&(S=b.feedback.trim());let w=new he(void 0,{supportThemeIcons:!0});S?w.appendText(d(9047,null,g,S.replace(/\s+/g," "))):w.appendText(g),y&&(w.appendMarkdown(`

`),w.appendMarkdown(y));let x=this.instantiationService.createInstance(KR,{content:w},this.chatContentMarkdownRenderer,e,v,!0,v?void 0:L.check,void 0,v);return{domNode:x.domNode,dispose:()=>x.dispose(),hasSameContent:(E,M,N)=>E.kind!=="planReview"||!!t.isUsed!==f?!1:t.resolveId&&E.resolveId?t.resolveId===E.resolveId:E===t}};return t.isUsed||(!!this.viewModel?.editing?void 0:n?.input.renderPlanReview(t,e,{onSubmit:l}))?u():this.instantiationService.createInstance(Uoe,t,e,{onSubmit:l})}getPlanReviewProgressMessage(e){if(!e.isUsed)return d(9049,null);let t=e.data;return t?t.rejected?d(9048,null):t.feedback?d(9046,null):e.actions.find(n=>n.label===t.action)?.permissionLevel==="autopilot"?d(9045,null):d(9044,null):void 0}removeCarouselFromTracking(e,t){if(Ni(e.element)){let o=this.pendingQuestionCarousels.get(e.element.sessionResource);o&&o.delete(t)}}renderChangesSummary(e,t,o){return this.instantiationService.createInstance(aWe,e,t)}renderAttachments(e,t,o,n){return this.instantiationService.createInstance(ine,{variables:e,contentReferences:t,modelId:o,domNode:void 0})}renderTextEdit(e,t,o){return this.instantiationService.createInstance(yWe,t,e,this.rendererOptions,this._diffEditorPool,this._currentLayoutWidth.get())}renderMarkdown(e,t,o){let n=o.element,r=!e.content.value.trim(),s=Ni(n)&&!n.isComplete&&Ixo(e.content.value)&&!Cqt(e.content.value);!this.hasEditCodeblockUri(e)&&!r&&!s&&this.finalizeCurrentThinkingPart(o,t);let l=Ni(n)&&(!n.isComplete||n.isCanceled||n.errorDetails?.responseIsFiltered||n.errorDetails?.responseIsIncomplete||!!n.renderData),c=o.codeBlockStartIndex,u=t.instantiationService.createInstance(UC,e,o,this._editorPool,l,c,this.chatContentMarkdownRenderer,void 0,this._currentLayoutWidth.get(),{});u.addDisposable(u.onDidChangeHeight(()=>this.fireItemHeightChange(t))),_r(n)&&(u.domNode.tabIndex=0,this.configService.getValue("chat.editRequests")==="inline"&&this.rendererOptions.editable&&(u.domNode.classList.add("clickable"),u.addDisposable($(u.domNode,ne.CLICK,h=>{if(this.viewModel?.editing?.id===n.id)return;let g=h.target;if(g.tagName==="A")return;let f=Me(t.rowContainer).getSelection();if(f&&!f.isCollapsed&&f.toString().length>0)return;let v=rf(g,"monaco-editor");v&&Array.from(this.editorsInUse()).find(S=>S.element.contains(v))?.editor.getSelection()?.isEmpty()===!1||(h.preventDefault(),h.stopPropagation(),this._onDidClickRequest.fire(t))})),u.addDisposable(this.hoverService.setupManagedHover(yi("element"),u.domNode,d(9066,null),{trapFocus:!0}))),u.addDisposable($(u.domNode,ne.FOCUS,()=>{this.hoverVisible(t.requestHover)})),u.addDisposable($(u.domNode,ne.BLUR,()=>{this.hoverHidden(t.requestHover)}))),this.handleRenderedCodeblocks(n,u,c);let p=this.configService.getValue("chat.agent.thinking.collapsedTools");if(Ni(o.element)&&p!=="off"){let h=this.isCodeblockComplete(e,o.element),g=Sxo(e.content.value);if(g){let v=this.getSubagentPart(t.renderedParts,g);if(v&&u?.domNode&&h)return v.appendMarkdownItem(()=>({domNode:u.domNode,disposable:u}),u.codeblocksPartId,e,t.value,u),v}let f=this.getLastThinkingPart(t.renderedParts);if(!f&&u?.domNode&&this.shouldPinPart(e,o.element)&&p==="always"&&h){let v=this.renderThinkingPart({kind:"thinking"},o,t);return v instanceof WE&&v.appendItem(()=>({domNode:u.domNode,disposable:u}),u.codeblocksPartId,e,t.value,u.onDidChangeDiff,u),v}this.shouldPinPart(e,o.element)&&h?f&&u?.domNode&&f.appendItem(()=>({domNode:u.domNode,disposable:u}),u.codeblocksPartId,e,t.value,u.onDidChangeDiff):!this.shouldPinPart(e,o.element)&&!r&&!s&&this.finalizeCurrentThinkingPart(o,t)}return u}renderThinkingPart(e,t,o){e.id||(e.id=Date.now().toString());let n=Ni(t.element)?t.element:void 0,r=this.isThinkingLookAheadComplete(t,n);if(Array.isArray(e.value)){if(e.value.length<1)return this.getLastThinkingPart(o.renderedParts)?.finalizeTitleIfDefault(),this.renderNoContent(c=>e.kind===c.kind);let s;for(let l of e.value)if(l){let c=s instanceof WE&&s.getIsActive()?s:void 0;if(c)c.setupThinkingContainer({...e,value:l});else{let u={...e,value:l};s=o.instantiationService.createInstance(WE,u,t,this.chatContentMarkdownRenderer,r)}}return s??this.renderNoContent(l=>e.kind===l.kind)}else{let s=this.getLastThinkingPart(o.renderedParts);return s?(s.setupThinkingContainer(e),s):o.instantiationService.createInstance(WE,e,t,this.chatContentMarkdownRenderer,r)}}disposeElement(e,t,o,n){this.traceLayout("disposeElement",`Disposing element, index=${t}`),o.elementDisposables.clear(),o.currentElement&&!this.viewModel?.editing&&this.templateDataByRequestId.delete(o.currentElement.id);let r=this.codeBlocksByResponseId.get(e.element.id);if(r){for(let s of r)s?.uri&&this.codeBlocksByEditorUri.delete(s.uri);this.codeBlocksByResponseId.delete(e.element.id)}this.fileTreesByResponseId.delete(e.element.id),this.focusedFileTreesByResponseId.delete(e.element.id),_r(e.element)&&e.element.id===this.viewModel?.editing?.id&&n?.onScroll&&this._onDidDispose.fire(o),o.titleToolbar&&(o.titleToolbar.context=void 0),o.footerToolbar.context=void 0,o.checkpointToolbar.context=void 0,o.checkpointRestoreToolbar.context=void 0}renderMcpServersInteractionRequired(e,t,o){return this.instantiationService.createInstance(gWe,e,t)}renderDisabledClaudeHooks(e,t){return this.instantiationService.createInstance(fWe,t)}disposeTemplate(e){this.clearRenderedParts(e),e.templateDisposables.dispose()}hoverVisible(e){e.style.opacity="1"}hoverHidden(e){e.style.opacity="0"}};_6=I([m(5,F),m(6,B),m(7,re),m(8,X),m(9,Pe),m(10,fe),m(11,ot),m(12,Lt),m(13,dr),m(14,si),m(15,br),m(16,Ai),m(17,Mt),m(18,_e)],_6);var b$t=class extends LK{constructor(e){super();this.defaultElementHeight=e}estimateHeight(e){return e.currentRenderedHeight??this.defaultElementHeight}getTemplateId(e){return _6.ID}hasDynamicHeight(e){return!0}};function v$t(a){return a.toolSpecificData?.kind==="subagent"&&!a.subAgentInvocationId}function AEo(a){return v$t(a)?a.toolCallId:a.subAgentInvocationId}function CNi(a){return!!AEo(a)}var d1=class extends k{constructor(e,t,o,n,r,s,l){super();this.foreground=t;this.inputEditorBackgroundColor=o;this.resultEditorBackgroundColor=n;this.configurationService=r;this.themeService=s;this.viewDescriptorService=l;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(this.themeService.onDidColorThemeChange(c=>this.update())),this._register(this.viewDescriptorService.onDidChangeLocation(c=>{c.views.some(u=>u.id===e)&&this.update()})),this._register(this.configurationService.onDidChangeConfiguration(c=>{d1.relevantSettingIds.some(u=>c.affectsConfiguration(u))&&this.update()})),this.update()}static{this.lineHeightEm=1.4}get configuration(){return this._config}static{this.relevantSettingIds=["chat.editor.lineHeight","chat.editor.fontSize","chat.editor.fontFamily","chat.editor.fontWeight","chat.editor.wordWrap","editor.cursorBlinking","editor.fontLigatures","editor.accessibilitySupport","editor.bracketPairColorization.enabled","editor.bracketPairColorization.independentColorPoolPerBracketType"]}update(){let e=this.configurationService.getValue("editor"),t=this.configurationService.getValue("chat")?.editor,o=this.configurationService.getValue("editor.accessibilitySupport");this._config={foreground:this.themeService.getColorTheme().getColor(this.foreground),inputEditor:{backgroundColor:this.themeService.getColorTheme().getColor(this.inputEditorBackgroundColor),accessibilitySupport:o},resultEditor:{backgroundColor:this.themeService.getColorTheme().getColor(this.resultEditorBackgroundColor),fontSize:t.fontSize,fontFamily:t.fontFamily==="default"?e.fontFamily:t.fontFamily,fontWeight:t.fontWeight,lineHeight:t.lineHeight?t.lineHeight:d1.lineHeightEm*t.fontSize,bracketPairColorization:{enabled:this.configurationService.getValue("editor.bracketPairColorization.enabled"),independentColorPoolPerBracketType:this.configurationService.getValue("editor.bracketPairColorization.independentColorPoolPerBracketType")},wordWrap:t.wordWrap,fontLigatures:e.fontLigatures}},this._onDidChange.fire()}};d1=I([m(4,B),m(5,Pe),m(6,ji)],d1);var NEo="data-pending-request-id",Ppn="data-pending-kind",OEo="chat-pending-dragging",WWe=class extends k{constructor(e,t,o){super();this._getViewModel=t;this._chatService=o;this._insertIndicator=_(".chat-pending-insert-indicator"),e.append(this._insertIndicator),this._register(ee(()=>this._insertIndicator.remove())),this._register(new wg(e,{onDragOver:n=>this._onDragOver(n),onDragLeave:()=>this._hideIndicator(),onDragEnd:()=>this._onDragEnd(),onDrop:n=>this._onDrop(n)}))}attachDragHandle(e,t,o,n){t.setAttribute("draggable","true"),n.add($(t,ne.DRAG_START,r=>{!r.dataTransfer||!e.pendingKind||(this._dragState={element:e,pendingKind:e.pendingKind},o.classList.add(OEo),r.dataTransfer.setDragImage(o,0,0),r.dataTransfer.effectAllowed="move")})),n.add($(t,ne.DRAG_END,()=>{o.classList.remove(OEo),this._onDragEnd()}))}_onDragOver(e){if(!this._dragState)return;let t=this._findDropTarget(e);if(!t){this._hideIndicator();return}e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");let o=t.row.getBoundingClientRect(),n=o.top+o.height/2,r=e.clientY<n;this._showIndicator(t.row,r)}_onDrop(e){if(this._hideIndicator(),!this._dragState)return;let t=this._findDropTarget(e);if(!t)return;e.preventDefault();let o=t.row.getBoundingClientRect(),n=o.top+o.height/2,r=e.clientY<n;this._reorder(this._dragState.element,t.requestId,r),this._dragState=void 0}_onDragEnd(){this._hideIndicator(),this._dragState=void 0}_showIndicator(e,t){let o=e.getBoundingClientRect(),n=this._insertIndicator.parentElement.getBoundingClientRect();this._insertIndicator.style.display="block",this._insertIndicator.style.left=`${o.left-n.left}px`,this._insertIndicator.style.width=`${o.width}px`,this._insertIndicator.style.top=t?`${o.top-n.top}px`:`${o.bottom-n.top}px`}_hideIndicator(){this._insertIndicator.style.display="none"}_findDropTarget(e){if(!this._dragState)return;let t=e.target?.closest?.(`[${NEo}]`);if(!t)return;let o=t.getAttribute(NEo);if(!(t.getAttribute(Ppn)!==this._dragState.pendingKind||o===this._dragState.element.id))return{row:t,requestId:o}}_reorder(e,t,o){let n=this._getViewModel();if(!n)return;let r=n.model.getPendingRequests(),s=e.pendingKind,l=[],c=[];for(let f of r)(f.kind===s?l:c).push(f);let u=l.findIndex(f=>f.request.id===e.id);if(u===-1)return;let[p]=l.splice(u,1),h=l.findIndex(f=>f.request.id===t);if(h===-1)return;o||h++,l.splice(h,0,p);let g=(s==="steering"?[...l,...c]:[...c,...l]).map(f=>({requestId:f.request.id,kind:f.kind}));this._chatService.setPendingRequests(n.sessionResource,g)}};WWe=I([m(2,si)],WWe);var gne=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.instantiationService=o;this.contextKeyService=n;this.chatService=r;this.contextMenuService=s;this.logService=l;this.configurationService=c;this.chatAccessibilityService=u;this._onDidScroll=this._register(new T);this.onDidScroll=this._onDidScroll.event;this._onDidChangeContentHeight=this._register(new T);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidClickFollowup=this._register(new T);this.onDidClickFollowup=this._onDidClickFollowup.event;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidChangeItemHeight=this._register(new T);this.onDidChangeItemHeight=this._onDidChangeItemHeight.event;this._visible=!0;this._mostRecentlyFocusedItemIndex=-1;this._scrollLock=!0;this._suppressAutoScroll=!1;this._settingChangeCounter=0;this._visibleChangeCount=0;this._bodyDimension=null;this._previousLastItemMinHeight=null;this._viewModel=t.viewModel,this._location=t.location,this._getCurrentLanguageModelId=t.getCurrentLanguageModelId,this._getCurrentModeInfo=t.getCurrentModeInfo,this._lastItemIdContextKey=Z.lastItemId.bindTo(this.contextKeyService),this._container=e;let p=()=>{let y=this.configurationService.getValue("chat.inlineReferences.style");this._container.classList.toggle("chat-inline-references-link-style",y==="link")};p(),this._register(this.configurationService.onDidChangeConfiguration(y=>{y.affectsConfiguration("chat.inlineReferences.style")&&p()}));let h=this._register(this.instantiationService.createChild(new Po([X,this.contextKeyService])));this._renderStyle=t.renderStyle;let g=t.overflowWidgetsDomNode??document.createElement("div");t.overflowWidgetsDomNode||(g.classList.add("chat-overflow-widget-container","monaco-editor"),this._container.append(g),this._register(ee(()=>g.remove())));let f=t.editorOptions??this._register(h.createInstance(d1,t.viewId,"foreground",t.inputEditorBackground??"chat.requestEditor.background",t.resultEditorBackground??"chat.responseEditor.background")),v=h.createInstance(b$t,t.defaultElementHeight??200),b={getListLength:()=>this._tree.getNode(null).visibleChildrenCount,onDidScroll:this.onDidScroll,container:this._container,currentChatMode:t.currentChatMode??(()=>"ask")};this._renderer=this._register(h.createInstance(_6,f,t.rendererOptions??{},b,g,this._viewModel)),this._register(this._renderer.onDidClickFollowup(y=>{this._onDidClickFollowup.fire(y)})),this._register(this._renderer.onDidChangeItemHeight(y=>{this._updateElementHeight(y.element,y.height);let w=this._viewModel?.getItems().at(-2);y.element.id===w?.id&&this.updateLastItemMinHeight(),this._onDidChangeItemHeight.fire(y)})),this._register(this._renderer.onDidClickRerunWithAgentOrCommandDetection(y=>{let w=this.chatService.getSession(y.sessionResource)?.getRequests().find(x=>x.id===y.requestId);if(w){let x={noCommandDetection:!0,attempt:w.attempt+1,location:this._location,userSelectedModelId:this._getCurrentLanguageModelId?.(),modeInfo:this._getCurrentModeInfo?.()};this.chatAccessibilityService.acceptRequest(y.sessionResource),this.chatService.resendRequest(w,x).catch(E=>this.logService.error("FAILED to rerun request",E))}})),this._renderer.pendingDragController=this._register(h.createInstance(WWe,this._container,()=>this._viewModel));let S=t.styles??{};this._tree=this._register(h.createInstance(hf,"ChatList",this._container,v,[this._renderer],{identityProvider:{getId:y=>y.id},horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,supportDynamicHeights:!0,hideTwistiesOfChildlessElements:!0,accessibilityProvider:this.instantiationService.createInstance(oWe),keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:y=>_r(y)?y.message:Ni(y)?y.response.value:""},setRowLineHeight:!1,scrollToActiveElement:!0,filter:t.filter,overrideStyles:{listFocusBackground:S.listBackground,listInactiveFocusBackground:S.listBackground,listActiveSelectionBackground:S.listBackground,listFocusAndSelectionBackground:S.listBackground,listInactiveSelectionBackground:S.listBackground,listHoverBackground:S.listBackground,listBackground:S.listBackground,listFocusForeground:S.listForeground,listHoverForeground:S.listForeground,listInactiveFocusForeground:S.listForeground,listInactiveSelectionForeground:S.listForeground,listActiveSelectionForeground:S.listForeground,listFocusAndSelectionForeground:S.listForeground,listActiveSelectionIconForeground:void 0,listInactiveSelectionIconForeground:void 0}})),this._scrollDownButton=this._register(new Pi(this._container,{buttonBackground:Tt(_5),buttonForeground:Tt(Gce),buttonHoverBackground:Tt(qce),buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,supportIcons:!0})),this._scrollDownButton.element.classList.add("chat-scroll-down"),this._scrollDownButton.label=`$(${L.chevronDown.id})`,this._scrollDownButton.element.style.display="none",this._register(this._scrollDownButton.onDidClick(()=>{this.setScrollLock(!0),this.scrollToEnd()})),this._register(this._tree.onDidChangeContentHeight(()=>{this._onDidChangeContentHeight.fire()})),this._register(this._tree.onDidFocus(()=>{this._onDidFocus.fire()})),this._register(this._tree.onDidChangeFocus(()=>{let y=this.getFocus();if(y&&y.length>0){let w=y[0],E=this.getItems().findIndex(M=>M===w);E!==-1&&(this._mostRecentlyFocusedItemIndex=E)}})),this._register(this._tree.onDidScroll(y=>{this._onDidScroll.fire(y),this.updateScrollDownButtonVisibility()})),this.updateScrollDownButtonVisibility(),this._register(this._tree.onContextMenu(y=>{this.handleContextMenu(y)})),this._register(this.configurationService.onDidChangeConfiguration(y=>{(y.affectsConfiguration("chat.editRequests")||y.affectsConfiguration("chat.checkpoints.enabled"))&&(this._settingChangeCounter++,this.refresh())}))}get onDidClickRequest(){return this._renderer.onDidClickRequest}get onDidRerender(){return this._renderer.onDidRerender}get onDidDispose(){return this._renderer.onDidDispose}get onDidFocusOutside(){return this._renderer.onDidFocusOutside}get domNode(){return this._container}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get scrollHeight(){return this._tree.scrollHeight}get renderHeight(){return this._tree.renderHeight}get contentHeight(){return this._tree.contentHeight}get isScrolledToBottom(){return this._tree.scrollTop+this._tree.renderHeight>=this._tree.scrollHeight-2}get lastItem(){return this._lastItem}updateScrollDownButtonVisibility(){let e=this.isScrolledToBottom||this._scrollLock;this._scrollDownButton.element.style.display=e?"none":"",this._container.classList.toggle("chat-list-at-bottom",e)}handleContextMenu(e){e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let t=e.element,n=e.browserEvent.target.closest(`.${YLe}`)!==null,r=this.contextKeyService.createOverlay([[Z.isResponse.key,Ni(t)],[Z.responseIsFiltered.key,Ni(t)&&!!t.errorDetails?.responseIsFiltered],[Z.isKatexMathElement.key,n]]);this.contextMenuService.showContextMenu({menuId:R.ChatContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:r,getAnchor:()=>e.anchor,getActionsContext:()=>t})}setViewModel(e){this._viewModel=e,this._renderer.updateViewModel(e)}refresh(){if(!this._viewModel){this._tree.setChildren(null,[]),this._lastItem=void 0,this._lastItemIdContextKey.set([]);return}let e=this._viewModel.getItems();this._lastItem=e.at(-1),this._lastItemIdContextKey.set(this._lastItem?[this._lastItem.id]:[]);let t=e.map(n=>({element:n,collapsed:!1,collapsible:!1})),o=this._viewModel.editing;this._withPersistedAutoScroll(()=>{this._tree.setChildren(null,t,{diffIdentityProvider:{getId:n=>{let r=_r(n)||Ni(n)?n.dataId:n.id,s=_r(n)||Ni(n)?n.shouldBeRemovedOnSend:void 0,l=_r(n)&&o?.id===n.id,c=_r(n)||Ni(n)?n.shouldBeBlocked.get():!1;return r+`${Ni(n)&&n.renderData?`_${this._visibleChangeCount}`:""}`+(Ni(n)?`_${n.contentReferences.length}`:"")+`_${s?`${s.afterUndoStop||"1"}`:"0"}_${l?"edit":""}_${c?"blocked":""}`+(_r(n)?`_${o?"1":"0"}`:"")+`_setting${this._settingChangeCounter}`+(_r(n)&&n.contentReferences?`_${n.contentReferences?.length}`:"")}}})})}setScrollLock(e){this._scrollLock=e,this.updateScrollDownButtonVisibility()}get scrollLock(){return this._scrollLock}setVisibleChangeCount(e){this._visibleChangeCount=e}scrollToCurrentItem(e){if(!this._viewModel?.editing||!e||!this._tree.hasElement(e))return;let t=this._tree.getRelativeTop(e);(t===null||t<0||t>1)&&this._tree.reveal(e,0)}rerender(){this._tree.rerender()}getItems(){let e=[],t=this._tree.getNode(null);for(let o of t.children)o.element&&e.push(o.element);return e}delegateScrollFromMouseWheelEvent(e){this._tree.delegateScrollFromMouseWheelEvent(e)}hasElement(e){return this._tree.hasElement(e)}_updateElementHeight(e,t){this._tree.hasElement(e)&&this._visible&&this._withPersistedAutoScroll(()=>{this._tree.updateElementHeight(e,t)})}reveal(e,t){this._tree.reveal(e,t)}getFocus(){return this._tree.getFocus().filter(e=>e!==null)}setFocus(e){this._tree.setFocus(e)}focusItem(e){this.hasElement(e)&&(this._tree.setFocus([e]),this._tree.domFocus())}focusLastItem(e){let t=this.getItems();if(t.length===0)return-1;let o;return e&&this._mostRecentlyFocusedItemIndex>=0&&this._mostRecentlyFocusedItemIndex<t.length?o=this._mostRecentlyFocusedItemIndex:o=t.length-1,this._tree.setFocus([t[o]]),this._tree.domFocus(),o}scrollToEnd(){if(this._lastItem){let e=Math.max(this._lastItem.currentRenderedHeight??0,1e6);this._tree.hasElement(this._lastItem)&&this._tree.reveal(this._lastItem,e)}}set suppressAutoScroll(e){this._suppressAutoScroll=e}_withPersistedAutoScroll(e){if(this._suppressAutoScroll){e();return}let t=this.isScrolledToBottom;e(),t&&this.scrollToEnd()}focus(){this._tree.domFocus()}isDOMFocused(){return this._tree.isDOMFocused()}getCodeBlockInfosForResponse(e){return this._renderer.getCodeBlockInfosForResponse(e)}getCodeBlockInfoForEditor(e){return this._renderer.getCodeBlockInfoForEditor(e)}getFileTreeInfosForResponse(e){return this._renderer.getFileTreeInfosForResponse(e)}getLastFocusedFileTreeForResponse(e){return this._renderer.getLastFocusedFileTreeForResponse(e)}editorsInUse(){return this._renderer.editorsInUse()}getTemplateDataForRequestId(e){if(e)return this._renderer.getTemplateDataForRequestId(e)}updateRendererOptions(e){this._renderer.updateOptions(e)}setVisible(e){this._visible=e,this._renderer.setVisible(e)}layout(e,t){this._bodyDimension=new di(t??this._container.clientWidth,e),this.updateLastItemMinHeight(),this._tree.layout(e,t),this._renderer.layout(t??this._container.clientWidth)}updateLastItemMinHeight(){if(!this._bodyDimension)return;let e=this._bodyDimension.height;if(this._renderStyle==="compact"||this._renderStyle==="minimal")this._container.style.removeProperty("--chat-current-response-min-height");else{let t=this._viewModel?.getItems().at(-2),n=Math.min(_r(t)||Ni(t)?t.currentRenderedHeight??150:150,200),r=Math.max(e-(n+10),0);if(this._container.style.setProperty("--chat-current-response-min-height",r+"px"),r!==this._previousLastItemMinHeight){this._previousLastItemMinHeight=r;let s=this._viewModel?.getItems().at(-1);s&&this._visible&&this._tree.hasElement(s)&&this._updateElementHeight(s,void 0)}}}};gne=I([m(2,F),m(3,X),m(4,si),m(5,Xe),m(6,re),m(7,B),m(8,F0)],gne);var xNi=class extends k{constructor(){super(...arguments);this.descriptors=[];this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event}register(e){this.descriptors.push(e),this._onDidChange.fire()}get(){return this.descriptors}},u1=new xNi;oe.add("workbench.registry.chat.viewsWelcome",u1);var Kst=_,VWe=class extends k{constructor(e,t,o,n,r){super();this.container=e;this.delegate=t;this.location=o;this.contextKeyService=n;this.instantiationService=r;this.enabled=!1;this.enabledDisposables=this._register(new O);this.renderDisposables=this._register(new O);this._isShowingWelcome=De(this,!1);this.element=D(this.container,_(".chat-view-welcome")),this._register(U.runAndSubscribe(t.onDidChangeViewWelcomeState,()=>this.update())),this._register(u1.onDidChange(()=>this.update(!0)))}get isShowingWelcome(){return this._isShowingWelcome}getMatchingWelcomeView(){return u1.get().filter(o=>this.contextKeyService.contextMatchesRules(o.when)).at(0)}update(e){let t=this.delegate.shouldShowWelcome();if(this.enabled===t&&!e)return;if(this.enabled=t,this.enabledDisposables.clear(),!t){this.container.classList.toggle("chat-view-welcome-visible",!1),this.renderDisposables.clear(),this._isShowingWelcome.set(!1,void 0);return}let o=u1.get();if(o.length){this.render(o);let n=new Set(o.flatMap(r=>r.when.keys()));this.enabledDisposables.add(this.contextKeyService.onDidChangeContext(r=>{r.affectsSome(n)&&this.render(o)}))}}render(e){this.renderDisposables.clear(),St(this.element);let o=e.filter(n=>this.contextKeyService.contextMatchesRules(n.when)).at(0);if(o){let n={icon:o.icon,title:o.title,message:o.content},r=this.renderDisposables.add(this.instantiationService.createInstance(Cve,n,{firstLinkToButton:!0,location:this.location}));this.element.appendChild(r.element),this.container.classList.toggle("chat-view-welcome-visible",!0),this._isShowingWelcome.set(!0,void 0)}else this.container.classList.toggle("chat-view-welcome-visible",!1),this._isShowingWelcome.set(!1,void 0)}};VWe=I([m(3,X),m(4,F)],VWe);var Cve=class extends k{constructor(e,t,o,n,r){super();this.content=e;this.openerService=o;this.logService=n;this.markdownRendererService=r;this.element=_(".chat-welcome-view");try{let s=D(this.element,Kst(".chat-welcome-view-icon"));if(e.useLargeIcon&&s.classList.add("large-icon"),e.icon){if(q.isThemeIcon(e.icon)){let p=un(e.icon);s.appendChild(p)}else if(A.isUri(e.icon)){let p=cl(e.icon),h=new wI;h.update(p);let g=`chat-welcome-icon-${h.digest()}`,f=`.chat-welcome-view-icon.${g}`;Eg(f,`
					mask: ${p} no-repeat 50% 50%;
					-webkit-mask: ${p} no-repeat 50% 50%;
					background-color: var(--vscode-icon-foreground);
				`),s.classList.add(g,"custom-icon")}}let l=D(this.element,Kst(".chat-welcome-view-title"));l.textContent=e.title;let c=D(this.element,Kst(".chat-welcome-view-message")),u=this.renderMarkdownMessageContent(e.message,t);if(D(c,u.element),e.additionalMessage){let p=D(this.element,Kst(".chat-welcome-view-disclaimer"));if(typeof e.additionalMessage=="string")p.textContent=e.additionalMessage;else{let h=this.renderMarkdownMessageContent(e.additionalMessage,t);p.appendChild(h.element)}}if(e.tips){let p=D(this.element,Kst(".chat-welcome-view-tips")),h=this._register(this.markdownRendererService.render(e.tips));p.appendChild(h.element)}}catch(s){this.logService.error("Failed to render chat view welcome content",s)}}needsRerender(e){return this.content.title!==e.title||this.content.message.value!==e.message.value||this.content.additionalMessage!==e.additionalMessage||this.content.tips?.value!==e.tips?.value}renderMarkdownMessageContent(e,t){let o=this._register(this.markdownRendererService.render(e)),n=t?.firstLinkToButton?o.element.querySelector("a"):void 0;if(n){let r=n.getAttribute("data-href"),s=this._register(new Pi(n.parentElement,Ro));s.label=n.textContent??"",r&&this._register(s.onDidClick(()=>{this.openerService.open(r,{allowCommands:!0})})),n.replaceWith(s.element)}return o}};Cve=I([m(2,Je),m(3,re),m(4,_n)],Cve);var S$t=class a extends k{constructor(e,t,o){super();this._chatService=e;this._storageService=t;this._getActiveContextKeyService=o;this._register(this._chatService.onDidSubmitRequest(n=>{let r=n.message??this._chatService.getSession(n.chatSessionResource)?.lastRequest?.message;if(!r)return;for(let c of r.parts)if(c.kind===gE.Kind){let u=c;if(a._isCreateSlashCommand(u.slashCommand.command)){this._markUsed();return}}let s=r.text.trimStart(),l=/^\/(create-(?:instructions|prompt|agent|skill))(?:\s|$)/.exec(s);l&&a._isCreateSlashCommand(l[1])&&this._markUsed()}))}static{this._USED_CREATE_SLASH_COMMANDS_KEY="chat.tips.usedCreateSlashCommands"}syncContextKey(e){let t=this._storageService.getBoolean(a._USED_CREATE_SLASH_COMMANDS_KEY,-1,!1);Z.hasUsedCreateSlashCommands.bindTo(e).set(t)}_markUsed(){if(this._storageService.getBoolean(a._USED_CREATE_SLASH_COMMANDS_KEY,-1,!1))return;this._storageService.store(a._USED_CREATE_SLASH_COMMANDS_KEY,!0,-1,1);let e=this._getActiveContextKeyService();e&&Z.hasUsedCreateSlashCommands.bindTo(e).set(!0)}static _isCreateSlashCommand(e){switch(e){case"create-instructions":case"create-prompt":case"create-agent":case"create-skill":return!0;default:return!1}}};var gO={DismissedTips:"chat.tip.dismissed",LastTipId:"chat.tip.lastTipId",ThinkingPhrasesEverModified:"chat.tip.thinkingPhrasesEverModified"},xve={ExecutedCommands:"chat.tips.executedCommands",UsedModes:"chat.tips.usedModes",InvokedTools:"chat.tips.invokedTools"},$R={AttachFilesReferenceUsed:"chat.tips.attachFiles.referenceUsed",CreateAgentInstructionsUsed:"chat.tips.createAgentInstructions.commandUsed",CreatePromptUsed:"chat.tips.createPrompt.commandUsed",CreateAgentUsed:"chat.tips.createAgent.commandUsed",CreateSkillUsed:"chat.tips.createSkill.commandUsed",ForkConversationUsed:"chat.tips.forkConversation.commandUsed"};var kve=class extends k{constructor(e,t,o,n,r,s){super();this._storageService=o;this._promptsService=n;this._languageModelToolsService=r;this._logService=s;this._commandListener=this._register(new ue);this._toolListener=this._register(new ue);this._excludedByFiles=new Set;this._fileCheckGeneration=new Map;this._fileChecksInFlight=new Map;let l=this._readApplicationWithProfileFallback(xve.ExecutedCommands);this._executedCommands=new Set(l?JSON.parse(l):[]);let c=this._readApplicationWithProfileFallback(xve.UsedModes);this._usedModes=new Set(c?JSON.parse(c):[]);let u=this._readApplicationWithProfileFallback(xve.InvokedTools);this._invokedTools=new Set(u?JSON.parse(u):[]),this._pendingCommands=new Set;for(let p of e)for(let h of p.excludeWhenCommandsExecuted??[])this._executedCommands.has(h)||this._pendingCommands.add(h);this._pendingModes=new Set;for(let p of e)for(let h of p.excludeWhenModesUsed??[])this._usedModes.has(h)||this._pendingModes.add(h);this._pendingTools=new Set;for(let p of e)for(let h of p.excludeWhenToolsInvoked??[])this._invokedTools.has(h)||this._pendingTools.add(h);this._pendingCommands.size>0&&(this._commandListener.value=t.onDidExecuteCommand(p=>{this.recordCommandExecuted(p.commandId)})),this._pendingTools.size>0&&(this._toolListener.value=this._languageModelToolsService.onDidInvokeTool(p=>{this._pendingTools.has(p.toolId)&&(this._invokedTools.add(p.toolId),this._pendingTools.delete(p.toolId),this._persistSet(xve.InvokedTools,this._invokedTools)),this._pendingTools.size===0&&this._toolListener.clear()})),this._tipsWithFileExclusions=e.filter(p=>p.excludeWhenPromptFilesExist);for(let p of this._tipsWithFileExclusions)p.excludeWhenPromptFilesExist.excludeUntilChecked&&this._excludedByFiles.add(p.id),this._checkForPromptFiles(p);this._register(this._promptsService.onDidChangeCustomAgents(()=>{for(let p of this._tipsWithFileExclusions)p.excludeWhenPromptFilesExist.promptType==="agent"&&this._checkForPromptFiles(p)}))}recordCommandExecuted(e){this._pendingCommands.has(e)&&(this._executedCommands.add(e),this._persistSet(xve.ExecutedCommands,this._executedCommands),this._pendingCommands.delete(e),this._pendingCommands.size===0&&this._commandListener.clear())}recordCurrentMode(e){if(this._pendingModes.size===0)return;let t=!1,o=e.getContextKeyValue(Z.chatModeKind.key);o&&!this._usedModes.has(o)&&(this._usedModes.add(o),this._pendingModes.delete(o),t=!0);let n=e.getContextKeyValue(Z.chatModeName.key);n&&!this._usedModes.has(n)&&(this._usedModes.add(n),this._pendingModes.delete(n),t=!0),t&&this._persistSet(xve.UsedModes,this._usedModes)}isExcluded(e){if(e.excludeWhenCommandsExecuted){for(let t of e.excludeWhenCommandsExecuted)if(this._executedCommands.has(t))return this._logService.debug("#ChatTips: tip excluded because command was executed",e.id,t),!0}if(e.excludeWhenModesUsed){for(let t of e.excludeWhenModesUsed)if(this._usedModes.has(t))return this._logService.debug("#ChatTips: tip excluded because mode was used",e.id,t),!0}if(e.excludeWhenToolsInvoked){for(let t of e.excludeWhenToolsInvoked)if(this._invokedTools.has(t))return this._logService.debug("#ChatTips: tip excluded because tool was invoked",e.id,t),!0}return e.excludeWhenPromptFilesExist&&this._excludedByFiles.has(e.id)?(this._logService.debug("#ChatTips: tip excluded because prompt files exist",e.id),!0):!1}refreshPromptFileExclusions(){for(let e of this._tipsWithFileExclusions)e.excludeWhenPromptFilesExist.excludeUntilChecked&&this._excludedByFiles.add(e.id),this._checkForPromptFiles(e)}async _checkForPromptFiles(e){let t=this._fileChecksInFlight.get(e.id);if(t){await t;return}let o=this._doCheckForPromptFiles(e);this._fileChecksInFlight.set(e.id,o);try{await o}finally{this._fileChecksInFlight.get(e.id)===o&&this._fileChecksInFlight.delete(e.id)}}async _doCheckForPromptFiles(e){let t=e.excludeWhenPromptFilesExist,o=(this._fileCheckGeneration.get(e.id)??0)+1;this._fileCheckGeneration.set(e.id,o);try{let[n,r]=await Promise.all([this._promptsService.listPromptFiles(t.promptType,Ie.None),t.agentFileType?this._promptsService.listAgentInstructions(Ie.None):Promise.resolve([])]);if(this._fileCheckGeneration.get(e.id)!==o)return;let s=n.length>0,l=t.agentFileType?r.some(u=>u.type===t.agentFileType):!1;s||l?this._excludedByFiles.add(e.id):this._excludedByFiles.delete(e.id)}catch{if(this._fileCheckGeneration.get(e.id)!==o)return;t.excludeUntilChecked&&this._excludedByFiles.add(e.id)}}_persistSet(e,t){this._storageService.store(e,JSON.stringify([...t]),-1,1)}_readApplicationWithProfileFallback(e){let t=this._storageService.get(e,-1);if(t)return t;let o=this._storageService.get(e,0);return o&&this._storageService.store(e,o,-1,1),o}};kve=I([m(1,fe),m(2,de),m(3,jr),m(4,Wn),m(5,re)],kve);function Eve(a,i){let e=a.keybindingService.lookupKeybinding(i);return e?` (${e.getLabel()})`:""}function kNi(a){let i=/\[.*?\]\(command:([^?\s)]+)/g,e=new Set,t;for(;(t=i.exec(a))!==null;)e.add(t[1]);return[...e]}var SV=[{id:"tip.switchToAuto",tier:"foundational",priority:0,buildMessage(a){return new he(d(8326,null))},onlyWhenModelIds:["gpt-4.1"]},{id:"tip.init",tier:"foundational",priority:50,buildMessage(a){let i=Eve(a,RG);return new he(d(8321,null,"/init",RG,i))},when:Z.chatSessionType.isEqualTo(kl),excludeWhenCommandsExecuted:[RG,$R.CreateAgentInstructionsUsed]},{id:"tip.createPrompt",tier:"foundational",buildMessage(a){let i=Eve(a,T8);return new he(d(8317,null,"/create-prompt",T8,i))},when:Z.chatSessionType.isEqualTo(kl),excludeWhenCommandsExecuted:[T8,$R.CreatePromptUsed]},{id:"tip.createAgent",tier:"foundational",priority:30,buildMessage(a){let i=Eve(a,D8);return new he(d(8316,null,"/create-agent",D8,i))},when:Z.chatSessionType.isEqualTo(kl),excludeWhenCommandsExecuted:[D8,$R.CreateAgentUsed]},{id:"tip.createSkill",tier:"foundational",priority:40,buildMessage(a){let i=Eve(a,_8);return new he(d(8318,null,"/create-skill",_8,i))},when:Z.chatSessionType.isEqualTo(kl),excludeWhenCommandsExecuted:[_8,$R.CreateSkillUsed]},{id:"tip.planMode",tier:"foundational",priority:20,buildMessage(a){let i=Eve(a,"workbench.action.chat.openPlan");return new he(d(8324,null,"Plan agent",i))},when:Z.chatModeName.notEqualsTo("Plan"),excludeWhenCommandsExecuted:["workbench.action.chat.openPlan"],excludeWhenModesUsed:["Plan"]},{id:"tip.attachFiles",tier:"qol",buildMessage(){return new he(d(8312,null))},excludeWhenCommandsExecuted:["workbench.action.chat.attachContext","workbench.action.chat.attachFile","workbench.action.chat.attachFolder","workbench.action.chat.attachSelection",$R.AttachFilesReferenceUsed]},{id:"tip.codeActions",tier:"qol",buildMessage(){return new he(d(8314,null))},excludeWhenCommandsExecuted:["inlineChat.start"]},{id:"tip.undoChanges",tier:"qol",buildMessage(){return new he(d(8329,null))},when:C.and(Z.chatSessionType.isEqualTo(kl),C.or(Z.chatModeKind.isEqualTo("agent"),Z.chatModeKind.isEqualTo("edit"))),excludeWhenCommandsExecuted:["workbench.action.chat.restoreCheckpoint","workbench.action.chat.restoreLastCheckpoint"]},{id:"tip.messageQueueing",tier:"qol",buildMessage(){return new he(d(8323,null))},when:Z.chatModeKind.isEqualTo("agent"),excludeWhenCommandsExecuted:["workbench.action.chat.queueMessage","workbench.action.chat.steerWithMessage"]},{id:"tip.forkConversation",tier:"qol",buildMessage(a){let i=Eve(a,Ret);return new he(d(8320,null,"/fork",Ret,i))},excludeWhenCommandsExecuted:[Ret,"workbench.action.chat.forkConversation",$R.ForkConversationUsed]},{id:"tip.agenticBrowser",tier:"qol",buildMessage(){return new he(d(8311,null,"agentic browser integration"))},when:C.and(Z.chatModeKind.isEqualTo("agent"),C.notEquals("config.workbench.browser.enableChatTools",!0)),excludeWhenSettingsChanged:["workbench.browser.enableChatTools"],dismissWhenCommandsClicked:["workbench.action.openSettings"]},{id:"tip.mermaid",tier:"qol",buildMessage(){return new he(d(8322,null))},when:Z.chatModeKind.isEqualTo("agent"),excludeWhenToolsInvoked:["renderMermaidDiagram"]},{id:"tip.subagents",tier:"qol",buildMessage(){return new he(d(8325,null))},when:Z.chatModeKind.isEqualTo("agent"),excludeWhenToolsInvoked:["runSubagent"]},{id:"tip.thinkingPhrases",tier:"qol",buildMessage(){return new he(d(8327,null,"thinking phrases","chat.agent.thinking.phrases"))},when:Z.chatModeKind.isEqualTo("agent"),excludeWhenSettingsChanged:["chat.agent.thinking.phrases"],dismissWhenCommandsClicked:["workbench.action.openSettings"]},{id:"tip.autoAcceptDelay",tier:"qol",buildMessage(){return new he(d(8313,null,"auto-accept delay"))},when:C.or(Z.chatModeKind.isEqualTo("agent"),Z.chatModeKind.isEqualTo("edit")),excludeWhenSettingsChanged:["chat.editing.autoAcceptDelay"],dismissWhenCommandsClicked:["workbench.action.openSettings"]},{id:"tip.troubleshoot",tier:"qol",buildMessage(a){let i=Eve(a,CWt);return new he(d(8328,null,"/troubleshoot",CWt,i))},when:Z.chatSessionType.isEqualTo(kl),excludeWhenToolsInvoked:["listDebugEvents"]},{id:"tip.copilotCli",tier:"qol",buildMessage(){return new he(d(8315,null))},when:C.and(qo.negate(),Z.chatSessionType.isEqualTo(kl),Z.chatModeKind.isEqualTo("agent"),Z.hasCanDelegateProviders),excludeWhenCommandsExecuted:["workbench.action.chat.openNewChatSessionInPlace.copilotcli"]},{id:"tip.defaultPermissions",tier:"qol",buildMessage(){return new he(d(8319,null,"default permissions","chat.permissions.default"))},when:C.or(Z.chatModeKind.isEqualTo("agent"),Z.chatModeKind.isEqualTo("edit")),excludeWhenSettingsChanged:["chat.permissions.default"],dismissWhenCommandsClicked:["workbench.action.openSettings"]}];var rym=$R.AttachFilesReferenceUsed,Apn=$R.CreateAgentInstructionsUsed,Npn=$R.CreatePromptUsed,Opn=$R.CreateAgentUsed,Fpn=$R.CreateSkillUsed,Wpn=$R.ForkConversationUsed,IV=le("chatTipService"),BWe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._productService=e;this._configurationService=t;this._storageService=o;this._chatService=n;this._logService=s;this._chatEntitlementService=l;this._commandService=c;this._telemetryService=u;this._keybindingService=p;this._onDidDismissTip=this._register(new T);this.onDidDismissTip=this._onDidDismissTip.event;this._onDidNavigateTip=this._register(new T);this.onDidNavigateTip=this._onDidNavigateTip.event;this._onDidHideTip=this._register(new T);this.onDidHideTip=this._onDidHideTip.event;this._onDidDisableTips=this._register(new T);this.onDidDisableTips=this._onDidDisableTips.event;this._tipsHiddenForSession=!1;this._tipCommandListener=this._register(new ue);this._tracker=this._register(r.createInstance(kve,SV)),this._createSlashCommandsUsageTracker=this._register(new S$t(this._chatService,this._storageService,()=>this._contextKeyService)),this._register(this._chatEntitlementService.onDidChangeQuotaExceeded(()=>{this._chatEntitlementService.quotas.chat?.percentRemaining===0&&this._shownTip&&this.hideTip()})),this._register(this._chatService.onDidSubmitRequest(h=>{let g=h.message??this._chatService.getSession(h.chatSessionResource)?.lastRequest?.message;if(!g)return;this._hasFileOrFolderReference(g)&&this._tracker.recordCommandExecuted($R.AttachFilesReferenceUsed);let f=this._getSlashCommandTrackingId(g);f&&this._tracker.recordCommandExecuted(f),this._hideShownTipIfNowIneligible()})),this._thinkingPhrasesEverModified=this._storageService.getBoolean(gO.ThinkingPhrasesEverModified,-1,!1),!this._thinkingPhrasesEverModified&&this._isSettingModified("chat.agent.thinking.phrases")&&(this._thinkingPhrasesEverModified=!0,this._storageService.store(gO.ThinkingPhrasesEverModified,!0,-1,1)),this._thinkingPhrasesEverModified||this._register(this._configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration("chat.agent.thinking.phrases")&&(this._thinkingPhrasesEverModified=!0,this._storageService.store(gO.ThinkingPhrasesEverModified,!0,-1,1))}))}_hasFileOrFolderReference(e){return e.parts.some(t=>{if(t.kind!==FM.Kind)return!1;let o=t;return o.isFile===!0||o.isDirectory===!0})}_getSlashCommandTrackingId(e){for(let n of e.parts){if(n.kind===gE.Kind){let r=n.slashCommand.command;return this._toSlashCommandTrackingId(r)}if(n.kind===cb.Kind){let r=n.command.name;return this._toSlashCommandTrackingId(r)}}let t=e.text.trimStart(),o=/^(?:@\S+\s+)?\/(init|create-(?:instructions|prompt|agent|skill)|fork)(?:\s|$)/.exec(t);return o?this._toSlashCommandTrackingId(o[1]):void 0}_toSlashCommandTrackingId(e){switch(e){case"init":case"create-instructions":return Apn;case"create-prompt":return Npn;case"create-agent":return Opn;case"create-skill":return Fpn;case"fork":return Wpn;default:return}}recordSlashCommandUsage(e){let t=this._toSlashCommandTrackingId(e);t&&(this._tracker.recordCommandExecuted(t),this._hideShownTipIfNowIneligible())}resetSession(){this._shownTip=void 0,this._tipRequestId=void 0,this._contextKeyService=void 0,this._tipsHiddenForSession=!1}dismissTip(){if(this._shownTip){this._logTipTelemetry(this._shownTip.id,"dismissed");let e=new Set(this._getDismissedTipIds());e.add(this._shownTip.id),this._storageService.store(gO.DismissedTips,JSON.stringify([...e]),-1,1)}this._tipRequestId=void 0,this._onDidDismissTip.fire()}dismissTipForSession(){this.dismissTip(),this.hideTipsForSession()}clearDismissedTips(){this._storageService.remove(gO.DismissedTips,-1),this._storageService.remove(gO.DismissedTips,0),this._shownTip=void 0,this._tipRequestId=void 0,this._contextKeyService=void 0,this._tipsHiddenForSession=!1,this._onDidDismissTip.fire()}_getDismissedTipIds(){let e=this._readApplicationWithProfileFallback(gO.DismissedTips);if(!e)return[];try{let t=JSON.parse(e);if(this._logService.debug("#ChatTips dismissed:",t),!Array.isArray(t))return[];let o=new Set(SV.map(r=>r.id)),n=new Set;for(let r of t)typeof r=="string"&&o.has(r)&&n.add(r);return[...n]}catch{return[]}}hideTip(){this._shownTip&&this._logTipTelemetry(this._shownTip.id,"hidden"),this._shownTip=void 0,this._tipRequestId=void 0,this._onDidHideTip.fire()}hideTipsForSession(){this._tipsHiddenForSession||(this._tipsHiddenForSession=!0,this._shownTip=void 0,this._tipRequestId=void 0,this._onDidHideTip.fire())}async disableTips(){this._shownTip&&this._logTipTelemetry(this._shownTip.id,"disabled"),this._shownTip=void 0,this._tipRequestId=void 0,await this._configurationService.updateValue("chat.tips.enabled",!1,1),this._onDidDisableTips.fire()}getWelcomeTip(e){if(this._createSlashCommandsUsageTracker.syncContextKey(e),this._tracker.recordCurrentMode(e),this._tracker.refreshPromptFileExclusions(),!this._configurationService.getValue("chat.tips.enabled")||this._tipsHiddenForSession||(this._contextKeyService=e,!this._isCopilotEnabled())||this._chatEntitlementService.entitlement===1&&!this._chatEntitlementService.hasByokModels||!this._isChatLocation(e)||e.getContextKeyValue(Z.foregroundSessionCount.key)!==1||this._isChatQuotaExceeded(e))return;if(this._tipRequestId==="welcome"&&this._shownTip){if(this._shownTip.id!=="tip.switchToAuto"){let n=SV.find(r=>r.id==="tip.switchToAuto");if(n&&!new Set(this._getDismissedTipIds()).has(n.id)&&this._isEligible(n,e)){this._shownTip=n,this._storageService.store(gO.LastTipId,n.id,-1,0);let s=this._createTip(n);return this._logTipTelemetry(n.id,"shown"),this._trackTipCommandClicks(n),this._onDidNavigateTip.fire(s),s}}if(!this._isEligible(this._shownTip,e)){if(this._tracker.isExcluded(this._shownTip)){this.hideTip();return}let n=this._findNextEligibleTip(this._shownTip.id,e);if(n){this._shownTip=n,this._storageService.store(gO.LastTipId,n.id,-1,0);let r=this._createTip(n);return this._onDidNavigateTip.fire(r),r}this.hideTip();return}return this._createTip(this._shownTip)}return this._pickTip("welcome",e)}_findNextEligibleTip(e,t){this._createSlashCommandsUsageTracker.syncContextKey(t);let o=SV.findIndex(r=>r.id===e);if(o===-1)return;let n=new Set(this._getDismissedTipIds());for(let r=1;r<SV.length;r++){let s=(o+r)%SV.length,l=SV[s];if(!n.has(l.id)&&this._isEligible(l,t))return l}}_hideShownTipIfNowIneligible(){if(!this._shownTip||!this._contextKeyService||this._tipsHiddenForSession)return;let e;try{e=this._isEligible(this._shownTip,this._contextKeyService)}catch{this._contextKeyService=void 0;return}e||this.hideTip()}_pickTip(e,t){this._createSlashCommandsUsageTracker.syncContextKey(t),this._tracker.recordCurrentMode(t);let o=new Set(this._getDismissedTipIds()),n=SV.filter(s=>!o.has(s.id)&&this._isEligible(s,t)),r=this._selectTipByTier(n);if(r)return this._storageService.store(gO.LastTipId,r.id,-1,0),this._tipRequestId=e,this._shownTip=r,this._logTipTelemetry(r.id,"shown"),this._trackTipCommandClicks(r),this._createTip(r)}_selectTipByTier(e){let t=e.filter(r=>r.tier==="foundational");if(t.length)return this._sortByPriorityAndCatalogOrder(t)[0];let o=e.filter(r=>r.tier==="qol");if(!o.length)return;let n=Math.floor(Math.random()*o.length);return o[n]}navigateToNextTip(){if(this._contextKeyService)return this._navigateTip(1,this._contextKeyService)}navigateToPreviousTip(){if(this._contextKeyService)return this._navigateTip(-1,this._contextKeyService)}getNextEligibleTip(){if(!this._contextKeyService||!this._shownTip)return;let e=this._contextKeyService;this._createSlashCommandsUsageTracker.syncContextKey(e);let t=this._shownTip.id,o=this._getOrderedEligibleTips(e,{includeTipId:t});if(!o.length)return;let n=o.findIndex(s=>s.id===t),r=this._getNextTipFromOrderedList(o,n,t);if(r)return this._shownTip=r,this._tipRequestId="welcome",this._storageService.store(gO.LastTipId,r.id,-1,0),this._logTipTelemetry(r.id,"shown"),this._trackTipCommandClicks(r),this._createTip(r)}_getNextTipFromOrderedList(e,t,o){if(!e.length)return;let r=t===-1?0:t;for(let s=1;s<=e.length;s++){let l=(r+s)%e.length,c=e[l];if(c.id!==o)return c}}hasMultipleTips(){return this._contextKeyService?(this._createSlashCommandsUsageTracker.syncContextKey(this._contextKeyService),this._hasNavigableTip(this._contextKeyService)):!1}_navigateTip(e,t){if(this._createSlashCommandsUsageTracker.syncContextKey(t),!this._shownTip)return;let o=this._getOrderedEligibleTips(t);if(!o.length)return;let n=o.findIndex(c=>c.id===this._shownTip.id);if(o.length===1&&n!==-1)return;let r=e===1?0:o.length-1,s=n===-1?r:(n+e+o.length)%o.length,l=o[s];if(l){this._logTipTelemetry(this._shownTip.id,e===1?"navigateNext":"navigatePrevious"),this._shownTip=l,this._tipRequestId="welcome",this._storageService.store(gO.LastTipId,l.id,-1,0),this._logTipTelemetry(l.id,"shown"),this._trackTipCommandClicks(l);let c=this._createTip(l);return this._onDidNavigateTip.fire(c),c}}_hasNavigableTip(e){let t=this._getOrderedEligibleTips(e);return t.length?this._shownTip?t.length>1?!0:t[0].id!==this._shownTip.id:t.length>1:!1}_getOrderedEligibleTips(e,t){let o=new Set(this._getDismissedTipIds()),n=SV.filter(l=>t?.includeTipId&&l.id===t.includeTipId?!0:t?.excludeShownTip&&this._shownTip&&l.id===this._shownTip.id?!1:!o.has(l.id)&&this._isEligible(l,e)),r=this._sortByPriorityAndCatalogOrder(n.filter(l=>l.tier==="foundational")),s=this._sortByPriorityAndCatalogOrder(n.filter(l=>l.tier==="qol"));return[...r,...s]}_sortByPriorityAndCatalogOrder(e){return[...e].sort((t,o)=>{let n=t.priority??Number.POSITIVE_INFINITY,r=o.priority??Number.POSITIVE_INFINITY;if(n!==r)return n-r;let s=SV.findIndex(c=>c.id===t.id),l=SV.findIndex(c=>c.id===o.id);return s-l})}_isEligible(e,t){if(e.onlyWhenModelIds?.length){let o=this._getCurrentChatModelId(t);if(!e.onlyWhenModelIds.some(r=>o===r||o.startsWith(`${r}-`)))return!1}return e.excludeWhenSettingsChanged?.some(o=>this._isSettingModified(o))?(this._logService.debug("#ChatTips: tip excluded because setting was modified",e.id,e.excludeWhenSettingsChanged),!1):e.when&&!t.contextMatchesRules(e.when)?(this._logService.debug("#ChatTips: tip is not eligible due to when clause",e.id,e.when.serialize()),!1):this._tracker.isExcluded(e)?!1:e.id==="tip.thinkingPhrases"&&this._thinkingPhrasesEverModified?(this._logService.debug("#ChatTips: tip excluded because thinking phrases setting was previously modified",e.id),!1):(this._logService.debug("#ChatTips: tip is eligible",e.id),!0)}_isSettingModified(e){let t=this._configurationService.inspect(e);return t.userValue!==void 0||t.userLocalValue!==void 0||t.userRemoteValue!==void 0||t.workspaceValue!==void 0||t.workspaceFolderValue!==void 0}_getCurrentChatModelId(e){let t=l=>{let c=l?.toLowerCase()??"";return c?c.includes("/")?c.split("/").at(-1)??"":c:""},o=t(e.getContextKeyValue(Z.chatModelId.key));if(o)return o;let n=e.getContextKeyValue(Z.location.key)??"panel",r=e.getContextKeyValue(Z.chatSessionType.key)??"",s=r?[`chat.currentLanguageModel.${n}.${r}`,`chat.currentLanguageModel.${n}`]:[`chat.currentLanguageModel.${n}`];for(let l of s){let c=this._storageService.get(l,-1),u=t(c);if(u)return u}return""}_isChatLocation(e){let t=e.getContextKeyValue(Z.location.key);return!t||t==="panel"}_isChatQuotaExceeded(e){return e.getContextKeyValue(Z.chatQuotaExceeded.key)===!0}_isCopilotEnabled(){return!!this._productService.defaultChatAgent?.chatExtensionId}_createTip(e){let t={keybindingService:this._keybindingService},o=e.buildMessage(t),n=d(8330,null,o.value),r=kNi(n),s=new he(n,{isTrusted:r.length>0?{enabledCommands:r}:!1});return{id:e.id,content:s,enabledCommands:r}}_logTipTelemetry(e,t,o){this._telemetryService.publicLog2("chatTip",{tipId:e,action:t,commandId:o})}_trackTipCommandClicks(e){this._tipCommandListener.clear();let t={keybindingService:this._keybindingService},o=e.buildMessage(t),n=kNi(o.value);if(!n.length)return;let r=new Set(n);this._tipCommandListener.value=this._commandService.onDidExecuteCommand(s=>{r.has(s.commandId)&&this._shownTip?.id===e.id&&(this._logTipTelemetry(e.id,"commandClicked",s.commandId),this.dismissTipForSession())})}_readApplicationWithProfileFallback(e){let t=this._storageService.get(e,-1);if(t)return t;let o=this._storageService.get(e,0);return o&&this._storageService.store(e,o,-1,1),o}};BWe=I([m(0,Ze),m(1,B),m(2,de),m(3,si),m(4,F),m(5,re),m(6,dr),m(7,fe),m(8,_e),m(9,Le)],BWe);var FEo=_,HWe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._renderer=t;this._chatTipService=o;this._contextMenuService=n;this._menuService=r;this._contextKeyService=s;this._instantiationService=l;this._openerService=c;this._commandService=u;this._chatEntitlementService=p;this._onDidHide=this._register(new T);this.onDidHide=this._onDidHide.event;this._renderedContent=this._register(new ue);this._toolbar=this._register(new ue);this.domNode=FEo(".chat-tip-widget"),this.domNode.tabIndex=0,this.domNode.setAttribute("role","region"),this.domNode.setAttribute("aria-roledescription",d(8901,null)),this._inChatTipContextKey=Z.inChatTip.bindTo(this._contextKeyService),this._multipleChatTipsContextKey=Z.multipleChatTips.bindTo(this._contextKeyService);let h=this._register(nr(this.domNode));this._register(h.onDidFocus(()=>this._inChatTipContextKey.set(!0))),this._register(h.onDidBlur(()=>this._inChatTipContextKey.set(!1))),this._register({dispose:()=>{this._inChatTipContextKey.reset(),this._multipleChatTipsContextKey.reset()}}),this._renderTip(e),this._register(this._chatTipService.onDidDismissTip(()=>{this._onDidHide.fire()})),this._register(this._chatTipService.onDidNavigateTip(g=>{this._renderTip(g),Cg(Me(this.domNode),()=>this.focus())})),this._register(this._chatTipService.onDidHideTip(()=>{this._onDidHide.fire()})),this._register(this._chatTipService.onDidDisableTips(()=>{this._onDidHide.fire()})),this._register($(this.domNode,ne.CONTEXT_MENU,g=>{Kt.stop(g,!0);let f=new Ln(Me(this.domNode),g);this._contextMenuService.showContextMenu({getAnchor:()=>f,getActions:()=>{let v=this._menuService.getMenuActions(R.ChatTipContext,this._contextKeyService);return Lu(v)}})}))}hasFocus(){return Is(this.domNode)}focus(){this.domNode.focus()}_renderTip(e){St(this.domNode),this._toolbar.clear(),this._multipleChatTipsContextKey.set(this._chatTipService.hasMultipleTips());let t=this._renderer.render(e.content,{actionHandler:(l,c)=>{this._handleTipAction(l,c).catch(mt)}});this._renderedContent.value=t,this.domNode.appendChild(t.element);let o=FEo(".chat-tip-toolbar");this._toolbar.value=this._instantiationService.createInstance(pr,o,R.ChatTipToolbar,{menuOptions:{shouldForwardArgs:!0}}),this.domNode.appendChild(o);let n=t.element.textContent??d(8894,null),s=/\[.*?\]\(.*?\)/.test(e.content.value)?d(8902,null,n):n;this.domNode.setAttribute("aria-label",s)}async _handleTipAction(e,t){e.startsWith("command:")&&this._shouldTriggerSetup()&&!await this._commandService.executeCommand(aS)||await WT(this._openerService,e,t.isTrusted)}_shouldTriggerSetup(){return this._chatEntitlementService.hasByokModels?!1:this._chatEntitlementService.sentiment?.completed?this._chatEntitlementService.entitlement===1:!0}};HWe=I([m(2,IV),m(3,Xe),m(4,Yt),m(5,X),m(6,F),m(7,Je),m(8,fe),m(9,dr)],HWe);W(class extends z{constructor(){super({id:"workbench.action.chat.previousTip",title:P(8899,"Previous tip"),icon:L.chevronLeft,precondition:Z.multipleChatTips,f1:!1,menu:[{id:R.ChatTipToolbar,group:"navigation",order:1}]})}async run(i){i.get(IV).navigateToPreviousTip()}});W(class extends z{constructor(){super({id:"workbench.action.chat.nextTip",title:P(8898,"Next tip"),icon:L.chevronRight,precondition:Z.multipleChatTips,f1:!1,menu:[{id:R.ChatTipToolbar,group:"navigation",order:2}]})}async run(i){i.get(IV).navigateToNextTip()}});W(class extends z{constructor(){super({id:"workbench.action.chat.dismissTipToolbar",title:P(8897,"Dismiss tip"),icon:L.check,f1:!1,menu:[{id:R.ChatTipToolbar,group:"navigation",order:3}]})}async run(i){i.get(IV).dismissTipForSession()}});W(class extends z{constructor(){super({id:"workbench.action.chat.dismissTip",title:P(8896,"Dismiss this tip"),f1:!1,menu:[{id:R.ChatTipContext,group:"chatTip",order:1}]})}async run(i){i.get(IV).dismissTipForSession()}});W(class extends z{constructor(){super({id:"workbench.action.chat.disableTips",title:P(8895,"Disable tips"),icon:L.bellSlash,f1:!1,menu:[{id:R.ChatTipContext,group:"chatTip",order:2},{id:R.ChatTipToolbar,group:"navigation",order:5}]})}async run(i){let e=i.get(IV),t=i.get(fe);await e.disableTips(),await t.executeCommand("workbench.action.openSettings","chat.tips.enabled")}});W(class extends z{constructor(){super({id:"workbench.action.chat.resetDismissedTips",title:P(8900,"Reset Dismissed Tips"),f1:!0,precondition:Z.enabled})}async run(i){i.get(IV).clearDismissedTips()}});var I$t=_;function y$t(a){return Ppe(a.viewContext)&&!!a.viewContext.isQuickChat}function WEo(a){return Ppe(a.viewContext)&&!!a.viewContext.isInlineChat}var VEo={supportsFileAttachments:!0,supportsToolAttachments:!0,supportsMCPAttachments:!0,supportsImageAttachments:!0,supportsSearchResultAttachments:!0,supportsInstructionAttachments:!0,supportsSourceControlAttachments:!0,supportsProblemAttachments:!0,supportsSymbolAttachments:!0,supportsTerminalAttachments:!0,supportsPromptAttachments:!0,supportsHandOffs:!0,supportsCheckpoints:!0},ENi=d(9082,null),my=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce,Se){super();this.viewOptions=o;this.styles=n;this.codeEditorService=r;this.configurationService=s;this.dialogService=l;this.contextKeyService=c;this.instantiationService=u;this.chatService=p;this.chatAgentService=h;this.chatWidgetService=g;this.chatAccessibilityService=f;this.logService=v;this.themeService=b;this.chatSlashCommandService=S;this.telemetryService=w;this.promptsService=x;this.customizationHarnessService=E;this.toolsService=M;this.chatLayoutService=N;this.chatEntitlementService=V;this.chatSessionsService=H;this.agentSessionsService=K;this.chatTodoListService=j;this.lifecycleService=J;this.chatAttachmentResolveService=se;this.chatTipService=ae;this.chatDebugService=ce;this.accessibilityService=Se;this._onDidSubmitAgent=this._register(new T);this.onDidSubmitAgent=this._onDidSubmitAgent.event;this._onDidChangeAgent=this._register(new T);this.onDidChangeAgent=this._onDidChangeAgent.event;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidChangeViewModel=this._register(new T);this.onDidChangeViewModel=this._onDidChangeViewModel.event;this._onDidScroll=this._register(new T);this.onDidScroll=this._onDidScroll.event;this._onDidAcceptInput=this._register(new T);this.onDidAcceptInput=this._onDidAcceptInput.event;this._onDidHide=this._register(new T);this.onDidHide=this._onDidHide.event;this._onDidShow=this._register(new T);this.onDidShow=this._onDidShow.event;this._onDidChangeParsedInput=this._register(new T);this.onDidChangeParsedInput=this._onDidChangeParsedInput.event;this._onDidChangeActiveInputEditor=this._register(new T);this.onDidChangeActiveInputEditor=this._onDidChangeActiveInputEditor.event;this._onWillMaybeChangeHeight=this._register(new T);this.onWillMaybeChangeHeight=this._onWillMaybeChangeHeight.event;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this._onDidChangeContentHeight=this._register(new T);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidChangeEmptyState=this._register(new T);this.onDidChangeEmptyState=this._onDidChangeEmptyState.event;this.contribs=[];this.visibilityTimeoutDisposable=this._register(new ue);this.visibilityAnimationFrameDisposable=this._register(new ue);this.inputPartDisposable=this._register(new ue);this.inlineInputPartDisposable=this._register(new ue);this.recentlyRestoredCheckpoint=!1;this.welcomePart=this._register(new ue);this._gettingStartedTipPart=this._register(new ue);this.visibleChangeCount=0;this._visible=!1;this._isRenderingWelcome=!1;this._attachmentCapabilities=VEo;this.viewModelDisposables=this._register(new O);this._editingSession=De(this,void 0);this._viewModelObs=vi(this,this.onDidChangeViewModel,()=>this.viewModel);this._lockedToCodingAgentContextKey=Z.lockedToCodingAgent.bindTo(this.contextKeyService),this._lockedCodingAgentIdContextKey=Z.lockedCodingAgentId.bindTo(this.contextKeyService),this._chatSessionSupportsForkContextKey=Z.chatSessionSupportsFork.bindTo(this.contextKeyService),this._agentSupportsAttachmentsContextKey=Z.agentSupportsAttachments.bindTo(this.contextKeyService),this._sessionIsEmptyContextKey=Z.chatSessionIsEmpty.bindTo(this.contextKeyService),this._hasPendingRequestsContextKey=Z.hasPendingRequests.bindTo(this.contextKeyService),this._sessionHasDebugDataContextKey=Z.chatSessionHasDebugData.bindTo(this.contextKeyService),this._register(this.chatDebugService.onDidAddEvent(xe=>{let He=this.viewModel?.sessionResource;He&&xe.sessionResource.toString()===He.toString()&&this._sessionHasDebugDataContextKey.set(!0)})),this.viewContext=t??{};let Re=this._viewModelObs;typeof e=="object"?this._location=e:this._location={location:e},Z.inChatSession.bindTo(c).set(!0),Z.location.bindTo(c).set(this._location.location),Z.inQuickChat.bindTo(c).set(y$t(this)),this.agentInInput=Z.inputHasAgent.bindTo(c),this.requestInProgress=Z.requestInProgress.bindTo(c),this.hasActiveRequest=Z.hasActiveRequest.bindTo(c),this._register(this.chatEntitlementService.onDidChangeAnonymous(()=>this.renderWelcomeViewContentIfNeeded())),this._register(this.configurationService.onDidChangeConfiguration(xe=>{if(xe.affectsConfiguration("chat.tips.enabled")){if(this.configurationService.getValue("chat.tips.enabled"))this.updateChatViewVisibility();else if(this.inputPart){this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear();let He=this.inputPart.gettingStartedTipContainerElement;St(He),Md(!1,He)}}xe.affectsConfiguration("chat.progressBorder.enabled")&&this.updateWorkingProgressBorder()})),this._register(this.accessibilityService.onDidChangeReducedMotion(()=>{this.updateWorkingProgressBorder(),this.visible&&this.listWidget.rerender()})),this._register(cu(VXe,c,xe=>{let He=this._editingSession.read(xe);return He?He.entries.read(xe).filter(It=>It.state.read(xe)!==0).map(It=>It.entryId):void 0})),this._register(cu(dR,c,xe=>(this._editingSession.read(xe)?.entries.read(xe)??[]).filter(It=>It.state.read(xe)===0).length>0)),this._register(cu(BXe,c,xe=>{let He=this._editingSession.read(xe);return He?He.entries.read(xe).length>0:!1})),this._register(cu(XAt,c,xe=>this._editingSession.read(xe)!==null)),this._register(cu(Z.chatEditingCanUndo,c,xe=>this._editingSession.read(xe)?.canUndo.read(xe)||!1)),this._register(cu(Z.chatEditingCanRedo,c,xe=>this._editingSession.read(xe)?.canRedo.read(xe)||!1)),this._register(cu(W3,c,xe=>{let He=Re.read(xe)?.model;if(!this._editingSession.read(xe)||!He)return!1;let Te=vi(this,He.onDidChange,()=>He.getRequests().at(-1)?.response).read(xe);return Te?.result?.errorDetails&&!Te?.result?.errorDetails.responseIsIncomplete})),this.chatSuggestNextWidget=this._register(this.instantiationService.createInstance(lFe)),this._register(ve(xe=>{let He=Re.read(xe),Te=y.editingSessionsObs.read(xe).find(tt=>ze(tt.chatSessionResource,He?.sessionResource));if(this._editingSession.set(void 0,void 0),this.renderChatEditingSessionState(),!Te)return;let It=Te.entries.read(xe);for(let tt of It)tt.state.read(xe);this._editingSession.set(Te,void 0),xe.store.add(Te.onDidDispose(()=>{this._editingSession.set(void 0,void 0),this.renderChatEditingSessionState()})),xe.store.add(this.inputEditor.onDidChangeModelContent(()=>{this.getInput()===""&&this.refreshParsedInput()})),this.renderChatEditingSessionState()})),this._register(this.codeEditorService.registerCodeEditorOpenHandler(async(xe,He,Ee)=>{let Te=xe.resource;if(Te.scheme!==Q.vscodeChatCodeBlock)return null;let It=Te.path.split("/").at(1);if(!It)return null;let tt=this.viewModel?.getItems().find(Oi=>Oi.id===It);if(!tt)return null;this.reveal(tt),await Li(0);for(let Oi of this.listWidget.editorsInUse())if(Jn.isEqual(Oi.uri,Te,!0)){let zt=Oi.editor,mo=0,dn=zt.getDomNode();if(dn){let No=rf(dn,"monaco-list-row");No&&(mo=pF(dn).top-pF(No).top)}if(xe.options?.selection){let No=zt.getTopForPosition(xe.options.selection.startLineNumber,xe.options.selection.startColumn);mo+=No,zt.focus(),zt.setSelection({startLineNumber:xe.options.selection.startLineNumber,startColumn:xe.options.selection.startColumn,endLineNumber:xe.options.selection.endLineNumber??xe.options.selection.startLineNumber,endColumn:xe.options.selection.endColumn??xe.options.selection.startColumn})}return this.reveal(tt,mo),zt}return null})),this._register(this.onDidChangeParsedInput(()=>this.updateChatInputContext())),this._register(this.chatTodoListService.onDidUpdateTodos(xe=>{ze(this.viewModel?.sessionResource,xe)&&this.inputPart.renderChatTodoListWidget(xe)}))}static{this.CONTRIBS=[]}get domNode(){return this.container}get visible(){return this._visible}set viewModel(e){if(this._viewModel===e)return;let t=this._viewModel?.sessionResource;this.viewModelDisposables.clear(),this._viewModel=e,e?(this.viewModelDisposables.add(e),this.logService.debug("ChatWidget#setViewModel: have viewModel"),e.model.requestInProgress.get()&&this.chatAccessibilityService.acceptRequest(e.sessionResource,!0)):this.logService.debug("ChatWidget#setViewModel: no viewModel"),this._onDidChangeViewModel.fire({previousSessionResource:t,currentSessionResource:this._viewModel?.sessionResource})}get viewModel(){return this._viewModel}get parsedInput(){if(this.parsedChatRequest===void 0){if(!this.viewModel)return{text:"",parts:[]};this.parsedChatRequest=this.instantiationService.createInstance(nR).parseChatRequestWithReferences(O2(this),RZ(this),this.getInput(),this.location,{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this.attachmentCapabilities,forcedAgent:this._lockedAgent?.id?this.chatAgentService.getAgent(this._lockedAgent.id):void 0,sessionType:yn(this.viewModel.model.sessionResource)}),this._onDidChangeParsedInput.fire()}return this.parsedChatRequest}get scopedContextKeyService(){return this.contextKeyService}get location(){return this._location.location}get supportsChangingModes(){return!!this.viewOptions.supportsChangingModes}get locationData(){return this._location.resolveData?.()}set lastSelectedAgent(e){this.parsedChatRequest=void 0,this._lastSelectedAgent=e,this._updateAgentCapabilitiesContextKeys(e),this._onDidChangeParsedInput.fire()}get lastSelectedAgent(){return this._lastSelectedAgent}_updateAgentCapabilitiesContextKeys(e){let t=e?.capabilities??(this._lockedAgent?this.chatSessionsService.getCapabilitiesForSessionType(this._lockedAgent.id):void 0);this._attachmentCapabilities=t??VEo;let o=Object.keys(yA(this._attachmentCapabilities,(n,r)=>r===!0)).length>0;this._agentSupportsAttachmentsContextKey.set(o)}get supportsFileReferences(){return!!this.viewOptions.supportsFileReferences}get attachmentCapabilities(){return this._attachmentCapabilities}get input(){return this.viewModel?.editing&&this.configurationService.getValue("chat.editRequests")!=="input"?this.inlineInputPart:this.inputPart}get inputPart(){return this.inputPartDisposable.value}get inlineInputPart(){return this.inlineInputPartDisposable.value}updateWorkingProgressBorder(){let e=this.inputPartDisposable.value;if(!e)return;let t=e.inputContainerElement;if(!t)return;let o=this.configurationService.getValue("chat.progressBorder.enabled")===!0&&!this.accessibilityService.isMotionReduced()&&!WEo(this),n=!!this.viewModel?.model.requestInProgress.get();t.classList.toggle("working",o&&n)}get inputEditor(){return this.input.inputEditor}get contentHeight(){return this.input.height.get()+this.listWidget.contentHeight+this.chatSuggestNextWidget.height}get scrollTop(){return this.listWidget.scrollTop}set scrollTop(e){this.listWidget.scrollTop=e}get attachmentModel(){return this.input.attachmentModel}render(e){let t=tw(this.viewContext)?this.viewContext.viewId:void 0;this.editorOptions=this._register(this.instantiationService.createInstance(d1,t,this.styles.listForeground,this.styles.inputEditorBackground,this.styles.resultEditorBackground));let o=this.viewOptions.renderInputOnTop??!1,n=this.viewOptions.renderFollowups??!o,r=this.viewOptions.renderStyle,s=this.viewOptions.renderInputToolbarBelowInput??!1;this.container=D(e,I$t(".interactive-session")),this.welcomeMessageContainer=D(this.container,I$t(".chat-welcome-view-container",{style:"display: none"})),this._register(Yo(this.welcomeMessageContainer,ne.CLICK,()=>this.focusInput())),this._register(this.chatSuggestNextWidget.onDidChangeHeight(()=>{this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width)})),this._register(this.chatSuggestNextWidget.onDidSelectPrompt(({handoff:c,agentId:u,withAutopilot:p})=>{this.handleNextPromptSelection(c,u,p)})),o?(this.createInput(this.container,{renderFollowups:n,renderStyle:r,renderInputToolbarBelowInput:s}),this.listContainer=D(this.container,I$t(".interactive-list"))):(this.listContainer=D(this.container,I$t(".interactive-list")),D(this.container,this.chatSuggestNextWidget.domNode),this.createInput(this.container,{renderFollowups:n,renderStyle:r,renderInputToolbarBelowInput:s})),this.renderWelcomeViewContentIfNeeded(),this.createList(this.listContainer,{editable:!WEo(this)&&!y$t(this),...this.viewOptions.rendererOptions,renderStyle:r}),this._register($(this.container,ne.MOUSE_WHEEL,c=>{c.defaultPrevented||c.target!==this.container||this.listWidget.delegateScrollFromMouseWheelEvent(c)})),this._register($(e,ne.MOUSE_WHEEL,c=>{if(c.defaultPrevented)return;let u=c.target;u&&ms(u,this.container)||this.listWidget.delegateScrollFromMouseWheelEvent(c)})),this._register(ve(c=>{let u=this.chatLayoutService.fontFamily.read(c),p=this.chatLayoutService.fontSize.read(c);this.container.style.setProperty("--vscode-chat-font-family",u),this.container.style.fontSize=`${p}px`,this.visible&&this.listWidget.rerender()})),this._register(U.runAndSubscribe(this.editorOptions.onDidChange,()=>this.onDidStyleChange())),this.viewModel&&(this.onDidChangeItems(),this.listWidget.scrollToEnd()),this.contribs=my.CONTRIBS.map(c=>{try{return this._register(this.instantiationService.createInstance(c,this))}catch(u){this.logService.error("Failed to instantiate chat widget contrib",Mn(u));return}}).filter(so),this._register(this.chatWidgetService.register(this));let l=vi(this.onDidChangeParsedInput,()=>this.parsedInput);this._register(ve(c=>{let u=l.read(c),p=new Map,h=new Set;for(let g of this.attachmentModel.attachments)g.range&&h.add(g.id);for(let g of u.parts)if(g instanceof iw||g instanceof U0||g instanceof FM){let f=g.toVariableEntry();p.set(f.id,f),h.delete(f.id)}this.attachmentModel.updateContext(h,p.values())})),this.focusedInputDOM||(this.focusedInputDOM=this.container.appendChild(_(".focused-input-dom")))}focusInput(){this.input.focus(),this._onDidFocus.fire()}focusTodosView(){return this.input.hasVisibleTodos()?this.input.focusTodoList():!1}toggleTodosViewFocus(){return this.input.hasVisibleTodos()?this.input.isTodoListFocused()?(this.focusInput(),!0):this.input.focusTodoList():!1}focusQuestionCarousel(){return this.input.questionCarousel?this.input.focusQuestionCarousel():!1}toggleQuestionCarouselFocus(){return this.input.questionCarousel?this.input.isQuestionCarouselFocused()?(this.focusInput(),!0):this.input.focusQuestionCarousel():!1}navigateToPreviousQuestion(){return this.input.questionCarousel?this.input.navigateToPreviousQuestion():!1}navigateToNextQuestion(){return this.input.questionCarousel?this.input.navigateToNextQuestion():!1}focusQuestionCarouselTerminal(){return this.input.focusQuestionCarouselTerminal()}toggleTipFocus(){return this._gettingStartedTipPartRef?.hasFocus()?(this.focusInput(),!0):this._gettingStartedTipPartRef?(this._gettingStartedTipPartRef.focus(),!0):!1}hasInputFocus(){return this.input.hasFocus()}refreshParsedInput(){if(!this.viewModel)return;let e=this.parsedChatRequest,t={selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this.attachmentCapabilities,sessionType:yn(this.viewModel.model.sessionResource),forcedAgent:this._lockedAgent?.id?this.chatAgentService.getAgent(this._lockedAgent.id):void 0};this.parsedChatRequest=this.instantiationService.createInstance(nR).parseChatRequestWithReferences(O2(this),RZ(this),this.getInput(),this.location,t),(!e||!lSi.equals(e,this.parsedChatRequest))&&this._onDidChangeParsedInput.fire()}getSibling(e,t){if(!Ni(e))return;let o=this.viewModel?.getItems();if(!o)return;let n=o.filter(l=>Ni(l)),r=n.indexOf(e);if(r===void 0)return;let s=t==="next"?r+1:r-1;if(!(s<0||s>n.length-1))return n[s]}async clear(){this.logService.debug("ChatWidget#clear"),this._dynamicMessageLayoutData&&(this._dynamicMessageLayoutData.enabled=!0),this.viewModel?.editing&&this.finishedEditing(),this.viewModel&&this.viewModel.resetInputPlaceholder(),this._lockedAgent?this.lockToCodingAgent(this._lockedAgent.name,this._lockedAgent.displayName,this._lockedAgent.id):this.unlockFromCodingAgent(),this.inputPart?.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.inputPart?.clearArtifactsWidget(),this.chatSuggestNextWidget.hide(),await this.viewOptions.clear?.()}onDidChangeItems(e){(this._visible||!this.viewModel)&&((this.viewModel?.getItems()??[]).length>0?this.updateChatViewVisibility():this.renderWelcomeViewContentIfNeeded(),this._onWillMaybeChangeHeight.fire(),this.listWidget.setVisibleChangeCount(this.visibleChangeCount),this.listWidget.refresh(),!e&&this._dynamicMessageLayoutData&&this.layoutDynamicChatTreeItemMode(),this.renderFollowups())}updateChatViewVisibility(){if(this.viewModel){let e=this.viewOptions.renderStyle!=="compact"&&this.viewOptions.renderStyle!=="minimal",t=this.viewModel.getItems().length;if(Md(t===0,this.welcomeMessageContainer),Md(t!==0,this.listContainer),e&&this.inputPart){let o=this.inputPart.gettingStartedTipContainerElement;t===0?this.renderGettingStartedTipIfNeeded():(this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),St(o),Md(!1,o))}}this.container.classList.toggle("chat-view-getting-started-disabled",this.chatEntitlementService.sentiment.completed||this.chatEntitlementService.hasByokModels),this._onDidChangeEmptyState.fire()}isEmpty(){return(this.viewModel?.getItems().length??0)===0}renderWelcomeViewContentIfNeeded(){if(!this._isRenderingWelcome&&this.inputPartDisposable.value){this._isRenderingWelcome=!0;try{if(this.viewOptions.renderStyle==="compact"||this.viewOptions.renderStyle==="minimal"||this.lifecycleService.willShutdown)return;if(!(this.viewModel?.getItems().length??0)){let t=this.chatAgentService.getDefaultAgent(this.location,this.input.currentModeKind),o;if(this.chatEntitlementService.anonymous&&!this.chatEntitlementService.sentiment.completed){let r=$i.defaultChatAgent.provider;o=new he(d(9088,null,r.default.name,r.default.name,$i.defaultChatAgent.termsStatementUrl,$i.defaultChatAgent.privacyStatementUrl),{isTrusted:!0})}else o=t?.metadata.additionalWelcomeMessage;!o&&!this._lockedAgent&&(o=this._getGenerateInstructionsMessage());let n=this.getWelcomeViewContent(o);(!this.welcomePart.value||this.welcomePart.value.needsRerender(n))&&(St(this.welcomeMessageContainer),this.welcomePart.value=this.instantiationService.createInstance(Cve,n,{location:this.location,isWidgetAgentWelcomeViewContent:this.input?.currentModeKind==="agent"}),D(this.welcomeMessageContainer,this.welcomePart.value.element))}this.updateChatViewVisibility()}finally{this._isRenderingWelcome=!1}}}renderGettingStartedTipIfNeeded(){if(!this.inputPart)return;let e=this.inputPart.gettingStartedTipContainerElement,t=this.chatTipService.getWelcomeTip(this.contextKeyService);if(!t){this._gettingStartedTipPart.value&&(this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),St(e)),Md(!1,e);return}if(this._gettingStartedTipPart.value){Md(!0,e);return}let o=new O,n=this.instantiationService.createInstance(zoe),r=o.add(this.instantiationService.createInstance(HWe,t,n));this._gettingStartedTipPartRef=r,o.add(r.onDidHide(()=>{r.domNode.remove(),this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear(),Md(!1,e),this.focusInput()})),this._gettingStartedTipPart.value=o,St(e),e.appendChild(r.domNode),Md(!0,e)}_getGenerateInstructionsMessage(){return this._instructionFilesCheckPromise||(this._instructionFilesCheckPromise=this._checkForAgentInstructionFiles(),this._register(Rvt(this._instructionFilesCheckPromise,e=>{this._instructionFilesExist=e,(this.viewModel?.getItems().length??0)===0&&this.renderWelcomeViewContentIfNeeded()}))),this._instructionFilesExist===!0?new he(""):this._instructionFilesExist===!1?new he(d(9083,null,`command:${RG}`),{isTrusted:{enabledCommands:[RG]}}):new he("")}async _checkForAgentInstructionFiles(){try{return(await this.promptsService.listAgentInstructions(Ie.None)).length>0}catch(e){return this.logService.warn("[ChatWidget] Error checking for instruction files:",e),!1}}getWelcomeViewContent(e){if(this.isLockedToCodingAgent){let o=this._lockedAgent?this.chatSessionsService.getChatSessionContribution(this._lockedAgent.id):void 0,n=o?.icon,r=o?.welcomeTitle,s=o?.welcomeMessage,l=s?new he(s):this._lockedAgent?.prefix==="@copilot "?new he(d(9085,null,this._lockedAgent.prefix,"https://aka.ms/coding-agent-docs")+ENi,{isTrusted:!0}):new he(d(9087,null,this._lockedAgent?.prefix)+ENi);return{title:r??d(9084,null,this._lockedAgent?.prefix),message:l,icon:n??L.sendToRemoteAgent,additionalMessage:e,useLargeIcon:!!n}}let t;return this.input.currentModeKind==="ask"?t=d(9081,null):this.input.currentModeKind==="edit"?t=d(9086,null):t=d(9074,null),{title:t,message:new he(ENi),icon:L.chatSparkle,additionalMessage:e}}async renderChatEditingSessionState(){this.input&&this.input.renderChatEditingSessionState(this._editingSession.get()??null)}async renderFollowups(){let e=this.listWidget.lastItem;e&&Ni(e)&&e.isComplete?this.input.renderFollowups(e.replyFollowups,e):this.input.renderFollowups(void 0,void 0)}renderChatSuggestNextWidget(){if(this.lifecycleService.willShutdown)return;if(this.isLockedToCodingAgent&&!this._attachmentCapabilities.supportsHandOffs){this.chatSuggestNextWidget.hide();return}let e=this.viewModel?.getItems()??[];if(!e.length)return;let t=e[e.length-1];if(!(t&&Ni(t)&&t.isComplete)||t.isCanceled){this.chatSuggestNextWidget.hide();return}let n=t.model.request?.modeInfo,r,s=this.input.currentChatModesObs.get();n?.modeInstructions?.name?r=s.findModeByName(n.modeInstructions.name):n?.modeId?r=s.findModeById(n.modeId):r=this.input.currentModeObs.get();let l=r?.handOffs?.get();if(r&&l&&l.length>0){if(this.inputPart.currentModeInfo.permissionLevel==="autopilot"){let p=l.find(h=>h.send);if(p){this.handleNextPromptSelection(p);return}}let u=this.chatSuggestNextWidget.domNode.style.display==="none";this.chatSuggestNextWidget.render(r),u&&this.telemetryService.publicLog2("chat.handoffWidgetShown",{agent:x8(r),handoffCount:l.length})}else this.chatSuggestNextWidget.hide();this.bodyDimension&&this.layout(this.bodyDimension.height,this.bodyDimension.width)}handleNextPromptSelection(e,t,o){this.chatSuggestNextWidget.hide(),o&&this.inputPart.setPermissionLevel("autopilot");let n=e.prompt,r=this.input.currentModeObs.get(),s=e.agent?this.input.currentChatModesObs.get().findModeByName(e.agent):void 0;this.telemetryService.publicLog2("chat.handoffClicked",{fromAgent:x8(r),toAgent:t||(s?x8(s):""),hasPrompt:!!n,autoSend:!!e.send}),this.executeHandoff(e,t).catch(l=>{let c=t??e.agent??"unknown";this.logService.error(`[Handoff] Failed to execute handoff '${e.label}' to '${c}'`,l)})}async executeHandoff(e,t){this.chatSuggestNextWidget.hide();let o=e.prompt;if(t)this.input.setValue(`@${t} ${o}`,!1),this.input.focus(),this.acceptInput().catch(n=>this.logService.error(`[Handoff] Failed to submit delegated handoff to '@${t}'`,n));else if(e.agent){if(!await this._switchToAgentByName(e.agent)){this.logService.warn(`[Handoff] Did not execute handoff '${e.label}' to '${e.agent}' because switching agents was unsuccessful`);return}e.model&&this.input.switchModelByQualifiedName([e.model]),this.input.setValue(o,!1),this.input.focus(),e.send&&this.acceptInput().catch(r=>this.logService.error(`[Handoff] Failed to submit handoff to '${e.agent}'`,r))}}async handleDelegationExitIfNeeded(e,t){if(this._shouldExitAfterDelegation(e,t)){this.logService.debug(`[Delegation] Will exit after delegation: sourceAgent=${e?.id}, targetAgent=${t?.id}`);try{await this._handleDelegationExit()}catch(o){this.logService.error("[Delegation] Failed to handle delegation exit",o)}}}_shouldExitAfterDelegation(e,t){if(!t)return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (no targetAgent)"),!1;if(!this.configurationService.getValue("chat.exitAfterDelegation"))return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (ExitAfterDelegation config disabled)"),!1;if(e&&e.id===t.id)return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (source and target agents are the same)"),!1;if(!tw(this.viewContext))return this.logService.debug("[Delegation] _shouldExitAfterDelegation: false (not in chat view context)"),!1;let o=this.chatSessionsService.getChatSessionContribution(t.id);return o?o.canDelegate!==!0?(this.logService.debug(`[Delegation] _shouldExitAfterDelegation: false (contribution.canDelegate=${o.canDelegate}, expected true)`),!1):(this.logService.debug("[Delegation] _shouldExitAfterDelegation: true"),!0):(this.logService.debug(`[Delegation] _shouldExitAfterDelegation: false (no contribution found for targetAgent.id=${t.id})`),!1)}async _handleDelegationExit(){let e=this.viewModel;if(!e){this.logService.debug("[Delegation] _handleDelegationExit: no viewModel, returning");return}let t=e.sessionResource;this.logService.debug(`[Delegation] _handleDelegationExit: parentSessionResource=${t.toString()}`);let o=()=>{let r=e.getItems(),s=r[r.length-1];return s&&Ni(s)&&s.model&&s.isComplete&&!s.model.isPendingConfirmation.get()?!!!s.result?.errorDetails:!1};if(o()){this.logService.debug("[Delegation] Response complete, archiving session before clearing"),await this.archiveLocalParentSession(t),await this.clear();return}this.logService.debug("[Delegation] Waiting for response to complete..."),await new Promise(r=>{let s=e.onDidChange(()=>{o()&&(c(),r(!0))}),l=setTimeout(()=>{this.logService.debug("[Delegation] Timeout waiting for response to complete"),c(),r(!1)},3e4),c=()=>{clearTimeout(l),s.dispose()}})?(this.logService.debug("[Delegation] Response completed, archiving session before clearing"),await this.archiveLocalParentSession(t),await this.clear()):this.logService.debug("[Delegation] Not clearing (timeout or error)")}async archiveLocalParentSession(e){if(yn(e)!==kl&&!qo.getValue(this.contextKeyService))return;this.logService.debug(`[Delegation] archiveLocalParentSession: archiving session ${e.toString()}`),await this.chatService.getSession(e)?.editingSession?.accept();let t=this.agentSessionsService.getSession(e);t?(t.setArchived(!0),this.logService.debug("[Delegation] archiveLocalParentSession: session archived successfully")):this.logService.warn(`[Delegation] archiveLocalParentSession: session not found in agentSessionsService for ${e.toString()}`)}setVisible(e){let t=this._visible;this._visible=e,this.visibleChangeCount++,this.listWidget.setVisible(e),this.input.setVisible(e),e?t||(this.visibilityTimeoutDisposable.value=Zo(()=>{this._visible&&this.onDidChangeItems(!0)},0),this.visibilityAnimationFrameDisposable.value=kr(Me(this.listContainer),()=>{this._onDidShow.fire()})):t&&this._onDidHide.fire()}createList(e,t){let o=document.createElement("div");o.classList.add("chat-overflow-widget-container","monaco-editor"),e.append(o),this.listWidget=this._register(this.instantiationService.createInstance(gne,e,{rendererOptions:t,renderStyle:this.viewOptions.renderStyle,defaultElementHeight:this.viewOptions.defaultElementHeight??200,overflowWidgetsDomNode:o,styles:{listForeground:this.styles.listForeground,listBackground:this.styles.listBackground},currentChatMode:()=>this.input.currentModeKind,filter:this.viewOptions.filter?{filter:this.viewOptions.filter.bind(this.viewOptions)}:void 0,viewModel:this.viewModel,editorOptions:this.editorOptions,location:this.location,getCurrentLanguageModelId:()=>this.input.currentLanguageModel,getCurrentModeInfo:()=>this.input.currentModeInfo})),this._register(this.listWidget.onDidClickRequest(async n=>{this.clickedRequest(n)})),this._register(this.listWidget.onDidRerender(n=>{_r(n.currentElement)&&this.configurationService.getValue("chat.editRequests")!=="input"&&(n.rowContainer.contains(this.inputContainer)||n.rowContainer.appendChild(this.inputContainer),this.input.focus())})),this._register(this.listWidget.onDidDispose(()=>{this.focusedInputDOM.appendChild(this.inputContainer),this.input.focus()})),this._register(this.listWidget.onDidFocusOutside(()=>{this.finishedEditing()})),this._register(this.listWidget.onDidClickFollowup(n=>{this.acceptInput(n.message)})),this._register(this.listWidget.onDidChangeContentHeight(()=>{this._onDidChangeContentHeight.fire()})),this._register(this.listWidget.onDidFocus(()=>{this._onDidFocus.fire()})),this._register(this.listWidget.onDidScroll(()=>{this._onDidScroll.fire()}))}startEditing(e){let t=this.listWidget.getTemplateDataForRequestId(e);t&&this.clickedRequest(t)}clickedRequest(e){let t=e.currentElement;if(_r(t)&&!this.viewModel?.editing){let o=this.viewModel?.model.getRequests();if(!o||!this.viewModel?.sessionResource)return;this.viewModel?.model.checkpoint&&(this.recentlyRestoredCheckpoint=!0),this.viewModel?.model.setCheckpoint(t.id);let n=[],r=new Set,s=h=>{let g=h.range?`${h.id}:${h.range.start}-${h.range.endExclusive}`:h.id;r.has(g)||rDe(h)||(tR(h)||B0(h))&&h.automaticallyAdded||(r.add(g),n.push(h))};for(let h=o.length-1;h>=0;h-=1){let g=o[h];g.id===t.id&&(g.setShouldBeBlocked(!1),g.attachedContext?.forEach(s))}t.variables.forEach(s),this.viewModel?.setEditing(t),e?.contextKeyService&&Z.currentlyEditing.bindTo(e.contextKeyService).set(!0);let l=t.pendingKind===void 0?Z.EditingRequestType.Sent:t.pendingKind==="queued"?Z.EditingRequestType.Queue:Z.EditingRequestType.Steer,c=this.configurationService.getValue("chat.editRequests")==="input";if(this.inputPart?.setEditing(!!this.viewModel?.editing&&c,l),c)this.inputPart.element.classList.add("editing");else{let h=e.rowContainer;this.inputContainer=_(".chat-edit-input-container"),h.appendChild(this.inputContainer),this.createInput(this.inputContainer),this.input.setChatMode(this.inputPart.currentModeObs.get().id),this.input.setPermissionLevel(this.inputPart.currentModeInfo.permissionLevel??"default"),this.input.setEditing(!0,l),this._onDidChangeActiveInputEditor.fire()}this.inputPart.toggleChatInputOverlay(!c),n.length>0&&this.input.attachmentModel.addContext(...n),this.inputPart.dnd.setDisabledOverlay(!c),this.input.renderAttachedContext(),this.input.setValue(t.messageText,!1);let u=this.getContrib(ab.ID),p=this.input.inputEditor.getModel();if(u&&p){let h=p.getValueLength();for(let g of n)if(g.range){if(g.range.start>=g.range.endExclusive||g.range.start<0||g.range.endExclusive>h)continue;let f=p.getPositionAt(g.range.start),v=p.getPositionAt(g.range.endExclusive);u.addReference({id:g.id,range:new G(f.lineNumber,f.column,v.lineNumber,v.column),data:g.value,fullName:g.fullName,icon:g.icon,modelDescription:g.modelDescription,isFile:g.kind==="file",isDirectory:g.kind==="directory"})}}this.listWidget.suppressAutoScroll=!0,this.onDidChangeItems(),this.input.inputEditor.focus(),this._register(this.inputPart.onDidClickOverlay(()=>{this.viewModel?.editing&&this.configurationService.getValue("chat.editRequests")!=="input"&&this.finishedEditing()})),c||(this._register(this.inlineInputPart.inputEditor.onDidChangeModelContent(()=>{this.listWidget.scrollToCurrentItem(t)})),this._register(this.inlineInputPart.inputEditor.onDidChangeCursorSelection(h=>{this.listWidget.scrollToCurrentItem(t)})))}this.telemetryService.publicLog2("chat.startEditingRequests",{editRequestType:this.configurationService.getValue("chat.editRequests")})}finishedEditing(e){this.listWidget.suppressAutoScroll=!1;let t=this.listWidget.getTemplateDataForRequestId(this.viewModel?.editing?.id);this.recentlyRestoredCheckpoint?this.recentlyRestoredCheckpoint=!1:this.viewModel?.model.setCheckpoint(void 0),this.inputPart.dnd.setDisabledOverlay(!1),t?.contextKeyService&&Z.currentlyEditing.bindTo(t.contextKeyService).set(!1);let o=this.configurationService.getValue("chat.editRequests")==="input";if(!o){this.inputPart.setChatMode(this.input.currentModeObs.get().id),this.inputPart.setPermissionLevel(this.input.currentModeInfo.permissionLevel??"default");let n=this.input.selectedLanguageModel.get();n&&this.inputPart.switchModel(n.metadata),this.inputPart?.toggleChatInputOverlay(!1);try{t?.rowContainer?.contains(this.inputContainer)?t.rowContainer.removeChild(this.inputContainer):this.inputContainer.parentElement&&this.inputContainer.parentElement.removeChild(this.inputContainer)}catch(r){this.logService.error("Error occurred while finishing editing:",r)}this.inputContainer=_(".empty-chat-state"),this.input.dispose()}o&&this.inputPart.element.classList.remove("editing"),this.viewModel?.setEditing(void 0),this.inputPart?.setEditing(!1,void 0),o||this._onDidChangeActiveInputEditor.fire(),this.onDidChangeItems(),this.telemetryService.publicLog2("chat.editRequestsFinished",{editRequestType:this.configurationService.getValue("chat.editRequests"),editCanceled:!e}),this.inputPart.focus()}getWidgetViewKindTag(){return this.viewContext?tw(this.viewContext)?"view":"quick":"editor"}createInput(e,t){let o={renderFollowups:t?.renderFollowups??!0,renderStyle:t?.renderStyle==="minimal"?"compact":t?.renderStyle,renderInputToolbarBelowInput:t?.renderInputToolbarBelowInput??!1,menus:{executeToolbar:R.ChatExecute,telemetrySource:"chatWidget",...this.viewOptions.menus},editorOverflowWidgetsDomNode:this.viewOptions.editorOverflowWidgetsDomNode,enableImplicitContext:this.viewOptions.enableImplicitContext,renderWorkingSet:this.viewOptions.enableWorkingSet==="explicit",supportsChangingModes:this.viewOptions.supportsChangingModes,dndContainer:this.viewOptions.dndContainer,inputEditorMinLines:this.viewOptions.inputEditorMinLines,widgetViewKindTag:this.getWidgetViewKindTag(),defaultMode:this.viewOptions.defaultMode,sessionTypePickerDelegate:this.viewOptions.sessionTypePickerDelegate,workspacePickerDelegate:this.viewOptions.workspacePickerDelegate,isSessionsWindow:this.viewOptions.isSessionsWindow};if(this.viewModel?.editing){let l=this.listWidget.getTemplateDataForRequestId(this.viewModel?.editing?.id),c=this._register(this.instantiationService.createChild(new Po([X,l?.contextKeyService])));this.inlineInputPartDisposable.value=c.createInstance(C6,this.location,o,this.styles,!0)}else this.inputPartDisposable.value=this.instantiationService.createInstance(C6,this.location,o,this.styles,!1),this._register(ve(l=>{this.inputPart.height.read(l),this.listWidget&&(this.bodyDimension&&this._layoutListForInputHeight(),this._onDidChangeContentHeight.fire())}));this.input.render(e,"",this),this.bodyDimension?.width&&this.input.layout(this.bodyDimension.width),this._register(this.input.onDidLoadInputState(()=>{this.refreshParsedInput()})),this._register(this.input.onDidFocus(()=>this._onDidFocus.fire())),this._register(this.input.onDidAcceptFollowup(l=>{if(!this.viewModel)return;let c="";if(l.followup.agentId&&l.followup.agentId!==this.chatAgentService.getDefaultAgent(this.location,this.input.currentModeKind)?.id){let u=this.chatAgentService.getAgent(l.followup.agentId);if(!u)return;this.lastSelectedAgent=u,c=`${pd}${u.name} `,l.followup.subCommand&&(c+=`${cp}${l.followup.subCommand} `)}else!l.followup.agentId&&l.followup.subCommand&&this.chatSlashCommandService.hasCommand(l.followup.subCommand,yn(this.viewModel.model.sessionResource))&&(c=`${cp}${l.followup.subCommand} `);c+=l.followup.message,this.acceptInput(c),l.response&&this.chatService.notifyUserAction({sessionResource:this.viewModel.sessionResource,requestId:l.response.requestId,agentId:l.response.agent?.id,command:l.response.slashCommand?.name,result:l.response.result,action:{kind:"followUp",followup:l.followup}})})),this._register(this.inputEditor.onDidChangeModelContent(()=>{this.parsedChatRequest=void 0,this.updateChatInputContext()})),this._register(this.chatAgentService.onDidChangeAgents(()=>{this.parsedChatRequest=void 0,this.renderWelcomeViewContentIfNeeded()})),this._register(this.input.onDidChangeCurrentChatMode(()=>{this.renderWelcomeViewContentIfNeeded(),this.refreshParsedInput(),this.renderFollowups(),this.renderChatSuggestNextWidget()}));let n=new Set([Z.foregroundSessionCount.key]),r=new Set([Xn.hasByokModels.key]);this._register(this.contextKeyService.onDidChangeContext(l=>{l.affectsSome(n)&&this.isEmpty()&&this.renderGettingStartedTipIfNeeded(),l.affectsSome(r)&&this.updateChatViewVisibility()}));let s;this._register(ve(l=>{let c=this.inputPart.selectedLanguageModel.read(l)?.identifier;if(s===void 0){s=c;return}s!==c&&(s=c,this._gettingStartedTipPartRef&&this.chatTipService.getWelcomeTip(this.contextKeyService))})),this._register(ve(l=>{let c=new Set,u=new Set;for(let[h,g]of this.input.selectedToolsModel.entriesMap.read(l))g&&(_h(h)?c.add(h.id):u.add(h.id));let p=this.input.attachmentModel.attachments.filter(h=>h.kind==="tool"&&!u.has(h.id)||h.kind==="toolset"&&!c.has(h.id)).map(h=>h.id);this.input.attachmentModel.updateContext(p,yt.empty()),this.refreshParsedInput()}))}onDidStyleChange(){this.container.style.setProperty("--vscode-interactive-result-editor-background-color",this.editorOptions.configuration.resultEditor.backgroundColor?.toString()??""),this.container.style.setProperty("--vscode-interactive-session-foreground",this.editorOptions.configuration.foreground?.toString()??""),this.container.style.setProperty("--vscode-chat-list-background",this.themeService.getColorTheme().getColor(this.styles.listBackground)?.toString()??"")}setModel(e){if(!this.container||!this.inputPart){this.logService.warn("ChatWidget#setModel called before render() completed");return}if(!e){this.inputPart.flushInputStateToModel(),this.viewModel?.editing&&this.finishedEditing(),this.viewModel=void 0,this.updateWorkingProgressBorder(),this.onDidChangeItems(),this._hasPendingRequestsContextKey.set(!1);return}if(ze(e.sessionResource,this.viewModel?.sessionResource))return;this.viewModel?.editing&&this.finishedEditing(),this.inputPart?.clearTodoListWidget(e.sessionResource,!1),this.inputPart?.clearArtifactsWidget(),this.chatSuggestNextWidget.hide(),this.chatTipService.resetSession(),this._gettingStartedTipPartRef=void 0,this._gettingStartedTipPart.clear();let t=this.inputPart.gettingStartedTipContainerElement;if(St(t),Md(!1,t),this.inputPart.setInputModel(e.inputModel,e.getRequests().length===0,e.sessionResource),this.viewModel=this.instantiationService.createInstance(ste,e,void 0),this.listWidget.setViewModel(this.viewModel),this._lockedAgent){let c=this.chatSessionsService.getChatSessionContribution(this._lockedAgent.id)?.inputPlaceholder;c||(c=d(9075,null,this._lockedAgent.displayName||this._lockedAgent.name)),this.viewModel.setInputPlaceholder(c),this.inputEditor.updateOptions({placeholder:c})}else this.viewModel.inputPlaceholder&&this.inputEditor.updateOptions({placeholder:this.viewModel.inputPlaceholder});let n=this.configurationService.getValue("chat.experimental.renderMarkdownImmediately")?EL:0;this.viewModelDisposables.add(U.runAndSubscribe(U.accumulate(this.viewModel.onDidChange,n),(c=>{!this.viewModel||this._store.isDisposed||(this.requestInProgress.set(this.viewModel.model.requestInProgress.get()),this.hasActiveRequest.set(this.viewModel.model.hasActiveRequest.get()),this.updateWorkingProgressBorder(),c?.some(u=>u?.kind==="changePlaceholder")&&this.inputEditor.updateOptions({placeholder:this.viewModel.inputPlaceholder}),this.onDidChangeItems(),c?.some(u=>u?.kind==="addRequest")&&this.visible&&this.listWidget.scrollToEnd())}))),this.viewModelDisposables.add(this.viewModel.onDidDisposeModel(()=>{this.viewModel?.editing&&this.finishedEditing(),this.viewModel=void 0,this.updateWorkingProgressBorder(),this.onDidChangeItems()})),this._sessionIsEmptyContextKey.set(e.getRequests().length===0);let r=()=>{let c=this.chatSessionsService.sessionSupportsFork(e.sessionResource);this._chatSessionSupportsForkContextKey.set(c),this.listWidget?.updateRendererOptions({supportsFork:c})};r(),this.viewModelDisposables.add(this.chatSessionsService.onDidChangeAvailability(()=>r())),this._sessionHasDebugDataContextKey.set(this.chatDebugService.getEvents(e.sessionResource).length>0);let s=0,l=c=>{let u=e.getPendingRequests(),p=u.length;this._hasPendingRequestsContextKey.set(p>0);let h=u.filter(g=>g.kind==="steering").length;c&&h>0&&s===0&&Er(d(9080,null)),s=h};l(!1),this.viewModelDisposables.add(e.onDidChangePendingRequests(()=>l(!0))),this.refreshParsedInput(),this.viewModelDisposables.add(e.onDidChange(c=>{c.kind==="setAgent"&&(this._onDidChangeAgent.fire({agent:c.agent,slashCommand:c.command}),this._updateAgentCapabilitiesContextKeys(c.agent)),c.kind==="addRequest"&&(this.inputPart?.clearTodoListWidget(this.viewModel?.sessionResource,!1),this._sessionIsEmptyContextKey.set(!1),this.chatSuggestNextWidget.hide()),c.kind==="removeRequest"&&(this.inputPart?.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.chatSuggestNextWidget.hide(),this._sessionIsEmptyContextKey.set((this.viewModel?.model.getRequests().length??0)===0)),c.kind==="completedRequest"&&((this.viewModel?.model.getRequests().at(-1)?.response?.isCanceled??!1)&&this.inputPart?.clearTodoListWidget(this.viewModel?.sessionResource,!0),this.renderChatSuggestNextWidget(),this.visible&&this.viewModel?.sessionResource&&this.agentSessionsService.getSession(this.viewModel.sessionResource)?.setRead(!0))})),this.listWidget&&this.visible&&(this.onDidChangeItems(),this.listWidget.scrollToEnd()),this.renderChatSuggestNextWidget(),this.updateChatInputContext(),this.input.renderChatTodoListWidget(this.viewModel.sessionResource),this.input.renderArtifactsWidget(this.viewModel.sessionResource)}getFocus(){return this.listWidget.getFocus()[0]??void 0}reveal(e,t){this.listWidget.reveal(e,t)}focus(e){this.listWidget.hasElement(e)&&this.listWidget.focusItem(e)}setInputPlaceholder(e){this.viewModel?.setInputPlaceholder(e)}resetInputPlaceholder(){this.viewModel?.resetInputPlaceholder()}setInput(e=""){this.input.setValue(e,!1),this.refreshParsedInput()}getInput(){return this.input.inputEditor.getValue()}getContrib(e){return this.contribs.find(t=>t.id===e)}lockToCodingAgent(e,t,o){if(this._lockedAgent?.id===o&&this._lockedAgent.name===e&&this._lockedAgent.displayName===t)return;this._lockedAgent={id:o,name:e,prefix:`@${e} `,displayName:t},this._lockedToCodingAgentContextKey.set(!0),this._lockedCodingAgentIdContextKey.set(o),this.renderWelcomeViewContentIfNeeded();let n=this.chatAgentService.getAgent(o);this._updateAgentCapabilitiesContextKeys(n);let r=this._attachmentCapabilities.supportsCheckpoints??!1;this.listWidget?.updateRendererOptions({restorable:r,editable:r,noFooter:!1,progressMessageAtBottomOfResponse:!0}),this.visible&&this.listWidget?.rerender()}unlockFromCodingAgent(){this._lockedAgent&&(this._lockedAgent=void 0,this._lockedToCodingAgentContextKey.set(!1),this._lockedCodingAgentIdContextKey.set(""),this._chatSessionSupportsForkContextKey.set(!1),this._updateAgentCapabilitiesContextKeys(void 0),this.renderWelcomeViewContentIfNeeded(),this.viewModel&&this.viewModel.resetInputPlaceholder(),this.inputEditor?.updateOptions({placeholder:void 0}),this.listWidget?.updateRendererOptions({restorable:!0,editable:!0,progressMessageAtBottomOfResponse:e=>e!=="ask"}),this.visible&&this.listWidget?.rerender())}get isLockedToCodingAgent(){return!!this._lockedAgent}get lockedAgentId(){return this._lockedAgent?.id}logInputHistory(){this.input.logInputHistory()}async acceptInput(e,t){return this.viewModel&&V0(this.viewModel.sessionResource,W0.RequestStart),this._acceptInput(e?{query:e}:void 0,t)}async rerunLastRequest(){if(!this.viewModel)return;let e=this.viewModel.sessionResource,t=this.chatService.getSession(e)?.getRequests().at(-1);if(!t)return;let o={attempt:t.attempt+1,location:this.location,userSelectedModelId:this.input.currentLanguageModel,modeInfo:this.input.currentModeInfo},n=await this.chatService.resendRequest(t,o);return this.logThinkingStyleUsage("rerun"),n}getConfiguredThinkingStyle(){let e=this.configurationService.getValue("chat.agent.thinkingStyle");switch(e){case"collapsed":case"collapsedPreview":case"fixedScrolling":return e;default:return"fixedScrolling"}}logThinkingStyleUsage(e){this.telemetryService.publicLog2("chat.thinkingStyleUsage",{thinkingStyle:this.getConfiguredThinkingStyle(),location:this.location,requestKind:e})}async _applyPromptFileIfSet(e,t){let o=this.parsedInput.parts.find(p=>p instanceof iR);if(!o)return!0;this.chatTipService.recordSlashCommandUsage(o.name);let n=yn(t),r=await this.customizationHarnessService.resolvePromptSlashCommand(o.name,n,Ie.None);if(!r)return!0;let s=r.parsedPromptFile,l=s.body?.variableReferences.map(({name:p,offset:h,fullLength:g})=>({name:p,range:new gi(h,h+g)}))??[],c=this.toolsService.toToolReferences(l);e.attachedContext.insertFirst(H0(s.uri,"vscode.prompt.file",void 0,!0,c));let u={storage:r.storage};return r.extension?(u.extensionId=r.extension.identifier.value,u.promptName=r.name):u.promptNameHash=Lr(r.name).toString(16),this.telemetryService.publicLog2("chat.promptRun",u),!(s.header&&!await this._applyPromptMetadata(s.header,e))}async _acceptInput(e,t={}){if(!e&&this.input.generating){let x=Date.now();if(await this.input.generating,Date.now()-x>500)return}for(;!this._viewModel&&!this._store.isDisposed;)await U.toPromise(this.onDidChangeViewModel,this._store);if(!this.viewModel)return;if(this.viewOptions.submitHandler){let w=e?e.query:this.getInput();if(await this.viewOptions.submitHandler(w,this.input.currentModeKind))return}this._onDidAcceptInput.fire(),this.listWidget.setScrollLock(this.isLockedToCodingAgent||!!cte(this.input.currentModeKind,this.viewOptions.autoScroll));let o=this.getInput(),n={input:e?e.query:o,attachedContext:t?.enableImplicitContext===!1?this.input.getAttachedContext():this.input.getAttachedAndImplicitContext()},r=!e,s=this.viewModel?.editing;if(s){this.inputPart?.clearToolConfirmationCarousel();let w=this.viewModel.editing.pendingKind;if(w!==void 0){let E=this.viewModel.editing.id;this.chatService.removePendingRequest(this.viewModel.sessionResource,E),t.queue??=w}else await this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource,"acceptInput-editing"),t.queue=void 0;let x=this._lockedAgent&&!!this._attachmentCapabilities.supportsCheckpoints;x&&(this.recentlyRestoredCheckpoint=!0),this.finishedEditing(!0),x||this.viewModel.model?.setCheckpoint(void 0)}let l=this.viewModel.model,c=l.requestInProgress.get();if(l.requestNeedsInput.get()&&!l.getPendingRequests().length&&(await this.chatService.cancelCurrentRequestForSession(this.viewModel.sessionResource,"acceptInput-needsInput"),t.queue??="queued"),c&&(t.queue??="queued"),!c&&!s&&!await this.confirmPendingRequestsBeforeSend(l,t)||!await this._applyPromptFileIfSet(n,this.viewModel.sessionResource))return;if(this.viewOptions.enableWorkingSet!==void 0&&this.input.currentModeKind==="edit"){let w=new xn,x=n.attachedContext,E=this.viewModel.model.getRequests();for(let M of E)for(let N of M.variableData.variables)if(A.isUri(N.value)&&N.kind==="file"){let V=N.value;w.has(V)||(x.add(N),w.add(N.value))}n.attachedContext=x,this.telemetryService.publicLog2("chatEditing/workingSetSize",{originalSize:w.size,actualSize:w.size})}if(this.input.validateAgentMode(),this.viewModel.model.checkpoint){let w=this.viewModel.model.getRequests();for(let x=w.length-1;x>=0;x-=1){let E=w[x];(E.shouldBeBlocked.get()||E===this.viewModel.model.checkpoint)&&this.chatService.removeRequest(this.viewModel.sessionResource,E.id)}this.viewModel.model.setCheckpoint(void 0)}let p=this.input.currentModeKind==="agent"?this.input.selectedToolsModel.userSelectedTools.get():void 0,h=this.input.currentModeKind==="agent"?this.input.currentModeObs.get().agents?.get():void 0,g=await this._resolveDirectoryImageAttachments(n.attachedContext.asArray()),f=this.viewModel.sessionResource,v=this._lockedAgent?this.chatSessionsService.getChatSessionContribution(this._lockedAgent.id):void 0,b=v?v.autoAttachReferences===!0:!0,S=await this.chatService.sendRequest(this.viewModel.sessionResource,n.input,{userSelectedModelId:this.input.currentLanguageModel,location:this.location,locationData:this._location.resolveData?.(),parserContext:{selectedAgent:this._lastSelectedAgent,mode:this.input.currentModeKind,attachmentCapabilities:this._lastSelectedAgent?.capabilities??this.attachmentCapabilities},attachedContext:n.attachedContext.asArray(),resolvedVariables:g,noCommandDetection:t?.noCommandDetection,...this.getModeRequestOptions(),modeInfo:this.input.currentModeInfo,agentIdSilent:this._lockedAgent?.id,queue:t?.queue,instructionContext:b?{modeKind:this.input.currentModeKind,enabledTools:p,enabledSubAgents:h}:void 0});if(R3.isRejected(S))return;this.logThinkingStyleUsage("submit"),this.updateChatViewVisibility(),this.input.acceptInput(t?.storeToHistory??r);let y=R3.isQueued(S)?await S.deferred:S;if(R3.isSent(y)){if(this._onDidSubmitAgent.fire({agent:y.data.agent,slashCommand:y.data.slashCommand}),this.handleDelegationExitIfNeeded(this._lockedAgent,y.data.agent),y.newSessionResource){let w=this.chatService.getSession(y.newSessionResource);w&&this.setModel(w)}return y.data.responseCreatedPromise.then(()=>{this.chatAccessibilityService.acceptRequest(f),y.data.responseCompletePromise.then(()=>{let w=this.viewModel?.getItems().filter(Ni),x=w?.[w.length-1];if(this.chatAccessibilityService.acceptResponse(this,this.container,x,f,t?.isVoiceInput),x?.result?.nextQuestion){let{prompt:E,participant:M,command:N}=x.result.nextQuestion,V=RPt(this.chatAgentService,this.location,E,M,N);V&&this.input.setValue(V,!1)}})}),y.data.responseCreatedPromise}}async _resolveDirectoryImageAttachments(e){let t=[];for(let n of e)n.kind==="directory"&&A.isUri(n.value)&&t.push(this.chatAttachmentResolveService.resolveDirectoryImages(n.value));return t.length===0?[]:(await Promise.all(t)).flat()}async confirmPendingRequestsBeforeSend(e,t){if(t.queue||!(e.getPendingRequests().length>0))return!0;let n=await this.dialogService.prompt({type:"question",message:d(9078,null),detail:d(9076,null),buttons:[{label:d(9077,null),run:()=>"keep"},{label:d(9079,null),run:()=>"remove"}],cancelButton:!0});if(!n.result)return!1;if(n.result==="remove")for(let r of[...e.getPendingRequests()])this.chatService.removePendingRequest(e.sessionResource,r.request.id);return!0}getModeRequestOptions(){if(!this.inputPartDisposable.value)return{};let e=this.viewModel?.sessionResource,t=this.input.currentModeObs.get().id,o=this.input.selectedToolsModel.userSelectedTools,n=o.get(),r=ke(s=>{if(this._store.isDisposed)return n;let l=this._viewModelObs.read(s)?.sessionResource,c=this.input.currentModeObs.read(s).id;if(ze(l,e)&&c===t){let u=o.read(s);return n=u,u}return n});return{modeInfo:this.input.currentModeInfo,userSelectedTools:r}}getCodeBlockInfosForResponse(e){return this.listWidget.getCodeBlockInfosForResponse(e)}getCodeBlockInfoForEditor(e){return this.listWidget.getCodeBlockInfoForEditor(e)}getFileTreeInfosForResponse(e){return this.listWidget.getFileTreeInfosForResponse(e)}getLastFocusedFileTreeForResponse(e){return this.listWidget.getLastFocusedFileTreeForResponse(e)}focusResponseItem(e){this.listWidget.focusLastItem(e)}setInputPartMaxHeightOverride(e){this.inputPartMaxHeightOverride=e}layout(e,t){t=Math.min(t,this.viewOptions.renderStyle==="minimal"?t:950),this.bodyDimension=new di(t,e),this.viewModel?.editing&&this.inlineInputPart?.layout(t);let o=this.chatSuggestNextWidget.height,n=this._dynamicMessageLayoutData||this.location!=="panel"?void 0:this.inputPartMaxHeightOverride!==void 0?Math.max(0,this.inputPartMaxHeightOverride-o-BEo):Math.max(0,e-o-BEo);this.inputPart.setMaxHeight(n),this.inputPart.layout(t),this._layoutListForInputHeight()}_layoutListForInputHeight(){if(!this.bodyDimension)return;let{height:e,width:t}=this.bodyDimension,o=this.chatSuggestNextWidget.height,n=this.inputPart.height.get(),r=this.listWidget.isScrolledToBottom,s=this.listWidget.lastItem,l=Math.max(0,e-n-o);this.listWidget.layout(l,t),this.welcomeMessageContainer.style.height=`${l}px`;let c=Ni(s)&&s.renderData;r&&(!c||cte(this.input.currentModeKind,this.viewOptions.autoScroll))&&this.listWidget.scrollToEnd(),this.listContainer.style.height=`${l}px`,this._onDidChangeHeight.fire(e)}setDynamicChatTreeItemLayout(e,t){this._dynamicMessageLayoutData={numOfMessages:e,maxHeight:t,enabled:!0},this._register(this.listWidget.onDidChangeItemHeight(()=>this.layoutDynamicChatTreeItemMode()));let o=this._register(new ue);this._register(this.listWidget.onDidScroll(n=>{this._dynamicMessageLayoutData?.enabled&&(o.value=kr(Me(this.listContainer),()=>{if(!n.scrollTopChanged||n.heightChanged||n.scrollHeightChanged)return;let r=n.height,s=n.scrollHeight-r-n.scrollTop;if(s===0)return;let l=this._dynamicMessageLayoutData?.maxHeight??t,c=this.bodyDimension?.width??this.container.offsetWidth;this.input.layout(c);let u=this.input.height.get(),p=this.chatSuggestNextWidget.height,h=Math.min(r+s,l-u-p);this.layout(h+u+p,c)}))}))}updateDynamicChatTreeItemLayout(e,t){this._dynamicMessageLayoutData={numOfMessages:e,maxHeight:t,enabled:!0};let o=!1,n=this.bodyDimension.height,r=this.bodyDimension.width;t<this.bodyDimension.height&&(n=t,o=!0);let s=this.container.offsetWidth;this.bodyDimension?.width!==s&&(r=s,o=!0),o&&this.layout(n,r)}get isDynamicChatTreeItemLayoutEnabled(){return this._dynamicMessageLayoutData?.enabled??!1}set isDynamicChatTreeItemLayoutEnabled(e){this._dynamicMessageLayoutData&&(this._dynamicMessageLayoutData.enabled=e)}layoutDynamicChatTreeItemMode(){if(!this.viewModel||!this._dynamicMessageLayoutData?.enabled)return;let e=this.bodyDimension?.width??this.container.offsetWidth;this.input.layout(e);let t=this.input.height.get(),o=this.chatSuggestNextWidget.height,n=this.viewModel.getItems(),r=n.slice(-this._dynamicMessageLayoutData.numOfMessages),s=r.some(c=>c.currentRenderedHeight===void 0),l=s?this._dynamicMessageLayoutData.maxHeight:r.reduce((c,u)=>c+u.currentRenderedHeight,0);this.layout(Math.min(t+o+l+(n.length>2?18:0),this._dynamicMessageLayoutData.maxHeight),e),(s||!l)&&this.listWidget.scrollToEnd()}saveState(){}getViewState(){return this.input.getCurrentInputState()}updateChatInputContext(){let e=this.parsedInput.parts.find(t=>t instanceof Qp);this.agentInInput.set(!!e)}async _switchToAgentByName(e){let t=this.input.currentModeObs.get();if(e===t.name.get())return!0;let o=this.input.currentChatModesObs.get().findModeByName(e);if(!o)return!1;if(t.kind!==o.kind){let n=await this.instantiationService.invokeFunction(Met,t.kind,o.kind,this.viewModel?.model.getRequests().length??0,this.viewModel?.model);if(!n)return!1;n.needToClearSession&&await this.clear()}return this.input.setChatMode(o.id),!0}async _applyPromptMetadata({agent:e,tools:t,model:o},n){if(t!==void 0&&!e&&this.input.currentModeKind!=="agent"&&(e=Bc.Agent.name.get()),e&&!await this._switchToAgentByName(e))return!1;if(t!==void 0&&this.input.currentModeKind==="agent"){let r=this.toolsService.toToolAndToolSetEnablementMap(t,this.input.selectedLanguageModel.get()?.metadata);this.input.selectedToolsModel.set(r,!0)}return o!==void 0&&this.input.switchModelByQualifiedName(o),!0}delegateScrollFromMouseWheelEvent(e){this.listWidget.delegateScrollFromMouseWheelEvent(e)}};my=I([m(4,Qt),m(5,B),m(6,ct),m(7,X),m(8,F),m(9,si),m(10,gr),m(11,Lt),m(12,F0),m(13,re),m(14,Pe),m(15,rN),m(16,mu),m(17,_e),m(18,jr),m(19,dh),m(20,Wn),m(21,X2t),m(22,dr),m(23,Ms),m(24,Vc),m(25,vW),m(26,to),m(27,nV),m(28,IV),m(29,ph),m(30,Ai)],my);var BEo=50;var Tve=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this._instantiationService=t;this._textModelResolverService=c;this._elements=st("div.inline-chat@root",[st("div.chat-widget@chatWidget"),st("div.accessibleViewer@accessibleViewer"),st("div.status@status",[st("div.label.info.hidden@infoLabel"),st("div.actions.hidden@toolbar1"),st("div.label.status.hidden@statusLabel"),st("div.actions.secondary.hidden@toolbar2"),st("div.label.disclaimer.hidden@disclaimerLabel")])]);this._store=new O;this._onDidChangeHeight=this._store.add(new T);this.onDidChangeHeight=U.filter(this._onDidChangeHeight.event,i=>!this.$A);this.$z=De(this,!1);this.requestInProgress=this.$z;this.$A=!1;this.$B=e,this.$C=n,this.$D=r,this.$E=s,this.$F=l,this.$G=u,this.$H=h,this.$I=g,this.scopedContextKeyService=this._store.add(o.createScoped(this._elements.chatWidget));let f=t.createChild(new Po([X,this.scopedContextKeyService]),this._store);this.chatWidget=f.createInstance(my,i,{isInlineChat:!0},{autoScroll:!0,defaultElementHeight:32,renderStyle:"minimal",renderInputOnTop:!1,renderFollowups:!0,supportsFileReferences:!0,filter:N=>!Ni(N)||N.errorDetails?!0:!(N.response.value.length===0||N.response.value.every(H=>H.kind==="textEditGroup"&&e.chatWidgetViewOptions?.rendererOptions?.renderTextEditsAsSummary?.(H.uri))),dndContainer:this._elements.root,defaultMode:Bc.Ask,...e.chatWidgetViewOptions},{listForeground:dwo,listBackground:CMi,overlayBackground:ZT,inputEditorBackground:Hf,resultEditorBackground:Bo}),this._elements.root.classList.toggle("in-zone-widget",!!e.inZoneWidget),this.chatWidget.render(this._elements.chatWidget),this._elements.chatWidget.style.setProperty(kF(xxo),Tt(CMi)),this.chatWidget.setVisible(!0),this._store.add(this.chatWidget);let v=Z.isResponse.bindTo(this.scopedContextKeyService),b=Z.responseVote.bindTo(this.scopedContextKeyService),S=Z.responseSupportsIssueReporting.bindTo(this.scopedContextKeyService),y=Z.responseHasError.bindTo(this.scopedContextKeyService),w=Z.responseIsFiltered.bindTo(this.scopedContextKeyService),x=this._store.add(new O);this._store.add(this.chatWidget.onDidChangeViewModel(()=>{x.clear();let N=this.chatWidget.viewModel;N&&(x.add(ee(()=>{M.context=void 0,v.reset(),b.reset(),y.reset(),w.reset(),S.reset()})),x.add(N.onDidChange(()=>{this.$z.set(N.model.requestInProgress.get(),void 0);let V=N.getItems().at(-1);M.context=V,v.set(Ni(V)),b.set(Ni(V)?V.vote===0?"down":V.vote===1?"up":"":""),y.set(Ni(V)&&V.errorDetails!==void 0),w.set(!!(Ni(V)&&V.errorDetails?.responseIsFiltered)),S.set(Ni(V)&&(V.agent?.metadata.supportIssueReporting??!1)),this._onDidChangeHeight.fire()})),this._onDidChangeHeight.fire())})),this._store.add(this.chatWidget.onDidChangeContentHeight(()=>{this._onDidChangeHeight.fire()})),this.$y=z2t.bindTo(o);let E=this._store.add(nr(this.domNode));if(this._store.add(E.onDidBlur(()=>this.$y.set(!1))),this._store.add(E.onDidFocus(()=>this.$y.set(!0))),this.$x=Nq.bindTo(o),this._store.add(this.chatWidget.inputEditor.onDidFocusEditorWidget(()=>this.$x.set(!0))),this._store.add(this.chatWidget.inputEditor.onDidBlurEditorWidget(()=>this.$x.set(!1))),e.statusMenuId){let N=e.statusMenuId.options,V=f.createInstance(Oq,this._elements.toolbar1,e.statusMenuId.menu,{toolbarOptions:{primaryGroup:"0_main"},telemetrySource:e.chatWidgetViewOptions?.menus?.telemetrySource,menuOptions:{renderShortTitle:!0},...N});this._store.add(V.onDidChange(()=>this._onDidChangeHeight.fire())),this._store.add(V)}let M=f.createInstance(pr,this._elements.toolbar2,e.secondaryMenuId??R.for(""),{telemetrySource:e.chatWidgetViewOptions?.menus?.telemetrySource,menuOptions:{renderShortTitle:!0,shouldForwardArgs:!0},actionViewItemProvider:(N,V)=>ta(f,N,V)});this._store.add(M.onDidChangeMenuItems(()=>this._onDidChangeHeight.fire())),this._store.add(M),this._store.add(this.$E.onDidChangeConfiguration(N=>{N.affectsConfiguration("accessibility.verbosity.inlineChat")&&this.$J()})),this._elements.root.tabIndex=0,this._elements.statusLabel.tabIndex=0,this.$J(),this.$K(),this._store.add(p.setupManagedHover(yi("element"),this._elements.statusLabel,()=>this._elements.statusLabel.dataset.title)),this._store.add(this.$G.onDidPerformUserAction(N=>{ze(N.sessionResource,this.chatWidget.viewModel?.model.sessionResource)&&N.action.kind==="vote"&&this.updateStatus(d(12434,null),{resetAfter:1250})}))}$x;$y;$z;$A;$B;$C;$D;$E;$F;$G;$H;$I;$J(){if(this._elements.root.ariaLabel=this.$F.getOpenAriaHint("accessibility.verbosity.inlineChat"),this.$D.isScreenReaderOptimized()){let i=Vpn;if(this.$E.getValue("accessibility.verbosity.inlineChat")){let e=this.$C.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();i=e?d(12435,null,e):d(12436,null)}this.chatWidget.inputEditor.updateOptions({ariaLabel:i})}}$K(){let i=this._store.add(new O);this._store.add(ve(e=>{i.clear(),Ii(this._elements.disclaimerLabel);let t=this.$H.sentimentObs.read(e),o=this.$H.anonymousObs.read(e),n=this.$G.requestInProgressObs.read(e),r=!t.completed&&o&&!n;if(this._elements.disclaimerLabel.classList.toggle("hidden",!r),r){let s=i.add(this.$I.render(new he(d(12437,null,$i.defaultChatAgent?.provider?.default?.name??"",$i.defaultChatAgent?.provider?.default?.name??"",$i.defaultChatAgent?.termsStatementUrl??"",$i.defaultChatAgent?.privacyStatementUrl??""),{isTrusted:!0})));this._elements.disclaimerLabel.appendChild(s.element)}this._onDidChangeHeight.fire()}))}dispose(){this._store.dispose()}get domNode(){return this._elements.root}layout(i){let e=this.contentHeight;this.$A=!0;try{this._doLayout(i)}finally{this.$A=!1,this.contentHeight!==e&&this._onDidChangeHeight.fire()}}_doLayout(i){let e=this._getExtraHeight(),t=Uh(this._elements.status);this._elements.root.style.height=`${i.height-e}px`,this._elements.root.style.width=`${i.width}px`,this.chatWidget.layout(i.height-t-e,i.width)}get contentHeight(){let i={chatWidgetContentHeight:this.chatWidget.contentHeight,statusHeight:Uh(this._elements.status),extraHeight:this._getExtraHeight()};return i.chatWidgetContentHeight+i.statusHeight+i.extraHeight}get minHeight(){let i=100;for(let t of this.chatWidget.viewModel?.getItems()??[])if(Ni(t)&&t.response.value.some(o=>o.kind==="textEditGroup"&&!o.state?.applied)){i=270;break}let e=this.contentHeight;return e-=this.chatWidget.contentHeight,e+=Math.min(this.chatWidget.input.height.get()+i,this.chatWidget.contentHeight),e}_getExtraHeight(){return this.$B.inZoneWidget?1:6}updateInfo(i){this._elements.infoLabel.classList.toggle("hidden",!i);let e=ir(i);Ii(this._elements.infoLabel,...e),this._onDidChangeHeight.fire()}updateStatus(i,e={}){let t=typeof e.resetAfter=="number";if(t&&!this._elements.statusLabel.dataset.state){let n=this._elements.statusLabel.innerText,r=this._elements.statusLabel.dataset.title,s=Array.from(this._elements.statusLabel.classList.values());setTimeout(()=>{this.updateStatus(n,{classes:s,keepMessage:!0,title:r})},e.resetAfter)}let o=ir(i);Ii(this._elements.statusLabel,...o),this._elements.statusLabel.className=`label status ${(e.classes??[]).join(" ")}`,this._elements.statusLabel.classList.toggle("hidden",!i),t?this._elements.statusLabel.dataset.state="temp":delete this._elements.statusLabel.dataset.state,e.title?this._elements.statusLabel.dataset.title=e.title:delete this._elements.statusLabel.dataset.title,this._onDidChangeHeight.fire()}reset(){this.chatWidget.attachmentModel.clear(!0),this.chatWidget.saveState(),Ii(this._elements.statusLabel),this._elements.statusLabel.classList.toggle("hidden",!0),this._elements.toolbar1.classList.add("hidden"),this._elements.toolbar2.classList.add("hidden"),this.updateInfo(""),this._elements.accessibleViewer.classList.toggle("hidden",!0),this._onDidChangeHeight.fire()}focus(){this.chatWidget.focusInput()}hasFocus(){return this.domNode.contains(Un())}};Tve=I([m(2,F),m(3,X),m(4,Le),m(5,Ai),m(6,B),m(7,Kd),m(8,Bt),m(9,si),m(10,ot),m(11,dr),m(12,_n)],Tve);var Vpn=d(12433,null),UWe=class extends Tve{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){let b=g.getContainer(Me(e.getContainerDomNode())).appendChild(_(".inline-chat-overflow.monaco-editor"));super(i,{...t,chatWidgetViewOptions:{...t.chatWidgetViewOptions,editorOverflowWidgetsDomNode:b}},r,o,n,s,l,c,u,p,h,f,v),this._store.add(ee(()=>{b.remove()}))}_doLayout(i){let e=i.height;super._doLayout(i.with(void 0,e)),this._elements.root.style.height=`${i.height-this._getExtraHeight()}px`}reset(){this.chatWidget.setInput(),super.reset()}};UWe=I([m(3,X),m(4,Le),m(5,F),m(6,Ai),m(7,B),m(8,Kd),m(9,Bt),m(10,si),m(11,ot),m(12,Kl),m(13,dr),m(14,_n)],UWe);var Gst=class a extends z{static{this.Id="inlineChatWidget.statusPlaceholder"}static{this.CtxHasStatus=new Y("inlineChatHasStatus",!1)}constructor(){super({id:a.Id,title:"",precondition:C.false(),menu:{id:R.ChatInput,when:C.and(C.equals(Z.location.key,"editor"),a.CtxHasStatus),group:"navigation",order:Number.MAX_SAFE_INTEGER}})}run(){}};W(Gst);var zC=class extends o0{constructor(e,t,o,n,r,s,l,c){super(o.editor,zC.$L);this.status=De(this,"");this.$Z=new O;this.notebookEditor=o.notebookEditor,this.$T=l,this.$U=_("div.inline-chat-terminated-card.hidden"),this.$V=_("div.markdown-scroll-container"),this.$W=_("div.markdown-message"),this.$V.appendChild(this.$W),this.$X=this._disposables.add(new Ar(this.$V,{consumeMouseWheelIfScrollbarIsNeeded:!0,horizontal:2,vertical:1})),this.$U.appendChild(this.$X.getDomNode());let u=_("div.content-row");this.$Y=_("div.toolbar"),u.appendChild(this.$Y),this.$U.appendChild(u),this._disposables.add(this.$Z),this.$Q=yrt.bindTo(c),this.$R=Gst.CtxHasStatus.bindTo(c),this._disposables.add(ee(()=>{this.$Q.reset(),this.$R.reset()})),this._disposables.add(ve(g=>{this.$R.set(!!this.status.read(g))})),zC.$M.add(this),this._disposables.add(ee(()=>{zC.$M.delete(this),zC.$M.size===0&&(zC.$O?.dispose(),zC.$O=void 0)})),this._disposables.add(ve(g=>{this.status.read(g),zC.$N.fire()})),zC.$O||(zC.$O=s.register(R.ChatInput,Gst.Id,(g,f)=>new class extends ts{render(b){super.render(b),b.classList.add("status-placeholder");let S=Me(b),y=S.requestAnimationFrame(()=>{y=0;let w=zC.$P(b);w&&this._store.add(ve(x=>{let E=w.status.read(x)??"";this.action.label=E,this.updateLabel()}))});this._store.add(ee(()=>{y&&S.cancelAnimationFrame(y)}))}}(void 0,g,{...f,icon:!1,label:!0}),zC.$N.event)),this.widget=r.createInstance(UWe,e,this.editor,{secondaryMenuId:JU,inZoneWidget:!0,chatWidgetViewOptions:{menus:{telemetrySource:"interactiveEditorWidget-toolbar",inputSideToolbar:cwo},clear:n,...t,rendererOptions:{renderTextEditsAsSummary:g=>ze(g,o.editor.getModel()?.uri),renderDetectedCommandsWithRequest:!0,...t?.rendererOptions},defaultMode:Bc.Ask}}),this._disposables.add(this.widget);let p;this._disposables.add(this.widget.chatWidget.onWillMaybeChangeHeight(()=>{this.position&&(p=this.$ac(this.position))})),this._disposables.add(this.widget.onDidChangeHeight(()=>{if(this.position&&!this._usesResizeHeight){p??=this.$ac(this.position);let g=this.$aa();this._relayout(g.linesValue),p?.(),p=void 0}})),this.create(),this._disposables.add(ve(g=>{let f=this.widget.requestInProgress.read(g);this.domNode.firstElementChild?.classList.toggle("busy",f)})),this._disposables.add($(this.domNode,"click",g=>{!this.editor.hasWidgetFocus()&&!this.widget.hasFocus()&&this.editor.focus()},!0));let h=()=>{!this.position||!this.editor.hasModel()?this.$Q.reset():this.position.lineNumber===this.editor.getPosition().lineNumber?this.$Q.set("above"):this.position.lineNumber+1===this.editor.getPosition().lineNumber?this.$Q.set("below"):this.$Q.reset()};this._disposables.add(this.editor.onDidChangeCursorPosition(g=>h())),this._disposables.add(this.editor.onDidFocusEditorText(g=>h())),h()}static $L={showFrame:!0,frameWidth:1,isResizeable:!0,showArrow:!1,isAccessible:!0,className:"inline-chat-widget",keepEditorSelection:!0,showInHiddenAreas:!0,ordinal:5e4};static $M=new Set;static $N=new T;static $O;static $P(e){let t=e.closest(".inline-chat-widget");if(t){for(let o of zC.$M)if(o.domNode===t)return o}}$Q;$R;$S;$T;$U;$V;$W;$X;$Y;$Z;_fillContainer(e){e.style.setProperty("--vscode-inlineChat-background","var(--vscode-editor-background)"),e.appendChild(this.widget.domNode),e.appendChild(this.$U)}showTerminationCard(e,t){this.$Z.clear();let o=typeof e=="string"?new he(e,{supportThemeIcons:!0}):e,n=ma(typeof e=="string"?new he(e):e);this.$W.replaceChildren();let r=this.$Z.add(Lg(o));this.$W.appendChild(r.element),this.$X.getDomNode().classList.remove("hidden"),this.$X.scanDomNode();let s=this.editor,l=this.$Z.add(new class extends cs{async runAction(c,u){return s.focus(),super.runAction(c,u)}});if(this.$Y.replaceChildren(),this.$Z.add(t.createInstance(pr,this.$Y,R.ChatEditorInlineExecute,{telemetrySource:"inlineChatZone.terminationToolbar",hiddenItemStrategy:0,actionRunner:l,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0}})),this.widget.domNode.style.display="none",this.$U.classList.remove("hidden"),Er(n),this.position){let c=this.$ac(this.position),u=this.$aa();this._relayout(u.linesValue),c()}}hideTerminationCard(){if(this.$Z.clear(),this.$U.classList.add("hidden"),this.widget.domNode.style.display="",this.position){let e=this.$ac(this.position),t=this.$aa();this._relayout(t.linesValue),e()}}get isShowingTerminationCard(){return!this.$U.classList.contains("hidden")}_doLayout(e){this.$ab();let t=this.editor.getLayoutInfo(),o=t.contentWidth-t.verticalScrollbarWidth;if(this.$S=new di(o,e),this.widget.layout(this.$S),this.isShowingTerminationCard){let n=Math.max(50,e-40);this.$X.getDomNode().style.maxHeight=`${n}px`,this.$V.style.maxHeight=`${n}px`,this.$X.scanDomNode()}}$aa(){let e=this.notebookEditor?.getLayoutInfo().height??this.editor.getLayoutInfo().height,t;this.isShowingTerminationCard?t=this.$U.offsetHeight||80:t=this.widget.contentHeight;let o=this._decoratingElementsHeight()+Math.min(t,Math.max(this.widget.minHeight,e*.42));return{linesValue:o/this.editor.getOption(75),pixelsValue:o}}_getResizeBounds(){let e=this.editor.getOption(75),t=this._decoratingElementsHeight(),o=t+this.widget.minHeight,n=t+this.widget.contentHeight;return{minLines:o/e,maxLines:n/e}}_onWidth(e){this.$S&&this._doLayout(this.$S.height)}show(e){To(this.container),this.$ab();let t=this.$ac(e);super.show(e,this.$aa().linesValue),this.widget.chatWidget.setVisible(!0),this.widget.focus(),t()}$ab(){To(this.container);let e=this.editor.getLayoutInfo(),t=e.glyphMarginWidth+e.lineNumbersWidth+e.decorationsWidth;this.container.style.paddingLeft=`${t}px`}reveal(e){let t=this.editor.getOption(131),o=t.enabled?t.maxLineCount:0;this.editor.revealLines(e.lineNumber+o,e.lineNumber+o,1),this.updatePositionAndHeight(e)}updatePositionAndHeight(e){let t=this.$ac(e);super.updatePositionAndHeight(e,this._usesResizeHeight?void 0:this.$aa().linesValue),t()}$ac(e){let t=V8e.capture(this.editor),o=e.lineNumber<=1?1:1+e.lineNumber;return()=>{t.restore(this.editor);let n=this.editor.getScrollTop(),r=this.editor.getTopForLineNumber(o),s=r-this.$aa().pixelsValue,l=this.editor.getLayoutInfo().height,c=this.editor.getBottomForLineNumber(o),u=s,p=!1;c>=n+l&&(u=c-l,p=!0),(u<n||p)&&(this.$T.trace("[IE] REVEAL zone",{zoneTop:s,lineTop:r,lineBottom:c,scrollTop:n,newScrollTop:u,forceScrollTop:p}),this.editor.setScrollTop(u,1))}}revealRange(e,t){}hide(){let e=V8e.capture(this.editor);this.$Q.reset(),this.$Z.clear(),this.$U.classList.add("hidden"),this.widget.domNode.style.display="",this.widget.chatWidget.setVisible(!1),super.hide(),Er(d(12438,null)),e.restore(this.editor)}};zC=I([m(4,F),m(5,sh),m(6,re),m(7,X)],zC);var qst=class{static isInlineChatRunOptions(i){if(typeof i!="object"||i===null)return!1;let{initialSelection:e,initialRange:t,message:o,autoSend:n,position:r,attachments:s,modelSelector:l,resolveOnResponse:c,attachDiagnostics:u}=i;return!(typeof o<"u"&&typeof o!="string"||typeof n<"u"&&typeof n!="boolean"||typeof t<"u"&&!G.isIRange(t)||typeof e<"u"&&!ei.isISelection(e)||typeof r<"u"&&!ye.isIPosition(r)||typeof s<"u"&&(!Array.isArray(s)||!s.every(p=>p instanceof A))||typeof l<"u"&&!dao(l)||typeof c<"u"&&typeof c!="boolean"||typeof u<"u"&&typeof u!="boolean")}};function Bpn(a,i){return`${a.getId()},${i.id}`}var fu=class{static{this.ID=tFe}static get(i){return i.getContribution(fu.ID)??void 0}static $ad;$ae=new O;$af=De(this,!1);$ag;$ah;$ai;$aj;$ak;$al;$am;$an;$ao;$ap;$aq;$ar;$as;get widget(){return this.$ag.value.widget}get isActive(){return!!this.$ah.get()}constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this.$ai=i,this.$aj=e,this.$ak=t,this.$al=o,this.$am=s,this.$an=l,this.$ao=c,this.$ap=u,this.$aq=p,this.$ar=h,this.$as=g;let f=Ds(i),v=XU.bindTo(r),b=kP.bindTo(r),S=Ife.bindTo(r),y=hr("inlineChat.notebookAgent",!1,this.$am);this.$ae.add(ve(H=>{let K=f.model.read(H);if(!K){b.set(!1);return}let j=this.$ar.editingSessionsObs.read(H),J=!1;for(let se of j){let ae=se.entries.read(H);for(let ce of ae)if(ze(ce.modifiedURI,K.uri)){J=!0;break}if(J)break}b.set(J)})),this.inputOverlayWidget=this.$ae.add(this.$aj.createInstance(nFe,this.$ai)),this.$ag=new uo(()=>{To(this.$ai.hasModel(),"[Illegal State] widget should only be created when the editor has a model");let H={location:"editor",resolveData:()=>{To(this.$ai.hasModel());let J=this.$ai.getSelection(),se=this.$ai.getModel().uri;return{type:"editor",id:Bpn(this.$ai,this.$ai.getModel()),selection:this.$ai.getSelection(),document:se,wholeRange:J}}},K=this.$ak.getNotebookForPossibleCell(this.$ai);K&&(H.location="notebook",y.get()&&(H.resolveData=()=>(To(this.$ai.hasModel()),{type:"notebook",sessionInputUri:this.$ai.getModel().uri})));let j=this.$aj.createInstance(zC,H,{enableWorkingSet:"implicit",enableImplicitContext:!1,renderInputOnTop:!1,renderInputToolbarBelowInput:!0,filter:J=>Ni(J)?!!J.model.isPendingConfirmation.get():!1,menus:{telemetrySource:"inlineChatWidget",executeToolbar:R.ChatEditorInlineExecute,inputSideToolbar:R.ChatEditorInlineInputSide},defaultMode:Bc.Ask},{editor:this.$ai,notebookEditor:K},()=>Promise.resolve());return this.$ae.add(j),j.domNode.classList.add("inline-chat-2"),j});let w=qr(this,o.onDidChangeSessions);this.$ah=ke(H=>{w.read(H);let K=f.model.read(H);return(K&&o.getSessionByTextModel(K.uri))??void 0});let x;this.$ae.add(ve(H=>{let K=this.$ah.read(H);if(!K){if(this.$af.set(!1,void 0),x&&!x.chatModel.hasRequests){let J=x.chatModel.inputModel.state.read(void 0);(!J||!J.inputText&&J.attachments.length===0)&&(x.dispose(),x=void 0)}return}x=K;let j=!1;for(let J of n.listCodeEditors()){let se=fu.get(J);if(se&&se.$af.read(void 0)){j=!0;break}}!j&&f.isFocused.read(H)&&this.$af.set(!0,void 0)}));let E=De(this,void 0);this.$ae.add(ve(H=>{let K=f.model.read(H),j=this.$ah.read(H),J=this.$af.read(H);!j||!J||!K?E.set(void 0,void 0):E.set(j,void 0)}));let M=E.map((H,K)=>H?.initialSelection.isEmpty()?d(12425,null):d(12426,null));this.$ae.add(ve(H=>{let K=E.read(H);S.set(!!K?.terminationState.read(H))})),this.$ae.add(ve(H=>{let K=E.read(H);K?(v.set(!0),this.$ag.value.widget.chatWidget.setModel(K.chatModel),this.$ag.value.position||(this.$ag.value.widget.chatWidget.setInputPlaceholder(M.read(H)),this.$ag.value.widget.chatWidget.input.renderAttachedContext(),this.$ag.value.show(K.initialPosition)),this.$ag.value.reveal(this.$ag.value.position),this.$ag.value.widget.focus()):(this.$ag.rawValue?.hide(),this.$ag.rawValue?.widget.chatWidget.setModel(void 0),i.focus(),v.reset())})),this.$ae.add(ve(H=>{let K=this.$ah.read(H);if(!K)return;let J=K.chatModel.lastRequestObs.read(H)?.response,se=J?.isPendingConfirmation.read(H);if(se){this.$aq.info(`[InlineChat] auto-approving: ${se.detail??"unknown"}`);for(let ae of J.response.value)ae.kind==="toolInvocation"&&pi.confirmWith(ae,{type:1,reason:"inlineChat"})}})),this.$ae.add(ve(H=>{let K=E.read(H);if(K){let j=K.editingSession.entries.read(H),J=sn.parse(K.uri),se=j.filter(ae=>!(ze(ae.modifiedURI,K.uri)||J&&ze(J.notebook,ae.modifiedURI)));for(let ae of se)this.$an.openEditor({resource:ae.modifiedURI},En).catch(mt)}}));let N=E.map((H,K)=>H?vi(this,H.chatModel.onDidChange,()=>H.chatModel.getRequests().at(-1)).read(K)?.response:void 0),V=N.map((H,K)=>{if(H)return vi(this,H.onDidChange,()=>H.response.value.findLast(j=>j.kind==="progressMessage")).read(K)});this.$ae.add(ve(H=>{let K=E.read(H),j=N.read(H),J=K?.terminationState.read(H);if(this.$ag.rawValue?.widget.updateInfo(""),!j?.isInProgress.read(H))this.$ag.rawValue?.status.set(j?.result?.details??"",void 0),j?.result?.errorDetails?(this.$ag.rawValue?.widget.updateInfo(`$(error) ${j.result.errorDetails.message}`),cn(j.result.errorDetails.message)):J&&this.$ag.rawValue?.showTerminationCard(J,this.$aj),J||this.$ag.rawValue?.hideTerminationCard(),this.$ag.rawValue?.widget.domNode.classList.toggle("request-in-progress",!1),this.$ag.rawValue?.widget.chatWidget.setInputPlaceholder(M.read(H));else{this.$ag.rawValue?.widget.domNode.classList.toggle("request-in-progress",!0),this.$ag.rawValue?.status.set("",void 0);let se=j.request?.message.text,ae=V.read(H);ae&&(se=ma(ae.content)),this.$ag.rawValue?.widget.chatWidget.setInputPlaceholder(se||d(12424,null))}})),this.$ae.add(ve(H=>{let K=E.read(H);if(!K)return;let j=K.editingSession.readEntry(K.uri,H);j?.state.read(H)===0&&j?.enableReviewModeUntilSettled()})),this.$ae.add(ve(H=>{let K=E.read(H),j=K?.editingSession.readEntry(K.uri,H),J=this.$an.visibleEditorPanes.find(se=>se.getControl()===this.$ai||qIo(se,this.$ai));if(J&&j&&j?.getEditorIntegration(J),j?.diffInfo&&this.$ag.rawValue?.position){let{position:se}=this.$ag.rawValue,ae=j.diffInfo.read(H);for(let ce of ae.changes)if(ce.modified.contains(se.lineNumber)){this.$ag.rawValue?.updatePositionAndHeight(new ye(ce.modified.startLineNumber-1,1));break}}}))}dispose(){this.$ae.dispose()}getWidgetPosition(){return this.$ag.rawValue?.position}focus(){this.$ag.rawValue?.widget.focus()}async run(i){To(this.$ai.hasModel());let e=this.$ai.getModel().uri,t=this.$al.getSessionByTextModel(e);t&&(await t.editingSession.accept(),t.dispose()),this.$af.set(!0,void 0);let o=this.$al.createSession(this.$ai);return this.$at(o,i)}async $at(i,e){To(this.$ai.hasModel());let t=this.$ai.getModel().uri,o=new O;try{if(await this.$av(i,o),e&&(e.attachDiagnostics??=!0),e?.attachDiagnostics){let n=[];for(let[r,s]of this.$ao.getLiveMarkers(t))if(r.intersectRanges(this.$ai.getSelection())){let l=nN.fromMarker(s);n.push(nN.toEntry(l))}if(n.length>0){this.$ag.value.widget.chatWidget.attachmentModel.addContext(...n);let r=n.length>1?d(12423,null):d(12422,null);this.$ag.value.widget.chatWidget.input.setValue(r,!0),e.message=r,this.$ag.value.widget.chatWidget.inputEditor.setSelection(new ei(1,1,Number.MAX_SAFE_INTEGER,1))}}if(e&&qst.isInlineChatRunOptions(e)){if(e.initialRange&&this.$ai.revealRange(e.initialRange),e.initialSelection&&this.$ai.setSelection(e.initialSelection),e.attachments&&(await Promise.all(e.attachments.map(async n=>{await this.$ag.value.widget.chatWidget.attachmentModel.addFile(n)})),delete e.attachments),e.modelSelector){let n=(await this.$ap.selectLanguageModels(e.modelSelector)).sort().at(0);if(!n)throw new Error(`No language models found matching selector: ${JSON.stringify(e.modelSelector)}.`);let r=this.$ap.lookupLanguageModel(n);if(!r)throw new Error(`Language model not loaded: ${n}.`);this.$ag.value.widget.chatWidget.input.setCurrentLanguageModel({metadata:r,identifier:n})}e.message&&(this.$ag.value.widget.chatWidget.setInput(e.message),e.autoSend&&await this.$ag.value.widget.chatWidget.acceptInput())}if(e?.resolveOnResponse){let n=ke(r=>{let s=i.editingSession.readEntry(t,r);return s?.state.read(r)===0&&!s?.isCurrentlyBeingModifiedBy.read(r)});return await yh(n,r=>r===!0),!0}else return await U.toPromise(i.editingSession.onDidDispose),!(i.editingSession.getEntry(t)?.state.get()===2)}finally{o.dispose()}}async acceptSession(){let i=this.$ah.get();i&&(await i.editingSession.accept(),i.dispose())}async rejectSession(){let i=this.$ah.get();i&&(await this.$as.cancelCurrentRequestForSession(i.chatModel.sessionResource,"inlineChatReject"),await i.editingSession.reject(),i.dispose())}async continueSessionInChat(){let i=this.$ah.get();i&&await this.$aj.invokeFunction(Iyo,i)}async rephraseSession(){let i=this.$ah.get();if(!i)return;let e=this.$aj.invokeFunction(yyo,i);e&&this.$ag.rawValue?.widget.chatWidget.setInput(e),this.$ag.rawValue?.widget.focus()}async $au(i){let e=this.$ag.value.widget.chatWidget.input.selectedLanguageModel.get();if(e&&!e.metadata.isDefaultForLocation[i.chatModel.initialLocation]){let t=await this.$ap.selectLanguageModels({vendor:e.metadata.vendor});for(let o of t){let n=this.$ap.lookupLanguageModel(o);if(n?.isDefaultForLocation[i.chatModel.initialLocation]){this.$ag.value.widget.chatWidget.input.setCurrentLanguageModel({metadata:n,identifier:o});break}}}}async $av(i,e){let t=fu.$ad,o=this.$am.getValue("inlineChat.defaultModel"),n=!1;t&&(n=this.$ag.value.widget.chatWidget.input.switchModelByQualifiedName([t]),n||(fu.$ad=void 0)),!n&&o&&(n=this.$ag.value.widget.chatWidget.input.switchModelByQualifiedName([o]),n||this.$aq.warn(`inlineChat.defaultModel setting value '${o}' did not match any available model. Falling back to vendor default.`)),n||await this.$au(i);let r;e.add(ve(s=>{let l=this.$ag.value.widget.chatWidget.input.selectedLanguageModel.read(s);if(l){if(!r){r=l.identifier;return}r!==l.identifier&&(fu.$ad=Mx.asQualifiedName(l.metadata),r=l.identifier)}}))}};fu=I([m(1,F),m(2,hd),m(3,cy),m(4,Qt),m(5,X),m(6,B),m(7,ie),m(8,Yz),m(9,Gr),m(10,re),m(11,mu),m(12,si)],fu);var $st=class a extends z{static{this.ID="notebook.action.indentUsingTabs"}constructor(){super({id:a.ID,title:d(13689,null),precondition:void 0})}run(i,...e){TNi(i,!1,!1)}},jst=class a extends z{static{this.ID="notebook.action.indentUsingSpaces"}constructor(){super({id:a.ID,title:d(13688,null),precondition:void 0})}run(i,...e){TNi(i,!0,!1)}},Qst=class a extends z{static{this.ID="notebook.action.changeTabDisplaySize"}constructor(){super({id:a.ID,title:d(13684,null),precondition:void 0})}run(i,...e){TNi(i,!0,!0)}},Yst=class a extends z{static{this.ID="notebook.action.convertIndentationToSpaces"}constructor(){super({id:a.ID,title:d(13686,null),precondition:void 0})}run(i,...e){HEo(i,!0)}},Xst=class a extends z{static{this.ID="notebook.action.convertIndentationToTabs"}constructor(){super({id:a.ID,title:d(13687,null),precondition:void 0})}run(i,...e){HEo(i,!1)}};function TNi(a,i,e){let t=a.get(ie),o=a.get(B),n=a.get(hd),r=a.get($e),s=t.activeEditorPane?.input;if(!mYe(s)||!n.retrieveExistingWidgetFromURI(s.resource)?.value)return;let u=[1,2,3,4,5,6,7,8].map(g=>({id:g.toString(),label:g.toString()})),p=o.getValue(Ct.cellEditorOptionsCustomizations),h=p["editor.insertSpaces"];delete p["editor.indentSize"],delete p["editor.tabSize"],delete p["editor.insertSpaces"],setTimeout(()=>{r.pick(u,{placeHolder:d(13690,null)}).then(g=>{if(g){let f=parseInt(g.label,10);e?o.updateValue(Ct.cellEditorOptionsCustomizations,{...p,"editor.tabSize":f,"editor.indentSize":f,"editor.insertSpaces":h}):o.updateValue(Ct.cellEditorOptionsCustomizations,{...p,"editor.tabSize":f,"editor.indentSize":f,"editor.insertSpaces":i})}})},50)}function HEo(a,i){let e=a.get(ie),t=a.get(B),o=a.get(re),n=a.get(Bt),r=a.get(hd),s=a.get(Ka),l=e.activeEditorPane?.input;if(!mYe(l))return;let u=r.retrieveExistingWidgetFromURI(l.resource)?.value?.textModel;if(!u)return;let p=new O;try{Promise.all(u.cells.map(async h=>{let g=await n.createModelReference(h.uri);p.add(g);let f=g.object.textEditorModel,v=h.textModel?.getOptions();if(!v)return;let b=Hpn(f,v.tabSize,i);s.apply(b,{label:d(13685,null),code:"undoredo.convertIndentation"})})).then(()=>{let h=t.getValue(Ct.cellEditorOptionsCustomizations),g=h["editor.indentSize"],f=h["editor.tabSize"];delete h["editor.indentSize"],delete h["editor.tabSize"],delete h["editor.insertSpaces"],t.updateValue(Ct.cellEditorOptionsCustomizations,{...h,"editor.tabSize":f,"editor.indentSize":g,"editor.insertSpaces":i}),p.dispose()})}catch{o.error("Failed to convert indentation to spaces for notebook cells.")}}function Hpn(a,i,e){if(a.getLineCount()===1&&a.getLineMaxColumn(1)===1)return[];let t="";for(let r=0;r<i;r++)t+=" ";let o=new RegExp(t,"gi"),n=[];for(let r=1,s=a.getLineCount();r<=s;r++){let l=a.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=a.getLineMaxColumn(r)),l===1)continue;let c=new G(r,1,r,l),u=a.getValueInRange(c),p=e?u.replace(/\t/ig,t):u.replace(o,"	");n.push(new hl(a.uri,{range:c,text:p}))}return n}W(jst);W($st);W(Qst);W(Yst);W(Xst);var fne=_;function vne(a){let i=fne(".");return i.classList.add("debug-view-content","file-icon-themable-tree"),a.appendChild(i),i}var UEo=(a,i)=>{let e=a.name.length,t=a.name.length+2,o=[],n=[];for(let r of i)r.start<e&&o.push({start:r.start,end:Math.min(r.end,e)}),r.end>t&&n.push({start:Math.max(r.start-t,0),end:r.end-t});return{name:o,value:n}},w$t={getKeyboardNavigationLabel(a){let i=a.getSession()?.rememberedCapabilities?.supportsANSIStyling;return`${a.name}: ${i?Hv(a.value):a.value}`}},Zq=class{constructor(i,e){this.debugService=i;this.debugVisualizer=e}async getChildren(i){let e=this.debugService.getViewModel(),t=await this.doGetChildren(i);return Promise.all(t.map(async o=>{let n=e.getVisualizedExpression(o);if(typeof n=="string"){let r=await this.debugVisualizer.getVisualizedNodeFor(n,o);if(r)return e.setVisualizedExpression(o,r),r}else if(n)return n;return o}))}};Zq=I([m(0,Hi),m(1,JZ)],Zq);var p1=class{constructor(i,e,t){this.debugService=i;this.contextViewService=e;this.hoverService=t}renderTemplate(i){let e=new O,t=D(i,fne(".expression")),o=D(t,fne("span.name")),n=D(t,fne("span.lazy-button"));n.classList.add(...q.asClassNameArray(L.eye)),e.add(this.hoverService.setupManagedHover(yi("mouse"),n,d(10397,null)));let r=D(t,fne("span.type")),s=D(t,fne("span.value")),l=e.add(new ul(o)),c=D(t,fne(".inputBoxContainer")),u;this.renderActionBar&&(D(t,fne(".span.actionbar-spacer")),u=e.add(new oo(t)));let p={expression:t,name:o,type:r,value:s,label:l,inputBoxContainer:c,actionBar:u,elementDisposable:new O,templateDisposable:e,lazyButton:n,currentElement:void 0};return e.add($(n,ne.CLICK,()=>{p.currentElement&&this.debugService.getViewModel().evaluateLazyExpression(p.currentElement)})),p}renderExpressionElement(i,e,t){t.currentElement=i,this.renderExpression(e.element,t,Wa(e.filterData)),t.actionBar&&this.renderActionBar(t.actionBar,i,t);let o=this.debugService.getViewModel().getSelectedExpression();if(i===o?.expression||i instanceof ac&&i.errorMessage){let n=this.getInputBoxOptions(i,!!o?.settingWatch);n&&t.elementDisposable.add(this.renderInputBox(t.name,t.value,t.inputBoxContainer,n))}}renderInputBox(i,e,t,o){i.style.display="none",e.style.display="none",t.style.display="initial",St(t);let n=new ad(t,this.contextViewService,{...o,inputBoxStyles:Wl});n.value=o.initialValue,n.focus(),n.select();let r=bd((l,c)=>{i.style.display="",e.style.display="",t.style.display="none";let u=n.value;je(s),c&&(this.debugService.getViewModel().setSelectedExpression(void 0,!1),o.onFinish(u,l))}),s=[n,Yo(n.inputElement,ne.KEY_DOWN,l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),r(u,!0))}),$(n.inputElement,ne.BLUR,()=>{r(!0,!0)}),$(n.inputElement,ne.CLICK,l=>{l.preventDefault(),l.stopPropagation()})];return ee(()=>{r(!1,!1)})}disposeElement(i,e,t){t.elementDisposable.clear()}disposeTemplate(i){i.elementDisposable.dispose(),i.templateDisposable.dispose()}};p1=I([m(0,Hi),m(1,qn),m(2,ot)],p1);var Upn=0,Jst=()=>`topReplElement:${Upn++}`,KC=class{constructor(i,e,t,o,n,r){this.session=i;this.id=e;this.value=t;this.severity=o;this.sourceData=n;this.expression=r;this._count=1;this._onDidChangeCount=new T}toString(i=!1){let e=this.value;for(let o=1;o<this.count;o++)e+=(e.endsWith(`
`)?"":`
`)+this.value;let t=this.sourceData&&i?` ${this.sourceData.source.name}`:"";return e+t}getId(){return this.id}getChildren(){return this.expression?.getChildren()||Promise.resolve([])}set count(i){this._count=i,this._onDidChangeCount.fire()}get count(){return this._count}get onDidChangeCount(){return this._onDidChangeCount.event}get hasChildren(){return!!this.expression?.hasChildren}},Dve=class{constructor(i,e,t,o){this.session=i;this.expression=e;this.severity=t;this.sourceData=o;this.id=ht();this.hasChildren=e.hasChildren}getSession(){return this.session}getChildren(){return this.expression.getChildren()}toString(){return this.expression.toString()}getId(){return this.id}},C$t=class a{constructor(i,e,t,o,n){this.id=i;this.name=e;this.valueObj=t;this.sourceData=o;this.annotation=n}static{this.MAX_CHILDREN=1e3}getId(){return this.id}getSession(){}get value(){return this.valueObj===null?"null":Array.isArray(this.valueObj)?`Array[${this.valueObj.length}]`:Di(this.valueObj)?"Object":We(this.valueObj)?`"${this.valueObj}"`:String(this.valueObj)||""}get hasChildren(){return Array.isArray(this.valueObj)&&this.valueObj.length>0||Di(this.valueObj)&&Object.getOwnPropertyNames(this.valueObj).length>0}evaluateLazy(){throw new Error("Method not implemented.")}getChildren(){let i=[];return Array.isArray(this.valueObj)?i=this.valueObj.slice(0,a.MAX_CHILDREN).map((e,t)=>new a(`${this.id}:${t}`,String(t),e)):Di(this.valueObj)&&(i=Object.getOwnPropertyNames(this.valueObj).slice(0,a.MAX_CHILDREN).map((e,t)=>new a(`${this.id}:${t}`,e,this.valueObj[e]))),Promise.resolve(i)}toString(){return`${this.name}
${this.value}`}},bne=class{constructor(i){this.value=i;this.id=ht()}toString(){return this.value}getId(){return this.id}},fO=class extends dN{constructor(e){super(void 0,void 0,0,ht());this.originalExpression=e;this._available=!0}get available(){return this._available}async evaluateExpression(e,t,o,n){let r=await super.evaluateExpression(e,t,o,n);return this._available=r,r}toString(){return`${this.value}`}},e$=class a{constructor(i,e,t,o){this.session=i;this.name=e;this.autoExpand=t;this.sourceData=o;this.children=[];this.ended=!1;this.id=`replGroup:${a.COUNTER++}`}static{this.COUNTER=0}get hasChildren(){return!0}getId(){return this.id}toString(i=!1){let e=i&&this.sourceData?` ${this.sourceData.source.name}`:"";return this.name+e}addChild(i){let e=this.children.length?this.children[this.children.length-1]:void 0;e instanceof a&&!e.hasEnded?e.addChild(i):this.children.push(i)}getChildren(){return this.children}end(){let i=this.children.length?this.children[this.children.length-1]:void 0;i instanceof a&&!i.hasEnded?i.end():this.ended=!0}get hasEnded(){return this.ended}};function _ve(a,i){return!a&&!i?!0:a&&i?a.column===i.column&&a.lineNumber===i.lineNumber&&a.source.uri.toString()===i.source.uri.toString():!1}var x$t=class a{constructor(i){this.configurationService=i;this.replElements=[];this._onDidChangeElements=new T;this.onDidChangeElements=this._onDidChangeElements.event}getReplElements(){return this.replElements}async addReplExpression(i,e,t){this.addReplElement(new bne(t));let o=new fO(t);await o.evaluateExpression(t,i,e,"repl"),this.addReplElement(o)}appendToRepl(i,{output:e,expression:t,sev:o,source:n}){let r="\x1B[2J",s=e.lastIndexOf(r);if(s!==-1&&(this.removeReplExpressions(),this.appendToRepl(i,{output:d(11158,null),sev:wt.Ignore}),e=e.substring(s+r.length)),t){this.addReplElement(e?new KC(i,Jst(),e,o,n,t):new Dve(i,t,o,n));return}this.appendOutputToRepl(i,e,o,n)}appendOutputToRepl(i,e,t,o){let n=this.configurationService.getValue("debug"),r=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(r instanceof KC&&r.severity===t&&_ve(r.sourceData,o)&&!r.value.endsWith(`
`)&&!r.value.endsWith(`\r
`)&&r.count===1){let s=r.value+e;this.replElements[this.replElements.length-1]=new KC(i,Jst(),s,t,o),this._onDidChangeElements.fire(void 0),n.console.collapseIdenticalLines&&s.endsWith(`
`)&&this.tryCollapseCompleteLine(t,o),n.console.collapseIdenticalLines&&s.includes(`
`)&&this.splitIntoLines(s).length>1&&this.applyLineLevelCollapsing(i,t,o);return}if(n.console.collapseIdenticalLines&&e.includes(`
`))this.processMultiLineOutput(i,e,t,o);else{if(r instanceof KC&&r.severity===t&&_ve(r.sourceData,o)&&r.value===e&&n.console.collapseIdenticalLines){r.count++;return}let s=new KC(i,Jst(),e,t,o);this.addReplElement(s)}}tryCollapseCompleteLine(i,e){if(this.replElements.length<2)return;let t=this.replElements[this.replElements.length-1],o=this.replElements[this.replElements.length-2];t instanceof KC&&o instanceof KC&&t.severity===i&&o.severity===i&&_ve(t.sourceData,e)&&_ve(o.sourceData,e)&&t.value===o.value&&t.count===1&&t.value.endsWith(`
`)&&(o.count+=t.count,this.replElements.pop(),this._onDidChangeElements.fire(void 0))}processMultiLineOutput(i,e,t,o){let n=this.splitIntoLines(e);for(let r of n){if(r.length===0)continue;let s=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(s instanceof KC&&s.severity===t&&_ve(s.sourceData,o)&&s.value===r)s.count++;else{let l=new KC(i,Jst(),r,t,o);this.addReplElement(l)}}}splitIntoLines(i){let e=[],t=0;for(;t<i.length;){let o=i.indexOf(`
`,t);if(o===-1){e.push(i.substring(t));break}e.push(i.substring(t,o+1)),t=o+1}return e}applyLineLevelCollapsing(i,e,t){let o=this.replElements[this.replElements.length-1];if(!(o instanceof KC)||o.severity!==e||!_ve(o.sourceData,t))return;let n=this.splitIntoLines(o.value);if(!(n.length<=1)){this.replElements.pop();for(let r of n){if(r.length===0)continue;let s=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(s instanceof KC&&s.severity===e&&_ve(s.sourceData,t)&&s.value===r)s.count++;else{let l=new KC(i,Jst(),r,e,t);this.addReplElement(l)}}this._onDidChangeElements.fire(void 0)}}startGroup(i,e,t,o){let n=new e$(i,e,t,o);this.addReplElement(n)}endGroup(){let i=this.replElements[this.replElements.length-1];i instanceof e$&&i.end()}addReplElement(i){let e=this.replElements.length?this.replElements[this.replElements.length-1]:void 0;if(e instanceof e$&&!e.hasEnded)e.addChild(i);else{this.replElements.push(i);let t=this.configurationService.getValue("debug");this.replElements.length>t.console.maximumLines&&this.replElements.splice(0,this.replElements.length-t.console.maximumLines)}this._onDidChangeElements.fire(i)}removeReplExpressions(){this.replElements.length>0&&(this.replElements=[],this._onDidChangeElements.fire(void 0))}clone(){let i=new a(this.configurationService);return i.replElements=this.replElements.slice(),i}};function _Ni(a,i,e,t,o){let n=document.createElement("span"),r=a.length,s=[],l,c,u,p=!1,h=0,g=0,f="";for(;h<r;){let E=!1;if(a.charCodeAt(h)===27&&a.charAt(h+1)==="["){let M=h;h+=2;let N="";for(;h<r;){let V=a.charAt(h);if(N+=V,h++,V.match(/^[ABCDHIJKfhmpsu]$/)){E=!0;break}}if(E){if(g+=2+N.length,zEo(n,f,s,i,e,l,c,u,t,h-f.length-g,o),f="",N.match(/^(?:[34][0-8]|9[0-7]|10[0-7]|[0-9]|2[1-5,7-9]|[34]9|5[8,9]|1[0-9])(?:;[349][0-7]|10[0-7]|[013]|[245]|[34]9)?(?:;[012]?[0-9]?[0-9])*;?m$/)){let V=N.slice(0,-1).split(";").filter(H=>H!=="").map(H=>parseInt(H,10));if(V[0]===38||V[0]===48||V[0]===58){let H=V[0]===38?"foreground":V[0]===48?"background":"underline";V[1]===5?w(V,H):V[1]===2&&y(V,H)}else S(V)}}else h=M}E===!1&&(f+=a.charAt(h),h++)}return f&&zEo(n,f,s,i,e,l,c,u,t,h-f.length,o),n;function v(E,M){E==="foreground"?l=M:E==="background"?c=M:E==="underline"&&(u=M),s=s.filter(N=>N!==`code-${E}-colored`),M!==void 0&&s.push(`code-${E}-colored`)}function b(){let E=l;v("foreground",c),v("background",E)}function S(E){for(let M of E)switch(M){case 0:{s=[],l=void 0,c=void 0;break}case 1:{s=s.filter(N=>N!=="code-bold"),s.push("code-bold");break}case 2:{s=s.filter(N=>N!=="code-dim"),s.push("code-dim");break}case 3:{s=s.filter(N=>N!=="code-italic"),s.push("code-italic");break}case 4:{s=s.filter(N=>N!=="code-underline"&&N!=="code-double-underline"),s.push("code-underline");break}case 5:{s=s.filter(N=>N!=="code-blink"),s.push("code-blink");break}case 6:{s=s.filter(N=>N!=="code-rapid-blink"),s.push("code-rapid-blink");break}case 7:{p||(p=!0,b());break}case 8:{s=s.filter(N=>N!=="code-hidden"),s.push("code-hidden");break}case 9:{s=s.filter(N=>N!=="code-strike-through"),s.push("code-strike-through");break}case 10:{s=s.filter(N=>!N.startsWith("code-font"));break}case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:{s=s.filter(N=>!N.startsWith("code-font")),s.push(`code-font-${M-10}`);break}case 21:{s=s.filter(N=>N!=="code-underline"&&N!=="code-double-underline"),s.push("code-double-underline");break}case 22:{s=s.filter(N=>N!=="code-bold"&&N!=="code-dim");break}case 23:{s=s.filter(N=>N!=="code-italic"&&N!=="code-font-10");break}case 24:{s=s.filter(N=>N!=="code-underline"&&N!=="code-double-underline");break}case 25:{s=s.filter(N=>N!=="code-blink"&&N!=="code-rapid-blink");break}case 27:{p&&(p=!1,b());break}case 28:{s=s.filter(N=>N!=="code-hidden");break}case 29:{s=s.filter(N=>N!=="code-strike-through");break}case 53:{s=s.filter(N=>N!=="code-overline"),s.push("code-overline");break}case 55:{s=s.filter(N=>N!=="code-overline");break}case 39:{v("foreground",void 0);break}case 49:{v("background",void 0);break}case 59:{v("underline",void 0);break}case 73:{s=s.filter(N=>N!=="code-superscript"&&N!=="code-subscript"),s.push("code-superscript");break}case 74:{s=s.filter(N=>N!=="code-superscript"&&N!=="code-subscript"),s.push("code-subscript");break}case 75:{s=s.filter(N=>N!=="code-superscript"&&N!=="code-subscript");break}default:{x(M);break}}}function y(E,M){if(E.length>=5&&E[2]>=0&&E[2]<=255&&E[3]>=0&&E[3]<=255&&E[4]>=0&&E[4]<=255){let N=new Ut(E[2],E[3],E[4]);v(M,N)}}function w(E,M){let N=E[2],V=zpn(N);if(V)v(M,V);else if(N>=0&&N<=15){if(M==="underline"){let H=YS[N];v(M,`--vscode-debug-ansi-${H}`);return}N+=30,N>=38&&(N+=52),M==="background"&&(N+=10),x(N)}}function x(E){let M,N;if(E>=30&&E<=37?(N=E-30,M="foreground"):E>=90&&E<=97?(N=E-90+8,M="foreground"):E>=40&&E<=47?(N=E-40,M="background"):E>=100&&E<=107&&(N=E-100+8,M="background"),N!==void 0&&M){let V=YS[N];v(M,`--vscode-debug-ansi-${V.replaceAll(".","-")}`)}}}function zEo(a,i,e,t,o,n,r,s,l,c,u){if(!a||!i)return;let p=t.linkify(i,u,!0,o,void 0,l?.map(h=>({start:h.start-c,end:h.end-c,extraClasses:h.extraClasses})));p.className=e.join(" "),n&&(p.style.color=typeof n=="string"?`var(${n})`:Ue.Format.CSS.formatRGB(new Ue(n))),r&&(p.style.backgroundColor=typeof r=="string"?`var(${r})`:Ue.Format.CSS.formatRGB(new Ue(r))),s&&(p.style.textDecorationColor=typeof s=="string"?`var(${s})`:Ue.Format.CSS.formatRGB(new Ue(s))),a.appendChild(p)}function zpn(a){if(a%1===0)if(a>=16&&a<=231){a-=16;let i=a%6;a=(a-i)/6;let e=a%6;a=(a-e)/6;let t=a,o=255/5;return i=Math.round(i*o),e=Math.round(e*o),t=Math.round(t*o),new Ut(t,e,i)}else if(a>=232&&a<=255){a-=232;let i=Math.round(a/23*255);return new Ut(i,i,i)}else return}hs((a,i)=>{let e=[{selector:".monaco-workbench .sidebar, .monaco-workbench .auxiliarybar",bg:a.getColor(ch)},{selector:".monaco-workbench .panel",bg:a.getColor(GI)},{selector:".monaco-workbench .monaco-list-row.selected",bg:a.getColor(bv)},{selector:".monaco-workbench .monaco-list-row.focused",bg:a.getColor(tyt)},{selector:".monaco-workbench .monaco-list:focus .monaco-list-row.focused",bg:a.getColor(lX)},{selector:".monaco-workbench .monaco-list:focus .monaco-list-row.selected",bg:a.getColor(Kw)},{selector:".debug-hover-widget",bg:a.getColor(EF)}];for(let{selector:t,bg:o}of e){let n=YS.map(r=>{let s=a.getColor(r);if(s)return`--vscode-debug-ansi-${r.replaceAll(".","-")}:${o?o.ensureConstrast(s,4):s}`}).filter(so);i.addRule(`${t} { ${n.join(";")} }`)}});var jR=le("extensionHostDebugService");async function GEo(a){let i=a.get($e),e=a.get(Hi),t=a.get(ie),o=e.getModel().getSessions(!1),n=a.get(_t),r=a.get(Rt),s=a.get(nt),l=new O,c=i.createQuickPick({useSeparators:!0});l.add(c),c.matchOnLabel=c.matchOnDescription=c.matchOnDetail=c.sortByLabel=!1,c.placeholder=d(11157,null),c.items=await KEo(c.value,o,t,n,r,s),l.add(c.onDidChangeValue(async()=>{c.items=await KEo(c.value,o,t,n,r,s)})),l.add(c.onDidAccept(()=>{c.selectedItems[0].accept(),c.hide()})),l.add(c.onDidHide(()=>l.dispose())),c.show()}async function Kpn(a,i,e,t,o,n){let r=[];return r.push({type:"separator",label:a.name}),(await a.getLoadedSources()).forEach(l=>{let c=Gpn(l,i,e,t,o,n);c&&r.push(c)}),r}async function KEo(a,i,e,t,o,n){let r=[],s=await Promise.all(i.map(l=>Kpn(l,a,e,t,o,n)));for(let l of s)for(let c of l)r.push(c);return r}function Gpn(a,i,e,t,o,n){let r=n.getUriBasenameLabel(a.uri),s=n.getUriLabel(ai(a.uri)),l=xh(i,r,!0),c=xh(i,s,!0);if(l||c)return{label:r,description:s==="."?void 0:s,highlights:{label:l??void 0,description:c??void 0},iconClasses:Ia(t,o,a.uri),accept:()=>{a.available&&a.openInEditor(e,{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0})}}}var nu=_;function xne(a){let i=new qf("",!1,Ag);return i.domNode.tabIndex=-1,a.add(i),i}var $pn=9;var yV=class{constructor(i,e){this.uri=i;this.breakpoints=e}getId(){return this.uri.toString()}get enabled(){return this.breakpoints.every(i=>i.enabled)}get indeterminate(){let i=this.breakpoints.filter(e=>e.enabled).length;return i>0&&i<this.breakpoints.length}};function qEo(a){return a instanceof pb?"source":a instanceof YI?"instruction":"exception"}var zWe=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,n,t,u,h,p,r,g,s,b);this.debugService=o;this.editorService=l;this.contextViewService=c;this.labelService=f;this.languageService=S;this.needsRefresh=!1;this.needsStateChange=!1;this.ignoreLayout=!1;this.collapsedState=new Set;this.menu=v.createMenu(R.DebugBreakpointsContext,h),this._register(this.menu),this.breakpointItemType=lR.bindTo(h),this.breakpointIsDataBytes=nIi.bindTo(h),this.breakpointHasMultipleModes=rIi.bindTo(h),this.breakpointSupportsCondition=EAt.bindTo(h),this.breakpointInputFocused=xAt.bindTo(h),this._register(this.debugService.getModel().onDidChangeBreakpoints(()=>this.onBreakpointsChange())),this._register(this.debugService.getViewModel().onDidFocusSession(()=>this.onBreakpointsChange())),this._register(this.debugService.onDidChangeState(()=>this.onStateChange())),this.hintDelayer=this._register(new Dt(()=>this.updateBreakpointsHint(!0),4e3))}getPresentation(){return this.configurationService.getValue("debug.breakpointsView.presentation")}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-breakpoints"),this.tree=this.instantiationService.createInstance(l0,"BreakpointsView",e,new DNi(this),[this.instantiationService.createInstance(Sne),this.instantiationService.createInstance(Ine,this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType),new k$t(this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType,this.debugService,this.hoverService),new _$t(this,this.debugService,this.contextViewService),this.instantiationService.createInstance(yne,this.menu,this.breakpointSupportsCondition,this.breakpointItemType),new E$t(this,this.debugService,this.contextViewService,this.hoverService,this.labelService),this.instantiationService.createInstance(wne,this.menu,this.breakpointHasMultipleModes,this.breakpointSupportsCondition,this.breakpointItemType,this.breakpointIsDataBytes),new T$t(this,this.debugService,this.contextViewService,this.hoverService,this.labelService),this.instantiationService.createInstance(Cne)],{compressionEnabled:this.getPresentation()==="tree",hideTwistiesOfChildlessElements:!0,identityProvider:{getId:o=>o.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:o=>o instanceof yV?sl(o.uri):o instanceof pb?`${sl(o.uri)}:${o.lineNumber}`:o instanceof QI?o.name:o instanceof rw?o.description:o instanceof pN?o.label||o.filter:o instanceof YI?`0x${o.address.toString(16)}`:"",getCompressedNodeKeyboardNavigationLabel:o=>o.map(n=>n instanceof yV?sl(n.uri):"").join("/")},accessibilityProvider:new RNi(this.debugService,this.labelService),multipleSelectionSupport:!1,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(this.tree),_De.bindTo(this.tree.contextKeyService),this._register(this.tree.onContextMenu(this.onTreeContextMenu,this)),this._register(this.tree.onMouseMiddleClick(async({element:o})=>{o instanceof pb?await this.debugService.removeBreakpoints(o.getId()):o instanceof QI?await this.debugService.removeFunctionBreakpoints(o.getId()):o instanceof rw?await this.debugService.removeDataBreakpoints(o.getId()):o instanceof YI?await this.debugService.removeInstructionBreakpoints(o.instructionReference,o.offset):o instanceof yV&&await this.debugService.removeBreakpoints(o.breakpoints.map(n=>n.getId()))})),this._register(this.tree.onDidOpen(async o=>{let n=o.element;n&&(Wp(o.browserEvent)&&o.browserEvent.button===1||(n instanceof pb&&KWe(n,o.sideBySide,o.editorOptions.preserveFocus||!1,o.editorOptions.pinned||!o.editorOptions.preserveFocus,this.debugService,this.editorService),n instanceof YI&&(await this.editorService.openEditor(UM.instance)).goToInstructionAndOffset(n.instructionReference,n.offset,Wp(o.browserEvent)&&o.browserEvent.detail===2),Wp(o.browserEvent)&&o.browserEvent.detail===2&&n instanceof QI&&n!==this.inputBoxData?.breakpoint&&this.renderInputBox({breakpoint:n,type:"name"})))})),this._register(this.tree.onKeyDown(o=>{let n=new mi(o);if(n.equals(10)&&!Ch(o.target)){let r=this.tree.getFocus();if(r.length>0){let s=r[0];s&&!(s instanceof yV)&&(this.debugService.enableOrDisableBreakpoints(!s.enabled,s),n.preventDefault(),n.stopPropagation())}}})),this._register(this.tree.onDidChangeCollapseState(o=>{let n=o.node.element;n instanceof yV&&(o.node.collapsed?this.collapsedState.add(n.getId()):this.collapsedState.delete(n.getId()),this.updateSize())})),this._register(this.configurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration("debug.breakpointsView.presentation")){let n=this.getPresentation();this.tree.updateOptions({compressionEnabled:n==="tree"}),this.onBreakpointsChange()}})),this.setTreeInput(),this._register(this.onDidChangeBodyVisibility(o=>{o&&(this.needsRefresh&&this.onBreakpointsChange(),this.needsStateChange&&this.onStateChange())}));let t=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id));this._register(t.onDidChangeAllViewDescriptors(()=>{this.updateSize()}))}renderHeaderTitle(e,t){super.renderHeaderTitle(e,t);let o=D(e,nu("span.breakpoint-warning"));this.hintContainer=this._register(new ld(o,{supportIcons:!0,hoverDelegate:{showHover:(n,r)=>this.hoverService.showInstantHover({content:n.content,target:this.hintContainer.element},r),delay:this.configurationService.getValue("workbench.hover.delay")}})),Wi(this.hintContainer.element)}focus(){super.focus(),this.tree?.domFocus()}renderInputBox(e){this._inputBoxData=e,this.onBreakpointsChange(),this._inputBoxData=void 0}get inputBoxData(){return this._inputBoxData}layoutBody(e,t){if(!this.ignoreLayout){super.layoutBody(e,t),this.tree?.layout(e,t);try{this.ignoreLayout=!0,this.updateSize()}finally{this.ignoreLayout=!1}}}onTreeContextMenu(e){let t=e.element;if(t instanceof yV){this.breakpointItemType.set("breakpointFolder");let{secondary:l}=um(this.menu.getActions({arg:t,shouldForwardArgs:!1}),"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>l,getActionsContext:()=>t});return}let o=t instanceof pb?"breakpoint":t instanceof pN?"exceptionBreakpoint":t instanceof QI?"functionBreakpoint":t instanceof rw?"dataBreakpoint":t instanceof YI?"instructionBreakpoint":void 0;this.breakpointItemType.set(o);let n=this.debugService.getViewModel().focusedSession,r=t instanceof pN?t.supportsCondition:!n||!!n.capabilities.supportsConditionalBreakpoints;this.breakpointSupportsCondition.set(r),this.breakpointIsDataBytes.set(t instanceof rw&&t.src.type===1),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes(qEo(t)).length>1);let{secondary:s}=um(this.menu.getActions({arg:e.element,shouldForwardArgs:!1}),"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,getActionsContext:()=>t})}updateSize(){let e=this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerByViewId(this.id)),t=22;this.minimumBodySize=this.orientation===0?Math.min($pn*t,this.tree.contentHeight):170,this.maximumBodySize=this.orientation===0&&e.visibleViewDescriptors.length>1?this.tree.contentHeight:Number.POSITIVE_INFINITY}updateBreakpointsHint(e=!1){if(!this.hintContainer)return;let t=this.debugService.getViewModel().focusedSession?.configuration.type,o=t?this.debugService.getAdapterManager().getDebugger(t):void 0,n=o?.strings?.unverifiedBreakpoints,r=n&&this.debugService.getModel().getBreakpoints().filter(s=>{if(s.verified||!s.enabled)return!1;let l=this.languageService.guessLanguageIdByFilepathOrFirstLine(s.uri);return l&&o.interestedInLanguage(l)});if(n&&r?.length&&this.debugService.getModel().areBreakpointsActivated())if(e){let s=new he(void 0,{isTrusted:!0}).appendMarkdown(n);this.hintContainer.setLabel("$(warning)",void 0,{title:{markdown:s,markdownNotSupportedFallback:n}}),Xo(this.hintContainer.element)}else this.hintDelayer.schedule();else Wi(this.hintContainer.element)}onBreakpointsChange(){this.isBodyVisible()?(this.tree&&(this.setTreeInput(),this.needsRefresh=!1),this.updateBreakpointsHint(),this.updateSize()):this.needsRefresh=!0}onStateChange(){if(this.isBodyVisible()){this.needsStateChange=!1;let e=this.debugService.getViewModel().focusedThread,t=!1;if(e&&e.stoppedDetails&&e.stoppedDetails.hitBreakpointIds&&e.stoppedDetails.hitBreakpointIds.length>0){let o=e.stoppedDetails.hitBreakpointIds,r=this.flatElements.find(s=>{let l=s.getIdFromAdapter(e.session.getId());return typeof l=="number"&&o.indexOf(l)!==-1});r&&(this.tree.setFocus([r]),this.tree.setSelection([r]),t=!0,this.autoFocusedElement=r)}if(!t){let o=this.tree.getFocus(),n=this.tree.getSelection();this.autoFocusedElement&&eo(o,n)&&n.includes(this.autoFocusedElement)&&(this.tree.setFocus([]),this.tree.setSelection([])),this.autoFocusedElement=void 0}this.updateBreakpointsHint()}else this.needsStateChange=!0}setTreeInput(){let e=this.getTreeElements();this.tree.setChildren(null,e)}getTreeElements(){let e=this.debugService.getModel(),t=this.debugService.getViewModel().focusedSession?.getId(),o=this.getPresentation()==="tree",n=[];for(let s of e.getExceptionBreakpointsForSession(t))n.push({element:s,incompressible:!0});for(let s of e.getFunctionBreakpoints())n.push({element:s,incompressible:!0});for(let s of e.getDataBreakpoints())n.push({element:s,incompressible:!0});let r=e.getBreakpoints();if(o&&r.length>0){let s=new Map;for(let l of r){let c=l.uri.toString();s.has(c)||s.set(c,[]),s.get(c).push(l)}for(let[l,c]of s){let u=A.parse(l),p=new yV(u,c);c.sort((g,f)=>g.lineNumber-f.lineNumber);let h=c.map(g=>({element:g,incompressible:!1}));n.push({element:p,incompressible:!1,collapsed:this.collapsedState.has(p.getId()),children:h})}}else for(let s of r)n.push({element:s,incompressible:!0});for(let s of e.getInstructionBreakpoints())n.push({element:s,incompressible:!0});return n}get flatElements(){let e=this.debugService.getModel(),t=this.debugService.getViewModel().focusedSession?.getId();return e.getExceptionBreakpointsForSession(t).concat(e.getFunctionBreakpoints()).concat(e.getDataBreakpoints()).concat(e.getBreakpoints()).concat(e.getInstructionBreakpoints())}};zWe=I([m(1,Xe),m(2,Hi),m(3,Le),m(4,F),m(5,Pe),m(6,ie),m(7,qn),m(8,B),m(9,ji),m(10,X),m(11,Je),m(12,nt),m(13,Yt),m(14,ot),m(15,Rt)],zWe);var DNi=class{constructor(i){this.view=i}getHeight(i){return 22}getTemplateId(i){if(i instanceof yV)return Sne.ID;if(i instanceof pb)return Ine.ID;if(i instanceof QI){let e=this.view.inputBoxData?.breakpoint;return!i.name||e&&e.getId()===i.getId()?E$t.ID:yne.ID}if(i instanceof pN){let e=this.view.inputBoxData?.breakpoint;return e&&e.getId()===i.getId()?_$t.ID:k$t.ID}if(i instanceof rw){let e=this.view.inputBoxData?.breakpoint;return e&&e.getId()===i.getId()?T$t.ID:wne.ID}return i instanceof YI?Cne.ID:""}},Zst=new Map,Sne=class{constructor(i,e,t){this.debugService=i;this.labelService=e;this.hoverService=t}static{this.ID="breakpointFolder"}get templateId(){return Sne.ID}renderTemplate(i){let e=Object.create(null);return e.elementDisposables=new O,e.templateDisposables=new O,e.templateDisposables.add(e.elementDisposables),e.container=i,i.classList.add("breakpoint","breakpoint-folder"),e.templateDisposables.add(ee(()=>{i.classList.remove("breakpoint","breakpoint-folder")})),e.checkbox=new $K("",!1,Ag),e.checkbox.domNode.tabIndex=-1,e.templateDisposables.add(e.checkbox),e.templateDisposables.add(e.checkbox.onChange(()=>{let t=e.checkbox.checked,o=t==="mixed"?!0:t;for(let n of e.context.breakpoints)this.debugService.enableOrDisableBreakpoints(o,n)})),D(e.container,e.checkbox.domNode),e.name=D(e.container,nu("span.name")),D(e.container,nu("span.file-path")),e.actionBar=new oo(e.container),e.templateDisposables.add(e.actionBar),e}renderElement(i,e,t){let o=i.element;t.context=o,t.name.textContent=this.labelService.getUriBasenameLabel(o.uri),t.container.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated());let n=this.labelService.getUriLabel(o.uri,{relative:!0});t.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.container,n)),o.indeterminate?t.checkbox.checked="mixed":t.checkbox.checked=o.enabled,t.actionBar.clear();let r=t.elementDisposables.add(new it("debug.removeBreakpointsInFile",d(10498,null),q.asClassName(L.close),!0,async()=>{for(let s of o.breakpoints)await this.debugService.removeBreakpoints(s.getId())}));t.actionBar.push(r,{icon:!0,label:!1})}renderCompressedElements(i,e,t){let o=i.element.elements,n=o[o.length-1];t.context=n;let r=o.map(c=>sl(c.uri));t.name.textContent=r.join("/");let s=this.labelService.getUriLabel(n.uri,{relative:!0});t.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.container,s)),n.indeterminate?t.checkbox.checked="mixed":t.checkbox.checked=n.enabled,t.actionBar.clear();let l=t.elementDisposables.add(new it("debug.removeBreakpointsInFile",d(10498,null),q.asClassName(L.close),!0,async()=>{for(let c of n.breakpoints)await this.debugService.removeBreakpoints(c.getId())}));t.actionBar.push(l,{icon:!0,label:!1})}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Sne=I([m(0,Hi),m(1,nt),m(2,ot)],Sne);var Ine=class{constructor(i,e,t,o,n,r,s,l){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.debugService=n;this.hoverService=r;this.labelService=s;this.textModelService=l}static{this.ID="breakpoints"}get templateId(){return Ine.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new O,e.templateDisposables=new O,e.templateDisposables.add(e.elementDisposables),e.breakpoint=i,i.classList.add("breakpoint"),e.templateDisposables.add(ee(()=>{i.classList.remove("breakpoint")})),e.icon=nu(".icon"),e.checkbox=xne(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),D(e.breakpoint,e.icon),D(e.breakpoint,e.checkbox.domNode),e.name=D(e.breakpoint,nu("span.name")),e.filePath=D(e.breakpoint,nu("span.file-path")),e.actionBar=new oo(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=D(e.breakpoint,nu(".badge-container"));return e.badge=D(t,nu("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){let o=i.element;t.context=o,i.depth>1?this.renderBreakpointLineLabel(o,t):this.renderBreakpointFileLabel(o,t),this.renderBreakpointCommon(o,t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];t.context=o,this.renderBreakpointFileLabel(o,t),this.renderBreakpointCommon(o,t)}renderBreakpointCommon(i,e){e.breakpoint.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated());let t=i.lineNumber.toString();i.column&&(t+=`:${i.column}`),i.modeLabel&&(t=`${i.modeLabel}: ${t}`),e.badge.textContent=t,e.checkbox.checked=i.enabled;let{message:o,icon:n}=t$(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(n),e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.breakpoint,i.message||o||"")),(this.debugService.state===3||this.debugService.state===2)&&!i.verified&&e.breakpoint.classList.add("disabled");let s=this.debugService.getViewModel().focusedSession;this.breakpointSupportsCondition.set(!s||!!s.capabilities.supportsConditionalBreakpoints),this.breakpointItemType.set("breakpoint"),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("source").length>1);let{primary:l}=xl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(l,{icon:!0,label:!1}),Zst.set(i.getId(),e.actionBar.domNode)}renderBreakpointFileLabel(i,e){e.name.textContent=sl(i.uri),e.filePath.textContent=this.labelService.getUriLabel(ai(i.uri),{relative:!0})}renderBreakpointLineLabel(i,e){e.name.textContent=d(10487,null),e.filePath.textContent="",this.textModelService.createModelReference(i.uri).then(t=>{if(e.context!==i){t.dispose();return}e.elementDisposables.add(t);let o=t.object.textEditorModel;if(o&&i.lineNumber<=o.getLineCount()){let n=o.getLineContent(i.lineNumber).trim();e.name.textContent=n||d(10466,null)}else e.name.textContent=d(10486,null)}).catch(()=>{e.context===i&&(e.name.textContent=d(10442,null))})}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Ine=I([m(4,Hi),m(5,ot),m(6,nt),m(7,Bt)],Ine);var k$t=class a{constructor(i,e,t,o,n,r){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.debugService=n;this.hoverService=r}static{this.ID="exceptionbreakpoints"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new O,e.templateDisposables=new O,e.templateDisposables.add(e.elementDisposables),e.breakpoint=D(i,nu(".breakpoint")),e.checkbox=xne(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),D(e.breakpoint,e.checkbox.domNode),e.name=D(e.breakpoint,nu("span.name")),e.condition=D(e.breakpoint,nu("span.condition")),e.breakpoint.classList.add("exception"),e.actionBar=new oo(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=D(e.breakpoint,nu(".badge-container"));return e.badge=D(t,nu("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){let o=i.element;this.renderExceptionBreakpoint(o,t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1];this.renderExceptionBreakpoint(o,t)}renderExceptionBreakpoint(i,e){e.context=i,e.name.textContent=i.label||`${i.filter} exceptions`;let t=i.verified?i.description||e.name.textContent:i.message||d(10503,null);e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.breakpoint,t)),e.breakpoint.classList.toggle("disabled",!i.verified),e.checkbox.checked=i.enabled,e.condition.textContent=i.condition||"",e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.condition,d(10472,null,i.condition))),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none",this.breakpointSupportsCondition.set(i.supportsCondition),this.breakpointItemType.set("exceptionBreakpoint"),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("exception").length>1);let{primary:o}=xl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(o,{icon:!0,label:!1}),Zst.set(i.getId(),e.actionBar.domNode)}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},yne=class{constructor(i,e,t,o,n,r){this.menu=i;this.breakpointSupportsCondition=e;this.breakpointItemType=t;this.debugService=o;this.hoverService=n;this.labelService=r}static{this.ID="functionbreakpoints"}get templateId(){return yne.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new O,e.templateDisposables=new O,e.templateDisposables.add(e.elementDisposables),e.breakpoint=D(i,nu(".breakpoint")),e.icon=nu(".icon"),e.checkbox=xne(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),D(e.breakpoint,e.icon),D(e.breakpoint,e.checkbox.domNode),e.name=D(e.breakpoint,nu("span.name")),e.condition=D(e.breakpoint,nu("span.condition")),e.actionBar=new oo(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=D(e.breakpoint,nu(".badge-container"));return e.badge=D(t,nu("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderFunctionBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderFunctionBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderFunctionBreakpoint(i,e){e.context=i,e.name.textContent=i.name;let{icon:t,message:o}=t$(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(t),e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.icon,o||"")),e.checkbox.checked=i.enabled,e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.breakpoint,o||"")),i.condition&&i.hitCondition?e.condition.textContent=d(10471,null,i.condition,i.hitCondition):e.condition.textContent=i.condition||i.hitCondition||"",i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none";let n=this.debugService.getViewModel().focusedSession;e.breakpoint.classList.toggle("disabled",n&&!n.capabilities.supportsFunctionBreakpoints||!this.debugService.getModel().areBreakpointsActivated()),n&&!n.capabilities.supportsFunctionBreakpoints&&e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.breakpoint,d(10480,null))),this.breakpointSupportsCondition.set(!n||!!n.capabilities.supportsConditionalBreakpoints),this.breakpointItemType.set("functionBreakpoint");let{primary:r}=xl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(r,{icon:!0,label:!1}),Zst.set(i.getId(),e.actionBar.domNode)}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};yne=I([m(3,Hi),m(4,ot),m(5,nt)],yne);var wne=class{constructor(i,e,t,o,n,r,s,l){this.menu=i;this.breakpointHasMultipleModes=e;this.breakpointSupportsCondition=t;this.breakpointItemType=o;this.breakpointIsDataBytes=n;this.debugService=r;this.hoverService=s;this.labelService=l}static{this.ID="databreakpoints"}get templateId(){return wne.ID}renderTemplate(i){let e=Object.create(null);e.breakpoint=D(i,nu(".breakpoint")),e.elementDisposables=new O,e.templateDisposables=new O,e.templateDisposables.add(e.elementDisposables),e.icon=nu(".icon"),e.checkbox=xne(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),D(e.breakpoint,e.icon),D(e.breakpoint,e.checkbox.domNode),e.name=D(e.breakpoint,nu("span.name")),e.accessType=D(e.breakpoint,nu("span.access-type")),e.condition=D(e.breakpoint,nu("span.condition")),e.actionBar=new oo(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=D(e.breakpoint,nu(".badge-container"));return e.badge=D(t,nu("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderDataBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderDataBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderDataBreakpoint(i,e){e.context=i,e.name.textContent=i.description;let{icon:t,message:o}=t$(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(t),e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.icon,o||"")),e.checkbox.checked=i.enabled,e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.breakpoint,o||"")),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none";let n=this.debugService.getViewModel().focusedSession;if(e.breakpoint.classList.toggle("disabled",n&&!n.capabilities.supportsDataBreakpoints||!this.debugService.getModel().areBreakpointsActivated()),n&&!n.capabilities.supportsDataBreakpoints&&e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.breakpoint,d(10455,null))),i.accessType){let s=i.accessType==="read"?d(10494,null):i.accessType==="write"?d(10505,null):d(10434,null);e.accessType.textContent=s}else e.accessType.textContent="";i.condition&&i.hitCondition?e.condition.textContent=d(10471,null,i.condition,i.hitCondition):e.condition.textContent=i.condition||i.hitCondition||"",this.breakpointSupportsCondition.set(!n||!!n.capabilities.supportsConditionalBreakpoints),this.breakpointHasMultipleModes.set(this.debugService.getModel().getBreakpointModes("data").length>1),this.breakpointItemType.set("dataBreakpoint"),this.breakpointIsDataBytes.set(i.src.type===1);let{primary:r}=xl(this.menu.getActions({arg:i,shouldForwardArgs:!0}),"inline");e.actionBar.clear(),e.actionBar.push(r,{icon:!0,label:!1}),Zst.set(i.getId(),e.actionBar.domNode),this.breakpointIsDataBytes.reset()}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};wne=I([m(5,Hi),m(6,ot),m(7,nt)],wne);var Cne=class{constructor(i,e,t){this.debugService=i;this.hoverService=e;this.labelService=t}static{this.ID="instructionBreakpoints"}get templateId(){return Cne.ID}renderTemplate(i){let e=Object.create(null);e.elementDisposables=new O,e.templateDisposables=new O,e.templateDisposables.add(e.elementDisposables),e.breakpoint=D(i,nu(".breakpoint")),e.icon=nu(".icon"),e.checkbox=xne(e.templateDisposables),e.templateDisposables.add(e.checkbox.onChange(()=>{this.debugService.enableOrDisableBreakpoints(!e.context.enabled,e.context)})),D(e.breakpoint,e.icon),D(e.breakpoint,e.checkbox.domNode),e.name=D(e.breakpoint,nu("span.name")),e.address=D(e.breakpoint,nu("span.file-path")),e.actionBar=new oo(e.breakpoint),e.templateDisposables.add(e.actionBar);let t=D(e.breakpoint,nu(".badge-container"));return e.badge=D(t,nu("span.line-number.monaco-count-badge")),e}renderElement(i,e,t){this.renderInstructionBreakpoint(i.element,t)}renderCompressedElements(i,e,t){this.renderInstructionBreakpoint(i.element.elements[i.element.elements.length-1],t)}renderInstructionBreakpoint(i,e){e.context=i,e.breakpoint.classList.toggle("disabled",!this.debugService.getModel().areBreakpointsActivated()),e.name.textContent="0x"+i.address.toString(16),e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.name,d(10457,null,i.address.toString()))),e.checkbox.checked=i.enabled;let{message:t,icon:o}=t$(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel());e.icon.className=q.asClassName(o),e.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),e.breakpoint,i.message||t||"")),(this.debugService.state===3||this.debugService.state===2)&&!i.verified&&e.breakpoint.classList.add("disabled"),i.modeLabel?(e.badge.textContent=i.modeLabel,e.badge.style.display="block"):e.badge.style.display="none"}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}};Cne=I([m(0,Hi),m(1,ot),m(2,nt)],Cne);var E$t=class a{constructor(i,e,t,o,n){this.view=i;this.debugService=e;this.contextViewService=t;this.hoverService=o;this.labelService=n}static{this.ID="functionbreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null),t=new O,o=D(i,nu(".breakpoint"));e.icon=nu(".icon"),e.checkbox=xne(t),D(o,e.icon),D(o,e.checkbox.domNode),this.view.breakpointInputFocused.set(!0);let n=D(o,nu(".inputBoxContainer")),r=new ad(n,this.contextViewService,{inputBoxStyles:Wl});t.add(r);let s=l=>{e.updating=!0;try{this.view.breakpointInputFocused.set(!1);let c=e.breakpoint.getId();l?(e.type==="name"&&this.debugService.updateFunctionBreakpoint(c,{name:r.value}),e.type==="condition"&&this.debugService.updateFunctionBreakpoint(c,{condition:r.value}),e.type==="hitCount"&&this.debugService.updateFunctionBreakpoint(c,{hitCondition:r.value})):e.type==="name"&&!e.breakpoint.name?this.debugService.removeFunctionBreakpoints(c):this.view.renderInputBox(void 0)}finally{e.updating=!1}};return t.add(Yo(r.inputElement,"keydown",l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),s(u))})),t.add($(r.inputElement,"blur",()=>{e.updating||s(!!r.value)})),e.inputBox=r,e.elementDisposables=new O,e.templateDisposables=t,e.templateDisposables.add(e.elementDisposables),e}renderElement(i,e,t){let o=i.element;t.breakpoint=o,t.type=this.view.inputBoxData?.type||"name";let{icon:n,message:r}=t$(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),o,this.labelService,this.debugService.getModel());t.icon.className=q.asClassName(n),t.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.icon,r||"")),t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value=o.name||"";let s=d(10479,null),l=d(10478,null);t.type==="condition"?(t.inputBox.value=o.condition||"",s=d(10475,null),l=d(10474,null)):t.type==="hitCount"&&(t.inputBox.value=o.hitCondition||"",s=d(10477,null),l=d(10476,null)),t.inputBox.setAriaLabel(l),t.inputBox.setPlaceHolder(s),setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},T$t=class a{constructor(i,e,t,o,n){this.view=i;this.debugService=e;this.contextViewService=t;this.hoverService=o;this.labelService=n}static{this.ID="databreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=Object.create(null),t=new O,o=D(i,nu(".breakpoint"));e.icon=nu(".icon"),e.checkbox=xne(t),D(o,e.icon),D(o,e.checkbox.domNode),this.view.breakpointInputFocused.set(!0);let n=D(o,nu(".inputBoxContainer")),r=new ad(n,this.contextViewService,{inputBoxStyles:Wl});t.add(r);let s=l=>{e.updating=!0;try{this.view.breakpointInputFocused.set(!1);let c=e.breakpoint.getId();l?(e.type==="condition"&&this.debugService.updateDataBreakpoint(c,{condition:r.value}),e.type==="hitCount"&&this.debugService.updateDataBreakpoint(c,{hitCondition:r.value})):this.view.renderInputBox(void 0)}finally{e.updating=!1}};return t.add(Yo(r.inputElement,"keydown",l=>{let c=l.equals(9),u=l.equals(3);(c||u)&&(l.preventDefault(),l.stopPropagation(),s(u))})),t.add($(r.inputElement,"blur",()=>{e.updating||s(!!r.value)})),e.inputBox=r,e.elementDisposables=new O,e.templateDisposables=t,e.templateDisposables.add(e.elementDisposables),e}renderElement(i,e,t){let o=i.element;t.breakpoint=o,t.type=this.view.inputBoxData?.type||"condition";let{icon:n,message:r}=t$(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),o,this.labelService,this.debugService.getModel());t.icon.className=q.asClassName(n),t.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.icon,r??"")),t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value="";let s="",l="";t.type==="condition"?(t.inputBox.value=o.condition||"",s=d(10450,null),l=d(10449,null)):t.type==="hitCount"&&(t.inputBox.value=o.hitCondition||"",s=d(10452,null),l=d(10451,null)),t.inputBox.setAriaLabel(l),t.inputBox.setPlaceHolder(s),setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},_$t=class a{constructor(i,e,t){this.view=i;this.debugService=e;this.contextViewService=t}static{this.ID="exceptionbreakpointinput"}get templateId(){return a.ID}renderTemplate(i){let e=new O,t=D(i,nu(".breakpoint"));t.classList.add("exception");let o=xne(e);D(t,o.domNode),this.view.breakpointInputFocused.set(!0);let n=D(t,nu(".inputBoxContainer")),r=new ad(n,this.contextViewService,{ariaLabel:d(10468,null),inputBoxStyles:Wl});e.add(r);let s=u=>{if(!c.currentBreakpoint)return;this.view.breakpointInputFocused.set(!1);let p=c.currentBreakpoint.condition;u&&(p=r.value!==""?r.value:void 0),this.debugService.setExceptionBreakpointCondition(c.currentBreakpoint,p)};e.add(Yo(r.inputElement,"keydown",u=>{let p=u.equals(9),h=u.equals(3);(p||h)&&(u.preventDefault(),u.stopPropagation(),s(h))})),e.add($(r.inputElement,"blur",()=>{setTimeout(()=>{s(!0)})}));let l=new O;e.add(l);let c={inputBox:r,checkbox:o,templateDisposables:e,elementDisposables:new O};return c}renderElement(i,e,t){let o=i.element,n=o.conditionDescription||d(10469,null);t.inputBox.setPlaceHolder(n),t.currentBreakpoint=o,t.checkbox.checked=o.enabled,t.checkbox.disable(),t.inputBox.value=o.condition||"",setTimeout(()=>{t.inputBox.focus(),t.inputBox.select()},0)}renderCompressedElements(i,e,t){}disposeElement(i,e,t){t.elementDisposables.clear()}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposables.dispose()}},RNi=class{constructor(i,e){this.debugService=i;this.labelService=e}getWidgetAriaLabel(){return d(10440,null)}getRole(){return"checkbox"}isChecked(i){return i instanceof yV,i.enabled}getAriaLabel(i){if(i instanceof yV)return d(10439,null,sl(i.uri),i.breakpoints.length);if(i instanceof pN)return i.toString();let{message:e}=t$(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),i,this.labelService,this.debugService.getModel()),t=i.toString();return e?`${t}, ${e}`:t}};function KWe(a,i,e,t,o,n){if(a.uri.scheme===Ox&&o.state===0)return Promise.resolve(void 0);let r=a.endLineNumber?{startLineNumber:a.lineNumber,endLineNumber:a.endLineNumber,startColumn:a.column||1,endColumn:a.endColumn||1073741824}:{startLineNumber:a.lineNumber,startColumn:a.column||1,endLineNumber:a.lineNumber,endColumn:a.column||1073741824};return n.openEditor({resource:a.uri,options:{preserveFocus:e,selection:r,revealIfOpened:!0,selectionRevealType:1,pinned:t}},i?En:tr)}function t$(a,i,e,t,o){let n=a===3||a===2,r=e instanceof rw?FLi:e instanceof QI?NLi:e.logMessage?XKt:eV;if(!e.enabled||!i)return{icon:r.disabled,message:e.logMessage?d(10460,null):d(10459,null)};let s=u=>e.message?u.concat(", "+e.message):u;if(n&&e instanceof pb&&e.pending)return{icon:eV.pending};if(n&&!e.verified)return{icon:r.unverified,message:e.message?e.message:e.logMessage?d(10504,null):d(10502,null),showAdapterUnverifiedMessage:!0};if(e instanceof rw)return e.supported?{icon:r.regular,message:e.message||d(10443,null)}:{icon:r.unverified,message:d(10456,null)};if(e instanceof QI){if(!e.supported)return{icon:r.unverified,message:d(10481,null)};let u=[];return u.push(e.message||d(10473,null)),e.condition&&u.push(d(10470,null,e.condition)),e.hitCondition&&u.push(d(10482,null,e.hitCondition)),{icon:r.regular,message:s(u.join(`
`))}}if(e instanceof YI){if(!e.supported)return{icon:r.unverified,message:d(10485,null)};let u=[];return e.message?u.push(e.message):e.instructionReference?u.push(d(10484,null,e.instructionReference)):u.push(d(10483,null)),e.hitCondition&&u.push(d(10482,null,e.hitCondition)),{icon:r.regular,message:s(u.join(`
`))}}let l;if(e instanceof pb&&e.triggeredBy&&(l=o.getBreakpoints().find(u=>u.getId()===e.triggeredBy)),e.logMessage||e.condition||e.hitCondition||l){let u=[],p=e.logMessage?XKt.regular:OLi.regular;return e.supported||(p=JKt,u.push(d(10441,null))),e.logMessage&&u.push(d(10488,null,e.logMessage)),e.condition&&u.push(d(10470,null,e.condition)),e.hitCondition&&u.push(d(10482,null,e.hitCondition)),l&&u.push(d(10501,null,`${t.getUriLabel(l.uri,{relative:!0})}: ${l.lineNumber}`)),{icon:p,message:s(u.join(`
`))}}let c=e.message?e.message:e instanceof pb&&t?t.getUriLabel(e.uri):d(10438,null);return{icon:r.regular,message:c}}W(class extends z{constructor(){super({id:"workbench.debug.viewlet.action.addFunctionBreakpointAction",title:{...P(10437,"Add Function Breakpoint"),mnemonicTitle:d(10492,null)},f1:!0,icon:dyo,menu:[{id:R.ViewTitle,group:"navigation",order:10,when:C.equals("view",bE)},{id:R.MenubarNewBreakpointMenu,group:"1_breakpoints",order:3,when:qa}]})}async run(a){let i=a.get(Hi);await a.get(Gt).openView(bE),i.addFunctionBreakpoint()}});var D$t=class extends z{async run(i,e){let t=i.get(Hi),o=t.getViewModel().focusedSession;if(!o)return;let n;e&&e.src.type===1&&(n=`${e.src.address} + ${e.src.bytes}`);let r=i.get($e),s=i.get(Ne),l=await this.getRange(r,n);if(!l)return;let c;try{c=await o.dataBytesBreakpointInfo(l.address,l.bytes)}catch(h){s.error(d(10448,null,l.address,h.message))}if(!c?.dataId)return;let u="write";if(c.accessTypes&&c.accessTypes?.length>1){let h=c.accessTypes.map(f=>({label:f})),g=await r.pick(h,{placeHolder:d(10444,null)});if(!g)return;u=g.label}let p={type:1,...l};e&&await t.removeDataBreakpoints(e.getId()),await t.addDataBreakpoint({description:c.description,src:p,canPersist:!0,accessTypes:c.accessTypes,accessType:u,initialSessionData:{session:o,dataId:c.dataId}})}getRange(i,e){return new Promise(t=>{let o=new O,n=o.add(i.createInputBox());n.prompt=d(10454,null),n.placeholder=d(10453,null),e&&(n.value=e,n.valueSelection=[0,e.length]),o.add(n.onDidChangeValue(r=>{let s=this.parseAddress(r,!1);n.validationMessage=s?.error})),o.add(n.onDidAccept(()=>{let r=this.parseAddress(n.value,!0);yo(r,{error:!0})?n.validationMessage=r.error:t(r),n.dispose()})),o.add(n.onDidHide(()=>{t(void 0),o.dispose()})),n.ignoreFocusOut=!0,n.show()})}parseAddress(i,e){let t=/^(\S+)\s*(?:([+-])\s*(\S+))?/.exec(i);if(!t)return{error:d(10445,null)};let o=p=>e?/^0x[0-9a-f]*|[0-9]*$/i.test(p):/^0x[0-9a-f]+|[0-9]+$/i.test(p),[,n,r="+",s="1"]=t;for(let p of[n,s])if(!o(p))return{error:d(10447,null,p)};if(!e)return;let l=BigInt(n),c=BigInt(s),u=`0x${l.toString(16)}`;return r==="-"?l>c?{error:d(10446,null,n,s)}:{address:u,bytes:Number(c-l)}:{address:u,bytes:Number(c)}}};W(class extends D$t{constructor(){super({id:"workbench.debug.viewlet.action.addDataBreakpointOnAddress",title:{...P(10436,"Add Data Breakpoint at Address"),mnemonicTitle:d(10489,null)},f1:!0,icon:uyo,menu:[{id:R.ViewTitle,group:"navigation",order:11,when:C.and(DDe,C.equals("view",bE))},{id:R.MenubarNewBreakpointMenu,group:"1_breakpoints",order:4,when:DDe}]})}});W(class extends D$t{constructor(){super({id:"workbench.debug.viewlet.action.editDataBreakpointOnAddress",title:P(10463,"Edit Address..."),menu:[{id:R.DebugBreakpointsContext,when:C.and(DDe,nIi),group:"navigation",order:15}]})}});W(class extends z{constructor(){super({id:"workbench.debug.viewlet.action.toggleBreakpointsActivatedAction",title:P(10435,"Toggle Activate Breakpoints"),f1:!0,icon:myo,menu:{id:R.ViewTitle,group:"navigation",order:20,when:C.equals("view",bE)}})}run(a){let i=a.get(Hi);i.setBreakpointsActivated(!i.getModel().areBreakpointsActivated())}});W(class extends z{constructor(){super({id:"workbench.debug.viewlet.action.removeBreakpoint",title:d(10497,null),icon:L.removeClose,menu:[{id:R.DebugBreakpointsContext,group:"3_modification",order:10,when:lR.notEqualsTo("exceptionBreakpoint")},{id:R.DebugBreakpointsContext,group:"inline",order:20,when:lR.notEqualsTo("exceptionBreakpoint")}]})}async run(a,i){let e=a.get(Hi);i instanceof pb?await e.removeBreakpoints(i.getId()):i instanceof QI?await e.removeFunctionBreakpoints(i.getId()):i instanceof rw?await e.removeDataBreakpoints(i.getId()):i instanceof YI&&await e.removeInstructionBreakpoints(i.instructionReference,i.offset)}});W(class extends z{constructor(){super({id:"workbench.debug.viewlet.action.removeAllBreakpoints",title:{...P(10496,"Remove All Breakpoints"),mnemonicTitle:d(10493,null)},f1:!0,icon:pyo,menu:[{id:R.ViewTitle,group:"navigation",order:30,when:C.equals("view",bE)},{id:R.DebugBreakpointsContext,group:"3_modification",order:20,when:C.and(F3,lR.notEqualsTo("exceptionBreakpoint"))},{id:R.MenubarDebugMenu,group:"5_breakpoints",order:3,when:qa}]})}run(a){let i=a.get(Hi);i.removeBreakpoints(),i.removeFunctionBreakpoints(),i.removeDataBreakpoints(),i.removeInstructionBreakpoints()}});W(class extends z{constructor(){super({id:"workbench.debug.viewlet.action.enableAllBreakpoints",title:{...P(10467,"Enable All Breakpoints"),mnemonicTitle:d(10491,null)},f1:!0,precondition:qa,menu:[{id:R.DebugBreakpointsContext,group:"z_commands",order:10,when:C.and(F3,lR.notEqualsTo("exceptionBreakpoint"))},{id:R.MenubarDebugMenu,group:"5_breakpoints",order:1,when:qa}]})}async run(a){await a.get(Hi).enableOrDisableBreakpoints(!0)}});W(class extends z{constructor(){super({id:"workbench.debug.viewlet.action.disableAllBreakpoints",title:{...P(10458,"Disable All Breakpoints"),mnemonicTitle:d(10490,null)},f1:!0,precondition:qa,menu:[{id:R.DebugBreakpointsContext,group:"z_commands",order:20,when:C.and(F3,lR.notEqualsTo("exceptionBreakpoint"))},{id:R.MenubarDebugMenu,group:"5_breakpoints",order:2,when:qa}]})}async run(a){await a.get(Hi).enableOrDisableBreakpoints(!1)}});W(class extends z{constructor(){super({id:"workbench.debug.viewlet.action.reapplyBreakpointsAction",title:P(10495,"Reapply All Breakpoints"),f1:!0,precondition:vl,menu:[{id:R.DebugBreakpointsContext,group:"z_commands",order:30,when:C.and(F3,lR.notEqualsTo("exceptionBreakpoint"))}]})}async run(a){await a.get(Hi).setBreakpointsActivated(!0)}});W(class extends z{constructor(){super({id:"workbench.debug.viewlet.action.toggleBreakpointsPresentation",title:P(10500,"Toggle Breakpoints View Presentation"),f1:!0,icon:YKt,menu:{id:R.ViewTitle,group:"navigation",order:10,when:C.equals("view",bE)}})}async run(a){let i=a.get(B),t=i.getValue("debug.breakpointsView.presentation")==="tree"?"list":"tree";await i.updateValue("debug.breakpointsView.presentation",t)}});W(class extends rr{constructor(){super({id:"debug.editBreakpoint",viewId:bE,title:d(10462,null),icon:L.edit,precondition:EAt,menu:[{id:R.DebugBreakpointsContext,when:lR.notEqualsTo("functionBreakpoint"),group:"navigation",order:10},{id:R.DebugBreakpointsContext,group:"inline",order:10}]})}async runInView(a,i,e){let t=a.get(Hi),o=a.get(ie);if(e instanceof pb){let n=await KWe(e,!1,!1,!0,t,o);if(n){let r=n.getControl();fn(r)&&r.getContribution(cN)?.showBreakpointWidget(e.lineNumber,e.column)}}else if(e instanceof QI){let n=a.get(Xe),r=[new it("breakpoint.editCondition",d(10462,null),void 0,!0,async()=>i.renderInputBox({breakpoint:e,type:"condition"})),new it("breakpoint.editCondition",d(10464,null),void 0,!0,async()=>i.renderInputBox({breakpoint:e,type:"hitCount"}))],s=Zst.get(e.getId());s&&n.showContextMenu({getActions:()=>r,getAnchor:()=>s,onHide:()=>je(r)})}else i.renderInputBox({breakpoint:e,type:"condition"})}});W(class extends rr{constructor(){super({id:"debug.editFunctionBreakpoint",viewId:bE,title:d(10461,null),menu:[{id:R.DebugBreakpointsContext,group:"navigation",order:10,when:lR.isEqualTo("functionBreakpoint")}]})}runInView(a,i,e){i.renderInputBox({breakpoint:e,type:"name"})}});W(class extends rr{constructor(){super({id:"debug.editFunctionBreakpointHitCount",viewId:bE,title:d(10464,null),precondition:EAt,menu:[{id:R.DebugBreakpointsContext,group:"navigation",order:20,when:C.or(lR.isEqualTo("functionBreakpoint"),lR.isEqualTo("dataBreakpoint"))}]})}runInView(a,i,e){i.renderInputBox({breakpoint:e,type:"hitCount"})}});W(class extends rr{constructor(){super({id:"debug.editBreakpointMode",viewId:bE,title:d(10465,null),menu:[{id:R.DebugBreakpointsContext,group:"navigation",order:20,when:C.and(rIi,C.or(lR.isEqualTo("breakpoint"),lR.isEqualTo("exceptionBreakpoint"),lR.isEqualTo("instructionBreakpoint")))}]})}async runInView(a,i,e){let t=a.get(Hi),o=qEo(e),n=t.getModel().getBreakpointModes(o),r=await a.get($e).pick(n.map(s=>({label:s.label,description:s.description,mode:s.mode})),{placeHolder:d(10499,null)});if(r)if(o==="source"){let s=new Map;s.set(e.getId(),{mode:r.mode,modeLabel:r.label}),t.updateBreakpoints(e.originalUri,s,!1)}else e instanceof YI?(t.removeInstructionBreakpoints(e.instructionReference,e.offset),t.addInstructionBreakpoint({...e.toJSON(),mode:r.mode,modeLabel:r.label})):e instanceof pN&&(e.mode=r.mode,e.modeLabel=r.label,t.setExceptionBreakpointCondition(e,e.condition))}});async function jEo(a,i){let e=a.get($e),t=a.get(Hi),o=a.get(Gt),n=a.get(fe),r=new O,s=e.createQuickPick({useSeparators:!0});r.add(s),s.matchOnLabel=s.matchOnDescription=s.matchOnDetail=s.sortByLabel=!1,s.placeholder=d(10858,null);let l=$Eo(s.value,i,t,o,n);s.items=l.picks,s.activeItems=l.activeItems,r.add(s.onDidChangeValue(async()=>{s.items=$Eo(s.value,i,t,o,n).picks})),r.add(s.onDidAccept(()=>{s.selectedItems[0].accept(),s.hide(),r.dispose()})),s.show()}function $Eo(a,i,e,t,o){let n=[],r=[],s=e.getViewModel().focusedSession,l=e.getModel().getSessions(!1),c=[];l.forEach(p=>{p.compact&&p.parentSession&&r.push(p.parentSession)}),l.forEach(p=>{let h=r.includes(p);if(p.parentSession||n.push({type:"separator",label:h?p.name:void 0}),!h){let g=Qpn(p,a,e,t,o);g&&(n.push(g),p.getId()===s?.getId()&&c.push(g))}}),n.length&&n.push({type:"separator"});let u=d(10860,null);return n.push({label:`$(plus) ${u}`,ariaLabel:u,accept:()=>o.executeCommand(i)}),{picks:n,activeItems:c}}function jpn(a){let i=a.configuration.name.length?a.configuration.name:a.name,e=a.compact?void 0:a.parentSession?.configuration.name,t="",o="";return e&&(o=d(10859,null,i,e),t=e),{label:i,description:t,ariaLabel:o}}function Qpn(a,i,e,t,o){let n=jpn(a),r=xh(i,n.label,!0);if(r)return{label:n.label,description:n.description,ariaLabel:n.ariaLabel,highlights:{label:r},accept:()=>{e.focusStackFrame(void 0,void 0,a,{explicit:!0}),t.isViewVisible($d)||t.openView($d,!0)}}}var Rve="debug.addConfiguration",R$t="editor.debug.action.copyAddress",L$t="editor.debug.action.toggleBreakpoint",eat="editor.debug.action.toggleInlineBreakpoint",MNi="debug.copyStackTrace",PNi="workbench.action.debug.reverseContinue",ANi="workbench.action.debug.stepBack",i$="workbench.action.debug.restart",M$t="workbench.action.debug.terminateThread",o$="workbench.action.debug.stepOver",n$="workbench.action.debug.stepInto",NNi="workbench.action.debug.stepIntoTarget",r$="workbench.action.debug.stepOut",D6="workbench.action.debug.pause",MP="workbench.action.debug.disconnect",GWe="workbench.action.debug.disconnectAndSuspend",V_="workbench.action.debug.stop",ONi="workbench.action.debug.restartFrame",s$="workbench.action.debug.continue",QEo="workbench.debug.action.focusRepl",tat="debug.jumpToCursor",qWe="workbench.action.debug.focusProcess",R6="workbench.action.debug.selectandstart",P$t="workbench.action.debug.selectDebugConsole",FNi="workbench.action.debug.selectDebugSession",a$="workbench.action.debug.configure",CV="workbench.action.debug.start",iat="workbench.action.debug.run",WNi="debug.renameWatchExpression",YEo="debug.copyWatchExpression",VNi="debug.setWatchExpression",BNi="debug.removeWatchExpression",HNi="workbench.action.debug.nextConsole",UNi="workbench.action.debug.prevConsole",zNi="workbench.action.debug.showLoadedScripts",KNi="workbench.action.debug.callStackTop",GNi="workbench.action.debug.callStackBottom",qNi="workbench.action.debug.callStackUp",$Ni="workbench.action.debug.callStackDown",oat="debug.addToWatchExpressions",kne="debug.copyEvaluatePath",L6="workbench.debug.viewlet.action.copyValue",nat="debug.breakWhenValueChanges",rat="debug.breakWhenValueIsAccessed",sat="debug.breakWhenValueIsRead",Ypn="debug.toggleExceptionBreakpoints",Xpn="debug.attachToCurrentCodeRenderer",Ene=P(10703,"Debug"),Tne=P(10715,"Restart"),_ne=P(10725,"Step Over"),Dne=P(10722,"Step Into"),XEo=P(10723,"Step Into Target"),Rne=P(10724,"Step Out"),Lne=P(10713,"Pause"),M6=P(10704,"Disconnect"),aat=P(10705,"Disconnect and Suspend"),l$=P(10726,"Stop"),Mne=P(10699,"Continue"),JEo=P(10707,"Focus Session"),ZEo=P(10716,"Select and Start Debugging"),$We=d(10711,null,"launch.json"),lat=P(10720,"Start Debugging"),jNi=P(10721,"Start Without Debugging"),eTo=P(10709,"Focus Next Debug Console"),tTo=P(10714,"Focus Previous Debug Console"),iTo=P(10712,"Open Loaded Script..."),oTo=P(10696,"Navigate to Top of Call Stack"),nTo=P(10694,"Navigate to Bottom of Call Stack"),rTo=P(10697,"Navigate Up Call Stack"),sTo=P(10695,"Navigate Down Call Stack"),jWe=P(10701,"Copy as Expression"),cat=P(10702,"Copy Value"),A$t=P(10700,"Copy Address"),dat=P(10692,"Add to Watch"),aTo=P(10717,"Select Debug Console"),lTo=P(10718,"Select Debug Session"),uat="debug ",pat="debug consoles ",W_;function N$t(a){W_=a}function Jpn(a){return a&&typeof a.sessionId=="string"&&typeof a.threadId=="string"}async function wV(a,i,e){let t=a.get(Hi),o;if(Jpn(i)){let n=t.getModel().getSession(i.sessionId);n&&(o=n.getAllThreads().find(r=>r.getId()===i.threadId))}else if(QNi(i)){let n=t.getModel().getSession(i.sessionId);if(n){let r=n.getAllThreads();o=r.length>0?r[0]:void 0}}if(!o&&(o=t.getViewModel().focusedThread,!o)){let n=t.getViewModel().focusedSession,r=n?n.getAllThreads():void 0;o=r&&r.length?r[0]:void 0}o&&await e(o)}function Zpn(a){return a&&typeof a.sessionId=="string"&&typeof a.threadId=="string"&&typeof a.frameId=="string"}function cTo(a,i){if(Zpn(i)){let e=a.getModel().getSession(i.sessionId);if(e){let t=e.getAllThreads().find(o=>o.getId()===i.threadId);if(t)return t.getCallStack().find(o=>o.getId()===i.frameId)}}else return a.getViewModel().focusedStackFrame}function QNi(a){return a&&typeof a.sessionId=="string"}async function dTo(a,i){let e=a.get(Hi),t=a.get(Gt),o=e.getModel().getSessions(!0).filter(s=>s.hasSeparateRepl()),n=e.getViewModel().focusedSession,r=0;if(o.length>0&&n){for(;n&&!n.hasSeparateRepl();)n=n.parentSession;if(n){let s=o.indexOf(n);i?r=s===o.length-1?0:s+1:r=s===0?o.length-1:s-1}}await e.focusStackFrame(void 0,void 0,o[r],{explicit:!0}),t.isViewVisible($d)||await t.openView($d,!0)}async function uTo(a,i){let e=a.getViewModel().focusedStackFrame;if(e){let t=e.thread.getCallStack(),o=t.findIndex(r=>r.frameId===e.frameId),n;if(i){if(o>=t.length-1)if(e.thread.reachedEndOfCallStack){mTo(a);return}else await a.getModel().fetchCallstack(e.thread,20),t=e.thread.getCallStack(),o=t.findIndex(r=>r.frameId===e.frameId);n=LNi(!0,t,o)}else{if(o<=0){pTo(a);return}n=LNi(!1,t,o)}n&&a.focusStackFrame(n,void 0,void 0,{preserveFocus:!1})}}async function pTo(a){let i=a.getViewModel().focusedThread;if(i){await a.getModel().fetchCallstack(i);let e=i.getCallStack();if(e.length>0){let t=LNi(!1,e,0);t&&a.focusStackFrame(t,void 0,void 0,{preserveFocus:!1})}}}function mTo(a){let i=a.getViewModel().focusedThread;i&&a.focusStackFrame(i.getTopStackFrame(),void 0,void 0,{preserveFocus:!1})}function LNi(a,i,e){e>=i.length?e=i.length-1:e<0&&(e=0);let t=e,o;do if(a?t===i.length-1?t=0:t++:t===0?t=i.length-1:t--,o=i[t],!X2(o))return o;while(t!==e)}Ge.registerCommand({id:MNi,handler:async(a,i,e)=>{let t=a.get(BL),o=a.get(Bi),n=a.get(Hi),r=cTo(n,e);if(r){let s=t.getEOL(r.source.uri);await o.writeText(r.thread.getCallStack().map(l=>l.toString()).join(s))}}});Ge.registerCommand({id:PNi,handler:async(a,i,e)=>{await wV(a,e,t=>t.reverseContinue())}});Ge.registerCommand({id:ANi,handler:async(a,i,e)=>{let t=a.get(X);Y2.getValue(t)?await wV(a,e,o=>o.stepBack("instruction")):await wV(a,e,o=>o.stepBack())}});Ge.registerCommand({id:M$t,handler:async(a,i,e)=>{await wV(a,e,t=>t.terminate())}});Ge.registerCommand({id:tat,handler:async a=>{let e=a.get(Hi).getViewModel().focusedStackFrame,o=a.get(ie).activeTextEditorControl,n=a.get(Ne),r=a.get($e);if(e&&fn(o)&&o.hasModel()){let s=o.getPosition(),l=o.getModel().uri,c=e.thread.session.getSourceForUri(l);if(c){let p=(await e.thread.session.gotoTargets(c.raw,s.lineNumber,s.column))?.body.targets;if(p&&p.length){let h=p[0].id;if(p.length>1){let g=p.map(v=>({label:v.label,_id:v.id})),f=await r.pick(g,{placeHolder:d(10698,null)});if(!f)return;h=f._id}return await e.thread.session.goto(e.thread.threadId,h).catch(g=>n.warn(g))}}}return n.warn(d(10710,null))}});Ge.registerCommand({id:KNi,handler:async(a,i,e)=>{let t=a.get(Hi);mTo(t)}});Ge.registerCommand({id:GNi,handler:async(a,i,e)=>{let t=a.get(Hi);await pTo(t)}});Ge.registerCommand({id:qNi,handler:async(a,i,e)=>{let t=a.get(Hi);uTo(t,!1)}});Ge.registerCommand({id:$Ni,handler:async(a,i,e)=>{let t=a.get(Hi);uTo(t,!0)}});be.appendMenuItem(R.EditorContext,{command:{id:tat,title:d(10708,null),category:Ene},when:C.and(Gpe,me.editorTextFocus),group:"debug",order:3});xt.registerCommandAndKeybindingRule({id:HNi,weight:201,when:j0,primary:2060,mac:{primary:3166},handler:async(a,i,e)=>{dTo(a,!0)}});xt.registerCommandAndKeybindingRule({id:UNi,weight:201,when:j0,primary:2059,mac:{primary:3164},handler:async(a,i,e)=>{dTo(a,!1)}});xt.registerCommandAndKeybindingRule({id:i$,weight:200,primary:3135,when:vl,handler:async(a,i,e)=>{let t=a.get(Hi),o=a.get(B),n;if(QNi(e)?n=t.getModel().getSession(e.sessionId):n=t.getViewModel().focusedSession,n){let r=o.getValue("debug").showSubSessionsInToolBar;for(;!r&&n.lifecycleManagedByParent&&n.parentSession;)n=n.parentSession;n.removeReplExpressions(),await t.restartSession(n)}else{let{launch:r,name:s}=t.getConfigurationManager().selectedConfiguration;await t.startDebugging(r,s,{noDebug:!1,startedByUser:!0})}}});xt.registerCommandAndKeybindingRule({id:o$,weight:200,primary:68,when:ca.isEqualTo("stopped"),handler:async(a,i,e)=>{let t=a.get(X);Y2.getValue(t)?await wV(a,e,o=>o.next("instruction")):await wV(a,e,o=>o.next())}});var hTo=Ft&&ii?581:69;xt.registerCommandAndKeybindingRule({id:n$,weight:210,primary:hTo,when:ca.notEqualsTo("inactive"),handler:async(a,i,e)=>{let t=a.get(X);Y2.getValue(t)?await wV(a,e,o=>o.stepIn("instruction")):await wV(a,e,o=>o.stepIn())}});xt.registerCommandAndKeybindingRule({id:r$,weight:200,primary:1093,when:ca.isEqualTo("stopped"),handler:async(a,i,e)=>{let t=a.get(X);Y2.getValue(t)?await wV(a,e,o=>o.stepOut("instruction")):await wV(a,e,o=>o.stepOut())}});xt.registerCommandAndKeybindingRule({id:D6,weight:202,primary:64,when:ca.isEqualTo("running"),handler:async(a,i,e)=>{await wV(a,e,t=>t.pause())}});xt.registerCommandAndKeybindingRule({id:NNi,primary:hTo|2048,when:C.and(GZ,vl,ca.isEqualTo("stopped")),weight:200,handler:async(a,i,e)=>{let t=a.get($e),o=a.get(Hi),n=o.getViewModel().focusedSession,r=o.getViewModel().focusedStackFrame;if(!r||!n)return;let s=await a.get(ie).openEditor({resource:r.source.uri,options:{revealIfOpened:!0}}),l;if(s){let p=s?.getControl();fn(p)&&(l=p)}let c=new O,u=c.add(t.createQuickPick());u.busy=!0,u.show(),c.add(u.onDidChangeActive(([p])=>{l&&p&&p.target.line!==void 0&&(l.revealLineInCenterIfOutsideViewport(p.target.line),l.setSelection({startLineNumber:p.target.line,startColumn:p.target.column||1,endLineNumber:p.target.endLine||p.target.line,endColumn:p.target.endColumn||p.target.column||1}))})),c.add(u.onDidAccept(()=>{u.activeItems.length&&n.stepIn(r.thread.threadId,u.activeItems[0].target.id)})),c.add(u.onDidHide(()=>c.dispose())),n.stepInTargets(r.frameId).then(p=>{u.busy=!1,p?.length?u.items=p?.map(h=>({target:h,label:h.label})):u.placeholder=d(10706,null)})}});async function YNi(a,i,e,t,o){let n=a.get(Hi),r;QNi(e)?r=n.getModel().getSession(e.sessionId):r=n.getViewModel().focusedSession;let l=a.get(B).getValue("debug").showSubSessionsInToolBar;for(;!l&&r&&r.lifecycleManagedByParent&&r.parentSession;)r=r.parentSession;await n.stopSession(r,t,o)}xt.registerCommandAndKeybindingRule({id:MP,weight:200,primary:1087,when:C.and(Nx,vl),handler:(a,i,e)=>YNi(a,i,e,!0)});Ge.registerCommand({id:GWe,handler:(a,i,e)=>YNi(a,i,e,!0,!0)});xt.registerCommandAndKeybindingRule({id:V_,weight:200,primary:1087,when:C.and(Nx.toNegated(),vl),handler:(a,i,e)=>YNi(a,i,e,!1)});Ge.registerCommand({id:ONi,handler:async(a,i,e)=>{let t=a.get(Hi),o=a.get(Ne),n=cTo(t,e);if(n)try{await n.restart()}catch(r){o.error(r)}}});xt.registerCommandAndKeybindingRule({id:s$,weight:210,primary:63,when:ca.isEqualTo("stopped"),handler:async(a,i,e)=>{await wV(a,e,t=>t.continue())}});Ge.registerCommand({id:zNi,handler:async a=>{await GEo(a)}});Ge.registerCommand({id:"debug.startFromConfig",handler:async(a,i)=>{await a.get(Hi).startDebugging(void 0,i)}});Ge.registerCommand({id:qWe,handler:async(a,i)=>{let e=a.get(Hi),t=a.get(ie);i=VAt(i,e.getModel().getSessions()),await e.focusStackFrame(void 0,void 0,i,{explicit:!0});let o=e.getViewModel().focusedStackFrame;o&&await o.openInEditor(t,!0)}});Ge.registerCommand({id:R6,handler:async(a,i,e)=>{let t=a.get($e),o=a.get(Hi);if(i){let n=o.getConfigurationManager(),r=await n.getDynamicProviders();for(let s of r)if(s.type===i){let l=await s.pick();if(l){await n.selectConfiguration(l.launch,l.config.name,l.config,{type:s.type}),o.startDebugging(l.launch,l.config,{noDebug:e?.noDebug,startedByUser:!0});return}}}t.quickAccess.show(uat)}});Ge.registerCommand({id:P$t,handler:async a=>{a.get($e).quickAccess.show(pat)}});Ge.registerCommand({id:FNi,handler:async a=>{jEo(a,R6)}});xt.registerCommandAndKeybindingRule({id:CV,weight:200,primary:63,when:C.and(qa,ca.isEqualTo("inactive")),handler:async(a,i)=>{let e=a.get(Hi);await TXe(a.get(B),a.get(ie));let{launch:t,name:o,getConfig:n}=e.getConfigurationManager().selectedConfiguration,r=await n(),s=r?Object.assign(io(r),i?.config):o;await e.startDebugging(t,s,{noDebug:i?.noDebug,startedByUser:!0},!1)}});xt.registerCommandAndKeybindingRule({id:iat,weight:200,primary:2111,mac:{primary:319},when:C.and(qa,ca.notEqualsTo(HM(1))),handler:async a=>{await a.get(fe).executeCommand(CV,{noDebug:!0})}});xt.registerCommandAndKeybindingRule({id:"debug.toggleBreakpoint",weight:205,when:C.and(_De,Wg.toNegated()),primary:10,handler:a=>{let i=a.get(Co),e=a.get(Hi),t=i.lastFocusedList;if(t instanceof Gc){let o=t.getFocusedElements();o&&o.length&&e.enableOrDisableBreakpoints(!o[0].enabled,o[0])}}});xt.registerCommandAndKeybindingRule({id:"debug.enableOrDisableBreakpoint",weight:200,primary:void 0,when:me.editorTextFocus,handler:a=>{let i=a.get(Hi),t=a.get(ie).activeTextEditorControl;if(fn(t)){let o=t.getModel();if(o){let n=t.getPosition();if(n){let r=i.getModel().getBreakpoints({uri:o.uri,lineNumber:n.lineNumber});r.length&&i.enableOrDisableBreakpoints(!r[0].enabled,r[0])}}}}});xt.registerCommandAndKeybindingRule({id:WNi,weight:205,when:SXe,primary:60,mac:{primary:3},handler:(a,i)=>{let e=a.get(Hi);if(!(i instanceof Fd)){let o=a.get(Co).lastFocusedList;if(o){let n=o.getFocus();Array.isArray(n)&&n[0]instanceof Fd&&(i=n[0])}}i instanceof Fd&&e.getViewModel().setSelectedExpression(i,!1)}});Ge.registerCommand({id:VNi,handler:async(a,i)=>{let e=a.get(Hi);(i instanceof Fd||i instanceof ac)&&e.getViewModel().setSelectedExpression(i,!0)}});xt.registerCommandAndKeybindingRule({id:"debug.setVariable",weight:205,when:CAt,primary:60,mac:{primary:3},handler:a=>{let i=a.get(Co),e=a.get(Hi),t=i.lastFocusedList;if(t){let o=t.getFocus();Array.isArray(o)&&o[0]instanceof ac&&e.getViewModel().setSelectedExpression(o[0],!1)}}});xt.registerCommandAndKeybindingRule({id:BNi,weight:200,when:C.and(SXe,UZ.toNegated()),primary:20,mac:{primary:2049},handler:(a,i)=>{let e=a.get(Hi);if(i instanceof Fd){e.removeWatchExpressions(i.getId());return}let o=a.get(Co).lastFocusedList;if(o){let n=o.getFocus();if(Array.isArray(n)&&n[0]instanceof Fd){let r=o.getSelection();r&&r.indexOf(n[0])>=0&&(n=r),n.forEach(s=>e.removeWatchExpressions(s.getId()))}}}});Ge.registerCommand({id:nat,handler:async a=>{let i=a.get(Hi);W_&&await i.addDataBreakpoint({description:W_.description,src:{type:0,dataId:W_.dataId},canPersist:!!W_.canPersist,accessTypes:W_.accessTypes,accessType:"write"})}});Ge.registerCommand({id:rat,handler:async a=>{let i=a.get(Hi);W_&&await i.addDataBreakpoint({description:W_.description,src:{type:0,dataId:W_.dataId},canPersist:!!W_.canPersist,accessTypes:W_.accessTypes,accessType:"readWrite"})}});Ge.registerCommand({id:sat,handler:async a=>{let i=a.get(Hi);W_&&await i.addDataBreakpoint({description:W_.description,src:{type:0,dataId:W_.dataId},canPersist:!!W_.canPersist,accessTypes:W_.accessTypes,accessType:"read"})}});xt.registerCommandAndKeybindingRule({id:"debug.removeBreakpoint",weight:200,when:C.and(_De,xAt.toNegated()),primary:20,mac:{primary:2049},handler:a=>{let i=a.get(Co),e=a.get(Hi),t=i.lastFocusedList;if(t instanceof Gc){let o=t.getFocusedElements(),n=o.length?o[0]:void 0;n instanceof pb?e.removeBreakpoints(n.getId()):n instanceof QI?e.removeFunctionBreakpoints(n.getId()):n instanceof rw&&e.removeDataBreakpoints(n.getId())}}});xt.registerCommandAndKeybindingRule({id:"debug.installAdditionalDebuggers",weight:200,when:void 0,primary:void 0,handler:async(a,i)=>{let e=a.get(Ui),t="@category:debuggers";return typeof i=="string"&&(t+=` ${i}`),e.openSearch(t)}});W(class extends z{constructor(){super({id:Rve,title:P(10690,"Add Configuration..."),category:Ene,f1:!0,menu:{id:R.EditorContent,when:C.and(C.regex(Ho.Path.key,/\.vscode[/\\]launch\.json$/),Tr.isEqualTo(EW))}})}async run(i,e){let t=i.get(Hi).getConfigurationManager(),o=t.getLaunches().find(n=>n.uri.toString()===e)||t.selectedConfiguration.launch;if(o){let{editor:n,created:r}=await o.openConfigFile({preserveFocus:!1});if(n&&!r){let s=n.getControl();s&&await s.getContribution(OH)?.addLaunchConfiguration()}}}});var emn=a=>{let i=a.get(Hi),t=a.get(ie).activeTextEditorControl;if(fn(t)){let o=t.getPosition();if(o&&t.hasModel()&&i.canSetBreakpointsIn(t.getModel())){let n=t.getModel().uri;i.getModel().getBreakpoints({lineNumber:o.lineNumber,uri:n}).some(s=>s.sessionAgnosticData.column===o.column||!s.column&&o.column<=1)||i.addBreakpoints(n,[{lineNumber:o.lineNumber,column:o.column>1?o.column:void 0}])}}};xt.registerCommandAndKeybindingRule({weight:200,primary:1091,when:me.editorTextFocus,id:eat,handler:emn});be.appendMenuItem(R.EditorContext,{command:{id:eat,title:d(10691,null),category:Ene},when:C.and(vl,Rpe.toNegated(),me.editorTextFocus,Z.inChatSession.toNegated()),group:"debug",order:1});xt.registerCommandAndKeybindingRule({id:"debug.openBreakpointToSide",weight:200,when:_De,primary:2051,secondary:[515],handler:a=>{let e=a.get(Co).lastFocusedList;if(e instanceof Gc){let t=e.getFocusedElements();if(t.length&&t[0]instanceof pb)return KWe(t[0],!0,!1,!0,a.get(Hi),a.get(ie))}}});W(class extends z{constructor(){super({id:Ypn,title:P(10727,"Toggle Exception Breakpoints"),category:Ene,f1:!0,precondition:qa})}async run(i){let e=i.get(Hi),t=i.get($e),o=e.getModel(),n=e.getViewModel().focusedSession||o.getSessions()[0],r=n?o.getExceptionBreakpointsForSession(n.getId()):o.getExceptionBreakpoints();if(r.length===0)return;if(r.length===1){let c=r[0];await e.enableOrDisableBreakpoints(!c.enabled,c);return}let s=new O,l=s.add(t.createQuickPick());l.placeholder=d(10719,null),l.canSelectMany=!0,l.matchOnDescription=!0,l.matchOnDetail=!0,l.items=r.map(c=>({label:c.label,description:c.description,picked:c.enabled,breakpoint:c})),l.selectedItems=l.items.filter(c=>c.picked),s.add(l.onDidAccept(()=>{let c=l.selectedItems,u=[],p=[];for(let g of r){let f=c.some(v=>v.breakpoint===g);f&&!g.enabled?u.push(g):!f&&g.enabled&&p.push(g)}let h=[];for(let g of u)h.push(e.enableOrDisableBreakpoints(!0,g));for(let g of p)h.push(e.enableOrDisableBreakpoints(!1,g));Promise.all(h).then(()=>s.dispose())})),s.add(l.onDidHide(()=>s.dispose())),l.show()}});xt.registerCommandAndKeybindingRule({id:"debug.openView",weight:200,when:qa.toNegated(),primary:63,secondary:[2111],handler:async a=>{await a.get(Es).openPaneComposite($g,0,!0)}});W(class extends z{constructor(){super({id:Xpn,title:P(10693,"Attach to Current Code Renderer")})}async run(a){let i=a.get(ko);if(!i.isExtensionDevelopment&&!i.extensionTestsLocationURI)throw new Error("Refusing to attach to renderer outside of development context");let e=hv(ut);return await a.get(jR).attachToCurrentWindowRenderer(e)}});var gTo="\\u0000-\\u0020\\u007f-\\u009f",tmn=new RegExp("(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s"+gTo+'"]{2,}[^\\s'+gTo+`"')}\\],:;.!?]`,"ug"),imn=/(?:[a-zA-Z]:(?:(?:\\|\/)[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,omn=/(?:(?:\~|\.+)(?:(?:\\|\/)[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,nmn=new RegExp(`(${imn.source}|${omn.source})`),rmn=/((?:\~|\.+)?(?:\/[\w\s\.@\-\(\)\[\]{}!#$%^&'`~+=]+)+)/,smn=/(?::(?:line\s+)?([\d]+))?(?::([\d]+))?/,amn=new RegExp(`${ii?nmn.source:rmn.source}${smn.source}`,"g"),lmn=/:(?:line\s+)?([\d]+)(?::([\d]+))?$/,cmn=2e3;var Pne=class{constructor(i,e,t,o,n,r,s,l){this.editorService=i;this.fileService=e;this.openerService=t;this.pathService=o;this.tunnelService=n;this.environmentService=r;this.configurationService=s;this.hoverService=l}linkify(i,e,t,o,n,r){return this._linkify(i,e,t,o,n,r)}_linkify(i,e,t,o,n,r,s){if(t){let c=i.split(`
`);for(let h=0;h<c.length-1;h++)c[h]=c[h]+`
`;c[c.length-1]||c.pop();let u=c.map(h=>this._linkify(h,e,!1,o,n,r,s));if(u.length===1)return u[0];let p=document.createElement("span");return u.forEach(h=>p.appendChild(h)),p}let l=document.createElement("span");for(let c of this.detectLinks(i))try{let u;switch(c.kind){case"text":u=s?this.linkifyLocation(c.value,s.locationReference,s.session,e):document.createTextNode(c.value);break;case"web":u=this.createWebLink(n?i:void 0,c.value,e);break;case"path":{let p=c.captures[0],h=c.captures[1]?Number(c.captures[1]):0,g=c.captures[2]?Number(c.captures[2]):0;u=this.createPathLink(n?i:void 0,c.value,p,h,g,o,e);break}default:u=document.createTextNode(c.value)}l.append(...this.applyHighlights(u,c.index,c.value.length,r))}catch{l.appendChild(document.createTextNode(c.value))}return l}applyHighlights(i,e,t,o){let n=[],r=e,s=e+t;for(let l of o||[]){if(l.end<=r||l.start>=s)continue;l.start>r&&(n.push(i.textContent.substring(r-e,l.start-e)),r=l.start);let c=Math.min(l.end,s),u=i.textContent.substring(r-e,c-e),p=document.createElement("span");p.classList.add("highlight"),l.extraClasses&&p.classList.add(...l.extraClasses),p.textContent=u,n.push(p),r=c}return r===e?yt.single(i):(r<s&&n.push(i.textContent.substring(r-e)),go(i)?(Ii(i,...n),yt.single(i)):n)}linkifyLocation(i,e,t,o){let n=this.createLink(i);return this.decorateLink(n,void 0,i,o,async r=>{let s=await t.resolveLocationReference(e);await s.source.openInEditor(this.editorService,{startLineNumber:s.line,startColumn:s.column,endLineNumber:s.endLine??s.line,endColumn:s.endColumn??s.column},r)}),n}makeReferencedLinkDetector(i,e){return{linkify:(t,o,n,r,s,l)=>this._linkify(t,o,n,r,s,l,{locationReference:i,session:e}),linkifyLocation:this.linkifyLocation.bind(this)}}createWebLink(i,e,t){let o=this.createLink(e),n=A.parse(e),r=lmn.exec(n.path);return r&&(n=n.with({path:n.path.slice(0,r.index),fragment:`L${r[0].slice(1)}`})),this.decorateLink(o,n,i,t,async()=>{if(n.scheme===Q.file){let s=n.fsPath,l=await this.pathService.path,c=Vh(l.sep===Vo.sep&&ii?s.replace(/\\/g,Vo.sep):s),u=A.parse(c);if(!await this.fileService.exists(u))return;await this.editorService.openEditor({resource:u,options:{pinned:!0,selection:r?{startLineNumber:+r[1],startColumn:r[2]?+r[2]:1}:void 0}});return}this.openerService.open(e,{allowTunneling:!!this.environmentService.remoteAuthority&&this.configurationService.getValue("remote.forwardOnOpen")})}),o}createPathLink(i,e,t,o,n,r,s){if(t[0]==="/"&&t[1]==="/")return document.createTextNode(e);let l=o>0?{selection:{startLineNumber:o,startColumn:n>0?n:1}}:{};if(t[0]==="."){if(!r)return document.createTextNode(e);let p=r.toResource(t),h=this.createLink(e);return this.decorateLink(h,p,i,s,g=>this.editorService.openEditor({resource:p,options:{...l,preserveFocus:g}})),h}if(t[0]==="~"){let p=this.pathService.resolvedUserHome;p&&(t=td(p.fsPath,t.substring(1)))}let c=this.createLink(e);c.tabIndex=0;let u=A.file(Vh(t));return this.fileService.stat(u).then(p=>{p.isDirectory||this.decorateLink(c,u,i,s,h=>this.editorService.openEditor({resource:u,options:{...l,preserveFocus:h}}))}).catch(()=>{}),c}createLink(i){let e=document.createElement("a");return e.textContent=i,e}decorateLink(i,e,t,o,n){if(o.store.isDisposed)return;i.classList.add("link");let r=e&&this.tunnelService.canTunnel(e)?d(10904,null):d(10905,null),s=i.ariaLabel=t?et?d(10903,null,r,t):d(10902,null,r,t):et?d(10901,null,r):d(10900,null,r);o.type===0?o.store.add(this.hoverService.setupManagedHover(yi("element"),i,s)):o.type!==2&&(i.title=s),o.store.add($(i,"mousemove",l=>{i.classList.toggle("pointer",et?l.metaKey:l.ctrlKey)})),o.store.add($(i,"mouseleave",()=>{i.classList.remove("pointer")})),o.store.add($(i,"click",l=>{let c=Me(i).getSelection();!c||c.type==="Range"||(et?l.metaKey:l.ctrlKey)&&(l.preventDefault(),l.stopImmediatePropagation(),n(!1))})),o.store.add($(i,"keydown",l=>{let c=new mi(l);(c.keyCode===3||c.keyCode===10)&&(c.preventDefault(),c.stopPropagation(),n(c.keyCode===10))}))}detectLinks(i){if(i.length>cmn)return[{kind:"text",value:i,captures:[],index:0}];let e=[tmn,amn],t=["web","path"],o=[],n=(r,s,l)=>{if(s>=e.length){o.push({value:r,kind:"text",captures:[],index:l});return}let c=e[s],u=0,p;for(c.lastIndex=0;(p=c.exec(r))!==null;){let g=r.substring(u,p.index);g&&n(g,s+1,l+u);let f=p[0];o.push({value:f,kind:t[s],captures:p.slice(1),index:l+p.index}),u=p.index+f.length}let h=r.substring(u);h&&n(h,s+1,l+u)};return n(i,0,0),o}};Pne=I([m(0,ie),m(1,ge),m(2,Je),m(3,Pn),m(4,Jp),m(5,Mt),m(6,B),m(7,ot)],Pne);var umn=1024,pmn=/^(true|false)$/i,mmn=/^(['"]).*\1$/;var hmn=Object.keys({value:0,unavailable:0,error:0,changed:0,boolean:0,string:0,number:0}),PP=class{constructor(i,e,t,o){this.commandService=i;this.hoverService=o;this.linkDetector=t.createInstance(Pne),this.displayType=hr("debug.showVariableTypes",!1,e)}renderVariable(i,e,t={}){let o=this.displayType.get(),n=UEo(e,t.highlights||[]);if(e.available){i.type.textContent="";let s=e.name;e.value&&typeof e.name=="string"&&(e.type&&o?(s+=": ",i.type.textContent=e.type+" ="):s+=" ="),i.label.set(s,n.name,e.type&&!o?e.type:e.name),i.name.classList.toggle("virtual",e.presentationHint?.kind==="virtual"),i.name.classList.toggle("internal",e.presentationHint?.visibility==="internal")}else e.value&&typeof e.name=="string"&&e.name&&i.label.set(":");i.expression.classList.toggle("lazy",!!e.presentationHint?.lazy);let r=[{id:L6,args:[e,[e]]}];return e.evaluateName&&r.push({id:kne,args:[{variable:e}]}),this.renderValue(i.value,e,{showChanged:t.showChanged,maxValueLength:umn,hover:{commands:r},highlights:n.value,colorize:!0,session:e.getSession()})}renderValue(i,e,t={}){let o=new O,n=t.session?.rememberedCapabilities?.supportsANSIStyling??t.wasANSI??!1,r=typeof e=="string"?e:e.value;for(let p of hmn)i.classList.remove(p);i.classList.add("value"),r===null||(e instanceof Fd||e instanceof ac||e instanceof fO)&&!e.available?(i.classList.add("unavailable"),r!==Fd.DEFAULT_VALUE&&i.classList.add("error")):(typeof e!="string"&&t.showChanged&&e.valueChanged&&r!==Fd.DEFAULT_VALUE&&(i.classList.add("changed"),e.valueChanged=!1),t.colorize&&typeof e!="string"&&(e.type==="number"||e.type==="boolean"||e.type==="string"?i.classList.add(e.type):isNaN(+r)?pmn.test(r)?i.classList.add("boolean"):mmn.test(r)&&i.classList.add("string"):i.classList.add("number"))),t.maxValueLength&&r&&r.length>t.maxValueLength&&(r=r.substring(0,t.maxValueLength)+"..."),r||(r="");let s=t.session??(e instanceof dN?e.getSession():void 0),l=t.hover===!1?{type:0,store:o}:{type:2,store:o};St(i);let c=t.locationReference??(e instanceof dN&&e.valueLocationReference),u=this.linkDetector;if(c&&s&&(u=this.linkDetector.makeReferencedLinkDetector(c,s)),n?i.appendChild(_Ni(r,u,s?s.root:void 0,t.highlights,l)):i.appendChild(u.linkify(r,l,!1,s?.root,!0,t.highlights)),t.hover!==!1){let{commands:p=[]}=t.hover||{};o.add(this.hoverService.setupManagedHover(yi("mouse"),i,()=>{let h=_("div"),g=_("div.hover-row"),f=D(g,_("div.hover-contents")),v=D(f,_("pre.debug-var-hover-pre"));return n?v.appendChild(_Ni(r,this.linkDetector,s?s.root:void 0,t.highlights,l)):v.textContent=r,h.appendChild(g),h},{actions:p.map(({id:h,args:g})=>{let f=Ge.getCommand(h)?.metadata?.description;return{label:typeof f=="string"?f:f?f.value:h,commandId:h,run:()=>this.commandService.executeCommand(h,...g)}})}))}return o}};PP=I([m(0,fe),m(1,B),m(2,F),m(3,ot)],PP);var XNi=_,O$t=!0,F$t,QWe=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,n,t,r,c,l,s,u,p,h);this.debugService=o;this.menuService=g;this.needsRefresh=!1;this.savedViewState=new Map;this.autoExpandedScopes=new Set;this.updateTreeScheduler=this._register(new Dt(async()=>{let f=this.debugService.getViewModel().focusedStackFrame;this.needsRefresh=!1;let v=this.tree.getInput();if(v&&this.savedViewState.set(v.getId(),this.tree.getViewState()),!f){await this.tree.setInput(null);return}let b=this.savedViewState.get(f.getId());await this.tree.setInput(f,b);let y=(await f.getScopes()).find(w=>!w.expensive);y&&this.tree.hasNode(y)&&(this.autoExpandedScopes.add(y.getId()),await this.tree.expand(y))},400))}get treeSelection(){return this.tree.getSelection()}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-variables");let t=vne(e),o=this.instantiationService.createInstance(PP);this.tree=this.instantiationService.createInstance(Rp,"VariablesView",t,new ZNi,[this.instantiationService.createInstance(AP,o),this.instantiationService.createInstance(BE,o),new V$t,new B$t],this.instantiationService.createInstance(JNi),{accessibilityProvider:new eOi,identityProvider:{getId:r=>r.getId()},keyboardNavigationLabelProvider:w$t,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(BE.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this.tree.setInput(this.debugService.getViewModel().focusedStackFrame??null),CAt.bindTo(this.tree.contextKeyService),this._register(this.debugService.getViewModel().onDidFocusStackFrame(r=>{if(!this.isBodyVisible()){this.needsRefresh=!0;return}let s=r.explicit?0:void 0;this.updateTreeScheduler.schedule(s)})),this._register(this.debugService.getViewModel().onWillUpdateViews(()=>{let r=this.debugService.getViewModel().focusedStackFrame;r&&O$t&&r.forgetScopes(),O$t=!0,this.tree.updateChildren()})),this._register(this.tree),this._register(this.tree.onMouseDblClick(r=>this.onMouseDblClick(r))),this._register(this.tree.onContextMenu(async r=>await this.onContextMenu(r))),this._register(this.onDidChangeBodyVisibility(r=>{r&&this.needsRefresh&&this.updateTreeScheduler.schedule()}));let n;this._register(this.debugService.getViewModel().onDidSelectExpression(r=>{let s=r?.expression;s&&this.tree.hasNode(s)?(n=this.tree.options.horizontalScrolling,n&&this.tree.updateOptions({horizontalScrolling:!1}),this.tree.rerender(s)):!r&&n!==void 0&&(this.tree.updateOptions({horizontalScrolling:n}),n=void 0)})),this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async r=>{r instanceof ac&&this.tree.hasNode(r)&&(await this.tree.updateChildren(r,!1,!0),await this.tree.expand(r))})),this._register(this.debugService.onDidEndSession(()=>{this.savedViewState.clear(),this.autoExpandedScopes.clear()}))}layoutBody(e,t){super.layoutBody(t,e),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}collapseAll(){this.tree.collapseAll()}onMouseDblClick(e){this.canSetExpressionValue(e.element)&&this.debugService.getViewModel().setSelectedExpression(e.element,!1)}canSetExpressionValue(e){let t=this.debugService.getViewModel().focusedSession;return t?e instanceof zM?!!e.treeItem.canEdit:!t.capabilities?.supportsSetVariable&&!t.capabilities?.supportsSetExpression?!1:e instanceof ac&&!e.presentationHint?.attributes?.includes("readOnly")&&!e.presentationHint?.lazy:!1}async onContextMenu(e){let t=e.element;if(t instanceof Z2)return this.openContextMenuForScope(e,t);if(!(!(t instanceof ac)||!t.value))return tOi(this.contextKeyService,this.menuService,this.contextMenuService,R.DebugVariablesContext,e)}openContextMenuForScope(e,t){let o={scope:{name:t.name}},n=this.menuService.getMenuActions(R.DebugScopesContext,this.contextKeyService,{arg:o,shouldForwardArgs:!1}),{secondary:r}=um(n,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r})}};QWe=I([m(1,Xe),m(2,Hi),m(3,Le),m(4,B),m(5,F),m(6,ji),m(7,X),m(8,Je),m(9,Pe),m(10,ot),m(11,Yt)],QWe);async function tOi(a,i,e,t,o){let n=o.element;if(!(n instanceof ac)||!n.value)return;let r=await gmn(a,n),s=iOi(n),l=i.getMenuActions(t,r,{arg:s,shouldForwardArgs:!1}),{secondary:c}=um(l,"inline");e.showContextMenu({getAnchor:()=>o.anchor,getActions:()=>c})}var iOi=a=>({sessionId:a.getSession()?.getId(),container:a.parent instanceof Fd?{expression:a.parent.name}:a.parent.toDebugProtocolObject(),variable:a.toDebugProtocolObject()});async function gmn(a,i){let e=i.getSession();if(!e||!e.capabilities.supportsDataBreakpoints)return W$t(a,i);let t=[],o=await e.dataBreakpointInfo(i.name,i.parent.reference),n=o?.dataId,r=o?.accessTypes;if(N$t(o),!r)t.push([Q2.key,!!n]);else for(let s of r)switch(s){case"read":t.push([$Z.key,!!n]);break;case"write":t.push([Q2.key,!!n]);break;case"readWrite":t.push([qZ.key,!!n]);break}return W$t(a,i,t)}function W$t(a,i,e=[]){return F$t=i,BAt(a,i,e)}function fTo(a){return a instanceof a_}var JNi=class extends Zq{hasChildren(i){return i?fTo(i)?!0:i.hasChildren:!1}doGetChildren(i){return fTo(i)?i.getScopes():i.getChildren()}},ZNi=class{getHeight(i){return 22}getTemplateId(i){return i instanceof LXe?B$t.ID:i instanceof Z2?V$t.ID:i instanceof zM?BE.ID:AP.ID}},V$t=class a{static{this.ID="scope"}get templateId(){return a.ID}renderTemplate(i){let e=D(i,XNi(".scope")),t=new ul(e);return{name:e,label:t}}renderElement(i,e,t){t.label.set(i.element.name,Wa(i.filterData))}disposeTemplate(i){i.label.dispose()}},B$t=class a{static{this.ID="scopeError"}get templateId(){return a.ID}renderTemplate(i){let e=D(i,XNi(".scope"));return{error:D(e,XNi(".error"))}}renderElement(i,e,t){t.error.innerText=i.element.name}disposeTemplate(){}},BE=class extends p1{constructor(e,t,o,n,r,s){super(t,o,n);this.expressionRenderer=e;this.menuService=r;this.contextKeyService=s}static{this.ID="viz"}static rendererOnVisualizationRange(e,t){return e.onDidChangeVisualization(({original:o})=>{if(!t.hasNode(o))return;let n=t.getParentElement(o);t.updateChildren(n,!1,!1)})}get templateId(){return BE.ID}renderElement(e,t,o){o.elementDisposable.clear(),super.renderExpressionElement(e.element,e,o)}renderExpression(e,t,o){let n=e,r=n.name;n.value&&typeof n.name=="string"&&(r+=":"),t.label.set(r,o,n.name),t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,n,{showChanged:!1,maxValueLength:1024,colorize:!0,session:e.getSession()}))}getInputBoxOptions(e){let t=e;return{initialValue:e.value,ariaLabel:d(11003,null),validationOptions:{validation:()=>t.errorMessage?{content:t.errorMessage}:null},onFinish:(o,n)=>{t.errorMessage=void 0,n&&t.edit(o).then(()=>{O$t=!1,this.debugService.getViewModel().updateViews()})}}}renderActionBar(e,t,o){let n=t,r=n.original?W$t(this.contextKeyService,n.original):this.contextKeyService,s=n.original?iOi(n.original):void 0,l=this.menuService.getMenuActions(R.DebugVariablesContext,r,{arg:s,shouldForwardArgs:!1}),{primary:c}=um(l,"inline");if(n.original){let u=li({id:"debugViz",label:d(10998,null),class:q.asClassName(L.eye),run:()=>this.debugService.getViewModel().setVisualizedExpression(n.original,void 0)});u.checked=!0,c.push(u),e.domNode.style.display="initial"}e.clear(),e.context=s,e.push(c,{icon:!0,label:!1})}};BE=I([m(1,Hi),m(2,qn),m(3,ot),m(4,Yt),m(5,X)],BE);var AP=class extends p1{constructor(e,t,o,n,r,s,l,c){super(s,l,c);this.expressionRenderer=e;this.menuService=t;this.contextKeyService=o;this.visualization=n;this.contextMenuService=r}static{this.ID="variable"}get templateId(){return AP.ID}renderExpression(e,t,o){t.elementDisposable.add(this.expressionRenderer.renderVariable(t,e,{highlights:o,showChanged:!0}))}renderElement(e,t,o){o.elementDisposable.clear(),super.renderExpressionElement(e.element,e,o)}getInputBoxOptions(e){let t=e;return{initialValue:e.value,ariaLabel:d(11003,null),validationOptions:{validation:()=>t.errorMessage?{content:t.errorMessage}:null},onFinish:(o,n)=>{t.errorMessage=void 0;let r=this.debugService.getViewModel().focusedStackFrame;n&&t.value!==o&&r&&t.setVariable(o,r).then(()=>{O$t=!1,this.debugService.getViewModel().updateViews()})}}}renderActionBar(e,t,o){let n=t,r=W$t(this.contextKeyService,n),s=iOi(n),l=this.menuService.getMenuActions(R.DebugVariablesContext,r,{arg:s,shouldForwardArgs:!1}),{primary:c}=um(l,"inline");e.clear(),e.context=s,e.push(c,{icon:!0,label:!1});let u=new qe;o.elementDisposable.add(ee(()=>u.dispose(!0))),this.visualization.getApplicableFor(t,u.token).then(p=>{o.elementDisposable.add(p);let h=t instanceof zM&&t.original||t,g=p.object.map(f=>li({id:"debugViz",label:f.name,class:f.iconClass||"debug-viz-icon",run:this.useVisualizer(f,h,u.token)}));g.length===0||(g.length===1?e.push(g[0],{icon:!0,label:!1}):e.push(li({id:"debugViz",label:d(10999,null),class:q.asClassName(L.eye),run:()=>this.pickVisualizer(g,h,o)}),{icon:!0,label:!1}))})}pickVisualizer(e,t,o){this.contextMenuService.showContextMenu({getAnchor:()=>o.actionBar.getContainer(),getActions:()=>e})}useVisualizer(e,t,o){return async()=>{let n=await e.resolve(o);if(!o.isCancellationRequested)if(n.type===0)e.execute();else{let r=await this.visualization.getVisualizedNodeFor(n.id,t);r&&this.debugService.getViewModel().setVisualizedExpression(t,r)}}}};AP=I([m(1,Yt),m(2,X),m(3,JZ),m(4,Xe),m(5,Hi),m(6,qn),m(7,ot)],AP);var eOi=class{getWidgetAriaLabel(){return d(11001,null)}getAriaLabel(i){return i instanceof Z2?d(11002,null,i.name):i instanceof ac?d(11000,null,i.name,i.value):null}},oOi="debug.setVariable";Ge.registerCommand({id:oOi,handler:a=>{a.get(Hi).getViewModel().setSelectedExpression(F$t,!1)}});Ge.registerCommand({metadata:{description:cat},id:L6,handler:async(a,i,e)=>{let t=a.get(Hi),o=a.get(Bi),n="",r;if(i)i instanceof ac||i instanceof Fd?(n="watch",r=[i]):(n="variables",r=F$t?[F$t]:[]);else{let p=a.get(Gt),h=p.getFocusedView(),g;if(h?.id===vE?(g=p.getActiveViewWithId(vE),n="watch"):h?.id===q2&&(g=p.getActiveViewWithId(q2),n="variables"),!g)return;r=g.treeSelection.filter(f=>f instanceof Fd||f instanceof ac)}let s=t.getViewModel().focusedStackFrame,l=t.getViewModel().focusedSession;if(!s||!l||r.length===0)return;let c=l.capabilities.supportsClipboardContext?"clipboard":n,u=r.map(p=>p instanceof ac?p.evaluateName||p.value:p.name);try{let p=await Promise.all(u.map(g=>l.evaluate(g,s.frameId,c))),h=ui(p).map(g=>g.body.result);h.length&&o.writeText(h.join(`
`))}catch{let h=r.map(g=>g.value);o.writeText(h.join(`
`))}}});var mat="workbench.debug.viewlet.action.viewMemory",vTo="ms-vscode.hexeditor",fmn="hexEditor.hexedit";Ge.registerCommand({id:mat,handler:async(a,i,e)=>{let t=a.get(Hi),o,n;if("sessionId"in i){if(!i.sessionId||!i.variable.memoryReference)return;o=i.sessionId,n=i.variable.memoryReference}else{if(!i.memoryReference)return;let h=t.getViewModel().focusedSession;if(!h)return;o=h.getId(),n=i.memoryReference}let r=a.get(Ui),s=a.get(ie),l=a.get(Ne),c=a.get(lt),u=a.get(_e);(await c.getExtension(vTo)||await vmn(r,l))&&(u.publicLog("debug/didViewMemory",{debugType:t.getModel().getSession(o)?.configuration.type}),await s.openEditor({resource:jlo(o,n),options:{revealIfOpened:!0,override:fmn}},En))}});async function vmn(a,i){try{return await a.install(vTo,{justification:d(11004,null),enable:!0},15),!0}catch(e){return i.error(e),!1}}Ge.registerCommand({metadata:{description:jWe},id:kne,handler:async(a,i)=>{let e=a.get(Bi);i instanceof ac?await e.writeText(i.evaluateName):await e.writeText(i.variable.evaluateName)}});Ge.registerCommand({metadata:{description:dat},id:oat,handler:async(a,i)=>{a.get(Hi).addWatchExpression(i.variable.evaluateName)}});W(class extends rr{constructor(){super({id:"variables.collapse",viewId:q2,title:d(10997,null),f1:!1,icon:L.collapseAll,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",q2)}})}runInView(a,i){i.collapseAll()}});var YWe=_;async function bTo(a,i){if(!a)return null;let t=(await a.getChildren()).filter(o=>i[0]===o.name);return t.length!==1?null:i.length===1?t[0]:bTo(t[0],i.slice(1))}async function bmn(a,i){let t=(await a.getScopes()).filter(n=>!n.expensive),o=ui(await Promise.all(t.map(n=>bTo(n,i))));return o.length>0&&o.every(n=>n.value===o[0].value)?o[0]:void 0}var m1=class{constructor(i,e,t,o,n,r){this.editor=i;this.debugService=e;this.instantiationService=t;this.menuService=o;this.contextKeyService=n;this.contextMenuService=r;this.allowEditorOverflow=!0;this.isUpdatingTree=!1;this.highlightDecorations=this.editor.createDecorationsCollection(),this.toDispose=[],this.showAtPosition=null,this.positionPreference=[1,2],this.debugHoverComputer=this.instantiationService.createInstance(hat,this.editor),this.expressionRenderer=this.instantiationService.createInstance(PP)}static{this.ID="debug.hoverWidget"}get isShowingComplexValue(){return this.complexValueContainer?.hidden===!1}create(){this.domNode=YWe(".debug-hover-widget"),this.complexValueContainer=D(this.domNode,YWe(".complex-value")),this.complexValueTitle=D(this.complexValueContainer,YWe(".title")),this.treeContainer=D(this.complexValueContainer,YWe(".debug-hover-tree")),this.treeContainer.setAttribute("role","tree");let i=D(this.complexValueContainer,YWe(".tip"));i.textContent=d(10761,null,et?"Option":"Alt");let e=this.instantiationService.createInstance(rOi);this.tree=this.instantiationService.createInstance(Rp,"DebugHover",this.treeContainer,new sOi,[this.instantiationService.createInstance(AP,this.expressionRenderer),this.instantiationService.createInstance(BE,this.expressionRenderer)],e,{accessibilityProvider:new nOi,mouseSupport:!1,horizontalScrolling:!0,useShadows:!1,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:t=>t.name},overrideStyles:{listBackground:EF}}),this.toDispose.push(BE.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this.toDispose.push(this.tree),this.valueContainer=YWe(".value"),this.valueContainer.tabIndex=0,this.valueContainer.setAttribute("role","tooltip"),this.scrollbar=new Ar(this.valueContainer,{horizontal:2}),this.domNode.appendChild(this.scrollbar.getDomNode()),this.toDispose.push(this.scrollbar),this.editor.applyFontInfo(this.domNode),this.domNode.style.backgroundColor=Tt(EF),this.domNode.style.border=`1px solid ${Tt(eK)}`,this.domNode.style.color=Tt(rX),this.toDispose.push(this.tree.onContextMenu(async t=>await this.onContextMenu(t))),this.toDispose.push(this.tree.onDidChangeContentHeight(()=>{this.isUpdatingTree||this.layoutTreeAndContainer()})),this.toDispose.push(this.tree.onDidChangeContentWidth(()=>{this.isUpdatingTree||this.layoutTreeAndContainer()})),this.registerListeners(),this.editor.addContentWidget(this)}async onContextMenu(i){let e=i.element;if(!(!(e instanceof ac)||!e.value))return tOi(this.contextKeyService,this.menuService,this.contextMenuService,R.DebugHoverContext,i)}registerListeners(){this.toDispose.push(Yo(this.domNode,"keydown",i=>{i.equals(9)&&this.hide()})),this.toDispose.push(this.editor.onDidChangeConfiguration(i=>{i.hasChanged(59)&&this.editor.applyFontInfo(this.domNode)})),this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(async i=>{i instanceof ac&&this.tree.hasNode(i)&&(await this.tree.updateChildren(i,!1,!0),await this.tree.expand(i))}))}isHovered(){return!!this.domNode?.matches(":hover")}isVisible(){return!!this._isVisible}willBeVisible(){return!!this.showCancellationSource}getId(){return m1.ID}getDomNode(){return this.domNode}isInSafeTriangle(i,e){return this._isVisible&&!!this.safeTriangle?.contains(i,e)}async showAt(i,e,t){this.showCancellationSource?.dispose(!0);let o=this.showCancellationSource=new qe,n=this.debugService.getViewModel().focusedSession;if(!n||!this.editor.hasModel())return this.hide(),1;let r=await this.debugHoverComputer.compute(i,o.token);if(o.token.isCancellationRequested)return this.hide(),2;if(!r.range)return this.hide(),1;if(this.isVisible()&&!r.rangeChanged)return 0;let s=await this.debugHoverComputer.evaluate(n);return o.token.isCancellationRequested?(this.hide(),2):!s||s instanceof Fd&&!s.available?(this.hide(),1):(this.highlightDecorations.set([{range:r.range,options:m1._HOVER_HIGHLIGHT_DECORATION_OPTIONS}]),this.doShow(n,r.range.getStartPosition(),s,e,t))}static{this._HOVER_HIGHLIGHT_DECORATION_OPTIONS=So.register({description:"bdebug-hover-highlight",className:"hoverHighlight"})}async doShow(i,e,t,o,n){this.domNode||this.create(),this.showAtPosition=e;let r=new O;if(this._isVisible={store:r},!t.hasChildren){this.complexValueContainer.hidden=!0,this.valueContainer.hidden=!1,r.add(this.expressionRenderer.renderValue(this.valueContainer,t,{showChanged:!1,colorize:!0,hover:!1,session:i})),this.valueContainer.title="",this.editor.layoutContentWidget(this),this.safeTriangle=n&&new D4e(n.posx,n.posy,this.domNode),this.scrollbar.scanDomNode(),o&&(this.editor.render(),this.valueContainer.focus());return}this.valueContainer.hidden=!0,this.expressionToRender=t,r.add(this.expressionRenderer.renderValue(this.complexValueTitle,t,{hover:!1,session:i})),this.editor.layoutContentWidget(this),this.safeTriangle=n&&new D4e(n.posx,n.posy,this.domNode),this.tree.scrollTop=0,this.tree.scrollLeft=0,this.complexValueContainer.hidden=!1,o&&(this.editor.render(),this.tree.domFocus())}layoutTreeAndContainer(){this.layoutTree(),this.editor.layoutContentWidget(this)}layoutTree(){let e=1/0;if(this.showAtPosition){let r=this.editor.getDomNode()?.offsetTop||0,s=this.treeContainer.offsetTop+r,l=this.editor.getTopForLineNumber(this.showAtPosition.lineNumber,!0)-this.editor.getScrollTop();s<l&&(e=l+r-22)}let t=Math.min(Math.max(266,this.editor.getLayoutInfo().height*.55),this.tree.contentHeight+10,e),o=this.tree.contentWidth,n=jn(o,400,550);this.tree.layout(t,n),this.treeContainer.style.height=`${t}px`,this.scrollbar.scanDomNode()}beforeRender(){if(this.expressionToRender){let i=this.expressionToRender;this.expressionToRender=void 0,this.isUpdatingTree=!0,this.tree.setInput(i).finally(()=>{this.isUpdatingTree=!1})}return null}afterRender(i){i&&(this.positionPreference=[i])}hide(){this.showCancellationSource&&(this.showCancellationSource.dispose(!0),this.showCancellationSource=void 0),this._isVisible&&(Is(this.domNode)&&this.editor.focus(),this._isVisible.store.dispose(),this._isVisible=void 0,this.highlightDecorations.clear(),this.editor.layoutContentWidget(this),this.positionPreference=[1,2])}getPosition(){return this._isVisible?{position:this.showAtPosition,preference:this.positionPreference}:null}dispose(){this.toDispose=je(this.toDispose)}};m1=I([m(1,Hi),m(2,F),m(3,Yt),m(4,X),m(5,Xe)],m1);var nOi=class{getWidgetAriaLabel(){return d(10762,null)}getAriaLabel(i){return d(10763,null,i.name,i.value)}},rOi=class extends Zq{hasChildren(i){return i.hasChildren}doGetChildren(i){return i.getChildren()}},sOi=class{getHeight(i){return 18}getTemplateId(i){return i instanceof zM?BE.ID:AP.ID}},hat=class{constructor(i,e,t,o){this.editor=i;this.debugService=e;this.languageFeaturesService=t;this.logService=o}async compute(i,e){if(!this.debugService.getViewModel().focusedSession||!this.editor.hasModel())return{rangeChanged:!1};let o=this.editor.getModel(),n=await WAt(this.languageFeaturesService,o,i,e);if(!n)return{rangeChanged:!1};let{range:r,matchingExpression:s}=n,l=!this._current?.range.equalsRange(r);return this._current={expression:s,range:G.lift(r)},{rangeChanged:l,range:this._current.range}}async evaluate(i){if(!this._current){this.logService.error("No expression to evaluate");return}let e=this.editor.getModel(),t=e&&i.getSourceForUri(e?.uri);if(i.capabilities.supportsEvaluateForHovers){let o=new Fd(this._current.expression);return await o.evaluate(i,this.debugService.getViewModel().focusedStackFrame,"hover",void 0,t?{line:this._current.range.startLineNumber,column:this._current.range.startColumn,source:t.raw}:void 0),o}else{let o=this.debugService.getViewModel().focusedStackFrame;if(o)return await bmn(o,ui(this._current.expression.split(".").map(n=>n.trim())))}}};hat=I([m(1,Hi),m(2,Jt),m(3,re)],hat);var gat=_,Smn=te("debugExceptionWidget.border","#a31515",d(10897,null)),Imn=te("debugExceptionWidget.background",{dark:"#420b0d",light:"#f1dfde",hcDark:"#420b0d",hcLight:"#f1dfde"},d(10896,null)),Ane=class extends o0{constructor(e,t,o,n,r,s){super(e,{showFrame:!0,showArrow:!0,isAccessible:!0,frameWidth:1,className:"exception-widget-container"});this.exceptionInfo=t;this.debugSession=o;this.shouldScroll=n;this.instantiationService=s;this.applyTheme(r.getColorTheme()),this._disposables.add(r.onDidColorThemeChange(this.applyTheme.bind(this))),this.create();let l=new Dt(()=>this._doLayout(void 0,void 0),50);this._disposables.add(this.editor.onDidLayoutChange(()=>l.schedule())),this._disposables.add(l)}applyTheme(e){this.backgroundColor=e.getColor(Imn);let t=e.getColor(Smn);this.style({arrowColor:t,frameColor:t})}_applyStyles(){this.container&&(this.container.style.backgroundColor=this.backgroundColor?this.backgroundColor.toString():""),super._applyStyles()}_fillContainer(e){this.setCssClass("exception-widget");let t=this.editor.getOption(59);e.style.fontSize=`${t.fontSize}px`,e.style.lineHeight=`${t.lineHeight}px`,e.tabIndex=0;let o=gat(".title"),n=gat(".label");D(o,n);let r=gat(".actions");D(o,r),n.textContent=this.exceptionInfo.id?d(10899,null,this.exceptionInfo.id):d(10898,null);let s=n.textContent;if(this._disposables.add(new oo(r)).push(new it("editor.closeExceptionWidget",d(10895,null),q.asClassName(MT),!0,async()=>{this.editor.getContribution(OH)?.closeExceptionWidget()}),{label:!1,icon:!0}),D(e,o),this.exceptionInfo.description){let c=gat(".description");c.textContent=this.exceptionInfo.description,s+=", "+this.exceptionInfo.description,D(e,c)}if(this.exceptionInfo.details&&this.exceptionInfo.details.stackTrace){let c=gat(".stack-trace"),u=this.instantiationService.createInstance(Pne),p={store:this._disposables,type:0},h=u.linkify(this.exceptionInfo.details.stackTrace,p,!0,this.debugSession?this.debugSession.root:void 0,void 0);c.appendChild(h),D(e,c),s+=", "+this.exceptionInfo.details.stackTrace}e.setAttribute("aria-label",s)}_doLayout(e,t){this.container.style.height="initial";let o=this.editor.getOption(75),n=Math.round(o/3),r=Math.ceil((this.container.offsetHeight+n)/o);this._relayout(r)}revealRange(e,t){this.shouldScroll()&&super.revealRange(e,t)}focus(){this.container?.focus()}hasFocus(){return this.container?Is(this.container):!1}getWhitespaceHeight(){if(!this._viewZone||!this._viewZone.id)return 0;let t=this.editor.getWhitespaces().find(o=>o.id===this._viewZone.id);return t?t.height:0}};Ane=I([m(4,Pe),m(5,F)],Ane);var ymn=100,wmn=150,Cmn=500,STo=200,ZPm=te("editor.inlineValuesForeground",{dark:"#ffffff80",light:"#00000080",hcDark:"#ffffff80",hcLight:"#00000080"},d(10760,null)),eAm=te("editor.inlineValuesBackground","#ffc80033",d(10759,null)),aOi=class{constructor(i,e){this.column=i;this.text=e}};function xmn(a){if(a.includes(",")&&a.includes("=")){let t=(o=>{let n=[],r=0,s=0;for(let u=0;u<o.length;u++)if(o[u]==="="){if(r===0){r++;continue}let p=o.lastIndexOf(",",u);p!==-1&&p>=s&&(n.push(p),s=p+1),r++}let l=[],c=0;for(let u of n)l.push(o.substring(c,u).trim()),c=u+1;return c<o.length&&l.push(o.substring(c).trim()),l})(a).map(o=>{let n=o.indexOf("=");if(n!==-1){let r=" ".repeat(n+2),[s,...l]=o.split(/\r?\n/);return[s,...l.map(c=>r+c)].join(`
`)}return o});return new he().appendCodeblock("",t.join(`,
`))}return new he().appendCodeblock("",a)}function Lve(a,i,e,t=1073741824,o=wmn){let n=i;return i.length>o&&(i=i.substring(0,o)+"..."),[{range:{startLineNumber:a,endLineNumber:a,startColumn:t,endColumn:t},options:{description:`${e}-inline-value-decoration-spacer`,after:{content:oF,cursorStops:3},showIfCollapsed:!0}},{range:{startLineNumber:a,endLineNumber:a,startColumn:t,endColumn:t},options:{description:`${e}-inline-value-decoration`,after:{content:kmn(i),inlineClassName:`${e}-inline-value`,inlineClassNameAffectsLetterSpacing:!0,cursorStops:3},showIfCollapsed:!0,hoverMessage:xmn(n)}}]}function kmn(a){return a.replace(/[ \t\n]/g,oF)}function Emn(a,i,e,t){let o=new Map;for(let r of a)if(o.set(r.name,r.value),o.size>=ymn)break;let n=new Map;return o.forEach((r,s)=>{let l=t.get(s);if(l)for(let c of l)i.some(u=>c>=u.startLineNumber&&c<=u.endLineNumber)&&(n.has(c)||n.set(c,[]),n.get(c).indexOf(s)===-1&&n.get(c).push(s))}),[...n].map(([r,s])=>({line:r,variables:s.sort((l,c)=>{let u=e.getLineContent(r);return u.indexOf(l)-u.indexOf(c)}).map(l=>({name:l,value:o.get(l)}))}))}function Tmn(a,i,e){if(a.getLineLength(i)>Cmn)return;let o=a.getLineContent(i);a.tokenization.forceTokenization(i);let n=a.tokenization.getLineTokens(i);for(let r=0,s=n.getCount();r<s;r++)if(n.getStandardTokenType(r)===0){AY.lastIndex=0;let c=n.getStartOffset(r),u=n.getEndOffset(r),p=o.substring(c,u),h=AY.exec(p);if(h){let g=h[0];e.has(g)||e.set(g,[]),e.get(g).push(i)}}}var P6=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.editor=i;this.debugService=e;this.instantiationService=t;this.commandService=o;this.configurationService=n;this.hostService=r;this.uriIdentityService=s;this.languageFeaturesService=c;this.editorService=p;this.mouseDown=!1;this.gutterIsHovered=!1;this.altListener=new ue;this.altPressed=!1;this.displayedStore=new O;this.allowScrollToExceptionWidget=!0;this.shouldScrollToExceptionWidget=()=>this.allowScrollToExceptionWidget;this.defaultHoverLockout=new ue;this.oldDecorations=this.editor.createDecorationsCollection(),this.debounceInfo=u.for(c.inlineValuesProvider,"InlineValues",{min:STo}),this.hoverWidget=this.instantiationService.createInstance(m1,this.editor),this.toDispose=[this.defaultHoverLockout,this.altListener,this.displayedStore],this.registerListeners(),this.exceptionWidgetVisible=LAt.bindTo(l),this.toggleExceptionWidget()}registerListeners(){this.toDispose.push(this.debugService.getViewModel().onDidFocusStackFrame(i=>this.onFocusStackFrame(i.stackFrame))),this.toDispose.push(this.editor.onMouseDown(i=>this.onEditorMouseDown(i))),this.toDispose.push(this.editor.onMouseUp(()=>this.mouseDown=!1)),this.toDispose.push(this.editor.onMouseMove(i=>this.onEditorMouseMove(i))),this.toDispose.push(this.editor.onMouseLeave(i=>{let e=this.hoverWidget.getDomNode();if(!e)return;let t=e.getBoundingClientRect();(i.event.posx<t.left||i.event.posx>t.right||i.event.posy<t.top||i.event.posy>t.bottom)&&this.hideHoverWidget()})),this.toDispose.push(this.editor.onKeyDown(i=>this.onKeyDown(i))),this.toDispose.push(this.editor.onDidChangeModelContent(()=>{this._wordToLineNumbersMap=void 0,this.updateInlineValuesScheduler.schedule()})),this.toDispose.push(this.debugService.getViewModel().onWillUpdateViews(()=>this.updateInlineValuesScheduler.schedule())),this.toDispose.push(this.debugService.getViewModel().onDidEvaluateLazyExpression(()=>this.updateInlineValuesScheduler.schedule())),this.toDispose.push(this.editor.onDidChangeModel(async()=>{this.addDocumentListeners(),this.toggleExceptionWidget(),this.hideHoverWidget(),this._wordToLineNumbersMap=void 0;let i=this.debugService.getViewModel().focusedStackFrame;await this.updateInlineValueDecorations(i)})),this.toDispose.push(this.editor.onDidScrollChange(()=>{this.hideHoverWidget();let i=this.editor.getModel();i&&this.languageFeaturesService.inlineValuesProvider.has(i)&&this.updateInlineValuesScheduler.schedule()})),this.toDispose.push(this.configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration("editor.hover")&&this.updateHoverConfiguration()})),this.toDispose.push(this.debugService.onDidChangeState(i=>{i!==2&&this.toggleExceptionWidget()})),this.updateHoverConfiguration()}updateHoverConfiguration(){let i=this.editor.getModel();i&&(this.editorHoverOptions=this.configurationService.getValue("editor.hover",{resource:i.uri,overrideIdentifier:i.getLanguageId()}))}addDocumentListeners(){let i=this.debugService.getViewModel().focusedStackFrame,e=this.editor.getModel();e&&this.applyDocumentListeners(e,i)}applyDocumentListeners(i,e){if(!e||!this.uriIdentityService.extUri.isEqual(i.uri,e.source.uri)){this.altListener.clear();return}let t=this.editor.getContainerDomNode().ownerDocument;this.altListener.value=$(t,"keydown",o=>{if(new mi(o).keyCode===6){this.altPressed=!0;let r=this.hoverWidget.isVisible();this.hoverWidget.hide(),this.defaultHoverLockout.clear(),r&&this.hoverPosition&&this.showEditorHover(this.hoverPosition.position,!1);let s=new Zn(t,"keyup"),l=U.any(this.hostService.onDidChangeFocus,s.event)(c=>{let u;sf(c)&&(u=new mi(c)),(!u||u.keyCode===6)&&(this.altPressed=!1,this.preventDefaultEditorHover(),l.dispose(),s.dispose())})}})}async showHover(i,e,t){this.preventDefaultEditorHover();let o=this.debugService.getViewModel().focusedStackFrame,n=this.editor.getModel();o&&n&&this.uriIdentityService.extUri.isEqual(o.source.uri,n.uri)?await this.hoverWidget.showAt(i,e,t)===1&&this.showEditorHover(i,e):this.showEditorHover(i,e)}preventDefaultEditorHover(){if(this.defaultHoverLockout.value||this.editorHoverOptions?.enabled==="off")return;this.editor.getContribution(ql.ID)?.hideContentHover(),this.editor.updateOptions({hover:{enabled:"off"}}),this.defaultHoverLockout.value={dispose:()=>{this.editor.updateOptions({hover:{enabled:this.editorHoverOptions?.enabled??"on"}})}}}showEditorHover(i,e){let t=this.editor.getContribution(ql.ID),o=new G(i.lineNumber,i.column,i.lineNumber,i.column);this.defaultHoverLockout.clear(),t?.showContentHover(o,1,0,e)}async onFocusStackFrame(i){let e=this.editor.getModel();e&&(this.applyDocumentListeners(e,i),i&&this.uriIdentityService.extUri.isEqual(i.source.uri,e.uri)?await this.toggleExceptionWidget():this.hideHoverWidget()),await this.updateInlineValueDecorations(i)}get hoverDelay(){let i=this.editorHoverOptions?.delay||0,e=jn(2-(i-300)/600,1,2);return i*e}get showHoverScheduler(){let i=new Dt(()=>{this.hoverPosition&&!this.altPressed&&this.showHover(this.hoverPosition.position,!1,this.hoverPosition.event)},this.hoverDelay);return this.toDispose.push(i),i}hideHoverWidget(){this.hoverWidget.willBeVisible()&&this.hoverWidget.hide(),this.showHoverScheduler.cancel(),this.defaultHoverLockout.clear()}onEditorMouseDown(i){this.mouseDown=!0,!(i.target.type===9&&i.target.detail===m1.ID)&&this.hideHoverWidget()}onEditorMouseMove(i){if(this.debugService.state!==2)return;let e=i.target,t=et?"metaKey":"ctrlKey";this.altPressed||(e.type===2?(this.defaultHoverLockout.clear(),this.gutterIsHovered=!0):this.gutterIsHovered&&(this.gutterIsHovered=!1,this.updateHoverConfiguration())),!((e.type===9&&e.detail===m1.ID||this.hoverWidget.isInSafeTriangle(i.event.posx,i.event.posy))&&((this.editorHoverOptions?.sticky??!0)||this.hoverWidget.isShowingComplexValue||i.event[t]))&&(e.type===6?e.position&&!ye.equals(e.position,this.hoverPosition?.position||null)&&!this.hoverWidget.isInSafeTriangle(i.event.posx,i.event.posy)&&(this.hoverPosition={position:e.position,event:i.event},this.preventDefaultEditorHover(),this.showHoverScheduler.schedule(this.hoverDelay)):this.mouseDown||this.hideHoverWidget())}onKeyDown(i){let e=et?57:5;i.keyCode!==e&&i.keyCode!==6&&this.hideHoverWidget()}async toggleExceptionWidget(){let i=this.editor.getModel(),e=this.debugService.getViewModel().focusedStackFrame,t=e?e.thread.getCallStack():null;if(!i||!e||!t||t.length===0){this.closeExceptionWidget();return}let o=t.find(r=>!!(r&&r.source&&r.source.available&&r.source.presentationHint!=="deemphasize"));if(!o||o!==e){this.closeExceptionWidget();return}let n=this.uriIdentityService.extUri.isEqual(o.source.uri,i.uri);if(this.exceptionWidget&&!n)this.closeExceptionWidget();else if(n){let s=this.editorService.activeTextEditorControl===this.editor,l=await e.thread.exceptionInfo;l&&(s?this.showExceptionWidget(l,this.debugService.getViewModel().focusedSession,o.range.startLineNumber,o.range.startColumn):this.showExceptionWidgetWithoutScroll(l,this.debugService.getViewModel().focusedSession,o.range.startLineNumber,o.range.startColumn))}}showExceptionWidget(i,e,t,o){this.exceptionWidget&&this.exceptionWidget.dispose(),this.exceptionWidget=this.instantiationService.createInstance(Ane,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidget.focus(),this.editor.revealRangeInCenter({startLineNumber:t,startColumn:o,endLineNumber:t,endColumn:o}),this.exceptionWidgetVisible.set(!0)}showExceptionWidgetWithoutScroll(i,e,t,o){this.exceptionWidget&&this.exceptionWidget.dispose(),this.allowScrollToExceptionWidget=!1;let n=this.editor.getScrollTop(),r=this.editor.getVisibleRanges();if(r.length===0){this.exceptionWidget=this.instantiationService.createInstance(Ane,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidgetVisible.set(!0),this.allowScrollToExceptionWidget=!0;return}let s=r[0].startLineNumber;if(this.exceptionWidget=this.instantiationService.createInstance(Ane,this.editor,i,e,this.shouldScrollToExceptionWidget),this.exceptionWidget.show({lineNumber:t,column:o},0),this.exceptionWidgetVisible.set(!0),t<s){let l=this.exceptionWidget.getWhitespaceHeight();this.editor.setScrollTop(n+l,1)}this.allowScrollToExceptionWidget=!0}closeExceptionWidget(){if(this.exceptionWidget){let i=this.exceptionWidget.hasFocus();this.exceptionWidget.dispose(),this.exceptionWidget=void 0,this.exceptionWidgetVisible.set(!1),i&&this.editor.focus()}}async addLaunchConfiguration(){let i=this.editor.getModel();if(!i)return;let e,t,o=()=>{let r=0;rE(i.getValue(),{onObjectProperty:s=>{t=s},onArrayBegin:s=>{t==="configurations"&&r===0&&(e=i.getPositionAt(s+1)),r++},onArrayEnd:()=>{r--}})};if(o(),!e){let{tabSize:r,insertSpaces:s}=i.getOptions(),l=i.getEOL(),c=Jo(i.uri.fsPath)==="launch.json"?rS(i.getValue(),["configurations"],[],{tabSize:r,insertSpaces:s,eol:l})[0]:rS(i.getValue(),["launch"],{configurations:[]},{tabSize:r,insertSpaces:s,eol:l})[0],u=i.getPositionAt(c.offset),p=u.lineNumber,h=new G(p,u.column,p,i.getLineMaxColumn(p));i.pushEditOperations(null,[Qn.replace(h,c.content)],()=>null),o()}if(!e)return;this.editor.focus(),await(r=>(i.getLineLastNonWhitespaceColumn(r.lineNumber)>r.column&&(this.editor.setPosition(r),this.instantiationService.invokeFunction(s=>{VL.LineBreakInsert.runEditorCommand(s,this.editor,null)})),this.editor.setPosition(r),this.commandService.executeCommand(Rue.ID)))(e),await this.commandService.executeCommand("editor.action.triggerSuggest")}get removeInlineValuesScheduler(){return new Dt(()=>{this.displayedStore.clear(),this.oldDecorations.clear()},100)}get updateInlineValuesScheduler(){let i=this.editor.getModel();return new Dt(async()=>await this.updateInlineValueDecorations(this.debugService.getViewModel().focusedStackFrame),i?this.debounceInfo.get(i):STo)}async updateInlineValueDecorations(i){let e="{0} = {1}",o=this.editor.getModel(),n=this.configurationService.getValue("debug").inlineValues;if(!(n===!0||n==="on"||n==="auto"&&o&&this.languageFeaturesService.inlineValuesProvider.has(o))||!o||!i||o.uri.toString()!==i.source.uri.toString()){this.removeInlineValuesScheduler.isScheduled()||this.removeInlineValuesScheduler.schedule();return}this.removeInlineValuesScheduler.cancel(),this.displayedStore.clear();let s=this.editor.getVisibleRangesPlusViewportAboveBelow(),l,c=new qe;if(this.displayedStore.add(ee(()=>c.dispose(!0))),this.languageFeaturesService.inlineValuesProvider.has(o)){let p=async(S,y)=>{let w=await i.getMostSpecificScopes(i.range),x=y?S:S.toLowerCase();for(let E of w){let N=(await E.getChildren()).find(V=>y?V.name===x:V.name.toLowerCase()===x);if(N)return N.value}},h={frameId:i.frameId,stoppedLocation:new G(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1)},g=this.languageFeaturesService.inlineValuesProvider.ordered(o).reverse();l=[];let f=new Map,v=g.flatMap(S=>s.map(y=>Promise.resolve(S.provideInlineValues(o,y,h,c.token)).then(async w=>{if(w)for(let x of w){let E;switch(x.type){case"text":E=x.text;break;case"variable":{let M=x.variableName;M||(M=o.getLineContent(x.range.startLineNumber).substring(x.range.startColumn-1,x.range.endColumn-1));let N=await p(M,x.caseSensitiveLookup);N&&(E=Wd(e,M,N));break}case"expression":{let M=x.expression;if(M||(M=o.getLineContent(x.range.startLineNumber).substring(x.range.startColumn-1,x.range.endColumn-1)),M){let N=new Fd(M);await N.evaluate(i.thread.session,i,"watch",!0),N.available&&(E=Wd(e,M,N.value))}break}}if(E){let M=x.range.startLineNumber,N=f.get(M);N||(N=[],f.set(M,N)),N.some(V=>V.text===E)||N.push(new aOi(x.range.startColumn,E))}}},w=>{vs(w)}))),b=Date.now();await Promise.all(v),this.updateInlineValuesScheduler.delay=this.debounceInfo.update(o,Date.now()-b),f.forEach((S,y)=>{if(S.length>0){S=S.sort((N,V)=>N.column-V.column);let w=S.map(N=>N.text).join(", "),x=this.editor.getLayoutInfo().width,E=this.editor.getOption(59),M=Math.floor((x-50)/E.typicalHalfwidthCharacterWidth);l.push(...Lve(y,w,"debug",void 0,M))}})}else{let p=await i.getMostSpecificScopes(i.range),h=await Promise.all(p.map(async f=>({scope:f,variables:await f.getChildren()}))),g=new Map;for(let{scope:f,variables:v}of h){let b=new G(0,0,i.range.startLineNumber,i.range.startColumn);f.range&&(b=b.setStartPosition(f.range.startLineNumber,f.range.startColumn));let S=s.map(w=>w.intersectRanges(b)).filter(so);this._wordToLineNumbersMap??=new lOi(o);for(let w of S)this._wordToLineNumbersMap.ensureRangePopulated(w);let y=Emn(v,S,o,this._wordToLineNumbersMap.value);for(let{line:w,variables:x}of y){let E=g.get(w);E||(E=new Map,g.set(w,E));for(let{name:M,value:N}of x)E.has(M)||E.set(M,N)}}l=[...g.entries()].flatMap(([f,v])=>{let b=[...v].map(([x,E])=>`${x} = ${E}`).join(", "),S=this.editor.getLayoutInfo().width,y=this.editor.getOption(59),w=Math.floor((S-50)/y.typicalHalfwidthCharacterWidth);return Lve(f,b,"debug",void 0,w)})}if(c.token.isCancellationRequested)return;let u;if(this.editor.getOption(149)!=="off"){let p=this.editor.getPosition();p&&this.editor.getVisibleRanges().some(h=>h.containsPosition(p))&&(u={position:p,top:this.editor.getTopForPosition(p.lineNumber,p.column)})}if(this.oldDecorations.set(l),u){let p=this.editor.getTopForPosition(u.position.lineNumber,u.position.column);this.editor.setScrollTop(this.editor.getScrollTop()-(u.top-p),1)}}dispose(){this.hoverWidget?.dispose(),this.configurationWidget?.dispose(),this.exceptionWidget?.dispose(),this.toDispose=je(this.toDispose)}};I([bi],P6.prototype,"showHoverScheduler",1),I([bi],P6.prototype,"removeInlineValuesScheduler",1),I([bi],P6.prototype,"updateInlineValuesScheduler",1),P6=I([m(1,Hi),m(2,F),m(3,fe),m(4,B),m(5,ti),m(6,gt),m(7,X),m(8,Jt),m(9,Gf),m(10,ie)],P6);var lOi=class{constructor(i){this.model=i;this.value=new Map;this.intervals=new Uint8Array(Math.ceil(i.getLineCount()/8))}ensureRangePopulated(i){for(let e=i.startLineNumber;e<=i.endLineNumber;e++){let t=e>>3,o=1<<(e&7);this.intervals[t]&o||(Tmn(this.model,e,this.value),this.intervals[t]|=o)}}};Ge.registerCommand("_executeInlineValueProvider",async(a,i,e,t)=>{if(To(A.isUri(i)),To(G.isIRange(e)),!t||typeof t.frameId!="number"||!G.isIRange(t.stoppedLocation))throw ls("context");let o=a.get(_t).getModel(i);if(!o)throw ls("uri");let n=G.lift(e),{inlineValuesProvider:r}=a.get(Jt),s=r.ordered(o);return(await Promise.all(s.map(c=>c.provideInlineValues(o,n,t,Ie.None)))).flat().filter(so)});var H$t=class{constructor(i,e){this.column=i;this.text=e}},xV=class extends k{constructor(e,t,o,n,r,s){super();this.notebookEditor=e;this.notebookKernelService=t;this.notebookExecutionStateService=o;this.languageFeaturesService=n;this.configurationService=r;this.debugService=s;this.cellDecorationIds=new Map;this.cellContentListeners=new dt;this.currentCancellationTokenSources=new dt;this._register(this.notebookExecutionStateService.onDidChangeExecution(async l=>{this.configurationService.getValue(Ct.notebookInlineValues)!=="off"&&l.type===0&&await this.updateInlineVariables(l)})),this._register(U.runAndSubscribe(this.configurationService.onDidChangeConfiguration,l=>{(!l||l.affectsConfiguration(Ct.notebookInlineValues))&&this.configurationService.getValue(Ct.notebookInlineValues)==="off"&&this.clearNotebookInlineDecorations()}))}static{this.id="notebook.inlineVariablesController"}static{this.MAX_CELL_LINES=5e3}async updateInlineVariables(e){if(e.changed)return;let t=this.notebookEditor.getCellByHandle(e.cellHandle);if(!t)return;let o=this.currentCancellationTokenSources.get(t.uri);o&&o.cancel(),this.currentCancellationTokenSources.set(t.uri,new qe);let n=this.currentCancellationTokenSources.get(t.uri).token;if(this.debugService.state!==0){this._clearNotebookInlineDecorations();return}if(!this.notebookEditor.textModel?.uri||!ze(this.notebookEditor.textModel.uri,e.notebook))return;let r=await t.resolveTextModel();if(!r)return;let s=this.configurationService.getValue(Ct.notebookInlineValues),l=this.languageFeaturesService.inlineValuesProvider.has(r);if(s==="off"||s==="auto"&&!l)return;this.clearCellInlineDecorations(t);let c=[];if(l){let u=r.getLineCount(),p=r.getLineMaxColumn(u),h={frameId:0,stoppedLocation:new G(u,p,u,p)},g=this.languageFeaturesService.inlineValuesProvider.ordered(r).reverse(),f=new Map,v=new G(1,1,u,p),b=g.flatMap(S=>Promise.resolve(S.provideInlineValues(r,v,h,n)).then(async y=>{if(!y)return;let w=this.notebookEditor.textModel;if(!w)return;let x=this.notebookKernelService.getMatchingKernel(w),E=[];if(y.some(M=>M.type==="variable")){if(!this.notebookEditor.hasModel())return;let M=x.selected?.provideVariables(e.notebook,void 0,"named",0,n);if(M)for await(let N of M)E.push(N)}for(let M of y){let N;switch(M.type){case"text":N=M.text;break;case"variable":{let V=M.variableName;if(!V)continue;let H=E.find(K=>K.name===V)?.value;if(!H)continue;N=Wd("{0} = {1}",V,H);break}case"expression":continue}if(N){let V=M.range.startLineNumber,H=f.get(V);H||(H=[],f.set(V,H)),H.some(K=>K.text===N)||H.push(new H$t(M.range.startColumn,N))}}},y=>{vs(y)}));await Promise.all(b),f.forEach((S,y)=>{if(S.length>0){S.sort((M,N)=>M.column-N.column);let w=S.map(M=>M.text).join(", "),x=t.layoutInfo.editorWidth,E=t.layoutInfo.fontInfo;if(E&&t.textModel){let M=Math.floor((x-50)/E.typicalHalfwidthCharacterWidth),N=t.textModel.getLineLength(y),V=Math.max(0,M-N);c.push(...Lve(y,w,"nb",void 0,V))}else c.push(...Lve(y,w,"nb"))}})}else if(s==="on"){if(!this.notebookEditor.hasModel())return;let p=this.notebookKernelService.getMatchingKernel(this.notebookEditor.textModel)?.selected?.provideVariables(e.notebook,void 0,"named",0,n);if(!p)return;let h=[];for await(let x of p)h.push(x);let g=h.map(x=>x.name),f=t.textModel;if(!f||f.getLineCount()>xV.MAX_CELL_LINES)return;let v=new Set,b=this.getFunctionRanges(f),S=this.getCommentedRanges(f),y=[...b,...S],w=new Map;for(let x of g){if(v.has(x))continue;let E=new RegExp(`\\b${x}\\b(?!\\w)`,"g"),M=null,N=!1,V=f.getValue().split(`
`);for(let H=V.length-1;H>=0;H--){let K=V[H],j;for(;(j=E.exec(K))!==null;){let J=j.index,se=new ye(H+1,J+1);if(!this.isPositionInRanges(se,y)){M={line:H+1,column:J+1},N=!0;break}}if(N)break}if(M){let H=x+" = "+h.find(j=>j.name===x)?.value,K=w.get(M.line);K||(K=[],w.set(M.line,K)),K.some(j=>j.text===H)||K.push(new H$t(M.column,H))}v.add(x)}w.forEach((x,E)=>{if(x.length>0){x.sort((H,K)=>H.column-K.column);let M=x.map(H=>H.text).join(", "),N=t.layoutInfo.editorWidth,V=t.layoutInfo.fontInfo;if(V&&t.textModel){let H=Math.floor((N-50)/V.typicalHalfwidthCharacterWidth),K=t.textModel.getLineLength(E),j=Math.max(0,H-K);c.push(...Lve(E,M,"nb",void 0,j))}else c.push(...Lve(E,M,"nb"))}})}c.length>0&&(this.updateCellInlineDecorations(t,c),this.initCellContentListener(t))}getFunctionRanges(e){return e.getLanguageId()==="python"?this.getPythonFunctionRanges(e.getValue()):this.getBracedFunctionRanges(e.getValue())}getPythonFunctionRanges(e){let t=[],o=e.split(`
`),n=-1,r=!1,s=-1,l=/^(\s*)(async\s+)?(?:def\s+\w+|class\s+\w+)\s*\([^)]*\)\s*:/;for(let c=0;c<o.length;c++){let u=o[c],p=u.match(l);if(p){r&&p[1].length<=s&&(t.push(new G(n+1,1,c,u.length+1)),r=!1),r||(r=!0,n=c,s=p[1].length);continue}if(r){if(u.trim()==="")continue;(u.match(/^\s*/)?.[0].length??0)<=s&&(t.push(new G(n+1,1,c,u.length+1)),r=!1,s=-1)}}return r&&t.push(new G(n+1,1,o.length,o[o.length-1].length+1)),t}getBracedFunctionRanges(e){let t=[],o=e.split(`
`),n=0,r=-1,s=!1,l=/\b(?:function\s+\w+|(?:async\s+)?(?:\w+\s*=\s*)?\([^)]*\)\s*=>|class\s+\w+|(?:public|private|protected|static)?\s*\w+\s*\([^)]*\)\s*{)/;for(let c=0;c<o.length;c++){let u=o[c];for(let p of u)p==="{"?(!s&&l.test(u)&&(s=!0,r=c),n++):p==="}"&&(n--,n===0&&s&&(t.push(new G(r+1,1,c+1,u.length+1)),s=!1))}return t}getCommentedRanges(e){return this._getCommentedRanges(e)}_getCommentedRanges(e){try{return this.getCommentedRangesByAccurateTokenization(e)}catch{return this.getCommentedRangesByManualParsing(e)}}getCommentedRangesByAccurateTokenization(e){let t=[],o=e.getLineCount();if(o>xV.MAX_CELL_LINES)return t;for(let n=1;n<=o;n++){e.tokenization.hasAccurateTokensForLine(n)||e.tokenization.forceTokenization(n);let r=e.tokenization.getLineTokens(n);if(r.getCount()===0)continue;let s;for(let l=0;l<r.getCount();l++){let c=r.getStandardTokenType(l);if(c===1||c===2||c===3){s===void 0&&(s=r.getStartOffset(l));let u=r.getEndOffset(l),p=l===r.getCount()-1,h=!p&&r.getStandardTokenType(l+1)!==c;(p||h)&&(t.push(new G(n,s+1,n,u+1)),s=void 0)}else s=void 0}}return t}getCommentedRangesByManualParsing(e){let t=[],o=e.getValue().split(`
`),n=e.getLanguageId(),r=n==="python"?"#":n==="javascript"||n==="typescript"?"//":null,s=n==="javascript"||n==="typescript"?{start:"/*",end:"*/"}:null,l=!1,c=-1,u=-1;for(let p=0;p<o.length;p++){let h=o[p];if(h.trim().length!==0){if(s){if(!l){let f=h.indexOf(s.start);f!==-1&&(l=!0,c=p,u=f)}if(l){let f=h.indexOf(s.end);f!==-1&&(t.push(new G(c+1,u+1,p+1,f+s.end.length+1)),l=!1);continue}}if(!l&&r&&h.trimLeft().startsWith(r)){let f=h.indexOf(r);t.push(new G(p+1,f+1,p+1,h.length+1))}}}return l&&t.push(new G(c+1,u+1,o.length,o[o.length-1].length+1)),t}isPositionInRanges(e,t){return t.some(o=>o.containsPosition(e))}updateCellInlineDecorations(e,t){let o=this.cellDecorationIds.get(e)??[];this.cellDecorationIds.set(e,e.deltaModelDecorations(o,t))}initCellContentListener(e){let t=e.textModel;t&&this.cellContentListeners.set(e.uri,t.onDidChangeContent(()=>{this.clearCellInlineDecorations(e)}))}clearCellInlineDecorations(e){let t=this.cellDecorationIds.get(e)??[];t&&(e.deltaModelDecorations(t,[]),this.cellDecorationIds.delete(e));let o=this.cellContentListeners.get(e.uri);o&&(o.dispose(),this.cellContentListeners.delete(e.uri))}_clearNotebookInlineDecorations(){this.cellDecorationIds.forEach((e,t)=>{this.clearCellInlineDecorations(t)})}clearNotebookInlineDecorations(){this._clearNotebookInlineDecorations()}dispose(){super.dispose(),this._clearNotebookInlineDecorations(),this.currentCancellationTokenSources.forEach(e=>e.cancel()),this.currentCancellationTokenSources.clear(),this.cellContentListeners.forEach(e=>e.dispose()),this.cellContentListeners.clear()}};xV=I([m(1,Ql),m(2,Ns),m(3,Jt),m(4,B),m(5,Hi)],xV);Hm(xV.id,xV);W(class extends Np{constructor(){super({id:"notebook.clearAllInlineValues",title:d(13550,null)})}runWithContext(i,e){return e.notebookEditor.getContribution(xV.id).clearNotebookInlineDecorations(),Promise.resolve()}});var _mn="notebook.clearAllCellsOutputs",Dmn="notebook.cell.edit",Rmn="notebook.cell.delete",ITo="notebook.quitEditAllCells",Lmn="notebook.cell.clearOutputs",cOi="notebook.selectIndentation",Mmn="notebook.commentSelectedCells";W(class extends iu{constructor(){super({id:Dmn,title:d(13624,null),keybinding:{when:C.and(Ap,C.not(Dp),me.hoverFocused.toNegated(),Fie.toNegated()),primary:3,weight:200},menu:{id:R.NotebookCellTitle,when:C.and(cc.isEqualTo(!0),lI.isEqualTo("markup"),Wie.toNegated(),OC),order:1,group:YW},icon:vIo})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;await e.notebookEditor.focusNotebookCell(e.cell,"editor");let t=e.cell?Bie(e,e.cell):void 0;t&&t.hasTextFocus()&&fu.get(t)?.getWidgetPosition()?.lineNumber===t.getPosition()?.lineNumber&&fu.get(t)?.focus()}});var yTo=C.and(wr,Wg,Nq.toNegated());W(class extends iu{constructor(){super({id:Vbi,title:d(13625,null),menu:{id:R.NotebookCellTitle,when:C.and(lI.isEqualTo("markup"),Wie,OC),order:4,group:YW},icon:bIo,keybinding:[{when:C.and(yTo,me.hoverVisible.toNegated(),me.hasNonEmptySelection.toNegated(),me.hasMultipleSelections.toNegated()),primary:9,weight:ov-5},{when:C.and(wr,vP),primary:9,weight:205},{when:C.and(yTo,lI.isEqualTo("markup")),primary:259,win:{primary:2563},weight:ov-5}]})}async runWithContext(i,e){e.cell.cellKind===1&&e.cell.updateEditState(0,Vbi),await e.notebookEditor.focusNotebookCell(e.cell,"container",{skipReveal:!0})}});W(class extends Np{constructor(){super({id:ITo,title:d(13626,null)})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;let t=e.notebookEditor.getViewModel();if(!t)return;let o=e.notebookEditor.getActiveCell();t.viewCells.filter(r=>r.cellKind===1&&r.getEditState()===1).forEach(r=>{r.updateEditState(0,ITo)}),o&&await e.notebookEditor.focusNotebookCell(o,"container",{skipReveal:!0})}});W(class extends iu{constructor(){super({id:Rmn,title:d(13623,null),keybinding:{primary:20,mac:{primary:2049},when:C.and(wr,C.not(Dp),Fie.toNegated()),weight:200},menu:[{id:R.NotebookCellDelete,when:cc,group:YW},{id:R.InteractiveCellDelete,group:YW}],icon:gIo})}async runWithContext(i,e){if(!e.notebookEditor.hasModel())return;let t,n=i.get(Ns).getCellExecution(e.cell.uri)?.state,r=i.get(B);if(n===3&&r.getValue(Ct.confirmDeleteRunningCell)){let s=i.get(ct),l=d(13612,null);t=await s.confirm({type:"question",message:d(13613,null),primaryButton:l,checkbox:{label:d(13615,null)}})}else t={confirmed:!0};t.confirmed&&(t.checkboxChecked===!0&&await r.updateValue(Ct.confirmDeleteRunningCell,!1),owo(e.notebookEditor,e.cell))}});W(class extends iu{constructor(){super({id:Lmn,title:d(13610,null),menu:[{id:R.NotebookCellTitle,when:C.and(lI.isEqualTo("code"),lLi,PE,cc,OC,Cnt.toNegated()),order:6,group:dIo},{id:R.NotebookOutputToolbar,when:C.and(PE,cc,OC,kKt,Cnt)}],keybinding:{when:C.and(wr,C.not(Dp),PE,cc,OC),primary:532,weight:200},icon:dLi})}async runWithContext(i,e){let t=i.get(Ns),o=e.notebookEditor;if(!o.hasModel()||!o.textModel.length)return;let n=e.cell,r=o.textModel.cells.indexOf(n.model);if(r<0)return;let s=!o.isReadOnly;o.textModel.applyEdits([{editType:2,index:r,outputs:[]}],!0,void 0,()=>{},void 0,s),t.getCellExecution(e.cell.uri)?.state!==3&&e.notebookEditor.textModel.applyEdits([{editType:9,index:r,internalMetadata:{runStartTime:null,runStartTimeAdjustment:null,runEndTime:null,executionOrder:null,lastRunSuccess:null}}],!0,void 0,()=>{},void 0,s)}});W(class extends Np{constructor(){super({id:_mn,title:d(13609,null),precondition:_Kt,menu:[{id:R.EditorTitle,when:C.and(nl,C.notEquals("config.notebook.globalToolbar",!0)),group:"navigation",order:0},{id:R.NotebookToolbar,when:C.and(lLi,C.equals("config.notebook.globalToolbar",!0)),group:"navigation/execute",order:10}],icon:dLi})}async runWithContext(i,e){let t=i.get(Ns),o=e.notebookEditor;if(!o.hasModel()||!o.textModel.length)return;let n=!o.isReadOnly;o.textModel.applyEdits(o.textModel.cells.map((l,c)=>({editType:2,index:c,outputs:[]})),!0,void 0,()=>{},void 0,n);let r=o.textModel.cells.map((l,c)=>{if(t.getCellExecution(l.uri)?.state!==3)return{editType:9,index:c,internalMetadata:{runStartTime:null,runStartTimeAdjustment:null,runEndTime:null,executionOrder:null,lastRunSuccess:null}}}).filter(l=>!!l);r.length&&e.notebookEditor.textModel.applyEdits(r,!0,void 0,()=>{},void 0,n),o.getContribution(xV.id).clearNotebookInlineDecorations()}});W(class extends iu{constructor(){super({id:AMt,title:d(13608,null),keybinding:{weight:200,primary:Gi(2089,43),when:C.and(wr,cc,OC)},metadata:{description:d(13608,null),args:[{name:"range",description:"The cell range",schema:{type:"object",required:["start","end"],properties:{start:{type:"number"},end:{type:"number"}}}},{name:"language",description:"The target cell language",schema:{type:"string"}}]}})}getCellContextFromArgs(i,e,...t){if(!e||typeof e.start!="number"||typeof e.end!="number"||e.start>=e.end)return;let o=t.length&&typeof t[0]=="string"?t[0]:void 0,n=this.getEditorContextFromArgsOrActive(i);if(!(!n||!n.notebookEditor.hasModel()||e.start>=n.notebookEditor.getLength()))return{notebookEditor:n.notebookEditor,cell:n.notebookEditor.cellAt(e.start),language:o}}async runWithContext(i,e){e.language?await this.setLanguage(e,e.language):await this.showLanguagePicker(i,e)}async showLanguagePicker(i,e){let t=[],o=[],n=i.get(Rt),r=i.get(_t),s=i.get($e),l=i.get(jS),c=i.get(Ql),u=e.notebookEditor.activeKernel?.supportedLanguages;if(!u){let S=c.getMatchingKernel(e.notebookEditor.textModel).all.flatMap(y=>y.supportedLanguages);u=S.length>0?S:n.getRegisteredLanguageIds()}new Set([...u,"markdown"]).forEach(b=>{let S;(e.cell.cellKind===1?b==="markdown":b===e.cell.language)?S=d(13618,null,b):S=d(13619,null,b);let y=n.getLanguageName(b);if(!y)return;let w={label:y,iconClasses:Ia(r,n,this.getFakeResource(y,n)),description:S,languageId:b};b==="markdown"||b===e.cell.language?t.push(w):o.push(w)}),o.sort((b,S)=>b.description.localeCompare(S.description));let h={label:d(13607,null)},g=[h,{type:"separator",label:d(13620,null)},...t,{type:"separator"},...o],f=await s.pick(g,{placeHolder:d(13629,null)}),v=f===h?await l.detectLanguage(e.cell.uri):f?.languageId;v&&await this.setLanguage(e,v)}async setLanguage(i,e){await wTo(e,i)}getFakeResource(i,e){let t,o=e.getLanguageIdByLanguageName(i);if(o){let n=e.getExtensions(o);if(n.length)t=A.file(n[0]);else{let r=e.getFilenames(o);r.length&&(t=A.file(r[0]))}}return t}});W(class extends iu{constructor(){super({id:gYe,title:P(13614,"Accept Detected Language for Cell"),f1:!0,precondition:C.and(cc,OC),keybinding:{primary:1570,weight:200}})}async runWithContext(i,e){let t=i.get(jS),o=i.get(Ne),s=[...i.get(Ql).getSelectedOrSuggestedKernel(e.notebookEditor.textModel)?.supportedLanguages??[]];s.push("markdown");let l=await t.detectLanguage(e.cell.uri,s);l?wTo(l,e):o.warn(d(13621,null))}});async function wTo(a,i){if(a==="markdown"&&i.cell?.language!=="markdown"){let e=i.notebookEditor.getCellIndex(i.cell);await eFe(1,{cell:i.cell,notebookEditor:i.notebookEditor,ui:!0},"markdown",cr.markdown);let t=i.notebookEditor.cellAt(e);t&&await i.notebookEditor.focusNotebookCell(t,"editor")}else if(a!=="markdown"&&i.cell?.cellKind===1)await eFe(2,{cell:i.cell,notebookEditor:i.notebookEditor,ui:!0},a);else{let e=i.notebookEditor.textModel.cells.indexOf(i.cell.model);i.notebookEditor.textModel.applyEdits([{editType:4,index:e,language:a}],!0,void 0,()=>{},void 0,!i.notebookEditor.isReadOnly)}}W(class extends Np{constructor(){super({id:cOi,title:P(13630,"Select Indentation"),f1:!0,precondition:C.and(nl,cc,OC)})}async runWithContext(i,e){await this.showNotebookIndentationPicker(i,e)}async showNotebookIndentationPicker(i,e){let t=i.get($e),o=i.get(ie),n=i.get(F),r=lr(o.activeEditorPane);if(!r||r.isDisposed)return t.pick([{label:d(13622,null)}]);if(r.isReadOnly)return t.pick([{label:d(13627,null)}]);let s=[new $st,new jst,new Qst,new Xst,new Yst].map(c=>({id:c.desc.id,label:c.desc.title.toString(),run:()=>{n.invokeFunction(c.run)}}));s.splice(3,0,{type:"separator",label:d(13616,null)}),s.unshift({type:"separator",label:d(13617,null)});let l=await t.pick(s,{placeHolder:d(13628,null),matchOnDetail:!0});l&&(l.run(),e.notebookEditor.focus())}});W(class extends kf{constructor(){super({id:Mmn,title:d(13611,null),keybinding:{when:C.and(wr,cc,C.not(Dp)),primary:2138,weight:200}})}async runWithContext(i,e){let t=i.get(Us);e.selectedCells.forEach(async o=>{let n=await o.resolveTextModel(),r=o.commentOptions,s=new qEe(t,new ei(1,1,n.getLineCount(),n.getLineMaxColumn(n.getLineCount())),n.getOptions().tabSize,0,r.insertSpace??!0,r.ignoreEmptyLines??!0,!1),l=o.getSelections(),c=l.map(p=>n._setTrackedRange(null,p,1));FX.executeCommands(n,l,[s]);let u=c.map(p=>n._getTrackedRange(p)).filter(p=>!!p).map(p=>new ei(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn));o.setSelections(u??[])})}});Ge.registerCommand("_resolveNotebookContentProvider",a=>a.get(kn).getContributedNotebookTypes().map(t=>{let o=t.selectors.map(n=>typeof n=="string"||GA(n)?n:aLt(n)?{include:n.include,exclude:n.exclude}:null).filter(n=>n!==null);return{viewType:t.id,displayName:t.displayName,filenamePattern:o,options:{transientCellMetadata:t.options.transientCellMetadata,transientDocumentMetadata:t.options.transientDocumentMetadata,transientOutputs:t.options.transientOutputs}}}));Ge.registerCommand("_resolveNotebookKernels",async(a,i)=>{let e=a.get(Ql),t=A.revive(i.uri);return e.getMatchingKernel({uri:t,notebookType:i.viewType}).all.map(n=>({id:n.id,label:n.label,description:n.description,detail:n.detail,isPreferred:!1,preloads:n.preloadUris}))});function A6(a){return a.replace(/[-\\^\]]/g,"\\$&")}function NP(a,i,e,t=!1){let o=Rk(i.column,e,a.getLineContent(i.lineNumber),0);if(!o&&a.getWordUntilPosition(i).word||!o&&i.column>1&&a.getValueInRange(new G(i.lineNumber,i.column-1,i.lineNumber,i.column))!==" "||o&&t&&a.getWordUntilPosition({lineNumber:i.lineNumber,column:o.startColumn}).word)return;let n,r;return o?(n=new G(i.lineNumber,o.startColumn,i.lineNumber,i.column),r=new G(i.lineNumber,o.startColumn,i.lineNumber,o.endColumn)):n=r=G.fromPositions(i),{insert:n,replace:r,varWord:o}}function Nne(a,i){let e=new G(1,1,i.replace.startLineNumber,i.replace.startColumn);return!!a.getValueInRange(e).match(/^\s*$/)}function CTo(a,i,e){if(e.length===0)return!1;let o=a.getLineContent(i.lineNumber).slice(0,i.column-1),n=o.search(/\s\S*$/),r=n>=0?o.slice(n+1):o;return r.length===0?!1:e.includes(r[0])}var Mve=new Y("notebookChatAgentRegistered",!1,d(13602,null));async function xTo(a,i,e,t,o,n){let r=a.get(B),s=a.get(fe);if(r.getValue(Ct.cellGenerate)||r.getValue(Ct.cellChat)){let l=i.notebookEditor.getActiveCell(),c=l?.getTextLength()===0&&n!=="insertToolbar"?l:await IMi(a,i,2,"below",!0);if(c){c.enableAutoLanguageDetection(),await i.notebookEditor.revealFirstLineIfOutsideViewport(c);let u=i.notebookEditor.codeEditors.find(p=>p[0]===c)?.[1];u&&(u.focus(),s.executeCommand("inlineChat.start"))}}}W(class extends Np{constructor(){super({id:"notebook.cell.chat.start",title:{value:"$(sparkle) "+d(13594,null),original:"$(sparkle) Generate"},tooltip:d(13595,null),metadata:{description:d(13595,null),args:[{name:"args",schema:{type:"object",required:["index"],properties:{index:{type:"number"},input:{type:"string"},autoSend:{type:"boolean"}}}}]},f1:!1,keybinding:{when:C.and(wr,cc.isEqualTo(!0),C.not(Dp),Mve,C.or(C.equals(`config.${Ct.cellChat}`,!0),C.equals(`config.${Ct.cellGenerate}`,!0))),weight:200,primary:2087,secondary:[Gi(2089,39)]},menu:[{id:R.NotebookCellBetween,group:"inline",order:-1,when:C.and(cc.isEqualTo(!0),Mve,C.or(C.equals(`config.${Ct.cellChat}`,!0),C.equals(`config.${Ct.cellGenerate}`,!0)))}]})}getEditorContextFromArgsOrActive(a,...i){let[e]=i;if(!e){let n=FNe(a);if(!n)return;let r=n.getActiveCell();return r?{cell:r,notebookEditor:n,input:void 0,autoSend:void 0}:void 0}if(typeof e!="object"||typeof e.index!="number")return;let t=FNe(a);return t?{cell:e.index<=0?void 0:t.cellAt(e.index-1),notebookEditor:t,input:e.input,autoSend:e.autoSend}:void 0}async runWithContext(a,i){let e=Math.max(0,i.cell?i.notebookEditor.getCellIndex(i.cell)+1:0);await xTo(a,i,e,i.input,i.autoSend,i.source)}});W(class extends Np{constructor(){super({id:"notebook.cell.chat.startAtTop",title:{value:"$(sparkle) "+d(13594,null),original:"$(sparkle) Generate"},tooltip:d(13595,null),f1:!1,menu:[{id:R.NotebookCellListTop,group:"inline",order:-1,when:C.and(cc.isEqualTo(!0),Mve,C.or(C.equals(`config.${Ct.cellChat}`,!0),C.equals(`config.${Ct.cellGenerate}`,!0)))}]})}async runWithContext(a,i){await xTo(a,i,0,"",!1)}});be.appendMenuItem(R.NotebookToolbar,{command:{id:"notebook.cell.chat.start",icon:L.sparkle,title:d(13592,null),tooltip:d(13593,null)},order:-10,group:"navigation/add",when:C.and(cc.isEqualTo(!0),C.notEquals("config.notebook.insertToolbarLocation","betweenCells"),C.notEquals("config.notebook.insertToolbarLocation","hidden"),Mve,C.or(C.equals(`config.${Ct.cellChat}`,!0),C.equals(`config.${Ct.cellGenerate}`,!0)))});var dOi=class extends yl{constructor(){super({id:"notebook.inlineChat.acceptChangesAndRun",title:P(13589,"Accept and Run"),shortTitle:d(13590,null),tooltip:d(13591,null),icon:L.check,f1:!0,precondition:C.and(cc.isEqualTo(!0),XU),keybinding:void 0,menu:[{id:R.ChatEditorInlineExecute,group:"0_main",order:2,when:C.and(cc.isEqualTo(!0),Z.inputHasText.toNegated(),lwo.toNegated())}]})}runEditorCommand(i,e){let t=Uge(i.get(ie)),o=fu.get(e);if(!t||!o)return;let r=t.notebookEditor.codeEditors.find(s=>s[1]===e)?.[0];if(r)return o.acceptSession(),t.notebookEditor.executeNotebookCells(yt.single(r))}};W(dOi);var U$t="kernelVariable",XWe=class extends k{constructor(e,t,o,n,r,s,l){super();this.editorService=o;this.chatWidgetService=n;this.notebookKernelService=r;this.languageFeaturesService=s;this._register(l.registerChatContextItem(new fat(this.editorService,this.notebookKernelService))),this._ctxHasProvider=Mve.bindTo(e);let c=()=>{let u=!!t.getDefaultAgent("notebook");this._ctxHasProvider.set(u)};c(),this._register(t.onDidChangeAgents(c)),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatKernelDynamicCompletions",triggerCharacters:[dp],provideCompletionItems:async(u,p,h,g)=>{let f=this.chatWidgetService.getWidgetByInputUri(u.uri);if(!f||!f.supportsFileReferences||f.location!=="notebook")return null;let v=new RegExp(`${dp}\\w*`,"g"),b=NP(u,p,v,!0);if(!b)return null;let S={suggestions:[]},y=new G(p.lineNumber,b.replace.startColumn,p.lineNumber,b.replace.startColumn+`${dp}${U$t}:`.length);return S.suggestions.push({label:`${dp}${U$t}`,insertText:`${dp}${U$t}:`,detail:d(13600,null),range:b,kind:18,command:{id:Pve.ID,title:Pve.ID,arguments:[{widget:f,range:y}]},sortText:"z"}),await this.addKernelVariableCompletion(f,S,b,g),S}})),aLi.bindTo(e).set(Art)}static{this.ID="workbench.contrib.notebookChatContribution"}async addKernelVariableCompletion(e,t,o,n){let r;o.varWord?.word&&o.varWord.word.startsWith(dp)&&(r=o.varWord.word.toLowerCase().slice(1));let s=lr(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;if(!s)return;let l=this.notebookKernelService.getMatchingKernel(s).selected;if(!l?.hasVariableProvider)return;let u=l.provideVariables(s.uri,void 0,"named",0,Ie.None);for await(let p of u)r&&!p.name.toLowerCase().includes(r)||t.suggestions.push({label:{label:p.name,description:p.type},insertText:`${dp}${U$t}:${p.name} `,filterText:`${dp}${p.name}`,range:o,kind:4,sortText:"z",command:{id:Pve.ID,title:Pve.ID,arguments:[{widget:e,range:o.insert,variable:p.name}]},detail:p.type,documentation:p.value})}};XWe=I([m(0,X),m(1,gr),m(2,ie),m(3,Lt),m(4,Ql),m(5,Jt),m(6,iI)],XWe);var Pve=class a extends z{constructor(){super({id:a.ID,title:""})}static{this.ID="notebook.chat.selectAndInsertKernelVariable"}async run(i,...e){let t=i.get(ie),o=i.get(Ql),n=i.get($e),r=lr(t.activeEditorPane)?.getViewModel()?.notebookDocument;if(!r)return;let s=e[0];if(!s||!("widget"in s)||!("range"in s))return;let l=s.widget,c=s.range,u=s.variable;if(u!==void 0){this.addVariableReference(l,u,c,!1);return}let p=o.getMatchingKernel(r).selected;if(!p?.hasVariableProvider)return;let g=p.provideVariables(r.uri,void 0,"named",0,Ie.None),f=[];for await(let S of g)f.push({label:S.name,description:S.value,detail:S.type});let v=f.length>0?d(13601,null):d(13598,null),b=await n.pick(f,{placeHolder:v});b&&this.addVariableReference(l,b.label,c,!0)}addVariableReference(i,e,t,o){if(t){let n=`#kernelVariable:${e}`;if(o&&!i.inputEditor.executeEdits("chatInsertFile",[{range:t,text:n+" "}]))return;i.getContrib(ab.ID)?.addReference({id:"vscode.notebook.variable",range:{startLineNumber:t.startLineNumber,startColumn:t.startColumn,endLineNumber:t.endLineNumber,endColumn:t.startColumn+n.length},data:e,fullName:e,icon:EY.variable})}else i.attachmentModel.addContext({id:"vscode.notebook.variable",name:e,value:e,icon:EY.variable,kind:"generic"})}},fat=class{constructor(i,e){this.editorService=i;this.notebookKernelService=e;this.type="pickerPick";this.label=d(13596,null);this.icon=L.serverEnvironment}isEnabled(i){return i.location==="notebook"&&!!lr(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument}asPicker(){let i=(async()=>{let e=lr(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;if(!e)return[];let t=this.notebookKernelService.getMatchingKernel(e).selected;if(!t?.hasVariableProvider)return[];let n=t.provideVariables(e.uri,void 0,"named",0,Ie.None),r=[];for await(let s of n)r.push({label:s.name,description:s.value,asAttachment:()=>({kind:"generic",id:"vscode.notebook.variable",name:s.name,value:s.value,icon:EY.variable})});return r})();return{placeholder:d(13597,null),picks:i}}};fat=I([m(0,ie),m(1,Ql)],fat);W(class extends z{constructor(){super({id:"notebook.cellOutput.addToChat",title:d(13599,null),menu:{id:R.NotebookOutputToolbar,when:C.and(PE,C.in(MNe.key,aLi.key)),order:10,group:"notebook_chat_actions"},category:Ph,icon:_nt,precondition:Z.enabled})}getNoteboookEditor(i,e){return e&&"notebookEditor"in e?e.notebookEditor:lr(i.activeEditorPane)}async run(i,e){let t=this.getNoteboookEditor(i.get(ie),e);if(!t)return;let o;if(e&&"outputId"in e&&typeof e.outputId=="string"?o=ort(e.outputId,t):e&&"outputViewModel"in e&&(o=e.outputViewModel),!o){let l=t.getActiveCell();if(!l)return;l.focusedOutputId!==void 0?o=l.outputsViewModels.find(c=>c.model.outputId===l.focusedOutputId):o=l.outputsViewModels.find(c=>c.pickedMimeType?.isTrusted)}if(!o)return;let n=o.pickedMimeType?.mimeType,r=i.get(Lt),s=await r.revealWidget();if(s&&n&&Art.includes(n)){let l=J2t(o,n,t);if(!l)return;s.attachmentModel.addContext(l),(await r.revealWidget())?.focusInput()}}});W(Pve);bt(XWe.ID,XWe,vt.BlockRestore);var Ave=new Y("notebookVariableViewEnabled",!1);var Pmn="notebook.openVariablesView";W(class extends Np{constructor(){super({id:Pmn,title:P(13703,"Variables"),icon:OKt,menu:[{id:R.InteractiveToolbar,group:"navigation",when:C.and(ONe,C.notEquals("jupyter.kernel.isjupyter",!0),Ave)},{id:R.EditorTitle,order:-1,group:"navigation",when:C.and(ONe,C.notEquals("jupyter.kernel.isjupyter",!0),C.notEquals("config.notebook.globalToolbar",!0),Ave)},{id:R.NotebookToolbar,order:-1,group:"navigation",when:C.and(ONe,C.notEquals("jupyter.kernel.isjupyter",!0),C.equals("config.notebook.globalToolbar",!0),Ave)}]})}async runWithContext(i,e){i.get(Gt).openView("workbench.notebook.variables",!0)}});var uOi="workbench.editor.empty.hint",One=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.configurationService=t;this.inlineChatSessionService=o;this.chatAgentService=n;this.instantiationService=r;this._register(this.editor.onDidChangeModel(()=>this.update())),this._register(this.editor.onDidChangeModelLanguage(()=>this.update())),this._register(this.editor.onDidChangeModelContent(()=>this.update())),this._register(this.chatAgentService.onDidChangeAgents(()=>this.update())),this._register(this.editor.onDidChangeModelDecorations(()=>this.update())),this._register(this.editor.onDidChangeConfiguration(s=>{s.hasChanged(104)&&this.update()})),this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(uOi)&&this.update()})),this._register(o.onWillStartSession(s=>{this.editor===s&&this.textHintContentWidget?.dispose()})),this._register(o.onDidChangeSessions(()=>{this.update()}))}static{this.ID="editor.contrib.emptyTextEditorHint"}shouldRenderHint(){if(this.configurationService.getValue(uOi)==="hidden"||this.editor.getOption(104))return!1;let t=this.editor.getModel(),o=t?.getLanguageId();if(!t||o===TRe||o===_Re||o===U2||this.inlineChatSessionService.getSessionByTextModel(t.uri)||this.editor.getModel()?.getValueLength()||!!this.editor.getLineDecorations(1)?.find(l=>l.options.beforeContentClassName||l.options.afterContentClassName||l.options.before?.content||l.options.after?.content))return!1;let r=!!this.chatAgentService.getDefaultAgent("editor"),s=t?.uri.scheme===Q.untitled&&o===es;return r||s}update(){let e=this.shouldRenderHint();e&&!this.textHintContentWidget?this.textHintContentWidget=this.instantiationService.createInstance(Nve,this.editor):!e&&this.textHintContentWidget&&(this.textHintContentWidget.dispose(),this.textHintContentWidget=void 0)}dispose(){super.dispose(),this.textHintContentWidget?.dispose()}};One=I([m(1,B),m(2,cy),m(3,gr),m(4,F)],One);var Nve=class extends k{constructor(e,t,o,n,r,s,l){super();this.editor=e;this.commandService=t;this.configurationService=o;this.keybindingService=n;this.chatAgentService=r;this.telemetryService=s;this.contextMenuService=l;this.isVisible=!1;this.ariaLabel="";this._register(this.editor.onDidChangeConfiguration(u=>{this.domNode&&u.hasChanged(59)&&this.editor.applyFontInfo(this.domNode)}));let c=U.debounce(this.editor.onDidFocusEditorText,()=>{},500);this._register(c(()=>{this.editor.hasTextFocus()&&this.isVisible&&this.ariaLabel&&this.configurationService.getValue("accessibility.verbosity.emptyEditorHint")&&Er(this.ariaLabel)})),this.editor.addContentWidget(this)}static{this.ID="editor.widget.emptyHint"}getId(){return Nve.ID}disableHint(e){let t=()=>{this.configurationService.updateValue(uOi,"hidden"),this.dispose(),this.editor.focus()};if(!e){t();return}this.contextMenuService.showContextMenu({getAnchor:()=>new Ln(zi(),e),getActions:()=>[{id:"workench.action.disableEmptyEditorHint",label:d(10087,null),tooltip:d(10087,null),enabled:!0,class:void 0,run:()=>{t()}}]})}getHint(){let e=this.chatAgentService.getActivatedAgents().filter(h=>h.locations.includes("editor")).length>0,t={disposables:this._store,callback:(h,g)=>{switch(h){case"0":e?n(g.browserEvent):r(g.browserEvent);break;case"1":e?r(g.browserEvent):this.disableHint();break;case"2":this.disableHint();break}}},o="inlineChat.start",n=async h=>{h.stopPropagation(),this.telemetryService.publicLog2("workbenchActionExecuted",{id:o,from:"hint"}),await this.commandService.executeCommand(o,{from:"hint"})},r=async h=>{h.stopPropagation(),this.editor.focus(),this.telemetryService.publicLog2("workbenchActionExecuted",{id:Pte.ID,from:"hint"}),await this.commandService.executeCommand(Pte.ID),this.editor.focus()},l=[o,Pte.ID].map(h=>this.keybindingService.lookupKeybinding(h)?.getLabel()),c=(e?d(10089,null,l.at(0)??"",l.at(1)??""):d(10090,null,l.at(1)??"")).replaceAll(" ()",""),u=Jk(c,{actionHandler:t,renderCodeSegments:!1});u.style.fontStyle="italic";let p=e?d(10085,null,...l):d(10086,null,...l);for(let h of u.querySelectorAll("a"))h.style.cursor="pointer";return{hintElement:u,ariaLabel:p}}getDomNode(){if(!this.domNode){this.domNode=_(".empty-editor-hint"),this.domNode.style.width="max-content",this.domNode.style.paddingLeft="4px";let{hintElement:e,ariaLabel:t}=this.getHint();this.domNode.append(e),this.ariaLabel=t.concat(d(10088,null,"accessibility.verbosity.emptyEditorHint")),this._register($(this.domNode,"click",()=>{this.editor.focus()})),this.editor.applyFontInfo(this.domNode);let o=this.editor.getLineHeightForPosition(new ye(1,1));this.domNode.style.lineHeight=o+"px"}return this.domNode}getPosition(){return{position:{lineNumber:1,column:1},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}};Nve=I([m(1,fe),m(2,B),m(3,Le),m(4,gr),m(5,_e),m(6,Xe)],Nve);Eo(One.ID,One,0);var JWe=class extends One{constructor(e,t,o,n,r,s){super(e,o,n,r,s);this._editorService=t;let l=lr(this._editorService.activeEditorPane);l&&this._register(l.onDidChangeActiveCell(()=>this.update()))}static{this.CONTRIB_ID="notebook.editor.contrib.emptyCellEditorHint"}shouldRenderHint(){let e=this.editor.getModel();if(!e||!(e?.uri.scheme===Q.vscodeNotebookCell))return!1;let o=lr(this._editorService.activeEditorPane);return!(!o||!o.isDisposed||!super.shouldRenderHint()||o.getActiveCell()?.uri.fragment!==e.uri.fragment)}};JWe=I([m(1,ie),m(2,B),m(3,cy),m(4,gr),m(5,F)],JWe);Eo(JWe.CONTRIB_ID,JWe,0);var z$t=!1;function Nmn(){z$t=!z$t}function N6(a,i){z$t&&a.info(`[NotebookClipboard]: ${i}`)}function kTo(a){let i=a.get(re),e=a.get(ie),t=lr(e.activeEditorPane);if(!t){N6(i,"[Revive Webview] No notebook editor found for active editor pane, bypass");return}if(!t.hasEditorFocus()){N6(i,"[Revive Webview] Notebook editor is not focused, bypass");return}if(!t.hasWebviewFocus()){N6(i,"[Revive Webview] Notebook editor backlayer webview is not focused, bypass");return}let o=t.getViewModel();if(!(o&&o.viewCells.every(n=>!n.outputIsFocused&&!n.outputIsHovered)))return{editor:t,loggerService:i}}function Omn(a){let i=kTo(a);if(!i)return;let e=i.editor.getInnerWebview();return N6(i.loggerService,"[Revive Webview] Notebook editor backlayer webview is focused"),e}function vat(a,i){let e=Omn(a);return e?(i(e),!0):!1}function Fmn(a,i){let e=kTo(a);return e?i(e.editor):!1}var bat=105;pD.addImplementation(bat,"notebook-webview",a=>vat(a,i=>i.undo()));mD.addImplementation(bat,"notebook-webview",a=>vat(a,i=>i.redo()));WA?.addImplementation(bat,"notebook-webview",a=>vat(a,i=>i.copy()));FA?.addImplementation(bat,"notebook-webview",a=>vat(a,i=>i.paste()));QB?.addImplementation(bat,"notebook-webview",a=>vat(a,i=>i.cut()));function ETo(a,i,e){if(!a.hasModel())return!1;let t=a.textModel;if(a.isReadOnly)return!1;let o={kind:1,focus:a.getFocus(),selections:a.getSelections()};if(i){let n=a.getCellIndex(i),r=typeof n=="number"?n+1:0;t.applyEdits([{editType:1,index:r,count:0,cells:e.items.map(s=>_q(s))}],!0,o,()=>({kind:1,focus:{start:r,end:r+1},selections:[{start:r,end:r+e.items.length}]}),void 0,!0)}else{if(a.getLength()!==0)return!1;t.applyEdits([{editType:1,index:0,count:0,cells:e.items.map(n=>_q(n))}],!0,o,()=>({kind:1,focus:{start:0,end:1},selections:[{start:1,end:e.items.length+1}]}),void 0,!0)}return!0}function TTo(a,i,e){if(!i.hasModel())return!1;if(i.hasOutputTextSelection())return Me(i.getDomNode()).document.execCommand("copy"),!0;let t=a.get(Bi),o=a.get(kn),n=i.getSelections();if(e){let l=i.getCellIndex(e);if(!n.find(u=>u.start<=l&&l<u.end))return t.writeText(e.getText()),o.setToCopy([e.model],!0),!0}let r=vZ(i,i.getSelections()),s=fYe(i,r);return s.length?(t.writeText(s.map(l=>l.getText()).join(`
`)),o.setToCopy(s.map(l=>l.model),!0),!0):!1}function _To(a,i,e){if(!i.hasModel()||i.isReadOnly)return!1;let t=i.textModel,o=a.get(Bi),n=a.get(kn),r=i.getSelections();if(e){let f=i.getCellIndex(e);if(!r.find(b=>b.start<=f&&f<b.end)){o.writeText(e.getText());let b=i.getFocus(),S=b.end<=f?b:{start:b.start-1,end:b.end-1},y=r.map(w=>w.end<=f?w:{start:w.start-1,end:w.end-1});return t.applyEdits([{editType:1,index:f,count:1,cells:[]}],!0,{kind:1,focus:i.getFocus(),selections:r},()=>({kind:1,focus:S,selections:y}),void 0,!0),n.setToCopy([e.model],!1),!0}}let s=i.getFocus();if(!r.find(f=>f.start<=s.start&&s.end<=f.end)){let f=i.cellAt(s.start);o.writeText(f.getText());let v=s.end===i.getLength()?{start:s.start-1,end:s.end-1}:s,b=r.map(S=>S.end<=s.start?S:{start:S.start-1,end:S.end-1});return t.applyEdits([{editType:1,index:s.start,count:1,cells:[]}],!0,{kind:1,focus:i.getFocus(),selections:r},()=>({kind:1,focus:v,selections:b}),void 0,!0),n.setToCopy([f.model],!1),!0}let c=vZ(i,i.getSelections()),u=fYe(i,c);if(!u.length)return!1;o.writeText(u.map(f=>f.getText()).join(`
`));let p=c.map(f=>({editType:1,index:f.start,count:f.end-f.start,cells:[]})),h=c[0].start,g=h<t.cells.length-1?h:Math.max(t.cells.length-2,0);return t.applyEdits(p,!0,{kind:1,focus:i.getFocus(),selections:c},()=>({kind:1,focus:{start:g,end:g+1},selections:[{start:g,end:g+1}]}),void 0,!0),n.setToCopy(u.map(f=>f.model),!1),!0}var ZWe=class extends k{constructor(e){super();this._editorService=e;let t=105;WA&&this._register(WA.addImplementation(t,"notebook-clipboard",o=>this.runCopyAction(o))),FA&&this._register(FA.addImplementation(t,"notebook-clipboard",o=>this.runPasteAction(o))),QB&&this._register(QB.addImplementation(t,"notebook-clipboard",o=>this.runCutAction(o)))}static{this.ID="workbench.contrib.notebookClipboard"}_getContext(){let e=lr(this._editorService.activeEditorPane),t=e?.getActiveCell();return{editor:e,activeCell:t}}_focusInsideEmebedMonaco(e){let t=Me(e.getDomNode()).getSelection();if(t?.rangeCount!==1)return!1;let o=t.getRangeAt(0);if(o.startContainer===o.endContainer&&o.endOffset-o.startOffset===0)return!1;let n=o.commonAncestorContainer,r=e.getDomNode();if(!r.contains(n))return!1;for(;n&&n!==r;){if(n.classList&&n.classList.contains("monaco-editor"))return!0;n=n.parentNode}return!1}runCopyAction(e){let t=e.get(re),o=Un();if(go(o)&&Ch(o))return N6(t,"[NotebookEditor] focus is on input or textarea element, bypass"),!1;let{editor:n}=this._getContext();return n?n.hasEditorFocus()?this._focusInsideEmebedMonaco(n)?(N6(t,"[NotebookEditor] focus is on embed monaco editor, bypass"),!1):(N6(t,"[NotebookEditor] run copy actions on notebook model"),TTo(e,n,void 0)):(N6(t,"[NotebookEditor] focus is outside of the notebook editor, bypass"),!1):(N6(t,"[NotebookEditor] no active notebook editor, bypass"),!1)}runPasteAction(e){let t=Un();if(t&&Ch(t))return!1;let{editor:o,activeCell:n}=this._getContext();if(!o||!o.hasEditorFocus()||this._focusInsideEmebedMonaco(o))return!1;let s=e.get(kn).getToCopy();return s?ETo(o,n,s):!1}runCutAction(e){let t=Un();if(t&&Ch(t))return!1;let{editor:o}=this._getContext();return!o||!o.hasEditorFocus()||this._focusInsideEmebedMonaco(o)?!1:_To(e,o,void 0)}};ZWe=I([m(0,ie)],ZWe);bt(ZWe.ID,ZWe,vt.BlockRestore);var Wmn="notebook.cell.copy",Vmn="notebook.cell.cut",Bmn="notebook.cell.paste",Hmn="notebook.cell.pasteAbove";W(class extends iu{constructor(){super({id:Wmn,title:d(13488,null),menu:{id:R.NotebookCellTitle,when:wr,group:"1_copy",order:2},keybinding:Qr?void 0:{primary:2081,win:{primary:2081,secondary:[2067]},when:C.and(wr,C.not(Dp)),weight:200}})}async runWithContext(a,i){TTo(a,i.notebookEditor,i.cell)}});W(class extends iu{constructor(){super({id:Vmn,title:d(13489,null),menu:{id:R.NotebookCellTitle,when:C.and(wr,cc,OC),group:"1_copy",order:1},keybinding:Qr?void 0:{when:C.and(wr,C.not(Dp)),primary:2102,win:{primary:2102,secondary:[1044]},weight:200}})}async runWithContext(a,i){_To(a,i.notebookEditor,i.cell)}});W(class extends Np{constructor(){super({id:Bmn,title:d(13490,null),menu:{id:R.NotebookCellTitle,when:C.and(wr,cc),group:"1_copy",order:3},keybinding:Qr?void 0:{when:C.and(wr,C.not(Dp)),primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}})}async runWithContext(a,i){let t=a.get(kn).getToCopy();!i.notebookEditor.hasModel()||i.notebookEditor.isReadOnly||t&&ETo(i.notebookEditor,i.cell,t)}});W(class extends iu{constructor(){super({id:Hmn,title:d(13491,null),keybinding:{when:C.and(wr,C.not(Dp)),primary:3124,weight:ov}})}async runWithContext(a,i){let t=a.get(kn).getToCopy(),o=i.notebookEditor,n=o.textModel;if(o.isReadOnly||!t)return;let r={kind:1,focus:o.getFocus(),selections:o.getSelections()},s=i.notebookEditor.getCellIndex(i.cell),l=s;n.applyEdits([{editType:1,index:s,count:0,cells:t.items.map(c=>_q(c))}],!0,r,()=>({kind:1,focus:{start:l,end:l+1},selections:[{start:l,end:l+t.items.length}]}),void 0,!0)}});W(class extends z{constructor(){super({id:"workbench.action.toggleNotebookClipboardLog",title:P(13492,"Toggle Notebook Clipboard Troubleshooting"),category:Fe.Developer,f1:!0})}run(a){Nmn(),z$t&&a.get(fe).executeCommand(OG)}});W(class extends iu{constructor(){super({id:"notebook.cell.output.selectAll",title:d(13487,null),keybinding:{primary:2079,when:C.and(wr,vP),weight:uIo}})}async runWithContext(a,i){Fmn(a,e=>{if(!e.hasEditorFocus())return!1;if(e.hasEditorFocus()&&!e.hasWebviewFocus())return!0;let t=e.getActiveCell();return!t||!t.outputIsFocused||!e.hasWebviewFocus()||(t.inputInOutputIsFocused?e.selectInputContents(t):e.selectOutputContent(t)),!0})}});var eVe=class extends k{constructor(e,t,o,n,r){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._markupInput=!0;this._markupPreview=!0;this._codeInput=!0;this._codeOutput=!0;this._findScope={findScopeType:"none"};this._markupInput=e,this._markupPreview=t,this._codeInput=o,this._codeOutput=n,this._findScope=r,this._initialMarkupInput=e,this._initialMarkupPreview=t,this._initialCodeInput=o,this._initialCodeOutput=n}get markupInput(){return this._markupInput}set markupInput(e){this._markupInput!==e&&(this._markupInput=e,this._onDidChange.fire({markupInput:e}))}get markupPreview(){return this._markupPreview}set markupPreview(e){this._markupPreview!==e&&(this._markupPreview=e,this._onDidChange.fire({markupPreview:e}))}get codeInput(){return this._codeInput}set codeInput(e){this._codeInput!==e&&(this._codeInput=e,this._onDidChange.fire({codeInput:e}))}get codeOutput(){return this._codeOutput}set codeOutput(e){this._codeOutput!==e&&(this._codeOutput=e,this._onDidChange.fire({codeOutput:e}))}get findScope(){return this._findScope}set findScope(e){this._findScope!==e&&(this._findScope=e,this._onDidChange.fire({findScope:!0}))}isModified(){return this._markupInput!==this._initialMarkupInput||this._markupPreview!==this._initialMarkupPreview||this._codeInput!==this._initialCodeInput||this._codeOutput!==this._initialCodeOutput}update(e){this._markupInput=e.markupInput,this._markupPreview=e.markupPreview,this._codeInput=e.codeInput,this._codeOutput=e.codeOutput,this._findScope=e.findScope}};var Umn=d(13508,null),zmn=d(13521,null),Kmn=d(13510,null),Gmn=d(13509,null),qmn=d(13515,null),$mn=d(13507,null),jmn=d(13514,null),Qmn=d(13511,null),Ymn=d(13522,null),Xmn=d(13513,null),Jmn=d(13512,null),qWm=Oe("find-filter",L.filter,d(13506,null)),Zmn=d(13516,null),ehn=d(13519,null),thn=d(13520,null),ihn=d(13517,null),ohn=d(13518,null),tVe=419,DTo=4,Sat=class extends rh{constructor(e,t,o,n,r){super(t,{getActions:()=>this.getActions()},r,{...o,actionRunner:n,classNames:t.class,anchorAlignmentProvider:()=>1});this.filters=e}render(e){super.render(e),this.updateChecked()}getActions(){let e={checked:this.filters.markupInput,class:void 0,enabled:!0,id:"findInMarkdownInput",label:ehn,run:async()=>{this.filters.markupInput=!this.filters.markupInput},tooltip:""},t={checked:this.filters.markupPreview,class:void 0,enabled:!0,id:"findInMarkdownInput",label:thn,run:async()=>{this.filters.markupPreview=!this.filters.markupPreview},tooltip:""},o={checked:this.filters.codeInput,class:void 0,enabled:!0,id:"findInCodeInput",label:ihn,run:async()=>{this.filters.codeInput=!this.filters.codeInput},tooltip:""},n={checked:this.filters.codeOutput,class:void 0,enabled:!0,id:"findInCodeOutput",label:ohn,run:async()=>{this.filters.codeOutput=!this.filters.codeOutput},tooltip:"",dispose:()=>null};return qye?[e,o]:[e,t,new oi,o,n]}updateChecked(){this.element.classList.toggle("checked",this._action.checked)}};Sat=I([m(4,Xe)],Sat);var Iat=class extends k{constructor(e,t,o,n,r=Zmn){super();this.filters=e;this.contextMenuService=t;this.instantiationService=o;this._actionbar=null;this._toggleStyles=n.toggleStyles,this._filtersAction=this._register(new it("notebookFindFilterAction",r,"notebook-filters "+q.asClassName(VKt))),this._filtersAction.checked=!1,this._filterButtonContainer=_(".find-filter-button"),this._filterButtonContainer.classList.add("monaco-custom-toggle"),this.createFilters(this._filterButtonContainer)}get container(){return this._filterButtonContainer}width(){return 22}enable(){this.container.setAttribute("aria-disabled",String(!1))}disable(){this.container.setAttribute("aria-disabled",String(!0))}set visible(e){this._filterButtonContainer.style.display=e?"":"none"}get visible(){return this._filterButtonContainer.style.display!=="none"}applyStyles(e){let t=this._toggleStyles;this._filterButtonContainer.style.border="1px solid transparent",this._filterButtonContainer.style.borderRadius="3px",this._filterButtonContainer.style.borderColor=e&&t.inputActiveOptionBorder||"",this._filterButtonContainer.style.color=e&&t.inputActiveOptionForeground||"inherit",this._filterButtonContainer.style.backgroundColor=e&&t.inputActiveOptionBackground||""}createFilters(e){this._actionbar=this._register(new oo(e,{actionViewItemProvider:(t,o)=>{if(t.id===this._filtersAction.id)return this.instantiationService.createInstance(Sat,this.filters,t,o,this._register(new cs))}})),this._actionbar.push(this._filtersAction,{icon:!0,label:!1})}},pOi=class extends QK{constructor(e,t,o,n,r,s,l){super(r,s,l);this.filters=e;this.contextMenuService=o;this.instantiationService=n;this._filterChecked=!1;this._register(JB(t,this.inputBox)),this._findFilter=this._register(new Iat(e,o,n,l)),this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this._findFilter.width(),this.controls.appendChild(this._findFilter.container)}setEnabled(e){super.setEnabled(e),e&&!this._filterChecked?this.regex?.enable():this.regex?.disable()}updateFilterState(e){this._filterChecked=e,this.regex&&(this._filterChecked?(this.regex.disable(),this.regex.domNode.tabIndex=-1,this.regex.domNode.classList.toggle("disabled",!0)):(this.regex.enable(),this.regex.domNode.tabIndex=0,this.regex.domNode.classList.toggle("disabled",!1))),this._findFilter.applyStyles(this._filterChecked)}getToggleDomNodes(){let e=super.getToggleDomNodes();return e.push(this._findFilter.container),e}getCellToolbarActions(e){return xl(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}},iVe=class extends ll{constructor(e,t,o,n,r,s,l=new p2,c,u,p){super();this._contextViewService=e;this._configurationService=o;this.contextMenuService=n;this.instantiationService=r;this._state=l;this._notebookEditor=c;this._findWidgetSearchHistory=u;this._replaceWidgetHistory=p;this._resizeOriginalWidth=tVe;this._isVisible=!1;this._isReplaceVisible=!1;this.foundMatch=!1;this.cellSelectionDecorationIds=[];this.textSelectionDecorationIds=[];this._register(this._state);let h=this._configurationService.getValue(Ct.findFilters)??{markupSource:!0,markupPreview:!0,codeSource:!0,codeOutput:!0},g=this._configurationService.getValue("editor.find.history"),f=this._configurationService.getValue("editor.find.replaceHistory");this._filters=this._register(new eVe(h.markupSource,h.markupPreview,h.codeSource,h.codeOutput,{findScopeType:"none"})),this._state.change({filters:this._filters},!1),this._register(this._filters.onDidChange(()=>{this._state.change({filters:this._filters},!1)})),this._domNode=document.createElement("div"),this._domNode.classList.add("simple-fr-find-part-wrapper"),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,w=>{(!w||w.affectsConfiguration(Ct.globalToolbar))&&(this._notebookEditor.notebookOptions.getLayoutConfiguration().globalToolbar?this._domNode.style.top="26px":this._domNode.style.top="0px")})),this._register(this._state.onFindReplaceStateChange(w=>this._onStateChanged(w))),this._scopedContextKeyService=this._register(t.createScoped(this._domNode));let v=_(".find-replace-progress");this._progressBar=this._register(new Cv(v,oC)),this._domNode.appendChild(v);let b=t.getContextKeyValue("notebookType")==="interactive",S={groupId:"simple-find-widget"};this._toggleReplaceBtn=this._register(new UI({label:jmn,className:"codicon toggle left",hoverLifecycleOptions:S,onTrigger:b?()=>{}:()=>{this._isReplaceVisible=!this._isReplaceVisible,this._state.change({isReplaceRevealed:this._isReplaceVisible},!1),this._updateReplaceViewDisplay()}},s)),this._toggleReplaceBtn.setEnabled(!b),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._innerFindDomNode=document.createElement("div"),this._innerFindDomNode.classList.add("simple-fr-find-part"),this._findInput=this._register(new pOi(this._filters,this._scopedContextKeyService,this.contextMenuService,this.instantiationService,null,this._contextViewService,{label:Umn,placeholder:zmn,validation:w=>{if(w.length===0||!this._findInput.getRegex())return null;try{return new RegExp(w),null}catch(x){return this.foundMatch=!1,this.updateButtons(this.foundMatch),{content:x.message}}},flexibleWidth:!0,showCommonFindToggles:!0,inputBoxStyles:Wl,toggleStyles:zh,history:g==="workspace"?this._findWidgetSearchHistory:new Set([])})),this._updateFindHistoryDelayer=new rn(500),this.oninput(this._findInput.domNode,w=>{this.foundMatch=this.onInputChanged(),this.updateButtons(this.foundMatch),this._delayedUpdateFindHistory()}),this._register(this._findInput.inputBox.onDidChange(()=>{this._state.change({searchString:this._findInput.getValue()},!0)})),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._state.onFindReplaceStateChange(()=>{this._findInput.setRegex(this._state.isRegex),this._findInput.setWholeWords(this._state.wholeWord),this._findInput.setCaseSensitive(this._state.matchCase),this._replaceInput.setPreserveCase(this._state.preserveCase)})),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount(),this.prevBtn=this._register(new UI({label:Kmn,icon:p6e,hoverLifecycleOptions:S,onTrigger:()=>{this.find(!0)}},s)),this.nextBtn=this._register(new UI({label:Gmn,icon:m6e,hoverLifecycleOptions:S,onTrigger:()=>{this.find(!1)}},s)),this.inSelectionToggle=this._register(new Lm({icon:Kui,title:qmn,isChecked:!1,hoverLifecycleOptions:S,inputActiveOptionBackground:Tt(AB),inputActiveOptionBorder:Tt(PB),inputActiveOptionForeground:Tt(E5)})),this.inSelectionToggle.domNode.style.display="inline",this._register(this.inSelectionToggle.onChange(()=>{if(this.inSelectionToggle.checked){let x=this._notebookEditor.getSelections(),E=this._notebookEditor.getSelectionViewModels()[0].getSelections();x.length>1||x.some(M=>M.end-M.start>1)?(this._filters.findScope={findScopeType:"cells",selectedCellRanges:x},this.setCellSelectionDecorations()):E.length>1||E.some(M=>M.endLineNumber-M.startLineNumber>=1)?(this._filters.findScope={findScopeType:"text",selectedCellRanges:x,selectedTextRanges:E},this.setTextSelectionDecorations(E,this._notebookEditor.getSelectionViewModels()[0])):(this._filters.findScope={findScopeType:"cells",selectedCellRanges:x},this.setCellSelectionDecorations())}else this._filters.findScope={findScopeType:"none"},this.clearCellSelectionDecorations(),this.clearTextSelectionDecorations()}));let y=this._register(new UI({label:$mn,icon:MT,hoverLifecycleOptions:S,onTrigger:()=>{this.hide()}},s));this._innerFindDomNode.appendChild(this._findInput.domNode),this._innerFindDomNode.appendChild(this._matchesCount),this._innerFindDomNode.appendChild(this.prevBtn.domNode),this._innerFindDomNode.appendChild(this.nextBtn.domNode),this._innerFindDomNode.appendChild(this.inSelectionToggle.domNode),this._innerFindDomNode.appendChild(y.domNode),this._domNode.appendChild(this._innerFindDomNode),this.onkeyup(this._innerFindDomNode,w=>{if(w.equals(9)){this.hide(),w.preventDefault();return}}),this._focusTracker=this._register(nr(this._domNode)),this._register(this._focusTracker.onDidFocus(this.onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this.onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register(nr(this._findInput.domNode)),this._register(this._findInputFocusTracker.onDidFocus(this.onFindInputFocusTrackerFocus.bind(this))),this._register(this._findInputFocusTracker.onDidBlur(this.onFindInputFocusTrackerBlur.bind(this))),this._register($(this._innerFindDomNode,"click",w=>{w.stopPropagation()})),this._innerReplaceDomNode=document.createElement("div"),this._innerReplaceDomNode.classList.add("simple-fr-replace-part"),this._replaceInput=this._register(new JK(null,void 0,{label:Qmn,placeholder:Ymn,history:f==="workspace"?this._replaceWidgetHistory:new Set([]),inputBoxStyles:Wl,toggleStyles:zh,hoverLifecycleOptions:S},t,!1)),this._innerReplaceDomNode.appendChild(this._replaceInput.domNode),this._replaceInputFocusTracker=this._register(nr(this._replaceInput.domNode)),this._register(this._replaceInputFocusTracker.onDidFocus(this.onReplaceInputFocusTrackerFocus.bind(this))),this._register(this._replaceInputFocusTracker.onDidBlur(this.onReplaceInputFocusTrackerBlur.bind(this))),this._updateReplaceHistoryDelayer=new rn(500),this.oninput(this._replaceInput.domNode,w=>{this._delayedUpdateReplaceHistory()}),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.getValue()},!0)})),this._domNode.appendChild(this._innerReplaceDomNode),this._updateReplaceViewDisplay(),this._replaceBtn=this._register(new UI({label:Xmn,icon:Gui,hoverLifecycleOptions:S,onTrigger:()=>{this.replaceOne()}},s)),this._replaceAllBtn=this._register(new UI({label:Jmn,icon:qui,hoverLifecycleOptions:S,onTrigger:()=>{this.replaceAll()}},s)),this._innerReplaceDomNode.appendChild(this._replaceBtn.domNode),this._innerReplaceDomNode.appendChild(this._replaceAllBtn.domNode),this._resizeSash=this._register(new kh(this._domNode,{getVerticalSashLeft:()=>0},{orientation:0,size:2})),this._register(this._resizeSash.onDidStart(()=>{this._resizeOriginalWidth=this._getDomWidth()})),this._register(this._resizeSash.onDidChange(w=>{let x=this._resizeOriginalWidth+w.startX-w.currentX;x<tVe&&(x=tVe);let E=this._getMaxWidth();x>E&&(x=E),this._domNode.style.width=`${x}px`,this._isReplaceVisible&&(this._replaceInput.width=Dc(this._findInput.domNode)),this._findInput.inputBox.layout()})),this._register(this._resizeSash.onDidReset(()=>{let w=this._getDomWidth(),x=tVe;w<=tVe&&(x=this._getMaxWidth()),this._domNode.style.width=`${x}px`,this._isReplaceVisible&&(this._replaceInput.width=Dc(this._findInput.domNode)),this._findInput.inputBox.layout()}))}_getMaxWidth(){return this._notebookEditor.getLayoutInfo().width-64}_getDomWidth(){return Dc(this._domNode)-DTo*2}getCellToolbarActions(e){return xl(e.getActions({shouldForwardArgs:!0}),t=>/^inline/.test(t))}get inputValue(){return this._findInput.getValue()}get replaceValue(){return this._replaceInput.getValue()}get replacePattern(){return this._state.isRegex?MEt(this.replaceValue):vJ.fromStaticValue(this.replaceValue)}get focusTracker(){return this._focusTracker}get isVisible(){return this._isVisible}_onStateChanged(e){this._updateButtons(),this._updateMatchesCount()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible);let e=this._state.searchString.length>0;this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this.foundMatch=this._state.matchesCount>0,this.updateButtons(this.foundMatch)}setCellSelectionDecorations(){let e=[];this._notebookEditor.getSelectionViewModels().forEach(o=>{e.push(o.handle)});let t=[];for(let o of e)t.push({handle:o,options:{className:"nb-multiCellHighlight",outputClassName:"nb-multiCellHighlight"}});this.cellSelectionDecorationIds=this._notebookEditor.deltaCellDecorations([],t)}clearCellSelectionDecorations(){this._notebookEditor.deltaCellDecorations(this.cellSelectionDecorationIds,[])}setTextSelectionDecorations(e,t){this._notebookEditor.changeModelDecorations(o=>{let n=[];for(let r of e)n.push({ownerId:t.handle,decorations:[{range:r,options:{description:"text search range for notebook search scope",isWholeLine:!0,className:"nb-findScope"}}]});this.textSelectionDecorationIds=o.deltaDecorations([],n)})}clearTextSelectionDecorations(){this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this.textSelectionDecorationIds,[])})}_updateMatchesCount(){}dispose(){super.dispose(),this._domNode.remove()}getDomNode(){return this._domNode}reveal(e){if(e&&this._findInput.setValue(e),this._isVisible){this._findInput.select();return}this._isVisible=!0,this.updateButtons(this.foundMatch),setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),this._findInput.select()},0)}focus(){this._findInput.focus()}show(e,t){e&&this._findInput.setValue(e),this._isVisible=!0,setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),(t?.focus??!0)&&this.focus()},0)}showWithReplace(e,t){e&&this._findInput.setValue(e),t&&this._replaceInput.setValue(t),this._isVisible=!0,this._isReplaceVisible=!0,this._state.change({isReplaceRevealed:this._isReplaceVisible},!1),this._updateReplaceViewDisplay(),setTimeout(()=>{this._domNode.classList.add("visible","visible-transition"),this._domNode.setAttribute("aria-hidden","false"),this._updateButtons(),this._replaceInput.focus()},0)}_updateReplaceViewDisplay(){this._isReplaceVisible?this._innerReplaceDomNode.style.display="flex":this._innerReplaceDomNode.style.display="none",this._replaceInput.width=Dc(this._findInput.domNode)}hide(){this._isVisible&&(this.inSelectionToggle.checked=!1,this._notebookEditor.deltaCellDecorations(this.cellSelectionDecorationIds,[]),this._notebookEditor.changeModelDecorations(e=>{e.deltaDecorations(this.textSelectionDecorationIds,[])}),this._domNode.classList.remove("visible-transition"),this._domNode.setAttribute("aria-hidden","true"),setTimeout(()=>{this._isVisible=!1,this.updateButtons(this.foundMatch),this._domNode.classList.remove("visible")},200))}_delayedUpdateFindHistory(){this._updateFindHistoryDelayer.trigger(this._updateFindHistory.bind(this))}_updateFindHistory(){this._findInput.inputBox.addToHistory()}_delayedUpdateReplaceHistory(){this._updateReplaceHistoryDelayer.trigger(this._updateReplaceHistory.bind(this))}_updateReplaceHistory(){this._replaceInput.inputBox.addToHistory()}_getRegexValue(){return this._findInput.getRegex()}_getWholeWordValue(){return this._findInput.getWholeWords()}_getCaseSensitiveValue(){return this._findInput.getCaseSensitive()}updateButtons(e){let t=this.inputValue.length>0;this.prevBtn.setEnabled(this._isVisible&&t&&e),this.nextBtn.setEnabled(this._isVisible&&t&&e)}};iVe=I([m(0,qn),m(1,X),m(2,B),m(3,Xe),m(4,F),m(5,ot)],iVe);hs((a,i)=>{i.addRule(`
	.notebook-editor {
		--notebook-find-width: ${tVe}px;
		--notebook-find-horizontal-padding: ${DTo}px;
	}
	`)});var yat="find-hide-transition",oVe="find-show-transition",mOi=69,hOi=200,GC=class extends k{constructor(e,t){super();this.notebookEditor=e;this.instantiationService=t;this._widget=new uo(()=>this._register(this.instantiationService.createInstance(wat,this.notebookEditor)))}static{this.id="workbench.notebook.find"}get widget(){return this._widget.value}show(e,t){return this._widget.value.show(e,t)}hide(){this._widget.rawValue?.hide()}replace(e){return this._widget.value.replace(e)}isVisible(){return this._widget.rawValue?.isVisible??!1}findNext(){this._widget.rawValue&&this._widget.value.findNext()}findPrevious(){this._widget.rawValue&&this._widget.value.findPrevious()}};GC=I([m(1,F)],GC);var wat=class extends iVe{constructor(e,t,o,n,r,s,l,c){let u=OD.getOrCreate(c),p=FD.getOrCreate(c);super(t,o,n,r,l,s,new p2,e,u,p);this._isFocused=!1;this._showTimeout=null;this._hideTimeout=null;this._findModel=new bOe(this._notebookEditor,this._state,this._configurationService),D(this._notebookEditor.getDomNode(),this.getDomNode()),this._findWidgetFocused=wKt.bindTo(o),this._findWidgetVisible=HT.bindTo(o),this._register(this._findInput.onKeyDown(h=>this._onFindInputKeyDown(h))),this._register(this._replaceInput.onKeyDown(h=>this._onReplaceInputKeyDown(h))),this._register(this._state.onFindReplaceStateChange(h=>{if(this.onInputChanged(),h.isSearching&&(this._state.isSearching?this._progressBar.infinite().show(hOi):this._progressBar.stop().hide()),this._findModel.currentMatch>=0){let f=this._findModel.getCurrentMatch();this._replaceBtn.setEnabled(f.isModelMatch)}let g=this._findModel.findMatches;this._replaceAllBtn.setEnabled(g.length>0&&g.find(f=>f.webviewMatches.length>0)===void 0),h.filters&&this._findInput.updateFilterState(this._state.filters?.isModified()??!1)})),this._register($(this.getDomNode(),ne.FOCUS,h=>{this._previousFocusElement=go(h.relatedTarget)?h.relatedTarget:void 0},!0))}get findModel(){return this._findModel}get isFocused(){return this._isFocused}_onFindInputKeyDown(e){if(e.equals(3)){this.find(!1),e.preventDefault();return}else if(e.equals(1027)){this.find(!0),e.preventDefault();return}}_onReplaceInputKeyDown(e){if(e.equals(3)){this.replaceOne(),e.preventDefault();return}}onInputChanged(){this._state.change({searchString:this.inputValue},!1);let e=this._findModel.findMatches;return!!(e&&e.length)}findIndex(e){this._findModel.find({index:e})}find(e){this._findModel.find({previous:e})}findNext(){this.find(!1)}findPrevious(){this.find(!0)}replaceOne(){if(!this._notebookEditor.hasModel()||!this._findModel.findMatches.length)return;this._findModel.ensureFindMatches(),this._findModel.currentMatch<0&&this._findModel.find({previous:!1});let e=this._findModel.getCurrentMatch(),t=e.cell;if(e.isModelMatch){let o=e.match;this._progressBar.infinite().show(hOi);let r=this.replacePattern.buildReplaceString(o.matches,this._state.preserveCase);this._notebookEditor.getViewModel().replaceOne(t,o.range,r).then(()=>{this._progressBar.stop()})}else console.error("Replace does not work for output match")}replaceAll(){if(!this._notebookEditor.hasModel())return;this._progressBar.infinite().show(hOi);let e=this.replacePattern,t=this._findModel.findMatches,o=[];t.forEach(r=>{r.contentMatches.forEach(s=>{let l=s.matches;o.push(e.buildReplaceString(l,this._state.preserveCase))})}),this._notebookEditor.getViewModel().replaceAll(this._findModel.findMatches,o).then(()=>{this._progressBar.stop()})}findFirst(){}onFocusTrackerFocus(){this._findWidgetFocused.set(!0),this._isFocused=!0}onFocusTrackerBlur(){this._previousFocusElement=void 0,this._findWidgetFocused.reset(),this._isFocused=!1}onReplaceInputFocusTrackerFocus(){}onReplaceInputFocusTrackerBlur(){}onFindInputFocusTrackerFocus(){}onFindInputFocusTrackerBlur(){}async show(e,t){let o=this._state.searchString!==e;super.show(e,t),this._state.change({searchString:e??this._state.searchString,isRevealed:!0},!1),this._findWidgetVisible.set(!0),typeof t?.matchIndex=="number"?(this._findModel.findMatches.length||await this._findModel.research(),this.findIndex(t.matchIndex)):t?.focus!==!1&&this._findInput.select(),!o&&t?.searchStringSeededFrom&&this._findModel.refreshCurrentMatch(t.searchStringSeededFrom),this._showTimeout===null&&(this._hideTimeout!==null&&(Me(this.getDomNode()).clearTimeout(this._hideTimeout),this._hideTimeout=null,this._notebookEditor.removeClassName(yat)),this._notebookEditor.addClassName(oVe),this._showTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(oVe),this._showTimeout=null},200))}replace(e,t){super.showWithReplace(e,t),this._state.change({searchString:e??"",replaceString:t??"",isRevealed:!0},!1),this._replaceInput.select(),this._showTimeout===null&&(this._hideTimeout!==null&&(Me(this.getDomNode()).clearTimeout(this._hideTimeout),this._hideTimeout=null,this._notebookEditor.removeClassName(yat)),this._notebookEditor.addClassName(oVe),this._showTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(oVe),this._showTimeout=null},200))}hide(){if(super.hide(),this._state.change({isRevealed:!1},!1),this._findWidgetVisible.set(!1),this._findModel.clear(),this._notebookEditor.findStop(),this._progressBar.stop(),this._hideTimeout===null&&(this._showTimeout!==null&&(Me(this.getDomNode()).clearTimeout(this._showTimeout),this._showTimeout=null,this._notebookEditor.removeClassName(oVe)),this._notebookEditor.addClassName(yat),this._hideTimeout=Me(this.getDomNode()).setTimeout(()=>{this._notebookEditor.removeClassName(yat)},200)),this._previousFocusElement&&this._previousFocusElement.offsetParent&&(this._previousFocusElement.focus(),this._previousFocusElement=void 0),this._notebookEditor.hasModel())for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);t.getEditState()===1&&t.editStateSource==="find"&&t.updateEditState(0,"closeFind")}}_updateMatchesCount(){if(!this._findModel||!this._findModel.findMatches)return;this._matchesCount.style.minWidth=mOi+"px",this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=t0&&(t+="+");let o=this._findModel.currentMatch<0?"?":String(this._findModel.currentMatch+1);e=Wd(h6e,o,t)}else e=e2;this._matchesCount.appendChild(document.createTextNode(e)),cn(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),mOi=Math.max(mOi,this._matchesCount.clientWidth)}_getAriaLabel(e,t,o){return e===e2?o===""?d(13524,null,e):d(13523,null,e,o):d(13525,null,e,o)}dispose(){this._notebookEditor?.removeClassName(oVe),this._notebookEditor?.removeClassName(yat),this._findModel.dispose(),super.dispose()}};wat=I([m(1,qn),m(2,X),m(3,B),m(4,Xe),m(5,ot),m(6,F),m(7,de)],wat);Hm(GC.id,GC);W(class extends z{constructor(){super({id:"notebook.hideFind",title:P(13505,"Hide Find in Notebook"),keybinding:{when:C.and(wr,HT),primary:9,weight:105}})}async run(a){let i=a.get(ie),e=lr(i.activeEditorPane);if(!e)return;e.getContribution(GC.id).hide(),e.focus()}});W(class extends kf{constructor(){super({id:"notebook.find",title:P(13504,"Find in Notebook"),keybinding:{when:C.and(wr,C.or(nl,wnt),me.focus.toNegated()),primary:2084,weight:200}})}async runWithContext(a,i){let e=a.get(ie),t=lr(e.activeEditorPane);if(!t)return;t.getContribution(GC.id).show(void 0,{findScope:{findScopeType:"none"}})}});function nhn(a,i){if(i.uri.scheme===Q.vscodeNotebookCell){let e=sn.parse(i.uri);if(e&&ze(e.notebook,a))return!0}return!1}function RTo(a,i){if(i.seedSearchStringFromSelection==="single"){let e=_J(a,i.seedSearchStringFromSelection,i.seedSearchStringFromNonEmptySelection);if(e)return{searchString:e,selection:a.getSelection()}}else if(i.seedSearchStringFromSelection==="multiple"&&!i.updateSearchScope){let e=_J(a,i.seedSearchStringFromSelection);if(e)return{searchString:e,selection:a.getSelection()}}}function LTo(a,i,e){if(!i||!e.hasModel())return!1;if(!i.hasEditorFocus()&&!i.hasWebviewFocus()){let t=a.get(Qt),o=t.getFocusedCodeEditor()||t.getActiveCodeEditor();return!!(i.hasModel()&&o&&o.hasModel()&&nhn(i.textModel.uri,o.getModel()))}return!0}function MTo(a,i,e,t=!0){if(!i||!e||!a||!e.hasModel())return!1;let o=RTo(e,{forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),n,r=e.getModel().uri,s=sn.parse(r);if(o?.selection&&s){let l=i.getCellByHandle(s.handle);l&&(n={searchStringSeededFrom:{cell:l,range:o.selection},focus:t})}else n={focus:t};return a.show(o?.searchString,n),!0}function PTo(a,i,e){let t=a.get(ie),o=lr(t.activeEditorPane);if(!LTo(a,o,i))return!1;let n=o?.getContribution(GC.id);return n?n.isVisible()?(e?n.findNext():n.findPrevious(),!0):MTo(n,o,i,!1):!1}async function ATo(a,i){let e=a.get(ie),t=lr(e.activeEditorPane);if(!t)return;let o=t.getContribution(GC.id);o&&o.isVisible()&&(i?o.findNext():o.findPrevious())}Omi.addImplementation(100,(a,i,e)=>{let t=a.get(ie),o=lr(t.activeEditorPane);if(!LTo(a,o,i))return!1;let n=o?.getContribution(GC.id);return MTo(n,o,i,!0)});Vmi.addImplementation(100,(a,i,e)=>{let t=a.get(ie),o=lr(t.activeEditorPane);if(!o||!i.hasModel())return!1;let n=o.getContribution(GC.id),r=RTo(i,{forceRevealReplace:!1,seedSearchStringFromSelection:i.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:i.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:i.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(50).loop});return n?(n.replace(r?.searchString),!0):!1});Fmi.addImplementation(100,(a,i,e)=>PTo(a,i,!0));Wmi.addImplementation(100,(a,i,e)=>PTo(a,i,!1));W(class extends z{constructor(){super({id:"notebook.findNext.fromWidget",title:P(13502,"Find Next"),keybinding:{when:C.and(wr,HT),primary:61,mac:{primary:2085,secondary:[61]},weight:201}})}async run(a){return ATo(a,!0)}});W(class extends z{constructor(){super({id:"notebook.findPrevious.fromWidget",title:P(13503,"Find Previous"),keybinding:{when:C.and(wr,HT),primary:1085,mac:{primary:3109,secondary:[1085]},weight:201}})}async run(a){return ATo(a,!1)}});var rhn="notebook.addFindMatchToSelection",shn="notebook.selectAllFindMatches";var vk={IsNotebookMultiCursor:new Y("isNotebookMultiSelect",!1),NotebookMultiSelectCursorState:new Y("notebookMultiSelectCursorState",0)},QR=class extends k{constructor(e,t,o,n,r,s,l){super();this.notebookEditor=e;this.contextKeyService=t;this.textModelService=o;this.languageConfigurationService=n;this.accessibilityService=r;this.configurationService=s;this.undoRedoService=l;this.word="",this.trackedCells=[],this.totalMatchesCount=0,this._onDidChangeAnchorCell=this._register(new T),this.onDidChangeAnchorCell=this._onDidChangeAnchorCell.event,this.anchorDisposables=this._register(new O),this.cursorsDisposables=this._register(new O),this.cursorsControllers=new dt,this.state=0,this._nbIsMultiSelectSession=vk.IsNotebookMultiCursor.bindTo(this.contextKeyService),this._nbMultiSelectState=vk.NotebookMultiSelectCursorState.bindTo(this.contextKeyService),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,this._register(this.onDidChangeAnchorCell(async()=>{await this.syncCursorsControllers(),this.syncAnchorListeners()}))}static{this.id="notebook.multiCursorController"}getState(){return this.state}syncAnchorListeners(){if(this.anchorDisposables.clear(),!this.anchorCell)throw new Error("Anchor cell is undefined");this.anchorDisposables.add(this.anchorCell[1].onWillType(e=>{let t=new RA;this.trackedCells.forEach(o=>{let n=this.cursorsControllers.get(o.cellViewModel.uri);n&&o.cellViewModel.handle!==this.anchorCell?.[0].handle&&n.type(t,e,"keyboard")})})),this.anchorDisposables.add(this.anchorCell[1].onDidType(()=>{this.state=2,this._nbMultiSelectState.set(2);let e=this.cursorsControllers.get(this.anchorCell[0].uri);if(!e)return;let t=this.notebookEditor.activeCodeEditor?.getSelections();t&&(e.setSelections(new RA,"keyboard",t,3),this.trackedCells.forEach(o=>{let n=this.cursorsControllers.get(o.cellViewModel.uri);n&&(o.initialSelection=n.getSelection(),o.matchSelections=[])}),this.updateLazyDecorations())})),this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorSelection(e=>{if(e.source==="mouse"){this.resetToIdleState();return}if(!e.oldSelections||e.reason===0||e.reason===2)return;let t={deltaStartCol:e.selection.startColumn-e.oldSelections[0].startColumn,deltaStartLine:e.selection.startLineNumber-e.oldSelections[0].startLineNumber,deltaEndCol:e.selection.endColumn-e.oldSelections[0].endColumn,deltaEndLine:e.selection.endLineNumber-e.oldSelections[0].endLineNumber},o=e.selection.getDirection();this.trackedCells.forEach(n=>{let r=this.cursorsControllers.get(n.cellViewModel.uri);if(!r)return;let s=r.getSelections().map(l=>{let c=l.startColumn+t.deltaStartCol,u=l.startLineNumber+t.deltaStartLine,p=l.endColumn+t.deltaEndCol,h=l.endLineNumber+t.deltaEndLine;return ei.createWithDirection(u,c,h,p,o)});r.setSelections(new RA,e.source,s,3)}),this.updateLazyDecorations()})),this.anchorDisposables.add(this.anchorCell[1].onWillTriggerEditorOperationEvent(e=>{this.handleEditorOperationEvent(e)})),this.anchorDisposables.add(this.anchorCell[1].onDidBlurEditorWidget(()=>{(this.state===1||this.state===2)&&this.resetToIdleState()}))}async syncCursorsControllers(){this.cursorsDisposables.clear(),await Promise.all(this.trackedCells.map(async e=>{let t=await this.createCursorController(e);if(!t)return;this.cursorsControllers.set(e.cellViewModel.uri,t);let o=e.matchSelections;t.setSelections(new RA,void 0,o,3)})),this.updateLazyDecorations()}async createCursorController(e){let t=await this.textModelService.createModelReference(e.cellViewModel.uri),o=t.object.textEditorModel;if(!o){t.dispose();return}this.cursorsDisposables.add(t);let n=this.constructCursorSimpleModel(e.cellViewModel),r=this.constructCoordinatesConverter(),s=e.editorConfig,l=this.cursorsDisposables.add(new ske(o,n,r,new DB(o.getLanguageId(),o.getOptions(),s,this.languageConfigurationService)));return l.setSelections(new RA,void 0,e.matchSelections,3),l}constructCoordinatesConverter(){return{convertViewPositionToModelPosition(e){return e},convertViewRangeToModelRange(e){return e},validateViewPosition(e,t){return e},validateViewRange(e,t){return e},convertModelPositionToViewPosition(e,t,o,n){return e},convertModelRangeToViewRange(e,t){return e},modelPositionIsVisible(e){return!0},getModelLineViewLineCount(e){return 1},getViewLineNumberOfModelPosition(e,t){return e}}}constructCursorSimpleModel(e){return{getLineCount(){return e.textBuffer.getLineCount()},getLineContent(t){return e.textBuffer.getLineContent(t)},getLineMinColumn(t){return e.textBuffer.getLineMinColumn(t)},getLineMaxColumn(t){return e.textBuffer.getLineMaxColumn(t)},getLineFirstNonWhitespaceColumn(t){return e.textBuffer.getLineFirstNonWhitespaceColumn(t)},getLineLastNonWhitespaceColumn(t){return e.textBuffer.getLineLastNonWhitespaceColumn(t)},normalizePosition(t,o){return t},getLineIndentColumn(t){return rke(e.textBuffer.getLineContent(t))+1}}}handleEditorOperationEvent(e){this.trackedCells.forEach(t=>{if(t.cellViewModel.handle===this.anchorCell?.[0].handle)return;let o=new RA,n=this.cursorsControllers.get(t.cellViewModel.uri);n&&this.executeEditorOperation(n,o,e)})}executeEditorOperation(e,t,o){switch(o.handlerId){case"compositionStart":e.startComposition(t);break;case"compositionEnd":e.endComposition(t,o.source);break;case"replacePreviousChar":{let n=o.payload;e.compositionType(t,n.text||"",n.replaceCharCnt||0,0,0,o.source);break}case"compositionType":{let n=o.payload;e.compositionType(t,n.text||"",n.replacePrevCharCnt||0,n.replaceNextCharCnt||0,n.positionDelta||0,o.source);break}case"paste":{let n=o.payload;e.paste(t,n.text||"",n.pasteOnNewLine||!1,n.multicursorText||null,o.source);break}case"cut":e.cut(t,o.source);break}}updateViewModelSelections(){for(let e of this.trackedCells){let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;e.cellViewModel.setSelections(t.getSelections())}}updateFinalUndoRedo(){if(!this.anchorCell?.[1].getModel())return;let t=new dt,o=[];this.trackedCells.forEach(n=>{if(!n.undoRedoHistory)return;o.push(n.cellViewModel.uri);let s=this.undoRedoService.getElements(n.cellViewModel.uri).past.slice(),l=n.undoRedoHistory.past.slice(),c=s.slice(l.length);c.length!==0&&(t.set(n.cellViewModel.uri,c),this.undoRedoService.removeElements(n.cellViewModel.uri),l.forEach(u=>{this.undoRedoService.pushElement(u)}))}),this.undoRedoService.pushElement({type:1,resources:o,label:"Multi Cursor Edit",code:"multiCursorEdit",confirmBeforeUndo:!1,undo:async()=>{t.forEach(async n=>{n.reverse().forEach(async r=>{await r.undo()})})},redo:async()=>{t.forEach(async n=>{n.forEach(async r=>{await r.redo()})})}})}resetToIdleState(){this.state=0,this._nbMultiSelectState.set(0),this._nbIsMultiSelectSession.set(!1),this.updateFinalUndoRedo(),this.trackedCells.forEach(e=>{this.clearDecorations(e),e.cellViewModel.setSelections([e.initialSelection])}),this.anchorDisposables.clear(),this.anchorCell=void 0,this.cursorsDisposables.clear(),this.cursorsControllers.clear(),this.trackedCells=[],this.totalMatchesCount=0,this.startPosition=void 0,this.word=""}async findAndTrackNextSelection(e){if(this.state===0){let t=e.textModel;if(!t)return;let o=e.getSelections()[0],n=this.getWord(o,t);if(!n)return;this.word=n.word;let r=this.notebookEditor.textModel;if(r){let c=r.findMatches(this.word,!1,!0,kB);this.totalMatchesCount=c.reduce((u,p)=>u+p.matches.length,0)}let s=this.notebookEditor.getCellIndex(e);if(s===void 0)return;this.startPosition={cellIndex:s,position:new ye(o.startLineNumber,n.startColumn)};let l=new ei(o.startLineNumber,n.startColumn,o.startLineNumber,n.endColumn);if(e.setSelections([l]),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||this.anchorCell[0].handle!==e.handle)throw new Error("Active cell is not the same as the cell passed as context");if(!(this.anchorCell[1]instanceof us))throw new Error("Active cell is not an instance of CodeEditorWidget");await this.updateTrackedCell(e,[l]),this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1),this._onDidChangeAnchorCell.fire()}else if(this.state===1){let t=this.notebookEditor.textModel;if(!t)return;let o=this.notebookEditor.getCellIndex(e);if(o===void 0||!this.startPosition||this.trackedCells.reduce((l,c)=>l+c.matchSelections.length,0)>=this.totalMatchesCount)return;let r=t.findNextMatch(this.word,{cellIndex:o,position:e.getSelections()[e.getSelections().length-1].getEndPosition()},!1,!0,kB,this.startPosition);if(!r)return;let s=this.notebookEditor.getCellByHandle(r.cell.handle);if(!s)return;if(r.cell.handle===e.handle){let l=[...e.getSelections(),ei.fromRange(r.match.range,0)],c=await this.updateTrackedCell(e,l);s.setSelections(c.matchSelections)}else if(r.cell.handle!==e.handle){await this.notebookEditor.revealRangeInViewAsync(s,r.match.range),await this.notebookEditor.focusNotebookCell(s,"editor");let l=await this.updateTrackedCell(s,[ei.fromRange(r.match.range,0)]);if(s.setSelections(l.matchSelections),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||!(this.anchorCell[1]instanceof us))throw new Error("Active cell is not an instance of CodeEditorWidget");this._onDidChangeAnchorCell.fire(),this.initializeMultiSelectDecorations(this.trackedCells.find(c=>c.cellViewModel.handle===e.handle))}}}async selectAllMatches(e,t){let o=this.notebookEditor.textModel;o&&(t?await this.handleFindWidgetSelectAllMatches(t):await this.handleCellEditorSelectAllMatches(o,e),await this.syncCursorsControllers(),this.syncAnchorListeners(),this.updateLazyDecorations())}async handleFindWidgetSelectAllMatches(e){if(this.state===0&&e.length){await this.notebookEditor.focusNotebookCell(e[0].cell,"editor"),this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,this.trackedCells=[];for(let t of e)this.updateTrackedCell(t.cell,t.contentMatches.map(o=>ei.fromRange(o.range,0))),this.anchorCell&&t.cell.handle===this.anchorCell[0].handle&&t.cell.setSelections(t.contentMatches.map(o=>ei.fromRange(o.range,0)));this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1)}}async handleCellEditorSelectAllMatches(e,t){if(this.state===0){let o=t.textModel;if(!o)return;let n=t.getSelections()[0],r=this.getWord(n,o);if(!r)return;this.word=r.word;let s=this.notebookEditor.getCellIndex(t);if(s===void 0)return;if(this.startPosition={cellIndex:s,position:new ye(n.startLineNumber,r.startColumn)},this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell||this.anchorCell[0].handle!==t.handle)throw new Error("Active cell is not the same as the cell passed as context");if(!(this.anchorCell[1]instanceof us))throw new Error("Active cell is not an instance of CodeEditorWidget");let l=e.findMatches(this.word,!1,!0,kB);this.trackedCells=[];for(let c of l)if(await this.updateTrackedCell(c.cell,c.matches.map(u=>ei.fromRange(u.range,0))),c.cell.handle===t.handle){let u=this.notebookEditor.getCellByHandle(c.cell.handle);u&&u.setSelections(c.matches.map(p=>ei.fromRange(p.range,0)))}this._nbIsMultiSelectSession.set(!0),this.state=1,this._nbMultiSelectState.set(1)}else if(this.state===1){let o=e.findMatches(this.word,!1,!0,kB);for(let n of o)await this.updateTrackedCell(n.cell,n.matches.map(r=>ei.fromRange(r.range,0)))}}async updateTrackedCell(e,t){let o=e instanceof AQ?this.notebookEditor.getCellByHandle(e.handle):e;if(!o)throw new Error("Cell not found");let n=this.trackedCells.find(r=>r.cellViewModel.handle===o.handle);if(n)this.clearDecorations(n),n.matchSelections=t;else{let r=o.getSelections()[0];(await o.resolveTextModel()).pushStackElement();let l=this.constructCellEditorOptions(o),c=l.getRawOptions(),u={cursorStyle:pSt(c.cursorStyle),cursorBlinking:Fni(c.cursorBlinking),cursorSmoothCaretAnimation:c.cursorSmoothCaretAnimation};n={cellViewModel:o,initialSelection:r,matchSelections:t,editorConfig:l,cursorConfig:u,decorationIds:[],undoRedoHistory:this.undoRedoService.getElements(o.uri)},this.trackedCells.push(n)}return n}async deleteLeft(){this.trackedCells.forEach(e=>{let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let[,o]=bF.deleteLeft(t.getPrevEditOperationType(),t.context.cursorConfig,t.context.model,t.getSelections(),t.getAutoClosedCharacters()),n=FX.executeCommands(t.context.model,t.getSelections(),o);n&&t.setSelections(new RA,void 0,n,3)}),this.updateLazyDecorations()}async deleteRight(){this.trackedCells.forEach(e=>{let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let[,o]=bF.deleteRight(t.getPrevEditOperationType(),t.context.cursorConfig,t.context.model,t.getSelections());if(e.cellViewModel.handle!==this.anchorCell?.[0].handle){let n=FX.executeCommands(t.context.model,t.getSelections(),o);if(!n)return;t.setSelections(new RA,void 0,n,3)}else t.setSelections(new RA,void 0,e.cellViewModel.getSelections(),3)}),this.updateLazyDecorations()}async undo(){let e=[];for(let t of this.trackedCells){let o=await t.cellViewModel.resolveTextModel();o&&e.push(o)}await Promise.all(e.map(t=>t.undo())),this.updateViewModelSelections(),this.updateLazyDecorations()}async redo(){let e=[];for(let t of this.trackedCells){let o=await t.cellViewModel.resolveTextModel();o&&e.push(o)}await Promise.all(e.map(t=>t.redo())),this.updateViewModelSelections(),this.updateLazyDecorations()}constructCellEditorOptions(e){let t=new oV(this.notebookEditor.getBaseCellEditorOptions(e.language),this.notebookEditor.notebookOptions,this.configurationService),o=t.getUpdatedValue(e.internalMetadata,e.uri);return t.dispose(),new eX(!1,R.EditorContent,o,null,this.accessibilityService)}initializeMultiSelectDecorations(e){if(!e)return;let t=[];e.matchSelections.forEach(o=>{t.push({range:ei.fromPositions(o.getEndPosition()),options:{description:"",className:this.getClassName(e.cursorConfig,!0)}})}),e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,t)}updateLazyDecorations(){this.trackedCells.forEach(e=>{if(e.cellViewModel.handle===this.anchorCell?.[0].handle)return;let t=this.cursorsControllers.get(e.cellViewModel.uri);if(!t)return;let o=t.getSelections(),n=[];o?.map(r=>{r.isEmpty()||n.push({range:r,options:{description:"",className:this.getClassName(e.cursorConfig,!1)}}),n.push({range:ei.fromPositions(r.getPosition()),options:{description:"",zIndex:1e4,className:this.getClassName(e.cursorConfig,!0)}})}),e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,n)})}clearDecorations(e){e.decorationIds=e.cellViewModel.deltaModelDecorations(e.decorationIds,[])}getWord(e,t){let o=e.startLineNumber,n=e.startColumn;return t.isDisposed()?null:t.getWordAtPosition({lineNumber:o,column:n})}getClassName(e,t){let o=t?".nb-multicursor-cursor":".nb-multicursor-selection";if(t){switch(e.cursorStyle){case 1:break;case 2:o+=".nb-cursor-block-style";break;case 3:o+=".nb-cursor-underline-style";break;case 4:o+=".nb-cursor-line-thin-style";break;case 5:o+=".nb-cursor-block-outline-style";break;case 6:o+=".nb-cursor-underline-thin-style";break;default:break}switch(e.cursorBlinking){case 1:o+=".nb-blink";break;case 2:o+=".nb-smooth";break;case 3:o+=".nb-phase";break;case 4:o+=".nb-expand";break;case 5:o+=".nb-solid";break;default:o+=".nb-solid";break}(e.cursorSmoothCaretAnimation==="on"||e.cursorSmoothCaretAnimation==="explicit")&&(o+=".nb-smooth-caret-animation")}return o}dispose(){super.dispose(),this.anchorDisposables.dispose(),this.cursorsDisposables.dispose(),this.trackedCells.forEach(e=>{this.clearDecorations(e)}),this.trackedCells=[]}};QR=I([m(1,X),m(2,Bt),m(3,Us),m(4,Ai),m(5,B),m(6,wl)],QR);var gOi=class extends Np{constructor(){super({id:shn,title:d(13536,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0)),keybinding:{when:C.or(C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,bP),C.and(C.equals("config.notebook.multiCursor.enabled",!0),wKt)),primary:3114,weight:200}})}async runWithContext(i,e){let t=i.get(ie),o=lr(t.activeEditorPane);if(!o||!e.cell)return;let n=o.getContribution(QR.id),r=o.getContribution(GC.id);if(r.widget.isFocused){let s=r.widget.findModel;n.selectAllMatches(e.cell,s.findMatches)}else n.selectAllMatches(e.cell)}},fOi=class extends Np{constructor(){super({id:rhn,title:d(13532,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,bP),keybinding:{when:C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,bP),primary:2082,weight:200}})}async runWithContext(i,e){let t=i.get(ie),o=lr(t.activeEditorPane);if(!o||!e.cell)return;o.getContribution(QR.id).findAndTrackNextSelection(e.cell)}},vOi=class extends Np{constructor(){super({id:"noteMultiCursor.exit",title:d(13535,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,vk.IsNotebookMultiCursor),keybinding:{when:C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,vk.IsNotebookMultiCursor),primary:9,weight:200}})}async runWithContext(i,e){let t=i.get(ie),o=lr(t.activeEditorPane);if(!o)return;o.getContribution(QR.id).resetToIdleState()}},bOi=class extends Np{constructor(){super({id:"noteMultiCursor.deleteLeft",title:d(13533,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,vk.IsNotebookMultiCursor,C.or(vk.NotebookMultiSelectCursorState.isEqualTo(1),vk.NotebookMultiSelectCursorState.isEqualTo(2))),keybinding:{when:C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,vk.IsNotebookMultiCursor,C.or(vk.NotebookMultiSelectCursorState.isEqualTo(1),vk.NotebookMultiSelectCursorState.isEqualTo(2))),primary:1,weight:200}})}async runWithContext(i,e){let t=i.get(ie),o=lr(t.activeEditorPane);if(!o)return;o.getContribution(QR.id).deleteLeft()}},SOi=class extends Np{constructor(){super({id:"noteMultiCursor.deleteRight",title:d(13534,null),precondition:C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,vk.IsNotebookMultiCursor,C.or(vk.NotebookMultiSelectCursorState.isEqualTo(1),vk.NotebookMultiSelectCursorState.isEqualTo(2))),keybinding:{when:C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,vk.IsNotebookMultiCursor,C.or(vk.NotebookMultiSelectCursorState.isEqualTo(1),vk.NotebookMultiSelectCursorState.isEqualTo(2))),primary:20,weight:200}})}async runWithContext(i,e){let t=i.get(ie),o=lr(t.activeEditorPane);if(!o)return;let n=o.activeCodeEditor;if(!n)return;VL.DeleteRight.runEditorCommand(i,n,null),o.getContribution(QR.id).deleteRight()}},nVe=class extends k{constructor(e,t){super();this._editorService=e;this.configurationService=t;if(!this.configurationService.getValue("notebook.multiCursor.enabled"))return;let o=10005;this._register(pD.addImplementation(o,"notebook-multicursor-undo-redo",()=>{let n=lr(this._editorService.activeEditorPane);return!n||!n.hasModel()?!1:n.getContribution(QR.id).undo()},C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,vk.IsNotebookMultiCursor))),this._register(mD.addImplementation(o,"notebook-multicursor-undo-redo",()=>{let n=lr(this._editorService.activeEditorPane);return!n||!n.hasModel()?!1:n.getContribution(QR.id).redo()},C.and(C.equals("config.notebook.multiCursor.enabled",!0),nl,vk.IsNotebookMultiCursor)))}static{this.ID="workbench.contrib.notebook.multiCursorUndoRedo"}};nVe=I([m(0,ie),m(1,B)],nVe);Hm(QR.id,QR);bt(nVe.ID,nVe,vt.BlockRestore);W(gOi);W(fOi);W(vOi);W(bOi);W(SOi);var Dat=class{constructor(i){this._editorService=i}canParticipate(){let e=lr(this._editorService.activeEditorPane)?.getContribution(QR.id);return e?e.getState()!==2:!0}},Cat=class{constructor(i,e,t,o,n,r){this.editorWorkerService=i;this.languageFeaturesService=e;this.instantiationService=t;this.textModelService=o;this.bulkEditService=n;this.configurationService=r}async participate(i,e,t,o){if(!i.model||!(i.model instanceof iU)||e.reason===2||!this.configurationService.getValue(Ct.formatOnSave))return;t.report({message:d(13572,null)});let r=i.model.notebookModel,s=await this.instantiationService.invokeFunction(Ove.checkAndRunFormatCodeAction,r,t,o),l=new O;try{if(!s){let c=await Promise.all(r.cells.map(async u=>{let p=await this.textModelService.createModelReference(u.uri);l.add(p);let h=p.object.textEditorModel,g=await J6e(this.editorWorkerService,this.languageFeaturesService,h,2,o),f=[];return g?(f.push(...g.map(v=>new hl(h.uri,v,h.getVersionId()))),f):[]}));await this.bulkEditService.apply(c.flat(),{label:d(13570,null),code:"undoredo.formatNotebook"})}}finally{t.report({increment:100}),l.dispose()}}};Cat=I([m(0,Qs),m(1,Jt),m(2,F),m(3,Bt),m(4,Ka),m(5,B)],Cat);var xat=class extends Dat{constructor(e,t,o,n){super(t);this.configurationService=e;this.editorService=t;this.textModelService=o;this.bulkEditService=n}async participate(e,t,o,n){let r=this.configurationService.getValue("files.trimTrailingWhitespace"),s=this.configurationService.getValue("files.trimTrailingWhitespaceInRegexAndStrings");r&&this.canParticipate()&&await this.doTrimTrailingWhitespace(e,t.reason===2,s,o)}async doTrimTrailingWhitespace(e,t,o,n){if(!e.model||!(e.model instanceof iU))return;let r=new O,s=e.model.notebookModel,l=IOi(this.editorService),c=[],u=[];try{let h=(await Promise.all(s.cells.map(async g=>{if(g.cellKind!==2)return[];let f=await this.textModelService.createModelReference(g.uri);r.add(f);let v=f.object.textEditorModel;if(l&&g.uri.toString()===l.getModel()?.uri.toString()&&(u=l.getSelections()??[],t)){c=u.map(w=>w.getPosition());let y=ss.get(l)?.getSessionEnclosingRange();if(y)for(let w=y.startLineNumber;w<=y.endLineNumber;w++)c.push(new ye(w,v.getLineMaxColumn(w)))}let S=r9e(v,c,o);return S.length?S.map(y=>new hl(v.uri,{...y,text:y.text||""},v.getVersionId())):[]}))).flat().filter(g=>g!==void 0);await this.bulkEditService.apply(h,{label:d(13577,null),code:"undoredo.notebookTrimTrailingWhitespace"})}finally{n.report({increment:100}),r.dispose()}}};xat=I([m(0,B),m(1,ie),m(2,Bt),m(3,Ka)],xat);var kat=class extends Dat{constructor(e,t,o){super(t);this.configurationService=e;this.editorService=t;this.bulkEditService=o}async participate(e,t,o,n){this.configurationService.getValue("files.trimFinalNewlines")&&this.canParticipate()&&await this.doTrimFinalNewLines(e,t.reason===2,o)}findLastNonEmptyLine(e){for(let t=e.getLineCount();t>=1;t--)if(e.getLineLength(t))return t;return 0}async doTrimFinalNewLines(e,t,o){if(!e.model||!(e.model instanceof iU))return;let n=new O,r=e.model.notebookModel,s=IOi(this.editorService);try{let c=(await Promise.all(r.cells.map(async u=>{if(u.cellKind!==2)return;let p=0,h=s&&u.uri.toString()===s.getModel()?.uri.toString();if(t&&h){let S=s.getSelections()??[];for(let y of S)p=Math.max(p,y.selectionStartLineNumber)}let g=u.textBuffer,f=this.findLastNonEmptyLine(g),v=Math.max(f+1,p+1);if(v>g.getLineCount())return;let b=new G(v,1,g.getLineCount(),g.getLineLastNonWhitespaceColumn(g.getLineCount()));if(!b.isEmpty())return new hl(u.uri,{range:b,text:""},u.textModel?.getVersionId())}))).flat().filter(u=>u!==void 0);await this.bulkEditService.apply(c,{label:d(13576,null),code:"undoredo.trimFinalNewLines"})}finally{o.report({increment:100}),n.dispose()}}};kat=I([m(0,B),m(1,ie),m(2,Ka)],kat);var Eat=class extends Dat{constructor(e,t,o){super(o);this.configurationService=e;this.bulkEditService=t;this.editorService=o}async participate(e,t,o,n){this.configurationService.getValue(Ct.insertFinalNewline)&&this.canParticipate()&&await this.doInsertFinalNewLine(e,t.reason===2,o)}async doInsertFinalNewLine(e,t,o){if(!e.model||!(e.model instanceof iU))return;let n=new O,r=e.model.notebookModel,s=IOi(this.editorService),l;s&&(l=s.getSelections()??[]);try{let u=(await Promise.all(r.cells.map(async p=>{if(p.cellKind!==2)return;let h=p.textBuffer.getLineCount(),g=p.textBuffer.getLineFirstNonWhitespaceColumn(h)===0;if(!(!h||g))return new hl(p.uri,{range:new G(h+1,p.textBuffer.getLineLength(h),h+1,p.textBuffer.getLineLength(h)),text:p.textBuffer.getEOL()},p.textModel?.getVersionId())}))).filter(p=>p!==void 0);await this.bulkEditService.apply(u,{label:d(13571,null),code:"undoredo.insertFinalNewLine"}),s&&l&&s.setSelections(l)}finally{o.report({increment:100}),n.dispose()}}};Eat=I([m(0,B),m(1,Ka),m(2,ie)],Eat);var Tat=class{constructor(i,e,t,o,n){this.configurationService=i;this.logService=e;this.workspaceTrustManagementService=t;this.textModelService=o;this.instantiationService=n}async participate(i,e,t,o){if(!this.workspaceTrustManagementService.isWorkspaceTrusted()||!i.model||!(i.model instanceof iU))return;let r="";if(e.reason===2)return;if(e.reason===1)r="explicit";else return;let s=i.model.notebookModel,l=this.configurationService.getValue(Ct.codeActionsOnSave),c=Array.isArray(l)?l:Object.keys(l).filter(v=>l[v]),u=this.createCodeActionsOnSave(c),p=u.filter(v=>l[v.value]==="never"||l[v.value]===!1),h=u.filter(v=>l[v.value]===r||l[v.value]===!0),g=h.filter(v=>!Nr.Notebook.contains(v)),f=h.filter(v=>Nr.Notebook.contains(v));if(f.length){let v=new O;t.report({message:d(13575,null)});try{let b=s.cells[0],S=await this.textModelService.createModelReference(b.uri);v.add(S);let y=S.object.textEditorModel;await this.instantiationService.invokeFunction(Ove.applyOnSaveGenericCodeActions,y,f,p,t,o)}catch{this.logService.error("Failed to apply notebook code action on save")}finally{t.report({increment:100}),v.dispose()}}if(g.length){Array.isArray(l)||g.sort((b,S)=>Nr.SourceFixAll.contains(b)?Nr.SourceFixAll.contains(S)?0:-1:Nr.SourceFixAll.contains(S)?1:0);let v=new O;t.report({message:d(13573,null)});try{await Promise.all(s.cells.map(async b=>{let S=await this.textModelService.createModelReference(b.uri);v.add(S);let y=S.object.textEditorModel;await this.instantiationService.invokeFunction(Ove.applyOnSaveGenericCodeActions,y,g,p,t,o)}))}catch{this.logService.error("Failed to apply code action on save")}finally{t.report({increment:100}),v.dispose()}}}createCodeActionsOnSave(i){let e=i.map(t=>new Rs(t));return e.filter(t=>e.every(o=>o.equals(t)||!o.contains(t)))}};Tat=I([m(0,B),m(1,re),m(2,Or),m(3,Bt),m(4,F)],Tat);var Ove=class a{static async checkAndRunFormatCodeAction(i,e,t,o){let n=i.get(F),r=i.get(Bt),s=i.get(re),l=i.get(B),c=new O,u=!1;t.report({message:d(13574,null)});try{let p=e.cells[0],h=await r.createModelReference(p.uri);c.add(h);let g=h.object.textEditorModel,f=l.getValue(Ct.defaultFormatter);u=await n.invokeFunction(a.applyOnSaveFormatCodeAction,g,new Rs("notebook.format"),[],f,t,o)}catch{s.error("Failed to apply notebook format action on save")}finally{t.report({increment:100}),c.dispose()}return u}static async applyOnSaveGenericCodeActions(i,e,t,o,n,r){let s=i.get(F),l=i.get(Jt),c=i.get(re),u=new class{constructor(){this._names=new Set}_report(){n.report({message:d(13569,null,[...this._names].map(p=>`'${p}'`).join(", "),"command:workbench.action.openSettings?%5B%22notebook.codeActionsOnSave%22%5D")})}report(p){p.displayName&&!this._names.has(p.displayName)&&(this._names.add(p.displayName),this._report())}};for(let p of t){let h=await a.getActionsToRun(e,p,o,l,u,r);if(r.isCancellationRequested){h.dispose();return}try{for(let g of h.validActions){let f=g.action.edit?.edits,v=!1;if(!g.action.kind?.startsWith("notebook"))for(let b of f??[]){let S=b;if(!(S.resource&&ze(S.resource,e.uri))){v=!0;break}}if(v){c.warn("Failed to apply code action on save, applied to multiple resources.");continue}if(n.report({message:d(13568,null,g.action.title)}),await s.invokeFunction(v4,g,"onSave",{},r),r.isCancellationRequested)return}}catch{}finally{h.dispose()}}}static async applyOnSaveFormatCodeAction(i,e,t,o,n,r,s){let l=i.get(F),c=i.get(Jt),u=i.get(re),p=new class{constructor(){this._names=new Set}_report(){r.report({message:d(13569,null,[...this._names].map(g=>`'${g}'`).join(", "),"command:workbench.action.openSettings?%5B%22notebook.defaultFormatter%22%5D")})}report(g){g.displayName&&!this._names.has(g.displayName)&&(this._names.add(g.displayName),this._report())}},h=await a.getActionsToRun(e,t,o,c,p,s);if(h.validActions.length>1&&!n&&u.warn("More than one format code action is provided, the 0th one will be used. A default can be specified via `notebook.defaultFormatter` in your settings."),s.isCancellationRequested)return h.dispose(),!1;try{let g=n?h.validActions.find(f=>f.provider?.extensionId===n):h.validActions[0];if(!g||(r.report({message:d(13568,null,g.action.title)}),await l.invokeFunction(v4,g,"onSave",{},s),s.isCancellationRequested))return!1}catch{return u.error("Failed to apply notebook format code action on save"),!1}finally{h.dispose()}return!0}static getActionsToRun(i,e,t,o,n,r){return cM(o.codeActionProvider,i,i.getFullModelRange(),{type:1,triggerAction:"save participants",filter:{include:e,excludes:t,includeSourceActions:!0}},n,r)}};function IOi(a){let i=a.activeEditorPane;return lr(i)?.activeCodeEditor}var _at=class extends k{constructor(e,t){super();this.instantiationService=e;this.workingCopyFileService=t;this.registerSaveParticipants()}registerSaveParticipants(){this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(xat))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(Tat))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(Cat))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(Eat))),this._register(this.workingCopyFileService.addSaveParticipant(this.instantiationService.createInstance(kat)))}};_at=I([m(0,F),m(1,gm)],_at);var ahn=oe.as(Zi.Workbench);ahn.registerWorkbenchContribution(_at,3);W(class extends z{constructor(){super({id:"notebook.format",title:P(13526,"Format Notebook"),category:Ph,precondition:C.and(nl,cc),keybinding:{when:me.editorTextFocus.toNegated(),primary:1572,linux:{primary:3111},weight:200},f1:!0,menu:{id:R.EditorContext,when:C.and(me.inCompositeEditor,me.hasDocumentFormattingProvider),group:"1_modification",order:1.3}})}async run(a){let i=a.get(ie),e=a.get(Bt),t=a.get(Qs),o=a.get(Jt),n=a.get(Ka),r=a.get(F),s=lr(i.activeEditorPane);if(!s||!s.hasModel())return;let l=s.textModel,c=await r.invokeFunction(Ove.checkAndRunFormatCodeAction,l,nh.None,Ie.None),u=new O;try{if(!c){let p=await Promise.all(l.cells.map(async h=>{let g=await e.createModelReference(h.uri);u.add(g);let f=g.object.textEditorModel,v=await J6e(t,o,f,1,Ie.None),b=[];if(v){for(let S of v)b.push(new hl(f.uri,S,f.getVersionId()));return b}return[]}));await n.apply(p.flat(),{label:d(13529,null),code:"undoredo.formatNotebook"})}}finally{u.dispose()}}});ri(class extends Mi{constructor(){super({id:"notebook.formatCell",label:P(13527,"Format Cell"),precondition:C.and(nl,cc,me.inCompositeEditor,me.writable,me.hasDocumentFormattingProvider),kbOpts:{kbExpr:C.and(me.editorTextFocus),primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.301}})}async run(i,e){e.hasModel()&&await i.get(F).invokeFunction(Eue,e,1,nh.None,Ie.None,!0)}});var Rat=class{constructor(i,e,t,o,n,r){this.bulkEditService=i;this.languageFeaturesService=e;this.textModelService=t;this.editorWorkerService=o;this.configurationService=n;this._notebookService=r}async onWillExecuteCell(i){if(!this.configurationService.getValue(Ct.formatOnCellExecution))return;let t=new O;try{let o=await Promise.all(i.map(async n=>{let r=this._notebookService.getNotebookTextModel(n.notebook);if(!r)return[];let s;for(let h of r.cells)if(h.handle===n.cellHandle){s=h;break}if(!s)return[];let l=await this.textModelService.createModelReference(s.uri);t.add(l);let c=l.object.textEditorModel,u=await J6e(this.editorWorkerService,this.languageFeaturesService,c,2,Ie.None),p=[];return u?(p.push(...u.map(h=>new hl(c.uri,h,c.getVersionId()))),p):[]}));await this.bulkEditService.apply(o.flat(),{label:d(13528,null),code:"undoredo.notebooks.onWillExecuteFormat"})}finally{t.dispose()}}};Rat=I([m(0,Ka),m(1,Jt),m(2,Bt),m(3,Qs),m(4,B),m(5,kn)],Rat);var Lat=class extends k{constructor(e,t){super();this.instantiationService=e;this.notebookExecutionService=t;this.registerKernelExecutionParticipants()}registerKernelExecutionParticipants(){this._register(this.notebookExecutionService.registerExecutionParticipant(this.instantiationService.createInstance(Rat)))}};Lat=I([m(0,F),m(1,LZ)],Lat);var lhn=oe.as(Zi.Workbench);lhn.registerWorkbenchContribution(Lat,3);var K$t="hasOpenedNotebook",NTo="hasShownNotebookGettingStarted",Mat=class extends k{constructor(i,e,t,o,n){super();let r=nIo.bindTo(t),s=new $l("notebookGettingStarted2",e),l=s.getMemento(0,0);l[K$t]&&r.set(!0);let c=n.getValue(Ct.openGettingStarted)&&!l[NTo];if(!l[K$t]||c){let u=()=>{r.set(!0),l[K$t]=!0,c&&(o.executeCommand("workbench.action.openWalkthrough",{category:"notebooks",step:"notebookProfile"},!0),l[NTo]=!0),s.saveMemento()};if(i.activeEditor?.typeId===Ga.ID){u();return}let p=this._register(i.onDidActiveEditorChange(()=>{i.activeEditor?.typeId===Ga.ID&&(p.dispose(),u())}))}}};Mat=I([m(0,ie),m(1,de),m(2,X),m(3,fe),m(4,B)],Mat);oe.as(Zi.Workbench).registerWorkbenchContribution(Mat,3);W(class extends z{constructor(){super({id:"workbench.notebook.layout.gettingStarted",title:P(13530,"Reset notebook getting started"),f1:!0,precondition:C.equals(`config.${Ct.openGettingStarted}`,!0),category:Fe.Developer})}run(i){let e=i.get(de),t=new $l("notebookGettingStarted",e),o=t.getMemento(0,0);o[K$t]=void 0,t.saveMemento()}});var chn="notebook.toggleCellToolbarPosition",yOi=class extends z{constructor(){super({id:chn,title:P(13531,"Toggle Cell Toolbar Position"),menu:[{id:R.NotebookCellTitle,group:"View",order:1}],category:Ph,f1:!1})}async run(i,e){let t=e&&e.ui?e.notebookEditor:void 0;if(t&&t.hasModel()){let o=t.textModel.viewType,n=i.get(B),r=n.getValue(Ct.cellToolbarLocation),s=this.togglePosition(o,r);await n.updateValue(Ct.cellToolbarLocation,s)}}togglePosition(i,e){if(typeof e=="string")if(["left","right","hidden"].indexOf(e)>=0){let t=e==="right"?"left":"right",o={default:e};return o[i]=t,o}else{let t={default:"right"};return t[i]="left",t}else{let o=(e[i]??e.default??"right")==="right"?"left":"right",n={...e};return n[i]=o,n}}};W(yOi);var rVe=class{constructor(i,e,t){this._markerService=i;this._configService=t;this._dispoables=e.registerProvider(this)}static{this.ID="workbench.contrib.markerListProvider"}dispose(){this._dispoables.dispose()}getMarkerList(i){if(!i)return;let e=sn.parse(i);if(e)return new hue(t=>sn.parse(t)?.notebook.toString()===e.notebook.toString(),this._markerService,this._configService)}};rVe=I([m(0,ha),m(1,W6e),m(2,B)],rVe);var Fve=class extends k{constructor(e,t){super();this._notebookEditor=e;this._markerService=t;this._markersOverviewRulerDecorations=[];this._update(),this._register(this._notebookEditor.onDidChangeModel(()=>this._update())),this._register(this._markerService.onMarkerChanged(o=>{o.some(n=>this._notebookEditor.getCellsInRange().some(r=>ze(r.uri,n)))&&this._update()}))}static{this.id="workbench.notebook.markerDecoration"}_update(){if(!this._notebookEditor.hasModel())return;let e=[];this._notebookEditor.getCellsInRange().forEach(t=>{this._markerService.read({resource:t.uri,severities:12}).forEach(n=>{let r=n.severity===8?$v:Tg,s={startLineNumber:n.startLineNumber,startColumn:n.startColumn,endLineNumber:n.endLineNumber,endColumn:n.endColumn};e.push({handle:t.handle,options:{overviewRuler:{color:r,modelRanges:[s],includeOutput:!1,position:4}}})})}),this._markersOverviewRulerDecorations=this._notebookEditor.deltaCellDecorations(this._markersOverviewRulerDecorations,e)}};I([DA(100)],Fve.prototype,"_update",1),Fve=I([m(1,ha)],Fve);bt(rVe.ID,rVe,vt.BlockRestore);Hm(Fve.id,Fve);var dhn="notebook.focusTop",uhn="notebook.focusBottom",phn="notebook.focusPreviousEditor",mhn="notebook.focusNextEditor",hhn="notebook.cell.focusInOutput",ghn="notebook.cell.focusOutOutput",wOi="notebook.centerActiveCell",fhn="notebook.cell.cursorPageUp",vhn="notebook.cell.cursorPageUpSelect",bhn="notebook.cell.cursorPageDown",Shn="notebook.cell.cursorPageDownSelect";W(class extends z{constructor(){super({id:"notebook.cell.nullAction",title:d(13547,null),keybinding:[{when:Fie,primary:18,weight:201},{when:Fie,primary:16,weight:201}],f1:!1})}run(){}});W(class extends iu{constructor(){super({id:mhn,title:d(13537,null),keybinding:[{when:C.and(wr,Oa.negate(),C.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),C.and(C.has(Dp),me.editorTextFocus,ape.notEqualsTo("top"),ape.notEqualsTo("none"),C.or(lpe.isEqualTo("end"),lpe.isEqualTo("both"))),me.isEmbeddedDiffEditor.negate()),primary:18,weight:ov},{when:C.and(wr,Oa.negate(),C.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),C.and(lI.isEqualTo("markup"),Wie.isEqualTo(!1),xnt),me.isEmbeddedDiffEditor.negate()),primary:18,weight:200},{when:C.and(wr,vP),primary:2066,mac:{primary:2322},weight:200},{when:C.and(bP,Oa),primary:2060,mac:{primary:267},weight:201}]})}async runWithContext(i,e){let t=e.notebookEditor,o=e.cell,n=t.getCellIndex(o);if(typeof n!="number"||n>=t.getLength()-1)return;let r=o.textBuffer.getLineCount(),s=e.cell??e.selectedCells?.[0],l=s?Bie(e,s):void 0;if(l&&l.hasTextFocus()&&fu.get(l)?.getWidgetPosition()?.lineNumber===r)fu.get(l)?.focus();else{let c=t.cellAt(n+1),u=c.cellKind===1&&c.getEditState()===0?"container":"editor";await t.focusNotebookCell(c,u,{focusEditorLine:1})}}});W(class extends iu{constructor(){super({id:phn,title:d(13538,null),keybinding:[{when:C.and(wr,Oa.negate(),C.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),C.and(C.has(Dp),me.editorTextFocus,ape.notEqualsTo("bottom"),ape.notEqualsTo("none"),C.or(lpe.isEqualTo("start"),lpe.isEqualTo("both"))),me.isEmbeddedDiffEditor.negate()),primary:16,weight:ov},{when:C.and(wr,Oa.negate(),C.equals("config.notebook.navigation.allowNavigateToSurroundingCells",!0),C.and(lI.isEqualTo("markup"),Wie.isEqualTo(!1),xnt),me.isEmbeddedDiffEditor.negate()),primary:16,weight:200},{when:C.and(bP,Oa),primary:2059,mac:{primary:267},weight:201}]})}async runWithContext(i,e){let t=e.notebookEditor,o=e.cell,n=t.getCellIndex(o);if(typeof n!="number"||n<1||t.getLength()===0)return;let r=t.cellAt(n-1),s=r.cellKind===1&&r.getEditState()===0?"container":"editor",l=r.textBuffer.getLineCount();await t.focusNotebookCell(r,s,{focusEditorLine:l});let c=Bie(e,r);c&&fu.get(c)?.getWidgetPosition()?.lineNumber===l&&fu.get(c)?.focus()}});W(class extends Np{constructor(){super({id:dhn,title:d(13543,null),keybinding:[{when:C.and(wr,C.not(Dp)),primary:2062,weight:200},{when:C.and(wr,C.not(Dp)),mac:{primary:2064},weight:200}]})}async runWithContext(a,i){let e=i.notebookEditor;if(e.getLength()===0)return;let t=e.cellAt(0);await e.focusNotebookCell(t,"container")}});W(class extends Np{constructor(){super({id:uhn,title:d(13544,null),keybinding:[{when:C.and(wr,C.not(Dp)),primary:2061,mac:void 0,weight:200},{when:C.and(wr,C.not(Dp)),mac:{primary:2066},weight:200}]})}async runWithContext(a,i){let e=i.notebookEditor;if(!e.hasModel()||e.getLength()===0)return;let t=e.getLength()-1,o=e.getPreviousVisibleCellIndex(t);if(o){let n=e.cellAt(o);await e.focusNotebookCell(n,"container")}}});W(class extends iu{constructor(){super({id:hhn,title:P(13545,"Focus In Active Cell Output"),f1:!0,keybinding:[{when:C.and(aI.negate(),cC,PE),primary:2066,weight:200},{primary:3090,mac:{primary:2322},weight:200}],precondition:rIo})}async runWithContext(a,i){let e=i.notebookEditor,t=i.cell;return Li(0).then(()=>e.focusNotebookCell(t,"output"))}});W(class extends iu{constructor(){super({id:ghn,title:d(13546,null),keybinding:{primary:3088,mac:{primary:2320},weight:200},precondition:C.and(wr,vP)})}async runWithContext(a,i){let e=i.notebookEditor,t=i.cell;await e.focusNotebookCell(t,"editor")}});W(class extends iu{constructor(){super({id:wOi,title:d(13549,null),keybinding:{when:wr,primary:2090,mac:{primary:298},weight:200}})}async runWithContext(i,e){return e.notebookEditor.revealInCenter(e.cell)}});W(class extends iu{constructor(){super({id:fhn,title:d(13541,null),keybinding:[{when:C.and(wr,C.has(Dp),me.editorTextFocus),primary:11,weight:ov}]})}async runWithContext(a,i){ml.getEditorCommand("cursorPageUp").runCommand(a,{pageSize:G$t(i)})}});W(class extends iu{constructor(){super({id:vhn,title:d(13542,null),keybinding:[{when:C.and(wr,C.has(Dp),me.editorTextFocus,vP.negate()),primary:1035,weight:ov}]})}async runWithContext(a,i){ml.getEditorCommand("cursorPageUpSelect").runCommand(a,{pageSize:G$t(i)})}});W(class extends iu{constructor(){super({id:bhn,title:d(13539,null),keybinding:[{when:C.and(wr,C.has(Dp),me.editorTextFocus),primary:12,weight:ov}]})}async runWithContext(a,i){ml.getEditorCommand("cursorPageDown").runCommand(a,{pageSize:G$t(i)})}});W(class extends iu{constructor(){super({id:Shn,title:d(13540,null),keybinding:[{when:C.and(wr,C.has(Dp),me.editorTextFocus,vP.negate()),primary:1036,weight:ov}]})}async runWithContext(a,i){ml.getEditorCommand("cursorPageDownSelect").runCommand(a,{pageSize:G$t(i)})}});function G$t(a){let e=a.notebookEditor.getViewModel().layoutInfo,t=e?.fontInfo.lineHeight||17;return Math.max(1,Math.floor((e?.height||0)/t)-2)}oe.as($t.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.navigation.allowNavigateToSurroundingCells":{type:"boolean",default:!0,markdownDescription:d(13548,null)}}});var Ihn={default:{[Ct.focusIndicator]:"gutter",[Ct.insertToolbarLocation]:"both",[Ct.globalToolbar]:!0,[Ct.cellToolbarLocation]:{default:"right"},[Ct.compactView]:!0,[Ct.showCellStatusBar]:"visible",[Ct.consolidatedRunButton]:!0,[Ct.undoRedoPerCell]:!1},jupyter:{[Ct.focusIndicator]:"gutter",[Ct.insertToolbarLocation]:"notebookToolbar",[Ct.globalToolbar]:!0,[Ct.cellToolbarLocation]:{default:"left"},[Ct.compactView]:!0,[Ct.showCellStatusBar]:"visible",[Ct.consolidatedRunButton]:!1,[Ct.undoRedoPerCell]:!0},colab:{[Ct.focusIndicator]:"border",[Ct.insertToolbarLocation]:"betweenCells",[Ct.globalToolbar]:!1,[Ct.cellToolbarLocation]:{default:"right"},[Ct.compactView]:!1,[Ct.showCellStatusBar]:"hidden",[Ct.consolidatedRunButton]:!0,[Ct.undoRedoPerCell]:!1}};async function yhn(a,i){let e=[];for(let t in i)e.push(a.updateValue(t,i[t]));await Promise.all(e)}W(class extends z{constructor(){super({id:"notebook.setProfile",title:d(13567,null)})}async run(a,i){if(!whn(i))return;let e=a.get(B);return yhn(e,Ihn[i.profile])}});function whn(a){let i=a;return i.profile==="colab"||i.profile==="default"||i.profile==="jupyter"}var Pat=class{constructor(i,e){this._notebookService=i;this._languageService=e;this.viewType="*"}async provideCellStatusBarItems(i,e,t){let n=this._notebookService.getNotebookTextModel(i)?.cells[e];if(!n)return;let r=[],s=n.language;if(n.cellKind===1)s="markdown";else if(this._languageService.getLanguageIdByLanguageName(n.language))s=this._languageService.getLanguageName(s)??s;else{let c=d(13485,null,n.language);r.push({text:"$(dialog-warning)",command:{id:"workbench.extensions.search",arguments:[`@tag:${n.language}`],title:"Search Extensions"},tooltip:c,alignment:2,priority:-Number.MAX_SAFE_INTEGER+1})}return r.push({text:s,command:AMt,tooltip:d(13484,null),alignment:2,priority:-Number.MAX_SAFE_INTEGER}),{items:r}}};Pat=I([m(0,kn),m(1,Rt)],Pat);var Aat=class{constructor(i,e,t,o,n,r){this._notebookService=i;this._notebookKernelService=e;this._languageService=t;this._configurationService=o;this._languageDetectionService=n;this._keybindingService=r;this.viewType="*";this.cache=new dt}async provideCellStatusBarItems(i,e,t){let o=this._notebookService.getNotebookTextModel(i),n=o?.cells[e];if(!n)return;let r=this._configurationService.getValue("workbench.editor.languageDetectionHints");if(!(typeof r=="object"&&r?.notebookEditors))return;let l=n.uri,c=n.textModel?.getVersionId();if(!c)return;let u=n.cellKind===1?"markdown":this._languageService.getLanguageIdByLanguageName(n.language)||n.language;this.cache.has(l)||this.cache.set(l,{cellLanguage:u,updateTimestamp:0,contentVersion:1});let p=this.cache.get(l);if(p.cellLanguage!==u||p.updateTimestamp<Date.now()-1e3&&p.contentVersion!==c){p.updateTimestamp=Date.now(),p.cellLanguage=u,p.contentVersion=c;let g=this._notebookKernelService.getSelectedOrSuggestedKernel(o);if(g){let f=[...g.supportedLanguages,"markdown"];p.guess=await this._languageDetectionService.detectLanguage(n.uri,f)}}let h=[];if(p.guess&&u!==p.guess){let g=this._languageService.getLanguageName(p.guess)||p.guess,f=this._keybindingService.appendKeybinding(d(13483,null,g),gYe);h.push({text:"$(lightbulb-autofix)",command:gYe,tooltip:f,alignment:2,priority:-Number.MAX_SAFE_INTEGER+1})}return{items:h}}};Aat=I([m(0,kn),m(1,Ql),m(2,Rt),m(3,B),m(4,jS),m(5,Le)],Aat);var Nat=class extends k{constructor(i,e){super(),[Pat,Aat].forEach(o=>{this._register(e.registerCellStatusBarItemProvider(i.createInstance(o)))})}};Nat=I([m(0,F),m(1,Zee)],Nat);oe.as(Zi.Workbench).registerWorkbenchContribution(Nat,3);var sVe=class extends k{constructor(e){super();this._notebookEditor=e;this._onDidChangeVisibleCells=this._register(new T);this.onDidChangeVisibleCells=this._onDidChangeVisibleCells.event;this._viewModelDisposables=this._register(new O);this._visibleCells=[];this._register(this._notebookEditor.onDidChangeVisibleRanges(this._updateVisibleCells,this)),this._register(this._notebookEditor.onDidChangeModel(this._onModelChange,this)),this._updateVisibleCells()}get visibleCells(){return this._visibleCells}_onModelChange(){this._viewModelDisposables.clear(),this._notebookEditor.hasModel()&&this._viewModelDisposables.add(this._notebookEditor.onDidChangeViewCells(()=>this.updateEverything())),this.updateEverything()}updateEverything(){this._onDidChangeVisibleCells.fire({added:[],removed:Array.from(this._visibleCells)}),this._visibleCells=[],this._updateVisibleCells()}_updateVisibleCells(){if(!this._notebookEditor.hasModel())return;let e=yv(this._notebookEditor.visibleRanges).map(l=>this._notebookEditor.cellAt(l)).filter(so),t=new Set(e.map(l=>l.handle)),o=new Set(this._visibleCells.map(l=>l.handle)),n=cz(o,t),r=n.added.map(l=>this._notebookEditor.getCellByHandle(l)).filter(so),s=n.removed.map(l=>this._notebookEditor.getCellByHandle(l)).filter(so);this._visibleCells=e,this._onDidChangeVisibleCells.fire({added:r,removed:s})}};var aVe=class extends k{constructor(e,t){super();this._notebookEditor=e;this._notebookCellStatusBarService=t;this._visibleCells=new Map;this._observer=this._register(new sVe(this._notebookEditor)),this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells,this)),this._updateEverything(),this._register(this._notebookCellStatusBarService.onDidChangeProviders(this._updateEverything,this)),this._register(this._notebookCellStatusBarService.onDidChangeItems(this._updateEverything,this))}static{this.id="workbench.notebook.statusBar.contributed"}_updateEverything(){let e=this._observer.visibleCells.filter(s=>!this._visibleCells.has(s.handle)),t=new Set(this._observer.visibleCells.map(s=>s.handle)),o=Array.from(this._visibleCells.keys()),n=o.filter(s=>!t.has(s)),r=o.filter(s=>t.has(s));this._updateVisibleCells({added:e,removed:n.map(s=>({handle:s}))}),r.forEach(s=>this._visibleCells.get(s)?.update())}_updateVisibleCells(e){let t=this._notebookEditor.getViewModel();if(t){for(let o of e.added){let n=new COi(t,o,this._notebookCellStatusBarService);this._visibleCells.set(o.handle,n)}for(let o of e.removed)this._visibleCells.get(o.handle)?.dispose(),this._visibleCells.delete(o.handle)}}dispose(){super.dispose(),this._visibleCells.forEach(e=>e.dispose()),this._visibleCells.clear()}};aVe=I([m(1,Zee)],aVe);var COi=class extends k{constructor(e,t,o){super();this._notebookViewModel=e;this._cell=t;this._notebookCellStatusBarService=o;this._currentItemIds=[];this._currentItemLists=[];this._isDisposed=!1;this._updateThrottler=this._register(new am);this._register(ee(()=>this._activeToken?.dispose(!0))),this._updateSoon(),this._register(this._cell.model.onDidChangeContent(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeLanguage(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeMetadata(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._updateSoon())),this._register(this._cell.model.onDidChangeOutputs(()=>this._updateSoon()))}update(){this._updateSoon()}_updateSoon(){setTimeout(()=>{this._isDisposed||this._updateThrottler.queue(()=>this._update())},0)}async _update(){let e=this._notebookViewModel.getCellIndex(this._cell),t=this._notebookViewModel.notebookDocument.uri,o=this._notebookViewModel.notebookDocument.viewType;this._activeToken?.dispose(!0);let n=this._activeToken=new qe,r=await this._notebookCellStatusBarService.getStatusBarItemsForCell(t,e,o,n.token);if(n.token.isCancellationRequested){r.forEach(c=>c.dispose&&c.dispose());return}let s=r.map(c=>c.items).flat(),l=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:s}]);this._currentItemLists.forEach(c=>c.dispose&&c.dispose()),this._currentItemLists=r,this._currentItemIds=l}dispose(){super.dispose(),this._isDisposed=!0,this._activeToken?.dispose(!0),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}]),this._currentItemLists.forEach(e=>e.dispose&&e.dispose())}};Hm(aVe.id,aVe);function Wve(a,i=!0){if(i&&a<1e3)return`${a}ms`;let e=Math.floor(a/1e3/60),t=Math.floor(a/1e3)%60,o=Math.floor(a%1e3/100);return e>0?`${e}m ${t}.${o}s`:`${t}.${o}s`}var lVe=class extends k{constructor(e,t){super();this._notebookEditor=e;this._itemFactory=t;this._visibleCells=new Map;this._observer=this._register(new sVe(this._notebookEditor)),this._register(this._observer.onDidChangeVisibleCells(this._updateVisibleCells,this)),this._updateEverything()}_updateEverything(){this._visibleCells.forEach(je),this._visibleCells.clear(),this._updateVisibleCells({added:this._observer.visibleCells,removed:[]})}_updateVisibleCells(e){let t=this._notebookEditor.getViewModel();if(t){for(let o of e.removed)this._visibleCells.get(o.handle)?.dispose(),this._visibleCells.delete(o.handle);for(let o of e.added)this._visibleCells.set(o.handle,this._itemFactory(t,o))}}dispose(){super.dispose(),this._visibleCells.forEach(je),this._visibleCells.clear()}},c$=class extends k{static{this.id="workbench.notebook.statusBar.execState"}constructor(i,e){super(),this._register(new lVe(i,(t,o)=>e.createInstance(Vve,t,o)))}};c$=I([m(1,F)],c$);Hm(c$.id,c$);var Vve=class extends k{constructor(e,t,o){super();this._notebookViewModel=e;this._cell=t;this._executionStateService=o;this._currentItemIds=[];this._clearExecutingStateTimer=this._register(new ue);this._update(),this._register(this._executionStateService.onDidChangeExecution(n=>{n.type===0&&n.affectsCell(this._cell.uri)&&this._update()})),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update()))}static{this.MIN_SPINNER_TIME=500}async _update(){let e=this._getItemsForCell();Array.isArray(e)&&(this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:e}]))}_getItemsForCell(){let e=this._executionStateService.getCellExecution(this._cell.uri);if(e?.state===3&&typeof this._showedExecutingStateTime!="number")this._showedExecutingStateTime=Date.now();else if(e?.state!==3&&typeof this._showedExecutingStateTime=="number"){let o=Vve.MIN_SPINNER_TIME-(Date.now()-this._showedExecutingStateTime);if(o>0){this._clearExecutingStateTimer.value||(this._clearExecutingStateTimer.value=Zo(()=>{this._showedExecutingStateTime=void 0,this._clearExecutingStateTimer.clear(),this._update()},o));return}else this._showedExecutingStateTime=void 0}return this._getItemForState(e,this._cell.internalMetadata)}_getItemForState(e,t){let o=e?.state,{lastRunSuccess:n}=t;return!o&&n?[{text:`$(${LKt.id})`,color:_s(Kyo),tooltip:d(13479,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:!o&&n===!1?[{text:`$(${WNe.id})`,color:_s(qyo),tooltip:d(13477,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:o===2||o===1?[{text:`$(${MKt.id})`,tooltip:d(13478,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:o===3?[{text:`$(${(e?.didPause?FC:q.modify(FC,"spin")).id})`,tooltip:d(13476,null),alignment:1,priority:Number.MAX_SAFE_INTEGER}]:[]}dispose(){super.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}])}};Vve=I([m(2,Ns)],Vve);var d$=class extends k{static{this.id="workbench.notebook.statusBar.execTimer"}constructor(i,e){super(),this._register(new lVe(i,(t,o)=>e.createInstance(Bve,t,o)))}};d$=I([m(1,F)],d$);Hm(d$.id,d$);var Chn=200,Bve=class extends k{constructor(e,t,o,n,r){super();this._notebookViewModel=e;this._cell=t;this._executionStateService=o;this._notebookService=n;this._configurationService=r;this._currentItemIds=[];this._isVerbose=this._configurationService.getValue(Ct.cellExecutionTimeVerbosity)==="verbose",this._scheduler=this._register(new Dt(()=>this._update(),Bve.UPDATE_INTERVAL)),this._update(),this._register(this._cell.model.onDidChangeInternalMetadata(()=>this._update())),this._register(this._configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(Ct.cellExecutionTimeVerbosity)&&(this._isVerbose=this._configurationService.getValue(Ct.cellExecutionTimeVerbosity)==="verbose",this._update())}))}static{this.UPDATE_INTERVAL=100}async _update(){let e,t=this._executionStateService.getCellExecution(this._cell.uri),o=t?.state,n=this._cell.internalMetadata.runStartTime,r=this._cell.internalMetadata.runStartTimeAdjustment??0,s=this._cell.internalMetadata.runEndTime;if(t?.didPause)e=void 0;else if(o===3)typeof n=="number"&&(e=this._getTimeItem(n,Date.now(),r),this._scheduler.schedule());else if(!o&&typeof n=="number"&&typeof s=="number"){let c=Date.now()-n+r,u=s-n,p=this._cell.internalMetadata.renderDuration??{};e=this._getTimeItem(n,s,void 0,{timerDuration:c,executionDuration:u,renderDuration:p})}let l=e?[e]:[];!l.length&&t?this._deferredUpdate||(this._deferredUpdate=Zo(()=>{this._deferredUpdate=void 0,this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:l}])},Chn,this._store)):(this._deferredUpdate?.dispose(),this._deferredUpdate=void 0,this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:l}]))}_getTimeItem(e,t,o=0,n){let r=t-e+o,s,l=new Date(t).toLocaleTimeString(Kr);if(n){let{renderDuration:u,executionDuration:p,timerDuration:h}=n,g="";for(let f in u){let v=this._notebookService.getRendererInfo(f),b=encodeURIComponent(JSON.stringify({extensionId:v?.extensionId.value??"",issueBody:`Auto-generated text from notebook cell performance - Please add an explanation for the performance issue, including cell content if possible.
The duration for the renderer, ${v?.displayName??f}, is slower than expected.
Execution Time: ${Wve(p)}
Renderer Duration: ${Wve(u[f])}
`})),S=u[f]>200&&p<2e3||u[f]>1e3,y=v?.displayName??f,w=S?`[${y}](command:workbench.action.openIssueReporter?${b})`:`**${y}**`;g+=`- ${w} ${Wve(u[f])}
`}g+=`
*${d(13481,null)}*
`,s={value:d(13480,null,l,Wve(p),Wve(h-p),g),isTrusted:!0}}return{text:this._isVerbose?d(13482,null,l,Wve(r,!1)):Wve(r,!1),alignment:1,priority:Number.MAX_SAFE_INTEGER-5,tooltip:s}}dispose(){super.dispose(),this._deferredUpdate?.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this._cell.handle,items:[]}])}};Bve=I([m(2,Ns),m(3,kn),m(4,B)],Bve);var Oat=class{constructor(i,e,t,o,n){let r=new O;this.dispose=r.dispose.bind(r);let s=()=>{r.clear(),t.selectKernelForNotebook(e,i)};r.add(i.onDidChangeContent(l=>{for(let c of l.rawEvents)switch(c.kind){case 10:case 1:case 2:case 5:n.trace("IMPLICIT kernel selection because of change event",c.kind),s();break}})),r.add(o.hoverProvider.register({scheme:Q.vscodeNotebookCell,pattern:i.uri.path},{provideHover(){n.trace("IMPLICIT kernel selection because of hover"),s()}}))}};Oat=I([m(2,Ql),m(3,Jt),m(4,re)],Oat);var Fat=class extends k{constructor(e,t,o,n){super();this._editorService=e;this._statusbarService=t;this._notebookKernelService=o;this._instantiationService=n;this._editorDisposables=this._register(new O);this._kernelInfoElement=this._register(new O);this._register(this._editorService.onDidActiveEditorChange(()=>this._updateStatusbar())),this._updateStatusbar()}_updateStatusbar(){this._editorDisposables.clear();let e=lr(this._editorService.activeEditorPane);if(!e){this._kernelInfoElement.clear();return}let t=()=>{if(e.notebookOptions.getDisplayOptions().globalToolbar){this._kernelInfoElement.clear();return}let o=e.textModel;o?this._showKernelStatus(o):this._kernelInfoElement.clear()};this._editorDisposables.add(this._notebookKernelService.onDidAddKernel(t)),this._editorDisposables.add(this._notebookKernelService.onDidChangeSelectedNotebooks(t)),this._editorDisposables.add(this._notebookKernelService.onDidChangeNotebookAffinity(t)),this._editorDisposables.add(e.onDidChangeModel(t)),this._editorDisposables.add(e.notebookOptions.onDidChangeOptions(t)),t()}_showKernelStatus(e){this._kernelInfoElement.clear();let{selected:t,suggestions:o,all:n}=this._notebookKernelService.getMatchingKernel(e),r=(o.length===1?o[0]:void 0)??n.length===1?n[0]:void 0,s=!1;if(n.length!==0)if(t||r){let l=t;l||(l=r,s=!0,this._kernelInfoElement.add(this._instantiationService.createInstance(Oat,e,l)));let c=l.description??l.detail??l.label;this._kernelInfoElement.add(this._statusbarService.addEntry({name:d(13496,null),text:`$(notebook-kernel-select) ${l.label}`,ariaLabel:l.label,tooltip:s?d(13501,null,c):c,command:D_},D_,1,10)),this._kernelInfoElement.add(l.onDidChange(()=>this._showKernelStatus(e)))}else this._kernelInfoElement.add(this._statusbarService.addEntry({name:d(13498,null),text:d(13493,null),ariaLabel:d(13493,null),command:D_,kind:"prominent"},D_,1,10))}};Fat=I([m(0,ie),m(1,Fr),m(2,Ql),m(3,F)],Fat);var Wat=class extends k{constructor(e,t){super();this._editorService=e;this._statusbarService=t;this._itemDisposables=this._register(new O);this._accessor=this._register(new ue);this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._update()}_update(){this._itemDisposables.clear();let e=lr(this._editorService.activeEditorPane);e?(this._itemDisposables.add(e.onDidChangeSelection(()=>this._show(e))),this._itemDisposables.add(e.onDidChangeActiveCell(()=>this._show(e))),this._show(e)):this._accessor.clear()}_show(e){if(!e.hasModel()){this._accessor.clear();return}let t=this._getSelectionsText(e);if(!t){this._accessor.clear();return}let o={name:d(13494,null),text:t,ariaLabel:t,command:wOi};this._accessor.value?this._accessor.value.update(o):this._accessor.value=this._statusbarService.addEntry(o,"notebook.activeCellStatus",1,100)}_getSelectionsText(e){if(!e.hasModel())return;let t=e.getActiveCell();if(!t)return;let o=e.getCellIndex(t)+1,n=e.getSelections().reduce((s,l)=>s+(l.end-l.start),0),r=e.getLength();return n>1?d(13497,null,o,n):d(13499,null,o,r)}};Wat=I([m(0,ie),m(1,Fr)],Wat);var Vat=class extends k{constructor(e,t,o){super();this._editorService=e;this._statusbarService=t;this._configurationService=o;this._itemDisposables=this._register(new O);this._accessor=this._register(new ue);this._register(this._editorService.onDidActiveEditorChange(()=>this._update())),this._register(this._configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("editor")||n.affectsConfiguration("notebook"))&&this._update()})),this._update()}static{this.ID="selectNotebookIndentation"}_update(){this._itemDisposables.clear();let e=lr(this._editorService.activeEditorPane);e?(this._show(e),this._itemDisposables.add(e.onDidChangeSelection(()=>{this._accessor.clear(),this._show(e)}))):this._accessor.clear()}_show(e){if(!e.hasModel()){this._accessor.clear();return}let t=e.getActiveCell()?.textModel?.getOptions();if(!t){this._accessor.clear();return}let o=e.notebookOptions.getDisplayOptions().editorOptionsCustomizations,n=o?.["editor.indentSize"]??t?.indentSize,r=o?.["editor.insertSpaces"]??t?.insertSpaces,s=o?.["editor.tabSize"]??t?.tabSize,l=typeof n=="number"?n:s,u=r?`Spaces: ${l}`:`Tab Size: ${l}`;if(!u){this._accessor.clear();return}let p={name:d(13495,null),text:u,ariaLabel:u,tooltip:d(13500,null),command:cOi};this._accessor.value?this._accessor.value.update(p):this._accessor.value=this._statusbarService.addEntry(p,"notebook.status.indentation",1,100.4)}};Vat=I([m(0,ie),m(1,Fr),m(2,B)],Vat);var cVe=class extends k{constructor(e){super();this.editorGroupService=e;for(let t of e.parts)this.createNotebookStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createNotebookStatus(t)))}static{this.ID="notebook.contrib.editorStatus"}createNotebookStatus(e){let t=new O;U.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(Fat)),t.add(o.createInstance(Wat)),t.add(o.createInstance(Vat))}};cVe=I([m(0,kt)],cVe);bt(cVe.ID,cVe,vt.AfterRestored);var dVe=class extends k{constructor(e){super();this._editorService=e;let t=105;this._register(pD.addImplementation(t,"notebook-undo-redo",()=>{let o=lr(this._editorService.activeEditorPane),n=o?.getViewModel();return o&&o.hasEditorFocus()&&o.hasModel()&&n?n.undo().then(r=>{if(r?.length){for(let s=0;s<o.getLength();s++){let l=o.cellAt(s);l.cellKind===1&&r.find(c=>c.fragment===l.model.uri.fragment)&&l.updateEditState(1,"undo")}o?.setOptions({cellOptions:{resource:r[0]},preserveFocus:!0})}}):!1})),this._register(mD.addImplementation(t,"notebook-undo-redo",()=>{let o=lr(this._editorService.activeEditorPane),n=o?.getViewModel();return o&&o.hasEditorFocus()&&o.hasModel()&&n?n.redo().then(r=>{if(r?.length){for(let s=0;s<o.getLength();s++){let l=o.cellAt(s);l.cellKind===1&&r.find(c=>c.fragment===l.model.uri.fragment)&&l.updateEditState(1,"redo")}o?.setOptions({cellOptions:{resource:r[0]},preserveFocus:!0})}}):!1}))}static{this.ID="workbench.contrib.notebookUndoRedo"}};dVe=I([m(0,ie)],dVe);bt(dVe.ID,dVe,vt.BlockRestore);var xhn="notebook.cell.moveUp",khn="notebook.cell.moveDown",Ehn="notebook.cell.copyUp",Thn="notebook.cell.copyDown";W(class extends iu{constructor(){super({id:xhn,title:P(13466,"Move Cell Up"),icon:SIo,keybinding:{primary:528,when:C.and(wr,Wg.toNegated()),weight:200},menu:{id:R.NotebookCellTitle,when:C.equals("config.notebook.dragAndDropEnabled",!1),group:"3_edit",order:14}})}async runWithContext(a,i){return gMi(i,"up")}});W(class extends iu{constructor(){super({id:khn,title:P(13465,"Move Cell Down"),icon:IIo,keybinding:{primary:530,when:C.and(wr,Wg.toNegated()),weight:200},menu:{id:R.NotebookCellTitle,when:C.equals("config.notebook.dragAndDropEnabled",!1),group:"3_edit",order:14}})}async runWithContext(a,i){return gMi(i,"down")}});W(class extends iu{constructor(){super({id:Ehn,title:P(13457,"Copy Cell Up"),keybinding:{primary:1552,when:C.and(wr,Wg.toNegated()),weight:200}})}async runWithContext(a,i){return fMi(i,"up")}});W(class extends iu{constructor(){super({id:Thn,title:P(13456,"Copy Cell Down"),keybinding:{primary:1554,when:C.and(wr,Wg.toNegated()),weight:200},menu:{id:R.NotebookCellTitle,when:C.and(wr,cc,OC),group:"3_edit",order:13}})}async runWithContext(a,i){return fMi(i,"down")}});var _hn="notebook.cell.split",Dhn="notebook.cell.joinSelected",Rhn="notebook.cell.joinAbove",Lhn="notebook.cell.joinBelow";W(class extends iu{constructor(){super({id:_hn,title:P(13467,"Split Cell"),menu:{id:R.NotebookCellTitle,when:C.and(cc,OC,PNe.toNegated()),order:5,group:YW},icon:yIo,keybinding:{when:C.and(wr,cc,OC,me.editorTextFocus),primary:Gi(2089,3165),weight:200}})}async runWithContext(a,i){if(i.notebookEditor.isReadOnly)return;let e=a.get(Ka),t=i.cell,o=i.notebookEditor.getCellIndex(t),n=t.focusMode===0?[{lineNumber:1,column:1}]:t.getSelectionsStartPosition();if(n&&n.length>0){if(await t.resolveTextModel(),!t.hasModel())return;let r=rwo(t,n);if(r){let s=t.language,l=t.cellKind,c=t.mime,u=await t.resolveTextModel();await e.apply([new hl(t.uri,{range:u.getFullModelRange(),text:r[0]}),new rb(i.notebookEditor.textModel.uri,{editType:1,index:o+1,count:0,cells:r.slice(1).map(p=>({cellKind:l,language:s,mime:c,source:p,outputs:[],metadata:{}}))})],{quotableLabel:"Split Notebook Cell"}),i.notebookEditor.cellAt(o+1)?.updateEditState(t.getEditState(),"splitCell")}}}});W(class extends iu{constructor(){super({id:Rhn,title:P(13462,"Join With Previous Cell"),keybinding:{when:wr,primary:1832,weight:200},menu:{id:R.NotebookCellTitle,when:C.and(wr,cc),group:"3_edit",order:10}})}async runWithContext(a,i){let e=a.get(Ka);return vMi(e,i,"above")}});W(class extends iu{constructor(){super({id:Lhn,title:P(13463,"Join With Next Cell"),keybinding:{when:wr,primary:808,weight:200},menu:{id:R.NotebookCellTitle,when:C.and(wr,cc),group:"3_edit",order:11}})}async runWithContext(a,i){let e=a.get(Ka);return vMi(e,i,"below")}});W(class extends iu{constructor(){super({id:Dhn,title:P(13464,"Join Selected Cells"),menu:{id:R.NotebookCellTitle,when:C.and(wr,cc),group:"3_edit",order:12}})}async runWithContext(a,i){let e=a.get(Ka),t=a.get(Ne);return nwo(e,t,i)}});var Mhn="notebook.cell.changeToCode",Phn="notebook.cell.changeToMarkdown";W(class extends kf{constructor(){super({id:Mhn,title:P(13450,"Change Cell to Code"),keybinding:{when:C.and(wr,C.not(Dp),vP.toNegated()),primary:55,weight:200},precondition:C.and(nl,lI.isEqualTo("markup")),menu:{id:R.NotebookCellTitle,when:C.and(wr,cc,OC,lI.isEqualTo("markup")),group:"3_edit"}})}async runWithContext(i,e){await eFe(2,e)}});W(class extends kf{constructor(){super({id:Phn,title:P(13451,"Change Cell to Markdown"),keybinding:{when:C.and(wr,C.not(Dp),vP.toNegated()),primary:43,weight:200},precondition:C.and(nl,lI.isEqualTo("code")),menu:{id:R.NotebookCellTitle,when:C.and(wr,cc,OC,lI.isEqualTo("code")),group:"3_edit"}})}async runWithContext(i,e){await eFe(1,e,"markdown",cr.markdown)}});var Ahn="notebook.cell.collapseCellInput",Nhn="notebook.cell.collapseCellOutput",Ohn="notebook.cell.collapseAllCellInputs",Fhn="notebook.cell.expandAllCellInputs",Whn="notebook.cell.collapseAllCellOutputs",Vhn="notebook.cell.expandAllCellOutputs",Bhn="notebook.cell.toggleOutputs",Hhn="notebook.cell.toggleOutputScrolling";W(class extends kf{constructor(){super({id:Ahn,title:P(13454,"Collapse Cell Input"),keybinding:{when:C.and(Ap,PNe.toNegated(),Wg.toNegated()),primary:Gi(2089,2081),weight:200}})}parseArgs(i,...e){return Sq(i,...e)}async runWithContext(i,e){e.ui?e.cell.isInputCollapsed=!0:e.selectedCells.forEach(t=>t.isInputCollapsed=!0)}});W(class extends kf{constructor(){super({id:F_e,title:P(13460,"Expand Cell Input"),keybinding:{when:C.and(Ap,PNe),primary:Gi(2089,2081),weight:200}})}parseArgs(i,...e){return Sq(i,...e)}async runWithContext(i,e){e.ui?e.cell.isInputCollapsed=!1:e.selectedCells.forEach(t=>t.isInputCollapsed=!1)}});W(class extends kf{constructor(){super({id:Nhn,title:P(13455,"Collapse Cell Output"),keybinding:{when:C.and(Ap,Ent.toNegated(),Wg.toNegated(),PE),primary:Gi(2089,50),weight:200}})}async runWithContext(i,e){e.ui?e.cell.isOutputCollapsed=!0:e.selectedCells.forEach(t=>t.isOutputCollapsed=!0)}});W(class extends kf{constructor(){super({id:NMt,title:P(13461,"Expand Cell Output"),keybinding:{when:C.and(Ap,Ent),primary:Gi(2089,50),weight:200}})}async runWithContext(i,e){e.ui?e.cell.isOutputCollapsed=!1:e.selectedCells.forEach(t=>t.isOutputCollapsed=!1)}});W(class extends kf{constructor(){super({id:Bhn,precondition:Ap,title:P(13468,"Toggle Outputs"),metadata:{description:d(13469,null),args:Tnt}})}parseArgs(a,...i){return Sq(a,...i)}async runWithContext(a,i){let e=[];i.ui?e=[i.cell]:i.selectedCells&&(e=i.selectedCells);for(let t of e)t.isOutputCollapsed=!t.isOutputCollapsed}});W(class extends kf{constructor(){super({id:Ohn,title:P(13452,"Collapse All Cell Inputs"),f1:!0})}async runWithContext(i,e){q$t(e.notebookEditor,t=>t.isInputCollapsed=!0)}});W(class extends kf{constructor(){super({id:Fhn,title:P(13458,"Expand All Cell Inputs"),f1:!0})}async runWithContext(i,e){q$t(e.notebookEditor,t=>t.isInputCollapsed=!1)}});W(class extends kf{constructor(){super({id:Whn,title:P(13453,"Collapse All Cell Outputs"),f1:!0})}async runWithContext(i,e){q$t(e.notebookEditor,t=>t.isOutputCollapsed=!0)}});W(class extends kf{constructor(){super({id:Vhn,title:P(13459,"Expand All Cell Outputs"),f1:!0})}async runWithContext(i,e){q$t(e.notebookEditor,t=>t.isOutputCollapsed=!1)}});W(class extends kf{constructor(){super({id:Hhn,title:P(13470,"Toggle Scroll Cell Output"),keybinding:{when:C.and(Ap,Wg.toNegated(),PE),primary:Gi(2089,55),weight:200}})}toggleOutputScrolling(i,e,t){let o=i.model.metadata;if(o){let n=o.scrollable!==void 0?o.scrollable:e,r=t||!n;o.scrollable=r,i.resetRenderer()}}async runWithContext(i,e){let t=i.get(B).getValue(Ct.outputScrolling);e.ui?(e.cell.outputsViewModels.forEach(o=>{this.toggleOutputScrolling(o,t,e.cell.isOutputCollapsed)}),e.cell.isOutputCollapsed=!1):e.selectedCells.forEach(o=>{o.outputsViewModels.forEach(n=>{this.toggleOutputScrolling(n,t,o.isOutputCollapsed)}),o.isOutputCollapsed=!1})}});function q$t(a,i){for(let e=0;e<a.getLength();e++){let t=a.cellAt(e);i(t,e)}}var uVe=class extends k{constructor(e,t,o){super();this._notebookEditor=e;this._notebookService=t;this._warmupDocument=null;this._warmupViewport=new Dt(()=>this._warmupViewportNow(),200),this._register(this._warmupViewport),this._register(this._notebookEditor.onDidScroll(()=>{this._warmupViewport.schedule()})),this._warmupDocument=new Dt(()=>this._warmupDocumentNow(),200),this._register(this._warmupDocument),this._register(this._notebookEditor.onDidAttachViewModel(()=>{this._notebookEditor.hasModel()&&this._warmupDocument?.schedule()})),this._notebookEditor.hasModel()&&this._warmupDocument?.schedule()}static{this.id="workbench.notebook.viewportWarmup"}_warmupDocumentNow(){if(this._notebookEditor.hasModel())for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);t?.cellKind===1&&t?.getEditState()===0&&!t.isInputCollapsed||t?.cellKind===2&&this._warmupCodeCell(t)}}_warmupViewportNow(){if(this._notebookEditor.isDisposed||!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getVisibleRangesPlusViewportAboveAndBelow();yv(e).forEach(t=>{let o=this._notebookEditor.cellAt(t);o?.cellKind===1&&o?.getEditState()===0&&!o.isInputCollapsed?this._notebookEditor.createMarkupPreview(o):o?.cellKind===2&&this._warmupCodeCell(o)})}_warmupCodeCell(e){if(e.isOutputCollapsed)return;let t=e.outputsViewModels;for(let o of t.slice(0,ZNe)){let[n,r]=o.resolveMimeTypes(this._notebookEditor.textModel,void 0);if(!n.find(u=>u.isTrusted)||n.length===0)continue;let s=n[r];if(!s||!this._notebookEditor.hasModel())return;let l=this._notebookService.getRendererInfo(s.rendererId);if(!l)return;let c={type:1,renderer:l,source:o,mimeType:s.mimeType};this._notebookEditor.createOutput(e,c,0,!0)}}};uVe=I([m(1,kn),m(2,Ai)],uVe);Hm(uVe.id,uVe);var Bat=class extends k{constructor(e){super();this._notebookEditor=e;this._localStore=this._register(new O);this._cellDisposables=[];this._enabled=!1;this._cellStatusItems=[];this._register(this._notebookEditor.onDidChangeModel(()=>{this._update()})),this._update()}static{this.id="workbench.notebook.troubleshoot"}toggle(){this._enabled=!this._enabled,this._update()}_update(){this._localStore.clear(),this._cellDisposables.forEach(e=>e.dispose()),this._cellDisposables=[],this._removeNotebookOverlay(),this._notebookEditor.hasModel()&&this._enabled&&(this._updateListener(),this._createNotebookOverlay(),this._createCellOverlays())}_log(e,t){if(this._enabled){let o=this._notebookEditor.getViewHeight(e);console.log(`cell#${e.handle}`,t,`${o} -> ${e.layoutInfo.totalHeight}`)}}_createCellOverlays(){if(this._notebookEditor.hasModel()){for(let e=0;e<this._notebookEditor.getLength();e++){let t=this._notebookEditor.cellAt(e);this._createCellOverlay(t,e)}this._localStore.add(this._notebookEditor.onDidChangeViewCells(e=>{let t=e.splices.reduce((o,[,,n])=>[...o,...n],[]);for(let o=0;o<t.length;o++){let n=this._notebookEditor.getCellIndex(t[o]);n!==void 0&&this._createCellOverlay(t[o],n)}}))}}_createNotebookOverlay(){if(!this._notebookEditor.hasModel())return;let e=this._notebookEditor.getLayoutInfo().listViewOffsetTop,t=this._notebookEditor.scrollTop,o=$o.div({style:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"1000"}},[$o.div({style:{position:"absolute",top:`${e}px`,left:"0",width:"100%",height:"2px",backgroundColor:"rgba(0, 0, 255, 0.7)"}}),$o.div({style:{position:"absolute",top:`${e}px`,left:"10px",backgroundColor:"rgba(0, 0, 255, 0.7)",color:"white",fontSize:"11px",fontWeight:"bold",padding:"2px 6px",borderRadius:"3px",whiteSpace:"nowrap",pointerEvents:"none",zIndex:"1001"}},[`ScrollTop: ${t}px`])]).keepUpdated(this._store);this._notebookOverlayDomNode=o.element,this._notebookOverlayDomNode&&this._notebookEditor.getDomNode().appendChild(this._notebookOverlayDomNode),this._localStore.add(this._notebookEditor.onDidScroll(()=>{let n=this._notebookEditor.scrollTop,r=this._notebookEditor.getLayoutInfo().listViewOffsetTop;if(this._notebookOverlayDomNode){let s=this._notebookOverlayDomNode.querySelector("div:nth-child(2)");s&&(s.textContent=`ScrollTop: ${n}px`,s.style.top=`${r}px`);let l=this._notebookOverlayDomNode.querySelector("div:first-child");l&&(l.style.top=`${r}px`)}}))}_createCellOverlay(e,t){let o=document.createElement("div");o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.width="100%",o.style.height="100%",o.style.pointerEvents="none",o.style.zIndex="1000";let n=document.createElement("div");n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%",n.style.height="2px",n.style.backgroundColor="rgba(255, 0, 0, 0.7)",o.appendChild(n);let r=()=>{let c=e.textBuffer.getEOL()===`
`?"LF":"CRLF",u="";return e.layoutInfo.layoutState>0&&(u=`| AbsoluteTopOfElement: ${this._notebookEditor.getAbsoluteTopOfElement(e)}px`),`cell #${t} (handle: ${e.handle}) ${u} | EOL: ${c}`},s=document.createElement("div");s.textContent=r(),s.style.position="absolute",s.style.top="0px",s.style.right="10px",s.style.backgroundColor="rgba(255, 0, 0, 0.5)",s.style.color="white",s.style.fontSize="11px",s.style.fontWeight="bold",s.style.padding="2px 6px",s.style.borderRadius="3px",s.style.whiteSpace="nowrap",s.style.pointerEvents="none",s.style.zIndex="1001",o.appendChild(s);let l;if(this._notebookEditor.changeCellOverlays(c=>{l=c.addOverlay({cell:e,domNode:o})}),l){let c=()=>{s.textContent=r(),l&&this._notebookEditor.changeCellOverlays(p=>{p.layoutOverlay(l)})},u=this._cellDisposables[t];u.add(e.onDidChangeLayout(p=>{c()})),u.add(e.textBuffer.onDidChangeContent(()=>{c()})),e.textModel&&u.add(e.textModel.onDidChangeContent(()=>{c()})),u.add(this._notebookEditor.onDidChangeLayout(()=>{c()})),u.add(ee(()=>{this._notebookEditor.changeCellOverlays(p=>{l&&p.removeOverlay(l)})}))}}_removeNotebookOverlay(){this._notebookOverlayDomNode&&(this._notebookOverlayDomNode.remove(),this._notebookOverlayDomNode=void 0)}_updateListener(){if(!this._notebookEditor.hasModel())return;for(let o=0;o<this._notebookEditor.getLength();o++){let n=this._notebookEditor.cellAt(o),r=new O;this._cellDisposables.push(r),r.add(n.onDidChangeLayout(s=>{this._log(n,s)}))}this._localStore.add(this._notebookEditor.onDidChangeViewCells(o=>{[...o.splices].reverse().forEach(r=>{let[s,l,c]=r,u=this._cellDisposables.splice(s,l,...c.map(p=>{let h=new O;return h.add(p.onDidChangeLayout(g=>{this._log(p,g)})),h}));je(u)});let n=o.splices.reduce((r,[,,s])=>[...r,...s],[]);for(let r=0;r<n.length;r++){let s=this._notebookEditor.getCellIndex(n[r]);s!==void 0&&this._createCellOverlay(n[r],s)}}));let e=this._notebookEditor.getViewModel(),t=[];this._enabled&&(t=this._getItemsForCells()),this._cellStatusItems=e.deltaCellStatusBarItems(this._cellStatusItems,t)}_getItemsForCells(){let e=[];for(let t=0;t<this._notebookEditor.getLength();t++)e.push({handle:t,items:[{text:`index: ${t}`,alignment:1,priority:Number.MAX_SAFE_INTEGER}]});return e}dispose(){je(this._cellDisposables),this._removeNotebookOverlay(),this._localStore.clear(),super.dispose()}};Hm(Bat.id,Bat);W(class extends z{constructor(){super({id:"notebook.toggleLayoutTroubleshoot",title:P(13580,"Toggle Notebook Layout Troubleshoot"),category:Fe.Developer,f1:!0})}async run(a){let i=a.get(ie),e=lr(i.activeEditorPane);if(!e)return;e.getContribution(Bat.id)?.toggle()}});W(class extends z{constructor(){super({id:"notebook.inspectLayout",title:P(13579,"Inspect Notebook Layout"),category:Fe.Developer,f1:!0})}async run(a){let i=a.get(ie),e=lr(i.activeEditorPane);if(!(!e||!e.hasModel()))for(let t=0;t<e.getLength();t++){let o=e.cellAt(t);console.log(`cell#${o.handle}`,o.layoutInfo)}}});W(class extends z{constructor(){super({id:"notebook.clearNotebookEdtitorTypeCache",title:P(13578,"Clear Notebook Editor Type Cache"),category:Fe.Developer,f1:!0})}async run(a){a.get(kn).clearEditorCache()}});var Hat=class extends k{constructor(e,t,o){super();this._debugService=e;this._editorService=o;let n=new dt;this._register(t.onWillAddNotebookDocument(r=>{n.set(r.uri,r.onWillAddRemoveCells(s=>{let l=this._debugService.getModel();if(l.getBreakpoints().length&&s.rawEvent.kind===1)for(let c of s.rawEvent.changes){let[u,p]=c;if(p>0){let h=r.cells.slice(u,u+p);for(let g of h)l.getBreakpoints({uri:g.uri}).forEach(v=>this._debugService.removeBreakpoints(v.getId()))}}}))})),this._register(t.onWillRemoveNotebookDocument(r=>{this.updateBreakpoints(r),n.get(r.uri)?.dispose(),n.delete(r.uri)})),this._register(this._debugService.getModel().onDidChangeBreakpoints(r=>{let s=r?.added?.find(l=>yo(l,{uri:!0})&&l.uri.scheme===Q.vscodeNotebookCell);if(s){let l=sn.parse(s.uri);if(!l)return;let c=lr(this._editorService.activeEditorPane);if(!c||!c.hasModel()||c.textModel.uri.toString()!==l.notebook.toString())return;let u=c.getCellByHandle(l.handle);if(!u)return;c.focusElement(u)}}))}updateBreakpoints(e){let t=this._debugService.getModel().getBreakpoints();if(!t.length||!e.cells.length)return;let o=new dt;e.cells.forEach((n,r)=>{o.set(n.uri,r)}),t.forEach(n=>{let r=o.get(n.uri);if(typeof r!="number")return;let s=sn.parse(n.uri)?.notebook;if(!s)return;let l=sn.generate(s,r);ze(l,n.uri)||(this._debugService.removeBreakpoints(n.getId()),this._debugService.addBreakpoints(l,[{column:n.column,condition:n.condition,enabled:n.enabled,hitCondition:n.hitCondition,logMessage:n.logMessage,lineNumber:n.lineNumber}]))})}};Hat=I([m(0,Hi),m(1,kn),m(2,ie)],Hat);oe.as(Zi.Workbench).registerWorkbenchContribution(Hat,3);var Uat=class extends k{constructor(e,t){super();this._debugService=e;this._notebookExecutionStateService=t;this._pausedCells=new Set;this._register(e.getModel().onDidChangeCallStack(()=>{this.onDidChangeCallStack(!0),this._scheduler.schedule()})),this._scheduler=this._register(new Dt(()=>this.onDidChangeCallStack(!1),2e3))}async onDidChangeCallStack(e){let t=new Set;for(let o of this._debugService.getModel().getSessions())for(let n of o.getAllThreads()){let r=n.getCallStack();e&&!r.length&&(r=n.getStaleCallStack()),r.forEach(s=>{sn.parse(s.source.uri)&&(t.add(s.source.uri.toString()),this.editIsPaused(s.source.uri,!0))})}for(let o of this._pausedCells)t.has(o)||(this.editIsPaused(A.parse(o),!1),this._pausedCells.delete(o));t.forEach(o=>this._pausedCells.add(o))}editIsPaused(e,t){if(sn.parse(e)){let n=this._notebookExecutionStateService.getCellExecution(e);n&&(n.isPaused!==t||!n.didPause)&&n.update([{editType:3,didPause:!0,isPaused:t}])}}};Uat=I([m(0,Hi),m(1,Ns)],Uat);oe.as(Zi.Workbench).registerWorkbenchContribution(Uat,3);var xOi=class{constructor(){this._registeredGutterActionsGenerators=new Set}registerGutterActionsGenerator(i){return this._registeredGutterActionsGenerators.add(i),{dispose:()=>{this._registeredGutterActionsGenerators.delete(i)}}}getGutterActionsGenerators(){return Array.from(this._registeredGutterActionsGenerators.values())}};oe.add("gutterActionsRegistry",new xOi);var zat=oe.as("gutterActionsRegistry"),Fne=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.contextMenuService=t;this.menuService=o;this.contextKeyService=n;this.instantiationService=r;this._register(this.editor.onMouseDown(s=>this.doShow(s,!1)))}static{this.ID="workbench.contrib.editorLineNumberContextMenu"}show(e){this.doShow(e,!0)}doShow(e,t){let o=this.editor.getModel();if(!e.event.rightButton&&!(et&&e.event.leftButton&&e.event.ctrlKey)&&!t||e.target.type!==3&&e.target.type!==2||!e.target.position||!o)return;let n=e.target.position.lineNumber,r=this.contextKeyService.createOverlay([["editorLineNumber",n]]),s=this.menuService.createMenu(R.EditorLineNumberContext,r),l=[];this.instantiationService.invokeFunction(c=>{for(let p of zat.getGutterActionsGenerators()){let h=new Map;p({lineNumber:n,editor:this.editor,accessor:c},{push:(g,f="navigation")=>{let v=h.get(f)??[];v.push(g),h.set(f,v)}});for(let[g,f]of h.entries())l.push([g,f])}l.sort((p,h)=>p[0].localeCompare(h[0]));let u=s.getActions({arg:{lineNumber:n,uri:o.uri},shouldForwardArgs:!0});if(l.push(...u),e.target.type===3){let p=this.editor.getSelections(),h={startLineNumber:n,endLineNumber:n,startColumn:1,endColumn:o.getLineLength(n)+1};p?.some(f=>!f.isEmpty()&&f.intersectRanges(h)!==null)||this.editor.setSelection(h,"api")}this.contextMenuService.showContextMenu({getAnchor:()=>e.event,getActions:()=>oi.join(...l.map(p=>p[1])),onHide:()=>s.dispose()})})}};Fne=I([m(1,Xe),m(2,Yt),m(3,X),m(4,F)],Fne);Eo(Fne.ID,Fne,1);var pVe=_,kOi=le("privateBreakpointWidgetService"),OTo="breakpointwidgetdecoration";function Uhn(a){return a.getModel().bracketPairs.getBracketPairsInRange(G.fromPositions(a.getPosition())).some(t=>t.openingBracketInfo.bracketText==="{")}function zhn(a,i){let e=a.getColor(Vd)?.transparent(.4);return[{range:{startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:1},renderOptions:{after:{contentText:i,color:e?e.toString():void 0}}}]}var mVe=class extends o0{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,{showFrame:!0,showArrow:!1,frameWidth:1,isAccessible:!0});this.lineNumber=t;this.column=o;this.contextViewService=r;this.debugService=s;this.themeService=l;this.instantiationService=c;this.modelService=u;this.codeEditorService=p;this._configurationService=h;this.languageFeaturesService=g;this.keybindingService=f;this.labelService=v;this.textModelService=b;this.hoverService=S;this.conditionInput="";this.hitCountInput="";this.logMessageInput="";this.availableBreakpoints=[];this.store=new O;let y=this.editor.getModel();if(y){let w=y.uri,x=this.debugService.getModel().getBreakpoints({lineNumber:this.lineNumber,column:this.column,uri:w});this.breakpoint=x.length?x[0]:void 0}n===void 0?this.breakpoint&&!this.breakpoint.condition&&!this.breakpoint.hitCondition&&this.breakpoint.logMessage?this.context=2:this.breakpoint&&!this.breakpoint.condition&&this.breakpoint.hitCondition?this.context=1:this.breakpoint&&this.breakpoint.triggeredBy?this.context=3:this.context=0:this.context=n,this.store.add(this.debugService.getModel().onDidChangeBreakpoints(w=>{this.breakpoint&&w&&w.removed&&w.removed.indexOf(this.breakpoint)>=0&&this.dispose(),this.context===3&&this.selectBreakpointBox&&this.updateTriggerBreakpointList()})),this.store.add(this.codeEditorService.registerDecorationType("breakpoint-widget",OTo,{})),this.create()}get placeholder(){let e=this.keybindingService.lookupKeybinding($$t.ID)?.getLabel()||"Enter",t=this.keybindingService.lookupKeybinding(j$t.ID)?.getLabel()||"Escape";switch(this.context){case 2:return d(10510,null,e,t);case 1:return d(10509,null,e,t);default:return d(10508,null,e,t)}}getInputValue(e){switch(this.context){case 2:return e&&e.logMessage?e.logMessage:this.logMessageInput;case 1:return e&&e.hitCondition?e.hitCondition:this.hitCountInput;default:return e&&e.condition?e.condition:this.conditionInput}}rememberInput(){if(this.context!==3){let e=this.input.getModel().getValue();switch(this.context){case 2:this.logMessageInput=e;break;case 1:this.hitCountInput=e;break;default:this.conditionInput=e}}}setInputMode(){if(this.editor.hasModel()){let e=this.context===2?es:this.editor.getModel().getLanguageId();this.input.getModel().setLanguage(e)}}show(e){let t=this.input.getModel().getLineCount();super.show(e,t+1)}fitHeightToContent(){let e=this.input.getModel().getLineCount();this._relayout(e+1)}_fillContainer(e){this.setCssClass("breakpoint-widget");let t=this.store.add(new Jw([{text:d(10511,null)},{text:d(10512,null)},{text:d(10513,null)},{text:d(10519,null)}],this.context,this.contextViewService,nC,{ariaLabel:d(10507,null),useCustomDrawn:!BI(this._configurationService)}));this.selectContainer=pVe(".breakpoint-select-container"),t.render(D(e,this.selectContainer)),this.store.add(t.onDidSelect(o=>{this.rememberInput(),this.context=o.index,this.updateContextInput()})),this.createModesInput(e),this.inputContainer=pVe(".inputContainer"),this.store.add(this.hoverService.setupManagedHover(yi("mouse"),this.inputContainer,this.placeholder)),this.createBreakpointInput(D(e,this.inputContainer)),this.input.getModel().setValue(this.getInputValue(this.breakpoint)),this.store.add(this.input.getModel().onDidChangeContent(()=>{this.fitHeightToContent()})),this.input.setPosition({lineNumber:1,column:this.input.getModel().getLineMaxColumn(1)}),this.createTriggerBreakpointInput(e),this.updateContextInput(),setTimeout(()=>this.focusInput(),150)}createModesInput(e){let t=this.debugService.getModel().getBreakpointModes("source");if(t.length<=1)return;let o=this.selectModeBox=new Jw([{text:d(10506,null),isDisabled:!0},...t.map(s=>({text:s.label,description:s.description}))],t.findIndex(s=>s.mode===this.breakpoint?.mode)+1,this.contextViewService,nC,{useCustomDrawn:!BI(this._configurationService)});this.store.add(o),this.store.add(o.onDidSelect(s=>{this.modeInput=t[s.index-1]}));let n=pVe(".select-mode-container"),r=pVe(".select-box-container");D(n,r),o.render(r),D(e,n)}createTriggerBreakpointInput(e){this.availableBreakpoints=this.debugService.getModel().getBreakpoints().filter(c=>c!==this.breakpoint&&!c.logMessage);let t=this.buildBreakpointOptions(),o=this.availableBreakpoints.findIndex(c=>this.breakpoint?.triggeredBy===c.getId()),n=0;o!==-1?(this.triggeredByBreakpointInput=this.availableBreakpoints[o],n=o+1):!this.breakpoint?.triggeredBy&&this.availableBreakpoints.length>0?(this.triggeredByBreakpointInput=this.availableBreakpoints[0],n=1):this.triggeredByBreakpointInput=void 0;let r=this.selectBreakpointBox=this.store.add(new Jw(t,n,this.contextViewService,nC,{ariaLabel:d(10517,null),useCustomDrawn:!BI(this._configurationService)}));this.store.add(r.onDidSelect(c=>{c.index===0?this.triggeredByBreakpointInput=void 0:this.triggeredByBreakpointInput=this.availableBreakpoints[c.index-1]})),this.selectBreakpointContainer=pVe(".select-breakpoint-container"),this.store.add($(this.selectBreakpointContainer,ne.KEY_DOWN,c=>{new mi(c).equals(9)&&this.close(!1)}));let s=pVe(".select-box-container");D(this.selectBreakpointContainer,s),r.render(s),D(e,this.selectBreakpointContainer);let l=new Pi(this.selectBreakpointContainer,Ro);l.label=d(10516,null),this.store.add(l.onDidClick(()=>this.close(!0))),this.store.add(l)}buildBreakpointOptions(){let e=[{text:d(10515,null),isDisabled:!0},...this.availableBreakpoints.map(t=>({text:`${this.labelService.getUriLabel(t.uri,{relative:!0})}: ${t.lineNumber}`,description:d(10518,null)}))];for(let[t,o]of this.availableBreakpoints.entries())this.textModelService.createModelReference(o.uri).then(n=>{try{e[t+1].description=n.object.textEditorModel.getLineContent(o.lineNumber).trim()}finally{n.dispose()}}).catch(()=>{e[t+1].description=d(10514,null)});return e}updateTriggerBreakpointList(){this.availableBreakpoints=this.debugService.getModel().getBreakpoints().filter(o=>o!==this.breakpoint&&!o.logMessage);let e=0;if(this.triggeredByBreakpointInput){let o=this.availableBreakpoints.findIndex(n=>n.getId()===this.triggeredByBreakpointInput?.getId());o!==-1?e=o+1:this.triggeredByBreakpointInput=void 0}let t=this.buildBreakpointOptions();this.selectBreakpointBox.setOptions(t,e)}updateContextInput(){if(this.context===3)this.inputContainer.hidden=!0,this.selectBreakpointContainer.hidden=!1,this.selectBreakpointBox&&this.updateTriggerBreakpointList();else{this.inputContainer.hidden=!1,this.selectBreakpointContainer.hidden=!0,this.setInputMode();let e=this.getInputValue(this.breakpoint);this.input.getModel().setValue(e),this.focusInput()}}_doLayout(e,t){this.heightInPx=e,this.input.layout({height:e,width:t-113}),this.centerInputVertically()}_onWidth(e){typeof this.heightInPx=="number"&&this._doLayout(this.heightInPx,e)}createBreakpointInput(e){let t=this.instantiationService.createChild(new Po([kOi,this]));this.store.add(t);let o=this.createEditorOptions(),n=nNe();this.input=t.createInstance(us,e,o,n),iIi.bindTo(this.input.contextKeyService).set(!0);let r=this.modelService.createModel("",null,A.parse(`${Ox}:${this.editor.getId()}:breakpointinput`),!0);this.editor.hasModel()&&r.setLanguage(this.editor.getModel().getLanguageId()),this.input.setModel(r),this.setInputMode(),this.store.add(r);let s=()=>{let c=this.input.getModel().getValue()?[]:zhn(this.themeService.getColorTheme(),this.placeholder);this.input.setDecorationsByType("breakpoint-widget",OTo,c)};this.store.add(this.input.getModel().onDidChangeContent(()=>s())),this.store.add(this.themeService.onDidColorThemeChange(()=>s())),this.store.add(this.languageFeaturesService.completionProvider.register({scheme:Ox,hasAccessToAllModels:!0},{_debugDisplayName:"breakpointWidget",provideCompletionItems:(l,c,u,p)=>{let h,g=this.editor.getModel();return g&&(this.context===0||this.context===2&&Uhn(this.input))?h=_ue(this.languageFeaturesService.completionProvider,g,new ye(this.lineNumber,1),new F4(void 0,new Set().add(28)),u,p).then(f=>{let v=0;if(this.context===0)v=c.column-1;else{let b=this.input.getModel().getValue();for(;c.column-2-v>=0&&b[c.column-2-v]!=="{"&&b[c.column-2-v]!==" ";)v++}return{suggestions:f.items.map(b=>(b.completion.range=G.fromPositions(c.delta(0,-v),c),b.completion))}}):h=Promise.resolve({suggestions:[]}),h}})),this.store.add(this._configurationService.onDidChangeConfiguration(l=>{(l.affectsConfiguration("editor.fontSize")||l.affectsConfiguration("editor.lineHeight"))&&(this.input.updateOptions(this.createEditorOptions()),this.centerInputVertically())}))}createEditorOptions(){let e=this._configurationService.getValue("editor"),t=ay(this._configurationService);return t.fontSize=e.fontSize,t.fontFamily=e.fontFamily,t.lineHeight=e.lineHeight,t.fontLigatures=e.fontLigatures,t.ariaLabel=this.placeholder,t}centerInputVertically(){if(this.container&&typeof this.heightInPx=="number"){let e=this.input.getOption(75),t=this.input.getModel().getLineCount(),o=(this.heightInPx-t*e)/2;this.inputContainer.style.marginTop=o+"px"}}close(e){if(e){let t,o,n,r,s,l;if(this.rememberInput(),(this.conditionInput||this.context===0)&&(t=this.conditionInput),(this.hitCountInput||this.context===1)&&(o=this.hitCountInput),(this.logMessageInput||this.context===2)&&(n=this.logMessageInput),this.selectModeBox&&(s=this.modeInput?.mode,l=this.modeInput?.label),this.context===3&&(t=void 0,o=void 0,n=void 0,r=this.triggeredByBreakpointInput?.getId()),this.breakpoint){let c=new Map;c.set(this.breakpoint.getId(),{condition:t,hitCondition:o,logMessage:n,triggeredBy:r,mode:s,modeLabel:l}),this.debugService.updateBreakpoints(this.breakpoint.originalUri,c,!1).then(void 0,mt)}else{let c=this.editor.getModel();c&&this.debugService.addBreakpoints(c.uri,[{lineNumber:this.lineNumber,column:this.column,enabled:!0,condition:t,hitCondition:o,logMessage:n,triggeredBy:r,mode:s,modeLabel:l}])}}this.dispose()}focusInput(){this.context===3?this.selectBreakpointBox.focus():this.input.focus()}dispose(){super.dispose(),this.input.dispose(),je(this.store),setTimeout(()=>this.editor.focus(),0)}};mVe=I([m(4,qn),m(5,Hi),m(6,Pe),m(7,F),m(8,_t),m(9,Qt),m(10,B),m(11,Jt),m(12,Le),m(13,nt),m(14,Bt),m(15,ot)],mVe);var $$t=class a extends od{static{this.ID="breakpointWidget.action.acceptInput"}constructor(){super({id:a.ID,precondition:bXe,kbOpts:{kbExpr:iIi,primary:3,weight:100}})}runEditorCommand(i,e){i.get(kOi).close(!0)}},j$t=class a extends od{static{this.ID="closeBreakpointWidget"}constructor(){super({id:a.ID,precondition:bXe,kbOpts:{kbExpr:me.textInputFocus,primary:9,secondary:[1033],weight:100}})}runEditorCommand(i,e,t){let o=e.getContribution(cN);if(o)return o.closeBreakpointWidget();i.get(kOi).close(!1)}};ro(new $$t);ro(new j$t);var Khn=_,Ghn={description:"breakpoint-helper-decoration",glyphMarginClassName:q.asClassName(Vnt),glyphMargin:{position:3},glyphMarginHoverMessage:new he().appendText(d(10405,null)),stickiness:1};function qhn(a,i,e,t,o,n){let r=[];return e.forEach(s=>{if(s.lineNumber>i.getLineCount())return;let l=e.some(p=>p!==s&&p.lineNumber===s.lineNumber),c=i.getLineFirstNonWhitespaceColumn(s.lineNumber),u=i.validateRange(s.column?new G(s.lineNumber,s.column,s.lineNumber,s.column+1):new G(s.lineNumber,c,s.lineNumber,c+1));r.push({options:$hn(a,i,s,t,o,n,l),range:u})}),r}function $hn(a,i,e,t,o,n,r){let s=a.get(Hi),l=a.get(Rt),c=a.get(nt),{icon:u,message:p,showAdapterUnverifiedMessage:h}=t$(t,o,e,c,s.getModel()),g,f;if(h){let S;f=s.getModel().getSessions().map(y=>{let w=s.getAdapterManager().getDebugger(y.configuration.type),x=w?.strings?.unverifiedBreakpoints;if(x)return S||(S=l.guessLanguageIdByFilepathOrFirstLine(e.uri)??void 0),S&&w.interestedInLanguage(S)?x:void 0}).find(y=>!!y)}if(p)if(g=new he(void 0,{isTrusted:!0,supportThemeIcons:!0}),e.condition||e.hitCondition){let S=i.getLanguageId();g.appendCodeblock(S,p),f&&g.appendMarkdown("$(warning) "+f)}else g.appendText(p),f&&g.appendMarkdown(`

$(warning) `+f);else f&&(g=new he(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(f));let v=null;n&&(v={color:_s(Q$t),position:1});let b=e.column&&(r||e.column>i.getLineFirstNonWhitespaceColumn(e.lineNumber));return{description:"breakpoint-decoration",glyphMargin:{position:3},glyphMarginClassName:q.asClassName(u),glyphMarginHoverMessage:g,stickiness:1,before:b?{content:oF,inlineClassName:"debug-breakpoint-placeholder",inlineClassNameAffectsLetterSpacing:!0}:void 0,overviewRuler:v,zIndex:9999}}async function jhn(a,i,e){return e.capabilities.supportsBreakpointLocationsRequest?await Promise.all(jo(i,t=>t).map(async t=>{try{return{lineNumber:t,positions:await e.breakpointsLocations(a.uri,t)}}catch{return{lineNumber:t,positions:[]}}})):[]}function Qhn(a,i,e){let t=[];for(let{positions:o,lineNumber:n}of e){if(o.length===0)continue;let r=a.getLineFirstNonWhitespaceColumn(n),s=a.getLineLastNonWhitespaceColumn(n);o.forEach(l=>{let c=new G(l.lineNumber,l.column,l.lineNumber,l.column+1);if(l.column<=r&&!i.some(p=>p.range.startColumn>r&&p.range.startLineNumber===l.lineNumber)||l.column>s)return;let u=i.find(p=>p.range.equalsRange(c));u&&u.inlineWidget||t.push({range:c,options:{description:"breakpoint-placeholder-decoration",stickiness:1,before:u?void 0:{content:oF,inlineClassName:"debug-breakpoint-placeholder",inlineClassNameAffectsLetterSpacing:!0}},breakpoint:u?u.breakpoint:void 0})})}return t}var hVe=class{constructor(i,e,t,o,n,r,s,l){this.editor=i;this.debugService=e;this.contextMenuService=t;this.instantiationService=o;this.dialogService=r;this.configurationService=s;this.labelService=l;this.breakpointHintDecoration=null;this.toDispose=[];this.ignoreDecorationsChangedEvent=!1;this.ignoreBreakpointsChangeEvent=!1;this.breakpointDecorations=[];this.candidateDecorations=[];this.breakpointWidgetVisible=bXe.bindTo(n),this.setDecorationsScheduler=new Dt(()=>this.setDecorations(),30),this.setDecorationsScheduler.schedule(),this.registerListeners()}getContextMenuActionsAtPosition(i,e){if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return[];if(!this.debugService.canSetBreakpointsIn(e))return[];let t=this.debugService.getModel().getBreakpoints({lineNumber:i,uri:e.uri});return this.getContextMenuActions(t,e.uri,i)}registerListeners(){this.toDispose.push(this.editor.onMouseDown(async i=>{if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return;let e=this.editor.getModel();if(!i.target.position||!e||i.target.type!==2||i.target.detail.isAfterLines||!this.marginFreeFromNonDebugDecorations(i.target.position.lineNumber)&&!i.target.element?.className.includes("breakpoint"))return;let t=this.debugService.canSetBreakpointsIn(e),o=i.target.position.lineNumber,n=e.uri;if(!(i.event.rightButton||et&&i.event.leftButton&&i.event.ctrlKey)){let r=this.debugService.getModel().getBreakpoints({uri:n,lineNumber:o});if(r.length){let s=i.event.shiftKey,l=i.event.altKey,c=r.some(u=>u.enabled);if(l)this.showBreakpointWidget(r[0].lineNumber,r[0].column);else if(s)r.forEach(u=>this.debugService.enableOrDisableBreakpoints(!c,u));else if(!Sn&&r.some(u=>!!u.condition||!!u.logMessage||!!u.hitCondition||!!u.triggeredBy)){let u=r.every(f=>!!f.logMessage),p=u?d(10426,null):d(10402,null),h=d(10403,null,p.toLowerCase(),u?d(10427,null):d(10406,null)),g=d(10404,null,p.toLowerCase(),u?d(10427,null):d(10406,null));await this.dialogService.prompt({type:wt.Info,message:c?g:h,buttons:[{label:d(10432,null,p),run:()=>r.forEach(f=>this.debugService.removeBreakpoints(f.getId()))},{label:d(10416,null,c?d(10412,null):d(10421,null),p),run:()=>r.forEach(f=>this.debugService.enableOrDisableBreakpoints(!c,f))}],cancelButton:!0})}else c?r.forEach(u=>this.debugService.removeBreakpoints(u.getId())):r.forEach(u=>this.debugService.enableOrDisableBreakpoints(!c,u))}else if(t)if(i.event.altKey)this.showBreakpointWidget(o,void 0,0);else if(i.event.middleButton){let s=this.configurationService.getValue("debug").gutterMiddleClickAction;if(s!=="none"){let l;switch(s){case"logpoint":l=2;break;case"conditionalBreakpoint":l=0;break;case"triggeredBreakpoint":l=3}this.showBreakpointWidget(o,void 0,l)}}else this.debugService.addBreakpoints(n,[{lineNumber:o}])}})),of.pointerEvents&&_S||(this.toDispose.push(this.editor.onMouseMove(i=>{if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return;let e=-1,t=this.editor.getModel();t&&i.target.position&&(i.target.type===2||i.target.type===3)&&this.debugService.canSetBreakpointsIn(t)&&this.marginFreeFromNonDebugDecorations(i.target.position.lineNumber)&&(i.target.detail.isAfterLines||(e=i.target.position.lineNumber)),this.ensureBreakpointHintDecoration(e)})),this.toDispose.push(this.editor.onMouseLeave(()=>{this.ensureBreakpointHintDecoration(-1)}))),this.toDispose.push(this.editor.onDidChangeModel(async()=>{this.closeBreakpointWidget(),await this.setDecorations()})),this.toDispose.push(this.debugService.getModel().onDidChangeBreakpoints(()=>{!this.ignoreBreakpointsChangeEvent&&!this.setDecorationsScheduler.isScheduled()&&this.setDecorationsScheduler.schedule()})),this.toDispose.push(this.debugService.onDidChangeState(()=>{this.setDecorationsScheduler.isScheduled()||this.setDecorationsScheduler.schedule()})),this.toDispose.push(this.editor.onDidChangeModelDecorations(()=>this.onModelDecorationsChanged())),this.toDispose.push(this.configurationService.onDidChangeConfiguration(async i=>{(i.affectsConfiguration("debug.showBreakpointsInOverviewRuler")||i.affectsConfiguration("debug.showInlineBreakpointCandidates"))&&await this.setDecorations()}))}getContextMenuActions(i,e,t,o){let n=[];if(i.length===1){let r=i[0].logMessage?d(10426,null):d(10402,null);n.push(li({id:"debug.removeBreakpoint",label:d(10428,null,r),enabled:!0,run:async()=>{await this.debugService.removeBreakpoints(i[0].getId())}})),n.push(li({id:"workbench.debug.action.editBreakpointAction",label:d(10417,null,r),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(i[0].lineNumber,i[0].column))})),n.push(li({id:"workbench.debug.viewlet.action.toggleBreakpoint",label:i[0].enabled?d(10413,null,r):d(10422,null,r),enabled:!0,run:()=>this.debugService.enableOrDisableBreakpoints(!i[0].enabled,i[0])}))}else if(i.length>1){let r=i.slice().sort((s,l)=>s.column&&l.column?s.column-l.column:1);n.push(new sa("debug.removeBreakpoints",d(10429,null),r.map(s=>li({id:"removeInlineBreakpoint",label:s.column?d(10430,null,s.column):d(10431,null),enabled:!0,run:()=>this.debugService.removeBreakpoints(s.getId())})))),n.push(new sa("debug.editBreakpoints",d(10418,null),r.map(s=>li({id:"editBreakpoint",label:s.column?d(10419,null,s.column):d(10420,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(s.lineNumber,s.column))})))),n.push(new sa("debug.enableDisableBreakpoints",d(10425,null),r.map(s=>li({id:s.enabled?"disableColumnBreakpoint":"enableColumnBreakpoint",label:s.enabled?s.column?d(10415,null,s.column):d(10414,null):s.column?d(10424,null,s.column):d(10423,null),enabled:!0,run:()=>this.debugService.enableOrDisableBreakpoints(!s.enabled,s)}))))}else n.push(li({id:"addBreakpoint",label:d(10398,null),enabled:!0,run:()=>this.debugService.addBreakpoints(e,[{lineNumber:t,column:o}])})),n.push(li({id:"addConditionalBreakpoint",label:d(10399,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,0))})),n.push(li({id:"addLogPoint",label:d(10400,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,2))})),n.push(li({id:"addTriggeredBreakpoint",label:d(10401,null),enabled:!0,run:()=>Promise.resolve(this.showBreakpointWidget(t,o,3))}));return this.debugService.state===2&&(n.push(new oi),n.push(li({id:"runToLine",label:d(10433,null),enabled:!0,run:()=>this.debugService.runTo(e,t).catch(mt)}))),n}marginFreeFromNonDebugDecorations(i){let e=this.editor.getLineDecorations(i);if(e)for(let{options:t}of e){let o=t.glyphMarginClassName;if(!o)continue;if(!(o.includes("codicon-")||o.startsWith("coverage-deco-"))||o.includes("codicon-testing-")||o.includes("codicon-merge-")||o.includes("codicon-arrow-")||o.includes("codicon-loading")||o.includes("codicon-fold")||o.includes("codicon-gutter-lightbulb")||o.includes("codicon-lightbulb-sparkle"))return!1}return!0}ensureBreakpointHintDecoration(i){this.editor.changeDecorations(e=>{this.breakpointHintDecoration&&(e.removeDecoration(this.breakpointHintDecoration),this.breakpointHintDecoration=null),i!==-1&&(this.breakpointHintDecoration=e.addDecoration({startLineNumber:i,startColumn:1,endLineNumber:i,endColumn:1},Ghn))})}async setDecorations(){if(!this.editor.hasModel())return;let i=(u,p)=>{let h=Qhn(t,this.breakpointDecorations,p),g=u.deltaDecorations(this.candidateDecorations.map(f=>f.decorationId),h);this.candidateDecorations.forEach(f=>{f.inlineWidget.dispose()}),this.candidateDecorations=g.map((f,v)=>{let b=h[v],S=b.breakpoint?t$(this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),b.breakpoint,this.labelService,this.debugService.getModel()).icon:eV.disabled,y=()=>this.getContextMenuActions(b.breakpoint?[b.breakpoint]:[],e.getModel().uri,b.range.startLineNumber,b.range.startColumn),w=new Kat(e,f,q.asClassName(S),b.breakpoint,this.debugService,this.contextMenuService,y);return{decorationId:f,inlineWidget:w}})},e=this.editor,t=e.getModel(),o=this.debugService.getModel().getBreakpoints({uri:t.uri}),n=this.configurationService.getValue("debug"),r=this.instantiationService.invokeFunction(u=>qhn(u,t,o,this.debugService.state,this.debugService.getModel().areBreakpointsActivated(),n.showBreakpointsInOverviewRuler)),s=this.debugService.getViewModel().focusedSession,l=n.showInlineBreakpointCandidates&&s?jhn(this.editor.getModel(),r.map(u=>u.range.startLineNumber),s):Promise.resolve([]),c=await Promise.race([l,Li(500).then(()=>{})]);c===void 0&&l.then(u=>e.changeDecorations(p=>i(p,u)));try{this.ignoreDecorationsChangedEvent=!0,e.changeDecorations(u=>{let p=u.deltaDecorations(this.breakpointDecorations.map(h=>h.decorationId),r);this.breakpointDecorations.forEach(h=>{h.inlineWidget?.dispose()}),this.breakpointDecorations=p.map((h,g)=>{let f,v=o[g];if(r[g].options.before){let b=()=>this.getContextMenuActions([v],e.getModel().uri,v.lineNumber,v.column);f=new Kat(e,h,r[g].options.glyphMarginClassName,v,this.debugService,this.contextMenuService,b)}return{decorationId:h,breakpoint:v,range:r[g].range,inlineWidget:f}}),c&&i(u,c)})}finally{this.ignoreDecorationsChangedEvent=!1}for(let u of this.breakpointDecorations)u.inlineWidget&&this.editor.layoutContentWidget(u.inlineWidget)}async onModelDecorationsChanged(){if(this.breakpointDecorations.length===0||this.ignoreDecorationsChangedEvent||!this.editor.hasModel())return;let i=!1,e=this.editor.getModel();if(this.breakpointDecorations.forEach(o=>{if(i)return;let n=e.getDecorationRange(o.decorationId);n&&!o.range.equalsRange(n)&&(i=!0,o.range=n)}),!i)return;let t=new Map;for(let o=0,n=this.breakpointDecorations.length;o<n;o++){let r=this.breakpointDecorations[o],s=e.getDecorationRange(r.decorationId);s&&r.breakpoint&&t.set(r.breakpoint.getId(),{lineNumber:s.startLineNumber,column:r.breakpoint.column?s.startColumn:void 0})}try{this.ignoreBreakpointsChangeEvent=!0,await this.debugService.updateBreakpoints(e.uri,t,!0)}finally{this.ignoreBreakpointsChangeEvent=!1}}showBreakpointWidget(i,e,t){this.breakpointWidget?.dispose(),this.breakpointWidget=this.instantiationService.createInstance(mVe,this.editor,i,e,t),this.breakpointWidget.show({lineNumber:i,column:1}),this.breakpointWidgetVisible.set(!0)}closeBreakpointWidget(){this.breakpointWidget&&(this.breakpointWidget.dispose(),this.breakpointWidget=void 0,this.breakpointWidgetVisible.reset(),this.editor.focus())}dispose(){this.breakpointWidget?.dispose(),this.setDecorationsScheduler.dispose(),this.editor.removeDecorations(this.breakpointDecorations.map(i=>i.decorationId)),je(this.toDispose)}};hVe=I([m(1,Hi),m(2,Xe),m(3,F),m(4,X),m(5,ct),m(6,B),m(7,nt)],hVe);zat.registerGutterActionsGenerator(({lineNumber:a,editor:i,accessor:e},t)=>{let o=i.getModel(),n=e.get(Hi);if(!o||!n.getAdapterManager().hasEnabledDebuggers()||!n.canSetBreakpointsIn(o))return;let r=i.getContribution(cN);if(!r)return;let s=r.getContextMenuActionsAtPosition(a,o);for(let l of s)t.push(l,"2_debug")});var Kat=class{constructor(i,e,t,o,n,r,s){this.editor=i;this.decorationId=e;this.breakpoint=o;this.debugService=n;this.contextMenuService=r;this.getContextMenuActions=s;this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this.toDispose=[];this.range=this.editor.getModel().getDecorationRange(e),this.toDispose.push(this.editor.onDidChangeModelDecorations(()=>{let c=this.editor.getModel().getDecorationRange(this.decorationId);this.range&&!this.range.equalsRange(c)&&(this.range=c,this.editor.layoutContentWidget(this),this.updateSize())})),this.create(t),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(i){this.domNode=Khn(".inline-breakpoint-widget"),i&&this.domNode.classList.add(...i.split(" ")),this.toDispose.push($(this.domNode,ne.CLICK,async e=>{switch(this.breakpoint?.enabled){case void 0:await this.debugService.addBreakpoints(this.editor.getModel().uri,[{lineNumber:this.range.startLineNumber,column:this.range.startColumn}]);break;case!0:await this.debugService.removeBreakpoints(this.breakpoint.getId());break;case!1:this.debugService.enableOrDisableBreakpoints(!0,this.breakpoint);break}})),this.toDispose.push($(this.domNode,ne.CONTEXT_MENU,e=>{let t=new Ln(Me(this.domNode),e),o=this.getContextMenuActions();this.contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>o,getActionsContext:()=>this.breakpoint,onHide:()=>gz(o)})})),this.updateSize(),this.toDispose.push(this.editor.onDidChangeConfiguration(e=>{(e.hasChanged(61)||e.hasChanged(75))&&this.updateSize()}))}updateSize(){let i=this.range?this.editor.getLineHeightForPosition(this.range.getStartPosition()):this.editor.getOption(75);this.domNode.style.height=`${i}px`,this.domNode.style.width=`${Math.ceil(.8*i)}px`,this.domNode.style.marginLeft="4px"}getId(){return ht()}getDomNode(){return this.domNode}getPosition(){return this.range?(this.domNode.classList.toggle("line-start",this.range.startColumn===1),{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn-1},preference:[0]}):null}dispose(){this.editor.removeContentWidget(this),je(this.toDispose)}};I([bi],Kat.prototype,"getId",1);hs((a,i)=>{let e=".monaco-editor .glyph-margin-widgets, .monaco-workbench .debug-breakpoints, .monaco-workbench .disassembly-view, .monaco-editor .contentWidgets",t=a.getColor(Q$t);t&&(i.addRule(`${e} {
			${ZKt.map(l=>`${q.asCSSSelector(l.regular)}`).join(`,
		`)},
			${q.asCSSSelector(JKt)},
			${q.asCSSSelector(Vnt)}:not([class*='codicon-debug-breakpoint']):not([class*='codicon-debug-stackframe']),
			${q.asCSSSelector(eV.regular)}${q.asCSSSelector(Xge)}::after,
			${q.asCSSSelector(eV.regular)}${q.asCSSSelector(Yge)}::after {
				color: ${t} !important;
			}
		}`),i.addRule(`${e} {
			${q.asCSSSelector(eV.pending)} {
				color: ${t} !important;
				font-size: 12px !important;
			}
		}`));let o=a.getColor(Yhn);o&&i.addRule(`${e} {
			${ZKt.map(l=>q.asCSSSelector(l.disabled)).join(`,
		`)} {
				color: ${o};
			}
		}`);let n=a.getColor(Xhn);n&&i.addRule(`${e} {
			${ZKt.map(l=>q.asCSSSelector(l.unverified)).join(`,
		`)} {
				color: ${n};
			}
		}`);let r=a.getColor(Jhn);r&&i.addRule(`
		.monaco-editor .debug-top-stack-frame-column {
			color: ${r} !important;
		}
		${e} {
			${q.asCSSSelector(Yge)} {
				color: ${r} !important;
			}
		}
		`);let s=a.getColor(Zhn);s&&i.addRule(`${e} {
			${q.asCSSSelector(Xge)} {
				color: ${s} !important;
			}
		}`)});var Q$t=te("debugIcon.breakpointForeground","#E51400",d(10409,null)),Yhn=te("debugIcon.breakpointDisabledForeground","#848484",d(10408,null)),Xhn=te("debugIcon.breakpointUnverifiedForeground","#848484",d(10411,null)),Jhn=te("debugIcon.breakpointCurrentStackframeForeground",{dark:"#FFCC00",light:"#BE8700",hcDark:"#FFCC00",hcLight:"#BE8700"},d(10407,null)),Zhn=te("debugIcon.breakpointStackframeForeground","#89D185",d(10410,null));var fVe=te("editor.stackFrameHighlightBackground",{dark:"#ffff0033",light:"#ffff6673",hcDark:"#ffff0033",hcLight:"#ffff6673"},d(10521,null)),vVe=te("editor.focusedStackFrameHighlightBackground",{dark:"#7abd7a4d",light:"#cee7ce73",hcDark:"#7abd7a4d",hcLight:"#cee7ce73"},d(10520,null)),Y$t=1,egn={description:"top-stack-frame-margin",glyphMarginClassName:q.asClassName(Yge),glyphMargin:{position:3},zIndex:9999,stickiness:Y$t,overviewRuler:{position:7,color:_s(fVe)}},tgn={description:"focused-stack-frame-margin",glyphMarginClassName:q.asClassName(Xge),glyphMargin:{position:3},zIndex:9999,stickiness:Y$t,overviewRuler:{position:7,color:_s(vVe)}},EOi={description:"top-stack-frame-decoration",isWholeLine:!0,className:"debug-top-stack-frame-line",stickiness:Y$t},ign={description:"focused-stack-frame-decoration",isWholeLine:!0,className:"debug-focused-stack-frame-line",stickiness:Y$t},TOi=a=>({description:"top-stack-frame-inline-decoration",before:{content:"\uEB8B",inlineClassName:a?"debug-top-stack-frame-column start-of-line":"debug-top-stack-frame-column",inlineClassNameAffectsLetterSpacing:!0}});function ogn(a,i,e){let t=[],o=new G(a.range.startLineNumber,a.range.startColumn,a.range.startLineNumber,1073741824),n=new G(a.range.startLineNumber,a.range.startColumn,a.range.startLineNumber,a.range.startColumn+1),r=a.thread.getTopStackFrame();return a.getId()===r?.getId()?(i&&t.push({options:egn,range:n}),t.push({options:EOi,range:o}),a.range.startColumn>1&&t.push({options:TOi(e),range:o})):(i&&t.push({options:tgn,range:n}),t.push({options:ign,range:o})),t}var gVe=class extends k{constructor(e,t,o,n){super();this.editor=e;this.debugService=t;this.uriIdentityService=o;this.logService=n;this.decorations=this.editor.createDecorationsCollection();let r=()=>this.decorations.set(this.createCallStackDecorations());this._register(U.any(this.debugService.getViewModel().onDidFocusStackFrame,this.debugService.getModel().onDidChangeCallStack)(()=>{r()})),this._register(this.editor.onDidChangeModel(s=>{s.newModelUrl&&r()})),r()}createCallStackDecorations(){let e=this.editor;if(!e.hasModel())return[];let t=this.debugService.getViewModel().focusedStackFrame,o=[];return this.debugService.getModel().getSessions().forEach(n=>{let r=n===t?.thread.session;n.getAllThreads().forEach(s=>{if(s.stopped){let l=s.getCallStack(),c=[];l.length>0&&(t&&!t.equals(l[0])&&c.push(t),c.push(l[0])),c.forEach(u=>{if(u&&this.uriIdentityService.extUri.isEqual(u.source.uri,e.getModel()?.uri)){if(u.range.startLineNumber>e.getModel()?.getLineCount()||u.range.startLineNumber<1){this.logService.warn(`CallStackEditorContribution: invalid stack frame line number: ${u.range.startLineNumber}`);return}let p=e.getModel().getLineFirstNonWhitespaceColumn(u.range.startLineNumber)>=u.range.startColumn;o.push(...ogn(u,r,p))}})}})}),jo(o,n=>`${n.options.className} ${n.options.glyphMarginClassName} ${n.range.startLineNumber} ${n.range.startColumn}`)}dispose(){super.dispose(),this.decorations.clear()}};gVe=I([m(1,Hi),m(2,gt),m(3,re)],gVe);var bVe=class extends k{constructor(e,t,o){super();this._notebookEditor=e;this._debugService=t;this._notebookExecutionStateService=o;this._currentTopDecorations=[];this._currentOtherDecorations=[];this._executingCellDecorations=[];let n=this._register(new rn(200));this._register(t.getModel().onDidChangeCallStack(()=>this.updateExecutionDecorations())),this._register(t.getViewModel().onDidFocusStackFrame(()=>this.updateExecutionDecorations())),this._register(o.onDidChangeExecution(r=>{r.type===0&&this._notebookEditor.textModel&&r.affectsNotebook(this._notebookEditor.textModel.uri)&&n.trigger(()=>this.updateExecutionDecorations())}))}static{this.id="workbench.notebook.debug.pausedCellDecorations"}updateExecutionDecorations(){let e=this._notebookEditor.textModel?this._notebookExecutionStateService.getCellExecutionsByHandleForNotebook(this._notebookEditor.textModel.uri):void 0,t=[],o,n=l=>{let c=sn.parse(l.source.uri);if(c&&c.notebook.toString()===this._notebookEditor.textModel?.uri.toString())return{handle:c.handle,range:l.range}};for(let l of this._debugService.getModel().getSessions())for(let c of l.getAllThreads()){let u=c.getTopStackFrame();if(u){let p=n(u);p&&(t.push(p),e?.delete(p.handle))}}let r=this._debugService.getViewModel().focusedStackFrame;if(r&&r.thread.stopped){let l=n(r);l&&!t.some(c=>c.handle===l?.handle&&G.equalsRange(c.range,l?.range))&&(o=l,e?.delete(o.handle))}this.setTopFrameDecoration(t),this.setFocusedFrameDecoration(o);let s=e?Array.from(e.entries()).filter(([l,c])=>c.state===3).map(([l])=>l):[];this.setExecutingCellDecorations(s)}setTopFrameDecoration(e){let t=e.map(({handle:o,range:n})=>{let r={overviewRuler:{color:fVe,includeOutput:!1,modelRanges:[n],position:7}};return{handle:o,options:r}});this._currentTopDecorations=this._notebookEditor.deltaCellDecorations(this._currentTopDecorations,t)}setFocusedFrameDecoration(e){let t=[];if(e){let o={overviewRuler:{color:vVe,includeOutput:!1,modelRanges:[e.range],position:7}};t=[{handle:e.handle,options:o}]}this._currentOtherDecorations=this._notebookEditor.deltaCellDecorations(this._currentOtherDecorations,t)}setExecutingCellDecorations(e){let t=e.map(o=>{let n={overviewRuler:{color:Gyo,includeOutput:!1,modelRanges:[new G(0,0,0,0)],position:1}};return{handle:o,options:n}});this._executingCellDecorations=this._notebookEditor.deltaCellDecorations(this._executingCellDecorations,t)}};bVe=I([m(1,Hi),m(2,Ns)],bVe);Hm(bVe.id,bVe);var SVe=class extends k{constructor(e,t,o){super();this._notebookEditor=e;this._debugService=t;this._configService=o;this._currentDecorations=[];this._register(t.getModel().onDidChangeBreakpoints(()=>this.updateDecorations())),this._register(o.onDidChangeConfiguration(n=>n.affectsConfiguration("debug.showBreakpointsInOverviewRuler")&&this.updateDecorations()))}static{this.id="workbench.notebook.debug.notebookBreakpointDecorations"}updateDecorations(){let t=this._configService.getValue("debug.showBreakpointsInOverviewRuler")?this._debugService.getModel().getBreakpoints().map(o=>{let n=sn.parse(o.uri);if(!n||n.notebook.toString()!==this._notebookEditor.textModel.uri.toString())return null;let r={overviewRuler:{color:Q$t,includeOutput:!1,modelRanges:[new G(o.lineNumber,0,o.lineNumber,0)],position:1}};return{handle:n.handle,options:r}}).filter(o=>!!o):[];this._currentDecorations=this._notebookEditor.deltaCellDecorations(this._currentDecorations,t)}};SVe=I([m(1,Hi),m(2,B)],SVe);Hm(SVe.id,SVe);var Hve=class extends k{constructor(e,t,o){super();this._notebookEditor=e;this._notebookExecutionStateService=t;this._userActivity=o;this._activityMutex=this._register(new ue);this._register(e.onDidScroll(()=>this._update())),this._register(t.onDidChangeExecution(n=>{n.notebook.toString()===this._notebookEditor.textModel?.uri.toString()&&this._update()})),this._register(e.onDidChangeModel(()=>this._update()))}static{this.id="workbench.notebook.executionEditorProgress"}_update(){if(!this._notebookEditor.hasModel())return;let e=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._notebookEditor.textModel?.uri).filter(l=>l.state===3),t=this._notebookExecutionStateService.getExecution(this._notebookEditor.textModel?.uri),o=l=>{for(let c of this._notebookEditor.visibleRanges)for(let u of this._notebookEditor.getCellsInRange(c))if(u.handle===l.cellHandle){let p=this._notebookEditor.getAbsoluteTopOfElement(u);if(this._notebookEditor.scrollTop<p+5)return!0}return!1},n=e.length||t;n&&!this._activityMutex.value?this._activityMutex.value=this._userActivity.markActive():!n&&this._activityMutex.value&&this._activityMutex.clear();let r=e.length&&!e.some(o)&&!e.some(l=>l.isPaused);!!t||r?this._notebookEditor.showProgress():this._notebookEditor.hideProgress()}};I([DA(100)],Hve.prototype,"_update",1),Hve=I([m(1,Ns),m(2,Mme)],Hve);Hm(Hve.id,Hve);var Gat=class extends k{constructor(e,t,o){super();this._notebookKernelService=e;this._extensionService=t;this._notebookLoggingService=o;this._detectionMap=new Map;this._localDisposableStore=this._register(new O);this._registerListeners()}_registerListeners(){this._localDisposableStore.clear(),this._localDisposableStore.add(this._extensionService.onWillActivateByEvent(t=>{if(t.event.startsWith("onNotebook:")){if(this._extensionService.activationEventIsDone(t.event))return;let o=t.event.substring(11);if(o==="*")return;let n=!1,r=this._extensionService.getExtensionsStatus();if(this._extensionService.extensions.forEach(s=>{r[s.identifier.value].activationTimes||s.activationEvents?.includes(t.event)&&(n=!0)}),n&&!this._detectionMap.has(o)){this._notebookLoggingService.debug("KernelDetection",`start extension activation for ${o}`);let s=this._notebookKernelService.registerNotebookKernelDetectionTask({notebookType:o});this._detectionMap.set(o,s)}}}));let e=null;this._localDisposableStore.add(this._extensionService.onDidChangeExtensionsStatus(()=>{e&&clearTimeout(e),e=setTimeout(()=>{let t=[];for(let[o,n]of this._detectionMap)this._extensionService.activationEventIsDone(`onNotebook:${o}`)&&(this._notebookLoggingService.debug("KernelDetection",`finish extension activation for ${o}`),t.push(o),n.dispose());t.forEach(o=>{this._detectionMap.delete(o)})})})),this._localDisposableStore.add({dispose:()=>{e&&clearTimeout(e)}})}};Gat=I([m(0,Ql),m(1,lt),m(2,Sb)],Gat);oe.as(Zi.Workbench).registerWorkbenchContribution(Gat,3);var O6=class extends k{constructor(e,t,o,n,r){super();this.notebookEditor=e;this.notebookExecutionStateService=t;this.markerService=o;this.chatAgentService=n;this.configurationService=r;this.enabled=!1;this.listening=!1;this.diagnosticsByHandle=new Map;this.updateEnabled(),this._register(n.onDidChangeAgents(()=>this.updateEnabled())),this._register(r.onDidChangeConfiguration(s=>{s.affectsConfiguration(Ct.cellFailureDiagnostics)&&this.updateEnabled()}))}static{this.ID="workbench.notebook.cellDiagnostics"}hasNotebookAgent(){return!!this.chatAgentService.getAgents().find(t=>t.locations.includes("notebook"))}updateEnabled(){let e=this.configurationService.getValue(Ct.cellFailureDiagnostics);this.enabled&&(!e||!this.hasNotebookAgent())?(this.enabled=!1,this.clearAll()):!this.enabled&&e&&this.hasNotebookAgent()&&(this.enabled=!0,this.listening||(this.listening=!0,this._register(U.accumulate(this.notebookExecutionStateService.onDidChangeExecution,200)(t=>this.handleChangeExecutionState(t)))))}handleChangeExecutionState(e){if(!this.enabled)return;let t=new Set;for(let o of e.reverse()){let n=this.notebookEditor.textModel?.uri;o.type===0&&n&&o.affectsNotebook(n)&&!t.has(o.cellHandle)&&(t.add(o.cellHandle),o.changed?this.clear(o.cellHandle):this.setDiagnostics(o.cellHandle))}}clearAll(){for(let e of this.diagnosticsByHandle.keys())this.clear(e)}clear(e){let t=this.diagnosticsByHandle.get(e);if(t){for(let o of t)o.dispose();this.diagnosticsByHandle.delete(e)}}setDiagnostics(e){if(this.diagnosticsByHandle.has(e))return;let t=this.notebookEditor.getCellByHandle(e);if(!t||t.cellKind!==2)return;let o=t.model.internalMetadata;if(t instanceof Ah&&!o.lastRunSuccess&&o?.error?.location){let n=[],r=o.error.name?`${o.error.name}: ${o.error.message}`:o.error.message,s=this.createMarkerData(r,o.error.location);this.markerService.changeOne(O6.ID,t.uri,[s]),n.push(ee(()=>this.markerService.changeOne(O6.ID,t.uri,[]))),t.executionErrorDiagnostic.set(o.error,void 0),n.push(ee(()=>t.executionErrorDiagnostic.set(void 0,void 0))),n.push(ve(l=>{t.executionErrorDiagnostic.read(l)||this.clear(e)})),n.push(t.model.onDidChangeOutputs(()=>{t.model.outputs.length===0&&this.clear(e)})),n.push(t.model.onDidChangeContent(()=>{this.clear(e)})),this.diagnosticsByHandle.set(e,n)}}createMarkerData(e,t){return{severity:8,message:e,startLineNumber:t.startLineNumber+1,startColumn:t.startColumn+1,endLineNumber:t.endLineNumber+1,endColumn:t.endColumn+1,source:"Cell Execution Error"}}dispose(){super.dispose(),this.clearAll()}};O6=I([m(1,Ns),m(2,ha),m(3,gr),m(4,B)],O6);Hm(O6.ID,O6);var X$t="notebook.cell.openFailureActions",ngn="notebook.cell.chat.fixError",rgn="notebook.cell.chat.explainError";W(class extends iu{constructor(){super({id:X$t,title:P(13472,"Show Cell Failure Actions"),precondition:C.and(Vge,Hge,bP.toNegated()),f1:!0,keybinding:{when:C.and(Vge,Hge,bP.toNegated()),primary:2137,weight:200}})}async runWithContext(a,i){if(i.cell instanceof Ah){let e=i.cell.executionErrorDiagnostic.get();if(e?.location){let t=G.lift({startLineNumber:e.location.startLineNumber+1,startColumn:e.location.startColumn+1,endLineNumber:e.location.endLineNumber+1,endColumn:e.location.endColumn+1});i.notebookEditor.setCellEditorSelection(i.cell,G.lift(t));let o=Bie(i,i.cell);o&&Rm.get(o)?.manualTriggerAtCurrentPosition(d(13471,null),"other (default)",{include:Nr.QuickFix})}}}});W(class extends iu{constructor(){super({id:ngn,title:P(13474,"Fix Cell Error"),precondition:C.and(Vge,Hge,bP.toNegated()),f1:!0})}async runWithContext(a,i){if(i.cell instanceof Ah){let e=i.cell.executionErrorDiagnostic.get();if(e?.location){let t=G.lift({startLineNumber:e.location.startLineNumber+1,startColumn:e.location.startColumn+1,endLineNumber:e.location.endLineNumber+1,endColumn:e.location.endColumn+1});i.notebookEditor.setCellEditorSelection(i.cell,G.lift(t));let o=Bie(i,i.cell);if(o){let n=fu.get(o),r=e.name?`${e.name}: ${e.message}`:e.message;n&&await n.run({message:"/fix "+r,initialRange:t,autoSend:!0})}}}}});W(class extends iu{constructor(){super({id:rgn,title:P(13473,"Explain Cell Error"),precondition:C.and(Vge,Hge,bP.toNegated()),f1:!0})}async runWithContext(a,i){if(i.cell instanceof Ah){let e=i.cell.executionErrorDiagnostic.get();if(e?.message){let o=await a.get(Lt).revealWidget(),n=e.name?`${e.name}: ${e.message}`:e.message;o?.acceptInput("@workspace /explain "+n)}}}});var IVe=class extends k{static{this.id="workbench.notebook.statusBar.diagtnostic"}constructor(i,e){super(),this._register(new lVe(i,(t,o)=>o instanceof Ah?e.createInstance(qat,t,o):k.None))}};IVe=I([m(1,F)],IVe);Hm(IVe.id,IVe);var qat=class extends k{constructor(e,t,o,n){super();this._notebookViewModel=e;this.cell=t;this.keybindingService=o;this.chatAgentService=n;this._currentItemIds=[];this._register(ve(r=>this.updateSparkleItem(r.readObservable(t.executionErrorDiagnostic))))}hasNotebookAgent(){return!!this.chatAgentService.getAgents().find(t=>t.locations.includes("notebook"))}async updateSparkleItem(e){let t;e?.location&&this.hasNotebookAgent()&&(t={text:"$(sparkle)",tooltip:this.keybindingService.appendKeybinding(d(13475,null),X$t),alignment:1,command:X$t,priority:Number.MAX_SAFE_INTEGER-1});let o=t?[t]:[];this._currentItemIds=this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this.cell.handle,items:o}])}dispose(){super.dispose(),this._notebookViewModel.deltaCellStatusBarItems(this._currentItemIds,[{handle:this.cell.handle,items:[]}])}};qat=I([m(2,Le),m(3,gr)],qat);var yVe=class extends k{constructor(e,t){super();this.notebookEditor=e;this.configurationService=t;this.isEnabled=!1;this.cellDecorationIds=new Map;this.anchorDisposables=new O;this.isEnabled=this.configurationService.getValue("editor.selectionHighlight"),this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("editor.selectionHighlight")&&(this.isEnabled=this.configurationService.getValue("editor.selectionHighlight"))})),this._register(this.notebookEditor.onDidChangeActiveCell(async()=>{if(!this.isEnabled||(this.anchorCell=this.notebookEditor.activeCellAndCodeEditor,!this.anchorCell))return;let o=this.notebookEditor.getActiveCell();o&&(o.editorAttached||await U.toPromise(o.onDidChangeEditorAttachState),this.clearNotebookSelectionDecorations(),this.anchorDisposables.clear(),this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorPosition(n=>{if(n.reason!==3){this.clearNotebookSelectionDecorations();return}this.anchorCell&&this.notebookEditor.hasModel()&&(this.clearNotebookSelectionDecorations(),this._update(this.notebookEditor))})),this.notebookEditor.getEditorViewState().editorFocused&&this.notebookEditor.hasModel()&&this._update(this.notebookEditor))}))}static{this.id="notebook.selectionHighlighter"}_update(e){if(!this.anchorCell||!this.isEnabled)return;let t=this.anchorCell[0].textModel;if(!t||t.isTooLargeForTokenization())return;let o=this.anchorCell[0].getSelections()[0];if(o.startLineNumber!==o.endLineNumber||o.isEmpty())return;let n=this.getSearchText(o,t);if(!n)return;let r=e.textModel.findMatches(n,!1,!0,null);for(let s of r){let l=e.getCellByHandle(s.cell.handle);l&&this.updateCellDecorations(l,s.matches)}}updateCellDecorations(e,t){let o=t.map(s=>ei.fromRange(s.range,0)),n=[];o?.map(s=>{s.isEmpty()||n.push({range:s,options:{description:"",className:".nb-selection-highlight"}})});let r=this.cellDecorationIds.get(e)??[];this.cellDecorationIds.set(e,e.deltaModelDecorations(r,n))}clearNotebookSelectionDecorations(){this.cellDecorationIds.forEach((e,t)=>{let o=this.cellDecorationIds.get(t)??[];o&&(t.deltaModelDecorations(o,[]),this.cellDecorationIds.delete(t))})}getSearchText(e,t){return t.getValueInRange(e).replace(/\r\n/g,`
`)}dispose(){super.dispose(),this.anchorDisposables.dispose()}};yVe=I([m(1,B)],yVe);Hm(yVe.id,yVe);var l4m=te("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},d(266,null)),c4m=te("multiDiffEditor.background",Bo,d(264,null)),d4m=te("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},d(265,null));var J$t=class{constructor(i,e){this.viewModel=i;this.deltaScrollVertical=e}getId(){return this.viewModel}},Wne=class extends k{constructor(e,t,o,n,r){super();this._container=e;this._overflowWidgetsDomNode=t;this._workbenchUIElementFactory=o;this._instantiationService=n;this._viewModel=De(this,void 0),this._collapsed=ke(this,c=>this._viewModel.read(c)?.collapsed.read(c)),this._editorContentHeight=De(this,500),this.contentHeight=ke(this,c=>(this._collapsed.read(c)?0:this._editorContentHeight.read(c))+this._outerEditorHeight),this._modifiedContentWidth=De(this,0),this._modifiedWidth=De(this,0),this._originalContentWidth=De(this,0),this._originalWidth=De(this,0),this.maxScroll=ke(this,c=>{let u=this._modifiedContentWidth.read(c)-this._modifiedWidth.read(c),p=this._originalContentWidth.read(c)-this._originalWidth.read(c);return u>p?{maxScroll:u,width:this._modifiedWidth.read(c)}:{maxScroll:p,width:this._originalWidth.read(c)}}),this._elements=st("div.multiDiffEntry",[st("div.header@header",[st("div.header-content",[st("div.collapse-button@collapseButton"),st("div.file-path",[st("div.title.modified.show-file-icons@primaryPath",[]),st("div.status.deleted@status",["R"]),st("div.title.original.show-file-icons@secondaryPath",[])]),st("div.actions@actions")])]),st("div.editorParent",[st("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(_p,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode,fixedOverflowWidgets:!0},{})),this.isModifedFocused=Ds(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=Ds(this.editor.getOriginalEditor()).isFocused,this.isFocused=ke(this,c=>this.isModifedFocused.read(c)||this.isOriginalFocused.read(c)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new O),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;let s=this._register(new Pi(this._elements.collapseButton,{}));this._register(ve(c=>{s.element.className="",s.icon=this._collapsed.read(c)?L.chevronRight:L.chevronDown})),this._register(s.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._workbenchUIElementFactory.headerClickToCollapse&&(this._elements.header.tabIndex=0,this._elements.header.setAttribute("role","button"),this._register($(this._elements.header,ne.CLICK,c=>{let u=c.target;u instanceof Element&&(u.closest(".actions")||u.closest(".collapse-button")||this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0))})),this._register($(this._elements.header,ne.KEY_DOWN,c=>{if(c.key==="Enter"||c.key===" "){let u=c.target;if(u instanceof Element&&(u.closest(".actions")||u.closest(".collapse-button")))return;c.preventDefault(),this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)}}))),this._register(ve(c=>{let u=this._collapsed.read(c);this._elements.editor.style.display=u?"none":"block",this._workbenchUIElementFactory.headerClickToCollapse&&this._elements.header.setAttribute("aria-expanded",String(!u))})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(c=>{let u=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(u,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(c=>{let u=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(u,void 0)})),this._register(this.editor.onDidContentSizeChange(c=>{bY(u=>{this._editorContentHeight.set(c.contentHeight,u),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),u),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),u)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(c=>{if(this._isSettingScrollTop||!c.scrollTopChanged||!this._data)return;let u=c.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(u)})),this._register(ve(c=>{let u=this._viewModel.read(c)?.isActive.read(c);this._elements.root.classList.toggle("active",u)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(r.createScoped(this._elements.actions));let l=this._register(this._instantiationService.createChild(new Po([X,this._contextKeyService])));this._register(l.createInstance(pr,this._elements.actions,R.MultiDiffEditorFileToolbar,{actionRunner:this._register(new Xke(()=>this._viewModel.get()?.modifiedUri??this._viewModel.get()?.originalUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:c=>c.startsWith("navigation")},actionViewItemProvider:(c,u)=>ta(l,c,u)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(n){return{...n,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){bY(n=>{this._viewModel.set(void 0,n),this.editor.setDiffModel(null,n),this._dataStore.clear()});return}let o=e.viewModel.documentDiffItem;if(bY(n=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let r=!1,s=!1,l=!1,c="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(c="R",r=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(c="A",l=!0):(c="D",s=!0),this._elements.status.classList.toggle("renamed",r),this._elements.status.classList.toggle("deleted",s),this._elements.status.classList.toggle("added",l),this._elements.status.innerText=c,this._resourceLabel2?.setUri(r?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,n),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,n),this.editor.updateOptions(t(o.options??{}))}),o.onOptionsDidChange&&this._dataStore.add(o.onOptionsDidChange(()=>{this.editor.updateOptions(t(o.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,n=>{n||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(let[n,r]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(n,r)}render(e,t,o,n){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";let r=e.length-this._headerHeight,s=Math.max(0,Math.min(n.start-e.start,r));this._elements.header.style.transform=`translateY(${s}px)`,bY(l=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=o,this.editor.getOriginalEditor().setScrollTop(o)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",s>0||o>0),this._elements.header.classList.toggle("collapsed",s===r)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};Wne=I([m(3,F),m(4,X)],Wne);var Z$t=class{constructor(i){this._create=i;this._unused=new Set;this._used=new Set;this._itemData=new Map}getUnusedObj(i){let e;if(this._unused.size===0)e=this._create(i),this._itemData.set(e,i);else{let t=[...this._unused.values()];e=t.find(o=>this._itemData.get(o).getId()===i.getId())??t[0],this._unused.delete(e),this._itemData.set(e,i),e.setData(i)}return this._used.add(e),{object:e,dispose:()=>{this._used.delete(e),this._unused.size>5?e.dispose():this._unused.add(e)}}}dispose(){for(let i of this._used)i.dispose();for(let i of this._unused)i.dispose();this._used.clear(),this._unused.clear()}};var wVe=class extends k{constructor(e,t,o,n,r,s){super();this._element=e;this._dimension=t;this._viewModel=o;this._workbenchUIElementFactory=n;this._parentContextKeyService=r;this._parentInstantiationService=s;this._scrollableElements=st("div.scrollContent",[st("div@content",{style:{overflow:"hidden"}}),st("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new hD({forceIntegerValues:!1,scheduleAtNextAnimationFrame:u=>kr(Me(this._element),u),smoothScrollDuration:100})),this._scrollableElement=this._register(new LF(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=st("div.monaco-component.multiDiffEditor",{},[st("div",{},[this._scrollableElement.getDomNode()]),st("div.placeholder@placeholder",{},[st("div")])]),this._sizeObserver=this._register(new Eke(this._element,void 0)),this._objectPool=this._register(new Z$t(u=>{let p=this._instantiationService.createInstance(Wne,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return p.setData(u),p})),this.scrollTop=vi(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=vi(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=ke(this,u=>{let p=this._viewModel.read(u);if(!p)return{items:[],getItem:v=>{throw new ci}};let h=p.items.read(u),g=new Map;return{items:h.map(v=>{let b=u.store.add(new _Oi(v,this._objectPool,this.scrollLeft,y=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+y})})),S=this._lastDocStates?.[b.getKey()];return S&&Ki(y=>{b.setViewState(S,y)}),g.set(v,b),b}),getItem:v=>g.get(v)}}),this._viewItems=this._viewItemsInfo.map(this,u=>u.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(u,p)=>u.reduce((h,g)=>h+g.contentHeight.read(p)+this._spaceBetweenPx,0)),this.activeControl=ke(this,u=>{let p=this._viewModel.read(u)?.activeDiffItem.read(u);return p?this._viewItemsInfo.read(u).getItem(p).template.read(u)?.editor:void 0}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new Po([X,this._contextKeyService]))),this._contextKeyService.createKey(me.inMultiDiffEditor.key,!0),this._lastDocStates={},this._register(Rl((u,p)=>{let h=this._viewModel.read(u);if(h&&h.contextKeys)for(let[g,f]of Object.entries(h.contextKeys)){let v=this._contextKeyService.createKey(g,void 0);v.set(f),p.add(ee(()=>v.reset()))}}));let l=this._parentContextKeyService.createKey(me.multiDiffEditorAllCollapsed.key,!1);this._register(ve(u=>{let p=this._viewModel.read(u);if(p){let h=p.items.read(u).every(g=>g.collapsed.read(u));l.set(h)}})),this._register(ve(u=>{let p=this._dimension.read(u);this._sizeObserver.observe(p)}));let c=ke(u=>{if(this._viewItems.read(u).length>0)return;let h=this._viewModel.read(u);return!h||h.isLoading.read(u)?d(267,null):d(268,null)});this._register(ve(u=>{let p=c.read(u);this._elements.placeholder.innerText=p??"",this._elements.placeholder.classList.toggle("visible",!!p)})),this._scrollableElements.content.style.position="relative",this._register(ve(u=>{let p=this._sizeObserver.height.read(u);this._scrollableElements.root.style.height=`${p}px`;let h=this._totalHeight.read(u);this._scrollableElements.content.style.height=`${h}px`;let g=this._sizeObserver.width.read(u),f=g,v=this._viewItems.read(u),b=j5e(v,Il(S=>S.maxScroll.read(u).maxScroll,Hu));if(b){let S=b.maxScroll.read(u);f=g+S.maxScroll}this._scrollableElement.setScrollDimensions({width:g,height:p,scrollHeight:h,scrollWidth:f})})),e.replaceChildren(this._elements.root),this._register(ee(()=>{e.replaceChildren()})),this._register(ve(u=>{let p=this._viewModel.read(u);if(p&&!p.isLoading.read(u)){if(p.items.read(u).length===0||p.activeDiffItem.read(u))return;this.goToNextChange()}})),this._register(this._register(ve(u=>{bY(p=>{this.render(u)})})))}setScrollState(e){this._scrollableElement.setScrollPosition({scrollLeft:e.left,scrollTop:e.top})}getRootElement(){return this._elements.root}getContextKeyService(){return this._contextKeyService}getScopedInstantiationService(){return this._instantiationService}reveal(e,t){let o=this._viewItems.get(),n=o.findIndex(u=>u.viewModel.originalUri?.toString()===e.original?.toString()&&u.viewModel.modifiedUri?.toString()===e.modified?.toString());if(n===-1)throw new ci("Resource not found in diff editor");let r=o[n];this._viewModel.get().activeDiffItem.setCache(r.viewModel,void 0);let s=0;for(let u=0;u<n;u++)s+=o[u].contentHeight.get()+this._spaceBetweenPx;this._scrollableElement.setScrollPosition({scrollTop:s});let l=r.template.get()?.editor,c="original"in e?l?.getOriginalEditor():l?.getModifiedEditor();c&&t?.range&&(c.revealRangeInCenter(t.range),sgn(c,t.range))}getViewState(){return{scrollState:{top:this.scrollTop.get(),left:this.scrollLeft.get()},docStates:Object.fromEntries(this._viewItems.get().map(e=>[e.getKey(),e.getViewState()]))}}setViewState(e){this.setScrollState(e.scrollState),this._lastDocStates=e.docStates,Ki(t=>{if(e.docStates)for(let o of this._viewItems.get()){let n=e.docStates[o.getKey()];n&&o.setViewState(n,t)}})}findDocumentDiffItem(e){return this._viewItems.get().find(o=>o.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||o.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString())?.viewModel.documentDiffItem}tryGetCodeEditor(e){let t=this._viewItems.get().find(n=>n.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()||n.viewModel.diffEditorViewModel.model.original.uri.toString()===e.toString()),o=t?.template.get()?.editor;if(o)return t.viewModel.diffEditorViewModel.model.modified.uri.toString()===e.toString()?{diffEditor:o,editor:o.getModifiedEditor()}:{diffEditor:o,editor:o.getOriginalEditor()}}goToNextChange(){this._navigateToChange("next")}goToPreviousChange(){this._navigateToChange("previous")}_navigateToChange(e){let t=this._viewItems.get();if(t.length===0)return;let o=this._viewModel.get()?.activeDiffItem.get(),n=o?t.findIndex(c=>c.viewModel===o):-1;if(n===-1){this._goToFile(0,"first");return}let r=t[n];r.viewModel.collapsed.get()&&r.viewModel.collapsed.set(!1,void 0);let s=r.template.get()?.editor;if(s?.getDiffComputationResult()?.changes2?.length){let c=s.getModifiedEditor().getPosition()?.lineNumber||1,u=s.getDiffComputationResult().changes2;if(e==="next"?u.some(h=>h.modified.startLineNumber>c):u.some(h=>h.modified.endLineNumberExclusive<=c)){s.goToDiff(e);return}}let l=(n+(e==="next"?1:-1)+t.length)%t.length;this._goToFile(l,e==="next"?"first":"last")}_goToFile(e,t){let o=this._viewItems.get()[e];o.viewModel.collapsed.get()&&o.viewModel.collapsed.set(!1,void 0),this.reveal({original:o.viewModel.originalUri,modified:o.viewModel.modifiedUri});let n=o.template.get()?.editor;if(n?.getDiffComputationResult()?.changes2?.length)if(t==="first")n.revealFirstDiff();else{let r=n.getDiffComputationResult().changes2.at(-1),s=n.getModifiedEditor();s.setPosition({lineNumber:r.modified.startLineNumber,column:1}),s.revealLineInCenter(r.modified.startLineNumber)}n?.focus()}render(e){let t=this.scrollTop.read(e),o=0,n=0,r=0,s=this._sizeObserver.height.read(e),l=gi.ofStartAndLength(t,s),c=this._sizeObserver.width.read(e);for(let u of this._viewItems.read(e)){let p=u.contentHeight.read(e),h=Math.min(p,s),g=gi.ofStartAndLength(n,h),f=gi.ofStartAndLength(r,p);if(f.isBefore(l))o-=p-h,u.hide();else if(f.isAfter(l))u.hide();else{let v=Math.max(0,Math.min(l.start-f.start,p-h));o-=v;let b=gi.ofStartAndLength(t+o,s);u.render(g,v,c,b)}n+=h+this._spaceBetweenPx,r+=p+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+o)}px)`}};wVe=I([m(4,X),m(5,F)],wVe);function sgn(a,i){let e=a.getModel(),t=a.createDecorationsCollection([{range:i,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===e&&t.clear()},350)}var _Oi=class extends k{constructor(e,t,o,n){super();this.viewModel=e;this._objectPool=t;this._scrollLeft=o;this._deltaScrollVertical=n;this._templateRef=this._register(IB(this,void 0));this.contentHeight=ke(this,e=>this._templateRef.read(e)?.object.contentHeight?.read(e)??this.viewModel.lastTemplateData.read(e).contentHeight);this.maxScroll=ke(this,e=>this._templateRef.read(e)?.object.maxScroll.read(e)??{maxScroll:0,scrollWidth:0});this.template=ke(this,e=>this._templateRef.read(e)?.object);this._isHidden=De(this,!1);this._isFocused=ke(this,e=>this.template.read(e)?.isFocused.read(e)??!1);this.viewModel.setIsFocused(this._isFocused,void 0),this._register(ve(r=>{let s=this._scrollLeft.read(r);this._templateRef.read(r)?.object.setScrollLeft(s)})),this._register(ve(r=>{let s=this._templateRef.read(r);!s||!this._isHidden.read(r)||s.object.isFocused.read(r)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}getViewState(){return Ki(e=>{this._updateTemplateData(e)}),{collapsed:this.viewModel.collapsed.get(),selections:this.viewModel.lastTemplateData.get().selections}}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);let o=this.viewModel.lastTemplateData.get(),n=e.selections?.map(ei.liftSelection);this.viewModel.lastTemplateData.set({...o,selections:n},t);let r=this._templateRef.get();r&&n&&r.object.editor.setSelections(n)}_updateTemplateData(e){let t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){let e=this._templateRef.get();e&&Ki(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,o,n){this._isHidden.set(!1,void 0);let r=this._templateRef.get();if(!r){r=this._objectPool.getUnusedObj(new J$t(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(r,void 0);let s=this.viewModel.lastTemplateData.get().selections;s&&r.object.editor.setSelections(s)}r.object.render(e,o,t,n)}};var Vne=class extends k{constructor(e,t,o){super();this._element=e;this._workbenchUIElementFactory=t;this._instantiationService=o;this._dimension=De(this,void 0);this._viewModel=De(this,void 0);this._widgetImpl=ke(this,e=>(zk(Wne,e),e.store.add(this._instantiationService.createInstance(zk(wVe,e),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))));this._activeControl=ke(this,e=>this._widgetImpl.read(e).activeControl.read(e));this.onDidChangeActiveControl=U.fromObservableLight(this._activeControl);this._register(bA(this._widgetImpl))}reveal(e,t){this._widgetImpl.get().reveal(e,t)}createViewModel(e){return new rRe(e,this._instantiationService)}setViewModel(e){this._viewModel.set(e,void 0)}layout(e){this._dimension.set(e,void 0)}getActiveControl(){return this._activeControl.get()}getViewState(){return this._widgetImpl.get().getViewState()}setViewState(e){this._widgetImpl.get().setViewState(e)}tryGetCodeEditor(e){return this._widgetImpl.get().tryGetCodeEditor(e)}getRootElement(){return this._widgetImpl.get().getRootElement()}getContextKeyService(){return this._widgetImpl.get().getContextKeyService()}getScopedInstantiationService(){return this._widgetImpl.get().getScopedInstantiationService()}findDocumentDiffItem(e){return this._widgetImpl.get().findDocumentDiffItem(e)}goToNextChange(){this._widgetImpl.get().goToNextChange()}goToPreviousChange(){this._widgetImpl.get().goToPreviousChange()}};Vne=I([m(2,F)],Vne);var Um=class extends zs{constructor(e,t,o,n,r,s,l,c,u){super(Um.ID,e,l,o,c);this.instantiationService=t;this._parentContextKeyService=n;this.notebookEditorWorkerService=r;this.configurationService=s;this.notebookService=u;this.modelSpecificResources=this._register(new O),this.ctxAllCollapsed=this._parentContextKeyService.createKey(Qyo.key,!1),this.ctxHasUnchangedCells=this._parentContextKeyService.createKey(vfe.key,!1),this.ctxHiddenUnchangedCells=this._parentContextKeyService.createKey(drt.key,!0),this._notebookOptions=t.createInstance(P_,this.window,!1,void 0),this._register(this._notebookOptions)}static{this.ID=sro}get textModel(){return this._model?.modified.notebook}get notebookOptions(){return this._notebookOptions}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}layout(e,t){this._multiDiffEditorWidget.layout(e)}createFontInfo(){let e=this.configurationService.getValue("editor");return zw.readFontInfo(this.window,RI(e,Gu.getInstance(this.window).value))}createEditor(e){this._multiDiffEditorWidget=this._register(this.instantiationService.createInstance(Vne,e,this.instantiationService.createInstance($at))),this._register(this._multiDiffEditorWidget.onDidChangeActiveControl(()=>{this._onDidChangeControl.fire()}))}async setInput(e,t,o,n){super.setInput(e,t,o,n);let r=await e.resolve();this._model!==r&&(this._detachModel(),this._model=r);let s=this.modelSpecificResources.add(new POe),l=this.instantiationService.createInstance(coe,this.fontInfo.lineHeight);this.viewModel=this.modelSpecificResources.add(new UOe(r,this.notebookEditorWorkerService,this.configurationService,s,this.notebookService,l,void 0,!0)),await this.viewModel.computeDiff(this.modelSpecificResources.add(new qe).token),this.ctxHasUnchangedCells.set(this.viewModel.hasUnchangedCells),this.ctxHasUnchangedCells.set(this.viewModel.hasUnchangedCells);let c=this.modelSpecificResources.add(Xie.createInput(this.viewModel,this.instantiationService));this.widgetViewModel=this.modelSpecificResources.add(await c.getViewModel());let u=new WeakSet;this.modelSpecificResources.add(ve(p=>{if(!this.widgetViewModel||!this.viewModel)return;let h=this.widgetViewModel.items.read(p),g=this.viewModel.value;h.length===g.length&&Ki(f=>{h.forEach(v=>{if(u.has(v))return;u.add(v);let b=g.find(S=>S.modifiedUri?.toString()===v.modifiedUri?.toString()&&S.originalUri?.toString()===v.originalUri?.toString());b&&b.type==="unchanged"&&v.collapsed.set(!0,f)})})})),this._multiDiffEditorWidget.setViewModel(this.widgetViewModel)}_detachModel(){this.viewModel=void 0,this.modelSpecificResources.clear()}_generateFontFamily(){return this.fontInfo.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}setOptions(e){super.setOptions(e)}getControl(){return this._multiDiffEditorWidget.getActiveControl()}focus(){super.focus(),this._multiDiffEditorWidget?.getActiveControl()?.focus()}hasFocus(){return this._multiDiffEditorWidget?.getActiveControl()?.hasTextFocus()||super.hasFocus()}clearInput(){super.clearInput(),this._multiDiffEditorWidget.setViewModel(void 0),this.modelSpecificResources.clear(),this.viewModel=void 0,this.widgetViewModel=void 0}expandAll(){this.widgetViewModel&&(this.widgetViewModel.expandAll(),this.ctxAllCollapsed.set(!1))}collapseAll(){this.widgetViewModel&&(this.widgetViewModel.collapseAll(),this.ctxAllCollapsed.set(!0))}hideUnchanged(){this.viewModel&&(this.viewModel.includeUnchanged=!1,this.ctxHiddenUnchangedCells.set(!0))}showUnchanged(){this.viewModel&&(this.viewModel.includeUnchanged=!0,this.ctxHiddenUnchangedCells.set(!1))}getDiffElementViewModel(e){if(e.scheme===Q.vscodeNotebookCellOutput||e.scheme===Q.vscodeNotebookCellOutputDiff||e.scheme===Q.vscodeNotebookCellMetadata||e.scheme===Q.vscodeNotebookCellMetadataDiff){let t=sn.parseCellPropertyUri(e,e.scheme);t&&(e=sn.generate(t.notebook,t.handle))}return e.scheme===Q.vscodeNotebookMetadata?this.viewModel?.items.find(t=>t.type==="modifiedMetadata"||t.type==="unchangedMetadata"):this.viewModel?.items.find(t=>{switch(t.type){case"delete":return t.original?.uri.toString()===e.toString();case"insert":return t.modified?.uri.toString()===e.toString();case"modified":case"unchanged":return t.modified?.uri.toString()===e.toString()||t.original?.uri.toString()===e.toString();default:return}})}};Um=I([m(1,F),m(2,Pe),m(3,X),m(4,Mq),m(5,B),m(6,_e),m(7,de),m(8,kn)],Um);var $at=class{constructor(i,e,t){this._instantiationService=i;this.notebookDocumentService=e;this.notebookService=t}createResourceLabel(i){let e=this._instantiationService.createInstance(CE,i,{}),t=this;return{setUri(o,n={}){if(!o)e.element.clear();else{let r="",s="",l;if(o.scheme===Q.vscodeNotebookCell){let c=o.scheme===Q.vscodeNotebookCell?t.notebookDocumentService.getNotebook(o):void 0,u=Q.vscodeNotebookCell?t.notebookDocumentService.getNotebook(o)?.getCellIndex(o):void 0;if(c&&u!==void 0){r=d(13742,null,`${u+1}`);let p=c?t.notebookService.getNotebookTextModel(c?.uri):void 0,h=p&&u!==void 0?p.cells[u].language:void 0;l=h?v2(h):void 0}}else o.scheme===Q.vscodeNotebookCellMetadata||o.scheme===Q.vscodeNotebookCellMetadataDiff?s=d(13743,null):(o.scheme===Q.vscodeNotebookCellOutput||o.scheme===Q.vscodeNotebookCellOutputDiff)&&(s=d(13744,null));e.element.setResource({name:r,description:s},{strikethrough:n.strikethrough,forceLabel:!0,hideIcon:!l,extraClasses:l})}},dispose(){e.dispose()}}}};$at=I([m(0,F),m(1,s3),m(2,kn)],$at);W(class extends z{constructor(){super({id:"notebook.diff.openFile",icon:L.goToFile,title:P(13728,"Open File"),precondition:C.or(Tr.isEqualTo(Oh.ID),Tr.isEqualTo(Um.ID)),menu:[{id:R.EditorTitle,group:"navigation",when:C.or(Tr.isEqualTo(Oh.ID),Tr.isEqualTo(Um.ID))}]})}async run(a){let i=a.get(ie),e=i.activeEditorPane;if(e&&(e instanceof Oh||e instanceof Um)){let o=e.input.modified.resource;await i.openEditor({resource:o})}}});W(class extends z{constructor(){super({id:"notebook.diff.cell.toggleCollapseUnchangedRegions",title:P(13724,"Toggle Collapse Unchanged Regions"),icon:L.map,toggled:C.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Tr.isEqualTo(Oh.ID),menu:{id:R.EditorTitle,group:"navigation",when:Tr.isEqualTo(Oh.ID)}})}run(a,...i){let e=a.get(B),t=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",t)}});W(class extends z{constructor(){super({id:"notebook.diff.switchToText",icon:wIo,title:P(13732,"Open Text Diff Editor"),precondition:C.or(Tr.isEqualTo(Oh.ID),Tr.isEqualTo(Um.ID)),menu:[{id:R.EditorTitle,group:"navigation",when:C.or(Tr.isEqualTo(Oh.ID),Tr.isEqualTo(Um.ID))}]})}async run(a){let i=a.get(ie),e=i.activeEditorPane;if(e&&(e instanceof Oh||e instanceof Um)){let t=e.input;await i.openEditor({original:{resource:t.original.resource},modified:{resource:t.resource},label:t.getName(),options:{preserveFocus:!1,override:Da.id}})}}});W(class extends z{constructor(){super({id:"notebook.diffEditor.showUnchangedCells",title:P(13734,"Show Unchanged Cells"),icon:L.unfold,precondition:C.and(Tr.isEqualTo(Um.ID),C.has(vfe.key)),menu:{when:C.and(Tr.isEqualTo(Um.ID),C.has(vfe.key),C.equals(drt.key,!0)),id:R.EditorTitle,order:22,group:"navigation"}})}run(a,...i){let e=a.get(ie).activeEditorPane;e&&e instanceof Um&&e.showUnchanged()}});W(class extends z{constructor(){super({id:"notebook.diffEditor.hideUnchangedCells",title:P(13716,"Hide Unchanged Cells"),icon:L.fold,precondition:C.and(Tr.isEqualTo(Um.ID),C.has(vfe.key)),menu:{when:C.and(Tr.isEqualTo(Um.ID),C.has(vfe.key),C.equals(drt.key,!1)),id:R.EditorTitle,order:22,group:"navigation"}})}run(a,...i){let e=a.get(ie).activeEditorPane;e&&e instanceof Um&&e.hideUnchanged()}});W(class extends z{constructor(){super({id:"notebook.diffEditor.2.goToCell",title:P(13715,"Go To Cell"),icon:L.goToFile,menu:{when:C.and(Tr.isEqualTo(Um.ID),C.equals(zQ.key,"Cell"),C.notEquals(KQ.key,"delete")),id:R.MultiDiffEditorFileToolbar,order:0,group:"navigation"}})}async run(i,...e){let t=e[0],o=i.get(ie);o.activeEditorPane instanceof Um&&await o.openEditor({resource:t,options:{selectionRevealType:1}})}});W(class extends z{constructor(){super({id:"notebook.diff.revertMetadata",title:d(13729,null),icon:Hie,f1:!1,menu:{id:R.NotebookDiffDocumentMetadata,when:crt},precondition:crt})}run(a,i){!i||!(a.get(ie).activeEditorPane instanceof Oh)||i.modifiedDocumentTextModel.applyEdits([{editType:5,metadata:i.originalMetadata.metadata}],!0,void 0,()=>{},void 0,!0)}});var WTo=d(13720,null);W(class extends z{constructor(){super({id:"notebook.diffEditor.2.cell.revertInput",title:WTo,icon:Hie,menu:{when:C.and(Tr.isEqualTo(Um.ID),C.equals(zQ.key,"Cell"),C.equals(KQ.key,"modified")),id:R.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ie).activeEditorPane;if(!(o instanceof Um))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof uk){let r=n.modified,s=n.original;if(!s||!r)return;await a.get(Ka).apply([new hl(r.uri,{range:r.textModel.getFullModelRange(),text:s.textModel.getValue()})],{quotableLabel:"Revert Notebook Cell Content Change"})}}});var agn=d(13722,null);W(class extends z{constructor(){super({id:"notebook.diffEditor.2.cell.revertOutputs",title:agn,icon:Hie,f1:!1,menu:{when:C.and(Tr.isEqualTo(Um.ID),C.equals(zQ.key,"Output"),C.equals(KQ.key,"modified")),id:R.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ie).activeEditorPane;if(!(o instanceof Um))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof uk){let r=n.original,s=n.modifiedDocument.cells.findIndex(l=>l.handle===n.modified.handle);if(s===-1)return;n.mainDocumentTextModel.applyEdits([{editType:2,index:s,outputs:r.outputs}],!0,void 0,()=>{},void 0,!0)}}});var VTo=d(13721,null);W(class extends z{constructor(){super({id:"notebook.diffEditor.2.cell.revertMetadata",title:VTo,icon:Hie,f1:!1,menu:{when:C.and(Tr.isEqualTo(Um.ID),C.equals(zQ.key,"Metadata"),C.equals(KQ.key,"modified")),id:R.MultiDiffEditorFileToolbar,order:2,group:"navigation"}})}async run(a,...i){let e=i[0],o=a.get(ie).activeEditorPane;if(!(o instanceof Um))return;let n=o.getDiffElementViewModel(e);if(n&&n instanceof uk){let r=n.original,s=n.modifiedDocument.cells.findIndex(l=>l.handle===n.modified.handle);if(s===-1)return;n.mainDocumentTextModel.applyEdits([{editType:3,index:s,metadata:r.metadata}],!0,void 0,()=>{},void 0,!0)}}});W(class extends z{constructor(){super({id:"notebook.diff.cell.revertMetadata",title:VTo,icon:Hie,f1:!1,menu:{id:R.NotebookDiffCellMetadataTitle,when:ffe},precondition:ffe})}run(a,i){if(!i||!(i instanceof uk))return;let e=i.original,t=i.modified,o=i.mainDocumentTextModel.cells.indexOf(t.textModel);if(o===-1)return;let n=[{editType:3,index:o,metadata:e.metadata}];i.original.language&&i.modified.language!==i.original.language&&n.push({editType:4,index:o,language:i.original.language}),i.modifiedDocument.applyEdits(n,!0,void 0,()=>{},void 0,!0)}});W(class extends z{constructor(){super({id:"notebook.diff.cell.switchOutputRenderingStyleToText",title:d(13723,null),icon:xIo,f1:!1,menu:{id:R.NotebookDiffCellOutputsTitle,when:D2t}})}run(a,i){i&&(i.renderOutput=!i.renderOutput)}});W(class extends z{constructor(){super({id:"notebook.diff.cell.revertOutputs",title:d(13722,null),icon:Hie,f1:!1,menu:{id:R.NotebookDiffCellOutputsTitle,when:ffe},precondition:ffe})}run(a,i){if(!i||!(i instanceof uk))return;let e=i.original,t=i.modified,o=i.mainDocumentTextModel.cells.indexOf(t.textModel);o!==-1&&i.mainDocumentTextModel.applyEdits([{editType:2,index:o,outputs:e.outputs}],!0,void 0,()=>{},void 0,!0)}});W(class extends z{constructor(){super({id:"notebook.toggle.diff.cell.ignoreTrimWhitespace",title:d(13717,null),icon:CIo,f1:!1,menu:{id:R.NotebookDiffCellInputTitle,when:gfe,order:1},precondition:gfe,toggled:C.equals(nMi,!1)})}run(a,i){let e=i;if(!e?.modified)return;let t=e.modified.uri,o=a.get(Gn),n="diffEditor.ignoreTrimWhitespace",r=o.getValue(t,n);o.updateValue(t,n,!r)}});W(class extends z{constructor(){super({id:"notebook.diff.cell.revertInput",title:WTo,icon:Hie,f1:!1,menu:{id:R.NotebookDiffCellInputTitle,when:gfe,order:2},precondition:gfe})}run(a,i){if(!i)return;let e=i.original,t=i.modified;return!e||!t?void 0:a.get(Ka).apply([new hl(t.uri,{range:t.textModel.getFullModelRange(),text:e.textModel.getValue()})],{quotableLabel:"Revert Notebook Cell Content Change"})}});var ejt=class extends z{constructor(e,t,o,n,r,s,l){super({id:e,title:t,precondition:o,menu:[{id:R.EditorTitle,group:"notebook",when:o,order:r}],toggled:n});this.toggleOutputs=s;this.toggleMetadata=l}async run(e){let t=e.get(B);if(this.toggleOutputs!==void 0){let o=t.getValue("notebook.diff.ignoreOutputs");t.updateValue("notebook.diff.ignoreOutputs",!o)}if(this.toggleMetadata!==void 0){let o=t.getValue("notebook.diff.ignoreMetadata");t.updateValue("notebook.diff.ignoreMetadata",!o)}}};W(class extends ejt{constructor(){super("notebook.diff.showOutputs",P(13731,"Show Outputs Differences"),C.or(Tr.isEqualTo(Oh.ID),Tr.isEqualTo(Um.ID)),C.notEquals("config.notebook.diff.ignoreOutputs",!0),2,!0,void 0)}});W(class extends ejt{constructor(){super("notebook.diff.showMetadata",P(13730,"Show Metadata Differences"),C.or(Tr.isEqualTo(Oh.ID),Tr.isEqualTo(Um.ID)),C.notEquals("config.notebook.diff.ignoreMetadata",!0),1,void 0,!0)}});W(class extends z{constructor(){super({id:"notebook.diff.action.previous",title:d(13719,null),icon:EIo,f1:!1,keybinding:{primary:1597,weight:200,when:Tr.isEqualTo(Oh.ID)},menu:{id:R.EditorTitle,group:"navigation",when:Tr.isEqualTo(Oh.ID)}})}run(a){let i=a.get(ie);if(i.activeEditorPane?.getId()!==oZ)return;i.activeEditorPane.getControl()?.previousChange()}});W(class extends z{constructor(){super({id:"notebook.diff.action.next",title:d(13718,null),icon:TIo,f1:!1,keybinding:{primary:573,weight:200,when:Tr.isEqualTo(Oh.ID)},menu:{id:R.EditorTitle,group:"navigation",when:Tr.isEqualTo(Oh.ID)}})}run(a){let i=a.get(ie);if(i.activeEditorPane?.getId()!==oZ)return;i.activeEditorPane.getControl()?.nextChange()}});W(class extends z{constructor(){super({id:"notebook.diff.inline.toggle",title:d(13727,null),menu:{id:R.EditorTitle,group:"1_diff",order:10,when:C.and(Tr.isEqualTo(Oh.ID),C.equals("config.notebook.diff.experimental.toggleInline",!0),Cb.negate(),EP.negate())}})}run(a){let i=a.get(ie);if(i.activeEditorPane?.getId()!==oZ)return;i.activeEditorPane.getControl()?.toggleInlineView()}});oe.as($t.Configuration).registerConfiguration({id:"notebook",order:100,type:"object",properties:{"notebook.diff.ignoreMetadata":{type:"boolean",default:!1,markdownDescription:d(13725,null)},"notebook.diff.ignoreOutputs":{type:"boolean",default:!1,markdownDescription:d(13726,null)},"notebook.diff.experimental.toggleInline":{type:"boolean",default:typeof $i.quality=="string"&&$i.quality!=="stable",markdownDescription:d(13733,null)}}});var CVe=class extends k{constructor(e,t,o,n){super();this._instantiationService=e;this._logService=t;this._notebookService=o;this._accessibilitySignalService=n;this._executions=new dt;this._notebookExecutions=new dt;this._notebookListeners=new dt;this._cellListeners=new dt;this._lastFailedCells=new dt;this._lastCompletedCellHandles=new dt;this._onDidChangeExecution=this._register(new T);this.onDidChangeExecution=this._onDidChangeExecution.event;this._onDidChangeLastRunFailState=this._register(new T);this.onDidChangeLastRunFailState=this._onDidChangeLastRunFailState.event}getLastFailedCellForNotebook(e){let t=this._lastFailedCells.get(e);return t?.visible?t.cellHandle:void 0}getLastCompletedCellForNotebook(e){return this._lastCompletedCellHandles.get(e)}forceCancelNotebookExecutions(e){let t=this._executions.get(e);if(t)for(let o of t.values())this._onCellExecutionDidComplete(e,o.cellHandle,o);this._notebookExecutions.has(e)&&this._onExecutionDidComplete(e)}getCellExecution(e){let t=sn.parse(e);if(!t)throw new Error(`Not a cell URI: ${e}`);let o=this._executions.get(t.notebook);if(o)return o.get(t.handle)}getExecution(e){return this._notebookExecutions.get(e)?.[0]}getCellExecutionsForNotebook(e){let t=this._executions.get(e);return t?Array.from(t.values()):[]}getCellExecutionsByHandleForNotebook(e){let t=this._executions.get(e);return t?new Map(t.entries()):void 0}_onCellExecutionDidChange(e,t,o){this._onDidChangeExecution.fire(new Yat(e,t,o))}_onCellExecutionDidComplete(e,t,o,n){let r=this._executions.get(e);if(!r){this._logService.debug(`NotebookExecutionStateService#_onCellExecutionDidComplete - unknown notebook ${e.toString()}`);return}o.dispose();let s=sn.generate(e,t);this._cellListeners.get(s)?.dispose(),this._cellListeners.delete(s),r.delete(t),r.size===0&&(this._executions.delete(e),this._notebookListeners.get(e)?.dispose(),this._notebookListeners.delete(e)),n!==void 0&&(n?(this._executions.size===0&&this._accessibilitySignalService.playSignal(tn.notebookCellCompleted),this._clearLastFailedCell(e)):(this._accessibilitySignalService.playSignal(tn.notebookCellFailed),this._setLastFailedCell(e,t)),this._lastCompletedCellHandles.set(e,t)),this._onDidChangeExecution.fire(new Yat(e,t))}_onExecutionDidChange(e,t){this._onDidChangeExecution.fire(new Xat(e,t))}_onExecutionDidComplete(e){let t=this._notebookExecutions.get(e);if(!Array.isArray(t)){this._logService.debug(`NotebookExecutionStateService#_onCellExecutionDidComplete - unknown notebook ${e.toString()}`);return}this._notebookExecutions.delete(e),this._onDidChangeExecution.fire(new Xat(e)),t.forEach(o=>o.dispose())}createCellExecution(e,t){let o=this._notebookService.getNotebookTextModel(e);if(!o)throw new Error(`Notebook not found: ${e.toString()}`);let n=this._executions.get(e);if(!n){let s=this._instantiationService.createInstance(xVe,e);this._notebookListeners.set(e,s),n=new Map,this._executions.set(e,n)}let r=n.get(t);return r||(r=this._createNotebookCellExecution(o,t),n.set(t,r),r.initialize(),this._onDidChangeExecution.fire(new Yat(e,t,r))),r}createExecution(e){let t=this._notebookService.getNotebookTextModel(e);if(!t)throw new Error(`Notebook not found: ${e.toString()}`);if(!this._notebookListeners.has(e)){let n=this._instantiationService.createInstance(xVe,e);this._notebookListeners.set(e,n)}let o=this._notebookExecutions.get(e);return o||(o=this._createNotebookExecution(t),this._notebookExecutions.set(e,o),this._onDidChangeExecution.fire(new Xat(e,o[0]))),o[0]}_createNotebookCellExecution(e,t){let o=e.uri,n=this._instantiationService.createInstance(jat,t,e),r=Fn(n.onDidUpdate(()=>this._onCellExecutionDidChange(o,t,n)),n.onDidComplete(s=>this._onCellExecutionDidComplete(o,t,n,s)));return this._cellListeners.set(sn.generate(o,t),r),n}_createNotebookExecution(e){let t=e.uri,o=this._instantiationService.createInstance(Qat,e),n=Fn(o.onDidUpdate(()=>this._onExecutionDidChange(t,o)),o.onDidComplete(()=>this._onExecutionDidComplete(t)));return[o,n]}_setLastFailedCell(e,t){let o=this._lastFailedCells.get(e),n=this._notebookService.getNotebookTextModel(e);if(!n)return;let r={cellHandle:t,disposable:o?o.disposable:this._getFailedCellListener(n),visible:!0};this._lastFailedCells.set(e,r),this._onDidChangeLastRunFailState.fire({visible:!0,notebook:e})}_setLastFailedCellVisibility(e,t){let o=this._lastFailedCells.get(e);o&&this._lastFailedCells.set(e,{cellHandle:o.cellHandle,disposable:o.disposable,visible:t}),this._onDidChangeLastRunFailState.fire({visible:t,notebook:e})}_clearLastFailedCell(e){let t=this._lastFailedCells.get(e);t&&(t.disposable?.dispose(),this._lastFailedCells.delete(e)),this._onDidChangeLastRunFailState.fire({visible:!1,notebook:e})}_getFailedCellListener(e){return e.onWillAddRemoveCells(t=>{let o=this._lastFailedCells.get(e.uri)?.cellHandle;if(o!==void 0){let n=e.cells.findIndex(r=>r.handle===o);t.rawEvent.changes.forEach(([r,s,l])=>{s&&n>=r&&n<r+s&&this._setLastFailedCellVisibility(e.uri,!1),l.some(c=>c.handle===o)&&this._setLastFailedCellVisibility(e.uri,!0)})}})}dispose(){super.dispose(),this._executions.forEach(e=>{e.forEach(t=>t.dispose()),e.clear()}),this._executions.clear(),this._notebookExecutions.forEach(e=>{e.forEach(t=>t.dispose())}),this._notebookExecutions.clear(),this._cellListeners.forEach(e=>e.dispose()),this._notebookListeners.forEach(e=>e.dispose()),this._lastFailedCells.forEach(e=>e.disposable.dispose())}};CVe=I([m(0,F),m(1,re),m(2,kn),m(3,br)],CVe);var Yat=class{constructor(i,e,t){this.notebook=i;this.cellHandle=e;this.changed=t;this.type=0}affectsCell(i){let e=sn.parse(i);return!!e&&ze(this.notebook,e.notebook)&&this.cellHandle===e.handle}affectsNotebook(i){return ze(this.notebook,i)}},Xat=class{constructor(i,e){this.notebook=i;this.changed=e;this.type=1}affectsNotebook(i){return ze(this.notebook,i)}},xVe=class extends k{constructor(e,t,o,n,r,s){super();this._notebookService=t;this._notebookKernelService=o;this._notebookExecutionService=n;this._notebookExecutionStateService=r;this._logService=s;this._logService.debug(`NotebookExecution#ctor ${e.toString()}`);let l=this._notebookService.getNotebookTextModel(e);if(!l)throw new Error("Notebook not found: "+e);this._notebookModel=l,this._register(this._notebookModel.onWillAddRemoveCells(c=>this.onWillAddRemoveCells(c))),this._register(this._notebookModel.onWillDispose(()=>this.onWillDisposeDocument()))}cancelAll(){this._logService.debug("NotebookExecutionListeners#cancelAll");let e=this._notebookExecutionStateService.getCellExecutionsForNotebook(this._notebookModel.uri);this._notebookExecutionService.cancelNotebookCellHandles(this._notebookModel,e.map(t=>t.cellHandle))}onWillDisposeDocument(){this._logService.debug("NotebookExecution#onWillDisposeDocument"),this.cancelAll()}onWillAddRemoveCells(e){let t=this._notebookExecutionStateService.getCellExecutionsByHandleForNotebook(this._notebookModel.uri),o=new Set,n=new Set;if(t&&e.rawEvent.changes.forEach(([r,s])=>{s&&this._notebookModel.cells.slice(r,r+s).map(c=>c.handle).forEach(c=>{let u=t.get(c);u?.state===3?o.add(c):u&&n.add(c)})}),o.size||n.size){let r=this._notebookKernelService.getSelectedOrSuggestedKernel(this._notebookModel);if(r){let l=r.implementsInterrupt?[...o]:[...o,...n];this._logService.debug(`NotebookExecution#onWillAddRemoveCells, ${JSON.stringify([...l])}`),l.length&&r.cancelNotebookCellExecution(this._notebookModel.uri,l)}}}};xVe=I([m(1,kn),m(2,Ql),m(3,LZ),m(4,Ns),m(5,re)],xVe);function lgn(a,i){if(a.editType===1)return{editType:2,handle:a.cellHandle,append:a.append,outputs:a.outputs};if(a.editType===2)return{editType:7,items:a.items,append:a.append,outputId:a.outputId};if(a.editType===3){let e={};return typeof a.executionOrder<"u"&&(e.executionOrder=a.executionOrder),typeof a.runStartTime<"u"&&(e.runStartTime=a.runStartTime),{editType:9,handle:i,internalMetadata:e}}throw new Error("Unknown cell update type")}var jat=class extends k{constructor(e,t,o){super();this.cellHandle=e;this._notebookModel=t;this._logService=o;this._onDidUpdate=this._register(new T);this.onDidUpdate=this._onDidUpdate.event;this._onDidComplete=this._register(new T);this.onDidComplete=this._onDidComplete.event;this._state=1;this._didPause=!1;this._isPaused=!1;this._logService.debug(`CellExecution#ctor ${this.getCellLog()}`)}get state(){return this._state}get notebook(){return this._notebookModel.uri}get didPause(){return this._didPause}get isPaused(){return this._isPaused}initialize(){let e={editType:9,handle:this.cellHandle,internalMetadata:{executionId:ht(),runStartTime:null,runEndTime:null,lastRunSuccess:null,executionOrder:null,renderDuration:null}};this._applyExecutionEdits([e])}getCellLog(){return`${this._notebookModel.uri.toString()}, ${this.cellHandle}`}logUpdates(e){let t=e.map(o=>UYe[o.editType]).join(", ");this._logService.debug(`CellExecution#updateExecution ${this.getCellLog()}, [${t}]`)}confirm(){this._logService.debug(`CellExecution#confirm ${this.getCellLog()}`),this._state=2,this._onDidUpdate.fire()}update(e){this.logUpdates(e),e.some(n=>n.editType===3)&&(this._state=3),!this._didPause&&e.some(n=>n.editType===3&&n.didPause)&&(this._didPause=!0);let t=[...e].reverse().find(n=>n.editType===3&&typeof n.isPaused=="boolean");if(t&&(this._isPaused=t.isPaused),!this._notebookModel.cells.find(n=>n.handle===this.cellHandle))this._logService.debug(`CellExecution#update, updating cell not in notebook: ${this._notebookModel.uri.toString()}, ${this.cellHandle}`);else{let n=e.map(r=>lgn(r,this.cellHandle));this._applyExecutionEdits(n)}e.some(n=>n.editType===3)&&this._onDidUpdate.fire()}complete(e){let t=this._notebookModel.cells.find(o=>o.handle===this.cellHandle);if(!t)this._logService.debug(`CellExecution#complete, completing cell not in notebook: ${this._notebookModel.uri.toString()}, ${this.cellHandle}`);else{let o={editType:9,handle:this.cellHandle,internalMetadata:{lastRunSuccess:e.lastRunSuccess,runStartTime:this._didPause?null:t.internalMetadata.runStartTime,runEndTime:this._didPause?null:e.runEndTime,error:e.error}};this._applyExecutionEdits([o])}this._onDidComplete.fire(e.lastRunSuccess)}_applyExecutionEdits(e){this._notebookModel.applyEdits(e,!0,void 0,()=>{},void 0,!1)}};jat=I([m(2,re)],jat);var Qat=class extends k{constructor(e,t){super();this._notebookModel=e;this._logService=t;this._onDidUpdate=this._register(new T);this.onDidUpdate=this._onDidUpdate.event;this._onDidComplete=this._register(new T);this.onDidComplete=this._onDidComplete.event;this._state=1;this._logService.debug("NotebookExecution#ctor")}get state(){return this._state}get notebook(){return this._notebookModel.uri}debug(e){this._logService.debug(`${e} ${this._notebookModel.uri.toString()}`)}confirm(){this.debug("Execution#confirm"),this._state=2,this._onDidUpdate.fire()}begin(){this.debug("Execution#begin"),this._state=3,this._onDidUpdate.fire()}complete(){this.debug("Execution#begin"),this._state=1,this._onDidComplete.fire()}};Qat=I([m(1,re)],Qat);var kVe=class{constructor(i,e,t,o,n,r){this._commandService=i;this._notebookKernelService=e;this._notebookKernelHistoryService=t;this._workspaceTrustRequestService=o;this._logService=n;this._notebookExecutionStateService=r;this.cellExecutionParticipants=new Set}async executeNotebookCells(i,e,t){let o=Array.from(e).filter(u=>u.cellKind===2);if(!o.length)return;this._logService.debug("Execution",`${JSON.stringify(o.map(u=>u.handle))}`);let n=d(13923,null);if(!await this._workspaceTrustRequestService.requestWorkspaceTrust({message:n}))return;let s=[];for(let u of o)this._notebookExecutionStateService.getCellExecution(u.uri)||s.push([u,this._notebookExecutionStateService.createCellExecution(i.uri,u.handle)]);let l=await xQ.resolveKernel(i,this._notebookKernelService,this._notebookKernelHistoryService,this._commandService);if(!l){s.forEach(u=>u[1].complete({}));return}this._notebookKernelHistoryService.addMostRecentKernel(l);let c=[];for(let[u,p]of s)l.supportedLanguages.includes(u.language)?c.push(p):p.complete({});if(c.length>0){await this.runExecutionParticipants(c),this._notebookKernelService.selectKernelForNotebook(l,i),await l.executeNotebookCellsRequest(i.uri,c.map(p=>p.cellHandle));let u=c.filter(p=>p.state===1);u.length&&(this._logService.debug("Execution",`Completing unconfirmed executions ${JSON.stringify(u.map(p=>p.cellHandle))}`),u.forEach(p=>p.complete({}))),this._logService.debug("Execution",`Completed executions ${JSON.stringify(c.map(p=>p.cellHandle))}`)}}async cancelNotebookCellHandles(i,e){let t=Array.from(e);this._logService.debug("Execution",`CancelNotebookCellHandles ${JSON.stringify(t)}`);let o=this._notebookKernelService.getSelectedOrSuggestedKernel(i);o&&await o.cancelNotebookCellExecution(i.uri,t)}async cancelNotebookCells(i,e){this.cancelNotebookCellHandles(i,Array.from(e,t=>t.handle))}registerExecutionParticipant(i){return this.cellExecutionParticipants.add(i),ee(()=>this.cellExecutionParticipants.delete(i))}async runExecutionParticipants(i){for(let e of this.cellExecutionParticipants)await e.onWillExecuteCell(i)}dispose(){this._activeProxyKernelExecutionToken?.dispose(!0)}};kVe=I([m(0,fe),m(1,Ql),m(2,XM),m(3,lp),m(4,Sb),m(5,Ns)],kVe);var BTo=le("notebookKeymapService");var EVe=class extends k{constructor(e,t,o,n,r){super();this.instantiationService=e;this.extensionEnablementService=t;this.tipsService=o;this.notificationService=r;this._register(n.onDidShutdown(()=>this.dispose())),this._register(e.invokeFunction(cgn)((s=>{Promise.all(s.map(l=>this.checkForOtherKeymaps(l))).then(void 0,mt)})))}checkForOtherKeymaps(e){return this.instantiationService.invokeFunction(DOi).then(t=>{let o=t.filter(r=>dgn(this.tipsService,r)),n=o.find(r=>Ht(r.identifier,e));if(n&&n.globallyEnabled){let r=o.filter(s=>!Ht(s.identifier,e)&&s.globallyEnabled);if(r.length)return this.promptForDisablingOtherKeymaps(n,r)}})}promptForDisablingOtherKeymaps(e,t){let o=n=>{n&&this.extensionEnablementService.setEnablement(t.map(r=>r.local),10)};this.notificationService.prompt(ft.Info,d(11898,null,t.map(n=>`'${n.local.manifest.displayName}'`).join(", ")),[{label:d(11900,null),run:()=>o(!0)},{label:d(11899,null),run:()=>o(!1)}])}};EVe=I([m(0,F),m(1,As),m(2,AR),m(3,to),m(4,Ne)],EVe);function cgn(a){let i=a.get(xs),e=a.get(As),t=U.chain(i.onDidInstallExtensions,o=>o.filter(n=>n.some(({operation:r})=>r===2)).map(n=>n.map(({identifier:r})=>r)));return U.debounce(U.any(U.any(t,U.map(i.onDidUninstallExtension,o=>[o.identifier])),U.map(e.onEnablementChanged,o=>o.map(n=>n.identifier))),(o,n)=>{o=o||[];for(let r of n)o.some(s=>!Ht(s,r))&&o.push(r);return o})}async function DOi(a){let i=a.get(xs),e=a.get(As);return(await i.getInstalled()).map(o=>({identifier:o.identifier,local:o,globallyEnabled:e.isEnabled(o)}))}function dgn(a,i){let e=i.local.manifest.categories;return e&&e.indexOf("Keymaps")!==-1||a.getKeymapRecommendations().some(t=>Ht({id:t},i.local.identifier))}function ugn(a){let i=a.get(xs),e=a.get(As),t=U.chain(i.onDidInstallExtensions,o=>o.filter(n=>n.some(({operation:r})=>r===2)).map(n=>n.map(({identifier:r})=>r)));return U.debounce(U.any(U.any(t,U.map(i.onDidUninstallExtension,o=>[o.identifier])),U.map(e.onEnablementChanged,o=>o.map(n=>n.identifier))),(o,n)=>{o=o||(n.length?[n[0]]:[]);for(let r of n)o.some(s=>!Ht(s,r))&&o.push(r);return o})}var pgn="hasRecommendedKeymap",TVe=class extends k{constructor(e,t,o,n,r){super();this.instantiationService=e;this.extensionEnablementService=t;this.notificationService=o;this.notebookKeymapMemento=new $l("notebookKeymap",n),this.notebookKeymap=this.notebookKeymapMemento.getMemento(0,0),this._register(r.onDidShutdown(()=>this.dispose())),this._register(this.instantiationService.invokeFunction(ugn)((s=>{Promise.all(s.map(l=>this.checkForOtherKeymaps(l))).then(void 0,mt)})))}checkForOtherKeymaps(e){return this.instantiationService.invokeFunction(DOi).then(t=>{let o=t.filter(r=>mgn(r)),n=o.find(r=>Ht(r.identifier,e));if(n&&n.globallyEnabled){this.notebookKeymap[pgn]=!0,this.notebookKeymapMemento.saveMemento();let r=o.filter(s=>!Ht(s.identifier,e)&&s.globallyEnabled);if(r.length)return this.promptForDisablingOtherKeymaps(n,r)}})}promptForDisablingOtherKeymaps(e,t){let o=n=>{n&&this.extensionEnablementService.setEnablement(t.map(r=>r.local),10)};this.notificationService.prompt(ft.Info,d(13925,null,jo(t.map(n=>n.local.manifest.displayName)).map(n=>`'${n}'`).join(", ")),[{label:d(13927,null),run:()=>o(!0)},{label:d(13926,null),run:()=>o(!1)}])}};TVe=I([m(0,F),m(1,As),m(2,Ne),m(3,de),m(4,to)],TVe);function mgn(a){if(a.local.manifest.extensionPack)return!1;let i=a.local.manifest.keywords;return i?i.indexOf("notebook-keymap")!==-1:!1}var HTo=5,h1=class extends k{constructor(e,t,o){super();this._storageService=e;this._notebookKernelService=t;this._notebookLoggingService=o;this._mostRecentKernelsMap={};this._loadState(),this._register(this._storageService.onWillSaveState(()=>this._saveState())),this._register(this._storageService.onDidChangeValue(1,h1.STORAGE_KEY,this._store)(()=>{this._loadState()}))}static{this.STORAGE_KEY="notebook.kernelHistory"}getKernels(e){let t=this._notebookKernelService.getMatchingKernel(e),o=t.all,n=t.selected,r=t.all.length===1?t.all[0]:void 0;this._notebookLoggingService.debug("History",`getMatchingKernels: ${t.all.length} kernels available for ${e.uri.path}. Selected: ${t.selected?.label}. Suggested: ${r?.label}`);let s=this._mostRecentKernelsMap[e.notebookType]?[...this._mostRecentKernelsMap[e.notebookType].values()]:[],l=s.map(c=>o.find(u=>u.id===c)).filter(c=>!!c);return this._notebookLoggingService.debug("History",`mru: ${s.length} kernels in history, ${l.length} registered already.`),{selected:n??r,all:l}}addMostRecentKernel(e){let t=e.id,o=e.viewType,n=this._mostRecentKernelsMap[o]??new uz;if(n.set(t,t,1),n.size>HTo){let r=[...n.entries()].slice(0,HTo);n.fromJSON(r)}this._mostRecentKernelsMap[o]=n}_saveState(){let e=!1;for(let[t,o]of Object.entries(this._mostRecentKernelsMap))e=e||o.size>0;if(e){let t=this._serialize();this._storageService.store(h1.STORAGE_KEY,JSON.stringify(t),1,0)}else this._storageService.remove(h1.STORAGE_KEY,1)}_loadState(){let e=this._storageService.get(h1.STORAGE_KEY,1);if(e)try{this._deserialize(JSON.parse(e))}catch{this._mostRecentKernelsMap={}}else this._mostRecentKernelsMap={}}_serialize(){let e=Object.create(null);for(let[t,o]of Object.entries(this._mostRecentKernelsMap))e[t]={entries:[...o.values()]};return e}_deserialize(e){this._mostRecentKernelsMap={};for(let[t,o]of Object.entries(e)){let n=new uz,r=[];for(let s of o.entries)r.push([s,s]);n.fromJSON(r),this._mostRecentKernelsMap[t]=n}}_clear(){this._mostRecentKernelsMap={},this._saveState()}};h1=I([m(0,de),m(1,Ql),m(2,Sb)],h1);W(class extends z{constructor(){super({id:"notebook.clearNotebookKernelsMRUCache",title:P(13924,"Clear Notebook Kernels MRU Cache"),category:Fe.Developer,f1:!0})}async run(a){a.get(XM)._clear()}});var hgn="notebook.rendering",_Ve=class extends k{static{this.ID="notebook"}constructor(i){super(),this._logger=this._register(i.createLogger(hgn,{name:d(13928,null),group:eP}))}trace(i,e){this._logger.trace(`[${i}] ${e}`)}debug(i,e){this._logger.debug(`[${i}] ${e}`)}info(i,e){this._logger.info(`[${i}] ${e}`)}warn(i,e){this._logger.warn(`[${i}] ${e}`)}error(i,e){this._logger.error(`[${i}] ${e}`)}};_Ve=I([m(0,Ol)],_Ve);var tjt=class{constructor(i){this.notebookKernelService=i;this.cancellationTokenSource=new qe}hasChildren(i){return i.kind==="root"||i.hasNamedChildren||i.indexedChildrenCount>0}cancel(){this.cancellationTokenSource.cancel(),this.cancellationTokenSource.dispose(),this.cancellationTokenSource=new qe}async getChildren(i){return i.kind==="empty"?[]:i.kind==="root"?this.getRootVariables(i.notebook):this.getVariables(i)}async getVariables(i){let e=this.notebookKernelService.getMatchingKernel(i.notebook).selected;if(e&&e.hasVariableProvider){let t=[];if(i.hasNamedChildren){let o=e.provideVariables(i.notebook.uri,i.extHostId,"named",0,this.cancellationTokenSource.token);for await(let n of o)t.push(this.createVariableElement(n,i.notebook))}if(i.indexedChildrenCount>0){let o=await this.getIndexedChildren(i,e);t=t.concat(o)}return t}return[]}async getIndexedChildren(i,e){let t=[];if(i.indexedChildrenCount>a0t){let o=Math.floor(Math.max(i.indexedChildrenCount/a0t,100)),n=1e6,r=i.indexStart??0,s=r+Math.min(i.indexedChildrenCount,n);for(;r<s;r+=o){let l=r+o;l>s&&(l=s),t.push({kind:"variable",notebook:i.notebook,id:i.id+`${r}`,extHostId:i.extHostId,name:`[${r}..${l-1}]`,value:"",indexedChildrenCount:l-r,indexStart:r,hasNamedChildren:!1})}i.indexedChildrenCount>n&&t.push({kind:"variable",notebook:i.notebook,id:i.id+`${s+1}`,extHostId:i.extHostId,name:d(13554,null),value:"",indexedChildrenCount:0,hasNamedChildren:!1})}else if(i.indexedChildrenCount>0){let o=e.provideVariables(i.notebook.uri,i.extHostId,"indexed",i.indexStart??0,this.cancellationTokenSource.token);for await(let n of o)if(t.push(this.createVariableElement(n,i.notebook)),t.length>=a0t)break}return t}async getRootVariables(i){let e=this.notebookKernelService.getMatchingKernel(i).selected;if(e&&e.hasVariableProvider){let t=e.provideVariables(i.uri,void 0,"named",0,this.cancellationTokenSource.token),o=[];for await(let n of t)o.push(this.createVariableElement(n,i));return o}return[]}createVariableElement(i,e){return{...i,kind:"variable",notebook:e,extHostId:i.id,id:`${i.id}`}}};var ROi=_,ggn=1024,njt=P(13555,"Notebook Variables"),LOi=P(13556,"REPL Variables");var ijt=class{getHeight(i){return 22}getTemplateId(i){return F6.ID}},F6=class{static{this.ID="variableElement"}get templateId(){return F6.ID}constructor(i){this.expressionRenderer=i.createInstance(PP)}renderTemplate(i){let e=D(i,ROi(".expression")),t=D(e,ROi("span.name")),o=D(e,ROi("span.value"));return{expression:e,name:t,value:o,elementDisposables:new O}}renderElement(i,e,t){let o=i.element.value.trim()!==""?`${i.element.name}:`:i.element.name;t.name.textContent=o,t.name.title=i.element.type??"",t.elementDisposables.add(this.expressionRenderer.renderValue(t.value,i.element,{colorize:!0,maxValueLength:ggn,session:void 0}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose()}};F6=I([m(0,F)],F6);var ojt=class{constructor(){this._widgetAriaLabel=De("widgetAriaLabel",njt.value)}getWidgetAriaLabel(){return this._widgetAriaLabel}updateWidgetAriaLabel(i){this._widgetAriaLabel.set(i,void 0)}getAriaLabel(i){return d(13557,null,i.name,i.value)}};var DVe=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,r,s,c,l,p,u,h,v,b);this.editorService=t;this.notebookKernelService=o;this.notebookExecutionStateService=n;this.quickInputService=g;this.commandService=f;this.menuService=S;this._register(this.editorService.onDidActiveEditorChange(()=>this.handleActiveEditorChange())),this._register(this.notebookKernelService.onDidNotebookVariablesUpdate(this.handleVariablesChanged.bind(this))),this._register(this.notebookExecutionStateService.onDidChangeExecution(this.handleExecutionStateChange.bind(this))),this._register(this.editorService.onDidCloseEditor(y=>this.handleCloseEditor(y))),this.accessibilityProvider=new ojt,this.handleActiveEditorChange(!1),this.dataSource=new tjt(this.notebookKernelService),this.updateScheduler=this._register(new Dt(()=>this.tree?.updateChildren(),100))}static{this.ID="notebookVariablesView"}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),this.tree=this.instantiationService.createInstance(Rp,"notebookVariablesTree",e,new ijt,[this.instantiationService.createInstance(F6)],this.dataSource,{accessibilityProvider:this.accessibilityProvider,identityProvider:{getId:t=>t.id}}),this.tree.layout(),this.activeNotebook&&this.tree.setInput({kind:"root",notebook:this.activeNotebook}),this._register(this.tree.onContextMenu(t=>this.onContextMenu(t)))}onContextMenu(e){if(!e.element)return;let t=e.element,o={source:t.notebook.uri.toString(),name:t.name,value:t.value,type:t.type,expression:t.expression,language:t.language,extensionId:t.extensionId},n=this.contextKeyService.createOverlay([[RAt.key,t.name],[RDe.key,t.value],[QZ.key,t.type],[Plo.key,t.interfaces],[Alo.key,t.language],[Nlo.key,t.extensionId]]),r=this.menuService.getMenuActions(R.NotebookVariablesContext,n,{arg:o,shouldForwardArgs:!0}),s=Lu(r);this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s})}focus(){super.focus(),this.tree?.domFocus()}layoutBody(e,t){super.layoutBody(e,t),this.tree?.layout(e,t)}setActiveNotebook(e,t,o=!0){this.activeNotebook=e,S3(t.input)?(this.updateTitle(LOi.value),this.accessibilityProvider.updateWidgetAriaLabel(LOi.value)):(this.updateTitle(njt.value),this.accessibilityProvider.updateWidgetAriaLabel(njt.value)),o&&(this.tree?.setInput({kind:"root",notebook:e}),this.updateScheduler.schedule())}getActiveNotebook(){let e=this.editorService.activeEditorPane,t=lr(e)?.textModel;return t&&e?{notebookDocument:t,notebookEditor:e}:void 0}handleCloseEditor(e){e.editor.resource&&e.editor.resource.toString()===this.activeNotebook?.uri.toString()&&(this.tree?.setInput({kind:"empty"}),this.updateScheduler.schedule())}handleActiveEditorChange(e=!0){let t=this.getActiveNotebook();t&&t.notebookDocument!==this.activeNotebook&&this.setActiveNotebook(t.notebookDocument,t.notebookEditor,e)}handleExecutionStateChange(e){this.activeNotebook&&e.affectsNotebook(this.activeNotebook.uri)?(this.dataSource.cancel(),e.changed===void 0?this.updateScheduler.schedule():this.updateScheduler.cancel()):this.getActiveNotebook()||this.editorService.visibleEditorPanes.forEach(t=>{let o=lr(t)?.textModel;o&&e.affectsNotebook(o.uri)&&this.setActiveNotebook(o,t)})}handleVariablesChanged(e){this.activeNotebook&&e.toString()===this.activeNotebook.uri.toString()?this.updateScheduler.schedule():this.getActiveNotebook()||this.editorService.visibleEditorPanes.forEach(t=>{let o=lr(t)?.textModel;o&&o.uri.toString()===e.toString()&&this.setActiveNotebook(o,t)})}};DVe=I([m(1,ie),m(2,Ql),m(3,Ns),m(4,Le),m(5,Xe),m(6,X),m(7,B),m(8,F),m(9,ji),m(10,Je),m(11,$e),m(12,fe),m(13,Pe),m(14,ot),m(15,Yt)],DVe);var RVe=class extends k{constructor(e,t,o,n,r,s,l){super();this.configurationService=t;this.editorService=o;this.notebookExecutionStateService=n;this.notebookKernelService=r;this.notebookDocumentService=s;this.viewDescriptorService=l;this.listeners=[];this.initialized=!1;this.viewEnabled=Ave.bindTo(e),this.listeners.push(this.editorService.onDidActiveEditorChange(()=>this.handleInitEvent())),this.listeners.push(this.notebookExecutionStateService.onDidChangeExecution(c=>this.handleInitEvent(c.notebook))),this.configListener=t.onDidChangeConfiguration(c=>this.handleConfigChange(c))}handleConfigChange(e){e.affectsConfiguration(Ct.notebookVariablesView)&&this.handleInitEvent()}handleInitEvent(e){(this.editorService.activeEditorPane?.getId()==="workbench.editor.repl"||this.configurationService.getValue(Ct.notebookVariablesView)||this.configurationService.getValue("notebook.experimental.variablesView"))&&(e||this.editorService.activeEditorPane?.getId()==="workbench.editor.notebook")&&this.hasVariableProvider(e)&&!this.initialized&&this.initializeView()&&(this.viewEnabled.set(!0),this.initialized=!0,this.listeners.forEach(o=>o.dispose()))}hasVariableProvider(e){let t=e?this.notebookDocumentService.getNotebookTextModel(e):lr(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;return t&&this.notebookKernelService.getMatchingKernel(t).selected?.hasVariableProvider}initializeView(){let e=this.viewDescriptorService.getViewContainerById($g);if(e){let t=oe.as(Kn.ViewsRegistry),o={id:"workbench.notebook.variables",name:P(13553,"Notebook Variables"),containerIcon:OKt,ctorDescriptor:new Vt(DVe),order:50,weight:5,canToggleVisibility:!0,canMoveView:!0,collapsed:!1,when:Ave};return t.registerViews([o],e),!0}return!1}dispose(){super.dispose(),this.listeners.forEach(e=>e.dispose()),this.configListener.dispose()}};RVe=I([m(0,X),m(1,B),m(2,ie),m(3,Ns),m(4,Ql),m(5,kn),m(6,ji)],RVe);var rjt=class{constructor(){this.priority=105;this.name="notebook";this.when=C.and(wr,aI.negate());this.type="help"}getProvider(i){let e=i.get(Qt).getActiveCodeEditor()||i.get(Qt).getFocusedCodeEditor()||i.get(ie).activeEditorPane;if(e)return vgn(i,e)}};function fgn(){return[d(13822,null),d(13813,null,"<keybinding:notebook.cell.edit>"),d(13817,null,"<keybinding:notebook.cell.quitEdit>"),d(13815,null,"<keybinding:notebook.cell.focusInOutput>"),d(13820,null,"<keybinding:notebook.focusNextEditor>"),d(13821,null,"<keybinding:notebook.focusPreviousEditor>"),d(13818,null),d(13814,null,"<keybinding:notebook.cell.executeAndFocusContainer>"),d(13816,null,"<keybinding:notebook.cell.insertCodeCellAbove>","<keybinding:notebook.cell.insertCodeCellBelow>"),d(13819,null)].join(`
`)}function vgn(a,i){let e=fgn();return new qp("notebook",{type:"help"},()=>e,()=>i.focus(),"accessibility.verbosity.notebook")}var sjt=class{constructor(){this.priority=100;this.name="notebook";this.type="view";this.when=C.and(Ap,Wg.toNegated())}getProvider(i){let e=i.get(ie);return bgn(e)}};function bgn(a){let i=a.activeEditorPane,e=lr(i),t=e?.getViewModel(),o=t?.getSelections(),n=t?.notebookDocument;if(!o||!n||!e?.textModel)return;let r=t.viewCells[o[0].start],s=iOe(n,r);if(s)return new qp("notebook",{type:"view"},()=>s,()=>{e?.setFocus(o[0]),e.focus()},"accessibility.verbosity.notebook")}var gh=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._extensionService=e;this._extensionEnablementService=t;this._configService=o;this._notificationService=n;this._dialogService=r;this._quickInputService=s;this._languageService=l;this._languageFeaturesService=c;this._languageStatusService=u;this._editorService=p;this._languageStatusStore=this._store.add(new O);this._store.add(this._extensionService.onDidChangeExtensions(this._updateConfigValues,this)),this._store.add(xue.setFormatterSelector((h,g,f,v)=>this._selectFormatter(h,g,f,v))),this._store.add(p.onDidActiveEditorChange(this._updateStatus,this)),this._store.add(c.documentFormattingEditProvider.onDidChange(this._updateStatus,this)),this._store.add(c.documentRangeFormattingEditProvider.onDidChange(this._updateStatus,this)),this._store.add(c.documentFormattingEditProvider.onDidChange(this._updateConfigValues,this)),this._store.add(c.documentRangeFormattingEditProvider.onDidChange(this._updateConfigValues,this)),this._store.add(o.onDidChangeConfiguration(h=>h.affectsConfiguration(gh.configName)&&this._updateStatus())),this._updateConfigValues()}static{this.configName="editor.defaultFormatter"}static{this.extensionIds=[]}static{this.extensionItemLabels=[]}static{this.extensionDescriptions=[]}async _updateConfigValues(){await this._extensionService.whenInstalledExtensionsRegistered();let e=[...this._extensionService.extensions],t=this._languageFeaturesService.documentFormattingEditProvider.allNoModel(),o=this._languageFeaturesService.documentRangeFormattingEditProvider.allNoModel(),n=new Set;for(let r of t)r.extensionId&&n.add(hi.toKey(r.extensionId));for(let r of o)r.extensionId&&n.add(hi.toKey(r.extensionId));e=e.sort((r,s)=>{let l=n.has(hi.toKey(r.identifier)),c=n.has(hi.toKey(s.identifier));if(l&&!c)return-1;if(!l&&c)return 1;let u=r.categories?.find(h=>h==="Formatters"||h==="Programming Languages"),p=s.categories?.find(h=>h==="Formatters"||h==="Programming Languages");return u&&!p?-1:!u&&p?1:r.name.localeCompare(s.name)}),gh.extensionIds.length=0,gh.extensionItemLabels.length=0,gh.extensionDescriptions.length=0,gh.extensionIds.push(null),gh.extensionItemLabels.push(d(12372,null)),gh.extensionDescriptions.push(d(12373,null));for(let r of e)(r.main||r.browser)&&(gh.extensionIds.push(r.identifier.value),gh.extensionItemLabels.push(r.displayName??""),gh.extensionDescriptions.push(r.description??""))}static _maybeQuotes(e){return e.match(/\s/)?`'${e}'`:e}async _analyzeFormatter(e,t,o){let n=this._configService.getValue(gh.configName,{resource:o.uri,overrideIdentifier:o.getLanguageId()});if(n){let l=t.find(u=>hi.equals(u.extensionId,n));if(l)return l;let c=await this._extensionService.getExtension(n);if(c&&this._extensionEnablementService.isEnabled(YT(c))){let u=this._languageService.getLanguageName(o.getLanguageId())||o.getLanguageId();return e===1?d(12370,null,c.displayName||c.name,u):d(12371,null,c.displayName||c.name,u)}}else if(t.length===1)return t[0];let r=this._languageService.getLanguageName(o.getLanguageId())||o.getLanguageId();return n?d(12358,null,n):d(12359,null,gh._maybeQuotes(r))}async _selectFormatter(e,t,o,n){let r=await this._analyzeFormatter(n,e,t);if(typeof r!="string")return r;if(o!==2){let{confirmed:s}=await this._dialogService.confirm({message:d(12369,null),detail:r,primaryButton:d(12361,null)});if(s)return this._pickAndPersistDefaultFormatter(e,t)}else this._notificationService.prompt(ft.Info,r,[{label:d(12363,null),run:()=>this._pickAndPersistDefaultFormatter(e,t)}],{priority:2})}async _pickAndPersistDefaultFormatter(e,t){let o=e.map((s,l)=>({index:l,label:s.displayName||(s.extensionId?s.extensionId.value:"?"),description:s.extensionId&&s.extensionId.value})),n=this._languageService.getLanguageName(t.getLanguageId())||t.getLanguageId(),r=await this._quickInputService.pick(o,{placeHolder:d(12374,null,gh._maybeQuotes(n))});if(!(!r||!e[r.index].extensionId))return this._configService.updateValue(gh.configName,e[r.index].extensionId.value,{resource:t.uri,overrideIdentifier:t.getLanguageId()}),e[r.index]}_updateStatus(){this._languageStatusStore.clear();let e=da(this._editorService.activeTextEditorControl);if(!e||!e.hasModel())return;let t=e.getModel(),o=JEe(this._languageFeaturesService.documentFormattingEditProvider,this._languageFeaturesService.documentRangeFormattingEditProvider,t);if(o.length===0)return;let n=new qe;this._languageStatusStore.add(ee(()=>n.dispose(!0))),this._analyzeFormatter(1,o,t).then(r=>{if(n.token.isCancellationRequested||typeof r!="string")return;let s={id:`formatter/configure/dfl/${ht()}`,title:d(12362,null)};this._languageStatusStore.add(Ge.registerCommand(s.id,()=>this._pickAndPersistDefaultFormatter(o,t))),this._languageStatusStore.add(this._languageStatusService.addStatus({id:"formatter.conflict",name:d(12375,null),selector:{language:t.getLanguageId(),pattern:t.uri.fsPath},severity:ft.Error,label:d(12367,null),detail:r,busy:!1,source:"",command:s,accessibilityInfo:void 0}))})}};gh=I([m(0,lt),m(1,As),m(2,B),m(3,Ne),m(4,ct),m(5,$e),m(6,Rt),m(7,Jt),m(8,$H),m(9,ie)],gh);oe.as(Zi.Workbench).registerWorkbenchContribution(gh,3);oe.as($t.Configuration).registerConfiguration({...wx,properties:{[gh.configName]:{description:d(12368,null),type:["string","null"],default:null,enum:gh.extensionIds,enumItemLabels:gh.extensionItemLabels,markdownEnumDescriptions:gh.extensionDescriptions}}});async function UTo(a,i,e){let t=a.get($e),o=a.get(B),n=a.get(Rt),r={resource:i.uri,overrideIdentifier:i.getLanguageId()},s=o.getValue(gh.configName,r),l,c=e.map((h,g)=>{let f=hi.equals(h.extensionId,s),v={index:g,label:h.displayName||"",description:f?d(12360,null):void 0};return f&&(l=v),v}),u={label:d(12357,null)},p=await t.pick([...c,{type:"separator"},u],{placeHolder:d(12364,null),activeItem:l});if(p)if(p===u){let h=n.getLanguageName(i.getLanguageId())||i.getLanguageId(),g=await t.pick(c,{placeHolder:d(12374,null,gh._maybeQuotes(h))});g&&e[g.index].extensionId&&o.updateValue(gh.configName,e[g.index].extensionId.value,r);return}else return p.index;else return}ri(class extends Mi{constructor(){super({id:"editor.action.formatDocument.multiple",label:d(12365,null),alias:"Format Document...",precondition:C.and(me.writable,me.hasMultipleDocumentFormattingProvider),contextMenuOpts:{group:"1_modification",order:1.3}})}async run(i,e,t){if(!e.hasModel())return;let o=i.get(F),n=i.get(Jt),r=e.getModel(),s=JEe(n.documentFormattingEditProvider,n.documentRangeFormattingEditProvider,r),l=await o.invokeFunction(UTo,r,s);typeof l=="number"&&await o.invokeFunction(vhi,s[l],e,1,Ie.None)}});ri(class extends Mi{constructor(){super({id:"editor.action.formatSelection.multiple",label:d(12366,null),alias:"Format Code...",precondition:C.and(C.and(me.writable),me.hasMultipleDocumentSelectionFormattingProvider),contextMenuOpts:{when:C.and(me.hasNonEmptySelection),group:"1_modification",order:1.31}})}async run(i,e){if(!e.hasModel())return;let t=i.get(F),o=i.get(Jt),n=e.getModel(),r=e.getSelection();r.isEmpty()&&(r=new G(r.startLineNumber,1,r.startLineNumber,n.getLineMaxColumn(r.startLineNumber)));let s=o.documentRangeFormattingEditProvider.ordered(n),l=await t.invokeFunction(UTo,n,s);typeof l=="number"&&await t.invokeFunction(fhi,s[l],e,r,Ie.None,!0)}});var MOi=class{constructor(i,e,t,o){this.resolvedNotebookEditorModel=i;this.notebookUri=e;this.cell=t;this.outputId=o}dispose(){this.resolvedNotebookEditorModel.dispose()}},OP=class extends Ls{constructor(e,t,o,n,r){super();this.notebookEditorModelResolverService=r;this._notebookUri=e,this.cellUri=void 0,this.cellIndex=t,this.outputId=o,this.outputIndex=n}static{this.ID="workbench.input.notebookOutputEditorInput"}get typeId(){return OP.ID}async resolve(){this._notebookRef||(this._notebookRef=await this.notebookEditorModelResolverService.resolve(this._notebookUri));let e=this._notebookRef.object.notebook.cells[this.cellIndex];if(!e)throw new Error("Cell not found");this.cellUri=e.uri;let t=e.outputs[this.outputIndex]?.outputId;if(!t)throw new Error("Output not found");return this.outputId||(this.outputId=t),new MOi(this._notebookRef.object,this._notebookUri,e,t)}getSerializedData(){if(!this._notebookRef)return;let e=this._notebookRef.object.notebook.cells.findIndex(n=>ze(n.uri,this.cellUri)),t=this._notebookRef.object.notebook.cells[e];if(!t)return;let o=t.outputs.findIndex(n=>n.outputId===this.outputId);if(o!==-1)return{notebookUri:this._notebookUri,cellIndex:e,outputIndex:o}}getName(){return d(13922,null)}get editorId(){return"notebookOutputEditor"}get resource(){}get capabilities(){return 2}dispose(){super.dispose()}};OP=I([m(4,Yh)],OP);var POi=class a extends k{constructor(){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._value=Object.freeze({...a.fixedEditorOptions,padding:{top:12,bottom:12},readOnly:!0})}static{this.fixedEditorOptions={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},renderLineHighlightOnlyWhenFocus:!0,overviewRulerLanes:0,lineDecorationsWidth:0,folding:!0,fixedOverflowWidgets:!0,minimap:{enabled:!1},renderValidationDecorations:"on",lineNumbersMinChars:3}}get value(){return this._value}},W6=class extends zs{constructor(e,t,o,n,r,s,l){super(W6.ID,e,n,o,r);this.instantiationService=t;this.configurationService=s;this.notebookService=l;this.creationOptions=roe();this._outputWebview=null;this._isDisposed=!1;this._notebookOptions=this.instantiationService.createInstance(P_,this.window,!1,void 0),this._register(this._notebookOptions)}static{this.ID=aro}get isDisposed(){return this._isDisposed}createEditor(e){this._rootElement=D(e,_(".notebook-output-editor"))}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo()),this._fontInfo}createFontInfo(){let e=this.configurationService.getValue("editor");return zw.readFontInfo(this.window,RI(e,Gu.getInstance(this.window).value))}async _createOriginalWebview(e,t,o){this._outputWebview?.dispose(),this._outputWebview=this.instantiationService.createInstance(sO,this,e,t,o,{...this._notebookOptions.computeDiffWebviewOptions(),fontFamily:this._generateFontFamily()},void 0),D(this._rootElement,this._outputWebview.element),this._outputWebview.createWebview(this.window),this._outputWebview.element.style.width="calc(100% - 16px)",this._outputWebview.element.style.left="16px"}_generateFontFamily(){return this.fontInfo.fontFamily??'"SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace'}getTitle(){return this.input?this.input.getName():d(13921,null)}async setInput(e,t,o,n){await super.setInput(e,t,o,n);let r=await e.resolve();if(!r)throw new Error("Invalid notebook output editor input");let s=r.resolvedNotebookEditorModel;await this._createOriginalWebview(ht(),s.viewType,A.from({scheme:Q.vscodeNotebookCellOutput,path:"",query:"openIn=notebookOutputEditor"}));let l=s.notebook,c=this._register(new gOe),u=this._register(new POi),p=new SOe(this._notebookOptions,c,w=>u);this._notebookViewModel=this.instantiationService.createInstance(ooe,l.viewType,l,p,null,{isReadOnly:!0});let h=this._notebookViewModel.getCellByHandle(r.cell.handle);if(!h)throw new Error("Invalid NotebookOutputEditorInput, no matching cell view model");let g=h.outputsViewModels.find(w=>w.model.outputId===r.outputId);if(!g)throw new Error("Invalid NotebookOutputEditorInput, no matching cell output view model");let f,[v,b]=g.resolveMimeTypes(l,void 0),S=g.pickedMimeType||v[b];if(v.length!==0){let w=this.notebookService.getRendererInfo(S.rendererId);f=w?{type:1,renderer:w,source:g,mimeType:S.mimeType}:this._renderMissingRenderer(g,S.mimeType)}if(!f)throw new Error("No InsetRenderInfo for output");let y={cellId:h.id,cellHandle:r.cell.handle,cellUri:r.cell.uri};this._outputWebview?.createOutput(y,f,0,0)}_renderMissingRenderer(e,t){if(!e.model.outputs.length)return this._renderMessage(e,d(13919,null));if(!t){let n=e.model.outputs.map(r=>r.mime).join(", ");return this._renderMessage(e,d(13920,null,n))}return this._renderSearchForMimetype(e,t)}_renderMessage(e,t){let o=_("p",void 0,t);return{type:0,source:e,htmlContent:o.outerHTML}}_renderSearchForMimetype(e,t){let o=`@tag:notebookRenderer ${t}`,n=_("p",void 0,`No renderer could be found for mimetype "${t}", but one might be available on the Marketplace.`),r=_("a",{href:`command:workbench.extensions.search?%22${o}%22`,class:"monaco-button monaco-text-button",tabindex:0,role:"button",style:"padding: 8px; text-decoration: none; color: rgb(255, 255, 255); background-color: rgb(14, 99, 156); max-width: 200px;"},"Search Marketplace");return{type:0,source:e,htmlContent:n.outerHTML+r.outerHTML}}scheduleOutputHeightAck(e,t,o){kr(this.window,()=>{this._outputWebview?.ackHeight([{cellId:e.cellId,outputId:t,height:o}])},10)}async focusNotebookCell(e,t){}async focusNextNotebookCell(e,t){}toggleNotebookCellSelection(e){throw new Error("Not implemented.")}getCellById(e){throw new Error("Not implemented")}getCellByInfo(e){return this._notebookViewModel?.getCellByHandle(e.cellHandle)}layout(e,t){}setScrollTop(e){}triggerScroll(e){}getOutputRenderer(){}updateOutputHeight(e,t,o,n,r){}updateMarkupCellHeight(e,t,o){}setMarkupCellEditState(e,t){}didResizeOutput(e){}didStartDragMarkupCell(e,t){}didDragMarkupCell(e,t){}didDropMarkupCell(e,t){}didEndDragMarkupCell(e){}updatePerformanceMetadata(e,t,o,n){}didFocusOutputInputChange(e){}dispose(){this._isDisposed=!0,super.dispose()}};W6=I([m(1,F),m(2,Pe),m(3,_e),m(4,de),m(5,B),m(6,kn)],W6);var LVe=class{constructor(i,e,t){this.instantiationService=e;this.uriIdentityService=t;i.registerEditor(`${Q.vscodeNotebookCellOutput}:/**`,{id:"notebookOutputEditor",label:"Notebook Output Editor",priority:"default"},{canSupportResource:o=>o.scheme===Q.vscodeNotebookCellOutput?new URLSearchParams(o.query).get("openIn")==="notebookOutputEditor":!1},{createEditorInput:async({resource:o,options:n})=>{let r=sn.parseCellOutputUri(o);if(!r||!r.notebook||r.cellIndex===void 0||r.outputIndex===void 0||!r.outputId)throw new Error("Invalid output uri for notebook output editor");let s=this.uriIdentityService.asCanonicalUri(r.notebook),l=r.cellIndex,c=r.outputId,u=r.outputIndex;return{editor:this.instantiationService.createInstance(OP,s,l,c,u),options:n}}})}static{this.ID="workbench.contribution.notebookOutputEditorContribution"}};LVe=I([m(0,il),m(1,F),m(2,gt)],LVe);bt(LVe.ID,LVe,vt.BlockRestore);oe.as(en.EditorPane).registerEditorPane(os.create(UR,UR.ID,"Notebook Editor"),[new Vt(Ga)]);oe.as(en.EditorPane).registerEditorPane(os.create(Oh,Oh.ID,"Notebook Diff Editor"),[new Vt(VC)]);oe.as(en.EditorPane).registerEditorPane(os.create(W6,W6.ID,"Notebook Output Editor"),[new Vt(OP)]);oe.as(en.EditorPane).registerEditorPane(os.create(Um,Um.ID,"Notebook Diff Editor"),[new Vt(Qge)]);var Jat=class{constructor(i){this._configurationService=i}canSerialize(){return!0}serialize(i){return To(i instanceof VC),JSON.stringify({resource:i.resource,originalResource:i.original.resource,name:i.getName(),originalName:i.original.getName(),textDiffName:i.getName(),viewType:i.viewType})}deserialize(i,e){let t=Dm(e);if(!t)return;let{resource:o,originalResource:n,name:r,viewType:s}=t;if(!(!t||!A.isUri(o)||!A.isUri(n)||typeof r!="string"||typeof s!="string"))return this._configurationService.getValue("notebook.experimental.enableNewDiffEditor")?Qge.create(i,o,r,void 0,n,s):VC.create(i,o,r,void 0,n,s)}static canResolveBackup(i,e){return!1}};Jat=I([m(0,B)],Jat);var AOi=class{canSerialize(i){return i.typeId===Ga.ID}serialize(i){To(i instanceof Ga);let e={resource:i.resource,preferredResource:i.preferredResource,viewType:i.viewType,options:i.options};return JSON.stringify(e)}deserialize(i,e){let t=Dm(e);if(!t)return;let{resource:o,preferredResource:n,viewType:r,options:s}=t;return!t||!A.isUri(o)||typeof r!="string"?void 0:Ga.getOrCreate(i,o,n,r,s)}},NOi=class{canSerialize(i){return i.typeId===OP.ID}serialize(i){To(i instanceof OP);let e=i.getSerializedData();if(e)return JSON.stringify(e)}deserialize(i,e){let t=Dm(e);return t?i.createInstance(OP,t.notebookUri,t.cellIndex,void 0,t.outputIndex):void 0}};oe.as(en.EditorFactory).registerEditorSerializer(Ga.ID,AOi);oe.as(en.EditorFactory).registerEditorSerializer(VC.ID,Jat);oe.as(en.EditorFactory).registerEditorSerializer(OP.ID,NOi);var Bne=class extends k{constructor(e,t,o){super();this.codeEditorService=o;this.updateCellUndoRedoComparisonKey(t,e),this._register(t.onDidChangeConfiguration(n=>{n.affectsConfiguration(Ct.undoRedoPerCell)&&this.updateCellUndoRedoComparisonKey(t,e)})),this._register(this.codeEditorService.registerDecorationType("comment-controller",zFt,{}))}static{this.ID="workbench.contrib.notebook"}updateCellUndoRedoComparisonKey(e,t){let o=e.getValue(Ct.undoRedoPerCell);o?(this._uriComparisonKeyComputer?.dispose(),this._uriComparisonKeyComputer=void 0):this._uriComparisonKeyComputer||(this._uriComparisonKeyComputer=t.registerUriComparisonKeyComputer(sn.scheme,{getComparisonKey:n=>o?n.toString():Bne._getCellUndoRedoComparisonKey(n)}))}static _getCellUndoRedoComparisonKey(e){let t=sn.parse(e);return t?t.notebook.toString():e.toString()}dispose(){super.dispose(),this._uriComparisonKeyComputer?.dispose()}};Bne=I([m(0,wl),m(1,B),m(2,Qt)],Bne);var MVe=class{constructor(i,e,t,o){this._modelService=e;this._languageService=t;this._notebookModelResolverService=o;this._registration=i.registerTextModelContentProvider(sn.scheme,this)}static{this.ID="workbench.contrib.cellContentProvider"}dispose(){this._registration.dispose()}async provideTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=sn.parse(i);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t.notebook),n=null;if(!o.object.isResolved())return null;for(let s of o.object.notebook.cells)if(s.uri.toString()===i.toString()){let l={create:p=>({textBuffer:s.textBuffer,disposable:k.None}),getFirstLineText:p=>s.textBuffer.getLineContent(1).substring(0,p)},c=this._languageService.getLanguageIdByLanguageName(s.language),u=c?this._languageService.createById(c):s.cellKind===1?this._languageService.createById("markdown"):this._languageService.createByFilepathOrFirstLine(i,s.textBuffer.getLineContent(1));n=this._modelService.createModel(l,u,i);break}if(!n)return o.dispose(),null;let r=U.any(n.onWillDispose,o.object.notebook.onWillDispose)(()=>{r.dispose(),o.dispose()});return n}};MVe=I([m(0,Bt),m(1,_t),m(2,Rt),m(3,Yh)],MVe);var PVe=class{constructor(i,e,t,o,n){this._modelService=e;this._languageService=t;this._labelService=o;this._notebookModelResolverService=n;this._disposables=[];this._disposables.push(i.registerTextModelContentProvider(Q.vscodeNotebookCellMetadata,{provideTextContent:this.provideMetadataTextContent.bind(this)})),this._disposables.push(i.registerTextModelContentProvider(Q.vscodeNotebookCellOutput,{provideTextContent:this.provideOutputTextContent.bind(this)})),this._disposables.push(this._labelService.registerFormatter({scheme:Q.vscodeNotebookCellMetadata,formatting:{label:"${path} (metadata)",separator:"/"}})),this._disposables.push(this._labelService.registerFormatter({scheme:Q.vscodeNotebookCellOutput,formatting:{label:"${path} (output)",separator:"/"}}))}static{this.ID="workbench.contrib.cellInfoContentProvider"}dispose(){je(this._disposables)}async provideMetadataTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=sn.parseCellPropertyUri(i,Q.vscodeNotebookCellMetadata);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t.notebook),n=null,r=this._languageService.createById("json"),s=new O;for(let c of o.object.notebook.cells)if(c.handle===t.handle){let u=o.object.notebook.cells.indexOf(c),p=Dq(o.object.notebook.transientOptions.transientCellMetadata,c.metadata,c.language,!0);n=this._modelService.createModel(p,r,i),this._disposables.push(s.add(o.object.notebook.onDidChangeContent(h=>{if(n&&h.rawEvents.some(g=>(g.kind===7||g.kind===5)&&g.index===u)){let g=Dq(o.object.notebook.transientOptions.transientCellMetadata,c.metadata,c.language,!0);n.getValue()!==g&&n.setValue(g)}})));break}if(!n)return o.dispose(),null;let l=n.onWillDispose(()=>{s.dispose(),l.dispose(),o.dispose()});return n}parseStreamOutput(i){if(!i)return;let e=sMi(i.outputs);if(e)return{content:e,mode:this._languageService.createById(es)}}_getResult(i,e){let t,o=this._languageService.createById("json"),n=e.outputs.find(c=>c.outputId===i.outputId||c.alternativeOutputId===i.outputId),r=this.parseStreamOutput(n);if(r)return t=r,t;let s=e.outputs.map(c=>({metadata:c.metadata,outputItems:c.outputs.map(u=>({mimeType:u.mime,data:u.data.toString()}))}));return t={content:dW(s,{}),mode:o},t}async provideOutputsTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=sn.parseCellPropertyUri(i,Q.vscodeNotebookCellOutput);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t.notebook),n=o.object.notebook.cells.find(u=>u.handle===t.handle);if(!n)return o.dispose(),null;let r=this._languageService.createById("json"),s=this._modelService.createModel(soe(n.outputs||[]),r,i,!0),l=U.any(n.onDidChangeOutputs??U.None,n.onDidChangeOutputItems??U.None)(()=>{s.setValue(soe(n.outputs||[]))}),c=s.onWillDispose(()=>{c.dispose(),l.dispose(),o.dispose()});return s}async provideOutputTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=sn.parseCellOutputUri(i);if(!t)return this.provideOutputsTextContent(i);let o=await this._notebookModelResolverService.resolve(t.notebook),n=o.object.notebook.cells.find(u=>!!u.outputs.find(p=>p.outputId===t.outputId||p.alternativeOutputId===t.outputId));if(!n)return o.dispose(),null;let r=this._getResult(t,n);if(!r)return o.dispose(),null;let s=this._modelService.createModel(r.content,r.mode,i),l=U.any(n.onDidChangeOutputs??U.None,n.onDidChangeOutputItems??U.None)(()=>{let u=this._getResult(t,n);u&&(s.setValue(u.content),s.setLanguage(u.mode.languageId))}),c=s.onWillDispose(()=>{c.dispose(),l.dispose(),o.dispose()});return s}};PVe=I([m(0,Bt),m(1,_t),m(2,Rt),m(3,nt),m(4,Yh)],PVe);var AVe=class{constructor(i,e,t,o,n){this._modelService=e;this._languageService=t;this._labelService=o;this._notebookModelResolverService=n;this._disposables=[];this._disposables.push(i.registerTextModelContentProvider(Q.vscodeNotebookMetadata,{provideTextContent:this.provideMetadataTextContent.bind(this)})),this._disposables.push(this._labelService.registerFormatter({scheme:Q.vscodeNotebookMetadata,formatting:{label:"${path} (metadata)",separator:"/"}}))}static{this.ID="workbench.contrib.notebookMetadataContentProvider"}dispose(){je(this._disposables)}async provideMetadataTextContent(i){let e=this._modelService.getModel(i);if(e)return e;let t=E7e.parse(i);if(!t)return null;let o=await this._notebookModelResolverService.resolve(t),n=null,r=this._languageService.createById("json"),s=new O,l=R2t(o.object.notebook.transientOptions.transientDocumentMetadata,o.object.notebook.metadata);if(n=this._modelService.createModel(l,r,i),!n)return o.dispose(),null;this._disposables.push(s.add(o.object.notebook.onDidChangeContent(u=>{if(n&&u.rawEvents.some(p=>p.kind===10||p.kind===11||p.kind===1)){let p=R2t(o.object.notebook.transientOptions.transientDocumentMetadata,o.object.notebook.metadata);n.getValue()!==p&&n.setValue(p)}})));let c=n.onWillDispose(()=>{s.dispose(),c.dispose(),o.dispose()});return n}};AVe=I([m(0,Bt),m(1,_t),m(2,Rt),m(3,nt),m(4,Yh)],AVe);var ajt=class extends k{static{this.ID="workbench.contrib.registerCellSchemas"}constructor(){super(),this.registerMetadataSchemas()}registerMetadataSchemas(){let i=oe.as(Ta.JSONContribution),e={properties:{language:{type:"string",description:"The language for the cell"}},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0};i.registerSchema("vscode://schemas/notebook/cellmetadata",e)}},NVe=class{constructor(i,e,t){this._editorService=i;this._notebookEditorModelService=e;this._disposables=new O;this._disposables.add(U.debounce(this._notebookEditorModelService.onDidChangeDirty,(o,n)=>o?[...o,n]:[n],100)(this._openMissingDirtyNotebookEditors,this)),this._disposables.add(e.onWillFailWithConflict(o=>{for(let n of t.groups){let r=n.editors.filter(l=>l instanceof Ga&&l.viewType!==o.viewType&&ze(l.resource,o.resource)),s=n.closeEditors(r);o.waitUntil(s)}}))}static{this.ID="workbench.contrib.notebookEditorManager"}dispose(){this._disposables.dispose()}_openMissingDirtyNotebookEditors(i){let e=[];for(let t of i)t.isDirty()&&!this._editorService.isOpened({resource:t.resource,typeId:Ga.ID,editorId:t.viewType})&&Ts(t.resource)!==".interactive"&&e.push({resource:t.resource,options:{inactive:!0,preserveFocus:!0,pinned:!0,override:t.viewType}});e.length>0&&this._editorService.openEditors(e)}};NVe=I([m(0,ie),m(1,Yh),m(2,kt)],NVe);var OVe=class extends k{constructor(e,t,o,n){super();this._instantiationService=e;this._workingCopyEditorService=t;this._extensionService=o;this._notebookService=n;this._installHandler()}static{this.ID="workbench.contrib.simpleNotebookWorkingCopyEditorHandler"}async handles(e){let t=this.handlesSync(e);return t?this._notebookService.canResolve(t):!1}handlesSync(e){let t=this._getViewType(e);if(!(!t||t==="interactive"))return t}isOpen(e,t){return this.handlesSync(e)?t instanceof Ga&&t.viewType===this._getViewType(e)&&ze(e.resource,t.resource):!1}createEditor(e){return Ga.getOrCreate(this._instantiationService,e.resource,void 0,this._getViewType(e))}async _installHandler(){await this._extensionService.whenInstalledExtensionsRegistered(),this._register(this._workingCopyEditorService.registerHandler(this))}_getViewType(e){let t=E0.parse(e.typeId);if(t&&t.viewType===t.notebookType)return t?.viewType}};OVe=I([m(0,F),m(1,If),m(2,lt),m(3,kn)],OVe);var FVe=class{constructor(i,e){this._notebookService=i;e.setNotebookTypeResolver(this._getNotebookInfo.bind(this))}static{this.ID="workbench.contrib.notebookLanguageSelectorScoreRefine"}_getNotebookInfo(i){let e=sn.parse(i);if(!e)return;let t=this._notebookService.getNotebookTextModel(e.notebook);if(t)return{uri:t.uri,type:t.viewType}}};FVe=I([m(0,kn),m(1,Jt)],FVe);var Sgn=oe.as(Zi.Workbench);bt(Bne.ID,Bne,vt.BlockStartup);bt(MVe.ID,MVe,vt.BlockStartup);bt(PVe.ID,PVe,vt.BlockStartup);bt(AVe.ID,AVe,vt.BlockStartup);bt(ajt.ID,ajt,vt.BlockStartup);bt(NVe.ID,NVe,vt.BlockRestore);bt(FVe.ID,FVe,vt.BlockRestore);bt(OVe.ID,OVe,vt.BlockRestore);Sgn.registerWorkbenchContribution(RVe,4);_a.register(new sjt);_a.register(new rjt);Ce(kn,Jie,1);Ce(Mq,jOe,1);Ce(Yh,JOe,1);Ce(Zee,B2t,1);Ce(hd,QOe,1);Ce(Ql,QU,1);Ce(XM,h1,1);Ce(LZ,kVe,1);Ce(Ns,CVe,1);Ce(CLe,ZOe,1);Ce(BTo,TVe,1);Ce(Sb,_Ve,1);Ce(TOe,EOe,1);Ce(w2t,xOe,1);var OOi={};function Ign(a){return typeof a.type<"u"||typeof a.anyOf<"u"}for(let a of Az){let i=a.schema;if(i)if(Ign(i))OOi[`editor.${a.name}`]=i;else for(let e in i)Object.hasOwnProperty.call(i,e)&&(OOi[e]=i[e])}var ygn={description:d(13767,null),default:{},allOf:[{properties:OOi}],tags:["notebookLayout"]},wgn=oe.as($t.Configuration);wgn.registerConfiguration({id:"notebook",order:100,title:d(13808,null),type:"object",properties:{[Ct.displayOrder]:{description:d(13765,null),type:"array",items:{type:"string"},default:[]},[Ct.cellToolbarLocation]:{description:d(13755,null),type:"object",additionalProperties:{markdownDescription:d(13756,null),type:"string",enum:["left","right","hidden"]},default:{default:"right"},tags:["notebookLayout"]},[Ct.showCellStatusBar]:{description:d(13796,null),type:"string",enum:["hidden","visible","visibleAfterExecute"],enumDescriptions:[d(13797,null),d(13798,null),d(13799,null)],default:"visible",tags:["notebookLayout"]},[Ct.cellExecutionTimeVerbosity]:{description:d(13751,null),type:"string",enum:["default","verbose"],enumDescriptions:[d(13750,null),d(13752,null)],default:"default",tags:["notebookLayout"]},[Ct.textDiffEditorPreview]:{description:d(13763,null),type:"boolean",default:!0,tags:["notebookLayout"]},[Ct.diffOverviewRuler]:{description:d(13762,null),type:"boolean",default:!1,tags:["notebookLayout"]},[Ct.cellToolbarVisibility]:{markdownDescription:d(13757,null),type:"string",enum:["hover","click"],default:"click",tags:["notebookLayout"]},[Ct.undoRedoPerCell]:{description:d(13806,null),type:"boolean",default:!0,tags:["notebookLayout"]},[Ct.compactView]:{description:d(13758,null),type:"boolean",default:!0,tags:["notebookLayout"]},[Ct.focusIndicator]:{description:d(13769,null),type:"string",enum:["border","gutter"],default:"gutter",tags:["notebookLayout"]},[Ct.insertToolbarLocation]:{description:d(13779,null),type:"string",enum:["betweenCells","notebookToolbar","both","hidden"],enumDescriptions:[d(13745,null),d(13748,null),d(13746,null),d(13747,null)],default:"both",tags:["notebookLayout"]},[Ct.globalToolbar]:{description:d(13772,null),type:"boolean",default:!0,tags:["notebookLayout"]},[Ct.stickyScrollEnabled]:{description:d(13801,null),type:"boolean",default:!1,tags:["notebookLayout"]},[Ct.stickyScrollMode]:{description:d(13802,null),type:"string",enum:["flat","indented"],enumDescriptions:[d(13803,null),d(13804,null)],default:"indented",tags:["notebookLayout"]},[Ct.consolidatedOutputButton]:{description:d(13760,null),type:"boolean",default:!0,tags:["notebookLayout"]},[Ct.showFoldingControls]:{description:d(13800,null),type:"string",enum:["always","never","mouseover"],enumDescriptions:[d(13810,null),d(13812,null),d(13811,null)],default:"mouseover",tags:["notebookLayout"]},[Ct.dragAndDropEnabled]:{description:d(13766,null),type:"boolean",default:!0,tags:["notebookLayout"]},[Ct.consolidatedRunButton]:{description:d(13761,null),type:"boolean",default:!1,tags:["notebookLayout"]},[Ct.globalToolbarShowLabel]:{description:d(13773,null),type:"string",enum:["always","never","dynamic"],default:"always",tags:["notebookLayout"]},[Ct.textOutputLineLimit]:{markdownDescription:d(13805,null,"`#notebook.output.scrolling#`"),type:"number",default:30,tags:["notebookLayout","notebookOutputLayout"],minimum:1},[Ct.LinkifyOutputFilePaths]:{description:d(13764,null),type:"boolean",default:!0,tags:["notebookOutputLayout"]},[Ct.minimalErrorRendering]:{description:d(13784,null),type:"boolean",default:!1,tags:["notebookOutputLayout"]},[Ct.markupFontSize]:{markdownDescription:d(13783,null,"`0`","`#editor.fontSize#`"),type:"number",default:0,tags:["notebookLayout"]},[Ct.markdownLineHeight]:{markdownDescription:d(13781,null,"`0`","`normal`"),type:"number",default:0,tags:["notebookLayout"]},[Ct.cellEditorOptionsCustomizations]:ygn,[Ct.interactiveWindowCollapseCodeCells]:{markdownDescription:d(13780,null),type:"string",enum:["always","never","fromEditor"],default:"fromEditor"},[Ct.outputLineHeight]:{markdownDescription:d(13788,null),type:"number",default:0,tags:["notebookLayout","notebookOutputLayout"]},[Ct.outputFontSize]:{markdownDescription:d(13787,null,"`#editor.fontSize#`"),type:"number",default:0,tags:["notebookLayout","notebookOutputLayout"]},[Ct.outputFontFamily]:{markdownDescription:d(13786,null,"`#editor.fontFamily#`"),type:"string",tags:["notebookLayout","notebookOutputLayout"]},[Ct.outputScrolling]:{markdownDescription:d(13789,null),type:"boolean",tags:["notebookLayout","notebookOutputLayout"],default:typeof $i.quality=="string"&&$i.quality!=="stable"},[Ct.outputWordWrap]:{markdownDescription:d(13790,null),type:"boolean",tags:["notebookLayout","notebookOutputLayout"],default:!1},[Ct.defaultFormatter]:{description:d(13809,null),type:["string","null"],default:null,enum:gh.extensionIds,enumItemLabels:gh.extensionItemLabels,markdownEnumDescriptions:gh.extensionDescriptions},[Ct.formatOnSave]:{markdownDescription:d(13771,null,"`#files.autoSave#`"),type:"boolean",tags:["notebookLayout"],default:!1},[Ct.insertFinalNewline]:{markdownDescription:d(13778,null),type:"boolean",tags:["notebookLayout"],default:!1},[Ct.formatOnCellExecution]:{markdownDescription:d(13770,null),type:"boolean",default:!1},[Ct.confirmDeleteRunningCell]:{markdownDescription:d(13759,null),type:"boolean",default:!0},[Ct.findFilters]:{markdownDescription:d(13768,null),type:"object",properties:{markupSource:{type:"boolean",default:!0},markupPreview:{type:"boolean",default:!0},codeSource:{type:"boolean",default:!0},codeOutput:{type:"boolean",default:!0}},default:{markupSource:!0,markupPreview:!0,codeSource:!0,codeOutput:!0},tags:["notebookLayout"]},[Ct.remoteSaving]:{markdownDescription:d(13791,null),type:"boolean",default:typeof $i.quality=="string"&&$i.quality!=="stable",tags:["experimental"]},[Ct.scrollToRevealCell]:{markdownDescription:d(13792,null,"notebook.cell.executeAndSelectBelow"),type:"string",enum:["fullCell","firstLine","none"],markdownEnumDescriptions:[d(13794,null),d(13793,null),d(13795,null)],default:"fullCell"},[Ct.cellGenerate]:{markdownDescription:d(13754,null),type:"boolean",default:!0},[Ct.notebookVariablesView]:{markdownDescription:d(13807,null),type:"boolean",default:!1},[Ct.notebookInlineValues]:{markdownDescription:d(13775,null),type:"string",enum:["on","auto","off"],enumDescriptions:[d(13777,null),d(13774,null),d(13776,null)],default:"off"},[Ct.cellFailureDiagnostics]:{markdownDescription:d(13753,null),type:"boolean",default:!0},[Ct.outputBackupSizeLimit]:{markdownDescription:d(13749,null),type:"number",default:1e4},[Ct.multiCursor]:{markdownDescription:d(13785,null),type:"boolean",default:!1},[Ct.markupFontFamily]:{markdownDescription:d(13782,null),type:"string",default:"",tags:["notebookLayout"]}}});var xgn=zn.registerExtensionPoint({extensionPoint:"speechProviders",jsonSchema:{description:d(15433,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(15432,null),type:"string"},description:{description:d(15431,null),type:"string"}}}}}),WVe=class extends k{constructor(e,t,o,n,r,s){super();this.logService=e;this.hostService=o;this.telemetryService=n;this.configurationService=r;this.extensionService=s;this._onDidChangeHasSpeechProvider=this._register(new T);this.onDidChangeHasSpeechProvider=this._onDidChangeHasSpeechProvider.event;this.providers=new Map;this.providerDescriptors=new Map;this._onDidStartSpeechToTextSession=this._register(new T);this.onDidStartSpeechToTextSession=this._onDidStartSpeechToTextSession.event;this._onDidEndSpeechToTextSession=this._register(new T);this.onDidEndSpeechToTextSession=this._onDidEndSpeechToTextSession.event;this.activeSpeechToTextSessions=0;this._onDidStartTextToSpeechSession=this._register(new T);this.onDidStartTextToSpeechSession=this._onDidStartTextToSpeechSession.event;this._onDidEndTextToSpeechSession=this._register(new T);this.onDidEndTextToSpeechSession=this._onDidEndTextToSpeechSession.event;this.activeTextToSpeechSessions=0;this._onDidStartKeywordRecognition=this._register(new T);this.onDidStartKeywordRecognition=this._onDidStartKeywordRecognition.event;this._onDidEndKeywordRecognition=this._register(new T);this.onDidEndKeywordRecognition=this._onDidEndKeywordRecognition.event;this.activeKeywordRecognitionSessions=0;this.hasSpeechProviderContext=YH.bindTo(t),this.textToSpeechInProgress=qOt.bindTo(t),this.speechToTextInProgress=Aee.bindTo(t),this.handleAndRegisterSpeechExtensions()}get hasSpeechProvider(){return this.providerDescriptors.size>0||this.providers.size>0}handleAndRegisterSpeechExtensions(){xgn.setHandler((e,t)=>{let o=this.hasSpeechProvider;for(let n of t.removed)for(let r of n.value)this.providerDescriptors.delete(r.name);for(let n of t.added)for(let r of n.value)this.providerDescriptors.set(r.name,r);o!==this.hasSpeechProvider&&this.handleHasSpeechProviderChange()})}registerSpeechProvider(e,t){if(this.providers.has(e))throw new Error(`Speech provider with identifier ${e} is already registered.`);let o=this.hasSpeechProvider;return this.providers.set(e,t),o!==this.hasSpeechProvider&&this.handleHasSpeechProviderChange(),ee(()=>{let n=this.hasSpeechProvider;this.providers.delete(e),n!==this.hasSpeechProvider&&this.handleHasSpeechProviderChange()})}handleHasSpeechProviderChange(){this.hasSpeechProviderContext.set(this.hasSpeechProvider),this._onDidChangeHasSpeechProvider.fire()}get hasActiveSpeechToTextSession(){return this.activeSpeechToTextSessions>0}async createSpeechToTextSession(e,t="speech"){let o=await this.getProvider(),n=$Ot(this.configurationService.getValue(vwi)),r=o.createSpeechToTextSession(e,typeof n=="string"?{language:n}:void 0),s=Date.now(),l=!1,c=!1,u=0,p=new O,h=()=>{this.activeSpeechToTextSessions=Math.max(0,this.activeSpeechToTextSessions-1),this.hasActiveSpeechToTextSession||this.speechToTextInProgress.reset(),this._onDidEndSpeechToTextSession.fire(),this.telemetryService.publicLog2("speechToTextSession",{context:t,sessionDuration:Date.now()-s,sessionRecognized:l,sessionError:c,sessionContentLength:u,sessionLanguage:n}),p.dispose()};return p.add(e.onCancellationRequested(()=>h())),e.isCancellationRequested&&h(),p.add(r.onDidChange(g=>{switch(g.status){case 1:this.activeSpeechToTextSessions++,this.speechToTextInProgress.set(!0),this._onDidStartSpeechToTextSession.fire();break;case 2:l=!0;break;case 3:typeof g.text=="string"&&(u+=g.text.length);break;case 4:h();break;case 5:this.logService.error(`Speech provider error in speech to text session: ${g.text}`),c=!0;break}})),r}async getProvider(){await this.extensionService.activateByEvent("onSpeech");let e=Array.from(this.providers.values()).at(0);if(e)this.providers.size>1&&this.logService.warn(`Multiple speech providers registered. Picking first one: ${e.metadata.displayName}`);else throw new Error("No Speech provider is registered.");return e}get hasActiveTextToSpeechSession(){return this.activeTextToSpeechSessions>0}async createTextToSpeechSession(e,t="speech"){let o=await this.getProvider(),n=$Ot(this.configurationService.getValue(vwi)),r=o.createTextToSpeechSession(e,typeof n=="string"?{language:n}:void 0),s=Date.now(),l=!1,c=new O,u=p=>{this.activeTextToSpeechSessions=Math.max(0,this.activeTextToSpeechSessions-1),this.hasActiveTextToSpeechSession||this.textToSpeechInProgress.reset(),this._onDidEndTextToSpeechSession.fire(),this.telemetryService.publicLog2("textToSpeechSession",{context:t,sessionDuration:Date.now()-s,sessionError:l,sessionLanguage:n}),p&&c.dispose()};return c.add(e.onCancellationRequested(()=>u(!0))),e.isCancellationRequested&&u(!0),c.add(r.onDidChange(p=>{switch(p.status){case 1:this.activeTextToSpeechSessions++,this.textToSpeechInProgress.set(!0),this._onDidStartTextToSpeechSession.fire();break;case 2:u(!1);break;case 3:this.logService.error(`Speech provider error in text to speech session: ${p.text}`),l=!0;break}})),r}get hasActiveKeywordRecognition(){return this.activeKeywordRecognitionSessions>0}async recognizeKeyword(e){let t=new Mo,o=new O;o.add(e.onCancellationRequested(()=>{o.dispose(),t.complete(3)}));let n=o.add(new O),r,s=()=>{n.clear();let c=new qe(e);n.add(ee(()=>c.dispose(!0)));let u=r=this.doRecognizeKeyword(c.token).then(p=>{u===r&&t.complete(p)},p=>{u===r&&t.error(p)})};o.add(this.hostService.onDidChangeFocus(c=>{!c&&r?(n.clear(),r=void 0):r||s()})),this.hostService.hasFocus&&s();let l;try{l=await t.p}finally{o.dispose()}return this.telemetryService.publicLog2("keywordRecognition",{keywordRecognized:l===1}),l}async doRecognizeKeyword(e){let o=(await this.getProvider()).createKeywordRecognitionSession(e);this.activeKeywordRecognitionSessions++,this._onDidStartKeywordRecognition.fire();let n=new O,r=()=>{this.activeKeywordRecognitionSessions=Math.max(0,this.activeKeywordRecognitionSessions-1),this._onDidEndKeywordRecognition.fire(),n.dispose()};n.add(e.onCancellationRequested(()=>r())),e.isCancellationRequested&&r(),n.add(o.onDidChange(s=>{s.status===2&&r()}));try{return(await U.toPromise(o.onDidChange)).status}finally{r()}}};WVe=I([m(0,re),m(1,X),m(2,ti),m(3,_e),m(4,B),m(5,lt)],WVe);Ce(Gx,WVe,0);var VVe=class extends k{constructor(e){super();this.logService=e}getMcpServerConfigurationFromManifest(e,t){if(t==="remote"&&e.remotes?.length){let c=e.remotes[0].url,u=e.remotes[0].headers??[],{inputs:p,variables:h}=this.processKeyValueInputs(c.startsWith("https://api.githubcopilot.com/mcp")?u.filter(g=>g.name.toLowerCase()!=="authorization"):u);return{mcpServerConfiguration:{config:{type:"http",url:e.remotes[0].url,headers:Object.keys(p).length?p:void 0},inputs:h.length?h:void 0},notices:[]}}let o=e.packages?.find(c=>c.registryType===t)??e.packages?.[0];if(!o)throw new Error("No server package found");let n=[],r=[],s={},l=[];if(o.registryType==="oci"&&(n.push("run"),n.push("-i"),n.push("--rm")),o.runtimeArguments?.length){let c=this.processArguments(o.runtimeArguments??[]);n.push(...c.args),r.push(...c.variables),l.push(...c.notices)}if(o.environmentVariables?.length){let{inputs:c,variables:u,notices:p}=this.processKeyValueInputs(o.environmentVariables??[]);r.push(...u),l.push(...p);for(let[h,g]of Object.entries(c))s[h]=g,o.registryType==="oci"&&(n.push("-e"),n.push(h))}switch(o.registryType){case"npm":o.registryBaseUrl&&n.push("--registry",o.registryBaseUrl),n.push(o.version?`${o.identifier}@${o.version}`:o.identifier);break;case"pypi":o.registryBaseUrl&&n.push("--index-url",o.registryBaseUrl),n.push(o.version?`${o.identifier}@${o.version}`:o.identifier);break;case"oci":{let c=o.registryBaseUrl?`${o.registryBaseUrl}/${o.identifier}`:o.identifier;n.push(o.version?`${c}:${o.version}`:c);break}case"nuget":n.push(o.version?`${o.identifier}@${o.version}`:o.identifier),n.push("--yes"),o.registryBaseUrl&&n.push("--source",o.registryBaseUrl),o.packageArguments?.length&&n.push("--");break}if(o.packageArguments?.length){let c=this.processArguments(o.packageArguments);n.push(...c.args),r.push(...c.variables),l.push(...c.notices)}return{notices:l,mcpServerConfiguration:{config:{type:"stdio",command:this.getCommandName(o.registryType),args:n.length?n:void 0,env:Object.keys(s).length?s:void 0},inputs:r.length?r: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 t=[];for(let[o,n]of Object.entries(e))t.push({id:o,type:n.choices?"pickString":"promptString",description:n.description??"",password:!!n.isSecret,default:n.default,options:n.choices});return t}processKeyValueInputs(e){let t=[],o={},n=[];for(let r of e){let s=r.variables?this.getVariables(r.variables):[],l=r.value||"";if(s.length){for(let c of s)l=l.replace(`{${c.id}}`,`\${input:${c.id}}`);n.push(...s)}else!l&&(r.description||r.choices||r.default!==void 0)&&(n.push({id:r.name,type:r.choices?"pickString":"promptString",description:r.description??"",password:!!r.isSecret,default:r.default,options:r.choices}),l=`\${input:${r.name}}`);o[r.name]=l}return{inputs:o,variables:n,notices:t}}processArguments(e){let t=[],o=[],n=[];for(let r of e){let s=r.variables?this.getVariables(r.variables):[];if(r.type==="positional"){let l=r.value;if(l){for(let c of s)l=l.replace(`{${c.id}}`,`\${input:${c.id}}`);t.push(l),s.length&&o.push(...s)}else r.valueHint&&(r.description||r.default!==void 0)?(o.push({id:r.valueHint,type:"promptString",description:r.description??"",password:!1,default:r.default}),t.push(`\${input:${r.valueHint}}`)):t.push(r.valueHint??"")}else if(r.type==="named"){if(!r.name){n.push(`Named argument is missing a name. ${JSON.stringify(r)}`);continue}if(t.push(r.name),r.value){let l=r.value;for(let c of s)l=l.replace(`{${c.id}}`,`\${input:${c.id}}`);t.push(l),s.length&&o.push(...s)}else if(r.description||r.default!==void 0){let l=r.name.replace(/^--?/,"");o.push({id:l,type:"promptString",description:r.description??"",password:!1,default:r.default}),t.push(`\${input:${l}}`)}}}return{args:t,variables:o,notices:n}}};VVe=I([m(0,re)],VVe);var Uve=class extends VVe{constructor(e,t,o,n,r,s,l){super(s);this.mcpResource=e;this.target=t;this.mcpGalleryService=o;this.fileService=n;this.uriIdentityService=r;this.mcpResourceScannerService=l;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 Dt(()=>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}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 t=await this.mcpResourceScannerService.scanMcpServers(this.mcpResource,this.target);t.servers&&await Promise.allSettled(Object.entries(t.servers).map(async([o,n])=>{let r=await this.scanLocalServer(o,n,t.sandbox);e.set(o,r)}))}catch(t){throw this.logService.debug("Could not read user MCP servers:",t),t}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(){try{let e=await this.populateLocalServers(),t=[],o=[],n=[...this.local.keys()].filter(r=>!e.has(r));for(let r of n)this.local.delete(r);for(let[r,s]of e){let l=this.local.get(r);l?Qi(l,s)||(o.push(s),this.local.set(r,s)):(t.push(s),this.local.set(r,s))}for(let r of n)this.local.delete(r),this._onDidUninstallMcpServer.fire({name:r,mcpResource:this.mcpResource});o.length&&this._onDidUpdateMcpServers.fire(o.map(r=>({name:r.name,local:r,mcpResource:this.mcpResource}))),t.length&&this._onDidInstallMcpServers.fire(t.map(r=>({name:r.name,local:r,mcpResource:this.mcpResource})))}catch(e){this.logService.error("Failed to load installed MCP servers:",e)}}async getInstalled(){return await this.initialize(),Array.from(this.local.values())}async scanLocalServer(e,t,o){let n=await this.getLocalServerInfo(e,t);return n||(n={name:e,version:t.version,galleryUrl:We(t.gallery)?t.gallery:void 0}),{name:e,config:t,rootSandbox:o,mcpResource:this.mcpResource,version:n.version,location:n.location,displayName:n.displayName,description:n.description,publisher:n.publisher,publisherDisplayName:n.publisherDisplayName,galleryUrl:n.galleryUrl,galleryId:n.galleryId,repositoryUrl:n.repositoryUrl,readmeUrl:n.readmeUrl,icon:n.icon,codicon:n.codicon,manifest:n.manifest,source:t.gallery?"gallery":"local"}}async install(e,t){this.logService.trace("MCP Management Service: install",e.name),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,t){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(A.revive(e.location),{recursive:!0}),await this.updateLocal()}catch(o){throw this._onDidUninstallMcpServer.fire({name:e.name,error:o,mcpResource:this.mcpResource}),o}}};Uve=I([m(2,pq),m(3,ge),m(4,gt),m(5,re),m(6,$te)],Uve);var Zat=class extends Uve{constructor(i,e,t,o,n,r,s){super(i,2,e,t,o,n,r),this.mcpLocation=o.extUri.joinPath(s.userRoamingDataHome,"mcp")}async installFromGallery(i,e){throw new Error("Not supported")}async updateMetadata(i,e){await this.updateMetadataFromGallery(e),await this.updateLocal();let t=(await this.getInstalled()).find(o=>o.name===i.name);if(!t)throw new Error(`Failed to find MCP server: ${i.name}`);return t}async updateMetadataFromGallery(i){let e=i.configuration,t=this.getLocation(i.name,i.version),o=this.uriIdentityService.extUri.joinPath(t,"manifest.json"),n={galleryUrl:i.galleryUrl,galleryId:i.id,name:i.name,displayName:i.displayName,description:i.description,version:i.version,publisher:i.publisher,publisherDisplayName:i.publisherDisplayName,repositoryUrl:i.repositoryUrl,licenseUrl:i.license,icon:i.icon,codicon:i.codicon,manifest:e};if(await this.fileService.writeFile(o,Ke.fromString(JSON.stringify(n))),i.readmeUrl||i.readme){let r=i.readme?i.readme:await this.mcpGalleryService.getReadme(i,Ie.None);await this.fileService.writeFile(this.uriIdentityService.extUri.joinPath(t,"README.md"),Ke.fromString(r))}return e}async getLocalServerInfo(i,e){let t,o,n;if(e.gallery){o=this.getLocation(i,e.version);let r=this.uriIdentityService.extUri.joinPath(o,"manifest.json");try{let s=await this.fileService.readFile(r);t=JSON.parse(s.value.toString()),t.galleryUrl?.includes("/v0/")&&(t.galleryUrl=t.galleryUrl.substring(0,t.galleryUrl.indexOf("/v0/")),await this.fileService.writeFile(r,Ke.fromString(JSON.stringify(t)))),t.location=o,n=this.uriIdentityService.extUri.joinPath(o,"README.md"),await this.fileService.exists(n)||(n=void 0),t.readmeUrl=n}catch(s){this.logService.error("MCP Management Service: failed to read manifest",o.toString(),s)}}return t}getLocation(i,e){return i=i.replace("/","."),this.uriIdentityService.extUri.joinPath(this.mcpLocation,e?`${i}-${e}`:i)}installFromUri(i,e){throw new Error("Method not supported.")}canInstall(){throw new Error("Not supported")}};Zat=I([m(1,pq),m(2,ge),m(3,gt),m(4,re),m(5,$te),m(6,ko)],Zat);var u$=class extends VVe{constructor(e,t){super(t);this.allowedMcpServersService=e}canInstall(e){let t=this.allowedMcpServersService.isAllowed(e);return t!==!0?new he(d(2422,null,t.value)):!0}};u$=I([m(0,fP),m(1,re)],u$);var ljt=class extends u${constructor(e,t,o,n){super(e,t);this.userDataProfilesService=o;this.instantiationService=n;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 dt}getMcpResourceManagementService(e){let t=this.mcpResourceManagementServices.get(e);if(!t){let o=new O,n=o.add(this.createMcpResourceManagementService(e));o.add(n.onInstallMcpServer(r=>this._onInstallMcpServer.fire(r))),o.add(n.onDidInstallMcpServers(r=>this._onDidInstallMcpServers.fire(r))),o.add(n.onDidUpdateMcpServers(r=>this._onDidUpdateMcpServers.fire(r))),o.add(n.onUninstallMcpServer(r=>this._onUninstallMcpServer.fire(r))),o.add(n.onDidUninstallMcpServer(r=>this._onDidUninstallMcpServer.fire(r))),this.mcpResourceManagementServices.set(e,t={service:n,dispose:()=>o.dispose()})}return t.service}async getInstalled(e){let t=e||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(t).getInstalled()}async install(e,t){let o=t?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).install(e,t)}async uninstall(e,t){let o=t?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).uninstall(e,t)}async installFromGallery(e,t){let o=t?.mcpResource||this.userDataProfilesService.defaultProfile.mcpResource;return this.getMcpResourceManagementService(o).installFromGallery(e,t)}async updateMetadata(e,t,o){return this.getMcpResourceManagementService(o||this.userDataProfilesService.defaultProfile.mcpResource).updateMetadata(e,t)}dispose(){this.mcpResourceManagementServices.forEach(e=>e.dispose()),this.mcpResourceManagementServices.clear(),super.dispose()}createMcpResourceManagementService(e){return this.instantiationService.createInstance(Zat,e)}};ljt=I([m(0,fP),m(1,re),m(2,hn),m(3,F)],ljt);function elt(a,i){return a?A.revive(i?i.transformIncoming(a):a):void 0}function BVe(a,i){i=i||R1t;let e=a.manifest;return{...L1t({...a,manifest:void 0},i),manifest:e}}var Hne=class extends u${constructor(e,t,o){super(t,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")(n=>this._onInstallMcpServer.fire({...n,mcpResource:elt(n.mcpResource,null)}))),this._register(this.channel.listen("onDidInstallMcpServers")(n=>this._onDidInstallMcpServers.fire(n.map(r=>({...r,local:r.local?BVe(r.local,null):r.local,mcpResource:elt(r.mcpResource,null)}))))),this._register(this.channel.listen("onDidUpdateMcpServers")(n=>this._onDidUpdateMcpServers.fire(n.map(r=>({...r,local:r.local?BVe(r.local,null):r.local,mcpResource:elt(r.mcpResource,null)}))))),this._register(this.channel.listen("onUninstallMcpServer")(n=>this._onUninstallMcpServer.fire({...n,mcpResource:elt(n.mcpResource,null)}))),this._register(this.channel.listen("onDidUninstallMcpServer")(n=>this._onDidUninstallMcpServer.fire({...n,mcpResource:elt(n.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,t){return Promise.resolve(this.channel.call("install",[e,t])).then(o=>BVe(o,null))}installFromGallery(e,t){return Promise.resolve(this.channel.call("installFromGallery",[e,t])).then(o=>BVe(o,null))}uninstall(e,t){return Promise.resolve(this.channel.call("uninstall",[e,t]))}getInstalled(e){return Promise.resolve(this.channel.call("getInstalled",[e])).then(t=>t.map(o=>BVe(o,null)))}updateMetadata(e,t,o){return Promise.resolve(this.channel.call("updateMetadata",[e,t,o])).then(n=>BVe(n,null))}};Hne=I([m(1,fP),m(2,re)],Hne);var FOi="usrlocal",WOi="usrremote",VOi="workspace",BOi="ws";var V6=kbo,HVe=class extends u${constructor(e,t,o,n,r,s,l,c,u,p){super(t,o);this.mcpManagementService=e;this.userDataProfileService=n;this.uriIdentityService=r;this.workspaceContextService=s;this.userDataProfilesService=c;this.remoteUserDataProfilesService=u;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(p.createInstance(ilt));let h=l.getConnection();h&&(this.remoteMcpManagementService=this._register(p.createInstance(Hne,h.getChannel("mcpManagement")))),this._register(this.mcpManagementService.onInstallMcpServer(g=>{this._onInstallMcpServer.fire(g),r.extUri.isEqual(g.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&this._onInstallMcpServerInCurrentProfile.fire({...g,scope:"user"})})),this._register(this.mcpManagementService.onDidInstallMcpServers(g=>{let{mcpServerInstallResult:f,mcpServerInstallResultInCurrentProfile:v}=this.createInstallMcpServerResultsFromEvent(g,"user");this._onDidInstallMcpServers.fire(f),v.length&&this._onDidInstallMcpServersInCurrentProfile.fire(v)})),this._register(this.mcpManagementService.onDidUpdateMcpServers(g=>{let{mcpServerInstallResult:f,mcpServerInstallResultInCurrentProfile:v}=this.createInstallMcpServerResultsFromEvent(g,"user");this._onDidUpdateMcpServers.fire(f),v.length&&this._onDidUpdateMcpServersInCurrentProfile.fire(v)})),this._register(this.mcpManagementService.onUninstallMcpServer(g=>{this._onUninstallMcpServer.fire(g),r.extUri.isEqual(g.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&this._onUninstallMcpServerInCurrentProfile.fire({...g,scope:"user"})})),this._register(this.mcpManagementService.onDidUninstallMcpServer(g=>{this._onDidUninstallMcpServer.fire(g),r.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:f}=this.createInstallMcpServerResultsFromEvent(g,"workspace");this._onDidInstallMcpServers.fire(f),this._onDidInstallMcpServersInCurrentProfile.fire(f)})),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:f}=this.createInstallMcpServerResultsFromEvent(g,"workspace");this._onDidUpdateMcpServers.fire(f),this._onDidUpdateMcpServersInCurrentProfile.fire(f)})),this.remoteMcpManagementService&&(this._register(this.remoteMcpManagementService.onInstallMcpServer(async g=>{this._onInstallMcpServer.fire(g);let f=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(f?r.extUri.isEqual(g.mcpResource,f):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 f=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(f?r.extUri.isEqual(g.mcpResource,f):this.userDataProfileService.currentProfile.isDefault)&&this._onUninstallMcpServerInCurrentProfile.fire({...g,scope:"remoteUser"})})),this._register(this.remoteMcpManagementService.onDidUninstallMcpServer(async g=>{this._onDidUninstallMcpServer.fire(g);let f=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);(f?r.extUri.isEqual(g.mcpResource,f):this.userDataProfileService.currentProfile.isDefault)&&this._onDidUninstallMcpServerInCurrentProfile.fire({...g,scope:"remoteUser"})}))),this._register(n.onDidChangeCurrentProfile(g=>{this.uriIdentityService.extUri.isEqual(g.previous.mcpResource,g.profile.mcpResource)||this._onDidChangeProfile.fire()}))}createInstallMcpServerResultsFromEvent(e,t){let o=[],n=[];for(let r of e){let s={...r,local:r.local?this.toWorkspaceMcpServer(r.local,t):void 0};o.push(s),this.uriIdentityService.extUri.isEqual(r.mcpResource,this.userDataProfileService.currentProfile.mcpResource)&&n.push(s)}return{mcpServerInstallResult:o,mcpServerInstallResultInCurrentProfile:n}}async handleRemoteInstallMcpServerResultsFromEvent(e,t,o){let n=[],r=[],s=await this.getRemoteMcpResource(this.userDataProfileService.currentProfile.mcpResource);for(let l of e){let c={...l,local:l.local?this.toWorkspaceMcpServer(l.local,"remoteUser"):void 0};n.push(c),(s?this.uriIdentityService.extUri.isEqual(l.mcpResource,s):this.userDataProfileService.currentProfile.isDefault)&&r.push(c)}t.fire(n),r.length&&o.fire(r)}async getInstalled(){let e=[],[t,o,n]=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 r of t)e.push(this.toWorkspaceMcpServer(r,"user"));for(let r of o)e.push(this.toWorkspaceMcpServer(r,"remoteUser"));for(let r of n)e.push(this.toWorkspaceMcpServer(r,"workspace"));return e}toWorkspaceMcpServer(e,t){return{...e,id:`mcp.config.${this.getConfigId(e,t)}.${e.name}`,scope:t}}getConfigId(e,t){if(t==="user")return FOi;if(t==="remoteUser")return WOi;if(t==="workspace"){let o=this.workspaceContextService.getWorkspace();if(o.configuration&&this.uriIdentityService.extUri.isEqual(o.configuration,e.mcpResource))return VOi;let n=o.folders;for(let r=0;r<n.length;r++){let s=n[r];if(this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.joinPath(s.uri,kR[yb]),e.mcpResource))return`${BOi}${r}`}}return"unknown"}async install(e,t){if(t=t??{},t.target===5||eC(t.target)){let n=t.target===5?this.workspaceContextService.getWorkspace().configuration:t.target.toResource(kR[yb]);if(!n)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=n;let r=await this.workspaceMcpManagementService.install(e,t);return this.toWorkspaceMcpServer(r,"workspace")}if(t.target===4){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=await this.getRemoteMcpResource(t.mcpResource);let n=await this.remoteMcpManagementService.install(e,t);return this.toWorkspaceMcpServer(n,"remoteUser")}if(t.target&&t.target!==2&&t.target!==3)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=this.userDataProfileService.currentProfile.mcpResource;let o=await this.mcpManagementService.install(e,t);return this.toWorkspaceMcpServer(o,"user")}async installFromGallery(e,t){if(t=t??{},t.target===5||eC(t.target)){let n=t.target===5?this.workspaceContextService.getWorkspace().configuration:t.target.toResource(kR[yb]);if(!n)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=n;let r=await this.workspaceMcpManagementService.installFromGallery(e,t);return this.toWorkspaceMcpServer(r,"workspace")}if(t.target===4){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${t.target}`);t.mcpResource=await this.getRemoteMcpResource(t.mcpResource);let n=await this.remoteMcpManagementService.installFromGallery(e,t);return this.toWorkspaceMcpServer(n,"remoteUser")}if(t.target&&t.target!==2&&t.target!==3)throw new Error(`Illegal target: ${t.target}`);t.mcpResource||(t.mcpResource=this.userDataProfileService.currentProfile.mcpResource);let o=await this.mcpManagementService.installFromGallery(e,t);return this.toWorkspaceMcpServer(o,"user")}async updateMetadata(e,t,o){if(e.scope==="workspace"){let r=await this.workspaceMcpManagementService.updateMetadata(e,t,o);return this.toWorkspaceMcpServer(r,"workspace")}if(e.scope==="remoteUser"){if(!this.remoteMcpManagementService)throw new Error(`Illegal target: ${e.scope}`);let r=await this.remoteMcpManagementService.updateMetadata(e,t,o);return this.toWorkspaceMcpServer(r,"remoteUser")}let n=await this.mcpManagementService.updateMetadata(e,t,o);return this.toWorkspaceMcpServer(n,"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 t=this.userDataProfilesService.profiles.find(o=>this.uriIdentityService.extUri.isEqual(o.mcpResource,e));return t?t=await this.remoteUserDataProfilesService.getRemoteProfile(t):t=(await this.remoteUserDataProfilesService.getRemoteProfiles()).find(o=>this.uriIdentityService.extUri.isEqual(o.mcpResource,e)),t?.mcpResource}};HVe=I([m(1,fP),m(2,re),m(3,gn),m(4,gt),m(5,Ae),m(6,bo),m(7,hn),m(8,jN),m(9,F)],HVe);var tlt=class extends Uve{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s)}async installFromGallery(i,e){this.logService.trace("MCP Management Service: installGallery",i.name,i.galleryUrl),this._onInstallMcpServer.fire({name:i.name,mcpResource:this.mcpResource});try{let t=e?.packageType??i.configuration.packages?.[0]?.registryType??"remote",{mcpServerConfiguration:o,notices:n}=this.getMcpServerConfigurationFromManifest(i.configuration,t);n.length>0&&this.logService.warn(`MCP Management Service: Warnings while installing ${i.name}`,n);let r={name:i.name,config:{...o.config,gallery:i.galleryUrl??!0,version:i.version},inputs:o.inputs};await this.mcpResourceScannerService.addMcpServers([r],this.mcpResource,this.target),await this.updateLocal();let s=(await this.getInstalled()).find(l=>l.name===i.name);if(!s)throw new Error(`Failed to install MCP server: ${i.name}`);return s}catch(t){throw this._onDidInstallMcpServers.fire([{name:i.name,source:i,error:t,mcpResource:this.mcpResource}]),t}}updateMetadata(){throw new Error("Not supported")}installFromUri(){throw new Error("Not supported")}async getLocalServerInfo(i,e){if(!e.gallery)return;let[t]=await this.mcpGalleryService.getMcpServersFromGallery([{name:i}]);if(t)return{name:t.name,version:e.version,displayName:t.displayName,description:t.description,galleryUrl:t.galleryUrl,manifest:t.configuration,publisher:t.publisher,publisherDisplayName:t.publisherDisplayName,repositoryUrl:t.repositoryUrl,icon:t.icon}}canInstall(i){throw new Error("Not supported")}};tlt=I([m(2,pq),m(3,ge),m(4,gt),m(5,re),m(6,$te)],tlt);var ilt=class extends u${constructor(e,t,o,n,r){super(e,o);this.uriIdentityService=t;this.workspaceContextService=n;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.allMcpServers=[];this.workspaceMcpManagementServices=new dt;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(t=>this.removeWorkspaceService(t.toResource(kR[yb]))))}catch(t){this.logService.error(t)}try{await Promise.allSettled(e.added.map(t=>this.addWorkspaceService(t.toResource(kR[yb]),6)))}catch(t){this.logService.error(t)}}async addWorkspaceService(e,t){if(this.workspaceMcpManagementServices.has(e))return;let o=new O,n=o.add(this.instantiationService.createInstance(tlt,e,t));try{let r=await n.getInstalled();if(this.allMcpServers.push(...r),r.length>0){let s=r.map(l=>({name:l.name,local:l,mcpResource:l.mcpResource}));this._onDidInstallMcpServers.fire(s)}}catch(r){this.logService.warn("Failed to get installed servers from",e.toString(),r)}o.add(n.onInstallMcpServer(r=>this._onInstallMcpServer.fire(r))),o.add(n.onDidInstallMcpServers(r=>{for(let{local:s}of r)s&&this.allMcpServers.push(s);this._onDidInstallMcpServers.fire(r)})),o.add(n.onDidUpdateMcpServers(r=>{for(let{local:s,mcpResource:l}of r)if(s){let c=this.allMcpServers.findIndex(u=>this.uriIdentityService.extUri.isEqual(u.mcpResource,l)&&u.name===s.name);c!==-1&&this.allMcpServers.splice(c,1,s)}this._onDidUpdateMcpServers.fire(r)})),o.add(n.onUninstallMcpServer(r=>this._onUninstallMcpServer.fire(r))),o.add(n.onDidUninstallMcpServer(r=>{let s=this.allMcpServers.findIndex(l=>this.uriIdentityService.extUri.isEqual(l.mcpResource,r.mcpResource)&&l.name===r.name);s!==-1&&(this.allMcpServers.splice(s,1),this._onDidUninstallMcpServer.fire(r))})),this.workspaceMcpManagementServices.set(e,{service:n,dispose:()=>o.dispose()})}async removeWorkspaceService(e){let t=this.workspaceMcpManagementServices.get(e);if(t){try{let o=await t.service.getInstalled();this.allMcpServers=this.allMcpServers.filter(n=>!o.some(r=>this.uriIdentityService.extUri.isEqual(r.mcpResource,n.mcpResource)));for(let n of o)this._onDidUninstallMcpServer.fire({name:n.name,mcpResource:n.mcpResource})}catch(o){this.logService.warn("Failed to get installed servers from",e.toString(),o)}this.workspaceMcpManagementServices.delete(e),t.dispose()}}async getInstalled(){return this.allMcpServers}async install(e,t){if(!t?.mcpResource)throw new Error("MCP resource is required");let o=this.workspaceMcpManagementServices.get(t?.mcpResource);if(!o)throw new Error(`No MCP management service found for resource: ${t?.mcpResource.toString()}`);return o.service.install(e,t)}async uninstall(e,t){let o=e.mcpResource,n=this.workspaceMcpManagementServices.get(o);if(!n)throw new Error(`No MCP management service found for resource: ${o.toString()}`);return n.service.uninstall(e,t)}installFromGallery(e,t){if(!t?.mcpResource)throw new Error("MCP resource is required");let o=this.workspaceMcpManagementServices.get(t?.mcpResource);if(!o)throw new Error(`No MCP management service found for resource: ${t?.mcpResource.toString()}`);return o.service.installFromGallery(e,t)}updateMetadata(){throw new Error("Not supported")}dispose(){this.workspaceMcpManagementServices.forEach(e=>e.dispose()),this.workspaceMcpManagementServices.clear(),super.dispose()}};ilt=I([m(0,fP),m(1,gt),m(2,re),m(3,Ae),m(4,F)],ilt);var olt={2:{title:d(12968,null),placeholder:d(12967,null),pickLabel:d(12985,null),pickDescription:d(12986,null),enabledConfigKey:null},3:{title:d(12972,null),placeholder:d(12971,null),pickLabel:d(12989,null),pickDescription:d(12990,null),enabledConfigKey:null},4:{title:d(12970,null),placeholder:d(12969,null),pickLabel:d(12987,null),pickDescription:d(12988,null),enabledConfigKey:"chat.mcp.assisted.nuget.enabled"},5:{title:d(12952,null),placeholder:d(12951,null),pickLabel:d(12980,null),pickDescription:d(12981,null),enabledConfigKey:null}};var UVe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){this.workspaceFolder=i;this._quickInputService=e;this._mcpManagementService=t;this._workspaceService=o;this._environmentService=n;this._commandService=r;this._mcpRegistry=s;this._openerService=l;this._editorService=c;this._fileService=u;this._notificationService=p;this._telemetryService=h;this._mcpService=g;this._label=f;this._configurationService=v}async getServerType(){let i=[{kind:0,label:d(12977,null),description:d(12978,null)},{kind:1,label:d(12982,null),description:d(12983,null)}],e;try{e=await this._commandService.executeCommand("github.copilot.chat.mcp.setup.check")}catch{}if(e){i.unshift({type:"separator",label:d(12984,null)});let n=Object.entries(olt).map(([r,{pickLabel:s,pickDescription:l,enabledConfigKey:c}])=>{if(!(c&&!(this._configurationService.getValue(c)??!1)))return{kind:Number(r),label:s,description:l}}).filter(r=>!!r);i.push({type:"separator",label:d(12979,null)},...n)}i.push({type:"separator"});let t=this._configurationService.getValue(xie);t&&typeof t=="object"&&uNe.some(n=>!t[n])&&i.push({kind:"discovery",label:d(12976,null)}),i.push({kind:"browse",label:d(12975,null)});let o=await this._quickInputService.pick(i,{placeHolder:d(12991,null)});if(o?.kind==="browse"){this._commandService.executeCommand("workbench.mcp.browseServers");return}if(o?.kind==="discovery"){this._commandService.executeCommand("workbench.action.openSettings",xie);return}return o?.kind}async getStdioConfig(){let i=await this._quickInputService.input({title:d(12949,null),placeHolder:d(12948,null),ignoreFocusLost:!0});if(!i)return;this._telemetryService.publicLog2("mcp.addserver",{packageType:"stdio"});let e=i.match(/(?:[^\s"]+|"[^"]*")+/g);return{type:"stdio",command:e[0].replace(/"/g,""),args:e.slice(1).map(t=>t.replace(/"/g,""))}}async getSSEConfig(){let i=await this._quickInputService.input({title:d(13002,null),placeHolder:d(13001,null),ignoreFocusLost:!0});if(i)return this._telemetryService.publicLog2("mcp.addserver",{packageType:"sse"}),{url:i,type:"http"}}async getServerId(i=`my-mcp-server-${ht().split("-")[0]}`){return await this._quickInputService.input({title:d(12974,null),placeHolder:d(12973,null),value:i,ignoreFocusLost:!0})}async getConfigurationTarget(){let i=[{target:3,label:d(12996,null),description:d(12997,null)}],e=this._environmentService.remoteAuthority&&this._label.getHostLabel(Q.vscodeRemote,this._environmentService.remoteAuthority);e&&i.push({target:4,label:d(12994,null),description:d(12992,null,e)});let t=this._workspaceService.getWorkbenchState();if(t!==1){let n=t===2?this._workspaceService.getWorkspace().folders[0]:5;this._environmentService.remoteAuthority?i.push({target:n,label:d(12998,null),description:d(13000,null,e)}):i.push({target:n,label:d(12998,null),description:d(12999,null)})}return i.length===1?i[0].target:(await this._quickInputService.pick(i,{title:d(12995,null),placeHolder:d(12993,null)}))?.target}async getAssistedConfig(i){let e=await this._quickInputService.input({ignoreFocusLost:!0,title:olt[i].title,placeHolder:olt[i].placeholder});if(!e)return;let t;(g=>(g.Retry="retry",g.Cancel="cancel",g.Allow="allow",g.OpenUri="openUri"))(t||={});let o=new O,n=o.add(this._quickInputService.createQuickPick());n.title=d(12966,null),n.busy=!0,n.ignoreFocusOut=!0;let r=this.getPackageType(i);this._telemetryService.publicLog2("mcp.addserver",{packageType:r}),this._commandService.executeCommand("github.copilot.chat.mcp.setup.validatePackage",{type:r,name:e,targetConfig:{...nnt,properties:{...nnt.properties,name:{type:"string",description:"Suggested name of the server, alphanumeric and hyphen only"}},required:[...nnt.required||[],"name"]}}).then(c=>{if(!c||c.state==="error"){n.title=c?.error||"Unknown error loading package";let u=[];c?.helpUri&&u.push({id:"openUri",label:c.helpUriLabel??d(12953,null),helpUri:A.parse(c.helpUri)}),u.push({id:"retry",label:d(12954,null)},{id:"cancel",label:d(12941,null)}),n.items=u}else n.title=d(12950,null,c.name??e,c.version?`@${c.version}`:"",c.publisher),n.items=[{id:"allow",label:d(12940,null)},{id:"cancel",label:d(12941,null)}];n.busy=!1});let s=await new Promise(c=>{o.add(n.onDidAccept(()=>c(n.selectedItems[0]))),o.add(n.onDidHide(()=>c(void 0))),n.show()}).finally(()=>o.dispose());switch(s?.id){case"retry":return this.getAssistedConfig(i);case"openUri":s.helpUri&&this._openerService.open(s.helpUri);return;case"allow":break;default:return}let l=await this._commandService.executeCommand("github.copilot.chat.mcp.setup.flow",{name:e,type:r});if(l?.type==="mapped")return{name:l.name,server:l.server,inputs:l.inputs};if(l?.type==="assisted"||!l?.type)return l;bs(l?.type)}showOnceDiscovered(i){let e=new O;e.add(ve(t=>{let o=this._mcpRegistry.collections.read(t),n=this._mcpService.servers.read(t),r=iD(o,l=>iD(l.serverDefinitions.read(t),c=>c.label===i?{server:c,collection:l}:void 0)),s=r&&n.find(l=>l.definition.id===r.server.id);r&&s&&(r.collection.presentation?.origin?this._editorService.openEditor({resource:r.collection.presentation.origin,options:{selection:r.server.presentation?.origin?.range,preserveFocus:!0}}):this._commandService.executeCommand("workbench.mcp.serverOptions",i),s.start({promptType:"all-untrusted"}).then(l=>{l.state===Sr.Kind.Error&&s.showOutput()}),e.dispose())})),e.add(Zo(()=>e.dispose(),5e3))}async run(){let i=await this.getServerType();if(i===void 0)return;let e,t,o,n;switch(i){case 0:e=await this.getStdioConfig();break;case 1:e=await this.getSSEConfig();break;case 2:case 3:case 4:case 5:{let c=await this.getAssistedConfig(i);e=c?.server?{...c.server,type:"stdio"}:void 0,t=c?.name,o=c?.inputs,n=c?.inputValues;break}default:bs(i)}if(!e)return;let r=await this.getServerId(t);if(!r)return;let s=this.workspaceFolder;if(!s&&(s=await this.getConfigurationTarget(),!s))return;if(await this._mcpManagementService.install({name:r,config:e,inputs:o},{target:s}),n)for(let[c,u]of Object.entries(n))await this._mcpRegistry.setSavedInput(c,(eC(s)?6:s)??5,u);let l=this.getPackageType(i);l&&this._telemetryService.publicLog2("mcp.addserver.completed",{packageType:l,serverType:e.type,target:s===5?"workspace":"user"}),this.showOnceDiscovered(r)}async pickForUrlHandler(i,e=!1){let t=decodeURIComponent(Be(i)).replace(/\.json$/,""),o=d(12947,null,t),n=[{id:"install",label:d(12946,null)},{id:"show",label:d(12945,null,t)},{id:"rename",label:d(12944,null,t)},{id:"cancel",label:d(12941,null)}];e&&([n[0],n[1]]=[n[1],n[0]]);let r=await this._quickInputService.pick(n,{placeHolder:o,ignoreFocusLost:!0}),s=()=>this._editorService.findEditors(i);switch(r?.id){case"show":await this._editorService.openEditor({resource:i});break;case"install":await this._editorService.save(s());try{let l=await this._fileService.readFile(i),{inputs:c,...u}=A_(l.value.toString());await this._mcpManagementService.install({name:t,config:u,inputs:c}),this._editorService.closeEditors(s()),this.showOnceDiscovered(t)}catch(l){this._notificationService.error(d(12942,null,t,l.message)),await this._editorService.openEditor({resource:i})}break;case"rename":{let l=await this._quickInputService.input({placeHolder:d(12943,null),value:t});if(l){let c=i.with({path:`/${encodeURIComponent(l)}.json`});return await this._editorService.save(s()),await this._fileService.move(i,c),this.pickForUrlHandler(c,e)}break}}}getPackageType(i){switch(i){case 2:return"npm";case 3:return"pip";case 4:return"nuget";case 5:return"docker";case 0:return"stdio";case 1:return"sse";default:return}}};UVe=I([m(1,$e),m(2,V6),m(3,Ae),m(4,Mt),m(5,fe),m(6,xc),m(7,Je),m(8,ie),m(9,ge),m(10,Ne),m(11,_e),m(12,Vs),m(13,nt),m(14,B)],UVe);var zVe=class{constructor(i,e,t,o,n,r){this._fileDialogService=i;this._fileService=e;this._quickInputService=t;this._notificationService=o;this._mcpManagementService=n;this._logService=r}async run(){let i=await this._fileDialogService.showOpenDialog({title:d(12965,null),filters:[{name:d(12955,null),extensions:["json"]}],canSelectFiles:!0,canSelectMany:!1,openLabel:FB(d(12959,null))});if(!i?.[0])return;let e=i[0],t;try{let c=await this._fileService.readFile(e);t=A_(c.value.toString())}catch(c){this._notificationService.error(d(12961,null,c.message));return}if(!t||typeof t!="object"){this._notificationService.error(d(12957,null));return}let o=t,n;if(Array.isArray(o.packages)&&o.packages.length>0)n=o.packages[0].registryType;else if(Array.isArray(o.remotes)&&o.remotes.length>0)n="remote";else{this._notificationService.error(d(12958,null));return}let r,s;try{let{mcpServerConfiguration:c,notices:u}=this._mcpManagementService.getMcpServerConfigurationFromManifest(o,n);r=c.config,s=c.inputs,u.length>0&&this._logService.warn(`MCP Management Service: Warnings while installing the MCP server from ${e.path}`,u)}catch(c){this._notificationService.error(d(12960,null,c.message));return}let l=o.name;if(!(!l&&(l=await this._quickInputService.input({title:d(12963,null),placeHolder:d(12962,null),value:Be(e).replace(/\.json$/i,""),ignoreFocusLost:!0}),!l)))try{await this._mcpManagementService.install({name:l,config:r,inputs:s}),this._notificationService.info(d(12964,null,l))}catch(c){this._notificationService.error(d(12956,null,c.message))}}};zVe=I([m(0,nn),m(1,ge),m(2,$e),m(3,Ne),m(4,V6),m(5,re)],zVe);var KVe=class extends k{constructor(e,t){super();this.delegate=e;this.logService=t;this._models=new s5;this._modelsToDispose=new Set;this._pendingDisposals=new Set;this._modelCreateOwners=new Map;this._referenceOwners=new Map;this._referenceOwnerIds=0;this._onDidDisposeModel=this._register(new T);this.onDidDisposeModel=this._onDidDisposeModel.event;this._onDidCreateModel=this._register(new T);this.onDidCreateModel=this._onDidCreateModel.event;let o=this;this._refCollection=new class extends ix{createReferencedObject(n,r,s){return o.createReferencedObject(n,r,s)}destroyReferencedObject(n,r){return o.destroyReferencedObject(n,r)}}}get observable(){return this._models.observable}values(){return this._models.values()}get(e){return this._models.get(this.toKey(e))}has(e){return this._models.has(this.toKey(e))}acquireExisting(e,t){let o=this.toKey(e);if(this._models.has(o))return this.wrapReference(o,this._refCollection.acquire(o,void 0,t),t)}acquireOrCreate(e,t){let o=this.toKey(e.sessionResource);return this.wrapReference(o,this._refCollection.acquire(o,e,t),t)}getReferenceDebugSnapshot(){let e=Array.from(this._models.values()).map(t=>{let o=this.toKey(t.sessionResource),n=this._referenceOwners.get(o)??new Map,r=new Map;for(let l of n.values())r.set(l,(r.get(l)??0)+1);let s=Array.from(r.entries()).map(([l,c])=>({holder:l,count:c})).sort((l,c)=>c.count-l.count||l.holder.localeCompare(c.holder));return{sessionResource:t.sessionResource,title:t.title,createdBy:this._modelCreateOwners.get(o)??"unknown",initialLocation:t.initialLocation,isImported:!!t.isImported,willKeepAlive:t.willKeepAlive,hasPendingEdits:!!t.editingSession?.entries.get().some(l=>l.state.get()===0),pendingDisposal:this._modelsToDispose.has(o),referenceCount:n.size,holders:s}}).sort((t,o)=>o.referenceCount-t.referenceCount||Number(o.hasPendingEdits)-Number(t.hasPendingEdits)||t.sessionResource.toString().localeCompare(o.sessionResource.toString()));return{totalModels:e.length,totalReferences:e.reduce((t,o)=>t+o.referenceCount,0),models:e}}createReferencedObject(e,t,o){this._modelsToDispose.delete(e);let n=this._models.get(e);if(n)return n;if(!t)throw new Error(`No start session props provided for chat session ${e}`);this.logService.trace(`Creating chat session ${e}`);let r=this.delegate.createModel(t);if(this._modelCreateOwners.set(e,o??"unspecified"),r.sessionResource.toString()!==e)throw new Error(`Chat session key mismatch for ${e}`);return this._models.set(e,r),this._onDidCreateModel.fire(r),r}destroyReferencedObject(e,t){this._modelsToDispose.add(e);let o=this.doDestroyReferencedObject(e,t);this._pendingDisposals.add(o),o.finally(()=>{this._pendingDisposals.delete(o)})}async doDestroyReferencedObject(e,t){try{await this.delegate.willDisposeModel(t)}catch(o){this.logService.error(o)}finally{this._modelsToDispose.has(e)&&(this.logService.trace(`Disposing chat session ${e}`),this._models.delete(e),this._modelCreateOwners.delete(e),this._referenceOwners.delete(e),this._onDidDisposeModel.fire(t),t.dispose()),this._modelsToDispose.delete(e)}}wrapReference(e,t,o){let n=++this._referenceOwnerIds,r=this._referenceOwners.get(e);r||(r=new Map,this._referenceOwners.set(e,r)),r.set(n,o??"unspecified");let s=!1,l={object:t.object,dispose:()=>{if(s)return;s=!0;let c=this._referenceOwners.get(e);c?.delete(n),c?.size===0&&this._referenceOwners.delete(e),t.dispose(),l.object=null}};return l}async waitForModelDisposals(){await Promise.all(this._pendingDisposals)}toKey(e){return e.toString()}dispose(){super.dispose(),this._models.forEach(e=>e.dispose())}};KVe=I([m(1,re)],KVe);var GVe=class{constructor(i){this.telemetryService=i}notifyUserAction(i){i.action.kind==="vote"?this.telemetryService.publicLog2("interactiveSessionVote",{direction:i.action.direction===1?"up":"down",agentId:i.agentId??"",command:i.command}):i.action.kind==="copy"?this.telemetryService.publicLog2("interactiveSessionCopy",{copyKind:i.action.copyKind===1?"action":"toolbar",agentId:i.agentId??"",command:i.command}):i.action.kind==="insert"?this.telemetryService.publicLog2("interactiveSessionInsert",{newFile:!!i.action.newFile,agentId:i.agentId??"",command:i.command}):i.action.kind==="apply"?this.telemetryService.publicLog2("interactiveSessionApply",{newFile:!!i.action.newFile,codeMapper:i.action.codeMapper,agentId:i.agentId??"",command:i.command,editsProposed:!!i.action.editsProposed}):i.action.kind==="runInTerminal"?this.telemetryService.publicLog2("interactiveSessionRunInTerminal",{languageId:i.action.languageId??"",agentId:i.agentId??"",command:i.command}):i.action.kind==="followUp"?this.telemetryService.publicLog2("chatFollowupClicked",{agentId:i.agentId??"",command:i.command}):i.action.kind==="chatEditingHunkAction"&&this.telemetryService.publicLog2("chatEditHunk",{agentId:i.agentId??"",outcome:i.action.outcome,lineCount:i.action.lineCount,hasRemainingEdits:i.action.hasRemainingEdits,requestId:i.requestId,modelId:Wwe(i.modelId)??"",modeId:i.modeId??""})}retrievedFollowups(i,e,t){this.telemetryService.publicLog2("chatFollowupsRetrieved",{agentId:i,command:e,numFollowups:t})}};GVe=I([m(0,_e)],GVe);function Egn(a){let i=a.split(`
`),e=[],t;for(let o=0;o<i.length;o++){let n=i[o];if(t)new RegExp(`^\\s*${t.delimiter}\\s*$`).test(n)&&(e.push(t.languageId),t=void 0);else{let r=n.match(/^(\s*)(`{3,}|~{3,})(\w*)/);r&&(t={delimiter:r[2],languageId:r[3]})}}return e}var qVe=class{constructor(i,e,t){this.opts=i;this.telemetryService=e;this.languageModelsService=t;this.isComplete=!1}complete({timeToFirstProgress:i,totalTime:e,result:t,requestType:o,request:n,detectedAgent:r}){this.isComplete||(this.isComplete=!0,this.telemetryService.publicLog2("interactiveSessionProviderInvoked",{timeToFirstProgress:i,totalTime:e,result:t,requestType:o,agent:r?.id??this.opts.agent.id,agentExtensionId:r?.extensionId.value??this.opts.agent.extensionId.value,slashCommand:this.opts.agentSlashCommandPart?this.opts.agentSlashCommandPart.command.name:this.opts.commandPart?.slashCommand.command,chatSessionId:jp(this.opts.sessionResource),enableCommandDetection:this.opts.enableCommandDetection,isParticipantDetected:!!r,location:this.opts.location,citations:n.response?.codeCitations.length??0,numCodeBlocks:Egn(n.response?.response.toString()??"").length,attachmentKinds:this.attachmentKindsForTelemetry(n.variableData),model:this.resolveModelId(this.opts.options?.userSelectedModelId),permissionLevel:this.opts.options?.modeInfo?.kind==="ask"?void 0:this.opts.options?.modeInfo?.permissionLevel,chatMode:this.opts.options?.modeInfo?.modeName??this.opts.options?.modeInfo?.modeId,sessionType:Tgn(this.opts.sessionResource)}))}attachmentKindsForTelemetry(i){return i.variables.map(e=>e.kind==="implicit"?"implicit":e.range?e.kind==="tool"?"toolInPrompt":e.kind==="toolset"?"toolsetInPrompt":"fileInPrompt":e.kind==="command"?"command":e.kind==="symbol"?"symbol":SC(e)?"image":e.kind==="directory"?"directory":e.kind==="tool"?"tool":e.kind==="toolset"?"toolset":A.isUri(e.value)?"file":Bp(e.value)?"location":"otherAttachment")}resolveModelId(i){return i&&this.languageModelsService.lookupLanguageModel(i)?.id}};qVe=I([m(1,_e),m(2,Gr)],qVe);function Tgn(a){let i=yn(a);return i.startsWith("remote-")?"remote-agent-host":i}function zTo(a,i){if(a.message=i+a.message,a.stack){let e=a.stack.indexOf(`
`);a.stack=e!==-1?`${a.name}: ${a.message}${a.stack.slice(e)}`:`${a.name}: ${a.message}`}}function KTo(a,i){if(a instanceof Error){let e=typeof i=="number"?`[${i}]`:`.${i}`,t=!a.message.startsWith("[")&&!a.message.startsWith(".");zTo(a,e+(t?": ":""))}throw a}function HOi(a){return{kind:0,extract:i=>i,equals:a??((i,e)=>i===e)}}function djt(a){return{kind:1,extract:i=>{let e=i;return e&&typeof e=="object"&&(e=JSON.parse(JSON.stringify(e))),e},equals:a??((i,e)=>i===e)}}function $Ve(a){return{kind:2,itemSchema:a,extract:i=>i?.map((e,t)=>{try{return a.extract(e)}catch(o){KTo(o,t)}})}}function Une(a,i){let e=Object.entries(a).sort(([,t],[,o])=>t.kind-o.kind);return{kind:3,children:e,sealed:i?.sealed,extract:t=>{if(mr(t))return t;let o=Object.create(null);for(let[n,r]of e)try{o[n]=r.extract(t)}catch(s){KTo(s,n)}return o}}}function vO(a,i){return{...i,extract:e=>i.extract(a(e))}}function dc(a,i){let e=djt(i);return{...e,extract:t=>e.extract(a(t))}}var _gn=Ke.fromString(`
`),cjt=class{constructor(i,e=512){this._transform=i;this._compactAfterEntries=e;this._entryCount=0;this._hasPendingWrite=!1;this._pendingEntryCount=0}createInitial(i){return this.createInitialFromSerialized(this._transform.extract(i))}createInitialFromSerialized(i){this._previous=i,this._entryCount=1,this._clearPending();let e={kind:0,v:i};return Ke.fromString(JSON.stringify(e)+`
`)}read(i){let e,t=0,o=0,n=i.byteLength;for(;o<n;){let r=i.indexOf(_gn,o);if(r===-1&&(r=n),r>o){let s=i.slice(o,r);if(s.byteLength>0){t++;let l=JSON.parse(s.toString());switch(l.kind){case 0:e=l.v;break;case 1:if(e===void 0)throw new Error("Log file is missing an initial entry");this._applySet(e,l.k,l.v);break;case 2:if(e===void 0)throw new Error("Log file is missing an initial entry");this._applyPush(e,l.k,l.v,l.i);break;case 3:if(e===void 0)throw new Error("Log file is missing an initial entry");this._applySet(e,l.k,void 0);break;default:bs(l)}}}o=r+1}if(t===0)throw new Error("Empty log file");return this._previous=e,this._entryCount=t,this._clearPending(),e}write(i){let e=this._transform.extract(i);if(!this._previous||this._entryCount>this._compactAfterEntries){this._hasPendingWrite=!0,this._pendingPrevious=e,this._pendingEntryCount=1;let r={kind:0,v:e};return{op:"replace",data:Ke.fromString(JSON.stringify(r)+`
`)}}let t=[],o=[];try{this._diff(this._transform,o,this._previous,e,t)}catch(r){if(r instanceof Error){let s=o.map(l=>typeof l=="number"?`[${l}]`:`.${l}`).join("")||"<root>";zTo(r,`error diffing at ${s}: `)}throw r}if(t.length===0)return this._clearPending(),{op:"append",data:Ke.fromString("")};this._hasPendingWrite=!0,this._pendingEntryCount=this._entryCount+t.length,this._pendingPrevious=e;let n="";for(let r of t)n+=JSON.stringify(r)+`
`;return{op:"append",data:Ke.fromString(n)}}confirmWrite(){this._hasPendingWrite&&(this._previous=this._pendingPrevious,this._entryCount=this._pendingEntryCount,this._clearPending())}_clearPending(){this._hasPendingWrite=!1,this._pendingPrevious=void 0,this._pendingEntryCount=0}_applySet(i,e,t){if(e.length===0)return;let o=i;for(let n=0;n<e.length-1;n++)o=o[e[n]];o[e[e.length-1]]=t}_applyPush(i,e,t,o){let n=i;for(let l=0;l<e.length-1;l++)n=n[e[l]];let r=e[e.length-1],s=n[r]||[];o!==void 0&&(s.length=o),t&&t.length>0&&s.push(...t),n[r]=s}_diff(i,e,t,o,n){if(i.kind===0||i.kind===1)i.equals(t,o)||n.push({kind:1,k:e.slice(),v:o});else if(mr(t)||mr(o))t!==o&&(o===void 0?n.push({kind:3,k:e.slice()}):o===null?n.push({kind:1,k:e.slice(),v:null}):n.push({kind:1,k:e.slice(),v:o}));else if(i.kind===2)this._diffArray(i,e,t,o,n);else if(i.kind===3)this._diffObject(i.children,e,t,o,n,i.sealed);else throw new Error(`Unknown transform kind ${JSON.stringify(i)}`)}_diffObject(i,e,t,o,n,r){let s=t,l=o,c=0;for(;c<i.length;c++){let[u,p]=i[c];if(p.kind!==0)break;if(!p.equals(s?.[u],l[u])){n.push({kind:1,k:e.slice(),v:o});return}}if(!(r&&r(t,!0)&&r(o,!1)))for(;c<i.length;c++){let[u,p]=i[c];e.push(u),this._diff(p,e,s?.[u],l[u],n),e.pop()}}_diffArray(i,e,t,o,n){let r=t||[],s=o||[],l=i.itemSchema,c=Math.min(r.length,s.length);if(l.kind===3){let u=l.children;for(let p=0;p<c;p++){let h=r[p],g=s[p];if(this._hasKeyMismatch(u,h,g)){let f=s.slice(p);n.push({kind:2,k:e.slice(),v:f.length>0?f:void 0,i:p});return}e.push(p),this._diffObject(u,e,h,g,n,l.sealed),e.pop()}s.length>r.length?n.push({kind:2,k:e.slice(),v:s.slice(r.length)}):s.length<r.length&&n.push({kind:2,k:e.slice(),i:s.length})}else{let u=-1;for(let p=0;p<c;p++)if(!l.equals(r[p],s[p])){u=p;break}if(u===-1)s.length>r.length?n.push({kind:2,k:e.slice(),v:s.slice(r.length)}):s.length<r.length&&n.push({kind:2,k:e.slice(),i:s.length});else{let p=s.slice(u);n.push({kind:2,k:e.slice(),v:p.length>0?p:void 0,i:u})}}}_hasKeyMismatch(i,e,t){let o=e,n=t;for(let[r,s]of i){if(s.kind!==0)break;if(!s.equals(o?.[r],n[r]))return!0}return!1}};var Rgn=a=>{let i=a;return i&&typeof i.toJSON=="function"?i.toJSON():a},Lgn=dc(a=>a.kind==="markdownContent"?a.content:Rgn(a),(a,i)=>{if(yr(a)&&yr(i))return a.value===i.value;if(yo(a,{kind:!0})&&yo(i,{kind:!0})){if(a.kind!==i.kind)return!1;switch(a.kind){case"markdownContent":return a.content===i.content;case"toolInvocationSerialized":case"elicitationSerialized":case"progressTaskSerialized":case"textEditGroup":case"multiDiffData":case"mcpServersStarting":case"thinking":return Qi(a,i);case"clearToPreviousToolInvocation":case"codeblockUri":case"command":case"confirmation":case"extensions":case"hook":case"inlineReference":case"markdownVuln":case"notebookEditGroup":case"progressMessage":case"pullRequest":case"questionCarousel":case"planReview":case"undoStop":case"warning":case"info":case"treeData":case"workspaceEdit":case"disabledClaudeHooks":return a.kind===i.kind;default:return Qi(a,i)}}return!1}),Mgn=(a,i)=>ze(A.from(a),A.from(i)),Pgn=Une({text:dc(a=>a.text),parts:dc(a=>a.parts,(a,i)=>a.length===i.length&&a.every((e,t)=>e.text===i[t].text))}),Agn=Une({uri:dc(a=>a.uri,Mgn),eventKind:dc(a=>a.eventKind)}),Ngn=Une({variables:vO(a=>a.variables.map(eR.toExport),$Ve(djt((a,i)=>a.name===i.name)))}),GTo=Une({requestId:vO(a=>a.id,HOi()),timestamp:dc(a=>a.timestamp),confirmation:dc(a=>a.confirmation),message:vO(a=>a.message,Pgn),shouldBeRemovedOnSend:dc(a=>a.shouldBeRemovedOnSend,Qi),agent:dc(a=>a.response?.agent,(a,i)=>a?.id===i?.id),modelId:dc(a=>a.modelId),editedFileEvents:vO(a=>a.editedFileEvents,$Ve(Agn)),variableData:vO(a=>a.variableData,Ngn),isHidden:dc(()=>{}),isCanceled:dc(()=>{}),response:vO(a=>a.response?.entireResponse.value,$Ve(Lgn)),responseId:dc(a=>a.response?.id),result:dc(a=>a.response?.result,Qi),responseMarkdownInfo:dc(a=>a.response?.codeBlockInfos?.map(i=>({suggestionId:i.suggestionId})),Qi),followups:dc(a=>a.response?.followups,Qi),modelState:dc(a=>a.response?.stateT,Qi),vote:dc(a=>a.response?.vote),slashCommand:vO(a=>a.response?.slashCommand,djt((a,i)=>a?.name===i?.name)),usedContext:dc(a=>a.response?.usedContext,Qi),contentReferences:dc(a=>a.response?.contentReferences,Qi),codeCitations:dc(a=>a.response?.codeCitations,Qi),timeSpentWaiting:dc(a=>a.response?.timestamp),completionTokens:dc(a=>a.response?.completionTokenCount),elapsedMs:dc(a=>a.response?.elapsedMs??(a.response?.completedAt?Math.max(0,a.response.completedAt-a.response.confirmationAdjustedTimestamp.get()):void 0)),modeInfo:dc(a=>a.modeInfo,Qi),isSystemInitiated:dc(a=>a.isSystemInitiated),systemInitiatedLabel:dc(a=>a.systemInitiatedLabel),terminalExecutionId:dc(a=>a.terminalExecutionId)},{sealed:a=>a.modelState?.value===2||a.modelState?.value===3||a.modelState?.value===1}),Ogn=Une({attachments:dc(a=>a.attachments.map(eR.toExport),Qi),mode:dc(a=>a.mode,(a,i)=>a.id===i.id),selectedModel:dc(a=>a.selectedModel,(a,i)=>a?.identifier===i?.identifier),inputText:dc(a=>a.inputText),selections:dc(a=>a.selections,Qi),permissionLevel:dc(a=>a.permissionLevel),contrib:dc(a=>a.contrib,Qi)}),Fgn=Une({id:vO(a=>a.request.id,HOi()),request:vO(a=>a.request,GTo),kind:dc(a=>a.kind),sendOptions:dc(a=>oho(a.sendOptions),Qi)}),Wgn=Une({version:dc(()=>3),creationDate:dc(a=>a.timestamp),customTitle:dc(a=>a.hasCustomTitle?a.title:void 0),initialLocation:dc(a=>a.initialLocation),inputState:vO(a=>a.inputModel.toJSON(),Ogn),responderUsername:dc(a=>a.responderUsername),sessionId:dc(a=>a.sessionId),requests:vO(a=>a.getRequests(),$Ve(GTo)),hasPendingEdits:dc(a=>a.editingSession?.entries.get().some(i=>i.state.get()===0)),repoData:dc(a=>a.repoData,Qi),pendingRequests:vO(a=>a.getPendingRequests(),$Ve(Fgn)),workingDirectory:dc(a=>a.workingDirectory?.toString())}),B6=class extends cjt{constructor(){super(Wgn,1024)}};var qTo=50,nlt="chat.ChatSessionStore.index",UOi="ChatSessionStore.transferIndex",zne=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.fileService=e;this.environmentService=t;this.logService=o;this.workspaceContextService=n;this.telemetryService=r;this.storageService=s;this.lifecycleService=l;this.userDataProfilesService=c;this.configurationService=u;this.workspaceEditingService=p;this.dialogService=h;this.openerService=g;this.storeQueue=new Tm;this.shuttingDown=!1;this._didReportIssue=!1;let f=this.workspaceContextService.getWorkspace(),v=!f.configuration&&f.folders.length===0,b=this.workspaceContextService.getWorkspace().id;this.storageRoot=v?Ve(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):Ve(this.environmentService.workspaceStorageHome,b,"chatSessions"),this.previousEmptyWindowStorageRoot=v?Ve(this.environmentService.workspaceStorageHome,"no-workspace","chatSessions"):void 0,this.transferredSessionStorageRoot=Ve(this.userDataProfilesService.defaultProfile.globalStorageHome,"transferredChatSessions"),this._register(this.workspaceEditingService.onDidEnterWorkspace(S=>{let y=this.storeQueue.queue(()=>this.handleWorkspaceTransition(S.oldWorkspace,S.newWorkspace));S.join(y)})),this._register(this.lifecycleService.onWillShutdown(S=>{this.shuttingDown=!0,this.storeTask&&S.join(this.storeTask,{id:"join.chatSessionStore",label:d(9383,null)})}))}async handleWorkspaceTransition(e,t){let o=u4(e),n=u4(t),r=e.id,s=t.id;this.logService.info(`ChatSessionStore: Workspace transition from ${r} to ${s}`);let l=o?Ve(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):Ve(this.environmentService.workspaceStorageHome,r,"chatSessions"),c=n?Ve(this.userDataProfilesService.defaultProfile.globalStorageHome,"emptyWindowChatSessions"):Ve(this.environmentService.workspaceStorageHome,s,"chatSessions");if(ze(l,c)){this.storageRoot=c;return}this.storageRoot=c,await this.migrateSessionsToNewWorkspace(l,o,n)}async migrateSessionsToNewWorkspace(e,t,o){try{if(!await this.fileService.exists(e)){this.logService.info("ChatSessionStore: Old storage location does not exist, skipping migration");return}let r=await this.fileService.resolve(e);if(!r.children){this.logService.info("ChatSessionStore: No children in old storage location, skipping migration");return}this.logService.info(`ChatSessionStore: Found ${r.children.length} files in old storage location`);let s=0;for(let l of r.children)if(!l.isDirectory&&(l.name.endsWith(".json")||l.name.endsWith(".jsonl"))){let c=l.resource,u=Ve(this.storageRoot,l.name);try{await this.fileService.copy(c,u,!1),s++}catch(p){rp(p)===4?this.logService.trace(`ChatSessionStore: Session file ${l.name} already exists at target, skipping`):this.reportError("sessionMigration",`Error migrating chat session file ${l.name}`,p)}}this.logService.info(`ChatSessionStore: Copied ${s} chat session files from ${t?"empty window":e.toString()} to ${o?"empty window":this.storageRoot.toString()} (originals preserved at old location)`),this.indexCache=void 0;try{await this.flushIndex()}catch(l){this.reportError("migrateWorkspace","Error flushing chat session index after workspace migration",l)}}catch(n){this.reportError("migrateWorkspace","Error migrating chat sessions to new workspace",n)}}async storeSessions(e){if(!this.shuttingDown)try{this.storeTask=this.storeQueue.queue(async()=>{try{await Promise.all(e.map(t=>this.writeSession(t))),await this.trimEntries(),await this.flushIndex()}catch(t){this.reportError("storeSessions","Error storing chat sessions",t)}}),await this.storeTask}finally{this.storeTask=void 0}}async storeSessionsMetadataOnly(e){if(!this.shuttingDown)try{this.storeTask=this.storeQueue.queue(async()=>{try{await Promise.all(e.map(t=>this.writeSessionMetadataOnly(t))),await this.flushIndex()}catch(t){this.reportError("storeSessions","Error storing chat sessions",t)}}),await this.storeTask}finally{this.storeTask=void 0}}async storeTransferSession(e,t){let o=this.getTransferredSessionIndex(),n=e.toWorkspace.toString(),r=o[n];if(r)try{let s=A.revive(r.sessionResource);if(s&&Br.parseLocalSessionId(s)){let l=this.getTransferredSessionStorageLocation(s);await this.fileService.del(l)}}catch(s){rp(s)!==1&&this.reportError("storeTransferSession","Error deleting old transferred session file",s)}try{let s=JSON.stringify(t,void 0,2),l=this.getTransferredSessionStorageLocation(t.sessionResource);await this.fileService.writeFile(l,Ke.fromString(s))}catch(s){this.reportError("sessionWrite","Error writing chat session",s);return}o[n]=e;try{this.storageService.store(UOi,o,0,1)}catch(s){this.reportError("storeTransferSession","Error storing chat transfer session",s)}}getTransferredSessionIndex(){try{return this.storageService.getObject(UOi,0,{})}catch(e){return this.reportError("getTransferredSessionIndex","Error reading chat transfer index",e),{}}}static{this.TRANSFER_EXPIRATION_MS=60*1e3*5}getTransferredSessionData(){try{let e=this.getTransferredSessionIndex(),t=this.workspaceContextService.getWorkspace().folders;if(t.length!==1)return;let o=t[0].uri.toString(),n=e[o];if(!n)return;let r=er(n);if(Date.now()-n.timestampInMilliseconds>zne.TRANSFER_EXPIRATION_MS){this.logService.info("ChatSessionStore: Transferred session has expired"),this.cleanupTransferredSession(r.sessionResource);return}return!!Br.parseLocalSessionId(r.sessionResource)&&r.sessionResource}catch(e){this.reportError("getTransferredSession","Error getting transferred chat session URI",e);return}}async readTransferredSession(e){try{let t=this.getTransferredSessionStorageLocation(e),o=Br.parseLocalSessionId(e);if(!o)return;let n=await this.readSessionFromLocation(t,void 0,o);return await this.cleanupTransferredSession(e),n}catch(t){this.reportError("getTransferredSession","Error getting transferred chat session",t);return}}async cleanupTransferredSession(e){try{let t=this.getTransferredSessionIndex(),o=this.workspaceContextService.getWorkspace().folders;if(o.length===1){let r=o[0].uri.toString();delete t[r],this.storageService.store(UOi,t,0,1)}let n=this.getTransferredSessionStorageLocation(e);await this.fileService.del(n)}catch(t){rp(t)!==1&&this.reportError("cleanupTransferredSession","Error cleaning up transferred session",t)}}async writeSession(e){try{let t=this.internalGetIndex(),o=this.getStorageLocation(e.sessionId);if(o.log)if(e instanceof ty){e.dataSerializer||(e.dataSerializer=new B6);let r,s;try{({op:r,data:s}=e.dataSerializer.write(e))}catch(l){throw this._didReportIssue||(this._didReportIssue=!0,this.dialogService.prompt({custom:!0,title:d(9381,null),message:d(9382,null,l.stack||Mn(l)),buttons:[{label:d(9385,null),run:()=>this.openerService.open("https://github.com/microsoft/vscode/issues/new?template=bug_report.md")}]})),l}s.byteLength>0&&await this.fileService.writeFile(o.log,s,{append:r==="append"}),e.dataSerializer.confirmWrite()}else{let r=new B6().createInitialFromSerialized(e);await this.fileService.writeFile(o.log,r)}else await this.fileService.writeFile(o.flat,Ke.fromString(JSON.stringify(e)));let n=await $To(e);t.entries[e.sessionId]=n}catch(t){this.reportError("sessionWrite","Error writing chat session",t)}}async writeSessionMetadataOnly(e){if(!Br.parseLocalSessionId(e.sessionResource))try{let t=this.internalGetIndex(),o=e.sessionResource.toString();t.entries[o]=await $To(e)}catch(t){this.reportError("sessionMetadataWrite","Error writing chat session metadata",t)}}async flushIndex(){let e=this.internalGetIndex();try{this.storageService.store(nlt,e,this.getIndexStorageScope(),1)}catch(t){this.reportError("indexWrite","Error writing index",t)}}getIndexStorageScope(){let e=this.workspaceContextService.getWorkspace();return!e.configuration&&e.folders.length===0?-1:1}async trimEntries(){let e=this.internalGetIndex(),t=Object.entries(e.entries).filter(([o,n])=>!n.isExternal).sort((o,n)=>n[1].lastMessageDate-o[1].lastMessageDate).map(([o])=>o);if(t.length>qTo){let o=t.slice(qTo);for(let n of o)delete e.entries[n];this.logService.trace(`ChatSessionStore: Trimmed ${o.length} old chat sessions from index`)}}async internalDeleteSession(e){let t=this.internalGetIndex();if(!t.entries[e])return;let o=this.getStorageLocation(e);for(let n of[o.flat,o.log]){try{n&&await this.fileService.del(n)}catch(r){rp(r)!==1&&this.reportError("sessionDelete","Error deleting chat session",r)}delete t.entries[e]}}hasSessions(){return Object.keys(this.internalGetIndex().entries).length>0}isSessionEmpty(e){return this.internalGetIndex().entries[e]?.isEmpty??!0}async deleteSession(e){await this.storeQueue.queue(async()=>{await this.internalDeleteSession(e),await this.flushIndex()})}async clearAllSessions(){await this.storeQueue.queue(async()=>{let e=this.internalGetIndex(),t=Object.keys(e.entries);this.logService.info(`ChatSessionStore: Clearing ${t.length} chat sessions`),await Promise.all(t.map(o=>this.internalDeleteSession(o))),await this.flushIndex()})}async setSessionTitle(e,t){await this.storeQueue.queue(async()=>{let o=this.internalGetIndex();o.entries[e]&&(o.entries[e].title=t)})}reportError(e,t,o){let n=o&&rp(o);n===1?this.logService.trace("ChatSessionStore: "+t,Mn(o)):this.logService.error("ChatSessionStore: "+t,Mn(o)),this.telemetryService.publicLog2("chatSessionStoreError",{reason:e,fileOperationReason:n??-1})}internalGetIndex(){if(this.indexCache)return this.indexCache;let e=this.storageService.get(nlt,this.getIndexStorageScope(),void 0);if(!e)return this.indexCache={version:1,entries:{}},this.indexCache;try{let t=JSON.parse(e);Bgn(t)?this.indexCache=t:(this.reportError("invalidIndexFormat",`Invalid index format: ${e}`),this.indexCache={version:1,entries:{}})}catch(t){this.reportError("invalidIndexJSON",`Index corrupt: ${e}`,t),this.indexCache={version:1,entries:{}}}for(let t of Object.values(this.indexCache.entries))t.timing??={created:t.lastMessageDate,lastRequestStarted:void 0,lastRequestEnded:t.lastMessageDate},t.lastResponseState??=t.lastResponseState===0||t.lastResponseState===4?1:t.lastResponseState||1;return this.indexCache}async getIndex(){return this.storeQueue.queue(async()=>this.internalGetIndex().entries)}getMetadataForSessionSync(e){return this.internalGetIndex().entries[this.getIndexKey(e)]}getIndexKey(e){return Br.parseLocalSessionId(e)??e.toString()}logIndex(){let e=this.storageService.get(nlt,this.getIndexStorageScope(),void 0);this.logService.info("ChatSessionStore index: ",e)}async migrateDataIfNeeded(e){await this.storeQueue.queue(async()=>{if(!this.storageService.get(nlt,this.getIndexStorageScope(),void 0)){let n=e();n&&await this.migrate(n)}})}async migrate(e){let t=Object.keys(e).length;this.logService.info(`ChatSessionStore: Migrating ${t} chat sessions from storage service to file system`),await Promise.all(Object.values(e).map(async o=>{await this.writeSession(o)})),await this.flushIndex()}async readSession(e){return await this.storeQueue.queue(async()=>{let t=this.getStorageLocation(e);return this.readSessionFromLocation(t.flat,t.log,e)})}async readSessionFromLocation(e,t,o){let n=e,r;if(t)try{r=(await this.fileService.readFile(t)).value,n=t}catch(s){this.reportError("sessionReadFile",`Error reading log chat session file ${o}`,s)}if(!r)try{r=(await this.fileService.readFile(e)).value,n=e}catch(s){this.reportError("sessionReadFile",`Error reading flat chat session file ${o}`,s),rp(s)===1&&this.previousEmptyWindowStorageRoot&&(r=await this.readSessionFromPreviousLocation(o))}if(r)try{let s,l=new B6;n===t?s=er(l.read(r)):s=er(JSON.parse(r.toString()));for(let c of s.requests)Array.isArray(c.response)?c.response=c.response.map(u=>typeof u=="string"?new he(u):u):typeof c.response=="string"&&(c.response=[new he(c.response)]);return{value:LWt(s),serializer:l}}catch(s){this.reportError("malformedSession",`Malformed session data in ${n.fsPath}: [${r.slice(0,20).toString()}${r.byteLength>20?"...":""}]`,s);return}}async readSessionFromPreviousLocation(e){let t;if(this.previousEmptyWindowStorageRoot){let o=Ve(this.previousEmptyWindowStorageRoot,`${e}.json`);try{t=(await this.fileService.readFile(o)).value,this.logService.info(`ChatSessionStore: Read chat session ${e} from previous location`)}catch(n){this.reportError("sessionReadFile",`Error reading chat session file ${e} from previous location`,n);return}}return t}getStorageLocation(e){return{flat:Ve(this.storageRoot,`${e}.json`),log:this.configurationService.getValue("chat.useLogSessionStorage")!==!1?Ve(this.storageRoot,`${e}.jsonl`):void 0}}getTransferredSessionStorageLocation(e){let t=Br.parseLocalSessionId(e);return Ve(this.transferredSessionStorageRoot,`${t}.json`)}updateAndFlushIndexSync(e,t){let o=this.internalGetIndex();for(let n of e)o.entries[n.sessionId]=zOi(n);for(let n of t){let r=n.sessionResource.toString();o.entries[r]=zOi(n)}try{this.storageService.store(nlt,o,this.getIndexStorageScope(),1)}catch(n){this.reportError("indexWrite","Error writing index synchronously",n)}}getChatStorageFolder(){return this.storageRoot}};zne=I([m(0,ge),m(1,ko),m(2,re),m(3,Ae),m(4,_e),m(5,de),m(6,to),m(7,hn),m(8,B),m(9,iS),m(10,ct),m(11,Je)],zne);function Vgn(a){return!!a&&typeof a=="object"&&typeof a.sessionId=="string"&&typeof a.title=="string"&&typeof a.lastMessageDate=="number"}function Bgn(a){if(typeof a!="object"||a===null)return!1;let i=a;if(i.version!==1||typeof i.entries!="object"||i.entries===null)return!1;for(let e in i.entries)if(!Vgn(i.entries[e]))return!1;return!0}function zOi(a){let i=a.customTitle||a.title,e=a.lastRequest?.response?.state??1;(e===0||e===4)&&(e=2);let t=!Br.parseLocalSessionId(a.sessionResource),o=t?a.inputModel.toJSON():void 0,n=o?{...o,attachments:[]}:void 0;return{sessionId:a.sessionId,title:i||d(9384,null),lastMessageDate:a.lastMessageDate,timing:a.timing,initialLocation:a.initialLocation,hasPendingEdits:a.editingSession?.entries.get().some(r=>r.state.get()===0)??!1,isEmpty:a.getRequests().length===0,isExternal:t,lastResponseState:e,permissionLevel:a.inputModel.state.get()?.permissionLevel,inputState:n,workingDirectory:a.workingDirectory?.toString()}}async function $To(a){if(a instanceof ty){let e=zOi(a);return e.stats=await EWt(a),e}let i=a.requests.at(-1)?.timestamp??a.creationDate;return{sessionId:a.sessionId,title:a.customTitle||d(9384,null),lastMessageDate:i,timing:{created:a.creationDate,lastRequestStarted:a.requests.at(-1)?.timestamp,lastRequestEnded:i},initialLocation:a.initialLocation,hasPendingEdits:!1,isEmpty:a.requests.length===0,isExternal:!1,lastResponseState:1}}async function jTo(a,i){for(let e of a.folders){let t=await i.resolve(e.uri);if(t.children&&t.children.length>0)return!1}return!0}var QVe=le("chatTransferService"),rlt="chat.transferedWorkspaces",jVe=class{constructor(i,e,t,o){this.workspaceService=i;this.storageService=e;this.fileService=t;this.workspaceTrustManagementService=o}deleteWorkspaceFromTransferredList(i){let t=this.storageService.getObject(rlt,0,[]).filter(o=>o!==i.toString());this.storageService.store(rlt,t,0,1)}addWorkspaceToTransferred(i){let e=this.storageService.getObject(rlt,0,[]);e.push(i.toString()),this.storageService.store(rlt,e,0,1)}async checkAndSetTransferredWorkspaceTrust(){let i=this.workspaceService.getWorkspace(),e=i.folders[0]?.uri;e&&this.isChatTransferredWorkspace(e,this.storageService)&&await jTo(i,this.fileService)&&(await this.workspaceTrustManagementService.setWorkspaceTrust(!0),this.deleteWorkspaceFromTransferredList(e))}isChatTransferredWorkspace(i,e){return i?e.getObject(rlt,0,[]).some(o=>o.toString()===i.toString()):!1}};jVe=I([m(0,Ae),m(1,de),m(2,ge),m(3,Or)],jVe);var KOi,Kne=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){this._modeKind=i;this._enabledTools=e;this._enabledSubagents=t;this._currentSessionType=o;this._promptsService=n;this._logService=r;this._labelService=s;this._configurationService=l;this._workspaceService=c;this._fileService=u;this._remoteAgentService=p;this._telemetryService=h;this._languageModelToolsService=g;this._agentPluginService=f;this._parseResults=new dt}async _parseInstructionsFile(i,e){if(this._parseResults.has(i))return this._parseResults.get(i);try{let t=await this._promptsService.parseNew(i,e);return this._parseResults.set(i,t),t}catch(t){this._logService.error(`[InstructionsContextComputer] Failed to parse instruction file: ${i}`,t);return}}async collect(i,e){let t=performance.now(),o=await this._promptsService.getInstructionFiles(e);this._logService.trace(`[InstructionsContextComputer] ${o.length} instruction files available.`);let n=nSi(),r=rSi(),s=this._getContext(i);await this.addApplyingInstructions(o,s,i,n,r,e),await this._addReferencedInstructions(i,n,r,e),await this._addAgentInstructions(i,n,r,e);let l=await this._getCustomizationsIndex(o,i,n,r,e);l&&(i.add(l),n.listedInstructionsCount++),r.durationInMillis=performance.now()-t,this.sendTelemetry(n),KOi={telemetryEvent:n,debugInfo:r}}sendTelemetry(i){i.totalInstructionsCount=i.agentInstructionsCount+i.referencedInstructionsCount+i.applyingInstructionsCount+i.listedInstructionsCount,this._telemetryService.publicLog2("instructionsCollected",i)}async _logSkillLoadedTelemetry(i){try{let e=new dt,t=this._agentPluginService.plugins.get();for(let n of t)e.set(n.uri,n);let o=n=>n!==void 0?String(Lr(n)):"";for(let n of i){let r=n.pluginUri?e.get(n.pluginUri):void 0;this._telemetryService.publicLog2("skillLoadedIntoContext",{skillNameHash:o(n.name),skillStorage:n.storage,extensionIdHash:o(n.extension?.identifier.value),extensionVersion:n.extension?.version??"",pluginNameHash:o(r?.label),pluginVersion:r?.fromMarketplace?.version??""})}}catch(e){this._logService.error("[InstructionsContextComputer] Failed to log skill telemetry",e)}}async addApplyingInstructions(i,e,t,o,n,r){if(!this._configurationService.getValue(El.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 c of i){if(r.isCancellationRequested)return;let{uri:u,pattern:p}=c;if(!lb(c.sessionTypes,l))continue;if(!p){this._logService.trace(`[InstructionsContextComputer] No pattern (applyTo / paths) found: ${u}`),n.debugDetails.push({category:"skipped",name:Be(u).toString(),uri:u,reason:d(9423,null)});continue}let h=H2(u);if(e.instructions.has(u)){this._logService.trace(`[InstructionsContextComputer] Skipping already processed instruction file: ${u}`),n.debugDetails.push({category:"skipped",name:Be(u).toString(),uri:u,reason:d(9421,null)});continue}let g=this._matches(e.files,p);if(g){this._logService.trace(`[InstructionsContextComputer] Match for ${u} with ${g.pattern}${g.file?` for file ${g.file}`:""}`);let f=g.file?d(9432,null,p,this._labelService.getUriLabel(g.file,{relative:!0})):d(9430,null);t.add(H0(u,"vscode.instructions.file.root",f,!0)),o.applyingInstructionsCount++,n.debugDetails.push({category:"applying",name:Be(u).toString(),uri:u,reason:f}),h&&o.claudeRulesCount++}else this._logService.trace(`[InstructionsContextComputer] No match for ${u} with ${p}`),n.debugDetails.push({category:"skipped",name:Be(u).toString(),uri:u,reason:d(9422,null,p)})}}_getContext(i){let e=new xn,t=new xn;for(let o of i.asArray())if(tR(o))t.add(o.value);else{let n=eR.toUri(o);n&&e.add(n)}return{files:e,instructions:t}}async _addAgentInstructions(i,e,t,o){let n={logInfo:c=>this._logService.trace(`[InstructionsContextComputer] ${c}`)},r=await this._promptsService.listAgentInstructions(o,n),s=new DH,l=new DH;for(let{uri:c,type:u}of r){let p=H0(c,"vscode.instructions.file.root",void 0,!0);s.add(p),u==="copilotInstructionsMd"&&l.add(p),e.agentInstructionsCount++,u==="claudeMd"&&e.claudeMdCount++,t.debugDetails.push({category:"applying",name:Be(c).toString(),uri:c,reason:d(9419,null)}),n.logInfo(`Agent instruction file added: ${c.toString()}`)}if(l.length>0){await this._addReferencedInstructions(l,e,t,o);for(let c of l.asArray())i.add(c)}for(let c of s.asArray())i.add(c)}_matches(i,e){let t=wM(e,","),o=n=>{if(n=n.trim(),n.length!==0){if(n==="**"||n==="**/*"||n==="*")return{pattern:n};!n.startsWith("/")&&!n.startsWith("**/")&&(n="**/"+n);for(let r of i)if(qd(n,r.path,{ignoreCase:!0}))return{pattern:n,file:r}}};for(let n of t){let r=o(n);if(r)return r}}_getTool(i){if(!this._enabledTools)return;let e=this._languageModelToolsService.getToolByName(i);if(e&&this._enabledTools[e.id])return{tool:e,variable:`#tool:${this._languageModelToolsService.getFullReferenceName(e)}`}}async _getCustomizationsIndex(i,e,t,o,n){let r=this._getTool("readFile"),s=this._getTool("runInTerminal"),l=r??s,c=this._getTool(D3.runSubagent),u=this._getTool("skill"),p=this._currentSessionType,g=(await this._remoteAgentService.getEnvironment())?.os,f=w=>Hgn(w,g),v=[];if(l){let x=this._configurationService.getValue(El.USE_NESTED_AGENT_MD)?this._promptsService.listNestedAgentMDs(n):Promise.resolve([]);v.push("<instructions>"),v.push("Here is a list of instruction files that contain rules for working with this codebase."),v.push("These files are important for understanding the codebase structure, conventions, and best practices."),v.push("When an instruction file applies to your task (based on its description or applyTo pattern), follow the rules specified in it."),v.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.`),v.push("Only load instruction files when they are relevant to the current task. Do not eagerly load all instructions upfront."),v.push("When modifying or creating files, check for instructions whose applyTo pattern matches the file path and follow them.");let E=!1;for(let K of i)lb(K.sessionTypes,p)&&(v.push("<instruction>"),v.push(`<file>${f(K.uri)}</file>`),K.description&&v.push(`<description>${K.description}</description>`),K.pattern&&v.push(`<applyTo>${K.pattern}</applyTo>`),v.push("</instruction>"),E=!0);let M=await x;for(let{uri:K}of M){let j=this._labelService.getUriLabel(ai(K),{relative:!0}),J=j.trim().length===0?d(9429,null):d(9428,null,j);v.push("<instruction>"),v.push(`<file>${f(K)}</file>`),v.push(`<description>${J}</description>`),v.push("</instruction>"),E=!0}E?v.push("</instructions>","",""):v.length=0;let N=await this._promptsService.findAgentSkills(n),V=this._configurationService.getValue(OM),H=N?.filter(K=>K.description?K.disableModelInvocation?(o.debugDetails.push({category:"skipped",name:K.name,uri:K.uri,reason:d(9426,null)}),!1):lb(K.sessionTypes,p)?!V&&K.uri.path.includes(vPt)?(o.debugDetails.push({category:"skipped",name:K.name,uri:K.uri,reason:d(9424,null)}),!1):!0:(o.debugDetails.push({category:"skipped",name:K.name,uri:K.uri,reason:d(9427,null)}),!1):(o.debugDetails.push({category:"skipped",name:K.name,uri:K.uri,reason:d(9425,null)}),!1));if(H&&H.length>0){this._logSkillLoadedTelemetry(H);for(let Se of H)o.debugDetails.push({category:"skill",name:Se.name,uri:Se.uri,reason:Se.storage});let K=this._configurationService.getValue(El.USE_SKILL_ADHERENCE_PROMPT),j=u??l;v.push("<skills>"),K?(v.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."),u?v.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 ${u.variable} with the skill name to load the relevant skill(s).`):v.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).`),v.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."),v.push("How to determine if a skill applies:"),v.push("1. Review the available skills below and match their descriptions against the user's request"),v.push("2. If any skill's domain overlaps with the task, load that skill immediately"),v.push("3. When multiple skills apply (e.g., a flowchart in documentation), load all relevant skills"),v.push("Examples:"),v.push(`- "Help me write unit tests for this module" -> Load the testing skill via ${j.variable} FIRST, then proceed`),v.push(`- "Optimize this slow function" -> Load the performance-profiling skill via ${j.variable} FIRST, then proceed`),v.push('- "Add a discount code field to checkout" -> Load both the checkout-flow and form-validation skills FIRST'),v.push("Available skills:")):u?(v.push("Here is a list of skills that contain domain specific knowledge on a variety of topics."),v.push(`When a user asks you to perform a task that falls within the domain of a skill, use the ${u.variable} tool with the skill name to load it.`)):(v.push("Here is a list of skills that contain domain specific knowledge on a variety of topics."),v.push("Each skill comes with a description of the topic and a file path that contains the detailed instructions."),v.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 J=15e3,se=5e3,ae=0,ce=H.length;for(let Se=0;Se<H.length;Se++){let Re=H[Se],xe=["<skill>",`<name>${Re.name}</name>`];Re.description&&xe.push(`<description>${Re.description}</description>`),xe.push(`<file>${f(Re.uri)}</file>`),xe.push("</skill>");let He=xe.join(`
`).length+1;if(u&&ae+He>J){ce=Se;break}ae+=He,v.push(...xe)}if(ce<H.length){let Se=H.slice(ce),Re=[],xe=0;for(let Te of Se){let It=(Re.length>0?2:0)+Te.name.length;if(xe+It>se)break;xe+=It,Re.push(Te.name)}let He=Se.length-Re.length,Ee=Re.join(", ");v.push(He>0?`Additional skills available (invoke by name): ${Ee}... and ${He} more`:`Additional skills available (invoke by name): ${Ee}`)}v.push("</skills>","","")}}if(c){let w=!!this._configurationService.getValue("chat.generalPurposeAgent.enabled"),x=(()=>{if(!this._enabledSubagents||this._enabledSubagents.includes("*"))return M=>M.visibility.agentInvocable&&lb(M.sessionTypes,p);{let M=this._enabledSubagents;return N=>M.includes(N.name)&&lb(N.sessionTypes,p)}})(),E=(await this._promptsService.getCustomAgents(n)).filter(M=>M.enabled);if(w||E.length>0){v.push("<agents>"),v.push("Here is a list of agents that can be used when running a subagent."),v.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."),v.push(`Use the ${c.variable} tool with the agent name to run the subagent.`),w&&(v.push("<agent>"),v.push(`<name>${EZ}</name>`),v.push("<description>Full-capability agent for complex multi-step tasks requiring high-quality reasoning. Has access to the same tools and capabilities as the current agent and inherits the parent agent's model and system prompt. Use for tasks that don't fit a more specialized agent.</description>"),v.push("</agent>"));for(let M of E)x(M)?(v.push("<agent>"),v.push(`<name>${M.name}</name>`),M.description&&v.push(`<description>${M.description}</description>`),M.argumentHint&&v.push(`<argumentHint>${M.argumentHint}</argumentHint>`),v.push("</agent>"),o.debugDetails.push({category:"custom-agent",name:M.name,uri:M.uri}),HPt(M.uri)&&t.claudeAgentsCount++):o.debugDetails.push({category:"skipped",name:M.name,uri:M.uri,reason:d(9420,null)});v.push("</agents>","","")}}if(v.length===0)return;let b=v.join(`
`),S=[],y=w=>{if(w){let x=b.indexOf(w.variable);for(;x>=0;)S.push(Npe(w.tool,new gi(x,x+w.variable.length))),x=b.indexOf(w.variable,x+1)}};return y(l),y(c),y(u),Cao(b,!0,S)}async _addReferencedInstructions(i,e,t,o){if(!this._configurationService.getValue(El.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 r=new xn,s=[];for(let c of i.asArray())tR(c)&&(r.has(c.value)||(s.push(c.value),r.add(c.value)));let l=s.pop();for(;l;){let c=await this._parseInstructionsFile(l,o);if(c&&c.body){let u=[];for(let p of c.body.fileReferences){let h=c.body.resolveFilePath(p.content);h&&!r.has(h)&&(gSi(h)||this._workspaceService.getWorkspaceFolder(h)!==void 0)&&(u.push({resource:h}),r.add(h))}if(u.length>0){let p=await this._fileService.resolveAll(u);for(let h=0;h<p.length;h++){let g=p[h],f=u[h].resource;if(g.success&&g.stat?.isFile){gSi(f)&&s.push(f);let v=d(9431,null,Be(l));i.add(H0(f,"vscode.instructions.file.reference",v,!0)),e.referencedInstructionsCount++,t.debugDetails.push({category:"referenced",name:Be(f).toString(),uri:f,reason:v}),this._logService.trace(`[InstructionsContextComputer] ${f.toString()} added, referenced by ${l.toString()}`)}}}}l=s.pop()}}};Kne=I([m(4,jr),m(5,re),m(6,nt),m(7,B),m(8,Ae),m(9,ge),m(10,bo),m(11,_e),m(12,Wn),m(13,mm)],Kne);function Hgn(a,i){if(a.scheme===Q.file||a.scheme===Q.vscodeRemote){let e=a.fsPath;return i!==void 0?i===1?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"):e}return a.toString()}var Ugn="interactive.sessions";function zgn(a){let i=a.inputModel.state.get();return i?i.inputText.trim().length>0?!0:i.attachments.length>0:!1}var YVe=class{constructor(i,e,t,o,n){this.cancellationTokenSource=i;this.requestId=e;this.responseCompletePromise=t;this.sendOptions=o;this.toolsService=n;this._yieldRequested=De(this,!1)}get yieldRequested(){return this._yieldRequested}dispose(){this.requestId&&this.toolsService.cancelToolCallsForRequest(this.requestId),this.cancellationTokenSource.dispose()}cancel(){this.requestId&&this.toolsService.cancelToolCallsForRequest(this.requestId),this.cancellationTokenSource.cancel()}setYieldRequested(){this._yieldRequested.set(!0,void 0)}resetYieldRequested(){this._yieldRequested.set(!1,void 0)}};YVe=I([m(4,Wn)],YVe);var Kgn=Object.freeze([]),Ggn=new Map,XVe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this.storageService=e;this.logService=t;this.telemetryService=o;this.extensionService=n;this.instantiationService=r;this.workspaceContextService=s;this.chatSlashCommandService=l;this.chatAgentService=c;this.configurationService=u;this.chatTransferService=p;this.chatSessionService=h;this.mcpService=g;this.promptsService=f;this.chatEntitlementService=v;this.languageModelsService=b;this.chatDebugService=S;this._pendingRequests=this._register(new bI);this._queuedRequestDeferreds=new Map;this._saveModelsEnabled=!0;this._onDidSubmitRequest=this._register(new T);this.onDidSubmitRequest=this._onDidSubmitRequest.event;this._onDidPerformUserAction=this._register(new T);this.onDidPerformUserAction=this._onDidPerformUserAction.event;this._onDidReceiveQuestionCarouselAnswer=this._register(new T);this.onDidReceiveQuestionCarouselAnswer=this._onDidReceiveQuestionCarouselAnswer.event;this._onDidDisposeSession=this._register(new T);this.onDidDisposeSession=this._onDidDisposeSession.event;this._sessionFollowupCancelTokens=this._register(new bI);this._sessionModels=this._register(r.createInstance(KVe,{createModel:w=>this._startSession(w),willDisposeModel:async w=>{let x=Br.parseLocalSessionId(w.sessionResource);x&&this.shouldStoreSession(w)?w.getRequests().length===0&&!w.customTitle?await this._chatSessionStore.deleteSession(x):this._saveModelsEnabled&&await this._chatSessionStore.storeSessions([w]):!x&&(w.getRequests().length>0||zgn(w))&&await this._chatSessionStore.storeSessionsMetadataOnly([w])}})),this._register(this._sessionModels.onDidDisposeModel(w=>{tSi(w.sessionResource),this.chatDebugService.endSession(w.sessionResource),this._onDidDisposeSession.fire({sessionResources:[w.sessionResource],reason:"cleared"})})),this._chatServiceTelemetry=this.instantiationService.createInstance(GVe),this._chatSessionStore=this._register(this.instantiationService.createInstance(zne)),this._chatSessionStore.migrateDataIfNeeded(()=>this.migrateData());let y=this._chatSessionStore.getTransferredSessionData();y&&(this.trace("constructor",`Transferred session ${y}`),this._transferredSessionResource=y),this._register(e.onWillSaveState(()=>this.saveState())),this.chatModels=ke(this,w=>[...this._sessionModels.observable.read(w).values()]),this.requestInProgressObs=ke(w=>{let x=this._sessionModels.observable.read(w).values();return yt.some(x,E=>E.requestInProgress.read(w))})}get transferredSessionResource(){return this._transferredSessionResource}get onDidCreateModel(){return this._sessionModels.onDidCreateModel}setSaveModelsEnabled(e){this._saveModelsEnabled=e}waitForModelDisposals(){return this._sessionModels.waitForModelDisposals()}get isEmptyWindow(){let e=this.workspaceContextService.getWorkspace();return!e.configuration&&e.folders.length===0}get editingSessions(){return[...this._sessionModels.values()].map(e=>e.editingSession).filter(so)}isEnabled(e){return this.chatAgentService.getContributedDefaultAgent(e)!==void 0}migrateData(){let e=this.storageService.get(Ugn,this.isEmptyWindow?-1:1,"");if(e){let t=this.deserializeChats(e),o=Object.keys(t).length;return o>0&&this.info("migrateData",`Restored ${o} persisted sessions`),t}}saveState(){if(!this._saveModelsEnabled)return;let e=Array.from(this._sessionModels.values()).filter(o=>this.shouldStoreSession(o)),t=Array.from(this._sessionModels.values()).filter(o=>!Br.parseLocalSessionId(o.sessionResource));this._chatSessionStore.updateAndFlushIndexSync(e,t),this._chatSessionStore.storeSessions(e),this._chatSessionStore.storeSessionsMetadataOnly(t)}shouldStoreSession(e){return e.isDeleted||!Br.parseLocalSessionId(e.sessionResource)?!1:e.initialLocation==="panel"&&!e.isImported}notifyUserAction(e){if(this._chatServiceTelemetry.notifyUserAction(e),this._onDidPerformUserAction.fire(e),e.action.kind==="chatEditingSessionAction"){let t=this._sessionModels.get(e.sessionResource);t&&t.notifyEditingAction(e.action)}}notifyQuestionCarouselAnswer(e,t,o){this._onDidReceiveQuestionCarouselAnswer.fire({requestId:e,resolveId:t,answers:o})}async setChatSessionTitle(e,t){let o=this._sessionModels.get(e);o&&o.setCustomTitle(t);let n=Br.parseLocalSessionId(e);n&&(await this._chatSessionStore.setSessionTitle(n,t),this.saveState())}trace(e,t){t?this.logService.trace(`ChatService#${e}: ${t}`):this.logService.trace(`ChatService#${e}`)}info(e,t){t?this.logService.info(`ChatService#${e}: ${t}`):this.logService.info(`ChatService#${e}`)}error(e,t){this.logService.error(`ChatService#${e} ${t}`)}deserializeChats(e){try{let t=er(JSON.parse(e));if(!Array.isArray(t))throw new Error("Expected array");return t.reduce((n,r)=>{for(let s of r.requests)Array.isArray(s.response)?s.response=s.response.map(l=>typeof l=="string"?new he(l):l):typeof s.response=="string"&&(s.response=[new he(s.response)]);return n[r.sessionId]=LWt(r),n},{})}catch(t){return this.error("deserializeChats",`Malformed session data: ${t}. [${e.substring(0,20)}${e.length>20?"...":""}]`),{}}}async getLocalSessionHistory(){let e=await this.getLiveSessionItems(),t=await this.getHistorySessionItems();return[...e,...t]}async getLiveSessionItems(){return await Promise.all(Array.from(this._sessionModels.values()).filter(e=>this.shouldBeInHistory(e)).map(GOi))}async getHistorySessionItems(){let e=await this._chatSessionStore.getIndex();return Object.values(e).filter(t=>!t.isExternal).filter(t=>!this._sessionModels.has(Br.forSession(t.sessionId))&&t.initialLocation==="panel"&&!t.isEmpty).map(t=>{let o=Br.forSession(t.sessionId),{workingDirectory:n,...r}=t;return{...r,sessionResource:o,isActive:this._sessionModels.has(o),workingDirectory:n?A.parse(n):void 0}})}async getMetadataForSession(e){let o=(await this._chatSessionStore.getIndex())[e.toString()];if(o){let{workingDirectory:n,...r}=o;return{...r,sessionResource:e,isActive:this._sessionModels.has(e),workingDirectory:n?A.parse(n):void 0}}}shouldBeInHistory(e){return!e.isImported&&!e.isDeleted&&!!Br.parseLocalSessionId(e.sessionResource)&&e.initialLocation==="panel"}async removeHistoryEntry(e){await this._chatSessionStore.deleteSession(this.toLocalSessionId(e));let t=this._sessionModels.get(e);t&&t.markDeleted(),this._onDidDisposeSession.fire({sessionResources:[e],reason:"cleared"})}async clearAllHistoryEntries(){await this._chatSessionStore.clearAllSessions()}startNewLocalSession(e,t){this.trace("startNewLocalSession");let o=Br.forSession(ht());return this._sessionModels.acquireOrCreate({initialData:void 0,location:e,sessionResource:o,canUseTools:t?.canUseTools??!0,disableBackgroundKeepAlive:t?.disableBackgroundKeepAlive},t?.debugOwner??"ChatService#startNewLocalSession")}_startSession(e){let{initialData:t,location:o,sessionResource:n,canUseTools:r,transferEditingSession:s,disableBackgroundKeepAlive:l,inputState:c}=e,u=this.instantiationService.createInstance(ty,t,{initialLocation:o,canUseTools:r,resource:n,disableBackgroundKeepAlive:l,inputState:c});return o==="panel"&&u.startEditingSession(!0,s),this.initializeSession(u),u}initializeSession(e){this.trace("initializeSession",`Initialize session ${e.sessionResource}`),this.activateDefaultAgent(e.initialLocation).catch(t=>this.logService.error(t))}async activateDefaultAgent(e){await this.extensionService.whenInstalledExtensionsRegistered();let t=this.chatAgentService.getContributedDefaultAgent(e)??this.chatAgentService.getContributedDefaultAgent("panel");if(!t)throw new ka("No default agent contributed");if(t.isCore||await this.extensionService.activateById(t.extensionId,{activationEvent:`onChatParticipant:${t.id}`,extensionId:t.extensionId,startup:!1}),!this.chatAgentService.getActivatedAgents().find(n=>n.id===t.id))throw new ka("No default agent registered")}getSession(e){return this._sessionModels.get(e)}acquireExistingSession(e,t){return this._sessionModels.acquireExisting(e,t??"ChatService#acquireExistingSession")}getChatModelReferenceDebugInfo(){return this._sessionModels.getReferenceDebugSnapshot()}async acquireOrRestoreLocalSession(e,t){this.trace("acquireOrRestoreSession",`${e}`);let o=this.acquireExistingSession(e,t);if(o)return o;let n;if(ze(this.transferredSessionResource,e))this._transferredSessionResource=void 0,n=await this._chatSessionStore.readTransferredSession(e);else{let s=Br.parseLocalSessionId(e);s&&(n=await this._chatSessionStore.readSession(s))}return n?this._sessionModels.acquireOrCreate({initialData:n,location:n.value.initialLocation??"panel",sessionResource:e,canUseTools:!0},t??"ChatService#acquireOrRestoreLocalSession"):void 0}getSessionTitle(e){if(Br.parseLocalSessionId(e))return this._sessionModels.get(e)?.title??this._chatSessionStore.getMetadataForSessionSync(e)?.title}loadSessionFromData(e,t){let o=e.sessionId??ht(),n=Br.forSession(o);return this._sessionModels.acquireOrCreate({initialData:{value:e,serializer:new B6},location:e.initialLocation??"panel",sessionResource:n,canUseTools:!0},t??"ChatService#loadSessionFromData")}async acquireOrLoadSession(e,t,o,n){return Br.isLocalSession(e)?this.acquireOrRestoreLocalSession(e,n):this.loadRemoteSession(e,t,o,n)}async loadRemoteSession(e,t,o,n){{let M=this.acquireExistingSession(e,n);if(M)return M}if(!await this.chatSessionService.canResolveChatSession(yn(e)))return;let r=await this.chatSessionService.getOrCreateChatSession(e,o);{let M=this.acquireExistingSession(e,n);if(M)return r.dispose(),M}let s=yn(e),l=wu(r.history.filter(M=>M.type==="request"),M=>M.modelId)?.modelId,c=wu(r.history.filter(M=>M.type==="request"),M=>M.modeInstructions?.uri)?.modeInstructions?.uri,u=this._chatSessionStore.getMetadataForSessionSync(e),p=u?.permissionLevel,h=u?.inputState,g;if(l||c){let M=c?{kind:"agent",id:c.toString()}:{kind:"agent",id:Bc.Agent.id},N=l?this.languageModelsService.lookupLanguageModel(l):void 0,V=l&&N?{identifier:l,metadata:N}:void 0;g={serializer:new B6,value:{creationDate:Date.now(),initialLocation:void 0,customTitle:void 0,requests:[],responderUsername:"",sessionId:"",version:3,inputState:{attachments:[],contrib:{},inputText:"",mode:M,selectedModel:V,selections:[],permissionLevel:p},pendingRequests:void 0,repoData:void 0}}}let f=this._sessionModels.acquireOrCreate({initialData:g,location:t,sessionResource:e,canUseTools:!1,transferEditingSession:r.transferredState?.editingSession,inputState:r.transferredState?.inputState??h},n??"ChatService#loadRemoteSession");p&&!g&&!h&&f.object.inputModel.setState({permissionLevel:p}),r.title&&f.object.setCustomTitle(r.title);let v=f.object,b=new O;b.add(f.object.onDidDispose(()=>{b.dispose(),r.dispose()}));let y=x3(s)?this.instantiationService.createInstance(nR):void 0,w=(M,N)=>{if(y)try{let V=this.getAttachmentCapabilitiesForParser(s,N),H=y.parseChatRequestWithReferences(Kgn,Ggn,M,t,{sessionType:s,forcedAgent:N,attachmentCapabilities:V});if(H.parts.length>0)return H}catch(V){this.logService.warn(`ChatService#loadRemoteSession: failed to re-parse historical prompt for ${s}`,V)}return{text:M,parts:[new Yb(new gi(0,M.length),{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:M.length+1},M)]}},x;for(let M of r.history)if(M.type==="request"){x&&x.response?.complete();let N=M.prompt,V=M.participant?this.chatAgentService.getAgent(M.participant):this.chatAgentService.getAgent(s),H=w(N,V),K=M.modeInstructions?{kind:"agent",isBuiltin:M.modeInstructions.isBuiltin??!1,modeInstructions:M.modeInstructions,modeId:"custom",applyCodeBlockSuggestionId:void 0}:void 0;x=v.addRequest(H,M.variableData??{variables:[]},0,K,V,void 0,void 0,void 0,void 0,!1,M.modelId,void 0,M.id)}else if(x){for(let N of M.parts)v.acceptResponseProgress(x,N);M.details&&x.response&&x.response.setResult({details:M.details})}if(r.progressObs&&r.interruptActiveResponseCallback){let M=0,N=b.add(new ue),V=j=>j.onCancellationRequested(()=>{r.interruptActiveResponseCallback?.().then(J=>{J||H()})}),H=()=>{let j=this.instantiationService.createInstance(YVe,new qe,void 0,void 0,void 0);this._pendingRequests.set(v.sessionResource,j),this.telemetryService.publicLog2(F2,{action:"add",source:"remoteSession",chatSessionId:jp(v.sessionResource)}),N.value=V(j.cancellationTokenSource.token)},K=()=>{this._pendingRequests.has(v.sessionResource)||H()};x&&!r.isCompleteObs?.get()&&H(),r.onDidStartServerRequest&&b.add(r.onDidStartServerRequest(({prompt:j,variableData:J})=>{x?.response&&!x.response.isComplete&&x.response.complete();let se=this.chatAgentService.getAgent(s),ae=w(j,se);x=v.addRequest(ae,J??{variables:[]},0,void 0,se),M=0,K()})),b.add(ve(j=>{let J=r.progressObs?.read(j)??[],se=r.isCompleteObs?.read(j)??!1;if(x&&J.length>M){let ae=J.slice(M);for(let ce of ae)v?.acceptResponseProgress(x,ce);M=J.length}se&&x&&(this._pendingRequests.deleteAndDispose(v.sessionResource),N.clear(),x.response?.complete())}))}else r.isCompleteObs?.get()&&x?.response?.complete(),this.telemetryService.publicLog2(F2,{action:"notCancelable",source:"remoteSession",chatSessionId:jp(v.sessionResource)}),x&&v.editingSession&&(await iee(v.editingSession),x.response?.complete());return f}async resendRequest(e,t){let o=this._sessionModels.get(e.session.sessionResource);if(!o&&o!==e.session)throw new Error(`Unknown session: ${e.session.sessionResource}`);let n=this._pendingRequests.get(e.session.sessionResource);n&&(this.trace("resendRequest",`Session ${e.session.sessionResource} already has a pending request, cancelling...`),n.cancel());let r=t?.location??o.initialLocation,s=t?.attempt??0,l=!t?.noCommandDetection,c=this.chatAgentService.getDefaultAgent(r,t?.modeInfo?.kind);o.removeRequest(e.id,1);let u={...t,locationData:e.locationData,attachedContext:e.attachedContext};await this._sendRequestAsync(o,o.sessionResource,e.message,s,l,c,r,u).responseCompletePromise}queuePendingRequest(e,t,o,n){let r=n.location??e.initialLocation,s=this.parseChatRequest(t,o,r,n),l=new lU({session:e,message:s,variableData:{variables:n.attachedContext??[]},timestamp:Date.now(),modeInfo:n.modeInfo,locationData:n.locationData,attachedContext:n.attachedContext,modelId:n.userSelectedModelId,userSelectedTools:n.userSelectedTools?.get(),isSystemInitiated:n.isSystemInitiated,systemInitiatedLabel:n.systemInitiatedLabel,terminalExecutionId:n.terminalExecutionId}),c=new Mo;return this._queuedRequestDeferreds.set(l.id,c),e.addPendingRequest(l,n.queue??"queued",{...n,queue:void 0}),n.queue==="steering"&&this.setYieldRequested(t),this.trace("sendRequest",`Queued message for session ${t}`),{kind:"queued",deferred:c.p}}async sendRequest(e,t,o){if(this.trace("sendRequest",`sessionResource: ${e.toString()}, message: ${t.substring(0,20)}${t.length>20?"[...]":""}}`),!t.trim()&&!o?.slashCommand&&!o?.agentId&&!o?.agentIdSilent)return this.trace("sendRequest","Rejected empty message"),{kind:"rejected",reason:"Empty message"};let n=this._sessionModels.get(e);if(!n)throw new Error(`Unknown session: ${e}`);let r,s;{if(!n.hasRequests&&ZD(e)&&yn(e)!==kl){let S=this.parseChatRequest(e,t,o?.location??n.initialLocation,o),y=S.parts.find(M=>M instanceof gE),w=DPt(S).message,x=this.chatSessionService.getSessionOptions(e),E=await this.chatSessionService.createNewChatSessionItem(yn(e),{prompt:w,command:y?.text,initialSessionOptions:x,untitledResource:e},Ie.None);if(E){if(this.chatSessionService.registerSessionResourceAlias(e,E.resource),r=await this.loadRemoteSession(E.resource,n.initialLocation,Ie.None),n=r?.object,!n)throw new Error(`Failed to load session for resource: ${E.resource}`);x&&this.chatSessionService.updateSessionOptions(n.sessionResource,x),e=E.resource,s=E.resource}}let l=this._pendingRequests.has(e);if(o?.queue){let S=this.queuePendingRequest(n,e,t,o);return o.pauseQueue||this.processPendingRequests(e),S}else if(l)return this.trace("sendRequest",`Session ${e} already has a pending request`),{kind:"rejected",reason:"Request already in progress"};let c=n.getRequests();for(let S=c.length-1;S>=0;S-=1){let y=c[S];y.shouldBeRemovedOnSend&&(y.shouldBeRemovedOnSend.afterUndoStop?y.response?.finalizeUndoState():await this.removeRequest(e,y.id))}let u=o?.location??n.initialLocation,p=o?.attempt??0,h=this.chatAgentService.getDefaultAgent(u,o?.modeInfo?.kind),g=this.parseChatRequest(e,t,u,o),f=o?.agentIdSilent?this.chatAgentService.getAgent(o.agentIdSilent):void 0,v=f??g.parts.find(S=>S instanceof Qp)?.agent??h,b=g.parts.find(S=>S instanceof cb);return{kind:"sent",newSessionResource:s,data:{...this._sendRequestAsync(n,e,g,p,!o?.noCommandDetection,f??h,u,o),agent:v,slashCommand:b?.command}}}}getAttachmentCapabilitiesForParser(e,t){return this.chatSessionService.getCapabilitiesForSessionType(e)??t?.capabilities}parseChatRequest(e,t,o,n){let r=n?.parserContext,s=r?.forcedAgent??r?.selectedAgent;if(n?.agentId){let u=this.chatAgentService.getAgent(n.agentId);if(!u)throw new Error(`Unknown agent: ${n.agentId}`);s=u,r={...r,selectedAgent:u,mode:n.modeInfo?.kind};let p=n.slashCommand?` ${cp}${n.slashCommand}`:"";t=`${pd}${u.name}${p} ${t}`}else if(n?.agentIdSilent&&!r?.forcedAgent){let u=this.chatAgentService.getAgent(n.agentIdSilent);u&&(s=u,r={...r,forcedAgent:u})}let l=r?.attachmentCapabilities??this.getAttachmentCapabilitiesForParser(yn(e),s);return l&&(r={...r,attachmentCapabilities:l}),this.instantiationService.createInstance(nR).parseChatRequest(e,t,o,r)}refreshFollowupsCancellationToken(e){this._sessionFollowupCancelTokens.get(e)?.cancel();let t=new qe;return this._sessionFollowupCancelTokens.set(e,t),t.token}_sendRequestAsync(e,t,o,n,r,s,l,c){let u=this.refreshFollowupsCancellationToken(t),p,h=o.parts.find(se=>se instanceof Qp),g=o.parts.find(se=>se instanceof cb),f=o.parts.find(se=>se instanceof gE),v=[...e.getRequests()],b=this.instantiationService.createInstance(qVe,{agent:h?.agent??s,agentSlashCommandPart:g,commandPart:f,sessionResource:e.sessionResource,location:e.initialLocation,options:c,enableCommandDetection:r}),S=!1,y=f?"slashCommand":"string",w=new Mo,x=!1;function E(){!x&&p?.response&&(w.complete(p.response),x=!0)}let M=new O,N=M.add(new qe),V=N.token,H=async()=>{let se=He=>{if(!V.isCancellationRequested){S||V0(t,W0.FirstToken),S=!0;for(let Ee=0;Ee<He.length;Ee++){let Te=Ee===He.length-1,It=He[Ee];It.kind==="markdownContent"?this.trace("sendRequest",`Provider returned progress for session ${e.sessionResource}, ${It.content.value.length} chars`):this.trace("sendRequest",`Provider returned progress: ${JSON.stringify(It)}`),p&&e.acceptResponseProgress(p,It,!Te)}E()}},ae,ce;if(!this.configurationService.getValue(OM)){let Ee=g?.command.name===aSi,Te=c?.attachedContext?.some(It=>{let tt=eR.toUri(It);return tt&&(tt.scheme===bao||tt.path.includes(vPt))});if(Ee||Te){p=e.addRequest(o,{variables:[]},n,c?.modeInfo),E();let It=encodeURIComponent(JSON.stringify(OM));e.acceptResponseProgress(p,{kind:"markdownContent",content:new he(d(9342,null,aSi,OM,It),{isTrusted:{enabledCommands:["workbench.action.openSettings"]}})}),e.setResponse(p,{}),p.response?.complete(),M.dispose();return}}let Se=async()=>{let He,Ee=!1;try{let It=await this.promptsService.getHooks(V);It&&(He=It.hooks,Ee=It.hasDisabledClaudeHooks)}catch(It){this.logService.warn("[ChatService] Failed to collect hooks:",It)}let Te=c?.modeInfo?.modeInstructions?.name;if(Te)try{let tt=(await this.promptsService.getCustomAgents(V)).find(Oi=>Oi.name===Te&&Oi.enabled);tt?.hooks&&(He=jPt(He,tt.hooks))}catch(It){this.logService.warn("[ChatService] Failed to collect agent hooks:",It)}return{hooks:He,hasDisabledClaudeHooks:Ee}},Re=async()=>{let He=c?.instructionContext;if(!He)return[];V0(t,W0.WillCollectInstructions);try{let Ee=new DH(c?.attachedContext);await this.instantiationService.createInstance(Kne,He.modeKind,He.enabledTools,He.enabledSubAgents,yn(t)).collect(Ee,V);let It=new Set((c?.attachedContext??[]).map(tt=>tt.id));return Ee.asArray().filter(tt=>!It.has(tt.id))}catch(Ee){return this.logService.error("[ChatService] Failed to collect instructions:",Ee),[]}finally{V0(t,W0.DidCollectInstructions)}},xe=new On(!1);M.add(V.onCancellationRequested(()=>{this.trace("sendRequest",`Request for session ${e.sessionResource} was cancelled`),p&&(b.complete({timeToFirstProgress:void 0,result:"cancelled",totalTime:xe.elapsed(),requestType:y,detectedAgent:ae,request:p}),e.cancelRequest(p))}));try{let He,Ee;if(h||s&&!f){let Te=h?.agent??s,It=g?.command,tt={variables:[]};p=e.addRequest(o,tt,n,c?.modeInfo,Te,It,c?.confirmation,c?.locationData,c?.attachedContext,void 0,c?.userSelectedModelId,c?.userSelectedTools?.get(),void 0,c?.isSystemInitiated,c?.systemInitiatedLabel,c?.terminalExecutionId);let Oi=p;E();let[zt,mo]=await Promise.all([Se(),Re()]),dn=zt.hooks,No=zt.hasDisabledClaudeHooks,_i=this.prepareContext(p.attachedContext);mo.length>0&&_i.push(...mo);let ln=_i.filter(Lo=>!(B0(Lo)&&Lo.automaticallyAdded));e.updateRequest(p,{variables:ln});let Tn={variables:_i};c?.resolvedVariables?.length&&(Tn={variables:[...Tn.variables,...c.resolvedVariables]});let Ko=DPt(p.message);Tn=Qxi(Tn,Ko.diff);let Bn=Ko.message,Mr=(Lo,kc,Cn,xa)=>{let Os={sessionResource:e.sessionResource,requestId:Oi.id,agentId:Lo.id,message:Bn,command:kc?.name,variables:Tn,enableCommandDetection:Cn,isParticipantDetected:xa,attempt:n,location:l,locationData:Oi.locationData,acceptedConfirmationData:c?.acceptedConfirmationData,rejectedConfirmationData:c?.rejectedConfirmationData,agentHostSessionConfig:c?.agentHostSessionConfig,userSelectedModelId:c?.userSelectedModelId,modelConfiguration:c?.userSelectedModelId?this.languageModelsService.getModelConfiguration(c.userSelectedModelId):void 0,userSelectedTools:c?.userSelectedTools?.get(),modeInstructions:c?.modeInfo?.modeInstructions,permissionLevel:c?.modeInfo?.permissionLevel,editedFileEvents:Oi.editedFileEvents,hooks:dn,hasHooksEnabled:!!dn&&Object.values(dn).some(js=>js.length>0),isSystemInitiated:c?.isSystemInitiated,workingDirectory:e.workingDirectory},rl=!0;return M.add(ve(js=>{let Fh=c?.userSelectedTools?.read(js);if(rl){rl=!1;return}Fh&&p&&(this.chatAgentService.setRequestTools(Lo.id,p.id,Fh),Os.userSelectedTools=Fh)})),Os};if(this.configurationService.getValue("chat.detectParticipant.enabled")!==!1&&this.chatAgentService.hasChatParticipantDetectionProviders()&&!h&&!f&&!g&&r&&l!=="editor"&&c?.modeInfo?.kind!=="agent"&&c?.modeInfo?.kind!=="edit"&&!c?.agentIdSilent){let Lo=this.getHistoryEntriesFromModel(v,l,s.id),kc=Mr(s,void 0,r,!1),Cn=await this.chatAgentService.detectAgentOrCommand(kc,Lo,{location:l},V);Cn&&this.chatAgentService.getAgent(Cn.agent.id)?.locations?.includes(l)&&(p?.response?.setAgent(Cn.agent,Cn.command),ae=Cn.agent,ce=Cn.command)}let va=ae??h?.agent??s,$s=ce??g?.command;await this.extensionService.activateByEvent(`onChatParticipant:${va.id}`);let _l=this.getHistoryEntriesFromModel(v,l,va.id),mc=Mr(va,$s,r,!!ae);this.generateInitialChatTitleIfNeeded(e,mc,s,V);let su=this._pendingRequests.get(t);su&&(M.add(ve(Lo=>{let kc=su.yieldRequested.read(Lo);p&&this.chatAgentService.setYieldRequested(va.id,p.id,kc)})),su.requestId??=mc.requestId,su.requestId&&this.telemetryService.publicLog2(F2,{action:"add",source:"sendRequestId",requestId:su.requestId,chatSessionId:jp(t)}));let yu="chat.disabledClaudeHooks.notification";if(No&&!this.storageService.getBoolean(yu,1)&&(this.storageService.store(yu,!0,1,0),se([{kind:"disabledClaudeHooks"}])),e.canUseTools){let Lo=new PPt(this.mcpService.autostart(V));Lo.isEmpty||(se([Lo]),await Lo.wait())}let sr=await this.chatAgentService.invokeAgent(va.id,mc,se,_l,V);He=sr,Ee=this.chatAgentService.getFollowups(va.id,mc,sr,_l,u)}else if(f&&this.chatSlashCommandService.hasCommand(f.slashCommand.command,yn(e.sessionResource))){f.slashCommand.silent!==!0&&(p=e.addRequest(o,{variables:[]},n,c?.modeInfo),E());let Te=[];for(let Oi of e.getRequests())Oi.response&&(Te.push({role:1,content:[{type:"text",value:Oi.message.text}]}),Te.push({role:2,content:[{type:"text",value:Oi.response.response.toString()}]}));let It=o.text,tt=await this.chatSlashCommandService.executeCommand(f.slashCommand.command,It.substring(f.slashCommand.command.length+1).trimStart(),new nh(Oi=>{se([Oi])}),Te,l,e.sessionResource,V,c);Ee=Promise.resolve(tt?.followUp),He={}}else throw new Error("Cannot handle request");if(V.isCancellationRequested&&!He)return;if(p){He||(this.trace("sendRequest",`Provider returned no response for session ${e.sessionResource}`),He={errorDetails:{message:d(9343,null)}});let Te=He.errorDetails?.responseIsFiltered?"filtered":He.errorDetails&&S?"errorWithOutput":He.errorDetails?"error":"success";if(b.complete({timeToFirstProgress:He.timings?.firstProgress,totalTime:He.timings?.totalElapsed,result:Te,requestType:y,detectedAgent:ae,request:p}),e.setResponse(p,He),E(),this.trace("sendRequest",`Provider returned response for session ${e.sessionResource}`),He.errorDetails?.isRateLimited&&this.chatEntitlementService.markAnonymousRateLimited(),K=!He.errorDetails&&!V.isCancellationRequested&&!p.response?.response.value.some(It=>It.kind==="confirmation"&&!It.isUsed),p.response?.complete(),Ee){let It=p;Ee.then(tt=>{e.setFollowups(It,tt);let Oi=g?g.command.name:f?.slashCommand.command;this._chatServiceTelemetry.retrievedFollowups(h?.agent.id??"",Oi,tt?.length??0)})}}else{K=!V.isCancellationRequested;return}}catch(He){if(this.logService.error(`Error while handling chat request: ${Mn(He,!0)}`),p){b.complete({timeToFirstProgress:void 0,totalTime:void 0,result:"error",requestType:y,detectedAgent:ae,request:p});let Ee={errorDetails:{message:He.message}};e.setResponse(p,Ee),E(),p.response?.complete()}}finally{M.dispose()}},K=!1,j=H(),J=this.instantiationService.createInstance(YVe,N,void 0,j,c);return this._pendingRequests.set(e.sessionResource,J),this.telemetryService.publicLog2(F2,{action:"add",source:"sendRequest",chatSessionId:jp(e.sessionResource)}),j.finally(()=>{V0(t,W0.RequestComplete),tSi(t),this._pendingRequests.get(e.sessionResource)===J&&(this._pendingRequests.deleteAndDispose(e.sessionResource),this.telemetryService.publicLog2(F2,{action:"remove",source:"sendRequestComplete",requestId:J.requestId,chatSessionId:jp(e.sessionResource)})),K&&this.processNextPendingRequest(e)}),c?.userSelectedModelId&&this.languageModelsService.addToRecentlyUsedList(c.userSelectedModelId),this._onDidSubmitRequest.fire({chatSessionResource:e.sessionResource,message:o}),{responseCreatedPromise:w.p,responseCompletePromise:j}}processPendingRequests(e){let t=this._sessionModels.get(e);t&&!this._pendingRequests.has(e)&&this.processNextPendingRequest(t)}_isServerManagedQueue(e){return yn(e).startsWith("agent-host-")}processNextPendingRequest(e){if(this._isServerManagedQueue(e.sessionResource))return;let t=e.dequeueAllSteeringRequests(),o=t.length===0?e.dequeuePendingRequest():void 0,n=t.length>0?t:o?[o]:[];if(n.length===0)return;this.trace("processNextPendingRequest",`Processing ${n.length} queued request(s) for session ${e.sessionResource}`);let r=[];for(let w of n){let x=this._queuedRequestDeferreds.get(w.request.id);this._queuedRequestDeferreds.delete(w.request.id),x&&r.push(x)}let s=n[0],l=new Set(n.map(w=>w.sendOptions.terminalExecutionId).filter(w=>!!w));l.size>1&&this.info("processNextPendingRequest",`Dropping terminalExecutionId: ${l.size} conflicting terminal IDs (${[...l].join(", ")})`);let c=l.size===1?[...l][0]:void 0,u={...s.sendOptions,terminalExecutionId:c,attachedContext:n.flatMap(w=>w.request.variableData.variables.slice())},p=u.location??u.locationData?.type??e.initialLocation,h=this.chatAgentService.getDefaultAgent(p,u.modeInfo?.kind);if(!h){this.logService.warn("processNextPendingRequest",`No default agent for location ${p}`);for(let w of r)w.complete({kind:"rejected",reason:"No default agent available"});return}let g;try{if(n.length>1){let w=n.map(x=>x.request.message.text).join(`

`);g=this.parseChatRequest(e.sessionResource,w,p,{...u,agentId:void 0,slashCommand:void 0})}else g=s.request.message}catch(w){this.logService.error("processNextPendingRequest: failed to parse combined chat request",w);let x=Mn(w);for(let E of r)E.complete({kind:"rejected",reason:x});return}let f=u.agentIdSilent?this.chatAgentService.getAgent(u.agentIdSilent):void 0,v=f??g.parts.find(w=>w instanceof Qp)?.agent??h,b=g.parts.find(w=>w instanceof cb),y={kind:"sent",data:{...this._sendRequestAsync(e,e.sessionResource,g,s.request.attempt,!u.noCommandDetection,f??h,p,u),agent:v,slashCommand:b?.command}};for(let w of r)w.complete(y)}generateInitialChatTitleIfNeeded(e,t,o,n){if(e.getRequests().length!==1||e.customTitle)return;let r=[{request:t,response:[],result:{}}];(async()=>{let l=await this.chatAgentService.getChatTitle(o.id,r,n);l&&!e.customTitle&&e.setCustomTitle(l)})()}prepareContext(e){return e??=[],e.sort((t,o)=>!t.range&&!o.range?0:t.range?o.range?o.range.start-t.range.start:-1:1),e}getHistoryEntriesFromModel(e,t,o){let n=[],r=this.chatAgentService.getAgent(o);for(let s of e){if(!s.response||o!==s.response.agent?.id&&!r?.isDefault&&!r?.canAccessPreviousChatHistory||t==="editor")continue;let l=DPt(s.message),c={sessionResource:s.session.sessionResource,requestId:s.id,agentId:s.response.agent?.id??"",message:l.message,command:s.response.slashCommand?.name,variables:Qxi(s.variableData,l.diff),location:"panel",editedFileEvents:s.editedFileEvents,modeInstructions:s.modeInfo?.modeInstructions};n.push({request:c,response:iho(s.response.response.value),result:s.response.result??{}})}return n}async removeRequest(e,t){let o=this._sessionModels.get(e);if(!o)throw new Error(`Unknown session: ${e}`);let n=this._pendingRequests.get(e);n?.requestId===t&&(n.cancel(),this._pendingRequests.deleteAndDispose(e),this.telemetryService.publicLog2(F2,{action:"remove",source:"removeRequest",requestId:t,chatSessionId:jp(o.sessionResource)})),o.removeRequest(t)}async adoptRequest(e,t){if(!(t instanceof lU))throw new TypeError("Can only adopt requests of type ChatRequestModel");let o=this._sessionModels.get(e);if(!o)throw new Error(`Unknown session: ${e}`);let n=t.session;if(o.adoptRequest(t),t.response&&!t.response.isComplete){let r=this._pendingRequests.deleteAndLeak(n.sessionResource);r&&(r.requestId=t.id,this._pendingRequests.set(o.sessionResource,r),this.telemetryService.publicLog2(F2,{action:"remove",source:"adoptRequest",requestId:t.id,chatSessionId:jp(n.sessionResource)}),this.telemetryService.publicLog2(F2,{action:"add",source:"adoptRequest",requestId:t.id,chatSessionId:jp(o.sessionResource)}))}}async addCompleteRequest(e,t,o,n,r){this.trace("addCompleteRequest",`message: ${t}`);let s=this._sessionModels.get(e);if(!s)throw new Error(`Unknown session: ${e}`);let l=typeof t=="string"?this.instantiationService.createInstance(nR).parseChatRequest(e,t):t,c=s.addRequest(l,o||{variables:[]},n??0,void 0,void 0,void 0,void 0,void 0,void 0,!0);if(typeof r.message=="string")s.acceptResponseProgress(c,{content:new he(r.message),kind:"markdownContent"});else for(let u of r.message)s.acceptResponseProgress(c,u,!0);s.setResponse(c,r.result||{}),r.followups!==void 0&&s.setFollowups(c,r.followups),c.response?.complete()}async cancelCurrentRequestForSession(e,t){this.trace("cancelCurrentRequestForSession",`session: ${e}`);let o=this._pendingRequests.get(e);if(!o){if(t!=="archive"){let r=this._sessionModels.get(e),s=r?.requestInProgress.get(),l=r?.getPendingRequests().length??0,c=r?.lastRequest;this.telemetryService.publicLog2(HYe,{source:t??"chatService",reason:"noPendingRequest",requestInProgress:s===void 0?"unknown":s?"true":"false",pendingRequests:l,sessionScheme:e.scheme,lastRequestId:c?.id,chatSessionId:jp(e)}),this.info("cancelCurrentRequestForSession",`No pending request was found for session ${e}. requestInProgress=${s??"unknown"}, pendingRequests=${l}`)}return}let n=o.responseCompletePromise;o.cancel(),this._pendingRequests.deleteAndDispose(e),this.telemetryService.publicLog2(F2,{action:"remove",source:t??"cancelRequest",requestId:o.requestId,chatSessionId:jp(e)}),n&&await Uu(n,1e3)}setYieldRequested(e){let t=this._pendingRequests.get(e);t&&t.setYieldRequested()}migrateRequests(e,t){let o=this._sessionModels.get(e);if(!o)return;let n=[...o.getPendingRequests()];if(n.length!==0){for(let r of n)this.removePendingRequest(e,r.request.id);for(let r of n)this.sendRequest(t,r.request.message.text,{...r.sendOptions,queue:r.kind})}}removePendingRequest(e,t){let o=this._sessionModels.get(e);o&&(o.removePendingRequest(t),o.getPendingRequests().some(s=>s.kind==="steering")||this._pendingRequests.get(e)?.resetYieldRequested());let n=this._queuedRequestDeferreds.get(t);n&&(n.complete({kind:"rejected",reason:"Request was removed from queue"}),this._queuedRequestDeferreds.delete(t))}setPendingRequests(e,t){let o=this._sessionModels.get(e);o&&o.setPendingRequests(t)}hasSessions(){return this._chatSessionStore.hasSessions()}async transferChatSession(e,t){if(!Br.isLocalSession(e))throw new Error(`Can only transfer local chat sessions. Invalid session: ${e}`);let o=this._sessionModels.get(e);if(!o)throw new Error(`Failed to transfer session. Unknown session: ${e}`);if(o.initialLocation!=="panel")throw new Error(`Can only transfer chat sessions located in the Chat view. Session ${e} has location=${o.initialLocation}`);await this._chatSessionStore.storeTransferSession({sessionResource:o.sessionResource,timestampInMilliseconds:Date.now(),toWorkspace:t},o),this.chatTransferService.addWorkspaceToTransferred(t),this.trace("transferChatSession",`Transferred session ${o.sessionResource} to workspace ${t.toString()}`)}getChatStorageFolder(){return this._chatSessionStore.getChatStorageFolder()}logChatIndex(){this._chatSessionStore.logIndex()}setSessionTitle(e,t){this._sessionModels.get(e)?.setCustomTitle(t)}appendProgress(e,t){let o=this._sessionModels.get(e.session.sessionResource);if(!(e instanceof lU))throw new ci("Can only append progress to requests of type ChatRequestModel");o?.acceptResponseProgress(e,t)}toLocalSessionId(e){let t=Br.parseLocalSessionId(e);if(!t)throw new Error(`Invalid local chat session resource: ${e}`);return t}};XVe=I([m(0,de),m(1,re),m(2,_e),m(3,lt),m(4,F),m(5,Ae),m(6,rN),m(7,gr),m(8,B),m(9,QVe),m(10,Ms),m(11,Vs),m(12,jr),m(13,dr),m(14,Gr),m(15,ph)],XVe);async function GOi(a){let i=a.title||d(9344,null);return{sessionResource:a.sessionResource,title:i,lastMessageDate:a.lastMessageDate,timing:a.timing,isActive:!0,stats:await EWt(a),lastResponseState:a.lastRequest?.response?.state??0,workingDirectory:a.workingDirectory}}function ujt(a){return zn.registerExtensionPoint({extensionPoint:a,jsonSchema:{description:d(9408,null,a),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{path:a==="chatSkills"?"./relative/path/to/skill-name/SKILL.md":"./relative/path/to/file.md"}}],required:["path"],properties:{path:{description:a==="chatSkills"?d(9405,null):d(9404,null),type:"string"},name:{description:d(9402,null),deprecationMessage:d(9403,null),type:"string"},description:{description:d(9400,null),deprecationMessage:d(9401,null),type:"string"},when:{description:d(9407,null),type:"string"},sessionTypes:{description:d(9406,null),type:"array",items:{type:"string"}}}}}})}var qgn=ujt("chatPromptFiles"),$gn=ujt("chatInstructions"),jgn=ujt("chatAgents"),Qgn=ujt("chatSkills");function QTo(a){switch(a){case"chatPromptFiles":return"prompt";case"chatInstructions":return"instructions";case"chatAgents":return"agent";case"chatSkills":return"skill";default:{let i=a;throw new Error(`Unknown contribution point: ${i}`)}}}function YTo(a,i,e){return`${a.value}/${i}/${e}`}var zve=class{constructor(i){this.promptsService=i;this.registrations=new Ot;this.handle(qgn,"chatPromptFiles"),this.handle($gn,"chatInstructions"),this.handle(jgn,"chatAgents"),this.handle(Qgn,"chatSkills")}static{this.ID="workbench.contrib.chatPromptFilesExtensionPointHandler"}handle(i,e){i.setHandler((t,o)=>{for(let n of o.added){let r=QTo(e);for(let s of n.value){if(!s.path){n.collector.error(d(9417,null,n.description.identifier.value,e));continue}let l=Ve(n.description.extensionLocation,s.path);if(!Yr(l,n.description.extensionLocation)){n.collector.error(d(9415,null,n.description.identifier.value,e,s.path));continue}if(s.when&&!C.deserialize(s.when)){n.collector.error(d(9416,null,n.description.identifier.value,e,s.path,s.when));continue}try{let c=this.promptsService.registerContributedFile(r,l,n.description,s.name,s.description,s.when,s.sessionTypes);this.registrations.set(YTo(n.description.identifier,r,s.path),c)}catch(c){let u=c instanceof Error?c.message:String(c);n.collector.error(d(9418,null,n.description.identifier.value,e,s.path,u))}}}for(let n of o.removed){let r=QTo(e);for(let s of n.value)this.registrations.deleteAndDispose(YTo(n.description.identifier,r,s.path))}})}};zve=I([m(0,jr)],zve);Ge.registerCommand("_listExtensionPromptFiles",async a=>{let i=a.get(jr),[e,t,o,n,r]=await Promise.all([i.listPromptFiles("agent",Ie.None),i.listPromptFiles("instructions",Ie.None),i.listPromptFiles("prompt",Ie.None),i.listPromptFiles("skill",Ie.None),i.listPromptFiles("hook",Ie.None)]),s=[];for(let l of[...e,...t,...o,...n,...r])l.storage==="extension"&&s.push({uri:l.uri.toJSON(),type:l.type,extensionId:l.extension.identifier.value});return s});var JVe=class extends k{constructor(e){super();this.contributionPoint=e;this.type="table"}shouldRender(e){return!!e.contributes?.[this.contributionPoint]}render(e){let t=e.contributes?.[this.contributionPoint]??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(9410,null),d(9409,null),d(9411,null)],n=t.map(r=>[r.name??"-",r.description??"-",r.path]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatPromptFiles",label:d(9413,null),access:{canToggle:!1},renderer:new Vt(JVe,["chatPromptFiles"])});oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatInstructions",label:d(9412,null),access:{canToggle:!1},renderer:new Vt(JVe,["chatInstructions"])});oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatAgents",label:d(9399,null),access:{canToggle:!1},renderer:new Vt(JVe,["chatAgents"])});oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatSkills",label:d(9414,null),access:{canToggle:!1},renderer:new Vt(JVe,["chatSkills"])});var ZVe=class{constructor(i){this.promptsService=i}async provideLinks(i,e){let t=this.promptsService.getParsedPromptFile(i);if(!t.body)return;let o=[];for(let n of t.body.fileReferences)if(!n.isMarkdownLink){let r=t.body.resolveFilePath(n.content);r&&o.push({range:n.range,url:r})}return{links:o}}};ZVe=I([m(0,jr)],ZVe);var eBe=class{constructor(i,e){this.fileService=i;this.languageModelToolsService=e;this._debugDisplayName="PromptBodyAutocompletion";this.triggerCharacters=[":",".","/","\\"]}async provideCompletionItems(i,e,t,o){let n=bC(i.getLanguageId());if(!n)return;let r=await this.findVariableReference(i,e,o);if(!r)return;let s=[];switch(r.type){case"file":r.contentRange.containsPosition(e)?await this.collectFilePathCompletions(i,e,r.contentRange,s):await this.collectDefaultCompletions(i,r.range,n,s);break;case"tool":r.contentRange.containsPosition(e)?(n==="agent"||n==="prompt")&&await this.collectToolCompletions(i,e,r.contentRange,s):await this.collectDefaultCompletions(i,r.range,n,s);break;default:await this.collectDefaultCompletions(i,r.range,n,s)}return{suggestions:s}}async collectToolCompletions(i,e,t,o){for(let n of this.languageModelToolsService.getFullReferenceNames())o.push({label:n,kind:13,filterText:n,insertText:n,range:t})}async collectFilePathCompletions(i,e,t,o){let n=i.getValueInRange(t.setEndPosition(e.lineNumber,e.column)),r=n.includes("/")||!n.includes("\\")?"/":"\\",s;if(n.match(/[^\/]\.\.$/i))s=n+r;else{let c=n.length-1;for(;c>=0&&![47,92].includes(n.charCodeAt(c));)c--;s=n.substring(0,c+1)}let l={id:"editor.action.triggerSuggest",title:"Suggest"};try{let c=Jn.resolvePath(ai(i.uri),s),{children:u}=await this.fileService.resolve(c);if(u)for(let p of u){let h=(s||"."+r)+p.name;o.push({label:p.name+(p.isDirectory?r:""),kind:p.isDirectory?23:20,range:t,insertText:h+(p.isDirectory?r:""),filterText:h,command:p.isDirectory?l:void 0})}}catch{}o.push({label:"..",kind:23,insertText:s+".."+r,range:t,filterText:s+"..",command:l})}async findVariableReference(i,e,t){if(i.getLineContent(1).trimEnd()==="---"){let l=2;for(;l<=i.getLineCount()&&i.getLineContent(l).trimEnd()!=="---";)l++;if(l>=e.lineNumber)return}let o=new RegExp(`${dp}[^\\s#]*`,"g"),n=Rk(e.column,o,i.getLineContent(e.lineNumber),0);if(!n)return;let r=new G(e.lineNumber,n.startColumn+1,e.lineNumber,n.endColumn),s=n.word.match(/^#(\w+:)?/);if(s){let l=n.startColumn+s[0].length;if(s[1]==="file:")return{type:"file",contentRange:new G(e.lineNumber,l,e.lineNumber,n.endColumn),range:r};if(s[1]==="tool:")return{type:"tool",contentRange:new G(e.lineNumber,l,e.lineNumber,n.endColumn),range:r}}return{type:"",contentRange:r,range:r}}async collectDefaultCompletions(i,e,t,o){(t==="instructions"?["file"]:["file","tool"]).forEach(r=>{o.push({label:`${r}:`,kind:17,insertText:`${r}:`,range:e,command:{id:"editor.action.triggerSuggest",title:"Suggest"}})})}};eBe=I([m(0,ge),m(1,Wn)],eBe);var tBe=class{constructor(i,e,t,o,n){this.promptsService=i;this.languageModelsService=e;this.languageModelToolsService=t;this.chatModeService=o;this.environmentService=n;this._debugDisplayName="PromptHeaderAutocompletion";this.triggerCharacters=[":"]}async provideCompletionItems(i,e,t,o){let n=bC(i.getLanguageId());if(!n)return;if(/^\s*$/.test(i.getValue()))return{suggestions:[{label:d(9554,null),kind:28,insertText:["---","description: $1","---","$0"].join(`
`),insertTextRules:4,range:i.getFullModelRange()}]};let r=this.promptsService.getParsedPromptFile(i),s=r.header;if(!s)return;let l=r.header.range;if(e.lineNumber<l.startLineNumber||e.lineNumber>=l.endLineNumber)return;let u=i.getLineContent(e.lineNumber).indexOf(":"),p=u!==-1?new ye(e.lineNumber,u+1):void 0;if(!p||e.isBeforeOrEqual(p)){let h=s.attributes.find(({range:g})=>g.startLineNumber<e.lineNumber&&e.lineNumber<=g.endLineNumber);if(!h)for(let g=s.attributes.length-1;g>=0;g--){let f=s.attributes[g];if(f.range.endLineNumber<e.lineNumber&&f.value.type==="map"){let v=s.attributes[g+1],b=v?v.range.startLineNumber:l.endLineNumber;e.lineNumber<b&&(h=f);break}}if(h){let f=i.getLineContent(h.range.startLineNumber).indexOf(":");if(f!==-1)return this.provideValueCompletions(i,e,s,new ye(h.range.startLineNumber,f+1),n,h)}return this.provideAttributeNameCompletions(i,e,s,p,n)}else if(p&&p.isBefore(e))return this.provideValueCompletions(i,e,s,p,n)}async provideAttributeNameCompletions(i,e,t,o,n){let r=[],s=Ax(n,t),l=new Set(FSi(n,!1,s));for(let u of t.attributes)l.delete(u.key);let c=async u=>{if(o)return u;if(u===no.hooks&&n==="agent"&&s!=="claude"){let h=Object.keys(qg[s]??qg.undefined);return`${u}:
  \${1|${h.join(",")}|}:
    - type: command
      command: "$2"`}let p=await this.getValueSuggestions(n,u,s);return p.length>0?`${u}: \${0:${p[0].name}}`:`${u}: $0`};for(let u of l){let p={label:u,documentation:FZ(u,n,s)?.description,kind:9,insertText:await c(u),insertTextRules:4,range:new G(e.lineNumber,1,e.lineNumber,o?o.column:i.getLineMaxColumn(e.lineNumber))};r.push(p)}return{suggestions:r}}async provideValueCompletions(i,e,t,o,n,r){let s=[],l=e.lineNumber,c=r??t.attributes.find(({range:f})=>f.startLineNumber<=l&&l<=f.endLineNumber);if(!c)return;let u=Ax(n,t);if(!FSi(n,!0,u).includes(c.key))return;if(n==="prompt"||n==="agent"){if(c.key===no.model&&c.value.type==="sequence"){let f=async()=>u==="claude"?OZ:this.getModelNames(n==="agent");return this.provideArrayCompletions(i,e,c.value,f)}if(c.key===no.tools||c.key===cXe.disallowedTools){let f=c.value;if(f.type==="scalar"&&(f=AH(f)),f.type==="sequence"){let v=async()=>u==="github-copilot"||this.environmentService.isSessionsWindow?slo:u==="claude"?OZ:Array.from(this.languageModelToolsService.getFullReferenceNames()).map(b=>({name:b}));return this.provideArrayCompletions(i,e,f,v)}}}if(c.key===no.agents&&c.value.type==="sequence")return this.provideArrayCompletions(i,e,c.value,async()=>(await this.promptsService.getCustomAgents(Ie.None)).filter(f=>f.enabled));if(c.key===no.hooks){if(c.value.type==="map")return this.provideHookEventCompletions(i,e,c.value,u);if(e.lineNumber!==c.range.startLineNumber){let f={type:"map",properties:[],range:c.value.range};return this.provideHookEventCompletions(i,e,f,u)}}let h=i.getLineContent(c.range.startLineNumber).substring(o.column).match(/^\s*/)?.[0].length??0,g=await this.getValueSuggestions(n,c.key,u);for(let f of g){let v={label:f.name,documentation:f.description,kind:13,insertText:h===0?` ${f.name}`:f.name,range:new G(e.lineNumber,o.column+h+1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))};s.push(v)}if(c.key===no.handOffs){let f=["","  - label: Start Implementation","    agent: agent","    prompt: Implement the plan","    send: true"].join(`
`),v={label:d(9555,null),kind:13,insertText:h===0?` ${f}`:f,range:new G(e.lineNumber,o.column+h+1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))};s.push(v)}if(c.key===no.hooks&&n==="agent"){let f=["","  ${1|"+Object.keys(qg[u]??qg.undefined).join(",")+"|}:","    - type: command",'      command: "$2"'].join(`
`),v={label:d(9558,null),kind:28,insertText:h===0?` ${f}`:f,insertTextRules:4,range:new G(e.lineNumber,o.column+h+1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))};s.push(v)}return{suggestions:s}}provideHookEventCompletions(i,e,t,o){if(t.properties.find(b=>b.key.range.startLineNumber===e.lineNumber)){let b=i.getLineContent(e.lineNumber),S=b.indexOf(":");if(S!==-1&&e.column>S+1){let y=b.substring(S+1).match(/^\s*/)?.[0].length??0,w=["","  - type: command",'    command: "$1"'].join(`
`);return{suggestions:[{label:d(9556,null),documentation:d(9557,null),kind:28,insertText:y===0?` ${w}`:w,insertTextRules:4,range:new G(e.lineNumber,S+1+y+1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))}]}}}let r=this.provideHookCommandFieldCompletions(i,e,t,o);if(r)return r;let s=[],l=qg[o]??qg.undefined,c=i.getLineContent(e.lineNumber),u=c.search(/\S/),p=u===-1,h=p?e.column:u+1,g=new Set(t.properties.filter(b=>b.key.range.startLineNumber!==e.lineNumber).map(b=>b.key.value)),f=t.properties.length>0?t.properties[0].key.range.startColumn-1:-1;if(f>=0){let b=i.getLineCount();for(let S=t.range.endLineNumber+1;S<=b;S++){if(S===e.lineNumber)continue;let y=i.getLineContent(S),w=y.search(/\S/);if(w!==-1){if(w<f)break;if(w===f){let x=y.match(/^\s+(\S+)\s*:/);x&&g.add(x[1])}}}}let v=c.indexOf(":")!==-1;for(let[b,S]of Object.entries(l)){if(g.has(b))continue;let y=yC[S],w;p?w=[`${b}:`,"  - type: command",'    command: "$1"'].join(`
`):v?w=`${b}:`:w=b,s.push({label:b,documentation:y?.description,kind:9,insertText:w,insertTextRules:4,range:new G(e.lineNumber,h,e.lineNumber,i.getLineMaxColumn(e.lineNumber))})}return{suggestions:s}}provideHookCommandFieldCompletions(i,e,t,o){let n=this.findContainingCommandMap(i,e,t);if(!n)return;let s=o==="github-copilot"?["type","bash","powershell","cwd","env","timeoutSec"]:["type","command","windows","linux","osx","bash","powershell","cwd","env","timeout"],l=new Set(n.properties.filter(S=>S.key.range.startLineNumber!==e.lineNumber).map(S=>S.key.value)),c=i.getLineContent(e.lineNumber),u=c.search(/\S/),p=u===-1,h=c.match(/^(\s*-\s+)/),g=h?h[1].length:u,f=p?e.column:g+1,v=c.indexOf(":"),b=[];for(let S of s){if(l.has(S))continue;let y=Px[S],w=v!==-1?S:`${S}: $0`;b.push({label:S,documentation:y,kind:9,insertText:w,insertTextRules:4,range:new G(e.lineNumber,f,e.lineNumber,v!==-1?v+1:i.getLineMaxColumn(e.lineNumber))})}return b.length>0?{suggestions:b}:void 0}findContainingCommandMap(i,e,t){for(let o=0;o<t.properties.length;o++){let n=t.properties[o];if(n.value.type!=="sequence")continue;let r=n.value.range,s=t.properties[o+1],l=r.containsPosition(e),c=!l&&r.endLineNumber<e.lineNumber&&(!s||s.key.range.startLineNumber>e.lineNumber);if(l||c){if(c){let h=i.getLineContent(e.lineNumber).search(/\S/),g=h===-1?e.column-1:h,f=n.key.range.startColumn-1;if(g<=f)continue}let u=this.findCommandMapInSequence(e,n.value);if(u)return u}}}findCommandMapInSequence(i,e){for(let t=0;t<e.items.length;t++){let o=e.items[t];if(o.type!=="map"){if(o.type==="scalar"&&o.range.startLineNumber===i.lineNumber)return{type:"map",properties:[],range:o.range};continue}let n=o.range.containsPosition(i),r=!n&&o.range.endLineNumber<i.lineNumber&&(t+1>=e.items.length||e.items[t+1].range.startLineNumber>i.lineNumber);if(!n&&!r)continue;let s=o.properties.find(l=>l.key.value==="hooks");if(s?.value.type==="sequence"){let l=this.findCommandMapInSequence(i,s.value);if(l)return l}return o}}async getValueSuggestions(i,e,t){let o=FZ(e,i,t);if(o?.enums)return o.enums;if(o?.defaults)return o.defaults.map(n=>({name:n}));switch(e){case no.agent:case no.mode:if(i==="prompt"){let n=await this.chatModeService.getLocalModes(),r=[];for(let s of yt.concat(n.builtin,n.custom))r.push({name:s.name.get(),description:s.label.get()});return r}break;case no.model:if(i==="prompt"||i==="agent")return this.getModelNames(i==="agent");break}return[]}getModelNames(i){let e=[];for(let t of this.languageModelsService.getLanguageModelIds()){let o=this.languageModelsService.lookupLanguageModel(t);o&&o.isUserSelectable!==!1&&!o.targetChatSessionType&&(!i||Mx.suitableForAgentMode(o))&&e.push({name:Mx.asQualifiedName(o),description:o.tooltip})}return e}async provideArrayCompletions(i,e,t,o){let n=async(s,l)=>{let c=[],u=await o(),p=ZCo(t,i),h=new Set(t.items.filter(g=>g!==l).filter(g=>g.type==="scalar").map(g=>g.value));for(let g of u){let f=g.name;if(h.has(f))continue;let v;if(s.isEmpty())v=eqt(f,p);else{let b=i.getValueInRange(s).charCodeAt(0);v=b===39?`'${f}'`:b===34?`"${f}"`:f}c.push({label:f,documentation:g.description,kind:13,filterText:v,insertText:v,range:s})}return{suggestions:c}};for(let s of t.items)if(s.range.containsPosition(e))return await n(s.range,s);if(i.getValueInRange(new G(e.lineNumber,1,e.lineNumber,e.column)).match(/[:,[]\s*$/))return await n(new G(e.lineNumber,e.column,e.lineNumber,e.column))}};tBe=I([m(0,jr),m(1,Gr),m(2,Wn),m(3,kE),m(4,Mt)],tBe);var iBe=class{constructor(i,e,t,o){this.promptsService=i;this.languageModelToolsService=e;this.languageModelsService=t;this.chatModeService=o;this._debugDisplayName="PromptHoverProvider"}createHover(i,e){return{contents:[new he(i)],range:e}}async provideHover(i,e,t,o){let n=bC(i.getLanguageId());if(!n)return;let r=this.promptsService.getParsedPromptFile(i),s=Ax(n,r.header??i.uri);if(r.header?.range.containsPosition(e))return this.provideHeaderHover(e,n,r.header,s);if(r.body?.range.containsPosition(e))return this.provideBodyHover(e,r.body,s)}async provideBodyHover(i,e,t){for(let o of e.variableReferences)if(o.range.containsPosition(i)){let n=o.name;return this.getToolHoverByName(n,o.range,t)}}async provideHeaderHover(i,e,t,o){for(let n of t.attributes)if(n.range.containsPosition(i)){let r=FZ(n.key,e,o)?.description;if(r)switch(n.key){case no.model:return this.getModelHover(n,i,r,o);case no.tools:case cXe.disallowedTools:return this.getToolHover(n,i,r,o);case no.agent:case no.mode:return this.getAgentHover(n,i,r);case no.handOffs:return this.getHandsOffHover(n,i,o);case no.hooks:return this.getHooksHover(n,i,r,o);case no.infer:return this.createHover(r+`

`+d(9565,null),n.range);default:return this.createHover(r,n.range)}}}getToolHover(i,e,t,o){let n=i.value;if(n.type==="scalar"&&(n=AH(n)),n.type==="sequence"){for(let r of n.items)if(r.type==="scalar"&&r.range.containsPosition(e)){let s=this.getToolHoverByName(r.value,r.range,o);if(s)return s}}return this.createHover(t,i.range)}getToolHoverByName(i,e,t){if(t==="claude"){let n=OZ.find(r=>r.name===i)?.description;return n?this.createHover(n,e):void 0}let o=this.languageModelToolsService.getToolByFullReferenceName(i);if(o!==void 0)return _h(o)?this.getToolsetHover(o,e):this.createHover(o.userDescription??o.modelDescription,e)}getToolsetHover(i,e){let t=[];t.push(d(9570,null,i.referenceName)),i.description&&t.push(i.description);for(let o of i.getTools())t.push(`- ${o.toolReferenceName??o.displayName}`);return this.createHover(t.join(`
`),e)}getModelHover(i,e,t,o){if(o==="github-copilot")return this.createHover(t+`

`+d(9564,null),i.range);let n=r=>{let s=[];if(s.push(t+`
`),o==="claude"){let c=ZPt.find(u=>u.name===r);if(!c)return this.createHover(s.join(`
`),i.range);if(c.modelEquivalent)s.push(d(9559,null,r)),r=c.modelEquivalent;else return s.push(c.description),this.createHover(s.join(`
`),i.range)}let l=this.languageModelsService.lookupLanguageModelByQualifiedName(r);if(l){let c=l.metadata;return s.push(d(9561,null,c.name)),s.push(d(9560,null,c.family)),s.push(d(9562,null,c.vendor)),c.tooltip&&s.push("","",c.tooltip),this.createHover(s.join(`
`),i.range)}};if(i.value.type==="scalar"){let r=n(i.value.value);if(r)return r}else if(i.value.type==="sequence"){for(let r of i.value.items)if(r.type==="scalar"&&r.range.containsPosition(e)){let s=n(r.value);if(s)return s}}return this.createHover(t,i.range)}async getAgentHover(i,e,t){let o=[],n=i.value;if(n.type==="scalar"&&n.range.containsPosition(e)){let r=(await this.chatModeService.getLocalModes()).findModeByName(n.value);if(r){let s=r.description.get()||(mWt(r)?d(9567,null):d(9569,null));o.push(`\`${r.name.get()}\`: ${s}`)}}else{let r=await this.chatModeService.getLocalModes();o.push(t),o.push(""),o.push(d(9566,null));for(let s of r.builtin)o.push(`- \`${s.name.get()}\`: ${s.description.get()||s.label.get()}`);if(r.custom.length>0){o.push(""),o.push(d(9568,null));for(let s of r.custom){let l=s.description.get();o.push(`- \`${s.name.get()}\`: ${l||d(9569,null)}`)}}}return this.createHover(o.join(`
`),i.range)}getHooksHover(i,e,t,o){let n=i.value;if(n.type==="map"){let r=qg[o]??qg.undefined;for(let s of n.properties){if(s.key.range.containsPosition(e)){let l=r[s.key.value];if(l){let c=yC[l];return this.createHover(`**${c.label}**

${c.description}`,s.key.range)}}if(s.value.type==="sequence"){let l=this.getHookCommandItemHover(s.value,e);if(l)return l}}}return this.createHover(t,i.range)}getHookCommandItemHover(i,e){for(let t of i.items){if(t.type!=="map"||!t.range.containsPosition(e))continue;let o=t.properties.find(n=>n.key.value==="hooks");if(o&&o.value.type==="sequence"){let n=this.getHookCommandItemHover(o.value,e);if(n)return n}for(let n of t.properties)if(n.key.range.containsPosition(e)||n.value.range.containsPosition(e)){let r=Px[n.key.value];if(r)return this.createHover(r,n.key.range)}}}getHandsOffHover(i,e,t){let o=FZ(no.handOffs,"agent",t)?.description;return WZ(t)?this.createHover(o,i.range):this.createHover(o+`

`+d(9563,null),i.range)}};iBe=I([m(0,jr),m(1,Wn),m(2,Gr),m(3,kE)],iBe);var oBe=class{constructor(i,e){this.promptsService=i;this.chatModeService=e;this._debugDisplayName="PromptHeaderDefinitionProvider"}async provideDefinition(i,e,t){if(!bC(i.getLanguageId()))return;let r=this.promptsService.getParsedPromptFile(i).header;if(!r)return;let s=r.getAttribute(no.agent)??r.getAttribute(no.mode);if(s&&s.value.type==="scalar"&&s.range.containsPosition(e)){let l=(await this.chatModeService.getLocalModes()).findModeByName(s.value.value);if(l&&l.uri)return{uri:l.uri.get(),range:new G(1,1,1,1)}}}};oBe=I([m(0,jr),m(1,kE)],oBe);var alt="prompts-diagnostics-provider",nBe=class{constructor(i,e,t,o,n,r,s,l){this.languageModelsService=i;this.languageModelToolsService=e;this.chatModeService=t;this.fileService=o;this.labelService=n;this.promptsService=r;this.logger=s;this.configurationService=l}async validate(i,e,t){i.header?.errors.forEach(n=>t(An(n.message,n.range,8)));let o=efn(e,i.header??i.uri);await this.validateHeader(i,e,o,t),await this.validateBody(i,o,t),await this.validateFileName(i,e,t),await this.validateSkillAttributes(i,e,t)}async validateFileName(i,e,t){if(e==="agent"&&i.uri.path.endsWith(V2)){let o=this.promptsService.getAgentFileURIFromModeFile(i.uri);o&&await this.fileService.canCreateFile(o)?t(An(d(9661,null,o.toString()),new G(1,1,1,4),4)):t(An(d(9662,null,B2),new G(1,1,1,4),4))}}async validateSkillAttributes(i,e,t){if(e!=="skill"||!i.header)return;let o=i.header.getAttribute(no.name);if(!o)t(An(d(9726,null),new G(1,1,1,4),4));else if(o.value.type==="scalar"){let s=o.value.value.trim();if(s.length>0){OPt.test(s)||t(An(d(9725,null),o.value.range,8));let l=i.uri.path.split("/"),c=l.findIndex(u=>NPt(u));if(c>0){let u=l[c-1];u&&s!==u&&t(An(d(9724,null,s,u),o.value.range,4))}}}if(!i.header.getAttribute(no.description)){if(t(An(d(9722,null),new G(1,1,1,4),4)),i.header.userInvocable===!1){let s=i.header.getAttribute(no.userInvocable);s&&t(An(d(9727,null),s.value.range,8))}if(i.header.disableModelInvocation===!1){let s=i.header.getAttribute(no.disableModelInvocation);s&&t(An(d(9723,null),s.value.range,8))}}let r=i.header?.getAttribute(no.context);r&&r.value.type==="scalar"&&r.value.value.trim()==="fork"&&(this.configurationService.getValue("github.copilot.chat.skillTool.enabled")||t(An(d(9665,null),r.value.range,4)))}async validateBody(i,e,t){let o=i.body;if(!o)return;let n=[];for(let r of o.fileReferences){let s=o.resolveFilePath(r.content);if(!s){t(An(d(9702,null,r.content),r.range,4));continue}i.uri.scheme===s.scheme&&n.push((async()=>{try{if(!await this.fileService.exists(s)){let c=this.labelService.getUriLabel(s);t(An(d(9678,null,r.content,c),r.range,4))}}catch(l){this.logger.warn(`Error checking existence of file reference '${r.content}' resolved to '${s.toString()}' in prompt file '${i.uri.toString()}': ${l.message}`)}})())}if(o.variableReferences.length&&ZTo(e)){let r=i.header?.tools,s=r?this.languageModelToolsService.toToolAndToolSetEnablementMap(r,void 0):void 0,l=new Set(this.languageModelToolsService.getFullReferenceNames()),c=this.languageModelToolsService.getDeprecatedFullReferenceNames();for(let u of o.variableReferences)if(l.has(u.name)){if(s){let p=this.languageModelToolsService.getToolByFullReferenceName(u.name);p&&s.get(p)===!1&&t(An(d(9670,null,u.name),u.range,4))}}else if(c.has(u.name)){let p=c.get(u.name);if(p&&p.size>0)if(p.size===1){let h=Array.from(p)[0];t(An(d(9666,null,u.name,h),u.range,2))}else{let h=Array.from(p).sort((g,f)=>g.localeCompare(f)).join(", ");t(An(d(9667,null,u.name,h),u.range,2))}}else t(An(d(9748,null,u.name),u.range,1,[1]))}await Promise.all(n)}async validateHeader(i,e,t,o){let n=i.header;if(!n)return;let r=n.attributes;switch(this.checkForInvalidArguments(r,e,t,o),this.validateName(r,o),this.validateDescription(r,o),this.validateArgumentHint(r,o),e){case"prompt":{let s=await this.validateAgent(r,o);this.validateTools(r,s?.kind??"agent",t,o),this.validateModel(r,s?.kind??"agent",o);break}case"instructions":t==="claude"?this.validatePaths(r,o):this.validateApplyTo(r,o),this.validateExcludeAgent(r,o);break;case"agent":{this.validateTarget(r,o),this.validateInfer(r,o),this.validateUserInvocable(r,o),this.validateDisableModelInvocation(r,o),this.validateTools(r,"agent",t,o),this.validateHooks(r,t,o),ZTo(t)?(this.validateModel(r,"agent",o),this.validateHandoffs(r,o),await this.validateAgentsAttribute(r,n,o),this.validateGithubPermissions(r,o)):t==="claude"?this.validateClaudeAttributes(r,o):t==="github-copilot"&&this.validateGithubPermissions(r,o);break}case"skill":this.validateUserInvocable(r,o),this.validateDisableModelInvocation(r,o);break}}checkForInvalidArguments(i,e,t,o){let n=qOi(e,!0,t),r=new uo(()=>new Set(qOi(e,!1,"github-copilot")));for(let s of i)if(!n.includes(s.key)){let l=new uo(()=>qOi(e,!1,t).sort().join(", "));switch(e){case"prompt":o(An(d(9738,null,s.key,l.value),s.range,1,[1]));break;case"agent":t==="github-copilot"?o(An(d(9736,null,s.key,l.value),s.range,1,[1])):t==="claude"||(r.value.has(s.key)?o(An(d(9700,null,s.key),s.range,1,[1])):o(An(d(9741,null,s.key,l.value),s.range,1,[1])));break;case"instructions":t==="claude"?o(An(d(9739,null,s.key,l.value),s.range,1,[1])):o(An(d(9737,null,s.key,l.value),s.range,1,[1]));break;case"skill":o(An(d(9740,null,s.key,l.value),s.range,1,[1]));break}}}validateName(i,e){let t=i.find(o=>o.key===no.name);if(t){if(t.value.type!=="scalar"){e(An(d(9714,null),t.range,8));return}if(t.value.value.trim().length===0){e(An(d(9715,null),t.value.range,8));return}}}validateDescription(i,e){let t=i.find(o=>o.key===no.description);if(t){if(t.value.type!=="scalar"){e(An(d(9668,null),t.range,8));return}if(t.value.value.trim().length===0){e(An(d(9669,null),t.value.range,8));return}}}validateArgumentHint(i,e){let t=i.find(o=>o.key===no.argumentHint);if(t){if(t.value.type!=="scalar"){e(An(d(9657,null),t.range,8));return}if(t.value.value.trim().length===0){e(An(d(9658,null),t.value.range,4));return}}}validateModel(i,e,t){let o=i.find(s=>s.key===no.model);if(!o)return;if(o.value.type!=="scalar"&&o.value.type!=="sequence"){t(An(d(9711,null),o.value.range,8));return}let n=[];if(o.value.type==="scalar"){let s=o.value.value.trim();if(s.length===0){t(An(d(9710,null),o.value.range,8));return}n.push([s,o.value.range])}else if(o.value.type==="sequence"){if(o.value.items.length===0){t(An(d(9709,null),o.value.range,8));return}for(let s of o.value.items){if(s.type!=="scalar"){t(An(d(9708,null),s.range,8));return}let l=s.value.trim();if(l.length===0){t(An(d(9707,null),s.range,8));return}n.push([l,s.range])}}if(this.languageModelsService.getLanguageModelIds().length!==0)for(let[s,l]of n){let c=this.findModelByName(s);c?e==="agent"&&!Mx.suitableForAgentMode(c)&&t(An(d(9713,null,s),l,4)):t(An(d(9712,null,s),l,1,[1]))}}validateClaudeAttributes(i,e){for(let t in $Oi){let n=$Oi[t].enums;if(n){let r=i.find(s=>s.key===t);if(!r)continue;if(r.value.type!=="scalar"){e(An(d(9663,null,t),r.value.range,8));continue}else{let s=r.value.value.trim();if(n.every(l=>l.name!==s)){let l=n.map(c=>c.name).join(", ");e(An(d(9664,null,s,l),r.value.range,4))}}}}}findModelByName(i){let e=this.languageModelsService.lookupLanguageModelByQualifiedName(i);if(e&&e.metadata.isUserSelectable!==!1)return e.metadata}async validateAgent(i,e){let t=i.find(s=>s.key===no.agent),o=i.find(s=>s.key===no.mode);o&&e(t?An(d(9705,null),o.range,4,[2]):An(d(9706,null),o.range,4,[2]));let n=i.find(s=>s.key===no.agent)??o;if(!n)return;if(n.value.type!=="scalar"){e(An(d(9660,null,n.key),n.value.range,8));return}if(n.value.value.trim().length===0){e(An(d(9659,null,n.key),n.value.range,8));return}return await this.validateAgentValue(n.value,e)}async validateAgentValue(i,e){let t=await this.chatModeService.getLocalModes(),o=[];for(let r of yt.concat(t.builtin,t.custom)){if(r.name.get()===i.value)return r;o.push(r.name.get())}let n=d(9652,null,i.value,o.join(", "));e(An(n,i.range,4))}validateTools(i,e,t,o){let n=i.find(s=>s.key===no.tools);if(!n)return;e!=="agent"&&o(An(d(9735,null),n.range,4));let r=n.value;if(r.type==="scalar"&&(r=AH(r)),r.type!=="sequence"){o(An(d(9734,null),n.value.range,8));return}t==="github-copilot"||t==="claude"||this.validateVSCodeTools(r,o)}validateVSCodeTools(i,e){if(i.items.length>0){let t=new Set(this.languageModelToolsService.getFullReferenceNames()),o=this.languageModelToolsService.getDeprecatedFullReferenceNames();for(let n of i.items)if(n.type!=="scalar")e(An(d(9676,null),n.range,8));else if(n.value&&!t.has(n.value)){let r=o.get(n.value);if(r)if(r?.size===1){let s=Array.from(r)[0];e(An(d(9731,null,n.value,s),n.range,2,[2]))}else{let s=Array.from(r).sort((l,c)=>l.localeCompare(c)).join(", ");e(An(d(9732,null,n.value,s),n.range,2,[2]))}else e(An(d(9733,null,n.value),n.range,1,[1]))}}}validateApplyTo(i,e){let t=i.find(n=>n.key===no.applyTo);if(!t)return;if(t.value.type!=="scalar"){e(An(d(9655,null),t.value.range,8));return}let o=t.value.value;try{let n=wM(o,",");if(n.length===0){e(An(d(9656,null),t.value.range,8));return}for(let r of n){let s=Eh(r);if(uvi(s)){e(An(d(9656,null),t.value.range,8));return}}}catch{e(An(d(9656,null),t.value.range,8))}}validatePaths(i,e){let t=i.find(o=>o.key===no.paths);if(t){if(t.value.type!=="sequence"){e(An(d(9719,null),t.value.range,8));return}for(let o of t.value.items){if(o.type!=="scalar"){e(An(d(9675,null),o.range,8));continue}let n=o.value.trim();if(n.length===0){e(An(d(9717,null),o.range,8));continue}try{let r=Eh(n);uvi(r)&&e(An(d(9718,null,n),o.range,8))}catch{e(An(d(9718,null,n),o.range,8))}}}}validateExcludeAgent(i,e){let t=i.find(o=>o.key===no.excludeAgent);if(t&&t.value.type!=="sequence"&&t.value.type!=="scalar"){e(An(d(9677,null),t.value.range,8));return}}validateHooks(i,e,t){let o=i.find(r=>r.key===no.hooks);if(!o)return;if(o.value.type!=="map"){t(An(d(9696,null),o.value.range,8));return}let n=new Set(Object.keys(qg[e]??qg.undefined));for(let r of o.value.properties){if(n.has(r.key.value)||t(An(d(9745,null,r.key.value,Array.from(n).join(", ")),r.key.range,4)),r.value.type!=="sequence"){t(An(d(9699,null,r.key.value),r.value.range,8));continue}for(let s of r.value.items)this.validateHookCommand(s,e,t)}}validateHookCommand(i,e,t){if(i.type!=="map"){t(An(d(9689,null),i.range,8));return}let o=i.properties.find(u=>u.key.value==="hooks");if(o){for(let u of i.properties)u.key.value!=="hooks"&&u.key.value!=="matcher"&&t(An(d(9746,null,u.key.value),u.key.range,4));if(o.value.type!=="sequence"){t(An(d(9716,null),o.value.range,8));return}for(let u of o.value.items)this.validateHookCommand(u,e,t);return}let n=e==="github-copilot",r=n?new Set(["bash","powershell"]):new Set(["command","windows","linux","osx","bash","powershell"]),s=n?new Set(["type","bash","powershell","cwd","env","timeoutSec"]):new Set(["type","command","windows","linux","osx","bash","powershell","cwd","env","timeout"]),l=!1,c=!1;for(let u of i.properties){let p=u.key.value;if(s.has(p)||t(An(d(9744,null,p),u.key.range,4)),p==="type")l=!0,(u.value.type!=="scalar"||u.value.value!=="command")&&t(An(d(9698,null),u.value.range,8));else if(r.has(p))c=!0,(u.value.type!=="scalar"||u.value.value.trim().length===0)&&t(An(d(9688,null,p),u.value.range,8));else if(p==="cwd")u.value.type!=="scalar"&&t(An(d(9690,null),u.value.range,8));else if(p==="env")if(u.value.type!=="map")t(An(d(9691,null),u.value.range,8));else for(let h of u.value.properties)h.value.type!=="scalar"&&t(An(d(9692,null,h.key.value),h.value.range,8));else(p==="timeout"||p==="timeoutSec")&&(u.value.type!=="scalar"||isNaN(Number(u.value.value)))&&t(An(d(9697,null,p),u.value.range,8))}l||t(An(d(9695,null),i.range,8)),c||t(n?An(d(9694,null),i.range,8):An(d(9693,null),i.range,8))}validateHandoffs(i,e){let t=i.find(n=>n.key===no.handOffs);if(!t)return;if(t.value.type!=="sequence"){e(An(d(9687,null),t.value.range,8));return}let o=new Map;for(let n of t.value.items){if(n.type!=="map"){e(An(d(9674,null),n.range,8));continue}let r=new Set(["label","agent","prompt"]);for(let l of n.properties){switch(l.key.value){case"label":l.value.type!=="scalar"||l.value.value.trim().length===0?e(An(d(9681,null),l.value.range,8)):/[a-zA-Z0-9]/.test(l.value.value)||e(An(d(9682,null),l.value.range,8));break;case"agent":l.value.type!=="scalar"||l.value.value.trim().length===0?e(An(d(9680,null),l.value.range,8)):this.validateAgentValue(l.value,e);break;case"prompt":l.value.type!=="scalar"&&e(An(d(9684,null),l.value.range,8));break;case"send":pjt(l.value)||e(An(d(9685,null),l.value.range,8));break;case"showContinueOn":pjt(l.value)||e(An(d(9686,null),l.value.range,8));break;case"model":l.value.type!=="scalar"&&e(An(d(9683,null),l.value.range,8));break;default:e(An(d(9743,null,l.key.value),l.value.range,4))}r.delete(l.key.value)}r.size>0&&e(An(d(9704,null,Array.from(r).map(l=>`'${l}'`).join(", ")),n.range,8));let s=n.properties.find(l=>l.key.value==="label");if(s?.value.type==="scalar"){let l=s.value.value.toLowerCase();l&&o.has(l)?e(An(d(9672,null,s.value.value),s.value.range,8)):l&&o.set(l,s.value.range)}}}validateInfer(i,e){let t=i.find(o=>o.key===no.infer);t&&e(An(d(9701,null),t.value.range,8))}validateTarget(i,e){let t=i.find(r=>r.key===no.target);if(!t)return;if(t.value.type!=="scalar"){e(An(d(9730,null),t.value.range,8));return}let o=t.value.value.trim();if(o.length===0){e(An(d(9729,null),t.value.range,8));return}let n=["github-copilot","vscode"];n.includes(o)||e(An(d(9728,null,n.join(", ")),t.value.range,8))}validateUserInvocable(i,e){let t=i.find(o=>o.key===no.userInvocable);if(t&&!pjt(t.value)){e(An(d(9749,null),t.value.range,8));return}}validateDisableModelInvocation(i,e){let t=i.find(o=>o.key===no.disableModelInvocation);if(t&&!pjt(t.value)){e(An(d(9671,null),t.value.range,8));return}}async validateAgentsAttribute(i,e,t){let o=i.find(l=>l.key===no.agents);if(!o)return;if(o.value.type!=="sequence"){t(An(d(9653,null),o.value.range,8));return}let n=(await this.promptsService.getCustomAgents(Ie.None)).filter(l=>l.enabled),r=new Set(n.map(l=>l.name));r.add(Bc.Agent.name.get());let s=[];for(let l of o.value.items)l.type!=="scalar"?t(An(d(9673,null),l.range,8)):l.value&&(s.push(l.value),l.value!=="*"&&!r.has(l.value)&&t(An(d(9651,null,l.value,Array.from(r).join(", ")),l.range,1,[1])));if(s.length>0){let l=e.tools;l&&!l.includes(Am.agent)&&t(An(d(9654,null),o.value.range,4))}}validateGithubPermissions(i,e){let t=i.find(o=>o.key===A3.github);if(t){if(t.value.type!=="map"){e(An(d(9679,null),t.value.range,8));return}for(let o of t.value.properties){if(o.key.value!=="permissions"){e(An(d(9742,null,o.key.value),o.key.range,4));continue}if(o.value.type!=="map"){e(An(d(9720,null),o.value.range,8));continue}for(let n of o.value.properties){let r=n.key.value,s=XTo[r];if(!s){let c=Object.keys(XTo).sort().join(", ");e(An(d(9747,null,r,c),n.key.range,4));continue}if(n.value.type!=="scalar"){e(An(d(9721,null,r),n.value.range,8));continue}let l=n.value.value;s.allowedValues.includes(l)||e(An(d(9703,null,l,r,s.allowedValues.join(", ")),n.value.range,8))}}}}};nBe=I([m(0,Gr),m(1,Wn),m(2,kE),m(3,ge),m(4,nt),m(5,jr),m(6,re),m(7,B)],nBe);var XTo={actions:{allowedValues:["read","write","none"],description:d(9615,null)},checks:{allowedValues:["read","none"],description:d(9616,null)},contents:{allowedValues:["read","write","none"],description:d(9617,null)},discussions:{allowedValues:["read","write","none"],description:d(9618,null)},issues:{allowedValues:["read","write","none"],description:d(9619,null)},metadata:{allowedValues:["read"],description:d(9620,null)},"pull-requests":{allowedValues:["read","write","none"],description:d(9621,null)},"security-events":{allowedValues:["read","none"],description:d(9622,null)},workflows:{allowedValues:["write","none"],description:d(9623,null)}};function pjt(a){return a.type==="scalar"?(a.value==="true"||a.value==="false")&&a.format==="none":!1}var slt={prompt:[no.name,no.description,no.model,no.tools,no.mode,no.agent,no.argumentHint],instructions:[no.name,no.description,no.applyTo,no.excludeAgent],agent:[no.name,no.description,no.model,no.tools,no.advancedOptions,no.handOffs,no.argumentHint,no.target,no.infer,no.agents,no.hooks,no.userInvocable,no.disableModelInvocation,A3.github],skill:[no.name,no.description,no.license,no.compatibility,no.metadata,no.argumentHint,no.userInvocable,no.disableModelInvocation,no.context],hook:[]},Ygn=[no.name,no.description,no.tools,no.target,A3.mcpServers,A3.github,no.infer],Xgn={prompt:slt.prompt.filter(a=>!mjt(a)),instructions:slt.instructions.filter(a=>!mjt(a)),agent:slt.agent.filter(a=>!mjt(a)),skill:slt.skill.filter(a=>!mjt(a)),hook:[]};function qOi(a,i,e){return e==="claude"?a==="instructions"?Object.keys(Zgn):Object.keys($Oi):e==="github-copilot"&&a==="agent"?Ygn:i?slt[a]:Xgn[a]}function mjt(a){return a===no.advancedOptions||a===no.excludeAgent||a===no.mode||a===no.infer}var ich=[{name:Am.execute,description:d(9612,null)},{name:Am.read,description:d(9613,null)},{name:Am.edit,description:d(9611,null)},{name:Am.search,description:d(9614,null)},{name:Am.agent,description:d(9610,null)}],JTo=[{name:"Bash",description:d(9584,null),toolEquivalent:[Am.execute]},{name:"Edit",description:d(9585,null),toolEquivalent:["edit/editNotebook","edit/editFiles"]},{name:"Glob",description:d(9586,null),toolEquivalent:["search/fileSearch"]},{name:"Grep",description:d(9587,null),toolEquivalent:["search/textSearch"]},{name:"Read",description:d(9603,null),toolEquivalent:["read/readFile","read/getNotebookSummary"]},{name:"Write",description:d(9609,null),toolEquivalent:["edit/createDirectory","edit/createFile","edit/createJupyterNotebook"]},{name:"WebFetch",description:d(9607,null),toolEquivalent:[Am.web]},{name:"WebSearch",description:d(9608,null),toolEquivalent:[Am.web]},{name:"Task",description:d(9606,null),toolEquivalent:[Am.agent]},{name:"Skill",description:d(9604,null),toolEquivalent:[]},{name:"LSP",description:d(9590,null),toolEquivalent:[]},{name:"NotebookEdit",description:d(9595,null),toolEquivalent:["edit/editNotebook"]},{name:"AskUserQuestion",description:d(9583,null),toolEquivalent:["vscode/askQuestions"]},{name:"MCPSearch",description:d(9591,null),toolEquivalent:[]}],Jgn=[{name:"sonnet",description:d(9605,null),modelEquivalent:"Claude Sonnet 4.5 (copilot)"},{name:"opus",description:d(9596,null),modelEquivalent:"Claude Opus 4.6 (copilot)"},{name:"haiku",description:d(9588,null),modelEquivalent:"Claude Haiku 4.5 (copilot)"},{name:"inherit",description:d(9589,null),modelEquivalent:void 0}];var $Oi={name:{type:"scalar",description:d(9577,null)},description:{type:"scalar",description:d(9571,null)},tools:{type:"sequence",description:d(9582,null),defaults:["Read, Edit, Bash"],items:JTo},disallowedTools:{type:"sequence",description:d(9572,null),defaults:["Write, Edit, Bash"],items:JTo},model:{type:"scalar",description:d(9576,null),defaults:["sonnet","opus","haiku","inherit"],enums:Jgn},permissionMode:{type:"scalar",description:d(9578,null),defaults:["default","acceptEdits","dontAsk","bypassPermissions","plan"],enums:[{name:"default",description:d(9599,null)},{name:"acceptEdits",description:d(9597,null)},{name:"plan",description:d(9602,null)},{name:"delegate",description:d(9600,null)},{name:"dontAsk",description:d(9601,null)},{name:"bypassPermissions",description:d(9598,null)}]},skills:{type:"sequence",description:d(9581,null)},mcpServers:{type:"sequence",description:d(9574,null)},hooks:{type:"object",description:d(9573,null)},memory:{type:"scalar",description:d(9575,null),defaults:["user","project","local"],enums:[{name:"user",description:d(9594,null)},{name:"project",description:d(9593,null)},{name:"local",description:d(9592,null)}]}},Zgn={description:{type:"scalar",description:d(9579,null)},paths:{type:"sequence",description:d(9580,null)}};function ZTo(a){return a==="vscode"||a==="undefined"}function efn(a,i){let e=i instanceof A?i:i.uri;if(a==="agent"){if(ai(e).path.endsWith(`/${W2}`))return"claude";if(!(i instanceof A)){let o=i.target;if(o==="github-copilot"||o==="vscode")return o}return"undefined"}else if(a==="instructions"&&H2(e))return"claude";return"undefined"}function An(a,i,e=8,t){return{severity:e,message:a,...t?{tags:t}:{},...i}}var rBe=class{constructor(i){this.promptsService=i;this._debugDisplayName="PromptDocumentSemanticTokensProvider"}provideDocumentSemanticTokens(i,e,t){let o=bC(i.getLanguageId());if(!o)return;let n=this.promptsService.getParsedPromptFile(i);if(!n.body)return;let r=Ax(o,n.header??i.uri);if(!WZ(r))return;let s=n.body.variableReferences;if(!s.length)return;let l=[],c=0,u=0,p=[...s].sort((h,g)=>h.range.startLineNumber===g.range.startLineNumber?h.range.startColumn-g.range.startColumn:h.range.startLineNumber-g.range.startLineNumber);for(let h of p){let f=h.range.startLineNumber-1,v=h.range.startColumn-6-1,b=h.range.endColumn-h.range.startColumn+6,S=f-c,y=S===0?v-u:v;if(l.push(S,y,b,0,0),c=f,u=v,t.isCancellationRequested)break}return{data:new Uint32Array(l)}}getLegend(){return{tokenTypes:["variable"],tokenModifiers:[]}}releaseDocumentSemanticTokens(i){}};rBe=I([m(0,jr)],rBe);var sBe=class{constructor(i,e,t,o){this.promptsService=i;this.languageModelToolsService=e;this.fileService=t;this.markerService=o;this._debugDisplayName="PromptCodeActionProvider"}async provideCodeActions(i,e,t,o){let n=bC(i.getLanguageId());if(!n||n==="instructions")return;let r=[],s=this.promptsService.getParsedPromptFile(i);switch(n){case"agent":this.getUpdateToolsCodeActions(s,n,i,e,r),await this.getMigrateModeFileCodeActions(i,r);break;case"prompt":this.getUpdateModeCodeActions(s,i,e,r),this.getUpdateToolsCodeActions(s,n,i,e,r);break}if(r.length!==0)return{actions:r,dispose:()=>{}}}getMarkers(i,e){return this.markerService.read({resource:i.uri,owner:alt}).filter(o=>e.containsRange(o))}createCodeAction(i,e,t,o){return{title:t,edit:{edits:o},ranges:[e],diagnostics:this.getMarkers(i,e),kind:Nr.QuickFix.value}}getUpdateModeCodeActions(i,e,t,o){let n=i.header?.getAttribute(no.mode);if(!n?.range.containsRange(t))return;let r=new G(n.range.startLineNumber,n.range.startColumn,n.range.startLineNumber,n.range.startColumn+n.key.length);o.push(this.createCodeAction(e,r,d(9473,null),[hjt(e,{range:r,text:"agent"})]))}async getMigrateModeFileCodeActions(i,e){if(i.uri.path.endsWith(V2)){let t=this.promptsService.getAgentFileURIFromModeFile(i.uri);if(t&&await this.fileService.canMove(i.uri,t)){let o={oldResource:i.uri,newResource:t,options:{overwrite:!1,copy:!1}};e.push(this.createCodeAction(i,new G(1,1,1,4),d(9472,null),[o]))}}}getUpdateToolsCodeActions(i,e,t,o,n){if(!i.header)return;let r=i.header.getAttribute(no.tools);if(!r||!r.value.range.containsRange(o))return;let s=Ax(e,i.header);if(!WZ(s))return;let l=r.value;if(l.type==="scalar"&&(l=AH(l)),l.type!=="sequence")return;let c=l.items,u=new uo(()=>this.languageModelToolsService.getDeprecatedFullReferenceNames()),p=[];for(let h of c){if(h.type!=="scalar")continue;let g=u.value.get(h.value);if(g&&g.size>0){let f=t.getValueInRange(new G(h.range.startLineNumber,h.range.startColumn,h.range.endLineNumber,h.range.startColumn+1));if(g.size===1){let v=Array.from(g)[0],b=f==="'"||f==='"'?f+v+f:v,S={range:h.range,text:b};p.push(S),h.range.containsRange(o)&&n.push(this.createCodeAction(t,h.range,d(9475,null,v),[hjt(t,S)]))}else{let v=Array.from(g).sort((E,M)=>E.localeCompare(M)),y=t.getValueInRange(new G(h.range.startLineNumber,h.range.endColumn,h.range.endLineNumber,h.range.endColumn+2)).includes(",")?", ":",",w=v.map(E=>f==="'"||f==='"'?f+E+f:E).join(y),x={range:h.range,text:w};p.push(x),h.range.containsRange(o)&&n.push(this.createCodeAction(t,h.range,d(9471,null,g.size),[hjt(t,x)]))}}}(p.length&&n.length===0||p.length>1)&&n.push(this.createCodeAction(t,l.range,d(9474,null),p.map(h=>hjt(t,h))))}};sBe=I([m(0,jr),m(1,Wn),m(2,ge),m(3,ha)],sBe);function hjt(a,i){return{versionId:a.getVersionId(),resource:a.uri,textEdit:i}}var Kve=class extends k{static{this.ID="chat.promptLanguageFeatures"}constructor(i,e){super(),this._register(i.linkProvider.register(A2,e.createInstance(ZVe))),this._register(i.completionProvider.register(A2,e.createInstance(eBe))),this._register(i.completionProvider.register(A2,e.createInstance(tBe))),this._register(i.hoverProvider.register(A2,e.createInstance(iBe))),this._register(i.definitionProvider.register(A2,e.createInstance(oBe))),this._register(i.documentSemanticTokensProvider.register(A2,e.createInstance(rBe))),this._register(i.codeActionProvider.register(A2,e.createInstance(sBe))),this._register(e.createInstance(llt))}};Kve=I([m(0,Jt),m(1,F)],Kve);var llt=class extends k{constructor(e,t,o,n,r,s,l){super();this.codeEditorService=e;this.markerService=o;this.promptsService=n;this.languageModelsService=r;this.languageModelToolsService=s;this.chatModeService=l;this.localDisposables=this._register(new O);this.validator=t.createInstance(nBe),this.updateRegistration()}async updateRegistration(){this.localDisposables.clear();let e=new dt;this.localDisposables.add(ee(()=>{e.forEach(c=>c.dispose()),e.clear()}));let t=c=>{let u=c.getModel();if(!u)return;let p=bC(u.getLanguageId());if(p){let h=e.get(u.uri);if(h){h.refCount++;return}e.set(u.uri,new jOi(u,p,this.validator,this.promptsService,this.markerService))}},o=c=>{let u=e.get(c);u&&--u.refCount===0&&(u.dispose(),e.delete(c))},n=new Ot;this.localDisposables.add(n);let r=c=>{t(c);let u=new O;u.add(c.onDidChangeModel(p=>{p.oldModelUrl&&o(p.oldModelUrl),t(c)})),u.add(c.onDidChangeModelLanguage(p=>{let h=c.getModel();h&&(o(h.uri),t(c))})),n.set(c.getId(),u)};for(let c of this.codeEditorService.listCodeEditors())r(c);this.localDisposables.add(this.codeEditorService.onCodeEditorAdd(c=>{r(c)})),this.localDisposables.add(this.codeEditorService.onCodeEditorRemove(c=>{n.deleteAndDispose(c.getId());let u=c.getModel();u&&o(u.uri)}));let s=()=>e.forEach(c=>c.validate()),l=await this.chatModeService.getLocalModes();this.localDisposables.add(this.languageModelToolsService.onDidChangeTools(()=>s())),this.localDisposables.add(l.onDidChange(()=>s())),this.localDisposables.add(this.languageModelsService.onDidChangeLanguageModels(()=>s()))}};llt=I([m(0,Qt),m(1,F),m(2,ha),m(3,jr),m(4,Gr),m(5,Wn),m(6,kE)],llt);var jOi=class extends k{constructor(e,t,o,n,r){super();this.textModel=e;this.promptType=t;this.validator=o;this.promptsService=n;this.markerService=r;this.refCount=1;this.delayer=this._register(new rn(200)),this._register(e.onDidChangeContent(()=>this.validate())),this.validate()}validate(){this.delayer.trigger(async()=>{let e=[],t=this.promptsService.getParsedPromptFile(this.textModel);await this.validator.validate(t,this.promptType,o=>e.push(o)),this._store.isDisposed||this.markerService.changeOne(alt,this.textModel.uri,e)})}dispose(){this.markerService.remove(alt,[this.textModel.uri]),super.dispose()}};var aBe=class extends k{constructor(e,t,o){super();this.chatService=e;this.chatWidgetService=t;this.telemetryService=o;this.logStartupTelemetry(),this._register(this.chatService.onDidCreateModel(n=>this.onDidCreateModel(n.initialLocation)))}static{this.ID="workbench.contrib.chatModelCountTelemetry"}logStartupTelemetry(){this.telemetryService.publicLog2("chat.modelsAtStartup",this.getSnapshot())}onDidCreateModel(e){let t=this.getSnapshot();t.totalModels<=1||this.telemetryService.publicLog2("chat.modelCreatedStats",{...t,newModelLocation:e})}getSnapshot(){let e=this.chatService.getChatModelReferenceDebugInfo(),t=0,o=0,n=0,r=0,s=0;for(let l of e.models)if(this.chatWidgetService.getWidgetBySessionResource(l.sessionResource))t++;else{o++;let c=!1;for(let{holder:u}of l.holders)u==="ChatModel#modifiedEditsKeepAlive"?n++:u==="ChatModel#requestInProgressKeepAlive"?r++:c=!0;c&&s++}return{totalModels:e.totalModels,modelsOpenInWidgets:t,backgroundModels:o,backgroundModels_modifiedEditsKeepAlive:n,backgroundModels_requestInProgressKeepAlive:r,backgroundModels_otherHolders:s}}};aBe=I([m(0,si),m(1,Lt),m(2,_e)],aBe);bt(aBe.ID,aBe,vt.AfterRestored);var gjt="The user is not available to respond and will review your work later. Work autonomously and make good decisions.",e_o="vscode_askQuestions",fjt={header:50,question:200},tfn={header:75};function ifn(a,i){if(a!==void 0)return a.length>i?a.slice(0,i-3)+"...":a}function ofn(){let i={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 ${fjt.header} characters.`,maxLength:fjt.header},question:{type:"string",description:`The question text to display to the user. Keep it concise, ideally one sentence. Maximum ${fjt.question} characters.`,maxLength:fjt.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:e_o,toolReferenceName:"askQuestions",legacyToolReferenceFullNames:[e_o,"vscode/askQuestions"],canBeReferencedInPrompt:!1,icon:q.fromId(L.question.id),displayName:d(9771,null),userDescription:d(9772,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:wn.Internal,inputSchema:i}}var QOi=ofn(),lBe=class extends k{constructor(e,t,o,n){super();this.chatService=e;this.telemetryService=t;this.logService=o;this.configService=n}async invoke(e,t,o,n){let r=On.create(!0),s=e.parameters,{questions:l}=s;if(this.logService.trace(`[AskQuestionsTool] Invoking with ${l?.length??0} question(s)`),!l||l.length===0)throw new Error(d(9769,null));let c=e.context?.sessionResource,u=e.chatRequestId,{request:p,sessionResource:h}=this.getRequest(c,u);if(!h||!p)return this.logService.warn("[AskQuestionsTool] Missing chat context; marking all questions as skipped."),this.createSkippedResult(l);let g=e.chatStreamToolCallId??e.callId;if(p.modeInfo?.permissionLevel==="autopilot"||this.configService.getValue("chat.autoReply")){let H=p.modeInfo?.permissionLevel==="autopilot"?"Autopilot mode":"Auto-reply enabled";this.logService.info(`[AskQuestionsTool] ${H}: auto-responding to questions`);let{carousel:K,idToHeaderMap:j}=this.toQuestionCarousel(l,g);return K.terminalId=this.extractTerminalId(p),K.data=this.buildAutopilotCarouselAnswers(l,K,j),K.isUsed=!0,this.chatService.appendProgress(p,K),this.createAutopilotResult(l)}let{carousel:f,idToHeaderMap:v}=this.toQuestionCarousel(l,g);f.terminalId=this.extractTerminalId(p),this.logService.trace(`[AskQuestionsTool] request=${p.id} terminalExecutionId=${p.terminalExecutionId??"undefined"} carousel.terminalId=${f.terminalId??"undefined"}`),this.chatService.appendProgress(p,f);let b=this.chatService.onDidReceiveQuestionCarouselAnswer(H=>{H.resolveId!==f.resolveId||f.isUsed||f.dismiss(H.answers)}),S;try{S=await Ea(f.completion.p,n)}catch(H){throw H instanceof qi&&f.dismiss(void 0),H}finally{b.dispose()}if(!S)throw f.dismiss(void 0),new qi;if(n.isCancellationRequested)throw new qi;if(f.dismissedByTerminalInput&&f.terminalId)return this.logService.info(`[AskQuestionsTool] Carousel dismissed because user typed directly in terminal ${f.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 ${f.terminalId} completes.`}]};o.report({message:d(9770,null)});let y=this.convertCarouselAnswers(l,S?.answers,v),{answeredCount:w,skippedCount:x,freeTextCount:E,recommendedAvailableCount:M,recommendedSelectedCount:N}=this.collectMetrics(l,y);this.sendTelemetry(e.chatRequestId,l.length,w,x,E,M,N,r.elapsed());let V=JSON.stringify(y);return this.logService.trace(`[AskQuestionsTool] Returning tool result with metrics: questions=${l.length}, answered=${w}, skipped=${x}, freeText=${E}, recommendedAvailable=${M}, recommendedSelected=${N}`),{content:[{kind:"text",value:V}]}}async prepareToolInvocation(e,t){let o=e.parameters,{questions:n}=o;if(!n||n.length===0)throw new Error(d(9769,null));for(let u of n)if(u.options&&u.options.length===1)throw new Error(d(9764,null,u.header));let r=n.length,s=n.map(u=>u.header).join(", "),l=r===1?d(9767,null,s):d(9765,null,r,s),c=r===1?d(9768,null,s):d(9766,null,r,s);return{invocationMessage:new he(l),pastTenseMessage:new he(c)}}getRequest(e,t){if(!e)return{request:void 0,sessionResource:void 0};let o=this.chatService.getSession(e),n;return o&&(t&&(n=o.getRequests().find(r=>r.id===t)),n||(n=o.getRequests().at(-1))),n?{request:n,sessionResource:e}:{request:void 0,sessionResource:e}}extractTerminalId(e){if(e.terminalExecutionId)return e.terminalExecutionId;let t=e.message.text.match(/\[Terminal (?<termId>\S+) notification:/);if(t?.groups?.termId)return t.groups.termId;let o=e.response;if(o){let n=o.response.value;for(let r=n.length-1;r>=0;r--){let s=n[r];if(s.kind==="toolInvocation"&&s.toolId==="run_in_terminal"){let l=s.state.get();if(l.type===pi.StateKind.Completed&&l.contentForModel){for(let c of l.contentForModel)if(c.kind==="text"){let u=c.value.match(/(?:running in terminal ID|may still be running in terminal ID) ([0-9a-fA-F-]+)/);if(u)return u[1]}}}}}}toQuestionCarousel(e,t){let o=new Map,n=t??ht(),r=e.map((s,l)=>this.toChatQuestion(s,o,n,l));return{carousel:new nI(r,!0,n),idToHeaderMap:o}}toChatQuestion(e,t,o,n){let r;!e.options||e.options.length===0?r="text":e.multiSelect?r="multiSelect":r="singleSelect";let s;if(e.options){let u=e.options.filter(p=>p.recommended);u.length>0&&(s=e.multiSelect?u.map(p=>p.label):u[0].label)}let l=`${o}:${n}`;t.set(l,e.header);let c=ifn(e.header,tfn.header)??e.header;return{id:l,type:r,title:c,message:e.question,detailedMessage:e.message,options:e.options?.map(u=>({id:u.label,label:u.description?`${u.label} - ${u.description}`:u.label,value:u.label})),defaultValue:s,allowFreeformInput:e.allowFreeformInput??!0}}convertCarouselAnswers(e,t,o){let n={answers:{}};t&&(this.logService.trace(`[AskQuestionsTool] Carousel answer keys: ${Object.keys(t).join(", ")}`),this.logService.trace(`[AskQuestionsTool] Question headers: ${e.map(s=>s.header).join(", ")}`));let r=new Map;for(let[s,l]of o)r.set(l,s);for(let s of e){if(!t){n.answers[s.header]={selected:[],freeText:null,skipped:!0};continue}let l=r.get(s.header),c=l?t[l]:void 0;if(this.logService.trace(`[AskQuestionsTool] Processing question "${s.header}" (internal ID: ${l}), raw answer: ${JSON.stringify(c)}, type: ${typeof c}`),c===void 0)n.answers[s.header]={selected:[],freeText:null,skipped:!0};else if(typeof c=="string")s.options?.some(u=>u.label===c)?n.answers[s.header]={selected:[c],freeText:null,skipped:!1}:n.answers[s.header]={selected:[],freeText:c,skipped:!1};else if(Array.isArray(c))n.answers[s.header]={selected:c.map(u=>String(u)),freeText:null,skipped:!1};else if(typeof c=="object"&&yo(c,{selectedValues:!0})){let{selectedValues:u,freeformValue:p}=c;n.answers[s.header]={selected:u,freeText:p??null,skipped:!1}}else if(typeof c=="object"&&(yo(c,{selectedValue:!0})||yo(c,{freeformValue:!0}))){let{selectedValue:u,freeformValue:p}=c;p?n.answers[s.header]={selected:[],freeText:p,skipped:!1}:u!==void 0?s.options?.some(h=>h.label===u)?n.answers[s.header]={selected:[u],freeText:null,skipped:!1}:n.answers[s.header]={selected:[],freeText:u,skipped:!1}:n.answers[s.header]={selected:[],freeText:null,skipped:!0}}else this.logService.warn(`[AskQuestionsTool] Unknown answer format for "${s.header}": ${JSON.stringify(c)}`),n.answers[s.header]={selected:[],freeText:null,skipped:!0}}return n}collectMetrics(e,t){let o=Object.values(t.answers),n=o.filter(u=>!u.skipped).length,r=o.filter(u=>u.skipped).length,s=o.filter(u=>u.freeText!==null).length,l=e.filter(u=>u.options?.some(p=>p.recommended)).length,c=e.filter(u=>{let p=t.answers[u.header],h=u.options?.find(g=>g.recommended);return p&&!p.skipped&&h&&p.selected.includes(h.label)}).length;return{answeredCount:n,skippedCount:r,freeTextCount:s,recommendedAvailableCount:l,recommendedSelectedCount:c}}createSkippedResult(e){let t={};for(let o of e)t[o.header]={selected:[],freeText:null,skipped:!0};return{content:[{kind:"text",value:JSON.stringify({answers:t})}]}}createAutopilotResult(e){let t={};for(let o of e)t[o.header]={selected:[],freeText:gjt,skipped:!1};return{content:[{kind:"text",value:JSON.stringify({answers:t})}]}}buildAutopilotCarouselAnswers(e,t,o){let n={},r=new Map;for(let[s,l]of o)r.set(l,s);for(let s of e){let l=r.get(s.header);if(!l)continue;let c=t.questions.find(u=>u.id===l);c&&(c.type==="multiSelect"?n[l]={selectedValues:[],freeformValue:gjt}:c.type==="singleSelect"?n[l]={freeformValue:gjt}:n[l]=gjt)}return n}sendTelemetry(e,t,o,n,r,s,l,c){this.telemetryService.publicLog2("askQuestionsToolInvoked",{requestId:e,questionCount:t,answeredCount:o,skippedCount:n,freeTextCount:r,recommendedAvailableCount:s,recommendedSelectedCount:l,duration:c})}};lBe=I([m(0,si),m(1,_e),m(2,re),m(3,B)],lBe);var nfn="vscode_get_confirmation",rfn="vscode_get_confirmation_with_options",sfn="vscode_get_modified_files_confirmation",t_o={id:nfn,displayName:"Confirmation Tool",modelDescription:"A tool that demonstrates different types of confirmations. Takes a title, message, and confirmation type (basic or terminal).",source:wn.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}},i_o={id:rfn,displayName:"Confirmation Tool with Options",modelDescription:"A tool that demonstrates different types of confirmations. Takes a title, message, and buttons.",source:wn.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}},o_o={id:sfn,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:wn.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}},vjt=class{async prepareToolInvocation(i,e){let t=i.parameters;if(!t.title||!t.message)throw new Error("Missing required parameters for ConfirmationTool");let o=t.confirmationType??"basic",n;return o==="terminal"?n={kind:"terminal",commandLine:{original:t.terminalCommand??""},language:"bash"}:n=void 0,{confirmationMessages:{title:t.title,message:new he(t.message),allowAutoConfirm:!(t.buttons||[]).length,customOptions:t.buttons?.map((r,s)=>({id:r,label:r,kind:s===0?"approve":"deny"}))},toolSpecificData:n,presentation:"hiddenAfterComplete"}}async invoke(i,e,t,o){return i.selectedCustomButton?{content:[{kind:"text",value:i.selectedCustomButton}]}:{content:[{kind:"text",value:"yes"}]}}},bjt=class{async prepareToolInvocation(i,e){let t=i.parameters;if(!t.title||!t.message)throw new Error("Missing required parameters for ModifiedFilesConfirmationTool");if(!t.options?.length)throw new Error("ModifiedFilesConfirmationTool requires at least one option");let o={kind:"modifiedFilesConfirmation",options:t.options,modifiedFiles:t.modifiedFiles.map(n=>({uri:A.parse(n.uri).toJSON(),originalUri:n.originalUri?A.parse(n.originalUri).toJSON():void 0,insertions:n.insertions,deletions:n.deletions,title:n.title,description:n.description}))};return{confirmationMessages:{title:t.title,message:new he(t.message),allowAutoConfirm:!1},toolSpecificData:o,presentation:"hiddenAfterComplete"}}async invoke(i,e,t,o){return i.selectedCustomButton?{content:[{kind:"text",value:i.selectedCustomButton}]}:{content:[{kind:"text",value:"yes"}]}}};var afn="vscode_editFile_internal",n_o={id:afn,displayName:"",modelDescription:"",source:wn.Internal},cBe=class{constructor(i,e,t){this.chatService=i;this.codeMapperService=e;this.notebookService=t}async invoke(i,e,t,o){if(!i.context)throw new Error("toolInvocationToken is required for this tool");let n=i.parameters,r=A.revive(n.uri),s=sn.parse(r)?.notebook||r,l=this.chatService.getSession(i.context.sessionResource),c=l.getRequests().at(-1);l.acceptResponseProgress(c,{kind:"markdownContent",content:new he("\n````\n")}),l.acceptResponseProgress(c,{kind:"codeblockUri",uri:s,isEdit:!0}),l.acceptResponseProgress(c,{kind:"markdownContent",content:new he("\n````\n")}),this.notebookService.hasSupportedNotebooks(s)&&this.notebookService.getNotebookTextModel(s)?l.acceptResponseProgress(c,{kind:"notebookEdit",edits:[],uri:s}):l.acceptResponseProgress(c,{kind:"textEdit",edits:[],uri:s});let u=l.editingSession;if(!u)throw new Error("This tool must be called from within an editing session");let p=await this.codeMapperService.mapCode({codeBlocks:[{code:n.code,resource:s,markdownBeforeBlock:n.explanation}],location:"tool",chatRequestId:i.chatRequestId,chatRequestModel:i.modelId,chatSessionResource:i.context.sessionResource},{textEdit:(g,f)=>{l.acceptResponseProgress(c,{kind:"textEdit",uri:g,edits:f})},notebookEdit(g,f){l.acceptResponseProgress(c,{kind:"notebookEdit",uri:g,edits:f})}},o);if(this.notebookService.hasSupportedNotebooks(s)&&this.notebookService.getNotebookTextModel(s)?l.acceptResponseProgress(c,{kind:"notebookEdit",uri:s,edits:[],done:!0}):l.acceptResponseProgress(c,{kind:"textEdit",uri:s,edits:[],done:!0}),p?.errorMessage)throw new Error(p.errorMessage);let h;return await new Promise(g=>{let f=!1;h=ve(v=>{let S=u.entries.read(v)?.find(y=>ze(y.modifiedURI,s));S&&(S.isCurrentlyBeingModifiedBy.read(v)?f=!0:f&&g(!0))})}).finally(()=>{h.dispose()}),{content:[{kind:"text",value:"The file was edited successfully"}]}}async prepareToolInvocation(i,e){return{presentation:"hidden"}}};cBe=I([m(0,si),m(1,BZ),m(2,kn)],cBe);var YOi="manage_todo_list";function XOi(){let a={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:YOi,toolReferenceName:"todo",legacyToolReferenceFullNames:["todos"],canBeReferencedInPrompt:!0,icon:q.fromId(L.checklist.id),displayName:d(9808,null),userDescription:d(9809,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:wn.Internal,inputSchema:a}}var Auh=XOi(),dBe=class extends k{constructor(e,t,o){super();this.chatTodoListService=e;this.logService=t;this.telemetryService=o}async invoke(e,t,o,n){let r=e.parameters,s=e.context?.sessionResource;if(!s&&r.operation==="read"&&r.chatSessionResource)try{s=A.parse(r.chatSessionResource)}catch(l){this.logService.error("ManageTodoListTool: Invalid chatSessionResource URI",l)}if(!s)return{content:[{kind:"text",value:"Error: No session resource available"}]};this.logService.debug(`ManageTodoListTool: Invoking with options ${JSON.stringify(r)}`);try{return r.operation==="read"?this.handleReadOperation(s):this.handleWriteOperation(r,s)}catch(l){return{content:[{kind:"text",value:`Error: ${l instanceof Error?l.message:"Unknown error"}`}]}}}async prepareToolInvocation(e,t){let o=e.parameters,n=e.chatSessionResource;if(!n)return;let r=this.chatTodoListService.getTodos(n),s;o.operation==="read"?s=d(9803,null):o.todoList&&(s=this.generatePastTenseMessage(r,o.todoList));let l=o.todoList??r,c=l.map(h=>({id:h.id.toString(),title:h.title,status:h.status})),u=s?.replace(/^(Starting|Completed): /i,"")??d(9807,null);return{invocationMessage:new he(u),presentation:l.length?void 0:"hidden",pastTenseMessage:new he(s??d(9806,null)),toolSpecificData:{kind:"todoList",todoList:c}}}generatePastTenseMessage(e,t){if(e.length===0)return t.length===1?d(9802,null):d(9801,null,t.length);let o=new Map(e.map(l=>[l.id,l])),n=t.filter(l=>{let c=o.get(l.id);return c&&c.status!=="in-progress"&&l.status==="in-progress"});if(n.length>0){let l=n[0],c=t.length,u=t.findIndex(p=>p.id===l.id)+1;return d(9804,null,l.title,u,c)}let r=t.filter(l=>{let c=o.get(l.id);return c&&c.status!=="completed"&&l.status==="completed"});if(r.length>0){let l=r[0],c=t.length,u=t.findIndex(p=>p.id===l.id)+1;return d(9800,null,l.title,u,c)}let s=t.filter(l=>!o.has(l.id));return s.length>0?s.length===1?d(9799,null):d(9798,null,s.length):d(9805,null)}handleRead(e,t){return e.length===0?"No todo list found.":`# Todo List

${this.formatTodoListAsMarkdownTaskList(e)}`}handleReadOperation(e){let t=this.chatTodoListService.getTodos(e),o=this.handleRead(t,e),n=this.calculateStatusCounts(t);return this.telemetryService.publicLog2("todoListToolInvoked",{operation:"read",notStartedCount:n.notStartedCount,inProgressCount:n.inProgressCount,completedCount:n.completedCount}),{content:[{kind:"text",value:o}]}}handleWriteOperation(e,t){if(!e.todoList)return{content:[{kind:"text",value:"Error: todoList is required for write operation"}]};let o=e.todoList.map(c=>({id:c.id,title:c.title,status:c.status})),n=this.chatTodoListService.getTodos(t),r=this.calculateTodoChanges(n,o);this.chatTodoListService.setTodos(t,o);let s=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."),r>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:s.notStartedCount,inProgressCount:s.inProgressCount,completedCount:s.completedCount}),{content:[{kind:"text",value:`Successfully wrote todo list${l.length?`

`+l.join(`
`):""}`}],toolMetadata:{warnings:l}}}calculateStatusCounts(e){let t=e.filter(r=>r.status==="not-started").length,o=e.filter(r=>r.status==="in-progress").length,n=e.filter(r=>r.status==="completed").length;return{notStartedCount:t,inProgressCount:o,completedCount:n}}formatTodoListAsMarkdownTaskList(e){return e.length===0?"":e.map(t=>{let o;switch(t.status){case"completed":o="[x]";break;case"in-progress":o="[-]";break;default:o="[ ]";break}return[`- ${o} ${t.title}`].join(`
`)}).join(`
`)}calculateTodoChanges(e,t){let o=0,n=Math.min(e.length,t.length);for(let c=0;c<n;c++){let u=e[c],p=t[c];(u.title!==p.title||u.status!==p.status)&&o++}let r=Math.max(0,t.length-e.length),s=Math.max(0,e.length-t.length);return r+s+o}};dBe=I([m(0,vW),m(1,re),m(2,_e)],dBe);var lfn="vscode_reviewPlan";function cfn(){let i={type:"object",properties:{title:{type:"string",description:'Title displayed in the widget header. Defaults to "Review plan" 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:lfn,toolReferenceName:"reviewPlan",canBeReferencedInPrompt:!1,icon:q.fromId(L.checklist.id),displayName:d(9814,null),userDescription:d(9815,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:wn.Internal,inputSchema:i}}var r_o=cfn(),uBe=class extends k{constructor(e,t){super();this.chatService=e;this.logService=t}async invoke(e,t,o,n){let r=e.parameters,{title:s,plan:l,content:c,actions:u,canProvideFeedback:p}=r;if(!u||u.length===0)throw new Error(d(9813,null));let{request:h}=this.getRequest(e.context?.sessionResource,e.chatRequestId);if(!h)return this.logService.warn("[ReviewPlanTool] Missing chat context; returning rejected result."),this.toResult({rejected:!0});let g;if(l)try{g=A.parse(l)}catch{try{g=A.file(l)}catch{g=void 0}}let f=new f_(s??d(9810,null),c,u,p,g?.toJSON(),ht());this.chatService.appendProgress(h,f);let v=await Ea(f.completion.p,n);if(n.isCancellationRequested)throw new qi;return this.toResult(v??{rejected:!0})}async prepareToolInvocation(e,t){let o=e.parameters;if(!o.actions||o.actions.length===0)throw new Error(d(9813,null));return{invocationMessage:new he(d(9811,null)),pastTenseMessage:new he(d(9812,null))}}toResult(e){return{content:[{kind:"text",value:JSON.stringify(e)}]}}getRequest(e,t){if(!e)return{request:void 0};let o=this.chatService.getSession(e);if(!o)return{request:void 0};let n;return t&&(n=o.getRequests().find(r=>r.id===t)),n||(n=o.getRequests().at(-1)),{request:n}}};uBe=I([m(0,si),m(1,re)],uBe);function g1(a){return{content:[{kind:"text",value:a}]}}var dfn=`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.`,ufn=5,f1=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.chatAgentService=e;this.chatService=t;this.languageModelToolsService=o;this.languageModelsService=n;this.logService=r;this.configurationService=s;this.promptsService=l;this.instantiationService=c;this.productService=u;this._onDidUpdateToolData=this._register(new T);this.onDidUpdateToolData=this._onDidUpdateToolData.event;this._resolvedModels=new Map;this._sessionDepth=new Map;this._register(U.filter(this.configurationService.onDidChangeConfiguration,p=>p.affectsConfiguration("chat.generalPurposeAgent.enabled"))(()=>this._onDidUpdateToolData.fire()))}static{this.Id="runSubagent"}getToolData(){let e=dfn,t=this.configurationService.getValue("chat.generalPurposeAgent.enabled"),o={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"}};o.agentName={type:"string",description:t?"Name of the agent to invoke.":"Optional name of a specific agent to invoke. If not provided, uses the current agent."},o.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 n=["prompt","description"];t&&n.push("agentName");let r={type:"object",properties:o,required:n};return{id:f1.Id,toolReferenceName:D3.runSubagent,icon:q.fromId(L.organization.id),displayName:d(9816,null),userDescription:d(9817,null),modelDescription:e,source:wn.Internal,inputSchema:r}}async invoke(e,t,o,n){let r=e.parameters;if(this.logService.debug(`RunSubagentTool: Invoking with prompt: ${r.prompt.substring(0,100)}...`),!e.context)throw new Error("toolInvocationToken is required for this tool");let s=this.chatService.getSession(e.context.sessionResource);if(!s)throw new Error("Chat model not found for session");let l=s.getRequests().at(-1),c=new O;try{let u=this.chatAgentService.getDefaultAgent("panel","agent");if(!u)return g1("Error: No default agent available");let p=e.modelId,h=e.userSelectedTools,g,f,v,b=r.agentName,S=this.configurationService.getValue("chat.generalPurposeAgent.enabled"),y=S&&(!b||b===EZ),w=y?EZ:b;if(b&&!y)if(f=await this.getSubAgentByName(b),f){let Ee=this._resolvedModels.get(e.callId);if(Ee)this._resolvedModels.delete(e.callId),p=Ee.modeModelId,v=Ee.resolvedModelName;else{let tt=this.resolveSubagentModel(f,e.modelId,r.model);p=tt.modeModelId,v=tt.resolvedModelName}let Te=f.tools;if(Te){let tt=this.languageModelToolsService.toToolAndToolSetEnablementMap(Te,void 0);h={};for(let[Oi,zt]of tt)_h(Oi)||(h[Oi.id]=zt)}let It=f.agentInstructions;g=It&&{name:b,content:It.content,toolReferences:this.languageModelToolsService.toToolReferences(It.toolReferences),metadata:It.metadata,isBuiltin:Qko(f.source,f.uri,this.productService)}}else{this._resolvedModels.delete(e.callId);let Ee=" Try again with the correct agent name, or omit agentName to use the current agent.",Te=S?` Additionally, you can use '${EZ}' for a full-capability agent.`:"";throw new Error(`Requested agent '${b}' not found.${Ee}${Te}`)}else{let Ee=this._resolvedModels.get(e.callId);if(Ee)this._resolvedModels.delete(e.callId),p=Ee.modeModelId,v=Ee.resolvedModelName;else{let Te=this.resolveSubagentModel(void 0,e.modelId,r.model);p=Te.modeModelId,v=Te.resolvedModelName}}let x=[],E=e.chatStreamToolCallId??e.callId??`subagent-${ht()}`,M=!1,N=Ee=>{for(let Te of Ee)Te.kind==="textEdit"||Te.kind==="notebookEdit"||Te.kind==="codeblockUri"?(Te.kind==="codeblockUri"&&!M&&(M=!0,s.acceptResponseProgress(l,{kind:"markdownContent",content:new he("```\n")})),Te.kind==="codeblockUri"?s.acceptResponseProgress(l,{...Te,subAgentInvocationId:E}):s.acceptResponseProgress(l,Te)):Te.kind==="hook"?s.acceptResponseProgress(l,{...Te,subAgentInvocationId:E}):Te.kind==="markdownContent"&&(M&&(s.acceptResponseProgress(l,{kind:"markdownContent",content:new he("\n```\n\n")}),M=!1),x.push(Te.content.value))},V=this.configurationService.getValue("chat.subagents.allowInvocationsFromSubagents")??!1,H=V?ufn:0,K=e.context.sessionResource.toString(),j=this._sessionDepth.get(K)??0,J=j+1<=H;h||(h={}),h[f1.Id]!==!1&&(h[f1.Id]=J),h[YOi]=!1,h.copilot_askQuestions=!1,H>0&&this.logService.debug(`RunSubagentTool: Nested subagents enabling ${h[f1.Id]}: session ${K}, currentDepth: ${j}, maxDepth: ${H}, allowInvocationsFromSubagents: ${V}`);let ae=new DH;await this.instantiationService.createInstance(Kne,"agent",h,void 0,yn(e.context.sessionResource)).collect(ae,n);let Se;try{Se=(await this.promptsService.getHooks(n))?.hooks}catch(Ee){this.logService.warn("[ChatService] Failed to collect hooks:",Ee)}if(f?.hooks){let Ee={...f.hooks};if(Ee.Stop){let Te=Ee.Stop;Ee.SubagentStop=Ee.SubagentStop?[...Ee.SubagentStop,...Te]:Te,Ee.Stop=void 0}Se=jPt(Se,Ee)}let Re={sessionResource:e.context.sessionResource,requestId:e.callId??`subagent-${Date.now()}`,agentId:u.id,message:r.prompt,variables:{variables:ae.asArray()},location:"panel",subAgentInvocationId:E,subAgentName:w,userSelectedModelId:p,modelConfiguration:p?this.languageModelsService.getModelConfiguration(p):void 0,userSelectedTools:h,modeInstructions:g,parentRequestId:e.chatRequestId,hooks:Se,hasHooksEnabled:!!Se&&Object.values(Se).some(Ee=>Ee&&Ee.length>0)};c.add(this.languageModelToolsService.onDidInvokeTool(Ee=>{Ee.subagentInvocationId===E&&(x.length=0)})),this._sessionDepth.set(K,j+1);let xe;try{xe=await this.chatAgentService.invokeAgent(u.id,Re,N,[],n)}finally{let Ee=(this._sessionDepth.get(K)??1)-1;Ee<=0?this._sessionDepth.delete(K):this._sessionDepth.set(K,Ee)}if(xe?.errorDetails)return g1(`Agent error: ${xe.errorDetails.message}`);let He=x.join("").replace(/^\n*```\n+```\n*/g,"").trim()||"Agent completed with no output";return e.toolSpecificData?.kind==="subagent"&&(e.toolSpecificData.result=He,e.toolSpecificData.modelName=v),{content:[{kind:"text",value:He}],toolMetadata:{subAgentInvocationId:E,description:r.description,agentName:Re.subAgentName,modelName:v}}}catch(u){let p=`Error invoking subagent: ${u instanceof Error?u.message:"Unknown error"}`;return this.logService.error(p,u),g1(p)}finally{c.dispose()}}async getSubAgentByName(e){return(await this.promptsService.getCustomAgents(Ie.None)).find(o=>o.name===e&&o.enabled)}checkMultiplierConstraint(e,t){if(!t||e===t)return{exceeds:!1};let o=this.languageModelsService.lookupLanguageModel(t),n=this.languageModelsService.lookupLanguageModel(e),r=o?.multiplierNumeric,s=n?.multiplierNumeric;return r!==void 0&&s!==void 0&&s>r?{exceeds:!0,reason:`exceeds the current model's cost tier (${s}x vs ${r}x)`}:{exceeds:!1}}getAvailableModelsInfo(e){let t=this.languageModelsService.getLanguageModelIds().map(s=>({id:s,metadata:this.languageModelsService.lookupLanguageModel(s)})).filter(s=>!!s.metadata&&Mx.suitableForAgentMode(s.metadata)&&s.metadata.isUserSelectable!==!1&&!s.metadata.targetChatSessionType);if(t.length===0)return"No models available.";let o=[],n=[];for(let{id:s,metadata:l}of t){let c=Mx.asQualifiedName(l);this.checkMultiplierConstraint(s,e).exceeds?n.push(c):o.push(c)}let r=[];return o.length>0&&r.push(`Available models: ${o.join(", ")}`),n.length>0&&r.push(`Unavailable (exceeds current model's cost tier): ${n.join(", ")}`),r.join(". ")||"No models available."}resolveSubagentModel(e,t,o){let n=t,r=!1;if(o){let l=this.languageModelsService.lookupLanguageModelByQualifiedName(o);if(l?.identifier)n=l.identifier,r=!0;else throw new Error(`Requested model '${o}' not found. ${this.getAvailableModelsInfo(t)}`)}if(e&&!r){let l=e.model;if(l)for(let c of l){let u=this.languageModelsService.lookupLanguageModelByQualifiedName(c);if(u?.identifier){n=u.identifier;break}}}if(n){let l=this.checkMultiplierConstraint(n,t);if(l.exceeds){let c=this.languageModelsService.lookupLanguageModel(n);throw new Error(`Requested model '${c?.name}' ${l.reason}. ${this.getAvailableModelsInfo(t)}`)}}let s=n?this.languageModelsService.lookupLanguageModel(n):void 0;return{modeModelId:n,resolvedModelName:s?.name}}async prepareToolInvocation(e,t){let o=e.parameters,r=this.configurationService.getValue("chat.generalPurposeAgent.enabled")&&(!o.agentName||o.agentName===EZ),s=o.agentName&&!r?await this.getSubAgentByName(o.agentName):void 0,l=this.resolveSubagentModel(s,e.modelId,o.model);return this._resolvedModels.set(e.toolCallId,l),{invocationMessage:o.description,toolSpecificData:{kind:"subagent",description:o.description,agentName:r?EZ:s?.name??o.agentName,prompt:o.prompt,modelName:l.resolvedModelName}}}};f1=I([m(0,gr),m(1,si),m(2,Wn),m(3,Gr),m(4,re),m(5,B),m(6,jr),m(7,F),m(8,Ze)],f1);var pfn="setArtifacts",mfn={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"]},s_o={id:pfn,toolReferenceName:"artifacts",legacyToolReferenceFullNames:["Set Session Artifacts"],displayName:d(9821,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:wn.Internal,inputSchema:mfn},pBe=class{constructor(i,e,t){this._chatArtifactsService=i;this._fileService=e;this._chatService=t}async prepareToolInvocation(i,e){return{pastTenseMessage:new he(d(9822,null)),presentation:"hidden"}}async invoke(i,e,t,o){let n=i.parameters,r=i.context?.sessionResource;if(!r)return{content:[{kind:"text",value:"Error: No session resource available"}]};let s=[];for(let u of n.artifacts??[]){let p=u.uri;if(p||(p=""),p){let h=A.parse(p);if(h.scheme!=="http"&&h.scheme!=="https"&&!await this._fileService.exists(h))throw new Error(d(9824,null,p))}s.push({label:u.label,uri:p,type:u.type})}let l=this._chatArtifactsService.getArtifacts(r),c=i.subAgentInvocationId;if(c){let u=this._resolveSubagentName(r,c);l.setSubagentArtifacts(c,u,s)}else l.setAgentArtifacts(s);return{content:[{kind:"text",value:d(9823,null,s.length)}]}}_resolveSubagentName(i,e){let t=this._chatService.getSession(i);if(t)for(let o of t.getRequests()){let n=o.response;if(n){for(let r of n.response.value)if((r.kind==="toolInvocation"||r.kind==="toolInvocationSerialized")&&r.toolCallId===e&&r.toolSpecificData?.kind==="subagent")return r.toolSpecificData.agentName}}}};pBe=I([m(0,LG),m(1,ge),m(2,si)],pBe);var hfn="setArtifactRules",JOi={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"]},gfn={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:JOi},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:JOi},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:JOi}}},a_o={id:hfn,toolReferenceName:"artifactRules",legacyToolReferenceFullNames:[],displayName:d(9818,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:wn.Internal,inputSchema:gfn},mBe=class{constructor(i){this._chatArtifactsService=i}async prepareToolInvocation(i,e){return{pastTenseMessage:new he(d(9819,null)),presentation:"hidden"}}async invoke(i,e,t,o){let n=i.parameters,r=i.context?.sessionResource;if(!r)return{content:[{kind:"text",value:"Error: No session resource available"}]};let s={byMimeType:n.byMimeType,byFilePath:n.byFilePath,byMemoryFilePath:n.byMemoryFilePath};return this._chatArtifactsService.getArtifacts(r).setRuleOverrides(s),{content:[{kind:"text",value:d(9820,null)}]}}};mBe=I([m(0,LG)],mBe);var ffn="task_complete";var l_o={id:ffn,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:wn.Internal,inputSchema:{type:"object",properties:{summary:{type:"string",description:"Brief summary of what was accomplished. Omit for trivial interactions."}}}},Sjt=class{async prepareToolInvocation(i,e){return{presentation:"hidden"}}async invoke(i,e,t,o){return{content:[{kind:"text",value:i.parameters?.summary??"All done!"}]}}};var Gve=class extends k{static{this.ID="chat.builtinTools"}constructor(i,e,t){super();let o=e.createInstance(cBe);this._register(i.registerTool(n_o,o));let n=this._register(e.createInstance(lBe));this._register(i.registerTool(QOi,n)),this._register(i.vscodeToolSet.addTool(QOi));let r=this._register(e.createInstance(uBe));this._register(i.registerTool(r_o,r));let s=XOi(),l=this._register(e.createInstance(dBe));this._register(i.registerTool(s,l));let c=e.createInstance(vjt);this._register(i.registerTool(t_o,c)),this._register(i.registerTool(i_o,c));let u=e.createInstance(bjt);this._register(i.registerTool(o_o,u));let p=e.createInstance(Sjt);this._register(i.registerTool(l_o,p));let h=e.createInstance(pBe),g=e.createInstance(mBe),f=this._register(new ue),v=this._register(new ue),b=()=>{t.getValue("chat.artifacts.enabled")?(f.value||(f.value=i.registerTool(s_o,h)),v.value||(v.value=i.registerTool(a_o,g))):(f.clear(),v.clear())};b(),this._register(t.onDidChangeConfiguration(E=>{E.affectsConfiguration("chat.artifacts.enabled")&&b()}));let S=this._register(e.createInstance(f1)),y,w,x=()=>{y?.dispose(),w?.dispose(),i.flushToolUpdates();let E=S.getToolData();y=i.registerTool(E,S),w=i.agentToolSet.addTool(E)};x(),this._register(S.onDidUpdateToolData(x)),this._register({dispose:()=>{y?.dispose(),w?.dispose()}})}};Gve=I([m(0,Wn),m(1,F),m(2,B)],Gve);var clt="vscode_fetchWebPage_internal";var hBe=class{constructor(i,e){this._workspaceContextService=i;this._uri=e}get uri(){return this._uri}get hasExplicitWorkingDirectory(){return!!this._uri}getFolder(i){return this._uri?kL.isEqualOrParent(i,this._uri)?this._uri:void 0:this._workspaceContextService.getWorkspaceFolder(i)?.uri}resolveRelativePath(i){if(this._uri)return Ve(this._uri,i);let e=this._workspaceContextService.getWorkspace().folders;if(e.length>0)return e[0].toResource(i)}};function Ijt(a,i,e){if(a.uri)return A.parse(a.uri);if(a.filePath)return new hBe(i,e).resolveRelativePath(a.filePath)}function yjt(a,i){let t=i.trim().split(/\s+/).map(Ss).join("\\s+"),o=a.findMatches(t,!1,!0,!1,null,!1,1);if(o.length!==0)return o[0].range.startLineNumber}function wjt(a,i){let t=new RegExp(`\\b${Ss(i)}\\b`).exec(a);if(t)return t.index+1}function kV(a){let i=g1(a);return i.toolResultMessage=new he(a),i}var vfn="vscode_renameSymbol",bfn=`Rename a code symbol across the workspace using the language server's rename functionality. This performs a precise, semantics-aware rename that updates all references.

Input:
- "symbol": The exact current name of the symbol to rename.
- "newName": The new name for the symbol.
- "uri": A full URI (e.g. "file:///path/to/file.ts") of a file where the symbol appears. Provide either "uri" or "filePath".
- "filePath": A workspace-relative file path (e.g. "src/utils/helpers.ts") of a file where the symbol appears. Provide either "uri" or "filePath".
- "lineContent": A substring of the line of code where the symbol appears. This is used to locate the exact position in the file. Must be the actual text from the file - do NOT fabricate it.

IMPORTANT: The file and line do NOT need to be the definition of the symbol. Any occurrence works - a usage, an import, a call site, etc. You can pick whichever occurrence is most convenient.

If the tool returns an error, retry with corrected input - ensure the file path is correct, the line content matches the actual file content, and the symbol name appears in that line.`,Sfn=bfn+`

If the file's language has no rename provider registered, the tool returns an error.`,dlt=class extends k{constructor(e,t,o,n,r){super();this._languageFeaturesService=e;this._textModelService=t;this._workspaceContextService=o;this._chatService=n;this._bulkEditService=r}getToolData(){return this._buildToolData(Sfn,d(8649,null))}_buildToolData(e,t){return{id:vfn,toolReferenceName:"rename",canBeReferencedInPrompt:!1,icon:q.fromId(L.rename.id),displayName:d(8645,null),userDescription:t,modelDescription:e,source:wn.Internal,inputSchema:{type:"object",properties:{symbol:{type:"string",description:"The exact current name of the symbol to rename."},newName:{type:"string",description:"The new name for the symbol."},uri:{type:"string",description:'A full URI of a file where the symbol appears (e.g. "file:///path/to/file.ts"). Provide either "uri" or "filePath".'},filePath:{type:"string",description:'A workspace-relative file path where the symbol appears (e.g. "src/utils/helpers.ts"). Provide either "uri" or "filePath".'},lineContent:{type:"string",description:"A substring of the line of code where the symbol appears. Used to locate the exact position. Must be actual text from the file."}},required:["symbol","newName","lineContent"]}}}async prepareToolInvocation(e,t){let o=e.parameters;return{invocationMessage:d(8647,null,o.symbol,o.newName)}}async invoke(e,t,o,n){let r=e.parameters,s=Ijt(r,this._workspaceContextService,e.context?.workingDirectory);if(!s)return kV('Provide either "uri" (a full URI) or "filePath" (a workspace-relative path) to identify the file.');let l=await this._textModelService.createModelReference(s);try{let c=l.object.textEditorModel;if(!this._languageFeaturesService.renameProvider.has(c))return kV("No rename provider available for this file's language. The rename tool may not support this language.");let u=yjt(c,r.lineContent);if(u===void 0)return kV(`Could not find line content "${r.lineContent}" in ${s.toString()}. Provide the exact text from the line where the symbol appears.`);let p=c.getLineContent(u),h=wjt(p,r.symbol);if(h===void 0)return kV(`Could not find symbol "${r.symbol}" in the matched line. Ensure the symbol name is correct and appears in the provided line content.`);let g=new ye(u,h),f=await ggi(this._languageFeaturesService.renameProvider,c,g,r.newName);if(f.rejectReason)return kV(`Rename rejected: ${f.rejectReason}`);if(f.edits.length===0)return kV("Rename produced no edits.");if(e.context){let b=this._chatService.getSession(e.context.sessionResource),S=b?.getRequests().at(-1);if(b&&S){let y=new dt;for(let w of f.edits)if(hl.is(w)){let x=y.get(w.resource);x||(x=[],y.set(w.resource,x)),x.push(w.textEdit)}for(let[w,x]of y)b.acceptResponseProgress(S,{kind:"textEdit",uri:w,edits:[]}),b.acceptResponseProgress(S,{kind:"textEdit",uri:w,edits:x}),b.acceptResponseProgress(S,{kind:"textEdit",uri:w,edits:[],done:!0});return this._successResult(r,y.size,f.edits.length)}}await this._bulkEditService.apply(f);let v=new xn(f.edits.filter(hl.is).map(b=>b.resource)).size;return this._successResult(r,v,f.edits.length)}finally{l.dispose()}}_successResult(e,t,o){let n=o===1?d(8648,null,e.symbol,e.newName,t):d(8646,null,e.symbol,e.newName,o,t),r=g1(n);return r.toolResultMessage=new he(n),r}};dlt=I([m(0,Jt),m(1,Bt),m(2,Ae),m(3,si),m(4,Ka)],dlt);var qve=class extends k{static{this.ID="chat.renameTool"}constructor(i,e){super();let t=this._store.add(e.createInstance(dlt));this._store.add(i.registerTool(t.getToolData(),t))}};qve=I([m(0,Wn),m(1,F)],qve);var Ifn="vscode_listCodeUsages",yfn=`Find all usages (references, definitions, and implementations) of a code symbol across the workspace. This tool locates where a symbol is referenced, defined, or implemented.

Input:
- "symbol": The exact name of the symbol to search for (function, class, method, variable, type, etc.).
- "uri": A full URI (e.g. "file:///path/to/file.ts") of a file where the symbol appears. Provide either "uri" or "filePath".
- "filePath": A workspace-relative file path (e.g. "src/utils/helpers.ts") of a file where the symbol appears. Provide either "uri" or "filePath".
- "lineContent": A substring of the line of code where the symbol appears. This is used to locate the exact position in the file. Must be the actual text from the file - do NOT fabricate it.

IMPORTANT: The file and line do NOT need to be the definition of the symbol. Any occurrence works - a usage, an import, a call site, etc. You can pick whichever occurrence is most convenient.

If the tool returns an error, retry with corrected input - ensure the file path is correct, the line content matches the actual file content, and the symbol name appears in that line.`,wfn=yfn+`

If the file's language has no reference provider registered, the tool returns an error.`,ult=class extends k{constructor(e,t,o,n,r){super();this._languageFeaturesService=e;this._modelService=t;this._searchService=o;this._textModelService=n;this._workspaceContextService=r}getToolData(){return this._buildToolData(wfn,d(8668,null))}_buildToolData(e,t){return{id:Ifn,toolReferenceName:"usages",canBeReferencedInPrompt:!1,icon:q.fromId(L.references.id),displayName:d(8663,null),userDescription:t,modelDescription:e,source:wn.Internal,inputSchema:{type:"object",properties:{symbol:{type:"string",description:"The exact name of the symbol (function, class, method, variable, type, etc.) to find usages of."},uri:{type:"string",description:'A full URI of a file where the symbol appears (e.g. "file:///path/to/file.ts"). Provide either "uri" or "filePath".'},filePath:{type:"string",description:'A workspace-relative file path where the symbol appears (e.g. "src/utils/helpers.ts"). Provide either "uri" or "filePath".'},lineContent:{type:"string",description:"A substring of the line of code where the symbol appears. Used to locate the exact position. Must be actual text from the file."}},required:["symbol","lineContent"]}}}async prepareToolInvocation(e,t){let o=e.parameters;return{invocationMessage:d(8664,null,o.symbol)}}async invoke(e,t,o,n){let r=e.parameters,s=Ijt(r,this._workspaceContextService,e.context?.workingDirectory);if(!s)return kV('Provide either "uri" (a full URI) or "filePath" (a workspace-relative path) to identify the file.');let l=await this._textModelService.createModelReference(s);try{let c=l.object.textEditorModel;if(!this._languageFeaturesService.referenceProvider.has(c))return kV("No reference provider available for this file's language. The usages tool may not support this language.");let u=yjt(c,r.lineContent);if(u===void 0)return kV(`Could not find line content "${r.lineContent}" in ${s.toString()}. Provide the exact text from the line where the symbol appears.`);let p=c.getLineContent(u),h=wjt(p,r.symbol);if(h===void 0)return kV(`Could not find symbol "${r.symbol}" in the matched line. Ensure the symbol name is correct and appears in the provided line content.`);let g=new ye(u,h),[f,v,b]=await Promise.all([d0(this._languageFeaturesService.definitionProvider,c,g,!1,n),xJ(this._languageFeaturesService.referenceProvider,c,g,!1,!1,n),BEe(this._languageFeaturesService.implementationProvider,c,g,!1,n)]);if(v.length===0){let E=g1(`No usages found for \`${r.symbol}\`.`);return E.toolResultMessage=new he(d(8665,null,r.symbol)),E}let S=await this._getLinePreviews(r.symbol,v,n),y=[];y.push(`${v.length} usages of \`${r.symbol}\`:
`);for(let E=0;E<v.length;E++){let M=v[E],N=this._classifyReference(M,f,b),V=G.lift(M.range).startLineNumber,H=S[E];H?(y.push(`<usage type="${N}" uri="${M.uri.toString()}" line="${V}">`),y.push(`	${H}`),y.push("</usage>")):y.push(`<usage type="${N}" uri="${M.uri.toString()}" line="${V}" />`)}let w=y.join(`
`),x=g1(w);return x.toolResultMessage=v.length===1?new he(d(8666,null,r.symbol)):new he(d(8667,null,r.symbol,v.length)),x.toolResultDetails=v.map(E=>({uri:E.uri,range:E.range})),x}finally{l.dispose()}}async _getLinePreviews(e,t,o){let n=new Array(t.length),r=new Map,s=new xn;for(let l=0;l<t.length;l++){let c=t[l],u=G.lift(c.range).startLineNumber,p=this._modelService.getModel(c.uri);p?n[l]=p.getLineContent(u).trim():(r.set(`${c.uri.toString()}:${u}`,l),s.add(c.uri))}if(s.size===0||o.isCancellationRequested)return n;try{let l=this._workspaceContextService.getWorkspace().folders,c=[];for(let u of s){let p=this._workspaceContextService.getWorkspaceFolder(u);if(p){let h=lu(p.uri,u);h&&c.push(h)}}if(c.length>0){let u={};c.length===1?u[c[0]]=!0:u[`{${c.join(",")}}`]=!0;let p=await this._searchService.textSearch({type:2,contentPattern:{pattern:Ss(e),isRegExp:!0,isWordMatch:!0},folderQueries:l.map(h=>({folder:h.uri})),includePattern:u},o);for(let h of p.results)if(h.results){for(let g of h.results)if(K0(g))for(let f of g.rangeLocations){let v=f.source.startLineNumber+1,b=`${h.resource.toString()}:${v}`,S=r.get(b);S!==void 0&&(n[S]=g.previewText.trim(),r.delete(b))}}}}catch{}return n}_classifyReference(e,t,o){return t.some(n=>this._overlaps(e,n))?"definition":o.some(n=>this._overlaps(e,n))?"implementation":"reference"}_overlaps(e,t){return ze(e.uri,t.uri)?G.areIntersectingOrTouching(e.range,t.range):!1}};ult=I([m(0,Jt),m(1,_t),m(2,Gg),m(3,Bt),m(4,Ae)],ult);var $ve=class extends k{static{this.ID="chat.usagesTool"}constructor(i,e){super();let t=this._store.add(e.createInstance(ult));this._store.add(i.registerTool(t.getToolData(),t))}};$ve=I([m(0,Wn),m(1,F)],$ve);var Cjt=le("voiceChatService");var xjt=new Y("voiceChatInProgress",!1,{type:"boolean",description:d(9855,null)}),Eb=class extends k{constructor(e,t,o){super();this.speechService=e;this.chatAgentService=t;this.activeVoiceChatSessions=0;this.voiceChatInProgress=xjt.bindTo(o)}static{this.AGENT_PREFIX=pd}static{this.COMMAND_PREFIX=cp}static{this.PHRASES_LOWER={[this.AGENT_PREFIX]:"at",[this.COMMAND_PREFIX]:"slash"}}static{this.PHRASES_UPPER={[this.AGENT_PREFIX]:"At",[this.COMMAND_PREFIX]:"Slash"}}static{this.CHAT_AGENT_ALIAS=new Map([["vscode","code"]])}createPhrases(e){let t=new Map;for(let o of this.chatAgentService.getActivatedAgents()){let n=`${Eb.PHRASES_LOWER[Eb.AGENT_PREFIX]} ${Eb.CHAT_AGENT_ALIAS.get(o.name)??o.name}`.toLowerCase();t.set(n,{agent:o.name});for(let r of o.slashCommands){let s=`${Eb.PHRASES_LOWER[Eb.COMMAND_PREFIX]} ${r.name}`.toLowerCase();t.set(s,{agent:o.name,command:r.name});let l=`${n} ${s}`.toLowerCase();t.set(l,{agent:o.name,command:r.name})}}return t}toText(e,t){switch(t){case 1:return`${Eb.AGENT_PREFIX}${e.agent}`;case 2:return`${Eb.COMMAND_PREFIX}${e.command}`;case 3:return`${Eb.AGENT_PREFIX}${e.agent} ${Eb.COMMAND_PREFIX}${e.command}`}}async createVoiceChatSession(e,t){let o=new O,n=p=>{this.activeVoiceChatSessions=Math.max(0,this.activeVoiceChatSessions-1),this.activeVoiceChatSessions===0&&this.voiceChatInProgress.reset(),p&&o.dispose()};o.add(e.onCancellationRequested(()=>n(!0)));let r=!1,s=!1,l=o.add(new T),c=await this.speechService.createSpeechToTextSession(e,"chat");e.isCancellationRequested&&n(!0);let u=this.createPhrases(t.model);return o.add(c.onDidChange(p=>{switch(p.status){case 2:case 3:{let h=p;if(p.text){let g=p.text.startsWith(Eb.PHRASES_UPPER[Eb.AGENT_PREFIX])||p.text.startsWith(Eb.PHRASES_LOWER[Eb.AGENT_PREFIX]),f=p.text.startsWith(Eb.PHRASES_UPPER[Eb.COMMAND_PREFIX])||p.text.startsWith(Eb.PHRASES_LOWER[Eb.COMMAND_PREFIX]);if(g||f){let v=p.text.split(" "),b,S=!1;if(t.usesAgents&&g&&!r&&!s&&v.length>=4){let y=u.get(v.slice(0,4).map(w=>this.normalizeWord(w)).join(" "));y&&(b=[this.toText(y,3),...v.slice(4)],S=v.length===4,p.status===3&&(r=!0,s=!0))}if(t.usesAgents&&g&&!r&&!b&&v.length>=2){let y=u.get(v.slice(0,2).map(w=>this.normalizeWord(w)).join(" "));y&&(b=[this.toText(y,1),...v.slice(2)],S=v.length===2,p.status===3&&(r=!0))}if(f&&!s&&!b&&v.length>=2){let y=u.get(v.slice(0,2).map(w=>this.normalizeWord(w)).join(" "));y&&(b=[this.toText(y,t.usesAgents&&!r?3:2),...v.slice(2)],S=v.length===2,p.status===3&&(s=!0))}h={status:p.status,text:(b??v).join(" "),waitingForInput:S}}}l.fire(h);break}case 1:this.activeVoiceChatSessions++,this.voiceChatInProgress.set(!0),l.fire(p);break;case 4:n(!1),l.fire(p);break;case 5:l.fire(p);break}})),{onDidChange:l.event}}normalizeWord(e){return e=Bh(e,"."),e=Bh(e,","),e=Bh(e,"?"),e.toLowerCase()}};Eb=I([m(0,Gx),m(1,gr),m(2,X)],Eb);var kjt=class{constructor(){this.priority=100;this.name="panelChat";this.type="view";this.when=Z.inChatSession}getProvider(i){let e=i.get(Lt),t=i.get(de),o=e.lastFocusedWidget;if(!o)return;let n=o.hasInputFocus();n&&o.focusResponseItem();let r=o,s=r.getFocus();if(!s||!Ni(s)){let c=r.viewModel?.getItems().filter(Ni)?.at(-1);c&&(s=c,r.focus(c))}if(!(!s||!Ni(s)))return new ZOi(r,s,n,t)}},Ejt="chat.accessibleView.includeThinking",Cfn=!0;function eFi(a){return a.getBoolean(Ejt,0,Cfn)}function xfn(a){return typeof a=="object"&&a!==null&&"output"in a&&typeof a.output=="object"&&a.output?.type==="data"&&typeof a.output?.base64Data=="string"}function d_o(a){if(!a)return"";if(cDe(a)||a.kind==="terminal"){let i=yR(a);return i.commandLine.userEdited??i.commandLine.toolEdited??i.commandLine.original}switch(a.kind){case"subagent":{let i=[];return a.agentName&&i.push(d(6304,null,a.agentName)),a.description&&i.push(a.description),a.prompt&&i.push(d(6305,null,a.prompt)),i.join(". ")||""}case"extensions":return a.extensions.length>0?d(6297,null,a.extensions.join(", ")):"";case"todoList":{let i=a.todoList;if(i.length===0)return"";let e=i.map(t=>d(6307,null,t.title,t.status));return d(6308,null,i.length,e.join("; "))}case"pullRequest":return d(6301,null,a.title,a.author);case"input":return typeof a.rawInput=="string"?a.rawInput:JSON.stringify(a.rawInput);case"resources":{let i=a.values;if(i.length===0)return"";let e=i.map(t=>"uri"in t&&"range"in t?`${t.uri.fsPath||t.uri.path}:${t.range.startLineNumber}`:t.fsPath||t.path).join(", ");return d(6302,null,e)}case"simpleToolInvocation":{let i=a.input,e=a.output;return d(6303,null,i,e)}case"modifiedFilesConfirmation":return a.modifiedFiles.length===0?"":d(6300,null,a.modifiedFiles.map(i=>{let e=A.revive(i.uri);return e.fsPath||e.path}).join(", "));default:return""}}function kfn(a){return a?Array.isArray(a)?{files:a.map(e=>A.isUri(e)?e.fsPath||e.path:e.uri.fsPath||e.uri.path)}:oR(a)?{input:a.input,isError:a.isError}:xfn(a)?{input:d(6295,null,a.output.mimeType)}:RH(a)?{input:d(6295,null,a.output.mimeType)}:{}:{}}function c_o(a,i,e,t,o){let n=[],r=o&&i?i:a;r&&n.push(r);let s=d_o(e);if(s&&n.push(s),o&&t){let l=kfn(t);l.isError&&n.unshift(d(6296,null)),l.input&&!s&&n.push(d(6299,null,l.input)),l.files&&l.files.length>0&&n.push(d(6298,null,l.files.join(", ")))}return n.join(". ")}var ZOi=class extends k{constructor(e,t,o,n){super();this._widget=e;this._wasOpenedFromInput=o;this._storageService=n;this._focusedItemDisposables=this._register(new O);this._storageDisposables=this._register(new O);this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this.id="panelChat";this.verbositySettingKey="accessibility.verbosity.panelChat";this.options={type:"view"};this._storageDisposables.add(this._storageService.onDidChangeValue(0,Ejt,this._storageDisposables)(()=>{this._onDidChangeContent.fire()})),this._setFocusedItem(t)}provideContent(){return this._getContent(this._focusedItem)}_setFocusedItem(e){this._focusedItem=e,this._focusedItemDisposables.clear(),Ni(e)&&this._focusedItemDisposables.add(e.model.onDidChange(()=>this._onDidChangeContent.fire()))}_renderMessageAsPlaintext(e){return typeof e=="string"?e:Du(ma(e,{useLinkFormatter:!0}))}_getContent(e){let t=[];if(!Ni(e))return"";"errorDetails"in e&&e.errorDetails&&t.push(e.errorDetails.message);for(let o of e.response.value)switch(o.kind){case"thinking":{if(!this._shouldIncludeThinkingContent())break;let r=(Array.isArray(o.value)?o.value.join(""):o.value||"").trim();r&&t.push(d(6306,null,r));break}case"markdownContent":{let n=ma(o.content,{includeCodeBlocksFences:!0,useLinkFormatter:!0});n.trim()&&t.push(n);break}case"inlineReference":{let n=o.inlineReference,r;if(A.isUri(n)){let s=o.name||Be(n),l=n.scheme==="file"?n.path:n.toString(!0);r=s!==l?`${s} (${l})`:l}else if(Bp(n)){let s=o.name||Be(n.uri),l=n.uri.scheme==="file"?n.uri.path:n.uri.toString(!0);r=`${s} (${l}:${n.range.startLineNumber})`}else{let s=n.location.uri.scheme==="file"?n.location.uri.fsPath||n.location.uri.path:n.location.uri.toString(!0);r=`${n.name} (${s}:${n.location.range.startLineNumber})`}t.push(r);break}case"elicitation2":case"elicitationSerialized":{let n=o.title,r="";typeof n=="string"?r+=`${n}
`:yr(n)&&(r+=ma(n,{includeCodeBlocksFences:!0})+`
`);let s=o.message;yr(s)?r+=ma(s,{includeCodeBlocksFences:!0}):r+=s,r.trim()&&t.push(r);break}case"toolInvocation":{let n=o.state.get();if(n.type===pi.StateKind.WaitingForConfirmation&&n.confirmationMessages?.title){let r=this._renderMessageAsPlaintext(n.confirmationMessages.title),s=n.confirmationMessages.message?this._renderMessageAsPlaintext(n.confirmationMessages.message):"",l=d_o(o.toolSpecificData),c=r;l&&(c+=`: ${l}`),s&&(c+=`
${s}`),t.push(c)}else if(n.type===pi.StateKind.WaitingForPostApproval){let r=oR(n.resultDetails)?n.resultDetails.input:RH(n.resultDetails)?void 0:MPt(n.contentForModel);t.push(d(6309,null,o.toolId)+(r??""))}else{let r=pi.resultDetails(o),s=pi.isComplete(o),l=c_o(this._renderMessageAsPlaintext(o.invocationMessage),o.pastTenseMessage?this._renderMessageAsPlaintext(o.pastTenseMessage):void 0,o.toolSpecificData,r,s);l&&t.push(l)}break}case"toolInvocationSerialized":{let n=c_o(this._renderMessageAsPlaintext(o.invocationMessage),o.pastTenseMessage?this._renderMessageAsPlaintext(o.pastTenseMessage):void 0,o.toolSpecificData,o.resultDetails,o.isComplete);n&&t.push(n);break}}return this._normalizeWhitespace(t.join(`
`))}_normalizeWhitespace(e){let t=e.split(/\r?\n/),o=[];for(let n of t)n.trim().length!==0&&o.push(n);return o.join(`
`)}_shouldIncludeThinkingContent(){return eFi(this._storageService)}onClose(){this._widget.reveal(this._focusedItem),this._wasOpenedFromInput?this._widget.focusInput():this._widget.focus(this._focusedItem)}provideNextContent(){let e=this._widget.getSibling(this._focusedItem,"next");if(e)return this._setFocusedItem(e),this._getContent(e)}providePreviousContent(){let e=this._widget.getSibling(this._focusedItem,"previous");if(e)return this._setFocusedItem(e),this._getContent(e)}};var Efn="workbench.action.chat.focusConfirmation",Tfn="workbench.action.chat.toggleThinkingContentAccessibleView",tFi=class extends z{constructor(){super({id:Efn,title:{value:d(6312,null),original:"Focus Chat Confirmation"},category:{value:d(6310,null),original:"Chat"},precondition:Z.enabled,f1:!0,keybinding:{weight:200,primary:3103,when:C.and(Oa,Z.Editing.hasQuestionCarousel.negate())}})}async run(i){let t=i.get(Lt).getAllWidgets().find(s=>s.viewModel?.model.requestNeedsInput.get());if(!t){cn(d(6313,null));return}let o=t.viewModel;if(!o){cn(d(6311,null));return}let n,r=o.getItems()[o.getItems().length-1];if(Ni(r)){t.reveal(r);let s=t.domNode.querySelectorAll(".chat-confirmation-widget-container[tabindex]");s.length>0&&(n=s[s.length-1])}n?n.contains(t.domNode.ownerDocument.activeElement)?t.focusInput():(n.scrollIntoView({block:"nearest"}),n.focus()):cn(d(6314,null))}},iFi=class extends z{constructor(){super({id:Tfn,title:{value:d(6317,null),original:"Toggle Thinking Content in Accessible View"},category:{value:d(6310,null),original:"Chat"},precondition:Z.enabled,f1:!0,keybinding:{primary:562,weight:200,when:C.and(Jd,C.equals(Fu.key,"panelChat"))}})}async run(i){let e=i.get(de),o=!eFi(e);e.store(Ejt,o,0,0),cn(o?d(6316,null):d(6315,null))}};function u_o(){W(tFi),W(iFi)}var oFi=class{constructor(){this.participants=new Set}registerParticipant(i){return this.participants.add(i),{dispose:()=>{this.participants.delete(i)}}}getParticipants(){return Array.from(this.participants)}},nFi=new oFi;async function gBe(a,i,e){let t=a.get(F),o=a.get(re);for(let n of nFi.getParticipants())try{if(await t.invokeFunction(s=>n.handleOpenSession(s,i,e)))return}catch(r){o.error(r)}return t.invokeFunction(n=>_fn(n,i,e))}async function _fn(a,i,e){let t=a.get(Ms),o=a.get(Lt),n=a.get(Ne);try{i.setRead(!0);let r;GLe(i)?r={}:r={title:{preferred:i.label}};let s={...r,...e?.editorOptions,revealIfOpened:!0};await t.activateChatSessionItemProvider(i.providerType);let l;return e?.sideBySide?l=tr:l=XD,!(i.resource.scheme===Q.vscodeChatEditor||yn(i.resource)===kl)&&!await t.canResolveChatSession(yn(i.resource))&&(l=e?.sideBySide?En:tr,s={...s,revealIfOpened:!0}),await o.openSession(i.resource,l,s)}catch(r){n.error(d(6831,null,Mn(r)));return}}var Dfn=60,rFi=240,sFi=500,fBe=class extends k{constructor(e,t,o,n,r){super();this.session=e;this.chatService=t;this.instantiationService=o;this.chatWidgetService=n;this.agentSessionsService=r;this.hasRendered=!1;this.domNode=_(".agent-session-hover.interactive-session"),this.domNode.style.width=`${sFi}px`,this.domNode.style.height=`${Dfn+rFi}px`,this.domNode.style.overflow="hidden",this.cts=new qe,this._register(ee(()=>this.cts.cancel())),this.buildHeader(),this.contentElement=D(this.domNode,_(".agent-session-hover-content")),this.loadingElement=D(this.contentElement,_(".agent-session-hover-loading")),D(this.loadingElement,un(q.modify(L.loading,"spin"))),this.renderScheduler=this._register(new Dt(()=>this.render(),200))}onRendered(){this.modelRef??=this.loadModel(),this.hasRendered?this.listWidget?.layout(rFi,sFi):(this.hasRendered=!0,this.renderScheduler.schedule())}async loadModel(){let e=await this.chatService.acquireOrLoadSession(this.session.resource,"panel",this.cts.token,"AgentSessionHoverWidget#loadModel");if(this._store.isDisposed){e?.dispose();return}if(!e){this.loadingElement.remove();let t=this.buildFallbackTooltip(this.session);this.domNode.textContent=typeof t=="string"?t:t.value;return}return this._register(e),e.object}async render(){this.modelRef??=this.loadModel();let e=await this.modelRef;if(!e||this._store.isDisposed)return;this.loadingElement.remove();let t=this._register(this.instantiationService.createInstance(ste,e,{maxVisibleItems:2})),o=D(this.contentElement,_(".interactive-list")),n=this._register(this.instantiationService.createInstance(gne,o,{rendererOptions:{renderStyle:"compact",noHeader:!0,editable:!1},currentChatMode:()=>"ask"}));n.layout(rFi,sFi),n.setScrollLock(!0),n.setViewModel(t),n.refresh();let r=this._register(new Dt(()=>n.refresh(),500));this._register(t.onDidChange(()=>{r.isScheduled()||r.schedule()})),this._register(n.onDidClickFollowup(async s=>{let l=await this.chatWidgetService.openSession(e.sessionResource);l&&l.acceptInput(s.message)}))}buildHeader(){let e=this.session,t=D(this.domNode,_(".agent-session-hover-header")),o=D(t,_(".agent-session-hover-title"));D(o,_("span",void 0,e.label));let n=D(t,_(".agent-session-hover-details")),s=Kg(e.providerType)??zo.Local,l=n_(s);if(D(n,un(l)),D(n,_("span",void 0,sb(s))),D(n,_("span.separator",void 0,"\u2022")),e.timing.lastRequestEnded&&e.timing.lastRequestStarted){let h=this.toDuration(e.timing.lastRequestStarted,e.timing.lastRequestEnded,!0);h&&D(n,_("span",void 0,h))}else{let h=e.timing.lastRequestStarted??e.timing.created;D(n,_("span",void 0,ea(h,!0,!0)))}let c=D(n,_("span.separator",void 0,"\u2022")),u=D(n,_(".agent-session-hover-diff"));c.style.display="none",u.style.display="none";let p=this.agentSessionsService.model.observeSession(e.resource);this._register(ve(h=>{let g=p.read(h)??e,f=KLe(g.changes);St(u),f&&nhe(g.changes)?(c.style.display="",u.style.display="",f.files>0&&D(u,_("span",void 0,f.files===1?d(6749,null):d(6750,null,f.files))),f.insertions>0&&D(u,_("span.insertions",void 0,`+${f.insertions}`)),f.deletions>0&&D(u,_("span.deletions",void 0,`-${f.deletions}`))):(c.style.display="none",u.style.display="none")})),e.status!==1&&(D(n,_("span.separator",void 0,"\u2022")),D(n,_("span",void 0,this.toStatusLabel(e.status)))),e.isArchived()&&(D(n,_("span.separator",void 0,"\u2022")),D(n,un(L.archive)),D(n,_("span",void 0,d(6748,null))))}buildFallbackTooltip(e){let t=[];if(t.push(`**${e.label}**`),e.tooltip){let p=typeof e.tooltip=="string"?e.tooltip:e.tooltip.value;t.push(p)}else{if(e.description){let p=typeof e.description=="string"?e.description:e.description.value;t.push(p)}if(e.badge){let p=typeof e.badge=="string"?e.badge:e.badge.value;t.push(p)}}let o=[],r=Kg(e.providerType)??zo.Local,s=n_(r),l=sb(r),c;if(e.timing.lastRequestEnded&&e.timing.lastRequestStarted)c=this.toDuration(e.timing.lastRequestStarted,e.timing.lastRequestEnded,!0)??ea(e.timing.lastRequestStarted,!0,!0);else{let p=e.timing.lastRequestStarted??e.timing.created;c=ea(p,!0,!0)}o.push(`$(${s.id}) ${l} \u2022 ${c}`);let u=KLe(e.changes);if(u&&nhe(e.changes)){let p=[];u.files>0&&p.push(u.files===1?d(6749,null):d(6750,null,u.files)),u.insertions>0&&p.push(`+${u.insertions}`),u.deletions>0&&p.push(`-${u.deletions}`),p.length>0&&o.push(p.join(" "))}return e.status!==1&&o.push(this.toStatusLabel(e.status)),t.push(o.join(" \u2022 ")),e.isArchived()&&t.push(`$(archive) ${d(6748,null)}`),new he(t.join(`

`),{supportThemeIcons:!0})}toDuration(e,t,o){let n=Math.round((t-e)/1e3)*1e3;if(!(n<1e3))return BY(n,o)}toStatusLabel(e){let t;switch(e){case 3:t=d(6747,null);break;case 2:t=d(6746,null);break;case 0:t=d(6745,null);break;default:t=d(6744,null)}return t}};fBe=I([m(1,si),m(2,F),m(3,Lt),m(4,Vc)],fBe);var Tjt=(e=>(e.Created="created",e.Updated="updated",e))(Tjt||{}),vBe=Object.freeze({providers:[],states:[],archived:!0,read:!1,repositoryGroupCapped:!0}),EV=class extends k{constructor(e,t,o){super();this.options=e;this.chatSessionsService=t;this.storageService=o;this.STORAGE_KEY="agentSessions.filterExcludes.agentsessionsviewerfiltersubmenu";this.SORTING_STORAGE_KEY="agentSessions.sorting";this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.limitResults=()=>this.options.limitResults?.();this.groupResults=()=>this.options.groupResults?.();this.sortResults=()=>this.options.sortResults?.()??this.currentSorting;this.excludes=vBe;this.isStoringExcludes=!1;this.currentSorting="created";this.actionDisposables=this._register(new O);this.restoreSorting(),this.updateExcludes(!1),this.registerListeners()}registerListeners(){this._register(this.chatSessionsService.onDidChangeItemsProviders(()=>this.updateFilterActions())),this._register(this.chatSessionsService.onDidChangeAvailability(()=>this.updateFilterActions())),this._register(this.storageService.onDidChangeValue(0,this.STORAGE_KEY,this._store)(()=>this.updateExcludes(!0)))}updateExcludes(e){if(!this.isStoringExcludes){let t=this.storageService.get(this.STORAGE_KEY,0);if(t)try{this.excludes=JSON.parse(t)}catch{this.excludes={...vBe}}else this.excludes={...vBe}}this.updateFilterActions(),e&&this._onDidChange.fire()}storeExcludes(e){this.excludes=e,this.isStoringExcludes=!0;try{Qi(this.excludes,vBe)?this.storageService.remove(this.STORAGE_KEY,0):this.storageService.store(this.STORAGE_KEY,JSON.stringify(this.excludes),0,0)}finally{this.isStoringExcludes=!1}}restoreSorting(){let e=this.storageService.get(this.SORTING_STORAGE_KEY,0);e&&Object.values(Tjt).includes(e)&&(this.currentSorting=e)}setSorting(e){this.currentSorting!==e&&(this.currentSorting=e,this.storageService.store(this.SORTING_STORAGE_KEY,e,0,0),this.updateFilterActions(),this._onDidChange.fire())}updateFilterActions(){this.actionDisposables.clear();let e=this.options.filterMenuId;e&&(this.registerSortActions(this.actionDisposables,e),this.registerProviderActions(this.actionDisposables,e),this.registerStateActions(this.actionDisposables,e),this.registerArchivedActions(this.actionDisposables,e),this.registerReadActions(this.actionDisposables,e),this.registerResetAction(this.actionDisposables,e))}registerSortActions(e,t){let o=this;e.add(W(class extends z{constructor(){super({id:`agentSessions.filter.sortByCreated.${t.id.toLowerCase()}`,title:d(6824,null),menu:{id:t,group:"0_sort",order:0},toggled:o.currentSorting==="created"?C.true():C.false()})}run(){o.setSorting("created")}})),e.add(W(class extends z{constructor(){super({id:`agentSessions.filter.sortByUpdated.${t.id.toLowerCase()}`,title:d(6825,null),menu:{id:t,group:"0_sort",order:1},toggled:o.currentSorting==="updated"?C.true():C.false()})}run(){o.setSorting("updated")}}))}registerProviderActions(e,t){let o=this.options.providerLabelOverrides,n=c=>{if(o?.has(c))return o.get(c);let u=Kg(c);return u?sb(u):c},r;if(this.options.allowedProviders)r=this.options.allowedProviders.map(c=>({id:c,label:n(c)}));else{r=[{id:zo.Local,label:n(zo.Local)}];for(let c of this.chatSessionsService.getAllChatSessionContributions())r.find(u=>u.id===c.type)||r.push({id:c.type,label:n(c.type)})}let s=this,l=0;for(let c of r)e.add(W(class extends z{constructor(){super({id:`agentSessions.filter.toggleExclude:${c.id}.${t.id.toLowerCase()}`,title:c.label,menu:{id:t,group:"1_providers",order:l++},toggled:s.excludes.providers.includes(c.id)?C.false():C.true()})}run(){let u=new Set(s.excludes.providers);u.delete(c.id)||u.add(c.id),s.storeExcludes({...s.excludes,providers:Array.from(u)})}}))}registerStateActions(e,t){let o=[{id:1,label:d(6826,null)},{id:2,label:d(6828,null)},{id:3,label:d(6829,null)},{id:0,label:d(6827,null)}],n=this,r=0;for(let s of o)e.add(W(class extends z{constructor(){super({id:`agentSessions.filter.toggleExcludeState:${s.id}.${t.id.toLowerCase()}`,title:s.label,menu:{id:t,group:"2_states",order:r++},toggled:n.excludes.states.includes(s.id)?C.false():C.true()})}run(){let l=new Set(n.excludes.states);l.delete(s.id)||l.add(s.id),n.storeExcludes({...n.excludes,states:Array.from(l)})}}))}registerArchivedActions(e,t){let o=this;e.add(W(class extends z{constructor(){super({id:`agentSessions.filter.toggleExcludeArchived.${t.id.toLowerCase()}`,title:d(6821,null),menu:{id:t,group:"3_props",order:1e3},toggled:o.excludes.archived?C.false():C.true()})}run(){o.storeExcludes({...o.excludes,archived:!o.excludes.archived})}}))}registerReadActions(e,t){let o=this;e.add(W(class extends z{constructor(){super({id:`agentSessions.filter.toggleExcludeRead.${t.id.toLowerCase()}`,title:d(6822,null),menu:{id:t,group:"3_props",order:0},toggled:o.excludes.read?C.false():C.true()})}run(){o.storeExcludes({...o.excludes,read:!o.excludes.read})}}))}setRepositoryGroupCapped(e){this.excludes.repositoryGroupCapped!==e&&this.storeExcludes({...this.excludes,repositoryGroupCapped:e})}registerResetAction(e,t){let o=this;e.add(W(class extends z{constructor(){super({id:`agentSessions.filter.resetExcludes.${t.id.toLowerCase()}`,title:d(6823,null),menu:{id:t,group:"4_reset",order:0}})}run(){o.reset()}}))}isDefault(){return Qi(this.excludes,vBe)&&this.currentSorting==="created"}getExcludes(){return this.excludes}exclude(e){let t=this.options?.overrideExclude?.(e);return typeof t=="boolean"?t:!!(this.options.allowedProviders&&!this.options.allowedProviders.includes(e.providerType)||this.excludes.read&&e.isRead()||this.excludes.providers.includes(e.providerType)||this.excludes.states.includes(e.status)||this.excludes.archived&&this.groupResults?.()==="capped"&&e.isArchived())}notifyResults(e){this.options.notifyResults?.(e)}reset(){this.storeExcludes({...vBe}),this.currentSorting!=="created"&&this.setSorting("created")}};EV=I([m(1,Ms),m(2,de)],EV);var FP=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.options=e;this._approvalModel=t;this._activeSessionResource=o;this.markdownRendererService=n;this.productService=r;this.hoverService=s;this.instantiationService=l;this.contextKeyService=c;this.chatSessionsService=u;this.templateId=FP.TEMPLATE_ID;this.sessionHover=this._register(new ue);this._onDidChangeItemHeight=this._register(new T);this.onDidChangeItemHeight=this._onDidChangeItemHeight.event}static{this.TEMPLATE_ID="agent-session"}static{this.APPROVAL_ROW_MAX_LINES=3}static{this._APPROVAL_ROW_LINE_HEIGHT=18}static{this._APPROVAL_ROW_OVERHEAD=14}static getApprovalRowHeight(e){return Math.min(e.split(/\r?\n/).length,FP.APPROVAL_ROW_MAX_LINES)*FP._APPROVAL_ROW_LINE_HEIGHT+FP._APPROVAL_ROW_OVERHEAD}renderTemplate(e){let t=new O,o=t.add(new O),n=st("div.agent-session-item@item",[st("div.agent-session-icon-col",[st("div.agent-session-icon@icon")]),st("div.agent-session-main-col",[st("div.agent-session-title-row",[st("div.agent-session-title@title"),st("div.agent-session-pinned-indicator@pinnedIndicator"),st("div.agent-session-title-toolbar@titleToolbar")]),st("div.agent-session-details-row",[st("div.agent-session-details-icon@detailsIcon"),st("div.agent-session-badge@badge"),st("span.agent-session-separator@separator"),st("div.agent-session-diff-container@diffContainer",[st("span.agent-session-diff-added@addedSpan"),st("span.agent-session-diff-removed@removedSpan")]),st("div.agent-session-description@description"),st("div.agent-session-status@statusContainer",[st("span.agent-session-status-time@statusTime")])]),st("div.agent-session-approval-row@approvalRow",[st("span.agent-session-approval-label@approvalLabel"),st("div.agent-session-approval-button@approvalButtonContainer")])])]),r=t.add(this.contextKeyService.createScoped(n.item)),s=t.add(this.instantiationService.createChild(new Po([X,r]))),l=t.add(s.createInstance(pr,n.titleToolbar,R.AgentSessionItemToolbar,{menuOptions:{shouldForwardArgs:!0}}));return e.appendChild(n.item),{element:n.item,icon:n.icon,title:t.add(new ld(n.title,{supportHighlights:!0,supportIcons:!0})),pinnedIndicator:n.pinnedIndicator,titleToolbar:l,detailsIcon:n.detailsIcon,badge:n.badge,separator:n.separator,diffContainer:n.diffContainer,diffAddedSpan:n.addedSpan,diffRemovedSpan:n.removedSpan,description:n.description,statusContainer:n.statusContainer,statusTime:n.statusTime,approvalRow:n.approvalRow,approvalLabel:n.approvalLabel,approvalButtonContainer:n.approvalButtonContainer,contextKeyService:r,elementDisposable:o,disposables:t}}renderElement(e,t,o,n){if(o.elementDisposable.clear(),o.diffAddedSpan.textContent="",o.diffRemovedSpan.textContent="",o.badge.textContent="",o.description.textContent="",o.element.classList.toggle("archived",e.element.isArchived()),this.options.isGroupedByRepository?.()){let v=SBe(e.element);v?o.element.setAttribute("data-section-label",v):o.element.removeAttribute("data-section-label")}else o.element.removeAttribute("data-section-label");if(this.options.useStatusOnlyIcons){let v=this.getIcon(e.element,!0);o.icon.className=`agent-session-icon ${q.asClassName(v)}${e.element.status===3?" needs-input":""}`,o.icon.style.color=v.color?Tt(v.color.id):"",e.element.providerType===zo.Background?o.detailsIcon.className="agent-session-details-icon":(o.detailsIcon.className=`agent-session-details-icon ${q.asClassName(e.element.icon)}`,o.detailsIcon.classList.add("visible"))}else{let v=this.getIcon(e.element);o.icon.className=`agent-session-icon ${q.asClassName(v)}${e.element.status===3?" needs-input":""}`,o.icon.style.color=v.color?Tt(v.color.id):"",o.detailsIcon.className="agent-session-details-icon"}let r=new he(e.element.label);o.title.setLabel(ma(r),void 0,{matches:Wa(e.filterData)}),Z.isArchivedAgentSession.bindTo(o.contextKeyService).set(e.element.isArchived()),Z.isPinnedAgentSession.bindTo(o.contextKeyService).set(e.element.isPinned()),Z.isReadAgentSession.bindTo(o.contextKeyService).set(e.element.isRead()),Z.agentSessionType.bindTo(o.contextKeyService).set(e.element.providerType),o.titleToolbar.context=e.element;let s=e.element.isPinned();o.pinnedIndicator.className="agent-session-pinned-indicator "+q.asClassName(L.pinned),o.pinnedIndicator.classList.toggle("visible",s);let l=this.renderBadge(e,o),c=!1,{changes:u}=e.element;!Rx(e.element.status)&&u&&nhe(u)&&this.renderDiff(e,o)&&(c=!0);let p=!1;e.element.providerType===zo.Background||e.element.providerType===zo.Cloud?p=Array.isArray(u)&&u.length>0:p=c,Z.hasAgentSessionChanges.bindTo(o.contextKeyService).set(p);let h=this.renderDescription(e,o),g=this.renderStatus(e,o),f=h&&Rx(e.element.status);o.badge.classList.toggle("has-badge",l&&!f),o.diffContainer.classList.toggle("has-diff",c&&!f),o.statusContainer.classList.toggle("hidden",f),o.separator.classList.toggle("has-separator",!f&&l&&c),o.description.classList.toggle("has-separator",h&&!f&&(l||c)),o.statusContainer.classList.toggle("has-separator",!f&&g&&(l||c||h)),this.renderHover(e,o),this._approvalModel&&this.renderApprovalRow(e,o),this.triggerResolve(e,o)}triggerResolve(e,t){let o=new qe;t.elementDisposable.add({dispose(){o.dispose(!0)}}),this.chatSessionsService.resolveChatSessionItem(e.element.providerType,e.element.resource,o.token).catch(()=>{})}renderBadge(e,t){if(this.options.hideSessionBadge)return!1;let o=e.element.badge;if(!o)return!1;if(this.options.isGroupedByRepository?.()&&!e.element.isArchived()&&!e.element.isPinned()){let l=(typeof o=="string"?o:o.value).match(/^\$\((?:repo|folder|worktree)\)\s*(.+)/);if(l){let c=l[1].trim(),u=SBe(e.element);if(c===u)return!1}}let n=this.stripCodicons(o);return(typeof n=="string"?n:n.value)?(this.renderMarkdownOrText(n,t.badge,t.elementDisposable),!0):!1}stripCodicons(e){let o=(typeof e=="string"?e:e.value).replace(/\$\([a-z0-9\-]+\)\s*/gi,"").trim();return typeof e=="string"?o:he.lift({...e,value:o})}renderMarkdownOrText(e,t,o){typeof e=="string"?t.textContent=e:o.add(this.markdownRendererService.render(e,{sanitizerConfig:{replaceWithPlaintext:!0,allowedTags:{override:Sst},allowedLinkSchemes:{augment:[this.productService.urlProtocol]}}},t))}renderDiff(e,t){let o=KLe(e.element.changes);return!o||o.insertions===0&&o.deletions===0?!1:(o.insertions>=0&&(t.diffAddedSpan.textContent=`+${o.insertions}`),o.deletions>=0&&(t.diffRemovedSpan.textContent=`-${o.deletions}`),!0)}getIcon(e,t){if(e.status===2)return{...L.sessionInProgress,color:wp("textLink.foreground")};if(e.status===3)return{...L.circleFilled,color:wp("list.warningForeground")};if(e.status===0)return{...L.error,color:wp("errorForeground")};if(t){let o=e.metadata;if(o?.pullRequestUrl||o?.pullRequestNumber)switch(o?.pullRequestState){case"merged":return{...L.gitPullRequestDone,color:wp("charts.purple")};case"closed":return{...L.gitPullRequestClosed,color:wp("charts.red")};case"draft":return{...L.gitPullRequestDraft,color:wp("descriptionForeground")};default:return{...L.gitPullRequest,color:wp("charts.green")}}}return!e.isRead()&&!e.isArchived()?{...L.circleFilled,color:wp("textLink.foreground")}:!t&&e.providerType===zo.Local?{...L.circleSmallFilled,color:wp("agentSessionReadIndicator.foreground")}:t?{...L.circleSmallFilled,color:wp("agentSessionReadIndicator.foreground")}:e.icon}renderDescription(e,t){let o=e.element.description;return o?(this.renderMarkdownOrText(o,t.description,t.elementDisposable),!0):e.element.status===2?(t.description.textContent=d(6863,null),!0):e.element.status===3?(t.description.textContent=d(6864,null),!0):e.element.status===0?(t.description.textContent=d(6862,null),!0):(t.description.textContent="",!1)}toDuration(e,t,o,n){let r=Math.max(Math.round((t-e)/1e3)*1e3,1e3);return!n&&r<6e4?d(6869,null):BY(r,o)}renderStatus(e,t){let o=e.element.isPinned()&&this.options.isGroupedByRepository?.()?SBe(e.element):void 0,n=s=>{let l;if(s.status===2&&s.timing.lastRequestStarted&&(l=this.toDuration(s.timing.lastRequestStarted,Date.now(),!1,!1)),!l){let c=this.options.isSortedByUpdated?.()?s.timing.lastRequestEnded??s.timing.created:s.timing.created;Math.round((new Date().getTime()-c)/1e3)<60?l=d(6869,null):l=aFi(c,!0)}return o?`${o} \xB7 ${l}`:l};return t.statusTime.textContent=n(e.element),t.elementDisposable.add(new ky).cancelAndSet(()=>t.statusTime.textContent=n(e.element),e.element.status===2?1e3:60*1e3),!0}renderHover(e,t){if(this.options.disableHover||!Rx(e.element.status)&&e.element.isRead())return;let o=e.element.status===3;t.elementDisposable.add(this.hoverService.setupDelayedHover(t.element,()=>this.buildHoverContent(e.element),{groupId:"agent.sessions",reducedDelay:o}))}buildHoverContent(e){this.sessionHover.value?.session.resource.toString()!==e.resource.toString()&&(this.sessionHover.value=this.instantiationService.createInstance(fBe,e));let t=this.sessionHover.value;return{id:`agent.session.hover.${e.resource.toString()}`,content:t.domNode,style:1,onDidShow:()=>t.onRendered(),position:{hoverPosition:this.options.getHoverPosition()}}}renderApprovalRow(e,t){if(this._approvalModel===void 0)throw new ci("Approval model is required to render approval row");let o=this._approvalModel,r=!!o.getApproval(e.element.resource).get();t.approvalRow.classList.toggle("visible",r);let s=t.elementDisposable.add(new O);t.elementDisposable.add(ve(l=>{s.clear();let c=o.getApproval(e.element.resource).read(l),u=!!c;if(t.approvalRow.classList.toggle("visible",u),c){let p=c.label.split(`
`),h=FP.APPROVAL_ROW_MAX_LINES,g=p.slice(0,h);p.length>h&&(g[h-1]=`${g[h-1]} \u2026`);let f=c.languageId??"json",v=new he;for(let w of g)v.appendCodeblock(f,w);this.renderMarkdownOrText(v,t.approvalLabel,s);let b=new he().appendCodeblock(c.languageId??"json",c.label);s.add(this.hoverService.setupDelayedHover(t.approvalLabel,{content:b,style:1,position:{hoverPosition:2}})),t.approvalButtonContainer.textContent="";let S=this._activeSessionResource.read(l)?.toString()===e.element.resource.toString(),y=s.add(new Pi(t.approvalButtonContainer,{title:d(6861,null),secondary:S,...Ro}));y.label=d(6860,null),s.add(y.onDidClick(()=>c.confirm()))}r!==u&&(r=u,this._onDidChangeItemHeight.fire(e.element))}))}renderCompressedElements(e,t,o,n){throw new Error("Should never happen since session is incompressible")}disposeElement(e,t,o,n){o.elementDisposable.clear()}disposeTemplate(e){e.disposables.dispose()}};FP=I([m(3,_n),m(4,Ze),m(5,ot),m(6,F),m(7,X),m(8,Ms)],FP);function Rfn(a){let i;switch(a){case 3:i=d(6842,null);break;case 2:i=d(6840,null);break;case 0:i=d(6839,null);break;default:i=d(6838,null)}return i}var H6=class{constructor(i,e,t){this.sectionOptions=i;this.instantiationService=e;this.contextKeyService=t;this.templateId=H6.TEMPLATE_ID}static{this.TEMPLATE_ID="agent-session-section"}renderTemplate(i){let e=new O,t=st("div.agent-session-section@container",[st("span.agent-session-section-label@label"),st("span.agent-session-section-count@count"),st("div.agent-session-section-toolbar@toolbar")]),o=e.add(this.contextKeyService.createScoped(t.container)),n=e.add(this.instantiationService.createChild(new Po([X,o]))),r=e.add(n.createInstance(pr,t.toolbar,R.AgentSessionSectionToolbar,{menuOptions:{shouldForwardArgs:!0}}));return i.appendChild(t.container),{container:t.container,label:t.label,count:t.count,toolbar:r,contextKeyService:o,disposables:e}}renderElement(i,e,t,o){t.label.textContent=i.element.label,this.sectionOptions.hideSectionCount?t.count.textContent="":t.count.textContent=String(i.element.sessions.length),Z.agentSessionSection.bindTo(t.contextKeyService).set(i.element.section),t.toolbar.context=i.element}renderCompressedElements(i,e,t,o){throw new Error("Should never happen since section header is incompressible")}disposeElement(i,e,t,o){}disposeTemplate(i){i.disposables.dispose()}};H6=I([m(1,F),m(2,X)],H6);var WP=class a{constructor(i){this.options=i;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="agent-session-show-more"}static{this.HEIGHT=26}static{this.COLLAPSED_HEIGHT=1}renderTemplate(i){let e=new O,t=st("div.agent-session-show-more@container",[st("span.agent-session-show-more-label@label")]);return i.appendChild(t.container),{container:t.container,label:t.label,disposables:e}}renderElement(i,e,t){t.label.textContent=this.options?.compactLabel?d(6852,null,i.element.remainingCount):d(6851,null,i.element.remainingCount),t.container.setAttribute("data-section-label",i.element.sectionLabel)}renderCompressedElements(){throw new Error("Should never happen since show-more is incompressible")}disposeElement(){}disposeTemplate(i){i.disposables.dispose()}},plt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="agent-session-show-less"}static{this.HEIGHT=WP.HEIGHT}renderTemplate(i){let e=new O,t=st("div.agent-session-show-more@container",[st("span.agent-session-show-more-label@label")]);return i.appendChild(t.container),{container:t.container,label:t.label,disposables:e}}renderElement(i,e,t){t.label.textContent=d(6850,null),t.container.setAttribute("data-section-label",i.element.sectionLabel)}renderCompressedElements(){throw new Error("Should never happen since show-less is incompressible")}disposeElement(){}disposeTemplate(i){i.disposables.dispose()}},jve=class a{constructor(i,e){this._approvalModel=i;this._compactShowMore=e}static{this.ITEM_HEIGHT=54}static{this.SECTION_HEIGHT=26}getHeight(i){if(oI(i))return a.SECTION_HEIGHT;if(hW(i)||gW(i))return this._compactShowMore?WP.COLLAPSED_HEIGHT:WP.HEIGHT;let e=a.ITEM_HEIGHT,t=this._approvalModel?.getApproval(i.resource).get();return t&&(e+=FP.getApprovalRowHeight(t.label)),e}hasDynamicHeight(i){return hW(i)||gW(i)?!0:!!this._approvalModel&&_G(i)}getTemplateId(i){return oI(i)?H6.TEMPLATE_ID:hW(i)?WP.TEMPLATE_ID:gW(i)?plt.TEMPLATE_ID:FP.TEMPLATE_ID}},Djt=class{getWidgetRole(){return"list"}getRole(i){return"listitem"}getWidgetAriaLabel(){return d(6843,null)}getAriaLabel(i){if(oI(i)){let e=i.sessions.length;return e===1?d(6857,null,i.label,e):d(6856,null,i.label,e)}return hW(i)?d(6859,null,i.remainingCount):gW(i)?d(6858,null):d(6841,null,i.providerLabel,i.label,Rfn(i.status),new Date(i.timing.created).toLocaleString())}},Rjt=class a extends k{constructor(e,t,o){super();this.filter=e;this.sorter=t;this.repositoryGroupLimit=o;this._onDidGetChildren=this._register(new T);this.onDidGetChildren=this._onDidGetChildren.event;this._onDidExpandRepositoryGroup=this._register(new T);this.onDidExpandRepositoryGroup=this._onDidExpandRepositoryGroup.event;this.expandedRepositoryGroups=new Set;if(this.filter){let n=this.filter.getExcludes().repositoryGroupCapped;this._register(this.filter.onDidChange(()=>{let r=this.filter.getExcludes().repositoryGroupCapped;r&&!n&&this.expandedRepositoryGroups.clear(),n=r}))}}static{this.CAPPED_SESSIONS_LIMIT=3}static{this.REPOSITORY_GROUP_LIMIT=5}expandRepositoryGroup(e){this.expandedRepositoryGroups.add(e),this._onDidExpandRepositoryGroup.fire()}collapseRepositoryGroup(e){this.expandedRepositoryGroups.delete(e),this._onDidExpandRepositoryGroup.fire()}hasChildren(e){return cWt(e)?!0:oI(e)?e.sessions.length>0:!1}getChildren(e){if(cWt(e)){let t=e.sessions.filter(n=>!this.filter?.exclude(n)),o=this.filter?.limitResults?.();return(!this.filter?.groupResults?.()||typeof o=="number")&&t.sort(this.sorter.compare.bind(this.sorter)),typeof o=="number"&&(t=t.slice(0,o)),this.filter?.notifyResults?.(t.length),this._onDidGetChildren.fire(t.length),this.filter?.groupResults?.()?this.groupSessionsIntoSections(t):t}else if(oI(e)){if(this.repositoryGroupLimit&&this.filter?.getExcludes().repositoryGroupCapped&&e.section==="repository"&&e.sessions.length>this.repositoryGroupLimit){if(this.expandedRepositoryGroups.has(e.label))return[...e.sessions,{showLess:!0,sectionLabel:e.label}];{let o=e.sessions.slice(0,this.repositoryGroupLimit),n=e.sessions.length-this.repositoryGroupLimit;return[...o,{showMore:!0,sectionLabel:e.label,remainingCount:n}]}}return e.sessions}else return[]}groupSessionsIntoSections(e){let t=this.filter?.groupResults?.()==="capped",o=this.sorter,n=o instanceof U6?e.sort((r,s)=>o.compare(r,s,!0)):e.sort(o.compare.bind(o));return t?this.filter?.getExcludes().read?n:this.groupSessionsCapped(n):this.filter?.groupResults?.()==="repository"?this.groupSessionsByRepository(n):this.groupSessionsByDate(n)}groupSessionsCapped(e){let t=[],o=e.findIndex(g=>g.isArchived()),n=o===-1?e.length:o,r=e.slice(0,n),s=e.slice(n),l=r.filter(g=>g.isPinned()),c=r.filter(g=>!g.isPinned()),u=c.slice(0,a.CAPPED_SESSIONS_LIMIT),p=c.slice(a.CAPPED_SESSIONS_LIMIT);t.push(...l,...u);let h=[...p,...s];return h.length>0&&t.push({section:"more",label:v1.more,sessions:h}),t}groupSessionsByDate(e){let t=[],o=this.filter?.sortResults?.(),n=mlt(e,o);for(let{sessions:r,section:s,label:l}of n.values())r.length!==0&&t.push({section:s,label:l,sessions:r});return t}groupSessionsByRepository(e){let t=new Map,o=[],n=[],r=[];for(let c of e){if(c.isArchived()){n.push(c);continue}if(c.isPinned()){o.push(c);continue}let u=SBe(c);if(u){let p=t.get(u);p||(p={label:u,sessions:[]},t.set(u,p)),p.sessions.push(c)}else r.push(c)}let s=[];s.push(...o);let l=[...t.values()].sort((c,u)=>MS(c.label,u.label));for(let{label:c,sessions:u}of l)s.push({section:"repository",label:c,sessions:u});return r.length>0&&s.push({section:"repository",label:v1.repository,sessions:r}),n.length>0&&s.push({section:"archived",label:v1.archived,sessions:n}),s}};function SBe(a){let i=a.metadata;if(i){let t=i.remoteAgentHost;if(t){let h=i.workingDirectoryPath;if(h){let g=_jt(h);if(g)return`${g} [${t}]`}return t}let o=i.owner,n=i.name;if(o&&n)return n;let r=i.repositoryNwo;if(r&&r.includes("/"))return r.split("/").pop();let s=i.repository;if(s){let h=p_o(s);if(h)return h}let l=i.repositoryUrl;if(l){let h=p_o(l);if(h)return h}let c=i.repositoryPath;if(c){let h=_jt(c);if(h)return h}let u=i.worktreePath;if(u){let h=_jt(u);if(h)return h}let p=i.workingDirectoryPath;if(p){let h=_jt(p);if(h)return h}}let e=a.badge;if(e){let o=(typeof e=="string"?e:e.value).match(/\$\((?:repo|folder|worktree)\)\s*(.+)/);if(o)return o[1].trim()}}function p_o(a){if(a.includes("/")&&!a.includes("://")&&!a.startsWith("git@")){let i=a.split("/").filter(Boolean).pop();return i?.endsWith(".git")&&(i=i.slice(0,-4)),i||void 0}try{let e=new URL(a).pathname.split("/").filter(Boolean);if(e.length>=2){let t=e[1];return t.endsWith(".git")&&(t=t.slice(0,-4)),t||void 0}}catch{}if(a.startsWith("git@")){let i=a.indexOf(":");if(i!==-1&&i<a.length-1){let t=a.substring(i+1).split("/").filter(Boolean).pop();return t?.endsWith(".git")&&(t=t.slice(0,-4)),t||void 0}}}function _jt(a){let i=a.split(/[/\\]/).filter(Boolean);if(i.length<2)return i[0];let e=i[i.length-2];return e.endsWith(".worktrees")?e.slice(0,-10)||void 0:i[i.length-1]}var v1={pinned:d(6849,null),today:d(6853,null),yesterday:d(6855,null),week:d(6854,null),older:d(6848,null),archived:d(6844,null),more:d(6846,null),repository:d(6847,null)},Ljt=1440*60*1e3,Lfn=7*Ljt;function mlt(a,i){let e=Date.now(),t=new Date(e).setHours(0,0,0,0),o=t-Ljt,n=e-Lfn,r=[],s=[],l=[],c=[],u=[],p=[];for(let h of a)if(h.isArchived())p.push(h);else if(h.isPinned())r.push(h);else{let g=i==="updated"?h.timing.lastRequestEnded??h.timing.created:h.timing.created;g>=t?s.push(h):g>=o?l.push(h):g>=n?c.push(h):u.push(h)}return new Map([["pinned",{section:"pinned",label:v1.pinned,sessions:r}],["today",{section:"today",label:v1.today,sessions:s}],["yesterday",{section:"yesterday",label:v1.yesterday,sessions:l}],["week",{section:"week",label:v1.week,sessions:c}],["older",{section:"older",label:v1.older,sessions:u}],["archived",{section:"archived",label:v1.archived,sessions:p}]])}function aFi(a,i){let e=Date.now(),t=new Date(e).setHours(0,0,0,0),o=t-Ljt,n=o-Ljt;return a<t&&a>=o?i?d(6868,null):d(6867,null):a<o&&a>=n?i?d(6866,null):d(6865,null):ea(a,i)}var Mjt=class{getId(i){return oI(i)?`section-${i.section}-${i.label}`:hW(i)?`show-more-${i.sectionLabel}`:gW(i)?`show-less-${i.sectionLabel}`:_G(i)?i.resource.toString():"agent-sessions-id"}getGroupId(i){return oI(i)||cWt(i)?Sde:1}},Pjt=class{isIncompressible(i){return!0}},U6=class{constructor(i){this.getSortBy=i??(()=>"created")}compare(i,e,t=!1){if(t){let p=i.status===3,h=e.status===3;if(p&&!h)return-1;if(!p&&h)return 1}let o=i.isArchived(),n=e.isArchived();if(!o&&n)return-1;if(o&&!n)return 1;let r=!o&&i.isPinned(),s=!n&&e.isPinned();if(r&&!s)return-1;if(!r&&s)return 1;let l=this.getSortBy(),c=l==="updated"?t?i.timing.lastRequestStarted??i.timing.created:i.timing.lastRequestEnded??i.timing.created:i.timing.created;return(l==="updated"?t?e.timing.lastRequestStarted??e.timing.created:e.timing.lastRequestEnded??e.timing.created:e.timing.created)-c}},Ajt=class{getKeyboardNavigationLabel(i){return oI(i)?i.label:hW(i)||gW(i)?i.sectionLabel:i.label}getCompressedNodeKeyboardNavigationLabel(i){}},bBe=class extends k{constructor(e){super();this.instantiationService=e}onDragStart(e,t){let o=e.getData().filter(r=>_G(r)),n=ui(o.map(r=>r.resource));this.instantiationService.invokeFunction(r=>kv(r,n,t))}getDragURI(e){return oI(e)||hW(e)||gW(e)?null:e.resource.toString()}getDragLabel(e,t){let o=e.filter(n=>_G(n));return o.length===1?o[0].label:d(6845,null,o.length)}onDragOver(e,t,o,n,r){return!1}drop(e,t,o,n,r){}};bBe=I([m(0,F)],bBe);var lFi={iconClass:q.asClassName(L.archive),tooltip:d(6832,null)},cFi={iconClass:q.asClassName(L.inbox),tooltip:d(6836,null)},Njt={iconClass:q.asClassName(L.edit),tooltip:d(6835,null)},Ojt={iconClass:q.asClassName(L.trash),tooltip:d(6834,null)};function dFi(a){let i=typeof a.description=="string"?a.description:a.description?ma(a.description):void 0,e=aFi(a.timing.created);return[i,a.providerLabel,e].filter(o=>!!o).join(" \u2022 ")}function uFi(a){let i=[];return GLe(a)&&(i.push(Njt),i.push(Ojt)),i.push(a.isArchived()?cFi:lFi),i}function pFi(a,i){return!a.isArchived()&&!i.exclude(a)}var Gne=class{constructor(i,e,t,o,n,r){this.anchor=i;this.options=e;this.agentSessionsService=t;this.quickInputService=o;this.instantiationService=n;this.commandService=r;this.sorter=new U6}async pickAgentSession(){let i=new O,e=i.add(this.quickInputService.createQuickPick({useSeparators:!0})),t=i.add(this.instantiationService.createInstance(EV,{}));e.anchor=this.anchor,e.items=this.createPickerItems(t),e.canAcceptInBackground=!0,e.placeholder=d(6833,null),i.add(e.onDidAccept(o=>{let n=e.selectedItems[0];if(n){let r={sideBySide:o.inBackground,editorOptions:{preserveFocus:o.inBackground,pinned:o.inBackground}};this.options?.overrideSessionOpen?this.options.overrideSessionOpen(n.session,r):this.instantiationService.invokeFunction(gBe,n.session,r)}o.inBackground||e.hide()})),i.add(e.onDidTriggerItemButton(async o=>{let n=o.item.session,r=!1;if(o.button===Njt)r=!0,await this.commandService.executeCommand(eDe,n);else if(o.button===Ojt)r=!0,await this.commandService.executeCommand(tDe,n);else{let s=!n.isArchived();n.setArchived(s)}r?(await this.agentSessionsService.model.resolve(n.providerType),this.pickAgentSession()):e.items=this.createPickerItems(t)})),i.add(e.onDidHide(()=>i.dispose())),e.show()}createPickerItems(i){let e=this.agentSessionsService.model.sessions.filter(n=>pFi(n,i)).sort(this.sorter.compare.bind(this.sorter)),t=[],o=mlt(e);for(let n of o.values())n.sessions.length>0&&(t.push({type:"separator",label:n.label}),t.push(...n.sessions.map(r=>this.toPickItem(r))));return t}toPickItem(i){let e=dFi(i),t=uFi(i);return{id:i.resource.toString(),label:i.label,tooltip:i.tooltip,description:e,iconClass:q.asClassName(i.icon),buttons:t,session:i}}};Gne=I([m(2,Vc),m(3,$e),m(4,F),m(5,fe)],Gne);var $ne=P(6789,"Chat Agent Sessions"),Fjt=class extends z{constructor(){super({id:"workbench.action.chat.toggleShowAgentSessions",title:P(6788,"Show Sessions"),toggled:C.equals("config.chat.viewSessions.enabled",!0),menu:{id:R.ChatWelcomeContext,group:"0_sessions",order:2,when:Z.inChatEditor.negate()}})}async run(i){let e=i.get(B),t=e.getValue("chat.viewSessions.enabled");await e.updateValue("chat.viewSessions.enabled",!t)}},hFi=new R("chatAgentSessionsOrientationSubmenu");be.appendMenuItem(R.ChatWelcomeContext,{submenu:hFi,title:P(6785,"Sessions Orientation"),group:"0_sessions",order:1,when:Z.inChatEditor.negate()});var Wjt=class extends z{constructor(){super({id:"workbench.action.chat.setAgentSessionsOrientationStacked",title:P(6787,"Stacked"),toggled:C.equals("config.chat.viewSessions.orientation","stacked"),precondition:C.equals("config.chat.viewSessions.enabled",!0),menu:{id:hFi,group:"navigation",order:2}})}async run(i){await i.get(fe).executeCommand(p$.ID)}},Vjt=class extends z{constructor(){super({id:"workbench.action.chat.setAgentSessionsOrientationSideBySide",title:P(6786,"Side by Side"),toggled:C.notEquals("config.chat.viewSessions.orientation","stacked"),precondition:C.equals("config.chat.viewSessions.enabled",!0),menu:{id:hFi,group:"navigation",order:1}})}async run(i){await i.get(fe).executeCommand(YR.ID)}},Bjt=class extends z{constructor(){super({id:"workbench.action.chat.history",title:P(6767,"Open Agent Session..."),menu:[{id:R.ViewTitle,when:C.and(C.equals("view",Xr),C.equals("config.chat.viewSessions.enabled",!1)),group:"navigation",order:2},{id:R.EditorTitle,when:Tr.isEqualTo(tl.EditorID)}],category:$ne,icon:L.history,f1:!0,precondition:Z.enabled})}async run(i){await i.get(F).createInstance(Gne,void 0,void 0).pickAgentSession()}},Hjt=class extends z{constructor(){super({id:"workbench.action.chat.archiveAllAgentSessions",title:P(6769,"Archive All Workspace Agent Sessions"),precondition:Z.enabled,category:$ne,f1:!0})}async run(i){let e=i.get(Vc),t=i.get(ct),o=e.model.sessions.filter(r=>!r.isArchived());if(!(o.length===0||!(await t.confirm({message:o.length===1?d(6772,null):d(6771,null,o.length),detail:d(6773,null),primaryButton:d(6770,null)})).confirmed))for(let r of o)r.setArchived(!0)}},Ujt=class extends z{constructor(){super({id:"workbench.action.chat.markAllAgentSessionsRead",title:P(6803,"Mark All as Read"),precondition:Z.enabled,category:$ne,f1:!0,menu:{id:R.AgentSessionsContext,group:"0_read",order:2,when:Z.isArchivedAgentSession.negate()}})}async run(i){let t=i.get(Vc).model.sessions.filter(o=>!o.isArchived()&&!o.isRead());if(t.length!==0)for(let o of t)o.setRead(!0)}},zjt="chat.sessions.confirmArchive",Kjt=class extends z{constructor(){super({id:"agentSessionSection.archive",title:P(6774,"Archive All"),icon:L.archive,menu:[{id:R.AgentSessionSectionToolbar,group:"navigation",order:1,when:Z.agentSessionSection.notEqualsTo("archived")},{id:R.AgentSessionSectionContext,group:"1_edit",order:2,when:Z.agentSessionSection.notEqualsTo("archived")}]})}async run(i,e){if(!e||!oI(e))return;let t=i.get(ct),o=i.get(de);if(!o.getBoolean(zjt,0,!1)){let r=await t.confirm({message:e.sessions.length===1?d(6777,null,e.label):d(6776,null,e.sessions.length,e.label),detail:d(6778,null),primaryButton:d(6775,null),checkbox:{label:d(6800,null)}});if(!r.confirmed)return;r.checkboxChecked&&o.store(zjt,!0,0,0)}for(let r of e.sessions)r.setArchived(!0)}},Gjt=class extends z{constructor(){super({id:"agentSessionSection.unarchive",title:P(6814,"Unarchive All"),icon:L.unarchive,menu:[{id:R.AgentSessionSectionToolbar,group:"navigation",order:1,when:Z.agentSessionSection.isEqualTo("archived")},{id:R.AgentSessionSectionContext,group:"1_edit",order:2,when:Z.agentSessionSection.isEqualTo("archived")}]})}async run(i,e){if(!e||!oI(e))return;let t=i.get(ct),o=i.get(de);if(e.sessions.length>1&&!o.getBoolean(zjt,0,!1)){let r=await t.confirm({message:d(6815,null,e.sessions.length),primaryButton:d(6816,null),checkbox:{label:d(6800,null)}});if(!r.confirmed)return;r.checkboxChecked&&o.store(zjt,!0,0,0)}for(let n of e.sessions)n.setArchived(!1)}},qjt=class extends z{constructor(){super({id:"agentSessionSection.markRead",title:P(6805,"Mark All as Read"),menu:[{id:R.AgentSessionSectionContext,group:"1_edit",order:1,when:Z.agentSessionSection.notEqualsTo("archived")}]})}async run(i,e){if(!(!e||!oI(e)))for(let t of e.sessions)t.setRead(!0)}},$jt=class extends z{constructor(){super({id:"agentSessionSection.collapseAll",title:P(6790,"Collapse All"),menu:[{id:R.AgentSessionSectionContext,group:"2_collapse",order:1}]})}async run(i,e,t){t?.collapseAllSections()}},b1=class extends z{async run(i,e){let t=i.get(Vc),o=i.get(Gt),n=[];if(dWt(e)?n=ui((e.sessions??[e.session]).map(r=>t.getSession(r.resource))):e&&(n=[e]),n.length===0){let s=o.getActiveViewWithId(Xr)?.getFocusedSessions().at(0);s&&(n=[s])}n.length>0&&await this.runWithSessions(n,i)}},jjt=class extends b1{constructor(){super({id:"agentSession.markUnread",title:P(6806,"Mark as Unread"),menu:{id:R.AgentSessionsContext,group:"0_read",order:1,when:C.and(Z.isReadAgentSession,Z.isArchivedAgentSession.negate())}})}runWithSessions(i){for(let e of i)e.setRead(!1)}},Qjt=class extends b1{constructor(){super({id:"agentSession.markRead",title:P(6804,"Mark as Read"),menu:{id:R.AgentSessionsContext,group:"0_read",order:1,when:C.and(Z.isReadAgentSession.negate(),Z.isArchivedAgentSession.negate())}})}runWithSessions(i){for(let e of i)e.setRead(!0)}},Yjt=class extends b1{constructor(){super({id:"agentSession.archive",title:P(6768,"Archive"),icon:L.archive,keybinding:{primary:20,mac:{primary:2049},weight:201,when:C.and(Z.agentSessionsViewerFocused,Z.isArchivedAgentSession.negate())},menu:[{id:R.AgentSessionItemToolbar,group:"navigation",order:1,when:Z.isArchivedAgentSession.negate()},{id:R.AgentSessionsContext,group:"1_edit",order:2,when:Z.isArchivedAgentSession.negate()}]})}async runWithSessions(i,e){let t=e.get(si),o=e.get(ct);for(let n of i){let r=t.getSession(n.resource);if(r&&!await eJe(r,o,{isArchiveAction:!0,titleOverride:d(6779,null),messageOverride:d(6780,null)}))return;n.setArchived(!0)}}},Xjt=class extends b1{constructor(){super({id:"agentSession.unarchive",title:P(6813,"Unarchive"),icon:L.unarchive,keybinding:{primary:1044,mac:{primary:3073},weight:201,when:C.and(Z.agentSessionsViewerFocused,Z.isArchivedAgentSession)},menu:[{id:R.AgentSessionItemToolbar,group:"navigation",order:1,when:Z.isArchivedAgentSession},{id:R.AgentSessionsContext,group:"1_edit",order:2,when:Z.isArchivedAgentSession}]})}runWithSessions(i){for(let e of i)e.setArchived(!1)}},Jjt=class extends b1{constructor(){super({id:"agentSession.pin",title:P(6808,"Pin"),icon:L.pin,menu:[{id:R.AgentSessionItemToolbar,group:"navigation",order:0,when:C.and(Z.isPinnedAgentSession.negate(),Z.isArchivedAgentSession.negate())},{id:R.AgentSessionsContext,group:"0_pin",order:1,when:C.and(Z.isPinnedAgentSession.negate(),Z.isArchivedAgentSession.negate())}]})}runWithSessions(i){for(let e of i)e.setPinned(!0)}},Zjt=class extends b1{constructor(){super({id:"agentSession.unpin",title:P(6817,"Unpin"),icon:L.pinned,menu:[{id:R.AgentSessionItemToolbar,group:"navigation",order:0,when:C.and(Z.isPinnedAgentSession,Z.isArchivedAgentSession.negate())},{id:R.AgentSessionsContext,group:"0_pin",order:1,when:C.and(Z.isPinnedAgentSession,Z.isArchivedAgentSession.negate())}]})}runWithSessions(i){for(let e of i)e.setPinned(!1)}},e5t=class extends b1{constructor(){super({id:eDe,title:P(6810,"Rename..."),precondition:Z.hasMultipleAgentSessionsSelected.negate(),keybinding:{primary:60,mac:{primary:3},weight:201,when:C.and(Z.agentSessionsViewerFocused,Z.agentSessionType.isEqualTo(zo.Local))},menu:{id:R.AgentSessionsContext,group:"1_edit",order:3,when:Z.agentSessionType.isEqualTo(zo.Local)}})}async runWithSessions(i,e){let t=i.at(0);if(!t)return;let o=e.get($e),n=e.get(si),r=await o.input({prompt:d(6807,null),value:t.label});r&&n.setChatSessionTitle(t.resource,r)}},t5t=class extends b1{constructor(){super({id:tDe,title:P(6791,"Delete..."),menu:{id:R.AgentSessionsContext,group:"1_edit",order:4,when:Z.agentSessionType.isEqualTo(zo.Local)}})}async runWithSessions(i,e){if(i.length===0)return;let t=e.get(si),o=e.get(ct),n=e.get(Lt),r=e.get(fe);if(!(await o.confirm({message:i.length===1?d(6796,null):d(6799,null,i.length),detail:d(6798,null),primaryButton:d(6797,null)})).confirmed)return;let l=[];for(let c of i){await n.getWidgetBySessionResource(c.resource)?.clear(),await t.removeHistoryEntry(c.resource);let u=Br.parseLocalSessionId(c.resource);u&&l.push(u)}l.length>0&&r.executeCommand("github.copilot.sessionSync.deleteSessionFromCloud",l).catch(()=>{})}},i5t=class extends z{constructor(){super({id:"workbench.action.chat.clearHistory",title:P(6766,"Delete All Local Workspace Chat Sessions"),precondition:Z.enabled,category:$ne,f1:!0})}async run(i,...e){let t=i.get(si),o=i.get(Lt),n=i.get(ct),s=i.get(Vc).model.sessions.filter(c=>GLe(c)).length;s===0||!(await n.confirm({message:s===1?d(6794,null):d(6793,null,s),detail:d(6795,null),primaryButton:d(6792,null)})).confirmed||(await Promise.all(o.getAllWidgets().map(c=>c.clear())),await t.clearAllHistoryEntries())}},hlt=class extends b1{async runWithSessions(i,e){let t=e.get(Lt),o=this.getTargetGroup();for(let n of i){let r=n.resource;await t.openSession(r,o,{...this.getOptions(),pinned:!0})}}},o5t=class a extends hlt{static{this.id="workbench.action.chat.openSessionInEditorGroup"}constructor(){super({id:a.id,title:P(6782,"Open as Editor"),keybinding:{primary:2051,mac:{primary:259},weight:201,when:C.and(Z.agentSessionsViewerFocused,qo.negate())},menu:{id:R.AgentSessionsContext,when:qo.negate(),order:1,group:"navigation"}})}getTargetGroup(){return tr}getOptions(){return{}}},n5t=class a extends hlt{static{this.id="workbench.action.chat.openSessionInNewEditorGroup"}constructor(){super({id:a.id,title:P(6783,"Open to the Side"),keybinding:{primary:2563,mac:{primary:771},weight:201,when:C.and(Z.agentSessionsViewerFocused,qo.negate())},menu:{id:R.AgentSessionsContext,when:qo.negate(),order:2,group:"navigation"}})}getTargetGroup(){return En}getOptions(){return{}}},r5t=class a extends hlt{static{this.id="workbench.action.chat.openSessionInNewWindow"}constructor(){super({id:a.id,title:P(6784,"Open in New Window"),menu:{id:R.AgentSessionsContext,order:3,group:"navigation"}})}getTargetGroup(){return ff}getOptions(){return{auxiliary:{compact:!0,bounds:{width:800,height:640}}}}},s5t=class extends z{constructor(){super({id:"agentSessionsViewer.refresh",title:P(6809,"Refresh Agent Sessions"),icon:L.refresh,menu:{id:R.AgentSessionsToolbar,group:"navigation",order:1}})}run(i,e){let t=e??i.get(Gt).getActiveViewWithId(Xr)?.agentSessionsControl;t?t.refresh():i.get(fe).executeCommand("sessionsViewPane.refresh")}},a5t=class extends z{constructor(){super({id:"agentSessionsViewer.find",title:P(6801,"Find Agent Session"),icon:L.search,menu:{id:R.AgentSessionsToolbar,group:"navigation",order:2}})}run(i,e){let t=e??i.get(Gt).getActiveViewWithId(Xr)?.agentSessionsControl;return t?t.openFind():i.get(fe).executeCommand("sessionsViewPane.find")}},l5t=class extends z{async run(i){let e=i.get(wi),t=i.get(ji),o=i.get(B),n=i.get(Gt),r=i.get(Es),s=t.getViewLocationById(Xr);if(typeof s!="number")return;let l=e.getPanelPosition(),c=s!==1||l===0||l===1;o.getValue("chat.viewSessions.enabled")||await o.updateValue("chat.viewSessions.enabled",!0);let p=n.getActiveViewWithId(Xr);if(p||(p=await n.openView(Xr,!1)),!p)return;let h=o.getValue("chat.viewSessions.orientation"),g;h==="stacked"||h==="sideBySide"?g=h:g="sideBySide";let f=this.getOrientation(),v=p?.getLastDimensions(f)?.width;if((!c||g==="sideBySide")&&f===1?p.updateConfiguredSessionsViewerOrientation("stacked"):(!c||g==="stacked")&&f===2&&p.updateConfiguredSessionsViewerOrientation("sideBySide"),!c)return;let b=r.getPartId(s),S=e.getSize(b),y=300,w=y,x=y+w+1;if(f===2&&S.width>=x||f===1&&s===2&&e.isAuxiliaryBarMaximized())return;s===2&&(e.setAuxiliaryBarMaximized(!1),S=e.getSize(b));let E;f===2?E=Math.max(x,v||Math.round(e.mainContainerDimension.width/2)):E=v||Math.max(y,S.width-w),e.setSize(b,{width:E,height:S.height});let M=e.getSize(b);s===2&&f===2&&M.width<x&&e.setAuxiliaryBarMaximized(!0)}},YR=class a extends l5t{static{this.ID="agentSessions.showAgentSessionsSidebar"}static{this.TITLE=P(6811,"Show Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:C.and(Z.enabled,Z.agentSessionsViewerOrientation.isEqualTo(1)),f1:!0,category:$ne})}getOrientation(){return 2}},p$=class a extends l5t{static{this.ID="agentSessions.hideAgentSessionsSidebar"}static{this.TITLE=P(6802,"Hide Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:C.and(Z.enabled,Z.agentSessionsViewerOrientation.isEqualTo(2)),f1:!0,category:$ne})}getOrientation(){return 1}},c5t=class a extends z{static{this.ID="agentSessions.toggleAgentSessionsSidebar"}static{this.TITLE=P(6812,"Toggle Agent Sessions Sidebar")}constructor(){super({id:a.ID,title:a.TITLE,precondition:Z.enabled,f1:!0,category:$ne})}async run(i){let e=i.get(fe);i.get(Gt).getActiveViewWithId(Xr)?.getSessionsViewerOrientation()===2?await e.executeCommand(p$.ID):await e.executeCommand(YR.ID)}},qne=class a extends z{static{this.id="workbench.action.chat.focusAgentSessionsViewer"}constructor(){super({id:a.id,title:P(6781,"Focus Agent Sessions"),precondition:C.and(Z.enabled,C.equals("config.chat.viewSessions.enabled",!0)),category:$ne,f1:!0})}async run(i){let e=i.get(Gt),t=i.get(B),o=i.get(fe),n=await e.openView(Xr,!0);if(n?.focusSessions())return;t.getValue("chat.viewSessions.orientation")==="stacked"?await o.executeCommand(Mh):await o.executeCommand(YR.ID),n?.focusSessions()}};var d5t=class{constructor(){this.priority=107;this.name="panelChat";this.type="help";this.when=C.and(Z.location.isEqualTo("panel"),Z.inQuickChat.negate(),Z.chatModeKind.isEqualTo("ask"),C.or(Z.inChatSession,Z.isResponse,Z.isRequest))}getProvider(i){return IBe(i,void 0,"panelChat")}},u5t=class{constructor(){this.priority=107;this.name="quickChat";this.type="help";this.when=C.and(Z.inQuickChat,C.or(Z.inChatSession,Z.isResponse,Z.isRequest))}getProvider(i){return IBe(i,void 0,"quickChat")}},p5t=class{constructor(){this.priority=119;this.name="editsView";this.type="help";this.when=C.and(Lx.inEditingMode,Z.inChatInput)}getProvider(i){return IBe(i,void 0,"editsView")}},m5t=class{constructor(){this.priority=120;this.name="agentView";this.type="help";this.when=C.and(Z.chatModeKind.isEqualTo("agent"),Z.inChatInput)}getProvider(i){return IBe(i,void 0,"agentView")}};function Mfn(a,i){let e=[];return(a==="panelChat"||a==="quickChat"||a==="agentView")&&(a==="quickChat"?(e.push(d(6329,null)),e.push(d(6321,null))):(e.push(d(6320,null)),e.push(d(6371,null,"<keybinding:workbench.action.chat.newChat>")),e.push(d(6370,null,"<keybinding:workbench.action.chat.history>")),e.push(d(6367,null,`<keybinding:${qne.id}>`)),e.push(d(6377,null,"<keybinding:workbench.action.openAgentsWindow>"))),e.push(d(6332,null)),e.push(d(6319,null)),e.push(d(6326,null,"<keybinding:editor.action.accessibleView>")),e.push(d(6327,null)),e.push(d(6366,null,gFi(i,a,"last"))),e.push(d(6369,null,gFi(i,a,"lastFocused"))),e.push(d(6368,null,gFi(i,a,"input"))),e.push(d(6331,null)),e.push(d(6318,null)),e.push(d(6372,null,"<keybinding:workbench.action.chat.nextCodeBlock>")),e.push(d(6373,null,"<keybinding:workbench.action.chat.nextUserPrompt>")),e.push(d(6374,null,"<keybinding:workbench.action.chat.previousUserPrompt>")),e.push(d(6364,null,"<keybinding:workbench.action.chat.focusConfirmation>")),e.push(d(6333,null,"<keybinding:workbench.action.terminal.chat.viewHiddenChatTerminals>")),e.push(d(6322,null,`<keybinding:${aw.FocusMostRecentChatTerminal}>`)),e.push(d(6323,null,`<keybinding:${aw.FocusMostRecentChatTerminalOutput}>`)),e.push(d(6324,null,"<keybinding:workbench.action.chat.focusQuestionCarousel>")),e.push(d(6330,null,"<keybinding:workbench.action.chat.previousQuestion>")),e.push(d(6328,null,"<keybinding:workbench.action.chat.nextQuestion>")),e.push(d(6325,null,"<keybinding:workbench.action.chat.focusTip>"))),a==="editsView"||a==="agentView"?(a==="agentView"?e.push(d(6339,null)):e.push(d(6350,null)),e.push(d(6347,null)),e.push(d(6346,null)),e.push(d(6352,null)),e.push(d(6354,null,"<keybinding:chatEditor.action.navigatePrevious>","<keybinding:chatEditor.action.navigateNext>")),e.push(d(6344,null,"<keybinding:chatEditor.action.acceptHunk>","<keybinding:chatEditor.action.undoHunk>","<keybinding:chatEditor.action.toggleDiff>")),e.push(d(6355,null)),a==="agentView"&&(e.push(d(6341,null)),e.push(d(6340,null,"<keybinding:workbench.action.chat.acceptTool>")),e.push(d(6336,null,"chat.tools.global.autoApprove","true")),e.push(d(6335,null,"<keybinding:workbench.action.chat.acceptTool>")),e.push(d(6338,null)),e.push(d(6337,null,"<keybinding:workbench.action.chat.focusTodosView>"))),e.push(d(6348,null)),e.push(d(6376,null,"<keybinding:workbench.action.chat.undoEdits>")),e.push(d(6375,null,"<keybinding:workbench.action.chat.restoreLastCheckpoint>")),e.push(d(6365,null,"<keybinding:workbench.action.chat.editing.attachFiles>")),e.push(d(6351,null,"<keybinding:chatEditing.removeFileFromWorkingSet>")),e.push(d(6343,null,"<keybinding:chatEditing.acceptFile>","<keybinding:chatEditing.discardFile>")),e.push(d(6353,null,"<keybinding:chatEditing.saveAllFiles>")),e.push(d(6342,null,"<keybinding:chatEditing.acceptAllFiles>")),e.push(d(6345,null,"<keybinding:chatEditing.discardAllFiles>")),e.push(d(6349,null,"<keybinding:chatEditing.openFileInDiff>")),e.push(`- ${kfe.LABEL}<keybinding:chatEditing.viewChanges>`),e.push(`- ${Efe.Label}<keybinding:chatEditing.viewPreviousEdits>`)):(e.push(d(6361,null)),e.push(d(6356,null,"<keybinding:inlineChat.start>")),e.push(d(6362,null,"<keybinding:history.showPrevious>","<keybinding:history.showNext>")),e.push(d(6360,null,"<keybinding:editor.action.accessibleView>")),e.push(d(6357,null)),e.push(d(6359,null)),e.push(d(6358,null,WK.id)),e.push(d(6363,null))),e.push(d(6334,null)),e.join(`
`)}function IBe(a,i,e){let t=a.get(Lt),o=a.get(Le),n=t.lastFocusedWidget?.inputEditor;if(!n||!(n.getDomNode()??void 0))return;let s=n.getPosition();n.getSupportedActions();let l=Mfn(e,o);return new qp(e==="panelChat"?"panelChat":e==="inlineChat"?"inlineChat":e==="agentView"?"agentChat":"quickChat",{type:"help"},()=>l,()=>{e==="quickChat"||e==="editsView"||e==="agentView"||e==="panelChat"?(s&&n.setPosition(s),n.focus()):e==="inlineChat"&&i?.getContribution(tFe)?.focus()},e==="inlineChat"?"accessibility.verbosity.inlineChat":"accessibility.verbosity.panelChat")}function gFi(a,i,e){let t,o=" (unassigned keybinding)";if(e==="input"?t=a.lookupKeybindings("workbench.action.chat.focusInput"):e==="lastFocused"?t=a.lookupKeybindings("workbench.chat.action.focusLastFocused"):t=a.lookupKeybindings("chat.action.focus"),!t?.length)return o;let n;return i==="agentView"||i==="panelChat"?e!=="input"?n=t.find(r=>r.getAriaLabel()?.includes("UpArrow"))?.getAriaLabel():n=t.find(r=>r.getAriaLabel()?.includes("DownArrow"))?.getAriaLabel():e!=="input"?n=t.find(r=>r.getAriaLabel()?.includes("DownArrow"))?.getAriaLabel():n=t.find(r=>r.getAriaLabel()?.includes("UpArrow"))?.getAriaLabel(),n?` (${n})`:o}async function h5t(a,i,e,t,o){if(!i.hasModel())return!1;let n=a.get(si),r=i.getModel().uri,s=n.startNewLocalSession("editor"),l=s.object;l.startEditingSession(!0);let c=new O;c.add(s);let u=l?.addRequest({text:"",parts:[]},{variables:[]},0,{kind:void 0,modeId:"applyCodeBlock",modeInstructions:void 0,isBuiltin:!0,applyCodeBlockSuggestionId:o});To(u.response),u.response.updateContent({kind:"textEdit",uri:r,edits:[],done:!1});for await(let g of e){if(t.isCancellationRequested){u.response.cancel();break}u.response.updateContent({kind:"textEdit",uri:r,edits:g,done:!1})}u.response.updateContent({kind:"textEdit",uri:r,edits:[],done:!0}),t.isCancellationRequested||u.response.complete();let p=ke(g=>{let f=l.editingSession?.readEntry(r,g);if(!f)return!1;let v=f.state.read(g);return v===1||v===2}),h=yh(p,Boolean);return await Ea(h,t),c.dispose(),!0}async function g_o(a,i,e,t){let o=a.get(si),r=a.get(kn).hasSupportedNotebooks(i),s=o.startNewLocalSession("editor"),l=s.object;l.startEditingSession(!0);let c=new O;c.add(s);let u=l?.addRequest({text:"",parts:[]},{variables:[]},0);To(u.response),r?u.response.updateContent({kind:"notebookEdit",uri:i,edits:[],done:!1}):u.response.updateContent({kind:"textEdit",uri:i,edits:[],done:!1});for await(let g of e){if(t.isCancellationRequested){u.response.cancel();break}g.every(Pfn)?u.response.updateContent({kind:"notebookEdit",uri:i,edits:g,done:!1}):u.response.updateContent({kind:"textEdit",uri:g[0],edits:g[1],done:!1})}r?u.response.updateContent({kind:"notebookEdit",uri:i,edits:[],done:!0}):u.response.updateContent({kind:"textEdit",uri:i,edits:[],done:!0}),t.isCancellationRequested||u.response.complete();let p=ke(g=>{let f=l.editingSession?.readEntry(i,g);if(!f)return!1;let v=f.state.read(g);return v===1||v===2}),h=yh(p,Boolean);return await Ea(h,t),c.dispose(),!0}function Pfn(a){return!(A.isUri(a)||Array.isArray(a))}var b_o="workbench.action.chat.copyItem",Afn=1200,f_o=q.asClassNameArray(L.copy),v_o=q.asClassNameArray(L.check),glt=class extends Cl{constructor(){super(...arguments);this.copiedStateReset=this._register(new ue);this.actionRunnerListener=this._register(new ue);this.copied=!1}get actionRunner(){return super.actionRunner}set actionRunner(e){super.actionRunner=e,this.bindActionRunner(e)}render(e){if(super.render(e),this.bindActionRunner(super.actionRunner),!this.element||!this.label)return;this.element.classList.add("chat-copy-action"),this.clearLabelIconClasses(),this.label.style.backgroundImage="",this.label.classList.remove("icon"),this.label.textContent="",this.label.setAttribute("aria-hidden","true");let t=D(this.label,_(".chat-copy-action-icons")),o=D(t,_(".chat-copy-action-icon.chat-copy-action-icon-copy"));o.classList.add(...f_o),o.setAttribute("aria-hidden","true");let n=D(t,_(".chat-copy-action-icon.chat-copy-action-icon-copied"));n.classList.add(...v_o),n.setAttribute("aria-hidden","true"),this.renderCopiedState()}getTooltip(){return this.copied?d(6481,null):super.getTooltip()}updateAriaLabel(){this.element?.setAttribute("aria-label",this.copied?d(6482,null):d(6480,null))}updateClass(){super.updateClass(),this.clearLabelIconClasses(),this.label&&(this.label.style.backgroundImage="",this.label.classList.remove("icon"))}clearLabelIconClasses(){this.label?.classList.remove(...f_o,...v_o)}renderCopiedState(){this.element?.classList.toggle("copied",this.copied),this.updateTooltip()}bindActionRunner(e){this.actionRunnerListener.value=e.onDidRun(t=>{t.action!==this.action||t.error||(this.copied=!0,this.renderCopiedState(),this.copiedStateReset.value=Zo(()=>{this.copied=!1,this.renderCopiedState()},Afn),Er(d(6484,null)))})}},Qve=class extends k{static{this.ID="chat.copyActionRendering"}constructor(i,e){super();let t=this._register(i.register(R.ChatMessageFooter,b_o,(o,n)=>{if(o instanceof Do)return e.createInstance(glt,o,n)}));bp(t)}};Qve=I([m(0,sh),m(1,F)],Qve);function S_o(){W(class extends z{constructor(){super({id:"workbench.action.chat.copyAll",title:P(6478,"Copy All"),f1:!1,category:fi,menu:{id:R.ChatContext,when:Z.responseIsFiltered.negate(),group:"copy"}})}run(i,e){let t=i.get(Bi),o=i.get(Lt),n=(_r(e)||Ni(e))&&o.getWidgetBySessionResource(e.sessionResource)||o.lastFocusedWidget;if(n){let s=n.viewModel?.getItems().filter(l=>_r(l)||Ni(l)&&!l.errorDetails?.responseIsFiltered).map(l=>Uxi(l)).join(`

`);s&&t.writeText(s)}}}),W(class extends z{constructor(){super({id:b_o,title:P(6483,"Copy"),f1:!1,category:fi,icon:L.copy,menu:[{id:R.ChatContext,when:Z.responseIsFiltered.negate(),group:"copy"},{id:R.ChatMessageFooter,group:"navigation",order:1,when:C.and(Z.isResponse,Z.responseIsFiltered.negate())}]})}async run(i,...e){let t=i.get(Lt),o=i.get(Bi),n=t.lastFocusedWidget,r=e[0];if(!EE(r)&&(r=n?.getFocus(),!r))return;let l=zi().getSelection()?.toString();if(n&&l&&l.length>0&&ms(Un(),n.domNode)){await o.writeText(l);return}if(!_r(r)&&!Ni(r))return;let c=Uxi(r,!1);await o.writeText(c)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.copyFinalResponse",title:P(6479,"Copy Final Response"),f1:!1,category:fi,menu:{id:R.ChatContext,when:C.and(Z.isResponse,Z.responseIsFiltered.negate()),group:"copy"}})}async run(i,...e){let t=i.get(Lt),o=i.get(Bi),n=t.lastFocusedWidget,r=e[0];if(!EE(r)&&(r=n?.getFocus(),!r)||!Ni(r))return;let s=r.response.getFinalResponse();s&&await o.writeText(s)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.copyKatexMathSource",title:P(6477,"Copy Math Source"),f1:!1,category:fi,menu:{id:R.ChatContext,group:"copy",when:Z.isKatexMathElement}})}async run(i,...e){let t=i.get(Lt),o=i.get(Bi),n=t.lastFocusedWidget,r=e[0];if(!EE(r)&&(r=n?.getFocus(),!r))return;let s=null,l=Un(),c=zi().getSelection();n&&c&&c.rangeCount>0&&ms(l,n.domNode)&&(s=c.getRangeAt(0).commonAncestorContainer,s.nodeType===Node.TEXT_NODE&&(s=s.parentElement)),s||(s=l?.querySelector(`.${YLe}`)??null);let p=(go(s)?s.closest(`.${YLe}`):null)?.getAttribute(Cet)||"";p&&await o.writeText(p)}})}var yBe=class{constructor(i,e,t,o,n,r,s,l){this.editorService=i;this.textFileService=e;this.bulkEditService=t;this.codeEditorService=o;this.chatService=n;this.languageService=r;this.dialogService=s;this.aiEditTelemetryService=l}async run(i){let e=w_o(this.editorService);if(e)await this.handleTextEditor(e,i);else{let t=fFi(this.editorService);t?await this.handleNotebookEditor(t,i):this.notify(d(6647,null))}if(Ni(i.element)){let t=i.element.requestId,o=i.element.session.getItems().find(r=>r.id===t&&_r(r));y_o(this.chatService,i,{kind:"insert",codeBlockIndex:i.codeBlockIndex,totalCharacters:i.code.length,totalLines:i.code.split(`
`).length,languageId:i.languageId,modelId:o?.modelId??""});let n=i.element.model.codeBlockInfos?.at(i.codeBlockIndex);this.aiEditTelemetryService.handleCodeAccepted({acceptanceMethod:"insertAtCursor",suggestionId:n?.suggestionId,editDeltaInfo:Uy.fromText(i.code),feature:"sideBarChat",languageId:i.languageId,modeId:i.element.model.request?.modeInfo?.modeId,modelId:o?.modelId,presentation:"codeBlock",applyCodeBlockSuggestionId:void 0,source:void 0,sourceRequestId:void 0})}}async handleNotebookEditor(i,e){if(i.isReadOnly)return this.notify(d(6649,null)),!1;let t=i.getFocus(),o=Math.max(t.end-1,0);return YU(this.languageService,i,o,2,"below",e.code,!0),!0}async handleTextEditor(i,e){let t=i.getModel();if(C_o(t,this.textFileService))return this.notify(d(6648,null)),!1;let o=i.getSelection()??new G(t.getLineCount(),1,t.getLineCount(),1),n=Nfn(e.code,t,o.startLineNumber),r=[new hl(t.uri,{range:o,text:n})];return await this.bulkEditService.apply(r),this.codeEditorService.listCodeEditors().find(s=>ze(s.getModel()?.uri,t.uri))?.focus(),!0}notify(i){this.dialogService.info(i)}};yBe=I([m(0,ie),m(1,Uo),m(2,Ka),m(3,Qt),m(4,si),m(5,Rt),m(6,ct),m(7,XS)],yBe);var wBe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.editorService=i;this.textFileService=e;this.chatService=t;this.fileService=o;this.dialogService=n;this.logService=r;this.codeMapperService=s;this.progressService=l;this.quickInputService=c;this.labelService=u;this.instantiationService=p;this.notebookService=h}async run(i){let e=w_o(this.editorService),t=await this.evaluateURIToUse(i.codemapperUri,e);if(!t)return;if(t&&!ze(e?.getModel().uri,t)&&!this.notebookService.hasSupportedNotebooks(t))try{let r=await this.editorService.openEditor({resource:t}),s=da(r?.getControl());if(s&&s.hasModel())this.tryToRevealCodeBlock(s,i.code),e=s;else{this.notify(d(6639,null,t.toString()));return}}catch(r){this.logService.info("[ApplyCodeBlockOperation] error opening code mapper file",t,r);return}let o;if(Ni(i.element)){let r=i.element.model.codeBlockInfos?.at(i.codeBlockIndex);r&&(o=r.suggestionId)}let n;if(e&&!this.notebookService.hasSupportedNotebooks(t))n=await this.handleTextEditor(e,i.chatSessionResource,i.code,o);else{let r=fFi(this.editorService);r?n=await this.handleNotebookEditor(r,i.chatSessionResource,i.code):this.notify(d(6641,null))}if(Ni(i.element)){let r=i.element.requestId,s=i.element.session.getItems().find(l=>l.id===r&&_r(l));y_o(this.chatService,i,{kind:"apply",codeBlockIndex:i.codeBlockIndex,totalCharacters:i.code.length,codeMapper:n?.codeMapper,editsProposed:!!n?.editsProposed,totalLines:i.code.split(`
`).length,modelId:s?.modelId??"",languageId:i.languageId})}}async evaluateURIToUse(i,e){if(i&&await this.fileService.exists(i))return i;let t=e?.getModel().uri?{label:d(6637,null,this.labelService.getUriLabel(e.getModel().uri,{relative:!0})),id:"activeEditor"}:void 0,o={label:d(6650,null),id:"newUntitledFile"},n=[];i?(n.push({label:d(6646,null,this.labelService.getUriLabel(i,{relative:!0})),id:"createFile"}),n.push(o),t&&n.push(t)):(t&&n.push(t),n.push(o));let r=n.length>1?await this.quickInputService.pick(n,{placeHolder:d(6651,null)}):n[0];if(r)switch(r.id){case"createFile":if(i)try{await this.fileService.writeFile(i,Ke.fromString(""))}catch(s){return this.notify(d(6640,null,s.message)),A.from({scheme:"untitled",path:i.path})}return i;case"newUntitledFile":return A.from({scheme:"untitled",path:i?i.path:"Untitled-1"});case"activeEditor":return e?.getModel().uri}}async handleNotebookEditor(i,e,t){if(i.isReadOnly){this.notify(d(6645,null));return}let o=i.textModel.uri,n={code:t,resource:o,markdownBeforeBlock:void 0},r=this.codeMapperService.providers[0]?.displayName;if(!r){this.notify(d(6642,null));return}let s=!1,l=new qe;try{let c=await this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async u=>{u.report({message:d(6643,null,r)});let p=this.getNotebookEdits(n,e,l.token);return await this.waitForFirstElement(p)},()=>l.cancel());s=await this.applyNotebookEditsWithInlinePreview(c,o,l)}catch(c){Yi(c)||this.notify(d(6638,null,c.message))}finally{l.dispose()}return{editsProposed:s,codeMapper:r}}async handleTextEditor(i,e,t,o){let n=i.getModel();if(C_o(n,this.textFileService)){this.notify(d(6644,null));return}let r={code:t,resource:n.uri,chatSessionResource:e,markdownBeforeBlock:void 0},s=this.codeMapperService.providers[0]?.displayName;if(!s){this.notify(d(6642,null));return}let l=!1,c=new qe;try{let u=await this.progressService.withProgress({location:15,delay:500,sticky:!0,cancellable:!0},async p=>{p.report({message:d(6643,null,s)});let h=this.getTextEdits(r,e,c.token);return await this.waitForFirstElement(h)},()=>c.cancel());l=await this.applyWithInlinePreview(u,i,c,o)}catch(u){Yi(u)||this.notify(d(6638,null,u.message))}finally{c.dispose()}return{editsProposed:l,codeMapper:s}}getTextEdits(i,e,t){return new Fp(async o=>{let n={codeBlocks:[i],chatSessionResource:e},r={textEdit:(l,c)=>{o.emitOne(c)},notebookEdit(l,c){}},s=await this.codeMapperService.mapCode(n,r,t);s?.errorMessage&&o.reject(new Error(s.errorMessage))})}getNotebookEdits(i,e,t){return new Fp(async o=>{let n={codeBlocks:[i],chatSessionResource:e,location:"panel"},r={textEdit:(l,c)=>{o.emitOne([l,c])},notebookEdit(l,c){o.emitOne(c)}},s=await this.codeMapperService.mapCode(n,r,t);s?.errorMessage&&o.reject(new Error(s.errorMessage))})}async waitForFirstElement(i){let e=i[Symbol.asyncIterator](),t=await e.next();return t.done?{async*[Symbol.asyncIterator](){}}:{async*[Symbol.asyncIterator](){for(;!t.done;)yield t.value,t=await e.next()}}}async applyWithInlinePreview(i,e,t,o){return this.instantiationService.invokeFunction(h5t,e,i,t.token,o)}async applyNotebookEditsWithInlinePreview(i,e,t){return this.instantiationService.invokeFunction(g_o,e,i,t.token)}tryToRevealCodeBlock(i,e){let t=e.match(/(\S[^\n]*)\n/);if(t&&t[1].length>10){let o=i.getModel().findNextMatch(t[1],{lineNumber:1,column:1},!1,!1,null,!1);o&&i.revealRangeInCenter(o.range)}}notify(i){this.dialogService.info(i)}};wBe=I([m(0,ie),m(1,Uo),m(2,si),m(3,ge),m(4,ct),m(5,re),m(6,BZ),m(7,Go),m(8,$e),m(9,nt),m(10,F),m(11,kn)],wBe);function y_o(a,i,e){Ni(i.element)&&a.notifyUserAction({agentId:i.element.agent?.id,command:i.element.slashCommand?.name,sessionResource:i.element.sessionResource,requestId:i.element.requestId,result:i.element.result,action:e})}function fFi(a){let i=a.activeEditorPane;if(i?.getId()===_M){let e=i.getControl();if(e.hasModel())return e}}function w_o(a){let i=fFi(a)?.activeCodeEditor;if(i&&i.hasTextFocus()&&i.hasModel())return i;let e=da(a.activeTextEditorControl);if(!e){for(let t of a.visibleTextEditorControls)if(e=da(t),e)break}if(!(!e||!e.hasModel()))return e}function C_o(a,i){return!!(i.files.get(a.uri)??i.untitled.get(a.uri))?.isReadonly()}function Nfn(a,i,e){let t=Hc(a);if(t.length===0)return a;let o=i.getFormattingOptions(),n=I_o(i.getLineContent(e),o.tabSize).level,r=t.map(c=>I_o(c,o.tabSize)),s=r.reduce((c,u,p)=>u.length!==t[p].length?Math.min(u.level,c):c,Number.MAX_VALUE);if(s===Number.MAX_VALUE||s===n)return a;let l=[];for(let c=0;c<t.length;c++){let{level:u,length:p}=r[c],h=Math.max(0,n+u-s),g=o.insertSpaces?" ".repeat(o.tabSize*h):"	".repeat(h);l.push(g+t[c].substring(p))}return l.join(`
`)}function I_o(a,i){let e=0,t=0,o=0,n=0,r=a.length;for(;o<r;){let s=a.charCodeAt(o);if(s===32)e++,e===i&&(t++,e=0,n=o+1);else if(s===9)t++,e=0,n=o+1;else break;o++}return{level:t,length:n}}var g5t=["fish","ps1","pwsh","powershell","sh","shellscript","zsh"];function f5t(a){return typeof a=="object"&&a!==null&&"code"in a&&"element"in a}function Ofn(a){return typeof a=="object"&&a!==null&&"element"in a&&"diffEditor"in a&&"toggleDiffViewMode"in a}function vFi(a){return Ni(a.element)&&a.element.errorDetails?.responseIsFiltered}var CBe=class extends z{run(i,...e){let t=e[0];if(!f5t(t)){let o=i.get(Qt),n=o.getFocusedCodeEditor()||o.getActiveCodeEditor();if(!n||(t=E_o(n,i),!f5t(t)))return}return this.runWithContext(i,t)}},x_o="workbench.action.chat.applyInEditor",Yve=class extends k{static{this.ID="chat.codeBlockActionRendering"}constructor(i,e,t){super();let o=this._register(i.register(R.ChatCodeBlock,"workbench.action.chat.copyCodeBlock",(r,s)=>{if(r instanceof Do)return e.createInstance(glt,r,s)})),n=i.register(R.ChatCodeBlock,x_o,(r,s)=>{if(r instanceof Do)return e.createInstance(class extends Cl{getTooltip(){let l=this._context;if(f5t(l)&&l.codemapperUri){let c=t.getUriLabel(l.codemapperUri,{relative:!0});return d(6442,null,c)}return super.getTooltip()}setActionContext(l){super.setActionContext(l),this.updateTooltip()}},r,void 0)});bp(o),bp(n)}};Yve=I([m(0,sh),m(1,F),m(2,nt)],Yve);function k_o(){W(class extends z{constructor(){super({id:"workbench.action.chat.copyCodeBlock",title:P(6447,"Copy"),f1:!1,category:fi,icon:L.copy,menu:{id:R.ChatCodeBlock,group:"navigation",order:30}})}run(e,...t){let o=t[0];if(!f5t(o)||vFi(o))return;let n=e.get(Bi),r=e.get(XS);if(n.writeText(o.code),Ni(o.element)){let s=e.get(si),l=o.element.requestId,c=o.element.session.getItems().find(p=>p.id===l&&_r(p));s.notifyUserAction({agentId:o.element.agent?.id,command:o.element.slashCommand?.name,sessionResource:o.element.sessionResource,requestId:o.element.requestId,result:o.element.result,action:{kind:"copy",codeBlockIndex:o.codeBlockIndex,copyKind:2,copiedCharacters:o.code.length,totalCharacters:o.code.length,copiedText:o.code,copiedLines:o.code.split(`
`).length,languageId:o.languageId,totalLines:o.code.split(`
`).length,modelId:c?.modelId??""}});let u=o.element.model.codeBlockInfos?.at(o.codeBlockIndex);r.handleCodeAccepted({acceptanceMethod:"copyButton",suggestionId:u?.suggestionId,editDeltaInfo:Uy.fromText(o.code),feature:"sideBarChat",languageId:o.languageId,modeId:o.element.model.request?.modeInfo?.modeId,modelId:c?.modelId,presentation:"codeBlock",applyCodeBlockSuggestionId:void 0,source:void 0,sourceRequestId:void 0})}}}),WA?.addImplementation(5e4,"chat-codeblock",i=>{let e=i.get(Qt).getFocusedCodeEditor();if(!e)return!1;let t=e.getModel();if(!t)return!1;let o=E_o(e,i);if(!o)return!1;let n=e.getSelections()?.length===1&&e.getSelection()?.isEmpty(),r=n?t.getValue():e.getSelections()?.reduce((p,h)=>p+t.getValueInRange(h),"")??"",s=t.getValueLength(),l=i.get(si),c=i.get(XS),u=o.element;if(Ni(u)){let p=u.requestId,h=u.session.getItems().find(f=>f.id===p&&_r(f));l.notifyUserAction({agentId:u.agent?.id,command:u.slashCommand?.name,sessionResource:u.sessionResource,requestId:u.requestId,result:u.result,action:{kind:"copy",codeBlockIndex:o.codeBlockIndex,copyKind:1,copiedText:r,copiedCharacters:r.length,totalCharacters:s,languageId:o.languageId,totalLines:o.code.split(`
`).length,copiedLines:r.split(`
`).length,modelId:h?.modelId??""}});let g=u.model.codeBlockInfos?.at(o.codeBlockIndex);c.handleCodeAccepted({acceptanceMethod:"copyManual",suggestionId:g?.suggestionId,editDeltaInfo:Uy.fromText(r),feature:"sideBarChat",languageId:o.languageId,modeId:u.model.request?.modeInfo?.modeId,modelId:h?.modelId,presentation:"codeBlock",applyCodeBlockSuggestionId:void 0,source:void 0,sourceRequestId:void 0})}return n?(i.get(Bi).writeText(o.code),!0):!1}),W(class extends CBe{constructor(){super({id:x_o,title:P(6441,"Apply in Editor"),precondition:Z.enabled,f1:!1,category:fi,icon:L.gitPullRequestGoToChanges,menu:[{id:R.ChatCodeBlock,group:"navigation",when:C.and(...g5t.map(e=>C.notEquals(me.languageId.key,e))),order:10},{id:R.ChatCodeBlock,when:C.or(...g5t.map(e=>C.equals(me.languageId.key,e)))}],keybinding:{when:C.or(C.and(Z.inChatSession,Z.inChatInput.negate()),fLe),primary:2051,mac:{primary:259},weight:401}})}runWithContext(e,t){return this.operation||(this.operation=e.get(F).createInstance(wBe)),this.operation.run(t)}}),W(class extends CBe{constructor(){super({id:"workbench.action.chat.insertCodeBlock",title:P(6448,"Insert At Cursor"),precondition:Z.enabled,f1:!0,category:fi,icon:L.insert,menu:[{id:R.ChatCodeBlock,group:"navigation",when:C.and(Z.inChatSession,Z.location.notEqualsTo("terminal")),order:20},{id:R.ChatCodeBlock,group:"navigation",when:C.and(Z.inChatSession,Z.location.isEqualTo("terminal")),isHiddenByDefault:!0,order:20}],keybinding:{when:C.or(C.and(Z.inChatSession,Z.inChatInput.negate()),fLe),primary:2051,mac:{primary:259},weight:401}})}runWithContext(e,t){return e.get(F).createInstance(yBe).run(t)}}),W(class extends CBe{constructor(){super({id:"workbench.action.chat.insertIntoNewFile",title:P(6449,"Insert into New File"),precondition:Z.enabled,f1:!0,category:fi,icon:L.newFile,menu:{id:R.ChatCodeBlock,group:"navigation",isHiddenByDefault:!0,order:40}})}async runWithContext(e,t){if(vFi(t))return;let o=e.get(ie),n=e.get(si),r=e.get(XS);if(o.openEditor({contents:t.code,languageId:t.languageId,resource:void 0}),Ni(t.element)){let s=t.element.requestId,l=t.element.session.getItems().find(u=>u.id===s&&_r(u));n.notifyUserAction({agentId:t.element.agent?.id,command:t.element.slashCommand?.name,sessionResource:t.element.sessionResource,requestId:t.element.requestId,result:t.element.result,action:{kind:"insert",codeBlockIndex:t.codeBlockIndex,totalCharacters:t.code.length,newFile:!0,totalLines:t.code.split(`
`).length,languageId:t.languageId,modelId:l?.modelId??""}});let c=t.element.model.codeBlockInfos?.at(t.codeBlockIndex);r.handleCodeAccepted({acceptanceMethod:"insertInNewFile",suggestionId:c?.suggestionId,editDeltaInfo:Uy.fromText(t.code),feature:"sideBarChat",languageId:t.languageId,modeId:t.element.model.request?.modeInfo?.modeId,modelId:l?.modelId,presentation:"codeBlock",applyCodeBlockSuggestionId:void 0,source:void 0,sourceRequestId:void 0})}}}),W(class extends CBe{constructor(){super({id:"workbench.action.chat.runInTerminal",title:P(6452,"Insert into Terminal"),precondition:Z.enabled,f1:!0,category:fi,icon:L.terminal,menu:[{id:R.ChatCodeBlock,group:"navigation",when:C.and(Z.inChatSession,C.or(...g5t.map(e=>C.equals(me.languageId.key,e))))},{id:R.ChatCodeBlock,group:"navigation",isHiddenByDefault:!0,when:C.and(Z.inChatSession,...g5t.map(e=>C.notEquals(me.languageId.key,e)))}],keybinding:[{primary:2563,mac:{primary:771},weight:100,when:C.or(Z.inChatSession,fLe)}]})}async runWithContext(e,t){if(vFi(t))return;let o=e.get(si),n=e.get(an),r=e.get(ie),s=e.get(hb),l=e.get(Cc),c=await n.getActiveOrCreateInstance({acceptsInput:!0});if(c.xterm?.isStdinDisabled||c.shellLaunchConfig.isFeatureTerminal?c=await n.createAndFocusTerminal({location:1}):await n.focusInstance(c),c.target===2){let u=r.findEditors(c.resource);s.openEditor(c,{viewColumn:u?.[0].groupId})}else await l.showPanel(!0);c.runCommand(t.code,!1),Ni(t.element)&&o.notifyUserAction({agentId:t.element.agent?.id,command:t.element.slashCommand?.name,sessionResource:t.element.sessionResource,requestId:t.element.requestId,result:t.element.result,action:{kind:"runInTerminal",codeBlockIndex:t.codeBlockIndex,languageId:t.languageId}})}});function a(i,e){let t=i.get(Qt),n=i.get(Lt).lastFocusedWidget;if(!n)return;let s=t.getFocusedCodeEditor()?.getModel()?.uri,l=s?n.getCodeBlockInfoForEditor(s):void 0,c=!n.inputEditor.hasWidgetFocus()&&n.getFocus(),u=Ni(c)?c:void 0,p=l?.elementId,g=(p?n.viewModel?.getItems().find(b=>b.id===p):void 0)??u??n.viewModel?.getItems().reverse().find(b=>Ni(b));if(!g||!Ni(g))return;n.reveal(g);let f=n.getCodeBlockInfosForResponse(g),v=l?(l.codeBlockIndex+(e?-1:1)+f.length)%f.length:e?f.length-1:0;f[v]?.focus()}W(class extends z{constructor(){super({id:"workbench.action.chat.nextCodeBlock",title:P(6450,"Next Code Block"),keybinding:{primary:2572,mac:{primary:2572},weight:200,when:Z.inChatSession},precondition:Z.enabled,f1:!0,category:fi})}run(e,...t){a(e)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.previousCodeBlock",title:P(6451,"Previous Code Block"),keybinding:{primary:2571,mac:{primary:2571},weight:200,when:Z.inChatSession},precondition:Z.enabled,f1:!0,category:fi})}run(e,...t){a(e,!0)}})}function E_o(a,i){let e=i.get(Lt),t=i.get(TZ),o=a.getModel();if(!o)return;let n=e.lastFocusedWidget,r=n?.getCodeBlockInfoForEditor(o.uri);if(!r){for(let l of t.providers){let c=l.getCodeBlockContext(a);if(c)return c}return}return{element:n?.viewModel?.getItems().find(l=>l.id===r.elementId),codeBlockIndex:r.codeBlockIndex,code:a.getValue(),languageId:a.getModel().getLanguageId(),codemapperUri:r.codemapperUri,chatSessionResource:r.chatSessionResource}}function T_o(){class a extends z{run(e,...t){let o=t[0];if(Ofn(o))return this.runWithContext(e,o)}}W(class extends a{constructor(){super({id:"workbench.action.chat.applyCompareEdits",title:P(6443,"Apply Edits"),f1:!1,category:fi,icon:L.gitPullRequestGoToChanges,precondition:C.and(me.hasChanges,Z.editApplied.negate(),me.readOnly.negate()),menu:{id:R.ChatCompareBlock,group:"navigation",order:10,when:me.readOnly.negate()}})}async runWithContext(e,t){let o=e.get(F),n=e.get(Qt),r=t.edit,s=t.element;if(r.state?.applied||!s.response.value.includes(r))return!1;let l=r.edits[0]?.[0];if(!l)return!1;let c=Fp.fromArray(r.edits),u=await n.openCodeEditor({resource:r.uri},null);return u?(u.revealLineInCenterIfOutsideViewport(l.range.startLineNumber),o.invokeFunction(h5t,u,c,Ie.None,void 0),s.setEditApplied(r,1),!0):!1}}),W(class extends a{constructor(){super({id:"workbench.action.chat.discardCompareEdits",title:P(6444,"Discard Edits"),f1:!1,category:fi,icon:L.trash,precondition:C.and(me.hasChanges,Z.editApplied.negate(),me.readOnly.negate()),menu:{id:R.ChatCompareBlock,group:"navigation",order:11,when:me.readOnly.negate()}})}async runWithContext(e,t){e.get(F).createInstance($Fe).discard(t.element,t.edit)}}),W(class extends a{constructor(){super({id:"workbench.action.chat.toggleCompareBlockDiffViewMode",title:P(6446,"Toggle Inline/Side-by-Side Diff"),f1:!1,category:fi,icon:L.diffSingle,toggled:{condition:me.diffEditorInlineMode,icon:L.diff},menu:{id:R.ChatCompareBlock,group:"navigation",order:1}})}runWithContext(e,t){t.toggleDiffViewMode()}}),W(class extends a{constructor(){super({id:"workbench.action.chat.openCompareBlockInDiffEditor",title:P(6445,"Open in Diff Editor"),f1:!1,category:fi,icon:L.goToFile,menu:{id:R.ChatCompareBlock,group:"navigation",order:2}})}async runWithContext(e,t){let o=e.get(ie),n=t.diffEditor.getModel();n&&await o.openEditor({original:{resource:n.original.uri},modified:{resource:n.modified.uri}})}})}async function jne(a,i,e,t,o){let n=a.get($e),r=a.get(ge),s=p=>{let h=p.trim();if(!h)return;let g=o??UPt(i);return h.endsWith(g)?h:`${h}${g}`},l=async p=>{let h=s(p);if(!h)return{content:d(8489,null),severity:wt.Warning};if(!Ez(h))return{content:d(8491,null),severity:wt.Error};let g=A.joinPath(e,h);if(await r.exists(g))return{content:d(8490,null),severity:wt.Error}},c=t?Wfn(i):Ffn(i),u=await n.input({placeHolder:c,validateInput:l,value:t});if(u)return s(u)}function Ffn(a){switch(a){case"instructions":return d(8488,null);case"prompt":return d(8492,null);case"agent":return d(8487,null);default:throw new Error("Unknown prompt type")}}function Wfn(a){switch(a){case"instructions":return d(8494,null);case"prompt":return d(8495,null);case"agent":return d(8493,null);default:throw new Error("Unknown prompt type")}}async function z6(a,i,e,t=!1){let o=a.get(F),n=a.get($e),r=a.get(jr),s=a.get(nt),l=a.get(Ae),c=await r.getResolvedSourceFolders(i);if(c.length===0){await o.invokeFunction(b=>Hfn(b,i));return}let u={placeHolder:e?Bfn(i,t):Vfn(i),canPickMany:!1,matchOnDescription:!0},p=e?void 0:c[0],{folders:h}=l.getWorkspace(),g=h.length>1,f=c.map(b=>{let S=b.searchRoot,y=p&&ze(S,p.searchRoot),w=bPt(b.source),x=e&&ze(S,e)?d(8508,null):void 0,E=g&&b.storage==="local"?s.getUriLabel(S,{relative:!0}):b.displayPath??s.getUriLabel(S,{relative:b.storage==="local"}),M=y?d(8511,null,E):E,N={uri:S,storage:b.storage,type:i};return{type:"item",label:M,description:w,detail:x,tooltip:s.getUriLabel(S),picked:y,folder:N}});if(g){let b=(S,y)=>y!=="local"?h.length:l.getWorkspaceFolder(S)?.index??h.length;f.sort((S,y)=>{let w=b(S.folder.uri,S.folder.storage),x=b(y.folder.uri,y.folder.storage);return w-x})}let v=await n.pick(f,u);if(v)return v.folder}function Vfn(a){switch(a){case"instructions":return d(8518,null);case"prompt":return d(8519,null);case"agent":return d(8516,null);case"skill":return d(8520,null);case"hook":return d(8517,null);default:throw new Error("Unknown prompt type")}}function Bfn(a,i){if(i)switch(a){case"instructions":return d(8510,null);case"prompt":return d(8513,null);case"agent":return d(8497,null);case"skill":return d(8515,null);case"hook":throw new Error("Hooks cannot be moved");default:throw new Error("Unknown prompt type")}switch(a){case"instructions":return d(8509,null);case"prompt":return d(8512,null);case"agent":return d(8496,null);case"skill":return d(8514,null);case"hook":throw new Error("Hooks cannot be copied");default:throw new Error("Unknown prompt type")}}async function Hfn(a,i){let e=a.get($e),t=a.get(Je),o={type:"item",label:Ufn(i),description:DZ,tooltip:DZ,value:A.parse(DZ)},n=await e.pick([o],{placeHolder:zfn(i),canPickMany:!1});n&&await t.open(n.value)}function Ufn(a){switch(a){case"prompt":return d(8504,null);case"instructions":return d(8502,null);case"agent":return d(8498,null);case"skill":return d(8506,null);case"hook":return d(8500,null);default:throw new Error("Unknown prompt type")}}function zfn(a){switch(a){case"instructions":return d(8503,null);case"prompt":return d(8505,null);case"agent":return d(8499,null);case"skill":return d(8507,null);case"hook":return d(8501,null);default:throw new Error("Unknown prompt type")}}var flt=class extends z{constructor(e,t,o){super({id:e,title:t,f1:!1,precondition:Z.enabled,category:fi,keybinding:{weight:200},menu:{id:R.CommandPalette,when:Z.enabled}});this.type=o}async run(e,t){let o=e.get(re),n=e.get(Je),r=e.get(fe),s=e.get(Ne),l=e.get(Yl),c=e.get(ie),u=e.get(ge),p=e.get(F),h,g;if(t?.targetFolder)h=t.targetFolder,g=t.targetStorage??"local";else{let x=await p.invokeFunction(z6,this.type);if(!x)return;h=x.uri,g=x.storage}let f=await p.invokeFunction(jne,this.type,h,void 0,t?.fileExtension);if(!f)return;await u.createFolder(h);let v=A.joinPath(h,f);await u.createFile(v);let b=Xb(v),S;if(t?.openFile?S=await t.openFile(v):(await n.open(v),S=da(c.activeTextEditorControl)),S&&S.hasModel()&&ze(S.getModel().uri,v)&&ss.get(S)?.apply([{range:S.getModel().getFullModelRange(),template:CFi(this.type,b,Ax(this.type,v))}]),g!=="user")return;let y=l.isResourceEnablementConfigured("prompts"),w=l.isEnabled();y===!0||w===!1||s.prompt(ft.Info,d(8486,null),[{label:d(8484,null),run:()=>{r.executeCommand(bot).catch(x=>{o.error(`Failed to run '${bot}' command: ${x}.`)})}},{label:d(8485,null),run:()=>{n.open(A.parse("https://aka.ms/vscode-settings-sync-help"))}}],{neverShowAgain:{id:"workbench.command.prompts.create.user.enable-sync-notification",scope:1}})}};function CFi(a,i,e){switch(a){case"prompt":return["---",`name: ${i??"${1:prompt-name}"}`,"description: ${2:Describe when to use this prompt}","---","","<!-- Tip: Use /create-prompt in chat to generate content with agent assistance -->","","${3:Define the prompt content here. You can include instructions, examples, and any other relevant information to guide the AI's responses.}"].join(`
`);case"instructions":return e==="claude"?["---","description: ${1:Describe when these instructions should be loaded}","paths:",'. - "src/**/*.ts"',"---","","<!-- Tip: Use /create-instructions in chat to generate content with agent assistance -->","","${2:Provide coding guidelines that AI should follow when generating code, answering questions, or reviewing changes.}"].join(`
`):["---","description: ${1:Describe when these instructions should be loaded by the agent based on task context}","# applyTo: '${1|**,**/*.ts|}' # when provided, instructions will automatically be added to the request context when the pattern matches an attached file","---","","<!-- Tip: Use /create-instructions in chat to generate content with agent assistance -->","","${2:Provide project context and coding guidelines that AI should follow when generating code, answering questions, or reviewing changes.}"].join(`
`);case"agent":return e==="claude"?["---",`name: ${i??"${1:agent-name}"}`,"description: ${2:Describe what this custom agent does and when to use it.}","tools: Read, Grep, Glob, Bash # specify the tools this agent can use. If not set, all enabled tools are allowed.","---","","<!-- Tip: Use /create-agent in chat to generate content with agent assistance -->","","${4:Define what this custom agent does, including its behavior, capabilities, and any specific instructions for its operation.}"].join(`
`):["---",`name: ${i??"${1:agent-name}"}`,"description: ${2:Describe what this custom agent does and when to use it.}",'argument-hint: ${3:The inputs this agent expects, e.g., "a task to implement" or "a question to answer".}',"# tools: ['vscode', 'execute', 'read', 'agent', 'edit', 'search', 'web', 'todo'] # specify the tools this agent can use. If not set, all enabled tools are allowed.","---","","<!-- Tip: Use /create-agent in chat to generate content with agent assistance -->","","${4:Define what this custom agent does, including its behavior, capabilities, and any specific instructions for its operation.}"].join(`
`);case"skill":return["---",`name: ${i??"${1:skill-name}"}`,"description: ${2:Describe what this skill does and when to use it. Include keywords that help agents identify relevant tasks.}","---","","<!-- Tip: Use /create-skill in chat to generate content with agent assistance -->","","${3:Define the functionality provided by this skill, including detailed instructions and examples}"].join(`
`);default:throw new Error(`Unsupported prompt type: ${a}`)}}var vlt="workbench.command.new.prompt",blt="workbench.command.new.instructions",Slt="workbench.command.new.agent",Ilt="workbench.command.new.skill",bFi=class extends flt{constructor(){super(vlt,d(8474,null),"prompt")}},SFi=class extends flt{constructor(){super(blt,d(8473,null),"instructions")}},IFi=class extends flt{constructor(){super(Slt,d(8472,null),"agent")}},yFi=class extends z{constructor(){super({id:Ilt,title:d(8475,null),f1:!1,precondition:Z.enabled,category:fi,keybinding:{weight:200},menu:{id:R.CommandPalette,when:Z.enabled}})}async run(i,e){let t=i.get(Je),o=i.get(ie),n=i.get(ge),r=i.get(F),s=i.get($e),l;if(e?.targetFolder)l=e.targetFolder;else{let f=await r.invokeFunction(z6,"skill");if(!f)return;l=f.uri}let c=await s.input({prompt:d(8480,null),placeHolder:d(8479,null),validateInput:async f=>{if(!f||!f.trim())return d(8481,null);let v=f.trim();if(v.length>64)return d(8482,null);if(!OPt.test(v))return d(8478,null);if(v.startsWith("-")||v.endsWith("-"))return d(8477,null);if(v.includes("--"))return d(8476,null)}});if(!c)return;let u=c.trim(),p=A.joinPath(l,u);await n.createFolder(p);let h=A.joinPath(p,LH);await n.createFile(h);let g;e?.openFile?g=await e.openFile(h):(await t.open(h),g=da(o.activeTextEditorControl)),g&&g.hasModel()&&ze(g.getModel().uri,h)&&ss.get(g)?.apply([{range:g.getModel().getFullModelRange(),template:CFi("skill",u,"undefined")}])}},wFi=class extends z{constructor(){super({id:"workbench.command.new.untitled.prompt",title:P(8483,"New Untitled Prompt File"),f1:!0,precondition:Z.enabled,category:fi,keybinding:{weight:200}})}async run(i){let e=i.get(ie),t=Sao("prompt"),o=await e.openEditor({resource:void 0,languageId:t,options:{pinned:!0}}),n="prompt",r=da(e.activeTextEditorControl);return r&&r.hasModel()&&ss.get(r)?.apply([{range:r.getModel().getFullModelRange(),template:CFi(n,void 0,"undefined")}]),o}};function __o(){W(bFi),W(SFi),W(IFi),W(yFi),W(wFi)}function K6(a){let i=q.asClassName(L.question);switch(a){case"prompt":return{tooltip:d(8536,null),helpURI:A.parse(DZ),iconClass:i};case"instructions":return{tooltip:d(8535,null),helpURI:A.parse(hPt),iconClass:i};case"agent":return{tooltip:d(8533,null),helpURI:A.parse(AYe),iconClass:i};case"skill":return{tooltip:d(8537,null),helpURI:A.parse(gPt),iconClass:i};case"hook":return{tooltip:d(8534,null),helpURI:A.parse(fPt),iconClass:i}}}function Kfn(a){return a.helpURI!==void 0}function D_o(a){return a.type==="item"&&!!a.promptFileUri}function Gfn(a){return a.storage==="extension"&&!!a.extension}var qfn={type:"item",label:`$(plus) ${d(8528,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("prompt")],commandId:vlt},$fn={type:"item",label:`$(plus) ${d(8527,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("instructions")],commandId:blt},jfn={type:"item",label:`$(sparkle) ${d(8521,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("instructions")],commandId:RG},Qfn={type:"item",label:`$(sparkle) ${d(8523,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("instructions")],commandId:Det},Yfn={type:"item",label:`$(plus) ${d(8526,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("agent")],commandId:Slt},Xfn={type:"item",label:`$(plus) ${d(8529,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("skill")],commandId:Ilt},Jfn={type:"item",label:`$(sparkle) ${d(8524,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("prompt")],commandId:T8},Zfn={type:"item",label:`$(sparkle) ${d(8525,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("skill")],commandId:_8},evn={type:"item",label:`$(sparkle) ${d(8522,null)}`,pickable:!1,alwaysShow:!0,buttons:[K6("agent")],commandId:D8},xFi={tooltip:d(8543,null),iconClass:q.asClassName(L.fileCode)},R_o={tooltip:d(8532,null),iconClass:q.asClassName(L.trash)},v5t={tooltip:d(8544,null),iconClass:q.asClassName(L.replace)},b5t={tooltip:d(8540,null),iconClass:q.asClassName(L.copy)},kFi={tooltip:d(8542,null),iconClass:q.asClassName(L.eyeClosed),alwaysVisible:!0},L_o={tooltip:d(8541,null),iconClass:q.asClassName(L.eye)},EFi={tooltip:d(8545,null),iconClass:q.asClassName(L.play)},bO=class{constructor(i,e,t,o,n,r,s,l,c){this._quickInputService=i;this._openerService=e;this._fileService=t;this._dialogService=o;this._commandService=n;this._instaService=r;this._promptsService=s;this._labelService=l;this._productService=c}async selectPromptFile(i){let e=new qe,t=this._quickInputService.createQuickPick({useSeparators:!0});t.busy=!0,t.placeholder=d(8546,null);try{let o=await this._createPromptPickItems(i,e.token),n=i.resource&&o.find(r=>r.type==="item"&&Jn.isEqual(r.promptFileUri,i.resource));n&&(t.activeItems=[n]),t.placeholder=i.placeholder,t.matchOnDescription=!0,t.items=o}finally{t.busy=!1}return new Promise(o=>{let n=new O,r=!1,s=!1;n.add(t),n.add(e);let l=async()=>{let c=t.activeItems,u=await this._createPromptPickItems(i,Ie.None);t.items=u,t.activeItems=c};n.add(t.onDidAccept(async()=>{let{selectedItems:c}=t,{keyMods:u}=t,p=c[0];if(D_o(p))o({promptFile:p.promptFileUri,keyMods:{...u}}),r=!0;else if(p.commandId){await this._commandService.executeCommand(p.commandId);return}t.hide()})),n.add(t.onDidTriggerItemButton(async c=>{let u=await this._handleButtonClick(t,c,i);!s&&u&&await l()})),n.add(t.onDidHide(()=>{t.ignoreFocusOut||(n.dispose(),s=!0,r||(o(void 0),r=!0))})),t.show()})}async _createPromptPickItems(i,e){let t=[];i.type==="prompt"&&i.optionRun!==!1&&t.push(EFi),i.optionEdit!==!1&&t.push(xFi),i.optionCopy!==!1&&t.push(b5t),i.optionRename!==!1&&t.push(v5t),i.optionDelete!==!1&&t.push(R_o);let o=[];i.optionNew!==!1&&o.push(...this._getNewItems(i.type));let n=()=>{};if(i.optionVisibility){let h=this._promptsService.getDisabledPromptFiles(i.type);n=g=>!h.has(g.uri)}let r=h=>h.sort((g,f)=>g.label.localeCompare(f.label)),s=await this._promptsService.listPromptFilesForStorage(i.type,"local",e);s.length&&(o.push({type:"separator",label:d(8551,null)}),o.push(...r(await Promise.all(s.map(h=>this._createPromptPickItem(h,t,n(h),e))))));let l=[];if(i.type==="instructions"&&(l=(await this._promptsService.listAgentInstructions(e)).map(g=>{let f=this._labelService.getUriLabel(ai(g.uri),{relative:!0});return{uri:g.uri,description:g.type!=="copilotInstructionsMd"?f:void 0,storage:"local",type:i.type}})),l.length){let h=t.filter(g=>g!==v5t);o.push({type:"separator",label:d(8552,null)}),o.push(...r(await Promise.all(l.map(g=>this._createPromptPickItem(g,h,n(g),e)))))}let c=(await this._promptsService.listPromptFilesForStorage(i.type,"extension",e)).filter(Gfn);if(c.length){let h=[];i.type==="prompt"&&i.optionRun!==!1&&h.push(EFi),i.optionEdit!==!1&&h.push(xFi),i.optionCopy!==!1&&h.push(b5t);let g=new Map;for(let v of c){let b=this._getExtensionGroupLabel(v);g.has(b)||g.set(b,[]),g.get(b).push(v)}let f=Array.from(g.entries()).sort((v,b)=>v[0].localeCompare(b[0]));for(let[v,b]of f)o.push({type:"separator",label:v}),o.push(...r(await Promise.all(b.map(S=>this._createPromptPickItem(S,h,n(S),e)))))}let u=await this._promptsService.listPromptFilesForStorage(i.type,"user",e);u.length&&(o.push({type:"separator",label:d(8550,null)}),o.push(...r(await Promise.all(u.map(h=>this._createPromptPickItem(h,t,n(h),e))))));let p=await this._promptsService.listPromptFilesForStorage(i.type,"plugin",e);if(p.length){let h=[];i.optionCopy!==!1&&h.push(b5t),o.push({type:"separator",label:d(8549,null)}),o.push(...r(await Promise.all(p.map(g=>this._createPromptPickItem(g,h,n(g),e)))))}return o}_getExtensionGroupLabel(i){return Pst(i.uri,i.extension.identifier,this._productService)?d(8548,null):d(8547,null)}_getNewItems(i){switch(i){case"prompt":return[qfn,Jfn];case"instructions":return[$fn,Qfn,jfn];case"agent":return[Yfn,evn];case"skill":return[Xfn,Zfn];default:throw new Error(`Unknown prompt type '${i}'.`)}}async _createPromptPickItem(i,e,t,o){let n=await this._promptsService.parseNew(i.uri,o).catch(()=>{}),r=(n?.header?.name??i.name)||(i.type==="skill"?PZ(i.uri):Xb(i.uri)),s=n?.header?.description??i.description,l;switch(i.storage){case"extension":l=i.extension.displayName??i.extension.id;break;case"local":l=this._labelService.getUriLabel(ai(i.uri),{relative:!0});break;case"user":l=void 0;break;case"plugin":l=i.name;break;default:bs(i)}let c;return t===!1?(e=(e??[]).concat(kFi),r=d(8539,null,r),l=d(8538,null)):t===!0&&(e=(e??[]).concat(L_o)),{id:i.uri.toString(),type:"item",label:r,description:s,iconClass:c,tooltip:l,promptFileUri:i.uri,buttons:e}}async keepQuickPickOpen(i,e){let t=i.ignoreFocusOut;i.ignoreFocusOut=!0;try{return await e()}finally{i.ignoreFocusOut=t,i.show()}}async _handleButtonClick(i,e,t){let{item:o,button:n}=e;if(!D_o(o)){if(Kfn(n))return await this._openerService.open(n.helpURI),!1;throw new Error(`Unknown button '${JSON.stringify(n)}'.`)}let r=o.promptFileUri;if(n===EFi){let s=i.keyMods.ctrlCmd===!0?"workbench.action.chat.run-in-new-chat.prompt.current":"workbench.action.chat.run.prompt.current";return await this._commandService.executeCommand(s,r),i.hide(),!1}if(n===xFi)return await this._openerService.open(r),!1;if(n===v5t||n===b5t)return await this.keepQuickPickOpen(i,async()=>{let s=ai(r),l=n===v5t&&i.keyMods.ctrlCmd,c=await this._instaService.invokeFunction(z6,t.type,s,l);if(!c)return!1;let u=await this._instaService.invokeFunction(jne,t.type,c.uri,o.label);if(!u)return!1;let p=Ve(c.uri,u);return l?await this._fileService.move(r,p):await this._fileService.copy(r,p),await this._openerService.open(p),await this._instaService.createInstance(Vq).openAndRewriteName(p,Xb(p),Ie.None),!0});if(n===R_o)return await this.keepQuickPickOpen(i,async()=>{let s=t.type==="skill",l=s?Be(ai(r)):o.label,c=s?d(8531,null,l):d(8530,null,l),{confirmed:u}=await this._dialogService.confirm({message:c});if(!u)return!1;let p=s?ai(r):r;return await this._fileService.del(p,{recursive:s,useTrash:!0}),!0});if(n===kFi||n===L_o){let s=this._promptsService.getDisabledPromptFiles(t.type);return n===kFi?s.delete(r):s.add(r),this._promptsService.setDisabledPromptFiles(t.type,s),!0}throw new Error(`Unknown button '${JSON.stringify(n)}'.`)}async managePromptFiles(i,e){let t=new qe,o=this._quickInputService.createQuickPick({useSeparators:!0});o.placeholder=e,o.canSelectMany=!0,o.matchOnDescription=!0,o.sortByLabel=!1,o.busy=!0;let n={placeholder:"",type:i,optionNew:!0,optionEdit:!0,optionDelete:!0,optionRename:!0,optionCopy:!0,optionVisibility:!1,optionRun:!1};try{let r=await this._createPromptPickItems(n,t.token);o.items=r}finally{o.busy=!1}return new Promise(r=>{let s=new O;s.add(o),s.add(t);let l=!1,c=!1,u=async()=>{let p=o.activeItems,h=await this._createPromptPickItems(n,Ie.None);o.items=h,o.activeItems=p};s.add(o.onDidAccept(async()=>{let p=o.activeItems;if(p.length===1&&p[0].commandId){let h=p[0].commandId;await this.keepQuickPickOpen(o,async()=>{await this._commandService.executeCommand(h)}),l||await u();return}c=!0,r(!0),o.hide()})),s.add(o.onDidTriggerItemButton(async p=>{let h=await this._handleButtonClick(o,p,n);!l&&h&&await u()})),s.add(o.onDidHide(()=>{o.ignoreFocusOut||(s.dispose(),l=!0,c||(r(!1),c=!0))})),o.show()})}};bO=I([m(0,$e),m(1,Je),m(2,ge),m(3,ct),m(4,fe),m(5,F),m(6,jr),m(7,nt),m(8,Ze)],bO);var tvn="workbench.action.chat.attach.instructions",S5t="workbench.action.chat.configure.instructions",TFi=class extends z{constructor(){super({id:S5t,title:P(8436,"Configure Instructions & Rules..."),shortTitle:P(8437,"Instructions & Rules"),icon:L.bookmark,f1:!0,precondition:Z.enabled,category:fi,menu:{id:LC,when:C.and(Z.enabled,C.equals("view",Xr)),order:10,group:"1_level"}})}async run(i){let e=i.get(Je),o=i.get(F).createInstance(bO),n=d(8435,null),r=await o.selectPromptFile({placeholder:n,type:"instructions",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function M_o(){W(TFi)}var xBe=class{constructor(i){this.promptsService=i;this.type="pickerPick";this.label=d(8434,null);this.icon=L.bookmark;this.commandId=tvn}isEnabled(i){return!!i.attachmentCapabilities.supportsInstructionAttachments}asPicker(){let i=this.promptsService.listPromptFiles("instructions",Ie.None).then(e=>{let t=[];e=e.slice(0).sort((n,r)=>oc(n.storage,r.storage));let o;for(let n of e)o!==n.storage&&(o=n.storage,t.push({type:"separator",label:this.promptsService.getPromptLocationLabel(n)})),t.push({label:n.name??Xb(n.uri),asAttachment:()=>H0(n.uri,"vscode.instructions.file.root")});return t});return{placeholder:d(8439,null),picks:i,configure:{label:d(8438,null),commandId:S5t}}}};xBe=I([m(0,jr)],xBe);var Xve=class extends k{static{this.ID="chat.contextContributions"}constructor(i,e){super(),this._store.add(e.registerChatContextItem(i.createInstance(_Fi))),this._store.add(e.registerChatContextItem(i.createInstance(xBe))),this._store.add(e.registerChatContextItem(i.createInstance(ylt))),this._store.add(e.registerChatContextItem(i.createInstance(wlt))),this._store.add(e.registerChatContextItem(i.createInstance(Clt))),this._store.add(e.registerChatContextItem(i.createInstance(xlt)))}};Xve=I([m(0,F),m(1,iI)],Xve);var _Fi=class{constructor(){this.type="pickerPick";this.label=d(6458,null);this.icon=L.tools;this.ordinal=-500}isEnabled(i){return!!i.attachmentCapabilities.supportsToolAttachments}asPicker(i){let e=[];for(let[n,r]of i.input.selectedToolsModel.entriesMap.get())r&&(_h(n)?e.push({toolInfo:wn.classify(n.source),label:n.referenceName,description:n.description,asAttachment:()=>TPt(n)}):e.push({toolInfo:wn.classify(n.source),label:n.toolReferenceName??n.displayName,description:n.userDescription??n.modelDescription,asAttachment:()=>Npe(n)}));e.sort((n,r)=>{let s=n.toolInfo.ordinal-r.toolInfo.ordinal;return s===0&&(s=n.toolInfo.label.localeCompare(r.toolInfo.label)),s===0&&(s=n.label.localeCompare(r.label)),s});let t,o=[];for(let n of e)t!==n.toolInfo.label&&(o.push({type:"separator",label:n.toolInfo.label}),t=n.toolInfo.label),o.push(n);return{placeholder:d(6459,null),picks:Promise.resolve(o)}}},ylt=class{constructor(i,e){this._editorService=i;this._labelService=e;this.type="valuePick";this.label=d(6455,null);this.icon=L.file;this.ordinal=800}isEnabled(){return this._editorService.editors.filter(i=>i instanceof dy||i instanceof Ba||i instanceof Jg).length>0}async asAttachment(){let i=[];for(let e of this._editorService.editors){if(!(e instanceof dy||e instanceof Ba||e instanceof Jg||e instanceof Ga))continue;let t=po.getOriginalUri(e,{supportSideBySide:1});t&&i.push({kind:"file",id:t.toString(),value:t,name:this._labelService.getUriBasenameLabel(t)})}return i}};ylt=I([m(0,ie),m(1,nt)],ylt);var wlt=class{constructor(i){this._clipboardService=i;this.type="valuePick";this.label=d(6460,null);this.icon=L.fileMedia}async isEnabled(i){if(!i.attachmentCapabilities.supportsImageAttachments||!i.input.selectedLanguageModel.get()?.metadata.capabilities?.vision)return!1;let e=await this._clipboardService.readImage();return bwo(e)}async asAttachment(){let i=await this._clipboardService.readImage();return{id:await Wrt(i),name:d(6461,null),fullName:d(6461,null),value:i,kind:"image"}}};wlt=I([m(0,Bi)],wlt);var kBe=class{constructor(i,e){this._resource=i;this._terminalService=e;this.type="valuePick";this.icon=L.terminal;this.label=d(6462,null)}isEnabled(i){let e=this._terminalService.getInstanceFromResource(this._resource);return!!i.attachmentCapabilities.supportsTerminalAttachments&&e?.isDisposed===!1}async asAttachment(i){let e=this._terminalService.getInstanceFromResource(this._resource);if(!e)return;let t=new URLSearchParams(this._resource.query),o=e.capabilities.get(2)?.commands.find(c=>c.id===t.get("command"));if(!o)return;let n={kind:"terminalCommand",id:`terminalCommand:${Date.now()}}`,value:this.asValue(o),name:o.command,command:o.command,output:o.getOutput(),exitCode:o.exitCode,resource:this._resource},r=new O,s=!1,l=()=>{s||(s=!0,r.dispose())};return r.add(i.attachmentModel.onDidChange(c=>{c.deleted.includes(n.id)&&l()})),r.add(e.onDisposed(()=>{i.attachmentModel.delete(n.id),i.refreshParsedInput(),l()})),n}asValue(i){let e=`Command: ${i.command}`,t=i.getOutput();return t&&(e+=`
Output:
${t}`),typeof i.exitCode=="number"&&(e+=`
Exit Code: ${i.exitCode}`),e}};kBe=I([m(1,an)],kBe);var Clt=class{constructor(i){this._hostService=i;this.type="valuePick";this.icon=L.deviceCamera;this.label=Avt?d(6453,null):d(6454,null)}async isEnabled(i){return!!i.attachmentCapabilities.supportsImageAttachments&&!!i.input.selectedLanguageModel.get()?.metadata.capabilities?.vision}async asAttachment(){let i=await this._hostService.getScreenshot();return i&&IWt(i)}};Clt=I([m(0,ti)],Clt);var xlt=class{constructor(i){this._chatSessionsService=i;this.type="pickerPick";this.icon=L.comment;this.label=d(6456,null);this.ordinal=-400}isEnabled(i){return i.location==="panel"}asPicker(i){let e=i.viewModel?.sessionResource;return{placeholder:d(6457,null),picks:(async()=>{let t=[],o=[zo.Local,zo.Background,zo.Claude];for await(let n of this._chatSessionsService.getChatSessionItems(o,Ie.None)){let r=n_(n.chatSessionType);for(let s of n.items){if(e&&s.resource.toString()===e.toString())continue;let l=s.resource,c=s.iconPath??r;t.push({label:s.label,description:new Date(s.timing.lastRequestEnded??s.timing.created).toLocaleString(),asAttachment:()=>({kind:"sessionReference",id:l.toString(),name:s.label,value:l,icon:c})})}}return t.sort((n,r)=>(r.description??"").localeCompare(n.description??"")),t})()}}};xlt=I([m(0,Ms)],xlt);var EBe=class{constructor(i){this.options=i;this.rangeHighlightDecorationId=void 0}provide(i,e,t){let o=new O;i.canAcceptInBackground=!!this.options?.canAcceptInBackground,i.matchOnLabel=i.matchOnDescription=i.matchOnDetail=i.sortByLabel=!1;let n=o.add(new ue);return n.value=this.doProvide(i,e,t),o.add(this.onDidActiveTextEditorControlChange(()=>{n.value=void 0,n.value=this.doProvide(i,e)})),o}doProvide(i,e,t){let o=new O,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){let r={editor:n},s=da(n);if(s){let l=n.saveViewState()??void 0;o.add(s.onDidChangeCursorPosition(()=>{l=n.saveViewState()??void 0})),r.restoreViewState=()=>{l&&n===this.activeTextEditorControl&&n.restoreViewState(l)},o.add(bd(e.onCancellationRequested)(()=>r.restoreViewState?.()))}o.add(ee(()=>this.clearDecorations(n))),o.add(this.provideWithTextEditor(r,i,e,t))}else o.add(this.provideWithoutTextEditor(i,e));return o}canProvideWithTextEditor(i){return!0}gotoLocation({editor:i},e){i.setSelection(e.range,"code.jump"),i.revealRangeInCenter(e.range,0),e.preserveFocus||i.focus();let t=this.getModel(i);if(t){let o=t.getLineContent(e.range.startLineNumber);Er(d(1510,null,e.range.startLineNumber,e.range.startColumn,o))}}getModel(i){return Lc(i)?i.getModel()?.modified:i.getModel()}addDecorations(i,e){i.changeDecorations(t=>{let o=[];this.rangeHighlightDecorationId&&(o.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),o.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);let n=[{range:e,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:e,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:_s(bxe),position:7}}}],[r,s]=t.deltaDecorations(o,n);this.rangeHighlightDecorationId={rangeHighlightId:r,overviewRulerDecorationId:s}})}clearDecorations(i){let e=this.rangeHighlightDecorationId;e&&(i.changeDecorations(t=>{t.deltaDecorations([e.overviewRulerDecorationId,e.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}};var XR=class extends EBe{constructor(e,t,o=Object.create(null)){super(o);this._languageFeaturesService=e;this._outlineModelService=t;this.options=o,this.options.canAcceptInBackground=!0}static{this.PREFIX="@"}static{this.SCOPE_PREFIX=":"}static{this.PREFIX_BY_CATEGORY=`${this.PREFIX}${this.SCOPE_PREFIX}`}provideWithoutTextEditor(e){return this.provideLabelPick(e,d(1524,null)),k.None}provideWithTextEditor(e,t,o,n){let r=e.editor,s=this.getModel(r);return s?this._languageFeaturesService.documentSymbolProvider.has(s)?this.doProvideWithEditorSymbols(e,s,t,o,n):this.doProvideWithoutEditorSymbols(e,s,t,o):k.None}doProvideWithoutEditorSymbols(e,t,o,n){let r=new O;return this.provideLabelPick(o,d(1525,null)),(async()=>!await this.waitForLanguageSymbolRegistry(t,r)||n.isCancellationRequested||r.add(this.doProvideWithEditorSymbols(e,t,o,n)))(),r}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;let o=new Mo,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),o.complete(!0))}));return t.add(ee(()=>o.complete(!1))),o.p}doProvideWithEditorSymbols(e,t,o,n,r){let s=e.editor,l=new O;l.add(o.onDidAccept(h=>{let[g]=o.selectedItems;if(g&&g.range){if(o.keyMods.shift&&g.attach){g.attach(o.keyMods,h);return}this.gotoLocation(e,{range:g.range.selection,keyMods:o.keyMods,preserveFocus:h.inBackground}),r?.handleAccept?.(g,h.inBackground),h.inBackground||o.hide()}})),l.add(o.onDidTriggerItemButton(({item:h})=>{h&&h.range&&(this.gotoLocation(e,{range:h.range.selection,keyMods:o.keyMods,forceSideBySide:!0}),o.hide())}));let c=this.getDocumentSymbols(t,n),u=l.add(new ue),p=async h=>{u?.value?.cancel(),o.busy=!1,u.value=new qe,o.busy=!0;try{let g=xW(o.value.substr(XR.PREFIX.length).trim()),f=await this.doGetSymbolPicks(c,g,void 0,u.value.token,t);if(n.isCancellationRequested)return;if(f.length>0){if(o.items=f,h&&g.original.length===0){let v=wu(f,b=>!!(b.type!=="separator"&&b.range&&G.containsPosition(b.range.decoration,h)));v&&(o.activeItems=[v])}}else g.original.length>0?this.provideLabelPick(o,d(1539,null)):this.provideLabelPick(o,d(1540,null))}finally{n.isCancellationRequested||(o.busy=!1)}};return l.add(o.onDidChangeValue(()=>p(void 0))),p(s.getSelection()?.getPosition()),l.add(o.onDidChangeActive(()=>{let[h]=o.activeItems;h&&h.range&&(s.revealRangeInCenter(h.range.selection,0),this.addDecorations(s,h.range.decoration))})),l}async doGetSymbolPicks(e,t,o,n,r){let s=await e;if(n.isCancellationRequested)return[];let l=t.original.indexOf(XR.SCOPE_PREFIX)===0,c=l?1:0,u,p;t.values&&t.values.length>1?(u=qMe(t.values[0]),p=qMe(t.values.slice(1))):u=t;let h,g=this.options?.openSideBySideDirection?.();g&&(h=[{iconClass:g==="right"?q.asClassName(L.splitHorizontal):q.asClassName(L.splitVertical),tooltip:g==="right"?d(1544,null):d(1543,null)}]);let f=[];for(let S=0;S<s.length;S++){let y=s[S],w=CL(y.name),x=`$(${Zm.toIcon(y.kind).id}) ${w}`,E=x.length-w.length,M=y.containerName;o?.extraContainerLabel&&(M?M=`${o.extraContainerLabel} \u2022 ${M}`:M=o.extraContainerLabel);let N,V,H,K;if(t.original.length>c){let J=!1;if(u!==t&&([N,V]=kte(x,{...t,values:void 0},c,E),typeof N=="number"&&(J=!0)),typeof N!="number"&&([N,V]=kte(x,u,c,E),typeof N!="number"))continue;if(!J&&p){if(M&&p.original.length>0&&([H,K]=kte(M,p)),typeof H!="number")continue;typeof N=="number"&&(N+=H)}}let j=y.tags&&y.tags.indexOf(1)>=0;f.push({index:S,kind:y.kind,score:N,label:x,ariaLabel:kIt(y.name,y.kind),description:M,highlights:j?void 0:{label:V,description:K},range:{selection:G.collapseToStart(y.selectionRange),decoration:y.range},uri:r.uri,symbolName:w,strikethrough:j,buttons:h})}let v=f.sort((S,y)=>l?this.compareByKindAndScore(S,y):this.compareByScore(S,y)),b=[];if(l){let x=function(){y&&typeof S=="number"&&w>0&&(y.label=Wd(RFi[S]||DFi,w))},S,y,w=0;for(let E of v)S!==E.kind?(x(),S=E.kind,w=1,y={type:"separator"},b.push(y)):w++,b.push(E);x()}else v.length>0&&(b=[{label:d(1550,null,f.length),type:"separator"},...v]);return b}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}return e.index<t.index?-1:e.index>t.index?1:0}compareByKindAndScore(e,t){let o=RFi[e.kind]||DFi,n=RFi[t.kind]||DFi,r=o.localeCompare(n);return r===0?this.compareByScore(e,t):r}async getDocumentSymbols(e,t){let o=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:o.asListOfDocumentSymbols()}};XR=I([m(0,Jt),m(1,kx)],XR);var DFi=d(1547,null),RFi={5:d(1536,null),11:d(1533,null),8:d(1521,null),12:d(1552,null),4:d(1526,null),22:d(1549,null),23:d(1530,null),24:d(1545,null),10:d(1534,null),2:d(1538,null),3:d(1546,null),25:d(1551,null),1:d(1537,null),6:d(1547,null),9:d(1528,null),21:d(1529,null),14:d(1548,null),0:d(1532,null),17:d(1522,null),15:d(1541,null),16:d(1523,null),18:d(1542,null),19:d(1535,null),7:d(1531,null),13:d(1527,null)};var I5t=class{constructor(i,e,t,o){this.cacheQuery=i;this.loadFn=e;this.disposeFn=t;this.previousCacheState=o;if(this._cacheKey=o4.nextId(),this.query=this.cacheQuery(this._cacheKey),this.loadingPhase=1,this.previousCacheState){let n=Object.assign({},this.query,{cacheKey:null}),r=Object.assign({},this.previousCacheState.query,{cacheKey:null});Qi(n,r)||(this.previousCacheState.dispose(),this.previousCacheState=void 0)}}get cacheKey(){return this.loadingPhase===3||!this.previousCacheState?this._cacheKey:this.previousCacheState.cacheKey}get isLoaded(){let i=this.loadingPhase===3;return i||!this.previousCacheState?i:this.previousCacheState.isLoaded}get isUpdating(){let i=this.loadingPhase===2;return i||!this.previousCacheState?i:this.previousCacheState.isUpdating}load(){return this.isUpdating?this:(this.loadingPhase=2,this.loadPromise=(async()=>{try{await this.loadFn(this.query),this.loadingPhase=3,this.previousCacheState&&(this.previousCacheState.dispose(),this.previousCacheState=void 0)}catch(i){throw this.loadingPhase=4,i}})(),this)}dispose(){this.loadPromise?(async()=>{try{await this.loadPromise}catch{}this.loadingPhase=5,this.disposeFn(this._cacheKey)})():this.loadingPhase=5,this.previousCacheState&&(this.previousCacheState.dispose(),this.previousCacheState=void 0)}};var HE=class extends cg{constructor(e,t,o,n,r,s){super(HE.PREFIX,{canAcceptInBackground:!0,noResultsPick:{label:d(15310,null)}});this.labelService=e;this.openerService=t;this.editorService=o;this.configurationService=n;this.codeEditorService=r;this.chatWidgetService=s;this.delayer=this._register(new Aa(HE.TYPING_SEARCH_DELAY))}static{this.PREFIX="#"}static{this.TYPING_SEARCH_DELAY=200}static{this.TREAT_AS_GLOBAL_SYMBOL_TYPES=new Set([4,9,0,10,2,3,1])}get defaultFilterValue(){let e=this.codeEditorService.getFocusedCodeEditor();if(e)return _J(e)??void 0}get configuration(){let e=this.configurationService.getValue().workbench?.editor;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,openSideBySideDirection:e?.openSideBySideDirection}}_getPicks(e,t,o){return this.getSymbolPicks(e,void 0,o)}async getSymbolPicks(e,t,o){return this.delayer.trigger(async()=>o.isCancellationRequested?[]:this.doGetSymbolPicks(xW(e),t,o),t?.delay)}async doGetSymbolPicks(e,t,o){let n,r;e.values&&e.values.length>1?(n=qMe(e.values[0]),r=qMe(e.values.slice(1))):n=e;let s=await uOt(n.original,o);if(o.isCancellationRequested)return[];let l=[],c=this.configuration.openSideBySideDirection;for(let{symbol:u,provider:p}of s){if(t?.skipLocal&&!HE.TREAT_AS_GLOBAL_SYMBOL_TYPES.has(u.kind)&&u.containerName)continue;let h=u.name,g,f,v=!1;if(n.original.length>0&&(n!==e&&([g,f]=kte(h,{...e,values:void 0},0,0),typeof g=="number"&&(v=!0)),typeof g!="number"&&([g,f]=kte(h,n,0,0),typeof g!="number")))continue;let b=u.location.uri,S;if(b){let E=this.labelService.getUriLabel(b,{relative:!0});u.containerName?S=`${u.containerName} \u2022 ${E}`:S=E}let y,w;if(!v&&r&&r.original.length>0){if(S&&([y,w]=kte(S,r)),typeof y!="number")continue;typeof g=="number"&&(g+=y)}let x=u.tags?u.tags.indexOf(1)>=0:!1;l.push({symbol:u,resource:b,score:g,iconClass:q.asClassName(Zm.toIcon(u.kind)),label:h,ariaLabel:h,highlights:x?void 0:{label:f,description:w},description:S,strikethrough:x,buttons:[{iconClass:c==="right"?q.asClassName(L.splitHorizontal):q.asClassName(L.splitVertical),tooltip:c==="right"?d(15312,null):d(15311,null)}],trigger:(E,M)=>(this.openSymbol(p,u,o,{keyMods:M,forceOpenSideBySide:!0}),1),accept:async(E,M)=>this.openSymbol(p,u,o,{keyMods:E,preserveFocus:M.inBackground,forcePinned:M.inBackground}),attach:(E,M)=>{if(E.shift){let N=this.chatWidgetService.lastFocusedWidget;if(N){let V={kind:"symbol",id:JSON.stringify({uri:b.toString(),range:u.location.range}),name:u.name,value:u.location,symbolKind:u.kind};N.attachmentModel.addContext(V)}return}this.openSymbol(p,u,o,{keyMods:E,preserveFocus:M.inBackground,forcePinned:M.inBackground})}})}return t?.skipSorting||l.sort((u,p)=>this.compareSymbols(u,p)),l}async openSymbol(e,t,o,n){let r=t;typeof e.resolveWorkspaceSymbol=="function"&&(r=await e.resolveWorkspaceSymbol(t,o)||t,o.isCancellationRequested)||(r.location.uri.scheme===Q.http||r.location.uri.scheme===Q.https?await this.openerService.open(r.location.uri,{fromUserGesture:!0,allowContributedOpeners:!0}):await this.editorService.openEditor({resource:r.location.uri,options:{preserveFocus:n?.preserveFocus,pinned:n.keyMods.ctrlCmd||n.forcePinned||this.configuration.openEditorPinned,selection:r.location.range?G.collapseToStart(r.location.range):void 0}},n.keyMods.alt||this.configuration.openEditorPinned&&n.keyMods.ctrlCmd||n?.forceOpenSideBySide?En:tr))}compareSymbols(e,t){if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}if(e.symbol&&t.symbol){let o=e.symbol.name.toLowerCase(),n=t.symbol.name.toLowerCase(),r=o.localeCompare(n);if(r!==0)return r}if(e.symbol&&t.symbol){let o=Zm.toIcon(e.symbol.kind).id,n=Zm.toIcon(t.symbol.kind).id;return o.localeCompare(n)}return 0}};HE=I([m(0,nt),m(1,Je),m(2,ie),m(3,B),m(4,Qt),m(5,Lt)],HE);var UE=class extends XR{constructor(e,t,o,n,r,s){super(o,r,{openSideBySideDirection:()=>this.configuration.openSideBySideDirection});this.editorService=e;this.configurationService=t;this.outlineService=n;this.chatWidgetService=s;this.onDidActiveTextEditorControlChange=this.editorService.onDidActiveEditorChange}get configuration(){let e=this.configurationService.getValue().workbench?.editor;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,openSideBySideDirection:e?.openSideBySideDirection}}get activeTextEditorControl(){if(!CF(this.editorService.activeEditorPane?.getControl()))return this.editorService.activeTextEditorControl}gotoLocation(e,t){if((t.keyMods.alt||this.configuration.openEditorPinned&&t.keyMods.ctrlCmd||t.forceSideBySide)&&this.editorService.activeEditor){e.restoreViewState?.();let o={selection:t.range,pinned:t.keyMods.ctrlCmd||this.configuration.openEditorPinned,preserveFocus:t.preserveFocus};this.editorService.openEditor(this.editorService.activeEditor,o,En)}else super.gotoLocation(e,t)}static{this.SYMBOL_PICKS_TIMEOUT=8e3}async getSymbolPicks(e,t,o,n,r){return!await Promise.race([this.waitForLanguageSymbolRegistry(e,n),Li(UE.SYMBOL_PICKS_TIMEOUT)])||r.isCancellationRequested?[]:this.doGetSymbolPicks(this.getDocumentSymbols(e,r),xW(t),o,r,e)}async doGetSymbolPicks(e,t,o,n,r){let s=await super.doGetSymbolPicks(e,t,o,n,r),l=r.uri;for(let c of s){let u=c;u.range&&!u.attach&&(u.attach=()=>{let p=this.chatWidgetService.lastFocusedWidget;if(!p)return;let h={kind:"symbol",id:JSON.stringify({uri:l.toString(),range:u.range.decoration}),name:u.symbolName??u.label,value:{uri:l,range:u.range.decoration},symbolKind:u.kind};p.attachmentModel.addContext(h)})}return s}provideWithoutTextEditor(e){return this.canPickWithOutlineService()?this.doGetOutlinePicks(e):super.provideWithoutTextEditor(e)}canPickWithOutlineService(){return this.editorService.activeEditorPane?this.outlineService.canCreateOutline(this.editorService.activeEditorPane):!1}doGetOutlinePicks(e){let t=this.editorService.activeEditorPane;if(!t)return k.None;let o=new qe,n=new O;return n.add(ee(()=>o.dispose(!0))),e.busy=!0,this.outlineService.createOutline(t,4,o.token).then(r=>{if(!r)return;if(o.token.isCancellationRequested){r.dispose();return}n.add(r);let s=r.captureViewState();n.add(ee(()=>{e.selectedItems.length===0&&s.dispose()}));let l=r.config.quickPickDataSource.getQuickPickElements(),c=l.map((h,g)=>({kind:0,index:g,score:0,label:h.label,description:h.description,ariaLabel:h.ariaLabel,iconClasses:h.iconClasses}));n.add(e.onDidAccept(()=>{e.hide();let[h]=e.selectedItems;h&&l[h.index]&&r.reveal(l[h.index].element,{},!1,!1)}));let u=()=>{let h=c.filter(g=>{if(e.value==="@")return g.score=0,g.highlights=void 0,!0;let f=e.value.substring(XR.PREFIX.length).trim(),v=MA(g.label),b=eM(f,f.toLowerCase(),0,v.text,v.text.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return b?(g.score=b[1],g.highlights={label:zB(f,v)??void 0},!0):!1});if(h.length===0){let g=d(10119,null);e.items=[{label:g,index:-1,kind:14}],e.ariaLabel=g}else e.items=h};u(),n.add(e.onDidChangeValue(u));let p=new ue;n.add(p),n.add(e.onDidChangeActive(()=>{let[h]=e.activeItems;h&&l[h.index]?p.value=r.preview(l[h.index].element):p.clear()}))}).catch(r=>{mt(r),e.hide()}).finally(()=>{e.busy=!1}),n}};UE=I([m(0,ie),m(1,B),m(2,Jt),m(3,sP),m(4,kx),m(5,Lt)],UE);var y5t=class a extends z{static{this.ID="workbench.action.gotoSymbol"}constructor(){super({id:a.ID,title:{...P(10120,"Go to Symbol in Editor..."),mnemonicTitle:d(10124,null)},f1:!0,keybinding:{when:C.and(Jd.negate(),jx.negate()),weight:200,primary:3117},menu:[{id:R.MenubarGoMenu,group:"4_symbol_nav",order:1}]})}run(i){i.get($e).quickAccess.show(UE.PREFIX,{itemActivation:0})}};W(y5t);oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:UE,prefix:XR.PREFIX,contextKey:"inFileSymbolsPicker",placeholder:d(10123,null),helpEntries:[{description:d(10122,null),prefix:XR.PREFIX,commandId:y5t.ID,commandCenterOrder:40},{description:d(10121,null),prefix:XR.PREFIX_BY_CATEGORY}]});var klt="workbench.action.quickchat.toggle";function P_o(){W(LFi),W(MFi),W(class extends z{constructor(){super({id:"workbench.action.quickchat.openInChatView",title:P(6598,"Open in Chat View"),f1:!1,category:fi,icon:L.chatSparkle,menu:{id:R.ChatInputSide,group:"navigation",order:10}})}run(i){i.get(JD).openInChatView()}}),W(class extends z{constructor(){super({id:"workbench.action.quickchat.close",title:P(6597,"Close Quick Chat"),f1:!1,category:fi,icon:L.close,menu:{id:R.ChatInputSide,group:"navigation",order:20}})}run(i){i.get(JD).close()}})}var LFi=class extends z{constructor(){super({id:klt,title:P(6600,"Open Quick Chat"),precondition:Z.enabled,icon:L.chatSparkle,f1:!1,category:fi,keybinding:{weight:200,primary:3626},menu:{id:R.ChatTitleBarMenu,group:"a_open",order:4},metadata:{description:d(6601,null),args:[{name:"args",schema:{anyOf:[{type:"object",required:["query"],properties:{query:{description:d(6603,null),type:"string"},isPartialQuery:{description:d(6602,null),type:"boolean"}}},{type:"string",description:d(6603,null)}]}}]}})}run(i,e){let t=i.get(JD),o;switch(typeof e){case"string":o={query:e};break;case"object":o=e;break}o?.query&&(o.selection=new ei(1,o.query.length+1,1,o.query.length+1)),t.toggle(o)}},MFi=class extends z{constructor(){super({id:"workbench.action.openQuickChat",category:fi,title:P(6599,"Open Quick Chat"),precondition:Z.enabled,f1:!0})}run(i,e){i.get(JD).toggle(e?{query:e,selection:new ei(1,e.length+1,1,e.length+1)}:void 0)}};function PFi(a){let i=a;return!!i?.range&&!!i.resource}var qC=class extends cg{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V){super(qC.PREFIX,{canAcceptInBackground:!0,noResultsPick:qC.NO_RESULTS_PICK});this.instantiationService=e;this.searchService=t;this.contextService=o;this.pathService=n;this.environmentService=r;this.fileService=s;this.labelService=l;this.modelService=c;this.languageService=u;this.workingCopyService=p;this.configurationService=h;this.editorService=g;this.historyService=f;this.filesConfigurationService=v;this.textModelService=b;this.uriIdentityService=S;this.quickInputService=y;this.keybindingService=w;this.contextKeyService=x;this.quickChatService=E;this.logService=M;this.customEditorLabelService=N;this.chatWidgetService=V;this.labelOnlyEditorHistoryPickAccessor=new OQe({skipDescription:!0});this.fileQueryDelayer=this._register(new Aa(qC.TYPING_SEARCH_DELAY));this.lazyRegistry=new uo(()=>oe.as(Bu.Quickaccess));this.pickState=this._register(new class extends k{constructor(K,j){super();this.provider=K;this.picker=void 0;this.scorerCache=Object.create(null);this.fileQueryCache=void 0;this.lastOriginalFilter=void 0;this.lastFilter=void 0;this.lastRange=void 0;this.lastGlobalPicks=void 0;this.isQuickNavigating=void 0;this.editorViewState=this._register(j.createInstance(FG))}set(K){this.picker=K,U.once(K.onDispose)(()=>{K===this.picker&&(this.picker=void 0)});let j=!!K.quickNavigate;j||(this.fileQueryCache=this.provider.createFileQueryCache(),this.scorerCache=Object.create(null)),this.isQuickNavigating=j,this.lastOriginalFilter=void 0,this.lastFilter=void 0,this.lastRange=void 0,this.lastGlobalPicks=void 0,this.editorViewState.reset()}}(this,e)),this.fileQueryBuilder=this.instantiationService.createInstance(JS),this.workspaceSymbolsQuickAccess=this._register(e.createInstance(HE)),this.editorSymbolsQuickAccess=this.instantiationService.createInstance(UE)}static{this.PREFIX=""}static{this.NO_RESULTS_PICK={label:d(15013,null)}}static{this.MAX_RESULTS=512}static{this.TYPING_SEARCH_DELAY=200}static{this.SYMBOL_PICKS_MERGE_DELAY=200}get defaultFilterValue(){if(this.configuration.preserveInput)return 1}get configuration(){let e=this.configurationService.getValue().workbench?.editor,t=this.configurationService.getValue().search,o=this.configurationService.getValue().workbench.quickOpen;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,openSideBySideDirection:e?.openSideBySideDirection,includeSymbols:t?.quickOpen?.includeSymbols,includeHistory:t?.quickOpen?.includeHistory??!0,historyFilterSortOrder:t?.quickOpen?.history?.filterSortOrder,preserveInput:o?.preserveInput}}provide(e,t,o){let n=new O;this.pickState.set(e);let r=n.add(new ue);return n.add(e.onDidChangeActive(()=>{r.value=void 0;let[s]=e.activeItems;PFi(s)&&(r.value=this.decorateAndRevealSymbolRange(s))})),n.add(U.once(e.onDidHide)(({reason:s})=>{s===2&&this.pickState.editorViewState.restore()})),n.add(super.provide(e,t,o)),n}decorateAndRevealSymbolRange(e){let t=this.editorService.activeEditor;if(!this.uriIdentityService.extUri.isEqual(e.resource,t?.resource))return k.None;let o=this.editorService.activeTextEditorControl;return o?(this.pickState.editorViewState.set(),o.revealRangeInCenter(e.range.selection,0),this.addDecorations(o,e.range.decoration),ee(()=>this.clearDecorations(o))):k.None}_getPicks(e,t,o,n){let r=xuo(e,[UE.PREFIX]),s;if(r?s=r.filter:s=e,this.pickState.lastRange=r?.range,e!==this.pickState.lastOriginalFilter&&s===this.pickState.lastFilter)return null;let l=!!this.pickState.lastOriginalFilter;this.pickState.lastOriginalFilter=e,this.pickState.lastFilter=s;let c=this.pickState.picker?.items,u=this.pickState.picker?.activeItems[0];if(c&&u){let p=PFi(u),h=u===qC.NO_RESULTS_PICK&&s.indexOf(UE.PREFIX)>=0;!p&&!h&&(this.pickState.lastGlobalPicks={items:c,active:u})}return this.doGetPicks(s,{...n,enableEditorSymbolSearch:l},t,o)}doGetPicks(e,t,o,n){let r=xW(e);if(t.enableEditorSymbolSearch){let u=this.getEditorSymbolPicks(r,o,n);if(u)return u}let s=this.pickState.picker?.activeItems[0];if(PFi(s)&&this.pickState.lastGlobalPicks)return this.pickState.lastGlobalPicks;let l=this.getEditorHistoryPicks(r),c=new Array;if(t.additionPicks)for(let u of t.additionPicks){if(u.type==="separator"){c.push(u);continue}if(!r.original){u.highlights=void 0,c.push(u);continue}let{score:p,labelMatch:h,descriptionMatch:g}=xte(u,r,!0,rJ,this.pickState.scorerCache);p&&(u.highlights={label:h,description:g},c.push(u))}return this.pickState.isQuickNavigating?(c.length>0&&c.push({type:"separator",label:d(15016,null)}),c=l):(t.includeHelp&&c.push(...this.getHelpPicks(r,n,t)),l.length!==0&&(c.push({type:"separator",label:d(15016,null)}),c.push(...l))),{picks:t.filter?c.filter(u=>t.filter?.(u)):c,additionalPicks:(async()=>{let u=new dt(h=>this.uriIdentityService.extUri.getComparisonKey(h));for(let h of l)h.resource&&u.set(h.resource,!0);let p=await this.getAdditionalPicks(r,u,!!this.configuration?.includeSymbols,n);return t.filter&&(p=p.filter(h=>t.filter?.(h))),n.isCancellationRequested?[]:p.length>0?[{type:"separator",label:this.configuration.includeSymbols?d(15009,null):d(15011,null)},...p]:[]})(),mergeDelay:qC.SYMBOL_PICKS_MERGE_DELAY}}async getAdditionalPicks(e,t,o,n){let[r,s]=await Promise.all([this.getFilePicks(e,t,n),this.getWorkspaceSymbolPicks(e,o,n)]);if(n.isCancellationRequested)return[];let l=K4i([...r,...s],(u,p)=>ptt(u,p,e,!0,rJ,this.pickState.scorerCache),qC.MAX_RESULTS),c=[];for(let u of l)if(u.highlights)c.push(u);else{let{score:p,labelMatch:h,descriptionMatch:g}=xte(u,e,!0,rJ,this.pickState.scorerCache);if(!p)continue;u.highlights={label:h,description:g},c.push(u)}return c}getEditorHistoryPicks(e){let t=this.configuration;if(!e.normalized)return this.historyService.getHistory().map(r=>this.createAnythingPick(r,t));if(!this.configuration.includeHistory)return[];let o=e.containsPathSeparator?rJ:this.labelOnlyEditorHistoryPickAccessor,n=[];for(let r of this.historyService.getHistory()){if(!r.resource)continue;let l=this.createAnythingPick(r,t),{score:c,labelMatch:u,descriptionMatch:p}=xte(l,e,!1,o,this.pickState.scorerCache);c&&(l.highlights={label:u,description:p},n.push(l))}return this.configuration.historyFilterSortOrder==="recency"?n:n.sort((r,s)=>ptt(r,s,e,!1,o,this.pickState.scorerCache))}createFileQueryCache(){return new I5t(e=>this.fileQueryBuilder.file(this.contextService.getWorkspace().folders,this.getFileQueryOptions({cacheKey:e})),e=>this.searchService.fileSearch(e),e=>this.searchService.clearCache(e),this.pickState.fileQueryCache).load()}async getFilePicks(e,t,o){if(!e.normalized)return[];let n=await this.getAbsolutePathFileResult(e,o);if(o.isCancellationRequested)return[];let r;if(n){if(t.has(n))return[];let l=this.createAnythingPick(n,this.configuration);return l.highlights={label:[{start:0,end:l.label.length}],description:l.description?[{start:0,end:l.description.length}]:void 0},[l]}if(this.pickState.fileQueryCache?.isLoaded?r=await this.doFileSearch(e,o):r=await this.fileQueryDelayer.trigger(async()=>o.isCancellationRequested?[]:this.doFileSearch(e,o)),o.isCancellationRequested)return[];let s=this.configuration;return r.filter(l=>!t.has(l)).map(l=>this.createAnythingPick(l,s))}async doFileSearch(e,t){let[o,n]=await Promise.all([this.getFileSearchResults(e,t),this.getRelativePathFileResults(e,t)]);if(t.isCancellationRequested)return[];if(!n)return o;let r=new dt(s=>this.uriIdentityService.extUri.getComparisonKey(s));for(let s of n)r.set(s,!0);return[...o.filter(s=>!r.has(s)),...n]}async getFileSearchResults(e,t){let o="";e.values&&e.values.length>1?o=e.values[0].original:o=e.original;let n=await this.doGetFileSearchResults(o,t);if(t.isCancellationRequested)return[];if(n.limitHit&&e.values&&e.values.length>1){let r=await this.doGetFileSearchResults(e.original,t);if(t.isCancellationRequested)return[];let s=new dt(l=>this.uriIdentityService.extUri.getComparisonKey(l));for(let l of n.results)s.set(l.resource,!0);for(let l of r.results)s.has(l.resource)||n.results.push(l)}return n.results.map(r=>r.resource)}doGetFileSearchResults(e,t){let o=Date.now();return this.searchService.fileSearch(this.fileQueryBuilder.file(this.contextService.getWorkspace().folders,this.getFileQueryOptions({filePattern:e,cacheKey:this.pickState.fileQueryCache?.cacheKey,maxResults:qC.MAX_RESULTS})),t).finally(()=>{this.logService.trace(`QuickAccess fileSearch ${Date.now()-o}ms`)})}getFileQueryOptions(e){return{_reason:"openFileHandler",extraFileResources:this.instantiationService.invokeFunction(Tee),filePattern:e.filePattern||"",cacheKey:e.cacheKey,maxResults:e.maxResults||0,sortByScore:!0}}async getAbsolutePathFileResult(e,t){if(!e.containsPathSeparator)return;let o=await this.pathService.userHome(),n=aK(e.original,o.scheme===Q.file?o.fsPath:o.path);if(t.isCancellationRequested)return;let r=(await this.pathService.path).isAbsolute(n);if(!t.isCancellationRequested&&r){let s=Nf(await this.pathService.fileURI(n),this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);if(t.isCancellationRequested)return;try{if((await this.fileService.stat(s)).isFile)return await this.matchFilenameCasing(s)}catch{}}}async getRelativePathFileResults(e,t){if(!e.containsPathSeparator)return;if(!(await this.pathService.path).isAbsolute(e.original)){let n=[];for(let r of this.contextService.getWorkspace().folders){if(t.isCancellationRequested)break;let s=Nf(r.toResource(e.original),this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);try{(await this.fileService.stat(s)).isFile&&n.push(await this.matchFilenameCasing(s))}catch{}}return n}}async matchFilenameCasing(e){let t=ai(e),o=await this.fileService.resolve(t,{resolveTo:[e]});if(o?.children){let n=o.children.find(r=>this.uriIdentityService.extUri.isEqual(r.resource,e));if(n)return A.joinPath(t,n.name)}return e}getHelpPicks(e,t,o){if(e.normalized)return[];let n=this.lazyRegistry.value.getQuickAccessProviders(this.contextKeyService).filter(r=>r.helpEntries.some(s=>s.commandCenterOrder!==void 0)).flatMap(r=>r.helpEntries.filter(s=>s.commandCenterOrder!==void 0).map(s=>{let l={...o,includeHelp:r.prefix===qC.PREFIX?!1:o?.includeHelp},c=s.commandCenterLabel??s.description;return{label:c,description:s.prefix??r.prefix,commandCenterOrder:s.commandCenterOrder,keybinding:s.commandId?this.keybindingService.lookupKeybinding(s.commandId):void 0,ariaLabel:d(15012,null,c,s.description),accept:()=>{this.quickInputService.quickAccess.show(r.prefix,{preserveValue:!0,providerOptions:l})}}}));return this.quickChatService.enabled&&n.push({label:d(15007,null),commandCenterOrder:30,keybinding:this.keybindingService.lookupKeybinding(klt),accept:()=>this.quickChatService.toggle()}),n.sort((r,s)=>r.commandCenterOrder-s.commandCenterOrder)}async getWorkspaceSymbolPicks(e,t,o){return!e.normalized||!t||this.pickState.lastRange?[]:this.workspaceSymbolsQuickAccess.getSymbolPicks(e.original,{skipLocal:!0,skipSorting:!0,delay:qC.TYPING_SEARCH_DELAY},o)}getEditorSymbolPicks(e,t,o){let n=e.original.split(UE.PREFIX),r=n.length>1?n[n.length-1].trim():void 0;if(typeof r!="string")return null;let s=this.pickState.lastGlobalPicks?.active;if(!s)return null;let l=s.resource;return!l||!this.fileService.hasProvider(l)&&l.scheme!==Q.untitled||(s.label.includes(UE.PREFIX)||s.description?.includes(UE.PREFIX))&&n.length<3?null:this.doGetEditorSymbolPicks(s,l,r,t,o)}async doGetEditorSymbolPicks(e,t,o,n,r){try{this.pickState.editorViewState.set(),await this.pickState.editorViewState.openTransientEditor({resource:t,options:{preserveFocus:!0,revealIfOpened:!0,ignoreError:!0}})}catch{return[]}if(r.isCancellationRequested)return[];let s=this.modelService.getModel(t);if(!s)try{let c=n.add(await this.textModelService.createModelReference(t));if(r.isCancellationRequested)return[];s=c.object.textEditorModel}catch{return[]}let l=await this.editorSymbolsQuickAccess.getSymbolPicks(s,o,{extraContainerLabel:Du(e.label)},n,r);return r.isCancellationRequested?[]:l.map(c=>c.type==="separator"?c:{...c,resource:t,description:c.description,trigger:(u,p)=>(this.openAnything(t,{keyMods:p,range:c.range?.selection,forceOpenSideBySide:!0}),1),accept:(u,p)=>this.openAnything(t,{keyMods:u,range:c.range?.selection,preserveFocus:p.inBackground,forcePinned:p.inBackground})})}addDecorations(e,t){this.editorSymbolsQuickAccess.addDecorations(e,t)}clearDecorations(e){this.editorSymbolsQuickAccess.clearDecorations(e)}createAnythingPick(e,t){let o=!A.isUri(e),n,r,s,l,c,u;if(ya(e))n=po.getOriginalUri(e),r=e.getName(),s=e.getDescription(),l=e.isDirty()&&!e.isSaving(),c=e.getLabelExtraClasses(),u=e.getIcon();else{n=A.isUri(e)?e:e.resource;let f=this.customEditorLabelService.getName(n);r=f||sl(n),s=this.labelService.getUriLabel(f?n:ai(n),{relative:!0}),l=this.workingCopyService.isDirty(n)&&!this.filesConfigurationService.hasShortAutoSaveDelay(n),c=[]}let p=s?`${r} ${s}`:r,h=new uo(()=>Ia(this.modelService,this.languageService,n,void 0,u).concat(c)),g=new uo(()=>{let f=t.openSideBySideDirection,v=[];return v.push({iconClass:f==="right"?q.asClassName(L.splitHorizontal):q.asClassName(L.splitVertical),tooltip:f==="right"?d(15015,null):d(15014,null)}),o&&v.push({iconClass:l?"dirty-anything "+q.asClassName(L.circleFilled):q.asClassName(L.close),tooltip:d(15008,null),alwaysVisible:l}),v});return{resource:n,label:r,ariaLabel:l?d(15010,null,p):p,description:s,iconPath:A.isUri(u)?{dark:u}:void 0,get iconClasses(){return h.value},get buttons(){return g.value},trigger:(f,v)=>{switch(f){case 0:return this.openAnything(e,{keyMods:v,range:this.pickState.lastRange,forceOpenSideBySide:!0}),1;case 1:if(!A.isUri(e))return this.historyService.removeFromHistory(e),3}return 0},accept:(f,v)=>this.openAnything(e,{keyMods:f,range:this.pickState.lastRange,preserveFocus:v.inBackground,forcePinned:v.inBackground}),attach:(f,v)=>{if(f.shift){let b=this.chatWidgetService.lastFocusedWidget;b&&n&&b.attachmentModel.addContext(b.attachmentModel.asFileVariableEntry(n));return}this.openAnything(e,{keyMods:f,range:this.pickState.lastRange,preserveFocus:v.inBackground,forcePinned:v.inBackground})}}}async openAnything(e,t){let o={preserveFocus:t.preserveFocus,pinned:t.keyMods?.ctrlCmd||t.forcePinned||this.configuration.openEditorPinned,selection:t.range?G.collapseToStart(t.range):void 0},n=t.keyMods?.alt||this.configuration.openEditorPinned&&t.keyMods?.ctrlCmd||t.forceOpenSideBySide?En:tr;if(n===En&&await this.pickState.editorViewState.restore(),ya(e))await this.editorService.openEditor(e,o,n);else{let r;A.isUri(e)?r={resource:e,options:o}:r={...e,options:{...e.options,...o}},await this.editorService.openEditor(r,n)}}};qC=I([m(0,F),m(1,Gg),m(2,Ae),m(3,Pn),m(4,Mt),m(5,ge),m(6,nt),m(7,_t),m(8,Rt),m(9,$a),m(10,B),m(11,ie),m(12,fa),m(13,fr),m(14,Bt),m(15,gt),m(16,$e),m(17,Le),m(18,X),m(19,JD),m(20,re),m(21,nb),m(22,Lt)],qC);function G6(a,i){do if(i.includes(a))return!0;while(!SO(a.parent())&&(a=a.parent()));return!1}var A_o="plainTextSearch",N_o="aiTextSearch";function AFi(a){let i=[],e=a;for(;!Pv(e);)i.push(e),e=e.parent();return i}var O_o="SEARCH_MODEL_",NFi="SEARCH_RESULT_",TBe="TEXT_SEARCH_HEADING_",Elt="FOLDER_MATCH_",Tlt="FILE_MATCH_",_lt="MATCH_";function w5t(a){let i={elements:[],added:!1,removed:!1};return a.forEach(e=>{e.added&&(i.added=!0),e.removed&&(i.removed=!0),i.elements=i.elements.concat(e.elements)}),i}function SO(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(NFi)}function Pv(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(TBe)}function F_o(a){return Pv(a)&&typeof a.replace=="function"&&typeof a.replaceAll=="function"}function ru(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Elt)}function q6(a){return ru(a)&&a.resource instanceof A}function m$(a){return q6(a)&&typeof a.createAndConfigureFileMatch=="function"}function TV(a){return ru(a)&&typeof a.createAndConfigureFileMatch=="function"}function Bl(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(Tlt)}function pl(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(_lt)}function W_o(a){return typeof a=="object"&&a!==null&&typeof a.id=="function"&&a.id().startsWith(TBe)}function Dlt(a){let i=[],e=[];return a.forEach(t=>{Bl(t)?e.push(t):i.push(t)}),e.concat(i.map(t=>t.allDownstreamFileMatches()).flat())}var _Be=class extends z{async run(i){let e=i.get(F),t=i.get(Je),o=e.createInstance(bO),n=d(8442,null),r=await o.selectPromptFile({placeholder:n,type:"agent",optionEdit:!1,optionVisibility:!0});r!==void 0&&await t.open(r.promptFile)}},V_o="workbench.action.chat.picker.customagents";function H_o(a){return{id:a?V_o+".disabled":V_o,title:P(8444,"Configure Custom Agents..."),tooltip:a?d(8443,null):void 0,icon:a?L.lock:void 0,category:fi,f1:!1,precondition:a?C.false():Z.Modes.agentModeDisabledByPolicy.negate(),menu:{id:R.ChatModePicker,when:a?Z.Modes.agentModeDisabledByPolicy:Z.Modes.agentModeDisabledByPolicy.negate()}}}var OFi=class extends _Be{constructor(){super(H_o(!1))}},FFi=class extends _Be{constructor(){super(H_o(!0))}},B_o="workbench.action.chat.configure.customagents";function U_o(a){let i={id:a?B_o+".disabled":B_o,title:P(8440,"Configure Custom Agents..."),shortTitle:d(8441,null),icon:a?L.lock:L.bookmark,f1:!a,precondition:a?C.false():C.and(Z.enabled,Z.Modes.agentModeDisabledByPolicy.negate()),category:fi,menu:[{id:LC,when:C.and(Z.enabled,C.equals("view",Xr),a?Z.Modes.agentModeDisabledByPolicy:Z.Modes.agentModeDisabledByPolicy.negate()),order:10,group:"0_level"}]};return a?{...i,tooltip:d(8443,null)}:i}var WFi=class extends _Be{constructor(){super(U_o(!1))}},VFi=class extends _Be{constructor(){super(U_o(!0))}};function z_o(){W(WFi),W(VFi),W(OFi),W(FFi)}var K_o=C.and(Z.enabled,Ho.HasResource,Ho.LangId.isEqualTo(r_)),KFi=858,G_o="workbench.action.chat.run.prompt.current",ivn="workbench.action.chat.run.prompt",GFi="workbench.action.chat.configure.prompts",C5t=class extends z{constructor(i){super({id:i.id,title:i.title,f1:!1,precondition:Z.enabled,category:fi,icon:i.icon,keybinding:{when:C.and(me.editorTextFocus,K_o),weight:200,primary:i.keybinding},menu:[{id:R.EditorTitleRun,group:"navigation",order:i.alt?0:1,alt:i.alt,when:K_o}]})}async execute(i,e,t){let o=t.get(fe),n=t.get(jr),r=t.get(Lt);i||=ovn(t),Z5e(i,"Cannot find URI resource for an active text editor."),e===!0&&await o.executeCommand(Mh);let s=await r.revealWidget();return s&&(s.setInput(`/${await n.getPromptSlashCommandName(i,Ie.None)}`),await s.acceptInput()),s}},q_o=P(8570,"Run Prompt in Current Chat"),$_o=L.playCircle,BFi=class extends C5t{constructor(){super({id:G_o,title:q_o,icon:$_o,keybinding:KFi})}async run(i,e){return await super.execute(e,!1,i)}},HFi=class extends z{constructor(){super({id:ivn,title:P(8571,"Run Prompt..."),icon:L.bookmark,f1:!0,precondition:Z.enabled,keybinding:{when:Z.enabled,weight:200,primary:KFi},category:fi})}async run(i){let e=i.get(fe),t=i.get(F),o=i.get(jr),n=i.get(Lt),r=t.createInstance(bO),s=d(8566,null,nM.modifierLabels[Ao].ctrlKey),l=await r.selectPromptFile({placeholder:s,type:"prompt"});if(l===void 0)return;let{promptFile:c,keyMods:u}=l;u.ctrlCmd===!0&&await e.executeCommand(Mh);let p=await n.revealWidget();p&&(p.setInput(`/${await o.getPromptSlashCommandName(c,Ie.None)}`),await p.acceptInput(),p.focusInput())}},UFi=class extends z{constructor(){super({id:GFi,title:P(8567,"Configure Prompt Files..."),shortTitle:P(8568,"Prompt Files"),icon:L.bookmark,f1:!0,precondition:Z.enabled,category:fi,menu:{id:LC,when:C.and(Z.enabled,C.equals("view",Xr)),order:11,group:"0_level"}})}async run(i){let e=i.get(Je),o=i.get(F).createInstance(bO),n=d(8565,null),r=await o.selectPromptFile({placeholder:n,type:"prompt",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function ovn(a){let e=a.get(Qt).getActiveCodeEditor()?.getModel();if(e?.getLanguageId()===r_)return e.uri}var nvn="workbench.action.chat.run-in-new-chat.prompt.current",rvn=P(8569,"Run Prompt In New Chat"),svn=L.play,zFi=class extends C5t{constructor(){super({id:nvn,title:rvn,icon:svn,keybinding:KFi|2048,alt:{id:G_o,title:q_o,icon:$_o}})}async run(i,e){return await super.execute(e,!0,i)}};function j_o(){W(zFi),W(BFi),W(HFi),W(UFi)}var $Fi="workbench.action.chat.configure.skills",qFi=class extends z{constructor(){super({id:$Fi,title:P(8579,"Configure Skills..."),shortTitle:P(8580,"Skills"),icon:L.lightbulb,f1:!0,precondition:Z.enabled,category:fi,menu:{id:LC,when:C.and(Z.enabled,C.equals("view",Xr)),order:9,group:"1_level"}})}async run(i){let e=i.get(Je),o=i.get(F).createInstance(bO),n=d(8578,null),r=await o.selectPromptFile({placeholder:n,type:"skill",optionEdit:!1});r!==void 0&&await e.open(r.promptFile)}};function Q_o(){W(qFi)}function Y_o(a,i){let e=1,t=1;for(let o=0;o<i&&o<a.length;o++)a[o]===`
`?(e++,t=1):t++;return{line:e,column:t}}function avn(a,i,e,t){let o=Tx(a,["hooks",i]);if(!o||o.type!=="array"||!o.children)return;let n=0;for(let r=0;r<o.children.length;r++){if(o.children[r].type!=="object")continue;let l=Tx(a,["hooks",i,r,"hooks"]);if(l&&l.type==="array"&&l.children)for(let c=0;c<l.children.length;c++){if(n===e)return Tx(a,["hooks",i,r,"hooks",c,t]);n++}else{if(n===e)return Tx(a,["hooks",i,r,t]);n++}}}function DBe(a,i,e,t){let o=xM(a);if(!o)return;let n=avn(o,i,e,t);if(!n||n.type!=="string")return;let r=n.offset+1,s=n.offset+n.length-1,l=Y_o(a,r),c=Y_o(a,s);return{startLineNumber:l.line,startColumn:l.column,endLineNumber:c.line,endColumn:c.column}}function X_o(a,i){let e=["command","windows","linux","osx","bash","powershell"],t=a.split(`
`);for(let o=0;o<t.length;o++){let n=t[o],r=n.trimStart();if(!e.find(u=>r.startsWith(`${u}:`)||r.startsWith(`- ${u}:`)))continue;let l=n.indexOf(":"),c=n.indexOf(i,l+1);if(c!==-1){let u=c+i.length,p=u<n.length?n.charCodeAt(u):-1;if(p===-1||p===34||p===39||p===32||p===9)return{startLineNumber:o+1,startColumn:c+1,endLineNumber:o+1,endColumn:c+1+i.length}}}}async function J_o(a,i,e,t,o,n,r,s){let l=await a.listPromptFiles("hook",r),c=[];for(let u of l)try{let p=await i.readFile(u.uri),h=is(p.value.toString()),{hooks:g}=gDe(u.uri,h,t,o);for(let[f,{hooks:v,originalId:b}]of g){let S=yC[f];if(S)for(let y=0;y<v.length;y++){let w=v[y],x=G0(w,n)||d(8471,null);c.push({hookType:f,hookTypeLabel:S.label,command:w,commandLabel:x,fileUri:u.uri,filePath:e.getUriLabel(u.uri,{relative:!0}),index:y,originalHookTypeId:b})}}}catch(p){console.error("Failed to read or parse hook file",u.uri.toString(),p)}if(s?.additionalDisabledFileUris)for(let u of s.additionalDisabledFileUris)try{let p=await i.readFile(u),h=is(p.value.toString()),{hooks:g}=tlo(u,h,t,o);for(let[f,{hooks:v,originalId:b}]of g){let S=yC[f];if(S)for(let y=0;y<v.length;y++){let w=v[y],x=G0(w,n)||d(8471,null);c.push({hookType:f,hookTypeLabel:S.label,command:w,commandLabel:x,fileUri:u,filePath:e.getUriLabel(u,{relative:!0}),index:y,originalHookTypeId:b,disabled:!0})}}}catch(p){console.error("Failed to read or parse disabled hook file",u.toString(),p)}if(s?.includeAgentHooks){let u=await a.getCustomAgents(r);for(let p of u)if(!(!p.hooks||!p.enabled))for(let h of Object.values(fE)){let g=p.hooks[h];if(!g||g.length===0)continue;let f=yC[h];if(f)for(let v=0;v<g.length;v++){let b=g[v],S=G0(b,n)||d(8471,null);c.push({hookType:h,hookTypeLabel:f.label,command:b,commandLabel:S,fileUri:p.uri,filePath:e.getUriLabel(p.uri,{relative:!0}),index:v,originalHookTypeId:h,agentName:p.name})}}}return c}var lvn="workbench.action.chat.configure.hooks";function cvn(a){for(let i of Object.keys(a))if(rXe(i)!==void 0)return!0;return!1}function dvn(a,i){if(i){let e=NSi(a);if(e)return e}return a}async function Z_o(a,i,e,t,o,n,r){let s,l=await e.exists(a);if(l){let x=await e.readFile(a);try{s=A_(x.value.toString()),s.hooks||(s.hooks={})}catch{o.error(d(8463,null)),await t.openEditor({resource:a});return}}else s={hooks:{}};let c=sXe(a),u=c==="claude",p=!u&&cvn(s.hooks),h=u?PSi(i)??i:dvn(i,p),g;for(let x of Object.keys(s.hooks))if((u?MSi(x):rXe(x))===i||x===i){g=x;break}let f=g??h,v=OSi(c),b=s.hooks[f],S=Array.isArray(b)?b.length:0,y;if(l){let x=(await e.readFile(a)).value.toString(),M={tabSize:1,insertSpaces:!1,eol:x.includes(`\r
`)?`\r
`:`
`},N=rS(x,["hooks",f,S],v,M);y=c8(x,N)}else{let x={hooks:{[f]:[v]}};y=JSON.stringify(x,null,"	")}if(t.editors.find(x=>ze(x.resource,a))){await t.openEditor({resource:a,options:{pinned:!1}});let x=da(t.activeTextEditorControl);if(x&&x.hasModel()&&ze(x.getModel().uri,a)){let E=x.getModel();E.pushEditOperations([],[{range:E.getFullModelRange(),text:y}],()=>null);let M=DBe(y,f,S,"command");M&&M.endLineNumber!==void 0&&M.endColumn!==void 0&&(x.setSelection({startLineNumber:M.startLineNumber,startColumn:M.startColumn,endLineNumber:M.endLineNumber,endColumn:M.endColumn}),x.revealLineInCenter(M.startLineNumber))}else{await n.apply([new hl(a,{range:new G(1,1,Number.MAX_SAFE_INTEGER,1),text:y})],{label:d(8445,null)});let E=DBe(y,f,S,"command");await t.openEditor({resource:a,options:{selection:E,pinned:!1}})}}else{l?(await t.openEditor({resource:a,options:{pinned:!1}}),await n.apply([new hl(a,{range:new G(1,1,Number.MAX_SAFE_INTEGER,1),text:y})],{label:d(8445,null)})):await e.writeFile(a,Ke.fromString(y));let x=DBe(y,f,S,"command");r?await r(a,{selection:x}):await t.openEditor({resource:a,options:{selection:x,pinned:!1}})}}function x5t(a,i){return new Promise(e=>{let t=!1,o=r=>{t||(t=!0,n.dispose(),e(r))},n=new O;n.add(a.onDidAccept(()=>{o(a.activeItems[0])})),n.add(a.onDidTriggerButton(r=>{r===i&&o("back")})),n.add(a.onDidHide(()=>{o(void 0)}))})}async function RBe(a,i){let e=a.get(jr),t=a.get($e),o=a.get(ge),n=a.get(nt),r=a.get(ie),s=a.get(Ae),l=a.get(Pn),c=a.get(Ne),u=a.get(Ka),g=(await a.get(bo).getEnvironment())?.os??Ao,v=s.getWorkspace().folders[0]?.uri,b=await l.userHome(),S=b.fsPath??b.path,y=await J_o(e,o,n,v,S,g,Ie.None,{includeAgentHooks:!0}),w=new Map;for(let ae of y)w.set(ae.hookType,(w.get(ae.hookType)??0)+1);let x=new O,E=x.add(t.createQuickPick({useSeparators:!0})),M=t.backButton;E.show();let N=1,V,H,K,j,J=[],se=()=>J.pop();try{for(;;)switch(N){case 1:{let ae=([Re,xe])=>{let He=w.get(Re)??0,Ee=He>0?` (${He})`:"";return{label:`${xe.label}${Ee}`,description:xe.description,hookType:Re,hookTypeMeta:xe}},ce;if(i?.target){let Re=new Set(Object.values(qg[i.target]));ce=Object.entries(yC).filter(([xe])=>Re.has(xe)).map(ae)}else{let Re=new Set(Object.values(qg.vscode)),xe=new Set(Object.values(qg["github-copilot"])),He=Object.entries(yC),Ee=He.filter(([tt])=>Re.has(tt)&&xe.has(tt)),Te=He.filter(([tt])=>Re.has(tt)&&!xe.has(tt)),It=He.filter(([tt])=>!Re.has(tt)&&xe.has(tt));ce=[],Ee.length>0&&(ce.push({type:"separator",label:d(8469,null)}),ce.push(...Ee.map(ae))),Te.length>0&&(ce.push({type:"separator",label:d(8470,null)}),ce.push(...Te.map(ae))),It.length>0&&(ce.push({type:"separator",label:d(8468,null)}),ce.push(...It.map(ae)))}E.items=ce,E.value="",E.placeholder=d(8459,null),E.title=d(8462,null),E.buttons=[];let Se=await x5t(E,M);if(!Se||Se==="back")return;V=Se,J.push(1),N=2;break}case 2:{let ae=y.filter(xe=>xe.hookType===V.hookType),ce=ae.filter(xe=>!xe.agentName),Se=ae.filter(xe=>xe.agentName),Re=[];if(Re.push({label:`$(plus) ${d(8447,null)}`,isAddNewHook:!0,alwaysShow:!0}),ce.length>0){Re.push({type:"separator",label:d(8467,null)});for(let xe of ce){let He=n.getUriLabel(xe.fileUri,{relative:!0});Re.push({label:xe.commandLabel,description:He,hookEntry:xe})}}if(Se.length>0){let xe=[...new Set(Se.map(He=>He.agentName))];for(let He of xe){Re.push({type:"separator",label:d(8446,null,He)});for(let Ee of Se.filter(Te=>Te.agentName===He)){let Te=n.getUriLabel(Ee.fileUri,{relative:!0});Re.push({label:Ee.commandLabel,description:Te,hookEntry:Ee})}}}if(ae.length===0)H=Re[0];else{E.items=Re,E.value="",E.placeholder=d(8461,null),E.title=V.hookTypeMeta.label,E.buttons=[M];let xe=await x5t(E,M);if(xe==="back"){N=se()??1;break}if(!xe)return;H=xe,J.push(2)}if(H.hookEntry){let xe=H.hookEntry,He;if(xe.agentName)try{let Ee=await o.readFile(xe.fileUri),Te=G0(xe.command,g);Te&&(He=X_o(Ee.value.toString(),Te))}catch{}else{let Ee=Xao(xe.command,g);if(Ee)try{let Te=await o.readFile(xe.fileUri);He=DBe(Te.value.toString(),xe.originalHookTypeId,xe.index,Ee)}catch{}}i?.openEditor?await i.openEditor(xe.fileUri,{selection:He}):await r.openEditor({resource:xe.fileUri,options:{selection:He,pinned:!1}});return}N=3;break}case 3:{let ae=await e.listPromptFilesForStorage("hook","local",Ie.None),ce=[];if(ce.push({label:`$(new-file) ${d(8448,null)}`,isCreateNewFile:!0,alwaysShow:!0}),ae.length>0){ce.push({type:"separator",label:d(8466,null)});for(let Se of ae){let Re=n.getUriLabel(Se.uri,{relative:!0});ce.push({label:Re,fileUri:Se.uri})}}if(ae.length===0)K=ce[0];else{E.items=ce,E.value="",E.placeholder=d(8460,null),E.title=d(8458,null),E.buttons=[M];let Se=await x5t(E,M);if(Se==="back"){N=se()??2;break}if(!Se)return;K=Se,J.push(3)}if(K.fileUri){await Z_o(K.fileUri,V.hookType,o,r,c,u,i?.openEditor);return}N=4;break}case 4:{let ae=await e.getSourceFolders("hook");if(ae.length===0){c.error(d(8455,null));return}if(j=ae[0],ae.length>1){let ce=ae.map((Re,xe)=>{let He=n.getUriLabel(Re.uri,{relative:Re.storage==="local"});return{label:xe===0?d(8449,null,He):He,description:Re.source?bPt(Re.source):void 0,folder:Re}});E.items=ce,E.value="",E.placeholder=d(8456,null),E.title=d(8457,null),E.buttons=[M];let Se=await x5t(E,M);if(Se==="back"){N=se()??3;break}if(!Se)return;j=Se.folder,J.push(4)}N=5;break}case 5:{E.hide();let ae=await new Promise(mo=>{let dn=!1,No=Tn=>{dn||(dn=!0,_i.dispose(),mo(Tn))},_i=new O,ln=_i.add(t.createInputBox());ln.prompt=d(8452,null),ln.placeholder=d(8451,null),ln.title=d(8454,null),ln.buttons=[M],ln.ignoreFocusOut=!0,_i.add(ln.onDidAccept(async()=>{let Tn=ln.value;if(!Tn||!Tn.trim()){ln.validationMessage=d(8453,null);return}let Ko=Tn.trim();if(/[/\\:*?"<>|]/.test(Ko)){ln.validationMessage=d(8450,null);return}No(Ko)})),_i.add(ln.onDidChangeValue(()=>{ln.validationMessage=void 0})),_i.add(ln.onDidTriggerButton(Tn=>{Tn===M&&No("back")})),_i.add(ln.onDidHide(()=>{No(void 0)})),ln.show()});if(ae==="back"){E.show(),N=se()??4;break}if(!ae)return;await o.createFolder(j.uri);let ce=ae.endsWith(".json")?ae:`${ae}.json`,Se=A.joinPath(j.uri,ce);if(await o.exists(Se)){await Z_o(Se,V.hookType,o,r,c,u,i?.openEditor);return}let Re=sXe(Se),xe=Re==="claude",He=!xe&&!new Set(Object.values(qg.vscode)).has(V.hookType)&&new Set(Object.values(qg["github-copilot"])).has(V.hookType),Ee=xe?PSi(V.hookType)??V.hookType:He?NSi(V.hookType)??V.hookType:V.hookType,Te=He?{type:"command",[g===1?"powershell":"bash"]:""}:OSi(Re),It=He?g===1?"powershell":"bash":"command",tt={...He?{version:1}:{},hooks:{[Ee]:[Te]}},Oi=JSON.stringify(tt,null,"	");await o.writeFile(Se,Ke.fromString(Oi)),i?.onHookFileCreated?.(Se);let zt=DBe(Oi,Ee,0,It);i?.openEditor?await i.openEditor(Se,{selection:zt}):await r.openEditor({resource:Se,options:{selection:zt,pinned:!1}});return}}}finally{x.dispose()}}var jFi=class extends z{constructor(){super({id:lvn,title:P(8464,"Configure Hooks..."),shortTitle:P(8465,"Hooks"),icon:L.zap,f1:!0,precondition:Z.enabled,category:fi,menu:{id:LC,when:C.and(Z.enabled,C.equals("view",Xr)),order:12,group:"1_level"}})}async run(i){return RBe(i)}};function eDo(){W(jFi)}var Rlt=class extends z{constructor(e,t){super(e);this.promptType=t}async run(e,t){let o=e.get(F),n=e.get(Qt),r=e.get(Uo),s=e.get(ge),l=n.getActiveCodeEditor();if(!l)return;let c=l.getModel();if(!c)return;let u=await o.invokeFunction(z6,this.promptType,void 0,!0);if(!u)return;let p=await o.invokeFunction(jne,this.promptType,u.uri,Xb(c.uri));if(!p)return;let h=Ve(u.uri,p);c.uri.scheme===Q.untitled?await r.saveAs(c.uri,h,{from:c.uri}):await s.copy(c.uri,h),await n.openCodeEditor({resource:h},l)}};function QFi(a,i,e,t){return{id:a,title:i,metadata:{description:e},category:fi,f1:!1,menu:{id:R.EditorContent,when:C.and(C.equals(Ho.Scheme.key,Q.untitled),C.equals(Ho.LangId.key,t),C.notEquals(tG.key,0))}}}var uvn="workbench.action.chat.save-as-prompt",k5t=class extends Rlt{constructor(){super(QFi(uvn,P(8576,"Save As Prompt File"),P(8577,"Save as prompt file"),r_),"prompt")}},pvn="workbench.action.chat.save-as-agent",E5t=class extends Rlt{constructor(){super(QFi(pvn,P(8572,"Save As Agent File"),P(8573,"Save as agent file"),OYe),"agent")}},mvn="workbench.action.chat.save-as-instructions",T5t=class extends Rlt{constructor(){super(QFi(mvn,P(8574,"Save As Instructions File"),P(8575,"Save as instructions file"),NYe),"instructions")}};function tDo(){j_o(),M_o(),Q_o(),eDo(),W(k5t),W(T5t),W(E5t),z_o(),__o()}var hvn=/^[a-z0-9]([a-z0-9\-.]*[a-z0-9])?$/,gvn=/--|[.][.]/;function fvn(a){if(!a)return d(6664,null);if(a.length>64)return d(6665,null);if(!hvn.test(a))return d(6662,null);if(gvn.test(a))return d(6661,null)}function vvn(a){return a==="local"||a==="user"}function bvn(a){let i=a.order;return i===200||i===0||i===100}function iDo(a){return a.name?a.name:a.type==="skill"&&Be(a.uri).toLowerCase()==="skill.md"?Be(ai(a.uri)):Be(a.uri)}function _5t(a){let i=iDo(a),e=i.indexOf(":");return e>=0?i.substring(e+1):i}var YFi=class a extends z{static{this.ID="workbench.action.chat.createPlugin"}constructor(){super({id:a.ID,title:P(6653,"Create Plugin"),category:fi,f1:!0,precondition:Z.enabled,icon:L.save,menu:[{id:R.ViewTitle,when:C.and(C.equals("view",_Z),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),group:"navigation",order:2}]})}async run(i){let e=i.get($e),t=i.get(jr),o=i.get(xc),n=i.get(nn),r=i.get(ge),s=i.get(fe),l=i.get(Ne),[c,u,p,h,g]=await(async()=>{let K=new qe;try{return await Promise.all([t.listPromptFiles("instructions",K.token),t.listPromptFiles("prompt",K.token),t.listPromptFiles("agent",K.token),t.listPromptFiles("skill",K.token),t.listPromptFiles("hook",K.token)])}finally{K.dispose(!0)}})(),f=o.collections.get(),v=!1,b=()=>{let K=[],j=(se,ae,ce,Se)=>{let Re=v?se:se.filter(He=>vvn(He.storage));if(Re.length===0)return;let xe=Re.map(He=>({label:iDo(He),description:He.storage,resourceType:ae,promptPath:He,checked:!1}));K.push({label:ce,iconClass:q.asClassName(Se),checked:void 0,collapsed:!1,pickable:!1,children:xe})};j(c,"instruction",d(6656,null),L.book),j(u,"prompt",d(6666,null),L.comment),j(p,"agent",d(6652,null),L.copilot),j(h,"skill",d(6671,null),L.lightbulb),j(g,"hook",d(6655,null),L.zap);let J=[];for(let se of f){if(!v&&!bvn(se))continue;let ae=se.serverDefinitions.get();for(let ce of ae)J.push({label:ce.label,description:se.label,resourceType:"mcp",mcpServer:{collection:se,definition:ce},checked:!1})}return J.length>0&&K.push({label:d(6657,null),iconClass:q.asClassName(L.mcp),checked:void 0,collapsed:!1,pickable:!1,children:J}),K},S=new O,y=S.add(e.createQuickTree());y.placeholder=d(6669,null),y.matchOnDescription=!0,y.matchOnLabel=!0,y.sortByLabel=!1,y.title=d(6654,null),y.setItemTree(b());let w={iconClass:q.asClassName(L.filter),tooltip:d(6670,null)};y.buttons=[w],S.add(y.onDidTriggerButton(K=>{K===w&&(v=!v,y.setItemTree(b()))}));let x=await new Promise(K=>{S.add(y.onDidAccept(()=>{K(y.checkedLeafItems),y.hide()})),S.add(y.onDidHide(()=>{K(void 0)})),y.show()});if(S.dispose(),!x||x.length===0)return;let E=x.filter(K=>!!K.resourceType),M=await e.input({prompt:d(6663,null),placeHolder:"my-plugin",validateInput:async K=>fvn(K)});if(!M)return;let N=await n.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(6668,null),openLabel:d(6667,null)});if(!N||N.length===0)return;let V=N[0],H=Ve(V,M);if(await r.exists(H)){l.error(d(6660,null,M));return}try{await Svn(r,H,M,E),await Cvn(r,V,M);try{await s.executeCommand("revealFileInOS",H)}catch{}l.info(d(6658,null,M))}catch(K){l.error(d(6659,null,String(K)))}}};async function Svn(a,i,e,t){await a.createFolder(i);let o=Ve(i,".plugin");await a.createFolder(o);let n={name:e,version:"1.0.0",description:""};await a.writeFile(Ve(o,"plugin.json"),Ke.fromString(JSON.stringify(n,null,"	")));let r={instruction:t.filter(s=>s.resourceType==="instruction"),prompt:t.filter(s=>s.resourceType==="prompt"),agent:t.filter(s=>s.resourceType==="agent"),skill:t.filter(s=>s.resourceType==="skill"),hook:t.filter(s=>s.resourceType==="hook"),mcp:t.filter(s=>s.resourceType==="mcp")};if(r.instruction.length>0){let s=Ve(i,"rules");await a.createFolder(s);for(let l of r.instruction){if(!l.promptPath)continue;let c=_5t(l.promptPath),u=c.endsWith(".instructions.md")||c.endsWith(".mdc")||c.endsWith(".md")?c:c+".instructions.md",p=await a.readFile(l.promptPath.uri);await a.writeFile(Ve(s,u),p.value)}}if(r.prompt.length>0){let s=Ve(i,"commands");await a.createFolder(s);for(let l of r.prompt){if(!l.promptPath)continue;let c=_5t(l.promptPath),u=c.endsWith(".md")?c:c+".md",p=await a.readFile(l.promptPath.uri);await a.writeFile(Ve(s,u),p.value)}}if(r.agent.length>0){let s=Ve(i,"agents");await a.createFolder(s);for(let l of r.agent){if(!l.promptPath)continue;let c=_5t(l.promptPath),u=c.endsWith(".md")?c:c+".md",p=await a.readFile(l.promptPath.uri);await a.writeFile(Ve(s,u),p.value)}}if(r.skill.length>0){let s=Ve(i,"skills");await a.createFolder(s);for(let l of r.skill){if(!l.promptPath)continue;let c=l.promptPath.uri,u=_5t(l.promptPath),g=Be(c).toLowerCase()==="skill.md"?Ve(c,".."):c,f=Ve(s,u);await oDo(a,g,f)}}if(r.hook.length>0){let s=Ve(i,"hooks");await a.createFolder(s);let l={};for(let u of r.hook)if(u.promptPath)try{let p=await a.readFile(u.promptPath.uri),h=A_(p.value.toString()),g=h?.hooks??h;if(g&&typeof g=="object"){for(let[f,v]of Object.entries(g))if(Array.isArray(v)){l[f]||(l[f]=[]);for(let b of v)l[f].push(Ivn(b))}}}catch{}let c={hooks:l};await a.writeFile(Ve(s,"hooks.json"),Ke.fromString(JSON.stringify(c,null,"	")))}if(r.mcp.length>0){let s={};for(let c of r.mcp){if(!c.mcpServer)continue;let u=c.mcpServer.definition;s[u.label]=yvn(u.launch)}let l={mcpServers:s};await a.writeFile(Ve(i,".mcp.json"),Ke.fromString(JSON.stringify(l,null,"	")))}}function Ivn(a){let i={type:"command"};return typeof a.command=="string"&&(i.command=a.command),typeof a.windows=="string"&&(i.windows=a.windows),typeof a.linux=="string"&&(i.linux=a.linux),typeof a.osx=="string"&&(i.osx=a.osx),a.cwd!==void 0&&(i.cwd=jm(a.cwd)?A.revive(a.cwd).fsPath:String(a.cwd)),a.env&&typeof a.env=="object"&&Object.keys(a.env).length>0&&(i.env=a.env),typeof a.timeout=="number"&&(i.timeout=a.timeout),i}function yvn(a){if(a.type===1){let i={type:"stdio",command:a.command};return a.args.length>0&&(i.args=[...a.args]),a.cwd&&(i.cwd=a.cwd),Object.keys(a.env).length>0&&(i.env={...a.env}),i}else{let i={type:"http",url:a.uri.toString()};if(a.headers.length>0){let e={};for(let[t,o]of a.headers)e[t]=o;i.headers=e}return i}}async function oDo(a,i,e){let t=await a.resolve(i);if(t.isDirectory){if(await a.createFolder(e),t.children)for(let o of t.children){let n=Be(o.resource);await oDo(a,o.resource,Ve(e,n))}}else{let o=await a.readFile(i);await a.writeFile(e,o.value)}}var wvn=["marketplace.json",".plugin/marketplace.json"];async function Cvn(a,i,e){for(let t of wvn){let o=Ve(i,t);if(await a.exists(o)){try{let n=await a.readFile(o),r=A_(n.value.toString());if(r&&typeof r=="object"){Array.isArray(r.plugins)||(r.plugins=[]);let s=r.plugins;if(s.some(l=>l.name===e))return;s.push({name:e,source:`./${e}/`}),await a.writeFile(o,Ke.fromString(JSON.stringify(r,null,"	")))}}catch{}return}}}function nDo(){let a=new O;return a.add(W(YFi)),a}function sDo(){let a=new O;return a.add(W(i0i)),a.add(W(XFi)),a.add(W(JFi)),a.add(W(e0i)),a.add(W(t0i)),a.add(W(ZFi)),a.add(nDo()),tDo(),a}async function R5t(a){let i=a.get(Lt),e=i.lastFocusedWidget;return!e||e.location==="panel"?i.revealWidget():e}var D5t=class extends z{async run(i,...e){let t=i.get(F),o=await t.invokeFunction(R5t);if(o)return t.invokeFunction(this.runWithWidget.bind(this),o,...e)}_getResources(i,...e){let t=i.get(ie),o=Spe(e[1])?this._getEditorResources(i,...e):Array.isArray(e[1])?e[1]:[e[0]],n=[];for(let r of o){let s;A.isUri(r)?s=r:Bl(r)?s=r.resource:pl(r)?s=r.parent().resource:!r&&t.activeTextEditorControl&&(s=po.getCanonicalUri(t.activeEditor,{supportSideBySide:1})),s&&[Q.file,Q.vscodeRemote,Q.untitled].includes(s.scheme)&&n.push(s)}return n}_getEditorResources(i,...e){return Zp(e,i.get(ie),i.get(kt),i.get(Co)).groupedEditors.flatMap(o=>o.editors).map(o=>po.getCanonicalUri(o,{supportSideBySide:1})).filter(o=>o!==void 0)}},XFi=class a extends D5t{static{this.ID="workbench.action.chat.attachFile"}constructor(){super({id:a.ID,title:P(6467,"Add File to Chat"),category:fi,icon:L.attach,precondition:Z.enabled,f1:!0,menu:[{id:R.SearchContext,group:"z_chat",order:1,when:C.and(Z.enabled,Ri.FileMatchOrMatchFocusKey,Ri.SearchResultHeaderFocused.negate())},{id:R.ExplorerContext,group:"5_chat",order:1,when:C.and(Z.enabled,gu.negate(),C.or(Ho.Scheme.isEqualTo(Q.file),Ho.Scheme.isEqualTo(Q.vscodeRemote)))},{id:R.EditorTitleContext,group:"2_chat",order:1,when:C.and(Z.enabled,C.or(Ho.Scheme.isEqualTo(Q.file),Ho.Scheme.isEqualTo(Q.vscodeRemote)))},{id:R.EditorContext,group:"1_chat",order:2,when:C.and(Z.enabled,me.hasNonEmptySelection.negate(),C.or(Ho.Scheme.isEqualTo(Q.file),Ho.Scheme.isEqualTo(Q.vscodeRemote),Ho.Scheme.isEqualTo(Q.untitled),Ho.Scheme.isEqualTo(Q.vscodeUserData)))},{id:R.InlineChatEditorAffordance,group:"0_chat",order:3,when:C.and(Z.enabled,me.hasNonEmptySelection.negate())},{id:R.ChatEditorInlineMenu,group:"0_chat",order:3,when:C.and(Z.enabled,me.hasNonEmptySelection.negate())}]})}async runWithWidget(i,e,...t){let o=this._getResources(i,...t);if(o.length&&e){e.focusInput();for(let n of o)e.attachmentModel.addFile(n)}}},JFi=class a extends D5t{static{this.ID="workbench.action.chat.attachFolder"}constructor(){super({id:a.ID,title:P(6468,"Add Folder to Chat"),category:fi,f1:!1,menu:{id:R.ExplorerContext,group:"5_chat",order:1,when:C.and(Z.enabled,gu,C.or(Ho.Scheme.isEqualTo(Q.file),Ho.Scheme.isEqualTo(Q.vscodeRemote)))}})}async runWithWidget(i,e,...t){let o=this._getResources(i,...t);if(o.length&&e){e.focusInput();for(let n of o)e.attachmentModel.addFolder(n)}}},ZFi=class a extends z{static{this.ID="workbench.action.chat.attachPinnedEditors"}constructor(){super({id:a.ID,title:P(6469,"Add Pinned Editors to Chat"),category:fi,precondition:Z.enabled,f1:!0})}async run(i){let e=i.get(kt),o=await i.get(F).invokeFunction(R5t);if(!o)return;let n=[];for(let r of e.groups)for(let s of r.editors)if(r.isPinned(s)){let l=po.getCanonicalUri(s,{supportSideBySide:1});l&&[Q.file,Q.vscodeRemote,Q.untitled].includes(l.scheme)&&n.push(l)}if(n.length){o.focusInput();for(let r of n)o.attachmentModel.addFile(r)}}},e0i=class a extends z{static{this.ID="workbench.action.chat.attachSelection"}constructor(){super({id:a.ID,title:P(6470,"Add Selection to Chat"),category:fi,icon:L.attach,f1:!0,precondition:Z.enabled,menu:[{id:R.EditorContext,group:"1_chat",order:1,when:C.and(Z.enabled,me.hasNonEmptySelection,C.or(Ho.Scheme.isEqualTo(Q.file),Ho.Scheme.isEqualTo(Q.vscodeRemote),Ho.Scheme.isEqualTo(Q.untitled),Ho.Scheme.isEqualTo(Q.vscodeUserData)))},{id:R.InlineChatEditorAffordance,group:"0_chat",order:2,when:C.and(Z.enabled,me.hasNonEmptySelection)},{id:R.ChatEditorInlineMenu,group:"0_chat",order:2,when:C.and(Z.enabled,me.hasNonEmptySelection)}]})}async run(i,...e){let t=i.get(ie),o=await i.get(F).invokeFunction(R5t);if(!o)return;let[n,r]=e;if(r&&r.length>0){let s=new Map;for(let l of r)if(Bl(l))s.set(l.resource,void 0);else{let c={uri:l._parent.resource,range:l._range},u=s.get(c.uri);(!u||u.startLineNumber!==c.range.startLineNumber&&u.endLineNumber!==c.range.endLineNumber)&&(s.set(c.uri,c.range),o.attachmentModel.addFile(c.uri,c.range))}for(let l of s){let[c,u]=l;u||o.attachmentModel.addFile(c)}}else{let s=t.activeTextEditorControl,l=po.getCanonicalUri(t.activeEditor,{supportSideBySide:1});if(s&&l&&[Q.file,Q.vscodeRemote,Q.untitled].includes(l.scheme)){let c=s.getSelection();if(c){o.focusInput();let u=c.isEmpty()?new G(c.startLineNumber,1,c.startLineNumber+1,1):c;o.attachmentModel.addFile(l,u)}}}}},t0i=class a extends z{static{this.Name="searchResults"}constructor(){super({id:"workbench.action.chat.insertSearchResults",title:P(6463,"Add Search Results to Chat"),category:fi,f1:!1,menu:[{id:R.SearchContext,group:"z_chat",order:3,when:C.and(Z.enabled,Ri.SearchResultHeaderFocused)}]})}async run(i){let e=i.get(re),t=await i.get(F).invokeFunction(R5t);if(!t){e.trace("InsertSearchResultAction: no chat view available");return}let o=t.inputEditor,n=o.getSelection()??o.getModel()?.getFullModelRange().collapseToEnd();if(!n){e.trace("InsertSearchResultAction: no selection");return}let r=`#${a.Name}`,s=new G(n.startLineNumber,n.startColumn,n.endLineNumber,n.startLineNumber+r.length),l=o.getModel();if(l&&l.getValueInRange(new G(n.startLineNumber,n.startColumn-1,n.startLineNumber,n.startColumn))!==" "&&(r=" "+r),!o.executeEdits("chatInsertSearch",[{range:s,text:r+" "}])){e.trace(`InsertSearchResultAction: failed to insert "${r}"`);return}}};function xvn(a){return Di(a)&&typeof a.kind=="string"&&a.kind==="contextPick"}function kvn(a){return Di(a)&&typeof a.symbolName=="string"&&!!a.uri&&!!a.range}function rDo(a){return Di(a)&&A.isUri(a.resource)}var i0i=class extends z{constructor(){super({id:"workbench.action.chat.attachContext",title:P(6466,"Add Context..."),icon:L.add,category:fi,keybinding:{when:C.and(Z.inChatInput,Z.location.isEqualTo("panel")),primary:2138,weight:100},menu:[{when:C.and(Z.inQuickChat.negate(),Z.location.isEqualTo("panel"),C.or(Z.lockedToCodingAgent.negate(),Z.agentSupportsAttachments)),id:R.ChatInput,group:"navigation",order:-1},{when:C.and(Z.inQuickChat.negate(),Z.location.isEqualTo("editor"),yfe,C.or(Z.lockedToCodingAgent.negate(),Z.agentSupportsAttachments)),id:R.ChatInput,group:"navigation",order:2},{when:C.and(Z.inQuickChat,C.or(Z.lockedToCodingAgent.negate(),Z.agentSupportsAttachments)),id:R.ChatExecute,group:"navigation",order:-1}]})}async run(i,...e){let t=i.get(F),o=i.get(Lt),n=i.get(X),r=i.get(Le),s=i.get(iI),l=e[0],c=l?.widget??o.lastFocusedWidget;if(!c)return;let u=[];for(let p of s.items)p.isEnabled&&!await p.isEnabled(c)||u.push({kind:"contextPick",item:p,label:p.label,iconClass:q.asClassName(p.icon),keybinding:p.commandId?r.lookupKeybinding(p.commandId,n):void 0});t.invokeFunction(this._show.bind(this),c,u,l?.placeholder)}_show(i,e,t,o){let n=i.get($e),r=i.get(JD),s=i.get(F),l=i.get(fe),c={filter:u=>rDo(u)&&u.resource?s.invokeFunction(p=>Q_e(p,u.resource.scheme)):!0,additionPicks:t,handleAccept:async(u,p)=>{if(xvn(u)){let h=!0;if(u.item.type==="valuePick"?this._handleContextPick(u.item,e):u.item.type==="pickerPick"&&(h=await this._handleContextPickerItem(n,l,u.item,e)),!h){s.invokeFunction(this._show.bind(this),e,t,o);return}}else s.invokeFunction(this._handleQPPick.bind(this),e,p,u);y$t(e)&&r.open()}};n.quickAccess.show("",{enabledProviderPrefixes:[qC.PREFIX,HE.PREFIX,XR.PREFIX],placeholder:o??d(6464,null),providerOptions:c})}async _handleQPPick(i,e,t,o){let n=i.get(ge),r=i.get(Bt),s=i.get(nV),l=[];if(rDo(o)&&o.resource)if(/\.(png|jpg|jpeg|bmp|gif|tiff)$/i.test(o.resource.path)){if(A.isUri(o.resource)){let c=await n.readFile(o.resource),u=await JA(c.value.buffer);l.push({id:o.resource.toString(),name:o.label,fullName:o.label,value:u,kind:"image",references:[{reference:o.resource,kind:"reference"}]})}}else if(o.resource.scheme===Q.vscodeBrowser){let c=await s.resolveEditorAttachContext({resource:o.resource});c&&l.push(c)}else{let c=0;try{(await r.createModelReference(o.resource)).dispose()}catch{c=2}l.push({kind:"file",id:o.resource.toString(),value:o.resource,name:o.label,omittedState:c})}else kvn(o)&&o.uri&&o.range&&l.push({kind:"generic",id:JSON.stringify({uri:o.uri,range:o.range.decoration}),value:{uri:o.uri,range:o.range.decoration},fullName:o.label,name:o.symbolName});e.attachmentModel.addContext(...l),t||e.focusInput()}async _handleContextPick(i,e){let t=await i.asAttachment(e);Array.isArray(t)?e.attachmentModel.addContext(...t):t&&e.attachmentModel.addContext(t)}async _handleContextPickerItem(i,e,t,o){let n=t.asPicker(o),r=new O,s={label:d(6465,null),alwaysShow:!0},l=n.configure?{label:n.configure.label,commandId:n.configure.commandId,alwaysShow:!0}:void 0,c=[{type:"separator"}];l&&c.push(l),c.push(s);let u=r.add(i.createQuickPick({useSeparators:!0})),p=new qe;if(r.add(u.onDidHide(()=>p.cancel())),r.add(ee(()=>p.dispose(!0))),u.placeholder=n.placeholder,u.matchOnDescription=!0,u.matchOnDetail=!0,u.canAcceptInBackground=!0,u.busy=!0,u.show(),aD(n.picks)){let f=await n.picks.then(v=>[].concat(v,c));u.items=f,u.busy=!1}else{let f=De("attachContext.query",u.value);r.add(u.onDidChangeValue(()=>f.set(u.value,void 0)));let v=n.picks(f,p.token);r.add(ve(b=>{let{busy:S,picks:y}=v.read(b);u.items=[].concat(y,c),u.busy=S}))}if(p.token.isCancellationRequested)return n.dispose?.(),!0;let h=new Mo,g=[];r.add(u.onDidAccept(async f=>{let v="noop",[b]=u.selectedItems;if(Mmo(b)){let S=b.asAttachment();if(!S||S===v)return;aD(S)?g.push(S.then(y=>{y!==v&&o.attachmentModel.addContext(...Ec(y))})):o.attachmentModel.addContext(...Ec(S))}if(b===s){if(n.goBack?.())return;h.complete(!1)}b===l&&(h.complete(!0),e.executeCommand(l.commandId)),f.inBackground||h.complete(!0)})),r.add(u.onDidHide(()=>{h.complete(!0),n.dispose?.()}));try{let f=await h.p;return u.busy=!0,await Promise.all(g),f}finally{r.dispose()}}};var LBe={ParseError:-32700,InvalidRequest:-32600,MethodNotFound:-32601,InvalidParams:-32602,InternalError:-32603},Qne={SessionNotFound:-32001,ProviderNotFound:-32002,SessionAlreadyExists:-32003,TurnInProgress:-32004,UnsupportedProtocolVersion:-32005,ContentNotFound:-32006,AuthRequired:-32007,NotFound:-32008,PermissionDenied:-32009,AlreadyExists:-32010};var aDo=-32005;var lDo=-32007;function cDo(a){return"method"in a&&"id"in a}function dDo(a){return"method"in a&&!("id"in a)}function uDo(a){return"id"in a&&!("method"in a)}var $C=class extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}};var WMh=le("tunnelAgentHostService");var pDo="tunnel:";var VMh=le("tunnelAgentHostMainService");var BMh=le("tunnelAgentHostHostingService");var VP;(u=>{u.connected=Object.freeze({kind:"connected"}),u.connecting=Object.freeze({kind:"connecting"}),u.disconnected=Object.freeze({kind:"disconnected"});function t(p,h,g,f){return Object.freeze({kind:"incompatible",message:p,supportedByClient:h,offeredByServer:g,vscodeUpgradeMethod:f})}u.incompatible=t;function o(p){return p?.kind==="connected"}u.isConnected=o;function n(p){return p?.kind==="connecting"}u.isConnecting=n;function r(p){return p?.kind==="disconnected"}u.isDisconnected=r;function s(p){return p?.kind==="incompatible"}u.isIncompatible=s;function l(p){return p?.kind!=="connected"}u.isUnavailable=l;function c(p,h){if(p instanceof $C&&p.code===aDo){let g=p.data,f=Array.isArray(g?.supportedVersions)?g.supportedVersions:void 0,v=typeof g?._meta?.vscodeUpgradeMethod=="string"?g._meta.vscodeUpgradeMethod:void 0;return t(p.message,h,f,v)}}u.fromConnectError=c})(VP||={});var Jve="chat.remoteAgentHosts",MBe="chat.remoteAgentHostsEnabled";function _V(a){switch(a.connection.type){case"websocket":case"ssh":return a.connection.address;case"tunnel":return`${pDo}${a.connection.tunnelId}`}}var PBe=le("remoteAgentHostService");function L5t(a){return a.sshConfigHost||a.sshHostName||a.sshUser||a.sshPort?{name:a.name,connectionToken:a.connectionToken,connection:{type:"ssh",address:a.address,sshConfigHost:a.sshConfigHost,hostName:a.sshHostName??a.address,user:a.sshUser,port:a.sshPort}}:{name:a.name,connectionToken:a.connectionToken,connection:{type:"websocket",address:a.address}}}function M5t(a){switch(a.connection.type){case"ssh":return{address:a.connection.address,name:a.name,connectionToken:a.connectionToken,sshConfigHost:a.connection.sshConfigHost,sshHostName:a.connection.hostName,sshUser:a.connection.user,sshPort:a.connection.port};case"websocket":return{address:a.connection.address,name:a.name,connectionToken:a.connectionToken};case"tunnel":return}}var n0i="copilotcli",r0i=`agent-host-${n0i}`,Tvn=n0i,mDo="remote-",hDo=`-${n0i}`;function _vn(a,i){return Ve(a,".copilot","session-state",i,"events.jsonl")}function Dvn(a,i){let e=a.defaultDirectory;if(!e)return;let t=e.endsWith("/")?e.slice(0,-1):e,o=A.from({scheme:"file",path:`${t}/.copilot/session-state/${i}/events.jsonl`}),n=VM(a.address);return $S(o,n)}function s0i(a){return!a.startsWith(mDo)||!a.endsWith(hDo)?void 0:a.slice(mDo.length,a.length-hDo.length)||void 0}function P5t(a,i,e){if(!a)return{kind:"no-session"};let t=a.path.startsWith("/")?a.path.substring(1):a.path;if(!t)return{kind:"no-session"};if(a.scheme===r0i||a.scheme===Tvn)return{kind:"ok",resource:_vn(i,t)};let o=s0i(a.scheme);if(o){let n=e(o);if(!n)return{kind:"remote-not-connected",authority:o};let r=Dvn(n,t);return r?{kind:"ok",resource:r}:{kind:"remote-no-home",authority:o}}return{kind:"unsupported-scheme",scheme:a.scheme}}var gDo="agenthost",Rvn="rendererLog",Lvn="shared",a0i=le("agentHostDebugLogsExportService"),A5t=class{constructor(i,e){this.fileDialogService=i;this.fileService=e}async save(i,e){await Fvn(this.fileDialogService,this.fileService,i,e)}};A5t=I([m(0,nn),m(1,ge)],A5t);async function Mvn(a,i){let e=a.get(Pn),t=a.get(hk),o=a.get(PBe),n=a.get(Tl),r=a.get(ge),s=a.get(Ne),l=a.get(Bt),c=a.get(Ze),u=a.get(re),p=a.get(ko),h=e.userHome({preferLocal:!0}),g=P5t(i?.resource,h,w=>o.connections.find(x=>VM(x.address)===w)),f=new Set,v,b;if(i)if(i.isLocal){f.add(gDo),f.add(`agenthost.${t.clientId}`);let w=Ovn(t.clientId);b=x=>x.includes(w)}else v=Nvn(i.resource,o.connections),v&&f.add(`agenthost.${v.clientId}`);else{f.add(gDo),f.add(`agenthost.${t.clientId}`);for(let w of o.connections)f.add(`agenthost.${w.clientId}`)}f.add(Rvn),f.add(Lvn);let S=[];if(g.kind==="ok")try{let w=await r.readFile(g.resource);S.push({path:"events.jsonl",contents:w.value.toString()})}catch{}for(let w of f){let x=n.getChannel(w),E=n.getChannelDescriptor(w);if(!x||!E)continue;let M=await l.createModelReference(x.uri);try{let N=`${E.label.replace(/[/\\:*?"<>|]/g,"-")}.log`;S.push({path:N,contents:M.object.textEditorModel.getValue()})}finally{M.dispose()}}try{let w=Ve(p.logsHome,"ahp"),x=await r.resolve(w,{resolveMetadata:!0});for(let E of x.children??[])if(!(E.isDirectory||!E.name.endsWith(".jsonl")||b&&!b(E.name)))try{let M=await r.readFile(E.resource);S.push({path:`ahp/${E.name}`,contents:M.value.toString()})}catch(M){u.warn(`[ExportAgentHostDebugLogs] Failed to read AHP log '${E.name}': ${M instanceof Error?M.message:String(M)}`)}}catch{}if(v?.defaultDirectory)try{let w=await Vvn(v,c.serverDataFolderName,r);w&&S.push({path:"remote-agenthost.log",contents:w})}catch(w){u.warn(`[ExportAgentHostDebugLogs] Failed to download remote agenthost.log: ${w instanceof Error?w.message:String(w)}`)}if(S.length===0){s.notify({severity:ft.Warning,message:i?d(6674,null):d(6675,null)});return}let y=i?.title?`-${i.title.replace(/[/\\:*?"<>|\s]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}`:"";return{files:S,exportName:`ah-logs${y}`}}async function Pvn(a,i){let e=a.get(a0i),t=a.get(Ne),o=await Mvn(a,i);if(o)try{await e.save(o.exportName,o.files)}catch(n){t.notify({severity:ft.Error,message:d(6676,null,n instanceof Error?n.message:String(n))})}}var N5t=class a extends z{static{this.ID="workbench.action.chat.exportAgentHostDebugLogs"}constructor(){super({id:a.ID,title:P(6672,"Export Agent Host Debug Logs..."),f1:!0,category:Fe.Developer,precondition:C.and(Z.enabled,C.equals(`config.${mk}`,!0))})}async run(i){let o=i.get(Lt).lastFocusedWidget?.viewModel?.model,n=o?Avn(o.sessionResource,o.title):void 0;await Pvn(i,n)}};function Avn(a,i){if(a.scheme===r0i)return{resource:a,title:i,isLocal:!0};if(s0i(a.scheme))return{resource:a,title:i,isLocal:!1}}function Nvn(a,i){return i.find(e=>a.scheme.startsWith(`remote-${VM(e.address)}-`))}function Ovn(a){return a.replace(/[\\/:\*\?"<>|\s]+/g,"-").replace(/^-+|-+$/g,"")||"connection"}async function Fvn(a,i,e,t){let n=(await a.showOpenDialog({title:d(6673,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,availableFileSystems:[Q.file]}))?.[0];if(!n)return;let r=Ve(n,e);await i.createFolder(r);for(let s of t){let l=Wvn(s.path);if(l.length===0)continue;let c=r;for(let u of l.slice(0,-1))c=Ve(c,u),await i.createFolder(c);await i.writeFile(Ve(c,l[l.length-1]),Ke.fromString(s.contents))}}function Wvn(a){return a.replace(/\\/g,"/").split("/").filter(i=>i.length>0&&i!=="."&&i!=="..").map(i=>i.replace(/[/\\:*?"<>|]/g,"-"))}async function Vvn(a,i,e){let t=a.defaultDirectory;if(!t)return;let o=VM(a.address),n=$S(A.from({scheme:"file",path:t}),o),r=new Set;i&&(r.add(i),i.endsWith("-dev")&&r.add(i.slice(0,-4))),r.add(".vscode-server"),r.add(".vscode-server-insiders"),r.add(".vscode-server-oss"),r.add(".vscode-server-exploration");let s;for(let c of r){let u=Ve(n,c,"data","logs"),p;try{p=(await e.resolve(u,{resolveMetadata:!0})).children}catch{continue}if(p)for(let h of p){if(!h.isDirectory)continue;let g=Ve(h.resource,"agenthost.log"),f;try{f=await e.resolve(g,{resolveMetadata:!0})}catch{continue}let v=f.mtime??0;(!s||v>s.mtime)&&(s={uri:g,mtime:v})}}return s?(await e.readFile(s.uri)).value.toString():void 0}async function Bvn(a,i){let e=a.get(Pn),t=a.get(PBe),o=a.get(ie),n=a.get(Ne),r=e.userHome({preferLocal:!0}),s=P5t(i,r,l=>t.connections.find(c=>VM(c.address)===l));switch(s.kind){case"ok":await o.openEditor({resource:s.resource});return;case"no-session":n.info(d(6679,null));return;case"unsupported-scheme":n.info(d(6681,null));return;case"remote-not-connected":n.warn(d(6680,null,s.authority));return;case"remote-no-home":n.warn(d(6678,null,s.authority));return}}var O5t=class a extends z{static{this.ID="workbench.action.chat.openCopilotCliStateFile"}constructor(){super({id:a.ID,title:P(6677,"Open Copilot CLI State File"),f1:!0,category:Fe.Developer,precondition:C.and(Z.enabled,qo.negate())})}async run(i){let t=i.get(Lt).lastFocusedWidget?.viewModel?.sessionResource;await Bvn(i,t)}};function fDo(a,i){return A.isUri(i)?i.toString():jm(i)?A.from(i).toString():i}function vDo(){W(l0i),W(c0i),W(d0i),W(u0i),W(p0i),W(m0i),W(O5t),W(N5t)}function Hvn(a){let i=a.get(si),e=a.get(Vc),t=i.getChatModelReferenceDebugInfo(),o=t.models.filter(l=>l.referenceCount>0),n=t.models.filter(l=>l.hasPendingEdits),r=t.models.filter(l=>l.pendingDisposal),s=`# Chat Model References

`;if(s+=`- Live models: ${t.totalModels}
`,s+=`- Live references: ${t.totalReferences}
`,s+=`- Models with active references: ${o.length}
`,s+=`- Models with pending edits: ${n.length}
`,s+=`- Models pending disposal: ${r.length}

`,s+=`Created by shows who loaded or created the model. Holders shows who currently keeps the model alive.

`,!t.models.length)return s+=`No live chat models.
`,s;for(let l of t.models){let c=i.getSession(l.sessionResource),u=e.getSession(l.sessionResource),p=u?u.isArchived():"unknown",h=c?ea(c.timing.created,!0,!0,!0):"unknown";if(s+=`## ${l.title||"(untitled)"}

`,s+=`- Session: ${l.sessionResource.toString()}
`,s+=`- Created by: ${l.createdBy}
`,s+=`- Archived: ${p}
`,s+=`- Age: ${h}
`,s+=`- Initial location: ${l.initialLocation}
`,s+=`- Imported: ${l.isImported}
`,s+=`- Pending edits: ${l.hasPendingEdits}
`,s+=`- Background keep-alive enabled: ${l.willKeepAlive}
`,s+=`- Pending disposal: ${l.pendingDisposal}
`,s+=`- Reference count: ${l.referenceCount}
`,l.holders.length){s+=`- Holders:
`;for(let g of l.holders)s+=`  - ${g.holder}: ${g.count}
`}else s+=`- Holders: none
`;s+=`
`}return s}var l0i=class a extends z{static{this.ID="workbench.action.chat.logInputHistory"}constructor(){super({id:a.ID,title:P(6489,"Log Chat Input History"),icon:L.attach,category:Fe.Developer,f1:!0,precondition:Z.enabled})}async run(i,...e){i.get(Lt).lastFocusedWidget?.logInputHistory()}},c0i=class a extends z{static{this.ID="workbench.action.chat.logChatIndex"}constructor(){super({id:a.ID,title:P(6488,"Log Chat Index"),icon:L.attach,category:Fe.Developer,f1:!0,precondition:Z.enabled})}async run(i,...e){i.get(si).logChatIndex()}},d0i=class a extends z{static{this.ID="workbench.action.chat.inspectChatModel"}constructor(){super({id:a.ID,title:P(6486,"Inspect Chat Model"),icon:L.inspect,category:Fe.Developer,f1:!0,precondition:Z.enabled})}async run(i,...e){let t=i.get(Lt),o=i.get(ie),n=t.lastFocusedWidget;if(!n?.viewModel)return;let s=n.viewModel.model.toJSON(),l=`# Chat Model Inspection

`,c=s.requests;if(c&&c.length>0){let u=c[c.length-1];u.response&&(l+=`## Latest Response

`,l+="```json\n"+JSON.stringify(u.response,fDo,2)+"\n```\n\n")}l+=`## Full Chat Model

`,l+="```json\n"+JSON.stringify(s,fDo,2)+"\n```\n",await o.openEditor({resource:void 0,contents:l,languageId:"markdown",options:{pinned:!0}})}},u0i=class a extends z{static{this.ID="workbench.action.chat.inspectChatModelReferences"}constructor(){super({id:a.ID,title:P(6487,"Inspect Chat Model References"),icon:L.inspect,category:Fe.Developer,f1:!0,precondition:Z.enabled})}async run(i){let e=i.get(F);await i.get(ie).openEditor({resource:void 0,contents:e.invokeFunction(Hvn),languageId:"markdown",options:{pinned:!0}})}},p0i=class a extends z{static{this.ID="workbench.action.chat.clearRecentlyUsedLanguageModels"}constructor(){super({id:a.ID,title:P(6485,"Clear Recently Used Language Models"),category:Fe.Developer,f1:!0,precondition:Z.enabled})}run(i){i.get(Gr).clearRecentlyUsedList()}},m0i=class a extends z{static{this.ID="workbench.action.chat.resetPermissionWarningDialogs"}constructor(){super({id:a.ID,title:P(6490,"Reset Permission Warning Dialogs (Autopilot, Bypass Approvals)"),category:Fe.Developer,f1:!0,precondition:Z.enabled})}run(i){let e=i.get(de);e.remove(n$t,0),e.remove(r$t,0),Zko()}};function SDo(){W(class extends z{constructor(){super({id:"workbench.action.chat.nextFileTree",title:P(6526,"Next File Tree"),keybinding:{primary:2115,weight:200,when:Z.inChatSession},precondition:Z.enabled,f1:!0,category:fi})}run(i,...e){bDo(i,!1)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.previousFileTree",title:P(6527,"Previous File Tree"),keybinding:{primary:3139,weight:200,when:Z.inChatSession},precondition:Z.enabled,f1:!0,category:fi})}run(i,...e){bDo(i,!0)}})}function bDo(a,i){let t=a.get(Lt).lastFocusedWidget;if(!t)return;let o=!t.inputEditor.hasWidgetFocus()&&t.getFocus(),r=(Ni(o)?o:void 0)??t.viewModel?.getItems().reverse().find(u=>Ni(u));if(!r)return;t.reveal(r);let s=t.getFileTreeInfosForResponse(r),l=t.getLastFocusedFileTreeForResponse(r),c=l?(l.treeIndex+(i?-1:1)+s.length)%s.length:i?s.length-1:0;s[c]?.focus()}var h$=class extends k{constructor(e,t,o,n,r,s){super();this.productService=e;this.extensionService=t;this.extensionManagementService=o;this.storageService=n;this.chatWidgetService=r;this.configurationService=s;this.recentlyInstalled=!1;let l=this.productService.defaultChatAgent,c=this.storageService.getBoolean(h$.hideWelcomeView,-1,!1);!l||c||this.registerListeners(l)}static{this.ID="workbench.contrib.chatGettingStarted"}static{this.hideWelcomeView="workbench.chat.hideWelcomeView"}registerListeners(e){this._register(this.extensionManagementService.onDidInstallExtensions(async t=>{for(let o of t)if(hi.equals(e.extensionId,o.identifier.id)&&o.operation===2){this.recentlyInstalled=!0;return}})),this._register(this.extensionService.onDidChangeExtensionsStatus(async t=>{for(let o of t)if(hi.equals(e.extensionId,o.value)&&this.extensionService.getExtensionsStatus()[o.value].activationTimes&&this.recentlyInstalled){this.onDidInstallChat();return}}))}async onDidInstallChat(){this.configurationService.getValue("workbench.startupEditor")!=="agentSessionsWelcomePage"&&this.chatWidgetService.revealWidget(),this.storageService.store(h$.hideWelcomeView,!0,-1,1),this.recentlyInstalled=!1}};h$=I([m(0,Ze),m(1,lt),m(2,xs),m(3,de),m(4,Lt),m(5,B)],h$);var IDo="chat.json",yDo=[{name:d(6533,null),extensions:["json"]}];function wDo(){W(class extends z{constructor(){super({id:"workbench.action.chat.export",category:fi,title:P(6532,"Export Chat..."),precondition:Z.enabled,f1:!0})}async run(i,e){let t=i.get(Lt),o=i.get(nn),n=i.get(ge),r=i.get(si),s=t.lastFocusedWidget;if(!s||!s.viewModel)return;if(!e){let u=Ve(await o.defaultFilePath(),IDo),p=await o.showSaveDialog({defaultUri:u,filters:yDo});if(!p)return;e=p}let l=r.getSession(s.viewModel.sessionResource);if(!l)return;let c=Ke.fromString(JSON.stringify(l.toExport(),void 0,2));await n.writeFile(e,c)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.import",title:P(6534,"Import Chat..."),category:fi,precondition:Z.enabled,f1:!0})}async run(i,e){let t=i.get(ge),o=i.get(Lt),n=i.get(si),r=i.get(nn),s=e?.inputPath;if(!s){let c=Ve(await r.defaultFilePath(),IDo),u=await r.showOpenDialog({defaultUri:c,canSelectFiles:!0,filters:yDo});if(!u)return;s=u[0]}let l=await t.readFile(s);try{let c=er(JSON.parse(l.value.toString()));if(!MWt(c))throw new Error("Invalid chat session data");let u,p,h;if(e?.target==="chatViewPane"){let g=n.loadSessionFromData(c,"ChatImportExport#importToChatView");try{u=g.object.sessionResource,p=XD,h={pinned:!0},await o.openSession(u,p,h)}finally{g.dispose()}}else u=tl.getNewEditorUri(),p=tr,h={target:{data:c},pinned:!0},await o.openSession(u,p,h)}catch(c){throw c}}})}var h0i=class a extends z{static{this.ID="workbench.action.chat.manageLanguageModelAuthentication"}constructor(){super({id:a.ID,title:P(6540,"Manage Language Model Access..."),category:fi,precondition:Z.enabled,menu:[{id:R.AccountsContext,order:100}],f1:!0})}async run(i){let e=i.get($e),t=i.get(Gr),o=i.get(mE),n=i.get(ct),r=i.get(lt),s=i.get(Ui),l=i.get(Ze),c=t.getLanguageModelIds(),u=new Map,p=new Map;for(let f of c){let v=t.lookupLanguageModel(f);if(!v?.auth)continue;let b=v.extension.value;if(!u.has(b))try{let S=iN+b,y=v.auth.accountLabel||"Language Models";p.set(b,y);let w=o.readAllowedExtensions(S,y).filter(E=>!E.trusted);if(l.trustedExtensionAuthAccess&&!Array.isArray(l.trustedExtensionAuthAccess)){let E=l.trustedExtensionAuthAccess[S];for(let M of E){let N=w.findIndex(H=>H.id===M);N!==-1&&w.splice(N,1);let V=await r.getExtension(M);V&&w.push({id:M,name:V.displayName||V.name,allowed:!0,trusted:!0})}}let x=new Array;for(let E of w)await r.getExtension(E.id)&&x.push(E);u.set(b,x)}catch{u.has(b)||u.set(b,[])}}if(u.size===0){n.prompt({type:"info",message:d(6543,null),detail:d(6544,null)});return}let h=[];for(let[f,v]of u){let b=await r.getExtension(f);if(!b)continue;h.push({type:"separator",id:f,label:d(6535,null,b.displayName||b.name),buttons:[{iconClass:q.asClassName(L.info),tooltip:d(6545,null)}]});let S=!1;if(v.length>0)for(let y of v)y.trusted&&!S&&(h.push({type:"separator",label:d(6546,null)}),S=!0),h.push({label:y.name,ownerId:f,id:y.id,picked:y.allowed??!1,extension:y,disabled:y.trusted,buttons:[{iconClass:q.asClassName(L.info),tooltip:d(6545,null)}]});else h.push({label:d(6542,null),description:d(6541,null,f),pickable:!1})}let g=await e.pick(h,{canPickMany:!0,sortByLabel:!0,onDidTriggerSeparatorButton(f){let v=f.separator.id;v&&s.open(v)},onDidTriggerItemButton(f){let v=f.item.id;v&&s.open(v)},title:d(6537,null),placeHolder:d(6536,null)});if(g)for(let[f,v]of u){let b=new Set(g.filter(S=>S.ownerId===f).filter(S=>!S.extension?.trusted).map(S=>S.id));for(let S of v)S.allowed=b.has(S.id);o.updateAllowedExtensions(iN+f,p.get(f)||"Language Models",v)}}},g0i=class extends z{constructor(){super({id:"lm.addLanguageModelsProviderGroup",title:d(6538,null)})}async run(i,e){let t=i.get(Gr);if(!e)throw new Error("Language model group is required");let{name:o,vendor:n,...r}=e;await t.addLanguageModelsProviderGroup(o,n,r)}},f0i=class extends z{constructor(){super({id:"lm.migrateLanguageModelsProviderGroup",title:d(6539,null)})}async run(i,e){let t=i.get(Gr);if(!e)throw new Error("Language model group is required");await t.migrateLanguageModelsProviderGroup(e)}};function CDo(){W(h0i),W(g0i),W(f0i)}var g$=le("agentPluginRepositoryService");var uI=le("pluginInstallService");var Uvn="installed.json",zvn=1,xDo="chat.plugins.installed.v1",Kvn="chat.plugins.marketplaces.index.v1",F5t=class extends k{constructor(e,t,o,n,r){super();this._agentPluginsHome=e;this._oldCacheRoot=t;this._fileService=o;this._logService=n;this._storageService=r;this._installed=De("file/installed.json",[]);this._suppressFileWatch=!1;this._initialized=!1;this.value=this._installed;this._fileUri=Ve(e,Uvn),this._writeDelayer=this._register(new Aa(100)),this._initialize()}get(){return this._installed.get()}set(e,t){this._setValue(e,t,!0)}async _initialize(){try{let e=await this._readFromFile();e!==void 0?this._setValue(e,void 0,!1):await this._migrateFromStorage()}catch(e){this._logService.error("[FileBackedInstalledPluginsStore] Initialization failed",e)}this._initialized=!0,this._setupFileWatcher()}async _readFromFile(){try{if(!await this._fileService.exists(this._fileUri))return;let t=await this._fileService.readFile(this._fileUri),o=JSON.parse(t.value.toString());if(!o||!Array.isArray(o.installed)){this._logService.warn("[FileBackedInstalledPluginsStore] installed.json has unexpected format, ignoring");return}return o.installed.filter(n=>typeof n.pluginUri=="string"&&typeof n.marketplace=="string").map(n=>({pluginUri:A.parse(n.pluginUri),marketplace:n.marketplace}))}catch{return}}_scheduleWrite(){this._writeDelayer.trigger(async()=>{await this._writeToFile()})}async _writeToFile(){let e=this.get().map(o=>({pluginUri:o.pluginUri.toString(),marketplace:o.marketplace})),t={version:zvn,installed:e};try{this._suppressFileWatch=!0;let o=JSON.stringify(t,void 0,"	");return await this._fileService.createFolder(this._agentPluginsHome),await this._fileService.writeFile(this._fileUri,Ke.fromString(o)),!0}catch(o){return this._logService.error("[FileBackedInstalledPluginsStore] Failed to write installed.json",o),!1}finally{this._suppressFileWatch=!1}}_setupFileWatcher(){if(typeof this._fileService.createWatcher!="function")return;let e=this._agentPluginsHome,t=this._fileService.createWatcher(e,{recursive:!1,excludes:[]});this._register(t);let o=this._register(new Dt(()=>this._onFileChanged(),100));this._register(t.onDidChange(n=>{!this._suppressFileWatch&&n.affects(this._fileUri)&&o.schedule()}))}async _onFileChanged(){let e=await this._readFromFile();if(e!==void 0){this._suppressFileWatch=!0;try{this._setValue(e,void 0,!1)}finally{this._suppressFileWatch=!1}}}_setValue(e,t,o){this._installed.set(e,t),o&&this._initialized&&!this._suppressFileWatch&&this._scheduleWrite()}async _migrateFromStorage(){let e=this._storageService.get(xDo,-1);if(e)try{let t=JSON.parse(e);if(!Array.isArray(t)||t.length===0)return;let o=er(t).map(r=>{let s=A.revive(r.pluginUri);return{pluginUri:this._rebasePluginUri(s)??s,marketplace:r.plugin?.marketplaceReference?.rawValue??""}}).filter(r=>!!r.marketplace);if(this._logService.info(`[FileBackedInstalledPluginsStore] Migrating ${o.length} plugin(s) from storage to installed.json`),this._setValue(o,void 0,!1),!await this._writeToFile())return;this._storageService.remove(xDo,-1),this._storageService.remove(Kvn,-1)}catch(t){this._logService.error("[FileBackedInstalledPluginsStore] Migration from storage failed",t)}}_rebasePluginUri(e){if(!this._oldCacheRoot)return;let t=this._oldCacheRoot;if(!ze(e,t)&&e.scheme===t.scheme&&e.path.startsWith(t.path+"/")){let o=e.path.substring(t.path.length);return e.with({path:this._agentPluginsHome.path+o})}}};function $6(a){let i=new Map;for(let e of a){if(typeof e!="string")continue;let t=Cw(e);t&&(i.has(t.canonicalId)||i.set(t.canonicalId,t))}return[...i.values()]}function v0i(a,i){let e=new Map;for(let t of a)e.set(t.canonicalId,t);for(let t of i)e.has(t.canonicalId)||e.set(t.canonicalId,t);return[...e.values()]}function Cw(a){let i=a.trim();if(!i)return;let e=Gvn(i);if(e)return e;let t=qvn(i);if(t)return t;let o=/^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(i);if(o){let n=o[1],r=o[2];return{rawValue:i,displayLabel:`${n}/${r}`,cloneUrl:`https://github.com/${n}/${r}.git`,canonicalId:jvn(n,r),cacheSegments:["github.com",n,r],kind:"githubShorthand",githubRepo:`${n}/${r}`}}}function Gvn(a){let i;try{i=A.parse(a)}catch{return}let e=i.scheme.toLowerCase();if(e==="file"&&/^file:\/\//i.test(a)){let p=A.file(i.fsPath);return{rawValue:a,displayLabel:p.fsPath,cloneUrl:a,canonicalId:`file:${p.toString().toLowerCase()}`,cacheSegments:[],kind:"localFileUri",localRepositoryUri:p}}if(e!=="http"&&e!=="https"&&e!=="ssh"||!i.authority)return;let t=$vn(i.path);if(!t)return;let o=".git",n=W5t(i.authority.toLowerCase()),r=t.toLowerCase().endsWith(o),s=r?t.slice(1,t.length-o.length):t.slice(1),l=s.split("/").map(W5t),c=r?t.slice(1).toLowerCase():`${t.slice(1).toLowerCase()}${o}`,u=kDo(i.authority,s);return{rawValue:a,displayLabel:a,cloneUrl:a,canonicalId:`git:${i.authority.toLowerCase()}/${c}`,cacheSegments:[n,...l],kind:"gitUri",githubRepo:u}}function qvn(a){let i=/^([^@\s]+)@([^:\s]+):(.+\.git)$/i.exec(a);if(!i)return;let e=".git",t=i[2],o=i[3].replace(/^\/+/,"");if(!o.toLowerCase().endsWith(e))return;let n=o.slice(0,-e.length),r=n.split("/").map(W5t),s=kDo(t,n);return{rawValue:a,displayLabel:a,cloneUrl:a,canonicalId:`git:${t.toLowerCase()}/${o.toLowerCase()}`,cacheSegments:[W5t(t.toLowerCase()),...r],kind:"gitUri",githubRepo:s}}function $vn(a){let i=".git",e=a.replace(/\/+/g,"/").replace(/\/+$/g,""),t=e.startsWith("/")?e:`/${e}`,o=t.toLowerCase().endsWith(i)?t.slice(1,t.length-i.length):t.slice(1);if(!(!o||!o.includes("/")))return t}function kDo(a,i){if(a.toLowerCase()!=="github.com")return;let e=i.split("/");if(e.length>=2&&e[0]&&e[1])return`${e[0]}/${e[1]}`}function jvn(a,i){return`github:${a.toLowerCase()}/${i.toLowerCase()}`}function W5t(a){return a.replace(/[\\/:*?"<>|]/g,"_")}var EDo="settings.json",TDo="settings.local.json",Qvn=".github/copilot",B5t=le("workspacePluginSettingsService");function Yvn(a){let i,e,t;if(typeof a.source=="object"&&a.source!==null){let o=a.source;i=o.source,e=o.repo,t=o.url}else i=a.source,e=a.repo,t=a.url;if(i==="github"&&typeof e=="string")return Cw(e);if(i==="git"&&typeof t=="string")return Cw(t)}function Xvn(a){let i=new Map;if(!a||typeof a!="object"||Array.isArray(a))return i;let e=a;for(let[t,o]of Object.entries(e))typeof o=="boolean"&&i.set(t,o);return i}function Jvn(a,i,e){let t=[];if(!a||typeof a!="object"||Array.isArray(a))return t;let o=a;for(let[n,r]of Object.entries(o)){if(!r||typeof r!="object"){e.debug(`${i} Ignoring non-object extraKnownMarketplaces entry: ${n}`);continue}let s=Yvn(r);if(!s){e.debug(`${i} Could not parse marketplace reference for: ${n}`);continue}t.push({name:n,reference:{...s,displayLabel:n}})}return t}var Zvn={marketplaces:[],enabledPlugins:new Map},V5t=class extends k{constructor(e,t,o,n,r){super();this._logService=r;this._data=De("data",Zvn);this.data=this._data;let s=vi(this,n.onDidChangeWorkspaceFolders,()=>n.getWorkspace().folders.map(c=>c.uri.path?Ve(c.uri,e):Ve(c.uri.with({path:"/"}),e))),l=this._register(new O);this._register(ve(c=>{let u=s.read(c);l.clear();let p=new Dt(()=>this._readSettings(u,t,o),100);l.add(p);for(let h of u){let g=o.createWatcher(h,{recursive:!1,excludes:[]});l.add(g),l.add(g.onDidChange(f=>{(f.affects(Ve(h,EDo))||f.affects(Ve(h,TDo)))&&p.schedule()}))}this._readSettings(u,t,o)}))}async _readSettings(e,t,o){let n=[],r=new Map;for(let s of e){let l=Ve(s,EDo),c=Ve(s,TDo);for(let u of[l,c])try{let p=await o.readFile(u),h=is(p.value.toString());if(!h||typeof h!="object")continue;let g=h,f=Jvn(g.extraKnownMarketplaces,t,this._logService);for(let b of f)n.some(S=>S.reference.canonicalId===b.reference.canonicalId)||n.push(b);let v=Xvn(g.enabledPlugins);for(let[b,S]of v)r.set(b,S)}catch{this._logService.debug(`${t} Could not read ${u.toString()}`)}}this._data.set({marketplaces:n,enabledPlugins:r},void 0)}},ABe=class extends k{constructor(i,e,t){super();let o=this._register(new V5t(qYe,"[ClaudePluginSettings]",i,e,t)),n=this._register(new V5t(Qvn,"[CopilotPluginSettings]",i,e,t));this.extraMarketplaces=ke(r=>{let s=o.data.read(r).marketplaces,l=n.data.read(r).marketplaces,c=new Map;for(let u of[...s,...l])c.has(u.reference.canonicalId)||c.set(u.reference.canonicalId,u);return[...c.values()]}),this.enabledPlugins=ke(r=>{let s=o.data.read(r).enabledPlugins,l=n.data.read(r).enabledPlugins,c=new Map;for(let[u,p]of s)c.set(u,p);for(let[u,p]of l)c.has(u)||c.set(u,p);return c})}};ABe=I([m(0,ge),m(1,Ae),m(2,re)],ABe);var jC=le("pluginMarketplaceService"),ebn=[{type:"openPlugin",path:"marketplace.json"},{type:"openPlugin",path:".plugin/marketplace.json"},{type:"copilot",path:".github/plugin/marketplace.json"},{type:"claude",path:".claude-plugin/marketplace.json"}],tbn=[{type:"openPlugin",path:".plugin/plugin.json"},{type:"claude",path:".claude-plugin/plugin.json"},{type:"copilot",path:"plugin.json"}],ibn=480*60*1e3,b0i="chat.plugins.marketplaces.githubCache.v1",_Do=1440*60*1e3,DDo="chat.plugins.lastUpdateCheck.v1";function RDo(a){return a.sourceDescriptor?a:{...a,sourceDescriptor:{kind:"relativePath",path:a.source}}}var obn=sN({defaultValue:[],key:"chat.plugins.trustedMarketplaces.v1",toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return Array.isArray(i)?i:[]}}),nbn=sN({defaultValue:{plugins:[],fetchedAt:0},key:"chat.plugins.lastFetchedPlugins.v2",toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return i&&Array.isArray(i.plugins)?i:{plugins:[],fetchedAt:0}}}),NBe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._configurationService=e;this._requestService=t;this._fileService=n;this._pluginRepositoryService=r;this._logService=s;this._storageService=l;this._workspacePluginSettingsService=c;this._workspaceTrustService=u;this._gitHubMarketplaceCache=new uo(()=>this._loadPersistedGitHubMarketplaceCache());this._pluginMetadata=new Map;this._hasUpdatesAvailable=De("hasUpdatesAvailable",!1);this.hasUpdatesAvailable=this._hasUpdatesAvailable;let p=Ve(o.cacheHome,"agentPlugins");this._installedPluginsStore=this._register(new F5t(r.agentPluginsHome,p,n,s,l)),this._trustedMarketplacesStore=this._register(obn(-1,1,l)),this._lastFetchedPluginsStore=this._register(nbn(-1,1,l)),this.lastFetchedPlugins=this._lastFetchedPluginsStore.map(g=>er(g).plugins.map(RDo)),this.installedPlugins=this._installedPluginsStore.value.map(g=>{let f=[];for(let v of g){let b=this._pluginMetadata.get(v.pluginUri.toString());b&&f.push({pluginUri:v.pluginUri,plugin:b})}return f});let h=vi(this,this._workspaceTrustService.onDidChangeTrust,()=>this._workspaceTrustService.isWorkspaceTrusted());this.recommendedPlugins=ke(g=>{if(!h.read(g))return new Set;let f=this._workspacePluginSettingsService.enabledPlugins.read(g),v=new Set;for(let[b,S]of f)S&&v.add(b);return v}),this.onDidChangeMarketplaces=U.any(U.filter(e.onDidChangeConfiguration,g=>g.affectsConfiguration("chat.plugins.enabled")||g.affectsConfiguration("chat.plugins.marketplaces")),U.fromObservableLight(this._workspacePluginSettingsService.extraMarketplaces),U.map(this._workspaceTrustService.onDidChangeTrust,()=>{})),this._register(TL(()=>{this._scheduleUpdateCheck(),this._register(U.filter(e.onDidChangeConfiguration,g=>g.affectsConfiguration(JI))(()=>this._scheduleUpdateCheck()))})),this._register(ve(g=>{let v=this._installedPluginsStore.value.read(g).filter(b=>!this._pluginMetadata.has(b.pluginUri.toString()));v.length>0&&this._hydratePluginMetadata(v)}))}dispose(){this._updateCheckTimer!==void 0&&(clearTimeout(this._updateCheckTimer),this._updateCheckTimer=void 0),super.dispose()}clearUpdatesAvailable(){this._hasUpdatesAvailable.set(!1,void 0)}async fetchMarketplacePlugins(e){if(!this._configurationService.getValue("chat.plugins.enabled"))return[];let t=this._configurationService.getValue("chat.plugins.marketplaces")??[],o=$6(t),n;if(this._workspaceTrustService.isWorkspaceTrusted()){let l=this._workspacePluginSettingsService.extraMarketplaces.get();n=v0i(l.map(c=>c.reference),o)}else n=o;for(let l of t)(typeof l!="string"||!Cw(l))&&this._logService.debug(`[PluginMarketplaceService] Ignoring invalid marketplace entry: ${String(l)}`);let s=(await Promise.all(n.map(l=>l.kind==="githubShorthand"&&l.githubRepo?this._fetchFromGitHubRepo(l,l.githubRepo,e):this._fetchFromClonedRepo(l,e)))).flat();return this._lastFetchedPluginsStore.set({plugins:s,fetchedAt:Date.now()},void 0),s}async _fetchFromGitHubRepo(e,t,o){let n=this._gitHubMarketplaceCache.value,r=this._getCachedGitHubMarketplacePlugins(n,e.canonicalId);if(r)return r.map(c=>({...c,marketplace:e.displayLabel,marketplaceReference:e}));let s=!0,l=await this._readPluginsFromDefinitions(e,async c=>{if(o.isCancellationRequested)return;let u=`https://raw.githubusercontent.com/${t}/main/${c}`;try{let p=await this._requestService.request({type:"GET",url:u,callSite:"pluginMarketplaceService.fetchPluginList"},o),h=p.res.statusCode;if(h!==200){s&&=h!==void 0&&h>=400&&h<500,this._logService.debug(`[PluginMarketplaceService] ${u} returned status ${h}, skipping`);return}return await Th(p)??void 0}catch(p){this._logService.debug(`[PluginMarketplaceService] Failed to fetch marketplace.json from ${u}:`,p);return}});return l.length>0?(n.set(e.canonicalId,{plugins:l,expiresAt:Date.now()+ibn,referenceRawValue:e.rawValue}),this._savePersistedGitHubMarketplaceCache(n),l):s?(this._logService.debug(`[PluginMarketplaceService] ${t} may be private, attempting clone-based marketplace discovery`),this._fetchFromClonedRepo(e,o)):(this._logService.debug(`[PluginMarketplaceService] No marketplace.json found in ${t}`),[])}_getCachedGitHubMarketplacePlugins(e,t){let o=e.get(t);if(o){if(o.expiresAt<=Date.now()){e.delete(t),this._savePersistedGitHubMarketplaceCache(e);return}return[...o.plugins]}}_loadPersistedGitHubMarketplaceCache(){let e=new Map,t=Date.now(),o=this._storageService.getObject(b0i,-1);if(!o)return e;let n=er(o);for(let[r,s]of Object.entries(n)){if(!s||!Array.isArray(s.plugins)||typeof s.expiresAt!="number"||s.expiresAt<=t||typeof s.referenceRawValue!="string")continue;let l=Cw(s.referenceRawValue);if(!l)continue;let c=s.plugins.map(u=>RDo({...u,marketplace:l.displayLabel,marketplaceReference:l}));e.set(r,{plugins:c,expiresAt:s.expiresAt,referenceRawValue:s.referenceRawValue})}return e}_savePersistedGitHubMarketplaceCache(e){let t={};for(let[o,n]of e)!n.plugins.length||n.expiresAt<=Date.now()||(t[o]={expiresAt:n.expiresAt,referenceRawValue:n.referenceRawValue,plugins:n.plugins});if(Object.keys(t).length===0){this._storageService.remove(b0i,-1);return}this._storageService.store(b0i,JSON.stringify(t),-1,1)}getMarketplacePluginMetadata(e){return this._pluginMetadata.get(e.toString())??[...this._pluginMetadata.entries()].find(([t])=>Yr(e,A.parse(t)))?.[1]}addInstalledPlugin(e,t){this._pluginMetadata.set(e.toString(),t);let o=this._installedPluginsStore.get(),n=o.find(r=>ze(r.pluginUri,e));n?this._installedPluginsStore.set(o.map(r=>r===n?{pluginUri:e,marketplace:t.marketplaceReference.rawValue}:r),void 0):this._installedPluginsStore.set([...o,{pluginUri:e,marketplace:t.marketplaceReference.rawValue}],void 0)}removeInstalledPlugin(e){this._pluginMetadata.delete(e.toString());let t=this._installedPluginsStore.get();this._installedPluginsStore.set(t.filter(o=>!ze(o.pluginUri,e)),void 0)}isMarketplaceTrusted(e){return this._trustedMarketplacesStore.get().includes(e.canonicalId)}async _hydratePluginMetadata(e){let t=0;for(let o of e){let n=o.pluginUri.toString();if(this._pluginMetadata.has(n))continue;let r=Cw(o.marketplace);if(!r){this._logService.debug(`[PluginMarketplaceService] Cannot parse marketplace reference '${o.marketplace}' for ${n}`);continue}try{let s=this._pluginRepositoryService.getRepositoryUri(r),l=await this._readPluginsFromDirectory(s,r);if(l.length===0){let u=await this.readSinglePluginManifest(s,r);u&&(l=[u])}let c=l.find(u=>{let p=this._pluginRepositoryService.getPluginInstallUri(u);return ze(p,o.pluginUri)});c&&(this._pluginMetadata.set(n,c),t++)}catch(s){this._logService.debug(`[PluginMarketplaceService] Failed to hydrate metadata for ${n}:`,s)}}if(t>0){let o=this._installedPluginsStore.get();this._installedPluginsStore.set([...o],void 0)}}_parseMarketplacePlugins(e,t,o,n){return!e.plugins||!Array.isArray(e.plugins)?[]:e.plugins.filter(r=>typeof r.name=="string"&&!!r.name).flatMap(r=>{let s=rbn(r.source,e.metadata?.pluginRoot,{pluginName:r.name,logService:this._logService,logPrefix:"[PluginMarketplaceService]"});if(!s)return[];let l=s.kind==="relativePath"?s.path:"";return[{name:r.name,description:r.description??"",version:r.version??"",source:l,sourceDescriptor:s,marketplace:t.displayLabel,marketplaceReference:t,marketplaceType:o,readmeUri:n?lbn(n,l):abn(t.githubRepo??"",l)}]})}trustMarketplace(e){let t=this._trustedMarketplacesStore.get();t.includes(e.canonicalId)||this._trustedMarketplacesStore.set([...t,e.canonicalId],void 0)}_isAutoUpdateEnabled(){return this._configurationService.getValue(JI)}_scheduleUpdateCheck(){if(this._updateCheckTimer!==void 0&&(clearTimeout(this._updateCheckTimer),this._updateCheckTimer=void 0),!this._isAutoUpdateEnabled())return;let e=this._storageService.getNumber(DDo,-1,0),t=Date.now()-e,o=Math.max(0,_Do-t);this._updateCheckTimer=setTimeout(()=>this._runUpdateCheck(),o)}async _runUpdateCheck(){this._updateCheckTimer=void 0;try{let e=this.installedPlugins.get();if(e.length===0)return;let t=new Set,o=!1;for(let n of e){let r=n.plugin.marketplaceReference;if(!t.has(r.canonicalId)){t.add(r.canonicalId);try{if(await this._pluginRepositoryService.fetchRepository(r)){o=!0;break}}catch(s){this._logService.debug(`[PluginMarketplaceService] Update check failed for ${r.displayLabel}:`,s)}}}this._hasUpdatesAvailable.set(o,void 0),this._storageService.store(DDo,Date.now(),-1,1)}catch(e){this._logService.debug("[PluginMarketplaceService] Periodic update check failed:",e)}finally{this._isAutoUpdateEnabled()&&(this._updateCheckTimer=setTimeout(()=>this._runUpdateCheck(),_Do))}}async _fetchFromClonedRepo(e,t){let o;try{o=await this._pluginRepositoryService.ensureRepository(e)}catch(n){return this._logService.debug(`[PluginMarketplaceService] Failed to prepare marketplace repository ${e.rawValue}:`,n),[]}return this._readPluginsFromDirectory(o,e,t)}async readPluginsFromDirectory(e,t){return this._readPluginsFromDirectory(e,t)}async readSinglePluginManifest(e,t){if(!(t.kind!=="githubShorthand"&&t.kind!=="gitUri")){for(let o of tbn){let n=Ve(e,o.path),r;try{let p=await this._fileService.readFile(n),h=is(p.value.toString());h&&typeof h=="object"&&!Array.isArray(h)&&(r=h)}catch{continue}if(!r)continue;let s=t.kind==="githubShorthand"?{kind:"github",repo:t.githubRepo}:{kind:"url",url:t.cloneUrl},l=typeof r.name=="string"&&r.name?r.name:t.displayLabel,c=typeof r.description=="string"?r.description:"",u=typeof r.version=="string"?r.version:"";return{name:l,description:c,version:u,source:"",sourceDescriptor:s,marketplace:t.displayLabel,marketplaceReference:t,marketplaceType:o.type}}this._logService.debug(`[PluginMarketplaceService] No single-plugin manifest found in ${t.rawValue}`)}}async _readPluginsFromDirectory(e,t,o){return this._readPluginsFromDefinitions(t,async n=>{if(o?.isCancellationRequested)return;let r=Ve(e,n);try{let s=await this._fileService.readFile(r);return is(s.value.toString())}catch{return}},e)}async _readPluginsFromDefinitions(e,t,o){for(let n of ebn){let r=await t(n.path);if(!(!r?.plugins||!Array.isArray(r.plugins)))return this._parseMarketplacePlugins(r,e,n.type,o)}return this._logService.debug(`[PluginMarketplaceService] No marketplace.json found in ${e.rawValue}`),[]}};NBe=I([m(0,B),m(1,Ra),m(2,ko),m(3,ge),m(4,g$),m(5,re),m(6,de),m(7,B5t),m(8,Or)],NBe);function LDo(a){let i=a.trim().replace(/\\/g,"/");return i=i.replace(/^\.?\/+/,"").replace(/\/+$/g,""),i}function MDo(a,i){let e=a?LDo(a):"",t=LDo(i),o=A.file("/"),n=e?Jj(Ve(o,e)):o;if(e&&(t===e||t.startsWith(`${e}/`)))return t;let r=Jj(Ve(n,t));return lu(o,r)??void 0}function rbn(a,i,e){if(a==null){let t=MDo(i,"");return t===void 0?void 0:{kind:"relativePath",path:t}}if(typeof a=="string"){let t=MDo(i,a);return t===void 0?void 0:{kind:"relativePath",path:t}}if(typeof a!="object"||typeof a.source!="string"){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': source object is missing a 'source' discriminant`);return}switch(a.source){case"github":{if(typeof a.repo!="string"||!a.repo){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source is missing required 'repo' field`);return}if(!sbn(a.repo)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source repo must be in 'owner/repo' format`);return}if(!Zve(a.ref)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source 'ref' must be a string when provided`);return}if(!PDo(a.sha)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source 'sha' must be a full 40-character commit hash when provided`);return}if(!Zve(a.path)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': github source 'path' must be a string when provided`);return}return{kind:"github",repo:a.repo,ref:a.ref,sha:a.sha,path:a.path}}case"url":{if(typeof a.url!="string"||!a.url){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source is missing required 'url' field`);return}if(!a.url.toLowerCase().endsWith(".git")){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source must end with '.git'`);return}if(!Zve(a.ref)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source 'ref' must be a string when provided`);return}if(!PDo(a.sha)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': url source 'sha' must be a full 40-character commit hash when provided`);return}return{kind:"url",url:a.url,ref:a.ref,sha:a.sha}}case"npm":{if(typeof a.package!="string"||!a.package){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': npm source is missing required 'package' field`);return}if(!Zve(a.version)||!Zve(a.registry)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': npm source 'version' and 'registry' must be strings when provided`);return}return{kind:"npm",package:a.package,version:a.version,registry:a.registry}}case"pip":{if(typeof a.package!="string"||!a.package){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': pip source is missing required 'package' field`);return}if(!Zve(a.version)||!Zve(a.registry)){e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': pip source 'version' and 'registry' must be strings when provided`);return}return{kind:"pip",package:a.package,version:a.version,registry:a.registry}}default:e.logService.warn(`${e.logPrefix} Skipping plugin '${e.pluginName}': unknown source kind '${a.source}'`);return}}function Zve(a){return a===void 0||typeof a=="string"}function PDo(a){return a===void 0||typeof a=="string"&&/^[0-9a-fA-F]{40}$/.test(a)}function sbn(a){return/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(a)}function OBe(a,i){if(a.kind!==i.kind)return!0;switch(a.kind){case"github":return a.ref!==i.ref||a.sha!==i.sha||a.path!==i.path;case"url":return a.ref!==i.ref||a.sha!==i.sha;case"npm":return a.version!==i.version;case"pip":return a.version!==i.version;default:return!1}}function abn(a,i){let e=i.trim().replace(/^\.?\/+|\/+$/g,""),t=e?`${e}/README.md`:"README.md";return A.parse(`https://github.com/${a}/blob/main/${t}`)}function lbn(a,i){let e=i.trim().replace(/^\.?\/+|\/+$/g,"");return e?Ve(a,e,"README.md"):Ve(a,"README.md")}var Mlt=class a extends z{static{this.ID="workbench.action.chat.managePlugins"}constructor(){super({id:a.ID,title:P(6579,"Plugins"),category:fi,precondition:Z.enabled,menu:[{id:LC,group:"2_plugins"}],f1:!0})}async run(i){i.get(Ui).openSearch("@agentPlugins ")}},S0i=class a extends z{static{this.ID="workbench.action.chat.installPluginFromSource"}constructor(){super({id:a.ID,title:P(6574,"Install Plugin from Source"),category:fi,icon:L.add,precondition:Z.enabled,f1:!0,menu:[{id:R.ViewTitle,when:C.and(C.equals("view",_Z),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),group:"navigation",order:1}]})}async run(i){let e=i.get($e),t=i.get(uI),o=i.get(Ui),n=new O,r=n.add(e.createInputBox());r.placeholder=d(6580,null),r.prompt=d(6581,null),r.ignoreFocusOut=!0,r.show(),n.add(r.onDidChangeValue(()=>{r.validationMessage=void 0}));let s=!1;n.add(r.onDidHide(()=>{s||n.dispose()})),n.add(r.onDidAccept(async()=>{let l=r.value.trim();if(!l)return;let c=t.validatePluginSource(l);if(c){r.validationMessage=c;return}r.busy=!0,r.enabled=!1,s=!0;try{r.hide();let u=await t.installPluginFromValidatedSource(l);if(!u.success)u.message&&(r.validationMessage=u.message),r.show();else{let p=Cw(l);p&&o.openSearch(`@agentPlugins ${p.displayLabel}`),n.dispose()}}finally{s=!1,n.isDisposed||(r.busy=!1,r.enabled=!0)}}))}},I0i=class a extends z{static{this.ID="workbench.action.chat.managePluginMarketplaces"}constructor(){super({id:a.ID,title:P(6576,"Manage Plugin Marketplaces"),icon:L.globe,category:fi,precondition:Z.enabled,f1:!0,menu:[{id:R.ViewTitle,when:C.and(C.equals("view",_Z),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),group:"navigation",order:2}]})}async run(i){let e=i.get($e),t=i.get(B),o=i.get(g$),n=i.get(Ui),r=i.get(fe),s=i.get(ge),l=t.getValue("chat.plugins.marketplaces")??[],c=$6(l);if(c.length===0){e.pick([],{placeHolder:d(6577,null)});return}let u=c.map(S=>({label:S.displayLabel,description:S.kind==="localFileUri"?d(6575,null):S.cloneUrl,reference:S})),p=await e.pick(u,{placeHolder:d(6583,null)});if(!p)return;let h=p.reference,g=[{id:"showPlugins",label:d(6585,null)}],f=o.getRepositoryUri(h);await s.exists(f)&&g.push({id:"openDirectory",label:d(6578,null)}),g.push({id:"removeMarketplace",label:d(6582,null)});let b=await e.pick(g,{placeHolder:d(6584,null,h.displayLabel)});if(b)switch(b.id){case"showPlugins":n.openSearch(`@agentPlugins ${h.displayLabel}`);break;case"openDirectory":await r.executeCommand("revealFileInOS",f);break;case"removeMarketplace":{let y=(t.getValue("chat.plugins.marketplaces")??[]).filter(w=>typeof w=="string"&&w.trim()!==h.rawValue);await t.updateValue("chat.plugins.marketplaces",y);break}}}};function ADo(){W(Mlt),W(S0i),W(I0i)}async function H5t(a,i){let e=a.get(ie);if(!i){let t=e.activeEditor;i=t instanceof tl?t:void 0}if(i instanceof tl){let t=i.sessionResource&&i.sessionResource.scheme!==Q.vscodeLocalChatSession?i.sessionResource.with({path:`/untitled-${ht()}`}):tl.getNewEditorUri(),o=e.findEditors(i.resource)[0];await e.replaceEditors([{editor:i,replacement:{resource:t,options:{pinned:!0}}}],o.groupId)}}var IO=class extends Y0{constructor(e,t,o,n,r,s,l,c,u,p,h){super(tl.EditorID,e,IO.VIEW_STATE_KEY,t,n,r,u,o,p,h);this.chatSessionsService=s;this.contextKeyService=l;this.chatService=c;this.dimension=new di(0,0)}static{this.VIEW_STATE_KEY="chatEditorViewState"}get widget(){return this._widget}get scopedContextKeyService(){return this._scopedContextKeyService}async clear(){if(this.input)return this.instantiationService.invokeFunction(H5t,this.input)}createEditor(e){this._editorContainer=e,e.classList.add("chat-editor-relative"),this._scopedContextKeyService=this._register(this.contextKeyService.createScoped(e));let t=this._register(this.instantiationService.createChild(new Po([X,this.scopedContextKeyService])));Z.inChatEditor.bindTo(this._scopedContextKeyService).set(!0),this._widget=this._register(t.createInstance(my,"panel",void 0,{autoScroll:o=>o!=="ask",renderFollowups:!0,supportsFileReferences:!0,clear:()=>this.clear(),rendererOptions:{renderTextEditsAsSummary:o=>!0,referencesExpandedWhenEmptyResponse:!1,progressMessageAtBottomOfResponse:o=>o!=="ask"},enableImplicitContext:!0,enableWorkingSet:"explicit",supportsChangingModes:!0},{listForeground:Vd,listBackground:Bo,overlayBackground:ZT,inputEditorBackground:Hf,resultEditorBackground:Bo})),this._register(this.widget.onDidSubmitAgent(()=>{this.group.pinEditor(this.input)})),this._register(this.widget.onDidChangeViewModel(o=>{if(o.currentSessionResource&&this.input instanceof tl){let n=this.chatService.getSession(o.currentSessionResource);n&&this.input.updateModel(n)}})),this.widget.render(e),this.widget.setVisible(!0)}setEditorVisible(e){super.setEditorVisible(e),this.widget?.setVisible(e),e&&this.widget&&this.widget.layout(this.dimension.height,this.dimension.width)}focus(){super.focus(),this.widget?.focusInput()}clearInput(){this.widget.setModel(void 0),super.clearInput()}showLoadingInChatWidget(e){if(!this._editorContainer)return;if(this._loadingContainer){let r=this._loadingContainer.querySelector(".chat-loading-content span");if(r){r.textContent=e;return}this.hideLoadingInChatWidget()}this._editorContainer.setAttribute("aria-busy","true"),this._loadingContainer=D(this._editorContainer,_(".chat-loading-overlay")),this._loadingContainer.setAttribute("role","status"),this._loadingContainer.setAttribute("aria-live","polite"),this._loadingContainer.tabIndex=-1;let t=D(this._loadingContainer,_(".chat-loading-content")),o=un(q.modify(L.loading,"spin"));o.setAttribute("aria-hidden","true"),t.appendChild(o);let n=D(t,_("span"));n.textContent=e}hideLoadingInChatWidget(){this._loadingContainer&&(this._loadingContainer.remove(),this._loadingContainer=void 0),this._editorContainer&&this._editorContainer.removeAttribute("aria-busy")}async setInput(e,t,o,n){let r=!1,s=e.getSessionType();if(s!==kl){let l=d(9211,null);this.showLoadingInChatWidget(l)}if(await super.setInput(e,t,o,n),n.isCancellationRequested){this.hideLoadingInChatWidget();return}if(!this.widget)throw new Error("ChatEditor lifecycle issue: no editor widget");if(s!==kl)try{await Ym(this.chatSessionsService.canResolveChatSession(s),n);let c=this.chatSessionsService.getAllChatSessionContributions().find(u=>u.type===s);c?(this.widget.lockToCodingAgent(c.name,c.displayName,c.type),r=!0):this.widget.unlockFromCodingAgent()}catch(l){throw this.hideLoadingInChatWidget(),l}else this.widget.unlockFromCodingAgent();try{let l=await Ym(e.resolve(),n);if(!l)throw new Error(`Failed to get model for chat editor. resource: ${e.sessionResource}`);s!==kl&&this.hideLoadingInChatWidget(),t?.modelInputState&&l.model.inputModel.setState(t.modelInputState),this.updateModel(l.model);let c=this.loadEditorViewState(e,o);c&&(this._widget.scrollTop=c.scrollTop),r&&t?.title?.preferred&&e.sessionResource&&this.chatService.setChatSessionTitle(e.sessionResource,t.title.preferred)}catch(l){throw this.hideLoadingInChatWidget(),l}}updateModel(e){this.widget.setModel(e)}computeEditorViewState(e){if(this._widget)return{scrollTop:this._widget.scrollTop}}tracksEditorViewState(e){return e instanceof tl}toEditorViewStateResource(e){return e.sessionResource}layout(e,t){this.dimension=e,this.widget&&this.widget.layout(e.height,e.width)}};IO=I([m(1,_e),m(2,Pe),m(3,F),m(4,de),m(5,Ms),m(6,X),m(7,si),m(8,Gn),m(9,ie),m(10,kt)],IO);function ODo(){W(class extends z{constructor(){super({id:"workbench.action.chat.openInEditor",title:P(6547,"Move Chat into Editor Area"),category:fi,precondition:Z.enabled,f1:!0,menu:{id:R.ViewTitle,when:C.equals("view",Xr),order:0,group:"1_open"}})}async run(e,...t){let o=t[0];NDo(e,"Editor",xfe(o)?o.sessionResource:void 0)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.openInNewWindow",title:P(6548,"Move Chat into New Window"),category:fi,precondition:Z.enabled,f1:!0,menu:{id:R.ViewTitle,when:C.equals("view",Xr),order:0,group:"1_open"}})}async run(e,...t){let o=t[0];NDo(e,"Window",xfe(o)?o.sessionResource:void 0)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.openInSidebar",title:P(6552,"Move Chat into Side Bar"),category:fi,precondition:Z.enabled,f1:!0})}async run(e,...t){return cbn(e)}});function a(i,e,t,o){be.appendMenuItem(i,{command:{id:"workbench.action.chat.openInSidebar",title:e,icon:t},when:C.and(Tr.isEqualTo(tl.EditorID),o),group:i===R.CompactWindowEditorTitle?"navigation":void 0,order:0})}[R.EditorTitle,R.CompactWindowEditorTitle].forEach(i=>{a(i,d(6551,null),L.layoutSidebarRightDock,Z.panelLocation.isEqualTo(2)),a(i,d(6550,null),L.layoutSidebarLeftDock,Z.panelLocation.isEqualTo(0)),a(i,d(6549,null),L.layoutPanelDock,Z.panelLocation.isEqualTo(1))})}async function NDo(a,i,e){let t=a.get(Lt),o={compact:!0,bounds:{width:800,height:640}},n=(e?t.getWidgetBySessionResource(e):void 0)??t.lastFocusedWidget;if(!n||!n.viewModel||n.location!=="panel"){await t.openSession(tl.getNewEditorUri(),i==="Window"?ff:tr,{pinned:!0,auxiliary:o});return}let r=t.getWidgetBySessionResource(n.viewModel.sessionResource);if(!r){await t.openSession(tl.getNewEditorUri(),i==="Window"?ff:tr,{pinned:!0,auxiliary:o});return}let s=n.viewModel.sessionResource,l=r.getViewState();await n.clear();let c={pinned:!0,modelInputState:l,auxiliary:o};await t.openSession(s,i==="Window"?ff:tr,c)}async function cbn(a){let i=a.get(Gt),e=a.get(ie),t=a.get(kt),o=e.activeEditorPane,n=o?.input,r;if(o instanceof IO&&n instanceof tl&&n.sessionResource){let s=o.widget.getViewState();await e.closeEditor({editor:o.input,groupId:t.activeGroup.id}),r=await i.openView(Xr);let l=await r.loadSession(n.sessionResource);s&&l&&!l.inputModel.state.get()&&l.inputModel.setState(s)}else r=await i.openView(Xr);r.focus()}function y0i(a){if(a&&typeof a=="object"){let i=a;return!(i.inputValue!==void 0&&typeof i.inputValue!="string"||i.agentMode!==void 0&&typeof i.agentMode!="boolean"||i.isPartialQuery!==void 0&&typeof i.isPartialQuery!="boolean")}return!1}function FDo(){be.appendMenuItem(R.ViewTitle,{submenu:R.ChatNewMenu,title:P(6555,"New Chat"),icon:L.plus,when:C.equals("view",Xr),group:"navigation",order:-1,isSplitButton:!0}),W(class extends z{constructor(){super({id:"workbench.action.chatEditor.newChat",title:P(6554,"New Chat"),icon:L.plus,f1:!1,precondition:Z.enabled})}async run(e,...t){await H5t(e)}}),W(class extends z{constructor(){super({id:Mh,title:P(6555,"New Chat"),category:fi,icon:L.plus,precondition:C.and(Z.enabled,Z.location.isEqualTo("panel")),f1:!0,menu:[{id:R.ChatContext,group:"z_clear"},{id:R.ChatNewMenu,group:"1_open",order:1,when:C.and(Z.newChatButtonExperimentIcon.notEqualsTo("copilot"),Z.newChatButtonExperimentIcon.notEqualsTo("new-session"),Z.newChatButtonExperimentIcon.notEqualsTo("comment"))}],keybinding:{weight:201,primary:2092,secondary:[2090],mac:{primary:2092,secondary:[298]},when:Z.inChatSession}})}async run(e,...t){let o=y0i(t[0])?t[0]:void 0,n=Tfe(e,t);await w0i(e,n,o)}});let a=[{idSuffix:".copilotIcon",iconValue:"copilot",icon:L.copilot},{idSuffix:".newSessionIcon",iconValue:"new-session",icon:L.newSession},{idSuffix:".commentIcon",iconValue:"comment",icon:L.comment}];for(let i of a)W(class extends z{constructor(){super({id:Mh+i.idSuffix,title:P(6555,"New Chat"),category:fi,icon:i.icon,precondition:C.and(Z.enabled,Z.location.isEqualTo("panel")),f1:!1,menu:[{id:R.ChatNewMenu,group:"1_open",order:1,when:Z.newChatButtonExperimentIcon.isEqualTo(i.iconValue)}]})}async run(e,...t){let o=y0i(t[0])?t[0]:void 0,n=Tfe(e,t);await w0i(e,n,o)}});Ge.registerCommandAlias(Gmo,Mh),W(class extends z{constructor(){super({id:"workbench.action.chat.newLocalChat",title:P(6556,"New Local Chat"),category:fi,icon:L.plus,precondition:C.and(Z.enabled,Z.location.isEqualTo("panel")),f1:!1})}async run(e,...t){let o=y0i(t[0])?t[0]:void 0,n=Tfe(e,t);await w0i(e,n,o,zo.Local)}}),be.appendMenuItem(R.ChatViewSessionTitleNavigationToolbar,{command:{id:Mh,title:P(6553,"Go Back"),icon:L.arrowLeft},when:Z.agentSessionsViewerOrientation.notEqualsTo(2),group:"navigation",order:1}),be.appendMenuItem(R.ChatTitleBarMenu,{command:{id:Mh,title:P(6555,"New Chat")},when:Z.enabled,group:"b_new",order:-1}),W(class extends lO{constructor(){super({id:"workbench.action.chat.undoEdit",title:P(6560,"Undo Last Edit"),category:fi,icon:L.discard,precondition:C.and(Z.chatEditingCanUndo,Z.enabled),f1:!0,menu:[{id:R.ViewTitle,when:C.equals("view",Xr),group:"navigation",order:-3,isHiddenByDefault:!0}]})}async runEditingSessionAction(e,t){await t.undoInteraction()}}),W(class extends lO{constructor(){super({id:"workbench.action.chat.redoEdit",title:P(6557,"Redo Last Edit"),category:fi,icon:L.redo,precondition:C.and(Z.chatEditingCanRedo,Z.enabled),f1:!0,menu:[{id:R.ViewTitle,when:C.equals("view",Xr),group:"navigation",order:-2,isHiddenByDefault:!0}]})}async runEditingSessionAction(e,t){let o=e.get(si);await t.redoInteraction(),o.getSession(t.chatSessionResource)?.setCheckpoint(void 0)}}),W(class extends lO{constructor(){super({id:"workbench.action.chat.redoEdit2",title:P(6558,"Redo"),tooltip:P(6559,"Reapply discarded workspace changes and chat"),category:fi,precondition:C.and(Z.chatEditingCanRedo,Z.enabled),f1:!0,menu:[{id:R.ChatMessageRestoreCheckpoint,when:C.or(Z.lockedToCodingAgent.negate(),Lx.isAgentHostSession),group:"navigation",order:-1}]})}async runEditingSessionAction(e,t){let o=e.get(Lt);for(;t.canRedo.get();)await t.redoInteraction();let n=o.getWidgetBySessionResource(t.chatSessionResource),r=n?.viewModel?.model.checkpoint?.message.text;n?.inputEditor.getValue()===r&&n?.input.setValue("",!1),n?.viewModel?.model.setCheckpoint(void 0),n?.focusInput()}})}async function w0i(a,i,e,t){let o=a.get(Ai),n=a.get(Gt),r=a.get(B),{editingSession:s,chatWidget:l}=i??{};if(!l)return;let c=a.get(ct),u=l.viewModel?.model;u&&!await Let(u,void 0,c)||(await s?.stop(),await xWt(l,n,t),l.attachmentModel.clear(!0),l.focusInput(),o.alert(d(6561,null)),e&&(typeof e.agentMode=="boolean"?l.input.setChatMode(e.agentMode?"agent":"edit"):l.input.currentModeKind==="edit"&&r.getValue("chat.editMode.hidden")&&l.input.setChatMode("agent"),e.inputValue&&(e.isPartialQuery?l.setInput(e.inputValue):l.acceptInput(e.inputValue))))}function VDo(){W(class extends z{constructor(){super({id:"workbench.action.chat.nextUserPrompt",title:P(6586,"Next User Prompt"),keybinding:{primary:2578,weight:200,when:Z.inChatSession},precondition:Z.enabled,f1:!0,category:fi})}run(i,...e){WDo(i,!1)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.previousUserPrompt",title:P(6587,"Previous User Prompt"),keybinding:{primary:2576,weight:200,when:Z.inChatSession},precondition:Z.enabled,f1:!0,category:fi})}run(i,...e){WDo(i,!0)}})}function WDo(a,i){let t=a.get(Lt).lastFocusedWidget;if(!t)return;let o=t.viewModel?.getItems();if(!o||o.length===0)return;let n=o.filter(u=>_r(u));if(n.length===0)return;let r=t.getFocus(),s=-1;r&&(_r(r)?s=n.findIndex(u=>u.id===r.id):Ni(r)&&(s=n.findIndex(u=>u.id===r.requestId)));let l;if(s===-1)l=i?n.length-1:0;else if(l=i?s-1:s+1,l<0?l=0:l>=n.length&&(l=n.length-1),l===s)return;let c=n[l];c&&(t.focus(c),t.reveal(c))}var BDo=Z.editingRequestType.isEqualTo(Z.EditingRequestType.Queue),HDo=Z.editingRequestType.isEqualTo(Z.EditingRequestType.Steer),T0i=C.or(BDo,HDo),_0i=C.and(C.or(Z.requestInProgress,T0i),Z.editingRequestType.notEqualsTo(Z.EditingRequestType.Sent)),UDo=C.equals("config.chat.requestQueuing.defaultAction","steer"),dbn=UDo.negate(),zDo=C.or(C.and(dbn,T0i.negate()),BDo),KDo=C.or(C.and(UDo,T0i.negate()),HDo);function ubn(a){return!!a&&typeof a=="object"&&"sessionResource"in a&&"pendingRequestId"in a&&A.isUri(a.sessionResource)&&typeof a.pendingRequestId=="string"}var j6=class a extends z{static{this.ID="workbench.action.chat.queueMessage"}constructor(){super({id:a.ID,title:P(6589,"Add to Queue"),tooltip:d(6590,null),icon:L.add,f1:!1,category:fi,precondition:Z.inputHasText,keybinding:[{when:C.and(Z.inChatInput,KDo),primary:515,weight:101},{when:C.and(Z.inChatInput,_0i,zDo),primary:3,weight:101}]})}run(i,...e){let o=i.get(Lt).lastFocusedWidget;if(!(!o?.viewModel||!o.getInput().trim())){if(!o.viewModel.model.requestInProgress.get()){o.acceptInput();return}o.acceptInput(void 0,{queue:"queued"})}}},Q6=class a extends z{static{this.ID="workbench.action.chat.steerWithMessage"}constructor(){super({id:a.ID,title:P(6595,"Steer with Message"),tooltip:d(6596,null),icon:L.arrowUp,f1:!1,category:fi,precondition:Z.inputHasText,keybinding:[{when:C.and(Z.inChatInput,_0i,KDo),primary:3,weight:101},{when:C.and(Z.inChatInput,zDo),primary:515,weight:101}]})}run(i,...e){let o=i.get(Lt).lastFocusedWidget;if(!(!o?.viewModel||!o.getInput().trim())){if(!o.viewModel.model.requestInProgress.get()){o.acceptInput();return}o.acceptInput(void 0,{queue:"steering"})}}},C0i=class a extends z{static{this.ID="workbench.action.chat.removePendingRequest"}constructor(){super({id:a.ID,title:P(6593,"Remove from Queue"),icon:L.close,f1:!1,category:fi,menu:[{id:R.ChatMessageTitle,group:"navigation",order:4,when:C.and(Z.isRequest,Z.isPendingRequest)}]})}run(i,...e){let t=i.get(si),[o]=e;if(_r(o)&&o.pendingKind){t.removePendingRequest(o.sessionResource,o.id);return}if(ubn(o)){t.removePendingRequest(o.sessionResource,o.pendingRequestId);return}}},x0i=class a extends z{static{this.ID="workbench.action.chat.editPendingRequest"}constructor(){super({id:a.ID,title:P(6588,"Edit"),icon:L.edit,f1:!1,category:fi,menu:[{id:R.ChatMessageTitle,group:"navigation",order:2,when:C.and(Z.isRequest,Z.isPendingRequest,C.notEquals("config.chat.editRequests","hover"),C.notEquals("config.chat.editRequests","input"))}]})}run(i,...e){let t=i.get(Lt),[o]=e;if(!_r(o)||!o.pendingKind)return;t.getWidgetBySessionResource(o.sessionResource)?.startEditing(o.id)}},k0i=class a extends z{static{this.ID="workbench.action.chat.sendPendingImmediately"}constructor(){super({id:a.ID,title:P(6594,"Send Immediately"),icon:L.arrowUp,f1:!1,category:fi,menu:[{id:R.ChatMessageTitle,group:"navigation",order:3,when:C.and(Z.isRequest,Z.isPendingRequest)}]})}async run(i,...e){let t=i.get(si),o=i.get(Lt),[n]=e;if(!_r(n)||!n.pendingKind)return;let s=o.getWidgetBySessionResource(n.sessionResource)?.viewModel?.model;if(!s)return;let l=s.getPendingRequests(),c=l.findIndex(h=>h.request.id===n.id);if(c===-1)return;let u=l[c],p=[{requestId:u.request.id,kind:u.kind},...l.filter((h,g)=>g!==c).map(h=>({requestId:h.request.id,kind:h.kind}))];t.setPendingRequests(n.sessionResource,p),await t.cancelCurrentRequestForSession(n.sessionResource,"queueRunNext"),t.processPendingRequests(n.sessionResource)}},E0i=class a extends z{static{this.ID="workbench.action.chat.removeAllPendingRequests"}constructor(){super({id:a.ID,title:P(6592,"Remove All Queued"),icon:L.clearAll,f1:!1,category:fi,menu:[{id:R.ChatContext,group:"navigation",order:3,when:Z.hasPendingRequests}]})}run(i,...e){let t=i.get(si),o=i.get(Lt),[n]=e,s=(_r(n)&&o.getWidgetBySessionResource(n.sessionResource)||o.lastFocusedWidget)?.viewModel?.model;if(s)for(let l of[...s.getPendingRequests()])t.removePendingRequest(s.sessionResource,l.request.id)}};function GDo(){W(j6),W(Q6),W(C0i),W(x0i),W(k0i),W(E0i),be.appendMenuItem(R.ChatExecuteQueue,{command:{id:j6.ID,title:P(6589,"Add to Queue"),icon:L.add},group:"navigation",order:1}),be.appendMenuItem(R.ChatExecuteQueue,{command:{id:Q6.ID,title:P(6595,"Steer with Message"),icon:L.arrowUp},group:"navigation",order:2}),be.appendMenuItem(R.ChatExecute,{submenu:R.ChatExecuteQueue,title:P(6591,"Queue"),icon:L.listOrdered,when:C.and(_0i,Z.inputHasText),group:"navigation",order:4})}var pbn="chat.installRecommendationAvailable",ebe=class extends k{constructor(e,t,o,n){super();this.productService=e;this.extensionGalleryService=t;this.extensionManagementService=o;this.contextKeyService=n;this.availabilityContextKeys=new Map;this.refreshRequestId=0;let r=this.productService.chatSessionRecommendations;if(!r?.length||!this.extensionGalleryService.isEnabled())return;for(let l of r)this.registerRecommendation(l);let s=()=>this.refreshInstallAvailability();this._register(this.extensionManagementService.onProfileAwareDidInstallExtensions(s)),this._register(this.extensionManagementService.onProfileAwareDidUninstallExtension(s)),this._register(this.extensionManagementService.onDidChangeProfile(s)),this.refreshInstallAvailability()}static{this.ID="workbench.contrib.chatAgentRecommendation"}registerRecommendation(e){let t=hi.toKey(e.extensionId),o=`chat.installRecommendation.${t}.${e.name}`,n=`${pbn}.${t}`,r=new Y(n,!1).bindTo(this.contextKeyService);this.availabilityContextKeys.set(t,r);let s=P(6440,"New {0}",e.displayName);this._register(W(class extends z{constructor(){super({id:o,title:s,tooltip:e.description,f1:!1,category:fi,icon:L.extensions,menu:[{id:R.ChatNewMenu,group:"4_recommendations",when:C.equals(n,!0)}]})}async run(l){let c=l.get(fe),u=l.get(Ze),p=l.get(si),h=u.quality!=="stable";await c.executeCommand("workbench.extensions.installExtension",e.extensionId,{installPreReleaseVersion:h}),await mbn(c,p,e.postInstallCommand)}}))}refreshInstallAvailability(){if(!this.availabilityContextKeys.size)return;let e=++this.refreshRequestId;this.extensionManagementService.getInstalled().then(t=>{if(e!==this.refreshRequestId)return;let o=new Set(t.map(n=>hi.toKey(n.identifier.id)));for(let[n,r]of this.availabilityContextKeys)r.set(!o.has(n))},()=>{if(e===this.refreshRequestId)for(let[,t]of this.availabilityContextKeys)t.set(!1)})}};ebe=I([m(0,Ze),m(1,ga),m(2,Dd),m(3,X)],ebe);async function mbn(a,i,e){if(e){await hbn(e),await i.activateDefaultAgent("panel");try{await a.executeCommand(e)}catch{}}}function hbn(a){return Ge.getCommands().has(a)?Promise.resolve():new Promise(i=>{let e=new Nl,t=Ge.onDidRegisterCommand(o=>{o===a&&(t.dispose(),e.dispose(),i())});e.cancelAndSet(()=>{t.dispose(),i()},1e4)})}var tbe=class extends k{static{this.ID="workbench.contrib.chatTransfer"}constructor(i){super(),i.checkAndSetTransferredWorkspaceTrust()}};tbe=I([m(0,QVe)],tbe);var gbn=Oe("chat-debug-editor-label-icon",L.bug,d(7726,null)),zE=class a extends Ls{constructor(){super(...arguments);this.resource=a.RESOURCE}static{this.ID="workbench.editor.chatDebug"}static{this.RESOURCE=A.from({scheme:"chat-debug",path:"default"})}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}get typeId(){return a.ID}get editorId(){return a.ID}get capabilities(){return 10}getName(){return d(7727,null)}getIcon(){return gbn}matches(e){return super.matches(e)?!0:e instanceof a}},U5t=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return zE.instance}};function qDo(){W(class extends z{constructor(){super({id:"workbench.action.chat.openAgentDebugPanel",title:P(6564,"Open Agent Debug Logs"),f1:!0,category:Fe.Developer,precondition:Z.enabled})}async run(t){let o=t.get(ie),n=t.get(ph);n.activeSessionResource=void 0;let r={pinned:!0,viewHint:"home"};await o.openEditor(zE.instance,r)}}),W(class extends z{constructor(){super({id:"workbench.action.chat.openAgentDebugPanelForSession",title:P(6565,"Show Agent Debug Logs"),f1:!1,category:fi,precondition:Z.enabled,menu:[{id:LC,when:C.and(Z.enabled,C.equals("view",Xr)),order:0,group:"4_logs"},{id:R.ChatWelcomeContext,group:"2_settings",order:0,when:Z.inChatEditor.negate()},{id:R.ViewTitle,when:C.and(Z.enabled,C.equals("view",Xr)),order:0,group:"4_logs"}]})}async run(t,o,n){let r=t.get(ie),s=t.get(Lt),l=t.get(ph),c;A.isUri(o)?c=o:xfe(o)&&(c=o.sessionResource),c||(c=s.lastFocusedWidget?.viewModel?.sessionResource),l.activeSessionResource=c;let u={pinned:!0,sessionResource:c,viewHint:"logs",filter:n};await r.openEditor(zE.instance,u)}});let a="agent-debug-log.json",i=[{name:d(6568,null),extensions:["json"]}];W(class extends z{constructor(){super({id:"workbench.action.chat.exportAgentDebugLog",title:P(6562,"Export Agent Debug Log..."),icon:L.chatExport,f1:!0,category:Fe.Developer,precondition:Z.enabled,menu:[{id:R.EditorTitle,group:"navigation",when:Tr.isEqualTo(zE.ID),order:10}]})}async run(t){let o=t.get(ph),n=t.get(nn),r=t.get(ge),s=t.get(Ne),l=t.get(Je),c=t.get(_e),u=o.activeSessionResource;if(!u){s.notify({severity:ft.Info,message:d(6572,null)});return}let g=(Br.parseLocalSessionId(u)??(u.path.replace(/^\//,"")||u.authority))?.replace(/[/\\:*?"<>|.]+/g,"_").replace(/^_+|_+$/g,""),f=g?`agent-debug-log-${g}.json`:a,v=Ve(await n.defaultFilePath(),f),b=await n.showSaveDialog({defaultUri:v,filters:i});if(!b)return;let S=await o.exportLog(u);if(!S){s.notify({severity:ft.Warning,message:d(6566,null)});return}await r.writeFile(b,Ke.wrap(S)),c.publicLog2("chatDebugLogExported",{fileSizeBytes:S.byteLength}),s.prompt(ft.Info,d(6567,null),[{label:d(6573,null),run:()=>l.open(b)}])}}),W(class extends z{constructor(){super({id:"workbench.action.chat.importAgentDebugLog",title:P(6563,"Import Agent Debug Log..."),icon:L.chatImport,f1:!0,category:Fe.Developer,precondition:Z.enabled,menu:[{id:R.EditorTitle,group:"navigation",when:Tr.isEqualTo(zE.ID),order:11}]})}async run(t){let o=t.get(ph),n=t.get(ct),r=t.get(ie),s=t.get(nn),l=t.get(ge),c=t.get(Ne),u=t.get(_e),p=Ve(await s.defaultFilePath(),a),h=await s.showOpenDialog({defaultUri:p,canSelectFiles:!0,filters:i});if(!h)return;let g=50*1024*1024,f=await l.stat(h[0]);if(f.size!==void 0&&f.size>g){u.publicLog2("chatDebugLogImported",{fileSizeBytes:f.size,result:"fileTooLarge"}),await n.warn(d(6570,null),d(6569,null,(f.size/(1024*1024)).toFixed(1)));return}let v=await l.readFile(h[0]),b=await o.importLog(v.value.buffer);if(!b){u.publicLog2("chatDebugLogImported",{fileSizeBytes:v.value.byteLength,result:"providerFailed"}),c.notify({severity:ft.Warning,message:d(6571,null)});return}u.publicLog2("chatDebugLogImported",{fileSizeBytes:v.value.byteLength,result:"success"});let S={pinned:!0,sessionResource:b,viewHint:"overview"};await r.openEditor(zE.instance,S)}})}var D0i=class{constructor(i){this.capacity=i;this._head=0;this._size=0;this._buffer=new Array(i)}get size(){return this._size}push(i){let e=(this._head+this._size)%this.capacity;this._buffer[e]=i,this._size<this.capacity?this._size++:this._head=(this._head+1)%this.capacity}toArray(){let i=[];for(let e=0;e<this._size;e++){let t=this._buffer[(this._head+e)%this.capacity];t&&i.push(t)}return i}removeWhere(i){let e=0;for(let t=0;t<this._size;t++){let o=(this._head+t)%this.capacity,n=this._buffer[o];if(!(n&&i(n))){if(e!==t){let r=(this._head+e)%this.capacity;this._buffer[r]=n}e++}}for(let t=e;t<this._size;t++)this._buffer[(this._head+t)%this.capacity]=void 0;this._size=e}clear(){this._buffer.fill(void 0),this._head=0,this._size=0}},z5t=class a extends k{constructor(){super(...arguments);this._sessionBuffers=new dt;this._sessionOrder=[];this._seenEventIds=new dt;this._onDidAddEvent=this._register(new T);this.onDidAddEvent=this._onDidAddEvent.event;this._onDidClearProviderEvents=this._register(new T);this.onDidClearProviderEvents=this._onDidClearProviderEvents.event;this._onDidChangeAvailableSessionResources=this._register(new T);this.onDidChangeAvailableSessionResources=this._onDidChangeAvailableSessionResources.event;this._providers=new Set;this._invocationCts=new dt;this._providerEvents=new WeakSet;this._importedSessions=new dt;this._availableSessionResources=[];this._availableSessionResourceSet=new Set;this._historicalSessionTitles=new dt;this._importedSessionTitles=new dt;this._availableSessionsFetchStarted=!1;this._availableSessionsRequested=!1}static{this.MAX_EVENTS_PER_SESSION=1e4}static{this.MAX_SESSIONS=5}static{this._eventKindPriority={subagentInvocation:0,modelTurn:1,toolCall:2,agentResponse:3,userMessage:4,generic:5}}static{this._debugEligibleSessionTypes=new Set([kl,"copilotcli","claude-code"])}_isDebugEligibleSession(e){return a._debugEligibleSessionTypes.has(yn(e))||this._importedSessions.has(e)}log(e,t,o,n=1,r){this._isDebugEligibleSession(e)&&this.addEvent({kind:"generic",id:r?.id,sessionResource:e,created:new Date,name:t,details:o,level:n,category:r?.category,parentEventId:r?.parentEventId})}addEvent(e){if(e.id){let o=this._seenEventIds.get(e.sessionResource);o||(o=new Map,this._seenEventIds.set(e.sessionResource,o));let n=o.get(e.id);if(n!==void 0){let r=a._eventKindPriority;if((r[e.kind]??5)>=(r[n]??5))return}if(o.set(e.id,e.kind),o.size>a.MAX_EVENTS_PER_SESSION){let r=o.keys().next().value;r!==void 0&&o.delete(r)}}let t=this._sessionBuffers.get(e.sessionResource);if(t){let o=this._sessionOrder.length-1;if(o<0||!Jn.isEqual(this._sessionOrder[o],e.sessionResource)){let n=this._sessionOrder.findIndex(r=>Jn.isEqual(r,e.sessionResource));n!==-1&&n!==o&&(this._sessionOrder.splice(n,1),this._sessionOrder.push(e.sessionResource))}}else{if(this._sessionOrder.length>=a.MAX_SESSIONS){let o=this._sessionOrder.shift();this._evictSession(o)}t=new D0i(a.MAX_EVENTS_PER_SESSION),this._sessionBuffers.set(e.sessionResource,t),this._sessionOrder.push(e.sessionResource)}t.push(e),this._onDidAddEvent.fire(e)}addProviderEvent(e){this._providerEvents.add(e),this.addEvent(e)}getEvents(e){if(e){let o=this._sessionBuffers.get(e);if(!o)return[];let n=o.toArray();return this._isSorted(n)||n.sort((r,s)=>r.created.getTime()-s.created.getTime()),n=this._deduplicateEvents(n),n}let t=[];for(let o of this._sessionBuffers.values())t.push(...o.toArray());return t.sort((o,n)=>o.created.getTime()-n.created.getTime()),t}_isSorted(e){for(let t=1;t<e.length;t++)if(e[t].created.getTime()<e[t-1].created.getTime())return!1;return!0}_deduplicateEvents(e){let t=new Map,o=a._eventKindPriority,n=[];for(let r of e){if(!r.id){n.push(r);continue}let s=t.get(r.id);if(s===void 0)t.set(r.id,n.length),n.push(r);else{let l=n[s];(o[r.kind]??5)<(o[l.kind]??5)&&(n[s]=r)}}return n}getSessionResources(){return[...this._sessionOrder]}clear(){this._sessionBuffers.clear(),this._sessionOrder.length=0,this._seenEventIds.clear(),this._importedSessions.clear(),this._importedSessionTitles.clear(),this._availableSessionResources.length=0,this._availableSessionResourceSet.clear(),this._historicalSessionTitles.clear()}_evictSession(e){this._sessionBuffers.delete(e),this._seenEventIds.delete(e),this._importedSessions.delete(e),this._importedSessionTitles.delete(e);let t=this._invocationCts.get(e);t&&(t.cancel(),t.dispose(),this._invocationCts.delete(e))}registerProvider(e){this._providers.add(e);for(let[t,o]of this._invocationCts)o.token.isCancellationRequested||this._invokeProvider(e,t,o.token).catch(mt);return ee(()=>{this._providers.delete(e)})}hasInvokedProviders(e){return this._invocationCts.has(e)}async invokeProviders(e){if(!this._isDebugEligibleSession(e))return;let t=this._invocationCts.get(e);t&&(t.cancel(),t.dispose()),this._clearProviderEvents(e);let o=new qe;this._invocationCts.set(e,o);try{let n=[...this._providers].map(r=>this._invokeProvider(r,e,o.token));await Promise.allSettled(n)}catch(n){mt(n)}}async _invokeProvider(e,t,o){try{let n=await e.provideChatDebugLog(t,o);if(n)for(let s=0;s<n.length&&!o.isCancellationRequested;s++)this.addProviderEvent({...n[s],sessionResource:n[s].sessionResource??t}),s>0&&s%500===0&&await Li(0)}catch(n){mt(n)}}endSession(e){let t=this._invocationCts.get(e);t&&(t.cancel(),t.dispose(),this._invocationCts.delete(e))}_clearProviderEvents(e){let t=this._sessionBuffers.get(e);if(t){let o=t.toArray().filter(n=>!this._providerEvents.has(n));t.clear();for(let n of o)t.push(n)}this._seenEventIds.delete(e),this._onDidClearProviderEvents.fire(e)}async resolveEvent(e){for(let t of this._providers)if(t.resolveChatDebugLogEvent)try{let o=await t.resolveChatDebugLogEvent(e,Ie.None);if(o!==void 0)return o}catch(o){mt(o)}}isCoreEvent(e){return!this._providerEvents.has(e)}setImportedSessionTitle(e,t){this._importedSessionTitles.set(e,t)}getImportedSessionTitle(e){return this._importedSessionTitles.get(e)}addAvailableSessionResources(e){let t=!1;for(let{uri:o,title:n}of e){let r=o.toString();this._availableSessionResourceSet.has(r)||(this._availableSessionResourceSet.add(r),this._availableSessionResources.push(o),t=!0),n&&this._historicalSessionTitles.set(o,n)}t&&this._onDidChangeAvailableSessionResources.fire()}getAvailableSessionResources(){this._availableSessionsRequested=!0,this._tryFetchAvailableSessions();let e=new Set(this._sessionOrder.map(o=>o.toString())),t=[...this._sessionOrder];for(let o of this._availableSessionResources)e.has(o.toString())||(e.add(o.toString()),t.push(o));return t}registerAvailableSessionsFetcher(e){this._availableSessionsFetcher=e,this._availableSessionsFetchStarted=!1,this._tryFetchAvailableSessions()}_tryFetchAvailableSessions(){if(!this._availableSessionsFetcher||!this._availableSessionsRequested||this._availableSessionsFetchStarted)return;this._availableSessionsFetchStarted=!0;let e=this._availableSessionsFetcher;e(Ie.None).then(t=>{t.length>0&&this.addAvailableSessionResources(t)}).catch(mt)}getHistoricalSessionTitle(e){return this._historicalSessionTitles.get(e)}async exportLog(e){for(let t of this._providers)if(t.provideChatDebugLogExport)try{let o=await t.provideChatDebugLogExport(e,Ie.None);if(o!==void 0)return o}catch(o){mt(o)}}async importLog(e){for(let t of this._providers)if(t.resolveChatDebugLogImport)try{let o=await t.resolveChatDebugLogImport(e,Ie.None);if(o!==void 0)return this._importedSessions.set(o,!0),o}catch(o){mt(o)}}dispose(){for(let e of this._invocationCts.values())e.cancel(),e.dispose();this._invocationCts.clear(),this.clear(),this._providers.clear(),super.dispose()}};var fbn=_;var K5t=new Y("chatDebugFilterActive",!1),G5t=new Y("chatDebug.kindToolCall",!0),q5t=new Y("chatDebug.kindModelTurn",!0),$5t=new Y("chatDebug.kindPromptDiscovery",!0),j5t=new Y("chatDebug.kindSubagent",!0),jDo="chatDebug.filter.toggleToolCall",QDo="chatDebug.filter.toggleModelTurn",YDo="chatDebug.filter.togglePromptDiscovery",XDo="chatDebug.filter.toggleSubagent",hy=class a extends Wte{constructor(e,t=!1){super();this._text=e;this._isLink=t}equals(e){return e instanceof a&&e._text===this._text}dispose(){}render(e){e.classList.add("chat-debug-breadcrumb-item"),this._isLink&&e.classList.add("chat-debug-breadcrumb-item-link"),D(e,fbn("span.chat-debug-breadcrumb-item-label",void 0,this._text))}};function Yne(a,i){return $(a,ne.KEY_DOWN,e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),i.focusPrev();break;case"ArrowRight":e.preventDefault(),i.focusNext();break;case"Home":e.preventDefault(),i.setFocused(i.getItems()[0]);break;case"End":{e.preventDefault();let t=i.getItems();i.setFocused(t[t.length-1]);break}case"Enter":case" ":{e.preventDefault();let t=i.getFocused();t&&i.setSelection(t);break}}})}function R0i(a,i){if(a.kind.toLowerCase().includes(i))return!0;switch(a.kind){case"toolCall":return a.toolName.toLowerCase().includes(i)||(a.input?.toLowerCase().includes(i)??!1)||(a.output?.toLowerCase().includes(i)??!1);case"modelTurn":return(a.model?.toLowerCase().includes(i)??!1)||(a.requestName?.toLowerCase().includes(i)??!1);case"generic":return a.name.toLowerCase().includes(i)||(a.details?.toLowerCase().includes(i)??!1)||(a.category?.toLowerCase().includes(i)??!1);case"subagentInvocation":return a.agentName.toLowerCase().includes(i)||(a.description?.toLowerCase().includes(i)??!1);case"userMessage":case"agentResponse":return a.message.toLowerCase().includes(i)||a.sections.some(e=>e.name.toLowerCase().includes(i)||e.content.toLowerCase().includes(i))}}var vbn=/\b(?:before|after):\d{4}(?:-\d{2}(?:-\d{2}(?:t\d{1,2}(?::\d{2}(?::\d{2})?)?)?)?)?(\b|$)/g;function L0i(a,i){let t=new RegExp(`${i}:(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:t(\\d{1,2})(?::(\\d{2})(?::(\\d{2}))?)?)?)?)?(?!\\w)`).exec(a);if(!t)return;let o=parseInt(t[1],10),n=t[2]!==void 0?parseInt(t[2],10)-1:void 0,r=t[3]!==void 0?parseInt(t[3],10):void 0,s=t[4]!==void 0?parseInt(t[4],10):void 0,l=t[5]!==void 0?parseInt(t[5],10):void 0,c=t[6]!==void 0?parseInt(t[6],10):void 0;return i==="before"?c!==void 0?new Date(o,n,r,s,l,c,999).getTime():l!==void 0?new Date(o,n,r,s,l,59,999).getTime():s!==void 0?new Date(o,n,r,s,59,59,999).getTime():r!==void 0?new Date(o,n,r,23,59,59,999).getTime():n!==void 0?new Date(o,n+1,0,23,59,59,999).getTime():new Date(o,11,31,23,59,59,999).getTime():new Date(o,n??0,r??1,s??0,l??0,c??0,0).getTime()}function JDo(a){return a.replace(vbn,"").trim()}var Q5t=class extends k{constructor(){super(...arguments);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.filterKindToolCall=!0;this.filterKindModelTurn=!0;this.filterKindPromptDiscovery=!0;this.filterKindSubagent=!0;this.textFilter=""}isKindVisible(e,t){switch(e){case"toolCall":return this.filterKindToolCall;case"modelTurn":return this.filterKindModelTurn;case"generic":return t!=="discovery"&&t!=="customization"?!0:this.filterKindPromptDiscovery;case"subagentInvocation":return this.filterKindSubagent;default:return!0}}isAllKindsVisible(){return this.filterKindToolCall&&this.filterKindModelTurn&&this.filterKindPromptDiscovery&&this.filterKindSubagent}isAllFiltersDefault(){return this.isAllKindsVisible()}setTextFilter(e){let t=e.toLowerCase();this.textFilter!==t&&(this.textFilter=t,this.beforeTimestamp=L0i(t,"before"),this.afterTimestamp=L0i(t,"after"),this._onDidChange.fire())}get textFilterWithoutTimestamps(){return JDo(this.textFilter)}isTimestampVisible(e){let t=e.getTime();return!(this.beforeTimestamp!==void 0&&t>this.beforeTimestamp||this.afterTimestamp!==void 0&&t<this.afterTimestamp)}fire(){this._onDidChange.fire()}};function ZDo(a,i){let e=new O;K5t.bindTo(i).set(!0);let t=G5t.bindTo(i);t.set(!0);let o=q5t.bindTo(i);o.set(!0);let n=$5t.bindTo(i);n.set(!0);let r=j5t.bindTo(i);r.set(!0);let s=(l,c,u,p,h,g,f)=>{e.add(Ge.registerCommand(l,()=>{let v=!h();g(v),f.set(v),a.fire()})),e.add(be.appendMenuItem(qx,{command:{id:l,title:c,toggled:u},group:p,when:K5t}))};return s(jDo,d(7754,null),G5t,"1_kind",()=>a.filterKindToolCall,l=>{a.filterKindToolCall=l},t),s(QDo,d(7751,null),q5t,"1_kind",()=>a.filterKindModelTurn,l=>{a.filterKindModelTurn=l},o),s(YDo,d(7752,null),$5t,"1_kind",()=>a.filterKindPromptDiscovery,l=>{a.filterKindPromptDiscovery=l},n),s(XDo,d(7753,null),j5t,"1_kind",()=>a.filterKindSubagent,l=>{a.filterKindSubagent=l},r),e}function Y5t(a,i){K5t.bindTo(i).set(!0);let e=G5t.bindTo(i),t=q5t.bindTo(i),o=$5t.bindTo(i),n=j5t.bindTo(i);return()=>{e.set(a.filterKindToolCall),t.set(a.filterKindModelTurn),o.set(a.filterKindPromptDiscovery),n.set(a.filterKindSubagent)}}var f$=_,eRo=5,FBe=class extends k{constructor(e,t,o,n,r,s,l){super();this.chatService=t;this.chatDebugService=o;this.chatWidgetService=n;this.agentSessionsService=r;this.configurationService=s;this.preferencesService=l;this._onNavigateToSession=this._register(new T);this.onNavigateToSession=this._onNavigateToSession.event;this.renderDisposables=this._register(new O);this._visibleCount=eRo;this._lastKnownSessionCount=0;this.container=D(e,f$(".chat-debug-home")),this.scrollContent=D(this.container,f$("div.chat-debug-home-content")),this._register(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(OM)&&this.render()})),this._register(this.chatDebugService.onDidAddEvent(c=>{let u=this.chatDebugService.getSessionResources().length;u!==this._lastKnownSessionCount&&(this._lastKnownSessionCount=u,this.container.style.display!=="none"&&this.render())})),this._register(this.chatDebugService.onDidChangeAvailableSessionResources(()=>{this.container.style.display!=="none"&&this.render()}))}show(){this.container.style.display="",this.render()}hide(){this.container.style.display="none"}render(){let e=this.configurationService.getValue(OM);this._lastKnownSessionCount=this.chatDebugService.getSessionResources().length;let t=e?this._getFilteredSessionResources(this.chatDebugService.getAvailableSessionResources()):[];this._renderWithSessions(t)}_getFilteredSessionResources(e){let t=new Set(["copilotcli","claude-code"]);return[...e].filter(o=>!t.has(yn(o))||!ZD(o))}_renderWithSessions(e){if(St(this.scrollContent),this.renderDisposables.clear(),D(this.scrollContent,f$("h2.chat-debug-home-title",void 0,d(7798,null))),!this.configurationService.getValue(OM)){D(this.scrollContent,f$("p.chat-debug-home-subtitle",void 0,d(7789,null)));let s=this.renderDisposables.add(new Pi(this.scrollContent,{...Ro,secondary:!0}));s.element.style.width="auto",s.label=d(7794,null),this.renderDisposables.add(s.onDidClick(()=>{this.preferencesService.openSettings({jsonEditor:!1,query:`@id:${OM}`})}));return}let n=this.chatWidgetService.lastFocusedWidget?.viewModel?.sessionResource,r=s=>{if(!s)return;let l=e.findIndex(c=>c.toString()===s.toString());l>0&&(e.splice(l,1),e.unshift(s))};if(r(this._lastOpenedSessionResource),r(n),D(this.scrollContent,f$("p.chat-debug-home-subtitle",void 0,e.length>0?d(7790,null):d(7793,null))),e.length>0){let s=e.slice(0,this._visibleCount),l=D(this.scrollContent,f$(".chat-debug-home-session-list"));l.setAttribute("role","list"),l.setAttribute("aria-label",d(7796,null));let c=[];for(let u of s){let h=this.agentSessionsService.model.getSession(u)?.label??this.chatService.getSessionTitle(u),g=this.chatDebugService.getImportedSessionTitle(u),f=this.chatDebugService.getHistoricalSessionTitle(u),v;if(h&&!Pyt(h))v=h;else if(f)v=f;else if(g)v=d(7791,null,g);else if(Br.isLocalSession(u))v=d(7792,null);else if(yn(u)==="copilotcli"){let E=u.path.replace(/^\//,"").split("-")[0]||u.authority||u.toString();v=d(7788,null,E)}else if(yn(u)==="claude-code"){let E=u.path.replace(/^\//,"").split("-")[0]||u.authority||u.toString();v=d(7787,null,E)}else v=d(7792,null);let b=n!==void 0&&u.toString()===n.toString(),S=D(l,f$("button.chat-debug-home-session-item"));S.setAttribute("role","listitem"),b&&(S.classList.add("chat-debug-home-session-item-active"),S.setAttribute("aria-current","true")),D(S,f$(`span${q.asCSSSelector(L.comment)}`));let y=D(S,f$("span.chat-debug-home-session-item-title"));y.textContent=v;let w=b?d(7795,null,v):v;S.setAttribute("aria-label",w),b&&D(S,f$("span.chat-debug-home-session-badge",void 0,d(7786,null))),this.renderDisposables.add($(S,ne.CLICK,()=>{this._lastOpenedSessionResource=u,this._onNavigateToSession.fire(u)})),c.push(S)}if(e.length>this._visibleCount){let u=e.length-this._visibleCount,p=this.renderDisposables.add(new Pi(this.scrollContent,{...Ro,secondary:!0}));p.element.classList.add("chat-debug-home-show-more"),p.label=d(7797,null,u),this.renderDisposables.add(p.onDidClick(()=>{this._visibleCount+=eRo,this.render()}))}this.renderDisposables.add($(l,ne.KEY_DOWN,u=>{if(c.length===0)return;let p=Un(),h=c.indexOf(p);if(h===-1)return;let g;switch(u.key){case"ArrowDown":g=h+1<c.length?h+1:h;break;case"ArrowUp":g=h-1>=0?h-1:h;break;case"Home":g=0;break;case"End":g=c.length-1;break}g!==void 0&&(u.preventDefault(),c[g].focus())}))}}};FBe=I([m(1,si),m(2,ph),m(3,Lt),m(4,Vc),m(5,B),m(6,Qo)],FBe);var rv=_,bbn=nd.NumberFormat(),Sbn=nd.NumberFormat(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}),Ibn=1e9;var WBe=class extends k{constructor(e,t,o,n,r){super();this.chatService=t;this.chatDebugService=o;this.chatWidgetService=n;this.chatSessionsService=r;this._onNavigate=this._register(new T);this.onNavigate=this._onNavigate.event;this.loadDisposables=this._register(new O);this.isFirstLoad=!0;this.container=D(e,rv(".chat-debug-overview")),Wi(this.container),this.refreshScheduler=this._register(new Dt(()=>this.doRefresh(),100));let s=D(this.container,rv(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new RW(s,3,void 0,L.chevronRight,YF)),this._register(Yne(s,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(l=>{l.type==="select"&&l.item instanceof hy&&(this.breadcrumbWidget.setSelection(void 0),this.breadcrumbWidget.getItems().indexOf(l.item)===0&&this._onNavigate.fire("home"))})),this.content=D(this.container,rv(".chat-debug-overview-content"))}setSession(e){this.currentSessionResource=e,this.isFirstLoad=!0}show(){Xo(this.container),this.load()}hide(){Wi(this.container),this.refreshScheduler.cancel()}refresh(){this.container.style.display!=="none"&&(this.refreshScheduler.isScheduled()||this.refreshScheduler.schedule())}doRefresh(){if(this.metricsContainer&&this.currentSessionResource){St(this.metricsContainer);let e=this.chatDebugService.getEvents(this.currentSessionResource);this.renderMetricsContent(this.metricsContainer,e),this.isFirstLoad=!1}else this.load()}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Br.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new hy(d(7895,null),!0),new hy(e)])}load(){if(St(this.content),this.loadDisposables.clear(),this.updateBreadcrumb(),!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Br.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString(),t=D(this.content,rv(".chat-debug-overview-title-row")),o=D(t,rv("h2.chat-debug-overview-title"));D(o,rv(`span${q.asCSSSelector(L.comment)}`)),o.append(e);let n=D(t,rv(".chat-debug-overview-title-actions")),r=this.loadDisposables.add(new Pi(n,{ariaLabel:d(7889,null),title:d(7889,null)}));r.element.classList.add("chat-debug-icon-button"),r.icon=L.goToFile,this.loadDisposables.add(r.onDidClick(()=>{this.currentSessionResource&&this.chatWidgetService.openSession(this.currentSessionResource)})),this.renderSessionDetails(this.currentSessionResource);let s=this.chatDebugService.getEvents(this.currentSessionResource);this.renderDerivedOverview(s,this.isFirstLoad&&s.length===0),this.isFirstLoad=!1}renderSessionDetails(e){let t=this.chatService.getSession(e),o=[],n=yn(e),s=this.chatSessionsService.getChatSessionContribution(n)?.displayName||(n===kl?d(7891,null):n);if(o.push({label:d(7874,null),value:s}),t){let l=this.getLocationLabel(t.initialLocation);o.push({label:d(7873,null),value:l});let u=t.requestInProgress.get()?d(7893,null):d(7892,null);o.push({label:d(7875,null),value:u});let p=t.timing;o.push({label:d(7871,null),value:new Date(p.created).toLocaleString()}),p.lastRequestEnded?o.push({label:d(7872,null),value:new Date(p.lastRequestEnded).toLocaleString()}):p.lastRequestStarted&&o.push({label:d(7872,null),value:new Date(p.lastRequestStarted).toLocaleString()})}if(o.length>0){let l=D(this.content,rv(".chat-debug-overview-section"));D(l,rv("h3.chat-debug-overview-section-label",void 0,d(7890,null)));let c=D(l,rv(".chat-debug-overview-details"));for(let u of o){let p=D(c,rv(".chat-debug-overview-detail-row"));D(p,rv("span.chat-debug-overview-detail-label",void 0,u.label)),D(p,rv("span.chat-debug-overview-detail-value",void 0,u.value))}}}getLocationLabel(e){switch(e){case"panel":return d(7877,null);case"terminal":return d(7880,null);case"notebook":return d(7879,null);case"editor":return d(7878,null);default:return String(e)}}renderDerivedOverview(e,t){let o=D(this.content,rv(".chat-debug-overview-section"));D(o,rv("h3.chat-debug-overview-section-label",void 0,d(7894,null))),this.metricsContainer=D(o,rv(".chat-debug-overview-metrics")),t?this.renderMetricsShimmer(this.metricsContainer):this.renderMetricsContent(this.metricsContainer,e);let n=D(this.content,rv(".chat-debug-overview-section"));D(n,rv("h3.chat-debug-overview-section-label",void 0,d(7876,null)));let r=D(n,rv(".chat-debug-overview-actions")),s=this.loadDisposables.add(new Pi(r,{...Ro,secondary:!0,supportIcons:!0,title:d(7896,null)}));s.element.classList.add("chat-debug-overview-action-button"),s.label=`$(list-flat) ${d(7896,null)}`,this.loadDisposables.add(s.onDidClick(()=>{this._onNavigate.fire("logs")}));let l=this.loadDisposables.add(new Pi(r,{...Ro,secondary:!0,supportIcons:!0,title:d(7869,null)}));l.element.classList.add("chat-debug-overview-action-button"),l.label=`$(type-hierarchy) ${d(7869,null)}`,this.loadDisposables.add(l.onDidClick(()=>{this._onNavigate.fire("flowchart")}));let c=this.loadDisposables.add(new Pi(r,{...Ro,secondary:!0,supportIcons:!0,title:d(7870,null)}));c.element.classList.add("chat-debug-overview-action-button"),c.label=`$(database) ${d(7870,null)}`,this.loadDisposables.add(c.onDidClick(()=>{this._onNavigate.fire("cache")}))}renderMetricsShimmer(e){let t=[d(7883,null),d(7884,null),d(7886,null),d(7887,null),d(7885,null),d(7888,null),d(7882,null)];for(let o of t){let n=D(e,rv(".chat-debug-overview-metric-card"));D(n,rv("div.chat-debug-overview-metric-label",void 0,o));let r=D(n,rv("div.chat-debug-overview-metric-value")),s=D(r,rv("span.chat-debug-overview-metric-shimmer"));s.textContent="\xA0"}}renderMetricsContent(e,t){let o=t.filter(f=>f.kind==="modelTurn"),n=t.filter(f=>f.kind==="toolCall"),r=t.filter(f=>f.kind==="generic"&&f.level===3||f.kind==="toolCall"&&f.result==="error"),s=bbn.value,l=o.reduce((f,v)=>f+(v.inputTokens??0),0),c=o.reduce((f,v)=>f+(v.outputTokens??0),0),u=o.reduce((f,v)=>f+(v.cachedTokens??0),0),p=o.reduce((f,v)=>f+(v.totalTokens??0),0),h=o.reduce((f,v)=>f+(v.copilotUsageNanoAiu??0),0),g=[{label:d(7883,null),value:s.format(o.length)},{label:d(7884,null),value:s.format(n.length)},{label:d(7886,null),value:s.format(l)},{label:d(7887,null),value:s.format(c)},{label:d(7885,null),value:s.format(u)},{label:d(7888,null),value:s.format(p)},{label:d(7882,null),value:s.format(r.length)}];if(h>0){let f=h/Ibn;g.push({label:d(7881,null),value:Sbn.value.format(f)})}for(let f of g){let v=D(e,rv(".chat-debug-overview-metric-card"));D(v,rv("div.chat-debug-overview-metric-label",void 0,f.label)),D(v,rv("div.chat-debug-overview-metric-value",void 0,f.value))}}};WBe=I([m(1,si),m(2,ph),m(3,Lt),m(4,Ms)],WBe);var M0i=_;function S1(a,i=""){return a==null||typeof a!="string"?i:a}var ybn=nd.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"}),wbn=nd.NumberFormat();function P0i(a){return ybn.value.format(a.created)}function J5t(a){switch(a.kind){case"toolCall":return S1(a.toolName,d(7749,null));case"modelTurn":return S1(a.model)||d(7747,null);case"generic":return S1(a.name,d(7749,null));case"subagentInvocation":return S1(a.agentName,d(7749,null));case"userMessage":return d(7750,null);case"agentResponse":return d(7746,null)}}function A0i(a){switch(a.kind){case"toolCall":return S1(a.result);case"modelTurn":return[S1(a.requestName),a.totalTokens!==void 0?d(7748,null,wbn.value.format(a.totalTokens)):""].filter(Boolean).join(" \xB7 ");case"generic":return S1(a.details);case"subagentInvocation":return S1(a.description)||S1(a.status);case"userMessage":return S1(a.message);case"agentResponse":return S1(a.message)}}function tRo(a,i){i.created.textContent=P0i(a),i.name.textContent=J5t(a),i.details.textContent=A0i(a);let e=a.kind==="generic"&&a.level===3||a.kind==="toolCall"&&a.result==="error",t=a.kind==="generic"&&a.level===2,o=a.kind==="generic"&&a.level===0;i.container.classList.toggle("chat-debug-log-error",e),i.container.classList.toggle("chat-debug-log-warning",t),i.container.classList.toggle("chat-debug-log-trace",o)}function iRo(a){a.classList.add("chat-debug-log-row");let i=D(a,M0i("span.chat-debug-log-created")),e=D(a,M0i("span.chat-debug-log-name")),t=D(a,M0i("span.chat-debug-log-details"));return{container:a,created:i,name:e,details:t}}var Plt=class a{static{this.TEMPLATE_ID="chatDebugEvent"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){return iRo(i)}renderElement(i,e,t){tRo(i,t)}disposeTemplate(i){}},Alt=class{getHeight(i){return 28}getTemplateId(i){return Plt.TEMPLATE_ID}},X5t=class a{static{this.TEMPLATE_ID="chatDebugEvent"}get templateId(){return a.TEMPLATE_ID}renderTemplate(i){return iRo(i)}renderElement(i,e,t){tRo(i.element,t)}disposeTemplate(i){}};var Y6=nd.NumberFormat();function oRo(a){switch(a.kind){case"toolCall":{let i=[d(7742,null,a.toolName)];return a.toolCallId&&i.push(d(7731,null,a.toolCallId)),a.result&&i.push(d(7740,null,a.result)),a.durationInMillis!==void 0&&i.push(d(7733,null,Y6.value.format(a.durationInMillis))),a.input&&i.push(`
${d(7734,null)}
${a.input}`),a.output&&i.push(`
${d(7738,null)}
${a.output}`),i.join(`
`)}case"modelTurn":{let i=[a.model??d(7736,null)];return a.inputTokens!==void 0&&i.push(d(7735,null,Y6.value.format(a.inputTokens))),a.outputTokens!==void 0&&i.push(d(7739,null,Y6.value.format(a.outputTokens))),a.cachedTokens!==void 0&&i.push(d(7730,null,Y6.value.format(a.cachedTokens))),a.totalTokens!==void 0&&i.push(d(7744,null,Y6.value.format(a.totalTokens))),a.durationInMillis!==void 0&&i.push(d(7733,null,Y6.value.format(a.durationInMillis))),i.join(`
`)}case"generic":return`${a.name}
${a.details??""}`;case"subagentInvocation":{let i=[d(7728,null,a.agentName)];return a.description&&i.push(d(7732,null,a.description)),a.status&&i.push(d(7741,null,a.status)),a.durationInMillis!==void 0&&i.push(d(7733,null,Y6.value.format(a.durationInMillis))),a.toolCallCount!==void 0&&i.push(d(7743,null,Y6.value.format(a.toolCallCount))),a.modelTurnCount!==void 0&&i.push(d(7737,null,Y6.value.format(a.modelTurnCount))),i.join(`
`)}case"userMessage":{let i=[d(7745,null,a.message)];for(let e of a.sections)i.push(`
--- ${e.name} ---
${e.content}`);return i.join(`
`)}case"agentResponse":{let i=[d(7729,null,a.message)];for(let e of a.sections)i.push(`
--- ${e.name} ---
${e.content}`);return i.join(`
`)}}}function Z5t(a,i,e,t,o=!1,n){let r=o;i.tabIndex=0,i.role="button",a.setAttribute("aria-hidden","true");let s=()=>{St(a);let l=r?L.chevronRight:L.chevronDown;a.classList.add(...q.asClassName(l).split(" ")),e.style.display=r?"none":"block",i.style.borderRadius=r?"":"3px 3px 0 0",i.setAttribute("aria-expanded",String(!r))};s(),t.add($(i,ne.CLICK,()=>{r=!r,a.className="chat-debug-message-section-chevron",s(),n?.scanDomNode()})),t.add($(i,ne.KEY_DOWN,l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),i.click())}))}var uc=_;function Cbn(a){switch(a){case"prompt":return"chat.promptFilesLocations";case"instructions":return"chat.instructionsFilesLocations";case"agent":return"chat.agentFilesLocations";case"skill":return"chat.agentSkillsLocations";case"hook":return"chat.hookFilesLocations";default:return}}function xbn(a,i,e){if(a.extensionId)return a.extensionId;let t=e==="skill"?ai(ai(a.uri)):ai(a.uri);return i.getUriLabel(t,{relative:!0})}function e4t(a,i,e,t,o,n,r,s,l,c){let u=uc(`a.${r1.className}.show-file-icons`);u.tabIndex=-1;let p=D(u,uc("span.icon")),h=Ia(o,n,a,e);p.classList.add(...h),D(u,uc("span.icon-label",void 0,i));let g=s.getUriLabel(a,{relative:!0}),f=c?`${g} ${c}`:g;return l.add(r.setupManagedHover(yi("element"),u,f)),l.add($(u,ne.CLICK,v=>{v.preventDefault(),v.stopPropagation(),t.open(a,{editorOptions:{preserveFocus:!0}})})),u}function N0i(a,i,e){if(i.length!==0){for(let t=0;t<i.length;t++)i[t].element.tabIndex=t===0?0:-1,i[t].element.setAttribute("role","listitem");e.add($(a,ne.KEY_DOWN,t=>{let o=t.target,n=i.findIndex(s=>s.element===o);if(n===-1)return;let r;switch(t.key){case"ArrowDown":r=Math.min(n+1,i.length-1);break;case"ArrowUp":r=Math.max(n-1,0);break;case"Home":r=0;break;case"End":r=i.length-1;break;case"Enter":{i[n].activate(),t.preventDefault();return}}r!==void 0&&r!==n&&(t.preventDefault(),i[n].element.tabIndex=-1,i[r].element.tabIndex=0,i[r].element.focus())}))}}function nRo(a,i,e,t,o,n,r){let s=new O,l=uc("div.chat-debug-file-list");l.tabIndex=0;let c=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1);D(l,uc("div.chat-debug-file-list-title",void 0,d(7597,null,c))),D(l,uc("div.chat-debug-file-list-summary",void 0,d(7618,null,a.files.length)));let u=a.files.filter(h=>h.status==="loaded");if(u.length>0){let h=D(l,uc("div.chat-debug-file-list-section"));D(h,uc("div.chat-debug-file-list-section-title",void 0,d(7599,null,u.length)));let g=new Map;for(let b of u){let S=xbn(b,n,a.discoveryType),y=g.get(S);y||(y=[],g.set(S,y)),y.push(b)}let f=D(h,uc("div.chat-debug-file-list-rows"));f.setAttribute("role","list"),f.setAttribute("aria-label",d(7600,null));let v=[];for(let[b,S]of g){let y=D(f,uc("div.chat-debug-file-list-group-header")),w=S[0];if(w.extensionId){let x=D(y,uc("a.chat-debug-file-list-group-label.chat-debug-file-list-badge-link"));x.textContent=b,x.tabIndex=-1,s.add(o.setupManagedHover(yi("element"),x,d(7602,null,w.extensionId))),s.add($(x,ne.CLICK,E=>{E.preventDefault(),E.stopPropagation(),i.open(A.parse(`command:extension.open?${encodeURIComponent(JSON.stringify([w.extensionId]))}`),{allowCommands:!0})}))}else D(y,uc("span.chat-debug-file-list-group-label",void 0,b));for(let x of S){let E=D(f,uc("div.chat-debug-file-list-row"));D(E,uc(`span.chat-debug-file-list-icon${q.asCSSSelector(L.check)}`)),E.appendChild(e4t(x.uri,x.name??x.uri.path,0,i,e,t,o,n,s));let M=n.getUriLabel(x.uri,{relative:!0});E.setAttribute("aria-label",M);let N=x.uri;v.push({element:E,activate:()=>i.open(N,{editorOptions:{preserveFocus:!0}})})}}N0i(f,v,s)}let p=a.files.filter(h=>h.status==="skipped");if(p.length>0){let h=D(l,uc("div.chat-debug-file-list-section"));D(h,uc("div.chat-debug-file-list-section-title",void 0,d(7613,null,p.length)));let g=new Map;for(let b of p){let S=b.skipReason??d(7619,null),y=g.get(S);y||(y=[],g.set(S,y)),y.push(b)}let f=D(h,uc("div.chat-debug-file-list-rows"));f.setAttribute("role","list"),f.setAttribute("aria-label",d(7614,null));let v=[];for(let[b,S]of g){let y=D(f,uc("div.chat-debug-file-list-group-header"));D(y,uc("span.chat-debug-file-list-group-label",void 0,b));for(let w of S){let x=D(f,uc("div.chat-debug-file-list-row"));D(x,uc(`span.chat-debug-file-list-icon${q.asCSSSelector(L.close)}`));let E="";w.errorMessage&&(E+=w.errorMessage),w.duplicateOf&&(E&&(E+=", "),E+=d(7598,null,w.duplicateOf.path)),x.appendChild(e4t(w.uri,w.name??w.uri.path,0,i,e,t,o,n,s)),E&&D(x,uc("span.chat-debug-file-list-detail",void 0,` (${E})`));let M=n.getUriLabel(w.uri,{relative:!0});x.setAttribute("aria-label",M);let N=w.uri;v.push({element:x,activate:()=>i.open(N,{editorOptions:{preserveFocus:!0}})})}}N0i(f,v,s)}if(a.sourceFolders&&a.sourceFolders.length>0){let h=D(l,uc("div.chat-debug-message-section")),g=D(h,uc("div.chat-debug-message-section-header")),f=D(g,uc("span.chat-debug-message-section-chevron"));D(g,uc("span.chat-debug-message-section-title",void 0,d(7615,null,a.sourceFolders.length)));let v=Cbn(a.discoveryType);if(v){let w=s.add(new Pi(g,{title:d(7603,null),ariaLabel:d(7588,null),hoverDelegate:yi("mouse")}));w.icon=L.settingsGear,w.element.classList.add("chat-debug-settings-gear"),s.add($(w.element,ne.MOUSE_ENTER,()=>{g.classList.add("chat-debug-settings-gear-header-passthrough")})),s.add($(w.element,ne.MOUSE_LEAVE,()=>{g.classList.remove("chat-debug-settings-gear-header-passthrough")})),s.add(w.onDidClick(x=>{x&&Kt.stop(x,!0),i.open(A.parse(`command:workbench.action.openSettings?${encodeURIComponent(JSON.stringify([`@id:${v}`]))}`),{allowCommands:!0})}))}let b=D(h,uc("div.chat-debug-source-folder-content"));b.tabIndex=0,b.setAttribute("role","region"),b.setAttribute("aria-label",d(7616,null));let S=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1),y=S.endsWith("s")?S:S+"s";D(b,uc("div.chat-debug-source-folder-note",void 0,d(7617,null,y)));for(let w=0;w<a.sourceFolders.length;w++){let x=a.sourceFolders[w],E=D(b,uc("div.chat-debug-source-folder-row"));D(E,uc("span.chat-debug-source-folder-index",void 0,`${w+1}.`)),D(E,uc("span.chat-debug-source-folder-label",void 0,x.uri.path))}Z5t(f,g,b,s,!0,r)}return{element:l,disposables:s}}function rRo(a){let i=[],e=a.discoveryType.charAt(0).toUpperCase()+a.discoveryType.slice(1);i.push(d(7606,null,e)),i.push(d(7611,null,a.files.length)),i.push("");let t=a.files.filter(n=>n.status==="loaded"),o=a.files.filter(n=>n.status==="skipped");if(t.length>0){i.push(d(7608,null,t.length));let n=new Map;for(let r of t){let s=a.discoveryType==="skill"?ai(ai(r.uri)):ai(r.uri),l=r.extensionId??s.path,c=n.get(l);c||(c=[],n.set(l,c)),c.push(r)}for(let[r,s]of n){i.push(`  ${r}`);for(let l of s){let c=l.name??l.uri.path;i.push(`    \u2713 ${c}`)}}i.push("")}if(o.length>0){i.push(d(7609,null,o.length));let n=new Map;for(let r of o){let s=r.skipReason??d(7612,null),l=n.get(s);l||(l=[],n.set(s,l)),l.push(r)}for(let[r,s]of n){i.push(`  ${r}`);for(let l of s){let u=`    \u2717 ${l.name??l.uri.path}`;if(l.errorMessage||l.duplicateOf){let p=[];l.errorMessage&&p.push(l.errorMessage),l.duplicateOf&&p.push(d(7607,null,l.duplicateOf.path)),u+=` (${p.join(", ")})`}i.push(u)}}}if(a.sourceFolders&&a.sourceFolders.length>0){i.push(""),i.push(d(7610,null,a.sourceFolders.length));for(let n of a.sourceFolders)i.push(`  ${n.uri.path}`)}return i.join(`
`)}function Nlt(a,i){switch(a){case"applying":return d(7591,null,i);case"referenced":return d(7592,null,i);case"skill":return d(7593,null,i);case"custom-agent":return d(7589,null,i);case"hook":return d(7590,null,i);case"skipped":return d(7594,null,i)}}function sRo(a,i,e,t,o,n,r){let s=new O,l=uc("div.chat-debug-customization-summary");l.tabIndex=0;let c=D(l,uc("div.chat-debug-file-list"));D(c,uc("div.chat-debug-file-list-title",void 0,d(7596,null))),D(c,uc("div.chat-debug-file-list-summary",void 0,d(7595,null,a.counts.instructions,a.counts.skills,a.counts.agents,a.counts.hooks,a.counts.skipped,a.durationInMillis.toFixed(1))));let u=a.resolutionLogs.filter(b=>b.category==="applying"||b.category==="referenced"),p=a.resolutionLogs.filter(b=>b.category==="skill"),h=a.resolutionLogs.filter(b=>b.category==="custom-agent"),g=a.resolutionLogs.filter(b=>b.category==="hook"),f=a.resolutionLogs.filter(b=>b.category==="skipped"),v=[{title:Nlt("applying",u.length),icon:L.book,entries:u},{title:Nlt("skill",p.length),icon:L.lightbulb,entries:p},{title:Nlt("custom-agent",h.length),icon:L.agent,entries:h},{title:Nlt("hook",g.length),icon:L.zap,entries:g},{title:Nlt("skipped",f.length),icon:L.close,entries:f}];for(let{title:b,icon:S,entries:y}of v){if(y.length===0)continue;let w=D(c,uc("div.chat-debug-file-list-section"));D(w,uc("div.chat-debug-file-list-section-title",void 0,b));let x=D(w,uc("div.chat-debug-file-list-rows"));x.setAttribute("role","list"),x.setAttribute("aria-label",b);let E=[];if(y.length>0&&y[0].category==="hook"){let N=new Map;for(let V of y){let H=V.reason??"",K=N.get(H);K||(K=[],N.set(H,K)),K.push(V)}for(let[V,H]of N){V&&D(x,uc("div.chat-debug-file-list-group-header",void 0,V));for(let K of H){let j=D(x,uc("div.chat-debug-file-list-row"));if(D(j,uc(`span.chat-debug-file-list-icon${q.asCSSSelector(S)}`)),K.uri){j.appendChild(e4t(K.uri,K.name,0,i,e,t,o,n,s));let J=K.uri;E.push({element:j,activate:()=>i.open(J,{editorOptions:{preserveFocus:!0}})})}else D(j,uc("span",void 0,K.name));j.setAttribute("aria-label",K.reason?`${K.name} \u2014 ${K.reason}`:K.name)}}}else for(let N of y){let V=D(x,uc("div.chat-debug-file-list-row"));D(V,uc(`span.chat-debug-file-list-icon${q.asCSSSelector(S)}`));let H=N.category!=="skill"&&N.category!=="custom-agent";if(N.uri){V.appendChild(e4t(N.uri,N.name,0,i,e,t,o,n,s,H?N.reason:void 0));let K=N.uri;E.push({element:V,activate:()=>i.open(K,{editorOptions:{preserveFocus:!0}})})}else D(V,uc("span",void 0,N.name));H&&N.reason&&D(V,uc("span.chat-debug-file-list-detail",void 0,` \u2014 ${N.reason}`)),V.setAttribute("aria-label",N.reason?`${N.name} \u2014 ${N.reason}`:N.name)}N0i(x,E,s)}return a.resolutionLogs.length===0&&D(c,uc("div.chat-debug-file-list-summary",void 0,d(7601,null))),{element:l,disposables:s}}function aRo(a){let i=[];i.push(d(7605,null)),i.push(d(7604,null,a.counts.instructions,a.counts.skills,a.counts.agents,a.counts.hooks,a.counts.skipped,a.durationInMillis.toFixed(1))),i.push("");for(let e of a.resolutionLogs){let t=e.reason?`${e.name} \u2014 ${e.reason}`:e.name;i.push(`  [${e.category}] ${t}`)}return i.join(`
`)}var v$=_,kbn=zf("chatDebugTokenizer",{createHTML(a){return a}});function Ebn(a){try{return{parsed:JSON.parse(a),isJSON:!0}}catch{return{isJSON:!1}}}async function yO(a,i){let e=Ebn(a),t=e.isJSON?JSON.stringify(e.parsed,null,2):a,o=e.isJSON?"json":"markdown",n=await EK(i,t,o);return{plainText:t,tokenizedHtml:n}}function wO(a,i,e,t,o,n=!1,r,s){let l=D(a,v$("div.chat-debug-message-section")),c=D(l,v$("div.chat-debug-message-section-header")),u=D(c,v$("span.chat-debug-message-section-chevron"));if(D(c,v$("span.chat-debug-message-section-title",void 0,i)),r){let g=o.add(new Pi(c,{title:d(7897,null),ariaLabel:d(7897,null),hoverDelegate:yi("mouse")}));g.icon=L.copy,g.element.classList.add("chat-debug-section-copy-btn"),o.add($(g.element,ne.MOUSE_ENTER,()=>{c.classList.add("chat-debug-section-copy-header-passthrough")})),o.add($(g.element,ne.MOUSE_LEAVE,()=>{c.classList.remove("chat-debug-section-copy-header-passthrough")})),o.add(g.onDidClick(f=>{f&&Kt.stop(f,!0),r.writeText(e)}))}let p=D(l,v$("div.chat-debug-message-section-content-wrapper")),h=D(p,v$("pre.chat-debug-message-section-content"));if(h.tabIndex=0,t){let g=kbn?.createHTML(t)??t;h.innerHTML=g}else h.textContent=e;Z5t(u,c,p,o,n,s)}async function lRo(a,i,e,t){let o=new O,n=v$("div.chat-debug-message-content");n.tabIndex=0,D(n,v$("div.chat-debug-message-content-title",void 0,a.toolName));let r=[];a.result&&r.push(a.result==="success"?d(7904,null):d(7901,null)),a.durationInMillis!==void 0&&r.push(d(7899,null,a.durationInMillis)),r.length>0&&D(n,v$("div.chat-debug-message-content-summary",void 0,r.join(" \xB7 ")));let s=D(n,v$("div.chat-debug-message-sections"));if(a.input){let{plainText:l,tokenizedHtml:c}=await yO(a.input,i);wO(s,d(7898,null),l,c,o,!1,e,t)}if(a.output){let{plainText:l,tokenizedHtml:c}=await yO(a.output,i);wO(s,d(7902,null),l,c,o,!1,e,t)}return{element:n,disposables:o}}function cRo(a){let i=[];if(i.push(d(7905,null,a.toolName)),a.result&&i.push(d(7903,null,a.result)),a.durationInMillis!==void 0&&i.push(d(7900,null,a.durationInMillis)),a.input){i.push(""),i.push(`[${d(7898,null)}]`);try{let e=JSON.parse(a.input);i.push(JSON.stringify(e,null,2))}catch{i.push(a.input)}}if(a.output){i.push(""),i.push(`[${d(7902,null)}]`);try{let e=JSON.parse(a.output);i.push(JSON.stringify(e,null,2))}catch{i.push(a.output)}}return i.join(`
`)}var JR=_;async function dRo(a,i,e,t){let o=new O,n=JR("div.chat-debug-message-content");if(n.tabIndex=0,D(n,JR("div.chat-debug-message-content-title",void 0,d(7845,null))),D(n,JR("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let r=D(n,JR("div.chat-debug-message-sections"));D(r,JR("div.chat-debug-message-sections-label",void 0,d(7843,null,a.sections.length)));for(let s of a.sections){let{plainText:l,tokenizedHtml:c}=await yO(s.content,i);wO(r,s.name,l,c,o,!1,e,t)}}return{element:n,disposables:o}}async function uRo(a,i,e,t){let o=new O,n=JR("div.chat-debug-message-content");if(n.tabIndex=0,D(n,JR("div.chat-debug-message-content-title",void 0,d(7842,null))),D(n,JR("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let r=D(n,JR("div.chat-debug-message-sections"));D(r,JR("div.chat-debug-message-sections-label",void 0,d(7844,null,a.sections.length)));for(let s of a.sections){let{plainText:l,tokenizedHtml:c}=await yO(s.content,i);wO(r,s.name,l,c,o,!1,e,t)}}return{element:n,disposables:o}}function O0i(a){let i=[],e=a.kind==="userMessage"?d(7845,null):d(7842,null);i.push(`${e}: ${a.message}`),i.push("");for(let t of a.sections)i.push(`--- ${t.name} ---`),i.push(t.content),i.push("");return i.join(`
`)}async function pRo(a,i,e,t){let o=new O,n=JR("div.chat-debug-message-content");n.tabIndex=0;let r=a.type==="user"?d(7845,null):d(7842,null);if(D(n,JR("div.chat-debug-message-content-title",void 0,r)),D(n,JR("div.chat-debug-message-content-summary",void 0,a.message)),a.sections.length>0){let s=D(n,JR("div.chat-debug-message-sections")),l=a.type==="user"?d(7843,null,a.sections.length):d(7844,null,a.sections.length);D(s,JR("div.chat-debug-message-sections-label",void 0,l));for(let c of a.sections){let{plainText:u,tokenizedHtml:p}=await yO(c.content,i);wO(s,c.name,u,p,o,!1,e,t)}}return{element:n,disposables:o}}function mRo(a){let i=[],e=a.type==="user"?d(7845,null):d(7842,null);i.push(`${e}: ${a.message}`),i.push("");for(let t of a.sections)i.push(`--- ${t.name} ---`),i.push(t.content),i.push("");return i.join(`
`)}var BP=_,B_=nd.NumberFormat();async function hRo(a,i,e,t){let o=new O,n=BP("div.chat-debug-message-content");n.tabIndex=0,D(n,BP("div.chat-debug-message-content-title",void 0,d(7864,null)));let r=[];a.requestName&&r.push(a.requestName),a.model&&r.push(a.model),a.status&&a.status!=="unknown"&&r.push(a.status),a.durationInMillis!==void 0&&r.push(d(7848,null,B_.value.format(a.durationInMillis))),r.length>0&&D(n,BP("div.chat-debug-message-content-summary",void 0,r.join(" \xB7 ")));let s=D(n,BP("div.chat-debug-model-turn-details"));if(a.inputTokens!==void 0&&D(s,BP("div",void 0,d(7852,null,B_.value.format(a.inputTokens)))),a.outputTokens!==void 0&&D(s,BP("div",void 0,d(7859,null,B_.value.format(a.outputTokens)))),a.cachedTokens!==void 0&&D(s,BP("div",void 0,d(7846,null,B_.value.format(a.cachedTokens)))),a.totalTokens!==void 0&&D(s,BP("div",void 0,d(7865,null,B_.value.format(a.totalTokens)))),a.timeToFirstTokenInMillis!==void 0&&D(s,BP("div",void 0,d(7867,null,B_.value.format(a.timeToFirstTokenInMillis)))),a.maxInputTokens!==void 0&&D(s,BP("div",void 0,d(7854,null,B_.value.format(a.maxInputTokens)))),a.maxOutputTokens!==void 0&&D(s,BP("div",void 0,d(7856,null,B_.value.format(a.maxOutputTokens)))),a.errorMessage&&D(s,BP("div.chat-debug-model-turn-error",void 0,d(7850,null,a.errorMessage))),a.sections&&a.sections.length>0){let l=D(n,BP("div.chat-debug-message-sections"));D(l,BP("div.chat-debug-message-sections-label",void 0,d(7862,null,a.sections.length)));for(let c of a.sections){let{plainText:u,tokenizedHtml:p}=await yO(c.content,i);wO(l,c.name,u,p,o,!1,e,t)}}return{element:n,disposables:o}}function gRo(a){let i=[];if(i.push(d(7861,null,a.requestName)),a.model&&i.push(d(7858,null,a.model)),a.status&&a.status!=="unknown"&&i.push(d(7863,null,a.status)),a.durationInMillis!==void 0&&i.push(d(7849,null,B_.value.format(a.durationInMillis))),a.timeToFirstTokenInMillis!==void 0&&i.push(d(7868,null,B_.value.format(a.timeToFirstTokenInMillis))),a.inputTokens!==void 0&&i.push(d(7853,null,B_.value.format(a.inputTokens))),a.outputTokens!==void 0&&i.push(d(7860,null,B_.value.format(a.outputTokens))),a.cachedTokens!==void 0&&i.push(d(7847,null,B_.value.format(a.cachedTokens))),a.totalTokens!==void 0&&i.push(d(7866,null,B_.value.format(a.totalTokens))),a.maxInputTokens!==void 0&&i.push(d(7855,null,B_.value.format(a.maxInputTokens))),a.maxOutputTokens!==void 0&&i.push(d(7857,null,B_.value.format(a.maxOutputTokens))),a.errorMessage&&i.push(d(7851,null,a.errorMessage)),a.sections&&a.sections.length>0){i.push("");for(let e of a.sections)i.push(`--- ${e.name} ---`),i.push(e.content),i.push("")}return i.join(`
`)}var t4t=_;async function fRo(a,i,e,t){let o=new O,n=t4t("div.chat-debug-message-content");n.tabIndex=0,D(n,t4t("div.chat-debug-message-content-title",void 0,a.hookType));let r=[];a.result!==void 0&&r.push(vRo(a.result)),a.exitCode!==void 0&&r.push(d(7803,null,a.exitCode)),a.durationInMillis!==void 0&&r.push(d(7800,null,a.durationInMillis)),r.length>0&&D(n,t4t("div.chat-debug-message-content-summary",void 0,r.join(" \xB7 ")));let s=D(n,t4t("div.chat-debug-message-sections"));if(a.command){let{plainText:l,tokenizedHtml:c}=await yO(a.command,i);wO(s,d(7799,null),l,c,o,!1,e,t)}if(a.input){let{plainText:l,tokenizedHtml:c}=await yO(a.input,i);wO(s,d(7805,null),l,c,o,!1,e,t)}if(a.output){let{plainText:l,tokenizedHtml:c}=await yO(a.output,i);wO(s,d(7806,null),l,c,o,!1,e,t)}if(a.errorMessage){let{plainText:l,tokenizedHtml:c}=await yO(a.errorMessage,i);wO(s,d(7802,null),l,c,o,!1,e,t)}return{element:n,disposables:o}}function vRo(a){switch(a){case 0:return d(7809,null);case 1:return d(7807,null);case 2:return d(7808,null);default:return String(a)}}function bRo(a){let i=[];if(i.push(d(7811,null,a.hookType)),a.result!==void 0&&i.push(d(7810,null,vRo(a.result))),a.exitCode!==void 0&&i.push(d(7804,null,a.exitCode)),a.durationInMillis!==void 0&&i.push(d(7801,null,a.durationInMillis)),a.command&&(i.push(""),i.push(`[${d(7799,null)}]`),i.push(a.command)),a.input){i.push(""),i.push(`[${d(7805,null)}]`);try{let e=JSON.parse(a.input);i.push(JSON.stringify(e,null,2))}catch{i.push(a.input)}}if(a.output){i.push(""),i.push(`[${d(7806,null)}]`);try{let e=JSON.parse(a.output);i.push(JSON.stringify(e,null,2))}catch{i.push(a.output)}}return a.errorMessage&&(i.push(""),i.push(`[${d(7802,null)}]`),i.push(a.errorMessage)),i.join(`
`)}var i4t=_,Tbn=350,_bn=200,Dbn=800,Xne=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.chatDebugService=t;this.instantiationService=o;this.editorService=n;this.clipboardService=r;this.hoverService=s;this.openerService=l;this.languageService=c;this._onDidHide=this._register(new T);this.onDidHide=this._onDidHide.event;this._onDidChangeWidth=this._register(new T);this.onDidChangeWidth=this._onDidChangeWidth.event;this.detailDisposables=this._register(new O);this.currentDetailText="";this._width=Tbn;this.element=D(e,i4t(".chat-debug-detail-panel")),this.contentContainer=i4t(".chat-debug-detail-content"),this.scrollable=this._register(new Ar(this.contentContainer,{horizontal:2,vertical:1})),this.element.style.width=`${this._width}px`,Wi(this.element),this.sash=this._register(new kh(e,{getVerticalSashLeft:()=>e.offsetWidth-this._width},{orientation:0})),this.sash.state=0;let u;this._register(this.sash.onDidStart(()=>u=this._width)),this._register(this.sash.onDidEnd(()=>{u=void 0,this.sash.layout()})),this._register(this.sash.onDidChange(p=>{if(u===void 0)return;let h=p.startX-p.currentX,g=Math.max(_bn,Math.min(Dbn,u+h));this._width=g,this.element.style.width=`${g}px`,this.sash.layout(),this._onDidChangeWidth.fire(g)})),this._register($(this.element,ne.KEY_DOWN,p=>{if((p.ctrlKey||p.metaKey)&&p.key==="a"){let h=p.target;if(h&&this.element.contains(h)){p.preventDefault();let g=Me(h),f=g.getSelection();if(f){let v=g.document.createRange();v.selectNodeContents(h),f.removeAllRanges(),f.addRange(v)}}}}))}get width(){return this._width}async show(e){if(e.id&&e.id===this.currentDetailEventId)return;this.currentDetailEventId=e.id;let t=e.id?await this.chatDebugService.resolveEvent(e.id):void 0;Xo(this.element),this.sash.state=3,this.sash.layout(),St(this.element),St(this.contentContainer),this.detailDisposables.clear();let o=D(this.element,i4t(".chat-debug-detail-header"));this.headerElement=o,this.element.appendChild(this.scrollable.getDomNode());let n=this.detailDisposables.add(new Pi(o,{ariaLabel:d(7725,null),title:d(7725,null)}));n.element.classList.add("chat-debug-detail-button"),n.icon=L.goToFile,this.firstFocusableElement=n.element,this.detailDisposables.add(n.onDidClick(()=>{this.editorService.openEditor({contents:this.currentDetailText,resource:void 0})}));let r=this.detailDisposables.add(new Pi(o,{ariaLabel:d(7724,null),title:d(7724,null)}));r.element.classList.add("chat-debug-detail-button"),r.icon=L.copy,this.detailDisposables.add(r.onDidClick(()=>{this.clipboardService.writeText(this.currentDetailText)}));let s=this.detailDisposables.add(new Pi(o,{ariaLabel:d(7723,null),title:d(7723,null)}));if(s.element.classList.add("chat-debug-detail-button"),s.icon=L.close,this.detailDisposables.add(s.onDidClick(()=>{this.hide()})),t&&t.kind==="fileList"){this.currentDetailText=rRo(t);let{element:c,disposables:u}=this.instantiationService.invokeFunction(p=>nRo(t,this.openerService,p.get(_t),this.languageService,this.hoverService,p.get(nt),this.scrollable));this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="customizationSummary"){this.currentDetailText=aRo(t);let{element:c,disposables:u}=this.instantiationService.invokeFunction(p=>sRo(t,this.openerService,p.get(_t),this.languageService,this.hoverService,p.get(nt),this.scrollable));this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="toolCall"){this.currentDetailText=cRo(t);let{element:c,disposables:u}=await lRo(t,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="message"){this.currentDetailText=mRo(t);let{element:c,disposables:u}=await pRo(t,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="modelTurn"){this.currentDetailText=gRo(t);let{element:c,disposables:u}=await hRo(t,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(t&&t.kind==="hook"){this.currentDetailText=bRo(t);let{element:c,disposables:u}=await fRo(t,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(e.kind==="userMessage"){this.currentDetailText=O0i(e);let{element:c,disposables:u}=await dRo(e,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else if(e.kind==="agentResponse"){this.currentDetailText=O0i(e);let{element:c,disposables:u}=await uRo(e,this.languageService,this.clipboardService,this.scrollable);if(this.currentDetailEventId!==e.id){u.dispose();return}this.detailDisposables.add(u),this.contentContainer.appendChild(c)}else{let c=D(this.contentContainer,i4t("pre"));c.tabIndex=0,t?this.currentDetailText=t.value:this.currentDetailText=oRo(e),c.textContent=this.currentDetailText}let l=this.element.parentElement?.clientHeight??0;l>0?this.layout(l):this.scrollable.scanDomNode()}get isVisible(){return this.element.style.display!=="none"}focus(){this.firstFocusableElement?.focus()}layout(e){let t=this.headerElement?.offsetHeight??0,o=Math.max(0,e-t),n=this.scrollable.getScrollPosition();this.contentContainer.style.height=`${o}px`,this.scrollable.scanDomNode(),this.scrollable.setScrollPosition({scrollTop:n.scrollTop}),this.sash.layout()}layoutSash(){this.sash.layout()}hide(){this.currentDetailEventId=void 0,this.firstFocusableElement=void 0,this.headerElement=void 0,Wi(this.element),this.sash.state=0,St(this.element),St(this.contentContainer),this.detailDisposables.clear(),this._onDidHide.fire()}};Xne=I([m(1,ph),m(2,F),m(3,ie),m(4,Bi),m(5,ot),m(6,Je),m(7,Rt)],Xne);var QC=_,o4t=1e3;var VBe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.filterState=t;this.chatService=o;this.chatDebugService=n;this.instantiationService=r;this.contextKeyService=s;this.clipboardService=l;this.contextMenuService=c;this._onNavigate=this._register(new T);this.onNavigate=this._onNavigate.event;this.logsViewMode="tree";this.events=[];this.filteredEvents=[];this.filterDirty=!0;this.cachedIncludeTerms=[];this.cachedExcludeTerms=[];this.eventListener=this._register(new ue);this.sessionStateDisposable=this._register(new ue);this.showMoreDisposables=this._register(new O);this.showMoreVisible=!1;this.visibleLimit=o4t;this.refreshScheduler=this._register(new Dt(()=>this.refreshList(),50)),this.container=D(e,QC(".chat-debug-logs")),Wi(this.container);let u=D(this.container,QC(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new RW(u,3,void 0,L.chevronRight,YF)),this._register(Yne(u,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(E=>{if(E.type==="select"&&E.item instanceof hy){this.breadcrumbWidget.setSelection(void 0);let N=this.breadcrumbWidget.getItems().indexOf(E.item);N===0?this._onNavigate.fire("home"):N===1&&this._onNavigate.fire("overview")}})),this.headerContainer=D(this.container,QC(".chat-debug-editor-header"));let p=this._register(this.contextKeyService.createScoped(this.headerContainer)),h=Y5t(this.filterState,p);h();let g=this._register(this.instantiationService.createChild(new Po([X,p])));this.filterWidget=this._register(g.createInstance(SG,{placeholder:d(7833,null),ariaLabel:d(7827,null)})),this.viewModeToggle=this._register(new Pi(this.headerContainer,{...Ro,secondary:!0,title:d(7840,null)})),this.viewModeToggle.element.classList.add("chat-debug-view-mode-toggle","monaco-text-button"),this.updateViewModeToggle(),this._register(this.viewModeToggle.onDidClick(()=>{this.toggleViewMode()})),D(this.headerContainer,QC(".viewpane-filter-container")).appendChild(this.filterWidget.element),this._register(this.filterWidget.onDidChangeFilterText(E=>{this.filterState.setTextFilter(E)})),this._register(this.filterState.onDidChange(()=>{h(),this.updateMoreFiltersChecked(),this.visibleLimit=o4t,this.filterDirty=!0,this.refreshList()}));let v=D(this.container,QC(".chat-debug-logs-content")),b=D(v,QC(".chat-debug-logs-main"));this.tableHeader=D(b,QC(".chat-debug-table-header")),D(this.tableHeader,QC("span.chat-debug-col-created",void 0,d(7821,null))),D(this.tableHeader,QC("span.chat-debug-col-name",void 0,d(7823,null))),D(this.tableHeader,QC("span.chat-debug-col-details",void 0,d(7822,null))),this.progressBar=this._register(new Cv(b,{...oC,ariaLabel:d(7832,null)})),this.bodyContainer=D(b,QC(".chat-debug-logs-body")),this.showMoreContainer=D(b,QC(".chat-debug-logs-show-more")),Wi(this.showMoreContainer),this.listContainer=D(this.bodyContainer,QC(".chat-debug-list-container")),Wi(this.listContainer);let S={getAriaLabel:E=>{switch(E.kind){case"toolCall":return d(7818,null,E.toolName,E.result?` (${E.result})`:"");case"modelTurn":return d(7815,null,E.model??d(7814,null),E.totalTokens!==void 0?d(7817,null,E.totalTokens):"",E.cachedTokens!==void 0?d(7813,null,E.cachedTokens):"");case"generic":return`${E.category?E.category+": ":""}${E.name}: ${E.details??""}`;case"subagentInvocation":return d(7816,null,E.agentName,E.description?` - ${E.description}`:"");case"userMessage":return d(7819,null,E.message);case"agentResponse":return d(7812,null,E.message)}},getWidgetAriaLabel:()=>d(7820,null)},y=0,w=new WeakMap,x={getId:E=>{if(E.id)return E.id;let M=w.get(E);return M||(M=`_fallback_${y++}`,w.set(E,M)),M}};this.list=this._register(this.instantiationService.createInstance(bc,"ChatDebugEvents",this.listContainer,new Alt,[new Plt],{identityProvider:x,accessibilityProvider:S})),this.treeContainer=D(this.bodyContainer,QC(".chat-debug-list-container")),this.tree=this._register(this.instantiationService.createInstance(hf,"ChatDebugEventsTree",this.treeContainer,new Alt,[new X5t],{identityProvider:x,accessibilityProvider:S})),this.detailPanel=this._register(this.instantiationService.createInstance(Xne,v)),this._register(this.detailPanel.onDidChangeWidth(()=>{this.currentDimension&&this.layout(this.currentDimension)})),this._register(this.detailPanel.onDidHide(()=>{this.list.getSelection().length>0&&this.list.setSelection([]),this.tree.getSelection().length>0&&this.tree.setSelection([]),this.currentDimension&&this.layout(this.currentDimension)})),this._register(this.list.onContextMenu(E=>{E.element&&this.showEventContextMenu(E.element,E.browserEvent)})),this._register(this.tree.onContextMenu(E=>{E.element&&this.showEventContextMenu(E.element,E.browserEvent)})),this._register(this.list.onDidChangeSelection(E=>{let M=E.elements[0];M?this.detailPanel.show(M):this.detailPanel.hide()})),this._register(this.tree.onDidChangeSelection(E=>{let M=E.elements[0];M?this.detailPanel.show(M):this.detailPanel.hide()}))}setSession(e){(!this.currentSessionResource||this.currentSessionResource.toString()!==e.toString())&&(this.visibleLimit=o4t),this.currentSessionResource=e}setFilterText(e){this.filterWidget.setFilterText(e)}show(){Xo(this.container),this.loadEvents(),this.refreshList()}hide(){Wi(this.container)}focus(){this.logsViewMode==="tree"?this.tree.domFocus():this.list.domFocus()}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Br.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new hy(d(7839,null),!0),new hy(e,!0),new hy(d(7831,null))])}layout(e){this.currentDimension=e;let t=22,o=this.headerContainer.offsetHeight,n=this.tableHeader.offsetHeight,r=this.showMoreContainer.offsetHeight,l=this.detailPanel.isVisible?this.detailPanel.width:0,c=e.height-t-o-n-r,u=e.width-l;this.logsViewMode==="tree"?this.tree.layout(c,u):this.list.layout(c,u),this.detailPanel.isVisible&&this.detailPanel.layout(c),this.detailPanel.layoutSash()}refreshList(){this.filterDirty&&(this.filteredEvents=this.events.filter(o=>this.passesCurrentFilter(o)),this.filterDirty=!1);let e=this.filteredEvents.length,t=e>this.visibleLimit?this.filteredEvents.slice(0,this.visibleLimit):this.filteredEvents;this.logsViewMode==="list"?this.list.splice(0,this.list.length,t):this.refreshTree(t),this.updateShowMore(e),this.currentDimension&&this.layout(this.currentDimension)}addEvent(e){this.binaryInsert(this.events,e),!this.filterDirty&&this.passesCurrentFilter(e)&&this.binaryInsert(this.filteredEvents,e),this.scheduleRefresh()}binaryInsert(e,t){let o=t.created.getTime(),n=0,r=e.length;for(;n<r;){let s=n+r>>>1;e[s].created.getTime()<=o?n=s+1:r=s}n===e.length?e.push(t):e.splice(n,0,t)}passesCurrentFilter(e){let t=e.kind==="generic"?e.category:void 0;return!(!this.filterState.isKindVisible(e.kind,t)||!this.filterState.isTimestampVisible(e.created)||(this.ensureCachedTerms(),this.cachedExcludeTerms.length>0&&this.cachedExcludeTerms.some(o=>R0i(e,o)))||this.cachedIncludeTerms.length>0&&!this.cachedIncludeTerms.some(o=>R0i(e,o)))}ensureCachedTerms(){let e=this.filterState.textFilterWithoutTimestamps;if(e===this.cachedTextFilter)return;if(this.cachedTextFilter=e,!e){this.cachedIncludeTerms=[],this.cachedExcludeTerms=[];return}let t=e.split(",").map(o=>o.trim()).filter(o=>o.length>0);this.cachedIncludeTerms=t.filter(o=>!o.startsWith("!")),this.cachedExcludeTerms=t.filter(o=>o.startsWith("!")).map(o=>o.slice(1).trim()).filter(o=>o.length>0)}scheduleRefresh(){this.refreshScheduler.isScheduled()||this.refreshScheduler.schedule()}loadEvents(){this.events=[...this.chatDebugService.getEvents(this.currentSessionResource||void 0)],this.filterDirty=!0;let e=this.chatDebugService.onDidAddEvent(o=>{(!this.currentSessionResource||o.sessionResource.toString()===this.currentSessionResource.toString())&&this.addEvent(o)}),t=this.chatDebugService.onDidClearProviderEvents(o=>{(!this.currentSessionResource||o.toString()===this.currentSessionResource.toString())&&(this.events=[...this.chatDebugService.getEvents(this.currentSessionResource||void 0)],this.filterDirty=!0,this.refreshList())});this.eventListener.value=Fn(e,t),this.updateBreadcrumb(),this.trackSessionState()}trackSessionState(){if(!this.currentSessionResource){this.progressBar.stop(),this.sessionStateDisposable.clear();return}let e=this.chatService.getSession(this.currentSessionResource);if(!e){this.progressBar.stop(),this.sessionStateDisposable.clear();return}this.sessionStateDisposable.value=ve(t=>{e.requestInProgress.read(t)?this.progressBar.infinite():this.progressBar.stop()})}refreshTree(e){let t=this.buildTreeHierarchy(e);this.tree.setChildren(null,t)}buildTreeHierarchy(e){let t=new Map,o=new Map,n=[];for(let s of e)s.id&&t.set(s.id,s);for(let s of e)if(s.parentEventId&&t.has(s.parentEventId)){let l=o.get(s.parentEventId);l||(l=[],o.set(s.parentEventId,l)),l.push(s)}else n.push(s);let r=s=>{let l=s.id?o.get(s.id):void 0;return{element:s,children:l?.map(r),collapsible:(l?.length??0)>0,collapsed:!1}};return n.map(r)}updateShowMore(e){if(e<=this.visibleLimit){this.showMoreVisible&&(Wi(this.showMoreContainer),this.showMoreVisible=!1);return}this.showMoreStatusLabel||(this.showMoreStatusLabel=D(this.showMoreContainer,QC("span.chat-debug-logs-show-more-status"))),this.showMoreBtn||(this.showMoreBtn=this.showMoreDisposables.add(new Pi(this.showMoreContainer,{...Ro,secondary:!0,title:d(7836,null)})),this.showMoreDisposables.add(this.showMoreBtn.onDidClick(()=>{this.visibleLimit+=o4t,this.refreshList()})));let t=Math.min(this.visibleLimit,e),o=e-t;this.showMoreStatusLabel.textContent=d(7834,null,t,e),this.showMoreBtn.label=d(7835,null,o),this.showMoreVisible||(Xo(this.showMoreContainer),this.showMoreVisible=!0)}toggleViewMode(){this.logsViewMode==="list"?(this.logsViewMode="tree",Wi(this.listContainer),Xo(this.treeContainer)):(this.logsViewMode="list",Xo(this.listContainer),Wi(this.treeContainer)),this.updateViewModeToggle(),this.refreshList(),this.currentDimension&&this.layout(this.currentDimension)}updateViewModeToggle(){let e=this.viewModeToggle.element;St(e);let t=this.logsViewMode==="tree";D(e,QC(`span${q.asCSSSelector(t?L.listTree:L.listFlat)}`));let o=D(e,QC("span.chat-debug-view-mode-labels")),n=D(o,QC("span.chat-debug-view-mode-label"));n.textContent=d(7841,null);let r=D(o,QC("span.chat-debug-view-mode-label"));r.textContent=d(7830,null),t?r.classList.add("hidden"):n.classList.add("hidden");let s=t?d(7837,null):d(7838,null);e.setAttribute("aria-label",s),this.viewModeToggle.setTitle(s)}updateMoreFiltersChecked(){this.filterWidget.checkMoreFilters(!this.filterState.isAllFiltersDefault())}showEventContextMenu(e,t){let o=e.created,n=c=>String(c).padStart(2,"0"),r=`${o.getFullYear()}-${n(o.getMonth()+1)}-${n(o.getDate())}T${n(o.getHours())}:${n(o.getMinutes())}:${n(o.getSeconds())}`,s=[P0i(e),J5t(e),A0i(e)].filter(Boolean).join("	"),l=J5t(e);this.contextMenuService.showContextMenu({getAnchor:()=>Wp(t)?new Ln(Me(this.container),t):this.container,getActions:()=>[new it("chatDebug.copyTimestamp",d(7825,null),void 0,!0,()=>this.clipboardService.writeText(r)),new it("chatDebug.copyRow",d(7824,null),void 0,!0,()=>this.clipboardService.writeText(s)),new oi,new it("chatDebug.filterBefore",d(7828,null),void 0,!0,()=>this.applyFilterToken(`before:${r}`)),new it("chatDebug.filterAfter",d(7826,null),void 0,!0,()=>this.applyFilterToken(`after:${r}`)),new it("chatDebug.filterName",d(7829,null),void 0,!!l,()=>this.applyFilterToken(l))]})}applyFilterToken(e){this.filterWidget.setFilterText(e)}};VBe=I([m(2,si),m(3,ph),m(4,F),m(5,X),m(6,Bi),m(7,Xe)],VBe);function Rbn(a,i){return a.length<=i?a:a.substring(0,i-1)+"\u2026"}function W0i(a){let i=["runSubagent","search_subagent"];function e(b){for(let S of i){if(b===S)return!0;if(b.startsWith(S)){let y=b[S.length];if(y==="-"||y===" "||y==="("||y===":")return!0}}return!1}let t=/^\u{1F6E0}\uFE0F?\s*/u;function o(b){return b.replace(t,"")}let n=new Map,r=new Map;for(let b of a)if(b.kind==="subagentInvocation"&&e(b.agentName)&&b.description&&b.parentEventId){let S=n.get(b.parentEventId);S||(S=[],n.set(b.parentEventId,S)),S.push(b.description)}function s(b){if(b.kind!=="subagentInvocation"||!b.parentEventId)return;let S=n.get(b.parentEventId);if(!S||S.length===0)return b.description&&b.description!==b.agentName?b.description:void 0;let y=r.get(b.parentEventId)??0;return r.set(b.parentEventId,y+1),S[y]??S[0]}let l=a.filter(b=>!(b.kind==="subagentInvocation"&&e(b.agentName))),c=new Map,u=new Map,p=[];for(let b of l)b.id&&c.set(b.id,b);for(let b of l)if(b.parentEventId&&c.has(b.parentEventId)){let S=u.get(b.parentEventId);S||(S=[],u.set(b.parentEventId,S)),S.push(b)}else p.push(b);function h(b){let S=b.id?u.get(b.id):void 0,y=Mbn(b),w=Pbn(b,y),x=Abn(b,y),E=Obn(b),M;if(y==="subagentInvocation"){M=s(b);let N=M?.replace(/^Subagent:\s*/i,"");if(w=N?d(7770,null,Rbn(N,30)):d(7769,null),M&&E&&!E.includes(M)){let V=E.split(`
`);V.splice(1,0,M),E=V.join(`
`)}}return{id:b.id??`event-${a.indexOf(b)}`,kind:y,category:b.kind==="generic"?b.category:void 0,label:w,sublabel:x,description:M,tooltip:E,isError:Nbn(b),created:b.created.getTime(),children:S?.map(h)??[]}}let g=p.map(h);return f(g);function f(b){let S=!1,y=[];for(let w of b)if(w.kind==="toolCall"&&e(o(w.label))){S=!0;let x=v(w.children),E=x.filter(M=>M.kind==="subagentInvocation");if(E.length>0){let M=x.filter(N=>N.kind!=="subagentInvocation");for(let N=0;N<E.length;N++){let V=N===0?M:[];y.push({...E[N],children:f([...E[N].children,...V])})}}else y.push(...f(x))}else{let x=f(w.children);x!==w.children?(S=!0,y.push({...w,children:x})):y.push(w)}return S?y:b}function v(b){if(!b.some(y=>y.kind==="generic"&&y.category==="subagent"))return b;let S=[];for(let y of b)if(y.kind==="generic"&&y.category==="subagent"){let w=y.children.find(x=>x.kind==="subagentInvocation");if(w){let x=y.children.filter(E=>E!==w);S.push({...w,children:[...w.children,...x]})}else S.push(...y.children)}else S.push(y);return S}}function V0i(a,i){let e=F0i(a,i.isKindVisible);return i.textFilter&&(e=wRo(e,i.textFilter)),e}function F0i(a,i){let e=[],t=!1;for(let o of a){if(!i(o.kind,o.category)){if(t=!0,o.kind==="subagentInvocation")continue;e.push(...F0i(o.children,i));continue}let n=F0i(o.children,i);n!==o.children?(t=!0,e.push({...o,children:n})):e.push(o)}return t?e:a}function Lbn(a,i){return a.label.toLowerCase().includes(i)||(a.sublabel?.toLowerCase().includes(i)??!1)||(a.tooltip?.toLowerCase().includes(i)??!1)}function wRo(a,i){let e=[];for(let t of a){if(Lbn(t,i)){e.push(t);continue}let o=wRo(t.children,i);o.length>0&&e.push({...t,children:o})}return e}function CRo(a){let i=0;for(let e of a)i+=1+CRo(e.children);return i}function B0i(a,i){let e=CRo(a);if(e<=i)return{nodes:a,totalCount:e,shownCount:e};let t=i;function o(s){let l=[];for(let c of s){if(t<=0)break;if(t--,c.children.length===0||t<=0)l.push(c.children.length===0?c:{...c,children:[]});else{let u=o(c.children);l.push(u!==c.children?{...c,children:u}:c)}}return l}let n=o(a),r=i-t;return{nodes:n,totalCount:e,shownCount:r}}function SRo(a){return a.kind==="generic"&&a.category==="discovery"}function r4t(a){let i=[],e=0;for(;e<a.length;){let t=a[e];if(!SRo(t)){let u=r4t(t.children);i.push(u!==t.children?{...t,children:u}:t),e++;continue}let o=[t],n=e+1;for(;n<a.length&&SRo(a[n]);)o.push(a[n]),n++;if(o.length<2){i.push(t),e=n;continue}let r=`merged-discovery:${o[0].id}`,s=o.map(u=>u.label),l=[...new Set(s)],c=l.length<=2?l.join(", "):d(7764,null,l[0],o.length-1);i.push({id:r,kind:"generic",category:"discovery",label:c,sublabel:d(7765,null,o.length),tooltip:o.map(u=>u.label+(u.sublabel?`: ${u.sublabel}`:"")).join(`
`),created:o[0].created,children:[],mergedNodes:o}),e=n}return i}function IRo(a){return a.kind==="toolCall"}function yRo(a){return a.label}function Olt(a){let i=[],e=0;for(;e<a.length;){let t=a[e];if(!IRo(t)){let l=Olt(t.children);i.push(l!==t.children?{...t,children:l}:t),e++;continue}let o=yRo(t),n=[t],r=e+1;for(;r<a.length&&IRo(a[r])&&yRo(a[r])===o;)n.push(a[r]),r++;if(n.length<2){let l=Olt(t.children);i.push(l!==t.children?{...t,children:l}:t),e=r;continue}let s=`merged-toolCall:${n[0].id}`;i.push({id:s,kind:"toolCall",label:o,sublabel:d(7773,null,n.length),tooltip:n.map(l=>l.label+(l.sublabel?`: ${l.sublabel}`:"")).join(`
`),created:n[0].created,children:[],mergedNodes:n}),e=r}return i}function Mbn(a){if(a.kind==="generic"){let i=a.name.toLowerCase().replace(/[\s_-]+/g,"");if(i==="usermessage"||i==="userprompt"||i==="user"||i.startsWith("usermessage"))return"userMessage";if(i==="response"||i.startsWith("agentresponse")||i.startsWith("assistantresponse")||i.startsWith("modelresponse"))return"agentResponse";let e=a.category?.toLowerCase();if(e==="user"||e==="usermessage")return"userMessage";if(e==="response"||e==="agentresponse")return"agentResponse"}return a.kind}function Pbn(a,i){switch(i??a.kind){case"userMessage":return d(7785,null);case"modelTurn":return a.kind==="modelTurn"?a.model??d(7767,null):d(7767,null);case"toolCall":return a.kind==="toolCall"?a.toolName:a.kind==="generic"?a.name:d(7772,null);case"subagentInvocation":return a.kind==="subagentInvocation"?a.agentName:d(7768,null);case"agentResponse":return d(7763,null);case"generic":return a.kind==="generic"?a.name:d(7766,null)}}function Abn(a,i){switch(i??a.kind){case"modelTurn":{let t=[];return a.kind==="modelTurn"&&a.requestName&&t.push(a.requestName),a.kind==="modelTurn"&&a.totalTokens&&t.push(d(7771,null,a.totalTokens)),a.kind==="modelTurn"&&a.durationInMillis&&t.push(n4t(a.durationInMillis)),t.length>0?t.join(" \xB7 "):void 0}case"toolCall":{let t=[];return a.kind==="toolCall"&&a.result&&t.push(a.result),a.kind==="toolCall"&&a.durationInMillis&&t.push(n4t(a.durationInMillis)),t.length>0?t.join(" \xB7 "):void 0}case"subagentInvocation":{let t=[];return a.kind==="subagentInvocation"&&a.status&&t.push(a.status),a.kind==="subagentInvocation"&&a.durationInMillis&&t.push(n4t(a.durationInMillis)),t.length>0?t.join(" \xB7 "):void 0}case"userMessage":case"agentResponse":{let t;if(a.kind==="userMessage"||a.kind==="agentResponse"?t=a.message:a.kind==="generic"&&(t=a.details),!t)return;let o=t.split(`
`),n="";for(let r of o){let s=r.trim();if(s&&s.length>2){n=s;break}}return n||(n=t.replace(/\s+/g," ").trim()),n?n.length>60?n.substring(0,57)+"...":n:void 0}default:return}}function n4t(a){return a<1e3?`${a}ms`:`${(a/1e3).toFixed(1)}s`}function Nbn(a){return a.kind==="toolCall"&&a.result==="error"||a.kind==="generic"&&a.level===3||a.kind==="subagentInvocation"&&a.status==="failed"}var Jne=500;function Obn(a){switch(a.kind){case"userMessage":{let i=a.message.trim();return i.length>Jne?i.substring(0,Jne)+"\u2026":i||void 0}case"toolCall":{let i=[a.toolName];if(a.input){let e=a.input.trim();i.push(d(7776,null,e.length>Jne?e.substring(0,Jne)+"\u2026":e))}if(a.output){let e=a.output.trim();i.push(d(7779,null,e.length>Jne?e.substring(0,Jne)+"\u2026":e))}return a.result&&i.push(d(7781,null,a.result)),i.join(`
`)}case"subagentInvocation":{let i=[a.agentName];return a.description&&i.push(a.description),a.status&&i.push(d(7782,null,a.status)),a.toolCallCount!==void 0&&i.push(d(7784,null,a.toolCallCount)),a.modelTurnCount!==void 0&&i.push(d(7778,null,a.modelTurnCount)),i.join(`
`)}case"generic":{if(a.details){let i=a.details.trim();return i.length>Jne?i.substring(0,Jne)+"\u2026":i}return}case"modelTurn":{let i=[];return a.model&&i.push(a.model),a.totalTokens!==void 0&&i.push(d(7783,null,a.totalTokens)),a.inputTokens!==void 0&&i.push(d(7777,null,a.inputTokens)),a.outputTokens!==void 0&&i.push(d(7780,null,a.outputTokens)),a.cachedTokens!==void 0&&i.push(d(7774,null,a.cachedTokens)),a.durationInMillis!==void 0&&i.push(d(7775,null,n4t(a.durationInMillis))),i.length>0?i.join(`
`):void 0}default:return}}var a4t=36,Fbn=52,_Ro=140,Wbn=320,H0i=16,s4t=6,HP=24,HBe=6,Vbn=1.5,Flt=12,Wlt=10,X6=12,BBe=24,U0i=40,ibe=22,xRo=3,l4t=36,Bbn=5e3;function DRo(a){let i=[];for(let l=0;l<a.length;l++)a[l].kind==="subagentInvocation"&&i.push(l);if(i.length<2)return[{type:"sequential",children:a}];let e=[],t=[i[0]];for(let l=1;l<i.length;l++){let c=a[i[l-1]].created,u=a[i[l]].created;Math.abs(u-c)<=Bbn?t.push(i[l]):(t.length>=2&&e.push(t),t=[i[l]])}if(t.length>=2&&e.push(t),e.length===0)return[{type:"sequential",children:a}];let o=new Set;for(let l of e)for(let c of l)o.add(c);let n=[],r=0,s=0;for(;s<a.length;)if(r<e.length&&s===e[r][0]){let l=e[r],c=l[l.length-1],u=[],p=[];for(let h=l[0];h<=c;h++)o.has(h)?p.push(a[h]):u.push(a[h]);u.length>0&&n.push({type:"sequential",children:u}),n.push({type:"parallel",children:p}),s=c+1,r++}else{let l=s,c=r<e.length?e[r][0]:a.length;for(;s<c&&!o.has(s);)s++;s>l&&n.push({type:"sequential",children:a.slice(l,s)})}return n}function RRo(a){return a==="userMessage"||a==="agentResponse"}function LRo(a,i){let t=a.length*7+H0i*2,o=i?i.length*6+H0i*2:0;return Math.min(Wbn,Math.max(_Ro,t,o))}function kRo(a){return a.kind==="subagentInvocation"?a.label:a.description&&a.description!==a.label?`${a.label}: ${a.description}`:a.label}function ERo(a){return a.length*6+X6*2+20}function MRo(a){let i=a.children.length;for(let e of a.children)i+=MRo(e);return i}function PRo(a,i,e,t,o,n,r,s,l){let c=e,u=0,p=o;for(let h of a)if(h.type==="parallel"){let g=Ubn(h.children,i,c,t,r,s,l);n.nodes.push(...g.nodes),n.edges.push(...g.edges),n.subgraphs.push(...g.subgraphs);for(let f of p)for(let v of g.entryNodes)n.edges.push(z0i(f,v));p=g.exitNodes,u=Math.max(u,g.width),c+=g.height+HP}else for(let g of h.children){let f=ARo(g,i,c,t,r,s,l);n.nodes.push(...f.nodes),n.edges.push(...f.edges),n.subgraphs.push(...f.subgraphs);for(let v of p)n.edges.push(z0i(v,f.entryNode));p=f.exitNodes,u=Math.max(u,f.width),c+=f.height+HP}return{exitNodes:p,maxWidth:u,endY:c}}function z0i(a,i){return{fromId:a.id,toId:i.id,fromX:a.x+a.width/2,fromY:a.y+a.height,toX:i.x+i.width/2,toY:i.y}}function K0i(a,i){if(a.length===0)return{nodes:[],edges:[],subgraphs:[],width:0,height:0};let e=i?.collapsedIds,t=i?.expandedMergedIds,o=DRo(a),n=[],r={nodes:[],edges:[],subgraphs:[]},{maxWidth:s,endY:l}=PRo(o,BBe,BBe,0,[],r,e,t,n);Hbn(n,r);let c=s+BBe*2,u=l-HP+BBe;for(let p of r.nodes)c=Math.max(c,p.x+p.width+BBe),u=Math.max(u,p.y+p.height+BBe);return zbn(r,c/2),{nodes:r.nodes,edges:r.edges,subgraphs:r.subgraphs,width:c,height:u}}function Hbn(a,i){for(let e of a){let{mergedNode:t,children:o}=e,n=o.length*a4t+(o.length-1)*HP,r=t.y,s=t.y+n,l=t.x+t.width;for(let f of i.nodes)f.y+f.height>r&&f.y<s&&(l=Math.max(l,f.x+f.width));for(let f of i.subgraphs)f.y+f.height>r&&f.y<s&&(l=Math.max(l,f.x+f.width));let c=l+U0i,u=t.y,p=0,h=[];for(let f of o){let v=LRo(f.label,f.sublabel),b={id:f.id,kind:f.kind,label:f.label,sublabel:f.sublabel,tooltip:f.tooltip,isError:f.isError,x:c,y:u,width:v,height:a4t};h.push(b),i.nodes.push(b),p=Math.max(p,v),u+=a4t+HP}let g=h[0].y+h[0].height/2;i.edges.push({fromId:t.id,toId:h[0].id,fromX:t.x+t.width,fromY:g,toX:c,toY:g});for(let f=0;f<h.length-1;f++)i.edges.push(z0i(h[f],h[f+1]))}}function ARo(a,i,e,t,o,n,r){let s=(a.mergedNodes?.length??0)>=2,l=s&&n?.has(a.id),c=s?l4t:0,u=LRo(a.label,a.sublabel)+c,p=a.kind==="subagentInvocation",h=p&&o?.has(a.id),g=RRo(a.kind)&&a.sublabel?Fbn:a4t,f={id:a.id,kind:a.kind,label:a.label,sublabel:a.sublabel,tooltip:a.tooltip,isError:a.isError,x:i,y:e,width:u,height:g,mergedCount:s?a.mergedNodes.length:void 0,isMergedExpanded:l},v={nodes:[f],edges:[],subgraphs:[],width:u,height:g,entryNode:f,exitNodes:[f]};if(l&&r)return r.push({mergedNode:f,children:a.mergedNodes}),v;if(a.children.length===0&&!h)return v;if(h){let H=ibe+X6*2,K=MRo(a),j=e+g+HP-HP/2,J=kRo(a),se=Math.max(_Ro,ERo(J))+X6*2;return v.subgraphs.push({label:J,x:i-X6,y:j,width:se,height:H,depth:t,nodeId:a.id,collapsedChildCount:K}),v.edges.push({fromX:i+u/2,fromY:e+g,toX:i-X6+se/2,toY:j}),v.width=Math.max(u,se),v.height=g+HP+H,v}if(a.children.length===0)return v;let b=p?t+1:t,S=p?X6:0,y=DRo(a.children),w=e+g+HP;p&&(w+=ibe);let{exitNodes:x,maxWidth:E,endY:M}=PRo(y,i+S,w,b,[f],v,o,n,r),N=M-w-HP,V=E;if(p){let H=kRo(a);V=Math.max(E,ERo(H)),v.subgraphs.push({label:H,x:i-X6,y:e+g+HP-HP/2,width:V+X6*2,height:N+ibe+HP,depth:t,nodeId:a.id})}return v.width=Math.max(u,E+S*2,p?V+S*2:0),v.height=g+HP+N+(p?ibe:0),v.exitNodes=x,v}function Ubn(a,i,e,t,o,n,r){let s=[],l=0,c=0;for(let b of a){let S=ARo(b,0,e,t,o,n,r);s.push(S),l+=S.width,c=Math.max(c,S.height)}l+=(a.length-1)*U0i;let u=[],p=[],h=[],g=[],f=[],v=i;for(let b of s){let S=v,y=b.nodes.map(M=>({...M,x:M.x+S})),w=b.edges.map(M=>({fromId:M.fromId,toId:M.toId,fromX:M.fromX+S,fromY:M.fromY,toX:M.toX+S,toY:M.toY})),x=b.subgraphs.map(M=>({...M,x:M.x+S}));u.push(...y),p.push(...w),h.push(...x),g.push(y.find(M=>M.id===b.entryNode.id));let E=new Set(b.exitNodes.map(M=>M.id));f.push(...y.filter(M=>E.has(M.id))),v+=b.width+U0i}return{nodes:u,edges:p,subgraphs:h,entryNodes:g,exitNodes:f,width:l,height:c}}function zbn(a,i){if(a.nodes.length===0)return;let e=1/0,t=-1/0;for(let n of a.nodes)e=Math.min(e,n.x),t=Math.max(t,n.x+n.width);let o=i-(e+t)/2;for(let n=0;n<a.nodes.length;n++){let r=a.nodes[n];a.nodes[n]={...r,x:r.x+o}}for(let n=0;n<a.edges.length;n++){let r=a.edges[n];a.edges[n]={fromId:r.fromId,toId:r.toId,fromX:r.fromX+o,fromY:r.fromY,toX:r.toX+o,toY:r.toY}}for(let n=0;n<a.subgraphs.length;n++){let r=a.subgraphs[n];a.subgraphs[n]={...r,x:r.x+o}}}var UBe="http://www.w3.org/2000/svg";function Tb(a,i){let e=document.createElementNS(UBe,a);for(let[t,o]of Object.entries(i))e.setAttribute(t,String(o));return e}function Kbn(a,i){if(i)return"var(--vscode-errorForeground)";switch(a){case"userMessage":return"var(--vscode-textLink-foreground)";case"modelTurn":return"var(--vscode-charts-blue, var(--vscode-textLink-foreground))";case"toolCall":return"var(--vscode-testing-iconPassed, #73c991)";case"subagentInvocation":return"var(--vscode-charts-purple, #b267e6)";case"agentResponse":return"var(--vscode-foreground)";case"generic":return"var(--vscode-descriptionForeground)"}}var TRo=["var(--vscode-charts-purple, #b267e6)","var(--vscode-charts-blue, #3dc9b0)","var(--vscode-charts-yellow, #e5c07b)","var(--vscode-charts-orange, #d19a66)"];function G0i(a){let i=new Map,e=Tb("svg",{width:a.width,height:a.height,viewBox:`0 0 ${a.width} ${a.height}`,role:"img","aria-label":`Agent flow chart with ${a.nodes.length} nodes`});e.classList.add("chat-debug-flowchart-svg"),Gbn(e,a.subgraphs,i),qbn(e,a.edges),$bn(e,a.nodes,i);let t=new Map;for(let r of a.subgraphs)t.set(`sg:${r.nodeId}`,{y:r.y,x:r.x});for(let r of a.nodes)t.set(r.id,{y:r.y,x:r.x});let o=new Map([...i.entries()].sort((r,s)=>{let l=t.get(r[0]),c=t.get(s[0]);return!l||!c?0:l.y!==c.y?l.y-c.y:l.x-c.x})),n=new Map;for(let r of a.edges)if(r.fromId&&r.toId){let s=n.get(r.fromId);s||(s={next:[],prev:[]},n.set(r.fromId,s)),s.next.push(r.toId);let l=n.get(r.toId);l||(l={next:[],prev:[]},n.set(r.toId,l)),l.prev.push(r.fromId)}return{svg:e,focusableElements:o,adjacency:n,positions:t}}function Gbn(a,i,e){for(let t=0;t<i.length;t++){let o=i[t],n=TRo[o.depth%TRo.length],r=o.collapsedChildCount!==void 0,s=document.createElementNS(UBe,"g");s.classList.add("chat-debug-flowchart-subgraph");let l={x:o.x,y:o.y,width:o.width,height:o.height,rx:HBe,ry:HBe},c=`sg-clip-${t}`,u=Tb("clipPath",{id:c});u.appendChild(Tb("rect",l)),a.appendChild(u),s.appendChild(Tb("rect",{...l,fill:n,opacity:.06+o.depth*.02})),s.appendChild(Tb("rect",{...l,fill:"none",stroke:n,"stroke-width":1,"stroke-dasharray":"6,3",opacity:.5})),s.appendChild(Tb("rect",{x:o.x,y:o.y,width:xRo,height:o.height,fill:n,opacity:.7,"clip-path":`url(#${c})`}));let p=document.createElementNS(UBe,"g");p.setAttribute("data-subgraph-id",o.nodeId),p.classList.add("chat-debug-flowchart-subgraph-header"),p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-expanded",String(!r)),p.setAttribute("aria-label",`${o.label}: ${r?"collapsed":"expanded"}${r&&o.collapsedChildCount!==void 0?`, ${o.collapsedChildCount} items hidden`:""}`);let h=Tb("rect",{x:o.x,y:o.y,width:o.width,height:ibe,fill:n,opacity:.15,"clip-path":`url(#${c})`});p.appendChild(h);let g=r?"\u25B6":"\u25BC",f=Tb("text",{x:o.x+xRo+8,y:o.y+ibe/2+4,"font-size":Wlt,fill:n,"font-family":"var(--vscode-font-family, sans-serif)","font-weight":"600"});if(f.textContent=`${g} ${o.label}`,p.appendChild(f),s.appendChild(p),e.set(`sg:${o.nodeId}`,p),r&&o.collapsedChildCount!==void 0){let v=Tb("text",{x:o.x+o.width/2,y:o.y+ibe+X6+4,"font-size":Wlt,fill:"var(--vscode-descriptionForeground)","font-family":"var(--vscode-font-family, sans-serif)","font-style":"italic","text-anchor":"middle"});v.textContent=`+${o.collapsedChildCount} items`,s.appendChild(v)}a.appendChild(s)}}function qbn(a,i){let e={fill:"none",stroke:"var(--vscode-descriptionForeground)","stroke-width":Vbn,"stroke-linecap":"round"},t=6;for(let o of i){let n=(o.fromY+o.toY)/2,r,s=o.fromY===o.toY;if(s)r=`M ${o.fromX} ${o.fromY} L ${o.toX} ${o.toY}`;else if(o.fromX===o.toX)r=`M ${o.fromX} ${o.fromY} L ${o.toX} ${o.toY}`;else{let u=o.toX-o.fromX,p=u>0?1:-1,h=Math.abs(u),g=Math.min(t,h/2,(o.toY-o.fromY)/4);r=`M ${o.fromX} ${o.fromY} L ${o.fromX} ${n-g} Q ${o.fromX} ${n}, ${o.fromX+p*g} ${n} L ${o.toX-p*g} ${n} Q ${o.toX} ${n}, ${o.toX} ${n+g} L ${o.toX} ${o.toY}`}a.appendChild(Tb("path",{...e,d:r}));let l=5,c;if(s){let u=o.toX>o.fromX?1:-1;c=`M ${o.toX-u*l*1.5} ${o.toY-l} L ${o.toX} ${o.toY} L ${o.toX-u*l*1.5} ${o.toY+l}`}else c=`M ${o.toX-l} ${o.toY-l*1.5} L ${o.toX} ${o.toY} L ${o.toX+l} ${o.toY-l*1.5}`;a.appendChild(Tb("path",{...e,"stroke-linejoin":"round",d:c}))}}function $bn(a,i,e){let t="var(--vscode-font-family, sans-serif)",o="var(--vscode-editor-background, var(--vscode-editorWidget-background))";for(let n of i){let r=document.createElementNS(UBe,"g");r.classList.add("chat-debug-flowchart-node"),r.setAttribute("data-node-id",n.id),r.setAttribute("tabindex","0"),r.setAttribute("role","img");let s=n.sublabel?`${n.label}, ${n.sublabel}`:n.label;if(r.setAttribute("aria-label",s),e.set(n.id,r),n.tooltip){let b=document.createElementNS(UBe,"title");b.textContent=n.tooltip,r.appendChild(b)}let l=Kbn(n.kind,n.isError),c=n.id.replace(/[^a-zA-Z0-9]/g,"_"),u={x:n.x,y:n.y,width:n.width,height:n.height,rx:HBe,ry:HBe},p=`clip-${c}`,h=Tb("clipPath",{id:p});h.appendChild(Tb("rect",u)),a.appendChild(h);let g=3;r.appendChild(Tb("rect",{class:"chat-debug-flowchart-focus-ring",x:n.x-g,y:n.y-g,width:n.width+g*2,height:n.height+g*2,rx:HBe+g,ry:HBe+g,fill:"none",stroke:"var(--vscode-focusBorder)","stroke-width":2})),r.appendChild(Tb("rect",{...u,fill:o,stroke:l,"stroke-width":n.isError?2:1.5})),r.appendChild(Tb("rect",{x:n.x,y:n.y,width:4,height:n.height,fill:l,"clip-path":`url(#${p})`}));let f=n.x+H0i;if(RRo(n.kind)&&n.sublabel){let b=Tb("text",{x:f,y:n.y+s4t+Wlt,"font-size":Wlt,fill:"var(--vscode-descriptionForeground)","font-family":t,"clip-path":`url(#${p})`});b.textContent=n.label,r.appendChild(b);let S=Tb("text",{x:f,y:n.y+n.height-s4t-2,"font-size":Flt,fill:"var(--vscode-foreground)","font-family":t,"clip-path":`url(#${p})`});S.textContent=n.sublabel,r.appendChild(S)}else if(n.sublabel){let b=Tb("text",{x:f,y:n.y+s4t+Flt,"font-size":Flt,fill:"var(--vscode-foreground)","font-family":t,"clip-path":`url(#${p})`});b.textContent=n.label,r.appendChild(b);let S=Tb("text",{x:f,y:n.y+n.height-s4t,"font-size":Wlt,fill:"var(--vscode-descriptionForeground)","font-family":t,"clip-path":`url(#${p})`});S.textContent=n.sublabel,r.appendChild(S)}else{let b=Tb("text",{x:f,y:n.y+n.height/2+Flt/2-1,"font-size":Flt,fill:"var(--vscode-foreground)","font-family":t,"clip-path":`url(#${p})`});b.textContent=n.label,r.appendChild(b)}n.mergedCount&&(r.setAttribute("data-is-toggle","true"),jbn(r,n,l,t)),a.appendChild(r)}}function jbn(a,i,e,t){let o=i.x+i.width-l4t,n=document.createElementNS(UBe,"g");n.classList.add("chat-debug-flowchart-merged-toggle"),n.setAttribute("data-merged-id",i.id),n.appendChild(Tb("line",{x1:o,y1:i.y+4,x2:o,y2:i.y+i.height-4,stroke:"var(--vscode-descriptionForeground)","stroke-width":.5,opacity:.4}));let r=o+l4t/2,s=i.y+i.height/2,l=Tb("text",{x:r,y:s+4,"font-size":9,fill:e,"font-family":t,"text-anchor":"middle",cursor:"pointer"});l.textContent=i.isMergedExpanded?"\u25C0":"\u25B6",n.appendChild(l),n.appendChild(Tb("rect",{x:o,y:i.y,width:l4t,height:i.height,fill:"transparent",cursor:"pointer"})),a.appendChild(n)}var b$=_,NRo=.1,ORo=5,FRo=.15,Qbn=.002,Ybn=25,c4t=100;var zBe=class extends k{constructor(e,t,o,n,r,s){super();this.filterState=t;this.chatService=o;this.chatDebugService=n;this.contextKeyService=r;this.instantiationService=s;this._onNavigate=this._register(new T);this.onNavigate=this._onNavigate.event;this.loadDisposables=this._register(new O);this.scale=1;this.translateX=0;this.translateY=0;this.isPanning=!1;this.startX=0;this.startY=0;this.mouseDownX=0;this.mouseDownY=0;this.lastEventCount=0;this.hasUserPanned=!1;this.collapsedNodeIds=new Set;this.expandedMergedIds=new Set;this.visibleLimit=c4t;this.eventById=new Map;this.container=D(e,b$(".chat-debug-flowchart")),Wi(this.container);let l=D(this.container,b$(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new RW(l,3,void 0,L.chevronRight,YF)),this._register(Yne(l,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(v=>{if(v.type==="select"&&v.item instanceof hy){this.breadcrumbWidget.setSelection(void 0);let S=this.breadcrumbWidget.getItems().indexOf(v.item);S===0?this._onNavigate.fire("home"):S===1&&this._onNavigate.fire("overview")}})),this.headerContainer=D(this.container,b$(".chat-debug-editor-header"));let c=this.headerContainer,u=this._register(this.contextKeyService.createScoped(c)),p=Y5t(this.filterState,u);p();let h=this._register(this.instantiationService.createChild(new Po([X,u])));this.filterWidget=this._register(h.createInstance(SG,{placeholder:d(7759,null),ariaLabel:d(7756,null)})),D(c,b$(".viewpane-filter-container")).appendChild(this.filterWidget.element),this._register(this.filterWidget.onDidChangeFilterText(v=>{this.filterState.setTextFilter(v)})),this._register(this.filterState.onDidChange(()=>{p(),this.filterWidget.checkMoreFilters(!this.filterState.isAllFiltersDefault()),this.visibleLimit=c4t,this.hasUserPanned=!1,this.lastEventCount=0,this.load()}));let f=D(this.container,b$(".chat-debug-flowchart-content-wrapper"));this.content=D(f,b$(".chat-debug-flowchart-content")),this.detailPanel=this._register(this.instantiationService.createInstance(Xne,f)),this.setupPanZoom(),this.setupKeyboard(),this.refreshScheduler=this._register(new Dt(()=>this.load(),100))}setSession(e){(!this.currentSessionResource||this.currentSessionResource.toString()!==e.toString())&&(this.scale=1,this.translateX=0,this.translateY=0,this.lastEventCount=0,this.hasUserPanned=!1,this.focusedElementId=void 0,this.collapsedNodeIds.clear(),this.expandedMergedIds.clear(),this.visibleLimit=c4t,this.detailPanel.hide()),this.currentSessionResource=e}show(){Xo(this.container),this.load()}hide(){Wi(this.container),this.refreshScheduler.cancel()}refresh(){this.container.style.display!=="none"&&(this.refreshScheduler.isScheduled()||this.refreshScheduler.schedule())}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Br.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new hy(d(7762,null),!0),new hy(e,!0),new hy(d(7755,null))])}load(){let e=Is(this.content);St(this.content),this.loadDisposables.clear(),this.updateBreadcrumb();let t=this.chatDebugService.getEvents(this.currentSessionResource),o=this.lastEventCount===0;this.lastEventCount=t.length,this.eventById.clear();for(let u of t)u.id&&this.eventById.set(u.id,u);if(t.length===0){let u=D(this.content,b$(".chat-debug-flowchart-empty"));u.textContent=d(7757,null);return}let n=W0i(t),r=V0i(n,{isKindVisible:(u,p)=>this.filterState.isKindVisible(u,p),textFilter:this.filterState.textFilter});if(r.length===0){let u=D(this.content,b$(".chat-debug-flowchart-empty"));u.textContent=d(7758,null);return}let s=B0i(r,this.visibleLimit),l=Olt(r4t(s.nodes)),c=K0i(l,{collapsedIds:this.collapsedNodeIds,expandedMergedIds:this.expandedMergedIds});if(this.renderResult=G0i(c),this.svgWrapper=D(this.content,b$(".chat-debug-flowchart-svg-wrapper")),this.svgWrapper.appendChild(this.renderResult.svg),this.svgElement=this.renderResult.svg,s.shownCount<s.totalCount){let u=s.totalCount-s.shownCount,p=D(this.svgWrapper,b$(".chat-debug-flowchart-show-more")),h=this.loadDisposables.add(new Pi(p,{...Ro,secondary:!0,title:d(7761,null)}));h.label=d(7760,null,u),this.loadDisposables.add(h.onDidClick(()=>{this.visibleLimit+=c4t,this.load()}))}o&&!this.hasUserPanned?Me(this.content).requestAnimationFrame(()=>{this.centerContent()}):this.applyTransform(),this.focusedElementId&&e&&!Is(this.headerContainer)&&this.restoreFocus(this.focusedElementId)}setupPanZoom(){this._register($(this.content,ne.MOUSE_DOWN,t=>this.handleMouseDown(t)));let e=Me(this.content).document;this._register($(e,ne.MOUSE_MOVE,t=>this.handleMouseMove(t))),this._register($(e,ne.MOUSE_UP,t=>this.handleMouseUp(t))),this._register($(this.content,"wheel",t=>this.handleWheel(t),{passive:!1}))}setupKeyboard(){this._register($(this.content,ne.FOCUS_IN,e=>{let t=e.target;if(!t)return;let o=t.getAttribute?.("data-subgraph-id");if(o){this.focusedElementId=`sg:${o}`;return}let n=t.getAttribute?.("data-node-id");n&&(this.focusedElementId=n)})),this._register($(this.content,ne.KEY_DOWN,e=>{let t=e.target;if(!t)return;let o=t.getAttribute?.("data-subgraph-id");switch(e.key){case"Tab":{this.focusedElementId?this.focusAdjacentElement(this.focusedElementId,e.shiftKey?-1:1)?e.preventDefault():!e.shiftKey&&this.detailPanel.isVisible&&(e.preventDefault(),this.detailPanel.focus()):e.shiftKey||(e.preventDefault(),this.focusFirstElement());break}case"Enter":case" ":if(o)e.preventDefault(),e.stopPropagation(),this.detailPanel.hide(),this.toggleSubgraph(o);else{let n=t.getAttribute?.("data-node-id");if(n)if(e.preventDefault(),t.getAttribute?.("data-is-toggle"))this.detailPanel.hide(),this.toggleMergedDiscovery(n);else{let r=this.eventById.get(n);r&&this.detailPanel.show(r)}}break;case"ArrowDown":e.preventDefault(),this.focusedElementId?this.focusEdgeNeighbor(this.focusedElementId,"next"):this.focusFirstElement();break;case"ArrowRight":if(e.preventDefault(),this.focusedElementId){if(o&&this.collapsedNodeIds.has(o))this.detailPanel.hide(),this.collapsedNodeIds.delete(o),this.focusedElementId=`sg:${o}`,this.load(),this.focusFirstChildOf(`sg:${o}`);else if(t.getAttribute?.("data-is-toggle"))if(this.expandedMergedIds.has(this.focusedElementId))this.focusFirstChildOf(this.focusedElementId);else{this.detailPanel.hide();let n=this.focusedElementId;this.expandedMergedIds.add(n),this.focusedElementId=n,this.load(),this.focusFirstChildOf(n)}}else this.focusFirstElement();break;case"ArrowUp":e.preventDefault(),this.focusedElementId?this.focusEdgeNeighbor(this.focusedElementId,"prev"):this.focusFirstElement();break;case"ArrowLeft":e.preventDefault(),this.focusedElementId&&(o&&!this.collapsedNodeIds.has(o)?(this.detailPanel.hide(),this.toggleSubgraph(o)):t.getAttribute?.("data-is-toggle")&&this.expandedMergedIds.has(this.focusedElementId)?(this.detailPanel.hide(),this.toggleMergedDiscovery(this.focusedElementId)):this.focusEdgeNeighbor(this.focusedElementId,"prev"));break;case"Home":e.preventDefault(),this.focusFirstElement();break;case"End":e.preventDefault(),this.focusLastElement();break;case"=":case"+":!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),this.zoomBy(FRo));break;case"-":!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),this.zoomBy(-FRo));break}}))}toggleSubgraph(e){this.collapsedNodeIds.has(e)?this.collapsedNodeIds.delete(e):this.collapsedNodeIds.add(e),this.focusedElementId=`sg:${e}`,this.load()}toggleMergedDiscovery(e){this.expandedMergedIds.has(e)?this.expandedMergedIds.delete(e):this.expandedMergedIds.add(e),this.focusedElementId=e,this.load()}focusFirstElement(){if(!this.renderResult)return;let e=this.renderResult.focusableElements.values().next();e.done||e.value.focus()}focusLastElement(){if(!this.renderResult)return;let e=[...this.renderResult.focusableElements.values()];e.length>0&&e[e.length-1].focus()}focusAdjacentElement(e,t){if(!this.renderResult)return!1;let o=[...this.renderResult.focusableElements.keys()],n=o.indexOf(e);if(n===-1)return!1;let r=n+t;if(r<0||r>=o.length)return!1;let s=this.renderResult.focusableElements.get(o[r]);return s?(s.focus(),!0):!1}focusEdgeNeighbor(e,t){if(!this.renderResult)return!1;let n=this.renderResult.adjacency.get(e)?.[t];if(!n||n.length===0)return!1;for(let r of n){let s=this.renderResult.focusableElements.get(r);if(s)return s.focus(),!0}return!1}focusFirstChildOf(e){if(!this.renderResult)return;let t=this.renderResult.adjacency.get(e);if(!t?.next||t.next.length===0)return;let o=this.renderResult.positions.get(e),n;for(let r of t.next)if(this.renderResult.focusableElements.has(r)&&(n||(n=r),o)){let s=this.renderResult.positions.get(r);if(s&&s.x>o.x){n=r;break}}if(n){let r=this.renderResult.focusableElements.get(n);r&&(this.focusedElementId=n,r.focus())}}restoreFocus(e){let t=this.renderResult?.focusableElements.get(e);t&&t.focus()}zoomBy(e){let t=this.content.getBoundingClientRect(),o=t.width/2,n=t.height/2,r=Math.min(ORo,Math.max(NRo,this.scale*(1+e))),s=r/this.scale;this.translateX=o-(o-this.translateX)*s,this.translateY=n-(n-this.translateY)*s,this.scale=r,this.hasUserPanned=!0,this.applyTransform()}handleMouseDown(e){e.button===0&&(e.preventDefault(),this.isPanning=!0,this.hasUserPanned=!0,this.startX=e.clientX-this.translateX,this.startY=e.clientY-this.translateY,this.mouseDownX=e.clientX,this.mouseDownY=e.clientY,this.content.style.cursor="grabbing")}handleMouseMove(e){if(this.isPanning){if(e.buttons===0){this.handleMouseUp(e);return}this.translateX=e.clientX-this.startX,this.translateY=e.clientY-this.startY,this.applyTransform()}}handleMouseUp(e){if(this.isPanning){this.isPanning=!1,this.content.style.cursor="grab";let t=e.clientX-this.mouseDownX,o=e.clientY-this.mouseDownY;t*t+o*o<Ybn&&this.handleClick(e)}}handleClick(e){let t=e.target;for(;t&&t!==this.content;){let o=t.getAttribute?.("data-merged-id");if(o){this.detailPanel.hide(),this.toggleMergedDiscovery(o);return}let n=t.getAttribute?.("data-subgraph-id");if(n){this.detailPanel.hide(),this.toggleSubgraph(n);return}let r=t.getAttribute?.("data-node-id");if(r){if(t.focus(),t.getAttribute?.("data-is-toggle"))this.detailPanel.hide(),this.toggleMergedDiscovery(r);else{let s=this.eventById.get(r);s&&this.detailPanel.show(s)}return}t=t.parentElement}}handleWheel(e){e.preventDefault(),e.stopPropagation(),this.hasUserPanned=!0;let t=this.content.getBoundingClientRect(),o=e.clientX-t.left,n=e.clientY-t.top,r=-e.deltaY*Qbn,s=Math.min(ORo,Math.max(NRo,this.scale*(1+r))),l=s/this.scale;this.translateX=o-(o-this.translateX)*l,this.translateY=n-(n-this.translateY)*l,this.scale=s,this.applyTransform()}applyTransform(){this.svgWrapper&&(this.svgWrapper.style.transform=`translate(${this.translateX}px, ${this.translateY}px) scale(${this.scale})`)}centerContent(){let e=this.content.getBoundingClientRect();if(!this.svgElement)return;let t=parseFloat(this.svgElement.getAttribute("width")||"0"),o=parseFloat(this.svgElement.getAttribute("height")||"0");if(t<=0||o<=0)return;let n=20;this.translateX=Math.max(n,(e.width-t)/2),this.translateY=n,this.applyTransform()}};zBe=I([m(2,si),m(3,ph),m(4,X),m(5,F)],zBe);function WRo(a){if(!a)return[];let i;try{i=JSON.parse(a)}catch{return[]}if(!Array.isArray(i))return[];let e=[];for(let t of i){if(!t||typeof t!="object")continue;let o=typeof t.role=="string"?t.role:"unknown",n=typeof t.name=="string"?t.name:void 0,r="",s=!1,l=!1,c=!1,u=!1;if(Array.isArray(t.parts)){for(let p of t.parts)if(!(!p||typeof p!="object"))switch(p.type){case void 0:case"text":case"reasoning":typeof p.content=="string"&&(r+=p.content,u=!0);break;case"tool_call_response":case"tool_result":typeof p.response=="string"?r+=p.response:p.response!==void 0?r+=Vlt(p.response):typeof p.content=="string"?r+=p.content:p.content!==void 0&&(r+=Vlt(p.content)),s=!0;break;case"tool_call":p.name&&(r+=`call:${p.name}`),p.arguments!==void 0&&(r+=Vlt(p.arguments)),l=!0;break;case"tool_search_output":r+=Vlt({id:p.id,status:p.status,tools:p.tools}),c=!0;break}}c&&!u?o="tool_search":s&&!u?o="tool":l&&!u&&o==="assistant"&&(o="assistant"),r.length===0&&o==="unknown"&&(r=Vlt(t)),e.push({role:o,name:n,text:r,charLength:r.length})}return e}function Vlt(a){try{return JSON.stringify(a)}catch{return String(a)}}function Xbn(a,i){return a.role===i.role&&a.name===i.name&&a.charLength===i.charLength&&a.text===i.text}function $0i(a,i){let e=[],t=[],o={identical:0,contentDrift:0,lengthChange:0,onlyInA:0,onlyInB:0},n,r=!1,s=Math.max(a.length,i.length);for(let l=0;l<s;l++){let c=a[l],u=i[l];if(c&&!u){o.onlyInA++,e.push({index:l,kind:"onlyInA",aRole:c.role,aName:c.name,aCharLength:c.charLength}),t.push({name:`messages[${l}]`,role:c.role,status:"onlyInA",aSize:c.charLength,bSize:0}),r||(r=!0,n={index:l,kind:"onlyInA"});continue}if(u&&!c){o.onlyInB++,e.push({index:l,kind:"onlyInB",bRole:u.role,bName:u.name,bCharLength:u.charLength}),t.push({name:`messages[${l}]`,role:u.role,status:"onlyInB",aSize:0,bSize:u.charLength}),r||(r=!0,n={index:l,kind:"onlyInB"});continue}if(!c||!u)continue;if(Xbn(c,u)){o.identical++,e.push({index:l,kind:"identical",aRole:c.role,aName:c.name,aCharLength:c.charLength,bRole:u.role,bName:u.name,bCharLength:u.charLength});continue}let p=c.charLength===u.charLength?"contentDrift":"lengthChange";p==="contentDrift"?o.contentDrift++:o.lengthChange++,e.push({index:l,kind:p,aRole:c.role,aName:c.name,aCharLength:c.charLength,bRole:u.role,bName:u.name,bCharLength:u.charLength}),t.push({name:`messages[${l}]`,role:c.role,status:p,aSize:c.charLength,bSize:u.charLength}),r||(r=!0,n={index:l,kind:p})}return{signature:e,break:n,drift:t,counts:o}}var q0i=["system","tools"];function VRo(a,i){let e=[],t=[];for(let o of a)q0i.includes(o.name)?o.name!==i.name&&e.push(o):t.push(o);return e.push(i),e.sort((o,n)=>q0i.indexOf(o.name)-q0i.indexOf(n.name)),[...e,...t]}function BRo(a,i){if(a!==i)return a?i?a.length===i.length?"contentDrift":"lengthChange":"onlyInA":"onlyInB"}function HRo(a,i,e){let t=BRo(i,e);return t===void 0?a:VRo(a,{name:"system",status:t,aSize:i?.length??0,bSize:e?.length??0})}function URo(a,i,e){let t=BRo(i,e);return t===void 0?a:VRo(a,{name:"tools",status:t,aSize:i?.length??0,bSize:e?.length??0})}var Nn=_,Av=nd.NumberFormat(),Jbn=nd.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",second:"2-digit"}),Zbn=280,eSn=180,tSn=600,g4t="current continuation delta";var GBe=class extends k{constructor(e,t,o){super();this.chatService=t;this.chatDebugService=o;this._onNavigate=this._register(new T);this.onNavigate=this._onNavigate.event;this.railWidth=Zbn;this.loadDisposables=this._register(new O);this.modelTurns=[];this.selectedIndex=-1;this.renderToken=0;this.resolvedCache=new Map;this.openComponents=new Set(["system","tools"]);this.collapsedGroups=new Set;this.container=D(e,Nn(".chat-debug-cache")),Wi(this.container);let n=D(this.container,Nn(".chat-debug-breadcrumb"));this.breadcrumbWidget=this._register(new RW(n,3,void 0,L.chevronRight,YF)),this._register(Yne(n,this.breadcrumbWidget)),this._register(this.breadcrumbWidget.onDidSelectItem(l=>{if(l.type==="select"&&l.item instanceof hy){this.breadcrumbWidget.setSelection(void 0);let u=this.breadcrumbWidget.getItems().indexOf(l.item);u===0?this._onNavigate.fire("home"):u===1&&this._onNavigate.fire("overview")}}));let r=D(this.container,Nn(".chat-debug-cache-body"));this.rail=D(r,Nn(".chat-debug-cache-rail")),this.rail.style.width=`${this.railWidth}px`,this.railList=D(this.rail,Nn(".chat-debug-cache-rail-list")),this.content=D(r,Nn(".chat-debug-cache-content")),this.sash=this._register(new kh(r,{getVerticalSashLeft:()=>this.railWidth},{orientation:0})),this.sash.state=3;let s;this._register(this.sash.onDidStart(()=>s=this.railWidth)),this._register(this.sash.onDidEnd(()=>{s=void 0,this.sash.layout()})),this._register(this.sash.onDidChange(l=>{if(s===void 0)return;let c=l.currentX-l.startX,u=Math.max(eSn,Math.min(tSn,s+c));this.railWidth=u,this.rail.style.width=`${u}px`,this.sash.layout()})),this.refreshScheduler=this._register(new Dt(()=>this.render(),50))}setSession(e){(!this.currentSessionResource||this.currentSessionResource.toString()!==e.toString())&&(this.resolvedCache.clear(),this.collapsedGroups.clear(),this.openComponents.clear(),this.openComponents.add("system"),this.openComponents.add("tools"),this.selectedIndex=-1),this.currentSessionResource=e}show(){Xo(this.container),this.render()}hide(){Wi(this.container),this.refreshScheduler.cancel()}refresh(){this.container.style.display!=="none"&&!this.refreshScheduler.isScheduled()&&this.refreshScheduler.schedule()}updateBreadcrumb(){if(!this.currentSessionResource)return;let e=this.chatService.getSessionTitle(this.currentSessionResource)||Br.parseLocalSessionId(this.currentSessionResource)||this.currentSessionResource.toString();this.breadcrumbWidget.setItems([new hy(d(7722,null),!0),new hy(e,!0),new hy(d(7720,null))])}async render(){let e=++this.renderToken,t=()=>e===this.renderToken;if(this.updateBreadcrumb(),this.loadDisposables.clear(),St(this.railList),St(this.content),!this.currentSessionResource)return;let o=this.chatDebugService.getEvents(this.currentSessionResource);this.modelTurns=o.filter(g=>g.kind==="modelTurn");let n=o.filter(g=>g.kind==="userMessage");if(this.modelTurns.length===0){let g=D(this.content,Nn(".chat-debug-cache-empty"));g.textContent=d(7668,null);return}(this.selectedIndex<0||this.selectedIndex>=this.modelTurns.length)&&(this.selectedIndex=this.modelTurns.length-1),this.renderRail(iSn(this.modelTurns,n)),this.renderTitleRow();let r=this.modelTurns[this.selectedIndex],s=this.selectedIndex>0?this.modelTurns[this.selectedIndex-1]:void 0;if(!s){let g=await this.resolveSide(r);if(!t())return;this.renderSingleSummary(g);return}let[l,c]=await Promise.all([this.resolveSide(s),this.resolveSide(r)]);if(!t())return;let u=sSn(l,c),p=u?$0i(l.inputMessages,c.inputMessages):$0i([],[]),h=URo(HRo([...p.drift],l.system,c.system),l.tools,c.tools);this.renderSummary(l,c,p),this.renderSignature(l,c,p,u),this.renderRequestOptions(l,c),this.renderComponents(h,l,c,u)}async resolveSide(e){let t;if(e.id)if(this.resolvedCache.has(e.id))t=this.resolvedCache.get(e.id);else{let p=await this.chatDebugService.resolveEvent(e.id);t=p&&p.kind==="modelTurn"?p:void 0,this.resolvedCache.set(e.id,t)}let o=d4t(t?.sections,"System"),n=d4t(t?.sections,"Tools"),r=d4t(t?.sections,"Request Shape"),s=d4t(t?.sections,"Input Messages"),l=WRo(s),c=0;if(o)for(;c<l.length&&l[c].role==="system";)c++;let u=c>0?l.slice(c):l;return{event:e,content:t,system:o,tools:n,inputMessages:u,requestShape:aSn(u,r)}}renderRail(e){for(let t of e){let o=this.collapsedGroups.has(t.key),n=D(this.railList,Nn(".chat-debug-cache-group-header"));o&&n.classList.add("is-collapsed"),n.tabIndex=0,n.setAttribute("role","button"),n.setAttribute("aria-expanded",o?"false":"true"),n.title=d(7701,null);let r=D(n,Nn(".chat-debug-cache-group-top"));D(r,Nn("span.chat-debug-cache-group-chev"));let s=D(r,Nn(".chat-debug-cache-group-prompt"));s.textContent=t.userMessage?.message?.trim()||d(7713,null);let l=D(r,Nn("span.chat-debug-cache-group-count"));l.textContent=String(t.turns.length);let c=D(n,Nn(".chat-debug-cache-group-meta"));c.textContent=t.key,c.title=d(7677,null,t.key);let u=()=>{this.collapsedGroups.has(t.key)?this.collapsedGroups.delete(t.key):this.collapsedGroups.add(t.key),this.refresh()};if(this.loadDisposables.add($(n,ne.CLICK,u)),this.loadDisposables.add($(n,ne.KEY_DOWN,p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u())})),!o)for(let{turn:p,index:h}of t.turns){let g=D(this.railList,Nn(".chat-debug-cache-turn"));h===this.selectedIndex&&g.classList.add("is-selected");let f=D(g,Nn(".chat-debug-cache-turn-idx"));f.textContent=String(h).padStart(2," ");let v=D(g,Nn(".chat-debug-cache-turn-main")),b=D(v,Nn(".chat-debug-cache-turn-top")),S=D(b,Nn("span.chat-debug-cache-turn-source"));if(S.textContent=p.requestName||d(7664,null),p.cachedTokens!==void 0&&p.inputTokens){let w=u4t(p),x=D(b,Nn("span.chat-debug-cache-turn-chip.chat-debug-cache-turn-hit",void 0,d(7648,null,cSn(w))));w<90&&x.classList.add("is-bad")}if(p.durationInMillis!==void 0&&D(b,Nn("span.chat-debug-cache-turn-chip",void 0,d(7665,null,Av.value.format(Math.round(p.durationInMillis))))),D(b,Nn("span.chat-debug-cache-turn-chip",void 0,`[${Jbn.value.format(p.created)}]`)),p.model){let w=D(v,Nn(".chat-debug-cache-turn-sub"));w.textContent=p.model}g.title=d(7711,null),g.tabIndex=0,g.setAttribute("role","button"),g.setAttribute("aria-selected",h===this.selectedIndex?"true":"false"),g.setAttribute("aria-label",d(7710,null,h,p.requestName??p.model??d(7664,null)));let y=()=>{this.selectedIndex!==h&&(this.selectedIndex=h,this.refresh())};this.loadDisposables.add($(g,ne.CLICK,y)),this.loadDisposables.add($(g,ne.KEY_DOWN,w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),y())}))}}}renderTitleRow(){let e=D(this.content,Nn(".chat-debug-cache-title-row")),t=D(e,Nn("h2.chat-debug-cache-title"));t.textContent=d(7721,null)}renderSummary(e,t,o){let n=D(this.content,Nn(".chat-debug-cache-summary"));n.appendChild(this.renderSideCard(e,d(7675,null))),n.appendChild(this.renderSideCard(t,d(7690,null)));let r=D(n,Nn(".chat-debug-cache-card.break"));D(r,Nn(".chat-debug-cache-card-h",void 0,d(7674,null)));let s=u4t(t.event),l=t.event.inputTokens??0,c=t.event.cachedTokens??0,u=Math.max(0,l-c),p=dSn(e,t),h=(e.system??"")!==(t.system??""),g=(e.tools??"")!==(t.tools??""),f=t.requestShape.isContinuation,v=!f&&pSn(s,o,p,h,g),b=D(r,Nn(".chat-debug-cache-card-headline"));v?b.textContent=d(7643,null,KBe(s)):b.textContent=d(7649,null,KBe(s));let S=D(r,Nn(".chat-debug-cache-card-sub"));if(S.textContent=d(7702,null,Av.value.format(c),Av.value.format(l)),t.requestShape.description){let V=D(r,Nn(".chat-debug-cache-perf-line.chat-debug-cache-request-shape-note"));V.textContent=t.requestShape.description}D(r,Nn(".chat-debug-cache-perf-rule")),D(r,Nn(".chat-debug-cache-perf-section-h",void 0,f?d(7718,null):d(7719,null)));let y=D(r,Nn(".chat-debug-cache-perf-line"));if(v)y.textContent=d(7644,null);else if(h)y.textContent=d(7699,null);else if(g){if(y.textContent=d(7703,null),f&&o.break){let V=o.break.index===0?d(7645,null):`messages[${o.break.index}]`,H=D(r,Nn(".chat-debug-cache-perf-line"));H.textContent=d(7634,null,V)}}else if(f&&o.break){let V=o.break.index===0?d(7645,null):`messages[${o.break.index}]`;if(y.textContent=d(7635,null,V,KRo(o.break.kind,o,t)),u>0&&l>0){let H=u/l*100,K=D(r,Nn(".chat-debug-cache-perf-line"));K.textContent=d(7712,null,Av.value.format(u),KBe(H))}}else if(o.break){let V=o.break.index===0?d(7645,null):`messages[${o.break.index}]`;if(y.textContent=d(7626,null,V,KRo(o.break.kind,o,t)),u>0&&l>0){let H=u/l*100,K=D(r,Nn(".chat-debug-cache-perf-line"));K.textContent=d(7662,null,Av.value.format(u),KBe(H))}}else p.length>0?y.textContent=d(7670,null):f?y.textContent=d(7636,null):y.textContent=d(7666,null);D(r,Nn(".chat-debug-cache-perf-rule")),D(r,Nn(".chat-debug-cache-perf-section-h",void 0,d(7639,null)));let w=D(r,Nn(".chat-debug-cache-perf-line")),x=o.counts.contentDrift+o.counts.lengthChange,E=o.counts.onlyInB,M=o.counts.onlyInA,N=[d(7698,null,o.counts.identical),d(7696,null,x)];if(E>0&&N.push(d(7695,null,E)),M>0&&N.push(d(7697,null,M)),w.textContent=N.join(" \xB7 "),p.length>0){let V=D(this.content,Nn(".chat-debug-cache-options-banner"));V.textContent=d(7669,null,p.map(H=>`${H.key} (${m4t(H.previous)} \u2192 ${m4t(H.current)})`).join(", "))}}renderSideCard(e,t){let o=Nn(".chat-debug-cache-card");t&&D(o,Nn(".chat-debug-cache-card-h",void 0,t)),this.appendKv(o,d(7663,null),e.event.model??"\u2014"),this.appendKv(o,d(7650,null),p4t(e.event.inputTokens)),this.appendKv(o,d(7628,null),p4t(e.event.cachedTokens)),this.appendKv(o,d(7629,null),`${KBe(u4t(e.event))}%`),this.appendKv(o,d(7679,null),e.requestShape.label);let n=e.event.created,r=e.event.durationInMillis!==void 0?new Date(n.getTime()+e.event.durationInMillis):void 0;this.appendKv(o,d(7694,null),n.toISOString(),!0),r&&this.appendKv(o,d(7642,null),r.toISOString(),!0),e.event.durationInMillis!==void 0&&this.appendKv(o,d(7641,null),`${Av.value.format(Math.round(e.event.durationInMillis))}ms`);let s=e.content?.timeToFirstTokenInMillis;s!==void 0&&this.appendKv(o,d(7709,null),`${Av.value.format(Math.round(s))}ms`);let l=e.content?.requestId??e.event.parentEventId??e.event.id;return l&&this.appendKv(o,d(7676,null),l,!0),o}renderSingleSummary(e){let t=D(this.content,Nn(".chat-debug-cache-summary"));t.appendChild(this.renderSideCard(e,d(7690,null)));let o=D(t,Nn(".chat-debug-cache-card.break"));D(o,Nn(".chat-debug-cache-card-h",void 0,d(7646,null)));let n=D(o,Nn(".chat-debug-cache-card-headline"));n.textContent=`${KBe(u4t(e.event))}%`;let r=D(o,Nn(".chat-debug-cache-card-sub"));if(r.textContent=d(7647,null),e.requestShape.description){let s=D(o,Nn(".chat-debug-cache-perf-line.chat-debug-cache-request-shape-note"));s.textContent=e.requestShape.description}}appendKv(e,t,o,n=!1){let r=D(e,Nn(".chat-debug-cache-kv"));D(r,Nn("span.k",void 0,t));let s=D(r,Nn("span.v",void 0,o));n&&(s.classList.add("chat-debug-cache-request-id"),s.title=o)}renderSignature(e,t,o,n){let r=t.requestShape.isContinuation,s=D(this.content,Nn(".chat-debug-cache-section")),l=D(s,Nn("h3.chat-debug-cache-section-h"));if(l.textContent=r?d(7714,null):d(7691,null),r){let N=D(s,Nn(".chat-debug-cache-sig-summary.chat-debug-cache-request-shape-note"));N.textContent=d(7715,null)}let c=D(s,Nn(".chat-debug-cache-sig-legend"));for(let N of["system","user","assistant","tool","tool_search","tools"]){let V=D(c,Nn("span.chat-debug-cache-sig-legend-entry"));D(V,Nn(`span.chat-debug-cache-sig-swatch.role-${GRo(N)}`)),D(V,_("span",void 0,N==="tools"?d(7660,null):N==="tool_search"?d(7661,null):N))}let u=D(c,Nn("span.chat-debug-cache-sig-legend-entry"));D(u,Nn("span.chat-debug-cache-sig-swatch.role-drift")),D(u,_("span",void 0,d(7640,null)));let p=(N,V)=>{let H=[],K=N.system;if(K){let J=V?t.system:e.system;H.push({role:"system",chars:K.length,drift:K!==(J??""),label:"system",synthetic:!0})}let j=N.tools;if(j){let J=V?t.tools:e.tools;H.push({role:"tools",chars:j.length,drift:j!==(J??""),label:"tools",synthetic:!0})}return N.inputMessages.forEach((J,se)=>{let ce=o.signature[se]?.kind,Se=n&&(ce==="contentDrift"||ce==="lengthChange"||V&&ce==="onlyInA"||!V&&ce==="onlyInB");H.push({role:J.role,chars:J.charLength,drift:Se,label:J.name?`${J.role}-${J.name}`:J.role,synthetic:!1})}),H},h=p(e,!0),g=p(t,!1),f=h.reduce((N,V)=>N+V.chars,0),v=g.reduce((N,V)=>N+V.chars,0),b=Math.max(f,v,1),S=N=>{if(!o.break)return;let V=0,H=0;for(let K of N){if(K.synthetic){V+=K.chars;continue}if(H===o.break.index)return V;V+=K.chars,H++}},y=(N,V,H)=>{let K=Nn(".chat-debug-cache-sig-lane-row");D(K,Nn(".chat-debug-cache-sig-lane-label",void 0,N));let j=D(K,Nn(".chat-debug-cache-sig-bar")),J=0;for(let se of V){if(se.chars<=0){J+=se.chars;continue}let ae=se.chars/b*100,ce=D(j,Nn(`span.chat-debug-cache-sig-seg.role-${GRo(se.role)}`));se.drift&&ce.classList.add("is-drift"),ce.style.width=`${ae}%`,ce.title=`${se.label}: ${Av.value.format(se.chars)} chars`+(se.drift?" \u2014 drift":""),se.chars>b*.05&&(ce.textContent=`${se.label}:${Av.value.format(se.chars)}`),J+=se.chars}if(J<b){let se=D(j,Nn("span.chat-debug-cache-sig-seg.role-empty"));se.style.width=`${(b-J)/b*100}%`}if(H!==void 0&&o.break){let se=D(j,Nn(".chat-debug-cache-sig-break"));se.style.left=`${H/b*100}%`,se.title=d(7627,null,o.break.index)}return D(K,Nn(".chat-debug-cache-sig-lane-total",void 0,d(7630,null,Av.value.format(J)))),K},w=D(s,Nn(".chat-debug-cache-sig-lanes"));w.appendChild(y(d(7659,null),h,S(h))),w.appendChild(y(d(7658,null),g,S(g)));let x=0,E;if((e.system||t.system)&&((e.system??"")===(t.system??"")?x+=t.system?.length??0:E=d(7700,null)),!E&&(e.tools||t.tools)&&((e.tools??"")===(t.tools??"")?x+=t.tools?.length??0:E=d(7704,null)),!E)for(let N of o.signature)if(N.kind==="identical")x+=N.bCharLength??0;else{E=`messages[${N.index}]`;break}let M=D(s,Nn(".chat-debug-cache-sig-summary"));E?M.textContent=r?d(7716,null,Av.value.format(x),Av.value.format(v),E):d(7692,null,Av.value.format(x),Av.value.format(v),E):M.textContent=r?d(7717,null,Av.value.format(x),Av.value.format(v)):d(7693,null,Av.value.format(x),Av.value.format(v))}renderRequestOptions(e,t){let o=f4t(e),n=f4t(t),r=new Set([...Object.keys(o),...Object.keys(n)]);if(r.size===0)return;let s=D(this.content,Nn(".chat-debug-cache-section"));D(s,Nn("h3.chat-debug-cache-section-h",void 0,d(7678,null)));let l=D(s,Nn(".chat-debug-cache-options-table")),c=D(l,Nn(".chat-debug-cache-options-row.head"));D(c,Nn(".chat-debug-cache-options-cell.key",void 0,d(7672,null))),D(c,Nn(".chat-debug-cache-options-cell",void 0,d(7673,null))),D(c,Nn(".chat-debug-cache-options-cell",void 0,d(7671,null)));let u=[...r].sort((p,h)=>p.localeCompare(h));for(let p of u){let h=D(l,Nn(".chat-debug-cache-options-row")),g=o[p],f=n[p];!Qi(g,f)&&h.classList.add("changed"),D(h,Nn(".chat-debug-cache-options-cell.key",void 0,p)),D(h,Nn(".chat-debug-cache-options-cell",void 0,m4t(g))),D(h,Nn(".chat-debug-cache-options-cell",void 0,m4t(f)))}}renderComponents(e,t,o,n){let r=D(this.content,Nn(".chat-debug-cache-section"));if(D(r,Nn("h3.chat-debug-cache-section-h",void 0,d(7631,null))),!n&&o.requestShape.isContinuation){let c=D(r,Nn(".chat-debug-cache-sig-summary.chat-debug-cache-request-shape-note"));c.textContent=d(7633,null)}let s=D(r,Nn(".chat-debug-cache-acc")),l=!n&&o.requestShape.isContinuation&&o.inputMessages.length>0?[...e,oSn(o)]:e;if(l.length===0){let c=D(s,Nn(".chat-debug-cache-acc-empty"));c.textContent=d(7620,null);return}for(let c of l){let u=D(s,Nn(".chat-debug-cache-acc-item"));u.classList.add(c.status),this.openComponents.has(c.name)&&u.classList.add("open");let p=D(u,Nn(".chat-debug-cache-acc-head"));D(p,Nn("span.chat-debug-cache-chev"));let h=D(p,Nn(".chat-debug-cache-acc-name"));c.role&&D(h,Nn("span.role",void 0,c.role)),D(h,_("span",void 0,c.name));let g=D(p,Nn(`span.chat-debug-cache-acc-badge.${c.status}`));g.textContent=nSn(c.status);let f=D(p,Nn("span.chat-debug-cache-acc-sizes"));f.textContent=d(7632,null,p4t(c.aSize),p4t(c.bSize));let v=D(u,Nn(".chat-debug-cache-acc-body")),b=c.name===g4t?"":zRo(c,t),S=c.name===g4t?jRo(o):zRo(c,o),y=rSn(b,S);if(y){let w=D(u,Nn(".chat-debug-cache-acc-truncated"));w.textContent=y,w.title=y,p.title=y}v.appendChild(this.renderComponentDiff(b,S,c.aSize,c.bSize)),this.loadDisposables.add($(p,ne.CLICK,()=>{this.openComponents.has(c.name)?(this.openComponents.delete(c.name),u.classList.remove("open")):(this.openComponents.add(c.name),u.classList.add("open"))}))}}renderComponentDiff(e,t,o,n){let r=Nn(".chat-debug-cache-diff"),s=D(r,Nn(".chat-debug-cache-diff-col"));D(s,Nn("h4",void 0,d(7637,null,Av.value.format(o))));let l=D(s,Nn(".chat-debug-cache-diff-body")),c=D(r,Nn(".chat-debug-cache-diff-col"));D(c,Nn("h4",void 0,d(7638,null,Av.value.format(n))));let u=D(c,Nn(".chat-debug-cache-diff-body"));return!e&&!t?(l.textContent=d(7667,null),u.textContent=d(7667,null),r):(hSn(l,u,e,t),r)}};GBe=I([m(1,si),m(2,ph)],GBe);function d4t(a,i){if(a){for(let e of a)if(e.name===i)return e.content}}function iSn(a,i){let e=new Map;for(let n of i){if(!n.id)continue;e.set(n.id,n);let r=n.id.startsWith("user-msg-")?n.id.slice(9):n.id;e.set(r,n)}let t=new Map,o=[];return a.forEach((n,r)=>{let s=n.parentEventId??n.id??`turn-${r}`,l=t.get(s);l||(l={userMessage:e.get(s)??e.get(`user-msg-${s}`),turns:[]},t.set(s,l),o.push(s)),l.turns.push({turn:n,index:r})}),o.map(n=>({key:n,userMessage:t.get(n).userMessage,turns:t.get(n).turns}))}function zRo(a,i){if(a.name==="system")return i.system??"";if(a.name==="tools")return i.tools??"";if(a.name===g4t)return jRo(i);let e=/^messages\[(\d+)\]$/.exec(a.name);if(e){let t=parseInt(e[1],10);return i.inputMessages[t]?.text??""}return""}function jRo(a){return a.requestShape.isContinuation?a.inputMessages.map((i,e)=>`input[${e}] ${i.role}
${i.text}`).join(`

`):""}function oSn(a){let i=a.inputMessages.reduce((e,t)=>e+t.charLength,0);return{name:g4t,role:a.requestShape.inputItemTypes.join(", ")||a.inputMessages.map(e=>e.role).join(", ")||void 0,status:"onlyInB",aSize:0,bSize:i}}function nSn(a){switch(a){case"identical":return d(7622,null);case"contentDrift":return d(7621,null);case"lengthChange":return d(7623,null);case"onlyInA":return d(7624,null);case"onlyInB":return d(7625,null)}}function rSn(a,i){let e=/\.\.\.\[truncated, original (\d+) chars\]$/,t=e.exec(a),o=e.exec(i);if(!t&&!o)return;if(t&&o)return d(7705,null,Av.value.format(parseInt(t[1],10)),Av.value.format(parseInt(o[1],10)));let n=t??o,r=t?d(7708,null):d(7707,null);return d(7706,null,r,Av.value.format(parseInt(n[1],10)))}function KRo(a,i,e){let t=i.signature.find(s=>s.index===i.break?.index),o=t?.bRole??t?.aRole??"message",n=e.inputMessages[i.break?.index??-1],r=n?Av.value.format(n.charLength):void 0;switch(a){case"onlyInB":return r?d(7651,null,o,r):d(7652,null,o);case"onlyInA":return d(7655,null,o);case"contentDrift":return r?d(7653,null,o,r):d(7654,null,o);case"lengthChange":return r?d(7656,null,o,r):d(7657,null,o)}}function u4t(a){return!a.inputTokens||a.cachedTokens===void 0?0:Math.min(100,a.cachedTokens/a.inputTokens*100)}function sSn(a,i){return!a.requestShape.isContinuation&&!i.requestShape.isContinuation}function aSn(a,i){let e=lSn(i),t=Array.isArray(e?.inputItemTypes)?e.inputItemTypes.filter(l=>typeof l=="string"):[],o={api:typeof e?.api=="string"?e.api:void 0,inputItemTypes:t},n=e?.hasPreviousResponseId===!0,r=t.includes("tool_search_output")||a.some(l=>l.role==="tool_search"),s=a.length>0&&a.every(l=>l.role==="tool");return n&&r?{label:d(7686,null),description:d(7687,null),isContinuation:!0,...o}:n&&s?{label:d(7683,null),description:d(7684,null),isContinuation:!0,...o}:n?{label:d(7680,null),description:d(7681,null),isContinuation:!0,...o}:r?{label:d(7688,null),description:d(7689,null),isContinuation:!1,...o}:s?{label:d(7685,null),description:void 0,isContinuation:!1,...o}:{label:d(7682,null),description:void 0,isContinuation:!1,...o}}function lSn(a){if(a)try{let i=JSON.parse(a);if(i&&typeof i=="object")return i}catch{}}function GRo(a){switch(a){case"system":case"tools":case"user":case"assistant":case"tool":return a;case"tool_search":return"tool-search";default:return"tool"}}function KBe(a){return(Math.floor(a*100)/100).toFixed(2)}function cSn(a){return String(Math.floor(a))}function p4t(a){return a===void 0?"\u2014":Av.value.format(a)}function f4t(a){let i={};return a.event.model!==void 0&&(i.model=a.event.model),Object.assign(i,uSn(a.content?.requestOptions)),i}function dSn(a,i){let e=f4t(a),t=f4t(i),o=new Set([...Object.keys(e),...Object.keys(t)]),n=[];for(let r of o){let s=e[r],l=t[r];Qi(s,l)||n.push({key:r,previous:s,current:l})}return n.sort((r,s)=>r.key.localeCompare(s.key)),n}function uSn(a){if(!a)return{};let i;try{i=JSON.parse(a)}catch{return{}}if(!i||typeof i!="object"||Array.isArray(i))return{};let e={};for(let[t,o]of Object.entries(i))if(o&&typeof o=="object"&&!Array.isArray(o))for(let[n,r]of Object.entries(o))e[`${t}.${n}`]=r;else e[t]=o;return e}function m4t(a){if(a===void 0)return"\u2014";if(a===null)return"null";if(typeof a=="string")return a;if(typeof a=="number"||typeof a=="boolean")return String(a);try{return JSON.stringify(a)}catch{return String(a)}}function pSn(a,i,e,t,o){return!(a>=1||i.break||e.length>0||t||o)}var mSn={ignoreTrimWhitespace:!1,maxComputationTimeMs:200,computeMoves:!1};function hSn(a,i,e,t){let o=e.split(/\r?\n/),n=t.split(/\r?\n/),r=yF.getDefault().computeDiff(o,n,mSn),s=0,l=0;for(let c of r.changes){let u=c.original.startLineNumber,p=c.original.endLineNumberExclusive,h=c.modified.startLineNumber,g=c.modified.endLineNumberExclusive;for(;s+1<u&&l+1<h;)h4t(a,o[s],"context"),h4t(i,n[l],"context"),s++,l++;let f=$Ro(c.innerChanges,!0),v=$Ro(c.innerChanges,!1);for(let b=u;b<p;b++){let S=o[b-1]??"";qRo(a,S,f.get(b),"remove")}s=p-1;for(let b=h;b<g;b++){let S=n[b-1]??"";qRo(i,S,v.get(b),"add")}l=g-1}for(;s<o.length&&l<n.length;)h4t(a,o[s],"context"),h4t(i,n[l],"context"),s++,l++}function h4t(a,i,e){let t=D(a,Nn(`.chat-debug-cache-diff-line.${e}`));t.textContent=i===""?"\xA0":i}function qRo(a,i,e,t){let o=D(a,Nn(`.chat-debug-cache-diff-line.${t}`));if(!e||e.length===0){o.textContent=i===""?"\xA0":i;return}let n=1,r=[...e].sort((s,l)=>s.startColumn-l.startColumn);for(let s of r){s.startColumn>n&&D(o,document.createTextNode(i.substring(n-1,s.startColumn-1)));let l=D(o,Nn("span.chat-debug-cache-diff-inner"));l.textContent=i.substring(s.startColumn-1,s.endColumn-1),n=s.endColumn}n-1<i.length&&D(o,document.createTextNode(i.substring(n-1)))}function $Ro(a,i){let e=new Map;if(!a)return e;for(let t of a){let o=i?t.originalRange:t.modifiedRange;if(o.startLineNumber!==o.endLineNumber)continue;let n=e.get(o.startLineNumber)??[];n.push({startColumn:o.startColumn,endColumn:o.endColumn}),e.set(o.startLineNumber,n)}return e}var gSn=_,Zne=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p){super(Zne.ID,e,t,o,n);this.instantiationService=r;this.chatDebugService=s;this.chatWidgetService=l;this.chatService=c;this.contextKeyService=u;this.configurationService=p;this.viewState="home";this.sessionModelListener=this._register(new ue);this.modelChangeListeners=this._register(new Ot)}static{this.ID="workbench.editor.chatDebug"}endActiveSession(){let e=this.chatDebugService.activeSessionResource;e&&this.chatDebugService.endSession(e),this.chatDebugService.activeSessionResource=void 0}createEditor(e){this.container=D(e,gSn(".chat-debug-editor")),this.filterState=this._register(new Q5t);let t=this._register(this.contextKeyService.createScoped(this.container));this._register(ZDo(this.filterState,t)),this.homeView=this._register(this.instantiationService.createInstance(FBe,this.container)),this._register(this.homeView.onNavigateToSession(o=>{this.navigateToSession(o)})),this.overviewView=this._register(this.instantiationService.createInstance(WBe,this.container)),this._register(this.overviewView.onNavigate(o=>{switch(o){case"home":this.endActiveSession(),this.showView("home");break;case"logs":this.showView("logs");break;case"flowchart":this.showView("flowchart");break;case"cache":this.showView("cache");break}})),this.logsView=this._register(this.instantiationService.createInstance(VBe,this.container,this.filterState)),this._register(this.logsView.onNavigate(o=>{switch(o){case"home":this.endActiveSession(),this.showView("home");break;case"overview":this.showView("overview");break}})),this.flowChartView=this._register(this.instantiationService.createInstance(zBe,this.container,this.filterState)),this._register(this.flowChartView.onNavigate(o=>{switch(o){case"home":this.endActiveSession(),this.showView("home");break;case"overview":this.showView("overview");break}})),this.cacheExplorerView=this._register(this.instantiationService.createInstance(GBe,this.container)),this._register(this.cacheExplorerView.onNavigate(o=>{switch(o){case"home":this.endActiveSession(),this.showView("home");break;case"overview":this.showView("overview");break}})),this._register(this.chatDebugService.onDidAddEvent(o=>{this.viewState==="home"?this.homeView?.render():this.chatDebugService.activeSessionResource&&o.sessionResource.toString()===this.chatDebugService.activeSessionResource.toString()&&(this.viewState==="overview"?this.overviewView?.refresh():this.viewState==="flowchart"?this.flowChartView?.refresh():this.viewState==="cache"&&this.cacheExplorerView?.refresh())})),this._register(this.chatWidgetService.onDidChangeFocusedSession(()=>{this.viewState==="home"&&this.homeView?.render()})),this._register(this.chatService.onDidCreateModel(o=>{let n=o.sessionResource.toString();this.modelChangeListeners.set(n,o.onDidChange(r=>{r.kind==="setCustomTitle"&&(this.viewState==="home"?this.homeView?.render():(this.viewState==="overview"||this.viewState==="logs"||this.viewState==="flowchart"||this.viewState==="cache")&&(this.overviewView?.updateBreadcrumb(),this.logsView?.updateBreadcrumb(),this.flowChartView?.updateBreadcrumb(),this.cacheExplorerView?.updateBreadcrumb()))}))})),this._register(this.chatService.onDidDisposeSession(()=>{this.viewState==="home"&&this.homeView?.render()})),this.showView("home")}showView(e){this.viewState=e,this.telemetryService.publicLog2("chatDebugViewSwitched",{viewState:e}),e==="home"?this.homeView?.show():this.homeView?.hide(),e==="overview"?this.overviewView?.show():this.overviewView?.hide(),e==="logs"?(this.logsView?.show(),this.doLayout(),this.logsView?.focus()):this.logsView?.hide(),e==="flowchart"?this.flowChartView?.show():this.flowChartView?.hide(),e==="cache"?this.cacheExplorerView?.show():this.cacheExplorerView?.hide()}navigateToSession(e,t){let o=this.chatDebugService.activeSessionResource;o&&o.toString()!==e.toString()&&this.chatDebugService.endSession(o),this.chatDebugService.activeSessionResource=e,this.chatDebugService.hasInvokedProviders(e)||this.chatDebugService.invokeProviders(e),this.trackSessionModelChanges(e),this.overviewView?.setSession(e),this.logsView?.setSession(e),this.flowChartView?.setSession(e),this.cacheExplorerView?.setSession(e);let n=t==="logs"?"logs":t==="flowchart"?"flowchart":t==="cache"?"cache":"overview";this.showView(n)}trackSessionModelChanges(e){let t=this.chatService.getSession(e);if(!t){this.sessionModelListener.clear();return}this.sessionModelListener.value=t.onDidChange(o=>{(o.kind==="addRequest"||o.kind==="completedRequest")&&this.viewState==="overview"&&this.overviewView?.refresh()})}focus(){this.viewState==="logs"?this.logsView?.focus():this.container?.focus()}async setInput(e,t,o,n){await super.setInput(e,t,o,n),t&&this._applyNavigationOptions(t)}setOptions(e){super.setOptions(e),e&&this._applyNavigationOptions(e)}setEditorVisible(e){if(super.setEditorVisible(e),e){if(this.telemetryService.publicLog2("chatDebugPanelOpened"),!this.configurationService.getValue(OM)){this.endActiveSession(),this.showView("home");return}this.showView(this.viewState)}}_applyNavigationOptions(e){if(!this.configurationService.getValue(OM)){this.endActiveSession(),this.showView("home");return}let{sessionResource:t,viewHint:o,filter:n}=e;o==="logs"&&t?this.navigateToSession(t,"logs"):o==="flowchart"&&t?this.navigateToSession(t,"flowchart"):o==="cache"&&t?this.navigateToSession(t,"cache"):o==="overview"&&t?this.navigateToSession(t,"overview"):o==="home"?(this.endActiveSession(),this.showView("home")):t?this.navigateToSession(t,"overview"):this.viewState==="home"&&this.showView("home"),n!==void 0&&this.filterState&&(this.filterState.setTextFilter(n),this.logsView?.setFilterText(n))}layout(e){this.currentDimension=e,this.container&&(this.container.style.width=`${e.width}px`,this.container.style.height=`${e.height}px`),this.doLayout()}doLayout(){!this.currentDimension||this.viewState!=="logs"||this.logsView?.layout(this.currentDimension)}};Zne=I([m(1,_e),m(2,Pe),m(3,de),m(4,F),m(5,ph),m(6,Lt),m(7,si),m(8,X),m(9,B)],Zne);var S$=class extends k{constructor(e,t,o,n,r){super();this.promptsService=e;this._discoveryEventDetails=new Map;this._customizationEventDetails=new Map;this._loggedSessions=new Set;this._register(o.onDidDisposeSession(s=>{for(let l of s.sessionResources)this._loggedSessions.delete(l.toString())})),this._register(t.onWillInvokeAgent(async s=>{let l=s.request.sessionResource.toString(),c=!this._loggedSessions.has(l);this._loggedSessions.add(l);let u=s.request.sessionResource;if(c){let h=new qe;try{let g=await Promise.all(["agent","instructions","prompt","skill","hook"].map(f=>this.promptsService.getDiscoveryInfo(f,h.token)));for(let f of g){let{name:v,details:b}=this.getDiscoveryLogEntry(f),S=ht();if(this._discoveryEventDetails.set(S,f),this._discoveryEventDetails.size>S$.MAX_DISCOVERY_DETAILS){let N=this._discoveryEventDetails.keys().next().value;N!==void 0&&this._discoveryEventDetails.delete(N)}let y=f.files.filter(N=>N.status==="loaded").map(N=>N.promptPath.name??N.promptPath.uri.path.split("/").pop()??N.promptPath.uri.toString()),w=f.files.filter(N=>N.status==="skipped").map(N=>{let V=N.promptPath.uri.toString();return N.skipReason?`${V} (${N.skipReason})`:V}),x=f.sourceFolders?.map(N=>N.uri.path)??[],E=[];b&&E.push(b),y.length>0&&E.push(`loaded: [${Q0i(y)}]`),w.length>0&&E.push(`skipped: [${Q0i(w)}]`),x.length>0&&E.push(`folders: [${Q0i(x)}]`);let M=E.join(" | ")||void 0;n.log(u,v,M,void 0,{id:S,category:"discovery"})}}catch(g){r.error("Error while logging prompt discovery info to chat debug service",g)}finally{h.dispose()}}let p=KOi;if(!c&&p){let{telemetryEvent:h,debugInfo:g}=p,f;try{f=(await this.promptsService.getDiscoveryInfo("hook",Ie.None)).hooksInfo?.hooks}catch(E){r.warn("Error while fetching hooks for customization debug event",E)}let v=[];h.applyingInstructionsCount>0&&v.push(d(8411,null,h.applyingInstructionsCount)),h.referencedInstructionsCount>0&&v.push(d(8413,null,h.referencedInstructionsCount)),h.agentInstructionsCount>0&&v.push(d(8410,null,h.agentInstructionsCount)),h.listedInstructionsCount>0&&v.push(d(8412,null,h.listedInstructionsCount));let b=g.durationInMillis.toFixed(1),S=v.length>0?d(8415,null,h.totalInstructionsCount,v.join(", "),b):d(8416,null),y=g.debugDetails.map(E=>{let M=E.reason?`${E.name} \u2014 ${E.reason}`:E.name;return`[${E.category}] ${M}`}),w=y.length>0?`${S} | ${y.join(", ")}`:S,x=ht();if(this._customizationEventDetails.set(x,{debugInfo:g,hooks:f}),this._customizationEventDetails.size>S$.MAX_DISCOVERY_DETAILS){let E=this._customizationEventDetails.keys().next().value;E!==void 0&&this._customizationEventDetails.delete(E)}n.log(u,d(8414,null),w,void 0,{id:x,category:"customization"})}})),this._register(n.registerProvider({provideChatDebugLog:async()=>{},resolveChatDebugLogEvent:async s=>this._resolveDiscoveryEvent(s)??this._resolveCustomizationEvent(s)}))}static{this.ID="workbench.contrib.promptsDebug"}static{this.MAX_DISCOVERY_DETAILS=1e4}getDiscoveryLogEntry(e){let t=e.durationInMillis.toFixed(1),o=e.files.filter(r=>r.status==="loaded").length,n=e.files.length-o;switch(e.type){case"prompt":return{name:d(8433,null),details:o===1?d(8427,null,o,t):d(8428,null,o,t)};case"agent":return{name:d(8429,null),details:o===1?d(8418,null,o,t):d(8419,null,o,t)};case"skill":return{name:d(8432,null),details:o===1?d(8425,null,o,t):d(8426,null,o,t)};case"instructions":return{name:d(8431,null),details:o===1?d(8423,null,o,t):d(8424,null,o,t)};case"hook":{let r=e,s=r.hooksInfo?Object.values(r.hooksInfo.hooks).reduce((c,u)=>c+u.length,0):o,l=n>0?d(8422,null,s,o,t,n):s===1?d(8420,null,s,t):d(8421,null,s,t);return{name:d(8430,null),details:l}}}}_resolveDiscoveryEvent(e){let t=this._discoveryEventDetails.get(e);if(t)return this._toFileListContent(t)}_resolveCustomizationEvent(e){let t=this._customizationEventDetails.get(e);if(!t)return;let{debugInfo:o,hooks:n}=t,r=[...o.debugDetails];if(n)for(let s of Object.values(fE)){let l=n[s];if(l&&l.length>0)for(let c of l){let u=G0(c,Ao)||d(8417,null);r.push({category:"hook",name:u,reason:s,uri:c.sourceUri})}}return{kind:"customizationSummary",resolutionLogs:r,durationInMillis:o.durationInMillis,counts:{instructions:r.filter(s=>s.category==="applying"||s.category==="referenced").length,skills:r.filter(s=>s.category==="skill").length,agents:r.filter(s=>s.category==="custom-agent").length,hooks:r.filter(s=>s.category==="hook").length,skipped:r.filter(s=>s.category==="skipped").length}}}_toFileListContent(e){return{kind:"fileList",discoveryType:e.type,durationInMillis:e.durationInMillis,files:e.files.map(t=>({uri:t.promptPath.uri,name:t.promptPath.name,status:t.status,storage:t.promptPath.storage,extensionId:t.promptPath.extension?.identifier.value,skipReason:t.skipReason,errorMessage:t.errorMessage,duplicateOf:t.duplicateOf})),sourceFolders:e.sourceFolders?.map(t=>({uri:t.uri,storage:t.storage}))}}};S$=I([m(0,jr),m(1,gr),m(2,si),m(3,ph),m(4,re)],S$);var j0i=100;function Q0i(a){return a.length<=j0i?a.join(", "):a.slice(0,j0i).join(", ")+` (+${a.length-j0i} more)`}var obe=le("agentTitleBarStatusService"),v4t=class extends k{constructor(){super(...arguments);this._mode="default";this._onDidChangeMode=this._register(new T);this.onDidChangeMode=this._onDidChangeMode.event;this._onDidChangeSessionInfo=this._register(new T);this.onDidChangeSessionInfo=this._onDidChangeSessionInfo.event}get mode(){return this._mode}get sessionInfo(){return this._sessionInfo}enterSessionMode(e,t){let o={sessionResource:e,title:t},n=this._mode!=="session";this._mode="session",this._sessionInfo=o,n&&this._onDidChangeMode.fire(this._mode),this._onDidChangeSessionInfo.fire(this._sessionInfo)}enterSessionReadyMode(e,t){let o={sessionResource:e,title:t},n=this._mode!=="sessionReady";this._mode="sessionReady",this._sessionInfo=o,n&&this._onDidChangeMode.fire(this._mode),this._onDidChangeSessionInfo.fire(this._sessionInfo)}exitSessionReadyMode(){this._mode==="sessionReady"&&(this._mode="default",this._sessionInfo=void 0,this._onDidChangeMode.fire(this._mode),this._onDidChangeSessionInfo.fire(void 0))}exitSessionMode(){this._mode!=="default"&&(this._mode="default",this._sessionInfo=void 0,this._onDidChangeMode.fire(this._mode),this._onDidChangeSessionInfo.fire(void 0))}updateSessionTitle(e){this._mode!=="session"||!this._sessionInfo||(this._sessionInfo={...this._sessionInfo,title:e},this._onDidChangeSessionInfo.fire(this._sessionInfo))}};var qBe=new Y("chatInAgentSessionProjection",!1,{type:"boolean",description:d(6870,null)});var Y0i=new Set(Object.values(zo)),jBe=le("agentSessionProjectionService"),$Be=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.configurationService=t;this.editorGroupsService=o;this.editorService=n;this.logService=r;this.chatWidgetService=s;this.chatSessionsService=l;this.layoutService=c;this.commandService=u;this.chatEditingService=p;this.agentTitleBarStatusService=h;this.agentSessionsService=g;this._isActive=!1;this._isExiting=!1;this._isSwappingSessions=!1;this._onDidChangeProjectionMode=this._register(new T);this.onDidChangeProjectionMode=this._onDidChangeProjectionMode.event;this._onDidChangeActiveSession=this._register(new T);this.onDidChangeActiveSession=this._onDidChangeActiveSession.event;this._sessionWorkingSets=new Map;this._wasAuxiliaryBarMaximized=!1;this._inProjectionModeContextKey=qBe.bindTo(e),this._register(this.editorService.onDidCloseEditor(()=>this._checkForEmptyEditors())),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>this._checkForInProgressSession()))}get isActive(){return this._isActive}get activeSession(){return this._activeSession}_isEnabled(){return this.configurationService.getValue("chat.agentSessionProjection.enabled")===!0}_checkForEmptyEditors(){if(!this._isActive||this._isExiting||this._isSwappingSessions)return;this.editorService.visibleEditors.length>0||(this.logService.trace("[AgentSessionProjection] All editors closed, exiting projection mode"),this.exitProjection())}_checkForInProgressSession(){if(!this._isActive||!this._activeSession)return;let e=this.agentSessionsService.getSession(this._activeSession.resource);e&&Rx(e.status)&&(this.logService.trace("[AgentSessionProjection] Active session transitioned to in-progress, exiting projection mode"),this.exitProjection({startNewChat:!1}))}async _openSessionInChatPanel(e){e.setRead(!0),await this.chatSessionsService.activateChatSessionItemProvider(e.providerType),await this.chatWidgetService.openSession(e.resource,void 0,{title:{preferred:e.label},revealIfOpened:!0})}async _openSessionFiles(e){if(this.logService.trace(`[AgentSessionProjection] Opening files for session '${e.label}'`,{hasChanges:!!e.changes,isArray:Array.isArray(e.changes),changeCount:Array.isArray(e.changes)?e.changes.length:0}),e.changes&&Array.isArray(e.changes)&&e.changes.length>0){let t=e.changes.filter(o=>o.originalUri).map(o=>({originalUri:o.originalUri,modifiedUri:o.modifiedUri}));if(this.logService.trace(`[AgentSessionProjection] Found ${t.length} files with diffs to display`),t.length>0){await this.editorService.openEditor({multiDiffSource:e.resource.with({scheme:e.resource.scheme+"-agent-session-projection"}),resources:t.map(r=>({original:{resource:r.originalUri},modified:{resource:r.modifiedUri}})),label:d(6875,null,e.label)},MM),this.logService.trace("[AgentSessionProjection] Multi-diff editor opened successfully in modal view");let o=e.resource.toString(),n=this.editorGroupsService.saveWorkingSet(`agent-session-projection-${o}`);return this._sessionWorkingSets.set(o,n),!0}else return this.logService.trace("[AgentSessionProjection] No files with diffs to display (all changes missing originalUri)"),!1}else return this.logService.trace("[AgentSessionProjection] Session has no changes to display"),!1}async enterProjection(e){if(!this._isEnabled()){this.logService.trace("[AgentSessionProjection] Agent Session Projection is disabled");return}if(!Y0i.has(e.providerType)){this.logService.trace(`[AgentSessionProjection] Provider type '${e.providerType}' does not support agent session projection`);return}let t=this.layoutService.isAuxiliaryBarMaximized();if(this.logService.trace("[AgentSessionProjection] enterProjection auxiliary bar state",{isAuxiliaryBarMaximized:t}),Rx(e.status)){this.logService.trace("[AgentSessionProjection] Session is in progress, opening chat without projection mode"),this._isActive&&await this.exitProjection({startNewChat:!1}),await this._openSessionInChatPanel(e);return}let o=!0,n=!0;if(e.providerType===zo.Local){let r=this.chatEditingService.getEditingSession(e.resource);n=!!r,r?(o=r.entries.get().some(s=>s.state.get()===0),o||this.logService.trace("[AgentSessionProjection] Local session has no undecided changes, opening chat without projection mode")):(o=!1,this.logService.trace("[AgentSessionProjection] Local session has no editing session yet"))}if(!o&&this._isActive&&n){this.logService.trace("[AgentSessionProjection] Switching to session without changes while in projection mode, exiting projection"),await this.exitProjection({startNewChat:!1}),await this._openSessionInChatPanel(e);return}if(!o&&this._isActive&&!n){this.logService.trace("[AgentSessionProjection] Switching to session without editing session while in projection mode, staying in projection"),await this._openSessionInChatPanel(e);return}if(o){if(!this._isActive&&!this._preProjectionWorkingSet){let s=this.editorService.visibleEditors.length;this._preProjectionWorkingSet=this.editorGroupsService.saveWorkingSet("agent-session-projection-backup"),this.logService.trace("[AgentSessionProjection] saved pre-projection working set",{id:this._preProjectionWorkingSet.id,visibleEditorsBefore:s})}if(this._isActive&&this._activeSession){this._isSwappingSessions=!0;let s=this._activeSession.resource.toString(),l=this.editorGroupsService.saveWorkingSet(`agent-session-projection-${s}`);this._sessionWorkingSets.set(s,l)}try{let s=!1;if(e.providerType===zo.Local?s=!0:s=await this._openSessionFiles(e),!s)this.logService.trace("[AgentSessionProjection] No files to display, opening chat without projection mode"),!this._isActive&&this._preProjectionWorkingSet&&(await this.editorGroupsService.applyWorkingSet(this._preProjectionWorkingSet),this.editorGroupsService.deleteWorkingSet(this._preProjectionWorkingSet),this._preProjectionWorkingSet=void 0);else{let l=this._isActive;this._isActive=!0,this._activeSession=e,this._inProjectionModeContextKey.set(!0),this.layoutService.mainContainer.classList.add("agent-session-projection-active"),l||(this._wasAuxiliaryBarMaximized=t,this.logService.trace("[AgentSessionProjection] captured auxiliary bar maximized state",{wasAuxiliaryBarMaximized:this._wasAuxiliaryBarMaximized})),this.agentTitleBarStatusService.enterSessionMode(e.resource,e.label),l||this._onDidChangeProjectionMode.fire(!0),this._onDidChangeActiveSession.fire(e)}}finally{this._isSwappingSessions=!1}}await this._openSessionInChatPanel(e),e.providerType===zo.Local&&o&&await this.commandService.executeCommand("chatEditing.viewChanges"),this._wasAuxiliaryBarMaximized&&(this.logService.trace("[AgentSessionProjection] hiding maximized auxiliary bar during projection"),this.layoutService.setPartHidden(!0,"workbench.parts.auxiliarybar"))}async exitProjection(e){if(!this._isActive||this._isExiting)return;let t=e?.startNewChat??!0;if(this._isExiting=!0,this.logService.trace("[AgentSessionProjection] exitProjection start",{hasPreProjectionWorkingSet:!!this._preProjectionWorkingSet,activeSession:this._activeSession?.label,startNewChat:t,wasAuxiliaryBarMaximized:this._wasAuxiliaryBarMaximized}),this._activeSession){let n=this._activeSession.resource.toString(),r=this.editorGroupsService.saveWorkingSet(`agent-session-projection-${n}`);this._sessionWorkingSets.set(n,r)}for(let n of this.editorGroupsService.groups)await n.closeAllEditors();this.logService.trace("[AgentSessionProjection] exitProjection closed editors",{visible:this.editorService.visibleEditors.length}),this._preProjectionWorkingSet?(await this.editorGroupsService.applyWorkingSet(this._preProjectionWorkingSet),this.logService.trace("[AgentSessionProjection] exitProjection applied pre-projection working set",{visible:this.editorService.visibleEditors.length,id:this._preProjectionWorkingSet.id}),this.editorGroupsService.deleteWorkingSet(this._preProjectionWorkingSet),this._preProjectionWorkingSet=void 0):(await this.editorGroupsService.applyWorkingSet("empty",{preserveFocus:!0}),this.logService.trace("[AgentSessionProjection] exitProjection no pre-working set, applied empty")),this._isActive=!1,this._activeSession=void 0,this._inProjectionModeContextKey.set(!1);let o=this._wasAuxiliaryBarMaximized;this._wasAuxiliaryBarMaximized=!1,this.layoutService.mainContainer.classList.remove("agent-session-projection-active"),this.agentTitleBarStatusService.exitSessionMode(),this._onDidChangeProjectionMode.fire(!1),this._onDidChangeActiveSession.fire(void 0),t&&await this.commandService.executeCommand(Mh),o&&(this.logService.trace("[AgentSessionProjection] restoring auxiliary bar maximized state"),this.layoutService.setPartHidden(!1,"workbench.parts.auxiliarybar"),await this.commandService.executeCommand("workbench.action.maximizeAuxiliaryBar")),this.logService.trace("[AgentSessionProjection] exitProjection complete"),this._isExiting=!1}};$Be=I([m(0,X),m(1,B),m(2,kt),m(3,ie),m(4,re),m(5,Lt),m(6,Ms),m(7,wi),m(8,fe),m(9,mu),m(10,obe),m(11,Vc)],$Be);var Blt="0_leading",UP=class extends z{constructor(e,t,o,n,r){super({id:`toggle.${e}`,title:t,metadata:o?{description:o}:void 0,toggled:C.equals(`config.${e}`,!0),menu:[{id:R.TitleBarContext,when:r,order:n,group:"2_config"},{id:R.TitleBarTitleContext,when:r,order:n,group:"2_config"}]});this.section=e}run(e,...t){let o=e.get(B),n=o.getValue(this.section);o.updateValue(this.section,!n)}};W(class extends UP{constructor(){super("window.commandCenter",d(5134,null),d(5135,null),1,N0.toNegated())}});W(class extends UP{constructor(){super("workbench.navigationControl.enabled",d(5142,null),d(5143,null),2,C.and(N0.toNegated(),C.has("config.window.commandCenter")))}});W(class extends UP{constructor(){super("workbench.layoutControl.enabled",d(5140,null),d(5141,null),4)}});W(class extends UP{constructor(){super("workbench.notifications.showInTitleBar",d(5144,null),d(5145,null),5,C.equals("config.workbench.notifications.position","top-right"))}});W(class extends z{constructor(){super({id:"toggle.window.customTitleBarVisibility",title:d(5138,null),menu:[{id:R.TitleBarContext,order:0,when:C.equals(yZ.key,"native"),group:"3_toggle"},{id:R.TitleBarTitleContext,order:0,when:C.equals(yZ.key,"native"),group:"3_toggle"}]})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","never")}});W(class extends z{constructor(){super({id:"toggle.window.customTitleBarVisibility.windowed",title:d(5139,null),menu:[{id:R.TitleBarContext,order:1,when:ZA,group:"3_toggle"},{id:R.TitleBarTitleContext,order:1,when:ZA,group:"3_toggle"}]})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","windowed")}});var X0i=class extends z{constructor(){super({id:"toggle.toggleCustomTitleBar",title:d(5136,null),toggled:w3,menu:[{id:R.MenubarAppearanceMenu,order:6,when:C.or(C.and(C.equals(yZ.key,"native"),C.and(C.equals("config.workbench.layoutControl.enabled",!1),C.equals("config.window.commandCenter",!1),C.notEquals("config.workbench.editor.editorActionsLocation","titleBar"),C.notEquals("config.workbench.activityBar.location","top"),C.notEquals("config.workbench.activityBar.location","bottom"))?.negate()),ZA),group:"2_workbench_layout"}]})}run(i,...e){let t=i.get(B),o=i.get(X);switch(t.getValue("window.customTitleBarVisibility")){case"never":t.updateValue("window.customTitleBarVisibility","auto");break;case"windowed":{ZA.evaluate(o.getContext(null))?t.updateValue("window.customTitleBarVisibility","auto"):t.updateValue("window.customTitleBarVisibility","never");break}case"auto":default:t.updateValue("window.customTitleBarVisibility","never");break}}};W(X0i);W(class extends z{constructor(){super({id:"showCustomTitleBar",title:P(5133,"Show Custom Title Bar"),precondition:w3.negate(),f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","auto")}});W(class extends z{constructor(){super({id:"hideCustomTitleBar",title:P(5130,"Hide Custom Title Bar"),precondition:w3,f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","never")}});W(class extends z{constructor(){super({id:"hideCustomTitleBarInFullScreen",title:P(5131,"Hide Custom Title Bar In Full Screen"),precondition:C.and(w3,ZA),f1:!0})}run(i,...e){i.get(B).updateValue("window.customTitleBarVisibility","windowed")}});W(class I1 extends z{static{this.settingsID="workbench.editor.editorActionsLocation"}constructor(){let i=C.and(C.equals("config.workbench.editor.showTabs","none").negate(),C.equals(`config.${I1.settingsID}`,"default"))?.negate();super({id:`toggle.${I1.settingsID}`,title:d(5137,null),toggled:C.equals(`config.${I1.settingsID}`,"hidden").negate(),menu:[{id:R.TitleBarContext,order:3,when:i,group:"2_config"},{id:R.TitleBarTitleContext,order:3,when:i,group:"2_config"}]})}run(i,...e){let t=i.get(B),o=i.get(de),n=t.getValue(I1.settingsID);if(n==="hidden"){if(t.getValue("workbench.editor.showTabs")!=="none")t.updateValue(I1.settingsID,"titleBar");else{let s=o.get(I1.settingsID,0);t.updateValue(I1.settingsID,s??"default")}o.remove(I1.settingsID,0)}else t.updateValue(I1.settingsID,"hidden"),o.store(I1.settingsID,n,0,0)}});var QRo={id:CU,label:d(5129,null),tooltip:d(5129,null),class:void 0,enabled:!0,run:function(){}},YRo={id:wU,label:d(5132,null),tooltip:d(5132,null),class:void 0,enabled:!0,run:function(){}};var ere=class a extends z{static{this.ID="agentSession.enterAgentSessionProjection"}constructor(){super({id:a.ID,title:P(6871,"Enter Agent Session Projection"),category:fi,f1:!1,precondition:C.and(Z.enabled,C.has("config.chat.agentSessionProjection.enabled"),qBe.negate())})}async run(i,e){let t=i.get(jBe),o=i.get(Vc),n;e&&(dWt(e)?n=o.getSession(e.session.resource):n=e),n&&await t.enterProjection(n)}},J6=class a extends z{static{this.ID="agentSession.exitAgentSessionProjection"}constructor(){super({id:a.ID,title:P(6872,"Exit Agent Session Projection"),category:fi,f1:!0,precondition:C.and(Z.enabled,qBe),keybinding:{weight:200,primary:9,when:qBe}})}async run(i){await i.get(jBe).exitProjection()}},b4t=class extends UP{constructor(){super("chat.unifiedAgentsBar.enabled",d(6873,null),d(6874,null),7,C.and(Z.enabled,N0.negate(),Z.supported,C.has("config.window.commandCenter")))}};var nbe=class extends ll{constructor(e){super();this._onDidSelect=this._register(new T);this.onDidSelect=this._onDidSelect.event;this.items=[];this.buttons=this._register(new Ot);this.hoverDelegate=e.hoverDelegate??this._register(Dg()),this.domNode=_(".monaco-custom-radio"),this.domNode.setAttribute("role","radio"),this.setItems(e.items)}setItems(e){this.buttons.clearAndDisposeAll(),this.items=e,this.activeItem=this.items.find(t=>t.isActive)??this.items[0];for(let t=0;t<this.items.length;t++){let o=this.items[t],n=new O,r=n.add(new Pi(this.domNode,{hoverDelegate:this.hoverDelegate,title:o.tooltip,supportIcons:!0}));r.enabled=!o.disabled,n.add(r.onDidClick(()=>{this.activeItem!==o&&(this.activeItem=o,this.updateButtons(),this._onDidSelect.fire(t))})),this.buttons.set(r,{item:o,dispose:()=>n.dispose()})}this.updateButtons()}setActiveItem(e){if(e<0||e>=this.items.length)throw new Error("Invalid Index");this.activeItem=this.items[e],this.updateButtons()}setEnabled(e){for(let[t]of this.buttons)t.enabled=e}updateButtons(){let e=!1;for(let[t,{item:o}]of this.buttons){let n=e;e=o===this.activeItem,t.element.classList.toggle("active",e),t.element.classList.toggle("previous-active",n),t.label=o.text}}};var Hlt="unified-quick-access-send-to-agent",J0i=[{id:"agentSessions",label:d(6911,null),prefix:"agent ",placeholder:d(6910,null),tooltip:d(6912,null)},{id:"commands",label:d(6914,null),prefix:">",placeholder:d(6913,null),tooltip:d(6915,null)},{id:"files",label:d(6917,null),prefix:"",placeholder:d(6916,null),tooltip:d(6918,null)}],QBe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.quickInputService=t;this.instantiationService=o;this.contextKeyService=n;this.layoutService=r;this.commandService=s;this.keybindingService=l;this.hoverService=c;this.registry=oe.as(Bu.Quickaccess);this.mapProviderToDescriptor=new Map;this._currentDisposables=this._register(new O);this._providerDisposables=this._register(new O);this._isInternalValueChange=!1;this._isUpdatingSendToAgent=!1;this._tabs=e??J0i}show(e,t){if(this._currentPicker)return;this._currentDisposables.clear();let o=this._currentDisposables.add(this.quickInputService.createQuickPick({useSeparators:!0}));this._currentPicker=o,o.ignoreFocusOut=!1,o.matchOnDescription=!0,o.matchOnDetail=!0,o.sortByLabel=!1;let n=e?this._tabs.find(r=>r.id===e)??this._tabs[0]:this._tabs[0];this._currentTab=n,this._injectTabBar(o),this._isInternalValueChange=!0,o.value=t??"",o.placeholder=n.placeholder,this._isInternalValueChange=!1,this._activateProvider(n,o),this._currentDisposables.add(o.onDidChangeValue(r=>{if(this._isInternalValueChange)return;if(this._arrivedViaShortcut){let l=this._arrivedViaShortcut;if(!r.startsWith(l)){let c=this._tabs.find(u=>u.id==="files");if(c&&c!==this._currentTab){this._arrivedViaShortcut=void 0,this._switchTab(c,o,!1);return}}}let s=this._detectTabFromValue(r);s&&s!==this._currentTab&&this._switchTab(s,o,!0),this._updateSendButtonState(r),this._sendToAgentTimeout&&clearTimeout(this._sendToAgentTimeout),this._sendToAgentTimeout=setTimeout(()=>this._maybeShowSendToAgent(o),150)})),this._currentDisposables.add(o.onDidAccept(()=>{let r=o.selectedItems,s=o.activeItems,l=r.length>0&&r[0].id===Hlt,c=s.some(p=>p.id!==Hlt),u;this._arrivedViaShortcut&&o.value.startsWith(this._arrivedViaShortcut)?u=o.value.substring(1).trim():this._currentTab?u=o.value.substring(this._currentTab.prefix.length).trim():u=o.value.trim(),(l||!c&&u)&&this._sendMessage(o.value)})),this._currentDisposables.add(o.onDidHide(()=>{this._providerDisposables.clear(),this._providerCts?.cancel(),this._providerCts=void 0,this._currentPicker=void 0,this._currentTab=void 0,this._arrivedViaShortcut=void 0,this._sendToAgentTimeout&&(clearTimeout(this._sendToAgentTimeout),this._sendToAgentTimeout=void 0),this._tabBarContainer?.remove(),this._tabBarContainer=void 0,this._sendButton=void 0,this._sendButtonLabel=void 0,this._sendButtonIcon=void 0,this._sendButtonHover=void 0,this._currentDisposables.clear()})),o.show()}hide(){this._currentPicker?.hide()}get isVisible(){return!!this._currentPicker}_injectTabBar(e){let t=this._currentDisposables.add(U.once(this.quickInputService.onShow)(()=>{this._currentDisposables.delete(t);let o=this.layoutService.activeContainer.querySelector(".quick-input-widget");if(!o)return;let n=o.querySelector(".quick-input-header"),r=o.querySelector(".quick-input-list");if(!n||!r)return;let s=_("div.unified-quick-access-tabs");this._tabBarContainer=s;let l=this._currentDisposables.add(Dg()),c=this._tabs.map(h=>({text:h.label,tooltip:h.tooltip,isActive:h===this._currentTab})),u=this._currentDisposables.add(new nbe({items:c,hoverDelegate:l}));s.appendChild(u.domNode),this._currentDisposables.add(u.onDidSelect(h=>{let g=this._tabs[h];g&&g!==this._currentTab&&this._switchTab(g,e,!1)}));let p=this._createSendButton(e);s.appendChild(p),r.parentElement?.insertBefore(s,r),e._unifiedRadio=u}))}_createSendButton(e){let t=_("div.unified-quick-access-send-container"),o=_("button.unified-send-button");o.setAttribute("type","button"),this._sendButton=o;let n=un(L.send);n.classList.add("unified-send-icon"),this._sendButtonIcon=n,o.appendChild(n);let r=_("span.unified-send-label");return this._sendButtonLabel=r,o.appendChild(r),t.appendChild(o),this._sendButtonHover=this._currentDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),o,"")),this._updateSendButtonState(e.value),this._currentDisposables.add($(o,ne.CLICK,s=>{s.preventDefault(),s.stopPropagation(),e.value.trim().length>0?this._sendMessageRaw(e.value):this._openChat()})),t}_updateSendButtonState(e){if(!this._sendButton||!this._sendButtonLabel||!this._sendButtonIcon)return;if(e.trim().length>0)this._sendButtonLabel.textContent=d(6924,null),this._sendButtonHover?.update(d(6927,null)),this._sendButtonIcon.style.display="";else{let n=this.keybindingService.lookupKeybinding(tk)?.getLabel()??"";this._sendButtonLabel.textContent=d(6920,null);let r=n?d(6922,null,n):d(6921,null);this._sendButtonHover?.update(r),this._sendButtonIcon.style.display="none"}}_openChat(){this.hide(),this.commandService.executeCommand(tk)}async _sendMessageRaw(e){let t=e.trim();if(!t)return;this.hide(),await this.commandService.executeCommand(Mh);let o={query:t,isPartialQuery:!1};this.commandService.executeCommand(tk,o)}async _sendMessage(e){let t=e;if(this._arrivedViaShortcut&&t.startsWith(this._arrivedViaShortcut)?t=t.substring(1).trim():this._currentTab&&e.startsWith(this._currentTab.prefix)&&(t=e.substring(this._currentTab.prefix.length).trim()),!t)return;this.hide(),await this.commandService.executeCommand(Mh);let o={query:t,isPartialQuery:!1};this.commandService.executeCommand(tk,o)}_maybeShowSendToAgent(e){if(this._isUpdatingSendToAgent)return;let t;this._arrivedViaShortcut&&e.value.startsWith(this._arrivedViaShortcut)?t=e.value.substring(1).trim():this._currentTab?t=e.value.substring(this._currentTab.prefix.length).trim():t=e.value.trim();let o=e.value.trim();if(!(t||o)||e.busy)return;let r=e.items[0];if(r?.id===Hlt&&r.description===o)return;let s={id:Hlt,label:`$(send) ${d(6926,null)}`,description:o,alwaysShow:!0,ariaLabel:d(6925,null,o)},l=e.items.filter(h=>h.id!==Hlt),c=this._currentTab?.id==="agentSessions",u=l.length>0,p=c||!u;this._isUpdatingSendToAgent=!0;try{p?e.items=[s,...l]:e.items=l}finally{this._isUpdatingSendToAgent=!1}}_switchTab(e,t,o){if(e===this._currentTab)return;let n=this._currentTab;this._currentTab=e;let r=t._unifiedRadio;if(r){let s=this._tabs.indexOf(e);s>=0&&r.setActiveItem(s)}if(this._isInternalValueChange=!0,o&&n){let s=t.value,l=s;s.startsWith(n.prefix)&&(l=s.substring(n.prefix.length)),this._arrivedViaShortcut==="<"&&e.id==="agentSessions"?(l=l.replace(/^<+/,""),t.value="<"+l):this._arrivedViaShortcut===">"&&e.id==="commands"?(l=l.replace(/^>+/,""),t.value=">"+l):t.value=e.prefix+l}else if(n){let s=t.value;s.startsWith(n.prefix)&&(t.value=s.substring(n.prefix.length)),(t.value.startsWith("<")||t.value.startsWith(">"))&&(t.value=t.value.substring(1)),this._arrivedViaShortcut=void 0}this._isInternalValueChange=!1,t.placeholder=e.placeholder,this._activateProvider(e,t)}_detectTabFromValue(e){if(e==="<"||e.startsWith("<")){let o=this._tabs.find(n=>n.id==="agentSessions");if(o&&this._currentTab?.id!=="agentSessions")return this._arrivedViaShortcut="<",o}if(e===">"||e.startsWith(">")){let o=this._tabs.find(n=>n.id==="commands");if(o&&this._currentTab?.id!=="commands")return this._arrivedViaShortcut=">",o}return this._currentTab&&e.startsWith(this._currentTab.prefix)?this._currentTab:[...this._tabs].filter(o=>o.prefix.length>0).sort((o,n)=>n.prefix.length-o.prefix.length).find(o=>e.startsWith(o.prefix))}_activateProvider(e,t){if(this._providerDisposables.clear(),this._providerCts?.cancel(),this._providerCts=new qe,this._providerDisposables.add(this._providerCts),e.isSendTab){t.busy=!1,t.items=[{label:d(6923,null),alwaysShow:!0}];return}t.items=[],t.busy=!0;let[o]=this._getOrInstantiateProvider(e.prefix);if(o){let n=e.prefix,r=this._arrivedViaShortcut;t.filterValue=l=>r&&l.startsWith(r)?l.substring(1):l.startsWith(n)?l.substring(n.length):l;let s=o.provide(t,this._providerCts.token);this._providerDisposables.add(s)}else t.busy=!1,t.items=[{label:d(6919,null),alwaysShow:!0}]}_getOrInstantiateProvider(e){let t=this.registry.getQuickAccessProvider(e,this.contextKeyService);if(!t)return[void 0,void 0];let o=this.mapProviderToDescriptor.get(t);return o||(o=this.instantiationService.createInstance(t.ctor),this.mapProviderToDescriptor.set(t,o)),[o,t]}dispose(){this._providerCts?.cancel();for(let e of this.mapProviderToDescriptor.values())Sd(e)&&e.dispose();super.dispose()}};QBe=I([m(1,$e),m(2,F),m(3,X),m(4,Kl),m(5,fe),m(6,Le),m(7,ot)],QBe);var Z0i;function S4t(a){return Z0i||(Z0i=a.createInstance(QBe,J0i)),Z0i}var Ult="workbench.action.unifiedQuickAccess",eWi=class a extends z{static{this.ID=Ult}constructor(){super({id:a.ID,title:P(6928,"Show Agent Quick Access"),f1:!0,precondition:C.and(Z.enabled,C.has("config.chat.unifiedAgentsBar.enabled"))})}run(i,e){let t=i.get(F);S4t(t).show(e)}},tWi=class a extends z{static{this.ID="workbench.action.showAgentSessionsQuickAccess"}constructor(){super({id:a.ID,title:P(6929,"Show Agent Sessions"),f1:!0,precondition:C.and(Z.enabled,C.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);S4t(e).show("agentSessions")}},iWi=class a extends z{static{this.ID="workbench.action.showCommandsQuickAccess"}constructor(){super({id:a.ID,title:P(6930,"Show Commands (Unified)"),f1:!0,precondition:C.and(Z.enabled,C.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);S4t(e).show("commands")}},oWi=class a extends z{static{this.ID="workbench.action.showFilesQuickAccess"}constructor(){super({id:a.ID,title:P(6931,"Show Files (Unified)"),f1:!0,precondition:C.and(Z.enabled,C.has("config.chat.unifiedAgentsBar.enabled"))})}run(i){let e=i.get(F);S4t(e).show("files")}};W(eWi);W(tWi);W(iWi);W(oWi);var fSn="workbench.action.chat.toggle",YBe="workbench.action.quickOpenWithModes",XRo="agentSessions.filterExcludes.agentsessionsviewerfiltersubmenu",nWi="agentSessions.filterExcludes.previousUserFilter";function vSn(a){let i=a.getValue("chat.disableAIFeatures")===!0,e=a.getValue("disableAICustomizations")===!0||a.getValue("workbench.disableAICustomizations")===!0;return i&&e}function JRo(a){if(vSn(a))return"hidden";let i=a.getValue("chat.agentsControl.enabled");return i===!1||i==="hidden"?"hidden":i==="badge"?"badge":"compact"}var zlt=class extends Ja{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super(void 0,e,o);this._windowTitle=t;this.instantiationService=n;this.agentTitleBarStatusService=r;this.hoverService=s;this.commandService=l;this.keybindingService=c;this.agentSessionsService=u;this.workspaceContextService=p;this.editorGroupsService=h;this.editorService=g;this.menuService=f;this.contextKeyService=v;this.storageService=b;this.configurationService=S;this.chatEntitlementService=y;this.chatWidgetService=w;this.telemetryService=x;this._dynamicDisposables=this._register(new O);this._isRendering=!1;this._rovingElements=[];this._rovingIndex=0;this._badgeFilterAppliedByThisWindow=null;this._commandCenterMenu=this._register(this.menuService.createMenu(R.CommandCenterCenter,this.contextKeyService)),this._chatTitleBarMenu=this._register(this.menuService.createMenu(R.ChatTitleBarMenu,this.contextKeyService)),this._register(this.agentTitleBarStatusService.onDidChangeMode(()=>{this._render()})),this._register(this.agentTitleBarStatusService.onDidChangeSessionInfo(()=>{this._render()})),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>{this._render()})),this._register(this._windowTitle.onDidChange(()=>{this._render()})),this._register(this.editorService.onDidActiveEditorChange(()=>{this._render()})),this._register(this.editorGroupsService.onDidChangeEditorPartOptions(({newPartOptions:E,oldPartOptions:M})=>{E.showTabs!==M.showTabs&&this._render()})),this._register(this._commandCenterMenu.onDidChange(()=>{this._lastRenderState=void 0,this._render()})),this._register(this.storageService.onDidChangeValue(0,"agentSessions.filterExcludes.agentsessionsviewerfiltersubmenu",this._store)(()=>{this._render()})),this._register(this.configurationService.onDidChangeConfiguration(E=>{(E.affectsConfiguration("chat.agentsControl.enabled")||E.affectsConfiguration("chat.unifiedAgentsBar.enabled")||E.affectsConfiguration("chat.viewSessions.enabled")||E.affectsConfiguration("chat.disableAIFeatures")||E.affectsConfiguration("disableAICustomizations")||E.affectsConfiguration("workbench.disableAICustomizations"))&&(this._lastRenderState=void 0,this._render())})),this._register(U.any(this.chatEntitlementService.onDidChangeSentiment,this.chatEntitlementService.onDidChangeQuotaExceeded,this.chatEntitlementService.onDidChangeEntitlement,this.chatEntitlementService.onDidChangeAnonymous)(()=>{this._lastRenderState=void 0,this._render()})),this._register(this.chatWidgetService.onDidAddWidget(()=>{this._render()})),this._register(this.chatWidgetService.onDidBackgroundSession(()=>{this._render()}))}render(e){super.render(e),this._container=e,e.classList.add("agent-status-container"),e.setAttribute("role","toolbar"),e.setAttribute("aria-label",d(6888,null)),e.tabIndex=-1,this._render()}setFocusable(e){}focus(){this._rovingElements[this._rovingIndex]?.focus()}blur(){if(!this._container)return;let e=Me(this._container).document.activeElement;go(e)&&this._container.contains(e)&&e.blur()}_render(){if(this._container&&!this._isRendering){this._isRendering=!0;try{let e=this.agentTitleBarStatusService.mode,t=this.agentTitleBarStatusService.sessionInfo,{activeSessions:o,unreadSessions:n,attentionNeededSessions:r}=this._getSessionStats(),s=r.length>0?[...r].sort((S,y)=>{let w=S.timing.lastRequestStarted??S.timing.created;return(y.timing.lastRequestStarted??y.timing.created)-w})[0]:void 0,l=s?.description?typeof s.description=="string"?s.description:ma(s.description):s?.label,c=this._getLabel(),{isFilteredToUnread:u,isFilteredToInProgress:p,isFilteredToNeedsInput:h}=this._getCurrentFilterState(),g=JRo(this.configurationService),f=this.configurationService.getValue("chat.unifiedAgentsBar.enabled")===!0,v=this.configurationService.getValue("chat.viewSessions.enabled")!==!1,b=JSON.stringify({mode:e,sessionTitle:t?.title,activeCount:o.length,unreadCount:n.length,attentionCount:r.length,attentionText:l,label:c,isFilteredToUnread:u,isFilteredToInProgress:p,isFilteredToNeedsInput:h,statusMode:g,unifiedAgentsBarEnabled:f,viewSessionsEnabled:v});if(this._lastRenderState===b)return;this._lastRenderState=b,Ii(this._container),this._dynamicDisposables.clear(),this._rovingElements=[],this.agentTitleBarStatusService.mode==="session"?this._renderSessionMode(this._dynamicDisposables):this.agentTitleBarStatusService.mode==="sessionReady"?this._renderSessionReadyMode(this._dynamicDisposables):g==="compact"?this._renderChatInputMode(this._dynamicDisposables):g==="badge"&&this._renderStatusBadge(this._dynamicDisposables,o,n,r),this._setupRovingTabIndex(this._dynamicDisposables)}finally{this._isRendering=!1}}}_setupRovingTabIndex(e){if(!(!this._container||this._rovingElements.length===0)){this._rovingIndex>=this._rovingElements.length&&(this._rovingIndex=0);for(let t=0;t<this._rovingElements.length;t++)this._rovingElements[t].tabIndex=t===this._rovingIndex?0:-1;e.add($(this._container,ne.KEY_DOWN,t=>{let o=this._rovingElements.findIndex(r=>r===t.target||r.contains(t.target));if(o===-1)return;let n=this._getNextRovingIndex(o,t.key);n!==void 0&&n!==o&&(t.preventDefault(),t.stopPropagation(),this._moveRovingFocus(o,n))}))}}_moveRovingFocus(e,t){this._rovingElements[e].tabIndex=-1,this._rovingElements[t].tabIndex=0,this._rovingElements[t].focus(),this._rovingIndex=t}_getNextRovingIndex(e,t){let o=this._rovingElements.length;switch(t){case"ArrowRight":return(e+1)%o;case"ArrowLeft":return(e-1+o)%o;case"Home":return 0;case"End":return o-1;default:return}}_getSessionStats(){let e=this.agentSessionsService.model.sessions,o=this._getStoredFilter()?.providers??[],n=o.length>0?e.filter(c=>!o.includes(c.providerType)):e,r=n.filter(c=>Rx(c.status)&&!c.isArchived()),s=n.filter(c=>!c.isRead()),l=n.filter(c=>c.status===3&&!this.chatWidgetService.getWidgetBySessionResource(c.resource));return{activeSessions:r,unreadSessions:s,attentionNeededSessions:l,hasActiveSessions:r.length>0,hasUnreadSessions:s.length>0,hasAttentionNeeded:l.length>0}}_renderChatInputMode(e){if(!this._container)return;let{activeSessions:t,unreadSessions:o,attentionNeededSessions:n,hasAttentionNeeded:r}=this._getSessionStats(),s=_("div.agent-status-pill.chat-input-mode");r&&s.classList.add("needs-attention"),this._container.appendChild(s),this._renderCommandCenterToolbar(e,s);let l=!0;s.classList.toggle("compact-mode",l);let c=_("span.agent-status-left-icon");if(r){let b=un(L.report),S=_("span.agent-status-attention-count");S.textContent=String(n.length),Ii(c,b,S),c.classList.add("has-attention")}else Ii(c,un(L.searchSparkle));l||s.appendChild(c);let u=_("div.agent-status-input-area");u.setAttribute("role","button"),u.setAttribute("aria-label",d(6902,null)),u.tabIndex=0,this._rovingElements.push(u),s.appendChild(u);let p=_("span.agent-status-label"),{progress:h}=this._getSessionNeedingAttention(n),g=l?this._getLabel():h??this._getLabel();!l&&h&&p.classList.add("has-progress");let f=d(6890,null);if(p.textContent=g,u.appendChild(p),l)e.add($(u,ne.MOUSE_ENTER,()=>{Ii(c,un(L.searchSparkle)),c.classList.remove("has-attention"),p.classList.remove("has-progress")})),e.add($(u,ne.MOUSE_LEAVE,()=>{Ii(c,un(L.searchSparkle))}));else{let b=_("span.agent-status-send");Ii(b,un(L.send)),b.classList.add("hidden"),u.appendChild(b),h||(e.add($(u,ne.MOUSE_ENTER,()=>{Ii(c,un(L.searchSparkle)),c.classList.remove("has-attention"),p.textContent=f,p.classList.remove("has-progress"),b.classList.remove("hidden")})),e.add($(u,ne.MOUSE_LEAVE,()=>{Ii(c,un(L.searchSparkle)),p.textContent=g,b.classList.add("hidden")})))}let v=yi("mouse");e.add(this.hoverService.setupManagedHover(v,u,()=>{let b=this.keybindingService.lookupKeybinding(Ult)?.getLabel();return b?d(6891,null,b):d(6892,null)})),e.add($(u,ne.CLICK,b=>{b.preventDefault(),b.stopPropagation(),this.telemetryService.publicLog2("agentStatusWidget.click",{source:"pill",action:"quickAccess"});let S=this.configurationService.getValue("chat.unifiedAgentsBar.enabled")===!0;this.commandService.executeCommand(S?Ult:YBe)})),e.add($(u,ne.KEY_DOWN,b=>{if(b.key==="Enter"||b.key===" "){b.preventDefault(),b.stopPropagation(),this.telemetryService.publicLog2("agentStatusWidget.click",{source:"pill",action:"quickAccess"});let S=this.configurationService.getValue("chat.unifiedAgentsBar.enabled")===!0;this.commandService.executeCommand(S?Ult:YBe)}})),this._renderStatusBadge(e,t,o,n,s)}_renderSessionMode(e){if(!this._container)return;let{activeSessions:t,unreadSessions:o,attentionNeededSessions:n}=this._getSessionStats();this._renderCommandCenterToolbar(e);let r=_("div.agent-status-pill.session-mode");this._container.appendChild(r),this._renderSearchButton(e,r);let s=_("span.agent-status-title"),l=this.agentTitleBarStatusService.sessionInfo;s.textContent=l?.title??d(6882,null),r.appendChild(s),this._renderEscapeButton(e,r);let c=yi("mouse");e.add(this.hoverService.setupManagedHover(c,r,()=>{let p=this.agentTitleBarStatusService.sessionInfo;return p?d(6883,null,p.title):d(6882,null)}));let u=p=>{p.preventDefault(),p.stopPropagation(),this.commandService.executeCommand(J6.ID)};e.add($(r,ne.CLICK,u)),e.add($(r,ne.MOUSE_DOWN,u)),this._renderStatusBadge(e,t,o,n)}_renderSessionReadyMode(e){if(!this._container)return;let{activeSessions:t,unreadSessions:o,attentionNeededSessions:n}=this._getSessionStats(),r=_("div.agent-status-pill.session-ready-mode");this._container.appendChild(r);let s=_("span.agent-status-title"),l=this.agentTitleBarStatusService.sessionInfo;s.textContent=l?.title??d(6884,null),r.appendChild(s),this._renderEnterButton(e,r);let c=yi("mouse");e.add(this.hoverService.setupManagedHover(c,r,()=>{let p=this.agentTitleBarStatusService.sessionInfo;return p?d(6886,null,p.title):d(6885,null)}));let u=p=>{p.preventDefault(),p.stopPropagation();let h=this.agentTitleBarStatusService.sessionInfo;if(h){let g=this.agentSessionsService.getSession(h.sessionResource);g&&this.commandService.executeCommand(ere.ID,g)}};e.add($(r,ne.CLICK,u)),e.add($(r,ne.MOUSE_DOWN,u)),this._renderStatusBadge(e,t,o,n)}_renderCommandCenterToolbar(e,t){let o=t??this._container;if(!o)return;let n=[];for(let[,c]of this._commandCenterMenu.getActions({shouldForwardArgs:!0}))for(let u of c)u.id!==YBe&&(u instanceof sa?n.push(...u.actions):n.push(u));if(n.length===0)return;let r=yi("mouse"),s=_("div.agent-status-command-center-toolbar");o.appendChild(s);let l=this.instantiationService.createInstance(dl,s,{hiddenItemStrategy:-1,telemetrySource:"agentStatusCommandCenter",actionViewItemProvider:(c,u)=>ta(this.instantiationService,c,{...u,hoverDelegate:r})});if(e.add(l),l.setActions(n),t){let c=_("span.agent-status-line-separator");o.appendChild(c)}else{let c=un(L.circleSmallFilled);c.classList.add("agent-status-separator"),o.appendChild(c)}}_renderSearchButton(e,t){let o=t??this._container;if(!o)return;let n=_("span.agent-status-search");Ii(n,un(L.searchSparkle)),n.setAttribute("role","button"),n.setAttribute("aria-label",d(6903,null)),n.tabIndex=0,this._rovingElements.push(n),o.appendChild(n);let r=yi("mouse"),s=this.keybindingService.lookupKeybinding(YBe)?.getLabel(),l=s?d(6904,null,s):d(6905,null);e.add(this.hoverService.setupManagedHover(r,n,l)),e.add($(n,ne.CLICK,c=>{c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(YBe)})),e.add($(n,ne.KEY_DOWN,c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),this.commandService.executeCommand(YBe))}))}_renderStatusBadge(e,t,o,n,r){if(!this._container)return;let s=t.length>0,l=o.length>0,c=n.length>0;this._clearFilterIfCategoryEmpty(l,s,c);let u;r?u=r:(u=_("div.agent-status-badge"),this._container.appendChild(u));let p=_("span.agent-status-badge-section.sparkle");p.tabIndex=0;let h=oi.join(...this._chatTitleBarMenu.getActions({shouldForwardArgs:!0}).map(([,K])=>K)),g=fSn,f=d(6907,null),v=L.chatSparkle,b=this.instantiationService.createInstance(Do,{id:g,title:f,icon:v},void 0,void 0,void 0,void 0),S=li({id:"agentStatus.sparkle.dropdown",label:d(6887,null),run(){}}),y=this.instantiationService.createInstance(BC,b,S,h,"agent-status-sparkle-dropdown",{skipTelemetry:!0});y.render(p),e.add(y),e.add($(p,ne.KEY_DOWN,K=>{if(K.key==="ArrowLeft"||K.key==="ArrowRight"||K.key==="Home"||K.key==="End"){let j=this._rovingElements.indexOf(p);if(j===-1)return;let J=this._getNextRovingIndex(j,K.key);J!==void 0&&J!==j&&(K.preventDefault(),K.stopImmediatePropagation(),this._moveRovingFocus(j,J))}},!0)),e.add($(p,ne.KEY_DOWN,K=>{K.key==="Enter"||K.key===" "?(K.preventDefault(),K.stopPropagation(),this.commandService.executeCommand(g)):(K.key==="ArrowDown"||K.key==="ArrowUp")&&(K.preventDefault(),K.stopPropagation(),y.showDropdown())}));let w=yi("mouse"),x=this.configurationService.getValue("chat.viewSessions.enabled")!==!1,E=!!r;E||u.appendChild(p);let M,N,V;if(x&&l&&this.workspaceContextService.getWorkbenchState()!==1){let{isFilteredToUnread:K}=this._getCurrentFilterState();M=_("span.agent-status-badge-section.unread"),K&&M.classList.add("filtered"),M.setAttribute("role","button"),M.tabIndex=0;let j=_("span.agent-status-icon");Ii(j,un(L.circleFilled)),M.appendChild(j);let J=_("span.agent-status-text");J.textContent=String(o.length),M.appendChild(J),e.add($(M,ne.CLICK,ae=>{ae.preventDefault(),ae.stopPropagation(),this._openSessionsWithFilter("unread")})),e.add($(M,ne.KEY_DOWN,ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),ae.stopPropagation(),this._openSessionsWithFilter("unread"))}));let se=o.length===1?d(6909,null,o.length):d(6908,null,o.length);e.add(this.hoverService.setupManagedHover(w,M,se))}if(x&&c){let{isFilteredToNeedsInput:K}=this._getCurrentFilterState();V=_("span.agent-status-badge-section.active.needs-input"),K&&V.classList.add("filtered"),V.setAttribute("role","button"),V.tabIndex=0;let j=_("span.agent-status-icon");Ii(j,un(L.report)),V.appendChild(j);let J=_("span.agent-status-text");J.textContent=String(n.length),V.appendChild(J),e.add($(V,ne.CLICK,ae=>{ae.preventDefault(),ae.stopPropagation(),this._openSessionsWithFilter("needsInput")})),e.add($(V,ne.KEY_DOWN,ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),ae.stopPropagation(),this._openSessionsWithFilter("needsInput"))}));let se=n.length===1?d(6901,null,n.length):d(6900,null,n.length);e.add(this.hoverService.setupManagedHover(w,V,se))}let H=t.filter(K=>K.status!==3);if(x&&H.length>0){let{isFilteredToInProgress:K}=this._getCurrentFilterState();N=_("span.agent-status-badge-section.active"),K&&N.classList.add("filtered"),N.setAttribute("role","button"),N.tabIndex=0;let j=_("span.agent-status-icon");Ii(j,un(L.sessionInProgress)),N.appendChild(j);let J=_("span.agent-status-text");J.textContent=String(H.length),N.appendChild(J),e.add($(N,ne.CLICK,ae=>{ae.preventDefault(),ae.stopPropagation(),this._openSessionsWithFilter("inProgress")})),e.add($(N,ne.KEY_DOWN,ae=>{(ae.key==="Enter"||ae.key===" ")&&(ae.preventDefault(),ae.stopPropagation(),this._openSessionsWithFilter("inProgress"))}));let se=H.length===1?d(6881,null,H.length):d(6880,null,H.length);e.add(this.hoverService.setupManagedHover(w,N,se))}E?(V&&(u.appendChild(V),this._rovingElements.push(V)),N&&(u.appendChild(N),this._rovingElements.push(N)),M&&(u.appendChild(M),this._rovingElements.push(M)),u.appendChild(p),this._rovingElements.push(p)):(this._rovingElements.push(p),M&&(u.appendChild(M),this._rovingElements.push(M)),N&&(u.appendChild(N),this._rovingElements.push(N)),V&&(u.appendChild(V),this._rovingElements.push(V)))}_clearFilterIfCategoryEmpty(e,t,o){this._badgeFilterAppliedByThisWindow==="unread"&&!e?this._restoreUserFilter():this._badgeFilterAppliedByThisWindow==="inProgress"&&!t?this._restoreUserFilter():this._badgeFilterAppliedByThisWindow==="needsInput"&&!o&&this._restoreUserFilter()}_getCurrentFilterState(){let e=this._getStoredFilter();if(!e)return{isFilteredToUnread:!1,isFilteredToInProgress:!1,isFilteredToNeedsInput:!1};let t=e.read===!0&&e.states.length===0,o=e.states?.length===3&&e.states.includes(3)&&e.read===!1,n=e.states?.length===3&&e.states.includes(2)&&e.read===!1;return{isFilteredToUnread:t,isFilteredToInProgress:o,isFilteredToNeedsInput:n}}_getStoredFilter(){let e=this.storageService.get(XRo,0);if(e)try{return JSON.parse(e)}catch{return}}_storeFilter(e){this.storageService.store(XRo,JSON.stringify(e),0,0)}_clearFilter(){this._storeFilter({providers:[],states:[],archived:!0,read:!1})}_saveUserFilter(){let{isFilteredToUnread:e,isFilteredToInProgress:t,isFilteredToNeedsInput:o}=this._getCurrentFilterState();if(e||t||o)return;let n=this._getStoredFilter();n&&this.storageService.store(nWi,JSON.stringify(n),0,0)}_restoreUserFilter(){let e=this.storageService.get(nWi,0);if(e)try{let t=JSON.parse(e);this._storeFilter(t)}catch{this._clearFilter()}else this._clearFilter();this.storageService.remove(nWi,0),this._badgeFilterAppliedByThisWindow=null}_openSessionsWithFilter(e){let{isFilteredToUnread:t,isFilteredToInProgress:o,isFilteredToNeedsInput:n}=this._getCurrentFilterState(),s=this._getStoredFilter()?.providers??[],l=e==="unread"&&t||e==="inProgress"&&o||e==="needsInput"&&n;this.telemetryService.publicLog2("agentStatusWidget.click",{source:e,action:l?"clearFilter":"applyFilter"}),l?this._restoreUserFilter():(this._saveUserFilter(),e==="unread"?this._storeFilter({providers:s,states:[],archived:!0,read:!0}):e==="inProgress"?this._storeFilter({providers:s,states:[1,0,3],archived:!0,read:!1}):this._storeFilter({providers:s,states:[1,0,2],archived:!0,read:!1}),this._badgeFilterAppliedByThisWindow=e),this.commandService.executeCommand(qne.id)}_renderEscapeButton(e,t){let o=_("span.agent-status-esc-button");o.textContent="Esc",o.setAttribute("role","button"),o.setAttribute("aria-label",d(6896,null)),o.tabIndex=0,this._rovingElements.push(o),t.appendChild(o);let n=yi("mouse");e.add(this.hoverService.setupManagedHover(n,o,d(6897,null))),e.add($(o,ne.MOUSE_DOWN,r=>{r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(J6.ID)})),e.add($(o,ne.CLICK,r=>{r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(J6.ID)})),e.add($(o,ne.KEY_DOWN,r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),r.stopPropagation(),this.commandService.executeCommand(J6.ID))}))}_renderEnterButton(e,t){let o=_("span.agent-status-enter-button"),n=this.keybindingService.lookupKeybinding(ere.ID);o.textContent=n?.getLabel()??d(6906,null),o.setAttribute("role","button"),o.setAttribute("aria-label",d(6893,null)),o.tabIndex=0,this._rovingElements.push(o),t.appendChild(o);let r=yi("mouse"),s=n?d(6894,null,n.getLabel()):d(6895,null);e.add(this.hoverService.setupManagedHover(r,o,s));let l=c=>{c.preventDefault(),c.stopPropagation();let u=this.agentTitleBarStatusService.sessionInfo;if(u){let p=this.agentSessionsService.getSession(u.sessionResource);p&&this.commandService.executeCommand(ere.ID,p)}};e.add($(o,ne.MOUSE_DOWN,l)),e.add($(o,ne.CLICK,l)),e.add($(o,ne.KEY_DOWN,c=>{(c.key==="Enter"||c.key===" ")&&l(c)}))}_getSessionNeedingAttention(e){if(e.length===0)return{session:void 0,progress:void 0};let o=[...e].sort((r,s)=>{let l=r.timing.lastRequestStarted??r.timing.created;return(s.timing.lastRequestStarted??s.timing.created)-l})[0];if(!o.description)return{session:o,progress:o.label};let n=typeof o.description=="string"?o.description:ma(o.description);return{session:o,progress:n}}_getLabel(){let{prefix:e,suffix:t}=this._windowTitle.getTitleDecorations(),o=this._windowTitle.workspaceName;return this._windowTitle.isCustomTitleFormat()?o=this._windowTitle.getWindowTitle():!o&&this.editorGroupsService.partOptions.showTabs==="none"&&(o=this._windowTitle.fileName??""),o||(o=d(6889,null)),e&&(o=d(6898,null,e,o)),t&&(o=d(6899,null,o,t)),o.replaceAll(/\r\n|\r|\n/g,"\u23CE")}};zlt=I([m(3,F),m(4,obe),m(5,ot),m(6,fe),m(7,Le),m(8,Vc),m(9,Ae),m(10,kt),m(11,ie),m(12,Yt),m(13,X),m(14,de),m(15,B),m(16,dr),m(17,Lt),m(18,_e)],zlt);var rbe=class extends k{static{this.ID="workbench.contrib.agentStatus.rendering"}constructor(i,e,t,o,n){super(),this._register(i.register(R.CommandCenter,R.AgentsTitleBarControlMenu,(c,u)=>{if(c instanceof id)return e.createInstance(zlt,c,n.windowTitle,u)},void 0));let s=!!o.getContextKeyValue("chatIsEnabled"),l=()=>{let c=t.getValue("window.commandCenter")===!0,u=JRo(t),p=c&&s&&u!=="hidden",h=p&&u==="compact";ut.document.body.classList.toggle("agent-status-enabled",p),ut.document.body.classList.toggle("unified-agents-bar",h)};l(),this._register(t.onDidChangeConfiguration(c=>{(c.affectsConfiguration("chat.agentsControl.enabled")||c.affectsConfiguration("window.commandCenter")||c.affectsConfiguration("chat.disableAIFeatures")||c.affectsConfiguration("disableAICustomizations")||c.affectsConfiguration("workbench.disableAICustomizations"))&&l()})),this._register(o.onDidChangeContext(c=>{c.affectsSome(new Set(["chatIsEnabled"]))&&(s=!!o.getContextKeyValue("chatIsEnabled"),l())}))}};rbe=I([m(0,sh),m(1,F),m(2,B),m(3,X),m(4,aP)],rbe);var XBe=class extends k{constructor(e,t,o,n,r,s){super();this.chatWidgetService=e;this.configurationService=t;this.agentTitleBarStatusService=o;this.agentSessionsService=n;this.agentSessionProjectionService=r;this.chatEditingService=s;this._widgetDisposables=this._register(new O);this._suppressSessionReady=!1;for(let l of this.chatWidgetService.getAllWidgets())l.location==="panel"&&this._watchWidget(l);this._register(this.chatWidgetService.onDidAddWidget(l=>{l.location==="panel"&&this._watchWidget(l)})),this._register(this.agentSessionProjectionService.onDidChangeProjectionMode(l=>{l||(this._suppressSessionReady=!0,this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode())})),this._register(ve(l=>{this.chatEditingService.editingSessionsObs.read(l);let c=this.chatWidgetService.getAllWidgets().find(u=>u.location==="panel");c&&this._checkSession(c.viewModel?.sessionResource)})),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>{let l=this.chatWidgetService.getAllWidgets().find(c=>c.location==="panel");l&&this._checkSession(l.viewModel?.sessionResource)}))}static{this.ID="chat.agentSessionReady"}_watchWidget(e){this._widgetDisposables.clear(),this._checkSession(e.viewModel?.sessionResource),this._widgetDisposables.add(e.onDidChangeViewModel(()=>{this._checkSession(e.viewModel?.sessionResource)}))}_checkSession(e){if(e?.toString()!==this._watchedSessionResource?.toString()&&(this._suppressSessionReady=!1),this.agentSessionProjectionService.isActive){let t=this.agentSessionProjectionService.activeSession;if(e&&t&&e.toString()!==t.resource.toString()){let o=this.agentSessionsService.getSession(e);o&&this.agentSessionProjectionService.enterProjection(o)}return}this._updateSessionReadyState(e)}_clearEntriesWatcher(){this._entriesWatcher?.dispose(),this._entriesWatcher=void 0,this._watchedSessionResource=void 0}_updateSessionReadyState(e){if(!this.configurationService.getValue("chat.agentSessionProjection.enabled")){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}if(this.agentSessionProjectionService.isActive){this._clearEntriesWatcher();return}if(!e){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}let o=this.agentSessionsService.getSession(e);if(!o){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}if(this.agentSessionsService.model.observeSession(e),!Y0i.has(o.providerType)){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}if(Rx(o.status)){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}let n=!1;if(o.providerType===zo.Local){let r=this.chatEditingService.getEditingSession(e);if(!r){this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode();return}n=r.entries.get().some(l=>l.state.get()===0),n&&!this._suppressSessionReady?(this.agentTitleBarStatusService.enterSessionReadyMode(o.resource,o.label),(!this._watchedSessionResource||this._watchedSessionResource.toString()!==e.toString())&&(this._clearEntriesWatcher(),this._watchedSessionResource=e,this._entriesWatcher=ve(l=>{r.entries.read(l).some(p=>p.state.read(l)===0)||this.agentTitleBarStatusService.exitSessionReadyMode()}))):(this._clearEntriesWatcher(),this.agentTitleBarStatusService.exitSessionReadyMode())}else this._clearEntriesWatcher(),n=(Array.isArray(o.changes)?o.changes.filter(s=>!!s.originalUri).length:0)>0,n&&!this._suppressSessionReady?this.agentTitleBarStatusService.enterSessionReadyMode(o.resource,o.label):this.agentTitleBarStatusService.exitSessionReadyMode()}};XBe=I([m(0,Lt),m(1,B),m(2,obe),m(3,Vc),m(4,jBe),m(5,mu)],XBe);W(ere);W(J6);W(b4t);Ce(jBe,$Be,1);Ce(obe,v4t,1);bt(rbe.ID,rbe,vt.AfterRestored);bt(XBe.ID,XBe,vt.AfterRestored);be.appendMenuItem(R.CommandCenter,{submenu:R.AgentsTitleBarControlMenu,title:d(6876,null),icon:L.chatSparkle,when:C.and(Z.enabled,C.notEquals("config.chat.agentsControl.enabled","hidden"),C.notEquals("config.chat.agentsControl.enabled",!1)),order:10002});be.appendMenuItem(R.TitleBar,{submenu:R.ChatTitleBarMenu,title:d(6878,null),group:"navigation",icon:L.chatSparkle,when:C.and(Z.supported,C.and(Z.Setup.hidden.negate()),C.has("config.window.commandCenter").negate()),order:1});be.appendMenuItem(R.AgentsTitleBarControlMenu,{command:{id:"workbench.action.chat.toggle",title:d(6877,null)},when:Z.enabled,group:"a_open",order:1});be.appendMenuItem(R.AgentsTitleBarControlMenu,{command:{id:"toggle.chat.unifiedAgentsBar.enabled",title:d(6879,null),toggled:C.has("config.chat.unifiedAgentsBar.enabled")},when:C.and(Z.enabled,D4.notEqualsTo("stable")),group:"z_experimental",order:10});var sbe=class extends k{constructor(e,t){super();this.chatService=e;this.chatSessionsService=t;this.chatSessionType=kl;this._onDidChangeChatSessionItems=this._register(new T);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._modelListeners=this._register(new bI);this._isDisposed=!1;this._items=new dt;this._register(this.chatSessionsService.registerChatSessionItemController(this.chatSessionType,this)),this.registerListeners()}static{this.ID="workbench.contrib.localAgentsSessionsController"}dispose(){this._isDisposed=!0,super.dispose()}get items(){return Array.from(this._items.values())}async refresh(e){let t=await this.provideChatSessionItems(e),o=new xn(t.map(s=>s.resource)),n=[],r=[];for(let s of t)this._items.has(s.resource)||n.push(s);for(let s of this._items.keys())o.has(s)||r.push(s);this._items.clear();for(let s of t)this._items.set(s.resource,s);(n.length>0||r.length>0)&&this._onDidChangeChatSessionItems.fire({...n.length>0?{addedOrUpdated:n}:void 0,...r.length>0?{removed:r}:void 0})}registerListeners(){let e=async t=>{if(yn(t.sessionResource)!==this.chatSessionType||(await this.refresh(Ie.None),this._isDisposed))return;this.tryUpdateLiveSessionItem(t);let o=t.lastRequestObs.map(r=>r?.response&&qr("chatSessions.modelRequestChangeListener",r.response.onDidChange)),n=qr("chatSessions.modelChangeListener",t.onDidChange);this._modelListeners.set(t.sessionResource,ve(r=>{o.read(r)?.read(r),n.read(r),this.tryUpdateLiveSessionItem(t)}))};this._register(this.chatService.onDidCreateModel(t=>e(t)));for(let t of this.chatService.chatModels.get())e(t);this._register(this.chatService.onDidDisposeSession(t=>{for(let n of t.sessionResources)this._modelListeners.deleteAndDispose(n);let o=t.sessionResources.filter(n=>yn(n)===this.chatSessionType);if(o.length){for(let n of o)this._items.delete(n);this._onDidChangeChatSessionItems.fire({removed:o})}}))}async tryUpdateLiveSessionItem(e){let t=this._items.get(e.sessionResource);if(!t)return;let o=new I4t(await GOi(e),e);t.isEqual(o)||(this._items.set(t.resource,o),this._onDidChangeChatSessionItems.fire({addedOrUpdated:[o]}))}async provideChatSessionItems(e){let t=[],o=new xn;for(let n of await this.chatService.getLiveSessionItems()){let r=this.toChatSessionItem(n);r&&(o.add(n.sessionResource),t.push(r))}if(!e.isCancellationRequested){let n=await this.getHistoryItems();t.push(...n.filter(r=>!o.has(r.resource)))}return t}async getHistoryItems(){try{let e=await this.chatService.getHistorySessionItems();return ui(e.map(t=>this.toChatSessionItem(t)))}catch{return[]}}toChatSessionItem(e){let t=this.chatService.getSession(e.sessionResource);if(t){if(!t.hasRequests)return}else if(e.isActive)return;return new I4t(e,t)}};sbe=I([m(0,si),m(1,Ms)],sbe);var I4t=class{constructor(i,e){this.iconPath=L.chatSparkle;this.resource=i.sessionResource,this.label=i.title,this.description=e?uWt(e):void 0,this.status=(e&&kWt(e))??eho(i.lastResponseState),this.timing=Lao(i.timing),this.changes=i.stats?{insertions:i.stats.added,deletions:i.stats.removed,files:i.stats.fileCount}:void 0;let t=i.workingDirectory?.scheme===Q.file?i.workingDirectory.fsPath:void 0;this.metadata=t?{workingDirectoryPath:t}:void 0}isEqual(i){return ze(this.resource,i.resource)&&this.label===i.label&&this.description===i.description&&this.status===i.status&&this.timing.created===i.timing.created&&this.timing.lastRequestStarted===i.timing.lastRequestStarted&&this.timing.lastRequestEnded===i.timing.lastRequestEnded&&Qi(this.changes,i.changes)}};var rWi="agent ",JBe=class extends cg{constructor(e,t,o){super(rWi,{canAcceptInBackground:!0,noResultsPick:{label:d(6837,null)}});this.agentSessionsService=e;this.instantiationService=t;this.commandService=o;this.sorter=new U6;this.filter=this._register(this.instantiationService.createInstance(EV,{}))}async _getPicks(e){let t=[],o=this.agentSessionsService.model.sessions.filter(r=>pFi(r,this.filter)).sort(this.sorter.compare.bind(this.sorter)),n=mlt(o);for(let r of n.values())if(r.sessions.length>0){t.push({type:"separator",label:r.label});for(let s of r.sessions){let l=xh(e,s.label,!0);l&&t.push(this.toPickItem(s,l))}}return t}toPickItem(e,t){let o=dFi(e),n=uFi(e);return{label:e.label,description:o,highlights:{label:t},iconClass:q.asClassName(e.icon),buttons:n,trigger:async r=>{switch(n[r]){case Njt:return await this.commandService.executeCommand(eDe,e),2;case Ojt:return await this.commandService.executeCommand(tDe,e),2;case lFi:case cFi:{let l=!e.isArchived();return e.setArchived(l),2}default:return 0}},accept:(r,s)=>{this.instantiationService.invokeFunction(gBe,e,{sideBySide:s.inBackground,editorOptions:{preserveFocus:s.inBackground,pinned:s.inBackground}})}}}};JBe=I([m(0,Vc),m(1,F),m(2,fe)],JBe);var ZRo="_agentHost.permission.allow",eLo="_agentHost.permission.allowAlways",tLo="_agentHost.permission.deny";Ge.registerCommand(ZRo,(a,i)=>{a.get(hQ).findPending(i)?.allow()});Ge.registerCommand(eLo,(a,i)=>{a.get(hQ).findPending(i)?.allowAlways()});Ge.registerCommand(tLo,(a,i)=>{a.get(hQ).findPending(i)?.deny()});var I$=class extends k{constructor(e,t,o){super();this._permissionService=e;this._chatInputNotificationService=t;this._labelService=o;this._register(ve(n=>{let r=this._permissionService.allPending.read(n);this._render(r)}))}static{this.ID="workbench.contrib.agentHostPermissionUi"}static{this.NOTIFICATION_ID="agentHost.permissionRequest"}_render(e){let t=e[0];if(!t){this._lastRequestId&&(this._chatInputNotificationService.deleteNotification(I$.NOTIFICATION_ID),this._lastRequestId=void 0);return}this._lastRequestId=t.id,this._chatInputNotificationService.setNotification(this._buildNotification(t,e.length))}_buildNotification(e,t){let o=Ru(this._resolveHostName(e.address)),n=e.uri.scheme===Q.file?e.uri.fsPath:e.uri.toString(),r="`".repeat((n.match(/`+/g)?.reduce((u,p)=>Math.max(u,p.length),0)??0)+1),s=`${r}${n}${r}`,l=new he(e.mode==="write"?d(6731,null,o,s):d(6730,null,o,s)),c=t>1?t===2?d(6729,null):d(6728,null,t-1):void 0;return{id:I$.NOTIFICATION_ID,severity:1,message:l,description:c,actions:[{label:d(6727,null),commandId:tLo,commandArgs:[e.id]},{label:d(6725,null),commandId:ZRo,commandArgs:[e.id]},{label:d(6726,null),commandId:eLo,commandArgs:[e.id]}],dismissible:!1,autoDismissOnMessage:!1}}_resolveHostName(e){let t=VM(e),o=this._labelService.getHostLabel(IC,t);return o&&o!==t?o:e}};I$=I([m(0,hQ),m(1,w8),m(2,nt)],I$);W(qne);W(Bjt);W(Hjt);W(Ujt);W(Kjt);W(Gjt);W(qjt);W($jt);W(Yjt);W(Xjt);W(Jjt);W(Zjt);W(e5t);W(t5t);W(i5t);W(jjt);W(Qjt);W(r5t);W(o5t);W(n5t);W(s5t);W(a5t);W(YR);W(p$);W(c5t);W(Fjt);W(Wjt);W(Vjt);be.appendMenuItem(R.AgentSessionsToolbar,{submenu:R.AgentSessionsViewerFilterSubMenu,title:P(6765,"Filter Agent Sessions"),group:"navigation",order:3,icon:L.filter});be.appendMenuItem(R.AgentSessionsToolbar,{command:{id:YR.ID,title:YR.TITLE,icon:L.layoutSidebarRightOff},group:"navigation",order:5,when:C.and(Z.agentSessionsViewerOrientation.isEqualTo(1),Z.agentSessionsViewerPosition.isEqualTo(2))});be.appendMenuItem(R.AgentSessionsToolbar,{command:{id:YR.ID,title:YR.TITLE,icon:L.layoutSidebarLeftOff},group:"navigation",order:5,when:C.and(Z.agentSessionsViewerOrientation.isEqualTo(1),Z.agentSessionsViewerPosition.isEqualTo(1))});be.appendMenuItem(R.AgentSessionsToolbar,{command:{id:p$.ID,title:p$.TITLE,icon:L.layoutSidebarRight},group:"navigation",order:5,when:C.and(Z.agentSessionsViewerOrientation.isEqualTo(2),Z.agentSessionsViewerPosition.isEqualTo(2))});be.appendMenuItem(R.AgentSessionsToolbar,{command:{id:p$.ID,title:p$.TITLE,icon:L.layoutSidebarLeft},group:"navigation",order:5,when:C.and(Z.agentSessionsViewerOrientation.isEqualTo(2),Z.agentSessionsViewerPosition.isEqualTo(1))});be.appendMenuItem(R.ChatViewSessionTitleToolbar,{command:{id:YR.ID,title:YR.TITLE,icon:L.layoutSidebarLeftOff},group:"navigation",order:1,when:C.and(C.or(Z.agentSessionsViewerVisible.negate(),Z.agentSessionsViewerOrientation.isEqualTo(1)),Z.agentSessionsViewerPosition.isEqualTo(1))});be.appendMenuItem(R.ChatViewSessionTitleToolbar,{command:{id:YR.ID,title:YR.TITLE,icon:L.layoutSidebarRightOff},group:"navigation",order:1,when:C.and(C.or(Z.agentSessionsViewerVisible.negate(),Z.agentSessionsViewerOrientation.isEqualTo(1)),Z.agentSessionsViewerPosition.isEqualTo(2))});oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:JBe,prefix:rWi,contextKey:"inAgentSessionsPicker",when:Z.enabled,placeholder:d(6764,null),helpEntries:[{description:d(6763,null),commandId:"workbench.action.chat.history"}]});bt(sbe.ID,sbe,vt.AfterRestored);bt(I$.ID,I$,vt.BlockRestore);Ce(Vc,qLe,1);var SSn=5e3,tre=class extends k{constructor(e,t,o){super();this._accessibilitySignalService=o;this._scheduler=this._register(new Dt(()=>{this._signalLoop=this._accessibilitySignalService.playSignalLoop(tn.progress,t??SSn)},e)),this._scheduler.schedule()}dispose(){super.dispose(),this._signalLoop?.dispose(),this._scheduler.dispose()}};tre=I([m(2,br)],tre);var wo=le("nativeHostService");var ISn=4e3,ZBe=class extends k{constructor(e,t,o,n,r,s){super();this._accessibilitySignalService=e;this._instantiationService=t;this._configurationService=o;this._hostService=n;this._widgetService=r;this._chatService=s;this._pendingSignalMap=this._register(new Ot);this.toasts=this._register(new Bye);this._register(this._widgetService.onDidBackgroundSession(l=>{let c=this._chatService.getSession(l);!c||!c.requestInProgress.get()||this.disposeRequest(l)}))}acceptRequest(e,t){t||this._accessibilitySignalService.playSignal(tn.chatRequestSent,{allowManyInParallel:!0}),this._pendingSignalMap.set(e,this._instantiationService.createInstance(tre,ISn,void 0))}disposeRequest(e){this._pendingSignalMap.deleteAndDispose(e)}acceptResponse(e,t,o,n,r){this._pendingSignalMap.deleteAndDispose(n);let s=typeof o!="string",l=typeof o=="string"?o:o?.response.toString();if(this._accessibilitySignalService.playSignal(tn.chatResponseReceived,{allowManyInParallel:!0}),!o||!l)return;let c=ma(new he(l)),u=s&&o.errorDetails?` ${o.errorDetails.message}`:"";this._showOSNotification(e,t,c+u),(!r||this._configurationService.getValue("accessibility.voice.autoSynthesize")!=="on")&&Er(c+u)}acceptElicitation(e){if(e.state.get()!=="pending")return;let t=typeof e.title=="string"?e.title:e.title.value,o=typeof e.message=="string"?e.message:e.message.value;cn(t+" "+o),this._accessibilitySignalService.playSignal(tn.chatUserActionRequired,{allowManyInParallel:!0})}async _showOSNotification(e,t,o){let n=this._configurationService.getValue("chat.notifyWindowOnResponseReceived");if(n==="off")return;let r=Me(t);if(!r)return;let s=r.document.hasFocus();if(n!=="always"&&s||!o||!o.trim())return;s||await this._hostService.focus(r,{mode:1}),this.toasts.clearAndDisposeAll();let l=e?.viewModel?.model.title?d(6293,null,e.viewModel.model.title):d(6292,null),c=new qe,u=ee(()=>c.dispose(!0));this.toasts.add(u);let{clicked:p}=await this._hostService.showToast({title:l,body:d(6294,null)},c.token);this.toasts.deleteAndDispose(u),p&&(await this._hostService.focus(r,{mode:2}),await this._widgetService.reveal(e),e.focusInput())}};ZBe=I([m(0,br),m(1,F),m(2,B),m(3,ti),m(4,Lt),m(5,si)],ZBe);var eHe=class extends k{constructor(e,t,o){super();this.modelService=t;this.languageService=o;this._register(e.registerTextModelContentProvider(Q.vscodeChatInput,this))}async provideTextContent(e){let t=this.modelService.getModel(e);return t||this.modelService.createModel("",this.languageService.createById("chatinput"),e)}};eHe=I([m(0,Bt),m(1,_t),m(2,Rt)],eHe);var abe=class{constructor(i,e,t){this._store=new O;let o=vi(this,e.onDidActiveEditorChange,()=>e.activeEditorPane?.input.resource);this._store.add(ve(n=>{let r=o.read(n);if(!r)return;i.editingSessionsObs.read(n).find(l=>l.readEntry(r,n))&&t.playSignal(tn.chatEditModifiedFile)}))}static{this.ID="chat.edits.accessibilty"}dispose(){this._store.dispose()}};abe=I([m(0,mu),m(1,ie),m(2,br)],abe);var _f=class extends Y0{constructor(e,t,o,n,r,s,l,c,u){super(_f.ID,e,"multiDiffEditor",o,t,r,c,n,s,l);this.editorProgressService=u;this._multiDiffEditorWidget=void 0}static{this.ID="multiDiffEditor"}get viewModel(){return this._viewModel}createEditor(e){this._multiDiffEditorWidget=this._register(this.instantiationService.createInstance(Vne,e,this.instantiationService.createInstance(Klt))),this._register(this._multiDiffEditorWidget.onDidChangeActiveControl(()=>{this._onDidChangeControl.fire()})),this._contentOverlay=this._register(new sWi(this._multiDiffEditorWidget.getRootElement(),this._multiDiffEditorWidget.getContextKeyService(),this._multiDiffEditorWidget.getScopedInstantiationService()))}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this._viewModel=await e.getViewModel(),this._contentOverlay?.updateResource(e.resource),this._multiDiffEditorWidget.setViewModel(this._viewModel);let r=this.loadEditorViewState(e,o);r&&this._multiDiffEditorWidget.setViewState(r),this._applyOptions(t)}setOptions(e){this._applyOptions(e)}_applyOptions(e){let t=e?.viewState;!t||!t.revealData||this._multiDiffEditorWidget?.reveal(t.revealData.resource,{range:t.revealData.range?G.lift(t.revealData.range):void 0,highlight:!0})}async clearInput(){await super.clearInput(),this._contentOverlay?.updateResource(void 0),this._multiDiffEditorWidget.setViewModel(void 0)}layout(e){this._multiDiffEditorWidget.layout(e)}getControl(){return this._multiDiffEditorWidget.getActiveControl()}focus(){super.focus(),this._multiDiffEditorWidget?.getActiveControl()?.focus()}hasFocus(){return this._multiDiffEditorWidget?.getActiveControl()?.hasTextFocus()||super.hasFocus()}computeEditorViewState(e){return this._multiDiffEditorWidget.getViewState()}tracksEditorViewState(e){return e instanceof Ou}toEditorViewStateResource(e){return e.resource}tryGetCodeEditor(e){return this._multiDiffEditorWidget.tryGetCodeEditor(e)}findDocumentDiffItem(e){let t=this._multiDiffEditorWidget.findDocumentDiffItem(e);return t?t.multiDiffEditorItem:void 0}goToNextChange(){this._multiDiffEditorWidget?.goToNextChange()}goToPreviousChange(){this._multiDiffEditorWidget?.goToPreviousChange()}async showWhile(e){return this.editorProgressService.showWhile(e)}};_f=I([m(1,F),m(2,_e),m(3,Pe),m(4,de),m(5,ie),m(6,kt),m(7,Gn),m(8,Hd)],_f);var sWi=class extends k{constructor(e,t,o){super();this.resourceObs=De(this,void 0);let n=o.createInstance(jue,R.MultiDiffEditorContent,t,this.resourceObs);n.element.classList.add("multi-diff-root-floating-menu"),this._register(n);let r=ke(s=>{let l=this.resourceObs.read(s),c=n.hasActions.read(s);return l!==void 0&&c});this._register(ve(s=>{r.read(s)&&(e.appendChild(n.element),s.store.add(ee(()=>{n.element.remove()})))}))}updateResource(e){this.resourceObs.set(e,void 0)}},Klt=class{constructor(i,e){this._instantiationService=i;this.headerClickToCollapse=qo.getValue(e)===!0}createResourceLabel(i){let e=this._instantiationService.createInstance(CE,i,{});return{setUri(t,o={}){t?e.element.setFile(t,{strikethrough:o.strikethrough}):e.element.clear()},dispose(){e.dispose()}}}};Klt=I([m(0,F),m(1,X)],Klt);function ySn(a,i){let e=[],t=[];for(let o=a.original.startLineNumber;o<a.original.endLineNumberExclusive;o++){let n=i.originalModel.getLineContent(o);e.push(n)}for(let o=a.modified.startLineNumber;o<a.modified.endLineNumberExclusive;o++){let n=i.modifiedModel.getLineContent(o);t.push(n)}return{originalText:e.join(`
`),modifiedText:t.join(`
`)}}function wSn(a,i=5){if(a.length===0)return[];let e=[],t=[a[0]];for(let o=1;o<a.length;o++){let n=t[0],r=a[o],s=n.modified.startLineNumber;r.modified.startLineNumber-s<=i?t.push(r):(e.push(t),t=[r])}return t.length>0&&e.push(t),e}var aWi=class a extends k{constructor(e,t,o,n,r,s){super();this._editor=e;this._changes=t;this._chatWidgetService=n;this._viewsService=r;this._chatSessionResource=s;this._id=`chat-explanation-widget-${a._idPool++}`;this._explanationItems=new Map;this._position=null;this._explanations=[];this._isExpanded=!0;this._isAllRead=!1;this._disposed=!1;this._startLineNumber=1;this._eventStore=this._register(new O);this._uri=o.modifiedModel.uri,this._rangeHighlightDecoration=this._editor.createDecorationsCollection(),this._explanations=this._changes.map(c=>{let{originalText:u,modifiedText:p}=ySn(c,o);return{startLineNumber:c.modified.startLineNumber,endLineNumber:c.modified.endLineNumberExclusive-1,explanation:d(7984,null),read:!1,loading:!0,originalText:u,modifiedText:p}}),this._domNode=_("div.chat-explanation-widget"),this._headerNode=_("div.chat-explanation-header"),this._readIndicator=_("div.chat-explanation-read-indicator"),this._updateReadIndicator(),this._headerNode.appendChild(this._readIndicator),this._titleNode=_("span.chat-explanation-title"),this._updateTitle(),this._headerNode.appendChild(this._titleNode),this._headerNode.appendChild(_("span.chat-explanation-spacer")),this._toggleButton=_("div.chat-explanation-toggle"),this._updateToggleButton(),this._headerNode.appendChild(this._toggleButton),this._dismissButton=_("div.chat-explanation-dismiss"),this._dismissButton.appendChild(un(L.close)),this._dismissButton.title=d(7981,null),this._headerNode.appendChild(this._dismissButton),this._domNode.appendChild(this._headerNode),this._bodyNode=_("div.chat-explanation-body"),this._buildExplanationItems(),this._domNode.appendChild(this._bodyNode);let l=_("div.chat-explanation-arrow");this._domNode.appendChild(l),this._setupEventHandlers(),this._domNode.classList.add("visible"),this._editor.addOverlayWidget(this)}static{this._idPool=0}_setupEventHandlers(){this._eventStore.add($(this._readIndicator,"click",e=>{e.stopPropagation(),this._isAllRead=!this._isAllRead;for(let t of this._explanations)t.read=this._isAllRead;this._updateReadIndicator(),this._updateExplanationItemsReadState()})),this._eventStore.add($(this._toggleButton,"click",e=>{e.stopPropagation(),this._toggleExpanded()})),this._eventStore.add($(this._headerNode,"click",()=>{this._toggleExpanded()})),this._eventStore.add($(this._dismissButton,"click",e=>{e.stopPropagation(),this._dismiss()}))}_toggleExpanded(){this._isExpanded=!this._isExpanded,this._bodyNode.classList.toggle("collapsed",!this._isExpanded),this._updateToggleButton(),this._editor.layoutOverlayWidget(this)}_dismiss(){this._domNode.classList.add("fadeOut");let e=()=>{this.dispose()},t=setTimeout(e,150);this._domNode.addEventListener("animationend",()=>{clearTimeout(t),e()},{once:!0})}_updateReadIndicator(){St(this._readIndicator);let e=this._explanations.every(o=>o.read),t=this._explanations.some(o=>o.read);this._isAllRead=e,e?(this._readIndicator.appendChild(un(L.circle)),this._readIndicator.classList.add("read"),this._readIndicator.classList.remove("partial","unread"),this._readIndicator.title=d(7989,null)):t?(this._readIndicator.appendChild(un(L.circleFilled)),this._readIndicator.classList.remove("read","unread"),this._readIndicator.classList.add("partial"),this._readIndicator.title=d(7987,null)):(this._readIndicator.appendChild(un(L.circleFilled)),this._readIndicator.classList.remove("read","partial"),this._readIndicator.classList.add("unread"),this._readIndicator.title=d(7988,null))}_updateTitle(){let e=this._explanations.length;e===1?this._titleNode.textContent=d(7991,null):this._titleNode.textContent=d(7990,null,e)}_updateToggleButton(){St(this._toggleButton),this._isExpanded?(this._toggleButton.appendChild(un(L.chevronUp)),this._toggleButton.title=d(7980,null)):(this._toggleButton.appendChild(un(L.chevronDown)),this._toggleButton.title=d(7982,null))}_buildExplanationItems(){St(this._bodyNode),this._explanationItems.clear();for(let e=0;e<this._explanations.length;e++){let t=this._explanations[e],o=_("div.chat-explanation-item"),n=_("span.chat-explanation-line-info");t.startLineNumber===t.endLineNumber?n.textContent=d(7985,null,t.startLineNumber):n.textContent=d(7986,null,t.startLineNumber,t.endLineNumber),o.appendChild(n);let r=_("span.chat-explanation-text");if(t.loading){let c=un(q.modify(L.loading,"spin"));c.classList.add("chat-explanation-loading"),r.appendChild(c);let u=document.createTextNode(" "+t.explanation);r.appendChild(u)}else r.textContent=t.explanation;o.appendChild(r);let s=_("div.chat-explanation-item-read");this._updateItemReadIndicator(s,t.read),o.appendChild(s);let l=_("div.chat-explanation-reply-button");l.appendChild(un(L.arrowRight)),l.title=d(7983,null),o.appendChild(l),this._eventStore.add($(l,"click",async c=>{c.stopPropagation();let u=new G(t.startLineNumber,1,t.endLineNumber,1),p;this._chatSessionResource?p=await this._chatWidgetService.openSession(this._chatSessionResource):(await this._viewsService.openView(Xr,!0),p=this._chatWidgetService.lastFocusedWidget),p&&p.attachmentModel.addContext(p.attachmentModel.asFileVariableEntry(this._uri,u))})),this._eventStore.add($(o,"click",c=>{c.stopPropagation(),t.read=!t.read,this._updateItemReadIndicator(s,t.read),this._updateReadIndicator()})),this._eventStore.add($(o,"mouseenter",()=>{let c=new G(t.startLineNumber,1,t.endLineNumber,this._editor.getModel()?.getLineMaxColumn(t.endLineNumber)??1);this._rangeHighlightDecoration.set([{range:c,options:{description:"chat-explanation-range-highlight",className:"rangeHighlight",isWholeLine:!0,linesDecorationsClassName:"chat-explanation-range-glyph"}},{range:c,options:{description:"chat-explanation-range-highlight-overview",overviewRuler:{color:_s(bxe),position:7}}}])})),this._eventStore.add($(o,"mouseleave",()=>{this._rangeHighlightDecoration.clear()})),this._explanationItems.set(e,{item:o,readIndicator:s,textElement:r}),this._bodyNode.appendChild(o)}}setExplanationByLineNumber(e,t,o){for(let n=0;n<this._explanations.length;n++){let r=this._explanations[n];if(r.startLineNumber===e&&r.endLineNumber===t)return r.explanation=o,r.loading=!1,this._updateExplanationText(n),!0}return!1}get explanationCount(){return this._explanations.length}_updateExplanationText(e){let t=this._explanationItems.get(e),o=this._explanations[e];t&&o&&(St(t.textElement),t.textElement.textContent=o.explanation)}_updateItemReadIndicator(e,t){St(e),t?(e.appendChild(un(L.circle)),e.classList.add("read"),e.classList.remove("unread")):(e.appendChild(un(L.circleFilled)),e.classList.remove("read"),e.classList.add("unread"))}_updateExplanationItemsReadState(){this._explanationItems.forEach(({readIndicator:e},t)=>{let o=this._explanations[t];this._updateItemReadIndicator(e,o.read)})}layout(e){if(this._disposed)return;this._startLineNumber=e;let t=this._editor.getOption(75),{contentLeft:o,contentWidth:n,verticalScrollbarWidth:r}=this._editor.getLayoutInfo(),s=this._editor.getScrollTop(),l=Dc(this._domNode)||280;this._position={stackOrdinal:2,preference:{top:this._editor.getTopForLineNumber(e)-s-t,left:o+n-(2*r+l)}},this._editor.layoutOverlayWidget(this)}toggle(e){this._domNode.classList.toggle("visible",e),e&&this._explanations.length>0&&this.layout(this._explanations[0].startLineNumber)}relayout(){this._startLineNumber&&this.layout(this._startLineNumber)}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return this._position}dispose(){this._disposed||(this._disposed=!0,this._rangeHighlightDecoration.clear(),this._editor.removeOverlayWidget(this),super.dispose())}},tHe=class extends k{constructor(e,t,o,n,r){super();this._editor=e;this._chatWidgetService=t;this._viewsService=o;this._modelUri=r;this._widgets=[];this._visible=!1;this._register(this._editor.onDidChangeModel(()=>{let s=this._editor.getModel()?.uri;if(this._modelUri)if(s&&s.toString()===this._modelUri.toString())for(let l of this._widgets)l.toggle(this._visible),l.relayout();else for(let l of this._widgets)l.toggle(!1)})),this._register(ve(s=>{let c=n.state.read(s).get(this._modelUri);c?(this._diffInfo=c.diffInfo,this._chatSessionResource=c.chatSessionResource,this._widgets.length===0&&this._diffInfo&&this._createWidgets(this._diffInfo,this._chatSessionResource),c.progress==="complete"&&this._handleExplanations(this._modelUri,c.explanations),this.show()):this.hide()}))}_createWidgets(e,t){if(e.identical||e.changes.length===0)return;let o=wSn(e.changes,5);for(let n of o){let r=new aWi(this._editor,n,e,this._chatWidgetService,this._viewsService,t);this._widgets.push(r),this._register(r),r.layout(n[0].modified.startLineNumber)}this._register(U.any(this._editor.onDidScrollChange,this._editor.onDidLayoutChange)(()=>{for(let n of this._widgets)n.relayout()}))}_handleExplanations(e,t){if(!(!this._modelUri||e.toString()!==this._modelUri.toString())){for(let o of t)for(let n of this._widgets)if(n.setExplanationByLineNumber(o.startLineNumber,o.endLineNumber,o.explanation))break}}show(){this._visible=!0;for(let e of this._widgets)e.toggle(!0),e.relayout()}hide(){this._visible=!1;for(let e of this._widgets)e.toggle(!1)}_clearWidgets(){for(let e of this._widgets)e.dispose();this._widgets.length=0}dispose(){this._clearWidgets(),super.dispose()}};var lbe=le("chatEditingExplanationModelManager");function CSn(a,i){let e=[],t=[];for(let o=a.original.startLineNumber;o<a.original.endLineNumberExclusive;o++){let n=i.originalModel.getLineContent(o);e.push(n)}for(let o=a.modified.startLineNumber;o<a.modified.endLineNumberExclusive;o++){let n=i.modifiedModel.getLineContent(o);t.push(n)}return{originalText:e.join(`
`),modifiedText:t.join(`
`)}}var Glt=class extends k{constructor(e){super();this._languageModelsService=e;this._state=De(this,new dt);this.state=this._state}_updateUriState(e,t){let o=this._state.get(),n=new dt(o);n.set(e,t),this._state.set(n,void 0)}_updateUriStatePartial(e,t){let o=this._state.get(),n=o.get(e);if(n){let r=new dt(o);r.set(e,{...n,...t}),this._state.set(r,void 0)}}_removeUris(e){let t=this._state.get(),o=new dt(t);for(let n of e)o.delete(n);this._state.set(o,void 0)}generateExplanations(e,t,o){let n=e.map(l=>l.modifiedModel.uri),r=new qe(o);for(let l of e)this._updateUriState(l.modifiedModel.uri,{progress:"loading",explanations:[],diffInfo:l,chatSessionResource:t});let s=this._doGenerateExplanations(e,r.token);return{uris:n,completed:s,dispose:()=>{r.dispose(!0),this._removeUris(n)}}}async _doGenerateExplanations(e,t){let o=[];for(let s of e)s.changes.length===0||s.identical?this._updateUriStatePartial(s.modifiedModel.uri,{progress:"complete",explanations:[]}):o.push(s);if(o.length===0)return;let n=o.map(s=>{let l=s.modifiedModel.uri,c=Be(l),u=s.changes.map(p=>{let{originalText:h,modifiedText:g}=CSn(p,s);return{startLineNumber:p.modified.startLineNumber,endLineNumber:p.modified.endLineNumberExclusive-1,originalText:h,modifiedText:g}});return{uri:l,fileName:c,changes:u}}),r=n.reduce((s,l)=>s+l.changes.length,0);try{let s=await this._languageModelsService.selectLanguageModels({vendor:"copilot",id:"copilot-utility-small"});if(!s.length){for(let b of n)this._updateUriStatePartial(b.uri,{progress:"error",explanations:[],errorMessage:d(7979,null)});return}if(t.isCancellationRequested)return;let l=0,c=n.map(b=>b.changes.map(S=>{let y=`=== CHANGE ${l} (File: ${b.fileName}, Lines ${S.startLineNumber}-${S.endLineNumber}) ===
BEFORE:
${S.originalText||"(empty)"}

AFTER:
${S.modifiedText||"(empty)"}`;return l++,y}).join(`

`)).join(`

`),u=n.length,p=`Analyze these ${r} code changes across ${u} file${u>1?"s":""} and provide a brief explanation for each one.
These changes are part of a single coherent modification, so consider how they relate to each other.

${c}

Respond with a JSON array containing exactly ${r} objects, one for each change in order.
Each object should have an "explanation" field with a brief sentence (max 15 words) explaining what changed and why.
Be specific about the actual code changes. Return ONLY valid JSON, no markdown.

Example response format:
[{"explanation": "Added null check to prevent crash"}, {"explanation": "Renamed variable for clarity"}]`,h=await this._languageModelsService.sendChatRequest(s[0],void 0,[{role:1,content:[{type:"text",value:p}]}],{},t),g="";for await(let b of h.stream){if(t.isCancellationRequested)return;if(Array.isArray(b))for(let S of b)S.type==="text"&&(g+=S.value);else b.type==="text"&&(g+=b.value)}if(await h.result,t.isCancellationRequested)return;let f=[];try{let b=g.trim();b.startsWith("```")&&(b=b.replace(/^```(?:json)?\n?/,"").replace(/\n?```$/,"")),f=JSON.parse(b)}catch{}let v=0;for(let b of n){let S=[];for(let y of b.changes){let w=f[v]?.explanation?.trim()||d(7977,null);S.push({uri:b.uri,startLineNumber:y.startLineNumber,endLineNumber:y.endLineNumber,originalText:y.originalText,modifiedText:y.modifiedText,explanation:w}),v++}this._updateUriStatePartial(b.uri,{progress:"complete",explanations:S})}}catch(s){if(!t.isCancellationRequested){let l=s instanceof Error?s.message:d(7978,null);for(let c of n)this._updateUriStatePartial(c.uri,{progress:"error",explanations:[],errorMessage:l})}}}};Glt=I([m(0,Gr)],Glt);Ce(lbe,Glt,1);var Z6=class extends z{constructor(i){super({category:fi,...i})}async run(i,...e){let t=i.get(F),o=i.get(mu),n=i.get(ie),r=po.getOriginalUri(n.activeEditorPane?.input,{supportSideBySide:1});if(!r||!n.activeEditorPane)return;let s=o.editingSessionsObs.get().find(u=>u.getEntry(r));if(!s)return;let l=s.getEntry(r),c=l.getEditorIntegration(n.activeEditorPane);return t.invokeFunction(this.runChatEditingCommand.bind(this),s,l,c,...e)}},w4t=class extends Z6{constructor(e){super({id:e?"chatEditor.action.navigateNext":"chatEditor.action.navigatePrevious",title:e?P(7958,"Go to Next Chat Edit"):P(7959,"Go to Previous Chat Edit"),icon:e?L.arrowDown:L.arrowUp,precondition:C.and(Z.enabled,Cb),keybinding:{primary:e?575:1599,weight:200,when:C.and(Cb,C.or(me.focus,Ap))},f1:!0,menu:{id:R.ChatEditingEditorContent,group:"navigate",order:e?3:2,when:C.and(Dfe,Cb)}});this.next=e}async runChatEditingCommand(e,t,o,n){let r=e.get(F);(this.next?n.next(!1):n.previous(!1))||await r.invokeFunction(gWi,t,o,this.next)||(this.next?n.next(!0):n.previous(!0))}};async function gWi(a,i,e,t){let o=a.get(ie),n=i.entries.get(),r=n.indexOf(e),s;for(;r=(r+(t?1:-1)+n.length)%n.length,s=n[r],s.state.get()!==0;)if(s===e)return!1;let l=await o.openEditor({resource:s.modifiedURI,options:{revealIfOpened:!1,revealIfVisible:!1}},tr);return l?(i.entries.get().includes(s)&&s.getEditorIntegration(l).reveal(t),!0):!1}var C4t=class extends Z6{constructor(e,t){super({id:e,title:t?P(7942,"Keep Chat Edits"):P(7952,"Undo Chat Edits"),shortTitle:t?P(7943,"Keep"):P(7953,"Undo"),tooltip:t?P(7944,"Keep Chat Edits in this File"):P(7954,"Undo Chat Edits in this File"),precondition:C.and(Cb,voe.negate()),icon:t?L.check:L.discard,f1:!0,keybinding:{when:C.or(me.focus,wr),weight:210,primary:t?3127:3116},menu:{id:R.ChatEditingEditorContent,group:"a_resolve",order:t?0:1,when:C.and(t?void 0:Dfe,C.or(dFe,EP.negate()))}});this._keep=t}async runChatEditingCommand(e,t,o,n){let r=e.get(F),s=e.get(B);this._keep?t.accept(o.modifiedURI):t.reject(o.modifiedURI),s.getValue("chat.editing.revealNextChangeOnResolve")&&await r.invokeFunction(gWi,t,o,!0)}},cbe=class a extends C4t{static{this.ID="chatEditor.action.accept"}constructor(){super(a.ID,!0)}},qlt=class a extends C4t{static{this.ID="chatEditor.action.reject"}constructor(){super(a.ID,!1)}},oLo="chatEditor.action.acceptHunk",nLo="chatEditor.action.undoHunk",x4t=class extends Z6{constructor(e){super({id:e?oLo:nLo,title:e?P(7948,"Keep this Change"):P(7961,"Undo this Change"),shortTitle:e?P(7949,"Keep"):P(7962,"Undo"),precondition:C.and(Cb,voe.negate()),f1:!0,keybinding:{when:C.and(oGt,C.or(me.focus,Ap)),weight:201,primary:e?2103:2092},menu:{id:R.ChatEditingEditorHunk,order:1}});this._accept=e}async runChatEditingCommand(e,t,o,n,...r){let s=e.get(F),l=e.get(B);this._accept?await n.acceptNearestChange(r[0]):await n.rejectNearestChange(r[0]),l.getValue("chat.editing.revealNextChangeOnResolve")&&o.changesCount.get()===0&&await s.invokeFunction(gWi,t,o,!0)}},lWi=class extends x4t{static{this.ID=oLo}constructor(){super(!0)}},cWi=class extends x4t{static{this.ID=nLo}constructor(){super(!1)}},dWi=class extends Z6{constructor(){super({id:"chatEditor.action.toggleDiff",title:P(7951,"Toggle Diff Editor for Chat Edits"),category:fi,toggled:{condition:C.or(me.inDiffEditor,Tr.isEqualTo(hZ)),icon:L.goToFile},precondition:C.and(Cb),icon:L.diffSingle,keybinding:{when:me.focus,weight:200,primary:1601},menu:[{id:R.ChatEditingEditorHunk,order:10},{id:R.ChatEditingEditorContent,group:"a_resolve",order:2,when:C.and(Dfe)}]})}runChatEditingCommand(i,e,t,o,...n){o.toggleDiff(n[0])}},uWi=class extends Z6{constructor(){super({id:"chatEditor.action.showAccessibleDiffView",title:P(7950,"Show Accessible Diff View for Chat Edits"),f1:!0,precondition:C.and(Cb,voe.negate()),keybinding:{when:C.and(me.focus,Oa),weight:200,primary:65}})}runChatEditingCommand(i,e,t,o){o.enableAccessibleDiffView()}},pWi=class extends Z6{constructor(){super({id:"chatEditor.action.reviewChanges",title:P(7960,"Review"),precondition:C.and(Cb,voe.negate()),menu:[{id:R.ChatEditingEditorContent,group:"a_resolve",order:3,when:C.and(Dfe.negate(),voe.negate(),C.or(dFe,EP.negate()))}]})}runChatEditingCommand(i,e,t,o,...n){t.enableReviewModeUntilSettled()}},mWi=class a extends Z6{static{this.ID="chatEditor.action.acceptAllEdits"}constructor(){super({id:a.ID,title:P(7946,"Keep All Chat Edits"),tooltip:P(7947,"Keep All Chat Edits in this Session"),precondition:C.and(Cb,voe.negate()),icon:L.checkAll,f1:!0,keybinding:{when:C.or(me.focus,wr),weight:210,primary:2615}})}async runChatEditingCommand(i,e,t,o,...n){await e.accept()}},k4t=class extends z{constructor(e){super({id:e?"chatEditing.multidiff.acceptAllFiles":"chatEditing.multidiff.discardAllFiles",title:e?d(7945,null):d(7955,null),icon:e?L.check:L.discard,menu:{when:C.equals("resourceScheme",eG),id:R.EditorTitle,order:e?0:1,group:"navigation"}});this.accept=e}async run(e,...t){let o=e.get(mu),n=e.get(ie),r=e.get(kt),s=e.get(Co),c=Zp(t,n,r,s).groupedEditors[0];if(!c)return;let u=c.editors[0];if(!(u instanceof Ou)||!u.resource)return;let{chatSessionResource:p}=HXe(u.resource),h=o.getEditingSession(p);h&&(this.accept?await h.accept():await h.reject(),n.closeEditor({editor:u,groupId:c.group.id}))}},xSn=[eG,"copilotcli-worktree-changes","copilotcloud-pr-changes"],hWi=class extends z{constructor(){super({id:"chatEditing.multidiff.explain",title:d(7956,null),menu:{when:C.and(C.or(...xSn.map(e=>C.equals("resourceScheme",e))),C.has("config.chat.editing.explainChanges.enabled")),id:R.MultiDiffEditorContent,order:10}});this._widgetsByInput=new WeakMap}async run(e,...t){let o=e.get(ie),n=e.get(lbe),r=e.get(Lt),s=e.get(Gt),l=e.get(mu),c=o.activeEditorPane;if(!c||!(c instanceof _f)||!c.viewModel)return;let u=c.input;if(!u)return;this._widgetsByInput.get(u)?.dispose();let p=new O;this._widgetsByInput.set(u,p),U.once(u.onWillDispose)(()=>{p.dispose(),this._widgetsByInput.delete(u)});let g=c.viewModel.items.get(),f;if(u instanceof Ou&&u.resource?.scheme===eG&&(f=HXe(u.resource).chatSessionResource),!f){let S=g.map(y=>{let w=y.documentDiffItem,x=w?.multiDiffEditorItem?.goToFileUri;if(x)return x;let E=w?.multiDiffEditorItem?.modifiedUri??y.modifiedUri;if(E?.path)return A.file(E.path)}).filter(y=>!!y);for(let y of l.editingSessionsObs.get())if(S.some(w=>y.getEntry(w))){f=y.chatSessionResource;break}}let v=new Map;for(let S of g){let y=S.modifiedUri;if(!y)continue;let w=c.tryGetCodeEditor(y);if(!w)continue;let x=S.diffEditorViewModel;await x.waitForDiff();let E=x.diff.get();if(!E||E.identical)continue;let M=y.toString(),N=v.get(M);N?N.changes.push(...E.mappings.map(V=>V.lineRangeMapping)):v.set(M,{editor:w.editor,changes:E.mappings.map(V=>V.lineRangeMapping),originalModel:x.model.original,modifiedModel:x.model.modified})}let b=[];for(let S of v.values()){let y={changes:S.changes,identical:!1,originalModel:S.originalModel,modifiedModel:S.modifiedModel};b.push(y);let w=new tHe(S.editor,r,s,n,y.modifiedModel.uri);p.add(w)}b.length>0&&p.add(n.generateExplanations(b,f,Ie.None))}};function rLo(){W(class extends w4t{constructor(){super(!0)}}),W(class extends w4t{constructor(){super(!1)}}),W(pWi),W(cbe),W(qlt),W(mWi),W(lWi),W(cWi),W(dWi),W(uWi),W(class extends k4t{constructor(){super(!0)}}),W(class extends k4t{constructor(){super(!1)}}),W(hWi),be.appendMenuItem(R.ChatEditingEditorContent,{command:{id:fWi,title:d(7957,null),precondition:C.false()},group:"navigate",order:-1,when:C.and(Dfe,Cb)})}var fWi="chatEditor.navigation.bearings";var vWi=class extends ts{constructor(e,t,o,n,r,s=[cbe.ID]){super(void 0,e,{...t,icon:!1,label:!0,keybindingNotRenderedWithLabel:!0});this._entry=o;this._editor=n;this._keybindingService=r;this._primaryActionIds=s;this._reveal=this._store.add(new ue)}render(e){if(super.render(e),this._primaryActionIds.includes(this._action.id)&&this.element?.classList.add("primary"),this._action.id===cbe.ID){let t=this._store.add(new ue);this._store.add(ve(o=>{To(this.label),To(this.element);let n=this._entry.read(o)?.autoAcceptController.read(o);if(n){let r=-100*(n.remaining/n.total);this.element.style.setProperty("--vscode-action-item-auto-timeout",`${r}%`),this.element.classList.toggle("auto",!0),t.value=Lwe(this.element,()=>n.cancel())}else this.element.classList.toggle("auto",!1),t.clear()}))}}set actionRunner(e){super.actionRunner=e,this._editor&&(this._reveal.value=e.onWillRun(t=>{this._editor.focus()}))}get actionRunner(){return super.actionRunner}getTooltip(){let e=super.getTooltip();return e&&this._keybindingService.appendKeybinding(e,this._action.id)}},$lt=class extends k{constructor(e,t,o){super();this._editor=e;this._keybindingService=t;this._instaService=o;this._showStore=this._store.add(new O);this._session=De(this,void 0);this._entry=De(this,void 0);this._navigationBearings=De(this,{changeCount:-1,activeIdx:-1,entriesCount:-1});this._domNode=document.createElement("div"),this._domNode.classList.add("chat-editor-overlay-widget"),this._isBusy=ke(s=>this._entry.read(s)?.waitsForLastEdits.read(s));let n=document.createElement("div");n.classList.add("chat-editor-overlay-progress"),D(n,un(q.modify(L.loading,"spin")));let r=D(n,_("span.progress-message"));this._domNode.appendChild(n),this._store.add(ve(s=>{let l=this._isBusy.read(s);this._domNode.classList.toggle("busy",l),r.innerText=""})),this._toolbarNode=document.createElement("div"),this._toolbarNode.classList.add("chat-editor-overlay-toolbar")}dispose(){this.hide(),super.dispose()}getDomNode(){return this._domNode}show(e,t,o){this._showStore.clear(),Ki(n=>{this._session.set(e,n),this._entry.set(t,n)}),this._showStore.add(ve(n=>{let r=o.entryIndex.read(n),s=o.changeIndex.read(n),l=e.entries.read(n),c=r!==void 0&&s!==void 0?s:-1,u=0;for(let p=0;p<l.length;p++){let h=l[p].changesCount.read(n);u+=h,r!==void 0&&p<r&&(c+=h)}this._navigationBearings.set({changeCount:u,activeIdx:c,entriesCount:l.length},void 0)})),this._domNode.appendChild(this._toolbarNode),this._showStore.add(ee(()=>this._toolbarNode.remove())),this._showStore.add(this._instaService.createInstance(pr,this._toolbarNode,R.ChatEditingEditorContent,{telemetrySource:"chatEditor.overlayToolbar",hiddenItemStrategy:0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0},actionViewItemProvider:(n,r)=>{let s=this;if(n.id===fWi)return new class extends ts{constructor(){super(void 0,n,{...r,icon:!1,label:!0,keybindingNotRenderedWithLabel:!0})}render(l){super.render(l),l.classList.add("label-item"),this._store.add(ve(c=>{To(this.label);let{changeCount:u,activeIdx:p}=s._navigationBearings.read(c);if(u>0){let h=p===-1?"1":`${p+1}`;this.label.innerText=d(7971,null,h,u)}else this.label.innerText=d(7970,null);this.updateTooltip()}))}getTooltip(){let{changeCount:l,entriesCount:c}=s._navigationBearings.get();if(l===-1||c===-1)return;let u;return l===1&&c===1?u=d(7972,null):l===1?u=d(7973,null,c):c===1?u=d(7975,null,l):u=d(7976,null,l,c),s._isBusy.get()?d(7974,null,u):u}};if(n.id===cbe.ID||n.id===qlt.ID)return new vWi(n,r,s._entry,s._editor,s._keybindingService)}}))}hide(){Ki(e=>{this._session.set(void 0,e),this._entry.set(void 0,e),this._navigationBearings.set({changeCount:-1,activeIdx:-1,entriesCount:-1},e)}),this._showStore.clear()}};$lt=I([m(1,Le),m(2,F)],$lt);var jlt=class{constructor(i,e,t,o){this._store=new O;this._domNode=document.createElement("div");this._domNode.classList.add("chat-editing-editor-overlay"),this._domNode.style.position="absolute",this._domNode.style.bottom="24px",this._domNode.style.right="24px",this._domNode.style.zIndex="100";let n=t.createInstance($lt,e);this._domNode.appendChild(n.getDomNode()),this._store.add(ee(()=>this._domNode.remove())),this._store.add(n);let r=()=>{i.contains(this._domNode)||i.appendChild(this._domNode)},s=()=>{i.contains(this._domNode)&&(n.hide(),this._domNode.remove())},l=qr(this,U.any(e.onDidActiveEditorChange,e.onDidModelChange)),c=Js({equalsFn:ze},p=>{l.read(p);let h=e.activeEditorPane;return da(h?.getControl())?po.getOriginalUri(h?.input,{supportSideBySide:1}):void 0}),u=ke(p=>{l.read(p);let h=c.read(p);if(h)for(let g of o.editingSessionsObs.read(p)){if(!g.isGlobalEditingSession)continue;let f=g.readEntry(h,p);if(f)return{session:g,entry:f}}});this._store.add(ve(p=>{let h=u.read(p);if(!h){s();return}let{session:g,entry:f}=h;if(f?.state.read(p)===0){let v=e.activeEditorPane;To(v);let b=ke(y=>f?f.getEditorIntegration(v).currentIndex.read(y):0),S=ke(y=>f?g.entries.read(y).indexOf(f):0);n.show(g,f,{entryIndex:S,changeIndex:b}),r()}else s()}))}dispose(){this._store.dispose()}};jlt=I([m(2,F),m(3,mu)],jlt);var dbe=class{constructor(i,e,t){this._store=new O;let o=vi(this,U.any(i.onDidAddGroup,i.onDidRemoveGroup),()=>i.groups),n=this._store.add(new Ot);this._store.add(ve(r=>{if(t.isSessionsWindow)return;let s=new Set(n.keys()),l=o.read(r);for(let c of l)if(c instanceof oy&&(s.delete(c),!n.has(c))){let u=e.createChild(new Po([X,c.scopedContextKeyService])),p=c.element,h=u.createInstance(jlt,p,c);n.set(c,Fn(h,u))}for(let c of s)n.deleteAndDispose(c)}))}static{this.ID="chat.edits.editorOverlay"}dispose(){this._store.dispose()}};dbe=I([m(0,kt),m(1,F),m(2,Mt)],dbe);var bWi=class{constructor(i,e,t){this.total=i;this.remaining=e;this.cancel=t}},SWi=te("minimap.chatEditHighlight",ni(Bo,.6),d(7995,null)),KE=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.modifiedURI=e;this._telemetryInfo=t;this._fileConfigService=r;this._chatService=s;this._fileService=l;this._undoRedoService=c;this._instantiationService=u;this._aiEditTelemetryService=p;this.entryId=`${KE.scheme}::${++KE.lastEntryId}`;this._onDidDelete=this._register(new T);this.onDidDelete=this._onDidDelete.event;this._stateObs=De(this,0);this.state=this._stateObs;this._waitsForLastEdits=De(this,!1);this.waitsForLastEdits=this._waitsForLastEdits;this._isCurrentlyBeingModifiedByObs=De(this,void 0);this.isCurrentlyBeingModifiedBy=this._isCurrentlyBeingModifiedByObs;this._isExternalEditInProgress=!1;this._lastModifyingResponseObs=Xm({equalsFn:(e,t)=>e?.requestId===t?.requestId},void 0);this.lastModifyingResponse=this._lastModifyingResponseObs;this._lastModifyingResponseInProgressObs=this._lastModifyingResponseObs.map((e,t)=>e?.isInProgress.read(t)??!1);this._rewriteRatioObs=De(this,0);this.rewriteRatio=this._rewriteRatioObs;this._reviewModeTempObs=De(this,void 0);this._autoAcceptCtrl=De(this,void 0);this.autoAcceptController=this._autoAcceptCtrl;this._refCounter=1;this._userEditScheduler=this._register(new Dt(()=>this._notifySessionAction("userModified"),1e3));this._editorIntegrations=this._register(new Ot);o===0&&(this.createdInRequestId=this._telemetryInfo.requestId),this.modifiedURI.scheme!==Q.untitled&&this.modifiedURI.scheme!==Q.vscodeNotebookCell&&(this._register(this._fileService.watch(this.modifiedURI)),this._register(this._fileService.onDidFilesChange(f=>{f.affects(this.modifiedURI)&&o===0&&f.gotDeleted()&&this._onDidDelete.fire()})));let h=hr("chat.editing.autoAcceptDelay",0,n);this._autoAcceptTimeout=ke(f=>{let v=h.read(f);return jn(v,0,100)}),this.reviewMode=ke(f=>{let v=this._autoAcceptTimeout.read(f);return this._reviewModeTempObs.read(f)??v===0}),this._store.add(ee(()=>this._lastModifyingResponseObs.set(void 0,void 0)));let g=this._store.add(new ue);this._store.add(ve(f=>{this._waitsForLastEdits.read(f)?g.value=r.disableAutoSave(this.modifiedURI):g.clear()})),this._store.add(ve(f=>{if(this._lastModifyingResponseInProgressObs.read(f)===!1&&!this.reviewMode.read(f)){let b=this._autoAcceptTimeout.read(void 0)*1e3,S=Date.now()+b,y=()=>{if(this.reviewMode.read(void 0)){this._autoAcceptCtrl.set(void 0,void 0);return}let x=Math.round(S-Date.now());if(x<=0)this.accept();else{let E=setTimeout(y,100);this._autoAcceptCtrl.set(new bWi(b,x,()=>{clearTimeout(E),this._autoAcceptCtrl.set(void 0,void 0)}),void 0)}};y()}}))}static{this.scheme="modified-file-entry"}static{this.lastEntryId=0}get telemetryInfo(){return this._telemetryInfo}get lastModifyingRequestId(){return this._telemetryInfo.requestId}dispose(){--this._refCounter===0&&super.dispose()}acquire(){return this._refCounter++,this}enableReviewModeUntilSettled(){if(this.state.get()!==0)return;this._reviewModeTempObs.set(!0,void 0);let e=ve(t=>{this.state.read(t)!==0&&(this._store.delete(e),this._reviewModeTempObs.set(void 0,void 0))});this._store.add(e)}updateTelemetryInfo(e){this._telemetryInfo=e}async accept(){let e=await this.acceptDeferred();e&&Ki(e)}async acceptDeferred(){if(this._stateObs.get()===0)return await this._doAccept(),e=>{this._stateObs.set(1,e),this._autoAcceptCtrl.set(void 0,e),this._notifySessionAction("accepted")}}async reject(){let e=await this.rejectDeferred();e&&Ki(e)}async rejectDeferred(){if(this._stateObs.get()===0)return this._notifySessionAction("rejected"),await this._doReject(),e=>{this._stateObs.set(2,e),this._autoAcceptCtrl.set(void 0,e)}}_notifySessionAction(e){this._notifyAction({kind:"chatEditingSessionAction",uri:this.modifiedURI,hasRemainingEdits:!1,outcome:e})}_notifyAction(e){e.kind==="chatEditingHunkAction"&&e.outcome==="accepted"?this._aiEditTelemetryService.handleCodeAccepted({suggestionId:void 0,acceptanceMethod:"accept",presentation:"highlightedEdit",modelId:this._telemetryInfo.modelId,modeId:this._telemetryInfo.modeId,applyCodeBlockSuggestionId:this._telemetryInfo.applyCodeBlockSuggestionId,editDeltaInfo:new Uy(e.linesAdded,e.linesRemoved,-1,-1),feature:this._telemetryInfo.feature,languageId:e.languageId,source:void 0,sourceRequestId:this._telemetryInfo.requestId}):e.kind==="chatEditingHunkAction"&&e.outcome==="rejected"&&this._aiEditTelemetryService.handleCodeRejected({suggestionId:void 0,rejectionMethod:"reject",presentation:"highlightedEdit",modelId:this._telemetryInfo.modelId,modeId:this._telemetryInfo.modeId,applyCodeBlockSuggestionId:this._telemetryInfo.applyCodeBlockSuggestionId,editDeltaInfo:new Uy(e.linesAdded,e.linesRemoved,-1,-1),feature:this._telemetryInfo.feature,languageId:e.languageId,source:void 0,sourceRequestId:this._telemetryInfo.requestId}),this._chatService.notifyUserAction({action:e,agentId:this._telemetryInfo.agentId,modelId:this._telemetryInfo.modelId,modeId:this._telemetryInfo.modeId,command:this._telemetryInfo.command,sessionResource:this._telemetryInfo.sessionResource,requestId:this._telemetryInfo.requestId,result:this._telemetryInfo.result})}getEditorIntegration(e){let t=this._editorIntegrations.get(e);return t||(t=this._createEditorIntegration(e),this._editorIntegrations.set(e,t)),t}acceptStreamingEditsStart(e,t,o){this._resetEditsState(o),this._isCurrentlyBeingModifiedByObs.set({responseModel:e,undoStopId:t},o),this._lastModifyingResponseObs.set(e,o),this._autoAcceptCtrl.get()?.cancel();let n=this._createUndoRedoElement(e);n&&this._undoRedoService.pushElement(n)}async acceptStreamingEditsEnd(){this._resetEditsState(void 0),await this._areOriginalAndModifiedIdentical()&&await this.accept()}_resetEditsState(e){this._isCurrentlyBeingModifiedByObs.set(void 0,e),this._rewriteRatioObs.set(0,e),this._waitsForLastEdits.set(!1,e)}startExternalEdit(){this._isExternalEditInProgress=!0}stopExternalEdit(){this._isExternalEditInProgress=!1}};KE=I([m(3,B),m(4,fr),m(5,si),m(6,ge),m(7,wl),m(8,F),m(9,XS)],KE);function Qlt(a){let i=Br.parseLocalSessionId(a);if(i)return i;let e=new wI;return e.update(a.toString()),e.digest()}var ZR=class{constructor(i,e){this._chatEditingService=i;this._modelService=e}static{this.scheme=Q.chatEditingModel}static getFileURI(i,e,t){return A.from({scheme:ZR.scheme,path:t,query:JSON.stringify({kind:"doc",documentId:e,chatSessionResource:i})})}async provideTextContent(i){let e=this._modelService.getModel(i);if(e&&!e.isDisposed())return e;let t=JSON.parse(i.query),n=this._chatEditingService.getEditingSession(A.revive(t.chatSessionResource))?.entries.get().find(r=>r.entryId===t.documentId);return n?this._modelService.getModel(n.originalURI):null}};ZR=I([m(1,_t)],ZR);var y$=class{constructor(i,e){this._chatEditingService=i;this._modelService=e}static getSnapshotFileURI(i,e,t,o,n){return A.from({scheme:Q.chatEditingSnapshotScheme,path:o,query:JSON.stringify({session:i,requestId:e??"",undoStop:t??"",scheme:n})})}async provideTextContent(i){let e=this._modelService.getModel(i);if(e&&!e.isDisposed())return e;let t=JSON.parse(i.query),o=this._chatEditingService.getEditingSession(A.revive(t.session));return!o||!t.requestId?null:o.getSnapshotModel(t.requestId,t.undoStop||void 0,i)}};y$=I([m(1,_t)],y$);var aLo="ArrayBuffer-4f56482b-5a03-49ba-8356-210d3b0c1c3d",yWi="chat-editing-notebook-snapshot-model";function wWi(a,i,e,t,o){return A.from({scheme:yWi,path:t,query:JSON.stringify({session:a,requestId:i??"",undoStop:e??"",viewType:o})})}function zP(a,i,e){let t=(typeof e=="number"?e:e.getValue(Ct.outputBackupSizeLimit))*1024;return kSn(a.createSnapshot({context:2,outputSizeLimit:t,transientOptions:i}),i)}function KP(a,i){try{let{transientOptions:e,data:t}=iHe(i);a.restoreSnapshot(t,e);let o=[];t.cells.forEach((n,r)=>{let s=n.internalMetadata?.internalId;s&&o.push({editType:9,index:r,internalMetadata:{internalId:s}})}),a.applyEdits(o,!0,void 0,()=>{},void 0,!1)}catch(e){console.error("Error restoring Notebook snapshot",e)}}var ire=class{constructor(i){let{transientOptions:e,data:t}=iHe(i);this.transientOptions=e,this.data=t}isEqual(i){if(i.cells.length!==this.data.cells.length)return!1;let e=this.transientOptions?.transientDocumentMetadata||{},t=yA(i.metadata||{},r=>!e[r]),o=yA(this.data.metadata||{},r=>!e[r]);if(JSON.stringify(t)!==JSON.stringify(o))return!1;let n=this.transientOptions?.transientCellMetadata||{};for(let r=0;r<i.cells.length;r++){let s=i.cells[r],l=this.data.cells[r];if(s instanceof AQ){if(!s.fastEqual(l,!0))return!1}else{if(s.cellKind!==l.cellKind||s.language!==l.language||s.mime!==l.mime||s.source!==l.source||!this.transientOptions?.transientOutputs&&s.outputs.length!==l.outputs.length)return!1;let c=yA(s.metadata||{},p=>!n[p]),u=yA(l.metadata||{},p=>!n[p]);if(JSON.stringify(c)!==JSON.stringify(u)||JSON.stringify(IWi(s,!0,this.transientOptions))!==JSON.stringify(IWi(l,!0,this.transientOptions)))return!1}}return!0}};function IWi(a,i,e){let t=e?.transientCellMetadata||{},o=e?.transientOutputs?[]:a.outputs.map(n=>({outputId:n.outputId,metadata:n.metadata,outputs:n.outputs.map(r=>({data:r.data,mime:r.mime}))}));return{cellKind:a.cellKind,language:a.language,metadata:a.metadata?yA(a.metadata,n=>!t[n]):a.metadata,outputs:o,mime:a.mime,source:a.source,collapseState:a.collapseState,internalMetadata:i?void 0:a.internalMetadata}}function kSn(a,i){let e={cells:a.cells.map(t=>IWi(t)),metadata:a.metadata};return JSON.stringify([JSON.stringify(i),JSON.stringify(e,(t,o)=>o instanceof Ke?{type:aLo,data:gc(o)}:o)])}function iHe(a){let[i,e]=JSON.parse(a),t=i?JSON.parse(i):void 0,o=JSON.parse(e,(n,r)=>r&&r.type===aLo?Ws(r.data):r);return{transientOptions:t,data:o}}var lLo="$$start",oHe="__epoch_",nHe=class{constructor(i,e,t,o,n,r,s){this.chatSessionResource=i;this._delegate=e;this._notebookEditorModelResolverService=t;this._notebookService=o;this._textModelService=n;this._editorWorkerService=r;this._configurationService=s;this._epochCounter=0;this._checkpoints=De(this,[]);this._currentEpoch=De(this,0);this._operations=Xm({equalsFn:()=>!1},[]);this._fileBaselines=new Map;this._refCountedDiffs=new Map;this._finalizedDiffCache=new Map;this._willUndoToCheckpoint=ke(i=>{let e=this._currentEpoch.read(i),t=this._checkpoints.read(i);if(t.length<2||e<=t[1].epoch)return;let o=this._operations.read(i),n=Oye(t,c=>c.epoch<e),r=n===-1?void 0:wu(t,c=>c.undoStopId===void 0,n),s=wu(o,c=>c.epoch<e),l=s&&wu(t,c=>c.epoch<s.epoch);return r?!l||!o.some(c=>c.epoch>r.epoch&&c.epoch<l.epoch)?r:l.epoch>r.epoch?l:r:l});this.canUndo=this._willUndoToCheckpoint.map(i=>!!i);this._willRedoToEpoch=ke(i=>{let e=this._currentEpoch.read(i),t=this._operations.read(i),o=this._checkpoints.read(i),n=Math.max(t.at(-1)?.epoch||0,o.at(-1)?.epoch||0);if(e>n)return;let r=t.find(c=>c.epoch>=e);if(!r){let c=o.find(p=>p.epoch>=e&&p.undoStopId===void 0);if(!c)return n+1;let u=o.find(p=>p.epoch>c.epoch&&p.undoStopId===void 0);return u?u.epoch:n+1}let s=o.find(c=>c.epoch>r.epoch),l=wu(o,c=>c.epoch<e);if(l&&r&&l.requestId!==r.requestId){let c=Oye(o,(p,h)=>p.undoStopId===void 0&&o[h-1]?.requestId===l.requestId),u=c===-1?void 0:o[c];if(u&&r.requestId!==u.requestId){let p=mvt(o,h=>h.undoStopId===void 0,c+1);if(p)return p.epoch}}return Math.min(s?.epoch||1/0,n+1)});this.canRedo=this._willRedoToEpoch.map(i=>!!i);this.requestDisablement=Js({equalsFn:(i,e)=>eo(i,e,Qi)},i=>{let e=this._currentEpoch.read(i),t=this._operations.read(i),o=this._checkpoints.read(i),n=Math.max(t.at(-1)?.epoch||0,o.at(-1)?.epoch||0);if(e>n)return[];let r=wu(t,u=>u.epoch<e)?.epoch||0,s=wu(o,u=>u.epoch<e&&u.undoStopId===void 0)?.epoch||0,l=Math.max(r,s),c=new Map;for(let u=o.length-1;u>=0;u--){let{undoStopId:p,requestId:h,epoch:g}=o[u];if(g<=l)break;h&&c.set(h,p)}return[...c].map(([u,p])=>({requestId:u,afterUndoStop:p}))});this.createCheckpoint(void 0,void 0,"Initial State","Starting point before any edits")}createCheckpoint(i,e,t,o){let r=this._checkpoints.get().find(p=>p.undoStopId===e&&p.requestId===i);if(r)return r.checkpointId;let{checkpoints:s,operations:l}=this._getVisibleOperationsAndCheckpoints(),c=ht(),u=this.incrementEpoch();return s.push({checkpointId:c,requestId:i,undoStopId:e,epoch:u,label:t,description:o}),Ki(p=>{this._checkpoints.set(s,p),this._operations.set(l,p),this._currentEpoch.set(u+1,p)}),c}async undoToLastCheckpoint(){let i=this._willUndoToCheckpoint.get();i&&await this.navigateToCheckpoint(i.checkpointId)}async redoToNextCheckpoint(){let i=this._willRedoToEpoch.get();i&&await this._navigateToEpoch(i)}navigateToCheckpoint(i){let e=this._getCheckpoint(i);if(!e)throw new Error(`Checkpoint ${i} not found`);return e.undoStopId===void 0?this._navigateToEpoch(e.epoch+1,e.epoch):this._navigateToEpoch(e.epoch+1)}getContentURIAtStop(i,e,t){return y$.getSnapshotFileURI(this.chatSessionResource,i,t,e.path)}async _navigateToEpoch(i,e=i){let t=this._currentEpoch.get();if(t!==i){let o=await this._applyFileSystemOperations(t,i);await this._reconstructAllFileContents(i,o)}this._currentEpoch.set(e,void 0)}_getCheckpoint(i){return this._checkpoints.get().find(e=>e.checkpointId===i)}incrementEpoch(){return this._epochCounter++}recordFileOperation(i){let{currentEpoch:e,checkpoints:t,operations:o}=this._getVisibleOperationsAndCheckpoints();if(i.epoch<e)throw new Error(`Cannot record operation at epoch ${i.epoch} when current epoch is ${e}`);o.push(i),Ki(n=>{this._checkpoints.set(t,n),this._operations.set(o,n),this._currentEpoch.set(i.epoch+1,n)})}_getVisibleOperationsAndCheckpoints(){let i=this._currentEpoch.get(),e=this._checkpoints.get(),t=this._operations.get();return{currentEpoch:i,checkpoints:e.filter(o=>o.epoch<i),operations:t.filter(o=>o.epoch<i)}}recordFileBaseline(i){let e=this._getBaselineKey(i.uri,i.requestId);this._fileBaselines.set(e,i)}_getFileBaseline(i,e){let t=this._getBaselineKey(i,e);return this._fileBaselines.get(t)}hasFileBaseline(i,e){let t=this._getBaselineKey(i,e);return this._fileBaselines.has(t)||this._operations.get().some(o=>o.type==="create"&&o.requestId===e&&ze(i,o.uri))}async getContentAtStop(i,e,t){let o;t?.startsWith(oHe)?o=Number(t.slice(oHe.length)):o=this._checkpoints.get().find(c=>c.requestId===i&&c.undoStopId===t)?.epoch;let n=this._getTimelineCanonicalUriForPath(e);if(!o||!n)return"";let r=await this._findBestBaselineForFile(n,o,i);if(!r)return"";let s=this._getFileOperationsInRange(n,r.epoch,o),l=await this._replayOperations(r,s);return l.exists?l.content:void 0}_getTimelineCanonicalUriForPath(i){for(let e of[this._fileBaselines.values(),this._operations.get()])for(let t of e)if(t.uri.path===i.path)return t.uri}onDidChangeContentsAtStop(i,e,t,o){if(!t||!t.startsWith(oHe))return k.None;let n=Number(t.slice(oHe.length));if(n<=this._epochCounter)return k.None;let r=new O,s=r.add(new Aa(500));return r.add(U.fromObservableLight(this._operations)(()=>{s.trigger(async()=>{this._operations.get().at(-1)?.epoch>=n&&r.dispose();let l=await this.getContentAtStop(i,e,t);l!==void 0&&o(l)})})),r}_getCheckpointBeforeEpoch(i,e){return wu(this._checkpoints.read(e),t=>t.epoch<=i)}async _reconstructFileState(i,e){let t=this._getCheckpointBeforeEpoch(e);if(!t)throw new Error(`Checkpoint for epoch ${e} not found`);let o=await this._findBestBaselineForFile(i,e,t.requestId||"");if(!o)return{exists:!1,uri:i};let n=this._getFileOperationsInRange(i,o.epoch,e);return this._replayOperations(o,n)}getStateForPersistence(){return{checkpoints:this._checkpoints.get(),currentEpoch:this._currentEpoch.get(),fileBaselines:[...this._fileBaselines],operations:this._operations.get(),epochCounter:this._epochCounter}}restoreFromState(i,e){this._checkpoints.set(i.checkpoints,e),this._currentEpoch.set(i.currentEpoch,e),this._operations.set(i.operations.slice(),e),this._epochCounter=i.epochCounter,this._fileBaselines.clear();for(let[t,o]of i.fileBaselines)this._fileBaselines.set(t,o)}getCheckpointIdForRequest(i,e){return this._checkpoints.get().find(o=>o.requestId===i&&o.undoStopId===e)?.checkpointId}async _reconstructAllFileContents(i,e){await Promise.all(Array.from(e).map(async t=>{let o=await this._reconstructFileState(t,i);o.exists&&await this._delegate.setContents(o.uri,o.content,o.telemetryInfo)}))}_getBaselineKey(i,e){return`${i.toString()}::${e}`}async _findBestBaselineForFile(i,e,t){let o=t,n=this._operations.get();for(let r=n.length-1;r>=0;r--){let s=n[r];if(!(s.epoch>e)){if(s.type==="create"&&ze(s.uri,i))return{uri:s.uri,requestId:s.requestId,content:s.initialContent,epoch:s.epoch,telemetryInfo:s.telemetryInfo};if(s.type==="rename"&&ze(s.newUri,i)){let l=await this._findBestBaselineForFile(s.oldUri,s.epoch,s.requestId);if(!l)return;let c=this._getFileOperationsInRange(s.oldUri,l.epoch,s.epoch),u=await this._replayOperations(l,c);return{uri:i,epoch:s.epoch,content:u.exists?u.content:"",requestId:s.requestId,telemetryInfo:l.telemetryInfo,notebookViewType:u.exists?u.notebookViewType:void 0}}if(o&&s.requestId!==o){let l=this._getFileBaseline(i,o);if(l)return l}o=s.requestId}}return this._getFileBaseline(i,o)}_getFileOperationsInRange(i,e,t){return this._operations.get().filter(o=>{let n=sn.parse(o.uri);return o.epoch>=e&&o.epoch<t&&(ze(o.uri,i)||n&&ze(n.notebook,i))}).sort((o,n)=>o.epoch-n.epoch)}async _replayOperations(i,e){let t={exists:!0,content:i.content,uri:i.uri,telemetryInfo:i.telemetryInfo};i.notebookViewType&&(t.notebook=await this._notebookEditorModelResolverService.createUntitledNotebookTextModel(i.notebookViewType),i.content&&KP(t.notebook,i.content));for(let o of e)t=await this._applyOperationToState(t,o,i.telemetryInfo);if(t.exists&&t.notebook){let o=await this._notebookService.withNotebookDataProvider(t.notebook.viewType);t.content=zP(t.notebook,o.serializer.options,this._configurationService),t.notebook.dispose()}return t}async _applyOperationToState(i,e,t){switch(e.type){case"create":{i.exists&&i.notebook&&i.notebook.dispose();let o;return e.notebookViewType&&(o=await this._notebookEditorModelResolverService.createUntitledNotebookTextModel(e.notebookViewType),e.initialContent&&KP(o,e.initialContent)),{exists:!0,content:e.initialContent,uri:e.uri,telemetryInfo:t,notebookViewType:e.notebookViewType,notebook:o}}case"delete":return i.exists&&i.notebook&&i.notebook.dispose(),{exists:!1,uri:e.uri};case"rename":return{...i,uri:e.newUri};case"textEdit":{if(!i.exists)throw new Error("Cannot apply text edits to non-existent file");let o=e.cellIndex!==void 0&&i.notebook?.cells.at(e.cellIndex);if(o){let n=this._applyTextEditsToContent(o.getValue(),e.edits);return i.notebook.applyEdits([{editType:1,index:e.cellIndex,count:1,cells:[{cellKind:o.cellKind,language:o.language,mime:o.language,source:n,outputs:o.outputs}]}],!0,void 0,()=>{},void 0),i}return{...i,content:this._applyTextEditsToContent(i.content,e.edits)}}case"notebookEdit":if(!i.exists)throw new Error("Cannot apply notebook edits to non-existent file");if(!i.notebook)throw new Error("Cannot apply notebook edits to non-notebook file");return i.notebook.applyEdits(e.cellEdits.slice(),!0,void 0,()=>{},void 0),i;default:bs(e)}}async _applyFileSystemOperations(i,e){let t=e>i,o=this._operations.get().filter(r=>t?r.epoch>=i&&r.epoch<e:r.epoch<i&&r.epoch>=e).sort((r,s)=>t?r.epoch-s.epoch:s.epoch-r.epoch),n=new xn;for(let r of o)await this._applyFileSystemOperation(r,t,n);return n}async _applyFileSystemOperation(i,e,t){switch(i.type){case"create":e?(await this._delegate.createFile(i.uri,i.initialContent),t.add(i.uri)):(await this._delegate.deleteFile(i.uri),t.delete(i.uri));break;case"delete":e?(await this._delegate.deleteFile(i.uri),t.delete(i.uri)):(await this._delegate.createFile(i.uri,i.finalContent),t.add(i.uri));break;case"rename":e?(await this._delegate.renameFile(i.oldUri,i.newUri),t.delete(i.oldUri),t.add(i.newUri)):(await this._delegate.renameFile(i.newUri,i.oldUri),t.delete(i.newUri),t.add(i.oldUri));break;case"textEdit":case"notebookEdit":t.add(sn.parse(i.uri)?.notebook??i.uri);break;default:bs(i)}}_applyTextEditsToContent(i,e){let{textBuffer:t,disposable:o}=xK(i,1);try{t.applyEdits(e.map(r=>new WY(null,G.lift(r.range),r.text,!1,!1,!1)),!1,!1);let n=t.getRangeAt(0,t.getLength());return t.getValueInRange(n,0)}finally{o.dispose()}}getEntryDiffBetweenStops(i,e,t){let o=Js({equalsFn:(n,r)=>n.start===r.start&&n.end===r.end},n=>{let r=this._checkpoints.read(n),s=r.findIndex(l=>l.requestId===e&&l.undoStopId===t);return{start:r[s],end:r[s+1]}});return this._getEntryDiffBetweenEpochs(i,`s\0${e}\0${t}`,o)}_getRequestEpochBounds(i,e){return Js({equalsFn:(t,o)=>t.start===o.start&&t.end===o.end},t=>{let o=this._checkpoints.read(t),n=o.findIndex(l=>l.requestId===i),r=n===-1?o[0]:o[n],s;return e===void 0?s=mvt(o,l=>l.requestId!==i,n+1):s=o.find(l=>l.requestId===e)||mvt(o,l=>l.requestId!==i,n+1)||o[o.length-1],{start:r,end:s}})}getEntryDiffBetweenRequests(i,e,t){return this._getEntryDiffBetweenEpochs(i,`r\0${e}\0${t}`,this._getRequestEpochBounds(e,t))}_getEntryDiffBetweenEpochs(i,e,t){let o=`${i.toString()}\0${e}`,n=this._finalizedDiffCache.get(o);if(n)return Fo(n);let r=this._refCountedDiffs.get(o);return r||(r=this._getEntryDiffBetweenEpochsInner(i,o,t,()=>this._refCountedDiffs.delete(o)),this._refCountedDiffs.set(o,r)),r}_getEntryDiffBetweenEpochsInner(i,e,t,o){let n=ke(this,s=>{let{start:l,end:c}=t.read(s);if(!l)return;let u=s.store.add(new O),p=this.getContentURIAtStop(l.requestId||lLo,i,oHe+l.epoch),h=this.getContentURIAtStop(c?.requestId||l.requestId||lLo,i,oHe+(c?.epoch||Number.MAX_SAFE_INTEGER)),g=Promise.all([this._textModelService.createModelReference(p),this._textModelService.createModelReference(h)]).then(f=>(u.isDisposed?f.forEach(v=>v.dispose()):f.forEach(v=>u.add(v)),{refs:f.map(v=>({model:v.object.textEditorModel,onChange:qr(this,v.object.textEditorModel.onDidChangeContent.bind(v.object.textEditorModel))})),isFinal:!!c})).catch(f=>({refs:[],isFinal:!0,error:f}));return{originalURI:p,modifiedURI:h,promise:new Uc(g)}}),r=ke(s=>{let l=n.read(s);if(!l)return;let{originalURI:c,modifiedURI:u,promise:p}=l,h=p?.promiseResult.read(s);if(!h?.data)return{originalURI:c,modifiedURI:u,promise:void 0};let{refs:g,isFinal:f,error:v}=h.data;return v?{originalURI:c,modifiedURI:u,promise:new Uc(Promise.resolve(oee(c,u)))}:(g.forEach(b=>b.onChange.read(s)),{originalURI:c,modifiedURI:u,promise:new Uc(this._computeDiff(c,u,!!f))})});return Js({onLastObserverRemoved:o},s=>{let l=r.read(s);if(!l)return;let c=l.promise?.promiseResult.read(s);return c?.data?(c.data.isFinal&&this._finalizedDiffCache.set(e,c.data),c.data):c?.error?oee(l.originalURI,l.modifiedURI):{...oee(l.originalURI,l.modifiedURI),isBusy:!0}})}_computeDiff(i,e,t){return this._editorWorkerService.computeDiff(i,e,{ignoreTrimWhitespace:!1,computeMoves:!1,maxComputationTimeMs:3e3},"advanced").then(o=>{let n={originalURI:i,modifiedURI:e,identical:!!o?.identical,isFinal:t,quitEarly:!o||o.quitEarly,added:0,removed:0,isBusy:!1};if(o)for(let r of o.changes)n.removed+=r.original.endLineNumberExclusive-r.original.startLineNumber,n.added+=r.modified.endLineNumberExclusive-r.modified.startLineNumber;return n})}hasEditsInRequest(i,e){for(let t of this._fileBaselines.values())if(t.requestId===i)return!0;for(let t of this._operations.read(e))if(t.requestId===i)return!0;return!1}getDiffsForFilesInRequest(i){let e=this._getRequestEpochBounds(i),t=Js({equalsFn:Cle},o=>{let n=new dt;for(let s of this._fileBaselines.values())s.requestId===i&&n.set(s.uri,s.epoch);let r=e.read(o);for(let s of this._operations.read(o))if(!(s.epoch<r.start.epoch)){if(r.end&&s.epoch>=r.end.epoch)break;s.type==="create"&&n.set(s.uri,0)}return n});return this._getDiffsForFilesAtEpochs(t,e.map(o=>o.end))}_getDiffsForFilesAtEpochs(i,e){let t=new dt,o;return ke(this,r=>{let s=this._checkpoints.read(r),l=s[0];if(!l)return[];let c=e.read(r);c!==o&&(t.clear(),o=c);let u=i.read(r),p=[];for(let[h,g]of u){let f=t.get(h)??this._getEntryDiffBetweenEpochs(h,`e\0${g}\0${c?.epoch}`,Fo({start:s.findLast(v=>v.epoch<=g)||l,end:c}));t.set(h,f),p.push(f)}return p}).map((r,s)=>r.flatMap(l=>l.read(s)).filter(so))}getDiffsForFilesInSession(){let i=Js({equalsFn:Cle},e=>{let t=new dt;for(let o of this._fileBaselines.values())t.set(o.uri,Math.min(o.epoch,t.get(o.uri)??Number.MAX_SAFE_INTEGER));for(let o of this._operations.read(e))o.type==="create"&&t.set(o.uri,0);return t});return this._getDiffsForFilesAtEpochs(i,Fo(void 0))}getDiffForSession(){let i=this.getDiffsForFilesInSession();return ke(e=>{let t=i.read(e),o=0,n=0;for(let r of t)o+=r.added,n+=r.removed;return{added:o,removed:n}})}};nHe=I([m(2,Yh),m(3,kn),m(4,Bt),m(5,Qs),m(6,B)],nHe);var e9=class extends KE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(e,n,2,c,u,p,h,g,f,v);this._multiDiffEntryDelegate=o;this._languageId=r;this._modelService=s;this._languageService=l;this.linesAdded=Fo(0);this._changesCount=De(this,1);this.changesCount=this._changesCount;this.isDeletion=!0;this._originalContent=t,this.initialContent=t,this.originalURI=ZR.getFileURI(n.sessionResource,this.entryId,e.path),this.diffInfo=Fo(this._diffInfo()),this.linesRemoved=Fo(this._getOrCreateOriginalModel().getLineCount())}dispose(){this._originalModel?.dispose(),this._modifiedModel?.dispose(),super.dispose()}_getOrCreateOriginalModel(){return(!this._originalModel||this._originalModel.isDisposed())&&(this._originalModel=this._modelService.createModel(Uk(MDe(this._originalContent)),this._languageService.createById(this._languageId),this.originalURI,!1)),this._originalModel}_getOrCreateModifiedModel(){return(!this._modifiedModel||this._modifiedModel.isDisposed())&&(this._modifiedModel=this._modelService.createModel("",this._languageService.createById(this._languageId),this.modifiedURI.with({scheme:"deleted-file"}),!1)),this._modifiedModel}_diffInfo(){let e=this._getOrCreateOriginalModel();this._getOrCreateModifiedModel();let t=e.getLineCount();return{changes:[new vv(new vo(1,t+1),new vo(1,1),void 0)],quitEarly:!1,identical:!1,moves:[]}}getDiffInfo(){return Promise.resolve(this._diffInfo())}equalsSnapshot(e){return!!e&&ze(this.modifiedURI,e.resource)&&this._languageId===e.languageId&&this._originalContent===e.original&&e.current===""&&this.state.get()===e.state}createSnapshot(e,t,o){return{resource:this.modifiedURI,languageId:this._languageId,snapshotUri:this.originalURI,original:this._originalContent,current:"",state:this.state.get(),telemetryInfo:this._telemetryInfo,isDeleted:!0}}async restoreFromSnapshot(e,t=!0){this._stateObs.set(e.state,void 0),t&&e.current!==""&&await this._fileService.writeFile(this.modifiedURI,Ke.fromString(e.current))}async resetToInitialContent(){await this._fileService.writeFile(this.modifiedURI,Ke.fromString(this._originalContent))}resetEditTrackerToInitialContent(){return Promise.resolve()}async _areOriginalAndModifiedIdentical(){return this._originalContent===""}_createUndoRedoElement(e){return{type:0,resource:this.modifiedURI,label:"Chat File Deletion",code:"chat.delete",undo:async()=>{await this._fileService.writeFile(this.modifiedURI,Ke.fromString(this._originalContent))},redo:async()=>{await this._fileService.del(this.modifiedURI,{useTrash:!1})}}}async acceptAgentEdits(e,t,o,n){Ki(r=>{this._waitsForLastEdits.set(!o,r),this._stateObs.set(0,r),o&&(this._resetEditsState(r),this._rewriteRatioObs.set(1,r))})}async _doAccept(){this._multiDiffEntryDelegate.collapse(void 0)}async _doReject(){await this._fileService.writeFile(this.modifiedURI,Ke.fromString(this._originalContent)),this._multiDiffEntryDelegate.collapse(void 0)}_createEditorIntegration(e){return{currentIndex:De(this,0),reveal:()=>{},next:()=>!1,previous:()=>!1,enableAccessibleDiffView:()=>{},acceptNearestChange:async()=>{},rejectNearestChange:async()=>{},toggleDiff:async()=>{},dispose:()=>{}}}async computeEditsFromSnapshots(e,t){return[]}async save(){}async revertToDisk(){}};e9=I([m(5,_t),m(6,Rt),m(7,B),m(8,fr),m(9,si),m(10,ge),m(11,wl),m(12,F),m(13,XS)],e9);function cLo(a,i,e){let t=$kt(a,e);if(!t)return!1;let o=t.getOriginalEditor().getModel(),n=t.getModifiedEditor().getModel();return ze(o?.uri,i.originalURI)&&ze(n?.uri,i.modifiedURI)}var CWi=class{constructor(){this._free=new ra}dispose(){je(this._free)}get(){return this._free.shift()}putBack(i){this._free.push(i)}get free(){return this._free}},w$=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._entry=i;this._editor=e;this._editorService=n;this._accessibilitySignalsService=r;this._explanationModelManager=u;this._chatWidgetService=p;this._viewsService=h;this._currentIndex=De(this,-1);this.currentIndex=this._currentIndex;this._store=new O;this._diffHunksRenderStore=this._store.add(new O);this._diffHunkWidgetPool=this._store.add(new CWi);this._diffHunkWidgets=[];this._viewZones=[];this._accessibleDiffViewVisible=De(this,!1);this._diffLineDecorations=e.createDecorationsCollection();let g=Ds(e);this._diffLineDecorations=this._editor.createDecorationsCollection(),this._diffVisualDecorations=this._editor.createDecorationsCollection(),this._store.add(new tHe(this._editor,this._chatWidgetService,this._viewsService,this._explanationModelManager,this._entry.modifiedURI));let f=ke(x=>!(!ze(g.model.read(x)?.uri,t.read(x).modifiedModel.uri)||this._editor.getOption(70)&&!l.invokeFunction(cLo,i,this._editor)));this._store.add(ve(x=>{if(!f.read(x)){this._diffLineDecorations.clear();return}let E=[],M=t.read(x);for(let N of M.changes)E.push({range:N.modified.toInclusiveRange()??new G(N.modified.startLineNumber,1,N.modified.startLineNumber,Number.MAX_SAFE_INTEGER),options:w$._diffLineDecorationData});this._diffLineDecorations.set(E)}));let v;this._store.add(ve(x=>{if(f.read(x)&&!i.isCurrentlyBeingModifiedBy.read(x)&&v!==i.lastModifyingRequestId&&!t.read(x).identical){v=i.lastModifyingRequestId;let E=e.getPosition()??new ye(1,1),M=this._diffLineDecorations.getRanges(),N=M.findIndex(V=>V.containsPosition(E));if(N<0)for(N=0;N<M.length-1&&!(M[N].endLineNumber>=E.lineNumber);N++);this._currentIndex.set(N,void 0),e.revealRange(M[N])}})),this._store.add(ve(x=>{if(!f.read(x)){this._clearDiffRendering();return}if(!i.isCurrentlyBeingModifiedBy.read(x)||o){let E=this._editor.getOption(70);g.getOption(59).read(x),g.getOption(75).read(x);let M=i.reviewMode.read(x),N=t.read(x);this._updateDiffRendering(N,M,E)}}));let b=oGt.bindTo(s);this._store.add(ve(x=>{let E=g.positions.read(x)?.at(0);if(!E||!f.read(x)){b.reset();return}let N=t.read(x).changes.find(V=>V.modified.contains(E.lineNumber)||V.modified.isEmpty&&V.modified.startLineNumber===E.lineNumber);if(b.set(!!N),N){let V;N.modified.isEmpty?V=tn.diffLineDeleted:N.original.isEmpty?V=tn.diffLineInserted:V=tn.diffLineModified,this._accessibilitySignalsService.playSignal(V,{source:"chatEditingEditor.cursorPositionChanged"})}})),this._store.add(ve(x=>{if(!this._accessibleDiffViewVisible.read(x)||!f.read(x))return;let M=new xWi;e.addOverlayWidget(M),x.store.add(ee(()=>e.removeOverlayWidget(M))),x.store.add(l.createInstance($F,M.getDomNode(),f,(N,V)=>this._accessibleDiffViewVisible.set(N,V),Fo(!0),g.layoutInfo.map((N,V)=>N.width),g.layoutInfo.map((N,V)=>N.height),t.map(N=>N.changes.slice()),l.createInstance(kWi,t,e)))}));let S,y=()=>{S!==void 0&&(this._editor.updateOptions(S),S=void 0)};this._store.add(ee(y));let w=ke(this,x=>f.read(x)&&!!i.isCurrentlyBeingModifiedBy.read(x));this._store.add(ve(x=>{w.read(x)?(S??={readOnly:this._editor.getOption(104),stickyScroll:this._editor.getOption(131),codeLens:this._editor.getOption(23),guides:this._editor.getOption(22)},this._editor.updateOptions({readOnly:!0,stickyScroll:{enabled:!1},codeLens:!1,guides:{indentation:!1,bracketPairs:!1}})):y()}))}static{this._diffLineDecorationData=So.register({description:"diff-line-decoration"})}dispose(){this._clear(),this._store.dispose()}_clear(){this._diffLineDecorations.clear(),this._clearDiffRendering(),this._currentIndex.set(-1,void 0)}_clearDiffRendering(){this._editor.changeViewZones(i=>{for(let e of this._viewZones)i.removeZone(e)}),this._viewZones=[],this._diffHunksRenderStore.clear();for(let i of this._diffHunkWidgetPool.free)i.remove();this._diffVisualDecorations.clear()}_updateDiffRendering(i,e,t){let o=So.createDynamic({...Mde,stickiness:1}),n=So.createDynamic({...Mke,stickiness:1}),r=(v,b)=>So.createDynamic({description:"chat-editing-decoration",overviewRuler:{color:wp(v),position:1},minimap:{color:wp(b),position:2}}),s=r(ZZ,WDe),l=r(eee,VDe),c=r(tee,BDe);this._diffHunksRenderStore.clear(),this._diffHunkWidgets.length=0;let u=[];this._editor.changeViewZones(v=>{for(let E of this._viewZones)v.removeZone(E);this._viewZones=[];let b=[],S=i.originalModel.mightContainNonBasicASCII(),y=i.originalModel.mightContainRTL(),w=NT.fromEditor(this._editor),x=this._editor.getModel()?.getLineCount();for(let E of i.changes){let M=E.original;i.originalModel.tokenization.forceTokenization(Math.max(1,M.endLineNumberExclusive-1));let N=new AT(M.mapToLineArray(j=>i.originalModel.tokenization.getLineTokens(j)),[],S,y),V=[];if(e)for(let j of E.innerChanges||[])V.push(new wT(j.originalRange.delta(-(E.original.startLineNumber-1)),c4.className,0)),!(j.originalRange.isEmpty()&&j.originalRange.startLineNumber===1&&j.modifiedRange.endLineNumber===x)&&!j.modifiedRange.isEmpty()&&b.push({range:j.modifiedRange,options:o});let H=V.length===1&&V[0].range.isEmpty()&&E.original.startLineNumber===1;E.modified.isEmpty||b.push({range:E.modified.toInclusiveRange(),options:n}),E.original.isEmpty?b.push({range:E.modified.toInclusiveRange(),options:l}):E.modified.isEmpty?b.push({range:new G(E.modified.startLineNumber-1,1,E.modified.startLineNumber,1),options:c}):b.push({range:E.modified.toInclusiveRange(),options:s});let K=0;if(e&&!t){let j=document.createElement("div");j.className="chat-editing-original-zone view-lines line-delete monaco-mouse-cursor-text";let J=oM(N,w,V,j);if(K=J.heightInLines,!H){let se={afterLineNumber:E.modified.startLineNumber-1,heightInLines:J.heightInLines,domNode:j,ordinal:50002};this._viewZones.push(v.addZone(se))}}if(e||t){let j=this._diffHunkWidgetPool.get();j?j.update(i,E,this._editor.getModel().getVersionId(),H?0:K):j=this._editor.invokeWithinContext(J=>J.get(F).createInstance(C$,this._editor,i,E,this._editor.getModel().getVersionId(),H?0:K)),this._diffHunksRenderStore.add(ee(()=>{this._diffHunkWidgetPool.putBack(j)})),j.layout(E.modified.startLineNumber),this._diffHunkWidgets.push(j),u.push({range:E.modified.toInclusiveRange()??new G(E.modified.startLineNumber,1,E.modified.startLineNumber,Number.MAX_SAFE_INTEGER),options:{description:"diff-hunk-widget",stickiness:0}})}}this._diffVisualDecorations.set(t?[]:b)});let p=this._editor.createDecorationsCollection(u);this._diffHunksRenderStore.add(ee(()=>{p.clear()}));for(let v of this._diffHunkWidgetPool.free)v.remove();let h=vi(this._editor.onDidChangeCursorPosition,v=>this._editor.getPosition()),g=ke(v=>{let b=h.read(v);return b?p.getRanges().findIndex(y=>y.containsPosition(b)):-1}),f=v=>{let b=g.get();for(let S=0;S<this._diffHunkWidgets.length;S++){let y=this._diffHunkWidgets[S];y.toggle(y===v||S===b)}};this._diffHunksRenderStore.add(ve(v=>{let b=g.read(v),S=this._diffHunkWidgets[b];f(S)})),this._diffHunksRenderStore.add(this._editor.onMouseUp(v=>{if(v.target.type===8){let b=v.target.detail;this._viewZones.findIndex(y=>y===b.viewZoneId)>=0&&(this._editor.setPosition(v.target.position),this._editor.focus())}})),this._diffHunksRenderStore.add(this._editor.onMouseMove(v=>{if(v.target.type===12){let b=v.target.detail,S=this._diffHunkWidgets.find(y=>y.getId()===b);f(S)}else if(v.target.type===8){let b=v.target.detail,S=this._viewZones.findIndex(y=>y===b.viewZoneId);f(this._diffHunkWidgets[S])}else if(v.target.position){let{position:b}=v.target,S=p.getRanges().findIndex(y=>y.containsPosition(b));f(this._diffHunkWidgets[S])}else f(void 0)})),this._diffHunksRenderStore.add(U.any(this._editor.onDidScrollChange,this._editor.onDidLayoutChange)(()=>{for(let v=0;v<this._diffHunkWidgets.length;v++){let b=this._diffHunkWidgets[v],S=p.getRange(v);S?b.layout(S?.startLineNumber):b.dispose()}}))}enableAccessibleDiffView(){this._accessibleDiffViewVisible.set(!0,void 0)}reveal(i,e){let t=this._diffLineDecorations.getRanges().sort((r,s)=>G.compareRangesUsingStarts(r,s)),o=i?0:t.length-1,n=t.at(o);n&&(this._editor.setPosition(n.getStartPosition()),this._editor.revealRange(n),e||this._editor.focus(),this._currentIndex.set(o,void 0))}next(i){return this._reveal(!0,!i)}previous(i){return this._reveal(!1,!i)}_reveal(i,e){let t=this._editor.getPosition();if(!t)return this._currentIndex.set(-1,void 0),!1;let o=this._diffLineDecorations.getRanges().sort((l,c)=>G.compareRangesUsingStarts(l,c));if(o.length===0)return this._currentIndex.set(-1,void 0),!1;let n=-1;for(let l=0;l<o.length;l++){let c=o[l];if(c.containsPosition(t)){n=l+(i?1:-1);break}else if(ye.isBefore(t,c.getStartPosition())){n=i?l:l-1;break}}if(e&&(n<0||n>=o.length))return!1;n=(n+o.length)%o.length,this._currentIndex.set(n,void 0);let r=o[n],s=i?r.getStartPosition():r.getEndPosition();return this._editor.setPosition(s),this._editor.revealPositionInCenter(r.getStartPosition().delta(-1)),this._editor.focus(),!0}_findClosestWidget(){if(!this._editor.hasModel())return;let i=this._editor.getTopForLineNumber(this._editor.getPosition().lineNumber)-this._editor.getScrollTop(),e,t=Number.MAX_VALUE;for(let o of this._diffHunkWidgets){let n=o.getPosition()?.preference?.top;if(n!==void 0){let r=Math.abs(n-i);r<t&&(t=r,e=o)}}return e}async rejectNearestChange(i){i=i??this._findClosestWidget(),i instanceof C$&&(await i.reject(),this.next(!0))}async acceptNearestChange(i){i=i??this._findClosestWidget(),i instanceof C$&&(await i.accept(),this.next(!0))}async toggleDiff(i,e){if(!this._editor.hasModel())return;let t=this._editor.getSelection();if(i instanceof C$){let n=i.getStartLineNumber(),r=n?new ye(n,1):void 0;r&&!t.containsPosition(r)&&(t=ei.fromPositions(r))}let o=this._editor.getOption(70);if(e!==void 0?e:!o){let n=await this._editorService.openEditor({original:{resource:this._entry.originalURI},modified:{resource:this._entry.modifiedURI},options:{selection:t},label:d(7941,null,Be(this._entry.modifiedURI))});if(n&&n.input){n.getControl()?.setSelection(t);let r=ve(s=>{let l=this._entry.state.read(s);if(l===1||l===2){r.dispose();let c=[];for(let u of this._editorService.getEditors(0))qD(u.editor)&&ze(u.editor.original.resource,this._entry.originalURI)&&ze(u.editor.modified.resource,this._entry.modifiedURI)&&c.push(u);this._editorService.closeEditors(c)}})}}else await this._editorService.openEditor({resource:this._entry.modifiedURI,options:{selection:t,selectionRevealType:3}})}};w$=I([m(4,ie),m(5,br),m(6,X),m(7,F),m(8,mu),m(9,lbe),m(10,Lt),m(11,Gt)],w$);var C$=class{constructor(i,e,t,o,n,r){this._editor=i;this._diffInfo=e;this._change=t;this._versionId=o;this._lineDelta=n;this._id=`diff-change-widget-${C$._idPool++}`;this._store=new O;this._removed=!1;this._domNode=document.createElement("div"),this._domNode.className="chat-diff-change-content-widget";let s=r.createInstance(pr,this._domNode,R.ChatEditingEditorHunk,{telemetrySource:"chatEditingEditorHunk",hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{renderShortTitle:!0,arg:this},actionViewItemProvider:(l,c)=>{let u=l.id==="chatEditor.action.acceptHunk";if(!l.class)return new class extends ts{constructor(){super(void 0,l,{...c,keybindingNotRenderedWithLabel:!0,icon:!1,label:!0})}render(p){super.render(p),u&&this.element?.classList.add("primary")}}}});this._store.add(s),this._store.add(s.actionRunner.onWillRun(l=>i.focus())),this._editor.addOverlayWidget(this)}static{this._idPool=0}update(i,e,t,o){this._diffInfo=i,this._change=e,this._versionId=t,this._lineDelta=o}dispose(){this._store.dispose(),this._editor.removeOverlayWidget(this),this._removed=!0}getId(){return this._id}layout(i){let e=this._editor.getOption(75),{contentLeft:t,contentWidth:o,verticalScrollbarWidth:n}=this._editor.getLayoutInfo(),r=this._editor.getScrollTop();this._position={stackOrdinal:1,preference:{top:this._editor.getTopForLineNumber(i)-r-e*this._lineDelta,left:t+o-(2*n+Dc(this._domNode))}},this._removed?(this._removed=!1,this._editor.addOverlayWidget(this)):this._editor.layoutOverlayWidget(this),this._lastStartLineNumber=i}remove(){this._editor.removeOverlayWidget(this),this._removed=!0}toggle(i){this._domNode.classList.toggle("hover",i),this._lastStartLineNumber&&this.layout(this._lastStartLineNumber)}getDomNode(){return this._domNode}getPosition(){return this._position??null}getStartLineNumber(){return this._lastStartLineNumber}async reject(){return this._versionId!==this._editor.getModel()?.getVersionId()?!1:await this._diffInfo.undo(this._change)}async accept(){return this._versionId!==this._editor.getModel()?.getVersionId()?!1:this._diffInfo.keep(this._change)}};C$=I([m(5,F)],C$);var xWi=class{constructor(){this._domNode=document.createElement("div"),this._domNode.className="accessible-diff-view",this._domNode.style.width="100%",this._domNode.style.position="absolute"}getId(){return"chatEdits.accessibleDiffView"}getDomNode(){return this._domNode}getPosition(){return{preference:{top:0,left:0},stackOrdinal:1}}},kWi=class{constructor(i,e){this._documentDiffInfo=i;this._editor=e}getOriginalModel(){return this._documentDiffInfo.get().originalModel}getOriginalOptions(){return this._editor.getOptions()}originalReveal(i){let e=this._documentDiffInfo.get().changes,t=e.findIndex(o=>o.original.intersect(vo.fromRange(i)));t>=0&&(i=e[t].modified.toInclusiveRange()??i),this.modifiedReveal(i)}getModifiedModel(){return this._editor.getModel()}getModifiedOptions(){return this._editor.getOptions()}modifiedReveal(i){i&&(this._editor.revealRange(i),this._editor.setSelection(i)),this._editor.focus()}modifiedSetSelection(i){this._editor.setSelection(i)}modifiedFocus(){this._editor.focus()}getModifiedPosition(){return this._editor.getPosition()??void 0}};var x$=Object.freeze({identical:!0,quitEarly:!1,changes:Object.freeze([]),moves:Object.freeze([])});var DV=class extends k{constructor(e,t,o,n,r,s){super();this.originalModel=e;this.modifiedModel=t;this.state=o;this._editorWorkerService=r;this._accessibilitySignalService=s;this._isEditFromUs=!1;this._allEditsAreFromUs=!0;this._diffOperationIds=0;this._diffInfo=De(this,x$);this._editDecorationClear=this._register(new Dt(()=>{this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,[])},500));this._editDecorations=[];this._didAcceptOrRejectAllHunks=this._register(new T);this.onDidAcceptOrRejectAllHunks=this._didAcceptOrRejectAllHunks.event;this._didAcceptOrRejectLines=this._register(new T);this.onDidAcceptOrRejectLines=this._didAcceptOrRejectLines.event;this._didUserEditModelFired=!1;this._didUserEditModel=this._register(new T);this.onDidUserEditModel=this._didUserEditModel.event;this._originalToModifiedEdit=Ad.empty;this.lineChangeCount=0;this.linesAdded=0;this.linesRemoved=0;this._isExternalEditInProgress=n,this._register(this.modifiedModel.onDidChangeContent(l=>{this._mirrorEdits(l)})),this._register(ee(()=>{this.clearCurrentEditLineDecoration()})),this._register(ve(l=>this.updateLineChangeCount(this._diffInfo.read(l)))),e.equalsTextBuffer(t.getTextBuffer())||this._updateDiffInfoSeq()}static{this._lastEditDecorationOptions=So.register({isWholeLine:!0,description:"chat-last-edit",className:"chat-editing-last-edit-line",marginClassName:"chat-editing-last-edit",overviewRuler:{position:7,color:wp(qv)}})}static{this._pendingEditDecorationOptions=So.register({isWholeLine:!0,description:"chat-pending-edit",className:"chat-editing-pending-edit",minimap:{position:1,color:wp(SWi)}})}static{this._atomicEditDecorationOptions=So.register({isWholeLine:!0,description:"chat-atomic-edit",className:"chat-editing-atomic-edit",minimap:{position:1,color:wp(SWi)}})}get isEditFromUs(){return this._isEditFromUs}get allEditsAreFromUs(){return this._allEditsAreFromUs}get diffInfo(){return this._diffInfo.map(e=>({...e,originalModel:this.originalModel,modifiedModel:this.modifiedModel,keep:t=>this._keepHunk(t),undo:t=>this._undoHunk(t)}))}notifyHunkAction(e,t){t.lineCount>0&&this._didAcceptOrRejectLines.fire({state:e,...t})}updateLineChangeCount(e){this.lineChangeCount=0,this.linesAdded=0,this.linesRemoved=0;for(let t of e.changes){let o=t.modified.endLineNumberExclusive-t.modified.startLineNumber;this.linesAdded+=Math.max(0,o);let n=t.original.endLineNumberExclusive-t.original.startLineNumber;this.linesRemoved+=Math.max(0,n),this.lineChangeCount+=Math.max(o,n)}}clearCurrentEditLineDecoration(){this.modifiedModel.isDisposed()||(this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,[]))}async areOriginalAndModifiedIdentical(){let e=await this._diffOperation;return e?e.identical:!1}async acceptAgentEdits(e,t,o,n){To(t.every(hT.isTextEdit),"INVALID args, can only handle text edits"),Aw(ze(e,this.modifiedModel.uri)," INVALID args, can only edit THIS document");let r=t.length>0&&o,s=0,l=0,c=this._createEditSource(n);if(r){let p=(await this._editorWorkerService.computeMoreMinimalEdits(this.modifiedModel.uri,t)??t).map(hT.asEditOperation),h=this._applyEdits(p,c);if(h.length>0){let g;for(let f=0;f<h.length;f++){let v=h[f];g?g=G.plusRange(g,v.range):g=G.lift(v.range)}if(g){let f=new Mo,v=$(Me(void 0),"animationend",b=>{b.animationName==="kf-chat-editing-atomic-edit"&&(f.complete(),v.dispose())});this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,[{options:DV._atomicEditDecorationOptions,range:g}]),await Promise.any([f.p,Li(500)]),v.dispose()}}}else{let u=t.map(hT.asEditOperation);s=this._applyEdits(u,c).reduce((g,f)=>Math.max(g,f.range.startLineNumber),0),l=Math.min(1,s/this.modifiedModel.getLineCount());let h=[{options:DV._pendingEditDecorationOptions,range:new G(s+1,1,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER)}];s>0&&h.push({options:DV._lastEditDecorationOptions,range:new G(s,1,s,Number.MAX_SAFE_INTEGER)}),this._editDecorations=this.modifiedModel.deltaDecorations(this._editDecorations,h)}return o&&(this._updateDiffInfoSeq(),this._editDecorationClear.schedule()),{rewriteRatio:l,maxLineNumber:s}}_createEditSource(e){if(!e)return sd.unknown({name:"editSessionUndoRedo"});let t=jp(e.session.sessionResource),o=e.session.getRequests().at(-1),n=this.modifiedModel.getLanguageId(),r=e.agent,s=CIt.tryCreate(r?.extensionId.value,r?.extensionVersion);return e.request?.locationData?.type==="editor"?sd.inlineChatApplyEdit({modelId:o?.modelId,requestId:o?.id,sessionId:t,languageId:n,extensionId:s}):sd.chatApplyEdits({modelId:o?.modelId,requestId:o?.id,sessionId:t,languageId:n,mode:o?.modeInfo?.modeId,extensionId:s,codeBlockSuggestionId:o?.modeInfo?.applyCodeBlockSuggestionId})}_applyEdits(e,t){if(e.length===0)return[];try{this._isEditFromUs=!0;let o=[];return this.modifiedModel.pushEditOperations(null,e,n=>(o=n,null),void 0,t),o}finally{this._isEditFromUs=!1}}keep(){this.notifyHunkAction("accepted",{linesAdded:this.linesAdded,linesRemoved:this.linesRemoved,lineCount:this.lineChangeCount,hasRemainingEdits:!1}),this.originalModel.setValue(this.modifiedModel.createSnapshot()),this._reset()}undo(){this.notifyHunkAction("rejected",{linesAdded:this.linesAdded,linesRemoved:this.linesRemoved,lineCount:this.lineChangeCount,hasRemainingEdits:!1}),this.modifiedModel.pushStackElement(),this._applyEdits([Qn.replace(this.modifiedModel.getFullModelRange(),this.originalModel.getValue())],sd.chatUndoEdits()),this.modifiedModel.pushStackElement(),this._reset()}_reset(){this._originalToModifiedEdit=Ad.empty,this._diffInfo.set(x$,void 0),this._didUserEditModelFired=!1}async resetDocumentValues(e,t){let o=!1;e!==void 0&&(this.originalModel.setValue(e),o=!0),t!==void 0&&this.modifiedModel.getValue()!==t&&(this.modifiedModel.pushStackElement(),this._applyEdits([Qn.replace(this.modifiedModel.getFullModelRange(),t)],sd.chatReset()),this.modifiedModel.pushStackElement(),o=!0),o&&await this._updateDiffInfoSeq()}_mirrorEdits(e){let t=AX(e.changes),o=this._isExternalEditInProgress?.();if(this._isEditFromUs||o){let n=this._originalToModifiedEdit,r=t;this._originalToModifiedEdit=n.compose(r),o&&this._updateDiffInfoSeq()}else{let n=this._originalToModifiedEdit,r=t,s=r.tryRebase(n.inverse(this.originalModel.getValue()));if(s===void 0)this._originalToModifiedEdit=n.compose(r);else{let l=iJi(s,this.originalModel);this.originalModel.applyEdits(l),this._originalToModifiedEdit=n.rebaseSkipConflicting(s)}this._allEditsAreFromUs=!1,this._updateDiffInfoSeq(),this._didUserEditModelFired||(this._didUserEditModelFired=!0,this._didUserEditModel.fire())}}async _keepHunk(e){if(!this._diffInfo.get().changes.includes(e))return!1;let t=[];for(let o of e.innerChanges??[]){let n=this.modifiedModel.getValueInRange(o.modifiedRange);t.push(Qn.replace(o.originalRange,n))}return this.originalModel.pushEditOperations(null,t,o=>null),await this._updateDiffInfoSeq("accepted"),this._diffInfo.get().identical&&this._didAcceptOrRejectAllHunks.fire(1),this._accessibilitySignalService.playSignal(tn.editsKept,{allowManyInParallel:!0}),!0}async _undoHunk(e){if(!this._diffInfo.get().changes.includes(e))return!1;let t=[];for(let o of e.innerChanges??[]){let n=this.originalModel.getValueInRange(o.originalRange);t.push(Qn.replace(o.modifiedRange,n))}return this.modifiedModel.pushEditOperations(null,t,o=>null),await this._updateDiffInfoSeq("rejected"),this._diffInfo.get().identical&&this._didAcceptOrRejectAllHunks.fire(2),this._accessibilitySignalService.playSignal(tn.editsUndone,{allowManyInParallel:!0}),!0}async getDiffInfo(){return this._diffOperation||this._updateDiffInfoSeq(),await this._diffOperation,this._diffInfo.get()}async _updateDiffInfoSeq(e=void 0){let t=++this._diffOperationIds;await Promise.resolve(this._diffOperation);let o=this.lineChangeCount,n=this.linesAdded,r=this.linesRemoved;if(this._diffOperationIds===t){let s=this._updateDiffInfo();if(this._diffOperation=s,await s,e){let l={linesAdded:n-this.linesAdded,linesRemoved:r-this.linesRemoved,lineCount:o-this.lineChangeCount,hasRemainingEdits:this.lineChangeCount>0};this.notifyHunkAction(e,l)}}}hasHunkAt(e){return this._diffInfo.get().changes.some(t=>t.modified.intersectsStrict(vo.fromRangeInclusive(e)))}async _updateDiffInfo(){if(this.originalModel.isDisposed()||this.modifiedModel.isDisposed()||this._store.isDisposed)return;if(this.state.get()!==0)return this._diffInfo.set(x$,void 0),this._originalToModifiedEdit=Ad.empty,x$;let e=this.modifiedModel.getVersionId(),t=this.originalModel.getVersionId(),o=await this._editorWorkerService.computeDiff(this.originalModel.uri,this.modifiedModel.uri,{ignoreTrimWhitespace:!1,computeMoves:!1,maxComputationTimeMs:3e3},"advanced");if(!(this.originalModel.isDisposed()||this.modifiedModel.isDisposed()||this._store.isDisposed)&&this.modifiedModel.getVersionId()===e&&this.originalModel.getVersionId()===t){let n=o??x$;return this._diffInfo.set(n,void 0),this._originalToModifiedEdit=oJi(this.originalModel,this.modifiedModel,n.changes),n}}};DV=I([m(4,Qs),m(5,br)],DV);var ore=class extends KE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(e.object.textEditorModel.uri,o,n,p,h,g,v,b,S,y);this._multiDiffEntryDelegate=t;this._textFileService=f;this._editorWorkerService=w;this._docFileEditorModel=this._register(e).object,this.modifiedModel=e.object.textEditorModel,this.originalURI=ZR.getFileURI(o.sessionResource,this.entryId,this.modifiedURI.path),this.initialContent=r??this.modifiedModel.getValue();let x=this.originalModel=this._register(l.createModel(Uk(r!==void 0?MDe(r):this.modifiedModel.createSnapshot()),u.createById(this.modifiedModel.getLanguageId()),this.originalURI,!1));this._textModelChangeService=this._register(S.createInstance(DV,this.originalModel,this.modifiedModel,this._stateObs,()=>this._isExternalEditInProgress)),this._register(this._textModelChangeService.onDidAcceptOrRejectAllHunks(M=>{this._stateObs.set(M,void 0),this._notifySessionAction(M===1?"accepted":"rejected")})),this._register(this._textModelChangeService.onDidAcceptOrRejectLines(M=>{this._notifyAction({kind:"chatEditingHunkAction",uri:this.modifiedURI,outcome:M.state,languageId:this.modifiedModel.getLanguageId(),...M})})),(async()=>{let M=await c.createModelReference(x.uri);if(this._store.isDisposed){M.dispose();return}this._register(M)})(),this._register(this._textModelChangeService.onDidUserEditModel(()=>{this._userEditScheduler.schedule();let M=this.modifiedModel.getValue()===this.initialContent;this._stateObs.get()===0&&M&&this._stateObs.set(2,void 0)}));let E=this._register(new ue);this._register(ve(M=>{if(this._waitsForLastEdits.read(M)){let V=this._lastModifyingResponseObs.read(M),H=V&&V.session.getRequests().find(K=>K.id===V.requestId);E.value=s.installResourceFilter(this.modifiedURI,H?.message.text||d(7994,null))}else E.clear()}))}get changesCount(){return this._textModelChangeService.diffInfo.map(e=>e.changes.length)}get diffInfo(){return this._textModelChangeService.diffInfo}get linesAdded(){return this._textModelChangeService.diffInfo.map(e=>{let t=0;for(let o of e.changes)t+=Math.max(0,o.modified.endLineNumberExclusive-o.modified.startLineNumber);return t})}get linesRemoved(){return this._textModelChangeService.diffInfo.map(e=>{let t=0;for(let o of e.changes)t+=Math.max(0,o.original.endLineNumberExclusive-o.original.startLineNumber);return t})}getDiffInfo(){return this._textModelChangeService.getDiffInfo()}equalsSnapshot(e){return!!e&&ze(this.modifiedURI,e.resource)&&this.modifiedModel.getLanguageId()===e.languageId&&this.originalModel.getValue()===e.original&&this.modifiedModel.getValue()===e.current&&this.state.get()===e.state}createSnapshot(e,t,o){return{resource:this.modifiedURI,languageId:this.modifiedModel.getLanguageId(),snapshotUri:y$.getSnapshotFileURI(e,t,o,this.modifiedURI.path),original:this.originalModel.getValue(),current:this.modifiedModel.getValue(),state:this.state.get(),telemetryInfo:this._telemetryInfo}}getCurrentContents(){return this.modifiedModel.getValue()}async restoreFromSnapshot(e,t=!0){this._stateObs.set(e.state,void 0),await this._textModelChangeService.resetDocumentValues(e.original,t?e.current:void 0)}async resetToInitialContent(){await this._textModelChangeService.resetDocumentValues(void 0,this.initialContent)}async resetEditTrackerToInitialContent(){await this._textModelChangeService.resetDocumentValues(this.initialContent,void 0)}async _areOriginalAndModifiedIdentical(){return this._textModelChangeService.areOriginalAndModifiedIdentical()}_resetEditsState(e){super._resetEditsState(e),this._textModelChangeService.clearCurrentEditLineDecoration()}_createUndoRedoElement(e){let t=e.session.getRequests().find(n=>n.id===e.requestId),o=t?.message.text?d(7992,null,t.message.text):d(7993,null);return new JL(o,"chat.edit",this.modifiedModel,null)}async acceptAgentEdits(e,t,o,n){let r=await this._textModelChangeService.acceptAgentEdits(e,t,o,n);Ki(s=>{this._waitsForLastEdits.set(!o,s),this._stateObs.set(0,s),o?(this._resetEditsState(s),this._rewriteRatioObs.set(1,s)):this._rewriteRatioObs.set(r.rewriteRatio,s)}),o&&this._shouldAutoSave()&&await this._textFileService.save(this.modifiedModel.uri,{reason:2,skipSaveParticipants:!0})}async _doAccept(){if(this._textModelChangeService.keep(),this._multiDiffEntryDelegate.collapse(void 0),!this._fileConfigService.getAutoSaveConfiguration(this.modifiedURI).autoSave||!this._textFileService.isDirty(this.modifiedURI))try{await this._textFileService.save(this.modifiedURI,{reason:1,force:!0,ignoreErrorHandler:!0})}catch{}}async _doReject(){this.createdInRequestId===this._telemetryInfo.requestId?(DXe(this._docFileEditorModel)&&(await this._docFileEditorModel.revert({soft:!0}),await this._fileService.del(this.modifiedURI).catch(e=>{})),this._onDidDelete.fire()):(this._textModelChangeService.undo(),this._textModelChangeService.allEditsAreFromUs&&DXe(this._docFileEditorModel)&&this._shouldAutoSave()&&await this._docFileEditorModel.save({reason:1,skipSaveParticipants:!0}),this._multiDiffEntryDelegate.collapse(void 0))}_createEditorIntegration(e){let t=da(e.getControl());To(t);let o=this._textModelChangeService.diffInfo;return this._instantiationService.createInstance(w$,this,t,o,!1)}_shouldAutoSave(){return this.modifiedURI.scheme!==Q.untitled}async computeEditsFromSnapshots(e,t){let o=await this._editorWorkerService.computeStringEditFromDiff(e,t,{maxComputationTimeMs:5e3},"advanced");return lm.fromStringEdit(o,new _I(e)).replacements.slice()}async save(){this.modifiedModel.uri.scheme!==Q.untitled&&this._textFileService.isDirty(this.modifiedModel.uri)&&await this._textFileService.save(this.modifiedModel.uri,{reason:1,skipSaveParticipants:!0})}async revertToDisk(){if(this.modifiedModel.uri.scheme===Q.untitled)return;let e=this._textFileService.files.get(this.modifiedModel.uri);e&&!e.isDisposed()&&await e.revert({soft:!1})}};ore=I([m(5,ha),m(6,_t),m(7,Bt),m(8,Rt),m(9,B),m(10,fr),m(11,si),m(12,Uo),m(13,ge),m(14,wl),m(15,F),m(16,XS),m(17,Qs)],ore);var rHe=class{constructor(i,e){this.notebook=i;this._notebookService=e;this.textEdits=[]}acceptTextEdits(i){i.length&&this.textEdits.push(...i)}async generateEdits(){if(this.notebook.cells.length)return console.error("Notebook edits not generated as notebook already has cells"),[];let i=this.generateContent();if(!i)return[];let e=[];try{let{serializer:t}=await this._notebookService.withNotebookDataProvider(this.notebook.viewType),o=await t.dataToNotebook(Ke.fromString(i));for(let n=0;n<o.cells.length;n++)e.push({editType:1,index:n,count:0,cells:[o.cells[n]]})}catch(t){return console.error(`Failed to generate notebook edits from text edits ${i}`,t),[]}return e}generateContent(){try{return TSn(this.textEdits)}catch(i){return console.error("Failed to generate content from text edits",i),""}}};rHe=I([m(1,kn)],rHe);function TSn(a){let i="";for(let e of a)i=i.slice(0,e.range.startColumn)+e.text+i.slice(e.range.endColumn);return i}var sHe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.notebookUri=e;this.cell=t;this.modifiedModel=o;this.originalModel=n;this.notebookEditorService=l;this.instantiationService=c;this._maxModifiedLineNumber=De(this,0);this.maxModifiedLineNumber=this._maxModifiedLineNumber;this._stateObs=De(this,0);this.state=this._stateObs;this.initialContent=this.originalModel.getValue(),this._register(s),this._textModelChangeService=this._register(this.instantiationService.createInstance(DV,this.originalModel,this.modifiedModel,this.state,r)),this._register(this._textModelChangeService.onDidAcceptOrRejectAllHunks(u=>{this.revertMarkdownPreviewState(),this._stateObs.set(u,void 0)})),this._register(this._textModelChangeService.onDidUserEditModel(()=>{let u=this.modifiedModel.getValue()===this.initialContent;this._stateObs.get()===0&&u&&this._stateObs.set(2,void 0)}))}get isDisposed(){return this._store.isDisposed}get isEditFromUs(){return this._textModelChangeService.isEditFromUs}get allEditsAreFromUs(){return this._textModelChangeService.allEditsAreFromUs}get diffInfo(){return this._textModelChangeService.diffInfo}clearCurrentEditLineDecoration(){this.modifiedModel.isDisposed()||this._textModelChangeService.clearCurrentEditLineDecoration()}async acceptAgentEdits(e,t,o){let{maxLineNumber:n}=await this._textModelChangeService.acceptAgentEdits(this.modifiedModel.uri,e,t,o);Ki(r=>{t?this._maxModifiedLineNumber.set(0,r):(this._stateObs.set(0,r),this._maxModifiedLineNumber.set(n,r))})}revertMarkdownPreviewState(){if(this.cell.cellKind!==1)return;let e=this.notebookEditorService.retrieveExistingWidgetFromURI(this.notebookUri)?.value;if(e){let t=e.getCellByHandle(this.cell.handle);t?.getEditState()===1&&(t.editStateSource==="chatEdit"||t.editStateSource==="chatEditNavigation")&&t?.updateEditState(0,"chatEdit")}}async keep(e){return this._textModelChangeService.diffInfo.get().keep(e)}async undo(e){return this._textModelChangeService.diffInfo.get().undo(e)}};sHe=I([m(6,hd),m(7,F)],sHe);var E4t=class extends k{constructor(e){super();this.notebookEditor=e;this.decorators=this._register(new O)}apply(e){let t=this.notebookEditor.textModel;if(!t)return;let o=[];for(let r of e)if(r.type==="modified"){let s=t.cells[r.modifiedCellIndex];o.push(s)}let n=this.notebookEditor.deltaCellDecorations([],o.map(r=>({handle:r.handle,options:{overviewRuler:{color:ZZ,modelRanges:[],includeOutput:!0,position:7}}})));this.clear(),this.decorators.add(ee(()=>{this.notebookEditor.isDisposed||this.notebookEditor.deltaCellDecorations(n,[])}))}clear(){this.decorators.clear()}};function Ylt(a){return a.reduce((i,e)=>{let t=e.diff.get();if(t.identical)return i;switch(e.type){case"delete":return i+1;case"insert":return i+1;case"modified":return i+t.changes.length;default:return i}},0)}function eL(a){let i=new Map;return a.forEach((e,t)=>i.set(e,t)),[...a].sort((e,t)=>{if((e.type==="unchanged"||e.type==="modified")&&(t.type==="unchanged"||t.type==="modified"))return e.modifiedCellIndex-t.modifiedCellIndex;if(e.type==="delete"&&t.type==="delete")return e.originalCellIndex-t.originalCellIndex;if(e.type==="insert"&&t.type==="insert")return e.modifiedCellIndex-t.modifiedCellIndex;if(e.type==="delete"&&t.type==="insert"||e.type==="insert"&&t.type==="delete")return i.get(e)-i.get(t);if(e.type==="delete"&&t.type!=="insert"||e.type!=="insert"&&t.type==="delete")return e.originalCellIndex-t.originalCellIndex;let o=e.type==="delete"?e.originalCellIndex:(e.type==="insert",e.modifiedCellIndex),n=t.type==="delete"?t.originalCellIndex:(t.type==="insert",t.modifiedCellIndex);return o-n})}var aHe=class extends k{constructor(e,t,o,n){super();this.notebookEditor=e;this.notebookModel=t;this.instantiationService=o;this.accessibilitySignalService=n;this._timeout=void 0;this.overlayDisposables=this._register(new O)}decorate(e){this._timeout!==void 0&&clearTimeout(this._timeout),this._timeout=setTimeout(()=>{this._timeout=void 0,this.createMarkdownPreviewToolbars(e)},100)}createMarkdownPreviewToolbars(e){this.overlayDisposables.clear();let t=this.accessibilitySignalService,o=this.notebookEditor;for(let n of e){let r=this.getCellViewModel(n);if(!r||r.cellKind!==1)continue;let s=document.createElement("div"),l;o.changeCellOverlays(g=>{s.style.right="44px",l=g.addOverlay({cell:r,domNode:s})});let c=()=>{o.changeCellOverlays(g=>{l&&g.removeOverlay(l)})};this.overlayDisposables.add({dispose:c});let u=document.createElement("div");s.appendChild(u),u.className="chat-diff-change-content-widget",u.classList.add("hover"),u.style.position="relative",u.style.top="18px",u.style.zIndex="10",u.style.display=r.getEditState()===1?"none":"block",this.overlayDisposables.add(r.onDidChangeState(g=>{g.editStateChanged&&(r.getEditState()===1?u.style.display="none":u.style.display="block")}));let h=this._register(this.instantiationService.createChild(new Po([X,this.notebookEditor.scopedContextKeyService]))).createInstance(pr,u,R.ChatEditingEditorHunk,{telemetrySource:"chatEditingNotebookHunk",hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},menuOptions:{renderShortTitle:!0,arg:{async accept(){t.playSignal(tn.editsKept,{allowManyInParallel:!0}),c(),h.dispose();for(let g of n.diff.get().changes)await n.keep(g);return!0},async reject(){t.playSignal(tn.editsUndone,{allowManyInParallel:!0}),c(),h.dispose();for(let g of n.diff.get().changes)await n.undo(g);return!0}}},actionViewItemProvider:(g,f)=>{if(!g.class)return new class extends ts{constructor(){super(void 0,g,{...f,keybindingNotRenderedWithLabel:!0,icon:!1,label:!0})}}}});this.overlayDisposables.add(h)}}getCellViewModel(e){if(e.type==="delete"||e.modifiedCellIndex===void 0)return;let t=this.notebookModel.cells[e.modifiedCellIndex];return this.notebookEditor.getViewModel()?.viewCells.find(n=>n.handle===t.handle)}dispose(){super.dispose(),this._timeout!==void 0&&clearTimeout(this._timeout)}};aHe=I([m(2,F),m(3,br)],aHe);var lHe=class extends k{constructor(e,t,o,n,r,s){super();this.instantiationService=s;let l=lr(t);To(l),this.notebookEditor=l,this.integration=this.instantiationService.createInstance(cHe,e,l,o,n,r),this._register(t.onDidChangeControl(()=>{let c=lr(t);c&&c!==this.notebookEditor&&(this.notebookEditor=c,this.integration.dispose(),this.integration=this.instantiationService.createInstance(cHe,e,c,o,n,r))}))}get currentIndex(){return this.integration.currentIndex}reveal(e){return this.integration.reveal(e)}next(e){return this.integration.next(e)}previous(e){return this.integration.previous(e)}enableAccessibleDiffView(){this.integration.enableAccessibleDiffView()}acceptNearestChange(e){return this.integration.acceptNearestChange(e)}rejectNearestChange(e){return this.integration.rejectNearestChange(e)}toggleDiff(e,t){return this.integration.toggleDiff(e,t)}dispose(){this.integration.dispose(),super.dispose()}};lHe=I([m(5,F)],lHe);var cHe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._entry=e;this.notebookEditor=t;this.notebookModel=o;this.cellChanges=r;this.instantiationService=s;this._editorService=l;this.accessibilitySignalService=u;this.logService=p;this._currentIndex=De(this,-1);this.currentIndex=this._currentIndex;this.cellEditorIntegrations=new Map;this.markdownEditState=De(this,"");this.markupCellListeners=new Map;this.sortedCellChanges=[];this.changeIndexComputer=new fD(new Uint32Array(0));let h=vA(vi(t.onDidChangeVisibleRanges,()=>t.visibleRanges),50);this._register(ee(()=>{this.markupCellListeners.forEach(y=>y.dispose())}));let g,f=e.isCurrentlyBeingModifiedBy.map(y=>!!y);this._register(ve(y=>{let w=f.read(y),x=c.retrieveExistingWidgetFromURI(e.modifiedURI)?.value;if(x){if(w)g??=x.isReadOnly,x.setOptions({isReadOnly:!0});else if(g===!1){x.setOptions({isReadOnly:!1});let E=setTimeout(()=>{x.setOptions({isReadOnly:!0}),x.setOptions({isReadOnly:!1}),M.dispose()},100),M=ee(()=>clearTimeout(E));y.store.add(M)}}}));let v;this._store.add(ve(y=>{!e.isCurrentlyBeingModifiedBy.read(y)&&!e.isProcessingResponse.read(y)&&v!==e.lastModifyingRequestId&&r.read(y).some(w=>w.type!=="unchanged"&&!w.diff.read(y).identical)&&(v=e.lastModifyingRequestId,this.sortedCellChanges.find(x=>{if(x.type==="unchanged")return!1;let E=x.modifiedCellIndex??x.originalCellIndex;return this.notebookEditor.visibleRanges.some(M=>E>=M.start&&E<M.end)})||this.reveal(!0))})),this._register(ve(y=>{this.sortedCellChanges=eL(r.read(y));let w=[];for(let x of this.sortedCellChanges)w.push(x.type==="insert"||x.type==="delete"?1:x.type==="modified"?x.diff.read(y).changes.length:0);this.changeIndexComputer=new fD(new Uint32Array(w)),this.changeIndexComputer.getTotalSum()===0&&this.revertMarkupCellState()})),this._register(ve(y=>{if(this.notebookEditor.textModel!==this.notebookModel)return;let x=eL(r.read(y)).filter(M=>M.type!=="delete");if(h.read(y),!x.length){this.cellEditorIntegrations.forEach(({diff:M})=>{M.set({...M.read(void 0),...x$},void 0)});return}this.markdownEditState.read(y);let E=new Set;x.forEach(M=>{if(M.modifiedCellIndex===void 0||M.modifiedCellIndex>=o.cells.length)return;let N=o.cells[M.modifiedCellIndex],V=t.codeEditors.find(([se])=>se.handle===o.cells[M.modifiedCellIndex].handle)?.[1],H=M.modifiedModel.promiseResult.read(y)?.data,K=M.originalModel.promiseResult.read(y)?.data;if(!N||!K||!H)return;if(N.cellKind===1&&!this.markupCellListeners.has(N.handle)){let se=this.notebookEditor.getViewModel()?.viewCells.find(ae=>ae.handle===N.handle);if(se){let ae=se.onDidChangeState(ce=>{ce.editStateChanged&&setTimeout(()=>this.markdownEditState.set(se.handle+"-"+se.getEditState(),void 0),0)});this.markupCellListeners.set(N.handle,ae)}}if(!V)return;let j={...M.diff.read(y),modifiedModel:H,originalModel:K,keep:M.keep,undo:M.undo};E.add(N);let J=this.cellEditorIntegrations.get(N);if(J)_Sn(J.diff.read(void 0),j)||J.diff.set(j,void 0);else{let se=De(`diff${N.handle}`,j),ae=this.instantiationService.createInstance(w$,e,V,se,!0);this.cellEditorIntegrations.set(N,{integration:ae,diff:se}),this._register(ae),this._register(V.onDidDispose(()=>{this.cellEditorIntegrations.get(N)?.integration.dispose(),this.cellEditorIntegrations.delete(N)})),this._register(V.onDidChangeModel(()=>{V.getModel()!==N.textModel&&(this.cellEditorIntegrations.get(N)?.integration.dispose(),this.cellEditorIntegrations.delete(N))}))}}),this.cellEditorIntegrations.forEach((M,N)=>{E.has(N)||(M.integration.dispose(),this.cellEditorIntegrations.delete(N))})}));let b=h.map(y=>y.length>0),S=vA(r,10);this._register(ve(y=>{if(this.notebookEditor.textModel!==this.notebookModel||!b.read(y)||!this.notebookEditor.getViewModel())return;let w=S.read(y).filter(E=>E.type==="insert"?!E.diff.read(y).identical:!0),x=w.filter(E=>E.type==="modified");this.createDecorators(),w.every(E=>E.type==="insert")?(this.insertedCellDecorator?.apply([]),this.modifiedCellDecorator?.apply([]),this.deletedCellDecorator?.apply([],n),this.overlayToolbarDecorator?.decorate([])):(this.insertedCellDecorator?.apply(w),this.modifiedCellDecorator?.apply(x),this.deletedCellDecorator?.apply(w,n),this.overlayToolbarDecorator?.decorate(w.filter(E=>E.type==="insert"||E.type==="modified")))}))}getCurrentChange(){let e=Math.min(this._currentIndex.get(),this.changeIndexComputer.getTotalSum()-1),t=this.changeIndexComputer.getIndexOf(e),o=this.sortedCellChanges[t.index];return o?{change:o,index:t.remainder}:void 0}updateCurrentIndex(e,t=0){let o=this.sortedCellChanges.indexOf(e),n=this.changeIndexComputer.getPrefixSum(o-1),r=Math.min(n+t,this.changeIndexComputer.getTotalSum()-1);this._currentIndex.set(r,void 0)}createDecorators(){let e=this.cellChanges.get(),t=this.accessibilitySignalService;this.insertedCellDecorator??=this._register(this.instantiationService.createInstance(GOe,this.notebookEditor)),this.modifiedCellDecorator??=this._register(this.instantiationService.createInstance(E4t,this.notebookEditor)),this.overlayToolbarDecorator??=this._register(this.instantiationService.createInstance(aHe,this.notebookEditor,this.notebookModel)),this.deletedCellDecorator&&(this._store.delete(this.deletedCellDecorator),this.deletedCellDecorator.dispose()),this.deletedCellDecorator=this._register(this.instantiationService.createInstance(doe,this.notebookEditor,{className:"chat-diff-change-content-widget",telemetrySource:"chatEditingNotebookHunk",menuId:R.ChatEditingEditorHunk,actionViewItemProvider:(o,n)=>{if(!o.class)return new class extends ts{constructor(){super(void 0,o,{...n,keybindingNotRenderedWithLabel:!0,icon:!1,label:!0})}}},argFactory:o=>({accept(){let n=e.find(r=>r.type==="delete"&&r.originalCellIndex===o);return n?n.keep(n.diff.get().changes[0]):(t.playSignal(tn.editsKept,{allowManyInParallel:!0}),Promise.resolve(!0))},reject(){let n=e.find(r=>r.type==="delete"&&r.originalCellIndex===o);return n?n.undo(n.diff.get().changes[0]):(t.playSignal(tn.editsUndone,{allowManyInParallel:!0}),Promise.resolve(!0))}})}))}getCell(e){let t=this.notebookModel.cells[e];return this.cellEditorIntegrations.get(t)?.integration}reveal(e){let t=this.sortedCellChanges.filter(n=>n.type!=="unchanged");if(!t.length)return;let o=e?t[0]:t[t.length-1];this._revealFirstOrLast(o,e)}_revealFirstOrLast(e,t=!0){switch(e.type){case"insert":case"modified":{this.blur(this.getCurrentChange()?.change);let o=t||e.type==="insert"?0:e.diff.get().changes.length-1;return this._revealChange(e,o)}case"delete":return this.blur(this.getCurrentChange()?.change),this.deletedCellDecorator?.reveal(e.originalCellIndex),this.updateCurrentIndex(e),!0;default:break}return!1}_revealChange(e,t){switch(e.type){case"insert":case"modified":{let o=e.diff.get().changes[t],n=this.getCellViewModel(e);if(n)return this.updateCurrentIndex(e,t),this.revealChangeInView(n,o?.modified,e).catch(r=>{this.logService.warn(`Error revealing change in view: ${r}`)}),!0;break}case"delete":return this.updateCurrentIndex(e),this.deletedCellDecorator?.reveal(e.originalCellIndex),!0;default:break}return!1}getCellViewModel(e){if(e.type==="delete"||e.modifiedCellIndex===void 0||e.modifiedCellIndex>=this.notebookModel.cells.length)return;let t=this.notebookModel.cells[e.modifiedCellIndex];return this.notebookEditor.getViewModel()?.viewCells.find(n=>n.handle===t.handle)}async revealChangeInView(e,t,o){let n=t??new vo(0,0);o.type==="modified"&&e.cellKind===1&&e.getEditState()===0&&e.updateEditState(1,"chatEditNavigation");let r=e.cellKind===2||o.type==="modified"?"editor":"container";await this.notebookEditor.focusNotebookCell(e,r,{focusEditorLine:n.startLineNumber}),await this.notebookEditor.revealRangeInCenterAsync(e,new G(n.startLineNumber,0,n.endLineNumberExclusive,0))}revertMarkupCellState(){for(let e of this.sortedCellChanges){let t=this.getCellViewModel(e);t?.cellKind===1&&t.getEditState()===1&&(t.editStateSource==="chatEditNavigation"||t.editStateSource==="chatEdit")&&t.updateEditState(0,"chatEdit")}}blur(e){if(!e)return;let t=this.getCellViewModel(e);t?.cellKind===1&&t.getEditState()===1&&t.editStateSource==="chatEditNavigation"&&t.updateEditState(0,"chatEditNavigation")}next(e){let t=this.sortedCellChanges.filter(n=>n.type!=="unchanged"),o=this.getCurrentChange();if(!o){let n=t[0];return n?this._revealFirstOrLast(n):!1}switch(o.change.type){case"modified":{let n=this.getCell(o.change.modifiedCellIndex);if(n&&n.next(!1))return this.updateCurrentIndex(o.change,n.currentIndex.get()),!0;let r=o.index>=dLo(o.change),s=r?0:o.index+1,l=r?t[t.indexOf(o.change)+1]:o.change;if(l&&(r&&this.blur(o.change),this._revealChange(l,s)))return!0}break;case"insert":case"delete":{this.blur(o.change);let n=t[t.indexOf(o.change)+1];if(n&&this._revealFirstOrLast(n,!0))return!0}break;default:break}if(e){let n=t[0];if(n)return this._revealFirstOrLast(n,!0)}return!1}previous(e){let t=this.sortedCellChanges.filter(n=>n.type!=="unchanged"),o=this.getCurrentChange();if(!o){let n=t[t.length-1];return n?this._revealFirstOrLast(n,!1):!1}switch(o.change.type){case"modified":{let n=this.getCell(o.change.modifiedCellIndex);if(n&&n.previous(!1))return this.updateCurrentIndex(o.change,n.currentIndex.get()),!0;let r=o.index<=0,s=r?t[t.indexOf(o.change)-1]:o.change;if(s){let l=r?dLo(s):o.index-1;if(r&&this.blur(o.change),this._revealChange(s,l))return!0}}break;case"insert":case"delete":{this.blur(o.change);let n=t[t.indexOf(o.change)-1];if(n&&this._revealFirstOrLast(n,!1))return!0}break;default:break}if(e){let n=t[t.length-1];if(n)return this._revealFirstOrLast(n,!1)}return!1}enableAccessibleDiffView(){let e=this.notebookEditor.getActiveCell()?.model;e&&this.cellEditorIntegrations.get(e)?.integration?.enableAccessibleDiffView()}getfocusedIntegration(){let e=this.notebookEditor.getSelectionViewModels()[0];if(e)return this.cellEditorIntegrations.get(e.model)?.integration}async acceptNearestChange(e){if(e)await e.accept();else{let t=this.getCurrentChange(),o=this.getfocusedIntegration();t&&!o||t?.change.type==="delete"?t.change.keep(t?.change.diff.get().changes[t.index]):o&&await o.acceptNearestChange(),this._currentIndex.set(this._currentIndex.get()-1,void 0),this.next(!0)}}async rejectNearestChange(e){if(e)await e.reject();else{let t=this.getCurrentChange(),o=this.getfocusedIntegration();t&&!o||t?.change.type==="delete"?t.change.undo(t.change.diff.get().changes[t.index]):o&&await o.rejectNearestChange(),this._currentIndex.set(this._currentIndex.get()-1,void 0),this.next(!0)}}async toggleDiff(e,t){let o={original:{resource:this._entry.originalURI},modified:{resource:this._entry.modifiedURI},label:d(8002,null,Be(this._entry.modifiedURI))};await this._editorService.openEditor(o)}};cHe=I([m(5,F),m(6,ie),m(7,hd),m(8,br),m(9,re)],cHe);var T4t=class extends k{constructor(e,t){super();this.notebookDiffEditor=e;this.cellChanges=t;this._currentIndex=De(this,-1);this.currentIndex=this._currentIndex;this._store.add(ve(o=>{let n=e.currentChangedIndex.read(o),r=t.read(o).filter(s=>!s.diff.read(o).identical);if(r.length&&n>=0&&n<r.length){let s=Ylt(r.slice(0,n+1));this._currentIndex.set(s-1,void 0)}else this._currentIndex.set(-1,void 0)}))}reveal(e){eL(this.cellChanges.get().filter(o=>o.type!=="unchanged")).length&&(e?this.notebookDiffEditor.firstChange():this.notebookDiffEditor.lastChange())}next(e){let t=this.cellChanges.get().filter(o=>!o.diff.get().identical).length;return this.notebookDiffEditor.currentChangedIndex.get()===t-1?!1:(this.notebookDiffEditor.nextChange(),!0)}previous(e){let t=this.cellChanges.get().filter(o=>!o.diff.get().identical).length;return this.notebookDiffEditor.currentChangedIndex.get()===t-1?!1:(this.notebookDiffEditor.nextChange(),!0)}enableAccessibleDiffView(){}async acceptNearestChange(e){await e.accept(),this.next(!0)}async rejectNearestChange(e){await e.reject(),this.next(!0)}async toggleDiff(e,t){}};function _Sn(a,i){return!(a.changes!==i.changes||a.identical!==i.identical||a.moves!==i.moves||a.originalModel!==i.originalModel||a.modifiedModel!==i.modifiedModel||a.keep!==i.keep||a.undo!==i.undo||a.quitEarly!==i.quitEarly)}function dLo(a){return a.type==="modified"?a.diff.get().changes.length-1:0}var ube=class extends k{constructor(e,t){super();this.fileService=e;let o=t.createInstance(RV);this._register(this.fileService.registerProvider(yWi,o))}static{this.ID="chatEditingNotebookFileSystemProviderContribution"}};ube=I([m(0,ge),m(1,F)],ube);var RV=class{constructor(i){this._chatEditingService=i;this.capabilities=18434;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None}static{this.registeredFiles=new dt}static registerFile(i,e){return RV.registeredFiles.set(i,e),{dispose(){RV.registeredFiles.get(i)===e&&RV.registeredFiles.delete(i)}}}watch(i,e){return k.None}async stat(i){return{type:1,ctime:0,mtime:0,size:0}}mkdir(i){throw new Error("Method not implemented1.")}readdir(i){throw new Error("Method not implemented2.")}delete(i,e){throw new Error("Method not implemented3.")}rename(i,e,t){throw new Error("Method not implemented4.")}copy(i,e,t){throw new Error("Method not implemented5.")}async readFile(i){let e=RV.registeredFiles.get(i);if(e)return e.buffer;let t=JSON.parse(i.query);if(!t.viewType)throw new Error("File not found, viewType not found");let o=this._chatEditingService.getEditingSession(Br.forSession(t.sessionId));if(!o||!t.requestId)throw new Error("File not found, session not found");let n=await o.getSnapshotContents(t.requestId,i,t.undoStop||void 0);if(!n)throw new Error("File not found, snapshot not found");return n.buffer}writeFile(i,e,t){throw new Error("Method not implemented7.")}readFileStream(i,e,t){throw new Error("Method not implemented8.")}open(i,e){throw new Error("Method not implemented9.")}close(i){throw new Error("Method not implemented10.")}read(i,e,t,o,n){throw new Error("Method not implemented11.")}write(i,e,t,o,n){throw new Error("Method not implemented12.")}cloneFile(i,e){throw new Error("Method not implemented13.")}};RV=I([m(0,mu)],RV);function uLo(a,i,e,t,o){i=eL(i);let n=i.findIndex(s=>s.originalCellIndex===a);if(n===-1)return i;let r=-1;for(let s=0;s<i.length;s++){let l=i[s];if(s<n){r=Math.max(r,l.modifiedCellIndex??r);continue}if(s===n){let c={cells:[e],count:0,editType:1,index:r+1};t([c],!0,void 0,()=>{},void 0,!0),i[s]=o(r+1,a);continue}else typeof l.modifiedCellIndex=="number"&&(l.modifiedCellIndex++,i[s]={...l})}return i}function pLo(a,i,e){if(a===-1)return i;i=eL(i).filter(o=>!(o.type==="insert"&&o.modifiedCellIndex===a)).map(o=>o.type==="insert"&&o.modifiedCellIndex===a?o:o.type!=="delete"&&o.modifiedCellIndex>a?{...o,modifiedCellIndex:o.modifiedCellIndex-1}:o);let t={cells:[],count:1,editType:1,index:a};return e([t],!0,void 0,()=>{},void 0,!0),i}function mLo(a,i,e,t,o){if(i=eL(i),a===-1)return i;let n=i.findIndex(s=>s.modifiedCellIndex===a);if(n===-1)return i;let r=-1;for(let s=0;s<i.length;s++){let l=i[s];if(s<n){r=Math.max(r,l.originalCellIndex??r);continue}if(s===n){let c={cells:[e],count:0,editType:1,index:r+1};t([c],!0,void 0,()=>{},void 0,!0),i[s]=o(a,r+1);continue}else typeof l.originalCellIndex=="number"&&(l.originalCellIndex++,i[s]={...l})}return i}function hLo(a,i,e,t,o,n){i=eL(i);let r=a[2].length,s=a[1],l=a[2].map(p=>({cellKind:p.cellKind,language:p.language,metadata:p.metadata,outputs:p.outputs,source:p.getValue(),mime:void 0,internalMetadata:p.internalMetadata})),c=-1,u;if(l.length){for(let h=0;h<i.length;h++){let g=i[h];if(typeof g.modifiedCellIndex=="number"&&g.modifiedCellIndex===a[0]){c=h,typeof g.originalCellIndex=="number"&&(u=g.originalCellIndex);break}typeof g.originalCellIndex=="number"&&(u=g.originalCellIndex+1)}let p={editType:1,cells:l,index:u??0,count:a[1]};o([p],!0,void 0,()=>{},void 0,!0)}if(s){let p=0,h=0,g=new Set;for(let v=0;v<s;v++)g.add(a[0]+v);let f=new Set;for(let v=0;v<i.length;v++){let b=i[v];if(v<c)continue;let S=!1;if(typeof b.modifiedCellIndex=="number"&&g.has(b.modifiedCellIndex)){h++,typeof b.originalCellIndex=="number"&&p++,f.add(b);continue}typeof b.modifiedCellIndex=="number"&&h&&(b.modifiedCellIndex-=h,S=!0),typeof b.originalCellIndex=="number"&&p&&(b.originalCellIndex-=p,S=!0),S&&(i[v]={...b})}f.size&&Array.from(f).filter(v=>typeof v.originalCellIndex=="number").forEach(v=>{let b={editType:1,cells:[],index:v.originalCellIndex,count:1};o([b],!0,void 0,()=>{},void 0,!0)}),i=i.filter(v=>!f.has(v))}if(r&&c>=0)for(let p=0;p<i.length;p++){let h=i[p];if(p<c)continue;let g=!1;typeof h.modifiedCellIndex=="number"&&(h.modifiedCellIndex+=r,g=!0),typeof h.originalCellIndex=="number"&&(h.originalCellIndex+=r,g=!0),g&&(i[p]={...h})}return l.forEach((p,h)=>{let g=h+(u??0),f=a[0]+h,v=n(f,g);i.splice((c===-1?i.length:c)+h,0,v)}),i}function gLo(a,i){let e=Math.min(a.index,a.newIdx),t=Math.max(a.index,a.newIdx),o=i.slice(),n=o.findIndex(f=>f.modifiedCellIndex===a.index),r=o.findIndex(f=>f.modifiedCellIndex===a.newIdx);if(n===-1||r===-1)return;let s={...o[n]},l=a.newIdx>a.index?"down":"up",c=o.findIndex(f=>f.modifiedCellIndex===e),u=o.findIndex(f=>f.modifiedCellIndex===t),p=typeof s.originalCellIndex=="number",h=!1;for(let f=0;f<o.length;f++){let v=o[f],b=!1;l==="down"?f>c&&f<=u&&(typeof v.modifiedCellIndex=="number"&&(b=!0,v.modifiedCellIndex=v.modifiedCellIndex-1),typeof v.originalCellIndex=="number"&&p&&(v.originalCellIndex=v.originalCellIndex-1,h=!0,b=!0)):f>=c&&f<u&&(typeof v.modifiedCellIndex=="number"&&(b=!0,v.modifiedCellIndex=v.modifiedCellIndex+1),typeof v.originalCellIndex=="number"&&p&&(v.originalCellIndex=v.originalCellIndex+1,h=!0,b=!0)),b&&(o[f]={...v})}s.modifiedCellIndex=a.newIdx;let g=s.originalCellIndex;if(l==="down"?(o.splice(u+1,0,s),o.splice(c,1),typeof s.originalCellIndex=="number"&&(s.originalCellIndex=o.slice(0,u).reduce((f,v)=>typeof v.originalCellIndex=="number"?Math.max(f,v.originalCellIndex):f,-1)+1)):(o.splice(u,1),o.splice(c,0,s),typeof s.originalCellIndex=="number"&&(s.originalCellIndex=o.slice(0,c).reduce((f,v)=>typeof v.originalCellIndex=="number"?Math.max(f,v.originalCellIndex):f,-1)+1)),typeof s.originalCellIndex=="number"&&h&&typeof g=="number"&&s.originalCellIndex!==g){let f={editType:6,index:g,length:a.length,newIdx:s.originalCellIndex};return[o,[f]]}return[o,[]]}function Xlt(a,i){return i.find(t=>t.modifiedCellIndex===a)?.originalCellIndex}function fLo(a,i){return a!=="jupyter-notebook"?!1:!!i.rawEvents.every(e=>e.kind!==7?!1:(JSON.stringify(e.metadata||{})===JSON.stringify({execution_count:null,metadata:{}}),!0))}function vLo(a,i,e){let t=a.reduce((n,r)=>n+(r.type==="unchanged"?0:r.type==="delete"?i.cells[r.originalCellIndex].textModel?.getLineCount()??0:r.type==="insert"?e.cells[r.modifiedCellIndex].textModel?.getLineCount()??0:r.diff.get().changes.reduce((l,c)=>Math.max(l,c.modified.endLineNumberExclusive),0)),0),o=e.cells.reduce((n,r)=>n+(r.textModel?.getLineCount()??0),0);return o===0?0:Math.min(1,t/o)}var bLo="VSCodeChatNotebookSnapshotLanguage",GE=class extends KE{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super(e.object.notebook.uri,r,s,c,u,p,h,b,g,x);this.modifiedResourceRef=e;this._multiDiffEntryDelegate=o;this.transientOptions=n;this.configurationService=c;this.textModelService=f;this.modelService=v;this.notebookEditorWorkerService=S;this.loggingService=y;this.notebookResolver=w;this._isProcessingResponse=De("isProcessingResponse",!1);this._isEditFromUs=!1;this._allEditsAreFromUs=!0;this._changesCount=De(this,0);this.changesCount=this._changesCount;this.cellEntryMap=new dt;this.modifiedToOriginalCell=new dt;this._cellsDiffInfo=De("diffInfo",[]);this.editedCells=new xn;this.computeRequestId=0;this.cellTextModelMap=new dt;this.initialContentComparer=new ire(l),this.modifiedModel=this._register(e).object.notebook,this.originalModel=this._register(t).object.notebook,this.originalURI=this.originalModel.uri,this.initialContent=l,this.initializeModelsFromDiff(),this._register(this.modifiedModel.onDidChangeContent(this.mirrorNotebookEdits,this))}static{this.NewModelCounter=0}get isProcessingResponse(){return this._isProcessingResponse}get cellsDiffInfo(){return this._cellsDiffInfo}get viewType(){return this.modifiedModel.viewType}static async create(e,t,o,n,r,s){return s.invokeFunction(async l=>{let c=l.get(kn),u=l.get(Yh),p=l.get(B),h=await u.resolve(e),g=h.object.notebook,f=wWi(o.sessionResource,o.requestId,ht(),g.uri.scheme===Q.untitled?`/${g.uri.path}`:g.uri.path,g.viewType),[v,b]=await Promise.all([c.withNotebookDataProvider(h.object.notebook.notebookType),c.createNotebookTextDocumentSnapshot(g.uri,2,Ie.None).then(x=>yI(x))]),S=new O;S.add(RV.registerFile(f,b));let y=await u.resolve(f,g.viewType);if(r!==void 0)try{KP(y.object.notebook,r)}catch(x){console.error(`Error restoring snapshot: ${r}`,x),r=zP(g,v.serializer.options,p)}else{r=zP(g,v.serializer.options,p),KP(y.object.notebook,r);let x=[];g.cells.forEach((E,M)=>{let N=EWi(E.uri);x.push({editType:9,index:M,internalMetadata:{internalId:N}})}),h.object.notebook.applyEdits(x,!0,void 0,()=>{},void 0,!1),y.object.notebook.applyEdits(x,!0,void 0,()=>{},void 0,!1)}let w=s.createInstance(GE,h,y,t,v.serializer.options,o,n,r);return w._register(S),w})}static canHandleSnapshotContent(e){if(!e)return!1;try{return iHe(e),!0}catch{return!1}}static canHandleSnapshot(e){return!!(e.languageId===bLo&&GE.canHandleSnapshotContent(e.current))}initializeModelsFromDiffImpl(e){this.cellEntryMap.forEach(o=>o.dispose()),this.cellEntryMap.clear();let t=e.map((o,n)=>{switch(o.type){case"delete":return this.createDeleteCellDiffInfo(o.originalCellIndex);case"insert":return this.createInsertedCellDiffInfo(o.modifiedCellIndex);default:return this.createModifiedCellDiffInfo(o.modifiedCellIndex,o.originalCellIndex)}});this._cellsDiffInfo.set(t,void 0),this._changesCount.set(Ylt(t),void 0)}getIndexOfCellHandle(e){return this.modifiedModel.cells.findIndex(t=>t.handle===e)}async initializeModelsFromDiff(){let e=++this.computeRequestId;if(this._areOriginalAndModifiedIdenticalImpl()){let o=this.modifiedModel.cells.map((n,r)=>({type:"unchanged",originalCellIndex:r,modifiedCellIndex:r}));this.initializeModelsFromDiffImpl(o);return}let t=[];try{this._isProcessingResponse.set(!0,void 0);let o=await this.notebookEditorWorkerService.computeDiff(this.originalURI,this.modifiedURI);if(e!==this.computeRequestId||this._store.isDisposed)return;let n=HOe(this.originalModel,this.modifiedModel,o);n.cellDiffInfo.length&&t.push(...n.cellDiffInfo)}catch(o){this.loggingService.error("Notebook Chat",`Error computing diff:
`+o)}finally{this._isProcessingResponse.set(!1,void 0)}this.initializeModelsFromDiffImpl(t)}updateCellDiffInfo(e,t){this._cellsDiffInfo.set(eL(e),t),this._changesCount.set(Ylt(e),t)}mirrorNotebookEdits(e){if(this._isEditFromUs||this._isExternalEditInProgress||Array.from(this.cellEntryMap.values()).some(n=>n.isEditFromUs))return;let t=this.initialContentComparer.isEqual(this.modifiedModel),o=this._stateObs.get();if(o===0&&t){this._stateObs.set(2,void 0),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff(),this._notifySessionAction("rejected");return}if(e.rawEvents.length&&o!==2&&!fLo(this.modifiedModel.notebookType,e)){this._allEditsAreFromUs=!1,this._userEditScheduler.schedule();for(let n of e.rawEvents.filter(r=>r.kind!==10))switch(n.kind){case 11:{let r={editType:5,metadata:this.modifiedModel.metadata};this.originalModel.applyEdits([r],!0,void 0,()=>{},void 0,!1);break}case 1:{let r=eL(this._cellsDiffInfo.get());this._applyEditsSync(()=>{n.changes.forEach(s=>{s[2].forEach((l,c)=>{if(l.internalMetadata.internalId)return;let u=s[0]+c,p=EWi(l.uri),h=[{editType:9,index:u,internalMetadata:{internalId:p}}];this.modifiedModel.applyEdits(h,!0,void 0,()=>{},void 0,!1),l.internalMetadata??={},l.internalMetadata.internalId=p})})}),n.changes.forEach(s=>{r=hLo(s,r,this.modifiedModel.cells.length,this.originalModel.cells.length,this.originalModel.applyEdits.bind(this.originalModel),this.createModifiedCellDiffInfo.bind(this))}),this.updateCellDiffInfo(r,void 0),this.disposeDeletedCellEntries();break}case 5:{let r=Xlt(n.index,this._cellsDiffInfo.get());if(typeof r=="number"){let s={editType:4,index:r,language:n.language};this.originalModel.applyEdits([s],!0,void 0,()=>{},void 0,!1)}break}case 7:{let r=Xlt(n.index,this._cellsDiffInfo.get());if(typeof r=="number"){let s={editType:3,index:r,metadata:n.metadata};this.originalModel.applyEdits([s],!0,void 0,()=>{},void 0,!1)}break}case 13:break;case 12:{let r=Xlt(n.index,this._cellsDiffInfo.get());if(typeof r=="number"){let s={editType:9,index:r,internalMetadata:n.internalMetadata};this.originalModel.applyEdits([s],!0,void 0,()=>{},void 0,!1)}break}case 8:{let r=Xlt(n.index,this._cellsDiffInfo.get());if(typeof r=="number"){let s={editType:2,index:r,append:n.append,outputs:n.outputs};this.originalModel.applyEdits([s],!0,void 0,()=>{},void 0,!1)}break}case 9:break;case 2:{let r=gLo(n,this._cellsDiffInfo.get().slice());r&&(this.originalModel.applyEdits(r[1],!0,void 0,()=>{},void 0,!1),this._cellsDiffInfo.set(r[0],void 0));break}default:break}if(t=this.initialContentComparer.isEqual(this.modifiedModel),o===0&&t){this._stateObs.set(2,void 0),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff();return}}}async _doAccept(){this.updateCellDiffInfo([],void 0);let e=zP(this.modifiedModel,this.transientOptions,this.configurationService);KP(this.originalModel,e),this.initializeModelsFromDiff(),await this._collapse(void 0);let t=this._fileConfigService.getAutoSaveConfiguration(this.modifiedURI);this.modifiedModel.uri.scheme!==Q.untitled&&(!t.autoSave||!this.notebookResolver.isDirty(this.modifiedURI))&&await this._applyEdits(async()=>{try{await this.modifiedResourceRef.object.save({reason:1,force:!0})}catch{}})}async _doReject(){this.updateCellDiffInfo([],void 0),this.createdInRequestId===this._telemetryInfo.requestId?(await this._applyEdits(async()=>{await this.modifiedResourceRef.object.revert({soft:!0}),await this._fileService.del(this.modifiedURI)}),this._onDidDelete.fire()):(await this._applyEdits(async()=>{let e=zP(this.originalModel,this.transientOptions,this.configurationService);this.restoreSnapshotInModifiedModel(e),this._allEditsAreFromUs&&Array.from(this.cellEntryMap.values()).every(t=>t.allEditsAreFromUs)&&await this.modifiedResourceRef.object.save({reason:1,skipSaveParticipants:!0})}),this.initializeModelsFromDiff(),await this._collapse(void 0))}async _collapse(e){this._multiDiffEntryDelegate.collapse(e)}_createEditorIntegration(e){let t=lr(e);if(!t&&e.getId()===Oh.ID){let o=e.getControl();return this._instantiationService.createInstance(T4t,o,this._cellsDiffInfo)}return To(t),this._instantiationService.createInstance(lHe,this,e,this.modifiedModel,this.originalModel,this._cellsDiffInfo)}_resetEditsState(e){super._resetEditsState(e),this.cellEntryMap.forEach(t=>!t.isDisposed&&t.clearCurrentEditLineDecoration())}_createUndoRedoElement(e){let t=e.session.getRequests().find(u=>u.id===e.requestId),o=t?.message.text?d(7996,null,t.message.text):d(7997,null),n=this.transientOptions,r=this.configurationService.getValue(Ct.outputBackupSizeLimit)*1024,s=zP(this.modifiedModel,n,r),l="",c=2;return{type:0,resource:this.modifiedURI,label:o,code:"chat.edit",confirmBeforeUndo:!1,undo:async()=>{l=zP(this.modifiedModel,n,r),this._isEditFromUs=!0;try{KP(this.modifiedModel,s),KP(this.originalModel,s)}finally{this._isEditFromUs=!1}c=this._stateObs.get()===1?1:2,this._stateObs.set(2,void 0),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff(),this._notifySessionAction("userModified")},redo:async()=>{s=zP(this.modifiedModel,n,r),this._isEditFromUs=!0;try{KP(this.modifiedModel,l),KP(this.originalModel,l)}finally{this._isEditFromUs=!1}this._stateObs.set(c,void 0),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff(),this._notifySessionAction("userModified")}}}async _areOriginalAndModifiedIdentical(){return this._areOriginalAndModifiedIdenticalImpl()}_areOriginalAndModifiedIdenticalImpl(){let e=zP(this.originalModel,this.transientOptions,this.configurationService);return new ire(e).isEqual(this.modifiedModel)}async acceptAgentEdits(e,t,o,n){let r=e.scheme===Q.vscodeNotebookCell,s=r&&this.modifiedModel.cells.find(u=>ze(u.uri,e)),l;if(s){let u=this.modifiedModel.cells.indexOf(s),p=this._cellsDiffInfo.get().slice().find(h=>h.modifiedCellIndex===u);if(!p){console.error("Original cell model not found");return}l=this.getOrCreateModifiedTextFileEntryForCell(s,await p.modifiedModel.promise,await p.originalModel.promise)}let c=async()=>{await Promise.all(Array.from(this.editedCells).map(async u=>{let p=this.modifiedModel.cells.find(g=>ze(g.uri,u));await(p&&this.cellEntryMap.get(p.uri))?.acceptAgentEdits([],!0,n)})),this.editedCells.clear()};if(await this._applyEdits(async()=>{await Promise.all(t.map(async(u,p)=>{let h=o&&p===t.length-1;hT.isTextEdit(u)?ze(e,this.modifiedModel.uri)?(this.newNotebookEditGenerator??=this._instantiationService.createInstance(rHe,this.modifiedModel),this.newNotebookEditGenerator.acceptTextEdits([u])):(this.newNotebookEditGenerator=void 0,this.editedCells.has(e)||(await c(),this.editedCells.add(e)),await l?.acceptAgentEdits([u],h,n)):(this.newNotebookEditGenerator=void 0,this.acceptNotebookEdit(u))}))}),o&&await c(),o=!r&&o,o&&this.newNotebookEditGenerator){let u=await this.newNotebookEditGenerator.generateEdits();this.newNotebookEditGenerator=void 0,u.forEach(p=>this.acceptNotebookEdit(p))}Ki(u=>{if(this._waitsForLastEdits.set(!o,u),this._stateObs.set(0,u),o)this.editedCells.clear(),this._resetEditsState(u),this._rewriteRatioObs.set(1,u);else{let p=Math.max(this._rewriteRatioObs.get(),vLo(this._cellsDiffInfo.get(),this.originalModel,this.modifiedModel));this._rewriteRatioObs.set(Math.min(1,p),u)}}),o&&this._shouldAutoSave()&&await this.modifiedResourceRef.object.save({reason:2,skipSaveParticipants:!0})}disposeDeletedCellEntries(){let e=new xn(this.modifiedModel.cells.map(t=>t.uri));Array.from(this.cellEntryMap.keys()).forEach(t=>{e.has(t)||(this.cellEntryMap.get(t)?.dispose(),this.cellEntryMap.delete(t))})}acceptNotebookEdit(e){if(this.modifiedModel.applyEdits([e],!0,void 0,()=>{},void 0,!1),this.disposeDeletedCellEntries(),e.editType!==1)return;e.cells.forEach((o,n)=>{let r=e.index+n,s=this.modifiedModel.cells[r];if(s.internalMetadata.internalId)return;let l=EWi(s.uri),c=[{editType:9,index:r,internalMetadata:{internalId:l}}];this.modifiedModel.applyEdits(c,!0,void 0,()=>{},void 0,!1)});let t=[];if(e.count===0){t=eL(this._cellsDiffInfo.get()),t.forEach(n=>{n.type!=="delete"&&n.modifiedCellIndex>=e.index&&(n.modifiedCellIndex+=e.cells.length)});let o=e.cells.map((n,r)=>this.createInsertedCellDiffInfo(e.index+r));t.splice(e.index,0,...o)}else t=eL(this._cellsDiffInfo.get()).map(o=>o.type==="unchanged"&&o.modifiedCellIndex>=e.index&&o.modifiedCellIndex<=e.index+e.count-1?this.createDeleteCellDiffInfo(o.originalCellIndex):(o.type!=="delete"&&o.modifiedCellIndex>=e.index+e.count&&(o.modifiedCellIndex-=e.count),o));this.updateCellDiffInfo(t,void 0)}computeStateAfterAcceptingRejectingChanges(e){let t=zP(this.modifiedModel,this.transientOptions,this.configurationService);if(new ire(t).isEqual(this.originalModel)){let o=e?1:2;this._stateObs.set(o,void 0),this._notifySessionAction(e?"accepted":"rejected")}}createModifiedCellDiffInfo(e,t){let o=this.modifiedModel.cells[e],n=this.originalModel.cells[t];this.modifiedToOriginalCell.set(o.uri,n.uri);let r=this.resolveCellModel(o.uri),s=this.resolveCellModel(n.uri);Promise.all([r,s]).then(([u,p])=>{this.getOrCreateModifiedTextFileEntryForCell(o,u,p)});let l=De("diff",x$);return{type:"unchanged",modifiedCellIndex:e,originalCellIndex:t,keep:async u=>{let[p,h]=await Promise.all([r,s]),g=this.getOrCreateModifiedTextFileEntryForCell(o,p,h);return g?g.keep(u):!1},undo:async u=>{let[p,h]=await Promise.all([r,s]),g=this.getOrCreateModifiedTextFileEntryForCell(o,p,h);return g?g.undo(u):!1},modifiedModel:new Uc(r),originalModel:new Uc(s),diff:l}}createInsertedCellDiffInfo(e){let t=this.modifiedModel.cells[e],o=t.getValue().split(/\r?\n/),n=new G(1,0,1,0),r=new G(1,0,o.length,o[o.length-1].length),s=new lf(n,r),l=[new vv(new vo(1,1),new vo(1,o.length),[s])],c=this.modifiedModel.uri.with({query:(GE.NewModelCounter++).toString(),scheme:"emptyCell"}),u=this.modelService.getModel(c)||this._register(this.modelService.createModel("",null,c));this.modifiedToOriginalCell.set(t.uri,c);let p=async()=>(this._applyEditsSync(()=>this.keepPreviouslyInsertedCell(t)),this.computeStateAfterAcceptingRejectingChanges(!0),!0),h=async()=>(this._applyEditsSync(()=>this.undoPreviouslyInsertedCell(t)),this.computeStateAfterAcceptingRejectingChanges(!1),!0);return this.resolveCellModel(t.uri).then(g=>{this._store.isDisposed||this.getOrCreateModifiedTextFileEntryForCell(t,g,u)}),{type:"insert",originalCellIndex:void 0,modifiedCellIndex:e,keep:p,undo:h,modifiedModel:new Uc(this.resolveCellModel(t.uri)),originalModel:new Uc(Promise.resolve(u)),diff:De("deletedCellDiff",{changes:l,identical:!1,moves:[],quitEarly:!1})}}createDeleteCellDiffInfo(e){let t=this.originalModel.cells[e],o=new Array(t.textBuffer.getLineCount()).fill(0).map((g,f)=>t.textBuffer.getLineContent(f+1)),n=new G(1,0,o.length,o[o.length-1].length),r=new G(1,0,1,0),s=new lf(r,n),l=[new vv(new vo(1,o.length),new vo(1,1),[s])],c=this.modifiedModel.uri.with({query:(GE.NewModelCounter++).toString(),scheme:"emptyCell"}),u=this.modelService.getModel(c)||this._register(this.modelService.createModel("",null,c)),p=async()=>(this._applyEditsSync(()=>this.keepPreviouslyDeletedCell(this.originalModel.cells.indexOf(t))),this.computeStateAfterAcceptingRejectingChanges(!0),!0),h=async()=>(this._applyEditsSync(()=>this.undoPreviouslyDeletedCell(this.originalModel.cells.indexOf(t),t)),this.computeStateAfterAcceptingRejectingChanges(!1),!0);return{type:"delete",modifiedCellIndex:void 0,originalCellIndex:e,originalModel:new Uc(this.resolveCellModel(t.uri)),modifiedModel:new Uc(Promise.resolve(u)),keep:p,undo:h,diff:De("cellDiff",{changes:l,identical:!1,moves:[],quitEarly:!1})}}undoPreviouslyInsertedCell(e){let t=[];this._applyEditsSync(()=>{let o=this.modifiedModel.cells.indexOf(e);t=pLo(o,this._cellsDiffInfo.get(),this.modifiedModel.applyEdits.bind(this.modifiedModel))}),this.disposeDeletedCellEntries(),this.updateCellDiffInfo(t,void 0)}keepPreviouslyInsertedCell(e){let t=this.modifiedModel.cells.indexOf(e);if(t===-1)return;let o={cellKind:e.cellKind,language:e.language,metadata:e.metadata,outputs:e.outputs,source:e.getValue(),mime:e.mime,internalMetadata:{internalId:e.internalMetadata.internalId}};this.cellEntryMap.get(e.uri)?.dispose(),this.cellEntryMap.delete(e.uri);let n=mLo(t,this._cellsDiffInfo.get().slice(),o,this.originalModel.applyEdits.bind(this.originalModel),this.createModifiedCellDiffInfo.bind(this));this.updateCellDiffInfo(n,void 0)}undoPreviouslyDeletedCell(e,t){let o={cellKind:t.cellKind,language:t.language,metadata:t.metadata,outputs:t.outputs,source:t.getValue(),mime:t.mime,internalMetadata:{internalId:t.internalMetadata.internalId}},n=[];this._applyEditsSync(()=>{n=uLo(e,this._cellsDiffInfo.get(),o,this.modifiedModel.applyEdits.bind(this.modifiedModel),this.createModifiedCellDiffInfo.bind(this))}),this.updateCellDiffInfo(n,void 0)}keepPreviouslyDeletedCell(e){let t={cells:[],count:1,editType:1,index:e};this.originalModel.applyEdits([t],!0,void 0,()=>{},void 0,!1);let o=eL(this._cellsDiffInfo.get()).filter(n=>!(n.type==="delete"&&n.originalCellIndex===e)).map(n=>n.type!=="insert"&&n.originalCellIndex>e?{...n,originalCellIndex:n.originalCellIndex-1}:n);this.updateCellDiffInfo(o,void 0)}async _applyEdits(e){this._isEditFromUs=!0;try{await e()}finally{this._isEditFromUs=!1}}_applyEditsSync(e){this._isEditFromUs=!0;try{e()}finally{this._isEditFromUs=!1}}_safeCreateSnapshot(e){try{return zP(e,this.transientOptions,this.configurationService)}catch(t){return this.loggingService.error("Notebook Chat",`Error creating snapshot: ${t instanceof Error?t.message:t}`),this.initialContent}}getCurrentSnapshot(){return this._safeCreateSnapshot(this.modifiedModel)}createSnapshot(e,t,o){let n=this._safeCreateSnapshot(this.originalModel),r=this.getCurrentSnapshot();return{resource:this.modifiedURI,languageId:bLo,snapshotUri:wWi(e,t,o,this.modifiedURI.path,this.modifiedModel.viewType),original:n,current:r,state:this.state.get(),telemetryInfo:this.telemetryInfo}}equalsSnapshot(e){return!!e&&ze(this.modifiedURI,e.resource)&&this.state.get()===e.state&&new ire(e.original).isEqual(this.originalModel)&&new ire(e.current).isEqual(this.modifiedModel)}async restoreFromSnapshot(e,t=!0){this.updateCellDiffInfo([],void 0),this._stateObs.set(e.state,void 0),KP(this.originalModel,e.original),t&&this.restoreSnapshotInModifiedModel(e.current),this.initializeModelsFromDiff()}async resetEditTrackerToInitialContent(){this.initialContent&&KP(this.originalModel,this.initialContent),this.updateCellDiffInfo([],void 0),this.initializeModelsFromDiff()}async resetToInitialContent(){this.updateCellDiffInfo([],void 0),this.restoreSnapshotInModifiedModel(this.initialContent),this.initializeModelsFromDiff()}restoreModifiedModelFromSnapshot(e){return this.restoreSnapshotInModifiedModel(e),this.initializeModelsFromDiff()}restoreSnapshotInModifiedModel(e){e!==zP(this.modifiedModel,this.transientOptions,this.configurationService)&&this._applyEditsSync(()=>{this.modifiedModel.pushStackElement(),KP(this.modifiedModel,e),this.modifiedModel.pushStackElement()})}async resolveCellModel(e){let t=this.originalModel.cells.concat(this.modifiedModel.cells).find(n=>ze(n.uri,e));if(!t)throw new Error("Cell not found");let o=this.cellTextModelMap.get(t.uri);if(o)return this.cellTextModelMap.set(t.uri,o),o;{let r=(await Lvt(this.textModelService.createModelReference(t.uri),this._store)).object.textEditorModel;return this.cellTextModelMap.set(t.uri,r),r}}getOrCreateModifiedTextFileEntryForCell(e,t,o){let n=this.cellEntryMap.get(e.uri);if(n)return n;if(this._store.isDisposed)return;let r=new O;return n=this._register(this._instantiationService.createInstance(sHe,this.modifiedResourceRef.object.resource,e,t,o,()=>this._isExternalEditInProgress,r)),this.cellEntryMap.set(e.uri,n),r.add(ve(s=>{if(this.modifiedModel.cells.indexOf(e)===-1)return;let l=this.cellsDiffInfo.read(void 0).slice(),c=this.modifiedModel.cells.indexOf(e),u=l.find(h=>h.modifiedCellIndex===c);if(!u)return;let p=l.indexOf(u);u.diff.set(n.diffInfo.read(s),void 0),n.diffInfo.read(void 0).identical&&u.type==="modified"&&(u={...u,type:"unchanged"}),!n.diffInfo.read(void 0).identical&&u.type==="unchanged"&&(u={...u,type:"modified"}),l.splice(p,1,{...u}),Ki(h=>{this.updateCellDiffInfo(l,h)})})),r.add(ve(s=>{if(this.modifiedModel.cells.indexOf(e)===-1)return;let l=n.state.read(s);l===1?this.computeStateAfterAcceptingRejectingChanges(!0):l===2&&this.computeStateAfterAcceptingRejectingChanges(!1)})),n}async computeEditsFromSnapshots(e,t){let o=iHe(e),n=iHe(t),r=[];return o.data.cells.length>0?r.push({editType:1,index:0,count:o.data.cells.length,cells:n.data.cells}):n.data.cells.length>0&&r.push({editType:1,index:0,count:0,cells:n.data.cells}),r}_shouldAutoSave(){return this.modifiedURI.scheme!==Q.untitled}async save(){this.modifiedModel.uri.scheme!==Q.untitled&&this.notebookResolver.isDirty(this.modifiedModel.uri)&&await this.modifiedResourceRef.object.save({reason:1,skipSaveParticipants:!0})}async revertToDisk(){this.modifiedModel.uri.scheme!==Q.untitled&&await this.modifiedResourceRef.object.revert({soft:!1})}};GE=I([m(7,B),m(8,fr),m(9,si),m(10,ge),m(11,F),m(12,Bt),m(13,_t),m(14,wl),m(15,Mq),m(16,Sb),m(17,Yh),m(18,XS)],GE);function EWi(a){let i=new wI;return i.update(a.toString()),i.digest().substring(0,8)}var SLo="contents",ILo="state.json",nre=class{constructor(i,e,t,o,n){this._chatSessionResource=i;this._fileService=e;this._environmentService=t;this._logService=o;this._workspaceContextService=n;this.storageKey=Qlt(i)}_getStorageLocation(){let i=this._workspaceContextService.getWorkspace().id;return Ve(this._environmentService.workspaceStorageHome,i,"chatEditingSessions",this.storageKey)}async restoreState(){let i=this._getStorageLocation(),e=new Map,t=s=>{let l=e.get(s);return l||(l=this._fileService.readFile(Ve(i,SLo,s)).then(c=>c.value.toString()),e.set(s,l)),l},o=async s=>{let l=new dt;for(let c of s){let u=await r(c);l.set(u.resource,u)}return l},n=async s=>{let l=await o(s.entries);return{stopId:"stopId"in s?s.stopId:void 0,entries:l}},r=async s=>({resource:A.parse(s.resource),languageId:s.languageId,original:await t(s.originalHash),current:await t(s.currentHash),state:s.state,snapshotUri:A.parse(s.snapshotUri),telemetryInfo:{requestId:s.telemetryInfo.requestId,agentId:s.telemetryInfo.agentId,command:s.telemetryInfo.command,sessionResource:this._chatSessionResource,result:void 0,modelId:s.telemetryInfo.modelId,modeId:s.telemetryInfo.modeId,applyCodeBlockSuggestionId:s.telemetryInfo.applyCodeBlockSuggestionId,feature:s.telemetryInfo.feature},isDeleted:s.isDeleted});try{let s=Ve(i,ILo);if(!await this._fileService.exists(s)){this._logService.debug(`chatEditingSession: No editing session state found at ${s.toString()}`);return}this._logService.debug(`chatEditingSession: Restoring editing session at ${s.toString()}`);let l=await this._fileService.readFile(s),c=JSON.parse(l.value.toString());if(!DSn.includes(c.version))return;let u=new dt;for(let h of c.initialFileContents)u.set(A.parse(h[0]),await t(h[1]));let p=await n(c.recentSnapshot);return{initialFileContents:u,recentSnapshot:p,timeline:er(c.timeline)}}catch(s){this._logService.error(`Error restoring chat editing session from ${i.toString()}`,s)}}async storeState(i){let e=this._getStorageLocation(),t=A.joinPath(e,SLo),o=new Set;try{(await this._fileService.resolve(t)).children?.forEach(h=>{h.isFile&&o.add(h.name)})}catch{try{await this._fileService.createFolder(t)}catch(h){this._logService.error(`Error creating chat editing session content folder ${t.toString()}`,h);return}}let n=new Map,r=async p=>{let h=Ke.fromString(p),g=(await bB(h)).substring(0,7);return o.has(g)||await this._fileService.writeFile(Ve(t,g),h),g},s=async p=>{let h=n.get(p);return h||(h=r(p),n.set(p,h)),h},l=async(p,h)=>await Promise.all(Array.from(p.entries()).map(async([g,f])=>[g.toString(),await h(f)])),c=async p=>({stopId:p.stopId,entries:await Promise.all(Array.from(p.entries.values()).map(u))}),u=async p=>({resource:p.resource.toString(),languageId:p.languageId,originalHash:await s(p.original),currentHash:await s(p.current),state:p.state,snapshotUri:p.snapshotUri.toString(),telemetryInfo:{requestId:p.telemetryInfo.requestId,agentId:p.telemetryInfo.agentId,command:p.telemetryInfo.command,modelId:p.telemetryInfo.modelId,modeId:p.telemetryInfo.modeId},isDeleted:p.isDeleted});try{let p={version:RSn,initialFileContents:await l(i.initialFileContents,h=>s(h)),timeline:i.timeline,recentSnapshot:await c(i.recentSnapshot)};this._logService.debug(`chatEditingSession: Storing editing session at ${e.toString()}: ${n.size} files`),await this._fileService.writeFile(Ve(e,ILo),Ke.fromString(JSON.stringify(p)))}catch(p){this._logService.debug(`Error storing chat editing session to ${e.toString()}`,p)}}async clearState(){let i=this._getStorageLocation();if(await this._fileService.exists(i)){this._logService.debug(`chatEditingSession: Clearing editing session at ${i.toString()}`);try{await this._fileService.del(i,{recursive:!0})}catch(e){this._logService.debug(`Error clearing chat editing session from ${i.toString()}`,e)}}}};nre=I([m(1,ge),m(2,ko),m(3,re),m(4,Ae)],nre);var DSn=[1,2],RSn=2;var TWi=class extends Tm{constructor(e,t){super();this._minDuration=e;this._maxOverallDelay=t;this._size=0}queue(e){this._size+=1;let t=this._size*this._minDuration>this._maxOverallDelay;return super.queue(async()=>{try{let o=e(),n=t?Promise.resolve(void 0):Li(this._minDuration,Ie.None),[r]=await Promise.all([o,n]);return r}finally{this._size-=1}})}};function LSn(a,i,e){return[{kind:"markdownContent",content:new he("\n````\n")},{kind:"codeblockUri",uri:a,isEdit:!0,undoStopId:e},{kind:"markdownContent",content:new he("\n````\n")},i?{kind:"notebookEdit",uri:a,edits:[],done:!1,isExternalEdit:!0}:{kind:"textEdit",uri:a,edits:[],done:!1,isExternalEdit:!0}]}var t9=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.chatSessionResource=e;this.isGlobalEditingSession=t;this._lookupExternalEntry=o;this._instantiationService=r;this._modelService=s;this._languageService=l;this._textModelService=c;this._bulkEditService=u;this._editorGroupsService=p;this._editorService=h;this._notebookService=g;this._accessibilitySignalService=f;this._logService=v;this.configurationService=b;this._fileService=S;this._explanationModelManager=y;this._telemetryService=w;this.supportsKeepUndo=!1;this._state=De(this,0);this._initialFileContents=new dt;this._baselineCreationLocks=new II;this._streamingEditLocks=new II;this._externalEditOperations=new Map;this._entriesObs=De(this,[]);this.entries=ke(e=>{let t=this._state.read(e);return t===3||t===0?[]:this._entriesObs.read(e)});this._onDidDispose=new T;this._timeline=this._instantiationService.createInstance(nHe,e,this._getTimelineDelegate()),this.canRedo=this._timeline.canRedo.map((x,E)=>x&&this._state.read(E)===2),this.canUndo=this._timeline.canUndo.map((x,E)=>x&&this._state.read(E)===2),this._init(n)}get state(){return this._state}get requestDisablement(){return this._timeline.requestDisablement}get onDidDispose(){return this._assertNotDisposed(),this._onDidDispose.event}_getTimelineDelegate(){return{createFile:(e,t)=>this._bulkEditService.apply({edits:[{newResource:e,options:{overwrite:!0,contents:t?Promise.resolve(Ke.fromString(t)):void 0}}]}),deleteFile:async e=>{let t=this._entriesObs.get().find(n=>ze(n.modifiedURI,e)),o=this._entriesObs.get().filter(n=>!ze(n.modifiedURI,e));this._entriesObs.set(o,void 0),t?.dispose(),await this._bulkEditService.apply({edits:[{oldResource:e,options:{ignoreIfNotExists:!0}}]})},renameFile:async(e,t)=>{let o=this._entriesObs.get(),n=o.find(r=>ze(r.modifiedURI,e));if(n){let r=await this._getOrCreateModifiedFileEntry(t,0,n.telemetryInfo,this._getCurrentTextOrNotebookSnapshot(n));n.dispose(),this._entriesObs.set(o.map(s=>s===n?r:s),void 0)}},setContents:async(e,t,o)=>{let n=await this._getOrCreateModifiedFileEntry(e,0,o),r=n.state.get();n instanceof GE?await n.restoreModifiedModelFromSnapshot(t):await n.acceptAgentEdits(e,[{range:new G(1,1,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),text:t}],!0,void 0),r!==0&&await n.accept()}}}async _init(e){let t=this._instantiationService.createInstance(nre,this.chatSessionResource),o;if(e instanceof t9)o=e._getStoredState(this.chatSessionResource);else if(o=await t.restoreState().catch(n=>{this._logService.error(`Error restoring chat editing session state for ${this.chatSessionResource}`,n)}),this._store.isDisposed)return;if(o){for(let[n,r]of o.initialFileContents)this._initialFileContents.set(n,r);o.timeline&&Ki(n=>this._timeline.restoreFromState(o.timeline,n)),await this._initEntries(o.recentSnapshot)}this._state.set(2,void 0)}_getEntry(e){return e=sn.parse(e)?.notebook??e,this._entriesObs.get().find(t=>ze(t.modifiedURI,e))}getEntry(e){return this._getEntry(e)}readEntry(e,t){return e=sn.parse(e)?.notebook??e,this._entriesObs.read(t).find(o=>ze(o.modifiedURI,e))}storeState(){let e=this._instantiationService.createInstance(nre,this.chatSessionResource),t=this._getStoredState();return this._telemetryService.publicLog2("chatEditing/sessionStore",{editSessionId:Qlt(this.chatSessionResource),...this._countEntryStates(this._entriesObs.get())}),e.storeState(t)}_getStoredState(e=this.chatSessionResource){let t=new dt;for(let n of this._entriesObs.get())t.set(n.modifiedURI,n.createSnapshot(e,void 0,void 0));return{initialFileContents:this._initialFileContents,timeline:this._timeline.getStateForPersistence(),recentSnapshot:{entries:t,stopId:void 0}}}getEntryDiffBetweenStops(e,t,o){return this._timeline.getEntryDiffBetweenStops(e,t,o)}getEntryDiffBetweenRequests(e,t,o){return this._timeline.getEntryDiffBetweenRequests(e,t,o)}getDiffsForFilesInSession(){return this._timeline.getDiffsForFilesInSession()}getDiffForSession(){return this._timeline.getDiffForSession()}getDiffsForFilesInRequest(e){return this._timeline.getDiffsForFilesInRequest(e)}hasEditsInRequest(e,t){return this._timeline.hasEditsInRequest(e,t)}createSnapshot(e,t){let o=t?`Request ${e} - Stop ${t}`:`Request ${e}`;this._timeline.createCheckpoint(e,t,o)}async getSnapshotContents(e,t,o){let n=await this._timeline.getContentAtStop(e,t,o);return typeof n=="string"?Ke.fromString(n):n}async getSnapshotModel(e,t,o){await this._baselineCreationLocks.peek(o.path);let n=await this._timeline.getContentAtStop(e,o,t);if(n===void 0)return null;let r=typeof n=="string"?n:n.toString(),s=this._modelService.createModel(r,this._languageService.createByFilepathOrFirstLine(o),o,!1),l=new O;return l.add(s.onWillDispose(()=>l.dispose())),l.add(this._timeline.onDidChangeContentsAtStop(e,o,t,c=>s.setValue(c))),s}getSnapshotUri(e,t,o){return this._timeline.getContentURIAtStop(e,t,o)}async restoreSnapshot(e,t){let o=this._timeline.getCheckpointIdForRequest(e,t);o&&await this._timeline.navigateToCheckpoint(o)}_assertNotDisposed(){if(this._state.get()===3)throw new ci("Cannot access a disposed editing session")}async accept(...e){await this._operateEntry("accept",e)&&this._accessibilitySignalService.playSignal(tn.editsKept,{allowManyInParallel:!0})}async reject(...e){await this._operateEntry("reject",e)&&this._accessibilitySignalService.playSignal(tn.editsUndone,{allowManyInParallel:!0})}async _operateEntry(e,t){this._assertNotDisposed();let o=this._entriesObs.get().filter(s=>t.length===0||t.some(l=>ze(l,s.modifiedURI))).filter(s=>!s.isCurrentlyBeingModifiedBy.get()).filter(s=>s.state.get()===0);if(o.length===0)return 0;let n=e==="accept"?"acceptDeferred":"rejectDeferred",r=await Promise.all(o.map(s=>s[n]().catch(l=>{this._logService.error(`Error calling ${n} on entry ${s.modifiedURI}`,l)})));return Ki(s=>{r.forEach(l=>l?.(s))}),o.length}async show(e){if(this._assertNotDisposed(),this._editorPane){if(this._editorPane.isVisible())return;if(this._editorPane.input){await this._editorService.openEditor(this._editorPane.input,{pinned:!0,activation:1});return}}let t=Ou.fromResourceMultiDiffEditorInput({multiDiffSource:JAt(this,e),label:d(8001,null)},this._instantiationService);this._editorPane=await this._editorService.openEditor(t,{pinned:!0,activation:1})}async stop(e=!1){this._stopPromise??=Promise.allSettled([this._performStop(),this.storeState()]).then(()=>{}),await this._stopPromise,e&&await this._instantiationService.createInstance(nre,this.chatSessionResource).clearState()}async _performStop(){let e=[KE.scheme,ZR.scheme];await Promise.allSettled(this._editorGroupsService.groups.flatMap(async t=>t.editors.map(async o=>{(o instanceof Ou&&o.initialResources?.some(n=>n.originalUri&&e.indexOf(n.originalUri.scheme)!==-1)||o instanceof Ba&&o.original.resource&&e.indexOf(o.original.resource.scheme)!==-1)&&await t.closeEditor(o)})))}dispose(){this._assertNotDisposed(),this.clearExplanations(),je(this._entriesObs.get()),super.dispose(),this._state.set(3,void 0),this._onDidDispose.fire(),this._onDidDispose.dispose()}get isDisposed(){return this._state.get()===3}startStreamingEdits(e,t,o){let n=new Mo,r=new Mo,s=new TWi(15,1e3);s.queue(()=>r.p),this._baselineCreationLocks.queue(e.path,()=>r.p),this._streamingEditLocks.queue(e.toString(),async()=>(await iee(this),this.isDisposed||await this._acceptStreamingEditsStart(t,o,e),r.complete(),n.p));let l=!1;return{pushText:(c,u)=>{s.queue(async()=>{this.isDisposed||await this._acceptEdits(e,c,u,t)})},pushNotebookCellText:(c,u,p)=>{s.queue(async()=>{this.isDisposed||await this._acceptEdits(c,u,p,t)})},pushNotebook:(c,u)=>{s.queue(async()=>{this.isDisposed||await this._acceptEdits(e,c,u,t)})},complete:()=>{l||(l=!0,s.queue(async()=>{this.isDisposed||(await this._acceptEdits(e,[],!0,t),await this._resolve(t.requestId,o,e),n.complete())}))}}}startDeletion(e,t,o){this._assertNotDisposed(),this._streamingEditLocks.queue(e.toString(),async()=>{if(this.isDisposed)return;await iee(this);let n;try{n=(await this._fileService.readFile(e)).value.toString()}catch{this._logService.warn(`Cannot delete file ${e.toString()}: file does not exist`);return}let r=this._getEntry(e);if(r){r.dispose();let p=this._entriesObs.get().filter(h=>h!==r);this._entriesObs.set(p,void 0)}this._initialFileContents.has(e)||this._initialFileContents.set(e,n),await this._bulkEditService.apply({edits:[{oldResource:e,options:{ignoreIfNotExists:!0}}]}),this._timeline.recordFileOperation({type:"delete",uri:e,requestId:t.requestId,epoch:this._timeline.incrementEpoch(),finalContent:n});let s=this._getTelemetryInfoForModel(t),l=this._languageService.createByFilepathOrFirstLine(e),c=this._instantiationService.createInstance(e9,e,n,{collapse:p=>this._collapse(e,p)},s,l.languageId),u=[...this._entriesObs.get(),c];this._entriesObs.set(u,void 0)})}applyWorkspaceEdit(e,t,o){for(let n of e.edits)n.oldResource&&!n.newResource&&this.startDeletion(n.oldResource,t,o)}async startExternalEdits(e,t,o,n,r){let s=new dt,l=[],c=[],u=[],p=this._getTelemetryInfoForModel(e);await iee(this);for(let h=0;h<o.length;h++){let g=o[h],f=r?.[h],v=new Mo;c.push(v);let b=new Mo;l.push(b),this._streamingEditLocks.queue(g.toString(),async()=>{if(this.isDisposed){b.complete();return}let S;if(f)try{S=(await this._fileService.readFile(f)).value.toString()}catch{S=""}let y=await this._getOrCreateModifiedFileEntry(g,1,p,S);y&&await this._acceptStreamingEditsStart(e,n,g);let w=sn.parse(g)?.notebook||g;return u.push(...LSn(g,this._notebookService.hasSupportedNotebooks(w),n)),S!==void 0?(y&&(y.initialContent=S,await y.resetEditTrackerToInitialContent()),s.set(g,S)):(await y?.save(),s.set(g,y&&this._getCurrentTextOrNotebookSnapshot(y))),y?.startExternalEdit(),b.complete(),v.p})}return await Promise.all(l.map(h=>h.p)),this.createSnapshot(e.requestId,n),this._externalEditOperations.set(t,{responseModel:e,snapshots:s,undoStopId:n,releaseLocks:()=>c.forEach(h=>h.complete())}),u}async stopExternalEdits(e,t,o){let n=this._externalEditOperations.get(t);if(!n)return this._logService.warn(`stopExternalEdits called for unknown operation ${t}`),[];this._externalEditOperations.delete(t);let r=[];try{let s=new dt;if(o){let l=0;for(let[c]of n.snapshots)l<o.length&&o[l]&&s.set(c,o[l]),l++}for(let[l,c]of n.snapshots){let u=this._getEntry(l);if(!u&&c===void 0&&(u=await this._getOrCreateModifiedFileEntry(l,1,this._getTelemetryInfoForModel(e),""),u&&(u.startExternalEdit(),u.acceptStreamingEditsStart(e,n.undoStopId,void 0))),!u)continue;let p,h=s.get(l);if(h)try{p=(await this._fileService.readFile(h)).value.toString()}catch{p=""}else await u.revertToDisk(),p=this._getCurrentTextOrNotebookSnapshot(u)??"";let g=[];c===void 0?this._timeline.recordFileOperation({type:"create",uri:l,requestId:e.requestId,epoch:this._timeline.incrementEpoch(),initialContent:p,telemetryInfo:u.telemetryInfo}):(g=await u.computeEditsFromSnapshots(c,p),this._recordEditOperations(u,l,g,e)),r.push(u instanceof GE?{kind:"notebookEdit",uri:l,edits:g,done:!0,isExternalEdit:!0}:{kind:"textEdit",uri:l,edits:g,done:!0,isExternalEdit:!0}),await u.acceptStreamingEditsEnd(),yn(this.chatSessionResource)===zo.Background&&await u.accept(),u.stopExternalEdit()}}finally{n.releaseLocks(),yt.some(this._streamingEditLocks.keys(),l=>!n.snapshots.has(A.parse(l)))||this._state.set(2,void 0)}return r}async undoInteraction(){await this._timeline.undoToLastCheckpoint()}async redoInteraction(){await this._timeline.redoToNextCheckpoint()}async triggerExplanationGeneration(){this.clearExplanations();let e=this._entriesObs.get(),t=[];for(let o of e)if(o instanceof ore){let n=await o.getDiffInfo();t.push({changes:n.changes,identical:n.identical,originalModel:o.originalModel,modifiedModel:o.modifiedModel})}t.length>0&&(this._explanationHandle=this._explanationModelManager.generateExplanations(t,this.chatSessionResource,Ie.None),await this._explanationHandle.completed)}clearExplanations(){this._explanationHandle&&(this._explanationHandle.dispose(),this._explanationHandle=void 0)}hasExplanations(){return this._explanationHandle!==void 0}_recordEditOperations(e,t,o,n){if(o.length>0&&yo(o[0],{cells:!0})){let s=o;this._timeline.recordFileOperation({type:"notebookEdit",uri:t,requestId:n.requestId,epoch:this._timeline.incrementEpoch(),cellEdits:s})}else{let s;if(e instanceof GE){let c=sn.parse(t);if(c){let u=e.getIndexOfCellHandle(c.handle);u!==-1&&(s=u)}}let l=o;this._timeline.recordFileOperation({type:"textEdit",uri:t,requestId:n.requestId,epoch:this._timeline.incrementEpoch(),edits:l,cellIndex:s})}}_getCurrentTextOrNotebookSnapshot(e){if(e instanceof GE)return e.getCurrentSnapshot();if(e instanceof ore)return e.getCurrentContents();if(e instanceof e9)return"";throw new Error(`unknown entry type for ${e.modifiedURI}`)}async _acceptStreamingEditsStart(e,t,o){let n=await this._getOrCreateModifiedFileEntry(o,0,this._getTelemetryInfoForModel(e));return this._timeline.hasFileBaseline(o,e.requestId)||this._timeline.recordFileBaseline({uri:o,requestId:e.requestId,content:this._getCurrentTextOrNotebookSnapshot(n),epoch:this._timeline.incrementEpoch(),telemetryInfo:n.telemetryInfo,notebookViewType:n instanceof GE?n.viewType:void 0}),Ki(r=>{this._state.set(1,r),n.acceptStreamingEditsStart(e,t,r)}),n}async _initEntries({entries:e}){for(let o of this._entriesObs.get())e.get(o.modifiedURI)||(await o.resetToInitialContent(),o.dispose());let t=[];for(let o of e.values()){let n;if(o.isDeleted)n=this._instantiationService.createInstance(e9,o.resource,o.original,{collapse:r=>this._collapse(o.resource,r)},o.telemetryInfo,o.languageId),await n.restoreFromSnapshot(o,!1);else if(n=await this._getOrCreateModifiedFileEntry(o.resource,1,o.telemetryInfo),n){let r=o.state===0;await n.restoreFromSnapshot(o,r)}n&&t.push(n)}this._entriesObs.set(t,void 0),this._telemetryService.publicLog2("chatEditing/sessionRestore",{editSessionId:Qlt(this.chatSessionResource),...this._countEntryStates(t)})}async _acceptEdits(e,t,o,n){let r=await this._getOrCreateModifiedFileEntry(e,0,this._getTelemetryInfoForModel(n));t.length>0&&this._recordEditOperations(r,e,t,n),await r.acceptAgentEdits(e,t,o,n)}_getTelemetryInfoForModel(e){return new class{get agentId(){return e.agent?.id}get modelId(){return e.request?.modelId}get modeId(){return e.request?.modeInfo?.modeId}get command(){return e.slashCommand?.name}get sessionResource(){return e.session.sessionResource}get requestId(){return e.requestId}get result(){return e.result}get applyCodeBlockSuggestionId(){return e.request?.modeInfo?.applyCodeBlockSuggestionId}get feature(){if(e.session.initialLocation==="panel")return"sideBarChat";if(e.session.initialLocation==="editor")return"inlineChat"}}}_countEntryStates(e){let t=0,o=0,n=0,r=0;for(let s of e)switch(t+=1,s.state.get()){case 0:o+=1;break;case 1:n+=1;break;case 2:r+=1;break}return{entryCount:t,modifiedCount:o,acceptedCount:n,rejectedCount:r}}async _resolve(e,t,o){yt.some(this._streamingEditLocks.keys(),l=>l!==o.toString())||this._state.set(2,void 0);let r=this._getEntry(o);if(!r)return;let s=t?`Request ${e} - Stop ${t}`:`Request ${e}`;return this._timeline.createCheckpoint(e,t,s),r.acceptStreamingEditsEnd()}async _getOrCreateModifiedFileEntry(e,t,o,n){e=sn.parse(e)?.notebook??e;let r=this._entriesObs.get().find(p=>ze(p.modifiedURI,e));if(r)if(r instanceof e9){let p=r.state.get()===0?r.initialContent:void 0;r.dispose();let h=this._entriesObs.get().filter(g=>g!==r);this._entriesObs.set(h,void 0),p!==void 0&&(n=p)}else return o.requestId!==r.telemetryInfo.requestId&&r.updateTelemetryInfo(o),r;let s,l=this._lookupExternalEntry(e);if(l)s=l,o.requestId!==s.telemetryInfo.requestId&&s.updateTelemetryInfo(o);else{let p=n??this._initialFileContents.get(e),h=await this._createModifiedFileEntry(e,o,t,p);if(!h)return;s=h,p===void 0&&this._initialFileContents.set(e,s.initialContent)}let c=s.onDidDelete(()=>{let p=this._entriesObs.get().filter(h=>!ze(h.modifiedURI,s.modifiedURI));this._entriesObs.set(p,void 0),this._editorService.closeEditors(this._editorService.findEditors(s.modifiedURI)),l||s.dispose(),this._store.delete(c)});this._store.add(c);let u=[...this._entriesObs.get(),s];return this._entriesObs.set(u,void 0),s}async _createModifiedFileEntry(e,t,o,n){let r={collapse:c=>this._collapse(e,c),recordOperation:c=>{c.epoch=this._timeline.incrementEpoch(),this._timeline.recordFileOperation(c)}},s=sn.parse(e)?.notebook||e,l=async c=>{if(this._notebookService.hasSupportedNotebooks(s))return await GE.create(s,r,t,c,n,this._instantiationService);{let u=await this._textModelService.createModelReference(e);return this._instantiationService.createInstance(ore,u,r,t,c,n)}};try{return await l(1)}catch{return o===1?void 0:(await this._bulkEditService.apply({edits:[{newResource:e}]}),this.configurationService.getValue("accessibility.openChatEditedFiles")&&this._editorService.openEditor({resource:e,options:{inactive:!0,preserveFocus:!0,pinned:!0,isExplicit:!1}}),this._timeline.recordFileOperation({type:"create",uri:e,requestId:t.requestId,epoch:this._timeline.incrementEpoch(),initialContent:n||"",telemetryInfo:t}),this._notebookService.hasSupportedNotebooks(s)?await GE.create(e,r,t,0,n,this._instantiationService):await l(0))}}_collapse(e,t){let o=this._editorPane?.findDocumentDiffItem(e);o&&this._editorPane?.viewModel?.items.get().find(n=>ze(n.originalUri,o.originalUri)&&ze(n.modifiedUri,o.modifiedUri))?.collapsed.set(!0,t)}};t9=I([m(4,F),m(5,_t),m(6,Rt),m(7,Bt),m(8,Ka),m(9,kt),m(10,ie),m(11,kn),m(12,br),m(13,re),m(14,B),m(15,ge),m(16,lbe),m(17,_e)],t9);var dHe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._instantiationService=e;this._chatService=r;this._editorService=s;this._fileService=c;this.lifecycleService=u;this.notebookService=v;this._configurationService=b;this._providers=new Map;this._sessionsObs=Xm({equalsFn:(e,t)=>!1},new ra);this.editingSessionsObs=ke(e=>Array.from(this._sessionsObs.read(e)));this._register(l.registerDecorationsProvider(e.createInstance(_Wi,this.editingSessionsObs))),this._register(t.registerResolver(e.createInstance(Jlt,this.editingSessionsObs))),this._register(o.registerTextModelContentProvider(ZR.scheme,e.createInstance(ZR,this))),this._register(o.registerTextModelContentProvider(Q.chatEditingSnapshotScheme,e.createInstance(y$,this))),this._register(this._chatService.onDidDisposeSession(x=>{if(x.reason==="cleared")for(let E of x.sessionResources)this.getEditingSession(E)?.stop()}));let S=eco.bindTo(n),y=()=>{let x=f.quality!=="stable"&&g.extensions.some(E=>E.enabledApiProposals?.includes("chatReadonlyPromptReference"));S.set(x)};y(),this._register(g.onDidRegisterExtensions(y)),this._register(g.onDidChangeExtensions(y));let w;this._register(p.onWillSaveState(()=>{let x=[];for(let E of this.editingSessionsObs.get())E.isGlobalEditingSession&&x.push(E.storeState());w=Promise.resolve(w).then(()=>Promise.all(x)).finally(()=>w=void 0)})),this._register(this.lifecycleService.onWillShutdown(x=>{w&&x.join(w,{id:"join.chatEditingSession",label:d(8000,null)})}))}dispose(){je(this._sessionsObs.get()),super.dispose()}startOrContinueGlobalEditingSession(e){return this.getEditingSession(e.sessionResource)||this.createEditingSession(e,!0)}_lookupEntry(e){for(let t of yt.concat(this.editingSessionsObs.get())){let o=t.getEntry(e);if(o instanceof KE)return o.acquire()}}getEditingSession(e){return this.editingSessionsObs.get().find(t=>ze(t.chatSessionResource,e))}createEditingSession(e,t=!1){return this._createEditingSession(e,t,void 0)}transferEditingSession(e,t){return this._createEditingSession(e,t.isGlobalEditingSession,t)}_createEditingSession(e,t,o){To(this.getEditingSession(e.sessionResource)===void 0,"CANNOT have more than one editing session per chat session");let n=this._providers.get(yn(e.sessionResource)),r=n?n.createEditingSession(e.sessionResource):this._instantiationService.createInstance(t9,e.sessionResource,t,this._lookupEntry.bind(this),o),s=this._sessionsObs.get(),l=s.unshift(r),c=new O;return this._store.add(c),!n&&r instanceof t9&&c.add(this.installAutoApplyObserver(r,e)),c.add(r.onDidDispose(u=>{l(),this._sessionsObs.set(s,void 0),this._store.delete(c)})),this._sessionsObs.set(s,void 0),r}registerEditingSessionProvider(e,t){return this._providers.set(e,t),ee(()=>{this._providers.get(e)===t&&this._providers.delete(e)})}installAutoApplyObserver(e,t){if(!t)throw new ka(`Edit session was created for a non-existing chat session: ${e.chatSessionResource}`);let o=new O;return o.add(t.onDidChange(async n=>{if(n.kind!=="addRequest")return;e.createSnapshot(n.request.id,void 0);let r=n.request.response;r&&this.observerEditsInResponse(n.request.id,r,e,o)})),o.add(t.onDidDispose(()=>o.dispose())),o}observerEditsInResponse(e,t,o,n){let r;(b=>(b[b.Stream=0]="Stream",b[b.Workspace=1]="Workspace"))(r||={});let s=[],l=this._editorService.activeEditorPane?.input,c=new dt,u=this._configurationService.getValue("accessibility.openChatEditedFiles"),p=f=>{let v=sn.parse(f)?.notebook??f;c.has(v)||c.set(v,(async()=>{if(this.notebookService.getNotebookTextModel(v)||v.scheme===Q.untitled||await this._fileService.exists(v).catch(()=>!1)){let b=this._editorService.activeEditorPane?.input.resource,S=this._editorService.activeEditorPane?.input,w=(l&&S?!l.matches(S):l!==S)||this._editorService.activeEditorPane?.input instanceof tl&&ze(this._editorService.activeEditorPane.input.sessionResource,o.chatSessionResource)||!!(b&&o.entries.get().find(x=>ze(b,x.modifiedURI)));this._editorService.openEditor({resource:v,options:{inactive:w,preserveFocus:!0,pinned:!0,isExplicit:!1}})}})())},h=()=>{for(let f of s)f?.kind===0&&f.stream.complete();s.length=0,c.clear()},g=async()=>{if(t.isCanceled)return;let f;for(let v=0;v<t.response.value.length;v++){let b=t.response.value[v];if(b.kind==="undoStop"){f=b.id;continue}if(b.kind==="workspaceEdit"){s[v]||(s[v]={kind:1},o.applyWorkspaceEdit(b,t,f??t.requestId));continue}if(b.kind!=="textEditGroup"&&b.kind!=="notebookEditGroup"||b.isExternalEdit)continue;u&&p(b.uri);let S=s[v];if(S||(S={kind:0,seen:0,stream:o.startStreamingEdits(sn.parse(b.uri)?.notebook??b.uri,t,f)},s[v]=S),S.kind!==0)continue;let y=S.seen===0,w=b.edits.slice(S.seen);if(S.seen=b.edits.length,w.length>0||y)for(let x=0;x<w.length;x++){let E=w[x],M=b.done?x===w.length-1:!1;if(MSn(E))S.stream.pushText(E,M);else if(nMe(E))for(let N of Object.values(yy(E,V=>V.uri.toString())))N&&S.stream.pushNotebookCellText(N[0].uri,N.map(V=>V.edit),M);else S.stream.pushNotebook(E,M)}b.done&&S.stream.complete()}};if(t.isComplete)g().then(()=>{h()});else{let f=n.add(t.onDidChange(v=>{v.reason==="undoStop"?o.createSnapshot(e,v.id):g().then(()=>{t.isComplete&&(h(),n.delete(f))})}))}}};dHe=I([m(0,F),m(1,rG),m(2,Bt),m(3,X),m(4,si),m(5,ie),m(6,mb),m(7,ge),m(8,to),m(9,de),m(10,re),m(11,lt),m(12,Ze),m(13,kn),m(14,B)],dHe);function wLo(a,i,e){let t=e.add(new T);return e.add(Zs(a,(o,n)=>{let r=dA(n||[],o,i),s=[].concat(r.added).concat(r.removed);t.fire(s)})),t.event}var _Wi=class extends k{constructor(e){super();this._sessions=e;this.label=d(7998,null);this._currentEntries=ke(this,e=>{let t=this._sessions.read(e);if(!t)return[];let o=[];for(let n of t)if(n.state.read(e)!==3){let r=n.entries.read(e);o.push(...r)}return o});this._currentlyEditingUris=ke(this,e=>this._currentEntries.read(e).filter(o=>o.isCurrentlyBeingModifiedBy.read(e)).map(o=>o.modifiedURI));this._modifiedUris=ke(this,e=>this._currentEntries.read(e).filter(o=>!o.isCurrentlyBeingModifiedBy.read(e)&&o.state.read(e)===0).map(o=>o.modifiedURI));this.onDidChange=U.any(wLo(this._currentlyEditingUris,Il(t=>t.toString(),oc),this._store),wLo(this._modifiedUris,Il(t=>t.toString(),oc),this._store))}provideDecorations(e,t){if(this._currentlyEditingUris.get().some(r=>ze(r,e)))return{weight:1e3,letter:q.modify(L.loading,"spin"),bubble:!1};if(this._modifiedUris.get().some(r=>ze(r,e)))return{weight:1e3,letter:L.diffModified,tooltip:d(7999,null),bubble:!0}}},Jlt=class{constructor(i,e){this._editingSessionsObs=i;this._instantiationService=e}canHandleUri(i){return i.scheme===eG}async resolveDiffSource(i){let e=HXe(i),t=ke(this,o=>this._editingSessionsObs.read(o).find(n=>ze(n.chatSessionResource,e.chatSessionResource)));return this._instantiationService.createInstance(DWi,t,e.showPreviousChanges)}};Jlt=I([m(1,F)],Jlt);var DWi=class{constructor(i,e){this._currentSession=i;this._showPreviousChanges=e;this._resources=ke(this,i=>{let e=this._currentSession.read(i);return e?e.entries.read(i).map(o=>{if(this._showPreviousChanges){let r=e.getEntryDiffBetweenStops(o.modifiedURI,void 0,void 0)?.read(i);if(r)return new wE(r.originalURI,r.modifiedURI,void 0,void 0,{[HDe.key]:o.entryId})}return new wE(o.originalURI,o.modifiedURI,void 0,void 0,{[HDe.key]:o.entryId})}):[]});this.resources=new cF(this._resources);this.contextKeys={[XAt.key]:!0}}};function MSn(a){return a.some(i=>hT.isTextEdit(i))}var PSn=13,uHe=class extends k{constructor(i){super();let e=hr("chat.fontFamily","default",i);this.fontFamily=ke(t=>{let o=e.read(t);return o==="default"?null:o}),this.fontSize=hr("chat.fontSize",PSn,i)}};uHe=I([m(0,B)],uHe);var pHe=class extends k{constructor(e,t,o,n,r,s,l){super();this.fileService=e;this.textFileService=t;this.textModelService=o;this.editorService=n;this.textEditorService=r;this._onDidChangeLanguageModelGroups=this._register(new T);this.onDidChangeLanguageModelGroups=this._onDidChangeLanguageModelGroups.event;this.languageModelsProviderGroups=[];this.modelsConfigurationFile=l.extUri.joinPath(s.currentProfile.location,"chatLanguageModels.json"),this.updateLanguageModelsConfiguration(),this._register(e.watch(l.extUri.dirname(this.modelsConfigurationFile))),this._register(e.onDidFilesChange(c=>{c.contains(this.modelsConfigurationFile)&&this.updateLanguageModelsConfiguration()}))}get configurationFile(){return this.modelsConfigurationFile}setLanguageModelsConfiguration(e){let t=[],o=new Map(this.languageModelsProviderGroups.map(r=>[`${r.vendor}:${r.name}`,r])),n=new Map(e.map(r=>[`${r.vendor}:${r.name}`,r]));for(let[r,s]of n){let l=o.get(r);(!l||!Qi(l,s))&&t.push(s)}for(let[r,s]of o)n.has(r)||t.push(s);this.languageModelsProviderGroups=e,t.length>0&&this._onDidChangeLanguageModelGroups.fire(t)}async updateLanguageModelsConfiguration(){let e=await this.withLanguageModelsProviderGroups();this.setLanguageModelsConfiguration(e)}getLanguageModelsProviderGroups(){return this.languageModelsProviderGroups}async addLanguageModelsProviderGroup(e){await this.withLanguageModelsProviderGroups(async o=>{if(o.some(({name:n,vendor:r})=>n===e.name&&r===e.vendor))throw new Error(`Language model group with name ${e.name} already exists for vendor ${e.vendor}`);return o.push(e),o}),await this.updateLanguageModelsConfiguration();let t=this.getLanguageModelsProviderGroups().find(o=>o.name===e.name&&o.vendor===e.vendor);if(!t)throw new Error(`Language model group with name ${e.name} not found for vendor ${e.vendor}`);return t}async updateLanguageModelsProviderGroup(e,t){await this.withLanguageModelsProviderGroups(async n=>{let r=[];for(let s of n)s.name===e.name&&s.vendor===e.vendor?r.push(t):r.push(s);return r}),await this.updateLanguageModelsConfiguration();let o=this.getLanguageModelsProviderGroups().find(n=>n.name===t.name&&n.vendor===t.vendor);if(!o)throw new Error(`Language model group with name ${t.name} not found for vendor ${t.vendor}`);return o}async removeLanguageModelsProviderGroup(e){await this.withLanguageModelsProviderGroups(async t=>{let o=[];for(let n of t)n.name===e.name&&n.vendor===e.vendor||o.push(n);return o}),await this.updateLanguageModelsConfiguration()}async configureLanguageModels(e){let t=await this.editorService.openEditor(this.textEditorService.createTextEditor({resource:this.modelsConfigurationFile}));if(!t||!e?.group)return;let o=da(t.getControl());if(o&&e.group.range)if(e.snippet){let n=o.getModel();if(!n)return;let r=e.group.range.endLineNumber-1,s=n.getLineLength(r),l={lineNumber:r,column:s+1};o.setPosition(l),o.revealPositionNearTop(l),o.focus(),ss.get(o)?.insert(`,
`+e.snippet)}else{let n={lineNumber:e.group.range.startLineNumber,column:e.group.range.startColumn};o.setPosition(n),o.revealPositionNearTop(n),o.focus()}}async withLanguageModelsProviderGroups(e){await this.fileService.exists(this.modelsConfigurationFile)||await this.fileService.writeFile(this.modelsConfigurationFile,Ke.fromString(JSON.stringify([],void 0,"	")));let o=await this.textModelService.createModelReference(this.modelsConfigurationFile),n=o.object.textEditorModel;try{let r=ASn(n);if(!e)return r;let s=await e(r);for(let l of s)delete l.range;return n.setValue(JSON.stringify(s,void 0,"	")),await this.textFileService.save(this.modelsConfigurationFile),s}finally{o.dispose()}}};pHe=I([m(0,ge),m(1,Uo),m(2,Bt),m(3,ie),m(4,TE),m(5,gn),m(6,gt)],pHe);function ASn(a){let i=[],e=null,t=i,o=[];function n(s,l,c){Array.isArray(t)?t.push(s):e!==null&&(t[e]=s)}let r={onObjectBegin:(s,l)=>{let c={};if(o.length===1&&Array.isArray(t)){let u=a.getPositionAt(s),p=a.getPositionAt(s+l);c.range={startLineNumber:u.lineNumber,startColumn:u.column,endLineNumber:p.lineNumber,endColumn:p.column}}n(c,s,l),o.push(t),t=c,e=null},onObjectProperty:(s,l,c)=>{e=s},onObjectEnd:(s,l)=>{let c=t;if(c.range){let u=a.getPositionAt(s+l);c.range={startLineNumber:c.range.startLineNumber,startColumn:c.range.startColumn,endLineNumber:u.lineNumber,endColumn:u.column}}if(c._parentConfigurationRange){let u=a.getPositionAt(s+l);c._parentConfigurationRange.endLineNumber=u.lineNumber,c._parentConfigurationRange.endColumn=u.column,delete c._parentConfigurationRange}t=o.pop()},onArrayBegin:(s,l)=>{if(t===i&&o.length===0){o.push(t),e=null;return}let c=[];n(c,s,l),o.push(t),t=c,e=null},onArrayEnd:(s,l)=>{let c=t;if(c._parentConfigurationRange){let u=a.getPositionAt(s+l);c._parentConfigurationRange.endLineNumber=u.lineNumber,c._parentConfigurationRange.endColumn=u.column,delete c._parentConfigurationRange}t=o.pop()},onLiteralValue:(s,l,c)=>{n(s,l,c)}};return rE(a.getValue(),r),i}var CLo="vscode://schemas/language-models",pbe=class extends k{constructor(e,t){super();this.languageModelsService=e;let o=oe.as(Ta.JSONContribution);this._register(o.registerSchemaAssociation(CLo,t.configurationFile.toString())),this.updateSchema(o),this._register(this.languageModelsService.onDidChangeLanguageModels(()=>this.updateSchema(o)))}static{this.ID="workbench.contrib.chatLanguageModelsData"}updateSchema(e){let t=this.languageModelsService.getVendors(),o=[],n=this.languageModelsService.getLanguageModelIds();for(let s of n){let l=this.languageModelsService.lookupLanguageModel(s);l?.configurationSchema&&o.push({if:{properties:{vendor:{const:l.vendor}}},then:{properties:{settings:{type:"object",properties:{[l.id]:l.configurationSchema}}}}})}let r={type:"array",items:{properties:{vendor:{type:"string",enum:t.map(s=>s.vendor)},name:{type:"string"},settings:{type:"object",description:d(8356,null)}},allOf:[...t.map(s=>({if:{properties:{vendor:{const:s.vendor}}},then:s.configuration})),...o],required:["vendor","name"]}};e.registerSchema(CLo,r)}};pbe=I([m(0,Gr),m(1,_H)],pbe);var NSn="model.entry.template",OSn="vendor.entry.template";var FSn=UF(HX,Qw),RWi=/@capability:\s*([^\s]+)/gi,LWi=/@provider:\s*((".+?")|([^\s]+))/gi,PWi={FILTER_TYPES:["@provider:","@capability:"],CAPABILITIES:["@capability:tools","@capability:vision","@capability:agent"]};function CO(a){return a.type==="vendor"}function y1(a){return a.type==="group"}function hHe(a){return a.type==="status"}var mHe=class extends k{constructor(e){super();this.languageModelsService=e;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onDidChangeGrouping=this._register(new T);this.onDidChangeGrouping=this._onDidChangeGrouping.event;this.languageModelGroupStatuses=[];this.languageModelGroups=[];this.collapsedGroups=new Set;this.searchValue="";this.modelsSorted=!1;this._groupBy="vendor";this._viewModelEntries=[];this.languageModels=[],this._register(this.languageModelsService.onDidChangeLanguageModels(t=>this.refreshVendor(t)))}get groupBy(){return this._groupBy}set groupBy(e){this._groupBy!==e&&(this._groupBy=e,this.collapsedGroups.clear(),this.languageModelGroups=this.groupModels(this.languageModels),this.doFilter(),this._onDidChangeGrouping.fire(e))}get viewModelEntries(){return this._viewModelEntries}splice(e,t,o){this._viewModelEntries.splice(e,t,...o),this.selectedEntry&&(this.selectedEntry=this._viewModelEntries.find(n=>n.id===this.selectedEntry?.id)),this._onDidChange.fire({at:e,removed:t,added:o})}shouldRefilter(){return!this.modelsSorted}filter(e){return e!==this.searchValue&&(this.searchValue=e,this.collapsedGroups.clear(),this.modelsSorted||(this.languageModelGroups=this.groupModels(this.languageModels)),this.doFilter()),this.viewModelEntries}doFilter(){let e=[],t=this.languageModelGroups.length>1;for(let o of this.languageModelGroups){if(this.collapsedGroups.has(o.group.id)){o.group.collapsed=!0,t&&e.push(o.group);continue}let n=[];o.status&&n.push(o.status),n.push(...this.filterModels(o.models,this.searchValue)),n.length>0&&(o.group.collapsed=!1,t&&e.push(o.group),e.push(...n))}this.splice(0,this._viewModelEntries.length,e)}filterModels(e,t){let o=[],n;for(LWi.lastIndex=0;(n=LWi.exec(t))!==null;){let f=n[2]?n[2].substring(1,n[2].length-1):n[3];o.push(f)}o.length>0&&(t=t.replace(LWi,""));let r=[],s;for(RWi.lastIndex=0;(s=RWi.exec(t))!==null;)r.push(s[1].toLowerCase());r.length>0&&(t=t.replace(RWi,""));let l=t.charAt(0)==='"',c=t.charAt(t.length-1)==='"',u=l&&c;l&&(t=t.substring(1)),c&&(t=t.substring(0,t.length-1)),t=t.trim();let p=[],h=t.split(" "),g=o.map(f=>f.toLowerCase().trim());for(let f of e){if(g.length>0&&!g.some(w=>f.provider.vendor.vendor.toLowerCase()===w||f.provider.vendor.displayName.toLowerCase()===w))continue;let v=[];if(r.length>0){if(!f.metadata.capabilities)continue;let y=!0;for(let w of r){let x=this.getMatchingCapabilities(f,w);if(x.length===0){y=!1;break}v.push(...x)}if(!y)continue;v=jo(v)}let b;if(t&&(b=new MWi(f,t,h,u),!b.modelNameMatches&&!b.modelIdMatches&&!b.providerMatches&&!b.capabilityMatches))continue;let S=this.getModelId(f);p.push({type:"model",id:S,templateId:NSn,model:f,modelNameMatches:b?.modelNameMatches||void 0,modelIdMatches:b?.modelIdMatches||void 0,providerMatches:b?.providerMatches||void 0,capabilityMatches:v.length?v:void 0})}return p}getMatchingCapabilities(e,t){let o=[];if(!e.metadata.capabilities)return o;switch(t){case"tools":case"toolcalling":e.metadata.capabilities.toolCalling===!0&&o.push("toolCalling");break;case"vision":e.metadata.capabilities.vision===!0&&o.push("vision");break;case"agent":case"agentmode":e.metadata.capabilities.agentMode===!0&&o.push("agentMode");break;default:if(e.metadata.capabilities.editTools)for(let n of e.metadata.capabilities.editTools)n.toLowerCase().includes(t)&&o.push(n);break}return o}groupModels(e){let t=[];if(this.groupBy==="vendor"){for(let o of e){let n=this.getProviderGroupId(o.provider.group),r=t.find(s=>s.group.id===n);r||(r={group:this.createLanguageModelProviderEntry(o.provider),models:[]},t.push(r)),r.models.push(o)}for(let o of this.languageModelGroupStatuses){let n=this.getProviderGroupId(o.provider.group),r=t.find(s=>s.group.id===n);r||(r={group:this.createLanguageModelProviderEntry(o.provider),models:[]},t.push(r)),r.status={id:`status.${r.group.id}`,type:"status",...o.status}}t.sort((o,n)=>o.models[0]?.provider.vendor.isDefault?-1:n.models[0]?.provider.vendor.isDefault?1:o.group.label.localeCompare(n.group.label))}for(let o of t)o.models.sort((n,r)=>n.provider.vendor.isDefault&&r.provider.vendor.isDefault?n.metadata.name.localeCompare(r.metadata.name):n.provider.vendor.isDefault?-1:r.provider.vendor.isDefault?1:n.provider.group.name===r.provider.group.name?n.metadata.name.localeCompare(r.metadata.name):n.provider.group.name.localeCompare(r.provider.group.name));return this.modelsSorted=!0,t}createLanguageModelProviderEntry(e){let t=this.getProviderGroupId(e.group);return{type:"vendor",id:t,label:e.group.name,templateId:OSn,collapsed:this.collapsedGroups.has(t),vendorEntry:{group:e.group,vendor:e.vendor}}}getVendors(){return[...this.languageModelsService.getVendors()].sort((e,t)=>e.isDefault?-1:t.isDefault?1:e.displayName.localeCompare(t.displayName))}async refresh(){await this.languageModelsService.selectLanguageModels({}),await this.refreshAllVendors()}async refreshAllVendors(){this.languageModels=[],this.languageModelGroupStatuses=[];for(let e of this.getVendors())this.addVendorModels(e);this.languageModelGroups=this.groupModels(this.languageModels),this.doFilter()}refreshVendor(e){let t=this.getVendors().find(o=>o.vendor===e);t&&(this.languageModels=this.languageModels.filter(o=>o.provider.vendor.vendor!==e),this.languageModelGroupStatuses=this.languageModelGroupStatuses.filter(o=>o.provider.vendor.vendor!==e),this.addVendorModels(t),this.languageModelGroups=this.groupModels(this.languageModels),this.doFilter())}addVendorModels(e){let t=[],o=this.languageModelsService.getLanguageModelGroups(e.vendor);for(let n of o){let r={group:n.group??{vendor:e.vendor,name:e.displayName},vendor:e};n.status&&this.languageModelGroupStatuses.push({provider:r,status:{message:n.status.message,severity:n.status.severity}});for(let s of n.modelIdentifiers){let l=this.languageModelsService.lookupLanguageModel(s);l&&(e.isDefault&&l.id==="auto"||t.push({identifier:s,metadata:l,provider:r}))}}this.languageModels.push(...t.sort((n,r)=>n.metadata.name.localeCompare(r.metadata.name)))}getModelsForGroup(e){return CO(e)?this.languageModels.filter(t=>this.getProviderGroupId(t.provider.group)===e.id):this.languageModels}getModelId(e){return`${e.provider.group.name}.${e.identifier}.${e.metadata.version}`}getProviderGroupId(e){return`${e.vendor}-${e.name}`}toggleCollapsed(e){let t=y1(e)||CO(e)?e.id:void 0;t&&(this.selectedEntry=e,this.collapsedGroups.delete(t)||this.collapsedGroups.add(t),this.doFilter())}collapseAll(){this.collapsedGroups.clear();for(let e of this.viewModelEntries)(CO(e)||y1(e))&&this.collapsedGroups.add(e.id);this.doFilter()}getConfiguredVendors(){let e=[],t=new Set;for(let o of this.languageModels)t.has(o.provider.group.name)||(t.add(o.provider.group.name),e.push(o.provider));return e}};mHe=I([m(0,Gr)],mHe);var MWi=class{constructor(i,e,t,o){this.modelNameMatches=null;this.modelIdMatches=null;this.providerMatches=null;this.capabilityMatches=null;if(!o&&(this.modelNameMatches=i.metadata.name?this.matches(e,i.metadata.name,(n,r)=>Qw(n,r,!0),t):null,this.modelIdMatches=this.matches(e,i.metadata.id,UF(Qw,UX),t),this.providerMatches=this.matches(e,i.provider.group.name,(n,r)=>Qw(n,r,!0),t),i.metadata.capabilities)){let n=[];i.metadata.capabilities.toolCalling&&n.push("tools","toolCalling"),i.metadata.capabilities.vision&&n.push("vision"),i.metadata.capabilities.agentMode&&n.push("agent","agentMode"),i.metadata.capabilities.editTools&&n.push(...i.metadata.capabilities.editTools);let r=n.join(" ");r&&(this.capabilityMatches=this.matches(e,r,UF(Qw,UX),t))}}matches(i,e,t,o){let n=i?FSn(i,e):null;return n||(n=this.matchesWords(o,e,t)),n&&(n=this.filterAndSort(n)),n}matchesWords(i,e,t){let o=[];for(let n of i){let r=t(n,e);if(r)o=[...o||[],...r];else{o=null;break}}return o}filterAndSort(i){return jo(i,(e=>e.start+"."+e.end)).filter(e=>!i.some(t=>!(t.start===e.start&&t.end===e.end)&&t.start<=e.start&&t.end>=e.end)).sort((e,t)=>e.start-t.start)}};var fS=_,WSn=30,VSn=30,BSn=26;var AWi=class extends it{constructor(){super("workbench.models.filter",d(8033,null),q.asClassName(L.filter))}async run(){}};function xLo(a,i){let{query:e,synonyms:t=[],excludes:o=[]}=i,n=[e,...t],r=n.some(l=>a.includes(l)),s=o.some(l=>a.includes(l));if(r){let l=a;for(let c of n)l=l.replace(c,"");return l.replace(/\s+/g," ").trim()}else if(s){let l=a;for(let c of o)l=l.replace(c,"");return l=l.replace(/\s+/g," ").trim(),l?`${l} ${e}`:e}else{let l=a.trim();return l?`${l} ${e}`:e}}var Zlt=class extends rh{constructor(e,t,o,n,r){super(e,{getActions:()=>this.getActions()},r,{...t,classNames:e.class,anchorAlignmentProvider:()=>1,menuAsChild:!0});this.search=o;this.viewModel=n}createProviderAction(e,t){let o=`@provider:"${t}"`,n=this.search.getValue(),r=n.includes(o)||n.includes(`@provider:${e}`);return{id:`provider-${e}`,label:t,tooltip:d(8035,null,t),class:void 0,enabled:!0,checked:r,run:()=>this.toggleFilterAndSearch({query:o,synonyms:[`@provider:${e}`]})}}createCapabilityAction(e,t){let o=`@capability:${e}`,r=this.search.getValue().includes(o);return{id:`capability-${e}`,label:t,tooltip:d(8034,null,t),class:void 0,enabled:!0,checked:r,run:()=>this.toggleFilterAndSearch({query:o})}}toggleFilterAndSearch(e){let t=this.search.getValue(),o=xLo(t,e);this.search.setValue(o)}getActions(){let e=[];e.push(this.createCapabilityAction("tools",d(8017,null)),this.createCapabilityAction("vision",d(8018,null)),this.createCapabilityAction("agent",d(8016,null)));let t=this.viewModel.getConfiguredVendors();return t.length>1&&(e.push(new oi),e.push(...t.map(o=>this.createProviderAction(o.vendor.vendor,o.group.name)))),e}};Zlt=I([m(4,Xe)],Zlt);var NWi=class{constructor(){this.headerRowHeight=WSn}getHeight(i){return CO(i)||y1(i)?VSn:BSn}},i9=class{renderElement(i,e,t){t.elementDisposables.clear();let o=CO(i),n=y1(i),r=hHe(i);t.container.classList.add("models-table-column"),t.container.parentElement.classList.toggle("models-vendor-row",o||n),t.container.parentElement.classList.toggle("models-model-row",!o&&!n),t.container.parentElement.classList.toggle("models-status-row",r),o?this.renderVendorElement(i,e,t):n?this.renderGroupElement(i,e,t):r?this.renderStatusElement(i,e,t):this.renderModelElement(i,e,t)}renderStatusElement(i,e,t){}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}},_4t=class a extends i9{constructor(e){super();this.viewModel=e;this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="gutter"}renderTemplate(e){let t=new O,o=new O;e.classList.add("models-gutter-column");let n=t.add(new oo(e));return{listRowElement:e.parentElement?.parentElement??null,container:e,actionBar:n,disposables:t,elementDisposables:o}}renderElement(e,t,o){o.actionBar.clear(),super.renderElement(e,t,o)}renderVendorElement(e,t,o){this.renderCollapsableElement(e,o)}renderGroupElement(e,t,o){this.renderCollapsableElement(e,o)}renderCollapsableElement(e,t){t.listRowElement&&t.listRowElement.setAttribute("aria-expanded",e.collapsed?"false":"true");let o=e.collapsed?d(8032,null):d(8020,null),n={id:"toggleCollapse",label:o,tooltip:o,enabled:!0,class:q.asClassName(e.collapsed?L.chevronRight:L.chevronDown),run:()=>this.viewModel.toggleCollapsed(e)};t.actionBar.push(n,{icon:!0,label:!1})}renderModelElement(e,t,o){}},rre=class extends i9{constructor(e){super();this.hoverService=e;this.templateId=rre.TEMPLATE_ID}static{this.TEMPLATE_ID="modelName"}renderTemplate(e){let t=new O,o=new O,n=D(e,fS(".model-name-container")),r=D(n,fS(".status-icon")),s=t.add(new ul(D(n,fS(".model-name")))),l=D(n,fS(".model-status-icon")),c=t.add(new oo(D(n,fS(".model-name-actions"))));return{container:e,statusIcon:r,nameLabel:s,modelStatusIcon:l,actionBar:c,disposables:t,elementDisposables:o}}renderElement(e,t,o){St(o.modelStatusIcon),o.actionBar.clear(),o.nameLabel.element.classList.remove("error-status","warning-status","info-status"),super.renderElement(e,t,o)}renderVendorElement(e,t,o){o.nameLabel.set(e.vendorEntry.group.name,void 0)}renderGroupElement(e,t,o){o.nameLabel.set(e.label,void 0)}renderModelElement(e,t,o){let{model:n,modelNameMatches:r}=e;o.statusIcon.style.display="none",o.modelStatusIcon.className="model-status-icon",n.metadata.statusIcon?(o.modelStatusIcon.classList.add(...q.asClassNameArray(n.metadata.statusIcon)),o.modelStatusIcon.style.display=""):o.modelStatusIcon.style.display="none",o.nameLabel.set(n.metadata.name,r);let s=new he("",{isTrusted:!0,supportThemeIcons:!0});s.appendMarkdown(`**${e.model.metadata.name}**`),e.model.metadata.id!==e.model.metadata.version?s.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">&nbsp;_${e.model.metadata.id}@${e.model.metadata.version}_&nbsp;</span>`):s.appendMarkdown(`&nbsp;<span style="background-color:#8080802B;">&nbsp;_${e.model.metadata.id}_&nbsp;</span>`),s.appendText(`
`),e.model.metadata.statusIcon&&e.model.metadata.tooltip&&(e.model.metadata.statusIcon&&s.appendMarkdown(`$(${e.model.metadata.statusIcon.id})&nbsp;`),s.appendMarkdown(`${e.model.metadata.tooltip}`),s.appendText(`
`)),o.elementDisposables.add(this.hoverService.setupDelayedHoverAtMouse(o.container,()=>({content:s,appearance:{compact:!0,skipFadeInAnimation:!0}})))}renderStatusElement(e,t,o){switch(o.statusIcon.style.display="",o.statusIcon.className="status-icon",e.severity){case wt.Error:o.nameLabel.element.classList.add("error-status"),o.statusIcon.classList.add(...q.asClassNameArray(L.error));break;case wt.Warning:o.nameLabel.element.classList.add("warning-status"),o.statusIcon.classList.add(...q.asClassNameArray(L.warning));break;case wt.Info:o.nameLabel.element.classList.add("info-status"),o.statusIcon.classList.add(...q.asClassNameArray(L.info));break}o.nameLabel.set(e.message,void 0,e.message)}};rre=I([m(0,ot)],rre);var sre=class extends i9{constructor(e){super();this.hoverService=e;this.templateId=sre.TEMPLATE_ID}static{this.TEMPLATE_ID="combinedCost"}renderTemplate(e){let t=new O,o=new O,n=D(e,fS(".model-cost-grid")),r=D(n,fS("span.model-cost-cell")),s=D(n,fS("span.model-cost-cell")),l=D(n,fS("span.model-cost-cell"));return{container:e,inputCell:r,outputCell:s,cacheCell:l,disposables:t,elementDisposables:o}}renderElement(e,t,o){o.inputCell.textContent="",o.outputCell.textContent="",o.cacheCell.textContent="",super.renderElement(e,t,o)}renderGroupElement(e,t,o){}renderVendorElement(e,t,o){}renderModelElement(e,t,o){let{inputCost:n,outputCost:r,cacheCost:s}=e.model.metadata;if(n!==void 0||r!==void 0||s!==void 0){o.inputCell.textContent=n!==void 0?d(8026,null,n):"",o.outputCell.textContent=r!==void 0?d(8029,null,r):"",o.cacheCell.textContent=s!==void 0?d(8023,null,s):"";let c=[];n!==void 0&&c.push(n===1?d(8028,null,n):d(8027,null,n)),r!==void 0&&c.push(r===1?d(8031,null,r):d(8030,null,r)),s!==void 0&&c.push(s===1?d(8025,null,s):d(8024,null,s)),o.elementDisposables.add(this.hoverService.setupDelayedHoverAtMouse(o.container,()=>({content:c.join(`
`),appearance:{compact:!0,skipFadeInAnimation:!0}})))}else{let c=e.model.metadata.pricing;c&&(o.inputCell.textContent=c,o.elementDisposables.add(this.hoverService.setupDelayedHoverAtMouse(o.container,()=>({content:d(8071,null,c),appearance:{compact:!0,skipFadeInAnimation:!0}}))))}}};sre=I([m(0,ot)],sre);var are=class extends i9{constructor(e){super();this.hoverService=e;this.templateId=are.TEMPLATE_ID}static{this.TEMPLATE_ID="tokenLimits"}renderTemplate(e){let t=new O,o=new O,n=D(e,fS(".model-token-limits"));return{container:e,tokenLimitsElement:n,disposables:t,elementDisposables:o}}renderElement(e,t,o){St(o.tokenLimitsElement),super.renderElement(e,t,o)}renderVendorElement(e,t,o){}renderGroupElement(e,t,o){}renderModelElement(e,t,o){let{model:n}=e,r=new he("",{isTrusted:!0,supportThemeIcons:!0});if(n.metadata.maxInputTokens||n.metadata.maxOutputTokens){let s=(n.metadata.maxInputTokens??0)+(n.metadata.maxOutputTokens??0),l=D(o.tokenLimitsElement,fS(".token-limit-item")),c=D(l,fS("span"));c.textContent=FWi(s),r.appendMarkdown(`${d(8050,null)}: `),r.appendMarkdown(`${FWi(s)}`)}o.elementDisposables.add(this.hoverService.setupDelayedHoverAtMouse(o.container,()=>({content:r,appearance:{compact:!0,skipFadeInAnimation:!0}})))}};are=I([m(0,ot)],are);var D4t=class a extends i9{constructor(){super(...arguments);this.templateId=a.TEMPLATE_ID;this._onDidClickCapability=new T;this.onDidClickCapability=this._onDidClickCapability.event}static{this.TEMPLATE_ID="capabilities"}dispose(){this._onDidClickCapability.dispose()}renderTemplate(e){let t=new O,o=new O;e.classList.add("model-capability-column");let n=D(e,fS(".model-capabilities"));return{container:e,metadataRow:n,disposables:t,elementDisposables:o}}renderElement(e,t,o){St(o.metadataRow),super.renderElement(e,t,o)}renderVendorElement(e,t,o){}renderGroupElement(e,t,o){}renderModelElement(e,t,o){let{model:n,capabilityMatches:r}=e;n.metadata.capabilities?.toolCalling&&o.elementDisposables.add(this.createCapabilityButton(o.metadataRow,r?.includes("toolCalling")||!1,d(8063,null),"tools")),n.metadata.capabilities?.vision&&o.elementDisposables.add(this.createCapabilityButton(o.metadataRow,r?.includes("vision")||!1,d(8065,null),"vision"))}createCapabilityButton(e,t,o,n){let r=new O,s=D(e,fS(".model-badge-container")),l=r.add(new Pi(s,{secondary:!0}));return l.element.classList.add("model-capability"),l.element.classList.toggle("active",t),l.label=o,r.add(l.onDidClick(()=>this._onDidClickCapability.fire(n))),r}},lre=class extends i9{constructor(e,t,o,n,r,s){super();this.viewModel=e;this.instantiationService=t;this.languageModelsService=o;this.dialogService=n;this.commandService=r;this.contextMenuService=s;this.templateId=lre.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(e){let t=new O,o=new O;e.classList.add("models-actions-column");let n=D(e,fS(".actions-container")),r=t.add(this.instantiationService.createInstance(Kp,n,this.contextMenuService,{icon:!0,label:!1,moreIcon:L.gear,anchorAlignmentProvider:()=>1}));return{container:e,actionBar:r,disposables:t,elementDisposables:o}}renderElement(e,t,o){o.actionBar.setActions([]),super.renderElement(e,t,o)}renderVendorElement(e,t,o){let{vendorEntry:n}=e,r=[],s=[];n.vendor.configuration?(s.push(li({id:"configureAction",label:d(8047,null),run:()=>this.languageModelsService.configureLanguageModelsProviderGroup(n.vendor.vendor,n.group.name)})),s.push(li({id:"deleteAction",label:d(8051,null),class:q.asClassName(L.trash),run:async()=>{(await this.dialogService.confirm({type:"info",message:d(8052,null,n.group.name)})).confirmed&&(await this.languageModelsService.removeLanguageModelsProviderGroup(n.vendor.vendor,n.group.name),this.viewModel.refresh())}}))):n.vendor.managementCommand&&r.push(li({id:"manageVendor",label:d(8057,null,n.group.name),class:q.asClassName(L.gear),run:async()=>{await this.commandService.executeCommand(n.vendor.managementCommand,n.vendor.vendor),this.viewModel.refresh()}})),o.actionBar.setActions(r,s)}renderGroupElement(e,t,o){}renderModelElement(e,t,o){let n=[];e.model.metadata.id!=="auto"&&n.push(this.createPinAction(e.model.identifier));let r=this.languageModelsService.getModelConfigurationActions(e.model.identifier),s=[...r];(r.length>0||e.model.metadata.configurationSchema)&&s.push(li({id:"configureModel",label:d(8049,null),run:()=>this.languageModelsService.configureModel(e.model.identifier)})),o.actionBar.setActions(n,s)}createPinAction(e){let t=this.languageModelsService.isModelPinned(e);return li({id:t?`unpin.${e}`:`pin.${e}`,label:t?d(8064,null):d(8060,null),class:q.asClassName(t?L.pinned:L.pin),run:()=>{t?this.languageModelsService.unpinModel(e):this.languageModelsService.pinModel(e),this.viewModel.refresh()}})}};lre=I([m(1,F),m(2,Gr),m(3,ct),m(4,fe),m(5,Xe)],lre);var OWi=class a extends i9{constructor(){super(...arguments);this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="provider"}renderTemplate(e){let t=new O,o=new O,n=D(e,fS(".model-provider"));return{container:e,providerElement:n,disposables:t,elementDisposables:o}}renderVendorElement(e,t,o){o.providerElement.textContent=""}renderGroupElement(e,t,o){o.providerElement.textContent=""}renderModelElement(e,t,o){o.providerElement.textContent=e.model.provider.vendor.displayName}};function FWi(a){return a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(0)}K`:a.toString()}var k$=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.languageModelsService=e;this.instantiationService=t;this.extensionService=o;this.contextMenuService=n;this.chatEntitlementService=r;this.editorProgressService=s;this.commandService=l;this.contextKeyService=c;this._onDidChangeItemCount=this._register(new T);this.onDidChangeItemCount=this._onDidChangeItemCount.event;this.tableMinWidth=0;this.dropdownActions=[];this.tableDisposables=this._register(new O);this.searchFocusContextKey=aPt.bindTo(this.contextKeyService),this.delayedFiltering=this._register(new rn(200)),this.viewModel=this._register(this.instantiationService.createInstance(mHe)),this.element=_(".models-widget"),this.create(this.element);let u=this.extensionService.whenInstalledExtensionsRegistered().then(()=>this.viewModel.refresh());this.editorProgressService.showWhile(u,300)}static{this.NUM_INSTANCES=0}create(e){let t=D(e,fS(".models-search-and-button-container")),o=d(8072,null),n=D(t,fS(".models-search-container"));this.searchWidget=this._register(this.instantiationService.createInstance(YN,"chatModelsWidget.searchbox",n,{triggerCharacters:["@",":"],provideResults:h=>{let g=this.viewModel.getVendors().map(S=>`@provider:"${S.displayName}"`),f=[...g,...PWi.CAPABILITIES];if(!h.trim())return f;let v=h.split(/\s/g),b=v[v.length-1];return b.startsWith("@provider:")?g:b.startsWith("@capability:")?PWi.CAPABILITIES:b.startsWith("@")?f:[]}},o,`chatModelsWidget:searchinput:${k$.NUM_INSTANCES++}`,{placeholderText:o,styleOverrides:{inputBorder:__},focusContextKey:this.searchFocusContextKey}));let r=this._register(new AWi),s=this._register(new it("workbench.models.clearSearch",d(8019,null),q.asClassName(iNe),!1,()=>this.clearSearch())),l=this._register(new it("workbench.models.collapseAll",d(8021,null),q.asClassName(L.collapseAll),!1,()=>{this.viewModel.collapseAll()}));l.enabled=this.viewModel.viewModelEntries.some(h=>y1(h)||CO(h)),this._register(this.viewModel.onDidChange(()=>l.enabled=this.viewModel.viewModelEntries.some(h=>CO(h)||y1(h)))),this._register(this.searchWidget.onInputDidChange(()=>{s.enabled=!!this.searchWidget.getValue(),this.filterModels()})),this.searchActionsContainer=D(n,fS(".models-search-actions"));let c=[s,l,r];this._register(new Kp(this.searchActionsContainer,this.contextMenuService,{actionViewItemProvider:(h,g)=>{if(h.id===r.id)return this.instantiationService.createInstance(Zlt,h,g,{getValue:()=>this.searchWidget.getValue(),setValue:f=>this.search(f)},this.viewModel)},getKeyBinding:()=>{}})).setActions(c),this.searchWidget.inputWidget.getContainerDomNode().style.paddingRight=`${Dc(this.searchActionsContainer)+12}px`,this.addButtonContainer=D(t,fS(".section-title-actions"));let p={...Ro,supportIcons:!0};this.addButton=this._register(new Pi(this.addButtonContainer,p)),this.addButton.label=`$(${L.add.id}) ${d(8053,null)}`,this.addButton.element.classList.add("models-add-model-button"),this.updateAddModelsButton(),this._register(this.addButton.onDidClick(h=>{this.dropdownActions.length>0&&this.contextMenuService.showContextMenu({getAnchor:()=>this.addButton.element,getActions:()=>this.dropdownActions})})),this.tableContainer=D(e,fS(".models-table-container")),this.createTable(),this._register(this.viewModel.onDidChangeGrouping(()=>this.createTable())),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>{this.updateAddModelsButton(),this.createTable()})),this._register(this.chatEntitlementService.onDidChangeUsageBasedBilling(()=>this.createTable())),this._register(this.languageModelsService.onDidChangeLanguageModelVendors(()=>this.updateAddModelsButton())),this._register(this.languageModelsService.onDidChangePinnedModels(()=>this.viewModel.refresh())),this._register(this.contextKeyService.onDidChangeContext(h=>{h.affectsSome(new Set(["github.copilot.clientByokEnabled"]))&&this.updateAddModelsButton()}))}createTable(){this.tableDisposables.clear(),St(this.tableContainer),this.tableViewport=fS(".models-table-viewport"),this.tableInner=D(this.tableViewport,fS(".models-table-inner")),this.tableScrollable=this.tableDisposables.add(new Ar(this.tableViewport,{horizontal:1,vertical:2,useShadows:!1,scrollYToX:!0})),this.tableContainer.appendChild(this.tableScrollable.getDomNode());let e=this.instantiationService.createInstance(_4t,this.viewModel),t=this.instantiationService.createInstance(rre),o=this.instantiationService.createInstance(sre),n=this.instantiationService.createInstance(are),r=this.instantiationService.createInstance(D4t),s=this.instantiationService.createInstance(lre,this.viewModel),l=this.instantiationService.createInstance(OWi);this.tableDisposables.add(r),this.tableDisposables.add(r.onDidClickCapability(p=>{let h=this.searchWidget.getValue(),g=`@capability:${p}`,f=xLo(h,{query:g});this.search(f)}));let c=[{label:"",tooltip:"",weight:.05,minimumWidth:40,maximumWidth:40,templateId:_4t.TEMPLATE_ID,project(p){return p}},{label:d(8042,null),tooltip:"",weight:.35,minimumWidth:200,templateId:rre.TEMPLATE_ID,project(p){return p}}],u=this.chatEntitlementService.quotas.usageBasedBilling===!0;c.push({label:d(8074,null),tooltip:"",weight:.1,minimumWidth:140,templateId:are.TEMPLATE_ID,project(p){return p}},{label:d(8015,null),tooltip:"",weight:.15,minimumWidth:180,templateId:D4t.TEMPLATE_ID,project(p){return p}},{label:u?d(8022,null):d(8069,null),tooltip:"",weight:u?.24:.15,minimumWidth:u?240:200,templateId:sre.TEMPLATE_ID,project(p){return p}},{label:"",tooltip:"",weight:.05,minimumWidth:64,maximumWidth:64,templateId:lre.TEMPLATE_ID,project(p){return p}}),this.tableMinWidth=c.reduce((p,h)=>p+h.minimumWidth,0),this.tableInner.style.minWidth=`${this.tableMinWidth}px`,this.table=this.tableDisposables.add(this.instantiationService.createInstance(Cx,"ModelsWidget",this.tableInner,new NWi,c,[e,t,o,n,r,s,l],{identityProvider:{getId:p=>p.id},horizontalScrolling:!1,accessibilityProvider:{getAriaLabel:p=>{if(CO(p))return d(8075,null,p.vendorEntry.group.name);if(y1(p))return p.id==="visible"?d(8076,null):d(8036,null);if(hHe(p))return d(8073,null,p.message);let h=[];if(h.push(d(8041,null,p.model.metadata.name,p.model.provider.vendor.displayName)),p.model.metadata.maxInputTokens||p.model.metadata.maxOutputTokens){let f=(p.model.metadata.maxInputTokens??0)+(p.model.metadata.maxOutputTokens??0);h.push(d(8040,null,FWi(f)))}p.model.metadata.capabilities&&h.push(d(8039,null,Object.keys(p.model.metadata.capabilities).join(", ")));let g=p.model.metadata.pricing??"-";return g!=="-"&&h.push(d(8070,null,g)),p.model.metadata.inputCost!==void 0&&h.push(p.model.metadata.inputCost===1?d(8038,null,p.model.metadata.inputCost):d(8037,null,p.model.metadata.inputCost)),p.model.metadata.outputCost!==void 0&&h.push(p.model.metadata.outputCost===1?d(8068,null,p.model.metadata.outputCost):d(8067,null,p.model.metadata.outputCost)),p.model.metadata.cacheCost!==void 0&&h.push(p.model.metadata.cacheCost===1?d(8014,null,p.model.metadata.cacheCost):d(8013,null,p.model.metadata.cacheCost)),h.join(". ")},getWidgetAriaLabel:()=>d(8066,null)},multipleSelectionSupport:!0,setRowLineHeight:!1,openOnSingleClick:!0,alwaysConsumeMouseWheel:!1})),this.tableDisposables.add(this.table.onContextMenu(p=>{if(!p.element)return;let h=this.table.getSelection(),g=h.every(y=>y!==p.index)?[p.element]:h.map(y=>this.viewModel.viewModelEntries[y]).filter(y=>!!y),f=g.filter(y=>!CO(y)&&!y1(y)&&!hHe(y)),v=[],b,S;if(f.length){let y=f.filter(w=>w.model.metadata.id!=="auto");if(y.length>0){let w=y.every(x=>this.languageModelsService.isModelPinned(x.model.identifier));v.push(li({id:w?"unpinModels":"pinModels",label:w?d(8064,null):d(8060,null),class:q.asClassName(w?L.pinned:L.pin),run:()=>{for(let x of y)w?this.languageModelsService.unpinModel(x.model.identifier):this.languageModelsService.pinModel(x.model.identifier)}}))}if(f.length===1){let w=this.languageModelsService.getModelConfigurationActions(f[0].model.identifier);w.length&&(v.push(new oi),v.push(...w))}b=f[0].model.provider.group.name,S=f[0].model.provider.vendor,f.some(w=>w.model.provider.vendor.isDefault||w.model.provider.group.name!==b)&&(b=void 0,S=void 0)}else if(g.length===1){let y=p.element;CO(y)&&(b=y.vendorEntry.group.name,S=y.vendorEntry.vendor)}b&&S&&(S.managementCommand||S.configuration)&&(v.length&&v.push(new oi),S.managementCommand?v.push(li({id:"configureVendor",label:d(8048,null),run:async()=>{await this.commandService.executeCommand(S.managementCommand,S.vendor),await this.viewModel.refresh()}})):v.push(li({id:"configureVendor",label:d(8048,null),run:()=>this.languageModelsService.configureLanguageModelsProviderGroup(S.vendor,b)}))),v.length>0&&this.contextMenuService.showContextMenu({getAnchor:()=>p.anchor,getActions:()=>v})})),this.table.splice(0,this.table.length,this.viewModel.viewModelEntries),this._onDidChangeItemCount.fire(this.itemCount),this.tableDisposables.add(this.viewModel.onDidChange(({at:p,removed:h,added:g})=>{if(this.table.splice(p,h,g),this._onDidChangeItemCount.fire(this.itemCount),this.viewModel.selectedEntry){let f=this.viewModel.viewModelEntries.indexOf(this.viewModel.selectedEntry);this.table.setFocus([f]),this.table.setSelection([f])}})),this.tableDisposables.add(this.table.onDidOpen(async({element:p,browserEvent:h})=>{p&&(hHe(p)||(CO(p)||y1(p))&&this.viewModel.toggleCollapsed(p))})),this.tableDisposables.add(this.table.onDidChangeSelection(p=>this.viewModel.selectedEntry=p.elements[0])),this.tableDisposables.add(this.table.onDidBlur(()=>{this.viewModel.shouldRefilter()&&this.viewModel.filter(this.searchWidget.getValue())})),this.layout(this.element.clientHeight,this.element.clientWidth)}updateAddModelsButton(){let e=this.languageModelsService.getVendors().filter(u=>u.managementCommand||u.configuration),t=this.chatEntitlementService.entitlement,o=t===8||t===9,n=this.chatEntitlementService.isInternal||this.chatEntitlementService.clientByokEnabled||t!==1&&t!==3&&!o;this.addButton.enabled=n&&e.length>0,this.addButton.setTitle(!n&&o?d(8056,null):"");let r=e.find(u=>u.vendor==="customendpoint"),s=e.find(u=>u.vendor==="customoai"),l=e.filter(u=>u.vendor!=="customendpoint"&&u.vendor!=="customoai").sort((u,p)=>u.displayName.localeCompare(p.displayName));s&&l.push(s);let c=u=>li({id:`enable-${u.vendor}`,label:u.displayName,run:async()=>{await this.addModelsForVendor(u)}});this.dropdownActions=l.map(c),r&&(this.dropdownActions.length>0&&this.dropdownActions.push(new oi),this.dropdownActions.push(c(r)))}filterModels(){this.delayedFiltering.trigger(()=>{this.viewModel.filter(this.searchWidget.getValue())})}async addModelsForVendor(e){await this.languageModelsService.configureLanguageModelsProviderGroup(e.vendor),await this.viewModel.refresh()}layout(e,t){t=t-24,this.searchWidget.layout(new di(t-this.searchActionsContainer.clientWidth-this.addButtonContainer.clientWidth-8,22));let o=e-40;this.tableContainer.style.height=`${o}px`;let n=Math.max(t,this.tableMinWidth);this.table.layout(o,n),this.tableScrollable?.scanDomNode()}focusSearch(){this.searchWidget.focus()}search(e){this.focusSearch(),this.searchWidget.setValue(e),this.viewModel.filter(e)}clearSearch(){this.focusSearch(),this.searchWidget.setValue("")}render(){this.viewModel.shouldRefilter()&&this.viewModel.filter(this.searchWidget.getValue())}get itemCount(){return this.viewModel.viewModelEntries.filter(e=>!CO(e)&&!y1(e)&&!hHe(e)).length}fireItemCount(){this._onDidChangeItemCount.fire(this.itemCount)}};k$=I([m(0,Gr),m(1,F),m(2,lt),m(3,Xe),m(4,dr),m(5,Hd),m(6,fe),m(7,X)],k$);var HSn=_,E$=class extends zs{constructor(e,t,o,n,r,s){super(E$.ID,e,t,o,n);this.instantiationService=r;this.editorDisposables=this._register(new O);this.inModelsEditorContextKey=X_e.bindTo(s)}static{this.ID="workbench.editor.modelsManagement"}createEditor(e){this.editorDisposables.clear(),this.bodyContainer=D(e,HSn(".ai-models-management-editor")),this.modelsWidget=this.editorDisposables.add(this.instantiationService.createInstance(k$)),this.bodyContainer.appendChild(this.modelsWidget.element)}async setInput(e,t,o,n){this.inModelsEditorContextKey.set(!0),await super.setInput(e,t,o,n),this.dimension&&this.layout(this.dimension),this.modelsWidget?.render()}layout(e){this.dimension=e,this.bodyContainer&&this.modelsWidget?.layout(e.height-15,this.bodyContainer.clientWidth-24)}focus(){super.focus(),this.modelsWidget?.focusSearch()}clearInput(){this.inModelsEditorContextKey.set(!1),super.clearInput()}clearSearch(){this.modelsWidget?.clearSearch()}search(e){this.modelsWidget?.search(e)}};E$=I([m(1,_e),m(2,Pe),m(3,de),m(4,F),m(5,X)],E$);var USn=Oe("models-management-editor-label-icon",L.settings,d(8012,null)),mbe=class a extends Ls{constructor(){super();this.resource=void 0}static{this.ID="workbench.input.modelsManagement"}get capabilities(){return super.capabilities|8|2048}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(8011,null)}getIcon(){return USn}async resolve(){return null}};var kLo=Oe("language-models-open-settings",L.goToFile,d(8006,null)),R4t=C.and(Z.enabled,C.or(Z.Entitlement.planFree,Z.Entitlement.planEdu,Z.Entitlement.planPro,Z.Entitlement.planProPlus,Z.Entitlement.planMax,Z.Entitlement.planBusiness,Z.Entitlement.planEnterprise,Z.Entitlement.internal,Xn.clientByokEnabled));oe.as(en.EditorPane).registerEditorPane(os.create(E$,E$.ID,d(8008,null)),[new Vt(mbe)]);var WWi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(mbe)}};oe.as(en.EditorFactory).registerEditorSerializer(mbe.ID,WWi);async function zSn(a){let i=a.get(Ze).defaultChatAgent?.chatExtensionId;if(!i)return;let e=a.get(Ui),t=a.get(As),o=a.get(Go),r=(await e.queryLocal()).find(s=>hi.equals(s.identifier.id,i));!r?.local||t.isEnabled(r.local)||await o.withProgress({location:10,title:d(8004,null)},async()=>{await e.setEnablement([r],12),await e.updateRunningExtensions(d(8005,null))})}var gHe=class extends k{constructor(e){super();this.languageModelsConfigurationService=e;this.registerChatManagementActions(),this.registerLanguageModelsEditorTitleActions()}static{this.ID="workbench.contrib.chatManagementActions"}registerChatManagementActions(){this._register(W(class extends z{constructor(){super({id:TYe,title:P(8009,"Manage Language Models"),category:fi,precondition:R4t,f1:!0})}async run(t){let o=t.get(ie);return await zSn(t),o.openEditor(new mbe,{pinned:!0})}})),this._register(W(class extends z{constructor(){super({id:"chat.models.action.clearSearchResults",precondition:X_e,keybinding:{primary:9,weight:100,when:aPt},title:P(8007,"Clear Models Search Results")})}run(t){let o=t.get(ie).activeEditorPane;return o instanceof E$&&o.clearSearch(),null}}));let e=C.and(X_e,R4t);this._register(W(class extends z{constructor(){super({id:"workbench.action.openLanguageModelsJson",title:P(8010,"Open Language Models (JSON)"),category:fi,precondition:R4t,icon:kLo,f1:!0,menu:[{id:R.EditorTitle,when:e,group:"navigation",order:1},{id:R.ModalEditorEditorTitle,when:e,group:"navigation",order:1}]})}async run(t){await t.get(_H).configureLanguageModels()}}))}registerLanguageModelsEditorTitleActions(){let e=this.languageModelsConfigurationService.configurationFile,t=C.and(X_e.toNegated(),Ho.Resource.isEqualTo(e.toString()),C.not("isInDiffEditor"),R4t);be.appendMenuItem(R.EditorTitle,{command:{id:TYe,title:P(8009,"Manage Language Models"),icon:kLo},when:t,group:"navigation",order:1})}};gHe=I([m(0,_H)],gHe);bt(gHe.ID,gHe,vt.AfterRestored);var hbe=class{constructor(i,e,t,o){this.workspaceContextService=i;this.commandService=e;this.promptsService=t;this.harnessService=o;this.managementSections=[pn.Agents,pn.Skills,pn.Instructions,pn.Prompts,pn.Hooks,pn.McpServers,pn.Plugins];this.isSessionsWindow=!1;this.welcomePageFeatures={showGettingStartedBanner:!0};this.hasOverrideProjectRoot=Fo(!1);let n=Mb({owner:this},this.workspaceContextService.onDidChangeWorkspaceFolders,()=>this.workspaceContextService.getWorkspace().folders);this.activeProjectRoot=ke(r=>n.read(r)[0]?.uri)}getActiveProjectRoot(){return this.workspaceContextService.getWorkspace().folders[0]?.uri}getStorageSourceFilter(i){return this.harnessService.getStorageSourceFilter(i)}setOverrideProjectRoot(i){}clearOverrideProjectRoot(){}async commitFiles(i,e){}async deleteFiles(i,e){}async generateCustomization(i){let t={agent:D8,skill:_8,instructions:Det,prompt:T8,hook:Bxi}[i];t&&await this.commandService.executeCommand(t)}async getFilteredPromptSlashCommands(i){return this.promptsService.getPromptSlashCommands(i)}static{this._emptyIntegrations=new Map}getSkillUIIntegrations(){return hbe._emptyIntegrations}};hbe=I([m(0,Ae),m(1,fe),m(2,jr),m(3,dh)],hbe);Ce(WM,hbe,1);var ect=class extends tAt{constructor(i){let e=["extension",sc];super([hlo(e)],_d.Local,i)}};ect=I([m(0,jr)],ect);Ce(dh,ect,1);var VWi=class extends k{constructor(){super(...arguments);this.capabilities=1026;this._onDidChangeCapabilities=this._register(new T);this.onDidChangeCapabilities=this._onDidChangeCapabilities.event;this._onDidChangeFile=this._register(new T);this.onDidChangeFile=this._onDidChangeFile.event;this._authorityToConnection=new Map}registerAuthority(e,t){return this._authorityToConnection.set(e,t),ee(()=>this._authorityToConnection.delete(e))}watch(){return k.None}async stat(e){let t=e.path;if(t==="/"||t==="")return{type:2,mtime:0,ctime:0,size:0,permissions:1};let o=this._decodeUri(e);if(o.scheme==="session-db"||o.scheme==="git-blob")return{type:1,mtime:0,ctime:0,size:0,permissions:1};if(o.path==="/"||o.path==="")return{type:2,mtime:0,ctime:0,size:0,permissions:1};let n=ai(e),r=Be(e),l=(await this._listDirectory(e.authority,n)).find(c=>c.name===r);if(!l)throw Ys(`File not found: ${t}`,"EntryNotFound");return{type:l.type==="directory"?2:1,mtime:0,ctime:0,size:0,permissions:1}}async readdir(e){return(await this._listDirectory(e.authority,e)).map(o=>[o.name,o.type==="directory"?2:1])}async readFile(e){let t=this._getConnection(e.authority);try{let o=this._decodeUri(e),n=await t.resourceRead(o);return n.encoding==="base64"?Ws(n.data).buffer:Ke.fromString(n.data).buffer}catch(o){throw this._mapError(o,"EntryNotFound")}}async writeFile(e,t,o){let n=this._getConnection(e.authority);try{let r=this._decodeUri(e);await n.resourceWrite({uri:r.toString(),data:Ke.wrap(t).toString(),encoding:"utf-8"})}catch(r){throw this._mapError(r,"NoPermissions")}}async mkdir(){throw Ys("mkdir not supported on remote filesystem","NoPermissions")}async delete(e,t){let o=this._getConnection(e.authority);try{let n=this._decodeUri(e);await o.resourceDelete({uri:n.toString(),recursive:t.recursive})}catch(n){throw this._mapError(n,"NoPermissions")}}async rename(e,t,o){let n=this._getConnection(e.authority);try{let r=this._decodeUri(e),s=this._decodeUri(t);await n.resourceMove({source:r.toString(),destination:s.toString(),failIfExists:!o.overwrite})}catch(r){throw this._mapError(r,"NoPermissions")}}async requestResourceAccess(e,t){let o=this._getConnection(e.authority);if(!o.resourceRequest)throw Ys(`Connection for ${e.authority} does not support resourceRequest`,"Unavailable");let n=this._decodeUri(e);try{await o.resourceRequest({uri:n.toString(),read:t.read,write:t.write})}catch(r){throw this._mapError(r,"NoPermissions")}}_getConnection(e){let t=this._authorityToConnection.get(e);if(!t)throw Ys(`No connection for authority: ${e}`,"Unavailable");return t}_mapError(e,t){return e instanceof $C&&e.code===Qne.PermissionDenied?Ys(e.message,"NoPermissions"):Ys(e instanceof Error?e.message:String(e),t)}async _listDirectory(e,t){let o=this._getConnection(e);try{let n=this._decodeUri(t);return(await o.resourceList(n)).entries}catch(n){throw this._mapError(n,"Unavailable")}}},fHe=class extends VWi{_decodeUri(i){return NZ(i)}};var T$="vscode-synced-customization",KSn=le("agentHostFileSystemService"),tct=class extends k{constructor(e,t){super();this._fileService=e;this._syncedCustomizationProviderRegistered=!1;this._fsProvider=this._register(new fHe),this._register(e.registerProvider(IC,this._fsProvider)),this._register(t.registerFormatter(mDe))}registerAuthority(e,t){return this._fsProvider.registerAuthority(e,t)}ensureSyncedCustomizationProvider(){if(!this._syncedCustomizationProviderRegistered){this._syncedCustomizationProviderRegistered=!0;let e=this._register(new PU);this._register(this._fileService.registerProvider(T$,e))}}};tct=I([m(0,ge),m(1,nt)],tct);Ce(KSn,tct,1);var oct=le("agentHostFileSystemService"),ict=class extends k{constructor(e,t){super();this._fileService=e;this._syncedCustomizationProviderRegistered=!1;this._fsProvider=this._register(new fHe),this._register(e.registerProvider(IC,this._fsProvider)),this._register(t.registerFormatter(mDe))}registerAuthority(e,t){return this._fsProvider.registerAuthority(e,t)}ensureSyncedCustomizationProvider(){if(!this._syncedCustomizationProviderRegistered){this._syncedCustomizationProviderRegistered=!0;let e=this._register(new PU);this._register(this._fileService.registerProvider(T$,e))}}};ict=I([m(0,ge),m(1,nt)],ict);Ce(oct,ict,1);var xO=class a extends Ls{constructor(){super();this.resource=void 0;this._isDirty=!1}static{this.ID=vWt}get capabilities(){return super.capabilities|8|2048}static getOrCreate(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}matches(e){return super.matches(e)||e instanceof a}get typeId(){return a.ID}getName(){return d(7142,null)}getIcon(){return L.settingsGear}async resolve(){return null}isDirty(){return this._isDirty}async save(e,t){if(!(t?.reason!==void 0&&t.reason!==1)&&this._saveHandler)return await this._saveHandler()?this:void 0}async revert(){this.setDirty(!1)}setDirty(e){this._isDirty!==e&&(this._isDirty=e,this._onDidChangeDirty.fire())}setSaveHandler(e){this._saveHandler=e}};var lng=Oe("ai-customization-view-icon",L.sparkle,d(6944,null)),gbe=Oe("ai-customization-agent",L.agent,d(6933,null)),fbe=Oe("ai-customization-skill",L.lightbulb,d(6942,null)),w1=Oe("ai-customization-instructions",L.book,d(6937,null)),vHe=Oe("ai-customization-prompt",L.bookmark,d(6940,null)),vbe=Oe("ai-customization-hook",L.zap,d(6936,null)),cng=Oe("ai-customization-add",L.add,d(6932,null)),dng=Oe("ai-customization-run",L.play,d(6941,null)),cre=Oe("ai-customization-workspace",L.folder,d(6945,null)),dre=Oe("ai-customization-user",L.account,d(6943,null)),bbe=Oe("ai-customization-extension",L.extensions,d(6935,null)),bk=Oe("ai-customization-plugin",L.plug,d(6939,null)),bHe=Oe("ai-customization-builtin",L.starFull,d(6934,null)),nct=Oe("ai-customization-mcp-server",L.server,d(6938,null));function ELo(a){switch(a){case"local":return cre;case"user":return dre;case"extension":return bbe;case"plugin":return bk;case sc:return bHe;default:return w1}}async function TLo(a,i,e,t,o,n,r,s){let l=gWt(a),c=e.getStorageSourceFilter(l),u=[];if(u.push(`== Customization Debug: ${a} (${l}) ==`),u.push(`Window: ${e.isSessionsWindow?"Sessions":"Core VS Code"}`),u.push(`Active root: ${e.getActiveProjectRoot()?.fsPath??"(none)"}`),u.push(`Sections: [${e.managementSections.join(", ")}]`),u.push(`Filter sources: [${c.sources.join(", ")}]`),o&&(u.push(""),u.push("--- Active Harness ---"),u.push(`  id: ${o.id}`),u.push(`  label: ${o.label}`),u.push(`  hasItemProvider: ${!!o.itemProvider}`),u.push(`  hasDisableProvider: ${!!o.syncProvider}`),u.push(`  hiddenSections: ${o.hiddenSections?`[${o.hiddenSections.join(", ")}]`:"(none)"}`),u.push(`  workspaceSubpaths: ${o.workspaceSubpaths?`[${o.workspaceSubpaths.join(", ")}]`:"(none)"}`),u.push(`  hideGenerateButton: ${o.hideGenerateButton??!1}`),u.push(`  requiredAgentId: ${o.requiredAgentId??"(none)"}`),u.push(`  instructionFileFilter: ${o.instructionFileFilter?`[${o.instructionFileFilter.join(", ")}]`:"(none)"}`)),u.push(""),c.includedUserFileRoots){u.push("Filter includedUserFileRoots:");for(let g of c.includedUserFileRoots)u.push(`  ${g.fsPath}`)}else u.push("Filter includedUserFileRoots: (all)");u.push("");let p=o?.itemProvider,h=p??n;if(h){let g;p?g="Extension Provider":g="PromptsService Adapter (fallback \u2014 no extension provider registered)",await GSn(u,h,l,g)}else u.push("--- Stage 1: No provider available ---"),u.push("");return p||(await qSn(u,i,l),await $Sn(u,i,l,c)),jSn(u,t),await QSn(u,i,l),r&&YSn(u,r),s&&XSn(u,s),u.join(`
`)}async function _Lo(a,i){let[e,t,o]=await Promise.all([a.listPromptFilesForStorage(i,"local",Ie.None),a.listPromptFilesForStorage(i,"user",Ie.None),a.listPromptFilesForStorage(i,"extension",Ie.None)]);return{localFiles:e,userFiles:t,extensionFiles:o}}async function GSn(a,i,e,t){a.push(`--- Stage 1: Provider Output (${t}) ---`);let o=await i.provideChatSessionCustomizations(Ie.None);if(!o){a.push("  Provider returned undefined"),a.push("");return}a.push(`  Total items from provider: ${o.length}`);let n=new Map;for(let s of o){let l=n.get(s.type)??[];l.push(s),n.set(s.type,l)}for(let[s,l]of n){a.push(`  ${s}: ${l.length} items`);for(let c of l){let u=c.uri.scheme==="file"?c.uri.fsPath:c.uri.toString();a.push(`    ${c.name} \u2014 ${u}`),c.description&&a.push(`      desc: ${c.description}`),c.storage&&a.push(`      storage: ${c.storage}`),c.groupKey&&a.push(`      groupKey: ${c.groupKey}`),c.itemKey&&a.push(`      itemKey: ${c.itemKey}`),c.extensionId&&a.push(`      extensionId: ${c.extensionId}`),c.pluginUri&&a.push(`      pluginUri: ${c.pluginUri.toString()}`),c.badge&&a.push(`      badge: ${c.badge}`),c.status&&a.push(`      status: ${c.status}${c.statusMessage?` (${c.statusMessage})`:""}`),c.enabled===!1&&a.push("      enabled: false")}}let r=o.filter(s=>s.type===e);a.push(`  Items matching current section (${e}): ${r.length}`),a.push("")}async function qSn(a,i,e){a.push("--- Stage 2a: Raw PromptsService Data ---");let{localFiles:t,userFiles:o,extensionFiles:n}=await _Lo(i,e);a.push(`  listPromptFilesForStorage(local):  ${t.length} files`),L4t(a,t),a.push(`  listPromptFilesForStorage(user):   ${o.length} files`),L4t(a,o),a.push(`  listPromptFilesForStorage(ext):    ${n.length} files`),L4t(a,n);let r=await i.listPromptFiles(e,Ie.None);if(a.push(`  listPromptFiles (merged):          ${r.length} files`),e==="instructions"){let s=await i.listAgentInstructions(Ie.None,void 0);a.push(`  listAgentInstructions (extra):     ${s.length} files`),L4t(a,s)}if(e==="skill"){let s=await i.findAgentSkills(Ie.None);a.push(`  findAgentSkills:                   ${s?.length??0} skills`);for(let l of s??[])a.push(`    ${l.name??"?"} [${l.storage}] ${l.uri.fsPath}`)}if(e==="agent"){let s=await i.getCustomAgents(Ie.None);a.push(`  getCustomAgents:                   ${s.length} agents`);for(let l of s)a.push(`    ${l.name} [${l.source.storage}] ${l.uri.fsPath}`)}if(e==="prompt"){let s=await i.getPromptSlashCommands(Ie.None);a.push(`  getPromptSlashCommands:            ${s.length} commands`);for(let l of s)a.push(`    /${l.name} [${l.storage}] ${l.uri.fsPath} (type=${l.type})`)}a.push("")}async function $Sn(a,i,e,t){a.push("--- Stage 2b: After applyStorageSourceFilter ---");let{localFiles:o,userFiles:n,extensionFiles:r}=await _Lo(i,e),s=[...o,...n,...r],l=APt(s,t);a.push(`  Input: ${s.length} \u2192 Filtered: ${l.length}`),a.push(`    local:     ${l.filter(u=>u.storage==="local").length}`),a.push(`    user:      ${l.filter(u=>u.storage==="user").length}`),a.push(`    extension: ${l.filter(u=>u.storage==="extension").length}`);let c=s.length-l.length;if(c>0){let u=new Set(l.map(h=>h.uri.toString())),p=s.filter(h=>!u.has(h.uri.toString()));a.push(`  Removed (${c}):`);for(let h of p)a.push(`    [${h.storage}] ${h.uri.fsPath}`)}a.push("")}function jSn(a,i){a.push("--- Stage 3: Widget State (loadItems \u2192 filterItems) ---"),a.push(`  allItems (after loadItems): ${i.allItems.length}`),a.push(`    local:     ${i.allItems.filter(n=>n.storage==="local").length}`),a.push(`    user:      ${i.allItems.filter(n=>n.storage==="user").length}`),a.push(`    extension: ${i.allItems.filter(n=>n.storage==="extension").length}`),a.push(`    plugin:    ${i.allItems.filter(n=>n.storage==="plugin").length}`),a.push(`    built-in:  ${i.allItems.filter(n=>n.storage===sc).length}`);let e=i.allItems.filter(n=>n.syncable).length;e>0&&a.push(`    syncable:  ${e}`);for(let n of i.allItems){let r=[`storage=${n.storage??"?"}`,`groupKey=${n.groupKey??"(none)"}`];n.syncable&&r.push("syncable"),n.pluginUri&&r.push(`pluginUri=${n.pluginUri.toString()}`),a.push(`    - ${n.name} [${r.join(", ")}]`)}a.push(`  displayEntries (after filterItems): ${i.displayEntries.length}`);let t=i.displayEntries.filter(n=>n.type==="file-item");a.push(`    file items shown: ${t.length}`);let o=i.displayEntries.filter(n=>n.type==="group-header");for(let n of o)a.push(`    group "${n.label}": count=${n.count}, collapsed=${n.collapsed}`);a.push("")}async function QSn(a,i,e){a.push("--- Stage 4: Source Folders (creation targets) ---");let t=await i.getSourceFolders(e);for(let o of t)a.push(`  [${o.storage}] ${o.uri.fsPath}`);try{let o=await i.getResolvedSourceFolders(e);a.push(""),a.push("--- Resolved Source Folders (discovery order) ---");for(let n of o)a.push(`  [${n.storage}] ${n.uri.fsPath} (source=${n.source})`)}catch{}}function L4t(a,i){for(let e of i)a.push(`    ${e.uri.fsPath}`)}function YSn(a,i){a.push("--- Stage 5: All Registered Harnesses ---");let e=i.activeHarness.get(),t=i.availableHarnesses.get();a.push(`  Active: ${e}`),a.push(`  Total harnesses: ${t.length}`);for(let o of t){let n=o.id===e?" (ACTIVE)":"";if(a.push(`  [${o.id}]${n} "${o.label}"`),a.push(`    hasItemProvider: ${!!o.itemProvider}`),a.push(`    hasDisableProvider: ${!!o.syncProvider}`),a.push(`    hiddenSections: ${o.hiddenSections?`[${o.hiddenSections.join(", ")}]`:"(none)"}`),a.push(`    hideGenerateButton: ${o.hideGenerateButton??!1}`),a.push(`    pluginActions: ${o.pluginActions?.length??0}`),o.pluginActions)for(let r of o.pluginActions)a.push(`      - ${r.id}: ${r.label}`)}a.push("")}function XSn(a,i){a.push("--- Stage 6: Installed Plugins ---");let e=i.plugins.get();a.push(`  Total: ${e.length}`);for(let t of e)if(a.push(`  [${t.label}] ${t.uri.toString()}`),t.fromMarketplace){let o=t.fromMarketplace;a.push(`    fromMarketplace: ${o.name}@${o.version} (marketplace=${o.marketplace}, type=${o.marketplaceType})`)}else a.push("    fromMarketplace: (none)");a.push("")}function o9(a){let i=a.search(/[\r\n]/);return i!==-1?a.substring(0,i):a}function BWi(a,i,e){return a?e==="hook"?a:o9(a):i}function DLo(a){let i=a.split("/"),e=i.lastIndexOf("globalStorage");if(e>0&&i[e-1]==="User"&&e+2<i.length){let r=i[e+1];if(/^[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*$/i.test(r))return r}let t=i.lastIndexOf("extensions");if(t<0||t+1>=i.length)return;let n=i[t+1].match(/^(.+)-\d+\./);return n?n[1]:void 0}function M4t(a,i){let e=i.defaultChatAgent?.chatExtensionId;return!!e&&hi.equals(a,e)}function N4t(a){let i=a.replace(/\.instructions\.md$/i,"").replace(/\.prompt\.md$/i,"").replace(/\.agent\.md$/i,"").replace(/\.md$/i,"");return i=i.replace(/[-_]/g," ").replace(/\b\w/g,e=>e.toUpperCase()),i||a}async function JSn(a,i,e,t){let o=[],n=i.getActiveProjectRoot(),r=await t.userHome(),s=r.scheme===Q.file?r.fsPath:r.path;for(let l of a){let c=!1;try{let u=await e.readFile(l.uri),p=is(u.value.toString()),{hooks:h}=gDe(l.uri,p,n,s);if(h.size>0){c=!0;for(let[g,f]of h){let v=yC[g];for(let b=0;b<f.hooks.length;b++){let S=f.hooks[b],y=G0(S,Ao),w=y.length>60?y.substring(0,57)+"...":y;o.push({uri:l.uri,type:"hook",name:v?.label??f.originalId,description:w||d(6946,null),enabled:l.enabled,groupKey:l.groupKey,storage:l.storage,extensionId:l.extensionId,pluginUri:l.pluginUri,userInvocable:l.userInvocable})}}}}catch{}c||o.push(l)}return o}var P4t=class{constructor(i,e,t,o,n){this.workspaceContextService=i;this.workspaceService=e;this.labelService=t;this.agentPluginService=o;this.productService=n}normalizeItems(i,e){let t=new dt;return i.filter(o=>o.type===e).map(o=>this.normalizeItem(o,e,t)).sort((o,n)=>o.name.localeCompare(n.name))}normalizeItem(i,e,t=new dt){let{storage:o,groupKey:n,isBuiltin:r,extensionId:s,pluginUri:l}=this.inferStorageAndGroup(i),c=t.get(i.uri)??0;t.set(i.uri,c+1);let u=c===0?"":`#${c}`,p=o==="local";return{id:`${i.uri.toString()}${u}`,uri:i.uri,name:i.name,filename:i.uri.scheme===Q.file?this.labelService.getUriLabel(i.uri,{relative:p}):Be(i.uri),description:i.description,storage:o,promptType:e,disabled:i.enabled===!1,groupKey:n,pluginUri:l,displayName:i.name,badge:i.badge,badgeTooltip:i.badgeTooltip,typeIcon:e==="instructions"&&o?ELo(o):void 0,isBuiltin:r,extensionId:s,status:i.status,statusMessage:i.statusMessage}}inferStorageAndGroup(i){let e=i.groupKey,t=i.storage===sc,o=e===sc||t;if(t)return{storage:sc,groupKey:e??sc,isBuiltin:!0,extensionId:i.extensionId};if(i.storage==="plugin")return{storage:"plugin",pluginUri:i.pluginUri,groupKey:e,isBuiltin:o};if(i.extensionId){let l=new hi(i.extensionId);return M4t(l,this.productService)?{storage:"extension",groupKey:sc,isBuiltin:!0,extensionId:i.extensionId}:{storage:"extension",extensionId:i.extensionId,groupKey:e,isBuiltin:o}}if(i.pluginUri)return{storage:"plugin",pluginUri:i.pluginUri,groupKey:e,isBuiltin:o};if(i.storage)return{storage:i.storage,groupKey:e,isBuiltin:o};let n=i.uri,r=this.workspaceService.getActiveProjectRoot();if(r&&Yr(n,r))return{storage:"local",groupKey:e,isBuiltin:o};for(let l of this.workspaceContextService.getWorkspace().folders)if(Yr(n,l.uri))return{storage:"local",groupKey:e,isBuiltin:o};for(let l of this.agentPluginService.plugins.get())if(Yr(n,l.uri))return{storage:"plugin",pluginUri:l.uri,groupKey:e,isBuiltin:o};let s=DLo(n.path);if(s){let l=new hi(s);return M4t(l,this.productService)?{storage:"extension",groupKey:sc,isBuiltin:!0,extensionId:s}:{storage:"extension",extensionId:s,groupKey:e,isBuiltin:o}}return{storage:"user",groupKey:e,isBuiltin:o}}},A4t=class{constructor(i,e,t,o,n,r,s){this.itemProvider=i;this.syncProvider=e;this.promptsService=t;this.workspaceService=o;this.fileService=n;this.pathService=r;this.itemNormalizer=s;let l=!this.itemProvider&&!!this.syncProvider,c=l?U.any(this.promptsService.onDidChangeCustomAgents,this.promptsService.onDidChangeSlashCommands,this.promptsService.onDidChangeSkills,this.promptsService.onDidChangeHooks,this.promptsService.onDidChangeInstructions):U.None;this.onDidChange=U.any(this.itemProvider?.onDidChange??U.None,l&&this.syncProvider?.onDidChange||U.None,c)}async fetchItems(i){let e=this.itemProvider?await this.fetchItemsFromProvider(this.itemProvider,i):[];if(!this.syncProvider||this.itemProvider)return e;let t=await this.fetchLocalSyncableItems(i,this.syncProvider);return[...e,...t]}async fetchItemsFromProvider(i,e){let t=await i.provideChatSessionCustomizations(Ie.None);if(!t)return[];let o;if(e==="hook"){let r=t.filter(u=>u.type==="hook"),s=r.filter(u=>u.storage!=="plugin"),l=r.filter(u=>u.storage==="plugin");o=[...await JSn(s,this.workspaceService,this.fileService,this.pathService),...l]}else o=t.filter(r=>r.type===e);e==="skill"&&(o=await this.addSkillDescriptionFallbacks(o));let n=this.itemNormalizer.normalizeItems(o,e);return e==="skill"?this.mergeBuiltinSkills(n,e):n}async mergeBuiltinSkills(i,e){let t=[];try{t=await this.promptsService.listPromptFilesForStorage("skill",sc,Ie.None)}catch{return[...i]}if(t.length===0)return[...i];let o=new dt;for(let h of t)o.set(h.uri,h);let n=i.filter(h=>!o.has(h.uri)),r=this.workspaceService.getSkillUIIntegrations(),s=d(6947,null),l=new Set;for(let h of n)(h.storage==="local"||h.storage==="user")&&h.name&&l.add(h.name);let c=new dt;for(let h of n)c.set(h.uri,(c.get(h.uri)??0)+1);let u=[],p=this.promptsService.getDisabledPromptFiles("skill");for(let h of t){let g=h.name??Be(h.uri);if(l.has(g))continue;let f=Be(ai(h.uri)),v=r.get(f),b={uri:h.uri,type:"skill",name:g,description:h.description,storage:sc,groupKey:sc,enabled:!p.has(h.uri),badge:v?s:void 0,badgeTooltip:v,extensionId:void 0,pluginUri:void 0,userInvocable:!0};u.push(this.itemNormalizer.normalizeItem(b,e,c))}return[...n,...u]}async addSkillDescriptionFallbacks(i){let e=new Map,t=await this.promptsService.findAgentSkills(Ie.None);for(let o of t??[])o.description&&e.set(o.uri.toString(),o.description);return i.map(o=>o.description?o:{...o,description:e.get(o.uri.toString())})}async fetchLocalSyncableItems(i,e){let t=await this.promptsService.listPromptFiles(i,Ie.None);if(!t.length)return[];let o=c=>({uri:c.uri,type:i,name:N4t(Be(c.uri)),groupKey:"sync-local",enabled:!0,extensionId:c.extension?.id,pluginUri:c.pluginUri,userInvocable:void 0}),n=t.filter(c=>c.storage==="local"||c.storage==="user"),r=t.filter(c=>c.storage==="plugin"),s=this.itemNormalizer.normalizeItems(n.map(o),i).map(c=>({...c,id:`sync-${c.id}`,syncable:!0,synced:!e.isDisabled(c.uri)})),l=this.itemNormalizer.normalizeItems(r.map(o),i);return[...s,...l]}};var O4t=class{constructor(i,e,t,o){this.getActiveDescriptor=i;this.promptsService=e;this.workspaceService=t;this.productService=o;this.onDidChange=U.any(this.promptsService.onDidChangeCustomAgents,this.promptsService.onDidChangeSlashCommands,this.promptsService.onDidChangeSkills,this.promptsService.onDidChangeHooks,this.promptsService.onDidChangeInstructions)}async provideChatSessionCustomizations(i){return(await Promise.all([this.provideCustomizations("agent",i),this.provideCustomizations("skill",i),this.provideCustomizations("instructions",i),this.provideCustomizations("hook",i),this.provideCustomizations("prompt",i)])).flat()}async provideCustomizations(i,e=Ie.None){let t=[],o=this.promptsService.getDisabledPromptFiles(i),n=new dt;if(i==="agent"){let r=await this.promptsService.getCustomAgents(e),s=await this.promptsService.listPromptFiles("agent",e);for(let l of s)l.extension&&n.set(l.uri,{id:l.extension.identifier,displayName:l.extension.displayName});for(let l of r)t.push({uri:l.uri,type:i,name:l.name,description:l.description,storage:l.source.storage,enabled:l.enabled,extensionId:l.source.storage==="extension"?l.source.extensionId.value:void 0,pluginUri:l.source.storage==="plugin"?l.source.pluginUri:void 0,userInvocable:l.visibility.userInvocable}),l.source.storage==="extension"&&!n.has(l.uri)&&n.set(l.uri,{id:l.source.extensionId})}else if(i==="skill"){let r=await this.promptsService.findAgentSkills(e),s=await this.promptsService.listPromptFiles("skill",e);for(let u of s)u.extension&&n.set(u.uri,{id:u.extension.identifier,displayName:u.extension.displayName});let l=this.workspaceService.getSkillUIIntegrations(),c=new xn;for(let u of r||[]){let p=u.name||Be(ai(u.uri))||Be(u.uri);c.add(u.uri);let h=Be(ai(u.uri)),g=l.get(h);t.push({uri:u.uri,type:i,name:p,description:u.description,storage:u.storage,enabled:!0,badge:g?d(7283,null):void 0,badgeTooltip:g,extensionId:u.extension?.identifier.value,pluginUri:u.pluginUri,userInvocable:u.userInvocable})}if(o.size>0){for(let u of s)if(!c.has(u.uri)&&o.has(u.uri)){let p=u.name||Be(ai(u.uri))||Be(u.uri),h=Be(ai(u.uri)),g=l.get(h);t.push({uri:u.uri,type:i,name:p,description:u.description,storage:u.storage,enabled:!1,badge:g?d(7283,null):void 0,badgeTooltip:g,extensionId:u.extension?.identifier.value,pluginUri:u.pluginUri,userInvocable:!1})}}}else if(i==="prompt"){let r=await this.promptsService.getPromptSlashCommands(e);for(let s of r)s.type!=="skill"&&(t.push({uri:s.uri,type:i,name:s.name,description:s.description,storage:s.storage,enabled:!o.has(s.uri),extensionId:s.extension?.identifier.value,pluginUri:s.pluginUri,userInvocable:s.userInvocable}),s.extension&&n.set(s.uri,{id:s.extension.identifier,displayName:s.extension.displayName}))}else i==="hook"?await this.fetchPromptServiceHooks(t,o,i):await this.fetchPromptServiceInstructions(t,n,o,i);return this.applyLocalFilters(this.applyBuiltinGroupKeys(t,n),i)}async fetchPromptServiceHooks(i,e,t){let o=await this.promptsService.listPromptFiles("hook",Ie.None);for(let r of o)i.push({uri:r.uri,type:t,name:r.name||N4t(Be(r.uri)),storage:r.storage,enabled:!e.has(r.uri),extensionId:r.extension?.identifier.value,pluginUri:r.pluginUri,userInvocable:void 0});let n=this.workspaceService.isSessionsWindow?[]:await this.promptsService.getCustomAgents(Ie.None);for(let r of n)if(!(!r.hooks||!r.enabled))for(let s of Object.values(fE)){let l=r.hooks[s];if(!l||l.length===0)continue;let c=yC[s];for(let u=0;u<l.length;u++){let p=l[u],h=G0(p,Ao),g=h.length>60?h.substring(0,57)+"...":h;i.push({uri:r.uri,type:t,name:c?.label??s,description:`${r.name}: ${g||d(7281,null)}`,storage:r.source.storage,groupKey:"agents",enabled:!e.has(r.uri),extensionId:r.source.storage==="extension"?r.source.extensionId.value:void 0,pluginUri:r.source.storage==="plugin"?r.source.pluginUri:void 0,userInvocable:void 0})}}}async fetchPromptServiceInstructions(i,e,t,o){let n=await this.promptsService.getInstructionFiles(Ie.None);for(let l of n)l.extension&&e.set(l.uri,{id:l.extension.identifier,displayName:l.extension.displayName});let r=await this.promptsService.listAgentInstructions(Ie.None,void 0),s=new xn(r.map(l=>l.uri));for(let l of r){let c="local",u=Be(l.uri);i.push({uri:l.uri,type:o,name:u,storage:c,groupKey:"agent-instructions",enabled:!t.has(l.uri),extensionId:void 0,pluginUri:void 0,userInvocable:void 0})}for(let{uri:l,pattern:c,name:u,description:p,storage:h,extension:g,pluginUri:f}of n){if(s.has(l))continue;let v=N4t(u);if(c!==void 0){let b=c==="**"?d(7279,null):c,S=c==="**"?d(7280,null):d(7282,null,c);i.push({uri:l,type:o,name:v,badge:b,badgeTooltip:S,description:p,storage:h,groupKey:"context-instructions",enabled:!t.has(l),extensionId:g?.identifier.value,pluginUri:f,userInvocable:void 0})}else i.push({uri:l,type:o,name:v,description:p,storage:h,groupKey:"on-demand-instructions",enabled:!t.has(l),extensionId:g?.identifier.value,pluginUri:f,userInvocable:void 0})}}applyBuiltinGroupKeys(i,e){return i.map(t=>{if(t.storage!=="extension")return t;let o=e.get(t.uri);return o?M4t(o.id,this.productService)?{...t,groupKey:t.groupKey??sc}:{...t,extensionLabel:o.displayName||o.id.value}:t})}applyLocalFilters(i,e){let t=this.workspaceService.getStorageSourceFilter(e),o=i.filter(u=>u.storage!==void 0),n=i.filter(u=>u.storage===void 0),r=[...APt(o,t),...n],s=this.getActiveDescriptor(),l=s.workspaceSubpaths,c=s.instructionFileFilter;if(l){let u=this.workspaceService.getActiveProjectRoot();r=r.filter(p=>!!(p.storage!=="local"||!u||!Yr(p.uri,u)||SDe(p.uri.path,l)||c&&e==="instructions"&&BSi(p.uri.path,c)||p.groupKey==="agent-instructions"))}return c&&e==="instructions"&&(r=r.filter(u=>BSi(u.uri.path,c))),r}};var HWi=[pn.Agents,pn.Skills,pn.Instructions,pn.Prompts,pn.Hooks],sct=le("aiCustomizationItemsModel"),rct=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.harnessService=e;this.promptsService=t;this.workspaceService=o;this.agentPluginService=s;this.fileService=c;this.pathService=u;this.sourceCache=new Map;this.perSection=new Map;this.perSectionCount=new Map;this.fetchSeq=new Map;this.perSectionPending=new Map;this.remotePluginNames=De("aiCustomizationRemotePluginNames",[]);this.pluginCount=ke(e=>{let t=this.agentPluginService.plugins.read(e),o=new Set(t.map(s=>(s.label||Be(s.uri)).toLowerCase())),r=this.remotePluginNames.read(e).filter(s=>s&&!o.has(s.toLowerCase()));return t.length+r.length});this.pluginCountObserved=!1;this.pluginFetchSeq=0;this.observedSections=new Set;this.itemNormalizer=new P4t(n,o,r,this.agentPluginService,l),this.promptsServiceItemProvider=new O4t(()=>this.harnessService.getActiveDescriptor(),this.promptsService,this.workspaceService,l);for(let h of HWi){let g=De(`aiCustomizationItems:${h}`,[]);this.perSection.set(h,g),this.perSectionCount.set(h,ke(f=>g.read(f).length)),this.fetchSeq.set(h,0)}let p=this._register(new ue);this._register(ve(h=>{let g=this.harnessService.availableHarnesses.read(h);this.harnessService.activeHarness.read(h),this.pruneSourceCache(g);let f=this.harnessService.getActiveDescriptor(),v=this.getOrCreateSource(f);p.value=v.onDidChange(()=>this.refetchObserved(v)),this.refetchObserved(v)})),this._register(n.onDidChangeWorkspaceFolders(()=>this.refetchObserved(this.getActiveItemSource()))),this._register(ve(h=>{this.workspaceService.activeProjectRoot.read(h),this.refetchObserved(this.getActiveItemSource())}))}getItems(e){return this.markObserved(e),this.perSection.get(e)}getCount(e){return this.markObserved(e),this.perSectionCount.get(e)}getPluginCount(){return this.markPluginCountObserved(),this.pluginCount}getActiveItemSource(){return this.getOrCreateSource(this.harnessService.getActiveDescriptor())}getPromptsServiceItemProvider(){return this.promptsServiceItemProvider}whenSectionLoaded(e){return this.markObserved(e),this.perSectionPending.get(e)??Promise.resolve()}markObserved(e){this.observedSections.has(e)||this._store.isDisposed||(this.observedSections.add(e),this.refetchSection(e,this.getActiveItemSource()))}markPluginCountObserved(){this.pluginCountObserved||this._store.isDisposed||(this.pluginCountObserved=!0,this.refetchPluginCount(this.getActiveItemSource()))}getOrCreateSource(e){let t=this.sourceCache.get(e);if(t)return t;let o=e.itemProvider??(e.syncProvider?void 0:this.promptsServiceItemProvider),n=new A4t(o,e.syncProvider,this.promptsService,this.workspaceService,this.fileService,this.pathService,this.itemNormalizer);return this.sourceCache.set(e,n),n}pruneSourceCache(e){let t=new Set(e);for(let o of this.sourceCache.keys())t.has(o)||this.sourceCache.delete(o)}refetchObserved(e){for(let t of this.observedSections)this.refetchSection(t,e);this.pluginCountObserved&&this.refetchPluginCount(e)}refetchSection(e,t){let o=(this.fetchSeq.get(e)??0)+1;this.fetchSeq.set(e,o);let n=ZSn(e),r=this.perSection.get(e),s=t.fetchItems(n).then(l=>{this._store.isDisposed||this.fetchSeq.get(e)===o&&this.getActiveItemSource()===t&&r.set(l,void 0)},l=>{this._store.isDisposed||mt(l)});this.perSectionPending.set(e,s)}refetchPluginCount(e){let t=++this.pluginFetchSeq,n=this.harnessService.getActiveDescriptor().itemProvider;(n?n.provideChatSessionCustomizations(Ie.None).then(s=>(s??[]).filter(l=>iAt(l)&&l.groupKey!=="remote-client").map(l=>l.name??"")):Promise.resolve([])).then(s=>{this._store.isDisposed||this.pluginFetchSeq===t&&this.getActiveItemSource()===e&&this.remotePluginNames.set(s,void 0)},s=>{this._store.isDisposed||mt(s)})}};rct=I([m(0,dh),m(1,jr),m(2,WM),m(3,Ae),m(4,nt),m(5,mm),m(6,Ze),m(7,ge),m(8,Pn)],rct);function ZSn(a){switch(a){case pn.Agents:return"agent";case pn.Skills:return"skill";case pn.Instructions:return"instructions";case pn.Hooks:return"hook";case pn.Prompts:default:return"prompt"}}Ce(sct,rct,1);var fh=_,eIn=44,tIn=36,iIn=40,zWi=class{getHeight(i){return i.type==="group-header"?i.isFirst?tIn:iIn:eIn}getTemplateId(i){return i.type==="group-header"?"groupHeader":"aiCustomizationItem"}},KWi=class{constructor(i){this.hoverService=i;this.templateId="groupHeader"}renderTemplate(i){let e=new O,t=new O;i.classList.add("ai-customization-group-header");let o=D(i,fh(".group-chevron")),n=D(i,fh(".group-icon")),r=D(i,fh(".group-label-group")),s=D(r,fh(".group-label")),l=D(i,fh(".group-count")),c=D(i,fh(".group-info"));return c.classList.add(...q.asClassNameArray(L.info)),{container:i,chevron:o,icon:n,label:s,count:l,infoIcon:c,disposables:e,elementDisposables:t}}renderElement(i,e,t){t.elementDisposables.clear(),t.chevron.className="group-chevron",t.chevron.classList.add(...q.asClassNameArray(i.collapsed?L.chevronRight:L.chevronDown)),t.icon.className="group-icon",t.icon.classList.add(...q.asClassNameArray(i.icon)),t.label.textContent=i.label,t.count.textContent=`${i.count}`,t.elementDisposables.add(this.hoverService.setupDelayedHover(t.infoIcon,()=>({content:i.description,appearance:{compact:!0,skipFadeInAnimation:!0}}))),t.container.classList.toggle("collapsed",i.collapsed),t.container.classList.toggle("has-previous-group",!i.isFirst)}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};function oIn(a){switch(a){case"agent":return gbe;case"skill":return fbe;case"instructions":return w1;case"prompt":return vHe;case"hook":return vbe;default:return vHe}}function C1(a){return a.replace(/\.md$/i,"")}var act=class{constructor(i,e,t,o,n,r){this.hoverService=i;this.labelService=e;this.menuService=t;this.contextKeyService=o;this.instantiationService=n;this.agentPluginService=r;this.templateId="aiCustomizationItem";this.templates=new Set;this.focusedIndex=-1}setFocusedIndex(i){this.focusedIndex=i;for(let e of this.templates)e.actionBar.setFocusable(i!==-1&&e.currentIndex===i)}renderTemplate(i){let e=new O,t=new O;i.classList.add("ai-customization-list-item");let o=D(i,fh(".item-left")),n=D(o,fh(".item-type-icon")),r=D(o,fh(".item-text")),s=D(r,fh(".item-name-row")),l=e.add(new ul(D(s,fh(".item-name")))),c=D(s,fh(".inline-badge.item-badge")),u=D(s,fh(".item-status-icon")),p=e.add(new ul(D(r,fh(".item-description")))),h=D(i,fh(".item-right")),g=e.add(new oo(h,{actionViewItemProvider:ta.bind(void 0,this.instantiationService)}));g.setFocusable(!1);let f={container:i,actionsContainer:h,actionBar:g,typeIcon:n,nameLabel:l,badge:c,statusIcon:u,description:p,disposables:e,elementDisposables:t,currentIndex:-1};return this.templates.add(f),f}renderElement(i,e,t){t.elementDisposables.clear(),t.currentIndex=e,t.actionBar.setFocusable(this.focusedIndex!==-1&&e===this.focusedIndex);let o=i.item;t.typeIcon.className="item-type-icon",t.typeIcon.classList.add(...q.asClassNameArray(o.typeIcon??oIn(o.promptType))),t.elementDisposables.add(this.hoverService.setupDelayedHover(t.container,()=>{let g;if(o.isBuiltin)g=`${o.name}
${d(6955,null)}`;else if(o.extensionId)g=`${o.name}
${d(7001,null,o.extensionId)}`;else{let v=o.storage==="local",b=this.labelService.getUriLabel(o.uri,{relative:v});g=`${o.name}
${b}`}o.badgeTooltip&&(g+=`

${o.badgeTooltip}`);let f=o.pluginUri&&this.agentPluginService.plugins.get().find(v=>ze(v.uri,o.pluginUri));return f&&(g+=`
${d(7002,null,f.label)}`),{content:g,appearance:{compact:!0,skipFadeInAnimation:!0}}})),t.container.classList.toggle("disabled",o.disabled);let n=o.displayName??C1(o.name);if(t.nameLabel.set(n,o.nameMatches),o.badge?(t.badge.textContent=o.badge,t.badge.style.display="",o.badgeTooltip&&t.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.badge,o.badgeTooltip))):(t.badge.textContent="",t.badge.style.display="none"),o.status){switch(t.statusIcon.style.display="",t.statusIcon.className="item-status-icon",o.status){case"loading":t.statusIcon.classList.add(...q.asClassNameArray(L.loading),"codicon-modifier-spin");break;case"loaded":t.statusIcon.classList.add(...q.asClassNameArray(L.check));break;case"degraded":t.statusIcon.classList.add(...q.asClassNameArray(L.warning));break;case"error":t.statusIcon.classList.add(...q.asClassNameArray(L.error));break}o.statusMessage&&t.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.statusIcon,o.statusMessage))}else t.statusIcon.style.display="none",t.statusIcon.className="item-status-icon";let r=BWi(o.description,o.filename,o.promptType),s;if(r&&o.description&&o.descriptionMatches)if(r===o.description)s=o.descriptionMatches;else{let g=r.length,f=o.descriptionMatches.map(v=>{if(v.start>=g||v.end<=0)return;let b=Math.max(0,v.start),S=Math.min(v.end,g);return S>b?{start:b,end:S}:void 0}).filter(v=>!!v);s=f.length?f:void 0}r?(t.description.set(r,s),t.description.element.style.display="",t.description.element.classList.toggle("is-filename",!o.description)):(t.description.set("",void 0),t.description.element.style.display="none");let l={uri:o.uri.toString(),name:o.name,promptType:o.promptType,storage:o.storage,pluginUri:o.pluginUri?.toString(),itemId:o.id},c=[[PN,o.promptType],[tMe,o.uri.toString()],[lte,o.disabled]];o.storage&&c.push([fW,o.storage]),o.pluginUri&&c.push([Tet,o.pluginUri.toString()]);let u=this.contextKeyService.createOverlay(c),p=t.elementDisposables.add(this.menuService.createMenu(ek,u)),h=()=>{let g=p.getActions({arg:l,shouldForwardArgs:!0}),{primary:f}=um(g,"inline");t.actionBar.clear(),t.actionBar.push(f,{icon:!0,label:!1})};h(),t.elementDisposables.add(p.onDidChange(h)),t.actionBar.context=l}disposeElement(i,e,t){t.currentIndex=-1}disposeTemplate(i){this.templates.delete(i),i.elementDisposables.dispose(),i.disposables.dispose()}};act=I([m(0,ot),m(1,nt),m(2,Yt),m(3,X),m(4,F),m(5,mm)],act);function UWi(a){switch(a){case pn.Agents:case pn.Skills:case pn.Instructions:case pn.Prompts:case pn.Hooks:return a;default:return}}function nIn(a,i,e){switch(a){case pn.Agents:return e?i===0?d(6965,null):i===1?d(6967,null):d(6968,null,i):i===0?d(6964,null):i===1?d(6966,null):d(6963,null,i);case pn.Skills:return e?i===0?d(6989,null):i===1?d(6991,null):d(6992,null,i):i===0?d(6988,null):i===1?d(6990,null):d(6987,null,i);case pn.Instructions:return e?i===0?d(6977,null):i===1?d(6979,null):d(6980,null,i):i===0?d(6976,null):i===1?d(6978,null):d(6975,null,i);case pn.Hooks:return e?i===0?d(6971,null):i===1?d(6973,null):d(6974,null,i):i===0?d(6970,null):i===1?d(6972,null):d(6969,null,i);case pn.Prompts:default:return e?i===0?d(6983,null):i===1?d(6985,null):d(6986,null,i):i===0?d(6982,null):i===1?d(6984,null):d(6981,null,i)}}var SHe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.instantiationService=e;this.promptsService=t;this.contextViewService=o;this.openerService=n;this.contextMenuService=r;this.menuService=s;this.contextKeyService=l;this.labelService=c;this.workspaceService=u;this.clipboardService=p;this.hoverService=h;this.fileService=g;this.telemetryService=f;this.harnessService=v;this.commandService=b;this.itemsModel=S;this.agentPluginService=y;this.currentSection=pn.Agents;this.allItems=[];this.displayEntries=[];this.searchQuery="";this.collapsedGroups=new Set;this._layoutDeferred=!1;this.lastLayoutWidth=0;this.lastLayoutHeight=0;this.lastHeaderHeight=0;this.dropdownActionDisposables=this._register(new O);this._sectionLoadId=0;this.delayedFilter=new rn(200);this.currentSectionSubscription=this._register(new ue);this._onDidSelectItem=this._register(new T);this.onDidSelectItem=this._onDidSelectItem.event;this._onDidChangeItemCount=this._register(new T);this.onDidChangeItemCount=this._onDidChangeItemCount.event;this._onDidRequestCreate=this._register(new T);this.onDidRequestCreate=this._onDidRequestCreate.event;this._onDidRequestCreateManual=this._register(new T);this.onDidRequestCreateManual=this._onDidRequestCreateManual.event;this.element=fh(".ai-customization-list-widget"),this.create(),this._register(ve(w=>{this.workspaceService.activeProjectRoot.read(w),this.updateAddButton()})),this._register(ve(w=>{this.harnessService.activeHarness.read(w),this.harnessService.availableHarnesses.read(w),this.updateAddButton()}))}create(){this.sectionTitleHeader=D(this.element,fh(".section-title-header"));let e=D(this.sectionTitleHeader,fh(".section-title-row"));this.sectionTitle=D(e,fh("h2.section-title")),this.sectionTitleDescription=D(this.sectionTitleHeader,fh("p.section-title-description")),this.sectionTitleDescriptionText=D(this.sectionTitleDescription,fh("span.section-title-description-text")),this.sectionTitleDescription.appendChild(document.createTextNode(" ")),this.sectionLink=D(this.sectionTitleDescription,fh("a.section-title-link")),this._register($(this.sectionLink,"click",s=>{s.preventDefault();let l=this.sectionLink.href;l&&this.openerService.open(A.parse(l))}));let t=Me(this.element),o=this._register(new zu("AICustomizationListWidget.sectionTitleHeader",()=>{this.lastLayoutWidth<=0||this.lastLayoutHeight<=0||this.sectionTitleHeader.offsetHeight===this.lastHeaderHeight||this.layout(this.lastLayoutHeight,this.lastLayoutWidth)},t));this._register(o.observe(this.sectionTitleHeader)),this.searchAndButtonContainer=D(this.element,fh(".list-search-and-button-container")),this.searchContainer=D(this.searchAndButtonContainer,fh(".list-search-container")),this.searchInput=this._register(new ad(this.searchContainer,this.contextViewService,{placeholder:d(7032,null),inputBoxStyles:Wl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.delayedFilter.trigger(()=>{let s=this.filterItems();this.announceItemCount(s),this.searchQuery.trim()&&this.telemetryService.publicLog2("chatCustomizationEditor.search",{section:this.currentSection,resultCount:s})})})),this.addButtonContainer=D(this.searchAndButtonContainer,fh(".list-add-button-container")),this.addButtonSimple=this._register(new Pi(this.addButtonContainer,{...Ro,supportIcons:!0})),this.addButtonSimple.element.classList.add("list-add-button"),this._register(this.addButtonSimple.onDidClick(()=>this.executePrimaryCreateAction())),this.addButton=this._register(new Jv(this.addButtonContainer,{...Ro,supportIcons:!0,contextMenuProvider:this.contextMenuService,addPrimaryActionToDropdown:!1,actions:{getActions:()=>this.getDropdownActions()}})),this.addButton.element.classList.add("list-add-button"),this._register(this.addButton.onDidClick(()=>this.executePrimaryCreateAction())),this.updateAddButton(),this.listContainer=D(this.element,fh(".list-container")),this.emptyStateContainer=D(this.element,fh(".list-empty-state"));let n=D(this.emptyStateContainer,fh(".empty-state-header"));this.emptyStateIcon=D(n,fh(".empty-state-icon")),this.emptyStateText=D(n,fh(".empty-state-text")),this.emptyStateSubtext=D(this.emptyStateContainer,fh(".empty-state-subtext")),this.emptyStateContainer.style.display="none";let r=this.instantiationService.createInstance(act);this.list=this._register(this.instantiationService.createInstance(bc,"AICustomizationManagementList",this.listContainer,new zWi,[new KWi(this.hoverService),r],{identityProvider:{getId:s=>s.type==="group-header"?s.id:s.item.id},accessibilityProvider:{getAriaLabel:s=>{if(s.type==="group-header")return d(7003,null,s.label,s.count,s.collapsed?d(6956,null):d(6998,null));let l=s.item.displayName??C1(s.item.name),c=BWi(s.item.description,s.item.filename,s.item.promptType),u=c?d(7009,null,l,c):l;return s.item.disabled?d(7010,null,u):u},getWidgetAriaLabel:()=>d(7016,null)},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:s=>s.type==="group-header"?s.label:s.item.name},multipleSelectionSupport:!1,openOnSingleClick:!0})),this._register(this.list.onDidOpen(s=>{s.element&&(s.element.type==="group-header"?this.toggleGroup(s.element):this._onDidSelectItem.fire(s.element.item))})),this._register(this.list.onDidChangeFocus(s=>{r.setFocusedIndex(s.indexes.length?s.indexes[0]:-1)})),this._register(this.list.onDidFocus(()=>{if(this.list.getFocus().length===0&&this.displayEntries.length>0){let s=this.displayEntries.findIndex(l=>l.type!=="group-header");s>=0&&this.list.setFocus([s])}})),this._register(this.list.onContextMenu(s=>this.onContextMenu(s))),this._register(this.fileService.onDidFilesChange(s=>{s.gotDeleted()&&this.refresh()})),this.updateSectionHeader()}onContextMenu(e){if(!e.element||e.element.type!=="file-item")return;let t=e.element.item,o={uri:t.uri.toString(),name:t.name,promptType:t.promptType,storage:t.storage,pluginUri:t.pluginUri?.toString(),itemId:t.id},n=[[PN,t.promptType],[tMe,t.uri.toString()],[lte,t.disabled]];t.storage&&n.push([fW,t.storage]),t.pluginUri&&n.push([Tet,t.pluginUri.toString()]);let r=this.contextKeyService.createOverlay(n),s=this.menuService.getMenuActions(ek,r,{arg:o,shouldForwardArgs:!0}),{secondary:l}=um(s,"inline"),c=t.isBuiltin?[]:[new oi,new it("copyFullPath",d(6961,null),void 0,!0,async()=>{await this.clipboardService.writeText(t.uri.fsPath)}),new it("copyRelativePath",d(6962,null),void 0,!0,async()=>{let u=this.workspaceService.getActiveProjectRoot();if(u&&t.uri.fsPath.startsWith(u.fsPath)){let p=t.uri.fsPath.substring(u.fsPath.length+1);await this.clipboardService.writeText(p)}else{let p=this.labelService.getUriLabel(t.uri,{relative:!0});await this.clipboardService.writeText(p)}})];this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[...l,...c]})}async setSection(e){let t=++this._sectionLoadId;this.currentSection=e,this.updateSectionHeader();let o=UWi(e);if(!o){this.currentSectionSubscription.clear(),this.allItems=[];let r=this.filterItems();this._onDidChangeItemCount.fire(0),this.updateAddButton(),this.announceItemCount(r);return}let n=this.itemsModel.getItems(o);this.currentSectionSubscription.value=ve(r=>{let s=n.read(r);this.allItems=s,this.filterItems(),this._onDidChangeItemCount.fire(s.length)}),this.updateAddButton(),await this.itemsModel.whenSectionLoaded(o),t===this._sectionLoadId&&this.announceItemCount(this.applySearchFilter(this.allItems).length)}updateSectionHeader(){let e,t,o,n;switch(this.currentSection){case pn.Agents:e=d(6951,null),t=d(6952,null),o="https://code.visualstudio.com/docs/copilot/customization/custom-agents",n=d(7011,null);break;case pn.Skills:e=d(7034,null),t=d(7035,null),o="https://code.visualstudio.com/docs/copilot/customization/agent-skills",n=d(7015,null);break;case pn.Instructions:e=d(7007,null),t=d(7008,null),o="https://code.visualstudio.com/docs/copilot/customization/custom-instructions",n=d(7013,null);break;case pn.Hooks:e=d(7005,null),t=d(7006,null),o="https://code.visualstudio.com/docs/copilot/customization/hooks",n=d(7012,null);break;case pn.Prompts:default:e=d(7028,null),t=d(7029,null),o="https://code.visualstudio.com/docs/copilot/customization/prompt-files",n=d(7014,null);break}this.sectionTitle.textContent=e,this.sectionTitleDescriptionText.textContent=t,this.sectionLink.textContent=n,this.sectionLink.href=o}updateAddButton(){let e=this.buildCreateActions(),[t,...o]=e,n=o.length>0;if(this.addButton.element.style.display=n?"":"none",this.addButtonSimple.element.style.display=n?"none":"",!t){this.addButtonSimple.element.style.display="none",this.addButton.element.style.display="none";return}n?(this.addButton.label=t.label,this.addButton.enabled=t.enabled,this.addButton.primaryButton.setTitle(t.tooltip??""),this.addButton.dropdownButton.setTitle("")):(this.addButtonSimple.label=t.label,this.addButtonSimple.enabled=t.enabled,this.addButtonSimple.setTitle(t.tooltip??""))}buildCreateActions(){let e=this.getTypeLabel(),t=gWt(this.currentSection),o=this.harnessService.getActiveDescriptor(),n=o.sectionOverrides?.get(this.currentSection),r=this.hasActiveWorkspace();if(n?.commandId)return[{label:`$(${L.add.id}) ${n.label}`,enabled:!0,run:()=>{this.commandService.executeCommand(n.commandId)}}];let s=this.menuService.getMenuActions(Bmo,this.contextKeyService,{shouldForwardArgs:!0}),l=[];for(let[,h]of s)for(let g of h)if(g instanceof Do){let f=q.isThemeIcon(g.item.icon)?g.item.icon.id:L.add.id;l.push({label:`$(${f}) ${typeof g.item.title=="string"?g.item.title:g.item.title.value}`,enabled:g.enabled,run:()=>{g.run()}})}if(l.length>0)return l;let c=n?.typeLabel??e,u=[],p=new Set;if(n?.rootFile&&r&&(u.push({label:`$(${L.add.id}) ${n.label}`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace-root"})}}),p.add("workspace-root")),t==="hook")return!this.workspaceService.isSessionsWindow&&!o.hideGenerateButton?(u.push({label:`$(${L.sparkle.id}) Generate ${e}`,enabled:!0,run:()=>{this._onDidRequestCreate.fire(t)}}),r&&u.push({label:`$(${L.add.id}) ${d(6957,null)}`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace"})}})):n?.commandId||u.push({label:`$(${L.add.id}) ${d(6957,null)}`,enabled:r,tooltip:r?void 0:d(6958,null),run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace"})}}),u;if(n?.rootFile||(!this.workspaceService.isSessionsWindow&&!o.hideGenerateButton?u.push({label:`$(${L.sparkle.id}) Generate ${e}`,enabled:!0,run:()=>{this._onDidRequestCreate.fire(t)}}):r?(u.push({label:`$(${L.add.id}) New ${c} (Workspace)`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace"})}}),p.add("workspace")):(u.push({label:`$(${L.add.id}) New ${c} (User)`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"user"})}}),p.add("user"))),r&&!p.has("workspace")&&u.push({label:`$(${L.folder.id}) New ${c} (Workspace)`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace"})}}),p.has("user")||u.push({label:`$(${L.account.id}) New ${c} (User)`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"user"})}}),r&&n?.rootFileShortcuts&&!p.has("workspace-root"))for(let h of n.rootFileShortcuts)u.push({label:`$(${L.file.id}) New ${h}`,enabled:!0,run:()=>{this._onDidRequestCreateManual.fire({type:t,target:"workspace-root",rootFileName:h})}});return u}getDropdownActions(){return this.dropdownActionDisposables.clear(),this.buildCreateActions().slice(1).map((t,o)=>this.dropdownActionDisposables.add(new it(`create_${o}`,t.label,void 0,t.enabled,()=>t.run())))}hasActiveWorkspace(){return!!this.workspaceService.getActiveProjectRoot()}executePrimaryCreateAction(){let e=this.buildCreateActions();e.length>0&&e[0].enabled&&e[0].run()}getTypeLabel(){switch(this.currentSection){case pn.Agents:return d(6948,null);case pn.Skills:return d(7033,null);case pn.Instructions:return d(7007,null);case pn.Hooks:return d(7004,null);case pn.Prompts:default:return d(7027,null)}}announceItemCount(e){let t=this.searchQuery.trim().length>0;Er(nIn(this.currentSection,e,t))}refresh(){this._store.isDisposed||(this.applyItemsFromModel(),this.updateAddButton())}applyItemsFromModel(){let e=UWi(this.currentSection);this.allItems=e?this.itemsModel.getItems(e).get():[],this.filterItems(),this._onDidChangeItemCount.fire(this.allItems.length)}computeItemCountForSection(e){let t=UWi(e);return t?this.itemsModel.getCount(t).get():0}applySearchFilter(e){if(!this.searchQuery.trim())return e.map(n=>({...n,nameMatches:void 0,descriptionMatches:void 0}));let t=this.searchQuery.toLowerCase(),o=[];for(let n of e){let r=n.displayName??C1(n.name),s=zF(t,r),l=n.description?zF(t,n.description):null,c=zF(t,n.filename),u=n.badge?zF(t,n.badge):null;(s||l||c||u)&&o.push({...n,nameMatches:s||void 0,descriptionMatches:l||void 0})}return o}buildGroupedEntries(e){for(let o of e)o.items.sort((n,r)=>n.name.localeCompare(r.name));this.displayEntries=[];let t=!0;for(let o of e){if(o.items.length===0)continue;let n=this.collapsedGroups.has(o.groupKey);if(this.displayEntries.push({type:"group-header",id:`group-${o.groupKey}`,groupKey:o.groupKey,label:o.label,icon:o.icon,count:o.items.length,isFirst:t,description:o.description,collapsed:n}),t=!1,!n)for(let r of o.items)this.displayEntries.push({type:"file-item",item:r})}}commitDisplayEntries(){this.list.splice(0,this.list.length,this.displayEntries),this.updateEmptyState()}groupMatchedItems(e){let t=this.currentSection===pn.Instructions?[{groupKey:"agent-instructions",label:d(6949,null),icon:w1,description:d(6950,null),items:[]},{groupKey:"context-instructions",label:d(6959,null),icon:w1,description:d(6960,null),items:[]},{groupKey:"on-demand-instructions",label:d(7023,null),icon:w1,description:d(7024,null),items:[]},{groupKey:"local",label:d(7039,null),icon:cre,description:d(7040,null),items:[]},{groupKey:"user",label:d(7037,null),icon:dre,description:d(7038,null),items:[]},{groupKey:"plugin",label:d(7025,null),icon:bk,description:d(7026,null),items:[]},{groupKey:sc,label:d(6953,null),icon:bHe,description:d(6954,null),items:[]}]:[{groupKey:"local",label:d(7039,null),icon:cre,description:d(7040,null),items:[]},{groupKey:"user",label:d(7037,null),icon:dre,description:d(7038,null),items:[]},{groupKey:"plugin",label:d(7025,null),icon:bk,description:d(7026,null),items:[]},{groupKey:"extension",label:d(6999,null),icon:bbe,description:d(7000,null),items:[]},{groupKey:sc,label:d(6953,null),icon:bHe,description:d(6954,null),items:[]}];for(let o of e){let n=o.groupKey??o.storage??"local",r=t.find(s=>s.groupKey===n);if(!r){let s;switch(n){case"remote-host":s=d(7031,null);break;case"remote-client":s=d(7030,null);break;default:s=C1(n)}r={groupKey:n,label:s,icon:L.folder,description:"",items:[]};let l=t.findIndex(c=>c.groupKey===sc);l>=0?t.splice(l,0,r):t.push(r)}r.items.push(o)}this.buildGroupedEntries(t),this.commitDisplayEntries()}filterItems(){let e=this.applySearchFilter(this.allItems);return this.groupMatchedItems(e),e.length}toggleGroup(e){this.collapsedGroups.has(e.groupKey)?this.collapsedGroups.delete(e.groupKey):this.collapsedGroups.add(e.groupKey),this.filterItems()}updateEmptyState(){if(this.displayEntries.length>0)this.emptyStateContainer.style.display="none",this.listContainer.style.display="";else{this.emptyStateContainer.style.display="flex",this.listContainer.style.display="none",this.emptyStateIcon.className="empty-state-icon";let t=this.getSectionIcon();if(this.emptyStateIcon.classList.add(...q.asClassNameArray(t)),this.searchQuery.trim())this.emptyStateText.textContent=d(7020,null,this.searchQuery),this.emptyStateSubtext.textContent=d(7036,null);else{let o=this.getEmptyStateInfo();this.emptyStateText.textContent=o.title,this.emptyStateSubtext.textContent=o.description}}}getSectionIcon(){switch(this.currentSection){case pn.Agents:return gbe;case pn.Skills:return fbe;case pn.Instructions:return w1;case pn.Hooks:return vbe;case pn.Prompts:default:return vHe}}getEmptyStateInfo(){switch(this.currentSection){case pn.Agents:return{title:d(7017,null),description:d(6993,null)};case pn.Skills:return{title:d(7022,null),description:d(6997,null)};case pn.Instructions:return{title:d(7019,null),description:d(6995,null)};case pn.Hooks:return{title:d(7018,null),description:d(6994,null)};case pn.Prompts:default:return{title:d(7021,null),description:d(6996,null)}}}setSearchQuery(e){this.searchInput.value=e}clearSearch(){this.searchInput.value=""}focusSearch(){this.searchInput.focus()}focusList(){this.list.domFocus(),this.displayEntries.length>0&&this.list.setFocus([0])}revealLastItem(){this.displayEntries.length>0&&this.list.reveal(this.displayEntries.length-1)}layout(e,t){this.lastLayoutHeight=e,this.lastLayoutWidth=t,this.element.style.height=`${e}px`,this.searchInput.layout();let o=this.searchAndButtonContainer.offsetHeight;if(o===0&&!this._layoutDeferred){this._layoutDeferred=!0,Me(this.element).requestAnimationFrame(()=>{try{this.layout(e,t)}finally{this._layoutDeferred=!1}});return}let n=this.sectionTitleHeader.offsetHeight;this.lastHeaderHeight=n;let r=Math.max(0,e-o-n);this.listContainer.style.height=`${r}px`,this.list.layout(r,t)}get itemCount(){return this.allItems.length}async generateDebugReport(){if(this._store.isDisposed)return"";let e=this.harnessService.getActiveDescriptor();return TLo(this.currentSection,this.promptsService,this.workspaceService,{allItems:this.allItems,displayEntries:this.displayEntries},e,this.itemsModel.getPromptsServiceItemProvider(),this.harnessService,this.agentPluginService)}};SHe=I([m(0,F),m(1,jr),m(2,qn),m(3,Je),m(4,Xe),m(5,Yt),m(6,X),m(7,nt),m(8,WM),m(9,Bi),m(10,ot),m(11,ge),m(12,_e),m(13,dh),m(14,fe),m(15,sct),m(16,mm)],SHe);var ym=class a extends it{constructor(){super(...arguments);this._onDidChange=this._register(new T);this._hidden=!1;this.hideOnDisabled=!0;this._mcpServer=null}get onDidChange(){return this._onDidChange.event}static{this.EXTENSION_ACTION_CLASS="extension-action"}static{this.TEXT_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} text`}static{this.LABEL_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} label`}static{this.PROMINENT_LABEL_ACTION_CLASS=`${a.LABEL_ACTION_CLASS} prominent`}static{this.ICON_ACTION_CLASS=`${a.EXTENSION_ACTION_CLASS} icon`}get hidden(){return this._hidden}set hidden(e){this._hidden!==e&&(this._hidden=e,this._onDidChange.fire({hidden:e}))}_setEnabled(e){super._setEnabled(e),this.hideOnDisabled&&(this.hidden=!e)}get mcpServer(){return this._mcpServer}set mcpServer(e){this._mcpServer=e,this.update()}},Sbe=class extends ym{constructor(e,t,o){t=`${t} action-dropdown`;super(e,void 0,t);this.actionsGroups=o;this.menuActionClassNames=[];this._menuActions=[];this.menuActionClassNames=t.split(" "),this.hideOnDisabled=!1,this.actions=o.flat(),this.update(),this._register(U.any(...this.actions.map(n=>n.onDidChange))(()=>this.update(!0))),this.actions.forEach(n=>this._register(n))}get menuActions(){return[...this._menuActions]}get mcpServer(){return super.mcpServer}set mcpServer(e){this.actions.forEach(t=>t.mcpServer=e),super.mcpServer=e}update(e){e||this.actions.forEach(n=>n.update());let t=this.actionsGroups.map(n=>n.filter(r=>!r.hidden)),o=[];for(let n of t)n.length&&(o=[...o,...n,new oi]);o=o.length?o.slice(0,o.length-1):o,this.primaryAction=o[0],this._menuActions=o.length>1?o:[],this._onDidChange.fire({menuActions:this._menuActions}),this.primaryAction?(this.hidden=!1,this.enabled=this.primaryAction.enabled,this.label=this.getLabel(this.primaryAction),this.tooltip=this.primaryAction.tooltip):(this.hidden=!0,this.enabled=!1)}async run(){this.enabled&&await this.primaryAction?.run()}getLabel(e){return e.label}},F4t=class extends ZX{constructor(i,e,t){super(null,i,e,t),this._register(i.onDidChange(o=>{(o.hidden!==void 0||o.menuActions!==void 0)&&this.updateClass()}))}render(i){super.render(i),this.updateClass()}updateClass(){if(super.updateClass(),this.element&&this.dropdownMenuActionViewItem?.element){this.element.classList.toggle("hide",this._action.hidden);let i=this._action.menuActions.length===0;this.element.classList.toggle("empty",i),this.dropdownMenuActionViewItem.element.classList.toggle("hide",i)}}},n9=class extends ym{constructor(e,t,o,n,r){super(e,t,o,n);this.instantiationService=r;this._actionViewItem=null}createActionViewItem(e){return this._actionViewItem=this.instantiationService.createInstance(lct,this,e),this._actionViewItem}run(e){return this._actionViewItem?.showMenu(e),Promise.resolve()}};n9=I([m(4,F)],n9);var lct=class extends ts{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!0});this.contextMenuService=o}showMenu(e){if(this.element){let t=this.getActions(e),o=ur(this.element),n={x:o.left,y:o.top+o.height+10};this.contextMenuService.showContextMenu({getAnchor:()=>n,getActions:()=>t,actionRunner:this.actionRunner,onHide:()=>gz(t)})}}getActions(e){let t=[];for(let o of e)t=[...t,...o,new oi];return t.length?t.slice(0,t.length-1):t}};lct=I([m(2,Xe)],lct);var H_=class extends ym{constructor(e,t,o,n){super("extensions.install",d(13086,null),H_.CLASS,!1);this.open=e;this.mcpWorkbenchService=t;this.telemetryService=o;this.mcpService=n;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=H_.HIDE,!(!this.mcpServer?.gallery&&!this.mcpServer?.installable)&&this.mcpServer.installState===3&&(this.class=H_.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0)}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer),cn(d(13101,null,this.mcpServer.label))),this.telemetryService.publicLog2("mcp:action:install",{name:this.mcpServer.gallery?.name});let e=await this.mcpWorkbenchService.install(this.mcpServer);await tqt(this.mcpService,t=>t.definition.label===e.name)}};H_=I([m(1,bf),m(2,_e),m(3,Vs)],H_);var _$=class extends ym{constructor(e,t,o,n,r,s){super("extensions.installWorkspace",d(13091,null),H_.CLASS,!1);this.open=e;this.mcpWorkbenchService=t;this.workspaceService=o;this.quickInputService=n;this.telemetryService=r;this.mcpService=s;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=_$.HIDE,this.workspaceService.getWorkbenchState()!==1&&(!this.mcpServer?.gallery&&!this.mcpServer?.installable||this.mcpServer.installState!==3&&this.mcpServer.local?.scope==="workspace"||(this.class=H_.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0))}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer,{preserveFocus:!0}),cn(d(13101,null,this.mcpServer.label)));let e=await this.getConfigurationTarget();if(!e)return;this.telemetryService.publicLog2("mcp:action:install:workspace",{name:this.mcpServer.gallery?.name});let t=await this.mcpWorkbenchService.install(this.mcpServer,{target:e});await tqt(this.mcpService,o=>o.definition.label===t.name)}async getConfigurationTarget(){let e=[];for(let o of this.workspaceService.getWorkspace().folders)e.push({target:o,label:o.name,description:d(13087,null)});return this.workspaceService.getWorkbenchState()===3&&(e.length>0&&e.push({type:"separator"}),e.push({target:5,label:d(13100,null)})),e.length===1?e[0].target:(await this.quickInputService.pick(e,{title:d(13099,null)}))?.target}};_$=I([m(1,bf),m(2,Ae),m(3,$e),m(4,_e),m(5,Vs)],_$);var D$=class extends ym{constructor(e,t,o,n,r,s){super("extensions.installRemote",d(13089,null),H_.CLASS,!1);this.open=e;this.mcpWorkbenchService=t;this.environmentService=o;this.telemetryService=n;this.labelService=r;this.mcpService=s;let l=this.labelService.getHostLabel(Q.vscodeRemote,this.environmentService.remoteAuthority);this.label=d(13090,null,l),this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent install`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=D$.HIDE,this.environmentService.remoteAuthority&&(!this.mcpServer?.gallery&&!this.mcpServer?.installable||this.mcpServer.installState!==3&&(this.mcpServer.local?.scope==="remoteUser"||this.mcpWorkbenchService.local.find(e=>e.name===this.mcpServer?.name&&e.local?.scope==="remoteUser"))||(this.class=H_.CLASS,this.enabled=this.mcpWorkbenchService.canInstall(this.mcpServer)===!0))}async run(){if(!this.mcpServer)return;this.open&&(this.mcpWorkbenchService.open(this.mcpServer),cn(d(13101,null,this.mcpServer.label))),this.telemetryService.publicLog2("mcp:action:install:remote",{name:this.mcpServer.gallery?.name});let e=await this.mcpWorkbenchService.install(this.mcpServer,{target:4});await tqt(this.mcpService,t=>t.definition.label===e.name)}};D$=I([m(1,bf),m(2,Mt),m(3,_e),m(4,nt),m(5,Vs)],D$);var wHe=class a extends ym{static{this.LABEL=d(13088,null)}static{this.CLASS=`${ym.LABEL_ACTION_CLASS} install installing`}constructor(){super("extension.installing",a.LABEL,a.CLASS,!1)}update(){this.class=`${a.CLASS}${this.mcpServer&&this.mcpServer.installState===0?"":" hide"}`}},LV=class extends ym{constructor(e){super("extensions.uninstall",d(13106,null),LV.CLASS,!1);this.mcpWorkbenchService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent uninstall`}static{this.HIDE=`${this.CLASS} hide`}update(){if(this.enabled=!1,this.class=LV.HIDE,!!this.mcpServer&&this.mcpServer.local){if(this.mcpServer.installState!==1){this.enabled=!1;return}this.class=LV.CLASS,this.enabled=!0,this.label=d(13106,null)}}async run(){this.mcpServer&&await this.mcpWorkbenchService.uninstall(this.mcpServer)}};LV=I([m(0,bf)],LV);var ure=class extends ym{constructor(e){super(ure.ID,d(13084,null),ym.LABEL_ACTION_CLASS);this.mcpService=e;this.tooltip=d(13085,null),this.update()}static{this.ID="mcpServer.enableGlobally"}update(){if(this.enabled=!1,!this.mcpServer?.local)return;let e=this.mcpService.servers.get().find(o=>o.definition.id===this.mcpServer?.id);if(!e)return;let t=e.enablement.get();this.enabled=sR(t)}async run(){this.mcpServer&&this.mcpService.enablementModel.setEnabled(this.mcpServer.id,2)}};ure=I([m(0,Vs)],ure);var pre=class extends ym{constructor(e,t){super(pre.ID,d(13082,null),ym.LABEL_ACTION_CLASS);this.mcpService=e;this.workspaceService=t;this.tooltip=d(13083,null),this.update()}static{this.ID="mcpServer.enableForWorkspace"}update(){if(this.enabled=!1,!this.mcpServer?.local||this.workspaceService.getWorkbenchState()===1)return;let e=this.mcpService.servers.get().find(o=>o.definition.id===this.mcpServer?.id);if(!e)return;let t=e.enablement.get();this.enabled=sR(t)}async run(){this.mcpServer&&this.mcpService.enablementModel.setEnabled(this.mcpServer.id,3)}};pre=I([m(0,Vs),m(1,Ae)],pre);var mre=class extends ym{constructor(e){super(mre.ID,d(13080,null),ym.LABEL_ACTION_CLASS);this.mcpService=e;this.tooltip=d(13081,null),this.update()}static{this.ID="mcpServer.disableGlobally"}update(){if(this.enabled=!1,!this.mcpServer?.local)return;let e=this.mcpService.servers.get().find(o=>o.definition.id===this.mcpServer?.id);if(!e)return;let t=e.enablement.get();this.enabled=Xf(t)}async run(){this.mcpServer&&this.mcpService.enablementModel.setEnabled(this.mcpServer.id,0)}};mre=I([m(0,Vs)],mre);var hre=class extends ym{constructor(e,t){super(hre.ID,d(13078,null),ym.LABEL_ACTION_CLASS);this.mcpService=e;this.workspaceService=t;this.tooltip=d(13079,null),this.update()}static{this.ID="mcpServer.disableForWorkspace"}update(){if(this.enabled=!1,!this.mcpServer?.local||this.workspaceService.getWorkbenchState()===1)return;let e=this.mcpService.servers.get().find(o=>o.definition.id===this.mcpServer?.id);if(!e)return;let t=e.enablement.get();this.enabled=Xf(t)}async run(){this.mcpServer&&this.mcpService.enablementModel.setEnabled(this.mcpServer.id,1)}};hre=I([m(0,Vs),m(1,Ae)],hre);var IHe=class extends Sbe{constructor(i){super("mcpServer.enable",ym.LABEL_ACTION_CLASS,[[i.createInstance(ure),i.createInstance(pre)]])}};IHe=I([m(0,F)],IHe);var yHe=class extends Sbe{constructor(i){super("mcpServer.disable",ym.LABEL_ACTION_CLASS,[[i.createInstance(mre),i.createInstance(hre)]])}};yHe=I([m(0,F)],yHe);function cct(a,i,e){return e.invokeFunction(t=>{let o=t.get(Ae),n=t.get(Mt),r=[];if(a.installState===1){if(r.push([e.createInstance(r9)]),r.push([e.createInstance(s9),e.createInstance(R$)]),r.push([e.createInstance(ure),e.createInstance(pre),e.createInstance(mre),e.createInstance(hre)]),r.push([e.createInstance(x1)]),r.push([e.createInstance(a9),e.createInstance(L$),e.createInstance(gre)]),r.push([e.createInstance(l9),e.createInstance(c9)]),r.push([e.createInstance(d9)]),!i){let l=[e.createInstance(LV)];o.getWorkbenchState()!==1&&l.push(e.createInstance(_$,!1)),n.remoteAuthority&&a.local?.scope!=="remoteUser"&&l.push(e.createInstance(D$,!1)),r.push(l)}}else{let l=[];o.getWorkbenchState()!==1&&l.push(e.createInstance(_$,!i)),n.remoteAuthority&&l.push(e.createInstance(D$,!i)),r.push(l)}return r.forEach(l=>l.forEach(c=>c.mcpServer=a)),r})}var GP=class extends n9{constructor(e,t){super(GP.ID,"","",!0,t);this.isEditorAction=e;this.tooltip=d(13092,null),this.update()}static{this.ID="mcpServer.manage"}static{this.Class=`${ym.ICON_ACTION_CLASS} manage `+q.asClassName(Kge)}static{this.HideManageExtensionClass=`${this.Class} hide`}async run(){return super.run(this.mcpServer?cct(this.mcpServer,this.isEditorAction,this.instantiationService):[])}update(){this.class=GP.HideManageExtensionClass,this.enabled=!1,this.mcpServer&&(this.isEditorAction?(this.enabled=!0,this.class=GP.Class):(this.enabled=!!this.mcpServer.local,this.class=this.enabled?GP.Class:GP.HideManageExtensionClass))}};GP=I([m(1,F)],GP);var r9=class extends ym{constructor(e){super("extensions.start",d(13104,null),r9.CLASS,!1);this.mcpService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent start`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=r9.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();Sr.canBeStarted(t.state)&&(this.class=r9.CLASS,this.enabled=!0,this.label=d(13104,null))}async run(){let e=this.getServer();e&&(await e.start({promptType:"all-untrusted"}),e.showOutput())}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};r9=I([m(0,Vs)],r9);var s9=class extends ym{constructor(e){super("extensions.stop",d(13105,null),s9.CLASS,!1);this.mcpService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent stop`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=s9.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();Sr.canBeStarted(t.state)||(this.class=s9.CLASS,this.enabled=!0,this.label=d(13105,null))}async run(){let e=this.getServer();e&&await e.stop()}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};s9=I([m(0,Vs)],s9);var R$=class extends ym{constructor(e){super("extensions.restart",d(13103,null),R$.CLASS,!1);this.mcpService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent restart`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=R$.HIDE;let e=this.getServer();if(!e)return;let t=e.connectionState.get();Sr.canBeStarted(t.state)||(this.class=R$.CLASS,this.enabled=!0,this.label=d(13103,null))}async run(){let e=this.getServer();e&&(await e.stop(),await e.start({promptType:"all-untrusted"}),e.showOutput())}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};R$=I([m(0,Vs)],R$);var x1=class extends ym{constructor(e,t,o){super("extensions.restart",d(13103,null),R$.CLASS,!1);this.mcpService=e;this._authenticationQueryService=t;this._authenticationService=o;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent account`}static{this.HIDE=`${this.CLASS} hide`}static{this.SIGN_OUT=d(13098,null)}static{this.DISCONNECT=d(13094,null)}update(){if(this.enabled=!1,this.class=x1.HIDE,!this.getServer())return;let t=this.getAccountQuery();if(!t)return;this._accountQuery=t,this.class=x1.CLASS,this.enabled=!0;let o=t.entities().getEntityCount().total>1?x1.DISCONNECT:x1.SIGN_OUT;o+=` (${t.accountName})`,this.label=o}async run(){let e=this.getServer();if(!e)return;let t=this.getAccountQuery();if(!t)return;await e.stop();let{providerId:o,accountName:n}=t;if(t.mcpServer(e.definition.id).setAccessAllowed(!1,e.definition.label),this.label===x1.SIGN_OUT){let s=(await this._authenticationService.getAccounts(o)).find(l=>l.label===n);if(s){let l=await this._authenticationService.getSessions(o,void 0,{account:s});for(let c of l)await this._authenticationService.removeSession(o,c.id)}}}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}getAccountQuery(){let e=this.getServer();if(!e)return;if(this._accountQuery)return this._accountQuery;let t=e.definition.id,o=this._authenticationQueryService.mcpServer(t).getAllAccountPreferences();if(o.size)for(let[n,r]of o){let s=this._authenticationQueryService.provider(n).account(r);if(s.mcpServer(t).isAccessAllowed())return s}}};x1=I([m(0,Vs),m(1,gP),m(2,ks)],x1);var a9=class extends ym{constructor(e){super("extensions.output",d(13102,null),a9.CLASS,!1);this.mcpService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent output`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=a9.HIDE,this.getServer()&&(this.class=a9.CLASS,this.enabled=!0,this.label=d(13102,null))}async run(){let e=this.getServer();e&&e.showOutput()}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};a9=I([m(0,Vs)],a9);var L$=class extends ym{constructor(e){super("extensions.config",d(13076,null),L$.CLASS,!1);this.mcpWorkbenchService=e;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=L$.HIDE,this.mcpServer?.local&&(this.class=L$.CLASS,this.enabled=!0)}async run(){this.mcpServer?.local&&this.mcpWorkbenchService.open(this.mcpServer,{tab:"configuration"})}};L$=I([m(0,bf)],L$);var gre=class extends ym{constructor(e,t,o){super("extensions.jsonConfig",d(13077,null),gre.CLASS,!1);this.mcpService=e;this.mcpRegistry=t;this.editorService=o;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=gre.HIDE,this.getConfigurationTarget()&&(this.class=L$.CLASS,this.enabled=!0)}async run(){let e=this.getConfigurationTarget();e&&this.editorService.openEditor({resource:A.isUri(e)?e:e.uri,options:{selection:A.isUri(e)?void 0:e.range}})}getConfigurationTarget(){if(!this.mcpServer||!this.mcpServer.local)return;let e=this.mcpService.servers.get().find(n=>n.definition.label===this.mcpServer?.name);if(!e)return;let t=this.mcpRegistry.collections.get().find(n=>n.id===e.collection.id);return t?.serverDefinitions.get().find(n=>n.id===e.definition.id)?.presentation?.origin||t?.presentation?.origin}};gre=I([m(0,Vs),m(1,xc),m(2,ie)],gre);var l9=class extends ym{constructor(e,t){super("extensions.config",d(13093,null),l9.CLASS,!1);this.mcpService=e;this.commandService=t;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=l9.HIDE,this.getServer()&&(this.class=l9.CLASS,this.enabled=!0,this.label=d(13093,null))}async run(){let e=this.getServer();e&&this.commandService.executeCommand("workbench.mcp.configureSamplingModels",e)}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};l9=I([m(0,Vs),m(1,fe)],l9);var c9=class extends ym{constructor(e,t,o){super("extensions.config",d(13096,null),c9.CLASS,!1);this.mcpService=e;this.samplingService=t;this.editorService=o;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=c9.HIDE;let e=this.getServer();e&&this.samplingService.hasLogs(e)&&(this.class=c9.CLASS,this.enabled=!0)}async run(){let e=this.getServer();e&&this.samplingService.hasLogs(e)&&this.editorService.openEditor({resource:void 0,contents:this.samplingService.getLogText(e),label:d(13097,null,e.definition.label)})}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};c9=I([m(0,Vs),m(1,Z3),m(2,ie)],c9);var d9=class extends ym{constructor(e,t){super("extensions.config",d(13095,null),d9.CLASS,!1);this.mcpService=e;this.commandService=t;this.update()}static{this.CLASS=`${this.LABEL_ACTION_CLASS} prominent config`}static{this.HIDE=`${this.CLASS} hide`}update(){this.enabled=!1,this.class=d9.HIDE;let e=this.getServer();if(!e)return;let t=e.capabilities.get();t!==void 0&&!(t&16)||(this.class=d9.CLASS,this.enabled=!0)}async run(){let e=this.getServer();if(!e)return;let t=e.capabilities.get();if(!(t!==void 0&&!(t&16)))return this.commandService.executeCommand("workbench.mcp.browseResources",e)}getServer(){if(this.mcpServer&&this.mcpServer.local)return this.mcpService.servers.get().find(e=>e.definition.id===this.mcpServer?.id)}};d9=I([m(0,Vs),m(1,fe)],d9);var tL=class extends ym{constructor(e,t){super("extensions.status","",`${tL.CLASS} hide`,!1);this.mcpWorkbenchService=e;this.commandService=t;this._status=[];this._onDidChangeStatus=this._register(new T);this.onDidChangeStatus=this._onDidChangeStatus.event;this.update()}static{this.CLASS=`${ym.ICON_ACTION_CLASS} extension-status`}get status(){return this._status}update(){this.computeAndUpdateStatus()}computeAndUpdateStatus(){if(this.updateStatus(void 0,!0),this.enabled=!1,!this.mcpServer)return;if((this.mcpServer.gallery||this.mcpServer.installable)&&this.mcpServer.installState===3){let t=this.mcpWorkbenchService.canInstall(this.mcpServer);if(t!==!0){this.updateStatus({icon:fp,message:t},!0);return}}let e=this.mcpServer.runtimeStatus;e?.message&&this.updateStatus({icon:e.message.severity===wt.Warning?fp:e.message.severity===wt.Error?cI:Ef,message:e.message.text},!0)}updateStatus(e,t){if(e){if(this._status.some(o=>o.message.value===e.message.value&&o.icon?.id===e.icon?.id))return}else{if(this._status.length===0)return;this._status=[]}e&&(this._status.push(e),this._status.sort((o,n)=>n.icon===SP?-1:o.icon===SP?1:n.icon===cI?-1:o.icon===cI?1:n.icon===fp?-1:o.icon===fp?1:n.icon===Ef?-1:o.icon===Ef?1:0)),t&&(e?.icon===cI?this.class=`${tL.CLASS} extension-status-error ${q.asClassName(cI)}`:e?.icon===fp?this.class=`${tL.CLASS} extension-status-warning ${q.asClassName(fp)}`:e?.icon===Ef?this.class=`${tL.CLASS} extension-status-info ${q.asClassName(Ef)}`:e?.icon===SP?this.class=`${tL.CLASS} ${q.asClassName(SP)}`:this.class=`${tL.CLASS} hide`),this._onDidChangeStatus.fire()}async run(){if(this._status[0]?.icon===SP)return this.commandService.executeCommand("workbench.trust.manage")}};tL=I([m(0,bf),m(1,fe)],tL);var xHe=_,B4t=36,H4t=40,kHe=class{constructor(i,e){this.templateId=i;this.hoverService=e}renderTemplate(i){let e=new O,t=new O;i.classList.add("ai-customization-group-header");let o=D(i,xHe(".group-chevron")),n=D(i,xHe(".group-icon")),r=D(i,xHe(".group-label-group")),s=D(r,xHe(".group-label")),l=D(i,xHe(".group-count")),c=D(i,xHe(".group-info"));return c.classList.add(...q.asClassNameArray(L.info)),{container:i,chevron:o,icon:n,label:s,count:l,infoIcon:c,disposables:e,elementDisposables:t}}renderElement(i,e,t){t.elementDisposables.clear(),t.chevron.className="group-chevron",t.chevron.classList.add(...q.asClassNameArray(i.collapsed?L.chevronRight:L.chevronDown)),t.icon.className="group-icon",t.icon.classList.add(...q.asClassNameArray(i.icon)),t.label.textContent=i.label,t.count.textContent=`${i.count}`,t.elementDisposables.add(this.hoverService.setupDelayedHover(t.infoIcon,()=>({content:i.description,appearance:{compact:!0,skipFadeInAnimation:!0}}))),t.container.classList.toggle("collapsed",i.collapsed),t.container.classList.toggle("has-previous-group",!i.isFirst)}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};var tp=_,rIn=36,GWi="plugin.",sIn=["github.copilot","github.copilot-chat"];function aIn(a){return sIn.some(i=>hi.equals(a,i))}function RLo(a){return a?.startsWith(GWi)?a.slice(GWi.length):void 0}var qWi=class{getHeight(i){return i.type==="group-header"?i.isFirst?B4t:H4t:i.type==="server-item"&&i.server.gallery&&!i.server.local?62:rIn}getTemplateId(i){if(i.type==="group-header")return"mcpGroupHeader";if(i.type==="builtin-item")return"mcpServerItem";let e=i.server;return e.gallery&&!e.local?"mcpGalleryItem":"mcpServerItem"}},dct=class{constructor(i,e,t,o){this.mcpService=i;this.workspaceService=e;this.agentPluginService=t;this.hoverService=o;this.templateId="mcpServerItem"}renderTemplate(i){i.classList.add("mcp-server-item");let e=D(i,tp(".mcp-server-icon"));e.classList.add(...q.asClassNameArray(nct));let t=D(i,tp(".mcp-server-details")),o=D(t,tp(".mcp-server-name-row")),n=D(o,tp(".mcp-server-name")),r=D(t,tp(".mcp-server-description")),s=D(i,tp(".mcp-server-status"));return{container:i,typeIcon:e,name:n,description:r,status:s,disposables:new O}}renderElement(i,e,t){if(t.disposables.clear(),i.type==="builtin-item"){t.container.classList.add("builtin"),t.name.textContent=C1(i.label),i.description?(t.description.textContent=o9(i.description),t.description.style.display=""):t.description.style.display="none",t.status.style.display="none";let n=RLo(i.collectionId);n&&t.disposables.add(this.hoverService.setupDelayedHover(t.container,()=>{let r=this.agentPluginService.plugins.get().find(s=>s.uri.toString()===n);return r?{content:`${i.label}
${d(7195,null,r.label)}`,appearance:{compact:!0,skipFadeInAnimation:!0}}:{content:i.label,appearance:{compact:!0,skipFadeInAnimation:!0}}}));return}t.container.classList.remove("builtin"),t.name.textContent=C1(i.server.label),i.server.description?(t.description.textContent=o9(i.server.description),t.description.style.display=""):t.description.style.display="none";let o=this.mcpService.servers.get().find(n=>n.definition.id===i.server.id);t.disposables.add(ve(n=>{let r=o?sR(o.enablement.read(n)):!1,s=o?.connectionState.read(n);t.container.classList.toggle("disabled",r),this.updateStatus(t.status,r?"disabled":s?.state)}))}updateStatus(i,e){if(i.className="mcp-server-status",this.workspaceService.isSessionsWindow){i.style.display="none";return}if(i.style.display="",e==="disabled"){i.textContent=d(7189,null),i.classList.add("disabled");return}switch(e){case Sr.Kind.Running:i.textContent=d(7215,null),i.classList.add("running");break;case Sr.Kind.Starting:i.textContent=d(7219,null),i.classList.add("starting");break;case Sr.Kind.Error:i.textContent=d(7191,null),i.classList.add("error");break;case Sr.Kind.Stopped:default:i.textContent=d(7220,null),i.classList.add("stopped");break}}disposeTemplate(i){i.disposables.dispose()}};dct=I([m(0,Vs),m(1,WM),m(2,mm),m(3,ot)],dct);var $Wi=class{constructor(i){this.mcpWorkbenchService=i;this.templateId="mcpGalleryItem"}renderTemplate(i){i.classList.add("mcp-server-item","mcp-gallery-item","extension-list-item");let e=D(i,tp(".details")),t=D(e,tp(".header-container")),o=D(t,tp(".header")),n=D(o,tp("span.name")),r=D(e,tp(".description.ellipsis")),s=D(e,tp(".publisher-container")),l=D(s,tp("span.publisher-name.mcp-gallery-publisher")),c=D(i,tp(".mcp-gallery-action")),u=new Pi(c,{...Ro,supportIcons:!0});u.element.classList.add("mcp-gallery-install-button");let p=new O;return p.add(u),{container:i,name:n,publisher:l,description:r,installButton:u,elementDisposables:new O,templateDisposables:p}}renderElement(i,e,t){t.elementDisposables.clear(),t.name.textContent=i.server.label,t.publisher.textContent=i.server.publisherDisplayName?`by ${i.server.publisherDisplayName}`:"",t.description.textContent=i.server.description||"",this.updateInstallButton(t.installButton,i.server),t.elementDisposables.add(t.installButton.onDidClick(async()=>{this.mcpWorkbenchService.canInstall(i.server)===!0&&(t.installButton.label=d(7199,null),t.installButton.enabled=!1,await this.mcpWorkbenchService.install(i.server))})),t.elementDisposables.add(this.mcpWorkbenchService.onChange(o=>{(!o||o.id===i.server.id)&&this.updateInstallButton(t.installButton,i.server)}))}updateInstallButton(i,e){switch(e.installState){case 1:i.label=d(7198,null),i.enabled=!1;break;case 0:i.label=d(7199,null),i.enabled=!1;break;default:i.label=d(7197,null),i.enabled=!0;break}}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposables.dispose()}},EHe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.instantiationService=e;this.mcpWorkbenchService=t;this.mcpService=o;this.mcpRegistry=n;this.commandService=r;this.openerService=s;this.contextViewService=l;this.contextMenuService=c;this.hoverService=u;this.agentPluginService=p;this.dialogService=h;this.configurationService=g;this._onDidSelectServer=this._register(new T);this.onDidSelectServer=this._onDidSelectServer.event;this._onDidChangeItemCount=this._register(new T);this.onDidChangeItemCount=this._onDidChangeItemCount.event;this._onDidRequestShowPlugin=this._register(new T);this.onDidRequestShowPlugin=this._onDidRequestShowPlugin.event;this.disabledLinkListener=this._register(new ue);this.filteredServers=[];this.filteredBuiltinCount=0;this.displayEntries=[];this.galleryServers=[];this.searchQuery="";this.browseMode=!1;this.lastHeight=0;this.lastWidth=0;this.lastHeaderHeight=0;this._layoutDeferred=!1;this.collapsedGroups=new Set;this.delayedFilter=new rn(200);this.delayedGallerySearch=new rn(400);this.element=tp(".mcp-list-widget"),this.create(),this.updateAccessState(),this._register(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(sy)&&this.updateAccessState()})),this._register({dispose:()=>{this.galleryCts?.dispose()}})}create(){this.sectionTitleHeader=D(this.element,tp(".section-title-header"));let e=D(this.sectionTitleHeader,tp(".section-title-row")),t=D(e,tp("h2.section-title"));t.textContent=d(7207,null);let o=D(this.sectionTitleHeader,tp("p.section-title-description")),n=D(o,tp("span.section-title-description-text"));n.textContent=d(7208,null),o.appendChild(document.createTextNode(" ")),this.sectionLink=D(o,tp("a.section-title-link")),this.sectionLink.textContent=d(7200,null),this.sectionLink.href="https://code.visualstudio.com/docs/copilot/chat/mcp-servers",this._register($(this.sectionLink,"click",w=>{w.preventDefault();let x=this.sectionLink.href;x&&this.openerService.open(A.parse(x))}));let r=Me(this.element),s=this._register(new zu("McpListWidget.sectionTitleHeader",()=>{this.lastWidth<=0||this.lastHeight<=0||this.sectionTitleHeader.offsetHeight===this.lastHeaderHeight||this.layout(this.lastHeight,this.lastWidth)},r));this._register(s.observe(this.sectionTitleHeader)),this.searchAndButtonContainer=D(this.element,tp(".list-search-and-button-container"));let l=D(this.searchAndButtonContainer,tp(".list-search-container"));this.searchInput=this._register(new ad(l,this.contextViewService,{placeholder:d(7217,null),inputBoxStyles:Wl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.browseMode?this.delayedGallerySearch.trigger(()=>this.queryGallery()):this.delayedFilter.trigger(()=>this.filterServers())}));let c=D(this.searchAndButtonContainer,tp(".list-button-group")),u=D(c,tp(".list-add-button-container"));this.browseButton=this._register(new Pi(u,{...Ro,secondary:!0,supportIcons:!0})),this.browseButton.label=`$(${L.library.id}) ${d(7183,null)}`,this.browseButton.element.classList.add("list-add-button"),this._register(this.browseButton.onDidClick(()=>{this.toggleBrowseMode(!this.browseMode)})),this.addButton=this._register(new Pi(c,{...Ro,secondary:!0,supportIcons:!0,title:d(7181,null),ariaLabel:d(7181,null)})),this.addButton.label=`$(${L.add.id})`,this.addButton.element.classList.add("list-icon-button"),this._register(this.hoverService.setupManagedHover(yi("element"),this.addButton.element,d(7182,null))),this._register(this.addButton.onDidClick(()=>{this.commandService.executeCommand("workbench.mcp.addConfiguration")})),this.emptyContainer=D(this.element,tp(".mcp-empty-state"));let p=D(this.emptyContainer,tp(".empty-state-header"));D(p,tp(".empty-icon")).classList.add(...q.asClassNameArray(L.server)),this.emptyText=D(p,tp(".empty-text")),this.emptySubtext=D(this.emptyContainer,tp(".empty-subtext")),this.disabledContainer=D(this.element,tp(".mcp-disabled-state"));let g=D(this.disabledContainer,tp(".empty-state-header"));this.disabledIcon=D(g,tp(".empty-icon"));let f=D(g,tp(".empty-text"));f.textContent=d(7205,null),this.disabledMessage=D(this.disabledContainer,tp(".empty-subtext")),this.listContainer=D(this.element,tp(".mcp-list-container"));let v=new qWi,b=new kHe("mcpGroupHeader",this.hoverService),S=this.instantiationService.createInstance(dct),y=new $Wi(this.mcpWorkbenchService);this.list=this._register(this.instantiationService.createInstance(bc,"McpManagementList",this.listContainer,v,[b,S,y],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel:w=>w.type==="group-header"?d(7206,null,w.label,w.count,w.collapsed?d(7186,null):d(7192,null)):w.type==="builtin-item"?w.label:w.server.label,getWidgetAriaLabel(){return d(7209,null)}},openOnSingleClick:!0,identityProvider:{getId(w){return w.type==="group-header"||w.type==="builtin-item"?w.id:w.server.id}}})),this._register(this.list.onDidOpen(w=>{w.element&&(w.element.type==="group-header"?this.toggleGroup(w.element):w.element.type==="server-item"&&this._onDidSelectServer.fire(w.element.server))})),this._register(this.list.onContextMenu(w=>this.onContextMenu(w))),this._register(this.mcpWorkbenchService.onChange(()=>{this.browseMode||this.refresh()})),this._register(ve(w=>{this.mcpService.servers.read(w),this.browseMode||this.refresh()})),this.refresh()}async refresh(){this.browseMode?await this.queryGallery():this.filterServers()}updateAccessState(){let e=this.configurationService.inspect(sy),o=(e.value??e.defaultValue)==="none",n=e.policyValue==="none";if(this.element.classList.toggle("access-disabled",o),o)if(this.disabledIcon.className="empty-icon",this.disabledIcon.classList.add(...q.asClassNameArray(n?L.shield:nct)),St(this.disabledMessage),this.disabledLinkListener.clear(),n)this.disabledMessage.textContent=d(7202,null);else{this.disabledMessage.appendChild(document.createTextNode(d(7203,null)));let r=D(this.disabledMessage,tp("a.mcp-disabled-settings-link"));r.textContent=d(7204,null),r.href="#",r.setAttribute("role","button"),this.disabledLinkListener.value=$(r,"click",s=>{s.preventDefault(),this.commandService.executeCommand("workbench.action.openSettings",`@id:${sy}`)})}}showBrowseMarketplace(){this.browseMode||this.toggleBrowseMode(!0)}toggleBrowseMode(e){this.browseMode=e,this.searchInput.value="",this.searchQuery="",this.addButton.element.style.display=e?"none":"",this.browseButton.element.parentElement.style.display=e?"none":"",this.searchInput.setPlaceHolder(e?d(7216,null):d(7217,null)),e?this.queryGallery():(this.galleryCts?.dispose(!0),this.galleryServers=[],this.filterServers()),this.lastHeight>0&&this.layout(this.lastHeight,this.lastWidth)}async queryGallery(){this.galleryCts?.dispose(!0);let e=this.galleryCts=new qe;this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(7201,null),this.emptySubtext.textContent="";try{let t=await this.mcpWorkbenchService.queryGallery({text:this.searchQuery.trim()||void 0},e.token);if(e.token.isCancellationRequested)return;this.galleryServers=t.firstPage.items,this.updateGalleryList()}catch{e.token.isCancellationRequested||(this.galleryServers=[],this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(7196,null),this.emptySubtext.textContent=d(7221,null))}}updateGalleryList(){this.galleryServers.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(7210,null,this.searchQuery),this.emptySubtext.textContent=d(7222,null)):(this.emptyText.textContent=d(7190,null),this.emptySubtext.textContent="")):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let e=this.galleryServers.map(t=>({type:"server-item",server:t}));this.list.splice(0,this.list.length,e)}filterServers(){let e=this.searchQuery.toLowerCase().trim();e?this.filteredServers=this.mcpWorkbenchService.local.filter(h=>h.label.toLowerCase().includes(e)||h.description?.toLowerCase().includes(e)):this.filteredServers=[...this.mcpWorkbenchService.local];let t=new Set(this.filteredServers.map(h=>h.id)),o=this.mcpService.servers.get().filter(h=>!t.has(h.definition.id)).filter(h=>!e||h.definition.label.toLowerCase().includes(e));this.filteredServers.length===0&&o.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(7211,null,this.searchQuery),this.emptySubtext.textContent=d(7222,null)):(this.emptyText.textContent=d(7212,null),this.emptySubtext.textContent=d(7180,null))):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let n=[{scope:"workspace",label:d(7227,null),icon:cre,description:d(7228,null),servers:[]},{scope:"user",label:d(7225,null),icon:dre,description:d(7226,null),servers:[]}];for(let h of this.filteredServers)h.local?.scope==="workspace"?n[0].servers.push(h):n[1].servers.push(h);let r=[],s=!0;for(let h of n){if(h.servers.length===0)continue;let g=this.collapsedGroups.has(h.scope);if(r.push({type:"group-header",id:`mcp-group-${h.scope}`,scope:h.scope,label:h.label,icon:h.icon,count:h.servers.length,isFirst:s,description:h.description,collapsed:g}),!g)for(let f of h.servers)r.push({type:"server-item",server:f});s=!1}let l=new Map(this.mcpRegistry.collections.get().map(h=>[h.id,h.source])),c=[],u=[],p=[];for(let h of o){let g=l.get(h.collection.id);h.collection.id.startsWith(GWi)?c.push(h):g instanceof hi&&!aIn(g)?u.push(h):p.push(h)}if(c.length>0){let h=this.collapsedGroups.has("plugin");if(r.push({type:"group-header",id:"mcp-group-plugin",scope:"plugin",label:d(7213,null),icon:bk,count:c.length,isFirst:s,description:d(7214,null),collapsed:h}),!h)for(let g of c)r.push({type:"builtin-item",id:`builtin-${g.definition.id}`,label:g.definition.label,description:"",collectionId:g.collection.id});s=!1}if(u.length>0){let h=this.collapsedGroups.has("extension");if(r.push({type:"group-header",id:"mcp-group-extension",scope:"extension",label:d(7193,null),icon:bbe,count:u.length,isFirst:s,description:d(7194,null),collapsed:h}),!h)for(let g of u)r.push({type:"builtin-item",id:`builtin-${g.definition.id}`,label:g.definition.label,description:"",collectionId:g.collection.id});s=!1}if(p.length>0){let h=this.collapsedGroups.has("builtin");if(r.push({type:"group-header",id:"mcp-group-builtin",scope:"builtin",label:d(7184,null),icon:bHe,count:p.length,isFirst:s,description:d(7185,null),collapsed:h}),!h)for(let g of p)r.push({type:"builtin-item",id:`builtin-${g.definition.id}`,label:g.definition.label,description:"",collectionId:g.collection.id});s=!1}this.displayEntries=r,this.list.splice(0,this.list.length,this.displayEntries),this.filteredBuiltinCount=o.length,this._onDidChangeItemCount.fire(this.itemCount)}get itemCount(){return this.filteredServers.length+this.filteredBuiltinCount}fireItemCount(){this._onDidChangeItemCount.fire(this.itemCount)}toggleGroup(e){this.collapsedGroups.has(e.scope)?this.collapsedGroups.delete(e.scope):this.collapsedGroups.add(e.scope),this.filterServers()}isInBrowseMode(){return this.browseMode}exitBrowseMode(){this.browseMode&&this.toggleBrowseMode(!1)}layout(e,t){this.lastHeight=e,this.lastWidth=t,this.element.style.height=`${e}px`;let o=this.searchAndButtonContainer.offsetHeight;if(o===0&&!this._layoutDeferred){this._layoutDeferred=!0,Me(this.element).requestAnimationFrame(()=>{try{this.layout(this.lastHeight,this.lastWidth)}finally{this._layoutDeferred=!1}});return}let n=this.sectionTitleHeader.offsetHeight;this.lastHeaderHeight=n;let r=Math.max(0,e-o-n);this.listContainer.style.height=`${r}px`,this.list.layout(r,t)}focusSearch(){this.searchInput.focus()}revealLastItem(){this.list.length>0&&this.list.reveal(this.list.length-1)}focus(){this.list.domFocus(),this.list.length>0&&this.list.setFocus([0])}onContextMenu(e){if(!e.element)return;if(e.element.type==="builtin-item"){let l=e.element.collectionId,c=RLo(l);if(!c)return;let u=this.agentPluginService.plugins.get().find(f=>f.uri.toString()===c);if(!u)return;let p=new O,h=p.add(new it("mcpServer.showPlugin",d(7218,null),void 0,!0,async()=>{let f={kind:"installed",name:u.label,description:u.fromMarketplace?.description??"",marketplace:u.fromMarketplace?.marketplace,plugin:u};this._onDidRequestShowPlugin.fire(f)})),g=p.add(new it("mcpServer.uninstallPlugin",d(7223,null),void 0,!0,async()=>{(await this.dialogService.confirm({message:d(7187,null,u.label),detail:d(7188,null),primaryButton:d(7224,null),type:"question"})).confirmed&&u.remove()}));this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>[h,g],onHide:()=>p.dispose()});return}if(e.element.type!=="server-item")return;let t=e.element,o=new O,n=this.mcpWorkbenchService.local.find(l=>l.id===t.server.id)||t.server,r=cct(n,!1,this.instantiationService),s=[];for(let l of r){for(let c of l)s.push(c),Sd(c)&&o.add(c);s.push(new oi)}s.length>0&&s[s.length-1]instanceof oi&&s.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,onHide:()=>o.dispose()})}};EHe=I([m(0,F),m(1,bf),m(2,Vs),m(3,xc),m(4,fe),m(5,Je),m(6,qn),m(7,Xe),m(8,ot),m(9,mm),m(10,ct),m(11,B)],EHe);function lIn(a,i,e){return[new it(`${e}.enable`,d(8350,null),void 0,!0,()=>(i.setEnabled(a,2),Promise.resolve())),new it(`${e}.enableForWorkspace`,d(8351,null),void 0,!0,()=>(i.setEnabled(a,3),Promise.resolve())),new it(`${e}.disable`,d(8348,null),void 0,!0,()=>(i.setEnabled(a,0),Promise.resolve())),new it(`${e}.disableForWorkspace`,d(8349,null),void 0,!0,()=>(i.setEnabled(a,1),Promise.resolve()))]}function LLo(a,i,e,t,o){let n=t.getWorkbenchState()!==1,[r,s,l,c]=lIn(i,e,o),u=[];return sR(a)?(u.push(r),n&&u.push(s)):(u.push(l),n&&u.push(c)),u}var u9=class extends it{constructor(i,e){super("agentPlugin.install",d(6686,null),"extension-action label prominent install",!0,()=>e.installPlugin({name:i.name,description:i.description,version:"",source:i.source,sourceDescriptor:i.sourceDescriptor,marketplace:i.marketplace,marketplaceReference:i.marketplaceReference,marketplaceType:i.marketplaceType,readmeUri:i.readmeUri}))}};u9=I([m(1,uI)],u9);var pct=class extends it{constructor(i){super("agentPlugin.uninstall",d(6689,null),"extension-action label uninstall",!0,()=>(i.remove(),Promise.resolve()))}},uct=class extends it{constructor(i,e,t){super("agentPlugin.openFolder",d(6687,null),void 0,!0,async()=>{try{await e.executeCommand("revealFileInOS",i.uri)}catch{await t.open(ai(i.uri))}})}};uct=I([m(1,fe),m(2,Je)],uct);var ybe=class extends it{constructor(i,e){super("agentPlugin.openReadme",d(6688,null),void 0,!0,()=>e.open(i))}};ybe=I([m(1,Je)],ybe);function mct(a,i){return i.invokeFunction(e=>{let t=e.get(mm),o=e.get(Ae),n=[];return n.push(LLo(a.enablement.get(),a.uri.toString(),t.enablementModel,o,"agentPlugin")),n.push([i.createInstance(uct,a),i.createInstance(ybe,Ve(a.uri,"README.md"))]),a.fromMarketplace&&n.push([new pct(a)]),n})}var THe=class extends it{get hidden(){return this._hidden}set hidden(i){this._hidden=i}constructor(i,e,t,o,n){super(i,e,t,o,n),this._hidden=!o}_setEnabled(i){super._setEnabled(i),this.hidden=!i}},_He=class extends it{constructor(e,t){super(e,void 0,"extension-action label action-dropdown");this.menuActionClassNames=["extension-action","label","action-dropdown"];this._menuActions=[];this._isHidden=!1;this._onDidChange=new T;this.subActions=t;for(let o of t)o.onDidChange(()=>this._updateDropdown());this._updateDropdown()}get menuActions(){return[...this._menuActions]}get isHidden(){return this._isHidden}get onDidChange(){return this._onDidChange.event}_updateDropdown(){let e=this.subActions.filter(o=>!o.hidden),t=e[0];this._menuActions=e.length>1?[...e]:[],t?(this._isHidden=!1,this.enabled=!0,this.label=t.label,this.tooltip=t.tooltip):(this._isHidden=!0,this.enabled=!1),this._onDidChange.fire({menuActions:this._menuActions})}async run(){await this.subActions.find(t=>!t.hidden)?.run()}dispose(){for(let e of this.subActions)e.dispose();super.dispose()}},U4t=class extends ZX{constructor(i,e,t){super(null,i,e,t),this._register(i.onDidChange(o=>{yo(o,{menuActions:!0})&&this.updateClass()}))}render(i){super.render(i),this.updateClass()}updateClass(){if(super.updateClass(),this.element&&this.dropdownMenuActionViewItem?.element){let i=this._action;this.element.classList.toggle("hide",i.isHidden);let e=i.menuActions.length===0;this.element.classList.toggle("empty",e),this.dropdownMenuActionViewItem.element.classList.toggle("hide",e)}}};function MLo(a,i,e){let t=a.uri.toString(),o=e.getWorkbenchState()!==1,n=new THe("agentPlugin.enable",d(6684,null),"extension-action label prominent",sR(a.enablement.get()),()=>(i.setEnabled(t,2),Promise.resolve())),r=new THe("agentPlugin.enableForWorkspace",d(6685,null),"extension-action label",sR(a.enablement.get())&&o,()=>(i.setEnabled(t,3),Promise.resolve()));return new _He("agentPlugin.enableDropdown",[n,r])}function PLo(a,i,e){let t=a.uri.toString(),o=e.getWorkbenchState()!==1,n=new THe("agentPlugin.disable",d(6682,null),"extension-action label disable",Xf(a.enablement.get()),()=>(i.setEnabled(t,0),Promise.resolve())),r=new THe("agentPlugin.disableForWorkspace",d(6683,null),"extension-action label disable",Xf(a.enablement.get())&&o,()=>(i.setEnabled(t,1),Promise.resolve()));return new _He("agentPlugin.disableDropdown",[n,r])}var Xc=_,cIn=36,jWi=class{getHeight(i){return i.type==="group-header"?i.isFirst?B4t:H4t:i.type==="marketplace-item"?62:cIn}getTemplateId(i){return i.type==="group-header"?"pluginGroupHeader":i.type==="marketplace-item"?"pluginMarketplaceItem":i.type==="remote-item"?"pluginRemoteItem":"pluginInstalledItem"}},QWi=class{constructor(i){this._harnessService=i;this.templateId="pluginInstalledItem"}renderTemplate(i){i.classList.add("mcp-server-item");let e=D(i,Xc(".item-sync-checkbox")),t=D(i,Xc(".mcp-server-icon"));t.classList.add(...q.asClassNameArray(bk));let o=D(i,Xc(".mcp-server-details")),n=D(o,Xc(".mcp-server-name")),r=D(o,Xc(".mcp-server-description"));return{container:i,syncCheckboxContainer:e,typeIcon:t,name:n,description:r,disposables:new O}}renderElement(i,e,t){t.disposables.clear(),t.name.textContent=C1(i.item.name),i.item.description?(t.description.textContent=o9(i.item.description),t.description.style.display=""):t.description.style.display="none",t.disposables.add(ve(n=>{let r=Xf(i.item.plugin.enablement.read(n));t.container.classList.toggle("disabled",!r)}));let o=this._harnessService.getActiveDescriptor().syncProvider;if(o){t.syncCheckboxContainer.style.display="";let n=i.item.plugin.uri,r=o.isDisabled(n),s=r?d(7243,null,i.item.name):d(7239,null,i.item.name),l=t.disposables.add(new qf(s,!r,Ag));t.syncCheckboxContainer.replaceChildren(l.domNode),t.disposables.add(l.onChange(()=>{o.setDisabled(n,!l.checked)}))}else t.syncCheckboxContainer.style.display="none",t.syncCheckboxContainer.replaceChildren()}disposeTemplate(i){i.disposables.dispose()}},YWi=class{constructor(){this.templateId="pluginRemoteItem"}renderTemplate(i){i.classList.add("mcp-server-item");let e=D(i,Xc(".mcp-server-icon"));e.classList.add(...q.asClassNameArray(bk));let t=D(i,Xc(".mcp-server-details")),o=D(t,Xc(".mcp-server-name")),n=D(o,Xc("span")),r=D(o,Xc(".inline-badge.item-badge")),s=D(t,Xc(".mcp-server-description")),l=D(i,Xc(".mcp-server-status"));return{container:i,typeIcon:e,name:n,badge:r,description:s,status:l}}renderElement(i,e,t){if(t.name.textContent=C1(i.item.name),i.item.badge?(t.badge.textContent=i.item.badge,t.badge.style.display="",t.badge.title=i.item.badgeTooltip??""):(t.badge.textContent="",t.badge.style.display="none",t.badge.title=""),i.item.description?(t.description.textContent=o9(i.item.description),t.description.style.display=""):(t.description.textContent="",t.description.style.display="none"),t.container.classList.toggle("disabled",i.item.enabled===!1),t.status.className="mcp-server-status",i.item.enabled===!1){t.status.textContent=d(7271,null),t.status.classList.add("disabled");return}switch(i.item.status){case"loading":t.status.textContent=d(7274,null),t.status.classList.add("running");break;case"loaded":t.status.textContent=d(7273,null),t.status.classList.add("running");break;case"degraded":t.status.textContent=d(7270,null),t.status.classList.add("disabled");break;case"error":t.status.textContent=d(7272,null),t.status.classList.add("disabled");break;default:t.status.textContent="";break}}disposeTemplate(i){}},XWi=class{constructor(i,e){this.pluginInstallService=i;this.agentPluginService=e;this.templateId="pluginMarketplaceItem"}renderTemplate(i){i.classList.add("mcp-server-item","mcp-gallery-item","extension-list-item");let e=D(i,Xc(".details")),t=D(e,Xc(".header-container")),o=D(t,Xc(".header")),n=D(o,Xc("span.name")),r=D(e,Xc(".description.ellipsis")),s=D(e,Xc(".publisher-container")),l=D(s,Xc("span.publisher-name.mcp-gallery-publisher")),c=D(i,Xc(".mcp-gallery-action")),u=new Pi(c,{...Ro,supportIcons:!0});u.element.classList.add("mcp-gallery-install-button");let p=new O;return p.add(u),{container:i,name:n,publisher:l,description:r,installButton:u,elementDisposables:new O,templateDisposables:p}}renderElement(i,e,t){t.elementDisposables.clear(),t.name.textContent=i.item.name,t.publisher.textContent=i.item.marketplace?d(7234,null,i.item.marketplace):"",t.description.textContent=i.item.description||"";let o=this.pluginInstallService.getPluginInstallUri({name:i.item.name,description:i.item.description,version:"",sourceDescriptor:i.item.sourceDescriptor,source:i.item.source,marketplace:i.item.marketplace,marketplaceReference:i.item.marketplaceReference,marketplaceType:i.item.marketplaceType});if(this.agentPluginService.plugins.get().some(r=>ze(r.uri,o))){t.installButton.label=d(7246,null),t.installButton.enabled=!1;return}t.installButton.label=d(7245,null),t.installButton.enabled=!0,t.elementDisposables.add(t.installButton.onDidClick(async()=>{t.installButton.label=d(7248,null),t.installButton.enabled=!1;try{await this.pluginInstallService.installPlugin({name:i.item.name,description:i.item.description,version:"",sourceDescriptor:i.item.sourceDescriptor,source:i.item.source,marketplace:i.item.marketplace,marketplaceReference:i.item.marketplaceReference,marketplaceType:i.item.marketplaceType,readmeUri:i.item.readmeUri}),t.installButton.label=d(7246,null)}catch{t.installButton.label=d(7245,null),t.installButton.enabled=!0}}))}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposables.dispose()}};function dIn(a,i){let e=a.label||Be(a.uri),t=a.fromMarketplace?.description??i.getUriLabel(ai(a.uri),{relative:!0}),o=a.fromMarketplace?.marketplace;return{kind:"installed",name:e,description:t,marketplace:o,plugin:a}}function uIn(a){return{kind:"marketplace",name:a.name,description:a.description,source:a.source,sourceDescriptor:a.sourceDescriptor,marketplace:a.marketplace,marketplaceReference:a.marketplaceReference,marketplaceType:a.marketplaceType,readmeUri:a.readmeUri}}var DHe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.instantiationService=e;this.agentPluginService=t;this.pluginMarketplaceService=o;this.pluginInstallService=n;this.openerService=r;this.contextViewService=s;this.contextMenuService=l;this.hoverService=c;this.labelService=u;this.commandService=p;this.harnessService=h;this.configurationService=g;this._onDidSelectPlugin=this._register(new T);this.onDidSelectPlugin=this._onDidSelectPlugin.event;this._onDidChangeItemCount=this._register(new T);this.onDidChangeItemCount=this._onDidChangeItemCount.event;this.disabledLinkListener=this._register(new ue);this.addDropdownActions=this._register(new O);this.installedItems=[];this.remoteItems=[];this.displayEntries=[];this.marketplaceItems=[];this.searchQuery="";this.browseMode=!1;this.lastHeight=0;this.lastWidth=0;this.lastHeaderHeight=0;this._layoutDeferred=!1;this.collapsedGroups=new Set;this.delayedFilter=new rn(200);this.delayedMarketplaceSearch=new rn(400);this.element=Xc(".mcp-list-widget"),this.create(),this.updateAccessState(),this._register(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration("chat.plugins.enabled")&&this.updateAccessState()})),this._register({dispose:()=>{this.marketplaceCts?.dispose()}})}create(){this.sectionTitleHeader=D(this.element,Xc(".section-title-header"));let e=D(this.sectionTitleHeader,Xc(".section-title-row")),t=D(e,Xc("h2.section-title"));t.textContent=d(7261,null);let o=D(this.sectionTitleHeader,Xc("p.section-title-description")),n=D(o,Xc("span.section-title-description-text"));n.textContent=d(7262,null),o.appendChild(document.createTextNode(" ")),this.sectionLink=D(o,Xc("a.section-title-link")),this.sectionLink.textContent=d(7249,null),this.sectionLink.href="https://code.visualstudio.com/docs/copilot/customization/agent-plugins",this._register($(this.sectionLink,"click",N=>{N.preventDefault();let V=this.sectionLink.href;V&&this.openerService.open(A.parse(V))}));let r=Me(this.element),s=this._register(new zu("PluginListWidget.sectionTitleHeader",()=>{this.lastWidth<=0||this.lastHeight<=0||this.sectionTitleHeader.offsetHeight===this.lastHeaderHeight||this.layout(this.lastHeight,this.lastWidth)},r));this._register(s.observe(this.sectionTitleHeader)),this.searchAndButtonContainer=D(this.element,Xc(".list-search-and-button-container"));let l=D(this.searchAndButtonContainer,Xc(".list-search-container"));this.searchInput=this._register(new ad(l,this.contextViewService,{placeholder:d(7276,null),inputBoxStyles:Wl})),this._register(this.searchInput.onDidChange(()=>{this.searchQuery=this.searchInput.value,this.browseMode?this.delayedMarketplaceSearch.trigger(()=>this.queryMarketplace()):this.delayedFilter.trigger(()=>this.filterPlugins())})),this.buttonContainer=D(this.searchAndButtonContainer,Xc(".list-button-group"));let c=D(this.buttonContainer,Xc(".list-add-button-container")),u=d(7231,null);this.browseButton=this._register(new Pi(c,{...Ro,secondary:!0,supportIcons:!0,title:u,ariaLabel:u})),this.browseButton.element.classList.add("list-add-button"),this._register(this.browseButton.onDidClick(()=>this.runPrimaryButtonAction())),this.addButtonContainer=D(this.buttonContainer,Xc(".list-add-button-container"));let p=d(7229,null);this.addButtonSimple=this._register(new Pi(this.addButtonContainer,{...Ro,secondary:!0,supportIcons:!0,title:p,ariaLabel:p})),this.addButtonSimple.element.classList.add("list-add-button"),this._register(this.addButtonSimple.onDidClick(()=>this.runPrimaryAddAction())),this.addButton=this._register(new Jv(this.addButtonContainer,{...Ro,secondary:!0,supportIcons:!0,contextMenuProvider:this.contextMenuService,addPrimaryActionToDropdown:!1,actions:{getActions:()=>this.getAddDropdownActions()},title:p,ariaLabel:p})),this.addButton.element.classList.add("list-add-button"),this._register(this.addButton.onDidClick(()=>this.runPrimaryAddAction()));let h=d(7236,null);this.createPluginButton=this._register(new Pi(this.buttonContainer,{...Ro,secondary:!0,supportIcons:!0,title:h,ariaLabel:h})),this.createPluginButton.element.classList.add("list-icon-button"),this.createPluginButton.label=`$(${L.newFile.id})`,this._register(this.createPluginButton.onDidClick(()=>this.runCreatePluginAction())),this.emptyContainer=D(this.element,Xc(".mcp-empty-state"));let g=D(this.emptyContainer,Xc(".empty-state-header"));D(g,Xc(".empty-icon")).classList.add(...q.asClassNameArray(bk)),this.emptyText=D(g,Xc(".empty-text")),this.emptySubtext=D(this.emptyContainer,Xc(".empty-subtext")),this.disabledContainer=D(this.element,Xc(".mcp-disabled-state"));let v=D(this.disabledContainer,Xc(".empty-state-header"));this.disabledIcon=D(v,Xc(".empty-icon"));let b=D(v,Xc(".empty-text"));b.textContent=d(7266,null),this.disabledMessage=D(this.disabledContainer,Xc(".empty-subtext")),this.listContainer=D(this.element,Xc(".mcp-list-container"));let S=new jWi,y=new kHe("pluginGroupHeader",this.hoverService),w=new QWi(this.harnessService),x=new YWi,E=new XWi(this.pluginInstallService,this.agentPluginService);this.list=this._register(this.instantiationService.createInstance(bc,"PluginManagementList",this.listContainer,S,[y,w,x,E],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(N){if(N.type==="group-header")return d(7257,null,N.label,N.count,N.collapsed?d(7235,null):d(7244,null));let V=C1(N.item.name),H=N.item.description?o9(N.item.description):void 0,K=H?d(7260,null,V,H):V;return N.type==="plugin-item"?Xf(N.item.plugin.enablement.get())?d(7259,null,K):d(7258,null,K):K},getWidgetAriaLabel(){return d(7267,null)}},openOnSingleClick:!0,identityProvider:{getId(N){return N.type==="group-header"?N.id:N.type==="marketplace-item"?`marketplace-${N.item.marketplaceReference.canonicalId}/${N.item.source}`:N.type==="remote-item"?N.item.itemKey??`remote-${N.item.groupKey??"default"}-${N.item.uri.toString()}`:N.item.plugin.uri.toString()}}})),this._register(this.list.onDidOpen(N=>{N.element&&(N.element.type==="group-header"?this.toggleGroup(N.element):N.element.type==="plugin-item"?this._onDidSelectPlugin.fire(N.element.item):N.element.type==="remote-item"||N.element.type==="marketplace-item"&&this._onDidSelectPlugin.fire(N.element.item))})),this._register(this.list.onContextMenu(N=>this.onContextMenu(N))),this._register(ve(N=>{let V=this.agentPluginService.plugins.read(N);for(let H of V)H.enablement.read(N);this.browseMode||this.refresh()})),this._register(this.pluginMarketplaceService.onDidChangeMarketplaces(()=>{this.browseMode||this.refresh()})),this._register(ve(N=>{this.harnessService.activeHarness.read(N),this.updateToolbarActions(),this.browseMode||this.refresh()}));let M=this._register(new ue);this._register(ve(N=>{this.harnessService.activeHarness.read(N);let V=this.harnessService.getActiveDescriptor().itemProvider;V?M.value=V.onDidChange(()=>{this.browseMode||this.refresh()}):M.clear()})),this.updateToolbarActions(),this.refresh()}async refresh(){this.browseMode?await this.queryMarketplace():this.filterPlugins()}updateAccessState(){let e=this.configurationService.inspect("chat.plugins.enabled"),o=(e.value??e.defaultValue)===!1,n=e.policyValue===!1;if(this.element.classList.toggle("access-disabled",o),o)if(this.disabledIcon.className="empty-icon",this.disabledIcon.classList.add(...q.asClassNameArray(n?L.shield:bk)),St(this.disabledMessage),this.disabledLinkListener.clear(),n)this.disabledMessage.textContent=d(7263,null);else{this.disabledMessage.appendChild(document.createTextNode(d(7264,null)));let r=D(this.disabledMessage,Xc("a.mcp-disabled-settings-link"));r.textContent=d(7265,null),r.href="#",r.setAttribute("role","button"),this.disabledLinkListener.value=$(r,"click",s=>{s.preventDefault(),this.commandService.executeCommand("workbench.action.openSettings","@id:chat.plugins.enabled")})}}get pluginActions(){return this.harnessService.getActiveDescriptor().pluginActions??[]}formatActionLabel(e,t=!1){return e.icon?t?`$(${e.icon.id})`:`$(${e.icon.id}) ${e.label}`:e.label}updateToolbarActions(){let e=this.isBrowseMarketplaceAvailable();!e&&this.browseMode&&this.toggleBrowseMode(!1),this.browseButton.element.parentElement.style.display=this.browseMode?"none":"",this.browseButton.label=`$(${L.library.id}) ${d(7231,null)}`,this.browseButton.enabled=e;let t=e?d(7231,null):d(7232,null);this.browseButton.setTitle(t),this.browseButton.element.setAttribute("aria-label",t),this.updateAddButton(),this.createPluginButton.enabled=!0}isBrowseMarketplaceAvailable(){return!Ft}updateAddButton(){let e=this.buildAddActions(),[t,...o]=e,n=o.length>0;if(this.addButton.element.style.display=n?"":"none",this.addButtonSimple.element.style.display=n?"none":"",!t){this.addButton.element.style.display="none",this.addButtonSimple.element.style.display="none";return}if(n){this.addButton.label=this.formatActionLabel(t),this.addButton.enabled=t.enabled!==!1;let r=t.tooltip??t.label;this.addButton.primaryButton.setTitle(r),this.addButton.primaryButton.element.setAttribute("aria-label",r);let s=d(7252,null);this.addButton.dropdownButton.setTitle(s),this.addButton.dropdownButton.element.setAttribute("aria-label",s)}else{this.addButtonSimple.label=this.formatActionLabel(t),this.addButtonSimple.enabled=t.enabled!==!1;let r=t.tooltip??t.label;this.addButtonSimple.setTitle(r),this.addButtonSimple.element.setAttribute("aria-label",r)}}buildAddActions(){return[...this.pluginActions,{id:"plugin.installFromSource",label:d(7247,null),tooltip:d(7247,null),icon:L.add,run:()=>this.commandService.executeCommand("workbench.action.chat.installPluginFromSource")}]}getAddDropdownActions(){return this.addDropdownActions.clear(),this.buildAddActions().slice(1).map((e,t)=>this.addDropdownActions.add(new it(`plugin_add_${t}`,this.formatActionLabel(e),void 0,e.enabled!==!1,()=>this.runPluginAction(e))))}async runPrimaryButtonAction(){this.isBrowseMarketplaceAvailable()&&this.toggleBrowseMode(!this.browseMode)}async runPrimaryAddAction(){let[e]=this.buildAddActions();e&&await this.runPluginAction(e)}async runCreatePluginAction(){await this.commandService.executeCommand("workbench.action.chat.createPlugin")}async runPluginAction(e){e.enabled!==!1&&await e.run()}showBrowseMarketplace(){this.isBrowseMarketplaceAvailable()&&(this.browseMode||this.toggleBrowseMode(!0))}toggleBrowseMode(e){this.browseMode=e,this.searchInput.value="",this.searchQuery="",this.browseButton.element.parentElement.style.display=e?"none":"",this.searchInput.setPlaceHolder(e?d(7275,null):d(7276,null)),e?this.queryMarketplace():(this.marketplaceCts?.dispose(!0),this.marketplaceItems=[],this.filterPlugins()),this.lastHeight>0&&this.layout(this.lastHeight,this.lastWidth)}async queryMarketplace(){this.marketplaceCts?.dispose(!0);let e=this.marketplaceCts=new qe;this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(7250,null),this.emptySubtext.textContent="";try{let t=await this.pluginMarketplaceService.fetchMarketplacePlugins(e.token);if(e.token.isCancellationRequested)return;let o=this.searchQuery.toLowerCase().trim(),n=o?t.filter(s=>s.name.toLowerCase().includes(o)||s.description.toLowerCase().includes(o)):t,r=new Set(this.agentPluginService.plugins.get().map(s=>s.uri.toString()));this.marketplaceItems=n.filter(s=>{let l=this.pluginInstallService.getPluginInstallUri(s);return!r.has(l.toString())}).map(uIn),this.updateMarketplaceList()}catch{e.token.isCancellationRequested||(this.marketplaceItems=[],this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.emptyText.textContent=d(7251,null),this.emptySubtext.textContent=d(7277,null))}}updateMarketplaceList(){this.marketplaceItems.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(7253,null,this.searchQuery),this.emptySubtext.textContent=d(7278,null)):(this.emptyText.textContent=d(7240,null),this.emptySubtext.textContent="")):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let e=this.marketplaceItems.map(t=>({type:"marketplace-item",item:t}));this.list.splice(0,this.list.length,e)}async getRemotePluginItems(e){let t=this.harnessService.getActiveDescriptor().itemProvider;if(!t)return[];try{return(await t.provideChatSessionCustomizations(Ie.None)??[]).filter(n=>iAt(n)&&(!e||n.name.toLowerCase().includes(e)||n.description?.toLowerCase().includes(e)||n.badge?.toLowerCase().includes(e)))}catch{return[]}}getRemoteGroupMetadata(e){return{group:e??"remote-host",label:d(7268,null),description:d(7269,null)}}appendGroup(e,t,o,n){if(o.length===0)return n;let r=this.collapsedGroups.has(t.group);return e.push({type:"group-header",id:`plugin-group-${t.group}`,group:t.group,label:t.label,icon:bk,count:o.length,isFirst:n,description:t.description,collapsed:r}),r||e.push(...o),!1}async filterPlugins(){let e=this.searchQuery.toLowerCase().trim(),t=this.agentPluginService.plugins.get();this.remoteItems=[...await this.getRemotePluginItems(e)],this.installedItems=t.map(u=>dIn(u,this.labelService)).filter(u=>!e||u.name.toLowerCase().includes(e)||u.description.toLowerCase().includes(e)),this.remoteItems.length===0&&this.installedItems.length===0?(this.emptyContainer.style.display="flex",this.listContainer.style.display="none",this.searchQuery.trim()?(this.emptyText.textContent=d(7254,null,this.searchQuery),this.emptySubtext.textContent=d(7278,null)):this.harnessService.getActiveDescriptor().itemProvider?(this.emptyText.textContent=d(7256,null),this.emptySubtext.textContent=d(7230,null)):(this.emptyText.textContent=d(7255,null),this.emptySubtext.textContent=d(7233,null))):(this.emptyContainer.style.display="none",this.listContainer.style.display="");let o=this.installedItems.filter(u=>Xf(u.plugin.enablement.get())),n=this.installedItems.filter(u=>!Xf(u.plugin.enablement.get())),r=[],s=!0,l=new Set(this.installedItems.map(u=>u.name.toLowerCase())),c=new Map;for(let u of this.remoteItems){let p=u.groupKey??"remote-host";if(p==="remote-client"||u.name&&l.has(u.name.toLowerCase()))continue;let h=c.get(p);h||(h=[],c.set(p,h)),h.push({type:"remote-item",item:u})}for(let[u,p]of c)s=this.appendGroup(r,this.getRemoteGroupMetadata(u),p,s);o.length>0&&(s=this.appendGroup(r,{group:"enabled",label:d(7241,null),description:d(7242,null)},o.map(u=>({type:"plugin-item",item:u})),s)),n.length>0&&this.appendGroup(r,{group:"disabled",label:d(7237,null),description:d(7238,null)},n.map(u=>({type:"plugin-item",item:u})),s),this.displayEntries=r,this.list.splice(0,this.list.length,this.displayEntries),this._onDidChangeItemCount.fire(this.itemCount)}get itemCount(){let e=new Set(this.installedItems.map(o=>o.name.toLowerCase()));return this.remoteItems.filter(o=>!(o.groupKey==="remote-client"||o.name&&e.has(o.name.toLowerCase()))).length+this.installedItems.length}fireItemCount(){this._onDidChangeItemCount.fire(this.itemCount)}toggleGroup(e){this.collapsedGroups.has(e.group)?this.collapsedGroups.delete(e.group):this.collapsedGroups.add(e.group),this.filterPlugins()}isInBrowseMode(){return this.browseMode}exitBrowseMode(){this.browseMode&&this.toggleBrowseMode(!1)}layout(e,t){this.lastHeight=e,this.lastWidth=t,this.element.style.height=`${e}px`;let o=this.searchAndButtonContainer.offsetHeight;if(o===0&&!this._layoutDeferred){this._layoutDeferred=!0,Me(this.element).requestAnimationFrame(()=>{try{this.layout(this.lastHeight,this.lastWidth)}finally{this._layoutDeferred=!1}});return}let n=this.sectionTitleHeader.offsetHeight;this.lastHeaderHeight=n;let r=Math.max(0,e-o-n);this.listContainer.style.height=`${r}px`,this.list.layout(r,t)}focusSearch(){this.searchInput.focus()}revealLastItem(){this.list.length>0&&this.list.reveal(this.list.length-1)}focus(){this.list.domFocus(),this.list.length>0&&this.list.setFocus([0])}onContextMenu(e){if(!e.element||e.element.type==="group-header"||e.element.type==="marketplace-item")return;let t=e.element,o=new O,n=[];if(t.type==="plugin-item"){let r=mct(t.item.plugin,this.instantiationService);for(let s of r){for(let l of s)n.push(l),Sd(l)&&o.add(l);n.push(new oi)}n.length>0&&n[n.length-1]instanceof oi&&n.pop()}else{let r=t.item.actions??[];for(let s of r)n.push(new it(s.id,s.label,s.icon?q.asClassName(s.icon):void 0,s.enabled!==!1,()=>s.run()))}this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>n,onHide:()=>o.dispose()})}};DHe=I([m(0,F),m(1,mm),m(2,jC),m(3,uI),m(4,Je),m(5,qn),m(6,Xe),m(7,ot),m(8,nt),m(9,fe),m(10,dh),m(11,B)],DHe);var z4t=class{constructor(i,e,t,o,n,r,s){this.commandService=i;this.chatService=e;this.chatWidgetService=t;this.workspaceService=o;this.promptsService=n;this.quickInputService=r;this.harnessService=s}async createWithAI(i){let e=hIn(i),t=await this.quickInputService.input({prompt:d(7168,null,e),placeHolder:d(7169,null,e),validateInput:async u=>{if(!u||!u.trim())return d(7170,null)}});if(!t)return;let o=t.trim(),n=await this.resolveTargetDirectoryWithPicker(i);if(n===null)return;let r=pIn(i,n,o),s=mIn(i,n,o);await this.commandService.executeCommand("workbench.action.chat.newChat");let c=this.chatWidgetService.lastFocusedWidget?.viewModel?.sessionResource;c&&await this.chatService.sendRequest(c,s,{modeInfo:{kind:"agent",isBuiltin:!1,modeId:"custom",applyCodeBlockSuggestionId:void 0,modeInstructions:{name:"customization-creator",content:r,toolReferences:[]}}})}resolveTargetDirectory(i){return JWi(this.workspaceService,i)}async resolveTargetDirectoryWithPicker(i){let e=await this.promptsService.getSourceFolders(i),t=this.workspaceService.getActiveProjectRoot(),n=this.harnessService.getActiveDescriptor().workspaceSubpaths,r=new Set,s=t?e.filter(u=>{if(!Yr(u.uri,t))return!1;let p=u.uri.toString();return r.has(p)?!1:(r.add(p),n?SDe(u.uri.path,n):!0)}):[];if(s.length===0)return this.resolveTargetDirectory(i);if(s.length===1)return s[0].uri;let l=s.map(u=>({label:this.promptsService.getPromptLocationLabel(u),description:u.uri.fsPath,uri:u.uri}));return(await this.quickInputService.pick(l,{placeHolder:d(7171,null)}))?.uri??null}async resolveUserDirectory(i){return ZWi(this.promptsService,i)}};z4t=I([m(0,fe),m(1,si),m(2,Lt),m(3,WM),m(4,jr),m(5,$e),m(6,dh)],z4t);function JWi(a,i){let e=a.getActiveProjectRoot();if(!e)return;let o=uDe(i).find(n=>n.storage==="local");return o?A.joinPath(e,o.path):e}async function ZWi(a,i){return(await a.getSourceFolders(i)).find(o=>o.storage==="user")?.uri}function pIn(a,i,e){let o=`

CRITICAL WORKFLOW:
- In your VERY FIRST response, you MUST immediately create the file on disk from a starter template with placeholder content. Do not ask questions first -- write the file first so it appears in the diff view, then ask the user how they want to customize it.
- Every subsequent message from the user should result in you updating that same file on disk with the requested changes.
- Always write the complete file content, not partial diffs.${i?`
IMPORTANT: Save the file to this directory: ${i.fsPath}. The name is "${e}".`:`
The name is "${e}".`}`;switch(a){case"agent":return`You are a helpful assistant that guides users through creating a new custom AI agent.${o}

Create a file named "${e}.agent.md" with YAML frontmatter (name, description, tools) and system instructions. Ask the user what it should do.`;case"skill":return`You are a helpful assistant that guides users through creating a new skill.${o}

Create a directory named "${e}" with a SKILL.md file inside it. The file should have YAML frontmatter (name, description) and instructions. Ask the user what it does.`;case"instructions":return`You are a helpful assistant that guides users through creating a new instructions file.${o}

Create a file named "${e}.instructions.md" with YAML frontmatter (description, optional applyTo) and actionable content. Ask the user what it should cover.`;case"prompt":return`You are a helpful assistant that guides users through creating a new reusable prompt.${o}

Create a file named "${e}.prompt.md" with YAML frontmatter (name, description) and prompt content. Ask the user what it should do.`;case"hook":return`You are a helpful assistant that guides users through creating a new hook.${o}

Ask the user when the hook should trigger and what it should do, then write the configuration file.`;default:return`You are a helpful assistant that guides users through creating a new AI customization file.${o}

Ask the user what they want to create, then guide them step by step.`}}function mIn(a,i,e){let t=i?` Write it to \`${i.fsPath}\`.`:"";switch(a){case"agent":return`Help me create a new custom agent called "${e}".${t}`;case"skill":return`Help me create a new skill called "${e}".${t}`;case"instructions":return`Help me create new instructions called "${e}".${t}`;case"prompt":return`Help me create a new prompt called "${e}".${t}`;case"hook":return`Help me create a new hook called "${e}".${t}`;default:return`Help me create a new customization called "${e}".${t}`}}function hIn(a){switch(a){case"agent":return"agent";case"skill":return"skill";case"instructions":return"instructions";case"prompt":return"prompt";case"hook":return"hook";default:return"customization"}}var fre=_,RHe=class extends k{constructor(e,t){super();this.mcpWorkbenchService=t;this.root=D(e,fre(".ai-customization-embedded-detail.embedded-mcp-detail"));let o=D(this.root,fre(".embedded-detail-header"));this.iconEl=D(o,fre(".embedded-detail-icon"));let n=D(o,fre(".embedded-detail-header-text"));this.nameEl=D(n,fre("h2.embedded-detail-name")),this.nameEl.setAttribute("role","heading"),this.scopeEl=D(n,fre(".embedded-detail-scope")),this.descriptionEl=D(this.root,fre(".embedded-detail-description")),this.emptyEl=D(this.root,fre(".embedded-detail-empty")),this.emptyEl.textContent=d(7177,null),this._register(this.mcpWorkbenchService.onChange(r=>{this.current&&r&&r.id===this.current.id&&(this.current=r,this.renderItem())})),this.renderItem()}get element(){return this.root}setInput(e){this.current=e,this.renderItem()}clearInput(){this.current=void 0,this.renderItem()}renderItem(){let e=this.current,t=!!e;if(this.emptyEl.style.display=t?"none":"",this.root.classList.toggle("is-empty",!t),!e){this.nameEl.textContent="",this.scopeEl.textContent="",this.descriptionEl.textContent="",this.iconEl.className="embedded-detail-icon";return}this.nameEl.textContent=e.label||e.name,this.iconEl.className=`embedded-detail-icon ${e.codicon?`codicon ${e.codicon}`:q.asClassName(nct)}`;let o=e.local?.scope,n=gIn(o);if(n){let s=_(`span.codicon.codicon-${n.icon.id}`);this.scopeEl.replaceChildren(s,document.createTextNode(" "+n.label)),this.scopeEl.style.display=""}else this.scopeEl.replaceChildren(),this.scopeEl.style.display="none";let r=(e.description||"").trim();this.descriptionEl.textContent=r,this.descriptionEl.style.display=r?"":"none"}};RHe=I([m(1,bf)],RHe);function gIn(a){switch(a){case"workspace":return{label:d(7179,null),icon:cre};case"user":case"remoteUser":return{label:d(7178,null),icon:dre};default:return}}var p9=_,K4t=class extends k{constructor(i){super(),this.root=D(i,p9(".ai-customization-embedded-detail.embedded-plugin-detail"));let e=D(this.root,p9(".embedded-detail-header"));this.iconEl=D(e,p9(".embedded-detail-icon"));let t=D(e,p9(".embedded-detail-header-text"));this.nameEl=D(t,p9("h2.embedded-detail-name")),this.nameEl.setAttribute("role","heading"),this.sourceEl=D(t,p9(".embedded-detail-scope")),this.descriptionEl=D(this.root,p9(".embedded-detail-description")),this.emptyEl=D(this.root,p9(".embedded-detail-empty")),this.emptyEl.textContent=d(7172,null),this.renderItem()}get element(){return this.root}setInput(i){this.current=i,this.renderItem()}clearInput(){this.current=void 0,this.renderItem()}renderItem(){let i=this.current,e=!!i;if(this.emptyEl.style.display=e?"none":"",this.root.classList.toggle("is-empty",!e),!i){this.nameEl.textContent="",this.sourceEl.textContent="",this.descriptionEl.textContent="",this.iconEl.className="embedded-detail-icon";return}this.nameEl.textContent=i.name;let t=i.kind==="marketplace",o=t?bbe.id:bk.id;this.iconEl.className=`embedded-detail-icon codicon codicon-${o}`;let n=i.marketplace?t?d(7175,null,i.marketplace):d(7173,null,i.marketplace):t?d(7176,null):d(7174,null),r=p9(`span.codicon.codicon-${o}`);this.sourceEl.replaceChildren(r,document.createTextNode(" "+n));let s=(i.description||"").trim();this.descriptionEl.textContent=s,this.descriptionEl.style.display=s?"":"none"}};var vS=_,G4t=class extends k{constructor(e,t,o,n,r,s){super();this.welcomePageFeatures=t;this.callbacks=o;this.workspaceService=r;this.hoverService=s;this.cardDisposables=this._register(new O);this.categoryDescriptions=[{id:pn.Agents,label:d(7143,null),icon:gbe,description:d(7144,null),promptType:"agent"},{id:pn.Skills,label:d(7160,null),icon:fbe,description:d(7161,null),promptType:"skill"},{id:pn.Instructions,label:d(7151,null),icon:w1,description:d(7152,null),promptType:"instructions"},{id:pn.Hooks,label:d(7149,null),icon:vbe,description:d(7150,null),promptType:"hook"},{id:pn.McpServers,label:d(7153,null),icon:L.server,description:d(7154,null)},{id:pn.Plugins,label:d(7157,null),icon:bk,description:d(7158,null)}];this.container=vS(".welcome-prompts-content-container"),this.scrollable=this._register(new Ar(this.container,{horizontal:2,vertical:1,useShadows:!1}));let l=this.scrollable.getDomNode();l.classList.add("welcome-prompts-scrollable"),e.appendChild(l);let c=this._register(new zu("AICustomizationWelcomePagePromptLaunchers.scrollable",()=>this.scrollable.scanDomNode()));this._register(c.observe(l));let u=D(this.container,vS(".welcome-prompts-inner")),p=D(u,vS("h2.welcome-prompts-heading"));p.textContent=d(7162,null);let h=D(u,vS("p.welcome-prompts-subtitle"));if(h.textContent=d(7163,null),this.welcomePageFeatures?.showGettingStartedBanner!==!1){let g=D(u,vS(".welcome-prompts-primary")),f=D(g,vS(".welcome-prompts-section-label"));D(f,vS("span.welcome-prompts-section-label-icon.codicon.codicon-sparkle")).setAttribute("aria-hidden","true");let b=D(f,vS("span"));b.textContent=d(7148,null);let S=D(g,vS("p.welcome-prompts-input-helper"));S.textContent=d(7147,null);let y=D(g,vS(".welcome-prompts-input-row"));this.inputRow=y,this.inputElement=D(y,vS("input.welcome-prompts-input")),this.inputElement.type="text",this.inputElement.placeholder=d(7165,null),this.inputElement.setAttribute("aria-label",d(7164,null));let w=D(y,vS("button.welcome-prompts-input-submit"));this.submitBtn=w,w.setAttribute("aria-label",d(7166,null)),this._register(this.hoverService.setupManagedHover(yi("element"),w,d(7167,null))),D(w,vS("span.codicon.codicon-arrow-up")).setAttribute("aria-hidden","true");let E=()=>{let N=!!this.inputElement?.value?.trim();w.disabled=!N,w.classList.toggle("welcome-prompts-input-submit-disabled",!N)},M=()=>{let N=this.inputElement?.value?.trim();if(!N)return;let V;this.workspaceService.isSessionsWindow?V=`Generate agent customizations. ${N}`:V=`/init ${N}`,this.inputElement&&(this.inputElement.value=""),E(),y.classList.add("sent"),w.style.display="none",this.sentLabel&&this.sentLabel.remove(),this.sentLabel=D(y,vS("span.welcome-prompts-sent-label")),this.sentLabel.textContent=d(7159,null),this.callbacks.prefillChat(V,{isPartialQuery:!1,newChat:!0})};this._register($(w,"click",N=>{N.stopPropagation(),M()})),this._register($(this.inputElement,"keydown",N=>{N.key==="Enter"&&(N.preventDefault(),M())})),this._register($(this.inputElement,"input",()=>{E(),this._clearSentState()})),E()}this.cardsContainer=D(u,vS(".welcome-prompts-cards"))}_clearSentState(){this.sentLabel&&(this.sentLabel.remove(),this.sentLabel=void 0),this.submitBtn&&(this.submitBtn.style.display=""),this.inputRow&&this.inputRow.classList.remove("sent")}reset(){this._clearSentState()}rebuildCards(e){if(this.cardsContainer){this.cardDisposables.clear(),St(this.cardsContainer),this.firstCard=void 0;for(let t of this.categoryDescriptions){if(!e.has(t.id))continue;let o=D(this.cardsContainer,vS(".welcome-prompts-card"));o.setAttribute("tabindex","0"),o.setAttribute("role","button"),this.firstCard||(this.firstCard=o);let n=D(o,vS(".welcome-prompts-card-header"));D(n,vS(".welcome-prompts-card-icon")).classList.add(...q.asClassNameArray(t.icon));let s=D(n,vS("span.welcome-prompts-card-label"));s.textContent=t.label;let l=D(o,vS("p.welcome-prompts-card-description"));l.textContent=t.description;let c=D(o,vS(".welcome-prompts-card-footer"));if(t.promptType){let u=D(c,vS("button.welcome-prompts-card-action"));u.textContent=d(7155,null),u.setAttribute("aria-label",d(7156,null,t.label)),this.cardDisposables.add($(u,"click",p=>{if(p.stopPropagation(),this.callbacks.closeEditor(),this.workspaceService.isSessionsWindow){let h=t.label.toLowerCase().replace(/s$/,"");this.callbacks.prefillChat(`Create me a custom ${h} that `,{isPartialQuery:!0,newChat:!0})}else this.workspaceService.generateCustomization(t.promptType)}))}else{let u=D(c,vS("button.welcome-prompts-card-action"));u.textContent=d(7145,null),u.setAttribute("aria-label",d(7146,null,t.label)),this.cardDisposables.add($(u,"click",p=>{p.stopPropagation(),this.callbacks.selectSectionWithMarketplace(t.id)}))}this.cardDisposables.add($(o,"click",()=>{this.callbacks.selectSection(t.id)})),this.cardDisposables.add($(o,"keydown",u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),this.callbacks.selectSection(t.id))}))}this.scrollable.scanDomNode()}}focus(){if(this.inputElement){this.inputElement.focus();return}this.firstCard?.focus()}};var fIn=_,q4t=class extends k{constructor(i,e,t,o,n,r){super(),this.container=D(i,fIn(".welcome-page-host")),this.container.style.height="100%",this.container.style.overflow="hidden",this.implementation=this._register(new G4t(this.container,e,t,o,n,r))}rebuildCards(i){this.implementation.rebuildCards(i)}focus(){this.implementation.focus()}reset(){this.implementation.reset?.()}};var fs=_,vIn=te("aiCustomizationManagement.sashBorder",ob,d(7086,null)),eVi=class{getHeight(){return 26}getTemplateId(){return"sectionItem"}},tVi=class{constructor(i){this.hoverService=i;this.templateId="sectionItem"}renderTemplate(i){i.classList.add("section-list-item");let e=D(i,fs(".section-icon")),t=D(i,fs(".section-label")),o=D(i,fs(".section-count")),n=new O;return{container:i,icon:e,label:t,count:o,templateDisposables:n}}renderElement(i,e,t){t.templateDisposables.clear(),t.icon.className="section-icon",t.icon.classList.add(...q.asClassNameArray(i.icon)),t.label.textContent=i.label,i.count>0?(t.count.textContent=String(i.count),t.count.style.display=""):(t.count.textContent="",t.count.style.display="none"),t.templateDisposables.add(this.hoverService.setupManagedHover(yi("element"),t.container,i.description))}disposeTemplate(i){i.templateDisposables.dispose()}},kO=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V){super(kO.ID,e,t,o,n);this.storageService=n;this.instantiationService=r;this.openerService=l;this.commandService=c;this.workspaceService=u;this.promptsService=p;this.textModelService=h;this.configurationService=g;this.workingCopyService=f;this.hoverService=v;this.markdownRendererService=b;this.modelService=S;this.quickInputService=y;this.contextMenuService=w;this.fileService=x;this.notificationService=E;this.harnessService=M;this.viewsService=N;this.itemsModel=V;this.editorActionButtonInProgress=!1;this.editorDisplayMode="preview";this.editorModelChangeDisposables=this._register(new O);this.editorPreviewDisposables=this._register(new O);this.editorPreviewRenderScheduler=this._register(new Dt(()=>{this.viewMode==="editor"&&this.editorDisplayMode==="preview"&&this.renderCurrentEditorPreview()},200));this.builtinEditingSessions=new Map;this.currentEditingReadOnly=!1;this.viewMode="list";this.mcpDetailDisposables=this._register(new O);this.pluginDetailDisposables=this._register(new O);this.sections=[];this.allSections=[];this.editorDisposables=this._register(new O);this._editorContentChanged=!1;this.inEditorContextKey=Fmo.bindTo(s),this.sectionContextKey=Wmo.bindTo(s),this.harnessContextKey=Vmo.bindTo(s),this._register(ve(j=>{this.workspaceService.activeProjectRoot.read(j),this.viewMode==="editor"&&(this.currentEditingProjectRoot=this.workspaceService.getActiveProjectRoot())})),this._register(ee(()=>{this.currentModelRef?.dispose(),this.currentModelRef=void 0})),this._register(ee(()=>this.disposeBuiltinEditingSessions()));let H={[pn.Agents]:{label:d(7084,null),icon:gbe,description:d(7085,null)},[pn.Skills]:{label:d(7138,null),icon:fbe,description:d(7139,null)},[pn.Instructions]:{label:d(7108,null),icon:w1,description:d(7109,null)},[pn.Prompts]:{label:d(7125,null),icon:vHe,description:d(7126,null)},[pn.Hooks]:{label:d(7106,null),icon:vbe,description:d(7107,null)},[pn.McpServers]:{label:d(7111,null),icon:L.server,description:d(7112,null)},[pn.Plugins]:{label:d(7117,null),icon:bk,description:d(7118,null)},[pn.Models]:{label:d(7113,null),icon:L.vm,description:d(7114,null)}};for(let j of this.workspaceService.managementSections){let J=H[j];J&&this.allSections.push({id:j,...J,count:0})}this.rebuildVisibleSections();let K=this.storageService.get(_et,0);K&&this.sections.some(j=>j.id===K)?this.selectedSection=K:this.selectedSection=void 0}static{this.ID=fWt}createEditor(e){this.editorDisposables.clear(),this.container=D(e,fs(".ai-customization-management-editor")),this.createSplitView(),this.updateStyles()}createSplitView(){this.splitViewContainer=D(this.container,fs(".management-split-view")),this.sidebarContainer=fs(".management-sidebar"),this.contentContainer=fs(".management-content"),this.createSidebar(),this.createContent(),this.splitView=this.editorDisposables.add(new Gp(this.splitViewContainer,{orientation:1,proportionalLayout:!0}));let e=this.storageService.getNumber(Fxi,0,bWt);this.splitView.addView({onDidChange:U.None,element:this.sidebarContainer,minimumSize:Hmo,maximumSize:Umo,layout:(t,o,n)=>{if(this.sidebarContainer.style.width=`${t}px`,n!==void 0){let r=this.sidebarHeaderContainer?.offsetHeight??0;this.sectionsList.layout(Math.max(0,n-8-r),t)}}},e,void 0,!0),this.splitView.addView({onDidChange:U.None,element:this.contentContainer,minimumSize:zmo,maximumSize:Number.POSITIVE_INFINITY,layout:(t,o,n)=>{if(this.contentContainer.style.width=`${t}px`,n!==void 0){this.listWidget.layout(n-16,t-24),this.mcpListWidget?.layout(n-16,t-24),this.pluginListWidget?.layout(n-16,t-24);let r=this.modelsFooterElement?.offsetHeight||80;this.modelsWidget?.layout(n-16-r,t),this.viewMode==="editor"&&this.embeddedEditor&&this.embeddedEditor.layout({width:Math.max(0,t-24),height:Math.max(0,n-50-24)})}}},Ac.Distribute,void 0,!0),this.editorDisposables.add(this.splitView.onDidSashChange(()=>{let t=this.splitView.getViewSize(0);this.storageService.store(Fxi,t,0,0)})),this.editorDisposables.add(this.splitView.onDidSashReset(()=>{let t=this.splitView.getViewSize(0)+this.splitView.getViewSize(1);this.splitView.resizeView(0,bWt),this.splitView.resizeView(1,t-bWt)}))}get isHarnessSelectorEnabled(){return this.configurationService.getValue("chat.customizations.harnessSelector.enabled")!==!1}rebuildVisibleSections(){let e;if(this.isHarnessSelectorEnabled){let t=this.harnessService.activeHarness.get(),o=this.harnessService.findHarnessById(t);e=new Set(o?.hiddenSections??[])}else e=new Set;this.sections.length=0;for(let t of this.allSections)e.has(t.id)||this.sections.push(t);this.sectionsList&&this.sectionsList.splice(0,this.sectionsList.length,this.sections),this.welcomePage?.rebuildCards(new Set(this.sections.map(t=>t.id))),this.selectedSection!==void 0&&!this.sections.some(t=>t.id===this.selectedSection)&&this.sections.length>0?this.showWelcomePage():this.ensureSectionsListReflectsActiveSection()}createSidebar(){let e=D(this.sidebarContainer,fs(".sidebar-content"));this.createSidebarHeader(e);let t=D(e,fs(".sidebar-sections-list"));this.sectionsList=this.editorDisposables.add(this.instantiationService.createInstance(bc,"AICustomizationManagementSections",t,new eVi,[new tVi(this.hoverService)],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel:o=>o.count>0?d(7134,null,o.label,o.count):o.label,getWidgetAriaLabel:()=>d(7135,null)},openOnSingleClick:!0,identityProvider:{getId:o=>o.id}})),this.sectionsList.splice(0,this.sectionsList.length,this.sections),this.ensureSectionsListReflectsActiveSection(),this.editorDisposables.add(this.sectionsList.onDidChangeSelection(o=>{if(o.elements.length===0){this.selectedSection!==void 0&&this.showWelcomePage();return}this.selectSection(o.elements[0].id)})),this.editorDisposables.add(ve(o=>{let n=this.harnessService.availableHarnesses.read(o),r=this.harnessService.activeHarness.read(o);if(!n.some(s=>s.id===r)&&n.length>0){this.harnessService.setActiveHarness(n[0].id);return}if(this.harnessContextKey.set(r),this.rebuildVisibleSections(),this.ensureHarnessDropdown(),this.updateHarnessDropdown(),this._previousActiveHarnessId!==void 0&&this._previousActiveHarnessId!==r)for(let s of this.sections)this.updateSectionCount(s.id,0);this._previousActiveHarnessId=r})),this.isHarnessSelectorEnabled||this.harnessService.setActiveHarness(_d.Local),this.editorDisposables.add(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("chat.customizations.harnessSelector.enabled")&&(this.isHarnessSelectorEnabled||this.harnessService.setActiveHarness(_d.Local)),o.affectsConfiguration("chat.customizations.structuredPreview.enabled")&&this.onStructuredPreviewSettingChanged()}))}createSidebarHeader(e){let t=this.sidebarHeaderContainer=D(e,fs(".sidebar-header-row")),o=this.homeButton=D(t,fs("button.sidebar-home-button"));o.setAttribute("aria-label",d(7104,null)),this.editorDisposables.add(this.hoverService.setupManagedHover(yi("element"),o,d(7105,null)));let n=D(o,fs("span.sidebar-home-icon"));n.classList.add(...q.asClassNameArray(L.home)),n.setAttribute("aria-hidden","true");let r=this.homeButtonLabel=D(o,fs("span.sidebar-home-label"));r.textContent=d(7116,null),this.editorDisposables.add($(o,"click",()=>{this.showWelcomePage()})),this.createHarnessDropdown(t),this.updateHomeButtonStyle()}createHarnessDropdown(e){if(!this.isHarnessSelectorEnabled)return;let t=this.harnessDropdownContainer=D(e,fs(".sidebar-harness-dropdown"));this.harnessDropdownButton=D(t,fs("button.harness-dropdown-button")),this.harnessDropdownButton.setAttribute("aria-label",d(7136,null)),this.harnessDropdownButton.setAttribute("aria-haspopup","listbox"),this.editorDisposables.add(this.hoverService.setupManagedHover(yi("element"),this.harnessDropdownButton,()=>this.harnessService.findHarnessById(this.harnessService.activeHarness.get())?.label??"")),this.harnessDropdownIcon=D(this.harnessDropdownButton,fs("span.harness-dropdown-icon")),this.harnessDropdownLabel=D(this.harnessDropdownButton,fs("span.harness-dropdown-label")),D(this.harnessDropdownButton,fs("span.harness-dropdown-chevron.codicon.codicon-chevron-down")),this.updateHarnessDropdown(),this.editorDisposables.add($(this.harnessDropdownButton,"click",()=>{this.showHarnessMenu()}))}ensureHarnessDropdown(){!this.isHarnessSelectorEnabled&&this.harnessDropdownContainer?(this.harnessDropdownContainer.remove(),this.harnessDropdownContainer=void 0,this.harnessDropdownButton=void 0,this.harnessDropdownIcon=void 0,this.harnessDropdownLabel=void 0,this.updateHomeButtonStyle()):this.isHarnessSelectorEnabled&&!this.harnessDropdownContainer&&this.sidebarHeaderContainer&&(this.createHarnessDropdown(this.sidebarHeaderContainer),this.updateHomeButtonStyle())}updateHomeButtonStyle(){if(!this.homeButtonLabel||!this.homeButton)return;let e=this.harnessDropdownContainer&&this.harnessDropdownContainer.style.display!=="none";this.homeButtonLabel.style.display=e?"none":"",this.homeButton.style.flex=e?"":"1"}updateHarnessDropdown(){if(!this.harnessDropdownContainer||!this.harnessDropdownIcon||!this.harnessDropdownLabel)return;let e=this.harnessService.availableHarnesses.get();this.harnessDropdownContainer.style.display=e.length<=1?"none":"",this.updateHomeButtonStyle();let t=this.harnessService.activeHarness.get(),o=e.find(n=>n.id===t);o&&(this.harnessDropdownIcon.className="harness-dropdown-icon",this.harnessDropdownIcon.classList.add(...q.asClassNameArray(o.icon)),this.harnessDropdownLabel.textContent=o.label)}showHarnessMenu(){if(!this.harnessDropdownButton)return;let e=this.harnessService.availableHarnesses.get(),t=this.harnessService.activeHarness.get(),o=e.map(n=>{let r=new it(n.id,n.label,q.asClassName(n.icon),!0,()=>{this.harnessService.setActiveHarness(n.id)});return r.checked=n.id===t,r});this.contextMenuService.showContextMenu({getAnchor:()=>this.harnessDropdownButton,getActions:()=>o,getCheckedActionsRepresentation:()=>"radio"})}createWelcomePage(e){this.welcomePage=this.editorDisposables.add(new q4t(e,this.workspaceService.welcomePageFeatures,{selectSection:t=>this.selectSection(t),selectSectionWithMarketplace:t=>this.selectSection(t,{showMarketplace:!0}),closeEditor:()=>{this.input&&this.group.closeEditor(this.input)},prefillChat:async(t,o)=>{try{if(this.workspaceService.isSessionsWindow){let n="workbench.view.sessions.chat";o?.newChat&&await this.commandService.executeCommand("workbench.action.sessions.newChat");let s=await this.viewsService.openView(n,!0);o?.isPartialQuery&&s?.prefillInput?s.prefillInput(t):s?.sendQuery&&s.sendQuery(t)}else o?.newChat&&await this.commandService.executeCommand("workbench.action.chat.newChat"),await this.commandService.executeCommand("workbench.action.chat.open",{query:t,isPartialQuery:o?.isPartialQuery??!1})}catch(n){mt(n)}}},this.commandService,this.workspaceService,this.hoverService)),this.welcomePage.rebuildCards(new Set(this.sections.map(t=>t.id)))}createBackArrowButton(e){let t=fs("button.section-back-arrow-button");t.type="button",t.setAttribute("aria-label",d(7091,null)),this.editorDisposables.add(this.hoverService.setupManagedHover(yi("element"),t,d(7092,null)));let o=D(t,fs("span.section-back-arrow-icon"));return o.classList.add(...q.asClassNameArray(L.arrowLeft)),o.setAttribute("aria-hidden","true"),this.editorDisposables.add($(t,"click",()=>{e?e():this.showWelcomePage()})),t}createContent(){let e=D(this.contentContainer,fs(".content-inner"));this.createWelcomePage(e),this.promptsContentContainer=D(e,fs(".prompts-content-container")),this.listWidget=this.editorDisposables.add(this.instantiationService.createInstance(SHe)),this.promptsContentContainer.appendChild(this.listWidget.element),this.editorDisposables.add(this.listWidget.onDidSelectItem(o=>{this.telemetryService.publicLog2("chatCustomizationEditor.itemSelected",{section:this.selectedSection??"welcome",promptType:o.promptType,storage:o.storage??"external"});let n=o.storage,r=n==="local",s=!n||n==="extension"||n==="plugin"||n===sc;this.showEmbeddedEditor(o.uri,o.name,o.promptType,n??sc,r,s)})),this.editorDisposables.add(this.listWidget.onDidRequestCreate(o=>{this.createNewItemWithAI(o)})),this.editorDisposables.add(this.listWidget.onDidRequestCreateManual(({type:o,target:n,rootFileName:r})=>{this.createNewItemManual(o,n,r)}));let t=new Set(this.workspaceService.managementSections);if(t.has(pn.Models)){this.modelsContentContainer=D(e,fs(".models-content-container")),D(this.modelsContentContainer,fs(".section-back-bar")).appendChild(this.createBackArrowButton()),this.modelsWidget=this.editorDisposables.add(this.instantiationService.createInstance(k$)),this.modelsContentContainer.appendChild(this.modelsWidget.element),this.modelsFooterElement=D(this.modelsContentContainer,fs(".section-footer"));let n=D(this.modelsFooterElement,fs("p.section-footer-description"));n.textContent=d(7115,null);let r=D(this.modelsFooterElement,fs("a.section-footer-link"));r.textContent=d(7110,null),r.href="https://code.visualstudio.com/docs/copilot/customization/language-models",this.editorDisposables.add($(r,"click",s=>{s.preventDefault(),this.openerService.open(A.parse(r.href))}))}t.has(pn.McpServers)&&(this.mcpContentContainer=D(e,fs(".mcp-content-container")),this.mcpListWidget=this.editorDisposables.add(this.instantiationService.createInstance(EHe)),this.mcpContentContainer.appendChild(this.mcpListWidget.element),this.mcpDetailContainer=D(e,fs(".mcp-detail-container")),this.createEmbeddedMcpDetail(),this.editorDisposables.add(this.mcpListWidget.onDidSelectServer(o=>{this.showEmbeddedMcpDetail(o)})),this.editorDisposables.add(this.mcpListWidget.onDidRequestShowPlugin(o=>{this.showPluginDetail(o)}))),t.has(pn.Plugins)&&(this.pluginContentContainer=D(e,fs(".plugin-content-container")),this.pluginListWidget=this.editorDisposables.add(this.instantiationService.createInstance(DHe)),this.pluginContentContainer.appendChild(this.pluginListWidget.element),this.pluginDetailContainer=D(e,fs(".plugin-detail-container")),this.createEmbeddedPluginDetail(),this.editorDisposables.add(this.pluginListWidget.onDidSelectPlugin(o=>{this.pluginDetailReturnSection=void 0,this.showEmbeddedPluginDetail(o)}))),this.editorContentContainer=D(e,fs(".editor-content-container")),this.createEmbeddedEditor(),this.updateContentVisibility(),this.editorDisposables.add(this.listWidget.onDidChangeItemCount(o=>{this.isPromptsSection(this.selectedSection)&&this.updateSectionCount(this.selectedSection,o)})),this.mcpListWidget&&(this.editorDisposables.add(this.mcpListWidget.onDidChangeItemCount(o=>{this.updateSectionCount(pn.McpServers,o)})),this.mcpListWidget.fireItemCount()),this.pluginListWidget&&(this.editorDisposables.add(this.pluginListWidget.onDidChangeItemCount(o=>{this.updateSectionCount(pn.Plugins,o)})),this.pluginListWidget.fireItemCount()),this.modelsWidget&&(this.editorDisposables.add(this.modelsWidget.onDidChangeItemCount(o=>{this.updateSectionCount(pn.Models,o)})),this.modelsWidget.fireItemCount());for(let o of HWi){let n=this.itemsModel.getCount(o);this.editorDisposables.add(ve(r=>{this.updateSectionCount(o,n.read(r))}))}this.isPromptsSection(this.selectedSection)&&this.listWidget.setSection(this.selectedSection)}isPromptsSection(e){return e===pn.Agents||e===pn.Skills||e===pn.Instructions||e===pn.Prompts||e===pn.Hooks}updateSectionCount(e,t){let o=this.sections.find(n=>n.id===e);!o||o.count===t||(o.count=t,this.sectionsList.splice(0,this.sectionsList.length,this.sections),this.ensureSectionsListReflectsActiveSection())}showWelcomePage(){this.viewMode==="editor"&&this.goBackToList(),this.viewMode==="mcpDetail"&&this.goBackFromMcpDetail(),this.viewMode==="pluginDetail"&&this.goBackFromPluginDetail(),this.selectedSection=void 0,this.sectionContextKey.set(""),this.storageService.remove(_et,0),this.welcomePage?.reset(),this.updateContentVisibility(),this.ensureSectionsListReflectsActiveSection(void 0),this.welcomePage?.focus()}selectSection(e,t){if(this.selectedSection===e&&!t?.showMarketplace){this.ensureSectionsListReflectsActiveSection(e);return}this.telemetryService.publicLog2("chatCustomizationEditor.sectionChanged",{section:e}),this.viewMode==="editor"&&this.goBackToList(),this.viewMode==="mcpDetail"&&this.goBackFromMcpDetail(),this.viewMode==="pluginDetail"&&this.goBackFromPluginDetail(),this.selectedSection=e,this.sectionContextKey.set(e),this.storageService.store(_et,e,0,0),this.updateContentVisibility(),this.isPromptsSection(e)&&this.listWidget.setSection(e),this.dimension&&this.layout(this.dimension),this.ensureSectionsListReflectsActiveSection(e),t?.showMarketplace&&(e===pn.McpServers?this.mcpListWidget?.showBrowseMarketplace():e===pn.Plugins&&this.pluginListWidget?.showBrowseMarketplace()),e===pn.McpServers?this.mcpListWidget?.focusSearch():e===pn.Plugins?this.pluginListWidget?.focusSearch():e===pn.Models?this.modelsWidget?.focusSearch():this.listWidget?.focusSearch()}ensureSectionsListReflectsActiveSection(e=this.selectedSection){if(!this.sectionsList)return;if(e===void 0){this.sectionsList.setSelection([]),this.sectionsList.setFocus([]);return}let t=this.sections.findIndex(r=>r.id===e);if(t<0)return;let o=this.sectionsList.getSelection();(o.length!==1||o[0]!==t)&&this.sectionsList.setSelection([t]);let n=this.sectionsList.getFocus();(n.length!==1||n[0]!==t)&&this.sectionsList.setFocus([t])}updateContentVisibility(){let e=this.viewMode==="editor",t=this.viewMode==="mcpDetail",o=this.viewMode==="pluginDetail",n=t||o,r=this.selectedSection===void 0,s=this.selectedSection!==void 0&&this.isPromptsSection(this.selectedSection),l=this.selectedSection===pn.Models,c=this.selectedSection===pn.McpServers,u=this.selectedSection===pn.Plugins;this.welcomePage&&(this.welcomePage.container.style.display=r&&!e&&!n?"":"none"),this.promptsContentContainer&&(this.promptsContentContainer.style.display=!e&&!n&&s?"":"none"),this.modelsContentContainer&&(this.modelsContentContainer.style.display=!e&&!n&&l?"":"none"),this.mcpContentContainer&&(this.mcpContentContainer.style.display=!e&&!n&&c?"":"none"),this.mcpDetailContainer&&(this.mcpDetailContainer.style.display=t?"":"none"),this.pluginContentContainer&&(this.pluginContentContainer.style.display=!e&&!n&&u?"":"none"),this.pluginDetailContainer&&(this.pluginDetailContainer.style.display=o?"":"none"),this.editorContentContainer&&(this.editorContentContainer.style.display=e?"":"none"),l&&this.modelsWidget&&(this.modelsWidget.render(),this.dimension&&this.layout(this.dimension))}async createNewItemWithAI(e){this.telemetryService.publicLog2("chatCustomizationEditor.createItem",{section:this.selectedSection??"welcome",promptType:e,creationMode:"ai",target:"workspace"}),this.input&&this.group.closeEditor(this.input),await this.workspaceService.generateCustomization(e)}async createNewItemManual(e,t,o){if(this.telemetryService.publicLog2("chatCustomizationEditor.createItem",{section:this.selectedSection??"welcome",promptType:e,creationMode:"manual",target:t==="workspace-root"?"workspace":t}),t==="workspace-root"){let c=this.workspaceService.getActiveProjectRoot();if(!c)return;let u=this.selectedSection?this.harnessService.getActiveDescriptor().sectionOverrides?.get(this.selectedSection):void 0,p=o??u?.rootFile??dDe,h=A.joinPath(c,p);await this.fileService.exists(h)?await this.showEmbeddedEditor(h,p,"instructions","local",!0):(await this.fileService.createFile(h),await this.showEmbeddedEditor(h,p,"instructions","local",!0)),this.listWidget.refresh();return}if(e==="hook"){this.workspaceService.isSessionsWindow?await this.instantiationService.invokeFunction(RBe,{openEditor:async c=>{await this.showEmbeddedEditor(c,Be(c),"hook","local",!0)},target:"github-copilot"}):await this.instantiationService.invokeFunction(RBe,{openEditor:async c=>{await this.showEmbeddedEditor(c,Be(c),"hook","local",!0)}});return}let n=await this.resolveTargetDirectoryWithPicker(e,t);if(n===null)return;let r=this.selectedSection?this.harnessService.getActiveDescriptor().sectionOverrides?.get(this.selectedSection):void 0,s={targetFolder:n,targetStorage:t==="user"?"user":"local",fileExtension:r?.fileExtension,openFile:async c=>{let u=t==="workspace";return await this.showEmbeddedEditor(c,Be(c),e,t==="user"?"user":"local",u),this.embeddedEditor}},l;switch(e){case"prompt":l=vlt;break;case"instructions":l=blt;break;case"agent":l=Slt;break;case"skill":l=Ilt;break;default:return}await this.commandService.executeCommand(l,s),this.listWidget.refresh()}async resolveTargetDirectoryWithPicker(e,t){let o=await this.promptsService.getSourceFolders(e),n=this.workspaceService.getActiveProjectRoot(),s=this.harnessService.getActiveDescriptor().workspaceSubpaths,l;if(t==="workspace")l=n?o.filter(h=>Yr(h.uri,n)?s?SDe(h.uri.path,s):!0:!1):[];else{l=n?o.filter(g=>!Yr(g.uri,n)):o;let h=this.harnessService.getStorageSourceFilter(e);if(h.includedUserFileRoots){let g=h.includedUserFileRoots;l=l.filter(f=>g.some(v=>Yr(f.uri,v)))}}let c=new Set;if(l=l.filter(h=>{let g=h.uri.toString();return c.has(g)?!1:(c.add(g),!0)}),l.length===0)return;if(l.length===1)return l[0].uri;let u=l.map(h=>({label:this.promptsService.getPromptLocationLabel(h),description:h.uri.fsPath,uri:h.uri}));return(await this.quickInputService.pick(u,{placeHolder:d(7137,null)}))?.uri??null}updateStyles(){let e=this.theme.getColor(vIn);e&&this.splitView?.style({separatorBorder:e})}async setInput(e,t,o,n){this.workspaceService.clearOverrideProjectRoot(),this.inEditorContextKey.set(!0),this.sectionContextKey.set(this.selectedSection??""),e.setSaveHandler(()=>this.handleBuiltinSave()),this.telemetryService.publicLog2("chatCustomizationEditor.opened",{section:this.selectedSection??"welcome"}),await super.setInput(e,t,o,n),this.dimension&&this.layout(this.dimension)}clearInput(){let e=this.input;e instanceof xO&&(e.setSaveHandler(void 0),e.setDirty(!1)),this.inEditorContextKey.set(!1),this.viewMode==="editor"&&this.goBackToList(),this.viewMode==="mcpDetail"&&this.goBackFromMcpDetail(),this.viewMode==="pluginDetail"&&this.goBackFromPluginDetail(),this.workspaceService.clearOverrideProjectRoot(),this.disposeBuiltinEditingSessions(),super.clearInput()}layout(e){this.dimension=e,this.container&&this.splitView&&(this.splitViewContainer.style.height=`${e.height}px`,this.splitView.layout(e.width,e.height))}focus(){if(super.focus(),this.viewMode==="editor"){this.editorDisplayMode==="raw"?this.embeddedEditor?.focus():this.editorModeButton?.focus();return}if(this.selectedSection===void 0){this.welcomePage?.focus();return}this.selectedSection===pn.McpServers?this.mcpListWidget?.focusSearch():this.selectedSection===pn.Plugins?this.pluginListWidget?.focusSearch():this.selectedSection===pn.Models?this.modelsWidget?.focusSearch():this.listWidget?.focusSearch()}selectSectionById(e,t){this.sections.findIndex(n=>n.id===e)>=0&&(this.viewMode==="editor"&&this.goBackToList(),this.viewMode==="mcpDetail"&&this.goBackFromMcpDetail(),this.viewMode==="pluginDetail"&&this.goBackFromPluginDetail(),this.selectedSection=e,this.sectionContextKey.set(e),this.storageService.store(_et,e,0,0),this.updateContentVisibility(),this.isPromptsSection(e)&&this.listWidget.setSection(e),this.dimension&&this.layout(this.dimension),this.ensureSectionsListReflectsActiveSection(e),t?.showMarketplace&&(e===pn.McpServers?this.mcpListWidget?.showBrowseMarketplace():e===pn.Plugins&&this.pluginListWidget?.showBrowseMarketplace()))}refreshList(){this.listWidget.refresh()}revealLastItem(){this.selectedSection===pn.McpServers?this.mcpListWidget?.revealLastItem():this.selectedSection===pn.Plugins?this.pluginListWidget?.revealLastItem():this.listWidget.revealLastItem()}async generateDebugReport(){return this.listWidget.generateDebugReport()}createEmbeddedEditor(){if(!this.editorContentContainer)return;let e=D(this.editorContentContainer,fs(".editor-header"));this.editorActionButton=D(e,fs("button.editor-back-button")),this.editorActionButton.setAttribute("aria-label",d(7087,null)),this.editorDisposables.add(this.hoverService.setupManagedHover(yi("element"),this.editorActionButton,d(7088,null))),this.editorActionButtonIcon=D(this.editorActionButton,fs(`.codicon.codicon-${L.arrowLeft.id}.editor-action-button-icon`)),this.editorActionButtonIcon.setAttribute("aria-hidden","true"),this.editorDisposables.add($(this.editorActionButton,"click",()=>{this.handleEditorActionButton().catch(s=>{console.error("Failed to handle editor back action:",s),this.notificationService.error(d(7097,null))})}));let t=D(e,fs(".editor-item-info"));this.editorItemNameElement=D(t,fs(".editor-item-name")),this.editorItemPathElement=D(t,fs(".editor-item-path")),this.editorModeButton=D(e,fs("button.editor-mode-button")),this.editorModeButton.type="button",this.editorModeButton.setAttribute("aria-pressed","false"),this.editorDisposables.add(this.hoverService.setupManagedHover(yi("element"),this.editorModeButton,()=>this.getEditorModeButtonTooltip())),this.editorDisposables.add($(this.editorModeButton,"click",()=>{this.toggleEditorDisplayMode()})),this.editorSaveIndicator=D(e,fs(".editor-save-indicator")),this.editorPreviewContainer=D(this.editorContentContainer,fs(".editor-preview-container")),this.editorPreviewScrollContainer=D(this.editorPreviewContainer,fs(".editor-preview-scroll-container")),this.editorPreviewScrollContainer.setAttribute("role","region"),this.editorPreviewScrollContainer.setAttribute("aria-label",d(7096,null)),this.editorPreviewIssuesContainer=D(this.editorPreviewScrollContainer,fs(".editor-preview-issues"));let o=D(this.editorPreviewScrollContainer,fs(".editor-preview-section.editor-preview-frontmatter-section"));this.editorPreviewFrontMatterContainer=D(o,fs(".editor-preview-frontmatter-list"));let n=D(this.editorPreviewScrollContainer,fs(".editor-preview-section.editor-preview-body-section"));this.editorPreviewBodyContainer=D(n,fs(".editor-preview-body-content")),this.embeddedEditorContainer=D(this.editorContentContainer,fs(".embedded-editor-container"));let r=D(this.editorContentContainer,fs(".embedded-editor-overflow-widgets.monaco-editor"));this.editorDisposables.add(ee(()=>r.remove())),this.embeddedEditor=this.editorDisposables.add(this.instantiationService.createInstance(us,this.embeddedEditorContainer,{...ay(this.configurationService),readOnly:!1,minimap:{enabled:!1},lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!1,folding:!0,renderLineHighlight:"all",scrollbar:{vertical:"auto",horizontal:"auto"},overflowWidgetsDomNode:r},{isSimpleWidget:!1})),this.updateEditorDisplayMode()}async showEmbeddedEditor(e,t,o,n,r=!1,s=!1){this.currentModelRef?.dispose(),this.currentModelRef=void 0,this.editorModelChangeDisposables.clear(),this.editorPreviewDisposables.clear(),this.editorPreviewRenderScheduler.cancel(),this.currentEditingUri=e,this.currentEditingProjectRoot=r?this.workspaceService.getActiveProjectRoot():void 0,this.currentEditingStorage=n,this.currentEditingPromptType=o,this.currentEditingReadOnly=s,this.editorDisplayMode=this.isStructuredPreviewSupported(o)?"preview":"raw",this.viewMode="editor",this.editorItemNameElement.textContent=t,this.editorItemPathElement.textContent=Be(e),this._editorContentChanged=!1,this.resetEditorSaveIndicator(),this.updateEditorActionButton(),this.updateEditorDisplayMode(),this.updateContentVisibility();try{if(n===sc&&(o==="prompt"||o==="skill")){let c=await this.getOrCreateBuiltinEditingSession(e);if(!ze(this.currentEditingUri,e))return;this.embeddedEditor.setModel(c.model),this.embeddedEditor.updateOptions({readOnly:!1}),this._editorContentChanged=c.model.getValue()!==c.originalContent,this.renderCurrentEditorPreview(),this.updateEditorActionButton(),this.dimension&&this.layout(this.dimension),this.editorDisplayMode==="raw"?this.embeddedEditor.focus():this.editorModeButton?.focus(),this.editorModelChangeDisposables.add(c.model.onDidChangeContent(()=>{this._editorContentChanged=c.model.getValue()!==c.originalContent,this.scheduleCurrentEditorPreviewRender(),this.updateEditorActionButton()}));return}let l=await this.textModelService.createModelReference(e);if(!ze(this.currentEditingUri,e)){l.dispose();return}this.currentModelRef=l,this.embeddedEditor.setModel(l.object.textEditorModel),this.embeddedEditor.updateOptions({readOnly:s}),this.renderCurrentEditorPreview(),this.dimension&&this.layout(this.dimension),this.editorDisplayMode==="raw"?this.embeddedEditor.focus():this.editorModeButton?.focus(),this._editorContentChanged=this.workingCopyService.isDirty(e),this.editorModelChangeDisposables.add(l.object.textEditorModel.onDidChangeContent(()=>{this._editorContentChanged=!0,this.scheduleCurrentEditorPreviewRender(),this.resetEditorSaveIndicator()})),this.editorModelChangeDisposables.add(this.workingCopyService.onDidSave(c=>{ze(c.workingCopy.resource,e)&&(this._editorContentChanged=this.workingCopyService.isDirty(e),this.editorSaveIndicator.className="editor-save-indicator visible saved",this.editorSaveIndicator.classList.add(...q.asClassNameArray(L.check)),this.editorSaveIndicator.title=d(7133,null),this.editorSaveIndicator.setAttribute("aria-label",d(7133,null)),Er(d(7133,null)))}))}catch(l){console.error("Failed to load model for embedded editor:",l),ze(this.currentEditingUri,e)&&this.goBackToList()}}goBackToList(){let e=this.currentEditingUri,t=this.createExistingCustomizationSaveRequest();if(t&&this.telemetryService.publicLog2("chatCustomizationEditor.saveItem",{promptType:this.currentEditingPromptType??"",storage:String(this.currentEditingStorage??""),saveTarget:"existing"}),e&&this.currentEditingStorage===sc&&this.disposeBuiltinEditingSession(e),this.currentModelRef?.dispose(),this.currentModelRef=void 0,this.currentEditingUri=void 0,this.currentEditingProjectRoot=void 0,this.currentEditingStorage=void 0,this.currentEditingPromptType=void 0,this.currentEditingReadOnly=!1,this.editorDisplayMode="preview",this._editorContentChanged=!1,this.editorModelChangeDisposables.clear(),this.editorPreviewRenderScheduler.cancel(),this.clearEditorPreview(),this.resetEditorSaveIndicator(),this.updateEditorActionButton(),this.updateEditorDisplayMode(),this.embeddedEditor?.setModel(null),this.viewMode="list",this.updateContentVisibility(),this.listWidget?.refresh(),this.dimension&&this.layout(this.dimension),this.listWidget?.focusSearch(),t){let o=t;this.saveExistingCustomization(o).catch(n=>{console.error("Failed to save customization changes on exit:",n),this.notificationService.warn(d(7132,null,Be(o.fileUri)))})}}async getOrCreateBuiltinEditingSession(e){let t=e.toString(),o=this.builtinEditingSessions.get(t);if(o&&!o.model.isDisposed())return o;let n=await this.textModelService.createModelReference(e);try{let r={model:this.modelService.createModel(Uk(n.object.textEditorModel.createSnapshot()),{languageId:n.object.textEditorModel.getLanguageId(),onDidChange:U.None},A.from({scheme:"ai-customization-builtin",path:e.path,query:ht()}),!1),originalContent:n.object.textEditorModel.getValue()};return this.builtinEditingSessions.set(t,r),r}finally{n.dispose()}}createBuiltinPromptSaveRequest(e){let t=this.currentEditingUri,o=this.currentEditingPromptType;if(!t||this.currentEditingStorage!==sc||o!=="prompt"&&o!=="skill"||!e.folder||e.target==="cancel")return;let n=this.builtinEditingSessions.get(t.toString());if(!(!n||!this._editorContentChanged))return{target:e.target,folder:e.folder,sourceUri:t,content:n.model.getValue(),promptType:o,projectRoot:e.target==="workspace"?this.workspaceService.getActiveProjectRoot():void 0}}createExistingCustomizationSaveRequest(){if(!this._editorContentChanged||this.currentEditingStorage===sc||!this.currentEditingUri)return;let e=this.currentModelRef?.object.textEditorModel;if(e)return{fileUri:this.currentEditingUri,content:e.getValue(),projectRoot:this.currentEditingProjectRoot}}async saveBuiltinPromptCopy(e){let t;if(e.promptType==="skill"){let o=Be(ai(e.sourceUri));t=A.joinPath(e.folder,o,Be(e.sourceUri))}else t=A.joinPath(e.folder,Be(e.sourceUri));await this.fileService.createFolder(ai(t)),await this.fileService.writeFile(t,Ke.fromString(e.content)),e.target==="workspace"&&e.projectRoot&&await this.workspaceService.commitFiles(e.projectRoot,[t])}async saveExistingCustomization(e){await this.fileService.writeFile(e.fileUri,Ke.fromString(e.content)),e.projectRoot&&await this.workspaceService.commitFiles(e.projectRoot,[e.fileUri])}async pickBuiltinPromptSaveTarget(){let e=[],t=this.currentEditingPromptType??"prompt",o=JWi(this.workspaceService,t);o&&e.push({label:d(7141,null),description:o.fsPath,target:"workspace",folder:o});let n=await ZWi(this.promptsService,t);return n&&e.push({label:d(7140,null),description:n.fsPath,target:"user",folder:n}),e.push({label:d(7095,null),target:"cancel"}),this.quickInputService.pick(e,{canPickMany:!1,placeHolder:d(7131,null),matchOnDescription:!0})}async handleEditorActionButton(){if(this.editorActionButtonInProgress)return;this.editorActionButtonInProgress=!0,this.updateEditorActionButton();let e;try{if(this.shouldShowBuiltinSaveAction()){let t=await this.pickBuiltinPromptSaveTarget();if(!t||t.target==="cancel")return;e=this.createBuiltinPromptSaveRequest(t),e&&this.telemetryService.publicLog2("chatCustomizationEditor.saveItem",{promptType:this.currentEditingPromptType??"",storage:String(this.currentEditingStorage??""),saveTarget:t.target})}if(this.goBackToList(),e){let t=e;this.saveBuiltinPromptCopy(t).then(()=>{this.listWidget?.refresh()},o=>{console.error("Failed to save built-in override:",o),this.notificationService.warn(t.target==="workspace"?d(7130,null):d(7129,null))})}}finally{this.editorActionButtonInProgress=!1,this.updateEditorActionButton()}}updateEditorActionButton(){if(this.updateInputDirtyState(),!this.editorActionButton||!this.editorActionButtonIcon)return;let e=this.shouldShowBuiltinSaveAction();this.editorActionButtonIcon.className=`codicon codicon-${e?L.save.id:L.arrowLeft.id} editor-action-button-icon`,this.editorActionButton.disabled=this.editorActionButtonInProgress,this.editorActionButton.setAttribute("aria-label",e?d(7127,null):d(7087,null)),this.editorActionButton.title=e?d(7128,null):d(7087,null)}shouldShowBuiltinSaveAction(){return this._editorContentChanged&&this.currentEditingStorage===sc&&(this.currentEditingPromptType==="prompt"||this.currentEditingPromptType==="skill")}updateInputDirtyState(){let e=this.input;e instanceof xO&&e.setDirty(this.shouldShowBuiltinSaveAction())}async handleBuiltinSave(){if(!this.shouldShowBuiltinSaveAction())return!1;let e=await this.pickBuiltinPromptSaveTarget();if(!e||e.target==="cancel")return!1;let t=this.createBuiltinPromptSaveRequest(e);if(!t)return!1;try{return await this.saveBuiltinPromptCopy(t),this.telemetryService.publicLog2("chatCustomizationEditor.saveItem",{promptType:this.currentEditingPromptType??"",storage:String(this.currentEditingStorage??""),saveTarget:e.target}),this._editorContentChanged=!1,this.updateEditorActionButton(),!0}catch(o){return console.error("Failed to save built-in override:",o),this.notificationService.warn(e.target==="workspace"?d(7130,null):d(7129,null)),!1}}resetEditorSaveIndicator(){this.editorSaveIndicator.className="editor-save-indicator",this.editorSaveIndicator.title="",this.editorSaveIndicator.removeAttribute("aria-label")}isStructuredPreviewSupported(e){return this.configurationService.getValue("chat.customizations.structuredPreview.enabled")!==!0?!1:e==="agent"||e==="skill"||e==="instructions"||e==="prompt"}onStructuredPreviewSettingChanged(){if(this.viewMode!=="editor")return;this.isStructuredPreviewSupported(this.currentEditingPromptType)?this.editorDisplayMode==="preview"&&this.editorPreviewRenderScheduler.schedule():(this.editorDisplayMode="raw",this.editorPreviewRenderScheduler.cancel(),this.clearEditorPreview()),this.updateEditorDisplayMode(),this.dimension&&this.layout(this.dimension)}getCurrentEditingModel(){if(this.currentEditingUri)return this.currentEditingStorage===sc?this.builtinEditingSessions.get(this.currentEditingUri.toString())?.model:this.currentModelRef?.object.textEditorModel}toggleEditorDisplayMode(){this.isStructuredPreviewSupported(this.currentEditingPromptType)&&(this.editorDisplayMode=this.editorDisplayMode==="preview"?"raw":"preview",this.editorDisplayMode==="preview"&&(this.editorPreviewRenderScheduler.cancel(),this.renderCurrentEditorPreview()),this.updateEditorDisplayMode(),this.dimension&&this.layout(this.dimension),this.editorDisplayMode==="raw"?this.embeddedEditor?.focus():this.editorModeButton?.focus())}updateEditorDisplayMode(){let e=this.isStructuredPreviewSupported(this.currentEditingPromptType),t=e&&this.editorDisplayMode==="preview";this.editorModeButton&&(this.editorModeButton.style.display=e?"":"none",this.editorModeButton.textContent=this.getEditorModeButtonLabel(),this.editorModeButton.setAttribute("aria-label",this.getEditorModeButtonTooltip()),this.editorModeButton.setAttribute("aria-pressed",String(this.editorDisplayMode==="raw")),this.editorModeButton.title=this.getEditorModeButtonTooltip()),this.editorPreviewContainer&&(this.editorPreviewContainer.style.display=t?"":"none"),this.embeddedEditorContainer&&(this.embeddedEditorContainer.style.display=t?"none":"")}getEditorModeButtonLabel(){return this.isStructuredPreviewSupported(this.currentEditingPromptType)?this.editorDisplayMode==="raw"?d(7100,null):this.canEditCurrentRaw()?d(7098,null):d(7102,null):""}getEditorModeButtonTooltip(){return this.isStructuredPreviewSupported(this.currentEditingPromptType)?this.editorDisplayMode==="raw"?d(7101,null):this.canEditCurrentRaw()?d(7099,null):d(7103,null):""}canEditCurrentRaw(){let e=this.currentEditingPromptType;return e?this.currentEditingStorage===sc&&(e==="prompt"||e==="skill")||!this.currentEditingReadOnly:!1}scheduleCurrentEditorPreviewRender(){this.editorDisplayMode==="preview"&&this.editorPreviewRenderScheduler.schedule()}renderCurrentEditorPreview(){let e=this.getCurrentEditingModel(),t=this.currentEditingPromptType;if(!e||!t||this.editorDisplayMode!=="preview"||!this.isStructuredPreviewSupported(t)){this.clearEditorPreview();return}let o=this.promptsService.getParsedPromptFile(e);this.renderEditorPreview(o,t)}renderEditorPreview(e,t){if(!this.editorPreviewIssuesContainer||!this.editorPreviewFrontMatterContainer||!this.editorPreviewBodyContainer)return;this.editorPreviewDisposables.clear(),St(this.editorPreviewIssuesContainer),St(this.editorPreviewFrontMatterContainer),St(this.editorPreviewBodyContainer);let o=Ax(t,e.header??e.uri);this.renderPreviewIssues(e),this.renderPreviewFrontMatter(e,t,o),this.renderPreviewBody(e)}renderPreviewIssues(e){if(!this.editorPreviewIssuesContainer||!e.header?.errors.length)return;let t=D(this.editorPreviewIssuesContainer,fs(".editor-preview-issues-box"));D(t,fs("div.editor-preview-issues-title")).textContent=d(7121,null),D(t,fs("div.editor-preview-issues-description")).textContent=d(7120,null);let o=D(t,fs("ul.editor-preview-issues-list"));for(let n of e.header.errors)D(o,fs("li.editor-preview-issues-item")).textContent=n.message}renderPreviewFrontMatter(e,t,o){if(!this.editorPreviewFrontMatterContainer)return;let n=e.header?.attributes??[];if(!n.length){D(this.editorPreviewFrontMatterContainer,fs("div.editor-preview-empty-state")).textContent=d(7123,null);return}for(let r of n)this.renderPreviewAttribute(r,t,o)}renderPreviewAttribute(e,t,o){if(!this.editorPreviewFrontMatterContainer)return;let n=D(this.editorPreviewFrontMatterContainer,fs(".editor-preview-row")),r=D(n,fs(".editor-preview-row-header"));D(r,fs("div.editor-preview-row-key")).textContent=e.key;let s=D(r,fs("button.editor-preview-row-help"));s.type="button",s.setAttribute("aria-label",d(7119,null,e.key));let l=D(s,fs("span.editor-preview-row-help-icon"));l.classList.add(...q.asClassNameArray(L.info)),l.setAttribute("aria-hidden","true");let c=FZ(e.key,t,o)?.description??d(7124,null,e.key),u=this.editorPreviewDisposables.add(this.hoverService.setupManagedHover(yi("element"),s,{markdown:new he(c),markdownNotSupportedFallback:c}));this.editorPreviewDisposables.add($(s,"click",g=>{g.preventDefault(),g.stopPropagation(),u.show(!0)}));let p=D(n,fs("div.editor-preview-row-value")),h=this.stringifyPreviewValue(e.value);p.textContent=h,p.classList.toggle("multiline",h.includes(`
`))}renderPreviewBody(e){if(!this.editorPreviewBodyContainer)return;let t=e.body?.getContent()??"";if(!t.trim()){D(this.editorPreviewBodyContainer,fs("div.editor-preview-empty-state")).textContent=d(7122,null);return}let o=new he(t,{supportThemeIcons:!0});o.baseUri=e.uri;let n=this.editorPreviewDisposables.add(this.markdownRendererService.render(o));this.editorPreviewBodyContainer.appendChild(n.element)}stringifyPreviewValue(e){switch(e.type){case"scalar":return e.value;case"sequence":return e.items.every(t=>t.type==="scalar")?e.items.map(t=>t.value).join(`
`):JSON.stringify(this.toPreviewObject(e),null,2);case"map":return JSON.stringify(this.toPreviewObject(e),null,2)}}toPreviewObject(e){switch(e.type){case"scalar":return e.value;case"sequence":return e.items.map(t=>this.toPreviewObject(t));case"map":{let t={};for(let o of e.properties)t[o.key.value]=this.toPreviewObject(o.value);return t}}}clearEditorPreview(){this.editorPreviewRenderScheduler.cancel(),this.editorPreviewDisposables.clear(),this.editorPreviewIssuesContainer&&St(this.editorPreviewIssuesContainer),this.editorPreviewFrontMatterContainer&&St(this.editorPreviewFrontMatterContainer),this.editorPreviewBodyContainer&&St(this.editorPreviewBodyContainer)}disposeBuiltinEditingSessions(){for(let e of this.builtinEditingSessions.values())e.model.dispose();this.builtinEditingSessions.clear()}disposeBuiltinEditingSession(e){let t=e.toString(),o=this.builtinEditingSessions.get(t);o&&(o.model.dispose(),this.builtinEditingSessions.delete(t))}createEmbeddedMcpDetail(){if(!this.mcpDetailContainer)return;let e=D(this.mcpDetailContainer,fs(".editor-header")),t=D(e,fs("button.editor-back-button"));t.setAttribute("aria-label",d(7089,null)),this.editorDisposables.add(this.hoverService.setupManagedHover(yi("element"),t,d(7090,null))),D(t,fs(`.codicon.codicon-${L.arrowLeft.id}`)).setAttribute("aria-hidden","true"),this.editorDisposables.add($(t,"click",()=>{this.goBackFromMcpDetail()}));let n=D(this.mcpDetailContainer,fs(".mcp-detail-editor-container"));this.embeddedMcpDetail=this.editorDisposables.add(this.instantiationService.createInstance(RHe,n))}async showEmbeddedMcpDetail(e){this.embeddedMcpDetail&&(this.viewMode="mcpDetail",this.updateContentVisibility(),this.mcpDetailDisposables.clear(),this.embeddedMcpDetail.setInput(e),this.dimension&&this.layout(this.dimension))}goBackFromMcpDetail(){this.mcpDetailDisposables.clear(),this.embeddedMcpDetail?.clearInput(),this.viewMode="list",this.updateContentVisibility(),this.dimension&&this.layout(this.dimension),this.mcpListWidget?.focusSearch()}createEmbeddedPluginDetail(){if(!this.pluginDetailContainer)return;let e=D(this.pluginDetailContainer,fs(".editor-header")),t=D(e,fs("button.editor-back-button"));t.setAttribute("aria-label",d(7093,null)),this.editorDisposables.add(this.hoverService.setupManagedHover(yi("element"),t,d(7094,null))),D(t,fs(`.codicon.codicon-${L.arrowLeft.id}`)).setAttribute("aria-hidden","true"),this.editorDisposables.add($(t,"click",()=>{this.goBackFromPluginDetail()}));let n=D(this.pluginDetailContainer,fs(".plugin-detail-editor-container"));this.embeddedPluginDetail=this.editorDisposables.add(this.instantiationService.createInstance(K4t,n))}async showEmbeddedPluginDetail(e){this.embeddedPluginDetail&&(this.viewMode="pluginDetail",this.updateContentVisibility(),this.pluginDetailDisposables.clear(),this.embeddedPluginDetail.setInput(e),this.dimension&&this.layout(this.dimension))}async showPluginDetail(e){this.selectedSection!==pn.Plugins&&(this.pluginDetailReturnSection=this.selectedSection??pn.Agents),await this.showEmbeddedPluginDetail(e)}goBackFromPluginDetail(){this.pluginDetailDisposables.clear(),this.embeddedPluginDetail?.clearInput();let e=this.pluginDetailReturnSection;this.pluginDetailReturnSection=void 0,e?(this.viewMode="list",this.updateContentVisibility(),this.selectSection(e)):(this.viewMode="list",this.updateContentVisibility(),this.pluginListWidget?.focusSearch()),this.dimension&&this.layout(this.dimension)}};kO=I([m(1,_e),m(2,Pe),m(3,de),m(4,F),m(5,X),m(6,Je),m(7,fe),m(8,WM),m(9,jr),m(10,Bt),m(11,B),m(12,$a),m(13,ot),m(14,_n),m(15,_t),m(16,$e),m(17,Xe),m(18,ge),m(19,Ne),m(20,dh),m(21,Gt),m(22,sct)],kO);oe.as(en.EditorPane).registerEditorPane(os.create(kO,fWt,d(7044,null)),[new Vt(xO)]);var iVi=class{canSerialize(i){return i instanceof xO}serialize(i){return""}deserialize(i){return xO.getOrCreate()}};oe.as(en.EditorFactory).registerEditorSerializer(vWt,iVi);function vre(a){return A.isUri(a)?a:typeof a=="string"?A.parse(a):A.isUri(a.uri)?a.uri:A.parse(a.uri)}function ALo(a){if(!(A.isUri(a)||typeof a=="string"))return a.storage}function oVi(a){if(!(A.isUri(a)||typeof a=="string"))return a.promptType}function bIn(a){if(A.isUri(a)||typeof a=="string")return;let i=a.pluginUri;if(i)return A.isUri(i)?i:typeof i=="string"?A.parse(i):void 0}function SIn(a){if(!(A.isUri(a)||typeof a=="string"))return typeof a.itemId=="string"?a.itemId:void 0}function IIn(a){let i=a.lastIndexOf("#");if(i<0)return;let e=a.substring(i+1),t=/^([^[]+)\[(\d+)\]$/.exec(e);if(t)return{originalId:t[1],index:parseInt(t[2],10)}}var NLo="aiCustomizationManagement.openFile";W(class extends z{constructor(){super({id:NLo,title:P(7069,"Open"),icon:L.goToFile})}async run(a,i){let e=a.get(ie),t=ALo(i),o=await e.openEditor({resource:vre(i)}),n=da(o?.getControl());n&&(t==="extension"||t==="plugin")&&n.updateOptions({readOnly:!0,readOnlyMessage:new he(d(7074,null))})}});var OLo="aiCustomizationManagement.runPrompt";W(class extends z{constructor(){super({id:OLo,title:P(7077,"Run Prompt"),icon:L.play})}async run(a,i){await a.get(fe).executeCommand("workbench.action.chat.run.prompt.current",vre(i))}});var FLo=ii?P(7076,"Reveal in File Explorer"):et?P(7075,"Reveal in Finder"):P(7072,"Open Containing Folder"),WLo="aiCustomizationManagement.revealInOS";W(class extends z{constructor(){super({id:WLo,title:FLo,icon:L.folderOpened})}async run(a,i){let e=a.get(fe),t=vre(i);await e.executeCommand("revealFileInOS",t)}});var nVi="aiCustomizationManagement.delete";W(class extends z{constructor(){super({id:nVi,title:P(7058,"Delete"),icon:L.trash})}async run(a,i){let e=a.get(ge),t=a.get(ct),o=a.get(_e),n=a.get(WM),r=a.get(ie),s=vre(i),l=ALo(i),c=oVi(i),u=SIn(i),p=c==="skill",h=c==="hook",g=p?Be(ai(s)):Be(s);if(l==="plugin"){let w=a.get(mm).plugins.get().find(x=>Yr(s,x.uri));w&&(await t.confirm({message:d(7048,null,w.label),detail:d(7049,null),primaryButton:d(7081,null),type:"question"})).confirmed&&w.remove();return}if(l==="extension"||l===sc){await t.info(d(7046,null),d(7047,null));return}let f=h&&u?IIn(u):void 0,v=typeof i!="string"&&!A.isUri(i)?i.name:void 0,b=p?d(7053,null,g):f&&v?d(7052,null,v):d(7050,null,g);if((await t.confirm({message:b,detail:d(7051,null),primaryButton:d(7059,null),type:"warning"})).confirmed){try{o.publicLog2("chatCustomizationEditor.deleteItem",{promptType:c??"",storage:l??""})}catch{}if(f){try{let M=(await e.readFile(s)).value.toString(),N=ZFt(M,["hooks",f.originalId,f.index],{tabSize:1,insertSpaces:!1});if(N.length>0){let V=c8(M,N);if(await e.writeFile(s,Ke.fromString(V)),l==="local"){let H=n.getActiveProjectRoot();H&&await n.commitFiles(H,[s])}}}catch{await t.error(d(7060,null),d(7061,null))}return}let y=p?ai(s):s,w=e.hasCapability(y,4096);if(await e.del(y,{useTrash:w,recursive:p}),l==="local"){let E=n.getActiveProjectRoot();E&&await n.deleteFiles(E,[y])}let x=r.activeEditorPane;x instanceof kO&&x.refreshList()}}});var VLo="aiCustomizationManagement.copyPath";W(class extends z{constructor(){super({id:VLo,title:P(7056,"Copy Path"),icon:L.clippy})}async run(a,i){let e=a.get(Bi),t=vre(i),o=t.scheme==="file"?t.fsPath:t.toString(!0);await e.writeText(o)}});var BLo="aiCustomizationManagement.installChatCustomizationExtension",HLo="ms-vscode.vscode-chat-customizations-evaluations",ULo=new Y("chat.customizationExtensionNotInstalled",!1),yIn=ULo.isEqualTo(!0);W(class extends z{constructor(){super({id:BLo,title:P(7068,"Install Chat Customization Extension"),icon:L.beaker})}async run(a,i){await a.get(fe).executeCommand("workbench.extensions.installExtension",HLo,{enable:!0})}});var zLo=C.and(C.notEquals(fW,"extension"),C.notEquals(fW,"plugin"),C.notEquals(fW,sc)),rVi=C.and(C.equals(fW,"plugin"),C.regex(Tet,new RegExp(`^${T$}:`)).negate());be.appendMenuItem(ek,{command:{id:BLo,title:d(7067,null),icon:L.beaker},group:"inline",order:1,when:C.and(yIn,C.or(C.equals(PN,"prompt"),C.equals(PN,"instructions"),C.equals(PN,"agent"),C.equals(PN,"skill")))});be.appendMenuItem(ek,{command:{id:VLo,title:d(7057,null),icon:L.clippy},group:"inline",order:2});be.appendMenuItem(ek,{command:{id:nVi,title:d(7059,null),icon:L.trash},group:"inline",order:10,when:zLo});be.appendMenuItem(ek,{command:{id:NLo,title:d(7070,null)},group:"1_open",order:1});be.appendMenuItem(ek,{command:{id:OLo,title:d(7078,null),icon:L.play},group:"2_run",order:1,when:C.equals(PN,"prompt")});be.appendMenuItem(ek,{command:{id:WLo,title:FLo.value},group:"3_file",order:1,when:C.or(C.regex(tMe,new RegExp(`^${Q.file}:`)),C.regex(tMe,new RegExp(`^${Q.vscodeUserData}:`)))});be.appendMenuItem(ek,{command:{id:nVi,title:d(7059,null)},group:"4_modify",order:1,when:zLo});var sVi="aiCustomizationManagement.uninstallPlugin";W(class extends z{constructor(){super({id:sVi,title:P(7082,"Uninstall Plugin"),icon:L.trash})}async run(a,i){let e=a.get(mm),t=a.get(ct),o=vre(i),n=e.plugins.get().find(s=>Yr(o,s.uri));if(!n)return;(await t.confirm({message:d(7054,null,n.label),detail:d(7055,null),primaryButton:d(7083,null),type:"question"})).confirmed&&n.remove()}});be.appendMenuItem(ek,{command:{id:sVi,title:d(7081,null),icon:L.trash},group:"inline",order:10,when:rVi});be.appendMenuItem(ek,{command:{id:sVi,title:d(7081,null)},group:"4_modify",order:1,when:rVi});var KLo="aiCustomizationManagement.showPlugin";W(class extends z{constructor(){super({id:KLo,title:P(7079,"Show Plugin")})}async run(a,i){let e=a.get(mm),t=a.get(ie),o=bIn(i);if(!o)return;let n=e.plugins.get().find(c=>c.uri.toString()===o.toString());if(!n)return;let r={kind:"installed",name:n.label,description:n.fromMarketplace?.description??"",marketplace:n.fromMarketplace?.marketplace,plugin:n},s=xO.getOrCreate(),l=await t.openEditor(s,{pinned:!0});l instanceof kO&&await l.showPluginDetail(r)}});be.appendMenuItem(ek,{command:{id:KLo,title:d(7080,null)},group:"1_open",order:2,when:rVi});var aVi="aiCustomizationManagement.disableItem";W(class extends z{constructor(){super({id:aVi,title:P(7062,"Disable"),icon:L.eyeClosed})}async run(a,i){let e=a.get(jr),t=vre(i),o=oVi(i);if(!o)return;let n=e.getDisabledPromptFiles(o);n.add(t),e.setDisabledPromptFiles(o,n)}});var lVi="aiCustomizationManagement.enableItem";W(class extends z{constructor(){super({id:lVi,title:P(7064,"Enable"),icon:L.eye})}async run(a,i){let e=a.get(jr),t=vre(i),o=oVi(i);if(!o)return;let n=e.getDisabledPromptFiles(o);n.delete(t),e.setDisabledPromptFiles(o,n)}});be.appendMenuItem(ek,{command:{id:aVi,title:d(7063,null)},group:"5_toggle",order:1,when:C.and(C.equals(lte,!1),C.equals(fW,sc),C.equals(PN,"skill"))});be.appendMenuItem(ek,{command:{id:lVi,title:d(7065,null)},group:"5_toggle",order:1,when:C.and(C.equals(lte,!0),C.equals(fW,sc),C.equals(PN,"skill"))});be.appendMenuItem(ek,{command:{id:aVi,title:d(7063,null),icon:L.eyeClosed},group:"inline",order:5,when:C.and(C.equals(lte,!1),C.equals(fW,sc),C.equals(PN,"skill"))});be.appendMenuItem(ek,{command:{id:lVi,title:d(7065,null),icon:L.eye},group:"inline",order:5,when:C.and(C.equals(lte,!0),C.equals(fW,sc),C.equals(PN,"skill"))});var LHe=class extends k{constructor(e,t){super();this.extensionManagementService=t;this.chatCustomizationExtensionNotInstalledContext=ULo.bindTo(e);let o=()=>this.updateChatCustomizationExtensionContext();this._register(this.extensionManagementService.onProfileAwareDidInstallExtensions(o)),this._register(this.extensionManagementService.onProfileAwareDidUninstallExtension(o)),this._register(this.extensionManagementService.onDidChangeProfile(o)),this.updateChatCustomizationExtensionContext(),this.registerActions()}static{this.ID="workbench.contrib.aiCustomizationManagementActions"}async updateChatCustomizationExtensionContext(){try{let e=await this.extensionManagementService.getInstalled(),t=hi.toKey(HLo),o=e.some(n=>hi.toKey(n.identifier.id)===t);this.chatCustomizationExtensionNotInstalledContext.set(!o)}catch{this.chatCustomizationExtensionNotInstalledContext.set(!1)}}registerActions(){this._register(W(class extends z{constructor(){super({id:eMe.OpenEditor,title:P(7071,"Open Customizations"),shortTitle:P(7045,"Customizations"),category:fi,precondition:Z.enabled,f1:!0})}async run(e,t){let o=e.get(ie),n=e.get(Lt),r=e.get(dh),s=n.lastFocusedWidget?.viewModel?.sessionResource;if(s){let u=yn(s);r.findHarnessById(u)&&r.setActiveHarness(u)}let l=xO.getOrCreate(),c=await o.openEditor(l,{pinned:!0});t&&c instanceof kO&&c.selectSectionById(t)}})),this._register(W(class extends z{constructor(){super({id:eMe.OpenMarketplace,title:P(7073,"Open Marketplace"),category:fi,precondition:Z.enabled})}async run(e,t){let o=e.get(ie),n=xO.getOrCreate(),r=await o.openEditor(n,{pinned:!0});if(r instanceof kO){let s=t??pn.McpServers;r.selectSectionById(s,{showMarketplace:!0})}}})),this._register(W(class extends z{constructor(){super({id:eMe.GenerateDebugReport,title:P(7066,"Generate Customization Debug Report"),category:Fe.Developer,precondition:Z.enabled,f1:!0})}async run(e){let t=e.get(ie),o=xO.getOrCreate(),n=await t.openEditor(o,{pinned:!0});if(!(n instanceof kO))return;let r=await n.generateDebugReport();await t.openEditor({resource:void 0,contents:r,languageId:"plaintext"})}}))}};LHe=I([m(0,X),m(1,Dd)],LHe);bt(LHe.ID,LHe,vt.AfterRestored);var k1=class extends k{constructor(e,t,o){super();this.container=e;this.delegate=t;this.instantiationService=o;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this.title=void 0;this.titleLabel=this._register(new ue);this.modelDisposables=this._register(new ue);this.lastKnownHeight=0;this.render(this.container),this.registerActions()}static{this.DEFAULT_TITLE=d(9234,null)}static{this.PICK_AGENT_SESSION_ACTION_ID="workbench.action.chat.pickAgentSession"}registerActions(){let e=this;this._register(W(class extends z{constructor(){super({id:k1.PICK_AGENT_SESSION_ACTION_ID,title:d(9235,null),f1:!1,menu:[{id:R.ChatViewSessionTitleNavigationToolbar,group:"navigation",order:2}]})}async run(t){await t.get(F).createInstance(Gne,e.titleLabel.value?.element,void 0).pickAgentSession()}}))}render(e){let t=st("div.chat-view-title-container",[st("div.chat-view-title-inner",[st("div.chat-view-title-navigation-toolbar@navigationToolbar"),st("div.chat-view-title-actions-toolbar@actionsToolbar")])]);this.navigationToolbar=this._register(this.instantiationService.createInstance(pr,t.navigationToolbar,R.ChatViewSessionTitleNavigationToolbar,{actionViewItemProvider:o=>{if(o.id===k1.PICK_AGENT_SESSION_ACTION_ID)return this.titleLabel.value=new cVi(o),this.titleLabel.value.updateTitle(this.title??k1.DEFAULT_TITLE),this.titleLabel.value},hiddenItemStrategy:-1,menuOptions:{shouldForwardArgs:!0}})),this.actionsToolbar=this._register(this.instantiationService.createInstance(pr,t.actionsToolbar,R.ChatViewSessionTitleToolbar,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:-1})),this.titleContainer=t.root,this._register(ds.addTarget(this.titleContainer));for(let o of[Vn.Tap,ne.CLICK])this._register($(this.titleContainer,o,()=>{this.delegate.focusChat()}));e.appendChild(this.titleContainer)}update(e){this.model=e,this.modelDisposables.value=e?.onDidChange(t=>{(t.kind==="setCustomTitle"||t.kind==="addRequest")&&this.doUpdate()}),this.doUpdate()}doUpdate(){let e=new he(this.model?.title??"");this.title=ma(e),this.updateTitle(this.title??k1.DEFAULT_TITLE);let t=this.model&&{$mid:19,sessionResource:this.model.sessionResource};this.navigationToolbar&&(this.navigationToolbar.context=t),this.actionsToolbar&&(this.actionsToolbar.context=t)}updateTitle(e){if(!this.titleContainer)return;this.titleContainer.classList.toggle("visible",this.shouldRender()),this.titleLabel.value?.updateTitle(e);let t=this.getHeight();t!==this.lastKnownHeight&&(this.lastKnownHeight=t,this._onDidChangeHeight.fire())}shouldRender(){return!!this.model?.title}getHeight(){return!this.titleContainer||this.titleContainer.style.display==="none"?0:this.titleContainer.offsetHeight}};k1=I([m(2,F)],k1);var cVi=class extends ts{constructor(e,t){super(null,e,{...t,icon:!1,label:!0});this.titleLabel=void 0}render(e){super.render(e),e.classList.add("chat-view-title-action-item"),this.label?.classList.add("chat-view-title-label-container"),this.titleLabel=this.label?.appendChild(st("span.chat-view-title-label").root),this.updateLabel()}updateTitle(e){this.title=e,this.updateLabel()}updateLabel(){this.titleLabel&&(this.title?this.titleLabel.textContent=this.title:this.titleLabel.textContent="")}};var MHe=class extends k{constructor(e,t){super();this._chatService=e;this._languageService=t;this._approvals=new Map;this._modelTrackers=this._register(new bI);this._register(Gle(o=>this._chatService.chatModels.read(o),({addedValues:o,removedValues:n})=>{for(let r of o)this._modelTrackers.set(r.sessionResource,this._trackModel(r));for(let r of n)this._modelTrackers.deleteAndDispose(r.sessionResource),this._approvals.get(r.sessionResource.toString())?.set(void 0,void 0)}))}getApproval(e){return this._getOrCreateApproval(e.toString())}_getOrCreateApproval(e){let t=this._approvals.get(e);return t||(t=De(`sessionApproval.${e}`,void 0),this._approvals.set(e,t)),t}_trackModel(e){let t=this._getOrCreateApproval(e.sessionResource.toString()),o=n=>{let r=t.get();r!==n&&(r!==void 0&&n!==void 0&&r.label===n.label&&r.languageId===n.languageId||t.set(n,void 0))};return ve(n=>{let r=e.requestNeedsInput.read(n);if(!r){o(void 0);return}let s=e.lastRequest?.response;if(!s?.response?.value){o(void 0);return}for(let l of s.response.value){if(l.kind!=="toolInvocation"||l.toolSpecificData?.kind==="modifiedFilesConfirmation")continue;let c=l.state.read(n);if(c.type===pi.StateKind.WaitingForConfirmation||c.type===pi.StateKind.WaitingForPostApproval){let u,p;if(l.toolSpecificData?.kind==="terminal"){let g=yR(l.toolSpecificData);u=g.presentationOverrides?.commandLine??g.commandLine.forDisplay??g.commandLine.userEdited??g.commandLine.toolEdited??g.commandLine.original,p=this._languageService.getLanguageIdByLanguageName(g.presentationOverrides?.language??g.language)??void 0}else if(r.detail)u=r.detail;else{let g=l.invocationMessage;u=typeof g=="string"?g:ma(g)}let h=c;o({label:u,languageId:p,since:new Date,confirm:()=>h.confirm({type:4})});return}}o(void 0)})}};MHe=I([m(0,si),m(1,Rt)],MHe);var qP=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.container=e;this.options=t;this.contextMenuService=o;this.contextKeyService=n;this.instantiationService=r;this.chatSessionsService=s;this.commandService=l;this.menuService=c;this.agentSessionsService=u;this.telemetryService=p;this.editorService=h;this.storageService=g;this.accessibilityService=f;this.sessionsListFindIsOpen=!1;this._isProgrammaticCollapseChange=!1;this._recentRepositoryLabels=new Set;this.updateSessionsListThrottler=this._register(new am);this._onDidUpdate=this._register(new T);this.onDidUpdate=this._onDidUpdate.event;this.visible=!0;this.focusedAgentSessionArchivedContextKey=Z.isArchivedAgentSession.bindTo(this.contextKeyService),this.focusedAgentSessionPinnedContextKey=Z.isPinnedAgentSession.bindTo(this.contextKeyService),this.focusedAgentSessionReadContextKey=Z.isReadAgentSession.bindTo(this.contextKeyService),this.focusedAgentSessionTypeContextKey=Z.agentSessionType.bindTo(this.contextKeyService),this.hasMultipleAgentSessionsSelectedContextKey=Z.hasMultipleAgentSessionsSelected.bindTo(this.contextKeyService),this.create(this.container),this.registerListeners()}get element(){return this.sessionsContainer}static{this.RECENT_SESSIONS_FOR_EXPAND=5}registerListeners(){this._register(this.editorService.onDidActiveEditorChange(()=>this.revealAndFocusActiveEditorSession()))}revealAndFocusActiveEditorSession(){if(!this.options.trackActiveEditorSession()||!this.visible)return;let e=this.editorService.activeEditor,t=e instanceof tl?e.sessionResource:e?.resource;if(!t)return;let o=this.agentSessionsService.model.getSession(t);o&&this.sessionsList?.hasNode(o)&&(this.sessionsList.getRelativeTop(o)===null&&this.sessionsList.reveal(o,.5),this.sessionsList.setFocus([o]),this.sessionsList.setSelection([o]))}create(e){this.sessionsContainer=D(e,_(".agent-sessions-viewer")),this.createEmptyFilterMessage(this.sessionsContainer),this.createList(this.sessionsContainer)}createEmptyFilterMessage(e){this.emptyFilterMessage=D(e,_(".agent-sessions-empty-filter-message")),Wi(this.emptyFilterMessage);let t=D(this.emptyFilterMessage,_("span"));t.textContent=`${d(6819,null)} - `;let o=D(this.emptyFilterMessage,_("span.reset-filter-link"));o.textContent=d(6820,null),o.tabIndex=0,o.setAttribute("role","button"),this._register($(o,ne.CLICK,()=>this.options.filter.reset())),this._register($(o,ne.KEY_DOWN,n=>{let r=new mi(n);(r.keyCode===3||r.keyCode===10)&&(Kt.stop(n,!0),this.options.filter.reset())}))}static{this.SECTION_COLLAPSE_STATE_KEY="agentSessions.sectionCollapseState"}getSavedCollapseState(e){let t=this.storageService.get(qP.SECTION_COLLAPSE_STATE_KEY,0);if(t)try{let o=JSON.parse(t);if(typeof o[e]=="boolean")return o[e]}catch{}}saveSectionCollapseState(e,t){let o={},n=this.storageService.get(qP.SECTION_COLLAPSE_STATE_KEY,0);if(n)try{let r=JSON.parse(n);typeof r=="object"&&r!==null&&!Array.isArray(r)&&(o=r)}catch{}o[e]=t,this.storageService.store(qP.SECTION_COLLAPSE_STATE_KEY,JSON.stringify(o),0,0)}resetSectionCollapseState(){this.storageService.remove(qP.SECTION_COLLAPSE_STATE_KEY,0)}createList(e){let t=h=>{if(oI(h)){let g=this.getSavedCollapseState(h.section);if(g!==void 0)return g;if(h.section==="more"&&!this.options.filter.getExcludes().read||h.section==="archived"&&this.options.filter.getExcludes().archived||this.options.collapseOlderSections?.()&&(["week","older","archived"].includes(h.section)||h.section==="yesterday"&&this.hasTodaySessions()||h.section==="repository"&&!this._recentRepositoryLabels.has(h.label)))return!0}return!1},o=new U6(()=>this.options.filter.sortResults?.()??"created"),n=this.options.enableApprovalRow?this._register(this.instantiationService.createInstance(MHe)):void 0,r=De(this,void 0),s=this._register(this.instantiationService.createInstance(FP,{...this.options,isGroupedByRepository:()=>this.options.filter.groupResults?.()==="repository",isSortedByUpdated:()=>this.options.filter.sortResults?.()==="updated"},n,r)),l=this.options.compactShowMore,c=this.sessionsDataSource=this._register(new Rjt(this.options.filter,o,this.options.repositoryGroupLimit)),u=this.sessionsList=this._register(this.instantiationService.createInstance(qy,"AgentSessionsView",e,new jve(n,this.options.compactShowMore),new Pjt,[s,this.instantiationService.createInstance(H6,{hideSectionCount:this.options.hideSectionCount}),new WP({compactLabel:this.options.compactShowMore}),new plt],c,{accessibilityProvider:new Djt,dnd:this.instantiationService.createInstance(bBe),identityProvider:new Mjt,horizontalScrolling:!1,multipleSelectionSupport:!0,findWidgetEnabled:!0,defaultFindMode:1,keyboardNavigationLabelProvider:new Ajt,overrideStyles:this.options.overrideStyles,twistieAdditionalCssClass:()=>"force-no-twistie",collapseByDefault:h=>t(h),renderIndentGuides:"none"}));if(Z.agentSessionsViewerFocused.bindTo(u.contextKeyService),this._register(s.onDidChangeItemHeight(h=>{u.hasNode(h)&&u.updateElementHeight(h,void 0)})),l){let h,g,f=WP.COLLAPSED_HEIGHT,v=new Map,b=()=>{v.clear();try{let V=u.getNode();for(let H of V.children)if(oI(H.element)){let K=H.element.label;for(let j of H.children)(hW(j.element)||gW(j.element))&&v.set(K,j.element)}}catch{}},S,y,w=Me(e);this._register({dispose:()=>{S&&w.cancelAnimationFrame(S),y&&w.cancelAnimationFrame(y)}});let x=(V,H,K,j)=>{if(this.accessibilityService.isMotionReduced()){if(u.hasNode(V)){N=!0;try{u.updateElementHeight(V,K)}finally{N=!1}f=K}j?.();return}let J=150,se=Date.now(),ae=()=>{let ce=Date.now()-se,Se=Math.min(ce/J,1),Re=1-Math.pow(1-Se,2),xe=Math.round(H+(K-H)*Re);if(u.hasNode(V)){N=!0;try{u.updateElementHeight(V,xe)}finally{N=!1}f=xe}if(Se<1)return w.requestAnimationFrame(ae);j?.()};return w.requestAnimationFrame(ae)},E=()=>{y&&(w.cancelAnimationFrame(y),y=void 0),S&&(w.cancelAnimationFrame(S),S=void 0),h&&g&&u.hasNode(h)&&(y=x(h,f,WP.COLLAPSED_HEIGHT,()=>{y=void 0})),h=void 0,g=void 0},M=V=>{if(g===V)return;E();let H=v.get(V);!H||!u.hasNode(H)||(h=H,g=V,f=WP.COLLAPSED_HEIGHT,S=x(H,WP.COLLAPSED_HEIGHT,WP.HEIGHT,()=>{S=void 0}))},N=!1;this._register(u.onDidChangeModel(()=>{N||(h=void 0,g=void 0,f=WP.COLLAPSED_HEIGHT,b())})),this._register($(e,"mouseover",V=>{let K=V.target.closest(".monaco-list-row");if(!K)return;let j,J=K.querySelector(".agent-session-section-label");if(J&&(j=J.textContent??void 0),!j){let se=K.querySelector(".agent-session-show-more");se&&(j=se.getAttribute("data-section-label")??void 0)}if(!j){let se=K.querySelector(".agent-session-item[data-section-label]");se&&(j=se.getAttribute("data-section-label")??void 0)}if(!j){if(K.querySelector(".agent-session-item"))return;E();return}if(!v.has(j)){E();return}M(j)})),this._register($(e,"mouseleave",()=>{E()})),b()}this._register(c.onDidGetChildren(h=>{this.updateEmpty(h===0)})),this._register(c.onDidExpandRepositoryGroup(()=>{this.update()}));let p=this.agentSessionsService.model;this._register(this.options.filter.onDidChange(async()=>{this.visible&&(this.updateSectionCollapseStates(),this.update())})),this._register(p.onDidChangeSessions(()=>{this.visible&&this.update()})),this.computeRecentRepositoryLabels(),u.setInput(p),this._register(u.onDidOpen(h=>this.openAgentSession(h))),this._register(u.onContextMenu(h=>this.showContextMenu(h))),this._register(u.onMouseDblClick(({element:h})=>{h===null&&this.commandService.executeCommand(Mh)})),this._register(U.any(u.onDidChangeFocus,u.onDidChangeSelection,p.onDidChangeSessions)(()=>{let h=u.getFocus().at(0);h&&_G(h)?(this.focusedAgentSessionArchivedContextKey.set(h.isArchived()),this.focusedAgentSessionPinnedContextKey.set(h.isPinned()),this.focusedAgentSessionReadContextKey.set(h.isRead()),this.focusedAgentSessionTypeContextKey.set(h.providerType),r.set(h.resource,void 0)):(this.focusedAgentSessionArchivedContextKey.reset(),this.focusedAgentSessionPinnedContextKey.reset(),this.focusedAgentSessionReadContextKey.reset(),this.focusedAgentSessionTypeContextKey.reset(),r.set(void 0,void 0));let g=u.getSelection().filter(_G);this.hasMultipleAgentSessionsSelectedContextKey.set(g.length>1)})),this._register(u.onDidChangeFindOpenState(h=>{this.sessionsListFindIsOpen=h,this.updateSectionCollapseStates()})),this._register(u.onDidChangeCollapseState(h=>{if(this._isProgrammaticCollapseChange)return;let g=h.node.element?.element;g&&oI(g)&&this.saveSectionCollapseState(g.section,h.node.collapsed)}))}updateEmpty(e){if(!this.emptyFilterMessage||!this.sessionsList)return;let o=this.agentSessionsService.model.sessions.length>0,n=!this.options.filter.isDefault(),r=o&&e&&n;Md(r,this.emptyFilterMessage),Md(!r,this.sessionsList.getHTMLElement())}hasTodaySessions(){let e=new Date().setHours(0,0,0,0);return this.agentSessionsService.model.sessions.some(t=>!t.isArchived()&&t.timing.created>=e)}computeRecentRepositoryLabels(){this._recentRepositoryLabels.clear();let e=this.agentSessionsService.model.sessions.filter(t=>!t.isArchived()&&!t.isPinned()).sort((t,o)=>o.timing.created-t.timing.created).slice(0,qP.RECENT_SESSIONS_FOR_EXPAND);for(let t of e){let o=SBe(t);this._recentRepositoryLabels.add(o??v1.repository)}}async openAgentSession(e){let t=e.element;if(!t||oI(t))return;if(hW(t)){this.sessionsDataSource?.expandRepositoryGroup(t.sectionLabel);return}if(gW(t)){this.sessionsDataSource?.collapseRepositoryGroup(t.sectionLabel);return}this.telemetryService.publicLog2("agentSessionOpened",{providerType:t.providerType,source:this.options.source});let o=this.options.overrideSessionOpenOptions?.(e)??e;if(this.options.overrideSessionOpen)await this.options.overrideSessionOpen(t.resource,o);else{let n=await this.instantiationService.invokeFunction(gBe,t,o);n&&this.options.notifySessionOpened?.(t.resource,n)}}async showContextMenu({element:e,anchor:t,browserEvent:o}){!e||hW(e)||gW(e)||(Kt.stop(o,!0),oI(e)?this.showAgentSessionSectionContextMenu(e,t):this.showAgentSessionContextMenu(e,t))}async showAgentSessionSectionContextMenu(e,t){let o=[];o.push([Z.agentSessionSection.key,e.section]);let n=this.menuService.createMenu(R.AgentSessionSectionContext,this.contextKeyService.createOverlay(o));this.contextMenuService.showContextMenu({getActions:()=>oi.join(...n.getActions({arg:e,shouldForwardArgs:!0}).map(([,r])=>r)),getAnchor:()=>t,getActionsContext:()=>this}),n.dispose()}async showAgentSessionContextMenu(e,t){this.chatSessionsService.activateChatSessionItemProvider(e.providerType);let o=[];o.push([Z.isArchivedAgentSession.key,e.isArchived()]),o.push([Z.isPinnedAgentSession.key,e.isPinned()]),o.push([Z.isReadAgentSession.key,e.isRead()]),o.push([Z.agentSessionType.key,e.providerType]);let n=this.menuService.createMenu(R.AgentSessionsContext,this.contextKeyService.createOverlay(o)),r=this.sessionsList?.getSelection().filter(_G)??[],s={session:e,sessions:r.length>1&&r.includes(e)?r:[e],$mid:25};this.contextMenuService.showContextMenu({getActions:()=>oi.join(...n.getActions({arg:s,shouldForwardArgs:!0}).map(([,l])=>l)),getAnchor:()=>t,getActionsContext:()=>s}),n.dispose()}openFind(){this.sessionsList?.openFind()}updateSectionCollapseStates(){if(this.sessionsList){this._isProgrammaticCollapseChange=!0;try{this._updateSectionCollapseStatesCore()}finally{this._isProgrammaticCollapseChange=!1}}}_updateSectionCollapseStatesCore(){if(!this.sessionsList)return;let e=this.agentSessionsService.model;for(let t of this.sessionsList.getNode(e).children)if(oI(t.element))switch(t.element.section){case"archived":{let o=!this.sessionsListFindIsOpen&&this.options.filter.getExcludes().archived;o&&!t.collapsed?this.sessionsList.collapse(t.element):!o&&t.collapsed&&this.sessionsList.expand(t.element);break}case"more":{t.collapsed&&this.sessionsListFindIsOpen&&this.sessionsList.expand(t.element);break}}}refresh(){return this.agentSessionsService.model.resolve(void 0)}collapseAllSections(){if(!this.sessionsList)return;let e=this.agentSessionsService.model;for(let t of this.sessionsList.getNode(e).children)oI(t.element)&&!t.collapsed&&this.sessionsList.collapse(t.element)}async update(){return this.updateSessionsListThrottler.queue(async()=>{this.computeRecentRepositoryLabels(),await this.sessionsList?.updateChildren(),this._onDidUpdate.fire()})}setVisible(e){this.visible!==e&&(this.visible=e,this.visible&&this.update())}layout(e,t){this.sessionsList?.layout(e,t)}focus(){this.sessionsList?.domFocus();try{(this.sessionsList?.getFocus().length??0)===0&&this.sessionsList?.focusFirst()}catch{}}clearFocus(){this.sessionsList?.setFocus([]),this.sessionsList?.setSelection([])}hasFocusOrSelection(){return(this.sessionsList?.getFocus().length??0)>0||(this.sessionsList?.getSelection().length??0)>0}scrollToTop(){this.sessionsList&&(this.sessionsList.scrollTop=0)}getFocus(){return(this.sessionsList?.getFocus()??[]).filter(t=>_G(t))}reveal(e){if(!this.sessionsList)return!1;let t=this.agentSessionsService.model.getSession(e);if(!t||!this.sessionsList.hasNode(t))return!1;try{this.sessionsList.getRelativeTop(t)===null&&this.sessionsList.reveal(t,.5)}catch{return!1}return this.sessionsList.setFocus([t]),this.sessionsList.setSelection([t]),!0}};qP=I([m(2,Xe),m(3,X),m(4,F),m(5,Ms),m(6,fe),m(7,Yt),m(8,Vc),m(9,_e),m(10,ie),m(11,de),m(12,Ai)],qP);var U_=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j){super(e,t,o,n,r,s,l,c,u,p);this.storageService=h;this.chatService=g;this.chatAgentService=f;this.logService=v;this.notificationService=b;this.layoutService=S;this.chatSessionsService=y;this.telemetryService=w;this.progressService=E;this.agentSessionsService=M;this.chatEntitlementService=N;this.commandService=V;this.activityService=H;this.workbenchEnvironmentService=K;this.hostService=j;this.lastDimensionsPerOrientation=new Map;this.loadSessionCts=this._register(new ue);this.modelRef=this._register(new ue);this.activityBadge=this._register(new ue);this.sessionsViewerOrientation=1;this.sessionsViewerOrientationConfiguration="sideBySide";this.sessionsViewerSashDisposables=this._register(new ue);this.layoutingBody=!1;this.memento=new $l(`interactive-session-view-${Z_e}`,this.storageService),this.viewState=this.memento.getMemento(1,1),x.startupKind!==3&&this.configurationService.getValue("chat.restoreLastPanelSession")===!1&&(this.viewState.sessionId=void 0,this.viewState.sessionResource=void 0),this.sessionsViewerVisible=!1,this.sessionsViewerSidebarWidth=Math.max(U_.SESSIONS_SIDEBAR_MIN_WIDTH,this.viewState.sessionsSidebarWidth??U_.SESSIONS_SIDEBAR_DEFAULT_WIDTH),this.chatViewLocationContext=Z.panelLocation.bindTo(r),this.sessionsViewerOrientationContext=Z.agentSessionsViewerOrientation.bindTo(r),this.sessionsViewerPositionContext=Z.agentSessionsViewerPosition.bindTo(r),this.sessionsViewerVisibilityContext=Z.agentSessionsViewerVisible.bindTo(r),this.updateContextKeys(),this.registerListeners()}updateContextKeys(){let{position:e,location:t}=this.getViewPositionAndLocation();this.chatViewLocationContext.set(t??2),this.sessionsViewerOrientationContext.set(this.sessionsViewerOrientation),this.sessionsViewerPositionContext.set(e===1?2:1)}getViewPositionAndLocation(){let e=this.viewDescriptorService.getViewLocationById(this.id),t=this.layoutService.getSideBarPosition(),o=this.layoutService.getPanelPosition(),n;switch(e){case 0:n=t===1;break;case 1:n=o!==0;break;default:n=t===0;break}return{position:n?1:0,location:e??2}}getSessionHoverPosition(){let e=this.viewDescriptorService.getViewLocationById(this.id),t=this.layoutService.getSideBarPosition();return this.sessionsViewerOrientation===2?e===0&&t===1?0:1:{0:1,1:0,3:2,2:3}[e===1?this.layoutService.getPanelPosition():t]}updateViewPaneClasses(e){let t=this.configurationService.getValue("workbench.activityBar.location")==="default";this.viewPaneContainer?.classList.toggle("activity-bar-location-default",t),this.viewPaneContainer?.classList.toggle("activity-bar-location-other",!t);let{position:o,location:n}=this.getViewPositionAndLocation();this.viewPaneContainer?.classList.toggle("chat-view-location-auxiliarybar",n===2),this.viewPaneContainer?.classList.toggle("chat-view-location-sidebar",n===0),this.viewPaneContainer?.classList.toggle("chat-view-location-panel",n===1),this.viewPaneContainer?.classList.toggle("chat-view-position-left",o===0),this.viewPaneContainer?.classList.toggle("chat-view-position-right",o===1),e&&this.relayout()}registerListeners(){this._register(this.chatAgentService.onDidChangeAgents(()=>this.onDidChangeAgents())),this._register(this.chatSessionsService.onDidCommitSession(async e=>{if(!this.modelRef.value||!ze(e.original,this.modelRef.value.object.sessionResource))return;let t=await this.chatService.acquireOrLoadSession(e.committed,"panel",Ie.None,"ChatViewPane#onDidCommitSession");await this.showModel(Ie.None,t)})),this._register(U.any(U.filter(this.configurationService.onDidChangeConfiguration,e=>e.affectsConfiguration("workbench.sideBar.location")),this.layoutService.onDidChangePanelPosition,U.filter(this.viewDescriptorService.onDidChangeContainerLocation,e=>e.viewContainer===this.viewDescriptorService.getViewContainerByViewId(this.id)))(()=>{this.updateContextKeys(),this.updateViewPaneClasses(!0)})),this._register(U.filter(this.configurationService.onDidChangeConfiguration,e=>e.affectsConfiguration("workbench.activityBar.location"))(()=>this.updateViewPaneClasses(!0)))}onDidChangeAgents(){if(this.chatAgentService.getDefaultAgent("panel")&&!this._widget?.viewModel&&!this.restoringSession){let e=this.getTransferredOrPersistedSessionInfo();this.restoringSession=(e?this.chatService.acquireOrLoadSession(e,"panel",Ie.None,"ChatViewPane#onDidChangeAgents"):Promise.resolve(void 0)).then(async t=>{if(!this._widget)return;let o=this._widget.visible;try{this._widget.setVisible(!1),await this.showModel(Ie.None,t)}finally{this._widget.setVisible(o)}}),this.restoringSession.finally(()=>this.restoringSession=void 0)}this._onDidChangeViewWelcomeState.fire()}getTransferredOrPersistedSessionInfo(){return this.chatService.transferredSessionResource?this.chatService.transferredSessionResource:this.viewState.sessionResource?this.viewState.sessionResource:this.viewState.sessionId?Br.forSession(this.viewState.sessionId):void 0}renderBody(e){super.renderBody(e),this.telemetryService.publicLog2("chatViewPaneOpened"),this.viewPaneContainer=e,this.viewPaneContainer.classList.add("chat-viewpane"),this.updateViewPaneClasses(!1),this.createControls(e),this.setupContextMenu(e),this.applyModel()}createControls(e){let t=this.createSessionsControl(e),o=this.welcomeController=this._register(this.instantiationService.createInstance(VWe,e,this,"panel")),n=this.createChatControl(e);this.registerControlsListeners(t,n,o),this.updateSessionsControlVisibility()}static{this.SESSIONS_SIDEBAR_MIN_WIDTH=200}static{this.SESSIONS_SIDEBAR_SNAP_THRESHOLD=this.SESSIONS_SIDEBAR_MIN_WIDTH/2}static{this.SESSIONS_SIDEBAR_DEFAULT_WIDTH=300}static{this.CHAT_WIDGET_DEFAULT_WIDTH=300}static{this.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH=this.CHAT_WIDGET_DEFAULT_WIDTH+this.SESSIONS_SIDEBAR_DEFAULT_WIDTH}get agentSessionsControl(){return this.sessionsControl}createSessionsControl(e){let t=this.sessionsContainer=e.appendChild(_(".agent-sessions-container")),o=this.sessionsTitleContainer=D(t,_(".agent-sessions-title-container")),n=this.sessionsTitle=D(o,_("span.agent-sessions-title"));n.textContent=d(9233,null),this._register($(n,ne.CLICK,()=>{this.sessionsControl?.scrollToTop(),this.sessionsControl?.focus()}));let r=D(o,_(".agent-sessions-toolbar")),s=this._register(this.instantiationService.createInstance(pr,r,R.AgentSessionsToolbar,{menuOptions:{shouldForwardArgs:!0}})),l=this._register(this.instantiationService.createInstance(EV,{filterMenuId:R.AgentSessionsViewerFilterSubMenu,groupResults:()=>this.sessionsViewerOrientation===1?"capped":"date"}));this._register(U.runAndSubscribe(l.onDidChange,()=>{r.classList.toggle("filtered",!l.isDefault())}));let c=this.sessionsNewButtonContainer=D(t,_(".agent-sessions-new-button-container")),u=this._register(new Pi(c,{...Ro,secondary:!0}));u.label=d(9231,null),this._register(u.onDidClick(()=>this.commandService.executeCommand(Mh))),this.sessionsControlContainer=D(t,_(".agent-sessions-control-container"));let p=this.sessionsControl=this._register(this.instantiationService.createInstance(qP,this.sessionsControlContainer,{source:"chatViewPane",filter:l,overrideStyles:this.getLocationBasedColors().listOverrideStyles,getHoverPosition:()=>this.getSessionHoverPosition(),trackActiveEditorSession:()=>!this._widget||this._widget.isEmpty(),overrideSessionOpenOptions:h=>this.sessionsViewerOrientation===1&&!h.sideBySide?{...h,editorOptions:{...h.editorOptions,preserveFocus:!1}}:h}));return this._register(this.onDidChangeBodyVisibility(h=>p.setVisible(h))),s.context=p,this._register(this.hostService.onDidChangeFocus(h=>{h&&p.refresh()})),this._register(U.runAndSubscribe(U.filter(this.configurationService.onDidChangeConfiguration,h=>h.affectsConfiguration("chat.viewSessions.orientation")),h=>{let g=this.configurationService.getValue("chat.viewSessions.orientation");this.doUpdateConfiguredSessionsViewerOrientation(g,{updateConfiguration:!1,layout:!!h})})),p}getSessionsViewerOrientation(){return this.sessionsViewerOrientation}updateConfiguredSessionsViewerOrientation(e){return this.doUpdateConfiguredSessionsViewerOrientation(e,{updateConfiguration:!0,layout:!0})}doUpdateConfiguredSessionsViewerOrientation(e,t){let o=this.sessionsViewerOrientationConfiguration,n;e==="stacked"||e==="sideBySide"?n=e:n="sideBySide",this.sessionsViewerOrientationConfiguration=n,o!==this.sessionsViewerOrientationConfiguration&&(t.updateConfiguration&&this.configurationService.updateValue("chat.viewSessions.orientation",n),t.layout&&this.relayout())}updateSessionsControlVisibility(){if(!this.sessionsContainer||!this.viewPaneContainer)return{changed:!1,visible:!1};let e;this.configurationService.getValue("chat.viewSessions.enabled")?this.sessionsViewerOrientation===1?e=(!!this.chatEntitlementService.sentiment.completed||this.chatEntitlementService.hasByokModels)&&(!this._widget||this._widget.isEmpty()&&!!this._widget.viewModel&&!this._widget.viewModel.model.title)&&!this.welcomeController?.isShowingWelcome.get():e=!this.welcomeController?.isShowingWelcome.get()&&!!this.lastDimensions&&this.lastDimensions.width>=U_.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH:e=!1,this.viewPaneContainer.classList.toggle("has-sessions-control",e);let t=this.sessionsContainer.style.display!=="none";return Md(e,this.sessionsContainer),this.sessionsViewerVisible=e,this.sessionsViewerVisibilityContext.set(e),{changed:t!==e,visible:e}}getFocusedSessions(){return this.sessionsControl?.getFocus()??[]}static{this.MIN_CHAT_WIDGET_HEIGHT=116}get widget(){return this._widget}createChatControl(e){let t=D(e,_(".chat-controls-container")),o=this.getLocationBasedColors(),n=this.layoutService.getContainer(Me(t)).appendChild(_(".chat-editor-overflow.monaco-editor"));this._register(ee(()=>n.remove())),this.viewDescriptorService.getViewLocationById(this.id)!==3&&this.createChatTitleControl(t);let r=this._register(this.instantiationService.createChild(new Po([X,this.scopedContextKeyService])));this._widget=this._register(r.createInstance(my,"panel",{viewId:this.id},{autoScroll:l=>l!=="ask",renderFollowups:!0,supportsFileReferences:!0,clear:()=>this.clear(),rendererOptions:{renderTextEditsAsSummary:l=>!0,referencesExpandedWhenEmptyResponse:!1,progressMessageAtBottomOfResponse:l=>l!=="ask"},editorOverflowWidgetsDomNode:n,enableImplicitContext:!0,enableWorkingSet:this.workbenchEnvironmentService.isSessionsWindow?"implicit":"explicit",supportsChangingModes:!0,dndContainer:e,inputEditorMinLines:this.workbenchEnvironmentService.isSessionsWindow?2:void 0,isSessionsWindow:this.workbenchEnvironmentService.isSessionsWindow},{listForeground:QA,listBackground:o.background,overlayBackground:o.overlayBackground,inputEditorBackground:o.background,resultEditorBackground:Bo})),this._widget.render(t);let s=l=>this._widget.setVisible(this.isBodyVisible()&&!this.welcomeController?.isShowingWelcome.read(l));return this._register(this.onDidChangeBodyVisibility(()=>s())),this._register(ve(l=>s(l))),this._widget}createChatTitleControl(e){this.titleControl=this._register(this.instantiationService.createInstance(k1,e,{focusChat:()=>this._widget.focusInput()})),this._register(this.titleControl.onDidChangeHeight(()=>{this.relayout()}))}registerControlsListeners(e,t,o){let n=new Set([Xn.hasByokModels.key]);this._register(U.any(t.onDidChangeEmptyState,U.fromObservable(o.isShowingWelcome),U.filter(this.configurationService.onDidChangeConfiguration,l=>l.affectsConfiguration("chat.viewSessions.enabled")),U.filter(this.contextKeyService.onDidChangeContext,l=>l.affectsSome(n)))(()=>{this.sessionsViewerOrientation===1&&e.clearFocus();let{changed:l}=this.updateSessionsControlVisibility();l&&this.relayout()})),this._register(t.onDidChangeViewModel(()=>{let l=t.viewModel?.model;if(this.titleControl?.update(l),this.sessionsViewerOrientation===1)return;let c=t.viewModel?.sessionResource;c&&(e.reveal(c)||e.clearFocus())})),this._register(this.agentSessionsService.model.onDidChangeSessions(()=>{if(this.sessionsViewerOrientation===1||e.hasFocusOrSelection())return;let l=t.viewModel?.sessionResource;l&&e.reveal(l)})),this._register(this.agentSessionsService.model.onDidChangeSessionArchivedState(l=>{if(l.isArchived()){let c=t.viewModel?.sessionResource;c&&ze(c,l.resource)&&this.clear()}})),this._register(ve(l=>{t.inputPart.height.read(l),this.sessionsViewerVisible&&this.sessionsViewerOrientation===1&&this.relayout()}));let r=this._register(new ue),s=()=>{if(r.value=new O,!this.configurationService.getValue("chat.viewProgressBadge.enabled")){this.activityBadge.clear();return}let l=t.viewModel?.model;l?r.value.add(ve(c=>{l.requestInProgress.read(c)?this.activityBadge.value=this.activityService.showViewActivity(this.id,{badge:new Jx(()=>d(9232,null))}):this.activityBadge.clear()})):this.activityBadge.clear()};this._register(t.onDidChangeViewModel(()=>s())),this._register(U.filter(this.configurationService.onDidChangeConfiguration,l=>l.affectsConfiguration("chat.viewProgressBadge.enabled"))(()=>s())),s()}setupContextMenu(e){this._register($(e,ne.CONTEXT_MENU,t=>{Kt.stop(t,!0),this.contextMenuService.showContextMenu({menuId:R.ChatWelcomeContext,contextKeyService:this.contextKeyService,getAnchor:()=>new Ln(Me(e),t)})}))}applyModel(){this.restoringSession=this._applyModel(),this.restoringSession.finally(()=>this.restoringSession=void 0)}async _applyModel(){let e=this.getTransferredOrPersistedSessionInfo(),t=e?await this.chatService.acquireOrLoadSession(e,"panel",Ie.None,"ChatViewPane#applyModel"):void 0;await this.showModel(Ie.None,t)}async showModel(e,t,o=!0){let n=this.modelRef.value?.object.sessionResource;this.modelRef.value=void 0;let r;if(o&&(r=t??(this.chatService.transferredSessionResource?await this.chatService.acquireOrLoadSession(this.chatService.transferredSessionResource,"panel",e,"ChatViewPane#showModel"):this.chatService.startNewLocalSession("panel",{debugOwner:"ChatViewPane#showModel"})),!r))throw new Error("Could not start chat session");if(e.isCancellationRequested){r?.dispose();return}this.modelRef.value=r;let s=r?.object;if(s){if(await this.updateWidgetLockState(yn(s.sessionResource)),e.isCancellationRequested){this.modelRef.value=void 0;return}this.viewState.sessionResource=s.sessionResource}if(this._widget.setModel(s),this.titleControl?.update(s),this.updateActions(),n){let l=n;this._register(Zo(()=>{let c=this.agentSessionsService.model.getSession(l);c&&!c.isMarkedUnread()&&c.setRead(!0)},0))}return s}async updateWidgetLockState(e){if(e===kl){this._widget.unlockFromCodingAgent();return}let t=!1;try{t=await this.chatSessionsService.canResolveChatSession(e)}catch(n){this.logService.warn(`Failed to resolve chat session type '${e}' for locking`,n)}if(!t){this._widget.unlockFromCodingAgent();return}let o=this.chatSessionsService.getChatSessionContribution(e);o?this._widget.lockToCodingAgent(o.name,o.displayName,e):this._widget.unlockFromCodingAgent()}async clear(){this.loadSessionCts.value?.cancel(),this.updateViewState(),await this.showModel(Ie.None),this.updateActions()}async loadSession(e){let t=Date.now();this.logService.trace(`[ChatViewPane] loadSession start uri=${e.toString()}`),this.loadSessionCts.value?.cancel();let o=this.loadSessionCts.value=new qe,n=o.token;if(this.restoringSession&&await this.restoringSession,n.isCancellationRequested){this.logService.trace(`[ChatViewPane] loadSession done total=${Date.now()-t}ms uri=${e.toString()} cancelled=true phase=preAcquire`);return}return this.progressService.withProgress({location:Xr,delay:200},async()=>{let r=Promise.resolve(),s=Zo(()=>{n.isCancellationRequested||this.loadSessionCts.value!==o||(r=this.showModel(n,void 0,!1).then(()=>{}))},100),l=n.onCancellationRequested(()=>s.dispose());try{let c=await this.chatService.acquireOrLoadSession(e,"panel",n,"ChatViewPane#loadSession");if(s.dispose(),await r,n.isCancellationRequested){c?.dispose(),this.logService.trace(`[ChatViewPane] loadSession done total=${Date.now()-t}ms uri=${e.toString()} cancelled=true phase=postAcquire`);return}let u=await this.showModel(n,c);return this.logService.trace(`[ChatViewPane] loadSession done total=${Date.now()-t}ms uri=${e.toString()}`),u}catch(c){if(s.dispose(),await r,n.isCancellationRequested){this.logService.trace(`[ChatViewPane] loadSession done total=${Date.now()-t}ms uri=${e.toString()} cancelled=true phase=error`);return}this.logService.error(`Failed to load chat session '${e.toString()}'`,c),this.notificationService.error(d(9230,null,Mn(c)));let u=await this.showModel(n,void 0);return this.logService.trace(`[ChatViewPane] loadSession done total=${Date.now()-t}ms uri=${e.toString()} error=true`),u}finally{l.dispose()}})}focus(){super.focus(),this.focusInput()}focusInput(){this._widget.focusInput()}focusSessions(){return this.sessionsContainer?.style.display==="none"?!1:(this.sessionsControl?.focus(),!0)}relayout(){this.lastDimensions&&this.layoutBody(this.lastDimensions.height,this.lastDimensions.width)}layoutBody(e,t){if(!this.layoutingBody){this.layoutingBody=!0;try{this.doLayoutBody(e,t)}finally{this.layoutingBody=!1}}}doLayoutBody(e,t){super.layoutBody(e,t),this.lastDimensions={height:e,width:t};let o=e,n=t,r=this.titleControl?.getHeight()??0;o-=r;let{heightReduction:s,widthReduction:l}=this.layoutSessionsControl(o,n);this._widget.setInputPartMaxHeightOverride(this.sessionsViewerOrientation===1?o:void 0),this._widget.layout(o-s,n-l),this.lastDimensionsPerOrientation.set(this.sessionsViewerOrientation,{height:e,width:t})}layoutSessionsControl(e,t){let o=0,n=0;if(!this.sessionsContainer||!this.sessionsControlContainer||!this.sessionsControl||!this.viewPaneContainer||!this.sessionsTitleContainer||!this.sessionsTitle)return{heightReduction:o,widthReduction:n};let r=this.sessionsViewerOrientation,s;if(this.sessionsViewerOrientationConfiguration==="stacked"?s=1:s=t>=U_.SESSIONS_SIDEBAR_VIEW_MIN_WIDTH?2:1,this.sessionsViewerOrientation=s,s===2?(this.viewPaneContainer.classList.toggle("sessions-control-orientation-sidebyside",!0),this.viewPaneContainer.classList.toggle("sessions-control-orientation-stacked",!1),this.sessionsViewerOrientationContext.set(2)):(this.viewPaneContainer.classList.toggle("sessions-control-orientation-sidebyside",!1),this.viewPaneContainer.classList.toggle("sessions-control-orientation-stacked",!0),this.sessionsViewerOrientationContext.set(1)),r!==this.sessionsViewerOrientation){let u=this.sessionsControl.update();this.sessionsViewerOrientation===2&&u.then(()=>{let p=this._widget?.viewModel?.sessionResource;p&&this.sessionsControl?.reveal(p)})}let{visible:l}=this.updateSessionsControlVisibility();if(!l||this.sessionsViewerOrientation===1?(this.sessionsViewerSashDisposables.clear(),this.sessionsViewerSash=void 0):this.sessionsViewerOrientation===2&&!this.sessionsViewerSashDisposables.value&&this.viewPaneContainer&&this.createSessionsViewerSash(this.viewPaneContainer,e,t),!l)return{heightReduction:0,widthReduction:0};let c=e-this.sessionsTitleContainer.offsetHeight;if(this.sessionsViewerOrientation===1?c-=Math.max(U_.MIN_CHAT_WIDGET_HEIGHT,this._widget?.input?.height.get()??0):c-=this.sessionsNewButtonContainer?.offsetHeight??0,this.sessionsViewerOrientation===2){let u=this.computeEffectiveSideBySideSessionsSidebarWidth(t);this.sessionsControlContainer.style.height=`${c}px`,this.sessionsControlContainer.style.width=`${u}px`,this.sessionsControl.layout(c,u),this.sessionsViewerSash?.layout(),o=0,n=this.sessionsContainer.offsetWidth}else this.sessionsControlContainer.style.height=`${c}px`,this.sessionsControlContainer.style.width="",this.sessionsControl.layout(c,t),o=this.sessionsContainer.offsetHeight,n=0;return{heightReduction:o,widthReduction:n}}computeEffectiveSideBySideSessionsSidebarWidth(e,t=this.sessionsViewerSidebarWidth){return Math.max(U_.SESSIONS_SIDEBAR_MIN_WIDTH,Math.min(t,e-U_.CHAT_WIDGET_DEFAULT_WIDTH))}getLastDimensions(e){return this.lastDimensionsPerOrientation.get(e)}createSessionsViewerSash(e,t,o){let n=this.sessionsViewerSashDisposables.value=new O,r=this.sessionsViewerSash=n.add(new kh(e,{getVerticalSashLeft:()=>{let l=this.computeEffectiveSideBySideSessionsSidebarWidth(this.lastDimensions?.width??o),{position:c}=this.getViewPositionAndLocation();return c===1?(this.lastDimensions?.width??o)-l:l}},{orientation:0})),s;n.add(r.onDidStart(()=>s=this.sessionsViewerSidebarWidth)),n.add(r.onDidEnd(()=>s=void 0)),n.add(r.onDidChange(l=>{if(s===void 0||!this.lastDimensions)return;let{position:c}=this.getViewPositionAndLocation(),u=l.currentX-l.startX,p=c===1?s-u:s+u;if(p<U_.SESSIONS_SIDEBAR_SNAP_THRESHOLD){this.updateConfiguredSessionsViewerOrientation("stacked");return}this.sessionsViewerSidebarWidth=this.computeEffectiveSideBySideSessionsSidebarWidth(this.lastDimensions.width,p),this.viewState.sessionsSidebarWidth=this.sessionsViewerSidebarWidth,this.layoutBody(this.lastDimensions.height,this.lastDimensions.width)})),n.add(r.onDidReset(()=>{this.sessionsViewerSidebarWidth=U_.SESSIONS_SIDEBAR_DEFAULT_WIDTH,this.viewState.sessionsSidebarWidth=this.sessionsViewerSidebarWidth,this.relayout()}))}saveState(){this._widget?.viewModel&&(this._widget.saveState(),this.updateViewState(),this.memento.saveMemento()),super.saveState()}updateViewState(e){let t=e??this._widget.getViewState();if(t)for(let[o,n]of Object.entries(t))this.viewState[o]=n}shouldShowWelcome(){let e=!this.chatService.hasSessions(),t=this.chatAgentService.getAgents().some(r=>r.isCore&&r.locations.includes("panel")),o=this.chatAgentService.getDefaultAgent("panel")!==void 0,n=!t&&(!o||!this._widget?.viewModel&&e);return this.logService.trace(`ChatViewPane#shouldShowWelcome() = ${n}: hasCoreAgent=${t} hasDefaultAgent=${o} || noViewModel=${!this._widget?.viewModel} && noPersistedSessions=${e}`),!!n}getMatchingWelcomeView(){return this.welcomeController?.getMatchingWelcomeView()}getActionsContext(){return this._widget?.viewModel?{sessionResource:this._widget.viewModel.sessionResource,$mid:19}:void 0}};U_=I([m(1,Le),m(2,Xe),m(3,B),m(4,X),m(5,ji),m(6,F),m(7,Je),m(8,Pe),m(9,ot),m(10,de),m(11,si),m(12,gr),m(13,re),m(14,Ne),m(15,wi),m(16,Ms),m(17,_e),m(18,to),m(19,Go),m(20,Vc),m(21,dr),m(22,fe),m(23,Al),m(24,Mt),m(25,ti)],U_);var wIn=Oe("chat-view-icon",L.chatSparkle,d(8104,null)),hct=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:T3,title:P(8081,"Chat"),icon:wIn,ctorDescriptor:new Vt(Qc,[T3,{mergeViewWithContainerWhenSingleView:!0}]),storageId:T3,hideIfEmpty:!0,order:1},2,{isDefault:!0,doNotRegisterOpenCommand:!0}),CIn={id:Xr,containerIcon:hct.icon,containerTitle:hct.title.value,singleViewPaneContainerTitle:hct.title.value,name:P(8081,"Chat"),canToggleVisibility:!1,canMoveView:!0,openCommandActionDescriptor:{id:T3,title:hct.title,mnemonicTitle:d(8105,null),keybindings:{primary:2599,mac:{primary:2343}},order:1},ctorDescriptor:new Vt(U_),when:C.and(Z.accountPolicyGateActive.negate(),C.or(C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),Z.panelParticipantRegistered,Z.extensionInvalid))};oe.as(Kn.ViewsRegistry).registerViews([CIn],hct);var xIn=zn.registerExtensionPoint({extensionPoint:"chatParticipants",jsonSchema:{description:d(8111,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name","id"],properties:{id:{description:d(8099,null),type:"string"},name:{description:d(8100,null),type:"string",pattern:"^[\\w-]+$"},fullName:{markdownDescription:d(8098,null,"`name`"),type:"string"},description:{description:d(8093,null),type:"string"},isSticky:{description:d(8090,null),type:"boolean"},sampleRequest:{description:d(8103,null),type:"string"},when:{description:d(8102,null),type:"string"},disambiguation:{description:d(8094,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{category:"",description:"",examples:[]}}],required:["category","description","examples"],properties:{category:{markdownDescription:d(8095,null),type:"string"},description:{description:d(8096,null),type:"string"},examples:{description:d(8097,null),type:"array"}}}},commands:{markdownDescription:d(8089,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{name:"",description:""}}],required:["name"],properties:{name:{description:d(8082,null),type:"string"},description:{description:d(8083,null),type:"string"},when:{description:d(8091,null),type:"string"},sampleRequest:{description:d(8088,null),type:"string"},isSticky:{description:d(8090,null),type:"boolean"},disambiguation:{description:d(8084,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{category:"",description:"",examples:[]}}],required:["category","description","examples"],properties:{category:{markdownDescription:d(8085,null),type:"string"},description:{description:d(8086,null),type:"string"},examples:{description:d(8087,null),type:"array"}}}}}}}}}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatParticipant:${i.id}`}}),Cbe=class{constructor(i){this._chatAgentService=i;this._participantRegistrationDisposables=new Ot;this.handleAndRegisterChatExtensions()}static{this.ID="workbench.contrib.chatExtensionPointHandler"}handleAndRegisterChatExtensions(){xIn.setHandler((i,e)=>{for(let t of e.added)for(let o of t.value){if(!o.name?.match(/^[\w-]+$/)){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT register participant with invalid name: ${o.name}. Name must match /^[\\w-]+$/.`);continue}if(o.fullName&&cY.getInstance(new Set).containsAmbiguousCharacter(o.fullName)){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT register participant with fullName that contains ambiguous characters: ${o.fullName}.`);continue}if(o.fullName&&mB.containsInvisibleCharacter(o.fullName.replace(/ /g,""))){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT register participant with fullName that contains invisible characters: ${o.fullName}.`);continue}if((o.isDefault||o.modes)&&!Va(t.description,"defaultChatParticipant")){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT use API proposal: defaultChatParticipant.`);continue}if(o.locations&&!Va(t.description,"chatParticipantAdditions")){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT use API proposal: chatParticipantAdditions.`);continue}if(!o.id||!o.name){t.collector.error(`Extension '${t.description.identifier.value}' CANNOT register participant without both id and name.`);continue}let n=[];o.disambiguation?.length&&n.push(...o.disambiguation.map(r=>({...r,category:r.category??r.categoryName})));try{let r=new O;r.add(this._chatAgentService.registerAgent(o.id,{extensionId:t.description.identifier,extensionVersion:t.description.version,publisherDisplayName:t.description.publisherDisplayName??t.description.publisher,extensionPublisherId:t.description.publisher,extensionDisplayName:t.description.displayName??t.description.name,id:o.id,description:o.description,when:o.when,metadata:{isSticky:o.isSticky,sampleRequest:o.sampleRequest},name:o.name,fullName:o.fullName,isDefault:o.isDefault,locations:Rr(o.locations)?o.locations.map(Ps.fromRaw):["panel"],modes:o.isDefault?o.modes??["ask"]:["agent","ask","edit"],slashCommands:o.commands??[],disambiguation:ui(n.flat())})),this._participantRegistrationDisposables.set(GLo(t.description.identifier,o.id),r)}catch(r){t.collector.error(`Failed to register participant ${o.id}: ${Mn(r,!0)}`)}}for(let t of e.removed)for(let o of t.value)this._participantRegistrationDisposables.deleteAndDispose(GLo(t.description.identifier,o.id))})}};Cbe=I([m(0,gr)],Cbe);function GLo(a,i){return`${a.value}_${i}`}var xbe=class extends k{constructor(e,t,o){super();this.productService=o;this.registeredWelcomeView=!1;let n=Z.extensionInvalid.bindTo(t);this._register(U.runAndSubscribe(e.onDidChangeExtensionsNotification,()=>{let s=e.getExtensionsNotification()?.extensions.find(l=>hi.equals(l.identifier.id,this.productService.defaultChatAgent?.chatExtensionId));s?(n.set(!0),this.registerWelcomeView(s)):n.set(!1)}))}static{this.ID="workbench.contrib.chatCompatNotifier"}registerWelcomeView(e){if(this.registeredWelcomeView)return;this.registeredWelcomeView=!0;let t=d(8110,null),o=d(8092,null,this.productService.nameLong),n=`[${t}](${nc(jNe,[this.productService.defaultChatAgent?.chatExtensionId])})`,r=`Copilot Chat version: ${e.version}`,s=oe.as(Kn.ViewsRegistry);this._register(s.registerViewWelcomeContent(Xr,{content:[o,n,r].join(`

`),when:Z.extensionInvalid}))}};xbe=I([m(0,Ui),m(1,X),m(2,Ze)],xbe);var dVi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.chatParticipants}render(e){let t=e.contributes?.chatParticipants?.filter(r=>!r.isDefault)??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(8109,null),d(8108,null),d(8107,null),d(8106,null)],n=t.map(r=>["@"+r.name,r.fullName,r.description??"-",r.commands?.length?new he(r.commands.map(s=>"- /"+s.name).join(`
`)):"-"]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatParticipants",label:d(8101,null),access:{canToggle:!1},renderer:new Vt(dVi)});var PHe=class extends k{constructor(e,t,o){super();this.quickInputService=e;this.chatService=t;this.instantiationService=o;this._onDidClose=this._register(new T)}get onDidClose(){return this._onDidClose.event}get enabled(){return!!this.chatService.isEnabled("panel")}get focused(){let e=this._input?.widget;return e?Is(e):!1}get sessionResource(){return this._input&&this._currentChat?.sessionResource}toggle(e){if(this.focused&&!e?.query)this.close();else if(this.open(e),e?.isPartialQuery){let t=this._store.add(U.once(this.onDidClose)(()=>{this._currentChat?.clearValue(),this._store.delete(t)}))}}open(e){if(this._input){if(this._currentChat&&e?.query){this._currentChat.focus(),this._currentChat.setValue(e.query,e.selection),e.isPartialQuery||this._currentChat.acceptInput();return}return this.focus()}let t=new O;this._input=this.quickInputService.createQuickWidget(),this._input.contextKey="chatInputVisible",this._input.ignoreFocusOut=!0,t.add(this._input),this._container??=_(".interactive-session"),this._input.widget=this._container,this._input.show(),this._currentChat?this._currentChat.show():(this._currentChat=this.instantiationService.createInstance(bre),this._currentChat.render(this._container)),t.add(this._input.onDidHide(()=>{t.dispose(),this._currentChat.hide(),this._input=void 0,this._onDidClose.fire()})),this._currentChat.focus(),e?.query&&(this._currentChat.setValue(e.query,e.selection),e.isPartialQuery||this._currentChat.acceptInput())}focus(){this._currentChat?.focus()}close(){this._input?.dispose(),this._input=void 0}async openInChatView(){await this._currentChat?.openChatView(),this.close()}};PHe=I([m(0,$e),m(1,si),m(2,F)],PHe);var bre=class extends k{constructor(e,t,o,n,r,s,l){super();this.instantiationService=e;this.contextKeyService=t;this.chatService=o;this.layoutService=n;this.chatWidgetService=r;this.chatEntitlementService=s;this.markdownRendererService=l;this.maintainScrollTimer=this._register(new ue);this._deferUpdatingDynamicLayout=!1}static{this.DEFAULT_MIN_HEIGHT=200}static{this.DEFAULT_HEIGHT_OFFSET=100}get sessionResource(){return this.modelRef?.object.sessionResource}clear(){return this.modelRef?.dispose(),this.modelRef=void 0,this.updateModel(),this.widget.inputEditor.setValue(""),Promise.resolve()}focus(e){if(this.widget){this.widget.focusInput();let t=this.widget.inputEditor.getValue();t&&this.widget.inputEditor.setSelection(e??{startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:t.length+1})}}hide(){this.widget.setVisible(!1),this.maintainScrollTimer.value=Zo(()=>{this.maintainScrollTimer.clear()},30*1e3)}show(){this.widget.setVisible(!0),this._deferUpdatingDynamicLayout&&(this._deferUpdatingDynamicLayout=!1,this.widget.updateDynamicChatTreeItemLayout(2,this.maxHeight)),this.maintainScrollTimer.value||this.widget.layoutDynamicChatTreeItemMode()}render(e){if(this.widget)throw new Error("Cannot render quick chat twice");let t=this._register(this.instantiationService.createChild(new Po([X,this._register(this.contextKeyService.createScoped(e))])));this.widget=this._register(t.createInstance(my,"panel",{isQuickChat:!0},{autoScroll:!0,renderInputOnTop:!0,renderStyle:"compact",menus:{inputSideToolbar:R.ChatInputSide,telemetrySource:"chatQuick"},enableImplicitContext:!0,defaultMode:Bc.Ask,clear:()=>this.clear()},{listForeground:dyt,listBackground:zCe,overlayBackground:ZT,inputEditorBackground:Hf,resultEditorBackground:Bo})),this.widget.render(e),this.widget.setVisible(!0),this.widget.setDynamicChatTreeItemLayout(2,this.maxHeight),this.updateModel(),this.sash=this._register(new kh(e,{getHorizontalSashTop:()=>e.offsetHeight},{orientation:1})),this.setupDisclaimer(e),this.registerListeners(e)}setupDisclaimer(e){let t=D(e,_(".disclaimer.hidden")),o=this._store.add(new O);this._register(ve(n=>{o.clear(),Ii(t);let r=this.chatEntitlementService.sentimentObs.read(n),s=this.chatEntitlementService.anonymousObs.read(n),l=this.chatService.requestInProgressObs.read(n),c=!r.completed&&s&&!l;if(t.classList.toggle("hidden",!c),c){let u=o.add(this.markdownRendererService.render(new he(d(9210,null,$i.defaultChatAgent?.provider?.default?.name??"",$i.defaultChatAgent?.provider?.default?.name??"",$i.defaultChatAgent?.termsStatementUrl??"",$i.defaultChatAgent?.privacyStatementUrl??""),{isTrusted:!0})));t.appendChild(u.element)}}))}get maxHeight(){return this.layoutService.mainContainerDimension.height-bre.DEFAULT_HEIGHT_OFFSET}registerListeners(e){this._register(this.layoutService.onDidLayoutMainContainer(()=>{this.widget.visible?this.widget.updateDynamicChatTreeItemLayout(2,this.maxHeight):this._deferUpdatingDynamicLayout=!0})),this._register(this.widget.onDidChangeHeight(o=>this.sash.layout()));let t=e.offsetWidth;this._register(this.sash.onDidStart(()=>{this.widget.isDynamicChatTreeItemLayoutEnabled=!1})),this._register(this.sash.onDidChange(o=>{o.currentY<bre.DEFAULT_MIN_HEIGHT||o.currentY>this.maxHeight||(this.widget.layout(o.currentY,t),this.sash.layout())})),this._register(this.sash.onDidReset(()=>{this.widget.isDynamicChatTreeItemLayoutEnabled=!0,this.widget.layoutDynamicChatTreeItemMode()}))}async acceptInput(){return this.widget.acceptInput()}async openChatView(){let e=await this.chatWidgetService.revealWidget(),t=this.modelRef?.object;if(!e?.viewModel||!t)return;for(let n of t.getRequests())if(n.response?.response.value||n.response?.result){let r=[];for(let s of n.response.response.value)if(s.kind==="textEditGroup")for(let l of s.edits)r.push({kind:"textEdit",edits:l,uri:s.uri});else if(s.kind==="notebookEditGroup")for(let l of s.edits)nMe(l)?r.push({kind:"textEdit",edits:l.map(c=>c.edit),uri:l[0].uri}):r.push({kind:"notebookEdit",edits:l,uri:s.uri});else r.push(s);this.chatService.addCompleteRequest(e.viewModel.sessionResource,n.message,n.variableData,n.attempt,{message:r,result:n.response.result,followups:n.response.followups})}else n.message;let o=this.widget.getViewState();o&&e.viewModel.model.inputModel.setState(o),e.focusInput()}setValue(e,t){this.widget.inputEditor.setValue(e),this.focus(t)}clearValue(){this.widget.inputEditor.setValue("")}updateModel(){this.modelRef??=this.chatService.startNewLocalSession("panel",{disableBackgroundKeepAlive:!0,debugOwner:"ChatQuick#updateModel"});let e=this.modelRef?.object;if(!e)throw new Error("Could not start chat session");this.modelRef.object.inputModel.setState({inputText:"",selections:[]}),this.widget.setModel(e)}dispose(){this.modelRef?.dispose(),this.modelRef=void 0,super.dispose()}};bre=I([m(0,F),m(1,X),m(2,si),m(3,wi),m(4,Lt),m(5,dr),m(6,_n)],bre);var $4t=class{constructor(){this.priority=115;this.name="chatTerminalOutput";this.type="view";this.when=Z.inChatTerminalToolOutput}getProvider(i){let t=i.get(tg).getFocusedProgressPart();if(!t)return;let o=t.getCommandAndOutputAsText();if(o)return new qp("chatTerminalOutput",{type:"view",id:"chatTerminalOutput",language:"text"},()=>o,()=>t.focusOutput(),"accessibility.verbosity.terminalChatOutput")}};var gct={chatRefreshTokenCommand:$i.defaultChatAgent?.chatRefreshTokenCommand??"",providerExtensionId:$i.defaultChatAgent?.providerExtensionId??""};function fct(a){a.executeCommand(gct.chatRefreshTokenCommand)}async function j4t(a,i){if(!gct.providerExtensionId)return!1;let e=a.local.find(t=>hi.equals(t.identifier.id,gct.providerExtensionId));if(!e)return!1;if(e.enablementState===10||e.enablementState===11){i.info(`[chat setup] auth provider extension '${gct.providerExtensionId}' is disabled, re-enabling it`);try{return await a.setEnablement([e],12),await a.updateRunningExtensions(d(8160,null)),!0}catch(t){return i.error(`[chat setup] failed to re-enable auth provider extension '${gct.providerExtensionId}'`,t),!1}}return!1}var iL={chatExtensionId:$i.defaultChatAgent?.chatExtensionId??"",provider:$i.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},providerUriSetting:$i.defaultChatAgent?.providerUriSetting??"",completionsAdvancedSetting:$i.defaultChatAgent?.completionsAdvancedSetting??""},AHe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.context=e;this.requests=t;this.telemetryService=o;this.extensionsWorkbenchService=n;this.logService=r;this.progressService=s;this.activityService=l;this.commandService=c;this.dialogService=u;this.configurationService=p;this.lifecycleService=h;this.quickInputService=g;this.defaultAccountService=f;this.productService=v;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._step=1;this.registerListeners()}get step(){return this._step}registerListeners(){this._register(this.context.onDidChange(()=>this._onDidChange.fire()))}setStep(e){this._step!==e&&(this._step=e,this._onDidChange.fire())}async setup(e={}){let t=new On(!1),o=d(8182,null),n=this.activityService.showViewContainerActivity(T3,{badge:new Jx(()=>o)});try{return await this.progressService.withProgress({location:10,command:tk,title:o},()=>this.doSetup(e,t))}finally{n.dispose()}}async doSetup(e,t){this.context.suspend();let o=!1;try{let n,r;if(e.forceSignIn?r=!0:this.context.state.entitlement===1?e.forceAnonymous?r=!1:r=!0:r=!1,r){this.setStep(2);let s=await this.signIn(e);if(!s.defaultAccount){let l=e.useSocialProvider??(e.useEnterpriseProvider?iL.provider.enterprise.id:iL.provider.default.id);this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedNotSignedIn",installDuration:t.elapsed(),signUpErrorCode:void 0,provider:l});return}n=s.entitlement}this.setStep(3),o=await this.install(n??this.context.state.entitlement,t,e)}finally{this.setStep(1),this.context.resume()}return o}async signIn(e){await j4t(this.extensionsWorkbenchService,this.logService)&&fct(this.commandService);let o,n;try{({defaultAccount:n,entitlements:o}=await this.requests.signIn(e))}catch(r){this.logService.error(`[chat setup] signIn: error ${r}`)}if(!n&&!this.lifecycleService.willShutdown){let{confirmed:r}=await this.dialogService.confirm({type:wt.Error,message:d(8184,null,this.defaultAccountService.getDefaultAccountAuthenticationProvider().name),detail:d(8185,null),primaryButton:d(8181,null)});if(r)return this.signIn(e)}return{defaultAccount:n,entitlement:o?.entitlement}}async install(e,t,o){let n=this.context.state.completed&&!this.context.state.disabled,r,s;o.forceAnonymous&&e===1?s="anonymous":s=o.useSocialProvider??(o.useEnterpriseProvider?iL.provider.enterprise.id:iL.provider.default.id);try{if(!o.forceAnonymous&&e!==5&&!O0(e)&&e!==4){if(r=await this.requests.signUpFree(),bn(r))return this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedNoSession",installDuration:t.elapsed(),signUpErrorCode:void 0,provider:s}),!1;typeof r!="boolean"&&this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedSignUp",installDuration:t.elapsed(),signUpErrorCode:r.errorCode,provider:s})}await this.doInstallWithRetry()}catch(l){return this.logService.error(`[chat setup] install: error ${l}`),this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:Yi(l)?"cancelled":"failedInstall",installDuration:t.elapsed(),signUpErrorCode:void 0,provider:s}),!1}return(typeof r=="boolean"||typeof r>"u")&&this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:n&&!r?"alreadyInstalled":"installed",installDuration:t.elapsed(),signUpErrorCode:void 0,provider:s}),n&&fct(this.commandService),!0}async doInstallWithRetry(){let e;try{await this.doInstall()}catch(t){this.logService.error(`[chat setup] install: error ${e}`),e=t}if(e){if(!this.lifecycleService.willShutdown){let{confirmed:t}=await this.dialogService.confirm({type:wt.Error,message:d(8183,null),detail:e&&!Yi(e)?Mn(e):void 0,primaryButton:d(8181,null)});if(t)return this.doInstallWithRetry()}throw e}}async doInstall(){await this.extensionsWorkbenchService.install(iL.chatExtensionId,{enable:!0,isApplicationScoped:!0,isMachineScoped:!1,installEverywhere:!0,installPreReleaseVersion:this.productService.quality!=="stable"},Xr)}async setupWithProvider(e){if(oe.as($t.Configuration).registerConfiguration({id:"copilot.setup",type:"object",properties:{[iL.completionsAdvancedSetting]:{type:"object",properties:{authProvider:{type:"string"}}},[iL.providerUriSetting]:{type:"string"}}}),e.useEnterpriseProvider){let n=await this.handleEnterpriseInstance();if(!n)return this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedEnterpriseSetup",installDuration:0,signUpErrorCode:void 0,provider:void 0}),n}let o=this.configurationService.inspect(iL.completionsAdvancedSetting).user?.value;return Di(o)||(o={}),e.useEnterpriseProvider?await this.configurationService.updateValue(`${iL.completionsAdvancedSetting}`,{...o,authProvider:iL.provider.enterprise.id},2):await this.configurationService.updateValue(`${iL.completionsAdvancedSetting}`,Object.keys(o).length>0?{...o,authProvider:void 0}:void 0,2),this.setup({...e,forceSignIn:!0})}async handleEnterpriseInstance(){let e=/^[a-zA-Z\-_]+$/,t=/^(https:\/\/)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.ghe\.com\/?$/,o=this.configurationService.getValue(iL.providerUriSetting);if(typeof o=="string"&&t.test(o))return!0;let n=!1,r=await this.quickInputService.input({prompt:d(8178,null,iL.provider.enterprise.name),placeHolder:d(8179,null),ignoreFocusLost:!0,value:o,validateInput:async l=>{if(n=!1,!!l){if(e.test(l))return n=!0,{content:d(8186,null,`https://${l}.ghe.com`),severity:wt.Info};if(!t.test(l))return{content:d(8180,null,iL.provider.enterprise.name),severity:wt.Error}}}});if(!r)return;let s=r;return n?s=`https://${s}.ghe.com`:r.toLowerCase().startsWith("https://")||(s=`https://${r}`),await this.configurationService.updateValue(iL.providerUriSetting,s,2),!0}};AHe=I([m(2,_e),m(3,Ui),m(4,re),m(5,Go),m(6,Al),m(7,fe),m(8,ct),m(9,B),m(10,to),m(11,$e),m(12,Nd),m(13,Ze)],AHe);var MV=class extends k{constructor(e,t,o,n){super();this.storageService=e;this.chatWidgetService=t;this.lifecycleService=o;this.logService=n;this._onDidChangeChatSessionItems=this._register(new T);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._onDidDismiss=this._register(new T);this.onDidDismiss=this._onDidDismiss.event;this._created=Date.now();this._dismissed=this.storageService.getBoolean(MV.STORAGE_KEY,-1,!1),this.lifecycleService.when(3).then(()=>{this._store.isDisposed||this._dismissed||this._register(this.chatWidgetService.onDidAddWidget(()=>{this.dismiss()}))})}static{this.STORAGE_KEY="chat.growthSession.dismissed"}static{this.SESSION_URI=A.from({scheme:zo.Growth,path:"/growth-welcome"})}get isDismissed(){return this._dismissed}get items(){return this._dismissed?[]:[{resource:MV.SESSION_URI,label:d(8189,null),description:d(8188,null),status:3,iconPath:L.lightbulb,timing:{created:this._created,lastRequestStarted:void 0,lastRequestEnded:void 0}}]}async refresh(){}dismiss(){this._dismissed||(this.logService.trace("[GrowthSession] Dismissing growth session"),this._dismissed=!0,this.storageService.store(MV.STORAGE_KEY,!0,-1,0),this._onDidChangeChatSessionItems.fire({removed:[MV.SESSION_URI]}),this._onDidDismiss.fire())}};MV=I([m(0,de),m(1,Lt),m(2,to),m(3,re)],MV);var uVi=class{async handleOpenSession(i,e,t){if(e.providerType!==zo.Growth)return!1;let o=i.get(fe),n={query:"",isPartialQuery:!0,previousRequests:[{request:d(8190,null),response:d(8191,null)}]};return await o.executeCommand(tk,n),!0}};function qLo(a,i){let e=new O;return e.add(a.registerChatSessionItemController(zo.Growth,i)),e.add(nFi.registerParticipant(new uVi)),e}W(class extends z{constructor(){super({id:"workbench.action.chat.resetGrowthSession",title:P(8192,"Reset Growth Session Notification"),category:P(8187,"Developer"),f1:!0})}run(i){i.get(de).remove(MV.STORAGE_KEY,-1)}});var PV={publicCodeMatchesUrl:$i.defaultChatAgent?.publicCodeMatchesUrl??"",provider:$i.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},chatRefreshTokenCommand:$i.defaultChatAgent?.chatRefreshTokenCommand??"",termsStatementUrl:$i.defaultChatAgent?.termsStatementUrl??"",privacyStatementUrl:$i.defaultChatAgent?.privacyStatementUrl??""},EO=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.context=i;this.controller=e;this.telemetryService=t;this.layoutService=o;this.keybindingService=n;this.chatEntitlementService=r;this.logService=s;this.widgetService=l;this.workspaceTrustRequestService=c;this.markdownRendererService=u;this.defaultAccountService=p;this.hostService=h;this.pendingRun=void 0;this.skipDialogOnce=!1}static{this.instance=void 0}static getInstance(i,e,t){let o=EO.instance;return o||(o=EO.instance=i.invokeFunction(n=>new EO(e,t,n.get(_e),n.get(wi),n.get(Le),n.get(dr),n.get(re),n.get(Lt),n.get(lp),n.get(_n),n.get(Nd),n.get(ti)))),o}skipDialog(){this.skipDialogOnce=!0}async run(i){if(this.pendingRun)return this.pendingRun;this.pendingRun=this.doRun(i);try{return await this.pendingRun}finally{this.pendingRun=void 0}}async doRun(i){this.context.update({later:!1});let e=this.skipDialogOnce;if(this.skipDialogOnce=!1,!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(8215,null)}))return this.context.update({later:!0}),this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedNotTrusted",installDuration:0,signUpErrorCode:void 0,provider:void 0}),{dialogSkipped:e,success:void 0};let o;i?.setupStrategy!==void 0?o=i.setupStrategy:!i?.forceSignInDialog&&(e||O0(this.chatEntitlementService.entitlement)||this.chatEntitlementService.entitlement===5)?o=1:i?.forceAnonymous===2?o=1:o=await this.showDialog(i),o===1&&this.defaultAccountService.getDefaultAccountAuthenticationProvider().enterprise&&(o=3),o!==0&&i?.onSignInStarted?.(),o!==0&&!i?.disableChatViewReveal&&this.widgetService.revealWidget();let n;try{switch(o){case 3:n=await this.controller.value.setupWithProvider({useEnterpriseProvider:!0,useSocialProvider:void 0,additionalScopes:i?.additionalScopes,forceAnonymous:i?.forceAnonymous});break;case 2:n=await this.controller.value.setupWithProvider({useEnterpriseProvider:!1,useSocialProvider:void 0,additionalScopes:i?.additionalScopes,forceAnonymous:i?.forceAnonymous});break;case 5:n=await this.controller.value.setupWithProvider({useEnterpriseProvider:!1,useSocialProvider:"apple",additionalScopes:i?.additionalScopes,forceAnonymous:i?.forceAnonymous});break;case 4:n=await this.controller.value.setupWithProvider({useEnterpriseProvider:!1,useSocialProvider:"google",additionalScopes:i?.additionalScopes,forceAnonymous:i?.forceAnonymous});break;case 1:n=await this.controller.value.setup({...i,forceAnonymous:i?.forceAnonymous});break;case 0:this.context.update({later:!0}),this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedMaybeLater",installDuration:0,signUpErrorCode:void 0,provider:void 0});break}}catch(r){this.logService.error(`[chat setup] Error during setup: ${Mn(r)}`),n=!1}return n&&this.context.update({completed:!0}),{success:n,dialogSkipped:e}}async showDialog(i){let e=new O,t=this.getButtons(i),o=e.add(new jte(this.layoutService.activeContainer,this.getDialogTitle(i),t.map(r=>r[0]),GPe({type:"none",extraClasses:["chat-setup-dialog"],detail:" ",icon:i?.dialogIcon??L.copilotLarge,alignment:1,cancelId:t.length,disableCloseButton:i?.disableCloseButton??!1,renderFooter:r=>r.appendChild(this.createDialogFooter(e,i)),buttonOptions:t.map(r=>r[2])},this.keybindingService,this.layoutService,this.hostService))),{button:n}=await o.show();return e.dispose(),t[n]?.[1]??0}getButtons(i){let e=(...o)=>({styleButton:n=>n.element.classList.add(...o)}),t;if(!i?.forceAnonymous&&(this.context.state.entitlement===1||i?.forceSignInDialog)){let o=[d(8216,null,PV.provider.default.name),2,e("continue-button","default")],n=[o[0],o[1],e("link-button")],r=[d(8216,null,PV.provider.enterprise.name),3,e("continue-button","default")],s=[r[0],r[1],e("link-button")],l=[d(8216,null,PV.provider.google.name),4,e("continue-button","google")],c=[d(8216,null,PV.provider.apple.name),5,e("continue-button","apple")];this.defaultAccountService.getDefaultAccountAuthenticationProvider().enterprise?t=ui([r,l,c,n]):t=ui([o,l,c,s])}else t=[[d(8220,null),1,void 0]];return t}getDialogTitle(i){return i?.dialogTitle?i.dialogTitle:this.chatEntitlementService.anonymous?i?.forceAnonymous?d(8222,null):d(8217,null):this.context.state.entitlement===1||i?.forceSignInDialog?d(8221,null):d(8222,null)}createDialogFooter(i,e){let t=_(".chat-setup-dialog-footer"),o;return e?.forceAnonymous||this.telemetryService.telemetryLevel===0?o=d(8219,null,PV.provider.default.name,PV.termsStatementUrl,PV.privacyStatementUrl):o=d(8218,null,PV.provider.default.name,PV.termsStatementUrl,PV.privacyStatementUrl,PV.provider.default.name,PV.publicCodeMatchesUrl,this.defaultAccountService.resolveGitHubUrl(SM.copilotSettings)),t.appendChild(_("p",void 0,i.add(this.markdownRendererService.render(new he(o,{isTrusted:!0}))).element)),t}};EO=I([m(2,_e),m(3,Kl),m(4,Le),m(5,dr),m(6,re),m(7,Lt),m(8,lp),m(9,_n),m(10,Nd),m(11,ti)],EO);var $P={extensionId:$i.defaultChatAgent?.extensionId??"",chatExtensionId:$i.defaultChatAgent?.chatExtensionId??"",provider:$i.defaultChatAgent?.provider??{default:{id:"",name:""},enterprise:{id:"",name:""},apple:{id:"",name:""},google:{id:"",name:""}},outputChannelId:$i.defaultChatAgent?.chatExtensionOutputId??"",outputExtensionStateCommand:$i.defaultChatAgent?.chatExtensionOutputExtensionStateCommand??""},TIn=C.and(C.equals("config.chat.agent.enabled",!0),C.not("previewFeaturesDisabled")),bS=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.context=e;this.controller=t;this.location=o;this.instantiationService=n;this.logService=r;this.telemetryService=s;this.environmentService=l;this.workspaceTrustManagementService=c;this.chatEntitlementService=u;this.viewsService=p;this.contextKeyService=h;this.outputService=g;this.extensionsWorkbenchService=f;this.commandService=v;this._onUnresolvableError=this._register(new T);this.onUnresolvableError=this._onUnresolvableError.event;this.pendingForwardedRequests=new dt;this.registerCommands()}static registerDefaultAgents(e,t,o,n,r){return e.invokeFunction(s=>{let l=s.get(gr),c;o==="ask"?c=Bc.Ask.description.get():o==="edit"?c=Bc.Edit.description.get():c=Bc.Agent.description.get();let u;switch(t){case"panel":o==="ask"?u="setup.chat":o==="edit"?u="setup.edits":u="setup.agent";break;case"terminal":u="setup.terminal";break;case"editor":u="setup.editor";break;case"notebook":u="setup.notebook";break}return bS.doRegisterAgent(e,l,u,`${$P.provider.default.name} Copilot`,!0,c,t,o,n,r)})}static registerBuiltInAgents(e,t,o){return e.invokeFunction(n=>{let r=n.get(gr),s=new O,{disposable:l}=bS.doRegisterAgent(e,r,"setup.vscode","vscode",!1,P(8211,"Ask questions about VS Code").value,"panel","agent",t,o);s.add(l);let{disposable:c}=bS.doRegisterAgent(e,r,"setup.workspace","workspace",!1,P(8214,"Ask about your workspace").value,"panel","agent",t,o);s.add(c);let{disposable:u}=bS.doRegisterAgent(e,r,"setup.terminal.agent","terminal",!1,P(8209,"Ask how to do something in the terminal").value,"panel","agent",t,o);return s.add(u),s.add(pVi.registerTool(e,{id:"setup_tools_createNewWorkspace",source:wn.Internal,icon:L.newFolder,displayName:d(8206,null),modelDescription:"Scaffold a new workspace in VS Code",userDescription:d(8207,null),canBeReferencedInPrompt:!0,toolReferenceName:"new",when:C.true()})),s})}static doRegisterAgent(e,t,o,n,r,s,l,c,u,p){let h=new O;h.add(t.registerAgent(o,{id:o,name:n,isDefault:r,isCore:!0,modes:[c],when:c==="agent"?TIn?.serialize():void 0,slashCommands:[],disambiguation:[],locations:[l],metadata:{helpTextPrefix:bS.SETUP_NEEDED_MESSAGE},description:s,extensionId:o_e.identifier,extensionVersion:void 0,extensionDisplayName:o_e.name,extensionPublisherId:o_e.publisher}));let g=h.add(e.createInstance(bS,u,p,l));return h.add(t.registerAgentImplementation(o,g)),c==="agent"&&t.updateAgent(o,{themeIcon:L.tools}),{agent:g,disposable:h}}static{this.SETUP_NEEDED_MESSAGE=new he(d(8204,null))}static{this.TRUST_NEEDED_MESSAGE=new he(d(8210,null))}static{this.CHAT_RETRY_COMMAND_ID="workbench.action.chat.retrySetup"}static{this.CHAT_SHOW_OUTPUT_COMMAND_ID="workbench.action.chat.showOutput"}registerCommands(){this._register(Ge.registerCommand(bS.CHAT_RETRY_COMMAND_ID,async(e,t)=>{let o=e.get(ti);await e.get(Lt).getWidgetBySessionResource(t)?.clear(),o.reload()})),this._register(Ge.registerCommand(bS.CHAT_SHOW_OUTPUT_COMMAND_ID,async e=>{let t=e.get(fe);$P.outputExtensionStateCommand&&Uu(t.executeCommand($P.outputExtensionStateCommand),5e3,()=>this.logService.info("[chat setup] Timed out executing extension state command")).then(void 0,o=>{this.logService.info("[chat setup] Failed to execute extension state command",o)}),$P.outputChannelId&&await t.executeCommand(`workbench.action.output.show.${$P.outputChannelId}`)}))}async invoke(e,t){return this.instantiationService.invokeFunction(async o=>{let n=o.get(si),r=o.get(Gr),s=o.get(Lt),l=o.get(gr),c=o.get(Wn),u=o.get(Nd);return this.doInvoke(e,p=>t([p]),n,r,s,l,c,u)})}async doInvoke(e,t,o,n,r,s,l,c){let u=this.chatEntitlementService.hasByokModels;return!this.context.state.completed&&!u||this.context.state.disabled||this.context.state.untrusted||this.context.state.entitlement===3||this.context.state.entitlement===1&&!this.chatEntitlementService.anonymous&&!u?this.doInvokeWithSetup(e,t,o,n,r,s,l,c):this.doInvokeWithoutSetup(e,t,o,n,r,s,l)}async doInvokeWithoutSetup(e,t,o,n,r,s,l){let c=r.getWidgetBySessionResource(e.sessionResource)?.viewModel?.model.getRequests().at(-1);return c?(t({kind:"progressMessage",content:new he(d(8212,null)),shimmer:!0}),await this.forwardRequestToChat(c,t,o,n,s,r,l),{}):(this.logService.error("[chat setup] Request model not found, cannot redispatch request."),{})}async forwardRequestToChat(e,t,o,n,r,s,l){try{await this.doForwardRequestToChat(e,t,o,n,r,s,l)}catch(c){this.logService.error("[chat setup] Failed to forward request to chat",c),t({kind:"warning",content:new he(d(8197,null))})}}async doForwardRequestToChat(e,t,o,n,r,s,l){if(this.pendingForwardedRequests.has(e.session.sessionResource))throw new Error("Request already in progress");let c=this.doForwardRequestToChatWhenReady(e,t,o,n,r,s,l);this.pendingForwardedRequests.set(e.session.sessionResource,c);try{await c}finally{this.pendingForwardedRequests.delete(e.session.sessionResource)}}async doForwardRequestToChatWhenReady(e,t,o,n,r,s,l){await j4t(this.extensionsWorkbenchService,this.logService)&&fct(this.commandService);let u=s.getWidgetBySessionResource(e.session.sessionResource),p=u?.input.currentModeInfo,h=!1,g=!1,f=!1,v=!1;oSi(iSi.WillWaitForActivation);let b=this.whenAgentActivated(o).then(()=>h=!0),S=this.whenAgentReady(r,p?.kind)?.then(()=>g=!0);S||(g=!0);let y=this.whenLanguageModelReady(n,e.modelId)?.then(()=>f=!0);y||(f=!0);let w=this.whenToolsModelReady(l,e)?.then(()=>v=!0);if(w||(v=!0),y instanceof Promise||S instanceof Promise||w instanceof Promise){let x=setTimeout(()=>{t({kind:"progressMessage",content:new he(d(8213,null)),shimmer:!0})},1e4),E=new O;E.add(ee(()=>clearTimeout(x)));try{let M=Promise.allSettled([b,S,y,w]),N=await Promise.race([Li(this.environmentService.remoteAuthority?6e4:2e4).then(()=>"timedout"),this.whenPanelAgentHasGuidance(E).then(()=>"panelGuidance"),M]);if(N==="panelGuidance"){let V=d(8196,null);t({kind:"markdownContent",content:new he(V)}),this._onUnresolvableError.fire();return}if(N==="timedout"){let V;this.chatEntitlementService.anonymous?V=d(8195,null,$P.chatExtensionId):V=d(8194,null,$P.provider.default.name,$P.chatExtensionId);let H=this.computeDiagnosticInfo(h,g,f,v,e,n,r,p);this.logService.warn(`[chat setup] ${V}`,H),this.telemetryService.publicLog2("chatSetup.timeout",H),t({kind:"warning",content:new he(V)}),$P.outputChannelId&&this.outputService.getChannelDescriptor($P.outputChannelId)?t({kind:"command",command:{id:bS.CHAT_SHOW_OUTPUT_COMMAND_ID,title:d(8208,null)}}):(this.logService.warn($P.outputChannelId?`[chat setup] No output channel found for id '${$P.outputChannelId}' to show details about chat setup timeout. Please ensure the ${$P.chatExtensionId} extension is activated.`:"[chat setup] No output channel provided via product.json to show details about chat setup timeout."),t({kind:"command",command:{id:bS.CHAT_RETRY_COMMAND_ID,title:d(8203,null),arguments:[e.session.sessionResource]}})),await M;let K=this.computeDiagnosticInfo(h,g,f,v,e,n,r,p);this.logService.info("[chat setup] Chat setup timeout recovered",K),this.telemetryService.publicLog2("chatSetup.timeoutRecovery",K)}}finally{E.dispose()}}oSi(iSi.DidWaitForActivation),await o.resendRequest(e,{...u?.getModeRequestOptions(),modeInfo:p,userSelectedModelId:u?.input?.currentLanguageModel})}async whenPanelAgentHasGuidance(e){let t=()=>u1.get().some(o=>this.contextKeyService.contextMatchesRules(o.when));if(!t())return new Promise(o=>{let n=new Set,r=()=>{let c=u1.get();n=new Set(c.flatMap(u=>u.when.keys()))};r();let s=U.map(u1.onDidChange,()=>"registry"),l=U.map(U.filter(this.contextKeyService.onDidChangeContext,c=>c.affectsSome(n)),()=>"context");e.add(U.any(s,l)(c=>{c==="registry"&&r(),t()&&o()}))})}whenLanguageModelReady(e,t){let o=()=>{if(t)return!!e.lookupLanguageModel(t);for(let n of e.getLanguageModelIds())if(e.lookupLanguageModel(n)?.isDefaultForLocation.panel)return!0;return!1};if(!o())return U.toPromise(U.filter(e.onDidChangeLanguageModels,()=>o()))}whenToolsModelReady(e,t){if(t.message.parts.some(n=>n instanceof iw)){for(let n of e.getAllToolsIncludingDisabled())if(n.id.startsWith("copilot_"))return;return U.toPromise(U.filter(e.onDidChangeTools,()=>{for(let n of e.getAllToolsIncludingDisabled())if(n.id.startsWith("copilot_"))return!0;return!1}))}}whenAgentReady(e,t){let o=e.getDefaultAgent(this.location,t);if(!(o&&!o.isCore))return U.toPromise(U.filter(e.onDidChangeAgents,()=>{let n=e.getDefaultAgent(this.location,t);return!!(n&&!n.isCore)}))}async whenAgentActivated(e){try{await e.activateDefaultAgent(this.location)}catch(t){this.logService.error(t)}}computeDiagnosticInfo(e,t,o,n,r,s,l,c){let u=s.getLanguageModelIds(),p=0;for(let b of u)s.lookupLanguageModel(b)?.isDefaultForLocation.panel&&p++;let h=l.getDefaultAgent(this.location,c?.kind),g=l.getContributedDefaultAgent(this.location),f=this.viewsService.getActiveViewWithId(Xr),v=f?.getMatchingWelcomeView();return{agentActivated:e,agentReady:t,agentHasDefault:!!h,agentDefaultIsCore:h?.isCore??!1,agentHasContributedDefault:!!g,agentContributedDefaultIsCore:g?.isCore??!1,agentActivatedCount:l.getActivatedAgents().length,agentLocation:this.location,agentModeKind:c?.kind??"",languageModelReady:o,languageModelCount:u.length,languageModelDefaultCount:p,languageModelHasRequestedModel:!!r.modelId,toolsModelReady:n,isRemote:!!this.environmentService.remoteAuthority,isAnonymous:this.chatEntitlementService.anonymous,matchingWelcomeViewWhen:v?.when.serialize()??(f?"noWelcomeView":"noChatViewPane")}}async doInvokeWithSetup(e,t,o,n,r,s,l,c){this.telemetryService.publicLog2("workbenchActionExecuted",{id:aS,from:"chat"});let u=r.getWidgetBySessionResource(e.sessionResource),p=u?.viewModel?.model.getRequests().at(-1),h=U.runAndSubscribe(this.controller.value.onDidChange,(()=>{switch(this.controller.value.step){case 2:t({kind:"progressMessage",content:new he(d(8205,null,c.getDefaultAccountAuthenticationProvider().name)),shimmer:!0});break;case 3:t({kind:"progressMessage",content:new he(d(8201,null)),shimmer:!0});break}})),g;try{g=await EO.getInstance(this.instantiationService,this.context,this.controller).run({disableChatViewReveal:!0,forceAnonymous:this.chatEntitlementService.anonymous?2:void 0})}catch(f){this.logService.error(`[chat setup] Error during setup: ${Mn(f)}`)}finally{h.dispose()}if(typeof g?.success=="boolean")if(g.success){if(g.dialogSkipped)await u?.clear();else if(p){let f=this.replaceAgentInRequestModel(p,s);f=this.replaceToolInRequestModel(f),await this.forwardRequestToChat(f,t,o,n,s,r,l)}}else t({kind:"warning",content:new he(d(8193,null))});else t({kind:"markdownContent",content:this.workspaceTrustManagementService.isWorkspaceTrusted()?bS.SETUP_NEEDED_MESSAGE:bS.TRUST_NEEDED_MESSAGE});return{}}replaceAgentInRequestModel(e,t){let o=e.message.parts.find(l=>l instanceof Qp);if(!o)return e;let n=o.agent.id.replace(/setup\./,`${$P.extensionId}.`.toLowerCase()),r=t.getAgent(n);if(!r)return e;let s=new Qp(o.range,o.editorRange,r);return new lU({session:e.session,message:{parts:e.message.parts.map(l=>l instanceof Qp?s:l),text:e.message.text},variableData:e.variableData,timestamp:Date.now(),attempt:e.attempt,modeInfo:e.modeInfo,confirmation:e.confirmation,locationData:e.locationData,attachedContext:e.attachedContext,isCompleteAddedRequest:e.isCompleteAddedRequest})}replaceToolInRequestModel(e){let t=e.message.parts.find(l=>l instanceof iw);if(!t)return e;let o=t.toolId.replace(/setup.tools\./,"copilot_".toLowerCase()),n=new iw(t.range,t.editorRange,t.toolName,o,t.displayName,t.icon),r={id:o,name:"new",range:t.range,kind:"tool",value:void 0},s={variables:[r]};return new lU({session:e.session,message:{parts:e.message.parts.map(l=>l instanceof iw?n:l),text:e.message.text},variableData:s,timestamp:Date.now(),attempt:e.attempt,modeInfo:e.modeInfo,confirmation:e.confirmation,locationData:e.locationData,attachedContext:[r],isCompleteAddedRequest:e.isCompleteAddedRequest})}};bS=I([m(3,F),m(4,re),m(5,_e),m(6,Mt),m(7,Or),m(8,dr),m(9,Gt),m(10,X),m(11,Tl),m(12,Ui),m(13,fe)],bS);var pVi=class a{static registerTool(i,e){return i.invokeFunction(t=>{let o=t.get(Wn),n=i.createInstance(a);return o.registerTool(e,n)})}async invoke(i,e,t,o){return{content:[{kind:"text",value:""}]}}async prepareToolInvocation(i,e){}},Sre=class{constructor(i,e,t,o){this.context=i;this.controller=e;this.instantiationService=t;this.chatEntitlementService=o}static registerProvider(i,e,t){return i.invokeFunction(o=>{let n=o.get(Jt),r=i.createInstance(Sre,e,t);return n.newSymbolNamesProvider.register("*",r)})}async provideNewSymbolNames(i,e,t,o){return await this.instantiationService.invokeFunction(n=>EO.getInstance(this.instantiationService,this.context,this.controller).run({forceAnonymous:this.chatEntitlementService.anonymous?1:void 0})),[]}};Sre=I([m(2,F),m(3,dr)],Sre);var Ire=class{constructor(i){this.markerService=i}static registerProvider(i){return i.invokeFunction(e=>{let t=e.get(Jt),o=i.createInstance(Ire);return t.codeActionProvider.register("*",o)})}async provideCodeActions(i,e){let t=[],o,n;if(e.isEmpty()){let s=i.getLineContent(e.startLineNumber);/^\s*$/.test(s)&&(o=d(8200,null),n=E1.generate(e))}else{let s=i.getValueInRange(e);/^\s*$/.test(s)||(o=d(8202,null),n=E1.modify(e))}o&&n&&t.push({kind:Nr.RefactorRewrite.append("copilot").value,isAI:!0,title:o,command:n});let r=E1.warningOrErrorMarkersAtRange(this.markerService,i.uri,e);return r.length>0&&(t.push({kind:Nr.QuickFix.append("copilot").value,isAI:!0,diagnostics:r,title:d(8199,null),command:E1.fixMarkers(r,e)}),t.push({kind:Nr.QuickFix.append("explain").append("copilot").value,isAI:!0,diagnostics:r,title:d(8198,null),command:E1.explainMarkers(r)})),{actions:t,dispose(){}}}};Ire=I([m(0,ha)],Ire);var E1=class{static warningOrErrorMarkersAtRange(i,e,t){return i.read({resource:e,severities:12}).filter(o=>t.startLineNumber<=o.endLineNumber&&t.endLineNumber>=o.startLineNumber)}static modify(i){return{id:JQ,title:d(8202,null),arguments:[{initialSelection:this.rangeToSelection(i),initialRange:i,position:i.getStartPosition()}]}}static generate(i){return{id:JQ,title:d(8200,null),arguments:[{initialSelection:this.rangeToSelection(i),initialRange:i,position:i.getStartPosition()}]}}static rangeToSelection(i){return new ei(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn)}static explainMarkers(i){return{id:tk,title:d(8198,null),arguments:[{query:`@workspace /explain ${i.map(e=>e.message).join(", ")}`,isPartialQuery:!0}]}}static fixMarkers(i,e){return{id:JQ,title:d(8199,null),arguments:[{message:`/fix ${i.map(t=>t.message).join(", ")}`,initialSelection:this.rangeToSelection(e),initialRange:e,position:e.getStartPosition()}]}}};var m9={chatExtensionId:$i.defaultChatAgent?.chatExtensionId??"",upgradePlanUrl:$i.defaultChatAgent?.upgradePlanUrl??"",chatRefreshTokenCommand:$i.defaultChatAgent?.chatRefreshTokenCommand??""},jLo="workbench.action.chat.signInIndicator",kbe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.instantiationService=t;this.logService=n;this.contextKeyService=r;this.extensionEnablementService=s;this.extensionsWorkbenchService=l;this.extensionService=c;this.environmentService=u;this.chatSessionsService=p;this.configurationService=h;let g=o.context?.value,f=o.requests?.value;if(!g||!f)return;let v=new uo(()=>this._register(this.instantiationService.createInstance(AHe,g,f)));this.registerSetupAgents(g,v),this.registerGrowthSession(o),this.registerActions(g,f,v),this.registerSignInTitleBarEntry(e),this.registerUrlLinkHandler(),this.checkExtensionInstallation(g)}static{this.ID="workbench.contrib.chatSetup"}registerSetupAgents(e,t){let o=bp(new ue),n=bp(new ue),r=bp(new ue),s=bp(new ue),l=()=>{{if(!e.state.hidden&&!e.state.disabledInWorkspace){if(!o.value){let c=o.value=new O,u=c.add(new O);for(let p of["ask","edit","agent"]){let{agent:h,disposable:g}=bS.registerDefaultAgents(this.instantiationService,"panel",p,e,t);u.add(g),u.add(h.onUnresolvableError(()=>{u1.get().some(v=>this.contextKeyService.contextMatchesRules(v.when))&&(this.logService.error("[chat setup] Unresolvable error from Chat agent registration, clearing registration."),u.dispose())}))}c.add(bS.registerDefaultAgents(this.instantiationService,"terminal","ask",e,t).disposable),c.add(bS.registerDefaultAgents(this.instantiationService,"notebook","ask",e,t).disposable),c.add(bS.registerDefaultAgents(this.instantiationService,"editor","ask",e,t).disposable)}(!e.state.completed||e.state.entitlement===1||e.state.entitlement===2)&&!n.value&&(n.value=new O).add(bS.registerBuiltInAgents(this.instantiationService,e,t))}else o.clear(),n.clear();e.state.completed&&n.clear()}!e.state.completed&&!e.state.hidden&&!e.state.disabledInWorkspace?r.value||(r.value=Sre.registerProvider(this.instantiationService,e,t)):r.clear(),!e.state.completed&&!e.state.hidden&&!e.state.disabledInWorkspace?s.value||(s.value=Ire.registerProvider(this.instantiationService)):s.clear()};this._register(U.runAndSubscribe(e.onDidChange,()=>l()))}registerGrowthSession(e){let t=bp(new ue),o=()=>{let r=this.configurationService.getValue("chat.growthNotification.enabled")===!0&&!e.sentiment.completed;if(r&&!t.value){let s=new O,l=s.add(this.instantiationService.createInstance(MV));l.isDismissed?s.dispose():(s.add(qLo(this.chatSessionsService,l)),s.add(l.onDidDismiss(()=>{t.clear()})),t.value=s)}else r||t.clear()};this._register(e.onDidChangeSentiment(()=>o())),o()}registerActions(e,t,o){class n extends z{static{this.CHAT_SETUP_ACTION_LABEL=P(8176,"Use AI Features with Copilot for free...")}constructor(){super({id:aS,title:n.CHAT_SETUP_ACTION_LABEL,category:fi,f1:!0,precondition:C.or(Z.Setup.hidden,Z.Setup.disabledInWorkspace,Z.Setup.untrusted,Z.Setup.completed.negate(),Z.Entitlement.canSignUp)})}async run(y,w,x){let E=y.get(Lt),M=y.get(F),N=y.get(ct),V=y.get(fe),H=y.get(to),K=y.get(B);if(await e.update({hidden:!1}),K.updateValue("chat.disableAIFeatures",!1),w){let se=await E.revealWidget();if(se){let ae=this.resolveAgentId(w,se);ae&&se.input.setChatMode(ae)}}if(x?.inputValue){let se=await E.revealWidget();se?.input.showScrollbarUntilAccept(),se?.setInput(x.inputValue)}let j=EO.getInstance(M,e,o),{success:J}=await j.run(x);if(J===!1&&!H.willShutdown){let{confirmed:se}=await N.confirm({type:wt.Error,message:d(8172,null),primaryButton:d(8170,null)});if(se)return!!await V.executeCommand(aS,w,x)}return!!J}resolveAgentId(y,w){let x=w.input.currentChatModesObs.get(),E=x.findModeById(y);if(E)return E.id;let M=[...x.builtin,...x.custom],N=y.toLowerCase();return M.find(H=>H.name.get().toLowerCase()===N)?.id}}class r extends z{constructor(){super({id:che,title:n.CHAT_SETUP_ACTION_LABEL})}async run(y,w){let x=y.get(fe),E=y.get(_e),M=y.get(dr);return E.publicLog2("workbenchActionExecuted",{id:aS,from:"api"}),x.executeCommand(aS,void 0,{forceAnonymous:M.anonymous?1:void 0,...w})}}class s extends z{constructor(){super({id:"workbench.action.chat.triggerSetupForceSignIn",title:P(8164,"Sign in to use AI features")})}async run(y){let w=y.get(fe);return y.get(_e).publicLog2("workbenchActionExecuted",{id:aS,from:"api"}),w.executeCommand(aS,void 0,{forceSignInDialog:!0})}}class l extends z{constructor(){super({id:"workbench.action.chat.triggerSetupAnonymousWithoutDialog",title:n.CHAT_SETUP_ACTION_LABEL})}async run(y){let w=y.get(fe);return y.get(_e).publicLog2("workbenchActionExecuted",{id:aS,from:"api"}),w.executeCommand(aS,void 0,{forceAnonymous:2})}}class c extends z{constructor(){super({id:"workbench.action.chat.triggerSetupFromAccounts",title:P(8177,"Sign in to use AI features..."),menu:{id:R.AccountsContext,group:"2_copilot",when:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),Z.Setup.completed.negate(),Xn.hasByokModels.negate(),Z.Entitlement.signedOut)}})}async run(y){let w=y.get(fe);return y.get(_e).publicLog2("workbenchActionExecuted",{id:aS,from:"accounts"}),w.executeCommand(aS)}}class u extends z{static{this.ID=jLo}constructor(){super({id:u.ID,title:d(8173,null),f1:!1,menu:[{id:R.TitleBarAdjacentCenter,order:0,when:C.and(Mu.negate(),Z.Entitlement.signedOut,Xn.hasByokModels.negate(),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),C.equals("config.chat.titleBar.signIn.enabled",!0),C.has("updateTitleBar").negate(),Yf.negate())}]})}async run(y){let w=y.get(fe);return y.get(_e).publicLog2("workbenchActionExecuted",{id:aS,from:"titlebar"}),w.executeCommand(aS)}}class p extends UP{constructor(){super("chat.titleBar.signIn.enabled",d(8174,null),d(8175,null),3,C.and(Mu.negate(),Z.Entitlement.signedOut,Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()))}}let h=this._register(new ue);class g extends z{constructor(){super({id:"workbench.action.chat.upgradePlan",title:P(8167,"Upgrade to GitHub Copilot Pro"),category:P(8161,"Chat"),f1:!0,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),C.or(Z.Entitlement.canSignUp,Z.Entitlement.planFree)),menu:{id:R.ChatTitleBarMenu,group:"a_first",order:1,when:C.and(Z.Entitlement.planFree,C.or(Z.chatQuotaExceeded,Z.completionsQuotaExceeded))}})}async run(y){let w=y.get(Je),x=y.get(ti),E=y.get(fe);y.get(_e).publicLog2("workbenchActionExecuted",{id:"workbench.action.chat.upgradePlan",from:"command"}),w.open(A.parse(m9.upgradePlanUrl));let N=e.state.entitlement;O0(N)||(h.value=x.onDidChangeFocus(V=>this.onWindowFocus(V,E)))}async onWindowFocus(y,w){if(y){h.clear();let x=await t.forceResolveEntitlement();x?.entitlement&&O0(x?.entitlement)&&_In(w)}}}class f extends z{constructor(){super({id:"workbench.action.chat.manageAdditionalSpend",title:P(8166,"Manage GitHub Copilot Budget"),category:P(8161,"Chat"),f1:!0,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),C.or(Z.Entitlement.planPro,Z.Entitlement.planProPlus,Z.Entitlement.planMax,Z.Entitlement.planEdu)),menu:{id:R.ChatTitleBarMenu,group:"a_first",order:1,when:C.and(C.or(Z.Entitlement.planPro,Z.Entitlement.planProPlus,Z.Entitlement.planMax,Z.Entitlement.planEdu),C.or(Z.chatQuotaExceeded,Z.completionsQuotaExceeded))}})}async run(y){let w=y.get(Je),x=y.get(_e),E=y.get(Nd);x.publicLog2("workbenchActionExecuted",{id:"workbench.action.chat.manageAdditionalSpend",from:"command"}),w.open(A.parse(E.resolveGitHubUrl(SM.billingBudgets)))}}W(n),W(s),W(c),W(u),W(p),W(l),W(r),W(g),W(f);function v(S,y){Ge.registerCommand(S,async(w,...x)=>{let E=w.get(fe),M=w.get(Qt),N=w.get(ha);switch(S){case"chat.internal.explain":case"chat.internal.fix":{let V=M.getActiveCodeEditor(),H=V?.getModel()?.uri,K=V?.getSelection();if(!H||!K)return;let j=E1.warningOrErrorMarkersAtRange(N,H,K),J=S==="chat.internal.explain"?E1.explainMarkers(j):E1.fixMarkers(j,K);await E.executeCommand(J.id,...J.arguments??[]);break}case"chat.internal.review":{await E.executeCommand(che)&&await E.executeCommand(y);break}case"chat.internal.codeReview.run":return E.executeCommand(y,...x)}})}v("chat.internal.explain","github.copilot.chat.explain"),v("chat.internal.fix","github.copilot.chat.fix"),v("chat.internal.review","github.copilot.chat.review"),v("chat.internal.codeReview.run","github.copilot.chat.codeReview.run");let b=C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),Z.Setup.completed.negate());be.appendMenuItem(R.EditorContext,{command:{id:"chat.internal.explain",title:d(8162,null)},group:"1_chat",order:4,when:b}),be.appendMenuItem(R.EditorContext,{command:{id:"chat.internal.fix",title:d(8163,null)},group:"1_chat",order:5,when:C.and(b,me.readOnly.negate())}),be.appendMenuItem(R.EditorContext,{command:{id:"chat.internal.review",title:d(8171,null)},group:"1_chat",order:6,when:b})}registerSignInTitleBarEntry(e){this._register(e.register(R.TitleBarAdjacentCenter,jLo,(t,o)=>new mVi(t,o)))}registerUrlLinkHandler(){this._register(gZe.registerHandler(this.instantiationService.createInstance(vct)))}async checkExtensionInstallation(e){if(this.environmentService.isExtensionDevelopment&&(await this.extensionService.whenInstalledExtensionsRegistered(),this.extensionService.extensions.find(t=>hi.equals(t.identifier,m9.chatExtensionId)))){e.update({installed:!0,disabled:!1,untrusted:!1,disabledInWorkspace:!1});return}await this.extensionsWorkbenchService.queryLocal(),this._register(U.runAndSubscribe(this.extensionsWorkbenchService.onChange,t=>{if(t&&!hi.equals(t.identifier.id,m9.chatExtensionId))return;let o=this.extensionsWorkbenchService.local.find(c=>hi.equals(c.identifier.id,m9.chatExtensionId)),n=!!o?.local,r,s=!1,l=!1;if(n){if(r=!this.extensionEnablementService.isEnabled(o.local),r){let c=this.extensionEnablementService.getEnablementState(o.local);c===0?(r=!1,s=!0):c===11&&(l=!0)}}else r=!1;e.update({installed:n,disabled:r,untrusted:s,disabledInWorkspace:l})}))}};kbe=I([m(0,sh),m(1,F),m(2,dr),m(3,re),m(4,X),m(5,As),m(6,Ui),m(7,lt),m(8,ko),m(9,Ms),m(10,B)],kbe);var vct=class{constructor(i,e,t){this.productService=i;this.commandService=e;this.telemetryService=t}canHandleURL(i){return i.scheme===this.productService.urlProtocol&&xr(i.authority,m9.chatExtensionId)}async handleURL(i){let e=new URLSearchParams(i.query);this.telemetryService.publicLog2("workbenchActionExecuted",{id:aS,from:"url",detail:e.get("referrer")??void 0});let t=e.get("agent")??e.get("mode"),o=e.get("prompt");return!t&&!o?!1:(await this.commandService.executeCommand(aS,t,o?{inputValue:o}:void 0),!0)}};vct=I([m(0,Ze),m(1,fe),m(2,_e)],vct);var Ebe=class extends k{constructor(e,t,o,n,r,s){super();this.configurationService=t;this.extensionsWorkbenchService=o;this.extensionEnablementService=n;this.viewDescriptorService=r;this.layoutService=s;e.context?.value&&(this.registerListeners(),this.registerActions(),this.handleChatDisabled(!1))}static{this.ID="workbench.contrib.chatTeardown"}handleChatDisabled(e){let t=this.configurationService.inspect("chat.disableAIFeatures");t.value===!0?(this.maybeEnableOrDisableExtension(typeof t.workspaceValue=="boolean"?11:10),e&&this.maybeHideAuxiliaryBar()):t.value===!1&&e&&this.maybeEnableOrDisableExtension(typeof t.workspaceValue=="boolean"?13:12)}async registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("chat.disableAIFeatures")&&this.handleChatDisabled(!0)})),await this.extensionsWorkbenchService.queryLocal(),this._register(this.extensionsWorkbenchService.onChange(e=>{if(e&&!hi.equals(e.identifier.id,m9.chatExtensionId))return;let t=this.extensionsWorkbenchService.local.find(o=>hi.equals(o.identifier.id,m9.chatExtensionId));t?.local&&this.extensionEnablementService.isEnabled(t.local)&&(t.enablementState===13?this.configurationService.inspect("chat.disableAIFeatures").workspaceValue===!0&&this.configurationService.updateValue("chat.disableAIFeatures",!1,5):this.configurationService.updateValue("chat.disableAIFeatures",!1))}))}async maybeEnableOrDisableExtension(e){let t=this.extensionsWorkbenchService.local.find(o=>hi.equals(o.identifier.id,m9.chatExtensionId));t&&(await this.extensionsWorkbenchService.setEnablement([t],e),await this.extensionsWorkbenchService.updateRunningExtensions(e===12||e===13?d(8169,null):d(8168,null)))}maybeHideAuxiliaryBar(){let e=this.viewDescriptorService.getViewContainersByLocation(2).filter(t=>this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0);(e.length===0||e.length===1&&e.at(0)?.id===T3)&&this.layoutService.setPartHidden(!0,"workbench.parts.auxiliarybar")}registerActions(){class e extends z{static{this.ID="workbench.action.chat.hideSetup"}static{this.TITLE=P(8165,"Learn How to Hide AI Features")}constructor(){super({id:e.ID,title:e.TITLE,f1:!0,category:fi,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),menu:{id:R.ChatTitleBarMenu,group:"z_hide",order:1,when:Z.Setup.completed.negate()}})}async run(o){o.get(Qo).openSettings({jsonEditor:!1,query:"@id:chat.disableAIFeatures"})}}W(e)}};Ebe=I([m(0,dr),m(1,B),m(2,Ui),m(3,As),m(4,ji),m(5,wi)],Ebe);function _In(a){a.executeCommand(m9.chatRefreshTokenCommand)}var mVi=class extends Ja{constructor(i,e){super(void 0,i,e)}render(i){super.render(i),i.setAttribute("role","button"),i.setAttribute("aria-label",this.action.label);let e=D(i,_(".update-indicator.prominent"));this.label=D(e,_(".indicator-label")),this.label.textContent=this.action.label}updateLabel(){this.label&&(this.label.textContent=this.action.label),this.element&&this.element.setAttribute("aria-label",this.action.label)}updateEnabled(){this.element&&this.element.classList.toggle("disabled",!this.action.enabled)}};var T1=class extends k{constructor(e,t,o,n,r){super();this._languageModelsConfigurationService=e;this._contextKeyService=t;this._configurationService=o;this._storageService=n;this._extensionsRegistered=!1;this._hasByokModels=Xn.hasByokModels.bindTo(this._contextKeyService),this._restore(),this._update(),r.whenInstalledExtensionsRegistered().then(()=>{this._store.isDisposed||(this._extensionsRegistered=!0,this._update())}),this._register(U.any(U.filter(this._configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("chat.offlineByok")||s.affectsConfiguration("chat.disableAIFeatures")),U.filter(this._contextKeyService.onDidChangeContext,s=>s.affectsSome(T1.TRACKED_KEYS)),this._languageModelsConfigurationService.onDidChangeLanguageModelGroups)(()=>this._update()))}static{this.ID="workbench.contrib.hasByokModels"}static{this.STORAGE_KEY_LAST_KNOWN="chat.hasByokModels.lastKnown"}static{this.TRACKED_KEYS=new Set([Xn.clientByokEnabled.key,Z.nonCopilotLanguageModelsAreUserSelectable.key])}_isFeatureEnabled(){return!this._configurationService.getValue("chat.disableAIFeatures")&&!!this._configurationService.getValue("chat.offlineByok")&&!!this._contextKeyService.getContextKeyValue(Xn.clientByokEnabled.key)}_restore(){if(!this._isFeatureEnabled()){this._hasByokModels.set(!1);return}this._hasByokModels.set(this._storageService.getBoolean(T1.STORAGE_KEY_LAST_KNOWN,-1,!1))}_setResult(e){this._hasByokModels.set(e),this._storageService.store(T1.STORAGE_KEY_LAST_KNOWN,e,-1,1)}_update(){if(!this._isFeatureEnabled()){this._setResult(!1);return}if(this._contextKeyService.getContextKeyValue(Z.nonCopilotLanguageModelsAreUserSelectable.key)){this._setResult(!0);return}if(!this._extensionsRegistered)return;this._languageModelsConfigurationService.getLanguageModelsProviderGroups().some(t=>t.vendor!==RYe)||this._setResult(!1)}};T1=I([m(0,_H),m(1,X),m(2,B),m(3,de),m(4,lt)],T1);var Y4t=class extends k{static createAppend(i,e,...t){if(!DT()){let n=new this(...t);i.appendChild(n.element),e.add(n);return}let o=this.createObservable(e,...t);e.add(ve(n=>{let r=o.read(n);i.appendChild(r.element),n.store.add(ee(()=>r.element.remove())),n.store.add(r)}))}static createInContents(i,...e){let t=document.createElement("div");return t.style.display="contents",this.createAppend(t,i,...e),t}static createObservable(i,...e){if(!DT())return Fo(new this(...e));let t=this[hVi],o=t?Q4t.get(t):void 0;return o?ke(n=>{let r=o.read(n);return new r(...e)}):Fo(new this(...e))}static instantiateAppend(i,e,t,...o){if(!DT()){let s=i.createInstance(this,...o);e.appendChild(s.element),t.add(s);return}let n=this.instantiateObservable(i,t,...o),r;t.add(ve(s=>{let l=n.read(s);r?r.element.replaceWith(l.element):e.appendChild(l.element),r=l,s.delayedStore.add(l)}))}static instantiateInContents(i,e,...t){let o=document.createElement("div");return o.style.display="contents",this.instantiateAppend(i,o,e,...t),o}static instantiateObservable(i,e,...t){if(!DT())return Fo(i.createInstance(this,...t));let o=this[hVi],n=o?Q4t.get(o):void 0;return n?ke(r=>{let s=n.read(r);return i.createInstance(s,...t)}):Fo(i.createInstance(this,...t))}static registerWidgetHotReplacement(i){if(!DT())return;let e=Q4t.get(i);e?e.set(this,void 0):(e=De(i,this),Q4t.set(i,e)),this[hVi]=i}},hVi=Symbol("DomWidgetHotReloadId"),Q4t=new Map;function X4t(a){return!a.sentiment.completed||a.entitlement===3}var AV=$i.defaultChatAgent,h9=class extends Y4t{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.options=e;this.chatEntitlementService=t;this.chatStatusItemService=o;this.commandService=n;this.configurationService=r;this.editorService=s;this.hoverService=l;this.languageService=c;this.openerService=u;this.telemetryService=p;this.textResourceConfigurationService=h;this.inlineCompletionsService=g;this.markdownRendererService=f;this.languageFeaturesService=v;this.contextViewService=b;this.storageService=S;this.defaultAccountService=y;this.element=_("div.chat-status-bar-entry-tooltip");this.dateFormatter=nd.DateTimeFormat(Kr,{month:"short",day:"numeric"});this.timeFormatter=nd.DateTimeFormat(Kr,{hour:"numeric",minute:"numeric"});this.quotaPercentageFormatter=nd.NumberFormat(void 0,{maximumFractionDigits:0,minimumFractionDigits:0});this.quotaCreditsFormatter=nd.NumberFormat(Kr,{maximumFractionDigits:2,minimumFractionDigits:0});this.render()}static{this.QUICK_SETTINGS_COLLAPSED_KEY="chatStatusDashboard.quickSettingsCollapsed"}render(){let e=wz(this._store),{chat:t,premiumChat:o,completions:n}=this.chatEntitlementService.quotas,r=!!(t||o),s=this.chatEntitlementService.anonymous&&this.chatEntitlementService.sentiment.completed,l=o?.unlimited&&o.hasQuota===!1&&!(this.chatEntitlementService.quotas.additionalUsageEnabled??!1),c=r||s,u=t?.unlimited===!1||o?.unlimited===!1||!this.options?.compactQuotaLayout&&n?.unlimited===!1||s||l,p=[...this.chatStatusItemService.getEntries()],h=!this.options?.disableInlineSuggestionsSettings||!this.options?.disableModelSelection||!this.options?.disableProviderOptions||!this.options?.disableCompletionsSnooze,g;if(c&&!this.options?.compactQuotaLayout){let b=nPt(this.chatEntitlementService.entitlement),S=this.options?.titleHeaderContainer??this.element,y=this.renderHeader(S,this._store,b,li({id:"workbench.action.manageCopilot",label:d(8279,null),tooltip:d(8286,null),class:q.asClassName(L.settings),run:()=>this.runCommandAndClose(()=>this.openerService.open(A.parse(this.defaultAccountService.resolveGitHubUrl(SM.copilotSettings))))})),w=this.chatEntitlementService.entitlement===10||this.chatEntitlementService.entitlement===6||this.chatEntitlementService.entitlement===7||this.chatEntitlementService.entitlement===11,x=this.chatEntitlementService.quotas.canUpgradePlan??!1,E=y.lastElementChild;if(w&&(g=this._store.add(new Pi(y,{...Ro,hoverDelegate:rC,secondary:!0})),g.element.classList.add("header-cta-button"),g.label=d(8266,null),this._store.add(g.onDidClick(()=>{this.telemetryService.publicLog2("workbenchActionExecuted",{id:"workbench.action.chat.manageAdditionalSpend",from:"chat-status"}),this.runCommandAndClose(()=>this.openerService.open(A.parse(this.defaultAccountService.resolveGitHubUrl(SM.billingBudgets))))})),E&&y.insertBefore(g.element,E)),x&&!w){let M=this._store.add(new Pi(y,{...Ro,hoverDelegate:rC}));M.element.classList.add("header-cta-button"),M.label=d(8299,null),this._store.add(M.onDidClick(()=>this.runCommandAndClose("workbench.action.chat.upgradePlan"))),E&&y.insertBefore(M.element,E)}}if(c&&this.options?.compactQuotaLayout&&this.options.ctaButtonsContainer){let b=this.options.ctaButtonsContainer,S=this.chatEntitlementService.entitlement===10||this.chatEntitlementService.entitlement===6||this.chatEntitlementService.entitlement===7||this.chatEntitlementService.entitlement===11,y=this.chatEntitlementService.quotas.canUpgradePlan??!1;if(S&&(g=this._store.add(new Pi(b,{...Ro,hoverDelegate:rC,secondary:!0})),g.label=d(8266,null),this._store.add(g.onDidClick(()=>{this.telemetryService.publicLog2("workbenchActionExecuted",{id:"workbench.action.chat.manageAdditionalSpend",from:"chat-status"}),this.runCommandAndClose(()=>this.openerService.open(A.parse(this.defaultAccountService.resolveGitHubUrl(SM.billingBudgets))))}))),y&&!S){let w=this._store.add(new Pi(b,{...Ro,hoverDelegate:rC}));w.label=d(8299,null),this._store.add(w.onDidClick(()=>this.runCommandAndClose("workbench.action.chat.upgradePlan")))}}this.options?.compactQuotaLayout&&this.element.classList.add("compact");let f=this.chatEntitlementService.update(e);u&&this.renderUsageContent(this.element,e,g,f);let v=!!o?.unlimited;if(v){let b=this.chatEntitlementService.quotas.usageBasedBilling?d(8261,null):d(8260,null),S=this.element.appendChild(_("div.quota-indicator.included"));if(this.options?.compactQuotaLayout){let y=nPt(this.chatEntitlementService.entitlement);S.classList.add("compact"),S.appendChild(_("div.quota-title",void 0,y)),S.appendChild(_("div.description",void 0,l?d(8272,null,b):d(8270,null,b)))}else S.appendChild(_("div.quota-title",void 0,b)),S.appendChild(_("div.description",void 0,l?d(8271,null):d(8269,null)))}if(h){let b=c||u||v;this.renderInlineSuggestionsSection(b)}p.length>0&&this.renderContributedSections(p),this.renderSetupSection()}renderUsageContent(e,t,o,n){let{chat:r,completions:s,premiumChat:l,resetDate:c,resetDateHasTime:u}=this.chatEntitlementService.quotas,p=!!this.options?.compactQuotaLayout,h=p?nPt(this.chatEntitlementService.entitlement):void 0;if(r||l||s){let g=c?u?d(8285,null,this.dateFormatter.value.format(new Date(c)),this.timeFormatter.value.format(new Date(c))):d(8284,null,this.dateFormatter.value.format(new Date(c))):void 0,f=this.createGlobalQuotaCallout(e),{calloutVisible:v}=f();o&&(o.element.style.display=v?"":"none");let b;if(r&&!r.unlimited&&(!this.chatEntitlementService.quotas.usageBasedBilling||this.chatEntitlementService.entitlement===5)){let E=this.chatEntitlementService.quotas.usageBasedBilling&&this.chatEntitlementService.entitlement===5?d(8253,null):d(8245,null);b=this.createQuotaIndicator(e,r,E,g,p?h:void 0)}let S;if(l&&!l.unlimited&&l.percentRemaining>=0){let E=this.chatEntitlementService.quotas.usageBasedBilling,M=E?d(8253,null):this.chatEntitlementService.quotas.additionalUsageEnabled?d(8259,null):d(8268,null),N=E?this.formatResetAtLabel(l.resetAt)??g:g;S=this.createQuotaIndicator(e,l,M,N,p?h:void 0)}let y;!p&&s&&!s.unlimited&&s.percentRemaining>=0&&(!this.chatEntitlementService.quotas.usageBasedBilling||this.chatEntitlementService.entitlement===5)&&(y=this.createQuotaIndicator(e,s,d(8252,null),g,p?h:void 0));let x=()=>{let{chat:E,premiumChat:M,completions:N}=this.chatEntitlementService.quotas;E&&b?.(E),M&&S?.(M),N&&y?.(N);let{calloutVisible:V}=f();o&&(o.element.style.display=V?"":"none",o.label=d(8266,null))};(async()=>(await n,!t.isCancellationRequested&&x()))(),this._store.add(this.chatEntitlementService.onDidChangeQuotaRemaining(()=>x())),this._store.add(this.chatEntitlementService.onDidChangeQuotaExceeded(()=>x()))}else this.chatEntitlementService.anonymous&&this.chatEntitlementService.sentiment.completed&&this.createQuotaIndicator(e,d(8281,null),d(8245,null))}renderInlineSuggestionsSection(e){let t=!!this.options?.disableQuickSettingsCollapsible,o=!t&&this.storageService.getBoolean(h9.QUICK_SETTINGS_COLLAPSED_KEY,0,!0),n=this.editorService.activeTextEditorLanguageId,r=()=>this.canUseChat()?(n?XY(this.configurationService,n):XY(this.configurationService))?d(8263,null):d(8262,null):d(8262,null),s,l,c;t||(s=this.element.appendChild(_("button.collapsible-header")),e||s.classList.add("no-border"),s.setAttribute("aria-expanded",String(!o)),s.appendChild(_("span.collapsible-label",void 0,d(8264,null))),l=s.appendChild(_("span.collapsible-chevron")),l.classList.add(...q.asClassNameArray(o?L.chevronRight:L.chevronDown)),c=s.appendChild(_("span.collapsible-status",void 0,r())));let u=this.element.appendChild(_("div.collapsible-content")),p=u.appendChild(_("div.collapsible-inner"));if(o&&(u.classList.add("collapsed"),p.inert=!0),s&&l){let h=()=>{let g=u.classList.toggle("collapsed");p.inert=g,s.setAttribute("aria-expanded",String(!g)),l.className="collapsible-chevron",l.classList.add(...q.asClassNameArray(g?L.chevronRight:L.chevronDown)),this.storageService.store(h9.QUICK_SETTINGS_COLLAPSED_KEY,g,0,0)};this._store.add($(s,ne.CLICK,()=>h()))}c&&this._store.add(this.configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration(AV.completionsEnablementSetting)&&(c.textContent=r())})),this.renderInlineSuggestionsContent(p)}renderContributedSections(e){for(let t of e){let o=typeof t.label=="string"?t.label:t.label.label,n=typeof t.label=="string"?void 0:t.label.link,r=typeof t.label=="string"?void 0:t.label.helpText,s=this.element.appendChild(_("div.contributed-section")),l=s.appendChild(_("div.collapsible-header.non-collapsible"));if(l.appendChild(_("span.collapsible-label",void 0,o)),r||n){let f=l.appendChild(_("span.contributed-info-icon"));f.classList.add(...q.asClassNameArray(L.info)),this._store.add(this.hoverService.setupDelayedHover(f,()=>{let v=new he("",{isTrusted:!0});return r&&v.appendText(r),n&&(r&&v.appendText(" "),v.appendMarkdown(`[${d(8265,null)}](${n})`)),{content:v}},{reducedDelay:!0}))}let c=l.appendChild(_("span.collapsible-status"));c.append(...ir(t.description));let u=t.tooltip;u&&this._store.add(this.hoverService.setupDelayedHover(c,()=>({content:u??""}),{reducedDelay:!0}));let p=this._store.add(new ue),h=new O;p.value=h;let g;t.detail&&(g=s.appendChild(_("div.contributed-detail")),this.renderTextPlus(g,t.detail,h)),this._store.add(this.chatStatusItemService.onDidChange(f=>{if(f.entry.id===t.id){c.textContent="",c.append(...ir(f.entry.description)),u=f.entry.tooltip,n=typeof f.entry.label=="string"?void 0:f.entry.label.link,r=typeof f.entry.label=="string"?void 0:f.entry.label.helpText;let v=new O;p.value=v,g?f.entry.detail?(g.textContent="",this.renderTextPlus(g,f.entry.detail,v)):(g.remove(),g=void 0):f.entry.detail&&(g=s.appendChild(_("div.contributed-detail")),this.renderTextPlus(g,f.entry.detail,v))}}))}}renderSetupSection(){let e=this.chatEntitlementService.hasByokModels,t=X4t(this.chatEntitlementService)&&!e,o=this.chatEntitlementService.anonymous,n=this.chatEntitlementService.sentiment.disabled||this.chatEntitlementService.sentiment.untrusted,r=this.chatEntitlementService.entitlement===1&&!e;if(!(t||r||n))return;this.element.appendChild(_("hr"));let s,l=".description";t&&o?(s=new he(d(8243,null,AV.provider.default.name,AV.provider.default.name,AV.termsStatementUrl,AV.privacyStatementUrl),{isTrusted:!0}),l=`${l}.terms`):t?s=d(8242,null):o?s=d(8258,null):n?s=d(8256,null):s=d(8297,null);let c;t?c=d(8254,null):o?c=d(8257,null):n?c=d(8255,null):c=d(8298,null);let u;t&&o?u="workbench.action.chat.triggerSetupAnonymousWithoutDialog":u="workbench.action.chat.triggerSetup",typeof s=="string"?this.element.appendChild(_(`div${l}`,void 0,s)):this.element.appendChild(_(`div${l}`,void 0,this._store.add(this.markdownRendererService.render(s)).element));let p=this._store.add(new Pi(this.element,{...Ro,hoverDelegate:rC}));p.label=c,this._store.add(p.onDidClick(()=>this.runCommandAndClose(u)))}renderInlineSuggestionsContent(e){this.options?.disableInlineSuggestionsSettings||this.createSettings(e);let t=!this.options?.disableModelSelection||!this.options?.disableProviderOptions?this.languageFeaturesService.inlineCompletionsProvider.allNoModel():void 0;if(!this.options?.disableModelSelection&&t){let o=t.find(n=>n.modelInfo&&n.modelInfo.models.length>0);if(o){let n=o.modelInfo;if(n.models.find(s=>s.id===n.currentModelId)){let s=e.appendChild(_("div.model-selection"));s.appendChild(_("span.model-text",void 0,d(8267,null)));let l=n.models.map(h=>({text:h.name})),c=n.models.findIndex(h=>h.id===n.currentModelId),u=this._store.add(new Jw(l,Math.max(0,c),this.contextViewService,nC,{ariaLabel:d(8290,null),optionsAsChildren:!0})),p=s.appendChild(_("div.model-select-container"));u.render(p),this._store.add(u.onDidSelect(async h=>{let g=n.models[h.index];g&&g.id!==n.currentModelId&&o.setModelId&&await o.setModelId(g.id)}))}}}if(!this.options?.disableProviderOptions&&t){for(let o of t)if(o.providerOptions&&o.providerOptions.length>0){for(let n of o.providerOptions)if(n.values.find(s=>s.id===n.currentValueId)){let s=e.appendChild(_("div.suggest-option-selection"));s.appendChild(_("span.suggest-option-text",void 0,n.label));let l=n.values.map(h=>({text:h.label})),c=n.values.findIndex(h=>h.id===n.currentValueId),u=this._store.add(new Jw(l,Math.max(0,c),this.contextViewService,nC,{ariaLabel:d(8291,null,n.label),optionsAsChildren:!0})),p=s.appendChild(_("div.suggest-option-select-container"));u.render(p),this._store.add(u.onDidSelect(async h=>{let g=n.values[h.index];g&&g.id!==n.currentValueId&&o.setProviderOption&&await o.setProviderOption(n.id,g.id)}))}}}if(!this.options?.disableCompletionsSnooze&&this.canUseChat()){let o=D(e,_("div.snooze-completions"));this.createCompletionsSnooze(o,d(8296,null))}}canUseChat(){return!this.chatEntitlementService.sentiment.completed||this.chatEntitlementService.sentiment.disabled||this.chatEntitlementService.sentiment.untrusted?!1:this.chatEntitlementService.entitlement===1||this.chatEntitlementService.entitlement===3?this.chatEntitlementService.anonymous:!(this.chatEntitlementService.entitlement===5&&this.chatEntitlementService.quotas.chat?.percentRemaining===0&&this.chatEntitlementService.quotas.completions?.percentRemaining===0)}renderHeader(e,t,o,n){let r=e.appendChild(_("div.header"));return r.appendChild(_("span.header-label",void 0,o)),n&&t.add(new oo(r,{hoverDelegate:rC})).push([n],{icon:!0,label:!1}),r}renderTextPlus(e,t,o){for(let n of ZS(t).nodes)if(typeof n=="string"){let r=ir(n);e.append(...r)}else o.add(new Bg(e,n,void 0,this.hoverService,this.openerService))}runCommandAndClose(e,...t){typeof e=="function"?e(...t):(this.telemetryService.publicLog2("workbenchActionExecuted",{id:e,from:"chat-status"}),this.commandService.executeCommand(e,...t)),this.hoverService.hideHover(!0)}formatResetAtLabel(e){if(!e)return;let t=new Date(e*1e3);return d(8285,null,this.dateFormatter.value.format(t),this.timeFormatter.value.format(t))}createQuotaIndicator(e,t,o,n,r){let s=!!r,l=_("span.quota-value"),c=s?l.appendChild(_("span.quota-value-text")):l,u=_("span.quota-value-suffix"),p=_("div.quota-bit"),h=_("span.quota-reset");n&&(h.textContent=n);let g=_("div.quota-percentage",void 0,l,u);g.tabIndex=s?-1:0;let f=_("div.quota-indicator",void 0,_("div.quota-title",void 0,s?r:o),_("div.quota-details",void 0,g,h),...s?[]:[_("div.quota-bar",void 0,p)]);s&&f.classList.add("compact"),e.appendChild(f);let v=t,b=!1,S=()=>{if(typeof v=="string")c.textContent=v,u.textContent="";else{let E=Math.max(0,100-v.percentRemaining);c.textContent=d(8278,null,this.quotaPercentageFormatter.value.format(Math.floor(E))),u.textContent=s?d(8280,null,o):` ${d(8287,null)}`}},y=()=>{if(typeof v!="string"&&v.entitlement){let E=v.entitlement,M=E*(100-v.percentRemaining)/100,N=this.quotaCreditsFormatter.value.format(M),V=this.quotaCreditsFormatter.value.format(E);c.textContent=d(8277,null,N,V),u.textContent=s?d(8280,null,o):` ${d(8287,null)}`}},w=s?c:g;this._store.add($(w,ne.MOUSE_ENTER,()=>{b=!0,y()})),this._store.add($(w,ne.MOUSE_LEAVE,()=>{b=!1,S()})),this._store.add($(w,ne.FOCUS,()=>{b=!0,y()})),this._store.add($(w,ne.BLUR,()=>{b=!1,S()}));let x=E=>{v=E;let M;typeof E=="string"?M=0:M=Math.max(0,100-E.percentRemaining),b?y():S(),p.style.width=`${M}%`};return x(t),x}createGlobalQuotaCallout(e){let t=_("span.callout-icon"),o=_("span.callout-text"),n=e.appendChild(_("div.quota-callout",void 0,t,o));n.style.display="none";let r=()=>{let s=this.chatEntitlementService.quotas,l=s.additionalUsageEnabled??!1,c=this.chatEntitlementService.entitlement===9||this.chatEntitlementService.entitlement===8,u=s.usageBasedBilling===!0,p=[];s.chat&&!s.chat.unlimited&&p.push(s.chat),s.premiumChat&&!s.premiumChat.unlimited&&p.push(s.premiumChat),s.completions&&!s.completions.unlimited&&p.push(s.completions);let h=p.length>0?Math.max(...p.map(f=>Math.max(0,100-f.percentRemaining))):0,g=s.premiumChat?.unlimited&&s.premiumChat.hasQuota===!1;return h>=100&&l?(n.style.display="",n.className="quota-callout info",t.className=`callout-icon ${q.asClassName(L.info)}`,o.textContent=u?d(8273,null):d(8275,null)):h>=75&&h<100&&l?(n.style.display="",n.className="quota-callout info",t.className=`callout-icon ${q.asClassName(L.info)}`,o.textContent=u?d(8274,null):d(8276,null)):(h>=100||g)&&!l?(n.style.display="",n.className="quota-callout info",t.className=`callout-icon ${q.asClassName(L.info)}`,o.textContent=c?d(8283,null):d(8282,null)):h>=75&&!l?(n.style.display="",n.className="quota-callout info",t.className=`callout-icon ${q.asClassName(L.info)}`,o.textContent=c?d(8289,null):d(8288,null)):n.style.display="none",{calloutVisible:n.style.display!=="none",additionalUsageEnabled:l}};return r(),r}createSettings(e){let t=this.editorService.activeTextEditorLanguageId,o=e.appendChild(_("div.settings"));{let n=D(o,_("div.setting"));this.createInlineSuggestionsSetting(n,d(8292,null),"*");let r=n.appendChild(_("span.setting-overridden")),s=()=>{let l=this.configurationService.getValue(AV.completionsEnablementSetting),c=t&&Di(l)&&typeof l[t]<"u"&&!!l[t]!=!!l["*"];r.textContent=c?d(8295,null):""};if(s(),t){let l=D(o,_("div.setting")),c=this.languageService.getLanguageName(t)??t;this.createTriStateLanguageSetting(l,d(8293,null,c),t,s)}}{let n=D(o,_("div.setting"));this.createNextEditSuggestionsSetting(n,d(8294,null),this.getCompletionsSettingAccessor(t))}}createSetting(e,t,o,n){let r=this._store.add(new qf(o,!!n.readSetting(),{...Ag}));e.appendChild(r.domNode);let s=D(e,_("span.setting-label",void 0,o));return this._store.add(ds.addTarget(s)),[ne.CLICK,Vn.Tap].forEach(l=>{this._store.add($(s,l,c=>{r?.enabled&&(Kt.stop(c,!0),r.checked=!r.checked,n.writeSetting(r.checked),r.focus())}))}),this._store.add(r.onChange(()=>{n.writeSetting(r.checked)})),this._store.add(this.configurationService.onDidChangeConfiguration(l=>{t.some(c=>l.affectsConfiguration(c))&&(r.checked=!!n.readSetting())})),this.canUseChat()||(e.classList.add("disabled"),r.disable(),r.checked=!1),r}createInlineSuggestionsSetting(e,t,o){this.createSetting(e,[AV.completionsEnablementSetting],t,this.getCompletionsSettingAccessor(o))}createTriStateLanguageSetting(e,t,o,n){let r=AV.completionsEnablementSetting,s=()=>{let f=this.configurationService.getValue(r);return!Di(f)||typeof f[o]>"u"?"mixed":!!f[o]},l=this._store.add(new $K(t,s(),{...Ag}));e.appendChild(l.domNode);let c=D(e,_("span.setting-label",void 0,t));this._store.add(ds.addTarget(c));let u=()=>{let f=l.checked;f===!0?l.checked=!1:f===!1?l.checked="mixed":l.checked=!0},p=f=>{let v=this.configurationService.getValue(r);if(Di(v)||(v=Object.create(null)),f==="mixed"){let{[o]:b,...S}=v,y=typeof S["*"]=="boolean"?S["*"]?"enabled":"disabled":"enabled";this.telemetryService.publicLog2("chatStatus.settingChanged",{settingIdentifier:r,settingMode:o,settingEnablement:y}),this.configurationService.updateValue(r,S)}else this.telemetryService.publicLog2("chatStatus.settingChanged",{settingIdentifier:r,settingMode:o,settingEnablement:f?"enabled":"disabled"}),this.configurationService.updateValue(r,{...v,[o]:f});n()},h=s(),g=()=>{u(),h=l.checked,p(l.checked)};[ne.CLICK,Vn.Tap].forEach(f=>{this._store.add($(c,f,v=>{l?.enabled&&(Kt.stop(v,!0),g(),l.focus())}))}),this._store.add(l.onChange(()=>{l.checked=h,g()})),this._store.add(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration(r)&&(l.checked=s(),h=l.checked,n())})),this.canUseChat()||(e.classList.add("disabled"),l.disable(),l.checked=!1)}getCompletionsSettingAccessor(e="*"){let t=AV.completionsEnablementSetting;return{readSetting:()=>XY(this.configurationService,e),writeSetting:o=>{this.telemetryService.publicLog2("chatStatus.settingChanged",{settingIdentifier:t,settingMode:e,settingEnablement:o?"enabled":"disabled"});let n=this.configurationService.getValue(t);return Di(n)||(n=Object.create(null)),this.configurationService.updateValue(t,{...n,[e]:o})}}}createNextEditSuggestionsSetting(e,t,o){let n=AV.nextEditSuggestionsSetting,r=AV.completionsEnablementSetting,s=po.getOriginalUri(this.editorService.activeEditor,{supportSideBySide:1}),l=this.createSetting(e,[n,r],t,{readSetting:()=>o.readSetting()&&this.textResourceConfigurationService.getValue(s,n),writeSetting:c=>(this.telemetryService.publicLog2("chatStatus.settingChanged",{settingIdentifier:n,settingEnablement:c?"enabled":"disabled"}),this.textResourceConfigurationService.updateValue(s,n,c))});o.readSetting()||(e.classList.add("disabled"),l.disable()),this._store.add(this.configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration(r)&&(o.readSetting()&&this.canUseChat()?(l.enable(),e.classList.remove("disabled")):(l.disable(),e.classList.add("disabled")))}))}createCompletionsSnooze(e,t){let o=()=>{let g=XY(this.configurationService),f=XY(this.configurationService,this.editorService.activeTextEditorLanguageId);return g||f},n=this._store.add(new Pi(e,{disabled:!o(),...Ro,hoverDelegate:rC,secondary:!0})),r=e.appendChild(_("span.snooze-label")),s=e.appendChild(_("div.snooze-action-bar")),l=this._store.add(new oo(s,{hoverDelegate:rC})),c=li({id:"workbench.action.cancelSnoozeStatusBarLink",label:d(8244,null),run:()=>this.inlineCompletionsService.cancelSnooze(),class:q.asClassName(L.stopCircle)}),u=g=>{e.classList.toggle("disabled",!g),l.clear();let f=this.inlineCompletionsService.snoozeTimeLeft;if(!g||f<=0)return r.textContent=d(8249,null),r.title="",n.label=t,n.setTitle(d(8248,null)),!0;let v=Math.ceil(f/1e3),b=Math.floor(v/60),S=v%60;return r.textContent=`${b}:${S<10?"0":""}${S} ${d(8247,null)}`,r.title=d(8251,null),n.label=d(8246,null),n.setTitle(d(8250,null)),l.push([c],{icon:!0,label:!1}),!1},p=this._store.add(new O);function h(){p.clear();let g=o();u(g)||p.add(Ly(Me(e),()=>u(g),1e3))}h(),this._store.add(n.onDidClick(()=>{this.inlineCompletionsService.snooze(),u(o())})),this._store.add(this.configurationService.onDidChangeConfiguration(g=>{g.affectsConfiguration(AV.completionsEnablementSetting)&&(n.enabled=o()),h()})),this._store.add(this.inlineCompletionsService.onDidChangeIsSnoozing(()=>{h()}))}};h9=I([m(1,dr),m(2,bet),m(3,fe),m(4,B),m(5,ie),m(6,ot),m(7,Rt),m(8,Je),m(9,_e),m(10,Gn),m(11,V4),m(12,_n),m(13,Jt),m(14,qn),m(15,de),m(16,Nd)],h9);var g9=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.chatEntitlementService=e;this.instantiationService=t;this.statusbarService=o;this.editorService=n;this.configurationService=r;this.completionsService=s;this.chatSessionsService=l;this.contextKeyService=c;this.entry=void 0;this.activeCodeEditorListener=this._register(new ue);this.entryAnchor=_("span");this.runningSessionsCount=this.chatSessionsService.getInProgress().reduce((u,p)=>u+p.count,0),this.update(),this.registerListeners()}static{this.ID="workbench.contrib.chatStatusBarEntry"}static{this.TITLE_BAR_CONTEXT_KEYS=new Set(["updateTitleBar",Yf.key,Xn.hasByokModels.key])}update(){if(this.chatEntitlementService.sentiment.hidden)this.entry?.dispose(),this.entry=void 0;else{let t=this.getEntryProps();this.entry?this.entry.update(t):this.entry=this.statusbarService.addEntry(t,"chat.statusBarEntry",1,{location:{id:"status.editor.mode",priority:100.1},alignment:1})}}registerListeners(){this._register(this.chatEntitlementService.onDidChangeQuotaExceeded(()=>this.update())),this._register(this.chatEntitlementService.onDidChangeSentiment(()=>this.update())),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>this.update())),this._register(this.contextKeyService.onDidChangeContext(e=>{e.affectsSome(g9.TITLE_BAR_CONTEXT_KEYS)&&this.update()})),this._register(this.completionsService.onDidChangeIsSnoozing(()=>this.update())),this._register(this.chatSessionsService.onDidChangeInProgress(()=>{let e=this.runningSessionsCount;this.runningSessionsCount=this.chatSessionsService.getInProgress().reduce((t,o)=>t+o.count,0),this.runningSessionsCount!==e&&this.update()})),this._register(this.editorService.onDidActiveEditorChange(()=>this.onDidActiveEditorChange())),this._register(this.configurationService.onDidChangeConfiguration(e=>{(e.affectsConfiguration($i.defaultChatAgent?.completionsEnablementSetting)||e.affectsConfiguration("chat.titleBar.signIn.enabled"))&&this.update()}))}onDidActiveEditorChange(){this.update(),this.activeCodeEditorListener.clear();let e=da(this.editorService.activeTextEditorControl);e&&(this.activeCodeEditorListener.value=e.onDidChangeModelLanguage(()=>{this.update()}))}getEntryProps(){let e="$(copilot)",t=d(8305,null),o;if(X4t(this.chatEntitlementService)){let r=this.chatEntitlementService.entitlement;if(this.chatEntitlementService.sentiment.later||r===3||O0(r)||r===5)return this.getSetupEntryProps()}else{let r=this.chatEntitlementService.quotas,s=r.chat?.percentRemaining===0,l=r.completions?.percentRemaining===0,c=r.premiumChat?.unlimited&&r.premiumChat.hasQuota===!1&&!(r.additionalUsageEnabled??!1);if(this.chatEntitlementService.sentiment.disabled||this.chatEntitlementService.sentiment.untrusted)e="$(copilot-unavailable)",t=d(8309,null);else if(this.runningSessionsCount>0)e="$(copilot-in-progress)",this.runningSessionsCount>1?t=d(8303,null,this.runningSessionsCount):t=d(8302,null);else{if(this.chatEntitlementService.entitlement===1&&!this.chatEntitlementService.hasByokModels)return this.getSetupEntryProps();if(this.chatEntitlementService.entitlement===5&&(s||l)){let u;s&&!l?u=d(8301,null):l&&!s?u=d(8307,null):u=d(8300,null),e=`$(copilot-warning) ${u}`,t=u,o="prominent"}else if((this.chatEntitlementService.entitlement===8||this.chatEntitlementService.entitlement===9)&&c){let u=d(8300,null);e=`$(copilot-warning) ${u}`,t=u,o="prominent"}else this.editorService.activeTextEditorLanguageId&&!XY(this.configurationService,this.editorService.activeTextEditorLanguageId)?(e="$(copilot-unavailable)",t=d(8306,null)):this.completionsService.isSnoozing()&&(e="$(copilot-snooze)",t=d(8308,null))}}return{name:d(8304,null),text:e,ariaLabel:t,command:i3,showInAllWindows:!0,kind:o,content:this.entryAnchor,tooltip:{element:r=>{let s=new O;s.add(r.onCancellationRequested(()=>{s.dispose()}));let l=h9.instantiateInContents(this.instantiationService,s,void 0);return s.add(Ly(ut,()=>{l.isConnected||s.dispose()},2e3)),l}}}}getSetupEntryProps(){let e=!this.isSignInTitleBarAffordanceVisible(),t=d(8310,null);return{name:d(8304,null),text:e?`$(copilot) ${t}`:"$(copilot)",ariaLabel:e?t:d(8305,null),command:aS,showInAllWindows:!0,kind:void 0,content:this.entryAnchor}}isSignInTitleBarAffordanceVisible(){return Ft||this.chatEntitlementService.entitlement!==1||this.chatEntitlementService.sentiment.hidden||this.chatEntitlementService.sentiment.disabledInWorkspace||!!this.contextKeyService.getContextKeyValue("updateTitleBar")||!!this.contextKeyService.getContextKeyValue(Yf.key)?!1:this.configurationService.getValue("chat.titleBar.signIn.enabled")!==!1}dispose(){super.dispose(),this.entry?.dispose(),this.entry=void 0}};g9=I([m(0,dr),m(1,F),m(2,Fr),m(3,ie),m(4,B),m(5,V4),m(6,Ms),m(7,X)],g9);var J4t=class{constructor(){this._providers=new Map}get providers(){return[...this._providers.values()]}registerProvider(i,e){return this._providers.set(e,i),ee(()=>this._providers.delete(e))}};var DIn=5e3,RIn=1e3,LIn=200,NHe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.prompt=e;this._quickInputService=t;this._terminalService=o;this._searchService=n;this._workspaceContextService=r;this._labelService=s;this._fileService=l;this._modelService=c;this._languageService=u;this._terminalGroupService=p;this._instantiationService=h;this._codeEditorService=g;this._editorService=f;this.quickPick=this._register(t.createQuickPick({useSeparators:!0}))}async createArgs(e){let{quickPick:t,prompt:o}=this;t.totalSteps=o.arguments.length,t.step=0,t.ignoreFocusOut=!0,t.sortByLabel=!1;let n={},r=[];for(let s=0;s<o.arguments.length;s++){let l=o.arguments[s],c=r.at(s);t.step=s+1,t.placeholder=l.required?l.description:`${l.description||""} (${d(13067,null)})`,t.title=d(13065,null,l.title||l.name),t.value=c?.value??(n.hasOwnProperty(l.name)&&n[l.name]||""),t.items=c?.items??[],t.activeItems=c?.activeItems??[],t.buttons=s>0?[this._quickInputService.backButton]:[];let u=await this._getArg(l,!!c,n,e);if(u.type==="back")s-=2;else{if(u.type==="cancel")return;u.type==="arg"?(r[s]={value:t.value,items:t.items.slice(),activeItems:t.activeItems.slice()},n[l.name]=u.value):bs(u)}}return t.value="",t.placeholder=d(13053,null),t.busy=!0,n}async _getArg(e,t,o,n){let{quickPick:r}=this,s=new O,l=De(this,r.value),c=[{name:d(13064,null),observer:this._promptCompletions(e,l,o)},{name:d(13055,null),observer:this._activeFileCompletions()},{name:d(13059,null),observer:this._fileCompletions(l)}];s.add(ve(u=>{if(t){l.read(u);return}let p=[];p.push({id:"insert-text",label:d(13058,null),iconClass:q.asClassName(L.textSize),action:"text",alwaysShow:!0}),p.push({id:"run-command",label:d(13056,null),description:d(13057,null),iconClass:q.asClassName(L.terminal),action:"command",alwaysShow:!0});let h=!1;for(let b of c){let S=b.observer.read(u);h||=S.busy,S.picks&&(p.push({label:b.name,type:"separator"}),p=p.concat(S.picks))}let g=r.activeItems;r.busy=h,r.items=p;let f=p.find(b=>g.some(S=>S.id===b.id)),v=c[0].observer;f?r.activeItems=[f]:v.read(u).picks?.length?r.activeItems=[p[3]]:h?r.activeItems=[]:r.activeItems=[p[0]]}));try{let u=await new Promise(h=>{n&&s.add(n.onCancellationRequested(()=>{h(void 0)})),s.add(r.onDidChangeValue(g=>{r.validationMessage=void 0,l.set(g,void 0)})),s.add(r.onDidAccept(()=>{let g=r.selectedItems[0];!r.value&&e.required&&(!g||g.action==="text"||g.action==="command")?r.validationMessage=d(13060,null):h(g||{id:"insert-text",label:"",action:"text"})})),s.add(r.onDidTriggerButton(()=>{h("back")})),s.add(r.onDidHide(()=>{h(void 0)})),r.show()});if(u==="back")return{type:"back"};if(u===void 0)return{type:"cancel"};s.clear();let p=new qe;switch(s.add(ee(()=>p.dispose(!0))),s.add(r.onDidHide(()=>s.dispose())),u.action){case"text":return{type:"arg",value:r.value||void 0};case"command":return r.value?(r.busy=!0,{type:"arg",value:await this._getTerminalOutput(r.value,p.token)}):{type:"arg",value:void 0};case"suggest":return{type:"arg",value:u.label};case"file":return r.busy=!0,{type:"arg",value:await this._fileService.readFile(u.uri).then(h=>h.value.toString())};case"selectedText":return{type:"arg",value:u.selectedText};default:bs(u)}}finally{s.dispose()}}_promptCompletions(e,t,o){let n={};for(let[r,s]of Object.entries(o))s&&(n[r]=s);return this._asyncCompletions(t,async(r,s)=>(await this.prompt.complete(e.name,r,n,s)).map(c=>({id:`suggest:${c}`,label:c,action:"suggest"})))}_fileCompletions(e){let t=this._instantiationService.createInstance(JS);return this._asyncCompletions(e,async(o,n)=>{if(!o)return[];let r=t.file(this._workspaceContextService.getWorkspace().folders,{filePattern:o,maxResults:10}),{results:s}=await this._searchService.fileSearch(r,n);return s.map(l=>({id:l.resource.toString(),label:Be(l.resource),description:this._labelService.getUriLabel(l.resource),iconClasses:Ia(this._modelService,this._languageService,l.resource),uri:l.resource,action:"file"}))})}_activeFileCompletions(){let e=qr(this,this._editorService.onDidActiveEditorChange),t=ke(r=>(e.read(r),this._codeEditorService.getActiveCodeEditor())),o=t.map(r=>r?qr(this,r.onDidChangeModel).map(()=>r.getModel()?.uri):void 0).map((r,s)=>r?.read(s)),n=t.map(r=>r?qr(this,r.onDidChangeCursorSelection).map(()=>({range:r.getSelection(),model:r.getModel()})):void 0).map((r,s)=>r?.read(s));return ke(r=>{let s=o.read(r);if(!s)return{busy:!1,picks:[]};let l=[];l.push({id:"active-file",label:d(13054,null),description:this._labelService.getUriLabel(s),iconClasses:Ia(this._modelService,this._languageService,s),uri:s,action:"file"});let c=n.read(r);if(c&&c.model&&c.range&&!c.range.isEmpty()){let u=c.model.getValueInRange(c.range),p=c.range.endLineNumber-c.range.startLineNumber+1,h=p===1?d(13063,null,c.range.startLineNumber):d(13062,null,p);l.push({id:"selected-text",label:d(13061,null),description:h,selectedText:u,iconClass:q.asClassName(L.selection),uri:s,action:"selectedText"})}return{picks:l,busy:!1}})}_asyncCompletions(e,t){return ke(n=>{let r=e.read(n),s=new qe;return n.store.add(ee(()=>s.dispose(!0))),new Uc(Li(LIn,s.token).then(()=>t(r,s.token)).catch(()=>[]))}).map((n,r)=>{let s=n.promiseResult.read(r);return{picks:s?.data||[],busy:s===void 0}})}async _getTerminalOutput(e,t){let o=this._terminal??=this._register(await this._terminalService.createTerminal({config:{name:d(13066,null),isTransient:!0,forceShellIntegration:!0,isFeatureTerminal:!0},location:1}));this._terminalService.setActiveInstance(o),this._terminalGroupService.showPanel(!1);let n=o.capabilities.get(2);if(n)return this._getTerminalOutputInner(o,e,n,t);let r=new O;return await new Promise(s=>{r.add(o.capabilities.onDidAddCapability(l=>{l.id===2&&(r.dispose(),s(this._getTerminalOutputInner(o,e,l.capability,t)))})),r.add(t.onCancellationRequested(()=>{r.dispose(),s(void 0)})),r.add(Zo(()=>{r.dispose(),s(this._getTerminalOutputInner(o,e,void 0,t))},DIn))})}async _getTerminalOutputInner(e,t,o,n){let r=new O;return new Promise(s=>{let l="";if(r.add(e.onLineData(c=>l+=c+`
`)),o)r.add(o.onCommandFinished(c=>s(c.getOutput()||l)));else{let c=r.add(new Dt(()=>s(l),RIn));r.add(e.onData(()=>c.schedule()))}r.add(n.onCancellationRequested(()=>s(void 0))),r.add(e.onDisposed(()=>s(void 0))),e.runCommand(t,!0)}).finally(()=>{r.dispose()})}};NHe=I([m(1,$e),m(2,an),m(3,Gg),m(4,Ae),m(5,nt),m(6,ge),m(7,_t),m(8,Rt),m(9,Cc),m(10,F),m(11,Qt),m(12,ie)],NHe);var OHe=class extends ll{constructor(e,t,o,n,r,s){super();this.contextViewProvider=t;this.contextKeyService=n;this.configurationService=r;this.keybindingService=s;this._onSubmit=this._register(new T);this.onSubmit=this._onSubmit.event;this._onCancel=this._register(new T);this.onCancel=this._onCancel.event;o={ariaLabel:d(15017,null),...o},this.width=o.width??100,this.render(o),e.appendChild(this.domNode)}static{this.OPTION_CHANGE="optionChange"}dispose(){super.dispose(),this.inputFocusTracker?.dispose()}setWidth(e){this.width=e,this.contextViewProvider.layout(),this.setInputWidth()}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}select(){this.inputBox.select()}focus(){this.inputBox.focus()}inputHasFocus(){return this.inputBox.hasFocus()}setInputWidth(){this.inputBox.width=this.width-this.getSubcontrolsWidth()-2}getSubcontrolsWidth(){return 0}getHistory(){return this.inputBox.getHistory()}clearHistory(){this.inputBox.clearHistory()}prependHistory(e){this.inputBox.prependHistory(e)}clear(){this.setValue("")}onSearchSubmit(){this.inputBox.addToHistory()}showNextTerm(){this.inputBox.showNextValue()}showPreviousTerm(){this.inputBox.showPreviousValue()}render(e){this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput");let t=e.history||[];this.inputBox=this._register(new YK(this.domNode,this.contextViewProvider,{placeholder:e.placeholder,showPlaceholderOnFocus:e.showPlaceholderOnFocus,tooltip:e.tooltip,ariaLabel:e.ariaLabel,validationOptions:{validation:void 0},history:new Set(t),showHistoryHint:()=>mM(this.keybindingService),inputBoxStyles:e.inputBoxStyles},this.contextKeyService)),this._register(this.inputBox.onDidChange(()=>this._onSubmit.fire(!0))),this.inputFocusTracker=nr(this.inputBox.inputElement),this.onkeyup(this.inputBox.inputElement,n=>this.onInputKeyUp(n));let o=document.createElement("div");o.className="controls",this.renderSubcontrols(o),this.domNode.appendChild(o),this.setInputWidth()}renderSubcontrols(e){}onInputKeyUp(e){switch(e.keyCode){case 3:this.onSearchSubmit(),this._onSubmit.fire(!1);return;case 9:this._onCancel.fire();return}}};OHe=I([m(3,X),m(4,B),m(5,Le)],OHe);var yre=class extends OHe{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this._onChangeSearchInEditorsBoxEmitter=this._register(new T);this.onChangeSearchInEditorsBox=this._onChangeSearchInEditorsBoxEmitter.event}dispose(){super.dispose(),this.useSearchInEditorsBox.dispose()}onlySearchInOpenEditors(){return this.useSearchInEditorsBox.checked}setOnlySearchInOpenEditors(e){this.useSearchInEditorsBox.checked=e,this._onChangeSearchInEditorsBoxEmitter.fire()}getSubcontrolsWidth(){return super.getSubcontrolsWidth()+this.useSearchInEditorsBox.width()}renderSubcontrols(e){this.useSearchInEditorsBox=this._register(new Lm({icon:L.book,title:d(15018,null),isChecked:!1,...zh})),this._register(this.useSearchInEditorsBox.onChange(t=>{this._onChangeSearchInEditorsBoxEmitter.fire(),t||this.inputBox.focus()})),e.appendChild(this.useSearchInEditorsBox.domNode),super.renderSubcontrols(e)}};yre=I([m(3,X),m(4,B),m(5,Le)],yre);var wre=class extends OHe{constructor(e,t,o,n,r,s){super(e,t,o,n,r,s);this._onChangeIgnoreBoxEmitter=this._register(new T);this.onChangeIgnoreBox=this._onChangeIgnoreBoxEmitter.event}dispose(){super.dispose(),this.useExcludesAndIgnoreFilesBox.dispose()}useExcludesAndIgnoreFiles(){return this.useExcludesAndIgnoreFilesBox.checked}setUseExcludesAndIgnoreFiles(e){this.useExcludesAndIgnoreFilesBox.checked=e,this._onChangeIgnoreBoxEmitter.fire()}getSubcontrolsWidth(){return super.getSubcontrolsWidth()+this.useExcludesAndIgnoreFilesBox.width()}renderSubcontrols(e){this.useExcludesAndIgnoreFilesBox=this._register(new Lm({icon:L.exclude,actionClassName:"useExcludesAndIgnoreFiles",title:d(15019,null),isChecked:!0,...zh})),this._register(this.useExcludesAndIgnoreFilesBox.onChange(t=>{this._onChangeIgnoreBoxEmitter.fire(),t||this.inputBox.focus()})),e.appendChild(this.useExcludesAndIgnoreFilesBox.domNode),super.renderSubcontrols(e)}};wre=I([m(3,X),m(4,B),m(5,Le)],wre);var Tbe=Oe("search-details",L.ellipsis,d(15205,null)),QLo=Oe("search-see-more",L.goToSearch,d(15214,null)),YLo=Oe("search-show-context",L.listSelection,d(15217,null)),Z4t=Oe("search-hide-replace",L.chevronRight,d(15207,null)),gVi=Oe("search-show-replace",L.chevronDown,d(15218,null)),XLo=Oe("search-replace-all",L.replaceAll,d(15212,null)),e3t=Oe("search-replace",L.replace,d(15213,null)),JLo=Oe("search-remove",L.close,d(15211,null)),t3t=Oe("search-refresh",L.refresh,d(15210,null)),ZLo=Oe("search-collapse-results",L.collapseAll,d(15204,null)),eMo=Oe("search-expand-results",L.expandAll,d(15206,null)),tMo=Oe("search-tree",L.listTree,d(15216,null)),iMo=Oe("search-list",L.listFlat,d(15215,null)),oMo=Oe("search-clear-results",L.clearAll,d(15203,null)),nMo=Oe("search-stop",L.searchStop,d(15221,null)),fVi=Oe("search-view-icon",L.searchLarge,d(15222,null)),rMo=Oe("search-new-editor",L.newFile,d(15208,null)),sMo=Oe("search-open-in-file",L.goToFile,d(15209,null)),lxg=Oe("search-sparkle-filled",L.sparkleFilled,d(15220,null)),cxg=Oe("search-sparkle-empty",L.sparkle,d(15219,null));var i3t=(a,i,e,t,o,n,r)=>{let s=_("div.providerMessage"),l=ZS(a.text);D(s,_("."+eE.className(a.type===1?wt.Info:wt.Warning).split(" ").join(".")));for(let c of l.nodes)if(typeof c=="string")D(s,document.createTextNode(c));else{let u=i.createInstance(Bg,s,c,{opener:async p=>{if(!a.trusted)return;let h=A.parse(p,!0);h.scheme===Q.command&&a.trusted?(await o.executeCommand(h.path))?.triggerSearch&&r():h.scheme===Q.https?t.open(h):h.scheme===Q.command&&!a.trusted?e.error(d(15224,null,p)):e.error(d(15223,null,p))}});n.add(u)}return s};function bct(a){return a&&a.getFullRange&&a.getFullRange()instanceof G}var Sct=class a{static{this.ITEM_HEIGHT=22}getHeight(i){return a.ITEM_HEIGHT}getTemplateId(i){if(ru(i))return v9.TEMPLATE_ID;if(Bl(i))return b9.TEMPLATE_ID;if(pl(i))return S9.TEMPLATE_ID;if(Pv(i))return f9.TEMPLATE_ID;throw console.error("Invalid search tree element",i),new Error("Invalid search tree element")}},f9=class extends k{constructor(e,t,o,n){super();this.labels=e;this.contextService=t;this.instantiationService=o;this.contextKeyService=n;this.templateId=f9.TEMPLATE_ID}static{this.TEMPLATE_ID="textResultMatch"}renderTemplate(e){let t=new O,o=D(e,_(".textsearchresult")),n=this.labels.create(o,{supportDescriptionHighlights:!0,supportHighlights:!0,supportIcons:!0});t.add(n);let r=D(o,_(".actionBarContainer")),s=t.add(this.contextKeyService.createScoped(e)),l=t.add(this.instantiationService.createChild(new Po([X,s]))),c=t.add(l.createInstance(pr,r,R.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},highlightToggledItems:!0,hiddenItemStrategy:0,toolbarOptions:{primaryGroup:u=>/^inline/.test(u)}}));return{label:n,disposables:t,actions:c,contextKeyService:s}}async renderElement(e,t,o){if(F_o(e.element))o.label.setLabel(d(15240,null)),Ri.AIResultsTitle.bindTo(o.contextKeyService).set(!1),Ri.MatchFocusKey.bindTo(o.contextKeyService).set(!1),Ri.FileFocusKey.bindTo(o.contextKeyService).set(!1),Ri.FolderFocusKey.bindTo(o.contextKeyService).set(!1);else{try{await e.element.parent().searchModel.getAITextResultProviderName()}catch{}let n=d(15238,null);o.label.setLabel(`$(${L.searchSparkle.id}) ${n}`),Ri.AIResultsTitle.bindTo(o.contextKeyService).set(!0),Ri.MatchFocusKey.bindTo(o.contextKeyService).set(!1),Ri.FileFocusKey.bindTo(o.contextKeyService).set(!1),Ri.FolderFocusKey.bindTo(o.contextKeyService).set(!1)}}disposeTemplate(e){e.disposables.dispose()}renderCompressedElements(e,t,o){}};f9=I([m(1,Ae),m(2,F),m(3,X)],f9);var v9=class extends k{constructor(e,t,o,n,r,s){super();this.searchView=e;this.labels=t;this.contextService=o;this.labelService=n;this.instantiationService=r;this.contextKeyService=s;this.templateId=v9.TEMPLATE_ID}static{this.TEMPLATE_ID="folderMatch"}renderCompressedElements(e,t,o){let n=e.element,r=n.elements[n.elements.length-1],s=n.elements.map(l=>l.name());if(r.resource){let l=m$(r)?2:1;o.label.setResource({resource:r.resource,name:s},{fileKind:l,separator:this.labelService.getSeparator(r.resource.scheme)})}else o.label.setLabel(d(15239,null));this.renderFolderDetails(r,o)}renderTemplate(e){let t=new O,o=D(e,_(".foldermatch")),n=this.labels.create(o,{supportDescriptionHighlights:!0,supportHighlights:!0});t.add(n);let r=new eb(D(o,_(".badge")),{},VI);t.add(r);let s=D(o,_(".actionBarContainer")),l=new O;t.add(l);let c=t.add(this.contextKeyService.createScoped(e));Ri.AIResultsTitle.bindTo(c).set(!1),Ri.MatchFocusKey.bindTo(c).set(!1),Ri.FileFocusKey.bindTo(c).set(!1),Ri.FolderFocusKey.bindTo(c).set(!0);let u=t.add(this.instantiationService.createChild(new Po([X,c]))),p=t.add(u.createInstance(pr,s,R.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:h=>/^inline/.test(h)}}));return{label:n,badge:r,actions:p,disposables:t,elementDisposables:l,contextKeyService:c}}renderElement(e,t,o){let n=e.element;if(n.resource){let r=this.contextService.getWorkspaceFolder(n.resource);r&&ze(r.uri,n.resource)?o.label.setFile(n.resource,{fileKind:2,hidePath:!0}):o.label.setFile(n.resource,{fileKind:1,hidePath:this.searchView.isTreeLayoutViewVisible})}else o.label.setLabel(d(15239,null));Ri.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches()),o.elementDisposables.add(n.onChange(()=>{Ri.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches())})),this.renderFolderDetails(n,o)}disposeElement(e,t,o){o.elementDisposables.clear()}disposeCompressedElements(e,t,o){o.elementDisposables.clear()}disposeTemplate(e){e.disposables.dispose()}renderFolderDetails(e,t){let o=e.recursiveMatchCount();t.badge.setCount(o),t.badge.setTitleFormat(o>1?d(15237,null,o):d(15236,null,o)),t.actions.context={viewer:this.searchView.getControl(),element:e}}};v9=I([m(2,Ae),m(3,nt),m(4,F),m(5,X)],v9);var b9=class extends k{constructor(e,t,o,n,r,s){super();this.searchView=e;this.labels=t;this.contextService=o;this.configurationService=n;this.instantiationService=r;this.contextKeyService=s;this.templateId=b9.TEMPLATE_ID}static{this.TEMPLATE_ID="fileMatch"}renderCompressedElements(e,t,o){throw new Error("Should never happen since node is incompressible.")}renderTemplate(e){let t=new O,o=new O;t.add(o);let n=D(e,_(".filematch")),r=this.labels.create(n);t.add(r);let s=new eb(D(n,_(".badge")),{},VI);t.add(s);let l=D(n,_(".actionBarContainer")),c=t.add(this.contextKeyService.createScoped(e));Ri.AIResultsTitle.bindTo(c).set(!1),Ri.MatchFocusKey.bindTo(c).set(!1),Ri.FileFocusKey.bindTo(c).set(!0),Ri.FolderFocusKey.bindTo(c).set(!1);let u=t.add(this.instantiationService.createChild(new Po([X,c]))),p=t.add(u.createInstance(pr,l,R.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:h=>/^inline/.test(h)}}));return{el:n,label:r,badge:s,actions:p,disposables:t,elementDisposables:o,contextKeyService:c}}renderElement(e,t,o){let n=e.element;o.el.setAttribute("data-resource",n.resource.toString());let r=this.configurationService.getValue("search").decorations;o.label.setFile(n.resource,{range:bct(n)?n.getFullRange():void 0,hidePath:this.searchView.isTreeLayoutViewVisible&&!TV(n.parent()),hideIcon:!1,fileDecorations:{colors:r.colors,badges:r.badges}});let s=n.count();o.badge.setCount(s),o.badge.setTitleFormat(s>1?d(15242,null,s):d(15241,null,s)),o.actions.context={viewer:this.searchView.getControl(),element:n},Ri.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches()),o.elementDisposables.add(n.onChange(()=>{Ri.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.hasOnlyReadOnlyMatches())})),o.el.parentElement?.parentElement?.querySelector(".monaco-tl-twistie")?.classList.add("force-twistie")}disposeElement(e,t,o){o.elementDisposables.clear()}disposeTemplate(e){e.disposables.dispose()}};b9=I([m(2,Ae),m(3,B),m(4,F),m(5,X)],b9);var S9=class extends k{constructor(e,t,o,n,r,s){super();this.searchView=e;this.contextService=t;this.configurationService=o;this.instantiationService=n;this.contextKeyService=r;this.hoverService=s;this.templateId=S9.TEMPLATE_ID}static{this.TEMPLATE_ID="match"}renderCompressedElements(e,t,o){throw new Error("Should never happen since node is incompressible.")}renderTemplate(e){e.classList.add("linematch");let t=D(e,_("span.matchLineNum")),o=D(e,_("a.plain.match")),n=D(o,_("span")),r=D(o,_("span.findInFileMatch")),s=D(o,_("span.replaceMatch")),l=D(o,_("span")),c=D(e,_("span.actionBarContainer")),u=new O,p=u.add(this.contextKeyService.createScoped(e));Ri.AIResultsTitle.bindTo(p).set(!1),Ri.MatchFocusKey.bindTo(p).set(!0),Ri.FileFocusKey.bindTo(p).set(!1),Ri.FolderFocusKey.bindTo(p).set(!1);let h=u.add(this.instantiationService.createChild(new Po([X,p]))),g=u.add(h.createInstance(pr,c,R.SearchActionMenu,{menuOptions:{shouldForwardArgs:!0},hiddenItemStrategy:0,toolbarOptions:{primaryGroup:f=>/^inline/.test(f)}}));return{parent:o,before:n,match:r,replace:s,after:l,lineNumber:t,actions:g,disposables:u,contextKeyService:p}}renderElement(e,t,o){let n=e.element,r=n.preview(),s=this.searchView.model.isReplaceActive()&&!!this.searchView.model.replaceString&&!n.isReadonly;o.before.textContent=r.before,o.match.textContent=r.inside,o.match.classList.toggle("replace",s),o.replace.textContent=s?n.replaceString:"",o.after.textContent=r.after;let l=(r.fullBefore+(s?n.replaceString:r.inside)+r.after).trim().substr(0,999);o.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),o.parent,l)),Ri.IsEditableItemKey.bindTo(o.contextKeyService).set(!n.isReadonly);let c=n.range().endLineNumber-n.range().startLineNumber,u=c>0?`+${c}`:"",p=this.configurationService.getValue("search").showLineNumbers,h=p?`${n.range().startLineNumber}:`:"";o.lineNumber.classList.toggle("show",c>0||p),o.lineNumber.textContent=h+u,o.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),o.lineNumber,this.getMatchTitle(n,p))),o.actions.context={viewer:this.searchView.getControl(),element:n}}disposeTemplate(e){e.disposables.dispose()}getMatchTitle(e,t){let o=e.range().startLineNumber,n=e.range().endLineNumber-e.range().startLineNumber,r=t?d(15231,null,o,n)+" ":"",s=n>0?"+ "+d(15232,null,n):"";return r+s}};S9=I([m(1,Ae),m(2,B),m(3,F),m(4,X),m(5,ot)],S9);var FHe=class{constructor(i,e){this.searchView=i;this.labelService=e}getWidgetAriaLabel(){return d(15235,null)}getAriaLabel(i){if(ru(i)){let e=i.allDownstreamFileMatches().reduce((t,o)=>t+o.count(),0);return i.resource?d(15230,null,e,i.name()):d(15233,null,e)}if(Bl(i)){let e=this.labelService.getUriLabel(i.resource,{relative:!0})||i.resource.fsPath;return d(15229,null,i.count(),i.name(),yd(e))}if(pl(i)){let e=i,t=this.searchView.model,o=t.isReplaceActive()&&!!t.replaceString,n=e.getMatchString(),r=e.range(),s=e.text().substr(0,r.endColumn+150);return o?d(15234,null,s,r.startColumn,n,e.replaceString):d(15243,null,s,r.startColumn,n)}return null}};FHe=I([m(1,nt)],FHe);var SS=new Y("inSearchEditor",!1),WHe="search-editor",o3t="search/editor",vVi="searchEditorFindMatch",Ict="workbench.editor.searchEditor",aMo="search.action.openNewEditor",Cre="search.action.openEditor",n3t="toggleSearchEditorContextLines",yct="workbench.editorinputs.searchEditorInput";function xre(a){return a&&typeof a.bindNotebookEditorWidget=="function"&&typeof a.updateMatchesForEditorWidget=="function"&&typeof a.unbindNotebookEditorWidget=="function"&&typeof a.updateNotebookHighlights=="function"&&Bl(a)}function _1(a){return typeof a=="object"&&a!==null&&typeof a.parent=="function"&&typeof a.cellParent=="object"&&typeof a.isWebviewMatch=="function"&&typeof a.cellIndex=="number"&&(typeof a.webviewIndex=="number"||a.webviewIndex===void 0)&&(typeof a.cell=="object"||a.cell===void 0)}var bVi=-1,SVi=-1;function TO(a,i,e="default"){if(Bl(a)&&ru(i))return 1;if(Bl(i)&&ru(a))return-1;if(ru(a)&&ru(i)){if(bVi=a.index(),SVi=i.index(),bVi!==-1&&SVi!==-1)return bVi-SVi;if(bct(a)&&bct(i))return a.rank-i.rank;switch(e){case"countDescending":return i.count()-a.count();case"countAscending":return a.count()-i.count();case"type":return wEi(a.name(),i.name());case"fileNames":return C_(a.name(),i.name());default:return!a.resource||!i.resource?0:Cte(a.resource.fsPath,i.resource.fsPath)||C_(a.name(),i.name())}}if(Bl(a)&&Bl(i))switch(e){case"countDescending":return i.count()-a.count();case"countAscending":return a.count()-i.count();case"type":return wEi(a.name(),i.name());case"fileNames":return C_(a.name(),i.name());case"modified":{let t=a.fileStat,o=i.fileStat;if(t&&o)return o.mtime-t.mtime}default:return Cte(a.resource.fsPath,i.resource.fsPath)||C_(a.name(),i.name())}return _1(a)&&_1(i)?MIn(a,i):pl(a)&&pl(i)?G.compareRangesUsingStarts(a.range(),i.range()):0}function MIn(a,i){return a.cellIndex===i.cellIndex?a.webviewIndex!==void 0&&i.webviewIndex!==void 0?a.webviewIndex-i.webviewIndex:a.webviewIndex===void 0&&i.webviewIndex===void 0?G.compareRangesUsingStarts(a.range(),i.range()):a.webviewIndex!==void 0?1:-1:a.cellIndex<i.cellIndex?-1:1}function s3t(a,i,e="default"){let t=AFi(a),o=AFi(i),n=t.length-1,r=o.length-1;for(;n>=0&&r>=0;){if(t[n].id()!==o[r].id())return TO(t[n],o[r],e);n--,r--}let s=n===0,l=r===0;return s&&!l?1:!s&&l?-1:0}var Hl=P(15147,"Search");function lMo(a){let i=vd(a);return!!(i&&Is(i.getContainer()))}function vd(a){return a.getActiveViewWithId(ow)}function wct(a,i,e){let t=a.getSelection().filter(o=>o!==null).sort((o,n)=>s3t(o,n,e?.sortOrder));return i&&!(t.length>1&&t.includes(i))&&(t=[i]),t}function cMo(a,i){return i?!i||a.includes(i)||PIn(a,i):!1}function PIn(a,i){for(let e of a)if(Bl(e)&&pl(i)&&e.matches().includes(i)||ru(e)&&(Bl(i)&&e.getDownstreamFileMatch(i.resource)||pl(i)&&e.getDownstreamFileMatch(i.parent().resource)))return!0;return!1}function I9(a,i){return a.openView(ow,i).then(e=>e??void 0)}async function a3t(a,i={}){let e=a.get(B).getValue().search,t=a.get(Gt),o=a.get(fe),n={};if(Object.keys(i).length!==0){let s=a.get(Xp),l=a.get(fa),c=a.get(Ae),u=l.getLastActiveWorkspaceRoot(),p=u?.scheme===Q.file||u?.scheme===Q.vscodeRemote?u:void 0,h=p?c.getWorkspaceFolder(p)??void 0:void 0;for(let g of Object.entries(i)){let f=g[0],v=g[1];v!==void 0&&(n[f]=typeof v=="string"?await s.resolveAsync(h,v):v)}}let r=e?.mode;if(r==="view")I9(t,!1).then(s=>{if(s){s.searchAndReplaceWidget.toggleReplace(typeof n.replace=="string");let c=!1;typeof n.query!="string"&&(c=s.updateTextFromFindWidgetOrSelection({allowUnselectedWord:typeof n.replace!="string"})),s.setSearchParameters(n),typeof n.showIncludesExcludes=="boolean"&&s.toggleQueryDetails(!1,n.showIncludesExcludes),s.searchAndReplaceWidget.focus(void 0,c,c)}});else{let s=l=>({location:r==="newEditor"?"new":"reuse",query:l.query,filesToInclude:l.filesToInclude,filesToExclude:l.filesToExclude,matchWholeWord:l.matchWholeWord,isCaseSensitive:l.isCaseSensitive,isRegexp:l.isRegex,useExcludeSettingsAndIgnoreFiles:l.useExcludeSettingsAndIgnoreFiles,onlyOpenEditors:l.onlyOpenEditors,showIncludesExcludes:!!(l.filesToExclude||l.filesToExclude||!l.useExcludeSettingsAndIgnoreFiles)});o.executeCommand(Cre,s(n))}}var l3t=class extends XK{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n);this.contextMenuService=r;this.instantiationService=s;this.filters=l;this._filterChecked=!1;this._onDidChangeAIToggle=this._register(new T);this.onDidChangeAIToggle=this._onDidChangeAIToggle.event;this._findFilter=this._register(new Iat(l,r,s,o,d(15202,null))),this._updatePadding(),this.controls.appendChild(this._findFilter.container),this._findFilter.container.classList.add("monaco-custom-toggle"),this.filterVisible=c}_updatePadding(){this.inputBox.paddingRight=(this.caseSensitive?.visible?this.caseSensitive.width():0)+(this.wholeWords?.visible?this.wholeWords.width():0)+(this.regex?.visible?this.regex.width():0)+(this._findFilter.visible?this._findFilter.width():0)}set filterVisible(e){this._findFilter.visible=e,this.updateFilterStyles(),this._updatePadding()}setEnabled(e){super.setEnabled(e),e&&(!this._filterChecked||!this._findFilter.visible)?this.regex?.enable():this.regex?.disable()}updateFilterStyles(){this._filterChecked=!this.filters.markupInput||!this.filters.markupPreview||!this.filters.codeInput||!this.filters.codeOutput,this._findFilter.applyStyles(this._filterChecked)}};var mMo=26,VHe=class a extends it{constructor(e){super(a.ID,"",q.asClassName(XLo),!1);this._searchWidget=e}static{this.ID="search.action.replaceAll"}set searchWidget(e){this._searchWidget=e}run(){return this._searchWidget?this._searchWidget.triggerReplaceAll():Promise.resolve()}},yVi={groupId:"search-widget"},dMo=et?256:2048;function uMo(a,i,e){let t=!!i.match(/\n/);if(e&&(t||e.clientHeight>mMo)&&e.selectionStart>0){a.stopPropagation();return}}function pMo(a,i,e){let t=!!i.match(/\n/);if(e&&(t||e.clientHeight>mMo)&&e.selectionEnd<e.value.length){a.stopPropagation();return}}var jP=class extends ll{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.contextViewService=o;this.contextKeyService=n;this.keybindingService=r;this.clipboardServce=s;this.configurationService=l;this.accessibilityService=c;this.contextMenuService=u;this.instantiationService=p;this.editorService=h;this.ignoreGlobalFindBufferOnNextFocus=!1;this.previousGlobalFindBufferValue=null;this._accessibilityHelpHintAnnounced=!1;this._onSearchSubmit=this._register(new T);this.onSearchSubmit=this._onSearchSubmit.event;this._onSearchCancel=this._register(new T);this.onSearchCancel=this._onSearchCancel.event;this._onReplaceToggled=this._register(new T);this.onReplaceToggled=this._onReplaceToggled.event;this._onReplaceStateChange=this._register(new T);this.onReplaceStateChange=this._onReplaceStateChange.event;this._onPreserveCaseChange=this._register(new T);this.onPreserveCaseChange=this._onPreserveCaseChange.event;this._onReplaceValueChanged=this._register(new T);this.onReplaceValueChanged=this._onReplaceValueChanged.event;this._onReplaceAll=this._register(new T);this.onReplaceAll=this._onReplaceAll.event;this._onBlur=this._register(new T);this.onBlur=this._onBlur.event;this._onDidHeightChange=this._register(new T);this.onDidHeightChange=this._onDidHeightChange.event;this._onDidToggleContext=this._register(new T);this.onDidToggleContext=this._onDidToggleContext.event;this.replaceActive=Ri.ReplaceActiveKey.bindTo(this.contextKeyService),this.searchInputBoxFocused=Ri.SearchInputBoxFocusedKey.bindTo(this.contextKeyService),this.replaceInputBoxFocused=Ri.ReplaceInputBoxFocusedKey.bindTo(this.contextKeyService);let g=t.notebookOptions??{isInNotebookMarkdownInput:!0,isInNotebookMarkdownPreview:!0,isInNotebookCellInput:!0,isInNotebookCellOutput:!0};this._notebookFilters=this._register(new eVe(g.isInNotebookMarkdownInput,g.isInNotebookMarkdownPreview,g.isInNotebookCellInput,g.isInNotebookCellOutput,{findScopeType:"none"})),this._register(this._notebookFilters.onDidChange(()=>{this.searchInput&&this.searchInput.updateFilterStyles()})),this._register(this.editorService.onDidEditorsChange(f=>{this.searchInput&&f.event.editor instanceof Ga&&(f.event.kind===5||f.event.kind===6)&&(this.searchInput.filterVisible=this._hasNotebookOpen())})),this._replaceHistoryDelayer=new rn(500),this._toggleReplaceButtonListener=this._register(new ue),this.render(e,t),this._register(this.configurationService.onDidChangeConfiguration(f=>{f.affectsConfiguration("editor.accessibilitySupport")&&this.updateAccessibilitySupport()})),this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this.updateAccessibilitySupport())),this.updateAccessibilitySupport()}static{this.INPUT_MAX_HEIGHT=134}static{this.REPLACE_ALL_DISABLED_LABEL=d(15304,null)}static{this.REPLACE_ALL_ENABLED_LABEL=e=>e.appendKeybinding(d(15305,null),VHe.ID)}_hasNotebookOpen(){return this.editorService.editors.some(t=>t instanceof Ga)}getNotebookFilters(){return this._notebookFilters}focus(e=!0,t=!1,o=!1){this.ignoreGlobalFindBufferOnNextFocus=o,t&&this.isReplaceShown()?this.replaceInput&&(this._updateSearchInputAriaLabel(!1),this.replaceInput.focus(),e&&this.replaceInput.select()):this.searchInput&&(this._updateSearchInputAriaLabel(!0),this.searchInput.focus(),e&&this.searchInput.select())}_updateSearchInputAriaLabel(e){if(!this.searchInput)return;let t=d(15303,null);if(e&&!this._accessibilityHelpHintAnnounced&&this.configurationService.getValue("accessibility.verbosity.find")&&this.accessibilityService.isScreenReaderOptimized()){let o=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();o&&(t+=", "+d(15301,null,o),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=Zo(()=>{this.searchInput&&this.searchInput.inputBox.setAriaLabel(d(15303,null))},1e3))}this.searchInput.inputBox.setAriaLabel(t)}setWidth(e){this.searchInput?.inputBox.layout(),this.replaceInput&&(this.replaceInput.width=e-28,this.replaceInput.inputBox.layout())}clear(){this.searchInput?.clear(),this.replaceInput?.setValue(""),this.setReplaceAllActionState(!1)}isReplaceShown(){return this.replaceContainer?!this.replaceContainer.classList.contains("disabled"):!1}isReplaceActive(){return!!this.replaceActive.get()}getReplaceValue(){return this.replaceInput?.getValue()??""}toggleReplace(e){(e===void 0||e!==this.isReplaceShown())&&this.onToggleReplaceButton()}getSearchHistory(){return this.searchInput?.inputBox.getHistory()??[]}getReplaceHistory(){return this.replaceInput?.inputBox.getHistory()??[]}prependSearchHistory(e){this.searchInput?.inputBox.prependHistory(e)}prependReplaceHistory(e){this.replaceInput?.inputBox.prependHistory(e)}clearHistory(){this.searchInput?.inputBox.clearHistory(),this.replaceInput?.inputBox.clearHistory()}showNextSearchTerm(){this.searchInput?.inputBox.showNextValue()}showPreviousSearchTerm(){this.searchInput?.inputBox.showPreviousValue()}showNextReplaceTerm(){this.replaceInput?.inputBox.showNextValue()}showPreviousReplaceTerm(){this.replaceInput?.inputBox.showPreviousValue()}searchInputHasFocus(){return!!this.searchInputBoxFocused.get()}replaceInputHasFocus(){return!!this.replaceInput?.inputBox.hasFocus()}focusReplaceAllAction(){this.replaceActionBar?.focus(!0)}focusRegexAction(){this.searchInput?.focusOnRegex()}set replaceButtonVisibility(e){this.toggleReplaceButton&&(this.toggleReplaceButton.element.style.display=e?"":"none")}render(e,t){this.domNode=D(e,_(".search-widget")),this.domNode.style.position="relative",t._hideReplaceToggle||this.renderToggleReplaceButton(this.domNode),this.renderSearchInput(this.domNode,t),this.renderReplaceInput(this.domNode,t)}updateAccessibilitySupport(){this.searchInput?.setFocusInputOnOptionClick(!this.accessibilityService.isScreenReaderOptimized())}renderToggleReplaceButton(e){let t={buttonBackground:void 0,buttonBorder:void 0,buttonForeground:void 0,buttonHoverBackground:void 0,buttonSecondaryBackground:void 0,buttonSecondaryForeground:void 0,buttonSecondaryHoverBackground:void 0,buttonSeparator:void 0,title:d(15308,null),hoverDelegate:yi("element")};this.toggleReplaceButton=this._register(new Pi(e,t)),this.toggleReplaceButton.element.setAttribute("aria-expanded","false"),this.toggleReplaceButton.element.classList.add("toggle-replace-button"),this.toggleReplaceButton.icon=Z4t,this._toggleReplaceButtonListener.value=this.toggleReplaceButton.onDidClick(()=>this.onToggleReplaceButton())}renderSearchInput(e,t){let o=t.searchHistory||[],n={label:d(15303,null),validation:s=>this.validateSearchInput(s),placeholder:d(15306,null),appendCaseSensitiveLabel:this.keybindingService.appendKeybinding("","toggleSearchCaseSensitive"),appendWholeWordsLabel:this.keybindingService.appendKeybinding("","toggleSearchWholeWord"),appendRegexLabel:this.keybindingService.appendKeybinding("","toggleSearchRegex"),history:new Set(o),showHistoryHint:()=>mM(this.keybindingService),flexibleHeight:!0,flexibleMaxHeight:jP.INPUT_MAX_HEIGHT,showCommonFindToggles:!0,inputBoxStyles:t.inputBoxStyles,toggleStyles:t.toggleStyles,hoverLifecycleOptions:yVi},r=D(e,_(".search-container.input-box"));this.searchInput=this._register(new l3t(r,this.contextViewService,n,this.contextKeyService,this.contextMenuService,this.instantiationService,this._notebookFilters,this._hasNotebookOpen())),this._register(this.searchInput.onKeyDown(s=>this.onSearchInputKeyDown(s))),this.searchInput.setValue(t.value||""),this.searchInput.setRegex(!!t.isRegex),this.searchInput.setCaseSensitive(!!t.isCaseSensitive),this.searchInput.setWholeWords(!!t.isWholeWords),this._register(this.searchInput.onCaseSensitiveKeyDown(s=>this.onCaseSensitiveKeyDown(s))),this._register(this.searchInput.onRegexKeyDown(s=>this.onRegexKeyDown(s))),this._register(this.searchInput.inputBox.onDidChange(()=>this.onSearchInputChanged())),this._register(this.searchInput.inputBox.onDidHeightChange(()=>this._onDidHeightChange.fire())),this._register(this.onReplaceValueChanged(()=>{this._replaceHistoryDelayer.trigger(()=>this.replaceInput?.inputBox.addToHistory())})),this.searchInputFocusTracker=this._register(nr(this.searchInput.inputBox.inputElement)),this._register(this.searchInputFocusTracker.onDidFocus(async()=>{this.searchInputBoxFocused.set(!0);let s=this.searchConfiguration.globalFindClipboard;if(!this.ignoreGlobalFindBufferOnNextFocus&&s){let l=await this.clipboardServce.readFindText();l&&this.previousGlobalFindBufferValue!==l&&(this.searchInput?.inputBox.addToHistory(),this.searchInput?.setValue(l),this.searchInput?.select()),this.previousGlobalFindBufferValue=l}this.ignoreGlobalFindBufferOnNextFocus=!1})),this._register(this.searchInputFocusTracker.onDidBlur(()=>this.searchInputBoxFocused.set(!1))),this.showContextToggle=new Lm({isChecked:!1,title:this.keybindingService.appendKeybinding(d(15309,null),n3t),icon:YLo,hoverLifecycleOptions:yVi,...zh}),this._register(this.showContextToggle.onChange(()=>this.onContextLinesChanged())),t.showContextToggle&&(this.contextLinesInput=new ad(r,this.contextViewService,{type:"number",inputBoxStyles:Wl}),this.contextLinesInput.element.classList.add("context-lines-input"),this.contextLinesInput.value=""+(this.configurationService.getValue("search").searchEditor.defaultNumberOfContextLines??1),this._register(this.contextLinesInput.onDidChange(s=>{s!=="0"&&(this.showContextToggle.checked=!0),this.onContextLinesChanged()})),D(r,this.showContextToggle.domNode))}onContextLinesChanged(){this._onDidToggleContext.fire(),this.contextLinesInput.value.includes("-")&&(this.contextLinesInput.value="0"),this._onDidToggleContext.fire()}setContextLines(e){this.contextLinesInput&&(e===0?this.showContextToggle.checked=!1:(this.showContextToggle.checked=!0,this.contextLinesInput.value=""+e))}renderReplaceInput(e,t){this.replaceContainer=D(e,_(".replace-container.disabled"));let o=D(this.replaceContainer,_(".replace-input"));this.replaceInput=this._register(new JK(o,this.contextViewService,{label:d(15302,null),placeholder:d(15307,null),appendPreserveCaseLabel:this.keybindingService.appendKeybinding("","toggleSearchPreserveCase"),history:new Set(t.replaceHistory),showHistoryHint:()=>mM(this.keybindingService),flexibleHeight:!0,flexibleMaxHeight:jP.INPUT_MAX_HEIGHT,inputBoxStyles:t.inputBoxStyles,toggleStyles:t.toggleStyles,hoverLifecycleOptions:yVi},this.contextKeyService,!0)),this._register(this.replaceInput.onDidOptionChange(n=>{n||this.replaceInput&&this._onPreserveCaseChange.fire(this.replaceInput.getPreserveCase())})),this._register(this.replaceInput.onKeyDown(n=>this.onReplaceInputKeyDown(n))),this.replaceInput.setValue(t.replaceValue||""),this._register(this.replaceInput.inputBox.onDidChange(()=>this._onReplaceValueChanged.fire())),this._register(this.replaceInput.inputBox.onDidHeightChange(()=>this._onDidHeightChange.fire())),this.replaceAllAction=new VHe(this),this.replaceAllAction.label=jP.REPLACE_ALL_DISABLED_LABEL,this.replaceActionBar=this._register(new oo(this.replaceContainer)),this.replaceActionBar.push([this.replaceAllAction],{icon:!0,label:!1}),this.onkeydown(this.replaceActionBar.domNode,n=>this.onReplaceActionbarKeyDown(n)),this.replaceInputFocusTracker=this._register(nr(this.replaceInput.inputBox.inputElement)),this._register(this.replaceInputFocusTracker.onDidFocus(()=>this.replaceInputBoxFocused.set(!0))),this._register(this.replaceInputFocusTracker.onDidBlur(()=>this.replaceInputBoxFocused.set(!1))),this._register(this.replaceInput.onPreserveCaseKeyDown(n=>this.onPreserveCaseKeyDown(n)))}triggerReplaceAll(){return this._onReplaceAll.fire(),Promise.resolve()}onToggleReplaceButton(){this.replaceContainer?.classList.toggle("disabled"),this.isReplaceShown()?(this.toggleReplaceButton?.element.classList.remove(...q.asClassNameArray(Z4t)),this.toggleReplaceButton?.element.classList.add(...q.asClassNameArray(gVi))):(this.toggleReplaceButton?.element.classList.remove(...q.asClassNameArray(gVi)),this.toggleReplaceButton?.element.classList.add(...q.asClassNameArray(Z4t))),this.toggleReplaceButton?.element.setAttribute("aria-expanded",this.isReplaceShown()?"true":"false"),this.updateReplaceActiveState(),this._onReplaceToggled.fire()}setValue(e){this.searchInput?.setValue(e)}setReplaceAllActionState(e){this.replaceAllAction&&this.replaceAllAction.enabled!==e&&(this.replaceAllAction.enabled=e,this.replaceAllAction.label=e?jP.REPLACE_ALL_ENABLED_LABEL(this.keybindingService):jP.REPLACE_ALL_DISABLED_LABEL,this.updateReplaceActiveState())}updateReplaceActiveState(){let e=this.isReplaceActive(),t=this.isReplaceShown()&&!!this.replaceAllAction?.enabled;e!==t&&(this.replaceActive.set(t),this._onReplaceStateChange.fire(t),this.replaceInput?.inputBox.layout())}validateSearchInput(e){if(e.length===0||!this.searchInput?.getRegex())return null;try{new RegExp(e,"u")}catch(t){return{content:t.message}}return null}onSearchInputChanged(){if(this.searchInput?.clearMessage(),this.setReplaceAllActionState(!1),this.searchConfiguration.searchOnType)if(this.searchInput?.getRegex())try{let e=new RegExp(this.searchInput.getValue(),"ug"),t=`
								~!@#$%^&*()_+
								\`1234567890-=
								qwertyuiop[]\\
								QWERTYUIOP{}|
								asdfghjkl;'
								ASDFGHJKL:"
								zxcvbnm,./
								ZXCVBNM<>? `.match(e)?.length??0,o=t<50?1:t<100?5:10;this.submitSearch(!0,this.searchConfiguration.searchOnTypeDebouncePeriod*o)}catch{}else this.submitSearch(!0,this.searchConfiguration.searchOnTypeDebouncePeriod)}onSearchInputKeyDown(e){if(e.equals(dMo|3)&&(this.searchInput?.inputBox.insertAtCursor(`
`),e.preventDefault()),e.equals(3))this.searchInput?.onSearchSubmit(),this.submitSearch(),e.preventDefault();else if(e.equals(9))this._onSearchCancel.fire({focus:!0}),e.preventDefault();else if(e.equals(2))this.isReplaceShown()?this.replaceInput?.focus():this.searchInput?.focusOnCaseSensitive(),e.preventDefault();else if(e.equals(16))uMo(e,this.searchInput?.getValue()??"",this.searchInput?.domNode.querySelector("textarea")??null);else if(e.equals(18))pMo(e,this.searchInput?.getValue()??"",this.searchInput?.domNode.querySelector("textarea")??null);else if(e.equals(11)){let t=this.searchInput?.inputBox.inputElement;t&&(t.setSelectionRange(0,0),t.focus(),e.preventDefault())}else if(e.equals(12)){let t=this.searchInput?.inputBox.inputElement;if(t){let o=t.value.length;t.setSelectionRange(o,o),t.focus(),e.preventDefault()}}}onCaseSensitiveKeyDown(e){e.equals(1026)&&this.isReplaceShown()&&(this.replaceInput?.focus(),e.preventDefault())}onRegexKeyDown(e){e.equals(2)&&this.isReplaceShown()&&(this.replaceInput?.focusOnPreserve(),e.preventDefault())}onPreserveCaseKeyDown(e){e.equals(2)?(this.isReplaceActive()?this.focusReplaceAllAction():this._onBlur.fire(),e.preventDefault()):e.equals(1026)&&(this.focusRegexAction(),e.preventDefault())}onReplaceInputKeyDown(e){e.equals(dMo|3)&&(this.replaceInput?.inputBox.insertAtCursor(`
`),e.preventDefault()),e.equals(3)?(this.submitSearch(),e.preventDefault()):e.equals(2)?(this.searchInput?.focusOnCaseSensitive(),e.preventDefault()):e.equals(1026)?(this.searchInput?.focus(),e.preventDefault()):e.equals(16)?uMo(e,this.replaceInput?.getValue()??"",this.replaceInput?.domNode.querySelector("textarea")??null):e.equals(18)&&pMo(e,this.replaceInput?.getValue()??"",this.replaceInput?.domNode.querySelector("textarea")??null)}onReplaceActionbarKeyDown(e){e.equals(1026)&&(this.focusRegexAction(),e.preventDefault())}async submitSearch(e=!1,t=0){if(this.searchInput?.validate(),!this.searchInput?.inputBox.isInputValid())return;let o=this.searchInput.getValue(),n=this.searchConfiguration.globalFindClipboard;o&&n&&await this.clipboardServce.writeFindText(o),this._onSearchSubmit.fire({triggeredOnType:e,delay:t})}getContextLines(){return this.showContextToggle.checked?+this.contextLinesInput.value:0}modifyContextLines(e){let o=+this.contextLinesInput.value+(e?1:-1);this.showContextToggle.checked=o!==0,this.contextLinesInput.value=""+o}toggleContextLines(){this.showContextToggle.checked=!this.showContextToggle.checked,this.onContextLinesChanged()}dispose(){this.setReplaceAllActionState(!1),super.dispose()}get searchConfiguration(){return this.configurationService.getValue("search")}};jP=I([m(2,qn),m(3,X),m(4,Le),m(5,Bi),m(6,B),m(7,Ai),m(8,Xe),m(9,F),m(10,ie)],jP);function hMo(){xt.registerCommandAndKeybindingRule({id:VHe.ID,weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.ReplaceActiveKey,yto),primary:2563,handler:a=>{let i=a.get(Gt);if(lMo(i)){let e=vd(i);e&&new VHe(e.searchAndReplaceWidget).run()}}})}var gy=le("replaceService");var BHe=le("searchHistoryService"),_O=class{constructor(i){this.storageService=i;this._onDidClearHistory=new T;this.onDidClearHistory=this._onDidClearHistory.event}static{this.SEARCH_HISTORY_KEY="workbench.search.history"}clearHistory(){this.storageService.remove(_O.SEARCH_HISTORY_KEY,1),this._onDidClearHistory.fire()}load(){let i,e=this.storageService.get(_O.SEARCH_HISTORY_KEY,1);if(e)try{i=JSON.parse(e)}catch{}return i||{}}save(i){dv(i)?this.storageService.remove(_O.SEARCH_HISTORY_KEY,1):this.storageService.store(_O.SEARCH_HISTORY_KEY,JSON.stringify(i),1,0)}};_O=I([m(0,de)],_O);var gMo=`
`,wVi=a=>i=>new G(i.startLineNumber+a,i.startColumn,i.endLineNumber+a,i.endColumn),AIn=(a,i)=>{let e=n=>`${a.range().startLineNumber+n}`,t=a.fullPreviewLines(),o=[];return t.forEach((n,r)=>{let s=e(r),c=`  ${" ".repeat(i-s.length)}${s}: `,u=c.length,p=c+(n.split(/\r?\n?$/,1)[0]||""),h=({start:b,end:S})=>new G(1,(b??1)+u,1,(S??n.length+1)+u),g=a.rangeInPreview(),f=g.startLineNumber===g.endLineNumber,v;f?v=h({start:g.startColumn,end:g.endColumn}):r===0?v=h({start:g.startColumn}):r===t.length-1?v=h({end:g.endColumn}):v=h({}),o.push({lineNumber:s,line:p,ranges:[v]})}),o};function NIn(a,i){let e=a.textMatches().length>0?fMo(a.resource,a.textMatches().sort(TO),a.context,i):void 0,t=xre(a)?a.cellMatches().sort((o,n)=>o.cellIndex-n.cellIndex).sort().filter(o=>o.contentMatches.length>0).map((o,n)=>OIn(o,i,n===0)):[];return[e,...t].filter(o=>!!o)}function fMo(a,i,e,t,o=!0){let n=i[i.length-1].range().endLineNumber.toString().length,r=o?[`${t(a)}:`]:[],s=[],l={},c=[];e.forEach((h,g)=>c.push({line:h,lineNumber:g})),c.sort((h,g)=>h.lineNumber-g.lineNumber);let u,p=new Set;for(i.forEach(h=>{AIn(h,n).forEach(g=>{if(!p.has(g.lineNumber)){for(;c.length&&c[0].lineNumber<+g.lineNumber;){let{line:f,lineNumber:v}=c.shift();u!==void 0&&v!==u+1&&r.push(""),r.push(`  ${" ".repeat(n-`${v}`.length)}${v}  ${f}`),u=v}l[g.lineNumber]=r.length,p.add(g.lineNumber),r.push(g.line),u=+g.lineNumber}s.push(...g.ranges.map(wVi(l[g.lineNumber])))})});c.length;){let{line:h,lineNumber:g}=c.shift();r.push(`  ${g}  ${h}`)}return{text:r,matchRanges:s}}function OIn(a,i,e){return fMo(a.cell?.uri??a.parent.resource,a.contentMatches.sort(TO),a.context,i,e)}var FIn=(a,i,e,t)=>({query:a.contentPattern.pattern,isRegexp:!!a.contentPattern.isRegExp,isCaseSensitive:!!a.contentPattern.isCaseSensitive,matchWholeWord:!!a.contentPattern.isWordMatch,filesToExclude:e,filesToInclude:i,showIncludesExcludes:!!(i||e||a?.userDisabledExcludesAndIgnoreFiles),useExcludeSettingsAndIgnoreFiles:a?.userDisabledExcludesAndIgnoreFiles===void 0?!0:!a.userDisabledExcludesAndIgnoreFiles,contextLines:t,onlyOpenEditors:!!a.onlyOpenEditors,notebookSearchConfig:{includeMarkupInput:!!a.contentPattern.notebookInfo?.isInNotebookMarkdownInput,includeMarkupPreview:!!a.contentPattern.notebookInfo?.isInNotebookMarkdownPreview,includeCodeInput:!!a.contentPattern.notebookInfo?.isInNotebookCellInput,includeOutput:!!a.contentPattern.notebookInfo?.isInNotebookCellOutput}}),vMo=a=>(t=>t.filter(o=>o!==!1&&o!==null&&o!==void 0))([`# Query: ${(t=>t.replace(/\\/g,"\\\\").replace(/\n/g,"\\n"))(a.query??"")}`,(a.isCaseSensitive||a.matchWholeWord||a.isRegexp||a.useExcludeSettingsAndIgnoreFiles===!1)&&`# Flags: ${ui([a.isCaseSensitive&&"CaseSensitive",a.matchWholeWord&&"WordMatch",a.isRegexp&&"RegExp",a.onlyOpenEditors&&"OpenEditors",a.useExcludeSettingsAndIgnoreFiles===!1&&"IgnoreExcludeSettings"]).join(" ")}`,a.filesToInclude?`# Including: ${a.filesToInclude}`:void 0,a.filesToExclude?`# Excluding: ${a.filesToExclude}`:void 0,a.contextLines?`# ContextLines: ${a.contextLines}`:void 0,""]).join(gMo);var CVi=()=>({query:"",filesToInclude:"",filesToExclude:"",isRegexp:!1,isCaseSensitive:!1,useExcludeSettingsAndIgnoreFiles:!0,matchWholeWord:!1,contextLines:0,showIncludesExcludes:!1,onlyOpenEditors:!1,notebookSearchConfig:{includeMarkupInput:!0,includeMarkupPreview:!1,includeCodeInput:!0,includeOutput:!0}}),WIn=a=>{let i=CVi(),e=o=>{let n="";for(let r=0;r<o.length;r++)if(o[r]==="\\"){r++;let s=o[r];if(s==="n")n+=`
`;else if(s==="\\")n+="\\";else throw Error(d(15356,null))}else n+=o[r];return n},t=/^# ([^:]*): (.*)$/;for(let o of a){let n=t.exec(o);if(!n)continue;let[,r,s]=n;switch(r){case"Query":i.query=e(s);break;case"Including":i.filesToInclude=s;break;case"Excluding":i.filesToExclude=s;break;case"ContextLines":i.contextLines=+s;break;case"Flags":i.isRegexp=s.indexOf("RegExp")!==-1,i.isCaseSensitive=s.indexOf("CaseSensitive")!==-1,i.useExcludeSettingsAndIgnoreFiles=s.indexOf("IgnoreExcludeSettings")===-1,i.matchWholeWord=s.indexOf("WordMatch")!==-1,i.onlyOpenEditors=s.indexOf("OpenEditors")!==-1}}return i.showIncludesExcludes=!!(i.filesToInclude||i.filesToExclude||!i.useExcludeSettingsAndIgnoreFiles),i},c3t=(a,i,e,t,o,n,r)=>{if(!a.query)throw Error("Internal Error: Expected query, got null");let s=FIn(a.query,i,e,t),l=a.fileCount()>1?d(15358,null,a.fileCount()):d(15360,null),c=a.count()>1?d(15359,null,a.count()):d(15361,null),u=[a.count()?`${c} - ${l}`:d(15357,null)];r&&u.push(d(15362,null)),u.push("");let p=(g,f)=>TO(g,f,n),h=VIn(a.folderMatches().sort(p).map(g=>g.allDownstreamFileMatches().sort(p).flatMap(f=>NIn(f,o))).flat());return{matchRanges:h.matchRanges.map(wVi(u.length)),text:u.concat(h.text).join(gMo),config:s}},VIn=a=>{let i=[],e=[];return a.forEach(t=>{t.matchRanges.map(wVi(i.length)).forEach(o=>e.push(o)),t.text.forEach(o=>i.push(o)),i.push("")}),{text:i,matchRanges:e}},d3t=async(a,i)=>{let t=(await a.get(Uo).read(i)).value;return xVi(t)},xVi=a=>{let i=[],e=[],t=!0;for(let o of a.split(/\r?\n/g))t?(i.push(o),o===""&&(t=!1)):e.push(o);return{config:WIn(i),text:e.join(`
`)}};var HHe=class{constructor(i){this.config=i;this._onConfigDidUpdate=new T;this.onConfigDidUpdate=this._onConfigDidUpdate.event}updateConfig(i){this.config=i,this._onConfigDidUpdate.fire(i)}},u3t=class{constructor(i){this.resource=i}async resolve(){return Ti(UHe.models.get(this.resource)).resolve()}},kVi=class{constructor(){this.models=new dt}initializeModelFromExistingModel(i,e,t){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let o=i.get(Rt),n=i.get(_t),r=i.get(F),s=i.get(Om),l;this.models.set(e,{resolve:()=>(l||(l=(async()=>{let c=await this.tryFetchModelFromBackupService(e,o,n,s,r);return c||Promise.resolve({resultsModel:n.getModel(e)??n.createModel("",o.createById(U2),e),configurationModel:new HHe(t)})})()),l)})}initializeModelFromRawData(i,e,t,o){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let n=i.get(Rt),r=i.get(_t),s=i.get(F),l=i.get(Om),c;this.models.set(e,{resolve:()=>(c||(c=(async()=>{let u=await this.tryFetchModelFromBackupService(e,n,r,l,s);return u||Promise.resolve({resultsModel:r.createModel(o??"",n.createById(U2),e),configurationModel:new HHe(t)})})()),c)})}initializeModelFromExistingFile(i,e,t){if(this.models.has(e))throw Error("Unable to contruct model for resource that already exists");let o=i.get(Rt),n=i.get(_t),r=i.get(F),s=i.get(Om),l;this.models.set(e,{resolve:async()=>(l||(l=(async()=>{let c=await this.tryFetchModelFromBackupService(e,o,n,s,r);if(c)return c;let{text:u,config:p}=await r.invokeFunction(d3t,t);return{resultsModel:n.createModel(u??"",o.createById(U2),e),configurationModel:new HHe(p)}})()),l)})}async tryFetchModelFromBackupService(i,e,t,o,n){let r=await o.resolve({resource:i,typeId:o3t}),s=t.getModel(i);if(!s&&r){let l=await OX(r.value);s=t.createModel(l,e.createById(U2),i)}if(s){let l=s.getValue(),{text:c,config:u}=xVi(l);return t.destroyModel(i),{resultsModel:t.createModel(c??"",e.createById(U2),i),configurationModel:new HHe(u)}}else return}},UHe=new kVi;var zHe=".code-search",BIn=Oe("search-editor-label-icon",L.search,d(15353,null)),im=class extends Ls{constructor(e,t,o,n,r,s,l,c,u,p){super();this.modelUri=e;this.backingUri=t;this.modelService=o;this.textFileService=n;this.fileDialogService=r;this.instantiationService=s;this.workingCopyService=l;this.telemetryService=c;this.pathService=u;this.dirty=!1;this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this.oldDecorationsIDs=[];if(this.model=s.createInstance(u3t,e),this.modelUri.scheme!==WHe)throw Error("SearchEditorInput must be invoked with a SearchEditorScheme uri");this.memento=new $l(im.ID,p),this._register(p.onWillSaveState(()=>this.memento.saveMemento()));let h=this,g=new class{constructor(){this.typeId=o3t;this.resource=h.modelUri;this.capabilities=h.hasCapability(4)?2:0;this.onDidChangeDirty=h.onDidChangeDirty;this.onDidChangeContent=h.onDidChangeContent;this.onDidSave=h.onDidSave}get name(){return h.getName()}isDirty(){return h.isDirty()}isModified(){return h.isDirty()}backup(f){return h.backup(f)}save(f){return h.save(0,f).then(v=>!!v)}revert(f){return h.revert(0,f)}};this._register(this.workingCopyService.registerWorkingCopy(g))}static{this.ID=yct}get typeId(){return im.ID}get editorId(){return this.typeId}getIcon(){return BIn}get capabilities(){let e=0;return this.backingUri||(e|=4),e}get resource(){return this.backingUri||this.modelUri}async save(e,t){if(!(await this.resolveModels()).resultsModel.isDisposed())return this.backingUri?(await this.textFileService.write(this.backingUri,await this.serializeForDisk(),t),this.setDirty(!1),this._onDidSave.fire({reason:t?.reason,source:t?.source}),this):this.saveAs(e,t)}tryReadConfigSync(){return this._cachedConfigurationModel?.config}async serializeForDisk(){let{configurationModel:e,resultsModel:t}=await this.resolveModels();return vMo(e.config)+`
`+t.getValue()}registerConfigChangeListeners(e){this.configChangeListenerDisposable?.dispose(),this.isDisposed()||(this.configChangeListenerDisposable=e.onConfigDidUpdate(()=>{this.lastLabel!==this.getName()&&(this._onDidChangeLabel.fire(),this.lastLabel=this.getName()),this.memento.getMemento(1,1).searchConfig=e.config}),this._register(this.configChangeListenerDisposable))}async resolveModels(){return this.model.resolve().then(e=>(this._cachedResultsModel=e.resultsModel,this._cachedConfigurationModel=e.configurationModel,this.lastLabel!==this.getName()&&(this._onDidChangeLabel.fire(),this.lastLabel=this.getName()),this.registerConfigChangeListeners(e.configurationModel),e))}async saveAs(e,t){let o=await this.fileDialogService.pickFileToSave(await this.suggestFileName(),t?.availableFileSystems);if(o){this.telemetryService.publicLog2("searchEditor/saveSearchResults");let n=await this.serializeForDisk();if(await this.textFileService.create([{resource:o,value:n,options:{overwrite:!0}}])){if(this.setDirty(!1),!ze(o,this.modelUri)){let r=this.instantiationService.invokeFunction(DO,{fileUri:o,from:"existingFile"});return r.setMatchRanges(this.getMatchRanges()),r}return this}}}getName(e=12){let t=n=>n.length<e?n:`${n.slice(0,e-3)}...`;if(this.backingUri){let n=po.getOriginalUri(this);return d(15355,null,Jo((n??this.backingUri).path,zHe))}let o=this._cachedConfigurationModel?.config?.query?.trim();return o?d(15355,null,t(o)):d(15354,null)}setDirty(e){let t=this.dirty;this.dirty=e,t!==e&&this._onDidChangeDirty.fire()}isDirty(){return this.dirty}async rename(e,t){if(Ts(t)===zHe)return{editor:this.instantiationService.invokeFunction(DO,{from:"existingFile",fileUri:t})}}dispose(){this.modelService.destroyModel(this.modelUri),super.dispose()}matches(e){return super.matches(e)?!0:e instanceof im?!!(e.modelUri.fragment&&e.modelUri.fragment===this.modelUri.fragment)||!!(e.backingUri&&ze(e.backingUri,this.backingUri)):!1}getMatchRanges(){return(this._cachedResultsModel?.getAllDecorations()??[]).filter(e=>e.options.className===vVi).filter(({range:e})=>!(e.startColumn===1&&e.endColumn===1)).map(({range:e})=>e)}async setMatchRanges(e){this.oldDecorationsIDs=(await this.resolveModels()).resultsModel.deltaDecorations(this.oldDecorationsIDs,e.map(t=>({range:t,options:{description:"search-editor-find-match",className:vVi,stickiness:1}})))}async revert(e,t){if(t?.soft){this.setDirty(!1);return}if(this.backingUri){let{config:o,text:n}=await this.instantiationService.invokeFunction(d3t,this.backingUri),{resultsModel:r,configurationModel:s}=await this.resolveModels();r.setValue(n),s.updateConfig(o)}else(await this.resolveModels()).resultsModel.setValue("");super.revert(e,t),this.setDirty(!1)}async backup(e){let t=await this.serializeForDisk();return e.isCancellationRequested?{}:{content:Iwe(Ke.fromString(t))}}async suggestFileName(){let t=((await this.resolveModels()).configurationModel.config.query.replace(/[^\w \-_]+/g,"_")||"Search")+zHe;return Ve(await this.fileDialogService.defaultFilePath(this.pathService.defaultUriScheme),t)}toUntyped(){if(!this.hasCapability(4))return{resource:this.resource,options:{override:im.ID}}}copy(){let e=A.from({scheme:WHe,fragment:`${Math.random()}`}),t=this._cachedConfigurationModel?.config??{},o=this._cachedResultsModel?.getValue()??"";return this.instantiationService.invokeFunction(DO,{from:"rawData",config:t,resultsContents:o,modelUri:e})}};im=I([m(2,_t),m(3,Uo),m(4,nn),m(5,F),m(6,$a),m(7,_e),m(8,Pn),m(9,de)],im);var DO=(a,i)=>{let e=a.get(de),t=a.get(B),o=a.get(F),n;if(i.from==="model"||i.from==="rawData"&&i.modelUri?n=i.modelUri:n=A.from({scheme:WHe,fragment:`${Math.random()}`}),!UHe.models.has(n))if(i.from==="existingFile")o.invokeFunction(r=>UHe.initializeModelFromExistingFile(r,n,i.fileUri));else{let r=t.getValue("search").searchEditor,s=r.reusePriorSearchConfiguration,l=r.defaultNumberOfContextLines,c=s?new $l(im.ID,e).getMemento(1,1).searchConfig??{}:{},p={...CVi(),...c,...i.config};l!=null&&(p.contextLines=i?.config?.contextLines??l),i.from==="rawData"?(i.resultsContents&&(p.contextLines=0),o.invokeFunction(h=>UHe.initializeModelFromRawData(h,n,p,i.resultsContents))):o.invokeFunction(h=>UHe.initializeModelFromExistingModel(h,n,p))}return o.createInstance(im,n,i.from==="existingFile"?i.fileUri:i.from==="model"?i.backupOf:void 0)};var bMo=a=>{let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.toggleCaseSensitive()},SMo=a=>{let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.toggleWholeWords()},IMo=a=>{let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.toggleRegex()},yMo=a=>{let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.toggleContextLines()},EVi=(a,i)=>{let e=a.get(ie);e.activeEditor instanceof im&&e.activeEditorPane.modifyContextLines(i)},wMo=a=>{let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.focusAllResults()};async function CMo(a){let i=a.get(Gt),e=a.get(F),t=vd(i);t?await e.invokeFunction(KHe,{filesToInclude:t.searchIncludePattern.getValue(),onlyOpenEditors:t.searchIncludePattern.onlySearchInOpenEditors(),filesToExclude:t.searchExcludePattern.getValue(),isRegexp:t.searchAndReplaceWidget.searchInput?.getRegex(),isCaseSensitive:t.searchAndReplaceWidget.searchInput?.getCaseSensitive(),matchWholeWord:t.searchAndReplaceWidget.searchInput?.getWholeWords(),useExcludeSettingsAndIgnoreFiles:t.searchExcludePattern.useExcludesAndIgnoreFiles(),showIncludesExcludes:!!(t.searchIncludePattern.getValue()||t.searchExcludePattern.getValue()||!t.searchExcludePattern.useExcludesAndIgnoreFiles())}):await e.invokeFunction(KHe)}var KHe=async(a,i={},e=!1)=>{let t=a.get(ie),o=a.get(kt),n=a.get(_e),r=a.get(F),s=a.get(B),l=a.get(Xp),c=a.get(Ae),p=a.get(fa).getLastActiveWorkspaceRoot(Q.file),h=p?c.getWorkspaceFolder(p)??void 0:void 0,g=t.activeTextEditorControl,f,v="";if(g){Lc(g)?g.getOriginalEditor().hasTextFocus()?f=g.getOriginalEditor():f=g.getModifiedEditor():f=g;let E=f?.getSelection();if(v=(E&&f?.getModel()?.getValueInRange(E))??"",E?.isEmpty()&&s.getValue("search").seedWithNearestWord){let M=f.getModel()?.getWordAtPosition(E.getStartPosition());M&&(v=M.word)}}else t.activeEditor instanceof im&&(v=t.activeEditorPane.getSelected());n.publicLog2("searchEditor/openNewSearchEditor");let S={query:i.location==="new"||s.getValue("editor").find.seedSearchStringFromSelection?v:void 0};for(let E of Object.entries(i)){let M=E[0],N=E[1];N!==void 0&&(S[M]=typeof N=="string"?await l.resolveAsync(h,N):N)}let y=t.getEditors(0).find(E=>E.editor.typeId===im.ID),w;if(y&&S.location==="reuse"){let E=o.getGroup(y.groupId);if(!E)throw new Error("Invalid group id for search editor");let M=y.editor;w=await E.openEditor(M),v?w.setQuery(v):w.selectQuery(),w.setSearchConfig(S)}else{let E=r.invokeFunction(DO,{config:S,resultsContents:"",from:"rawData"});w=await t.openEditor(E,{pinned:!0},e?En:tr)}let x=s.getValue("search").searchOnType;(S.triggerSearch===!0||S.triggerSearch!==!1&&x&&S.query)&&w.triggerSearch({focusResults:S.focusResults}),S.focusResults||w.focusSearchInput()},p3t=async(a,i,e,t,o)=>{if(!i.query){console.error("Expected searchResult.query to be defined. Got",i);return}let n=a.get(ie),r=a.get(_e),s=a.get(F),l=a.get(nt),c=a.get(B),u=c.getValue("search").sortOrder;r.publicLog2("searchEditor/createEditorFromSearchResult");let p=b=>l.getUriLabel(b,{relative:!0}),{text:h,matchRanges:g,config:f}=c3t(i,e,t,0,p,u);f.onlyOpenEditors=o;let v=c.getValue("search").searchEditor.defaultNumberOfContextLines;if(i.isDirty||v===0||v===null){let b=s.invokeFunction(DO,{resultsContents:h,config:f,from:"rawData"});await n.openEditor(b,{pinned:!0}),b.setMatchRanges(g)}else{let b=s.invokeFunction(DO,{from:"rawData",resultsContents:"",config:{...f,contextLines:v}});(await n.openEditor(b,{pinned:!0})).triggerSearch()}};var kre=le("searchViewModelWorkbenchService");function HIn(a,i,e){let t=a[0].range.startLineNumber,o=a[a.length-1].range.endLineNumber,n=[];for(let r=t;r<=o;r++)n.push(i.getLineContent(r));return new AZ(n.join(`
`)+`
`,a.map(r=>new G(r.range.startLineNumber-1,r.range.startColumn-1,r.range.endLineNumber-1,r.range.endColumn-1)),e)}function m3t(a,i,e){let t=-1,o=[],n=[];return a.forEach(r=>{r.range.startLineNumber!==t&&(n=[],o.push(n)),n.push(r),t=r.range.endLineNumber}),o.map(r=>HIn(r,i,e))}function GHe(a,i,e){let t=[],o=-1;for(let n=0;n<a.length;n++){let{start:r,end:s}=xMo(a[n]);if(typeof e.surroundingContext=="number"&&e.surroundingContext>0){let u=Math.max(o+1,r-e.surroundingContext);for(let p=u;p<r;p++)t.push({text:i.getLineContent(p+1),lineNumber:p+1})}t.push(a[n]);let l=a[n+1],c=l?xMo(l).start:Number.MAX_VALUE;if(typeof e.surroundingContext=="number"&&e.surroundingContext>0){let u=Math.min(c-1,s+e.surroundingContext,i.getLineCount()-1);for(let p=s+1;p<=u;p++)t.push({text:i.getLineContent(p+1),lineNumber:p+1})}o=s}return t}function xMo(a){let i=a.rangeLocations.map(o=>o.source),e=i[0].startLineNumber,t=i[i.length-1].endLineNumber;return{start:e,end:t}}function w9(a,i,e){let t=a.previewText.split(`
`);return a.rangeLocations.map(o=>{let n=o.preview;return new Cct(i,t,n,o.source,e)})}var h3t=class h3t{constructor(i,e,t,o,n=!1){this._parent=i;this._fullPreviewLines=e;this._isReadonly=n;this._oneLinePreviewText=e[t.startLineNumber];let r=t.startLineNumber===t.endLineNumber?t.endColumn:this._oneLinePreviewText.length;this._rangeInPreviewText=new iXe(1,t.startColumn+1,r+1),this._range=new G(o.startLineNumber+1,o.startColumn+1,o.endLineNumber+1,o.endColumn+1),this._fullPreviewRange=t,this._id=_lt+this._parent.resource.toString()+">"+this._range+this.getMatchString()}static{this.MAX_PREVIEW_CHARS=250}id(){return this._id}parent(){return this._parent}text(){return this._oneLinePreviewText}range(){return this._range}preview(){let i=this._oneLinePreviewText.substring(0,this._rangeInPreviewText.startColumn-1),e=q3i(i,26,"\u2026"),t=this.getMatchString(),o=this._oneLinePreviewText.substring(this._rangeInPreviewText.endColumn-1),n=h3t.MAX_PREVIEW_CHARS-e.length;return t=t.substr(0,n),n-=t.length,o=o.substr(0,n),{before:e,fullBefore:i,inside:t,after:o}}get replaceString(){let i=this.parent().parent().searchModel;if(!i.replacePattern)throw new Error("searchModel.replacePattern must be set before accessing replaceString");let e=this.fullMatchText(),t=i.replacePattern.getReplaceString(e,i.preserveCase);if(t!==null)return t;let o=e.replace(/\r\n/g,`
`);if(o!==e&&(t=i.replacePattern.getReplaceString(o,i.preserveCase),t!==null))return t;let n=this.fullMatchText(!0);if(t=i.replacePattern.getReplaceString(n,i.preserveCase),t!==null)return t;let r=n.replace(/\r\n/g,`
`);return r!==n&&(t=i.replacePattern.getReplaceString(r,i.preserveCase),t!==null)?t:i.replacePattern.pattern}fullMatchText(i=!1){let e;return i?e=this._fullPreviewLines:(e=this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber,this._fullPreviewRange.endLineNumber+1),e[e.length-1]=e[e.length-1].slice(0,this._fullPreviewRange.endColumn),e[0]=e[0].slice(this._fullPreviewRange.startColumn)),e.join(`
`)}rangeInPreview(){return{...this._fullPreviewRange,startColumn:this._fullPreviewRange.startColumn+1,endColumn:this._fullPreviewRange.endColumn+1}}fullPreviewLines(){return this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber,this._fullPreviewRange.endLineNumber+1)}getMatchString(){return this._oneLinePreviewText.substring(this._rangeInPreviewText.startColumn-1,this._rangeInPreviewText.endColumn-1)}get isReadonly(){return this._isReadonly}};I([bi],h3t.prototype,"preview",1);var Cct=h3t;var NV=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._query=e;this._previewOptions=t;this._maxResults=o;this._parent=n;this.rawMatch=r;this._closestRoot=s;this.modelService=l;this.replaceService=c;this._onChange=this._register(new T);this.onChange=this._onChange.event;this._onDispose=this._register(new T);this.onDispose=this._onDispose.event;this._model=null;this._modelListener=null;this._selectedMatch=null;this._modelDecorations=[];this._context=new Map;this.replaceQ=Promise.resolve();this._resource=this.rawMatch.resource,this._textMatches=new Map,this._removedTextMatches=new Set,this._updateScheduler=this._register(new Dt(this.updateMatchesForModel.bind(this),250)),this._name=new uo(()=>u.getUriBasenameLabel(this.resource))}static{this._CURRENT_FIND_MATCH=So.register({description:"search-current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",overviewRuler:{color:wp(DF),position:2},minimap:{color:wp(sX),position:1}})}static{this._FIND_MATCH=So.register({description:"search-find-match",stickiness:1,className:"findMatch",inlineClassName:"findMatchInline",overviewRuler:{color:wp(DF),position:2},minimap:{color:wp(sX),position:1}})}static getDecorationOption(e){return e?NV._CURRENT_FIND_MATCH:NV._FIND_MATCH}get context(){return new Map(this._context)}get closestRoot(){return this._closestRoot}hasReadonlyMatches(){return this.matches().some(e=>e.isReadonly)}createMatches(){let e=this.modelService.getModel(this._resource);e?(this.bindModel(e),this.updateMatchesForModel()):this.rawMatch.results&&this.rawMatch.results.filter(K0).forEach(t=>{w9(t,this,!1).forEach(o=>this.add(o))})}bindModel(e){this._model=e,this._modelListener=new O,this._modelListener.add(this._model.onDidChangeContent(()=>{this._updateScheduler.schedule()})),this._modelListener.add(this._model.onWillDispose(()=>this.onModelWillDispose())),this.updateHighlights()}onModelWillDispose(){this.updateMatchesForModel(),this.unbindModel()}unbindModel(){this._model&&(this._updateScheduler.cancel(),this._model.changeDecorations(e=>{this._modelDecorations=e.deltaDecorations(this._modelDecorations,[])}),this._model=null,this._modelListener.dispose())}updateMatchesForModel(){if(!this._model)return;this._textMatches=new Map;let e=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,t=this._model.findMatches(this._query.pattern,this._model.getFullModelRange(),!!this._query.isRegExp,!!this._query.isCaseSensitive,e,!1,this._maxResults??M3);this.updateMatches(t,!0,this._model,!1)}async updatesMatchesForLineAfterReplace(e,t){if(!this._model)return;let o={startLineNumber:e,startColumn:this._model.getLineMinColumn(e),endLineNumber:e,endColumn:this._model.getLineMaxColumn(e)};Array.from(this._textMatches.values()).filter(l=>l.range().startLineNumber===e).forEach(l=>this._textMatches.delete(l.id()));let r=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,s=this._model.findMatches(this._query.pattern,o,!!this._query.isRegExp,!!this._query.isCaseSensitive,r,!1,this._maxResults??M3);this.updateMatches(s,t,this._model,!1)}updateMatches(e,t,o,n){let r=m3t(e,o,this._previewOptions);r.forEach(s=>{w9(s,this,n).forEach(l=>{this._removedTextMatches.has(l.id())||(this.add(l),this.isMatchSelected(l)&&(this._selectedMatch=l))})}),this.addContext(GHe(r,o,this.parent().parent().query)),this._onChange.fire({forceUpdateModel:t}),this.updateHighlights()}updateHighlights(){this._model&&this._model.changeDecorations(e=>{let t=this.parent().showHighlights?this.matches().map(o=>({range:o.range(),options:NV.getDecorationOption(this.isMatchSelected(o))})):[];this._modelDecorations=e.deltaDecorations(this._modelDecorations,t)})}id(){return Tlt+this.resource.toString()}parent(){return this._parent}get hasChildren(){return this._textMatches.size>0}matches(){return[...this._textMatches.values()]}textMatches(){return Array.from(this._textMatches.values())}remove(e){Array.isArray(e)||(e=[e]);for(let t of e)this.removeMatch(t),this._removedTextMatches.add(t.id());this._onChange.fire({didRemove:!0})}async replace(e){return this.replaceQ=this.replaceQ.finally(async()=>{await this.replaceService.replace(e),await this.updatesMatchesForLineAfterReplace(e.range().startLineNumber,!1)})}setSelectedMatch(e){e&&(!this._textMatches.has(e.id())||this.isMatchSelected(e))||(this._selectedMatch=e,this.updateHighlights())}getSelectedMatch(){return this._selectedMatch}isMatchSelected(e){return!!this._selectedMatch&&this._selectedMatch.id()===e.id()}count(){return this.matches().length}get resource(){return this._resource}name(){return this._name.value}addContext(e){return e?e.filter((o=>!K0(o))).forEach(o=>this._context.set(o.lineNumber,o.text)):void 0}add(e,t){this._textMatches.set(e.id(),e),t&&this._onChange.fire({forceUpdateModel:!0})}removeMatch(e){this._textMatches.delete(e.id()),this.isMatchSelected(e)?(this.setSelectedMatch(null),this._findMatchDecorationModel?.clearCurrentFindMatchDecoration()):this.updateHighlights()}async resolveFileStat(e){this._fileStat=await e.stat(this.resource).catch(()=>{})}get fileStat(){return this._fileStat}set fileStat(e){this._fileStat=e}dispose(){this.setSelectedMatch(null),this.unbindModel(),this._onDispose.fire(),super.dispose()}hasOnlyReadOnlyMatches(){return this.matches().every(e=>e.isReadonly)}};NV=I([m(6,_t),m(7,gy),m(8,nt)],NV);var Ere=class{constructor(i){this._modelService=i;this._decorationId=null;this._model=null;this._modelDisposables=new O}removeHighlightRange(){if(this._model&&this._decorationId){let i=this._decorationId;this._model.changeDecorations(e=>{e.removeDecoration(i)})}this._decorationId=null}highlightRange(i,e,t=0){let o;A.isUri(i)?o=this._modelService.getModel(i):o=i,o&&this.doHighlightRange(o,e)}doHighlightRange(i,e){this.removeHighlightRange(),i.changeDecorations(t=>{this._decorationId=t.addDecoration(e,Ere._RANGE_HIGHLIGHT_DECORATION)}),this.setModel(i)}setModel(i){this._model!==i&&(this.clearModelListeners(),this._model=i,this._modelDisposables.add(this._model.onDidChangeDecorations(e=>{this.clearModelListeners(),this.removeHighlightRange(),this._model=null})),this._modelDisposables.add(this._model.onWillDispose(()=>{this.clearModelListeners(),this.removeHighlightRange(),this._model=null})))}clearModelListeners(){this._modelDisposables.clear()}dispose(){this._model&&(this.removeHighlightRange(),this._model=null),this._modelDisposables.dispose()}static{this._RANGE_HIGHLIGHT_DECORATION=So.register({description:"search-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}};Ere=I([m(0,_t)],Ere);function g3t(a){return"cellResults"in a}var xct="rawCell#";function kMo(a,i){let e=-1,t=[],o=[];return a.forEach(r=>{r.range.startLineNumber!==e&&o.length>0&&(t.push([...o]),o=[]),o.push(r),e=r.range.endLineNumber}),o.length>0&&t.push([...o]),t.map(r=>{let s=[],l=r[0].range.startLineNumber,c=r[r.length-1].range.endLineNumber;for(let u=l;u<=c;u++)s.push(i.getLineContent(u));return new AZ(s.join(`
`)+`
`,r.map(u=>new G(u.range.startLineNumber-1,u.range.startColumn-1,u.range.endLineNumber-1,u.range.endColumn-1)))})}var f3t=class extends k{constructor(e,t,o){super();this._source=e;this._inputTextBuffer=t;this._outputs=o;this._outputTextBuffers=void 0}_getFullModelRange(e){let t=e.getLineCount();return new G(1,1,t,this._getLineMaxColumn(e,t))}_getLineMaxColumn(e,t){if(t<1||t>e.getLineCount())throw new Error("Illegal value for lineNumber");return e.getLineLength(t)+1}get inputTextBuffer(){if(!this._inputTextBuffer){let e=new Y5;e.acceptChunk(this._source);let t=e.finish(!0),{textBuffer:o,disposable:n}=t.create(1);this._inputTextBuffer=o,this._register(n)}return this._inputTextBuffer}get outputTextBuffers(){return this._outputTextBuffers||(this._outputTextBuffers=this._outputs.map(e=>{let t=new Y5;t.acceptChunk(e);let o=t.finish(!0),{textBuffer:n,disposable:r}=o.create(1);return this._register(r),n})),this._outputTextBuffers}findInInputs(e){let o=new Uw(e,!1,!1,null).parseSearchRequest();if(!o)return[];let n=this._getFullModelRange(this.inputTextBuffer);return this.inputTextBuffer.findMatchesLineByLine(n,o,!0,5e3)}findInOutputs(e){let o=new Uw(e,!1,!1,null).parseSearchRequest();return o?this.outputTextBuffers.map(n=>{let r=n.findMatchesLineByLine(this._getFullModelRange(n),o,!0,5e3);if(r.length!==0)return{textBuffer:n,matches:r}}).filter(n=>!!n):[]}};function EMo(a){return b3t(a)?a.cell.id:`${xct}${a.index}`}function v3t(a){return"cellResults"in a&&a.cellResults instanceof Array&&a.cellResults.every(b3t)}function b3t(a){return"cell"in a}function S3t(a,i){return kMo(a,i.textBuffer)}function I3t(a){return a.map(i=>i.searchPreviewInfo?new AZ(i.searchPreviewInfo.line,new G(0,i.searchPreviewInfo.range.start,0,i.searchPreviewInfo.range.end),void 0,i.index):void 0).filter(i=>!!i)}var Tre=class extends Cct{constructor(e,t,o,n,r){super(e.parent,t,o,n,!1);this._cellParent=e;this._id=_lt+this._parent.resource.toString()+">"+this._cellParent.cellIndex+(r?"_"+r:"")+"_"+this.notebookMatchTypeString()+this._range+this.getMatchString(),this._webviewIndex=r}parent(){return this._cellParent.parent}get cellParent(){return this._cellParent}notebookMatchTypeString(){return this.isWebviewMatch()?"webview":"content"}isWebviewMatch(){return this._webviewIndex!==void 0}get isReadonly(){return super.isReadonly||!this._cellParent.hasCellViewModel()||this.isWebviewMatch()}get cellIndex(){return this._cellParent.cellIndex}get webviewIndex(){return this._webviewIndex}get cell(){return this._cellParent.cell}},y3t=class{constructor(i,e,t){this._parent=i;this._cell=e;this._cellIndex=t;this._contentMatches=new Map,this._webviewMatches=new Map,this._context=new Map}hasCellViewModel(){return!(this._cell instanceof f3t)}get context(){return new Map(this._context)}matches(){return[...this._contentMatches.values(),...this._webviewMatches.values()]}get contentMatches(){return Array.from(this._contentMatches.values())}get webviewMatches(){return Array.from(this._webviewMatches.values())}remove(i){Array.isArray(i)||(i=[i]);for(let e of i)this._contentMatches.delete(e.id()),this._webviewMatches.delete(e.id())}clearAllMatches(){this._contentMatches.clear(),this._webviewMatches.clear()}addContentMatches(i){TMo(i,this).forEach(t=>{this._contentMatches.set(t.id(),t)}),this.addContext(i)}addContext(i){this.cell&&this.cell.resolveTextModel().then(e=>{GHe(i,e,this.parent.parent().query).filter((n=>!K0(n))).map(n=>({...n,lineNumber:n.lineNumber+1})).forEach(n=>{this._context.set(n.lineNumber,n.text)})})}addWebviewMatches(i){TMo(i,this).forEach(t=>{this._webviewMatches.set(t.id(),t)})}setCellModel(i){this._cell=i}get parent(){return this._parent}get id(){return this._cell?.id??`${xct}${this.cellIndex}`}get cellIndex(){return this._cellIndex}get cell(){return this._cell}},_be=class extends NV{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,c,u,p);this.searchInstanceID=l;this.notebookEditorService=h;this._notebookEditorWidget=null;this._editorWidgetListener=null;this._cellMatches=new Map,this._notebookUpdateScheduler=this._register(new Dt(this.updateMatchesForEditorWidget.bind(this),250))}get cellContext(){let e=new Map;return this._cellMatches.forEach(t=>{e.set(t.id,t.context)}),e}getCellMatch(e){return this._cellMatches.get(e)}addCellMatch(e){let t=new y3t(this,b3t(e)?e.cell:void 0,e.index);this._cellMatches.set(t.id,t),this.addWebviewMatchesToCell(t.id,e.webviewResults),this.addContentMatchesToCell(t.id,e.contentResults)}addWebviewMatchesToCell(e,t){let o=this.getCellMatch(e);o!==void 0&&o.addWebviewMatches(t)}addContentMatchesToCell(e,t){let o=this.getCellMatch(e);o!==void 0&&o.addContentMatches(t)}revealCellRange(e,t){!this._notebookEditorWidget||!e.cell||(e.webviewIndex!==void 0?this._notebookEditorWidget.getCellIndex(e.cell)!==void 0&&this._notebookEditorWidget.revealCellOffsetInCenter(e.cell,t??0):(e.cell.updateEditState(e.cell.getEditState(),"focusNotebookCell"),this._notebookEditorWidget.setCellEditorSelection(e.cell,e.range()),this._notebookEditorWidget.revealRangeInCenterIfOutsideViewportAsync(e.cell,e.range())))}bindNotebookEditorWidget(e){this._notebookEditorWidget!==e&&(this._notebookEditorWidget=e,this._editorWidgetListener=this._notebookEditorWidget.textModel?.onDidChangeContent(t=>{t.rawEvents.some(o=>o.kind===10||o.kind===1)&&this._notebookUpdateScheduler.schedule()})??null,this._addNotebookHighlights())}unbindNotebookEditorWidget(e){e&&this._notebookEditorWidget!==e||(this._notebookEditorWidget&&(this._notebookUpdateScheduler.cancel(),this._editorWidgetListener?.dispose()),this._removeNotebookHighlights(),this._notebookEditorWidget=null)}updateNotebookHighlights(){this.parent().showHighlights?(this._addNotebookHighlights(),this.setNotebookFindMatchDecorationsUsingCellMatches(Array.from(this._cellMatches.values()))):this._removeNotebookHighlights()}_addNotebookHighlights(){this._notebookEditorWidget&&(this._findMatchDecorationModel?.stopWebviewFind(),this._findMatchDecorationModel?.dispose(),this._findMatchDecorationModel=new fOe(this._notebookEditorWidget,this.searchInstanceID),this._selectedMatch instanceof Tre&&this.highlightCurrentFindMatchDecoration(this._selectedMatch))}_removeNotebookHighlights(){this._findMatchDecorationModel&&(this._findMatchDecorationModel?.stopWebviewFind(),this._findMatchDecorationModel?.dispose(),this._findMatchDecorationModel=void 0)}updateNotebookMatches(e,t){if(!this._notebookEditorWidget)return;let o=new Map(this._cellMatches);this._notebookEditorWidget.getId()!==this._lastEditorWidgetIdForUpdate&&(this._cellMatches.clear(),this._lastEditorWidgetIdForUpdate=this._notebookEditorWidget.getId()),e.forEach(n=>{let r=this._cellMatches.get(n.cell.id);if(this._notebookEditorWidget&&!r){let l=this._notebookEditorWidget.getCellIndex(n.cell),c=o.get(`${xct}${l}`);c&&(c.setCellModel(n.cell),c.clearAllMatches(),r=c)}r?.clearAllMatches();let s=r??new y3t(this,n.cell,n.index);s.addContentMatches(S3t(n.contentMatches,n.cell)),s.addWebviewMatches(I3t(n.webviewMatches)),this._cellMatches.set(s.id,s)}),this._findMatchDecorationModel?.setAllFindMatchesDecorations(e),this._selectedMatch instanceof Tre&&this.highlightCurrentFindMatchDecoration(this._selectedMatch),this._onChange.fire({forceUpdateModel:t})}setNotebookFindMatchDecorationsUsingCellMatches(e){if(!this._findMatchDecorationModel)return;let t=ui(e.map(o=>{let n=ui(o.webviewMatches.map(s=>{if(s.webviewIndex)return{index:s.webviewIndex}}));if(!o.cell)return;let r=o.contentMatches.map(s=>new Fz(s.range(),[s.text()]));return new HQ(o.cell,o.cellIndex,r,n)}));try{this._findMatchDecorationModel.setAllFindMatchesDecorations(t)}catch{}}async updateMatchesForEditorWidget(){if(!this._notebookEditorWidget)return;this._textMatches=new Map;let e=this._query.isWordMatch&&this._query.wordSeparators?this._query.wordSeparators:null,t=await this._notebookEditorWidget.find(this._query.pattern,{regex:this._query.isRegExp,wholeWord:this._query.isWordMatch,caseSensitive:this._query.isCaseSensitive,wordSeparators:e??void 0,includeMarkupInput:this._query.notebookInfo?.isInNotebookMarkdownInput,includeMarkupPreview:this._query.notebookInfo?.isInNotebookMarkdownPreview,includeCodeInput:this._query.notebookInfo?.isInNotebookCellInput,includeOutput:this._query.notebookInfo?.isInNotebookCellOutput},Ie.None,!1,!0,this.searchInstanceID);this.updateNotebookMatches(t,!0)}async showMatch(e){let t=await this.highlightCurrentFindMatchDecoration(e);this.setSelectedMatch(e),this.revealCellRange(e,t)}async highlightCurrentFindMatchDecoration(e){return!this._findMatchDecorationModel||!e.cell?null:e.webviewIndex===void 0?this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInCell(e.cell,e.range()):this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInWebview(e.cell,e.webviewIndex)}matches(){let e=Array.from(this._cellMatches.values()).flatMap(t=>t.matches());return[...super.matches(),...e]}removeMatch(e){e instanceof Tre?(e.cellParent.remove(e),e.cellParent.matches().length===0&&this._cellMatches.delete(e.cellParent.id),this.isMatchSelected(e)?(this.setSelectedMatch(null),this._findMatchDecorationModel?.clearCurrentFindMatchDecoration()):this.updateHighlights(),this.setNotebookFindMatchDecorationsUsingCellMatches(this.cellMatches())):super.removeMatch(e)}cellMatches(){return Array.from(this._cellMatches.values())}createMatches(){let e=this.modelService.getModel(this._resource);if(e)this.bindModel(e),this.updateMatchesForModel();else{let t=this.notebookEditorService.retrieveExistingWidgetFromURI(this.resource);t?.value&&this.bindNotebookEditorWidget(t.value),this.rawMatch.results&&this.rawMatch.results.filter(K0).forEach(o=>{w9(o,this,!1).forEach(n=>this.add(n))}),(v3t(this.rawMatch)||g3t(this.rawMatch))&&(this.rawMatch.cellResults?.forEach(o=>this.addCellMatch(o)),this.setNotebookFindMatchDecorationsUsingCellMatches(this.cellMatches()),this._onChange.fire({forceUpdateModel:!0})),this.addContext(this.rawMatch.results)}}get hasChildren(){return super.hasChildren||this._cellMatches.size>0}setSelectedMatch(e){if(e){if(!this.isMatchSelected(e)&&_1(e)){this._selectedMatch=e;return}if(!this._textMatches.has(e.id())||this.isMatchSelected(e))return}this._selectedMatch=e,this.updateHighlights()}dispose(){this.unbindNotebookEditorWidget(),super.dispose()}};_be=I([m(7,_t),m(8,gy),m(9,nt),m(10,hd)],_be);function TMo(a,i){let e=[];return a.forEach(t=>{let o=t.previewText.split(`
`);t.rangeLocations.map(n=>{let r=n.preview,s=new Tre(i,o,r,n.source,t.webviewIndex);e.push(s)})}),e}var _re=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._resource=e;this._index=o;this._query=n;this._parent=r;this._searchResult=s;this._closestRoot=l;this.replaceService=c;this.instantiationService=u;this.uriIdentityService=h;this._onChange=this._register(new T);this.onChange=this._onChange.event;this._onDispose=this._register(new T);this.onDispose=this._onDispose.event;this._replacingAll=!1;this._fileMatches=new dt,this._folderMatches=new dt,this._folderMatchesMap=Hp.forUris(g=>this.uriIdentityService.extUri.ignorePathCasing(g)),this._unDisposedFileMatches=new dt,this._unDisposedFolderMatches=new dt,this._name=new uo(()=>this.resource?p.getUriBasenameLabel(this.resource):""),this._id=Elt+t}get searchModel(){return this._searchResult.searchModel}get showHighlights(){return this._parent.showHighlights}get closestRoot(){return this._closestRoot}set replacingAll(e){this._replacingAll=e}id(){return this._id}get resource(){return this._resource}index(){return this._index}name(){return this._name.value}parent(){return this._parent}isAIContributed(){return!1}get hasChildren(){return this._fileMatches.size>0||this._folderMatches.size>0}bindModel(e){let t=this._fileMatches.get(e.uri);t?t.bindModel(e):this.getFolderMatch(e.uri)?.getDownstreamFileMatch(e.uri)?.bindModel(e)}createIntermediateFolderMatch(e,t,o,n,r){let s=this._register(this.instantiationService.createInstance(qHe,e,t,o,n,this,this._searchResult,r));return this.configureIntermediateMatch(s),this.doAddFolder(s),s}configureIntermediateMatch(e){let t=e.onChange(o=>this.onFolderChange(e,o));this._register(e.onDispose(()=>t.dispose()))}clear(e=!1){let t=this.allDownstreamFileMatches();this.disposeMatches(),this._onChange.fire({elements:t,removed:!0,added:!1,clearingAll:e})}remove(e){Array.isArray(e)||(e=[e]);let t=Dlt(e);this.doRemoveFile(t)}async replace(e){return this.replaceService.replace([e]).then(()=>{this.doRemoveFile([e],!0,!0,!0)})}replaceAll(){let e=this.matches();return this.batchReplace(e)}matches(){return[...this.fileMatchesIterator(),...this.folderMatchesIterator()]}fileMatchesIterator(){return this._fileMatches.values()}folderMatchesIterator(){return this._folderMatches.values()}isEmpty(){return this.fileCount()+this.folderCount()===0}getDownstreamFileMatch(e){let t=this._fileMatches.get(e);if(t)return t;let n=this.getFolderMatch(e)?.getDownstreamFileMatch(e);return n||null}allDownstreamFileMatches(){let e=[],t=this.folderMatchesIterator();for(let o of t)e=e.concat(o.allDownstreamFileMatches());return[...this.fileMatchesIterator(),...e]}fileCount(){return this._fileMatches.size}folderCount(){return this._folderMatches.size}count(){return this.fileCount()+this.folderCount()}recursiveFileCount(){return this.allDownstreamFileMatches().length}recursiveMatchCount(){return this.allDownstreamFileMatches().reduce((e,t)=>e+t.count(),0)}get query(){return this._query}doAddFile(e){this._fileMatches.set(e.resource,e),this._unDisposedFileMatches.delete(e.resource)}hasOnlyReadOnlyMatches(){return Array.from(this._fileMatches.values()).every(e=>e.hasOnlyReadOnlyMatches())}uriHasParent(e,t){return this.uriIdentityService.extUri.isEqualOrParent(t,e)&&!this.uriIdentityService.extUri.isEqual(t,e)}isInParentChain(e){let t=this;for(;t instanceof _re;){if(t.id()===e.id())return!0;t=t.parent()}return!1}getFolderMatch(e){return this._folderMatchesMap.findSubstr(e)}doAddFolder(e){if(this.resource&&!this.uriHasParent(this.resource,e.resource))throw Error(`${e.resource} does not belong as a child of ${this.resource}`);if(this.isInParentChain(e))throw Error(`${e.resource} is a parent of ${this.resource}`);this._folderMatches.set(e.resource,e),this._folderMatchesMap.set(e.resource,e),this._unDisposedFolderMatches.delete(e.resource)}async batchReplace(e){let t=Dlt(e);await this.replaceService.replace(t),this.doRemoveFile(t,!0,!0,!0)}onFileChange(e,t=!1){let o=!1;this._fileMatches.has(e.resource)||(this.doAddFile(e),o=!0),e.count()===0&&(this.doRemoveFile([e],!1,!1),o=!1,t=!0),this._replacingAll||this._onChange.fire({elements:[e],added:o,removed:t})}onFolderChange(e,t){this._folderMatches.has(e.resource)||this.doAddFolder(e),e.isEmpty()&&(this._folderMatches.delete(e.resource),e.dispose()),this._onChange.fire(t)}doRemoveFile(e,t=!0,o=!0,n=!1){let r=[];for(let s of e)if(this._fileMatches.get(s.resource)){if(n&&s.hasReadonlyMatches())continue;this._fileMatches.delete(s.resource),t?s.dispose():this._unDisposedFileMatches.set(s.resource,s),r.push(s)}else{let l=this.getFolderMatch(s.resource);if(l)l.doRemoveFile([s],t,o);else throw Error(`FileMatch ${s.resource} is not located within FolderMatch ${this.resource}`)}o&&this._onChange.fire({elements:r,removed:!0})}async bindNotebookEditorWidget(e,t){let o=this._fileMatches.get(t);if(xre(o))if(o)o.bindNotebookEditorWidget(e),await o.updateMatchesForEditorWidget();else{let n=this.folderMatchesIterator();for(let r of n)await r.bindNotebookEditorWidget(e,t)}}addFileMatch(e,t,o){let n=[],r=[];e.forEach(l=>{let c=this.getDownstreamFileMatch(l.resource);if(c)l.results&&l.results.filter(K0).forEach(u=>{w9(u,c,!1).forEach(p=>c.add(p))}),(v3t(l)||g3t(l))&&l.cellResults?.forEach(u=>{if(xre(c)){let p=c.getCellMatch(EMo(u));p?(p.addContentMatches(u.contentResults),p.addWebviewMatches(u.webviewResults)):c.addCellMatch(u)}}),r.push(c),l.results&&l.results.length>0&&c.addContext(l.results);else if(m$(this)||TV(this)){let u=this.createAndConfigureFileMatch(l,o);n.push(u)}});let s=[...n,...r];!t&&s.length&&this._onChange.fire({elements:s,added:!!n.length})}unbindNotebookEditorWidget(e,t){let o=this._fileMatches.get(t);if(xre(o))if(o)o.unbindNotebookEditorWidget(e);else{let n=this.folderMatchesIterator();for(let r of n)r.unbindNotebookEditorWidget(e,t)}}disposeMatches(){[...this._fileMatches.values()].forEach(e=>e.dispose()),[...this._folderMatches.values()].forEach(e=>e.disposeMatches()),[...this._unDisposedFileMatches.values()].forEach(e=>e.dispose()),[...this._unDisposedFolderMatches.values()].forEach(e=>e.disposeMatches()),this._fileMatches.clear(),this._folderMatches.clear(),this._unDisposedFileMatches.clear(),this._unDisposedFolderMatches.clear()}dispose(){this.disposeMatches(),this._onDispose.fire(),super.dispose()}};_re=I([m(7,gy),m(8,F),m(9,nt),m(10,gt)],_re);var qHe=class extends _re{constructor(i,e,t,o,n,r,s,l,c,u,p){super(i,e,t,o,n,r,s,l,c,u,p),this._normalizedResource=new uo(()=>this.uriIdentityService.extUri.removeTrailingPathSeparator(this.uriIdentityService.extUri.normalizePath(this.resource)))}get resource(){return this._resource}get normalizedResource(){return this._normalizedResource.value}};qHe=I([m(7,gy),m(8,F),m(9,nt),m(10,gt)],qHe);var $He=class extends qHe{constructor(i,e,t,o,n,r,s,l,c){super(i,e,t,o,n,n.parent(),null,r,s,l,c)}normalizedUriParent(i){return this.uriIdentityService.extUri.normalizePath(this.uriIdentityService.extUri.dirname(i))}uriEquals(i,e){return this.uriIdentityService.extUri.isEqual(i,e)}createFileMatch(i,e,t,o,n,r,s){let l=this.instantiationService.createInstance(_be,i,e,t,o,n,r,s);l.createMatches(),o.doAddFile(l);let c=l.onChange(({didRemove:u})=>o.onFileChange(l,u));return this._register(l.onDispose(()=>c.dispose())),l}createAndConfigureFileMatch(i,e){if(!this.uriHasParent(this.resource,i.resource))throw Error(`${i.resource} is not a descendant of ${this.resource}`);let t=[],o=this.normalizedUriParent(i.resource);for(;!this.uriEquals(this.normalizedResource,o);){t.unshift(o);let l=o;if(o=this.uriIdentityService.extUri.removeTrailingPathSeparator(this.normalizedUriParent(o)),this.uriEquals(l,o))throw Error(`${i.resource} is not correctly configured as a child of ${this.normalizedResource}`)}let n=this.closestRoot??this,r=this;for(let l=0;l<t.length;l++){let c=r.getFolderMatch(t[l]);c||(c=r.createIntermediateFolderMatch(t[l],t[l].toString(),-1,this._query,n)),r=c}let s=typeof this._query.contentPattern=="string"?{pattern:this._query.contentPattern}:this._query.contentPattern;return this.createFileMatch(s,this._query.previewOptions,this._query.maxResults,r,i,n,e)}};$He=I([m(5,gy),m(6,F),m(7,nt),m(8,gt)],$He);var jHe=class extends _re{constructor(i,e,t,o,n,r,s,l){super(null,i,e,t,o,o.parent(),null,n,r,s,l)}createAndConfigureFileMatch(i,e){let t=typeof this._query.contentPattern=="string"?{pattern:this._query.contentPattern}:this._query.contentPattern,o=this._register(this.instantiationService.createInstance(_be,t,this._query.previewOptions,this._query.maxResults,this,i,null,e));o.createMatches(),this.doAddFile(o);let n=o.onChange(({didRemove:r})=>this.onFileChange(o,r));return this._register(o.onDispose(()=>n.dispose())),o}};jHe=I([m(4,gy),m(5,F),m(6,nt),m(7,gt)],jHe);var Dbe=class extends k{constructor(e,t,o,n){super();this._allowOtherResults=e;this._parent=t;this.instantiationService=o;this.uriIdentityService=n;this._onChange=this._register(new T);this.onChange=this._onChange.event;this._isDirty=!1;this._showHighlights=!1;this._query=null;this.disposePastResults=()=>Promise.resolve();this._folderMatches=[];this._otherFilesMatch=null;this._folderMatchesMap=Hp.forUris(e=>this.uriIdentityService.extUri.ignorePathCasing(e));this.resource=null;this.hidden=!1;this._rangeHighlightDecorations=this.instantiationService.createInstance(Ere),this._register(this.onChange(r=>{r.removed&&(this._isDirty=!this.isEmpty())}))}hide(){this.hidden=!0,this.clear()}parent(){return this._parent}get hasChildren(){return this._folderMatches.length>0}get isDirty(){return this._isDirty}getFolderMatch(e){let t=this._folderMatchesMap.findSubstr(e);return!t&&this._allowOtherResults&&this._otherFilesMatch?this._otherFilesMatch:t}add(e,t,o=!1){let{byFolder:n,other:r}=this.groupFilesByFolder(e);n.forEach(s=>{if(!s.length)return;this.getFolderMatch(s[0].resource)?.addFileMatch(s,o,t)}),this.isAIContributed||this._otherFilesMatch?.addFileMatch(r,o,t),this.disposePastResults()}remove(e,t=!1){Array.isArray(e)||(e=[e]),e.forEach(s=>{ru(s)&&s.clear()});let o=e.filter(s=>Bl(s)),{byFolder:n,other:r}=this.groupFilesByFolder(o);n.forEach(s=>{s.length&&this.getFolderMatch(s[0].resource)?.remove(s)}),r.length&&this.getFolderMatch(r[0].resource)?.remove(r)}groupFilesByFolder(e){let t=new dt,o=[];return this._folderMatches.forEach(n=>t.set(n.resource,[])),e.forEach(n=>{let r=this.getFolderMatch(n.resource);if(!r)return;let s=r.resource;s?t.get(s).push(n):o.push(n)}),{byFolder:t,other:o}}isEmpty(){return this.folderMatches().every(e=>e.isEmpty())}findFolderSubstr(e){return this._folderMatchesMap.findSubstr(e)}clearQuery(){let e=this.folderMatches();this.disposePastResults=async()=>{e.forEach(t=>t.clear()),e.forEach(t=>t.dispose()),this._isDirty=!1},this.cachedSearchComplete=void 0,this._rangeHighlightDecorations.removeHighlightRange(),this._folderMatchesMap=Hp.forUris(t=>this.uriIdentityService.extUri.ignorePathCasing(t))}folderMatches(){return this._otherFilesMatch&&this._allowOtherResults?[...this._folderMatches,this._otherFilesMatch]:this._folderMatches}disposeMatches(){this.folderMatches().forEach(e=>e.dispose()),this._folderMatches=[],this._folderMatchesMap=Hp.forUris(e=>this.uriIdentityService.extUri.ignorePathCasing(e)),this._rangeHighlightDecorations.removeHighlightRange()}matches(){let e=[];return this.folderMatches().forEach(t=>{e.push(t.allDownstreamFileMatches())}),[].concat(...e)}get showHighlights(){return this._showHighlights}toggleHighlights(e){if(this._showHighlights===e)return;this._showHighlights=e;let t=null;this.matches().forEach(o=>{o.updateHighlights(),xre(o)&&o.updateNotebookHighlights(),t||(t=o.getSelectedMatch())}),this._showHighlights&&t?this._rangeHighlightDecorations.highlightRange(t.parent().resource,t.range()):this._rangeHighlightDecorations.removeHighlightRange()}get rangeHighlightDecorations(){return this._rangeHighlightDecorations}fileCount(){return this.folderMatches().reduce((e,t)=>e+t.recursiveFileCount(),0)}count(){return this.matches().reduce((e,t)=>e+t.count(),0)}clear(e=!0){this.cachedSearchComplete=void 0,this.folderMatches().forEach(t=>t.clear(e)),this.disposeMatches(),this._folderMatches=[],this._otherFilesMatch=null}async dispose(){this._rangeHighlightDecorations.dispose(),this.disposeMatches(),super.dispose(),await this.disposePastResults()}};Dbe=I([m(2,F),m(3,gt)],Dbe);var QHe=class extends Dbe{constructor(e,t,o,n){super(!0,e,t,o);this.replaceService=n}id(){return TBe+A_o}get isAIContributed(){return!1}replace(e){return this.getFolderMatch(e.resource)?.replace(e)??Promise.resolve()}name(){return"Text"}replaceAll(e){return this.replacingAll=!0,this.replaceService.replace(this.matches(),e).then(()=>{this.replacingAll=!1,this.clear()},()=>{this.replacingAll=!1})}set replacingAll(e){this.folderMatches().forEach(t=>{t.replacingAll=e})}get query(){return this._query}set query(e){this.clearQuery(),e&&(this._folderMatches=(e&&e.folderQueries||[]).map(t=>t.folder).map((t,o)=>this._createBaseFolderMatch(t,t.toString(),o,e)),this._folderMatches.forEach(t=>this._folderMatchesMap.set(t.resource,t)),this._otherFilesMatch=this._createBaseFolderMatch(null,"otherFiles",this._folderMatches.length+1,e),this._query=e)}_createBaseFolderMatch(e,t,o,n){let r;e?r=this._register(this.createWorkspaceRootWithResourceImpl(e,t,o,n)):r=this._register(this.createNoRootWorkspaceImpl(t,o,n));let s=r.onChange(l=>this._onChange.fire(l));return this._register(r.onDispose(()=>s.dispose())),r}createWorkspaceRootWithResourceImpl(e,t,o,n){return this.instantiationService.createInstance($He,e,t,o,n,this)}createNoRootWorkspaceImpl(e,t,o){return this._register(this.instantiationService.createInstance(jHe,e,t,o,this))}};QHe=I([m(1,F),m(2,gt),m(3,gy)],QHe);var C9=class extends Dbe{constructor(i,e,t){super(!1,i,e,t),this.hidden=!0}name(){return"AI"}id(){return TBe+N_o}get isAIContributed(){return!0}get query(){return this._query}set query(i){this.clearQuery(),i&&(this._folderMatches=(i&&i.folderQueries||[]).map(e=>e.folder).map((e,t)=>this._createBaseFolderMatch(e,e.toString(),t,i)),this._folderMatches.forEach(e=>this._folderMatchesMap.set(e.resource,e)),this._query=i)}fileCount(){let i=new xn;for(let e of this.folderMatches())if(!e.isEmpty())for(let t of e.allDownstreamFileMatches())i.add(t.resource);return i.size}_createBaseFolderMatch(i,e,t,o){let n=this._register(this.createWorkspaceRootWithResourceImpl(i,e,t,o)),r=n.onChange(s=>this._onChange.fire(s));return this._register(n.onDispose(()=>r.dispose())),n}createWorkspaceRootWithResourceImpl(i,e,t,o){return this.instantiationService.createInstance(Rbe,i,e,t,o,this)}};C9=I([m(1,F),m(2,gt)],C9);var Rbe=class extends k{constructor(e,t,o,n,r,s,l){super();this._resource=e;this._index=o;this._query=n;this._parent=r;this.instantiationService=s;this._onChange=this._register(new T);this.onChange=this._onChange.event;this._onDispose=this._register(new T);this.onDispose=this._onDispose.event;this.latestRank=0;this.replacingAll=!1;this._fileMatches=new Map,this._id=Elt+t,this._name=new uo(()=>this.resource?l.getUriBasenameLabel(this.resource):""),this._unDisposedFileMatches=new Map}get resource(){return this._resource}id(){return this._id}index(){return this._index}name(){return this._name.value}count(){return this._fileMatches.size}doAddFile(e){this._fileMatches.set(e.id(),e)}createAndConfigureFileMatch(e,t){let o=this.instantiationService.createInstance(kct,this._query.contentPattern,this._query.previewOptions,this._query.maxResults,this,e,this,e.resource.toString()+"_"+Date.now().toString(),this.latestRank++);o.createMatches(),this.doAddFile(o);let n=o.onChange(({didRemove:r})=>this.onFileChange(o,r));return this._register(o.onDispose(()=>n.dispose())),o}isAIContributed(){return!0}onFileChange(e,t=!1){let o=!1;this._fileMatches.has(e.id())||(this.doAddFile(e),o=!0),e.count()===0&&(this.doRemoveFile([e],!1,!1),o=!1,t=!0),this._onChange.fire({elements:[e],added:o,removed:t})}get hasChildren(){return this._fileMatches.size>0}parent(){return this._parent}matches(){return[...this._fileMatches.values()]}allDownstreamFileMatches(){return[...this._fileMatches.values()]}remove(e){Array.isArray(e)||(e=[e]);let t=Dlt(e);this.doRemoveFile(t)}addFileMatch(e,t,o){let n=[],r=[];e.forEach(l=>{let c=this.createAndConfigureFileMatch(l,o);n.push(c)});let s=[...n,...r];!t&&s.length&&this._onChange.fire({elements:s,added:!!n.length})}isEmpty(){return this.recursiveFileCount()===0}clear(e){let t=this.allDownstreamFileMatches();t.length>0&&(this.disposeMatches(),this._onChange.fire({elements:t,removed:!0,added:!1,clearingAll:e}))}get showHighlights(){return this._parent.showHighlights}get searchModel(){return this._searchResult.searchModel}get _searchResult(){return this._parent.parent()}get query(){return this._query}getDownstreamFileMatch(e){for(let t of this._fileMatches.values())if(t.resource.toString()===e.toString())return t;return null}replaceAll(){throw new Error("Cannot replace in AI search")}recursiveFileCount(){return this._fileMatches.size}doRemoveFile(e,t=!0,o=!0,n=!1){let r=[];for(let s of e)if(this._fileMatches.get(s.id())){if(n&&s.hasReadonlyMatches())continue;this._fileMatches.delete(s.id()),t?s.dispose():this._unDisposedFileMatches.set(s.id(),s),r.push(s)}o&&this._onChange.fire({elements:r,removed:!0})}replace(e){throw new Error("Cannot replace in AI search")}bindModel(e){}unbindNotebookEditorWidget(e,t){}bindNotebookEditorWidget(e,t){return Promise.resolve()}hasOnlyReadOnlyMatches(){return Array.from(this._fileMatches.values()).every(e=>e.hasOnlyReadOnlyMatches())}fileMatchesIterator(){return this._fileMatches.values()}folderMatchesIterator(){return[].values()}recursiveMatchCount(){return this._fileMatches.size}disposeMatches(){[...this._fileMatches.values()].forEach(e=>e.dispose()),[...this._unDisposedFileMatches.values()].forEach(e=>e.dispose()),this._fileMatches.clear()}dispose(){this.disposeMatches(),this._onDispose.fire(),super.dispose()}};Rbe=I([m(5,F),m(6,nt)],Rbe);var kct=class extends NV{constructor(e,t,o,n,r,s,l,c,u,p,h){super({pattern:e},t,o,n,r,s,u,p,h);this._id=l;this.rank=c}id(){return Tlt+this._id}getFullRange(){let e,t;for(let o of this.matches()){let n=o.range().getStartPosition(),r=o.range().getEndPosition();(e===void 0||n.isBefore(e))&&(e=n),t===void 0?t=r:r.isBefore(t)||(t=r)}if(!(e===void 0||t===void 0))return new G(e.lineNumber,e.column,t.lineNumber,t.column)}rangeAsString(){let e=this.getFullRange();if(e)return e.startLineNumber+":"+e.startColumn+"-"+e.endLineNumber+":"+e.endColumn}name(){let e=this.rangeAsString();return super.name()+e?" "+e:""}createMatches(){this.rawMatch.results&&this.rawMatch.results.filter(K0).forEach(e=>{w9(e,this,!0).forEach(t=>this.add(t))})}};kct=I([m(8,_t),m(9,gy),m(10,nt)],kct);W(class extends z{constructor(){super({id:"search.action.clearHistory",title:P(15189,"Clear Search History"),category:Hl,f1:!0})}async run(i){zIn(i)}});W(class extends z{constructor(){super({id:"search.action.cancel",title:P(15188,"Cancel Search"),icon:nMo,category:Hl,f1:!0,precondition:IRe.isEqualTo(0).negate(),keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Nc),primary:9},menu:[{id:R.ViewTitle,group:"navigation",order:0,when:C.and(C.equals("view",ow),IRe.isEqualTo(2))}]})}run(i){return qIn(i)}});W(class extends z{constructor(){super({id:"search.action.refreshSearchResults",title:P(15193,"Refresh"),icon:t3t,precondition:Ri.ViewHasSearchPatternKey,category:Hl,f1:!0,menu:[{id:R.ViewTitle,group:"navigation",order:0,when:C.and(C.equals("view",ow),IRe.isEqualTo(2).negate())}]})}run(i,...e){return $In(i)}});W(class extends z{constructor(){super({id:"search.action.collapseSearchResults",title:P(15191,"Collapse All"),category:Hl,icon:ZLo,f1:!0,precondition:C.and(Ri.HasSearchResults,Ri.ViewHasSomeCollapsibleKey),menu:[{id:R.ViewTitle,group:"navigation",order:4,when:C.and(C.equals("view",ow),C.or(Ri.HasSearchResults.negate(),Ri.ViewHasSomeCollapsibleKey))}]})}run(i,...e){return jIn(i)}});W(class extends z{constructor(){super({id:"search.action.expandSearchResults",title:P(15192,"Expand All"),category:Hl,icon:eMo,f1:!0,precondition:C.and(Ri.HasSearchResults,Ri.ViewHasSomeCollapsibleKey.toNegated()),menu:[{id:R.ViewTitle,group:"navigation",order:4,when:C.and(C.equals("view",ow),Ri.HasSearchResults,Ri.ViewHasSomeCollapsibleKey.toNegated())}]})}async run(i,...e){return KIn(i)}});W(class extends z{constructor(){super({id:"search.action.clearSearchResults",title:P(15190,"Clear Search Results"),category:Hl,icon:oMo,f1:!0,precondition:C.or(Ri.HasSearchResults,Ri.ViewHasSearchPatternKey,Ri.ViewHasReplacePatternKey,Ri.ViewHasFilePatternKey),menu:[{id:R.ViewTitle,group:"navigation",order:1,when:C.equals("view",ow)}]})}run(i,...e){return GIn(i)}});W(class extends z{constructor(){super({id:"search.action.viewAsTree",title:P(15196,"View as Tree"),category:Hl,icon:iMo,f1:!0,precondition:C.and(Ri.HasSearchResults,Ri.InTreeViewKey.toNegated()),menu:[{id:R.ViewTitle,group:"navigation",order:2,when:C.and(C.equals("view",ow),Ri.InTreeViewKey.toNegated())}]})}async run(i,...e){let t=vd(i.get(Gt));t&&await t.setTreeView(!0)}});W(class extends z{constructor(){super({id:"search.action.viewAsList",title:P(15195,"View as List"),category:Hl,icon:tMo,f1:!0,precondition:C.and(Ri.HasSearchResults,Ri.InTreeViewKey),menu:[{id:R.ViewTitle,group:"navigation",order:2,when:C.and(C.equals("view",ow),Ri.InTreeViewKey)}]})}async run(i,...e){let t=vd(i.get(Gt));t&&await t.setTreeView(!1)}});W(class extends z{constructor(){super({id:"search.action.searchWithAI",title:P(15194,"Search with AI"),category:Hl,f1:!0,precondition:Ri.hasAIResultProvider,keybinding:{weight:200,when:C.and(Ri.hasAIResultProvider,Ri.SearchViewFocusedKey),primary:2087}})}async run(i,...e){let t=vd(i.get(Gt));t&&t.requestAIResults()}});var zIn=a=>{a.get(BHe).clearHistory()};async function KIn(a){let i=a.get(Gt),e=vd(i);if(e){let t=e.getControl();await YHe(t,void 0)}}async function YHe(a,i){if(i){if(!a.hasNode(i))return;await a.expand(i,!0)}let e=a.getNode(i)?.children;if(e)for(let t of e){if(SO(t.element))throw Error("SearchResult should not be a child of a RenderableMatch");YHe(a,t.element)}}function GIn(a){let i=a.get(Gt);vd(i)?.clearSearchResults()}function qIn(a){let i=a.get(Gt);vd(i)?.cancelSearch()}function $In(a){let i=a.get(Gt),e=vd(i);e?.triggerQueryChange({preserveFocus:!1,shouldUpdateAISearch:!e.model.searchResult.aiTextSearchResult.hidden})}function jIn(a){let i=a.get(Gt),e=vd(i);if(e){let t=e.getControl(),o=t.navigate(),n=o.first(),r=!1,s=!1;do n=o.next();while(Pv(n));if(m$(n)||e.isTreeLayoutViewVisible){for(;n=o.next();)if(!Pv(n)){if(pl(n)){r=!0;break}if(e.isTreeLayoutViewVisible&&!s){let c=n;if(ru(n)){let p=t.getCompressedTreeNode(n)?.elements[0].element;c=p&&!pl(p)&&!Pv(p)&&!SO(p)?p:n}let u=c.parent();Pv(u)||m$(u)||TV(u)||SO(u)||(s=!0)}}}if(r){n=o.first();do Bl(n)&&t.collapse(n);while(n=o.next())}else if(s){if(n=o.first(),n)do{let c=n;if(ru(n)){let p=t.getCompressedTreeNode(n)?.elements[0].element;c=p&&!pl(p)&&!SO(p)?p:n}let u=c.parent();(m$(u)||TV(u))&&(t.hasNode(n)?t.collapse(n,!0):t.collapseAll())}while(n=o.next())}else if(Pv(o.first())){n=o.first();do{if(!n)break;Pv(t.getParentElement(n))&&t.collapse(n)}while(n=o.next())}else t.collapseAll();let l=t.getFocus()[0]?.parent();l&&(ru(l)||Bl(l))&&t.hasNode(l)&&t.isCollapsed(l)&&(t.domFocus(),t.focusFirst(),t.setSelection(t.getFocus()))}}var oL=_;var _Mo=d(15291,null),DMo=75,M$=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce){super(e,V,M,g,b,h,p,K,x,j);this.fileService=t;this.editorService=o;this.codeEditorService=n;this.progressService=r;this.notificationService=s;this.dialogService=l;this.commandService=c;this.contextViewService=u;this.contextService=f;this.searchViewModelWorkbenchService=v;this.replaceService=S;this.textFileService=y;this.preferencesService=w;this.searchHistoryService=E;this.accessibilityService=N;this.storageService=H;this.notebookService=J;this.logService=se;this.accessibilitySignalService=ae;this.telemetryService=ce;this.isDisposed=!1;this.lastFocusState="input";this.messageDisposables=new O;this.currentEditorCursorListener=this._register(new ue);this.currentSearchQ=Promise.resolve();this.pauseSearching=!1;this._visibleMatches=0;this._cachedKeywords=[];this.container=_(".search-view"),this.viewletVisible=Ri.SearchViewVisibleKey.bindTo(this.contextKeyService),this.firstMatchFocused=Ri.FirstMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrMatchFocused=Ri.FileMatchOrMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrFolderMatchFocus=Ri.FileMatchOrFolderMatchFocusKey.bindTo(this.contextKeyService),this.fileMatchOrFolderMatchWithResourceFocus=Ri.FileMatchOrFolderMatchWithResourceFocusKey.bindTo(this.contextKeyService),this.fileMatchFocused=Ri.FileFocusKey.bindTo(this.contextKeyService),this.folderMatchFocused=Ri.FolderFocusKey.bindTo(this.contextKeyService),this.folderMatchWithResourceFocused=Ri.ResourceFolderFocusKey.bindTo(this.contextKeyService),this.searchResultHeaderFocused=Ri.SearchResultHeaderFocused.bindTo(this.contextKeyService),this.hasSearchResultsKey=Ri.HasSearchResults.bindTo(this.contextKeyService),this.matchFocused=Ri.MatchFocusKey.bindTo(this.contextKeyService),this.searchStateKey=IRe.bindTo(this.contextKeyService),this.hasSearchPatternKey=Ri.ViewHasSearchPatternKey.bindTo(this.contextKeyService),this.hasReplacePatternKey=Ri.ViewHasReplacePatternKey.bindTo(this.contextKeyService),this.hasFilePatternKey=Ri.ViewHasFilePatternKey.bindTo(this.contextKeyService),this.hasSomeCollapsibleResultKey=Ri.ViewHasSomeCollapsibleKey.bindTo(this.contextKeyService),this.treeViewKey=Ri.InTreeViewKey.bindTo(this.contextKeyService),this.refreshTreeController=this._register(this.instantiationService.createInstance(Tct,this,()=>this.searchConfig)),this._register(this.contextKeyService.onDidChangeContext(Se=>{let Re=Ri.hasAIResultProvider.keys();Se.affectsSome(new Set(Re))&&this.refreshHasAISetting()})),this.contextKeyService=this._register(this.contextKeyService.createScoped(this.container)),Ri.SearchViewFocusedKey.bindTo(this.contextKeyService).set(!0),this.inputBoxFocused=Ri.InputBoxFocusedKey.bindTo(this.contextKeyService),this.inputPatternIncludesFocused=Ri.PatternIncludesFocusedKey.bindTo(this.contextKeyService),this.inputPatternExclusionsFocused=Ri.PatternExcludesFocusedKey.bindTo(this.contextKeyService),this.isEditableItem=Ri.IsEditableItemKey.bindTo(this.contextKeyService),this.instantiationService=this._register(this.instantiationService.createChild(new Po([X,this.contextKeyService]))),this._register(this.configurationService.onDidChangeConfiguration(async Se=>{Se.affectsConfiguration("search.sortOrder")&&(this.searchConfig.sortOrder==="modified"&&this.removeFileStats(),await this.refreshTreeController.queue())})),this.viewModel=this.searchViewModelWorkbenchService.searchModel,this.queryBuilder=this.instantiationService.createInstance(JS),this.memento=new $l(this.id,H),this.viewletState=this.memento.getMemento(1,1),this._register(this.fileService.onDidFilesChange(Se=>this.onFilesChanged(Se))),this._register(this.textFileService.untitled.onWillDispose(Se=>this.onUntitledDidDispose(Se.resource))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onDidChangeWorkbenchState())),this._register(this.searchHistoryService.onDidClearHistory(()=>this.clearHistory())),this._register(this.configurationService.onDidChangeConfiguration(Se=>this.onConfigurationUpdated(Se))),this.delayedRefresh=this._register(new rn(250)),this.addToSearchHistoryDelayer=this._register(new rn(2e3)),this.toggleCollapseStateDelayer=this._register(new rn(100)),this.triggerQueryDelayer=this._register(new rn(0)),this.treeAccessibilityProvider=this.instantiationService.createInstance(FHe,this),this.isTreeLayoutViewVisible=this.viewletState.view?.treeLayout??this.searchConfig.defaultViewMode==="tree",this._refreshResultsScheduler=this._register(new Dt(this._updateResults.bind(this),80)),this._register(this.storageService.onWillSaveState(()=>{this._saveSearchHistoryService()})),this._register(this.storageService.onDidChangeValue(1,_O.SEARCH_HISTORY_KEY,this._store)(()=>{let Se=this.searchHistoryService.load();Se.include&&this.inputPatternIncludes.prependHistory(Se.include),Se.exclude&&this.inputPatternExcludes.prependHistory(Se.exclude),Se.search&&this.searchWidget.prependSearchHistory(Se.search),Se.replace&&this.searchWidget.prependReplaceHistory(Se.replace)})),this.changedWhileHidden=this.hasSearchResults()}static{this.ACTIONS_RIGHT_CLASS_NAME="actions-right"}get cachedResults(){return this._cachedResults}async queueRefreshTree(){return this.refreshTreeController.queue()}get isTreeLayoutViewVisible(){return this.treeViewKey.get()??!1}set isTreeLayoutViewVisible(e){this.treeViewKey.set(e)}async setTreeView(e){if(e!==this.isTreeLayoutViewVisible)return this.isTreeLayoutViewVisible=e,this.updateIndentStyles(this.themeService.getFileIconTheme()),this.refreshTreeController.queue()}get state(){return this.searchStateKey.get()??0}set state(e){this.searchStateKey.set(e)}getContainer(){return this.container}get searchResult(){return this.viewModel&&this.viewModel.searchResult}get model(){return this.viewModel}async refreshHasAISetting(){let e=this.shouldShowAIResults();if(!(!this.tree||!this.tree.hasNode(this.searchResult))){if(e&&!this.tree.hasNode(this.searchResult.aiTextSearchResult)){if(this.model.searchResult.getCachedSearchComplete(!1))return this.refreshAndUpdateCount()}else if(!e&&this.tree.hasNode(this.searchResult.aiTextSearchResult))return this.refreshAndUpdateCount()}}onDidChangeWorkbenchState(){this.contextService.getWorkbenchState()!==1&&this.searchWithoutFolderMessageElement&&Wi(this.searchWithoutFolderMessageElement)}refreshInputs(){this.pauseSearching=!0,this.searchWidget.setValue(this.viewModel.searchResult.query?.contentPattern.pattern??""),this.searchWidget.setReplaceAllActionState(!1),this.searchWidget.toggleReplace(!0),this.inputPatternIncludes.setOnlySearchInOpenEditors(this.viewModel.searchResult.query?.onlyOpenEditors||!1),this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(!this.viewModel.searchResult.query?.userDisabledExcludesAndIgnoreFiles||!0),this.searchIncludePattern.setValue(""),this.searchExcludePattern.setValue(""),this.pauseSearching=!1}async replaceSearchModel(e,t){let o;this.progressService.withProgress({location:this.getProgressLocation(),delay:0},r=>new Promise(s=>o=s));let n=setTimeout(()=>{this.state=2},2e3);this._refreshResultsScheduler.schedule(),e.location=0,e.replaceActive=this.viewModel.isReplaceActive(),e.replaceString=this.searchWidget.getReplaceValue(),this._onSearchResultChangedDisposable?.dispose(),this._onSearchResultChangedDisposable=this._register(e.onSearchResultChanged(async r=>this.onSearchResultsChanged(r))),this.searchViewModelWorkbenchService.searchModel=e,this.viewModel=e,this.tree.setInput(this.viewModel.searchResult),await this.onSearchResultsChanged(),this.refreshInputs(),t.then(r=>(clearTimeout(n),this.onSearchComplete(o,void 0,void 0,r)),r=>(clearTimeout(n),this.onSearchError(r,o,void 0,void 0))),await this.expandIfSingularResult()}renderBody(e){super.renderBody(e),this.container=D(e,_(".search-view")),this.searchWidgetsContainerElement=D(this.container,oL(".search-widgets-container")),this.createSearchWidget(this.searchWidgetsContainerElement);let t=this.searchHistoryService.load(),o=this.viewletState.query?.filePatterns||"",n=this.viewletState.query?.folderExclusions||"",r=t.exclude||[],s=this.viewletState.query?.folderIncludes||"",l=t.include||[],c=this.viewletState.query?.onlyOpenEditors||!1,u=this.viewletState.query?.queryDetailsExpanded||"",p=typeof this.viewletState.query?.useExcludesAndIgnoreFiles=="boolean"?this.viewletState.query.useExcludesAndIgnoreFiles:!0;this.queryDetails=D(this.searchWidgetsContainerElement,oL(".query-details"));let h=d(15250,null);this.toggleQueryDetailsButton=D(this.queryDetails,oL(".more"+q.asCSSSelector(Tbe),{tabindex:0,role:"button","aria-label":h})),this._register(this.hoverService.setupManagedHover(yi("element"),this.toggleQueryDetailsButton,h)),this._register($(this.toggleQueryDetailsButton,ne.CLICK,w=>{Kt.stop(w),this.toggleQueryDetails(!this.accessibilityService.isScreenReaderOptimized())})),this._register($(this.toggleQueryDetailsButton,ne.KEY_UP,w=>{let x=new mi(w);(x.equals(3)||x.equals(10))&&(Kt.stop(w),this.toggleQueryDetails(!1))})),this._register($(this.toggleQueryDetailsButton,ne.KEY_DOWN,w=>{new mi(w).equals(1026)&&(this.searchWidget.isReplaceActive()?this.searchWidget.focusReplaceAllAction():this.searchWidget.isReplaceShown()?this.searchWidget.replaceInput?.focusOnPreserve():this.searchWidget.focusRegexAction(),Kt.stop(w))}));let g=D(this.queryDetails,oL(".file-types.includes")),f=d(15295,null);D(g,oL("h4",void 0,f)),this.inputPatternIncludes=this._register(this.instantiationService.createInstance(yre,g,this.contextViewService,{ariaLabel:f,placeholder:d(15266,null),showPlaceholderOnFocus:!0,history:l,inputBoxStyles:Wl})),this.inputPatternIncludes.setValue(s),this.inputPatternIncludes.setOnlySearchInOpenEditors(c),this._register(this.inputPatternIncludes.onCancel(()=>this.cancelSearch(!1))),this._register(this.inputPatternIncludes.onChangeSearchInEditorsBox(()=>this.triggerQueryChange())),this.trackInputBox(this.inputPatternIncludes.inputFocusTracker,this.inputPatternIncludesFocused);let v=D(this.queryDetails,oL(".file-types.excludes")),b=d(15294,null);D(v,oL("h4",void 0,b)),this.inputPatternExcludes=this._register(this.instantiationService.createInstance(wre,v,this.contextViewService,{ariaLabel:b,placeholder:d(15265,null),showPlaceholderOnFocus:!0,history:r,inputBoxStyles:Wl})),this.inputPatternExcludes.setValue(n),this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(p),this._register(this.inputPatternExcludes.onCancel(()=>this.cancelSearch(!1))),this._register(this.inputPatternExcludes.onChangeIgnoreBox(()=>this.triggerQueryChange())),this.trackInputBox(this.inputPatternExcludes.inputFocusTracker,this.inputPatternExclusionsFocused);let S=()=>this.hasFilePatternKey.set(this.inputPatternIncludes.getValue().length>0||this.inputPatternExcludes.getValue().length>0);S();let y=w=>{this.triggerQueryChange({triggeredOnType:w,delay:this.searchConfig.searchOnTypeDebouncePeriod}),w&&S()};this._register(this.inputPatternIncludes.onSubmit(y)),this._register(this.inputPatternExcludes.onSubmit(y)),this.messagesElement=D(this.container,oL(".messages.text-search-provider-messages")),this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),this.createSearchResultsView(this.container),(o!==""||n!==""||s!==""||u!==""||!p)&&this.toggleQueryDetails(!0,!0,!0),this._onSearchResultChangedDisposable=this._register(this.viewModel.onSearchResultChanged(async w=>await this.onSearchResultsChanged(w))),this._onAIResultChangedDisposable?.dispose(),this._onAIResultChangedDisposable=this._register(this.viewModel.searchResult.aiTextSearchResult.onChange(w=>{this.tree&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&!w.removed&&this.tree.updateChildren(this.searchResult.aiTextSearchResult)})),this._register(this.onDidChangeBodyVisibility(w=>this.onVisibilityChanged(w))),this.updateIndentStyles(this.themeService.getFileIconTheme()),this._register(this.themeService.onDidFileIconThemeChange(this.updateIndentStyles,this))}updateIndentStyles(e){this.resultsElement.classList.toggle("hide-arrows",this.isTreeLayoutViewVisible&&e.hidesExplorerArrows)}async onVisibilityChanged(e){this.viewletVisible.set(e),e?this.changedWhileHidden&&(await this.refreshAndUpdateCount(),this.changedWhileHidden=!1):this.lastFocusState="input",this.viewModel?.searchResult.toggleHighlights(e)}get searchAndReplaceWidget(){return this.searchWidget}get searchIncludePattern(){return this.inputPatternIncludes}get searchExcludePattern(){return this.inputPatternExcludes}createSearchWidget(e){let t=this.viewletState.query?.contentPattern||"",o=this.viewletState.query?.replaceText||"",n=this.viewletState.query?.regex===!0,r=this.viewletState.query?.wholeWords===!0,s=this.viewletState.query?.caseSensitive===!0,l=this.searchHistoryService.load(),c=l.search||this.viewletState.query?.searchHistory||[],u=l.replace||this.viewletState.query?.replaceHistory||[],p=typeof this.viewletState.view?.showReplace=="boolean"?this.viewletState.view.showReplace:!0,h=this.viewletState.query?.preserveCase===!0,g=this.viewletState.query?.isInNotebookMarkdownInput??!0,f=this.viewletState.query?.isInNotebookMarkdownPreview??!0,v=this.viewletState.query?.isInNotebookCellInput??!0,b=this.viewletState.query?.isInNotebookCellOutput??!0;if(this.searchWidget=this._register(this.instantiationService.createInstance(jP,e,{value:t,replaceValue:o,isRegex:n,isCaseSensitive:s,isWholeWords:r,searchHistory:c,replaceHistory:u,preserveCase:h,inputBoxStyles:Wl,toggleStyles:zh,notebookOptions:{isInNotebookMarkdownInput:g,isInNotebookMarkdownPreview:f,isInNotebookCellInput:v,isInNotebookCellOutput:b}})),!this.searchWidget.searchInput||!this.searchWidget.replaceInput){this.logService.warn(`Cannot fully create search widget. Search or replace input undefined. SearchInput: ${this.searchWidget.searchInput}, ReplaceInput: ${this.searchWidget.replaceInput}`);return}p&&this.searchWidget.toggleReplace(!0),this._register(this.searchWidget.onSearchSubmit(w=>{let x=this.configurationService.getValue("search").searchView.semanticSearchBehavior;x==="auto"&&this.logService.info("SearchView: Automatically rendering AI results"),this.triggerQueryChange({...w,shouldKeepAIResults:!1,shouldUpdateAISearch:x==="auto"})})),this._register(this.searchWidget.onSearchCancel(({focus:w})=>this.cancelSearch(w))),this._register(this.searchWidget.searchInput.onDidOptionChange(()=>{this.triggerQueryChange({shouldKeepAIResults:!0})})),this._register(this.searchWidget.getNotebookFilters().onDidChange(()=>this.triggerQueryChange({shouldKeepAIResults:!0})));let S=()=>this.hasSearchPatternKey.set(this.searchWidget.searchInput?this.searchWidget.searchInput.getValue().length>0:!1);S(),this._register(this.searchWidget.searchInput.onDidChange(()=>S()));let y=()=>this.hasReplacePatternKey.set(this.searchWidget.getReplaceValue().length>0);y(),this._register(this.searchWidget.replaceInput.inputBox.onDidChange(()=>y())),this._register(this.searchWidget.onDidHeightChange(()=>this.reLayout())),this._register(this.searchWidget.onReplaceToggled(()=>this.reLayout())),this._register(this.searchWidget.onReplaceStateChange(async w=>{this.viewModel.replaceActive=w,await this.refreshTreeController.queue()})),this._register(this.searchWidget.onPreserveCaseChange(async w=>{this.viewModel.preserveCase=w,await this.refreshTreeController.queue()})),this._register(this.searchWidget.onReplaceValueChanged(()=>{this.viewModel.replaceString=this.searchWidget.getReplaceValue(),this.delayedRefresh.trigger(async()=>this.refreshTreeController.queue())})),this._register(this.searchWidget.onBlur(()=>{this.toggleQueryDetailsButton.focus()})),this._register(this.searchWidget.onReplaceAll(()=>this.replaceAll())),this.trackInputBox(this.searchWidget.searchInputFocusTracker),this.trackInputBox(this.searchWidget.replaceInputFocusTracker)}shouldShowAIResults(){return!!Ri.hasAIResultProvider.getValue(this.contextKeyService)}async onConfigurationUpdated(e){if(e&&(e.affectsConfiguration("search.decorations.colors")||e.affectsConfiguration("search.decorations.badges")))return this.refreshTreeController.queue()}trackInputBox(e,t){e&&(this._register(e.onDidFocus(()=>{this.lastFocusState="input",this.inputBoxFocused.set(!0),t?.set(!0)})),this._register(e.onDidBlur(()=>{this.inputBoxFocused.set(this.searchWidget.searchInputHasFocus()||this.searchWidget.replaceInputHasFocus()||this.inputPatternIncludes.inputHasFocus()||this.inputPatternExcludes.inputHasFocus()),t?.set(!1)})))}async onSearchResultsChanged(e){if(this.isVisible())return this.refreshAndUpdateCount(e);this.changedWhileHidden=!0}async refreshAndUpdateCount(e){return this.searchWidget.setReplaceAllActionState(!this.viewModel.searchResult.isEmpty()),this.updateSearchResultCount(this.viewModel.searchResult.query.userDisabledExcludesAndIgnoreFiles,this.viewModel.searchResult.query?.onlyOpenEditors,e?.clearingAll),this.refreshTreeController.queue(e)}originalShouldCollapse(e){let t=this.searchConfig.collapseResults;return t==="alwaysCollapse"||!pl(e)&&e.count()>10&&t!=="alwaysExpand"?3:2}shouldCollapseAccordingToConfig(e){return this.originalShouldCollapse(e)===3}replaceAll(){if(this.viewModel.searchResult.count()===0)return;let e=this.viewModel.searchResult.count(),t=this.viewModel.searchResult.fileCount(),o=this.searchWidget.getReplaceValue()||"",n=this.buildAfterReplaceAllMessage(e,t,o),r,s;this.progressService.withProgress({location:this.getProgressLocation(),delay:100,total:e},c=>(s=c,new Promise(u=>r=u)));let l={title:d(15276,null),message:this.buildReplaceAllConfirmationMessage(e,t,o),primaryButton:d(15275,null)};this.dialogService.confirm(l).then(c=>{c.confirmed?(this.searchWidget.setReplaceAllActionState(!1),this.viewModel.searchResult.replaceAll(s).then(()=>{r();let u=this.clearMessage();D(u,n),this.reLayout()},u=>{r(),Yi(u),this.notificationService.error(u)})):r()})}buildAfterReplaceAllMessage(e,t,o){return e===1?t===1?o?d(15278,null,e,t,o):d(15268,null,e,t):o?d(15280,null,e,t,o):d(15270,null,e,t):t===1?o?d(15282,null,e,t,o):d(15272,null,e,t):o?d(15284,null,e,t,o):d(15274,null,e,t)}buildReplaceAllConfirmationMessage(e,t,o){let r=(s=>{if(!s)return s;let l=s.split(`
`);return l.length>10?l.slice(0,10).join(`
`)+`
...`:s})(o);return e===1?t===1?r?d(15267,null,e,t,r):d(15277,null,e,t):r?d(15269,null,e,t,r):d(15279,null,e,t):t===1?r?d(15271,null,e,t,r):d(15281,null,e,t):r?d(15273,null,e,t,r):d(15283,null,e,t)}clearMessage(){this.searchWithoutFolderMessageElement=void 0;let e=this.messagesElement.style.display==="none";St(this.messagesElement),Xo(this.messagesElement),this.messageDisposables.clear();let t=D(this.messagesElement,oL(".message"));return e&&this.reLayout(),t}createSearchResultsView(e){this.resultsElement=D(e,oL(".results.show-file-icons.file-icon-themable-tree"));let t=this.instantiationService.createInstance(Sct),o={getId(r){return r.id()}};this.searchDataSource=this.instantiationService.createInstance(Ect,this),this.treeLabels=this._register(this.instantiationService.createInstance(jl,{onDidChangeVisibility:this.onDidChangeBodyVisibility})),this.tree=this._register(this.instantiationService.createInstance(qy,"SearchView",this.resultsElement,t,{isIncompressible:r=>!(ru(r)&&!Pv(r.parent())&&!m$(r.parent())&&!TV(r.parent()))},[this._register(this.instantiationService.createInstance(v9,this,this.treeLabels)),this._register(this.instantiationService.createInstance(b9,this,this.treeLabels)),this._register(this.instantiationService.createInstance(f9,this.treeLabels)),this._register(this.instantiationService.createInstance(S9,this))],this.searchDataSource,{identityProvider:o,accessibilityProvider:this.treeAccessibilityProvider,dnd:this.instantiationService.createInstance(d8,r=>Bl(r)?r.resource:pl(r)?$L(r.parent().resource,r.range()):null),multipleSelectionSupport:!0,selectionNavigation:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles,paddingBottom:Sct.ITEM_HEIGHT,collapseByDefault:r=>Pv(r)?r.isAIContributed:ru(r)&&r.matches().length===1&&ru(r.matches()[0])?!1:this.shouldCollapseAccordingToConfig(r)})),Ri.SearchResultListFocusedKey.bindTo(this.tree.contextKeyService),this.tree.setInput(this.viewModel.searchResult),this._register(this.tree.onContextMenu(r=>this.onContextMenu(r)));let n=()=>this.toggleCollapseStateDelayer.trigger(()=>this.hasSomeCollapsibleResultKey.set(this.hasSomeCollapsible()));n(),this._register(this.tree.onDidChangeCollapseState(()=>n())),this._register(this.tree.onDidChangeModel(()=>n())),this._register(U.debounce(this.tree.onDidOpen,(r,s)=>s,DMo,!0)(r=>{if(pl(r.element)){let s=r.element;this.currentSelectedFileMatch?.setSelectedMatch(null),this.currentSelectedFileMatch=s.parent(),this.currentSelectedFileMatch.setSelectedMatch(s),this.onFocus(s,r.editorOptions.preserveFocus,r.sideBySide,r.editorOptions.pinned)}})),this._register(U.debounce(this.tree.onDidChangeFocus,(r,s)=>s,DMo,!0)(()=>{let r=this.tree.getSelection(),s=this.tree.getFocus()[0];r.length>1&&pl(s)&&this.onFocus(s,!0)})),this._register(U.any(this.tree.onDidFocus,this.tree.onDidChangeFocus)(()=>{let r=this.tree.getFocus()[0];if(this.tree.isDOMFocused()){let l=this.tree.getFirstElementChild(this.tree.getInput());this.firstMatchFocused.set(l===r),this.fileMatchOrMatchFocused.set(!!r),this.fileMatchFocused.set(Bl(r)),this.folderMatchFocused.set(ru(r)),this.matchFocused.set(pl(r)),this.fileMatchOrFolderMatchFocus.set(Bl(r)||ru(r)),this.fileMatchOrFolderMatchWithResourceFocus.set(Bl(r)||q6(r)),this.folderMatchWithResourceFocused.set(q6(r)),this.searchResultHeaderFocused.set(W_o(r)),this.lastFocusState="tree"}let s=!1;pl(r)?s=!r.isReadonly:(Bl(r)||ru(r))&&(s=!r.hasOnlyReadOnlyMatches()),this.isEditableItem.set(s)})),this._register(this.tree.onDidBlur(()=>{this.firstMatchFocused.reset(),this.fileMatchOrMatchFocused.reset(),this.fileMatchFocused.reset(),this.folderMatchFocused.reset(),this.matchFocused.reset(),this.fileMatchOrFolderMatchFocus.reset(),this.fileMatchOrFolderMatchWithResourceFocus.reset(),this.folderMatchWithResourceFocused.reset(),this.searchResultHeaderFocused.reset(),this.isEditableItem.reset()})),this._register(this.editorService.onDidActiveEditorChange(()=>{let r=da(this.editorService.activeTextEditorControl);this.currentEditorCursorListener.value=r?.onDidChangeCursorPosition(()=>{this.currentSelectedFileMatch?.setSelectedMatch(null),this.currentSelectedFileMatch=void 0})}))}onContextMenu(e){e.browserEvent.preventDefault(),e.browserEvent.stopPropagation();let t=this.tree.getSelection(),o,n;t&&t.length>0?(o=e.element,n=t):n=e.element,this.contextMenuService.showContextMenu({menuId:R.SearchContext,menuActionOptions:{shouldForwardArgs:!0,arg:o},contextKeyService:this.contextKeyService,getAnchor:()=>e.anchor,getActionsContext:()=>n})}hasSomeCollapsible(){let e=this.getControl(),t=e.navigate(),o=t.first(),n=this.shouldShowAIResults();do if(o&&!e.isCollapsed(o)&&(!n||!Pv(o)))return!0;while(o=t.next());return!1}async selectNextMatch(){if(!this.hasSearchResults())return;let[e]=this.tree.getSelection();e&&!pl(e)&&this.tree.isCollapsed(e)&&await this.tree.expand(e);let t=this.tree.navigate(e),o=t.next();for(o||(o=t.first());o&&!pl(o);)this.tree.isCollapsed(o)&&await this.tree.expand(o),o=t.next();if(o){o===e&&this.tree.setFocus([]);let n=GT(void 0,!1,!1);this.tree.setFocus([o],n),this.tree.setSelection([o],n),this.tree.reveal(o);let r=this.treeAccessibilityProvider.getAriaLabel(o);r&&Er(r)}}async selectPreviousMatch(){if(!this.hasSearchResults())return;let[e]=this.tree.getSelection(),t=this.tree.navigate(e),o=t.previous();for(;!o||!pl(o)&&!this.tree.isCollapsed(o);){let n=o?t.previous():t.last();if(!o&&!n)return;o=n}for(;o&&!pl(o);){let n=t.next();if(!n)break;await this.tree.expand(o),t=this.tree.navigate(n),o=n?t.previous():t.last()}if(o){o===e&&this.tree.setFocus([]);let n=GT(void 0,!1,!1);this.tree.setFocus([o],n),this.tree.setSelection([o],n),this.tree.reveal(o);let r=this.treeAccessibilityProvider.getAriaLabel(o);r&&Er(r)}}moveFocusToResults(){this.tree.domFocus()}focus(){if(super.focus(),this.lastFocusState==="input"||!this.hasSearchResults()){let e=this.searchConfig.seedOnFocus?this.updateTextFromSelection({allowSearchOnType:!1}):!1;this.searchWidget.focus(void 0,void 0,e)}else this.tree.domFocus()}updateTextFromFindWidgetOrSelection({allowUnselectedWord:e=!0,allowSearchOnType:t=!0}){let o=this.editorService.activeTextEditorControl;if(fn(o)&&!o?.hasTextFocus()){let n=Sv.get(o);if(n&&n.isFindInputFocused())return this.updateTextFromFindWidget(n,{allowSearchOnType:t});o=this.codeEditorService.listCodeEditors().find(s=>s instanceof Ed&&s.getParentEditor()===o&&s.hasTextFocus())??o}return this.updateTextFromSelection({allowUnselectedWord:e,allowSearchOnType:t},o)}updateTextFromFindWidget(e,{allowSearchOnType:t=!0}){if(!this.searchConfig.seedWithNearestWord&&(zi().getSelection()?.toString()??"")==="")return!1;let o=e.getState().searchString;return o===""?!1:(this.searchWidget.searchInput?.setCaseSensitive(e.getState().matchCase),this.searchWidget.searchInput?.setWholeWords(e.getState().wholeWord),this.searchWidget.searchInput?.setRegex(e.getState().isRegex),this.updateText(o,t),!0)}updateTextFromSelection({allowUnselectedWord:e=!0,allowSearchOnType:t=!0},o){let n=this.configurationService.getValue("editor").find.seedSearchStringFromSelection;if(!n||n==="never")return!1;let r=this.getSearchTextFromEditor(e,o);return r===null?!1:(this.searchWidget.searchInput?.getRegex()&&(r=Ss(r)),this.updateText(r,t),!0)}updateText(e,t=!0){t&&!this.viewModel.searchResult.isDirty?this.searchWidget.setValue(e):(this.pauseSearching=!0,this.searchWidget.setValue(e),this.pauseSearching=!1)}focusNextInputBox(){if(this.searchWidget.searchInputHasFocus()){this.searchWidget.isReplaceShown()?this.searchWidget.focus(!0,!0):this.moveFocusFromSearchOrReplace();return}if(this.searchWidget.replaceInputHasFocus()){this.moveFocusFromSearchOrReplace();return}if(this.inputPatternIncludes.inputHasFocus()){this.inputPatternExcludes.focus(),this.inputPatternExcludes.select();return}if(this.inputPatternExcludes.inputHasFocus()){this.selectTreeIfNotSelected();return}}moveFocusFromSearchOrReplace(){this.showsFileTypes()?this.toggleQueryDetails(!0,this.showsFileTypes()):this.selectTreeIfNotSelected()}focusPreviousInputBox(){if(!this.searchWidget.searchInputHasFocus()){if(this.searchWidget.replaceInputHasFocus()){this.searchWidget.focus(!0);return}if(this.inputPatternIncludes.inputHasFocus()){this.searchWidget.focus(!0,!0);return}if(this.inputPatternExcludes.inputHasFocus()){this.inputPatternIncludes.focus(),this.inputPatternIncludes.select();return}if(this.tree.isDOMFocused()){this.moveFocusFromResults();return}}}moveFocusFromResults(){this.showsFileTypes()?this.toggleQueryDetails(!0,!0,!1,!0):this.searchWidget.focus(!0,!0)}reLayout(){if(this.isDisposed||!this.size)return;let e=this.searchConfig.actionsPosition;this.getContainer().classList.toggle(M$.ACTIONS_RIGHT_CLASS_NAME,e==="right"),this.searchWidget.setWidth(this.size.width-28),this.inputPatternExcludes.setWidth(this.size.width-28),this.inputPatternIncludes.setWidth(this.size.width-28);let t=Uh(this.searchWidgetsContainerElement),o=Uh(this.messagesElement);this.tree.layout(this.size.height-t-o,this.size.width-28)}layoutBody(e,t){super.layoutBody(e,t),this.size=new di(t,e),this.reLayout()}getControl(){return this.tree}allSearchFieldsClear(){return this.searchWidget.getReplaceValue()===""&&(!this.searchWidget.searchInput||this.searchWidget.searchInput.getValue()==="")}allFilePatternFieldsClear(){return this.searchExcludePattern.getValue()===""&&this.searchIncludePattern.getValue()===""}hasSearchResults(){return!this.viewModel.searchResult.isEmpty()}clearSearchResults(e=!0){this.viewModel.searchResult.clear(),this.showEmptyStage(!0),this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),e&&(this.allSearchFieldsClear()&&this.clearFilePatternFields(),this.searchWidget.clear()),this.viewModel.cancelSearch(),this.viewModel.cancelAISearch(),this.tree.ariaLabel=d(15246,null),this.accessibilitySignalService.playSignal(tn.clear),this.reLayout()}clearFilePatternFields(){this.searchExcludePattern.clear(),this.searchIncludePattern.clear()}cancelSearch(e=!0){return this.viewModel.cancelSearch()&&this.viewModel.cancelAISearch()?(e&&this.searchWidget.focus(),!0):!1}selectTreeIfNotSelected(){if(this.tree.getNode(void 0)&&(this.tree.domFocus(),this.tree.getSelection().length===0)){let t=GT();this.tree.focusNext(void 0,void 0,t),this.tree.setSelection(this.tree.getFocus(),t)}}getSearchTextFromEditor(e,t){if(Is(this.getContainer())||(t=t??this.editorService.activeTextEditorControl,!t))return null;let o=this.searchConfig.seedWithNearestWord&&e;return _Vi(o,t)}showsFileTypes(){return this.queryDetails.classList.contains("more")}toggleCaseSensitive(){this.searchWidget.searchInput?.setCaseSensitive(!this.searchWidget.searchInput.getCaseSensitive()),this.triggerQueryChange({shouldKeepAIResults:!0})}toggleWholeWords(){this.searchWidget.searchInput?.setWholeWords(!this.searchWidget.searchInput.getWholeWords()),this.triggerQueryChange({shouldKeepAIResults:!0})}toggleRegex(){this.searchWidget.searchInput?.setRegex(!this.searchWidget.searchInput.getRegex()),this.triggerQueryChange({shouldKeepAIResults:!0})}togglePreserveCase(){this.searchWidget.replaceInput?.setPreserveCase(!this.searchWidget.replaceInput.getPreserveCase()),this.triggerQueryChange({shouldKeepAIResults:!0})}setSearchParameters(e={}){typeof e.isCaseSensitive=="boolean"&&this.searchWidget.searchInput?.setCaseSensitive(e.isCaseSensitive),typeof e.matchWholeWord=="boolean"&&this.searchWidget.searchInput?.setWholeWords(e.matchWholeWord),typeof e.isRegex=="boolean"&&this.searchWidget.searchInput?.setRegex(e.isRegex),typeof e.filesToInclude=="string"&&this.searchIncludePattern.setValue(String(e.filesToInclude)),typeof e.filesToExclude=="string"&&this.searchExcludePattern.setValue(String(e.filesToExclude)),typeof e.query=="string"&&this.searchWidget.searchInput?.setValue(e.query),typeof e.replace=="string"?this.searchWidget.replaceInput?.setValue(e.replace):this.searchWidget.replaceInput&&this.searchWidget.replaceInput.getValue()!==""&&this.searchWidget.replaceInput.setValue(""),typeof e.triggerSearch=="boolean"&&e.triggerSearch&&this.triggerQueryChange(),typeof e.preserveCase=="boolean"&&this.searchWidget.replaceInput?.setPreserveCase(e.preserveCase),typeof e.useExcludeSettingsAndIgnoreFiles=="boolean"&&this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(e.useExcludeSettingsAndIgnoreFiles),typeof e.onlyOpenEditors=="boolean"&&this.searchIncludePattern.setOnlySearchInOpenEditors(e.onlyOpenEditors)}toggleQueryDetails(e=!0,t,o,n){t=typeof t>"u"?!this.queryDetails.classList.contains("more"):!!t,this.viewletState.query||(this.viewletState.query={}),this.viewletState.query.queryDetailsExpanded=t,o=!!o,t?(this.toggleQueryDetailsButton.setAttribute("aria-expanded","true"),this.queryDetails.classList.add("more"),e&&(n?(this.inputPatternExcludes.focus(),this.inputPatternExcludes.select()):(this.inputPatternIncludes.focus(),this.inputPatternIncludes.select()))):(this.toggleQueryDetailsButton.setAttribute("aria-expanded","false"),this.queryDetails.classList.remove("more"),e&&this.searchWidget.focus()),!o&&this.size&&this.reLayout()}searchInFolders(e=[]){this._searchWithIncludeOrExclude(!0,e)}searchOutsideOfFolders(e=[]){this._searchWithIncludeOrExclude(!1,e)}_searchWithIncludeOrExclude(e,t){if(!t.length||t.some(o=>o===".")){this.inputPatternIncludes.setValue(""),this.searchWidget.focus();return}this.showsFileTypes()||this.toggleQueryDetails(!0,!0),(e?this.inputPatternIncludes:this.inputPatternExcludes).setValue(t.join(", ")),this.searchWidget.focus(!1)}triggerQueryChange(e){let t={preserveFocus:!0,triggeredOnType:!1,delay:0,...e};if(!(t.triggeredOnType&&!this.searchConfig.searchOnType)&&!this.pauseSearching){let o=t.triggeredOnType?t.delay:0;this.triggerQueryDelayer.trigger(()=>{this._onQueryChanged(t.preserveFocus,t.triggeredOnType,t.shouldKeepAIResults,t.shouldUpdateAISearch)},o)}}_getExcludePattern(){return this.inputPatternExcludes.getValue().trim()}_getIncludePattern(){return this.inputPatternIncludes.getValue().trim()}_onQueryChanged(e,t=!1,o=!1,n=!1){if(!this.searchWidget.searchInput?.inputBox.isInputValid())return;let r=this.searchWidget.searchInput.getRegex(),s=this.searchWidget.getNotebookFilters().markupInput,l=this.searchWidget.getNotebookFilters().markupPreview,c=this.searchWidget.getNotebookFilters().codeInput,u=this.searchWidget.getNotebookFilters().codeOutput,p=this.searchWidget.searchInput.getWholeWords(),h=this.searchWidget.searchInput.getCaseSensitive(),g=this.searchWidget.searchInput.getValue(),f=this._getExcludePattern(),v=this._getIncludePattern(),b=this.inputPatternExcludes.useExcludesAndIgnoreFiles(),S=this.inputPatternIncludes.onlySearchInOpenEditors();if(g.length===0){this.clearSearchResults(!1),this.clearMessage(),this.clearAIResults();return}let y={pattern:g,isRegExp:r,isCaseSensitive:h,isWordMatch:p,notebookInfo:{isInNotebookMarkdownInput:s,isInNotebookMarkdownPreview:l,isInNotebookCellInput:c,isInNotebookCellOutput:u}},w=[{pattern:this.inputPatternExcludes.getValue()}],x=this.inputPatternIncludes.getValue(),E=y.isRegExp?1e4:1e3,M={_reason:"searchView",extraFileResources:this.instantiationService.invokeFunction(Tee),maxResults:this.searchConfig.maxResults??void 0,disregardIgnoreFiles:!b||void 0,disregardExcludeSettings:!b||void 0,ignoreGlobCase:!Sn||void 0,onlyOpenEditors:S,excludePattern:w,includePattern:x,previewOptions:{matchLines:1,charsPerLine:E},isSmartCase:this.searchConfig.smartCase,expandPatterns:!0},N=this.contextService.getWorkspace().folders,V=K=>{this.searchWidget.searchInput?.showMessage({content:K.message,type:3}),this.viewModel.searchResult.clear()},H;try{H=this.queryBuilder.text(y,N.map(K=>K.uri),M)}catch(K){V(K);return}this.validateQuery(H).then(()=>{!o&&n&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&this.tree.collapse(this.searchResult.aiTextSearchResult),this.onQueryTriggered(H,M,f,v,t,o,n),e||this.searchWidget.focus(!1,void 0,!0)},V)}validateQuery(e){let t=e.folderQueries.map(o=>this.fileService.exists(o.folder).catch(()=>!1));return Promise.all(t).then(o=>{let n=e.folderQueries.filter((r,s)=>o[s]);if(!e.folderQueries.length||n.length)e.folderQueries=n;else{let r=e.folderQueries[0].folder.fsPath,s=d(15293,null,r);return Promise.reject(new Error(s))}})}onQueryTriggered(e,t,o,n,r,s,l){this.addToSearchHistoryDelayer.trigger(()=>{this.searchWidget.searchInput?.onSearchSubmit(),this.inputPatternExcludes.onSearchSubmit(),this.inputPatternIncludes.onSearchSubmit()}),this.viewModel.cancelSearch(!0),s||this.clearAIResults(),this.currentSearchQ=this.currentSearchQ.then(()=>this.doSearch(e,o,n,r,s,l)).then(()=>{},()=>{})}async _updateResults(){if(this.state!==0)try{let e=this.viewModel.searchResult.fileCount();this._visibleMatches!==e&&(this._visibleMatches=e,await this.refreshAndUpdateCount())}finally{this._refreshResultsScheduler.schedule()}}async expandIfSingularResult(){if(this.searchConfig.collapseResults!=="alwaysCollapse"&&this.viewModel.searchResult.matches().length===1){let t=this.viewModel.searchResult.matches()[0];await this.tree.expandTo(t),t.count()<50&&await this.tree.expand(t)}}appendSearchWithAIButton(e){let t=this.keybindingService.appendKeybinding(d(15298,null),"search.action.searchWithAI"),o=d(15296,null),n=this.messageDisposables.add(new OV(o,()=>{this.commandService.executeCommand("search.action.searchWithAI")},this.hoverService,t));D(e,n.element)}async onSearchComplete(e,t,o,n,r=!0,s){this.state=0,e(),r&&await this.refreshAndUpdateCount();let l=!this.viewModel.searchResult.isEmpty(),c=this.searchResult.getCachedSearchComplete(!0);if(n?.exit!==1){if(Ri.AIResultsRequested.bindTo(this.contextKeyService).set(this.shouldShowAIResults()&&!!c),n&&this.tree.hasNode(this.searchResult.aiTextSearchResult)&&this.tree.isCollapsed(this.searchResult.aiTextSearchResult)){this.tree.expand(this.searchResult.aiTextSearchResult);return}if(l)this.viewModel.searchResult.toggleHighlights(this.isVisible()),Er(d(15244,null,this.viewModel.searchResult.count(),this.viewModel.searchResult.fileCount()));else{let u=!!t,p=!!o,h;n?this.inputPatternIncludes.onlySearchInOpenEditors()?p&&u?h=d(15254,null,o,t):p?h=d(15253,null,o):u?h=d(15251,null,t):h=d(15252,null):p&&u?h=d(15258,null,o,t):p?h=d(15257,null,o):u?h=d(15255,null,t):h=d(15256,null):h=_Mo,Er(h);let g=this.clearMessage();if(D(g,h),this.shouldShowAIResults()&&(this.appendSearchWithAIButton(g),D(g,oL("span",void 0," - "))),n)if(p||u){let f=this.messageDisposables.add(new OV(d(15286,null),this.onSearchAgain.bind(this),this.hoverService));D(g,f.element)}else{let f=this.messageDisposables.add(new OV(d(15264,null),this.onOpenSettings.bind(this),this.hoverService));D(g,f.element)}else{let f=this.messageDisposables.add(new OV(d(15285,null),()=>this.triggerQueryChange({preserveFocus:!1}),this.hoverService));D(g,f.element)}this.contextService.getWorkbenchState()===1&&this.showSearchWithoutFolderMessage(),this.reLayout()}if(n&&n.limitHit&&n.messages.push({type:2,text:d(15292,null)}),n&&n.messages)for(let u of n.messages)this.addMessage(u);this.reLayout()}}async onSearchError(e,t,o,n,r,s=!0){return this.state=0,Yi(e)?this.onSearchComplete(t,o,n,r,s):(t(),this.searchWidget.searchInput?.showMessage({content:e.message,type:3}),this.viewModel.searchResult.clear(),Promise.resolve())}clearAIResults(){this.model.searchResult.aiTextSearchResult.hidden=!0,this.refreshTreeController.clearAllPending(),this._pendingSemanticSearchPromise=void 0,this._cachedResults=void 0,this._cachedKeywords=[],this.model.cancelAISearch(!0),this.model.clearAiSearchResults()}async requestAIResults(){this.logService.info(`SearchView: Requesting semantic results from keybinding. Cached: ${!!this.cachedResults}`),(!this.cachedResults||this.cachedResults.results.length===0)&&!this._pendingSemanticSearchPromise&&this.clearAIResults(),this.model.searchResult.aiTextSearchResult.hidden=!1,await this.queueRefreshTree(),await YHe(this.getControl(),this.model.searchResult.aiTextSearchResult)}async addAIResults(){let e=this._getExcludePattern(),t=this._getIncludePattern();this.searchWidget.searchInput?.clearMessage(),this.showEmptyStage(),this._visibleMatches=0,this.tree.setSelection([]),this.tree.setFocus([]),this.viewModel.replaceString=this.searchWidget.getReplaceValue();let o=this._pendingSemanticSearchPromise;o||(this.viewModel.searchResult.setAIQueryUsingTextQuery(),o=this._pendingSemanticSearchPromise=this.viewModel.aiSearch(()=>{this._pendingSemanticSearchPromise===o&&(this._pendingSemanticSearchPromise=void 0)})),o.then(n=>(this.updateSearchResultCount(this.viewModel.searchResult.query?.userDisabledExcludesAndIgnoreFiles,this.viewModel.searchResult.query?.onlyOpenEditors,!1),this.onSearchComplete(()=>{},e,t,n,!1,n.aiKeywords)),n=>this.onSearchError(n,()=>{},e,t,void 0,!1))}doSearch(e,t,o,n,r,s){let l;this.progressService.withProgress({location:this.getProgressLocation(),delay:n?300:0},p=>new Promise(h=>l=h)),this.searchWidget.searchInput?.clearMessage(),this.state=1,this.showEmptyStage(),this.model.searchResult.aiTextSearchResult.hidden&&s&&(this.logService.info(`SearchView: Semantic search visible. Keep semantic results: ${r}. Update semantic search: ${s}`),this.model.searchResult.aiTextSearchResult.hidden=!1);let c=setTimeout(()=>{this.state=2},2e3);this._visibleMatches=0,this._refreshResultsScheduler.schedule(),this.searchWidget.setReplaceAllActionState(!1),this.tree.setSelection([]),this.tree.setFocus([]),this.viewModel.replaceString=this.searchWidget.getReplaceValue();let u=this.viewModel.search(e);return(!r||s)&&this.viewModel.searchResult.setAIQueryUsingTextQuery(e),this.configurationService.getValue("search").searchView.keywordSuggestions&&this.getKeywordSuggestions(),u.asyncResults.then(p=>{clearTimeout(c);let h=this.configurationService.getValue("search").searchView.semanticSearchBehavior;return p.results.length===0&&h==="runOnEmpty"&&(this.logService.info("SearchView: Requesting semantic results on empty search."),this.model.searchResult.aiTextSearchResult.hidden=!1),this.onSearchComplete(l,t,o,p)},p=>(clearTimeout(c),this.onSearchError(p,l,t,o)))}onOpenSettings(e){Kt.stop(e,!1),this.openSettings("@id:files.exclude,search.exclude,search.useParentIgnoreFiles,search.useGlobalIgnoreFiles,search.useIgnoreFiles")}openSettings(e){let t={query:e};return this.contextService.getWorkbenchState()!==1?this.preferencesService.openWorkspaceSettings(t):this.preferencesService.openUserSettings(t)}onSearchAgain(){this.inputPatternExcludes.setValue(""),this.inputPatternIncludes.setValue(""),this.inputPatternIncludes.setOnlySearchInOpenEditors(!1),this.triggerQueryChange({preserveFocus:!1})}onEnableExcludes(){this.toggleQueryDetails(!1,!0),this.searchExcludePattern.setUseExcludesAndIgnoreFiles(!0)}onDisableSearchInOpenEditors(){this.toggleQueryDetails(!1,!0),this.inputPatternIncludes.setOnlySearchInOpenEditors(!1)}updateSearchResultCount(e,t,o=!1){if(this._cachedKeywords.length>0)return;let n=this.viewModel.searchResult.fileCount(this.viewModel.searchResult.aiTextSearchResult.hidden),r=this.viewModel.searchResult.count(this.viewModel.searchResult.aiTextSearchResult.hidden);this.hasSearchResultsKey.set(n>0);let s=this.messagesElement.style.display==="none",l=this.clearMessage(),c=o?"":this.buildResultCountMessage(r,n);if(this.tree.ariaLabel=c+d(15248,null,this.searchResult.query?.contentPattern.pattern??""),D(l,c),n>0){if(e){let h=" - "+d(15300,null)+" ",g=this.messageDisposables.add(new OV(d(15247,null),this.onEnableExcludes.bind(this),this.hoverService,d(15299,null)));D(l,oL("span",void 0,h,"(",g.element,")"))}if(t){let h=" - "+d(15259,null)+" ",g=this.messageDisposables.add(new OV(d(15260,null),this.onDisableSearchInOpenEditors.bind(this),this.hoverService,d(15245,null)));D(l,oL("span",void 0,h,"(",g.element,")"))}D(l," - ");let u=this.keybindingService.appendKeybinding(d(15263,null),"search.action.openInEditor"),p=this.messageDisposables.add(new OV(d(15262,null),()=>this.instantiationService.invokeFunction(p3t,this.searchResult,this.searchIncludePattern.getValue(),this.searchExcludePattern.getValue(),this.searchIncludePattern.onlySearchInOpenEditors()),this.hoverService,u));D(l,p.element),this.shouldShowAIResults()&&(D(l," - "),this.appendSearchWithAIButton(l)),this.reLayout()}else s||Wi(this.messagesElement)}handleKeywordClick(e,t){this.searchWidget.searchInput?.setValue(e),this.triggerQueryChange({preserveFocus:!1,triggeredOnType:!1,shouldKeepAIResults:!1}),this.telemetryService.publicLog2("searchKeywordClick",{index:t,maxKeywords:this._cachedKeywords.length})}updateKeywordSuggestionUI(e){let t=this.messagesElement.firstChild;if(this._cachedKeywords.length>0){if(this._cachedKeywords.length>=3)return;D(t,", ");let o=this._cachedKeywords.length,n=this.messageDisposables.add(new OV(e.keyword,()=>this.handleKeywordClick(e.keyword,o),this.hoverService));D(t,n.element)}else{let o=this.clearMessage();o.classList.add("ai-keywords");let n=d(15249,null);D(o,n);let r=this.messageDisposables.add(new OV(e.keyword,()=>this.handleKeywordClick(e.keyword,0),this.hoverService));D(o,r.element)}this._cachedKeywords.push(e.keyword)}async getKeywordSuggestions(){let e=this._pendingSemanticSearchPromise;e||(this.viewModel.searchResult.setAIQueryUsingTextQuery(),e=this._pendingSemanticSearchPromise=this.viewModel.aiSearch(t=>{if(t&&qPt(t)){this.updateKeywordSuggestionUI(t);return}this._pendingSemanticSearchPromise===e&&(this._pendingSemanticSearchPromise=void 0)})),this._cachedResults=await e}addMessage(e){let t=this.messagesElement.firstChild;t&&D(t,i3t(e,this.instantiationService,this.notificationService,this.openerService,this.commandService,this.messageDisposables,()=>this.triggerQueryChange()))}buildResultCountMessage(e,t){return e===1&&t===1?d(15287,null,e,t):e===1?d(15289,null,e,t):t===1?d(15288,null,e,t):d(15290,null,e,t)}showSearchWithoutFolderMessage(){this.searchWithoutFolderMessageElement=this.clearMessage();let e=D(this.searchWithoutFolderMessageElement,oL("p",void 0,d(15297,null))),t=this.messageDisposables.add(new OV(d(15261,null),()=>{this.commandService.executeCommand(wW.ID).catch(o=>mt(o))},this.hoverService));D(e,t.element)}showEmptyStage(e=!1){((this.messagesElement.firstChild?.textContent?.indexOf(_Mo)??-1)>-1||e||!this.configurationService.getValue().search?.searchOnType)&&Wi(this.messagesElement),Xo(this.resultsElement),this.currentSelectedFileMatch=void 0}shouldOpenInNotebookEditor(e,t){return _1(e)||t.scheme!==Q.untitled&&this.notebookService.getContributedNotebookTypes(t).length>0}onFocus(e,t,o,n){let r=this.configurationService.getValue().search?.useReplacePreview,s=pl(e)?e.parent().resource:e.resource;return r&&this.viewModel.isReplaceActive()&&this.viewModel.replaceString&&!this.shouldOpenInNotebookEditor(e,s)?this.replaceService.openReplacePreview(e,t,o,n):this.open(e,t,o,n,s)}async open(e,t,o,n,r){let s=TVi(e,this.viewModel),l=pl(e)?e.parent().matches():[],c=r??(pl(e)?e.parent().resource:e.resource),u,p={preserveFocus:t,pinned:n,selection:s,revealIfVisible:!0};try{u=await this.editorService.openEditor({resource:c,options:p},o?En:tr);let h=u?.getControl();pl(e)&&t&&fn(h)?this.viewModel.searchResult.getRangeHighlightDecorations().highlightRange(h.getModel(),e.range()):this.viewModel.searchResult.getRangeHighlightDecorations().removeHighlightRange()}catch(h){mt(h);return}if(u instanceof UR){let h=e.parent();if(pl(e))if(_1(e))e.parent().showMatch(e);else{let g=u.getControl();if(g){h.bindNotebookEditorWidget(g),await h.updateMatchesForEditorWidget();let f=l.findIndex(S=>S.id()===e.id()),v=h.matches(),b=f>=v.length?v[v.length-1]:v[f];_1(b)&&(h.showMatch(b),(!this.tree.getFocus().includes(b)||!this.tree.getSelection().includes(b))&&(this.tree.setSelection([b],GT()),this.tree.setFocus([b])))}}}}openEditorWithMultiCursor(e){let t=pl(e)?e.parent().resource:e.resource;return this.editorService.openEditor({resource:t,options:{preserveFocus:!1,pinned:!0,revealIfVisible:!0}}).then(o=>{if(o){let n=null;if(Bl(e)?n=e:pl(e)&&(n=e.parent()),n){let r=n.matches().map(l=>new ei(l.range().startLineNumber,l.range().startColumn,l.range().endLineNumber,l.range().endColumn)),s=da(o.getControl());s&&$J.get(s)?.selectAllUsingSelections(r)}}this.viewModel.searchResult.getRangeHighlightDecorations().removeHighlightRange()},mt)}onUntitledDidDispose(e){if(!this.viewModel)return;let t=this.viewModel.searchResult.matches();for(let o=0,n=t.length;o<n;o++)e.toString()===t[o].resource.toString()&&this.viewModel.searchResult.remove(t[o]);t=this.viewModel.searchResult.matches(!0);for(let o=0,n=t.length;o<n;o++)e.toString()===t[o].resource.toString()&&this.viewModel.searchResult.remove(t[o])}onFilesChanged(e){if(!this.viewModel||this.searchConfig.sortOrder!=="modified"&&!e.gotDeleted())return;let t=this.viewModel.searchResult.matches();if(e.gotDeleted()){let o=t.filter(n=>e.contains(n.resource,2));this.viewModel.searchResult.remove(o)}else{let o=t.filter(n=>e.contains(n.resource));o.length&&this.searchConfig.sortOrder==="modified"&&this.updateFileStats(o).then(async()=>this.refreshTreeController.queue())}}get searchConfig(){return this.configurationService.getValue("search")}clearHistory(){this.searchWidget.clearHistory(),this.inputPatternExcludes.clearHistory(),this.inputPatternIncludes.clearHistory()}saveState(){if(!this.searchWidget)return;let e=this.inputPatternExcludes?.getValue().trim()??"",t=this.inputPatternIncludes?.getValue().trim()??"",o=this.inputPatternIncludes?.onlySearchInOpenEditors()??!1,n=this.inputPatternExcludes?.useExcludesAndIgnoreFiles()??!0,r=this.viewModel.preserveCase;if(this.viewletState.query||(this.viewletState.query={}),this.searchWidget.searchInput){let l=this.searchWidget.searchInput.getRegex(),c=this.searchWidget.searchInput.getWholeWords(),u=this.searchWidget.searchInput.getCaseSensitive(),p=this.searchWidget.searchInput.getValue(),h=this.searchWidget.getNotebookFilters().codeInput,g=this.searchWidget.getNotebookFilters().codeOutput,f=this.searchWidget.getNotebookFilters().markupInput,v=this.searchWidget.getNotebookFilters().markupPreview;this.viewletState.query.contentPattern=p,this.viewletState.query.regex=l,this.viewletState.query.wholeWords=c,this.viewletState.query.caseSensitive=u,this.viewletState.query.isInNotebookMarkdownInput=f,this.viewletState.query.isInNotebookMarkdownPreview=v,this.viewletState.query.isInNotebookCellInput=h,this.viewletState.query.isInNotebookCellOutput=g}this.viewletState.query.folderExclusions=e,this.viewletState.query.folderIncludes=t,this.viewletState.query.useExcludesAndIgnoreFiles=n,this.viewletState.query.preserveCase=r,this.viewletState.query.onlyOpenEditors=o;let s=this.searchAndReplaceWidget.isReplaceShown();this.viewletState.view||(this.viewletState.view={}),this.viewletState.view.showReplace=s,this.viewletState.view.treeLayout=this.isTreeLayoutViewVisible,this.viewletState.query.replaceText=s&&this.searchWidget.getReplaceValue(),this._saveSearchHistoryService(),this.memento.saveMemento(),super.saveState()}_saveSearchHistoryService(){if(this.searchWidget===void 0)return;let e=Object.create(null),t=this.searchWidget.getSearchHistory();t&&t.length&&(e.search=t);let o=this.searchWidget.getReplaceHistory();o&&o.length&&(e.replace=o);let n=this.inputPatternExcludes.getHistory();n&&n.length&&(e.exclude=n);let r=this.inputPatternIncludes.getHistory();r&&r.length&&(e.include=r),this.searchHistoryService.save(e)}async updateFileStats(e){let t=e.map(o=>o.resolveFileStat(this.fileService));await Promise.all(t)}removeFileStats(){for(let e of this.searchResult.matches())e.fileStat=void 0;for(let e of this.searchResult.matches(!0))e.fileStat=void 0}dispose(){this.isDisposed=!0,this.saveState(),super.dispose()}};M$=I([m(1,ge),m(2,ie),m(3,Qt),m(4,Go),m(5,Ne),m(6,ct),m(7,fe),m(8,qn),m(9,F),m(10,ji),m(11,B),m(12,Ae),m(13,kre),m(14,X),m(15,gy),m(16,Uo),m(17,Qo),m(18,Pe),m(19,BHe),m(20,Xe),m(21,Ai),m(22,Le),m(23,de),m(24,Je),m(25,ot),m(26,kn),m(27,re),m(28,br),m(29,_e)],M$);var OV=class extends k{constructor(i,e,t,o){super(),this.element=oL("a.pointer",{tabindex:0},i),this._register(t.setupManagedHover(yi("mouse"),this.element,o)),this.addEventHandlers(e)}addEventHandlers(i){let e=t=>{Kt.stop(t,!1),i(t)};this._register($(this.element,ne.CLICK,e)),this._register($(this.element,ne.KEY_DOWN,t=>{let o=new mi(t);(o.equals(10)||o.equals(3))&&(e(t),o.preventDefault(),o.stopPropagation())}))}};function TVi(a,i){let e=null;if(pl(a)&&(e=a),Bl(a)&&a.count()>0&&(e=a.matches()[a.matches().length-1]),e){let t=e.range();if(i.isReplaceActive()&&i.replaceString){let o=e.replaceString;return{startLineNumber:t.startLineNumber,startColumn:t.startColumn,endLineNumber:t.startLineNumber,endColumn:t.startColumn+o.length}}return t}}function _Vi(a,i){let e=i;if(Lc(e)&&(e.getOriginalEditor().hasTextFocus()?e=e.getOriginalEditor():e=e.getModifiedEditor()),!fn(e)||!e.hasModel())return null;let t=e.getSelection();if(!t)return null;if(t.isEmpty())return a?e.getModel().getWordAtPosition(t.getStartPosition())?.word??null:null;let o="";for(let n=t.startLineNumber;n<=t.endLineNumber;n++){let r=e.getModel().getLineContent(n);n===t.endLineNumber&&(r=r.substring(0,t.endColumn-1)),n===t.startLineNumber&&(r=r.substring(t.startColumn-1)),n!==t.startLineNumber&&(r=`
`+r),o+=r}return o}var Ect=class{constructor(i,e){this.searchView=i;this.configurationService=e}get searchConfig(){return this.configurationService.getValue("search")}createSearchResultIterator(i){let e=[];if(this.searchView.shouldShowAIResults()&&i.searchModel.hasPlainResults&&!i.aiTextSearchResult.hidden&&e.push(i.aiTextSearchResult),!i.plainTextSearchResult.isEmpty()){if(!this.searchView.shouldShowAIResults()||i.aiTextSearchResult.hidden)return this.createTextSearchResultIterator(i.plainTextSearchResult);e.push(i.plainTextSearchResult)}return e}createTextSearchResultIterator(i){let e=i.folderMatches().filter(t=>!t.isEmpty()).sort(TO);return e.length===1?this.createFolderIterator(e[0]):e}createFolderIterator(i){let e=this.searchView.isTreeLayoutViewVisible?i.matches():i.allDownstreamFileMatches(),t=e;return i instanceof Rbe||(t=e.sort((o,n)=>TO(o,n,this.searchConfig.sortOrder))),t}createFileIterator(i){return i.matches().sort(TO)}hasChildren(i){return pl(i)?!1:Pv(i)&&i.isAIContributed?!0:i.hasChildren}getChildren(i){return SO(i)?this.createSearchResultIterator(i):Pv(i)?i.isAIContributed&&(!this.searchView.model.hasAIResults||this.searchView._pendingSemanticSearchPromise)?this.searchView.cachedResults?this.createTextSearchResultIterator(i):(this.searchView.addAIResults(),new Promise(e=>{let t=i.onChange(()=>{t.dispose(),e(this.createTextSearchResultIterator(i))})})):this.createTextSearchResultIterator(i):ru(i)?this.createFolderIterator(i):Bl(i)?this.createFileIterator(i):[]}getParent(i){let e=i.parent();if(SO(e))throw new Error("Invalid element passed to getParent");return e}};Ect=I([m(1,B)],Ect);var Tct=class extends k{constructor(e,t,o){super();this.searchView=e;this.geSearchConfig=t;this.fileService=o;this.queuedIChangeEvents=[];this.refreshTreeThrottler=this._register(new am)}clearAllPending(){this.searchView.getControl().cancelAllRefreshPromises(!0)}async queue(e){return e&&this.queuedIChangeEvents.push(e),this.refreshTreeThrottler.queue(this.refreshTreeUsingQueue.bind(this))}async refreshTreeUsingQueue(){let e=this.queuedIChangeEvents.length===0?void 0:{elements:this.queuedIChangeEvents.map(t=>t.elements).flat(),added:this.queuedIChangeEvents.some(t=>t.added),removed:this.queuedIChangeEvents.some(t=>t.removed),clearingAll:this.queuedIChangeEvents.some(t=>t.clearingAll)};return this.queuedIChangeEvents=[],this.refreshTree(e)}async retrieveFileStats(){let e=this.searchView.model.searchResult.matches().filter(t=>!t.fileStat).map(t=>t.resolveFileStat(this.fileService));await Promise.all(e)}async refreshTree(e){let t=this.geSearchConfig();!e||e.added||e.removed?t.sortOrder==="modified"?await this.retrieveFileStats().then(()=>this.searchView.getControl().updateChildren(void 0)):await this.searchView.getControl().updateChildren(void 0):t.sortOrder==="countAscending"||t.sortOrder==="countDescending"?await this.searchView.getControl().updateChildren(void 0):e.elements.every(n=>this.searchView.getControl().hasNode(n))?await Promise.all(e.elements.map(async n=>{await this.searchView.getControl().updateChildren(n),this.searchView.getControl().rerender(n)})):this.searchView.getControl().updateChildren(void 0)}};Tct=I([m(2,ge)],Tct);var Lbe=class extends k{static{this.ID="workbench.contributions.searchChatContextContribution"}constructor(i,e){super(),this._store.add(e.registerChatContextItem(i.createInstance(_ct))),this._store.add(e.registerChatContextItem(i.createInstance(Rct))),this._store.add(e.registerChatContextItem(this._store.add(i.createInstance(Dct))))}};Lbe=I([m(0,F),m(1,iI)],Lbe);var _ct=class{constructor(i,e,t){this._contextKeyService=i;this._viewsService=e;this._labelService=t;this.type="valuePick";this.label=d(15199,null);this.icon=L.search;this.ordinal=500}isEnabled(i){return!!Ri.HasSearchResults.getValue(this._contextKeyService)&&!!i.attachmentCapabilities.supportsSearchResultAttachments}async asAttachment(){let i=this._viewsService.getViewWithId(ow);return i instanceof M$?i.model.searchResult.matches().map(e=>({kind:"file",id:e.resource.toString(),value:e.resource,name:this._labelService.getUriBasenameLabel(e.resource)})):[]}};_ct=I([m(0,X),m(1,Gt),m(2,nt)],_ct);var Dct=class{constructor(i){this._instantiationService=i;this.type="pickerPick";this.label=d(15201,null);this.icon=L.symbolField;this.ordinal=-200}dispose(){this._provider?.dispose()}isEnabled(i){return!!i.attachmentCapabilities.supportsSymbolAttachments}asPicker(){return{placeholder:d(15200,null),picks:ohe((i,e)=>(this._provider??=this._instantiationService.createInstance(HE),this._provider.getSymbolPicks(i,void 0,e).then(t=>{let o=[];for(let n of t){if(!n.symbol)continue;let r={kind:"symbol",id:JSON.stringify(n.symbol.location),value:n.symbol.location,symbolKind:n.symbol.kind,icon:Zm.toIcon(n.symbol.kind),fullName:n.label,name:n.symbol.name};o.push({label:n.symbol.name,iconClass:q.asClassName(Zm.toIcon(n.symbol.kind)),asAttachment(){return r}})}return o})))}}};Dct=I([m(0,F)],Dct);var Rct=class{constructor(i,e,t,o,n,r,s,l,c){this._searchService=i;this._labelService=e;this._modelService=t;this._languageService=o;this._configurationService=n;this._workspaceService=r;this._fileService=s;this._historyService=l;this._instantiationService=c;this.type="pickerPick";this.label=d(15198,null);this.icon=L.folder;this.ordinal=600}asPicker(){return{placeholder:d(15197,null),picks:ohe(async(i,e)=>{let t=this._workspaceService.getWorkspace().folders.map(r=>r.uri),o=[];if((await tyn(t,this._fileService)).forEach(r=>o.push(this._createPickItem(r,1))),this._historyService.getHistory().filter(r=>r.resource&&this._instantiationService.invokeFunction(s=>Q_e(s,r.resource.scheme))).slice(0,30).forEach(r=>o.push(this._createPickItem(r.resource,0))),i==="")return o;let n=[];return await Promise.all(t.map(async r=>{let{folders:s,files:l}=await DVi(r,i,!0,e,void 0,this._configurationService,this._searchService);for(let c of s)n.push(this._createPickItem(c,1));for(let c of l)n.push(this._createPickItem(c,0))})),n.sort((r,s)=>oc(r.label,s.label)),n})}}_createPickItem(i,e){return{label:Be(i),description:this._labelService.getUriLabel(ai(i),{relative:!0}),iconClasses:Ia(this._modelService,this._languageService,i,e),asAttachment:()=>({kind:e===0?"file":"directory",id:i.toString(),value:i,name:Be(i)})}}};Rct=I([m(0,Gg),m(1,nt),m(2,_t),m(3,Rt),m(4,B),m(5,Ae),m(6,ge),m(7,fa),m(8,F)],Rct);async function DVi(a,i,e,t,o,n,r){let s=e?JIn(i):ZIn(i),l=PH(n.getValue({resource:a}))||{},c={folderQueries:[{folder:a,disregardIgnoreFiles:n.getValue("explorer.excludeGitIgnore")}],type:1,shouldGlobMatchFilePattern:!0,cacheKey:o,excludePattern:l,sortByScore:!0,ignoreGlobCase:!0},u;try{u=await r.fileSearch({...c,filePattern:`{**/${s}/**,**/${s}}`},t)}catch(g){if(!Yi(g))throw g}if(!u||t?.isCancellationRequested)return{files:[],folders:[]};let p=u.results.map(g=>g.resource);return{folders:eyn(p,a,s),files:p}}function JIn(a){return a?"*"+a.split("").join("*")+"*":"*"}function ZIn(a){return a?"*"+a+"*":"*"}function eyn(a,i,e){let t=new xn;for(let n of a){let r=lu(i,n);if(!r)throw new Error("Resource is not a child of the workspace");let s=i,l=r.split("/").slice(0,-1);for(let c of l)s=s.with({path:`${s.path}/${c}`}),t.add(s)}let o=[];for(let n of t){let r=n.path.split("/"),s=r[r.length-1];!s||!qd(e,s,{ignoreCase:!0})||o.push(n)}return o}async function tyn(a,i){let e=[];for(let t of a){let o=i.getProvider(t.scheme);if(!o)continue;let n=await o.readdir(t);for(let[r,s]of n){let l=Ve(t,r);s===2&&e.push(l)}}return e}var LVi=/\/[\p{L}0-9_.:-]*/gu,RVi=/(@|\/)[\p{L}0-9_.:-]*/gu;function XHe(a){let i=a.viewModel?.model.sessionResource;return!!i&&x3(yn(i))}var Lct=class extends k{constructor(e,t,o,n,r,s,l){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatSlashCommandService=o;this.harnessService=n;this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"globalSlashCommands",triggerCharacters:[cp],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=NP(c,u,LVi);if(!f)return null;if(!Nne(c,f)||g.parsedInput.parts.find(w=>w instanceof Qp))return;let S=this.chatSlashCommandService.getCommands(g.location,g.input.currentModeKind);if(!S)return null;let y=yn(g.viewModel.model.sessionResource);return{suggestions:S.filter(w=>!w.silent&&!g.attachmentCapabilities.supportsPromptAttachments||w.when&&!g.scopedContextKeyService.contextMatchesRules(w.when)||!lb(w.sessionTypes,y)?!1:g.lockedAgentId?!(w.modes&&w.modes.length&&!w.modes.includes("agent")):!0).map((w,x)=>{let E=`/${w.command}`;return{label:{label:E,description:w.detail},insertText:w.executeImmediately?"":`${E} `,documentation:w.detail,range:f,sortText:w.sortText??"a".repeat(x+1),kind:18,command:w.executeImmediately?{id:cO.ID,title:E,arguments:[{widget:g,inputValue:`${E} `}]}:void 0}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"globalSlashCommandsAt",triggerCharacters:[pd],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=NP(c,u,/@\w*/g);if(!f)return null;if(!Nne(c,f))return;let v=this.chatSlashCommandService.getCommands(g.location,g.input.currentModeKind);if(!v||g.lockedAgentId)return null;let b=yn(g.viewModel.model.sessionResource);return{suggestions:v.filter(S=>!S.when||g.scopedContextKeyService.contextMatchesRules(S.when)).filter(S=>lb(S.sessionTypes,b)).map((S,y)=>{let w=`${cp}${S.command}`;return{label:{label:w,description:S.detail},insertText:S.executeImmediately?"":`${w} `,documentation:S.detail,range:f,filterText:`${pd}${S.command}`,sortText:S.sortText??"z".repeat(y+1),kind:18,command:S.executeImmediately?{id:cO.ID,title:w,arguments:[{widget:g,inputValue:`${w} `}]}:void 0}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"promptSlashCommands",triggerCharacters:[cp],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=NP(c,u,LVi);if(!f)return null;if(!Nne(c,f)||g.parsedInput.parts.find(x=>x instanceof Qp))return;let S=yn(g.viewModel.model.sessionResource),y=await this.harnessService.getSlashCommands(S,h);if(y.length===0||g.lockedAgentId&&!g.attachmentCapabilities.supportsPromptAttachments)return null;let w=y.filter(x=>x.userInvocable).filter(x=>lb(x.sessionTypes,S));return w.length===0?null:{suggestions:w.map((x,E)=>{let M=`/${x.name}`,N=x.description;return{label:{label:M,description:N},insertText:`${M} `,documentation:x.description,range:f,sortText:"a".repeat(E+1),kind:18}})}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"mcpPromptSlashCommands",triggerCharacters:[cp],provideCompletionItems:async(c,u,p,h)=>{let g=this.chatWidgetService.getWidgetByInputUri(c.uri);if(!g||!g.viewModel)return null;let f=NP(c,u,/\/[\p{L}0-9_.-]*/gu);if(!f)return null;if(Nne(c,f))return g.lockedAgentId?null:{suggestions:l.servers.get().flatMap(v=>v.prompts.get().map(b=>{let S=`/mcp.${b.id}`;return{label:{label:S,description:b.description},command:{id:w3t.ID,title:b.name,arguments:[c,v,b,`${S} `]},insertText:`${S} `,range:f,kind:18}}))}}}))}};Lct=I([m(0,Jt),m(1,Lt),m(2,rN),m(3,dh),m(4,si),m(5,Ms),m(6,Vs)],Lct);oe.as(Zi.Workbench).registerWorkbenchContribution(Lct,4);var Mct=class extends k{constructor(e,t,o,n,r){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatAgentService=o;this.chatAgentNameService=n;this.chatSessionsService=r;let s={_debugDisplayName:"chatAgentSubcommand",triggerCharacters:[cp],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri);if(!h||!h.viewModel||XHe(h))return;let g=NP(l,c,LVi);if(!g)return;let f=this.getCurrentAgentForWidget(h);if(!(!f||f.command))return{suggestions:f.agent.slashCommands.map((v,b)=>{let S=`/${v.name}`;return{label:S,insertText:`${S} `,documentation:v.description,range:g,kind:18}})}}};this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},s)),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentAndSubcommand",triggerCharacters:[pd],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri),g=h?.viewModel;if(!h||!g||XHe(h))return;if(h.lockedAgentId)return null;let f=NP(l,c,RVi);if(!f)return null;if(!Nne(l,f))return;let v=this.chatAgentService.getAgents().filter(E=>E.locations.includes(h.location)),b=this.chatSessionsService.getAllChatSessionContributions(),S=new Set(b.map(E=>E.type)),y=v.filter(E=>!S.has(E.id)),w=(E,M)=>{let N=E.id==="github.copilot.terminalPanel"?"0000":"";return`${pd}${N}${E.name}.${M}`};return{suggestions:v.filter(E=>!E.isDefault).filter(E=>!S.has(E.id)).map(E=>{let{label:M,isDupe:N}=this.getAgentCompletionDetails(E),V=E.description;return{label:N?{label:M,description:E.description,detail:` (${E.publisherDisplayName})`}:M,documentation:V,filterText:`${pd}${E.name}`,insertText:`${M} `,range:f,kind:18,sortText:`${pd}${E.name}`,command:{id:x9.ID,title:x9.ID,arguments:[{agent:E,widget:h}]}}}).concat(ui(y.flatMap(E=>E.slashCommands.map((M,N)=>{if(E.isDefault&&this.chatAgentService.getDefaultAgent(h.location,h.input.currentModeKind)?.id!==E.id)return;let{label:V,isDupe:H}=this.getAgentCompletionDetails(E),K=`${V} ${cp}${M.name}`,j={label:H?{label:K,description:M.description,detail:H?` (${E.publisherDisplayName})`:void 0}:K,documentation:M.description,filterText:w(E,M.name),commitCharacters:[" "],insertText:K+" ",range:f,kind:18,sortText:`x${pd}${E.name}${M.name}`,command:{id:x9.ID,title:x9.ID,arguments:[{agent:E,widget:h}]}};if(E.isDefault){let J=`${cp}${M.name}`;j.label=J,j.insertText=`${J} `,j.documentation=M.description}return j}))))}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatAgentAndSubcommand",triggerCharacters:[cp],provideCompletionItems:async(l,c,u,p)=>{let h=this.chatWidgetService.getWidgetByInputUri(l.uri),g=h?.viewModel;if(!h||!g||XHe(h))return;if(h.lockedAgentId)return null;let f=NP(l,c,RVi);if(!f)return null;if(!Nne(l,f))return;let v=this.chatAgentService.getAgents().filter(b=>b.locations.includes(h.location)&&b.modes.includes(h.input.currentModeKind)).filter(b=>!this.chatSessionsService.getChatSessionContribution(b.id));return{suggestions:ui(v.flatMap(b=>b.slashCommands.map((S,y)=>{if(b.isDefault&&this.chatAgentService.getDefaultAgent(h.location,h.input.currentModeKind)?.id!==b.id)return;let{label:w,isDupe:x}=this.getAgentCompletionDetails(b),E=`${cp}${S.name}`,M=b.id==="github.copilot.terminalPanel"?"z":"",N=`${cp}${M}${b.name}${S.name}`,V={label:{label:E,description:w,detail:x?` (${b.publisherDisplayName})`:void 0},commitCharacters:[" "],insertText:`${w} ${E} `,documentation:`(${w}) ${S.description??""}`,range:f,kind:18,sortText:N,command:{id:x9.ID,title:x9.ID,arguments:[{agent:b,widget:h}]}};if(b.isDefault){let H=`${cp}${S.name}`;V.label=H,V.insertText=`${H} `,V.documentation=S.description}return V})))}}})),this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"installChatExtensions",triggerCharacters:[pd],provideCompletionItems:async(l,c,u,p)=>{if(!l.getLineContent(1).startsWith(pd))return;let h=this.chatWidgetService.getWidgetByInputUri(l.uri);if(h?.location!=="panel"||h.input.currentModeKind!=="ask"||XHe(h))return;if(h.lockedAgentId)return null;let g=NP(l,c,RVi);if(!g||!Nne(l,g))return;let f=d(9162,null);return{suggestions:[{label:f,insertText:"",range:g,kind:18,command:{id:"workbench.extensions.search",title:"",arguments:["@tag:chat-participant"]},filterText:pd+f,sortText:"zzz"}]}}}))}getCurrentAgentForWidget(e){if(e.lockedAgentId){let s=this.chatAgentService.getAgent(e.lockedAgentId);return s&&{agent:s}}let t=e.parsedInput.parts,o=t.findIndex(s=>s instanceof Qp);if(o<0)return;let n=t[o],r=t.find(s=>s instanceof cb||s instanceof iR);if(r)return{agent:n.agent,command:r instanceof cb?r.command.name:void 0};for(let s of t.slice(o+1))if(!(s instanceof Yb)||!s.text.trim().match(/^(\/[\p{L}0-9_.:-]*)?$/u))return;return{agent:n.agent}}getAgentCompletionDetails(e){let t=this.chatAgentNameService.getAgentNameRestriction(e),o=`${pd}${t?e.name:_3(e)}`,n=t&&this.chatAgentService.agentHasDupeName(e.id);return{label:o,isDupe:n}}};Mct=I([m(0,Jt),m(1,Lt),m(2,gr),m(3,P2),m(4,Ms)],Mct);oe.as(Zi.Workbench).registerWorkbenchContribution(Mct,4);var x9=class a extends z{static{this.ID="workbench.action.chat.assignSelectedAgent"}constructor(){super({id:a.ID,title:""})}async run(i,...e){let t=e[0];!t||!t.widget||!t.agent||(t.agent.modes.includes(t.widget.input.currentModeKind)||t.widget.input.setChatMode(t.agent.modes[0]),t.widget.lastSelectedAgent=t.agent)}};W(x9);var w3t=class a extends z{static{this.ID="workbench.action.chat.startParameterizedPrompt"}constructor(){super({id:a.ID,title:""})}async run(i,e,t,o,n){if(!e||!o)return;let r=i.get(F),s=i.get(Ne),l=i.get(Lt),c=i.get(ge),u=await l.revealWidget(!0);if(!u)return;let p=e.getFullModelRange().collapseToEnd(),h=()=>e.findMatches(n,!0,!1,!0,null,!1)[0],g=S=>e.applyEdits([{range:h()?.range||p,text:S}]),f=new O,v=f.add(new qe);f.add(u.input.startGenerating()),f.add(e.onDidChangeContent(()=>{h()&&v.cancel()})),e.changeDecorations(S=>{let y=S.addDecoration(p,{description:"mcp-prompt-spinner",showIfCollapsed:!0,after:{content:" ",inlineClassNameAffectsLetterSpacing:!0,inlineClassName:q.asClassName(q.modify(L.loading,"spin"))+" chat-prompt-spinner"}});f.add(ee(()=>{e.changeDecorations(w=>w.removeDecoration(y))}))});let b=f.add(r.createInstance(NHe,o));try{await t.start();let S=await b.createArgs();if(!S){g("");return}let y;try{y=await o.resolve(S,v.token)}catch(N){v.token.isCancellationRequested||s.error(d(9163,null,String(N))),g("");return}let w=[],x=async(N,V,H,K=!1)=>{let j;if(H)for(let J of[A.parse(H),_C.fromServer(t.definition,H)])try{j||=await c.exists(J)?J:void 0}catch{}if(K)j?w.push({id:ht(),kind:"file",value:j,name:Be(j)}):w.push({id:ht(),kind:"generic",value:V,name:d(9165,null)});else if(N&&R8(N)){let J=await JA(V).catch(()=>Ws(V).buffer);u.attachmentModel.addContext({id:ht(),name:d(9164,null),fullName:d(9164,null),value:J,kind:"image",references:j&&[{reference:j,kind:"reference"}]})}else j&&w.push({id:ht(),kind:"file",value:j,name:Be(j)})},E=y.some(N=>N.role!==y[0].role),M="";for(let N of y)switch(N.content.type){case"text":M&&(M+=`

`),E&&(M+=`--${N.role.toUpperCase()}
`),M+=N.content.text;break;case"resource":"text"in N.content.resource?await x(N.content.resource.mimeType,N.content.resource.text,N.content.resource.uri,!0):await x(N.content.resource.mimeType,N.content.resource.blob,N.content.resource.uri);break;case"image":case"audio":await x(N.content.mimeType,N.content.data);break}w.length&&u.attachmentModel.addContext(...w),g(M)}finally{f.dispose()}}};W(w3t);var Mbe=class{constructor(i,e){this.widget=i;this.variable=e}},FV=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.historyService=e;this.workspaceContextService=t;this.searchService=o;this.labelService=n;this.languageFeaturesService=r;this.chatWidgetService=s;this.outlineService=l;this.editorService=c;this.configurationService=u;this.codeEditorService=p;this.chatAgentService=h;this.instantiationService=g;this.chatSessionsService=f;let v=new RegExp(`[${A6(dp)}${A6(pd)}][^\\s]*`,"g");this.registerVariableCompletions("fileAndFolder",async({widget:S,range:y},w)=>{if(!S.supportsFileReferences)return;let x={suggestions:[]};if(S.lockedAgentId){let E=this.chatAgentService.getAgent(S.lockedAgentId);if(E&&!E.capabilities?.supportsFileAttachments)return x}return await this.addFileAndFolderEntries(S,x,y,w),x},v),this.registerVariableCompletions("selection",({widget:S,range:y},w)=>{if(!S.supportsFileReferences||S.location==="editor")return;let x=this.findActiveCodeEditor();if(!fn(x))return;let E=x.getModel()?.uri,M=x.getSelection();if(!M||!E||M.isEmpty())return;let N=y.varWord?.word?.charAt(0)===pd?pd:dp,V=this.labelService.getUriBasenameLabel(E),H=`${N}file:${V}:${M.startLineNumber}-${M.endLineNumber}`,K=`:${M.startLineNumber}:${M.startColumn}-${M.endLineNumber}:${M.endColumn}`,j=this.labelService.getUriLabel(E,{relative:!0})+K,J={suggestions:[]};return J.suggestions.push({label:{label:`${N}selection`,description:j},filterText:`${N}selection`,insertText:y.varWord?.endColumn===y.replace.endColumn?`${H} `:H,range:y,kind:18,sortText:"z",command:{id:FV.addReferenceCommand,title:"",arguments:[new Mbe(S,{id:"vscode.selection",isFile:!0,range:{startLineNumber:y.replace.startLineNumber,startColumn:y.replace.startColumn,endLineNumber:y.replace.endLineNumber,endColumn:y.replace.startColumn+H.length},data:{range:M,uri:E}})]}}),J}),this.registerVariableCompletions("symbol",({widget:S,range:y,position:w,model:x},E)=>{if(!S.supportsFileReferences)return null;let M={suggestions:[]},N=NP(x,w,new RegExp(`[${A6(dp)}${A6(pd)}][^\\s]*`,"g"),!0);return N&&this.addSymbolEntries(S,M,N,E),M});let b=new RegExp(`${dp}[^\\s]*`,"g");this.registerVariableCompletions("sessionReference",async({widget:S,range:y},w)=>{if(S.location!=="panel")return;let x=y.varWord?.word??"",E=`${dp}session`,M={suggestions:[]};if(x.toLowerCase().startsWith(`${E}:`)){let N=[],V=[zo.Local,zo.Background,zo.Claude];for await(let j of this.chatSessionsService.getChatSessionItems(V,w)){if(w.isCancellationRequested)return;let J=n_(j.chatSessionType);for(let se of j.items)N.push({title:se.label,sessionResource:se.resource,lastMessageDate:se.timing.lastRequestEnded??se.timing.created,icon:se.iconPath??J})}let H=S.viewModel?.sessionResource,K=N.filter(j=>!H||j.sessionResource.toString()!==H.toString()).sort((j,J)=>J.lastMessageDate-j.lastMessageDate);for(let j of K){let J=`${E}:${j.title}`,se=new Date(j.lastMessageDate).toLocaleString();M.suggestions.push({label:{label:j.title,description:se},filterText:`${E}:${j.title}`,insertText:y.varWord?.endColumn===y.replace.endColumn?`${J} `:J,range:y,kind:18,sortText:`z${String(Number.MAX_SAFE_INTEGER-j.lastMessageDate).padStart(20,"0")}`,command:{id:FV.addReferenceCommand,title:"",arguments:[new Mbe(S,{id:j.sessionResource.toString(),icon:j.icon,range:{startLineNumber:y.replace.startLineNumber,startColumn:y.replace.startColumn,endLineNumber:y.replace.endLineNumber,endColumn:y.replace.startColumn+J.length},data:j.sessionResource})]}})}}else M.suggestions.push({label:{label:E,description:d(9166,null)},filterText:E,insertText:`${E}:`,range:y,kind:18,sortText:"z",command:{id:"editor.action.triggerSuggest",title:""}});return M},b),this._register(Ge.registerCommand(FV.addReferenceCommand,(S,y)=>(To(y instanceof Mbe),this.cmdAddReference(y))))}static{this.addReferenceCommand="_addReferenceCmd"}static{this.VariableNameDef=new RegExp(`[${A6(dp)}${A6(pd)}][\\w:-]*`,"g")}findActiveCodeEditor(){let e=this.codeEditorService.getActiveCodeEditor();if(e){let t=e.getModel();if(t?.uri.scheme===Q.vscodeNotebookCell)return;if(t)return e}for(let t of this.editorService.getVisibleTextEditorControls(0)){let o=da(t);if(!o)continue;if(o.getModel())return o}}registerVariableCompletions(e,t,o=FV.VariableNameDef){this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:`chatVarCompletions-${e}`,triggerCharacters:[dp,pd],provideCompletionItems:async(n,r,s,l)=>{let c=this.chatWidgetService.getWidgetByInputUri(n.uri);if(!c||XHe(c))return;let u=NP(n,r,o,!0);if(u)return t({model:n,position:r,widget:c,range:u,context:s},l)}}))}async addFileAndFolderEntries(e,t,o,n){let r=o.varWord?.word?.charAt(0)===pd?pd:dp,s=(p,h,g,f)=>{let v=this.labelService.getUriBasenameLabel(p),b=`${r}file:${v}`,S=this.labelService.getUriLabel(p,{relative:!0}),y=g?d(9161,null,S,g):S,w=f?" ":"!";return{label:{label:v,description:y},filterText:`${v} ${r}${v} ${S}`,insertText:o.varWord?.endColumn===o.replace.endColumn?`${b} `:b,range:o,kind:h===0?20:23,sortText:w,command:{id:FV.addReferenceCommand,title:"",arguments:[new Mbe(e,{id:p.toString(),isFile:h===0,isDirectory:h===1,range:{startLineNumber:o.replace.startLineNumber,startColumn:o.replace.startColumn,endLineNumber:o.replace.endLineNumber,endColumn:o.replace.startColumn+b.length},data:p})]}}},l;o.varWord?.word&&(o.varWord.word.startsWith(dp)||o.varWord.word.startsWith(pd))&&(l=o.varWord.word.toLowerCase().slice(1));let c=new xn,u=t.suggestions.length;for(let[p,h]of this.historyService.getHistory().entries()){let g=qD(h)?h.modified.resource:h.resource;if(!g||c.has(g)||!this.instantiationService.invokeFunction(v=>Q_e(v,g.scheme)))continue;if(l){let v=this.labelService.getUriLabel(g,{relative:!0}).toLowerCase(),S=`${this.labelService.getUriBasenameLabel(g).toLowerCase()} ${v}`;if(!gke(l,0,l.length,S,0,S.length))continue}if(c.add(g),t.suggestions.push(s(g,0,p===0?d(9160,null):void 0,p===0))-u>=5)break}if(l){let p=this.updateCacheKey(),h=this.workspaceContextService.getWorkspace().folders.map(g=>g.uri);for(let g of h){let{folders:f,files:v}=await DVi(g,l,!0,n,p.key,this.configurationService,this.searchService);for(let b of v)c.has(b)||(t.suggestions.push(s(b,0)),c.add(b));for(let b of f)c.has(b)||(t.suggestions.push(s(b,1)),c.add(b))}}t.incomplete=!0}addSymbolEntries(e,t,o,n){let s=new On,l=o.varWord?.word?.charAt(0)===pd?pd:dp,c=(g,f)=>{let v=`${l}sym:${g.name}`,b=g.location.uri,S=this.labelService.getUriLabel(b,{relative:!0}),y=f?"{":"|";return{label:{label:g.name,description:S},filterText:`${l}${g.name}`,insertText:o.varWord?.endColumn===o.replace.endColumn?`${v} `:v,range:o,kind:Zm.toCompletionKind(g.kind),sortText:y,command:{id:FV.addReferenceCommand,title:"",arguments:[new Mbe(e,{id:`vscode.symbol/${JSON.stringify(g.location)}`,fullName:g.name,range:{startLineNumber:o.replace.startLineNumber,startColumn:o.replace.startColumn,endLineNumber:o.replace.endLineNumber,endColumn:o.replace.startColumn+v.length},data:g.location,icon:Zm.toIcon(g.kind)})]}}},u;o.varWord?.word&&(o.varWord.word.startsWith(dp)||o.varWord.word.startsWith(pd))&&(u=o.varWord.word.toLowerCase().slice(1));let p=[];for(let g of this.outlineService.getCachedModels()){let f=g.asListOfDocumentSymbols();for(let v of f)p.push({symbol:v,uri:g.uri})}let h=!1;for(let g of p){if(s.elapsed()>100||n.isCancellationRequested){h=!0;break}t.suggestions.push(c({...g.symbol,location:{uri:g.uri,range:g.symbol.range}},u??""))}t.incomplete=!!u||h}updateCacheKey(){return this.cacheKey&&Date.now()-this.cacheKey.time>6e4&&(this.searchService.clearCache(this.cacheKey.key),this.cacheKey=void 0),this.cacheKey||(this.cacheKey={key:ht(),time:Date.now()}),this.cacheKey.time=Date.now(),this.cacheKey}cmdAddReference(e){e.widget.getContrib(ab.ID)?.addReference(e.variable)}};FV=I([m(0,fa),m(1,Ae),m(2,Gg),m(3,nt),m(4,Jt),m(5,Lt),m(6,kx),m(7,ie),m(8,B),m(9,Qt),m(10,gr),m(11,F),m(12,Ms)],FV);oe.as(Zi.Workbench).registerWorkbenchContribution(FV,4);var Pbe=class extends k{constructor(e,t,o){super();this.languageFeaturesService=e;this.chatWidgetService=t;this.chatAgentService=o;this._register(this.languageFeaturesService.completionProvider.register({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},{_debugDisplayName:"chatVariables",triggerCharacters:[dp,pd],provideCompletionItems:async(n,r,s,l)=>{let c=this.chatWidgetService.getWidgetByInputUri(n.uri);if(!c||XHe(c))return null;if(c.lockedAgentId){let b=this.chatAgentService.getAgent(c.lockedAgentId);if(b&&!b.capabilities?.supportsToolAttachments)return null}let u=NP(n,r,Pbe.VariableNameDef,!0);if(!u)return null;let p=new Set;for(let b of c.parsedInput.parts)b instanceof iw?p.add(b.toolName):b instanceof U0&&p.add(b.name);let h=u.varWord?.word?.charAt(0)===pd?pd:dp,g=u.varWord?.word?u.varWord.word.toLowerCase().slice(1):"",f=[],v=c.input.selectedToolsModel.entriesMap.get();for(let[b,S]of v){if(!S)continue;let y,w,x;if(_h(b))y=b.description,x=b.referenceName;else{let M=b.source;y=d(9167,null,M.label,b.displayName),x=b.toolReferenceName??b.displayName,w=b.userDescription??b.modelDescription}if(p.has(x))continue;if(g){let M=x.toLowerCase();if(!gke(g,0,g.length,M,0,M.length))continue}let E=`${h}${x}`;f.push({label:E,range:u,detail:y,documentation:w,filterText:`${h}${x}`,insertText:E+" ",kind:27})}return{suggestions:f}}}))}static{this.VariableNameDef=new RegExp(`(?<=^|\\s)[${A6(dp)}${A6(pd)}]\\w*`,"g")}};Pbe=I([m(0,Jt),m(1,Lt),m(2,gr)],Pbe);oe.as(Zi.Workbench).registerWorkbenchContribution(Pbe,4);var C3t=class extends k{constructor(e,t){super();this._languageFeaturesService=e;this._chatSessionsService=t}_registerProvider(e,t,o,n){return this._languageFeaturesService.completionProvider.register(e,{_debugDisplayName:t,triggerCharacters:[...o],provideCompletionItems:(r,s,l,c)=>this._provide(r,s,c,o,n)})}async _provide(e,t,o,n,r){if(!CTo(e,t,n))return null;let s=this._resolveContext(e,r);if(!s)return null;let l=e.getValue(),c=e.getOffsetAt(t),u=await this._chatSessionsService.provideChatInputCompletions(s.sessionResource,{text:l,offset:c},o);if(o.isCancellationRequested||!u)return null;let p=[];for(let h of u.items)p.push(this._buildItem(t,h,s.context));return{suggestions:p}}static computeRange(e,t){let o=t.start??e,n=t.end??e,r=new G(o.lineNumber,o.column,n.lineNumber,n.column);return{insert:new G(o.lineNumber,o.column,e.lineNumber,e.column),replace:r}}};var k9=class extends C3t{constructor(e,t,o){super(e,o);this._chatWidgetService=t;this._registrations=this._register(new Ot);this._register(Ge.registerCommand(k9.addReferenceCommand,(n,r)=>{To(r instanceof x3t),r.widget.getContrib(ab.ID)?.addReference({id:r.uri.toString(),range:r.range,isFile:!r.isDirectory,isDirectory:r.isDirectory,fullName:r.displayName,data:r.uri,_meta:r._meta})}));for(let n of this._chatSessionsService.getContentProviderSchemes())this._registerForScheme(n);this._register(this._chatSessionsService.onDidChangeContentProviderSchemes(({added:n,removed:r})=>{for(let s of r)this._registrations.deleteAndDispose(s);for(let s of n)this._registerForScheme(s)}))}static{this.addReferenceCommand="_chatAgentHostAddReferenceCmd"}async _registerForScheme(e){if(!x3(e))return;let t=await this._chatSessionsService.getChatInputCompletionTriggerCharacters(e);!t||t.length===0||this._chatSessionsService.getContentProviderSchemes().includes(e)&&this._registrations.set(e,this._registerProvider({scheme:Q.vscodeChatInput,hasAccessToAllModels:!0},`agentHostChatInputCompletions[${e}]`,t,e))}_resolveContext(e,t){let o=this._chatWidgetService.getWidgetByInputUri(e.uri);if(!o?.viewModel)return;let n=o.viewModel.model.sessionResource;if(yn(n)===t)return{sessionResource:n,context:o}}_buildItem(e,t,o){let n=k9.computeRange(e,t),r=t.attachment;switch(r.kind){case"command":return{label:t.insertText,insertText:t.insertText,filterText:t.insertText,range:n,kind:18,detail:r.description};case"skill":{let s=t.insertText.trimEnd();return{label:r.displayName?{label:s,description:r.displayName}:s,insertText:t.insertText,filterText:t.insertText,range:n,kind:18,detail:r.description}}default:{let s=r.displayName??t.insertText,l=r.uri.path;return{label:{label:s,description:l},insertText:t.insertText,filterText:t.insertText,range:n,kind:r.isDirectory?23:20,command:{id:k9.addReferenceCommand,title:"",arguments:[new x3t(o,r.uri,r.displayName,!!r.isDirectory,n.replace.setEndPosition(n.replace.startLineNumber,n.replace.startColumn+t.insertText.length),r._meta)]}}}}}};k9=I([m(0,Jt),m(1,Lt),m(2,Ms)],k9);var x3t=class{constructor(i,e,t,o,n,r){this.widget=i;this.uri=e;this.displayName=t;this.isDirectory=o;this.range=n;this._meta=r}};oe.as(Zi.Workbench).registerWorkbenchContribution(k9,4);var WV="chat",k3t="chat-session-detail",LMo="chat-session-text",MVi="chat-session-clickable-text",MMo="chat-variable-text";function PVi(a,i){return i?`${a.id}__${i}`:a.id}function iyn(a){return a instanceof Yb&&!a.text.trim().length||a instanceof iR}function E3t(a,i){let e=a.indexOf(i);if(a.length>e+2)return!1;let t=a[e+1];return t&&t instanceof Yb&&t.text===" "}function T3t(a){return{startLineNumber:a.editorRange.startLineNumber,endLineNumber:a.editorRange.endLineNumber,startColumn:a.editorRange.endColumn+1,endColumn:1e3}}var Abe=class extends k{constructor(e,t,o,n,r,s,l){super();this.widget=e;this.codeEditorService=t;this.themeService=o;this.chatAgentService=n;this.labelService=r;this.customizationHarnessService=s;this.editorService=l;this.id="inputEditorDecorations";this.previouslyUsedAgents=new Set;this.viewModelDisposables=this._register(new ue);this.updateThrottle=this._register(new Aa(Abe.UPDATE_DELAY));this.registeredDecorationTypes(),this.triggerInputEditorDecorationsUpdate(),this._register(this.widget.inputEditor.onDidChangeModelContent(()=>this.triggerInputEditorDecorationsUpdate())),this._register(this.widget.onDidChangeParsedInput(()=>this.triggerInputEditorDecorationsUpdate())),this._register(this.widget.onDidChangeViewModel(()=>{this.registerViewModelListeners(),this.previouslyUsedAgents.clear(),this.triggerInputEditorDecorationsUpdate()})),this._register(this.widget.onDidSubmitAgent(c=>{this.previouslyUsedAgents.add(PVi(c.agent,c.slashCommand?.name))})),this._register(this.widget.inputEditor.onMouseDown(c=>{if(this.mouseDownPromptSlashCommand=void 0,!c.event.leftButton||c.target.type!==6||!c.target.position)return;let u=this.clickablePromptSlashCommand;!u||!u.range.containsPosition(c.target.position)||(this.mouseDownPromptSlashCommand={position:ye.lift(c.target.position),uri:u.uri,range:u.range})})),this._register(this.widget.inputEditor.onMouseUp(c=>{let u=this.mouseDownPromptSlashCommand;this.mouseDownPromptSlashCommand=void 0,!(!u||c.target.type!==6||!c.target.position)&&(!u.range.containsPosition(c.target.position)||!ye.equals(u.position,c.target.position)||this.editorService.openEditor({resource:u.uri}))})),this._register(this.chatAgentService.onDidChangeAgents(()=>this.triggerInputEditorDecorationsUpdate())),this._register(this.customizationHarnessService.onDidChangeSlashCommands(c=>{let u=this.widget.viewModel?.sessionResource;u&&c.sessionType===yn(u)&&this.triggerInputEditorDecorationsUpdate()})),this._register(ve(c=>{let u=this.widget.input.currentModeObs.read(c);u&&u.description.read(c),this.triggerInputEditorDecorationsUpdate()})),this.registerViewModelListeners()}static{this.UPDATE_DELAY=200}registerViewModelListeners(){this.viewModelDisposables.value=this.widget.viewModel?.onDidChange(e=>{(e?.kind==="changePlaceholder"||e?.kind==="initialize")&&this.triggerInputEditorDecorationsUpdate()})}registeredDecorationTypes(){this._register(this.codeEditorService.registerDecorationType(WV,k3t,{})),this._register(this.codeEditorService.registerDecorationType(WV,LMo,{color:wp(Goe),backgroundColor:wp(Koe),borderRadius:"3px"})),this._register(this.codeEditorService.registerDecorationType(WV,MVi,{color:wp(Goe),backgroundColor:wp(Koe),borderRadius:"3px",cursor:"pointer"})),this._register(this.codeEditorService.registerDecorationType(WV,MMo,{color:wp(Goe),backgroundColor:wp(Koe),borderRadius:"3px"})),this._register(this.codeEditorService.registerDecorationType(WV,eSi,{color:wp(Goe),backgroundColor:wp(Koe),borderRadius:"3px",rangeBehavior:1}))}getPlaceholderColor(){return this.themeService.getColorTheme().getColor(cX)?.toString()}triggerInputEditorDecorationsUpdate(){this.updateInputPlaceholderDecoration(),this.updateThrottle.trigger(e=>this.updateAsyncInputEditorDecorations(e)).catch(e=>{if(!Yi(e))throw e})}updateInputPlaceholderDecoration(){let e=this.widget.inputEditor.getValue(),t=this.widget.viewModel;if(!t){this.updateAriaPlaceholder(void 0);return}if(!e){let p=this.widget.input.currentModeObs.get(),h=p.argumentHint?.get()??p.description.get()??"",g=t.inputPlaceholder||h,f=[{range:{startLineNumber:1,endLineNumber:1,startColumn:1,endColumn:1e3},renderOptions:{after:{contentText:g,color:this.getPlaceholderColor()}}}];this.updateAriaPlaceholder(g||void 0),this.widget.inputEditor.setDecorationsByType(WV,k3t,f);return}this.updateAriaPlaceholder(void 0);let o=this.widget.parsedInput.parts,n,r=o.find(p=>p instanceof Qp),s=o.find(p=>p instanceof cb);if(r&&o.every(p=>p instanceof Yb&&!p.text.trim().length||p instanceof Qp)){let h=this.previouslyUsedAgents.has(PVi(r.agent,void 0))&&r.agent.metadata.followupPlaceholder;r.agent.description&&E3t(o,r)&&(n=[{range:T3t(r),renderOptions:{after:{contentText:h?r.agent.metadata.followupPlaceholder:r.agent.description,color:this.getPlaceholderColor()}}}])}if(r&&s&&o.every(p=>p instanceof Yb&&!p.text.trim().length||p instanceof Qp||p instanceof cb)){let h=this.previouslyUsedAgents.has(PVi(r.agent,s.command.name))&&s.command.followupPlaceholder;s?.command.description&&E3t(o,s)&&(n=[{range:T3t(s),renderOptions:{after:{contentText:h?s.command.followupPlaceholder:s.command.description,color:this.getPlaceholderColor()}}}])}s&&o.every(p=>p instanceof Yb&&!p.text.trim().length||p instanceof cb)&&s?.command.description&&E3t(o,s)&&(n=[{range:T3t(s),renderOptions:{after:{contentText:s.command.description,color:this.getPlaceholderColor()}}}]),this.widget.inputEditor.setDecorationsByType(WV,k3t,n??[])}async updateAsyncInputEditorDecorations(e){this.clickablePromptSlashCommand=void 0,this.widget.inputEditor.setDecorationsByType(WV,MVi,[]);let t=this.widget.parsedInput.parts,o=this.widget.viewModel;if(!o)return;let n=t.find(v=>v instanceof Qp),r=t.find(v=>v instanceof cb),s=t.find(v=>v instanceof gE),l=t.find(v=>v instanceof iR),c=l?await this.customizationHarnessService.resolvePromptSlashCommand(l.name,yn(o.sessionResource),e):void 0;if(e.isCancellationRequested)return;if(l&&c&&l&&t.every(iyn)&&E3t(t,l)&&c){let b=c.argumentHint??c.description;b&&this.widget.inputEditor.setDecorationsByType(WV,k3t,[{range:T3t(l),renderOptions:{after:{contentText:b,color:this.getPlaceholderColor()}}}])}let u=[];if(n&&u.push({range:n.editorRange}),r&&u.push({range:r.editorRange,hoverMessage:new he(r.command.description)}),s&&u.push({range:s.editorRange,hoverMessage:new he(s.slashCommand.detail)}),l&&c){this.clickablePromptSlashCommand={range:G.lift(l.editorRange),uri:c.uri};let v=new he;c.description&&(v.appendText(c.description),v.appendText(`
`)),v.appendText(d(9168,null,this.labelService.getUriLabel(c.uri,{relative:!0})));let b={range:l.editorRange,hoverMessage:v};this.widget.inputEditor.setDecorationsByType(WV,MVi,[b])}this.widget.inputEditor.setDecorationsByType(WV,LMo,u);let p=[],h=t.filter(v=>v instanceof iw||v instanceof U0);for(let v of h)p.push({range:v.editorRange});let g=t.filter(v=>v instanceof FM);if(!!o.editing)for(let v of g)p.push({range:v.editorRange,hoverMessage:A.isUri(v.data)?new he(this.labelService.getUriLabel(v.data,{relative:!0})):void 0});this.widget.inputEditor.setDecorationsByType(WV,MMo,p)}updateAriaPlaceholder(e){let t=cde.get(this.widget.inputEditor.getId());if(t){let o=t.domNode.domNode;e&&e.trim().length?o.setAttribute("aria-placeholder",e):o.removeAttribute("aria-placeholder")}else{let o=dCt.get(this.widget.inputEditor.getId());if(o){let n=o.textArea.domNode;e&&e.trim().length?n.setAttribute("aria-placeholder",e):n.removeAttribute("aria-placeholder")}}}};Abe=I([m(1,Qt),m(2,Pe),m(3,gr),m(4,nt),m(5,dh),m(6,ie)],Abe);var AVi=class extends k{constructor(e){super();this.widget=e;this.id="InputEditorSlashCommandMode";this._register(this.widget.onDidChangeAgent(t=>{(t.slashCommand&&t.slashCommand.isSticky||!t.slashCommand&&t.agent.metadata.isSticky)&&this.repopulateAgentCommand(t.agent,t.slashCommand)})),this._register(this.widget.onDidSubmitAgent(t=>{this.repopulateAgentCommand(t.agent,t.slashCommand)}))}async repopulateAgentCommand(e,t){if(this.widget.inputEditor.getValue().trim())return;let o;t&&t.isSticky?o=`${pd}${e.name} ${cp}${t.name} `:e.metadata.isSticky&&(o=`${pd}${e.name} `),o&&(this.widget.inputEditor.setValue(o),this.widget.inputEditor.setPosition({lineNumber:1,column:o.length+1}))}};my.CONTRIBS.push(Abe,AVi);var NVi=class extends k{constructor(e){super();this.widget=e;this.id="chatTokenDeleter";let t;this._register(this.widget.inputEditor.onDidChangeModelContent(o=>{let n;if(o.changes.length===1){let r=o.changes[0];r.text.length>0&&r.rangeLength===1?(BYe.test(r.text)||dSi.test(r.text)||uSi.test(r.text))&&(n=new G(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.startColumn+r.text.length)):r.text.length===0&&t&&r.range.endColumn===t.endColumn&&(this.widget.inputEditor.executeEdits(this.id,[{range:t,text:""}]),this.widget.refreshParsedInput())}t=n}))}};my.CONTRIBS.push(NVi);var PMo=_,AMo=st,JHe=class{constructor(i,e,t){this.keybindingService=t;let o=AMo(".chat-editor-hover-wrapper@root",[AMo(".chat-editor-hover-wrapper-content@content")]);if(this.domNode=o.root,o.content.appendChild(i),e&&e.length>0){let n=PMo(".hover-row.status-bar"),r=PMo(".actions");e.forEach(s=>{let l=this.keybindingService.lookupKeybinding(s.commandId),c=l?l.getLabel():null;JX.render(r,{label:s.label,commandId:s.commandId,run:u=>{s.run(u)},iconClass:s.iconClass},c)}),n.appendChild(r),this.domNode.appendChild(n)}}};JHe=I([m(2,Le)],JHe);var Pct=class{constructor(i,e,t,o){this.editor=i;this.instantiationService=e;this.chatWidgetService=t;this.commandService=o;this.hoverOrdinal=1}computeSync(i,e){if(!this.editor.hasModel())return[];let t=this.chatWidgetService.getWidgetByInputUri(this.editor.getModel().uri);if(!t)return[];let{agentPart:o}=kao(t.parsedInput);return o?G.containsPosition(o.editorRange,i.range.getStartPosition())?[new OVi(this,G.lift(o.editorRange),o.agent)]:[]:[]}renderHoverParts(i,e){if(!e.length)return new Yk([]);let t=new O,o=t.add(this.instantiationService.createInstance(Bq));t.add(o.onDidChangeContents(()=>i.onContentsChanged()));let n=e[0],r=n.agent;o.setAgent(r.id);let s=zFe(()=>r,this.commandService).actions,c=this.instantiationService.createInstance(JHe,o.domNode,s).domNode;i.fragment.appendChild(c);let u={hoverPart:n,hoverElement:c,dispose(){t.dispose()}};return new Yk([u])}getAccessibleContent(i){return d(9169,null)}};Pct=I([m(1,F),m(2,Lt),m(3,fe)],Pct);var OVi=class{constructor(i,e,t){this.owner=i;this.range=e;this.agent=t}isValidForHoverAnchor(i){return i.type===1&&this.range.startColumn<=i.range.startColumn&&this.range.endColumn>=i.range.endColumn}};PD.register(Pct);var _3t=d(8621,null),D3t=d(8619,null),Nbe=class extends k{constructor(e,t){super();this._storageKey=e;this._instantiationService=t;this._memoryStore=new Map;this._workspaceStore=new uo(()=>this._register(this._instantiationService.createInstance(ZHe,1,this._storageKey))),this._profileStore=new uo(()=>this._register(this._instantiationService.createInstance(ZHe,0,this._storageKey)))}setAutoConfirmation(e,t,o,n){this._workspaceStore.value.setAutoConfirm(e,void 0),this._profileStore.value.setAutoConfirm(e,void 0),this._memoryStore.delete(e);let r={confirmed:!0,label:o,arguments:n};t==="workspace"?this._workspaceStore.value.setAutoConfirm(e,r):t==="profile"?this._profileStore.value.setAutoConfirm(e,r):t==="session"&&this._memoryStore.set(e,r)}getAutoConfirmation(e){return this._workspaceStore.value.getAutoConfirm(e)?"workspace":this._profileStore.value.getAutoConfirm(e)?"profile":this._memoryStore.has(e)?"session":"never"}getAutoConfirmationIn(e,t){return t==="workspace"?!!this._workspaceStore.value.getAutoConfirm(e):t==="profile"?!!this._profileStore.value.getAutoConfirm(e):this._memoryStore.has(e)}getLabel(e){return this._workspaceStore.value.getAutoConfirm(e)?.label??this._profileStore.value.getAutoConfirm(e)?.label??this._memoryStore.get(e)?.label}getArguments(e){return this._workspaceStore.value.getAutoConfirm(e)?.arguments??this._profileStore.value.getAutoConfirm(e)?.arguments??this._memoryStore.get(e)?.arguments}reset(){this._workspaceStore.value.reset(),this._profileStore.value.reset(),this._memoryStore.clear()}checkAutoConfirmation(e){if(this._workspaceStore.value.getAutoConfirm(e))return{type:3,scope:"workspace"};if(this._profileStore.value.getAutoConfirm(e))return{type:3,scope:"profile"};if(this._memoryStore.has(e))return{type:3,scope:"session"}}getAllConfirmed(){let e=new Set;for(let t of this._workspaceStore.value.getAll())e.add(t);for(let t of this._profileStore.value.getAll())e.add(t);for(let t of this._memoryStore.keys())e.add(t);return e}},ZHe=class extends k{constructor(e,t,o){super();this._scope=e;this._storageKey=t;this.storageService=o;this._autoConfirmTools=new Ua(100);this._didChange=!1;let n=o.get(this._storageKey,this._scope);if(n)try{let r=JSON.parse(n);if(Array.isArray(r))for(let s of r)this._autoConfirmTools.set(s,{confirmed:!0});else if(typeof r=="object"&&r!==null)for(let[s,l]of Object.entries(r))if(typeof l=="object"&&l!==null){let c=l;this._autoConfirmTools.set(s,{confirmed:!0,label:c.label,arguments:c.arguments})}else this._autoConfirmTools.set(s,{confirmed:!0,label:typeof l=="string"?l:void 0})}catch{}this._register(o.onWillSaveState(()=>{if(this._didChange){let r={};for(let[s,l]of this._autoConfirmTools)l.arguments?r[s]={label:l.label,arguments:l.arguments}:r[s]=l.label??!0;this.storageService.store(this._storageKey,JSON.stringify(r),this._scope,1),this._didChange=!1}}))}reset(){this._autoConfirmTools.clear(),this._didChange=!0}getAutoConfirm(e){let t=this._autoConfirmTools.get(e);if(t)return this._didChange=!0,t}setAutoConfirm(e,t){t?this._autoConfirmTools.set(e,t):this._autoConfirmTools.delete(e),this._didChange=!0}getAll(){return[...this._autoConfirmTools.keys()]}};ZHe=I([m(2,de)],ZHe);var eUe=class extends k{constructor(e,t,o){super();this._instantiationService=e;this._quickInputService=t;this._dialogService=o;this._contributions=new Map;this._preExecutionToolConfirmStore=this._register(new Nbe("chat/autoconfirm",this._instantiationService)),this._postExecutionToolConfirmStore=this._register(new Nbe("chat/autoconfirm-post",this._instantiationService)),this._preExecutionServerConfirmStore=this._register(new Nbe("chat/servers/autoconfirm",this._instantiationService)),this._postExecutionServerConfirmStore=this._register(new Nbe("chat/servers/autoconfirm-post",this._instantiationService)),this._combinationConfirmStore=this._register(new Nbe("chat/autoconfirm-combination",this._instantiationService))}getPreConfirmAction(e){let t=this._contributions.get(e.toolId);if(t?.getPreConfirmAction){let n=t.getPreConfirmAction(e);if(n)return n}if(t&&t.canUseDefaultApprovals===!1)return;if(e.combination){let n=this._combinationConfirmStore.checkAutoConfirmation(e.combination.key);if(n)return n}let o=this._preExecutionToolConfirmStore.checkAutoConfirmation(e.toolId);if(o)return o;if(e.source.type==="mcp"){let n=this._preExecutionServerConfirmStore.checkAutoConfirmation(e.source.definitionId);if(n)return n}}getPostConfirmAction(e){let t=this._contributions.get(e.toolId);if(t?.getPostConfirmAction){let n=t.getPostConfirmAction(e);if(n)return n}if(t&&t.canUseDefaultApprovals===!1)return;let o=this._postExecutionToolConfirmStore.checkAutoConfirmation(e.toolId);if(o)return o;if(e.source.type==="mcp"){let n=this._postExecutionServerConfirmStore.checkAutoConfirmation(e.source.definitionId);if(n)return n}}getPreConfirmActions(e){let t=[],o=this._contributions.get(e.toolId);if(o?.getPreConfirmActions&&t.push(...o.getPreConfirmActions(e)),o&&o.canUseDefaultApprovals===!1)return t;if(e.combination){let{label:n,key:r,arguments:s}=e.combination;t.push({label:d(8586,null,n),detail:d(8587,null),divider:!!t.length,scope:"session",select:async()=>(this._combinationConfirmStore.setAutoConfirmation(r,"session",n,s),!0)},{label:d(8588,null,n),detail:d(8589,null),scope:"workspace",select:async()=>(this._combinationConfirmStore.setAutoConfirmation(r,"workspace",n,s),!0)},{label:d(8584,null,n),detail:d(8585,null),scope:"profile",select:async()=>(this._combinationConfirmStore.setAutoConfirmation(r,"profile",n,s),!0)})}if(t.push({label:d(8606,null),detail:d(8609,null),divider:!!t.length,scope:"session",select:async()=>(this._preExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"session"),!0)},{label:d(8610,null),detail:d(8613,null),scope:"workspace",select:async()=>(this._preExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"workspace"),!0)},{label:d(8590,null),detail:d(8593,null),scope:"profile",select:async()=>(this._preExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"profile"),!0)}),e.source.type==="mcp"){let{serverLabel:n,definitionId:r}=e.source;t.push({label:d(8598,null,n),detail:d(8601,null),divider:!0,scope:"session",select:async()=>(this._preExecutionServerConfirmStore.setAutoConfirmation(r,"session"),!0)},{label:d(8602,null,n),detail:d(8605,null),scope:"workspace",select:async()=>(this._preExecutionServerConfirmStore.setAutoConfirmation(r,"workspace"),!0)},{label:d(8594,null,n),detail:d(8597,null),scope:"profile",select:async()=>(this._preExecutionServerConfirmStore.setAutoConfirmation(r,"profile"),!0)})}return t}getPostConfirmActions(e){let t=[],o=this._contributions.get(e.toolId);if(o?.getPostConfirmActions&&t.push(...o.getPostConfirmActions(e)),o&&o.canUseDefaultApprovals===!1)return t;if(t.push({label:d(8607,null),detail:d(8608,null),divider:!!t.length,scope:"session",select:async()=>(this._postExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"session"),!0)},{label:d(8611,null),detail:d(8612,null),scope:"workspace",select:async()=>(this._postExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"workspace"),!0)},{label:d(8591,null),detail:d(8592,null),scope:"profile",select:async()=>(this._postExecutionToolConfirmStore.setAutoConfirmation(e.toolId,"profile"),!0)}),e.source.type==="mcp"){let{serverLabel:n,definitionId:r}=e.source;t.push({label:d(8599,null,n),detail:d(8600,null),divider:!0,scope:"session",select:async()=>(this._postExecutionServerConfirmStore.setAutoConfirmation(r,"session"),!0)},{label:d(8603,null,n),detail:d(8604,null),scope:"workspace",select:async()=>(this._postExecutionServerConfirmStore.setAutoConfirmation(r,"workspace"),!0)},{label:d(8595,null,n),detail:d(8596,null),scope:"profile",select:async()=>(this._postExecutionServerConfirmStore.setAutoConfirmation(r,"profile"),!0)})}return t}registerConfirmationContribution(e,t){return this._contributions.set(e,t),{dispose:()=>{this._contributions.delete(e)}}}toolCanManageConfirmation(e){return!!e.canRequestPreApproval||!!e.canRequestPostApproval||this._contributions.has(e.id)||!!this._preExecutionToolConfirmStore.checkAutoConfirmation(e.id)||!!this._postExecutionToolConfirmStore.checkAutoConfirmation(e.id)||this._hasCombinationApprovalsForTool(e.id)}_hasCombinationApprovalsForTool(e){let t=e+":combination:";for(let o of this._combinationConfirmStore.getAllConfirmed())if(o.startsWith(t))return!0;return!1}_getCombinationApprovalsForTool(e,t){let o=e+":combination:",n=[];for(let r of this._combinationConfirmStore.getAllConfirmed())if(r.startsWith(o)&&this._combinationConfirmStore.getAutoConfirmationIn(r,t)){let s=this._combinationConfirmStore.getLabel(r)??r,l=this._combinationConfirmStore.getArguments(r);n.push({key:r,label:s,arguments:l})}return n}manageConfirmationPreferences(e,t){let o={iconClass:q.asClassName(L.info),tooltip:d(8622,null)},n=(f,v,b,S)=>{S.has(f)||S.set(f,{label:v,tools:new Set}),S.get(f).tools.add(b)},r=(f,v,b)=>{f.type==="mcp"?n(f.definitionId,f.serverLabel||f.label,v,b):f.type==="extension"&&n(f.extensionId.value,f.label,v,b)},s=new Set,l=new Map;for(let f of e)(f.canRequestPreApproval||f.canRequestPostApproval||this._contributions.has(f.id))&&(s.add(f.id),r(f.source,f.id,l));for(let f of this._preExecutionToolConfirmStore.getAllConfirmed())if(!s.has(f)){let v=e.find(b=>b.id===f);v&&(s.add(f),r(v.source,f,l))}for(let f of this._postExecutionToolConfirmStore.getAllConfirmed())if(!s.has(f)){let v=e.find(b=>b.id===f);v&&(s.add(f),r(v.source,f,l))}for(let f of e)!s.has(f.id)&&this._hasCombinationApprovalsForTool(f.id)&&(s.add(f.id),r(f.source,f.id,l));if(s.size===0)return;let c=t?.defaultScope??"workspace",u=()=>{let f=[];for(let[b,S]of l){let y=[],w=Array.from(S.tools).some(j=>e.find(se=>se.id===j)?.canRequestPreApproval),x=Array.from(S.tools).some(j=>e.find(se=>se.id===j)?.canRequestPostApproval),E=this._preExecutionServerConfirmStore.getAutoConfirmationIn(b,c),M=this._postExecutionServerConfirmStore.getAutoConfirmationIn(b,c);for(let j of S.tools){let J=e.find(Te=>Te.id===j);if(!J)continue;let se=[],ae=!E&&(J.canRequestPreApproval||this._preExecutionToolConfirmStore.getAutoConfirmationIn(J.id,c)),ce=!M&&(J.canRequestPostApproval||this._postExecutionToolConfirmStore.getAutoConfirmationIn(J.id,c));ae&&ce&&(se.push({type:"tool-pre",toolId:J.id,label:_3t,checked:this._preExecutionToolConfirmStore.getAutoConfirmationIn(J.id,c)}),se.push({type:"tool-post",toolId:J.id,label:D3t,checked:this._postExecutionToolConfirmStore.getAutoConfirmationIn(J.id,c)}));let Se=this._getCombinationApprovalsForTool(J.id,c);for(let{key:Te,label:It,arguments:tt}of Se)se.push({type:"combination",toolId:J.id,combinationKey:Te,combinationArgs:tt,label:It,checked:!0,buttons:tt?[o]:void 0});let Re=this._preExecutionToolConfirmStore.getAutoConfirmationIn(J.id,c),xe=this._postExecutionToolConfirmStore.getAutoConfirmationIn(J.id,c),He,Ee;if(ae&&ce)He=Re&&xe?!0:!Re&&!xe?!1:"mixed";else if(ae)He=Re,Ee=_3t;else if(ce)He=xe,Ee=D3t;else if(se.length>0)He=!1;else continue;He===!1&&se.length===0&&!J.canRequestPreApproval&&!J.canRequestPostApproval||y.push({type:"tool",toolId:J.id,label:J.displayName||J.id,description:Ee,checked:He,collapsed:!0,children:se.length>0?se:void 0})}y.sort((j,J)=>j.label.localeCompare(J.label)),x&&y.unshift({type:"server-post",serverId:b,iconClass:q.asClassName(L.play),label:d(8618,null),checked:M}),w&&y.unshift({type:"server-pre",serverId:b,iconClass:q.asClassName(L.play),label:d(8620,null),checked:E});let N=this._preExecutionServerConfirmStore.getAutoConfirmationIn(b,c),V=this._postExecutionServerConfirmStore.getAutoConfirmationIn(b,c),H;w&&x?H=N&&V?!0:!N&&!V?!1:"mixed":w?H=N:x?H=V:H=!1;let K=h.itemTree.find(j=>j.serverId===b);f.push({type:"server",serverId:b,label:S.label,checked:H,children:y,collapsed:K?h.isCollapsed(K):!0,pickable:!1})}let v=e.slice().sort((b,S)=>b.displayName.localeCompare(S.displayName));for(let b of v){if(!s.has(b.id)||b.source.type==="mcp"||b.source.type==="extension")continue;let S=this._contributions.get(b.id),y=[],w=S?.getManageActions?.();w&&y.push(...w.map(N=>({type:"manage",...N})));let x=!1,E,M=!1;if(S?.canUseDefaultApprovals!==!1){M=!0;let N=b.canRequestPreApproval||this._preExecutionToolConfirmStore.getAutoConfirmationIn(b.id,c),V=b.canRequestPostApproval||this._postExecutionToolConfirmStore.getAutoConfirmationIn(b.id,c);N&&V&&(y.push({type:"tool-pre",toolId:b.id,label:_3t,checked:this._preExecutionToolConfirmStore.getAutoConfirmationIn(b.id,c)}),y.push({type:"tool-post",toolId:b.id,label:D3t,checked:this._postExecutionToolConfirmStore.getAutoConfirmationIn(b.id,c)}));let H=this._getCombinationApprovalsForTool(b.id,c);for(let{key:J,label:se,arguments:ae}of H)y.push({type:"combination",toolId:b.id,combinationKey:J,combinationArgs:ae,label:se,checked:!0,buttons:ae?[o]:void 0});let K=this._preExecutionToolConfirmStore.getAutoConfirmationIn(b.id,c),j=this._postExecutionToolConfirmStore.getAutoConfirmationIn(b.id,c);N&&V?x=K&&j?!0:!K&&!j?!1:"mixed":N?(x=K,E=_3t):V?(x=j,E=D3t):x=!1}x===!1&&y.length===0&&!b.canRequestPreApproval&&!b.canRequestPostApproval&&!this._contributions.has(b.id)||f.push({type:"tool",toolId:b.id,label:b.displayName||b.id,description:E,checked:x,pickable:M,collapsed:e.length>1,children:y.length>0?y:void 0})}return f},p=new O,h=p.add(this._quickInputService.createQuickTree());if(h.ignoreFocusOut=!0,h.sortByLabel=!1,c!=="session"){let f={iconClass:q.asClassName(L.folder),tooltip:d(8623,null),toggle:{checked:c==="workspace"},location:3};h.buttons=[f],p.add(h.onDidTriggerButton(v=>{v===f&&(c=c==="workspace"?"profile":"workspace",g(),h.setItemTree(u()))}))}let g=()=>{c==="session"?h.placeholder=d(8616,null):h.placeholder=c==="workspace"?d(8617,null):d(8615,null)};if(g(),h.setItemTree(u()),p.add(h.onDidChangeCheckboxState(f=>{let v=f.checked?c:"never";if(f.type==="server"&&f.serverId)l.get(f.serverId)&&(this._preExecutionServerConfirmStore.setAutoConfirmation(f.serverId,v),this._postExecutionServerConfirmStore.setAutoConfirmation(f.serverId,v));else if(f.type==="tool"&&f.toolId){let b=e.find(S=>S.id===f.toolId);if((b?.canRequestPostApproval||v==="never")&&this._postExecutionToolConfirmStore.setAutoConfirmation(f.toolId,v),(b?.canRequestPreApproval||v==="never")&&this._preExecutionToolConfirmStore.setAutoConfirmation(f.toolId,v),v==="never")for(let S of this._combinationConfirmStore.getAllConfirmed())S.startsWith(f.toolId+":combination:")&&this._combinationConfirmStore.setAutoConfirmation(S,"never");h.setItemTree(u())}else f.type==="tool-pre"&&f.toolId?this._preExecutionToolConfirmStore.setAutoConfirmation(f.toolId,v):f.type==="tool-post"&&f.toolId?this._postExecutionToolConfirmStore.setAutoConfirmation(f.toolId,v):f.type==="server-pre"&&f.serverId?(this._preExecutionServerConfirmStore.setAutoConfirmation(f.serverId,v),h.setItemTree(u())):f.type==="server-post"&&f.serverId?(this._postExecutionServerConfirmStore.setAutoConfirmation(f.serverId,v),h.setItemTree(u())):f.type==="manage"?f.onDidChangeChecked?.(!!f.checked):f.type==="combination"&&f.combinationKey&&(this._combinationConfirmStore.setAutoConfirmation(f.combinationKey,v,f.label,f.combinationArgs),h.setItemTree(u()))})),p.add(h.onDidTriggerItemButton(f=>{f.item.type==="manage"?f.item.onDidTriggerItemButton?.(f.button):f.item.type==="combination"&&f.button===o&&f.item.combinationArgs&&this._dialogService.prompt({message:d(8614,null),buttons:[],custom:{markdownDetails:[{markdown:new he().appendCodeblock("json",f.item.combinationArgs)}]}})})),p.add(h.onDidAccept(async()=>{let f=h.activeItems.find(v=>v.type==="manage");f?(h.hide(),await f.onDidOpen?.(),this.manageConfirmationPreferences(e,t)):h.hide()})),p.add(h.onDidHide(()=>{p.dispose()})),h.show(),t?.focusToolId){let f=t.focusToolId;for(let v of h.itemTree){let b=v;if(b.children){let S=b.children.find(y=>y.type==="tool"&&y.toolId===f);if(S){h.expand(v),h.reveal(S);break}}}}}resetToolAutoConfirmation(){this._preExecutionToolConfirmStore.reset(),this._postExecutionToolConfirmStore.reset(),this._preExecutionServerConfirmStore.reset(),this._postExecutionServerConfirmStore.reset(),this._combinationConfirmStore.reset();for(let e of this._contributions.values())e.reset?.()}};eUe=I([m(0,F),m(1,$e),m(2,ct)],eUe);var tUe=le("IToolResultCompressor");function FVi(a){let i=a.trim();if(!i)return!1;let e=i[0],t=i[i.length-1];if(e==="{"&&t==="}"||e==="["&&t==="]")try{return JSON.parse(i),!0}catch{}return!!(/^---\s*\n/.test(i)||/^\[[A-Za-z_][A-Za-z0-9_.-]*\]\s*\n/.test(i))}var WVi=1024;function NMo(a,i,e){return`[Output compressed by ${a.length>0?a.join(", "):"unknown"} (${i} \u2192 ${e} chars). To disable, set chat.tools.compressOutput.enabled to false.]`}var OMo=oe.as(Ta.JSONContribution);var oyn="vscode.chat.tools.global.autoApprove.testMode",Act=new Set(["vscode_get_confirmation_with_options","vscode_get_modified_files_confirmation"]),VVi=P(8627,`Global auto approve also known as "YOLO mode" disables manual approval completely for _all tools in all workspaces_, allowing the agent to act fully autonomously. This is extremely dangerous and is *never* recommended, even containerized environments like [Codespaces](https://github.com/features/codespaces) and [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) have user keys forwarded into the container that could be compromised.

**This feature disables [critical security protections](https://code.visualstudio.com/docs/copilot/security) and makes it much easier for an attacker to compromise the machine.**

Note: This setting only controls tool approval and does not prevent the agent from asking questions. To automatically answer agent questions, use the [\`chat.autoReply\`](command:workbench.action.openSettings?%5B%22chat.autoReply%22%5D) setting.`),RO=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._instantiationService=e;this._extensionService=t;this._contextKeyService=o;this._chatService=n;this._dialogService=r;this._telemetryService=s;this._logService=l;this._configurationService=c;this._accessibilityService=u;this._accessibilitySignalService=p;this._storageService=h;this._confirmationService=g;this._commandService=f;this._chatWidgetService=v;this._toolResultCompressor=b;this._onDidChangeTools=this._register(new T);this.onDidChangeTools=this._onDidChangeTools.event;this._onDidPrepareToolCallBecomeUnresponsive=this._register(new T);this.onDidPrepareToolCallBecomeUnresponsive=this._onDidPrepareToolCallBecomeUnresponsive.event;this._onDidInvokeTool=this._register(new T);this.onDidInvokeTool=this._onDidInvokeTool.event;this._onDidChangeToolsScheduler=this._register(new Dt(()=>this._onDidChangeTools.fire(),750));this._tools=new Map;this._toolContextKeys=new Set;this._callsByRequestId=new Map;this._pendingToolCalls=new Map;this._toolSets=new SY;this.toolSets=ke(this,e=>Array.from(this._toolSets.observable.read(e)).filter(o=>this.isPermitted(o,e)));this.allToolsIncludingDisableObs=Mb({equalsFn:rF()},this.onDidChangeTools,()=>Array.from(this.getAllToolsIncludingDisabled()));this.toolsWithFullReferenceName=ke(e=>{let t=[],o=new Set;for(let n of this.toolSets.read(e))if(n.source.type!=="user"){t.push([n,FMo(n)]);for(let r of n.getTools())t.push([r,Dre(r,n)]),o.add(r)}for(let n of this.allToolsIncludingDisableObs.read(e))n.when&&!this._contextKeyService.contextMatchesRules(n.when)||n.canBeReferencedInPrompt&&!o.has(n)&&this.isPermitted(n,e)&&t.push([n,Dre(n)]);return t});this._isAgentModeEnabled=hr("chat.agent.enabled",!0,this._configurationService),this._register(this._contextKeyService.onDidChangeContext(S=>{S.affectsSome(this._toolContextKeys)&&this._onDidChangeToolsScheduler.schedule()})),this._register(this._configurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration("chat.extensionTools.enabled")||S.affectsConfiguration("chat.agent.enabled")||S.affectsConfiguration("github.copilot.chat.gpt55ReadFileTool.enabled"))&&this._onDidChangeToolsScheduler.schedule()})),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,S=>{(!S||S.affectsConfiguration("chat.tools.global.autoApprove"))&&this._configurationService.getValue("chat.tools.global.autoApprove")!==!0&&this._storageService.remove("chat.tools.global.autoApprove.optIn",-1)})),this._ctxToolsCount=Z.Tools.toolsCount.bindTo(o),this.vscodeToolSet=this._register(this.createToolSet(wn.Internal,"vscode",D3.vscode,{icon:q.fromId(L.vscode.id),description:d(8631,null)})),this.executeToolSet=this._register(this.createToolSet(wn.Internal,"execute",Am.execute,{icon:q.fromId(L.terminal.id),description:d(8629,null)})),this.readToolSet=this._register(this.createToolSet(wn.Internal,"read",Am.read,{icon:q.fromId(L.book.id),description:d(8630,null)})),this.agentToolSet=this._register(this.createToolSet(wn.Internal,"agent",Am.agent,{icon:q.fromId(L.agent.id),description:d(8628,null)}))}isToolEnabledForModel(e,t){return!(!cSi(e,t)||e.id==="copilot_readFile"&&t?.family.startsWith("gpt-5.5")&&this._configurationService.getValue("github.copilot.chat.gpt55ReadFileTool.enabled")===!1)}isPermitted(e,t){if(this._isAgentModeEnabled.read(t)!==!1||!_h(e)&&e.canBeReferencedInPrompt===!1&&e.source.type==="internal")return!0;let n=[Am.read,Am.search,Am.web];if(_h(e)){let r=e.source.type==="internal"&&n.includes(e.referenceName);return this._logService.trace(`LanguageModelToolsService#isPermitted: ToolSet ${e.id} (${e.referenceName}) permitted=${r}`),r}for(let r of this._toolSets)if(r.source.type==="internal"&&n.includes(r.referenceName)){for(let s of r.getTools())if(s.id===e.id)return this._logService.trace(`LanguageModelToolsService#isPermitted: Tool ${e.id} (${e.toolReferenceName}) permitted=true (member of ${r.referenceName})`),!0}return e.id==="vscode_fetchWebPage_internal"&&n.includes(Am.web)?(this._logService.trace(`LanguageModelToolsService#isPermitted: Tool ${e.id} (${e.toolReferenceName}) permitted=true (special case)`),!0):(this._logService.trace(`LanguageModelToolsService#isPermitted: Tool ${e.id} (${e.toolReferenceName}) permitted=false`),!1)}dispose(){super.dispose(),this._callsByRequestId.forEach(e=>e.forEach(t=>t.store.dispose())),this._pendingToolCalls.clear(),this._ctxToolsCount.reset()}registerToolData(e){if(this._tools.has(e.id))throw new Error(`Tool "${e.id}" is already registered.`);this._tools.set(e.id,{data:e}),this._ctxToolsCount.set(this._tools.size),this._onDidChangeToolsScheduler.isScheduled()||this._onDidChangeToolsScheduler.schedule(),e.when?.keys().forEach(o=>this._toolContextKeys.add(o));let t;if(e.inputSchema){t=new O;let o=VYe(e.id).toString();OMo.registerSchema(o,e.inputSchema,t),t.add(OMo.registerSchemaAssociation(o,`/lm/tool/${e.id}/tool_input.json`))}return ee(()=>{t?.dispose(),this._tools.delete(e.id),this._ctxToolsCount.set(this._tools.size),this._refreshAllToolContextKeys(),this._onDidChangeToolsScheduler.isScheduled()||this._onDidChangeToolsScheduler.schedule()})}flushToolUpdates(){this._onDidChangeToolsScheduler.flush()}_refreshAllToolContextKeys(){this._toolContextKeys.clear();for(let e of this._tools.values())e.data.when?.keys().forEach(t=>this._toolContextKeys.add(t))}registerToolImplementation(e,t){let o=this._tools.get(e);if(!o)throw new Error(`Tool "${e}" was not contributed.`);if(o.impl)throw new Error(`Tool "${e}" already has an implementation.`);return o.impl=t,ee(()=>{o.impl=void 0})}registerTool(e,t){return Fn(this.registerToolData(e),this.registerToolImplementation(e.id,t))}getTools(e){let t=yt.map(this._tools.values(),n=>n.data),o=this._configurationService.getValue("chat.extensionTools.enabled");return yt.filter(t,n=>{let r=!n.when||this._contextKeyService.contextMatchesRules(n.when),s=n.source.type!=="extension"||!!o,l=this.isPermitted(n),c=this.isToolEnabledForModel(n,e);return r&&s&&l&&c})}observeTools(e){let t=ke(o=>{let n=zc("observeToolsContext"),r=()=>Ki(s=>n.trigger(s));return o.store.add(this.onDidChangeTools(r)),n});return Js({equalsFn:rF()},o=>(t.read(o).read(o),Array.from(this.getTools(e))))}getAllToolsIncludingDisabled(){let e=yt.map(this._tools.values(),o=>o.data),t=this._configurationService.getValue("chat.extensionTools.enabled");return yt.filter(e,o=>{let n=o.source.type!=="extension"||!!t,r=this.isPermitted(o);return n&&r})}getTool(e){return this._tools.get(e)?.data}getToolByName(e){for(let t of this.getAllToolsIncludingDisabled())if(t.toolReferenceName===e)return t}_handlePreToolUseDenial(e,t,o,n,r){let s=t.permissionDecisionReason??d(8637,null),l=d(8635,null,"PreToolUse",s);if(this._logService.debug(`[LanguageModelToolsService#invokeTool] Tool ${e.toolId} denied by preToolUse hook: ${s}`),o){if(n)n.presentation="hidden",n.cancelFromStreaming(0,l);else if(r){let c=ZM.createCancelled({toolCallId:e.callId,toolId:e.toolId,toolData:o,subagentInvocationId:e.subAgentInvocationId,chatRequestId:e.chatRequestId},e.parameters,0,l);c.presentation="hidden",this._chatService.appendProgress(r,c)}}return{content:[{kind:"text",value:`Tool execution denied: ${s}`}],toolResultError:s}}async _validateUpdatedInput(e,t,o){if(t?.inputSchema)try{let n=VYe(e),r=JSON.stringify(o),s=await this._commandService.executeCommand("json.validate",n,r)||[];if(s.length>0)return s.map(l=>l.message).join("; ")}catch(n){this._logService.debug(`[LanguageModelToolsService#_validateUpdatedInput] json.validate command failed, skipping validation: ${Mn(n)}`)}}async invokeTool(e,t,o){this._logService.trace(`[LanguageModelToolsService#invokeTool] Invoking tool ${e.toolId} with parameters ${JSON.stringify(e.parameters)}`);let n=this._tools.get(e.toolId)?.data,r,s;if(e.context?.sessionResource){if(r=this._chatService.getSession(e.context.sessionResource),s=r?.getRequests().at(-1),s?.response?.isCanceled||s?.response?.isComplete)throw this._logService.debug(`[LanguageModelToolsService#invokeTool] Ignoring tool ${e.toolId} for cancelled/complete request ${s.id}`),new qi;r?.workingDirectory&&!e.context.workingDirectory&&(e={...e,context:{...e.context,workingDirectory:r.workingDirectory}})}let l,c;this._pendingToolCalls.has(e.callId)?(l=e.callId,c=this._pendingToolCalls.get(e.callId)):e.chatStreamToolCallId&&this._pendingToolCalls.has(e.chatStreamToolCallId)&&(l=e.chatStreamToolCallId,c=this._pendingToolCalls.get(e.chatStreamToolCallId));let u,p;if(e.context&&s){u=s.id,p=new O,this._callsByRequestId.has(u)||this._callsByRequestId.set(u,[]);let w={store:p};this._callsByRequestId.get(u).push(w);let x=new qe;p.add(ee(()=>{x.dispose(!0)})),p.add(o.onCancellationRequested((()=>{pi.confirmWith(c,{type:0}),x.cancel()}))),p.add(x.token.onCancellationRequested(()=>{pi.confirmWith(c,{type:0})})),o=x.token}let h=e.preToolUseResult;if(h?.permissionDecision==="deny"){let w=this._handlePreToolUseDenial(e,h,n,c,s);return l&&this._pendingToolCalls.delete(l),w}if(h?.updatedInput){let w=await this._validateUpdatedInput(e.toolId,n,h.updatedInput);w?this._logService.warn(`[LanguageModelToolsService#invokeTool] Tool ${e.toolId} updatedInput from preToolUse hook failed schema validation: ${w}`):(this._logService.debug(`[LanguageModelToolsService#invokeTool] Tool ${e.toolId} input modified by preToolUse hook`),e.parameters=h.updatedInput)}this._onDidInvokeTool.fire({toolId:e.toolId,sessionResource:e.context?.sessionResource,requestId:e.chatRequestId,subagentInvocationId:e.subAgentInvocationId});let g=this._tools.get(e.toolId);if(!g)throw new Error(`Tool ${e.toolId} was not contributed`);if(!g.impl&&(await this._extensionService.activateByEvent(`onLanguageModelTool:${e.toolId}`),g=this._tools.get(e.toolId),!g?.impl))throw new Error(`Tool ${e.toolId} does not have an implementation registered.`);let f=!!c;f&&l&&this._pendingToolCalls.delete(l);let v,b,S,y;try{if(e.context){if(!r)throw new Error("Tool called for unknown chat session");if(!s)throw new Error("Tool called for unknown chat request");e.modelId=s.modelId,e.userSelectedTools=s.userSelectedTools&&{...s.userSelectedTools},b=On.create(!0),y=await this.prepareToolInvocationWithHookResult(g,e,h,o),b.stop();let{autoConfirmed:E,preparedInvocation:M}=await this.resolveAutoConfirmFromHook(h,g,e,y,e.context?.sessionResource);if(y=M,f&&c?c.transitionFromStreaming(y,e.parameters,E):(c=new ZM(y,g.data,e.chatStreamToolCallId??e.callId,e.subAgentInvocationId,e.parameters),E&&pi.confirmWith(c,E),this._chatService.appendProgress(s,c)),e.toolSpecificData=c?.toolSpecificData,y?.confirmationMessages?.title){!pi.executionConfirmedOrDenied(c)&&!E&&this.playAccessibilitySignal([c],e.context?.sessionResource);let N=await pi.awaitConfirmation(c,o);if(this._logToolApprovalTelemetry(g,e,N),N.type===0)throw new qi;if(N.type===5)return v={content:[{kind:"text",value:"The user chose to skip the tool call, they want to proceed without running it"}]},v;N.type===4&&N.selectedButton&&(e.selectedCustomButton=N.selectedButton),e.toolSpecificData?.kind==="input"&&(e.parameters=e.toolSpecificData.rawInput,e.toolSpecificData=void 0)}else this._logToolApprovalTelemetry(g,e,E??{type:1})}else{b=On.create(!0),y=await this.prepareToolInvocationWithHookResult(g,e,h,o),b.stop();let{autoConfirmed:E,preparedInvocation:M}=await this.resolveAutoConfirmFromHook(h,g,e,y,void 0);if(y=M,y?.confirmationMessages?.title&&!E&&!(await this._dialogService.confirm({message:ma(y.confirmationMessages.title),detail:ma(y.confirmationMessages.message)})).confirmed)throw new qi;e.toolSpecificData=y?.toolSpecificData}if(o.isCancellationRequested)throw new qi;S=On.create(!0),v=await g.impl.invoke(e,t,{report:E=>{c?.acceptProgress(E)}},o),S.stop();let w=this._toolResultCompressor.maybeCompress(g.data.id,e.parameters,v);w&&(v=w),this.ensureToolDetails(e,v,g.data,c);let x=await c?.didExecuteTool(v,void 0,()=>this.shouldAutoConfirmPostExecution(g.data.id,g.data.runsInWorkspace,g.data.source,e.parameters,e.context?.sessionResource,e.chatRequestId,e.context?.workingDirectory));if(c&&x?.type===pi.StateKind.WaitingForPostApproval){let E=await pi.awaitPostConfirmation(c,o);if(E.type===0)throw new qi;E.type===5&&(v={content:[{kind:"text",value:"The tool executed but the user chose not to share the results"}]})}return this._telemetryService.publicLog2("languageModelToolInvoked",{result:"success",chatSessionId:e.context?.sessionResource?jp(e.context.sessionResource):void 0,toolId:g.data.id,toolExtensionId:g.data.source.type==="extension"?g.data.source.extensionId.value:void 0,toolSourceKind:g.data.source.type,prepareTimeMs:b?.elapsed(),invocationTimeMs:S?.elapsed()}),v}catch(w){let x=Yi(w)?"userCancelled":"error";throw this._telemetryService.publicLog2("languageModelToolInvoked",{result:x,chatSessionId:e.context?.sessionResource?jp(e.context.sessionResource):void 0,toolId:g.data.id,toolExtensionId:g.data.source.type==="extension"?g.data.source.extensionId.value:void 0,toolSourceKind:g.data.source.type,prepareTimeMs:b?.elapsed(),invocationTimeMs:S?.elapsed()}),Yi(w)||this._logService.error(`[LanguageModelToolsService#invokeTool] Error from tool ${e.toolId} with parameters ${JSON.stringify(e.parameters)}:
${Mn(w,!0)}`),v??={content:[]},v.toolResultError=w instanceof Error?w.message:String(w),g.data.alwaysDisplayInputOutput&&(v.toolResultDetails={input:this.formatToolInput(e),output:[{type:"embed",isText:!0,value:String(w)}],isError:!0}),w}finally{c?.didExecuteTool(v,!0),p&&this.cleanupCallDisposables(u,p)}}async prepareToolInvocationWithHookResult(e,t,o,n){let r;if(o?.permissionDecision==="ask"){let s=d(8644,null,"PreToolUse");r=o.permissionDecisionReason?`${s}: ${o.permissionDecisionReason}`:s}return this.prepareToolInvocation(e,t,r,n)}_logToolApprovalTelemetry(e,t,o){let n={0:"denied",1:"confirmationNotNeeded",2:"setting",3:"lmServicePerTool",4:"userAction",5:"skipped"},r=new Set(["auto-approve-all","inlineChat"]),s;if(o.type===1&&o.reason){let c=typeof o.reason=="string"?o.reason:o.reason.value;s=r.has(c)?c:"other"}let l=t.toolSpecificData?.kind==="terminal"?t.toolSpecificData:void 0;this._telemetryService.publicLog2("chat.toolApproval",{confirmKind:n[o.type],settingId:o.type===2?o.id:void 0,lmServiceScope:o.type===3?o.scope:void 0,customButtonKind:o.type===4?o.selectedButtonKind:void 0,confirmationNotNeededReason:s,sandboxWrapped:l?.commandLine.isSandboxWrapped,requestUnsandboxedExecution:l?.requestUnsandboxedExecution,chatSessionId:t.context?.sessionResource?jp(t.context.sessionResource):void 0,toolId:e.data.id,toolExtensionId:e.data.source.type==="extension"?e.data.source.extensionId.value:void 0,toolSourceKind:e.data.source.type})}async resolveAutoConfirmFromHook(e,t,o,n,r){if(e?.permissionDecision==="allow")return this._logService.debug(`[LanguageModelToolsService#invokeTool] Tool ${o.toolId} auto-approved by preToolUse hook`),{autoConfirmed:{type:1,reason:d(8636,null)},preparedInvocation:n};if(e?.permissionDecision==="ask"){if(this._logService.debug(`[LanguageModelToolsService#invokeTool] Tool ${o.toolId} requires confirmation (preToolUse hook returned 'ask')`),n?.confirmationMessages?.title){let u=e.permissionDecisionReason,p=u?d(8640,null,"PreToolUse",u):d(8641,null,"PreToolUse"),h=n.confirmationMessages;if(n.toolSpecificData?.kind==="terminal"){let g=h.disclaimer?typeof h.disclaimer=="string"?h.disclaimer:h.disclaimer.value:void 0,f=g?`${p}

${g}`:p;n.confirmationMessages={...h,disclaimer:f,allowAutoConfirm:!1}}else{let g=typeof h.message=="string"?h.message:h.message?.value??"";n.confirmationMessages={...h,message:new he(`_${p}_

${g}`),allowAutoConfirm:!1}}}else{n||(n={});let u=Dre(t.data),p=e.permissionDecisionReason,h=p?d(8639,null,"PreToolUse",p):d(8638,null,"PreToolUse");n.confirmationMessages={...n.confirmationMessages,title:d(8642,null,u),message:new he(`_${h}_`),allowAutoConfirm:!1},n.toolSpecificData={kind:"input",rawInput:o.parameters}}return{autoConfirmed:void 0,preparedInvocation:n}}let s=n?.confirmationMessages?.approveCombination,l;return s&&(l={label:typeof s.label=="string"?s.label:s.label.value,key:s.key}),{autoConfirmed:await this.shouldAutoConfirm(t.data.id,t.data.runsInWorkspace,t.data.source,o.parameters,r,o.chatRequestId,l,o.context?.workingDirectory),preparedInvocation:n}}async prepareToolInvocation(e,t,o,n){let r;if(e.impl.prepareToolInvocation){let l=e.impl.prepareToolInvocation({parameters:t.parameters,toolCallId:t.callId,chatRequestId:t.chatRequestId,chatSessionResource:t.context?.sessionResource,chatInteractionId:t.chatInteractionId,modelId:t.modelId,forceConfirmationReason:o,workingDirectory:t.context?.workingDirectory},n);await Promise.race([Li(3e3,n).then(()=>"timeout"),l])==="timeout"&&t.context&&this._onDidPrepareToolCallBecomeUnresponsive.fire({sessionResource:t.context.sessionResource,toolData:e.data}),r=await l}let s=this.isToolEligibleForAutoApproval(e.data);if(!s&&!r?.confirmationMessages?.title){r||(r={});let l=Dre(e.data);r.confirmationMessages={...r.confirmationMessages,title:d(8634,null),message:d(8633,null,l),disclaimer:Act.has(e.data.id)?void 0:new he(d(8632,null,Dre(e.data),Xw({text:"`chat.tools.eligibleForAutoApproval`",id:"workbench.action.openSettings",arguments:["chat.tools.eligibleForAutoApproval"],tooltip:d(8643,null)},!1)),{isTrusted:!0}),allowAutoConfirm:!1}}return!s&&r?.confirmationMessages?.title&&(r.confirmationMessages.disclaimer=Act.has(e.data.id)?void 0:new he(d(8632,null,Dre(e.data),Xw({text:"`chat.tools.eligibleForAutoApproval`",id:"workbench.action.openSettings",arguments:["chat.tools.eligibleForAutoApproval"],tooltip:d(8643,null)},!1)),{isTrusted:!0})),r?.confirmationMessages?.title&&(r.toolSpecificData?.kind!=="terminal"&&r.confirmationMessages.allowAutoConfirm!==!1&&(r.confirmationMessages.allowAutoConfirm=s),!r.toolSpecificData&&e.data.alwaysDisplayInputOutput&&(r.toolSpecificData={kind:"input",rawInput:t.parameters})),r}beginToolCall(e){let t=this._tools.get(e.toolId);if(!t||!e.force&&!t.impl?.handleToolStream)return;let o=ZM.createStreaming({toolCallId:e.toolCallId,toolId:e.toolId,toolData:t.data,subagentInvocationId:e.subagentInvocationId,chatRequestId:e.chatRequestId});if(this._pendingToolCalls.set(e.toolCallId,o),e.sessionResource){let n=this._chatService.getSession(e.sessionResource);if(n){let r=(e.chatRequestId?n.getRequests().find(s=>s.id===e.chatRequestId):void 0)??n.getRequests().at(-1);r&&this._chatService.appendProgress(r,o)}}return this._callHandleToolStream(t,o,e.toolCallId,void 0,Ie.None),o}async _callHandleToolStream(e,t,o,n,r){if(e.impl?.handleToolStream)try{let s=await e.impl.handleToolStream({toolCallId:o,rawInput:n,chatRequestId:t.chatRequestId},r);s?.invocationMessage&&t.updateStreamingMessage(s.invocationMessage)}catch(s){this._logService.error(`[LanguageModelToolsService#_callHandleToolStream] Error calling handleToolStream for tool ${e.data.id}:`,s)}}async updateToolStream(e,t,o){let n=this._pendingToolCalls.get(e);if(!n)return;n.updatePartialInput(t);let r=this._tools.get(n.toolId);r&&await this._callHandleToolStream(r,n,e,t,o)}playAccessibilitySignal(e,t){if(this._configurationService.getValue("chat.tools.global.autoApprove"))return;if(t){let u=this._chatService.getSession(t)?.getRequests().at(-1);if(Mpe(u?.modeInfo?.permissionLevel)||this._isSessionLiveAutoApproveLevel(t))return}let n=e.filter(c=>!pi.executionConfirmedOrDenied(c));if(n.length===0)return;let r=this._configurationService.getValue(tn.chatUserActionRequired.settingsKey);if(!r)return;let s=r.sound==="on"||r.sound==="auto"&&this._accessibilityService.isScreenReaderOptimized(),l=this._accessibilityService.isScreenReaderOptimized()&&r.announcement==="auto";(s||l)&&this._accessibilitySignalService.playSignal(tn.chatUserActionRequired,{customAlertMessage:this._instantiationService.invokeFunction(iNi,n),userGesture:!0,modality:s?void 0:"announcement"})}ensureToolDetails(e,t,o,n){!t.toolResultDetails&&(o.alwaysDisplayInputOutput||this.toolResultHasImages(t)&&!this.toolResultMessageHasImageFileWidgets(t,n))&&(t.toolResultDetails={input:this.formatToolInput(e),output:this.toolResultToIO(t)})}toolResultHasImages(e){return e.content.some(t=>t.kind==="data"&&t.value.mimeType?.startsWith("image/"))}toolResultMessageHasImageFileWidgets(e,t){let o=e.toolResultMessage??t?.pastTenseMessage;if(!o)return!1;let n=typeof o=="string"?o:o.value,r=/\[\s*\]\((?<uri>[^)]+)\)/g,s;for(;(s=r.exec(n))!==null;)try{let l=A.parse(s.groups.uri);if(Py(l.path)?.startsWith("image/"))return!0}catch{}return!1}formatToolInput(e){return JSON.stringify(e.parameters,void 0,2)}toolResultToIO(e){return e.content.map(t=>{if(t.kind==="text")return{type:"embed",isText:!0,value:t.value};if(t.kind==="promptTsx")return{type:"embed",isText:!0,value:WYe(t)};if(t.kind==="data")return{type:"embed",value:gc(t.value.data),mimeType:t.value.mimeType};bs(t)})}_isAutoApprovePolicyRestricted(){return this._configurationService.inspect("chat.tools.global.autoApprove").policyValue===!1}_isSessionLiveAutoApproveLevel(e){let t=this._chatWidgetService.getWidgetBySessionResource(e)??this._chatWidgetService.lastFocusedWidget;return!!t&&Mpe(t.input.currentModeInfo.permissionLevel)}_isSessionInAutoApproveLevel(e){if(!e)return!1;let o=this._chatService.getSession(e)?.getRequests().at(-1);return Mpe(o?.modeInfo?.permissionLevel)||this._isSessionLiveAutoApproveLevel(e)}getEligibleForAutoApprovalSpecialCase(e){if(e.id==="vscode_fetchWebPage_internal")return"fetch"}isToolEligibleForAutoApproval(e){let t=this.getEligibleForAutoApprovalSpecialCase(e)??Dre(e);if(e.id==="copilot_fetchWebPage")return!0;if(Act.has(e.id))return!1;let o=this._configurationService.getValue("chat.tools.eligibleForAutoApproval");if(o&&typeof o=="object"&&t){if(Object.prototype.hasOwnProperty.call(o,t))return o[t];if(e.legacyToolReferenceFullNames)for(let n of e.legacyToolReferenceFullNames){if(Object.prototype.hasOwnProperty.call(o,n))return o[n];if(n.includes("/")){let r=n.split("/").pop();if(r&&Object.prototype.hasOwnProperty.call(o,r))return o[r]}}}return!0}async shouldAutoConfirm(e,t,o,n,r,s,l,c){let u=this._tools.get(e);if(!u)return;if(r&&!this._isAutoApprovePolicyRestricted()&&this._isSessionInAutoApproveLevel(r)&&!(Act.has(u.data.id)&&yn(r)!==kl))return{type:1,reason:"auto-approve-all"};if(!this.isToolEligibleForAutoApproval(u.data))return;let p=this._confirmationService.getPreConfirmAction({toolId:e,source:o,parameters:n,chatSessionResource:r,workingDirectory:c,combination:l});if(p)return p;let h=this._configurationService.inspect("chat.tools.global.autoApprove"),g=h.value??h.defaultValue;if(typeof t=="boolean"&&(g=h.userLocalValue??h.applicationValue,t&&(g=h.workspaceValue??h.workspaceFolderValue??h.userRemoteValue??g)),(g===!0||typeof g=="object"&&g.hasOwnProperty(e)&&g[e]===!0)&&await this._checkGlobalAutoApprove())return{type:2,id:"chat.tools.global.autoApprove"}}async shouldAutoConfirmPostExecution(e,t,o,n,r,s,l){let c=r&&!this._isAutoApprovePolicyRestricted()&&this._isSessionInAutoApproveLevel(r);return c&&!(Act.has(e)&&yn(r)!==kl)?{type:1,reason:"auto-approve-all"}:this._configurationService.getValue("chat.tools.global.autoApprove")&&!c&&await this._checkGlobalAutoApprove()?{type:2,id:"chat.tools.global.autoApprove"}:this._confirmationService.getPostConfirmAction({toolId:e,source:o,parameters:n,chatSessionResource:r,workingDirectory:l})}async _checkGlobalAutoApprove(){if(this._storageService.getBoolean("chat.tools.global.autoApprove.optIn",-1,!1)||this._contextKeyService.getContextKeyValue(oyn)===!0)return!0;if(this._pendingGlobalAutoApproveCheck)return this._pendingGlobalAutoApproveCheck;this._pendingGlobalAutoApproveCheck=this._doCheckGlobalAutoApprove();try{return await this._pendingGlobalAutoApproveCheck}finally{this._pendingGlobalAutoApproveCheck=void 0}}async _doCheckGlobalAutoApprove(){let e=new O;try{let t=new qe;e.add(t),e.add(this._storageService.onDidChangeValue(-1,"chat.tools.global.autoApprove.optIn",e)(()=>{this._storageService.getBoolean("chat.tools.global.autoApprove.optIn",-1,!1)&&t.cancel()}));let o=await this._dialogService.prompt({type:wt.Warning,message:d(8626,null),buttons:[{label:d(8625,null),run:()=>!0},{label:d(8624,null),run:()=>!1}],custom:{icon:L.warning,markdownDetails:[{markdown:new he(VVi.value,{isTrusted:{enabledCommands:["workbench.action.openSettings"]}})}]},token:t.token});return t.token.isCancellationRequested?!0:o.result!==!0?(await this._configurationService.updateValue("chat.tools.global.autoApprove",!1),!1):(this._storageService.store("chat.tools.global.autoApprove.optIn",!0,-1,0),!0)}finally{e.dispose()}}cleanupCallDisposables(e,t){if(e){let o=this._callsByRequestId.get(e);if(o){let n=o.findIndex(r=>r.store===t);n>-1&&o.splice(n,1),o.length===0&&this._callsByRequestId.delete(e)}}t.dispose()}cancelToolCallsForRequest(e){let t=this._callsByRequestId.get(e);t&&(t.forEach(o=>o.store.dispose()),this._callsByRequestId.delete(e));for(let[o,n]of this._pendingToolCalls)n.chatRequestId===e&&this._pendingToolCalls.delete(o)}static{this.githubMCPServerAliases=["github/github-mcp-server","io.github.github/github-mcp-server","github-mcp-server"]}static{this.playwrightMCPServerAliases=["microsoft/playwright-mcp","com.microsoft/playwright-mcp"]}*getToolSetAliases(e,t){switch(t!==e.referenceName&&(yield e.referenceName),e.legacyFullNames&&(yield*e.legacyFullNames),e.referenceName){case"github":for(let o of RO.githubMCPServerAliases)yield o+"/*";break;case"playwright":for(let o of RO.playwrightMCPServerAliases)yield o+"/*";break;case Am.execute:yield"shell";break;case Am.agent:yield D3.runSubagent,yield"custom-agent";break}}*getToolAliases(e,t){let o=e.toolReferenceName??e.displayName;if(t!==o&&o!==D3.runSubagent&&(yield o),e.legacyToolReferenceFullNames)for(let r of e.legacyToolReferenceFullNames){yield r;let s=r.lastIndexOf("/");s!==-1&&(yield r.substring(s+1))}let n=t.lastIndexOf("/");if(n!==-1)switch(t.substring(0,n)){case"github":for(let r of RO.githubMCPServerAliases)yield r+t.substring(n);break;case"playwright":for(let r of RO.playwrightMCPServerAliases)yield r+t.substring(n);break}}toToolAndToolSetEnablementMap(e,t){let o=new Set(e),n=new Map;for(let[r,s]of this.toolsWithFullReferenceName.get())if(_h(r)){let l=o.has(s)||yt.some(this.getToolSetAliases(r,s),u=>o.has(u)),c=t?new FYe(r,t):r;if(n.set(c,l),l)for(let u of c.getTools())n.set(u,!0)}else{if(!this.isToolEnabledForModel(r,t))continue;if(!n.has(r)){let l=o.has(s)||yt.some(this.getToolAliases(r,s),c=>o.has(c))||!!r.legacyToolReferenceFullNames?.some(c=>{let u=c.lastIndexOf("/");return u!==-1&&o.has(c.substring(0,u))});n.set(r,l)}}for(let r of this._toolSets)if(r.source.type==="user"){let s=yt.every(r.getTools(),l=>n.get(l)===!0);n.set(r,s)}return n}toFullReferenceNames(e){let t=[],o=new Set;for(let[n,r]of this.toolsWithFullReferenceName.get())if(_h(n)){if(e.get(n)){t.push(r);for(let s of n.getTools())o.add(s)}}else e.get(n)&&!o.has(n)&&t.push(r);return t}toToolReferences(e){let t=new Map;for(let[n,r]of this.toolsWithFullReferenceName.get())t.set(r,n);let o=[];for(let n of e){let r=t.get(n.name);r&&(_h(r)?o.push(TPt(r,n.range)):o.push(Npe(r,n.range)))}return o}getToolSetsForModel(e,t){return e?yt.map(this.toolSets.read(t),o=>new FYe(o,e,n=>this.isToolEnabledForModel(n,e))):this.toolSets.read(t)}getToolSet(e){for(let t of this._toolSets)if(t.id===e)return t}getToolSetByName(e){for(let t of this._toolSets)if(t.referenceName===e)return t}getSpecedToolSetName(e){return RO.githubMCPServerAliases.includes(e)?"github":RO.playwrightMCPServerAliases.includes(e)?"playwright":e}createToolSet(e,t,o,n){let r=this;o=this.getSpecedToolSetName(o);let s=new class extends aDe{dispose(){r._toolSets.has(s)&&(this._tools.clear(),r._toolSets.delete(s))}}(t,o,n?.icon??L.tools,e,n?.description,n?.legacyFullNames,this._contextKeyService);return this._toolSets.add(s),s}*getFullReferenceNames(){for(let[,e]of this.toolsWithFullReferenceName.get())yield e}getDeprecatedFullReferenceNames(){let e=new Map,t=new Set,o=(n,r)=>{n!==r&&(e.has(n)||e.set(n,new Set),e.get(n).add(r))};for(let[n,r]of this.toolsWithFullReferenceName.get())if(_h(n)&&(t.add(n.referenceName),n.legacyFullNames))for(let s of n.legacyFullNames)t.add(s);for(let[n,r]of this.toolsWithFullReferenceName.get())if(_h(n))for(let s of this.getToolSetAliases(n,r))o(s,r);else{for(let s of this.getToolAliases(n,r))o(s,r);if(n.legacyToolReferenceFullNames){let s=r.lastIndexOf("/"),l=s!==-1?r.substring(0,s+1):void 0;for(let c of n.legacyToolReferenceFullNames)if(l&&!c.includes("/")&&o(l+c,r),c.includes("/")){let u=c.substring(0,c.lastIndexOf("/"));t.has(u)||o(u,r)}}}return e}getToolByFullReferenceName(e){for(let[t,o]of this.toolsWithFullReferenceName.get()){if(e===o)return t;let n=_h(t)?this.getToolSetAliases(t,o):this.getToolAliases(t,o);if(yt.some(n,r=>e===r))return t}}getFullReferenceName(e,t){for(let[o,n]of this.toolsWithFullReferenceName.get())if(o===e)return n;return _h(e)?FMo(e):Dre(e,t)}};RO=I([m(0,F),m(1,lt),m(2,X),m(3,si),m(4,ct),m(5,_e),m(6,re),m(7,B),m(8,Ai),m(9,br),m(10,de),m(11,IR),m(12,fe),m(13,Lt),m(14,tUe)],RO);function Dre(a,i){let e=a.toolReferenceName??a.displayName;return i?`${i.referenceName}/${e}`:a.source.type==="extension"?`${a.source.extensionId.value.toLowerCase()}/${e}`:e}function FMo(a){return a.source.type==="mcp"?`${a.referenceName}/*`:a.referenceName}var iUe=class extends k{constructor(e,t,o){super();this._configurationService=e;this._telemetryService=t;this._logService=o;this._filters=new Map;this._caches=new Map}registerFilter(e){for(let t of e.toolIds){let o=this._filters.get(t);o||(o=[],this._filters.set(t,o)),o.push(e)}}registerCache(e){for(let t of e.toolIds){let o=this._caches.get(t);o||(o=[],this._caches.set(t,o)),o.push(e)}}maybeCompress(e,t,o){if(!this._configurationService.getValue("chat.tools.compressOutput.enabled"))return;let n=this._caches.get(e);if(n&&n.length>0){for(let b of n)try{b.observe(e,t)}catch(S){this._logService.warn(`[ToolResultCompressor] cache ${b.id} threw in observe on tool ${e}: ${Dn(S)}`,S)}for(let b of n){let S;try{S=b.lookup(e,t)}catch(y){this._logService.warn(`[ToolResultCompressor] cache ${b.id} threw in lookup on tool ${e}: ${Dn(y)}`,y);continue}if(S){let y=o.content.reduce((M,N)=>M+(N.kind==="text"?N.value.length:0),0);if(y<WVi||o.content.some(M=>M.kind==="text"&&FVi(M.value)))continue;let x=this._buildCacheHitResult(o,S),E=x.content.reduce((M,N)=>M+(N.kind==="text"?N.value.length:0),0);if(E>=y)continue;return this._sendTelemetry(e,[`cache:${b.id}`],y,E,!0),x}}}let s=this._filters.get(e)?.filter(b=>{try{return b.matches(e,t)}catch(S){return this._logService.warn(`[ToolResultCompressor] filter ${b.id} threw in matches on tool ${e}: ${Dn(S)}`,S),!1}})??[];if(s.length===0){this._recordInCaches(e,t,o,n);return}let l=s.slice(),c=new Set,u=0,p=0,h=!1,g=new Set,f=o.content.map(b=>{if(b.kind!=="text")return b;let S=b.value;if(u+=S.length,S.length<WVi||FVi(S))return p+=S.length,b;let y=S,w=[];for(let x=0;x<l.length;){let E=l[x];try{let M=E.apply(y,t);M.compressed&&M.text.length<y.length&&(y=M.text,g.add(E.id),w.push(E.id)),x++}catch(M){l.splice(x,1),c.has(E.id)||(c.add(E.id),this._logService.warn(`[ToolResultCompressor] filter ${E.id} threw on tool ${e}; disabled for this pass: ${Dn(M)}`,M))}}return p+=y.length,y!==S?(h=!0,{kind:"text",value:`${NMo(w,S.length,y.length)}
${y}`,audience:b.audience,title:b.title}):b});if(!h){this._recordInCaches(e,t,o,n);return}this._sendTelemetry(e,[...g],u,p,!1);let v={...o,content:f};return this._recordInCaches(e,t,v,n),v}_buildCacheHitResult(e,t){let n=`Same output as last run (${new Date(t.timestamp).toISOString()}). To disable, set chat.tools.compressOutput.enabled to false.`,r=e.content.find(c=>c.kind==="text"),s={kind:"text",value:n,audience:r?.audience,title:r?.title},l=e.content.filter(c=>c.kind!=="text");return{...e,content:[s,...l]}}_recordInCaches(e,t,o,n){if(!n||n.length===0)return;let r=o.content.filter(s=>s.kind==="text").map(s=>s.value).join(`
`);if(r)for(let s of n)try{s.record(e,t,r)}catch(l){this._logService.warn(`[ToolResultCompressor] cache ${s.id} threw in record on tool ${e}: ${Dn(l)}`,l)}}_sendTelemetry(e,t,o,n,r){this._telemetryService.publicLog2("toolResultCompressed",{toolId:e,filters:t.join(","),beforeChars:o,afterChars:n,cacheHit:r})}};iUe=I([m(0,B),m(1,_e),m(2,re)],iUe);var nyn={format:0,manifestPath:"plugin.json",hookConfigPath:"hooks.json",pluginRootToken:void 0,pluginRootEnvVar:void 0,parseHooks(a,i,e,t,o){return GMo(a,i,t,o)}},ryn={format:1,manifestPath:".claude-plugin/plugin.json",hookConfigPath:"hooks/hooks.json",pluginRootToken:"${CLAUDE_PLUGIN_ROOT}",pluginRootEnvVar:"CLAUDE_PLUGIN_ROOT",parseHooks(a,i,e,t,o){return qMo(a,i,e,t,o,"${CLAUDE_PLUGIN_ROOT}","CLAUDE_PLUGIN_ROOT")}},syn={format:2,manifestPath:".plugin/plugin.json",hookConfigPath:"hooks/hooks.json",pluginRootToken:"${PLUGIN_ROOT}",pluginRootEnvVar:"PLUGIN_ROOT",parseHooks(a,i,e,t,o){return qMo(a,i,e,t,o,"${PLUGIN_ROOT}","PLUGIN_ROOT")}};async function VMo(a,i){return await Nct(Ve(a,".plugin","plugin.json"),i)?syn:a.path.split("/").includes(".claude")||await Nct(Ve(a,".claude-plugin","plugin.json"),i)?ryn:nyn}var BVi={paths:[],exclusive:!1};function BMo(a){if(a==null)return BVi;if(typeof a=="string"){let i=a.trim();return i?{paths:[i],exclusive:!1}:BVi}if(Array.isArray(a))return{paths:a.filter(e=>typeof e=="string").map(e=>e.trim()).filter(e=>e.length>0),exclusive:!1};if(typeof a=="object"){let i=a;if(Array.isArray(i.paths)){let e=i.paths.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0),t=i.exclusive===!0;return{paths:e,exclusive:t}}}return BVi}function HMo(a,i,e,t){let o=t&&Yr(a,t)?t:a,n=[];e.exclusive||n.push(Ve(a,i));for(let r of e.paths){let s=Jj(Ve(a,r));Yr(s,o)&&n.push(s)}return n}function UMo(a){if(!a||typeof a!="object"||Array.isArray(a))return;let i=a;return Object.hasOwn(i,"mcpServers")?i.mcpServers:i}function ayn(a){if(!a||typeof a!="object")return;let i=a,e=typeof i.type=="string"?i.type:void 0,t=typeof i.command=="string"?i.command:void 0,o=typeof i.url=="string"?i.url:void 0,n=Array.isArray(i.args)?i.args.filter(p=>typeof p=="string"):void 0,r=i.env&&typeof i.env=="object"?Object.fromEntries(Object.entries(i.env).filter(([,p])=>typeof p=="string"||typeof p=="number"||p===null).map(([p,h])=>[p,h])):void 0,s=typeof i.envFile=="string"?i.envFile:void 0,l=typeof i.cwd=="string"?i.cwd:void 0,c=i.headers&&typeof i.headers=="object"?Object.fromEntries(Object.entries(i.headers).filter(([,p])=>typeof p=="string").map(([p,h])=>[p,h])):void 0,u=i.dev&&typeof i.dev=="object"?i.dev:void 0;if(e!=="ws"){if(e==="stdio"||!e&&t)return t?{type:"stdio",command:t,args:n,env:r,envFile:s,cwd:l,dev:u}:void 0;if(e==="http"||e==="sse"||!e&&o)return o?{type:"http",url:o,headers:c,dev:u}:void 0}}var lyn=/[\s&|<>()^;!`"']/;function zMo(a,i,e){if(!a.includes(e))return a;if(!lyn.test(i))return a.replaceAll(e,i);let t=Ss(e),o=new RegExp(`(["']?)`+t+"([\\w./\\\\~:-]*)","g");return a.replace(o,(n,r,s)=>{let l=i+s;return r?r+l:'"'+l.replace(/"/g,'\\"')+'"'})}function cyn(a,i,e,t){let o=s=>s.replaceAll(e,i),n=a.configuration,r;if(n.type==="stdio"){let s={...n};s.command=o(s.command),s.args&&(s.args=s.args.map(o)),s.cwd&&(s.cwd=o(s.cwd)),s.env={...s.env};for(let[l,c]of Object.entries(s.env))typeof c=="string"&&(s.env[l]=o(c));s.env[t]=i,s.envFile&&(s.envFile=o(s.envFile)),r=s}else{let s={...n};s.url=o(s.url),s.headers&&(s.headers=Object.fromEntries(Object.entries(s.headers).map(([l,c])=>[l,o(c)]))),r=s}return{name:a.name,configuration:r,uri:a.uri}}var dyn=/\$\{(?![A-Za-z]+:)([A-Z_][A-Z0-9_]*)\}/g;function KMo(a){return Dk(a,i=>{if(A.isUri(i))return i;if(typeof i=="string"){let e=i.replace(dyn,"${env:$1}");return e!==i?e:void 0}})}var uyn={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 pyn(a){if(a.type!==void 0&&a.type!=="command")return;let i=typeof a.command=="string"&&a.command.length>0,e=typeof a.bash=="string"&&a.bash.length>0,t=typeof a.powershell=="string"&&a.powershell.length>0,o=typeof a.windows=="string"&&a.windows.length>0,n=typeof a.linux=="string"&&a.linux.length>0,r=typeof a.osx=="string"&&a.osx.length>0;if(!i&&!e&&!t&&!o&&!n&&!r)return;let s=o?a.windows:t?a.powershell:void 0,l=n?a.linux:e?a.bash:void 0,c=r?a.osx:e?a.bash:void 0,u=typeof a.timeout=="number"?a.timeout:typeof a.timeoutSec=="number"?a.timeoutSec:void 0;return{...i&&{command:a.command},...s&&{windows:s},...l&&{linux:l},...c&&{osx:c},...typeof a.env=="object"&&a.env!==null&&{env:a.env},...u!==void 0&&{timeout:u}}}function WMo(a,i,e){let t=pyn(a);if(!t)return;let o,n=typeof a.cwd=="string"?a.cwd:void 0;if(n){let r=aK(n,e);Jl(r)?o=A.file(r):i&&(o=Ve(i,r))}else o=i;return{...t,cwd:o}}function myn(a,i,e){if(!a||typeof a!="object")return[];let t=a,o=[],n=t.hooks;if(n!==void 0&&Array.isArray(n))for(let r of n){if(!r||typeof r!="object")continue;let s=WMo(r,i,e);s&&o.push(s)}else{let r=WMo(t,i,e);r&&o.push(r)}return o}function GMo(a,i,e,t){if(!i||typeof i!="object")return[];let o=i;if(o.disableAllHooks===!0)return[];let n=o.hooks;if(!n||typeof n!="object")return[];let r=n,s=[];for(let l of Object.keys(r)){let c=uyn[l];if(!c)continue;let u=r[l];if(!Array.isArray(u))continue;let p=[];for(let h of u)p.push(...myn(h,e,t));p.length>0&&s.push({type:c,commands:p,uri:a,originalId:l})}return s}function qMo(a,i,e,t,o,n,r){let s=e.fsPath,l=i,c=p=>{for(let h of["command","windows","linux","osx"])typeof p[h]=="string"&&(p[h]=zMo(p[h],s,n));(!p.env||typeof p.env!="object")&&(p.env={}),p.env[r]=s};for(let p of Object.values(l.hooks??{}))if(Array.isArray(p))for(let h of p){if(!h||typeof h!="object")continue;let g=h;if(Array.isArray(g.hooks))for(let f of g.hooks)c(f);else c(g)}return GMo(a,Dk(i,p=>typeof p=="string"?p.replaceAll(n,e.fsPath):void 0),t,o)}async function Nct(a,i){try{return await i.resolve(a),!0}catch{return!1}}var R3t=".md";async function $Mo(a,i,e){let t=new Set,o=[],n=(r,s)=>{t.has(r)||(t.add(r),o.push({uri:s,name:r}))};for(let r of i){let s=A.joinPath(r,"SKILL.md");if(await Nct(s,e)){n(Be(r),s);continue}let l;try{l=await e.resolve(r)}catch{continue}if(!(!l.isDirectory||!l.children))for(let c of l.children){let u=A.joinPath(c.resource,"SKILL.md");await Nct(u,e)&&n(Be(c.resource),u)}}if(o.length===0){let r=A.joinPath(a,"SKILL.md");await Nct(r,e)&&n(Be(a),r)}return o.sort((r,s)=>r.name.localeCompare(s.name)),o}async function HVi(a,i){let e=new Set,t=[],o=(n,r)=>{e.has(n)||(e.add(n),t.push({uri:r,name:n}))};for(let n of a){let r;try{r=await i.resolve(n)}catch{continue}if(r.isFile&&Ts(n).toLowerCase()===R3t){o(Be(n).slice(0,-R3t.length),n);continue}if(!(!r.isDirectory||!r.children))for(let s of r.children)!s.isFile||Ts(s.resource).toLowerCase()!==R3t||o(Be(s.resource).slice(0,-R3t.length),s.resource)}return t.sort((n,r)=>n.name.localeCompare(r.name)),t}function UVi(a,i,e,t){let o=UMo(i);if(!o)return[];let n=[];for(let[r,s]of Object.entries(o)){let l=ayn(s);if(!l)continue;let c={name:r,configuration:l,uri:a};t.pluginRootToken&&t.pluginRootEnvVar&&(c=cyn(c,e,t.pluginRootToken,t.pluginRootEnvVar)),c=KMo(c),n.push(c)}return n}function jMo(a){return a.filter(i=>Object.values(fE).includes(i.type)).map(i=>({type:i.type,hooks:i.commands,uri:i.uri,originalId:i.originalId}))}var hyn=[".instructions.md",".mdc",".md"];function QMo(a,i){let e=i.getWorkspace().folders[0];return(i.getWorkspaceFolder(a)??e)?.uri}var oUe=class extends k{constructor(i,e,t){super(),this.enablementModel=this._register(new VZ("agentPlugins.enablement",t));let o=hr("chat.plugins.enabled",!0,e),n=[];for(let r of Vpe.getAll()){let s=i.createInstance(r);this._register(s),n.push(s),s.start(this.enablementModel)}this.plugins=ke(r=>o.read(r)?this._dedupeAndSort(n.flatMap(s=>s.plugins.read(r))):[])}_dedupeAndSort(i){let e=[],t=new xn;for(let o of i)t.has(o.uri)||(t.add(o.uri),e.push(o));return e.sort((o,n)=>o.uri.toString().localeCompare(n.uri.toString())),e}};oUe=I([m(0,F),m(1,B),m(2,de)],oUe);var lUe=class extends k{constructor(e,t,o,n){super();this._fileService=e;this._pathService=t;this._logService=o;this._workspaceContextService=n;this._pluginEntries=new Map;this._plugins=De("discoveredAgentPlugins",[]);this.plugins=this._plugins;this._discoverVersion=0}async _refreshPlugins(){let e=++this._discoverVersion,t=await this._discoverAndBuildPlugins();e!==this._discoverVersion||this._store.isDisposed||this._plugins.set(t,void 0)}async _discoverAndBuildPlugins(){let e=await this._discoverPluginSources(),t=[],o=new Set;for(let n of e){let r=n.uri.toString();if(!o.has(r)){o.add(r);let s=await VMo(n.uri,this._fileService);t.push(await this._toPlugin(n.uri,s,n.fromMarketplace,n.repositoryUri,()=>n.remove()))}}return this._disposePluginEntriesExcept(o),t.sort((n,r)=>n.uri.toString().localeCompare(r.uri.toString())),t}async _pathExists(e){try{return await this._fileService.resolve(e),!0}catch{return!1}}async _toPlugin(e,t,o,n,r){let s=e.toString(),l=this._pluginEntries.get(s);if(l)if(l.format.format!==t.format)l.store.dispose(),this._pluginEntries.delete(s);else return l.plugin;let c=new O,u=ke(H=>this._enablementModel.readEnabled(s,H)),p=await this._readManifest(e,t),h=De("agentPluginManifest",p),g=(H,K,j,J=H)=>{let se=Js({equalsFn:Qi},xe=>h.read(xe)?.[H]),ae=ke(xe=>{let He=se.read(xe);if(j&&He&&typeof He=="object"&&!Array.isArray(He)&&!yo(He,{paths:!0}))return{kind:"const",data:new Uc(j(He))};let Ee=BMo(He),Te=HMo(e,J,Ee,n);for(let It of Te){let tt=this._fileService.createWatcher(It,{recursive:!1,excludes:[]});xe.store.add(tt),xe.store.add(tt.onDidChange(()=>ce.trigger(void 0)))}return{kind:"dirs",dirs:Te}}),ce=zc("fileChange");return ke(xe=>{let He=ae.read(xe);return He.kind==="const"?He.data.promiseResult:(ce.read(xe),new Uc(K(He.dirs)).promiseResult)}).map((xe,He)=>xe.read(He)?.data??yt.empty()).recomputeInitiallyAndOnChange(c)},f=Ve(e,t.manifestPath),v=g("commands",H=>HVi(H,this._fileService)),b=g("skills",H=>$Mo(e,H,this._fileService)),S=g("agents",H=>HVi(H,this._fileService)),y=g("rules",H=>this._readRules(H)),w=g("hooks",H=>this._readHooksFromPaths(e,H,t),async H=>{let K=(await this._pathService.userHome()).fsPath,j=QMo(e,this._workspaceContextService);return jMo(t.parseHooks(f,H,e,j,K))},t.hookConfigPath),x=g("mcpServers",H=>this._readMcpDefinitionsFromPaths(H,e.fsPath,t),async H=>UVi(f,{mcpServers:H},e.fsPath,t),".mcp.json"),E=async()=>{h.set(await this._readManifest(e,t),void 0)},M=this._fileService.createWatcher(f,{recursive:!1,excludes:[]});c.add(M),c.add(M.onDidChange(()=>E()));let N=typeof p?.name=="string"&&p.name.trim()?p.name.trim():void 0,V={uri:e,label:o?.name??N??Be(e),enablement:u,remove:r,hooks:w,commands:v,skills:b,agents:S,instructions:y,mcpServerDefinitions:x,fromMarketplace:o};return this._pluginEntries.set(s,{store:c,plugin:V,format:t}),V}async _readManifest(e,t){let o=await this._readJsonFile(Ve(e,t.manifestPath));if(o&&typeof o=="object"&&!Array.isArray(o))return o}async _readHooksFromPaths(e,t,o){let n=(await this._pathService.userHome()).fsPath,r=QMo(e,this._workspaceContextService);for(let s of t){let l=await this._readJsonFile(s);if(l)try{return jMo(o.parseHooks(s,l,e,r,n))}catch(c){this._logService.info(`[AgentPluginDiscovery] Failed to parse hooks from ${s.toString()}:`,c)}}return[]}async _readMcpDefinitionsFromPaths(e,t,o){let n=new Map;for(let r of e){let s=await this._readJsonFile(r);for(let l of UVi(r,s,t,o))n.has(l.name)||n.set(l.name,l)}return[...n.values()].sort((r,s)=>r.name.localeCompare(s.name))}async _readJsonFile(e){try{let t=await this._fileService.readFile(e);return is(t.value.toString())}catch{return}}async _readRules(e){let t=new Set,o=[],n=s=>{let l=s.toLowerCase();return hyn.find(c=>l.endsWith(c))},r=(s,l)=>{t.has(s)||(t.add(s),o.push({uri:l,name:s}))};for(let s of e){let l;try{l=await this._fileService.resolve(s)}catch{continue}if(l.isFile){let c=n(Be(s));c&&r(Be(s).slice(0,-c.length),s);continue}if(!(!l.isDirectory||!l.children))for(let c of l.children){if(!c.isFile)continue;let u=n(c.name);u&&r(c.name.slice(0,-u.length),c.resource)}}return o.sort((s,l)=>s.name.localeCompare(l.name)),o}_disposePluginEntriesExcept(e){for(let[t,o]of this._pluginEntries)e.has(t)||(o.store.dispose(),this._pluginEntries.delete(t))}dispose(){this._disposePluginEntriesExcept(new Set),super.dispose()}},nUe=class extends lUe{constructor(e,t,o,n,r,s){super(t,r,s,n);this._configurationService=e;this._pluginMarketplaceService=o;this._pluginLocationsConfig=hr("chat.pluginLocations",{},e)}start(e){this._enablementModel=e;let t=this._register(new Dt(()=>this._refreshPlugins(),0));this._register(ve(o=>{this._pluginLocationsConfig.read(o),t.schedule()})),t.schedule()}async _discoverPluginSources(){let e=[],t=this._pluginLocationsConfig.get(),o=await this._getUserHome();for(let[n,r]of Object.entries(t)){if(!n.trim()||r===!1)continue;let s=this._resolvePluginPath(n.trim(),o);for(let l of s){let c;try{c=await this._fileService.resolve(l)}catch{this._logService.debug(`[ConfiguredAgentPluginDiscovery] Could not resolve plugin path: ${l.toString()}`);continue}if(!c.isDirectory){this._logService.debug(`[ConfiguredAgentPluginDiscovery] Plugin path is not a directory: ${l.toString()}`);continue}let u=this._pluginMarketplaceService.getMarketplacePluginMetadata(c.resource),p=n;e.push({uri:c.resource,fromMarketplace:u,remove:()=>this._removePluginPath(p)})}}return e}async _getUserHome(){let e=await this._pathService.userHome();return e.scheme==="file"?e.fsPath:e.path}_resolvePluginPath(e,t){return e.startsWith("~")&&(e=aK(e,t)),Gs.isAbsolute(e)||Vo.isAbsolute(e)?[A.file(e)]:this._workspaceContextService.getWorkspace().folders.map(o=>Ve(o.uri,e))}_removePluginPath(e){let t=this._configurationService.inspect("chat.pluginLocations"),o=[6,5,3,4,2,1];for(let n of o){let r=Z4e(t,n);if(r&&Object.prototype.hasOwnProperty.call(r,e)){let s={...r};delete s[e],this._configurationService.updateValue("chat.pluginLocations",s,n);return}}}};nUe=I([m(0,B),m(1,ge),m(2,jC),m(3,Ae),m(4,Pn),m(5,re)],nUe);var rUe=class extends lUe{constructor(e,t,o,n,r,s){super(o,n,r,s);this._pluginMarketplaceService=e;this._pluginRepositoryService=t}start(e){this._enablementModel=e;let t=this._register(new Dt(()=>this._refreshPlugins(),0));this._register(ve(o=>{this._pluginMarketplaceService.installedPlugins.read(o),t.schedule()})),t.schedule()}async _discoverPluginSources(){let e=this._pluginMarketplaceService.installedPlugins.get(),t=[];for(let o of e){let n;try{n=await this._fileService.resolve(o.pluginUri)}catch{this._logService.debug(`[MarketplaceAgentPluginDiscovery] Could not resolve installed plugin: ${o.pluginUri.toString()}`);continue}if(!n.isDirectory){this._logService.debug(`[MarketplaceAgentPluginDiscovery] Installed plugin path is not a directory: ${o.pluginUri.toString()}`);continue}let r=this._pluginRepositoryService.getRepositoryUri(o.plugin.marketplaceReference,o.plugin.marketplaceType);t.push({uri:n.resource,fromMarketplace:o.plugin,repositoryUri:r,remove:()=>{this._enablementModel.remove(n.resource.toString()),this._pluginMarketplaceService.removeInstalledPlugin(o.pluginUri);let s=this._pluginMarketplaceService.installedPlugins.get();this._pluginRepositoryService.cleanupPluginSource(o.plugin,s.map(l=>l.plugin.sourceDescriptor)).catch(l=>{this._logService.error("[MarketplaceAgentPluginDiscovery] Failed to clean up plugin source",l)})}})}return t}};rUe=I([m(0,jC),m(1,g$),m(2,ge),m(3,Pn),m(4,re),m(5,Ae)],rUe);var gyn=".copilot/installed-plugins",sUe=class extends lUe{constructor(e,t,o,n,r){super(e,t,o,n);this._dialogService=r}start(e){this._enablementModel=e;let t=this._register(new Dt(()=>this._refreshPlugins(),0)),o=this._register(new O),n=async()=>{if(o.clear(),this._store.isDisposed)return;let r=await this._getInstalledPluginsDir(),s=[],l=r;for(;l;){s.unshift(l);let u=Ve(l,"..");if(u.toString()===l.toString())break;if(await this._pathExists(u)){s.unshift(u);break}l=u}for(let u of s){if(!await this._pathExists(u))continue;let p=this._fileService.createWatcher(u,{recursive:!1,excludes:[]});o.add(p),o.add(p.onDidChange(()=>{t.schedule(),n().catch(()=>{})}))}let c;try{c=await this._fileService.resolve(r)}catch{return}if(c.children)for(let u of c.children){if(!u.isDirectory)continue;let p=this._fileService.createWatcher(u.resource,{recursive:!1,excludes:[]});o.add(p),o.add(p.onDidChange(()=>t.schedule()))}};n().catch(()=>{}),t.schedule()}async _getInstalledPluginsDir(){let e=await this._pathService.userHome();return Ve(e,gyn)}async _discoverPluginSources(){let e=await this._getInstalledPluginsDir(),t;try{t=await this._fileService.resolve(e)}catch{return[]}if(!t.isDirectory||!t.children)return[];let o=[];for(let n of t.children){if(!n.isDirectory)continue;let r;try{r=await this._fileService.resolve(n.resource)}catch{continue}if(r.children)for(let s of r.children)s.isDirectory&&o.push({uri:s.resource,fromMarketplace:void 0,remove:()=>this._promptRemove(s.resource)})}return o}async _promptRemove(e){let{confirmed:t}=await this._dialogService.confirm({message:d(9392,null),detail:d(9393,null,e.fsPath),primaryButton:d(9394,null)});if(t)try{await this._fileService.del(e,{recursive:!0,useTrash:!0}),this._enablementModel.remove(e.toString())}catch(o){this._logService.error("[CopilotCliAgentPluginDiscovery] Failed to remove plugin",o)}}};sUe=I([m(0,ge),m(1,Pn),m(2,re),m(3,Ae),m(4,ct)],sUe);var fyn=zn.registerExtensionPoint({extensionPoint:"chatPlugins",jsonSchema:{description:d(9389,null),type:"array",items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{path:"./relative/path/to/plugin/"}}],required:["path"],properties:{path:{description:d(9387,null),type:"string"},when:{description:d(9388,null),type:"string"}}}}}),aUe=class extends lUe{constructor(e,t,o,n,r,s,l){super(n,r,s,l);this._commandService=e;this._contextKeyService=t;this._dialogService=o;this._extensionPlugins=new Map;this._whenKeys=new Set}start(e){this._enablementModel=e;let t=this._register(new Dt(()=>this._refreshPlugins(),0));this._register(this._contextKeyService.onDidChangeContext(o=>{o.affectsSome(this._whenKeys)&&t.schedule()})),fyn.setHandler((o,n)=>{for(let r of n.added)for(let s of r.value){if(!s.path){r.collector.error(d(9397,null,r.description.identifier.value));continue}let l=Ve(r.description.extensionLocation,s.path);if(!Yr(l,r.description.extensionLocation)){r.collector.error(d(9395,null,r.description.identifier.value,s.path));continue}let c;if(s.when&&(c=C.deserialize(s.when),!c)){r.collector.error(d(9396,null,r.description.identifier.value,s.path,s.when));continue}this._extensionPlugins.set(YMo(r.description.identifier,s.path),{uri:l,when:c,extensionId:r.description.identifier.value})}for(let r of n.removed)for(let s of r.value)this._extensionPlugins.delete(YMo(r.description.identifier,s.path));this._rebuildWhenKeys(),t.schedule()})}_rebuildWhenKeys(){this._whenKeys.clear();for(let{when:e}of this._extensionPlugins.values())if(e)for(let t of e.keys())this._whenKeys.add(t)}async _discoverPluginSources(){let e=[];for(let[,t]of this._extensionPlugins){if(t.when&&!this._contextKeyService.contextMatchesRules(t.when))continue;let o;try{o=await this._fileService.resolve(t.uri)}catch{this._logService.debug(`[ExtensionAgentPluginDiscovery] Could not resolve extension plugin path: ${t.uri.toString()}`);continue}if(!o.isDirectory){this._logService.debug(`[ExtensionAgentPluginDiscovery] Extension plugin path is not a directory: ${t.uri.toString()}`);continue}e.push({uri:o.resource,fromMarketplace:void 0,remove:()=>this._promptUninstallExtension(t.extensionId)})}return e}async _promptUninstallExtension(e){let{confirmed:t}=await this._dialogService.confirm({message:d(9398,null,e)});t&&await this._commandService.executeCommand("workbench.extensions.uninstallExtension",e)}};aUe=I([m(0,fe),m(1,X),m(2,ct),m(3,ge),m(4,Pn),m(5,re),m(6,Ae)],aUe);function YMo(a,i){return`${a.value}/${i}`}var zVi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.chatPlugins?.length}render(e){let t=e.contributes?.chatPlugins??[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(9390,null),d(9391,null)],n=t.map(r=>[r.path,r.when??"-"]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"chatPlugins",label:d(9386,null),access:{canToggle:!1},renderer:new Vt(zVi)});var Obe=class extends k{constructor(e,t,o,n){super();this._chatService=e;this._pluginMarketplaceService=t;this._notificationService=o;this._extensionsWorkbenchService=n;this._hasNotified=!1;this._register(this._chatService.onDidSubmitRequest(()=>{this._hasNotified||(this._hasNotified=!0,this._checkForRecommendedPlugins())}))}static{this.ID="workbench.contrib.agentPluginRecommendations"}async _checkForRecommendedPlugins(){let e=this._pluginMarketplaceService.recommendedPlugins.get();if(e.size===0)return;let t=new Set;for(let s of this._pluginMarketplaceService.installedPlugins.get()){let l=`${s.plugin.name}@${s.plugin.marketplace}`;t.add(l)}let o=this._pluginMarketplaceService.lastFetchedPlugins.get();if(o.length===0)try{o=await this._pluginMarketplaceService.fetchMarketplacePlugins(Ie.None)}catch{return}let n=new Set;for(let s of o)n.add(`${s.name}@${s.marketplace}`);let r=0;for(let s of e)!t.has(s)&&n.has(s)&&r++;r!==0&&this._notificationService.prompt(ft.Info,r===1?d(8338,null):d(8337,null,r),[{label:d(8339,null),run:()=>{this._extensionsWorkbenchService.openSearch("@agentPlugins @recommended")}}],{neverShowAgain:{id:"agentPluginRecommendations.dismissed",scope:0,isSecondary:!0}})}};Obe=I([m(0,si),m(1,jC),m(2,Ne),m(3,Ui)],Obe);var vyn=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g;function byn(a){return a.trim().toLowerCase().replace(vyn,"").replace(/\s/g,"-")}var Syn=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Iyn(a){return a.replace(Syn,(i,e)=>(e=e.toLowerCase(),e==="colon"?":":e.charAt(0)==="#"?e.charAt(1)==="x"?String.fromCharCode(parseInt(e.substring(2),16)):String.fromCharCode(+e.substring(1)):""))}function L3t({prefix:a="",globalSlugs:i=!1}={}){return{renderer:{heading({tokens:e,depth:t}){let o=this.parser.parseInline(e),n=Iyn(this.parser.parseInline(e,this.parser.textRenderer)).trim().replace(/<[!\/a-z].*?>/gi,""),r=t,s=`${a}${byn(n)}`;return`<h${r} id="${s}">${o}</h${r}>
`}}}}var D1=`
body {
	padding: 10px 20px;
	line-height: 22px;
	max-width: 882px;
	margin: 0 auto;
}

body *:last-child {
	margin-bottom: 0;
}

img {
	max-width: 100%;
	max-height: 100%;
}

a {
	text-decoration: var(--text-link-decoration);
}

a:hover {
	text-decoration: underline;
}

a:focus,
input:focus,
select:focus,
textarea:focus {
	outline: 1px solid -webkit-focus-ring-color;
	outline-offset: -1px;
}

hr {
	border: 0;
	height: 2px;
	border-bottom: 2px solid;
}

h1 {
	padding-bottom: 0.3em;
	line-height: 1.2;
	border-bottom-width: 1px;
	border-bottom-style: solid;
}

h1, h2, h3 {
	font-weight: normal;
}

table {
	border-collapse: collapse;
}

th {
	text-align: left;
	border-bottom: 1px solid;
}

th,
td {
	padding: 5px 10px;
}

table > tbody > tr + tr > td {
	border-top-width: 1px;
	border-top-style: solid;
}

blockquote {
	margin: 0 7px 0 5px;
	padding: 0 16px 0 10px;
	border-left-width: 5px;
	border-left-style: solid;
}

code {
	font-family: "SF Mono", Monaco, Menlo, Consolas, "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", monospace;
}

pre {
	padding: 16px;
	border-radius: 3px;
	overflow: auto;
}

pre code {
	font-family: var(--vscode-editor-font-family);
	font-weight: var(--vscode-editor-font-weight);
	font-size: var(--vscode-editor-font-size);
	line-height: 1.5;
	color: var(--vscode-editor-foreground);
	tab-size: 4;
}

.monaco-tokenized-source {
	white-space: pre;
}

/** Theming */

.pre {
	background-color: var(--vscode-textCodeBlock-background);
}

.vscode-high-contrast h1 {
	border-color: rgb(0, 0, 0);
}

.vscode-light th {
	border-color: rgba(0, 0, 0, 0.69);
}

.vscode-dark th {
	border-color: rgba(255, 255, 255, 0.69);
}

.vscode-light h1,
.vscode-light hr,
.vscode-light td {
	border-color: rgba(0, 0, 0, 0.18);
}

.vscode-dark h1,
.vscode-dark hr,
.vscode-dark td {
	border-color: rgba(255, 255, 255, 0.18);
}

@media (forced-colors: active) and (prefers-color-scheme: light){
	body {
		forced-color-adjust: none;
	}
}

@media (forced-colors: active) and (prefers-color-scheme: dark){
	body {
		forced-color-adjust: none;
	}
}
`,yyn=Object.freeze([Q.http,Q.https]);function wyn(a,i){return okt(a,{allowedLinkProtocols:{override:i?.allowedLinkProtocols?.override??yyn},allowRelativeLinkPaths:i?.allowRelativeLinkPaths,allowedMediaProtocols:i?.allowedMediaProtocols,allowRelativeMediaPaths:i?.allowRelativeMediaPaths,allowedTags:{override:ndi,augment:i?.allowedTags?.augment},allowedAttributes:{override:[...sQe,"name","id","class","role","tabindex","placeholder"],augment:i?.allowedAttributes?.augment??[]}})}async function P$(a,i,e,t,o=Ie.None){let n=new s4(XMo.markedHighlight({async:!0,async highlight(s,l){if(typeof l!="string")return Cr(s);if(await i.whenInstalledExtensionsRegistered(),o?.isCancellationRequested)return"";let c=e.getLanguageIdByLanguageName(l)??e.getLanguageIdByLanguageName(l.split(/\s+|:|,|(?!^)\{|\?]/,1)[0]);return EK(e,s,c)}}),L3t(),...t?.markedExtensions??[]),r=await Ym(n.parse(a,{async:!0}),o??Ie.None);return wyn(r,t?.sanitizerConfig)}var XMo;(c=>{function a(u){if(typeof u=="function"&&(u={highlight:u}),!u||typeof u.highlight!="function")throw new Error("Must provide highlight function");return{async:!!u.async,walkTokens(p){if(p.type!=="code")return;if(u.async)return Promise.resolve(u.highlight(p.text,p.lang)).then(i(p));let h=u.highlight(p.text,p.lang);if(h instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");i(p)(h)},renderer:{code({text:p,lang:h,escaped:g}){let f=h?` class="language-${l(h)}"`:"";return p=p.replace(/\n$/,""),`<pre><code${f}>${g?p:l(p,!0)}
</code></pre>`}}}}c.markedHighlight=a;function i(u){return p=>{typeof p=="string"&&p!==u.text&&(u.escaped=!0,u.text=p)}}let e=/[&<>"']/,t=new RegExp(e.source,"g"),o=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,n=new RegExp(o.source,"g"),r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},s=u=>r[u];function l(u,p){if(p){if(e.test(u))return u.replace(t,s)}else if(o.test(u))return u.replace(n,s);return u}})(XMo||={});var cUe=class extends k{constructor(e,t,o,n){super();this._container=e;this._labels=o;this._markdownRendererService=n;this._renderDisposables=this._register(new ue);this._register(ve(r=>{this._render(t.read(r))}))}_render(e){Ii(this._container),this._renderDisposables.value=void 0;let t;if(e===0?t=this._labels.disabledProfile:e===1&&(t=this._labels.disabledWorkspace),!t)return;let o=new he("",{isTrusted:!0,supportThemeIcons:!0});o.appendMarkdown(`$(${L.info.id})&nbsp;`),o.appendText(t);let n=this._markdownRendererService.render(o);this._renderDisposables.value=n,this._container.appendChild(n.element)}};cUe=I([m(3,_n)],cUe);var JMo={disabledProfile:d(8354,null),disabledWorkspace:d(8355,null)},yBg={disabledProfile:d(8352,null),disabledWorkspace:d(8353,null)};var E9=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(E9.ID,e,t,n,s);this.instantiationService=o;this.openerService=r;this.extensionService=l;this.webviewService=c;this.languageService=u;this.fileService=p;this.requestService=h;this.agentPluginService=g;this.pluginInstallService=f;this.pluginMarketplaceService=v;this.labelService=b;this.contextMenuService=S;this.pluginReadme=null;this.initialScrollProgress=new Map;this.currentIdentifier="";this.layoutParticipants=[];this.contentDisposables=this._register(new O);this.transientDisposables=this._register(new O);this.activeElement=null}static{this.ID="workbench.editor.agentPlugin"}createEditor(e){let t=D(e,_(".extension-editor.agent-plugin-editor"));t.tabIndex=0,t.style.outline="none",t.setAttribute("role","document");let o=D(t,_(".header")),n=D(o,_(".icon-container")),r=D(n,_("span.codicon.codicon-extensions"));r.style.fontSize="64px";let s=D(o,_(".details")),l=D(s,_(".title")),c=D(l,_("span.name",{role:"heading",tabIndex:0})),u=D(s,_(".description")),p=D(s,_(".subtitle")),h=D(p,_("span.subtitle-entry")),g=D(s,_(".actions-status-container")),f=this._register(new oo(g,{actionViewItemProvider:(y,w)=>{if(y instanceof _He)return new U4t(y,{...w,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>y.menuActions},menuActionClassNames:y.menuActionClassNames},this.contextMenuService)},focusOnlyEnabledItems:!0}));f.setFocusable(!0);let v=D(g,_(".status")),b=D(t,_(".body")),S=D(b,_(".content"));S.id=ht(),this.template={content:S,description:u,header:o,name:c,marketplace:h,actionBar:f,statusContainer:v}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.template&&await this.render(e.item,this.template)}async render(e,t){this.activeElement=null,this.transientDisposables.clear(),this.contentDisposables.clear(),t.content.innerText="";let o=new qe;this.transientDisposables.add(ee(()=>o.dispose(!0)));let n=o.token,r=e.kind==="installed"?e.plugin.uri.toString():`${e.marketplaceReference.canonicalId}/${e.source}`;this.currentIdentifier!==r&&(this.initialScrollProgress.clear(),this.currentIdentifier=r),this.pluginReadme=new pB(()=>this.fetchReadme(e,n)),t.name.textContent=e.name,t.description.textContent=e.description;let s=e.marketplace??"",l=e.kind==="marketplace"?e.marketplaceReference.githubRepo:e.plugin.fromMarketplace?.marketplaceReference.githubRepo;if(s&&l){let h=`https://github.com/${l}`,g=_("a.marketplace-link",{href:h},s);this.transientDisposables.add($(g,ne.CLICK,f=>{f.preventDefault(),f.stopPropagation(),this.openerService.open(A.parse(h))})),Ii(t.marketplace,g)}else Ii(t.marketplace,s);let c=ke(h=>{let g=this.agentPluginService.plugins.read(h),f=e;if(e.kind==="marketplace"){let v=this.pluginInstallService.getPluginInstallUri({name:e.name,description:e.description,version:"",source:e.source,sourceDescriptor:e.sourceDescriptor,marketplace:e.marketplace,marketplaceReference:e.marketplaceReference,marketplaceType:e.marketplaceType}),b=g.find(S=>S.uri.toString()===v.toString());b&&(f=this.installedPluginToItem(b))}else{let v=g.find(b=>b.uri.toString()===e.plugin.uri.toString());if(v)v.enablement.read(h),f=this.installedPluginToItem(v);else if(e.plugin.fromMarketplace){let b=e.plugin.fromMarketplace;f={kind:"marketplace",name:e.name,description:b.description,source:b.source,sourceDescriptor:b.sourceDescriptor,marketplace:b.marketplace,marketplaceReference:b.marketplaceReference,marketplaceType:b.marketplaceType,readmeUri:b.readmeUri}}else return}return f}),u=c.map((h,g)=>{if(!(!h||h.kind==="marketplace"))return this.pluginMarketplaceService.installedPlugins.read(g).find(f=>f.pluginUri.toString()===h.plugin.uri.toString())?.plugin??h.plugin.fromMarketplace}),p=this.transientDisposables.add(new O);this.transientDisposables.add(ve(h=>{p.clear(),t.actionBar.clear();let g=c.read(h);if(!g)return;this.pluginMarketplaceService.lastFetchedPlugins.read(h);let f=this.getItemActions(g,u.read(h));f.length>0&&t.actionBar.push(f,{icon:!0,label:!0});for(let v of f)p.add(v);g.kind==="installed"&&p.add(this.instantiationService.createInstance(cUe,t.statusContainer,g.plugin.enablement,JMo))})),this.activeElement=await this.openDetails(e,t,n)}getItemActions(e,t){if(e.kind==="marketplace")return[this.instantiationService.createInstance(u9,e)];let o=this.instantiationService.invokeFunction(r=>r.get(Ae)),n=[];if(t){let r=this.pluginMarketplaceService.lastFetchedPlugins.get(),s=`${t.marketplaceReference.canonicalId}::${t.name}`,l=r.find(c=>`${c.marketplaceReference.canonicalId}::${c.name}`===s);l&&OBe(t.sourceDescriptor,l.sourceDescriptor)&&n.push(this.instantiationService.createInstance(Fbe,e.plugin,l))}return n.push(MLo(e.plugin,this.agentPluginService.enablementModel,o)),n.push(PLo(e.plugin,this.agentPluginService.enablementModel,o)),n.push(new pct(e.plugin)),n}installedPluginToItem(e){let t=e.label,o=e.fromMarketplace?.description??this.labelService.getUriLabel(ai(e.uri),{relative:!0}),n=e.fromMarketplace?.marketplace;return{kind:"installed",name:t,description:o,marketplace:n,plugin:e}}async fetchReadme(e,t){let o;if(e.kind==="installed"?o=Ve(e.plugin.uri,"README.md"):o=e.readmeUri,!o)return"";if(o.scheme===Q.file||o.scheme===Q.vscodeRemote)try{return(await this.fileService.readFile(o)).value.toString()}catch{return""}if(o.scheme===Q.https){let n=o.toString(),r=n.match(/^https:\/\/github\.com\/(?<owner>[^/]+)\/(?<repo>[^/]+)\/blob\/(?<rest>.+)$/);r?.groups&&(n=`https://raw.githubusercontent.com/${r.groups.owner}/${r.groups.repo}/${r.groups.rest}`);try{let s=await this.requestService.request({type:"GET",url:n,callSite:"agentPluginEditor.fetchReadme"},t);return await jD(s)??""}catch{return""}}return""}async openDetails(e,t,o){let n=D(t.content,_(".details")),r=D(n,_(".content-container")),s=()=>n.classList.toggle("narrow",this.dimension!==void 0&&this.dimension.width<500);return s(),this.contentDisposables.add(ee(vg(this.layoutParticipants,{layout:s}))),this.openMarkdown(this.pluginReadme.get(),d(6690,null),r,0,d(6691,null),o)}async openMarkdown(e,t,o,n,r,s){try{let l=await this.renderMarkdown(e,o,s);if(s.isCancellationRequested)return null;let c=this.contentDisposables.add(this.webviewService.createWebviewOverlay({title:r,options:{enableFindWidget:!0,tryRestoreScrollPosition:!0,disableServiceWorker:!0},contentOptions:{},extension:void 0}));c.initialScrollProgress=this.initialScrollProgress.get(n)||0,c.claim(this,this.window,void 0),AL(c.container,o),c.setAnchorElement(o),c.setHtml(l),c.claim(this,this.window,void 0),this.contentDisposables.add(c.onDidFocus(()=>this._onDidFocus?.fire())),this.contentDisposables.add(c.onDidScroll(()=>this.initialScrollProgress.set(n,c.initialScrollProgress)));let u=vg(this.layoutParticipants,{layout:()=>{c.setAnchorElement(o)}});this.contentDisposables.add(ee(u));let p=!1;return this.contentDisposables.add(ee(()=>{p=!0})),this.contentDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let h=await this.renderMarkdown(e,o);p||c.setHtml(h)})),this.contentDisposables.add(c.onDidClickLink(h=>{h&&(hc(h,Q.http)||hc(h,Q.https)||hc(h,Q.mailto))&&this.openerService.open(h)})),c}catch{let c=D(o,_("p.nocontent"));return c.textContent=t,c}}async renderMarkdown(e,t,o){let n=await this.loadContents(()=>e,t);if(o?.isCancellationRequested)return"";let r=await P$(n,this.extensionService,this.languageService,{},o);return o?.isCancellationRequested?"":this.renderBody(r)}renderBody(e){let t=ht(),o=vc.getColorMap(),n=o?ED(o):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${t}';">
				<style nonce="${t}">
					${D1}

					body {
						padding-bottom: 75px;
					}

					#scroll-to-top {
						position: fixed;
						width: 32px;
						height: 32px;
						right: 25px;
						bottom: 25px;
						background-color: var(--vscode-button-secondaryBackground);
						border-color: var(--vscode-button-border);
						border-radius: 50%;
						cursor: pointer;
						box-shadow: 1px 1px 1px rgba(0,0,0,.25);
						outline: none;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					#scroll-to-top:hover {
						background-color: var(--vscode-button-secondaryHoverBackground);
						box-shadow: 2px 2px 2px rgba(0,0,0,.25);
					}

					body.vscode-high-contrast #scroll-to-top {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}

					#scroll-to-top span.icon::before {
						content: "";
						display: block;
						background: var(--vscode-button-secondaryForeground);
						-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						width: 16px;
						height: 16px;
					}
					${n}
				</style>
			</head>
			<body>
				<a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
				${e}
			</body>
		</html>`}loadContents(e,t){t.classList.add("loading");let o=this.contentDisposables.add(e()),n=()=>t.classList.remove("loading");return o.promise.then(n,n),o.promise}clearInput(){this.contentDisposables.clear(),this.transientDisposables.clear(),super.clearInput()}focus(){super.focus(),this.activeElement?.focus()}get activeWebview(){if(!(!this.activeElement||!this.activeElement.runFindAction))return this.activeElement}layout(e){this.dimension=e,this.layoutParticipants.forEach(t=>t.layout())}};E9=I([m(1,_e),m(2,F),m(3,Pe),m(4,Je),m(5,de),m(6,lt),m(7,Pu),m(8,Rt),m(9,ge),m(10,Ra),m(11,mm),m(12,uI),m(13,jC),m(14,nt),m(15,Xe)],E9);var Fbe=class extends it{constructor(e,t,o,n){super(Fbe.ID,d(6692,null),"extension-action label prominent install");this.plugin=e;this.liveMarketplacePlugin=t;this.pluginInstallService=o;this.pluginMarketplaceService=n}static{this.ID="agentPlugin.editor.update"}async run(){await this.pluginInstallService.updatePlugin(this.liveMarketplacePlugin)&&this.pluginMarketplaceService.addInstalledPlugin(this.plugin.uri,this.liveMarketplacePlugin)}};Fbe=I([m(2,uI),m(3,jC)],Fbe);var Cyn=Oe("agent-plugin-editor-icon",L.extensions,d(6693,null));function KVi(a){return a.kind==="installed"?a.plugin.uri.toString():`${a.marketplaceReference.canonicalId}/${a.source}`}var Rre=class a extends Ls{constructor(e){super();this._item=e}static{this.ID="workbench.agentPlugin.input"}get typeId(){return a.ID}get capabilities(){return super.capabilities|8|2048}get resource(){return A.from({scheme:Q.extension,path:`/agentPlugin/${encodeURIComponent(KVi(this._item))}`})}get item(){return this._item}getName(){return d(6694,null,this._item.name)}getIcon(){return Cyn}matches(e){return super.matches(e)?!0:e instanceof a&&KVi(this._item)===KVi(e._item)}};var Lre=le("pluginGitService");function pUe(a){return a.replace(/[\\/:*?"<>|]/g,"_")}function GVi(a,i){return i?[`sha_${pUe(i)}`]:a?[`ref_${pUe(a)}`]:[]}function xyn(a){return ii?`"${a.replace(/[`$"]/g,"`$&")}"`:`'${a.replace(/'/g,"'\\''")}'`}function kyn(a){let[i,...e]=a;return[i,...e.map(t=>xyn(t))].join(" ")}var dUe=class{constructor(i,e,t,o,n,r){this._commandService=i;this._fileService=e;this._logService=t;this._notificationService=o;this._pluginGit=n;this._progressService=r}getCleanupTarget(i,e){return this._getRepoDir(i,e)}_getRepoDir(i,e){return this.getInstallUri(i,e)}async ensure(i,e,t){let o=e.sourceDescriptor,n=this._getRepoDir(i,o),r=await this._fileService.exists(n),s=this._displayLabel(o);if(r)return await this._checkoutRevision(n,o,t?.failureLabel??s),this.getInstallUri(i,o);let l=t?.progressTitle??d(8391,null,s),c=t?.failureLabel??s,u=o.ref;return await this._cloneRepository(n,this._cloneUrl(o),l,c,u),await this._checkoutRevision(n,o,c),this.getInstallUri(i,o)}async update(i,e,t){let o=e.sourceDescriptor,n=this._getRepoDir(i,o);if(!await this._fileService.exists(n))return this._logService.warn(`[${this.kind}] Cannot update plugin '${t?.pluginName??e.name}': source repository not cloned`),!1;let s=t?.pluginName??e.name,l=t?.failureLabel??s;try{let c=async p=>{let h=o,g;if(h.sha){let f=await this._pluginGit.revParse(n,"HEAD").catch(()=>{});await this._pluginGit.fetch(n,p?.token),await this._checkoutRevision(n,o,l,p?.token);let v=await this._pluginGit.revParse(n,"HEAD").catch(()=>{});g=f!==v}else g=await this._pluginGit.pull(n,p?.token),await this._checkoutRevision(n,o,l,p?.token);return g};if(t?.silent)return await c();let u=new qe;try{return await this._progressService.withProgress({location:15,title:d(8403,null,s),cancellable:!0},()=>c(u),()=>u.dispose(!0))}finally{u.dispose()}}catch(c){throw this._logService.error(`[${this.kind}] Failed to update plugin source '${s}':`,c),t?.silent||this._notificationService.notify({severity:ft.Error,message:d(8400,null,l,c?.message??String(c))}),c}}async _cloneRepository(i,e,t,o,n){let r=new qe;try{await this._progressService.withProgress({location:15,title:t,cancellable:!0},async()=>{await this._fileService.createFolder(ai(i)),await this._pluginGit.cloneRepository(e,i,n,r.token)},()=>r.dispose(!0))}catch(s){throw this._logService.error(`[${this.kind}] Failed to clone ${e}:`,s),this._notificationService.notify({severity:ft.Error,message:d(8390,null,o,s?.message??String(s))}),s}finally{r.dispose()}}async _checkoutRevision(i,e,t,o){let n=e;if(!(!n.sha&&!n.ref))try{if(n.sha){await this._pluginGit.checkout(i,n.sha,!0,o);return}await this._pluginGit.checkout(i,n.ref,void 0,o)}catch(r){throw this._logService.error(`[${this.kind}] Failed to checkout revision for '${t}':`,r),this._notificationService.notify({severity:ft.Error,message:d(8389,null,t,r?.message??String(r))}),r}}};dUe=I([m(0,fe),m(1,ge),m(2,re),m(3,Ne),m(4,Lre),m(5,Go)],dUe);var M3t=class{constructor(){this.kind="relativePath"}getInstallUri(i,e){throw new Error("Use getPluginInstallUri() for relative-path sources")}async ensure(i,e,t){throw new Error("Use ensureRepository() for relative-path sources")}async update(i,e,t){throw new Error("Use pullRepository() for relative-path sources")}getCleanupTarget(i,e){}getLabel(i){return i.path||"."}},P3t=class extends dUe{constructor(){super(...arguments);this.kind="github"}getInstallUri(e,t){let o=this._getRepoDir(e,t),n=t;if(n.path){let r=n.path.trim().replace(/^\.?\/+|\/+$/g,"");if(r){let s=Ve(o,r);if(Yr(s,o))return s}}return o}_getRepoDir(e,t){let o=t,[n,r]=o.repo.split("/");return Ve(e,"github.com",n,r,...GVi(o.ref,o.sha))}getLabel(e){let t=e;return t.path?`${t.repo}/${t.path}`:t.repo}_cloneUrl(e){return`https://github.com/${e.repo}.git`}_displayLabel(e){return e.repo}},A3t=class extends dUe{constructor(){super(...arguments);this.kind="url"}getInstallUri(e,t){let o=t,n=this._gitUrlCacheSegments(o.url,o.ref,o.sha);return Ve(e,...n)}getLabel(e){return e.url}_cloneUrl(e){return e.url}_displayLabel(e){return e.url}_gitUrlCacheSegments(e,t,o){try{let n=A.parse(e),r=(n.authority||"unknown").replace(/[\\/:*?"<>|]/g,"_").toLowerCase(),l=n.path.replace(/^\/+/,"").replace(/\.git$/i,"").replace(/\/+$/g,"").split("/").map(c=>c.replace(/[\\/:*?"<>|]/g,"_"));return[r,...l,...GVi(t,o)]}catch{return["git",e.replace(/[\\/:*?"<>|]/g,"_"),...GVi(t,o)]}}},uUe=class{constructor(i,e,t,o,n,r){this._dialogService=i;this._fileService=e;this._logService=t;this._notificationService=o;this._progressService=n;this._terminalService=r}getCleanupTarget(i,e){return this._getCacheDir(i,e)}async ensure(i,e,t){let o=this._getCacheDir(i,e.sourceDescriptor);return await this._fileService.createFolder(o),o}async update(i,e,t){let o=this._getCacheDir(i,e.sourceDescriptor),n=this.getInstallUri(i,e.sourceDescriptor);return await this.runInstall(o,n,e,{silent:t?.silent}),!0}async runInstall(i,e,t,o){let n=this._buildInstallArgs(i,t),r=kyn(n);if(!await this._confirmTerminalCommand(t.name,r,o?.silent))return;let l=d(8397,null,this._managerName,t.name),{success:c,terminal:u}=await this._runTerminalCommand(r,l);if(!c)return;if(!await this._fileService.exists(e)){this._notificationService.notify({severity:ft.Error,message:d(8398,null,this._managerName,this.getLabel(t.sourceDescriptor))});return}return u?.dispose(),{pluginDir:e}}async _confirmTerminalCommand(i,e,t){if(t)return new Promise(n=>{let r=this._notificationService.notify({severity:ft.Info,message:d(8395,null,i,e),actions:{primary:[new it("installPlugin",d(8396,null),void 0,!0,async()=>n(!0))]}});U.once(r.onDidClose)(()=>n(!1))});let{confirmed:o}=await this._dialogService.confirm({type:"question",message:d(8393,null,i),detail:d(8394,null,e),primaryButton:d(8392,null)});return o}async _runTerminalCommand(i,e){let t;try{return await this._progressService.withProgress({location:15,title:e,cancellable:!1},async()=>{t=await this._terminalService.createTerminal({config:{name:d(8399,null),forceShellIntegration:!0,isTransient:!0,isFeatureTerminal:!0}}),await t.processReady,this._terminalService.setActiveInstance(t);let o=this._waitForTerminalCommandCompletion(t);await t.runCommand(i,!0);let n=await o;if(n!==0)throw new Error(d(8401,null,n))}),{success:!0,terminal:t}}catch(o){return this._logService.error(`[${this.kind}] Terminal command failed:`,o),this._notificationService.notify({severity:ft.Error,message:d(8402,null,o?.message??String(o))}),{success:!1,terminal:t}}}_waitForTerminalCommandCompletion(i){return new Promise(e=>{let t=new O,o=!1,n=l=>{o||(o=!0,t.dispose(),e(l))},r=()=>{let l=i.capabilities.get(2);l&&t.add(l.onCommandFinished(c=>{n(c.exitCode??0)}))};r(),t.add(i.capabilities.onDidAddCommandDetectionCapability(()=>r()));let s=Li(12e4);t.add(ee(()=>s.cancel())),s.then(()=>{o||(this._logService.warn(`[${this.kind}] Terminal command completion timed out`),n(void 0))})})}};uUe=I([m(0,ct),m(1,ge),m(2,re),m(3,Ne),m(4,Go),m(5,an)],uUe);var N3t=class extends uUe{constructor(){super(...arguments);this.kind="npm";this._managerName="npm"}getInstallUri(e,t){let o=t;return Ve(e,"npm",pUe(o.package),"node_modules",o.package)}getLabel(e){let t=e;return t.version?`${t.package}@${t.version}`:t.package}_getCacheDir(e,t){return Ve(e,"npm",pUe(t.package))}_buildInstallArgs(e,t){let o=t.sourceDescriptor,n=o.version?`${o.package}@${o.version}`:o.package,r=["npm","install","--prefix",e.fsPath,n];return o.registry&&r.push("--registry",o.registry),r}},O3t=class extends uUe{constructor(){super(...arguments);this.kind="pip";this._managerName="pip"}getInstallUri(e,t){return Ve(e,"pip",pUe(t.package))}getLabel(e){let t=e;return t.version?`${t.package}==${t.version}`:t.package}_getCacheDir(e,t){return Ve(e,"pip",pUe(t.package))}_buildInstallArgs(e,t){let o=t.sourceDescriptor,n=o.version?`${o.package}==${o.version}`:o.package,r=["pip","install","--target",e.fsPath,n];return o.registry&&r.push("--index-url",o.registry),r}};var F3t="chat.plugins.marketplaces.index.v1",mUe=class{constructor(i,e,t,o,n,r,s,l,c,u){this._commandService=i;this._fileService=t;this._logService=n;this._notificationService=r;this._pluginGit=s;this._progressService=l;this._storageService=c;this._marketplaceIndex=new uo(()=>this._loadMarketplaceIndex());this._cloneSequencer=new II;this.agentPluginsHome=u.currentProfile.agentPluginsHome;let p=Ve(e.cacheHome,"agentPlugins"),h=e.cacheHome.scheme==="file"?p:this.agentPluginsHome;this._cacheRoot=this.agentPluginsHome,ze(h,this.agentPluginsHome)?this._migrationDone=Promise.resolve():this._migrationDone=this._migrateDirectory(h),this._pluginSources=new Map([["relativePath",new M3t],["github",o.createInstance(P3t)],["url",o.createInstance(A3t)],["npm",o.createInstance(N3t)],["pip",o.createInstance(O3t)]])}getPluginSource(i){let e=this._pluginSources.get(i);if(!e)throw new Error(`No source repository registered for kind '${i}'`);return e}getRepositoryUri(i,e){if(i.kind==="localFileUri"&&i.localRepositoryUri)return i.localRepositoryUri;let t=this._marketplaceIndex.value.get(i.canonicalId);return t?.repositoryUri?t.repositoryUri:this._getRepoCacheDirForReference(i)}getPluginInstallUri(i){let e=this.getRepositoryUri(i.marketplaceReference,i.marketplaceType);return this._getPluginDir(e,i.source)}async ensureRepository(i,e){await this._migrationDone;let t=this.getRepositoryUri(i,e?.marketplaceType);return this._cloneSequencer.queue(t.fsPath,async()=>{if(await this._fileService.exists(t))return this._updateMarketplaceIndex(i,t,e?.marketplaceType),t;if(i.kind==="localFileUri")throw new Error(`Local marketplace repository does not exist: ${t.fsPath}`);let n=e?.progressTitle??d(6696,null,i.displayLabel),r=e?.failureLabel??i.displayLabel;return await this._cloneRepository(t,i.cloneUrl,n,r),this._updateMarketplaceIndex(i,t,e?.marketplaceType),t})}async pullRepository(i,e){let t=this.getRepositoryUri(i,e?.marketplaceType);if(!await this._fileService.exists(t))return this._logService.warn(`[AgentPluginRepositoryService] Cannot update plugin '${e?.pluginName??i.displayLabel}': repository not cloned`),!1;let n=e?.pluginName??i.displayLabel;try{if(e?.silent)return await this._pluginGit.pull(t);let r=new qe;try{return await this._progressService.withProgress({location:15,title:d(6699,null,n),cancellable:!0},()=>this._pluginGit.pull(t,r.token),()=>r.dispose(!0))}finally{r.dispose()}}catch(r){throw this._logService.error(`[AgentPluginRepositoryService] Failed to update ${i.displayLabel}:`,r),e?.silent||this._notificationService.notify({severity:ft.Error,message:d(6697,null,e?.failureLabel??n,r?.message??String(r)),actions:{primary:[new it("showGitOutput",d(6698,null),void 0,!0,()=>{this._commandService.executeCommand("git.showOutput")})]}}),r}}_getRepoCacheDirForReference(i){return Ve(this._cacheRoot,...i.cacheSegments)}_loadMarketplaceIndex(){let i=new Map,e=this._storageService.getObject(F3t,-1);if(!e)return i;let t=er(e);for(let[o,n]of Object.entries(t))!n||!n.repositoryUri||i.set(o,{repositoryUri:n.repositoryUri,marketplaceType:n.marketplaceType});return i}_updateMarketplaceIndex(i,e,t){if(i.kind==="localFileUri")return;let o=this._marketplaceIndex.value.get(i.canonicalId);o&&o.repositoryUri.toString()===e.toString()&&o.marketplaceType===t||(this._marketplaceIndex.value.set(i.canonicalId,{repositoryUri:e,marketplaceType:t}),this._saveMarketplaceIndex())}_saveMarketplaceIndex(){let i={};for(let[e,t]of this._marketplaceIndex.value)i[e]=JSON.parse(JSON.stringify({repositoryUri:t.repositoryUri,marketplaceType:t.marketplaceType}));if(Object.keys(i).length===0){this._storageService.remove(F3t,-1);return}this._storageService.store(F3t,JSON.stringify(i),-1,1)}async _cloneRepository(i,e,t,o,n){let r=new qe;try{await this._progressService.withProgress({location:15,title:t,cancellable:!0},async()=>{await this._fileService.createFolder(ai(i)),await this._pluginGit.cloneRepository(e,i,n,r.token)},()=>r.dispose(!0))}catch(s){throw this._logService.error(`[AgentPluginRepositoryService] Failed to clone ${e}:`,s),this._notificationService.notify({severity:ft.Error,message:d(6695,null,o,s?.message??String(s)),actions:{primary:[new it("showGitOutput",d(6698,null),void 0,!0,()=>{this._commandService.executeCommand("git.showOutput")})]}}),s}finally{r.dispose()}}_getPluginDir(i,e){let t=e.trim().replace(/^\.?\/+|\/+$/g,""),o=t?Ve(i,t):i;if(!Yr(o,i))throw new Error(`Invalid plugin source path '${e}'`);return o}getPluginSourceInstallUri(i){return this.getPluginSource(i.kind).getInstallUri(this._cacheRoot,i)}async ensurePluginSource(i,e){await this._migrationDone;let t=this.getPluginSource(i.sourceDescriptor.kind);return i.sourceDescriptor.kind==="relativePath"?this.ensureRepository(i.marketplaceReference,e):t.ensure(this._cacheRoot,i,e)}async updatePluginSource(i,e){let t=this.getPluginSource(i.sourceDescriptor.kind);return i.sourceDescriptor.kind==="relativePath"?this.pullRepository(i.marketplaceReference,e):t.update(this._cacheRoot,i,e)}async fetchRepository(i){let e=this.getRepositoryUri(i);if(!await this._fileService.exists(e))return!1;try{return await this._pluginGit.fetchRepository(e),await this._pluginGit.revListCount(e,"HEAD","@{u}")>0}catch(o){return this._logService.debug(`[AgentPluginRepositoryService] Silent fetch failed for ${i.displayLabel}:`,o),!1}}async cleanupPluginSource(i,e){let o=this.getPluginSource(i.sourceDescriptor.kind).getCleanupTarget(this._cacheRoot,i.sourceDescriptor);if(o){if(e&&e.some(r=>{let l=this.getPluginSource(r.kind).getCleanupTarget(this._cacheRoot,r);return l&&ze(l,o)})){this._logService.info(`[${i.sourceDescriptor.kind}] Skipping cleanup of shared cache: ${o.toString()}`);return}try{await this._fileService.exists(o)&&(await this._fileService.del(o,{recursive:!0}),this._logService.info(`[${i.sourceDescriptor.kind}] Removed plugin cache: ${o.toString()}`))}catch(n){this._logService.warn(`[${i.sourceDescriptor.kind}] Failed to remove plugin cache '${o.toString()}':`,n)}try{await this._pruneEmptyParents(o)}catch(n){this._logService.warn(`[${i.sourceDescriptor.kind}] Failed to cleanup plugin source:`,n)}}}async _pruneEmptyParents(i){if(!Yr(i,this._cacheRoot))return;let e=ai(i);for(;Yr(e,this._cacheRoot)&&!ze(e,this._cacheRoot);){try{let t=await this._fileService.resolve(e);if(t.children&&t.children.length>0)break;await this._fileService.del(e)}catch{break}e=ai(e)}}async _migrateDirectory(i){try{if(!await this._fileService.exists(i))return;if(await this._fileService.exists(this.agentPluginsHome)){this._logService.info("[AgentPluginRepositoryService] Both old and new agent-plugins directories exist; skipping directory migration");return}this._logService.info(`[AgentPluginRepositoryService] Migrating agent plugins from ${i.toString()} to ${this.agentPluginsHome.toString()}`),await this._fileService.move(i,this.agentPluginsHome,!1),this._storageService.remove(F3t,-1),this._marketplaceIndex.value.clear()}catch(e){this._logService.error("[AgentPluginRepositoryService] Directory migration failed",e)}}};mUe=I([m(0,fe),m(1,ko),m(2,ge),m(3,F),m(4,re),m(5,Ne),m(6,Lre),m(7,Go),m(8,de),m(9,gn)],mUe);var Eyn=new Set(["github.com","www.github.com"]);function ePo(a){let i;try{i=new URL(a)}catch{return}if(i.protocol!=="https:"||!Eyn.has(i.hostname.toLowerCase()))return;let t=i.pathname.replace(/^\/+/,"").replace(/\/+$/,"").replace(/\.git$/i,"").split("/");if(!(t.length!==2||!t[0]||!t[1]))return{owner:t[0],repo:t[1]}}async function $Vi(a,i,e){try{return await a.request({type:"GET",url:i.url,headers:i.headers,callSite:i.callSite},e)}catch(t){let o=t instanceof Error?`${t.name}: ${t.message}`:String(t);throw new Error(`Network error during ${i.callSite} (GET ${i.url}): ${o}`,{cause:t instanceof Error?t:void 0})}}async function W3t(a,i,e,t,o){let n=e&&e.length>0?encodeURIComponent(e):"HEAD",r=`https://api.github.com/repos/${encodeURIComponent(i.owner)}/${encodeURIComponent(i.repo)}/commits/${n}`,s={Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"};t&&(s.Authorization=`Bearer ${t}`);let l=await $Vi(a,{url:r,headers:s,callSite:"pluginGit.resolveSha"},o);if(o.isCancellationRequested)throw new qi;let c=l.res.statusCode??0;if(c===403&&jVi(l.res.headers))throw new Wbe(`GitHub rate limit hit resolving ref '${e??"HEAD"}' on ${i.owner}/${i.repo}`,QVi(l.res.headers));if(c===401||c===403)throw new T9(`GitHub returned ${c} resolving ref '${e??"HEAD"}' on ${i.owner}/${i.repo}`);if(c===404)throw new Error(`GitHub repository or ref not found: ${i.owner}/${i.repo}@${e??"HEAD"}`);if(!pE(l))throw new Error(`GitHub returned ${c}${Cpe(l)?" (client error)":""} resolving ref for ${i.owner}/${i.repo}`);let u=await Th(l);if(!u||typeof u.sha!="string")throw new Error(`GitHub commit response for ${i.owner}/${i.repo} missing 'sha' field`);return u.sha}var T9=class extends Error{constructor(i){super(i),this.name="GitHubAuthRequiredError"}},Wbe=class extends Error{constructor(e,t){super(e);this.retryAfterSeconds=t;this.name="GitHubRateLimitError"}};function jVi(a){return a?qVi(a,"x-ratelimit-remaining")==="0"?!0:qVi(a,"retry-after")!==void 0:!1}function QVi(a){if(!a)return;let i=qVi(a,"retry-after");if(!i)return;let e=parseInt(i,10);return Number.isFinite(e)?e:void 0}function qVi(a,i){let e=a[i]??a[i.toLowerCase()];return Array.isArray(e)?e[0]:e}async function V3t(a,i,e,t,o,n,r,s){let l=await _yn(a,t,o,r,s);l.truncated&&e.warn(`[GitHubRepoFetcher] Tree for ${t.owner}/${t.repo}@${o} is truncated; some files will be missing from the install`);let c=Ve(ai(n),`.staging-${ht()}`);try{await i.createFolder(c);let u=[],p=new Set([c.toString()]);for(let g of l.tree){if(s.isCancellationRequested)throw new qi;if(g.type==="commit"){e.trace(`[GitHubRepoFetcher] Skipping submodule entry ${g.path}`);continue}if(g.mode==="120000"){e.trace(`[GitHubRepoFetcher] Skipping symlink entry ${g.path}`);continue}let f=Ryn(c,g.path);if(!f){e.warn(`[GitHubRepoFetcher] Skipping unsafe tree entry path: ${g.path}`);continue}if(g.type==="tree"){p.has(f.toString())||(await i.createFolder(f),p.add(f.toString()));continue}if(g.type!=="blob"){e.trace(`[GitHubRepoFetcher] Skipping tree entry with unsupported type '${g.type}': ${g.path}`);continue}let v=ai(f);v.toString()!==f.toString()&&!p.has(v.toString())&&(await i.createFolder(v),p.add(v.toString())),u.push({entry:g,dest:f})}let h=new _k(Tyn);await Promise.all(u.map(({entry:g,dest:f})=>h.queue(async()=>{if(s.isCancellationRequested)throw new qi;let v=await Dyn(a,t,o,g,r,s);await i.writeFile(f,v)}))),await i.move(c,n,!0)}catch(u){try{await i.exists(c)&&await i.del(c,{recursive:!0})}catch(p){e.warn(`[GitHubRepoFetcher] Failed to clean up staging dir ${c.toString()}:`,p)}throw u}}var Tyn=10;async function _yn(a,i,e,t,o){let n=`https://api.github.com/repos/${encodeURIComponent(i.owner)}/${encodeURIComponent(i.repo)}/git/trees/${encodeURIComponent(e)}?recursive=1`,r={Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"};t&&(r.Authorization=`Bearer ${t}`);let s=await $Vi(a,{url:n,headers:r,callSite:"pluginGit.tree"},o);if(o.isCancellationRequested)throw new qi;let l=s.res.statusCode??0;if(l===403&&jVi(s.res.headers))throw new Wbe(`GitHub rate limit hit fetching tree for ${i.owner}/${i.repo}@${e}`,QVi(s.res.headers));if(l===401||l===403)throw new T9(`GitHub returned ${l} fetching tree for ${i.owner}/${i.repo}@${e}`);if(l===404)throw new Error(`GitHub repository or commit not found: ${i.owner}/${i.repo}@${e}`);if(!pE(s))throw new Error(`GitHub returned ${l}${Cpe(s)?" (client error)":""} fetching tree for ${i.owner}/${i.repo}@${e}`);let c=await Th(s);if(!c||!Array.isArray(c.tree))throw new Error(`GitHub tree response for ${i.owner}/${i.repo}@${e} missing 'tree' array`);return c}async function Dyn(a,i,e,t,o,n){let r=`https://api.github.com/repos/${encodeURIComponent(i.owner)}/${encodeURIComponent(i.repo)}/git/blobs/${encodeURIComponent(t.sha)}`,s={Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"};o&&(s.Authorization=`Bearer ${o}`);let l=await $Vi(a,{url:r,headers:s,callSite:"pluginGit.blob"},n);if(n.isCancellationRequested)throw new qi;let c=l.res.statusCode??0;if(c===403&&jVi(l.res.headers))throw new Wbe(`GitHub rate limit hit fetching blob '${t.path}' for ${i.owner}/${i.repo}@${e}`,QVi(l.res.headers));if(c===401||c===403)throw new T9(`GitHub returned ${c} fetching blob '${t.path}' for ${i.owner}/${i.repo}@${e}`);if(!pE(l))throw new Error(`GitHub returned ${c} fetching blob '${t.path}' for ${i.owner}/${i.repo}@${e}`);let u=await Th(l);if(!u||typeof u.content!="string")throw new Error(`GitHub blob response for '${t.path}' missing 'content' field`);if(u.encoding!=="base64")throw new Error(`GitHub blob response for '${t.path}' has unsupported encoding '${u.encoding}'`);return Ws(u.content.replace(/\s+/g,""))}function Ryn(a,i){if(i.includes("\0")||i.startsWith("/")||i.startsWith("\\"))return;let e=[];for(let o of i.split("/"))if(!(o.length===0||o===".")){if(o===".."||o.includes("\\"))return;e.push(o)}if(e.length===0)return;let t=Ve(a,...e);if(Yr(t,a))return t}var YVi="chat.plugins.browserCache.v1",hUe=class{constructor(i,e,t,o,n){this._fileService=i;this._logService=e;this._requestService=t;this._storageService=o;this._authenticationService=n}async cloneRepository(i,e,t,o){let n=this._parseOrThrow(i),r=o??Ie.None,s=async p=>{let h=await W3t(this._requestService,n,t,p,r);await V3t(this._requestService,this._fileService,this._logService,n,h,e,p,r),this._setCacheEntry(e,{owner:n.owner,repo:n.repo,ref:t,sha:h,fetchedAt:Date.now()})},l=await this._lookupGitHubToken(),c=[async()=>l];l&&c.push(async()=>{}),c.push(()=>this._requestGitHubToken(n));let u;for(let p of c){if(r.isCancellationRequested)throw new qi;try{await s(await p());return}catch(h){if(u=h,this._maybeLogTransientError(h,n),!(h instanceof T9))throw h}}throw u instanceof T9?new Error(d(8367,null,`${n.owner}/${n.repo}`)):u}async pull(i,e){let t=this._getCacheEntry(i);if(!t)throw new Error(`Cannot pull plugin: no cached metadata for ${i.toString()}`);let o=e??Ie.None,n=await this._lookupGitHubToken(),r={owner:t.owner,repo:t.repo};try{let s=await W3t(this._requestService,r,t.ref,n,o);return s===t.sha?!1:(await V3t(this._requestService,this._fileService,this._logService,r,s,i,n,o),this._setCacheEntry(i,{...t,sha:s,fetchedAt:Date.now()}),!0)}catch(s){throw this._maybeLogTransientError(s,r),s}}async checkout(i,e,t,o){let n=this._getCacheEntry(i);if(!n)throw new Error(`Cannot checkout plugin: no cached metadata for ${i.toString()}`);let r=o??Ie.None,s=await this._lookupGitHubToken(),l={owner:n.owner,repo:n.repo},c=e.trim(),u=/^[0-9a-f]{40}$/i.test(c),p=u?c.toLowerCase():await W3t(this._requestService,l,c,s,r);if(p!==n.sha.toLowerCase())try{await V3t(this._requestService,this._fileService,this._logService,l,p,i,s,r),this._setCacheEntry(i,{...n,ref:u?n.ref:c,sha:p,fetchedAt:Date.now()})}catch(h){throw this._maybeLogTransientError(h,l),h}}async revParse(i,e){let t=this._getCacheEntry(i);if(!t)throw new Error(`Cannot resolve ref: no cached metadata for ${i.toString()}`);let o=e.trim();if(/^[0-9a-f]{40}$/i.test(o)&&o.toLowerCase()!==t.sha.toLowerCase())throw new Error(`Cannot resolve ref '${e}' in tree-cached plugin: only HEAD/${t.sha} is materialised`);return t.sha}async fetch(i,e){}async fetchRepository(i,e){}async revListCount(i,e,t){return 0}_parseOrThrow(i){let e=ePo(i);if(!e)throw new Error(d(8369,null,i));return e}_maybeLogTransientError(i,e){if(i instanceof T9)this._logService.warn(`[BrowserPluginGitCommandService] GitHub auth required for ${e.owner}/${e.repo}: ${i.message}`);else if(i instanceof Wbe){let t=i.retryAfterSeconds!==void 0?` (retry after ${i.retryAfterSeconds}s)`:"";this._logService.warn(`[BrowserPluginGitCommandService] GitHub rate limit hit for ${e.owner}/${e.repo}${t}: ${i.message}`)}else if(i instanceof Error){let t=i.cause instanceof Error?` (cause: ${i.cause.name}: ${i.cause.message})`:"";this._logService.error(`[BrowserPluginGitCommandService] Clone failed for ${e.owner}/${e.repo}: ${i.message}${t}`)}}async _lookupGitHubToken(){try{let i=await this._authenticationService.getSessions("github",[],{silent:!0});return i.length===0?void 0:i.find(t=>t.scopes.includes("repo"))?.accessToken??i[0].accessToken}catch(i){this._logService.trace("[BrowserPluginGitCommandService] Silent GitHub session lookup failed:",i);return}}async _requestGitHubToken(i){try{return(await this._authenticationService.createSession("github",["repo"],{activateImmediate:!0})).accessToken}catch(e){throw this._logService.trace("[BrowserPluginGitCommandService] GitHub session request failed:",e),new Error(d(8368,null,`${i.owner}/${i.repo}`))}}_cacheKey(i){return m8i(i,!0)}async _pruneStaleEntries(i,e){let t=[];if(await Promise.all(Array.from(e,async([o,n])=>{try{await this._fileService.exists(n)||t.push(o)}catch{}})),t.length!==0){for(let o of t)i.delete(o);this._logService.trace(`[BrowserPluginGitCommandService] Pruned ${t.length} stale cache entries`),this._persistCache()}}_ensureCacheLoaded(){if(this._cache)return this._cache;let i=new Map,e=this._storageService.getObject(YVi,-1),t=new Map;if(e){for(let[o,n]of Object.entries(e))if(n&&typeof n.sha=="string"&&typeof n.owner=="string"&&typeof n.repo=="string"){i.set(o,{owner:n.owner,repo:n.repo,ref:typeof n.ref=="string"?n.ref:void 0,sha:n.sha,fetchedAt:typeof n.fetchedAt=="number"?n.fetchedAt:0});try{t.set(o,A.parse(o))}catch{i.delete(o)}}}return this._cache=i,t.size>0&&this._pruneStaleEntries(i,t).catch(o=>{this._logService.trace("[BrowserPluginGitCommandService] Cache prune failed:",o)}),i}_getCacheEntry(i){return this._ensureCacheLoaded().get(this._cacheKey(i))}_setCacheEntry(i,e){this._ensureCacheLoaded().set(this._cacheKey(i),e),this._persistCache()}_persistCache(){if(!this._cache)return;let i={};for(let[e,t]of this._cache)i[e]=t;if(Object.keys(i).length===0){this._storageService.remove(YVi,-1);return}this._storageService.store(YVi,JSON.stringify(i),-1,1)}};hUe=I([m(0,ge),m(1,re),m(2,Ra),m(3,de),m(4,ks)],hUe);var gUe=class{constructor(i,e,t,o,n,r,s,l,c,u){this._pluginRepositoryService=i;this._pluginMarketplaceService=e;this._fileService=t;this._notificationService=o;this._dialogService=n;this._logService=r;this._progressService=s;this._commandService=l;this._quickInputService=c;this._configurationService=u}async installPlugin(i){if(!await this._ensureMarketplaceTrusted(i))throw new qi;let e=i.sourceDescriptor.kind;if(e==="relativePath")return this._installRelativePathPlugin(i);if(e==="npm"||e==="pip"){await this._installPackagePlugin(i);return}return this._installGitPlugin(i)}async installPluginFromSource(i,e){let t=Cw(i);if(!t){this._notificationService.notify({severity:ft.Error,message:d(8374,null,i)});return}if(t.kind==="localFileUri"){this._notificationService.notify({severity:ft.Error,message:d(8375,null)});return}let o=await this._doInstallFromSource(t,e);!o.success&&o.message&&this._notificationService.notify({severity:ft.Error,message:o.message})}validatePluginSource(i){let e=Cw(i);if(!e)return d(8374,null,i);if(e.kind==="localFileUri")return d(8375,null)}async installPluginFromValidatedSource(i,e){let t=Cw(i);return t?t.kind==="localFileUri"?{success:!1,message:d(8375,null)}:this._doInstallFromSource(t,e):{success:!1,message:d(8374,null,i)}}async _doInstallFromSource(i,e){let t=i.kind==="githubShorthand"?{kind:"github",repo:i.githubRepo}:{kind:"url",url:i.cloneUrl},o={name:i.displayLabel,description:"",version:"",source:"",sourceDescriptor:t,marketplace:i.displayLabel,marketplaceReference:i,marketplaceType:"openPlugin"};if(!await this._ensureMarketplaceTrusted(o))return{success:!1};let n;try{n=await this._pluginRepositoryService.ensurePluginSource(o,{progressTitle:d(8372,null,i.displayLabel),failureLabel:i.displayLabel,marketplaceType:"openPlugin"})}catch(u){let p=u instanceof Error?u.message:String(u);return{success:!1,message:d(8371,null,i.displayLabel,p)}}if(!await this._fileService.exists(n))return{success:!1,message:d(8370,null,i.displayLabel)};let s=await this._pluginMarketplaceService.readPluginsFromDirectory(n,i);if(s.length===0){let u=await this._pluginMarketplaceService.readSinglePluginManifest(n,i);return u?e?.plugin&&e.plugin!==u.name?{success:!1,message:d(8379,null,e.plugin,i.displayLabel)}:(await this.installPlugin(u),e?.plugin?{success:!0,matchedPlugin:u}:{success:!0}):(this._pluginRepositoryService.cleanupPluginSource(o),{success:!1,message:d(8376,null,i.displayLabel)})}if(e?.plugin){let u=s.find(p=>p.name===e.plugin);return u?(await this._addMarketplaceToConfig(i),await this.installPlugin(u),{success:!0,matchedPlugin:u}):{success:!1,message:d(8379,null,e.plugin,i.displayLabel)}}if(s.length===1)return await this._addMarketplaceToConfig(i),await this.installPlugin(s[0]),{success:!0};let l=s.map(u=>({label:u.name,description:u.description,plugin:u})),c=await this._quickInputService.pick(l,{placeHolder:d(8381,null,i.displayLabel),canPickMany:!1});return c?(await this._addMarketplaceToConfig(i),await this.installPlugin(c.plugin),{success:!0}):{success:!1}}_addMarketplaceToConfig(i){let e=this._configurationService.getValue("chat.plugins.marketplaces")??[];if(!$6(e).some(o=>o.canonicalId===i.canonicalId))return this._configurationService.updateValue("chat.plugins.marketplaces",[...e,i.rawValue])}async updatePlugin(i,e){let t=i.sourceDescriptor.kind;return t==="npm"||t==="pip"?this._installPackagePlugin(i,e):this._pluginRepositoryService.updatePluginSource(i,{pluginName:i.name,failureLabel:i.name,marketplaceType:i.marketplaceType})}async updateAllPlugins(i,e){let t=this._pluginMarketplaceService.installedPlugins.get();if(t.length===0)return{updatedNames:[],failedNames:[]};let o=[],n=[],r=async()=>{let s=[],l=[],c=new Set;for(let g of t){let f=g.plugin.marketplaceReference;c.has(f.canonicalId)||(c.add(f.canonicalId),s.push((async()=>{if(!e.isCancellationRequested)try{await this._pluginRepositoryService.pullRepository(f,{pluginName:f.displayLabel,failureLabel:f.displayLabel,marketplaceType:g.plugin.marketplaceType,silent:i.silent})&&o.push(f.displayLabel)}catch(v){this._logService.error(`[PluginInstallService] Failed to pull marketplace '${f.displayLabel}':`,v),n.push(f.displayLabel)}})()))}await Promise.all(s);let u=await this._pluginMarketplaceService.fetchMarketplacePlugins(e),p=new Map;for(let g of u)p.set(`${g.marketplaceReference.canonicalId}::${g.name}`,g);let h=[];for(let g of t){if(g.plugin.sourceDescriptor.kind==="relativePath")continue;let f=p.get(`${g.plugin.marketplaceReference.canonicalId}::${g.plugin.name}`);if(!f||!OBe(g.plugin.sourceDescriptor,f.sourceDescriptor))continue;let v=f.sourceDescriptor;if(v.kind==="npm"||v.kind==="pip"){if(!i.force&&!v.version)continue;l.push({installed:g.plugin,marketplace:f});continue}h.push((async()=>{if(!e.isCancellationRequested)try{await this._pluginRepositoryService.updatePluginSource(f,{pluginName:f.name,failureLabel:f.name,marketplaceType:f.marketplaceType,silent:i.silent})&&(o.push(f.name),this._pluginMarketplaceService.addInstalledPlugin(g.pluginUri,f))}catch(b){this._logService.error(`[PluginInstallService] Failed to update plugin '${f.name}':`,b),n.push(f.name)}})())}await Promise.all(h);for(let{installed:g,marketplace:f}of l){if(e.isCancellationRequested)return;try{if(await this.updatePlugin(f,i?.silent)){o.push(f.name);let b=this._pluginRepositoryService.getPluginSourceInstallUri(f.sourceDescriptor);this._pluginMarketplaceService.addInstalledPlugin(b,f)}}catch(v){this._logService.error(`[PluginInstallService] Failed to update plugin '${f.name}':`,v),n.push(f.name)}}};return i.silent?await r():await this._progressService.withProgress({location:15,title:d(8388,null)},r),n.length>0?this._notificationService.notify({severity:ft.Error,message:d(8386,null,n.join(", ")),actions:{primary:[new it("showGitOutput",d(8382,null),void 0,!0,()=>{this._commandService.executeCommand("git.showOutput")})]}}):o.length>0?(this._pluginMarketplaceService.clearUpdatesAvailable(),this._notificationService.notify({severity:ft.Info,message:d(8387,null,o.join(", "))})):e.isCancellationRequested||this._pluginMarketplaceService.clearUpdatesAvailable(),{updatedNames:o,failedNames:n}}getPluginInstallUri(i){return i.sourceDescriptor.kind==="relativePath"?this._pluginRepositoryService.getPluginInstallUri(i):this._pluginRepositoryService.getPluginSourceInstallUri(i.sourceDescriptor)}async _ensureMarketplaceTrusted(i){if(this._pluginMarketplaceService.isMarketplaceTrusted(i.marketplaceReference))return!0;let{confirmed:e}=await this._dialogService.confirm({type:"question",message:d(8384,null,i.marketplaceReference.displayLabel),detail:d(8385,null,i.marketplaceReference.rawValue),primaryButton:d(8383,null),custom:{icon:L.shield}});return e?(this._pluginMarketplaceService.trustMarketplace(i.marketplaceReference),!0):!1}async _installRelativePathPlugin(i){try{await this._pluginRepositoryService.ensureRepository(i.marketplaceReference,{progressTitle:d(8373,null,i.name),failureLabel:i.name,marketplaceType:i.marketplaceType})}catch{return}let e;try{e=this._pluginRepositoryService.getPluginInstallUri(i)}catch{this._notificationService.notify({severity:ft.Error,message:d(8377,null,i.source,i.marketplace)});return}if(!await this._fileService.exists(e)){this._notificationService.notify({severity:ft.Error,message:d(8378,null,i.source,i.marketplace)});return}this._pluginMarketplaceService.addInstalledPlugin(e,i)}async _installGitPlugin(i){let e=this._pluginRepositoryService.getPluginSource(i.sourceDescriptor.kind),t;try{t=await this._pluginRepositoryService.ensurePluginSource(i,{progressTitle:d(8373,null,i.name),failureLabel:i.name,marketplaceType:i.marketplaceType})}catch{return}if(!await this._fileService.exists(t)){this._notificationService.notify({severity:ft.Error,message:d(8380,null,e.getLabel(i.sourceDescriptor))});return}this._pluginMarketplaceService.addInstalledPlugin(t,i)}async _installPackagePlugin(i,e){let t=this._pluginRepositoryService.getPluginSource(i.sourceDescriptor.kind);if(!t.runInstall)return this._logService.error(`[PluginInstallService] Expected package repository for kind '${i.sourceDescriptor.kind}'`),!1;let o=await this._pluginRepositoryService.ensurePluginSource(i),n=this._pluginRepositoryService.getPluginSourceInstallUri(i.sourceDescriptor),r=await t.runInstall(o,n,i,{silent:e});return r?(this._pluginMarketplaceService.addInstalledPlugin(r.pluginDir,i),!0):!1}};gUe=I([m(0,g$),m(1,jC),m(2,ge),m(3,Ne),m(4,ct),m(5,re),m(6,Go),m(7,fe),m(8,$e),m(9,B)],gUe);var Vbe=class extends k{constructor(e,t,o,n){super();this._pluginMarketplaceService=e;this._pluginInstallService=t;this._configurationService=o;this._logService=n;this._updateInFlight=!1;this._register(ve(r=>{this._pluginMarketplaceService.hasUpdatesAvailable.read(r)&&this._triggerAutoUpdate()}))}static{this.ID="workbench.contrib.pluginAutoUpdate"}async _triggerAutoUpdate(){if(!(this._updateInFlight||this._configurationService.getValue(JI)!==!0)){this._updateInFlight=!0;try{await this._pluginInstallService.updateAllPlugins({silent:!0},Ie.None)}catch(t){this._logService.error("[PluginAutoUpdate] Failed to auto-update plugins:",t)}finally{this._updateInFlight=!1,this._pluginMarketplaceService.clearUpdatesAvailable()}}}};Vbe=I([m(0,jC),m(1,uI),m(2,B),m(3,re)],Vbe);var Fct=le("remoteCodingAgentsService"),Oct=class extends k{constructor(e){super();this.contextKeyService=e;this.agents=[];this.contextKeys=new Set;this._ctxHasRemoteCodingAgent=Z.hasRemoteCodingAgent.bindTo(this.contextKeyService),this._register(U.filter(e.onDidChangeContext,t=>t.affectsSome(this.contextKeys))(()=>{this.updateContextKeys()}))}getRegisteredAgents(){return[...this.agents]}getAvailableAgents(){return this.agents.filter(e=>this.isAgentAvailable(e))}registerAgent(e){let t=this.agents.findIndex(o=>o.id===e.id);if(t>=0?this.agents[t]=e:this.agents.push(e),e.when){let o=C.deserialize(e.when);if(o)for(let n of o.keys())this.contextKeys.add(n)}this.updateContextKeys()}isAgentAvailable(e){if(!e.when)return!0;let t=C.deserialize(e.when);return!t||this.contextKeyService.contextMatchesRules(t)}updateContextKeys(){let e=this.getAvailableAgents().length>0;this._ctxHasRemoteCodingAgent.set(e)}};Oct=I([m(0,X)],Oct);Ce(Fct,Oct,1);var Mre=class extends k{constructor(e,t,o,n,r){super();this._editor=e;this._commandService=t;this._contextKeyService=o;this._remoteCodingAgentService=n;this._promptsService=r;this._isVisible=!1;this._domNode=_(".prompt-coding-agent-action-overlay"),this._button=this._register(new Pi(this._domNode,{supportIcons:!0,title:d(8553,null)})),this._button.element.style.background="var(--vscode-button-background)",this._button.element.style.color="var(--vscode-button-foreground)",this._button.label=d(8554,null,"$(cloud-upload)"),this._register(this._button.onDidClick(async()=>{await this._execute()})),this._register(this._contextKeyService.onDidChangeContext(()=>{this._updateVisibility()})),this._register(this._editor.onDidChangeModel(()=>{this._updateVisibility()})),this._register(this._editor.onDidLayoutChange(()=>{this._isVisible&&this._editor.layoutOverlayWidget(this)})),this._updateVisibility()}static{this.ID="promptCodingAgentActionOverlay"}getId(){return Mre.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:1}:null}_updateVisibility(){let e=Z.enableRemoteCodingAgentPromptFileOverlay.getValue(this._contextKeyService),t=Z.hasRemoteCodingAgent.getValue(this._contextKeyService),r=!!(this._editor.getModel()?.getLanguageId()===r_&&e&&t);r!==this._isVisible&&(this._isVisible=r,this._isVisible?this._editor.addOverlayWidget(this):this._editor.removeOverlayWidget(this))}async _execute(){let e=this._editor.getModel();if(e){this._button.enabled=!1;try{let t=e.getValue(),o=await this._promptsService.getPromptSlashCommandName(e.uri,Ie.None),r=this._remoteCodingAgentService.getAvailableAgents()[0];if(!r)return;await this._commandService.executeCommand(r.command,{userPrompt:o,summary:t,source:"prompt"})}finally{this._button.enabled=!0}}}dispose(){this._isVisible&&this._editor.removeOverlayWidget(this),super.dispose()}};Mre=I([m(1,fe),m(2,X),m(3,Fct),m(4,jr)],Mre);var fUe=class extends k{constructor(e,t){super();this._editor=e;this._instantiationService=t;this._overlayWidgets=this._register(new Ot);this._register(this._editor.onDidChangeModel(()=>{this._updateOverlayWidget()})),this._updateOverlayWidget()}static{this.ID="promptCodingAgentActionContribution"}_updateOverlayWidget(){let e=this._editor.getModel();if(this._overlayWidgets.deleteAndDispose(this._editor),e&&e.getLanguageId()===r_){let t=this._instantiationService.createInstance(Mre,this._editor);this._overlayWidgets.set(this._editor,t)}}};fUe=I([m(1,F)],fUe);Eo(fUe.ID,fUe,1);var Wct=class extends k{constructor(e,t,o,n){super();this.promptsService=e;this.languageService=t;this.languageModelToolsService=o;this.instantiationService=n;this.cmdId=`_configure/${ht()}`;this._register(this.languageService.codeLensProvider.register(A2,this)),this._register(Ge.registerCommand(this.cmdId,(r,...s)=>{let[l,c,u,p,h]=s,g=l;VY(g)&&G.isIRange(c)&&Xa(u)&&Array.isArray(p)&&JPt(h)&&this.updateTools(g,G.lift(c),u,p,h)}))}async provideCodeLenses(e,t){let o=bC(e.getLanguageId());if(!o||o==="instructions")return;let r=this.promptsService.getParsedPromptFile(e).header;if(!r)return;let s=Ax(o,r);if(!WZ(s))return;let l=r.getAttribute(no.tools);if(!l)return;let c=l.value;if(c.type==="scalar"&&(c=AH(c)),c.type!=="sequence")return;let p=c.items.filter(g=>g.type==="scalar").map(g=>g.value);return{lenses:[{range:l.range.collapseToStart(),command:{title:d(8555,null),id:this.cmdId,arguments:[e,l.value.range,l.value.type==="scalar",p,s]}}]}}async updateTools(e,t,o,n,r){let s=()=>this.languageModelToolsService.toToolAndToolSetEnablementMap(n,void 0),l=await this.instantiationService.invokeFunction(nqt,d(8556,null),"codeLens",void 0,s);l&&this.instantiationService.createInstance(Vq).rewriteTools(e,l,t,o)}};Wct=I([m(0,jr),m(1,Jt),m(2,Wn),m(3,F)],Wct);Qk(Wct);var Bbe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.environmentService=u;this._store.add(e.registerSlashCommand({command:"clear",detail:d(8227,null),sortText:"z2_clear",executeImmediately:!0,locations:["panel"]},async(g,f,v,b,S)=>{r.getSession(S)?.setArchived(!0),t.executeCommand(Mh)})),this._store.add(e.registerSlashCommand({command:"hooks",detail:d(8233,null),sortText:"z3_hooks",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local]},async()=>{await n.invokeFunction(RBe)})),this._store.add(e.registerSlashCommand({command:"models",detail:d(8235,null),sortText:"z3_models",executeImmediately:!0,silent:!0,locations:["panel"]},async()=>{await t.executeCommand(Soe.ID)})),this._store.add(e.registerSlashCommand({command:"tools",detail:d(8240,null),sortText:"z3_tools",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local]},async()=>{await t.executeCommand(qfe.ID)})),this._store.add(e.registerSlashCommand({command:"plugins",detail:d(8236,null),sortText:"z3_plugins",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local]},async()=>{await t.executeCommand(Mlt.ID)})),this.environmentService.isSessionsWindow||this._store.add(e.registerSlashCommand({command:"debug",detail:d(8228,null),sortText:"z3_debug",executeImmediately:!0,silent:!0,locations:["panel"]},async()=>{await t.executeCommand("github.copilot.debug.showChatLogView")})),this._store.add(e.registerSlashCommand({command:"agents",detail:d(8223,null),sortText:"z3_agents",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local]},async()=>{await t.executeCommand(ZQ.ID)})),this._store.add(e.registerSlashCommand({command:"skills",detail:d(8239,null),sortText:"z3_skills",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local]},async()=>{await t.executeCommand($Fi)})),this._store.add(e.registerSlashCommand({command:"instructions",detail:d(8234,null),sortText:"z3_instructions",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local]},async()=>{await t.executeCommand(S5t)})),this._store.add(e.registerSlashCommand({command:"prompts",detail:d(8237,null),sortText:"z3_prompts",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local]},async()=>{await t.executeCommand(GFi)})),this._store.add(e.registerSlashCommand({command:"fork",detail:d(8232,null),sortText:"z2_fork",executeImmediately:!0,silent:!0,locations:["panel"],when:C.or(Z.lockedToCodingAgent.negate(),Z.chatSessionSupportsFork)},async(g,f,v,b,S)=>{await t.executeCommand("workbench.action.chat.forkConversation",S)})),this._store.add(e.registerSlashCommand({command:"rename",detail:d(8238,null),sortText:"z2_rename",executeImmediately:!1,silent:!0,locations:["panel"],sessionTypes:[_d.Local]},async(g,f,v,b,S)=>{let y=g.trim();y&&s.setChatSessionTitle(S,y)}));let p=(g,f)=>{let v=c.getWidgetBySessionResource(g)??c.lastFocusedWidget;v&&v.input.setPermissionLevel(f)};l.inspect("chat.tools.global.autoApprove").policyValue!==!1&&(this._store.add(e.registerSlashCommand({command:"autoApprove",detail:d(8224,null),sortText:"z1_autoApprove",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local,_d.CopilotCLI]},async(g,f,v,b,S)=>{p(S,"autoApprove")})),this._store.add(e.registerSlashCommand({command:"disableAutoApprove",detail:d(8229,null),sortText:"z1_disableAutoApprove",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local,_d.CopilotCLI]},async(g,f,v,b,S)=>{p(S,"default")})),this._store.add(e.registerSlashCommand({command:"yolo",detail:d(8241,null),sortText:"z1_yolo",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local,_d.CopilotCLI]},async(g,f,v,b,S)=>{p(S,"autoApprove")})),this._store.add(e.registerSlashCommand({command:"disableYolo",detail:d(8230,null),sortText:"z1_disableYolo",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local,_d.CopilotCLI]},async(g,f,v,b,S)=>{p(S,"default")})),l.getValue("chat.autopilot.enabled")!==!1&&(this._store.add(e.registerSlashCommand({command:"autopilot",detail:d(8225,null),sortText:"z1_autopilot",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local,_d.CopilotCLI]},async(g,f,v,b,S)=>{p(S,"autopilot")})),this._store.add(e.registerSlashCommand({command:"exitAutopilot",detail:d(8231,null),sortText:"z1_exitAutopilot",executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[_d.Local,_d.CopilotCLI]},async(g,f,v,b,S)=>{p(S,"default")})))),this._store.add(e.registerSlashCommand({command:"help",detail:"",sortText:"z1_help",executeImmediately:!0,locations:["panel"],modes:["ask"],sessionTypes:[_d.Local]},async(g,f,v,b,S)=>{let y=o.getDefaultAgent("panel"),w=o.getAgents();y?.metadata.helpTextPrefix&&(yr(y.metadata.helpTextPrefix)?f.report({content:y.metadata.helpTextPrefix,kind:"markdownContent"}):f.report({content:new he(y.metadata.helpTextPrefix),kind:"markdownContent"}),f.report({content:new he(`

`),kind:"markdownContent"}));let x=(await Promise.all(w.filter(E=>!E.isDefault&&!E.isCore).filter(E=>E.locations.includes("panel")).map(async E=>{let M=E.description?`- ${E.description}`:"",V=`- ${n.invokeFunction(K=>dAi(E,S,!0,K))} ${M}`,H=E.slashCommands.map(K=>{let j=K.description?`- ${K.description}`:"";return`	* ${Exo(E,K,S)} ${j}`}).join(`
`);return(V+`
`+H).trim()}))).join(`
`);f.report({content:new he(x,{isTrusted:{enabledCommands:[cO.ID]}}),kind:"markdownContent"}),y?.metadata.helpTextPostfix&&(f.report({content:new he(`

`),kind:"markdownContent"}),yr(y.metadata.helpTextPostfix)?f.report({content:y.metadata.helpTextPostfix,kind:"markdownContent"}):f.report({content:new he(y.metadata.helpTextPostfix),kind:"markdownContent"})),await Li(200)}))}static{this.ID="workbench.contrib.chatSlashCommands"}};Bbe=I([m(0,rN),m(1,fe),m(2,gr),m(3,F),m(4,Vc),m(5,si),m(6,B),m(7,Lt),m(8,Mt)],Bbe);var Hbe=class extends k{constructor(e,t,o){super();this.chatSessionsService=e;this.slashCommandService=t;this.logService=o;this._registrationsByType=this._register(new Ot);this._register(this.chatSessionsService.onDidChangeOptionGroups(n=>{this.refreshForSessionType(n)}))}static{this.ID="workbench.contrib.chatSessionOptionSlashCommands"}refreshForSessionType(e){this._registrationsByType.deleteAndDispose(e);let t=this.chatSessionsService.getOptionGroupsForSessionType(e);if(!t||t.length===0)return;let o=new O,n=new Set;for(let r of t)for(let s of r.items){let l=s.slashCommand?.trim();if(l){if(n.has(l)){this.logService.warn(`[ChatSessionOptionSlashCommands] Skipping duplicate slash command '${l}' contributed by session type '${e}'.`);continue}if(this.slashCommandService.hasCommand(l,e)){this.logService.warn(`[ChatSessionOptionSlashCommands] Slash command '${l}' contributed by session type '${e}' is already registered; skipping.`);continue}n.add(l),o.add(this.registerOne(e,r,s,l))}}if(o.isDisposed||n.size===0){o.dispose();return}this._registrationsByType.set(e,o)}registerOne(e,t,o,n){return this.slashCommandService.registerSlashCommand({command:n,detail:o.description??d(8226,null,o.name),sortText:`z1_${n}`,executeImmediately:!0,silent:!0,locations:["panel"],sessionTypes:[e]},async(r,s,l,c,u)=>{u&&this.chatSessionsService.setSessionOption(u,t.id,o)})}};Hbe=I([m(0,Ms),m(1,rN),m(2,re)],Hbe);var Vct=R.for("planReviewFeedback.editorContent"),Ube=new Y("planReviewFeedback.hasFeedback",!1),Lyn="planReviewFeedback.action.navigatePrevious",Myn="planReviewFeedback.action.navigateNext",Pyn="planReviewFeedback.action.clearAll",JVi="planReviewFeedback.navigation.bearings";function tPo(a){let i=a.get(ie),e=a.get(Wq),t=i.activeEditor;if(!t)return;let o=t.resource;if(o&&e.isActivePlanReview(o))return o}var B3t=class extends z{constructor(e){super({id:e?Myn:Lyn,title:e?P(8360,"Go to Next Feedback Comment"):P(8361,"Go to Previous Feedback Comment"),icon:e?L.arrowDown:L.arrowUp,category:fi,f1:!0,precondition:Ube,menu:{id:Vct,group:"navigate",order:e?2:1,when:Ube}});this._next=e}run(e){let t=tPo(e);if(!t)return;let o=e.get(Wq),n=e.get(ie),r=o.getNextFeedback(t,this._next);if(!r)return;let s=n.activeTextEditorControl;s&&fn(s)&&(s.revealLineInCenter(r.line),s.setPosition({lineNumber:r.line,column:r.column}))}},XVi=class extends z{constructor(){super({id:Pyn,title:P(8357,"Clear"),tooltip:P(8358,"Clear All Feedback"),icon:L.clearAll,category:fi,f1:!0,precondition:Ube,menu:{id:Vct,group:"a_actions",order:0,when:Ube}})}run(i){let e=tPo(i);if(!e)return;i.get(Wq).clearFeedback(e)}};function iPo(){W(class extends B3t{constructor(){super(!1)}}),W(class extends B3t{constructor(){super(!0)}}),W(XVi),be.appendMenuItem(Vct,{command:{id:JVi,title:d(8359,null),precondition:C.false()},group:"navigate",order:-1,when:Ube})}var ZVi=class a{constructor(i){this._editor=i;this.allowEditorOverflow=!1;this._position=null;this._lineHeight=22;this._onDidTriggerAdd=new T;this.onDidTriggerAdd=this._onDidTriggerAdd.event;this._domNode=document.createElement("div"),this._domNode.classList.add("plan-review-feedback-input-widget"),this._domNode.style.display="none",this._inputElement=document.createElement("textarea"),this._inputElement.rows=1,this._inputElement.placeholder=d(8363,null),this._domNode.appendChild(this._inputElement),this._measureElement=document.createElement("span"),this._measureElement.classList.add("plan-review-feedback-input-measure"),this._domNode.appendChild(this._measureElement);let e=document.createElement("div");e.classList.add("plan-review-feedback-input-actions"),this._domNode.appendChild(e),this._addAction=new it("planReviewFeedback.add",d(8362,null),q.asClassName(L.plus),!1,()=>(this._onDidTriggerAdd.fire(),Promise.resolve())),this._actionBar=new oo(e),this._actionBar.push(this._addAction,{icon:!0,label:!1,keybinding:d(8364,null)}),this._inputElement.style.lineHeight=`${this._lineHeight}px`}static{this._ID="planReviewFeedback.inputWidget"}static{this._MIN_WIDTH=150}static{this._MAX_WIDTH=400}getId(){return a._ID}getDomNode(){return this._domNode}getPosition(){return this._position}get inputElement(){return this._inputElement}setPosition(i){this._position=i,this._editor.layoutOverlayWidget(this)}show(){this._domNode.style.display=""}hide(){this._domNode.style.display="none"}clearInput(){this._inputElement.value="",this._updateActionEnabled(),this._autoSize()}autoSize(){this._autoSize()}updateActionEnabled(){this._updateActionEnabled()}_updateActionEnabled(){let i=this._inputElement.value.trim().length>0;this._addAction.enabled=i}_autoSize(){let i=this._inputElement.value||this._inputElement.placeholder;this._measureElement.textContent=i;let e=this._measureElement.scrollWidth,t=Math.max(a._MIN_WIDTH,Math.min(e+10,a._MAX_WIDTH));this._inputElement.style.width=`${t}px`,this._inputElement.style.height="auto";let o=Math.max(this._inputElement.scrollHeight,this._lineHeight);this._inputElement.style.height=`${o}px`}dispose(){this._actionBar.dispose(),this._addAction.dispose(),this._onDidTriggerAdd.dispose()}},eBi=class a{constructor(i,e){this._instaService=e;this._showStore=new O;this._navigationBearings=De("planReviewFeedbackBearings",{activeIdx:-1,totalCount:0});this._domNode=document.createElement("div"),this._domNode.classList.add("plan-review-feedback-overlay-widget"),this._domNode.style.display="none",this._toolbarNode=document.createElement("div"),this._toolbarNode.classList.add("plan-review-feedback-overlay-toolbar"),this._domNode.appendChild(this._toolbarNode)}static{this._ID="planReviewFeedback.overlayWidget"}getId(){return a._ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}show(i){this._showStore.clear(),this._navigationBearings.set(i,void 0),this._domNode.style.display="",this._showStore.add(this._instaService.createInstance(pr,this._toolbarNode,Vct,{telemetrySource:"planReviewFeedback.overlayToolbar",hiddenItemStrategy:0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{renderShortTitle:!0},actionViewItemProvider:(e,t)=>{if(e.id===JVi){let o=this;return new class extends ts{constructor(){super(void 0,e,{...t,icon:!1,label:!0,keybindingNotRenderedWithLabel:!0})}render(n){super.render(n),n.classList.add("label-item"),this._store.add(ve(r=>{if(!this.label)return;let{activeIdx:s,totalCount:l}=o._navigationBearings.read(r);if(l>0){let c=s===-1?1:s+1;this.label.innerText=d(8365,null,c,l)}else this.label.innerText=d(8366,null)}))}}}return new ts(void 0,e,{...t,icon:!0,label:!1,keybindingNotRenderedWithLabel:!0})}}))}hide(){this._showStore.clear(),this._domNode.style.display="none",this._navigationBearings.set({activeIdx:-1,totalCount:0},void 0)}dispose(){this._showStore.dispose()}},vUe=class extends k{constructor(e,t,o,n){super();this._editor=e;this._planReviewFeedbackService=t;this._instantiationService=n;this._visible=!1;this._mouseDown=!1;this._suppressSelectionChangeOnce=!1;this._isActivePlan=!1;this._widgetListeners=this._register(new O);this._decorations=this._editor.createDecorationsCollection(),this._hasFeedbackContextKey=Ube.bindTo(o),this._register(this._editor.onDidChangeCursorSelection(()=>this._onSelectionChanged())),this._register(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._register(this._editor.onDidScrollChange(()=>{this._visible&&this._updatePosition()})),this._register(this._editor.onMouseDown(r=>{this._isWidgetTarget(r.event.target)||(this._mouseDown=!0,this._hide())})),this._register(this._editor.onMouseUp(r=>{this._mouseDown=!1,!this._isWidgetTarget(r.event.target)&&this._onSelectionChanged()})),this._register(this._editor.onDidBlurEditorWidget(()=>{this._visible&&Me(this._editor.getDomNode()).setTimeout(()=>{this._visible&&(this._isWidgetTarget(Me(this._editor.getDomNode()).document.activeElement)||this._hide())},0)})),this._register(this._editor.onDidFocusEditorText(()=>this._onSelectionChanged())),this._register(this._planReviewFeedbackService.onDidChangeRegistrations(()=>this._onModelChanged())),this._register(this._planReviewFeedbackService.onDidChangeFeedback(()=>this._updateDecorations())),this._register(this._planReviewFeedbackService.onDidChangeNavigation(()=>this._updateDecorations())),this._onModelChanged()}static{this.ID="planReviewFeedback.editorContribution"}_isWidgetTarget(e){return!!this._widget&&!!e&&this._widget.getDomNode().contains(e)}_ensureWidget(){return this._widget||(this._widget=new ZVi(this._editor),this._register(this._widget.onDidTriggerAdd(()=>this._addFeedback())),this._editor.addOverlayWidget(this._widget)),this._widget}_onModelChanged(){this._hide(),this._suppressSelectionChangeOnce=!1;let e=this._editor.getModel();this._isActivePlan=!!e&&this._planReviewFeedbackService.isActivePlanReview(e.uri),this._updateDecorations()}_onSelectionChanged(){if(this._suppressSelectionChangeOnce){this._suppressSelectionChangeOnce=!1;return}if(this._mouseDown||!this._editor.hasTextFocus())return;if(!this._isActivePlan){this._hide();return}if(!this._editor.getSelection()){this._hide();return}if(!this._editor.getModel()){this._hide();return}this._show()}_show(){let e=this._ensureWidget();this._visible||(this._visible=!0,this._registerWidgetListeners(e),e.clearInput()),e.show(),this._updatePosition()}_hide(){this._visible&&(this._visible=!1,this._widgetListeners.clear(),this._widget&&(this._widget.hide(),this._widget.setPosition(null),this._widget.clearInput()))}_registerWidgetListeners(e){this._widgetListeners.clear();let t=this._editor.getDomNode();t&&this._widgetListeners.add(Yo(t,"keydown",o=>{if(this._visible&&this._editor.hasTextFocus()&&!(o.keyCode===5||o.keyCode===4||o.keyCode===6||o.keyCode===57)){if(o.keyCode===9){this._hide(),this._editor.focus();return}if((o.ctrlKey||o.metaKey)&&o.keyCode===39){o.preventDefault(),o.stopPropagation(),e.inputElement.focus();return}o.ctrlKey||o.altKey||o.metaKey||o.keyCode===16||o.keyCode===18||o.keyCode===15||o.keyCode===17||this._editor.getOption(104)&&Me(e.inputElement).document.activeElement!==e.inputElement&&e.inputElement.focus()}})),this._widgetListeners.add(Yo(e.inputElement,"keydown",o=>{if(o.keyCode===9){o.preventDefault(),o.stopPropagation(),this._hide(),this._editor.focus();return}if(o.keyCode===3&&!o.shiftKey){o.preventDefault(),o.stopPropagation(),this._addFeedback();return}})),this._widgetListeners.add(Yo(e.inputElement,"keypress",o=>{o.stopPropagation()})),this._widgetListeners.add(Yo(e.inputElement,"input",()=>{e.autoSize(),e.updateActionEnabled(),this._updatePosition()})),this._widgetListeners.add(Yo(e.inputElement,"blur",()=>{Me(e.inputElement).setTimeout(()=>{this._visible&&(this._editor.hasWidgetFocus()||this._hide())},0)}))}_hideAndRefocusEditor(){this._suppressSelectionChangeOnce=!0,this._hide(),this._editor.focus()}_addFeedback(){if(!this._widget)return!1;let e=this._widget.inputElement.value.trim();if(!e)return!1;let t=this._editor.getSelection(),o=this._editor.getModel();if(!t||!o)return!1;let n=t.startLineNumber,r=t.startColumn;return this._planReviewFeedbackService.addFeedback(o.uri,n,r,e),this._hideAndRefocusEditor(),!0}_updatePosition(){if(!this._widget||!this._visible)return;let e=this._editor.getSelection();if(!e){this._hide();return}let t=this._editor.getOption(75),o=this._editor.getLayoutInfo(),n=this._widget.getDomNode(),r=n.offsetHeight||30,s=n.offsetWidth||150,l=e.getDirection()===0?e.getEndPosition():e.getStartPosition(),c=this._editor.getScrolledVisiblePosition(l);if(!c){this._widget.setPosition(null);return}let u;e.getDirection()===0?(u=c.top+t,u+r>o.height&&(u=c.top-r)):(u=c.top-r,u<0&&(u=c.top+t)),u=Math.max(0,Math.min(u,o.height-r));let p=Math.max(0,Math.min(c.left,o.width-s));this._widget.setPosition({preference:{top:u,left:p}})}_updateDecorations(){let e=this._editor.getModel();if(!e||!this._isActivePlan){this._decorations.clear(),this._hasFeedbackContextKey.set(!1),this._hideOverlayToolbar();return}let t=this._planReviewFeedbackService.getFeedback(e.uri);if(this._hasFeedbackContextKey.set(t.length>0),t.length>0){let o=this._planReviewFeedbackService.getNavigationBearing(e.uri);this._showOverlayToolbar(o)}else this._hideOverlayToolbar();this._decorations.set(t.map(o=>({range:new G(o.line,o.column,o.line,o.column),options:{description:"plan-review-feedback",glyphMarginClassName:q.asClassName(L.comment),glyphMarginHoverMessage:{value:o.text},overviewRuler:{color:_s(SX),position:2},lineNumberClassName:"plan-review-feedback-line-number"}})))}_ensureOverlayWidget(){return this._overlayWidget||(this._overlayWidget=new eBi(this._editor,this._instantiationService),this._editor.addOverlayWidget(this._overlayWidget)),this._overlayWidget}_showOverlayToolbar(e){this._ensureOverlayWidget().show(e)}_hideOverlayToolbar(){this._overlayWidget&&this._overlayWidget.hide()}dispose(){this._widget&&(this._editor.removeOverlayWidget(this._widget),this._widget.dispose(),this._widget=void 0),this._overlayWidget&&(this._editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget.dispose(),this._overlayWidget=void 0),super.dispose()}};vUe=I([m(1,Wq),m(2,X),m(3,F)],vUe);Eo(vUe.ID,vUe,3);var zbe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._pluginInstallService=t;this._dialogService=o;this._configurationService=n;this._extensionsWorkbenchService=r;this._hostService=s;this._logService=l;this._editorService=c;this._instantiationService=u;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.pluginUrlHandler"}async handleURL(e){if(e.authority!=="chat-plugin")return!1;switch(e.path){case"/install":return this._handleInstall(e);case"/add-marketplace":return this._handleAddMarketplace(e);default:return!1}}async _handleInstall(e){let t=this._decodeQueryParam(e,"source");if(!t)return this._logService.warn('[PluginUrlHandler] Missing or invalid "source" query parameter'),!0;let o=Cw(t);if(!o)return this._logService.warn(`[PluginUrlHandler] Invalid plugin source: ${t}`),!0;if(o.kind==="localFileUri")return this._logService.warn("[PluginUrlHandler] Local file URIs are not supported for install"),!0;await this._hostService.focus(ut);let n=this._decodeStringParam(e,"plugin");if(n)return this._handleInstallTargetedPlugin(t,o.displayLabel,n);let{confirmed:r}=await this._dialogService.confirm({type:"question",message:d(8407,null,o.displayLabel),detail:d(8408,null,o.rawValue),primaryButton:d(8409,null),custom:{icon:L.shield}});return r&&(await this._pluginInstallService.installPluginFromSource(t),this._extensionsWorkbenchService.openSearch(`@agentPlugins ${o.displayLabel}`)),!0}async _handleInstallTargetedPlugin(e,t,o){let n=await this._pluginInstallService.installPluginFromValidatedSource(e,{plugin:o});if(!n.success)return n.message&&this._logService.warn(`[PluginUrlHandler] ${n.message}`),this._extensionsWorkbenchService.openSearch(`@agentPlugins ${t}`),!0;if(!n.matchedPlugin)return this._extensionsWorkbenchService.openSearch(`@agentPlugins ${t}`),!0;let r=n.matchedPlugin,s={kind:"marketplace",name:r.name,description:r.description,source:r.source,sourceDescriptor:r.sourceDescriptor,marketplace:r.marketplace,marketplaceReference:r.marketplaceReference,marketplaceType:r.marketplaceType,readmeUri:r.readmeUri},l=this._instantiationService.createInstance(Rre,s);return await this._editorService.openEditor(l),!0}async _handleAddMarketplace(e){let t=this._decodeQueryParam(e,"ref");if(!t)return this._logService.warn('[PluginUrlHandler] Missing or invalid "ref" query parameter'),!0;let o=Cw(t);if(!o)return this._logService.warn(`[PluginUrlHandler] Invalid marketplace reference: ${t}`),!0;await this._hostService.focus(ut);let{confirmed:n}=await this._dialogService.confirm({type:"question",message:d(8405,null,o.displayLabel),detail:d(8406,null,o.rawValue),primaryButton:d(8404,null),custom:{icon:L.shield}});if(!n)return!0;let r=this._configurationService.getValue("chat.plugins.marketplaces")??[];return $6(r).some(l=>l.canonicalId===o.canonicalId)||await this._configurationService.updateValue("chat.plugins.marketplaces",[...r,t],2),this._extensionsWorkbenchService.openSearch(`@agentPlugins ${o.displayLabel}`),!0}_decodeQueryParam(e,t){let n=new URLSearchParams(e.query).get(t);if(!n)return;let r=this._tryBase64Decode(n);return r&&Cw(r)?r:Cw(n)?n:void 0}_decodeStringParam(e,t){return new URLSearchParams(e.query).get(t)??void 0}_tryBase64Decode(e){try{return Ws(e).toString()||void 0}catch{return}}};zbe=I([m(0,tS),m(1,uI),m(2,ct),m(3,B),m(4,Ui),m(5,ti),m(6,re),m(7,ie),m(8,F)],zbe);var Kbe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.notificationService=t;this.requestService=o;this.instantiationService=n;this.fileService=r;this.openerService=s;this.logService=l;this.dialogService=c;this.hostService=u;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.promptUrlHandler"}async handleURL(e){let t;switch(e.path){case"chat-prompt/install":t="prompt";break;case"chat-instructions/install":t="instructions";break;case"chat-mode/install":case"chat-agent/install":t="agent";break;default:return!1}try{let o=decodeURIComponent(e.query);if(!o||!o.startsWith("url="))return!0;let n=o.substring(4),r=A.parse(n);if(r.scheme!==Q.https&&r.scheme!==Q.http)return this.logService.error(`[PromptUrlHandler] Invalid URL: ${n}`),!0;if(await this.hostService.focus(ut),await this.shouldBlockInstall(t,r))return!0;let s=await this.requestService.request({type:"GET",url:n,callSite:"promptUrlHandler.resolveUrl"},Ie.None);if(s.res.statusCode!==200)return this.logService.error(`[PromptUrlHandler] Failed to fetch URL: ${n}`),this.notificationService.error(d(8562,null,n)),!0;let l=(await yI(s.stream)).toString(),c=await this.instantiationService.invokeFunction(z6,t);if(!c)return!0;let u=await this.instantiationService.invokeFunction(jne,t,c.uri,Xb(r));if(!u)return!0;let p=A.joinPath(c.uri,u);return await this.fileService.createFolder(c.uri),await this.fileService.createFile(p,Ke.fromString(l)),await this.openerService.open(p),!0}catch(o){return this.logService.error(`Error handling prompt URL ${e.toString()}`,o),!0}}async shouldBlockInstall(e,t){let o=t.toString();o.length>50&&(o=`${o.substring(0,35)}...${o.substring(o.length-15)}`);let n=new he("",{supportHtml:!0});n.appendMarkdown(d(8560,null,`[${o}](${t.toString()})`)),n.appendMarkdown(d(8561,null));let r;switch(e){case"prompt":r=d(8559,null);break;case"instructions":r=d(8558,null);break;default:r=d(8557,null);break}let{confirmed:s}=await this.dialogService.confirm({type:"warning",primaryButton:d(8564,null),cancelButton:d(8563,null),message:r,custom:{markdownDetails:[{markdown:n}]}});return!s}};Kbe=I([m(0,tS),m(1,Ne),m(2,Ra),m(3,F),m(4,ge),m(5,Je),m(6,re),m(7,ct),m(8,ti)],Kbe);var Ayn={type:"object",additionalProperties:!1,required:["icon","title","contents","when"],properties:{icon:{type:"string",description:d(8672,null)},title:{type:"string",description:d(8673,null)},content:{type:"string",description:d(8671,null)},when:{type:"string",description:d(8674,null)}}},Nyn=zn.registerExtensionPoint({extensionPoint:"chatViewsWelcome",jsonSchema:{description:d(8675,null),type:"array",items:Ayn}}),Gbe=class{constructor(i){this.logService=i;Nyn.setHandler((e,t)=>{for(let o of t.added)for(let n of o.value){S7e(o.description,"chatParticipantPrivate");let r=C.deserialize(n.when);if(!r){this.logService.error(`Could not deserialize 'when' clause for chatViewsWelcome contribution: ${n.when}`);continue}let s={...n,when:r,icon:q.fromString(n.icon),content:new he(n.content,{isTrusted:!0})};oe.as("workbench.registry.chat.viewsWelcome").register(s)}})}static{this.ID="workbench.contrib.chatViewsWelcomeHandler"}};Gbe=I([m(0,re)],Gbe);var bUe=class extends k{constructor(e,t,o,n,r,s,l){super();this.editorGroupsService=e;this.viewsService=t;this.quickChatService=o;this.layoutService=n;this.editorService=r;this.chatService=s;this.logService=l;this._widgets=[];this._lastFocusedWidget=void 0;this._onDidAddWidget=this._register(new T);this.onDidAddWidget=this._onDidAddWidget.event;this._onDidBackgroundSession=this._register(new T);this.onDidBackgroundSession=this._onDidBackgroundSession.event;this._onDidChangeFocusedWidget=this._register(new T);this.onDidChangeFocusedWidget=this._onDidChangeFocusedWidget.event;this._onDidChangeFocusedSession=this._register(new T);this.onDidChangeFocusedSession=this._onDidChangeFocusedSession.event}get lastFocusedWidget(){return this._lastFocusedWidget}getAllWidgets(){return this._widgets}getWidgetsByLocations(e){return this._widgets.filter(t=>t.location===e)}getWidgetByInputUri(e){return this._widgets.find(t=>ze(t.input.inputUri,e))}getWidgetBySessionResource(e){return this._widgets.find(t=>ze(t.viewModel?.sessionResource,e))}async revealWidget(e){let t=this.lastFocusedWidget;return t&&await this.reveal(t,e)?t:(await this.viewsService.openView(Xr,!e))?.widget}async reveal(e,t){if(e.viewModel?.sessionResource&&await this.revealSessionIfAlreadyOpen(e.viewModel.sessionResource,{preserveFocus:t}))return!0;if(tw(e.viewContext)){let o=await this.viewsService.openView(e.viewContext.viewId,!t);return t||o?.focus(),!!o}return!1}async openSession(e,t,o){let n=Date.now(),r=t===XD?"view":typeof t>"u"?"undefined":"editor";if(this.logService.trace(`[ChatWidgetService] openSession start uri=${e.toString()} target=${r}`),typeof t>"u"||o?.revealIfOpened){let l=await this.revealSessionIfAlreadyOpen(e,o);if(l)return this.logService.trace(`[ChatWidgetService] openSession done total=${Date.now()-n}ms uri=${e.toString()} path=reveal`),l}else await this.prepareSessionForMove(e,t);if(t===XD||typeof t>"u"){let l=await this.viewsService.openView(Xr,!o?.preserveFocus);return l&&(await l.loadSession(e),o?.preserveFocus||l.focusInput()),this.logService.trace(`[ChatWidgetService] openSession done total=${Date.now()-n}ms uri=${e.toString()} path=view`),l?.widget}let s=await this.editorService.openEditor({resource:e,options:{...o,revealIfOpened:o?.revealIfOpened??!0}},t);return this.logService.trace(`[ChatWidgetService] openSession done total=${Date.now()-n}ms uri=${e.toString()} path=editor`),s instanceof IO?s.widget:void 0}async revealSessionIfAlreadyOpen(e,t){let o=this.viewsService.getViewWithId(Xr);if(o?.widget.viewModel?.sessionResource&&ze(o.widget.viewModel.sessionResource,e)){let r=await this.viewsService.openView(Xr,!t?.preserveFocus);return t?.preserveFocus||r?.focus(),o.widget}let n=this.findExistingChatEditorByUri(e);if(n){let r=n.group.windowId,s=()=>Me(this.layoutService.activeContainer).vscodeWindowId===r,l;!s()&&!t?.preserveFocus&&(l=U.toPromise(U.once(U.filter(this.layoutService.onDidChangeActiveContainer,s))));let c=await n.group.openEditor(n.editor,t);return await l,c instanceof IO?c.widget:void 0}if(ze(e,this.quickChatService.sessionResource)){this.quickChatService.focus();return}}async prepareSessionForMove(e,t){let o=this.getWidgetBySessionResource(e);if(o){let n=tw(o.viewContext)?void 0:this.findExistingChatEditorByUri(e);if(tw(o.viewContext)&&t===XD||!tw(o.viewContext)&&t!==XD&&n&&this.isSameEditorTarget(n.group.id,t))return;n?await this.editorService.closeEditor({editor:n.editor,groupId:n.group.id},{preserveFocus:!0}):await o.clear()}}findExistingChatEditorByUri(e){for(let t of this.editorGroupsService.groups)for(let o of t.editors)if(o instanceof tl&&ze(o.sessionResource,e))return{editor:o,group:t}}isSameEditorTarget(e,t){return typeof t=="number"&&t===e||t===tr&&this.editorGroupsService.activeGroup?.id===e||Ipe(t)&&t.id===e}setLastFocusedWidget(e){e!==this._lastFocusedWidget&&(this._lastFocusedWidget=e,this._onDidChangeFocusedWidget.fire(e),this._onDidChangeFocusedSession.fire())}register(e){if(this._widgets.some(t=>t===e))throw new Error("Cannot register the same widget multiple times");return this._widgets.push(e),this._onDidAddWidget.fire(e),this._lastFocusedWidget||this.setLastFocusedWidget(e),Fn(e.onDidFocus(()=>this.setLastFocusedWidget(e)),e.onDidChangeViewModel(({previousSessionResource:t,currentSessionResource:o})=>{this._lastFocusedWidget===e&&!ze(t,o)&&this._onDidChangeFocusedSession.fire(),!(!t||o&&ze(t,o))&&Li(200).then(()=>{!this.getWidgetBySessionResource(t)&&this.chatService.getSession(t)&&this._onDidBackgroundSession.fire(t)})}),ee(()=>{this._widgets.splice(this._widgets.indexOf(e),1),this._lastFocusedWidget===e&&this.setLastFocusedWidget(void 0)}))}};bUe=I([m(0,kt),m(1,Gt),m(2,JD),m(3,Kl),m(4,ie),m(5,si),m(6,re)],bUe);var qbe=class extends k{constructor(e,t,o,n){super();this._chatService=e;this._chatWidgetService=t;this._hostService=o;this._configurationService=n;this._activeNotifications=this._register(new bI);let r=this._register(new bI);this._register(Gle(s=>this._chatService.chatModels.read(s),({addedValues:s,removedValues:l})=>{for(let c of s)r.set(c.sessionResource,this._trackModel(c));for(let c of l)r.deleteAndDispose(c.sessionResource)}))}static{this.ID="workbench.contrib.chatWindowNotifier"}_trackModel(e){return Kle(e.requestNeedsInput,({lastValue:t,newValue:o})=>{let n=!!o,r=!!t;!r&&n&&o?this._notifyIfNeeded(e.sessionResource,o):r&&!n&&this._clearNotification(e.sessionResource)})}async _notifyIfNeeded(e,t){let o=this._configurationService.getValue("chat.notifyWindowOnConfirmation");if(o==="off")return;let n=this._chatWidgetService.getWidgetBySessionResource(e),r=n?Me(n.domNode):ut,s=r.document.hasFocus();if(o!=="always"&&s)return;this._clearNotification(e),s||await this._hostService.focus(r,{mode:1});let l=t.title?d(8333,null,t.title):d(8332,null),c=new qe;this._activeNotifications.set(e,ee(()=>c.dispose(!0)));let u=this._isQuestionCarouselPending(e);try{let p=u?d(8335,null):d(8331,null),h=await this._hostService.showToast({title:this._sanitizeOSToastText(l),body:this._getNotificationBody(e,t,u),actions:[p]},c.token);if(h.actionIndex===0&&!u&&this._confirmAllow(e))return;(h.clicked||typeof h.actionIndex=="number")&&(await this._hostService.focus(r,{mode:2}),(await this._chatWidgetService.openSession(e))?.focusInput())}finally{this._clearNotification(e)}}_confirmAllow(e){let o=this._chatService.getSession(e)?.lastRequest?.response;if(!o)return!1;for(let n of o.response.value){let r=n.kind==="toolInvocation"?n.state.get():void 0;if(r?.type===pi.StateKind.WaitingForConfirmation||r?.type===pi.StateKind.WaitingForPostApproval)return r.confirm({type:4}),!0}return!1}_getNotificationBody(e,t,o){if(o)return d(8336,null);let n=this._getPendingTerminalCommand(e);return n?this._sanitizeOSToastText(n):t.detail?this._sanitizeOSToastText(t.detail):d(8334,null)}_getPendingTerminalCommand(e){let o=this._chatService.getSession(e)?.lastRequest?.response;if(o?.response?.value){for(let n of o.response.value)if(n.kind==="toolInvocation"&&n.toolSpecificData?.kind==="terminal"){let r=n.state.get();if(r?.type!==pi.StateKind.WaitingForConfirmation&&r?.type!==pi.StateKind.WaitingForPostApproval)continue;let s=yR(n.toolSpecificData);return s.commandLine.forDisplay??s.commandLine.userEdited??s.commandLine.toolEdited??s.commandLine.original}}}_isQuestionCarouselPending(e){let o=this._chatService.getSession(e)?.lastRequest?.response;return o?o.response.value.some(n=>n.kind==="questionCarousel"&&!n.isUsed):!1}_sanitizeOSToastText(e){return e.replace(/`/g,"'")}_clearNotification(e){this._activeNotifications.deleteAndDispose(e)}};qbe=I([m(0,si),m(1,Lt),m(2,ti),m(3,B)],qbe);var Oyn=100,Fyn=900*1024,oPo=1*1024*1024,Wyn=/^\s*url\s*=\s*(.+\S)\s*$/mg;function Vyn(a){let i=[],e;for(;e=Wyn.exec(a);)i.push(e[1]);return i}function Byn(a){try{return new URL(a).hostname.toLowerCase()}catch{let i=a.lastIndexOf("@"),e=i!==-1?a.slice(i+1):a,t=e.indexOf(":");if(t!==-1){let n=e.slice(0,t);return n?n.toLowerCase():void 0}let o=e.indexOf("/");if(o!==-1){let n=e.slice(0,o);return n?n.toLowerCase():void 0}return}}function Hyn(a,i){let e=a.contextValue?.toLowerCase()??"",t=i.toLowerCase();return e.includes("untracked")||e.includes("add")?"added":e.includes("delete")?"deleted":e.includes("rename")?"renamed":t.includes("untracked")?"added":a.decorations.strikeThrough?"deleted":a.multiDiffEditorOriginalUri?"modified":"added"}async function Uyn(a,i,e,t,o){try{let n="",r="";if(e&&o!=="added")try{let f=await a.readFile(e,{limits:{size:oPo}});if(YDe({buffer:f.value,bytesRead:f.value.byteLength}).seemsBinary)return;n=f.value.toString()}catch(f){if(f instanceof ua&&f.fileOperationResult===7||o==="modified")return}if(o!=="deleted")try{let f=await a.readFile(t,{limits:{size:oPo}});if(YDe({buffer:f.value,bytesRead:f.value.byteLength}).seemsBinary)return;r=f.value.toString()}catch(f){return f instanceof ua&&f.fileOperationResult===7,void 0}let s=n.split(`
`),l=r.split(`
`),c=n.length>0&&n.endsWith(`
`),u=r.length>0&&r.endsWith(`
`);c&&s.length>0&&s[s.length-1]===""&&s.pop(),u&&l.length>0&&l[l.length-1]===""&&l.pop();let p=[],h=o==="added"?"/dev/null":`a/${i}`,g=o==="deleted"?"/dev/null":`b/${i}`;if(p.push(`--- ${h}`),p.push(`+++ ${g}`),o==="added"){if(l.length>0){p.push(`@@ -0,0 +1,${l.length} @@`);for(let f of l)p.push(`+${f}`);u||p.push("\\ No newline at end of file")}}else if(o==="deleted"){if(s.length>0){p.push(`@@ -1,${s.length} +0,0 @@`);for(let f of s)p.push(`-${f}`);c||p.push("\\ No newline at end of file")}}else{let f=zyn(s,l,c,u);for(let v of f)p.push(v)}return p.join(`
`)}catch{return}}function zyn(a,i,e,t){let n=[],s=yF.getDefault().computeDiff(a,i,{ignoreTrimWhitespace:!1,maxComputationTimeMs:1e3,computeMoves:!1});if(s.changes.length===0)return n;let l=[],c=[];for(let u of s.changes)if(c.length===0)c.push(u);else{let h=c[c.length-1].original.endLineNumberExclusive-1+3;u.original.startLineNumber-3<=h+1?c.push(u):(l.push(c),c=[u])}c.length>0&&l.push(c);for(let u of l){let p=u[0],h=u[u.length-1],g=Math.max(1,p.original.startLineNumber-3),f=Math.min(a.length,h.original.endLineNumberExclusive-1+3),v=Math.max(1,p.modified.startLineNumber-3),b=[],S=-1,y=-1,w=g,x=0,E=0;for(let M of u){let N=M.original.startLineNumber,V=M.original.endLineNumberExclusive,H=M.modified.startLineNumber,K=M.modified.endLineNumberExclusive;for(;w<N;){let j=b.length;b.push(` ${a[w-1]}`),w===a.length&&(S=j),v+E===i.length&&(y=j),w++,x++,E++}for(let j=N;j<V;j++){let J=b.length;b.push(`-${a[j-1]}`),j===a.length&&(S=J),w++,x++}for(let j=H;j<K;j++){let J=b.length;b.push(`+${i[j-1]}`),j===i.length&&(y=J),E++}}for(;w<=f;){let M=b.length;b.push(` ${a[w-1]}`),w===a.length&&(S=M),v+E===i.length&&(y=M),w++,x++,E++}n.push(`@@ -${g},${x} +${v},${E} @@`);for(let M=0;M<b.length;M++){n.push(b[M]);let N=M===S,V=M===y;N&&V?(!e||!t)&&n.push("\\ No newline at end of file"):(N&&!e||V&&!t)&&n.push("\\ No newline at end of file")}}return n}function Kyn(a){let i=[...a.repositories];if(i.length===0)return;let e=i[0];if(!e.provider.rootUri)return;let o,n,r,s,l,c=e.provider.historyProvider?.get();if(c){let h=c.historyItemRef.get();o=h?.name,n=h?.revision;let g=c.historyItemRemoteRef.get();g&&(r=g.name,s=g.revision);let f=c.historyItemBaseRef.get();f&&(l=f.name)}let u,p;return r||s||l?(u="remote-git",r?n&&s&&n===s?p="synced":p="unpushed":p="unpublished"):(u="local-git",p="local-only"),{workspaceType:u,syncStatus:p,localBranch:o,remoteTrackingBranch:r,remoteBaseBranch:l,localHeadCommit:n,remoteHeadCommit:s,diffsStatus:"notCaptured"}}async function tBi(a,i){let e=[...a.repositories];if(e.length===0)return;let t=e[0],o=t.provider.rootUri;if(!o)return;let n=!1;try{let N=o.with({path:`${o.path}/.git`});n=await i.exists(N)}catch{}if(!n)return{workspaceType:"plain-folder",syncStatus:"no-git",diffs:void 0};let r;try{let N=o.with({path:`${o.path}/.git/config`});if(await i.exists(N)){let H=await i.readFile(N);r=Vyn(H.value.toString())[0]}}catch{}let s,l,c,u,p,h=t.provider.historyProvider?.get();if(h){let N=h.historyItemRef.get();s=N?.name,l=N?.revision;let V=h.historyItemRemoteRef.get();V&&(c=V.name,u=V.revision);let H=h.historyItemBaseRef.get();H&&(p=H.name)}let g,f;r?(g="remote-git",c?l===u?f="synced":f="unpushed":f="unpublished"):(g="local-git",f="local-only");let v;if(r){let N=Byn(r);N==="github.com"?v="github":N==="dev.azure.com"||N&&N.endsWith(".visualstudio.com")?v="ado":v="other"}let b=0;for(let N of t.provider.groups)b+=N.resources.length;let S={workspaceType:g,syncStatus:f,remoteUrl:r,remoteVendor:v,localBranch:s,remoteTrackingBranch:c,remoteBaseBranch:p,localHeadCommit:l,remoteHeadCommit:u};if(b===0)return{...S,diffs:void 0,diffsStatus:"noChanges",changedFileCount:0};if(b>Oyn)return{...S,diffs:void 0,diffsStatus:"tooManyChanges",changedFileCount:b};let y=[],w=[];for(let N of t.provider.groups)for(let V of N.resources){let H=lu(o,V.sourceUri)??V.sourceUri.path,K=Hyn(V,N.id),j=(async()=>{let J=await Uyn(i,H,V.multiDiffEditorOriginalUri,V.sourceUri,K);return{relativePath:H,changeType:K,status:N.label||N.id,unifiedDiff:J}})();w.push(j)}let x=await Promise.all(w);for(let N of x)N&&y.push(N);let E=JSON.stringify(y);return new TextEncoder().encode(E).length>Fyn?{...S,diffs:void 0,diffsStatus:"tooLarge",changedFileCount:b}:{...S,diffs:y,diffsStatus:"included",changedFileCount:b}}var $be=class extends k{constructor(e,t,o,n,r){super();this.chatService=e;this.chatEntitlementService=t;this.scmService=o;this.logService=n;this.configurationService=r;this._configurationRegistered=!1;this.registerConfigurationIfInternal(),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>{this.registerConfigurationIfInternal()})),this._register(this.chatService.onDidSubmitRequest(({chatSessionResource:s})=>{let l=this.chatService.getSession(s);l&&this.captureAndSetRepoMetadata(l)}))}static{this.ID="workbench.contrib.chatRepoInfo"}registerConfigurationIfInternal(){if(this._configurationRegistered||!this.chatEntitlementService.isInternal)return;oe.as($t.Configuration).registerConfiguration({id:"chatRepoInfo",title:d(8113,null),type:"object",properties:{"chat.repoInfo.enabled":{type:"boolean",description:d(8112,null),default:!1}}}),this._configurationRegistered=!0,this.logService.debug("[ChatRepoInfo] Configuration registered for internal user")}captureAndSetRepoMetadata(e){if(this.chatEntitlementService.isInternal&&this.configurationService.getValue("chat.repoInfo.enabled")&&!e.repoData)try{let t=Kyn(this.scmService);t?(e.setRepoData(t),t.localHeadCommit||this.logService.warn("[ChatRepoInfo] Captured repo metadata without commit hash - git history may not be ready")):this.logService.debug("[ChatRepoInfo] No SCM repository available for chat session")}catch(t){this.logService.warn("[ChatRepoInfo] Failed to capture repo metadata:",t)}}};$be=I([m(0,si),m(1,dr),m(2,lc),m(3,re),m(4,B)],$be);var Bct=class extends Ja{constructor(e,t,o,n,r,s,l,c){super(void 0,e);this.commandService=o;this.configurationService=n;this.keybindingService=s;this.contextKeyService=l;this._altKeyPressed=!1;let u=this._isSteerDefault();this._primaryActionAction=this._register(new it("chat.queuePickerPrimary",u?d(9153,null):d(9148,null),q.asClassName(u?L.arrowUp:L.add),!!this.contextKeyService.getContextKeyValue(Z.inputHasText.key),()=>this._runDefaultAction())),this._primaryAction=this._register(new ts(void 0,this._primaryActionAction,{icon:!0,label:!1})),this._register(this.contextKeyService.onDidChangeContext(h=>{this._primaryActionAction.enabled=!!this.contextKeyService.getContextKeyValue(Z.inputHasText.key)}));let p=this._register(new it("chat.queuePickerDropdown",d(9150,null)));this._dropdown=this._register(new iBi(p,{actionProvider:{getActions:()=>this._getDropdownActions()},showItemKeybindings:!0},r,this.keybindingService,this.contextKeyService,c)),this._register(this.configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration("chat.requestQueuing.defaultAction")&&this._updatePrimaryAction()})),this._register(Ab.getInstance().event(h=>{this._altKeyPressed!==h.altKey&&(this._altKeyPressed=h.altKey,this._updatePrimaryAction())}))}_isSteerDefault(){return this.configurationService.getValue("chat.requestQueuing.defaultAction")==="steer"}_isEffectiveSteer(){let e=this._isSteerDefault();return this._altKeyPressed?!e:e}_updatePrimaryAction(){let e=this._isEffectiveSteer();this._primaryActionAction.label=e?d(9153,null):d(9148,null),this._primaryActionAction.class=q.asClassName(e?L.arrowUp:L.add)}_runDefaultAction(){let e=this._isEffectiveSteer()?Q6.ID:j6.ID;this.commandService.executeCommand(e)}render(e){super.render(e),e.classList.add("monaco-dropdown-with-default");let t=_(".action-container");this._primaryAction.render(D(e,t)),this._register($(t,ne.KEY_DOWN,n=>{let r=new mi(n);r.equals(17)&&(this._primaryAction.blur(),this._dropdown.focus(),r.stopPropagation())}));let o=_(".dropdown-action-container");this._dropdown.render(D(e,o)),this._register($(o,ne.KEY_DOWN,n=>{let r=new mi(n);r.equals(15)&&(this._dropdown.setFocusable(!1),this._primaryAction.focus(),r.stopPropagation())}))}focus(e){e?this._dropdown.focus():this._primaryAction.focus()}blur(){this._primaryAction.blur(),this._dropdown.blur()}setFocusable(e){this._primaryAction.setFocusable(e),this._dropdown.setFocusable(e)}_getDropdownActions(){let e=this._isSteerDefault(),t=this.contextKeyService.createOverlay([[Z.inputHasText.key,!0],[Z.inChatInput.key,!0],[Z.requestInProgress.key,!0]]),o=this.keybindingService.lookupKeybinding(j6.ID,t,!0),n=this.keybindingService.lookupKeybinding(Q6.ID,t,!0),r={id:j6.ID,label:d(9148,null),tooltip:"",enabled:!0,checked:!e,icon:L.add,class:void 0,keybinding:o,hover:{content:d(9149,null)},run:()=>{this.commandService.executeCommand(j6.ID)}},s={id:Q6.ID,label:d(9153,null),tooltip:"",enabled:!0,checked:e,icon:L.arrowUp,class:void 0,keybinding:n,hover:{content:d(9154,null)},run:()=>{this.commandService.executeCommand(Q6.ID)}};return[{id:"_"+cO.ID,label:d(9151,null),tooltip:"",enabled:!0,icon:L.arrowRight,class:void 0,hover:{content:d(9152,null)},run:()=>{this.commandService.executeCommand(cO.ID)}},r,s]}};Bct=I([m(2,fe),m(3,B),m(4,kd),m(5,Le),m(6,X),m(7,_e)],Bct);var iBi=class extends rV{renderLabel(i){return i.classList.add("codicon","codicon-chevron-down"),null}},jbe=class extends k{static{this.ID="chat.queuePickerRendering"}constructor(i){super(),this._register(i.register(R.ChatExecute,R.ChatExecuteQueue,(e,t,o)=>{if(e instanceof id)return o.createInstance(Bct,e,t)}))}};jbe=I([m(0,sh)],jbe);var Gyn=oe.as($t.Configuration);function _9(a,i){return{modelIds:[""],modelLabels:[a??d(8345,null)],modelDescriptions:[i??d(8346,null)]}}var LO=class extends k{constructor(e,t,o,n){super();this._arrays=e;this._options=t;this._languageModelsService=o;this._logService=n;this._register(o.onDidChangeLanguageModels(()=>this._updateModelValues())),this._updateModelValues()}_updateModelValues(){let{modelIds:e,modelLabels:t,modelDescriptions:o}=this._arrays,{configKey:n,configSectionId:r,logPrefix:s,filter:l,storageFormat:c,defaultEntryLabel:u,defaultEntryDescription:p}=this._options;try{e.length=0,t.length=0,o.length=0,e.push(""),t.push(u??d(8345,null)),o.push(p??d(8346,null));let h=[],g=this._languageModelsService.getLanguageModelIds();for(let w of g)try{let x=this._languageModelsService.lookupLanguageModel(w);x?h.push({identifier:w,metadata:x}):this._logService.warn(`${s} No metadata found for model ID: ${w}`)}catch(x){this._logService.error(`${s} Error looking up model ${w}:`,x)}let f=this._languageModelsService.getVendors(),v=new Set(f.map(w=>w.vendor)),b=h.filter(w=>!(!v.has(w.metadata.vendor)||w.metadata?.isUserSelectable===!1||w.metadata?.targetChatSessionType!==void 0||l&&!l(w.metadata)));b.sort((w,x)=>w.metadata.name.localeCompare(x.metadata.name));let S=new Map;for(let w of f)S.set(w.vendor,w.displayName);let y=new Set;if(c==="vendorAndId"){let w=new Map;for(let x of h){let E=`${x.metadata.vendor}/${x.metadata.id}`;w.set(E,(w.get(E)??0)+1)}for(let[x,E]of w)E>1&&y.add(x)}for(let w of b)try{let x=c==="vendorAndId"?`${w.metadata.vendor}/${w.metadata.id}`:Mx.asQualifiedName(w.metadata);if(y.has(x)){this._logService.trace(`${s} Skipping model '${w.metadata.name}' (${x}): key collides with another registered model.`);continue}let E=S.get(w.metadata.vendor);E||this._logService.trace(`${s} No vendor descriptor for '${w.metadata.vendor}' (model '${w.metadata.id}'); falling back to vendor id in label.`),e.push(x),t.push(d(8347,null,w.metadata.name,E??w.metadata.vendor)),o.push(w.metadata.tooltip??w.metadata.detail??"")}catch(x){this._logService.error(`${s} Error adding model ${w.metadata.name}:`,x)}r&&Gyn.notifyConfigurationSchemaUpdated({id:r,properties:{[n]:{}}})}catch(h){this._logService.error(`${s} Error updating model values:`,h)}}};LO=I([m(2,Gr),m(3,re)],LO);var H3t=_9(),A$=class extends LO{static{this.ID="workbench.contrib.exploreAgentDefaultModel"}static{this.modelIds=H3t.modelIds}static{this.modelLabels=H3t.modelLabels}static{this.modelDescriptions=H3t.modelDescriptions}constructor(i,e){super(H3t,{configKey:"chat.exploreAgent.defaultModel",configSectionId:"chatSidebar",logPrefix:"[ExploreAgentDefaultModel]",filter:t=>!!t.capabilities?.toolCalling},i,e)}};A$=I([m(0,Gr),m(1,re)],A$);bt(A$.ID,A$,vt.BlockRestore);var U3t=_9(),N$=class extends LO{static{this.ID="workbench.contrib.planAgentDefaultModel"}static{this.modelIds=U3t.modelIds}static{this.modelLabels=U3t.modelLabels}static{this.modelDescriptions=U3t.modelDescriptions}constructor(i,e){super(U3t,{configKey:"chat.planAgent.defaultModel",configSectionId:"chatSidebar",logPrefix:"[PlanAgentDefaultModel]",filter:t=>!!t.capabilities?.toolCalling},i,e)}};N$=I([m(0,Gr),m(1,re)],N$);bt(N$.ID,N$,vt.BlockRestore);var G3t=d(8670,null),q3t=d(8669,null),z3t=_9(G3t,q3t),K3t=_9(G3t,q3t),O$=class extends LO{static{this.ID="workbench.contrib.utilityModel"}static{this.modelIds=z3t.modelIds}static{this.modelLabels=z3t.modelLabels}static{this.modelDescriptions=z3t.modelDescriptions}constructor(i,e){super(z3t,{configKey:"chat.utilityModel",configSectionId:"chatSidebar",logPrefix:"[UtilityModel]",storageFormat:"vendorAndId",defaultEntryLabel:G3t,defaultEntryDescription:q3t},i,e)}};O$=I([m(0,Gr),m(1,re)],O$);var F$=class extends LO{static{this.ID="workbench.contrib.utilitySmallModel"}static{this.modelIds=K3t.modelIds}static{this.modelLabels=K3t.modelLabels}static{this.modelDescriptions=K3t.modelDescriptions}constructor(i,e){super(K3t,{configKey:"chat.utilitySmallModel",configSectionId:"chatSidebar",logPrefix:"[UtilitySmallModel]",storageFormat:"vendorAndId",defaultEntryLabel:G3t,defaultEntryDescription:q3t},i,e)}};F$=I([m(0,Gr),m(1,re)],F$);bt(O$.ID,O$,vt.BlockRestore);bt(F$.ID,F$,vt.BlockRestore);var fy={OpenBrowserPage:"openBrowserPage",ReadPage:"readPage",ScreenshotPage:"screenshotPage",NavigatePage:"navigatePage",ClickElement:"clickElement",TypeInPage:"typeInPage",HoverElement:"hoverElement",DragElement:"dragElement",HandleDialog:"handleDialog",RunPlaywrightCode:"runPlaywrightCode"},nPo=Object.values(fy);Ge.registerCommand("_chat.notifyQuestionCarouselAnswer",(a,i,e)=>{a.get(si).notifyQuestionCarouselAnswer("",i,e)});var oBi=[],nBi=[],sPo=oe.as(Ta.JSONContribution);sPo.registerSchema(RSi,Yao);var $3t=oe.as($t.Configuration);$3t.registerConfiguration({id:"chatSidebar",title:d(7584,null),type:"object",properties:{"chat.experimentalSessionsWindowOverride":{type:"boolean",description:d(7446,null),default:!1,tags:["experimental"],agentsWindow:{default:!0}},"chat.fontSize":{type:"number",description:d(7451,null),default:13,minimum:6,maximum:100},"chat.fontFamily":{type:"string",description:d(7450,null),default:"default"},"chat.editor.fontSize":{type:"number",description:d(7580,null),default:et?12:14},"chat.editor.fontFamily":{type:"string",description:d(7579,null),default:"default"},"chat.editor.fontWeight":{type:"string",description:d(7581,null),default:"default"},"chat.editor.wordWrap":{type:"string",description:d(7583,null),default:"off",enum:["on","off"]},"chat.editor.lineHeight":{type:"number",description:d(7582,null),default:0},"chat.agentsControl.enabled":{type:"string",enum:["hidden","badge","compact"],enumDescriptions:[d(7393,null),d(7390,null),d(7391,null)],markdownDescription:d(7392,null,"`#window.commandCenter#`","`#chat.viewSessions.enabled#`"),default:"compact",tags:["experimental"]},"chat.unifiedAgentsBar.enabled":{type:"boolean",markdownDescription:d(7548,null),default:!1,tags:["experimental"]},"chat.agentSessionProjection.enabled":{type:"boolean",markdownDescription:d(7394,null),default:!1,tags:["experimental"]},"chat.implicitContext.enabled":{type:"object",description:d(7457,null),additionalProperties:{type:"string",enum:["never","first","always"],description:d(7459,null),enumDescriptions:[d(7462,null),d(7461,null),d(7460,null)]},default:{panel:"always"},tags:["experimental"],experiment:{mode:"startup"},agentsWindow:{default:{panel:"never"}}},"chat.implicitContext.suggestedContext":{type:"boolean",markdownDescription:d(7458,null),default:!0,agentsWindow:{default:!1}},"chat.editing.autoAcceptDelay":{type:"number",markdownDescription:d(7422,null),default:0,minimum:0,maximum:100},"chat.editing.confirmEditRequestRemoval":{type:"boolean",scope:1,markdownDescription:d(7423,null),default:!0},"chat.editing.confirmEditRequestRetry":{type:"boolean",scope:1,markdownDescription:d(7424,null),default:!0},"chat.editing.explainChanges.enabled":{type:"boolean",markdownDescription:d(7425,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.editing.revealNextChangeOnResolve":{type:"boolean",markdownDescription:d(7426,null),default:!0},"chat.tips.enabled":{type:"boolean",scope:1,description:d(7534,null),default:!0},"chat.upvoteAnimation":{type:"string",enum:["off","confetti","floatingThumbs","pulseWave","radiantLines"],enumDescriptions:[d(7552,null),d(7550,null),d(7551,null),d(7553,null),d(7554,null)],description:d(7549,null),default:"floatingThumbs"},"chat.experimental.detectParticipant.enabled":{type:"boolean",deprecationMessage:d(7432,null),description:d(7431,null),default:null},"chat.experimental.incrementalRendering.enabled":{type:"boolean",description:d(7445,null),default:!1,tags:["experimental"]},"chat.experimental.incrementalRendering.animationStyle":{type:"string",enum:["none","fade","rise","blur","scale","slide","reveal"],enumDescriptions:[d(7436,null),d(7435,null),d(7438,null),d(7434,null),d(7439,null),d(7440,null),d(7437,null)],description:d(7433,null),default:"fade",tags:["experimental"]},"chat.experimental.incrementalRendering.buffering":{type:"string",enum:["off","word","paragraph"],enumDescriptions:[d(7442,null),d(7444,null),d(7443,null)],description:d(7441,null),default:"word",tags:["experimental"]},"chat.detectParticipant.enabled":{type:"boolean",description:d(7420,null),default:!0},"chat.inlineReferences.style":{type:"string",enum:["box","link"],enumDescriptions:[d(7468,null),d(7469,null)],description:d(7467,null),default:"box"},"chat.editorAssociations":{type:"object",markdownDescription:d(7428,null),additionalProperties:{type:"string"},default:{}},"chat.notifyWindowOnConfirmation":{type:"string",enum:["off","windowNotFocused","always"],enumDescriptions:[d(7498,null),d(7499,null),d(7497,null)],description:d(7496,null),default:"windowNotFocused"},"chat.autoReply":{default:!1,markdownDescription:d(7412,null),type:"boolean",scope:3,tags:["experimental","advanced"]},"chat.autopilot.enabled":{type:"boolean",markdownDescription:d(7411,null),default:!0,tags:["experimental"]},"chat.planReview.inlineEditor.enabled":{type:"boolean",markdownDescription:d(7514,null),default:!0},"chat.permissions.default":{type:"string",enum:["default","autoApprove","autopilot"],enumItemLabels:[d(7510,null),d(7506,null),d(7508,null)],enumDescriptions:[d(7509,null),d(7505,null),d(7507,null)],description:d(7511,null),default:"default",tags:["experimental"]},"chat.tools.global.autoApprove":{default:!1,markdownDescription:VVi.value,type:"boolean",scope:3,tags:["experimental"],policy:{name:"ChatToolsAutoApprove",category:"InteractiveSession",minimumVersion:"1.99",value:a=>a.chat_preview_features_enabled===!1?!1:void 0,localization:{description:{key:"autoApprove3.description",value:d(7355,null)}}}},"chat.sessionSync.enabled":{default:!1,markdownDescription:d(7529,null),type:"boolean",tags:["experimental","advanced"],experiment:{mode:"auto"},policy:{name:"CopilotSessionSync",category:"InteractiveSession",minimumVersion:"1.121",value:a=>a.cloud_session_storage_enabled===!1?!1:void 0,localization:{description:{key:"chat.sessionSync.enabled.policy",value:d(7530,null)}}}},"chat.sessionSync.excludeRepositories":{type:"array",items:{type:"string"},default:[],markdownDescription:d(7531,null),tags:["experimental","advanced"]},"chat.tools.edits.autoApprove":{default:{"**/*":!0,"**/.vscode/*.json":!1,"**/.git/**":!1,"**/{package.json,server.xml,build.rs,web.config,.gitattributes,.env}":!1,"**/*.{code-workspace,csproj,fsproj,vbproj,vcxproj,proj,targets,props}":!1,"**/*.lock":!1,"**/*-lock.{yaml,json}":!1},markdownDescription:d(7537,null),type:"object",additionalProperties:{type:"boolean"}},"chat.tools.urls.autoApprove":{default:{"https://code.visualstudio.com":!0,"https://github.com/microsoft/vscode/wiki/*":!0},markdownDescription:d(7542,null),type:"object",additionalProperties:{oneOf:[{type:"boolean"},{type:"object",properties:{approveRequest:{type:"boolean"},approveResponse:{type:"boolean"}}}]}},"chat.tools.eligibleForAutoApproval":{default:{},markdownDescription:d(7541,null),type:"object",propertyNames:{enum:oBi,enumDescriptions:nBi},additionalProperties:{type:"boolean"},examples:[{fetch:!1,runTask:!1}],policy:{name:"ChatToolsEligibleForAutoApproval",category:"InteractiveSession",minimumVersion:"1.107",localization:{description:{key:"chat.tools.eligibleForAutoApproval",value:d(7541,null)}}}},"chat.sendElementsToChat.attachImages":{default:!0,markdownDescription:d(7528,null),type:"boolean",tags:["experimental"]},"chat.artifacts.enabled":{default:!1,description:d(7401,null),type:"boolean",tags:["experimental"]},"chat.artifacts.rules.byMimeType":{default:{"image/*":{groupName:"Screenshots",onlyShowGroup:!0}},description:d(7408,null),type:"object",additionalProperties:{type:"object",properties:{groupName:{type:"string",description:d(7409,null)},onlyShowGroup:{type:"boolean",description:d(7410,null)}},required:["groupName"]},tags:["experimental"]},"chat.artifacts.rules.byFilePath":{default:{"**/*plan*.md":{groupName:"Plans"}},description:d(7402,null),type:"object",additionalProperties:{type:"object",properties:{groupName:{type:"string",description:d(7403,null)},onlyShowGroup:{type:"boolean",description:d(7404,null)}},required:["groupName"]},tags:["experimental"]},"chat.artifacts.rules.byMemoryFilePath":{default:{"**/*plan*.md":{groupName:"Plans"}},description:d(7405,null),type:"object",additionalProperties:{type:"object",properties:{groupName:{type:"string",description:d(7406,null)},onlyShowGroup:{type:"boolean",description:d(7407,null)}},required:["groupName"]},tags:["experimental"]},"chat.undoRequests.restoreInput":{default:!0,markdownDescription:d(7547,null),type:"boolean"},"chat.editRequests":{markdownDescription:d(7429,null),type:"string",enum:["inline","hover","input","none"],default:"inline"},"chat.viewSessions.enabled":{type:"boolean",default:!0,description:d(7574,null),agentsWindow:{default:!1}},"chat.viewSessions.orientation":{type:"string",enum:["stacked","sideBySide"],enumDescriptions:[d(7577,null),d(7576,null)],default:"sideBySide",description:d(7575,null)},"chat.viewProgressBadge.enabled":{type:"boolean",default:!1,description:d(7573,null)},"chat.contextUsage.enabled":{type:"boolean",default:!0,description:d(7416,null)},"chat.persistentProgress.enabled":{type:"boolean",default:$i.quality!=="stable",description:d(7512,null)},"chat.progressBorder.enabled":{type:"boolean",default:!0,markdownDescription:d(7518,null,"`#chat.persistentProgress.enabled#`")},"chat.notifyWindowOnResponseReceived":{type:"string",enum:["off","windowNotFocused","always"],enumDescriptions:[d(7502,null),d(7503,null),d(7501,null)],default:"windowNotFocused",description:d(7500,null)},"chat.checkpoints.enabled":{type:"boolean",default:!0,description:d(7413,null)},"chat.checkpoints.showFileChanges":{type:"boolean",description:d(7414,null),default:!1},[sy]:{type:"string",description:d(7474,null),enum:["none","registry","all"],enumDescriptions:[d(7476,null),d(7477,null),d(7475,null)],default:"all",policy:{name:"ChatMCP",category:"InteractiveSession",minimumVersion:"1.99",value:a=>{if(a.mcp===!1)return"none";if(a.mcpAccess==="registry_only")return"registry"},localization:{description:{key:"chat.mcp.access",value:d(7474,null)},enumDescriptions:[{key:"chat.mcp.access.none",value:d(7476,null)},{key:"chat.mcp.access.registry",value:d(7477,null)},{key:"chat.mcp.access.any",value:d(7475,null)}]}}},[gie]:{type:"string",description:d(7479,null),default:"newAndOutdated",enum:["never","onlyNew","newAndOutdated"],enumDescriptions:[d(7480,null),d(7482,null),d(7481,null)],tags:["experimental"]},[wzt]:{type:"boolean",description:d(7491,null),default:!0,tags:["experimental"]},[oKt]:{type:"string",description:d(7483,null),enum:["disable","suffix"],enumDescriptions:[d(7484,null),d(7485,null)],default:"disable"},[ont]:{type:"object",description:d(7487,null,"MCP: "+d(7587,null)),scope:5,additionalProperties:{type:"object",properties:{allowedDuringChat:{type:"boolean",description:d(7488,null),default:!0},allowedOutsideChat:{type:"boolean",description:d(7489,null),default:!1},allowedModels:{type:"array",items:{type:"string",description:d(7490,null)}}}}},[olt[4].enabledConfigKey]:{type:"boolean",description:d(7478,null),default:!1,tags:["experimental"],experiment:{mode:"startup"}},"chat.extensionTools.enabled":{type:"boolean",description:d(7448,null),default:!0,policy:{name:"ChatAgentExtensionTools",category:"InteractiveSession",minimumVersion:"1.99",localization:{description:{key:"chat.extensionToolsEnabled",value:d(7448,null)}}}},"chat.plugins.enabled":{type:"boolean",description:d(7516,null),default:!0,tags:["preview"],policy:{name:"ChatPluginsEnabled",category:"InteractiveSession",minimumVersion:"1.116",localization:{description:{key:"chat.plugins.enabled",value:d(7516,null)}}}},"chat.pluginLocations":{type:"object",additionalProperties:{type:"boolean"},restricted:!0,markdownDescription:d(7515,null),scope:2,tags:["experimental"]},"chat.plugins.marketplaces":{type:"array",items:{type:"string"},markdownDescription:d(7517,null),default:["github/copilot-plugins","github/awesome-copilot"],scope:1,tags:["experimental"]},"chat.agent.enabled":{type:"boolean",description:d(7359,null),default:!0,order:1,policy:{name:"ChatAgentMode",category:"InteractiveSession",minimumVersion:"1.99",value:a=>a.chat_agent_enabled===!1?!1:void 0,localization:{description:{key:"chat.agent.enabled.description",value:d(7359,null)}}}},"chat.agent.networkFilter":{markdownDescription:d(7361,null,"`#chat.agent.allowedNetworkDomains#`","`#chat.agent.deniedNetworkDomains#`","`#chat.agent.sandbox.enabled#`"),type:"boolean",default:!1,restricted:!0,policy:{name:"ChatAgentNetworkFilter",category:"InteractiveSession",minimumVersion:"1.116",localization:{description:{key:"chat.agent.networkFilter",value:d(7361,null,"`#chat.agent.allowedNetworkDomains#`","`#chat.agent.deniedNetworkDomains#`","`#chat.agent.sandbox.enabled#`")}}}},"chat.agent.allowedNetworkDomains":{markdownDescription:d(7357,null,"`#chat.agent.networkFilter#`","`#chat.agent.sandbox.enabled#`","`allowNetwork`","`*.example.com`","`#chat.agent.deniedNetworkDomains#`"),type:"array",items:{type:"string"},default:[],restricted:!0,policy:{name:"ChatAgentAllowedNetworkDomains",category:"InteractiveSession",minimumVersion:"1.116",localization:{description:{key:"chat.agent.allowedNetworkDomains",value:d(7357,null,"`#chat.agent.networkFilter#`","`#chat.agent.sandbox.enabled#`","`allowNetwork`","`*.example.com`","`#chat.agent.deniedNetworkDomains#`")}}}},"chat.agent.deniedNetworkDomains":{markdownDescription:d(7358,null,"`#chat.agent.networkFilter#`","`#chat.agent.sandbox.enabled#`","`allowNetwork`","`#chat.agent.allowedNetworkDomains#`","`*.example.com`"),type:"array",items:{type:"string"},default:[],restricted:!0,policy:{name:"ChatAgentDeniedNetworkDomains",category:"InteractiveSession",minimumVersion:"1.116",localization:{description:{key:"chat.agent.deniedNetworkDomains",value:d(7358,null,"`#chat.agent.networkFilter#`","`#chat.agent.sandbox.enabled#`","`allowNetwork`","`#chat.agent.allowedNetworkDomains#`","`*.example.com`")}}}},"chat.agent.sandboxNetwork.allowedDomains":{type:"array",items:{type:"string"},deprecated:!0,markdownDeprecationMessage:d(7351,null,"`#chat.agent.allowedNetworkDomains#`")},"chat.agent.sandboxNetwork.deniedDomains":{type:"array",items:{type:"string"},deprecated:!0,markdownDeprecationMessage:d(7353,null,"`#chat.agent.deniedNetworkDomains#`")},"chat.agent.sandbox.allowedNetworkDomains":{type:"array",items:{type:"string"},deprecated:!0,markdownDeprecationMessage:d(7352,null,"`#chat.agent.allowedNetworkDomains#`")},"chat.agent.sandbox.deniedNetworkDomains":{type:"array",items:{type:"string"},deprecated:!0,markdownDeprecationMessage:d(7354,null,"`#chat.agent.deniedNetworkDomains#`")},"chat.newSession.defaultMode":{type:"string",description:d(7495,null),default:""},[mk]:{type:"boolean",description:d(7379,null),default:!1,tags:["experimental","advanced"],included:$i.quality!=="stable"},[OCo]:{type:"string",description:d(7376,null),default:"",tags:["experimental","advanced"],included:$i.quality!=="stable"},[GGt]:{type:"boolean",description:d(7380,null),default:$i.quality!=="stable",tags:["experimental","advanced"],included:$i.quality!=="stable"},[MFe]:{type:"boolean",description:d(7375,null),default:$i.quality!=="stable",tags:["experimental","advanced"],included:$i.quality!=="stable"},[mst]:{type:"boolean",description:d(7378,null),default:!0,tags:["experimental","advanced"],included:$i.quality!=="stable"},[FCo]:{type:"boolean",description:d(7383,null),default:!1,tags:["experimental","advanced"],included:$i.quality!=="stable"},[WCo]:{type:"string",enum:["otlp-http","otlp-grpc","console","file"],description:d(7384,null),default:"otlp-http",tags:["experimental","advanced"],included:$i.quality!=="stable"},[VCo]:{type:"string",description:d(7385,null),default:"",tags:["experimental","advanced"],included:$i.quality!=="stable"},[BCo]:{type:"boolean",description:d(7381,null),default:!1,tags:["experimental","advanced"],included:$i.quality!=="stable"},[HCo]:{type:"string",description:d(7386,null),default:"",tags:["experimental","advanced"],included:$i.quality!=="stable"},[qGt]:{type:"boolean",description:d(7382,null),default:!1,tags:["experimental","advanced"],included:$i.quality!=="stable"},"chat.agentHost.clientTools":{type:"array",items:{type:"string"},description:d(7377,null),default:["runTask","getTaskOutput","problems","runTests",...nPo],tags:["experimental","advanced"],included:$i.quality!=="stable"},"chat.tools.confirmationCarousel.enabled":{type:"boolean",description:d(7540,null),default:$i.quality!=="stable",tags:["experimental"]},"chat.tools.riskAssessment.enabled":{type:"boolean",description:d(7543,null),default:!0,experiment:{mode:"auto"}},"chat.tools.riskAssessment.model":{type:"string",description:d(7544,null),default:"copilot-utility-small",tags:["experimental","advanced"],experiment:{mode:"auto"}},"chat.planAgent.defaultModel":{type:"string",description:d(7513,null),default:"",enum:N$.modelIds,enumItemLabels:N$.modelLabels,markdownEnumDescriptions:N$.modelDescriptions},"chat.exploreAgent.defaultModel":{type:"string",description:d(7447,null),default:"",enum:A$.modelIds,enumItemLabels:A$.modelLabels,markdownEnumDescriptions:A$.modelDescriptions},"chat.utilityModel":{type:"string",description:d(7571,null),default:"",enum:O$.modelIds,enumItemLabels:O$.modelLabels,markdownEnumDescriptions:O$.modelDescriptions},"chat.utilitySmallModel":{type:"string",description:d(7572,null),default:"",enum:F$.modelIds,enumItemLabels:F$.modelLabels,markdownEnumDescriptions:F$.modelDescriptions},"chat.requestQueuing.defaultAction":{type:"string",enum:["queue","steer"],enumDescriptions:[d(7523,null),d(7524,null)],description:d(7522,null),default:"steer"},"chat.editMode.hidden":{type:"boolean",description:d(7427,null),default:!0,tags:["experimental"],experiment:{mode:"auto"},policy:{name:"DeprecatedEditModeHidden",category:"InteractiveSession",minimumVersion:"1.112",localization:{description:{key:"chat.editMode.hidden",value:d(7427,null)}}}},"chat.math.enabled":{type:"boolean",description:d(7473,null),default:!0},"chat.agent.codeBlockProgress":{type:"boolean",description:d(7415,null),default:!0,tags:["experimental"]},[xie]:{type:"object",properties:Object.fromEntries(uNe.map(a=>[a,{type:"boolean",description:uSo[a]}])),additionalProperties:!1,default:Object.fromEntries(uNe.map(a=>[a,!1])),markdownDescription:d(7585,null)},[mq]:{type:"boolean",default:!1,tags:["preview"],description:d(7486,null),included:$i.quality==="stable"},[gQ]:{type:"string",description:d(7586,null),default:"",scope:1,tags:["usesOnlineServices","advanced"],included:!1,policy:{name:"McpGalleryServiceUrl",category:"InteractiveSession",minimumVersion:"1.101",value:a=>a.mcpRegistryUrl,localization:{description:{key:"mcp.gallery.serviceUrl",value:d(7586,null)}}}},[El.INSTRUCTIONS_LOCATION_KEY]:{type:"object",title:d(7471,null),markdownDescription:d(7470,null,GYe,hPt),default:{...BPt.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Wpe,patternErrorMessage:d(7472,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[BPt[0].path]:!0},{[mSi]:!0,"/Users/vscode/repos/instructions":!0}]},[El.PROMPT_LOCATIONS_KEY]:{type:"object",title:d(7527,null),markdownDescription:d(7526,null,KYe,DZ),default:{[$Ye]:!0},additionalProperties:{type:"boolean"},unevaluatedProperties:{type:"boolean"},propertyNames:{pattern:Wpe,patternErrorMessage:d(7519,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[$Ye]:!0},{[$Ye]:!0,"/Users/vscode/repos/prompts":!0}]},[El.MODE_LOCATION_KEY]:{type:"object",title:d(7494,null),markdownDescription:d(7493,null,V2,AYe),default:{[WPt]:!0},deprecationMessage:d(7492,null),additionalProperties:{type:"boolean"},unevaluatedProperties:{type:"boolean"},restricted:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"],examples:[{[WPt]:!0},{[WPt]:!0,"/Users/vscode/repos/chatmodes":!0}]},[El.AGENTS_LOCATION_KEY]:{type:"object",title:d(7389,null),markdownDescription:d(7388,null,MZ,AYe),default:{[B2]:!0,[W2]:!0,[VPt]:!0},additionalProperties:{type:"boolean"},propertyNames:{pattern:Wpe,patternErrorMessage:d(7387,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[B2]:!0},{[B2]:!0,"my-agents":!0,"../shared-agents":!0,"~/.copilot/agents":!0}]},[El.USE_AGENT_MD]:{type:"boolean",title:d(7556,null),markdownDescription:d(7555,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[El.USE_NESTED_AGENT_MD]:{type:"boolean",title:d(7568,null),markdownDescription:d(7567,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"]},[El.USE_CLAUDE_MD]:{type:"boolean",title:d(7562,null),markdownDescription:d(7561,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[El.USE_AGENT_SKILLS]:{type:"boolean",title:d(7558,null),markdownDescription:d(7557,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[El.USE_SKILL_ADHERENCE_PROMPT]:{type:"boolean",title:d(7570,null),markdownDescription:d(7569,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["experimental","prompts","reusable prompts","prompt snippets","instructions"],experiment:{mode:"auto"}},[El.INCLUDE_APPLYING_INSTRUCTIONS]:{type:"boolean",title:d(7464,null),markdownDescription:d(7463,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[El.INCLUDE_REFERENCED_INSTRUCTIONS]:{type:"boolean",title:d(7466,null),markdownDescription:d(7465,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[El.USE_CUSTOMIZATIONS_IN_PARENT_REPOS]:{type:"boolean",title:d(7564,null),markdownDescription:d(7563,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"]},[El.SKILLS_LOCATION_KEY]:{type:"object",title:d(7397,null),markdownDescription:d(7395,null,LH,gPt),default:{...jYe.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Wpe,patternErrorMessage:d(7396,null)},restricted:!0,tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{[jYe[0].path]:!0},{[jYe[0].path]:!0,"my-skills":!0,"../shared-skills":!0,"~/.custom/skills":!0}]},[El.HOOKS_LOCATION_KEY]:{type:"object",title:d(7456,null),markdownDescription:d(7454,null,fPt),default:{...QYe.map(a=>({[a.path]:!0})).reduce((a,i)=>({...a,...i}),{})},additionalProperties:{type:"boolean"},propertyNames:{pattern:Wpe,patternErrorMessage:d(7455,null)},restricted:!0,tags:["preview","prompts","hooks","agent"],examples:[{[QYe[0].path]:!0},{[QYe[0].path]:!0,"custom-hooks/hooks.json":!0}],agentsWindow:{default:{".claude/settings.local.json":!1,".claude/settings.json":!1,"~/.claude/settings.json":!1}}},[El.USE_CHAT_HOOKS]:{type:"boolean",title:d(7566,null),markdownDescription:d(7565,null),default:!0,restricted:!0,disallowConfigurationDefault:!0,tags:["preview","prompts","hooks","agent"],policy:{name:"ChatHooks",category:"InteractiveSession",minimumVersion:"1.109",value:a=>a.chat_preview_features_enabled===!1?!1:void 0,localization:{description:{key:"chat.useHooks.description",value:d(7565,null)}}}},[El.USE_CLAUDE_HOOKS]:{type:"boolean",title:d(7560,null),markdownDescription:d(7559,null),default:!1,restricted:!0,disallowConfigurationDefault:!0,tags:["preview","prompts","hooks","agent"]},[El.PROMPT_FILES_SUGGEST_KEY]:{type:"object",scope:5,title:d(7521,null),markdownDescription:d(7520,null),default:{},additionalProperties:{oneOf:[{type:"boolean"},{type:"string"}]},tags:["prompts","reusable prompts","prompt snippets","instructions"],examples:[{plan:!0,"a11y-audit":"resourceExtname == .html",document:"resourceLangId == markdown"}]},"chat.tools.todos.showWidget":{type:"boolean",default:!0,description:d(7546,null)},"chat.agent.thinkingStyle":{type:"string",default:"fixedScrolling",enum:["collapsed","collapsedPreview","fixedScrolling"],enumDescriptions:[d(7371,null),d(7372,null),d(7373,null)],description:d(7374,null),tags:["experimental"]},"chat.agent.thinking.generateTitles":{type:"boolean",default:!0,description:d(7366,null),tags:["experimental"]},"chat.agent.thinking.collapsedTools":{type:"string",default:"always",enum:["off","withThinking","always"],enumDescriptions:[d(7364,null),d(7365,null),d(7363,null)],markdownDescription:d(7362,null),tags:["experimental"]},"chat.agent.thinking.terminalTools":{type:"boolean",default:!0,markdownDescription:d(7370,null),tags:["experimental"]},"chat.tools.terminal.simpleCollapsible":{type:"boolean",default:!0,markdownDescription:d(7545,null),tags:["experimental"]},"chat.tools.compressOutput.enabled":{type:"boolean",default:!1,markdownDescription:d(7539,null),tags:["preview"],experiment:{mode:"auto"}},"chat.agent.thinking.phrases":{type:"object",default:{mode:"append",phrases:[]},properties:{mode:{type:"string",enum:["replace","append"],default:"append",description:d(7368,null)},phrases:{type:"array",items:{type:"string"},default:[],description:d(7369,null)}},additionalProperties:!1,markdownDescription:d(7367,null),tags:["experimental"]},"chat.tools.autoExpandFailures":{type:"boolean",default:!0,markdownDescription:d(7538,null)},"chat.disableAIFeatures":{type:"boolean",description:d(7421,null),default:!1,scope:4},"chat.offlineByok":{type:"boolean",description:d(7504,null),default:!1,scope:4,included:!1},"chat.titleBar.signIn.enabled":{type:"boolean",description:d(7535,null),default:!0},"chat.approvedAccountOrganizations":{type:"array",items:{type:"string"},description:d(7399,null),default:[],included:!1,policy:{name:"ChatApprovedAccountOrganizations",category:"InteractiveSession",minimumVersion:"1.118",localization:{description:{key:"chat.approvedAccountOrganizations.policy.description",value:d(7400,null)}}}},"chat.allowAnonymousAccess":{type:"boolean",description:d(7398,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.growthNotification.enabled":{type:"boolean",description:d(7453,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},"chat.restoreLastPanelSession":{type:"boolean",description:d(7525,null),default:!1},"chat.exitAfterDelegation":{type:"boolean",description:d(7430,null),default:!1,tags:["preview"]},"chat.extensionUnification.enabled":{type:"boolean",description:d(7449,null),default:!0,tags:["experimental"],experiment:{mode:"auto"}},"chat.generalPurposeAgent.enabled":{type:"boolean",description:d(7452,null),default:!1,tags:["experimental","advanced"],experiment:{mode:"auto"}},"chat.subagents.allowInvocationsFromSubagents":{type:"boolean",description:d(7532,null),markdownDescription:d(7533,null),default:!1,experiment:{mode:"auto"}},"chat.customizations.harnessSelector.enabled":{type:"boolean",tags:["preview"],description:d(7417,null),default:!0},"chat.customizations.structuredPreview.enabled":{type:"boolean",tags:["preview"],description:d(7418,null),default:!1},"chat.customizations.useChatSessionCustomizationsForCustomAgents":{type:"boolean",description:d(7419,null),default:!1,tags:["experimental","advanced"],experiment:{mode:"auto"}}}});oe.as(en.EditorPane).registerEditorPane(os.create(IO,tl.EditorID,d(7356,null)),[new Vt(tl)]);oe.as(en.EditorPane).registerEditorPane(os.create(Zne,zE.ID,d(7578,null)),[new Vt(zE)]);oe.as(en.EditorPane).registerEditorPane(os.create(E9,E9.ID,d(7350,null)),[new Vt(Rre)]);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"chat.experimental.detectParticipant.enabled",migrateFn:(a,i)=>[["chat.experimental.detectParticipant.enabled",{value:void 0}],["chat.detectParticipant.enabled",{value:a!==!1}]]},{key:"chat.useClaudeSkills",migrateFn:(a,i)=>[["chat.useClaudeSkills",{value:void 0}],["chat.useAgentSkills",{value:a}]]},{key:xie,migrateFn:a=>typeof a=="boolean"?{value:Object.fromEntries(uNe.map(i=>[i,a]))}:{value:a}},{key:"chat.notifyWindowOnConfirmation",migrateFn:a=>a===!0?{value:"windowNotFocused"}:a===!1?{value:"off"}:[]},{key:"chat.notifyWindowOnResponseReceived",migrateFn:a=>a===!0?{value:"windowNotFocused"}:a===!1?{value:"off"}:[]},{key:"chat.plugins.paths",migrateFn:(a,i)=>[["chat.plugins.paths",{value:void 0}],["chat.pluginLocations",{value:a}]]},{key:"chat.agent.sandbox.allowedNetworkDomains",migrateFn:(a,i)=>{let e=[];return e.push(["chat.agent.sandbox.allowedNetworkDomains",{value:void 0}]),a!==void 0&&i("chat.agent.allowedNetworkDomains")===void 0&&e.push(["chat.agent.allowedNetworkDomains",{value:a}]),e}},{key:"chat.agent.sandbox.deniedNetworkDomains",migrateFn:(a,i)=>{let e=[];return e.push(["chat.agent.sandbox.deniedNetworkDomains",{value:void 0}]),a!==void 0&&i("chat.agent.deniedNetworkDomains")===void 0&&e.push(["chat.agent.deniedNetworkDomains",{value:a}]),e}},{key:"chat.agent.sandboxNetwork.allowedDomains",migrateFn:(a,i)=>{let e=[];return e.push(["chat.agent.sandboxNetwork.allowedDomains",{value:void 0}]),a!==void 0&&i("chat.agent.allowedNetworkDomains")===void 0&&e.push(["chat.agent.allowedNetworkDomains",{value:a}]),e}},{key:"chat.agent.sandboxNetwork.deniedDomains",migrateFn:(a,i)=>{let e=[];return e.push(["chat.agent.sandboxNetwork.deniedDomains",{value:void 0}]),a!==void 0&&i("chat.agent.deniedNetworkDomains")===void 0&&e.push(["chat.agent.deniedNetworkDomains",{value:a}]),e}}]);var SUe=class extends k{constructor(e,t,o){super();this.editorResolverService=t;this.instantiationService=o;this._editorRegistrations=this._register(new Ot);this._registerEditor(Q.vscodeChatEditor),this._registerEditor(Q.vscodeLocalChatSession),this._register(e.onDidChangeContentProviderSchemes(n=>{for(let r of n.added)this._registerEditor(r);for(let r of n.removed)this._editorRegistrations.deleteAndDispose(r)}));for(let n of e.getContentProviderSchemes())this._registerEditor(n)}static{this.ID="workbench.contrib.chatResolver"}_registerEditor(e){this._editorRegistrations.set(e,this.editorResolverService.registerEditor(`${e}:**/**`,{id:tl.EditorID,label:d(7356,null),priority:"builtin"},{singlePerResource:!0,canSupportResource:t=>t.scheme===e},{createEditorInput:({resource:t,options:o})=>({editor:this.instantiationService.createInstance(tl,t,o),options:o})}))}};SUe=I([m(0,Ms),m(1,il),m(2,F)],SUe);var IUe=class extends k{constructor(e,t){super();this.telemetryService=e;this.chatEntitlementService=t;this.updateCopilotTrackingId(),this._register(this.chatEntitlementService.onDidChangeEntitlement(()=>{this.updateCopilotTrackingId()}))}static{this.ID="workbench.contrib.copilotTelemetry"}updateCopilotTrackingId(){let e=this.chatEntitlementService.copilotTrackingId;e&&this.telemetryService.setCommonProperty("common.copilotTrackingId",e)}};IUe=I([m(0,_e),m(1,dr)],IUe);var yUe=class{static{this.ID="workbench.contrib.chatDebugResolver"}constructor(i){i.registerEditor(`${zE.RESOURCE.scheme}:**/**`,{id:zE.ID,label:d(7578,null),priority:"exclusive"},{singlePerResource:!0,canSupportResource:e=>e.scheme===zE.RESOURCE.scheme},{createEditorInput:()=>({editor:zE.instance,options:{pinned:!0}})})}};yUe=I([m(0,il)],yUe);var wUe=class extends k{constructor(e,t,o){super();this.experimentService=e;this.entitlementService=t;this.contextKeyService=o;this.newChatButtonExperimentIcon=Z.newChatButtonExperimentIcon.bindTo(this.contextKeyService),this.registerMaxRequestsSetting(),this.registerNewChatButtonIcon(),this.registerDefaultModeSetting()}static{this.ID="workbench.contrib.chatAgentSetting"}registerMaxRequestsSetting(){let e,t=()=>{let o=this.entitlementService.entitlement===5?"chatAgentMaxRequestsFree":"chatAgentMaxRequestsPro";this.experimentService.getTreatment(o).then(n=>{let r={id:"chatSidebar",title:d(7584,null),type:"object",properties:{"chat.agent.maxRequests":{type:"number",markdownDescription:d(7360,null),default:n??50,order:2,agentsWindow:{default:1e3}}}};$3t.updateConfigurations({remove:e?[e]:[],add:[r]}),e=r})};this._register(U.runAndSubscribe(U.debounce(this.entitlementService.onDidChangeEntitlement,()=>{},1e3),()=>t()))}registerNewChatButtonIcon(){this.experimentService.getTreatment("chatNewButtonIcon").then(e=>{typeof e=="string"&&["copilot","new-session","comment"].includes(e)?this.newChatButtonExperimentIcon.set(e):this.newChatButtonExperimentIcon.reset()})}registerDefaultModeSetting(){this.experimentService.getTreatment("chatDefaultNewSessionMode").then(e=>{let t={id:"chatSidebar",title:d(7584,null),type:"object",properties:{"chat.newSession.defaultMode":{type:"string",description:d(7495,null),default:typeof e=="string"?e:""}}};$3t.updateConfigurations({add:[t],remove:[]})})}};wUe=I([m(0,wN),m(1,dr),m(2,X)],wUe);var CUe=class extends k{constructor(e,t,o,n){super();this.contextKeyService=e;this.chatWidgetService=t;this.viewsService=o;this.editorService=n;this.foregroundSessionCountContextKey=Z.foregroundSessionCount.bindTo(this.contextKeyService),this._register(this.chatWidgetService.onDidAddWidget(()=>{this.updateForegroundSessionCount()})),this._register(this.editorService.onDidVisibleEditorsChange(()=>{this.updateForegroundSessionCount()})),this._register(U.filter(this.viewsService.onDidChangeViewVisibility,r=>r.id===Xr)(()=>{this.updateForegroundSessionCount()})),this.updateForegroundSessionCount()}static{this.ID="workbench.contrib.chatForegroundSessionCount"}updateForegroundSessionCount(){let e=this.viewsService.isViewVisible(Xr)?1:0;for(let t of this.chatWidgetService.getWidgetsByLocations("panel"))t.domNode.offsetParent!==null&&(tw(t.viewContext)||Ppe(t.viewContext)&&t.viewContext.isQuickChat||e++);this.foregroundSessionCountContextKey.set(e)}};CUe=I([m(0,X),m(1,Lt),m(2,Gt),m(3,ie)],CUe);function $yn(a,i){let e=new Set,t=new Set(a.map(n=>n.name.get())),o=new Map;for(let n of i){let r=n.name.get();if(t.has(r))continue;let s=o.get(r);s&&e.delete(s),o.set(r,n.id),e.add(n.id)}return e}var xUe=class extends k{constructor(e,t){super();this.chatWidgetService=t;this._modeActionDisposables=new Ot;this._store.add(this._modeActionDisposables);let o=vi(this,this.chatWidgetService.onDidChangeFocusedSession,()=>this.chatWidgetService.lastFocusedWidget);this._register(ve(n=>{let r=o.read(n)?.input.currentChatModesObs.read(n);this._syncModeActions(r)}))}static{this.ID="workbench.contrib.chatAgentActions"}_syncModeActions(e){if(!e){this._modeActionDisposables.clearAndDisposeAll();return}let{builtin:t,custom:o}=e,n=$yn(t,o);for(let r of this._modeActionDisposables.keys())n.has(r)||this._modeActionDisposables.deleteAndDispose(r);for(let r of o)n.has(r.id)&&!this._modeActionDisposables.has(r.id)&&this._registerModeAction(r)}_registerModeAction(e){let t=class extends lhe{constructor(){super(e)}};this._modeActionDisposables.set(e.id,W(t))}};xUe=I([m(0,kE),m(1,Lt)],xUe);var kUe=class extends k{constructor(e,t){super();this._configurationService=e;this._pathService=t;this._registrations=this._register(new O);this._updateAssociations(),this._register(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(El.HOOKS_LOCATION_KEY)&&this._updateAssociations()}))}static{this.ID="workbench.contrib.hookSchemaAssociation"}async _updateAssociations(){this._registrations.clear();let e=El.promptSourceFolders(this._configurationService,"hook"),t=await this._pathService.userHome(),o=t.fsPath??t.path;for(let n of e){if(n.source==="claude-workspace"||n.source==="claude-workspace-local"||n.source==="claude-personal")continue;let r=eXe(n.path)?o+n.path.substring(1):n.path,s=r.toLowerCase().endsWith(".json")?r:`${r}/*.json`;this._registrations.add(sPo.registerSchemaAssociation(RSi,s))}}};kUe=I([m(0,B),m(1,Pn)],kUe);var EUe=class extends k{constructor(e){super();this._languageModelToolsService=e;this._updateToolReferenceNames(),this._register(this._languageModelToolsService.onDidChangeTools(()=>this._updateToolReferenceNames()))}static{this.ID="workbench.contrib.toolReferenceNames"}_updateToolReferenceNames(){let e=Array.from(this._languageModelToolsService.getAllToolsIncludingDisabled()).filter(t=>typeof t.toolReferenceName=="string").sort((t,o)=>t.toolReferenceName.localeCompare(o.toolReferenceName));oBi.length=0,nBi.length=0;for(let t of e)oBi.push(t.toolReferenceName),nBi.push(d(7536,null,t.toolReferenceName,t.userDescription||t.displayName));$3t.notifyConfigurationSchemaUpdated({id:"chatSidebar",properties:{"chat.tools.eligibleForAutoApproval":{}}})}};EUe=I([m(0,Wn)],EUe);_a.register(new $4t);_a.register(new kjt);_a.register(new d5t);_a.register(new u5t);_a.register(new p5t);_a.register(new m5t);Qk(eHe);oe.as(en.EditorFactory).registerEditorSerializer(tl.TypeID,cNt);oe.as(en.EditorFactory).registerEditorSerializer(zE.ID,U5t);bt(IUe.ID,IUe,vt.BlockRestore);bt(SUe.ID,SUe,vt.BlockStartup);bt(yUe.ID,yUe,vt.BlockStartup);bt(S$.ID,S$,vt.BlockRestore);bt(pbe.ID,pbe,vt.BlockRestore);bt(Bbe.ID,Bbe,vt.Eventually);bt(Hbe.ID,Hbe,vt.Eventually);bt(Cbe.ID,Cbe,vt.BlockStartup);bt(Upe.ID,Upe,vt.BlockRestore);bt(zve.ID,zve,vt.BlockRestore);bt(xbe.ID,xbe,vt.Eventually);bt(Yve.ID,Yve,vt.BlockRestore);bt(Qve.ID,Qve,vt.BlockRestore);bt(Ffe.ID,Ffe,vt.Eventually);bt(Gbe.ID,Gbe,vt.BlockStartup);bt(h$.ID,h$,vt.Eventually);bt(kbe.ID,kbe,vt.BlockRestore);bt(T1.ID,T1,vt.BlockRestore);bt(Ebe.ID,Ebe,vt.AfterRestored);bt(g9.ID,g9,vt.BlockRestore);bt(Gve.ID,Gve,vt.Eventually);bt($ve.ID,$ve,vt.BlockRestore);bt(qve.ID,qve,vt.BlockRestore);bt(wUe.ID,wUe,vt.AfterRestored);bt(CUe.ID,CUe,vt.AfterRestored);bt(xUe.ID,xUe,vt.Eventually);bt(kUe.ID,kUe,vt.AfterRestored);bt(EUe.ID,EUe,vt.AfterRestored);bt(ebe.ID,ebe,vt.Eventually);bt(abe.ID,abe,vt.AfterRestored);bt(jbe.ID,jbe,vt.BlockRestore);bt(dbe.ID,dbe,vt.AfterRestored);bt(_fe.ID,_fe,vt.AfterRestored);bt(tbe.ID,tbe,vt.BlockRestore);bt(Xve.ID,Xve,vt.AfterRestored);bt(Kbe.ID,Kbe,vt.BlockRestore);bt(zbe.ID,zbe,vt.BlockRestore);bt(ube.ID,ube,vt.BlockStartup);bt(gve.ID,gve,vt.AfterRestored);bt(Gfe.ID,Gfe,vt.Eventually);bt(Kve.ID,Kve,vt.Eventually);bt(qbe.ID,qbe,vt.AfterRestored);bt($be.ID,$be,vt.Eventually);bt(Obe.ID,Obe,vt.Eventually);bt(Vbe.ID,Vbe,vt.Eventually);Jmo();u_o();S_o();qDo();k_o();T_o();SDo();VDo();rEo();Owo();GDo();P_o();wDo();ODo();FDo();sDo();vDo();rLo();sEo();lxo();CDo();ADo();iPo();W(BFe);Qk(sFe);Vpe.register(new Vt(nUe));Vpe.register(new Vt(rUe));Vpe.register(new Vt(aUe));Vpe.register(new Vt(sUe));Ce(Fst,wWe,1);Ce(QVe,jVe,1);Ce(si,XVe,1);Ce(Lt,bUe,1);Ce(JD,PHe,1);Ce(F0,ZBe,1);Ce(Eet,JLe,1);Ce(_H,pHe,1);Ce(Gr,E3,1);Ce(Kmo,iMe,1);Ce(rN,sDe,1);Ce(gr,iDe,1);Ce(P2,nDe,1);Ce(LPt,lDe,1);Ce(mm,oUe,1);Ce(jC,NBe,1);Ce(B5t,ABe,1);Ce(g$,mUe,1);Ce(Lre,hUe,1);Ce(uI,gUe,1);Ce(Wn,RO,1);Ce(tUe,iUe,1);Ce(IR,eUe,1);Ce(UFe,HFe,1);Ce(Cjt,Eb,1);Ce(TZ,J4t,1);Ce(BZ,nAt,1);Ce(mu,dHe,1);Ce(gS,sqt,1);Ce(bW,uMe,1);Ce(H_e,WMt,1);Ce(jr,bDe,1);Ce(iI,oWt,1);Ce(kE,jLe,1);Ce(nV,aFe,1);Ce(gFe,aGt,1);Ce(vW,sMe,1);Ce(LG,rMe,1);Ce(a8,XRe,1);Ce(X2t,uHe,1);Ce(Wq,ZGt,1);Ce(IV,BWe,1);Ce(ph,z5t,1);Ce(Eoe,_Fe,1);my.CONTRIBS.push(ab);var j3t=class extends z{constructor(){super({id:"workbench.action.chat.forkConversation",title:P(6528,"Fork Conversation"),tooltip:P(6529,"Fork conversation from this point"),f1:!1,category:fi,icon:L.repoForked,precondition:Z.enabled,menu:[{id:R.ChatMessageCheckpoint,group:"navigation",order:3,when:C.and(Z.isRequest,Z.isFirstRequest.negate(),C.or(C.or(Z.lockedToCodingAgent.negate(),Lx.isAgentHostSession),Z.chatSessionSupportsFork))}]});this.pendingFork=new Map}async run(e,...t){let o=e.get(Lt),n=e.get(F),r=e.get(si),s=e.get(Ms),l=d(6531,null);if(A.isUri(t[0])){let M=t[0];if(s.getContentProviderSchemes().includes(yn(M)))return await this.forkContributedChatSession(M,void 0,!1,s,o);let V=r.getSession(M);if(!V)return;let H=V.toJSON();if(H.requests.length===0)return;let K=er(JSON.parse(JSON.stringify(H)));K.sessionId=ht();let j=Date.now();K.creationDate=j,K.customTitle=V.title.startsWith(l)?V.title:d(6530,null,V.title);for(let[ae,ce]of K.requests.entries())ce.shouldBeRemovedOnSend=void 0,ce.isHidden=void 0,ce.requestId=ht(),ce.responseId=ce.responseId?ht():void 0,ce.timestamp=j+ae,ce.response&&(ce.modelState={value:1,completedAt:j+ae});let J=r.loadSessionFromData(K,"ChatForkActions#forkCleanSession"),se=J.object.sessionResource;setTimeout(async()=>{try{await this._openForkedSession(n,V.sessionResource,se)}finally{J.dispose()}},0);return}let c=t[0],u=EE(c)?c:EE(c?.element)?c.element:EE(c?.context)?c.context:EE(c?.item)?c.item:void 0,p=u&&o.getWidgetBySessionResource(u.sessionResource)||o.lastFocusedWidget;if(!Ni(u)&&!_r(u)&&(u=p?.getFocus()),!u)return;let h=p?.viewModel?.sessionResource??(EE(u)?u.sessionResource:void 0);if(!h)return;let g=_r(u)?u.id:Ni(u)?u.requestId:void 0;if(!g)return;if(s.getContentProviderSchemes().includes(yn(h))){let N=(await s.getOrCreateChatSession(h,Ie.None)).history.find(V=>V.type==="request"&&V.id===g);if(!N){let H=r.getSession(h)?.toJSON();for(let[,K]of H?.requests.entries()??[])if(K.requestId===g){N={id:K.requestId,type:"request",prompt:typeof K.message=="string"?K.message:K.message.text,participant:K.agent?.id??"",variableData:K.variableData,modelId:K.modelId};break}}return await this.forkContributedChatSession(h,N,!0,s,o)}let v=r.getSession(h);if(!v)return;let b=v.toJSON(),S=_r(u),y=-1;if(p?.viewModel){let M=-1;for(let N of p.viewModel.getItems())if(_r(N)&&(M+=1),N.id===u?.id){y=_r(N)?Math.max(0,M-1):M;break}}if(y<0){let M=v.getRequests().findIndex(N=>N.id===g);y=S?Math.max(0,M-1):M}if(y<0)return;let w=er(JSON.parse(JSON.stringify({...b,requests:b.requests.slice(0,y+1)})));w.sessionId=ht();let x=Date.now();w.creationDate=x,w.customTitle=v.title.startsWith(l)?v.title:d(6530,null,v.title);for(let[M,N]of w.requests.entries())N.shouldBeRemovedOnSend=void 0,N.isHidden=void 0,N.requestId=ht(),N.responseId=N.responseId?ht():void 0,N.timestamp=x+M,N.response&&(N.modelState={value:1,completedAt:x+M});let E=r.loadSessionFromData(w,"ChatForkActions#forkSession");if(E)try{let M=E.object.sessionResource;await this._openForkedSession(n,v.sessionResource,M)}finally{E.dispose()}}async _openForkedSession(e,t,o){await e.invokeFunction(async n=>{await n.get(Lt).openSession(o,XD)})}async forkContributedChatSession(e,t,o,n,r){let s=`${e.toString()}@${t?.id??"full"}`,l=this.pendingFork.get(s);if(l)return l;let c=jyn(e,t,o,n,r);this.pendingFork.set(s,c);try{await c}finally{this.pendingFork.delete(s)}}};async function jyn(a,i,e,t,o){let n=new qe;try{let r=await t.forkChatSession(a,i,n.token);e?await o.openSession(r.resource,XD):setTimeout(async()=>{await o.openSession(r.resource,XD)},0)}finally{n.dispose()}}W(j3t);function Hct(a){switch(a){case 1:return"file";case 2:return"workspace";case 3:return"exe"}}var Pre=le("IExtensionRecommendationNotificationService");var W$=class a{constructor(i,e){this.value=i;this.sortBy=e;this.value=i.trim()}static suggestions(i,e){let t=["installed","updates","enabled","disabled","builtin","contribute"];e?.capabilities.extensionQuery?.filtering?.some(p=>p.name==="Featured")&&t.push("featured"),t.push("mcp","agentPlugins","popular","recommended","recentlyPublished","workspaceUnsupported","deprecated","sort");let o=e?.capabilities.extensionQuery?.filtering?.some(p=>p.name==="Category");o&&t.push("category"),t.push("tag","ext","id","outdated","recentlyUpdated","restartRequired");let n=[];e?.capabilities.extensionQuery?.sorting?.some(p=>p.name==="InstallCount")&&n.push("installs"),e?.capabilities.extensionQuery?.sorting?.some(p=>p.name==="WeightedRating")&&n.push("rating"),n.push("name","publishedDate","updateDate");let r=[];for(let p of oe.as(qs.ExtensionFeaturesRegistry).getExtensionFeatures())r.push(p.id);let s={sort:n,category:o?m0.map(p=>`"${p.toLowerCase()}"`):[],tag:[""],ext:[""],id:[""],contribute:r},l=p=>i.indexOf(p)>-1,c=s.sort.some(p=>l(`@sort:${p}`)),u=s.category.some(p=>l(`@category:${p}`));return t.flatMap(p=>c&&p==="sort"||u&&p==="category"?[]:p in s?s[p].map(h=>`@${p}:${h}${h===""?"":" "}`):l(`@${p}`)?[]:[`@${p} `])}static parse(i){let e="";return i=i.replace(/@sort:(\w+)(-\w*)?/g,(t,o,n)=>(e=o,"")),new a(i,e)}toString(){let i=this.value;return this.sortBy&&(i=`${i}${i?" ":""}@sort:${this.sortBy}`),i}isValid(){return!/@outdated/.test(this.value)}equals(i){return this.value===i.value&&this.sortBy===i.sortBy}};var Qyn=Oe("extensions-editor-label-icon",L.extensions,d(11896,null)),V$=class a extends Ls{constructor(e){super();this._extension=e}static{this.ID="workbench.extensions.input2"}get typeId(){return a.ID}get capabilities(){return 10}get resource(){return A.from({scheme:Q.extension,path:td(this._extension.identifier.id,"extension")})}get extension(){return this._extension}getName(){return d(11897,null,this._extension.displayName)}getIcon(){return Qyn}matches(e){return super.matches(e)?!0:e instanceof a&&Ht(this._extension.identifier,e._extension.identifier)}};var Yyn="vscode_searchExtensions_internal",rBi={id:Yyn,toolReferenceName:"extensions",legacyToolReferenceFullNames:["extensions"],icon:q.fromId(L.extensions.id),displayName:d(11904,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:d(11906,null),source:wn.Internal,inputSchema:{type:"object",properties:{category:{type:"string",description:"The category of extensions to search for",enum:m0},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"}}}},TUe=class{constructor(i){this.extensionWorkbenchService=i}async invoke(i,e,t,o){let n=i.parameters;if(!n.keywords?.length&&!n.category&&!n.ids?.length)return{content:[{kind:"text",value:d(11905,null)}]};let r=new Map,s=u=>{for(let p of u)p.deprecationInfo||p.isMalicious||r.set(p.identifier.id.toLowerCase(),{id:p.identifier.id,name:p.displayName,description:p.description,installed:p.state===1,installCount:p.installCount??0,rating:p.rating??0,categories:p.categories??[],tags:p.gallery?.tags??[]})},l=async u=>{let p=await this.extensionWorkbenchService.queryGallery({text:u,pageSize:10,sortBy:"InstallCount"},o);p.firstPage.length&&s(p.firstPage)};if(n.ids?.length){let u=await this.extensionWorkbenchService.getExtensions(n.ids.map(p=>({id:p})),o);s(u)}if(n.keywords?.length)for(let u of n.keywords??[])if(u==="featured")await l("featured");else{let p=n.category?`category:"${n.category}"`:"";p=u?`${p} ${u}`.trim():p,await l(p)}else await l(`category:"${n.category}"`);let c=Array.from(r.values());return{content:[{kind:"text",value:`Here are the list of extensions:
${JSON.stringify(c)}
. 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(n),output:[{type:"embed",isText:!0,value:JSON.stringify(c.map(u=>u.id))}]}}}};TUe=I([m(0,Ui)],TUe);var _Ue=class extends k{constructor(e,t,o,n){super();this.extensionService=e;this.hoverService=t;this.extensionFeaturesManagementService=o;this.markdownRendererService=n;this.type="element"}static{this.ID="runtimeStatus"}shouldRender(e){let t=new hi(zS(e.publisher,e.name));return this.extensionService.extensions.some(o=>hi.equals(o.identifier,t))?!!e.main||!!e.browser:!1}render(e){let t=new O,o=new hi(zS(e.publisher,e.name)),n=t.add(new T);return t.add(this.extensionService.onDidChangeExtensionsStatus(r=>{r.some(s=>hi.equals(s,o))&&n.fire(this.createElement(e,t))})),t.add(this.extensionFeaturesManagementService.onDidChangeAccessData(r=>n.fire(this.createElement(e,t)))),{onDidChange:n.event,data:this.createElement(e,t),dispose:()=>t.dispose()}}createElement(e,t){let o=_(".runtime-status"),n=new hi(zS(e.publisher,e.name)),r=this.extensionService.getExtensionsStatus()[n.value];if(this.extensionService.extensions.some(l=>hi.equals(l.identifier,n))){let l=new he;l.appendMarkdown(`### ${d(11332,null)}

`),r.activationTimes?r.activationTimes.activationReason.startup?l.appendMarkdown(`Activated on Startup: \`${r.activationTimes.activateCallTime}ms\``):l.appendMarkdown(`Activated by \`${r.activationTimes.activationReason.activationEvent}\` event: \`${r.activationTimes.activateCallTime}ms\``):l.appendMarkdown("Not yet activated"),this.renderMarkdown(l,o,t)}let s=oe.as(qs.ExtensionFeaturesRegistry).getExtensionFeatures();for(let l of s){let c=this.extensionFeaturesManagementService.getAccessData(n,l.id);if(c){if(this.renderMarkdown(new he(`
 ### ${d(11340,null,l.label)}

`),o,t),c.accessTimes.length){let p=D(o,_(".feature-chart-description",void 0,d(11334,null,c?.accessTimes.length,l.accessDataLabel??l.label)));p.style.marginBottom="8px",this.renderRequestsChart(o,c.accessTimes,t)}let u=c?.current?.status;if(u){let p=new he;u?.severity===wt.Error&&p.appendMarkdown(`$(${cI.id}) ${u.message}

`),u?.severity===wt.Warning&&p.appendMarkdown(`$(${fp.id}) ${u.message}

`),p.value&&this.renderMarkdown(p,o,t)}}}if(r.runtimeErrors.length||r.messages.length){let l=new he;if(r.runtimeErrors.length){l.appendMarkdown(`
 ### ${d(11346,null,r.runtimeErrors.length)}
`);for(let c of r.runtimeErrors)l.appendMarkdown(`$(${L.error.id})&nbsp;${Dn(c)}

`)}if(r.messages.length){l.appendMarkdown(`
 ### ${d(11341,null,r.messages.length)}
`);for(let c of r.messages)l.appendMarkdown(`$(${(c.type===wt.Error?L.error:c.type===wt.Warning?L.warning:L.info).id})&nbsp;${c.message}

`)}l.value&&this.renderMarkdown(l,o,t)}return o}renderMarkdown(e,t,o){let{element:n}=o.add(this.markdownRendererService.render({value:e.value,isTrusted:e.isTrusted,supportThemeIcons:!0}));D(t,n)}renderRequestsChart(e,t,o){let s={top:0,right:4,bottom:20,left:4},l=450-s.left-s.right,c=250-s.top-s.bottom,u=D(e,_(".feature-chart-container"));u.style.position="relative";let p=D(u,_(".feature-chart-tooltip"));p.style.position="absolute",p.style.width="0px",p.style.height="0px";let h=100,g=new Map;for(let H of t){let K=`${H.getDate()} ${H.toLocaleString("default",{month:"short"})}`;g.set(K,(g.get(K)??0)+1),h=Math.max(h,g.get(K))}let f=new Date,v=[];for(let H=0;H<=30;H++){let K=new Date(f);K.setDate(f.getDate()-(30-H));let j=`${K.getDate()} ${K.toLocaleString("default",{month:"short"})}`,J=g.get(j)??0,se=H/30*l,ae=c-J/h*c;v.push({x:se,y:ae,date:j,count:J})}let b=D(u,_(".feature-chart")),S=D(b,_.SVG("svg"));S.setAttribute("width","450px"),S.setAttribute("height","250px"),S.setAttribute("viewBox","0 0 450 250");let y=_.SVG("g");y.setAttribute("transform",`translate(${s.left},${s.top})`),S.appendChild(y);let w=_.SVG("line");w.setAttribute("x1","0"),w.setAttribute("y1",`${c}`),w.setAttribute("x2",`${l}`),w.setAttribute("y2",`${c}`),w.setAttribute("stroke",Tt(lsi)),w.setAttribute("stroke-width","1px"),y.appendChild(w);for(let H=1;H<=30;H+=7){let K=new Date(f);K.setDate(f.getDate()-(30-H));let j=`${K.getDate()} ${K.toLocaleString("default",{month:"short"})}`,J=H/30*l,se=_.SVG("line");se.setAttribute("x1",`${J}`),se.setAttribute("y1",`${c}`),se.setAttribute("x2",`${J}`),se.setAttribute("y2",`${c+10}`),se.setAttribute("stroke",Tt(lsi)),se.setAttribute("stroke-width","1px"),y.appendChild(se);let ae=_.SVG("line");ae.setAttribute("x1",`${J}`),ae.setAttribute("y1","0"),ae.setAttribute("x2",`${J}`),ae.setAttribute("y2",`${c}`),ae.setAttribute("stroke",Tt(F9i)),ae.setAttribute("stroke-width","1px"),y.appendChild(ae);let ce=_.SVG("text");ce.setAttribute("x",`${J}`),ce.setAttribute("y","250"),ce.setAttribute("text-anchor","middle"),ce.setAttribute("fill",Tt(xo)),ce.setAttribute("font-size","10px"),ce.textContent=j,y.appendChild(ce)}let x=_.SVG("polyline");x.setAttribute("fill","none"),x.setAttribute("stroke",Tt(O9i)),x.setAttribute("stroke-width","2px"),x.setAttribute("points",v.map(H=>`${H.x},${H.y}`).join(" ")),y.appendChild(x);let E=_.SVG("circle");E.setAttribute("r","4px"),E.style.display="none",y.appendChild(E);let M=o.add(new ue),N=H=>{let K=S.getBoundingClientRect(),j=H.clientX-K.left-s.left,J,se=1/0;v.forEach(ae=>{let ce=Math.abs(ae.x-j);ce<se&&(se=ce,J=ae)}),J?(E.setAttribute("cx",`${J.x}`),E.setAttribute("cy",`${J.y}`),E.style.display="block",p.style.left=`${J.x+24}px`,p.style.top=`${J.y+14}px`,M.value=this.hoverService.showInstantHover({content:new he(`${J.date}: ${J.count} requests`),target:p,appearance:{showPointer:!0,skipFadeInAnimation:!0}})):M.value=void 0};o.add($(S,ne.MOUSE_MOVE,N));let V=()=>{E.style.display="none",M.value=void 0};o.add($(S,ne.MOUSE_LEAVE,V))}};_Ue=I([m(0,lt),m(1,ot),m(2,Qy),m(3,_n)],_Ue);var sBi={id:_Ue.ID,label:d(11345,null),access:{canToggle:!1},renderer:new Vt(_Ue)},DUe=class extends ju{constructor(e,t,o,n){super(o);this.manifest=e;this.feature=t;this.instantiationService=n;this.featureView=this._register(new ue);this.layoutParticipants=[];this.extensionId=new hi(zS(e.publisher,e.name)),this.domNode=_("div.subcontent.feature-contributions"),this.create()}layout(e,t){this.layoutParticipants.forEach(o=>o.layout(e,t))}create(){let e=this.getFeatures();if(e.length===0){D(_(".no-features"),this.domNode).textContent=d(11342,null);return}let t=this._register(new Gp(this.domNode,{orientation:1,proportionalLayout:!0}));this.layoutParticipants.push({layout:(l,c)=>{t.el.style.height=`${l-14}px`,t.layout(c)}});let o=_(".features-list-container"),n=this._register(this.createFeaturesList(o));n.splice(0,n.length,e);let r=_(".feature-view-container");this._register(n.onDidChangeSelection(l=>{let c=l.elements[0];c&&this.showFeatureView(c,r)}));let s=this.feature?e.findIndex(l=>l.id===this.feature):0;n.setSelection([s===-1?0:s]),t.addView({onDidChange:U.None,element:o,minimumSize:100,maximumSize:Number.POSITIVE_INFINITY,layout:(l,c,u)=>{o.style.width=`${l}px`,n.layout(u,l)}},200,void 0,!0),t.addView({onDidChange:U.None,element:r,minimumSize:500,maximumSize:Number.POSITIVE_INFINITY,layout:(l,c,u)=>{r.style.width=`${l}px`,this.featureViewDimension={height:u,width:l},this.layoutFeatureView()}},Ac.Distribute,void 0,!0),t.style({separatorBorder:this.theme.getColor(wMt)})}createFeaturesList(e){let t=this.instantiationService.createInstance(Uct,this.extensionId),o=new aBi;return this.instantiationService.createInstance(bc,"ExtensionFeaturesList",D(e,_(".features-list-wrapper")),o,[t],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(r){return r?.label??""},getWidgetAriaLabel(){return d(11338,null)}},openOnSingleClick:!0})}layoutFeatureView(){this.featureView.value?.layout(this.featureViewDimension?.height,this.featureViewDimension?.width)}showFeatureView(e,t){this.featureView.value?.feature.id!==e.id&&(St(t),this.featureView.value=this.instantiationService.createInstance(zct,this.extensionId,this.manifest,e),t.appendChild(this.featureView.value.domNode),this.layoutFeatureView())}getFeatures(){let e=oe.as(qs.ExtensionFeaturesRegistry).getExtensionFeatures().filter(o=>{let n=this.getRenderer(o),r=n?.shouldRender(this.manifest);return n?.dispose(),r}).sort((o,n)=>o.label.localeCompare(n.label)),t=this.getRenderer(sBi);return t?.shouldRender(this.manifest)&&e.splice(0,0,sBi),t?.dispose(),e}getRenderer(e){return e.renderer?this.instantiationService.createInstance(e.renderer):void 0}};DUe=I([m(2,Pe),m(3,F)],DUe);var aBi=class{getHeight(){return 22}getTemplateId(){return"extensionFeatureDescriptor"}},Uct=class{constructor(i,e){this.extensionId=i;this.extensionFeaturesManagementService=e;this.templateId="extensionFeatureDescriptor"}renderTemplate(i){i.classList.add("extension-feature-list-item");let e=D(i,_(".extension-feature-label")),t=D(i,_(".extension-feature-disabled-label"));t.textContent=d(11344,null);let o=D(i,_(".extension-feature-status"));return{label:e,disabledElement:t,statusElement:o,disposables:new O}}renderElement(i,e,t){t.disposables.clear(),t.label.textContent=i.label,t.disabledElement.style.display=i.id===sBi.id||this.extensionFeaturesManagementService.isEnabled(this.extensionId,i.id)?"none":"inherit",t.disposables.add(this.extensionFeaturesManagementService.onDidChangeEnablement(({extension:r,featureId:s,enabled:l})=>{hi.equals(r,this.extensionId)&&s===i.id&&(t.disabledElement.style.display=l?"none":"inherit")}));let o=t.statusElement.className,n=()=>{let r=this.extensionFeaturesManagementService.getAccessData(this.extensionId,i.id);r?.current?.status?(t.statusElement.style.display="inherit",t.statusElement.className=`${o} ${eE.className(r.current.status.severity)}`):t.statusElement.style.display="none"};n(),t.disposables.add(this.extensionFeaturesManagementService.onDidChangeAccessData(({extension:r,featureId:s})=>{hi.equals(r,this.extensionId)&&s===i.id&&n()}))}disposeElement(i,e,t){t.disposables.dispose()}disposeTemplate(i){i.disposables.dispose()}};Uct=I([m(1,Qy)],Uct);var zct=class extends k{constructor(e,t,o,n,r,s,l){super();this.extensionId=e;this.manifest=t;this.feature=o;this.instantiationService=n;this.extensionFeaturesManagementService=r;this.dialogService=s;this.markdownRendererService=l;this.layoutParticipants=[];this.domNode=_(".extension-feature-content"),this.create(this.domNode)}create(e){let t=D(e,_(".feature-header")),o=D(t,_(".feature-title"));if(o.textContent=this.feature.label,this.feature.access.canToggle){let u=D(t,_(".feature-actions")),p=new Pi(u,Ro);this.updateButtonLabel(p),this._register(this.extensionFeaturesManagementService.onDidChangeEnablement(({extension:h,featureId:g})=>{hi.equals(h,this.extensionId)&&g===this.feature.id&&this.updateButtonLabel(p)})),this._register(p.onDidClick(async()=>{let h=this.extensionFeaturesManagementService.isEnabled(this.extensionId,this.feature.id);(await this.dialogService.confirm({title:d(11331,null,this.feature.label),message:h?d(11335,null,this.manifest.displayName??this.extensionId.value,this.feature.label):d(11337,null,this.manifest.displayName??this.extensionId.value,this.feature.label),custom:!0,primaryButton:h?d(11343,null):d(11339,null),cancelButton:d(11333,null)})).confirmed&&this.extensionFeaturesManagementService.setEnablement(this.extensionId,this.feature.id,!h)}))}let n=D(e,_(".feature-body")),r=_(".feature-body-content"),s=this._register(new Ar(r,{}));if(D(n,s.getDomNode()),this.layoutParticipants.push({layout:()=>s.scanDomNode()}),s.scanDomNode(),this.feature.description){let u=D(r,_(".feature-description"));u.textContent=this.feature.description}let l=this.extensionFeaturesManagementService.getAccessData(this.extensionId,this.feature.id);l?.current?.status&&D(r,_(".feature-status",void 0,_(`span${q.asCSSSelector(l.current.status.severity===wt.Error?cI:l.current.status.severity===wt.Warning?fp:Ef)}`,void 0),_("span",void 0,l.current.status.message)));let c=D(r,_(".feature-content"));if(this.feature.renderer){let u=this.instantiationService.createInstance(this.feature.renderer);u.type==="table"?this.renderTableData(c,u):u.type==="markdown"?this.renderMarkdownData(c,u):u.type==="markdown+table"?this.renderMarkdownAndTableData(c,u):u.type==="element"&&this.renderElementData(c,u)}}updateButtonLabel(e){e.label=this.extensionFeaturesManagementService.isEnabled(this.extensionId,this.feature.id)?d(11343,null):d(11336,null)}renderTableData(e,t){let o=this._register(t.render(this.manifest)),n=this._register(new ue);o.onDidChange&&this._register(o.onDidChange(r=>{St(e),n.value=this.renderTable(r,e)})),n.value=this.renderTable(o.data,e)}renderTable(e,t){let o=new O;return D(t,_("table",void 0,_("tr",void 0,...e.headers.map(n=>_("th",void 0,n))),...e.rows.map(n=>_("tr",void 0,...n.map(r=>{if(typeof r=="string")return _("td",void 0,_("p",void 0,r));let s=Array.isArray(r)?r:[r];return _("td",void 0,...s.map(l=>{let c=[];if(yr(r)){let u=_("",void 0);this.renderMarkdown(r,u),c.push(u)}else if(l instanceof rwe){let u=_("");o.add(new ah(u,Ao,qk)).set(l),c.push(u)}else l instanceof Ue&&(c.push(_("span",{class:"colorBox",style:"background-color: "+Ue.Format.CSS.format(l)},"")),c.push(_("code",void 0,Ue.Format.CSS.formatHex(l))));return c}).flat())}))))),o}renderMarkdownAndTableData(e,t){let o=this._register(t.render(this.manifest));o.onDidChange&&this._register(o.onDidChange(n=>{St(e),this.renderMarkdownAndTable(n,e)})),this.renderMarkdownAndTable(o.data,e)}renderMarkdownData(e,t){e.classList.add("markdown");let o=this._register(t.render(this.manifest));o.onDidChange&&this._register(o.onDidChange(n=>{St(e),this.renderMarkdown(n,e)})),this.renderMarkdown(o.data,e)}renderMarkdown(e,t){let{element:o}=this._register(this.markdownRendererService.render({value:e.value,isTrusted:e.isTrusted,supportThemeIcons:!0}));D(t,o)}renderMarkdownAndTable(e,t){for(let o of e)if(yr(o)){let n=_("",void 0);this.renderMarkdown(o,n),D(t,n)}else{let n=D(t,_("table"));this.renderTable(o,n)}}renderElementData(e,t){let o=this._register(t.render(this.manifest));o.onDidChange&&this._register(o.onDidChange(n=>{St(e),e.appendChild(n)})),e.appendChild(o.data)}layout(e,t){this.layoutParticipants.forEach(o=>o.layout(e,t))}};zct=I([m(3,F),m(4,Qy),m(5,ct),m(6,_n)],zct);var B$="update.showCurrentReleaseNotes",aPo="developer.showCurrentFileAsReleaseNotes";var lBi=class extends k{constructor(e){super();this._onChange=this._register(new T);this.onChange=this._onChange.event;this._currentId=null;let t=D(e,_(".navbar"));this.actions=[],this.actionbar=this._register(new oo(t))}get currentId(){return this._currentId}push(e,t,o){let n=new it(e,t,void 0,!0,()=>this.update(e,!0));n.tooltip=o,this.actions.push(n),this.actionbar.push(n),this.actions.length===1&&this.update(e)}clear(){this.actions=je(this.actions),this.actionbar.clear()}switch(e){let t=this.actions.find(o=>o.id===e);return t?(t.run(),!0):!1}update(e,t){this._currentId=e,this._onChange.fire({id:e,focus:!!t}),this.actions.forEach(o=>o.checked=o.id===e)}dispose(){this.clear(),super.dispose()}};var Xyn=new Y("showPreReleaseVersion",!1),cBi=class extends uy{constructor(){super(...arguments);this._gallery=null}get gallery(){return this._gallery}set gallery(e){this.extension&&e&&!Ht(this.extension.identifier,e.identifier)||(this._gallery=e,this.update())}},dBi=class extends cBi{constructor(i,e){super(),this.element=D(i,_("code.version",void 0,"pre-release")),this._register(e.setupManagedHover(yi("mouse"),this.element,d(11299,null))),this.render()}render(){this.extension?.preRelease?Xo(this.element):Wi(this.element)}},VV=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(VV.ID,e,t,s,p);this.instantiationService=o;this.extensionsWorkbenchService=n;this.extensionGalleryService=r;this.notificationService=l;this.openerService=c;this.extensionRecommendationsService=u;this.extensionService=h;this.webviewService=g;this.languageService=f;this.contextMenuService=v;this.contextKeyService=b;this.hoverService=S;this._scopedContextKeyService=this._register(new ue);this.initialScrollProgress=new Map;this.currentIdentifier="";this.layoutParticipants=[];this.contentDisposables=this._register(new O);this.transientDisposables=this._register(new O);this.activeElement=null;this.extensionReadme=null,this.extensionChangelog=null,this.extensionManifest=null}static{this.ID="workbench.editor.extension"}get scopedContextKeyService(){return this._scopedContextKeyService.value}createEditor(e){let t=D(e,_(".extension-editor"));this._scopedContextKeyService.value=this.contextKeyService.createScoped(t),this._scopedContextKeyService.value.createKey("inExtensionEditor",!0),this.showPreReleaseVersionContextKey=Xyn.bindTo(this._scopedContextKeyService.value),t.tabIndex=0,t.style.outline="none",t.setAttribute("role","document");let o=D(t,_(".header")),n=D(o,_(".icon-container")),r=this.instantiationService.createInstance(Hq,n),s=this.instantiationService.createInstance(Qoe,n,!0),l=D(o,_(".details")),c=D(l,_(".title")),u=D(c,_("span.name.clickable",{role:"heading",tabIndex:0}));this._register(this.hoverService.setupManagedHover(yi("mouse"),u,d(11315,null)));let p=new dBi(c,this.hoverService),h=D(c,_("span.preview"));this._register(this.hoverService.setupManagedHover(yi("mouse"),h,d(11320,null))),h.textContent=d(11320,null);let g=D(c,_("span.builtin"));g.textContent=d(11287,null);let f=D(l,_(".subtitle")),v=[],b=D(f,_(".subtitle-entry"));v.push(b);let S=this.instantiationService.createInstance(joe,b,!1),y=D(f,_(".subtitle-entry"));v.push(y);let w=this.instantiationService.createInstance(Yoe,y,!1),x=D(f,_(".subtitle-entry"));v.push(x);let E=this.instantiationService.createInstance(s1,x,!1),M=D(f,_(".subtitle-entry"));v.push(M);let N=this.instantiationService.createInstance($oe,M,!1),V=D(f,_(".subtitle-entry"));v.push(V);let H=this.instantiationService.createInstance(jFe,V),K=[r,s,p,S,w,E,N,H],j=D(l,_(".description")),J=this.instantiationService.createInstance(zie),se=[this.instantiationService.createInstance(Cq),this.instantiationService.createInstance(ZW),this.instantiationService.createInstance(ZN,!0),this.instantiationService.createInstance(AE),this.instantiationService.createInstance(NE),this.instantiationService.createInstance(OE),this.instantiationService.createInstance(yP),this.instantiationService.createInstance(dk),this.instantiationService.createInstance(VNe),this.instantiationService.createInstance(HR),this.instantiationService.createInstance(BNe),this.instantiationService.createInstance(kQ,!1),this.instantiationService.createInstance(Kie),this.instantiationService.createInstance(Gie),J,this.instantiationService.createInstance(qNe),this.instantiationService.createInstance(Tq,"extensions.uninstall",L_.UninstallClass,[[this.instantiationService.createInstance(JW,!1),this.instantiationService.createInstance(L_),this.instantiationService.createInstance(M_,null,!0)]]),this.instantiationService.createInstance(ck),new HKt(this.scopedContextKeyService||this.contextKeyService,this.instantiationService)],ae=D(l,_(".actions-status-container")),ce=this._register(new oo(ae,{actionViewItemProvider:(zt,mo)=>{if(zt instanceof $U)return zt.createActionViewItem(mo);if(zt instanceof Tq)return new GNe(zt,{...mo,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>zt.menuActions},menuActionClassNames:zt.menuActionClassNames},this.contextMenuService);if(zt instanceof ck)return new DEt(void 0,zt,{...mo,icon:!0,label:!0,checkboxStyles:Ag})},focusOnlyEnabledItems:!0}));ce.push(se,{icon:!0,label:!0}),ce.setFocusable(!0),this._register(U.any(...se.map(zt=>U.filter(zt.onDidChange,mo=>mo.enabled!==void 0)))(()=>{ce.setFocusable(!1),ce.setFocusable(!0)}));let Se=[],Re=this.instantiationService.createInstance(BR),xe=this._register(this.instantiationService.createInstance(ZFe,D(ae,_(".status")),Re));Se.push(Re,new class extends uy{render(){ae.classList.toggle("list-layout",this.extension?.state===1)}});let He=this.instantiationService.createInstance(e0e,D(l,_(".recommendation")));K.push(He),this._register(U.any(xe.onDidRender,He.onDidRender)(()=>{this.dimension&&this.layout(this.dimension)}));let Ee=this.instantiationService.createInstance(bee,[...se,...K,...Se]);for(let zt of[...se,...K,...Se,Ee])this._register(zt);let Te=U.chain(ce.onDidRun,zt=>zt.map(({error:mo})=>mo).filter(mo=>!!mo));this._register(Te(this.onError,this));let It=D(t,_(".body")),tt=this._register(new lBi(It)),Oi=D(It,_(".content"));Oi.id=ht(),this.template={builtin:g,content:Oi,description:j,header:o,name:u,navbar:tt,preview:h,actionsAndStatusContainer:ae,extensionActionBar:ce,set extension(zt){Ee.extension=zt;let mo;for(let dn of v)dn.classList.remove("last-non-empty"),dn.children.length>0&&(mo=dn);mo&&mo.classList.add("last-non-empty")},set gallery(zt){p.gallery=zt},set manifest(zt){J.manifest=zt}}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.updatePreReleaseVersionContext(),this.template&&await this.render(e.extension,this.template,!!t?.preserveFocus)}setOptions(e){let t=this.options;if(super.setOptions(e),this.updatePreReleaseVersionContext(),this.input&&this.template&&t?.showPreReleaseVersion!==e?.showPreReleaseVersion){this.render(this.input.extension,this.template,!!e?.preserveFocus);return}e?.tab&&this.template?.navbar.switch(e.tab)}updatePreReleaseVersionContext(){let e=this.options?.showPreReleaseVersion;bn(e)&&(e=!!this.input.extension.gallery?.properties.isPreReleaseVersion),this.showPreReleaseVersionContextKey?.set(e)}async openTab(e){!this.input||!this.template||this.template.navbar.switch(e)||e==="extensionPack"&&this.template.navbar.switch("readme")}async getGalleryVersionToShow(e,t){return e.resourceExtension||e.local?.source==="resource"||bn(t)||t===e.gallery?.properties.isPreReleaseVersion||t&&!e.hasPreReleaseVersion||!t&&!e.hasReleaseVersion?null:(await this.extensionGalleryService.getExtensions([{...e.identifier,preRelease:t,hasPreRelease:e.hasPreReleaseVersion}],Ie.None))[0]||null}async render(e,t,o){this.activeElement=null,this.transientDisposables.clear();let n=this.transientDisposables.add(new qe).token,r=await this.getGalleryVersionToShow(e,this.options?.showPreReleaseVersion);if(n.isCancellationRequested)return;this.extensionReadme=new pB(()=>r?this.extensionGalleryService.getReadme(r,n):e.getReadme(n)),this.extensionChangelog=new pB(()=>r?this.extensionGalleryService.getChangelog(r,n):e.getChangelog(n)),this.extensionManifest=new pB(()=>r?this.extensionGalleryService.getManifest(r,n):e.getManifest(n)),t.extension=e,t.gallery=r,t.manifest=null,t.name.textContent=e.displayName,t.name.classList.toggle("clickable",!!e.url),t.name.classList.toggle("deprecated",!!e.deprecationInfo),t.preview.style.display=e.preview?"inherit":"none",t.builtin.style.display=e.isBuiltin?"inherit":"none",t.description.textContent=e.description,e.url&&this.transientDisposables.add(mV(t.name,()=>this.openerService.open(A.parse(e.url))));let s=await this.extensionManifest.get().promise;if(n.isCancellationRequested)return;s&&(t.manifest=s),this.renderNavbar(e,s,t,o);let l=this.extensionRecommendationsService.getAllRecommendationsWithReason(),c={};l[e.identifier.id.toLowerCase()]&&(c={recommendationReason:l[e.identifier.id.toLowerCase()].reasonId}),this.telemetryService.publicLog("extensionGallery:openExtension",{...e.telemetryData,...c})}renderNavbar(e,t,o,n){o.content.innerText="",o.navbar.clear(),this.currentIdentifier!==e.identifier.id&&(this.initialScrollProgress.clear(),this.currentIdentifier=e.identifier.id),o.navbar.push("readme",d(11295,null),d(11296,null)),t&&o.navbar.push("features",d(11302,null),d(11303,null)),e.hasChangelog()&&o.navbar.push("changelog",d(11290,null),d(11292,null)),e.dependencies.length&&o.navbar.push("dependencies",d(11293,null),d(11294,null)),t&&t.extensionPack?.length&&!this.shallRenderAsExtensionPack(t)&&o.navbar.push("extensionPack",d(11300,null),d(11301,null)),this.options?.tab&&o.navbar.switch(this.options.tab),o.navbar.currentId&&this.onNavbarChange(e,{id:o.navbar.currentId,focus:!n},o),o.navbar.onChange(r=>this.onNavbarChange(e,r,o),this,this.transientDisposables)}clearInput(){this.contentDisposables.clear(),this.transientDisposables.clear(),super.clearInput()}focus(){super.focus(),this.activeElement?.focus()}showFind(){this.activeWebview?.showFind()}runFindAction(e){this.activeWebview?.runFindAction(e)}get activeWebview(){if(!(!this.activeElement||!this.activeElement.runFindAction))return this.activeElement}onNavbarChange(e,{id:t,focus:o},n){if(this.contentDisposables.clear(),n.content.innerText="",this.activeElement=null,t){let r=new qe;this.contentDisposables.add(ee(()=>r.dispose(!0))),this.open(t,e,n,r.token).then(s=>{r.token.isCancellationRequested||(this.activeElement=s,o&&this.focus())})}}open(e,t,o,n){let r=D(o.content,_(".details")),s=D(r,_(".content-container")),l=D(r,_(".additional-details-container")),c=()=>r.classList.toggle("narrow",this.dimension&&this.dimension.width<500);switch(c(),this.contentDisposables.add(ee(vg(this.layoutParticipants,{layout:c}))),this.renderAdditionalDetails(l,t),e){case"readme":return this.openDetails(t,s,n);case"features":return this.openFeatures(t,s,n);case"changelog":return this.openChangelog(t,s,n);case"dependencies":return this.openExtensionDependencies(t,s,n);case"extensionPack":return this.openExtensionPack(t,s,n)}return Promise.resolve(null)}async openMarkdown(e,t,o,n,r,s,l){try{let c=await this.renderMarkdown(e,t,n,l);if(l.isCancellationRequested)return Promise.resolve(null);let u=this.contentDisposables.add(this.webviewService.createWebviewOverlay({title:s,options:{enableFindWidget:!0,tryRestoreScrollPosition:!0,disableServiceWorker:!0},contentOptions:{},extension:void 0}));u.initialScrollProgress=this.initialScrollProgress.get(r)||0,u.claim(this,this.window,this.scopedContextKeyService),AL(u.container,n),u.setAnchorElement(n),u.setHtml(c),u.claim(this,this.window,void 0),this.contentDisposables.add(u.onDidFocus(()=>this._onDidFocus?.fire())),this.contentDisposables.add(u.onDidScroll(()=>this.initialScrollProgress.set(r,u.initialScrollProgress)));let p=!1;return this.contentDisposables.add(ee(()=>{p=!0})),this.contentDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let h=await this.renderMarkdown(e,t,n);p||u.setHtml(h)})),this.contentDisposables.add(u.onDidClickLink(h=>{h&&(hc(h,Q.http)||hc(h,Q.https)||hc(h,Q.mailto)?this.openerService.open(h):hc(h,Q.command)&&e.type===0&&this.openerService.open(h,{allowCommands:[B$]}))})),u}catch{let u=D(n,_("p.nocontent"));return u.textContent=o,u}}async renderMarkdown(e,t,o,n){let r=await this.loadContents(()=>t,o);if(n?.isCancellationRequested)return"";let s=[Q.http,Q.https,Q.mailto],l=await P$(r,this.extensionService,this.languageService,{sanitizerConfig:{allowedLinkProtocols:{override:e.type===0?[...s,Q.command]:s}}},n);return n?.isCancellationRequested?"":this.renderBody(l)}renderBody(e){let t=ht(),o=vc.getColorMap(),n=o?ED(o):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${t}';">
				<style nonce="${t}">
					${D1}

					/* prevent scroll-to-top button from blocking the body text */
					body {
						padding-bottom: 75px;
					}

					#scroll-to-top {
						position: fixed;
						width: 32px;
						height: 32px;
						right: 25px;
						bottom: 25px;
						background-color: var(--vscode-button-secondaryBackground);
						border-color: var(--vscode-button-border);
						border-radius: 50%;
						cursor: pointer;
						box-shadow: 1px 1px 1px rgba(0,0,0,.25);
						outline: none;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					#scroll-to-top:hover {
						background-color: var(--vscode-button-secondaryHoverBackground);
						box-shadow: 2px 2px 2px rgba(0,0,0,.25);
					}

					body.vscode-high-contrast #scroll-to-top {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}

					#scroll-to-top span.icon::before {
						content: "";
						display: block;
						background: var(--vscode-button-secondaryForeground);
						/* Chevron up icon */
						webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						width: 16px;
						height: 16px;
					}
					${n}
				</style>
			</head>
			<body>
				<a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
				${e}
			</body>
		</html>`}async openDetails(e,t,o){let n=null,r=await this.extensionManifest.get().promise;return r&&r.extensionPack?.length&&this.shallRenderAsExtensionPack(r)?n=await this.openExtensionPackReadme(e,r,t,o):n=await this.openMarkdown(e,this.extensionReadme.get(),d(11318,null),t,0,d(11322,null),o),n}shallRenderAsExtensionPack(e){return!!e.categories?.some(t=>t.toLowerCase()==="extension packs")}async openExtensionPackReadme(e,t,o,n){if(n.isCancellationRequested)return Promise.resolve(null);let r=D(o,_("div",{class:"extension-pack-readme"}));r.style.margin="0 auto",r.style.maxWidth="882px";let s=D(r,_("div",{class:"extension-pack"})),l=t.extensionPack.length,c=37,u=200,p=()=>{r.classList.remove("one-row","two-rows","three-rows","more-rows");let v=o.clientHeight,b=Math.max(v-c-u,0),S="one-row";b>=302&&l>6?S="more-rows":b>=282&&l>4?S="three-rows":b>=200&&l>2?S="two-rows":S="one-row",r.classList.add(S)};p(),this.contentDisposables.add(ee(vg(this.layoutParticipants,{layout:p})));let h=D(s,_("div.header"));h.textContent=d(11298,null,t.extensionPack.length);let g=D(s,_("div",{class:"extension-pack-content"}));g.setAttribute("tabindex","0");let f=D(r,_("div.readme-content"));return await Promise.all([this.renderExtensionPack(t,g,n),this.openMarkdown(e,this.extensionReadme.get(),d(11318,null),f,0,d(11322,null),n)]),{focus:()=>g.focus()}}renderAdditionalDetails(e,t){let o=_("div",{class:"additional-details-content",tabindex:"0"}),n=new Ar(o,{}),r=()=>n.scanDomNode(),s=vg(this.layoutParticipants,{layout:r});this.contentDisposables.add(ee(s)),this.contentDisposables.add(n),this.contentDisposables.add(this.instantiationService.createInstance(Kct,o,t)),D(e,n.getDomNode()),n.scanDomNode()}async openChangelog(e,t,o){return await this.openMarkdown(e,this.extensionChangelog.get(),d(11316,null),t,1,d(11291,null),o)}async openFeatures(e,t,o){let n=await this.loadContents(()=>this.extensionManifest.get(),t);if(o.isCancellationRequested||!n)return null;let r=this.contentDisposables.add(this.instantiationService.createInstance(DUe,n,this.options?.feature)),s=()=>r.layout(t.clientHeight,t.clientWidth),l=vg(this.layoutParticipants,{layout:s});return this.contentDisposables.add(ee(l)),D(t,r.domNode),s(),r.domNode}openExtensionDependencies(e,t,o){if(o.isCancellationRequested)return Promise.resolve(null);if(YO(e.dependencies))return D(t,_("p.nocontent")).textContent=d(11317,null),Promise.resolve(t);let n=_("div",{class:"subcontent"}),r=new Ar(n,{});D(t,r.getDomNode()),this.contentDisposables.add(r);let s=this.instantiationService.createInstance(n0e,new fqt(e,null,u=>u.dependencies||[],this.extensionsWorkbenchService),n,{listBackground:Bo}),l=()=>{r.scanDomNode();let u=r.getScrollDimensions();s.layout(u.height)},c=vg(this.layoutParticipants,{layout:l});return this.contentDisposables.add(ee(c)),this.contentDisposables.add(s),l(),Promise.resolve({focus(){s.domFocus()}})}async openExtensionPack(e,t,o){if(o.isCancellationRequested)return Promise.resolve(null);let n=await this.loadContents(()=>this.extensionManifest.get(),t);return o.isCancellationRequested||!n?null:this.renderExtensionPack(n,t,o)}async renderExtensionPack(e,t,o){if(o.isCancellationRequested)return null;let n=_("div",{class:"subcontent"}),r=new Ar(n,{useShadows:!1});D(t,r.getDomNode());let s=this.instantiationService.createInstance(i0e,n,new t0e),l=await yst(e.extensionPack,this.extensionsWorkbenchService);return s.setExtensions(l),r.scanDomNode(),this.contentDisposables.add(r),this.contentDisposables.add(s),this.contentDisposables.add(ee(vg(this.layoutParticipants,{layout:()=>r.scanDomNode()}))),n}loadContents(e,t){t.classList.add("loading");let o=this.contentDisposables.add(e()),n=()=>t.classList.remove("loading");return o.promise.then(n,n),o.promise}layout(e){this.dimension=e,this.layoutParticipants.forEach(t=>t.layout())}onError(e){Yi(e)||this.notificationService.error(e)}};VV=I([m(1,_e),m(2,F),m(3,Ui),m(4,ga),m(5,Pe),m(6,Ne),m(7,Je),m(8,AR),m(9,de),m(10,lt),m(11,Pu),m(12,Rt),m(13,Xe),m(14,X),m(15,ot)],VV);var Kct=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.container=e;this.hoverService=o;this.openerService=n;this.userDataProfilesService=r;this.remoteAgentService=s;this.fileService=l;this.uriIdentityService=c;this.extensionsWorkbenchService=u;this.extensionGalleryManifestService=p;this.disposables=this._register(new O);this.render(t),this._register(this.extensionsWorkbenchService.onChange(h=>{h&&Ht(h.identifier,t.identifier)&&h.server===t.server&&this.render(h)}))}render(e){this.container.innerText="",this.disposables.clear(),e.local&&this.renderInstallInfo(this.container,e.local),e.gallery&&this.renderMarketplaceInfo(this.container,e),this.renderCategories(this.container,e),this.renderExtensionResources(this.container,e)}renderCategories(e,t){if(t.categories.length){let o=D(e,_(".categories-container.additional-details-element"));D(o,_(".additional-details-title",void 0,d(11289,null)));let n=D(o,_(".categories"));this.extensionGalleryManifestService.getExtensionGalleryManifest().then(r=>{let s=r?.capabilities.extensionQuery.filtering?.some(({name:l})=>l==="Category");for(let l of t.categories){let c=D(n,_("span.category",{tabindex:"0"},l));s&&(c.classList.add("clickable"),this.disposables.add(mV(c,()=>this.extensionsWorkbenchService.openSearch(`@category:"${l}"`))))}})}}renderExtensionResources(e,t){let o=[];if(t.repository)try{o.push([d(11323,null),q.fromId(L.repo.id),A.parse(t.repository)])}catch{}if(t.supportUrl)try{o.push([d(11309,null),q.fromId(L.issues.id),A.parse(t.supportUrl)])}catch{}if(t.licenseUrl)try{o.push([d(11312,null),q.fromId(L.linkExternal.id),A.parse(t.licenseUrl)])}catch{}if(t.publisherUrl&&o.push([t.publisherDisplayName,q.fromId(L.linkExternal.id),t.publisherUrl]),t.url&&o.push([d(11313,null),q.fromId(L.linkExternal.id),A.parse(t.url)]),o.length||t.publisherSponsorLink){let n=D(e,_(".resources-container.additional-details-element"));D(n,_(".additional-details-title",void 0,d(11324,null)));let r=D(n,_(".resources"));for(let[s,l,c]of o){let u=D(r,_(".resource"));D(u,_(q.asCSSSelector(l))),D(u,_("a",{tabindex:"0"},s)),this.disposables.add(mV(u,()=>this.openerService.open(c))),this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),u,c.toString()))}}}renderInstallInfo(e,t){let o=D(e,_(".more-info-container.additional-details-element"));D(o,_(".additional-details-title",void 0,d(11308,null)));let n=D(o,_(".more-info"));if(D(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11307,null)),_("code",void 0,t.identifier.id))),t.type!==0&&D(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11328,null)),_("code",void 0,t.manifest.version))),t.installedTimestamp&&D(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11311,null)),_("div",{title:new Date(t.installedTimestamp).toString()},ea(t.installedTimestamp,!0,!0,!0)))),!t.isBuiltin&&t.source!=="gallery"){let r=_("div",void 0,t.source==="vsix"?d(11329,null):d(11319,null));D(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11327,null)),r)),Qr&&t.source==="resource"&&t.location.scheme===Q.file&&(r.classList.add("link"),r.tabIndex=0,r.setAttribute("role","link"),r.title=t.location.fsPath,this.disposables.add(mV(r,()=>this.openerService.open(t.location,{openExternal:!0}))))}if(t.size){let r=_("div",void 0,Ml.formatSize(t.size));D(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",{title:d(11326,null)},d(11325,null)),r)),Qr&&t.location.scheme===Q.file&&(r.classList.add("link"),r.tabIndex=0,r.setAttribute("role","link"),r.title=t.location.fsPath,this.disposables.add(mV(r,()=>this.openerService.open(t.location,{openExternal:!0}))))}this.getCacheLocation(t).then(r=>{r&&Yvi(r,this.fileService).then(s=>{if(!s)return;let l=_("div",void 0,Ml.formatSize(s));D(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",{title:d(11297,null)},d(11288,null)),l)),Qr&&t.location.scheme===Q.file&&(l.classList.add("link"),l.tabIndex=0,l.setAttribute("role","link"),l.title=r.fsPath,this.disposables.add(mV(l,()=>this.openerService.open(r.with({scheme:Q.file}),{openExternal:!0}))))})})}async getCacheLocation(e){let t=this.uriIdentityService.extUri.joinPath(this.userDataProfilesService.defaultProfile.globalStorageHome,e.identifier.id.toLowerCase());if(e.location.scheme===Q.vscodeRemote){let o=await this.remoteAgentService.getEnvironment();if(!o)return;t=this.uriIdentityService.extUri.joinPath(o.globalStorageHome,e.identifier.id.toLowerCase())}return t}renderMarketplaceInfo(e,t){let o=t.gallery,n=D(e,_(".more-info-container.additional-details-element"));D(n,_(".additional-details-title",void 0,d(11314,null)));let r=D(n,_(".more-info"));o&&(t.local||(D(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11307,null)),_("code",void 0,t.identifier.id))),D(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11328,null)),_("code",void 0,o.version)))),D(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11321,null)),_("div",{title:new Date(o.releaseDate).toString()},ea(o.releaseDate,!0,!0,!0))),_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(11310,null)),_("div",{title:new Date(o.lastUpdated).toString()},ea(o.lastUpdated,!0,!0,!0)))))}};Kct=I([m(2,ot),m(3,Je),m(4,hn),m(5,bo),m(6,ge),m(7,gt),m(8,Ui),m(9,tb)],Kct);var uBi=C.and(C.equals("activeEditor",VV.ID),me.focus.toNegated());W(class extends z{constructor(){super({id:"editor.action.extensioneditor.showfind",title:d(11304,null),keybinding:{when:uBi,weight:100,primary:2084}})}run(i){pBi(i)?.showFind()}});W(class extends z{constructor(){super({id:"editor.action.extensioneditor.findNext",title:d(11305,null),keybinding:{when:C.and(uBi,K2),primary:3,weight:100}})}run(i){pBi(i)?.runFindAction(!1)}});W(class extends z{constructor(){super({id:"editor.action.extensioneditor.findPrevious",title:d(11306,null),keybinding:{when:C.and(uBi,K2),primary:1027,weight:100}})}run(i){pBi(i)?.runFindAction(!0)}});hs((a,i)=>{let e=a.getColor(AS);e&&(i.addRule(`.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource { color: ${e}; }`),i.addRule(`.monaco-workbench .extension-editor .content .feature-contributions a { color: ${e}; }`));let t=a.getColor(GIt);t&&(i.addRule(`.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource:hover,
			.monaco-workbench .extension-editor .content .details .additional-details-container .resources-container a.resource:active { color: ${t}; }`),i.addRule(`.monaco-workbench .extension-editor .content .feature-contributions a:hover,
			.monaco-workbench .extension-editor .content .feature-contributions a:active { color: ${t}; }`));let o=a.getColor(T5);o&&i.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .categories-container > .categories > .category.clickable:hover { background-color: ${o}; border-color: ${o}; }`);let n=a.getColor(Fk);n&&i.addRule(`.monaco-workbench .extension-editor .content > .details > .additional-details-container .categories-container > .categories > .category.clickable:hover { color: ${n}; }`)});function pBi(a){let i=a.get(ie).activeEditorPane;return i instanceof VV?i:null}var RUe=class extends k{constructor(i,e,t,o,n,r){super(),n.isWorkspaceTrustEnabled()&&r.workspaceTrustInitialized.then(()=>{let s=new class{async participate(l){if(l)await o.updateExtensionsEnablementsWhenWorkspaceTrustChanges();else if(t.remoteAuthority)e.reload();else{let c=await i.stopExtensionHosts(d(11330,null));await o.updateExtensionsEnablementsWhenWorkspaceTrustChanges(),c&&i.startExtensionHosts()}}};this._register(r.addWorkspaceTrustTransitionParticipant(s))})}};RUe=I([m(0,lt),m(1,ti),m(2,Mt),m(3,As),m(4,yM),m(5,Or)],RUe);var lPo="extensionsAssistant/importantRecommendationsIgnore",cPo="extensionsAssistant/workspaceRecommendationsIgnore",mBi=class extends k{constructor(e,t,o,n){super();this.severity=e;this.message=t;this.choices=o;this.notificationService=n;this._onDidClose=this._register(new T);this.onDidClose=this._onDidClose.event;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.cancelled=!1;this.onDidCloseDisposable=this._register(new ue);this.onDidChangeVisibilityDisposable=this._register(new ue)}show(){this.notificationHandle||this.updateNotificationHandle(this.notificationService.prompt(this.severity,this.message,this.choices,{sticky:!0,priority:1,onCancel:()=>this.cancelled=!0}))}hide(){this.notificationHandle&&(this.onDidCloseDisposable.clear(),this.notificationHandle.close(),this.cancelled=!1,this.updateNotificationHandle(this.notificationService.prompt(this.severity,this.message,this.choices,{priority:2,onCancel:()=>this.cancelled=!0})))}isCancelled(){return this.cancelled}updateNotificationHandle(e){this.onDidCloseDisposable.clear(),this.onDidChangeVisibilityDisposable.clear(),this.notificationHandle=e,this.onDidCloseDisposable.value=this.notificationHandle.onDidClose(()=>{this.onDidCloseDisposable.dispose(),this.onDidChangeVisibilityDisposable.dispose(),this._onDidClose.fire(),this._onDidClose.dispose(),this._onDidChangeVisibility.dispose()}),this.onDidChangeVisibilityDisposable.value=this.notificationHandle.onDidChangeVisibility(t=>this._onDidChangeVisibility.fire(t))}},LUe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.configurationService=e;this.storageService=t;this.notificationService=o;this.telemetryService=n;this.extensionsWorkbenchService=r;this.extensionManagementService=s;this.extensionEnablementService=l;this.extensionIgnoredRecommendationsService=c;this.userDataSyncEnablementService=u;this.workbenchEnvironmentService=p;this.uriIdentityService=h;this.recommendedExtensions=[];this.recommendationSources=[];this.pendingNotificaitons=[]}get ignoredRecommendations(){return jo([...JSON.parse(this.storageService.get(lPo,0,"[]"))].map(e=>e.toLowerCase()))}hasToIgnoreRecommendationNotifications(){let e=this.configurationService.getValue("extensions");return e.ignoreRecommendations||!!e.showRecommendationsOnlyOnDemand}async promptImportantExtensionsInstallNotification(e){let t=[...this.extensionIgnoredRecommendationsService.ignoredRecommendations,...this.ignoredRecommendations],o=e.extensions.filter(n=>!t.includes(n));return o.length?this.promptRecommendationsNotification({...e,extensions:o},{onDidInstallRecommendedExtensions:n=>n.forEach(r=>this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"install",extensionId:r.identifier.id,source:Hct(e.source)})),onDidShowRecommendedExtensions:n=>n.forEach(r=>this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"show",extensionId:r.identifier.id,source:Hct(e.source)})),onDidCancelRecommendedExtensions:n=>n.forEach(r=>this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"cancelled",extensionId:r.identifier.id,source:Hct(e.source)})),onDidNeverShowRecommendedExtensionsAgain:n=>{for(let r of n)this.addToImportantRecommendationsIgnore(r.identifier.id),this.telemetryService.publicLog2("extensionRecommendations:popup",{userReaction:"neverShowAgain",extensionId:r.identifier.id,source:Hct(e.source)});this.notificationService.prompt(ft.Info,d(11356,null),[{label:d(11355,null),run:()=>this.setIgnoreRecommendationsConfig(!0)},{label:d(11359,null),run:()=>this.setIgnoreRecommendationsConfig(!1)}])}}):"ignored"}async promptWorkspaceRecommendations(e){if(this.storageService.getBoolean(cPo,1,!1))return;let t=await this.extensionManagementService.getInstalled();t=t.filter(o=>this.extensionEnablementService.getEnablementState(o)!==1),e=e.filter(o=>t.every(n=>We(o)?!Ht({id:o},n.identifier):!this.uriIdentityService.extUri.isEqual(o,n.location))),e.length&&await this.promptRecommendationsNotification({extensions:e,source:2,name:d(11362,null)},{onDidInstallRecommendedExtensions:()=>this.telemetryService.publicLog2("extensionWorkspaceRecommendations:popup",{userReaction:"install"}),onDidShowRecommendedExtensions:()=>this.telemetryService.publicLog2("extensionWorkspaceRecommendations:popup",{userReaction:"show"}),onDidCancelRecommendedExtensions:()=>this.telemetryService.publicLog2("extensionWorkspaceRecommendations:popup",{userReaction:"cancelled"}),onDidNeverShowRecommendedExtensionsAgain:()=>{this.telemetryService.publicLog2("extensionWorkspaceRecommendations:popup",{userReaction:"neverShowAgain"}),this.storageService.store(cPo,!0,1,1)}})}async promptRecommendationsNotification({extensions:e,source:t,name:o,searchValue:n},r){if(this.hasToIgnoreRecommendationNotifications())return"ignored";if(t===3&&this.workbenchEnvironmentService.remoteAuthority)return"incompatibleWindow";if(t===3&&(this.recommendationSources.includes(3)||this.recommendationSources.length>=2))return"toomany";if(this.recommendationSources.push(t),t===3&&e.every(p=>We(p)&&this.recommendedExtensions.includes(p)))return"ignored";let s=await this.getInstallableExtensions(e);if(!s.length)return"ignored";this.recommendedExtensions=jo([...this.recommendedExtensions,...e.filter(We)]);let l="";if(s.length===1)l=d(11351,null,s[0].displayName,s[0].publisherDisplayName);else{let p=[...s.reduce((h,g)=>h.add(g.publisherDisplayName),new Set)];p.length>2?l=d(11352,null,p[0],p[1]):p.length===2?l=d(11354,null,p[0],p[1]):l=d(11353,null,p[0])}let c=d(11360,null,l,o);t===3&&(c=d(11350,null,o,l)),n||(n=t===2?"@recommended":s.map(p=>`@id:${p.identifier.id}`).join(" "));let u=t===2?d(11347,null):s.length>1?d(11348,null):d(11349,null);return Hle([this._registerP(this.showRecommendationsNotification(s,c,n,u,t,r)),this._registerP(this.waitUntilRecommendationsAreInstalled(s))])}showRecommendationsNotification(e,t,o,n,r,{onDidInstallRecommendedExtensions:s,onDidShowRecommendedExtensions:l,onDidCancelRecommendedExtensions:c,onDidNeverShowRecommendedExtensionsAgain:u}){return Hn(async p=>{let h=!1,g=[],f=async v=>{this.extensionsWorkbenchService.openSearch(o),s(e);let b=[],S=[];for(let y of e)y.gallery?b.push(y.gallery):y.resourceExtension&&S.push(y);await vn.settled([vn.settled(e.map(y=>this.extensionsWorkbenchService.open(y,{pinned:!0}))),b.length?this.extensionManagementService.installGalleryExtensions(b.map(y=>({extension:y,options:{isMachineScoped:v}}))):Promise.resolve(),S.length?Promise.allSettled(S.map(y=>this.extensionsWorkbenchService.install(y))):Promise.resolve()])};g.push({label:d(11357,null),run:()=>f(!1),menu:this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncEnablementService.isResourceEnabled("extensions")?[{label:d(11358,null),run:()=>f(!0)}]:void 0}),g.push({label:d(11361,null),run:async()=>{l(e);for(let v of e)this.extensionsWorkbenchService.open(v,{pinned:!0});this.extensionsWorkbenchService.openSearch(o)}},{label:n,isSecondary:!0,run:()=>{u(e)}});try{h=await this.doShowRecommendationsNotification(ft.Info,t,g,r,p)}catch(v){if(!Yi(v))throw v}return h?"reacted":(c(e),"cancelled")})}waitUntilRecommendationsAreInstalled(e){let t=[],o=new O;return Hn(async n=>(o.add(n.onCancellationRequested(r=>o.dispose())),new Promise((r,s)=>{o.add(this.extensionManagementService.onInstallExtension(l=>{t.push(l.identifier.id.toLowerCase()),e.every(c=>t.includes(c.identifier.id.toLowerCase()))&&r("reacted")}))})))}async doShowRecommendationsNotification(e,t,o,n,r){let s=new O;try{let l=s.add(new mBi(e,t,o,this.notificationService));if(s.add(U.once(U.filter(l.onDidChangeVisibility,c=>!c))(()=>this.showNextNotification())),this.visibleNotification){let c=this.pendingNotificaitons.length;s.add(r.onCancellationRequested(()=>this.pendingNotificaitons.splice(c,1))),this.pendingNotificaitons.push({recommendationsNotification:l,source:n,token:r}),n!==3&&n<=this.visibleNotification.source&&this.hideVisibleNotification(3e3)}else this.visibleNotification={recommendationsNotification:l,source:n,from:Date.now()},l.show();return await Ea(new Promise(c=>s.add(U.once(l.onDidClose)(c))),r),!l.isCancelled()}finally{s.dispose()}}showNextNotification(){let e=this.getNextPendingNotificationIndex(),[t]=e>-1?this.pendingNotificaitons.splice(e,1):[];Li(t?500:0).then(()=>{this.unsetVisibileNotification(),t&&(this.visibleNotification={recommendationsNotification:t.recommendationsNotification,source:t.source,from:Date.now()},t.recommendationsNotification.show())})}getNextPendingNotificationIndex(){let e=this.pendingNotificaitons.length-1;if(this.pendingNotificaitons.length)for(let t=0;t<this.pendingNotificaitons.length;t++)this.pendingNotificaitons[t].source<=this.pendingNotificaitons[e].source&&(e=t);return e}hideVisibleNotification(e){if(this.visibleNotification&&!this.hideVisibleNotificationPromise){let t=this.visibleNotification;this.hideVisibleNotificationPromise=Li(Math.max(e-(Date.now()-t.from),0)),this.hideVisibleNotificationPromise.then(()=>t.recommendationsNotification.hide())}}unsetVisibileNotification(){this.hideVisibleNotificationPromise?.cancel(),this.hideVisibleNotificationPromise=void 0,this.visibleNotification=void 0}async getInstallableExtensions(e){let t=[];if(e.length){let o=[],n=[];for(let r of e)typeof r=="string"?o.push(r):n.push(r);if(o.length){let r=await this.extensionsWorkbenchService.getExtensions(o.map(s=>({id:s})),{source:"install-recommendations"},Ie.None);for(let s of r)s.gallery&&await this.extensionManagementService.canInstall(s.gallery)===!0&&t.push(s)}if(n.length){let r=await this.extensionsWorkbenchService.getResourceExtensions(n,!0);for(let s of r)await this.extensionsWorkbenchService.canInstall(s)===!0&&t.push(s)}}return t}addToImportantRecommendationsIgnore(e){let t=[...this.ignoredRecommendations];t.includes(e.toLowerCase())||(t.push(e.toLowerCase()),this.storageService.store(lPo,JSON.stringify(t),0,0))}setIgnoreRecommendationsConfig(e){this.configurationService.updateValue("extensions.ignoreRecommendations",e)}_registerP(e){return this._register(ee(()=>e.cancel())),e}};LUe=I([m(0,B),m(1,de),m(2,Ne),m(3,_e),m(4,Ui),m(5,Dd),m(6,As),m(7,RE),m(8,Yl),m(9,Mt),m(10,gt)],LUe);var Sk=class extends k{constructor(){super(...arguments);this._activationPromise=null}get activated(){return this._activationPromise!==null}activate(){return this._activationPromise||(this._activationPromise=this.doActivate()),this._activationPromise}};var MUe=class extends Sk{constructor(e){super();this.extensionTipsService=e;this._otherTips=[];this._importantTips=[]}get otherRecommendations(){return this._otherTips.map(e=>this.toExtensionRecommendation(e))}get importantRecommendations(){return this._importantTips.map(e=>this.toExtensionRecommendation(e))}get recommendations(){return[...this.importantRecommendations,...this.otherRecommendations]}getRecommendations(e){let t=this._importantTips.filter(n=>n.exeName.toLowerCase()===e.toLowerCase()).map(n=>this.toExtensionRecommendation(n)),o=this._otherTips.filter(n=>n.exeName.toLowerCase()===e.toLowerCase()).map(n=>this.toExtensionRecommendation(n));return{important:t,others:o}}async doActivate(){this._otherTips=await this.extensionTipsService.getOtherExecutableBasedTips(),await this.fetchImportantExeBasedRecommendations()}async fetchImportantExeBasedRecommendations(){return this._importantExeBasedRecommendations||(this._importantExeBasedRecommendations=this.doFetchImportantExeBasedRecommendations()),this._importantExeBasedRecommendations}async doFetchImportantExeBasedRecommendations(){let e=new Map;return this._importantTips=await this.extensionTipsService.getImportantExecutableBasedTips(),this._importantTips.forEach(t=>e.set(t.extensionId.toLowerCase(),t)),e}toExtensionRecommendation(e){return{extension:e.extensionId.toLowerCase(),reason:{reasonId:2,reasonText:d(11286,null,e.exeFriendlyName)}}}};MUe=I([m(0,XTe)],MUe);var hBi=".vscode/extensions",PUe=class extends Sk{constructor(e,t,o,n,r,s){super();this.workspaceExtensionsConfigService=e;this.contextService=t;this.uriIdentityService=o;this.fileService=n;this.workbenchExtensionManagementService=r;this.notificationService=s;this._recommendations=[];this._onDidChangeRecommendations=this._register(new T);this.onDidChangeRecommendations=this._onDidChangeRecommendations.event;this._ignoredRecommendations=[];this.workspaceExtensions=[];this.onDidChangeWorkspaceExtensionsScheduler=this._register(new Dt(()=>this.onDidChangeWorkspaceExtensionsFolders(),1e3))}get recommendations(){return this._recommendations}get ignoredRecommendations(){return this._ignoredRecommendations}async doActivate(){this.workspaceExtensions=await this.fetchWorkspaceExtensions(),await this.fetch(),this._register(this.workspaceExtensionsConfigService.onDidChangeExtensionsConfigs(()=>this.onDidChangeExtensionsConfigs()));for(let e of this.contextService.getWorkspace().folders)this._register(this.fileService.watch(this.uriIdentityService.extUri.joinPath(e.uri,hBi)));this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.onDidChangeWorkspaceExtensionsScheduler.schedule())),this._register(this.fileService.onDidFilesChange(e=>{this.contextService.getWorkspace().folders.some(t=>e.affects(this.uriIdentityService.extUri.joinPath(t.uri,hBi),1,2))&&this.onDidChangeWorkspaceExtensionsScheduler.schedule()}))}async onDidChangeWorkspaceExtensionsFolders(){let e=this.workspaceExtensions;this.workspaceExtensions=await this.fetchWorkspaceExtensions(),eo(e,this.workspaceExtensions,(t,o)=>this.uriIdentityService.extUri.isEqual(t,o))||this.onDidChangeExtensionsConfigs()}async fetchWorkspaceExtensions(){let e=[];for(let t of this.contextService.getWorkspace().folders){let o=this.uriIdentityService.extUri.joinPath(t.uri,hBi);try{let n=await this.fileService.resolve(o);for(let r of n.children??[])r.isDirectory&&e.push(r.resource)}catch{}}return e.length?(await this.workbenchExtensionManagementService.getExtensions(e)).map(o=>o.location):[]}async fetch(){let e=await this.workspaceExtensionsConfigService.getExtensionsConfigs(),{invalidRecommendations:t,message:o}=await this.validateExtensions(e);t.length&&this.notificationService.warn(`The ${t.length} extension(s) below, in workspace recommendations have issues:
${o}`),this._recommendations=[],this._ignoredRecommendations=[];for(let n of e){if(n.unwantedRecommendations)for(let r of n.unwantedRecommendations)t.indexOf(r)===-1&&this._ignoredRecommendations.push(r);if(n.recommendations)for(let r of n.recommendations)t.indexOf(r)===-1&&this._recommendations.push({extension:r,reason:{reasonId:0,reasonText:d(11890,null)}})}for(let n of this.workspaceExtensions)this._recommendations.push({extension:n,reason:{reasonId:0,reasonText:d(11890,null)}})}async validateExtensions(e){let t=[],o=[],n="",r=jo(e.flatMap(({recommendations:l})=>l||[])),s=new RegExp(w0);for(let l of r)s.test(l)?t.push(l):(o.push(l),n+=`${l} (bad format) Expected: <provider>.<name>
`);return{validRecommendations:t,invalidRecommendations:o,message:n}}async onDidChangeExtensionsConfigs(){await this.fetch(),this._onDidChangeRecommendations.fire()}};PUe=I([m(0,rq),m(1,Ae),m(2,gt),m(3,ge),m(4,Dd),m(5,Ne)],PUe);var pPo="fileBasedRecommendations/promptedRecommendations",mPo="extensionsAssistant/recommendations",Jyn=1e3*60*60*24,Zyn=1e3,AUe=class extends Sk{constructor(e,t,o,n,r,s,l,c,u){super();this.extensionsWorkbenchService=e;this.modelService=t;this.languageService=o;this.storageService=r;this.extensionRecommendationNotificationService=s;this.extensionIgnoredRecommendationsService=l;this.workspaceContextService=c;this.untitledTextEditorService=u;this.recommendationsByPattern=new Map;this.fileBasedRecommendations=new Map;this.fileBasedImportantRecommendations=new Set;if(this.fileOpenRecommendations={},n.extensionRecommendations)for(let[p,h]of Object.entries(n.extensionRecommendations))h.onFileOpen&&(this.fileOpenRecommendations[p.toLowerCase()]=h.onFileOpen)}get recommendations(){let e=[];return[...this.fileBasedRecommendations.keys()].sort((t,o)=>{if(this.fileBasedRecommendations.get(t).recommendedTime===this.fileBasedRecommendations.get(o).recommendedTime){if(this.fileBasedImportantRecommendations.has(t))return-1;if(this.fileBasedImportantRecommendations.has(o))return 1}return this.fileBasedRecommendations.get(t).recommendedTime>this.fileBasedRecommendations.get(o).recommendedTime?-1:1}).forEach(t=>{e.push({extension:t,reason:{reasonId:1,reasonText:d(11887,null)}})}),e}get importantRecommendations(){return this.recommendations.filter(e=>this.fileBasedImportantRecommendations.has(e.extension))}get otherRecommendations(){return this.recommendations.filter(e=>!this.fileBasedImportantRecommendations.has(e.extension))}async doActivate(){if(dv(this.fileOpenRecommendations))return;await this.extensionsWorkbenchService.whenInitialized;let e=this.getCachedRecommendations(),t=Date.now();Object.entries(e).forEach(([o,n])=>{(t-n)/Jyn<=7&&this.fileOpenRecommendations[o]&&this.fileBasedRecommendations.set(o.toLowerCase(),{recommendedTime:n})}),this._register(this.modelService.onModelAdded(o=>this.onModelAdded(o))),this.modelService.getModels().forEach(o=>this.onModelAdded(o))}onModelAdded(e){let t=e.uri.scheme===Q.vscodeNotebookCell?sn.parse(e.uri)?.notebook:e.uri;if(!t)return;let o=jo([Q.untitled,Q.file,Q.vscodeRemote,...this.workspaceContextService.getWorkspace().folders.map(n=>n.uri.scheme)]);!t||!o.includes(t.scheme)||Zo(()=>this.promptImportantRecommendations(t,e),0,this._store)}promptImportantRecommendations(e,t,o){if(t.isDisposed())return;let n=Ts(e).toLowerCase();o=o??this.recommendationsByPattern.get(n)??this.fileOpenRecommendations;let r=Object.entries(o);if(r.length===0)return;let s=new Map,l=this.extensionsWorkbenchService.local,c={},u={},p={},h=!1,g=t.getLanguageId(),f=this.untitledTextEditorService.get(e),v=!f||f.hasLanguageSetExplicitly||t.getValueLength()>Zyn;for(let[b,S]of r){let y=[],w=[],x=[];for(let E of S){let M=!1,N=!1,V=!!E.languages,H=!!E.contentPattern;(V||H)&&y.push(E),V&&v&&E.languages.includes(g)&&(M=!0);let K=E.pathGlob;K&&((s.get(K)??qd(K,e.with({fragment:""}).toString(),{ignoreCase:!0}))&&(N=!0),s.set(K,N));let j=M||N;n&&!j||(j&&E.whenInstalled&&(E.whenInstalled.every(J=>l.some(se=>Ht({id:J},se.identifier)))||(j=!1)),j&&E.whenNotInstalled&&l.some(J=>E.whenNotInstalled?.some(se=>Ht({id:se},J.identifier)))&&(j=!1),j&&H&&(t.findMatches(E.contentPattern,!1,!0,!1,null,!1).length||(j=!1)),j?(w.push(E),y.pop()):(V||H)&&(x.push(E),V&&(h=!0)))}w.length&&(u[b]=w),x.length&&(p[b]=x),y.length&&(c[b]=y)}if(n&&this.recommendationsByPattern.set(n,c),Object.keys(p).length&&h){let b=new O;b.add(t.onDidChangeLanguage(()=>{Zo(()=>{b.isDisposed||(this.promptImportantRecommendations(e,t,p),b.dispose())},0,b)})),b.add(t.onWillDispose(()=>b.dispose()))}Object.keys(u).length&&this.promptFromRecommendations(e,t,u)}promptFromRecommendations(e,t,o){let n=!1,r=new Set,s=new Set;for(let[u,p]of Object.entries(o))for(let h of p)s.add(u),h.important&&(r.add(u),this.fileBasedImportantRecommendations.add(u)),h.languages&&(n=!0);for(let u of s){let p=this.fileBasedRecommendations.get(u)||{recommendedTime:Date.now(),sources:[]};p.recommendedTime=Date.now(),this.fileBasedRecommendations.set(u,p)}if(this.storeCachedRecommendations(),this.extensionRecommendationNotificationService.hasToIgnoreRecommendationNotifications())return;let l=t.getLanguageId(),c=this.languageService.getLanguageName(l);r.size&&this.promptRecommendedExtensionForFileType(c&&n&&l!==es?d(11888,null,c):Be(e),l,[...r])}promptRecommendedExtensionForFileType(e,t,o){if(o=this.filterIgnoredOrNotAllowed(o),o.length===0)return!1;o=this.filterInstalled(o,this.extensionsWorkbenchService.local).filter(r=>this.fileBasedImportantRecommendations.has(r));let n=t!==es?this.getPromptedRecommendations()[t]:void 0;return n&&(o=o.filter(r=>!n.includes(r))),o.length===0?!1:(this.promptImportantExtensionsInstallNotification(o,e,t),!0)}async promptImportantExtensionsInstallNotification(e,t,o){try{await this.extensionRecommendationNotificationService.promptImportantExtensionsInstallNotification({extensions:e,name:t,source:1})==="reacted"&&this.addToPromptedRecommendations(o,e)}catch{}}getPromptedRecommendations(){return JSON.parse(this.storageService.get(pPo,0,"{}"))}addToPromptedRecommendations(e,t){let o=this.getPromptedRecommendations();o[e]=jo([...o[e]??[],...t]),this.storageService.store(pPo,JSON.stringify(o),0,0)}filterIgnoredOrNotAllowed(e){let t=[...this.extensionIgnoredRecommendationsService.ignoredRecommendations,...this.extensionRecommendationNotificationService.ignoredRecommendations];return e.filter(o=>!t.includes(o))}filterInstalled(e,t){let o=t.reduce((n,r)=>(r.enablementState!==1&&n.add(r.identifier.id.toLowerCase()),n),new Set);return e.filter(n=>!o.has(n.toLowerCase()))}getCachedRecommendations(){let e=JSON.parse(this.storageService.get(mPo,0,"[]"));Array.isArray(e)&&(e=e.reduce((o,n)=>(o[n]=Date.now(),o),{}));let t={};return Object.entries(e).forEach(([o,n])=>{typeof n=="number"&&(t[o.toLowerCase()]=n)}),t}storeCachedRecommendations(){let e={};this.fileBasedRecommendations.forEach((t,o)=>e[o]=t.recommendedTime),this.storageService.store(mPo,JSON.stringify(e),0,1)}};AUe=I([m(0,Ui),m(1,_t),m(2,Rt),m(3,Ze),m(4,de),m(5,Pre),m(6,RE),m(7,Ae),m(8,yE)],AUe);var NUe=class extends Sk{constructor(e){super();this.productService=e;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){this.productService.keymapExtensionTips&&(this._recommendations=this.productService.keymapExtensionTips.map(e=>({extension:e.toLowerCase(),reason:{reasonId:6,reasonText:""}})))}};NUe=I([m(0,Ze)],NUe);var OUe=class extends Sk{constructor(e){super();this.productService=e;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){this.productService.languageExtensionTips&&(this._recommendations=this.productService.languageExtensionTips.map(e=>({extension:e.toLowerCase(),reason:{reasonId:6,reasonText:""}})))}};OUe=I([m(0,Ze)],OUe);var FUe=class extends Sk{constructor(e,t){super();this.extensionTipsService=e;this.workspaceContextService=t;this.importantTips=[];this.otherTips=[];this._onDidChangeRecommendations=this._register(new T);this.onDidChangeRecommendations=this._onDidChangeRecommendations.event;this._otherRecommendations=[];this._importantRecommendations=[]}get otherRecommendations(){return this._otherRecommendations}get importantRecommendations(){return this._importantRecommendations}get recommendations(){return[...this.importantRecommendations,...this.otherRecommendations]}async doActivate(){await this.fetch(),this._register(this.workspaceContextService.onDidChangeWorkspaceFolders(e=>this.onWorkspaceFoldersChanged(e)))}async fetch(){let e=this.workspaceContextService.getWorkspace(),t=new Map,o=new Map;for(let n of e.folders){let r=await this.extensionTipsService.getConfigBasedTips(n.uri);for(let s of r)s.important?t.set(s.extensionId,s):o.set(s.extensionId,s)}this.importantTips=[...t.values()],this.otherTips=[...o.values()].filter(n=>!t.has(n.extensionId)),this._otherRecommendations=this.otherTips.map(n=>this.toExtensionRecommendation(n)),this._importantRecommendations=this.importantTips.map(n=>this.toExtensionRecommendation(n))}async onWorkspaceFoldersChanged(e){if(e.added.length){let t=this.importantTips;await this.fetch(),this.importantTips.some(o=>t.every(n=>o.extensionId!==n.extensionId))&&this._onDidChangeRecommendations.fire()}}toExtensionRecommendation(e){return{extension:e.extensionId,reason:{reasonId:3,reasonText:d(11285,null)},whenNotInstalled:e.whenNotInstalled}}};FUe=I([m(0,XTe),m(1,Ae)],FUe);var WUe=class extends Sk{constructor(e,t){super();this.productService=e;this.extensionManagementServerService=t;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){this.extensionManagementServerService.webExtensionManagementServer&&!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer&&Array.isArray(this.productService.webExtensionTips)&&(this._recommendations=this.productService.webExtensionTips.map(t=>({extension:t.toLowerCase(),reason:{reasonId:6,reasonText:d(11889,null,this.productService.nameLong)}})))}};WUe=I([m(0,Ze),m(1,$c)],WUe);var VUe=class extends Sk{constructor(e){super();this.productService=e;this._recommendations=[]}get recommendations(){return this._recommendations}async doActivate(){let e={...this.productService.remoteExtensionTips,...this.productService.virtualWorkspaceExtensionTips},t=oD(xm);this._recommendations=Object.values(e).filter(({supportedPlatforms:o})=>!o||o.includes(t)).map(o=>({extension:o.extensionId.toLowerCase(),reason:{reasonId:6,reasonText:""}}))}};VUe=I([m(0,Ze)],VUe);var BUe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.lifecycleService=t;this.galleryService=o;this.telemetryService=n;this.environmentService=r;this.extensionManagementService=s;this.extensionRecommendationsManagementService=l;this.extensionRecommendationNotificationService=c;this.extensionsWorkbenchService=u;this.remoteExtensionsScannerService=p;this.userDataInitializationService=h;this._onDidChangeRecommendations=this._register(new T);this.onDidChangeRecommendations=this._onDidChangeRecommendations.event;if(this.workspaceRecommendations=this._register(e.createInstance(PUe)),this.fileBasedRecommendations=this._register(e.createInstance(AUe)),this.configBasedRecommendations=this._register(e.createInstance(FUe)),this.exeBasedRecommendations=this._register(e.createInstance(MUe)),this.keymapRecommendations=this._register(e.createInstance(NUe)),this.webRecommendations=this._register(e.createInstance(WUe)),this.languageRecommendations=this._register(e.createInstance(OUe)),this.remoteRecommendations=this._register(e.createInstance(VUe)),!this.isEnabled()){this.sessionSeed=0,this.activationPromise=Promise.resolve();return}this.sessionSeed=+new Date,this.activationPromise=this.activate(),this._register(this.extensionManagementService.onDidInstallExtensions(g=>this.onDidInstallExtensions(g)))}async activate(){try{await Promise.allSettled([this.remoteExtensionsScannerService.whenExtensionsReady(),this.userDataInitializationService.whenInitializationFinished(),this.lifecycleService.when(3)])}catch{}await Promise.all([this.workspaceRecommendations.activate(),this.configBasedRecommendations.activate(),this.fileBasedRecommendations.activate(),this.keymapRecommendations.activate(),this.languageRecommendations.activate(),this.webRecommendations.activate(),this.remoteRecommendations.activate()]),this._register(U.any(this.workspaceRecommendations.onDidChangeRecommendations,this.configBasedRecommendations.onDidChangeRecommendations,this.extensionRecommendationsManagementService.onDidChangeIgnoredRecommendations)(()=>this._onDidChangeRecommendations.fire())),this.promptWorkspaceRecommendations()}isEnabled(){return this.galleryService.isEnabled()&&!this.environmentService.isExtensionDevelopment}async activateProactiveRecommendations(){await Promise.all([this.exeBasedRecommendations.activate(),this.configBasedRecommendations.activate()])}getAllRecommendationsWithReason(){this.activateProactiveRecommendations();let e=Object.create(null),t=[...this.configBasedRecommendations.recommendations,...this.exeBasedRecommendations.recommendations,...this.fileBasedRecommendations.recommendations,...this.workspaceRecommendations.recommendations,...this.keymapRecommendations.recommendations,...this.languageRecommendations.recommendations,...this.webRecommendations.recommendations];for(let{extension:o,reason:n}of t)We(o)&&this.isExtensionAllowedToBeRecommended(o)&&(e[o.toLowerCase()]=n);return e}async getConfigBasedRecommendations(){return await this.configBasedRecommendations.activate(),{important:this.toExtensionIds(this.configBasedRecommendations.importantRecommendations),others:this.toExtensionIds(this.configBasedRecommendations.otherRecommendations)}}async getOtherRecommendations(){await this.activationPromise,await this.activateProactiveRecommendations();let e=[...this.configBasedRecommendations.otherRecommendations,...this.exeBasedRecommendations.otherRecommendations,...this.webRecommendations.recommendations],t=this.toExtensionIds(e);return nY(t,this.sessionSeed),t}async getImportantRecommendations(){await this.activateProactiveRecommendations();let e=[...this.fileBasedRecommendations.importantRecommendations,...this.configBasedRecommendations.importantRecommendations,...this.exeBasedRecommendations.importantRecommendations],t=this.toExtensionIds(e);return nY(t,this.sessionSeed),t}getKeymapRecommendations(){return this.toExtensionIds(this.keymapRecommendations.recommendations)}getLanguageRecommendations(){return this.toExtensionIds(this.languageRecommendations.recommendations)}getRemoteRecommendations(){return this.toExtensionIds(this.remoteRecommendations.recommendations)}async getWorkspaceRecommendations(){if(!this.isEnabled())return[];await this.workspaceRecommendations.activate();let e=[];for(let{extension:t}of this.workspaceRecommendations.recommendations)We(t)?!e.includes(t.toLowerCase())&&this.isExtensionAllowedToBeRecommended(t)&&e.push(t.toLowerCase()):e.push(t);return e}async getExeBasedRecommendations(e){await this.exeBasedRecommendations.activate();let{important:t,others:o}=e?this.exeBasedRecommendations.getRecommendations(e):{important:this.exeBasedRecommendations.importantRecommendations,others:this.exeBasedRecommendations.otherRecommendations};return{important:this.toExtensionIds(t),others:this.toExtensionIds(o)}}getFileBasedRecommendations(){return this.toExtensionIds(this.fileBasedRecommendations.recommendations)}onDidInstallExtensions(e){for(let t of e)if(t.source&&!A.isUri(t.source)&&t.operation===2){let n=(this.getAllRecommendationsWithReason()||{})[t.source.identifier.id.toLowerCase()];n&&this.telemetryService.publicLog("extensionGallery:install:recommendations",{...t.source.telemetryData,recommendationReason:n.reasonId})}}toExtensionIds(e){let t=[];for(let{extension:o}of e)We(o)&&this.isExtensionAllowedToBeRecommended(o)&&!t.includes(o.toLowerCase())&&t.push(o.toLowerCase());return t}isExtensionAllowedToBeRecommended(e){return!this.extensionRecommendationsManagementService.ignoredRecommendations.includes(e.toLowerCase())}async promptWorkspaceRecommendations(){let e=await this.extensionsWorkbenchService.queryLocal(),t=[...this.workspaceRecommendations.recommendations,...this.configBasedRecommendations.importantRecommendations.filter(o=>!o.whenNotInstalled||o.whenNotInstalled.every(n=>e.every(r=>!Ht(r.identifier,{id:n}))))].map(({extension:o})=>o).filter(o=>!We(o)||this.isExtensionAllowedToBeRecommended(o));t.length&&(await this._registerP(Li(5e3)),await this.extensionRecommendationNotificationService.promptWorkspaceRecommendations(t))}_registerP(e){return this._register(ee(()=>e.cancel())),e}};BUe=I([m(0,F),m(1,to),m(2,ga),m(3,_e),m(4,ko),m(5,xs),m(6,RE),m(7,Pre),m(8,Ui),m(9,aq),m(10,tQ)],BUe);var HUe=class{constructor(i,e,t){let o={location:10,title:d(11683,null)},n,r=0;this._listener=i.onWillActivateByEvent(s=>{t.trace("onWillActivateByEvent: ",s.event),n||(n=new Mo,e.withProgress(o,l=>n.p)),r++,Promise.race([s.activation,Li(5e3,Ie.None)]).finally(()=>{--r===0&&(n.complete(void 0),n=void 0)})})}dispose(){this._listener.dispose()}};HUe=I([m(0,lt),m(1,Go),m(2,re)],HUe);var UUe=class extends k{constructor(e,t){super();this.extensionManagementService=e;this._register(t.completionProvider.register({language:"jsonc",pattern:"**/settings.json"},{_debugDisplayName:"extensionsCompletionProvider",provideCompletionItems:async(o,n,r,s)=>{let l=(p,h)=>{let g=p.getWordAtPosition(h);return g?new G(h.lineNumber,g.startColumn,h.lineNumber,g.endColumn):null},c=Uno(o.getValue(),o.getOffsetAt(n)),u=l(o,n)??G.fromPositions(n,n);if(c.path[0]==="extensions.supportUntrustedWorkspaces"&&c.path.length===2&&c.isAtPropertyKey){let p=[];try{p=Object.keys(is(o.getValue())["extensions.supportUntrustedWorkspaces"])}catch{}return{suggestions:await this.provideSupportUntrustedWorkspacesExtensionProposals(p,u)}}return{suggestions:[]}}}))}async provideSupportUntrustedWorkspacesExtensionProposals(e,t){let o=[],r=(await this.extensionManagementService.getInstalled()).filter(s=>s.manifest.main).filter(s=>e.indexOf(s.identifier.id)===-1);if(r.length)o.push(...r.map(s=>{let l=`"${s.identifier.id}": {
	"supported": true,
	"version": "${s.manifest.version}"
},`;return{label:s.identifier.id,kind:13,insertText:l,filterText:l,range:t}}));else{let s=`"vscode.csharp": {
	"supported": true,
	"version": "0.0.0"
},`;o.push({label:d(11684,null),kind:13,insertText:s,filterText:s,range:t})}return o}};UUe=I([m(0,xs),m(1,Jt)],UUe);var zUe=class extends k{constructor(e,t,o,n){super();this.extensionService=e;this.extensionsWorkbenchService=t;this.notificationService=o;this.hostService=n;Ge.registerCommand("workbench.extensions.installMissingDependencies",()=>this.installMissingDependencies()),be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.extensions.installMissingDependencies",category:d(11686,null),title:d(11685,null)}})}async getUninstalledMissingDependencies(){let e=await this.getAllMissingDependencies(),t=await this.extensionsWorkbenchService.queryLocal();return e.filter(o=>t.every(n=>!Ht(n.identifier,{id:o})))}async getAllMissingDependencies(){await this.extensionService.whenInstalledExtensionsRegistered();let e=this.extensionService.extensions.reduce((o,n)=>(o.add(n.identifier.value.toLowerCase()),o),new Set),t=new Set;for(let o of this.extensionService.extensions)o.extensionDependencies&&o.extensionDependencies.forEach(n=>{e.has(n.toLowerCase())||t.add(n)});return[...t.values()]}async installMissingDependencies(){let e=await this.getUninstalledMissingDependencies();if(e.length){let t=await this.extensionsWorkbenchService.getExtensions(e.map(o=>({id:o})),Ie.None);t.length&&(await vn.settled(t.map(o=>this.extensionsWorkbenchService.install(o))),this.notificationService.notify({severity:ft.Info,message:d(11687,null),actions:{primary:[new it("realod",d(11689,null),"",!0,()=>this.hostService.reload())]}}))}else this.notificationService.info(d(11688,null))}};zUe=I([m(0,lt),m(1,Ui),m(2,Ne),m(3,ti)],zUe);var D9=class extends cg{constructor(e,t,o,n,r){super(D9.PREFIX);this.extensionsWorkbenchService=e;this.galleryService=t;this.extensionsService=o;this.notificationService=n;this.logService=r}static{this.PREFIX="ext install "}_getPicks(e,t,o){if(!e)return[{label:d(11718,null)}];let n={label:d(11717,null,e),accept:()=>this.extensionsWorkbenchService.openSearch(e)};return/\./.test(e)?this.getPicksForExtensionId(e,n,o):[n]}async getPicksForExtensionId(e,t,o){try{let[n]=await this.galleryService.getExtensions([{id:e}],o);return o.isCancellationRequested?[]:n?[{label:d(11715,null,e),accept:()=>this.installExtension(n,e)}]:[t]}catch(n){return o.isCancellationRequested?[]:(this.logService.error(n),[t])}}async installExtension(e,t){try{await this.extensionsWorkbenchService.openSearch(`@id:${t}`),await this.extensionsService.installFromGallery(e)}catch(o){this.notificationService.error(o)}}};D9=I([m(0,Ui),m(1,ga),m(2,xs),m(3,Ne),m(4,re)],D9);var R9=class extends cg{constructor(e){super(R9.PREFIX);this.extensionsWorkbenchService=e}static{this.PREFIX="ext "}_getPicks(){return[{label:d(11716,null),accept:()=>this.extensionsWorkbenchService.openSearch("")}]}};R9=I([m(0,Ui)],R9);var vBi="none",gBi=class extends k{constructor(){super(...arguments);this._onFocus=this._register(new T);this.onFocus=this._onFocus.event;this._onBlur=this._register(new T);this.onBlur=this._onBlur.event;this.currentlyFocusedItems=[];this.filters={}}onFocusChange(e){this.currentlyFocusedItems.forEach(t=>this._onBlur.fire(t)),this.currentlyFocusedItems=e,this.currentlyFocusedItems.forEach(t=>this._onFocus.fire(t))}};function ewn(a){if(a==="UpdateDate")return!0}var L9=class extends na{},Hr=class extends L9{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se){super({...t,showActions:2,maximumBodySize:e.flexibleHeight?V.getNumber(`${t.id}.size`,0,0)?void 0:0:void 0},n,r,f,E,M,s,N,l,g);this.options=e;this.notificationService=o;this.extensionService=c;this.extensionsWorkbenchService=u;this.extensionRecommendationsService=p;this.telemetryService=h;this.contextService=v;this.extensionManagementServerService=b;this.extensionManifestPropertiesService=S;this.extensionManagementService=y;this.workspaceService=w;this.productService=x;this.storageService=V;this.workspaceTrustManagementService=H;this.extensionEnablementService=K;this.extensionFeaturesManagementService=j;this.uriIdentityService=J;this.logService=se;this.list=null;this.queryRequest=null;this.contextMenuActionRunner=this._register(new cs);this.options.onDidChangeTitle&&this._register(this.options.onDidChangeTitle(ae=>this.updateTitle(ae))),this._register(this.contextMenuActionRunner.onDidRun(({error:ae})=>ae&&this.notificationService.error(ae))),this.registerActions()}static{this.RECENT_UPDATE_DURATION=10080*60*1e3}registerActions(){}renderHeader(e){e.classList.add("extension-view-header"),super.renderHeader(e),this.options.hideBadge||(this.badge=this._register(new eb(D(e,_(".count-badge-wrapper")),{},VI)))}renderBody(e){super.renderBody(e);let t=D(e,_(".message-container")),o=D(t,_("")),n=D(t,_(".message")),r=D(e,_(".extensions-list"));this.extensionsViewState=this._register(new gBi),this.list=this._register(this.instantiationService.createInstance(Joe,r,this.id,{},this.extensionsViewState)).list,ydo.bindTo(this.list.contextKeyService),this._register(this.list.onDidChangeFocus(s=>this.extensionsViewState?.onFocusChange(ui(s.elements)),this)),this.bodyTemplate={extensionsList:r,messageBox:n,messageContainer:t,messageSeverityIcon:o},this.queryResult&&this.setModel(this.queryResult.model)}layoutBody(e,t){super.layoutBody(e,t),this.bodyTemplate&&(this.bodyTemplate.extensionsList.style.height=e+"px"),this.list?.layout(e,t)}async show(e,t){if(this.queryRequest){if(!t&&this.queryRequest.query===e)return this.queryRequest.request;this.queryRequest.request.cancel(),this.queryRequest=null}this.queryResult&&(this.queryResult.disposables.dispose(),this.queryResult=void 0,this.extensionsViewState&&(this.extensionsViewState.filters={}));let o=W$.parse(e),n={sortOrder:0};switch(o.sortBy){case"installs":n.sortBy="InstallCount";break;case"rating":n.sortBy="WeightedRating";break;case"name":n.sortBy="Title";break;case"publishedDate":n.sortBy="PublishedDate";break;case"updateDate":n.sortBy="UpdateDate";break}let r=Hn(async s=>{try{this.queryResult=await this.query(o,n,s);let l=this.queryResult.model;return this.setModel(l,this.queryResult.message),this.queryResult.onDidChangeModel&&this.queryResult.disposables.add(this.queryResult.onDidChangeModel(c=>{this.queryResult&&(this.queryResult.model=c,this.updateModel(c))})),l}catch(l){let c=new hh([]);return Yi(l)||(this.logService.error(l),this.setModel(c,this.getMessage(l))),this.list?this.list.model:c}});return r.finally(()=>this.queryRequest=null),this.queryRequest={query:e,request:r},r}count(){return this.queryResult?.model.length??0}showEmptyModel(){let e=new hh([]);return this.setModel(e),Promise.resolve(e)}async query(e,t,o){let n=/@id:(([a-z0-9A-Z][a-z0-9\-A-Z]*)\.([a-z0-9A-Z][a-z0-9\-A-Z]*))/g,r=[],s;for(;(s=n.exec(e.value))!==null;){let c=s[1];r.push(c)}if(r.length)return{model:await this.queryByIds(r,t,o),disposables:new O};if(Hr.isLocalExtensionsQuery(e.value,e.sortBy))return this.queryLocal(e,t);Hr.isSearchPopularQuery(e.value)?(e.value=e.value.replace("@popular",""),t.sortBy=t.sortBy?t.sortBy:"InstallCount"):Hr.isSearchRecentlyPublishedQuery(e.value)&&(e.value=e.value.replace("@recentlyPublished",""),t.sortBy=t.sortBy?t.sortBy:"PublishedDate");let l={...t,sortBy:ewn(t.sortBy)?void 0:t.sortBy};return this.queryGallery(e,l,o)}async queryByIds(e,t,o){let n=e.reduce((l,c)=>(l.add(c.toLowerCase()),l),new Set),r=(await this.extensionsWorkbenchService.queryLocal(this.options.server)).filter(l=>n.has(l.identifier.id.toLowerCase())),s=r.length?e.filter(l=>r.every(c=>!Ht(c.identifier,{id:l}))):e;if(s.length){let l=await this.extensionsWorkbenchService.getExtensions(s.map(c=>({id:c})),{source:"queryById"},o);r.push(...l)}return new hh(r)}async queryLocal(e,t){let o=await this.extensionsWorkbenchService.queryLocal(this.options.server),{extensions:n,canIncludeInstalledExtensions:r,description:s}=await this.filterLocal(o,this.extensionService.extensions,e,t),l=new O,c=l.add(new T);if(r){let u=!1;l.add(ee(()=>u=!0)),l.add(U.debounce(U.any(U.filter(this.extensionsWorkbenchService.onChange,p=>p?.state===1),this.extensionService.onDidChangeExtensions),()=>{})(async()=>{let p=this.options.server?this.extensionsWorkbenchService.installed.filter(g=>g.server===this.options.server):this.extensionsWorkbenchService.local,{extensions:h}=await this.filterLocal(p,this.extensionService.extensions,e,t);if(!u){let g=this.mergeAddedExtensions(n,h);g&&(n=g,c.fire(new hh(n)))}}))}return{model:new hh(n),message:s?{text:s,severity:ft.Info}:void 0,onDidChangeModel:c.event,disposables:l}}async filterLocal(e,t,o,n){let r=o.value,s=[],l,c=/@builtin/i.test(r),u=!c;return/@installed/i.test(r)?s=this.filterInstalledExtensions(e,t,o,n):/@outdated/i.test(r)?s=this.filterOutdatedExtensions(e,o,n):/@disabled/i.test(r)?s=this.filterDisabledExtensions(e,t,o,n,c):/@enabled/i.test(r)?s=this.filterEnabledExtensions(e,t,o,n,c):/@workspaceUnsupported/i.test(r)?s=this.filterWorkspaceUnsupportedExtensions(e,o,n):/@deprecated/i.test(o.value)?s=await this.filterDeprecatedExtensions(e,o,n):/@recentlyUpdated/i.test(o.value)?s=this.filterRecentlyUpdatedExtensions(e,o,n):/@restartrequired/i.test(o.value)?s=this.filterRestartRequiredExtensions(e,o,n):/@contribute:/i.test(o.value)?s=this.filterExtensionsByFeature(e,o):c&&(s=this.filterBuiltinExtensions(e,o,n)),{extensions:s,canIncludeInstalledExtensions:u,description:l}}filterBuiltinExtensions(e,t,o){let{value:n,includedCategories:r,excludedCategories:s}=this.parseCategories(t.value);n=n.replaceAll(/@builtin/gi,"").replaceAll(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let l=e.filter(c=>c.isBuiltin&&(c.name.toLowerCase().indexOf(n)>-1||c.displayName.toLowerCase().indexOf(n)>-1)&&this.filterExtensionByCategory(c,r,s));return this.sortExtensions(l,o)}filterExtensionByCategory(e,t,o){return!t.length&&!o.length?!0:e.categories.length?o.length&&e.categories.some(n=>o.includes(n.toLowerCase()))?!1:e.categories.some(n=>t.includes(n.toLowerCase())):t.includes(vBi)}parseCategories(e){let t=[],o=[];return e=e.replace(/\bcategory:("([^"]*)"|([^"]\S*))(\s+|\b|$)/g,(n,r,s)=>{let l=(s||r||"").toLowerCase();return l.startsWith("-")?o.indexOf(l)===-1&&o.push(l):t.indexOf(l)===-1&&t.push(l),""}),{value:e,includedCategories:t,excludedCategories:o}}filterInstalledExtensions(e,t,o,n){let{value:r,includedCategories:s,excludedCategories:l}=this.parseCategories(o.value);r=r.replace(/@installed/g,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let c=p=>(p.name.toLowerCase().indexOf(r)>-1||p.displayName.toLowerCase().indexOf(r)>-1||p.description.toLowerCase().indexOf(r)>-1)&&this.filterExtensionByCategory(p,s,l),u;if(n.sortBy!==void 0)u=e.filter(p=>!p.isBuiltin&&c(p)),u=this.sortExtensions(u,n);else{u=e.filter(y=>(!y.isBuiltin||y.outdated||y.runtimeState!==void 0)&&c(y));let p=t.reduce((y,w)=>(y.set(w.identifier.value,w),y),new uu),h=(y,w)=>{let x=p.get(y.identifier.id),E=!!x&&this.extensionManagementServerService.getExtensionManagementServer(YT(x))===y.server,M=p.get(w.identifier.id),N=M&&this.extensionManagementServerService.getExtensionManagementServer(YT(M))===w.server;if(E&&N)return y.displayName.localeCompare(w.displayName);let V=y.local&&gM(y.local.manifest),H=w.local&&gM(w.local.manifest);return!E&&!N?V?-1:H?1:y.displayName.localeCompare(w.displayName):E&&H||N&&V?y.displayName.localeCompare(w.displayName):E?-1:1},g=[],f=[],v=[],b=[],S=[];for(let y of u)y.enablementState===6?g.push(y):y.deprecationInfo?f.push(y):y.outdated&&this.extensionEnablementService.isEnabledEnablementState(y.enablementState)?v.push(y):y.runtimeState?b.push(y):S.push(y);u=[...g.sort(h),...f.sort(h),...v.sort(h),...b.sort(h),...S.sort(h)]}return u}filterOutdatedExtensions(e,t,o){let{value:n,includedCategories:r,excludedCategories:s}=this.parseCategories(t.value);n=n.replace(/@outdated/g,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let l=e.sort((c,u)=>c.displayName.localeCompare(u.displayName)).filter(c=>c.outdated&&(c.name.toLowerCase().indexOf(n)>-1||c.displayName.toLowerCase().indexOf(n)>-1)&&this.filterExtensionByCategory(c,r,s));return this.sortExtensions(l,o)}filterDisabledExtensions(e,t,o,n,r){let{value:s,includedCategories:l,excludedCategories:c}=this.parseCategories(o.value);s=s.replaceAll(/@disabled|@builtin/gi,"").replaceAll(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase(),r&&(e=e.filter(p=>p.isBuiltin));let u=e.sort((p,h)=>p.displayName.localeCompare(h.displayName)).filter(p=>t.every(h=>!Ht({id:h.identifier.value,uuid:h.uuid},p.identifier))&&(p.name.toLowerCase().indexOf(s)>-1||p.displayName.toLowerCase().indexOf(s)>-1)&&this.filterExtensionByCategory(p,l,c));return this.sortExtensions(u,n)}filterEnabledExtensions(e,t,o,n,r){let{value:s,includedCategories:l,excludedCategories:c}=this.parseCategories(o.value);s=s?s.replaceAll(/@enabled|@builtin/gi,"").replaceAll(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase():"",e=e.filter(p=>p.isBuiltin===r);let u=e.sort((p,h)=>p.displayName.localeCompare(h.displayName)).filter(p=>t.some(h=>Ht({id:h.identifier.value,uuid:h.uuid},p.identifier))&&(p.name.toLowerCase().indexOf(s)>-1||p.displayName.toLowerCase().indexOf(s)>-1)&&this.filterExtensionByCategory(p,l,c));return this.sortExtensions(u,n)}filterWorkspaceUnsupportedExtensions(e,t,o){let r=t.value.match(/^\s*@workspaceUnsupported(?::(untrusted|virtual)(Partial)?)?(?:\s+([^\s]*))?/i);if(!r)return[];let s=r[1]?.toLowerCase(),l=!!r[2],c=r[3]?.toLowerCase();c&&(e=e.filter(f=>f.name.toLowerCase().indexOf(c)>-1||f.displayName.toLowerCase().indexOf(c)>-1));let u=(f,v)=>f.local&&this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(f.local.manifest)===v,p=(f,v)=>{if(!f.local)return!1;let b=this.extensionEnablementService.getEnablementState(f.local);return b!==12&&b!==13&&b!==0&&b!==8?!1:this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(f.local.manifest)===v?!0:v===!1?ipe(e.map(y=>y.local),f.local).some(y=>this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(y.manifest)===v):!1},h=R0(this.workspaceService.getWorkspace()),g=!this.workspaceTrustManagementService.isWorkspaceTrusted();return s==="virtual"?e=e.filter(f=>h&&u(f,l?"limited":!1)&&!(g&&p(f,!1))):s==="untrusted"?e=e.filter(f=>p(f,l?"limited":!1)&&!(h&&u(f,!1))):e=e.filter(f=>h&&!u(f,!0)||g&&!p(f,!0)),this.sortExtensions(e,o)}async filterDeprecatedExtensions(e,t,o){let n=t.value.replace(/@deprecated/g,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase(),r=await this.extensionManagementService.getExtensionsControlManifest(),s=Object.keys(r.deprecated);return e=e.filter(l=>s.includes(l.identifier.id)&&(!n||l.name.toLowerCase().indexOf(n)>-1||l.displayName.toLowerCase().indexOf(n)>-1)),this.sortExtensions(e,o)}filterRecentlyUpdatedExtensions(e,t,o){let{value:n,includedCategories:r,excludedCategories:s}=this.parseCategories(t.value),l=Date.now();e=e.filter(u=>!u.isBuiltin&&!u.outdated&&u.local?.updated&&u.local?.installedTimestamp!==void 0&&l-u.local.installedTimestamp<Hr.RECENT_UPDATE_DURATION),n=n.replace(/@recentlyUpdated/g,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let c=e.filter(u=>(u.name.toLowerCase().indexOf(n)>-1||u.displayName.toLowerCase().indexOf(n)>-1)&&this.filterExtensionByCategory(u,r,s));return o.sortBy=o.sortBy??"UpdateDate",this.sortExtensions(c,o)}filterRestartRequiredExtensions(e,t,o){let{value:n,includedCategories:r,excludedCategories:s}=this.parseCategories(t.value);e=e.filter(c=>c.runtimeState!==void 0),n=n.replace(/@restartrequired/gi,"").replace(/@sort:(\w+)(-\w*)?/g,"").trim().toLowerCase();let l=e.filter(c=>(c.name.toLowerCase().indexOf(n)>-1||c.displayName.toLowerCase().indexOf(n)>-1)&&this.filterExtensionByCategory(c,r,s));return this.sortExtensions(l,o)}filterExtensionsByFeature(e,t){let n=t.value.replace(/@contribute:/g,"").trim().split(" ")[0],r=oe.as(qs.ExtensionFeaturesRegistry).getExtensionFeature(n);if(!r)return[];this.extensionsViewState&&(this.extensionsViewState.filters.featureId=n);let s=r.renderer?this.instantiationService.createInstance(r.renderer):void 0;try{let l=[];for(let c of e){if(!c.local)continue;let u=this.extensionFeaturesManagementService.getAccessData(new hi(c.identifier.id),n),p=s?.shouldRender(c.local.manifest);(u||p)&&l.push([c,u?.accessTimes.length??0])}return l.sort(([,c],[,u])=>u-c).map(([c])=>c)}finally{s?.dispose()}}mergeAddedExtensions(e,t){let o=[...e],n=s=>{let l=-1,c=t[s];return c&&(l=o.findIndex(u=>Ht(u.identifier,c.identifier)),l===-1)?n(s-1):l},r=!1;for(let s=0;s<t.length;s++){let l=t[s];e.every(c=>!Ht(c.identifier,l.identifier))&&(r=!0,e.splice(n(s-1)+1,0,l))}return r?e:void 0}async queryGallery(e,t,o){let n=t.sortBy!==void 0;if(!n&&!e.value.trim()&&(t.sortBy="InstallCount"),this.isRecommendationsQuery(e))return{model:await this.queryRecommendations(e,t,o),disposables:new O};let r=e.value;if(!r){t.source="viewlet";let s=await this.extensionsWorkbenchService.queryGallery(t,o);return{model:new hh(s),disposables:new O}}if(/\bext:([^\s]+)\b/g.test(r)){t.text=r,t.source="file-extension-tags";let s=await this.extensionsWorkbenchService.queryGallery(t,o);return{model:new hh(s),disposables:new O}}if(t.text=r.substring(0,350),t.source="searchText",n||/\b(category|tag):([^\s]+)\b/gi.test(r)||/\bfeatured(\s+|\b|$)/gi.test(r)){let s=await this.extensionsWorkbenchService.queryGallery(t,o);return{model:new hh(s),disposables:new O}}try{let[s,l]=await Promise.all([this.extensionsWorkbenchService.queryGallery(t,o),this.getPreferredExtensions(t.text.toLowerCase(),o).catch(()=>[])]);return{model:l.length?new fBi(l,s):new hh(s),disposables:new O}}catch(s){if(Yi(s)||!(s instanceof QT))throw s;let l=t.text.toLowerCase(),c=this.extensionsWorkbenchService.local.filter(u=>!u.isBuiltin&&(u.name.toLowerCase().indexOf(l)>-1||u.displayName.toLowerCase().indexOf(l)>-1||u.description.toLowerCase().indexOf(l)>-1));if(c.length){let u=this.getMessage(s);return{model:new hh(c),disposables:new O,message:{text:d(11779,null,u.text),severity:u.severity}}}throw s}}async getPreferredExtensions(e,t){let o=this.extensionsWorkbenchService.local.filter(s=>!s.isBuiltin&&(s.name.toLowerCase().indexOf(e)>-1||s.displayName.toLowerCase().indexOf(e)>-1||s.description.toLowerCase().indexOf(e)>-1)),n=new Set;if(o.length){let s=[];for(let l of o)l.identifier.uuid&&n.add(l.identifier.uuid),!l.gallery&&l.identifier.uuid&&s.push(l.identifier);s.length&&this.extensionsWorkbenchService.getExtensions(s,Ie.None).catch(l=>null)}let r=[];try{let s=await this.extensionManagementService.getExtensionsControlManifest();if(Array.isArray(s.search)){for(let l of s.search)if(l.query&&l.query.toLowerCase()===e&&Array.isArray(l.preferredResults)){r.push(...l.preferredResults);break}}if(r.length){let l=await this.extensionsWorkbenchService.getExtensions(r.map(c=>({id:c})),t);for(let c of l)c.identifier.uuid&&!n.has(c.identifier.uuid)&&o.push(c)}}catch(s){this.logService.warn("Failed to get preferred results from the extensions control manifest.",s)}return o}sortExtensions(e,t){switch(t.sortBy){case"InstallCount":e=e.sort((o,n)=>typeof n.installCount=="number"&&typeof o.installCount=="number"?n.installCount-o.installCount:NaN);break;case"UpdateDate":e=e.sort((o,n)=>typeof n.local?.installedTimestamp=="number"&&typeof o.local?.installedTimestamp=="number"?n.local.installedTimestamp-o.local.installedTimestamp:typeof n.local?.installedTimestamp=="number"?1:typeof o.local?.installedTimestamp=="number"?-1:NaN);break;case"AverageRating":case"WeightedRating":e=e.sort((o,n)=>typeof n.rating=="number"&&typeof o.rating=="number"?n.rating-o.rating:NaN);break;default:e=e.sort((o,n)=>o.displayName.localeCompare(n.displayName));break}return t.sortOrder===2&&(e=e.reverse()),e}isRecommendationsQuery(e){return Hr.isWorkspaceRecommendedExtensionsQuery(e.value)||Hr.isKeymapsRecommendedExtensionsQuery(e.value)||Hr.isLanguageRecommendedExtensionsQuery(e.value)||Hr.isExeRecommendedExtensionsQuery(e.value)||Hr.isRemoteRecommendedExtensionsQuery(e.value)||/@recommended:all/i.test(e.value)||Hr.isSearchRecommendedExtensionsQuery(e.value)||Hr.isRecommendedExtensionsQuery(e.value)}async queryRecommendations(e,t,o){return Hr.isWorkspaceRecommendedExtensionsQuery(e.value)?this.getWorkspaceRecommendationsModel(e,t,o):Hr.isKeymapsRecommendedExtensionsQuery(e.value)?this.getKeymapRecommendationsModel(e,t,o):Hr.isLanguageRecommendedExtensionsQuery(e.value)?this.getLanguageRecommendationsModel(e,t,o):Hr.isExeRecommendedExtensionsQuery(e.value)?this.getExeRecommendationsModel(e,t,o):Hr.isRemoteRecommendedExtensionsQuery(e.value)?this.getRemoteRecommendationsModel(e,t,o):/@recommended:all/i.test(e.value)?this.getAllRecommendationsModel(t,o):Hr.isSearchRecommendedExtensionsQuery(e.value)||Hr.isRecommendedExtensionsQuery(e.value)&&t.sortBy!==void 0?this.searchRecommendations(e,t,o):Hr.isRecommendedExtensionsQuery(e.value)?this.getOtherRecommendationsModel(e,t,o):new hh([])}async getInstallableRecommendations(e,t,o){let n=[];if(e.length){let r=[],s=[];for(let l of e)typeof l=="string"?r.push(l):s.push(l);if(r.length)try{let l=await this.extensionsWorkbenchService.getExtensions(r.map(c=>({id:c})),{source:t.source},o);for(let c of l)c.gallery&&!c.deprecationInfo&&await this.extensionManagementService.canInstall(c.gallery)===!0&&n.push(c)}catch(l){if(!s.length||!this.isOfflineError(l))throw l}if(s.length){let l=await this.extensionsWorkbenchService.getResourceExtensions(s,!0);for(let c of l)await this.extensionsWorkbenchService.canInstall(c)===!0&&n.push(c)}}return n}async getWorkspaceRecommendations(){let e=await this.extensionRecommendationsService.getWorkspaceRecommendations(),{important:t}=await this.extensionRecommendationsService.getConfigBasedRecommendations();for(let o of t)e.find(n=>n===o)||e.push(o);return e}async getWorkspaceRecommendationsModel(e,t,o){let n=await this.getWorkspaceRecommendations(),r=await this.getInstallableRecommendations(n,{...t,source:"recommendations-workspace"},o);return new hh(r)}async getKeymapRecommendationsModel(e,t,o){let n=e.value.replace(/@recommended:keymaps/g,"").trim().toLowerCase(),r=this.extensionRecommendationsService.getKeymapRecommendations(),s=(await this.getInstallableRecommendations(r,{...t,source:"recommendations-keymaps"},o)).filter(l=>l.identifier.id.toLowerCase().indexOf(n)>-1);return new hh(s)}async getLanguageRecommendationsModel(e,t,o){let n=e.value.replace(/@recommended:languages/g,"").trim().toLowerCase(),r=this.extensionRecommendationsService.getLanguageRecommendations(),s=(await this.getInstallableRecommendations(r,{...t,source:"recommendations-languages"},o)).filter(l=>l.identifier.id.toLowerCase().indexOf(n)>-1);return new hh(s)}async getRemoteRecommendationsModel(e,t,o){let n=e.value.replace(/@recommended:remotes/g,"").trim().toLowerCase(),r=this.extensionRecommendationsService.getRemoteRecommendations(),s=(await this.getInstallableRecommendations(r,{...t,source:"recommendations-remotes"},o)).filter(l=>l.identifier.id.toLowerCase().indexOf(n)>-1);return new hh(s)}async getExeRecommendationsModel(e,t,o){let n=e.value.replace(/@exe:/g,"").trim().toLowerCase(),{important:r,others:s}=await this.extensionRecommendationsService.getExeBasedRecommendations(n.startsWith('"')?n.substring(1,n.length-1):n),l=await this.getInstallableRecommendations([...r,...s],{...t,source:"recommendations-exe"},o);return new hh(l)}async getOtherRecommendationsModel(e,t,o){let n=await this.getOtherRecommendations(),r=await this.getInstallableRecommendations(n,{...t,source:"recommendations-other",sortBy:void 0},o),s=ui(n.map(l=>r.find(c=>Ht(c.identifier,{id:l}))));return new hh(s)}async getOtherRecommendations(){let e=(await this.extensionsWorkbenchService.queryLocal(this.options.server)).map(o=>o.identifier.id.toLowerCase()),t=(await this.getWorkspaceRecommendations()).map(o=>We(o)?o.toLowerCase():o);return jo((await Promise.all([this.extensionRecommendationsService.getImportantRecommendations(),this.extensionRecommendationsService.getFileBasedRecommendations(),this.extensionRecommendationsService.getOtherRecommendations()])).flat().filter(o=>!e.includes(o.toLowerCase())&&!t.includes(o.toLowerCase())),o=>o.toLowerCase())}async getAllRecommendationsModel(e,t){let o=await this.extensionsWorkbenchService.queryLocal(this.options.server),n=o.map(c=>c.identifier.id.toLowerCase()),r=jo((await Promise.all([this.getWorkspaceRecommendations(),this.extensionRecommendationsService.getImportantRecommendations(),this.extensionRecommendationsService.getFileBasedRecommendations(),this.extensionRecommendationsService.getOtherRecommendations()])).flat().filter(c=>We(c)?!n.includes(c.toLowerCase()):!o.some(u=>u.local&&this.uriIdentityService.extUri.isEqual(u.local.location,c)))),s=await this.getInstallableRecommendations(r,{...e,source:"recommendations-all",sortBy:void 0},t),l=[];for(let c=0;c<s.length&&l.length<8;c++){let u=r[c];if(We(u)){let p=s.find(h=>Ht(h.identifier,{id:u}));p&&l.push(p)}else{let p=s.find(h=>h.resourceExtension&&this.uriIdentityService.extUri.isEqual(h.resourceExtension.location,u));p&&l.push(p)}}return new hh(l)}async searchRecommendations(e,t,o){let n=e.value.replace(/@recommended/g,"").trim().toLowerCase(),r=jo([...await this.getWorkspaceRecommendations(),...await this.getOtherRecommendations()]),s=(await this.getInstallableRecommendations(r,{...t,source:"recommendations",sortBy:void 0},o)).filter(l=>l.identifier.id.toLowerCase().indexOf(n)>-1);return new hh(this.sortExtensions(s,t))}setModel(e,t,o){this.list&&(this.list.model=new u6(e),this.updateBody(t),o||(this.list.scrollTop=0)),this.badge&&this.badge.setCount(this.count())}updateModel(e){this.list&&(this.list.model=new u6(e),this.updateBody()),this.badge&&this.badge.setCount(this.count())}updateBody(e){if(this.bodyTemplate){let t=this.count();this.bodyTemplate.extensionsList.classList.toggle("hidden",t===0),this.bodyTemplate.messageContainer.classList.toggle("hidden",!e&&t>0),this.isBodyVisible()&&(e?(this.bodyTemplate.messageSeverityIcon.className=eE.className(e.severity),this.bodyTemplate.messageBox.textContent=e.text):this.count()===0&&(this.bodyTemplate.messageSeverityIcon.className="",this.bodyTemplate.messageBox.textContent=d(11776,null)),this.bodyTemplate.messageBox.textContent&&cn(this.bodyTemplate.messageBox.textContent))}this.updateSize()}getMessage(e){return this.isOfflineError(e)?{text:d(11778,null),severity:ft.Warning}:{text:d(11775,null,Dn(e)),severity:ft.Error}}isOfflineError(e){return e instanceof QT?e.code==="Offline":Uit(e)}updateSize(){this.options.flexibleHeight&&(this.maximumBodySize=this.list?.model.length?Number.POSITIVE_INFINITY:0,this.storageService.store(`${this.id}.size`,this.list?.model.length||0,0,1))}dispose(){super.dispose(),this.queryRequest&&(this.queryRequest.request.cancel(),this.queryRequest=null),this.queryResult&&(this.queryResult.disposables.dispose(),this.queryResult=void 0),this.list=null}static isLocalExtensionsQuery(e,t){return this.isInstalledExtensionsQuery(e)||this.isSearchInstalledExtensionsQuery(e)||this.isOutdatedExtensionsQuery(e)||this.isEnabledExtensionsQuery(e)||this.isDisabledExtensionsQuery(e)||this.isBuiltInExtensionsQuery(e)||this.isSearchBuiltInExtensionsQuery(e)||this.isBuiltInGroupExtensionsQuery(e)||this.isSearchDeprecatedExtensionsQuery(e)||this.isSearchWorkspaceUnsupportedExtensionsQuery(e)||this.isSearchRecentlyUpdatedQuery(e)||this.isRestartRequiredQuery(e)||this.isSearchExtensionUpdatesQuery(e)||this.isSortInstalledExtensionsQuery(e,t)||this.isFeatureExtensionsQuery(e)}static isSearchBuiltInExtensionsQuery(e){return/@builtin\s.+|.+\s@builtin/i.test(e)}static isBuiltInExtensionsQuery(e){return/^@builtin$/i.test(e.trim())}static isBuiltInGroupExtensionsQuery(e){return/^@builtin:.+$/i.test(e.trim())}static isSearchWorkspaceUnsupportedExtensionsQuery(e){return/^\s*@workspaceUnsupported(:(untrusted|virtual)(Partial)?)?(\s|$)/i.test(e)}static isInstalledExtensionsQuery(e){return/@installed$/i.test(e)&&!/@mcp/i.test(e)&&!/@agentPlugins/i.test(e)}static isSearchInstalledExtensionsQuery(e){return/@installed\s./i.test(e)&&!/@mcp/i.test(e)&&!/@agentPlugins/i.test(e)||this.isFeatureExtensionsQuery(e)}static isOutdatedExtensionsQuery(e){return/@outdated/i.test(e)}static isEnabledExtensionsQuery(e){return/@enabled/i.test(e)&&!/@builtin/i.test(e)}static isDisabledExtensionsQuery(e){return/@disabled/i.test(e)&&!/@builtin/i.test(e)}static isSearchDeprecatedExtensionsQuery(e){return/@deprecated\s?.*/i.test(e)}static isRecommendedExtensionsQuery(e){return/^@recommended$/i.test(e.trim())}static isSearchRecommendedExtensionsQuery(e){return/@recommended\s.+/i.test(e)}static isWorkspaceRecommendedExtensionsQuery(e){return/@recommended:workspace/i.test(e)}static isExeRecommendedExtensionsQuery(e){return/@exe:.+/i.test(e)}static isRemoteRecommendedExtensionsQuery(e){return/@recommended:remotes/i.test(e)}static isKeymapsRecommendedExtensionsQuery(e){return/@recommended:keymaps/i.test(e)}static isLanguageRecommendedExtensionsQuery(e){return/@recommended:languages/i.test(e)}static isSortInstalledExtensionsQuery(e,t){return t!==void 0&&t!==""&&e===""||!t&&/^@sort:\S*$/i.test(e)}static isSearchPopularQuery(e){return/@popular/i.test(e)}static isSearchRecentlyPublishedQuery(e){return/@recentlyPublished/i.test(e)}static isSearchRecentlyUpdatedQuery(e){return/@recentlyUpdated/i.test(e)}static isRestartRequiredQuery(e){return/@restartrequired/i.test(e)}static isSearchExtensionUpdatesQuery(e){return/@updates/i.test(e)}static isSortUpdateDateQuery(e){return/@sort:updateDate/i.test(e)}static isFeatureExtensionsQuery(e){return/@contribute:/i.test(e)}focus(){super.focus(),this.list&&(this.list.getFocus().length||this.list.getSelection().length||this.list.focusNext(),this.list.domFocus())}};Hr=I([m(2,Ne),m(3,Le),m(4,Xe),m(5,F),m(6,Pe),m(7,lt),m(8,Ui),m(9,AR),m(10,_e),m(11,ot),m(12,B),m(13,Ae),m(14,$c),m(15,hm),m(16,Dd),m(17,Ae),m(18,Ze),m(19,X),m(20,ji),m(21,Je),m(22,de),m(23,Or),m(24,As),m(25,Qy),m(26,gt),m(27,re)],Hr);var Q3t=class extends Hr{async show(){let i=this.extensionManagementServerService.webExtensionManagementServer&&!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer?"@web":"";return super.show(i)}},Y3t=class extends Hr{async show(i){return i=i||"@installed",(!Hr.isLocalExtensionsQuery(i)||Hr.isSortInstalledExtensionsQuery(i))&&(i=i+=" @installed"),super.show(i.trim())}},X3t=class extends Hr{async show(i){return i=i||"@enabled",Hr.isEnabledExtensionsQuery(i)?super.show(i):Hr.isSortInstalledExtensionsQuery(i)?super.show("@enabled "+i):this.showEmptyModel()}},J3t=class extends Hr{async show(i){return i=i||"@disabled",Hr.isDisabledExtensionsQuery(i)?super.show(i):Hr.isSortInstalledExtensionsQuery(i)?super.show("@disabled "+i):this.showEmptyModel()}},Z3t=class extends Hr{async show(i){return i=i||"@outdated",Hr.isSearchExtensionUpdatesQuery(i)&&(i=i.replace("@updates","@outdated")),super.show(i.trim())}updateSize(){super.updateSize(),this.setExpanded(this.count()>0)}},e8t=class extends Hr{async show(i){return i=i||"@recentlyUpdated",Hr.isSearchExtensionUpdatesQuery(i)&&(i=i.replace("@updates","@recentlyUpdated")),super.show(i.trim())}},Are=class extends Hr{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se){super(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se);this.options=e}show(){return super.show(this.options.query)}};Are=I([m(2,Ne),m(3,Le),m(4,Xe),m(5,F),m(6,Pe),m(7,lt),m(8,Ui),m(9,AR),m(10,_e),m(11,ot),m(12,B),m(13,Ae),m(14,$c),m(15,hm),m(16,Dd),m(17,Ae),m(18,Ze),m(19,X),m(20,ji),m(21,Je),m(22,de),m(23,Or),m(24,As),m(25,Qy),m(26,gt),m(27,re)],Are);function d8t(a,i){if(!a)return"@workspaceUnsupported:"+i;let e=a.match(new RegExp(`@workspaceUnsupported(:${i})?(\\s|$)`,"i"));if(e)return e[1]?a:a.replace(/@workspaceUnsupported/gi,"@workspaceUnsupported:"+i)}var t8t=class extends Hr{async show(i){let e=d8t(i,"untrusted");return e?super.show(e):this.showEmptyModel()}},i8t=class extends Hr{async show(i){let e=d8t(i,"untrustedPartial");return e?super.show(e):this.showEmptyModel()}},o8t=class extends Hr{async show(i){let e=d8t(i,"virtual");return e?super.show(e):this.showEmptyModel()}},n8t=class extends Hr{async show(i){let e=d8t(i,"virtualPartial");return e?super.show(e):this.showEmptyModel()}},r8t=class extends Hr{async show(i){return Hr.isSearchDeprecatedExtensionsQuery(i)?super.show(i):this.showEmptyModel()}},s8t=class extends Hr{constructor(){super(...arguments);this.reportSearchFinishedDelayer=this._register(new Aa(2e3));this.searchWaitPromise=Promise.resolve()}async show(e){let t=super.show(e);return this.reportSearchFinishedDelayer.trigger(()=>this.reportSearchFinished()),this.searchWaitPromise=t.then(null,null),t}async reportSearchFinished(){await this.searchWaitPromise,this.telemetryService.publicLog2("extensionsView:MarketplaceSearchFinished")}},a8t=class extends Hr{constructor(){super(...arguments);this.recommendedExtensionsQuery="@recommended:all"}renderBody(e){super.renderBody(e),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>{this.show("")}))}async show(e){if(e&&e.trim()!==this.recommendedExtensionsQuery)return this.showEmptyModel();let t=await super.show(this.recommendedExtensionsQuery);return this.extensionsWorkbenchService.local.some(o=>!o.isBuiltin)||this.setExpanded(t.length>0),t}},l8t=class extends Hr{constructor(){super(...arguments);this.recommendedExtensionsQuery="@recommended"}renderBody(e){super.renderBody(e),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>{this.show("")}))}async show(e){return e&&e.trim()!==this.recommendedExtensionsQuery?this.showEmptyModel():super.show(this.recommendedExtensionsQuery)}},c8t=class extends Hr{constructor(){super(...arguments);this.recommendedExtensionsQuery="@recommended:workspace"}renderBody(e){super.renderBody(e),this._register(this.extensionRecommendationsService.onDidChangeRecommendations(()=>this.show(this.recommendedExtensionsQuery))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.show(this.recommendedExtensionsQuery)))}async show(e){let o=await(e&&e.trim()!=="@recommended"&&e.trim()!=="@recommended:workspace"?this.showEmptyModel():super.show(this.recommendedExtensionsQuery));return this.setExpanded(o.length>0),o}async getInstallableWorkspaceRecommendations(){let e=(await this.extensionsWorkbenchService.queryLocal()).filter(o=>o.enablementState!==1),t=(await this.getWorkspaceRecommendations()).filter(o=>e.every(n=>We(o)?!Ht({id:o},n.identifier):!this.uriIdentityService.extUri.isEqual(o,n.local?.location)));return this.getInstallableRecommendations(t,{source:"install-all-workspace-recommendations"},Ie.None)}async installWorkspaceRecommendations(){let e=await this.getInstallableWorkspaceRecommendations();if(e.length){let t=[],o=[];for(let n of e)n.gallery?t.push({extension:n.gallery,options:{}}):o.push(n);await Promise.all([this.extensionManagementService.installGalleryExtensions(t),...o.map(n=>this.extensionsWorkbenchService.install(n))])}else this.notificationService.notify({severity:ft.Info,message:d(11777,null)})}},fBi=class{constructor(i,e){this.preferredExtensions=i;this.pager=e;this.resolved=new Map;this.preferredGalleryExtensions=new Set;this.resolvedGalleryExtensionsFromQuery=[];for(let o=0;o<this.preferredExtensions.length;o++)this.resolved.set(o,this.preferredExtensions[o]);for(let o of i)o.identifier.uuid&&this.preferredGalleryExtensions.add(o.identifier.uuid);this.length=i.length-this.preferredGalleryExtensions.size+this.pager.total;let t=Math.ceil(this.pager.total/this.pager.pageSize);this.populateResolvedExtensions(0,this.pager.firstPage),this.pages=tf(t-1).map(()=>({promise:null,cts:null,promiseIndexes:new Set}))}get onDidIncrementLength(){return U.None}isResolved(i){return this.resolved.has(i)}get(i){return this.resolved.get(i)}async resolve(i,e){if(e.isCancellationRequested)throw new qi;if(this.isResolved(i))return this.get(i);let t=i-this.preferredExtensions.length+this.resolvedGalleryExtensionsFromQuery.length,o=Math.floor(t/this.pager.pageSize),n=this.pages[o-1];n.promise||(n.cts=new qe,n.promise=this.pager.getPage(o,n.cts.token).then(s=>this.populateResolvedExtensions(o,s)).catch(s=>{throw n.promise=null,s}).finally(()=>n.cts=null));let r=e.onCancellationRequested(()=>{n.cts&&(n.promiseIndexes.delete(i),n.promiseIndexes.size===0&&n.cts.cancel())});n.promiseIndexes.add(i);try{await n.promise}finally{r.dispose()}return this.get(i)}populateResolvedExtensions(i,e){let t=0,o=i*this.pager.pageSize;for(let n=0;n<e.length;n++){let r=e[n];r.gallery?.identifier.uuid&&this.preferredGalleryExtensions.has(r.gallery.identifier.uuid)?(this.resolvedGalleryExtensionsFromQuery.push(r),t++):this.resolved.set(this.preferredExtensions.length-this.resolvedGalleryExtensionsFromQuery.length+o+n,r)}if(i!==0&&t){let n=(i+1)*this.pager.pageSize,r=[...this.resolved.keys()].sort();for(let s of r)if(s>=n){let l=this.resolved.get(s);l&&(this.resolved.delete(s),this.resolved.set(s-t,l))}}}};var SBi=new Y("extensionsSortByValue",""),IBi=new Y("searchMarketplaceExtensions",!1),yBi=new Y("extensionSearchHasText",!1),twn=new Y("installedExtensions",!1),iwn=new Y("searchInstalledExtensions",!1),own=new Y("searchRecentlyUpdatedExtensions",!1),bBi=new Y("searchExtensionUpdates",!1),nwn=new Y("searchOutdatedExtensions",!1),rwn=new Y("searchEnabledExtensions",!1),swn=new Y("searchDisabledExtensions",!1),awn=new Y("hasInstalledExtensions",!0),Qbe=new Y("builtInExtensions",!1),lwn=new Y("searchBuiltInExtensions",!1),Gct=new Y("searchUnsupportedWorkspaceExtensions",!1),gPo=new Y("searchDeprecatedExtensions",!1),fPo=new Y("searchRestartRequiredExtensions",!1),wBi=new Y("recommendedExtensions",!1),vPo=new Y("sortByUpdateDate",!1),CBi=new Y("extensionsSearchValue",""),hPo=P(11759,"Remote"),KUe=class extends k{constructor(e,t,o){super();this.extensionManagementServerService=e;this.labelService=t;this.contextKeyService=o;this.container=oe.as(Kn.ViewContainersRegistry).get(Rh),this.registerViews()}registerViews(){let e=[];e.push(...this.createDefaultExtensionsViewDescriptors()),e.push(...this.createSearchExtensionsViewDescriptors()),e.push(...this.createRecommendedExtensionsViewDescriptors()),e.push(...this.createBuiltinExtensionsViewDescriptors()),e.push(...this.createUnsupportedWorkspaceExtensionsViewDescriptors()),e.push(...this.createOtherLocalFilteredExtensionsViewDescriptors()),e.push({id:"workbench.views.extensions.marketplaceAccess",name:P(11752,"Marketplace"),ctorDescriptor:new Vt(class extends na{shouldShowWelcome(){return!0}}),when:C.and(C.or(C.has("searchMarketplaceExtensions"),C.and(zx)),C.or(See.isEqualTo("requiresSignIn"),See.isEqualTo("accessDenied"))),order:-1});let t=oe.as(Kn.ViewsRegistry);t.registerViews(e,this.container),t.registerViewWelcomeContent("workbench.views.extensions.marketplaceAccess",{content:d(11765,null,`command:${Sge}`),when:See.isEqualTo("requiresSignIn")}),t.registerViewWelcomeContent("workbench.views.extensions.marketplaceAccess",{content:d(11726,null),when:See.isEqualTo("accessDenied")})}createDefaultExtensionsViewDescriptors(){let e=[],t=[];this.extensionManagementServerService.localExtensionManagementServer&&t.push(this.extensionManagementServerService.localExtensionManagementServer),this.extensionManagementServerService.remoteExtensionManagementServer&&t.push(this.extensionManagementServerService.remoteExtensionManagementServer),this.extensionManagementServerService.webExtensionManagementServer&&t.push(this.extensionManagementServerService.webExtensionManagementServer);let o=(s,l)=>t.length>1?`${l.label} - ${s}`:s,n=U.None;if(this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer){let s=new Set;s.add("hasInstalledWebExtensions"),n=U.filter(this.contextKeyService.onDidChangeContext,l=>l.affectsSome(s))}let r=U.any(this.labelService.onDidChangeFormatters,n);for(let s of t){let l=()=>o(d(11748,null),s),c=U.map(r,()=>l()),u=t.length>1?`workbench.views.extensions.${s.id}.installed`:"workbench.views.extensions.installed";e.push({id:u,get name(){return{value:l(),original:o("Installed",s)}},weight:100,order:1,when:C.and(zx),ctorDescriptor:new Vt(Y3t,[{server:s,flexibleHeight:!0,onDidChangeTitle:c}]),canToggleVisibility:t.length===1}),s===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManagementServerService.localExtensionManagementServer&&this._register(W(class extends z{constructor(){super({id:"workbench.extensions.installLocalExtensions",get title(){return P(11763,"Install Local Extensions in '{0}'...",s.label)},category:hPo,icon:OIo,f1:!0,menu:{id:R.ViewTitle,when:C.equals("view",u),group:"navigation"}})}run(h){return h.get(F).createInstance(zNe).run()}}))}return this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer&&this._register(W(class extends z{constructor(){super({id:"workbench.extensions.actions.installLocalExtensionsInRemote",title:P(11747,"Install Remote Extensions Locally..."),category:hPo,f1:!0})}run(l){return l.get(F).createInstance(KNe,"workbench.extensions.actions.installLocalExtensionsInRemote").run()}})),e.push({id:"workbench.views.extensions.popular",name:P(11755,"Popular"),ctorDescriptor:new Vt(Q3t,[{hideBadge:!0}]),when:C.and(zx,C.not("hasInstalledExtensions"),og),weight:60,order:2,canToggleVisibility:!1}),e.push({id:"extensions.recommendedList",name:P(11757,"Recommended"),ctorDescriptor:new Vt(a8t,[{flexibleHeight:!0}]),when:C.and(zx,vPo.negate(),C.not("config.extensions.showRecommendationsOnlyOnDemand"),og),weight:40,order:3,canToggleVisibility:!0}),t.length===1&&(e.push({id:"workbench.views.extensions.enabled",name:P(11738,"Enabled"),ctorDescriptor:new Vt(X3t,[{}]),when:C.and(zx,C.has("hasInstalledExtensions")),hideByDefault:!0,weight:40,order:4,canToggleVisibility:!0}),e.push({id:"workbench.views.extensions.disabled",name:P(11736,"Disabled"),ctorDescriptor:new Vt(J3t,[{}]),when:C.and(zx,C.has("hasInstalledExtensions")),hideByDefault:!0,weight:10,order:5,canToggleVisibility:!0})),e}createSearchExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.marketplace",name:P(11752,"Marketplace"),ctorDescriptor:new Vt(s8t,[{}]),when:C.and(C.has("searchMarketplaceExtensions"),og)}),e.push({id:"workbench.views.extensions.searchInstalled",name:P(11749,"Installed"),ctorDescriptor:new Vt(Hr,[{}]),when:C.or(C.has("searchInstalledExtensions"),C.has("installedExtensions"))}),e.push({id:"workbench.views.extensions.searchRecentlyUpdated",name:P(11756,"Recently Updated"),ctorDescriptor:new Vt(e8t,[{}]),when:C.or(bBi,C.has("searchRecentlyUpdatedExtensions")),order:2}),e.push({id:"workbench.views.extensions.searchEnabled",name:P(11737,"Enabled"),ctorDescriptor:new Vt(Hr,[{}]),when:C.and(C.has("searchEnabledExtensions"))}),e.push({id:"workbench.views.extensions.searchDisabled",name:P(11735,"Disabled"),ctorDescriptor:new Vt(Hr,[{}]),when:C.and(C.has("searchDisabledExtensions"))}),e.push({id:UNt,name:P(11728,"Available Updates"),ctorDescriptor:new Vt(Z3t,[{}]),when:C.or(bBi,C.has("searchOutdatedExtensions")),order:1}),e.push({id:"workbench.views.extensions.searchBuiltin",name:P(11729,"Builtin"),ctorDescriptor:new Vt(Hr,[{}]),when:C.and(C.has("searchBuiltInExtensions"))}),e.push({id:"workbench.views.extensions.searchWorkspaceUnsupported",name:P(11774,"Workspace Unsupported"),ctorDescriptor:new Vt(Hr,[{}]),when:C.and(C.has("searchWorkspaceUnsupportedExtensions"))}),e}createRecommendedExtensionsViewDescriptors(){let e=[];return e.push({id:uRe,name:P(11773,"Workspace Recommendations"),ctorDescriptor:new Vt(c8t,[{}]),when:C.and(C.has("recommendedExtensions"),el.notEqualsTo("empty")),order:1}),e.push({id:"workbench.views.extensions.otherRecommendations",name:P(11754,"Other Recommendations"),ctorDescriptor:new Vt(l8t,[{}]),when:C.has("recommendedExtensions"),order:2}),e}createBuiltinExtensionsViewDescriptors(){let e=[],t=["themes","programming languages"],o=m0.filter(r=>!t.includes(r.toLowerCase()));o.push(vBi);let n=`${o.map(r=>`category:"${r}"`).join(" ")} ${t.map(r=>`category:"-${r}"`).join(" ")}`;return e.push({id:"workbench.views.extensions.builtinFeatureExtensions",name:P(11730,"Features"),ctorDescriptor:new Vt(Are,[{query:`@builtin ${n}`}]),when:C.has("builtInExtensions")}),e.push({id:"workbench.views.extensions.builtinThemeExtensions",name:P(11732,"Themes"),ctorDescriptor:new Vt(Are,[{query:"@builtin category:themes"}]),when:C.has("builtInExtensions")}),e.push({id:"workbench.views.extensions.builtinProgrammingLanguageExtensions",name:P(11731,"Programming Languages"),ctorDescriptor:new Vt(Are,[{query:'@builtin category:"programming languages"'}]),when:C.has("builtInExtensions")}),e}createUnsupportedWorkspaceExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.untrustedUnsupportedExtensions",name:P(11770,"Disabled in Restricted Mode"),ctorDescriptor:new Vt(t8t,[{}]),when:C.and(Gct)}),e.push({id:"workbench.views.extensions.untrustedPartiallySupportedExtensions",name:P(11769,"Limited in Restricted Mode"),ctorDescriptor:new Vt(i8t,[{}]),when:C.and(Gct)}),e.push({id:"workbench.views.extensions.virtualUnsupportedExtensions",name:P(11772,"Disabled in Virtual Workspaces"),ctorDescriptor:new Vt(o8t,[{}]),when:C.and(AM,Gct)}),e.push({id:"workbench.views.extensions.virtualPartiallySupportedExtensions",name:P(11771,"Limited in Virtual Workspaces"),ctorDescriptor:new Vt(n8t,[{}]),when:C.and(AM,Gct)}),e}createOtherLocalFilteredExtensionsViewDescriptors(){let e=[];return e.push({id:"workbench.views.extensions.deprecatedExtensions",name:P(11734,"Deprecated"),ctorDescriptor:new Vt(r8t,[{}]),when:C.and(gPo)}),e.push({id:"workbench.views.extensions.restartRequired",name:P(11760,"Restart Required"),ctorDescriptor:new Vt(Hr,[{}]),when:C.and(fPo)}),e}};KUe=I([m(0,$c),m(1,nt),m(2,X)],KUe);var GUe=class extends Qc{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M){super(Rh,{mergeViewWithContainerWhenSingleView:!0},n,g,e,S,t,y,h,f,v,w,M);this.progressService=o;this.editorGroupService=r;this.extensionsWorkbenchService=l;this.extensionManagementServerService=c;this.notificationService=u;this.paneCompositeService=p;this.contextKeyService=b;this.preferencesService=x;this.commandService=E;this.extensionGalleryManifest=null;this.notificationDisposables=this._register(new ue);this.searchDelayer=this._register(new rn(500)),this.extensionsSearchValueContextKey=CBi.bindTo(b),this.defaultViewsContextKey=zx.bindTo(b),this.sortByContextKey=SBi.bindTo(b),this.searchMarketplaceExtensionsContextKey=IBi.bindTo(b),this.searchMcpServersContextKey=CJe.bindTo(b),this.searchAgentPluginsContextKey=qNt.bindTo(b),this.searchHasTextContextKey=yBi.bindTo(b),this.sortByUpdateDateContextKey=vPo.bindTo(b),this.installedExtensionsContextKey=twn.bindTo(b),this.searchInstalledExtensionsContextKey=iwn.bindTo(b),this.searchRecentlyUpdatedExtensionsContextKey=own.bindTo(b),this.searchExtensionUpdatesContextKey=bBi.bindTo(b),this.searchWorkspaceUnsupportedExtensionsContextKey=Gct.bindTo(b),this.searchDeprecatedExtensionsContextKey=gPo.bindTo(b),this.searchRestartRequiredExtensionsContextKey=fPo.bindTo(b),this.searchOutdatedExtensionsContextKey=nwn.bindTo(b),this.searchEnabledExtensionsContextKey=rwn.bindTo(b),this.searchDisabledExtensionsContextKey=swn.bindTo(b),this.hasInstalledExtensionsContextKey=awn.bindTo(b),this.builtInExtensionsContextKey=Qbe.bindTo(b),this.searchBuiltInExtensionsContextKey=lwn.bindTo(b),this.recommendedExtensionsContextKey=wBi.bindTo(b),this._register(this.paneCompositeService.onDidPaneCompositeOpen(N=>{N.viewContainerLocation===0&&this.onViewletOpen(N.composite)},this)),this._register(l.onReset(()=>this.refresh())),this.searchViewletState=this.getMemento(1,1),s.getExtensionGalleryManifest().then(N=>{this.extensionGalleryManifest=N,this._register(s.onDidChangeExtensionGalleryManifest(V=>{this.extensionGalleryManifest=V,this.refresh()}))})}get searchValue(){return this.searchBox?.getValue()}create(e){e.classList.add("extensions-viewlet"),this.root=e;let t=D(this.root,_(".overlay")),o=this.getColor(p3)??"";t.style.backgroundColor=o,Wi(t),this.header=D(this.root,_(".header"));let n=d(11762,null),r=this.searchViewletState["query.value"]?this.searchViewletState["query.value"]:"",s=D(this.header,_(".extensions-search-container"));this.searchBox=this._register(this.instantiationService.createInstance(YN,`${Rh}.searchbox`,s,{triggerCharacters:["@"],sortKey:p=>p.indexOf(":")===-1?"a":/ext:/.test(p)||/id:/.test(p)||/tag:/.test(p)?"b":/sort:/.test(p)?"c":"d",provideResults:p=>W$.suggestions(p,this.extensionGalleryManifest)},n,"extensions:searchinput",{placeholderText:n,value:r})),this.notificationContainer=D(this.header,_(".notification-container.hidden",{tabindex:"0"})),this.renderNotificaiton(),this._register(this.extensionsWorkbenchService.onDidChangeExtensionsNotification(()=>this.renderNotificaiton())),this.updateInstalledExtensionsContexts(),this.searchBox.getValue()&&this.triggerSearch(),this._register(this.searchBox.onInputDidChange(()=>{this.sortByContextKey.set(W$.parse(this.searchBox?.getValue()??"").sortBy),this.triggerSearch()},this)),this._register(this.searchBox.onShouldFocusResults(()=>this.focusListView(),this));let l=D(s,_(".extensions-search-actions-container"));this._register(this.instantiationService.createInstance(pr,l,kJe,{toolbarOptions:{primaryGroup:()=>!0},actionViewItemProvider:(p,h)=>ta(this.instantiationService,p,h)})),this._register(new wg(this.root,{onDragEnter:p=>{this.isSupportedDragElement(p)&&Xo(t)},onDragLeave:p=>{this.isSupportedDragElement(p)&&Wi(t)},onDragOver:p=>{this.isSupportedDragElement(p)&&(p.dataTransfer.dropEffect="copy")},onDrop:async p=>{if(this.isSupportedDragElement(p)){Wi(t);let h=ui((await this.instantiationService.invokeFunction(g=>dxe(g,p))).map(g=>g.resource&&Ts(g.resource)===".vsix"?g.resource:void 0));if(h.length>0)try{await this.commandService.executeCommand(wJe,h)}catch(g){this.notificationService.error(g)}}}})),super.create(D(this.root,_(".extensions")));let c=this._register(nr(this.root)),u=()=>this.searchBox?.inputWidget.hasWidgetFocus();this._register(p_({name:"extensionsView",focusNotifiers:[c],focusNextWidget:()=>{u()&&this.focusListView()},focusPreviousWidget:()=>{u()||this.searchBox?.focus()}}))}focus(){super.focus(),this.searchBox?.focus()}layout(e){this._dimension=e,this.root&&(this.root.classList.toggle("narrow",e.width<=250),this.root.classList.toggle("mini",e.width<=200)),this.searchBox?.layout(new di(e.width-34-8-48,20));let t=41,o=this.header&&this.notificationContainer?.childNodes.length?this.notificationContainer.clientHeight+t+10:t;this.header.style.height=`${o}px`,super.layout(new di(e.width,e.height-o))}getOptimalWidth(){return 400}search(e){this.searchBox&&this.searchBox.getValue()!==e&&this.searchBox.setValue(e)}async refresh(){await this.updateInstalledExtensionsContexts(),this.doSearch(!0),this.configurationService.getValue(yJe)&&this.extensionsWorkbenchService.checkForUpdates()}renderNotificaiton(){if(!this.notificationContainer)return;St(this.notificationContainer),this.notificationDisposables.value=new O;let e=this.extensionsWorkbenchService.getExtensionsNotification(),t=e?.query??e?.extensions.map(o=>`@id:${o.identifier.id}`).join(" ");if(e&&(t===this.searchBox?.getValue()||!this.searchMarketplaceExtensionsContextKey.get())){this.notificationContainer.setAttribute("aria-label",e.message),this.notificationContainer.classList.remove("hidden");let o=D(this.notificationContainer,_(".message-container"));D(o,_("span")).className=eE.className(e.severity);let n=D(o,_("span.message-text"));D(n,_("span.message",void 0,e.message));let r=D(n,_("span.message-text-action",{tabindex:"0",role:"button","aria-label":`${e.message}. ${d(11733,null)}`},d(11764,null)));this.notificationDisposables.value.add($(r,ne.CLICK,()=>this.search(t??""))),this.notificationDisposables.value.add($(r,ne.KEY_DOWN,l=>{let c=new mi(l);(c.keyCode===3||c.keyCode===10)&&this.search(t??""),c.stopPropagation()}));let s=D(this.notificationContainer,_(".notification-actions"));if(e.action){let l=D(s,_("span.message-action-button",{tabindex:"0",role:"button","aria-label":e.action.label},e.action.label));this.notificationDisposables.value.add($(l,ne.CLICK,()=>{Promise.resolve(e.action.run()).catch(c=>this.notificationService.error(c))})),this.notificationDisposables.value.add($(l,ne.KEY_DOWN,c=>{let u=new mi(c);(u.keyCode===3||u.keyCode===10)&&Promise.resolve(e.action.run()).catch(p=>this.notificationService.error(p)),u.stopPropagation()}))}}else this.notificationContainer.removeAttribute("aria-label"),this.notificationContainer.classList.add("hidden"),this.searchBox&&Hr.isRestartRequiredQuery(this.searchBox.getValue())&&this.search("");this._dimension&&this.layout(this._dimension)}async updateInstalledExtensionsContexts(){let e=await this.extensionsWorkbenchService.queryLocal();this.hasInstalledExtensionsContextKey.set(e.some(t=>!t.isBuiltin))}triggerSearch(){this.searchDelayer.trigger(()=>this.doSearch(),this.searchBox&&this.searchBox.getValue()?500:0).then(void 0,e=>this.onError(e))}normalizedQuery(){return this.searchBox?this.searchBox.getValue().trim().replace(/@category/g,"category").replace(/@tag:/g,"tag:").replace(/@ext:/g,"ext:").replace(/@featured/g,"featured").replace(/@popular/g,this.extensionManagementServerService.webExtensionManagementServer&&!this.extensionManagementServerService.localExtensionManagementServer&&!this.extensionManagementServerService.remoteExtensionManagementServer?"@web":"@popular"):""}saveState(){let e=this.searchBox?this.searchBox.getValue():"";Hr.isLocalExtensionsQuery(e)?this.searchViewletState["query.value"]=e:this.searchViewletState["query.value"]="",super.saveState()}doSearch(e){let t=this.normalizedQuery();return this.contextKeyService.bufferChangeEvents(()=>{let o=Hr.isRecommendedExtensionsQuery(t);this.searchHasTextContextKey.set(t.trim()!==""),this.extensionsSearchValueContextKey.set(t),this.installedExtensionsContextKey.set(Hr.isInstalledExtensionsQuery(t)),this.searchInstalledExtensionsContextKey.set(Hr.isSearchInstalledExtensionsQuery(t)),this.searchRecentlyUpdatedExtensionsContextKey.set(Hr.isSearchRecentlyUpdatedQuery(t)&&!Hr.isSearchExtensionUpdatesQuery(t)),this.searchOutdatedExtensionsContextKey.set(Hr.isOutdatedExtensionsQuery(t)&&!Hr.isSearchExtensionUpdatesQuery(t)),this.searchExtensionUpdatesContextKey.set(Hr.isSearchExtensionUpdatesQuery(t)),this.searchEnabledExtensionsContextKey.set(Hr.isEnabledExtensionsQuery(t)),this.searchDisabledExtensionsContextKey.set(Hr.isDisabledExtensionsQuery(t)),this.searchBuiltInExtensionsContextKey.set(Hr.isSearchBuiltInExtensionsQuery(t)),this.searchWorkspaceUnsupportedExtensionsContextKey.set(Hr.isSearchWorkspaceUnsupportedExtensionsQuery(t)),this.searchDeprecatedExtensionsContextKey.set(Hr.isSearchDeprecatedExtensionsQuery(t)),this.searchRestartRequiredExtensionsContextKey.set(Hr.isRestartRequiredQuery(t)),this.builtInExtensionsContextKey.set(Hr.isBuiltInExtensionsQuery(t)),this.recommendedExtensionsContextKey.set(o),this.searchMcpServersContextKey.set(!!t&&/@mcp\s?.*/i.test(t)),this.searchAgentPluginsContextKey.set(!!t&&/@agentPlugins\s?.*/i.test(t)),this.searchMarketplaceExtensionsContextKey.set(!!t&&!Hr.isLocalExtensionsQuery(t)&&!o&&!this.searchMcpServersContextKey.get()&&!this.searchAgentPluginsContextKey.get()),this.sortByUpdateDateContextKey.set(Hr.isSortUpdateDateQuery(t)),this.defaultViewsContextKey.set(!t||Hr.isSortInstalledExtensionsQuery(t))}),this.renderNotificaiton(),this.showExtensionsViews(this.panes)}onDidAddViewDescriptors(e){let t=super.onDidAddViewDescriptors(e);return this.showExtensionsViews(t),t}async showExtensionsViews(e){await this.progress(Promise.all(e.map(async t=>{if(t instanceof L9){let o=await t.show(this.normalizedQuery());this.alertSearchResult(o.length,t.id)}})))}alertSearchResult(e,t){let o=this.viewContainerModel.visibleViewDescriptors.find(n=>n.id===t);switch(e){case 0:break;case 1:o?cn(d(11740,null,o.name.value)):cn(d(11739,null));break;default:o?cn(d(11742,null,e,o.name.value)):cn(d(11741,null,e));break}}getFirstExpandedPane(){for(let e of this.panes)if(e.isExpanded()&&e instanceof Hr)return e}focusListView(){let e=this.getFirstExpandedPane();e&&e.count()>0&&e.focus()}onViewletOpen(e){if(!(!e||e.getId()===Rh)&&this.configurationService.getValue(Ido)){let t=this.editorGroupService.groups.map(o=>{let n=o.editors.filter(r=>r instanceof V$);return o.closeEditors(n)});Promise.all(t)}}progress(e){return this.progressService.withProgress({location:5},()=>e)}onError(e){if(Yi(e))return;let t=e&&e.message||"";if(/ECONNREFUSED/.test(t)){let o=Rz(d(11768,null),[new it("open user settings",d(11753,null),void 0,!0,()=>this.preferencesService.openUserSettings())]);this.notificationService.error(o);return}this.notificationService.error(e)}isSupportedDragElement(e){return e.dataTransfer?e.dataTransfer.types.map(o=>o.toLocaleLowerCase()).indexOf("files")!==-1:!1}};GUe=I([m(0,wi),m(1,_e),m(2,Go),m(3,F),m(4,kt),m(5,tb),m(6,Ui),m(7,$c),m(8,Ne),m(9,Es),m(10,Pe),m(11,B),m(12,de),m(13,Ae),m(14,X),m(15,Xe),m(16,lt),m(17,ji),m(18,Qo),m(19,fe),m(20,re)],GUe);var qUe=class extends k{constructor(e,t,o,n){super();this.activityService=e;this.extensionsWorkbenchService=t;this.extensionEnablementService=o;this.configurationService=n;this.badgeHandle=this._register(new ue);this.onServiceChange(),this._register(U.any(U.debounce(t.onChange,()=>{},100,void 0,void 0,void 0,this._store),t.onDidChangeExtensionsNotification)(this.onServiceChange,this))}onServiceChange(){this.badgeHandle.clear();let e,t=this.extensionsWorkbenchService.getExtensionsNotification();if(t&&t.severity===wt.Warning&&(e=new pet(()=>t.message)),!e){let o=this.configurationService.getValue(UH)===!0?[]:this.extensionsWorkbenchService.installed.filter(s=>s.runtimeState!==void 0),n=this.extensionsWorkbenchService.outdated.reduce((s,l)=>s+(this.extensionEnablementService.isEnabled(l.local)&&!o.includes(l)?1:0),0),r=n+o.length;if(r>0){let s="";n&&(s+=n===1?d(11746,null,n):d(11744,null,n)),n>0&&o.length>0&&(s+=", "),o.length&&(s+=o.length===1?d(11745,null,o.length):d(11743,null,o.length)),e=new eu(r,()=>s)}}e&&(this.badgeHandle.value=this.activityService.showViewContainerActivity(Rh,{badge:e}))}};qUe=I([m(0,Al),m(1,Ui),m(2,As),m(3,B)],qUe);var $Ue=class{constructor(i,e,t,o,n,r){this.extensionsManagementService=i;this.extensionsWorkbenchService=e;this.hostService=t;this.logService=o;this.notificationService=n;this.commandService=r;this.loopCheckForMaliciousExtensions()}loopCheckForMaliciousExtensions(){this.checkForMaliciousExtensions().then(()=>Li(1e3*60*5)).then(()=>this.loopCheckForMaliciousExtensions())}async checkForMaliciousExtensions(){try{let i=[],e=!1,t=!1;for(let o of this.extensionsWorkbenchService.installed)o.isMalicious&&o.local&&(i.push([o.local,o.maliciousInfoLink]),e=e||o.runtimeState?.action==="restartExtensions",t=t||o.runtimeState?.action==="reloadWindow");if(i.length){await this.extensionsManagementService.uninstallExtensions(i.map(o=>({extension:o[0],options:{remove:!0}})));for(let[o,n]of i){let r=[];(e||t)&&r.push({label:e?d(11761,null):d(11758,null),run:()=>e?this.extensionsWorkbenchService.updateRunningExtensions():this.hostService.reload()}),n&&r.push({label:d(11750,null),run:()=>this.commandService.executeCommand("vscode.open",A.parse(n))}),this.notificationService.prompt(wt.Warning,d(11751,null,o.manifest.displayName||o.identifier.id),r,{sticky:!0,priority:3})}}}catch(i){this.logService.error(i)}}};$Ue=I([m(0,xs),m(1,Ui),m(2,ti),m(3,re),m(4,Ne),m(5,fe)],$Ue);var jUe=class extends k{constructor(e,t){super();this.activityService=e;this.extensionGalleryManifestService=t;this.badgeHandle=this._register(new ue);this.accountBadgeDisposable=this._register(new ue);this.updateBadge(),this._register(this.extensionGalleryManifestService.onDidChangeExtensionGalleryManifestStatus(()=>this.updateBadge()))}async updateBadge(){this.badgeHandle.clear();let e=this.extensionGalleryManifestService.extensionGalleryManifestStatus,t;switch(e){case"requiresSignIn":t=new eu(1,()=>d(11767,null));break;case"accessDenied":t=new pet(()=>d(11727,null));break}if(t&&(this.badgeHandle.value=this.activityService.showViewContainerActivity(Rh,{badge:t})),this.accountBadgeDisposable.clear(),e==="requiresSignIn"){let o=new eu(1,()=>d(11766,null));this.accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:o})}}};jUe=I([m(0,Al),m(1,tb)],jUe);var BV=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.stateProvider=i;this.runtimeStateProvider=e;this.server=t;this.local=o;this._gallery=n;this.resourceExtensionInfo=r;this.galleryService=s;this.telemetryService=l;this.logService=c;this.fileService=u;this.productService=p;this.enablementState=12;this.galleryResourcesCache=new Map}get resourceExtension(){if(this.resourceExtensionInfo)return this.resourceExtensionInfo.resourceExtension;if(this.local?.isWorkspaceScoped)return{type:"resource",identifier:this.local.identifier,location:this.local.location,manifest:this.local.manifest,changelogUri:this.local.changelogUrl,readmeUri:this.local.readmeUrl}}get gallery(){return this._gallery}set gallery(i){this._gallery=i,this.galleryResourcesCache.clear()}get missingFromGallery(){return!!this._missingFromGallery}set missingFromGallery(i){this._missingFromGallery=i}get type(){return this.local?this.local.type:1}get isBuiltin(){return this.local?this.local.isBuiltin:!1}get isWorkspaceScoped(){return this.local?this.local.isWorkspaceScoped:this.resourceExtensionInfo?this.resourceExtensionInfo.isWorkspaceScoped:!1}get name(){return this.gallery?this.gallery.name:this.getManifestFromLocalOrResource()?.name??""}get displayName(){return this.gallery?this.gallery.displayName||this.gallery.name:this.getManifestFromLocalOrResource()?.displayName??this.name}get identifier(){return this.gallery?this.gallery.identifier:this.resourceExtension?this.resourceExtension.identifier:this.local?.identifier??{id:""}}get uuid(){return this.gallery?this.gallery.identifier.uuid:this.local?.identifier.uuid}get publisher(){return this.gallery?this.gallery.publisher:this.getManifestFromLocalOrResource()?.publisher??""}get publisherDisplayName(){return this.gallery?this.gallery.publisherDisplayName||this.gallery.publisher:this.local?.publisherDisplayName?this.local.publisherDisplayName:this.publisher}get publisherUrl(){return this.gallery?.publisherLink?A.parse(this.gallery.publisherLink):void 0}get publisherDomain(){return this.gallery?.publisherDomain}get publisherSponsorLink(){return this.gallery?.publisherSponsorLink?A.parse(this.gallery.publisherSponsorLink):void 0}get version(){return this.local?this.local.manifest.version:this.latestVersion}get private(){return this.gallery?this.gallery.private:this.local?this.local.private:!1}get pinned(){return!!this.local?.pinned}get latestVersion(){return this.gallery?this.gallery.version:this.getManifestFromLocalOrResource()?.version??""}get description(){return this.gallery?this.gallery.description:this.getManifestFromLocalOrResource()?.description??""}get url(){return this.gallery?.detailsLink}get iconUrl(){return this.galleryIconUrl||this.resourceExtensionIconUrl||this.localIconUrl||this.defaultIconUrl}get iconUrlFallback(){return this.gallery?.assets.icon?.fallbackUri}get localIconUrl(){if(this.local&&this.local.manifest.icon)return In.uriToBrowserUri(Ve(this.local.location,this.local.manifest.icon)).toString(!0)}get resourceExtensionIconUrl(){if(this.resourceExtension?.manifest.icon)return In.uriToBrowserUri(Ve(this.resourceExtension.location,this.resourceExtension.manifest.icon)).toString(!0)}get galleryIconUrl(){return this.gallery?.assets.icon?.uri}get defaultIconUrl(){if(this.type===0&&this.local&&this.local.manifest&&this.local.manifest.contributes){if(Array.isArray(this.local.manifest.contributes.themes)&&this.local.manifest.contributes.themes.length)return In.asBrowserUri("vs/workbench/contrib/extensions/browser/media/theme-icon.png").toString(!0);if(Array.isArray(this.local.manifest.contributes.grammars)&&this.local.manifest.contributes.grammars.length)return In.asBrowserUri("vs/workbench/contrib/extensions/browser/media/language-icon.svg").toString(!0)}}get repository(){return this.gallery&&this.gallery.assets.repository?this.gallery.assets.repository.uri:void 0}get licenseUrl(){return this.gallery&&this.gallery.assets.license?this.gallery.assets.license.uri:void 0}get supportUrl(){return this.gallery&&this.gallery.supportLink?this.gallery.supportLink:void 0}get state(){return this.stateProvider(this)}get isMalicious(){return!!this.malicious||this.enablementState===4}get maliciousInfoLink(){return this.malicious?.learnMoreLink}get installCount(){return this.gallery?this.gallery.installCount:void 0}get rating(){return this.gallery?this.gallery.rating:void 0}get ratingCount(){return this.gallery?this.gallery.ratingCount:void 0}get ratingUrl(){return this.gallery?.ratingLink}get outdated(){try{if(!this.gallery||!this.local||this.type===0&&this.productService.quality==="stable"&&!this.productService.builtInExtensionsEnabledWithAutoUpdates?.some(i=>i.toLowerCase()===this.identifier.id.toLowerCase())||!this.local.preRelease&&this.gallery.properties.isPreReleaseVersion)return!1;if(BM(this.latestVersion,this.version)||this.outdatedTargetPlatform)return!0}catch{}return!1}get outdatedTargetPlatform(){return!!this.local&&!!this.gallery&&!["undefined","web"].includes(this.local.targetPlatform)&&this.gallery.properties.targetPlatform!=="web"&&this.local.targetPlatform!==this.gallery.properties.targetPlatform&&pAt(this.latestVersion,this.version)}get runtimeState(){return this.runtimeStateProvider(this)}get telemetryData(){let{local:i,gallery:e}=this;return e?tpe(e):i?qRt(i):{}}get preview(){return this.local?.manifest.preview??this.gallery?.preview??!1}get preRelease(){return!!this.local?.preRelease}get isPreReleaseVersion(){return this.local?this.local.isPreReleaseVersion:!!this.gallery?.properties.isPreReleaseVersion}get hasPreReleaseVersion(){return this.gallery?this.gallery.hasPreReleaseVersion:!!this.local?.hasPreReleaseVersion}get hasReleaseVersion(){return!!this.resourceExtension||!!this.gallery?.hasReleaseVersion}getLocal(){return this.local&&!this.outdated?this.local:void 0}async getManifest(i){let e=this.getLocal();return e?e.manifest:this.gallery?this.getGalleryManifest(i):this.resourceExtension?this.resourceExtension.manifest:null}async getGalleryManifest(i=Ie.None){if(this.gallery){let e=this.galleryResourcesCache.get("manifest");return e||(this.gallery.assets.manifest?this.galleryResourcesCache.set("manifest",e=this.galleryService.getManifest(this.gallery,i).catch(t=>{throw this.galleryResourcesCache.delete("manifest"),t})):this.logService.error(d(11849,null),this.identifier.id)),e}return null}hasReadme(){return this.local&&this.local.readmeUrl||this.gallery&&this.gallery.assets.readme||this.resourceExtension?.readmeUri?!0:this.type===0}async getReadme(i){let e=this.getLocal();if(e?.readmeUrl)return(await this.fileService.readFile(e.readmeUrl)).value.toString();if(this.gallery){if(this.gallery.assets.readme)return this.galleryService.getReadme(this.gallery,i);this.telemetryService.publicLog("extensions:NotFoundReadMe",this.telemetryData)}return this.type===0?Promise.resolve(`# ${this.displayName||this.name}
**Notice:** This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
## Features
${this.description}
`):this.resourceExtension?.readmeUri?(await this.fileService.readFile(this.resourceExtension?.readmeUri)).value.toString():Promise.reject(new Error("not available"))}hasChangelog(){return this.local&&this.local.changelogUrl||this.gallery&&this.gallery.assets.changelog?!0:this.type===0}async getChangelog(i){let e=this.getLocal();return e?.changelogUrl?(await this.fileService.readFile(e.changelogUrl)).value.toString():this.gallery?.assets.changelog?this.galleryService.getChangelog(this.gallery,i):this.type===0?Promise.resolve(`Please check the [VS Code Release Notes](command:${B$}) for changes to the built-in extensions.`):Promise.reject(new Error("not available"))}get categories(){let{local:i,gallery:e,resourceExtension:t}=this;return i&&i.manifest.categories&&!this.outdated?i.manifest.categories:e?e.categories:t?t.manifest.categories??[]:[]}get tags(){let{gallery:i}=this;return i?i.tags.filter(e=>!e.startsWith("_")):[]}get dependencies(){let{local:i,gallery:e,resourceExtension:t}=this;return i&&i.manifest.extensionDependencies&&!this.outdated?i.manifest.extensionDependencies:e?e.properties.dependencies||[]:t?t.manifest.extensionDependencies||[]:[]}get extensionPack(){let{local:i,gallery:e,resourceExtension:t}=this;return i&&i.manifest.extensionPack&&!this.outdated?i.manifest.extensionPack:e?e.properties.extensionPack||[]:t?t.manifest.extensionPack||[]:[]}setExtensionsControlManifest(i){this.malicious=gbi(this.identifier,i.malicious),this.deprecationInfo=i.deprecated?i.deprecated[this.identifier.id.toLowerCase()]:void 0}getManifestFromLocalOrResource(){return this.local?this.local.manifest:this.resourceExtension?this.resourceExtension.manifest:null}};BV=I([m(6,ga),m(7,_e),m(8,re),m(9,ge),m(10,Ze)],BV);var xBi="extensions.autoUpdate",kBi="extensions.donotAutoUpdate",EBi="extensions.dismissedNotifications",Ybe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.server=e;this.stateProvider=t;this.runtimeStateProvider=o;this.isWorkspaceServer=n;this.galleryService=r;this.extensionEnablementService=s;this.workbenchExtensionManagementService=l;this.telemetryService=c;this.instantiationService=u;this._onChange=this._register(new T);this._onReset=this._register(new T);this.installing=[];this.uninstalling=[];this.installed=[];this._register(e.extensionManagementService.onInstallExtension(p=>this.onInstallExtension(p))),this._register(e.extensionManagementService.onDidInstallExtensions(p=>this.onDidInstallExtensions(p))),this._register(e.extensionManagementService.onUninstallExtension(p=>this.onUninstallExtension(p.identifier))),this._register(e.extensionManagementService.onDidUninstallExtension(p=>this.onDidUninstallExtension(p))),this._register(e.extensionManagementService.onDidUpdateExtensionMetadata(p=>this.onDidUpdateExtensionMetadata(p.local))),this._register(e.extensionManagementService.onDidChangeProfile(()=>this.reset())),this._register(s.onEnablementChanged(p=>this.onEnablementChanged(p))),this._register(U.any(this.onChange,this.onReset)(()=>this._local=void 0)),this.isWorkspaceServer&&(this._register(this.workbenchExtensionManagementService.onInstallExtension(p=>{p.workspaceScoped&&this.onInstallExtension(p)})),this._register(this.workbenchExtensionManagementService.onDidInstallExtensions(p=>{let h=p.filter(g=>g.workspaceScoped);h.length&&this.onDidInstallExtensions(h)})),this._register(this.workbenchExtensionManagementService.onUninstallExtension(p=>{p.workspaceScoped&&this.onUninstallExtension(p.identifier)})),this._register(this.workbenchExtensionManagementService.onDidUninstallExtension(p=>{p.workspaceScoped&&this.onDidUninstallExtension(p)})))}get onChange(){return this._onChange.event}get onReset(){return this._onReset.event}get local(){if(!this._local){this._local=[];for(let e of this.installed)this._local.push(e);for(let e of this.installing)this.installed.some(t=>Ht(t.identifier,e.identifier))||this._local.push(e)}return this._local}async queryInstalled(e){return await this.fetchInstalledExtensions(e),this._onChange.fire(void 0),this.local}async syncInstalledExtensionsWithGallery(e,t,o){let n=await this.mapInstalledExtensionWithCompatibleGalleryExtension(e,t);for(let[r,s]of n)r.local&&r.local.type!==0&&!r.local.identifier.uuid&&(r.local=await this.updateMetadata(r.local,s)),(!r.gallery||r.gallery.version!==s.version||r.gallery.properties.targetPlatform!==s.properties.targetPlatform)&&(r.gallery=s,this._onChange.fire({extension:r}));if(o){let r=[];for(let s of this.local)s.gallery||s.missingFromGallery||s.identifier.uuid&&o.some(l=>Ht(l,s.identifier))&&r.push(s);if(r.length){let s=await this.galleryService.getExtensions(r.map(u=>({...u.identifier,version:u.version})),Ie.None),l=[],c=[];for(let u of r){l.push(u.identifier.id);let p=s.find(h=>Ht(h.identifier,u.identifier));p?u.gallery=p:(u.missingFromGallery=!0,c.push(u.identifier.id)),this._onChange.fire({extension:u})}this.telemetryService.publicLog2("extensions:missingFromGallery",{queriedIds:new lh(l.join(";")),missingIds:new lh(c.join(";"))})}}}async mapInstalledExtensionWithCompatibleGalleryExtension(e,t){let o=this.mapInstalledExtensionWithGalleryExtension(e),n=await this.server.extensionManagementService.getTargetPlatform(),r=[],s=[];if(await Promise.allSettled(o.map(async([l,c])=>{l.local&&(await this.galleryService.isExtensionCompatible(c,l.local.preRelease,n,t)?r.push(c):s.push({...l.local.identifier,preRelease:l.local.preRelease}))})),s.length){let l=await this.galleryService.getExtensions(s,{targetPlatform:n,compatible:!0,queryAllVersions:!0,productVersion:t},Ie.None);r.push(...l)}return this.mapInstalledExtensionWithGalleryExtension(r)}mapInstalledExtensionWithGalleryExtension(e){let t=[],o=new Map,n=new Map;for(let r of e)o.set(r.identifier.uuid,r),n.set(r.identifier.id.toLowerCase(),r);for(let r of this.installed){if(r.uuid){let s=o.get(r.uuid);if(s){t.push([r,s]);continue}}if(r.local?.source!=="resource"){let s=n.get(r.identifier.id.toLowerCase());s&&t.push([r,s])}}return t}async updateMetadata(e,t){let o=!1;return e.manifest.version!==t.version&&(this.telemetryService.publicLog2("galleryService:updateMetadata"),o=!!(await this.galleryService.getExtensions([{...e.identifier,version:e.manifest.version}],Ie.None))[0]?.properties?.isPreReleaseVersion),this.workbenchExtensionManagementService.updateMetadata(e,{id:t.identifier.uuid,publisherDisplayName:t.publisherDisplayName,publisherId:t.publisherId,isPreReleaseVersion:o})}canInstall(e){return this.server.extensionManagementService.canInstall(e)}onInstallExtension(e){let{source:t}=e;if(t&&!A.isUri(t)){let o=this.installed.find(n=>Ht(n.identifier,t.identifier))??this.instantiationService.createInstance(BV,this.stateProvider,this.runtimeStateProvider,this.server,void 0,t,void 0);this.installing.push(o),this._onChange.fire({extension:o})}}async fetchInstalledExtensions(e){let t=await this.server.extensionManagementService.getExtensionsControlManifest(),o=await this.server.extensionManagementService.getInstalled(void 0,void 0,e);this.isWorkspaceServer&&o.push(...await this.workbenchExtensionManagementService.getInstalledWorkspaceExtensions(!0));let n=hbi(o,s=>s.identifier).reduce((s,l)=>{if(l.length===1)s.push(l[0]);else{let c,u,p;for(let g of l)g.isWorkspaceScoped?c=g:g.type===1?u=g:p=g;let h=c??u??p;h&&s.push(h)}return s},[]),r=oY(this.installed,s=>s.local?s.local.identifier.id:s.identifier.id);this.installed=n.map(s=>{let l=r[s.identifier.id]||this.instantiationService.createInstance(BV,this.stateProvider,this.runtimeStateProvider,this.server,s,void 0,void 0);return l.local=s,l.enablementState=this.extensionEnablementService.getEnablementState(s),l.setExtensionsControlManifest(t),l})}async reset(){this.installed=[],this.installing=[],this.uninstalling=[],await this.fetchInstalledExtensions(),this._onReset.fire()}async onDidInstallExtensions(e){let t=[];for(let o of e){let{local:n,source:r}=o,s=r&&!A.isUri(r)?r:void 0,l=r&&A.isUri(r)?r:void 0,c=s?this.installing.filter(p=>Ht(p.identifier,s.identifier))[0]:null;this.installing=c?this.installing.filter(p=>p!==c):this.installing;let u=c||(l||n?this.instantiationService.createInstance(BV,this.stateProvider,this.runtimeStateProvider,this.server,n,void 0,void 0):void 0);if(u){if(n){let p=this.installed.filter(h=>Ht(h.identifier,u.identifier))[0];p?u=p:this.installed.push(u),u.local=n,u.gallery||(u.gallery=s),u.enablementState=this.extensionEnablementService.getEnablementState(n)}t.push(u)}this._onChange.fire(!n||!u?void 0:{extension:u,operation:o.operation})}if(t.length){let o=await this.server.extensionManagementService.getExtensionsControlManifest();for(let n of t)n.setExtensionsControlManifest(o);this.matchInstalledExtensionsWithGallery(t)}}async onDidUpdateExtensionMetadata(e){let t=this.installed.find(o=>Ht(o.identifier,e.identifier));t?.local&&(t.local=e,this._onChange.fire({extension:t}))}async matchInstalledExtensionsWithGallery(e){let t=e.filter(n=>n.local&&!n.gallery&&n.local.source!=="resource");if(!t.length||!this.galleryService.isEnabled())return;let o=await this.galleryService.getExtensions(t.map(n=>({...n.identifier,preRelease:n.local?.preRelease})),{compatible:!0,targetPlatform:await this.server.extensionManagementService.getTargetPlatform()},Ie.None);for(let n of e){let r=o.find(s=>Ht(s.identifier,n.identifier));r&&(n.gallery=r,this._onChange.fire({extension:n}))}}onUninstallExtension(e){let t=this.installed.filter(o=>Ht(o.identifier,e))[0];if(t){let o=this.uninstalling.filter(n=>Ht(n.identifier,e))[0]||t;this.uninstalling=[o,...this.uninstalling.filter(n=>!Ht(n.identifier,e))],this._onChange.fire(o?{extension:o}:void 0)}}onDidUninstallExtension({identifier:e,error:t}){let o=this.uninstalling.find(n=>Ht(n.identifier,e))||this.installed.find(n=>Ht(n.identifier,e));this.uninstalling=this.uninstalling.filter(n=>!Ht(n.identifier,e)),t||(this.installed=this.installed.filter(n=>!Ht(n.identifier,e))),o&&this._onChange.fire({extension:o})}onEnablementChanged(e){let t=this.local.filter(o=>e.some(n=>Ht(o.identifier,n.identifier)));for(let o of t)if(o.local){let n=this.extensionEnablementService.getEnablementState(o.local);n!==o.enablementState&&(o.enablementState=n,this._onChange.fire({extension:o}))}}getExtensionState(e){return e.gallery&&this.installing.some(o=>!!o.gallery&&Ht(o.gallery.identifier,e.gallery.identifier))?0:this.uninstalling.some(o=>Ht(o.identifier,e.identifier))?2:this.installed.filter(o=>o===e||o.gallery&&e.gallery&&Ht(o.gallery.identifier,e.gallery.identifier))[0]?1:3}};Ybe=I([m(4,ga),m(5,As),m(6,Dd),m(7,_e),m(8,F)],Ybe);var M9=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce,Se,Re,xe,He,Ee,Te,It){super();this.instantiationService=e;this.editorService=t;this.extensionManagementService=o;this.galleryService=n;this.extensionGalleryManifestService=r;this.configurationService=s;this.telemetryService=l;this.notificationService=c;this.extensionEnablementService=p;this.hostService=h;this.progressService=g;this.extensionManagementServerService=f;this.languageService=v;this.extensionsSyncManagementService=b;this.userDataAutoSyncService=S;this.productService=y;this.extensionManifestPropertiesService=x;this.logService=E;this.extensionService=M;this.localeService=N;this.lifecycleService=V;this.fileService=H;this.userDataProfileService=K;this.userDataProfilesService=j;this.storageService=J;this.dialogService=se;this.userDataSyncEnablementService=ae;this.updateService=ce;this.uriIdentityService=Se;this.workspaceContextService=Re;this.viewsService=xe;this.fileDialogService=He;this.quickInputService=Ee;this.allowedExtensionsService=Te;this.meteredConnectionService=It;this.localExtensions=null;this.remoteExtensions=null;this.webExtensions=null;this.extensionsServers=[];this._onChange=this._register(new T);this._onDidChangeExtensionsNotification=this._register(new T);this.onDidChangeExtensionsNotification=this._onDidChangeExtensionsNotification.event;this._onReset=this._register(new T);this.installing=[];this.tasksInProgress=[];this.autoRestartListenerDisposable=this._register(new ue);this.hasOutdatedExtensionsContextKey=GNt.bindTo(w),f.localExtensionManagementServer&&(this.localExtensions=this._register(e.createInstance(Ybe,f.localExtensionManagementServer,tt=>this.getExtensionState(tt),tt=>this.getRuntimeState(tt),!f.remoteExtensionManagementServer)),this._register(this.localExtensions.onChange(tt=>this.onDidChangeExtensions(tt?.extension))),this._register(this.localExtensions.onReset(tt=>this.reset())),this.extensionsServers.push(this.localExtensions)),f.remoteExtensionManagementServer&&(this.remoteExtensions=this._register(e.createInstance(Ybe,f.remoteExtensionManagementServer,tt=>this.getExtensionState(tt),tt=>this.getRuntimeState(tt),!0)),this._register(this.remoteExtensions.onChange(tt=>this.onDidChangeExtensions(tt?.extension))),this._register(this.remoteExtensions.onReset(tt=>this.reset())),this.extensionsServers.push(this.remoteExtensions)),f.webExtensionManagementServer&&(this.webExtensions=this._register(e.createInstance(Ybe,f.webExtensionManagementServer,tt=>this.getExtensionState(tt),tt=>this.getRuntimeState(tt),!(f.remoteExtensionManagementServer||f.localExtensionManagementServer))),this._register(this.webExtensions.onChange(tt=>this.onDidChangeExtensions(tt?.extension))),this._register(this.webExtensions.onReset(tt=>this.reset())),this.extensionsServers.push(this.webExtensions)),this.updatesCheckDelayer=new Aa(M9.UpdatesCheckInterval),this.autoUpdateDelayer=new Aa(1e3),this._register(ee(()=>{this.updatesCheckDelayer.cancel(),this.autoUpdateDelayer.cancel()})),u.registerHandler(this),this.whenInitialized=this.initialize()}static{this.UpdatesCheckInterval=1e3*60*60*12}get onChange(){return this._onChange.event}get onReset(){return this._onReset.event}async initialize(){await Promise.all([this.queryLocal(),this.extensionService.whenInstalledExtensionsRegistered()]),!this._store.isDisposed&&(this.onDidChangeRunningExtensions(this.extensionService.extensions,[]),this._register(this.extensionService.onDidChangeExtensions(({added:e,removed:t})=>this.onDidChangeRunningExtensions(e,t))),await this.lifecycleService.when(4),!this._store.isDisposed&&(this.initializeAutoUpdate(),this.updateExtensionsNotificaiton(),this.reportInstalledExtensionsTelemetry(),this._register(this.storageService.onDidChangeValue(0,EBi,this._store)(e=>this.onDidDismissedNotificationsValueChange())),this._register(this.storageService.onDidChangeValue(-1,xBi,this._store)(e=>this.onDidSelectedExtensionToAutoUpdateValueChange())),this._register(this.storageService.onDidChangeValue(-1,kBi,this._store)(e=>this.onDidSelectedExtensionToAutoUpdateValueChange())),this._register(U.debounce(this.onChange,()=>{},100)(()=>{this.updateExtensionsNotificaiton(),this.reportProgressFromOtherSources()}))))}initializeAutoUpdate(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(JI)&&this.isAutoUpdateEnabled()&&this.eventuallyAutoUpdateExtensions(),e.affectsConfiguration(yJe)&&this.isAutoCheckUpdatesEnabled()&&this.checkForUpdates("Enabled auto check updates")})),this._register(this.extensionEnablementService.onEnablementChanged(e=>{this.isAutoCheckUpdatesEnabled()&&this.getAutoUpdateValue()==="onlyEnabledExtensions"&&e.some(t=>this.extensionEnablementService.isEnabled(t))&&this.checkForUpdates("Extension enablement changed")})),this._register(U.debounce(this.onChange,()=>{},100)(()=>this.hasOutdatedExtensionsContextKey.set(this.outdated.length>0))),this._register(this.updateService.onStateChange(e=>{(e.type==="checking for updates"&&e.explicit||e.type==="available for download"||e.type==="downloaded")&&(this.telemetryService.publicLog2("extensions:updatecheckonproductupdate"),this.isAutoCheckUpdatesEnabled()&&this.checkForUpdates("Product update"))})),this._register(this.allowedExtensionsService.onDidChangeAllowedExtensionsConfigValue(()=>{this.isAutoCheckUpdatesEnabled()&&this.checkForUpdates("Allowed extensions changed")})),this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(()=>{this.isAutoCheckUpdatesEnabled()&&this.checkForUpdates("Connection is no longer metered"),Ft&&!this.isAutoUpdateEnabled()&&this.autoUpdateBuiltinExtensions()})),this.hasOutdatedExtensionsContextKey.set(this.outdated.length>0),this.eventuallyCheckForUpdates(!0),Ft&&(this.syncPinnedBuiltinExtensions(),this.isAutoUpdateEnabled()||this.autoUpdateBuiltinExtensions()),this.registerAutoRestartListener(),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(UH)&&this.registerAutoRestartListener()}))}isAutoUpdateEnabled(){return this.meteredConnectionService.isConnectionMetered?!1:this.getAutoUpdateValue()!==!1}getAutoUpdateValue(){let e=this.configurationService.getValue(JI);return e==="onlySelectedExtensions"?!1:Xa(e)||e==="onlyEnabledExtensions"?e:!0}async updateAutoUpdateForAllExtensions(e){this.isAutoUpdateEnabled()===e||!(await this.dialogService.confirm({title:d(11813,null),message:e?d(11812,null):d(11811,null),detail:d(11814,null)})).confirmed||(this.setEnabledAutoUpdateExtensions([]),await this.configurationService.updateValue(JI,e),this.setDisabledAutoUpdateExtensions([]),await this.updateExtensionsPinnedState(!e),this._onChange.fire(void 0))}registerAutoRestartListener(){this.autoRestartListenerDisposable.value=void 0,this.configurationService.getValue(UH)===!0&&(this.autoRestartListenerDisposable.value=this.hostService.onDidChangeFocus(e=>{!e&&this.configurationService.getValue(UH)===!0&&this.updateRunningExtensions(void 0,!0)}))}reportInstalledExtensionsTelemetry(){let e=this.installed.filter(t=>!t.isBuiltin&&(t.enablementState===13||t.enablementState===12)).map(t=>hi.toKey(t.identifier.id));this.telemetryService.publicLog2("installedExtensions",{extensionIds:new lh(e.join(";")),count:e.length})}async onDidChangeRunningExtensions(e,t){let o=[],n=[];for(let s of e){let l=this.installed.find(c=>Ht({id:s.identifier.value,uuid:s.uuid},c.identifier));l?o.push(l):n.push(s)}let r=[];for(let s of t)this.workspaceContextService.isInsideWorkspace(s.extensionLocation)?r.push(s):n.push(s);if(n.length){let s=await this.getExtensions(n.map(l=>({id:l.identifier.value,uuid:l.uuid})),Ie.None);o.push(...s)}if(r.length){let s=await this.getResourceExtensions(r.map(l=>l.extensionLocation),!0);o.push(...s)}for(let s of o)this._onChange.fire(s)}updateExtensionsPinnedState(e){return this.progressService.withProgress({location:5,title:d(11886,null)},()=>this.extensionManagementService.resetPinnedStateForAllUserExtensions(e))}reset(){for(let e of this.tasksInProgress)e.cancel();this.tasksInProgress=[],this.installing=[],this.onDidChangeExtensions(),this._onReset.fire()}onDidChangeExtensions(e){this._installed=void 0,this._local=void 0,this._onChange.fire(e)}get local(){if(!this._local)if(this.extensionsServers.length===1)this._local=this.installed;else{this._local=[];let e=hbi(this.installed,t=>t.identifier);for(let t of e)this._local.push(this.getPrimaryExtension(t))}return this._local}get installed(){if(!this._installed){this._installed=[];for(let e of this.extensionsServers)for(let t of e.local)this._installed.push(t)}return this._installed}get outdated(){return this.installed.filter(e=>e.outdated&&e.local&&e.state===1)}async queryLocal(e){if(e){if(this.localExtensions&&this.extensionManagementServerService.localExtensionManagementServer===e)return this.localExtensions.queryInstalled(this.getProductVersion());if(this.remoteExtensions&&this.extensionManagementServerService.remoteExtensionManagementServer===e)return this.remoteExtensions.queryInstalled(this.getProductVersion());if(this.webExtensions&&this.extensionManagementServerService.webExtensionManagementServer===e)return this.webExtensions.queryInstalled(this.getProductVersion())}if(this.localExtensions)try{await this.localExtensions.queryInstalled(this.getProductVersion())}catch(t){this.logService.error(t)}if(this.remoteExtensions)try{await this.remoteExtensions.queryInstalled(this.getProductVersion())}catch(t){this.logService.error(t)}if(this.webExtensions)try{await this.webExtensions.queryInstalled(this.getProductVersion())}catch(t){this.logService.error(t)}return this.local}async queryGallery(e,t){if(!this.galleryService.isEnabled())return hAi([]);let o=Ie.isCancellationToken(e)?{}:e,n=Ie.isCancellationToken(e)?e:t;o.text=o.text?this.resolveQueryText(o.text):o.text,o.includePreRelease=bn(o.includePreRelease)?this.extensionManagementService.preferPreReleases:o.includePreRelease;let r=await this.extensionManagementService.getExtensionsControlManifest(),s=await this.galleryService.query(o,n);return this.syncInstalledExtensionsWithGallery(s.firstPage),{firstPage:s.firstPage.map(l=>this.fromGallery(l,r)),total:s.total,pageSize:s.pageSize,getPage:async(l,c)=>{let u=await s.getPage(l,c);return this.syncInstalledExtensionsWithGallery(u),u.map(p=>this.fromGallery(p,r))}}}async getExtensions(e,t,o){if(!this.galleryService.isEnabled())return[];e.forEach(s=>s.preRelease=s.preRelease??this.extensionManagementService.preferPreReleases);let n=await this.extensionManagementService.getExtensionsControlManifest(),r=await this.galleryService.getExtensions(e,t,o);return this.syncInstalledExtensionsWithGallery(r),r.map(s=>this.fromGallery(s,n))}async getResourceExtensions(e,t){return(await this.extensionManagementService.getExtensions(e)).map(n=>this.getInstalledExtensionMatchingLocation(n.location)??this.instantiationService.createInstance(BV,r=>this.getExtensionState(r),r=>this.getRuntimeState(r),void 0,void 0,void 0,{resourceExtension:n,isWorkspaceScoped:t}))}onDidDismissedNotificationsValueChange(){this.dismissedNotificationsValue!==this.getDismissedNotificationsValue()&&(this._dismissedNotificationsValue=void 0,this.updateExtensionsNotificaiton())}updateExtensionsNotificaiton(){let e=this.computeExtensionsNotifications(),t=[],o;if(e.length){for(let n of this.getDismissedNotifications())e.some(r=>r.key===n)&&t.push(n);t.includes(e[0].key)||(o={message:e[0].message,severity:e[0].severity,extensions:e[0].extensions,query:e[0].query,action:e[0].action,key:e[0].key,dismiss:()=>{this.setDismissedNotifications([...this.getDismissedNotifications(),e[0].key]),this.updateExtensionsNotificaiton()}})}this.setDismissedNotifications(t),this.extensionsNotification?.key!==o?.key&&(this.extensionsNotification=o,this._onDidChangeExtensionsNotification.fire(this.extensionsNotification))}computeExtensionsNotifications(){let e=[],t=this.local.filter(r=>r.enablementState===7);t.length&&e.push({message:this.configurationService.inspect(Xue).policy?d(11822,null):d(11821,null),severity:ft.Warning,extensions:t,key:"disallowedExtensions:"+t.sort((r,s)=>r.identifier.id.localeCompare(s.identifier.id)).map(r=>r.identifier.id.toLowerCase()).join("-")});let o=this.local.filter(r=>r.enablementState===6&&!r.isWorkspaceScoped);if(o.length&&(o.some(r=>r.local&&r.local.manifest.engines?.vscode&&(!oge(r.local.manifest.engines.vscode,this.productService.version,this.productService.date)||iQ([...r.local.manifest.enabledApiProposals??[]])))?e.push({message:d(11839,null),severity:ft.Warning,extensions:o,key:"incompatibleExtensions:"+o.sort((r,s)=>r.identifier.id.localeCompare(s.identifier.id)).map(r=>`${r.identifier.id.toLowerCase()}@${r.local?.manifest.version}`).join("-")}):e.push({message:d(11847,null),severity:ft.Warning,extensions:o,key:"invalidExtensions:"+o.sort((r,s)=>r.identifier.id.localeCompare(s.identifier.id)).map(r=>`${r.identifier.id.toLowerCase()}@${r.local?.manifest.version}`).join("-")})),!this.configurationService.getValue(UH)){let r=this.local.filter(s=>s.runtimeState!==void 0&&(s.runtimeState.action==="restartExtensions"||s.runtimeState.action==="reloadWindow"));if(r.length){let s=r.some(l=>l.runtimeState?.action==="reloadWindow");e.push({message:s?d(11835,null):d(11836,null),severity:ft.Info,extensions:r,query:"@restartrequired",action:{label:s?d(11868,null):d(11872,null),run:()=>{s?this.hostService.reload():this.updateRunningExtensions()}},key:"restartRequired:"+r.sort((l,c)=>l.identifier.id.localeCompare(c.identifier.id)).map(l=>l.identifier.id.toLowerCase()).join("-")})}}let n=this.local.filter(r=>!!r.deprecationInfo&&r.local&&this.extensionEnablementService.isEnabled(r.local));return n.length&&e.push({message:d(11817,null),severity:ft.Warning,extensions:n,key:"deprecatedExtensions:"+n.sort((r,s)=>r.identifier.id.localeCompare(s.identifier.id)).map(r=>r.identifier.id.toLowerCase()).join("-")}),e}getExtensionsNotification(){return this.extensionsNotification}resolveQueryText(e){e=e.replace(/@web/g,`tag:"${TRt}"`);let t=/\bext:([^\s]+)\b/g;return t.test(e)&&(e=e.replace(t,(o,n)=>{let s=(this.productService.extensionKeywords||{})[n]||[],l=this.languageService.guessLanguageIdByFilepathOrFirstLine(A.file(`.${n}`)),c=l&&this.languageService.getLanguageName(l),u=c?` tag:"${c}"`:"";return`tag:"__ext_${n}" tag:"__ext_.${n}" ${s.map(p=>`tag:"${p}"`).join(" ")}${u} tag:"${n}"`})),e.substr(0,350)}fromGallery(e,t){let o=this.getInstalledExtensionMatchingGallery(e);return o||(o=this.instantiationService.createInstance(BV,n=>this.getExtensionState(n),n=>this.getRuntimeState(n),void 0,void 0,e,void 0),o.setExtensionsControlManifest(t)),o}getInstalledExtensionMatchingGallery(e){for(let t of this.local)if(t.identifier.uuid){if(t.identifier.uuid===e.identifier.uuid)return t}else if(t.local?.source!=="resource"&&Ht(t.identifier,e.identifier))return t;return null}getInstalledExtensionMatchingLocation(e){return this.local.find(t=>t.local&&this.uriIdentityService.extUri.isEqualOrParent(e,t.local?.location))??null}async open(e,t){if(typeof e=="string"){let n=e;e=this.installed.find(r=>Ht(r.identifier,{id:n}))??(await this.getExtensions([{id:e}],Ie.None))[0]}if(!e)throw new Error(`Extension not found. ${e}`);let o=this.configurationService.getValue("extensions.allowOpenInModalEditor");await this.editorService.openEditor(this.instantiationService.createInstance(V$,e),t,t?.sideByside?En:o?MM:tr)}async openSearch(e,t){let o=(await this.viewsService.openViewContainer(Rh,!0))?.getViewPaneContainer();if(!o){this.logService.trace("ExtensionsWorkbenchService#openSearch: extension view pane container was not available");return}o.search(e),t||o.focus()}getExtensionRuntimeStatus(e){let t=this.extensionService.getExtensionsStatus();for(let o of Object.keys(t))if(Ht({id:o},e.identifier))return t[o]}async updateRunningExtensions(e=d(11870,null),t=!1){let o=[],n=[],r=[...this.local];for(let s of r){let l=s.runtimeState;if(!l||l.action!=="restartExtensions")continue;if(s.state===3){n.push(s.identifier.id);continue}if(!s.local)continue;if(this.extensionEnablementService.isEnabled(s.local)){let u=this.extensionService.extensions.find(p=>Ht({id:p.identifier.value,uuid:p.uuid},s.identifier));u&&n.push(u.identifier.value),o.push(s.local)}else n.push(s.identifier.id)}for(let s of this.extensionService.extensions)s.isUnderDevelopment||r.some(l=>Ht({id:s.identifier.value,uuid:s.uuid},l.local?.identifier??l.identifier))||n.push(s.identifier.value);(o.length||n.length)&&await this.extensionService.stopExtensionHosts(e,t)&&(await this.extensionService.startExtensionHosts({toAdd:o,toRemove:n}),t&&this.notificationService.notify({severity:ft.Info,message:d(11837,null),priority:2}),this.telemetryService.publicLog2("extensions:autorestart",{count:o.length+n.length,auto:t}))}getRuntimeState(e){let t=e.state===3,o=this.extensionService.extensions.find(s=>Ht({id:s.identifier.value},e.identifier)),n=this.extensionManagementServerService.remoteExtensionManagementServer?"reloadWindow":"restartExtensions",r=n==="reloadWindow"?d(11867,null):d(11871,null);if(t){let s=o&&this.extensionService.canRemoveExtension(o),l=o&&(!e.server||e.server===this.extensionManagementServerService.getExtensionManagementServer(YT(o)))&&(!e.resourceExtension||this.uriIdentityService.extUri.isEqual(e.resourceExtension.location,o.extensionLocation));return!s&&l&&!o.isUnderDevelopment?{action:n,reason:d(11861,null,r)}:void 0}if(e.local){let s=o&&e.server===this.extensionManagementServerService.getExtensionManagementServer(YT(o)),l=this.extensionEnablementService.isEnabled(e.local);if(o){if(l){if(this.extensionService.canAddExtension(C0(e.local)))return;let c=this.extensionManagementServerService.getExtensionManagementServer(YT(o));if(s){if(!o.isUnderDevelopment&&(e.version!==o.version||e.local.targetPlatform!==o.targetPlatform)){let u=this.getProductCurrentVersion(),p=this.getProductUpdateVersion();if(p&&!oge(e.local.manifest.engines.vscode,u.version,u.date)&&oge(e.local.manifest.engines.vscode,p.version,p.date)){let h=this.updateService.state;return h.type==="available for download"?{action:"downloadUpdate",reason:d(11862,null,this.productService.nameLong)}:h.type==="downloaded"?{action:"applyUpdate",reason:d(11865,null,this.productService.nameLong)}:h.type==="ready"?{action:"quitAndInstall",reason:d(11863,null,this.productService.nameLong)}:void 0}return{action:n,reason:d(11864,null,r)}}if(this.extensionsServers.length>1){let u=this.installed.filter(p=>Ht(p.identifier,e.identifier)&&p.server!==e.server)[0];if(u){if(c===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnUI(e.local.manifest)&&u.server===this.extensionManagementServerService.localExtensionManagementServer)return{action:n,reason:d(11828,null,r)};if(c===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(e.local.manifest)&&u.server===this.extensionManagementServerService.remoteExtensionManagementServer)return{action:n,reason:d(11829,null,r,this.extensionManagementServerService.remoteExtensionManagementServer?.label)}}}}else{if(e.server===this.extensionManagementServerService.localExtensionManagementServer&&c===this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnUI(e.local.manifest))return{action:n,reason:d(11860,null,r)};if(e.server===this.extensionManagementServerService.remoteExtensionManagementServer&&c===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManifestPropertiesService.prefersExecuteOnWorkspace(e.local.manifest))return{action:n,reason:d(11860,null,r)}}return}else if(s)return{action:n,reason:d(11859,null,r)};return}else{if(l&&!this.extensionService.canAddExtension(C0(e.local)))return{action:n,reason:d(11860,null,r)};let c=e.server?e.server===this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer:this.extensionManagementServerService.localExtensionManagementServer:null;if(c&&e.enablementState===1){let u=this.local.filter(p=>Ht(p.identifier,e.identifier)&&p.server===c)[0];if(u&&u.local&&this.extensionEnablementService.isEnabled(u.local))return{action:n,reason:d(11860,null,r)}}}}}getPrimaryExtension(e){if(e.length===1)return e[0];let t=e.filter(l=>l.local&&this.extensionEnablementService.isEnabled(l.local));if(t.length===1)return t[0];let o=t.length?t:e,n=o.find(l=>l.local&&l.local.manifest)?.local?.manifest;if(!n)return o[0];let r=this.extensionManifestPropertiesService.getExtensionKind(n),s=o.find(l=>{for(let c of r)switch(c){case"ui":return l.server===this.extensionManagementServerService.localExtensionManagementServer;case"workspace":return l.server===this.extensionManagementServerService.remoteExtensionManagementServer;case"web":return l.server===this.extensionManagementServerService.webExtensionManagementServer}return!1});return!s&&this.extensionManagementServerService.localExtensionManagementServer&&(s=o.find(l=>{for(let c of r)switch(c){case"workspace":return l.server===this.extensionManagementServerService.localExtensionManagementServer;case"web":return l.server===this.extensionManagementServerService.localExtensionManagementServer}return!1})),!s&&this.extensionManagementServerService.webExtensionManagementServer&&(s=o.find(l=>{for(let c of r)if(c==="web")return l.server===this.extensionManagementServerService.webExtensionManagementServer;return!1})),!s&&this.extensionManagementServerService.remoteExtensionManagementServer&&(s=o.find(l=>{for(let c of r)if(c==="web")return l.server===this.extensionManagementServerService.remoteExtensionManagementServer;return!1})),s||e[0]}getExtensionState(e){if(this.installing.some(t=>Ht(t.identifier,e.identifier)&&(!e.server||t.server===e.server)))return 0;if(this.remoteExtensions){let t=this.remoteExtensions.getExtensionState(e);if(t!==3)return t}if(this.webExtensions){let t=this.webExtensions.getExtensionState(e);if(t!==3)return t}return this.localExtensions?this.localExtensions.getExtensionState(e):3}async checkForUpdates(e,t){if(e?this.logService.trace(`[Extensions]: Checking for updates. Reason: ${e}`):this.logService.trace("[Extensions]: Checking for updates"),!this.galleryService.isEnabled())return;let o=[];if(this.localExtensions&&o.push(this.localExtensions),this.remoteExtensions&&o.push(this.remoteExtensions),this.webExtensions&&o.push(this.webExtensions),!o.length)return;let n=[];for(let r of this.local)t&&!r.isBuiltin||!r.local?.forceAutoUpdate&&r.isBuiltin&&!r.local?.pinned&&(r.type===0||!r.local?.identifier.uuid)||r.local?.source!=="resource"&&n.push({...r.identifier,preRelease:!!r.local?.preRelease,currentVersion:r.isBuiltin?r.version:void 0});if(n.length){let r=await o[0].server.extensionManagementService.getTargetPlatform();this.telemetryService.publicLog2("galleryService:checkingForUpdates",{count:n.length}),this.logService.trace("Checking updates for extensions",n.map(l=>l.id).join(", "));let s=await this.galleryService.getExtensions(n,{targetPlatform:r,compatible:!0,productVersion:this.getProductVersion()},Ie.None);s.length&&await this.syncInstalledExtensionsWithGallery(s,n)}}async updateAll(){let e=[];return this.outdated.forEach(t=>{t.gallery&&e.push({extension:t.gallery,options:{operation:3,installPreReleaseVersion:t.local?.isPreReleaseVersion,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,isApplicationScoped:t.local?.isApplicationScoped,context:{[CM]:!0}}})}),this.extensionManagementService.installGalleryExtensions(e)}async downloadVSIX(e,t){let o;if(t==="any"&&(o=await this.pickVersionToDownload(e),!o))return;let n=o?{id:e,version:o.version}:{id:e,preRelease:t==="prerelease"},r=o?{}:{compatible:!0},[s]=await this.galleryService.getExtensions([n],r,Ie.None);if(!s)throw new Error(d(11834,null,e));let l=s.properties.targetPlatform,c=[];for(let p of o?.targetPlatforms??s.allTargetPlatforms)p!=="unknown"&&p!=="universal"&&c.push({label:p==="undefined"?d(11809,null):g7e(p),id:p});if(c.length>1){let p=d(11858,null),h=await this.quickInputService.pick(c.sort((g,f)=>g.label.localeCompare(f.label)),{placeHolder:p});if(!h)return;l=h.id}l!==s.properties.targetPlatform&&([s]=await this.galleryService.getExtensions([n],{...r,targetPlatform:l},Ie.None));let u=await this.fileDialogService.showOpenDialog({title:d(11824,null),canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,openLabel:d(11823,null)});u?.[0]&&this.progressService.withProgress({location:15},async p=>{try{p.report({message:d(11827,null)});let h=`${s.identifier.id}-${s.version}${l!=="undefined"&&l!=="universal"&&l!=="unknown"?`-${l}`:""}.vsix`;await this.galleryService.download(s,this.uriIdentityService.extUri.joinPath(u[0],h),1),this.notificationService.info(d(11825,null))}catch(h){this.notificationService.error(d(11826,null,Dn(h)))}})}async pickVersionToDownload(e){let t=await this.galleryService.getAllVersions({id:e});if(!t.length){await this.dialogService.info(d(11852,null));return}let o=t.map((r,s)=>({id:r.version,label:r.version,description:`${ea(new Date(Date.parse(r.date)),!0)}${r.isPreReleaseVersion?` (${d(11866,null)})`:""}`,ariaLabel:`${r.isPreReleaseVersion?"Pre-Release version":"Release version"} ${r.version}`,data:r}));return(await this.quickInputService.pick(o,{placeHolder:d(11873,null),matchOnDetail:!0}))?.data}async syncInstalledExtensionsWithGallery(e,t){let o=[];this.localExtensions&&o.push(this.localExtensions),this.remoteExtensions&&o.push(this.remoteExtensions),this.webExtensions&&o.push(this.webExtensions),o.length&&(await Promise.allSettled(o.map(n=>n.syncInstalledExtensionsWithGallery(e,this.getProductVersion(),t))),this.outdated.length&&(this.logService.info("Auto updating outdated extensions.",this.outdated.map(n=>n.identifier.id).join(", ")),this.eventuallyAutoUpdateExtensions()))}isAutoCheckUpdatesEnabled(){return this.meteredConnectionService.isConnectionMetered?!1:this.configurationService.getValue(yJe)}eventuallyCheckForUpdates(e=!1){this.updatesCheckDelayer.cancel(),this.updatesCheckDelayer.trigger(async()=>{this.isAutoCheckUpdatesEnabled()&&await this.checkForUpdates(),this.eventuallyCheckForUpdates()},e?0:this.getUpdatesCheckInterval()).then(void 0,t=>null)}getUpdatesCheckInterval(){return this.productService.quality==="insider"&&this.getProductUpdateVersion()?1e3*60*60*1:M9.UpdatesCheckInterval}eventuallyAutoUpdateExtensions(){this.autoUpdateDelayer.trigger(()=>this.autoUpdateExtensions()).then(void 0,e=>null)}async autoUpdateBuiltinExtensions(){if(this.meteredConnectionService.isConnectionMetered)return;await this.checkForUpdates(void 0,!0);let e=this.outdated.filter(t=>t.isBuiltin);await vn.settled(e.map(t=>this.install(t,t.local?.preRelease?{installPreReleaseVersion:!0}:void 0)))}async syncPinnedBuiltinExtensions(){let e=[];for(let t of this.local)t.isBuiltin&&t.local?.pinned&&t.local?.identifier.uuid&&e.push({...t.identifier,version:t.version});if(e.length){let t=await this.galleryService.getExtensions(e,Ie.None);t.length&&await this.syncInstalledExtensionsWithGallery(t)}}async autoUpdateExtensions(){if(this.meteredConnectionService.isConnectionMetered){this.logService.trace("[Extensions]: Skipping auto-update because connection is metered");return}let e=[],t=[],o=[];for(let r of this.outdated){if(!this.shouldAutoUpdateExtension(r)){t.push(r.identifier.id);continue}if(await this.shouldRequireConsentToUpdate(r)){o.push(r.identifier.id);continue}e.push(r)}if(t.length&&this.logService.trace("Auto update disabled for extensions",t.join(", ")),o.length&&this.logService.info("Auto update consent required for extensions",o.join(", ")),!e.length)return;let n=this.getProductVersion();await vn.settled(e.map(r=>this.install(r,r.local?.preRelease?{installPreReleaseVersion:!0,productVersion:n}:{productVersion:n})))}getProductVersion(){return this.getProductUpdateVersion()??this.getProductCurrentVersion()}getProductCurrentVersion(){return{version:this.productService.version,date:this.productService.date}}getProductUpdateVersion(){switch(this.updateService.state.type){case"available for download":case"downloaded":case"updating":case"ready":{let e=this.updateService.state.update.productVersion;if(e&&wDe(e))return{version:e,date:this.updateService.state.update.timestamp?new Date(this.updateService.state.update.timestamp).toISOString():void 0}}}}shouldAutoUpdateExtension(e){if(e.deprecationInfo?.disallowInstall)return!1;if(e.local?.forceAutoUpdate)return!0;let t=this.getAutoUpdateValue();if(t===!1){let n=this.getEnabledAutoUpdateExtensions(),r=e.identifier.id.toLowerCase();return!!(n.includes(r)||this.isAutoUpdateEnabledForPublisher(e.publisher)&&!n.includes(`-${r}`))}return e.pinned||this.getDisabledAutoUpdateExtensions().includes(e.identifier.id.toLowerCase())?!1:t===!0?!0:t==="onlyEnabledExtensions"?e.enablementState!==10&&e.enablementState!==11:!1}async shouldRequireConsentToUpdate(e){if(e.outdated&&!(!e.gallery||!e.local)){if(e.local.identifier.uuid&&e.local.identifier.uuid!==e.gallery.identifier.uuid)return d(11816,null);if(!(!e.local.manifest.engines.vscode||e.local.manifest.main||e.local.manifest.browser)){if(so(e.gallery.properties?.executesCode)){if(!e.gallery.properties.executesCode)return}else{let t=e instanceof BV?await e.getGalleryManifest():await this.galleryService.getManifest(e.gallery,Ie.None);if(!t?.main&&!t?.browser)return}return d(11815,null,e.displayName)}}}isAutoUpdateEnabledFor(e){if(We(e)){if(Z4.test(e))throw new Error("Expected publisher string, found extension identifier");return this.isAutoUpdateEnabled()?!0:this.isAutoUpdateEnabledForPublisher(e)}return this.shouldAutoUpdateExtension(e)}isAutoUpdateEnabledForPublisher(e){return this.getPublishersToAutoUpdate().includes(e.toLowerCase())}async updateAutoUpdateEnablementFor(e,t){if(this.isAutoUpdateEnabled()){if(We(e))throw new Error("Expected extension, found publisher string");let o=this.getDisabledAutoUpdateExtensions(),n=e.identifier.id.toLowerCase(),r=o.indexOf(n);t?r!==-1&&o.splice(r,1):r===-1&&o.push(n),this.setDisabledAutoUpdateExtensions(o),t&&e.local&&e.pinned&&await this.extensionManagementService.updateMetadata(e.local,{pinned:!1}),this._onChange.fire(e)}else{let o=this.getEnabledAutoUpdateExtensions();if(We(e)){if(Z4.test(e))throw new Error("Expected publisher string, found extension identifier");e=e.toLowerCase(),this.isAutoUpdateEnabledFor(e)!==t&&(t?o.push(e):o.includes(e)&&o.splice(o.indexOf(e),1)),this.setEnabledAutoUpdateExtensions(o);for(let n of this.installed)n.publisher.toLowerCase()===e&&this._onChange.fire(n)}else{let n=e.identifier.id.toLowerCase(),r=this.isAutoUpdateEnabledFor(e.publisher.toLowerCase()),s=o.includes(n),l=o.includes(`-${n}`);t?(l&&o.splice(o.indexOf(`-${n}`),1),r?s&&o.splice(o.indexOf(n),1):s||o.push(n)):(s&&o.splice(o.indexOf(n),1),r?l||o.push(`-${n}`):l&&o.splice(o.indexOf(`-${n}`),1)),this.setEnabledAutoUpdateExtensions(o),this._onChange.fire(e)}}t&&this.autoUpdateExtensions()}onDidSelectedExtensionToAutoUpdateValueChange(){if(this.enabledAuotUpdateExtensionsValue!==this.getEnabledAutoUpdateExtensionsValue()||this.disabledAutoUpdateExtensionsValue!==this.getDisabledAutoUpdateExtensionsValue()){let e=this.installed.filter(l=>!l.isBuiltin),t=l=>{let c=[],u=[];for(let p of l)this.shouldAutoUpdateExtension(p)?c.push(p):u.push(p);return[c,u]},[o,n]=t(e);this._enabledAutoUpdateExtensionsValue=void 0,this._disabledAutoUpdateExtensionsValue=void 0;let[r,s]=t(e);for(let l of o??[])s?.includes(l)&&this._onChange.fire(l);for(let l of n??[])r?.includes(l)&&this._onChange.fire(l)}}async canInstall(e){if(!(e instanceof BV))return new he().appendText(d(11853,null));if(e.isMalicious)return new he().appendText(d(11848,null));if(e.deprecationInfo?.disallowInstall)return new he().appendText(d(11820,null));if(e.gallery){if(!e.gallery.isSigned&&f7e(e.private,await this.extensionGalleryManifestService.getExtensionGalleryManifest()))return new he().appendText(d(11856,null));let t=this.localExtensions?await this.localExtensions.canInstall(e.gallery):void 0;if(t===!0)return!0;let o=this.remoteExtensions?await this.remoteExtensions.canInstall(e.gallery):void 0;if(o===!0)return!0;let n=this.webExtensions?await this.webExtensions.canInstall(e.gallery):void 0;return n===!0?!0:t??o??n??new he().appendText(d(11810,null,e.displayName??e.identifier.id))}return e.resourceExtension&&await this.extensionManagementService.canInstall(e.resourceExtension)===!0?!0:new he().appendText(d(11810,null,e.displayName??e.identifier.id))}async install(e,t={},o){let n=await this._install(e,t,o);if(!n)throw new Error(d(11885,null));if(t.enable){if(n.enablementState===11||n.enablementState===10){if(t.justification&&!(await this.dialogService.confirm({title:d(11833,null),message:d(11832,null,n.displayName),detail:We(t.justification)?t.justification:t.justification.reason,primaryButton:We(t.justification)?d(11830,null):d(11831,null,t.justification.action)})).confirmed)throw new qi;await this.setEnablement(n,n.enablementState===11?13:12)}await this.waitUntilExtensionIsEnabled(n)}return n}async _install(e,t={},o){let n,r,s;if(e instanceof A)n=e;else{let l,c;if(We(e))if(r=this.local.find(u=>Ht(u.identifier,{id:e})),r?.isBuiltin){if(this.productService.builtInExtensionsEnabledWithAutoUpdates?.some(u=>u.toLowerCase()===e.toLowerCase()))return r}else l={id:e,version:t.version,preRelease:t.installPreReleaseVersion??this.extensionManagementService.preferPreReleases};else e.gallery?(r=e,c=e.gallery,t.version&&t.version!==c?.version&&(l={id:r.identifier.id,version:t.version})):e.resourceExtension&&(r=e,n=e.resourceExtension);if(l){let u=r?.server?await r.server.extensionManagementService.getTargetPlatform():void 0;c=(await this.galleryService.getExtensions([l],{targetPlatform:u},Ie.None)).at(0)}if(!r&&c&&(r=this.instantiationService.createInstance(BV,u=>this.getExtensionState(u),u=>this.getRuntimeState(u),void 0,void 0,c,void 0),r.setExtensionsControlManifest(await this.extensionManagementService.getExtensionsControlManifest())),r?.isMalicious)throw new Error(d(11848,null));if(c){if(t.installEverywhere){s=[];let u=await this.extensionManagementService.getInstallableServers(c);for(let p of this.extensionsServers)u.includes(p.server)&&!p.local.find(h=>Ht(h.identifier,c.identifier))&&s.push(p.server)}else if(t.enable&&r?.local&&(s=[],r.enablementState===1)){let[u]=await this.extensionManagementService.getInstallableServers(c);u&&s.push(u)}}if(!s||s.length){if(!n){if(!c){let u=We(e)?e:e.identifier.id,p=await this.extensionGalleryManifestService.getExtensionGalleryManifest(),h=p?jA(p,"ContactSupportUri"):void 0,g=h?d(11869,null,h.toString()):"";if(t.version){let f=d(11855,null,u,t.version);throw new qh(g?`${f} ${g}`:f,"NotFound")}else{let f=d(11854,null,u);throw new qh(g?`${f} ${g}`:f,"NotFound")}}n=c}t.version&&(t.installGivenVersion=!0),r?.isWorkspaceScoped&&(t.isWorkspaceScoped=!0)}}if(n){if(t.justification){let l=bn(t.isMachineScoped)&&this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncEnablementService.isResourceEnabled("extensions"),c=[];c.push({label:We(t.justification)||!t.justification.action?d(11840,null):d(11841,null,t.justification.action),run:()=>!0}),r||c.push({label:d(11857,null),run:()=>(this.open(r),!1)});let u=await this.dialogService.prompt({title:d(11843,null),message:r?d(11842,null,r.displayName,r.publisherDisplayName):d(11846,null),detail:We(t.justification)?t.justification:t.justification.reason,cancelButton:!0,buttons:c,checkbox:l?{label:d(11876,null),checked:!0}:void 0});if(!u.result)throw new qi;l&&(t.isMachineScoped=!u.checkboxChecked)}n instanceof A?r=await this.doInstall(void 0,()=>this.installFromVSIX(n,t),o):r&&(r.resourceExtension?r=await this.doInstall(r,()=>this.extensionManagementService.installResourceExtension(n,t),o):r=await this.doInstall(r,()=>this.installFromGallery(r,n,t,s),o))}return r}async installInServer(e,t,o){await this.doInstall(e,async()=>{let n=e.local;if(!n)throw new Error("Extension not found");if(e.gallery||(e=(await this.getExtensions([{...e.identifier,preRelease:n.preRelease}],Ie.None))[0]??e),e.gallery)return t.extensionManagementService.installFromGallery(e.gallery,{installPreReleaseVersion:n.preRelease,...o});let r=await t.extensionManagementService.getTargetPlatform();if(!Yue(n.targetPlatform,[n.targetPlatform],r))throw new Error(d(11838,null,e.identifier.id));let s=await this.extensionManagementService.zip(n);try{return await t.extensionManagementService.install(s)}finally{try{await this.fileService.del(s)}catch(l){this.logService.error(l)}}})}canSetLanguage(e){return!(!Ft||!e.gallery||!pZ(e.gallery))}async setLanguage(e){if(!this.canSetLanguage(e))throw new Error("Can not set language");let t=pZ(e.gallery);if(t===Kr)return;let o=e.gallery?.properties?.localizedLanguages?.[0];return this.localeService.setLocale({id:t,galleryExtension:e.gallery,extensionId:e.identifier.id,label:o??e.displayName})}setEnablement(e,t){return e=Array.isArray(e)?e:[e],this.promptAndSetEnablement(e,t)}async uninstall(e){let t=e.local?e:this.local.find(s=>Ht(s.identifier,e.identifier));if(!t?.local)throw new Error("Missing local");if(t.local.isApplicationScoped&&this.userDataProfilesService.profiles.length>1){let{confirmed:s}=await this.dialogService.confirm({title:d(11881,null),type:ft.Info,message:d(11882,null,t.displayName),primaryButton:d(11880,null)});if(!s)throw new qi}let o=[{extension:t.local}];if(!Ht(t.identifier,{id:this.productService.defaultChatAgent.extensionId}))for(let s of this.getAllPackedExtensions(t,this.local))s.local&&!o.some(l=>Ht(l.extension.identifier,s.identifier))&&o.push({extension:s.local});let n=[],r;for(let{extension:s}of o){let l=[];if(s.isApplicationScoped&&this.userDataProfilesService.profiles.length>1)r||(r=[],await Promise.allSettled(this.userDataProfilesService.profiles.map(async c=>{let u=await this.extensionManagementService.getInstalled(1,c.extensionsResource);for(let p of u)r?.push([p,c.extensionsResource])}))),l.push(...r);else for(let{local:c}of this.local)c&&l.push([c,void 0]);for(let[c,u]of l)Ht(c.identifier,s.identifier)||!c.manifest.extensionDependencies||c.manifest.extensionDependencies.length===0||s.manifest.extensionPack?.some(p=>Ht({id:p},c.identifier))||n.some(p=>p.manifest.extensionPack?.some(h=>Ht({id:h},c.identifier)))||c.manifest.extensionDependencies.some(p=>Ht(s.identifier,{id:p}))&&(n.push(c),o.push({extension:c,options:{profileLocation:u}}))}if(n.length){let{result:s}=await this.dialogService.prompt({title:d(11883,null),type:ft.Warning,message:this.getErrorMessageForUninstallingAnExtensionWithDependents(t,n),buttons:[{label:d(11879,null),run:()=>!0}],cancelButton:{run:()=>!1}});if(!s)throw new qi}return this.withProgress({location:5,title:d(11884,null),source:`${t.identifier.id}`},()=>this.extensionManagementService.uninstallExtensions(o).then(()=>{}))}getAllPackedExtensions(e,t,o=[]){if(o.some(r=>Ht(r.identifier,e.identifier)))return[];o.push(e);let n=e.extensionPack??[];if(n.length){let r=[];for(let l of t)!l.isBuiltin&&n.some(c=>Ht({id:c},l.identifier))&&r.push(l);let s=[];for(let l of r)s.push(...this.getAllPackedExtensions(l,t,o));return[...r,...s]}return[]}getErrorMessageForUninstallingAnExtensionWithDependents(e,t){return t.length===1?d(11875,null,e.displayName,t[0].manifest.displayName):t.length===2?d(11878,null,e.displayName,t[0].manifest.displayName,t[1].manifest.displayName):d(11851,null,e.displayName,t[0].manifest.displayName,t[1].manifest.displayName)}isExtensionIgnoredToSync(e){return e.local?!this.isInstalledExtensionSynced(e.local):this.extensionsSyncManagementService.hasToNeverSyncExtension(e.identifier.id)}async togglePreRelease(e){if(e.local){if(e.preRelease!==e.isPreReleaseVersion){await this.extensionManagementService.updateMetadata(e.local,{preRelease:!e.preRelease});return}await this.install(e,{installPreReleaseVersion:!e.preRelease,preRelease:!e.preRelease})}}async toggleExtensionIgnoredToSync(e){let t=[e,...this.getAllPackedExtensions(e,this.local)];for(let o of t){let n=this.isExtensionIgnoredToSync(o);o.local&&n&&o.local.isMachineScoped?await this.extensionManagementService.updateMetadata(o.local,{isMachineScoped:!1}):await this.extensionsSyncManagementService.updateIgnoredExtensions(o.identifier.id,!n)}await this.userDataAutoSyncService.triggerSync(["IgnoredExtensionsUpdated"])}async toggleApplyExtensionToAllProfiles(e){let t=[e,...this.getAllPackedExtensions(e,this.local)],o=this.getAllExtensionServers();await Promise.allSettled(t.map(async n=>{if(!n.local||O4(n.local.manifest)||n.isBuiltin)return;let r=n.local.isApplicationScoped;await Promise.all(o.map(async s=>{let l=s.local.find(c=>Ht(n.identifier,c.identifier))?.local;l&&l.isApplicationScoped===r&&await this.extensionManagementService.toggleApplicationScope(l,this.userDataProfileService.currentProfile.extensionsResource)}))}))}getAllExtensionServers(){let e=[];return this.localExtensions&&e.push(this.localExtensions),this.remoteExtensions&&e.push(this.remoteExtensions),this.webExtensions&&e.push(this.webExtensions),e}isInstalledExtensionSynced(e){return e.isMachineScoped?!1:this.extensionsSyncManagementService.hasToAlwaysSyncExtension(e.identifier.id)?!0:!this.extensionsSyncManagementService.hasToNeverSyncExtension(e.identifier.id)}doInstall(e,t,o){let n=e?d(11845,null,e.displayName):d(11844,null);return this.withProgress({location:o??5,title:n},async()=>{try{e&&(this.installing.push(e),this._onChange.fire(e));let r=await t();return await this.waitAndGetInstalledExtension(r.identifier)}finally{e&&(this.installing=this.installing.filter(r=>r!==e),this._onChange.fire(void 0))}})}async installFromVSIX(e,t){let o=await this.extensionManagementService.getManifest(e),n=this.local.find(r=>Ht(r.identifier,{id:gf(o.publisher,o.name)}));return n&&(t=t||{},n.latestVersion===o.version?t.pinned=t.pinned??(n.local?.pinned||!this.shouldAutoUpdateExtension(n)):t.installGivenVersion=!0),this.extensionManagementService.installVSIX(e,o,t)}installFromGallery(e,t,o,n){return o=o??{},o.pinned=o.pinned??(e.local?.pinned||!this.shouldAutoUpdateExtension(e)),e.local&&!n?(o.productVersion=this.getProductVersion(),o.operation=3,this.extensionManagementService.updateFromGallery(t,e.local,o)):this.extensionManagementService.installFromGallery(t,o,n)}async waitAndGetInstalledExtension(e){let t=this.local.find(o=>Ht(o.identifier,e));if(t||await U.toPromise(U.filter(this.onChange,o=>!!o&&this.local.some(n=>Ht(n.identifier,e)))),t=this.local.find(o=>Ht(o.identifier,e)),!t)throw new Error("Extension should have been installed");return t}async waitUntilExtensionIsEnabled(e){this.extensionService.extensions.find(t=>hi.equals(t.identifier,e.identifier.id))||!e.local||!this.extensionService.canAddExtension(C0(e.local))||await new Promise((t,o)=>{let n=this.extensionService.onDidChangeExtensions(()=>{try{this.extensionService.extensions.find(r=>hi.equals(r.identifier,e.identifier.id))&&(n.dispose(),t())}catch(r){o(r)}})})}promptAndSetEnablement(e,t){if(t===12||t===13){let n=this.getExtensionsRecursively(e,this.local,t,{dependencies:!0,pack:!0});return this.checkAndSetEnablement(e,n,t)}else{let n=this.getExtensionsRecursively(e,this.local,t,{dependencies:!1,pack:!0});return n.length?this.checkAndSetEnablement(e,n,t):this.checkAndSetEnablement(e,[],t)}}async checkAndSetEnablement(e,t,o){let n=[...e,...t];if(!(o===12||o===13))for(let s of e){let l=this.getDependentsAfterDisablement(s,n,this.local);if(l.length){let{result:c}=await this.dialogService.prompt({title:d(11819,null),type:ft.Warning,message:this.getDependentsErrorMessageForDisablement(s,n,l),buttons:[{label:d(11818,null),run:()=>!0}],cancelButton:{run:()=>!1}});if(!c)throw new qi;await this.checkAndSetEnablement(l,[s],o)}}return this.doSetEnablement(n,o)}getExtensionsRecursively(e,t,o,n,r=[]){let s=e.filter(l=>r.indexOf(l)===-1);if(s.length){for(let c of s)r.push(c);let l=t.filter(c=>{if(r.indexOf(c)!==-1)return!1;let u=o===12||o===13,p=c.enablementState===12||c.enablementState===13;return u===p?!1:(u||!c.isBuiltin)&&(n.dependencies||n.pack)&&e.some(h=>n.dependencies&&h.dependencies.some(g=>Ht({id:g},c.identifier))||n.pack&&h.extensionPack.some(g=>Ht({id:g},c.identifier)))});return l.length&&l.push(...this.getExtensionsRecursively(l,t,o,n,r)),l}return[]}getDependentsAfterDisablement(e,t,o){return o.filter(n=>n.dependencies.length===0||n===e||!this.extensionEnablementService.isEnabledEnablementState(n.enablementState)||t.indexOf(n)!==-1?!1:n.dependencies.some(r=>[e,...t].some(s=>Ht(s.identifier,{id:r}))))}getDependentsErrorMessageForDisablement(e,t,o){for(let n of[e,...t]){let r=o.filter(s=>s.dependencies.some(l=>Ht({id:l},n.identifier)));if(r.length)return this.getErrorMessageForDisablingAnExtensionWithDependents(n,r)}return""}getErrorMessageForDisablingAnExtensionWithDependents(e,t){return t.length===1?d(11874,null,e.displayName,t[0].displayName):t.length===2?d(11877,null,e.displayName,t[0].displayName,t[1].displayName):d(11850,null,e.displayName,t[0].displayName,t[1].displayName)}async doSetEnablement(e,t){return await this.extensionEnablementService.setEnablement(e.map(o=>o.local),t)}reportProgressFromOtherSources(){this.installed.some(e=>e.state===0||e.state===2)?this._activityCallBack||this.withProgress({location:5},()=>new Promise(e=>this._activityCallBack=e)):(this._activityCallBack?.(),this._activityCallBack=void 0)}withProgress(e,t){return this.progressService.withProgress(e,async()=>{let o=Hn(()=>t());this.tasksInProgress.push(o);try{return await o}finally{let n=this.tasksInProgress.indexOf(o);n!==-1&&this.tasksInProgress.splice(n,1)}})}onError(e){if(Yi(e))return;let t=e&&e.message||"";/getaddrinfo ENOTFOUND|getaddrinfo ENOENT|connect EACCES|connect ECONNREFUSED/.test(t)||this.notificationService.error(e)}handleURL(e,t){return/^extension/.test(e.path)?(this.onOpenExtensionUrl(e),Promise.resolve(!0)):Promise.resolve(!1)}onOpenExtensionUrl(e){let t=/^extension\/([^/]+)$/.exec(e.path);if(!t)return;let o=t[1];this.queryLocal().then(async n=>{let r=n.find(s=>Ht(s.identifier,{id:o}));r||([r]=await this.getExtensions([{id:o}],{source:"uri"},Ie.None)),r&&(await this.hostService.focus(ut),await this.open(r))}).then(void 0,n=>this.onError(n))}getPublishersToAutoUpdate(){return this.getEnabledAutoUpdateExtensions().filter(e=>!Z4.test(e))}getEnabledAutoUpdateExtensions(){try{let e=JSON.parse(this.enabledAuotUpdateExtensionsValue);if(Array.isArray(e))return e}catch{}return[]}setEnabledAutoUpdateExtensions(e){this.enabledAuotUpdateExtensionsValue=JSON.stringify(e)}get enabledAuotUpdateExtensionsValue(){return this._enabledAutoUpdateExtensionsValue||(this._enabledAutoUpdateExtensionsValue=this.getEnabledAutoUpdateExtensionsValue()),this._enabledAutoUpdateExtensionsValue}set enabledAuotUpdateExtensionsValue(e){this.enabledAuotUpdateExtensionsValue!==e&&(this._enabledAutoUpdateExtensionsValue=e,this.setEnabledAutoUpdateExtensionsValue(e))}getEnabledAutoUpdateExtensionsValue(){return this.storageService.get(xBi,-1,"[]")}setEnabledAutoUpdateExtensionsValue(e){this.storageService.store(xBi,e,-1,0)}getDisabledAutoUpdateExtensions(){try{let e=JSON.parse(this.disabledAutoUpdateExtensionsValue);if(Array.isArray(e))return e}catch{}return[]}setDisabledAutoUpdateExtensions(e){this.disabledAutoUpdateExtensionsValue=JSON.stringify(e)}get disabledAutoUpdateExtensionsValue(){return this._disabledAutoUpdateExtensionsValue||(this._disabledAutoUpdateExtensionsValue=this.getDisabledAutoUpdateExtensionsValue()),this._disabledAutoUpdateExtensionsValue}set disabledAutoUpdateExtensionsValue(e){this.disabledAutoUpdateExtensionsValue!==e&&(this._disabledAutoUpdateExtensionsValue=e,this.setDisabledAutoUpdateExtensionsValue(e))}getDisabledAutoUpdateExtensionsValue(){return this.storageService.get(kBi,-1,"[]")}setDisabledAutoUpdateExtensionsValue(e){this.storageService.store(kBi,e,-1,0)}getDismissedNotifications(){try{let e=JSON.parse(this.dismissedNotificationsValue);if(Array.isArray(e))return e}catch{}return[]}setDismissedNotifications(e){this.dismissedNotificationsValue=JSON.stringify(e)}get dismissedNotificationsValue(){return this._dismissedNotificationsValue||(this._dismissedNotificationsValue=this.getDismissedNotificationsValue()),this._dismissedNotificationsValue}set dismissedNotificationsValue(e){this.dismissedNotificationsValue!==e&&(this._dismissedNotificationsValue=e,this.setDismissedNotificationsValue(e))}getDismissedNotificationsValue(){return this.storageService.get(EBi,0,"[]")}setDismissedNotificationsValue(e){this.storageService.store(EBi,e,0,0)}};M9=I([m(0,F),m(1,ie),m(2,Dd),m(3,ga),m(4,tb),m(5,B),m(6,_e),m(7,Ne),m(8,tS),m(9,As),m(10,ti),m(11,Go),m(12,$c),m(13,Rt),m(14,uq),m(15,T_),m(16,Ze),m(17,X),m(18,hm),m(19,re),m(20,lt),m(21,AU),m(22,to),m(23,ge),m(24,gn),m(25,hn),m(26,de),m(27,ct),m(28,Yl),m(29,Lp),m(30,gt),m(31,Ae),m(32,Gt),m(33,nn),m(34,$e),m(35,Mm),m(36,MG)],M9);async function TBi(a,i,e,t,o,n){try{let r=await i.getExtensionsControlManifest();if(!r.deprecated)return;let s=await i.getInstalled(1,a?.extensionsResource);for(let[l,c]of Object.entries(r.deprecated)){if(!c?.extension)continue;let{id:u,autoMigrate:p,preRelease:h}=c.extension;if(!p)continue;let g=s.find(v=>Ht(v.identifier,{id:l}));if(!g)continue;let f=(await e.getExtensions([{id:u,preRelease:h}],{targetPlatform:await i.getTargetPlatform(),compatible:!0},Ie.None))[0];if(!f){n.info(`Skipping migrating '${g.identifier.id}' extension because, the comaptible target '${u}' extension is not found`);continue}try{n.info(`Migrating '${g.identifier.id}' extension to '${u}' extension...`);let v=!o.getDisabledExtensions().some(S=>Ht(S,g.identifier));await i.uninstall(g,{profileLocation:a?.extensionsResource}),n.info(`Uninstalled the unsupported extension '${g.identifier.id}'`);let b=s.find(S=>Ht(S.identifier,{id:u}));(!b||b.isPreReleaseVersion!==!!h&&v)&&(b=await i.installFromGallery(f,{installPreReleaseVersion:h,isMachineScoped:g.isMachineScoped,operation:4,profileLocation:a?.extensionsResource,context:{[CM]:!0}}),n.info(`Installed the pre-release extension '${b.identifier.id}'`),!p.donotDisable&&!v&&(await o.disableExtension(b.identifier),n.info(`Disabled the pre-release extension '${b.identifier.id}' because the unsupported extension '${g.identifier.id}' is disabled`)),p.storage&&(t.addToMigrationList(zS(g.manifest.publisher,g.manifest.name),zS(b.manifest.publisher,b.manifest.name)),n.info("Added pre-release extension to the storage migration list"))),n.info(`Migrated '${g.identifier.id}' extension to '${u}' extension.`)}catch(v){n.error(v)}}if(r.autoUpdate)for(let[l,c]of Object.entries(r.autoUpdate))try{let u=s.find(h=>Ht(h.identifier,{id:l})&&xlo(h.manifest.version,c));if(!u)continue;let p=(await e.getExtensions([{id:l,preRelease:u.preRelease}],{targetPlatform:await i.getTargetPlatform(),compatible:!0},Ie.None))[0];if(!p){n.info(`Skipping updating '${u.identifier.id}' extension because, the compatible target '${l}' extension is not found`);continue}await i.installFromGallery(p,{installPreReleaseVersion:u.preRelease,isMachineScoped:u.isMachineScoped,operation:3,profileLocation:a?.extensionsResource,context:{[CM]:!0}}),n.info(`Autoupdated '${u.identifier.id}' extension to '${p.version}' extension.`)}catch(u){n.error(u)}}catch(r){n.error(r)}}var QUe=class{constructor(i,e,t,o,n){i.remoteExtensionManagementServer&&TBi(void 0,i.remoteExtensionManagementServer.extensionManagementService,e,t,o,n),i.webExtensionManagementServer&&TBi(void 0,i.webExtensionManagementServer.extensionManagementService,e,t,o,n)}};QUe=I([m(0,$c),m(1,ga),m(2,hG),m(3,x2),m(4,re)],QUe);Ce(Ui,M9,0);Ce(Pre,LUe,1);Ce(AR,BUe,0);oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:R9,prefix:R9.PREFIX,placeholder:d(11455,null),helpEntries:[{description:d(11454,null)}]});oe.as(en.EditorPane).registerEditorPane(os.create(VV,VV.ID,d(11383,null)),[new Vt(V$)]);var u8t=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:Rh,title:P(11391,"Extensions"),openCommandActionDescriptor:{id:Rh,mnemonicTitle:d(11457,null),keybindings:{primary:3126},order:4},ctorDescriptor:new Vt(GUe),icon:PIo,order:4,rejectAddedViews:!0,alwaysUseContainerInfo:!0},0);oe.as($t.Configuration).registerConfiguration({id:"extensions",order:30,title:d(11410,null),type:"object",properties:{"extensions.autoUpdate":{enum:[!0,"onlyEnabledExtensions",!1],enumItemLabels:[d(11363,null),d(11380,null),d(11460,null)],enumDescriptions:[d(11397,null),d(11395,null),d(11396,null)],description:d(11394,null),default:!0,scope:1,tags:["usesOnlineServices"]},"extensions.autoCheckUpdates":{type:"boolean",description:d(11408,null),default:!0,scope:1,tags:["usesOnlineServices"]},"extensions.ignoreRecommendations":{type:"boolean",description:d(11412,null),default:!1,agentsWindow:{default:!0,readOnly:!0}},"extensions.showRecommendationsOnlyOnDemand":{type:"boolean",deprecationMessage:d(11415,null),default:!1,tags:["usesOnlineServices"]},"extensions.closeExtensionDetailsOnViewChange":{type:"boolean",description:d(11409,null),default:!1},"extensions.confirmedUriHandlerExtensionIds":{type:"array",items:{type:"string"},description:d(11426,null),default:[],scope:1},"extensions.webWorker":{type:["boolean","string"],enum:[!0,!1,"auto"],enumDescriptions:[d(11420,null),d(11419,null),d(11418,null)],description:d(11417,null),default:"auto"},"extensions.supportVirtualWorkspaces":{type:"object",markdownDescription:d(11406,null),patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:"boolean",default:!1}},additionalProperties:!1,default:{},defaultSnippets:[{body:{"pub.name":!1}}]},[ZSi]:{type:"object",scope:1,markdownDescription:d(11399,null),patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:"boolean",default:!1}},additionalProperties:!1,default:{},defaultSnippets:[{body:{"pub.name":!0}}]},"extensions.experimental.affinity":{type:"object",markdownDescription:d(11392,null),patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:"integer",default:1}},additionalProperties:!1,default:{},defaultSnippets:[{body:{"pub.name":1}}]},[hAt]:{type:"object",scope:1,markdownDescription:d(11400,null),patternProperties:{"([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$":{type:"object",properties:{supported:{type:["boolean","string"],enum:[!0,!1,"limited"],enumDescriptions:[d(11404,null),d(11401,null),d(11402,null)],description:d(11403,null)},version:{type:"string",description:d(11405,null)}}}}},"extensions.experimental.deferredStartupFinishedActivation":{type:"boolean",description:d(11411,null),default:!1},"extensions.experimental.issueQuickAccess":{type:"boolean",description:d(11413,null),default:!0},"extensions.allowOpenInModalEditor":{type:"boolean",description:d(11393,null),default:!1,tags:["experimental"],experiment:{mode:"auto"}},[JTe]:{type:"boolean",description:d(11407,null),default:!0,scope:1,included:Qr},[UH]:{type:"boolean",description:d(11364,null),default:!1,included:$i.quality!=="stable"},[I7e]:{type:"string",description:d(11398,null),default:"",scope:1,tags:["usesOnlineServices"],included:!1,policy:{name:"ExtensionGalleryServiceUrl",category:"Extensions",minimumVersion:"1.99",localization:{description:{key:"extensions.gallery.serviceUrl",value:d(11398,null)}}}},"extensions.supportNodeGlobalNavigator":{type:"boolean",description:d(11416,null),default:!1},[RRt]:{type:"number",description:d(11414,null),default:6e4,scope:1,tags:["advanced","usesOnlineServices"]}}});var cwn=oe.as(Ta.JSONContribution);cwn.registerSchema(mLi,MIo);Ge.registerCommand("_extensions.manage",(a,i,e,t,o)=>{let n=a.get(Ui),r=n.local.find(s=>Ht(s.identifier,{id:i}));if(r)n.open(r,{tab:e,preserveFocus:t,feature:o});else throw new Error(d(11461,null,i))});Ge.registerCommand("extension.open",async(a,i,e,t,o,n)=>{let r=a.get(Ui),s=a.get(fe),[l]=await r.getExtensions([{id:i}],Ie.None);return l?r.open(l,{tab:e,preserveFocus:t,feature:o,sideByside:n}):s.executeCommand("_extensions.manage",i,e,t,o)});Ge.registerCommand({id:"workbench.extensions.installExtension",metadata:{description:d(11507,null),args:[{name:"extensionIdOrVSIXUri",description:d(11506,null),constraint:a=>typeof a=="string"||a instanceof A},{name:"options",description:"(optional) Options for installing the extension. Object with the following properties: `installOnlyNewlyAddedFromExtensionPackVSIX`: When enabled, VS Code installs only newly added extensions from the extension pack VSIX. This option is considered only when installing VSIX. ",isOptional:!0,schema:{type:"object",properties:{installOnlyNewlyAddedFromExtensionPackVSIX:{type:"boolean",description:d(11511,null),default:!1},installPreReleaseVersion:{type:"boolean",description:d(11512,null),default:!1},donotSync:{type:"boolean",description:d(11509,null),default:!1},justification:{type:["string","object"],description:d(11513,null)},enable:{type:"boolean",description:d(11510,null),default:!1},context:{type:"object",description:d(11508,null)}}}}]},handler:async(a,i,e)=>{let t=a.get(Ui),o=a.get(Dd),n=a.get(ga);try{if(typeof i=="string"){let[r,s]=b7e(i);if(t.local.find(c=>Ht(c.identifier,{id:r,uuid:s}))?.enablementState===1){let[c]=await n.getExtensions([{id:r,preRelease:e?.installPreReleaseVersion}],Ie.None);if(!c)throw new Error(d(11461,null,i));await o.installFromGallery(c,{isMachineScoped:e?.donotSync?!0:void 0,installPreReleaseVersion:e?.installPreReleaseVersion,installGivenVersion:!!s,context:{...e?.context,[bH]:"command"}})}else await t.install(r,{version:s,installPreReleaseVersion:e?.installPreReleaseVersion,context:{...e?.context,[bH]:"command"},justification:e?.justification,enable:e?.enable,isMachineScoped:e?.donotSync?!0:void 0},15)}else{let r=A.revive(i);await t.install(r,{installGivenVersion:!0})}}catch(r){throw mt(r),r}}});Ge.registerCommand({id:"workbench.extensions.uninstallExtension",metadata:{description:d(11517,null),args:[{name:d(11516,null),schema:{type:"string"}}]},handler:async(a,i)=>{if(!i)throw new Error(d(11427,null));let e=a.get(xs),t=await e.getInstalled(),[o]=t.filter(n=>Ht(n.identifier,{id:i}));if(!o)throw new Error(d(11462,null,i));if(o.isBuiltin)throw new Error(d(11365,null,i));try{await e.uninstall(o)}catch(n){throw mt(n),n}}});Ge.registerCommand({id:"workbench.extensions.search",metadata:{description:d(11515,null),args:[{name:d(11514,null),schema:{type:"string"}}]},handler:async(a,i="")=>a.get(Ui).openSearch(i)});function RBi(a,i){a?.addImplementation(105,"extensions-editor",e=>{let o=e.get(ie).activeEditorPane;return o instanceof VV&&o.activeWebview?.isFocused?(i(o.activeWebview),!0):!1})}RBi(WA,a=>a.copy());RBi(QB,a=>a.cut());RBi(FA,a=>a.paste());var Ik=new Y("hasLocalServer",!1),qE=new Y("hasRemoteServer",!1),MO=new Y("hasWebServer",!1),bPo=new Y("gallerySortCapabilities",""),_Bi=new Y("galleryFilterCapabilities",""),SPo=new Y("galleryAllPublicRepositorySigned",!1),IPo=new Y("galleryAllPrivateRepositorySigned",!1),yPo=new Y("galleryHasExtensionLink",!1);async function DBi(a){try{await a.run()}finally{Sd(a)&&a.dispose()}}var qct=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.extensionManagementService=e;this.extensionManagementServerService=t;this.extensionGalleryManifestService=o;this.contextKeyService=n;this.viewsService=r;this.extensionsWorkbenchService=s;this.extensionEnablementService=l;this.instantiationService=c;this.dialogService=u;this.commandService=p;this.productService=h;this.pluginInstallService=g;let f=Ik.bindTo(n);this.extensionManagementServerService.localExtensionManagementServer&&f.set(!0);let v=qE.bindTo(n);this.extensionManagementServerService.remoteExtensionManagementServer&&v.set(!0);let b=MO.bindTo(n);this.extensionManagementServerService.webExtensionManagementServer&&b.set(!0),this.updateExtensionGalleryStatusContexts(),this._register(o.onDidChangeExtensionGalleryManifestStatus(()=>this.updateExtensionGalleryStatusContexts())),o.getExtensionGalleryManifest().then(S=>{this.updateGalleryCapabilitiesContexts(S),this._register(o.onDidChangeExtensionGalleryManifest(y=>this.updateGalleryCapabilitiesContexts(y)))}),this.registerGlobalActions(),this.registerContextMenuActions(),this.registerQuickAccessProvider()}async updateExtensionGalleryStatusContexts(){og.bindTo(this.contextKeyService).set(this.extensionGalleryManifestService.extensionGalleryManifestStatus==="available"),See.bindTo(this.contextKeyService).set(this.extensionGalleryManifestService.extensionGalleryManifestStatus)}async updateGalleryCapabilitiesContexts(e){bPo.bindTo(this.contextKeyService).set(`_${e?.capabilities.extensionQuery.sorting?.map(t=>t.name)?.join("_")}_UpdateDate_`),_Bi.bindTo(this.contextKeyService).set(`_${e?.capabilities.extensionQuery.filtering?.map(t=>t.name)?.join("_")}_`),SPo.bindTo(this.contextKeyService).set(!!e?.capabilities?.signing?.allPublicRepositorySigned),IPo.bindTo(this.contextKeyService).set(!!e?.capabilities?.signing?.allPrivateRepositorySigned),yPo.bindTo(this.contextKeyService).set(!!(e&&jA(e,"ExtensionDetailsViewUriTemplate")))}registerQuickAccessProvider(){(this.extensionManagementServerService.localExtensionManagementServer||this.extensionManagementServerService.remoteExtensionManagementServer||this.extensionManagementServerService.webExtensionManagementServer)&&oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:D9,prefix:D9.PREFIX,placeholder:d(11437,null),helpEntries:[{description:d(11436,null)}]})}registerGlobalActions(){this._register(be.appendMenuItem(R.MenubarPreferencesMenu,{command:{id:Rh,title:d(11456,null)},group:"2_configuration",order:3,when:qo.negate()})),this._register(be.appendMenuItem(R.GlobalActivity,{command:{id:Rh,title:d(11472,null)},group:"2_configuration",order:3})),this.registerExtensionAction({id:"workbench.extensions.action.focusExtensionsView",title:P(11425,"Focus on Extensions View"),category:$h,f1:!0,run:async l=>{await l.get(Ui).openSearch("")}}),this.registerExtensionAction({id:"workbench.extensions.action.installExtensions",title:P(11438,"Install Extensions"),category:$h,menu:{id:R.CommandPalette,when:C.and(og,C.or(Ik,qE,MO))},run:async l=>{l.get(Gt).openViewContainer(Rh,!0)}}),this.registerExtensionAction({id:"workbench.extensions.action.showRecommendedKeymapExtensions",title:P(11477,"Keymaps"),category:Xvi,menu:[{id:R.CommandPalette,when:og},{id:R.EditorTitle,when:C.and(xf,og),group:"2_keyboard_discover_actions"}],menuTitles:{[R.EditorTitle.id]:d(11428,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recommended:keymaps ")}),this.registerExtensionAction({id:"workbench.extensions.action.showLanguageExtensions",title:P(11474,"Language Extensions"),category:Xvi,menu:{id:R.CommandPalette,when:og},run:()=>this.extensionsWorkbenchService.openSearch("@recommended:languages ")}),this.registerExtensionAction({id:"workbench.extensions.action.checkForUpdates",title:P(11367,"Check for Extension Updates"),category:$h,menu:[{id:R.CommandPalette,when:C.and(og,C.or(Ik,qE,MO))},{id:R.ViewContainerTitle,when:C.and(C.equals("viewContainer",Rh),og),group:"1_updates",order:1}],run:async()=>{let[,l]=await Promise.all([this.extensionsWorkbenchService.checkForUpdates(),this.pluginInstallService.updateAllPlugins({silent:!0},Ie.None)]);if(this.extensionsWorkbenchService.outdated.length)return this.extensionsWorkbenchService.openSearch("@outdated ");if(l.updatedNames.length===0&&l.failedNames.length===0)return this.dialogService.info(d(11463,null))}});let e=C.equals(`config.${JI}`,!1);this.registerExtensionAction({id:"workbench.extensions.action.enableAutoUpdate",title:P(11379,"Enable Auto Update for All Extensions"),category:$h,precondition:e,menu:[{id:R.ViewContainerTitle,order:5,group:"1_updates",when:C.and(C.equals("viewContainer",Rh),e)},{id:R.CommandPalette}],run:l=>l.get(Ui).updateAutoUpdateForAllExtensions(!0)});let t=C.notEquals(`config.${JI}`,!1);this.registerExtensionAction({id:"workbench.extensions.action.disableAutoUpdate",title:P(11371,"Disable Auto Update for All Extensions"),precondition:t,category:$h,menu:[{id:R.ViewContainerTitle,order:5,group:"1_updates",when:C.and(C.equals("viewContainer",Rh),t)},{id:R.CommandPalette}],run:l=>l.get(Ui).updateAutoUpdateForAllExtensions(!1)}),this.registerExtensionAction({id:"workbench.extensions.action.updateAllExtensions",title:P(11488,"Update All Extensions"),category:$h,precondition:GNt,menu:[{id:R.CommandPalette,when:C.and(og,C.or(Ik,qE,MO))},{id:R.ViewContainerTitle,when:C.and(C.equals("viewContainer",Rh),C.or(C.has(`config.${JI}`).negate(),C.equals(`config.${JI}`,"onlyEnabledExtensions"))),group:"1_updates",order:2},{id:R.ViewTitle,when:C.equals("view",UNt),group:"navigation",order:1}],icon:gLi,run:async()=>{await this.extensionsWorkbenchService.updateAll()}}),this.registerExtensionAction({id:"workbench.extensions.action.enableAll",title:P(11377,"Enable All Extensions"),category:$h,menu:[{id:R.CommandPalette,when:C.or(Ik,qE,MO)},{id:R.ViewContainerTitle,when:C.equals("viewContainer",Rh),group:"2_enablement",order:1}],run:async()=>{let l=this.extensionsWorkbenchService.local.filter(c=>!!c.local&&this.extensionEnablementService.canChangeEnablement(c.local)&&!this.extensionEnablementService.isEnabled(c.local));l.length&&await this.extensionsWorkbenchService.setEnablement(l,12)}}),this.registerExtensionAction({id:"workbench.extensions.action.enableAllWorkspace",title:P(11378,"Enable All Extensions for this Workspace"),category:$h,menu:{id:R.CommandPalette,when:C.and(el.notEqualsTo("empty"),C.or(Ik,qE,MO))},run:async()=>{let l=this.extensionsWorkbenchService.local.filter(c=>!!c.local&&this.extensionEnablementService.canChangeEnablement(c.local)&&!this.extensionEnablementService.isEnabled(c.local));l.length&&await this.extensionsWorkbenchService.setEnablement(l,13)}}),this.registerExtensionAction({id:"workbench.extensions.action.disableAll",title:P(11369,"Disable All Installed Extensions"),category:$h,menu:[{id:R.CommandPalette,when:C.or(Ik,qE,MO)},{id:R.ViewContainerTitle,when:C.equals("viewContainer",Rh),group:"2_enablement",order:2}],run:async()=>{let l=this.extensionsWorkbenchService.local.filter(c=>!c.isBuiltin&&!!c.local&&this.extensionEnablementService.isEnabled(c.local)&&this.extensionEnablementService.canChangeEnablement(c.local));l.length&&await this.extensionsWorkbenchService.setEnablement(l,10)}}),this.registerExtensionAction({id:"workbench.extensions.action.disableAllWorkspace",title:P(11370,"Disable All Installed Extensions for this Workspace"),category:$h,menu:{id:R.CommandPalette,when:C.and(el.notEqualsTo("empty"),C.or(Ik,qE,MO))},run:async()=>{let l=this.extensionsWorkbenchService.local.filter(c=>!c.isBuiltin&&!!c.local&&this.extensionEnablementService.isEnabled(c.local)&&this.extensionEnablementService.canChangeEnablement(c.local));l.length&&await this.extensionsWorkbenchService.setEnablement(l,11)}}),this.registerExtensionAction({id:KNt,title:P(11442,"Install from VSIX..."),category:$h,menu:[{id:R.CommandPalette,when:C.or(Ik,qE)},{id:R.ViewContainerTitle,when:C.and(C.equals("viewContainer",Rh),C.or(Ik,qE)),group:"3_install",order:1}],run:async l=>{let c=l.get(nn),u=l.get(fe),p=await c.showOpenDialog({title:d(11441,null),filters:[{name:"VSIX Extensions",extensions:["vsix"]}],canSelectFiles:!0,canSelectMany:!0,openLabel:FB(d(11432,null))});p&&await u.executeCommand(wJe,p)}}),this.registerExtensionAction({id:wJe,title:d(11444,null),menu:[{id:R.ExplorerContext,group:"extensions",when:C.and(Ho.Extension.isEqualTo(".vsix"),C.or(Ik,qE))}],run:async(l,c)=>{let u=l.get(Ui),p=l.get(ti),h=l.get(Ne),g=Array.isArray(c)?c:[c],f=await Promise.allSettled(g.map(async y=>await u.install(y,{installGivenVersion:!0}))),v,b=!1,S=!1;for(let y of f){if(y.status==="rejected"){v=new Error(y.reason);break}b=b||y.value.runtimeState?.action==="reloadWindow",S=S||y.value.runtimeState?.action==="restartExtensions"}if(v)throw v;b?h.prompt(ft.Info,g.length>1?d(11451,null):d(11448,null),[{label:d(11445,null),run:()=>p.reload()}]):S?h.prompt(ft.Info,g.length>1?d(11452,null):d(11449,null),[{label:d(11446,null),run:()=>u.updateRunningExtensions()}]):h.prompt(ft.Info,g.length>1?d(11450,null):d(11447,null),[])}}),this.registerExtensionAction({id:"workbench.extensions.action.installExtensionFromLocation",title:P(11435,"Install Extension from Location..."),category:Fe.Developer,menu:[{id:R.CommandPalette,when:C.or(MO,Ik)}],run:async l=>{let c=l.get(Dd);if(Ft)return new Promise((u,p)=>{let h=l.get($e),g=new O,f=g.add(h.createQuickPick());f.title=d(11439,null),f.customButton=!0,f.customLabel=d(11430,null),f.placeholder=d(11440,null),f.ignoreFocusOut=!0,g.add(U.any(f.onDidAccept,f.onDidCustom)(async()=>{if(f.hide(),f.value)try{await c.installFromLocation(A.parse(f.value))}catch(v){p(v);return}u()})),g.add(f.onDidHide(()=>g.dispose())),f.show()});{let p=await l.get(nn).showOpenDialog({canSelectFolders:!0,canSelectFiles:!1,canSelectMany:!1,title:d(11439,null)});p?.[0]&&await c.installFromLocation(p[0])}}}),be.appendMenuItem(kJe,{submenu:Qg,title:d(11424,null),group:"navigation",order:2,icon:VKt});let o="extensions.filter.featured",n=C.and(og,C.regex(_Bi.key,new RegExp("_Featured_")));this.registerExtensionAction({id:o,title:P(11473,"Show Featured Extensions"),category:$h,menu:[{id:R.CommandPalette,when:n},{id:Qg,when:n,group:"1_predefined",order:1}],menuTitles:{[Qg.id]:d(11422,null)},run:()=>this.extensionsWorkbenchService.openSearch("@featured ")}),this.registerExtensionAction({id:"workbench.extensions.action.showPopularExtensions",title:P(11475,"Show Popular Extensions"),category:$h,menu:[{id:R.CommandPalette,when:og},{id:Qg,when:og,group:"1_predefined",order:2}],menuTitles:{[Qg.id]:d(11458,null)},run:()=>this.extensionsWorkbenchService.openSearch("@popular ")}),this.registerExtensionAction({id:"workbench.extensions.action.showRecommendedExtensions",title:P(11476,"Show Recommended Extensions"),category:$h,menu:[{id:R.CommandPalette,when:og},{id:Qg,when:og,group:"1_predefined",order:2}],menuTitles:{[Qg.id]:d(11459,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recommended ")}),this.registerExtensionAction({id:"workbench.extensions.action.recentlyPublishedExtensions",title:P(11465,"Show Recently Published Extensions"),category:$h,menu:[{id:R.CommandPalette,when:og},{id:Qg,when:og,group:"1_predefined",order:2}],menuTitles:{[Qg.id]:d(11464,null)},run:()=>this.extensionsWorkbenchService.openSearch("@recentlyPublished ")});let r=new R("extensionsCategoryFilterSubMenu");be.appendMenuItem(Qg,{submenu:r,title:d(11423,null),when:C.and(og,C.regex(_Bi.key,new RegExp("_Category_"))),group:"2_categories",order:1}),m0.forEach((l,c)=>{this.registerExtensionAction({id:`extensions.actions.searchByCategory.${l}`,title:l,menu:[{id:r,when:og,order:c}],run:()=>this.extensionsWorkbenchService.openSearch(`@category:"${l.toLowerCase()}"`)})}),this.registerExtensionAction({id:"workbench.extensions.action.installedExtensions",title:P(11434,"Show Installed Extensions"),category:$h,f1:!0,menu:[{id:Qg,group:"3_installed",order:1}],menuTitles:{[Qg.id]:d(11433,null)},run:()=>this.extensionsWorkbenchService.openSearch("@installed ")}),this.registerExtensionAction({id:"workbench.extensions.action.listBuiltInExtensions",title:P(11469,"Show Built-in Extensions"),category:$h,menu:[{id:R.CommandPalette,when:C.or(Ik,qE,MO)},{id:Qg,group:"3_installed",order:3}],menuTitles:{[Qg.id]:d(11366,null)},run:()=>this.extensionsWorkbenchService.openSearch("@builtin ")}),this.registerExtensionAction({id:"workbench.extensions.action.extensionUpdates",title:P(11421,"Show Extension Updates"),category:$h,precondition:og,f1:!0,menu:[{id:Qg,group:"3_installed",when:og,order:2}],menuTitles:{[Qg.id]:d(11384,null)},run:()=>this.extensionsWorkbenchService.openSearch("@updates")}),this.registerExtensionAction({id:zH,title:P(11478,"Show Extensions Unsupported By Workspace"),category:$h,menu:[{id:R.CommandPalette,when:C.or(Ik,qE)},{id:Qg,group:"3_installed",order:6,when:C.or(Ik,qE)}],menuTitles:{[Qg.id]:d(11518,null)},run:()=>this.extensionsWorkbenchService.openSearch("@workspaceUnsupported")}),this.registerExtensionAction({id:"workbench.extensions.action.showEnabledExtensions",title:P(11471,"Show Enabled Extensions"),category:$h,menu:[{id:R.CommandPalette,when:C.or(Ik,qE,MO)},{id:Qg,group:"3_installed",order:4}],menuTitles:{[Qg.id]:d(11381,null)},run:()=>this.extensionsWorkbenchService.openSearch("@enabled ")}),this.registerExtensionAction({id:"workbench.extensions.action.showDisabledExtensions",title:P(11470,"Show Disabled Extensions"),category:$h,menu:[{id:R.CommandPalette,when:C.or(Ik,qE,MO)},{id:Qg,group:"3_installed",order:5}],menuTitles:{[Qg.id]:d(11372,null)},run:()=>this.extensionsWorkbenchService.openSearch("@disabled ")});let s=new R("extensionsSortSubMenu");be.appendMenuItem(Qg,{submenu:s,title:d(11485,null),when:C.and(C.or(og,zx)),group:"4_sort",order:1}),[{id:"installs",title:d(11480,null),precondition:Qbe.negate(),sortCapability:"InstallCount"},{id:"rating",title:d(11483,null),precondition:Qbe.negate(),sortCapability:"WeightedRating"},{id:"name",title:d(11481,null),precondition:Qbe.negate(),sortCapability:"Title"},{id:"publishedDate",title:d(11482,null),precondition:Qbe.negate(),sortCapability:"PublishedDate"},{id:"updateDate",title:d(11484,null),precondition:C.and(IBi.negate(),wBi.negate(),Qbe.negate()),sortCapability:"UpdateDate"}].map(({id:l,title:c,precondition:u,sortCapability:p},h)=>{let g=C.regex(bPo.key,new RegExp(`_${p}_`));this.registerExtensionAction({id:`extensions.sort.${l}`,title:c,precondition:C.and(u,C.regex(CBi.key,/^@contribute:/).negate(),g),menu:[{id:s,when:C.and(C.or(og,zx),g),order:h}],toggled:SBi.isEqualTo(l),run:async()=>{let f=(await this.viewsService.openViewContainer(Rh,!0))?.getViewPaneContainer(),v=W$.parse(f?.searchValue??"");f?.search(new W$(v.value,l).toString()),f?.focus()}})}),this.registerExtensionAction({id:"workbench.extensions.action.clearExtensionsSearchResults",title:P(11368,"Clear Extensions Search Results"),category:$h,icon:AIo,f1:!0,precondition:yBi,menu:{id:kJe,group:"navigation",order:1},run:async l=>{let c=l.get(Gt).getActiveViewPaneContainerWithId(Rh);if(c){let u=c;u.search(""),u.focus()}}}),this.registerExtensionAction({id:"workbench.extensions.action.refreshExtension",title:P(11466,"Refresh"),category:$h,icon:NIo,f1:!0,menu:{id:R.ViewContainerTitle,when:C.equals("viewContainer",Rh),group:"navigation",order:2},run:async l=>{let c=l.get(Gt).getActiveViewPaneContainerWithId(Rh);c&&await c.refresh()}}),this.registerExtensionAction({id:"workbench.extensions.action.installWorkspaceRecommendedExtensions",title:d(11453,null),icon:gLi,menu:{id:R.ViewTitle,when:C.equals("view",uRe),group:"navigation",order:1},run:async l=>l.get(Gt).getActiveViewWithId(uRe).installWorkspaceRecommendations()}),this.registerExtensionAction({id:kq.ID,title:kq.LABEL,icon:FIo,menu:[{id:R.CommandPalette,when:el.notEqualsTo("empty")},{id:R.ViewTitle,when:C.equals("view",uRe),group:"navigation",order:2}],run:()=>DBi(this.instantiationService.createInstance(kq,kq.ID,kq.LABEL))}),this.registerExtensionAction({id:iO.ID,title:{value:iO.LABEL,original:"Install Specific Version of Extension..."},category:$h,menu:{id:R.CommandPalette,when:C.and(og,C.or(Ik,qE,MO))},run:()=>DBi(this.instantiationService.createInstance(iO,iO.ID,iO.LABEL))})}registerContextMenuActions(){this.registerExtensionAction({id:AE.ID,title:AE.TITLE,menu:{id:R.ExtensionContext,group:pRe,order:0,when:C.and(C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.has("extensionHasColorThemes"))},run:async(e,t)=>{let o=e.get(Ui),n=e.get(F),r=o.local.find(s=>Ht(s.identifier,{id:t}));if(r){let s=n.createInstance(AE);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:NE.ID,title:NE.TITLE,menu:{id:R.ExtensionContext,group:pRe,order:0,when:C.and(C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.has("extensionHasFileIconThemes"))},run:async(e,t)=>{let o=e.get(Ui),n=e.get(F),r=o.local.find(s=>Ht(s.identifier,{id:t}));if(r){let s=n.createInstance(NE);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:OE.ID,title:OE.TITLE,menu:{id:R.ExtensionContext,group:pRe,order:0,when:C.and(C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.has("extensionHasProductIconThemes"))},run:async(e,t)=>{let o=e.get(Ui),n=e.get(F),r=o.local.find(s=>Ht(s.identifier,{id:t}));if(r){let s=n.createInstance(OE);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.showPreReleaseVersion",title:P(11467,"Show Pre-Release Version"),menu:{id:R.ExtensionContext,group:Iee,order:0,when:C.and(C.has("inExtensionEditor"),C.has("galleryExtensionHasPreReleaseVersion"),C.has("isPreReleaseExtensionAllowed"),C.not("showPreReleaseVersion"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(Ui),n=(await o.getExtensions([{id:t}],Ie.None))[0];o.open(n,{showPreReleaseVersion:!0})}}),this.registerExtensionAction({id:"workbench.extensions.action.showReleasedVersion",title:P(11468,"Show Release Version"),menu:{id:R.ExtensionContext,group:Iee,order:1,when:C.and(C.has("inExtensionEditor"),C.has("galleryExtensionHasPreReleaseVersion"),C.has("extensionHasReleaseVersion"),C.has("showPreReleaseVersion"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(Ui),n=(await o.getExtensions([{id:t}],Ie.None))[0];o.open(n,{showPreReleaseVersion:!1})}}),this.registerExtensionAction({id:ck.ID,title:ck.LABEL,category:$h,precondition:C.and(C.or(C.notEquals(`config.${JI}`,"onlyEnabledExtensions"),C.equals("isExtensionEnabled",!0)),C.not("extensionDisallowInstall"),C.has("isExtensionAllowed")),menu:{id:R.ExtensionContext,group:xJe,order:1,when:C.and(C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(Ui).local.find(s=>Ht(s.identifier,{id:t}));if(r){let s=o.createInstance(ck);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:XW.ID,title:{value:XW.LABEL,original:"Auto Update (Publisher)"},category:$h,precondition:C.equals(`config.${JI}`,!1),menu:{id:R.ExtensionContext,group:xJe,order:2,when:C.and(C.equals("extensionStatus","installed"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(Ui).local.find(s=>Ht(s.identifier,{id:t}));if(r){let s=o.createInstance(XW);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.switchToPreRlease",title:d(11382,null),category:$h,menu:{id:R.ExtensionContext,group:Iee,order:2,when:C.and(og,C.has("galleryExtensionHasPreReleaseVersion"),C.has("isPreReleaseExtensionAllowed"),C.not("installedExtensionIsOptedToPreRelease"),C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(Ui).local.find(s=>Ht(s.identifier,{id:t}));if(r){let s=o.createInstance(HR);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.switchToRelease",title:d(11373,null),category:$h,menu:{id:R.ExtensionContext,group:Iee,order:2,when:C.and(og,C.has("galleryExtensionHasPreReleaseVersion"),C.has("isExtensionAllowed"),C.has("installedExtensionIsOptedToPreRelease"),C.not("inExtensionEditor"),C.equals("extensionStatus","installed"),C.not("isBuiltinExtension"))},run:async(e,t)=>{let o=e.get(F),r=e.get(Ui).local.find(s=>Ht(s.identifier,{id:t}));if(r){let s=o.createInstance(HR);return s.extension=r,s.run()}}}),this.registerExtensionAction({id:dk.ID,title:dk.TITLE,menu:{id:R.ExtensionContext,group:Iee,order:0,when:C.and(C.not("inExtensionEditor"),C.has("canSetLanguage"),C.has("isActiveLanguagePackExtension"))},run:async(e,t)=>{let o=e.get(F),r=(await e.get(Ui).getExtensions([{id:t}],Ie.None))[0],s=o.createInstance(dk);return s.extension=r,s.run()}}),this.registerExtensionAction({id:"workbench.extensions.action.installUnsigned",title:d(11429,null),menu:{id:R.ExtensionContext,group:"0_install",when:C.and(C.equals("extensionStatus","uninstalled"),C.has("isGalleryExtension"),C.not("extensionDisallowInstall"),C.has("extensionIsUnsigned"),C.or(C.and(SPo,C.not("extensionIsPrivate")),C.and(IPo,C.has("extensionIsPrivate")))),order:1},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ht(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Ie.None))[0];if(n){let r=o.createInstance(WC,{installPreReleaseVersion:this.extensionManagementService.preferPreReleases});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.installAndDonotSync",title:d(11431,null),menu:{id:R.ExtensionContext,group:"0_install",when:C.and(C.equals("extensionStatus","uninstalled"),C.has("isGalleryExtension"),C.has("isExtensionAllowed"),C.not("extensionDisallowInstall"),NR),order:1},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ht(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Ie.None))[0];if(n){let r=o.createInstance(WC,{installPreReleaseVersion:this.extensionManagementService.preferPreReleases,isMachineScoped:!0});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:"workbench.extensions.action.installPrereleaseAndDonotSync",title:d(11443,null),menu:{id:R.ExtensionContext,group:"0_install",when:C.and(C.equals("extensionStatus","uninstalled"),C.has("isGalleryExtension"),C.has("extensionHasPreReleaseVersion"),C.has("isPreReleaseExtensionAllowed"),C.not("extensionDisallowInstall"),NR),order:2},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ht(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Ie.None))[0];if(n){let r=o.createInstance(WC,{isMachineScoped:!0,preRelease:!0});return r.extension=n,r.run()}}}),this.registerExtensionAction({id:M_.ID,title:M_.LABEL,menu:{id:R.ExtensionContext,group:"0_install",when:C.and(C.equals("extensionStatus","uninstalled"),C.has("isGalleryExtension"),C.has("isExtensionAllowed"),C.not("extensionDisallowInstall")),order:3},run:async(e,t)=>{let o=e.get(F),n=this.extensionsWorkbenchService.local.filter(r=>Ht(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Ie.None))[0];if(n)return o.createInstance(M_,n,!1).run()}}),this.registerExtensionAction({id:"workbench.extensions.action.copyExtension",title:P(11497,"Copy"),menu:{id:R.ExtensionContext,group:"1_copy"},run:async(e,t)=>{let o=e.get(Bi),n=this.extensionsWorkbenchService.local.filter(r=>Ht(r.identifier,{id:t}))[0]||(await this.extensionsWorkbenchService.getExtensions([{id:t}],Ie.None))[0];if(n){let r=d(11387,null,n.displayName),s=d(11386,null,t),l=d(11385,null,n.description),c=d(11389,null,n.version),u=d(11388,null,n.publisherDisplayName),p=n.url?d(11390,null,`${n.url}`):null,h=`${r}
${s}
${l}
${c}
${u}${p?`
`+p:""}`;await o.writeText(h)}}}),this.registerExtensionAction({id:"workbench.extensions.action.copyExtensionId",title:P(11498,"Copy Extension ID"),menu:{id:R.ExtensionContext,group:"1_copy"},run:async(e,t)=>e.get(Bi).writeText(t)}),this.registerExtensionAction({id:"workbench.extensions.action.copyLink",title:P(11499,"Copy Link"),menu:{id:R.ExtensionContext,group:"1_copy",when:C.and(C.has("isGalleryExtension"),yPo)},run:async(e,t,o)=>{let n=e.get(Bi);o.galleryLink&&await n.writeText(o.galleryLink)}}),this.registerExtensionAction({id:"workbench.extensions.action.configure",title:P(11495,"Settings"),menu:{id:R.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),C.has("extensionHasConfiguration")),order:1},run:async(e,t)=>e.get(Qo).openSettings({jsonEditor:!1,query:`@ext:${t}`})}),this.registerExtensionAction({id:"workbench.extensions.action.download",title:d(11376,null),menu:{id:R.ExtensionContext,when:C.and(C.not("extensionDisallowInstall"),C.has("isGalleryExtension")),order:this.productService.quality==="stable"?0:1},run:async(e,t)=>{e.get(Ui).downloadVSIX(t,"release")}}),this.registerExtensionAction({id:"workbench.extensions.action.downloadPreRelease",title:d(11374,null),menu:{id:R.ExtensionContext,when:C.and(C.not("extensionDisallowInstall"),C.has("isGalleryExtension"),C.has("extensionHasPreReleaseVersion")),order:this.productService.quality==="stable"?1:0},run:async(e,t)=>{e.get(Ui).downloadVSIX(t,"prerelease")}}),this.registerExtensionAction({id:"workbench.extensions.action.downloadSpecificVersion",title:d(11375,null),menu:{id:R.ExtensionContext,when:C.and(C.not("extensionDisallowInstall"),C.has("isGalleryExtension")),order:2},run:async(e,t)=>{e.get(Ui).downloadVSIX(t,"any")}}),this.registerExtensionAction({id:"workbench.extensions.action.manageAccountPreferences",title:P(11494,"Account Preferences"),menu:{id:R.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),C.has("extensionHasAccountPreferences")),order:2},run:(e,t)=>e.get(fe).executeCommand("_manageAccountPreferencesForExtension",t)}),this.registerExtensionAction({id:"workbench.extensions.action.configureKeybindings",title:P(11496,"Keyboard Shortcuts"),menu:{id:R.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),C.has("extensionHasKeybindings")),order:2},run:async(e,t)=>e.get(Qo).openGlobalKeybindingSettings(!1,{query:`@ext:${t}`})}),this.registerExtensionAction({id:"workbench.extensions.action.toggleApplyToAllProfiles",title:P(11503,"Apply Extension to all Profiles"),toggled:C.has("isApplicationScopedExtension"),menu:{id:R.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),C.has("isDefaultApplicationScopedExtension").negate(),C.has("isBuiltinExtension").negate(),C.equals("isWorkspaceScopedExtension",!1)),order:3},run:async(e,t,o)=>{let n=e.get(gt),r=o.location?this.extensionsWorkbenchService.installed.find(s=>n.extUri.isEqual(s.local?.location,o.location)):void 0;if(r)return this.extensionsWorkbenchService.toggleApplyExtensionToAllProfiles(r)}}),this.registerExtensionAction({id:zNt,title:P(11504,"Sync This Extension"),menu:{id:R.ExtensionContext,group:"2_configure",when:C.and(C.equals("extensionStatus","installed"),NR,C.equals("isWorkspaceScopedExtension",!1)),order:4},run:async(e,t)=>{let o=this.extensionsWorkbenchService.local.find(n=>Ht({id:t},n.identifier));if(o)return this.extensionsWorkbenchService.toggleExtensionIgnoredToSync(o)}}),this.registerExtensionAction({id:"workbench.extensions.action.ignoreRecommendation",title:P(11500,"Ignore Recommendation"),menu:{id:R.ExtensionContext,group:"3_recommendations",when:C.has("isExtensionRecommended"),order:1},run:async(e,t)=>e.get(RE).toggleGlobalIgnoredRecommendation(t,!0)}),this.registerExtensionAction({id:"workbench.extensions.action.undoIgnoredRecommendation",title:P(11505,"Undo Ignored Recommendation"),menu:{id:R.ExtensionContext,group:"3_recommendations",when:C.has("isUserIgnoredRecommendation"),order:1},run:async(e,t)=>e.get(RE).toggleGlobalIgnoredRecommendation(t,!1)}),this.registerExtensionAction({id:"workbench.extensions.action.addExtensionToWorkspaceRecommendations",title:P(11489,"Add to Workspace Recommendations"),menu:{id:R.ExtensionContext,group:"3_recommendations",when:C.and(el.notEqualsTo("empty"),C.has("isBuiltinExtension").negate(),C.has("isExtensionWorkspaceRecommended").negate(),C.has("isUserIgnoredRecommendation").negate(),C.notEquals("extensionSource","resource")),order:2},run:(e,t)=>e.get(rq).toggleRecommendation(t)}),this.registerExtensionAction({id:"workbench.extensions.action.removeExtensionFromWorkspaceRecommendations",title:P(11502,"Remove from Workspace Recommendations"),menu:{id:R.ExtensionContext,group:"3_recommendations",when:C.and(el.notEqualsTo("empty"),C.has("isBuiltinExtension").negate(),C.has("isExtensionWorkspaceRecommended")),order:2},run:(e,t)=>e.get(rq).toggleRecommendation(t)}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceRecommendations",title:P(11493,"Add Extension to Workspace Recommendations"),category:Q3,menu:{id:R.CommandPalette,when:C.and(el.isEqualTo("workspace"),C.equals("resourceScheme",Q.extension))},async run(e){let t=e.get(ie),o=e.get(rq);if(!(t.activeEditor instanceof V$))return;let n=t.activeEditor.extension.identifier.id.toLowerCase();(await o.getRecommendations()).includes(n)||await o.toggleRecommendation(n)}}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceFolderRecommendations",title:P(11491,"Add Extension to Workspace Folder Recommendations"),category:Q3,menu:{id:R.CommandPalette,when:C.and(el.isEqualTo("folder"),C.equals("resourceScheme",Q.extension))},run:()=>this.commandService.executeCommand("workbench.extensions.action.addToWorkspaceRecommendations")}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceIgnoredRecommendations",title:P(11492,"Add Extension to Workspace Ignored Recommendations"),category:Q3,menu:{id:R.CommandPalette,when:C.and(el.isEqualTo("workspace"),C.equals("resourceScheme",Q.extension))},async run(e){let t=e.get(ie),o=e.get(rq);if(!(t.activeEditor instanceof V$))return;let n=t.activeEditor.extension.identifier.id.toLowerCase();(await o.getUnwantedRecommendations()).includes(n)||await o.toggleUnwantedRecommendation(n)}}),this.registerExtensionAction({id:"workbench.extensions.action.addToWorkspaceFolderIgnoredRecommendations",title:P(11490,"Add Extension to Workspace Folder Ignored Recommendations"),category:Q3,menu:{id:R.CommandPalette,when:C.and(el.isEqualTo("folder"),C.equals("resourceScheme",Q.extension))},run:()=>this.commandService.executeCommand("workbench.extensions.action.addToWorkspaceIgnoredRecommendations")}),this.registerExtensionAction({id:xq.ID,title:{value:xq.LABEL,original:"Configure Recommended Extensions (Workspace)"},category:Q3,menu:{id:R.CommandPalette,when:el.isEqualTo("workspace")},run:()=>DBi(this.instantiationService.createInstance(xq,xq.ID,xq.LABEL))}),this.registerExtensionAction({id:"workbench.extensions.action.manageTrustedPublishers",title:P(11501,"Manage Trusted Extension Publishers"),category:Q3,f1:!0,run:async e=>{let t=e.get($e),o=e.get(Dd),n=o.getTrustedPublishers(),r=n.map(l=>({id:l.publisher,label:l.publisherDisplayName,description:l.publisher,picked:!0})).sort((l,c)=>l.label.localeCompare(c.label)),s=await t.pick(r,{canPickMany:!0,title:d(11486,null),placeHolder:d(11487,null)});if(s){let l=[];for(let{publisher:c}of n)s.some(u=>u.id===c)||l.push(c);n.filter(c=>!s.some(u=>u.id===c.publisher)),o.untrustPublishers(...l)}}})}registerExtensionAction(e){let t=e.menu?Array.isArray(e.menu)?e.menu:[e.menu]:[],o=[],n=[];if(e.menuTitles)for(let s=0;s<t.length;s++){let l=t[s],c=e.menuTitles[l.id.id];c?n.push({id:l.id,item:{...l,command:{id:e.id,title:c}}}):o.push(l)}else o=t;let r=new O;return r.add(W(class extends z{constructor(){super({...e,menu:o})}run(s,...l){return e.run(s,...l)}})),n.length&&r.add(be.appendMenuItems(n)),r}};qct=I([m(0,xs),m(1,$c),m(2,tb),m(3,X),m(4,Gt),m(5,Ui),m(6,As),m(7,F),m(8,ct),m(9,fe),m(10,Ze),m(11,uI)],qct);var $ct=class{constructor(i,e){DC.removeOutdatedExtensionVersions(i,e)}};$ct=I([m(0,xs),m(1,de)],$ct);var jct=class{constructor(i,e,t,o){let n="trusted-publishers-init-migration";if(!o.get(n,-1))for(let r of e.profiles)i.getInstalled(1,r.extensionsResource).then(async s=>{let l=new Map;for(let c of s){if(!c.publisherDisplayName)continue;let u=c.manifest.publisher.toLowerCase();t.trustedExtensionPublishers?.includes(u)||c.publisherDisplayName&&t.trustedExtensionPublishers?.includes(c.publisherDisplayName.toLowerCase())||l.set(u,{publisher:u,publisherDisplayName:c.publisherDisplayName})}l.size&&i.trustPublishers(...l.values()),o.store(n,"true",-1,1)})}};jct=I([m(0,Dd),m(1,hn),m(2,Ze),m(3,de)],jct);var YUe=class extends k{static{this.ID="extensions.chat.toolsContribution"}constructor(i,e){super();let t=e.createInstance(TUe);this._register(i.registerTool(rBi,t)),this._register(i.vscodeToolSet.addTool(rBi))}};YUe=I([m(0,Wn),m(1,F)],YUe);var PO=oe.as(Zi.Workbench);PO.registerWorkbenchContribution(qct,3);PO.registerWorkbenchContribution(qUe,4);PO.registerWorkbenchContribution($Ue,4);PO.registerWorkbenchContribution(EVe,3);PO.registerWorkbenchContribution(KUe,3);PO.registerWorkbenchContribution(HUe,4);PO.registerWorkbenchContribution(zUe,4);PO.registerWorkbenchContribution(RUe,3);PO.registerWorkbenchContribution(UUe,3);PO.registerWorkbenchContribution(QUe,4);PO.registerWorkbenchContribution(jct,4);PO.registerWorkbenchContribution(jUe,4);Ft&&PO.registerWorkbenchContribution($ct,4);bt(YUe.ID,YUe,vt.AfterRestored);W(class extends z{constructor(){super({id:"workbench.extensions.actions.gallery.signIn",title:P(11479,"Sign in to access Extensions Marketplace"),menu:{id:R.AccountsContext,when:See.isEqualTo("requiresSignIn")}})}run(i){return i.get(fe).executeCommand(Sge)}});oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:JI,migrateFn:(a,i)=>a==="onlySelectedExtensions"?{value:!1}:[]}]);function dwn(a,i,e){let t=a.label,o=a.fromMarketplace?.description??i.getUriLabel(ai(a.uri),{relative:!0}),n=a.fromMarketplace?.marketplace;return{kind:"installed",name:t,description:o,marketplace:n,plugin:a,outdated:e}}function uwn(a){return{kind:"marketplace",name:a.name,description:a.description,source:a.source,sourceDescriptor:a.sourceDescriptor,marketplace:a.marketplace,marketplaceReference:a.marketplaceReference,marketplaceType:a.marketplaceType,readmeUri:a.readmeUri}}var Xbe=class extends it{constructor(e,t,o,n){super(Xbe.ID,d(6710,null),"extension-action label prominent install");this.plugin=e;this.liveMarketplacePlugin=t;this.pluginInstallService=o;this.pluginMarketplaceService=n}static{this.ID="agentPlugin.update"}async run(){await this.pluginInstallService.updatePlugin(this.liveMarketplacePlugin)&&this.pluginMarketplaceService.addInstalledPlugin(this.plugin.uri,this.liveMarketplacePlugin)}};Xbe=I([m(2,uI),m(3,jC)],Xbe);var P9=class extends it{constructor(e,t){super(P9.ID,"",P9.CLASS,!0);this.getActionGroups=e;this.instantiationService=t;this._actionViewItem=null;this.tooltip=d(6708,null)}static{this.ID="agentPlugin.manage"}static{this.CLASS=`extension-action icon manage ${q.asClassName(Kge)}`}createActionViewItem(e){return this._actionViewItem=this.instantiationService.createInstance(Qct,this,e),this._actionViewItem}async run(){this._actionViewItem?.showMenu(this.getActionGroups())}};P9=I([m(1,F)],P9);var Qct=class extends ts{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!1});this.contextMenuService=o}showMenu(e){if(!this.element)return;let t=e.flatMap(s=>[...s,new oi]);t.length>0&&t.pop();let{left:o,top:n,height:r}=ur(this.element);this.contextMenuService.showContextMenu({getAnchor:()=>({x:o,y:n+r+10}),getActions:()=>t,onHide:()=>gz(t)})}};Qct=I([m(2,Xe)],Qct);var Nre=class{constructor(i){this.instantiationService=i;this.templateId=Nre.templateId}static{this.templateId="agentPlugin"}renderTemplate(i){let e=D(i,_(".agent-plugin-item.extension-list-item")),t=D(e,_(".details")),o=D(t,_(".header-container")),n=D(o,_(".header")),r=D(n,_("span.name")),s=D(t,_(".description.ellipsis")),l=D(t,_(".footer")),c=D(l,_(".publisher-container")),u=D(c,_("span.publisher-name")),p=new oo(l,{focusOnlyEnabledItems:!0,actionViewItemProvider:(h,g)=>{if(h instanceof P9)return h.createActionViewItem(g)}});return p.setFocusable(!1),{root:i,name:r,description:s,detail:u,actionbar:p,disposables:[p],elementDisposables:[]}}renderPlaceholder(i,e){e.name.textContent="",e.description.textContent="",e.detail.textContent="",e.actionbar.clear(),this.disposeElement(void 0,0,e)}renderElement(i,e,t){this.disposeElement(void 0,0,t),t.name.textContent=i.name,t.description.textContent=i.description,t.elementDisposables.push(ve(n=>{t.root.classList.toggle("disabled",i.kind==="installed"&&!Xf(i.plugin.enablement.read(n)))}));let o=n=>{if(t.actionbar.clear(),i.kind==="marketplace"){t.detail.textContent=i.marketplace;let r=this.instantiationService.createInstance(u9,i);n.store.add(r),t.actionbar.push([r],{icon:!0,label:!0})}else{t.detail.textContent=i.marketplace??"";let r=[],s=i.outdated?.read(n);if(s){let c=this.instantiationService.createInstance(Xbe,i.plugin,s);n.store.add(c),r.push(c)}let l=this.instantiationService.createInstance(P9,()=>mct(i.plugin,this.instantiationService));n.store.add(l),r.push(l),t.actionbar.push(r,{icon:!0,label:!0})}};t.elementDisposables.push(ve(o))}disposeElement(i,e,t){for(let o of t.elementDisposables)o.dispose();t.elementDisposables=[]}disposeTemplate(i){for(let e of i.disposables)e.dispose();this.disposeElement(void 0,0,i)}};Nre=I([m(0,F)],Nre);var Jbe=class extends L9{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(t,o,n,c,u,p,r,h,s,l);this.listOptions=e;this.agentPluginService=g;this.pluginMarketplaceService=f;this.pluginInstallService=v;this.labelService=b;this.editorService=S;this.actionStore=this._register(new O);this.queryCts=new ue;this.list=null;this.listContainer=null;this.currentQuery="@agentPlugins";this.refreshOnPluginsChangedScheduler=this._register(new Dt(()=>{this.list&&this.show(this.currentQuery)},0));this._register(ve(y=>{let w=this.agentPluginService.plugins.read(y);for(let x of w)x.enablement.read(y);this.list&&this.isBodyVisible()&&this.refreshOnPluginsChangedScheduler.schedule()})),this._register(this.pluginMarketplaceService.onDidChangeMarketplaces(()=>{this.list&&this.isBodyVisible()&&this.refreshOnPluginsChangedScheduler.schedule()}))}renderBody(e){super.renderBody(e);let t=D(e,_(".message-container")),o=D(t,_(".message")),n=_(".agent-plugins-list");this.bodyTemplate={pluginsList:n,messageBox:o,messageContainer:t},this.listContainer=D(e,n),this.list=this._register(this.instantiationService.createInstance(r2,`${this.id}-Agent-Plugins`,this.listContainer,{getHeight(){return 72},getTemplateId:()=>Nre.templateId},[this.instantiationService.createInstance(Nre)],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(r){return r?.name??""},getWidgetAriaLabel(){return d(6702,null)}},overrideStyles:IG(this.viewDescriptorService.getViewLocationById(this.id)).listOverrideStyles})),this._register(this.list.onContextMenu(r=>this.onContextMenu(r),this)),this._register(U.debounce(U.filter(this.list.onDidOpen,r=>r.element!==null),(r,s)=>s,75,!0)(r=>{this.editorService.openEditor(this.instantiationService.createInstance(Rre,r.element),r.editorOptions)}))}onContextMenu(e){if(!e.element)return;let t=this.getContextMenuActions(e.element);t.length!==0&&this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t})}getContextMenuActions(e){let t;e.kind==="installed"?(t=mct(e.plugin,this.instantiationService).flatMap(n=>[...n,new oi]),t.length>0&&t.pop()):(t=[],e.readmeUri&&t.push(this.instantiationService.createInstance(ybe,e.readmeUri)),t.push(this.instantiationService.createInstance(u9,e))),this.actionStore.clear();for(let o of t)Sd(o)&&this.actionStore.add(o);return t}layoutBody(e,t){super.layoutBody(e,t),this.list?.layout(e,t)}async show(e){this.currentQuery=e;let t=e.replace(/@agentPlugins/i,"").trim(),o=/^@recommended$/i.test(t),n=/(?:^|\s)@installed(?:\s|$)/i.test(t),r=o?"":t.replace(/(?:^|\s)@installed(?:\s|$)/gi," ").trim().toLowerCase(),s=this.queryInstalled();if(r&&(s=s.filter(u=>u.name.toLowerCase().includes(r)||u.description.toLowerCase().includes(r)||(u.marketplace??"").toLowerCase().includes(r))),o){let u=this.pluginMarketplaceService.recommendedPlugins.get();s=s.filter(p=>{let h=p.plugin.fromMarketplace;if(!h)return!1;let g=`${h.name}@${h.marketplace}`;return u.has(g)})}let l=s;if(!this.listOptions.installedOnly&&!n){let p=await this.queryMarketplacePlugins();if(o){let v=this.pluginMarketplaceService.recommendedPlugins.get();p=p.filter(b=>{let S=`${b.name}@${b.marketplace}`;return v.has(S)})}else{let v=r.toLowerCase();p=p.filter(b=>b.name.toLowerCase().includes(v)||b.description.toLowerCase().includes(v)||b.marketplace.toLowerCase().includes(v))}let h=p.map(uwn),g=new Set(s.map(v=>v.plugin.uri.toString())),f=h.filter(v=>{let b=this.pluginInstallService.getPluginInstallUri({name:v.name,description:v.description,version:"",source:v.source,sourceDescriptor:v.sourceDescriptor,marketplace:v.marketplace,marketplaceReference:v.marketplaceReference,marketplaceType:v.marketplaceType});return!g.has(b.toString())});l=[...s,...f]}let c=new hh(l);return this.list&&(this.list.model=c),this.updateBody(c.length),c}queryInstalled(){let e=ke(o=>{let n=this.pluginMarketplaceService.lastFetchedPlugins.read(o),r=new Map;for(let l of n)r.set(`${l.marketplaceReference.canonicalId}::${l.name}`,l);let s=new Map;for(let l of this.pluginMarketplaceService.installedPlugins.read(o))s.set(l.pluginUri.toString(),l.plugin);return{marketplaceByKey:r,installedByUri:s}});return this.agentPluginService.plugins.get().map(o=>{let n=ke(r=>{let{marketplaceByKey:s,installedByUri:l}=e.read(r),c=l.get(o.uri.toString())??o.fromMarketplace;if(c){let u=`${c.marketplaceReference.canonicalId}::${c.name}`,p=s.get(u);if(p&&OBe(c.sourceDescriptor,p.sourceDescriptor))return p}});return dwn(o,this.labelService,n)})}async queryMarketplacePlugins(){this.queryCts.value?.cancel();let e=new qe;this.queryCts.value=e;try{return await this.pluginMarketplaceService.fetchMarketplacePlugins(e.token)}catch{return[]}}updateBody(e){this.bodyTemplate&&(this.bodyTemplate.pluginsList.classList.toggle("hidden",e===0),this.bodyTemplate.messageContainer.classList.toggle("hidden",e>0),e===0&&this.isBodyVisible()&&(this.bodyTemplate.messageBox.textContent=d(6709,null)))}};Jbe=I([m(2,Le),m(3,Xe),m(4,F),m(5,Pe),m(6,ot),m(7,B),m(8,X),m(9,ji),m(10,Je),m(11,mm),m(12,jC),m(13,uI),m(14,nt),m(15,ie)],Jbe);var LBi=class extends z{constructor(){super({id:"workbench.agentPlugins.browse",title:P(6703,"Agent Plugins"),tooltip:P(6704,"Browse Agent Plugins"),icon:L.search,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),menu:[{id:Qg,group:"1_predefined",order:2,when:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())},{id:R.ViewTitle,when:C.and(C.equals("view",_Z),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),group:"navigation"}]})}async run(i){i.get(Ui).openSearch("@agentPlugins ")}},MBi=class extends z{constructor(){super({id:"workbench.agentPlugins.checkForUpdates",title:P(6705,"Update Plugins"),category:P(6707,"Chat"),precondition:Z.enabled,f1:!0})}async run(i){await i.get(uI).updateAllPlugins({},Ie.None)}},PBi=class extends z{constructor(){super({id:"workbench.agentPlugins.forceUpdate",title:P(6706,"Update Plugins (Force)"),category:P(6707,"Chat"),precondition:Z.enabled,f1:!0})}async run(i){await i.get(uI).updateAllPlugins({force:!0},Ie.None)}},Zbe=class extends k{static{this.ID="workbench.chat.agentPlugins.views.contribution"}constructor(i,e){super();let t=cPt.bindTo(i);this._register(ve(o=>{t.set(e.plugins.read(o).length>0)})),W(LBi),W(MBi),W(PBi),oe.as(Kn.ViewsRegistry).registerViews([{id:_Z,name:P(6701,"Agent Plugins - Installed"),ctorDescriptor:new Vt(Jbe,[{installedOnly:!0}]),when:C.and(zx,cPt,Z.Setup.hidden.negate()),weight:30,order:5,canToggleVisibility:!0},{id:"workbench.views.agentPlugins.default.marketplace",name:P(6700,"Agent Plugins"),ctorDescriptor:new Vt(Jbe,[{}]),when:C.and(zx,cPt.toNegated(),Z.Setup.hidden.negate()),weight:30,order:5,canToggleVisibility:!0,hideByDefault:!0},{id:"workbench.views.agentPlugins.marketplace",name:P(6700,"Agent Plugins"),ctorDescriptor:new Vt(Jbe,[{}]),when:C.and(qNt,Z.Setup.hidden.negate())}],u8t)}};Zbe=I([m(0,X),m(1,mm)],Zbe);bt(Zbe.ID,Zbe,vt.AfterRestored);var nL=class extends _p{constructor(i,e,t,o,n,r,s,l,c){super(i,o.getRawOptions(),t,n,r,s,l,c),this._parentEditor=o,this._overwriteOptions=e,super.updateOptions(this._overwriteOptions),this._register(o.onDidChangeConfiguration(u=>this._onParentConfigurationChanged(u)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(i){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(i){Cp(this._overwriteOptions,i,!0),super.updateOptions(this._overwriteOptions)}};nL=I([m(4,X),m(5,F),m(6,Qt),m(7,br),m(8,Hd)],nL);Ge.registerCommandAlias("interactiveEditor.start","inlineChat.start");var pwn=Oe("start-inline-chat",L.sparkle,d(12421,null)),mwn=C.or(C.and(nl,awo)),Yct=C.and(C.or(mwn,yfe),U2t,me.writable,me.editorSimpleInput.negate()),p8t=class extends z{constructor(){super({id:JQ,title:P(12419,"Open Inline Chat"),shortTitle:P(12420,"Inline Chat"),category:$E.category,f1:!0,precondition:C.and(Yct,C.or(kP.negate(),hoe.negate())),keybinding:{when:C.and(me.focus,Yct,C.or(kP.negate(),hoe.negate())),weight:200,primary:2087},icon:pwn,menu:[{id:R.EditorContext,group:"1_chat",order:3,when:C.and(Yct,C.or(kP.negate(),hoe.negate()))},{id:R.ChatTitleBarMenu,group:"a_open",order:3}]})}run(i,...e){let o=i.get(Qt).getActiveCodeEditor();if(!(!o||o.isSimpleWidget))return o.invokeWithinContext(n=>{let r=n.get(X),s=n.get(re);if(!r.contextMatchesRules(this.desc.precondition??void 0)){s.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this._runEditorCommand(n,o,...e)})}async _runEditorCommand(i,e,...t){let o=fu.get(e);if(!o)return;let n,r=t[0];r&&qst.isInlineChatRunOptions(r)&&(n=r),await o?.run({...n})}};be.appendMenuItem(R.InlineChatEditorAffordance,{group:"0_chat",order:1,when:C.and(me.writable,me.hasNonEmptySelection,C.or(kP.negate(),hoe.negate()),Xn.Setup.hidden.negate()),command:{id:JQ,title:d(12413,null),shortTitle:d(12414,null),icon:L.sparkle}});var m8t=class extends yl{constructor(){super({id:"inlineChat.focus",title:P(12416,"Focus Input"),f1:!0,category:$E.category,precondition:C.and(me.editorTextFocus,XU,Nq.negate(),Oa.negate()),keybinding:[{weight:10,when:C.and(yrt.isEqualTo("above"),me.isEmbeddedDiffEditor.negate()),primary:2066},{weight:10,when:C.and(yrt.isEqualTo("below"),me.isEmbeddedDiffEditor.negate()),primary:2064}]})}runEditorCommand(i,e,...t){fu.get(e)?.focus()}},$E=class a extends yl{static{this.category=P(12409,"Inline Chat")}constructor(i){let e=t=>{if(Array.isArray(t))for(let o of t)o.when=C.and(yfe,o.when);else t&&(t.when=C.and(yfe,t.when))};Array.isArray(i.menu),e(i.menu),super({...i,category:a.category,precondition:C.and(yfe,i.precondition)})}runEditorCommand(i,e,...t){let o=i.get(ie),n=i.get(re),r=fu.get(e);if(!r){let{activeTextEditorControl:s}=o;fn(s)?e=s:Lc(s)&&(e=s.getModifiedEditor()),r=fu.get(e)}if(!r){n.warn("[IE] NO controller found for action",this.desc.id,e.getModel()?.uri);return}if(e instanceof Ed&&(e=e.getParentEditor()),!r){for(let s of i.get(Qt).listDiffEditors())(s.getOriginalEditor()===e||s.getModifiedEditor()===e)&&s instanceof nL&&this.runEditorCommand(i,s.getParentEditor(),...t);return}this.runInlineChatCommand(i,r,e,...t)}},h8t=class extends $E{constructor(){super({id:"inlineChat.fixDiagnostics",title:P(12415,"Fix"),icon:L.editSparkle,precondition:C.and(wrt,me.selectionHasDiagnostics,kP.negate()),menu:[{id:R.InlineChatEditorAffordance,group:"1_quickfix",order:100,when:C.and(wrt,me.selectionHasDiagnostics,kP.negate())},{id:R.ChatEditorInlineMenu,group:"2_chat",order:1,when:C.and(wrt,me.selectionHasDiagnostics,kP.negate())},{id:R.MarkerHoverStatusBar,group:"1_fix",order:1,when:C.and(wrt,kP.negate()),precondition:null}]})}runInlineChatCommand(i,e,t,...o){e.run({autoSend:!0,attachDiagnostics:!0})}},Xct=class extends $E{constructor(e,t){super(t);this._keep=e}async runInlineChatCommand(e,t,o,...n){this._keep?await t.acceptSession():await t.rejectSession(),o.hasModel()&&o.setSelection(o.getSelection().collapseToStart())}},g8t=class extends Xct{constructor(){super(!0,{id:"inlineChat2.keep",title:P(12417,"Keep"),f1:!0,icon:L.check,precondition:C.and(XU,EP.negate(),Cb),keybinding:[{when:C.and(Z.inputHasFocus,Z.inputHasText.negate()),weight:200,primary:3},{weight:210,primary:2051}],menu:[{id:R.ChatEditorInlineExecute,group:"navigation",order:4,when:C.and(EP.negate(),Cb,Z.inputHasText.toNegated())}]})}},f8t=class extends Xct{constructor(){super(!1,{id:"inlineChat2.close",title:P(12410,"Close"),f1:!0,icon:L.close,precondition:C.and(XU),keybinding:[{when:C.or(C.and(me.focus,Cb.negate()),Z.inputHasFocus),weight:201,primary:9}],menu:[{id:R.ChatEditorInlineExecute,group:"navigation",order:100}]})}},v8t=class extends Xct{constructor(){super(!1,{id:"inlineChat2.cancel",title:P(12408,"Cancel"),precondition:C.and(XU,EP),keybinding:[{when:C.or(me.focus,Z.inputHasFocus),weight:201,primary:9}],menu:[]})}},b8t=class extends $E{constructor(){super({id:"inlineChat2.continueInChat",title:P(12411,"Ask in Chat"),icon:L.chatSparkle,precondition:C.and(XU,Ife),menu:[{id:R.ChatEditorInlineExecute,group:"navigation",order:2,when:Ife}]})}async runInlineChatCommand(i,e,t){await e.continueSessionInChat()}},S8t=class extends $E{constructor(){super({id:"inlineChat2.rephrase",title:P(12418,"Rephrase"),precondition:C.and(XU,Ife),menu:[{id:R.ChatEditorInlineExecute,group:"navigation",order:1,when:Ife}]})}async runInlineChatCommand(i,e,t){await e.rephraseSession()}},I8t=class extends yl{constructor(){super({id:G2t,title:P(12407,"Ask in Chat"),category:$E.category,f1:!0,precondition:C.and(Yct,kP,hoe),keybinding:{when:me.focus,weight:200,primary:2087},icon:L.chatSparkle,menu:[{id:R.EditorContext,group:"1_chat",order:3,when:C.and(Yct,kP,hoe)},{id:R.InlineChatEditorAffordance,group:"0_chat",order:1,when:C.and(me.hasNonEmptySelection,kP,hoe)}]})}async runEditorCommand(i,e){let t=i.get(mu),o=i.get(Lt);if(!e.hasModel())return;let n=t.editingSessionsObs.get().find(l=>l.getEntry(e.getModel().uri));if(!n)return;let r=await o.openSession(n.chatSessionResource);if(!r)return;let s=e.getSelection();s&&!s.isEmpty()&&await r.attachmentModel.addFile(e.getModel().uri,s)}},y8t=class extends yl{constructor(){super({id:"inlineChat.dismissEditorAffordance",title:P(12412,"Dismiss Editor Affordance"),precondition:C.and(K2t,C.equals("config.inlineChat.affordance","editor")),keybinding:{when:me.editorTextFocus,weight:100,primary:9}})}runEditorCommand(i,e){fu.get(e)?.inputOverlayWidget.dismiss()}};var XUe=class{$aw=new O;constructor(i,e){this.$aw.add(i.onWillStartSession(t=>{let o=sn.parse(t.getModel().uri);if(o){for(let n of e.listNotebookEditors())if(ze(n.textModel?.uri,o.notebook)){let r=!1,s=[];for(let[,l]of n.codeEditors)s.push(l),r=l===t||r;if(r){for(let l of s)l!==t&&fu.get(l)?.acceptSession();break}}}}))}dispose(){this.$aw.dispose()}};XUe=I([m(0,cy),m(1,hd)],XUe);var CPo=class a extends Error{static{this.code="InlineChatError"}constructor(i){super(i),this.name=a.code}},JUe=class{constructor(i,e){this.$ax=new O;this.$ay=new dt;this.$az=this.$ax.add(new T);this.onWillStartSession=this.$az.event;this.$aA=this.$ax.add(new T);this.onDidChangeSessions=this.$aA.event;this.$aB=i;let t=vi(this,e.onDidChangeAgents,()=>e.getDefaultAgent("editor"));this.$ax.add(ve(o=>{t.read(o)||(je(this.$ay.values()),this.$ay.clear())}))}$ax;$ay;$az;$aA;$aB;dispose(){this.$ax.dispose()}createSession(i){let e=i.getModel().uri;if(this.$ay.has(e))throw new Error("Session already exists");this.$az.fire(i);let t=this.$aB.startNewLocalSession("editor",{canUseTools:!1}),o=t.object;o.startEditingSession(!1);let n=De(this,void 0),r=new O;r.add(ee(()=>{this.$aB.cancelCurrentRequestForSession(o.sessionResource,"inlineChatSession"),o.editingSession?.reject(),this.$ay.delete(e),this.$aA.fire(this)})),r.add(t),r.add(ve(l=>{let c=o.editingSession?.entries.read(l);if(!c?.length)return;let u=c.find(h=>ze(h.modifiedURI,e))?.state.read(l);if(u===1||u===2){let h=o.getRequests().at(-1)?.response;h&&this.$aB.notifyUserAction({sessionResource:h.session.sessionResource,requestId:h.requestId,agentId:h.agent?.id,command:h.slashCommand?.name,result:h.result,action:{kind:"inlineChat",action:u===1?"accepted":"discarded"}})}c.every(h=>{let g=h.state.read(l);return(g===1||g===2)&&!h.isCurrentlyBeingModifiedBy.read(l)})&&!o.requestInProgress.read(void 0)&&r.dispose()}));let s={uri:e,initialPosition:i.getSelection().getStartPosition().delta(-1),initialSelection:i.getSelection(),chatModel:o,editingSession:o.editingSession,terminationState:n,setTerminationState:l=>{n.set(l,void 0),this.$aA.fire(this)},dispose:r.dispose.bind(r)};return this.$ay.set(e,s),this.$aA.fire(this),s}getSessionByTextModel(i){let e=this.$ay.get(i);if(!e){for(let[t,o]of this.$ay)if(o.editingSession.getEntry(i)){e=o;break}}return e}getSessionBySessionUri(i){for(let e of this.$ay.values())if(ze(e.chatModel.sessionResource,i))return e}};JUe=I([m(0,si),m(1,gr)],JUe);var eSe=class{static{this.Id="inlineChat.enabler"}$aC;$aD;$aE;$aF=new O;constructor(i,e,t,o){this.$aC=yMi.bindTo(i),this.$aD=wMi.bindTo(i),this.$aE=U2t.bindTo(i);let n=vi(this,e.onDidChangeAgents,()=>e.getDefaultAgent("editor")),r=vi(this,e.onDidChangeAgents,()=>e.getDefaultAgent("notebook")),s=hr("inlineChat.notebookAgent",!1,o);this.$aF.add(ve(c=>{n.read(c)?this.$aC.set(!0):this.$aC.reset()})),this.$aF.add(ve(c=>{this.$aD.set(s.read(c)&&!!r.read(c))}));let l=()=>{let c=t.activeEditorPane?.getControl(),u=fn(c)||Lc(c)||CF(c);this.$aE.set(u)};this.$aF.add(t.onDidActiveEditorChange(l)),l()}dispose(){this.$aE.reset(),this.$aC.reset(),this.$aF.dispose()}};eSe=I([m(0,X),m(1,gr),m(2,ie),m(3,B)],eSe);var A9=class extends k{static{this.Id="inlineChat.escapeTool"}static $aG={id:"inline_chat_exit",source:wn.Internal,canBeReferencedInPrompt:!1,alwaysDisplayInputOutput:!1,displayName:d(12429,null),modelDescription:"Show a short textual response when not being able to make code changes and when not having been asked for code changes. Can also be used to move the request to the richer panel chat which supports edits across files, creating and deleting files, multi-turn conversations between the user and the assistant, and access to more IDE tools, like retrieve problems, interact with source control, run terminal commands etc.",inputSchema:{type:"object",additionalProperties:!1,properties:{response:{type:"string",description:d(12430,null),maxLength:200}}}};constructor(i,e,t){super(),this._store.add(i.registerTool(A9.$aG,{invoke:async(o,n,r,s)=>{let l=o.context?.sessionResource;if(!l)return t.warn("InlineChatEscapeToolContribution: no sessionId in tool invocation context"),{content:[{kind:"text",value:"Cancel"}]};let c=e.getSessionBySessionUri(l);if(!c)return t.warn(`InlineChatEscapeToolContribution: no session found for id ${l}`),{content:[{kind:"text",value:"Cancel"}]};if(!c.chatModel.getRequests().at(-1))return t.warn(`InlineChatEscapeToolContribution: no request found for id ${l}`),{content:[{kind:"text",value:"Cancel"}],toolResultMessage:d(12432,null)};let p=typeof o.parameters?.response=="string"&&o.parameters.response.trim().length>0?o.parameters.response.trim():d(12431,null);return c.setTerminationState(p),{content:[{kind:"text",value:"Success"}]}}}))}};A9=I([m(0,Wn),m(1,cy),m(2,re)],A9);var w8t=class{constructor(){this.priority=106;this.name="inlineChat";this.type="help";this.when=C.or(z2t,Z.inputHasFocus)}getProvider(i){let e=i.get(Qt).getActiveCodeEditor()||i.get(Qt).getFocusedCodeEditor();if(e)return IBe(i,e,"inlineChat")}};var C8t=_9(),H$=class extends LO{static{this.ID="workbench.contrib.inlineChatDefaultModel"}static{this.modelIds=C8t.modelIds}static{this.modelLabels=C8t.modelLabels}static{this.modelDescriptions=C8t.modelDescriptions}constructor(i,e){super(C8t,{configKey:"inlineChat.defaultModel",configSectionId:"inlineChat",logPrefix:"[InlineChatDefaultModel]",filter:t=>!!t.capabilities?.toolCalling},i,e)}};H$=I([m(0,Gr),m(1,re)],H$);oe.as($t.Configuration).registerConfiguration({id:"inlineChat",title:d(12427,null),order:30,type:"object",properties:{"inlineChat.defaultModel":{description:d(12428,null),type:"string",default:"",order:1,enum:H$.modelIds,enumItemLabels:H$.modelLabels,markdownEnumDescriptions:H$.modelDescriptions}}});Eo(fu.ID,fu,0);W(g8t);W(f8t);W(v8t);W(b8t);W(S8t);Ce(cy,JUe,1);W(p8t);W(I8t);W(m8t);W(h8t);W(y8t);bt("inlineChat.notebooks",XUe,vt.AfterRestored);bt(H$.ID,H$,vt.BlockRestore);bt(eSe.Id,eSe,vt.AfterRestored);bt(A9.Id,A9,vt.AfterRestored);_a.register(new w8t);var xPo="mcp.extCachedServers",gwn=zn.registerExtensionPoint(gSo);var Ore=class extends k{constructor(e,t,o,n){super();this._mcpRegistry=e;this._extensionService=o;this._contextKeyService=n;this.fromGallery=!1;this._extensionCollectionIdsToPersist=new Map;this._conditionalCollections=this._register(new Ot);this.cachedServers=t.getObject(xPo,1,{}),this._register(t.onWillSaveState(()=>{let r=!1;for(let[s,l]of this._extensionCollectionIdsToPersist.entries()){let c=this._mcpRegistry.collections.get().find(p=>p.id===s),u=c?.serverDefinitions.get();if(!c||c.lazy)if(l===1)u=[];else continue;u&&(r=!0,this.cachedServers[s]={servers:u.map(GH.toSerialized)})}r&&t.store(xPo,this.cachedServers,1,1)}))}start(){let e=this._register(new Ot);this._register(gwn.setHandler((t,o)=>{let{added:n,removed:r}=o;for(let s of r)for(let l of s.value){let c=RJe(s.description.identifier,l.id);e.deleteAndDispose(c),this._conditionalCollections.deleteAndDispose(c)}for(let s of n)if(Ore._validate(s))for(let l of s.value){let c=RJe(s.description.identifier,l.id);this._extensionCollectionIdsToPersist.set(c,0),l.when?this._registerConditionalCollection(c,l,s,e):this._registerCollection(c,l,s,e)}}))}_registerCollection(e,t,o,n){let r=this.cachedServers.hasOwnProperty(e)?this.cachedServers[e].servers:void 0,s=this._mcpRegistry.registerCollection({id:e,label:t.label,remoteAuthority:null,trustBehavior:TC.Kind.Trusted,scope:1,configTarget:2,order:300,serverDefinitions:De(this,r?.map(GH.fromSerialized)||[]),lazy:{isCached:!!r,load:()=>this._activateExtensionServers(t.id).then(()=>{this._extensionCollectionIdsToPersist.set(e,1)}),removed:()=>{n.deleteAndDispose(e),this._conditionalCollections.deleteAndDispose(e)}},source:o.description.identifier});n.set(e,s)}_registerConditionalCollection(e,t,o,n){let r=C.deserialize(t.when);if(!r)return;let s=()=>{let c=this._contextKeyService.contextMatchesRules(r),u=n.has(e);c&&!u?this._registerCollection(e,t,o,n):!c&&u&&n.deleteAndDispose(e)},l=this._contextKeyService.onDidChangeContext(s);s(),this._conditionalCollections.set(e,l)}async _activateExtensionServers(e){await this._extensionService.activateByEvent(int(e)),await Promise.all(this._mcpRegistry.delegates.get().map(t=>t.waitForInitialProviderPromises()))}static _validate(e){if(!Array.isArray(e.value))return e.collector.error(d(13175,null)),!1;for(let t of e.value){if(typeof t.id!="string"||_c(t.id))return e.collector.error(d(13176,null)),!1;if(typeof t.label!="string"||_c(t.label))return e.collector.error(d(13177,null)),!1;if(t.when!==void 0&&(typeof t.when!="string"||_c(t.when)))return e.collector.error(d(13178,null)),!1}return!0}};Ore=I([m(0,xc),m(1,de),m(2,lt),m(3,X)],Ore);var kPo=a=>{let i=xM(a.model.getValue()),e=Tx(i,a.pathToServers);if(!e||e.type!=="object")return new Map;let t=new Map;for(let o of e.children||[]){if(o.type!=="property"||o.children?.[0]?.type!=="string")continue;let n=a.model.getPositionAt(o.offset),r=a.model.getPositionAt(o.offset+o.length);t.set(o.children[0].value,{uri:a.model.uri,range:{startLineNumber:n.lineNumber,startColumn:n.column,endLineNumber:r.lineNumber,endColumn:r.column}})}return t};var ZUe=class extends k{constructor(e,t,o,n){super();this.mcpWorkbenchService=e;this.mcpRegistry=t;this.textModelService=o;this.logService=n;this.fromGallery=!0;this.collections=this._register(new Ot)}start(){let e=this._register(new am);this._register(this.mcpWorkbenchService.onChange(()=>e.queue(()=>this.sync()))),this.sync()}async getServerIdMapping(e,t){let o=new O;try{let n=await this.textModelService.createModelReference(e);return o.add(n),kPo({model:n.object.textEditorModel,pathToServers:t})}catch{return new Map}finally{o.dispose()}}async sync(){try{let e=new Map,t=new dt;for(let o of this.mcpWorkbenchService.getEnabledLocalMcpServers()){let n=t.get(o.mcpResource);n||(n=(async p=>{let h=this.mcpWorkbenchService.getMcpConfigPath(p),g=h?.uri?await this.getServerIdMapping(h?.uri,h.section?[...h.section,"servers"]:["servers"]):new Map;return h?{...h,locations:g}:void 0})(o),t.set(o.mcpResource,n));let r=o.config,s=await n,l=`mcp.config.${s?s.id:"unknown"}`,c=e.get(l);c||(c=[s,[]],e.set(l,c));let u=r.type==="http"?{type:2,uri:A.parse(r.url),headers:Object.entries(r.headers||{}),oauth:r.oauth}:{type:1,command:r.command,args:r.args||[],env:r.env||{},envFile:r.envFile,cwd:r.cwd,sandbox:o.rootSandbox};c[1].push({id:`${l}.${o.name}`,label:o.name,launch:u,sandboxEnabled:r.type==="http"?void 0:r.sandboxEnabled,cacheNonce:await yN.hash(u),roots:s?.workspaceFolder?[s.workspaceFolder.uri]:void 0,variableReplacement:{folder:s?.workspaceFolder,section:jW,target:s?.target??2},devMode:r.dev,presentation:{order:s?.order,origin:s?.locations.get(o.name)}})}for(let[o]of this.collections)e.has(o)||this.collections.deleteAndDispose(o);for(let[o,[n,r]]of e){let s=De(this,r),l={id:o,label:n?.label??"",order:n?.order??200,presentation:{origin:n?.uri},remoteAuthority:n?.remoteAuthority??null,serverDefinitions:s,trustBehavior:TC.Kind.Trusted,configTarget:n?.target??2,scope:n?.scope??0},c=this.collections.get(o);if(!(c?!byi.equals(c.definition,l):!0)){(!c||!eo(c.definition.serverDefinitions.get(),l.serverDefinitions.get(),GH.equals))&&c?.serverDefinitions.set(r,void 0);continue}this.collections.deleteAndDispose(o);let p=this.mcpRegistry.registerCollection(l);this.collections.set(o,{definition:l,serverDefinitions:s,dispose:()=>p.dispose()})}}catch(e){this.logService.error(e)}}};ZUe=I([m(0,bf),m(1,xc),m(2,Bt),m(3,re)],ZUe);var ABi=class{constructor(){this._discovery=[]}register(i){this._discovery.push(i)}getAll(){return this._discovery}},R1=new ABi;var Caf=le("INativeMcpDiscoveryHelperService"),x8t="NativeMcpDiscoveryHelper";async function Jct(a,i,e){let t;try{t=JSON.parse(i.toString())}catch{return}return Promise.all(Object.entries(t.mcpServers).map(async([o,n])=>{let r=n.url?{type:2,uri:A.parse(n.url),headers:[]}:{type:1,args:n.args||[],command:n.command,env:n.env||{},envFile:void 0,cwd:e?.fsPath,sandbox:void 0};return{id:`${a}.${o}`,label:o,launch:r,cacheNonce:await yN.hash(r)}}))}var e1e=class{constructor(i){this.remoteAuthority=i;this.order=400;this.discoverySource="claude-desktop";this.id=`claude-desktop.${this.remoteAuthority}`}getFilePath({platform:i,winAppData:e,xdgHome:t,homedir:o}){if(i===3){let n=e||A.joinPath(o,"AppData","Roaming");return A.joinPath(n,"Claude","claude_desktop_config.json")}else{if(i===1)return A.joinPath(o,"Library","Application Support","Claude","claude_desktop_config.json");{let n=t||A.joinPath(o,".config");return A.joinPath(n,"Claude","claude_desktop_config.json")}}}adaptFile(i,{homedir:e}){return Jct(this.id,i,e)}},k8t=class extends e1e{constructor(e){super(e);this.discoverySource="windsurf";this.id=`windsurf.${this.remoteAuthority}`}getFilePath({homedir:e}){return A.joinPath(e,".codeium","windsurf","mcp_config.json")}},E8t=class extends e1e{constructor(e){super(e);this.discoverySource="cursor-global";this.id=`cursor.${this.remoteAuthority}`}getFilePath({homedir:e}){return A.joinPath(e,".cursor","mcp.json")}};var tSe=class extends k{constructor(e,t,o){super();this._fileService=t;this._mcpRegistry=o;this.fromGallery=!1;this._fsDiscoveryEnabled=hr(xie,void 0,e)}_isDiscoveryEnabled(e,t){let o=this._fsDiscoveryEnabled.read(e);return typeof o=="boolean"?o:!!(t&&o?.[t]===!0)}watchFile(e,t,o,n){let r=new O,s=r.add(new ue),l=async()=>{let c=[];try{let u=await this._fileService.readFile(e);c=await n(u.value)||[]}catch{}c.length?(t.serverDefinitions.set(c,void 0),s.value||(s.value=this._mcpRegistry.registerCollection(t))):s.clear()};return r.add(ve(c=>{if(!this._isDiscoveryEnabled(c,o)){s.clear();return}let u=c.store.add(new Dt(l,500)),p=c.store.add(this._fileService.createWatcher(e,{recursive:!1,excludes:[]}));c.store.add(p.onDidChange(()=>u.schedule())),l()})),r}};tSe=I([m(0,B),m(1,ge),m(2,xc)],tSe);var Fre=class extends tSe{constructor(e,t,o,n,r,s){super(s,o,r);this.suffix="";e&&(this.suffix=" "+d(13179,null,t.getHostLabel(Q.vscodeRemote,e))),this.adapters=[n.createInstance(e1e,e),n.createInstance(E8t,e),n.createInstance(k8t,e)]}setDetails(e){if(!e)return;let t={...e,homedir:A.revive(e.homedir),xdgHome:e.xdgHome?A.revive(e.xdgHome):void 0,winAppData:e.winAppData?A.revive(e.winAppData):void 0};for(let o of this.adapters){let n=o.getFilePath(t);if(!n)continue;let r={id:o.id,label:dSo[o.discoverySource]+this.suffix,remoteAuthority:o.remoteAuthority,configTarget:2,scope:0,trustBehavior:TC.Kind.TrustedOnNonce,serverDefinitions:De(this,[]),order:o.order+(o.remoteAuthority?-50:0),presentation:{origin:n}};this._register(this.watchFile(n,r,o.discoverySource,s=>o.adaptFile(s,t)))}}};Fre=I([m(1,nt),m(2,ge),m(3,F),m(4,xc),m(5,B)],Fre);var t1e=class extends Fre{constructor(e,t,o,n,r,s,l){super(e.getConnection()?.remoteAuthority||null,o,n,r,s,l);this.remoteAgent=e;this.logService=t}async start(){let e=this.remoteAgent.getConnection();if(!e)return this.setDetails(void 0);await e.withChannel(x8t,async t=>{Xd.toService(t).load().then(n=>this.setDetails(n),n=>{this.logService.warn("Error getting remote process MCP environment",n),this.setDetails(void 0)})})}};t1e=I([m(0,bo),m(1,re),m(2,nt),m(3,ge),m(4,F),m(5,xc),m(6,B)],t1e);var i1e=class extends k{constructor(e,t){super();this._agentPluginService=e;this._mcpRegistry=t;this.fromGallery=!1;this._collections=this._register(new bI)}start(){this._register(ve(e=>{let t=this._agentPluginService.plugins.read(e),o=new xn;for(let n of t){if(!Xf(n.enablement.read(e)))continue;let r=n.mcpServerDefinitions.read(e);if(r.length===0)continue;o.add(n.uri);let s=this._collections.get(n.uri);s||(s=this.createCollectionState(n,r[0].uri),this._collections.set(n.uri,s))}for(let[n]of this._collections)o.has(n)||this._collections.deleteAndDispose(n)}))}createCollectionState(e,t){let o=`plugin.${e.uri}`;return this._mcpRegistry.registerCollection({id:o,label:`${e.label} (Agent Plugin)`,remoteAuthority:e.uri.scheme===Q.vscodeRemote?e.uri.authority:null,configTarget:2,scope:0,trustBehavior:TC.Kind.Trusted,serverDefinitions:e.mcpServerDefinitions.map(n=>n.map(r=>this._toServerDefinition(o,r)).filter(so)),order:350,presentation:{origin:t}})}_toServerDefinition(e,{name:t,configuration:o}){let n=this._toLaunch(o);if(n)return{id:`${e}.${t}`,label:t,launch:n,variableReplacement:{target:2},cacheNonce:String(Lr(n))}}_toLaunch(e){if(e.type==="stdio")return{type:1,command:e.command,args:e.args?[...e.args]:[],env:e.env?{...e.env}:{},envFile:e.envFile,cwd:e.cwd,sandbox:void 0};try{return{type:2,uri:A.parse(e.url),headers:Object.entries(e.headers??{}),oauth:e.oauth}}catch{return}}};i1e=I([m(0,mm),m(1,xc)],i1e);var o1e=class extends tSe{constructor(e,t,o,n,r){super(n,e,o);this._workspaceContextService=t;this._remoteAgentService=r;this._collections=this._register(new Ot)}start(){this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(e=>{for(let t of e.removed)this._collections.deleteAndDispose(t.uri.toString());for(let t of e.added)this.watchFolder(t)}));for(let e of this._workspaceContextService.getWorkspace().folders)this.watchFolder(e)}watchFolder(e){let t=Ve(e.uri,".cursor","mcp.json"),o={id:`cursor-workspace.${e.index}`,label:`${e.name}/.cursor/mcp.json`,remoteAuthority:this._remoteAgentService.getConnection()?.remoteAuthority||null,scope:1,trustBehavior:TC.Kind.TrustedOnNonce,serverDefinitions:De(this,[]),configTarget:6,order:1,presentation:{origin:t}};this._collections.set(e.uri.toString(),this.watchFile(A.joinPath(e.uri,".cursor","mcp.json"),o,"cursor-workspace",async n=>{let r=await Jct(o.id,n,e.uri);return r?.forEach(s=>s.roots=[e.uri]),r}))}};o1e=I([m(0,ge),m(1,Ae),m(2,xc),m(3,B),m(4,bo)],o1e);var n1e=class extends k{constructor(e,t,o,n){super();this._fileService=e;this._workspaceContextService=t;this._mcpRegistry=o;this._remoteAgentService=n;this.fromGallery=!1;this._collections=this._register(new Ot)}start(){this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(e=>{for(let t of e.removed)this._collections.deleteAndDispose(t.uri.toString());for(let t of e.added)this._watchFolder(t)}));for(let e of this._workspaceContextService.getWorkspace().folders)this._watchFolder(e)}_watchFolder(e){let t=Ve(e.uri,".mcp.json"),o=`workspace-dot-mcp.${e.index}`,n=De(this,[]),r={id:o,label:`${e.name}/.mcp.json`,remoteAuthority:this._remoteAgentService.getConnection()?.remoteAuthority||null,scope:1,trustBehavior:TC.Kind.TrustedOnNonce,serverDefinitions:n,configTarget:6,order:1,presentation:{origin:t}},s=new O,l=s.add(new ue),c=async()=>{let h=[];try{let g=await this._fileService.readFile(t),f=await Jct(o,g.value,e.uri);if(f){for(let v of f)v.roots=[e.uri];h=f}}catch{}h.length?(n.set(h,void 0),l.value||(l.value=this._mcpRegistry.registerCollection(r))):l.clear()},u=s.add(new Dt(c,500)),p=s.add(this._fileService.createWatcher(t,{recursive:!1,excludes:[]}));s.add(p.onDidChange(()=>u.schedule())),c(),this._collections.set(e.uri.toString(),s)}};n1e=I([m(0,ge),m(1,Ae),m(2,xc),m(3,bo)],n1e);var L1;(o=>(o.serverCount=new Y("mcp.serverCount",void 0,{type:"number",description:d(13224,null)}),o.hasUnknownTools=new Y("mcp.hasUnknownTools",void 0,{type:"boolean",description:d(13223,null)}),o.hasServersWithErrors=new Y("mcp.hasServersWithErrors",void 0,{type:"boolean",description:d(13222,null)}),o.toolsCount=new Y("mcp.toolsCount",void 0,{type:"number",description:d(13225,null)})))(L1||={});var r1e=class extends k{static{this.ID="workbench.contrib.mcp.contextKey"}constructor(i,e){super();let t=L1.serverCount.bindTo(e),o=L1.toolsCount.bindTo(e),n=L1.hasUnknownTools.bindTo(e);this._store.add(cu(L1.hasServersWithErrors,e,r=>i.servers.read(r).some(s=>s.connectionState.read(r).state===Sr.Kind.Error))),this._store.add(ve(r=>{let s=i.servers.read(r),l=s.map(c=>c.tools.read(r));t.set(s.length),o.set(l.reduce((c,u)=>c+u.length,0)),n.set(i.lazyCollectionState.read(r).state!==2||s.some(c=>{let u=c.cacheState.read(r);return u===0||u===2||u===3}))}))}};r1e=I([m(0,Vs),m(1,X)],r1e);var s1e=le("imageResizeMainService");var iSe=class extends k{constructor(e,t,o,n,r){super();this._toolsService=e;this._instantiationService=o;this._mcpRegistry=n;this.lifecycleService=r;let s=this._register(new Ot);this._register(ve(l=>{let c=t.servers.read(l),u=new Set(s.keys());for(let p of c){if(!Xf(p.enablement.read(l)))continue;let h=s.get(p);if(h){if(u.delete(p),!h.source||Qi(h.source,VFe(p,l)))continue;h.dispose()}let g=new O,f={dispose:()=>g.dispose()},v=new uo(()=>{let b=f.source=VFe(p),S=p.definition.label.toLowerCase().replace(/\s+/g,"-");return{toolSet:g.add(this._toolsService.createToolSet(b,p.definition.id,S,{icon:L.mcp,description:d(13229,null,p.definition.label)})),source:b}});this._syncTools(p,v,g),s.set(p,f)}for(let p of u)s.deleteAndDispose(p)}))}static{this.ID="workbench.contrib.mcp.languageModelTools"}_syncTools(e,t,o){let n=new Map,r=this._mcpRegistry.collections.map(s=>s.find(l=>l.id===e.collection.id));o.add(ve(s=>{let l=new Set(n.keys()),c=[],u=(h,g,f)=>{f.add(this._toolsService.registerTool(g,this._instantiationService.createInstance(Zct,h,e))),f.add(t.value.toolSet.addTool(g))};if(this.lifecycleService.willShutdown)return;let p=r.read(s);if(!p){n.forEach(h=>h.store.dispose()),n.clear();return}for(let h of e.tools.read(s)){if(!(h.visibility&1))continue;let g=n.get(h.id),f=h.icons.getUrl(22),v={id:h.id,source:t.value.source,icon:f||L.tools,displayName:h.definition.annotations?.title||h.definition.title||h.definition.name,toolReferenceName:h.referenceName,modelDescription:h.definition.description??"",userDescription:h.definition.description??"",inputSchema:h.definition.inputSchema,canBeReferencedInPrompt:!0,alwaysDisplayInputOutput:!0,canRequestPreApproval:!h.definition.annotations?.readOnlyHint,canRequestPostApproval:!!h.definition.annotations?.openWorldHint,runsInWorkspace:p?.scope===1||!!p?.remoteAuthority,tags:["mcp"]};if(g)Qi(g.toolData,v)||(g.toolData=v,g.store.clear(),u(h,v,g.store)),l.delete(h.id);else{let b=new O;c.push(()=>u(h,v,b)),n.set(h.id,{toolData:v,store:b})}}for(let h of l){let g=n.get(h);g&&(g.store.dispose(),n.delete(h))}for(let h of c)h();this._toolsService.flushToolUpdates()})),o.add(ee(()=>{for(let s of n.values())s.store.dispose()}))}};iSe=I([m(0,Wn),m(1,Vs),m(2,F),m(3,xc),m(4,to)],iSe);var Zct=class{constructor(i,e,t,o,n,r){this._tool=i;this._server=e;this._configurationService=t;this._productService=o;this._fileService=n;this._imageResizeService=r}async prepareToolInvocation(i){let e=this._tool,t=this._server,n=await kb.callOn(t,async(u,p)=>p.definition.sandboxEnabled)===!0,r=d(13228,null,this._productService.nameShort),s=e.definition.annotations?.title||e.definition.title||"`"+e.definition.name+"`",l;n||(l={},e.definition.annotations?.readOnlyHint||(l.title=new he(d(13233,null,s)),l.message=new he(e.definition.description,{supportThemeIcons:!0}),l.disclaimer=r,l.allowAutoConfirm=!0),e.definition.annotations?.openWorldHint&&(l.confirmResults=!0));let c=this._configurationService.getValue(wzt);return{confirmationMessages:l,invocationMessage:new he(d(13231,null,s)),pastTenseMessage:new he(d(13230,null,s)),originMessage:d(13232,null,t.definition.label),toolSpecificData:{kind:"input",rawInput:i.parameters,mcpAppData:c&&e.uiResourceUri?{resourceUri:e.uiResourceUri,serverDefinitionId:t.definition.id,collectionId:t.collection.id}:void 0}}}async invoke(i,e,t,o){let n={content:[]},r=await this._tool.callWithProgress(i.parameters,t,{chatRequestId:i.chatRequestId,chatSessionResource:i.context?.sessionResource,traceparent:i.traceparent,tracestate:i.tracestate},o),s={input:JSON.stringify(i.parameters,void 0,2),output:[],isError:r.isError===!0};for(let l of r.content){let c=l.annotations?.audience?.map(g=>g==="assistant"?0:g==="user"?1:void 0).filter(so);c?.includes(1)&&l.type==="text"&&t.report({message:l.text});let u=async(g,f,v)=>{if(s.output.push({type:"embed",mimeType:g,value:f,uri:v,audience:c}),h){let b;try{let S=await this._imageResizeService.resizeImage(Ws(f).buffer,g);b=Ke.wrap(S)}catch{b=Ws(f)}n.content.push({kind:"data",value:{mimeType:g,data:b},audience:c})}},p=(g,f)=>{let v={uri:g,underlyingMimeType:f};n.content.push({kind:"data",audience:c,value:{mimeType:Ldo,data:Ke.fromString(JSON.stringify(v))}})},h=!c||c.includes(0);if(l.type==="text")s.output.push({type:"embed",isText:!0,value:l.text}),h&&!r.structuredContent&&n.content.push({kind:"text",audience:c,value:l.text});else if(l.type==="image"||l.type==="audio")await u(l.mimeType||"image/png",l.data);else if(l.type==="resource_link"){let g=_C.fromServer(this._server.definition,l.uri);s.output.push({type:"ref",uri:g,audience:c,mimeType:l.mimeType}),h&&(l.mimeType&&R8(l.mimeType)?n.content.push({kind:"data",audience:c,value:{mimeType:l.mimeType,data:await this._fileService.readFile(g).then(f=>f.value).catch(()=>Ke.alloc(0))}}):p(g,l.mimeType))}else if(l.type==="resource"){let g=_C.fromServer(this._server.definition,l.resource.uri);if(l.resource.mimeType&&R8(l.resource.mimeType)&&"blob"in l.resource)await u(l.resource.mimeType,l.resource.blob,g);else if(s.output.push({type:"embed",uri:g,isText:"text"in l.resource,mimeType:l.resource.mimeType,value:"blob"in l.resource?l.resource.blob:l.resource.text,audience:c,asResource:!0}),h){let f=i.context&&v_.createUri(i.context.sessionResource,i.chatStreamToolCallId||i.callId,n.content.length,Be(g));p(f||g,l.resource.mimeType)}}}return r.structuredContent&&(s.output.push({type:"embed",isText:!0,value:JSON.stringify(r.structuredContent,null,2),audience:[0]}),n.content.push({kind:"text",value:JSON.stringify(r.structuredContent),audience:[0]})),this._tool.uiResourceUri&&(s.mcpOutput=r),n.toolResultDetails=s,n}};Zct=I([m(2,B),m(3,Ze),m(4,ge),m(5,s1e)],Zct);var TPo="mcpEncryptionKey",T8t="AES-GCM",vwn=256,bwn=12,NBi=1,_Po="mcpInputs",N9=class extends k{constructor(e,t,o,n,r){super();this._scope=e;this._storageService=o;this._secretStorageService=n;this._logService=r;this._secretsSealerSequencer=new Tm;this._getEncryptionKey=new uo(()=>N9.secretSequencer.queue(async()=>{let e=await this._secretStorageService.get(TPo);if(e)try{let n=JSON.parse(e);return await crypto.subtle.importKey("jwk",n,T8t,!1,["encrypt","decrypt"])}catch{}let t=await crypto.subtle.generateKey({name:T8t,length:vwn},!0,["encrypt","decrypt"]),o=await crypto.subtle.exportKey("jwk",t);return await this._secretStorageService.set(TPo,JSON.stringify(o)),t}));this._didChange=!1;this._record=new uo(()=>{let e=this._storageService.getObject(_Po,this._scope);return e?.version===NBi?{...e}:{version:NBi,values:{}}});this._register(o.onWillSaveState(()=>{this._didChange&&(this._storageService.store(_Po,{version:NBi,values:this._record.value.values,secrets:this._record.value.secrets},this._scope,t),this._didChange=!1)}))}static{this.secretSequencer=new Tm}clearAll(){this._record.value.values={},this._record.value.secrets=void 0,this._record.value.unsealedSecrets=void 0,this._didChange=!0}async clear(e){let t=await this._unsealSecrets();delete this._record.value.values[e],this._didChange=!0,t.hasOwnProperty(e)&&(delete t[e],await this._sealSecrets())}async getMap(){let e=await this._unsealSecrets();return{...this._record.value.values,...e}}async setPlainText(e){Object.assign(this._record.value.values,e),this._didChange=!0}async setSecrets(e){let t=await this._unsealSecrets();Object.assign(t,e),await this._sealSecrets()}async _sealSecrets(){let e=await this._getEncryptionKey.value;return this._secretsSealerSequencer.queue(async()=>{if(!this._record.value.unsealedSecrets||dv(this._record.value.unsealedSecrets)){this._record.value.secrets=void 0;return}let t=JSON.stringify(this._record.value.unsealedSecrets),o=crypto.getRandomValues(new Uint8Array(bwn)),n=await crypto.subtle.encrypt({name:T8t,iv:o.buffer},e,new TextEncoder().encode(t).buffer),r=gc(Ke.wrap(new Uint8Array(n)));this._record.value.secrets={iv:gc(Ke.wrap(o)),value:r},this._didChange=!0})}async _unsealSecrets(){if(!this._record.value.secrets)return this._record.value.unsealedSecrets??={};if(this._record.value.unsealedSecrets)return this._record.value.unsealedSecrets;try{let e=await this._getEncryptionKey.value,t=Ws(this._record.value.secrets.iv),o=Ws(this._record.value.secrets.value),n=await crypto.subtle.decrypt({name:T8t,iv:t.buffer},e,o.buffer),r=JSON.parse(new TextDecoder().decode(n));return this._record.value.unsealedSecrets=r,r}catch(e){this._logService.warn("Error unsealing MCP secrets",e),this._record.value.secrets=void 0}return{}}};N9=I([m(2,de),m(3,fC),m(4,re)],N9);var Wre=class extends Error{constructor(e,t,o){super(t);this.code=e;this.data=o}},_8t=class a extends k{constructor(e,t){super();this._send=e;this._handlers=t;this._nextRequestId=1;this._pendingRequests=new Map}static{this.ParseError=-32700}static{this.MethodNotFound=-32601}static{this.InternalError=-32603}sendNotification(e){this._send({jsonrpc:"2.0",...e})}sendRequest(e,t=Ie.None,o){if(this._store.isDisposed)return Promise.reject(new qi);let n=this._nextRequestId++,r=new Mo,s=new qe;this._pendingRequests.set(n,{promise:r,cts:s});let l=t.onCancellationRequested(()=>{r.isSettled||(this._pendingRequests.delete(n),s.cancel(),o?.(n),r.cancel()),l.dispose()});return this._send({jsonrpc:"2.0",id:n,...e}),r.p.finally(()=>{l.dispose(),this._pendingRequests.delete(n),s.dispose(!0)})}async handleMessage(e){if(Array.isArray(e)){let o=[];for(let n of e){let r=await this._handleMessage(n);r&&o.push(r)}return o}let t=await this._handleMessage(e);return t?[t]:[]}cancelPendingRequest(e){let t=this._pendingRequests.get(e);t&&(this._pendingRequests.delete(e),t.cts.cancel(),t.promise.cancel(),t.cts.dispose(!0))}cancelAllRequests(){for(let[e,t]of this._pendingRequests)this._pendingRequests.delete(e),t.cts.cancel(),t.promise.cancel(),t.cts.dispose(!0)}async _handleMessage(e){if(Iwn(e)){yo(e,{result:!0})?this._handleResult(e):this._handleError(e);return}if(Swn(e))return this._handleRequest(e);ywn(e)&&this._handlers.handleNotification?.(e)}_handleResult(e){let t=this._pendingRequests.get(e.id);t&&(this._pendingRequests.delete(e.id),t.promise.complete(e.result),t.cts.dispose(!0))}_handleError(e){if(e.id===void 0)return;let t=this._pendingRequests.get(e.id);t&&(this._pendingRequests.delete(e.id),t.promise.error(new Wre(e.error.code,e.error.message,e.error.data)),t.cts.dispose(!0))}async _handleRequest(e){if(!this._handlers.handleRequest){let o={jsonrpc:"2.0",id:e.id,error:{code:a.MethodNotFound,message:`Method not found: ${e.method}`}};return this._send(o),o}let t=new qe;this._register(ee(()=>t.dispose(!0)));try{let o=this._handlers.handleRequest(e,t.token),n=wwn(o)?await o:o,r={jsonrpc:"2.0",id:e.id,result:n};return this._send(r),r}catch(o){let n;return o instanceof Wre?n={jsonrpc:"2.0",id:e.id,error:{code:o.code,message:o.message,data:o.data}}:n={jsonrpc:"2.0",id:e.id,error:{code:a.InternalError,message:o instanceof Error?o.message:"Internal error"}},this._send(n),n}finally{t.dispose(!0)}}dispose(){this.cancelAllRequests(),super.dispose()}static createParseError(e,t){return{jsonrpc:"2.0",error:{code:a.ParseError,message:e,data:t}}}};function Swn(a){return"method"in a&&"id"in a&&(typeof a.id=="string"||typeof a.id=="number")}function Iwn(a){return yo(a,{id:!0,result:!0})||yo(a,{id:!0,error:!0})}function ywn(a){return yo(a,{method:!0})&&!yo(a,{id:!0})}function wwn(a){return typeof a=="object"&&a!==null&&"then"in a&&typeof a.then=="function"}var D8t=class a extends k{constructor({launch:e,logger:t,createMessageRequestHandler:o,elicitationRequestHandler:n,requestLogLevel:r=2,taskManager:s}){super();this._hasAnnouncedRoots=!1;this._roots=[];this._onDidReceiveCancelledNotification=this._register(new T);this.onDidReceiveCancelledNotification=this._onDidReceiveCancelledNotification.event;this._onDidReceiveProgressNotification=this._register(new T);this.onDidReceiveProgressNotification=this._onDidReceiveProgressNotification.event;this._onDidReceiveElicitationCompleteNotification=this._register(new T);this.onDidReceiveElicitationCompleteNotification=this._onDidReceiveElicitationCompleteNotification.event;this._onDidChangeResourceList=this._register(new T);this.onDidChangeResourceList=this._onDidChangeResourceList.event;this._onDidUpdateResource=this._register(new T);this.onDidUpdateResource=this._onDidUpdateResource.event;this._onDidChangeToolList=this._register(new T);this.onDidChangeToolList=this._onDidChangeToolList.event;this._onDidChangePromptList=this._register(new T);this.onDidChangePromptList=this._onDidChangePromptList.event;this._launch=e,this.logger=t,this._requestLogLevel=r,this._createMessageRequestHandler=o,this._elicitationRequestHandler=n,this._taskManager=s,this._rpc=this._register(new _8t(l=>this.send(l),{handleRequest:(l,c)=>this.handleServerRequest(l,c),handleNotification:l=>this.handleServerNotification(l)})),this._taskManager.setHandler(this),this._register(this._taskManager.onDidUpdateTask(l=>{this.send({jsonrpc:vb.JSONRPC_VERSION,method:"notifications/tasks/status",params:l})})),this._register(ee(()=>this._taskManager.setHandler(void 0))),this._register(e.onDidReceiveMessage(l=>{Bwe(this.logger.getLevel(),this._requestLogLevel)&&MY(this.logger,this._requestLogLevel,`[server -> editor] ${JSON.stringify(l)}`),this._rpc.handleMessage(l)})),this._register(ve(l=>{let c=e.state.read(l).state;(c===Sr.Kind.Error||c===Sr.Kind.Stopped)&&this.cancelAllRequests()})),this._register(t.onDidChangeLogLevel(l=>{this._sendLogLevelToServer(l)}))}set roots(e){eo(this._roots,e)||(this._roots=e,this._hasAnnouncedRoots&&(this.sendNotification({method:"notifications/roots/list_changed"}),this._hasAnnouncedRoots=!1))}get capabilities(){return this._serverInit.capabilities}get serverInfo(){return this._serverInit.serverInfo}get serverInstructions(){return this._serverInit.instructions}static async create(e,t,o){let n=new a(t),r=new O;try{return r.add(new ky).cancelAndSet(()=>{t.logger.info("Waiting for server to respond to `initialize` request...")},5e3),await e.invokeFunction(async l=>{let c=l.get(Ze),u=await n.sendRequest({method:"initialize",params:{protocolVersion:vb.LATEST_PROTOCOL_VERSION,capabilities:{roots:{listChanged:!0},sampling:t.createMessageRequestHandler?{}:void 0,elicitation:t.elicitationRequestHandler?{form:{},url:{}}:void 0,tasks:{list:{},cancel:{},requests:{sampling:t.createMessageRequestHandler?{createMessage:{}}:void 0,elicitation:t.elicitationRequestHandler?{create:{}}:void 0}},extensions:{"io.modelcontextprotocol/ui":{mimeTypes:["text/html;profile=mcp-app"]}}},clientInfo:{name:c.nameLong,version:c.version}}},o);n._serverInit=u,n._sendLogLevelToServer(t.logger.getLevel()),n.sendNotification({method:"notifications/initialized"})}),n}catch(s){throw n.dispose(),s}finally{r.dispose()}}async sendRequest(e,t=Ie.None){return this._store.isDisposed?Promise.reject(new qi):this._rpc.sendRequest(e,t,o=>this.sendNotification({method:"notifications/cancelled",params:{requestId:o}})).catch(o=>{throw o instanceof Wre?new Cee(o.message,o.code,o.data):o})}send(e){Bwe(this.logger.getLevel(),this._requestLogLevel)&&MY(this.logger,this._requestLogLevel,`[editor -> server] ${JSON.stringify(e)}`),this._launch.send(e)}async*sendRequestPaginated(e,t,o,n=Ie.None){let r;do{let s={...o,cursor:r},l=await this.sendRequest({method:e,params:s},n);yield t(l),r=l.nextCursor}while(r!==void 0&&!n.isCancellationRequested)}sendNotification(e){this.send({...e,jsonrpc:vb.JSONRPC_VERSION})}handleServerRequest(e,t){let o=n=>{if(n instanceof eS)return new Wre(n.code,n.message,n.data);this.logger.error(`Error handling request ${e.method}:`,n);let r=eS.unknown(n instanceof Error?n:new Error(String(n)));return new Wre(r.code,r.message,r.data)};try{let n;if(e.method==="ping")n=this.handlePing(e);else if(e.method==="roots/list")n=this.handleRootsList(e);else if(e.method==="sampling/createMessage"&&this._createMessageRequestHandler)if(e.params.task){let r=this._taskManager.createTask(e.params.task.ttl??null,s=>this._createMessageRequestHandler(e.params,s));r._meta??={},r._meta["io.modelcontextprotocol/related-task"]={taskId:r.task.taskId},n=r}else n=this._createMessageRequestHandler(e.params,t);else if(e.method==="elicitation/create"&&this._elicitationRequestHandler)if(e.params.task){let r=this._taskManager.createTask(e.params.task.ttl??null,s=>this._elicitationRequestHandler(e.params,s));r._meta??={},r._meta["io.modelcontextprotocol/related-task"]={taskId:r.task.taskId},n=r}else n=this._elicitationRequestHandler(e.params,t);else if(e.method==="tasks/get")n=this._taskManager.getTask(e.params.taskId);else if(e.method==="tasks/result")n=this._taskManager.getTaskResult(e.params.taskId);else if(e.method==="tasks/cancel")n=this._taskManager.cancelTask(e.params.taskId);else if(e.method==="tasks/list")n=this._taskManager.listTasks();else throw eS.methodNotFound(e.method);return aD(n)?n.then(void 0,r=>{throw o(r)}):n}catch(n){throw o(n)}}handleServerNotification(e){try{switch(e.method){case"notifications/message":return this.handleLoggingNotification(e);case"notifications/cancelled":return this._onDidReceiveCancelledNotification.fire(e),this.handleCancelledNotification(e);case"notifications/progress":this._onDidReceiveProgressNotification.fire(e);return;case"notifications/resources/list_changed":this._onDidChangeResourceList.fire();return;case"notifications/resources/updated":this._onDidUpdateResource.fire(e);return;case"notifications/tools/list_changed":this._onDidChangeToolList.fire();return;case"notifications/prompts/list_changed":this._onDidChangePromptList.fire();return;case"notifications/elicitation/complete":this._onDidReceiveElicitationCompleteNotification.fire(e);return;case"notifications/tasks/status":this._taskManager.getClientTask(e.params.taskId)?.onDidUpdateState(e.params);return;default:}}catch(t){this.logger.error(`Error handling notification ${e.method}:`,t)}}handleCancelledNotification(e){e.params.requestId&&this._rpc.cancelPendingRequest(e.params.requestId)}handleLoggingNotification(e){iqt(this.logger,e.params)}handlePing(e){return{}}handleRootsList(e){return this._hasAnnouncedRoots=!0,{roots:this._roots}}cancelAllRequests(){this._rpc.cancelAllRequests()}dispose(){this.cancelAllRequests(),super.dispose()}async _sendLogLevelToServer(e){try{if(!this.capabilities.logging)return;await this.setLevel({level:Cwn(e)})}catch(t){this.logger.error(`Failed to set MCP server log level: ${t}`)}}initialize(e,t){return this.sendRequest({method:"initialize",params:e},t)}listResources(e,t){return yt.asyncToArrayFlat(this.listResourcesIterable(e,t))}listResourcesIterable(e,t){return this.sendRequestPaginated("resources/list",o=>o.resources,e,t)}readResource(e,t){return this.sendRequest({method:"resources/read",params:e},t)}listResourceTemplates(e,t){return yt.asyncToArrayFlat(this.sendRequestPaginated("resources/templates/list",o=>o.resourceTemplates,e,t))}subscribe(e,t){return this.sendRequest({method:"resources/subscribe",params:e},t)}unsubscribe(e,t){return this.sendRequest({method:"resources/unsubscribe",params:e},t)}listPrompts(e,t){return yt.asyncToArrayFlat(this.sendRequestPaginated("prompts/list",o=>o.prompts,e,t))}getPrompt(e,t){return this.sendRequest({method:"prompts/get",params:e},t)}listTools(e,t){return yt.asyncToArrayFlat(this.sendRequestPaginated("tools/list",o=>o.tools,e,t))}async callTool(e,t,o){let n=await this.sendRequest({method:"tools/call",params:e},t);if(txo(n)){let r=new FBi(n.task,t,o);return this._taskManager.adoptClientTask(r),r.setHandler(this),r.result.finally(()=>{this._taskManager.abandonClientTask(r.id)})}return n}setLevel(e,t){return this.sendRequest({method:"logging/setLevel",params:e},t)}complete(e,t){return this.sendRequest({method:"completion/complete",params:e},t)}getTask(e,t){return this.sendRequest({method:"tasks/get",params:e},t)}getTaskResult(e,t){return this.sendRequest({method:"tasks/result",params:e},t)}cancelTask(e,t){return this.sendRequest({method:"tasks/cancel",params:e},t)}listTasks(e,t){return yt.asyncToArrayFlat(this.sendRequestPaginated("tasks/list",o=>o.tasks,e,t))}};function OBi(a){return a.status==="completed"||a.status==="failed"||a.status==="cancelled"}var FBi=class extends k{constructor(e,t=Ie.None,o){super();this._task=e;this._onStatusMessage=o;this.promise=new Mo;this._handler=De("mcpTaskHandler",void 0);let n=e.ttl?Date.now()+e.ttl:void 0;this._lastTaskState=De("lastTaskState",this._task);let r=this._register(new O);if(t.isCancellationRequested?this._lastTaskState.set({...this._task,status:"cancelled"},void 0):r.add(t.onCancellationRequested(()=>{let c=this._lastTaskState.get();OBi(c)||this._lastTaskState.set({...c,status:"cancelled"},void 0)})),n){let c=n-Date.now();c<=0?this._lastTaskState.set({...this._task,status:"cancelled",statusMessage:"Task timed out."},void 0):r.add(Zo(()=>{let u=this._lastTaskState.get();OBi(u)||this._lastTaskState.set({...u,status:"cancelled",statusMessage:"Task timed out."},void 0)},c))}let s=De("activeResultLookup",void 0);r.add(ve(c=>{let u=this._lastTaskState.read(c);if(OBi(u))return;let p=s.read(c);if(p){let v=p.promiseResult.read(c);return Ki(b=>{v&&(v.data?(s.set(void 0,b),this._lastTaskState.set(v.data,b)):(s.set(void 0,b),v.error instanceof eS&&v.error.code===vb.INVALID_PARAMS?this._lastTaskState.set({...u,status:"cancelled"},void 0):this._lastTaskState.set({...u,status:"working"},void 0)))})}let h=this._handler.read(c);if(!h)return;let g=e.pollInterval??2e3,f=new qe(t);c.store.add(ee(()=>f.dispose(!0))),c.store.add(Zo(()=>{h.getTask({taskId:u.taskId},f.token).catch(v=>v instanceof eS&&v.code===vb.INVALID_PARAMS?{...u,status:"cancelled"}:{...u}).then(v=>{v&&!f.token.isCancellationRequested&&this._lastTaskState.set(v,void 0)})},g))}));let l=this._lastTaskState.map(c=>c.status);r.add(ve(c=>{let u=l.read(c);if(u==="failed"){let p=this._lastTaskState.read(void 0);this.promise.error(new Error(`Task ${p.taskId} failed: ${p.statusMessage??"unknown error"}`)),r.dispose()}else if(u==="cancelled")this.promise.cancel(),r.dispose();else if(u==="input_required"){let p=this._handler.read(c);if(p){let h=this._lastTaskState.read(void 0),g=new qe(t);c.store.add(ee(()=>g.dispose(!0))),s.set(new Uc(p.getTask({taskId:h.taskId},g.token)),void 0)}}else if(u==="completed"){let p=this._handler.read(c);p&&(this.promise.settleWith(p.getTaskResult({taskId:e.taskId},t)),r.dispose())}else u==="working"||void 0}))}get result(){return this.promise.p}get id(){return this._task.taskId}onDidUpdateState(e){this._lastTaskState.set(e,void 0),e.statusMessage&&this._onStatusMessage&&this._onStatusMessage(e.statusMessage)}setHandler(e){this._handler.set(e,void 0)}};function Cwn(a){switch(a){case 1:return"debug";case 2:return"debug";case 3:return"info";case 4:return"warning";case 5:return"error";case 0:return"emergency";default:return bs(a)}}var a1e=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._collection=e;this.definition=t;this._delegate=o;this.launchDefinition=n;this._logger=r;this._errorOnUserInteraction=s;this._taskManager=l;this._instantiationService=c;this._launch=this._register(new ue);this._state=De("mcpServerState",{state:Sr.Kind.Stopped});this._requestHandler=De("mcpServerRequestHandler",void 0);this._onPotentialSandboxBlock=this._register(new T);this.state=this._state;this.handler=this._requestHandler;this.onPotentialSandboxBlock=this._onPotentialSandboxBlock.event}async start(e){let t=this._state.get();if(!Sr.canBeStarted(t.state))return this._waitForState(Sr.Kind.Running,Sr.Kind.Error);this._launch.value=void 0,this._state.set({state:Sr.Kind.Starting},void 0),this._logger.info(d(13275,null,this.definition.label));try{let o=this._delegate.start(this._collection,this.definition,this.launchDefinition,{errorOnUserInteraction:this._errorOnUserInteraction});return this._launch.value=this.adoptLaunch(o,e),this._waitForState(Sr.Kind.Running,Sr.Kind.Error)}catch(o){let n={state:Sr.Kind.Error,message:o instanceof Error?o.message:String(o)};return this._state.set(n,void 0),n}}adoptLaunch(e,t){let o=new O,n=new qe;o.add(ee(()=>n.dispose(!0))),o.add(e),o.add(e.onDidLog(({level:s,message:l})=>{MY(this._logger,s,l);let c=this._toPotentialSandboxBlock(l);c&&this._onPotentialSandboxBlock.fire(c)}));let r=!1;return o.add(ve(s=>{let l=e.state.read(s);this._state.set(l,void 0),this._logger.info(d(13276,null,Sr.toString(l))),l.state===Sr.Kind.Running&&!r&&(r=!0,D8t.create(this._instantiationService,{...t,launch:e,logger:this._logger,requestLogLevel:this.definition.devMode?3:2,taskManager:this._taskManager},n.token).then(c=>{o.isDisposed?c.dispose():this._requestHandler.set(c,void 0)},c=>{if(!o.isDisposed&&Sr.isRunning(this._state.read(void 0))){let u=c.message;c instanceof qi?(u="Server exited before responding to `initialize` request.",this._logger.error(u)):this._logger.error(c),this._state.set({state:Sr.Kind.Error,message:u},void 0)}o.dispose()}))})),{dispose:()=>o.dispose(),object:e}}async stop(){this._logger.info(d(13277,null,this.definition.label)),this._launch.value?.object.stop(),await this._waitForState(Sr.Kind.Stopped,Sr.Kind.Error)}dispose(){this._requestHandler.get()?.dispose(),super.dispose(),this._state.set({state:Sr.Kind.Stopped},void 0)}_waitForState(...e){let t=this._state.get();return e.includes(t.state)?Promise.resolve(t):new Promise(o=>{let n=ve(r=>{let s=this._state.read(r);e.includes(s.state)&&(n.dispose(),o(s))})})}_toPotentialSandboxBlock(e){if(this.definition.sandboxEnabled){if(/No matching config rule, denying:/i.test(e))return{kind:"network",message:e,host:this._extractSandboxHost(e)};if(/(?:\b(?:EACCES|EPERM|ENOENT|EROFS|fail(?:ed|ure)?)\b|not accessible|read[- ]only)/i.test(e))return{kind:"filesystem",message:e,path:this._extractSandboxPath(e)}}}_extractSandboxPath(e){let t=e.match(/\[(\/[^\]\r\n]+)\]/);if(t?.[1])return t[1].trim();let o=e.match(/["'`](\/[^"'`]+)["'`]/);return o?.[1]?o[1]:e.match(/(\/[\w.\-~/ ]+)$/)?.[1]?.trim()}_extractSandboxHost(e){return e.match(/No matching config rule, denying:\s+(?<host>[^:\s]+):\d+\.?$/i)?.groups?.host}};a1e=I([m(7,F)],a1e);var WBi="__vscode_not_trusted",l1e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._instantiationService=e;this._configurationResolverService=t;this._dialogService=o;this._notificationService=n;this._editorService=r;this._quickInputService=l;this._labelService=c;this._logService=u;this._mcpSandboxService=p;this._workspaceTrustManagementService=h;this._workspaceTrustRequestService=g;this._collections=De("collections",[]);this._delegates=De("delegates",[]);this.collections=ke(e=>this._mcpAccessValue.read(e)==="none"?[]:this._collections.read(e));this._workspaceStorage=new uo(()=>this._register(this._instantiationService.createInstance(N9,1,0)));this._profileStorage=new uo(()=>this._register(this._instantiationService.createInstance(N9,0,0)));this._ongoingLazyActivations=De(this,0);this.lazyCollectionState=ke(e=>{if(this._mcpAccessValue.read(e)==="none")return{state:2,collections:[]};if(this._ongoingLazyActivations.read(e)>0)return{state:1,collections:[]};let t=this._collections.read(e);return t.some(n=>n.lazy&&n.lazy.isCached===!1)?{state:0,collections:t.filter(n=>n.lazy&&n.lazy.isCached===!1)}:{state:2,collections:[]}});this._onDidChangeInputs=this._register(new T);this.onDidChangeInputs=this._onDidChangeInputs.event;this._mcpAccessValue=hr(sy,"all",s)}get delegates(){return this._delegates}registerDelegate(e){let t=this._delegates.get().slice();return t.push(e),t.sort((o,n)=>n.priority-o.priority),this._delegates.set(t,void 0),{dispose:()=>{let o=this._delegates.get().filter(n=>n!==e);this._delegates.set(o,void 0)}}}registerCollection(e){let t=this._collections.get(),o=t.find(n=>n.id===e.id);return o&&!o.lazy?k.None:(o?this._collections.set(t.map(n=>n===o?e:n),void 0):this._collections.set([...t,e].sort((n,r)=>n.order-r.order),void 0),{dispose:()=>{let n=this._collections.get();this._collections.set(n.filter(r=>r!==e),void 0)}})}getServerDefinition(e,t){return this._collections.map(n=>n.find(r=>r.id===e.id)).map((n,r)=>{let s=n?.serverDefinitions.read(r).find(l=>l.id===t.id);return{collection:n,server:s}})}async discoverCollections(){let e=this._collections.get().filter(n=>n.lazy&&!n.lazy.isCached);this._ongoingLazyActivations.set(this._ongoingLazyActivations.get()+1,void 0),await Promise.all(e.map(n=>n.lazy?.load())).finally(()=>{this._ongoingLazyActivations.set(this._ongoingLazyActivations.get()-1,void 0)});let t=[],o=this._collections.get();for(let n of e){let r=o.find(s=>s.id===n.id);r&&(r.lazy?r.lazy.removed?.():t.push(r))}return t}_getInputStorage(e){return e===1?this._workspaceStorage.value:this._profileStorage.value}_getInputStorageInConfigTarget(e){return this._getInputStorage(e===5||e===6?1:0)}async clearSavedInputs(e,t){let o=this._getInputStorage(e);t?await o.clear(t):o.clearAll(),this._onDidChangeInputs.fire()}async editSavedInput(e,t,o,n){let r=this._getInputStorageInConfigTarget(n),s=eI.parse(e),c=(await r.getMap())[e].value;await this._configurationResolverService.resolveWithInteraction(t,s,o,c?{[e.slice(2,-1)]:c}:{},n),await this._updateStorageWithExpressionInputs(r,s)}async setSavedInput(e,t,o){let n=this._getInputStorageInConfigTarget(t),r=eI.parse(e);for(let s of r.unresolved()){r.resolve(s,o);break}await this._updateStorageWithExpressionInputs(n,r)}getSavedInputs(e){return this._getInputStorage(e).getMap()}async _checkTrust(e,t,{trustNonceBearer:o,interaction:n,promptType:r="only-new",autoTrustChanges:s=!1,errorOnUserInteraction:l=!1}){if(e.scope===1&&!this._workspaceTrustManagementService.isWorkspaceTrusted()){if(l)throw new EC("workspaceTrust");if(!await this._workspaceTrustRequestService.requestWorkspaceTrust({message:d(13241,null)}))return!1}if(e.trustBehavior===TC.Kind.Trusted)return this._logService.trace(`MCP server ${t.id} is trusted, no trust prompt needed`),!0;if(e.trustBehavior===TC.Kind.TrustedOnNonce){if(t.cacheNonce===o.trustedAtNonce)return this._logService.trace(`MCP server ${t.id} is unchanged, no trust prompt needed`),!0;if(s)return this._logService.trace(`MCP server ${t.id} is was changed but user explicitly executed`),o.trustedAtNonce=t.cacheNonce,!0;if(o.trustedAtNonce===WBi)if(r==="all-untrusted"){if(l)throw new EC("serverTrust");return this._promptForTrust(t,e,n,o)}else return this._logService.trace(`MCP server ${t.id} is untrusted, denying trust prompt`),!1;if(r==="never")return this._logService.trace(`MCP server ${t.id} trust state is unknown, skipping prompt`),!1;if(l)throw new EC("serverTrust");let c=await this._promptForTrust(t,e,n,o);return c?!0:c===void 0?void 0:(o.trustedAtNonce=WBi,!1)}else bs(e.trustBehavior)}async _promptForTrust(e,t,o,n){o??=new wee,o.participants.set(e.id,{s:"waiting",definition:e,collection:t});let r=await new Promise(s=>{uD(l=>{let c=o.participants.observable.read(l);yt.some(c.values(),u=>u.s==="unknown")||(l.dispose(),o.choice??=this._promptForTrustOpenDialog([...c.values()].map(u=>u.s==="waiting"?u:void 0).filter(so)),s(o.choice))})});return this._logService.trace("MCP trusted servers:",r),r&&(n.trustedAtNonce=r.includes(e.id)?e.cacheNonce:WBi),!!r?.includes(e.id)}async _promptForTrustOpenDialog(e){function t(c){let u=c.definition.presentation?.origin?.uri||c.collection.presentation?.origin,p=u?`[\`${c.definition.label}\`](${u})`:"`"+c.definition.label+"`";return c.collection.source instanceof hi&&(p+=` (${d(13242,null,c.collection.source.value)})`),p}if(e.length===1){let c=e[0],u=c.definition.presentation?.origin?.uri,{result:p}=await this._dialogService.prompt({message:d(13243,null,c.definition.label),custom:{icon:L.shield,markdownDetails:[{markdown:new he(d(13236,null,t(c))),actionHandler:()=>this._editorService.openEditor({resource:u},ff).then(Boolean)}]},buttons:[{label:d(13240,null),run:()=>!0},{label:d(13238,null),run:()=>!1}]});return p===void 0?void 0:p?[c.definition.id]:[]}let o=e.map(c=>`- ${t(c)}`).join(`
`),{result:n}=await this._dialogService.prompt({message:d(13244,null,e.length),custom:{icon:L.shield,markdownDetails:[{markdown:new he(d(13237,null,o)),actionHandler:c=>this._editorService.openEditor({resource:A.parse(c)},ff).then(Boolean)}]},buttons:[{label:d(13240,null),run:()=>"all"},{label:d(13239,null),run:()=>"pick"},{label:d(13238,null),run:()=>"none"}]});if(n===void 0)return;if(n==="all")return e.map(c=>c.definition.id);if(n==="none")return[];function r(c){return typeof c.action=="function"}let s=new O,l=s.add(this._quickInputService.createQuickPick({useSeparators:!1}));return l.canSelectMany=!0,l.items=e.map(({definition:c,collection:u})=>{let p=[];if(c.presentation?.origin){let h=c.presentation.origin;p.push({iconClass:"codicon-go-to-file",tooltip:"Go to Definition",action:()=>this._editorService.openEditor({resource:h.uri,options:{selection:h.range}})})}return{type:"item",label:c.label,definitonId:c.id,description:u.source instanceof hi?u.source.value:c.presentation?.origin?this._labelService.getUriLabel(c.presentation.origin.uri):void 0,picked:!1,buttons:p}}),l.placeholder="Select MCP servers to trust",l.ignoreFocusOut=!0,s.add(l.onDidTriggerItemButton(c=>{r(c.button)&&c.button.action()})),new Promise(c=>{s.add(l.onDidAccept(()=>{c(l.selectedItems.map(u=>u.definitonId)),l.hide()})),s.add(l.onDidHide(()=>{c(void 0)})),l.show()}).finally(()=>s.dispose())}async _updateStorageWithExpressionInputs(e,t){let o={},n={};for(let[r,s]of t.resolved())s.input?.type==="promptString"&&s.input.password?o[r.id]=s:n[r.id]=s;e.setPlainText(n),await e.setSecrets(o),this._onDidChangeInputs.fire()}async _replaceVariablesInLaunch(e,t,o,n){if(!t.variableReplacement)return o;let{section:r,target:s,folder:l}=t.variableReplacement,c=this._getInputStorageInConfigTarget(s),[u,p]=await Promise.all([c.getMap(),e.substituteVariables(t,o)]),h=eI.parse(p);for(let g of h.unresolved())u.hasOwnProperty(g.id)&&h.resolve(g,u[g.id]);if(n&&Array.from(h.unresolved()).length>0)throw new EC("variables");return await this._configurationResolverService.resolveWithInteraction(l,h,r,void 0,s),await this._updateStorageWithExpressionInputs(c,h),await this._configurationResolverService.resolveAsync(l,h)}async resolveConnection(e){let{collectionRef:t,definitionRef:o,interaction:n,logger:r,debug:s}=e,l=this._collections.get().find(g=>g.id===t.id);l?.lazy&&(await l.lazy.load(),l=this._collections.get().find(g=>g.id===t.id));let c=l?.serverDefinitions.get().find(g=>g.id===o.id);if(!l||!c)throw new Error(`Collection or definition not found for ${t.id} and ${o.id}`);let u=this._delegates.get().find(g=>g.canStart(l,c));if(!u)throw new Error("No delegate found that can handle the connection");let p=await this._checkTrust(l,c,e);if(n?.participants.set(c.id,{s:"resolved"}),!p)return;let h=c.launch;if(!(l.resolveServerLanch&&(h=await l.resolveServerLanch(c),!h))){try{h=await this._replaceVariablesInLaunch(u,c,h,e.errorOnUserInteraction),c.devMode&&s&&(h=await this._instantiationService.invokeFunction(g=>g.get(xWe).transform(c,h))),h=await this._mcpSandboxService.launchInSandboxIfEnabled(c,h,l.remoteAuthority??void 0,l.configTarget)}catch(g){if(g instanceof EC)throw g;this._notificationService.notify({severity:ft.Error,message:d(13234,null,c.label,String(g)),actions:{primary:l.presentation?.origin&&[{id:"mcp.launchError.openConfig",class:void 0,enabled:!0,tooltip:"",label:d(13235,null),run:()=>this._editorService.openEditor({resource:l.presentation.origin,options:{selection:c.presentation?.origin?.range}})}]}});return}return this._instantiationService.createInstance(a1e,l,c,u,h,r,e.errorOnUserInteraction,e.taskManager)}}};l1e=I([m(0,F),m(1,Xp),m(2,ct),m(3,Ne),m(4,ie),m(5,B),m(6,$e),m(7,nt),m(8,re),m(9,EWe),m(10,Or),m(11,lp)],l1e);var xwn=3e3,c1e=class extends k{constructor(e,t,o){super();this._instantiationService=e;this._fileService=t;this._webContentExtractorService=o;this._mcpServiceLazy=new uo(()=>this._instantiationService.invokeFunction(e=>e.get(Vs)));this._momentaryCache=new dt;this.onDidChangeCapabilities=U.None;this._onDidChangeFile=this._register(new T);this.onDidChangeFile=this._onDidChangeFile.event;this.capabilities=19474;this._register(this._fileService.registerProvider(_C.scheme,this))}get _mcpService(){return this._mcpServiceLazy.value}async readFile(e){return this._readFile(e)}readFileStream(e,t,o){let n=Ty(r=>Ke.concat(r.map(s=>Ke.wrap(s))).buffer);return this._readFile(e,o).then(r=>{t.position&&(r=r.slice(t.position)),t.length&&(r=r.slice(0,t.length)),n.end(r)},r=>n.error(r)),n}watch(e,t){let{resourceURI:o,server:n}=this._decodeURI(e),r=n.capabilities.get();if(r!==void 0&&!(r&32))return k.None;n.start();let s=new O,l,c=s.add(new ue),u=s.add(new ue);return s.add(ve(p=>{let h=n.connection.read(p);if(!h)return;let g=h.handler.read(p);if(!g||l===g)return;u.value?.dispose(!0),u.value=new qe,l=g;let f=u.value.token;g.subscribe({uri:o.toString()},f).then(()=>{f.isCancellationRequested||(c.value=g.onDidUpdateResource(v=>{DPo(v.params.uri,o)&&this._onDidChangeFile.fire([{resource:e,type:0}])}))},v=>{g.logger.warn(`Failed to subscribe to resource changes for ${o}: ${v}`),l=void 0})})),s}async stat(e){let{forSameURI:t,contents:o}=await this._readURI(e);if(!o.length)throw Ys("File not found","EntryNotFound");return{ctime:0,mtime:0,size:Pw(o,n=>VBi(n).byteLength),type:t.length?1:2}}async readdir(e){let{forSameURI:t,contents:o,resourceURI:n}=await this._readURI(e);if(t.length>0)throw Ys("File is not a directory","EntryNotADirectory");let r=n.pathname.split("/"),s=new Map;for(let l of o){let u=A.parse(l.uri).path.split("/");if(!(u.length<=r.length||!r.every((p,h)=>xr(p,u[h]))))if(u.length>r.length+1)s.set(u[r.length],2);else{let p=u[u.length-1];s.set(p,VBi(l).byteLength>0?1:2)}}return[...s]}mkdir(e){throw Ys("write is not supported","NoPermissions")}writeFile(e,t,o){throw Ys("write is not supported","NoPermissions")}delete(e,t){throw Ys("delete is not supported","NoPermissions")}rename(e,t,o){throw Ys("rename is not supported","NoPermissions")}async _readFile(e,t){let{forSameURI:o,contents:n}=await this._readURI(e);if(!o.length)throw n.length?Ys("File is a directory","EntryIsADirectory"):Ys("File not found","EntryNotFound");return VBi(o[0])}_decodeURI(e){let t,o;try{({definitionId:t,resourceURL:o}=_C.toServer(e))}catch(s){throw Ys(String(s),"EntryNotFound")}o.pathname.endsWith("/")&&(o.pathname=o.pathname.slice(0,-1));let n=this._mcpService.servers.get().find(s=>s.definition.id===t);if(!n)throw Ys(`MCP server ${t} not found`,"EntryNotFound");let r=n.capabilities.get();if(r!==void 0&&!(r&16))throw Ys(`MCP server ${t} does not support resources`,"EntryNotFound");return{definitionId:t,resourceURI:o,server:n}}async _readURI(e,t){let o=this._momentaryCache.get(e);if(o)return o.pool.add(t||Ie.None),o.promise;let n=this._store.add(new qvt);n.add(t||Ie.None);let r=this._readURIInner(e,n.token);this._momentaryCache.set(e,{pool:n,promise:r});let s=this._store.add(Zo(()=>{this._momentaryCache.delete(e),this._store.delete(s),this._store.delete(n)},xwn));return r}async _readURIInner(e,t){let{resourceURI:o,server:n}=this._decodeURI(e),r=this._mcpService.servers.get().find(l=>l.definition.id===n.definition.id);if(exo(o,r)){let l=A.parse(o.toString()),c=(await this._webContentExtractorService.extract([l],{followRedirects:!1})).at(0);if(c?.status==="ok")return{contents:[{uri:o.toString(),text:c.result}],resourceURI:o,forSameURI:[{uri:o.toString(),text:c.result}]}}let s=await kb.callOn(n,l=>l.readResource({uri:o.toString()},t),t);return{contents:s.contents,resourceURI:o,forSameURI:s.contents.filter(l=>DPo(l.uri,o))}}};c1e=I([m(0,F),m(1,ge),m(2,cFe)],c1e);function DPo(a,i){return xr(new URL(a).pathname,i.pathname)}function VBi(a){if("text"in a)return Ke.fromString(a.text).buffer;if("blob"in a)return Ws(a.blob).buffer;throw Ys("Unknown content type","Unknown")}var kwn=sN({defaultValue:new Map,key:"mcp.sampling.logs",toStorage:a=>JSON.stringify(Array.from(a.entries())),fromStorage:a=>new Map(JSON.parse(a))}),d1e=class extends k{constructor(e){super();this._storageService=e;this._logs={}}has(e){return this._getLogStorageForServer(e).get().has(e.definition.id)}get(e){return this._getLogStorageForServer(e).get().get(e.definition.id)}getAsText(e){let o=this._getLogStorageForServer(e).get().get(e.definition.id);if(!o)return"";let n=[],r=o.bins.reduce((s,l)=>s+l,0);return n.push(d(13245,null,r)),n.push(this._formatRecentRequests(o)),n.join(`
`)}_formatRecentRequests(e){if(!e.lastReqs.length)return`
No recent requests.`;let t=[];for(let o=0;o<e.lastReqs.length;o++){let{request:n,response:r,at:s,model:l}=e.lastReqs[o];t.push(`
[${o+1}] ${new Date(s).toISOString()} ${l}`),t.push("  Request:");for(let c of n){let u=c.role.padEnd(9),p="";"text"in c.content&&c.content.type==="text"?p=c.content.text:"data"in c.content&&(p=`[${c.content.type} data: ${c.content.mimeType}]`),t.push(`    ${u}: ${p}`)}t.push("  Response:"),t.push(`    ${r}`)}return t.join(`
`)}async add(e,t,o,n){let r=Date.now(),s=Math.floor(r/864e5),l=this._getLogStorageForServer(e),c=new Map(l.get()),u=c.get(e.definition.id);if(!u)u={head:s,bins:Array.from({length:7},()=>0),lastReqs:[]};else{for(let p=0;p<s-u.head&&p<7;p++)u.bins.pop(),u.bins.unshift(0);u.head=s}for(u.bins[0]++,u.lastReqs.unshift({request:t,response:o,at:r,model:n});u.lastReqs.length>30;)u.lastReqs.pop();c.set(e.definition.id,u),l.set(c,void 0)}_getLogStorageForServer(e){let t=e.readDefinitions().get().collection?.scope??1;return this._logs[t]??=this._register(kwn(t,1,this._storageService))}};d1e=I([m(0,de)],d1e);var u1e=class extends k{constructor(e,t,o,n,r,s){super();this._languageModelsService=e;this._configurationService=t;this._dialogService=o;this._notificationService=n;this._commandService=r;this._sessionSets={allowedDuringChat:new Map,allowedOutsideChat:new Map};this._modelSequencer=new Tm;this._logs=this._register(s.createInstance(d1e))}async sample(e,t=Ie.None){let o=e.params.messages.map(c=>{let u=Ec(c.content).map(p=>p.type==="text"?{type:"text",value:p.text}:p.type==="image"||p.type==="audio"?{type:"image_url",value:{mimeType:p.mimeType,data:Ws(p.data)}}:void 0).filter(so);if(u.length)return{role:c.role==="assistant"?2:1,content:u}}).filter(so);e.params.systemPrompt&&o.unshift({role:0,content:[{type:"text",value:e.params.systemPrompt}]});let n=await this._modelSequencer.queue(()=>this._getMatchingModel(e)),r=await this._languageModelsService.sendChatRequest(n,void 0,o,{},t),s="",l=(async()=>{for await(let c of r.stream)if(Array.isArray(c))for(let u of c)u.type==="text"&&(s+=u.value);else c.type==="text"&&(s+=c.value)})();try{return await Promise.all([r.result,l]),this._logs.add(e.server,e.params.messages,s,n),{sample:{model:n,content:{type:"text",text:s},role:"assistant"}}}catch(c){throw eS.unknown(c)}}hasLogs(e){return this._logs.has(e)}getLogText(e){return this._logs.getAsText(e)}async _getMatchingModel(e){let t=await this._getMatchingModelInner(e.server,e.isDuringToolCall,e.params.modelPreferences),o=this._configurationService.getValue("chat.tools.global.autoApprove");if(t===0){if(o)return this._sessionSets.allowedDuringChat.set(e.server.definition.id,!0),this._getMatchingModel(e);if(await this._showContextual(e.isDuringToolCall,d(13253,null,e.server.definition.label),d(13252,null,e.server.definition.label),this.allowButtons(e.server,"allowedDuringChat")))return this._getMatchingModel(e);throw eS.notAllowed()}else if(t===1){if(o)return this._sessionSets.allowedOutsideChat.set(e.server.definition.id,!0),this._getMatchingModel(e);if(await this._showContextual(e.isDuringToolCall,d(13255,null,e.server.definition.label),d(13254,null,e.server.definition.label),this.allowButtons(e.server,"allowedOutsideChat")))return this._getMatchingModel(e);throw eS.notAllowed()}else{if(t===2)throw eS.notAllowed();if(t===3){if(e.isDuringToolCall?await this._commandService.executeCommand("workbench.mcp.configureSamplingModels",e.server):await this._notify(d(13256,null,e.server.definition.label),{[d(13247,null)]:()=>this._commandService.executeCommand("workbench.mcp.configureSamplingModels",e.server),[d(13246,null)]:()=>Promise.resolve(void 0)}))return this._getMatchingModel(e);throw eS.notAllowed()}}return t}allowButtons(e,t){return{[d(13249,null)]:async()=>(this._sessionSets[t].set(e.definition.id,!0),!0),[d(13248,null)]:async()=>(await this.updateConfig(e,o=>o[t]=!0),!0),[d(13251,null)]:async()=>(this._sessionSets[t].set(e.definition.id,!1),!1),[d(13250,null)]:async()=>(await this.updateConfig(e,o=>o[t]=!1),!1)}}async _showContextual(e,t,o,n){return e?await(await this._dialogService.prompt({type:"question",title:t,message:o,buttons:Object.entries(n).map(([s,l])=>({label:s,run:l}))})).result:await this._notify(o,n)}async _notify(e,t){return await new Promise(o=>{let n=this._notificationService.prompt(ft.Info,e,Object.entries(t).map(([r,s])=>({label:r,run:()=>o(s())})));U.once(n.onDidClose)(()=>o(void 0))})}async _getMatchingModelInner(e,t,o){let n=this.getConfig(e);if(t&&!n.allowedDuringChat&&!this._sessionSets.allowedDuringChat.has(e.definition.id))return n.allowedDuringChat===void 0?0:2;if(!t&&!n.allowedOutsideChat&&!this._sessionSets.allowedOutsideChat.has(e.definition.id))return n.allowedOutsideChat===void 0?1:2;let r=n.allowedModels?.filter(s=>!!this._languageModelsService.lookupLanguageModel(s))||this._getDefaultModels();if(!r.length)return 3;if(o?.hints){let s=iD(o.hints,l=>r.find(c=>c.toLowerCase().includes(l.name.toLowerCase())));if(s)return s}return r[0]}_getDefaultModels(){let e=this._languageModelsService.getLanguageModelIds().map(o=>{let n=this._languageModelsService.lookupLanguageModel(o);return n&&!n.multiplierNumeric&&!n.targetChatSessionType?{model:n,id:o}:void 0}).filter(so),t=e.findIndex(o=>Object.values(o.model.isDefaultForLocation).some(Boolean));return t!==-1&&([e[0],e[t]]=[e[t],e[0]]),e.map(o=>o.id)}_configKey(e){return`${e.collection.label}: ${e.definition.label}`}getConfig(e){return this._getConfig(e).value||{}}_getConfig(e){let t=e.readDefinitions().get(),o=8,n=t.collection?.configTarget||2,r=this._configKey(e),s=t.collection?.presentation?.origin,l=this._configurationService.inspect(ont,{resource:s});for(let c=o;c>=n;c--){let u=Z4e(l,c),p=u?.[r];if(p)return{value:p,key:r,mapping:u,target:c,resource:s}}return{value:void 0,mapping:Z4e(l,n),key:r,target:n,resource:s}}async updateConfig(e,t){let{value:o,mapping:n,key:r,target:s,resource:l}=this._getConfig(e),c={...o};return t(c),await this._configurationService.updateValue(ont,{...n,[r]:c},{resource:l},s),c}};u1e=I([m(0,Gr),m(1,B),m(2,ct),m(3,Ne),m(4,fe),m(5,F)],u1e);var p1e=class extends k{constructor(e,t,o,n,r){super();this._instantiationService=e;this._mcpRegistry=t;this._logService=o;this.configurationService=n;this._currentAutoStarts=new Set;this._servers=De(this,[]);this.servers=this._servers.map(e=>e.map(t=>t.object));let s=this._register(new VZ("mcp.enablement",r)),l=hr(oKt,"disable",n);this.enablementModel=new HBi(s,this._mcpRegistry,l),this.userCache=this._register(e.createInstance(fve,0)),this.workspaceCache=this._register(e.createInstance(fve,1));let c=this._store.add(new Dt(()=>this.updateCollectedServers(),500));this._register(ve(u=>{for(let p of this._mcpRegistry.collections.read(u))p.serverDefinitions.read(u);c.schedule(500)}))}get lazyCollectionState(){return this._mcpRegistry.lazyCollectionState}cancelAutostart(){for(let e of this._currentAutoStarts)e.cancel()}autostart(e){let t=this.configurationService.getValue(gie);if(t==="never")return De(this,hRe.Empty);let o=De(this,{working:!0,starting:[],serversRequiringInteraction:[]}),n=new O,r=n.add(new qe(e));return this._currentAutoStarts.add(r),n.add(ee(()=>{this._currentAutoStarts.delete(r)})),n.add(r.token.onCancellationRequested(()=>{o.set(hRe.Empty,void 0)})),this._autostart(t,o,r.token).catch(s=>{this._logService.error("Error during MCP autostart:",s),o.set(hRe.Empty,void 0)}).finally(()=>n.dispose()),o}async _autostart(e,t,o){if(await this._activateCollections(),o.isCancellationRequested)return;let n=this.servers.get().filter(u=>u.connectionState.get().state!==Sr.Kind.Error&&Xf(u.enablement.get())),r=new Set;if(e==="onlyNew"?r=new Set(n.filter(u=>u.cacheState.get()===0)):e==="newAndOutdated"&&(r=new Set(n.filter(u=>{let p=u.cacheState.get();return p===0||p===2}))),!r.size){t.set(hRe.Empty,void 0);return}let s=new wee,l=[],c=()=>t.set({working:r.size>0,starting:[...r].map(u=>u.definition),serversRequiringInteraction:l},void 0);c(),await Promise.all([...r].map(async(u,p)=>{try{await cV(u,{interaction:s,errorOnUserInteraction:!0},o)}catch(h){h instanceof EC&&l.push({id:u.definition.id,label:u.definition.label,errorMessage:h.message})}finally{r.delete(u),o.isCancellationRequested||c()}}))}resetCaches(){this.userCache.reset(),this.workspaceCache.reset()}resetTrust(){this.resetCaches()}async activateCollections(){await this._activateCollections()}async _activateCollections(){let e=await this._mcpRegistry.discoverCollections();return this.updateCollectedServers(),new Set(e.map(t=>t.id))}updateCollectedServers(){let e=new BBi,t=this._mcpRegistry.collections.get().flatMap(l=>l.serverDefinitions.get().map(c=>{let u=e.generate(c.label);return{serverDefinition:c,collectionDefinition:l,toolPrefix:u}})),o=new Set(t),n=this._servers.get(),r=[],s=(l,c)=>{o.delete(l),r.push(c);let u=c.object.connection.get();u&&!GH.equals(u.definition,l.serverDefinition)&&(c.object.stop(),this._logService.debug(`MCP server ${c.object.definition.id} stopped because the definition changed`))};for(let l of n){let c=t.find(u=>Ewn(l.object,u)&&l.toolPrefix===u.toolPrefix);c?s(c,l):l.object.dispose()}for(let l of o){let c=this._instantiationService.createInstance(kb,l.collectionDefinition,l.serverDefinition,l.serverDefinition.roots,!!l.collectionDefinition.lazy,l.collectionDefinition.scope===1?this.workspaceCache:this.userCache,l.toolPrefix,this.enablementModel);r.push({object:c,toolPrefix:l.toolPrefix})}Ki(l=>{this._servers.set(r,l)})}dispose(){this._servers.get().forEach(e=>e.object.dispose()),super.dispose()}};p1e=I([m(0,F),m(1,xc),m(2,re),m(3,B),m(4,de)],p1e);function Ewn(a,i){return a.collection.id===i.collectionDefinition.id&&a.definition.id===i.serverDefinition.id}var BBi=class{constructor(){this.seenPrefixes=new Set}generate(i){let e="mcp_"+i.toLowerCase().replace(/[^a-z0-9_.-]+/g,"_").slice(0,18-"mcp_".length-1),t=e+"_";for(let o=2;this.seenPrefixes.has(t);o++)t=e+o+"_";return this.seenPrefixes.add(t),t}},HBi=class{constructor(i,e,t){this._base=i;this._collisionGroups=ke(o=>{if(t.read(o)!=="disable")return new Map;let n=e.collections.read(o),r=new Map;for(let l of n)for(let c of l.serverDefinitions.read(o)){let u=c.label.toLowerCase(),p=r.get(u);p||(p=[],r.set(u,p)),p.push(c.id)}let s=new Map;for(let l of r.values())if(!(l.length<2))for(let c of l)s.set(c,l);return s})}readEnabled(i,e){let t=this._base.readEnabled(i,e);if(!Xf(t))return t;let o=this._collisionGroups.read(e).get(i);if(!o)return t;for(let n of o){if(n===i)return t;if(Xf(this._base.readEnabled(n,e)))return 0}return t}setEnabled(i,e,t){let n=e===2||e===3?this._collisionGroups.get().get(i):void 0;if(!n){this._base.setEnabled(i,e,t);return}let r=s=>{this._base.setEnabled(i,e,s);for(let l of n)l!==i&&this._base.setEnabled(l,1,s)};t?r(t):Ki(s=>r(s))}remove(i){this._base.remove(i)}};var ohf=le("IMcpGatewayService"),edt="mcpGateway",R8t="mcpGatewayToolBroker";var m1e=class{constructor(i,e){this._remoteAgentService=i;this._logService=e}async createGateway(i,e){if(this._logService.debug(`[McpGateway][BrowserWorkbench] createGateway requested (inRemote=${i})`),!i){this._logService.info("[McpGateway][BrowserWorkbench] Cannot create local gateway in browser environment");return}let t=this._remoteAgentService.getConnection();if(!t){this._logService.info("[McpGateway][BrowserWorkbench] No remote connection available (serverless web)");return}return this._logService.info("[McpGateway][BrowserWorkbench] Creating remote gateway via remote server"),t.withChannel(edt,async o=>{let n=await o.call("createGateway",e?{chatSessionResource:e.toString()}:void 0),r=RPo(n.servers);this._logService.info(`[McpGateway][BrowserWorkbench] Remote gateway created with ${r.length} server(s)`);let s=U.map(U.filter(o.listen("onDidChangeGatewayServers"),l=>l.gatewayId===n.gatewayId),l=>RPo(l.servers));return{servers:r,onDidChangeServers:s,dispose:()=>{this._logService.info(`[McpGateway][BrowserWorkbench] Disposing remote gateway: ${n.gatewayId}`),o.call("disposeGateway",n.gatewayId).then(void 0,l=>{this._logService.warn(`[McpGateway][BrowserWorkbench] Failed to dispose remote gateway: ${n.gatewayId}`,l)})}}})}};m1e=I([m(0,bo),m(1,re)],m1e);function RPo(a){return a.map(i=>({label:i.label,address:A.revive(i.address)}))}var h1e=class extends k{constructor(e,t,o=5e3){super();this._mcpService=e;this._logService=t;this._startupGracePeriodMs=o;this._onDidChangeTools=this._register(new T);this._onDidChangeResources=this._register(new T);this._onDidChangeServers=this._register(new T);this._startupGrace=new Map;this._logService.debug("[McpGateway][ToolBroker] Initialized");let n=!1;this._register(ve(l=>{for(let c of this._mcpService.servers.read(l))c.tools.read(l);n?(this._logService.debug("[McpGateway][ToolBroker] Tools changed, firing onDidChangeTools"),this._onDidChangeTools.fire()):n=!0}));let r=!1;this._register(ve(l=>{for(let c of this._mcpService.servers.read(l))c.capabilities.read(l);r?(this._logService.debug("[McpGateway][ToolBroker] Resources changed, firing onDidChangeResources"),this._onDidChangeResources.fire()):r=!0}));let s=!1;this._register(ve(l=>{let c=this._mcpService.servers.read(l);s?(this._logService.debug("[McpGateway][ToolBroker] Servers changed, firing onDidChangeServers"),this._onDidChangeServers.fire(c.map(u=>({id:u.definition.id,label:u.definition.label})))):s=!0}))}_getServerById(e){for(let t of this._mcpService.servers.get())if(t.definition.id===e)return t}_waitForStartup(e){let t=e.definition.id;if(this._startupGrace.get(t)?.resolved){let n=e.cacheState.get();(n===0||n===2)&&this._startupGrace.delete(t)}if(!this._startupGrace.has(t)){let n={promise:Promise.race([this._ensureServerReady(e),new Promise(r=>setTimeout(()=>r(!1),this._startupGracePeriodMs))]),resolved:!1};n.promise.then(()=>{n.resolved=!0}),this._startupGrace.set(t,n)}return this._startupGrace.get(t).promise}async _shouldUseCachedData(e){let t=e.cacheState.get();if(t===0||t===2){await this._waitForStartup(e);let o=e.cacheState.get();return o===5||o===1||o===4}return t===5||t===1||t===4}listen(e,t){switch(t){case"onDidChangeTools":return this._onDidChangeTools.event;case"onDidChangeResources":return this._onDidChangeResources.event;case"onDidChangeServers":return this._onDidChangeServers.event}throw new Error(`Invalid listen: ${t}`)}async call(e,t,o,n){switch(this._logService.debug(`[McpGateway][ToolBroker] IPC call: ${t}`),t){case"listServers":return this._listServers();case"listToolsForServer":{let{serverId:r}=o;return await this._listToolsForServer(r)}case"callToolForServer":{let{serverId:r,name:s,args:l,chatSessionResource:c}=o;return await this._callToolForServer(r,s,l||{},c,n)}case"listResourcesForServer":{let{serverId:r}=o;return await this._listResourcesForServer(r)}case"readResourceForServer":{let{serverId:r,uri:s}=o;return await this._readResourceForServer(r,s,n)}case"listResourceTemplatesForServer":{let{serverId:r}=o;return await this._listResourceTemplatesForServer(r)}}throw new Error(`Invalid call: ${t}`)}_listServers(){let e=this._mcpService.servers.get(),t=[];for(let o of e)t.push({id:o.definition.id,label:o.definition.label});return this._logService.debug(`[McpGateway][ToolBroker] listServers result: ${t.length} server(s): [${t.map(o=>o.label).join(", ")}]`),t}async _listToolsForServer(e){let t=this._getServerById(e);if(!t)return this._logService.warn(`[McpGateway][ToolBroker] listToolsForServer: unknown server '${e}'`),[];if(!await this._shouldUseCachedData(t))return this._logService.debug(`[McpGateway][ToolBroker] Server '${e}' not ready, skipping tool listing`),[];let o=t.tools.get().filter(n=>n.visibility&1).map(n=>n.definition);return this._logService.debug(`[McpGateway][ToolBroker] listToolsForServer '${e}': ${o.length} tool(s)`),o}async _callToolForServer(e,t,o,n,r=Ie.None){this._logService.debug(`[McpGateway][ToolBroker] callToolForServer '${e}' tool '${t}' with args: ${JSON.stringify(o)}`);let s=this._getServerById(e);if(!s)throw new Error(`Unknown server: ${e}`);let l=s.tools.get().find(p=>p.definition.name===t&&p.visibility&1);if(!l)throw new Error(`Unknown tool '${t}' on server '${e}'`);let c=n?{chatSessionResource:A.parse(n)}:void 0,u=await l.call(o,c,r);return this._logService.debug(`[McpGateway][ToolBroker] Tool '${t}' on '${e}' completed (isError=${u.isError??!1}, content blocks=${u.content.length})`),u}async _listResourcesForServer(e){let t=this._getServerById(e);if(!t)return this._logService.warn(`[McpGateway][ToolBroker] listResourcesForServer: unknown server '${e}'`),[];if(!await this._shouldUseCachedData(t))return[];let o=t.capabilities.get();if(!o||!(o&16))return this._logService.debug(`[McpGateway][ToolBroker] Server '${e}' has no resource capability`),[];try{let n=await kb.callOn(t,r=>r.listResources());return this._logService.debug(`[McpGateway][ToolBroker] Server '${e}' listed ${n.length} resource(s)`),n}catch(n){return this._logService.warn(`[McpGateway][ToolBroker] Server '${e}' failed to list resources`,n),[]}}async _readResourceForServer(e,t,o=Ie.None){let n=this._getServerById(e);if(!n)throw new Error(`Unknown server: ${e}`);this._logService.debug(`[McpGateway][ToolBroker] readResourceForServer '${t}' from server '${e}'`);let r=await kb.callOn(n,s=>s.readResource({uri:t},o),o);return this._logService.debug(`[McpGateway][ToolBroker] readResourceForServer returned ${r.contents.length} content(s)`),r}async _listResourceTemplatesForServer(e){let t=this._getServerById(e);if(!t)return this._logService.warn(`[McpGateway][ToolBroker] listResourceTemplatesForServer: unknown server '${e}'`),[];if(!await this._shouldUseCachedData(t))return[];let o=t.capabilities.get();if(!o||!(o&16))return[];try{let n=await kb.callOn(t,r=>r.listResourceTemplates());return this._logService.debug(`[McpGateway][ToolBroker] Server '${e}' listed ${n.length} resource template(s)`),n}catch(n){return this._logService.warn(`[McpGateway][ToolBroker] Server '${e}' failed to list resource templates`,n),[]}}async _ensureServerReady(e){let t=e.cacheState.get();if(t!==0&&t!==2)return!0;this._logService.debug(`[McpGateway][ToolBroker] Server '${e.definition.id}' not ready (cacheState=${t}), starting...`);try{let o=await cV(e,{promptType:"all-untrusted",errorOnUserInteraction:!0});return this._logService.debug(`[McpGateway][ToolBroker] Server '${e.definition.id}' ready=${o}`),o}catch(o){return this._logService.warn(`[McpGateway][ToolBroker] Server '${e.definition.id}' failed to start`,o),!1}}};var g1e=class{constructor(i,e,t){i.getConnection()?.registerChannel(R8t,new h1e(e,t))}};g1e=I([m(0,bo),m(1,Vs),m(2,re)],g1e);async function L8t(a,i){await a.openView(Xr,!0);let e=i.getWidgetsByLocations("panel");if(e.length)return e[0];let t=U.toPromise(U.filter(i.onDidAddWidget,o=>o.location==="panel"));return await Uu(t,1e4,()=>t.cancel())}var M1=class extends k{constructor(e,t,o,n,r){super();this._mcpService=e;this._fileService=t;this._quickInputService=o;this._notificationService=n;this._chatAttachmentResolveService=r;this._resources=De(this,{picks:new Map,isBusy:!0});this._pickItemsStack=new ra;this._inDirectory=De(this,void 0);this.hasServersWithResources=ke(e=>{let t=!1;for(let o of this._mcpService.servers.read(e)){let n=o.capabilities.read(void 0);if(n===void 0)t=!0;else if(n&16){t=!0;break}}return t});this.checkIfNestedResources=()=>!this._pickItemsStack.isEmpty()}static sep(e){return{id:e.definition.id,type:"separator",label:e.definition.label}}addCurrentMCPQuickPickItemLevel(e,t){let o=!1;if(o=this._pickItemsStack.isEmpty(),!o){let n=this._pickItemsStack.peek();n?.server===e&&n.resources===t?o=!1:o=!0}o&&this._pickItemsStack.push({server:e,resources:t})}navigateBack(){let e=this._pickItemsStack.pop();return e?(this._inDirectory.set({server:e.server,resources:e.resources},void 0),!0):!1}static item(e){let t=e.icons.getUrl(22);return gRe(e)?{id:e.template.template,label:e.title||e.name,description:e.description,detail:d(13071,null,e.template.template),iconPath:t}:{id:e.uri.toString(),label:e.title||e.name,description:e.description,detail:e.mcpUri+(e.sizeInBytes!==void 0?" ("+Ml.formatSize(e.sizeInBytes)+")":""),iconPath:t}}async navigate(e,t){if(gRe(e))return!1;let o=e.uri,n;try{n=await this._fileService.resolve(o,{resolveMetadata:!1})}catch{return!1}if(n&&this._isDirectoryResource(e)&&(n.children?.length??0)>0){let r=this._resources.get().picks.get(t);r&&this.addCurrentMCPQuickPickItemLevel(t,r);let s=n.children.map(l=>({uri:_C.fromServer(t.definition,l.resource.toString()),mcpUri:l.resource.path,name:l.name,title:l.name,description:e.description,mimeType:void 0,sizeInBytes:l.size,icons:Jq.fromParsed(void 0)}));return this._inDirectory.set({server:t,resources:s},void 0),!0}return!1}toAttachment(e,t){let o="noop";return this._isDirectoryResource(e)?(this.checkIfDirectoryAndPopulate(e,t),o):gRe(e)?this._resourceTemplateToAttachment(e).then(n=>n||o):this._resourceToAttachment(e).then(n=>n||o)}async checkIfDirectoryAndPopulate(e,t){try{return!await this.navigate(e,t)}catch{return!1}}async toURI(e){if(gRe(e)){let t=await this._resourceTemplateToURI(e);return t&&await this._verifyUriIfNeeded(t)}else return e.uri}async _resourceToAttachment(e){let t=await this._chatAttachmentResolveService.resolveImageEditorAttachContext(e.uri,void 0,e.mimeType);return t||{id:e.uri.toString(),kind:"file",name:e.name,value:e.uri}}async _resourceTemplateToAttachment(e){let t=await this._resourceTemplateToURI(e),o=t&&await this._verifyUriIfNeeded(t);return o&&this._resourceToAttachment({uri:o,name:e.name,mimeType:e.mimeType})}async _verifyUriIfNeeded({uri:e,needsVerification:t}){if(!t||await this._fileService.exists(e))return e;this._notificationService.warn(d(13073,null,_C.toServer(e).resourceURL.toString()))}async _resourceTemplateToURI(e){let t=e.template.components.flatMap(l=>typeof l=="object"?l.variables:[]),o=this._quickInputService.createQuickPick(),n=new qe,r={};o.totalSteps=t.length,o.ignoreFocusOut=!0;let s=!1;try{for(let l=0;l<t.length;l++){let c=t[l],u=await this._promptForTemplateValue(o,c,r,e);if(u===void 0)return;s||=!u.completed,r[t[l].name]=c.repeatable?u.value.split("/"):u.value}return{uri:e.resolveURI(r),needsVerification:s}}finally{n.dispose(!0),o.dispose()}}_promptForTemplateValue(e,t,o,n){let r=new O,s=new Map([]),l={...o};for(let v of n.template.components.flatMap(b=>typeof b=="object"?b.variables:[]))l.hasOwnProperty(v.name)||(l[v.name]=`$${v.name.toUpperCase()}`);let c=d(13075,null,t.name.toUpperCase(),n.template.resolve(l).replaceAll("%24","$"));t.optional&&(c+=" ("+d(13074,null)+")"),e.placeholder=c,e.value="",e.items=[],e.show();let u=ht(),p=(v,b=[])=>{let S=b.filter(y=>y!==v).map(y=>({id:y,label:y}));v?S.unshift({id:u,label:v}):t.optional&&S.unshift({id:u,label:d(13072,null)}),e.items=S},h=new qe;r.add(ee(()=>h.dispose(!0)));let g=()=>{let v=e.value,b=s.get(v);b||(b=n.complete(t.name,v,o,h.token),s.set(v,b)),b.then(S=>{h.token.isCancellationRequested||p(v,S)}).catch(()=>{s.delete(v)}).finally(()=>{h.token.isCancellationRequested||(e.busy=!1)})},f=r.add(new Dt(g,300));return new Promise(v=>{r.add(e.onDidHide(()=>v(void 0))),r.add(e.onDidAccept(()=>{let b=e.selectedItems[0];b.id===u?v({value:e.value,completed:!1}):t.explodable&&b.label.endsWith("/")&&b.label!==e.value?e.value=b.label:v({value:b.label,completed:!0})})),r.add(e.onDidChangeValue(b=>{e.busy=!0,h.dispose(!0),h=new qe,f.cancel(),p(b),s.has(e.value)?g():f.schedule()})),g()}).finally(()=>r.dispose())}_isDirectoryResource(e){return e.mimeType&&e.mimeType==="inode/directory"?!0:gRe(e)?e.template.template.endsWith("/"):e.uri.path.endsWith("/")}getPicks(e){let t=new qe(e),o=!0;this._register(ee(()=>t.dispose(!0)));let n=!0;this._register(Zo(()=>{n=!1,r()},5e3));let r=()=>{let l=new Map;for(let[c,u]of s){let p=[];if(l.set(c,p),u.templates.isResolved)p.push(...u.templates.value);else if(n)break;if(p.push(...u.resourcesSoFar),!u.resources.isSettled&&n)break}this._resources.set({picks:l,isBusy:o},void 0)},s=new Map;return Promise.all((this.explicitServers||this._mcpService.servers.get()).map(async l=>{let c=l.capabilities.get(),u={templates:new Mo,resourcesSoFar:[],resources:new Mo};s.set(l,u),c===void 0&&(c=await new Promise(p=>{l.start().then(h=>{(h.state===Sr.Kind.Error||h.state===Sr.Kind.Stopped)&&p(void 0)}),this._register(t.token.onCancellationRequested(()=>p(void 0))),this._register(ve(h=>{let g=l.capabilities.read(h);g!==void 0&&p(g)}))})),c&&c&16?await Promise.all([u.templates.settleWith(l.resourceTemplates(t.token).catch(()=>[])).finally(r),u.resources.settleWith((async()=>{for await(let p of l.resources(t.token))u.resourcesSoFar=u.resourcesSoFar.concat(p),r()})())]):(u.templates.complete([]),u.resources.complete([]))})).finally(()=>{o=!1,r()}),ke(this,l=>{let c=this._inDirectory.read(l);return c?{picks:new Map([[c.server,c.resources]]),isBusy:!1}:this._resources.read(l)})}};M1=I([m(0,Vs),m(1,ge),m(2,$e),m(3,Ne),m(4,nV)],M1);var f1e=class{constructor(i,e,t,o,n){this._scopeTo=i;this._instantiationService=e;this._editorService=t;this._chatWidgetService=o;this._viewsService=n}applyToPick(i,e,t){i.canAcceptInBackground=!0,i.busy=!0,i.keepScrollPosition=!0;let o=new O,n="_goback_",r=d(13069,null),s=o.add(this._instantiationService.createInstance(M1));this._scopeTo&&(s.explicitServers=[this._scopeTo]);let l=s.getPicks(e);return o.add(ve(c=>{let u=l.read(c),p=u.isBusy,h=[];for(let[g,f]of u.picks){h.push(M1.sep(g));for(let v of f){let b=M1.item(v);b.buttons=[{iconClass:q.asClassName(L.attach),tooltip:r}],h.push({...b,resource:v,server:g})}}if(s.checkIfNestedResources()){let g={id:n,label:d(13068,null),alwaysShow:!0};h.push(g)}i.items=h,i.busy=p})),o.add(i.onDidTriggerItemButton(c=>{if(c.button.tooltip===r){i.busy=!0;let u=c.item,p=s.toAttachment(u.resource,u.server);p instanceof Promise&&p.then(async h=>{h!=="noop"&&(await L8t(this._viewsService,this._chatWidgetService))?.attachmentModel.addContext(...Ec(h)),i.hide()})}})),o.add(i.onDidHide(()=>{s.dispose()})),o.add(i.onDidAccept(async c=>{try{i.busy=!0;let[u]=i.selectedItems;if(u.id===n){s.navigateBack(),i.busy=!1;return}let p=u,h=p.resource;if(!await s.navigate(h,p.server)){let f=await s.toURI(h);f&&(i.hide(),this._editorService.openEditor({resource:f,options:{preserveFocus:c.inBackground}}))}}finally{i.busy=!1}})),o}};f1e=I([m(1,F),m(2,ie),m(3,Lt),m(4,Gt)],f1e);var v1e=class extends f1e{constructor(e,t,o,n,r,s){super(e,t,o,n,r);this._quickInputService=s}async pick(e=Ie.None){let t=new O,o=t.add(this._quickInputService.createQuickPick({useSeparators:!0}));o.placeholder=d(13070,null),t.add(this.applyToPick(o,e)),t.add(o.onDidHide(()=>t.dispose())),o.show(),await U.toPromise(o.onDidHide)}};v1e=I([m(1,F),m(2,ie),m(3,Lt),m(4,Gt),m(5,$e)],v1e);var O9=class extends f1e{constructor(e,t,o,n){super(void 0,e,t,o,n);this.defaultFilterValue=1}static{this.PREFIX="mcpr "}provide(e,t,o){return this.applyToPick(e,t,o)}};O9=I([m(0,F),m(1,ie),m(2,Lt),m(3,Gt)],O9);var b1e=class extends k{constructor(e,t,o){super();this._chatContextPickService=e;this._instantiationService=t;this._addContextMenu=this._register(new ue);let n=ke(r=>{let s=!1;for(let l of o.servers.read(r)){let c=l.capabilities.read(void 0);if(c===void 0)s=!0;else if(c&16){s=!0;break}}return s});this._register(ve(r=>{n.read(r)&&!this._addContextMenu.value?this._registerAddContextMenu():this._addContextMenu.clear()}))}_registerAddContextMenu(){this._addContextMenu.value=this._chatContextPickService.registerChatContextItem({type:"pickerPick",label:d(12879,null),icon:L.mcp,isEnabled(e){return!!e.attachmentCapabilities.supportsMCPAttachments},asPicker:()=>{let e=this._instantiationService.createInstance(M1);return{placeholder:d(12880,null),picks:(t,o)=>this._getResourcePicks(o,e),goBack:()=>e.navigateBack(),dispose:()=>{e.dispose()}}}})}_getResourcePicks(e,t){let o=t.getPicks(e);return ke(this,n=>{let r=o.read(n),s=[];for(let[l,c]of r.picks)if(c.length!==0){s.push(M1.sep(l));for(let u of c)s.push({...M1.item(u),asAttachment:()=>t.toAttachment(u,l)})}return{picks:s,busy:r.isBusy}})}};b1e=I([m(0,iI),m(1,F),m(2,Vs)],b1e);var Nv={original:"MCP",value:"MCP"},M8t=class extends z{constructor(){super({id:"workbench.mcp.listServer",title:P(12915,"List Servers"),icon:L.server,category:Nv,f1:!0,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),menu:[{when:C.and(C.or(C.and(C.equals(`config.${gie}`,"never"),L1.hasUnknownTools),L1.hasServersWithErrors),Z.chatModeKind.isEqualTo("agent"),Z.lockedToCodingAgent.negate(),C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())),id:R.ChatInput,group:"navigation",order:101}]})}async run(i){let e=i.get(Vs),t=i.get(fe),o=i.get($e),n=new O,r=o.createQuickPick({useSeparators:!0});r.placeholder=d(12928,null),e.activateCollections(),n.add(r),n.add(ve(l=>{let c=yy(e.servers.read(l).slice().sort((p,h)=>p.collection.order-h.collection.order),p=>p.collection.id),u=r.items.length===0;r.items=[{id:"$add",label:d(12886,null),description:d(12887,null),alwaysShow:!0,iconClass:q.asClassName(L.add)},...Object.values(c).filter(p=>p.length).flatMap(p=>[{type:"separator",label:p[0].collection.label,id:p[0].collection.id},...p.map(h=>{let g=sR(h.enablement.read(l));return{id:h.definition.id,label:h.definition.label,description:g?d(12907,null):Sr.toString(h.connectionState.read(l))}})])],u&&r.items.length>3&&(r.activeItems=r.items.slice(2,3))}));let s=await new Promise(l=>{n.add(r.onDidAccept(()=>{l(r.activeItems[0])})),n.add(r.onDidHide(()=>{l(void 0)})),r.show()});n.dispose(),s&&(s.id==="$add"?t.executeCommand("workbench.mcp.addConfiguration"):t.executeCommand("workbench.mcp.serverOptions",s.id))}},P8t=class extends z{constructor(){super({id:"workbench.mcp.serverOptionsInConfirmation",title:P(12919,"Server Options"),category:Nv,icon:L.settingsGear,f1:!1,menu:[{id:R.ChatConfirmationMenu,when:C.and(C.equals("chatConfirmationPartSource","mcp"),C.or(C.equals("chatConfirmationPartType","chatToolConfirmation"),C.equals("chatConfirmationPartType","elicitation"))),group:"navigation"}]})}async run(i,e){let t=i.get(Wn);if(e.kind==="toolInvocation"){let o=t.getTool(e.toolId);o?.source.type==="mcp"&&i.get(fe).executeCommand("workbench.mcp.serverOptions",o.source.definitionId)}else e.kind==="elicitation2"?e.source?.type==="mcp"&&i.get(fe).executeCommand("workbench.mcp.serverOptions",e.source.definitionId):bs(e)}},A8t=class extends z{constructor(){super({id:"workbench.mcp.serverOptions",title:P(12919,"Server Options"),category:Nv,f1:!1})}async run(i,e){let t=i.get(Vs),o=i.get($e),n=i.get(xc),r=i.get(ie),s=i.get(fe),l=i.get(Z3),c=i.get(gP),u=i.get(ks),p=t.servers.get().find(x=>x.definition.id===e);if(!p)return;let h=n.collections.get().find(x=>x.id===p.collection.id),g=h?.serverDefinitions.get().find(x=>x.id===p.definition.id),f=[],v=p.connectionState.get(),b=sR(p.enablement.get());f.push({type:"separator",label:d(12883,null)}),b?f.push({label:d(12910,null),action:"enable"}):Sr.canBeStarted(v.state)?f.push({label:d(12935,null),action:"start"}):(f.push({label:d(12937,null),action:"stop"}),f.push({label:d(12923,null),action:"restart"})),f.push(...this._getAuthActions(c,p.definition.id));let S=g?.presentation?.origin||h?.presentation?.origin;S&&f.push({label:d(12903,null),action:"config"}),f.push({label:d(12931,null),action:"showOutput"}),f.push({type:"separator",label:d(12882,null)},{label:d(12904,null),description:d(12932,null),action:"configSampling"}),l.hasLogs(p)&&f.push({label:d(12924,null),description:d(12925,null),action:"samplingLog"});let y=p.capabilities.get();(y===void 0||y&16)&&(f.push({type:"separator",label:d(12881,null)}),f.push({label:d(12922,null),action:"resources"}));let w=await o.pick(f,{placeHolder:d(12927,null,p.definition.label)});if(w)switch(w.action){case"enable":t.enablementModel.setEnabled(p.definition.id,3);break;case"start":await p.start({promptType:"all-untrusted"}),p.showOutput();break;case"stop":await p.stop();break;case"restart":await p.stop(),await p.start({promptType:"all-untrusted"});break;case"disconnect":await p.stop(),await this._handleAuth(u,w.accountQuery,p.definition,!1);break;case"signout":await p.stop(),await this._handleAuth(u,w.accountQuery,p.definition,!0);break;case"showOutput":p.showOutput();break;case"config":r.openEditor({resource:A.isUri(S)?S:S.uri,options:{selection:A.isUri(S)?void 0:S.range}});break;case"configSampling":return s.executeCommand("workbench.mcp.configureSamplingModels",p);case"resources":return s.executeCommand("workbench.mcp.browseResources",p);case"samplingLog":r.openEditor({resource:void 0,contents:l.getLogText(p),label:d(12926,null,p.definition.label)});break;default:bs(w)}}_getAuthActions(i,e){let t=[];for(let[o,n]of i.mcpServer(e).getAllAccountPreferences()){let r=i.provider(o).account(n);r.mcpServer(e).isAccessAllowed()&&(r.entities().getEntityCount().total>1?t.push({action:"disconnect",label:d(12908,null),description:`(${n})`,accountQuery:r}):t.push({action:"signout",label:d(12933,null),description:`(${n})`,accountQuery:r}))}return t}async _handleAuth(i,e,t,o){let{providerId:n,accountName:r}=e;if(e.mcpServer(t.id).setAccessAllowed(!1,t.label),o){let l=(await i.getAccounts(n)).find(c=>c.label===r);if(l){let c=await i.getSessions(n,void 0,{account:l});for(let u of c)await i.removeSession(n,u.id)}}}},S1e=class extends k{constructor(i,e,t,o,n){super();let r=De(this,!1),s=hr(gie,"newAndOutdated",n),l;(S=>(S[S.None=0]="None",S[S.NewTools=1]="NewTools",S[S.Error=2]="Error",S[S.Refreshing=3]="Refreshing"))(l||={});function c(g){return typeof g.start=="function"}let u=ke(g=>{let f=e.servers.read(g),v=[];for(let y of f){let w=0;switch(y.cacheState.read(g)){case 0:case 2:w=y.connectionState.read(g).state===Sr.Kind.Error?2:1;break;case 3:w=3;break;default:w=y.connectionState.read(g).state===Sr.Kind.Error?2:0;break}v[w]??=[],v[w].push(y)}let b=e.lazyCollectionState.read(g);b.state===1?(v[3]??=[],v[3].push(...b.collections)):b.state===0&&(v[1]??=[],v[1].push(...b.collections));let S=v.length-1;return S===1&&s.read(g)!=="never"&&(S=0),{state:S,servers:v[S]||[]}}),p=mv(this,(g,f)=>f&&r.read(g)?f:u.read(g)),h=p.map(g=>g.state);this._store.add(i.register(R.ChatInput,"workbench.mcp.listServer",(g,f)=>{if(g instanceof Do)return t.createInstance(class extends Cl{render(v){super.render(v),v.classList.add("chat-mcp"),v.style.position="relative";let b=v.appendChild(_(".chat-mcp-state-indicator"));b.style.display="none",this._register(ve(S=>{let y=p.read(S),{state:w}=y;this.updateTooltip(),b.ariaLabel=this.getLabelForState(y),b.className="chat-mcp-state-indicator",w===1?(b.style.display="block",b.classList.add("chat-mcp-state-new",...q.asClassNameArray(L.refresh))):w===2?(b.style.display="block",b.classList.add("chat-mcp-state-error",...q.asClassNameArray(L.warning))):w===3?(b.style.display="block",b.classList.add("chat-mcp-state-refreshing",...q.asClassNameArray(PT))):b.style.display="none"}))}async onClick(v){v.preventDefault(),v.stopPropagation();let{state:b,servers:S}=u.get();if(b===1){let y=new wee;S.filter(c).forEach(w=>w.stop().then(()=>w.start({interaction:y}))),e.activateCollections()}else if(b===3)wu(S,c)?.showOutput();else if(b===2){let y=wu(S,c);y&&(await y.showOutput(!0),o.executeCommand("workbench.mcp.serverOptions",y.definition.id))}else o.executeCommand("workbench.mcp.listServer")}getTooltip(){return this.getLabelForState()||super.getTooltip()}getHoverContents({state:v,servers:b}=u.get()){let S=E=>Xw({text:E.definition.label,id:"workbench.mcp.serverOptions",arguments:[E.definition.id],tooltip:d(12929,null,E.definition.label)}),y=b.length===1,w=b.map(E=>c(E)?S(E):"`"+E.label+"`").map(E=>y?E:`- ${E}`).join(`
`),x;if(v===1)x=new he(y?d(12918,null,w):d(12917,null,w));else if(v===2)x=new he(y?d(12912,null,w):d(12911,null,w));else return this.getLabelForState()||void 0;return{element:E=>{r.set(!0,void 0);let M=new O;M.add(ee(()=>r.set(!1,void 0))),M.add(E.onCancellationRequested(()=>{M.dispose()})),M.add(Ly(ut,()=>{N.isConnected||M.dispose()},2e3));let N=_("div.mcp-hover-contents");x.isTrusted=!0;let V=M.add(Lg(x));N.appendChild(V.element);let H=_("hr.mcp-hover-divider");N.appendChild(H);let K=_("div.mcp-hover-setting"),j=d(12888,null),J=M.add(new qf(j,s.get()!=="never",{...Ag}));K.appendChild(J.domNode);let se=_("span.mcp-hover-setting-label",void 0,j);K.appendChild(se);let ae=()=>{let ce=J.checked?"newAndOutdated":"never";n.updateValue(gie,ce)};return M.add(J.onChange(ae)),M.add($(se,ne.CLICK,()=>{J.checked=!J.checked,ae()})),N.appendChild(K),N}}}getLabelForState({state:v,servers:b}=u.get()){return v===1?d(12916,null,b.length||1):v===2?d(12938,null,b.length||1):v===3?d(12939,null):null}},g,{...f,keybindingNotRenderedWithLabel:!0})},U.fromObservableLight(h)))}};S1e=I([m(0,sh),m(1,Vs),m(2,F),m(3,fe),m(4,B)],S1e);var N8t=class extends z{constructor(){super({id:"workbench.mcp.resetTrust",title:P(12921,"Reset Trust"),category:Nv,f1:!0,precondition:C.and(L1.toolsCount.greater(0),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())})}run(i){i.get(Vs).resetTrust()}},O8t=class extends z{constructor(){super({id:"workbench.mcp.resetCachedTools",title:P(12920,"Reset Cached Tools"),category:Nv,f1:!0,precondition:C.and(L1.toolsCount.greater(0),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())})}run(i){i.get(Vs).resetCaches()}},F8t=class extends z{constructor(){super({id:"workbench.mcp.addConfiguration",title:P(12884,"Add Server..."),metadata:{description:P(12885,"Installs a new Model Context protocol to the mcp.json settings")},category:Nv,f1:!0,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),menu:{id:R.EditorContent,when:C.and(C.regex(Ho.Path.key,/\.vscode[/\\]mcp\.json$/),Tr.isEqualTo(EW),C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()))}})}async run(i,e){let t=i.get(F),o=i.get(Ae),n=e?o.getWorkspaceFolder(A.parse(e)):void 0;return t.createInstance(UVe,n??void 0).run()}},W8t=class extends z{constructor(){super({id:"workbench.mcp.installFromManifest",title:P(12913,"Install Server from Manifest..."),metadata:{description:P(12914,"Install an MCP server from a JSON manifest file")},category:Nv,f1:!0,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())})}async run(i){return i.get(F).createInstance(zVe).run()}},V8t=class extends z{constructor(){super({id:"workbench.mcp.removeStoredInput",title:P(12920,"Reset Cached Tools"),category:Nv,f1:!1})}run(i,e,t){i.get(xc).clearSavedInputs(e,t)}},B8t=class extends z{constructor(){super({id:"workbench.mcp.editStoredInput",title:P(12909,"Edit Stored Input"),category:Nv,f1:!1})}run(i,e,t,o,n){let r=t&&i.get(Ae).getWorkspaceFolder(t);i.get(xc).editSavedInput(e,r||void 0,o,n)}},H8t=class extends z{constructor(){super({id:"workbench.mcp.showConfiguration",title:P(12899,"Show Configuration"),category:Nv,f1:!1})}run(i,e,t){let o=i.get(xc).collections.get().find(s=>s.id===e);if(!o)return;let n=o?.serverDefinitions.get().find(s=>s.id===t),r=i.get(ie);n?.presentation?.origin?r.openEditor({resource:n.presentation.origin.uri,options:{selection:n.presentation.origin.range}}):o.presentation?.origin&&r.openEditor({resource:o.presentation.origin})}},U8t=class extends z{constructor(){super({id:"workbench.mcp.showOutput",title:P(12900,"Show Output"),category:Nv,f1:!1})}run(i,e){i.get(Vs).servers.get().find(t=>t.definition.id===e)?.showOutput()}},z8t=class extends z{constructor(){super({id:"workbench.mcp.restartServer",title:P(12897,"Restart Server"),category:Nv,f1:!1})}async run(i,e,t){let o=i.get(Vs).servers.get().find(n=>n.definition.id===e);o?.showOutput(),await o?.stop(),await o?.start({promptType:"all-untrusted",...t})}},K8t=class extends z{constructor(){super({id:"workbench.mcp.startServer",title:P(12901,"Start Server"),category:Nv,f1:!1})}async run(i,e,t){let o=i.get(Vs).servers.get();e!=="*"&&(o=o.filter(r=>r.definition.id===e));let n={promptType:"all-untrusted",...t};t?.waitForLiveTools?await Promise.all(o.map(r=>cV(r,n))):await Promise.all(o.map(r=>r.start(n)))}},G8t=class extends z{constructor(){super({id:"workbench.mcp.stopServer",title:P(12902,"Stop Server"),category:Nv,f1:!1})}async run(i,e){await i.get(Vs).servers.get().find(o=>o.definition.id===e)?.stop()}},q8t=class extends z{constructor(){super({id:"workbench.mcp.browseServers",title:P(12890,"MCP Servers"),tooltip:P(12892,"Browse MCP Servers"),category:Nv,icon:L.search,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),menu:[{id:Qg,group:"1_predefined",order:1,when:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())},{id:R.ViewTitle,when:C.and(C.equals("view",fRe),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),group:"navigation"}]})}async run(i){i.get(Ui).openSearch("@mcp ")}};be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.mcp.browseServers",title:P(12891,"Browse MCP Servers"),category:Nv,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())}});var $8t=class extends z{constructor(){super({id:"workbench.mcp.showInstalledServers",title:P(12898,"Show Installed Servers"),category:Nv,precondition:C.and(xee,Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),f1:!0})}async run(i){let e=i.get(Gt);await e.openView(fRe,!0)||(await e.openViewContainer(Rh),await e.openView(fRe,!0))}};be.appendMenuItem(LC,{command:{id:"workbench.mcp.showInstalledServers",title:P(12930,"MCP Servers")},when:C.and(Z.enabled,C.equals("view",Xr)),order:10,group:"2_level"});var j8t=class extends z{async run(i){let e=i.get(ge),t=i.get(ie),o=await this.getURI(i);await e.exists(o)||await e.createFile(o,Ke.fromString(JSON.stringify({servers:{}},null,"	"))),await t.openEditor({resource:o})}},Q8t=class extends j8t{constructor(){super({id:"workbench.mcp.openUserMcpJson",title:P(12894,"Open User Configuration"),category:Nv,f1:!0,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())})}getURI(i){let e=i.get(gn);return Promise.resolve(e.currentProfile.mcpResource)}},Y8t=class extends j8t{constructor(){super({id:"workbench.mcp.openRemoteUserMcpJson",title:P(12893,"Open Remote User Configuration"),category:Nv,f1:!0,precondition:C.and(C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),Qb.notEqualsTo(""))})}async getURI(i){let e=i.get(gn);return(await i.get(jN).getRemoteProfile(e.currentProfile)).mcpResource}},X8t=class extends z{constructor(){super({id:"workbench.mcp.openWorkspaceFolderMcpJson",title:P(12895,"Open Workspace Folder MCP Configuration"),category:Nv,f1:!0,precondition:C.and(C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),i_.notEqualsTo(0))})}async run(i){let e=i.get(Ae),t=i.get(fe),o=i.get(ie),n=e.getWorkspace().folders,r=n.length===1?n[0]:await t.executeCommand(iP);r&&await o.openEditor({resource:r.toResource(kR[yb])})}},J8t=class extends z{constructor(){super({id:"workbench.mcp.openWorkspaceMcpJson",title:P(12896,"Open Workspace MCP Configuration"),category:Nv,f1:!0,precondition:C.and(C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),el.isEqualTo("workspace"))})}async run(i){let e=i.get(Ae),t=i.get(ie),o=e.getWorkspace().configuration;o&&await t.openEditor({resource:o})}},Z8t=class extends z{constructor(){super({id:"workbench.mcp.browseResources",title:P(12889,"Browse Resources..."),category:Nv,precondition:C.and(L1.serverCount.greater(0),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),f1:!0})}run(i,e){e?i.get(F).createInstance(v1e,e).pick():i.get($e).quickAccess.show(O9.PREFIX)}},eQt=class extends z{constructor(){super({id:"workbench.mcp.configureSamplingModels",title:P(12905,"Configure SamplingModel"),category:Nv})}async run(i,e){let t=i.get($e),o=i.get(Gr),n=i.get(Z3),r=new Set(n.getConfig(e).allowedModels),s=o.getLanguageModelIds().map(c=>{let u=o.lookupLanguageModel(c);if(u.isUserSelectable)return{label:u.name,description:u.tooltip,id:c,picked:r.size?r.has(c):u.isDefaultForLocation.panel}}).filter(so);s.sort((c,u)=>(u.picked?1:0)-(c.picked?1:0)||c.label.localeCompare(u.label));let l=await t.pick(s,{placeHolder:d(12906,null,e.definition.label),canPickMany:!0});return l&&await n.updateConfig(e,c=>c.allowedModels=l.map(u=>u.id)),l?.length||0}},tQt=class extends z{constructor(){super({id:"workbench.mcp.startPromptForServer",title:P(12936,"Start Prompting Server"),category:Nv,f1:!1})}async run(i,e){let t=await L8t(i.get(Gt),i.get(Lt));if(!t)return;let o=t.inputEditor,n=o.getModel();if(!n)return;let r=(o.getSelection()||n.getFullModelRange()).collapseToEnd(),s=Rdo(e.definition)+".";n.applyEdits([{range:r,text:s}]),o.setSelection(G.fromPositions(r.getEndPosition().delta(0,s.length))),t.focusInput(),Sc.get(o)?.triggerSuggest()}},iQt=class extends z{constructor(){super({id:"workbench.mcp.skipAutostart",title:P(12934,"Skip Current Autostart"),category:Nv,f1:!1})}async run(i){i.get(Vs).cancelAutostart()}};var I1e=class extends k{static{this.ID="workbench.contrib.mcp.discovery"}constructor(i,e){super();let t=hr(sy,"all",e),o=this._register(new O);this._register(ve(n=>{o.clear();let r=t.read(n);if(r!=="none")for(let s of R1.getAll()){let l=i.createInstance(s);if(r==="registry"&&!l.fromGallery){l.dispose();continue}o.add(l),l.start()}}))}};I1e=I([m(0,F),m(1,B)],I1e);var UBi={id:void 0,label:d(13004,null),description:d(13005,null),alwaysShow:!0};function Twn(a){return a.mode==="form"||a.mode===void 0&&!!a.requestedSchema}function _wn(a){return a.mode==="url"}function LPo(a){let i=a;return i.type==="string"&&Array.isArray(i.enum)&&Array.isArray(i.enumNames)}function MPo(a){let i=a;return i.type==="string"&&Array.isArray(i.enum)}function PPo(a){let i=a;return i.type==="string"&&Array.isArray(i.oneOf)}function APo(a){let i=a;return i.type==="array"&&!!i.items?.enum}function NPo(a){let i=a;return i.type==="array"&&!!i.items?.anyOf}var y1e=class{constructor(i,e,t,o){this._notificationService=i;this._quickInputService=e;this._chatService=t;this._openerService=o}elicit(i,e,t,o){return Twn(t)?this._elicitForm(i,e,t,o):_wn(t)?this._elicitUrl(i,e,t,o):Promise.reject(new Cee("Unsupported elicitation type",vb.INVALID_PARAMS,void 0))}async _elicitForm(i,e,t,o){let n=new O,r=await new Promise(s=>{let l=e?.chatSessionResource&&this._chatService.getSession(e.chatSessionResource);if(l instanceof ty){let u=l.getRequests().at(-1);if(u){let{questions:p,idToPropertyMap:h}=this._convertSchemaToQuestions(t),g=new nI(p,!0,void 0,void 0,void 0,new he(t.message),VFe(i));l.acceptResponseProgress(u,g),n.add(o.onCancellationRequested(()=>{g.completion.complete({answers:void 0})})),g.completion.p.then(f=>{if(!f.answers)s({action:"cancel"});else{let v=this._convertCarouselAnswersToElicitResult(f.answers,h,t.requestedSchema.properties);s({action:"accept",content:v})}});return}}let c=this._notificationService.notify({message:t.message,source:d(13009,null,i.definition.label),severity:ft.Info,actions:{primary:[n.add(new it("mcp.elicit.give",d(13007,null),void 0,!0,()=>s(this._doElicitForm(t,o))))],secondary:[n.add(new it("mcp.elicit.cancel",d(13003,null),void 0,!0,()=>s({action:"decline"})))]}});n.add(c.onDidClose(()=>s({action:"cancel"}))),n.add(o.onCancellationRequested(()=>s({action:"cancel"})))}).finally(()=>n.dispose());return{kind:0,value:r,dispose:()=>{}}}async _elicitUrl(i,e,t,o){let n=new O,r=new Promise((c,u)=>{n.add(o.onCancellationRequested(()=>u(new qi))),n.add(ve(p=>{let g=i.connection.read(p)?.handler.read(p);g?p.store.add(g.onDidReceiveElicitationCompleteNotification(f=>{f.params.elicitationId===t.elicitationId&&c()})):Sr.isRunning(i.connectionState.read(p))||u(new qi)}))}).finally(()=>n.dispose()),s=new O,l=await new Promise(c=>{let u=e?.chatSessionResource&&this._chatService.getSession(e.chatSessionResource);if(u instanceof ty){let p=u.getRequests().at(-1);if(p){let h=new gV(d(13015,null),new he().appendText(t.message).appendMarkdown(`

`+d(13011,null)).appendCodeblock("",t.url),d(13027,null,i.definition.label),d(13013,null,A.parse(t.url).authority),d(13008,null),async()=>{let g=await this._doElicitUrl(t,o);return c(g),r.then(()=>h.hide()),g.action==="accept"?"accepted":"rejected"},()=>(c({action:"decline"}),Promise.resolve("rejected")),VFe(i));u.acceptResponseProgress(p,h)}}else{let p=this._notificationService.notify({message:t.message+" "+d(13012,null,t.url),source:d(13009,null,i.definition.label),severity:ft.Info,actions:{primary:[s.add(new it("mcp.elicit.url.open2",d(13014,null),void 0,!0,()=>c(this._doElicitUrl(t,o))))],secondary:[s.add(new it("mcp.elicit.cancel",d(13003,null),void 0,!0,()=>c({action:"decline"})))]}});s.add(p.onDidClose(()=>c({action:"cancel"}))),s.add(o.onCancellationRequested(()=>c({action:"cancel"})))}}).finally(()=>s.dispose());return{kind:1,value:l,wait:r,dispose:()=>n.dispose()}}async _doElicitUrl(i,e){if(e.isCancellationRequested)return{action:"cancel"};try{if(await this._openerService.open(i.url,{allowCommands:!1}))return{action:"accept"}}catch{}return{action:"decline"}}async _doElicitForm(i,e){let t=this._quickInputService.createQuickPick(),o=new O;try{let n=Object.entries(i.requestedSchema.properties),r=new Set(i.requestedSchema.required||[]),s={},l=[];t.title=i.message,t.totalSteps=n.length,t.ignoreFocusOut=!0;for(let c=0;c<n.length;c++){let[u,p]=n[c],h=r.has(u),g=l.at(c);o.clear(),t.step=c+1,t.title=p.title||u,t.placeholder=this._getFieldPlaceholder(p,h),t.value=g?.value??"",t.validationMessage="",t.buttons=c>0?[this._quickInputService.backButton]:[];let f;if(p.type==="boolean"?(f=await this._handleEnumField(t,{enum:[{const:"true"},{const:"false"}],default:p.default?String(p.default):void 0},h,o,e),f.type==="value"&&(f.value=f.value==="true")):LPo(p)?f=await this._handleEnumField(t,{enum:p.enum.map((v,b)=>({const:v,title:p.enumNames[b]})),default:p.default},h,o,e):MPo(p)?f=await this._handleEnumField(t,{enum:p.enum.map(v=>({const:v})),default:p.default},h,o,e):PPo(p)?f=await this._handleEnumField(t,{enum:p.oneOf,default:p.default},h,o,e):NPo(p)?f=await this._handleMultiEnumField(t,{enum:p.items.anyOf,default:p.default},h,o,e):APo(p)?f=await this._handleMultiEnumField(t,{enum:p.items.enum.map(v=>({const:v})),default:p.default},h,o,e):(f=await this._handleInputField(t,p,h,o,e),f.type==="value"&&(p.type==="number"||p.type==="integer")&&(f.value=Number(f.value))),f.type==="back"){c-=2;continue}if(f.type==="cancel")return{action:"cancel"};l[c]={value:t.value},f.value===void 0?delete s[u]:s[u]=f.value}return{action:"accept",content:s}}finally{o.dispose(),t.dispose()}}_getFieldPlaceholder(i,e){let t=i.description||"";return e||(t=t?`${t} (${d(13028,null)})`:d(13028,null)),t}async _handleEnumField(i,e,t,o,n){let r=e.enum.map(({const:s,title:l})=>({id:s,label:s,description:l}));return t||r.push(UBi),i.canSelectMany=!1,i.items=r,e.default!==void 0&&(i.activeItems=r.filter(s=>s.id===e.default)),new Promise(s=>{o.add(n.onCancellationRequested(()=>s({type:"cancel"}))),o.add(i.onDidAccept(()=>{let l=i.selectedItems[0];l&&s({type:"value",value:l.id})})),o.add(i.onDidTriggerButton(()=>s({type:"back"}))),o.add(i.onDidHide(()=>s({type:"cancel"}))),i.show()})}async _handleMultiEnumField(i,e,t,o,n){let r=e.enum.map(({const:s,title:l})=>({id:s,label:s,description:l,picked:!!e.default?.includes(s),pickable:!0}));return t||r.push(UBi),i.canSelectMany=!0,i.items=r,new Promise(s=>{o.add(n.onCancellationRequested(()=>s({type:"cancel"}))),o.add(i.onDidAccept(()=>{i.selectedItems[0].id===void 0?s({type:"value",value:void 0}):s({type:"value",value:i.selectedItems.map(c=>c.id).filter(so)})})),o.add(i.onDidTriggerButton(()=>s({type:"back"}))),o.add(i.onDidHide(()=>s({type:"cancel"}))),i.show()})}async _handleInputField(i,e,t,o,n){i.canSelectMany=!1;let r=()=>{let s=[];if(i.value){let l=this._validateInput(i.value,e);i.validationMessage=l.message,l.isValid&&s.push({id:"$current",label:`\u27A4 ${i.value}`})}else i.validationMessage="",e.default&&s.push({id:"$default",label:`${e.default}`,description:d(13016,null)});i.validationMessage?i.severity=ft.Warning:(i.severity=ft.Ignore,t||s.push(UBi)),i.items=s};return r(),new Promise(s=>{if(n.isCancellationRequested){s({type:"cancel"});return}o.add(n.onCancellationRequested(()=>s({type:"cancel"}))),o.add(i.onDidChangeValue(r)),o.add(i.onDidAccept(()=>{let l=i.selectedItems[0].id;l?l==="$default"?s({type:"value",value:String(e.default)}):i.validationMessage||s({type:"value",value:i.value}):s({type:"value",value:void 0})})),o.add(i.onDidTriggerButton(()=>s({type:"back"}))),o.add(i.onDidHide(()=>s({type:"cancel"}))),i.show()})}_validateInput(i,e){switch(e.type){case"string":return this._validateString(i,e);case"number":case"integer":return this._validateNumber(i,e);default:bs(e)}}_validateString(i,e){if(e.minLength&&i.length<e.minLength)return{isValid:!1,message:d(13024,null,e.minLength)};if(e.maxLength&&i.length>e.maxLength)return{isValid:!1,message:d(13022,null,e.maxLength)};if(e.format){let t=this._validateStringFormat(i,e.format);if(!t.isValid)return t}return{isValid:!0,parsedValue:i}}_validateStringFormat(i,e){switch(e){case"email":return i.includes("@")?{isValid:!0}:{isValid:!1,message:d(13019,null)};case"uri":return URL.canParse(i)?{isValid:!0}:{isValid:!1,message:d(13026,null)};case"date":{if(!/^\d{4}-\d{2}-\d{2}$/.test(i))return{isValid:!1,message:d(13017,null)};let o=new Date(i);return isNaN(o.getTime())?{isValid:!1,message:d(13017,null)}:{isValid:!0}}case"date-time":{let t=new Date(i);return isNaN(t.getTime())?{isValid:!1,message:d(13018,null)}:{isValid:!0}}default:return{isValid:!0}}}_validateNumber(i,e){let t=Number(i);return isNaN(t)?{isValid:!1,message:d(13025,null)}:e.type==="integer"&&!Number.isInteger(t)?{isValid:!1,message:d(13020,null)}:e.minimum!==void 0&&t<e.minimum?{isValid:!1,message:d(13023,null,e.minimum)}:e.maximum!==void 0&&t>e.maximum?{isValid:!1,message:d(13021,null,e.maximum)}:{isValid:!0,parsedValue:t}}_convertSchemaToQuestions(i){let e=Object.entries(i.requestedSchema.properties),t=new Set(i.requestedSchema.required||[]),o=[],n=new Map;for(let[r,s]of e){let l=ht();n.set(l,r);let c=s.title||r,u=s.description,p=t.has(r);if(s.type==="boolean")o.push({id:l,type:"singleSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:[{id:"true",label:d(13010,null),value:"true"},{id:"false",label:d(13006,null),value:"false"}],defaultValue:s.default!==void 0?String(s.default):void 0});else if(LPo(s))o.push({id:l,type:"singleSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.enum.map((h,g)=>({id:h,label:s.enumNames[g]?`${h} - ${s.enumNames[g]}`:h,value:h})),defaultValue:s.default});else if(PPo(s))o.push({id:l,type:"singleSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.oneOf.map(({const:h,title:g})=>({id:h,label:g?`${h} - ${g}`:h,value:h})),defaultValue:s.default});else if(MPo(s))o.push({id:l,type:"singleSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.enum.map(h=>({id:h,label:h,value:h})),defaultValue:s.default});else if(NPo(s))o.push({id:l,type:"multiSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.items.anyOf.map(({const:h,title:g})=>({id:h,label:g?`${h} - ${g}`:h,value:h})),defaultValue:s.default});else if(APo(s))o.push({id:l,type:"multiSelect",title:c,description:u,required:p,allowFreeformInput:!1,options:s.items.enum.map(h=>({id:h,label:h,value:h})),defaultValue:s.default});else{let h={};s.type==="string"?(s.minLength!==void 0&&(h.minLength=s.minLength),s.maxLength!==void 0&&(h.maxLength=s.maxLength),s.format&&(h.format=s.format)):(s.type==="number"||s.type==="integer")&&(s.minimum!==void 0&&(h.minimum=s.minimum),s.maximum!==void 0&&(h.maximum=s.maximum),s.type==="integer"&&(h.isInteger=!0)),o.push({id:l,type:"text",title:c,description:u,required:p,defaultValue:s.default!==void 0?String(s.default):void 0,validation:Object.keys(h).length>0?h:void 0})}}return{questions:o,idToPropertyMap:n}}_convertCarouselAnswersToElicitResult(i,e,t){let o={};for(let[n,r]of Object.entries(i)){let s=e.get(n);if(!s)continue;let l=t[s];if(!l)continue;let c=r;if(typeof r=="object"&&r!==null){let u=r;"selectedValue"in u?c=u.selectedValue:"selectedValues"in u?c=u.selectedValues:"freeformValue"in u&&u.freeformValue&&(c=u.freeformValue)}if(c!=null)if(l.type==="boolean")o[s]=c==="true"||c===!0;else if(l.type==="number"||l.type==="integer"){let u=Number(c);isNaN(u)||(o[s]=u)}else l.type==="array"?Array.isArray(c)&&(o[s]=c.map(u=>String(u))):o[s]=String(c)}return o}};y1e=I([m(0,Ne),m(1,$e),m(2,si),m(3,Je)],y1e);var zBi="vscode.mcp",w1e=class extends k{constructor(e,t,o,n,r,s){super();this._mcpRegistry=t;this._mcpWorkbenchService=o;this._mcpService=n;this._markerService=r;this._configurationResolverService=s;this._cachedMcpSection=this._register(new ue);let l=[{pattern:"**/mcp.json"},{pattern:"**/.mcp.json"},{pattern:"**/workspace.json"}],c=this._register(new T),u={onDidChange:c.event,provideCodeLenses:(p,h)=>this._provideCodeLenses(p,()=>c.fire(u))};this._register(e.codeLensProvider.register(l,u)),this._register(e.inlayHintsProvider.register(l,{onDidChangeInlayHints:t.onDidChangeInputs,provideInlayHints:(p,h)=>this._provideInlayHints(p,h)}))}async _parseModel(e){if(this._cachedMcpSection.value?.model===e)return this._cachedMcpSection.value;let t=e.uri,o=t.path.endsWith("/.mcp.json")?{scope:1,target:6,serversKey:"mcpServers"}:await this._mcpWorkbenchService.getMcpConfigPath(e.uri);if(!o)return;let n=e.getValue(),r=xM(n),s=[e.onDidChangeContent(()=>this._cachedMcpSection.clear()),e.onWillDispose(()=>this._cachedMcpSection.clear())];return this._addDiagnostics(e,n,r,o),this._cachedMcpSection.value={model:e,tree:r,inConfig:o,dispose:()=>{this._markerService.remove(zBi,[t]),je(s)}}}_addDiagnostics(e,t,o,n){let r=n.serversKey??"servers",s=Tx(o,n.section?[...n.section,r]:[r]);if(!s)return;let l=u=>{let p="",h=1/0;for(let g of this._configurationResolverService.resolvableVariables){let f=z6i(u,g);f<h&&(h=f,p=g)}return p},c=[];oQt(s,u=>{let p=eI.parse(u.value);for(let{id:h,name:g,arg:f}of p.unresolved())if(!this._configurationResolverService.resolvableVariables.has(g)){let v=t.indexOf(h,u.offset);if(v===-1)continue;let b=e.getPositionAt(v),S=e.getPositionAt(v+h.length);c.push({severity:4,message:d(13041,null,g,l(g)+(f?`:${f}`:"")),startLineNumber:b.lineNumber,startColumn:b.column,endLineNumber:S.lineNumber,endColumn:S.column,modelVersionId:e.getVersionId()})}}),c.length?this._markerService.changeOne(zBi,e.uri,c):this._markerService.remove(zBi,[e.uri])}async _provideCodeLenses(e,t){let o=await this._parseModel(e);if(!o)return;let{tree:n,inConfig:r}=o,s=r.serversKey??"servers",l=Tx(n,r.section?[...r.section,s]:[s]);if(!l)return;let c=new O,u=[],p={lenses:u,dispose:()=>c.dispose()},h=v=>(c.add(U.fromObservableLight(v)(t)),v.get()),g=h(this._mcpRegistry.collections).find(v=>ze(v.presentation?.origin,e.uri));if(!g)return p;let f=h(this._mcpService.servers).filter(v=>v.collection.id===g.id);for(let v of l.children||[]){if(v.type!=="property"||v.children?.[0]?.type!=="string")continue;let b=v.children[0].value,S=f.find(E=>E.definition.label===b);if(!S)continue;let y=G.fromPositions(e.getPositionAt(v.children[0].offset));if(sR(h(S.enablement))){u.push({range:y,command:{id:"workbench.mcp.serverOptions",title:"$(circle-slash) "+d(13042,null),arguments:[S.definition.id]}});continue}let w=!!S.readDefinitions().get().server?.devMode?.debug,x=h(S.connectionState).state;switch(x){case Sr.Kind.Error:u.push({range:y,command:{id:"workbench.mcp.showOutput",title:"$(error) "+d(13043,null),arguments:[S.definition.id]}},{range:y,command:{id:"workbench.mcp.restartServer",title:d(13037,null),arguments:[S.definition.id,{autoTrustChanges:!0}]}}),w&&u.push({range:y,command:{id:"workbench.mcp.restartServer",title:d(13036,null),arguments:[S.definition.id,{debug:!0,autoTrustChanges:!0}]}});break;case Sr.Kind.Starting:u.push({range:y,command:{id:"workbench.mcp.showOutput",title:"$(loading~spin) "+d(13046,null),arguments:[S.definition.id]}},{range:y,command:{id:"workbench.mcp.stopServer",title:d(13029,null),arguments:[S.definition.id]}});break;case Sr.Kind.Running:u.push({range:y,command:{id:"workbench.mcp.showOutput",title:"$(check) "+d(13045,null),arguments:[S.definition.id]}},{range:y,command:{id:"workbench.mcp.stopServer",title:d(13040,null),arguments:[S.definition.id]}},{range:y,command:{id:"workbench.mcp.restartServer",title:d(13037,null),arguments:[S.definition.id,{autoTrustChanges:!0}]}}),w&&u.push({range:y,command:{id:"workbench.mcp.restartServer",title:d(13036,null),arguments:[S.definition.id,{autoTrustChanges:!0,debug:!0}]}});break;case Sr.Kind.Stopped:u.push({range:y,command:{id:"workbench.mcp.startServer",title:"$(debug-start) "+d(13039,null),arguments:[S.definition.id,{autoTrustChanges:!0}]}}),w&&u.push({range:y,command:{id:"workbench.mcp.startServer",title:d(13036,null),arguments:[S.definition.id,{autoTrustChanges:!0,debug:!0}]}})}if(x!==Sr.Kind.Error){let E=h(S.tools).length;E&&u.push({range:y,command:{id:"",title:d(13047,null,E)}});let M=h(S.prompts).length;M&&u.push({range:y,command:{id:"workbench.mcp.startPromptForServer",title:d(13044,null,M),arguments:[S]}}),u.push({range:y,command:{id:"workbench.mcp.serverOptions",title:d(13038,null),arguments:[S.definition.id]}})}}return p}async _provideInlayHints(e,t){let o=await this._parseModel(e);if(!o)return;let{tree:n,inConfig:r}=o,s=r.section?Tx(n,[...r.section]):n;if(!s)return;let l=Tx(s,["inputs"]);if(!l)return;let c=await this._mcpRegistry.getSavedInputs(r.scope),u=[],p=Tx(s,[r.serversKey??"servers"]);return p&&h(p),g(l),{hints:u,dispose:()=>{}};function h(v){oQt(v,b=>{let S=eI.parse(b.value);for(let{id:y}of S.unresolved()){let w=c[y];w&&f(y,b.offset+b.value.indexOf(y)+y.length,w)}})}function g(v){if(!(v.type!=="array"||!v.children))for(let b of v.children){if(b.type!=="object"||!b.children)continue;let S=b.children.find(E=>E.type==="property"&&E.children?.[0].value==="id");if(!S)continue;let y=S.children[1];if(!y||y.type!=="string"||!y.value)continue;let w="${input:"+y.value+"}",x=c[w];x&&f(w,y.offset+1+y.length,x)}}function f(v,b,S){let y=new he([Xw({id:"workbench.mcp.editStoredInput",text:d(13034,null),arguments:[v,e.uri,jW,r.target],tooltip:d(13035,null)}),Xw({id:"workbench.mcp.removeStoredInput",text:d(13030,null),arguments:[r.scope,v],tooltip:d(13031,null)}),Xw({id:"workbench.mcp.removeStoredInput",text:d(13032,null),arguments:[r.scope],tooltip:d(13033,null)})].join(" | "),{isTrusted:!0}),w={label:"= "+(S.input?.type==="promptString"&&S.input.password?"*".repeat(10):S.value||""),position:e.getPositionAt(b),tooltip:y,paddingLeft:!0};return u.push(w),w}}};w1e=I([m(0,Jt),m(1,xc),m(2,bf),m(3,Vs),m(4,ha),m(5,Xp)],w1e);function oQt(a,i){a.type==="string"&&typeof a.value=="string"&&a.value.includes(eI.VARIABLE_LHS)?i(a):a.type==="property"?a.children?.slice(1).forEach(e=>oQt(e,i)):a.children?.forEach(e=>oQt(e,i))}var oSe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.mcpManagementService=e;this.userDataProfileService=t;this.fileService=o;this.remoteAgentService=n;this.jsonEditingService=r;this.logService=s;this.notificationService=l;this.commandService=c;this.migrateMcpConfig()}static{this.ID="workbench.mcp.config.migration"}async migrateMcpConfig(){try{let t=await this.parseMcpConfig(this.userDataProfileService.currentProfile.settingsResource);t&&t.servers&&Object.keys(t.servers).length>0&&(await Promise.all(Object.entries(t.servers).map(([o,n],r)=>this.mcpManagementService.install({name:o,config:n,inputs:r===0?t.inputs:void 0}))),await this.removeMcpConfig(this.userDataProfileService.currentProfile.settingsResource))}catch(t){this.logService.error("MCP migration: Failed to migrate user MCP config",t)}this.watchForMcpConfiguration(this.userDataProfileService.currentProfile.settingsResource,!1);let e=await this.remoteAgentService.getEnvironment();if(e){try{let t=await this.parseMcpConfig(e.settingsPath);t&&t.servers&&Object.keys(t.servers).length>0&&(await Promise.all(Object.entries(t.servers).map(([o,n],r)=>this.mcpManagementService.install({name:o,config:n,inputs:r===0?t.inputs:void 0},{target:4}))),await this.removeMcpConfig(e.settingsPath))}catch(t){this.logService.error("MCP migration: Failed to migrate remote MCP config",t)}this.watchForMcpConfiguration(e.settingsPath,!0)}}watchForMcpConfiguration(e,t){this._register(this.fileService.watch(e)),this._register(this.fileService.onDidFilesChange(o=>{o.contains(e)&&this.checkForMcpConfigInFile(e,t)}))}async checkForMcpConfigInFile(e,t){try{let o=await this.parseMcpConfig(e);o&&o.servers&&Object.keys(o.servers).length>0&&this.showMcpConfigErrorNotification(t)}catch{}}showMcpConfigErrorNotification(e){let t=e?d(13050,null):d(13052,null),o=e?d(13048,null):d(13049,null),n=e?"workbench.mcp.openRemoteUserMcpJson":"workbench.mcp.openUserMcpJson";this.notificationService.prompt(ft.Error,t,[{label:d(13051,null),run:async()=>{await this.migrateMcpConfig(),await this.commandService.executeCommand(n)}},{label:o,keepOpen:!0,run:()=>this.commandService.executeCommand(n)}])}async parseMcpConfig(e){try{let t=await this.fileService.readFile(e),o=A_(t.value.toString());if(!Di(o))return;let n=o[jW];if(n&&n.servers)for(let[,r]of Object.entries(n.servers))r.type===void 0&&(r.type=r.command?"stdio":"http");return n}catch(t){rp(t)!==1&&this.logService.warn(`MCP migration: Failed to parse MCP config from ${e}:`,t);return}}async removeMcpConfig(e){try{await this.jsonEditingService.write(e,[{path:[jW],value:void 0}],!0)}catch(t){this.logService.warn(`MCP migration: Failed to remove MCP config from ${e}:`,t)}}};oSe=I([m(0,V6),m(1,gn),m(2,ge),m(3,bo),m(4,Zg),m(5,re),m(6,Ne),m(7,fe)],oSe);var C1e=Oe("mcp-server",L.mcp,d(13146,null)),KBi=Oe("mcp-server-remote",L.remote,d(13147,null)),GBi=Oe("mcp-server-workspace",L.rootFolder,d(13148,null)),nQt=Oe("mcp-server-starred",L.starFull,d(13149,null)),OPo=Oe("mcp-server-license",L.law,d(13145,null));var P1=class extends k{constructor(){super(...arguments);this._mcpServer=null}get mcpServer(){return this._mcpServer}set mcpServer(e){this._mcpServer=e,this.update()}update(){this.render()}};function tdt(a,i){let e=new O;return e.add($(a,ne.CLICK,Nwe(i))),e.add($(a,ne.KEY_UP,t=>{let o=new mi(t);(o.equals(10)||o.equals(3))&&(t.preventDefault(),t.stopPropagation(),i())})),e}var Vre=class extends P1{constructor(e,t){super();this.themeService=t;this.iconLoadingDisposable=this._register(new ue);this.element=D(e,_(".extension-icon")),this.iconElement=D(this.element,_("img.icon",{alt:""})),this.iconElement.style.display="none",this.codiconIconElement=D(this.element,_(q.asCSSSelector(C1e))),this.codiconIconElement.style.display="none",this.render(),this._register(ee(()=>this.clear())),this._register(this.themeService.onDidColorThemeChange(()=>this.render()))}clear(){this.iconUrl=void 0,this.iconElement.src="",this.iconElement.style.display="none",this.codiconIconElement.style.display="none",this.codiconIconElement.className=q.asClassName(C1e),this.iconLoadingDisposable.clear()}render(){if(!this.mcpServer){this.clear();return}if(this.mcpServer.icon){let e=this.themeService.getColorTheme().type,t=cm(e)?this.mcpServer.icon.dark:this.mcpServer.icon.light;this.iconUrl!==t&&(this.iconElement.style.display="inherit",this.codiconIconElement.style.display="none",this.iconUrl=t,this.iconLoadingDisposable.value=$(this.iconElement,"error",()=>{this.iconElement.style.display="none",this.codiconIconElement.style.display="inherit"},{once:!0}),this.iconElement.src=this.iconUrl,this.iconElement.complete?this.iconElement.style.visibility="inherit":(this.iconElement.style.visibility="hidden",this.iconElement.onload=()=>this.iconElement.style.visibility="inherit"))}else this.iconUrl=void 0,this.iconElement.style.display="none",this.iconElement.src="",this.codiconIconElement.className=this.mcpServer.codicon?`codicon ${this.mcpServer.codicon}`:q.asClassName(C1e),this.codiconIconElement.style.display="inherit",this.iconLoadingDisposable.clear()}};Vre=I([m(1,Pe)],Vre);var Bre=class extends P1{constructor(e,t,o,n){super();this.container=e;this.small=t;this.hoverService=o;this.openerService=n;this.disposables=this._register(new O);this.render(),this._register(ee(()=>this.clear()))}clear(){this.element?.remove(),this.disposables.clear()}render(){if(this.clear(),!this.mcpServer?.publisherDisplayName)return;this.element=D(this.container,_(".publisher"));let e=_(".publisher-name.ellipsis");e.textContent=this.mcpServer.publisherDisplayName;let t=_(".verified-publisher");if(D(t,_("span.extension-verified-publisher.clickable"),un(dV)),this.small)this.mcpServer.gallery?.publisherDomain?.verified&&D(this.element,t),D(this.element,e);else{if(this.element.classList.toggle("clickable",!!this.mcpServer.gallery?.publisherUrl),this.element.setAttribute("role","button"),this.element.tabIndex=0,this.containerHover=this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),this.element,d(13163,null,this.mcpServer.publisherDisplayName))),D(this.element,e),this.mcpServer.gallery?.publisherDomain?.verified){D(this.element,t);let o=A.parse(this.mcpServer.gallery?.publisherDomain.link);t.tabIndex=0,t.setAttribute("role","button"),this.containerHover.update(d(13165,null,this.mcpServer.gallery?.publisherDomain.link)),t.setAttribute("role","link"),D(t,_("span.extension-verified-publisher-domain",void 0,o.authority.startsWith("www.")?o.authority.substring(4):o.authority)),this.disposables.add(tdt(t,()=>this.openerService.open(o)))}this.mcpServer.gallery?.publisherUrl&&this.disposables.add(tdt(this.element,()=>this.openerService.open(this.mcpServer?.gallery?.publisherUrl)))}}};Bre=I([m(2,ot),m(3,Je)],Bre);var nSe=class a extends P1{constructor(e,t){super();this.container=e;this.small=t;this.disposables=this._register(new O);this.container.classList.add("extension-ratings"),this.small&&e.classList.add("small"),this.render(),this._register(ee(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.mcpServer?.starsCount||this.small&&this.mcpServer.installState!==3)return;let e=this.small?this.container:D(this.container,_("span.rating",{tabIndex:0}));D(e,_("span"+q.asCSSSelector(nQt)));let t=D(e,_("span.count",void 0,a.getCountLabel(this.mcpServer.starsCount)));this.small||(t.style.paddingLeft="3px")}static getCountLabel(e){return e>1e6?`${Math.floor(e/1e5)/10}M`:e>1e3?`${Math.floor(e/1e3)}K`:String(e)}},rQt=class extends P1{constructor(e){super();this.container=e;this.disposables=this._register(new O);this.container.classList.add("license"),this.render(),this._register(ee(()=>this.clear()))}clear(){this.container.innerText="",this.disposables.clear()}render(){if(this.clear(),!this.mcpServer?.license)return;let e=D(this.container,_("span.license",{tabIndex:0}));D(e,_("span"+q.asCSSSelector(OPo)));let t=D(e,_("span",void 0,this.mcpServer.license));t.style.paddingLeft="3px"}},x1e=class extends P1{constructor(e,t,o,n){super();this.options=e;this.mcpServerStatusAction=t;this.hoverService=o;this.configurationService=n;this.hover=this._register(new ue)}render(){this.hover.value=void 0,this.mcpServer&&(this.hover.value=this.hoverService.setupManagedHover({delay:this.configurationService.getValue("workbench.hover.delay"),showHover:(e,t)=>this.hoverService.showInstantHover({...e,additionalClasses:["extension-hover"],position:{hoverPosition:this.options.position(),forcePosition:!0},persistence:{hideOnKeyDown:!0}},t),placement:"element"},this.options.target,{markdown:()=>Promise.resolve(this.getHoverMarkdown()),markdownNotSupportedFallback:void 0},{appearance:{showHoverHint:!0}}))}getHoverMarkdown(){if(!this.mcpServer)return;let e=new he("",{isTrusted:!0,supportThemeIcons:!0});e.appendMarkdown(`**${this.mcpServer.label}**`),e.appendText(`
`);let t=!1;if(this.mcpServer.local?.scope==="workspace"&&(e.appendMarkdown(`$(${GBi.id})&nbsp;`),e.appendMarkdown(d(13166,null)),t=!0),this.mcpServer.local?.scope==="remoteUser"&&(e.appendMarkdown(`$(${KBi.id})&nbsp;`),e.appendMarkdown(d(13164,null)),t=!0),this.mcpServer.installState===1&&this.mcpServer.starsCount){t&&e.appendText("  |  ");let n=nSe.getCountLabel(this.mcpServer.starsCount);e.appendMarkdown(`$(${nQt.id}) ${n}`),t=!0}t&&e.appendText(`
`),this.mcpServer.description&&e.appendMarkdown(`${this.mcpServer.description}`);let o=this.mcpServerStatusAction.status;if(o.length){e.appendMarkdown("---"),e.appendText(`
`);for(let n of o)n.icon&&e.appendMarkdown(`$(${n.icon.id})&nbsp;`),e.appendMarkdown(n.message.value),e.appendText(`
`)}return e}};x1e=I([m(2,ot),m(3,B)],x1e);var Hre=class extends P1{constructor(e,t){super();this.container=e;this.instantiationService=t;this.badge=this._register(new ue);this.element=D(this.container,_("")),this.render(),this._register(ee(()=>this.clear()))}clear(){this.badge.value?.element.remove(),this.badge.clear()}render(){this.clear();let e=this.mcpServer?.local?.scope;if(!e||e==="user")return;let t;switch(e){case"workspace":{t=GBi;break}case"remoteUser":{t=KBi;break}}this.badge.value=this.instantiationService.createInstance(Yfe,t,void 0),D(this.element,this.badge.value.element)}};Hre=I([m(1,F)],Hre);var k1e=class extends P1{constructor(e,t,o){super();this.container=e;this.extensionStatusAction=t;this.markdownRendererService=o;this.renderDisposables=this._register(new ue);this._onDidRender=this._register(new T);this.onDidRender=this._onDidRender.event;this.render(),this._register(t.onDidChangeStatus(()=>this.render()))}render(){Ii(this.container),this.renderDisposables.value=void 0;let e=new O;this.renderDisposables.value=e;let t=this.extensionStatusAction.status;if(t.length){let o=new he("",{isTrusted:!0,supportThemeIcons:!0});for(let r=0;r<t.length;r++){let s=t[r];s.icon&&o.appendMarkdown(`$(${s.icon.id})&nbsp;`),o.appendMarkdown(s.message.value),r<t.length-1&&o.appendText(`
`)}let n=e.add(this.markdownRendererService.render(o));D(this.container,n.element)}this._onDidRender.fire()}};k1e=I([m(2,_n)],k1e);var Dwn=te("mcpIcon.starForeground",{light:"#DF6100",dark:"#FF8E00",hcDark:"#FF8E00",hcLight:AS},d(13162,null),!1);hs((a,i)=>{let e=a.getColor(Dwn);e&&(i.addRule(`.extension-ratings .codicon-mcp-server-starred { color: ${e}; }`),i.addRule(`.monaco-hover.extension-hover .markdown-hover .hover-contents ${q.asCSSSelector(nQt)} { color: ${e}; }`))});var qBi=class extends k{constructor(e){super();this._onChange=this._register(new T);this._currentId=null;let t=D(e,_(".navbar"));this.actions=[],this.actionbar=this._register(new oo(t))}get onChange(){return this._onChange.event}get currentId(){return this._currentId}push(e,t,o,n){let r=new it(e,t,void 0,!0,()=>this.update(e,!0));r.tooltip=o,typeof n=="number"?this.actions.splice(n,0,r):this.actions.push(r),this.actionbar.push(r,{index:n}),this.actions.length===1&&this.update(e)}remove(e){let t=this.actions.findIndex(o=>o.id===e);t!==-1&&(this.actions.splice(t,1),this.actionbar.pull(t),this._currentId===e&&this.switch(this.actions[0]?.id))}clear(){this.actions=je(this.actions),this.actionbar.clear()}switch(e){let t=this.actions.find(o=>o.id===e);return t?(t.run(),!0):!1}has(e){return this.actions.some(t=>t.id===e)}update(e,t){this._currentId=e,this._onChange.fire({id:e,focus:!!t}),this.actions.forEach(o=>o.checked=o.id===e)}};var F9=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(F9.ID,e,t,n,l);this.instantiationService=o;this.notificationService=r;this.openerService=s;this.extensionService=c;this.webviewService=u;this.languageService=p;this.contextKeyService=h;this.mcpWorkbenchService=g;this.hoverService=f;this.contextMenuService=v;this._scopedContextKeyService=this._register(new ue);this.initialScrollProgress=new Map;this.currentIdentifier="";this.layoutParticipants=[];this.contentDisposables=this._register(new O);this.transientDisposables=this._register(new O);this.activeElement=null;this.mcpServerReadme=null,this.mcpServerManifest=null}static{this.ID="workbench.editor.mcpServer"}get scopedContextKeyService(){return this._scopedContextKeyService.value}createEditor(e){let t=D(e,_(".extension-editor.mcp-server-editor"));this._scopedContextKeyService.value=this.contextKeyService.createScoped(t),this._scopedContextKeyService.value.createKey("inExtensionEditor",!0),t.tabIndex=0,t.style.outline="none",t.setAttribute("role","document");let o=D(t,_(".header")),n=D(o,_(".icon-container")),r=this.instantiationService.createInstance(Vre,n),s=this.instantiationService.createInstance(Hre,n),l=D(o,_(".details")),c=D(l,_(".title")),u=D(c,_("span.name.clickable",{role:"heading",tabIndex:0}));this._register(this.hoverService.setupManagedHover(yi("mouse"),u,d(13123,null)));let p=D(l,_(".subtitle")),h=[],g=D(p,_(".subtitle-entry"));h.push(g);let f=this.instantiationService.createInstance(Bre,g,!1),v=D(p,_(".subtitle-entry"));h.push(v);let b=this.instantiationService.createInstance(nSe,v,!1),S=D(p,_(".subtitle-entry"));h.push(S);let y=this.instantiationService.createInstance(rQt,S),w=[r,f,b,s,y],x=D(l,_(".description")),E=[this.instantiationService.createInstance(H_,!1),this.instantiationService.createInstance(wHe),this.instantiationService.createInstance(Sbe,"extensions.uninstall",LV.CLASS,[[this.instantiationService.createInstance(LV),this.instantiationService.createInstance(_$,!1),this.instantiationService.createInstance(D$,!1)]]),this.instantiationService.createInstance(IHe),this.instantiationService.createInstance(yHe),this.instantiationService.createInstance(GP,!0)],M=D(l,_(".actions-status-container.mcp-server-actions")),N=this._register(new oo(M,{actionViewItemProvider:(Se,Re)=>{if(Se instanceof n9)return Se.createActionViewItem(Re);if(Se instanceof Sbe)return new F4t(Se,{...Re,icon:!0,label:!0,menuActionsOrProvider:{getActions:()=>Se.menuActions},menuActionClassNames:Se.menuActionClassNames},this.contextMenuService)},focusOnlyEnabledItems:!0}));N.push(E,{icon:!0,label:!0}),N.setFocusable(!0),this._register(U.any(...E.map(Se=>U.filter(Se.onDidChange,Re=>Re.enabled!==void 0)))(()=>{N.setFocusable(!1),N.setFocusable(!0)}));let V=[],H=this.instantiationService.createInstance(tL),K=this._register(this.instantiationService.createInstance(k1e,D(M,_(".status")),H));this._register(U.any(K.onDidRender)(()=>{this.dimension&&this.layout(this.dimension)})),V.push(H,new class extends P1{render(){M.classList.toggle("list-layout",this.mcpServer?.installState===1)}});let j=this.instantiationService.createInstance(yee,[...E,...w,...V]);for(let Se of[...E,...w,...V,j])this._register(Se);let J=U.chain(N.onDidRun,Se=>Se.map(({error:Re})=>Re).filter(Re=>!!Re));this._register(J(this.onError,this));let se=D(t,_(".body")),ae=new qBi(se),ce=D(se,_(".content"));ce.id=ht(),this.template={content:ce,description:x,header:o,name:u,navbar:ae,actionsAndStatusContainer:M,actionBar:N,set mcpServer(Se){j.mcpServer=Se;let Re;for(let xe of h)xe.classList.remove("last-non-empty"),xe.children.length>0&&(Re=xe);Re&&Re.classList.add("last-non-empty")}}}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.template&&await this.render(e.mcpServer,this.template,!!t?.preserveFocus)}async render(e,t,o){this.activeElement=null,this.transientDisposables.clear();let n=this.transientDisposables.add(new qe).token;this.mcpServerReadme=new pB(()=>e.getReadme(n)),this.mcpServerManifest=new pB(()=>e.getManifest(n)),t.mcpServer=e,t.name.textContent=e.label,t.name.classList.toggle("clickable",!!e.gallery?.webUrl),t.description.textContent=e.description,e.gallery?.webUrl&&this.transientDisposables.add(tdt(t.name,()=>this.openerService.open(A.parse(e.gallery?.webUrl)))),this.renderNavbar(e,t,o)}setOptions(e){super.setOptions(e),e?.tab&&this.template?.navbar.switch(e.tab)}renderNavbar(e,t,o){t.content.innerText="",t.navbar.clear(),this.currentIdentifier!==e.id&&(this.initialScrollProgress.clear(),this.currentIdentifier=e.id),(e.readmeUrl||e.gallery?.readme)&&t.navbar.push("readme",d(13111,null),d(13112,null)),(e.gallery||e.local?.manifest)&&t.navbar.push("manifest",d(13120,null),d(13121,null)),e.config&&t.navbar.push("configuration",d(13109,null),d(13110,null)),this.transientDisposables.add(this.mcpWorkbenchService.onChange(n=>{n===e&&(n.config&&!t.navbar.has("configuration")&&t.navbar.push("configuration",d(13109,null),d(13110,null),e.readmeUrl?1:0),!n.config&&t.navbar.has("configuration")&&t.navbar.remove("configuration"))})),this.options?.tab&&t.navbar.switch(this.options.tab),t.navbar.currentId&&this.onNavbarChange(e,{id:t.navbar.currentId,focus:!o},t),t.navbar.onChange(n=>this.onNavbarChange(e,n,t),this,this.transientDisposables)}clearInput(){this.contentDisposables.clear(),this.transientDisposables.clear(),super.clearInput()}focus(){super.focus(),this.activeElement?.focus()}showFind(){this.activeWebview?.showFind()}runFindAction(e){this.activeWebview?.runFindAction(e)}get activeWebview(){if(!(!this.activeElement||!this.activeElement.runFindAction))return this.activeElement}onNavbarChange(e,{id:t,focus:o},n){if(this.contentDisposables.clear(),n.content.innerText="",this.activeElement=null,t){let r=new qe;this.contentDisposables.add(ee(()=>r.dispose(!0))),this.open(t,e,n,r.token).then(s=>{r.token.isCancellationRequested||(this.activeElement=s,o&&this.focus())})}}open(e,t,o,n){switch(e){case"configuration":return this.openConfiguration(t,o,n);case"readme":return this.openDetails(t,o,n);case"manifest":return t.readmeUrl?this.openManifest(t,o.content,n):this.openManifestWithAdditionalDetails(t,o,n)}return Promise.resolve(null)}async openMarkdown(e,t,o,n,r,s,l){try{let c=await this.renderMarkdown(e,t,n,l);if(l.isCancellationRequested)return Promise.resolve(null);let u=this.contentDisposables.add(this.webviewService.createWebviewOverlay({title:s,options:{enableFindWidget:!0,tryRestoreScrollPosition:!0,disableServiceWorker:!0},contentOptions:{},extension:void 0}));u.initialScrollProgress=this.initialScrollProgress.get(r)||0,u.claim(this,this.window,this.scopedContextKeyService),AL(u.container,n),u.setAnchorElement(n),u.setHtml(c),u.claim(this,this.window,void 0),this.contentDisposables.add(u.onDidFocus(()=>this._onDidFocus?.fire())),this.contentDisposables.add(u.onDidScroll(()=>this.initialScrollProgress.set(r,u.initialScrollProgress)));let p=vg(this.layoutParticipants,{layout:()=>{u.setAnchorElement(n)}});this.contentDisposables.add(ee(p));let h=!1;return this.contentDisposables.add(ee(()=>{h=!0})),this.contentDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let g=await this.renderMarkdown(e,t,n);h||u.setHtml(g)})),this.contentDisposables.add(u.onDidClickLink(g=>{g&&(hc(g,Q.http)||hc(g,Q.https)||hc(g,Q.mailto))&&this.openerService.open(g)})),u}catch{let u=D(n,_("p.nocontent"));return u.textContent=o,u}}async renderMarkdown(e,t,o,n){let r=await this.loadContents(()=>t,o);if(n?.isCancellationRequested)return"";let s=await P$(r,this.extensionService,this.languageService,{},n);return n?.isCancellationRequested?"":this.renderBody(s)}renderBody(e){let t=ht(),o=vc.getColorMap(),n=o?ED(o):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; script-src 'none'; style-src 'nonce-${t}';">
				<style nonce="${t}">
					${D1}

					/* prevent scroll-to-top button from blocking the body text */
					body {
						padding-bottom: 75px;
					}

					#scroll-to-top {
						position: fixed;
						width: 32px;
						height: 32px;
						right: 25px;
						bottom: 25px;
						background-color: var(--vscode-button-secondaryBackground);
						border-color: var(--vscode-button-border);
						border-radius: 50%;
						cursor: pointer;
						box-shadow: 1px 1px 1px rgba(0,0,0,.25);
						outline: none;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					#scroll-to-top:hover {
						background-color: var(--vscode-button-secondaryHoverBackground);
						box-shadow: 2px 2px 2px rgba(0,0,0,.25);
					}

					body.vscode-high-contrast #scroll-to-top {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}

					#scroll-to-top span.icon::before {
						content: "";
						display: block;
						background: var(--vscode-button-secondaryForeground);
						/* Chevron up icon */
						webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						width: 16px;
						height: 16px;
					}
					${n}
				</style>
			</head>
			<body>
				<a id="scroll-to-top" role="button" aria-label="scroll to top" href="#"><span class="icon"></span></a>
				${e}
			</body>
		</html>`}async openDetails(e,t,o){let n=D(t.content,_(".details")),r=D(n,_(".content-container")),s=D(n,_(".additional-details-container")),l=()=>n.classList.toggle("narrow",this.dimension&&this.dimension.width<500);l(),this.contentDisposables.add(ee(vg(this.layoutParticipants,{layout:l})));let c=await this.openMarkdown(e,this.mcpServerReadme.get(),d(13126,null),r,0,d(13131,null),o);return this.renderAdditionalDetails(s,e),c}async openConfiguration(e,t,o){let n=D(t.content,_(".configuration")),r=_("div",{class:"configuration-content"});this.renderConfigurationDetails(r,e);let s=new Ar(r,{}),l=()=>s.scanDomNode();return this.contentDisposables.add(ee(vg(this.layoutParticipants,{layout:l}))),D(n,s.getDomNode()),{focus:()=>r.focus()}}async openManifestWithAdditionalDetails(e,t,o){let n=D(t.content,_(".details")),r=D(n,_(".content-container")),s=D(n,_(".additional-details-container")),l=()=>n.classList.toggle("narrow",this.dimension&&this.dimension.width<500);l(),this.contentDisposables.add(ee(vg(this.layoutParticipants,{layout:l})));let c=await this.openManifest(e,r,o);return this.renderAdditionalDetails(s,e),c}async openManifest(e,t,o){let n=D(t,_(".manifest")),r=_("div",{class:"manifest-content"});try{let c=await this.loadContents(()=>this.mcpServerManifest.get(),r);if(o.isCancellationRequested)return null;this.renderManifestDetails(r,c)}catch{for(;r.firstChild;)r.removeChild(r.firstChild);let u=D(r,_(".no-manifest"));u.textContent=d(13125,null)}let s=new Ar(r,{}),l=()=>s.scanDomNode();return this.contentDisposables.add(ee(vg(this.layoutParticipants,{layout:l}))),D(n,s.getDomNode()),{focus:()=>r.focus()}}renderConfigurationDetails(e,t){St(e);let o=t.config;if(!o){let p=D(e,_(".no-config"));p.textContent=d(13124,null);return}let n=D(e,_(".config-section")),r=D(n,_(".config-label"));r.textContent=d(13136,null);let s=D(n,_(".config-value"));s.textContent=t.name;let l=D(e,_(".config-section")),c=D(l,_(".config-label"));c.textContent=d(13137,null);let u=D(l,_(".config-value"));if(u.textContent=o.type,o.type==="stdio"){let p=D(e,_(".config-section")),h=D(p,_(".config-label"));h.textContent=d(13108,null);let g=D(p,_("code.config-value"));if(g.textContent=o.command,o.args&&o.args.length>0){let f=D(e,_(".config-section")),v=D(f,_(".config-label"));v.textContent=d(13107,null);let b=D(f,_("code.config-value"));b.textContent=o.args.join(" ")}if(o.env&&Object.keys(o.env).length>0){let f=D(e,_(".config-section")),v=D(f,_(".config-label"));v.textContent=d(13114,null);let b=D(f,_(".config-value"));for(let[S,y]of Object.entries(o.env))D(b,_("code.env-entry",void 0,`${S}=${y??""}`))}if(o.envFile){let f=D(e,_(".config-section")),v=D(f,_(".config-label"));v.textContent=d(13113,null);let b=D(f,_("code.config-value"));b.textContent=o.envFile}}else if(o.type==="http"){let p=D(e,_(".config-section")),h=D(p,_(".config-label"));h.textContent=d(13141,null);let g=D(p,_("code.config-value"));if(g.textContent=o.url,o.headers&&Object.keys(o.headers).length>0){let f=D(e,_(".config-section")),v=D(f,_(".config-label"));v.textContent=d(13116,null);let b=D(f,_(".config-value"));for(let[S,y]of Object.entries(o.headers))D(b,_("code.env-entry",void 0,`${S}: ${y??""}`))}}}renderManifestDetails(e,t){if(St(e),t.packages&&t.packages.length>0){let o=new Map;for(let n of t.packages){let r=n.registryType,s=o.get(r);s||o.set(r,s=[]),s.push(n)}D(e,_(".manifest-section",void 0,_(".manifest-section-title",void 0,d(13129,null))));for(let[n,r]of o){let s=D(e,_(".package-section",void 0,_(".package-section-title",void 0,n.toUpperCase()))),l=D(s,_(".package-details"));for(let c=0;c<r.length;c++){let u=r[c];if(D(l,_(".package-detail",void 0,_(".detail-label",void 0,d(13128,null)),_(".detail-value",void 0,u.identifier))),u.packageArguments&&u.packageArguments.length>0){let p=[];for(let h of u.packageArguments)if(h.type==="named"&&(p.push(h.name),h.value&&p.push(h.value)),h.type==="positional"){let g=h.value??h.valueHint;g&&p.push(g)}D(l,_(".package-detail",void 0,_(".detail-label",void 0,d(13127,null)),_("code.detail-value",void 0,p.join(" "))))}if(u.runtimeArguments&&u.runtimeArguments.length>0){let p=[];for(let h of u.runtimeArguments)if(h.type==="named"&&(p.push(h.name),h.value&&p.push(h.value)),h.type==="positional"){let g=h.value??h.valueHint;g&&p.push(g)}D(l,_(".package-detail",void 0,_(".detail-label",void 0,d(13135,null)),_("code.detail-value",void 0,p.join(" "))))}if(u.environmentVariables&&u.environmentVariables.length>0){let p=u.environmentVariables.map(h=>`${h.name}=${h.value??""}`);D(l,_(".package-detail",void 0,_(".detail-label",void 0,d(13115,null)),_("code.detail-value",void 0,p.join(" "))))}c<r.length-1&&D(l,_(".package-separator"))}}}if(t.remotes&&t.remotes.length>0){let o=D(e,_(".package-section",void 0,_(".package-section-title",void 0,d(13132,null).toLocaleUpperCase())));for(let n of t.remotes){let r=D(o,_(".package-details"));if(D(r,_(".package-detail",void 0,_(".detail-label",void 0,d(13141,null)),_(".detail-value",void 0,n.url))),n.type&&D(r,_(".package-detail",void 0,_(".detail-label",void 0,d(13140,null)),_(".detail-value",void 0,n.type))),n.headers&&n.headers.length>0){let s=n.headers.map(l=>`${l.name}: ${l.value??""}`);D(r,_(".package-detail",void 0,_(".detail-label",void 0,d(13116,null)),_(".detail-value",void 0,s.join(", "))))}}}}renderAdditionalDetails(e,t){let o=_("div",{class:"additional-details-content",tabindex:"0"}),n=new Ar(o,{}),r=()=>n.scanDomNode(),s=vg(this.layoutParticipants,{layout:r});this.contentDisposables.add(ee(s)),this.contentDisposables.add(n),this.contentDisposables.add(this.instantiationService.createInstance(idt,o,t)),D(e,n.getDomNode()),n.scanDomNode()}loadContents(e,t){t.classList.add("loading");let o=this.contentDisposables.add(e()),n=()=>t.classList.remove("loading");return o.promise.then(n,n),o.promise}layout(e){this.dimension=e,this.layoutParticipants.forEach(t=>t.layout())}onError(e){Yi(e)||this.notificationService.error(e)}};F9=I([m(1,_e),m(2,F),m(3,Pe),m(4,Ne),m(5,Je),m(6,de),m(7,lt),m(8,Pu),m(9,Rt),m(10,X),m(11,bf),m(12,ot),m(13,Xe)],F9);var idt=class extends k{constructor(e,t,o,n,r){super();this.container=e;this.mcpGalleryManifestService=o;this.hoverService=n;this.openerService=r;this.disposables=this._register(new O);this.render(t),this._register(this.mcpGalleryManifestService.onDidChangeMcpGalleryManifest(()=>this.render(t)))}render(e){this.container.innerText="",this.disposables.clear(),e.local&&this.renderInstallInfo(this.container,e.local),e.gallery&&this.renderMarketplaceInfo(this.container,e),this.renderTags(this.container,e),this.renderExtensionResources(this.container,e)}renderTags(e,t){if(t.gallery?.topics?.length){let o=D(e,_(".categories-container.additional-details-element"));D(o,_(".additional-details-title",void 0,d(13139,null)));let n=D(o,_(".categories"));for(let r of t.gallery.topics)D(n,_("span.category",{tabindex:"0"},r))}}async renderExtensionResources(e,t){let o=[],n=await this.mcpGalleryManifestService.getMcpGalleryManifest();if(t.repository)try{o.push([d(13133,null),q.fromId(L.repo.id),A.parse(t.repository)])}catch{}if(n){let r=J3(n,"ContactSupportUri");if(r)try{o.push([d(13138,null),q.fromId(L.commentDiscussion.id),A.parse(r)])}catch{}}if(o.length){let r=D(e,_(".resources-container.additional-details-element"));D(r,_(".additional-details-title",void 0,d(13134,null)));let s=D(r,_(".resources"));for(let[l,c,u]of o){let p=D(s,_(".resource"));D(p,_(q.asCSSSelector(c))),D(p,_("a",{tabindex:"0"},l)),this.disposables.add(tdt(p,()=>this.openerService.open(u))),this.disposables.add(this.hoverService.setupManagedHover(yi("mouse"),p,u.toString()))}}}renderInstallInfo(e,t){let o=D(e,_(".more-info-container.additional-details-element"));D(o,_(".additional-details-title",void 0,d(13118,null)));let n=D(o,_(".more-info"));D(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(13117,null)),_("code",void 0,t.name))),t.version&&D(n,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(13142,null)),_("code",void 0,t.version)))}renderMarketplaceInfo(e,t){let o=t.gallery,n=D(e,_(".more-info-container.additional-details-element"));D(n,_(".additional-details-title",void 0,d(13122,null)));let r=D(n,_(".more-info"));o&&(t.local||(D(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(13117,null)),_("code",void 0,t.name))),o.version&&D(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(13142,null)),_("code",void 0,o.version)))),o.lastUpdated&&D(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(13119,null)),_("div",{title:new Date(o.lastUpdated).toString()},ea(o.lastUpdated,!0,!0,!0)))),o.publishDate&&D(r,_(".more-info-entry",void 0,_("div.more-info-entry-name",void 0,d(13130,null)),_("div",{title:new Date(o.publishDate).toString()},ea(o.publishDate,!0,!0,!0)))))}};idt=I([m(2,KH),m(3,ot),m(4,Je)],idt);var Rwn=Oe("mcp-server-editor-icon",L.mcp,d(13144,null)),E1e=class a extends Ls{constructor(e){super();this._mcpServer=e}static{this.ID="workbench.mcpServer.input2"}get typeId(){return a.ID}get capabilities(){return 10}get resource(){return A.from({scheme:Q.extension,path:td(this.mcpServer.id,"mcpServer")})}get mcpServer(){return this._mcpServer}getName(){return d(13143,null,this._mcpServer.label)}getIcon(){return Rwn}matches(e){return super.matches(e)?!0:e instanceof a&&this._mcpServer.id===e._mcpServer.id}};var AO=class{constructor(i,e,t,o,n,r,s){this.installStateProvider=i;this.runtimeStateProvider=e;this.local=t;this.gallery=o;this.installable=n;this.mcpGalleryService=r;this.fileService=s;this.local=t}get id(){return this.local?.id??this.gallery?.name??this.installable?.name??this.name}get name(){return this.gallery?.name??this.local?.name??this.installable?.name??""}get label(){return this.gallery?.displayName??this.local?.displayName??this.local?.name??this.installable?.name??""}get icon(){return this.gallery?.icon??this.local?.icon}get installState(){return this.installStateProvider(this)}get codicon(){return this.gallery?.codicon??this.local?.codicon}get publisherDisplayName(){return this.gallery?.publisherDisplayName??this.local?.publisherDisplayName??this.gallery?.publisher??this.local?.publisher}get publisherUrl(){return this.gallery?.publisherDomain?.link}get description(){return this.gallery?.description??this.local?.description??""}get starsCount(){return this.gallery?.starsCount??0}get license(){return this.gallery?.license}get repository(){return this.gallery?.repositoryUrl}get config(){return this.local?.config??this.installable?.config}get runtimeStatus(){return this.runtimeStateProvider(this)}get readmeUrl(){return this.local?.readmeUrl??(this.gallery?.readmeUrl?A.parse(this.gallery.readmeUrl):void 0)}async getReadme(i){return this.local?.readmeUrl?(await this.fileService.readFile(this.local.readmeUrl)).value.toString():this.gallery?.readme?this.gallery.readme:this.gallery?.readmeUrl?this.mcpGalleryService.getReadme(this.gallery,i):Promise.reject(new Error("not available"))}async getManifest(i){if(this.local?.manifest)return this.local.manifest;if(this.gallery)return this.gallery.configuration;throw new Error("No manifest available")}};AO=I([m(5,pq),m(6,ge)],AO);var T1e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super();this.mcpGalleryService=t;this.mcpManagementService=o;this.editorService=n;this.userDataProfilesService=r;this.uriIdentityService=s;this.workspaceService=l;this.environmentService=c;this.labelService=u;this.productService=p;this.remoteAgentService=h;this.configurationService=g;this.instantiationService=f;this.telemetryService=v;this.logService=b;this.extensionsWorkbenchService=S;this.allowedMcpServersService=y;this.mcpService=w;this.installing=[];this.uninstalling=[];this._local=[];this._onChange=this._register(new T);this.onChange=this._onChange.event;this._onReset=this._register(new T);this.onReset=this._onReset.event;this._register(this.mcpManagementService.onDidInstallMcpServersInCurrentProfile(E=>this.onDidInstallMcpServers(E))),this._register(this.mcpManagementService.onDidUpdateMcpServersInCurrentProfile(E=>this.onDidUpdateMcpServers(E))),this._register(this.mcpManagementService.onDidUninstallMcpServerInCurrentProfile(E=>this.onDidUninstallMcpServer(E))),this._register(this.mcpManagementService.onDidChangeProfile(E=>this.onDidChangeProfile())),this.queryLocal().then(()=>{if(this._store.isDisposed)return;let E=this._register(new Hh);this._register(e.onDidChangeMcpGalleryManifest(M=>E.queue(()=>this.syncInstalledMcpServers()))),E.queue(()=>this.syncInstalledMcpServers())}),x.registerHandler(this),this._register(this.configurationService.onDidChangeConfiguration(E=>{E.affectsConfiguration(sy)&&this._onChange.fire(void 0)})),this._register(this.allowedMcpServersService.onDidChangeAllowedMcpServers(()=>{this._local=this.sort(this._local),this._onChange.fire(void 0)})),this._register(Zs(w.servers,()=>{this._local=this.sort(this._local),this._onChange.fire(void 0)})),this._register(ve(E=>{for(let M of w.servers.read(E))M.enablement.read(E);this._onChange.fire(void 0)}))}get local(){return[...this._local]}async onDidChangeProfile(){await this.queryLocal(),this._onChange.fire(void 0),this._onReset.fire()}areSameMcpServers(e,t){return e===t?!0:!e||!t?!1:e.name===t.name&&e.scope===t.scope}onDidUninstallMcpServer(e){if(e.error)return;let t=this._local.find(o=>this.areSameMcpServers(o.local,e));t&&(this._local=this._local.filter(o=>o!==t),this._onChange.fire(t))}onDidInstallMcpServers(e){let t=[];for(let{local:o,source:n,name:r}of e){let s=this.installing.find(l=>l.local&&o?this.areSameMcpServers(l.local,o):l.name===r);this.installing=s?this.installing.filter(l=>l!==s):this.installing,o&&(s?s.local=o:s=this.instantiationService.createInstance(AO,l=>this.getInstallState(l),l=>this.getRuntimeStatus(l),o,n,void 0),o.galleryUrl||(s.gallery=void 0),this._local=this._local.filter(l=>!this.areSameMcpServers(l.local,o)),this.addServer(s)),this._onChange.fire(s)}t.some(o=>o.local?.galleryUrl&&!o.gallery)&&this.syncInstalledMcpServers()}onDidUpdateMcpServers(e){for(let t of e){if(!t.local)continue;let o=this._local.findIndex(r=>this.areSameMcpServers(r.local,t.local)),n;o!==-1?(this._local[o].local=t.local,n=this._local[o]):(n=this.instantiationService.createInstance(AO,r=>this.getInstallState(r),r=>this.getRuntimeStatus(r),t.local,t.source,void 0),this.addServer(n)),this._onChange.fire(n)}}fromGallery(e){for(let t of this._local)if(t.name===e.name)return t.gallery=e,t}async syncInstalledMcpServers(){let e=[];for(let t of this.local)t.local?.source==="gallery"&&t.local.galleryUrl&&e.push({name:t.local.name,id:t.local.galleryId});if(e.length){let t=await this.mcpGalleryService.getMcpServersFromGallery(e);await this.syncInstalledMcpServersWithGallery(t)}}async syncInstalledMcpServersWithGallery(e){let t=new Map(e.map(o=>[o.name,o]));for(let o of this.local){if(!o.local)continue;let n=o.local.name,r=n?t.get(n):void 0;if(!r||r.galleryUrl!==o.local.galleryUrl){o.gallery&&(o.gallery=void 0,this._onChange.fire(o));continue}o.gallery=r,o.local.manifest||(o.local=await this.mcpManagementService.updateMetadata(o.local,r)),this._onChange.fire(o)}}async queryGallery(e,t){if(!this.mcpGalleryService.isEnabled())return{firstPage:{items:[],hasMore:!1},getNextPage:async()=>({items:[],hasMore:!1})};let o=await this.mcpGalleryService.query(e,t),n=r=>({items:r.items.map(s=>this.fromGallery(s)??this.instantiationService.createInstance(AO,l=>this.getInstallState(l),l=>this.getRuntimeStatus(l),void 0,s,void 0)),hasMore:r.hasMore});return{firstPage:n(o.firstPage),getNextPage:async r=>{let s=await o.getNextPage(r);return n(s)}}}async queryLocal(){let e=await this.mcpManagementService.getInstalled();return this._local=this.sort(e.map(t=>{let n=this._local.find(r=>r.id===t.id)??this.instantiationService.createInstance(AO,r=>this.getInstallState(r),r=>this.getRuntimeStatus(r),void 0,void 0,void 0);return n.local=t,n})),this._onChange.fire(void 0),[...this.local]}addServer(e){this._local.push(e),this._local=this.sort(this._local)}sort(e){return e.sort((t,o)=>t.name===o.name?!t.runtimeStatus||t.runtimeStatus.state===4?-1:!o.runtimeStatus||o.runtimeStatus.state===4?1:0:t.name.localeCompare(o.name))}getEnabledLocalMcpServers(){let e=new Map,t=[],o=[];for(let n of this.local){let r=this.getEnablementStatus(n);r&&r.state!==4||(n.local?.scope==="user"?e.set(n.name,n.local):n.local?.scope==="remoteUser"?t.push(n.local):n.local?.scope==="workspace"&&o.push(n.local))}for(let n of t){let r=e.get(n.name);r&&this.logService.warn(d(13174,null,n.name,n.mcpResource.path,r.mcpResource.path)),e.set(n.name,n)}for(let n of o){let r=e.get(n.name);r&&this.logService.warn(d(13174,null,n.name,n.mcpResource.path,r.mcpResource.path)),e.set(n.name,n)}return[...e.values()]}canInstall(e){if(!(e instanceof AO))return new he().appendText(d(13173,null));if(e.gallery){let t=this.mcpManagementService.canInstall(e.gallery);return t===!0?!0:t}if(e.installable){let t=this.mcpManagementService.canInstall(e.installable);return t===!0?!0:t}return new he().appendText(d(13167,null,e.label))}async install(e,t){if(!(e instanceof AO))throw new Error("Invalid server instance");if(e.installable){let o=e.installable;return this.doInstall(e,()=>this.mcpManagementService.install(o,t))}if(e.gallery){let o=e.gallery;return this.doInstall(e,()=>this.mcpManagementService.installFromGallery(o,t))}throw new Error("No installable server found")}async uninstall(e){if(!e.local)throw new Error("Local server is missing");await this.mcpManagementService.uninstall(e.local)}async doInstall(e,t){let o=e.gallery?"gallery":"local",n=e.name,r=!!(e.installable?.inputs&&e.installable.inputs.length>0);this.installing.push(e),this._onChange.fire(e);try{await t();let s=await this.waitAndGetInstalledMcpServer(e);return this.telemetryService.publicLog2("mcp/serverInstall",{serverName:n,source:o,scope:s.local?.scope??"unknown",success:!0,hasInputs:r}),s}catch(s){throw this.telemetryService.publicLog2("mcp/serverInstall",{serverName:n,source:o,scope:"unknown",success:!1,error:s instanceof Error?s.message:String(s),hasInputs:r}),s}finally{this.installing.includes(e)&&(this.installing.splice(this.installing.indexOf(e),1),this._onChange.fire(e))}}async waitAndGetInstalledMcpServer(e){let t=this.local.find(o=>o.name===e.name);if(t||await U.toPromise(U.filter(this.onChange,o=>!!o&&this.local.some(n=>n.name===e.name))),t=this.local.find(o=>o.name===e.name),!t)throw new Error("Extension should have been installed");return t}getMcpConfigPath(e){if(e instanceof A){let t=e;for(let o of this.userDataProfilesService.profiles)if(this.uriIdentityService.extUri.isEqual(o.mcpResource,t))return this.getUserMcpConfigPath(t);return this.remoteAgentService.getEnvironment().then(o=>o&&this.uriIdentityService.extUri.isEqual(o.mcpResource,t)?this.getRemoteMcpConfigPath(t):this.getWorkspaceMcpConfigPath(t))}if(e.scope==="user")return this.getUserMcpConfigPath(e.mcpResource);if(e.scope==="workspace")return this.getWorkspaceMcpConfigPath(e.mcpResource);if(e.scope==="remoteUser")return this.getRemoteMcpConfigPath(e.mcpResource)}getUserMcpConfigPath(e){return{id:FOi,key:"userLocalValue",target:3,label:d(13172,null,this.productService.nameShort),scope:0,order:200,uri:e,section:[]}}getRemoteMcpConfigPath(e){return{id:WOi,key:"userRemoteValue",target:4,label:this.environmentService.remoteAuthority?this.labelService.getHostLabel(Q.vscodeRemote,this.environmentService.remoteAuthority):"Remote",scope:0,order:150,remoteAuthority:this.environmentService.remoteAuthority,uri:e,section:[]}}getWorkspaceMcpConfigPath(e){let t=this.workspaceService.getWorkspace();if(t.configuration&&this.uriIdentityService.extUri.isEqual(t.configuration,e))return{id:VOi,key:"workspaceValue",target:5,label:Be(e),scope:1,order:100,remoteAuthority:this.environmentService.remoteAuthority,uri:e,section:["settings",jW]};let o=t.folders;for(let n=0;n<o.length;n++){let r=o[n];if(this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.joinPath(r.uri,kR[yb]),e))return{id:`${BOi}${n}`,key:"workspaceFolderValue",target:6,label:`${r.name}/.vscode/mcp.json`,scope:1,remoteAuthority:this.environmentService.remoteAuthority,order:0,uri:e,workspaceFolder:r}}}async handleURL(e){if(e.path==="mcp/install")return this.handleMcpInstallUri(e);if(e.path.startsWith("mcp/by-name/")){let t=e.path.substring(12);if(t)return this.handleMcpServerByName(t)}if(e.path.startsWith("mcp/")){let t=e.path.substring(4);if(t)return this.handleMcpServerUrl(`${Q.https}://${t}`)}return!1}async handleMcpInstallUri(e){let t;try{t=JSON.parse(decodeURIComponent(e.query))}catch{return!1}try{let{name:o,inputs:n,gallery:r,...s}=t;s.type===void 0&&(s.type=t.command?"stdio":"http"),this.open(this.instantiationService.createInstance(AO,l=>this.getInstallState(l),l=>this.getRuntimeStatus(l),void 0,void 0,{name:o,config:s,inputs:n}))}catch{}return!0}async handleMcpServerUrl(e){try{let t=await this.mcpGalleryService.getMcpServer(e);if(!t)return this.logService.info(`MCP server '${e}' not found`),!0;let o=this.local.find(n=>n.name===t.name)??this.instantiationService.createInstance(AO,n=>this.getInstallState(n),n=>this.getRuntimeStatus(n),void 0,t,void 0);this.open(o)}catch(t){this.logService.error(t)}return!0}async handleMcpServerByName(e){try{let[t]=await this.mcpGalleryService.getMcpServersFromGallery([{name:e}]);if(!t)return this.logService.info(`MCP server '${e}' not found`),!0;let o=this.local.find(n=>n.name===t.name)??this.instantiationService.createInstance(AO,n=>this.getInstallState(n),n=>this.getRuntimeStatus(n),void 0,t,void 0);this.open(o)}catch(t){this.logService.error(t)}return!0}async openSearch(e,t){await this.extensionsWorkbenchService.openSearch(`@mcp ${e}`,t)}async open(e,t){let o=this.configurationService.getValue("extensions.allowOpenInModalEditor");await this.editorService.openEditor(this.instantiationService.createInstance(E1e,e),t,o?MM:tr)}getInstallState(e){return this.installing.some(o=>o.name===e.name)?0:this.uninstalling.some(o=>o.name===e.name)?2:this.local.find(o=>o===e)?1:3}getRuntimeStatus(e){let t=this.getEnablementStatus(e);if(t)return t;let o=this.mcpService.servers.get().find(r=>r.definition.id===e.id);if(!o)return{state:0};let n=o.enablement.get();if(n===0)return{state:2,message:{severity:wt.Info,text:new he(d(13170,null))}};if(n===1)return{state:3,message:{severity:wt.Info,text:new he(d(13171,null))}}}getEnablementStatus(e){if(!e.local)return;let t=nc("workbench.action.openSettings",{query:`@id:${sy}`}).toString(),o=this.configurationService.getValue(sy);if(o==="none")return{state:1,message:{severity:wt.Warning,text:new he(d(13168,null,t))}};if(o==="registry"){if(!e.gallery)return{state:1,message:{severity:wt.Warning,text:new he(d(13169,null,t))}};let n=e.local.config.type==="http"&&e.local.config.url;if(n&&!e.gallery.configuration.remotes?.some(r=>r.url===n))return{state:1,message:{severity:wt.Warning,text:new he(d(13169,null,t))}}}}};T1e=I([m(0,KH),m(1,pq),m(2,V6),m(3,ie),m(4,hn),m(5,gt),m(6,Ae),m(7,Mt),m(8,nt),m(9,Ze),m(10,bo),m(11,B),m(12,F),m(13,_e),m(14,re),m(15,Ui),m(16,fP),m(17,Vs),m(18,tS)],T1e);var rSe=class extends k{static{this.ID="workbench.mcp.contexts.initialisation"}constructor(i,e,t){super();let o=hme.bindTo(t);o.set(e.mcpGalleryManifestStatus),this._register(e.onDidChangeMcpGalleryManifestStatus(r=>o.set(r)));let n=xee.bindTo(t);i.queryLocal().finally(()=>{n.set(i.local.length>0),this._register(i.onChange(()=>n.set(i.local.length>0)))})}};rSe=I([m(0,bf),m(1,KH),m(2,X)],rSe);Ce(xc,l1e,1);Ce(EWe,kWe,1);Ce(Vs,p1e,1);Ce(bf,T1e,0);Ce(xWe,mne,1);Ce(Z3,u1e,1);Ce(LJe,y1e,1);Ce(zLe,m1e,1);R1.register(new Vt(t1e));R1.register(new Vt(ZUe));R1.register(new Vt(Ore));R1.register(new Vt(o1e));R1.register(new Vt(n1e));R1.register(new Vt(i1e));bt("mcpDiscovery",I1e,vt.AfterRestored);bt("mcpContextKeys",r1e,vt.BlockRestore);bt("mcpLanguageFeatures",w1e,vt.Eventually);bt("mcpResourceFilesystem",c1e,vt.BlockRestore);bt(iSe.ID,iSe,vt.AfterRestored);bt("mcpGatewayToolBrokerRemote",g1e,vt.AfterRestored);W(M8t);W(A8t);W(P8t);W(N8t);W(O8t);W(F8t);W(W8t);W(V8t);W(B8t);W(K8t);W(G8t);W(U8t);W(z8t);W(H8t);W(q8t);W(Q8t);W(Y8t);W(J8t);W(X8t);W($8t);W(Z8t);W(eQt);W(tQt);W(iQt);bt("mcpActionRendering",S1e,vt.BlockRestore);bt("mcpAddContext",b1e,vt.Eventually);bt(rSe.ID,rSe,vt.AfterRestored);bt(oSe.ID,oSe,vt.Eventually);var Mwn=oe.as(Ta.JSONContribution);Mwn.registerSchema(VMe,hSo);oe.as(en.EditorPane).registerEditorPane(os.create(F9,F9.ID,d(12878,null)),[new Vt(E1e)]);oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:O9,prefix:O9.PREFIX,when:Z.enabled,placeholder:d(12877,null),helpEntries:[{description:d(12876,null),commandId:"workbench.mcp.addConfiguration"}]});oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"chat.mcp.enabled",migrateFn:(a,i)=>{let e=[["chat.mcp.enabled",{value:void 0}]];return a===!0&&e.push([sy,{value:"all"}]),a===!1&&e.push([sy,{value:"none"}]),e}}]);var Ure=class extends L9{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(t,o,n,c,u,p,r,h,s,l);this.mpcViewOptions=e;this.dialogService=g;this.mcpWorkbenchService=f;this.mcpGalleryManifestService=v;this.layoutService=b;this.markdownRendererService=S;this.logService=y;this.list=null;this.listContainer=null;this.welcomeContainer=null;this.contextMenuActionRunner=this._register(new cs);this.modalNavigationDisposable=this._register(new ue)}renderBody(e){super.renderBody(e),this.welcomeContainer=D(e,_(".mcp-welcome-container.hide")),this.createWelcomeContent(this.welcomeContainer);let t=D(e,_(".message-container")),o=D(t,_("")),n=D(t,_(".message")),r=_(".mcp-servers-list");this.bodyTemplate={mcpServersList:r,messageBox:n,messageContainer:t,messageSeverityIcon:o},this.listContainer=D(e,r),this.list=this._register(this.instantiationService.createInstance(r2,`${this.id}-MCP-Servers`,this.listContainer,{getHeight(){return 72},getTemplateId:()=>zre.templateId},[this.instantiationService.createInstance(zre,{hoverOptions:{position:()=>{let s=this.viewDescriptorService.getViewLocationById(this.id);return s===0?this.layoutService.getSideBarPosition()===0?1:0:s===2?this.layoutService.getSideBarPosition()===0?0:1:1}}})],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(s){return s?.label??""},getWidgetAriaLabel(){return d(13151,null)}},overrideStyles:IG(this.viewDescriptorService.getViewLocationById(this.id)).listOverrideStyles,openOnSingleClick:!0})),this._register(U.debounce(U.filter(this.list.onDidOpen,s=>s.element!==null),(s,l)=>l,75,!0)(s=>{this.mcpWorkbenchService.open(s.element,{...s.editorOptions,modal:s.sideBySide?void 0:vAi(s.element,()=>this.list?.model,(l,c)=>l.id===c.id,(l,c)=>this.mcpWorkbenchService.open(l,{pinned:!1,modal:c}),this.modalNavigationDisposable,this.logService)})})),this._register(this.list.onContextMenu(s=>this.onContextMenu(s),this)),this.input&&this.renderInput()}async onContextMenu(e){if(e.element){let t=new O,o=e.element&&this.mcpWorkbenchService.local.find(s=>s.id===e.element.id)||e.element,n=cct(o,!1,this.instantiationService),r=[];for(let s of n){for(let l of s)r.push(l),Sd(l)&&t.add(l);r.push(new oi)}r.pop(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>r,actionRunner:this.contextMenuActionRunner,onHide:()=>t.dispose()})}}layoutBody(e,t){super.layoutBody(e,t),this.list?.layout(e,t)}async show(e){return this.input&&(this.input.disposables.dispose(),this.input=void 0),this.mpcViewOptions.showWelcome?this.input={model:new hh([]),disposables:new O,showWelcomeContent:!0}:this.input=await this.query(e.trim()),this.renderInput(),this.input.onDidChangeModel&&this.input.disposables.add(this.input.onDidChangeModel(t=>{this.input&&(this.input.model=t,this.renderInput())})),this.input.model}renderInput(){this.input&&(this.list&&(this.list.model=new u6(this.input.model)),this.showWelcomeContent(!!this.input.showWelcomeContent),this.input.showWelcomeContent||this.updateBody())}showWelcomeContent(e){this.welcomeContainer?.classList.toggle("hide",!e),this.listContainer?.classList.toggle("hide",e)}createWelcomeContent(e){let t=D(e,_(".mcp-welcome-content")),o=D(t,_(".mcp-welcome-icon")),n=D(o,_("span"));n.className=q.asClassName(C1e);let r=D(t,_(".mcp-welcome-title"));r.textContent=d(13160,null);let s=Xw({id:"workbench.action.openSettings",arguments:[`@id:${mq}`],text:mq,tooltip:d(13159,null)}).toString(),l=D(t,_(".mcp-welcome-description")),c=this._register(this.markdownRendererService.render(new he(d(13157,null),{isTrusted:{enabledCommands:["workbench.action.openSettings"]}}).appendMarkdown(`

`).appendMarkdown(d(13155,null,s))));l.appendChild(c.element);let u=D(t,_(".mcp-welcome-button-container")),p=this._register(new Pi(u,{title:d(13158,null),...Ro}));p.label=d(13158,null),this._register(p.onDidClick(async()=>{let{result:h}=await this.dialogService.prompt({type:"info",message:d(13156,null),custom:{markdownDetails:[{markdown:new he(d(13155,null,s),{isTrusted:!0})}]},buttons:[{label:d(13154,null),run:()=>!0},{label:d(13153,null),run:()=>!1}]});h&&await this.configurationService.updateValue(mq,!0)}))}updateBody(e){if(this.bodyTemplate){let t=this.input?.model.length??0;this.bodyTemplate.mcpServersList.classList.toggle("hidden",t===0),this.bodyTemplate.messageContainer.classList.toggle("hidden",!e&&t>0),this.isBodyVisible()&&(e?(this.bodyTemplate.messageSeverityIcon.className=eE.className(e.severity),this.bodyTemplate.messageBox.textContent=e.text):t===0&&(this.bodyTemplate.messageSeverityIcon.className="",this.bodyTemplate.messageBox.textContent=d(13161,null)),this.bodyTemplate.messageBox.textContent&&cn(this.bodyTemplate.messageBox.textContent))}}async query(e){let t=new O;if(e){let r=await this.mcpWorkbenchService.queryGallery({text:e.replace("@mcp","")});return{model:t.add(new hqt(r)),disposables:t}}let o=t.add(new T),n=await this.mcpWorkbenchService.queryLocal();return t.add(U.debounce(this.mcpWorkbenchService.onChange,()=>{})(()=>{let r=this.mergeChangedMcpServers(n,[...this.mcpWorkbenchService.local]);r&&(n=r,o.fire(new hh(n)))})),t.add(this.mcpWorkbenchService.onReset(()=>o.fire(new hh([...this.mcpWorkbenchService.local])))),{model:new hh(n),onDidChangeModel:o.event,disposables:t}}mergeChangedMcpServers(e,t){let o=[...e],n=s=>{let l=-1,c=t[s];return c&&(l=o.findIndex(u=>u.id===c.id),l===-1)?n(s-1):l},r=!1;for(let s=0;s<t.length;s++){let l=t[s];e.every(c=>c.id!==l.id)&&(r=!0,e.splice(n(s-1)+1,0,l))}for(let s=e.length-1;s>=0;s--){let l=e[s];t.every(c=>c.id!==l.id)&&t.some(c=>c.name===l.name)&&(r=!0,e.splice(s,1))}if(!r&&e.length===t.length){for(let s=0;s<t.length;s++)if(e[s]?.id!==t[s]?.id){r=!0,e=t;break}}return r?e:void 0}};Ure=I([m(2,Le),m(3,Xe),m(4,F),m(5,Pe),m(6,ot),m(7,B),m(8,X),m(9,ji),m(10,Je),m(11,ct),m(12,bf),m(13,KH),m(14,wi),m(15,_n),m(16,re)],Ure);var zre=class{constructor(i,e,t,o){this.options=i;this.instantiationService=e;this.mcpWorkbenchService=t;this.notificationService=o;this.templateId=zre.templateId}static{this.templateId="mcpServer"}renderTemplate(i){let e=D(i,_(".mcp-server-item.extension-list-item")),t=D(e,_(".icon-container")),o=this.instantiationService.createInstance(Vre,t),n=D(e,_(".details")),r=D(n,_(".header-container")),s=D(r,_(".header")),l=D(s,_("span.name")),c=D(s,_("span.ratings")),u=D(n,_(".description.ellipsis")),p=D(n,_(".footer")),h=this.instantiationService.createInstance(Bre,D(p,_(".publisher-container")),!0),g=new oo(p,{actionViewItemProvider:(x,E)=>{if(x instanceof n9)return x.createActionViewItem(E)},focusOnlyEnabledItems:!0});g.setFocusable(!1);let f=g.onDidRun(({error:x})=>x&&this.notificationService.error(x)),v=this.instantiationService.createInstance(tL),b=[this.instantiationService.createInstance(H_,!0),this.instantiationService.createInstance(wHe),this.instantiationService.createInstance(GP,!1),v],S=[o,h,this.instantiationService.createInstance(nSe,c,!0),this.instantiationService.createInstance(Hre,t),this.instantiationService.createInstance(x1e,{target:i,position:this.options.hoverOptions.position},v)],y=this.instantiationService.createInstance(yee,[...b,...S]);g.push(b,{icon:!0,label:!0});let w=Fn(...b,...S,g,f,y);return{root:i,element:e,name:l,description:u,starred:c,disposables:[w],actionbar:g,mcpServerDisposables:[],set mcpServer(x){y.mcpServer=x}}}renderPlaceholder(i,e){e.element.classList.add("loading"),e.mcpServerDisposables=je(e.mcpServerDisposables),e.name.textContent="",e.description.textContent="",e.starred.style.display="none",e.mcpServer=null}renderElement(i,e,t){t.element.classList.remove("loading"),t.mcpServerDisposables=je(t.mcpServerDisposables),t.root.setAttribute("data-mcp-server-id",i.id),t.name.textContent=i.label,t.description.textContent=i.description,t.starred.style.display="",t.mcpServer=i;let o=()=>t.root.classList.toggle("disabled",!!i.runtimeStatus?.state&&i.runtimeStatus.state!==4);o(),t.mcpServerDisposables.push(this.mcpWorkbenchService.onChange(n=>{(!n||n.id===i.id)&&o()}))}disposeElement(i,e,t){t.mcpServerDisposables=je(t.mcpServerDisposables)}disposeTemplate(i){i.mcpServerDisposables=je(i.mcpServerDisposables),i.disposables=je(i.disposables)}};zre=I([m(1,F),m(2,bf),m(3,Ne)],zre);var sQt=class extends Ure{renderBody(i){super.renderBody(i),this._register(this.mcpGalleryManifestService.onDidChangeMcpGalleryManifest(()=>this.show()))}async show(){return super.show("@mcp")}},odt=class extends k{static{this.ID="workbench.mcp.servers.views.contribution"}constructor(){super(),oe.as(Kn.ViewsRegistry).registerViews([{id:fRe,name:P(13152,"MCP Servers - Installed"),ctorDescriptor:new Vt(Ure,[{}]),when:C.and(zx,xee,Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate()),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.default.marketplace",name:P(13150,"MCP Servers"),ctorDescriptor:new Vt(sQt,[{}]),when:C.and(zx,xee.toNegated(),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),hme.isEqualTo("available"),C.or(lT.create(`config.${gQ}`),D4.notEqualsTo("stable"),lT.create(`config.${mq}`))),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.marketplace",name:P(13150,"MCP Servers"),ctorDescriptor:new Vt(Ure,[{}]),when:C.and(CJe,Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),hme.isEqualTo("available"),C.or(lT.create(`config.${gQ}`),D4.notEqualsTo("stable"),lT.create(`config.${mq}`)))},{id:"workbench.views.mcp.default.welcomeView",name:P(13150,"MCP Servers"),ctorDescriptor:new Vt(sQt,[{showWelcome:!0}]),when:C.and(zx,xee.toNegated(),Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),hme.isEqualTo("available"),lT.create(`config.${gQ}`).negate(),D4.isEqualTo("stable"),lT.create(`config.${mq}`).negate()),weight:40,order:4,canToggleVisibility:!0},{id:"workbench.views.mcp.welcomeView",name:P(13150,"MCP Servers"),ctorDescriptor:new Vt(Ure,[{showWelcome:!0}]),when:C.and(CJe,Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),hme.isEqualTo("available"),lT.create(`config.${gQ}`).negate(),D4.isEqualTo("stable"),lT.create(`config.${mq}`).negate())}],u8t)}};bt(odt.ID,odt,vt.AfterRestored);var Pwn=zn.registerExtensionPoint({extensionPoint:"chatContext",jsonSchema:{description:d(8340,null),type:"array",items:{type:"object",properties:{id:{description:d(8342,null),type:"string"},icon:{description:d(8341,null),type:"string"},displayName:{description:d(8344,null),type:"string"}},required:["id","icon","displayName"]}},activationEventsGenerator:function*(a){for(let i of a)yield`onChatContextProvider:${i.id}`}}),_1e=class extends k{constructor(e){super();this._chatContextService=e;Pwn.setHandler(t=>{for(let o of t)if(Va(o.description,"chatContextProvider")&&Array.isArray(o.value))for(let n of o.value){let r=n.icon?q.fromString(n.icon):void 0;if(!r&&n.icon){o.collector.error(d(8343,null,n.id,"$(iconId)","$(iconId~spin)","$(copilot)"));continue}r&&this._chatContextService.setChatContextProvider(`${o.description.id}-${n.id}`,{title:n.displayName,icon:r})}})}static{this.ID="workbench.contrib.chatContextContribution"}};_1e=I([m(0,SR)],_1e);bt(_1e.ID,_1e,vt.AfterRestored);var W9=class a extends Ls{constructor(e,t=0){super();this.collection=e;this.startIndex=t;this._resource=A.from({scheme:Q.vscodeImageCarousel,path:`/${encodeURIComponent(e.id)}`}),this._name=e.title}static{this.ID="workbench.input.imageCarousel"}get capabilities(){return super.capabilities|8|2048}get typeId(){return a.ID}get resource(){return this._resource}getName(){return this._name}setName(e){this._name!==e&&(this._name=e,this._onDidChangeLabel.fire())}matches(e){return e instanceof a?e.collection.id===this.collection.id:!1}};function ndt(a){return a.startsWith("video/")}var Awn=.075,FPo=20,WPo=.1,Nwn=3,D1e=[.1,.2,.3,.4,.5,.6,.7,.8,.9,1,1.5,2,3,5,7,10,15,20],V9=class extends zs{constructor(e,t,o,n,r,s){super(V9.ID,e,t,o,n);this._fileService=r;this._webviewService=s;this._currentIndex=0;this._zoomScale="fit";this._sections=[];this._flatImages=[];this._contentDisposables=this._register(new O);this._imageDisposables=this._register(new O);this._blobUrlCache=new Map;this._thumbnailElements=[]}static{this.ID="workbench.editor.imageCarousel"}createEditor(e){this._container=st("div.image-carousel-editor").root,e.appendChild(this._container)}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this._sections=e.collection.sections,this._flatImages=[];for(let r=0;r<this._sections.length;r++)for(let s=0;s<this._sections[r].images.length;s++)this._flatImages.push({sectionIndex:r,imageIndexInSection:s,image:this._sections[r].images[s]});this._currentIndex=Math.min(e.startIndex,Math.max(0,this._flatImages.length-1)),this.buildSlideshow()}clearInput(){this._videoWebview?.dispose(),this._videoWebview=void 0,this._contentDisposables.clear(),this._imageDisposables.clear(),this._revokeCachedBlobUrls(),this._zoomScale="fit",this._container&&St(this._container),this._elements=void 0,this._thumbnailElements=[],super.clearInput()}_isCurrentVideo(){let e=this._flatImages[this._currentIndex];return!!e&&ndt(e.image.mimeType)}buildSlideshow(){if(!this._container)return;if(this._contentDisposables.clear(),this._imageDisposables.clear(),this._revokeCachedBlobUrls(),St(this._container),this._flatImages.length===0){let s=st("div.empty-message");s.root.textContent=d(12396,null),this._container.appendChild(s.root);return}let e=st("div.slideshow-container",[st("div.image-area@imageArea",[st("div.main-image-container@mainImageContainer",[st("img.main-image@mainImage"),st("div.video-container@videoContainer")]),st("button.nav-arrow.prev-arrow@prevBtn",{ariaLabel:d(12397,null)},[st("span.codicon.codicon-chevron-left",{ariaHidden:"true"})]),st("button.nav-arrow.next-arrow@nextBtn",{ariaLabel:d(12395,null)},[st("span.codicon.codicon-chevron-right",{ariaHidden:"true"})])]),st("div.bottom-bar@bottomBar",[st("div.image-info-bar",[st("span.caption-text@captionText"),st("span.caption-separator@captionSeparator"),st("span.image-counter@counter")]),st("div.sections-container@sectionsContainer"),st("span.sr-only@ariaStatus")])]);e.root.setAttribute("role","group"),e.root.setAttribute("aria-label",d(12391,null)),e.captionSeparator.setAttribute("aria-hidden","true"),e.ariaStatus.setAttribute("aria-live","polite"),e.ariaStatus.setAttribute("aria-atomic","true"),e.sectionsContainer.setAttribute("role","group"),e.sectionsContainer.setAttribute("aria-label",d(12402,null)),this._elements={root:e.root,imageArea:e.imageArea,mainImageContainer:e.mainImageContainer,mainImage:e.mainImage,videoContainer:e.videoContainer,captionText:e.captionText,captionSeparator:e.captionSeparator,counter:e.counter,ariaStatus:e.ariaStatus,prevBtn:e.prevBtn,nextBtn:e.nextBtn,sectionsContainer:e.sectionsContainer},this._elements.mainImage.classList.add("scale-to-fit"),this._elements.mainImage.alt="",this._elements.videoContainer.style.display="none",this._contentDisposables.add($(this._elements.prevBtn,"click",()=>{this._currentIndex>0&&(this._currentIndex--,this.updateCurrentImage())})),this._contentDisposables.add($(this._elements.nextBtn,"click",()=>{this._currentIndex<this._flatImages.length-1&&(this._currentIndex++,this.updateCurrentImage())})),this._contentDisposables.add($(e.root,ne.KEY_DOWN,s=>{let l=new mi(s);l.keyCode===15?(this.previous(),l.stopPropagation(),l.preventDefault()):l.keyCode===17&&(this.next(),l.stopPropagation(),l.preventDefault())})),e.root.tabIndex=0,this._contentDisposables.add($(this._elements.imageArea,ne.MOUSE_WHEEL,s=>{if(this._isCurrentVideo()||!(et?s.altKey:s.ctrlKey)&&!s.ctrlKey||(s.preventDefault(),s.deltaY===0))return;this._zoomScale==="fit"&&this._initZoomFromFit();let c=s.deltaY>0?1:-1;this._applyZoom(this._zoomScale*(1-c*Awn))},{passive:!1}));let t=!1,o=!1;this._contentDisposables.add($(this._elements.mainImageContainer,ne.MOUSE_DOWN,s=>{s.button===0&&(t=s.ctrlKey,o=s.altKey)})),this._contentDisposables.add($(this._elements.mainImageContainer,ne.CLICK,s=>{if(s.button!==0||this._isCurrentVideo())return;(et?o:t)?this._zoomOut():this._zoomIn()}));let n=s=>{let l=et?s.altKey:s.ctrlKey;this._elements.mainImageContainer.classList.toggle("zoom-out",l)};this._contentDisposables.add($(e.root,ne.KEY_DOWN,n)),this._contentDisposables.add($(e.root,ne.KEY_UP,n)),this._thumbnailElements=[];let r=0;for(let s=0;s<this._sections.length;s++){let l=this._sections[s];if(s>0&&this._sections.length>1){let c=st("div.thumbnail-separator").root;c.setAttribute("aria-hidden","true"),this._elements.sectionsContainer.appendChild(c)}for(let c=0;c<l.images.length;c++){let u=l.images[c],p=r,h=ndt(u.mimeType),g=document.createElement("button");if(g.className=h?"thumbnail video-thumbnail":"thumbnail",g.ariaLabel=h?d(12401,null,p+1,this._flatImages.length):d(12400,null,p+1,this._flatImages.length),h){let f=st("span.codicon.codicon-play.thumbnail-play-icon");f.root.setAttribute("aria-hidden","true"),g.appendChild(f.root)}else{let f=document.createElement("img");f.className="thumbnail-image",f.alt=u.name;let v=this._contentDisposables.add(new O),b=()=>{if(!v.isDisposed&&!g.classList.contains("broken")){g.classList.add("broken"),f.removeAttribute("src"),f.alt="",f.remove();let S=st("span.codicon.codicon-warning.thumbnail-broken-icon");S.root.setAttribute("aria-hidden","true"),g.appendChild(S.root)}};this._loadBlobUrl(u).then(S=>{if(!v.isDisposed)if(S){let y=new Image;v.add($(y,"load",()=>{g.classList.contains("broken")||(f.src=S,f.parentElement||g.appendChild(f))})),v.add($(y,"error",()=>{b()})),y.src=S}else b()},()=>{b()}),v.add($(f,"error",()=>{b()}))}this._contentDisposables.add($(g,"click",()=>{this._currentIndex=p,this.updateCurrentImage()})),this._elements.sectionsContainer.appendChild(g),this._thumbnailElements.push(g),r++}}this._container.appendChild(e.root),this.updateCurrentImage()}async updateCurrentImage(){if(!this._elements)return;let e=this._currentIndex,t=this._flatImages[e],o=t.image,n=ndt(o.mimeType);if(n){this._elements.mainImage.style.display="none",this._elements.videoContainer.style.display="",this._elements.mainImageContainer.classList.remove("zoomed"),this._elements.mainImageContainer.style.cursor="default";let l=await this._loadRawData(o);if(this._currentIndex!==e)return;let c=ht(),u=`<!DOCTYPE html>
<html><head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; media-src blob: data:; script-src 'nonce-${c}'; style-src 'nonce-${c}';">
<style nonce="${c}">html,body{margin:0;padding:0;width:100%;height:100%;overflow:hidden;background:transparent}
video{width:100%;height:100%;object-fit:contain;outline:none}</style>
</head><body>
<video id="v" controls></video>
<script nonce="${c}">
window.addEventListener("message",function(e){var m=e.data;if(m.type==="loadVideo"){var b=new Blob([m.data],{type:m.mimeType});document.getElementById("v").src=URL.createObjectURL(b);}});
</script>
</body></html>`,p;this._videoWebview?p=this._videoWebview:(p=this._contentDisposables.add(this._webviewService.createWebviewElement({title:o.name,options:{disableServiceWorker:!0},contentOptions:{allowScripts:!0},extension:void 0})),p.mountTo(this._elements.videoContainer,this.window),this._videoWebview=p),p.setHtml(u);let h=l.buffer;p.postMessage({type:"loadVideo",data:h,mimeType:o.mimeType},[h])}else{this._elements.videoContainer.style.display="none",this._elements.mainImage.style.display="",this._elements.mainImageContainer.style.cursor="";let l=await this._loadBlobUrl(o);if(this._currentIndex!==e)return;let c=new Image;c.src=l,c.decode().then(()=>{this._currentIndex===e&&this._elements&&(this._elements.mainImage.src=l,this._elements.mainImage.alt=o.name)},()=>{this._currentIndex===e&&this._elements&&(this._elements.mainImage.src=l,this._elements.mainImage.alt=o.name)})}this._applyZoom("fit"),o.caption?(this._elements.captionText.textContent=o.caption,this._elements.captionText.style.display="",this._elements.captionSeparator.style.display=""):(this._elements.captionText.textContent="",this._elements.captionText.style.display="none",this._elements.captionSeparator.style.display="none"),this._elements.counter.textContent=d(12392,null,e+1,this._flatImages.length);let r=n?d(12394,null):d(12393,null);this._elements.ariaStatus.textContent=o.caption?d(12398,null,r,e+1,this._flatImages.length,o.caption):d(12399,null,r,e+1,this._flatImages.length,o.name),this._elements.prevBtn.disabled=e===0,this._elements.nextBtn.disabled=e===this._flatImages.length-1;for(let l=0;l<this._thumbnailElements.length;l++){let c=l===e,u=this._thumbnailElements[l];u.classList.toggle("active",c),c?u.setAttribute("aria-current","page"):u.removeAttribute("aria-current")}let s=this._thumbnailElements[e];if(s&&s.scrollIntoView({block:"nearest",inline:"nearest"}),this.input instanceof W9){let l=this._sections[t.sectionIndex];this.input.setName(l.title||this.input.collection.title)}this._preloadAdjacentImages()}async _loadBlobUrl(e){let t=this._blobUrlCache.get(e.id);if(t)return t;let o;if(e.data)o=e.data instanceof Uint8Array?e.data:e.data.buffer;else if(e.uri)o=(await this._fileService.readFile(e.uri)).value.buffer;else return"";let n=new Blob([o],{type:e.mimeType}),r=URL.createObjectURL(n);return this._blobUrlCache.set(e.id,r),r}_revokeCachedBlobUrls(){for(let e of this._blobUrlCache.values())URL.revokeObjectURL(e);this._blobUrlCache.clear()}async _loadRawData(e){return e.data?e.data instanceof Uint8Array?e.data:e.data.buffer:e.uri?(await this._fileService.readFile(e.uri)).value.buffer:new Uint8Array(0)}_preloadAdjacentImages(){for(let e of[this._currentIndex-1,this._currentIndex+1])if(e>=0&&e<this._flatImages.length){let t=this._flatImages[e].image;ndt(t.mimeType)?this._loadRawData(t).catch(()=>{}):this._loadBlobUrl(t).then(o=>{let n=new Image;n.src=o,n.decode().catch(()=>{})})}}previous(){this._currentIndex>0&&(this._currentIndex--,this.updateCurrentImage())}next(){this._currentIndex<this._flatImages.length-1&&(this._currentIndex++,this.updateCurrentImage())}_initZoomFromFit(){if(!this._elements)return;let e=this._elements.mainImage;e.naturalWidth>0?this._zoomScale=e.clientWidth/e.naturalWidth:this._zoomScale=1}_zoomIn(){this._zoomScale==="fit"&&this._initZoomFromFit();let e=this._zoomScale,t=0;for(;t<D1e.length&&!(D1e[t]>e);++t);this._applyZoom(D1e[t]??FPo)}_zoomOut(){this._zoomScale==="fit"&&this._initZoomFromFit();let e=this._zoomScale,t=D1e.length-1;for(;t>=0&&!(D1e[t]<e);--t);this._applyZoom(D1e[t]??WPo)}_applyZoom(e){if(!this._elements)return;let t=this._elements.mainImageContainer,o=this._elements.mainImage;if(e==="fit"){this._zoomScale="fit",o.classList.add("scale-to-fit"),o.classList.remove("pixelated"),o.style.zoom="";let n=t.classList.contains("zoomed");t.classList.remove("zoomed"),t.classList.remove("zoom-out"),n&&t.scrollTo(0,0)}else{let n=jn(e,WPo,FPo);this._zoomScale=n;let r=t.scrollWidth>0?(t.scrollLeft+t.clientWidth/2)/t.scrollWidth:.5,s=t.scrollHeight>0?(t.scrollTop+t.clientHeight/2)/t.scrollHeight:.5;o.classList.remove("scale-to-fit"),o.classList.toggle("pixelated",n>=Nwn),o.style.zoom=String(n),t.classList.add("zoomed");let l=t.scrollWidth*r-t.clientWidth/2,c=t.scrollHeight*s-t.clientHeight/2;t.scrollTo(l,c)}}focus(){super.focus(),this._elements?.root.focus()}layout(e){this._container&&(this._container.style.width=`${e.width}px`,this._container.style.height=`${e.height}px`)}};V9=I([m(1,_e),m(2,Pe),m(3,de),m(4,ge),m(5,Pu)],V9);oe.as($t.Configuration).registerConfiguration({id:"imageCarousel",title:d(12386,null),type:"object",properties:{"imageCarousel.explorerContextMenu.enabled":{type:"boolean",default:!0,markdownDescription:d(12383,null),tags:["experimental"]},"imageCarousel.chat.enabled":{type:"boolean",default:!0,description:d(12382,null),tags:["experimental"]}}});oe.as(en.EditorPane).registerEditorPane(os.create(V9,V9.ID,d(12387,null)),[new Vt(W9)]);var jBi=class{canSerialize(){return!1}serialize(){}deserialize(){}};oe.as(en.EditorFactory).registerEditorSerializer(W9.ID,jBi);function Own(a){return typeof a=="object"&&a!==null&&typeof a.collection=="object"&&typeof a.startIndex=="number"}function Fwn(a){return typeof a=="object"&&a!==null&&typeof a.name=="string"&&typeof a.mimeType=="string"&&a.data instanceof Uint8Array}var QBi=class extends z{constructor(){super({id:"workbench.action.chat.openImageInCarousel",title:P(12389,"Open in Images Preview"),f1:!1})}async run(i,e){let t=i.get(ie),o,n;if(Own(e))o=e.collection,n=e.startIndex;else if(Fwn(e))o={id:ht(),title:e.title??d(12385,null),sections:[{title:"",images:[{id:ht(),name:e.name,mimeType:e.mimeType,data:Ke.wrap(e.data)}]}]},n=0;else return;let r=new W9(o,n);await t.openEditor(r,{pinned:!0})}};W(QBi);var VPo=/^\.(png|jpg|jpeg|jpe|gif|webp|svg|bmp|ico|mp4|webm|mov)$/i;function YBi(a){return VPo.test(Ts(a))}async function $Bi(a,i){let e=await a.resolve(i),t=[];if(e.children)for(let o of e.children)o.isFile&&YBi(o.resource)&&t.push(o.resource);return t.sort((o,n)=>Be(o).localeCompare(Be(n))),t}function Wwn(a){return a.map(i=>({id:ht(),name:Be(i),mimeType:Py(i.path)??"image/png",uri:i}))}var XBi=class extends z{constructor(){super({id:"workbench.action.openImagesInCarousel",title:P(12390,"Open in Images Preview"),f1:!1,menu:[{id:R.ExplorerContext,group:"navigation",order:25,when:C.and(C.has("config.imageCarousel.explorerContextMenu.enabled"),C.or(gu,C.regex(Ho.Extension.key,VPo)))}]})}async run(i,e){let t=i.get(Qa),o=i.get(ge),n=i.get(ie),r=i.get(Ne),s=i.get(Ae),l=t.getContext(!0),c=[],u;try{if(l.length===0){let v;if(A.isUri(e))v=e;else{let b=s.getWorkspace().folders;b.length>0&&(v=b[0].uri)}v&&(c=await $Bi(o,v))}else if(l.length===1&&!l[0].isDirectory&&YBi(l[0].resource)){u=l[0].resource;let b=ai(l[0].resource);c=await $Bi(o,b)}else{let b=new xn;for(let S of l)if(S.isDirectory){let y=await $Bi(o,S.resource);for(let w of y)b.has(w)||(b.add(w),c.push(w))}else YBi(S.resource)&&(b.has(S.resource)||(b.add(S.resource),c.push(S.resource),u||(u=S.resource)))}}catch{r.error(d(12381,null));return}if(c.length===0){r.info(d(12388,null));return}let p=Wwn(c),h=0;if(u){let v=p.findIndex(b=>b.uri?.toString()===u.toString());v>=0&&(h=v)}let g={id:ht(),title:d(12384,null),sections:[{title:"",images:p}]},f=new W9(g,h);await n.openEditor(f,{pinned:!0})}};W(XBi);var A1=new Y("interactiveInputCursorAtBoundary","none"),QP={interactiveWindowAlwaysScrollOnNewCell:"interactiveWindow.alwaysScrollOnNewCell",executeWithShiftEnter:"interactiveWindow.executeWithShiftEnter",showExecutionHint:"interactiveWindow.showExecutionHint"};var U$=class extends k{constructor(e,t,o){super();this.editor=e;this.configurationService=t;this.keybindingService=o;this.ariaLabel="";this._register(this.editor.onDidChangeConfiguration(r=>{this.domNode&&r.hasChanged(59)&&this.editor.applyFontInfo(this.domNode)}));let n=U.debounce(this.editor.onDidFocusEditorText,()=>{},500);this._register(n(()=>{this.editor.hasTextFocus()&&this.ariaLabel&&t.getValue("accessibility.verbosity.replEditor")&&Er(this.ariaLabel)})),this._register(t.onDidChangeConfiguration(r=>{r.affectsConfiguration(QP.executeWithShiftEnter)&&this.setHint()})),this.editor.addContentWidget(this)}static{this.ID="replInput.widget.emptyHint"}getId(){return U$.ID}getPosition(){return{position:{lineNumber:1,column:1},preference:[0]}}getDomNode(){if(!this.domNode){this.domNode=_(".empty-editor-hint"),this.domNode.style.width="max-content",this.domNode.style.paddingLeft="4px",this.setHint(),this._register($(this.domNode,"click",()=>{this.editor.focus()})),this.editor.applyFontInfo(this.domNode);let e=this.editor.getLineHeightForPosition(new ye(1,1));this.domNode.style.lineHeight=e+"px"}return this.domNode}setHint(){if(!this.domNode)return;for(;this.domNode.firstChild;)this.domNode.removeChild(this.domNode.firstChild);let e=_("div.empty-hint-text");e.style.cursor="text",e.style.whiteSpace="nowrap";let t=this.getKeybinding(),o=t?.getLabel();if(t&&o){let n=d(12496,null,o),[r,s]=n.split(o).map(u=>{let p=_("span",void 0,u);return p.style.fontStyle="italic",p});e.appendChild(r),this.label&&this.label.dispose(),this.label=this._register(new ah(e,Ao)),this.label.set(t),this.label.element.style.width="min-content",this.label.element.style.display="inline",e.appendChild(s),this.domNode.append(e);let l=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel(),c=l?d(12497,null,l):d(12498,null);this.ariaLabel=n.concat(c,d(12495,null,"accessibility.verbosity.replEditor"))}}getKeybinding(){let e=this.keybindingService.lookupKeybindings("interactive.execute"),t=this.configurationService.getValue(QP.executeWithShiftEnter),o=(n,r="")=>{let s=n.getDispatchChords(),l=r+"Enter",c=r+"[Enter]";return s.length===1&&(s[0]===l||s[0]===c)};if(t){let n=e.find(r=>o(r,"shift+"));if(n)return n}else{let n=e.find(r=>o(r));if(n||(n=this.keybindingService.lookupKeybindings("python.execInREPLEnter").find(r=>o(r)),n))return n}return e?.[0]}dispose(){super.dispose(),this.editor.removeContentWidget(this),this.label?.dispose()}};U$=I([m(1,B),m(2,Le)],U$);var Vwn="interactiveInputDecoration",Bwn="InteractiveEditorViewState",rdt=8,JBi=10,sdt=8,R1e=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(nZ,e,t,o,n);this._notebookWidget={value:void 0};this._widgetDisposableStore=this._register(new O);this._groupListener=this._register(new ue);this._onDidFocusWidget=this._register(new T);this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new T);this.onDidChangeScroll=this._onDidChangeScroll.event;this._notebookWidgetService=s,this._configurationService=g,this._notebookKernelService=u,this._languageService=p,this._keybindingService=h,this._menuService=f,this._contextMenuService=v,this._editorGroupService=b,this._notebookExecutionStateService=y,this._extensionService=w,this._rootElement=_(".interactive-editor"),this._contextKeyService=this._register(l.createScoped(this._rootElement)),this._contextKeyService.createKey("isCompositeNotebook",!0),this._instantiationService=this._register(r.createChild(new Po([X,this._contextKeyService]))),this._editorOptions=this._computeEditorOptions(),this._register(this._configurationService.onDidChangeConfiguration(x=>{(x.affectsConfiguration("editor")||x.affectsConfiguration("notebook"))&&(this._editorOptions=this._computeEditorOptions())})),this._notebookOptions=r.createInstance(P_,this.window,!0,{cellToolbarInteraction:"hover",globalToolbar:!0,stickyScrollEnabled:!1,dragAndDropEnabled:!1,disableRulers:!0}),this._editorMemento=this.getEditorMemento(b,S,Bwn),this._register(c.registerDecorationType("interactive-decoration",Vwn,{})),this._register(this._keybindingService.onDidUpdateKeybindings(this._updateInputHint,this)),this._register(this._notebookExecutionStateService.onDidChangeExecution(x=>{if(x.type===0&&ze(x.notebook,this._notebookWidget.value?.viewModel?.notebookDocument.uri)){let E=this._notebookWidget.value?.getCellByHandle(x.cellHandle);E&&x.changed?.state&&this._scrollIfNecessary(E)}}))}get onDidFocus(){return this._onDidFocusWidget.event}get inputCellContainerHeight(){return 21+rdt*2+sdt*2}get inputCellEditorHeight(){return 19+sdt*2}createEditor(e){D(e,this._rootElement),this._rootElement.style.position="relative",this._notebookEditorContainer=D(this._rootElement,_(".notebook-editor-container")),this._inputCellContainer=D(this._rootElement,_(".input-cell-container")),this._inputCellContainer.style.position="absolute",this._inputCellContainer.style.height=`${this.inputCellContainerHeight}px`,this._inputFocusIndicator=D(this._inputCellContainer,_(".input-focus-indicator")),this._inputRunButtonContainer=D(this._inputCellContainer,_(".run-button-container")),this._setupRunButtonToolbar(this._inputRunButtonContainer),this._inputEditorContainer=D(this._inputCellContainer,_(".input-editor-container")),this._createLayoutStyles()}_setupRunButtonToolbar(e){let t=this._register(this._menuService.createMenu(R.InteractiveInputExecute,this._contextKeyService));this._runbuttonToolbar=this._register(new Kp(e,this._contextMenuService,{getKeyBinding:r=>this._keybindingService.lookupKeybinding(r.id),actionViewItemProvider:(r,s)=>ta(this._instantiationService,r,s),renderDropdownAsChildElement:!0}));let{primary:o,secondary:n}=xl(t.getActions({shouldForwardArgs:!0}));this._runbuttonToolbar.setActions([...o,...n])}_createLayoutStyles(){this._styleElement=Pr(this._rootElement);let e=[],{codeCellLeftMargin:t,cellRunGutter:o}=this._notebookOptions.getLayoutConfiguration(),{focusIndicator:n}=this._notebookOptions.getDisplayOptions(),r=this._notebookOptions.getCellEditorContainerLeftMargin();e.push(`
			.interactive-editor .input-cell-container {
				padding: ${rdt}px ${JBi}px ${rdt}px ${r}px;
			}
		`),n==="gutter"?e.push(`
				.interactive-editor .input-cell-container:focus-within .input-focus-indicator::before {
					border-color: var(--vscode-notebook-focusedCellBorder) !important;
				}
				.interactive-editor .input-focus-indicator::before {
					border-color: var(--vscode-notebook-inactiveFocusedCellBorder) !important;
				}
				.interactive-editor .input-cell-container .input-focus-indicator {
					display: block;
					top: ${rdt}px;
				}
				.interactive-editor .input-cell-container {
					border-top: 1px solid var(--vscode-notebook-inactiveFocusedCellBorder);
				}
			`):e.push(`
				.interactive-editor .input-cell-container {
					border-top: 1px solid var(--vscode-notebook-inactiveFocusedCellBorder);
				}
				.interactive-editor .input-cell-container .input-focus-indicator {
					display: none;
				}
			`),e.push(`
			.interactive-editor .input-cell-container .run-button-container {
				width: ${o}px;
				left: ${t}px;
				margin-top: ${sdt-2}px;
			}
		`),this._styleElement.textContent=e.join(`
`)}_computeEditorOptions(){let e;this._codeEditorWidget&&(e=this._codeEditorWidget.getModel()?.getLanguageId());let t=io(this._configurationService.getValue("editor",{overrideIdentifier:e})),o=ay(this._configurationService);return Object.freeze({...t,...o,glyphMargin:!0,padding:{top:sdt,bottom:sdt},hover:{enabled:"on"},rulers:[]})}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof Jf)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}_saveEditorViewState(e){if(this._notebookWidget.value&&e instanceof Jf){if(this._notebookWidget.value.isDisposed)return;let t=this._notebookWidget.value.getEditorViewState(),o=this._codeEditorWidget.saveViewState();this._editorMemento.saveEditorState(this.group,e.notebookEditorInput.resource,{notebook:t,input:o})}}_loadNotebookEditorViewState(e){let t=this._editorMemento.loadEditorState(this.group,e.notebookEditorInput.resource);if(t)return t;for(let o of this._editorGroupService.getGroups(1))if(o.activeEditorPane!==this&&o.activeEditorPane===this&&o.activeEditor?.matches(e)){let n=this._notebookWidget.value?.getEditorViewState(),r=this._codeEditorWidget.saveViewState();return{notebook:n,input:r}}}async setInput(e,t,o,n){let r=e.notebookEditorInput;if(this._notebookWidget.value?.onWillHide(),this._codeEditorWidget?.dispose(),this._widgetDisposableStore.clear(),this._notebookWidget=this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget,this.group.id,r,{isReplHistory:!0,isReadOnly:!0,contributions:OQ.getSomeEditorContributions([c$.id,d$.id,GC.id]),menuIds:{notebookToolbar:R.InteractiveToolbar,cellTitleToolbar:R.InteractiveCellTitle,cellDeleteToolbar:R.InteractiveCellDelete,cellInsertToolbar:R.NotebookCellBetween,cellTopInsertToolbar:R.NotebookCellListTop,cellExecuteToolbar:R.InteractiveCellExecute,cellExecutePrimary:void 0},cellEditorContributions:ml.getSomeEditorContributions([mw,Vg.ID,ql.ID,jf.ID,uC.ID]),options:this._notebookOptions,codeWindow:this.window},void 0,this.window),this._codeEditorWidget=this._instantiationService.createInstance(us,this._inputEditorContainer,this._editorOptions,{isSimpleWidget:!1,contributions:ml.getSomeEditorContributions([dw.ID,mw,Vg.ID,Sc.ID,S0.ID,ss.ID,pw.ID,ql.ID,jf.ID,uC.ID,tFe])}),this._lastLayoutDimensions){this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._notebookWidget.value.layout(new di(this._lastLayoutDimensions.dimension.width,this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight),this._notebookEditorContainer);let h=this._notebookOptions.getCellEditorContainerLeftMargin(),g=Math.min(this._lastLayoutDimensions.dimension.height/2,this.inputCellEditorHeight);this._codeEditorWidget.layout(this._validateDimension(this._lastLayoutDimensions.dimension.width-h-JBi,g)),this._inputFocusIndicator.style.height=`${this.inputCellEditorHeight}px`,this._inputCellContainer.style.top=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._inputCellContainer.style.width=`${this._lastLayoutDimensions.dimension.width}px`}await super.setInput(e,t,o,n);let s=await e.resolve();if(this._runbuttonToolbar&&(this._runbuttonToolbar.context=e.resource),s===null)throw new Error("The Interactive Window model could not be resolved");this._notebookWidget.value?.setParentContextKeyService(this._contextKeyService);let l=t?.viewState??this._loadNotebookEditorViewState(e);await this._extensionService.whenInstalledExtensionsRegistered(),await this._notebookWidget.value.setModel(s.notebook,l?.notebook),s.notebook.setCellCollapseDefault(this._notebookOptions.getCellCollapseDefault()),this._notebookWidget.value.setOptions({isReadOnly:!0}),this._widgetDisposableStore.add(this._notebookWidget.value.onDidResizeOutput(h=>{this._scrollIfNecessary(h)})),this._widgetDisposableStore.add(this._notebookWidget.value.onDidFocusWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._notebookOptions.onDidChangeOptions(h=>{(h.compactView||h.focusIndicator)&&(this._styleElement?.remove(),this._createLayoutStyles()),this._lastLayoutDimensions&&this.isVisible()&&this.layout(this._lastLayoutDimensions.dimension,this._lastLayoutDimensions.position),h.interactiveWindowCollapseCodeCells&&s.notebook.setCellCollapseDefault(this._notebookOptions.getCellCollapseDefault())}));let c=this._notebookWidget.value?.activeKernel?.supportedLanguages[0]??e.language??es,u=await e.resolveInput(c);u.setLanguage(c),this._codeEditorWidget.setModel(u),l?.input&&this._codeEditorWidget.restoreViewState(l.input),this._editorOptions=this._computeEditorOptions(),this._codeEditorWidget.updateOptions(this._editorOptions),this._widgetDisposableStore.add(this._codeEditorWidget.onDidFocusEditorWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._codeEditorWidget.onDidContentSizeChange(h=>{h.contentHeightChanged&&this._lastLayoutDimensions&&this._layoutWidgets(this._lastLayoutDimensions.dimension,this._lastLayoutDimensions.position)})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(h=>this._onDidChangeSelection.fire({reason:this._toEditorPaneSelectionChangeReason(h)}))),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(()=>this._onDidChangeSelection.fire({reason:3}))),this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeNotebookAffinity(this._syncWithKernel,this)),this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeSelectedNotebooks(this._syncWithKernel,this)),this._widgetDisposableStore.add(this.themeService.onDidColorThemeChange(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelDecorations(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModel(()=>{this._updateInputHint()})),this._widgetDisposableStore.add(this._configurationService.onDidChangeConfiguration(h=>{h.affectsConfiguration(QP.showExecutionHint)&&this._updateInputHint()}));let p=A1.bindTo(this._contextKeyService);e.resource&&e.historyService.has(e.resource)?p.set("top"):p.set("none"),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(({position:h})=>{let g=this._codeEditorWidget._getViewModel(),f=g.getLineCount(),v=g.getLineLength(f)+1,b=g.coordinatesConverter.convertModelPositionToViewPosition(h),S=b.lineNumber===1&&b.column===1,y=b.lineNumber===f&&b.column===v;S?y?p.set("both"):p.set("top"):y?p.set("bottom"):p.set("none")})),this._widgetDisposableStore.add(u.onDidChangeContent(()=>{let h=u.getValue();if(this.input?.resource){let g=this.input.historyService;g.matchesCurrent(this.input.resource,h)||g.replaceLast(this.input.resource,h)}})),this._widgetDisposableStore.add(this._notebookWidget.value.onDidScroll(()=>this._onDidChangeScroll.fire())),this._syncWithKernel(),this._updateInputHint()}setOptions(e){this._notebookWidget.value?.setOptions(e),super.setOptions(e)}_toEditorPaneSelectionChangeReason(e){switch(e.source){case"api":return 1;case"code.navigation":return 4;case"code.jump":return 5;default:return 2}}_cellAtBottom(e){let t=this._notebookWidget.value?.visibleRanges||[];return this._notebookWidget.value?.getCellIndex(e)===Math.max(...t.map(n=>n.end-1))}_scrollIfNecessary(e){this._notebookWidget.value.getCellIndex(e)===this._notebookWidget.value.getLength()-1&&(this._configurationService.getValue(QP.interactiveWindowAlwaysScrollOnNewCell)||this._cellAtBottom(e))&&this._notebookWidget.value.scrollToBottom()}_syncWithKernel(){let e=this._notebookWidget.value?.textModel,t=this._codeEditorWidget.getModel();if(e&&t){let o=this._notebookKernelService.getMatchingKernel(e),n=o.selected??(o.suggestions.length===1?o.suggestions[0]:void 0)??(o.all.length===1?o.all[0]:void 0);if(n){let r=n.supportedLanguages[0];if(r&&r!=="plaintext"){let s=this._languageService.createById(r).languageId;t.setLanguage(s)}ANe.bindTo(this._contextKeyService).set(n.id)}}}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600);let o=e.height!==this._lastLayoutDimensions?.dimension.height;this._lastLayoutDimensions={dimension:e,position:t},this._notebookWidget.value&&(o&&this._codeEditorWidget&&Sc.get(this._codeEditorWidget)?.cancelSuggestWidget(),this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._layoutWidgets(e,t))}_layoutWidgets(e,t){let o=this._codeEditorWidget.hasModel()?this._codeEditorWidget.getContentHeight():this.inputCellEditorHeight,n=Math.min(e.height/2,o),r=this._notebookOptions.getCellEditorContainerLeftMargin(),s=n+rdt*2;this._notebookEditorContainer.style.height=`${e.height-s}px`,this._notebookWidget.value.layout(e.with(e.width,e.height-s),this._notebookEditorContainer,t),this._codeEditorWidget.layout(this._validateDimension(e.width-r-JBi,n)),this._inputFocusIndicator.style.height=`${o}px`,this._inputCellContainer.style.top=`${e.height-s}px`,this._inputCellContainer.style.width=`${e.width}px`}_validateDimension(e,t){return new di(Math.max(0,e),Math.max(0,t))}_hasConflictingDecoration(){return!!this._codeEditorWidget.getLineDecorations(1)?.find(e=>e.options.beforeContentClassName||e.options.afterContentClassName||e.options.before?.content||e.options.after?.content)}_updateInputHint(){if(!this._codeEditorWidget)return;let e=!this._codeEditorWidget.hasModel()||this._configurationService.getValue(QP.showExecutionHint)===!1||this._codeEditorWidget.getModel().getValueLength()!==0||this._hasConflictingDecoration();!this._hintElement&&!e?this._hintElement=this._instantiationService.createInstance(U$,this._codeEditorWidget):this._hintElement&&e&&(this._hintElement.dispose(),this._hintElement=void 0)}getScrollPosition(){return{scrollTop:this._notebookWidget.value?.scrollTop??0,scrollLeft:0}}setScrollPosition(e){this._notebookWidget.value?.setScrollTop(e.scrollTop)}focus(){super.focus(),this._notebookWidget.value?.onShow(),this._codeEditorWidget.focus()}focusHistory(){this._notebookWidget.value.focus()}setEditorVisible(e){super.setEditorVisible(e),this._groupListener.value=this.group.onWillCloseEditor(t=>this._saveEditorViewState(t.editor)),e||(this._saveEditorViewState(this.input),this.input&&this._notebookWidget.value&&this._notebookWidget.value.onWillHide()),this._updateInputHint()}clearInput(){this._notebookWidget.value&&(this._saveEditorViewState(this.input),this._notebookWidget.value.onWillHide()),this._codeEditorWidget?.dispose(),this._notebookWidget={value:void 0},this._widgetDisposableStore.clear(),super.clearInput()}getControl(){return{notebookEditor:this._notebookWidget.value,activeCodeEditor:this._codeEditorWidget,onDidChangeActiveEditor:U.None}}};R1e=I([m(1,_e),m(2,Pe),m(3,de),m(4,F),m(5,hd),m(6,X),m(7,Qt),m(8,Ql),m(9,Rt),m(10,Le),m(11,B),m(12,Yt),m(13,Xe),m(14,kt),m(15,Gn),m(16,Ns),m(17,lt)],R1e);var Hwn=Oe("repl-editor-label-icon",L.debugLineByLine,d(14760,null)),xw=class extends Ga{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,void 0,"jupyter-notebook",{},o,n,r,s,l,c,u,p,h,g,S,y);this.historyService=f;this._textModelService=v;this.isDisposing=!1;this.isScratchpad=e.scheme==="untitled"&&b.getValue(Ct.InteractiveWindowPromptToSave)!==!0,this.label=t??this.createEditorLabel(e)}static{this.ID="workbench.editorinputs.replEditorInput"}getIcon(){return Hwn}createEditorLabel(e){if(!e)return"REPL";if(e.scheme==="untitled"){let o=new RegExp("Untitled-(\\d+).").exec(e.path);if(o?.length===2)return`REPL - ${o[1]}`}let t=e.path.split("/").pop();return t?`REPL - ${t}`:"REPL"}get typeId(){return xw.ID}get editorId(){return"repl"}getName(){return this.label}get editorInputs(){return[this]}get capabilities(){let e=super.capabilities,t=this.isScratchpad?512:0;return e|2|t}async resolve(){let e=await super.resolve();return e&&this.ensureInputBoxCell(e.notebook),e}ensureInputBoxCell(e){let t=e.cells[e.cells.length-1];(!t||t.cellKind===1||t.outputs.length>0||t.internalMetadata.executionOrder!==void 0)&&e.applyEdits([{editType:1,index:e.cells.length,count:0,cells:[{cellKind:2,language:"python",mime:void 0,outputs:[],source:""}]}],!0,void 0,()=>{},void 0,!1)}async resolveInput(e){if(this.inputModelRef)return this.inputModelRef.object.textEditorModel;let t=e.cells[e.cells.length-1];if(!t)throw new Error("The REPL editor requires at least one cell for the input box.");return this.inputModelRef=await this._textModelService.createModelReference(t.uri),this.inputModelRef.object.textEditorModel}dispose(){this.isDisposing||(this.isDisposing=!0,this.editorModelReference?.object.revert({soft:!0}),this.inputModelRef?.dispose(),super.dispose())}};xw=I([m(2,kn),m(3,Yh),m(4,nn),m(5,nt),m(6,ge),m(7,fr),m(8,lt),m(9,ie),m(10,Gn),m(11,nb),m(12,Z0),m(13,Bt),m(14,B),m(15,Mt),m(16,Pn)],xw);var Uwn="InteractiveEditorViewState",adt=8,ZBi=10,ldt=8,L1e=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(s_e,e,t,o,n);this._accessibilityService=w;this._notebookWidget={value:void 0};this._widgetDisposableStore=this._register(new O);this._groupListener=this._register(new ue);this._onDidFocusWidget=this._register(new T);this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeScroll=this._register(new T);this.onDidChangeScroll=this._onDidChangeScroll.event;this._notebookWidgetService=s,this._configurationService=h,this._notebookKernelService=c,this._languageService=u,this._keybindingService=p,this._menuService=g,this._contextMenuService=f,this._editorGroupService=v,this._extensionService=y,this._rootElement=_(".interactive-editor"),this._contextKeyService=this._register(l.createScoped(this._rootElement)),this._contextKeyService.createKey("isCompositeNotebook",!0),this._instantiationService=this._register(r.createChild(new Po([X,this._contextKeyService]))),this._editorOptions=this._computeEditorOptions(),this._register(this._configurationService.onDidChangeConfiguration(x=>{(x.affectsConfiguration("editor")||x.affectsConfiguration("notebook"))&&(this._editorOptions=this._computeEditorOptions())})),this._notebookOptions=r.createInstance(P_,this.window,!0,{cellToolbarInteraction:"hover",globalToolbar:!0,stickyScrollEnabled:!1,dragAndDropEnabled:!1,disableRulers:!0}),this._editorMemento=this.getEditorMemento(v,b,Uwn),this._register(this._keybindingService.onDidUpdateKeybindings(this._updateInputHint,this)),this._register(S.onDidChangeExecution(x=>{if(x.type===0&&ze(x.notebook,this._notebookWidget.value?.viewModel?.notebookDocument.uri)){let E=this._notebookWidget.value?.getCellByHandle(x.cellHandle);E&&x.changed?.state&&this._scrollIfNecessary(E)}}))}get onDidFocus(){return this._onDidFocusWidget.event}get inputCellContainerHeight(){return 21+adt*2+ldt*2}get inputCellEditorHeight(){return 19+ldt*2}createEditor(e){D(e,this._rootElement),this._rootElement.style.position="relative",this._notebookEditorContainer=D(this._rootElement,_(".notebook-editor-container")),this._inputCellContainer=D(this._rootElement,_(".input-cell-container")),this._inputCellContainer.style.position="absolute",this._inputCellContainer.style.height=`${this.inputCellContainerHeight}px`,this._inputFocusIndicator=D(this._inputCellContainer,_(".input-focus-indicator")),this._inputRunButtonContainer=D(this._inputCellContainer,_(".run-button-container")),this._setupRunButtonToolbar(this._inputRunButtonContainer),this._inputEditorContainer=D(this._inputCellContainer,_(".input-editor-container")),this._createLayoutStyles()}_setupRunButtonToolbar(e){let t=this._register(this._menuService.createMenu(R.ReplInputExecute,this._contextKeyService));this._runbuttonToolbar=this._register(new Kp(e,this._contextMenuService,{getKeyBinding:r=>this._keybindingService.lookupKeybinding(r.id),actionViewItemProvider:(r,s)=>ta(this._instantiationService,r,s),renderDropdownAsChildElement:!0}));let{primary:o,secondary:n}=xl(t.getActions({shouldForwardArgs:!0}));this._runbuttonToolbar.setActions([...o,...n])}_createLayoutStyles(){this._styleElement=Pr(this._rootElement);let e=[],{codeCellLeftMargin:t,cellRunGutter:o}=this._notebookOptions.getLayoutConfiguration(),{focusIndicator:n}=this._notebookOptions.getDisplayOptions(),r=this._notebookOptions.getCellEditorContainerLeftMargin();e.push(`
			.interactive-editor .input-cell-container {
				padding: ${adt}px ${ZBi}px ${adt}px ${r}px;
			}
		`),n==="gutter"?e.push(`
				.interactive-editor .input-cell-container:focus-within .input-focus-indicator::before {
					border-color: var(--vscode-notebook-focusedCellBorder) !important;
				}
				.interactive-editor .input-focus-indicator::before {
					border-color: var(--vscode-notebook-inactiveFocusedCellBorder) !important;
				}
				.interactive-editor .input-cell-container .input-focus-indicator {
					display: block;
					top: ${adt}px;
				}
				.interactive-editor .input-cell-container {
					border-top: 1px solid var(--vscode-notebook-inactiveFocusedCellBorder);
				}
			`):e.push(`
				.interactive-editor .input-cell-container {
					border-top: 1px solid var(--vscode-notebook-inactiveFocusedCellBorder);
				}
				.interactive-editor .input-cell-container .input-focus-indicator {
					display: none;
				}
			`),e.push(`
			.interactive-editor .input-cell-container .run-button-container {
				width: ${o}px;
				left: ${t}px;
				margin-top: ${ldt-2}px;
			}
		`),this._styleElement.textContent=e.join(`
`)}_computeEditorOptions(){let e;this._codeEditorWidget&&(e=this._codeEditorWidget.getModel()?.getLanguageId());let t=io(this._configurationService.getValue("editor",{overrideIdentifier:e})),o=ay(this._configurationService);return Object.freeze({...t,...o,ariaLabel:d(14746,null),glyphMargin:!0,padding:{top:ldt,bottom:ldt},hover:{enabled:"on"},rulers:[]})}saveState(){this._saveEditorViewState(this.input),super.saveState()}getViewState(){let e=this.input;if(e instanceof xw)return this._saveEditorViewState(e),this._loadNotebookEditorViewState(e)}_saveEditorViewState(e){if(this._notebookWidget.value&&e instanceof xw){if(this._notebookWidget.value.isDisposed)return;let t=this._notebookWidget.value.getEditorViewState(),o=this._codeEditorWidget.saveViewState();this._editorMemento.saveEditorState(this.group,e.resource,{notebook:t,input:o})}}_loadNotebookEditorViewState(e){let t=this._editorMemento.loadEditorState(this.group,e.resource);if(t)return t;for(let o of this._editorGroupService.getGroups(1))if(o.activeEditorPane!==this&&o.activeEditorPane===this&&o.activeEditor?.matches(e)){let n=this._notebookWidget.value?.getEditorViewState(),r=this._codeEditorWidget.saveViewState();return{notebook:n,input:r}}}async setInput(e,t,o,n){this._notebookWidget.value?.onWillHide(),this._codeEditorWidget?.dispose(),this._widgetDisposableStore.clear(),this._notebookWidget=this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget,this.group.id,e,{isReplHistory:!0,isReadOnly:!0,contributions:OQ.getSomeEditorContributions([c$.id,d$.id,GC.id]),menuIds:{notebookToolbar:R.InteractiveToolbar,cellTitleToolbar:R.InteractiveCellTitle,cellDeleteToolbar:R.InteractiveCellDelete,cellInsertToolbar:R.NotebookCellBetween,cellTopInsertToolbar:R.NotebookCellListTop,cellExecuteToolbar:R.InteractiveCellExecute,cellExecutePrimary:void 0},cellEditorContributions:ml.getSomeEditorContributions([mw,Vg.ID,ql.ID,jf.ID,uC.ID]),options:this._notebookOptions,codeWindow:this.window},void 0,this.window);let r=["workbench.notebook.cellToolbar","editor.contrib.inlineCompletionsController"],s=roe().cellEditorContributions?.filter(h=>r.indexOf(h.id)===-1);if(this._codeEditorWidget=this._instantiationService.createInstance(us,this._inputEditorContainer,this._editorOptions,{isSimpleWidget:!1,contributions:s}),this._lastLayoutDimensions){this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._notebookWidget.value.layout(new di(this._lastLayoutDimensions.dimension.width,this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight),this._notebookEditorContainer);let h=this._notebookOptions.getCellEditorContainerLeftMargin(),g=Math.min(this._lastLayoutDimensions.dimension.height/2,this.inputCellEditorHeight);this._codeEditorWidget.layout(this._validateDimension(this._lastLayoutDimensions.dimension.width-h-ZBi,g)),this._inputFocusIndicator.style.height=`${this.inputCellEditorHeight}px`,this._inputCellContainer.style.top=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._inputCellContainer.style.width=`${this._lastLayoutDimensions.dimension.width}px`}await super.setInput(e,t,o,n);let l=await e.resolve();if(this._runbuttonToolbar&&(this._runbuttonToolbar.context=e.resource),l===null)throw new Error("The REPL model could not be resolved");this._notebookWidget.value?.setParentContextKeyService(this._contextKeyService);let c=t?.viewState??this._loadNotebookEditorViewState(e);await this._extensionService.whenInstalledExtensionsRegistered(),await this._notebookWidget.value.setModel(l.notebook,c?.notebook,void 0,"repl"),l.notebook.setCellCollapseDefault(this._notebookOptions.getCellCollapseDefault()),this._notebookWidget.value.setOptions({isReadOnly:!0}),this._widgetDisposableStore.add(this._notebookWidget.value.onDidResizeOutput(h=>{this._scrollIfNecessary(h)})),this._widgetDisposableStore.add(this._notebookWidget.value.onDidFocusWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._notebookOptions.onDidChangeOptions(h=>{(h.compactView||h.focusIndicator)&&(this._styleElement?.remove(),this._createLayoutStyles()),this._lastLayoutDimensions&&this.isVisible()&&this.layout(this._lastLayoutDimensions.dimension,this._lastLayoutDimensions.position),h.interactiveWindowCollapseCodeCells&&l.notebook.setCellCollapseDefault(this._notebookOptions.getCellCollapseDefault())}));let u=await e.resolveInput(l.notebook);this._codeEditorWidget.setModel(u),c?.input&&this._codeEditorWidget.restoreViewState(c.input),this._editorOptions=this._computeEditorOptions(),this._codeEditorWidget.updateOptions(this._editorOptions),this._widgetDisposableStore.add(this._codeEditorWidget.onDidFocusEditorWidget(()=>this._onDidFocusWidget.fire())),this._widgetDisposableStore.add(this._codeEditorWidget.onDidContentSizeChange(h=>{h.contentHeightChanged&&this._lastLayoutDimensions&&this._layoutWidgets(this._lastLayoutDimensions.dimension,this._lastLayoutDimensions.position)})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(h=>this._onDidChangeSelection.fire({reason:this._toEditorPaneSelectionChangeReason(h)}))),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(()=>this._onDidChangeSelection.fire({reason:3}))),this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeNotebookAffinity(this._syncWithKernel,this)),this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeSelectedNotebooks(this._syncWithKernel,this)),this._widgetDisposableStore.add(this.themeService.onDidColorThemeChange(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(()=>{this.isVisible()&&this._updateInputHint()})),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelDecorations(()=>{this.isVisible()&&this._updateInputHint()}));let p=A1.bindTo(this._contextKeyService);e.resource&&e.historyService.has(e.resource)?p.set("top"):p.set("none"),this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(({position:h})=>{let g=this._codeEditorWidget._getViewModel(),f=g.getLineCount(),v=g.getLineLength(f)+1,b=g.coordinatesConverter.convertModelPositionToViewPosition(h),S=b.lineNumber===1&&b.column===1,y=b.lineNumber===f&&b.column===v;S?y?p.set("both"):p.set("top"):y?p.set("bottom"):p.set("none")})),this._widgetDisposableStore.add(u.onDidChangeContent(()=>{let h=u.getValue();if(this.input?.resource&&h!==""){let g=this.input.historyService;g.matchesCurrent(this.input.resource,h)||g.replaceLast(this.input.resource,h)}})),this._widgetDisposableStore.add(this._notebookWidget.value.onDidScroll(()=>this._onDidChangeScroll.fire())),this._widgetDisposableStore.add(this._notebookWidget.value.onDidChangeViewCells(this.handleViewCellChange,this)),this._updateInputHint(),this._syncWithKernel()}handleViewCellChange(e){let t=this._notebookWidget.value;if(t)for(let o of e.splices){let[n,r,s]=o;if(s.length){let l=t.viewModel;if(l){this.handleAppend(t,l);break}}}}handleAppend(e,t){this._notebookWidgetService.updateReplContextKey(t.notebookDocument.uri.toString());let o=this._configurationService.getValue("accessibility.replEditor.autoFocusReplExecution");this._accessibilityService.isScreenReaderOptimized()&&(o==="lastExecution"?setTimeout(()=>{let n=t.length-1;if(n>=0){let r=t.viewCells[n];e.focusNotebookCell(r,"container")}},0):o==="input"&&this._codeEditorWidget.focus())}setOptions(e){this._notebookWidget.value?.setOptions(e),super.setOptions(e)}_toEditorPaneSelectionChangeReason(e){switch(e.source){case"api":return 1;case"code.navigation":return 4;case"code.jump":return 5;default:return 2}}_cellAtBottom(e){let t=this._notebookWidget.value?.visibleRanges||[];return this._notebookWidget.value?.getCellIndex(e)===Math.max(...t.map(n=>n.end-1))}_scrollIfNecessary(e){this._notebookWidget.value.getCellIndex(e)===this._notebookWidget.value.getLength()-1&&(this._configurationService.getValue(QP.interactiveWindowAlwaysScrollOnNewCell)||this._cellAtBottom(e))&&this._notebookWidget.value.scrollToBottom()}_syncWithKernel(){let e=this._notebookWidget.value?.textModel,t=this._codeEditorWidget.getModel();if(e&&t){let o=this._notebookKernelService.getMatchingKernel(e),n=o.selected??(o.suggestions.length===1?o.suggestions[0]:void 0)??(o.all.length===1?o.all[0]:void 0);if(n){let r=n.supportedLanguages[0];if(r&&r!=="plaintext"){let s=this._languageService.createById(r).languageId;t.setLanguage(s)}ANe.bindTo(this._contextKeyService).set(n.id)}}}layout(e,t){this._rootElement.classList.toggle("mid-width",e.width<1e3&&e.width>=600),this._rootElement.classList.toggle("narrow-width",e.width<600);let o=e.height!==this._lastLayoutDimensions?.dimension.height;this._lastLayoutDimensions={dimension:e,position:t},this._notebookWidget.value&&(o&&this._codeEditorWidget&&Sc.get(this._codeEditorWidget)?.cancelSuggestWidget(),this._notebookEditorContainer.style.height=`${this._lastLayoutDimensions.dimension.height-this.inputCellContainerHeight}px`,this._layoutWidgets(e,t))}_layoutWidgets(e,t){let o=this._codeEditorWidget.hasModel()?this._codeEditorWidget.getContentHeight():this.inputCellEditorHeight,n=Math.min(e.height/2,o),r=this._notebookOptions.getCellEditorContainerLeftMargin(),s=n+adt*2;this._notebookEditorContainer.style.height=`${e.height-s}px`,this._notebookWidget.value.layout(e.with(e.width,e.height-s),this._notebookEditorContainer,t),this._codeEditorWidget.layout(this._validateDimension(e.width-r-ZBi,n)),this._inputFocusIndicator.style.height=`${o}px`,this._inputCellContainer.style.top=`${e.height-s}px`,this._inputCellContainer.style.width=`${e.width}px`}_validateDimension(e,t){return new di(Math.max(0,e),Math.max(0,t))}_hasConflictingDecoration(){return!!this._codeEditorWidget.getLineDecorations(1)?.find(e=>e.options.beforeContentClassName||e.options.afterContentClassName||e.options.before?.content||e.options.after?.content)}_updateInputHint(){if(!this._codeEditorWidget)return;let e=!this._codeEditorWidget.hasModel()||this._configurationService.getValue(QP.showExecutionHint)===!1||this._codeEditorWidget.getModel().getValueLength()!==0||this._hasConflictingDecoration();!this._hintElement&&!e?this._hintElement=this._instantiationService.createInstance(U$,this._codeEditorWidget):this._hintElement&&e&&(this._hintElement.dispose(),this._hintElement=void 0)}getScrollPosition(){return{scrollTop:this._notebookWidget.value?.scrollTop??0,scrollLeft:0}}setScrollPosition(e){this._notebookWidget.value?.setScrollTop(e.scrollTop)}focus(){super.focus(),this._notebookWidget.value?.onShow(),this._codeEditorWidget.focus()}focusHistory(){this._notebookWidget.value.focus()}setEditorVisible(e){super.setEditorVisible(e),this._groupListener.value=this.group.onWillCloseEditor(t=>this._saveEditorViewState(t.editor)),e||(this._saveEditorViewState(this.input),this.input&&this._notebookWidget.value&&this._notebookWidget.value.onWillHide()),this._updateInputHint()}clearInput(){this._notebookWidget.value&&(this._saveEditorViewState(this.input),this._notebookWidget.value.onWillHide()),this._codeEditorWidget?.dispose(),this._notebookWidget={value:void 0},this._widgetDisposableStore.clear(),super.clearInput()}getControl(){return{notebookEditor:this._notebookWidget.value,activeCodeEditor:this.getActiveCodeEditor(),onDidChangeActiveEditor:U.None}}getActiveCodeEditor(){if(this._codeEditorWidget)return this._codeEditorWidget.hasWidgetFocus()||!this._notebookWidget.value?.activeCodeEditor?this._codeEditorWidget:this._notebookWidget.value.activeCodeEditor}};L1e=I([m(1,_e),m(2,Pe),m(3,de),m(4,F),m(5,hd),m(6,X),m(7,Ql),m(8,Rt),m(9,Le),m(10,B),m(11,Yt),m(12,Xe),m(13,kt),m(14,Gn),m(15,Ns),m(16,lt),m(17,Ai)],L1e);function jE(a){let i=a;return i?.activeCodeEditor instanceof us&&i?.notebookEditor instanceof Lq}var B9=P(12490,"Interactive Window");oe.as(en.EditorPane).registerEditorPane(os.create(R1e,nZ,"Interactive Window"),[new Vt(Jf)]);var M1e=class extends k{constructor(e,t,o,n){super();this.instantiationService=n;e.getContributedNotebookType("interactive")||this._register(e.registerContributedNotebookType("interactive",{providerDisplayName:"Interactive Notebook",displayName:"Interactive",filenamePattern:["*.interactive"],priority:"builtin"})),t.registerEditor(`${Q.vscodeInteractiveInput}:/**`,{id:"vscode-interactive-input",label:"Interactive Editor",priority:"exclusive"},{canSupportResource:s=>s.scheme===Q.vscodeInteractiveInput,singlePerResource:!0},{createEditorInput:({resource:s})=>o.findEditors({resource:s,editorId:"interactive",typeId:Jf.ID},{order:1}).at(0)}),t.registerEditor("*.interactive",{id:"interactive",label:"Interactive Editor",priority:"exclusive"},{canSupportResource:s=>s.scheme===Q.untitled&&Ts(s)===".interactive"||s.scheme===Q.vscodeNotebookCell&&Ts(s)===".interactive",singlePerResource:!0},{createEditorInput:({resource:s,options:l})=>{let c=sn.parse(s),u,p=s;c&&(u={resource:s,options:l},p=c.notebook);let h={...l,cellOptions:u,cellRevealType:void 0,cellSelections:void 0,isReadOnly:void 0,viewState:void 0,indexedCellOptions:void 0};return{editor:eHi(p,this.instantiationService),options:h}},createUntitledEditorInput:({resource:s,options:l})=>{if(!s)throw new Error("Interactive window editors must have a resource name");let c=sn.parse(s),u;c&&(u={resource:s,options:l});let p={...l,cellOptions:u,cellRevealType:void 0,cellSelections:void 0,isReadOnly:void 0,viewState:void 0,indexedCellOptions:void 0};return{editor:eHi(s,this.instantiationService),options:p}}})}static{this.ID="workbench.contrib.interactiveDocument"}};M1e=I([m(0,kn),m(1,il),m(2,ie),m(3,F)],M1e);var P1e=class{constructor(i,e){this._modelService=e;this._registration=i.registerTextModelContentProvider(Q.vscodeInteractiveInput,this)}static{this.ID="workbench.contrib.interactiveInputContentProvider"}dispose(){this._registration.dispose()}async provideTextContent(i){let e=this._modelService.getModel(i);return e||this._modelService.createModel("",null,i,!1)}};P1e=I([m(0,Bt),m(1,_t)],P1e);function eHi(a,i){let e=/\/Interactive-(\d+)/.exec(a.path),t=e&&e[1]?`/InteractiveInput-${e[1]}`:"InteractiveInput",o=A.from({scheme:Q.vscodeInteractiveInput,path:t});return Jf.create(i,a,o)}var A1e=class extends k{constructor(e,t,o){super();this._instantiationService=e;this._workingCopyEditorService=t;this._extensionService=o;this._installHandler()}static{this.ID="workbench.contrib.interactiveWindowWorkingCopyEditorHandler"}handles(e){let t=this._getViewType(e);return!!t&&t==="interactive"}isOpen(e,t){return this.handles(e)?t instanceof Jf&&ze(e.resource,t.resource):!1}createEditor(e){return eHi(e.resource,this._instantiationService)}async _installHandler(){await this._extensionService.whenInstalledExtensionsRegistered(),this._register(this._workingCopyEditorService.registerHandler(this))}_getViewType(e){return E0.parse(e.typeId)?.viewType}};A1e=I([m(0,F),m(1,If),m(2,lt)],A1e);bt(M1e.ID,M1e,vt.BlockRestore);bt(P1e.ID,P1e,{editorTypeId:nZ});bt(A1e.ID,A1e,{editorTypeId:nZ});var aQt=class{static{this.ID=Jf.ID}canSerialize(i){return i instanceof Jf?A.isUri(i.primary.resource)&&A.isUri(i.inputResource):!1}serialize(i){if(this.canSerialize(i))return JSON.stringify({resource:i.primary.resource,inputResource:i.inputResource,name:i.getName(),language:i.language})}deserialize(i,e){let t=Dm(e);if(!t)return;let{resource:o,inputResource:n,name:r,language:s}=t;return!A.isUri(o)||!A.isUri(n)?void 0:Jf.create(i,o,n,r,s)}};oe.as(en.EditorFactory).registerEditorSerializer(aQt.ID,aQt);Ce(Z0,bNt,1);Ce(XDe,vNt,1);W(class extends z{constructor(){super({id:"_interactive.open",title:P(12486,"Open Interactive Window"),f1:!1,category:B9,metadata:{description:d(12487,null),args:[{name:"showOptions",description:"Show Options",schema:{type:"object",properties:{viewColumn:{type:"number",default:-1},preserveFocus:{type:"boolean",default:!0}}}},{name:"resource",description:"Interactive resource Uri",isOptional:!0},{name:"controllerId",description:"Notebook controller Id",isOptional:!0},{name:"title",description:"Notebook editor title",isOptional:!0}]}})}async run(a,i,e,t,o){let n=a.get(ie),r=a.get(kt),s=a.get(Z0),l=a.get(Ql),c=a.get(re),u=a.get(B),p=SE(r,u,typeof i=="number"?i:i?.viewColumn),h={activation:3,preserveFocus:typeof i!="number"?i?.preserveFocus??!1:!1};if(e&&Ts(e)===".interactive"){c.debug("Open interactive window from resource:",e.toString());let x=A.revive(e),E=n.findEditors(x).filter(M=>M.editor instanceof Jf&&M.editor.resource?.toString()===x.toString());if(E.length){c.debug("Find existing interactive window:",e.toString());let M=E[0].editor,N=E[0].groupId,H=(await n.openEditor(M,h,N))?.getControl();return{notebookUri:M.resource,inputUri:M.inputResource,notebookEditorId:H?.notebookEditor?.getId()}}}let g=new Set;n.getEditors(1).forEach(x=>{x.editor.resource&&g.add(x.editor.resource.toString())});let f,v,b=1;do f=A.from({scheme:Q.untitled,path:`/Interactive-${b}.interactive`}),v=A.from({scheme:Q.vscodeInteractiveInput,path:`/InteractiveInput-${b}`}),b++;while(g.has(f.toString()));if(Jf.setName(f,o),c.debug("Open new interactive window:",f.toString(),v.toString()),t){let E=l.getMatchingKernel({uri:f,notebookType:"interactive"}).all.find(M=>M.id===t);E&&l.preselectKernelForNotebook(E,{uri:f,notebookType:"interactive"})}s.clearHistory(f);let S={resource:f,options:h},w=(await n.openEditor(S,p))?.getControl();return c.debug("New interactive window opened. Notebook editor id",w?.notebookEditor?.getId()),{notebookUri:f,inputUri:v,notebookEditorId:w?.notebookEditor?.getId()}}});W(class extends z{constructor(){super({id:"interactive.execute",title:P(12479,"Execute Code"),category:B9,keybinding:[{when:C.and(aI,C.equals("activeEditor","workbench.editor.interactive")),primary:2051,weight:ov},{when:C.and(aI,C.equals("activeEditor","workbench.editor.interactive"),C.equals("config.interactiveWindow.executeWithShiftEnter",!0)),primary:1027,weight:ov},{when:C.and(aI,C.equals("activeEditor","workbench.editor.interactive"),C.equals("config.interactiveWindow.executeWithShiftEnter",!1)),primary:3,weight:ov}],menu:[{id:R.InteractiveInputExecute}],icon:Iq,f1:!1,metadata:{description:"Execute the Contents of the Input Box",args:[{name:"resource",description:"Interactive resource Uri",isOptional:!0}]}})}async run(a,i){let e=a.get(ie),t=a.get(Ka),o=a.get(Z0),n=a.get(hd),r;if(i){let s=A.revive(i),l=e.findEditors(s);for(let c of l)if(c.editor.typeId===Jf.ID){r=(await e.openEditor(c.editor,c.groupId))?.getControl();break}}else r=e.activeEditorPane?.getControl();if(r&&jE(r)&&r.notebookEditor){let s=r.notebookEditor.textModel,l=r.activeCodeEditor?.getModel(),u=r.notebookEditor.activeKernel?.supportedLanguages[0]??es;if(s&&l&&r.activeCodeEditor){let p=s.length,h=l.getValue();if(_c(h))return;let g=fu.get(r.activeCodeEditor);g&&g.acceptSession(),o.replaceLast(s.uri,h),o.addToHistory(s.uri,""),l.setValue("");let f=r.notebookEditor.notebookOptions.getDisplayOptions().interactiveWindowCollapseCodeCells==="fromEditor"?{inputCollapsed:!1,outputCollapsed:!1}:void 0;await t.apply([new rb(s.uri,{editType:1,index:p,count:0,cells:[{cellKind:2,mime:void 0,language:u,source:h,outputs:[],metadata:{},collapseState:f}]})]);let v={start:p,end:p+1};r.notebookEditor.revealCellRangeInView(v),await r.notebookEditor.executeNotebookCells(r.notebookEditor.getCellsInRange({start:p,end:p+1}));let b=n.getNotebookEditor(r.notebookEditor.getId());b&&(b.setSelections([v]),b.setFocus(v))}}}});W(class extends z{constructor(){super({id:"interactive.input.clear",title:P(12484,"Clear the interactive window input editor contents"),category:B9,f1:!1})}async run(a){let e=a.get(ie).activeEditorPane?.getControl();if(e&&jE(e)&&e.notebookEditor){let t=e.notebookEditor.textModel,o=e.activeCodeEditor,n=o?.getModel()?.getFullModelRange();t&&o&&n&&o.executeEdits("",[Qn.replace(n,null)])}}});W(class extends z{constructor(){super({id:"interactive.history.previous",title:P(12482,"Previous value in history"),category:B9,f1:!1,keybinding:{when:C.and(A1.notEqualsTo("bottom"),A1.notEqualsTo("none"),ar.Visible.toNegated()),primary:16,weight:200},precondition:C.and(aI,wr.negate())})}async run(a){let i=a.get(ie),e=a.get(Z0),t=i.activeEditorPane?.getControl();if(t&&jE(t)&&t.notebookEditor){let o=t.notebookEditor.textModel,n=t.activeCodeEditor?.getModel();if(o&&n){let r=e.getPreviousValue(o.uri);r&&n.setValue(r)}}}});W(class extends z{constructor(){super({id:"interactive.history.next",title:P(12481,"Next value in history"),category:B9,f1:!1,keybinding:{when:C.and(A1.notEqualsTo("top"),A1.notEqualsTo("none"),ar.Visible.toNegated()),primary:18,weight:200},precondition:C.and(aI,wr.negate())})}async run(a){let i=a.get(ie),e=a.get(Z0),t=i.activeEditorPane?.getControl();if(t&&jE(t)&&t.notebookEditor){let o=t.notebookEditor.textModel,n=t.activeCodeEditor?.getModel();if(o&&n){let r=e.getNextValue(o.uri);r!==null&&n.setValue(r)}}}});W(class extends z{constructor(){super({id:"interactive.scrollToTop",title:d(12489,null),keybinding:{when:C.equals("activeEditor","workbench.editor.interactive"),primary:2062,mac:{primary:2064},weight:200},category:B9})}async run(a){let e=a.get(ie).activeEditorPane?.getControl();if(e&&jE(e)&&e.notebookEditor){if(e.notebookEditor.getLength()===0)return;e.notebookEditor.revealCellRangeInView({start:0,end:1})}}});W(class extends z{constructor(){super({id:"interactive.scrollToBottom",title:d(12488,null),keybinding:{when:C.equals("activeEditor","workbench.editor.interactive"),primary:2061,mac:{primary:2066},weight:200},category:B9})}async run(a){let e=a.get(ie).activeEditorPane?.getControl();if(e&&jE(e)&&e.notebookEditor){if(e.notebookEditor.getLength()===0)return;let t=e.notebookEditor.getLength();e.notebookEditor.revealCellRangeInView({start:t-1,end:t})}}});W(class extends z{constructor(){super({id:"interactive.input.focus",title:P(12485,"Focus Input Editor"),category:B9,menu:{id:R.CommandPalette,when:CKt}})}async run(a){let i=a.get(ie),e=i.activeEditorPane?.getControl();if(e&&jE(e)&&e.notebookEditor)i.activeEditorPane?.focus();else{let t=i.getEditors(0),o=yt.find(t,n=>n.editor.typeId===Jf.ID);if(o){let n=o.editor,r=o.groupId,l=(await i.openEditor(n,r))?.getControl();l&&jE(l)&&l.notebookEditor&&i.activeEditorPane?.focus()}}}});W(class extends z{constructor(){super({id:"interactive.history.focus",title:P(12480,"Focus History"),category:B9,menu:{id:R.CommandPalette,when:C.equals("activeEditor","workbench.editor.interactive")},keybinding:[{when:C.and(A1.notEqualsTo("bottom"),A1.notEqualsTo("none")),weight:205,primary:2064},{when:C.or(cC,aue),weight:200,primary:2064}],precondition:C.and(aI,wr.negate())})}async run(a){let e=a.get(ie).activeEditorPane?.getControl();e&&jE(e)&&e.notebookEditor&&e.notebookEditor.focus()}});te("interactive.activeCodeBorder",{dark:Vce(AD,AD,"#007acc"),light:Vce(AD,AD,"#007acc"),hcDark:Ei,hcLight:Ei},d(12478,null));te("interactive.inactiveCodeBorder",{dark:Vce(bv,bv,"#37373D"),light:Vce(bv,bv,"#E4E6F1"),hcDark:ob,hcLight:ob},d(12483,null));oe.as($t.Configuration).registerConfiguration({id:"interactiveWindow",order:100,type:"object",properties:{[QP.interactiveWindowAlwaysScrollOnNewCell]:{type:"boolean",default:!0,markdownDescription:d(12491,null)},[Ct.InteractiveWindowPromptToSave]:{type:"boolean",default:!1,markdownDescription:d(12493,null)},[QP.executeWithShiftEnter]:{type:"boolean",default:!1,markdownDescription:d(12492,null),tags:["replExecute"]},[QP.showExecutionHint]:{type:"boolean",default:!0,markdownDescription:d(12494,null),tags:["replExecute"]}}});var BPo=_,N1e=class extends Ja{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o);this.context=e;this.debugService=n;this.configurationService=r;this.commandService=s;this.contextService=l;this.keybindingService=u;this.hoverService=p;this.contextKeyService=h;this.debugOptions=[];this.selected=0;this.providers=[];this.toDispose=[],this.selectBox=new Jw([],-1,c,nC,{ariaLabel:d(10652,null),useCustomDrawn:!BI(this.configurationService)}),this.selectBox.setFocusable(!1),this.toDispose.push(this.selectBox),this.registerListeners()}registerListeners(){this.toDispose.push(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("launch")&&this.updateOptions()})),this.toDispose.push(this.debugService.getConfigurationManager().onDidSelectConfiguration(()=>{this.updateOptions()}))}render(e){this.container=e,e.classList.add("start-debug-action-item"),this.start=D(e,BPo(q.asCSSSelector(e2t)));let t=this.keybindingService.appendKeybinding(this.action.label,this.action.id);this.toDispose.push(this.hoverService.setupManagedHover(yi("mouse"),this.start,t)),this.start.setAttribute("role","button"),this._setAriaLabel(t),this._register(ds.addTarget(this.start));for(let s of[ne.CLICK,Vn.Tap])this.toDispose.push($(this.start,s,()=>{this.start.blur(),this.debugService.state!==1&&this.actionRunner.run(this.action,this.context)}));this.toDispose.push($(this.start,ne.MOUSE_DOWN,s=>{this.action.enabled&&s.button===0&&this.start.classList.add("active")})),this.toDispose.push($(this.start,ne.MOUSE_UP,()=>{this.start.classList.remove("active")})),this.toDispose.push($(this.start,ne.MOUSE_OUT,()=>{this.start.classList.remove("active")})),this.toDispose.push($(this.start,ne.KEY_DOWN,s=>{let l=new mi(s);l.equals(17)&&(this.start.tabIndex=-1,this.selectBox.focus(),l.stopPropagation())})),this.toDispose.push(this.selectBox.onDidSelect(async s=>{let l=this.debugOptions[s.index];(l.handler?await l.handler():!1)?this.selected=s.index:this.selectBox.select(this.selected)}));let o=BPo(".configuration");this.selectBox.render(D(e,o)),this.toDispose.push($(o,ne.KEY_DOWN,s=>{let l=new mi(s);l.equals(15)&&(this.selectBox.setFocusable(!1),this.start.tabIndex=0,this.start.focus(),l.stopPropagation(),l.preventDefault())})),this.container.style.border=`1px solid ${Tt(RF)}`,o.style.borderLeft=`1px solid ${Tt(RF)}`,this.container.style.backgroundColor=Tt(iK);let n=this.debugService.getConfigurationManager(),r=()=>n.getDynamicProviders().then(s=>{s.length!==this.providers.length&&(this.providers=s,this.updateOptions())});this.toDispose.push(n.onDidChangeConfigurationProviders(r)),r(),this.updateOptions()}setActionContext(e){this.context=e}isEnabled(){return!0}focus(e){e?this.selectBox.focus():(this.start.tabIndex=0,this.start.focus())}blur(){this.start.tabIndex=-1,this.selectBox.blur(),this.container.blur()}setFocusable(e){e?this.start.tabIndex=0:(this.start.tabIndex=-1,this.selectBox.setFocusable(!1))}dispose(){this.toDispose=je(this.toDispose),super.dispose()}updateOptions(){this.selected=0,this.debugOptions=[];let e=this.debugService.getConfigurationManager(),t=this.contextService.getWorkbenchState()===3,o,n=[],r=[];e.getAllConfigurations().forEach(({launch:s,name:l,presentation:c})=>{o!==c?.group&&(o=c?.group,this.debugOptions.length&&(this.debugOptions.push({label:GF.text,handler:()=>Promise.resolve(!1)}),n.push(this.debugOptions.length-1),r.push(this.debugOptions.length-1))),l===e.selectedConfiguration.name&&s===e.selectedConfiguration.launch&&(this.selected=this.debugOptions.length);let u=t?`${l} (${s.name})`:l;this.debugOptions.push({label:u,handler:async()=>(await e.selectConfiguration(s,l),!0)})}),e.getRecentDynamicConfigurations().slice(0,3).forEach(({name:s,type:l})=>{l===e.selectedConfiguration.type&&e.selectedConfiguration.name===s&&(this.selected=this.debugOptions.length),this.debugOptions.push({label:s,handler:async()=>(await e.selectConfiguration(void 0,s,void 0,{type:l}),!0)})}),this.debugOptions.length===0&&this.debugOptions.push({label:d(10654,null),handler:async()=>!1}),this.debugOptions.push({label:GF.text,handler:()=>Promise.resolve(!1)}),n.push(this.debugOptions.length-1),r.push(this.debugOptions.length-1),this.providers.forEach(s=>{this.debugOptions.push({label:`${s.label}...`,handler:async()=>{let l=await s.pick();return l?(await e.selectConfiguration(l.launch,l.config.name,l.config,{type:s.type}),!0):!1}})}),e.getLaunches().filter(s=>!s.hidden).forEach(s=>{let l=t?d(10648,null,s.name):d(10649,null);this.debugOptions.push({label:l,handler:async()=>(await this.commandService.executeCommand(Rve,s.uri.toString()),!1)})}),this.selectBox.setOptions(this.debugOptions.map((s,l)=>({text:s.label,isDisabled:n.indexOf(l)!==-1,isSeparator:r.indexOf(l)!==-1})),this.selected)}_setAriaLabel(e){let t=e,o;this.configurationService.getValue("accessibility.verbosity.debug")&&(o=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp",this.contextKeyService)?.getLabel()??void 0),o?t=d(10650,null,t,o):t=d(10651,null,t),this.start.ariaLabel=t}};N1e=I([m(3,Hi),m(4,B),m(5,fe),m(6,Ae),m(7,qn),m(8,Le),m(9,ot),m(10,X)],N1e);var z$=class extends NK{constructor(e,t,o,n,r){super(null,e,[],-1,n,nC,{ariaLabel:d(10653,null),useCustomDrawn:!BI(r)});this.debugService=o;this.configurationService=r;this._register(this.debugService.getViewModel().onDidFocusSession(()=>{let u=this.getSelectedSession();if(u){let p=this.getSessions().indexOf(u);this.select(p)}}));let s=this._register(new O),l=u=>{let p=s.add(new O);p.add(u.onDidChangeName(()=>this.update())),p.add(u.onDidEndAdapter(()=>s.delete(p)))};this._register(this.debugService.onDidNewSession(u=>{l(u),this.update()})),this.getSessions().forEach(l),this._register(this.debugService.onDidEndSession(()=>this.update()));let c=t?this.mapFocusedSessionToSelected(t):void 0;this.update(c)}getActionContext(e,t){return this.getSessions()[t]}update(e){e||(e=this.getSelectedSession());let t=this.getSessions(),o=t.map(n=>{let r=n.getLabel();return n.parentSession?`\xA0\xA0${r}`:r});this.setOptions(o.map(n=>({text:n})),e?t.indexOf(e):void 0)}getSelectedSession(){let e=this.debugService.getViewModel().focusedSession;return e?this.mapFocusedSessionToSelected(e):void 0}getSessions(){let e=this.configurationService.getValue("debug").showSubSessionsInToolBar,t=this.debugService.getModel().getSessions();return e?t:t.filter(o=>!o.parentSession)}mapFocusedSessionToSelected(e){let t=this.configurationService.getValue("debug").showSubSessionsInToolBar;for(;e.parentSession&&!t;)e=e.parentSession;return e}};z$=I([m(2,Hi),m(3,qn),m(4,B)],z$);var lQt=class a{constructor(){this._parsedQueries=[]}static{this.matchQuery=xh}set filterQuery(i){if(this._parsedQueries=[],i=i.trim(),i&&i!==""){let e=wM(i,",").map(t=>t.trim()).filter(t=>!!t.length);for(let t of e)t.startsWith("\\")?this._parsedQueries.push({type:"include",query:t.slice(1)}):t.startsWith("!")?this._parsedQueries.push({type:"exclude",query:t.slice(1)}):this._parsedQueries.push({type:"include",query:t})}}filter(i,e){if(i instanceof bne||i instanceof fO||i instanceof ac)return 1;let t=!1,o=!1,n=i.toString(!0);for(let{type:r,query:s}of this._parsedQueries){if(r==="exclude"&&a.matchQuery(s,n))return!1;r==="include"&&(t=!0,a.matchQuery(s,n)&&(o=!0))}return t?o:typeof e<"u"?e:1}};var NO=_,cdt=class a{static{this.ID="replEvaluationInput"}get templateId(){return a.ID}renderTemplate(i){D(i,NO("span.arrow"+q.asCSSSelector(hyo)));let e=D(i,NO(".expression"));return{label:new ul(e)}}renderElement(i,e,t){let o=i.element;t.label.set(o.value,Wa(i.filterData))}disposeTemplate(i){i.label.dispose()}},H9=class{constructor(i,e){this.expressionRenderer=i;this.instaService=e}static{this.ID="replGroup"}get templateId(){return H9.ID}renderTemplate(i){i.classList.add("group");let e=D(i,NO(".output.expression.value-and-source")),t=D(e,NO("span.label")),o=this.instaService.createInstance(O1e,e);return{label:t,source:o}}renderElement(i,e,t){t.elementDisposable?.dispose();let o=i.element;St(t.label),t.elementDisposable=this.expressionRenderer.renderValue(t.label,o.name,{wasANSI:!0,session:i.element.session}),t.source.setSource(o.sourceData)}disposeTemplate(i){i.elementDisposable?.dispose(),i.source.dispose()}};H9=I([m(1,F)],H9);var ddt=class a{constructor(i){this.expressionRenderer=i}static{this.ID="replEvaluationResult"}get templateId(){return a.ID}renderTemplate(i){let e=D(i,NO(".evaluation-result.expression"));return{value:D(e,NO("span.value")),elementStore:new O}}renderElement(i,e,t){t.elementStore.clear();let o=i.element;t.elementStore.add(this.expressionRenderer.renderValue(t.value,o,{colorize:!0,hover:!1,session:i.element.getSession()}))}disposeTemplate(i){i.elementStore.dispose()}},U9=class{constructor(i,e){this.expressionRenderer=i;this.instaService=e}static{this.ID="outputReplElement"}get templateId(){return U9.ID}renderTemplate(i){let e=Object.create(null);i.classList.add("output");let t=D(i,NO(".output.expression.value-and-source"));return e.container=i,e.countContainer=D(t,NO(".count-badge-wrapper")),e.count=new eb(e.countContainer,{},VI),e.value=D(t,NO("span.value.label")),e.source=this.instaService.createInstance(O1e,t),e.elementDisposable=new O,e}renderElement({element:i},e,t){t.elementDisposable.clear(),this.setElementCount(i,t),t.elementDisposable.add(i.onDidChangeCount(()=>this.setElementCount(i,t))),St(t.value),t.value.className="value";let o=i.expression?.valueLocationReference;t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,i.value,{wasANSI:!0,session:i.session,locationReference:o,hover:!1})),t.value.classList.add(i.severity===wt.Warning?"warn":i.severity===wt.Error?"error":i.severity===wt.Ignore?"ignore":"info"),t.source.setSource(i.sourceData),t.getReplElementSource=()=>i.sourceData}setElementCount(i,e){i.count>=2?(e.count.setCount(i.count),e.countContainer.hidden=!1):e.countContainer.hidden=!0}disposeTemplate(i){i.source.dispose(),i.elementDisposable.dispose(),i.count.dispose()}disposeElement(i,e,t){t.elementDisposable.clear()}};U9=I([m(1,F)],U9);var z9=class extends p1{constructor(e,t,o,n){super(t,o,n);this.expressionRenderer=e}static{this.ID="replVariable"}get templateId(){return z9.ID}renderElement(e,t,o){let n=e.element;o.elementDisposable.clear(),super.renderExpressionElement(n instanceof Dve?n.expression:n,e,o)}renderExpression(e,t,o){let n=e instanceof Dve;if(n||!e.name){t.label.set("");let r=n?e.expression:e;t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,r,{colorize:!0,hover:!1,session:e.getSession()})),t.expression.classList.remove("nested-variable")}else t.elementDisposable.add(this.expressionRenderer.renderVariable(t,e,{showChanged:!0,highlights:o})),t.expression.classList.toggle("nested-variable",tHi(e))}getInputBoxOptions(e){}};z9=I([m(1,Hi),m(2,qn),m(3,ot)],z9);var udt=class a{constructor(i){this.expressionRenderer=i}static{this.ID="rawObject"}get templateId(){return a.ID}renderTemplate(i){i.classList.add("output");let e=D(i,NO(".output.expression")),t=D(e,NO("span.name")),o=new ul(t),n=D(e,NO("span.value"));return{container:i,expression:e,name:t,label:o,value:n,elementStore:new O}}renderElement(i,e,t){t.elementStore.clear();let o=i.element;t.label.set(o.name?`${o.name}:`:"",Wa(i.filterData)),o.name?t.name.textContent=`${o.name}:`:t.name.textContent="",t.elementStore.add(this.expressionRenderer.renderValue(t.value,o.value,{hover:!1,session:i.element.getSession()}))}disposeTemplate(i){i.elementStore.dispose(),i.label.dispose()}};function tHi(a){return a instanceof ac&&(a.parent instanceof fO||a.parent instanceof ac)}var cQt=class extends LK{constructor(e,t){super();this.configurationService=e;this.replOptions=t}getHeight(e){return this.configurationService.getValue("debug").console.wordWrap?super.getHeight(e):this.estimateHeight(e,!0)}estimateHeight(e,t=!1){let o=this.replOptions.replConfiguration.lineHeight,n=s=>s.match(/\n/g)?.length??0;if((s=>typeof s.value=="string")(e)&&!tHi(e)){let s=e.value,l=n(s)+(t?0:Math.floor(s.length/70))+(e instanceof KC?0:1);return Math.max(l,1)*o}return o}getTemplateId(e){return e instanceof ac||e instanceof Dve?z9.ID:e instanceof fO?ddt.ID:e instanceof bne?cdt.ID:e instanceof KC?U9.ID:e instanceof e$?H9.ID:udt.ID}hasDynamicHeight(e){return tHi(e)?!1:e.toString().length>0}};function HPo(a){return typeof a.getReplElements=="function"}var dQt=class{hasChildren(i){return HPo(i)?!0:!!i.hasChildren}getChildren(i){return HPo(i)?Promise.resolve(i.getReplElements()):Promise.resolve(i.getChildren())}},uQt=class{getWidgetAriaLabel(){return d(10972,null)}getAriaLabel(i){return i instanceof ac?d(10976,null,i.name,i.value):i instanceof KC||i instanceof bne||i instanceof fO?i.value+(i instanceof KC&&i.count>1?d(10973,null,i.count):""):i instanceof C$t?d(10975,null,i.name,i.value):i instanceof e$?d(10974,null,i.name):""}},O1e=class extends k{constructor(e,t,o,n){super();this.hoverService=o;this.labelService=n;this.el=D(e,NO(".source")),this._register($(this.el,"click",r=>{r.preventDefault(),r.stopPropagation(),this.source&&this.source.source.openInEditor(t,{startLineNumber:this.source.lineNumber,startColumn:this.source.column,endLineNumber:this.source.lineNumber,endColumn:this.source.column})}))}setSource(e){this.source=e,this.el.textContent=e?`${Jo(e.source.name)}:${e.lineNumber}`:"",this.hover??=this._register(this.hoverService.setupManagedHover(yi("mouse"),this.el,"")),this.hover.update(e?`${this.labelService.getUriLabel(e.source.uri)}:${e.lineNumber}`:"")}};O1e=I([m(1,ie),m(2,ot),m(3,nt)],O1e);var pQt=_,iHi="debug.repl.history",oHi="debug.repl.filterHistory",nHi="debug.repl.filterValue",UPo="replinputdecoration";function F1e(a){a.scrollTop=a.scrollHeight-a.renderHeight}var W1e=new Set,zPo={getId:a=>a.getId()},N1=class extends lW{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){let E=n.get(nHi,1,"");super({...e,filterOptions:{placeholder:d(10935,null),text:E,history:JSON.parse(n.get(oHi,1,"[]"))}},v,p,h,l,u,o,b,r,S);this.debugService=t;this.storageService=n;this.modelService=s;this.configurationService=h;this.textResourcePropertiesService=g;this.editorService=f;this.keybindingService=v;this.languageFeaturesService=w;this.logService=x;this.previousTreeScrollHeight=0;this.styleChangedWhenInvisible=!1;this.modelChangeListener=k.None;this.findIsOpen=!1;this.menu=y.createMenu(R.DebugConsoleContext,l),this._register(this.menu),this.history=this._register(new bJ(new Set(JSON.parse(this.storageService.get(iHi,1,"[]"))),100)),this.filter=new lQt,this.filter.filterQuery=E,this.multiSessionRepl=sIi.bindTo(l),this.replOptions=this._register(this.instantiationService.createInstance(K9,this.id,()=>this.getLocationBasedColors().background)),this._register(this.replOptions.onDidChange(()=>this.onDidStyleChange())),this._register(c.registerDecorationType("repl-decoration",UPo,{})),this.multiSessionRepl.set(this.isMultiSessionView),this.registerListeners()}static{this.REFRESH_DELAY=50}static{this.URI=A.parse(`${Ox}:replinput`)}registerListeners(){this.debugService.getViewModel().focusedSession&&this.onDidFocusSession(this.debugService.getViewModel().focusedSession),this._register(this.debugService.getViewModel().onDidFocusSession(e=>{this.onDidFocusSession(e)})),this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async e=>{e instanceof ac&&this.tree?.hasNode(e)&&(await this.tree.updateChildren(e,!1,!0),await this.tree.expand(e))})),this._register(this.debugService.onWillNewSession(async e=>{let t=this.tree?.getInput();(!t||t.state===0)&&await this.selectSession(e),this.multiSessionRepl.set(this.isMultiSessionView)})),this._register(this.debugService.onDidEndSession(async()=>{await Promise.resolve(),this.multiSessionRepl.set(this.isMultiSessionView)})),this._register(this.themeService.onDidColorThemeChange(()=>{this.refreshReplElements(!1),this.isVisible()&&this.updateInputDecoration()})),this._register(this.onDidChangeBodyVisibility(e=>{if(!e)return;this.model||(this.model=this.modelService.getModel(N1.URI)||this.modelService.createModel("",null,N1.URI,!0));let t=this.debugService.getViewModel().focusedSession;this.tree&&this.tree.getInput()!==t&&this.onDidFocusSession(t),this.setMode(),this.replInput.setModel(this.model),this.updateInputDecoration(),this.refreshReplElements(!0),this.styleChangedWhenInvisible&&(this.styleChangedWhenInvisible=!1,this.tree?.getInput()&&this.tree.updateChildren(void 0,!0,!1),this.onDidStyleChange())})),this._register(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration("debug.console.wordWrap")&&this.tree&&(this.tree.dispose(),this.treeContainer.innerText="",St(this.treeContainer),this.createReplTree()),e.affectsConfiguration("debug.console.acceptSuggestionOnEnter")){let t=this.configurationService.getValue("debug");this.replInput.updateOptions({acceptSuggestionOnEnter:t.console.acceptSuggestionOnEnter==="on"?"on":"off"})}})),this._register(this.editorService.onDidActiveEditorChange(()=>{this.setMode()})),this._register(this.filterWidget.onDidChangeFilterText(()=>{this.filter.filterQuery=this.filterWidget.getFilterText(),this.tree&&(this.tree.refilter(),F1e(this.tree))}))}async onDidFocusSession(e){e&&(W1e.delete(e),this.completionItemProvider?.dispose(),e.capabilities.supportsCompletionsRequest&&(this.completionItemProvider=this.languageFeaturesService.completionProvider.register({scheme:Ox,pattern:"**/replinput",hasAccessToAllModels:!0},{_debugDisplayName:"debugConsole",triggerCharacters:e.capabilities.completionTriggerCharacters||["."],provideCompletionItems:async(t,o,n,r)=>{this.setHistoryNavigationEnablement(!1);let s=this.replInput.getModel();if(s){let l=s.getValue(),c=this.debugService.getViewModel().focusedStackFrame,u=c?c.frameId:void 0,p=await e.completions(u,c?.thread.threadId||0,l,o,r),h=[],g=f=>G.fromPositions(o.delta(0,-f),o);if(p&&p.body&&p.body.targets&&p.body.targets.forEach(f=>{if(f&&f.label){let v,b=f.text||f.label;if(typeof f.selectionStart=="number"){v=4;let y=typeof f.selectionLength=="number"?f.selectionLength:0,w=y>0?"${1:"+b.substring(f.selectionStart,f.selectionStart+y)+"}$0":"$0";b=b.substring(0,f.selectionStart)+w+b.substring(f.selectionStart+y)}let S=f.detail?{label:f.label,description:f.detail}:f.label;h.push({label:S,insertText:b,kind:Kz.fromString(f.type||"property"),filterText:f.start&&f.length?l.substring(f.start,f.start+f.length).concat(f.label):void 0,range:g(f.length||0),sortText:f.sortText,insertTextRules:v})}}),this.configurationService.getValue("debug").console.historySuggestions){let f=this.history.getHistory(),v=String(f.length).length;f.forEach((b,S)=>h.push({label:b,insertText:b,kind:18,range:g(b.length),sortText:"ZZZ"+String(f.length-S).padStart(v,"0")}))}return{suggestions:h}}return Promise.resolve({suggestions:[]})}}))),await this.selectSession()}getFilterStats(){return{total:this.tree?.getNode().children.length??0,filtered:this.tree?.getNode().children.filter(e=>e.visible).length??0}}get isReadonly(){let e=this.tree?.getInput();return!(e&&e.state!==0)}showPreviousValue(){this.isReadonly||this.navigateHistory(!0)}showNextValue(){this.isReadonly||this.navigateHistory(!1)}focusFilter(){this.filterWidget.focus()}openFind(){this.tree?.openFind()}setMode(){if(!this.isVisible())return;let e=this.editorService.activeTextEditorControl;fn(e)&&(this.modelChangeListener.dispose(),this.modelChangeListener=e.onDidChangeModelLanguage(()=>this.setMode()),this.model&&e.hasModel()&&this.model.setLanguage(e.getModel().getLanguageId()))}onDidStyleChange(){if(!this.isVisible()){this.styleChangedWhenInvisible=!0;return}if(this.styleElement){this.replInput.updateOptions({fontSize:this.replOptions.replConfiguration.fontSize,lineHeight:this.replOptions.replConfiguration.lineHeight,fontFamily:this.replOptions.replConfiguration.fontFamily==="default"?Ku.fontFamily:this.replOptions.replConfiguration.fontFamily});let e=this.replInput.getOption(75);this.styleElement.textContent=`
				.repl .repl-input-wrapper .repl-input-chevron {
					line-height: ${e}px
				}

				.repl .repl-input-wrapper .monaco-editor .lines-content {
					background-color: ${this.replOptions.replConfiguration.backgroundColor};
				}
			`;let t=this.replOptions.replConfiguration.fontFamily==="default"?"var(--monaco-monospace-font)":this.replOptions.replConfiguration.fontFamily;this.container.style.setProperty("--vscode-repl-font-family",t),this.container.style.setProperty("--vscode-repl-font-size",`${this.replOptions.replConfiguration.fontSize}px`),this.container.style.setProperty("--vscode-repl-font-size-for-twistie",`${this.replOptions.replConfiguration.fontSizeForTwistie}px`),this.container.style.setProperty("--vscode-repl-line-height",this.replOptions.replConfiguration.cssLineHeight),this.tree?.rerender(),this.bodyContentDimension&&this.layoutBodyContent(this.bodyContentDimension.height,this.bodyContentDimension.width)}}navigateHistory(e){let t=(e?this.history.previous()??this.history.first():this.history.next())??"";this.replInput.setValue(t),Er(t),this.replInput.setPosition({lineNumber:1,column:t.length+1}),this.setHistoryNavigationEnablement(!0)}async selectSession(e){let t=this.tree?.getInput();if(!e){let o=this.debugService.getViewModel().focusedSession;o?e=o:(!t||W1e.has(t))&&(e=this.debugService.getModel().getSessions(!0).find(n=>!W1e.has(n)))}if(e&&(this.replElementsChangeListener?.dispose(),this.replElementsChangeListener=e.onDidChangeReplElements(()=>{this.refreshReplElements(e.getReplElements().length===0)}),this.tree&&t!==e)){try{await this.tree.setInput(e)}catch(o){this.logService.error(o)}F1e(this.tree)}this.replInput?.updateOptions({readOnly:this.isReadonly}),this.updateInputDecoration()}async clearRepl(){let e=this.tree?.getInput();e&&(e.removeReplExpressions(),e.state===0&&(W1e.add(e),await this.selectSession(),this.multiSessionRepl.set(this.isMultiSessionView))),this.replInput.focus()}acceptReplInput(){let e=this.tree?.getInput();e&&!this.isReadonly&&(e.addReplExpression(this.debugService.getViewModel().focusedStackFrame,this.replInput.getValue()),F1e(this.tree),this.history.add(this.replInput.getValue()),this.replInput.setValue(""),this.bodyContentDimension&&this.layoutBodyContent(this.bodyContentDimension.height,this.bodyContentDimension.width))}sendReplInput(e){let t=this.tree?.getInput();t&&!this.isReadonly&&(t.addReplExpression(this.debugService.getViewModel().focusedStackFrame,e),F1e(this.tree),this.history.add(e))}getVisibleContent(){let e="";if(this.model&&this.tree){let t=this.textResourcePropertiesService.getEOL(this.model.uri),o=n=>{n.children.forEach(r=>{r.visible&&(e+=r.element.toString().trimRight()+t,!r.collapsed&&r.children.length&&o(r))})};o(this.tree.getNode())}return Hv(e)}layoutBodyContent(e,t){this.bodyContentDimension=new di(t,e);let o=Math.min(this.replInput.getContentHeight(),e);if(this.tree){let n=this.tree.scrollTop+this.tree.renderHeight>=this.tree.scrollHeight,r=e-o;this.tree.getHTMLElement().style.height=`${r}px`,this.tree.layout(r,t),n&&F1e(this.tree)}this.replInputContainer.style.height=`${o}px`,this.replInput.layout({width:t-30,height:o})}collapseAll(){this.tree?.collapseAll()}getDebugSession(){return this.tree?.getInput()}getReplInput(){return this.replInput}getReplDataSource(){return this.replDataSource}getFocusedElement(){return this.tree?.getFocus()?.[0]}focusTree(){this.tree?.domFocus()}async focus(){super.focus(),await Li(0),this.replInput.focus()}createActionViewItem(e){if(e.id===KPo){let t=(this.tree?this.tree.getInput():void 0)??this.debugService.getViewModel().focusedSession;return this.instantiationService.createInstance(cHi,e,t)}return super.createActionViewItem(e)}get isMultiSessionView(){return this.debugService.getModel().getSessions(!0).filter(e=>e.hasSeparateRepl()&&!W1e.has(e)).length>1}get refreshScheduler(){let e=new Set;return new Dt(async()=>{if(!this.tree||!this.tree.getInput()||!this.isVisible())return;await this.tree.updateChildren(void 0,!0,!1,{diffIdentityProvider:zPo});let t=this.tree.getInput();if(t){let r=async s=>{for(let l of s)l instanceof e$&&(l.autoExpand&&!e.has(l.getId())&&(e.add(l.getId()),await this.tree.expand(l)),this.tree.isCollapsed(l)||await r(l.getChildren()))};await r(t.getReplElements())}let{total:o,filtered:n}=this.getFilterStats();this.filterWidget.updateBadge(o===n||o===0?void 0:d(10933,null,n,o))},N1.REFRESH_DELAY)}render(){super.render(),this._register(p_({name:"repl",focusNotifiers:[this,this.filterWidget],focusNextWidget:()=>{let e=this.tree?.getHTMLElement();this.filterWidget.hasFocus()?this.tree?.domFocus():e&&Na(e)&&this.focus()},focusPreviousWidget:()=>{let e=this.tree?.getHTMLElement();this.replInput.hasTextFocus()?this.tree?.domFocus():e&&Na(e)&&this.focusFilter()}}))}renderBody(e){super.renderBody(e),this.container=D(e,pQt(".repl")),this.treeContainer=D(this.container,pQt(`.repl-tree.${xT}`)),this.createReplInput(this.container),this.createReplTree()}createReplTree(){this.replDelegate=new cQt(this.configurationService,this.replOptions);let e=this.configurationService.getValue("debug").console.wordWrap;this.treeContainer.classList.toggle("word-wrap",e);let t=this.instantiationService.createInstance(PP);this.replDataSource=new dQt;let o=this.tree=this.instantiationService.createInstance(Rp,"DebugRepl",this.treeContainer,this.replDelegate,[this.instantiationService.createInstance(z9,t),this.instantiationService.createInstance(U9,t),new cdt,this.instantiationService.createInstance(H9,t),new ddt(t),new udt(t)],this.replDataSource,{filter:this.filter,accessibilityProvider:new uQt,identityProvider:zPo,userSelection:!0,mouseSupport:!1,findWidgetEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:r=>r.toString(!0)},horizontalScrolling:!e,setRowLineHeight:!1,supportDynamicHeights:e,overrideStyles:this.getLocationBasedColors().listOverrideStyles});this._register(o.onDidChangeContentHeight(()=>{o.scrollHeight!==this.previousTreeScrollHeight&&o.scrollTop+o.renderHeight>=this.previousTreeScrollHeight-2&&setTimeout(()=>{F1e(o)},0),this.previousTreeScrollHeight=o.scrollHeight})),this._register(o.onContextMenu(r=>this.onContextMenu(r))),this._register(o.onDidChangeFindOpenState(r=>this.findIsOpen=r));let n;this._register(o.onMouseClick(()=>{if(this.findIsOpen)return;let r=Me(this.treeContainer).getSelection();(!r||r.type!=="Range"||n===r.toString())&&this.replInput.focus(),n=r?r.toString():""})),this.selectSession(),this.styleElement=Pr(this.container,void 0,this._store),this.onDidStyleChange()}createReplInput(e){this.replInputContainer=D(e,pQt(".repl-input-wrapper")),D(this.replInputContainer,pQt(".repl-input-chevron"+q.asCSSSelector(gyo)));let{historyNavigationBackwardsEnablement:t,historyNavigationForwardsEnablement:o}=this._register(JB(this.scopedContextKeyService,this));this.setHistoryNavigationEnablement=l=>{t.set(l),o.set(l)},j0.bindTo(this.scopedContextKeyService).set(!0),this.scopedInstantiationService=this._register(this.instantiationService.createChild(new Po([X,this.scopedContextKeyService])));let n=ay(this.configurationService);n.readOnly=!0,n.suggest={showStatusBar:!0};let r=this.configurationService.getValue("debug");n.acceptSuggestionOnEnter=r.console.acceptSuggestionOnEnter==="on"?"on":"off",n.ariaLabel=this.getAriaLabel(),this.replInput=this.scopedInstantiationService.createInstance(us,this.replInputContainer,n,nNe());let s=-1;this._register(this.replInput.onDidChangeModelContent(()=>{let l=this.replInput.getModel();this.setHistoryNavigationEnablement(!!l&&l.getValue()==="");let c=this.replInput.getContentHeight();c!==s&&(s=c,this.bodyContentDimension&&this.layoutBodyContent(this.bodyContentDimension.height,this.bodyContentDimension.width))})),this._register(this.replInput.onDidFocusEditorText(()=>this.updateInputDecoration())),this._register(this.replInput.onDidBlurEditorText(()=>this.updateInputDecoration())),this._register(Yo(this.replInputContainer,ne.FOCUS,()=>this.replInputContainer.classList.add("synthetic-focus"))),this._register(Yo(this.replInputContainer,ne.BLUR,()=>this.replInputContainer.classList.remove("synthetic-focus")))}getAriaLabel(){let e=d(10927,null);if(!this.configurationService.getValue("accessibility.verbosity.debug"))return e;let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();return t?e=d(10923,null,e,t):e=d(10924,null,e),e}onContextMenu(e){let t=Lu(this.menu.getActions({arg:e.element,shouldForwardArgs:!1}));this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t,getActionsContext:()=>e.element})}refreshReplElements(e){if(this.tree&&this.isVisible()){if(this.refreshScheduler.isScheduled())return;this.refreshScheduler.schedule(e?0:void 0)}}updateInputDecoration(){if(!this.replInput)return;let e=[];if(this.isReadonly&&this.replInput.hasTextFocus()&&!this.replInput.getValue()){let t=bD(Vd,this.themeService.getColorTheme())?.transparent(.4);e.push({range:{startLineNumber:0,endLineNumber:0,startColumn:0,endColumn:1},renderOptions:{after:{contentText:d(10934,null),color:t?t.toString():void 0}}})}this.replInput.setDecorationsByType("repl-decoration",UPo,e)}saveState(){let e=this.history.getHistory();e.length?this.storageService.store(iHi,JSON.stringify(e),1,1):this.storageService.remove(iHi,1);let t=this.filterWidget.getHistory();t.length?this.storageService.store(oHi,JSON.stringify(t),1,1):this.storageService.remove(oHi,1);let o=this.filterWidget.getFilterText();o?this.storageService.store(nHi,o,1,1):this.storageService.remove(nHi,1),super.saveState()}dispose(){this.replInput?.dispose(),this.replElementsChangeListener?.dispose(),this.refreshScheduler.dispose(),this.modelChangeListener.dispose(),super.dispose()}};I([bi],N1.prototype,"refreshScheduler",1),N1=I([m(1,Hi),m(2,F),m(3,de),m(4,Pe),m(5,_t),m(6,X),m(7,Qt),m(8,ji),m(9,Xe),m(10,B),m(11,BL),m(12,ie),m(13,Le),m(14,Je),m(15,ot),m(16,Yt),m(17,Jt),m(18,re)],N1);var K9=class extends k{constructor(e,t,o,n,r){super();this.backgroundColorDelegate=t;this.configurationService=o;this.themeService=n;this.viewDescriptorService=r;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(this.themeService.onDidColorThemeChange(s=>this.update())),this._register(this.viewDescriptorService.onDidChangeLocation(s=>{s.views.some(l=>l.id===e)&&this.update()})),this._register(this.configurationService.onDidChangeConfiguration(s=>{(s.affectsConfiguration("debug.console.lineHeight")||s.affectsConfiguration("debug.console.fontSize")||s.affectsConfiguration("debug.console.fontFamily"))&&this.update()})),this.update()}static{this.lineHeightEm=1.4}get replConfiguration(){return this._replConfig}update(){let e=this.configurationService.getValue("debug").console;this._replConfig={fontSize:e.fontSize,fontFamily:e.fontFamily,lineHeight:e.lineHeight?e.lineHeight:K9.lineHeightEm*e.fontSize,cssLineHeight:e.lineHeight?`${e.lineHeight}px`:`${K9.lineHeightEm}em`,backgroundColor:this.themeService.getColorTheme().getColor(this.backgroundColorDelegate()),fontSizeForTwistie:e.fontSize*K9.lineHeightEm/2-8},this._onDidChange.fire()}};K9=I([m(2,B),m(3,Pe),m(4,ji)],K9);var rHi=class extends Mi{constructor(){super({id:"repl.action.acceptInput",label:P(10918,"Debug Console: Accept Input"),precondition:j0,kbOpts:{kbExpr:me.textInputFocus,primary:3,weight:100}})}run(i,e){Sc.get(e)?.cancelSuggestWidget(),Kre(i.get(Gt))?.acceptReplInput()}},sHi=class extends rr{constructor(){super({viewId:$d,id:"repl.action.filter",title:d(10930,null),precondition:j0,keybinding:[{when:me.textInputFocus,primary:2084,weight:100}]})}runInView(i,e){e.focusFilter()}},aHi=class extends rr{constructor(){super({viewId:$d,id:"repl.action.find",title:d(10931,null),precondition:j0,keybinding:[{when:C.or(j0,C.equals("focusedView","workbench.panel.repl.view")),primary:2596,weight:100}],icon:L.search,menu:[{id:R.ViewTitle,group:"navigation",when:C.equals("view",$d),order:15},{id:R.DebugConsoleContext,group:"z_commands",order:25}]})}runInView(i,e){e.openFind()}},lHi=class extends Mi{constructor(){super({id:"repl.action.copyAll",label:d(10919,null),alias:"Debug Console Copy All",precondition:j0})}run(i,e){let t=i.get(Bi),o=Kre(i.get(Gt));if(o)return t.writeText(o.getVisibleContent())}};ri(rHi);ri(lHi);W(sHi);W(aHi);var cHi=class extends z${getSessions(){return this.debugService.getModel().getSessions(!0).filter(i=>i.hasSeparateRepl()&&!W1e.has(i))}mapFocusedSessionToSelected(i){for(;i.parentSession&&!i.hasSeparateRepl();)i=i.parentSession;return i}};function Kre(a){return a.getActiveViewWithId($d)??void 0}var KPo="workbench.action.debug.selectRepl";W(class extends rr{constructor(){super({id:KPo,viewId:$d,title:d(10932,null),f1:!1,menu:{id:R.ViewTitle,group:"navigation",when:C.and(C.equals("view",$d),sIi),order:20}})}async runInView(a,i,e){let t=a.get(Hi);e&&e.state!==0&&e!==t.getViewModel().focusedSession&&(e=VAt(e,t.getModel().getSessions()),await t.focusStackFrame(void 0,void 0,e,{explicit:!0})),await i.selectSession(e)}});W(class extends rr{constructor(){super({id:"workbench.debug.panel.action.clearReplAction",viewId:$d,title:P(10920,"Clear Console"),metadata:{description:P(10921,"Clears all program output from your debug REPL")},f1:!0,icon:syo,menu:[{id:R.ViewTitle,group:"navigation",when:C.equals("view",$d),order:30},{id:R.DebugConsoleContext,group:"z_commands",order:20}],keybinding:[{primary:0,mac:{primary:2089},weight:201,when:C.equals("focusedView","workbench.panel.repl.view")}]})}runInView(a,i){let e=a.get(br);i.clearRepl(),e.playSignal(tn.clear)}});W(class extends rr{constructor(){super({id:"debug.collapseRepl",title:d(10922,null),viewId:$d,menu:{id:R.DebugConsoleContext,group:"z_commands",order:10}})}runInView(a,i){i.collapseAll(),i.focus()}});W(class extends rr{constructor(){super({id:"debug.replPaste",title:d(10929,null),viewId:$d,precondition:ca.notEqualsTo(HM(0)),menu:{id:R.DebugConsoleContext,group:"2_cutcopypaste",order:30}})}async runInView(a,i){let t=await a.get(Bi).readText();if(t){let o=i.getReplInput();o.setValue(o.getValue().concat(t)),i.focus();let n=o.getModel(),r=n?n.getLineCount():0,s=n?.getLineMaxColumn(r);typeof r=="number"&&typeof s=="number"&&o.setPosition({lineNumber:r,column:s})}}});W(class extends rr{constructor(){super({id:"workbench.debug.action.copyAll",title:d(10926,null),viewId:$d,menu:{id:R.DebugConsoleContext,group:"2_cutcopypaste",order:20}})}async runInView(a,i){await a.get(Bi).writeText(i.getVisibleContent())}});W(class extends z{constructor(){super({id:"debug.replCopy",title:d(10925,null),menu:{id:R.DebugConsoleContext,group:"2_cutcopypaste",order:10}})}async run(a,i){let e=a.get(Bi),t=a.get(Hi),n=zi().getSelection()?.toString();if(n&&n.length>0)return e.writeText(n);if(i){let s=await this.tryEvaluateAndCopy(t,i)||Hv(i.toString());return e.writeText(s)}}async tryEvaluateAndCopy(a,i){if(!(i instanceof fO))return;let e=a.getViewModel().focusedStackFrame,t=a.getViewModel().focusedSession;if(!(!e||!t||!t.capabilities.supportsClipboardContext))try{return(await t.evaluate(i.originalExpression,e.frameId,"clipboard"))?.body.result}catch{return}}});W(class extends z{constructor(){super({id:QEo,category:Ene,title:P(10928,"Focus on Debug Console View")})}async run(a){await(await a.get(Gt).openView($d))?.focus()}});var mQt=class{constructor(){this.priority=100;this.name="replEditorInput";this.type="view";this.when=C.and(aI,Ap.negate())}getProvider(i){let e=i.get(ie);return zwn(e)}};function zwn(a){let i=a.activeEditorPane?.getControl();if(i&&jE(i)&&i.notebookEditor){let e=i.notebookEditor,t=e?.getViewModel();if(e&&t){let o=t.length-1;if(o>=0){let n=t.viewCells[o],r=iOe(t.notebookDocument,n);if(r)return new qp("notebook",{type:"view"},()=>r,()=>{i.activeCodeEditor?.focus()},"accessibility.verbosity.replEditor")}}}}var hQt=class{constructor(){this.priority=105;this.name="REPL Editor Input";this.when=C.and(aI,Ap.negate());this.type="help"}getProvider(i){return GPo(i.get(Qt),Kwn())}};function Kwn(){return[d(14759,null),d(14751,null,"<keybinding:repl.execute>"),d(14750,null),d(14748,null),d(14754,null,"<keybinding:repl.focusLastItemExecuted>"),d(14758,null,"<keybinding:editor.action.accessibleView>"),d(14755,null,"<keybinding:repl.input.focus>")].join(`
`)}var gQt=class{constructor(){this.priority=105;this.name="REPL Editor History";this.when=C.and(aI,Ap);this.type="help"}getProvider(i){return GPo(i.get(Qt),Gwn())}};function Gwn(){return[d(14757,null),d(14752,null,"<keybinding:notebook.cell.edit>"),d(14749,null,"<keybinding:notebook.cell.quitEdit>"),d(14747,null,"<keybinding:editor.action.accessibleView>"),d(14753,null,"<keybinding:notebook.cell.focusInOutput>"),d(14756,null,"<keybinding:repl.input.focus>"),d(14754,null,"<keybinding:repl.focusLastItemExecuted>")].join(`
`)}function GPo(a,i){let e=a.getActiveCodeEditor()||a.getFocusedCodeEditor();if(e)return new qp("replEditor",{type:"help"},()=>i,()=>e.focus(),"accessibility.verbosity.replEditor")}var dHi=class{canSerialize(i){return i.typeId===xw.ID}serialize(i){To(i instanceof xw);let e={resource:i.resource,preferredResource:i.preferredResource,viewType:i.viewType,options:i.options,label:i.getName()};return JSON.stringify(e)}deserialize(i,e){let t=Dm(e);if(!t)return;let{resource:o,viewType:n}=t;return!t||!A.isUri(o)||typeof n!="string"?void 0:i.createInstance(xw,o,t.label)}};oe.as(en.EditorPane).registerEditorPane(os.create(L1e,s_e,"REPL Editor"),[new Vt(xw)]);oe.as(en.EditorFactory).registerEditorSerializer(xw.ID,dHi);var V1e=class extends k{constructor(e,t,o,n,r){super();this.notebookEditorModelResolverService=o;this.instantiationService=n;this.configurationService=r;this.editorInputCache=new dt;t.registerEditor(" ",{id:"repl",label:"repl Editor",priority:"option"},{canSupportResource:s=>e.getNotebookTextModel(s)!==void 0,singlePerResource:!0},{createUntitledEditorInput:async({resource:s,options:l})=>{if(s){let f=this.editorInputCache.get(s);if(f&&!f.isDisposed())return{editor:f,options:l};f&&this.editorInputCache.delete(s)}let c=this.configurationService.getValue(Ct.InteractiveWindowPromptToSave)!==!0,u=await this.notebookEditorModelResolverService.resolve({untitledResource:s},"jupyter-notebook",{scratchpad:c,viewType:"repl"}),p=u.object.notebook.uri;U.once(u.object.notebook.onWillDispose)(()=>{u.dispose()});let h=l?.label??void 0,g=this.instantiationService.createInstance(xw,p,h);return this.editorInputCache.set(p,g),U.once(g.onWillDispose)(()=>this.editorInputCache.delete(p)),{editor:g,options:l}},createEditorInput:async({resource:s,options:l})=>{if(this.editorInputCache.has(s))return{editor:this.editorInputCache.get(s),options:l};let c=l?.label??void 0,u=this.instantiationService.createInstance(xw,s,c);return this.editorInputCache.set(s,u),U.once(u.onWillDispose)(()=>this.editorInputCache.delete(s)),{editor:u,options:l}}})}static{this.ID="workbench.contrib.replDocument"}};V1e=I([m(0,kn),m(1,il),m(2,Yh),m(3,F),m(4,B)],V1e);var B1e=class extends k{constructor(e,t,o,n){super();this.instantiationService=e;this.workingCopyEditorService=t;this.extensionService=o;this.notebookService=n;this._installHandler()}static{this.ID="workbench.contrib.replWorkingCopyEditorHandler"}async handles(e){let t=this._getNotebookType(e);return t?!!t&&t.viewType==="repl"&&await this.notebookService.canResolve(t.notebookType):!1}isOpen(e,t){return this.handles(e)?t instanceof xw&&ze(e.resource,t.resource):!1}createEditor(e){return this.instantiationService.createInstance(xw,e.resource,void 0)}async _installHandler(){await this.extensionService.whenInstalledExtensionsRegistered(),this._register(this.workingCopyEditorService.registerHandler(this))}_getNotebookType(e){return E0.parse(e.typeId)}};B1e=I([m(0,F),m(1,If),m(2,lt),m(3,kn)],B1e);bt(B1e.ID,B1e,vt.BlockRestore);bt(V1e.ID,V1e,vt.BlockRestore);_a.register(new hQt);_a.register(new gQt);W(class extends z{constructor(){super({id:"repl.focusLastItemExecuted",title:P(14744,"Focus Most Recent REPL Execution"),category:"REPL",menu:{id:R.CommandPalette,when:yQ},keybinding:[{primary:Gi(525,525),weight:ov,when:C.or(aI,Ap.negate())}],precondition:yQ})}async run(a,i){let e=a.get(ie),t=e.activeEditorPane?.getControl(),o=a.get(X),n;if(t&&jE(t))n=t.notebookEditor;else{let s=yQ.getValue(o),l=s?A.parse(s):void 0;if(!l)return;let c=e.findEditors(l)[0];if(c){let p=(await e.openEditor(c.editor,c.groupId))?.getControl();p&&jE(p)&&(n=p.notebookEditor)}}let r=n?.getViewModel();if(n&&r){let s=r.length-1;if(s>=0){let l=r.viewCells[s];n.focusNotebookCell(l,"container")}}}});W(class extends z{constructor(){super({id:"repl.input.focus",title:P(14745,"Focus Input Editor"),category:"REPL",menu:{id:R.CommandPalette,when:yQ},keybinding:[{when:C.and(aI,wr),weight:ov,primary:2066},{when:C.and(yQ),weight:205,primary:Gi(526,526)}]})}async run(a){let i=a.get(ie),e=i.activeEditorPane?.getControl(),t=a.get(X);if(e&&jE(e)&&e.notebookEditor)i.activeEditorPane?.focus();else{let o=yQ.getValue(t),n=o?A.parse(o):void 0;if(!n)return;let r=i.findEditors(n)[0];r&&await i.openEditor({resource:n,options:{preserveFocus:!1}},r.groupId)}}});W(class extends z{constructor(){super({id:"repl.execute",title:P(14743,"Execute REPL input"),category:"REPL",keybinding:[{when:C.and(aI,C.equals("activeEditor","workbench.editor.repl"),Ap.negate()),primary:2051,weight:ov},{when:C.and(aI,C.equals("activeEditor","workbench.editor.repl"),C.equals("config.interactiveWindow.executeWithShiftEnter",!0),Ap.negate()),primary:1027,weight:ov},{when:C.and(aI,C.equals("activeEditor","workbench.editor.repl"),C.equals("config.interactiveWindow.executeWithShiftEnter",!1),Ap.negate()),primary:3,weight:ov}],menu:[{id:R.ReplInputExecute}],icon:Iq,f1:!1,metadata:{description:"Execute the Contents of the Input Box",args:[{name:"resource",description:"Interactive resource Uri",isOptional:!0}]}})}async run(a,i){let e=a.get(ie),t=a.get(Ka),o=a.get(Z0),n=a.get(hd),r;if(i){let s=A.revive(i),l=e.findEditors(s);for(let c of l)if(c.editor.typeId===xw.ID){r=(await e.openEditor(c.editor,c.groupId))?.getControl();break}}else r=e.activeEditorPane?.getControl();jE(r)&&qwn(t,o,n,r)}});async function qwn(a,i,e,t){if(t&&t.notebookEditor&&t.activeCodeEditor){let o=t.notebookEditor.textModel,n=t.activeCodeEditor.getModel(),s=t.notebookEditor.activeKernel?.supportedLanguages[0]??es;if(o&&n){let l=o.length-1,c=n.getValue();if(_c(c))return;let u=fu.get(t.activeCodeEditor);u&&u.acceptSession(),i.replaceLast(o.uri,c),i.addToHistory(o.uri,""),n.setValue(""),o.cells[l].resetTextBuffer(n.getTextBuffer());let p=t.notebookEditor.notebookOptions.getDisplayOptions().interactiveWindowCollapseCodeCells==="fromEditor"?{inputCollapsed:!1,outputCollapsed:!1}:void 0;await a.apply([new rb(o.uri,{editType:1,index:l,count:0,cells:[{cellKind:2,mime:void 0,language:s,source:c,outputs:[],metadata:{},collapseState:p}]})]);let h={start:l,end:l+1};t.notebookEditor.revealCellRangeInView(h),await t.notebookEditor.executeNotebookCells(t.notebookEditor.getCellsInRange({start:l,end:l+1}));let g=e.getNotebookEditor(t.notebookEditor.getId());g&&(g.setSelections([h]),g.setFocus(h))}}}_a.register(new mQt);xt.registerCommandAndKeybindingRule({id:"list.find.replInputFocus",weight:201,when:C.equals("view",$d),primary:2596,secondary:[61],handler:a=>{Kre(a.get(Gt))?.openFind()}});var qPo={id:"testing",order:21,title:d(17238,null),type:"object",properties:{"testing.automaticallyOpenPeekView":{description:d(17240,null),enum:["failureAnywhere","failureInVisibleDocument","never"],default:"never",enumDescriptions:[d(17241,null),d(17242,null),d(17243,null)]},"testing.showAllMessages":{description:d(17273,null),type:"boolean",default:!1},"testing.automaticallyOpenPeekViewDuringAutoRun":{description:d(17244,null),type:"boolean",default:!1},"testing.countBadge":{description:d(17245,null),enum:["failed","off","passed","skipped"],enumDescriptions:[d(17246,null),d(17247,null),d(17248,null),d(17249,null)],default:"failed"},"testing.followRunningTest":{description:d(17262,null),type:"boolean",default:!1},"testing.defaultGutterClickAction":{description:d(17253,null),enum:["run","debug","runWithCoverage","contextMenu"],enumDescriptions:[d(17257,null),d(17256,null),d(17255,null),d(17254,null)],default:"run"},"testing.gutterEnabled":{description:d(17263,null),type:"boolean",default:!0},"testing.saveBeforeTest":{description:d(17272,null),type:"boolean",default:!0},"testing.automaticallyOpenTestResults":{enum:["neverOpen","openOnTestStart","openOnTestFailure","openExplorerOnTestStart"],enumDescriptions:[d(17265,null),d(17268,null),d(17267,null),d(17266,null)],default:"openOnTestStart",description:d(17264,null)},"testing.alwaysRevealTestOnStateChange":{markdownDescription:d(17239,null,"`#testing.followRunningTest#`"),type:"boolean",default:!1},"testing.showCoverageInExplorer":{description:d(17274,null),type:"boolean",default:!0},"testing.displayedCoveragePercent":{markdownDescription:d(17258,null),default:"totalCoverage",enum:["totalCoverage","statement","minimum"],enumDescriptions:[d(17261,null),d(17260,null),d(17259,null)]},"testing.coverageBarThresholds":{markdownDescription:d(17250,null),default:{red:0,yellow:60,green:90},properties:{red:{type:"number",minimum:0,maximum:100,default:0},yellow:{type:"number",minimum:0,maximum:100,default:60},green:{type:"number",minimum:0,maximum:100,default:90}}},"testing.coverageToolbarEnabled":{description:d(17252,null),type:"boolean",default:!1},"testing.coverageMinimapEnabled":{description:d(17251,null),type:"boolean",default:!0},"testing.resultsView.layout":{description:d(17269,null),enum:["treeRight","treeLeft"],enumDescriptions:[d(17271,null),d(17270,null)],default:"treeRight"}}};oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"testing.openTesting",migrateFn:a=>[["testing.automaticallyOpenTestResults",{value:a}]]},{key:"testing.automaticallyOpenResults",migrateFn:a=>[["testing.automaticallyOpenTestResults",{value:a}]]}]);var wm=(a,i)=>a.getValue(i),$Po=(a,i)=>vi(a.onDidChangeConfiguration,()=>wm(a,i));var YC=le("testCoverageService"),H1e=class extends k{constructor(e,t,o,n){super();this.viewsService=n;this.lastOpenCts=this._register(new ue);this.selected=De("testCoverage",void 0);this.filterToTest=De("filterToTest",void 0);this.showInline=De("inlineCoverage",!1);let r=hr("testing.coverageToolbarEnabled",!0,o);this._register(cu(co.coverageToolbarEnabled,e,s=>r.read(s))),this._register(cu(co.inlineCoverageEnabled,e,s=>this.showInline.read(s))),this._register(cu(co.isTestCoverageOpen,e,s=>!!this.selected.read(s))),this._register(cu(co.hasPerTestCoverage,e,s=>!yt.isEmpty(this.selected.read(s)?.allPerTestIDs()))),this._register(cu(co.isCoverageFilteredToTest,e,s=>!!this.filterToTest.read(s))),this._register(t.onResultsChanged(s=>{if("completed"in s){let l=s.completed.tasks.find(c=>c.coverage.get());l?this.openCoverage(l,!1):this.closeCoverage()}else if("removed"in s&&this.selected.get()){let l=this.selected.get()?.fromTaskId;s.removed.some(c=>c.tasks.some(u=>u.id===l))&&this.closeCoverage()}}))}async openCoverage(e,t=!0){this.lastOpenCts.value?.cancel();let o=this.lastOpenCts.value=new qe,n=e.coverage.get();n&&(Ki(r=>{this.filterToTest.set(void 0,r),this.selected.set(n,r)}),t&&!o.token.isCancellationRequested&&this.viewsService.openView("workbench.view.testCoverage",!0))}closeCoverage(){this.selected.set(void 0,void 0)}};H1e=I([m(0,X),m(1,Rd),m(2,B),m(3,Gt)],H1e);var jPo=a=>({onDidChange:U.None,value:a}),YP=class a extends k{constructor(e){super();this._value=e;this.changeEmitter=this._register(new T);this.onDidChange=this.changeEmitter.event}get value(){return this._value}set value(e){e!==this._value&&(this._value=e,this.changeEmitter.fire(e))}static stored(e,t){let o=new a(e.get(t));return o._register(e),o._register(o.onDidChange(n=>e.store(n))),o}};var HV=le("testingFilterState"),$wn=/!?@([^ ,:]+)/g,jwn=a=>a.replace(/\s\s+/g," ").trim(),U1e=class extends k{constructor(e){super();this.focusEmitter=this._register(new T);this.termFilterState={};this.globList=[];this.includeTags=new Set;this.excludeTags=new Set;this.text=this._register(new YP(""));this.reveal=De("TestExplorerFilterState.reveal",void 0);this.onDidRequestInputFocus=this.focusEmitter.event;this.selectTestInExplorerEmitter=this._register(new T);this.onDidSelectTestInExplorer=this.selectTestInExplorerEmitter.event;this.fuzzy=this._register(YP.stored(new tI({key:"testHistoryFuzzy",scope:0,target:0},e),!1))}didSelectTestInExplorer(e){this.selectTestInExplorerEmitter.fire(e)}focusInput(){this.focusEmitter.fire()}setText(e){if(e===this.text.value)return;this.termFilterState={},this.globList=[],this.includeTags.clear(),this.excludeTags.clear();let t="",o=0;for(let n of e.matchAll($wn)){let r=n.index+n[0].length,s=n[0],l=Qwn.includes(s);l&&(this.termFilterState[s]=!0);let c=!1;if(e[r]===":"){c=!0,r++;let u=e[r];u!=='"'&&u!=="'"?u=" ":r++;let p="";for(;r<e.length&&e[r]!==u;)e[r]==="\\"?(p+=e[r+1],r+=2):(p+=e[r],r++);n[0].startsWith("!")?this.excludeTags.add(vRe(n[1],p)):this.includeTags.add(vRe(n[1],p)),r++}!l&&!c||(t+=e.slice(o,n.index),o=r)}if(t+=e.slice(o).trim(),t.length)for(let n of wM(t,",").map(r=>r.trim()).filter(r=>!!r.length))n.startsWith("!")?this.globList.push({include:!1,text:n.slice(1).toLowerCase()}):this.globList.push({include:!0,text:n.toLowerCase()});this.text.value=e}isFilteringFor(e){return!!this.termFilterState[e]}toggleFilteringFor(e,t){let o=this.text.value.trim();t!==!1&&!this.termFilterState[e]?this.setText(o?`${o} ${e}`:e):t!==!0&&this.termFilterState[e]&&this.setText(jwn(o.replace(e,"")))}};U1e=I([m(0,de)],U1e);var Qwn=["@failed","@executed","@doc","@openedFiles","@hidden"];var fQt=class extends ZNt{constructor(e,t){super(e);this.expandActual=t;this.testsByUrl=new dt;this.busyProvidersChangeEmitter=new T;this.expandPromises=new WeakMap;this.onBusyProvidersChange=this.busyProvidersChangeEmitter.event;this.changeCollector={add:e=>{if(!e.item.uri)return;let t=this.testsByUrl.get(e.item.uri);t?t.add(e):this.testsByUrl.set(e.item.uri,new Set([e]))},remove:e=>{if(!e.item.uri)return;let t=this.testsByUrl.get(e.item.uri);t&&(t.delete(e),t.size===0&&this.testsByUrl.delete(e.item.uri))}}}get busyProviders(){return this.busyControllerCount}get rootItems(){return this.roots}get all(){return this.getIterator()}get rootIds(){return yt.map(this.roots.values(),e=>e.item.extId)}expand(e,t){let o=this.items.get(e);if(!o)return Promise.resolve();let n=this.expandPromises.get(o);if(n&&n.pendingLvl>=t)return n.prom;let r=this.expandActual(o.item.extId,t),s={doneLvl:n?n.doneLvl:-1,pendingLvl:t,prom:r};return this.expandPromises.set(o,s),r.then(()=>{s.doneLvl=t})}getNodeById(e){return this.items.get(e)}getNodeByUrl(e){return this.testsByUrl.get(e)||yt.empty()}getReviverDiff(){let e=[{op:4,amount:this.pendingRootCount}],t=[this.rootIds];for(;t.length;)for(let o of t.pop()){let n=this.items.get(o);e.push({op:0,item:{controllerId:n.controllerId,expand:n.expand,item:n.item}}),t.push(n.children)}return e}apply(e){let t=this.busyControllerCount;super.apply(e),t!==this.busyControllerCount&&this.busyProvidersChangeEmitter.fire(this.busyControllerCount)}clear(){let e=[];for(let t of this.roots)e.push({op:3,itemId:t.item.extId});return this.roots.clear(),this.items.clear(),e}createItem(e){return{...e,children:new Set}}createChangeCollector(){return this.changeCollector}*getIterator(){let e=new ra;for(e.push(this.rootIds);e.size>0;)for(let t of e.pop()){let o=this.getNodeById(t);yield o,e.push(o.children)}}};var z1e=class extends k{constructor(e){super();this.storageService=e;this.excluded=this._register(YP.stored(new tI({key:"excludedTestItems",scope:1,target:1,serialization:{deserialize:t=>new Set(JSON.parse(t)),serialize:t=>JSON.stringify([...t])}},this.storageService),new Set)),this.onTestExclusionsChanged=this.excluded.onDidChange}get hasAny(){return this.excluded.value.size>0}get all(){return this.excluded.value}toggle(e,t){t!==!0&&this.excluded.value.has(e.item.extId)?this.excluded.value=new Set(yt.filter(this.excluded.value,o=>o!==e.item.extId)):t!==!1&&!this.excluded.value.has(e.item.extId)&&(this.excluded.value=new Set([...this.excluded.value,e.item.extId]))}contains(e){return this.excluded.value.has(e.item.extId)}clear(){this.excluded.value=new Set}};z1e=I([m(0,de)],z1e);var K1e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.editorService=r;this.testProfiles=s;this.notificationService=l;this.configurationService=c;this.testResults=u;this.workspaceTrustRequestService=p;this.testControllers=De("testControllers",new Map);this.testExtHosts=new Set;this.cancelExtensionTestRunEmitter=this._register(new T);this.willProcessDiffEmitter=this._register(new T);this.didProcessDiffEmitter=this._register(new T);this.testRefreshCancellations=new Set;this.uiRunningTests=new Map;this.onWillProcessDiff=this.willProcessDiffEmitter.event;this.onDidProcessDiff=this.didProcessDiffEmitter.event;this.onDidCancelTestRun=this.cancelExtensionTestRunEmitter.event;this.collection=new fQt(o,this.expandTest.bind(this)),this.showInlineOutput=this._register(YP.stored(new tI({key:"inlineTestOutputVisible",scope:1,target:0},n),!0)),this.excluded=t.createInstance(z1e),this.isRefreshingTests=co.isRefreshingTests.bindTo(e),this.activeEditorHasTests=co.activeEditorHasTests.bindTo(e),this._register(cu(co.providerCount,e,g=>this.testControllers.read(g).size));let h=(g,f)=>this._register(cu(g,e,v=>yt.some(this.testControllers.read(v).values(),b=>!!(b.capabilities.read(v)&f))));h(co.canRefreshTests,2),h(co.canGoToRelatedCode,4),h(co.canGoToRelatedTest,8),this._register(r.onDidActiveEditorChange(()=>this.updateEditorContextKeys()))}async expandTest(e,t){await this.testControllers.get().get(ns.fromString(e).controllerId)?.expandTest(e,t)}cancelTestRun(e,t){if(this.cancelExtensionTestRunEmitter.fire({runId:e,taskId:t}),e===void 0)for(let o of this.uiRunningTests.values())o.cancel();else t||this.uiRunningTests.get(e)?.cancel()}async runTests(e,t=Ie.None){let o=[];for(let r of e.tests){let s=o.find(c=>JM(c.profile,r));if(s){s.tests.push(r);continue}let l=this.testProfiles.getDefaultProfileForTest(e.group,r);l&&o.push({profile:l,tests:[r]})}let n={targets:o.map(({profile:r,tests:s})=>({profileId:r.profileId,controllerId:s[0].controllerId,testIds:s.map(l=>l.item.extId)})),group:e.group,exclude:e.exclude?.map(r=>r.item.extId),continuous:e.continuous,preserveFocus:e.preserveFocus};if(n.targets.length===0)for(let r of Lf(e.tests,(s,l)=>s.controllerId===l.controllerId?0:1)){let s=this.testProfiles.getControllerProfiles(r[0].controllerId),l=r.map(c=>({profile:s.find(u=>u.group===e.group&&JM(u,c)),test:c}));for(let c of Lf(l,(u,p)=>u.profile===p.profile?0:1)){let u=c[0].profile;u&&n.targets.push({testIds:c.map(p=>p.test.item.extId),profileId:u.profileId,controllerId:u.controllerId})}}return this.runResolvedTests(n,t)}async startContinuousRun(e,t){if(e.exclude||(e.exclude=[...this.excluded.all]),!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(17341,null)}))return;let r=Lf(e.targets,(s,l)=>s.controllerId.localeCompare(l.controllerId)).map(s=>this.getTestController(s[0].controllerId)?.startContinuousRun(s.map(l=>({excludeExtIds:e.exclude.filter(c=>!l.testIds.includes(c)),profileId:l.profileId,controllerId:l.controllerId,testIds:l.testIds})),t).then(l=>{let c=l.map(u=>u.error).filter(so);c.length&&this.notificationService.error(d(17340,null,c.join(" ")))}));await Promise.all(r)}async runResolvedTests(e,t=Ie.None){e.exclude||(e.exclude=[...this.excluded.all]);let o=this.testResults.createLiveResult(e);if(!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(17341,null)}))return o.markComplete(),o;try{let r=new qe(t);this.uiRunningTests.set(o.id,r);let l=Lf(e.targets,(c,u)=>c.controllerId.localeCompare(u.controllerId)).map(c=>this.getTestController(c[0].controllerId)?.runTests(c.map(u=>({runId:o.id,excludeExtIds:e.exclude.filter(p=>!u.testIds.includes(p)),profileId:u.profileId,controllerId:u.controllerId,testIds:u.testIds})),r.token).then(u=>{let p=u.map(h=>h.error).filter(so);p.length&&this.notificationService.error(d(17340,null,p.join(" ")))}));return await this.saveAllBeforeTest(e),await Promise.all(l),o}finally{this.uiRunningTests.delete(o.id),o.markComplete()}}async provideTestFollowups(e,t){let o=await Promise.all([...this.testExtHosts].map(async r=>({ctrl:r,followups:await r.provideTestFollowups(e,t)}))),n={followups:o.flatMap(({ctrl:r,followups:s})=>s.map(l=>({message:l.title,execute:()=>r.executeTestFollowup(l.id)}))),dispose:()=>{for(let{ctrl:r,followups:s}of o)r.disposeTestFollowups(s.map(l=>l.id))}};return t.isCancellationRequested&&n.dispose(),n}publishDiff(e,t){this.willProcessDiffEmitter.fire(t),this.collection.apply(t),this.updateEditorContextKeys(),this.didProcessDiffEmitter.fire(t)}getTestController(e){return this.testControllers.get().get(e)}async syncTests(){let e=new qe;try{await Promise.all([...this.testControllers.get().values()].map(t=>t.syncTests(e.token)))}finally{e.dispose(!0)}}async refreshTests(e){let t=new qe;this.testRefreshCancellations.add(t),this.isRefreshingTests.set(!0);try{e?await this.getTestController(e)?.refreshTests(t.token):await Promise.all([...this.testControllers.get().values()].map(o=>o.refreshTests(t.token)))}finally{this.testRefreshCancellations.delete(t),this.isRefreshingTests.set(this.testRefreshCancellations.size>0),t.dispose(!0)}}cancelRefreshTests(){for(let e of this.testRefreshCancellations)e.cancel();this.testRefreshCancellations.clear(),this.isRefreshingTests.set(!1)}registerExtHost(e){return this.testExtHosts.add(e),ee(()=>this.testExtHosts.delete(e))}async getTestsRelatedToCode(e,t,o=Ie.None){return(await Promise.all([...this.testExtHosts.values()].map(r=>r.getTestsRelatedToCode(e,t,o)))).flatMap(r=>r.map(s=>this.collection.getNodeById(s))).filter(so)}registerTestController(e,t){return this.testControllers.set(new Map(this.testControllers.get()).set(e,t),void 0),ee(()=>{let o=[];for(let r of this.collection.rootItems)r.controllerId===e&&o.push({op:3,itemId:r.item.extId});this.publishDiff(e,o);let n=new Map(this.testControllers.get());n.delete(e),this.testControllers.set(n,void 0)})}async getCodeRelatedToTest(e,t=Ie.None){return await this.testControllers.get().get(e.controllerId)?.getRelatedCode(e.item.extId,t)||[]}updateEditorContextKeys(){let e=this.editorService.activeEditor?.resource;e?this.activeEditorHasTests.set(!yt.isEmpty(this.collection.getNodeByUrl(e))):this.activeEditorHasTests.set(!1)}async saveAllBeforeTest(e,t=this.configurationService,o=this.editorService){if(e.preserveFocus===!0)return;wm(this.configurationService,"testing.saveBeforeTest")&&await o.saveAll()}};K1e=I([m(0,X),m(1,F),m(2,gt),m(3,de),m(4,ie),m(5,Vu),m(6,Ne),m(7,B),m(8,Rd),m(9,lp)],K1e);var G1e=(a,i)=>{let e=0,t=0,o=0,n=0,r=0;for(let s of i){let l=s.counts;t+=l[6]+l[4],e+=l[3],o+=l[5],n+=l[2],r+=l[1]}return{isRunning:a,passed:e,failed:t,runSoFar:e+t,totalWillBeRun:e+t+r+n,skipped:o}},pdt=({isRunning:a,passed:i,runSoFar:e,totalWillBeRun:t,skipped:o,failed:n})=>{let r=i/e*100;return n>0?r=Math.min(r,99.9):e===0&&(r=0),a?e===0?d(17335,null):o===0?d(17334,null,i,t,r.toPrecision(3)):d(17337,null,i,t,r.toPrecision(3),o):o===0?d(17333,null,i,e,r.toPrecision(3)):d(17336,null,i,e,r.toPrecision(3),o)};var sSe=class extends k{static{this.ID="workbench.contrib.testing.chatAgentTool"}constructor(i,e){super();let t=i.createInstance(aSe);this._register(e.registerTool(aSe.DEFINITION,t)),this._register(e.executeToolSet.addTool(aSe.DEFINITION));let o=i.createInstance(lSe);this._register(e.registerTool(lSe.DEFINITION,o)),this._register(e.executeToolSet.addTool(lSe.DEFINITION))}};sSe=I([m(0,F),m(1,Wn)],sSe);var aSe=class{constructor(i,e,t,o,n){this._testService=i;this._uriIdentityService=e;this._workspaceContextService=t;this._testResultService=o;this._testProfileService=n}static{this.ID="runTests"}static{this.DEFINITION={id:this.ID,toolReferenceName:"runTests",legacyToolReferenceFullNames:["runTests"],displayName:"Run tests",modelDescription:'Runs unit tests in files. Use this tool if the user asks to run tests or when you want to validate changes using unit tests, and prefer using this tool instead of the terminal tool. When possible, always try to provide `files` paths containing the relevant unit tests in order to avoid unnecessarily long test runs. This tool outputs detailed information about the results of the test run. Set mode="coverage" to also collect coverage and optionally provide coverageFiles for focused reporting.',icon:L.beaker,inputSchema:{type:"object",properties:{files:{type:"array",items:{type:"string"},description:"Absolute paths to the test files to run. If not provided, all test files will be run."},testNames:{type:"array",items:{type:"string"},description:"An array of test names to run. Depending on the context, test names defined in code may be strings or the names of functions or classes containing the test cases. If not provided, all tests in the files will be run."},mode:{type:"string",enum:["run","coverage"],description:'Execution mode: "run" (default) runs tests normally, "coverage" collects coverage.'},coverageFiles:{type:"array",items:{type:"string"},description:'When mode="coverage": absolute file paths to include detailed coverage info for. If not provided, a file-level summary of all files with incomplete coverage is shown.'}}},userDescription:d(17296,null),source:wn.Internal,tags:["vscode_editing_with_tests","enable_other_tool_copilot_readFile","enable_other_tool_copilot_listDirectory","enable_other_tool_copilot_findFiles","enable_other_tool_copilot_runTests","enable_other_tool_copilot_runTestsWithCoverage","enable_other_tool_testFailure"]}}async invoke(i,e,t,o){let n=i.parameters,r=n.mode==="coverage"?"coverage":"run",s=r==="coverage"?8:2,l=r==="coverage"&&n.coverageFiles&&n.coverageFiles.length?n.coverageFiles:void 0,c=await this._getFileTestsToRun(n,t),u=await this._getTestCasesToRun(n,c,t);if(!u.length)return{content:[{kind:"text",value:"No tests found in the files. Ensure the correct absolute paths are passed to the tool."}],toolResultError:d(17295,null)};t.report({message:d(17293,null)}),s===8&&(u.some(f=>this._testProfileService.capabilitiesForTest(f.item)&8)||(s=2));let p=await this._captureTestResult(u,s,o);return p?(await this._monitorRunProgress(p,t,o),o.isCancellationRequested?(this._testService.cancelTestRun(p.id),{content:[{kind:"text",value:d(17290,null)}],toolResultMessage:d(17290,null)}):{content:[{kind:"text",value:await Xwn(p,r,l)}],toolResultMessage:pdt(G1e(!1,[p]))}):{content:[{kind:"text",value:"No test run was started. Instruct the user to ensure their test runner is correctly configured"}],toolResultError:d(17294,null)}}async _monitorRunProgress(i,e,t){let o=new O,n=()=>{let s=G1e(!i.completedAt,[i]),l=pdt(s);e.report({message:l,progress:s.runSoFar/s.totalWillBeRun})},r=o.add(new Dt(n,500));return new Promise(s=>{o.add(i.onChange(()=>{r.isScheduled||r.schedule()})),o.add(t.onCancellationRequested(()=>{this._testService.cancelTestRun(i.id),s()})),o.add(i.onComplete(()=>{n(),s()}))}).finally(()=>o.dispose())}async _captureTestResult(i,e,t){let o=new O,n=o.add(new T);return new Promise(r=>{o.add(n.event(()=>{r(void 0)})),o.add(this._testResultService.onResultsChanged(s=>{"started"in s&&o.add(s.started.onNewTask(()=>{o.dispose(),r(s.started)}))})),this._testService.runTests({group:e,tests:i,preserveFocus:!0},t).then(()=>{o.isDisposed||o.add(Zo(()=>n.fire(),5e3))})}).finally(()=>o.dispose())}async _getTestCasesToRun(i,e,t){if(!i.testNames?.length)return e;t.report({message:d(17292,null)});let o=i.testNames.map(s=>s.toLowerCase().trim()),n=[],r=async s=>{let l=s.item.label.toLowerCase().trim();if(o.some(c=>l.includes(c))){n.push(s);return}s.expand===1&&await this._testService.collection.expand(s.item.extId,1),await cet(this._testService,s),await Promise.all([...s.children].map(async c=>{let u=this._testService.collection.getNodeById(c);u&&await r(u)}))};return await Promise.all(e.map(r)),n}async _getFileTestsToRun(i,e){if(!i.files?.length)return[...this._testService.collection.rootItems];e.report({message:d(17291,null)});let t=this._workspaceContextService.getWorkspace().folders.at(0)?.uri,o=i.files.map(r=>Jl(r)?A.file(r):t?A.joinPath(t,r):void 0).filter(so),n=[];for(let r of o)for await(let s of Zme(this._testService,this._uriIdentityService,r,void 0,!1))for(let l of s)n.push(l);return n}prepareToolInvocation(i,e){let t=i.parameters,o=d(17289,null),n=t.files?.map(r=>"`"+Jo(r)+"`");return Promise.resolve({invocationMessage:d(17287,null),confirmationMessages:{title:o,message:n?.length?new he().appendMarkdown(d(17288,null,n.join(", "))):d(17286,null),allowAutoConfirm:!0}})}};aSe=I([m(0,Xs),m(1,gt),m(2,Ae),m(3,Rd),m(4,Vu)],aSe);var lSe=class{constructor(i){this._testResultService=i}static{this.ID="testFailure"}static{this.DEFINITION={id:this.ID,toolReferenceName:"testFailure",legacyToolReferenceFullNames:["copilot_testFailure"],displayName:d(17297,null),modelDescription:"Includes test failure information in the prompt. Use this tool to get the details of test failures from the most recent test run. If there are no failures yet, suggest running tests first.",icon:L.beaker,inputSchema:{type:"object",properties:{}},userDescription:d(17300,null),source:wn.Internal,tags:["vscode_editing_with_tests","enable_other_tool_copilot_readFile","enable_other_tool_copilot_listDirectory","enable_other_tool_copilot_findFiles","enable_other_tool_copilot_runTests"]}}async invoke(i,e,t,o){let n=this._testResultService.results.find(s=>s.tasks.length>0);return n?{content:[{kind:"text",value:await QPo(n)}]}:{content:[{kind:"text",value:"No test failures were found yet, call the runTests tool to run tests and find failures."}]}}prepareToolInvocation(i,e){return Promise.resolve({invocationMessage:d(17298,null),pastTenseMessage:d(17299,null)})}};lSe=I([m(0,Rd)],lSe);async function Xwn(a,i,e){let t=a.counts[6]+a.counts[4],o=`<summary passed=${a.counts[3]} failed=${t} />
`;return t!==0&&(o+=await QPo(a)),i==="coverage"&&(o+=await Jwn(a,e)),o}async function Jwn(a,i){let e="";for(let t of a.tasks){let o=t.coverage.get();if(!o)continue;if(!i||!i.length){e+=Zwn(o);continue}let n=i.map(s=>A.file(s).fsPath),r=new Map;for(let s of o.getAllFiles().values())r.set(s.uri.fsPath,s);for(let s of n){let l=r.get(s);l&&(e+=await eCn(l,s))}}return e}function Zwn(a){let i=[...a.getAllFiles().values()].map(t=>({path:t.uri.fsPath,pct:nte(t.statement,t.branch,t.declaration)*100})).filter(t=>t.pct<100).sort((t,o)=>t.pct-o.pct);if(!i.length)return`<coverageSummary>All files have 100% coverage.</coverageSummary>
`;let e=`<coverageSummary>
`;for(let t of i)e+=`<file path="${t.path}" percent=${t.pct.toFixed(1)} />
`;return e+=`</coverageSummary>
`,e}async function eCn(a,i){let e=nte(a.statement,a.branch,a.declaration)*100,t=`<coverage path="${i}" percent=${e.toFixed(1)} statements=${a.statement.covered}/${a.statement.total}`;a.branch&&(t+=` branches=${a.branch.covered}/${a.branch.total}`),a.declaration&&(t+=` declarations=${a.declaration.covered}/${a.declaration.total}`),t+=`>
`;try{let o=await a.details(),n=[],r=[],s=[];for(let l of o)if(l.type===0){if(!l.count){let c=ye.isIPosition(l.location)?l.location.lineNumber:l.location.startLineNumber;n.push({name:l.name,line:c})}}else{if(!l.count){let c=ye.isIPosition(l.location)?l.location.lineNumber:l.location.startLineNumber,u=ye.isIPosition(l.location)?l.location.lineNumber:l.location.endLineNumber;s.push([c,u])}if(l.branches){for(let c of l.branches)if(!c.count){let u;c.location?u=ye.isIPosition(c.location)?c.location.lineNumber:c.location.startLineNumber:u=ye.isIPosition(l.location)?l.location.lineNumber:l.location.startLineNumber,r.push({line:u,label:c.label})}}}n.length&&(t+="uncovered functions: "+n.map(l=>`${l.name}(L${l.line})`).join(", ")+`
`),r.length&&(t+="uncovered branches: "+r.map(l=>l.label?`L${l.line}(${l.label})`:`L${l.line}`).join(", ")+`
`),s.length&&(t+="uncovered lines: "+tCn(s)+`
`)}catch{}return t+=`</coverage>
`,t}function tCn(a){if(!a.length)return"";a.sort((e,t)=>e[0]-t[0]);let i=[a[0]];for(let e=1;e<a.length;e++){let t=i[i.length-1],[o,n]=a[e];o<=t[1]+1?t[1]=Math.max(t[1],n):i.push([o,n])}return i.map(([e,t])=>e===t?`${e}`:`${e}-${t}`).join(", ")}async function QPo(a){let i="",e=!1;for(let t of a.tests){if(!Xx(t.ownComputedState))continue;let[,...o]=ns.split(t.item.extId),n=o.pop();i+=`<testFailure name=${JSON.stringify(n)} path=${JSON.stringify(o.join(" > "))}>
`;for(let r of t.tasks)for(let s of r.messages.filter(l=>l.type===0)){if(e=!0,s.expected!==void 0&&s.actual!==void 0)i+=`<expectedOutput>
${s.expected}
</expectedOutput>
`,i+=`<actualOutput>
${s.actual}
</actualOutput>
`;else{let l=typeof s.message=="string"?s.message:s.message.value;i+=`<message>
${l}
</message>
`}if(s.stackTrace&&s.stackTrace.length>0)for(let l of s.stackTrace.slice(0,10))l.uri&&l.position?i+=`<stackFrame path="${l.uri.fsPath}" line="${l.position.lineNumber}" col="${l.position.column}" />
`:l.uri?i+=`<stackFrame path="${l.uri.fsPath}">${l.label}</stackFrame>
`:i+=`<stackFrame>${l.label}</stackFrame>
`;s.location&&(i+=`<location path="${s.location.uri.fsPath}" line="${s.location.range.startLineNumber}" col="${s.location.range.startColumn}" />
`)}i+=`</testFailure>
`}if(!e){let t=a.tasks.map(o=>o.output.getRange(0,o.output.length).toString().trim()).join(`
`);t&&(i+=`<output>
${t}
</output>
`)}return i}var uHi="vscode-test-data";var cSe=a=>{let i=a.authority,[e,...t]=a.path.slice(1).split("/");if(t[0]==="message"){let o=Number(t[1]),n=a.query,r=Number(t[2]),s=t[3];if(i==="results")switch(s){case"TestFailureMessage":return{resultId:e,taskIndex:o,testExtId:n,messageIndex:r,type:2};case"ActualOutput":return{resultId:e,taskIndex:o,testExtId:n,messageIndex:r,type:3};case"ExpectedOutput":return{resultId:e,taskIndex:o,testExtId:n,messageIndex:r,type:4};case"message":}}if(t[0]==="output"){let o=a.query,n=Number(t[1]);return o?{resultId:e,taskIndex:n,testExtId:o,type:1}:{resultId:e,taskIndex:n,type:0}}},rL=a=>{let i={scheme:uHi,authority:"results"};if(a.type===0)return A.from({...i,path:["",a.resultId,"output",a.taskIndex].join("/")});let e=(t,...o)=>A.from({...i,query:a.testExtId,path:["",t,"message",...o].join("/")});switch(a.type){case 3:return e(a.resultId,a.taskIndex,a.messageIndex,"ActualOutput");case 4:return e(a.resultId,a.taskIndex,a.messageIndex,"ExpectedOutput");case 2:return e(a.resultId,a.taskIndex,a.messageIndex,"TestFailureMessage");case 1:return A.from({...i,query:a.testExtId,path:["",a.resultId,"output",a.taskIndex].join("/")});default:bs(a,"Invalid test uri")}};var dSe=class{constructor(i,e,t,o){this.languageService=e;this.modelService=t;this.resultService=o;i.registerTextModelContentProvider(uHi,this)}static{this.ID="workbench.contrib.testing.contentProvider"}async provideTextContent(i){let e=this.modelService.getModel(i);if(e&&!e.isDisposed())return e;let t=cSe(i);if(!t)return null;let o=this.resultService.getResult(t.resultId);if(!o)return null;if(t.type===0){let l=o.tasks[t.taskIndex],c=this.modelService.createModel("",null,i,!1),u=f=>c.applyEdits([{range:{startColumn:1,endColumn:1,startLineNumber:1/0,endLineNumber:1/0},text:f}]),p=Ke.concat(l.output.buffers,l.output.length).toString();u(Hv(p));let h=p.length>0,g=new O;return g.add(l.output.onDidWriteData(f=>{h||=f.byteLength>0,u(Hv(f.toString()))})),l.output.endPromise.then(()=>{g.isDisposed||h||(u(d(17301,null)),g.dispose())}),g.add(c.onWillDispose(()=>g.dispose())),c}let n=o?.getStateById(t.testExtId);if(!n)return null;let r,s=null;switch(t.type){case 3:{let l=n.tasks[t.taskIndex].messages[t.messageIndex];l?.type===0&&(r=l.actual);break}case 1:{r="";let l=o.tasks[t.taskIndex].output;for(let c of n.tasks[t.taskIndex].messages)c.type===1&&(r+=Hv(l.getRange(c.offset,c.length).toString()));break}case 4:{let l=n.tasks[t.taskIndex].messages[t.messageIndex];l?.type===0&&(r=l.expected);break}case 2:{let l=n.tasks[t.taskIndex].messages[t.messageIndex];if(!l)break;if(l.type===1){let c=o.tasks[t.taskIndex].output.getRange(l.offset,l.length);r=Hv(c.toString())}else typeof l.message=="string"?r=Hv(l.message):(r=l.message.value,s=this.languageService.createById("markdown"))}}return r===void 0?null:this.modelService.createModel(r,s,i,!1)}};dSe=I([m(0,Bt),m(1,Rt),m(2,_t),m(3,Rd)],dSe);var XP=le("testingContinuousRunService"),q1e=class extends k{constructor(e,t,o,n){super();this.testService=e;this.testProfileService=n;this.changeEmitter=this._register(new T);this.running=new IN;this.onDidChange=this.changeEmitter.event;let r=co.isContinuousModeOn.bindTo(o);this._register(this.onDidChange(()=>{r.set(!!this.running.root.value)})),this.lastRun=this._register(new tI({key:"lastContinuousRunProfileIds",scope:1,target:1,serialization:{deserialize:s=>new Set(JSON.parse(s)),serialize:s=>JSON.stringify([...s])}},t)),this._register(ee(()=>{for(let s of this.running.values())s.handle.dispose()}))}get lastRunProfileIds(){return this.lastRun.get(new Set)}isSpecificallyEnabledFor(e){return this.running.size>0&&this.running.hasKey(ns.fromString(e).path)}isEnabledForAParentOf(e){return!!this.running.root.value||this.running.size>0&&this.running.hasKeyOrParent(ns.fromString(e).path)}isEnabledForProfile({profileId:e,controllerId:t}){for(let o of this.running.values())if(o.profiles.get().some(n=>n.profileId===e&&n.controllerId===t))return!0;return!1}isEnabledForAChildOf(e){return!!this.running.root.value||this.running.size>0&&this.running.hasKeyOrChildren(ns.fromString(e).path)}isEnabled(){return!!this.running.root.value||this.running.size>0}start(e,t){let o=new O,n;if(e instanceof Array)n=De("crProfiles",e);else{let u=()=>this.testProfileService.getGroupDefaultProfiles(e).filter(p=>p.supportsContinuousRun&&(!t||ns.root(t)===p.controllerId));n=De("crProfiles",u()),o.add(this.testProfileService.onDidChange(()=>{if(s.autoSetDefault){let p=u();eo(p,n.get())||n.set(u(),void 0)}}))}let r=t?ns.fromString(t).path:[],s={profiles:n,handle:o,path:r,autoSetDefault:typeof e=="number"},l=this.running.find(r);if(l){o.dispose(),s.autoSetDefault=l.autoSetDefault=!1,l.profiles.set([...new Set([...n.get(),...l.profiles.get()])],void 0),this.changeEmitter.fire(t);return}this.running.insert(r,s);let c=new Ot;o.add(ee(()=>{for(let u of c.values())u.cancel();c.dispose()})),o.add(Gle(u=>n.read(u),({addedValues:u,removedValues:p})=>{for(let h of u){let g=new qe;this.testService.startContinuousRun({continuous:!0,group:h.group,targets:[{testIds:[t??h.controllerId],controllerId:h.controllerId,profileId:h.profileId}]},g.token),c.set(h,g)}for(let h of p)c.get(h)?.cancel(),c.deleteAndDispose(h);this.lastRun.store(new Set([...c.keys()].map(h=>h.profileId)))})),this.changeEmitter.fire(t)}stopProfile({profileId:e,controllerId:t}){let o=[];for(let n of this.running.values()){let r=n.profiles.get(),s=r.filter(l=>l.profileId!==e||l.controllerId!==t);s.length!==r.length&&(s.length===0?o.push(n):n.profiles.set(s,void 0))}for(let n=o.length-1;n>=0;n--)o[n].handle.dispose(),this.running.delete(o[n].path);this.changeEmitter.fire(void 0)}stop(e){let t=[...this.running.deleteRecursive(e?ns.fromString(e).path:[])];for(let o=t.length-1;o>=0;o--)t[o].handle.dispose();this.changeEmitter.fire(e)}};q1e=I([m(0,Xs),m(1,de),m(2,X),m(3,Vu)],q1e);var bQt=class{constructor(){this.value=[]}push(i){let e=Ek(this.value,i,(t,o)=>t.line-o.line);this.value.splice(e<0?~e:e,0,i)}*lines(){if(!this.value.length)return;let i=0,e=this.value[0].line;for(let t=1;t<this.value.length;t++){let o=this.value[t];o.line!==e&&(yield[e,this.value.slice(i,t)],e=o.line,i=t)}yield[e,this.value.slice(i)]}},mdt=le("testingDecorationService");var sL=le("testingPeekOpener");var F1=a=>jn(a.total===0?1:a.covered/a.total,0,1),YPo=[{color:`var(${kF(zce)})`,key:"red"},{color:`var(${kF(h7i)})`,key:"yellow"},{color:`var(${kF(k5)})`,key:"green"}],XPo=(a,i)=>{let e=YPo[0].color,t=a;for(let{key:o,color:n}of YPo){let r=i[o]/100;r&&a>=r&&a-r<t&&(e=n,t=a-r)}return e},iCn=1e-7,$1e=(a,i=2)=>{let e=(a*100).toFixed(i);return a<1-iCn&&e==="100"?`${100-10**-i}%`:`${e}%`},JPo=(a,i)=>{switch(i){case"statement":return F1(a.statement);case"minimum":{let e=F1(a.statement);return a.branch&&(e=Math.min(e,F1(a.branch))),a.declaration&&(e=Math.min(e,F1(a.declaration))),e}case"totalCoverage":return nte(a.statement,a.branch,a.declaration);default:bs(i)}};function SQt(a,i,e){let t=[];for(let n of i.idsFromRoot()){let r=a.getTestById(n.toString());if(!r)break;t.push(r.label)}let o=t.slice(e);return o.length<=1?{label:o[0]??""}:{label:o[o.length-1],description:o.slice(0,-1).join(" \u203A ")}}var Gre;(n=>(n.showingFilterFor=r=>d(16990,null,r),n.clickToChangeFiltering=d(16988,null),n.percentCoverage=(r,s)=>d(16991,null,$1e(r,s)),n.allTests=d(16989,null),n.pickShowCoverage=d(16992,null)))(Gre||={});var ZPo=te("testing.iconFailed",Ok,d(17213,null)),eAo=te("testing.iconErrored",Ok,d(17211,null)),hHi=te("testing.iconPassed",{dark:"#73c991",light:"#73c991",hcDark:"#73c991",hcLight:"#007100"},d(17215,null)),tAo=te("testing.runAction",hHi,d(17232,null)),iAo=te("testing.iconQueued",tK,d(17217,null)),oAo=te("testing.iconUnset","#848484",d(17221,null)),nAo=te("testing.iconSkipped","#848484",d(17219,null)),rAo=te("testing.peekBorder",{dark:$v,light:$v,hcDark:Ei,hcLight:Ei},d(17231,null)),sAo=te("testing.messagePeekBorder",{dark:eh,light:eh,hcDark:Ei,hcLight:Ei},d(17229,null)),aAo=te("testing.peekHeaderBackground",{dark:ni($v,.1),light:ni($v,.1),hcDark:null,hcLight:null},d(17231,null)),lAo=te("testing.messagePeekHeaderBackground",{dark:ni(eh,.1),light:ni(eh,.1),hcDark:null,hcLight:null},d(17230,null)),mHi=te("testing.coveredBackground",{dark:_g,light:_g,hcDark:null,hcLight:null},d(17207,null)),oCn=te("testing.coveredBorder",{dark:ni(mHi,.75),light:ni(mHi,.75),hcDark:Ei,hcLight:Ei},d(17208,null)),bFf=te("testing.coveredGutterBackground",{dark:ni(_g,.6),light:ni(_g,.6),hcDark:k5,hcLight:k5},d(17209,null)),SFf=te("testing.uncoveredBranchBackground",{dark:w5(ni(df,2),Bo),light:w5(ni(df,2),Bo),hcDark:null,hcLight:null},d(17235,null)),IQt=te("testing.uncoveredBackground",{dark:df,light:df,hcDark:null,hcLight:null},d(17233,null)),nCn=te("testing.uncoveredBorder",{dark:ni(IQt,.75),light:ni(IQt,.75),hcDark:Ei,hcLight:Ei},d(17234,null)),IFf=te("testing.uncoveredGutterBackground",{dark:ni(df,1.5),light:ni(df,1.5),hcDark:zce,hcLight:zce},d(17236,null)),gHi=te("testing.coveredMinimapBackground",{dark:ni(_g,.6),light:ni(_g,.6),hcDark:k5,hcLight:k5},d(17210,null)),fHi=te("testing.uncoveredMinimapBackground",{dark:ni(df,1.5),light:ni(df,1.5),hcDark:zce,hcLight:zce},d(17237,null)),yFf=te("testing.coverCountBadgeBackground",Gv,d(17205,null)),wFf=te("testing.coverCountBadgeForeground",gx,d(17206,null)),cAo=te("testing.message.error.badgeBackground",asi,d(17223,null));te("testing.message.error.badgeBorder",cAo,d(17224,null));te("testing.message.error.badgeForeground",ssi,d(17225,null));te("testing.message.error.lineBackground",null,d(17226,null));te("testing.message.info.decorationForeground",ni(Vd,.5),d(17227,null));te("testing.message.info.lineBackground",null,d(17228,null));var dAo={6:eAo,4:ZPo,3:hHi,1:iAo,0:oAo,5:nAo},rCn=te("testing.iconErrored.retired",ni(eAo,.7),d(17212,null)),sCn=te("testing.iconFailed.retired",ni(ZPo,.7),d(17214,null)),aCn=te("testing.iconPassed.retired",ni(hHi,.7),d(17216,null)),lCn=te("testing.iconQueued.retired",ni(iAo,.7),d(17218,null)),cCn=te("testing.iconUnset.retired",ni(oAo,.7),d(17222,null)),dCn=te("testing.iconSkipped.retired",ni(nAo,.7),d(17220,null)),uAo={6:rCn,4:sCn,3:aCn,1:lCn,0:cCn,5:dCn};hs((a,i)=>{let e=a.getColor(Bo);if(i.addRule(`
	.coverage-deco-inline.coverage-deco-hit.coverage-deco-hovered {
		background: ${a.getColor(mHi)?.transparent(1.3)};
		outline-color: ${a.getColor(oCn)?.transparent(2)};
	}
	.coverage-deco-inline.coverage-deco-miss.coverage-deco-hovered {
		background: ${a.getColor(IQt)?.transparent(1.3)};
		outline-color: ${a.getColor(nCn)?.transparent(2)};
	}
		`),e){let t=a.getColor(IQt)?.transparent(2).makeOpaque(e),o=a.getColor(cAo)?.makeOpaque(e);i.addRule(`
			.coverage-deco-branch-miss-indicator::before {
				border-color: ${t?.transparent(1.3)};
				background-color: ${t};
			}
			.monaco-workbench .test-error-content-widget .inner{
				background: ${o};
			}
			.monaco-workbench .test-error-content-widget .inner .arrow svg {
				fill: ${o};
			}
		`)}});var j1e=Oe("test-view-icon",L.beaker,d(17021,null)),vHi=Oe("test-results-icon",L.checklist,d(17008,null)),W1=Oe("testing-run-icon",L.run,d(17011,null)),qre=Oe("testing-rerun-icon",L.debugRerun,d(17007,null)),q9=Oe("testing-run-all-icon",L.runAll,d(17009,null)),uSe=Oe("testing-debug-all-icon",L.debugAltSmall,d(16999,null)),yk=Oe("testing-debug-icon",L.debugAltSmall,d(17000,null)),bHi=Oe("testing-coverage-icon",L.runCoverage,d(16998,null)),yQt=Oe("testing-coverage-all-icon",L.runAllCoverage,d(17010,null)),wQt=Oe("testing-cancel-icon",L.debugStop,d(16995,null)),hdt=Oe("testing-filter",L.filter,d(16993,null)),pAo=Oe("testing-hidden",L.eyeClosed,d(16994,null)),LFf=Oe("testing-show-as-list-icon",L.listTree,d(17012,null)),MFf=Oe("testing-show-as-list-icon",L.listFlat,d(17013,null)),gdt=Oe("testing-update-profiles",L.gear,d(17019,null)),mAo=Oe("testing-refresh-tests",L.refresh,d(17006,null)),fdt=Oe("testing-turn-continuous-run-on",L.eye,d(17017,null)),CQt=Oe("testing-turn-continuous-run-off",L.eyeClosed,d(17016,null)),vdt=Oe("testing-continuous-is-on",L.eye,d(17015,null)),hAo=Oe("testing-cancel-refresh-tests",L.stop,d(16996,null)),bdt=Oe("testing-coverage",L.coverage,d(16997,null)),gAo=Oe("testing-was-covered",L.check,d(17020,null)),fAo=Oe("testing-missing-branch",L.question,d(17003,null)),OO=new Map([[6,Oe("testing-error-icon",L.issues,d(17001,null))],[4,Oe("testing-failed-icon",L.error,d(17002,null))],[3,Oe("testing-passed-icon",L.pass,d(17004,null))],[1,Oe("testing-queued-icon",L.history,d(17005,null))],[2,PT],[5,Oe("testing-skipped-icon",L.debugStepOver,d(17014,null))],[0,Oe("testing-unset-icon",L.circleOutline,d(17018,null))]]);hs((a,i)=>{for(let[e,t]of OO.entries()){let o=dAo[e],n=uAo[e];o&&(i.addRule(`.monaco-workbench ${q.asCSSSelector(t)} {
			color: ${a.getColor(o)} !important;
		}`),n&&i.addRule(`
			.test-explorer .computed-state.retired${q.asCSSSelector(t)},
			.testing-run-glyph.retired${q.asCSSSelector(t)}{
				color: ${a.getColor(n)} !important;
			}
		`))}i.addRule(`
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(W1)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(q9)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(yk)},
		.monaco-editor .glyph-margin-widgets ${q.asCSSSelector(uSe)} {
			color: ${a.getColor(tAo)};
		}
	`)});var K$=class extends k{constructor(e,t,o){super();this.options=e;this.configurationService=t;this.hoverService=o;this.el=new uo(()=>{if(this.options.compact){let e=st(".test-coverage-bars.compact",[st(".tpc@overall"),st(".bar@tpcBar")]);return this.attachHover(e.tpcBar,pCn),e}else{let e=st(".test-coverage-bars",[st(".tpc@overall"),st(".bar@statement"),st(".bar@function"),st(".bar@branch")]);return this.attachHover(e.statement,vAo),this.attachHover(e.function,bAo),this.attachHover(e.branch,SAo),e}});this.visibleStore=this._register(new O);this.customHovers=[]}get visible(){return!!this._coverage}attachHover(e,t){this._register(this.hoverService.setupManagedHover(yi("element"),e,()=>this._coverage&&t(this._coverage)))}setCoverageInfo(e){let t=this.visibleStore;if(!e){this._coverage&&(this._coverage=void 0,this.customHovers.forEach(o=>o.hide()),t.clear());return}if(!this._coverage){let o=this.el.value.root;t.add(ee(()=>o.remove())),this.options.container.appendChild(o),t.add(this.configurationService.onDidChangeConfiguration(n=>{this._coverage&&(n.affectsConfiguration("testing.displayedCoveragePercent")||n.affectsConfiguration("testing.coverageBarThresholds"))&&this.doRender(this._coverage)}))}this._coverage=e,this.doRender(e)}doRender(e){let t=this.el.value,o=this.options.compact?0:2,n=wm(this.configurationService,"testing.coverageBarThresholds"),r=JPo(e,wm(this.configurationService,"testing.displayedCoveragePercent"));this.options.overall!==!1?t.overall.textContent=$1e(r,o):t.overall.style.display="none","tpcBar"in t?kQt(t.tpcBar,r,!1,n):(kQt(t.statement,F1(e.statement),e.statement.total===0,n),kQt(t.function,e.declaration&&F1(e.declaration),e.declaration?.total===0,n),kQt(t.branch,e.branch&&F1(e.branch),e.branch?.total===0,n))}};K$=I([m(1,B),m(2,ot)],K$);var uCn=16,kQt=(a,i,e,t)=>{if(i===void 0){a.style.display="none";return}if(a.style.display="block",a.style.width=`${uCn}px`,a.style.setProperty("--test-bar-width",`${Math.floor(i*16)}px`),e){a.style.color="currentColor",a.style.opacity="0.5";return}a.style.color=XPo(i,t),a.style.opacity="1"},Q1e=nd.NumberFormat(),vAo=a=>d(17024,null,Q1e.value.format(a.statement.covered),Q1e.value.format(a.statement.total),$1e(F1(a.statement))),bAo=a=>a.declaration&&d(17023,null,Q1e.value.format(a.declaration.covered),Q1e.value.format(a.declaration.total),$1e(F1(a.declaration))),SAo=a=>a.branch&&d(17022,null,Q1e.value.format(a.branch.covered),Q1e.value.format(a.branch.total),$1e(F1(a.branch))),pCn=a=>{let i=[vAo(a),bAo(a),SAo(a)].filter(so).join(`

`);return{markdown:new he().appendText(i),markdownNotSupportedFallback:i}},$re=class extends K${constructor(e,t,o,n){super(e,t,o);this.resource=De(this,void 0);let r=$Po(t,"testing.showCoverageInExplorer");this._register(ve(async s=>{let l,c=n.selected.read(s);if(c&&r.read(s)){let u=this.resource.read(s);u&&(l=c.getComputedForUri(u))}this.setCoverageInfo(l)}))}static{this.hasRegistered=!1}static register(){this.hasRegistered||(this.hasRegistered=!0,oe.as("workbench.registry.explorer.fileContributions").register({create(e,t){return e.createInstance($re,{compact:!0,container:t})}}))}setResource(e,t){this.resource.set(e,t)}setCoverageInfo(e){super.setCoverageInfo(e),this.options.container?.classList.toggle("explorer-item-with-test-coverage",this.visible)}};$re=I([m(1,B),m(2,ot),m(3,YC)],$re);var IAo="coverage-deco-hit",SHi="coverage-deco-miss",mCn=d(16985,null),xAo="testing.toggleInlineCoverage",hCn=4,kAo=P(16975,"Go to Next Uncovered Line"),EAo=P(16977,"Go to Previous Uncovered Line"),jre=class extends k{constructor(e,t,o,n,r,s){super();this.editor=e;this.coverage=o;this.log=r;this.displayedStore=this._register(new O);this.hoveredStore=this._register(new O);this.decorationIds=new Map;this.hasInlineCoverageDetails=De("hasInlineCoverageDetails",!1);this.summaryWidget=new uo(()=>this._register(t.createInstance(Sdt,this.editor)));let l=vi(this,e.onDidChangeModel,()=>e.getModel()),c=vi(this,e.onDidChangeConfiguration,g=>g),u=ke(g=>{let f=o.selected.read(g);if(!f)return;let v=l.read(g);if(!v)return;let b=f.getUri(v.uri);if(b)return f.didAddCoverage.read(g),{file:b,testId:o.filterToTest.read(g)}});this._register(cu(co.hasPerTestCoverage,s,g=>!!u.read(g)?.file.perTestData?.size)),this._register(cu(co.hasCoverageInFile,s,g=>!!u.read(g)?.file)),this._register(cu(co.hasInlineCoverageDetails,s,g=>this.hasInlineCoverageDetails.read(g)));let p=hr("testing.coverageMinimapEnabled",!0,n);this._register(ve(g=>{let f=u.read(g);f?this.apply(e.getModel(),f.file,f.testId,o.showInline.read(g),p.read(g)):this.clear()}));let h=hr("testing.coverageToolbarEnabled",!0,n);this._register(ve(g=>{let f=u.read(g);f&&h.read(g)?this.summaryWidget.value.setCoverage(f.file,f.testId):this.summaryWidget.rawValue?.clearCoverage()})),this._register(ve(g=>{u.read(g)&&c.read(g)?.hasChanged(75)!==!1&&this.updateEditorStyles()})),this._register(e.onMouseMove(g=>{let f=e.getModel();g.target.type===3&&f?this.hoverLineNumber(e.getModel()):o.showInline.get()&&g.target.type===6&&f?this.hoverInlineDecoration(f,g.target.position):this.hoveredStore.clear()})),this._register(e.onWillChangeModel(()=>{let g=e.getModel();if(!(!this.details||!g))for(let f of g.getAllDecorations()){let v=this.decorationIds.get(f.id);v&&(v.detail.range=f.range)}}))}static{this.ID="editor.contrib.coverageDecorations"}updateEditorStyles(){let e=this.editor.getOption(75),{style:t}=this.editor.getContainerDomNode();t.setProperty("--vscode-testing-coverage-lineHeight",`${e}px`)}hoverInlineDecoration(e,t){let o=e.getDecorationsInRange(G.fromPositions(t)),n=iD(o,({id:r})=>this.decorationIds.has(r)?{id:r,deco:this.decorationIds.get(r)}:void 0);n!==this.hoveredSubject&&(this.hoveredStore.clear(),this.hoveredSubject=n,n&&(e.changeDecorations(r=>{r.changeDecorationOptions(n.id,{...n.deco.options,className:`${n.deco.options.className} coverage-deco-hovered`})}),this.hoveredStore.add(ee(()=>{this.hoveredSubject=void 0,e.changeDecorations(r=>{r.changeDecorationOptions(n.id,n.deco.options)})}))))}hoverLineNumber(e){this.hoveredSubject==="lineNo"||!this.details||this.coverage.showInline.get()||(this.hoveredStore.clear(),this.hoveredSubject="lineNo",e.changeDecorations(t=>{for(let[o,n]of this.decorationIds){let{applyHoverOptions:r,options:s}=n,l={...s};r(l),t.changeDecorationOptions(o,l)}}),this.hoveredStore.add(this.editor.onMouseLeave(()=>{this.hoveredStore.clear()})),this.hoveredStore.add(ee(()=>{this.hoveredSubject=void 0,e.changeDecorations(t=>{for(let[o,n]of this.decorationIds)t.changeDecorationOptions(o,n.options)})})))}goToNextMissedLine(){return this.navigateToMissedLine(!0)}goToPreviousMissedLine(){return this.navigateToMissedLine(!1)}navigateToMissedLine(e){let t=this.editor.getModel(),o=this.editor.getPosition();if(!t||!o||!this.details)return!1;let n=o.lineNumber,r,s,l,c;for(let[,{detail:p,options:h}]of this.decorationIds)if(h.lineNumberClassName?.includes(SHi)){let g=p.range;if(g.isEmpty())continue;let f=g.startLineNumber,v={lineNumber:f,range:g};(!l||f<l.lineNumber)&&(l=v),(!c||f>c.lineNumber)&&(c=v),f<n?(!r||f>r.lineNumber)&&(r=v):f>n&&(!s||f<s.lineNumber)&&(s=v)}let u=e?s||l:r||c;return u?(this.editor.setPosition(new ye(u.lineNumber,1)),this.editor.revealLineInCenter(u.lineNumber),!0):!1}async apply(e,t,o,n,r){let s=this.details=await this.loadDetails(t,o,e);if(!s)return this.hasInlineCoverageDetails.set(!1,void 0),this.clear();this.hasInlineCoverageDetails.set(s.ranges.length>0,void 0),this.displayedStore.clear(),e.changeDecorations(l=>{for(let c of s.ranges){let{metadata:{detail:u,description:p},range:h,primary:g}=c;if(u.type===2){let f=u.detail.branches[u.branch].count,v=f?IAo:SHi,b=!f&&h.isEmpty()&&u.detail.branches.some(w=>w.count),S={showIfCollapsed:b,description:"coverage-gutter",lineNumberClassName:`coverage-deco-gutter ${v}`,minimap:r?{color:_s(f?gHi:fHi),position:2}:void 0},y=w=>{w.hoverMessage=p,b?w.after={content:"\xA0".repeat(hCn),inlineClassName:`coverage-deco-branch-miss-indicator ${q.asClassName(fAo)}`,inlineClassNameAffectsLetterSpacing:!0,cursorStops:3}:(w.className=`coverage-deco-inline ${v}`,g&&typeof f=="number"&&(w.before=yAo(f)))};n&&y(S),this.decorationIds.set(l.addDecoration(h,S),{options:S,applyHoverOptions:y,detail:c})}else if(u.type===1){let f=u.count?IAo:SHi,v={showIfCollapsed:!1,description:"coverage-inline",lineNumberClassName:`coverage-deco-gutter ${f}`,minimap:r?{color:_s(u.count?gHi:fHi),position:2}:void 0},b=S=>{S.className=`coverage-deco-inline ${f}`,S.hoverMessage=p,g&&typeof u.count=="number"&&(S.before=yAo(u.count))};n&&b(v),this.decorationIds.set(l.addDecoration(h,v),{options:v,applyHoverOptions:b,detail:c})}}}),this.displayedStore.add(ee(()=>{e.changeDecorations(l=>{for(let c of this.decorationIds.keys())l.removeDecoration(c);this.decorationIds.clear()})}))}clear(){this.loadingCancellation?.cancel(),this.loadingCancellation=void 0,this.displayedStore.clear(),this.hoveredStore.clear(),this.hasInlineCoverageDetails.set(!1,void 0)}async loadDetails(e,t,o){let n=this.loadingCancellation=new qe;this.displayedStore.add(this.loadingCancellation);try{let r=t?await e.detailsForTest(t,this.loadingCancellation.token):await e.details(this.loadingCancellation.token);return n.token.isCancellationRequested?void 0:new IHi(r,o)}catch(r){this.log.error("Error loading coverage details",r)}}};jre=I([m(1,F),m(2,YC),m(3,B),m(4,re),m(5,X)],jre);var yAo=a=>{if(a!==0)return{content:`${a>99?"99+":a}x`,cursorStops:3,inlineClassName:"coverage-deco-inline-count",inlineClassNameAffectsLetterSpacing:!0}},IHi=class{constructor(i,e){this.details=i;this.ranges=[];let t=i.map(s=>({range:EQt(s.location),primary:!0,metadata:{detail:s,description:this.describe(s,e)}}));for(let{range:s,metadata:{detail:l}}of t)if(l.type===1&&l.branches)for(let c=0;c<l.branches.length;c++){let u={type:2,branch:c,detail:l};t.push({range:EQt(l.branches[c].location||G.fromPositions(s.getEndPosition())),primary:!0,metadata:{detail:u,description:this.describe(u,e)}})}t.sort((s,l)=>G.compareRangesUsingStarts(s.range,l.range)||s.metadata.detail.type-l.metadata.detail.type);let o=[],n=this.ranges=[],r=()=>{let s=o.pop(),l=o[o.length-1];l&&(l.range=l.range.setStartPosition(s.range.endLineNumber,s.range.endColumn)),n.push(s)};for(let s of t){let l=s.range.getStartPosition();for(;o[o.length-1]?.range.containsPosition(l)===!1;)r();if(s.range.isEmpty()){n.push(s);continue}let c=o[o.length-1];if(c){let u=c.primary,p=c.range.setEndPosition(l.lineNumber,l.column);c.range=c.range.setStartPosition(s.range.endLineNumber,s.range.endColumn),c.primary=!1,c.range.isEmpty()&&o.pop(),n.push({range:p,primary:u,metadata:c.metadata})}o.push(s)}for(;o.length;)r()}describe(i,e){if(i.type===0)return wAo(i.name,i);if(i.type===1){let t=CAo(e.getValueInRange(EQt(i.location)).trim()||"<empty statement>");if(i.branches?.length){let o=i.branches.filter(n=>!!n.count).length;return new he().appendMarkdown(d(16966,null,o,i.branches.length,t))}else return wAo(t,i)}else if(i.type===2){let t=CAo(e.getValueInRange(EQt(i.detail.location)).trim()||"<empty statement>"),{count:o,label:n}=i.detail.branches[i.branch],r=n?TAo(n):`#${i.branch+1}`;return o?o===!0?new he().appendMarkdown(d(16965,null,r,t)):new he().appendMarkdown(d(16964,null,r,t,o)):new he().appendMarkdown(d(16967,null,r,t))}bs(i)}};function wAo(a,i){return new he().appendMarkdown(i.count?typeof i.count=="number"?d(16968,null,a,i.count):d(16970,null,a):d(16969,null,a))}function EQt(a){return a instanceof ye?G.fromPositions(a,new ye(a.lineNumber,2147483647)):a}function TAo(a){return"`"+a.replace(/[\n\r`]/g,"")+"`"}function CAo(a){return a.length>50&&(a=a.slice(0,40)+"..."),TAo(a)}var Sdt=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.editor=e;this.configurationService=t;this.contextMenuService=o;this.testService=n;this.keybindingService=r;this.commandService=s;this.coverage=l;this.registered=!1;this.isRunning=!1;this.showStore=this._register(new O);this._domNode=st("div.coverage-summary-widget",[st("div",[st("span.bars@bars"),st("span.toolbar@toolbar")])]);this.bars=this._register(c.createInstance(K$,{compact:!1,overall:!1,container:this._domNode.bars})),this.actionBar=this._register(c.createInstance(oo,this._domNode.toolbar,{orientation:0,actionViewItemProvider:(u,p)=>{if(u instanceof $9){if(u.iconOnly)return u.class=q.asClassName(u.icon),new ts(void 0,u,{...p,label:!1,icon:!0});let h=new yHi(void 0,u,p);return h.themeIcon=u.icon,h}}})),this._register(ve(u=>{l.showInline.read(u),this.setActions()})),this._register(Yo(this._domNode.root,ne.CONTEXT_MENU,u=>{this.contextMenuService.showContextMenu({menuId:R.StickyScrollContext,getAnchor:()=>u})}))}getId(){return"coverage-summary-widget"}getDomNode(){return this._domNode.root}getPosition(){return{preference:2,stackOrdinal:9}}clearCoverage(){this.current=void 0,this.bars.setCoverageInfo(void 0),this.hide()}setCoverage(e,t){this.current={coverage:e,testId:t},this.bars.setCoverageInfo(e),e?(this.setActions(),this.show()):this.hide()}setActions(){this.actionBar.clear();let e=this.current;if(!e)return;let t=new $9("toggleInline",this.coverage.showInline.get()?d(16980,null):d(16982,null),bdt,void 0,()=>this.coverage.showInline.set(!this.coverage.showInline.get(),void 0));t.tooltip=this.keybindingService.appendKeybinding(mCn,xAo);let o=e.coverage.statement.covered<e.coverage.statement.total;if(this.actionBar.push(new $9("goToPreviousMissed",EAo.value,L.arrowUp,o,()=>this.commandService.executeCommand("testing.coverage.goToPreviousMissedLine"),!0)),this.actionBar.push(new $9("goToNextMissed",kAo.value,L.arrowDown,o,()=>this.commandService.executeCommand("testing.coverage.goToNextMissedLine"),!0)),this.actionBar.push(t),e.testId){let n=e.coverage.fromResult.getTestById(e.testId.toString());Aw(!!n,"got coverage for an unreported test"),this.actionBar.push(new $9("perTestFilter",Gre.showingFilterFor(n.label),hdt,void 0,()=>this.commandService.executeCommand("testing.coverageFilterToTestInEditor",this.current,this.editor)))}else e.coverage.perTestData?.size&&this.actionBar.push(new $9("perTestFilter",d(16973,null,e.coverage.perTestData.size),hdt,void 0,()=>this.commandService.executeCommand("testing.coverageFilterToTestInEditor",this.current,this.editor)));this.actionBar.push(new $9("rerun",d(16981,null),qre,!this.isRunning,()=>this.rerunTest()))}show(){if(this.registered)return;this.registered=!0;let e,t=this.showStore;this.editor.addOverlayWidget(this),this.editor.changeViewZones(o=>{e=o.addZone({afterLineNumber:0,afterColumn:0,domNode:document.createElement("div"),heightInPx:30,ordinal:-1})}),t.add(ee(()=>{this.registered=!1,this.editor.removeOverlayWidget(this),this.editor.changeViewZones(o=>{o.removeZone(e)})})),t.add(this.configurationService.onDidChangeConfiguration(o=>{this.current&&(o.affectsConfiguration("testing.coverageBarThresholds")||o.affectsConfiguration("testing.displayedCoveragePercent"))&&this.setCoverage(this.current.coverage,this.current.testId)}))}rerunTest(){let e=this.current;e&&(this.isRunning=!0,this.setActions(),this.testService.runResolvedTests(e.coverage.fromResult.request).finally(()=>{this.isRunning=!1,this.setActions()}))}hide(){this.showStore.clear()}};Sdt=I([m(1,B),m(2,Xe),m(3,Xs),m(4,Le),m(5,fe),m(6,YC),m(7,F)],Sdt);W(class extends z{constructor(){super({id:xAo,title:P(16972,"Toggle Inline Coverage"),category:Fe.Test,keybinding:{weight:200,primary:Gi(2133,3111)},toggled:{condition:co.inlineCoverageEnabled,title:d(16971,null)},icon:bdt,menu:[{id:R.CommandPalette,when:co.isTestCoverageOpen},{id:R.EditorTitle,when:C.and(co.hasInlineCoverageDetails,co.coverageToolbarEnabled.notEqualsTo(!0)),group:"navigation"}]})}run(i){let e=i.get(YC);e.showInline.set(!e.showInline.get(),void 0)}});W(class extends z{constructor(){super({id:"testing.coverageToggleToolbar",title:P(16987,"Show Test Coverage Toolbar"),metadata:{description:P(16986,"Toggle the sticky coverage bar in the editor.")},category:Fe.Test,toggled:{condition:co.coverageToolbarEnabled},menu:[{id:R.CommandPalette,when:co.isTestCoverageOpen},{id:R.StickyScrollContext,when:co.isTestCoverageOpen},{id:R.EditorTitle,when:co.hasCoverageInFile,group:"coverage",order:1}]})}run(i){let e=i.get(B),t=wm(e,"testing.coverageToolbarEnabled");e.updateValue("testing.coverageToolbarEnabled",!t)}});W(class extends z{constructor(){super({id:"testing.coverageFilterToTestInEditor",title:P(16974,"Filter Coverage to Test"),category:Fe.Test,icon:L.filter,toggled:{icon:L.filterFilled,condition:co.isCoverageFilteredToTest},menu:[{id:R.EditorTitle,when:C.and(co.hasCoverageInFile,co.coverageToolbarEnabled.notEqualsTo(!0),co.hasPerTestCoverage,Tr.isEqualTo(EW)),group:"navigation"}]})}run(i,e,t){let o=i.get(YC),n=i.get($e),r=i.get(fe),s=fn(t)?t:i.get(Qt).getActiveCodeEditor(),l;if(e instanceof I8)l=e;else if(jm(e))l=o.selected.get()?.getUri(A.from(e));else{let S=s?.getModel()?.uri;l=S&&o.selected.get()?.getUri(S)}if(!l||!l.perTestData?.size)return;let c=[...l.perTestData].map(ns.fromString),u=ns.getLengthOfCommonPrefix(c.length,S=>c[S]),p=l.fromResult,h=o.filterToTest.get(),g=[{iconClass:"codicon-go-to-file",tooltip:"Go to Test"}],f=[{label:Gre.allTests,testId:void 0},{type:"separator"},...c.map(S=>({...SQt(p,S,u),testId:S,buttons:g}))],v=s?.getScrollTop()||0,b=new ue;n.pick(f,{activeItem:f.find(S=>"testId"in S&&S.testId?.toString()===h?.toString()),placeHolder:Gre.pickShowCoverage,onDidTriggerItemButton:S=>{r.executeCommand("vscode.revealTest",S.item.testId?.toString())},onDidFocus:S=>{if(!S.testId)b.clear(),s?.setScrollTop(v),o.filterToTest.set(void 0,void 0);else{let y=b.value=new qe;l.detailsForTest(S.testId,y.token).then(w=>{let x=w.find(E=>E.type===1);!y.token.isCancellationRequested&&x&&s?.revealLineNearTop(x.location instanceof ye?x.location.lineNumber:x.location.startLineNumber)},()=>{}),o.filterToTest.set(S.testId,void 0)}}}).then(S=>{S||s?.setScrollTop(v),b.dispose(),o.filterToTest.set(S?S.testId:h,void 0)})}});W(class extends z{constructor(){super({id:"testing.toggleCoverageInExplorer",title:P(16984,"Toggle Coverage in Explorer"),metadata:{description:P(16983,"Toggle the display of test coverage in the File Explorer view.")},category:Fe.Test,toggled:{condition:C.equals("config.testing.showCoverageInExplorer",!0),title:d(16979,null)},menu:[{id:R.CommandPalette,when:co.isTestCoverageOpen}]})}run(i){let e=i.get(B),t=wm(e,"testing.showCoverageInExplorer");e.updateValue("testing.showCoverageInExplorer",!t)}});W(class extends z{constructor(){super({id:"testing.coverage.goToNextMissedLine",title:kAo,metadata:{description:P(16976,"Navigate to the next line that is not covered by tests.")},category:Fe.Test,icon:L.arrowDown,precondition:co.hasCoverageInFile,keybinding:{when:Tr,weight:100,primary:579},menu:[{id:R.CommandPalette,when:co.isTestCoverageOpen},{id:R.EditorTitle,when:co.hasCoverageInFile,group:"coverage",order:2}]})}run(i){let t=i.get(Qt).getActiveCodeEditor();if(!t)return;t.getContribution(jre.ID)?.goToNextMissedLine()}});W(class extends z{constructor(){super({id:"testing.coverage.goToPreviousMissedLine",title:EAo,metadata:{description:P(16978,"Navigate to the previous line that is not covered by tests.")},category:Fe.Test,icon:L.arrowUp,precondition:co.hasCoverageInFile,keybinding:{when:Tr,weight:100,primary:1603},menu:[{id:R.CommandPalette,when:co.isTestCoverageOpen},{id:R.EditorTitle,when:co.hasCoverageInFile,group:"coverage",order:3}]})}run(i){let t=i.get(Qt).getActiveCodeEditor();if(!t)return;t.getContribution(jre.ID)?.goToPreviousMissedLine()}});var $9=class extends it{constructor(e,t,o,n,r,s=!1){super(e,t,void 0,n,r);this.icon=o;this.iconOnly=s}},yHi=class extends ts{updateLabel(){this.options.label&&this.label&&this.themeIcon&&Ii(this.label,un(this.themeIcon),this.action.label)}};function _Ao(a,i){let e={beginUpdate(){},endUpdate(){},handlePossibleChange(t){t.reportChanges()},handleChange(t,o){i(o)}};return a.addObserver(e),{dispose(){a.removeObserver(e)}}}var Y1e=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,t,o,n,r,s,l,c,u,p);this.coverageService=h;this.storageService=g;this.tree=this._register(new ue);this.sortOrder=De("sortOrder",1);let f=this.storageService.getNumber("testing.coverageSortOrder",1);f!==void 0&&f>=0&&f<=2&&this.sortOrder.set(f,void 0)}renderBody(e){super.renderBody(e),this._register(ve(o=>{let n=this.sortOrder.read(o);this.storageService.store("testing.coverageSortOrder",n,1,1)}));let t=this._register(this.instantiationService.createInstance(jl,{onDidChangeVisibility:this.onDidChangeBodyVisibility}));this._register(ve(o=>{let n=this.coverageService.selected.read(o);n?(this.tree.value??=this.instantiationService.createInstance(Idt,e,t,this.sortOrder)).setInput(n,this.coverageService.filterToTest.read(o)):this.tree.clear()}))}layoutBody(e,t){super.layoutBody(e,t),this.tree.value?.layout(e,t)}collapseAll(){this.tree.value?.collapseAll()}};Y1e=I([m(1,Le),m(2,Xe),m(3,B),m(4,X),m(5,ji),m(6,F),m(7,Je),m(8,Pe),m(9,ot),m(10,YC),m(11,de)],Y1e);var RQt=0,ydt=class{constructor(i,e,t){this.uri=i;this.data=e;this.id=String(RQt++);this.containedDetails=new Set;this.children=[];if(e.location instanceof G)for(let o of t)this.contains(o.location)&&this.containedDetails.add(o)}get hits(){return this.data.count}get label(){return this.data.name}get location(){return this.data.location}get tpc(){let i=this.attributableCoverage();return i&&nte(i.statement,i.branch,void 0)}contains(i){let e=this.data.location;return e instanceof G&&(i instanceof G?e.containsRange(i):e.containsPosition(i))}attributableCoverage(){let{location:i,count:e}=this.data;if(!(i instanceof G)||!e)return;let t={covered:0,total:0},o={covered:0,total:0};for(let n of this.containedDetails)if(n.type===1&&(t.covered+=n.count?1:0,t.total++,n.branches))for(let{count:r}of n.branches)o.covered+=r?1:0,o.total++;return{statement:t,branch:o}}};I([bi],ydt.prototype,"attributableCoverage",1);var wHi=class{constructor(i){this.n=i;this.id=String(RQt++)}get label(){return d(17026,null,this.n)}},wdt=class{constructor(i){this.testItem=i;this.id=String(RQt++)}get label(){return d(17025,null,this.testItem.label)}},TQt=class{constructor(){this.id=String(RQt++);this.label=d(17027,null)}},Jre=a=>typeof a=="object"&&"value"in a,_Qt=a=>a instanceof ydt,gCn=a=>Jre(a)&&a.value instanceof I8&&!!a.value.declaration?.total,Idt=class extends k{constructor(e,t,o,n,r,s){super();this.inputDisposables=this._register(new O);e.classList.add("testing-stdtree"),this.tree=n.createInstance(l0,"TestCoverageView",e,new CHi,[n.createInstance(Yre,t),n.createInstance(Xre),n.createInstance(DQt),n.createInstance(Qre)],{expandOnlyOnTwistieClick:!0,sorter:new xHi(o),keyboardNavigationLabelProvider:{getCompressedNodeKeyboardNavigationLabel(l){return l.map(c=>this.getKeyboardNavigationLabel(c)).join("/")},getKeyboardNavigationLabel(l){return Jre(l)?sl(l.value.uri):l.label}},accessibilityProvider:{getAriaLabel(l){if(Jre(l)){let c=sl(l.value.uri);return d(17028,null,c,(l.value.tpc*100).toFixed(2))}else return l.label},getWidgetAriaLabel(){return d(17029,null)}},identityProvider:new kHi}),this._register(ve(l=>{o.read(l),this.tree.resort(null,!0)})),this._register(this.tree),this._register(this.tree.onDidChangeCollapseState(l=>{let c=l.node.element;!l.node.collapsed&&!l.node.children.length&&c&&gCn(c)&&(c.value.hasSynchronousDetails&&this.tree.setChildren(c,[{element:new TQt,incompressible:!0}]),c.value.details().then(u=>this.updateWithDetails(c,u)))})),this._register(this.tree.onDidOpen(l=>{let c,u;if(l.element){if(Jre(l.element)&&!l.element.children?.size)c=l.element.value.uri;else if(_Qt(l.element))c=l.element.uri,u=l.element.location;else if(l.element instanceof wdt){s.executeCommand("testing.coverageFilterToTest");return}}c&&r.openEditor({resource:c,options:{selection:u instanceof ye?G.fromPositions(u,u):u,revealIfOpened:!0,selectionRevealType:3,preserveFocus:l.editorOptions.preserveFocus,pinned:l.editorOptions.pinned,source:1}},l.sideBySide?En:tr)}))}setInput(e,t){this.inputDisposables.clear();let o=e.tree;t&&(o=e.filterTreeForTest(t));let n=[];for(let c of o.nodes){for(;!(c.value instanceof I8)&&c.children?.size===1;)c=yt.first(c.children.values());n.push(c)}let r=c=>{let u=!c.children?.size;return{element:c,incompressible:u,collapsed:u,collapsible:!u||!!c.value?.declaration?.total,children:c.children&&yt.map(c.children?.values(),r)}};this.inputDisposables.add(_Ao(e.didAddCoverage,c=>{let u=wu(c,p=>this.tree.hasElement(p));u&&this.tree.setChildren(u,yt.map(u.children?.values()||[],r),{diffIdentityProvider:{getId:p=>p.value.id}})}));let s=yt.map(n,r),l=t&&e.result.getTestById(t.toString());l&&(s=yt.concat(yt.single({element:new wdt(l),incompressible:!0}),s)),this.tree.setChildren(null,s)}layout(e,t){this.tree.layout(e,t)}collapseAll(){this.tree.collapseAll()}updateWithDetails(e,t){if(!this.tree.hasElement(e))return;let o=[];for(let r of t){if(r.type!==0)continue;let s=o;for(;;){let l=s.find(c=>c.containedDetails.has(r));if(l)s=l.children;else break}s.push(new ydt(e.value.uri,r,t))}let n=r=>({element:r,incompressible:!0,collapsed:!0,collapsible:r.children.length>0,children:r.children.map(n)});this.tree.setChildren(e,o.map(n))}};Idt=I([m(3,F),m(4,ie),m(5,fe)],Idt);var CHi=class{getHeight(i){return 22}getTemplateId(i){if(Jre(i))return Yre.ID;if(_Qt(i))return Xre.ID;if(i instanceof TQt||i instanceof wHi)return DQt.ID;if(i instanceof wdt)return Qre.ID;bs(i)}},xHi=class{constructor(i){this.order=i}compare(i,e){let t=this.order.get();if(Jre(i)&&Jre(e))switch(t){case 1:case 2:return i.value.uri.toString().localeCompare(e.value.uri.toString());case 0:return e.value.tpc-i.value.tpc}else if(_Qt(i)&&_Qt(e))switch(t){case 1:return ye.compare(i.location instanceof G?i.location.getStartPosition():i.location,e.location instanceof G?e.location.getStartPosition():e.location);case 2:return i.label.localeCompare(e.label);case 0:{let o=i.tpc,n=e.tpc;return o!==void 0&&n!==void 0&&n-o||+e.hits-+i.hits||i.label.localeCompare(e.label)}}else return 0}},Qre=class{constructor(i,e){this.menuService=i;this.contextKeyService=e;this.templateId=Qre.ID}static{this.ID="C"}renderCompressedElements(i,e,t){this.renderInner(i.element.elements[i.element.elements.length-1],t)}renderTemplate(i){i.classList.add("testing-stdtree-container");let e=D(i,_(".label")),t=this.menuService.getMenuActions(R.TestCoverageFilterItem,this.contextKeyService,{shouldForwardArgs:!0}),o=new oo(i);return o.push(xl(t,"inline").primary,{icon:!0,label:!1}),o.domNode.style.display="block",{label:e,actions:o}}renderElement(i,e,t){this.renderInner(i.element,t)}disposeTemplate(i){i.actions.dispose()}renderInner(i,e){e.label.innerText=i.label}};Qre=I([m(0,Yt),m(1,X)],Qre);var Yre=class{constructor(i,e,t){this.labels=i;this.labelService=e;this.instantiationService=t;this.templateId=Yre.ID}static{this.ID="F"}renderTemplate(i){let e=new O;return i.classList.add("testing-stdtree-container","test-coverage-list-item"),{container:i,bars:e.add(this.instantiationService.createInstance(K$,{compact:!1,container:i})),label:e.add(this.labels.create(i,{supportHighlights:!0})),elementsDisposables:e.add(new O),templateDisposables:e}}renderElement(i,e,t){this.doRender(i.element,t,i.filterData)}renderCompressedElements(i,e,t){this.doRender(i.element.elements,t,i.filterData)}disposeTemplate(i){i.templateDisposables.dispose()}doRender(i,e,t){e.elementsDisposables.clear();let o=i instanceof Array?i[i.length-1]:i,n=o.value,r=i instanceof Array?i.map(s=>sl(s.value.uri)):sl(n.uri);n instanceof oet?e.bars.setCoverageInfo(void 0):(e.elementsDisposables.add(ve(s=>{o.value?.didChange.read(s),e.bars.setCoverageInfo(n)})),e.bars.setCoverageInfo(n)),e.label.setResource({resource:n.uri,name:r},{fileKind:o.children?.size?1:0,matches:Wa(t),separator:this.labelService.getSeparator(n.uri.scheme,n.uri.authority),extraClasses:["label"]})}};Yre=I([m(1,nt),m(2,F)],Yre);var Xre=class{constructor(i){this.instantiationService=i;this.templateId=Xre.ID}static{this.ID="N"}renderTemplate(i){let e=new O;i.classList.add("test-coverage-list-item","testing-stdtree-container");let t=D(i,_(".state")),o=D(i,_(".label"));return{container:i,bars:e.add(this.instantiationService.createInstance(K$,{compact:!1,container:i})),templateDisposables:e,icon:t,label:o}}renderElement(i,e,t){this.doRender(i.element,t,i.filterData)}renderCompressedElements(i,e,t){this.doRender(i.element.elements[i.element.elements.length-1],t,i.filterData)}disposeTemplate(i){i.templateDisposables.dispose()}doRender(i,e,t){let o=!!i.hits,n=o?gAo:OO.get(0);e.container.classList.toggle("not-covered",!o),e.icon.className=`computed-state ${q.asClassName(n)}`,e.label.innerText=i.label,e.bars.setCoverageInfo(i.attributableCoverage())}};Xre=I([m(0,F)],Xre);var DQt=class a{constructor(){this.templateId=a.ID}static{this.ID="B"}renderCompressedElements(i,e,t){this.renderInner(i.element.elements[i.element.elements.length-1],t)}renderTemplate(i){return i}renderElement(i,e,t){this.renderInner(i.element,t)}disposeTemplate(){}renderInner(i,e){e.innerText=i.label}},kHi=class{getId(i){return Jre(i)?i.value.uri.toString():i.id}};W(class extends z{constructor(){super({id:"testing.coverageFilterToTest",category:Fe.Test,title:P(17030,"Filter Coverage by Test"),icon:L.filter,toggled:{icon:L.filterFilled,condition:co.isCoverageFilteredToTest},menu:[{id:R.CommandPalette,when:co.hasPerTestCoverage},{id:R.TestCoverageFilterItem,group:"inline"},{id:R.ViewTitle,when:C.and(co.hasPerTestCoverage,C.equals("view","workbench.view.testCoverage")),group:"navigation"}]})}run(i){let e=i.get(YC),t=i.get($e),o=e.selected.get();if(!o)return;let n=[...o.allPerTestIDs()].map(ns.fromString),r=ns.getLengthOfCommonPrefix(n.length,p=>n[p]),s=o.result,l=e.filterToTest.get(),c=l?.toString(),u=[{label:Gre.allTests,id:void 0},{type:"separator"},...n.map(p=>({...SQt(s,p,r),testId:p}))];t.pick(u,{activeItem:u.find(p=>"testId"in p&&p.testId?.toString()===c),placeHolder:Gre.pickShowCoverage,onDidFocus:p=>{e.filterToTest.set(p.testId,void 0)}}).then(p=>{e.filterToTest.set(p?p.testId:l,void 0)})}});W(class extends rr{constructor(){super({id:"testing.coverageViewChangeSorting",viewId:"workbench.view.testCoverage",title:P(17031,"Change Sort Order"),icon:L.sortPrecedence,menu:{id:R.ViewTitle,when:C.equals("view","workbench.view.testCoverage"),group:"navigation",order:1}})}runInView(i,e){let t=new O,o=t.add(i.get($e).createQuickPick()),n=[{label:d(17035,null),value:1,description:d(17036,null)},{label:d(17033,null),value:0,description:d(17034,null)},{label:d(17037,null),value:2,description:d(17038,null)}];o.placeholder=d(17039,null),o.items=n,o.show(),t.add(o.onDidHide(()=>t.dispose())),t.add(o.onDidAccept(()=>{let r=o.selectedItems[0]?.value;r!==void 0&&(e.sortOrder.set(r,void 0),o.dispose())}))}});W(class extends rr{constructor(){super({id:"testing.coverageViewCollapseAll",viewId:"workbench.view.testCoverage",title:P(17032,"Collapse All Coverage"),icon:L.collapseAll,menu:{id:R.ViewTitle,when:C.equals("view","workbench.view.testCoverage"),group:"navigation",order:2}})}runInView(i,e){e.collapseAll()}});function X1e(a,i){i instanceof ns||(i=ns.fromString(i));let e=a;for(let t of i.path){if(!e.children?.hasOwnProperty(t))return;e=e.children[t]}return e.collapsed}var fCn=0,DAo=()=>String(fCn++),mg=class{constructor(i,e=null){this.test=i;this.parent=e;this.changeEmitter=new T;this.onChange=this.changeEmitter.event;this.children=new Set;this.treeId=DAo();this.retired=!1;this.state=0;this.depth=e?e.depth+1:0}toJSON(){if(this.depth===0)return{controllerId:this.test.controllerId};let i={$mid:16,tests:[QM.serialize(this.test)]};for(let e=this.parent;e&&e.depth>0;e=e.parent)i.tests.unshift(QM.serialize(e.test));return i}},wk=class{constructor(i,e){this.message=i;this.parent=e;this.treeId=DAo();this.children=new Set}get description(){return typeof this.message=="string"?this.message:this.message.value}},LQt={getId(a){let i=a instanceof wk?"error":a.test.expand===0?!!a.children.size:a.test.expand;return a.treeId+"\0"+i}},J1e=(a,i,e)=>{let t;if(e===null){let o=[...i];if(o.length===1)return J1e(a,o,o[0]);t=o}else t=e.children;return yt.map(t,o=>o instanceof wk?{element:o}:{element:o,collapsible:o.test.expand!==0,collapsed:o.test.item.error?2:X1e(a,o.test.item.extId)??o.depth>0?3:2,children:J1e(a,i,o)})};var vp=Fe.Test;var FQt=_Y.create(co.providerCount.key,0),RAo=P(17063,"Run Tests"),LAo=P(17044,"Debug Tests"),MAo=P(17041,"Run Tests with Coverage"),EHi=class extends z{constructor(){super({id:"testing.hideTest",title:P(17048,"Hide Test"),menu:{id:R.TestItem,group:"builtin@2",when:co.testItemIsHidden.isEqualTo(!1)}})}run(i,...e){let t=i.get(Xs);for(let o of e)t.excluded.toggle(o.test,!0);return Promise.resolve()}},THi=class extends z{constructor(){super({id:"testing.unhideTest",title:P(17111,"Unhide Test"),menu:{id:R.TestItem,order:21,when:co.testItemIsHidden.isEqualTo(!0)}})}run(i,...e){let t=i.get(Xs);for(let o of e)o instanceof mg&&t.excluded.toggle(o.test,!1);return Promise.resolve()}},_Hi=class extends z{constructor(){super({id:"testing.unhideAllTests",title:P(17110,"Unhide All Tests")})}run(i){return i.get(Xs).excluded.clear(),Promise.resolve()}},WQt=(a,i)=>[{id:R.TestItem,group:"inline",order:a,when:i},{id:R.TestItem,group:"builtin@1",order:a,when:i}],Cdt=class extends rr{constructor(e,t){super({...t,viewId:"workbench.view.testing"});this.bitset=e}runInView(e,t,...o){let{include:n,exclude:r}=t.getTreeIncludeExclude(this.bitset,o.map(s=>s.test));return e.get(Xs).runTests({tests:n,exclude:r,group:this.bitset})}},DHi=class extends Cdt{constructor(){super(4,{id:"testing.debug",title:P(17042,"Debug Test"),icon:yk,menu:WQt(12,co.hasDebuggableTests.isEqualTo(!0))})}},RHi=class extends Cdt{constructor(){super(8,{id:"testing.coverage",title:P(17060,"Run Test with Coverage"),icon:bHi,menu:WQt(13,co.hasCoverableTests.isEqualTo(!0))})}},LHi=class extends z{constructor(){super({id:"testing.runUsing",title:P(17093,"Execute Using Profile..."),icon:yk,menu:{id:R.TestItem,order:15,group:"builtin@2",when:co.hasNonDefaultProfile.isEqualTo(!0)}})}async run(i,...e){let t=i.get(fe),o=i.get(Xs),n=await t.executeCommand("vscode.pickTestProfile",{onlyForTest:e[0].test});n&&o.runResolvedTests({group:n.group,targets:[{profileId:n.profileId,controllerId:n.controllerId,testIds:e.filter(r=>JM(n,r.test)).map(r=>r.test.item.extId)}]})}},MHi=class extends Cdt{constructor(){super(2,{id:"testing.run",title:P(17059,"Run Test"),icon:W1,menu:WQt(11,co.hasRunnableTests.isEqualTo(!0))})}},PHi=class extends z{constructor(){super({id:"testing.selectDefaultTestProfiles",title:P(17096,"Select Default Profile"),icon:gdt,category:vp})}async run(i,e){let t=i.get(fe),o=i.get(Vu),n=await t.executeCommand("vscode.pickMultipleTestProfiles",{showConfigureButtons:!1,selected:o.getGroupDefaultProfiles(e),onlyGroup:e});n?.length&&o.setGroupDefaultProfiles(e,n)}},AHi=class extends z{constructor(){super({id:"testing.toggleContinuousRunForTest",title:P(17105,"Turn on Continuous Run"),icon:fdt,precondition:C.or(co.isContinuousModeOn.isEqualTo(!0),co.isParentRunningContinuously.isEqualTo(!1)),toggled:{condition:co.isContinuousModeOn.isEqualTo(!0),icon:vdt,title:d(17104,null)},menu:WQt(2147483647,co.supportsContinuousRun.isEqualTo(!0))})}async run(i,...e){let t=i.get(XP);for(let o of e){let n=o.test.item.extId;if(t.isSpecificallyEnabledFor(n)){t.stop(n);continue}t.start(2,n)}}},NHi=class extends z{constructor(){super({id:"testing.continuousRunUsingForTest",title:P(17102,"Start Continous Run Using..."),icon:yk,menu:[{id:R.TestItem,order:14,group:"builtin@2",when:C.and(co.supportsContinuousRun.isEqualTo(!0),co.isContinuousModeOn.isEqualTo(!1))}]})}async run(i,...e){let t=i.get(XP),o=i.get(Vu),n=i.get(Ne),r=i.get($e);for(let s of e){let l=await AAo(t,n,r,[{profiles:o.getControllerProfiles(s.test.controllerId)}]);l.length&&t.start(l,s.test.item.extId)}}},OHi=class extends z{constructor(){super({id:"testing.configureProfile",title:P(17069,"Configure Test Profiles"),icon:gdt,f1:!0,category:vp,menu:{id:R.CommandPalette,when:co.hasConfigurableProfile.isEqualTo(!0)}})}async run(i,e){let t=i.get(fe),o=i.get(Vu),n=await t.executeCommand("vscode.pickTestProfile",{placeholder:d(17040,null),showConfigureButtons:!1,onlyConfigurable:!0,onlyGroup:e});n&&o.configure(n.controllerId,n.profileId)}},PAo=a=>[{id:R.ViewTitle,group:"navigation",order:15,when:C.and(C.equals("view","workbench.view.testing"),co.supportsContinuousRun.isEqualTo(!0),co.isContinuousModeOn.isEqualTo(a))},{id:R.CommandPalette,when:co.supportsContinuousRun.isEqualTo(!0)}],FHi=class extends z{constructor(){super({id:"testing.stopContinuousRun",title:P(17103,"Stop Continuous Run"),category:vp,icon:CQt,menu:PAo(!0)})}run(i){i.get(XP).stop()}};function AAo(a,i,e,t){let o=[];for(let{controller:u,profiles:p}of t)for(let h of p)h.supportsContinuousRun&&o.push({label:h.label||u?.label.get()||"",description:u?.label.get(),profile:h});if(o.length===0)return i.info(d(17082,null)),Promise.resolve([]);if(o.length===1)return Promise.resolve([o[0].profile]);let n=[],r=[],s=a.lastRunProfileIds;o.sort((u,p)=>u.profile.group-p.profile.group||u.profile.controllerId.localeCompare(p.profile.controllerId)||u.label.localeCompare(p.label));for(let u=0;u<o.length;u++){let p=o[u];(u===0||o[u-1].profile.group!==p.profile.group)&&n.push({type:"separator",label:K0t[p.profile.group]}),n.push(p),s.has(p.profile.profileId)&&r.push(p)}let l=new O,c=l.add(e.createQuickPick({useSeparators:!0}));return c.title=d(17095,null),c.canSelectMany=!0,c.items=n,c.selectedItems=r,c.show(),new Promise(u=>{l.add(c.onDidAccept(()=>{u(c.selectedItems.map(p=>p.profile)),l.dispose()})),l.add(c.onDidHide(()=>{u([]),l.dispose()}))})}var WHi=class extends z{constructor(){super({id:"testing.startContinuousRun",title:P(17101,"Start Continuous Run"),category:vp,icon:fdt,menu:PAo(!1)})}async run(i){let e=i.get(XP),o=[...i.get(Vu).all()].flatMap(r=>r.profiles.filter(s=>e.lastRunProfileIds.has(s.profileId)));if(o.length)return e.start(o);let n=await AAo(e,i.get(Ne),i.get($e),i.get(Vu).all());n.length&&e.start(n)}},xdt=class extends rr{constructor(e,t){super({...e,menu:[{id:R.ViewTitle,order:t===2?11:t===4?12:13,group:"navigation",when:C.and(C.equals("view","workbench.view.testing"),co.isRunning.isEqualTo(!1),co.capabilityToContextKey[t].isEqualTo(!0))}],category:vp,viewId:"workbench.view.testing"});this.group=t}runInView(e,t){let{include:o,exclude:n}=t.getTreeIncludeExclude(this.group);return e.get(Xs).runTests({tests:o,exclude:n,group:this.group})}},VHi=class extends z{constructor(){super({id:"testing.getSelectedProfiles",title:P(17047,"Get Selected Profiles")})}run(i){let e=i.get(Vu);return[...e.getGroupDefaultProfiles(2),...e.getGroupDefaultProfiles(4),...e.getGroupDefaultProfiles(8)].map(t=>({controllerId:t.controllerId,label:t.label,kind:t.group&8?3:t.group&4?2:1}))}},BHi=class extends rr{constructor(){super({id:"_testing.getExplorerSelection",title:P(17046,"Get Explorer Selection"),viewId:"workbench.view.testing"})}runInView(i,e){let{include:t,exclude:o}=e.getTreeIncludeExclude(2,void 0,"selected"),n=r=>r.item.extId;return{include:t.map(n),exclude:o.map(n)}}},HHi=class extends xdt{constructor(){super({id:"testing.runSelected",title:RAo,icon:q9},2)}},UHi=class extends xdt{constructor(){super({id:"testing.debugSelected",title:LAo,icon:uSe},4)}},zHi=class extends xdt{constructor(){super({id:"testing.coverageSelected",title:MAo,icon:yQt},8)}},NAo=(a,i)=>a.withProgress({location:10,title:d(17045,null)},()=>i),kdt=class extends z{constructor(e,t,o){super({...e,category:vp,menu:[{id:R.CommandPalette,when:co.capabilityToContextKey[t].isEqualTo(!0)}]});this.group=t;this.noTestsFoundError=o}async run(e){let t=e.get(Xs),o=e.get(Ne),n=[...t.collection.rootItems].filter(r=>r.children.size||r.expand===1||r.expand===2);if(!n.length){o.info(this.noTestsFoundError);return}await t.runTests({tests:n,group:this.group})}},KHi=class extends kdt{constructor(){super({id:"testing.runAll",title:P(17061,"Run All Tests"),icon:q9,keybinding:{weight:200,primary:Gi(2133,31)}},2,d(17053,null))}},GHi=class extends kdt{constructor(){super({id:"testing.debugAll",title:P(17043,"Debug All Tests"),icon:yk,keybinding:{weight:200,primary:Gi(2133,2079)}},4,d(17050,null))}},qHi=class extends kdt{constructor(){super({id:"testing.coverageAll",title:P(17062,"Run All Tests with Coverage"),icon:bHi,keybinding:{weight:200,primary:Gi(2133,3103)}},8,d(17049,null))}},$Hi=class extends z{constructor(){super({id:"testing.cancelRun",title:P(17064,"Cancel Test Run"),icon:wQt,category:vp,keybinding:{weight:200,primary:Gi(2133,2102)},menu:[{id:R.ViewTitle,order:11,group:"navigation",when:C.and(C.equals("view","workbench.view.testing"),C.equals(co.isRunning.serialize(),!0))},{id:R.CommandPalette,when:co.isRunning}]})}async run(i,e,t){let o=i.get(Rd),n=i.get(Xs);if(e)n.cancelTestRun(e,t);else for(let r of o.results)r.completedAt||n.cancelTestRun(r.id)}},jHi=class extends rr{constructor(){super({id:"testing.viewAsList",viewId:"workbench.view.testing",title:P(17108,"View as List"),toggled:co.viewMode.isEqualTo("list"),menu:{id:R.ViewTitle,order:18,group:"viewAs",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewMode="list"}},QHi=class extends rr{constructor(){super({id:"testing.viewAsTree",viewId:"workbench.view.testing",title:P(17109,"View as Tree"),toggled:co.viewMode.isEqualTo("true"),menu:{id:R.ViewTitle,order:18,group:"viewAs",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewMode="true"}},YHi=class extends rr{constructor(){super({id:"testing.sortByStatus",viewId:"workbench.view.testing",title:P(17100,"Sort by Status"),toggled:co.viewSorting.isEqualTo("status"),menu:{id:R.ViewTitle,order:19,group:"sortBy",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="status"}},XHi=class extends rr{constructor(){super({id:"testing.sortByLocation",viewId:"workbench.view.testing",title:P(17099,"Sort by Location"),toggled:co.viewSorting.isEqualTo("location"),menu:{id:R.ViewTitle,order:19,group:"sortBy",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="location"}},JHi=class extends rr{constructor(){super({id:"testing.sortByDuration",viewId:"workbench.view.testing",title:P(17098,"Sort by Duration"),toggled:co.viewSorting.isEqualTo("duration"),menu:{id:R.ViewTitle,order:19,group:"sortBy",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.viewSorting="duration"}},ZHi=class extends z{constructor(){super({id:"testing.showMostRecentOutput",title:P(17097,"Show Output"),category:vp,icon:L.terminal,keybinding:{weight:200,primary:Gi(2133,2093)},precondition:co.hasAnyResults.isEqualTo(!0),menu:[{id:R.ViewTitle,order:16,group:"navigation",when:C.equals("view","workbench.view.testing")},{id:R.CommandPalette,when:co.hasAnyResults.isEqualTo(!0)}]})}async run(i){(await i.get(Gt).openView("workbench.panel.testResults.view",!0))?.showLatestRun()}},eUi=class extends rr{constructor(){super({id:"testing.collapseAll",viewId:"workbench.view.testing",title:P(17068,"Collapse All Tests"),icon:L.collapseAll,menu:{id:R.ViewTitle,order:16,group:"displayAction",when:C.equals("view","workbench.view.testing")}})}runInView(i,e){e.viewModel.collapseAll()}},tUi=class extends z{constructor(){super({id:"testing.clearTestResults",title:P(17067,"Clear All Results"),category:vp,icon:L.clearAll,menu:[{id:R.TestPeekTitle},{id:R.CommandPalette,when:co.hasAnyResults.isEqualTo(!0)},{id:R.ViewTitle,order:17,group:"displayAction",when:C.equals("view","workbench.view.testing")},{id:R.ViewTitle,order:17,group:"navigation",when:C.equals("view","workbench.panel.testResults.view")}]})}run(i){i.get(Rd).clear()}},iUi=class extends z{constructor(){super({id:"testing.editFocusedTest",title:P(17078,"Go to Test"),icon:L.goToFile,menu:{id:R.TestItem,group:"builtin@1",order:20,when:co.testItemHasUri.isEqualTo(!0)},keybinding:{weight:90,when:rc.isEqualTo("workbench.view.testing"),primary:515}})}async run(i,e,t){e||(e=i.get(Gt).getActiveViewWithId("workbench.view.testing")?.focusedTreeElements[0]),e&&e instanceof mg&&i.get(fe).executeCommand("vscode.revealTest",e.test.item.extId,t)}};async function OAo(a,i,e,t,o){let n=[],r,s=[],l;for await(let c of Zme(a,i,e))for(let u of c){if(!u.item.range||o?.(u)===!1)continue;let p=G.lift(u.item.range);p.containsPosition(t)?r&&G.equalsRange(u.item.range,r)?n.some(h=>ns.isChild(h.item.extId,u.item.extId))||n.push(u):(r=p,n=[u]):ye.isBefore(p.getStartPosition(),t)&&(!l||l.getStartPosition().isBefore(p.getStartPosition())?(l=p,s=[u]):p.equalsRange(l)&&!s.some(h=>ns.isChild(h.item.extId,u.item.extId))&&s.push(u))}return n.length?n:s}var Edt=class extends z{constructor(e,t){super({...e,menu:[{id:R.CommandPalette,when:FQt},{id:R.EditorContext,group:"testing",order:t===2?0:1,when:C.and(co.activeEditorHasTests,co.capabilityToContextKey[t])}]});this.group=t}async run(e){let t=e.get(Qt),o=e.get(ie),n=o.activeEditorPane,r=t.getActiveCodeEditor();if(!n||!r)return;r instanceof Ed&&(r=r.getParentEditor());let s=r?.getPosition(),l=r?.getModel();if(!s||!l||!("uri"in l))return;let c=e.get(Xs),u=e.get(Vu),p=e.get(gt),h=e.get(Go),g=e.get(B);wm(g,"testing.saveBeforeTest")&&(await o.save({editor:n.input,groupId:n.group.id}),await c.syncTests());let v=await NAo(h,OAo(c,p,l.uri,s,S=>!!(u.capabilitiesForTest(S.item)&this.group)));if(v.length){await c.runTests({group:this.group,tests:v});return}let b=await c.getTestsRelatedToCode(l.uri,s);if(b.length){await c.runTests({group:this.group,tests:b});return}r&&Xu.get(r)?.showMessage(d(17055,null),s)}},oUi=class extends Edt{constructor(){super({id:"testing.runAtCursor",title:P(17091,"Run Test at Cursor"),category:vp,keybinding:{weight:200,when:me.editorTextFocus,primary:Gi(2133,33)}},2)}},nUi=class extends Edt{constructor(){super({id:"testing.debugAtCursor",title:P(17073,"Debug Test at Cursor"),category:vp,keybinding:{weight:200,when:me.editorTextFocus,primary:Gi(2133,2081)}},4)}},rUi=class extends Edt{constructor(){super({id:"testing.coverageAtCursor",title:P(17070,"Run Test at Cursor with Coverage"),category:vp,keybinding:{weight:200,when:me.editorTextFocus,primary:Gi(2133,3105)}},8)}},Tdt=class extends z{constructor(e,t){super({...e,menu:[{id:R.ExplorerContext,when:co.capabilityToContextKey[t].isEqualTo(!0),group:"6.5_testing",order:(t===2?11:12)+.1}]});this.group=t}async run(e,t){let o=e.get(Xs),n=e.get(Ne),r=await yt.asyncToArray(Rmo(o,e.get(gt),t));if(!r.length){n.notify({message:d(17054,null),severity:ft.Info});return}return o.runTests({tests:r,group:this.group})}},sUi=class extends Tdt{constructor(){super({id:"testing.run.uri",title:RAo,category:vp},2)}},aUi=class extends Tdt{constructor(){super({id:"testing.debug.uri",title:LAo,category:vp},4)}},lUi=class extends Tdt{constructor(){super({id:"testing.coverage.uri",title:MAo,category:vp},8)}},_dt=class extends z{constructor(e,t){super({...e,menu:[{id:R.CommandPalette,when:co.capabilityToContextKey[t].isEqualTo(!0)},{id:R.EditorContext,group:"testing",order:t===2?2:3,when:C.and(co.activeEditorHasTests,co.capabilityToContextKey[t])}]});this.group=t}async _runByUris(e,t){let o=e.get(gt),n=e.get(Xs),r=[];for(let s of t)for await(let l of Zme(n,o,s,void 0,!0))for(let c of l)r.push(c);return r.length?{completedAt:(await n.runTests({tests:r,group:this.group})).completedAt}:{completedAt:void 0}}run(e,t){if(t?.length)return this._runByUris(e,t);let o=e.get(gt),n=e.get(Qt).getActiveCodeEditor();if(!n)return;n instanceof Ed&&(n=n.getParentEditor());let r=n?.getPosition(),s=n?.getModel();if(!r||!s||!("uri"in s))return;let l=e.get(Xs),c=[l.collection.rootIds],u=[];for(;c.length;)for(let p of c.pop()){let h=l.collection.getNodeById(p);o.extUri.isEqual(h.item.uri,s.uri)?u.push(h):c.push(h.children)}if(u.length)return l.runTests({tests:u,group:this.group});n&&Xu.get(n)?.showMessage(d(17056,null),r)}},cUi=class extends _dt{constructor(){super({id:"testing.runCurrentFile",title:P(17092,"Run Tests in Current File"),category:vp,keybinding:{weight:200,when:me.editorTextFocus,primary:Gi(2133,36)}},2)}},dUi=class extends _dt{constructor(){super({id:"testing.debugCurrentFile",title:P(17074,"Debug Tests in Current File"),category:vp,keybinding:{weight:200,when:me.editorTextFocus,primary:Gi(2133,2084)}},4)}},uUi=class extends _dt{constructor(){super({id:"testing.coverageCurrentFile",title:P(17071,"Run Tests with Coverage in Current File"),category:vp,keybinding:{weight:200,when:me.editorTextFocus,primary:Gi(2133,3108)}},8)}},Mdt=async(a,i,e,t)=>{let o=Promise.all(e.map(r=>Dmo(a,r))),n=(await NAo(i,o)).filter(so);return n.length?await t(n):void 0},pUi=class extends z{async run(i,...e){let t=i.get(Xs);await Mdt(i.get(Xs).collection,i.get(Go),[...this.getTestExtIdsToRun(i,...e)],o=>this.runTest(t,o))}},MQt=class extends pUi{constructor(i){super({...i,menu:{id:R.CommandPalette,when:FQt}})}getTestExtIdsToRun(i){let{results:e}=i.get(Rd),t=new Set;for(let o=e.length-1;o>=0;o--){let n=e[o];for(let r of n.tests)Xx(r.ownComputedState)?t.add(r.item.extId):t.delete(r.item.extId)}return t}},Ddt=class extends z{constructor(i){super({...i,menu:{id:R.CommandPalette,when:C.and(FQt,co.hasAnyResults.isEqualTo(!0))}})}getLastTestRunRequest(i,e){let t=i.get(Rd);return(e?t.results.find(n=>n.id===e):t.results[0])?.request}async run(i,e){let t=i.get(Rd),o=e?t.results.find(c=>c.id===e):t.results[0];if(!o)return;let n=o.request,r=i.get(Xs),s=i.get(Vu),l=c=>s.getControllerProfiles(c.controllerId).some(u=>u.profileId===c.profileId);await Mdt(r.collection,i.get(Go),n.targets.flatMap(c=>c.testIds),c=>this.getGroup()&n.group&&n.targets.every(l)?r.runResolvedTests({targets:n.targets,group:n.group,exclude:n.exclude}):r.runTests({tests:c,group:this.getGroup()}))}},mUi=class extends MQt{constructor(){super({id:"testing.reRunFailTests",title:P(17089,"Rerun Failed Tests"),category:vp,keybinding:{weight:200,primary:Gi(2133,35)}})}runTest(i,e){return i.runTests({group:2,tests:e})}},hUi=class extends MQt{constructor(){super({id:"testing.debugFailTests",title:P(17076,"Debug Failed Tests"),category:vp,keybinding:{weight:200,primary:Gi(2133,2083)}})}runTest(i,e){return i.runTests({group:4,tests:e})}},Rdt=class extends Ddt{constructor(){super({id:"testing.reRunLastRun",title:P(17090,"Rerun Last Run"),category:vp,keybinding:{weight:200,primary:Gi(2133,42)}})}getGroup(){return 2}},Ldt=class extends Ddt{constructor(){super({id:"testing.debugLastRun",title:P(17077,"Debug Last Run"),category:vp,keybinding:{weight:200,primary:Gi(2133,2090)}})}getGroup(){return 4}},gUi=class extends Ddt{constructor(){super({id:"testing.coverageLastRun",title:P(17072,"Rerun Last Run with Coverage"),category:vp,keybinding:{weight:200,primary:Gi(2133,3114)}})}getGroup(){return 8}},PQt=class extends z{constructor(i){super({...i,menu:{id:R.CommandPalette,when:C.and(FQt,co.hasAnyResults.isEqualTo(!0))}})}async run(i,e){let t=i.get(Rd),o=i.get(Xs),n=i.get(Go),r=e?t.results.find(l=>l.id===e):t.results[0];if(!r)return;let s=new Set;for(let l of r.tests)Xx(l.ownComputedState)&&s.add(l.item.extId);s.size!==0&&await Mdt(o.collection,n,Array.from(s),l=>o.runTests({tests:l,group:this.getGroup()}))}},fUi=class extends PQt{constructor(){super({id:"testing.reRunFailedFromLastRun",title:P(17088,"Rerun Failed Tests from Last Run"),category:vp})}getGroup(){return 2}},vUi=class extends PQt{constructor(){super({id:"testing.debugFailedFromLastRun",title:P(17075,"Debug Failed Tests from Last Run"),category:vp})}getGroup(){return 4}},bUi=class extends z{constructor(){super({id:"testing.searchForTestExtension",title:P(17094,"Search for Test Extension")})}async run(i){i.get(Ui).openSearch('@category:"testing"')}},SUi=class extends z{constructor(){super({id:"testing.openOutputPeek",title:P(17084,"Peek Output"),category:vp,keybinding:{weight:200,primary:Gi(2133,2091)},menu:{id:R.CommandPalette,when:co.hasAnyResults.isEqualTo(!0)}})}async run(i){i.get(sL).open()}},IUi=class extends z{constructor(){super({id:"testing.toggleInlineTestOutput",title:P(17106,"Toggle Inline Test Output"),category:vp,keybinding:{weight:200,primary:Gi(2133,2087)},menu:{id:R.CommandPalette,when:co.hasAnyResults.isEqualTo(!0)}})}async run(i){let e=i.get(Xs);e.showInlineOutput.value=!e.showInlineOutput.value}},FAo=a=>[{id:R.TestItem,group:"inline",order:10,when:C.and(co.canRefreshTests.isEqualTo(!0),co.isRefreshingTests.isEqualTo(a))},{id:R.ViewTitle,group:"navigation",order:10,when:C.and(C.equals("view","workbench.view.testing"),co.canRefreshTests.isEqualTo(!0),co.isRefreshingTests.isEqualTo(a))},{id:R.CommandPalette,when:co.canRefreshTests.isEqualTo(!0)}],yUi=class extends z{constructor(){super({id:"testing.refreshTests",title:P(17087,"Refresh Tests"),category:vp,icon:mAo,keybinding:{weight:200,primary:Gi(2133,2096),when:co.canRefreshTests.isEqualTo(!0)},menu:FAo(!1)})}async run(i,...e){let t=i.get(Xs),o=i.get(Go),n=jo(e.filter(so).map(r=>r.test.controllerId));return o.withProgress({location:"workbench.view.extension.test"},async()=>{n.length?await Promise.all(n.map(r=>t.refreshTests(r))):await t.refreshTests()})}},wUi=class extends z{constructor(){super({id:"testing.cancelTestRefresh",title:P(17065,"Cancel Test Refresh"),category:vp,icon:hAo,menu:FAo(!0)})}async run(i){i.get(Xs).cancelRefreshTests()}},CUi=class extends z{constructor(){super({id:"testing.coverage.close",title:P(17066,"Clear Coverage"),icon:MT,category:vp,menu:[{id:R.ViewTitle,group:"navigation",order:10,when:C.equals("view","workbench.view.testCoverage")},{id:R.CommandPalette,when:co.isTestCoverageOpen.isEqualTo(!0)}]})}run(i){i.get(YC).closeCoverage()}},xUi=class extends z{constructor(){super({id:"testing.openCoverage",title:P(17083,"Open Coverage"),category:vp,menu:[{id:R.CommandPalette,when:co.hasAnyResults.isEqualTo(!0)}]})}run(i){let e=i.get(Rd).results,t=e.length&&e[0].tasks.find(o=>o.coverage);if(!t){i.get(Ne).info(d(17081,null));return}i.get(YC).openCoverage(t,!0)}},AQt=class extends u0{runEditorCommand(i,e,...t){return this.testService=i.get(Xs),this.uriIdentityService=i.get(gt),super.runEditorCommand(i,e,...t)}_getAlternativeCommand(i){return i.getOption(67).alternativeTestsCommand}_getGoToPreference(i){return i.getOption(67).multipleTests||"peek"}},NQt=class extends AQt{async _getLocationModel(i,e,t,o){let n=await this.testService.getTestsRelatedToCode(e.uri,t,o);return new dC(n.map(r=>r.item.uri&&{uri:r.item.uri,range:r.item.range||new G(1,1,1,1)}).filter(so),d(17058,null))}_getNoResultFoundMessage(){return d(17052,null)}},kUi=class extends NQt{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"testing.goToRelatedTest",title:P(17080,"Go to Related Test"),category:vp,precondition:C.and(C.not(co.activeEditorHasTests.key),co.canGoToRelatedTest),menu:[{id:R.EditorContext,group:"testing",order:4}]})}},EUi=class extends NQt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"testing.peekRelatedTest",title:P(17086,"Peek Related Test"),category:vp,precondition:C.and(co.canGoToRelatedTest,C.not(co.activeEditorHasTests.key),Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated()),menu:[{id:R.EditorContext,group:"testing",order:5}]})}},OQt=class extends AQt{async _getLocationModel(i,e,t,o){let n=await OAo(this.testService,this.uriIdentityService,e.uri,t),r=await Promise.all(n.map(s=>this.testService.getCodeRelatedToTest(s)));return new dC(r.flat(),d(17057,null))}_getNoResultFoundMessage(){return d(17051,null)}},TUi=class extends OQt{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"testing.goToRelatedCode",title:P(17079,"Go to Related Code"),category:vp,precondition:C.and(co.activeEditorHasTests,co.canGoToRelatedCode),menu:[{id:R.EditorContext,group:"testing",order:4}]})}},_Ui=class extends OQt{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"testing.peekRelatedCode",title:P(17085,"Peek Related Code"),category:vp,precondition:C.and(co.activeEditorHasTests,co.canGoToRelatedCode,Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated()),menu:[{id:R.EditorContext,group:"testing",order:5}]})}},DUi=class extends z{constructor(){super({id:"testing.toggleResultsViewLayout",title:P(17107,"Toggle Tree Position"),category:vp,icon:L.arrowSwap,menu:{id:R.ViewTitle,order:18,group:"navigation",when:C.equals("view","workbench.panel.testResults.view")}})}async run(i){let e=i.get(B),o=wm(e,"testing.resultsView.layout")==="treeLeft"?"treeRight":"treeLeft";await e.updateValue("testing.resultsView.layout",o)}},WAo=[wUi,$Hi,CUi,tUi,eUi,OHi,AHi,NHi,RHi,qHi,rUi,uUi,gUi,zHi,lUi,DHi,GHi,nUi,dUi,hUi,Ldt,UHi,aUi,BHi,VHi,TUi,kUi,iUi,EHi,xUi,SUi,_Ui,EUi,yUi,mUi,Rdt,MHi,KHi,oUi,cUi,HHi,sUi,LHi,bUi,PHi,ZHi,WHi,FHi,JHi,XHi,YHi,jHi,QHi,IUi,DUi,_Hi,THi,fUi,vUi];function VAo(a,{onlyGroup:i,showConfigureButtons:e=!0,onlyForTest:t,onlyConfigurable:o,placeholder:n=d(17119,null)}){let r=a.get(Vu),s=[],l=(u,p)=>{for(let h of Lf(u,(g,f)=>g.group-f.group)){let g=!1;if(i){if(h[0].group!==i)continue;g=!0}for(let f of h)o&&!f.hasConfigurationHandler||(g||(s.push({type:"separator",label:K0t[h[0].group]}),g=!0),s.push({type:"item",profile:f,label:f.label,description:p,alwaysShow:!0,buttons:f.hasConfigurationHandler&&e?[{iconClass:q.asClassName(gdt),tooltip:d(17120,null)}]:[]}))}};if(t!==void 0)l(r.getControllerProfiles(t.controllerId).filter(u=>JM(u,t)));else for(let{profiles:u,controller:p}of r.all())l(u,p.label.get());let c=a.get($e).createQuickPick({useSeparators:!0});return c.items=s,c.placeholder=n,c}var BAo=(a,i)=>e=>{let t=e.item.profile;t&&(a.configure(t.controllerId,t.profileId),i(void 0))};Ge.registerCommand({id:"vscode.pickMultipleTestProfiles",handler:async(a,i)=>{let e=a.get(Vu),t=VAo(a,i);if(!t)return;let o=new O;o.add(t),t.canSelectMany=!0,i.selected&&(t.selectedItems=t.items.filter(r=>r.type==="item").filter(r=>i.selected.some(s=>s.controllerId===r.profile.controllerId&&s.profileId===r.profile.profileId)));let n=await new Promise(r=>{o.add(t.onDidAccept(()=>{let s=t.selectedItems;r(s.map(l=>l.profile).filter(so))})),o.add(t.onDidHide(()=>r(void 0))),o.add(t.onDidTriggerItemButton(BAo(e,r))),t.show()});return o.dispose(),n}});Ge.registerCommand({id:"vscode.pickTestProfile",handler:async(a,i)=>{let e=a.get(Vu),t=VAo(a,i);if(!t)return;let o=new O;o.add(t);let n=await new Promise(r=>{o.add(t.onDidAccept(()=>r(t.selectedItems[0]?.profile))),o.add(t.onDidHide(()=>r(void 0))),o.add(t.onDidTriggerItemButton(BAo(e,r))),t.show()});return o.dispose(),n}});var Z1e=(a,i)=>{if(!a)return[];let e=ns.fromString(a.item.extId);return[[co.testItemExtId.key,e.localId],[co.controllerId.key,a.controllerId],[co.testItemHasUri.key,!!a.item.uri],...G0t(i)]};var bCn=/^\x1b\[([0-9]+)m$/;var Zre=a=>typeof a=="string"?Hv(a):ma(a),HAo=(a,i)=>{let e=[];return i.changeDecorations(t=>{let o=new ye(1,1),n=[];for(let r of j3i(a))if(r.isCode){let s=bCn.exec(r.str)?.[1];if(!s)continue;let l=Number(s);l===0?n.length=0:l===22?n=n.filter(c=>c!=="tstm-ansidec-1"&&c!=="tstm-ansidec-3"):l===23?n=n.filter(c=>c!=="tstm-ansidec-3"):l===24?n=n.filter(c=>c!=="tstm-ansidec-4"):l>=30&&l<=39||l>=90&&l<=99?(n=n.filter(c=>!c.startsWith("tstm-ansidec-fg")),n.push("tstm-ansidec-fg"+s)):l>=40&&l<=49||l>=100&&l<=109?(n=n.filter(c=>!c.startsWith("tstm-ansidec-bg")),n.push("tstm-ansidec-bg"+s)):n.push("tstm-ansidec-"+s)}else{let s=o.lineNumber,l=o.column,c=new Qj(r.str);for(let p=0;!c.eol();p+=c.nextGraphemeLength())r.str[p]===`
`?(s++,l=1):l++;let u=new ye(s,l);n.length&&e.push(t.addDecoration(G.fromPositions(o,u),{inlineClassName:n.join(" "),description:"test-message-colorized"})),o=u}}),ee(()=>i.removeDecorations(e))};var RUi=(a,i)=>({$mid:18,test:QM.serialize(a),message:oW.serialize(i)}),UAo=a=>a instanceof vh&&!!a.stack?.length,vh=class{constructor(i,e,t,o){this.result=i;this.taskIndex=t;this.messageIndex=o;this.test=e.item;let n=e.tasks[t].messages;this.messageIndex=o;let r={messageIndex:o,resultId:i.id,taskIndex:t,testExtId:e.item.extId};this.expectedUri=rL({...r,type:4}),this.actualUri=rL({...r,type:3}),this.messageUri=rL({...r,type:2});let s=this.message=n[this.messageIndex];this.context=RUi(e,s),this.revealLocation=s.location??(e.item.uri&&e.item.range?{uri:e.item.uri,range:G.lift(e.item.range)}:void 0)}get controllerId(){return ns.root(this.test.extId)}get isDiffable(){return this.message.type===0&&oW.isDiffable(this.message)}get contextValue(){return this.message.type===0?this.message.contextValue:void 0}get stack(){return this.message.type===0&&this.message.stackTrace?.length?this.message.stackTrace:void 0}},pI=class{constructor(i,e){this.result=i;this.taskIndex=e;this.outputUri=rL({resultId:i.id,taskIndex:e,type:0})}get controllerId(){return this.result.tasks[this.taskIndex].ctrlId}},mI=class{constructor(i,e,t){this.result=i;this.taskIndex=e;this.test=t;this.outputUri=rL({resultId:this.result.id,taskIndex:this.taskIndex,testExtId:this.test.item.extId,type:1}),this.task=i.tasks[this.taskIndex]}get controllerId(){return ns.root(this.test.item.extId)}},zAo=(a,i)=>a instanceof vh&&i instanceof vh&&a.message===i.message||a instanceof pI&&i instanceof pI&&a.result===i.result&&a.taskIndex===i.taskIndex||a instanceof mI&&i instanceof mI&&a.test===i.test&&a.taskIndex===i.taskIndex,eze=(a,i)=>{for(let e=0;e<a.tasks.length;e++){let t=a.tasks[e];for(let o=0;o<t.messages.length;o++){let n=i(t,t.messages[o],o,e);if(n!==void 0)return n}}},KAo=a=>{if(a instanceof vh)return a.test;if(!(a instanceof pI))return a.test.item};var ose=class{constructor(i,e,t=1,o=1){this.name=i;this.source=e;this.line=t;this.column=o}},nze=class{constructor(i,e){this.label=i;this.load=e}},Adt=class{constructor(){this.showHeader=De("CustomStackFrame.showHeader",!0)}},VQt=class extends ose{constructor(e){super(e.name,e.source,e.line,e.column);this.editorHeight=De("WrappedCallStackFrame.height",this.source?100:0);this.collapsed=De("WrappedCallStackFrame.collapsed",!1);this.height=ke(e=>this.collapsed.read(e)?rze:rze+this.editorHeight.read(e))}},mSe=class{constructor(i){this.original=i;this.collapsed=De("WrappedCallStackFrame.collapsed",!1);this.height=ke(i=>{let e=this.original.showHeader.read(i)?rze:0;return this.collapsed.read(i)?e:e+this.original.height.read(i)})}},SCn=a=>a instanceof VQt||a instanceof mSe,GAo="multiCallStackWidget",tze=class extends k{constructor(e,t,o){super();this.layoutEmitter=this._register(new T);this.currentFramesDs=this._register(new O);e.classList.add(GAo),this._register(ee(()=>e.classList.remove(GAo))),this.list=this._register(o.createInstance(bc,"TestResultStackWidget",e,new LUi,[o.createInstance(ese,t,this.layoutEmitter.event),o.createInstance(tse),o.createInstance(BQt),o.createInstance(ise,n=>this.loadFrame(n))],{multipleSelectionSupport:!1,mouseSupport:!1,keyboardSupport:!1,setRowLineHeight:!1,alwaysConsumeMouseWheel:!1,accessibilityProvider:o.createInstance(Pdt)}))}get onDidChangeContentHeight(){return this.list.onDidChangeContentHeight}get onDidScroll(){return this.list.onDidScroll}get contentHeight(){return this.list.contentHeight}setFrames(e){this.currentFramesDs.clear();let t=new qe;this.currentFramesDs.add(ee(()=>t.dispose(!0))),this.cts=t,this.list.splice(0,this.list.length,this.mapFrames(e))}layout(e,t){this.list.layout(e,t),this.layoutEmitter.fire()}collapseAll(){Ki(e=>{for(let t=0;t<this.list.length;t++){let o=this.list.element(t);SCn(o)&&o.collapsed.set(!0,e)}})}async loadFrame(e){if(!this.cts)return;let t=await e.load(this.cts.token);if(this.cts.token.isCancellationRequested)return;let o=this.list.indexOf(e);this.list.splice(o,1,this.mapFrames(t))}mapFrames(e){let t=[];for(let o of e){if(o instanceof nze){t.push(o);continue}let n=o instanceof Adt?new mSe(o):new VQt(o);t.push(n),this.currentFramesDs.add(ve(r=>{let s=n.height.read(r),l=this.list.indexOf(n);l!==-1&&this.list.updateElementHeight(l,s)}))}return t}};tze=I([m(2,F)],tze);var Pdt=class{constructor(i){this.labelService=i}getAriaLabel(i){if(i instanceof nze)return i.label;if(i instanceof mSe)return i.original.label;if(i instanceof ose)return i.source&&i.line?d(10540,null,i.name,i.line,this.labelService.getUriLabel(i.source,{relative:!0})):i.name;bs(i)}getWidgetAriaLabel(){return d(10539,null)}};Pdt=I([m(0,nt)],Pdt);var LUi=class{getHeight(i){if(i instanceof ose||i instanceof mSe)return i.height.get();if(i instanceof nze)return rze;bs(i)}getTemplateId(i){if(i instanceof ose)return i.source?ese.templateId:tse.templateId;if(i instanceof nze)return ise.templateId;if(i instanceof mSe)return BQt.templateId;bs(i)}},qAo={scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},overviewRulerLanes:0,fixedOverflowWidgets:!0,overviewRulerBorder:!1,stickyScroll:{enabled:!1},minimap:{enabled:!1},readOnly:!0,automaticLayout:!1},jAo=()=>st("div.multiCallStackFrame",[st("div.header@header",[st("div.collapse-button@collapseButton"),st("div.title.show-file-icons@title"),st("div.actions@actions")]),st("div.editorParent",[st("div.editorContainer@editor")])]),rze=24,ize=class{constructor(i){this.instantiationService=i}renderTemplate(i){let e=jAo();i.appendChild(e.root);let t=new O;i.classList.add("multiCallStackFrameContainer"),t.add(ee(()=>{i.classList.remove("multiCallStackFrameContainer"),e.root.remove()}));let o=t.add(this.instantiationService.createInstance(CE,e.title,{})),n=t.add(new Pi(e.collapseButton,{})),r=ht();return e.editor.id=r,e.editor.role="region",e.collapseButton.setAttribute("aria-controls",r),this.finishRenderTemplate({container:i,decorations:[],elements:e,label:o,collapse:n,elementStore:t.add(new O),templateStore:t})}renderElement(i,e,t){let{elementStore:o}=t;o.clear();let n=i;this.setupCollapseButton(n,t)}setupCollapseButton(i,{elementStore:e,elements:t,collapse:o}){e.add(ve(r=>{o.element.className="";let s=i.collapsed.read(r);o.icon=s?L.chevronRight:L.chevronDown,o.element.ariaExpanded=String(!s),t.root.classList.toggle("collapsed",s)}));let n=()=>i.collapsed.set(!i.collapsed.get(),void 0);e.add(o.onDidClick(n)),e.add($(t.title,"click",n))}disposeElement(i,e,t){t.elementStore.clear()}disposeTemplate(i){i.templateStore.dispose()}};ize=I([m(0,F)],ize);var $Ao=2,ese=class extends ize{constructor(e,t,o,n){super(n);this.containingEditor=e;this.onLayout=t;this.modelService=o;this.templateId=ese.templateId}static{this.templateId="f"}finishRenderTemplate(e){let t=[{id:oze.ID,instantiation:2,ctor:oze}],o=this.containingEditor?this.instantiationService.createInstance(Ed,e.elements.editor,qAo,{isSimpleWidget:!0,contributions:t},this.containingEditor):this.instantiationService.createInstance(us,e.elements.editor,qAo,{isSimpleWidget:!0,contributions:t});e.templateStore.add(o);let n=e.templateStore.add(this.instantiationService.createInstance(pr,e.elements.actions,R.DebugCallStackToolbar,{menuOptions:{shouldForwardArgs:!0},actionViewItemProvider:(r,s)=>ta(this.instantiationService,r,s)}));return{...e,editor:o,toolbar:n}}renderElement(e,t,o){super.renderElement(e,t,o);let{elementStore:n,editor:r}=o,s=e,l=s.source;o.label.element.setFile(l);let c=new qe;n.add(ee(()=>c.dispose(!0))),this.modelService.createModelReference(l).then(u=>{if(c.token.isCancellationRequested)return u.dispose();n.add(u),r.setModel(u.object.textEditorModel),this.setupEditorAfterModel(s,o),this.setupEditorLayout(s,o)})}setupEditorLayout(e,{elementStore:t,container:o,editor:n}){let r=()=>{let s=n.getContentHeight();n.layout({width:o.clientWidth,height:s});let l=n.getContentHeight();l!==s&&n.layout({width:o.clientWidth,height:l}),e.editorHeight.set(l,void 0)};t.add(n.onDidChangeModelDecorations(r)),t.add(n.onDidChangeModelContent(r)),t.add(n.onDidChangeModelOptions(r)),t.add(this.onLayout(r)),r()}setupEditorAfterModel(e,t){let o=G.fromPositions({column:e.column??1,lineNumber:e.line??1});t.toolbar.context={uri:e.source,range:o},t.editor.setHiddenAreas([G.fromPositions({column:1,lineNumber:1},{column:1,lineNumber:Math.max(1,e.line-$Ao-1)}),G.fromPositions({column:1,lineNumber:e.line+$Ao+1},{column:1,lineNumber:1073741824})]),t.editor.changeDecorations(n=>{for(let c of t.decorations)n.removeDecoration(c);t.decorations.length=0;let r=o.setStartPosition(o.startLineNumber,1),s=!!t.editor.getModel()?.getValueInRange(r).trim(),l=o.setEndPosition(o.startLineNumber,1073741824);t.decorations.push(n.addDecoration(l,TOi(!s))),t.decorations.push(n.addDecoration(l,EOi))}),e.editorHeight.set(t.editor.getContentHeight(),void 0)}};ese=I([m(2,Bt),m(3,F)],ese);var tse=class{constructor(i){this.instantiationService=i;this.templateId=tse.templateId}static{this.templateId="m"}renderTemplate(i){let e=jAo();e.root.classList.add("missing"),i.appendChild(e.root);let t=this.instantiationService.createInstance(CE,e.title,{});return{elements:e,label:t}}renderElement(i,e,t){let o=i;t.label.element.setResource({name:o.name,description:d(10538,null,o.line,o.column),range:{startLineNumber:o.line,startColumn:o.column,endColumn:o.column,endLineNumber:o.line}},{icon:L.fileBinary})}disposeTemplate(i){i.label.dispose(),i.elements.root.remove()}};tse=I([m(0,F)],tse);var BQt=class a extends ize{constructor(){super(...arguments);this.templateId=a.templateId}static{this.templateId="c"}finishRenderTemplate(e){return e}renderElement(e,t,o){super.renderElement(e,t,o);let n=e,{elementStore:r,container:s,label:l}=o;l.element.setResource({name:n.original.label},{icon:n.original.icon}),r.add(ve(u=>{o.elements.header.style.display=n.original.showHeader.read(u)?"":"none"})),r.add(Rl((u,p)=>{n.collapsed.read(u)||p.add(n.original.render(s))}));let c=n.original.renderActions?.(o.elements.actions);c&&r.add(c)}},ise=class{constructor(i,e){this.loadFrames=i;this.notificationService=e;this.templateId=ise.templateId}static{this.templateId="s"}renderTemplate(i){let e=new O,t=new Pi(i,{title:"",...Ro}),o={button:t,store:e};return e.add(t),e.add(t.onDidClick(()=>{!o.current||!t.enabled||(t.enabled=!1,this.loadFrames(o.current).catch(n=>{this.notificationService.error(d(10536,null,n.message))}))})),o}renderElement(i,e,t){let o=i;t.button.enabled=!0,t.button.label=o.label,t.current=o}disposeTemplate(i){i.store.dispose()}};ise=I([m(1,Ne)],ise);var oze=class extends k{constructor(e,t){super();this.editor=e;this.linkDecorations=e.createDecorationsCollection(),this._register(ee(()=>this.linkDecorations.clear()));let o=this._register(new i0(e));this._register(o.onMouseMoveOrRelevantKeyDown(([n,r])=>{this.onMove(n)})),this._register(o.onExecute(n=>{let r=this.editor.getModel();!this.current||!r||t.openEditor({resource:r.uri,options:{selection:G.fromPositions(new ye(this.current.line,this.current.word.startColumn)),selectionRevealType:1}},n.hasSideBySideModifier?En:void 0)}))}static{this.ID="clickToLocation"}onMove(e){if(!e.hasTriggerModifier)return this.clear();let t=e.target.position,o=t&&this.editor.getModel()?.getWordAtPosition(t);if(!o)return this.clear();let n=this.current?.word;n&&n.startColumn===o.startColumn&&n.endColumn===o.endColumn&&n.word===o.word||(this.current={word:o,line:t.lineNumber},this.linkDecorations.set([{range:new G(t.lineNumber,o.startColumn,t.lineNumber,o.endColumn),options:{description:"call-stack-go-to-file-link",inlineClassName:"call-stack-go-to-file-link"}}]))}clear(){this.linkDecorations.clear(),this.current=void 0}};oze=I([m(1,ie)],oze);W(class extends z{constructor(){super({id:"callStackWidget.goToFile",title:P(10537,"Open File"),icon:L.goToFile,menu:{id:R.DebugCallStackToolbar,order:22,group:"navigation"}})}async run(a,{uri:i,range:e}){await a.get(ie).openEditor({resource:i,options:{selection:e,selectionRevealType:1}})}});function QE(a,i={}){let e="";return i.excludeLeadingNewLine||(e+=`\r
`),e+="\x1B[0m\x1B[7m * ",i.loudFormatting?e+="\x1B[0;104m":e+="\x1B[0m",e+=` ${a} \x1B[0m
\r`,e}var Ndt=class a{constructor(i,e){this._xterm=i;this._properties=e}get command(){return this._properties.command}get commandLineConfidence(){return this._properties.commandLineConfidence}get isTrusted(){return this._properties.isTrusted}get timestamp(){return this._properties.timestamp}get duration(){return this._properties.duration}get promptStartMarker(){return this._properties.promptStartMarker}get marker(){return this._properties.marker}get endMarker(){return this._properties.endMarker}set endMarker(i){this._properties.endMarker=i}get executedMarker(){return this._properties.executedMarker}get aliases(){return this._properties.aliases}get wasReplayed(){return this._properties.wasReplayed}get cwd(){return this._properties.cwd}get exitCode(){return this._properties.exitCode}get commandStartLineContent(){return this._properties.commandStartLineContent}get markProperties(){return this._properties.markProperties}get executedX(){return this._properties.executedX}get startX(){return this._properties.startX}get id(){return this._properties.id}static deserialize(i,e,t){let o=i.buffer.normal,n=e.startLine!==void 0?i.registerMarker(e.startLine-(o.baseY+o.cursorY)):void 0;if(!n)return;let r=e.promptStartLine!==void 0?i.registerMarker(e.promptStartLine-(o.baseY+o.cursorY)):void 0,s=e.endLine!==void 0?i.registerMarker(e.endLine-(o.baseY+o.cursorY)):void 0,l=e.executedLine!==void 0?i.registerMarker(e.executedLine-(o.baseY+o.cursorY)):void 0;return new a(i,{command:t?"":e.command,commandLineConfidence:e.commandLineConfidence??"low",isTrusted:e.isTrusted,id:e.id,promptStartMarker:r,marker:n,startX:e.startX,endMarker:s,executedMarker:l,executedX:e.executedX,timestamp:e.timestamp,duration:e.duration,cwd:e.cwd,commandStartLineContent:e.commandStartLineContent,exitCode:e.exitCode,markProperties:e.markProperties,aliases:void 0,wasReplayed:!0})}serialize(i){return{promptStartLine:this.promptStartMarker?.line,startLine:this.marker?.line,startX:void 0,endLine:this.endMarker?.line,executedLine:this.executedMarker?.line,executedX:this.executedX,command:i?"":this.command,commandLineConfidence:i?"low":this.commandLineConfidence,isTrusted:this.isTrusted,cwd:this.cwd,exitCode:this.exitCode,commandStartLineContent:this.commandStartLineContent,timestamp:this.timestamp,duration:this.duration,markProperties:this.markProperties,id:this.id}}extractCommandLine(){return YAo(this._xterm.buffer.active,this._xterm.cols,this.marker,this.startX,this.executedMarker,this.executedX)}getOutput(){if(!this.executedMarker||!this.endMarker)return;let i=this.executedMarker.line,e=this.endMarker.line;if(i===e)return;let t="",o="",n,r=this._xterm.buffer.active;for(let s=i;s<e;s++){if(n=r.getLine(s),!n)continue;let l=s+1<e?!!r.getLine(s+1)?.isWrapped:!1;o+=n.translateToString(!l),l||(t+=o+`
`,o="")}return o.length>0&&(t+=o),t===""?void 0:t}getOutputMatch(i){if(!this.executedMarker||!this.endMarker)return;let e=this.endMarker.line;if(e===-1)return;let t=this._xterm.buffer.active,o=Math.max(this.executedMarker.line,0),n=i.lineMatcher,r=We(n)?1:i.length||ICn(n),s=[],l;if(i.anchor==="bottom")for(let c=e-(i.offset||0);c>=o;c--){let u=c,p=c;for(;u>=o&&t.getLine(u)?.isWrapped;)u--;if(c=u,s.unshift(QAo(t,u,p,this._xterm.cols)),l||(l=s[0].match(n)),s.length>=r)break}else for(let c=o+(i.offset||0);c<e;c++){let u=c,p=c;for(;p+1<e&&t.getLine(p+1)?.isWrapped;)p++;if(c=p,s.push(QAo(t,u,p,this._xterm.cols)),l||(l=s[s.length-1].match(n)),s.length>=r)break}return l?{regexMatch:l,outputLines:s}:void 0}hasOutput(){return!this.executedMarker?.isDisposed&&!this.endMarker?.isDisposed&&!!(this.executedMarker&&this.endMarker&&this.executedMarker.line<this.endMarker.line)}getPromptRowCount(){return XAo(this,this._xterm.buffer.active)}getCommandRowCount(){return JAo(this)}},Odt=class{constructor(i,e){this._xterm=i;this.id=e??ht()}serialize(i){if(this.commandStartMarker)return{promptStartLine:this.promptStartMarker?.line,startLine:this.commandStartMarker.line,startX:this.commandStartX,endLine:void 0,executedLine:void 0,executedX:void 0,command:"",commandLineConfidence:"low",isTrusted:!0,cwd:i,exitCode:void 0,commandStartLineContent:void 0,timestamp:0,duration:0,markProperties:void 0,id:this.id}}promoteToFullCommand(i,e,t,o){if(e===void 0&&this.command===void 0&&(this.command=""),this.command!==void 0&&!this.command.startsWith("\\")||t)return new Ndt(this._xterm,{command:t?"":this.command||"",commandLineConfidence:t?"low":this.commandLineConfidence||"low",isTrusted:!!this.isTrusted,id:this.id,promptStartMarker:this.promptStartMarker,marker:this.commandStartMarker,startX:this.commandStartX,endMarker:this.commandFinishedMarker,executedMarker:this.commandExecutedMarker,executedX:this.commandExecutedX,timestamp:Date.now(),duration:this.commandDuration||0,cwd:i,exitCode:e,commandStartLineContent:this.commandStartLineContent,markProperties:o})}markExecutedTime(){this.commandExecutedTimestamp===void 0&&(this.commandExecutedTimestamp=Date.now())}markFinishedTime(){this.commandDuration===void 0&&this.commandExecutedTimestamp!==void 0&&(this.commandDuration=Date.now()-this.commandExecutedTimestamp)}extractCommandLine(){return YAo(this._xterm.buffer.active,this._xterm.cols,this.commandStartMarker,this.commandStartX,this.commandExecutedMarker,this.commandExecutedX)}getPromptRowCount(){return XAo(this,this._xterm.buffer.active)}getCommandRowCount(){return JAo(this)}};function YAo(a,i,e,t,o,n){if(!e||!o||t===void 0||n===void 0)return"";let r="";for(let s=e.line;s<=o.line;s++){let l=a.getLine(s);l&&(r+=l.translateToString(!0,s===e.line?t:0,s===o.line?n:i))}return r}function QAo(a,i,e,t){let o=Math.max(2048/t*2);e=Math.min(e,i+o);let n="";for(let r=i;r<=e;r++){let s=a.getLine(r);s&&(n+=s.translateToString(!0,0,t))}return n}function ICn(a){if(!a.multiline)return 1;let i=a.source,e=1,t=i.indexOf("\\n");for(;t!==-1;)e++,t=i.indexOf("\\n",t+1);return e}function XAo(a,i){let e=XC(a)?a.marker:a.commandStartMarker;if(!e||!a.promptStartMarker)return 1;let t=1,o=a.promptStartMarker.line;for(;o<e.line&&(i.getLine(o)?.translateToString(!0)??"").length===0;)o++;return t=e.line-o+1,t}function JAo(a){let i=XC(a)?a.marker:a.commandStartMarker,e=XC(a)?a.executedMarker:a.commandExecutedMarker;if(!i||!e)return 1;let o=Math.max(e.line,i.line)-i.line+1;return(XC(a)?a.executedX:a.commandExecutedX)===0&&o--,o}function XC(a){return!!a.hasOutput}var sze=class extends k{constructor(e,t,o){super();this._capabilities=e;this._configurationService=t;this._themeService=o;this._currentMarker=1;this._selectionStart=null;this._isDisposable=!1;this._commandGuideDecorations=this._register(new ue)}activate(e){this._terminal=e,this._register(this._terminal.onData(()=>{this._currentMarker=1}))}_getMarkers(e){let t=this._capabilities.get(2),o=this._capabilities.get(3),n=this._capabilities.get(4),r=[];if(t?(r=ui(t.commands.filter(s=>e?s.exitCode!==void 0:!0).map(s=>s.promptStartMarker??s.marker)),t.currentCommand?.promptStartMarker&&t.currentCommand.commandExecutedMarker&&r.push(t.currentCommand?.promptStartMarker)):o&&r.push(...o.commands),n&&!e){let s=n.markers().next()?.value,l=[];for(;s;)l.push(s),s=n.markers().next()?.value;r=l}return r}_findCommand(e){let t=this._capabilities.get(2);if(t){let o=t.commands.find(n=>n.marker?.line===e.line||n.promptStartMarker?.line===e.line);if(o)return o;if(t.currentCommand)return t.currentCommand}}clear(){this._currentMarker=1,this._resetNavigationDecorations(),this._selectionStart=null}_resetNavigationDecorations(){this._navigationDecorations&&je(this._navigationDecorations),this._navigationDecorations=[]}_isEmptyCommand(e){return e===1?!0:e===0?!this._getMarkers(!0).map(t=>t.line).includes(0):!this._getMarkers(!0).includes(e)}scrollToPreviousMark(e=1,t=!1,o=!0){if(!this._terminal)return;t||(this._selectionStart=null);let n,r=typeof this._currentMarker=="object"?this.getTargetScrollLine(this._currentMarker.line,e):Math.min(Fdt(this._terminal,this._currentMarker),this._terminal.buffer.active.baseY),s=this._terminal.buffer.active.viewportY;if(typeof this._currentMarker=="object"?!this._isMarkerInViewport(this._terminal,this._currentMarker):r!==s){let l=this._getMarkers(o).filter(c=>c.line>=s).length;n=this._getMarkers(o).length-l-1}else this._currentMarker===1?n=this._getMarkers(o).length-1:this._currentMarker===0?n=-1:this._isDisposable?(n=this._findPreviousMarker(o),this._currentMarker.dispose(),this._isDisposable=!1):o&&this._isEmptyCommand(this._currentMarker)?n=this._findPreviousMarker(!0):n=this._getMarkers(o).indexOf(this._currentMarker)-1;if(n<0){this._currentMarker=0,this._terminal.scrollToTop(),this._resetNavigationDecorations();return}this._currentMarker=this._getMarkers(o)[n],this._scrollToCommand(this._currentMarker,e)}scrollToNextMark(e=1,t=!1,o=!0){if(!this._terminal)return;t||(this._selectionStart=null);let n,r=typeof this._currentMarker=="object"?this.getTargetScrollLine(this._currentMarker.line,e):Math.min(Fdt(this._terminal,this._currentMarker),this._terminal.buffer.active.baseY),s=this._terminal.buffer.active.viewportY;if((typeof this._currentMarker=="object"?!this._isMarkerInViewport(this._terminal,this._currentMarker):r!==s)?n=this._getMarkers(o).filter(c=>c.line<=s).length:this._currentMarker===1?n=this._getMarkers(o).length:this._currentMarker===0?n=0:this._isDisposable?(n=this._findNextMarker(o),this._currentMarker.dispose(),this._isDisposable=!1):o&&this._isEmptyCommand(this._currentMarker)?n=this._findNextMarker(!0):n=this._getMarkers(o).indexOf(this._currentMarker)+1,n>=this._getMarkers(o).length){this._currentMarker=1,this._terminal.scrollToBottom(),this._resetNavigationDecorations();return}this._currentMarker=this._getMarkers(o)[n],this._scrollToCommand(this._currentMarker,e)}_scrollToCommand(e,t){let o=this._findCommand(e);o?this.revealCommand(o,t):this._scrollToMarker(e,t)}_scrollToMarker(e,t,o,n){if(this._terminal){if(!this._isMarkerInViewport(this._terminal,e)||n?.forceScroll){let r=this.getTargetScrollLine(nse(e),t);this._terminal.scrollToLine(r)}n?.hideDecoration||(n?.bufferRange?this._highlightBufferRange(n.bufferRange):this.registerTemporaryDecoration(e,o,!0))}}_createMarkerForOffset(e,t){if(t===0&&ZAo(e))return e;{let o=this._terminal?.registerMarker(-this._terminal.buffer.active.cursorY+nse(e)-this._terminal.buffer.active.baseY+t);if(o)return o;throw new Error(`Could not register marker with offset ${nse(e)}, ${t}`)}}revealCommand(e,t=1){let o=XC(e)?e.marker:e.commandStartMarker;if(!this._terminal||!o)return;let n=nse(o),r=e.getPromptRowCount(),s=e.getCommandRowCount();this._scrollToMarker(n-(r-1),t,n+(s-1))}revealRange(e){this._scrollToMarker(e.start.y-1,1,e.end.y-1,{bufferRange:e,forceScroll:!!this._configurationService.getValue(Yp.StickyScrollEnabled)})}showCommandGuide(e){if(this._terminal){if(!e){this._commandGuideDecorations.clear(),this._activeCommandGuide=void 0;return}if(this._activeCommandGuide!==e&&e.marker){this._activeCommandGuide=e;let t=this._commandGuideDecorations.value=new O;if(!e.executedMarker||!e.endMarker)return;let o=e.marker.line-(e.getPromptRowCount()-1),n=nse(e.endMarker)-o;if(n>200)return;for(let r=0;r<n;r++){let s=this._terminal.registerDecoration({marker:this._createMarkerForOffset(o,r)});if(s){t.add(s);let l;t.add(s.onRender(c=>{l||(l=c,c.classList.add("terminal-command-guide"),r===0&&c.classList.add("top"),r===n-1&&c.classList.add("bottom"))}))}}}}}saveScrollState(){this._scrollState={viewportY:this._terminal?.buffer.active.viewportY??0}}restoreScrollState(){this._scrollState&&this._terminal&&(this._terminal.scrollToLine(this._scrollState.viewportY),this._scrollState=void 0)}_highlightBufferRange(e){if(!this._terminal)return;this._resetNavigationDecorations();let t=e.start.y,o=e.end.y-e.start.y+1;for(let n=0;n<o;n++){let r=this._terminal.registerDecoration({marker:this._createMarkerForOffset(t-1,n),x:e.start.x-1,width:e.end.x-1-(e.start.x-1)+1,overviewRulerOptions:void 0});if(r){this._navigationDecorations?.push(r);let s;r.onRender(l=>{s||(s=l,l.classList.add("terminal-range-highlight"))}),r.onDispose(()=>{this._navigationDecorations=this._navigationDecorations?.filter(l=>l!==r)})}}}registerTemporaryDecoration(e,t,o){if(!this._terminal)return;this._resetNavigationDecorations();let n=this._themeService.getColorTheme().getColor(WNt),r=nse(e),s=t?nse(t)-r+1:1;for(let l=0;l<s;l++){let c=this._terminal.registerDecoration({marker:this._createMarkerForOffset(e,l),width:this._terminal.cols,overviewRulerOptions:l===0?{color:n?.toString()||"#a0a0a0cc"}:void 0});if(c){this._navigationDecorations?.push(c);let u;c.onRender(p=>{u?p.classList.add("terminal-scroll-highlight"):(u=p,p.classList.add("terminal-scroll-highlight"),o&&p.classList.add("terminal-scroll-highlight-outline"),l===0&&p.classList.add("top"),l===s-1&&p.classList.add("bottom")),this._terminal?.element&&(p.style.marginLeft=`-${Me(this._terminal.element).getComputedStyle(this._terminal.element).paddingLeft}`)}),c.onDispose(()=>{this._navigationDecorations=this._navigationDecorations?.filter(p=>p!==c)}),o&&Li(350).then(()=>{u&&u.classList.remove("terminal-scroll-highlight-outline")})}}}scrollToLine(e,t){this._terminal?.scrollToLine(this.getTargetScrollLine(e,t))}getTargetScrollLine(e,t){return this._terminal&&t===1?Math.max(e-Math.floor(this._terminal.rows/4),0):e}_isMarkerInViewport(e,t){let o=e.buffer.active.viewportY,n=nse(t);return n>=o&&n<o+e.rows}scrollToClosestMarker(e,t,o){let n=this._capabilities.get(4);if(!n)return;let r=n.getMark(e);if(!r)return;let s=t?n.getMark(t):r;this._scrollToMarker(r,0,s,{hideDecoration:!o})}selectToPreviousMark(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this._capabilities.has(2)?this.scrollToPreviousMark(1,!0,!0):this.scrollToPreviousMark(1,!0,!1),HQt(this._terminal,this._currentMarker,this._selectionStart))}selectToNextMark(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this._capabilities.has(2)?this.scrollToNextMark(1,!0,!0):this.scrollToNextMark(1,!0,!1),HQt(this._terminal,this._currentMarker,this._selectionStart))}selectToPreviousLine(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this.scrollToPreviousLine(this._terminal,1,!0),HQt(this._terminal,this._currentMarker,this._selectionStart))}selectToNextLine(){this._terminal&&(this._selectionStart===null&&(this._selectionStart=this._currentMarker),this.scrollToNextLine(this._terminal,1,!0),HQt(this._terminal,this._currentMarker,this._selectionStart))}scrollToPreviousLine(e,t=1,o=!1){if(o||(this._selectionStart=null),this._currentMarker===0){e.scrollToTop();return}if(this._currentMarker===1)this._currentMarker=this._registerMarkerOrThrow(e,this._getOffset(e)-1);else{let n=this._getOffset(e);this._isDisposable&&this._currentMarker.dispose(),this._currentMarker=this._registerMarkerOrThrow(e,n-1)}this._isDisposable=!0,this._scrollToMarker(this._currentMarker,t)}scrollToNextLine(e,t=1,o=!1){if(o||(this._selectionStart=null),this._currentMarker===1){e.scrollToBottom();return}if(this._currentMarker===0)this._currentMarker=this._registerMarkerOrThrow(e,this._getOffset(e)+1);else{let n=this._getOffset(e);this._isDisposable&&this._currentMarker.dispose(),this._currentMarker=this._registerMarkerOrThrow(e,n+1)}this._isDisposable=!0,this._scrollToMarker(this._currentMarker,t)}_registerMarkerOrThrow(e,t){let o=e.registerMarker(t);if(!o)throw new Error(`Could not create marker for ${t}`);return o}_getOffset(e){if(this._currentMarker===1)return 0;if(this._currentMarker===0)return 0-(e.buffer.active.baseY+e.buffer.active.cursorY);{let t=Fdt(e,this._currentMarker);return t-=e.buffer.active.baseY+e.buffer.active.cursorY,t}}_findPreviousMarker(e=!1){if(this._currentMarker===0)return 0;if(this._currentMarker===1)return this._getMarkers(e).length-1;let t;for(t=this._getMarkers(e).length-1;t>=0;t--)if(this._getMarkers(e)[t].line<this._currentMarker.line)return t;return-1}_findNextMarker(e=!1){if(this._currentMarker===0)return 0;if(this._currentMarker===1)return this._getMarkers(e).length-1;let t;for(t=0;t<this._getMarkers(e).length;t++)if(this._getMarkers(e)[t].line>this._currentMarker.line)return t;return this._getMarkers(e).length}};sze=I([m(1,B),m(2,Pe)],sze);function Fdt(a,i){return i===1?a.buffer.active.baseY+a.rows-1:i===0?0:i.line}function HQt(a,i,e){e===null&&(e=1);let t=Fdt(a,i),o=Fdt(a,e);if(t>o){let n=t;t=o,o=n}o-=1,a.selectLines(t,o)}function ZAo(a){return typeof a!="number"}function nse(a){return ZAo(a)?a.line:a}var hSe=class extends k{constructor(e,t){super();this._terminal=e;this._logService=t;this.type=2;this._commands=[];this._commandMarkers=[];this.__isCommandStorageDisabled=!1;this._hasRichCommandDetection=!1;this._onCommandStarted=this._register(new T);this.onCommandStarted=this._onCommandStarted.event;this._onCommandStartChanged=this._register(new T);this.onCommandStartChanged=this._onCommandStartChanged.event;this._onBeforeCommandFinished=this._register(new T);this.onBeforeCommandFinished=this._onBeforeCommandFinished.event;this._onCommandFinished=this._register(new T);this.onCommandFinished=this._onCommandFinished.event;this._onCommandExecuted=this._register(new T);this.onCommandExecuted=this._onCommandExecuted.event;this._onCommandInvalidated=this._register(new T);this.onCommandInvalidated=this._onCommandInvalidated.event;this._onCurrentCommandInvalidated=this._register(new T);this.onCurrentCommandInvalidated=this._onCurrentCommandInvalidated.event;this._onSetRichCommandDetection=this._register(new T);this.onSetRichCommandDetection=this._onSetRichCommandDetection.event;this._currentCommand=new Odt(this._terminal),this._promptInputModel=this._register(new ive(this._terminal,this.onCommandStarted,this.onCommandStartChanged,this.onCommandExecuted,this.onCommandFinished,this._logService)),this._register(this.onCommandExecuted(n=>{if(n.commandLineConfidence!=="high"){let r=n;n.command=r.extractCommandLine(),n.commandLineConfidence="low",XC(r)?r.promptStartMarker&&r.marker&&r.executedMarker&&n.command.indexOf(`
`)===-1&&r.startX!==void 0&&r.startX>0&&(n.commandLineConfidence="medium"):r.promptStartMarker&&r.commandStartMarker&&r.commandExecutedMarker&&n.command.indexOf(`
`)===-1&&r.commandStartX!==void 0&&r.commandStartX>0&&(n.commandLineConfidence="medium")}})),this._register(this._terminal.parser.registerCsiHandler({final:"J"},n=>(n.length>=1&&n[0]===2&&(this._terminal.options.scrollOnEraseInDisplay||this._clearCommandsInViewport(),this._currentCommand.wasCleared=!0),!1)));let o=this;this._ptyHeuristicsHooks=new class{get onCurrentCommandInvalidatedEmitter(){return o._onCurrentCommandInvalidated}get onCommandStartedEmitter(){return o._onCommandStarted}get onCommandExecutedEmitter(){return o._onCommandExecuted}get dimensions(){return o._dimensions}get isCommandStorageDisabled(){return o.__isCommandStorageDisabled}get commandMarkers(){return o._commandMarkers}set commandMarkers(n){o._commandMarkers=n}get clearCommandsInViewport(){return o._clearCommandsInViewport.bind(o)}},this._ptyHeuristics=this._register(new _vt(new Wdt(this._terminal,this,this._ptyHeuristicsHooks,this._logService))),this._dimensions={cols:this._terminal.cols,rows:this._terminal.rows},this._register(this._terminal.onResize(n=>this._handleResize(n))),this._register(this._terminal.onCursorMove(()=>this._handleCursorMove()))}get promptInputModel(){return this._promptInputModel}get hasRichCommandDetection(){return this._hasRichCommandDetection}get commands(){return this._commands}get executingCommand(){return this._currentCommand.command}get executingCommandObject(){if(this._currentCommand.commandStartMarker)return this._currentCommand.promoteToFullCommand(this._cwd,void 0,this._handleCommandStartOptions?.ignoreCommandLine??!1,void 0)}get executingCommandConfidence(){let e=this._currentCommand;return XC(e)?e.commandLineConfidence:void 0}get currentCommand(){return this._currentCommand}get cwd(){return this._cwd}get promptTerminator(){return this._promptTerminator}_handleResize(e){this._ptyHeuristics.value.preHandleResize?.(e),this._dimensions.cols=e.cols,this._dimensions.rows=e.rows}_handleCursorMove(){this._store.isDisposed||this._terminal.buffer.active===this._terminal.buffer.normal&&this._currentCommand.commandStartMarker&&this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY<this._currentCommand.commandStartMarker.line&&(this._clearCommandsInViewport(),this._currentCommand.isInvalid=!0,this._onCurrentCommandInvalidated.fire({reason:"windows"}))}_clearCommandsInViewport(){let e=0;for(let t=this._commands.length-1;t>=0;t--){let o=this._commands[t].marker?.line;if(o&&o<this._terminal.buffer.active.baseY)break;e++}e>0&&this._onCommandInvalidated.fire(this._commands.splice(this._commands.length-e,e))}setContinuationPrompt(e){this._promptInputModel.setContinuationPrompt(e)}setPromptTerminator(e,t){this._logService.debug("CommandDetectionCapability#setPromptTerminator",e),this._promptTerminator=e,this._promptInputModel.setLastPromptLine(t)}setCwd(e){this._cwd=e}setIsWindowsPty(e){if(e&&!(this._ptyHeuristics.value instanceof gSe)){let t=this;this._ptyHeuristics.value=new gSe(this._terminal,this,new class{get onCurrentCommandInvalidatedEmitter(){return t._onCurrentCommandInvalidated}get onCommandStartedEmitter(){return t._onCommandStarted}get onCommandExecutedEmitter(){return t._onCommandExecuted}get dimensions(){return t._dimensions}get isCommandStorageDisabled(){return t.__isCommandStorageDisabled}get commandMarkers(){return t._commandMarkers}set commandMarkers(o){t._commandMarkers=o}get clearCommandsInViewport(){return t._clearCommandsInViewport.bind(t)}},this._logService)}else!e&&!(this._ptyHeuristics.value instanceof Wdt)&&(this._ptyHeuristics.value=new Wdt(this._terminal,this,this._ptyHeuristicsHooks,this._logService))}setHasRichCommandDetection(e){this._hasRichCommandDetection=e,this._onSetRichCommandDetection.fire(e)}setIsCommandStorageDisabled(){this.__isCommandStorageDisabled=!0}getCommandForLine(e){if(this._currentCommand.promptStartMarker&&e>=this._currentCommand.promptStartMarker?.line)return this._currentCommand;if(this._commands.length!==0&&!((this._commands[0].promptStartMarker??this._commands[0].marker).line>e)){for(let t=this.commands.length-1;t>=0;t--)if((this.commands[t].promptStartMarker??this.commands[t].marker).line<=e)return this.commands[t]}}getCwdForLine(e){if(this._currentCommand.promptStartMarker&&e>=this._currentCommand.promptStartMarker?.line)return this._cwd;let t=this.getCommandForLine(e);if(t&&XC(t))return t.cwd}handlePromptStart(e){let t=this.commands.at(-1);t?.endMarker&&t?.executedMarker&&t.endMarker.line===t.executedMarker.line&&t.executedMarker.line<this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY&&(this._logService.debug("CommandDetectionCapability#handlePromptStart adjusted commandFinished",`${t.endMarker.line} -> ${t.executedMarker.line+1}`),t.endMarker=Vdt(this._terminal,t.executedMarker,1)),this._currentCommand.promptStartMarker=e?.marker||(!this._currentCommand.wasCleared&&t?.endMarker?Vdt(this._terminal,t.endMarker):this._terminal.registerMarker(0)),this._currentCommand.wasCleared=!1}handleContinuationStart(){this._currentCommand.currentContinuationMarker=this._terminal.registerMarker(0),this._logService.debug("CommandDetectionCapability#handleContinuationStart",this._currentCommand.currentContinuationMarker)}handleContinuationEnd(){if(!this._currentCommand.currentContinuationMarker){this._logService.warn("CommandDetectionCapability#handleContinuationEnd Received continuation end without start");return}this._currentCommand.continuations||(this._currentCommand.continuations=[]),this._currentCommand.continuations.push({marker:this._currentCommand.currentContinuationMarker,end:this._terminal.buffer.active.cursorX}),this._currentCommand.currentContinuationMarker=void 0,this._logService.debug("CommandDetectionCapability#handleContinuationEnd",this._currentCommand.continuations[this._currentCommand.continuations.length-1])}handleRightPromptStart(){this._currentCommand.commandRightPromptStartX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleRightPromptStart",this._currentCommand.commandRightPromptStartX)}handleRightPromptEnd(){this._currentCommand.commandRightPromptEndX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleRightPromptEnd",this._currentCommand.commandRightPromptEndX)}handleCommandStart(e){if(this._handleCommandStartOptions=e,this._currentCommand.cwd=this._cwd,this._currentCommand.commandStartMarker=e?.marker||this._currentCommand.commandStartMarker,this._currentCommand.commandStartMarker?.line===this._terminal.buffer.active.cursorY){this._currentCommand.commandStartX=this._terminal.buffer.active.cursorX,this._onCommandStartChanged.fire(),this._logService.debug("CommandDetectionCapability#handleCommandStart",this._currentCommand.commandStartX,this._currentCommand.commandStartMarker?.line);return}this._ptyHeuristics.value.handleCommandStart(e)}setNextCommandId(e,t){this._nextCommandId={command:e,commandId:t}}handleCommandExecuted(e){this._ensureCurrentCommandId(this._currentCommand.command??this._currentCommand.extractCommandLine()),this._ptyHeuristics.value.handleCommandExecuted(e),this._currentCommand.markExecutedTime()}handleCommandFinished(e,t){if(this._currentCommand.commandExecutedMarker||this.handleCommandExecuted(),this._currentCommand.markFinishedTime(),this._ptyHeuristics.value.preHandleCommandFinished?.(),this._logService.debug("CommandDetectionCapability#handleCommandFinished",this._terminal.buffer.active.cursorX,t?.marker?.line,this._currentCommand.command,this._currentCommand),e===void 0){let n=this.commands.length>0?this.commands[this.commands.length-1]:void 0;this._currentCommand.command&&this._currentCommand.command.length>0&&n?.command===this._currentCommand.command&&(e=n.exitCode)}if(this._currentCommand.commandStartMarker===void 0||!this._terminal.buffer.active)return;this._currentCommand.commandFinishedMarker=t?.marker||this._terminal.registerMarker(0),this._ptyHeuristics.value.postHandleCommandFinished?.();let o=this._currentCommand.promoteToFullCommand(this._cwd,e,this._handleCommandStartOptions?.ignoreCommandLine??!1,t?.markProperties);o&&(this._commands.push(o),this._onBeforeCommandFinished.fire(o),this._logService.debug("CommandDetectionCapability#onCommandFinished",o),this._onCommandFinished.fire(o)),this._currentCommand=new Odt(this._terminal),this._handleCommandStartOptions=void 0}_ensureCurrentCommandId(e){this._nextCommandId?.commandId&&(this._currentCommand.id!==this._nextCommandId.commandId&&(this._currentCommand.id=this._nextCommandId.commandId),this._nextCommandId=void 0)}setCommandLine(e,t){this._logService.debug("CommandDetectionCapability#setCommandLine",e,t),this._currentCommand.command=e,this._currentCommand.commandLineConfidence="high",this._currentCommand.isTrusted=t,t&&this._promptInputModel.setConfidentCommandLine(e)}serialize(){let e=this.commands.map(o=>o.serialize(this.__isCommandStorageDisabled)),t=this._currentCommand.serialize(this._cwd);return t&&e.push(t),{isWindowsPty:this._ptyHeuristics.value instanceof gSe,hasRichCommandDetection:this._hasRichCommandDetection,commands:e,promptInputModel:this._promptInputModel.serialize()}}deserialize(e){e.isWindowsPty&&this.setIsWindowsPty(e.isWindowsPty),e.hasRichCommandDetection&&this.setHasRichCommandDetection(e.hasRichCommandDetection);let t=this._terminal.buffer.normal;for(let o of e.commands){if(!o.endLine){let r=o.startLine!==void 0?this._terminal.registerMarker(o.startLine-(t.baseY+t.cursorY)):void 0;if(!r)continue;this._currentCommand.commandStartMarker=o.startLine!==void 0?this._terminal.registerMarker(o.startLine-(t.baseY+t.cursorY)):void 0,this._currentCommand.commandStartX=o.startX,this._currentCommand.promptStartMarker=o.promptStartLine!==void 0?this._terminal.registerMarker(o.promptStartLine-(t.baseY+t.cursorY)):void 0,this._cwd=o.cwd,this._onCommandStarted.fire({marker:r});continue}let n=Ndt.deserialize(this._terminal,o,this.__isCommandStorageDisabled);n&&(this._commands.push(n),this._logService.debug("CommandDetectionCapability#onCommandFinished",n),this._onCommandFinished.fire(n))}e.promptInputModel&&this._promptInputModel.deserialize(e.promptInputModel)}};I([Tu(500)],hSe.prototype,"_handleCursorMove",1),hSe=I([m(1,re)],hSe);var Wdt=class extends k{constructor(e,t,o,n){super();this._terminal=e;this._capability=t;this._hooks=o;this._logService=n}handleCommandStart(e){let t=this._capability.currentCommand;t.commandStartX=this._terminal.buffer.active.cursorX,t.commandStartMarker=e?.marker||this._terminal.registerMarker(0),t.commandExecutedMarker?.dispose(),t.commandExecutedMarker=void 0,t.commandExecutedX=void 0;for(let o of this._hooks.commandMarkers)o.dispose();this._hooks.commandMarkers.length=0,this._hooks.onCommandStartedEmitter.fire({marker:e?.marker||t.commandStartMarker,markProperties:e?.markProperties}),this._logService.debug("CommandDetectionCapability#handleCommandStart",t.commandStartX,t.commandStartMarker?.line)}handleCommandExecuted(e){let t=this._capability.currentCommand;t.commandExecutedMarker=e?.marker||this._terminal.registerMarker(0),t.commandExecutedX=this._terminal.buffer.active.cursorX,this._logService.debug("CommandDetectionCapability#handleCommandExecuted",t.commandExecutedX,t.commandExecutedMarker?.line),!(!t.commandStartMarker||!t.commandExecutedMarker||t.commandStartX===void 0)&&(t.command=this._capability.promptInputModel.ghostTextIndex>-1?this._capability.promptInputModel.value.substring(0,this._capability.promptInputModel.ghostTextIndex):this._capability.promptInputModel.value,this._hooks.onCommandExecutedEmitter.fire(t))}};var gSe=class extends k{constructor(e,t,o,n){super();this._terminal=e;this._capability=t;this._hooks=o;this._logService=n;this._onCursorMoveListener=this._register(new ue);this._tryAdjustCommandStartMarkerScannedLineCount=0;this._tryAdjustCommandStartMarkerPollCount=0;this._register(this._capability.onBeforeCommandFinished(r=>{(r.command.trim().toLowerCase()==="clear"||r.command.trim().toLowerCase()==="cls")&&(this._tryAdjustCommandStartMarkerScheduler?.cancel(),this._tryAdjustCommandStartMarkerScheduler=void 0,this._hooks.clearCommandsInViewport(),this._capability.currentCommand.isInvalid=!0,this._hooks.onCurrentCommandInvalidatedEmitter.fire({reason:"windows"}))}))}preHandleResize(e){let t=this._terminal.buffer.active.baseY,o=e.rows-this._hooks.dimensions.rows;o>0&&this._waitForCursorMove().then(()=>{let n=Math.min(o,t);for(let r=this._capability.commands.length-1;r>=0;r--){let s=this._capability.commands[r];if(!s.marker||s.marker.line<t||s.commandStartLineContent===void 0)break;let l=this._terminal.buffer.active.getLine(s.marker.line);if(!l||l.translateToString(!0)===s.commandStartLineContent)continue;let c=s.marker.line-n;this._terminal.buffer.active.getLine(c)?.translateToString(!0)===s.commandStartLineContent&&this._terminal._core._bufferService.buffer.lines.onDeleteEmitter.fire({index:this._terminal.buffer.active.baseY,amount:n})}})}handleCommandStart(){this._capability.currentCommand.commandStartX=this._terminal.buffer.active.cursorX,this._hooks.commandMarkers.length=0;let e=this._capability.currentCommand.commandStartMarker=this._capability.currentCommand.promptStartMarker?Vdt(this._terminal,this._capability.currentCommand.promptStartMarker):this._terminal.registerMarker(0);this._capability.currentCommand.commandStartX=0,this._tryAdjustCommandStartMarkerScannedLineCount=0,this._tryAdjustCommandStartMarkerPollCount=0,this._tryAdjustCommandStartMarkerScheduler=new Dt(()=>this._tryAdjustCommandStartMarker(e),20),this._tryAdjustCommandStartMarkerScheduler.schedule()}_tryAdjustCommandStartMarker(e){if(this._store.isDisposed)return;let t=this._terminal.buffer.active,o=this._tryAdjustCommandStartMarkerScannedLineCount;for(;o<10&&e.line+o<t.baseY+this._terminal.rows;){if(this._cursorOnNextLine()){let n=this._getWindowsPrompt(e.line+o);if(n){let r=We(n)?n:n.prompt;if(this._capability.currentCommand.commandStartMarker=this._terminal.registerMarker(0),!We(n)&&n.likelySingleLine){this._logService.debug("CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted promptStart",`${this._capability.currentCommand.promptStartMarker?.line} -> ${this._capability.currentCommand.commandStartMarker.line}`),this._capability.currentCommand.promptStartMarker?.dispose(),this._capability.currentCommand.promptStartMarker=Vdt(this._terminal,this._capability.currentCommand.commandStartMarker);let s=this._capability.commands.at(-1);s&&this._capability.currentCommand.commandStartMarker.line!==s.endMarker?.line&&(s.endMarker?.dispose(),s.endMarker=Vdt(this._terminal,this._capability.currentCommand.commandStartMarker))}this._capability.currentCommand.commandStartX=r.length,this._logService.debug("CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted commandStart",`${e.line} -> ${this._capability.currentCommand.commandStartMarker.line}:${this._capability.currentCommand.commandStartX}`),this._flushPendingHandleCommandStartTask();return}}o++}o<10?(this._tryAdjustCommandStartMarkerScannedLineCount=o,++this._tryAdjustCommandStartMarkerPollCount<10?this._tryAdjustCommandStartMarkerScheduler?.schedule():this._flushPendingHandleCommandStartTask()):this._flushPendingHandleCommandStartTask()}_flushPendingHandleCommandStartTask(){if(this._tryAdjustCommandStartMarkerScheduler&&(this._tryAdjustCommandStartMarkerPollCount=10,this._tryAdjustCommandStartMarkerScheduler.flush(),this._tryAdjustCommandStartMarkerScheduler=void 0),this._capability.currentCommand.commandExecutedMarker||(this._onCursorMoveListener.value=this._terminal.onCursorMove(()=>{if(this._hooks.commandMarkers.length===0||this._hooks.commandMarkers[this._hooks.commandMarkers.length-1].line!==this._terminal.buffer.active.cursorY){let e=this._terminal.registerMarker(0);e&&this._hooks.commandMarkers.push(e)}})),this._capability.currentCommand.commandStartMarker){let e=this._terminal.buffer.active.getLine(this._capability.currentCommand.commandStartMarker.line);e&&(this._capability.currentCommand.commandStartLineContent=e.translateToString(!0))}this._hooks.onCommandStartedEmitter.fire({marker:this._capability.currentCommand.commandStartMarker}),this._logService.debug("CommandDetectionCapability#_handleCommandStartWindows",this._capability.currentCommand.commandStartX,this._capability.currentCommand.commandStartMarker?.line)}handleCommandExecuted(e){this._tryAdjustCommandStartMarkerScheduler&&this._flushPendingHandleCommandStartTask(),this._onCursorMoveListener.clear(),this._evaluateCommandMarkers(),this._capability.currentCommand.commandExecutedX=this._terminal.buffer.active.cursorX,this._hooks.onCommandExecutedEmitter.fire(this._capability.currentCommand),this._logService.debug("CommandDetectionCapability#handleCommandExecuted",this._capability.currentCommand.commandExecutedX,this._capability.currentCommand.commandExecutedMarker?.line)}preHandleCommandFinished(){this._capability.currentCommand.commandExecutedMarker||(this._hooks.commandMarkers.length===0&&(this._capability.currentCommand.commandStartMarker||(this._capability.currentCommand.commandStartMarker=this._terminal.registerMarker(0)),this._capability.currentCommand.commandStartMarker&&this._hooks.commandMarkers.push(this._capability.currentCommand.commandStartMarker)),this._evaluateCommandMarkers())}postHandleCommandFinished(){let e=this._capability.currentCommand,t=e.command,o=e.commandStartMarker?.line,n=e.commandExecutedMarker?.line;if(!t||t.length===0||o===void 0||o===-1||n===void 0||n===-1)return;let r=0,s=!1;for(let l=o;l<=n;l++){let c=this._terminal.buffer.active.getLine(l);if(!c)break;let u=c.translateToString(!0);for(let p=0;p<u.length;p++){for(;t.length<r&&t[r]===" ";)r++;if(u[p]===t[r]&&r++,r===t.length){let h=p>=this._terminal.cols-1;e.commandExecutedMarker=this._terminal.registerMarker(l-(this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY)+(h?1:0)),e.commandExecutedX=h?0:p+1,s=!0;break}}if(s)break}}_evaluateCommandMarkers(){if(this._hooks.commandMarkers.length!==0){if(this._hooks.commandMarkers=this._hooks.commandMarkers.sort((e,t)=>e.line-t.line),this._capability.currentCommand.commandStartMarker=this._hooks.commandMarkers[0],this._capability.currentCommand.commandStartMarker){let e=this._terminal.buffer.active.getLine(this._capability.currentCommand.commandStartMarker.line);e&&(this._capability.currentCommand.commandStartLineContent=e.translateToString(!0))}this._capability.currentCommand.commandExecutedMarker=this._hooks.commandMarkers[this._hooks.commandMarkers.length-1],this._hooks.onCommandExecutedEmitter.fire(this._capability.currentCommand)}}_cursorOnNextLine(){let e=this._capability.commands.at(-1);if(!e)return!0;let t=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,o=(e.endMarker?e.endMarker.line:e.marker?.line)??-1;return t>o}_waitForCursorMove(){let e=this._terminal.buffer.active.cursorX,t=this._terminal.buffer.active.cursorY,o=0;return new Promise((n,r)=>{let s=setInterval(()=>{if(e!==this._terminal.buffer.active.cursorX||t!==this._terminal.buffer.active.cursorY){n(),clearInterval(s);return}o+=10,o>1e3&&(clearInterval(s),n())},10)})}_getWindowsPrompt(e=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY){let t=this._terminal.buffer.active.getLine(e);if(!t)return;let o=t.translateToString(!0);if(!o)return;let n=o.match(/(?<prompt>(\(.+\)\s)?(?:PS.+>\s?))/)?.groups?.prompt;if(n){let u=this._adjustPrompt(n,o,">");if(u)return{prompt:u,likelySingleLine:!0}}let r=o.match(/.*\u276f(?=[^\u276f]*$)/g)?.[0];if(r){let u=this._adjustPrompt(r,o,"\u276F");if(u)return u}let s=o.match(/^(?<prompt>\$)/)?.groups?.prompt;if(s){let u=this._adjustPrompt(s,o,"$");if(u)return u}let l=o.match(/^(?<prompt>>>> )/g)?.groups?.prompt;if(l)return{prompt:l,likelySingleLine:!0};if(this._capability.promptTerminator&&(o===this._capability.promptTerminator||o.trim().endsWith(this._capability.promptTerminator))){let u=this._adjustPrompt(o,o,this._capability.promptTerminator);if(u)return u}let c=o.match(/^(?<prompt>(\(.+\)\s)?(?:[A-Z]:\\.*>))/);return c?.groups?.prompt?{prompt:c.groups.prompt,likelySingleLine:!0}:void 0}_adjustPrompt(e,t,o){if(e)return t===e&&e.endsWith(o)&&(e+=" "),e}};gSe=I([m(3,re)],gSe);function MUi(a,i,e,t){if(!t)return;let o=i.executedMarker,n=i.endMarker;if(!o||!n)return;let r=o.line,s=n.line,l=t.length,c=[];if(t.anchor==="bottom")for(let u=s-(t.offset||0);u>=r;u--){let p=u,h=u;for(;p>=r&&a.getLine(p)?.isWrapped;)p--;u=p,c.unshift(eNo(a,p,h,e)),c.length>l&&c.pop()}else for(let u=r+(t.offset||0);u<s;u++){let p=u,h=u;for(;h+1<s&&a.getLine(h+1)?.isWrapped;)h++;u=h,c.push(eNo(a,p,h,e)),c.length===l&&c.shift()}return c}function eNo(a,i,e,t){let o=Math.max(2048/t*2);e=Math.min(e,i+o);let n="";for(let r=i;r<=e;r++){let s=a.getLine(r);s&&(n+=s.translateToString(!0,0,t))}return n}function Vdt(a,i,e=0){return a.registerMarker(i.line-(a.buffer.active.baseY+a.buffer.active.cursorY)+e)}var UQt=class extends k{constructor(){super(...arguments);this.type=0;this._cwd="";this._cwds=new Map;this._onDidChangeCwd=this._register(new T);this.onDidChangeCwd=this._onDidChangeCwd.event}get cwds(){return Array.from(this._cwds.keys())}getCwd(){return this._cwd}updateCwd(e){let t=this._cwd!==e;this._cwd=e;let o=this._cwds.get(this._cwd)||0;this._cwds.delete(this._cwd),this._cwds.set(this._cwd,o+1),t&&this._onDidChangeCwd.fire(e)}};var zQt=class extends O{constructor(e,t){super();this._terminal=e;this._onDidExecuteText=t;this.type=3;this._commands=[];this._onCommandFinished=this.add(new T);this.onCommandFinished=this._onCommandFinished.event;this.add(this._terminal.onData(o=>this._onData(o))),this.add(this._terminal.parser.registerCsiHandler({final:"J"},o=>(o.length>=1&&(o[0]===2||o[0]===3)&&this._clearCommandsInViewport(),!1))),this._onDidExecuteText&&this.add(this._onDidExecuteText(()=>this._onEnter()))}get commands(){return this._commands}_onData(e){e==="\r"&&this._onEnter()}_onEnter(){if(this._terminal&&this._terminal.buffer.active.cursorX>=2){let e=this._terminal.registerMarker(0);e&&(this._commands.push(e),this._onCommandFinished.fire(e))}}_clearCommandsInViewport(){let e=0;for(let t=this._commands.length-1;t>=0&&!(this._commands[t].line<this._terminal.buffer.active.baseY);t--)e++;this._commands.splice(this._commands.length-e,e)}};var KQt=class extends k{constructor(e){super();this._terminal=e;this.type=4;this._idToMarkerMap=new Map;this._anonymousMarkers=new Map;this._onMarkAdded=this._register(new T);this.onMarkAdded=this._onMarkAdded.event}*markers(){for(let e of this._idToMarkerMap.values())yield e;for(let e of this._anonymousMarkers.values())yield e}addMark(e){let t=e?.marker||this._terminal.registerMarker(),o=e?.id;t&&(o?(this._idToMarkerMap.set(o,t),t.onDispose(()=>this._idToMarkerMap.delete(o))):(this._anonymousMarkers.set(t.id,t),t.onDispose(()=>this._anonymousMarkers.delete(t.id))),this._onMarkAdded.fire({marker:t,id:o,hidden:e?.hidden,hoverMessage:e?.hoverMessage}))}getMark(e){return this._idToMarkerMap.get(e)}};var GQt=class extends k{constructor(){super(...arguments);this.type=5;this._env={value:new Map,isTrusted:!0};this._onDidChangeEnv=this._register(new T);this.onDidChangeEnv=this._onDidChangeEnv.event}get env(){return this._createStateObject()}setEnvironment(e,t){if(!Qi(this.env.value,e)){this._env.value.clear();for(let[o,n]of Object.entries(e))n!==void 0&&this._env.value.set(o,n);this._env.isTrusted=t,this._fireEnvChange()}}startEnvironmentSingleVar(e,t){e?this._pendingEnv={value:new Map,isTrusted:t}:this._pendingEnv={value:new Map(this._env.value),isTrusted:this._env.isTrusted&&t}}setEnvironmentSingleVar(e,t,o){this._pendingEnv&&e!==void 0&&t!==void 0&&(this._pendingEnv.value.set(e,t),this._pendingEnv.isTrusted&&=o)}endEnvironmentSingleVar(e){if(!this._pendingEnv)return;this._pendingEnv.isTrusted&&=e,!Cle(this._env.value,this._pendingEnv.value)&&(this._env=this._pendingEnv,this._fireEnvChange()),this._pendingEnv=void 0}deleteEnvironmentSingleVar(e,t,o){this._pendingEnv&&e!==void 0&&t!==void 0&&(this._pendingEnv.value.delete(e),this._pendingEnv.isTrusted&&=o)}_fireEnvChange(){this._onDidChangeEnv.fire(this._createStateObject())}_createStateObject(){return{value:Object.fromEntries(this._env.value),isTrusted:this._env.isTrusted}}};var qQt=class extends k{constructor(){super(...arguments);this.type=6;this._onPromptTypeChanged=this._register(new T);this.onPromptTypeChanged=this._onPromptTypeChanged.event}get promptType(){return this._promptType}setPromptType(e){this._promptType=e,this._onPromptTypeChanged.fire(e)}};var $Qt=class extends k{constructor(e,t,o,n,r){super();this._nonce=e;this._disableTelemetry=t;this._onDidExecuteText=o;this._telemetryService=n;this._logService=r;this.capabilities=this._register(new fk);this._hasUpdatedTelemetry=!1;this._commonProtocolDisposables=[];this._seenSequences=new Set;this._status=0;this._onDidChangeStatus=this._register(new T);this.onDidChangeStatus=this._onDidChangeStatus.event;this._onDidChangeSeenSequences=this._register(new T);this.onDidChangeSeenSequences=this._onDidChangeSeenSequences.event;this._register(ee(()=>{this._clearActivationTimeout(),this._disposeCommonProtocol()}))}get seenSequences(){return this._seenSequences}get status(){return this._status}_disposeCommonProtocol(){je(this._commonProtocolDisposables),this._commonProtocolDisposables.length=0}activate(e){this._terminal=e,this.capabilities.add(3,this._register(new zQt(this._terminal,this._onDidExecuteText))),this._register(e.parser.registerOscHandler(633,t=>this._handleVSCodeSequence(t))),this._register(e.parser.registerOscHandler(1337,t=>this._doHandleITermSequence(t))),this._commonProtocolDisposables.push(e.parser.registerOscHandler(133,t=>this._handleFinalTermSequence(t))),this._register(e.parser.registerOscHandler(7,t=>this._doHandleSetCwd(t))),this._register(e.parser.registerOscHandler(9,t=>this._doHandleSetWindowsFriendlyCwd(t))),this._ensureCapabilitiesOrAddFailureTelemetry()}getMarkerId(e,t){this._createOrGetBufferMarkDetection(e).getMark(t)}setNextCommandId(e,t){this._terminal&&this._createOrGetCommandDetection(this._terminal).setNextCommandId(e,t)}_markSequenceSeen(e){this._seenSequences.has(e)||(this._seenSequences.add(e),this._onDidChangeSeenSequences.fire(this._seenSequences))}_handleFinalTermSequence(e){let t=this._doHandleFinalTermSequence(e);return this._status===0&&(this._status=1,this._onDidChangeStatus.fire(this._status)),t}_doHandleFinalTermSequence(e){if(!this._terminal)return!1;let[t,...o]=e.split(";");switch(this._logService.trace(`ShellIntegrationAddon#_doHandleFinalTermSequence: received sequence ${t}`),this._markSequenceSeen(t),t){case"A":return this._createOrGetCommandDetection(this._terminal).handlePromptStart(),!0;case"B":return this._createOrGetCommandDetection(this._terminal).handleCommandStart({ignoreCommandLine:!0}),!0;case"C":return this._createOrGetCommandDetection(this._terminal).handleCommandExecuted(),!0;case"D":{let n=o.length===1?parseInt(o[0]):void 0;return this._createOrGetCommandDetection(this._terminal).handleCommandFinished(n),!0}}return!1}_handleVSCodeSequence(e){let t=this._doHandleVSCodeSequence(e);return!this._hasUpdatedTelemetry&&t&&(this._telemetryService?.publicLog2("terminal/shellIntegrationActivationSucceeded"),this._hasUpdatedTelemetry=!0,this._clearActivationTimeout()),this._status!==2&&(this._status=2,this._onDidChangeStatus.fire(this._status)),t}async _ensureCapabilitiesOrAddFailureTelemetry(){!this._telemetryService||this._disableTelemetry||(this._activationTimeout=setTimeout(()=>{!this.capabilities.get(2)&&!this.capabilities.get(0)&&(this._telemetryService?.publicLog2("terminal/shellIntegrationActivationTimeout"),this._logService.warn("Shell integration failed to add capabilities within 10 seconds")),this._hasUpdatedTelemetry=!0},1e4))}_clearActivationTimeout(){this._activationTimeout!==void 0&&(clearTimeout(this._activationTimeout),this._activationTimeout=void 0)}_doHandleVSCodeSequence(e){if(!this._terminal)return!1;let t=e.indexOf(";"),o=t===-1?e:e.substring(0,t);this._logService.trace(`ShellIntegrationAddon#_doHandleVSCodeSequence: received sequence ${o}`),this._markSequenceSeen(o);let n=t===-1?[]:e.substring(t+1).split(";");switch(o){case"A":return this._createOrGetCommandDetection(this._terminal).handlePromptStart(),!0;case"B":return this._createOrGetCommandDetection(this._terminal).handleCommandStart(),!0;case"C":return this._createOrGetCommandDetection(this._terminal).handleCommandExecuted(),!0;case"D":{let r=n[0],s=r!==void 0?parseInt(r):void 0;return this._createOrGetCommandDetection(this._terminal).handleCommandFinished(s),!0}case"E":{let r=n[0],s=n[1],l;return r!==void 0?l=Bdt(r):l="",this._createOrGetCommandDetection(this._terminal).setCommandLine(l,s===this._nonce),!0}case"F":return this._createOrGetCommandDetection(this._terminal).handleContinuationStart(),!0;case"G":return this._createOrGetCommandDetection(this._terminal).handleContinuationEnd(),!0;case"EnvJson":{let r=n[0],s=n[1];if(r!==void 0)try{let l=JSON.parse(Bdt(r));this._createOrGetShellEnvDetection().setEnvironment(l,s===this._nonce)}catch{this._logService.warn("Failed to parse environment from shell integration sequence",r)}return!0}case"EnvSingleStart":return this._createOrGetShellEnvDetection().startEnvironmentSingleVar(n[0]==="1",n[1]===this._nonce),!0;case"EnvSingleDelete":{let r=n[0],s=n[1],l=n[2];if(r!==void 0&&s!==void 0){let c=Bdt(s);this._createOrGetShellEnvDetection().deleteEnvironmentSingleVar(r,c,l===this._nonce)}return!0}case"EnvSingleEntry":{let r=n[0],s=n[1],l=n[2];if(r!==void 0&&s!==void 0){let c=Bdt(s);this._createOrGetShellEnvDetection().setEnvironmentSingleVar(r,c,l===this._nonce)}return!0}case"EnvSingleEnd":return this._createOrGetShellEnvDetection().endEnvironmentSingleVar(n[0]===this._nonce),!0;case"H":return this._createOrGetCommandDetection(this._terminal).handleRightPromptStart(),!0;case"I":return this._createOrGetCommandDetection(this._terminal).handleRightPromptEnd(),!0;case"P":{let r=n[0],s=r!==void 0?Bdt(r):"",{key:l,value:c}=tNo(s);if(c===void 0)return!0;switch(l){case"ContinuationPrompt":return this._updateContinuationPrompt(Q3i(c)),!0;case"Cwd":return this._updateCwd(c),!0;case"IsWindows":return this._createOrGetCommandDetection(this._terminal).setIsWindowsPty(c==="True"),!0;case"HasRichCommandDetection":return this._createOrGetCommandDetection(this._terminal).setHasRichCommandDetection(c==="True"),!0;case"Prompt":{let u=c.replace(/\x1b\[[0-9;]*m/g,"");return this._updatePromptTerminator(u),!0}case"PromptType":return this._createOrGetPromptTypeDetection().setPromptType(c),!0;case"Task":return this._createOrGetBufferMarkDetection(this._terminal),this.capabilities.get(2)?.setIsCommandStorageDisabled(),!0}}case"SetMark":return this._createOrGetBufferMarkDetection(this._terminal).addMark(wCn(n)),!0}return!1}_updateContinuationPrompt(e){this._terminal&&this._createOrGetCommandDetection(this._terminal).setContinuationPrompt(e)}_updatePromptTerminator(e){if(!this._terminal)return;let t=e.substring(e.lastIndexOf(`
`)+1),n=t.trim().length===1?t:t.substring(t.lastIndexOf(" "));n&&this._createOrGetCommandDetection(this._terminal).setPromptTerminator(n,t)}_updateCwd(e){e=Tst(e),this._createOrGetCwdDetection().updateCwd(e),this.capabilities.get(2)?.setCwd(e)}_doHandleITermSequence(e){if(!this._terminal)return!1;let[t]=e.split(";");switch(this._markSequenceSeen(`1337;${t}`),t){case"SetMark":this._createOrGetBufferMarkDetection(this._terminal).addMark();default:{let{key:o,value:n}=tNo(t);if(n===void 0)return!0;if(o==="CurrentDir")return this._updateCwd(n),!0}}return!1}_doHandleSetWindowsFriendlyCwd(e){if(!this._terminal)return!1;let[t,...o]=e.split(";");return this._markSequenceSeen(`9;${t}`),t==="9"?(o.length&&this._updateCwd(o[0]),!0):!1}_doHandleSetCwd(e){if(!this._terminal)return!1;let[t]=e.split(";");if(this._markSequenceSeen(`7;${t}`),t.match(/^file:\/\/.*\//)){let o=A.parse(t);if(o.path&&o.path.length>0)return this._updateCwd(o.path),!0}return!1}serialize(){return!this._terminal||!this.capabilities.has(2)?{isWindowsPty:!1,hasRichCommandDetection:!1,commands:[],promptInputModel:void 0}:this._createOrGetCommandDetection(this._terminal).serialize()}deserialize(e){if(!this._terminal)throw new Error("Cannot restore commands before addon is activated");let t=this._createOrGetCommandDetection(this._terminal);t.deserialize(e),t.cwd&&this._updateCwd(t.cwd)}_createOrGetCwdDetection(){let e=this.capabilities.get(0);return e||(e=this._register(new UQt),this.capabilities.add(0,e)),e}_createOrGetCommandDetection(e){let t=this.capabilities.get(2);return t||(t=this._register(new hSe(e,this._logService)),this.capabilities.add(2,t)),t}_createOrGetBufferMarkDetection(e){let t=this.capabilities.get(4);return t||(t=this._register(new KQt(e)),this.capabilities.add(4,t)),t}_createOrGetShellEnvDetection(){let e=this.capabilities.get(5);return e||(e=this._register(new GQt),this.capabilities.add(5,e)),e}_createOrGetPromptTypeDetection(){let e=this.capabilities.get(6);return e||(e=this._register(new qQt),this.capabilities.add(6,e)),e}};function Bdt(a){return a.replaceAll(/\\(\\|x([0-9a-f]{2}))/gi,(i,e,t)=>t?String.fromCharCode(parseInt(t,16)):e)}function oNo(a){return a.replace(/[\\;\x00-\x20]/g,i=>i==="\\"?"\\\\":`\\x${i.charCodeAt(0).toString(16).padStart(2,"0")}`)}function tNo(a){let i=a.indexOf("=");return i===-1?{key:a,value:void 0}:{key:a.substring(0,i),value:a.substring(1+i)}}function wCn(a){let i,e=!1;for(let t of a)t!==void 0&&(t==="Hidden"&&(e=!0),t.startsWith("Id=")&&(i=t.substring(3)));return{id:i,hidden:e}}function G$(a){let[,i,e]=a.path.split("/");if(!i||!Number.parseInt(e))throw new Error(`Could not parse terminal uri for resource ${a}`);return{workspaceId:i,instanceId:Number.parseInt(e)}}function aze(a,i,e,t){let o=new URLSearchParams;return t&&o.set("command",t),A.from({scheme:Q.vscodeTerminal,path:`/${a}/${i}`,fragment:e||void 0,query:t?o.toString():void 0})}function lze(a){let i=a.dataTransfer?.getData("Terminals");if(i){let e=JSON.parse(i),t=[];for(let o of e)t.push(A.parse(o));return t.length===0?void 0:t}}function cze(a,i){if(i){for(let e of a)if(e.resource.path===i.path)return e}}var dze=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super();this._resource=e;this._capabilities=t;this._clipboardService=o;this._contextMenuService=n;this._configurationService=r;this._themeService=s;this._openerService=l;this._quickInputService=c;this._commandService=p;this._accessibilitySignalService=h;this._notificationService=g;this._hoverService=f;this._contextPickService=v;this._chatWidgetService=b;this._instantiationService=S;this._capabilityDisposables=this._register(new Ot);this._decorations=new Map;this._registeredMenuItems=new Map;this._onDidRequestRunCommand=this._register(new T);this.onDidRequestRunCommand=this._onDidRequestRunCommand.event;this._onDidRequestCopyAsHtml=this._register(new T);this.onDidRequestCopyAsHtml=this._onDidRequestCopyAsHtml.event;this._register(ee(()=>this._dispose())),this._register(this._configurationService.onDidChangeConfiguration(y=>{y.affectsConfiguration("terminal.integrated.fontSize")||y.affectsConfiguration("terminal.integrated.lineHeight")?this.refreshLayouts():y.affectsConfiguration("workbench.colorCustomizations")?this._refreshStyles(!0):y.affectsConfiguration("terminal.integrated.shellIntegration.decorationsEnabled")&&(this._removeCapabilityDisposables(2),this._updateDecorationVisibility())})),this._register(this._themeService.onDidColorThemeChange(()=>this._refreshStyles(!0))),this._updateDecorationVisibility(),this._register(this._capabilities.onDidAddCapability(y=>this._createCapabilityDisposables(y.id))),this._register(this._capabilities.onDidRemoveCapability(y=>this._removeCapabilityDisposables(y.id))),this._register(u.onWillShutdown(()=>this._disposeAllDecorations()))}_createCapabilityDisposables(e){let t=this._capabilities.get(e);if(!t||this._capabilityDisposables.has(e))return;let o=new O;switch(t.type){case 4:o.add(t.onMarkAdded(n=>this.registerMarkDecoration(n)));break;case 2:{let n=this._getCommandDetectionListeners(t);for(let r of n)o.add(r);break}}this._capabilityDisposables.set(e,o)}_removeCapabilityDisposables(e){this._capabilityDisposables.deleteAndDispose(e)}registerMarkDecoration(e){if(!(!this._terminal||!this._showGutterDecorations&&!this._showOverviewRulerDecorations)&&!e.hidden)return this.registerCommandDecoration(void 0,void 0,e)}_updateDecorationVisibility(){let e=this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled");this._showGutterDecorations=e==="both"||e==="gutter",this._showOverviewRulerDecorations=e==="both"||e==="overviewRuler",this._disposeAllDecorations(),(this._showGutterDecorations||this._showOverviewRulerDecorations)&&(this._attachToCommandCapability(),this._updateGutterDecorationVisibility());let t=this._capabilities.get(2)?.executingCommandObject;t&&this.registerCommandDecoration(t,!0)}_disposeAllDecorations(){this._placeholderDecoration?.dispose();for(let e of this._decorations.values())e.decoration.dispose(),je(e.disposables)}_updateGutterDecorationVisibility(){let e=this._terminal?.element?.querySelectorAll("terminal-command-decoration");if(e)for(let t of e)this._updateCommandDecorationVisibility(t)}_updateCommandDecorationVisibility(e){this._showGutterDecorations?e.classList.remove("hide"):e.classList.add("hide")}refreshLayouts(){LWe(this._configurationService,this._placeholderDecoration?.element);for(let e of this._decorations)LWe(this._configurationService,e[1].decoration.element)}_refreshStyles(e){if(e)for(let t of this._decorations.values()){let o=this._getDecorationCssColor(t.command)?.toString()??"";t.decoration.options?.overviewRulerOptions?t.decoration.options.overviewRulerOptions.color=o:t.decoration.options&&(t.decoration.options.overviewRulerOptions={color:o})}this._updateClasses(this._placeholderDecoration?.element);for(let t of this._decorations.values())this._updateClasses(t.decoration.element,t.command,t.markProperties)}_dispose(){for(let e of this._capabilityDisposables.values())je(e);this.clearDecorations()}_clearPlaceholder(){this._placeholderDecoration?.dispose(),this._placeholderDecoration=void 0}clearDecorations(){this._placeholderDecoration?.marker.dispose(),this._clearPlaceholder(),this._disposeAllDecorations(),this._decorations.clear()}_attachToCommandCapability(){if(this._capabilities.has(2)){let e=this._capabilities.get(2),t=this._getCommandDetectionListeners(e),o=new O;for(let n of t)o.add(n);this._capabilityDisposables.set(2,o)}}_getCommandDetectionListeners(e){this._removeCapabilityDisposables(2);let t=[];e.executingCommandObject?.marker&&this.registerCommandDecoration(e.executingCommandObject,!0),t.push(e.onCommandStarted(o=>this.registerCommandDecoration(o,!0)));for(let o of e.commands)this.registerCommandDecoration(o);return t.push(e.onCommandFinished(o=>{let n=this._terminal?.buffer?.active,r=o.promptStartMarker;(o.exitCode===void 0||n&&r&&n.baseY+n.cursorY>=r.line)&&this.registerCommandDecoration(o),o.exitCode?this._accessibilitySignalService.playSignal(tn.terminalCommandFailed):this._accessibilitySignalService.playSignal(tn.terminalCommandSucceeded)})),t.push(e.onCommandInvalidated(o=>{for(let n of o){let r=n.marker?.id;if(r){let s=this._decorations.get(r);s&&(s.decoration.dispose(),je(s.disposables))}}})),t.push(e.onCurrentCommandInvalidated(o=>{o.reason==="noProblemsReported"?Array.from(this._decorations.entries())[this._decorations.size-1]?.[1].decoration.dispose():o.reason==="windows"&&this._clearPlaceholder()})),t}activate(e){this._terminal=e,this._attachToCommandCapability()}registerCommandDecoration(e,t,o){if(!this._terminal||t&&!e||!this._showGutterDecorations&&!this._showOverviewRulerDecorations)return;let n=e?.marker||o?.marker;if(!n)throw new Error(`cannot add a decoration for a command ${JSON.stringify(e)} with no marker`);this._clearPlaceholder();let r=this._getDecorationCssColor(e)?.toString()??"",s=this._terminal.registerDecoration({marker:n,overviewRulerOptions:this._showOverviewRulerDecorations?t?{color:r,position:"left"}:{color:r,position:e?.exitCode?"right":"left"}:void 0});if(s)return t&&(this._placeholderDecoration=s),s.onRender(l=>{l.classList.contains(".xterm-decoration-overview-ruler")||(this._decorations.get(s.marker.id)||(s.onDispose(()=>this._decorations.delete(s.marker.id)),this._decorations.set(s.marker.id,{decoration:s,disposables:this._createDisposables(l,e,o),command:e,markProperties:e?.markProperties||o})),(!l.classList.contains("codicon")||e?.marker?.line===0)&&(LWe(this._configurationService,l),this._updateClasses(l,e,e?.markProperties||o)))}),s}registerMenuItems(e,t){let o=this._registeredMenuItems.get(e);return o?o.push(...t):this._registeredMenuItems.set(e,[...t]),ee(()=>{let n=this._registeredMenuItems.get(e);if(n)for(let r of t.values()){let s=n.indexOf(r);s!==-1&&n.splice(s,1)}})}_createDisposables(e,t,o){return t?.exitCode===void 0&&!t?.markProperties?[]:t?.markProperties||o?[this._createHover(e,t||o,o?.hoverMessage)]:[...this._createContextMenu(e,t),this._createHover(e,t)]}_createHover(e,t,o){return this._hoverService.setupDelayedHover(e,()=>({content:new he(vNi(t,o,!0))}))}_updateClasses(e,t,o){if(e){for(let n of e.classList)e.classList.remove(n);if(e.classList.add("terminal-command-decoration","codicon","xterm-decoration"),o)e.classList.add("default-color",...q.asClassNameArray(CEo)),o.hoverMessage||e.classList.add("default");else{let n=f$t(t);this._updateCommandDecorationVisibility(e);for(let r of n.classNames)e.classList.add(r);e.classList.add(...q.asClassNameArray(n.icon))}e.removeAttribute("title"),e.removeAttribute("aria-label")}}_createContextMenu(e,t){return[$(e,ne.MOUSE_DOWN,async o=>{o.stopImmediatePropagation()}),$(e,ne.CLICK,async o=>{o.stopImmediatePropagation();let n=await this._getCommandActions(t);this._contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>n})}),$(e,ne.CONTEXT_MENU,async o=>{o.stopImmediatePropagation();let n=await this._getCommandActions(t),r=this._getContextMenuActions();this._contextMenuService.showContextMenu({getAnchor:()=>e,getActions:()=>[...r,...n]})})]}_getContextMenuActions(){let e=d(16119,null);return[{class:void 0,tooltip:e,id:"terminal.toggleVisibility",label:e,enabled:!0,run:async()=>{this._showToggleVisibilityQuickPick()}}]}async _getCommandActions(e){let t=[],o=this._registeredMenuItems.get(e);o?.length&&t.push(...o,new oi);let n=this._createAttachToChatAction(e);if(n&&t.push(n,new oi),e.command!==""){let c=d(16115,null);t.push({class:void 0,tooltip:c,id:"terminal.rerunCommand",label:c,enabled:!0,run:async()=>{e.command!==""&&(!e.isTrusted&&!await new Promise(h=>{this._notificationService.prompt(ft.Info,d(16108,null,e.command),[{label:d(16120,null),run:()=>h(!0)},{label:d(16106,null),run:()=>h(!1)}])})||this._onDidRequestRunCommand.fire({command:e}))}}),t.push(new oi);let u=d(16110,null);t.push({class:void 0,tooltip:u,id:"terminal.copyCommand",label:u,enabled:!0,run:()=>this._clipboardService.writeText(e.command)})}if(e.hasOutput()){let c=d(16111,null);t.push({class:void 0,tooltip:c,id:"terminal.copyCommandAndOutput",label:c,enabled:!0,run:()=>{let h=e.getOutput();We(h)&&this._clipboardService.writeText(`${e.command!==""?e.command+`
`:""}${h}`)}});let u=d(16112,null);t.push({class:void 0,tooltip:u,id:"terminal.copyOutput",label:u,enabled:!0,run:()=>{let h=e.getOutput();We(h)&&this._clipboardService.writeText(h)}});let p=d(16113,null);t.push({class:void 0,tooltip:p,id:"terminal.copyOutputAsHtml",label:p,enabled:!0,run:()=>this._onDidRequestCopyAsHtml.fire({command:e})})}t.length>0&&t.push(new oi);let r=d(16118,null);t.push({class:void 0,tooltip:r,id:"workbench.action.terminal.runRecentCommand",label:r,enabled:!0,run:()=>this._commandService.executeCommand("workbench.action.terminal.runRecentCommand")});let s=d(16117,null);t.push({class:void 0,tooltip:r,id:"workbench.action.terminal.goToRecentDirectory",label:s,enabled:!0,run:()=>this._commandService.executeCommand("workbench.action.terminal.goToRecentDirectory")}),t.push(new oi);let l=d(16114,null);return t.push({class:void 0,tooltip:l,id:"terminal.learnShellIntegration",label:l,enabled:!0,run:()=>this._openerService.open("https://code.visualstudio.com/docs/terminal/shell-integration")}),t}_createAttachToChatAction(e){if(!this._chatWidgetService.getWidgetsByLocations("panel").some(n=>n.attachmentCapabilities.supportsTerminalAttachments))return;let o=d(16109,null);return{class:void 0,tooltip:o,id:"terminal.attachToChat",label:o,enabled:!0,run:async()=>{let n=this._chatWidgetService.lastFocusedWidget??this._chatWidgetService.getWidgetsByLocations("panel")?.find(s=>s.attachmentCapabilities.supportsTerminalAttachments);if(n||(n=await this._chatWidgetService.revealWidget()),!n)return;let r;if(this._resource){let s=G$(this._resource);r=this._instantiationService.createInstance(kBe,aze(s.workspaceId,s.instanceId,void 0,e.id))}if(r&&n.attachmentCapabilities.supportsTerminalAttachments){try{let s=await r.asAttachment(n);if(s){n.attachmentModel.addContext(s),n.focusInput();return}}catch{}this._store.add(this._contextPickService.registerChatContextItem(r))}}}}_showToggleVisibilityQuickPick(){let e=this._register(this._quickInputService.createQuickPick());e.hideInput=!0,e.hideCheckAll=!0,e.canSelectMany=!0,e.title=d(16116,null);let t=this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled"),o={label:d(16105,null),picked:t!=="never"&&t!=="overviewRuler"},n={label:d(16107,null),picked:t!=="never"&&t!=="gutter"};e.items=[o,n];let r=[];t!=="never"&&(t!=="gutter"&&r.push(o),t!=="overviewRuler"&&r.push(n)),e.selectedItems=r,this._register(e.onDidChangeSelection(async s=>{let l="never";s.includes(o)?s.includes(n)?l="both":l="gutter":s.includes(n)&&(l="overviewRuler"),await this._configurationService.updateValue("terminal.integrated.shellIntegration.decorationsEnabled",l)})),e.ok=!1,e.show()}_getDecorationCssColor(e){let t;return e?.exitCode===void 0?t=cdo:t=e.exitCode?udo:ddo,this._themeService.getColorTheme().getColor(t)?.toString()}};dze=I([m(2,Bi),m(3,Xe),m(4,B),m(5,Pe),m(6,Je),m(7,$e),m(8,to),m(9,fe),m(10,br),m(11,Ne),m(12,ot),m(13,iI),m(14,Lt),m(15,F)],dze);var nNo=new Map,uze=class{async importAddon(i){let e=nNo.get(i);if(!e){switch(i){case"clipboard":e=(await vf("@xterm/addon-clipboard","lib/addon-clipboard.js")).ClipboardAddon;break;case"image":e=(await vf("@xterm/addon-image","lib/addon-image.js")).ImageAddon;break;case"ligatures":e=(await vf("@xterm/addon-ligatures","lib/addon-ligatures.js")).LigaturesAddon;break;case"progress":e=(await vf("@xterm/addon-progress","lib/addon-progress.js")).ProgressAddon;break;case"search":e=(await vf("@xterm/addon-search","lib/addon-search.js")).SearchAddon;break;case"serialize":e=(await vf("@xterm/addon-serialize","lib/addon-serialize.js")).SerializeAddon;break;case"unicode11":e=(await vf("@xterm/addon-unicode11","lib/addon-unicode11.js")).Unicode11Addon;break;case"webgl":e=(await vf("@xterm/addon-webgl","lib/addon-webgl.js")).WebglAddon;break}if(!e)throw new Error(`Could not load addon ${i}`);nNo.set(i,e)}return e}};function xCn(a,i){let e=i.getLine(a);if(!e)return{lineData:void 0,lineIndex:a};let t=e.translateToString(!0);for(;a>0&&e.isWrapped&&(e=i.getLine(--a),!!e);)t=e.translateToString(!1)+t;return{lineData:t,lineIndex:a}}var JP=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._onDidExecuteText=n;this._configurationService=r;this._instantiationService=s;this._logService=l;this._notificationService=c;this._themeService=u;this._telemetryService=p;this._terminalConfigurationService=h;this._clipboardService=g;this._accessibilitySignalService=v;this._isPhysicalMouseWheel=sK.INSTANCE.isPhysicalMouseWheel();this._progressState={state:0,value:0};this._webglAddonCustomGlyphs=!1;this._ligaturesAddon=this._register(new ue);this._attachedDisposables=this._register(new O);this._onDidRequestRunCommand=this._register(new T);this.onDidRequestRunCommand=this._onDidRequestRunCommand.event;this._onDidRequestCopyAsHtml=this._register(new T);this.onDidRequestCopyAsHtml=this._onDidRequestCopyAsHtml.event;this._onDidRequestRefreshDimensions=this._register(new T);this.onDidRequestRefreshDimensions=this._onDidRequestRefreshDimensions.event;this._onDidChangeFindResults=this._register(new T);this.onDidChangeFindResults=this._onDidChangeFindResults.event;this._onBeforeSearch=this._register(new T);this.onBeforeSearch=this._onBeforeSearch.event;this._onAfterSearch=this._register(new T);this.onAfterSearch=this._onAfterSearch.event;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onDidChangeFocus=this._register(new T);this.onDidChangeFocus=this._onDidChangeFocus.event;this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event;this._onDidChangeProgress=this._register(new T);this.onDidChangeProgress=this._onDidChangeProgress.event;this._xtermAddonLoader=o.xtermAddonImporter??new uze,this._xtermColorProvider=o.xtermColorProvider,this._capabilities=o.capabilities;let S=this._terminalConfigurationService.getFont(zi(),void 0,!0),y=this._terminalConfigurationService.config,w=this._configurationService.getValue("editor");this.raw=this._register(new t({allowProposedApi:!0,cols:o.cols,rows:o.rows,documentOverride:b.mainContainer.ownerDocument,altClickMovesCursor:y.altClickMovesCursor&&w.multiCursorModifier==="alt",scrollback:y.scrollback,theme:this.getXtermTheme(),drawBoldTextInBrightColors:y.drawBoldTextInBrightColors,fontFamily:S.fontFamily,fontWeight:y.fontWeight,fontWeightBold:y.fontWeightBold,fontSize:S.fontSize,letterSpacing:S.letterSpacing,lineHeight:S.lineHeight,logLevel:PUi(this._logService.getLevel()),logger:this._logService,minimumContrastRatio:y.minimumContrastRatio,tabStopWidth:y.tabStopWidth,cursorBlink:y.cursorBlinking,blinkIntervalDuration:y.textBlinking?600:0,cursorStyle:jQt(y.cursorStyle),cursorInactiveStyle:jQt(y.cursorStyleInactive),cursorWidth:y.cursorWidth,macOptionIsMeta:y.macOptionIsMeta,macOptionClickForcesSelection:y.macOptionClickForcesSelection,rightClickSelectsWord:y.rightClickBehavior==="selectWord",fastScrollSensitivity:y.fastScrollSensitivity,scrollSensitivity:y.mouseWheelScrollSensitivity,scrollOnEraseInDisplay:!0,wordSeparator:y.wordSeparators,scrollbar:o.disableOverviewRuler?void 0:{width:14,overviewRuler:{showTopBorder:!0}},ignoreBracketedPasteMode:y.ignoreBracketedPasteMode,rescaleOverlappingGlyphs:y.rescaleOverlappingGlyphs,vtExtensions:{kittyKeyboard:y.enableKittyKeyboardProtocol,win32InputMode:y.enableWin32InputMode},allowTransparency:y.enableImages,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0}})),this._updateSmoothScrolling(),this._core=this.raw._core,o.detached||(this._register(this._configurationService.onDidChangeConfiguration(async x=>{x.affectsConfiguration("terminal.integrated.gpuAcceleration")&&(JP._suggestedRendererType=void 0),(x.affectsConfiguration("terminal.integrated")||x.affectsConfiguration("editor.fastScrollSensitivity")||x.affectsConfiguration("editor.mouseWheelScrollSensitivity")||x.affectsConfiguration("editor.multiCursorModifier"))&&this.updateConfig(),x.affectsConfiguration("terminal.integrated.unicodeVersion")&&this._updateUnicodeVersion(),x.affectsConfiguration("terminal.integrated.shellIntegration.decorationsEnabled")&&this._updateTheme()})),this._register(this._themeService.onDidColorThemeChange(x=>this._updateTheme(x))),this._register(this._logService.onDidChangeLogLevel(x=>this.raw.options.logLevel=PUi(x)))),this._register(this.raw.onSelectionChange(()=>{this._onDidChangeSelection.fire(),this.isFocused&&this._anyFocusedTerminalHasSelection.set(this.raw.hasSelection())})),this._register(this.raw.onData(x=>this._lastInputEvent=x)),this._updateUnicodeVersion(),this._markNavigationAddon=this._instantiationService.createInstance(sze,o.capabilities),this.raw.loadAddon(this._markNavigationAddon),this._decorationAddon=this._instantiationService.createInstance(dze,e,this._capabilities),this._register(this._decorationAddon.onDidRequestRunCommand(x=>this._onDidRequestRunCommand.fire(x))),this._register(this._decorationAddon.onDidRequestCopyAsHtml(x=>this._onDidRequestCopyAsHtml.fire(x))),this.raw.loadAddon(this._decorationAddon),this._shellIntegrationAddon=new $Qt(o.shellIntegrationNonce??"",o.disableShellIntegrationReporting,this._onDidExecuteText,this._telemetryService,this._logService),this.raw.loadAddon(this._shellIntegrationAddon),this._xtermAddonLoader.importAddon("clipboard").then(x=>{this._store.isDisposed||(this._clipboardAddon=this._instantiationService.createInstance(x,void 0,{async readText(E){return g.readText(E==="p"?"selection":"clipboard")},async writeText(E,M){return g.writeText(M,E==="p"?"selection":"clipboard")}}),this.raw.loadAddon(this._clipboardAddon))}),this._xtermAddonLoader.importAddon("progress").then(x=>{if(this._store.isDisposed)return;let E=this._instantiationService.createInstance(x);this.raw.loadAddon(E);let M=()=>{Qi(this._progressState,E.progress)||(this._progressState=E.progress,this._onDidChangeProgress.fire(this._progressState))};this._register(E.onChange(()=>M())),M();let N=this._capabilities.get(2);if(N)this._register(N.onCommandFinished(()=>E.progress={state:0,value:0}));else{let V=this._capabilities.onDidAddCapability(H=>{H.id===2&&(this._register(H.capability.onCommandFinished(()=>E.progress={state:0,value:0})),this._store.delete(V))});this._store.add(V)}}),this._anyTerminalFocusContextKey=pt.focusInAny.bindTo(f),this._anyFocusedTerminalHasSelection=pt.textSelectedInFocused.bindTo(f)}static{this._suggestedRendererType=void 0}get lastInputEvent(){return this._lastInputEvent}get progressState(){return this._progressState}get buffer(){return this.raw.buffer}get cols(){return this.raw.cols}get findResult(){return this._lastFindResult}get isStdinDisabled(){return!!this.raw.options.disableStdin}get isGpuAccelerated(){return!!this._webglAddon}get isImageAddonLoaded(){return!!this._imageAddon}get markTracker(){return this._markNavigationAddon}get shellIntegration(){return this._shellIntegrationAddon}get decorationAddon(){return this._decorationAddon}get textureAtlas(){let e=this._webglAddon?.textureAtlas;if(e)return createImageBitmap(e)}get isFocused(){return this.raw.element?Is(this.raw.element):!1}*getBufferReverseIterator(){for(let e=this.raw.buffer.active.length-1;e>=0;e--){let{lineData:t,lineIndex:o}=xCn(e,this.raw.buffer.active);t&&(e=o,yield t)}}getContentsAsText(e,t){let o=[],n=this.raw.buffer.active;if(e?.line===-1)throw new Error("Cannot get contents of a disposed startMarker");if(t?.line===-1)throw new Error("Cannot get contents of a disposed endMarker");let r=e?.line??0,s=t?.line??n.length-1;for(let l=r;l<=s;l++)o.push(n.getLine(l)?.translateToString(!0)??"");return o.join(`
`)}async getContentsAsHtml(){if(!this._serializeAddon){let e=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new e,this.raw.loadAddon(this._serializeAddon)}return this._serializeAddon.serializeAsHTML()}async getCommandOutputAsHtml(e,t){if(!this._serializeAddon){let h=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new h,this.raw.loadAddon(this._serializeAddon)}let o,n;e.executedMarker&&e.executedMarker.line>=0?(o=e.executedMarker.line,n=Math.max(e.executedX??0,0)):(o=e.marker?.line!==void 0?e.marker.line+1:1,n=Math.max(e.startX??0,0));let r=e.endMarker?.line!==void 0?e.endMarker.line-1:this.raw.buffer.active.length-1;if(r<o)return{text:"",truncated:!1};let s=0;for(let h=r;h>=o;h--){let g=this.raw.buffer.active.getLine(h);if(g&&g.translateToString(!0).trim()==="")s++;else break}r=r-s;let l=0;for(let h=o;h<=r;h++){let g=this.raw.buffer.active.getLine(h);if(g&&g.translateToString(!0,h===o?n:void 0).trim()==="")h===o&&(n=0),l++;else break}o=o+l,t&&r-o>t&&(o=r-t,n=0);let c=this.raw.buffer.active.getLine(o);c&&(n=Math.min(n,c.length));let u={startLine:o,endLine:r,startCol:n};return{text:this._serializeAddon.serializeAsHTML({range:u}),truncated:r-o>=t}}async getSelectionAsHtml(e){if(!this._serializeAddon){let o=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new o,this.raw.loadAddon(this._serializeAddon)}if(e){let o=e.getOutput()?.length,n=e.marker?.line;if(!o||!n)throw new Error(`No row ${n} or output length ${o} for command ${e}`);this.raw.select(0,n+1,o-Math.floor(o/this.raw.cols))}let t=this._serializeAddon.serializeAsHTML({onlySelection:!0});return e&&this.raw.clearSelection(),t}attachToElement(e,t){let o={enableGpu:!0,...t};if(this._attached||this.raw.open(e),o.enableGpu&&this._shouldLoadWebgl()&&this._enableWebglRenderer(),!this.raw.element||!this.raw.textarea)throw new Error("xterm elements not set after open");let n=this._attachedDisposables;return n.clear(),n.add($(this.raw.textarea,"focus",()=>this._setFocused(!0))),n.add($(this.raw.textarea,"blur",()=>this._setFocused(!1))),n.add($(this.raw.textarea,"focusout",()=>this._setFocused(!1))),n.add($(this.raw.element,ne.MOUSE_WHEEL,r=>{let s=sK.INSTANCE;s.acceptStandardWheelEvent(new nD(r));let l=s.isPhysicalMouseWheel();l!==this._isPhysicalMouseWheel&&(this._isPhysicalMouseWheel=l,this._updateSmoothScrolling())},{passive:!0})),this._refreshLigaturesAddon(),this._attached={container:e,options:o},this._attached?.container.querySelector(".xterm-screen")}_setFocused(e){this._onDidChangeFocus.fire(e),this._anyTerminalFocusContextKey.set(e),this._anyFocusedTerminalHasSelection.set(e&&this.raw.hasSelection())}write(e,t){this.raw.write(e,t)}resize(e,t){this._logService.debug("resizing",e,t),this.raw.resize(e,t)}updateLogLevel(){this.raw.options.logLevel=PUi(this._logService.getLevel())}updateConfig(){let e=this._terminalConfigurationService.config;this.raw.options.altClickMovesCursor=e.altClickMovesCursor,this._setCursorBlink(e.cursorBlinking),this._setTextBlinking(e.textBlinking),this._setCursorStyle(e.cursorStyle),this._setCursorStyleInactive(e.cursorStyleInactive),this._setCursorWidth(e.cursorWidth),this.raw.options.scrollback=e.scrollback,this.raw.options.drawBoldTextInBrightColors=e.drawBoldTextInBrightColors,this.raw.options.minimumContrastRatio=e.minimumContrastRatio,this.raw.options.tabStopWidth=e.tabStopWidth,this.raw.options.fastScrollSensitivity=e.fastScrollSensitivity,this.raw.options.scrollSensitivity=e.mouseWheelScrollSensitivity,this.raw.options.macOptionIsMeta=e.macOptionIsMeta;let t=this._configurationService.getValue("editor");this.raw.options.altClickMovesCursor=e.altClickMovesCursor&&t.multiCursorModifier==="alt",this.raw.options.macOptionClickForcesSelection=e.macOptionClickForcesSelection,this.raw.options.rightClickSelectsWord=e.rightClickBehavior==="selectWord",this.raw.options.wordSeparator=e.wordSeparators,this.raw.options.ignoreBracketedPasteMode=e.ignoreBracketedPasteMode,this.raw.options.rescaleOverlappingGlyphs=e.rescaleOverlappingGlyphs,this.raw.options.allowTransparency=e.enableImages,this.raw.options.vtExtensions={kittyKeyboard:e.enableKittyKeyboardProtocol,win32InputMode:e.enableWin32InputMode},this._updateSmoothScrolling(),this._attached&&(this._attached.options.enableGpu&&(this._shouldLoadWebgl()?this._enableWebglRenderer():this._disposeOfWebglRenderer()),this._refreshLigaturesAddon())}_updateSmoothScrolling(){this.raw.options.smoothScrollDuration=this._terminalConfigurationService.config.smoothScrolling&&this._isPhysicalMouseWheel?125:0}_shouldLoadWebgl(){return this._terminalConfigurationService.config.gpuAcceleration==="auto"&&JP._suggestedRendererType===void 0||this._terminalConfigurationService.config.gpuAcceleration==="on"}forceRedraw(){this.raw.clearTextureAtlas()}clearDecorations(){this._decorationAddon?.clearDecorations()}forceRefresh(){this._core.viewport?._innerRefresh()}async findNext(e,t){return this._updateFindColors(t),(await this._getSearchAddon()).findNext(e,t)}async findPrevious(e,t){return this._updateFindColors(t),(await this._getSearchAddon()).findPrevious(e,t)}_updateFindColors(e){let t=this._themeService.getColorTheme(),o=t.getColor(fee)||t.getColor(GI),n=t.getColor(mdo),r=t.getColor(hdo),s=t.getColor(WNt),l=t.getColor(gdo),c=t.getColor(fdo),u=t.getColor(vdo);e.decorations={activeMatchBackground:n?.toString(),activeMatchBorder:r?.toString()||"transparent",activeMatchColorOverviewRuler:s?.toString()||"transparent",matchBackground:o?l?.blend(o).toString():void 0,matchBorder:c?.toString()||"transparent",matchOverviewRuler:u?.toString()||"transparent"}}_getSearchAddon(){return this._searchAddonPromise||(this._searchAddonPromise=this._xtermAddonLoader.importAddon("search").then(e=>this._store.isDisposed?Promise.reject("Could not create search addon, terminal is disposed"):(this._searchAddon=new e({highlightLimit:2e4}),this.raw.loadAddon(this._searchAddon),this._store.add(this._searchAddon.onDidChangeResults(t=>{this._lastFindResult=t,this._onDidChangeFindResults.fire(t)})),this._store.add(this._searchAddon.onBeforeSearch(()=>{this._onBeforeSearch.fire()})),this._store.add(this._searchAddon.onAfterSearch(()=>{this._onAfterSearch.fire()})),this._searchAddon))),this._searchAddonPromise}clearSearchDecorations(){this._searchAddon?.clearDecorations()}clearActiveSearchDecoration(){this._searchAddon?.clearActiveDecoration()}getFont(){return this._terminalConfigurationService.getFont(Me(this.raw.element),this._core)}getLongestViewportWrappedLineLength(){let e=0;for(let t=this.raw.buffer.active.length-1;t>=this.raw.buffer.active.viewportY;t--){let o=this._getWrappedLineCount(t,this.raw.buffer.active);e=Math.max(e,o.lineCount*this.raw.cols-o.endSpaces||0),t=o.currentIndex}return e}_getWrappedLineCount(e,t){let o=t.getLine(e);if(!o)throw new Error("Could not get line");let n=e,r=0;for(let s=Math.min(o.length,this.raw.cols)-1;s>=0&&!o?.getCell(s)?.getChars();s--)r++;for(;o?.isWrapped&&n>0;)n--,o=t.getLine(n);return{lineCount:e-n+1,currentIndex:n,endSpaces:r}}scrollDownLine(){this.raw.scrollLines(1)}scrollDownPage(){this.raw.scrollPages(1)}scrollToBottom(){this.raw.scrollToBottom()}scrollUpLine(){this.raw.scrollLines(-1)}scrollUpPage(){this.raw.scrollPages(-1)}scrollToTop(){this.raw.scrollToTop()}scrollToLine(e,t=0){this.markTracker.scrollToLine(e,t)}clearBuffer(){this.raw.clear(),this._capabilities.get(2)?.handlePromptStart(),this._capabilities.get(2)?.handleCommandStart(),this._accessibilitySignalService.playSignal(tn.clear)}reset(){this.raw.reset()}hasSelection(){return this.raw.hasSelection()}clearSelection(){this.raw.clearSelection()}selectMarkedRange(e,t,o=!1){let n=this.shellIntegration.capabilities.get(4);if(!n)return;let r=n.getMark(e),s=n.getMark(t);r===void 0||s===void 0||(this.raw.selectLines(r.line,s.line),o&&this.raw.scrollToLine(r.line))}selectAll(){this.raw.focus(),this.raw.selectAll()}focus(){this.raw.focus()}async copySelection(e,t){if(this.hasSelection()||e&&t)if(e){let n=function(s){s.clipboardData&&(s.clipboardData.types.includes("text/plain")||s.clipboardData.setData("text/plain",t?.getOutput()??""),s.clipboardData.setData("text/html",o)),s.preventDefault()},o=await this.getSelectionAsHtml(t),r=Qle(this.raw.element);r.addEventListener("copy",n),r.execCommand("copy"),r.removeEventListener("copy",n)}else await this._clipboardService.writeText(this.raw.getSelection());else this._notificationService.warn(d(16131,null))}_setCursorBlink(e){this.raw.options.cursorBlink!==e&&(this.raw.options.cursorBlink=e,this.raw.refresh(0,this.raw.rows-1))}_setTextBlinking(e){let t=e?600:0,o=this.raw.options;o.blinkIntervalDuration!==t&&(o.blinkIntervalDuration=t)}_setCursorStyle(e){let t=jQt(e);this.raw.options.cursorStyle!==t&&(this.raw.options.cursorStyle=t)}_setCursorStyleInactive(e){let t=jQt(e);this.raw.options.cursorInactiveStyle!==t&&(this.raw.options.cursorInactiveStyle=t)}_setCursorWidth(e){this.raw.options.cursorWidth!==e&&(this.raw.options.cursorWidth=e)}async _enableWebglRenderer(){if(!this.raw.element||this._webglAddon&&this._webglAddonCustomGlyphs===this._terminalConfigurationService.config.customGlyphs)return;this._disposeOfWebglRenderer(),this._webglAddonCustomGlyphs=this._terminalConfigurationService.config.customGlyphs;let e=await this._xtermAddonLoader.importAddon("webgl");this._webglAddon=new e({customGlyphs:this._terminalConfigurationService.config.customGlyphs});try{this.raw.loadAddon(this._webglAddon),this._logService.trace("Webgl was loaded"),this._store.add(this._webglAddon.onContextLoss(()=>{this._logService.info("Webgl lost context, disposing of webgl renderer"),this._disposeOfWebglRenderer()})),this._refreshImageAddon(),this._onDidRequestRefreshDimensions.fire()}catch(t){this._logService.warn("Webgl could not be loaded. Falling back to the DOM renderer",t),JP._suggestedRendererType="dom",this._disposeOfWebglRenderer()}}async _refreshLigaturesAddon(){if(!this.raw.element)return;let e=this._terminalConfigurationService.config.fontLigatures,t=!1;if(e?.enabled){if(this._ligaturesAddon.value&&!Qi(e,this._ligaturesAddonConfig)&&this._ligaturesAddon.clear(),!this._ligaturesAddon.value){let o=await this._xtermAddonLoader.importAddon("ligatures");if(this._store.isDisposed)return;this._ligaturesAddon.value=this._instantiationService.createInstance(o,{fontFeatureSettings:e.featureSettings,fallbackLigatures:e.fallbackLigatures}),this.raw.loadAddon(this._ligaturesAddon.value),t=!0}}else{if(!this._ligaturesAddon.value)return;this._ligaturesAddon.clear(),t=!0}t&&this._webglAddon&&(this._disposeOfWebglRenderer(),await this._enableWebglRenderer())}async _refreshImageAddon(){if(this._terminalConfigurationService.config.enableImages&&this._webglAddon){if(!this._imageAddon){let e=await this._xtermAddonLoader.importAddon("image");this._imageAddon=new e,this.raw.loadAddon(this._imageAddon),this._telemetryService.publicLog2("terminal/imageAddonActivated"),this._register(this._imageAddon.onImageAdded(()=>{this._telemetryService.publicLog2("terminal/imageAdded")}))}}else{try{this._imageAddon?.dispose()}catch{}this._imageAddon=void 0}}_disposeOfWebglRenderer(){if(this._webglAddon){try{this._webglAddon?.dispose()}catch{}this._webglAddon=void 0,this._webglAddonCustomGlyphs=void 0,this._refreshImageAddon(),this._onDidRequestRefreshDimensions.fire()}}async getRangeAsVT(e,t,o){if(!this._serializeAddon){let c=await this._xtermAddonLoader.importAddon("serialize");this._serializeAddon=new c,this.raw.loadAddon(this._serializeAddon)}let n=this.raw.buffer.active.length-1;if(n<0)return"";let r=on(t?.line),s=jn(on(e?.line)&&e.line>-1?e.line:0,0,n),l=r?t.line:this.raw.buffer.active.length-1;return o&&r&&(l=l-1),l=jn(Math.max(l,s),s,n),this._serializeAddon.serialize({range:{start:s,end:l}})}getXtermTheme(e){e||(e=this._themeService.getColorTheme());let t=this._terminalConfigurationService.config,o=["never","gutter"].includes(t.shellIntegration?.decorationsEnabled??""),n=e.getColor(ndo),r=this._xtermColorProvider.getBackgroundColor(e),s=e.getColor(rdo)||n,l=e.getColor(sdo)||r,c=e.getColor(cRe),u=e.getColor(ado),p=e.getColor(ldo)||void 0;return{background:r?.toString(),foreground:n?.toString(),cursor:s?.toString(),cursorAccent:l?.toString(),selectionBackground:c?.toString(),selectionInactiveBackground:u?.toString(),selectionForeground:p?.toString(),overviewRulerBorder:o?"#0000":e.getColor(pdo)?.toString(),scrollbarSliderActiveBackground:e.getColor(Zz)?.toString(),scrollbarSliderBackground:e.getColor(iX)?.toString(),scrollbarSliderHoverBackground:e.getColor(Jz)?.toString(),black:e.getColor(YS[0])?.toString(),red:e.getColor(YS[1])?.toString(),green:e.getColor(YS[2])?.toString(),yellow:e.getColor(YS[3])?.toString(),blue:e.getColor(YS[4])?.toString(),magenta:e.getColor(YS[5])?.toString(),cyan:e.getColor(YS[6])?.toString(),white:e.getColor(YS[7])?.toString(),brightBlack:e.getColor(YS[8])?.toString(),brightRed:e.getColor(YS[9])?.toString(),brightGreen:e.getColor(YS[10])?.toString(),brightYellow:e.getColor(YS[11])?.toString(),brightBlue:e.getColor(YS[12])?.toString(),brightMagenta:e.getColor(YS[13])?.toString(),brightCyan:e.getColor(YS[14])?.toString(),brightWhite:e.getColor(YS[15])?.toString()}}_updateTheme(e){this.raw.options.theme=this.getXtermTheme(e)}updateTheme(){this._updateTheme()}refresh(){this._updateTheme(),this._decorationAddon.refreshLayouts()}async _updateUnicodeVersion(){if(!this._unicode11Addon&&this._terminalConfigurationService.config.unicodeVersion==="11"){let e=await this._xtermAddonLoader.importAddon("unicode11");this._unicode11Addon=new e,this.raw.loadAddon(this._unicode11Addon)}this.raw.unicode.activeVersion!==this._terminalConfigurationService.config.unicodeVersion&&(this.raw.unicode.activeVersion=this._terminalConfigurationService.config.unicodeVersion)}_writeText(e){this.raw.write(e)}dispose(){this._anyTerminalFocusContextKey.reset(),this._anyFocusedTerminalHasSelection.reset(),this._disposeOfWebglRenderer(),this._onDidDispose.fire(),super.dispose()}};I([Tu(100)],JP.prototype,"_refreshLigaturesAddon",1),I([Tu(100)],JP.prototype,"_refreshImageAddon",1),JP=I([m(4,B),m(5,F),m(6,wa),m(7,Ne),m(8,Pe),m(9,_e),m(10,mp),m(11,Bi),m(12,X),m(13,br),m(14,Kl)],JP);function QQt(a,i,e,t){if(!i.charWidth||!i.charHeight)return null;let o=e*a.devicePixelRatio,n=i.charWidth*a.devicePixelRatio+i.letterSpacing,r=Math.max(Math.floor(o/n),1),s=t*a.devicePixelRatio,l=Math.ceil(i.charHeight*a.devicePixelRatio),c=Math.floor(l*i.lineHeight);return{rows:Math.max(Math.floor(s/c),1),cols:r}}function PUi(a){switch(a){case 1:return"trace";case 2:return"debug";case 3:return"info";case 4:return"warn";case 5:return"error";default:return"off"}}function jQt(a){return a==="line"?"bar":a}var NUi=class extends Zh{constructor(e,t){super();this._original=e;this._modified=t;this.original=this._original.object.textEditorModel,this.modified=this._modified.object.textEditorModel}dispose(){super.dispose(),this._original.dispose(),this._modified.dispose()}},Udt={scrollBeyondLastLine:!1,links:!0,lineNumbers:"off",glyphMargin:!1,scrollbar:{vertical:"hidden",horizontal:"auto",useShadows:!1,verticalHasArrows:!1,horizontalHasArrows:!1,handleMouseWheel:!1},overviewRulerLanes:0,fixedOverflowWidgets:!0,readOnly:!0,stickyScroll:{enabled:!1},minimap:{enabled:!1},automaticLayout:!1},AUi={...Udt,enableSplitViewResizing:!0,isInEmbeddedEditor:!0,renderOverviewRuler:!1,ignoreTrimWhitespace:!1,renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1,originalAriaLabel:d(17181,null),modifiedAriaLabel:d(17180,null),diffAlgorithm:"advanced"};function sNo(a,i,e){let t=new Set(Object.keys(a));function o(){let n=i.getValue("editor"),r=!1,s={};for(let[l,c]of Object.entries(n))!t.has(l)&&a[l]!==c&&(s[l]=c,r=!0);return r?s:void 0}return Object.assign(a,o()),i.onDidChangeConfiguration(n=>{if(n.affectsConfiguration("editor")){let r=o();r&&(e(r),Object.assign(a,r))}})}var pze=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.container=t;this.instantiationService=o;this.modelService=n;this.configurationService=r;this.widget=this._register(new ue);this.model=this._register(new ue)}get onDidContentSizeChange(){return this.widget.value?.onDidContentSizeChange||U.None}async update(e){if(!(e instanceof vh))return this.clear(),!1;let t=e.message;if(!oW.isDiffable(t))return this.clear(),!1;let[o,n]=await Promise.all([this.modelService.createModelReference(e.expectedUri),this.modelService.createModelReference(e.actualUri)]),r=this.model.value=new NUi(o,n);if(!this.widget.value){let s={...AUi},l=sNo(s,this.configurationService,u=>c.updateOptions(u)),c=this.widget.value=this.editor?this.instantiationService.createInstance(nL,this.container,s,{},this.editor):this.instantiationService.createInstance(_p,this.container,s,{});U.once(c.onDidDispose)(()=>{l.dispose()}),this.dimension&&c.layout(this.dimension)}return this.widget.value.setModel(r),this.widget.value.updateOptions(this.getOptions(rNo(t.expected)||rNo(t.actual))),!0}clear(){this.model.clear(),this.widget.clear()}layout(e,t){this.dimension=e;let o=this.widget.value;if(!o)return;o.layout(e);let n=Math.max(o.getOriginalEditor().getContentHeight(),o.getModifiedEditor().getContentHeight());return o.updateOptions({scrollbar:{...Udt.scrollbar,handleMouseWheel:!t}}),this.helper=new YQt(t,n,e.height),n}onScrolled(e){this.helper?.onScrolled(e,this.widget.value?.getDomNode(),this.widget.value?.getOriginalEditor())}getOptions(e){return e?{...AUi,lineNumbers:"on"}:{...AUi,lineNumbers:"off"}}};pze=I([m(2,F),m(3,Bt),m(4,B)],pze);var mze=class extends k{constructor(e,t){super();this.container=e;this.markdownRendererService=t;this.rendered=this._register(new O);this._register(ee(()=>this.clear()))}async update(e){if(this.clear(),!(e instanceof vh))return!1;let t=e.message;if(oW.isDiffable(t)||typeof t.message=="string")return!1;let o=this.rendered.add(this.markdownRendererService.render(t.message,{}));return o.element.style.userSelect="text",o.element.classList.add("preview-text"),this.container.appendChild(o.element),this.element=o.element,this.rendered.add(ee(()=>o.element.remove())),!0}layout(e){if(this.element)return this.element.style.width=`${e.width-32}px`,this.element.clientHeight}clear(){this.rendered.clear(),this.element=void 0}};mze=I([m(1,_n)],mze);var YQt=class{constructor(i,e,t){this.hasMultipleFrames=i;this.contentHeight=e;this.viewHeight=t}onScrolled(i,e,t){if(!t||!e)return;let o=Math.max(0,i.scrollTop-(this.hasMultipleFrames?rze:0));o=Math.min(Math.max(0,this.contentHeight-this.viewHeight),o),t.setScrollTop(o),e.style.transform=`translateY(${o}px)`}},hze=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.container=t;this.instantiationService=o;this.modelService=n;this.configurationService=r;this.widgetDecorations=this._register(new ue);this.widget=this._register(new ue);this.model=this._register(new ue)}get onDidContentSizeChange(){return this.widget.value?.onDidContentSizeChange||U.None}async update(e){if(!(e instanceof vh))return this.clear(),!1;let t=e.message;if(oW.isDiffable(t)||t.type===1||typeof t.message!="string")return this.clear(),!1;let o=this.model.value=await this.modelService.createModelReference(e.messageUri);if(!this.widget.value){let n={...Udt},r=sNo(n,this.configurationService,l=>s.updateOptions(l)),s=this.widget.value=this.editor?this.instantiationService.createInstance(Ed,this.container,n,{},this.editor):this.instantiationService.createInstance(us,this.container,n,{isSimpleWidget:!0});U.once(s.onDidDispose)(()=>{r.dispose()}),this.dimension&&s.layout(this.dimension)}return this.widget.value.setModel(o.object.textEditorModel),this.widget.value.updateOptions(Udt),this.widgetDecorations.value=HAo(t.message,this.widget.value),!0}clear(){this.widgetDecorations.clear(),this.widget.clear(),this.model.clear()}onScrolled(e){this.helper?.onScrolled(e,this.widget.value?.getDomNode(),this.widget.value)}layout(e,t){this.dimension=e;let o=this.widget.value;if(!o)return;o.layout(e);let n=o.getContentHeight();return this.helper=new YQt(t,n,e.height),o.updateOptions({scrollbar:{...Udt.scrollbar,handleMouseWheel:!t}}),n}};hze=I([m(2,F),m(3,Bt),m(4,B)],hze);var gze=class extends k{constructor(e,t,o,n,r){super();this.container=e;this.isInPeekView=t;this.terminalService=o;this.viewDescriptorService=n;this.workspaceContext=r;this.terminalCwd=this._register(new YP(""));this.xtermLayoutDelayer=this._register(new rn(50));this.terminal=this._register(new ue);this.outputDataListener=this._register(new ue)}async makeTerminal(){let e=this.terminal.value;if(e)return e.xterm.clearBuffer(),e.xterm.clearSearchDecorations(),e.xterm.write("\x1Bc"),e;let t=new fk,o=this.terminalCwd;return t.add(0,{type:0,get cwds(){return[o.value]},onDidChangeCwd:o.onDidChange,getCwd:()=>o.value,updateCwd:()=>{}}),this.terminal.value=await this.terminalService.createDetachedTerminal({rows:10,cols:80,readonly:!0,capabilities:t,processInfo:new rve({initialCwd:o.value}),colorProvider:{getBackgroundColor:n=>{let r=n.getColor(fee);return r||(this.isInPeekView?n.getColor(yJ):this.viewDescriptorService.getViewLocationById("workbench.panel.testResults.view")===1?n.getColor(GI):n.getColor(ch))}}})}async update(e){if(this.outputDataListener.clear(),e instanceof pI)await this.updateForTaskSubject(e);else if(e instanceof mI||e instanceof vh&&e.message.type===1)await this.updateForTestSubject(e);else return this.clear(),!1;return!0}async updateForTestSubject(e){let t=this,o=e instanceof mI?e.test.item:e.test,n=await this.updateGenerically({subject:e,noOutputMessage:d(17177,null),getTarget:r=>r?.tasks[e.taskIndex].output,*doInitialWrite(r,s){t.updateCwd(o.uri);let l=e instanceof mI?e.test:s.getStateById(o.extId);if(l)for(let c of l.tasks[e.taskIndex].messages)c.type===1&&(yield*r.getRangeIter(c.offset,c.length))},doListenForMoreData:(r,s,l)=>s.onChange(c=>{if(c.reason===2&&c.item.item.extId===o.extId&&c.message.type===1)for(let u of r.getRangeIter(c.message.offset,c.message.length))l(u.buffer)})});e instanceof vh&&e.message.type===1&&e.message.marker!==void 0&&n?.xterm.selectMarkedRange(AJe(e.message.marker,!0),AJe(e.message.marker,!1),!0)}updateForTaskSubject(e){return this.updateGenerically({subject:e,noOutputMessage:d(17178,null),getTarget:t=>t?.tasks[e.taskIndex],doInitialWrite:(t,o)=>(this.updateCwd(yt.find(o.tests,n=>!!n.item.uri)?.item.uri),t.output.buffers),doListenForMoreData:(t,o,n)=>t.output.onDidWriteData(r=>n(r.buffer))})}async updateGenerically(e){let t=e.subject.result,o=e.getTarget(t);if(!o)return this.clear();let n=await this.makeTerminal(),r=!1,s=new YP(0);if(t instanceof lg)for(let l of e.doInitialWrite(o,t))r||=l.byteLength>0,s.value++,n.xterm.write(l.buffer,()=>s.value--);else r=!0,this.writeNotice(n,d(17179,null));if(this.attachTerminalToDom(n),this.outputDataListener.clear(),t instanceof lg&&!t.completedAt){let l=t.onComplete(()=>{r||this.writeNotice(n,e.noOutputMessage)}),c=e.doListenForMoreData(o,t,u=>{n.xterm.write(u),r||=u.byteLength>0});this.outputDataListener.value=Fn(l,c)}return!this.outputDataListener.value&&!r&&this.writeNotice(n,e.noOutputMessage),s.value>0&&await new Promise(l=>{let c=s.onDidChange(()=>{s.value===0&&(c.dispose(),l())})}),n}updateCwd(e){let t=e&&this.workspaceContext.getWorkspaceFolder(e)||this.workspaceContext.getWorkspace().folders[0];t&&(this.terminalCwd.value=t.uri.fsPath)}writeNotice(e,t){e.xterm.write(QE(t))}attachTerminalToDom(e){e.xterm.write("\x1B[?25l"),kr(Me(this.container),()=>this.layoutTerminal(e)),e.attachToElement(this.container,{enableGpu:!1})}clear(){this.outputDataListener.clear(),this.xtermLayoutDelayer.cancel(),this.terminal.clear()}layout(e){if(this.dimensions=e,this.terminal.value)return this.layoutTerminal(this.terminal.value,e.width,e.height),e.height}layoutTerminal({xterm:e},t=this.dimensions?.width??this.container.clientWidth,o=this.dimensions?.height??this.container.clientHeight){t-=30,this.xtermLayoutDelayer.trigger(()=>{let n=QQt(Me(this.container),e.getFont(),t,o);n&&e.resize(n.cols,n.rows)})}};gze=I([m(2,an),m(3,ji),m(4,Ae)],gze);var rNo=a=>!!a&&a.includes(`
`);function OUi(a,i){return{testRunName:i.name,controllerId:i.ctrlId,resultId:a,taskId:i.id}}var Kdt=class{constructor(i){this.value=i;this.changeEmitter=new T;this.onDidChange=this.changeEmitter.event;this.type="result";this.id=i.id,this.context=i.id,this.label=i.name}get icon(){return OO.get(this.value.completedAt===void 0?2:Emo(this.value.counts))}},kCn=d(17188,null),ECn=d(17182,null),XQt=class{constructor(i,e,t){this.task=e;this.coverageService=t;this.type="coverage";this.id=`coverage-${i.id}/${e.id}`,this.onDidChange=U.fromObservableLight(t.selected)}get label(){return this.isOpen?ECn:kCn}get icon(){return this.isOpen?MT:bdt}get isOpen(){return this.coverageService.selected.get()?.fromTaskId===this.task.id}},JQt=class{constructor(i){this.n=i;this.type="older";this.onDidChange=U.None;this.label=i===1?d(17187,null):d(17186,null,i),this.id=`older-${this.n}`}},j9=class{constructor(i,e,t){this.results=i;this.test=e;this.taskIndex=t;this.type="test";this.id=`${i.id}/${e.item.extId}`;let o=ns.fromString(e.item.extId).parentId;if(o){this.description="";for(let n of o.idsToRoot()){if(n.isRoot)break;let r=i.getStateById(n.toString());if(!r)break;this.description.length&&(this.description+=" \u2039 "),this.description+=r.item.label}}this.context=new Gdt([{$mid:16,tests:[QM.serialize(e)]},OUi(i.id,i.tasks[this.taskIndex])])}get onDidChange(){return this.results instanceof lg?U.filter(this.results.onChange,i=>i.item.item.extId===this.test.item.extId&&i.reason!==2):U.None}get state(){return this.test.tasks[this.taskIndex].state}get label(){return this.test.item.label}get labelWithIcons(){return ir(this.label)}get icon(){return OO.get(this.state)}get outputSubject(){return new mI(this.results,this.taskIndex,this.test)}},rse=class{constructor(i,e,t){this.results=i;this.task=e;this.index=t;this.changeEmitter=new T;this.onDidChange=this.changeEmitter.event;this.type="task";this.itemsCache=new ZQt;this.id=`${i.id}/${t}`,this.task=i.tasks[t],this.context=OUi(i.id,this.task),this.label=this.task.name}get icon(){return this.results.tasks[this.index].running?OO.get(2):void 0}},Q9=class{constructor(i,e,t,o){this.result=i;this.test=e;this.taskIndex=t;this.messageIndex=o;this.type="message";let n=this.message=e.tasks[t].messages[o];this.location=n.location,this.contextValue=n.type===0?n.contextValue:void 0,this.uri=rL({type:2,messageIndex:o,resultId:i.id,taskIndex:t,testExtId:e.item.extId}),this.id=this.uri.toString();let r=Zre(n.message),s=rT(r.trimEnd(),`
`);this.label=TCn(r),s>0&&(this.description=s>1?d(17185,null,s):d(17184,null))}get onDidChange(){return this.result instanceof lg?U.filter(this.result.onChange,i=>i.item.item.extId===this.test.item.extId&&i.reason!==2):U.None}get context(){return new Gdt([RUi(this.test,this.message),OUi(this.result.id,this.result.tasks[this.taskIndex])])}get outputSubject(){return new mI(this.result,this.taskIndex,this.test)}},fze=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this.onDidReveal=t;this.contextMenuService=n;this.disposed=!1;this.requestReveal=this._register(new T);this.contextMenuActionRunner=this._register(new e6t);this.onDidRequestReview=this.requestReveal.event;this.treeActions=s.createInstance(zdt,o.showRevealLocationOnMessages,this.requestReveal);let h={getId(N){return N.id}};this.tree=this._register(s.createInstance(l0,"Test Output Peek",e,{getHeight:()=>22,getTemplateId:()=>sse.ID},[s.createInstance(sse,this.treeActions)],{compressionEnabled:!0,hideTwistiesOfChildlessElements:!0,identityProvider:h,alwaysConsumeMouseWheel:!1,sorter:{compare(N,V){return N instanceof j9&&V instanceof j9?net(N.state,V.state):0}},accessibilityProvider:{getAriaLabel(N){return N.ariaLabel||N.label},getWidgetAriaLabel(){return d(17201,null)}}}));let g=new ZQt,f=N=>{let{results:V,index:H,itemsCache:K,task:j}=N,J=yt.filter(V.tests,ae=>ae.tasks[H].state>=2||ae.tasks[H].messages.length>0),se=yt.map(J,ae=>({element:K.getOrCreate(ae,()=>new j9(V,ae,H)),incompressible:!0,children:v(V,ae,H)}));return j.coverage.get()&&(se=yt.concat(yt.single({element:new XQt(V,j,c),collapsible:!0,incompressible:!0}),se)),se},v=(N,V,H)=>V.tasks[H].messages.map((K,j)=>K.type===0?{element:g.getOrCreate(K,()=>new Q9(N,V,H,j)),incompressible:!1}:void 0).filter(so),b=N=>N.tasks.map((V,H)=>{let K=g.getOrCreate(V,()=>new rse(N,V,H));return{element:K,incompressible:!1,collapsible:!0,children:f(K)}}),S=()=>{let N=[],V=[];for(let H of r.results)if(!N.length&&H.tasks.length)N=b(H);else if(N){let K=g.getOrCreate(H,()=>new Kdt(H));V.push({element:K,incompressible:!0,collapsible:!0,collapsed:this.tree.hasElement(K)?this.tree.isCollapsed(K):!0,children:b(H)})}return N.length?(V.length&&N.push({element:new JQt(V.length),incompressible:!0,collapsible:!0,collapsed:!0,children:V}),N):V},y=new Set,w=this._register(new Dt(()=>{for(let N of y)this.tree.hasElement(N)&&this.tree.setChildren(N,f(N),{diffIdentityProvider:h});y.clear()},300)),x=N=>{y.add(N),w.isScheduled()||w.schedule()},E=N=>{let V=new O;V.add(N.onNewTask(H=>{this.tree.setChildren(null,S(),{diffIdentityProvider:h}),N.tasks.length===1&&this.requestReveal.fire(new pI(N,0));let K=N.tasks[H];V.add(ve(j=>{K.coverage.read(j),x(g.get(K))}))})),V.add(N.onEndTask(H=>{g.get(N.tasks[H])?.changeEmitter.fire()})),V.add(N.onChange(H=>{for(let[K,j]of N.tasks.entries()){let J=g.get(j);if(!this.tree.hasElement(J))continue;let se=J.itemsCache.get(H.item);if(se&&this.tree.hasElement(se)){H.reason===2&&H.message.type===0&&this.tree.setChildren(se,v(N,H.item,K),{diffIdentityProvider:h});return}x(J)}})),V.add(N.onComplete(()=>{g.get(N)?.changeEmitter.fire(),V.dispose()}))};this._register(r.onResultsChanged(N=>{this.disposed||("completed"in N?g.get(N.completed)?.changeEmitter.fire():"started"in N?E(N.started):this.tree.setChildren(null,S(),{diffIdentityProvider:h}))}));let M=(N,V)=>{this.tree.setFocus([N]),this.tree.setSelection([N]),V||this.tree.domFocus()};this._register(t(async({subject:N,preserveFocus:V=!1})=>{if(N instanceof pI){let j=this.tree.getNode(null).children.find(J=>J.element instanceof rse?J.element.results.id===N.result.id&&J.element.index===N.taskIndex:J.element instanceof Kdt?J.element.id===N.result.id:!1);j&&M(j.element,V);return}let H=N instanceof mI?g.get(N.task)?.itemsCache.get(N.test):g.get(N.message);if(!H||!this.tree.hasElement(H))return;let K=[];for(let j=this.tree.getParentElement(H);j;j=this.tree.getParentElement(j))K.unshift(j);for(let j of K)this.tree.expand(j);this.tree.getRelativeTop(H)===null&&this.tree.reveal(H,.5),M(H,V)})),this._register(this.tree.onDidOpen(async N=>{if(N.element instanceof Q9)this.requestReveal.fire(new vh(N.element.result,N.element.test,N.element.taskIndex,N.element.messageIndex));else if(N.element instanceof j9){let V=N.element,H=eze(N.element.test,(K,j,J,se)=>new vh(V.results,V.test,se,J));this.requestReveal.fire(H||new mI(V.results,0,V.test))}else if(N.element instanceof XQt){let V=N.element.task;if(N.element.isOpen)return c.closeCoverage();u.withProgress({location:o.locationForProgress},()=>c.openCoverage(V,!0))}})),this._register(this.tree.onDidChangeSelection(N=>{for(let V of N.elements)if(V&&"test"in V){l.reveal.set(V.test.item.extId,void 0);break}})),this._register(l.onDidSelectTestInExplorer(N=>{if(!this.tree.getSelection().some(V=>V&&"test"in V&&V.test.item.extId===N)){for(let V of this.tree.getNode(null).children)if(V.element instanceof rse){for(let H of V.children)if(H.element instanceof j9&&H.element.test.item.extId===N){this.tree.setSelection([H.element]),this.tree.getRelativeTop(H.element)===null&&this.tree.reveal(H.element,.5);break}}}})),this._register(this.tree.onContextMenu(N=>this.onContextMenu(N))),this._register(this.tree.onDidChangeCollapseState(N=>{N.node.element instanceof JQt&&!N.node.collapsed&&p.publicLog2("testing.expandOlderResults")})),this.tree.setChildren(null,S());for(let N of r.results)!N.completedAt&&N instanceof lg&&E(N)}layout(e,t){this.tree.layout(e,t)}onContextMenu(e){if(!e.element)return;let t=this.getRenderedElement(e.element),o=this.treeActions.provideActionBar(t);this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>o.secondary.length?[...o.primary,new oi,...o.secondary]:o.primary,getActionsContext:()=>t.context,actionRunner:this.contextMenuActionRunner})}getRenderedElement(e){if(!(e instanceof rse)&&!(e instanceof Q9))return e;try{let o=this.tree.getCompressedTreeNode(e).element?.elements;if(o&&o.length>=2&&o[o.length-1]===e){let n=o[o.length-2];if(n)return n}}catch{}return e}dispose(){super.dispose(),this.disposed=!0}};fze=I([m(3,Xe),m(4,Rd),m(5,F),m(6,HV),m(7,YC),m(8,Go),m(9,_e)],fze);var sse=class{constructor(i,e){this.treeActions=i;this.instantiationService=e;this.templateId=sse.ID}static{this.ID="testRunElementRenderer"}renderCompressedElements(i,e,t){let o=i.element.elements,n=o[o.length-1];(n instanceof rse||n instanceof Q9)&&o.length>=2?this.doRender(o[o.length-2],t,n):this.doRender(n,t)}renderTemplate(i){let e=new O;i.classList.add("testing-stdtree-container");let t=D(i,_(".state")),o=D(i,_(".label")),n=new oo(i,{actionRunner:e.add(new e6t),actionViewItemProvider:(s,l)=>s instanceof Do?this.instantiationService.createInstance(Cl,s,{hoverDelegate:l.hoverDelegate}):void 0}),r=new O;return e.add(r),e.add(n),{icon:t,label:o,actionBar:n,elementDisposable:r,templateDisposable:e}}renderElement(i,e,t){this.doRender(i.element,t)}disposeTemplate(i){i.templateDisposable.dispose()}doRender(i,e,t){e.elementDisposable.clear(),e.elementDisposable.add(i.onDidChange(()=>this.doRender(i,e,t))),this.doRenderInner(i,e,t)}doRenderInner(i,e,t){let{label:o,labelWithIcons:n,description:r}=i;t instanceof Q9&&(r=t.label,i.description&&(r=`${r} @ ${i.description}`));let s=r?_("span.test-label-description",{},r):"";n?Ii(e.label,...n,s):Ii(e.label,o,s);let l=i.icon;e.icon.className=`computed-state ${l?q.asClassName(l):""}`;let c=this.treeActions.provideActionBar(i);e.actionBar.clear(),e.actionBar.context=i.context,e.actionBar.push(c.primary,{icon:!0,label:!1})}};sse=I([m(1,F)],sse);var zdt=class{constructor(i,e,t,o,n,r,s){this.showRevealLocationOnMessages=i;this.requestReveal=e;this.contextKeyService=t;this.menuService=o;this.commandService=n;this.testProfileService=r;this.editorService=s}provideActionBar(i){let e=i instanceof j9?i.test:void 0,t=e?this.testProfileService.capabilitiesForTest(e.item):0,o=[["peek","editor.contrib.testingOutputPeek"],[co.peekItemType.key,i.type]],n=R.TestPeekElement,r=[],s=[];if(i instanceof rse)if(r.push(new it("testing.outputPeek.showResultOutput",d(17200,null),q.asClassName(L.terminal),void 0,()=>this.requestReveal.fire(new pI(i.results,i.index)))),i.task.running)r.push(new it("testing.outputPeek.cancel",d(17190,null),q.asClassName(wQt),void 0,()=>this.commandService.executeCommand("testing.cancelRun",i.results.id,i.task.id)));else{r.push(new it("testing.outputPeek.rerun",d(17197,null),q.asClassName(qre),void 0,()=>this.commandService.executeCommand("testing.reRunLastRun",i.results.id)));let p=yt.some(i.results.tests,h=>Xx(h.ownComputedState));p&&r.push(new it("testing.outputPeek.rerunFailed",d(17196,null),q.asClassName(qre),void 0,()=>this.commandService.executeCommand("testing.reRunFailedFromLastRun",i.results.id))),r.push(new it("testing.outputPeek.debug",d(17192,null),q.asClassName(yk),void 0,()=>this.commandService.executeCommand("testing.debugLastRun",i.results.id))),p&&r.push(new it("testing.outputPeek.debugFailed",d(17191,null),q.asClassName(yk),void 0,()=>this.commandService.executeCommand("testing.debugFailedFromLastRun",i.results.id)))}if(i instanceof Kdt){i.value.tasks.length===1&&r.push(new it("testing.outputPeek.showResultOutput",d(17200,null),q.asClassName(L.terminal),void 0,()=>this.requestReveal.fire(new pI(i.value,0)))),r.push(new it("testing.outputPeek.reRunLastRun",d(17198,null),q.asClassName(W1),void 0,()=>this.commandService.executeCommand("testing.reRunLastRun",i.value.id)));let p=yt.some(i.value.tests,h=>Xx(h.ownComputedState));p&&r.push(new it("testing.outputPeek.rerunFailedResult",d(17196,null),q.asClassName(qre),void 0,()=>this.commandService.executeCommand("testing.reRunFailedFromLastRun",i.value.id))),t&4&&(r.push(new it("testing.outputPeek.debugLastRun",d(17193,null),q.asClassName(yk),void 0,()=>this.commandService.executeCommand("testing.debugLastRun",i.value.id))),p&&r.push(new it("testing.outputPeek.debugFailedResult",d(17191,null),q.asClassName(yk),void 0,()=>this.commandService.executeCommand("testing.debugFailedFromLastRun",i.value.id))))}if(i instanceof j9||i instanceof Q9){o.push([co.testResultOutdated.key,i.test.retired],[co.testResultState.key,eOt[i.test.ownComputedState]],...Z1e(i.test,t));let{extId:p,uri:h}=i.test.item;h&&r.push(new it("testing.outputPeek.goToTest",d(17195,null),q.asClassName(L.goToFile),void 0,()=>this.commandService.executeCommand("vscode.revealTest",p))),i.test.tasks[i.taskIndex].messages.some(g=>g.type===1)&&r.push(new it("testing.outputPeek.showResultOutput",d(17200,null),q.asClassName(L.terminal),void 0,()=>this.requestReveal.fire(i.outputSubject))),s.push(new it("testing.outputPeek.revealInExplorer",d(17199,null),q.asClassName(L.listTree),void 0,()=>this.commandService.executeCommand("_revealTestInExplorer",p))),t&2&&r.push(new it("testing.outputPeek.runTest",d(17189,null),q.asClassName(W1),void 0,()=>this.commandService.executeCommand("vscode.runTestsById",2,p))),t&4&&r.push(new it("testing.outputPeek.debugTest",d(17183,null),q.asClassName(yk),void 0,()=>this.commandService.executeCommand("vscode.runTestsById",4,p)))}i instanceof Q9&&(n=R.TestMessageContext,o.push([co.testMessageContext.key,i.contextValue]),this.showRevealLocationOnMessages&&i.location&&r.push(new it("testing.outputPeek.goToError",d(17194,null),q.asClassName(L.debugStackframe),void 0,()=>this.editorService.openEditor({resource:i.location.uri,options:{selection:i.location.range,preserveFocus:!0}}))));let l=this.contextKeyService.createOverlay(o),c={primary:r,secondary:s},u=this.menuService.getMenuActions(n,l,{shouldForwardArgs:!0});return $B(u,c,"inline"),c}};zdt=I([m(2,X),m(3,Yt),m(4,fe),m(5,Vu),m(6,ie)],zdt);var ZQt=class{constructor(){this.v=new WeakMap}get(i){return this.v.get(i)}getOrCreate(i,e){let t=this.v.get(i);if(t)return t;let o=e();return this.v.set(i,o),o}},TCn=a=>{let i=a.indexOf(`
`);return i===-1?a:a.slice(0,i)},Gdt=class{constructor(i){this.value=i}},e6t=class extends cs{async runAction(i,e){e instanceof Gdt?await i.run(...e.value):await i.run(e)}};var qdt=class extends Adt{constructor(e,t,o,n,r,s){super();this.message=e;this.followup=t;this.subject=o;this.instantiationService=n;this.contextKeyService=r;this.profileService=s;this.height=De("MessageStackFrame.height",100);this.icon=j1e;this.label=o instanceof vh?o.test.label:o instanceof mI?o.test.item.label:o.result.name}render(e){return this.message.style.visibility="visible",e.appendChild(this.message),ee(()=>this.message.remove())}renderActions(e){let t=new O;e.appendChild(this.followup.domNode),t.add(ee(()=>this.followup.domNode.remove()));let o=KAo(this.subject),n=o&&this.profileService.capabilitiesForTest(o),r;if(n)r=this.contextKeyService.createOverlay(G0t(n));else{let c=this.profileService.getControllerProfiles(this.subject.controllerId);r=this.contextKeyService.createOverlay([[co.hasRunnableTests.key,c.some(u=>u.group&2)],[co.hasDebuggableTests.key,c.some(u=>u.group&4)]])}let s=t.add(this.instantiationService.createChild(new Po([X,r]))),l=t.add(s.createInstance(pr,e,R.TestCallStack,{menuOptions:{shouldForwardArgs:!0},actionViewItemProvider:(c,u)=>ta(this.instantiationService,c,u)}));return l.context=this.subject,t.add(l),t}};qdt=I([m(3,F),m(4,X),m(5,Vu)],qdt);function aNo(a,i,e){if(e instanceof pI)return a.get(fe).executeCommand(i===4?"testing.debugLastRun":"testing.reRunLastRun",e.result.id);let t=a.get(Xs),o=e instanceof vh?e.test:e.test.item,n=t.collection.getNodeById(o.extId);if(n)return t.runTests({group:i,tests:[n]})}W(class extends z{constructor(){super({id:"testing.callStack.run",title:d(17204,null),icon:W1,menu:{id:R.TestCallStack,when:co.hasRunnableTests,group:"navigation"}})}run(a,i){aNo(a,2,i)}});W(class extends z{constructor(){super({id:"testing.callStack.debug",title:d(17203,null),icon:yk,menu:{id:R.TestCallStack,when:co.hasDebuggableTests,group:"navigation"}})}run(a,i){aNo(a,4,i)}});var q$=class extends k{constructor(e,t,o,n,r,s,l){super();this.editor=e;this.options=t;this.instantiationService=o;this.modelService=n;this.contextKeyService=r;this.uriIdentityService=s;this.configurationService=l;this.didReveal=this._register(new T);this.currentSubjectStore=this._register(new O);this.onCloseEmitter=this._register(new Ig);this.contentProvidersUpdateLimiter=this._register(new _k(1));this.isTreeLeft=!1;this.onClose=this.onCloseEmitter.event}get uiState(){return{splitViewWidths:Array.from({length:this.splitView.length},(e,t)=>this.splitView.getViewSize(t))}}get onDidChangeContentHeight(){return this.callStackWidget.onDidChangeContentHeight}get contentHeight(){return this.callStackWidget?.contentHeight||0}get diffViewIndex(){return this.isTreeLeft?1:0}get historyViewIndex(){return this.isTreeLeft?0:1}swapViews(){let e=this.splitView.getViewSize(0),t=this.splitView.getViewSize(1),o=this.splitView.removeView(1),n=this.splitView.removeView(0);this.splitView.addView(o,t),this.splitView.addView(n,e)}fillBody(e){let t=q$.lastSplitWidth;this.splitView=new Gp(e,{orientation:1});let{historyVisible:o,showRevealLocationOnMessages:n}=this.options,r=this.editor!==void 0,s=wm(this.configurationService,"testing.resultsView.layout");this.isTreeLeft=s==="treeLeft",this._register(this.configurationService.onDidChangeConfiguration(g=>{if(g.affectsConfiguration("testing.resultsView.layout")){let v=wm(this.configurationService,"testing.resultsView.layout")==="treeLeft";v!==this.isTreeLeft&&(this.isTreeLeft=v,this.swapViews())}}));let l=this.messageContainer=_(".test-output-peek-message-container");this.stackContainer=D(e,_(".test-output-call-stack-container")),this.callStackWidget=this._register(this.instantiationService.createInstance(tze,this.stackContainer,this.editor)),this.followupWidget=this._register(this.instantiationService.createInstance($dt,this.editor)),this.onCloseEmitter.input=this.followupWidget.onClose,this.contentProviders=[this._register(this.instantiationService.createInstance(pze,this.editor,l)),this._register(this.instantiationService.createInstance(mze,l)),this._register(this.instantiationService.createInstance(gze,l,r)),this._register(this.instantiationService.createInstance(hze,this.editor,l))],this.messageContextKeyService=this._register(this.contextKeyService.createScoped(e)),this.contextKeyTestMessage=co.testMessageContext.bindTo(this.messageContextKeyService),this.contextKeyResultOutdated=co.testResultOutdated.bindTo(this.messageContextKeyService);let c=D(e,_(".test-output-peek-tree.testing-stdtree")),u=this._register(this.instantiationService.createInstance(fze,c,this.didReveal.event,{showRevealLocationOnMessages:n,locationForProgress:this.options.locationForProgress}));this.onDidRequestReveal=u.onDidRequestReview;let p={onDidChange:U.None,element:this.stackContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:g=>{q$.lastSplitWidth=g,this.dimension&&(this.callStackWidget?.layout(this.dimension.height,g),this.layoutContentWidgets(this.dimension,g))}},h={onDidChange:U.None,element:c,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:g=>{this.dimension&&u.layout(this.dimension.height,g)}};this.splitView.addView(p,Ac.Distribute),this.splitView.addView(h,Ac.Distribute),this.isTreeLeft&&this.swapViews(),this.splitView.setViewVisible(this.historyViewIndex,o.value),this._register(o.onDidChange(g=>{this.splitView.setViewVisible(this.historyViewIndex,g)})),t&&queueMicrotask(()=>this.splitView.resizeView(this.diffViewIndex,t))}reveal(e){return this.didReveal.fire(e),this.current&&zAo(this.current,e.subject)?Promise.resolve():(this.current=e.subject,this.contentProvidersUpdateLimiter.queue(async()=>{this.currentSubjectStore.clear();let t=this.getCallFrames(e.subject)||[],o=await this.prepareTopFrame(e.subject,t);this.setCallStackFrames(o,t),this.followupWidget.show(e.subject),this.populateFloatingClick(e.subject)}))}setCallStackFrames(e,t){this.callStackWidget.setFrames([e,...t.map(o=>new ose(o.label,o.uri,o.position?.lineNumber,o.position?.column))])}collapseStack(){this.callStackWidget.collapseAll()}getCallFrames(e){if(!(e instanceof vh))return;let t=e.stack;if(!t?.length||!this.editor)return t;let o=t[0],n=e.revealLocation;return n&&o.position&&o.uri&&o.position.lineNumber===n.range.startLineNumber&&o.position.column===n.range.startColumn&&this.uriIdentityService.extUri.isEqual(o.uri,n.uri)?t.slice(1):t}async prepareTopFrame(e,t){this.messageContainer.style.visibility="hidden",this.stackContainer.appendChild(this.messageContainer);let o=this.currentTopFrame=this.instantiationService.createInstance(qdt,this.messageContainer,this.followupWidget,e),n=t.length>0;o.showHeader.set(n,void 0);let r=await Z4i(this.contentProviders,s=>s.update(e));if(r){let s=this.splitView.getViewSize(this.diffViewIndex);s!==-1&&this.dimension&&o.height.set(r.layout({width:s,height:this.dimension?.height},n),void 0),r.onScrolled&&this.currentSubjectStore.add(this.callStackWidget.onDidScroll(l=>{r.onScrolled(l)})),r.onDidContentSizeChange&&this.currentSubjectStore.add(r.onDidContentSizeChange(()=>{let l=this.splitView.getViewSize(this.diffViewIndex);this.dimension&&!this.isDoingLayoutUpdate&&l!==-1&&(this.isDoingLayoutUpdate=!0,o.height.set(r.layout({width:l,height:this.dimension.height},n),void 0),this.isDoingLayoutUpdate=!1)}))}return o}layoutContentWidgets(e,t=this.splitView.getViewSize(this.diffViewIndex)){this.isDoingLayoutUpdate=!0;for(let o of this.contentProviders){let n=o.layout({height:e.height,width:t},!!this.currentTopFrame?.showHeader.get());n&&this.currentTopFrame?.height.set(n,void 0)}this.isDoingLayoutUpdate=!1}populateFloatingClick(e){if(!(e instanceof vh))return;this.currentSubjectStore.add(ee(()=>{this.contextKeyResultOutdated.reset(),this.contextKeyTestMessage.reset()})),this.contextKeyTestMessage.set(e.contextValue||""),e.result instanceof lg?(this.contextKeyResultOutdated.set(e.result.getStateById(e.test.extId)?.retired??!1),this.currentSubjectStore.add(e.result.onChange(o=>{o.item.item.extId===e.test.extId&&this.contextKeyResultOutdated.set(o.item.retired??!1)}))):this.contextKeyResultOutdated.set(!0);let t=this.currentSubjectStore.add(this.instantiationService.createChild(new Po([X,this.messageContextKeyService])));this.currentSubjectStore.add(t.createInstance(cNe,{container:this.messageContainer,menuId:R.TestMessageContent,getActionArg:()=>e.context}))}onLayoutBody(e,t){this.dimension=new di(t,e),this.splitView.layout(t)}onWidth(e){this.splitView.layout(e)}};q$=I([m(2,F),m(3,Bt),m(4,X),m(5,gt),m(6,B)],q$);var _Cn=500,$dt=class extends k{constructor(e,t,o){super();this.editor=e;this.testService=t;this.quickInput=o;this.el=st("div.testing-followup-action",[]);this.visibleStore=this._register(new O);this.onCloseEmitter=this._register(new T);this.onClose=this.onCloseEmitter.event}get domNode(){return this.el.root}show(e){this.visibleStore.clear(),e instanceof vh&&this.showMessage(e)}async showMessage(e){let t=this.visibleStore.add(new qe),o=Date.now();e.result instanceof lg&&!e.result.completedAt&&await new Promise(r=>U.once(e.result.onComplete)(r));let n=await this.testService.provideTestFollowups({extId:e.test.extId,messageIndex:e.messageIndex,resultId:e.result.id,taskIndex:e.taskIndex},t.token);if(!n.followups.length||t.token.isCancellationRequested){n.dispose();return}this.visibleStore.add(n),St(this.el.root),this.el.root.classList.toggle("animated",Date.now()-o>_Cn),this.el.root.appendChild(this.makeFollowupLink(n.followups[0])),n.followups.length>1&&this.el.root.appendChild(this.makeMoreLink(n.followups)),this.visibleStore.add(ee(()=>{this.el.root.remove()}))}makeFollowupLink(e){let t=this.makeLink(()=>this.actionFollowup(t,e));return Ii(t,...ir(e.message)),t}makeMoreLink(e){let t=this.makeLink(()=>this.quickInput.pick(e.map((o,n)=>({label:o.message,index:n}))).then(o=>{o?.length&&e[o[0].index].execute()}));return t.innerText=d(17202,null,e.length-1),t}makeLink(e){let t=document.createElement("a");return t.tabIndex=0,this.visibleStore.add($(t,"click",e)),this.visibleStore.add($(t,"keydown",o=>{let n=new mi(o);(n.equals(10)||n.equals(3))&&e()})),t}actionFollowup(e,t){e.ariaDisabled!=="true"&&(e.ariaDisabled="true",t.execute(),this.editor&&this.onCloseEmitter.fire())}};$dt=I([m(1,Xs),m(2,$e)],$dt);function*lNo([a]){if(a)for(let i of a.tests)for(let e=0;e<i.tasks.length;e++){let t=i.tasks[e].messages;for(let o=0;o<t.length;o++)t[o].type===0&&(yield{result:a,test:i,taskIndex:e,messageIndex:o})}}function FUi({result:a,test:i,taskIndex:e,messageIndex:t}){return rL({type:2,resultId:a.id,testExtId:i.item.extId,taskIndex:e,messageIndex:t})}var ase=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.configuration=e;this.editorService=t;this.codeEditorService=o;this.testResults=n;this.testService=r;this.viewsService=l;this.commandService=c;this.notificationService=u;this._register(n.onTestChanged(this.openPeekOnFailure,this)),this.historyVisible=this._register(YP.stored(new tI({key:"testHistoryVisibleInPeek",scope:0,target:0},s),!1))}static{this.ID="workbench.contrib.testing.peekOpener"}async open(){let e,t=this.editorService.activeTextEditorControl;if(fn(t)&&t.getModel()?.uri){let o=t.getModel()?.uri;o&&(e=await this.getFileCandidateMessage(o,t.getPosition()))}return e||(e=this.lastUri),e||(e=this.getAnyCandidateMessage()),e?this.showPeekFromUri(e):!1}tryPeekFirstError(e,t,o){let n=this.getFailedCandidateMessage(t);return n?(this.showPeekFromUri({type:2,documentUri:n.location.uri,taskIndex:n.taskId,messageIndex:n.index,resultId:e.id,testExtId:t.item.extId},void 0,{selection:n.location.range,selectionRevealType:3,...o}),!0):!1}peekUri(e,t={}){let o=cSe(e),n=o&&this.testResults.getResult(o.resultId);if(!o||!n||!("testExtId"in o)||!("messageIndex"in o))return!1;let r=n.getStateById(o.testExtId)?.tasks[o.taskIndex].messages[o.messageIndex];return r?.location?(this.showPeekFromUri({type:2,documentUri:r.location.uri,taskIndex:o.taskIndex,messageIndex:o.messageIndex,resultId:n.id,testExtId:o.testExtId},t.inEditor,{selection:r.location.range,...t.options}),!0):!1}closeAllPeeks(){for(let e of this.codeEditorService.listCodeEditors())IS.get(e)?.removePeek()}openCurrentInEditor(){let e=this.getActiveControl();if(!e)return;let t={pinned:!1,revealIfOpened:!0};if(e instanceof pI||e instanceof mI){this.editorService.openEditor({resource:e.outputUri,options:t});return}if(e instanceof mI){this.editorService.openEditor({resource:e.outputUri,options:t});return}let o=e.message;e.isDiffable?this.editorService.openEditor({original:{resource:e.expectedUri},modified:{resource:e.actualUri},options:t}):typeof o.message=="string"?this.editorService.openEditor({resource:e.messageUri,options:t}):this.commandService.executeCommand("markdown.showPreview",e.messageUri).catch(n=>{this.notificationService.error(d(17171,null,n.message))})}getActiveControl(){let e=Qdt(this.codeEditorService);return(e&&IS.get(e))?.subject.get()??this.viewsService.getActiveViewWithId("workbench.panel.testResults.view")?.subject}async showPeekFromUri(e,t,o){if(fn(t))return this.lastUri=e,IS.get(t)?.show(rL(this.lastUri)),!0;let r=(await this.editorService.openEditor({resource:e.documentUri,options:{revealIfOpened:!0,...o}}))?.getControl();return fn(r)?(this.lastUri=e,IS.get(r)?.show(rL(this.lastUri)),!0):!1}openPeekOnFailure(e){if(e.reason!==1)return;let t=this.getFailedCandidateMessage(e.item);if(!t||e.result.request.continuous&&!wm(this.configuration,"testing.automaticallyOpenPeekViewDuringAutoRun"))return;let o=this.codeEditorService.listCodeEditors();switch(wm(this.configuration,"testing.automaticallyOpenPeekView")){case"failureInVisibleDocument":{let s=this.editorService.visibleTextEditorControls,l=new Set(s.filter(fn).map(c=>c.getModel()?.uri.toString()));if(!yt.some(kmo(e.result,e.item),c=>c.item.uri&&l.has(c.item.uri.toString()))||!l.has(t.location.uri.toString()))return;break}case"failureAnywhere":break;default:return}o.map(IS.get).some(s=>s?.subject.get())||this.tryPeekFirstError(e.result,e.item)}async getFileCandidateMessage(e,t){let o,n=1/0,r=e.toString();for(let s of this.testService.collection.all){let l=this.testResults.getStateById(s.item.extId);l&&eze(l[1],(c,u,p,h)=>{if(u.type!==0||!u.location||u.location.uri.toString()!==r)return;let g=t?Math.abs(t.lineNumber-u.location.range.startLineNumber):0;(!o||g<=n)&&(n=g,o={type:2,testExtId:l[1].item.extId,resultId:l[0].id,taskIndex:h,messageIndex:p,documentUri:e})})}return o}getAnyCandidateMessage(){let e=new Set;for(let t of this.testResults.results)for(let o of t.tests){if(e.has(o.item.extId))continue;e.add(o.item.extId);let n=eze(o,(r,s,l,c)=>s.location&&{type:2,testExtId:o.item.extId,resultId:t.id,taskIndex:c,messageIndex:l,documentUri:s.location.uri});if(n)return n}}getFailedCandidateMessage(e){let t=e.item.uri&&e.item.range?{uri:e.item.uri,range:e.item.range}:void 0,o;return eze(e,(n,r,s,l)=>{let c=r.location||t;!Xx(n.state)||!c||o&&r.type!==0||(o={taskId:l,index:s,message:r,location:c})}),o}};ase=I([m(0,B),m(1,ie),m(2,Qt),m(3,Rd),m(4,Xs),m(5,de),m(6,Gt),m(7,fe),m(8,Ne)],ase);var IS=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.codeEditorService=t;this.instantiationService=o;this.testResults=n;this.peek=this._register(IB("TestingOutputPeek",void 0));this.subject=ke(e=>this.peek.read(e)?.current.read(e));this.visible=co.isPeekVisible.bindTo(r),this._register(e.onDidChangeModel(()=>this.peek.set(void 0,void 0))),this._register(n.onResultsChanged(this.closePeekOnCertainResultEvents,this)),this._register(n.onTestChanged(this.closePeekOnTestChange,this))}static get(e){return e.getContribution("editor.contrib.testingOutputPeek")}async show(e){let t=this.retrieveTest(e);t&&this.showSubject(t)}async showSubject(e){if(!this.peek.get()){let t=this.instantiationService.createInstance(jdt,this.editor);this.peek.set(t,void 0),U.once(t.onDidClose)(()=>{this.visible.set(!1),this.peek.set(void 0,void 0)}),this.visible.set(!0),t.create()}e instanceof vh&&cn(Zre(e.message.message)),this.peek.get().setModel(e)}async openAndShow(e){let t=this.retrieveTest(e);if(!t)return;if(!t.revealLocation||t.revealLocation.uri.toString()===this.editor.getModel()?.uri.toString())return this.show(e);let o=await this.codeEditorService.openCodeEditor({resource:t.revealLocation.uri,options:{pinned:!1,revealIfOpened:!0}},this.editor);if(o)return IS.get(o)?.removePeek(),IS.get(o)?.show(e)}removePeek(){this.peek.set(void 0,void 0)}collapseStack(){this.peek.get()?.collapseStack()}next(){let e=this.peek.get()?.current.get();if(!e)return;let t,o=!1;for(let n of lNo(this.testResults.results)){if(t??=n,e instanceof pI&&n.result.id===e.result.id&&(o=!0),o){this.openAndShow(FUi(n));return}e instanceof mI&&e.test.item.extId===n.test.item.extId&&e.taskIndex===n.taskIndex&&e.result.id===n.result.id&&(o=!0),e instanceof vh&&e.test.extId===n.test.item.extId&&e.messageIndex===n.messageIndex&&e.taskIndex===n.taskIndex&&e.result.id===n.result.id&&(o=!0)}t&&this.openAndShow(FUi(t))}previous(){let e=this.subject.get();if(!e)return;let t,o=!1,n;for(let s of lNo(this.testResults.results))if(n=s,!o){if(e instanceof pI){s.result.id===e.result.id&&(o=!0);continue}if(e instanceof mI){s.test.item.extId===e.test.item.extId&&s.result.id===e.result.id&&s.taskIndex===e.taskIndex&&(o=!0);continue}if(e.test.extId===s.test.item.extId&&e.messageIndex===s.messageIndex&&e.taskIndex===s.taskIndex&&e.result.id===s.result.id){o=!0;continue}t=s}let r=t||n;r&&this.openAndShow(FUi(r))}removeIfPeekingForTest(e){let t=this.subject.get();t&&t instanceof vh&&t.test.extId===e&&this.peek.set(void 0,void 0)}closePeekOnTestChange(e){e.reason!==1||e.previousState===e.item.ownComputedState||this.removeIfPeekingForTest(e.item.item.extId)}closePeekOnCertainResultEvents(e){"started"in e&&this.peek.set(void 0,void 0),"removed"in e&&this.testResults.results.length===0&&this.peek.set(void 0,void 0)}retrieveTest(e){let t=cSe(e);if(!t)return;let o=this.testResults.results.find(c=>c.id===t.resultId);if(!o)return;if(t.type===0)return new pI(o,t.taskIndex);if(t.type===1){let c=o.getStateById(t.testExtId);return c?new mI(o,t.taskIndex,c):void 0}let{testExtId:n,taskIndex:r,messageIndex:s}=t,l=o?.getStateById(n);if(!(!l||!l.tasks[t.taskIndex]))return new vh(o,l,r,s)}};IS=I([m(1,Qt),m(2,F),m(3,Rd),m(4,X)],IS);var jdt=class extends zT{constructor(e,t,o,n,r,s,l,c,u,p){super(e,{showFrame:!0,frameWidth:1,showArrow:!0,isResizeable:!0,isAccessible:!0,className:"test-output-peek"},l);this.themeService=t;this.testingPeek=n;this.contextKeyService=r;this.menuService=s;this.modelService=c;this.codeEditorService=u;this.uriIdentityService=p;this.current=De("testPeekCurrent",void 0);this.resizeOnNextContentHeightUpdate=!1;this._disposables.add(t.onDidColorThemeChange(this.applyTheme,this)),o.addExclusiveWidget(e,this)}_getMaximumHeightInLines(){let e=super._getMaximumHeightInLines(),t=this.content?.contentHeight;if(!t||this.testingPeek.historyVisible.value)return e;let o=this.editor.getOption(75);return Math.min(e||1/0,(t+41)/o+1)}applyTheme(){let e=this.themeService.getColorTheme(),t=this.current.get(),o=t instanceof vh&&t.message.type===0,n=(o?e.getColor(rAo):e.getColor(sAo))||Ue.transparent,r=(o?e.getColor(aAo):e.getColor(lAo))||Ue.transparent,s=e.getColor(Bo);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s&&r?r.makeOpaque(s):r,primaryHeadingColor:e.getColor(n0),secondaryHeadingColor:e.getColor(r0)})}_fillContainer(e){if(!this.scopedContextKeyService){this.scopedContextKeyService=this._disposables.add(this.contextKeyService.createScoped(e)),co.isInPeek.bindTo(this.scopedContextKeyService).set(!0);let t=this._disposables.add(this.instantiationService.createChild(new Po([X,this.scopedContextKeyService])));this.content=this._disposables.add(t.createInstance(q$,this.editor,{historyVisible:this.testingPeek.historyVisible,showRevealLocationOnMessages:!1,locationForProgress:"workbench.panel.testResults.view"})),this._disposables.add(this.content.onClose(()=>{IS.get(this.editor)?.removePeek()}))}super._fillContainer(e)}_fillHead(e){super._fillHead(e);let t=this._disposables.add(this.contextKeyService.createScoped(e));this._disposables.add(cu(co.peekHasStack,t,s=>UAo(this.current.read(s))));let o=this.menuService.createMenu(R.TestPeekTitle,t),n=this._actionbarWidget;this._disposables.add(o.onDidChange(()=>{for(r.length=0,$B(o.getActions(),r);n.getAction(1);)n.pull(0);n.push(r,{label:!1,icon:!0,index:0})}));let r=[];$B(o.getActions(),r),n.push(r,{label:!1,icon:!0,index:0})}_fillBody(e){this.content.fillBody(e);let t=this._disposables.add(new Dt(()=>{this.resizeOnNextContentHeightUpdate=!1},500));this._disposables.add(this.content.onDidChangeContentHeight(o=>{if(!this.resizeOnNextContentHeightUpdate||!o)return;let n=this._getMaximumHeightInLines();n&&(this._relayout(Math.min(n,this.getVisibleEditorLines()/2),!0),t.isScheduled()||t.schedule())})),this._disposables.add(this.content.onDidRequestReveal(o=>{IS.get(this.editor)?.show(o instanceof vh?o.messageUri:o.outputUri)}))}setModel(e){if(e instanceof pI||e instanceof mI)return this.current.set(e,void 0),this.showInPlace(e);let t=this.current,o=e.revealLocation?.range.getStartPosition();return!o&&!t?Promise.resolve():(this.current.set(e,void 0),o?(this.resizeOnNextContentHeightUpdate=!0,this.show(o,10),this.editor.revealRangeNearTopIfOutsideViewport(G.fromPositions(o),0),this.showInPlace(e)):this.showInPlace(e))}collapseStack(){this.content.collapseStack()}getVisibleEditorLines(){return Math.round(this.editor.getDomNode().clientHeight/this.editor.getOption(75))}async showInPlace(e){if(e instanceof vh){let t=e.message;this.setTitle(DCn(Zre(t.message)),Du(e.test.label))}else this.setTitle(d(17175,null));this.applyTheme(),await this.content.reveal({subject:e,preserveFocus:!1})}_doLayoutBody(e,t){super._doLayoutBody(e,t),this.content.onLayoutBody(e,t)}_onWidth(e){super._onWidth(e),this.dimension&&(this.dimension=new di(e,this.dimension.height)),this.content.onWidth(e)}};jdt=I([m(1,Pe),m(2,T4),m(3,sL),m(4,X),m(5,Yt),m(6,F),m(7,Bt),m(8,Qt),m(9,gt)],jdt);var vze=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,c,u,p);this.resultService=h;this.content=new uo(()=>this._register(this.instantiationService.createInstance(q$,void 0,{historyVisible:jPo(!0),showRevealLocationOnMessages:!0,locationForProgress:"workbench.view.testing"})))}get subject(){return this.content.rawValue?.current}showLatestRun(e=!1){let t=this.resultService.results.find(o=>o.tasks.length);t&&this.content.rawValue?.reveal({preserveFocus:e,subject:new pI(t,0)})}renderBody(e){super.renderBody(e),this.isBodyVisible()?this.renderContent(e):this._register(U.once(U.filter(this.onDidChangeBodyVisibility,Boolean))(()=>this.renderContent(e)))}layoutBody(e,t){super.layoutBody(e,t),this.content.rawValue?.onLayoutBody(e,t)}renderContent(e){let t=this.content.value;t.fillBody(e),this._register(t.onDidRequestReveal(n=>t.reveal({preserveFocus:!0,subject:n})));let[o]=this.resultService.results;o&&o.tasks.length&&t.reveal({preserveFocus:!0,subject:new pI(o,0)})}};vze=I([m(1,Le),m(2,Xe),m(3,B),m(4,X),m(5,ji),m(6,F),m(7,Je),m(8,Pe),m(9,ot),m(10,Rd)],vze);var DCn=a=>{let i=a.indexOf(`
`);return i===-1?a:a.slice(0,i)};function RCn(a){let i=a.listDiffEditors();for(let e of i)if(e.hasTextFocus()&&e instanceof nL)return e.getParentEditor();return null}var t6t=class extends yl{constructor(){super({id:"editor.closeTestPeek",title:P(17165,"Close"),icon:L.close,precondition:C.or(co.isInPeek,co.isPeekVisible),keybinding:{weight:-1,primary:9,when:C.not("config.editor.stablePeek")}})}runEditorCommand(i,e){let t=Qdt(i.get(Qt));IS.get(t??e)?.removePeek()}},i6t=C.and(me.focus,co.isPeekVisible),Qdt=a=>{let i=a.getFocusedCodeEditor()||a.getActiveCodeEditor();return i&&LCn(a,i)},LCn=(a,i)=>{if(IS.get(i)?.subject.get())return i;if(i instanceof Ed)return i.getParentEditor();let e=RCn(a);return e||i},o6t=class a extends z{static{this.ID="testing.goToNextMessage"}constructor(){super({id:a.ID,f1:!0,title:P(17167,"Go to Next Test Failure"),metadata:{description:P(17168,"Shows the next failure message in your file")},icon:L.arrowDown,category:Fe.Test,keybinding:{primary:578,weight:101,when:i6t},menu:[{id:R.TestPeekTitle,group:"navigation",order:2},{id:R.CommandPalette,when:i6t}]})}run(i){let e=Qdt(i.get(Qt));e&&IS.get(e)?.next()}},n6t=class a extends z{static{this.ID="testing.goToPreviousMessage"}constructor(){super({id:a.ID,f1:!0,title:P(17169,"Go to Previous Test Failure"),metadata:{description:P(17170,"Shows the previous failure message in your file")},icon:L.arrowUp,category:Fe.Test,keybinding:{primary:1602,weight:101,when:i6t},menu:[{id:R.TestPeekTitle,group:"navigation",order:1},{id:R.CommandPalette,when:i6t}]})}run(i){let e=Qdt(i.get(Qt));e&&IS.get(e)?.previous()}},r6t=class a extends z{static{this.ID="testing.collapsePeekStack"}constructor(){super({id:a.ID,title:P(17166,"Collapse Stack Frames"),icon:L.collapseAll,category:Fe.Test,menu:[{id:R.TestPeekTitle,when:co.peekHasStack,group:"navigation",order:4}]})}run(i){let e=Qdt(i.get(Qt));e&&IS.get(e)?.collapseStack()}},s6t=class a extends z{static{this.ID="testing.openMessageInEditor"}constructor(){super({id:a.ID,f1:!1,title:P(17172,"Open in Editor"),icon:L.goToFile,category:Fe.Test,menu:[{id:R.TestPeekTitle}]})}run(i){i.get(sL).openCurrentInEditor()}},a6t=class a extends z{static{this.ID="testing.toggleTestingPeekHistory"}constructor(){super({id:a.ID,f1:!0,title:P(17173,"Toggle Test History in Peek"),metadata:{description:P(17174,"Shows or hides the history of test runs in the peek view")},icon:L.history,category:Fe.Test,menu:[{id:R.TestPeekTitle,group:"navigation",order:3}],keybinding:{weight:200,primary:550,when:co.isPeekVisible.isEqualTo(!0)}})}run(i){let e=i.get(sL);e.historyVisible.value=!e.historyVisible.value}};var cNo=128,dNo=30,mNo=2;function MCn(a,i){let e=a.listDiffEditors();for(let t of e)if(t.getOriginalEditor()===i)return!0;return!1}var Zdt=class{constructor(){this.runByIdKey=new Map}get size(){return this.runByIdKey.size}getForExactTests(i){let e=i.sort().join("\0\0");return this.runByIdKey.get(e)}addTest(i){let e=i.testIds.sort().join("\0\0");this.runByIdKey.set(e,i)}getById(i){for(let e of this.runByIdKey.values())if(e.id===i)return e}*[Symbol.iterator](){for(let i of this.runByIdKey.values())yield i}},bze=class extends k{constructor(e,t,o,n,r,s){super();this.configurationService=t;this.testService=o;this.results=n;this.instantiationService=r;this.modelService=s;this.generation=0;this.changeEmitter=this._register(new T);this.decorationCache=new dt;this.invalidatedMessages=new WeakSet;this.onDidChange=this.changeEmitter.event;this._register(e.registerDecorationType("test-message-decoration",Y9.decorationId,{},void 0)),this._register(s.onModelRemoved(c=>this.decorationCache.delete(c.uri)));let l=this._register(new Dt(()=>this.invalidate(),100));this._register(this.testService.onWillProcessDiff(c=>{for(let u of c){if(u.op!==2)continue;let p=this.decorationCache.get(u.uri);p&&(p.rangeUpdateVersionId=u.docv)}l.isScheduled()||l.schedule()})),this._register(U.any(this.results.onResultsChanged,this.results.onTestChanged,this.testService.excluded.onTestExclusionsChanged,U.filter(t.onDidChangeConfiguration,c=>c.affectsConfiguration("testing.gutterEnabled")))(()=>{l.isScheduled()||l.schedule()})),this._register(zat.registerGutterActionsGenerator((c,u)=>{let p=c.editor.getModel(),h=FO.get(c.editor);if(!p||!h?.currentUri)return;let g=this.syncDecorations(h.currentUri);if(!g.size)return;let f=p.getLinesDecorations(c.lineNumber,c.lineNumber);for(let{id:v}of f){let b=g.getById(v);if(b){let{object:S}=b.getContextMenuActions();for(let y of S)u.push(y,"1_testing")}}}))}invalidateResultMessage(e){this.invalidatedMessages.add(e),this.invalidate()}syncDecorations(e){let t=this.modelService.getModel(e);if(!t)return new Zdt;let o=this.decorationCache.get(e);return o&&o.generation===this.generation&&(o.rangeUpdateVersionId===void 0||o.rangeUpdateVersionId!==t.getVersionId())?o.value:this.applyDecorations(t)}getDecoratedTestPosition(e,t){let o=this.modelService.getModel(e);if(!o)return;let n=yt.find(this.syncDecorations(e),r=>r instanceof lse&&r.isForTest(t));if(n)return o.getDecorationRange(n.id)?.getStartPosition()}invalidate(){this.generation++,this.changeEmitter.fire()}updateDecorationsAlternateAction(e,t){let o=this.modelService.getModel(e),n=this.decorationCache.get(e);!o||!n||n.isAlt===t||(n.isAlt=t,o.changeDecorations(r=>{for(let s of n.value)s instanceof lse&&s.editorDecoration.alternate&&r.changeDecorationOptions(s.id,t?s.editorDecoration.alternate:s.editorDecoration.options)}))}applyDecorations(e){let t=wm(this.configurationService,"testing.gutterEnabled"),o=this.decorationCache.get(e.uri),n=o?.rangeUpdateVersionId===e.getVersionId(),r=o?.value??new Zdt;return e.changeDecorations(l=>{let c=new Zdt,u=new bQt;for(let h of this.testService.collection.getNodeByUrl(e.uri)){if(!h.item.range)continue;let g=this.results.getStateById(h.item.extId),f=h.item.range.startLineNumber;u.push({line:f,id:"",test:h,resultItem:g?.[1]})}for(let[h,g]of u.lines()){let f=g.length>1,v=r.getForExactTests(g.map(b=>b.test.item.extId));v&&n&&e.getDecorationRange(v.id)?.startLineNumber!==h&&(v=void 0),v?(v.replaceOptions(g,t)&&l.changeDecorationOptions(v.id,v.editorDecoration.options),c.addTest(v)):c.addTest(f?this.instantiationService.createInstance(Ydt,g,t,e):this.instantiationService.createInstance(Xdt,g[0].test,g[0].resultItem,e,t))}let p=new Set;for(let h of c)h.id===""?h.id=l.addDecoration(h.editorDecoration.range,h.editorDecoration.options):p.add(h.id);for(let h of r)p.has(h.id)||l.removeDecoration(h.id);return this.decorationCache.set(e.uri,{generation:this.generation,rangeUpdateVersionId:o?.rangeUpdateVersionId,value:c}),c})||r}};bze=I([m(0,Qt),m(1,B),m(2,Xs),m(3,Rd),m(4,F),m(5,_t)],bze);var FO=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.editor=e;this.codeEditorService=t;this.testService=o;this.decorations=n;this.uriIdentityService=r;this.results=s;this.configurationService=l;this.instantiationService=c;this.expectedWidget=this._register(new ue);this.actualWidget=this._register(new ue);this.errorContentWidgets=this._register(new Ot);this.loggedMessageDecorations=new Map;this._register(t.registerDecorationType("test-message-decoration",Y9.decorationId,{},void 0,e)),this.attachModel(e.getModel()?.uri),this._register(n.onDidChange(()=>{this._currentUri&&n.syncDecorations(this._currentUri)}));let u=this._register(new am);this._register(this.results.onTestChanged(g=>{g.reason===2&&u.queue(()=>(this.applyResults(),Li(100)))})),this._register(U.any(this.results.onResultsChanged,e.onDidChangeModel,this.testService.showInlineOutput.onDidChange)(()=>this.applyResults()));let p=Me(e.getDomNode());this._register($(p,"keydown",g=>{new mi(g).keyCode===6&&this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!0)})),this._register($(p,"keyup",g=>{new mi(g).keyCode===6&&this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!1)})),this._register($(p,"blur",()=>{this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!1)})),this._register(this.editor.onKeyUp(g=>{g.keyCode===6&&this._currentUri&&n.updateDecorationsAlternateAction(this._currentUri,!1)})),this._register(this.editor.onDidChangeModel(g=>this.attachModel(g.newModelUrl||void 0))),this._register(this.editor.onMouseDown(g=>{if(g.target.position&&this.currentUri){let f=e.getModel()?.getLineDecorations(g.target.position.lineNumber)??[];if(!f.length)return;let v=n.syncDecorations(this.currentUri);for(let{id:b}of f)if(v.getById(b)?.click(g)){g.event.stopPropagation();return}}})),this._register(U.accumulate(this.editor.onDidChangeModelContent,0,void 0,this._store)(g=>{let f=e.getModel();if(!this._currentUri||!f)return;let v=!1;for(let[b,S]of this.loggedMessageDecorations)g.some(w=>w.changes.some(x=>x.range.startLineNumber<=S.line&&x.range.endLineNumber>=S.line||S.resultItem?.item.range&&S.resultItem.item.range.startLineNumber<=x.range.startLineNumber&&S.resultItem.item.range.endLineNumber>=x.range.endLineNumber))&&(v=!0,FO.invalidatedTests.add(S.resultItem||b));v&&this.applyResults()}));let h=()=>{this.editor.getContainerDomNode().style.setProperty("--testMessageDecorationFontFamily",e.getOption(58)),this.editor.getContainerDomNode().style.setProperty("--testMessageDecorationFontSize",`${e.getOption(61)}px`)};this._register(this.editor.onDidChangeConfiguration(g=>{g.hasChanged(58)&&h()})),h()}static{this.invalidatedTests=new WeakSet}static get(e){return e.getContribution("editor.contrib.testingDecorations")}get currentUri(){return this._currentUri}attachModel(e){switch(e&&cSe(e)?.type){case 4:this.expectedWidget.value=new WUi(this.editor),this.actualWidget.clear();break;case 3:this.expectedWidget.clear(),this.actualWidget.value=new VUi(this.editor);break;default:this.expectedWidget.clear(),this.actualWidget.clear()}MCn(this.codeEditorService,this.editor)&&(e=void 0),this._currentUri=e,e&&(this.decorations.syncDecorations(e),(async()=>{for await(let t of Zme(this.testService,this.uriIdentityService,e,!1))if(this._currentUri!==e)break})())}applyResults(){let e=this.editor.getModel();if(!e)return this.clearResults();let t=e.uri.toString(),o=new Set;this.applyResultsContentWidgets(t,o),this.applyResultsLoggedMessages(t,o)}clearResults(){this.errorContentWidgets.clearAndDisposeAll()}isMessageInvalidated(e){return FO.invalidatedTests.has(e)}applyResultsContentWidgets(e,t){let o=new Set;wm(this.configurationService,"testing.showAllMessages")?this.results.results.forEach(n=>this.applyContentWidgetsFromResult(n,e,o,t)):this.results.results.length&&this.applyContentWidgetsFromResult(this.results.results[0],e,o,t);for(let n of this.errorContentWidgets.keys())o.has(n)||this.errorContentWidgets.deleteAndDispose(n)}applyContentWidgetsFromResult(e,t,o,n){for(let r of e.tests)if(!FO.invalidatedTests.has(r))for(let s=0;s<r.tasks.length;s++){let l=r.tasks[s];for(let c=0;c<l.messages.length;c++){let u=l.messages[c];if(u.type!==0||this.isMessageInvalidated(u))continue;let p=u.location?.uri.toString()===t?u.location.range.startLineNumber:u.stackTrace&&iD(u.stackTrace,g=>g.position&&g.uri?.toString()===t?g.position.lineNumber:void 0);if(p===void 0||n.has(p))continue;n.add(p);let h=this.errorContentWidgets.get(u);if(!h){let g=this.editor.getModel()?.getLineLength(p)??100;h=this.instantiationService.createInstance(Jdt,this.editor,new ye(p,g+1),u,r,rL({type:3,messageIndex:c,taskIndex:s,resultId:e.id,testExtId:r.item.extId})),this.errorContentWidgets.set(u,h)}o.add(u)}}}applyResultsLoggedMessages(e,t){this.editor.changeDecorations(o=>{let n=new Set;wm(this.configurationService,"testing.showAllMessages")?this.results.results.forEach(r=>this.applyLoggedMessageFromResult(r,e,n,t,o)):this.results.results.length&&this.applyLoggedMessageFromResult(this.results.results[0],e,n,t,o);for(let[r,{id:s}]of this.loggedMessageDecorations)n.has(r)||o.removeDecoration(s)})}applyLoggedMessageFromResult(e,t,o,n,r){if(!this.testService.showInlineOutput.value||!(e instanceof lg))return;let s=(l,c,u)=>{if(this.isMessageInvalidated(c)||c.location?.uri.toString()!==t)return;o.add(c);let p=c.location.range.startLineNumber;if(n.has(p)||this.loggedMessageDecorations.has(c))return;let h=this.instantiationService.createInstance(Y9,c,u,this.editor.getModel());n.add(p);let g=r.addDecoration(h.editorDecoration.range,h.editorDecoration.options);this.loggedMessageDecorations.set(c,{id:g,line:p,resultItem:l})};for(let l of e.tests)if(!FO.invalidatedTests.has(l))for(let c=0;c<l.tasks.length;c++){let u=l.tasks[c];for(let p=u.messages.length-1;p>=0;p--){let h=u.messages[p];h.type===1&&s(l,h,rL({type:3,messageIndex:p,taskIndex:c,resultId:e.id,testExtId:l.item.extId}))}}for(let l of e.tasks)for(let c of l.otherMessages)s(void 0,c)}};FO=I([m(1,Qt),m(2,Xs),m(3,mdt),m(4,gt),m(5,Rd),m(6,B),m(7,F)],FO);var uNo=a=>({startLineNumber:a.startLineNumber,endLineNumber:a.startLineNumber,startColumn:a.startColumn,endColumn:a.startColumn}),pNo=(a,i,e,t)=>{let o=a[0]?.item.range;if(!o)throw new Error("Test decorations can only be created for tests with a range");if(!e)return{range:uNo(o),options:{isWholeLine:!0,description:"run-test-decoration"}};let n=0,r=[],s,l=!1;for(let b=0;b<a.length;b++){let S=a[b],y=i[b],w=y?.computedState??0;r.length<10&&r.push(z0t(S.item.label,w)),n=WLe(n,w),l=l||!!y?.retired,!s&&y?.tasks.some(x=>x.messages.length)&&(s=S.item.extId)}let c=a.length>1||a[0].children.size>0,u=n===0?c?q9:W1:OO.get(n),p=t==="debug"?c?q9:W1:c?uSe:yk,h,g="testing-run-glyph";l&&(g+=" retired");let f={description:"run-test-decoration",showIfCollapsed:!0,get hoverMessage(){if(!h){let b=h=new he("",!0).appendText(r.join(", ")+".");if(s){let S=encodeURIComponent(JSON.stringify([s]));b.appendMarkdown(` [${d(17127,null)}](command:vscode.peekTestError?${S})`)}}return h},glyphMargin:{position:mNo},glyphMarginClassName:`${q.asClassName(u)} ${g}`,stickiness:1,zIndex:1e4,overviewRuler:Xx(n)?{color:_s(ode),position:2}:void 0},v={...f,glyphMarginClassName:`${q.asClassName(p)} ${g}`};return{range:uNo(o),options:f,alternate:v}};var l6t=class{constructor(i){this.editor=i;this.allowEditorOverflow=!1;this.suppressMouseDown=!0;this._domNode=_("span");queueMicrotask(()=>{this.applyStyling(),this.editor.addContentWidget(this)})}applyStyling(){let i=this.editor.getOption(25),e;!i||i<5?(i=this.editor.getOption(61)*.9|0,e=this.editor.getOption(75)):e=i*Math.max(1.3,this.editor.getOption(75)/this.editor.getOption(61))|0;let t=this.editor.getOption(59),o=this._domNode;o.classList.add("testing-diff-lens-widget"),o.textContent=this.getText(),o.style.lineHeight=`${e}px`,o.style.fontSize=`${i}px`,o.style.fontFamily="var(--testingDiffLensFontFamily)",o.style.fontFeatureSettings="var(--testingDiffLensFontFeatures)";let n=this.editor.getContainerDomNode().style;n.setProperty("testingDiffLensFontFamily",this.editor.getOption(24)??"inherit"),n.setProperty("testingDiffLensFontFeatures",t.fontFeatureSettings),this.editor.changeViewZones(r=>{this.viewZoneId&&r.removeZone(this.viewZoneId),this.viewZoneId=r.addZone({afterLineNumber:0,afterColumn:1073741824,domNode:document.createElement("div"),heightInPx:20})})}getDomNode(){return this._domNode}dispose(){this.editor.changeViewZones(i=>{this.viewZoneId&&i.removeZone(this.viewZoneId)}),this.editor.removeContentWidget(this)}getPosition(){return{position:{column:0,lineNumber:0},preference:[1]}}},WUi=class extends l6t{getId(){return"expectedTestingLens"}getText(){return d(17125,null)}},VUi=class extends l6t{getId(){return"actualTestingLens"}getText(){return d(17121,null)}},lse=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.tests=i;this.visible=e;this.model=t;this.codeEditorService=o;this.testService=n;this.contextMenuService=r;this.commandService=s;this.configurationService=l;this.testProfileService=c;this.contextKeyService=u;this.menuService=p;this.id="";this.displayedStates=i.map(h=>h.resultItem?.computedState),this.editorDecoration=pNo(i.map(h=>h.test),i.map(h=>h.resultItem),e,wm(this.configurationService,"testing.defaultGutterClickAction")),this.editorDecoration.options.glyphMarginHoverMessage=new he().appendText(this.getGutterLabel())}get line(){return this.editorDecoration.range.startLineNumber}get testIds(){return this.tests.map(i=>i.test.item.extId)}click(i){if(i.target.type!==2||i.target.detail.glyphMarginLane!==mNo||i.event.rightButton||et&&i.event.leftButton&&i.event.ctrlKey)return!1;let e=i.event.altKey;switch(wm(this.configurationService,"testing.defaultGutterClickAction")){case"contextMenu":this.showContextMenu(i);break;case"debug":this.runWith(e?2:4);break;case"runWithCoverage":this.runWith(e?4:8);break;case"run":default:this.runWith(e?4:2);break}return!0}replaceOptions(i,e){let t=i.map(r=>r.resultItem?.computedState);if(e===this.visible&&eo(this.displayedStates,t))return!1;this.tests=i,this.displayedStates=t,this.visible=e;let{options:o,alternate:n}=pNo(i.map(r=>r.test),i.map(r=>r.resultItem),e,wm(this.configurationService,"testing.defaultGutterClickAction"));return this.editorDecoration.options=o,this.editorDecoration.alternate=n,this.editorDecoration.options.glyphMarginHoverMessage=new he().appendText(this.getGutterLabel()),!0}isForTest(i){return this.tests.some(e=>e.test.item.extId===i)}runWith(i){return this.testService.runTests({tests:Lmo(this.testService.collection,this.tests.map(({test:e})=>e)),group:i})}showContextMenu(i){this.codeEditorService.listCodeEditors().find(t=>t.getModel()===this.model)?.getContribution(Fne.ID)?.show(i)}getGutterLabel(){switch(wm(this.configurationService,"testing.defaultGutterClickAction")){case"contextMenu":return d(17134,null);case"debug":return d(17136,null);case"runWithCoverage":return d(17135,null);case"run":default:return d(17137,null)}}getTestContextMenuActions(i,e){let t=[],o=this.testProfileService.capabilitiesForTest(i.item);[{bitset:2,label:d(17131,null)},{bitset:4,label:d(17124,null)},{bitset:8,label:d(17122,null)}].forEach(({bitset:r,label:s})=>{o&r&&t.push(new it(`testing.gutter.${r}`,s,void 0,void 0,()=>this.testService.runTests({group:r,tests:[i]})))}),o&16&&t.push(new it("testing.runUsing",d(17138,null),void 0,void 0,async()=>{let r=await this.commandService.executeCommand("vscode.pickTestProfile",{onlyForTest:i});r&&this.testService.runResolvedTests({group:r.group,targets:[{profileId:r.profileId,controllerId:r.controllerId,testIds:[i.item.extId]}]})})),e&&Xx(e.computedState)&&t.push(new it("testing.gutter.peekFailure",d(17126,null),void 0,void 0,()=>this.commandService.executeCommand("vscode.peekTestError",i.item.extId))),e?.computedState===2&&t.push(new it("testing.gutter.cancel",d(17133,null),void 0,void 0,()=>this.commandService.executeCommand("testing.cancelRun"))),t.push(new it("testing.gutter.reveal",d(17128,null),void 0,void 0,()=>this.commandService.executeCommand("_revealTestInExplorer",i.item.extId)));let n=this.getContributedTestActions(i,o);return{object:oi.join(t,n),dispose(){t.forEach(r=>r.dispose())}}}getContributedTestActions(i,e){let t=this.contextKeyService.createOverlay(Z1e(i,e)),o=_mo(this.testService.collection,i.item.extId),n=this.menuService.getMenuActions(R.TestItemGutter,t,{shouldForwardArgs:!0,arg:o});return Lu(n)}};lse=I([m(3,Qt),m(4,Xs),m(5,Xe),m(6,fe),m(7,B),m(8,Vu),m(9,X),m(10,Yt)],lse);var Ydt=class extends lse{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,t,o,n,r,s,l,c,u,p,h);this.quickInputService=g}getContextMenuActions(){let e=new O,t=[];[{bitset:2,label:d(17129,null)},{bitset:8,label:d(17130,null)},{bitset:4,label:d(17123,null)}].forEach(({bitset:u,label:p},h)=>{this.tests.some(({test:f})=>this.testProfileService.capabilitiesForTest(f.item)&u)&&t.push(new it(`testing.gutter.run${h}`,p,void 0,void 0,()=>this.runWith(u)))}),e.add(ee(()=>t.forEach(u=>u.dispose())));let o=this.tests.map(u=>({currentLabel:u.test.item.label,testItem:u,parent:ns.fromString(u.test.item.extId).parentId})),n=u=>{let p=new Map;for(let h of u)p.set(h.currentLabel,(p.get(h.currentLabel)||0)+1);return u.filter(h=>p.get(h.currentLabel)>1)},r,s=!0;for(;(r=n(o)).length&&s;)for(let u of r)if(u.parent){let p=this.testService.collection.getNodeById(u.parent.toString());u.currentLabel=p?.item.label+" > "+u.currentLabel,u.parent=u.parent.parentId}else s=!1;o.sort((u,p)=>{let h=u.testItem.test.item,g=p.testItem.test.item;return(h.sortText||h.label).localeCompare(g.sortText||g.label)});let l=o.map(({currentLabel:u,testItem:p})=>{let h=this.getTestContextMenuActions(p.test,p.resultItem);e.add(h);let g=Du(u),f=g.indexOf(`
`);return f!==-1&&(g=g.slice(0,f)),new sa(p.test.item.extId,g,h.object)}),c=l.length-dNo;return c>0&&(l=l.slice(0,dNo),l.push(new it("testing.gutter.overflow",d(17139,null,c),void 0,void 0,()=>this.pickAndRun(o)))),{object:oi.join(t,l),dispose:()=>e.dispose()}}async pickAndRun(e){let t=(r,s)=>new Promise(l=>{let c=new O,u=c.add(this.quickInputService.createQuickPick());u.placeholder=s,u.items=r,c.add(u.onDidHide(()=>{l(void 0),c.dispose()})),c.add(u.onDidAccept(()=>{l(u.selectedItems[0]),c.dispose()})),u.show()}),o=await t(e.map(({currentLabel:r,testItem:s})=>({label:r,test:s.test,result:s.resultItem})),d(17132,null));if(!o)return;let n=this.getTestContextMenuActions(o.test,o.result);try{(await t(n.object,o.label))?.run()}finally{n.dispose()}}};Ydt=I([m(3,Qt),m(4,Xs),m(5,Xe),m(6,fe),m(7,B),m(8,Vu),m(9,X),m(10,Yt),m(11,$e)],Ydt);var Xdt=class extends lse{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super([{test:i,resultItem:e}],o,t,n,r,l,s,c,u,p,h)}getContextMenuActions(){return this.getTestContextMenuActions(this.tests[0].test,this.tests[0].resultItem)}};Xdt=I([m(4,Qt),m(5,Xs),m(6,fe),m(7,Xe),m(8,B),m(9,Vu),m(10,X),m(11,Yt)],Xdt);var PCn=/\r?\n\s*/g,Y9=class{constructor(i,e,t,o,n){this.testMessage=i;this.messageUri=e;this.peekOpener=o;this.id="";this.contentIdClass=`test-message-inline-content-id${ht()}`;let r=i.location;this.line=jn(r.range.startLineNumber,0,t.getLineCount());let s=i.type,l=i.message,c=n.resolveDecorationOptions(Y9.decorationId,!0),u=Zre(l);c.hoverMessage=new he().appendText(u),c.zIndex=10,c.className=`testing-inline-message-severity-${s}`,c.isWholeLine=!0,c.stickiness=1,c.collapseOnReplaceEdit=!0;let p=Zre(l).replace(PCn," ");p.length>cNo&&(p=p.slice(0,cNo-1)+"\u2026"),c.after={content:p,inlineClassName:`test-message-inline-content test-message-inline-content-s${s} ${this.contentIdClass} ${e?"test-message-inline-content-clickable":""}`},c.showIfCollapsed=!0;let h=s===0?ode:SX;h&&(c.overviewRuler={color:_s(h),position:4});let g=t.getLineLength(this.line),f=g?g+1:r.range.endColumn;this.editorDecoration={options:c,range:{startLineNumber:this.line,startColumn:f,endColumn:f,endLineNumber:this.line}}}static{this.inlineClassName="test-message-inline-content"}static{this.decorationId=`testmessage-${ht()}`}click(i){return i.event.rightButton||!this.messageUri||i.target.element?.className.includes(this.contentIdClass)&&this.peekOpener.peekUri(this.messageUri),!1}getContextMenuActions(){return{object:[],dispose:()=>{}}}};Y9=I([m(3,sL),m(4,Qt)],Y9);var ACn=20,Jdt=class extends k{constructor(e,t,o,n,r,s){super();this.editor=e;this.position=t;this.message=o;this.resultItem=n;this.peekOpener=s;this.id=ht();this.allowEditorOverflow=!1;this.node=st("div.test-error-content-widget",[st("div.inner@inner",[st("div.arrow@arrow"),st(`span${q.asCSSSelector(OO.get(4))}`),st("span.content@name")])]);let l=()=>{let g=e.getLineHeightForPosition(t);this.node.root.style.marginTop=(g-ACn)/2+"px"};l(),this._register(e.onDidChangeLineHeight(g=>{g.affects(t)&&l()})),this._register(e.onDidChangeConfiguration(g=>{g.hasChanged(75)&&l()}));let c;if(o.expected!==void 0&&o.actual!==void 0)c=`${Cii(o.actual.replace(/\s+/g," "),30)} != ${Cii(o.expected.replace(/\s+/g," "),30)}`;else{let g=ma(o.message),f=g.indexOf(`
`);c=f===-1?g:g.slice(0,f)}this._register($(this.node.root,ne.CLICK,g=>{this.peekOpener.peekUri(r),g.preventDefault()}));let u=IS.get(e);u&&this._register(ve(g=>{let f=u.subject.read(g),v=f instanceof vh&&f.message===o;this.node.root.classList.toggle("is-current",v)})),this.node.name.innerText=c||"Test Failed";let p=document.createElementNS("http://www.w3.org/2000/svg","svg");p.setAttribute("width","15"),p.setAttribute("height","10"),p.setAttribute("preserveAspectRatio","none"),p.setAttribute("viewBox","0 0 15 10");let h=document.createElementNS("http://www.w3.org/2000/svg","path");h.setAttribute("d","M15 0 L10 0 L0 5 L10 10 L15 10 Z"),p.append(h),this.node.arrow.appendChild(p),this._register(e.onDidChangeModelContent(g=>{for(let f of g.changes){if(f.range.startLineNumber>this.line)continue;(f.range.startLineNumber<=this.line&&f.range.endLineNumber>=this.line||n.item.range&&n.item.range.startLineNumber<=f.range.startLineNumber&&n.item.range.endLineNumber>=f.range.endLineNumber)&&(FO.invalidatedTests.add(this.resultItem),this.dispose());let v=rT(f.text,`
`)-(f.range.endLineNumber-f.range.startLineNumber);v!==0&&(this.position=this.position.delta(v),this.editor.layoutContentWidget(this))}})),e.addContentWidget(this),this._register(ee(()=>e.removeContentWidget(this)))}get line(){return this.position.lineNumber}getId(){return this.id}getDomNode(){return this.node.root}getPosition(){return{position:this.position,preference:[0]}}afterRender(e,t){if(t){let{verticalScrollbarWidth:o}=this.editor.getLayoutInfo(),n=this.editor.getScrollWidth();this.node.inner.style.maxWidth=`${n-o-t.left-20}px`}}};Jdt=I([m(5,sL)],Jdt);var c6t=class extends mg{constructor(e,t,o){super({...e,item:{...e.item}},t);this.chain=o;this.descriptionParts=[];this.updateErrorVisibility()}get description(){return this.chain.map(e=>e.item.label).join(" \u203A ")}update(e){bRe(this.test,e),this.updateErrorVisibility(e),this.fireChange()}fireChange(){this.changeEmitter.fire()}updateErrorVisibility(e){this.errorChild&&(!this.test.item.error||e?.item?.error)&&(this.children.delete(this.errorChild),this.errorChild=void 0),this.test.item.error&&!this.errorChild&&(this.errorChild=new wk(this.test.item.error,this),this.children.add(this.errorChild))}},Sze=class extends k{constructor(e,t,o){super();this.lastState=e;this.testService=t;this.results=o;this.updateEmitter=this._register(new T);this.items=new Map;this.onUpdate=this.updateEmitter.event;this._register(t.onDidProcessDiff(n=>this.applyDiff(n))),this._register(o.onResultsChanged(n=>{if("removed"in n)for(let r of this.items.values()){let s=this.results.getStateById(r.test.item.extId)?.[1];r.duration=s?.ownDuration,r.state=s?.ownComputedState||0,r.fireChange()}})),this._register(o.onTestChanged(n=>{if(n.reason===2)return;let r=n.item;if(r.ownComputedState===0||n.result!==o.results[0]){let l=o.getStateById(r.item.extId);l&&(r=l[1])}let s=this.items.get(r.item.extId);s&&(s.retired=!!r.retired,s.state=r.computedState,s.duration=r.ownDuration,s.fireChange())}));for(let n of t.collection.all)this.storeItem(n)}get rootsWithChildren(){let e=yt.map(this.testService.collection.rootItems,t=>this.items.get(t.item.extId));return yt.filter(e,t=>!!t?.children.size)}getElementByTestId(e){return this.items.get(e)}applyDiff(e){for(let t of e)switch(t.op){case 0:{this.storeItem(t.item);break}case 1:{this.items.get(t.item.extId)?.update(t.item);break}case 3:{for(let[o,n]of this.items)(o===t.itemId||ns.isChild(t.itemId,o))&&this.unstoreItem(n);break}}e.length!==0&&this.updateEmitter.fire()}applyTo(e){e.setChildren(null,J1e(this.lastState,this.rootsWithChildren,null),{diffIdentityProvider:LQt,diffDepth:1/0})}expandElement(e,t){e instanceof c6t&&e.test.expand!==0&&this.testService.collection.expand(e.test.item.extId,t)}unstoreItem(e){this.items.delete(e.test.item.extId),e.parent?.children.delete(e);let t=ns.fromString(e.test.item.extId).parentId;if(t)for(let o of t.idsToRoot()){let n=this.testService.collection.getNodeById(o.toString());if(n){n.children.size===0&&!this.items.has(o.toString())&&this._storeItem(t,n);break}}}_storeItem(e,t){let o=e.isRoot?null:this.items.get(t.controllerId),n=[...e.idsFromRoot()].slice(1,-1).map(l=>this.testService.collection.getNodeById(l.toString())),r=new c6t(t,o,n);o?.children.add(r),this.items.set(r.test.item.extId,r),(r.depth===0||X1e(this.lastState,r.test.item.extId)===!1)&&this.expandElement(r,1/0);let s=this.results.getStateById(r.test.item.extId)?.[1];s&&(r.retired=!!s.retired,r.state=s.computedState,r.duration=s.ownDuration)}storeItem(e){let t=ns.fromString(e.item.extId);for(let o of t.idsToRoot())if(!o.isRoot){let n=this.items.get(o.toString());if(n){this.unstoreItem(n);break}}this._storeItem(t,e)}};Sze=I([m(1,Xs),m(2,Rd)],Sze);var d6t=class extends hf{getOptimizedViewState(i){let e=i||{},t=(o,n)=>{if(!(o.element instanceof mg))return!1;let r=ns.localId(o.element.test.item.extId),s=n.children?.[r]||{};s.collapsed=o.depth===0||!o.collapsed?o.collapsed:void 0;let l=s.collapsed!==void 0;if(o.children.length)for(let c of o.children)l=t(c,s)||l;return l?(n.children??={},n.children[r]=s):n.children?.hasOwnProperty(r)&&delete n.children[r],l};e.children??={};for(let o of this.getNode().children)if(o.element instanceof mg)if(o.element.test.controllerId===o.element.test.item.extId)t(o,e);else{let n=e.children[o.element.test.controllerId]??={children:{}};t(o,n)}return e}};var u6t={getOwnState:a=>a instanceof mg?a.ownState:0,getCurrentComputedState:a=>a.state,setComputedState:(a,i)=>a.state=i,getCurrentComputedDuration:a=>a.duration,getOwnDuration:a=>a instanceof mg?a.ownDuration:void 0,setComputedDuration:(a,i)=>a.duration=i,getChildren:a=>yt.filter(a.children.values(),i=>i instanceof fSe),*getParents(a){for(let i=a.parent;i;i=i.parent)yield i}},fSe=class extends mg{constructor(e,t,o){super({...e,item:{...e.item}},t);this.addedOrRemoved=o;this.ownState=0;this.updateErrorVisibility()}get description(){return this.test.item.description}update(e){bRe(this.test,e),this.updateErrorVisibility(e),this.fireChange()}fireChange(){this.changeEmitter.fire()}updateErrorVisibility(e){this.errorChild&&(!this.test.item.error||e?.item?.error)&&(this.addedOrRemoved(this),this.children.delete(this.errorChild),this.errorChild=void 0),this.test.item.error&&!this.errorChild&&(this.errorChild=new wk(this.test.item.error,this),this.children.add(this.errorChild),this.addedOrRemoved(this))}},Ize=class extends k{constructor(e,t,o){super();this.lastState=e;this.testService=t;this.results=o;this.updateEmitter=this._register(new T);this.changedParents=new Set;this.resortedParents=new Set;this.items=new Map;this.onUpdate=this.updateEmitter.event;this._register(t.onDidProcessDiff(n=>this.applyDiff(n))),this._register(o.onResultsChanged(n=>{if("removed"in n)for(let r of[...this.items.values()].sort((s,l)=>l.depth-s.depth)){let s=this.results.getStateById(r.test.item.extId)?.[1];r.ownDuration=s?.ownDuration,Jme(u6t,r,s?.ownComputedState??0).forEach(l=>l.fireChange())}})),this._register(o.onTestChanged(n=>{if(n.reason===2)return;let r=n.item;if(r.ownComputedState===0||n.result!==o.results[0]){let u=o.getStateById(r.item.extId);u&&(r=u[1])}let s=this.items.get(r.item.extId);if(!s)return;let l=n.reason===1&&n.previousOwnDuration!==r.ownDuration,c=s.children.size?void 0:r.computedState;s.retired=!!r.retired,s.ownState=r.ownComputedState,s.ownDuration=r.ownDuration,s.fireChange(),Jme(u6t,s,c,l).forEach(u=>u.fireChange())}));for(let n of t.collection.all)this.storeItem(this.createItem(n))}get rootsWithChildren(){let e=yt.map(this.testService.collection.rootItems,t=>this.items.get(t.item.extId));return yt.filter(e,t=>!!t?.children.size)}getElementByTestId(e){return this.items.get(e)}applyDiff(e){for(let t of e)switch(t.op){case 0:{let o=this.createItem(t.item);this.storeItem(o);break}case 1:{let o=t.item,n=this.items.get(o.extId);if(!n)break;let r=n.test.expand===0&&o.expand;n.update(o),r?this.changedParents.add(n.parent):this.resortedParents.add(n.parent);break}case 3:{let o=this.items.get(t.itemId);if(!o)break;let n=o.parent,r=o.depth===1&&(n?.children.size===1||!yt.some(this.rootsWithChildren,(l,c)=>c===1));this.changedParents.add(r?null:n);let s=[[o]];for(;s.length;)for(let l of s.pop())l instanceof fSe&&s.push(this.unstoreItem(l));n instanceof fSe&&Jme(u6t,n,void 0,!!n.duration).forEach(l=>l.fireChange())}}e.length!==0&&this.updateEmitter.fire()}applyTo(e){for(let t of this.changedParents)(!t||e.hasElement(t))&&e.setChildren(t,J1e(this.lastState,this.rootsWithChildren,t),{diffIdentityProvider:LQt});for(let t of this.resortedParents)(!t||e.hasElement(t))&&e.resort(t,!1);this.changedParents.clear(),this.resortedParents.clear()}expandElement(e,t){e instanceof fSe&&e.test.expand!==0&&this.testService.collection.expand(e.test.item.extId,t)}createItem(e){let t=ns.parentId(e.item.extId),o=t?this.items.get(t):null;return new fSe(e,o,n=>this.changedParents.add(n))}unstoreItem(e){return e.parent?.children.delete(e),this.items.delete(e.test.item.extId),e.children}storeItem(e){e.parent?.children.add(e),this.items.set(e.test.item.extId,e);let o=e.parent?.children.size===1?e.parent.parent:e.parent;this.changedParents.add(o),o?.depth===0&&this.changedParents.add(null),(e.depth===0||X1e(this.lastState,e.test.item.extId)===!1)&&this.expandElement(e,0);let n=this.results.getStateById(e.test.item.extId)?.[1];n&&(e.retired=!!n.retired,e.ownState=n.computedState,e.ownDuration=n.ownDuration,Jme(u6t,e,void 0,!!e.ownDuration).forEach(r=>r.fireChange()))}};Ize=I([m(1,Xs),m(2,Rd)],Ize);var hNo={"@failed":d(17149,null),"@executed":d(17148,null),"@doc":d(17142,null),"@openedFiles":d(17145,null),"@hidden":d(17147,null)},yze=class extends Ja{constructor(e,t,o,n,r){super(null,e,t);this.state=o;this.instantiationService=n;this.testService=r;this.focusEmitter=this._register(new T);this.onDidFocus=this.focusEmitter.event;this.filtersAction=new it("markersFiltersAction",d(17144,null),"testing-filter-button "+q.asClassName(hdt));this.history=this._register(n.createInstance(tI,{key:"testing.filterHistory2",scope:1,target:1})),this.updateFilterActiveState(),this._register(r.excluded.onTestExclusionsChanged(this.updateFilterActiveState,this))}render(e){e.classList.add("testing-filter-action-item");let t=this._register(new rn(400)),o=this.wrapper=_(".testing-filter-wrapper");e.appendChild(o);let n=this.history.get({lastValue:"",values:[]});n instanceof Array&&(n={lastValue:"",values:n}),n.lastValue&&this.state.setText(n.lastValue);let r=this.input=this._register(this.instantiationService.createInstance(sNe,{id:"testing.explorer.filter",ariaLabel:d(17141,null),parent:o,suggestionProvider:{triggerCharacters:["@"],provideResults:()=>[...Object.entries(hNo).map(([l,c])=>({label:l,detail:c})),...yt.map(this.testService.collection.tags.values(),l=>{let{ctrlId:c,tagId:u}=tOt(l.id),p=`@${c}:${u}`;return{label:`@${c}:${u}`,detail:this.testService.collection.getNodeById(c)?.item.label,insertText:u.includes(" ")?`@${c}:"${u.replace(/(["\\])/g,"\\$1")}"`:p}})].filter(l=>!this.state.text.value.includes(l.label))},resourceHandle:"testing:filter",suggestOptions:{value:this.state.text.value,placeholderText:d(17140,null)},history:n.values}));this._register(this.state.text.onDidChange(l=>{r.getValue()!==l&&r.setValue(l)})),this._register(this.state.onDidRequestInputFocus(()=>{r.focus()})),this._register(r.onDidFocus(()=>{this.focusEmitter.fire()})),this._register(r.onInputDidChange(()=>t.trigger(()=>{r.addToHistory(),this.state.setText(r.getValue())}))),this._register(new oo(e,{actionViewItemProvider:(l,c)=>{if(l.id===this.filtersAction.id)return this.instantiationService.createInstance(eut,l,c,this.state,this.actionRunner)}})).push(this.filtersAction,{icon:!0,label:!1}),this.layout(this.wrapper.clientWidth)}layout(e){this.input.layout(new di(e-24-8-22,20))}focus(){this.input.focus()}saveState(){this.history.store({lastValue:this.input.getValue(),values:this.input.getHistory()})}dispose(){this.saveState(),super.dispose()}updateFilterActiveState(){this.filtersAction.checked=this.testService.excluded.hasAny}};yze=I([m(2,HV),m(3,F),m(4,Xs)],yze);var eut=class extends rh{constructor(e,t,o,n,r,s){super(e,{getActions:()=>this.getActions()},r,{actionRunner:n,classNames:e.class,anchorAlignmentProvider:()=>1,menuAsChild:!0});this.filters=o;this.testService=s}render(e){super.render(e),this.updateChecked()}getActions(){return[...["@failed","@executed","@doc","@openedFiles"].map(e=>({checked:this.filters.isFilteringFor(e),class:void 0,enabled:!0,id:e,label:hNo[e],run:()=>this.filters.toggleFilteringFor(e),tooltip:"",dispose:()=>null})),new oi,{checked:this.filters.fuzzy.value,class:void 0,enabled:!0,id:"fuzzy",label:d(17143,null),run:()=>this.filters.fuzzy.value=!this.filters.fuzzy.value,tooltip:""},new oi,{checked:this.filters.isFilteringFor("@hidden"),class:void 0,enabled:this.testService.excluded.hasAny,id:"showExcluded",label:d(17147,null),run:()=>this.filters.toggleFilteringFor("@hidden"),tooltip:""},{class:void 0,enabled:this.testService.excluded.hasAny,id:"removeExcluded",label:d(17146,null),run:async()=>this.testService.excluded.clear(),tooltip:""}]}updateChecked(){this.element.classList.toggle("checked",this._action.checked)}};eut=I([m(4,Xe),m(5,Xs)],eut);var wze=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,o,t,n,l,s,r,c,u,h);this.testService=p;this.testProfileService=g;this.commandService=f;this.menuService=v;this.crService=b;this.filterActionBar=this._register(new ue);this.discoveryProgress=this._register(new ue);this.filter=this._register(new ue);this.filterFocusListener=this._register(new ue);this.dimensions={width:0,height:0};this.lastFocusState=0;let S=this._register(new Dt(()=>this.layoutBody(),1));this._register(this.onDidChangeViewWelcomeState(()=>{this.shouldShowWelcome()||S.schedule()})),this._register(U.any(b.onDidChange,g.onDidChange)(()=>{this.updateActions()})),this._register(p.collection.onBusyProvidersChange(y=>{this.updateDiscoveryProgress(y)})),this._register(g.onDidChange(()=>this.updateActions()))}get focusedTreeElements(){return this.viewModel.tree.getFocus().filter(so)}shouldShowWelcome(){return this.viewModel?.welcomeExperience===1}focus(){super.focus(),this.lastFocusState===1?this.viewModel.tree.domFocus():this.filter.value?.focus()}getTreeIncludeExclude(e,t,o="visible"){let n=this.viewModel.projection.value;if(!n)return{include:[],exclude:[]};let r=new Set,s=[],l=new Map,c=p=>{let h=l.get(p);return h===void 0&&(h=typeof e=="number"?!!this.testProfileService.getDefaultProfileForTest(e,p):JM(e,p),l.set(p,h)),h},u=(p,h)=>{if(!(p instanceof mg)||!this.viewModel.tree.hasElement(p))return;let g=this.viewModel.tree.getNode(p);if(!g.visible){h&&s.push(p.test);return}let f=g.children.filter(v=>v.visible&&v.element instanceof mg&&c(v.element.test)).length;!h&&c(p.test)&&(f===0||f*2>=g.children.length)&&f!==1&&(r.add(p.test),h=!0);for(let v of p.children)u(v,h)};if(o==="selected"){let p=this.viewModel.tree.getSelection().filter(so);if(p.length){e:for(let h of p)if(h instanceof mg){for(let g=h;g;g=g.parent)if(r.has(g.test))continue e;r.add(h.test),h.children.forEach(g=>u(g,!0))}return{include:[...r],exclude:s}}}for(let p of t||this.testService.collection.rootItems){let h=n.getElementByTestId(p.item.extId);h&&(typeof e=="object"&&!JM(e,p)||(r.add(h.test),h.children.forEach(g=>u(g,!0))))}return{include:[...r],exclude:s}}render(){super.render(),this._register(p_({name:"testingExplorerView",focusNotifiers:[this],focusNextWidget:()=>{this.viewModel.tree.isDOMFocused()||this.viewModel.tree.domFocus()},focusPreviousWidget:()=>{this.viewModel.tree.isDOMFocused()&&this.filter.value?.focus()}}))}renderBody(e){super.renderBody(e),this.container=D(e,_(".test-explorer")),this.treeHeader=D(this.container,_(".test-explorer-header")),this.filterActionBar.value=this.createFilterActionBar();let t=D(this.treeHeader,_(".result-summary-container"));this._register(this.instantiationService.createInstance(tut,t));let o=D(this.container,_(".test-explorer-tree"));this.viewModel=this.instantiationService.createInstance(iut,o,this.onDidChangeBodyVisibility),this._register(this.viewModel.tree.onDidFocus(()=>this.lastFocusState=1)),this._register(this.viewModel.onChangeWelcomeVisibility(()=>this._onDidChangeViewWelcomeState.fire())),this._register(this.viewModel),this._onDidChangeViewWelcomeState.fire()}createActionViewItem(e,t){switch(e.id){case"workbench.actions.treeView.testExplorer.filter":return this.filter.value=this.instantiationService.createInstance(yze,e,t),this.filterFocusListener.value=this.filter.value.onDidFocus(()=>this.lastFocusState=0),this.filter.value;case"testing.runSelected":return this.getRunGroupDropdown(2,e,t);case"testing.debugSelected":return this.getRunGroupDropdown(4,e,t);case"testing.coverageSelected":return this.getRunGroupDropdown(8,e,t);case"testing.startContinuousRun":case"testing.stopContinuousRun":return this.getContinuousRunDropdown(e,t);default:return super.createActionViewItem(e,t)}}getTestConfigGroupActions(e){let t=[],o=0,n=0,r=!1,s=this.testProfileService.getGroupDefaultProfiles(e);for(let{profiles:g,controller:f}of this.testProfileService.all()){let v=!1;for(let b of g)b.group===e&&(v||(v=!0,o++,t.push(li({id:`${f.id}.$root`,label:f.label.get(),enabled:!1,checked:!1,run:()=>{}}))),r=r||b.hasConfigurationHandler,n++,t.push(li({id:`${f.id}.${b.profileId}`,label:s.includes(b)?d(17151,null,b.label):b.label,run:()=>{let{include:S,exclude:y}=this.getTreeIncludeExclude(b);this.testService.runResolvedTests({exclude:y.map(w=>w.item.extId),group:b.group,targets:[{profileId:b.profileId,controllerId:b.controllerId,testIds:S.map(w=>w.item.extId)}]})}})))}let l=[];e===2&&l.push(["testing.profile.context.group","run"]),e===4&&l.push(["testing.profile.context.group","debug"]),e===8&&l.push(["testing.profile.context.group","coverage"]);let c=this.contextKeyService.createOverlay(l),u=this.menuService.getMenuActions(R.TestProfilesContext,c),p=Lu(u),h=[];return n>1&&h.push(li({id:"selectDefaultTestConfigurations",label:d(17153,null),run:()=>this.commandService.executeCommand("testing.selectDefaultTestProfiles",e)})),r&&h.push(li({id:"configureTestProfiles",label:d(17150,null),run:()=>this.commandService.executeCommand("testing.configureProfile",e)})),{numberOfProfiles:n,actions:p.length>0?oi.join(t,p,h):oi.join(t,h)}}saveState(){this.filter.value?.saveState(),super.saveState()}getRunGroupDropdown(e,t,o){let n=this.getTestConfigGroupActions(e);if(n.numberOfProfiles<2)return super.createActionViewItem(t,o);let r=this.instantiationService.createInstance(Do,{id:t.id,title:t.label,icon:e===2?q9:e===4?uSe:yQt},void 0,void 0,void 0,void 0);return this.instantiationService.createInstance(BC,r,this.getDropdownAction(),n.actions,"",o)}getDropdownAction(){return new it("selectRunConfig",d(17164,null),"codicon-chevron-down",!0)}getContinuousRunDropdown(e,t){let o=[...yt.flatMap(this.testProfileService.all(),c=>this.testService.collection.getNodeById(c.controller.id)?.children.size?yt.filter(c.profiles,u=>u.supportsContinuousRun):yt.empty())];if(o.length<=1)return super.createActionViewItem(e,t);let n=this.instantiationService.createInstance(Do,{id:e.id,title:e.label,icon:e.id==="testing.startContinuousRun"?fdt:CQt},void 0,void 0,void 0,void 0),r=[],s=yy(o,c=>c.group),l=this.crService;for(let c of[2,4,8]){let u=s[c];if(u){Object.keys(s).length>1&&r.push({id:`${c}.label`,label:Eyi[c],enabled:!1,class:void 0,tooltip:Eyi[c],run:()=>{}});for(let p of u)r.push({id:`${c}.${p.profileId}`,label:p.label,enabled:!0,class:void 0,tooltip:p.label,checked:l.isEnabledForProfile(p),run:()=>l.isEnabledForProfile(p)?l.stopProfile(p):l.start([p])})}}return this.instantiationService.createInstance(BC,n,this.getDropdownAction(),r,"",t)}createFilterActionBar(){let e=new oo(this.treeHeader,{actionViewItemProvider:(t,o)=>this.createActionViewItem(t,o),triggerKeys:{keyDown:!1,keys:[]}});return e.push(new it("workbench.actions.treeView.testExplorer.filter")),e.getContainer().classList.add("testing-filter-action-bar"),e}updateDiscoveryProgress(e){!e&&this.discoveryProgress?this.discoveryProgress.clear():e&&!this.discoveryProgress.value&&(this.discoveryProgress.value=this.instantiationService.createInstance(dke,{location:this.getProgressLocation()}))}layoutBody(e=this.dimensions.height,t=this.dimensions.width){super.layoutBody(e,t),this.dimensions.height=e,this.dimensions.width=t,this.container.style.height=`${e}px`,this.viewModel?.layout(e-this.treeHeader.clientHeight,t),this.filter.value?.layout(t)}};wze=I([m(1,Xe),m(2,Le),m(3,B),m(4,F),m(5,ji),m(6,X),m(7,Je),m(8,Pe),m(9,Xs),m(10,ot),m(11,Vu),m(12,fe),m(13,Yt),m(14,XP)],wze);var FCn=200,tut=class extends k{constructor(e,t,o,n,r,s,l){super();this.container=e;this.resultService=t;this.activityService=o;this.crService=n;this.elementsWereAttached=!1;this.badgeDisposable=this._register(new ue);this.renderLoop=this._register(new Dt(()=>this.render(),FCn));this.elements=st("div.result-summary",[st("div@status"),st("div@count"),st("div@count"),st("span"),st("duration@duration"),st("a@rerun")]);this.badgeType=r.getValue("testing.countBadge"),this._register(t.onResultsChanged(this.render,this)),this._register(r.onDidChangeConfiguration(u=>{u.affectsConfiguration("testing.countBadge")&&(this.badgeType=r.getValue("testing.countBadge"),this.render())})),this.countHover=this._register(l.setupManagedHover(yi("mouse"),this.elements.count,"")),this._register(new oo(this.elements.rerun,{actionViewItemProvider:(u,p)=>ta(s,u,p)})).push(s.createInstance(Do,{...new Rdt().desc,icon:qre},{...new Ldt().desc,icon:yk},{},void 0,void 0),{icon:!0,label:!1}),this.render()}render(){let{results:e}=this.resultService,{count:t,root:o,status:n,duration:r,rerun:s}=this.elements;if(!e.length){this.elementsWereAttached&&(o.remove(),this.elementsWereAttached=!1),this.container.innerText=d(17152,null),this.badgeDisposable.clear();return}let l=e.filter(u=>!u.completedAt),c;if(l.length){n.className=q.asClassName(PT),c=G1e(!0,l),this.renderLoop.schedule();let u=l[l.length-1];r.textContent=rut(Date.now()-u.startedAt),s.style.display="none"}else{let u=e[0],p=iD(ret,h=>u.counts[h]>0?h:void 0);n.className=q.asClassName(OO.get(p??0)),c=G1e(!1,[u]),r.textContent=u instanceof lg?rut(u.completedAt-u.startedAt):"",s.style.display="block"}t.textContent=`${c.passed}/${c.totalWillBeRun}`,this.countHover.update(pdt(c)),this.renderActivityBadge(c,l.length>0),this.elementsWereAttached||(St(this.container),this.container.appendChild(o),this.elementsWereAttached=!0)}renderActivityBadge(e,t){if(t){if(this.badgeDisposable.value&&this.lastBadge instanceof EG&&this.lastBadge.icon===PT)return;this.lastBadge=new EG(PT,()=>d(17163,null))}else if(e&&this.badgeType!=="off"&&e[this.badgeType]!==0){if(this.badgeDisposable.value&&this.lastBadge instanceof eu&&this.lastBadge.number===e[this.badgeType])return;this.lastBadge=new eu(e[this.badgeType],o=>this.getLocalizedBadgeString(this.badgeType,o))}else if(this.crService.isEnabled()){if(this.badgeDisposable.value&&this.lastBadge instanceof EG&&this.lastBadge.icon===vdt)return;this.lastBadge=new EG(vdt,()=>d(17157,null))}else{if(!this.lastBadge)return;this.lastBadge=void 0}this.badgeDisposable.value=this.lastBadge&&this.activityService.showViewActivity("workbench.view.testing",{badge:this.lastBadge})}getLocalizedBadgeString(e,t){switch(e){case"passed":return d(17159,null,t);case"skipped":return d(17160,null,t);default:return d(17158,null,t)}}};tut=I([m(1,Rd),m(2,Al),m(3,XP),m(4,B),m(5,F),m(6,ot)],tut);var iut=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.menuService=s;this.contextMenuService=l;this.testService=c;this.filterState=u;this.instantiationService=p;this.storageService=h;this.contextKeyService=g;this.testResults=f;this.peekOpener=v;this.testProfileService=b;this.crService=S;this.projection=this._register(new ue);this.revealTimeout=this._register(new ue);this.welcomeVisibilityEmitter=this._register(new T);this.actionRunner=this._register(new HUi(()=>this.tree.getSelection().filter(so)));this.hasPendingReveal=!1;this.onChangeWelcomeVisibility=this.welcomeVisibilityEmitter.event;this.welcomeExperience=0;this.hasPendingReveal=!!u.reveal.get(),this.noTestForDocumentWidget=this._register(p.createInstance(nut,e)),this.lastViewState=this._register(new tI({key:"testing.treeState",scope:1,target:1},this.storageService)),this._viewMode=co.viewMode.bindTo(g),this._viewSorting=co.viewSorting.bindTo(g),this._viewMode.set(this.storageService.get("testing.viewMode",1,"true")),this._viewSorting.set(this.storageService.get("testing.viewSorting",1,"location")),this.reevaluateWelcomeState(),this.filter=this.instantiationService.createInstance(out,c.collection),this.tree=p.createInstance(d6t,"Test Explorer List",e,new KUi,[p.createInstance(dse,this.actionRunner),p.createInstance(cse)],{identityProvider:p.createInstance(GUi),hideTwistiesOfChildlessElements:!1,sorter:p.createInstance(BUi,this),keyboardNavigationLabelProvider:p.createInstance(zUi),accessibilityProvider:p.createInstance(UUi),filter:this.filter,findWidgetEnabled:!1});let w=this._register(new Dt(()=>{let H=this.tree.getOptimizedViewState(this.lastViewState.get({})),K=this.projection.value;K&&(K.lastState=H)},3e3));this._register(this.tree.onDidChangeCollapseState(H=>{H.node.element instanceof mg&&(H.node.collapsed||this.projection.value?.expandElement(H.node.element,H.deep?1/0:0),w.schedule())})),this._register(this.crService.onDidChange(H=>{if(H){let K=this.projection.value?.getElementByTestId(H);this.tree.resort(K?.parent&&this.tree.hasElement(K.parent)?K.parent:null,!1)}})),this._register(t(H=>{H&&this.ensureProjection()})),this._register(this.tree.onContextMenu(H=>this.onContextMenu(H))),this._register(U.any(u.text.onDidChange,u.fuzzy.onDidChange,c.excluded.onTestExclusionsChanged)(()=>{if(!u.text.value)return this.tree.refilter();let H=this.filter.lastIncludedTests=new Set;this.tree.refilter(),this.filter.lastIncludedTests=void 0;for(let K of H)this.tree.expandTo(K)})),this._register(this.tree.onDidOpen(H=>{H.element instanceof mg&&(u.didSelectTestInExplorer(H.element.test.item.extId),!H.element.children.size&&H.element.test.item.uri&&(this.tryPeekError(H.element)||y.executeCommand("vscode.revealTest",H.element.test.item.extId,{openToSide:H.sideBySide,preserveFocus:!0})))})),this._register(this.tree),this._register(this.onChangeWelcomeVisibility(H=>{this.noTestForDocumentWidget.setVisible(H===2)})),this._register(Yo(this.tree.getHTMLElement(),"keydown",H=>{H.equals(3)?this.handleExecuteKeypress(H):Mci.mightProducePrintableCharacter(H)&&(u.text.value=H.browserEvent.key,u.focusInput())})),this._register(ve(H=>{this.revealById(u.reveal.read(H),void 0,!1)})),this._register(t(H=>{H&&u.focusInput()}));let x=wm(o,"testing.followRunningTest");this._register(o.onDidChangeConfiguration(H=>{H.affectsConfiguration("testing.followRunningTest")&&(x=wm(o,"testing.followRunningTest"))}));let E=wm(o,"testing.alwaysRevealTestOnStateChange");this._register(o.onDidChangeConfiguration(H=>{H.affectsConfiguration("testing.alwaysRevealTestOnStateChange")&&(E=wm(o,"testing.alwaysRevealTestOnStateChange"))})),this._register(f.onTestChanged(H=>{x&&H.reason===1&&(this.tree.selectionSize>1||H.item.ownComputedState!==2&&!(H.previousState===1&&ymo(H.item.ownComputedState))||this.revealById(H.item.item.extId,E,!1))})),this._register(f.onResultsChanged(()=>{this.tree.resort(null)})),this._register(this.testProfileService.onDidChange(()=>{this.tree.rerender()}));let M=vi(this,n.onDidEditorsChange,()=>new Set(r.groups.flatMap(H=>H.editors).map(H=>H.resource).filter(so))),N=vi(this,n.onDidActiveEditorChange,()=>n.activeEditor instanceof Ba?n.activeEditor.primary.resource:n.activeEditor?.resource),V=vi(this.filterState.text.onDidChange,()=>this.filterState.text);this._register(ve(H=>{V.read(H),this.filterState.isFilteringFor("@openedFiles")?this.filter.filterToDocumentUri([...M.read(H)]):this.filter.filterToDocumentUri([N.read(H)].filter(so)),(this.filterState.isFilteringFor("@doc")||this.filterState.isFilteringFor("@openedFiles"))&&this.tree.refilter()})),this._register(this.storageService.onWillSaveState(({reason:H})=>{H===1&&this.lastViewState.store(this.tree.getOptimizedViewState())}))}get viewMode(){return this._viewMode.get()??"true"}set viewMode(e){e!==this._viewMode.get()&&(this._viewMode.set(e),this.updatePreferredProjection(),this.storageService.store("testing.viewMode",e,1,1))}get viewSorting(){return this._viewSorting.get()??"status"}set viewSorting(e){e!==this._viewSorting.get()&&(this._viewSorting.set(e),this.tree.resort(null),this.storageService.store("testing.viewSorting",e,1,1))}layout(e,t){this.tree.layout(e,t)}revealById(e,t=!0,o=!0){if(!e){this.hasPendingReveal=!1;return}let n=this.ensureProjection(),r=0,s=[...ns.fromString(e).idsFromRoot()];for(let l=s.length-1;l>=r;l--){let c=n.getElementByTestId(s[l].toString());if(!c||!this.tree.hasElement(c))continue;if(l<s.length-1&&t){this.tree.expand(c),r=l+1,l=s.length-1;continue}let u=c;for(let p=c;p instanceof mg;p=p.parent){if(p.test&&this.testService.excluded.contains(p.test)){this.filterState.toggleFilteringFor("@hidden",!0);break}!t&&this.tree.hasElement(p)&&this.tree.isCollapsed(p)&&(u=p)}this.filterState.reveal.set(void 0,void 0),this.hasPendingReveal=!1,o&&this.tree.domFocus(),this.tree.getRelativeTop(u)===null&&this.tree.reveal(u,.5),this.revealTimeout.value=Zo(()=>{this.tree.setFocus([u]),this.tree.setSelection([u])},1);return}this.hasPendingReveal=!0}async collapseAll(){this.tree.collapseAll()}tryPeekError(e){let t=e.test&&this.testResults.getStateById(e.test.item.extId);return t&&t[1].tasks.some(o=>Xx(o.state))?this.peekOpener.tryPeekFirstError(t[0],t[1],{preserveFocus:!0}):!1}onContextMenu(e){let t=e.element;if(!(t instanceof mg))return;let{actions:o}=fNo(this.contextKeyService,this.menuService,this.testService,this.crService,this.testProfileService,t);this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>o.secondary,getActionsContext:()=>t,actionRunner:this.actionRunner})}handleExecuteKeypress(e){let t=this.tree.getFocus(),o=this.tree.getSelection(),n;t.length===1&&o.includes(t[0])?(e.browserEvent?.preventDefault(),n=o):n=t;let r=n.filter(s=>s instanceof mg);r.length&&this.testService.runTests({group:2,tests:r.map(s=>s.test)})}reevaluateWelcomeState(){let t=this.testService.collection.busyProviders===0&&Tmo(this.testService.collection)?this.filterState.isFilteringFor("@doc")?2:1:0;t!==this.welcomeExperience&&(this.welcomeExperience=t,this.welcomeVisibilityEmitter.fire(t))}ensureProjection(){return this.projection.value??this.updatePreferredProjection()}updatePreferredProjection(){this.projection.clear();let e=this.lastViewState.get({});this._viewMode.get()==="list"?this.projection.value=this.instantiationService.createInstance(Sze,e):this.projection.value=this.instantiationService.createInstance(Ize,e);let t=this._register(new Dt(()=>this.applyProjectionChanges(),200));return this.projection.value.onUpdate(()=>{t.isScheduled()||t.schedule()}),this.applyProjectionChanges(),this.projection.value}applyProjectionChanges(){this.reevaluateWelcomeState(),this.projection.value?.applyTo(this.tree),this.tree.refilter(),this.hasPendingReveal&&this.revealById(this.filterState.reveal.get())}getSelectedTests(){return this.tree.getSelection()}};iut=I([m(2,B),m(3,ie),m(4,kt),m(5,Yt),m(6,Xe),m(7,Xs),m(8,HV),m(9,F),m(10,de),m(11,X),m(12,Rd),m(13,sL),m(14,Vu),m(15,XP),m(16,fe)],iut);var WCn=(a,i,e,t)=>{let o=[t?[t]:a.rootIds];for(;o.length;)for(let n of o.pop()){let r=a.getNodeById(n);if(r&&!(!r.item.uri||!i.extUri.isEqualOrParent(e,r.item.uri))){if(r.item.range||r.expand===1)return!0;o.push(r.children)}}return!1},out=class{constructor(i,e,t,o){this.collection=i;this.state=e;this.testService=t;this.uriIdentityService=o;this.documentUris=[]}filter(i){if(i instanceof wk)return 1;if(i.test&&!this.state.isFilteringFor("@hidden")&&this.testService.excluded.contains(i.test))return 0;switch(Math.min(this.testFilterText(i),this.testLocation(i),this.testState(i),this.testTags(i))){case 0:return 0;case 2:return this.lastIncludedTests?.add(i),1;default:return 2}}filterToDocumentUri(i){this.documentUris=[...i]}testTags(i){return!this.state.includeTags.size&&!this.state.excludeTags.size||(!this.state.includeTags.size||i.test.item.tags.some(e=>this.state.includeTags.has(e)))&&i.test.item.tags.every(e=>!this.state.excludeTags.has(e))?2:1}testState(i){return this.state.isFilteringFor("@failed")?Xx(i.state)?2:1:this.state.isFilteringFor("@executed")?i.state!==0?2:1:2}testLocation(i){return this.documentUris.length===0||!this.state.isFilteringFor("@doc")&&!this.state.isFilteringFor("@openedFiles")||!(i instanceof mg)||this.documentUris.some(e=>WCn(this.collection,this.uriIdentityService,e,i.test.item.extId))?2:1}testFilterText(i){if(this.state.globList.length===0)return 2;let e=this.state.fuzzy.value;for(let t=i;t;t=t.parent){let o=this.state.globList[0].include===!1?2:1,n=t.test.item.label.toLowerCase();for(let{include:r,text:s}of this.state.globList)(e?d4e(n,s):n.includes(s))&&(o=r?2:0);if(o!==1)return o}return 1}};out=I([m(1,HV),m(2,Xs),m(3,gt)],out);var BUi=class{constructor(i){this.viewModel=i}compare(i,e){if(i instanceof wk||e instanceof wk)return(i instanceof wk?-1:0)+(e instanceof wk?1:0);let t=(e.duration||0)-(i.duration||0);if(this.viewModel.viewSorting==="duration"&&t!==0)return t;let o=net(i.state,e.state);if(this.viewModel.viewSorting==="status"&&o!==0)return o;let n=!1;if(i instanceof mg&&e instanceof mg&&i.test.item.uri&&e.test.item.uri&&i.test.item.uri.toString()===e.test.item.uri.toString()&&i.test.item.range&&e.test.item.range){n=!0;let l=i.test.item.range.startLineNumber-e.test.item.range.startLineNumber;if(l!==0)return l}let r=i.test.item.sortText,s=e.test.item.sortText;return n&&!r&&!s?0:C_(r||i.test.item.label,s||e.test.item.label)}},nut=class extends k{constructor(i,e){super();let t=this.el=D(i,_(".testing-no-test-placeholder")),o=D(t,_("p"));o.innerText=d(17162,null);let n=d(17161,null),r=this._register(new Pi(t,{title:n,...Ro}));r.label=n,this._register(r.onDidClick(()=>e.toggleFilteringFor("@doc",!1)))}setVisible(i){this.el.classList.toggle("visible",i)}};nut=I([m(1,HV)],nut);var HUi=class extends cs{constructor(e){super();this.getSelectedTests=e}async runAction(e,t){if(!(e instanceof Do))return super.runAction(e,t);let o=this.getSelectedTests(),s=(o.some(l=>l===t)?o:[t]).filter(l=>l instanceof mg);await e.run(...s)}},gNo=a=>{let i=z0t(a.description||a.test.item.label,a.state);return a instanceof mg&&(a.duration!==void 0&&(i=d(17155,null,i,rut(a.duration))),a.retired&&(i=d(17156,null,i))),i},UUi=class{getWidgetAriaLabel(){return d(17154,null)}getAriaLabel(i){return i instanceof wk?i.description:gNo(i)}},zUi=class{getKeyboardNavigationLabel(i){return i instanceof wk?i.message:i.test.item.label}},KUi=class{getHeight(i){return i instanceof wk?27:22}getTemplateId(i){return i instanceof wk?cse.ID:dse.ID}},GUi=class{getId(i){return i.treeId}},cse=class{constructor(i,e){this.hoverService=i;this.markdownRendererService=e}static{this.ID="error"}get templateId(){return cse.ID}renderTemplate(i){return{label:D(i,_(".error")),disposable:new O}}renderElement({element:i},e,t){if(St(t.label),typeof i.message=="string")t.label.innerText=i.message;else{let o=this.markdownRendererService.render(i.message,void 0,document.createElement("span"));t.label.appendChild(o.element)}t.disposable.add(this.hoverService.setupManagedHover(yi("mouse"),t.label,i.description))}disposeTemplate(i){i.disposable.dispose()}};cse=I([m(0,ot),m(1,_n)],cse);var dse=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.actionRunner=e;this.menuService=t;this.testService=o;this.profiles=n;this.contextKeyService=r;this.instantiationService=s;this.crService=l;this.hoverService=c;this.templateId=dse.ID}static{this.ID="testItem"}renderTemplate(e){e.classList.add("testing-stdtree-container");let t=D(e,_(".computed-state")),o=D(e,_(".label")),n=new O;D(e,_(q.asCSSSelector(pAo)));let r=n.add(new oo(e,{actionRunner:this.actionRunner,actionViewItemProvider:(l,c)=>l instanceof Do?this.instantiationService.createInstance(Cl,l,{hoverDelegate:c.hoverDelegate}):void 0}));n.add(this.profiles.onDidChange(()=>{s.current&&this.fillActionBar(s.current,s)})),n.add(this.crService.onDidChange(l=>{let c=s.current?.test.item.extId;c&&(!l||l===c||ns.isChild(c,l))&&this.fillActionBar(s.current,s)}));let s={wrapper:e,label:o,actionBar:r,icon:t,elementDisposable:new O,templateDisposable:n};return s}disposeTemplate(e){e.templateDisposable.clear()}disposeElement(e,t,o){o.elementDisposable.clear()}fillActionBar(e,t){let{actions:o,contextOverlay:n}=fNo(this.contextKeyService,this.menuService,this.testService,this.crService,this.profiles,e),r=!!n.getContextKeyValue(co.isContinuousModeOn.key),s=!r&&this.crService.isEnabledForAChildOf(e.test.item.extId);t.actionBar.domNode.classList.toggle("testing-is-continuous-run",r||s),t.actionBar.clear(),t.actionBar.context=e,t.actionBar.push(o.primary,{icon:!0,label:!1})}renderElement(e,t,o){o.elementDisposable.clear(),o.current=e.element,o.elementDisposable.add(e.element.onChange(()=>this._renderElement(e,o))),this._renderElement(e,o)}_renderElement(e,t){this.fillActionBar(e.element,t);let o=this.testService.excluded.contains(e.element.test);t.wrapper.classList.toggle("test-is-hidden",o);let n=OO.get(e.element.test.expand===2||e.element.test.item.busy?2:e.element.state);t.icon.className="computed-state "+(n?q.asClassName(n):""),e.element.retired&&(t.icon.className+=" retired"),t.elementDisposable.add(this.hoverService.setupManagedHover(yi("mouse"),t.label,gNo(e.element))),e.element.test.item.label.trim()?Ii(t.label,...ir(e.element.test.item.label)):t.label.textContent="\xA0";let r=e.element.description;e.element.duration!==void 0&&(r=r?`${r}: ${rut(e.element.duration)}`:rut(e.element.duration)),r&&D(t.label,_("span.test-label-description",{},r))}};dse=I([m(1,Yt),m(2,Xs),m(3,Vu),m(4,X),m(5,F),m(6,XP),m(7,ot)],dse);var rut=a=>a<10?`${a.toFixed(1)}ms`:a<1e3?`${a.toFixed(0)}ms`:`${(a/1e3).toFixed(1)}s`,fNo=(a,i,e,t,o,n)=>{let r=n instanceof mg?n.test:void 0,s=Z1e(r,r?o.capabilitiesForTest(r.item):0);if(s.push(["view","workbench.view.testing"]),r){let p=e.getTestController(r.controllerId),h=!!p&&o.getControllerProfiles(p.id).some(g=>g.supportsContinuousRun&&JM(g,r));s.push([co.canRefreshTests.key,p&&!!(p.capabilities.get()&2)&&ns.isRoot(r.item.extId)],[co.testItemIsHidden.key,e.excluded.contains(r)],[co.isContinuousModeOn.key,h&&t.isSpecificallyEnabledFor(r.item.extId)],[co.isParentRunningContinuously.key,h&&t.isEnabledForAParentOf(r.item.extId)],[co.supportsContinuousRun.key,h],[co.testResultOutdated.key,n.retired],[co.testResultState.key,eOt[n.state]])}let l=a.createOverlay(s),c=i.getMenuActions(R.TestItem,l,{shouldForwardArgs:!0});return{actions:xl(c,"inline"),contextOverlay:l}};hs((a,i)=>{if(a.type==="dark"){let e=a.getColor(xo);if(e){let t=new Ue(new Ut(e.rgba.r,e.rgba.g,e.rgba.b,.65));i.addRule(`.test-explorer .test-explorer-messages { color: ${t}; }`)}}});var vSe=class extends k{constructor(e,t,o,n){super();this.configurationService=o;this.viewsService=n;this._register(e.onResultsChanged(s=>{"started"in s&&this.attachAutoOpenForNewResults(s.started)}));let r=ve(s=>{t.selected.read(s)&&(r.dispose(),$re.register())});this._register(r)}static{this.ID="workbench.contrib.testing.progressTrigger"}attachAutoOpenForNewResults(e){if(e.request.preserveFocus===!0)return;let t=wm(this.configurationService,"testing.automaticallyOpenTestResults");if(t==="neverOpen")return;if(t==="openExplorerOnTestStart")return this.openExplorerView();if(t==="openOnTestStart")return this.openResultsView();let o=new O;o.add(e.onComplete(()=>o.dispose())),o.add(e.onChange(n=>{n.reason===1&&Xx(n.item.ownComputedState)&&(this.openResultsView(),o.dispose())}))}openExplorerView(){this.viewsService.openView("workbench.view.testing",!1)}openResultsView(){this.viewsService.openView("workbench.panel.testResults.view",!1)}};vSe=I([m(0,Rd),m(1,YC),m(2,B),m(3,Gt)],vSe);var Cze=class extends Qc{constructor(i,e,t,o,n,r,s,l,c,u,p){super("workbench.view.extension.test",{mergeViewWithContainerWhenSingleView:!0},t,s,i,o,e,l,n,r,c,u,p)}create(i){super.create(i),i.classList.add("testing-view-pane")}getOptimalWidth(){return 400}getTitle(){return d(17176,null)}};Cze=I([m(0,wi),m(1,_e),m(2,F),m(3,Xe),m(4,Pe),m(5,de),m(6,B),m(7,lt),m(8,Ae),m(9,ji),m(10,re)],Cze);Ce(Xs,K1e,1);Ce(j0t,VLe,1);Ce(Vu,FLe,1);Ce(YC,H1e,1);Ce(XP,q1e,1);Ce(Rd,BLe,1);Ce(HV,U1e,1);Ce(sL,ase,1);Ce(mdt,bze,1);var VCn=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:"workbench.view.extension.test",title:P(17115,"Testing"),ctorDescriptor:new Vt(Cze),icon:j1e,alwaysUseContainerInfo:!0,order:6,openCommandActionDescriptor:{id:"workbench.view.extension.test",mnemonicTitle:d(17112,null),order:4},hideIfEmpty:!0},0),BCn=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:"workbench.panel.testResults",title:P(17118,"Test Results"),icon:vHi,ctorDescriptor:new Vt(Qc,["workbench.panel.testResults",{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,order:3},1,{doNotRegisterOpenCommand:!0}),p6t=oe.as(Kn.ViewsRegistry);p6t.registerViews([{id:"workbench.panel.testResults.view",name:P(17118,"Test Results"),containerIcon:vHi,canToggleVisibility:!1,canMoveView:!0,when:co.hasAnyResults.isEqualTo(!0),ctorDescriptor:new Vt(vze)}],BCn);p6t.registerViewWelcomeContent("workbench.view.testing",{content:d(17113,null)});p6t.registerViewWelcomeContent("workbench.view.testing",{content:"["+d(17114,null)+"](command:testing.searchForTestExtension)",order:10});p6t.registerViews([{id:"workbench.view.testing",name:P(17117,"Test Explorer"),ctorDescriptor:new Vt(wze),canToggleVisibility:!0,canMoveView:!0,weight:80,order:-999,containerIcon:j1e,when:C.greater(co.providerCount.key,0)},{id:"workbench.view.testCoverage",name:P(17116,"Test Coverage"),ctorDescriptor:new Vt(Y1e),canToggleVisibility:!0,canMoveView:!0,weight:80,order:-998,containerIcon:j1e,when:co.isTestCoverageOpen}],VCn);WAo.forEach(W);W(s6t);W(n6t);W(o6t);W(t6t);W(a6t);W(r6t);bt(dSe.ID,dSe,vt.AfterRestored);bt(ase.ID,ase,vt.Eventually);bt(vSe.ID,vSe,vt.Eventually);bt(sSe.ID,sSe,vt.Eventually);Eo("editor.contrib.testingOutputPeek",IS,1);Eo("editor.contrib.testingDecorations",FO,1);Eo("editor.contrib.coverageDecorations",jre,3);Ge.registerCommand({id:"_revealTestInExplorer",handler:async(a,i,e)=>{a.get(HV).reveal.set(typeof i=="string"?i:i.extId,void 0),a.get(Gt).openView("workbench.view.testing",e)}});Ge.registerCommand({id:"testing.startContinuousRunFromExtension",handler:async(a,i,e)=>{let t=a.get(Vu),o=a.get(Xs).collection,n=t.getControllerProfiles(i.controllerId).find(s=>s.profileId===i.profileId);if(!n?.supportsContinuousRun)return;let r=a.get(XP);for(let s of e){let l=o.getNodeById(s.extId);l&&JM(n,l)&&r.start([n],l.item.extId)}}});Ge.registerCommand({id:"testing.stopContinuousRunFromExtension",handler:async(a,i)=>{let e=a.get(XP);for(let t of i)e.stop(t.extId)}});Ge.registerCommand({id:"vscode.peekTestError",handler:async(a,i)=>{let e=a.get(Rd).getStateById(i);if(!e)return!1;let[t,o]=e,n=a.get(sL);if(n.tryPeekFirstError(t,o))return!0;for(let r of t.tests)if(ns.compare(o.item.extId,r.item.extId)===2&&n.tryPeekFirstError(t,r))return!0;return!1}});Ge.registerCommand({id:"vscode.revealTest",handler:async(a,i,e)=>{let t=a.get(Xs).collection.getNodeById(i);if(!t)return;let o=a.get(fe),n=a.get(ge),r=a.get(Je),{range:s,uri:l}=t.item;if(!l)return;let c=a.get(mdt).getDecoratedTestPosition(l,i)||s?.getStartPosition();a.get(HV).reveal.set(i,void 0),a.get(sL).closeAllPeeks();let u=!0;try{(await n.stat(l)).isFile||(u=!1)}catch{}if(!u){await o.executeCommand(sV,l);return}await r.open(c?l.with({fragment:`L${c.lineNumber}:${c.column}`}):l,{openToSide:e?.openToSide,editorOptions:{preserveFocus:e?.preserveFocus}})}});Ge.registerCommand({id:"vscode.runTestsById",handler:async(a,i,...e)=>{let t=a.get(Xs);await Mdt(a.get(Xs).collection,a.get(Go),e,o=>t.runTests({group:i,tests:o}))}});Ge.registerCommand({id:"vscode.testing.getControllersWithTests",handler:async a=>[...a.get(Xs).collection.rootItems].filter(e=>e.children.size>0).map(e=>e.controllerId)});Ge.registerCommand({id:"vscode.testing.getTestsInFile",handler:async(a,i)=>[...a.get(Xs).collection.getNodeByUrl(i)].map(t=>ns.split(t.item.extId))});oe.as($t.Configuration).registerConfiguration(qPo);var $$=class extends it{constructor(e,t,o,n,r,s){super(e,t);this.quickInputService=o;this.loggerService=n;this.outputService=r;this.defaultLogLevelsService=s}static{this.ID="workbench.action.setLogLevel"}static{this.TITLE=P(12712,"Set Log Level...")}async run(){let e=await this.selectLogLevelOrChannel();e!==null&&(LY(e)?this.loggerService.setLogLevel(e):await this.setLogLevelForChannel(e))}async selectLogLevelOrChannel(){let e=this.defaultLogLevelsService.defaultLogLevels,t=[],o=[],n=this.loggerService.getLogLevel();for(let s of this.outputService.getChannelDescriptors()){if(!this.outputService.canSetLogLevel(s))continue;let l=xN(s)?[s.source]:QH(s)?s.source:[];if(!l.length)continue;let c=l.reduce((p,h)=>Math.min(p,this.loggerService.getLogLevel(h.resource)??n),n),u={id:s.id,label:s.label,description:c!==n?this.getLabel(c):void 0,channel:s};s.extensionId?t.push(u):o.push(u)}let r=[];return r.push({type:"separator",label:d(12700,null)}),r.push(...this.getLogLevelEntries(e.default,this.loggerService.getLogLevel(),!0)),t.length&&(r.push({type:"separator",label:d(12703,null)}),r.push(...t.sort((s,l)=>s.label.localeCompare(l.label)))),r.push({type:"separator",label:d(12705,null)}),r.push(...o.sort((s,l)=>s.label.localeCompare(l.label))),new Promise((s,l)=>{let c=new O,u=c.add(this.quickInputService.createQuickPick({useSeparators:!0}));u.placeholder=d(12708,null),u.items=r;let p;c.add(u.onDidTriggerItemButton(h=>{u.hide(),this.defaultLogLevelsService.setDefaultLogLevel(h.item.level)})),c.add(u.onDidAccept(h=>{p=u.selectedItems[0],u.hide()})),c.add(u.onDidHide(()=>{let h=p?p.level??p:null;c.dispose(),s(h)})),u.show()})}async setLogLevelForChannel(e){let t=this.defaultLogLevelsService.defaultLogLevels,o=t.extensions.find(r=>r[0]===e.channel.extensionId?.toLowerCase())?.[1]??t.default,n=this.getLogLevelEntries(o,this.outputService.getLogLevel(e.channel)??o,!!e.channel.extensionId);return new Promise((r,s)=>{let l=new O,c=l.add(this.quickInputService.createQuickPick());c.placeholder=e?d(12710,null,e?.label):d(12709,null),c.items=n,c.activeItems=n.filter(p=>p.level===this.loggerService.getLogLevel());let u;l.add(c.onDidTriggerItemButton(p=>{c.hide(),this.defaultLogLevelsService.setDefaultLogLevel(p.item.level,e.channel.extensionId)})),l.add(c.onDidAccept(p=>{u=c.selectedItems[0],c.hide()})),l.add(c.onDidHide(()=>{u&&this.outputService.setLogLevel(e.channel,u.level),l.dispose(),r()})),c.show()})}getLogLevelEntries(e,t,o){let n=o?{iconClass:q.asClassName(L.checkAll),tooltip:d(12707,null)}:void 0;return[{label:this.getLabel(1,t),level:1,description:this.getDescription(1,e),buttons:n&&e!==1?[n]:void 0},{label:this.getLabel(2,t),level:2,description:this.getDescription(2,e),buttons:n&&e!==2?[n]:void 0},{label:this.getLabel(3,t),level:3,description:this.getDescription(3,e),buttons:n&&e!==3?[n]:void 0},{label:this.getLabel(4,t),level:4,description:this.getDescription(4,e),buttons:n&&e!==4?[n]:void 0},{label:this.getLabel(5,t),level:5,description:this.getDescription(5,e),buttons:n&&e!==5?[n]:void 0},{label:this.getLabel(0,t),level:0,description:this.getDescription(0,e),buttons:n&&e!==0?[n]:void 0}]}getLabel(e,t){let o=z4e(e).value;return e===t?`$(check) ${o}`:o}getDescription(e,t){return t===e?d(12702,null):void 0}};$$=I([m(2,$e),m(3,Ol),m(4,Tl),m(5,FR)],$$);var m6t=class extends it{constructor(e,t,o,n,r,s){super(e,t);this.environmentService=o;this.fileService=n;this.quickInputService=r;this.editorService=s}static{this.ID="workbench.action.openSessionLogFile"}static{this.TITLE=P(12706,"Open Window Log File (Session)...")}async run(){let e=await this.quickInputService.pick(this.getSessions().then(t=>t.map((o,n)=>({id:o.toString(),label:Be(o),description:n===0?d(12701,null):void 0}))),{canPickMany:!1,placeHolder:d(12711,null)});if(e){let t=await this.quickInputService.pick(this.getLogFiles(A.parse(e.id)).then(o=>o.map(n=>({id:n.toString(),label:Be(n)}))),{canPickMany:!1,placeHolder:d(12704,null)});if(t)return this.editorService.openEditor({resource:A.parse(t.id),options:{pinned:!0}}).then(()=>{})}}async getSessions(){let e=this.environmentService.logsHome.with({scheme:this.environmentService.logFile.scheme}),t=[e],o=await this.fileService.resolve(ai(e));return o.children&&t.push(...o.children.filter(n=>!ze(n.resource,e)&&n.isDirectory&&/^\d{8}T\d{6}$/.test(n.name)).sort().reverse().map(n=>n.resource)),t}async getLogFiles(e){let t=await this.fileService.resolve(e);return t.children?t.children.filter(o=>!o.isDirectory).map(o=>o.resource):[]}};m6t=I([m(2,Mt),m(3,ge),m(4,$e),m(5,ie)],m6t);W(class extends z{constructor(){super({id:$$.ID,title:$$.TITLE,category:Fe.Developer,f1:!0})}run(a){let i=a.get(F).createInstance($$,$$.ID,$$.TITLE.value);return i.run().finally(()=>i.dispose())}});W(class extends z{constructor(){super({id:"workbench.action.setDefaultLogLevel",title:P(12698,"Set Default Log Level"),category:Fe.Developer})}run(a,i,e){return a.get(FR).setDefaultLogLevel(i,e)}});var sut=class extends k{constructor(e,t,o){super();this.loggerService=e;this.contextKeyService=t;this.uriIdentityService=o;this.contextKeys=new Wye;this.outputChannelRegistry=oe.as(bb.OutputChannels);let n=qQi.bindTo(t);n.set(ux(e.getLogLevel())),this._register(e.onDidChangeLogLevel(r=>{LY(r)&&n.set(ux(e.getLogLevel()))})),this.onDidAddLoggers(e.getRegisteredLoggers()),this._register(e.onDidChangeLoggers(({added:r,removed:s})=>{this.onDidAddLoggers(r),this.onDidRemoveLoggers(s)})),this._register(e.onDidChangeVisibility(([r,s])=>{let l=e.getRegisteredLogger(r);l&&(s?this.registerLogChannel(l):this.deregisterLogChannel(l))})),this.registerShowWindowLogAction(),this._register(U.filter(t.onDidChangeContext,r=>r.affectsSome(this.contextKeys))(()=>this.onDidChangeContext()))}onDidAddLoggers(e){for(let t of e){if(t.when){let o=C.deserialize(t.when);if(o){for(let n of o.keys())this.contextKeys.add(n);if(!this.contextKeyService.contextMatchesRules(o))continue}}t.hidden||this.registerLogChannel(t)}}onDidChangeContext(){for(let e of this.loggerService.getRegisteredLoggers())e.when&&(this.contextKeyService.contextMatchesRules(C.deserialize(e.when))?this.registerLogChannel(e):this.deregisterLogChannel(e))}onDidRemoveLoggers(e){for(let t of e){if(t.when){let o=C.deserialize(t.when);if(o)for(let n of o.keys())this.contextKeys.delete(n)}this.deregisterLogChannel(t)}}registerLogChannel(e){if(e.group){this.registerCompoundLogChannel(e.group.id,e.group.name,e);return}let t=this.outputChannelRegistry.getChannel(e.id);if(t&&xN(t)&&this.uriIdentityService.extUri.isEqual(t.source.resource,e.resource))return;let o=this.outputChannelRegistry.getChannel(e.id),n=o&&xN(o)&&o.source.resource.scheme===Q.vscodeRemote?this.loggerService.getRegisteredLogger(o.source.resource):void 0;n&&this.deregisterLogChannel(n);let r=o&&e.resource.scheme===Q.vscodeRemote,s=r?`${e.id}.remote`:e.id,l=r?d(12697,null,e.name??e.id):e.name??e.id;this.outputChannelRegistry.registerChannel({id:s,label:l,source:{resource:e.resource},log:!0,extensionId:e.extensionId})}registerCompoundLogChannel(e,t,o){let n=this.outputChannelRegistry.getChannel(e),r={resource:o.resource,name:o.name??o.id};n?QH(n)&&!n.source.some(({resource:s})=>this.uriIdentityService.extUri.isEqual(s,o.resource))&&this.outputChannelRegistry.updateChannelSources(e,[...n.source,r]):this.outputChannelRegistry.registerChannel({id:e,label:t,log:!0,source:[r]})}deregisterLogChannel(e){if(e.group){let t=this.outputChannelRegistry.getChannel(e.group.id);t&&QH(t)&&this.outputChannelRegistry.updateChannelSources(e.group.id,t.source.filter(({resource:o})=>!this.uriIdentityService.extUri.isEqual(o,e.resource)))}else this.outputChannelRegistry.removeChannel(e.id)}registerShowWindowLogAction(){this._register(W(class extends z{constructor(){super({id:OG,title:P(12699,"Show Window Log"),category:Fe.Developer,f1:!0})}async run(t){t.get(Tl).showChannel(ghe)}}))}};sut=I([m(0,Ol),m(1,X),m(2,gt)],sut);oe.as(Zi.Workbench).registerWorkbenchContribution(sut,3);var UV=class{constructor(i,e,t){this.quickInputService=i;this.keybindingService=e;this.contextKeyService=t;this.registry=oe.as(Bu.Quickaccess)}static{this.PREFIX="?"}provide(i){let e=new O;return e.add(i.onDidAccept(()=>{let[t]=i.selectedItems;t&&this.quickInputService.quickAccess.show(t.prefix,{preserveValue:!0})})),e.add(i.onDidChangeValue(t=>{let o=this.registry.getQuickAccessProvider(t.substr(UV.PREFIX.length),this.contextKeyService);o?.prefix&&o.prefix!==UV.PREFIX&&this.quickInputService.quickAccess.show(o.prefix,{preserveValue:!0})})),i.items=this.getQuickAccessProviders().filter(t=>t.prefix!==UV.PREFIX),e}getQuickAccessProviders(){return this.registry.getQuickAccessProviders(this.contextKeyService).sort((e,t)=>e.prefix.localeCompare(t.prefix)).flatMap(e=>this.createPicks(e))}createPicks(i){return i.helpEntries.map(e=>{let t=e.prefix||i.prefix,o=t||"\u2026";return{prefix:t,label:o,keybinding:e.commandId?this.keybindingService.lookupKeybinding(e.commandId):void 0,ariaLabel:d(2492,null,o,e.description),description:e.description}})}};UV=I([m(0,$e),m(1,Le),m(2,X)],UV);var V1=class extends cg{constructor(e,t,o,n,r,s,l,c){super(V1.PREFIX,{noResultsPick:{label:d(14494,null),containerLabel:""}});this.viewDescriptorService=e;this.viewsService=t;this.outputService=o;this.terminalService=n;this.terminalGroupService=r;this.debugService=s;this.paneCompositeService=l;this.contextKeyService=c}static{this.PREFIX="view "}_getPicks(e){let t=this.doGetViewPickItems().filter(s=>e?(s.highlights={label:xh(e,s.label,!0)??void 0},s.highlights.label||d4e(s.containerLabel,e)):!0),o=new Map;for(let s of t)o.has(s.label)||o.set(s.label,s.containerLabel);let n=[],r;for(let s of t){if(r!==s.containerLabel){r=s.containerLabel;let l;o.has(r)?l=`${o.get(r)} / ${r}`:l=r,n.push({type:"separator",label:l})}n.push(s)}return n}doGetViewPickItems(){let e=[],t=(s,l)=>{let c=this.viewDescriptorService.getViewContainerModel(l),u=[];for(let p of c.allViewDescriptors)this.contextKeyService.contextMatchesRules(p.when)&&u.push({label:p.name.value,containerLabel:c.title,accept:()=>this.viewsService.openView(p.id,!0)});return u},o=(s,l)=>{let c=this.paneCompositeService.getPaneComposites(s),u=this.paneCompositeService.getVisiblePaneCompositeIds(s);c.sort((p,h)=>{let g=u.findIndex(v=>p.id===v),f=u.findIndex(v=>h.id===v);return g<0&&(g=c.indexOf(p)+u.length),f<0&&(f=c.indexOf(h)+u.length),g-f});for(let p of c)if(this.includeViewContainer(p)){let h=this.viewDescriptorService.getViewContainerById(p.id);h&&e.push({label:this.viewDescriptorService.getViewContainerModel(h).title,containerLabel:l,accept:()=>this.paneCompositeService.openPaneComposite(p.id,s,!0)})}};o(0,d(14501,null)),o(1,d(14496,null)),o(2,d(14498,null));let n=s=>{let l=this.paneCompositeService.getPaneComposites(s);for(let c of l){let u=this.viewDescriptorService.getViewContainerById(c.id);u&&e.push(...t(c,u))}};n(0),n(1),n(2),this.terminalGroupService.groups.forEach((s,l)=>{s.terminalInstances.forEach((c,u)=>{let p=d(14500,null,`${l+1}.${u+1}`,c.title);e.push({label:p,containerLabel:d(14499,null),accept:async()=>{await this.terminalGroupService.showPanel(!0),this.terminalService.setActiveInstance(c)}})})}),this.debugService.getModel().getSessions(!0).filter(s=>s.hasSeparateRepl()).forEach((s,l)=>{let c=s.name;e.push({label:c,containerLabel:d(14493,null),accept:async()=>{await this.debugService.focusStackFrame(void 0,void 0,s,{explicit:!0}),this.viewsService.isViewVisible($d)||await this.viewsService.openView($d,!0)}})});let r=this.outputService.getChannelDescriptors();for(let s of r)e.push({label:s.label,containerLabel:d(14492,null),accept:()=>this.outputService.showChannel(s.id)});return e}includeViewContainer(e){let t=this.viewDescriptorService.getViewContainerById(e.id);return t?.hideIfEmpty?this.viewDescriptorService.getViewContainerModel(t).activeViewDescriptors.length>0:!0}};V1=I([m(0,ji),m(1,Gt),m(2,Tl),m(3,an),m(4,Cc),m(5,Hi),m(6,Es),m(7,X)],V1);var xze=class a extends z{static{this.ID="workbench.action.openView"}constructor(){super({id:a.ID,title:P(14495,"Open View"),category:Fe.View,f1:!0})}async run(i){i.get($e).quickAccess.show(V1.PREFIX)}},aut=class a extends z{static{this.ID="workbench.action.quickOpenView"}static{this.KEYBINDING={primary:2095,mac:{primary:303},linux:{primary:0}}}constructor(){super({id:a.ID,title:P(14497,"Quick Open View"),category:Fe.View,f1:!1,keybinding:{weight:200,when:void 0,...a.KEYBINDING}})}async run(i){let e=i.get(Le),t=i.get($e),o=e.lookupKeybindings(a.ID);t.quickAccess.show(V1.PREFIX,{quickNavigateConfiguration:{keybindings:o},itemActivation:1})}};var zV=class extends cg{constructor(e,t,o,n,r,s){super(zV.PREFIX,e);this.keybindingService=o;this.commandService=n;this.telemetryService=r;this.dialogService=s;this.commandsHistory=this._register(t.createInstance(vu)),this.options=e}static{this.PREFIX=">"}static{this.TFIDF_THRESHOLD=.5}static{this.TFIDF_MAX_RESULTS=5}static{this.WORD_FILTER=UF(HX,Qw)}async _getPicks(e,t,o,n){let r=await this.getCommandPicks(o);if(o.isCancellationRequested)return[];let s=bd(()=>{let f=new CNe;f.updateDocuments(r.map(b=>({key:b.commandId,textChunks:[this.getTfIdfChunk(b)]})));let v=f.calculateScores(e,o);return eIo(v).filter(b=>b.score>zV.TFIDF_THRESHOLD).slice(0,zV.TFIDF_MAX_RESULTS)}),l=[];for(let f of r){let v=zV.WORD_FILTER(e,f.label)??void 0,b;if(f.commandAlias&&(b=zV.WORD_FILTER(e,f.commandAlias)??void 0),v||b)f.highlights={label:v,detail:this.options.showAlias?b:void 0},l.push(f);else if(e===f.commandId)l.push(f);else if(e.length>=3){let S=s();if(o.isCancellationRequested)return[];let y=S.find(w=>w.key===f.commandId);y&&(f.tfIdfScore=y.score,l.push(f))}}let c=new Map;for(let f of l){let v=c.get(f.label);v?(f.description=f.commandId,v.description=v.commandId):c.set(f.label,f)}l.sort((f,v)=>{if(f.tfIdfScore&&v.tfIdfScore)return f.tfIdfScore===v.tfIdfScore?f.label.localeCompare(v.label):v.tfIdfScore-f.tfIdfScore;if(f.tfIdfScore)return 1;if(v.tfIdfScore)return-1;let b=this.commandsHistory.peek(f.commandId),S=this.commandsHistory.peek(v.commandId);if(b&&S)return b>S?-1:1;if(b)return-1;if(S)return 1;if(this.options.suggestedCommandIds){let x=this.options.suggestedCommandIds.has(f.commandId),E=this.options.suggestedCommandIds.has(v.commandId);if(x&&E)return 0;if(x)return-1;if(E)return 1}let y=f.commandCategory===Fe.Developer.value,w=v.commandCategory===Fe.Developer.value;return y&&!w?1:!y&&w?-1:f.label.localeCompare(v.label)});let u=[],p=!1,h=!0,g=!!this.options.suggestedCommandIds;for(let f=0;f<l.length;f++){let v=l[f],b=!!this.commandsHistory.peek(v.commandId);f===0&&b&&(u.push({type:"separator",label:d(2489,null)}),p=!0),h&&v.tfIdfScore!==void 0&&(u.push({type:"separator",label:d(2491,null)}),h=!1),g&&v.tfIdfScore===void 0&&!b&&this.options.suggestedCommandIds?.has(v.commandId)&&(u.push({type:"separator",label:d(2487,null)}),p=!0,g=!1),p&&v.tfIdfScore===void 0&&!b&&!this.options.suggestedCommandIds?.has(v.commandId)&&(u.push({type:"separator",label:d(2488,null)}),p=!1),u.push(this.toCommandPick(v,n,b))}return this.hasAdditionalCommandPicks(e,o)?{picks:u,additionalPicks:(async()=>{let f=await this.getAdditionalCommandPicks(r,l,e,o);if(o.isCancellationRequested)return[];let v=f.map(b=>this.toCommandPick(b,n));return h&&v[0]?.type!=="separator"&&v.unshift({type:"separator",label:d(2491,null)}),v})()}:u}toCommandPick(e,t,o=!1){if(e.type==="separator")return e;let n=e.tooltip??e.commandDescription?.value,r=this.keybindingService.lookupKeybinding(e.commandId),s=r?d(2486,null,e.label,r.getAriaLabel()):e.label,l=e.buttons||[],c=o?[...l,{iconClass:q.asClassName(L.close),tooltip:d(2490,null)}]:e.buttons;return{...e,tooltip:n,ariaLabel:s,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:r,buttons:c,accept:async()=>{this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:t?.from??"quick open"});try{e.args?.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(u){Yi(u)||this.dialogService.error(d(2485,null,e.label),Mn(u))}},trigger:o?(u,p)=>{let h=l.length;return u===h?(this.commandsHistory.remove(e.commandId),3):e.trigger?e.trigger(u,p):0}:e.trigger}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:o}){let n=e;return t&&t!==e&&(n+=` - ${t}`),o&&o.value!==e&&(n+=` - ${o.value===o.original?o.value:`${o.value} (${o.original})`}`),n}};zV=I([m(1,F),m(2,Le),m(3,fe),m(4,_e),m(5,ct)],zV);var vu=class extends k{constructor(e,t,o){super();this.storageService=e;this.configurationService=t;this.logService=o;this.configuredCommandsHistoryLength=0;this.updateConfiguration(),this.load(),this.registerListeners()}static{this.DEFAULT_COMMANDS_HISTORY_LENGTH=50}static{this.PREF_KEY_CACHE="commandPalette.mru.cache"}static{this.PREF_KEY_COUNTER="commandPalette.mru.counter"}static{this.counter=1}static{this.hasChanges=!1}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===1&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=vu.getConfiguredCommandHistoryLength(this.configurationService),vu.cache&&vu.cache.limit!==this.configuredCommandsHistoryLength&&(vu.cache.limit=this.configuredCommandsHistoryLength,vu.hasChanges=!0))}load(){let e=this.storageService.get(vu.PREF_KEY_CACHE,0),t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}let o=vu.cache=new Ua(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((r,s)=>r.value-s.value),n.forEach(r=>o.set(r.key,r.value))}vu.counter=this.storageService.getNumber(vu.PREF_KEY_COUNTER,0,vu.counter)}push(e){vu.cache&&(vu.cache.set(e,vu.counter++),vu.hasChanges=!0)}peek(e){return vu.cache?.peek(e)}remove(e){vu.cache&&(vu.cache.delete(e),vu.hasChanges=!0)}saveState(){if(!vu.cache||!vu.hasChanges)return;let e={usesLRU:!0,entries:[]};vu.cache.forEach((t,o)=>e.entries.push({key:o,value:t})),this.storageService.store(vu.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(vu.PREF_KEY_COUNTER,vu.counter,0,0),vu.hasChanges=!1}static getConfiguredCommandHistoryLength(e){let o=e.getValue().workbench?.commandPalette?.history;return typeof o=="number"?o:vu.DEFAULT_COMMANDS_HISTORY_LENGTH}static clearHistory(e,t){let o=vu.getConfiguredCommandHistoryLength(e);vu.cache=new Ua(o),vu.counter=1,vu.hasChanges=!0}};vu=I([m(0,de),m(1,B),m(2,re)],vu);var h6t=class extends zV{constructor(i,e,t,o,n,r){super(i,e,t,o,n,r)}getCodeEditorCommandPicks(){let i=this.activeTextEditorControl;if(!i)return[];let e=[];for(let t of i.getSupportedActions()){let o;t.metadata?.description&&(d4(t.metadata.description)?o=t.metadata.description:o={original:t.metadata.description,value:t.metadata.description}),e.push({commandId:t.id,commandAlias:t.alias,commandDescription:o,label:Du(t.label)||t.id})}return e}};var B1=class extends h6t{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super({showAlias:!SI.isDefaultVariant(),noResultsPick:()=>({label:d(14478,null),commandId:""})},n,r,s,l,c);this.editorService=e;this.menuService=t;this.configurationService=u;this.editorGroupService=p;this.preferencesService=h;this.productService=g;this.aiRelatedInformationService=f;this.chatAgentService=v;this.useAiRelatedInfo=!1;this.extensionRegistrationRace=Uu(o.whenInstalledExtensionsRegistered(),800),this._register(u.onDidChangeConfiguration(b=>this.updateOptions(b))),this.updateOptions()}static{this.AI_RELATED_INFORMATION_MAX_PICKS=5}static{this.AI_RELATED_INFORMATION_DEBOUNCE=200}get activeTextEditorControl(){return this.editorService.activeTextEditorControl}get defaultFilterValue(){if(this.configuration.preserveInput)return 1}get configuration(){let e=this.configurationService.getValue().workbench.commandPalette;return{preserveInput:e.preserveInput,showAskInChat:e.showAskInChat,experimental:e.experimental}}updateOptions(e){if(e&&!e.affectsConfiguration("workbench.commandPalette.experimental"))return;let t=this.configuration,o=t.experimental.suggestCommands&&this.productService.commandPaletteSuggestedCommandIds?.length?new Set(this.productService.commandPaletteSuggestedCommandIds):void 0;this.options.suggestedCommandIds=o,this.useAiRelatedInfo=t.experimental.enableNaturalLanguageSearch}async getCommandPicks(e){return await this.extensionRegistrationRace,e.isCancellationRequested?[]:[...this.getCodeEditorCommandPicks(),...this.getGlobalCommandPicks()].map(t=>({...t,buttons:[{iconClass:q.asClassName(L.gear),tooltip:d(14475,null)}],trigger:()=>(this.preferencesService.openGlobalKeybindingSettings(!1,{query:lvo(t.commandId,t.commandWhen)}),1)}))}hasAdditionalCommandPicks(e,t){return!(!this.useAiRelatedInfo||t.isCancellationRequested||e===""||!this.aiRelatedInformationService.isEnabled())}async getAdditionalCommandPicks(e,t,o,n){if(!this.hasAdditionalCommandPicks(o,n))return[];let r=[];try{await Li(B1.AI_RELATED_INFORMATION_DEBOUNCE,n),r=await this.getRelatedInformationPicks(e,t,o,n)}catch{}return this.configuration.showAskInChat&&this.chatAgentService.getDefaultAgent("panel")&&((t.length||r.length)&&r.push({type:"separator"}),r.push({label:d(14472,null,o),commandId:this.configuration.experimental.askChatLocation==="quickChat"?klt:tk,args:[o],buttons:[{iconClass:q.asClassName(L.gear),tooltip:d(14473,null)}],trigger:()=>(this.preferencesService.openSettings({jsonEditor:!1,query:"workbench.commandPalette.showAskInChat"}),1)})),r}async getRelatedInformationPicks(e,t,o,n){let r=await this.aiRelatedInformationService.getRelatedInformation(o,[2],n);r.sort((c,u)=>u.weight-c.weight);let s=new Set(t.map(c=>c.commandId)),l=new Array;for(let c of r){if(l.length===B1.AI_RELATED_INFORMATION_MAX_PICKS)break;let u=e.find(p=>p.commandId===c.command&&!s.has(p.commandId));u&&l.push(u)}return l}getGlobalCommandPicks(){let e=[],t=this.editorService.activeEditorPane?.scopedContextKeyService||this.editorGroupService.activeGroup.scopedContextKeyService,n=this.menuService.getMenuActions(R.CommandPalette,t).reduce((r,[,s])=>[...r,...s],[]).filter(r=>r instanceof Do&&r.enabled);for(let r of n){let s=(typeof r.item.title=="string"?r.item.title:r.item.title.value)||r.item.id,l=typeof r.item.category=="string"?r.item.category:r.item.category?.value;l&&(s=d(14474,null,l,s));let c=typeof r.item.title!="string"?r.item.title.original:void 0,u=l&&r.item.category&&typeof r.item.category!="string"?r.item.category.original:void 0,p=c&&l?u?`${u}: ${c}`:`${l}: ${c}`:c,h=r.item.metadata?.description,g=h===void 0||d4(h)?h:{value:h,original:h};e.push({commandId:r.item.id,commandWhen:r.item.precondition?.serialize(),commandAlias:p,label:Du(s),commandDescription:g,commandCategory:l})}return e}};B1=I([m(0,ie),m(1,Yt),m(2,lt),m(3,F),m(4,Le),m(5,fe),m(6,_e),m(7,ct),m(8,B),m(9,kt),m(10,Qo),m(11,Ze),m(12,ULe),m(13,gr)],B1);var X9=class a extends z{static{this.ID="workbench.action.showCommands"}constructor(){super({id:a.ID,title:P(14479,"Show All Commands"),keybinding:{weight:200,when:void 0,primary:ed?void 0:3118,secondary:[59]},f1:!0})}async run(i){i.get($e).quickAccess.show(B1.PREFIX)}},g6t=class extends z{constructor(){super({id:"workbench.action.clearCommandHistory",title:P(14471,"Clear Command History"),f1:!0})}async run(i){let e=i.get(B),t=i.get(de),o=i.get(ct);if(vu.getConfiguredCommandHistoryLength(e)>0){let{confirmed:r}=await o.confirm({type:"warning",message:d(14477,null),detail:d(14476,null),primaryButton:d(14470,null)});if(!r)return;vu.clearHistory(e,t)}}};var qUi=oe.as(Bu.Quickaccess);qUi.registerQuickAccessProvider({ctor:UV,prefix:UV.PREFIX,placeholder:d(14484,null,UV.PREFIX),helpEntries:[{description:d(14483,null),commandCenterOrder:70,commandCenterLabel:d(14489,null)}]});qUi.registerQuickAccessProvider({ctor:V1,prefix:V1.PREFIX,contextKey:"inViewsPicker",placeholder:d(14491,null),helpEntries:[{description:d(14490,null),commandId:xze.ID}]});qUi.registerQuickAccessProvider({ctor:B1,prefix:B1.PREFIX,contextKey:"inCommandsPicker",placeholder:d(14482,null),helpEntries:[{description:d(14481,null),commandId:X9.ID,commandCenterOrder:20}]});be.appendMenuItem(R.MenubarViewMenu,{group:"1_open",command:{id:X9.ID,title:d(14485,null)},order:1});be.appendMenuItem(R.MenubarHelpMenu,{group:"1_welcome",command:{id:X9.ID,title:d(14488,null)},order:2});be.appendMenuItem(R.MenubarViewMenu,{group:"1_open",command:{id:xze.ID,title:d(14487,null)},order:2});be.appendMenuItem(R.MenubarGoMenu,{group:"5_infile_nav",command:{id:"workbench.action.gotoLine",title:d(14486,null)},order:1});be.appendMenuItem(R.GlobalActivity,{group:"1_command",command:{id:X9.ID,title:d(14480,null)},order:1});be.appendMenuItem(R.EditorContext,{group:"z_commands",when:me.editorSimpleInput.toNegated(),command:{id:X9.ID,title:d(14480,null)},order:1});W(g6t);W(X9);W(xze);W(aut);var HCn="inViewsPicker",SNo=C.and(y_,C.has(HCn)),kze=aut.KEYBINDING,vNo="workbench.action.quickOpenNavigateNextInViewPicker";xt.registerCommandAndKeybindingRule({id:vNo,weight:250,handler:xR(vNo,!0),when:SNo,primary:kze.primary,linux:kze.linux,mac:kze.mac});var bNo="workbench.action.quickOpenNavigatePreviousInViewPicker";xt.registerCommandAndKeybindingRule({id:bNo,weight:250,handler:xR(bNo,!1),when:SNo,primary:kze.primary|1024,linux:kze.linux,mac:{primary:kze.mac.primary|1024}});var aL=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,r,s,c,p,o,n,h,t,g);this.contextService=l;this.labelService=u;this._disposed=!1;this._register(this.contextService.onDidChangeWorkbenchState(()=>this.refreshTitle())),this._register(this.labelService.onDidChangeFormatters(()=>this.refreshTitle()))}static{this.ID="workbench.explorer.emptyView"}static{this.NAME=P(12292,"No Folder Opened")}shouldShowWelcome(){return!0}renderBody(e){super.renderBody(e),this._register(new wg(e,{onDrop:t=>{e.style.backgroundColor="",this.instantiationService.createInstance(uW,{allowWorkspaceOpen:!Ft||tC(this.contextService.getWorkspace())}).handleDrop(t,Me(e))},onDragEnter:()=>{let t=this.themeService.getColorTheme().getColor(iyt);e.style.backgroundColor=t?t.toString():""},onDragEnd:()=>{e.style.backgroundColor=""},onDragLeave:()=>{e.style.backgroundColor=""},onDragOver:t=>{t.dataTransfer&&(t.dataTransfer.dropEffect="copy")}})),this.refreshTitle()}refreshTitle(){this._disposed||(this.contextService.getWorkbenchState()===3?this.updateTitle(aL.NAME.value):this.updateTitle(this.title))}dispose(){this._disposed=!0,super.dispose()}};aL=I([m(1,Pe),m(2,ji),m(3,F),m(4,Le),m(5,Xe),m(6,Ae),m(7,B),m(8,nt),m(9,X),m(10,Je),m(11,ot)],aL);var $Ui=Oe("explorer-view-icon",L.files,d(11994,null)),zCn=Oe("open-editors-view-icon",L.book,d(12001,null)),bSe=class extends k{constructor(e,t){super();this.workspaceContextService=e;t.withProgress({location:1},()=>e.getCompleteWorkspace()).finally(()=>{this.registerViews(),this._register(e.onDidChangeWorkbenchState(()=>this.registerViews())),this._register(e.onDidChangeWorkspaceFolders(()=>this.registerViews()))})}static{this.ID="workbench.contrib.explorerViewletViews"}registerViews(){Wo("code/willRegisterExplorerViews");let e=use.getViews(SSe),t=[],o=[],n=this.createOpenEditorsViewDescriptor();e.some(u=>u.id===n.id)||t.push(n);let r=this.createExplorerViewDescriptor(),s=e.find(u=>u.id===r.id),l=this.createEmptyViewDescriptor(),c=e.find(u=>u.id===l.id);this.workspaceContextService.getWorkbenchState()===1||this.workspaceContextService.getWorkspace().folders.length===0?(s&&o.push(s),c||t.push(l)):(c&&o.push(c),s||t.push(r)),o.length&&use.deregisterViews(o,SSe),t.length&&use.registerViews(t,SSe),Wo("code/didRegisterExplorerViews")}createOpenEditorsViewDescriptor(){return{id:HC.ID,name:HC.NAME,ctorDescriptor:new Vt(HC),containerIcon:zCn,order:0,canToggleVisibility:!0,canMoveView:!0,collapsed:!1,hideByDefault:!0,focusCommand:{id:"workbench.files.action.focusOpenEditorsView",keybindings:{primary:Gi(2089,35)}}}}createEmptyViewDescriptor(){return{id:aL.ID,name:aL.NAME,containerIcon:$Ui,ctorDescriptor:new Vt(aL),order:1,canToggleVisibility:!0,focusCommand:{id:"workbench.explorer.fileView.focus"}}}createExplorerViewDescriptor(){return{id:pS,name:P(11995,"Folders"),containerIcon:$Ui,ctorDescriptor:new Vt(fV),order:1,canMoveView:!0,canToggleVisibility:!1,focusCommand:{id:"workbench.explorer.fileView.focus"}}}};bSe=I([m(0,Ae),m(1,Go)],bSe);var lut=class extends Qc{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(Dv,{mergeViewWithContainerWhenSingleView:!0},r,n,i,c,e,u,l,o,t,p,h),this.viewletVisibleContextKey=efo.bindTo(s),this._register(this.contextService.onDidChangeWorkspaceName(g=>this.updateTitleArea()))}create(i){super.create(i),i.classList.add("explorer-viewlet")}createView(i,e){return i.id===pS?this.instantiationService.createInstance(fV,{...e,delegate:{willOpenElement:t=>{if(!Wp(t))return;let o=this.getOpenEditorsView();if(o){let n=0;this.configurationService.getValue().workbench?.editor?.enablePreview&&(n=250),o.setStructuralRefreshDelay(n)}},didOpenElement:t=>{if(!Wp(t))return;this.getOpenEditorsView()?.setStructuralRefreshDelay(0)}}}):super.createView(i,e)}getExplorerView(){return this.getView(pS)}getOpenEditorsView(){return this.getView(HC.ID)}setVisible(i){this.viewletVisibleContextKey.set(i),super.setVisible(i)}focus(){let i=this.getView(pS);i&&this.panes.every(e=>!e.isExpanded())&&i.setExpanded(!0),i?.isExpanded()?i.focus():super.focus()}};lut=I([m(0,wi),m(1,_e),m(2,Ae),m(3,de),m(4,B),m(5,F),m(6,X),m(7,Pe),m(8,Xe),m(9,lt),m(10,ji),m(11,re)],lut);var KCn=oe.as(Kn.ViewContainersRegistry),SSe=KCn.registerViewContainer({id:Dv,title:P(11993,"Explorer"),ctorDescriptor:new Vt(lut),storageId:"workbench.explorer.views.state",icon:$Ui,alwaysUseContainerInfo:!0,hideIfEmpty:!0,order:0,openCommandActionDescriptor:{id:Dv,title:P(11993,"Explorer"),mnemonicTitle:d(11996,null),keybindings:{primary:3107},order:0}},0,{isDefault:!0}),jUi=d(12002,null),GCn=d(11992,null),qCn=d(12003,null),$Cn=`[${jUi}](command:${NMe.ID})`,jCn=`[${GCn}](command:${NMe.ID})`,QUi=`[${jUi}](command:${wW.ID})`,QCn=`[${jUi}](command:${Ste.ID})`,YCn=`[${qCn}](command:${yW.ID})`,use=oe.as(Kn.ViewsRegistry);use.registerViewWelcomeContent(aL.ID,{content:d(12000,null,$Cn),when:C.and(el.isEqualTo("workspace"),P0),group:"2_open",order:1});use.registerViewWelcomeContent(aL.ID,{content:d(11999,null,QCn,YCn),when:C.and(el.isEqualTo("workspace"),P0.toNegated()),group:"2_open",order:1});use.registerViewWelcomeContent(aL.ID,{content:d(12004,null,QUi),when:C.and(el.notEqualsTo("workspace"),Qb.notEqualsTo(""),Mu.toNegated()),group:"2_open",order:1});use.registerViewWelcomeContent(aL.ID,{content:d(11997,null,QUi,jCn),when:C.and(C.has("editorIsOpen"),C.or(C.and(el.notEqualsTo("workspace"),Qb.isEqualTo("")),C.and(el.notEqualsTo("workspace"),Mu))),group:"2_open",order:1});use.registerViewWelcomeContent(aL.ID,{content:d(11998,null,QUi),when:C.and(C.has("editorIsOpen")?.negate(),C.or(C.and(el.notEqualsTo("workspace"),Qb.isEqualTo("")),C.and(el.notEqualsTo("workspace"),Mu))),group:"2_open",order:1});var ISe=class extends k{constructor(e,t,o,n,r,s,l){super();this.editorService=e;this.textFileService=t;this.lifecycleService=o;this.hostService=n;this.codeEditorService=r;this.filesConfigurationService=s;this.workingCopyEditorService=l;this.ensureDirtyFilesAreOpenedWorker=this._register(new hA(e=>this.ensureDirtyTextFilesAreOpened(e),this.getDirtyTextFileTrackerDelay()));this.registerListeners()}static{this.ID="workbench.contrib.textFileEditorTracker"}registerListeners(){this._register(this.textFileService.files.onDidChangeDirty(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.textFileService.files.onDidSaveError(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.textFileService.untitled.onDidChangeDirty(e=>this.ensureDirtyFilesAreOpenedWorker.work(e.resource))),this._register(this.hostService.onDidChangeFocus(e=>e?this.reloadVisibleTextFileEditors():void 0)),this._register(this.lifecycleService.onDidShutdown(()=>this.dispose()))}getDirtyTextFileTrackerDelay(){return 800}ensureDirtyTextFilesAreOpened(e){this.doEnsureDirtyTextFilesAreOpened(jo(e.filter(t=>{if(!this.textFileService.isDirty(t))return!1;let o=this.textFileService.files.get(t);if(o?.hasState(2)||t.scheme!==Q.untitled&&!o?.hasState(5)&&this.filesConfigurationService.hasShortAutoSaveDelay(t)||this.editorService.isOpened({resource:t,typeId:t.scheme===Q.untitled?Jg.ID:khe,editorId:Da.id}))return!1;let n=o??this.textFileService.untitled.get(t);return!(n&&this.workingCopyEditorService.findEditor(n))}),t=>t.toString()))}doEnsureDirtyTextFilesAreOpened(e){e.length&&this.editorService.openEditors(e.map(t=>({resource:t,options:{inactive:!0,pinned:!0,preserveFocus:!0}})))}reloadVisibleTextFileEditors(){jo(ui(this.codeEditorService.listCodeEditors().map(e=>{let t=e.getModel()?.uri;if(!t)return;let o=this.textFileService.files.get(t);if(!(!o||o.isDirty()||!o.isResolved()))return o})),e=>e.resource.toString()).forEach(e=>this.textFileService.files.resolve(e.resource,{reload:{async:!0}}))}};ISe=I([m(0,ie),m(1,Uo),m(2,to),m(3,ti),m(4,Qt),m(5,fr),m(6,If)],ISe);var J9=class extends nP{constructor(e,t,o,n,r){super(J9.ID,e,{openInternal:(s,l)=>this.openInternal(s,l)},t,o,r);this.editorResolverService=n}static{this.ID=nBt}async openInternal(e,t){if(e instanceof dy&&this.group.activeEditor){let o=this.group.activeEditor,n=o?.toUntyped();if(!n)return;let r=await this.editorResolverService.resolveEditor({...n,options:{...t,override:0}},this.group);if(r===2)r=void 0;else if(r===1)return;if(D0(r))for(let s of r.editor instanceof Ba?[r.editor.original,r.editor.modified]:[r.editor])s instanceof dy&&(s.setForceOpenAsText(),s.setPreferredLanguageId(nPe));await this.group.replaceEditors([{editor:o,replacement:r?.editor??e,options:{...r?.options??t}}])}}getTitle(){return this.input?this.input.getName():d(11963,null)}};J9=I([m(1,_e),m(2,Pe),m(3,il),m(4,de)],J9);var Eze=new pK,pse=class{constructor(i,e,t,o,n,r,s,l,c,u){this.fileService=i;this.configurationService=e;this.contextService=t;this.clipboardService=o;this.editorService=n;this.uriIdentityService=r;this.bulkEditService=s;this.progressService=l;this.filesConfigurationService=u;this.disposables=new O;this.fileChangeEvents=[];this.config=this.configurationService.getValue("explorer"),this.model=new wGt(this.contextService,this.uriIdentityService,this.fileService,this.configurationService,this.filesConfigurationService),this.disposables.add(this.model),this.disposables.add(this.fileService.onDidRunOperation(p=>this.onDidRunOperation(p))),this.onFileChangesScheduler=this.disposables.add(new Dt(async()=>{let p=this.fileChangeEvents;this.fileChangeEvents=[];let h=[2];this.config.sortOrder==="modified"&&h.push(0);let g=!1;this.roots.forEach(f=>{this.view&&!g&&(g=INo(f,this.view,p,h))}),p.forEach(f=>{if(!g)for(let v of f.rawAdded){let b=this.model.findClosest(ai(v));if(b&&!b.getChild(Be(v))){g=!0;break}}}),g&&await this.refresh(!1)},pse.EXPLORER_FILE_CHANGES_REACT_DELAY)),this.disposables.add(this.fileService.onDidFilesChange(p=>{this.fileChangeEvents.push(p),!this.editable&&(this.onFileChangesScheduler.isScheduled()||this.onFileChangesScheduler.schedule())})),this.disposables.add(this.configurationService.onDidChangeConfiguration(p=>this.onConfigurationUpdated(p))),this.disposables.add(U.any(this.fileService.onDidChangeFileSystemProviderRegistrations,this.fileService.onDidChangeFileSystemProviderCapabilities)(async p=>{let h=!1;this.model.roots.forEach(g=>{g.resource.scheme===p.scheme&&(h=!0,g.forgetChildren())}),h&&this.view&&await this.view.setTreeInput()})),this.disposables.add(this.model.onDidChangeRoots(()=>{this.view?.setTreeInput()})),this.disposables.add(c.onDidChangeFocus(p=>{p&&this.refresh(!1)})),this.revealExcludeMatcher=new qI(p=>JCn(e.getValue({resource:p})),p=>p.affectsConfiguration("explorer.autoRevealExclude"),t,e),this.disposables.add(this.revealExcludeMatcher)}static{this.EXPLORER_FILE_CHANGES_REACT_DELAY=500}get roots(){return this.model.roots}get sortOrderConfiguration(){return{sortOrder:this.config.sortOrder,lexicographicOptions:this.config.sortOrderLexicographicOptions,reverse:this.config.sortOrderReverse}}registerView(i){this.view=i}getContext(i,e=!1){if(!this.view)return[];let t=new Set(this.view.getContext(i));return t.forEach(o=>{try{if(i&&!e&&this.view?.isItemCollapsed(o)&&o.nestedChildren)for(let n of o.nestedChildren)t.add(n)}catch{return}}),[...t]}async applyBulkEdit(i,e){let t=new qe,o=e.progressLocation??10,n;o===10?n={location:o,title:e.progressLabel,cancellable:i.length>1}:n={location:o,title:e.progressLabel,cancellable:i.length>1,delay:500};let r=this.progressService.withProgress(n,async s=>{await this.bulkEditService.apply(i,{undoRedoSource:Eze,label:e.undoLabel,code:"undoredo.explorerOperation",progress:s,token:t.token,confirmBeforeUndo:e.confirmBeforeUndo})},()=>t.cancel());await this.progressService.withProgress({location:1,delay:500},()=>r),t.dispose()}hasViewFocus(){return!!this.view&&this.view.hasFocus()}findClosest(i){return this.model.findClosest(i)}findClosestRoot(i){let e=this.model.roots.filter(t=>this.uriIdentityService.extUri.isEqualOrParent(i,t.resource)).sort((t,o)=>o.resource.path.length-t.resource.path.length);return e.length?e[0]:null}async setEditable(i,e){if(!this.view)return;e?this.editable={stat:i,data:e}:this.editable=void 0;let t=this.isEditable(i);try{await this.view.setEditable(i,t)}catch{return}!this.editable&&this.fileChangeEvents.length&&!this.onFileChangesScheduler.isScheduled()&&this.onFileChangesScheduler.schedule()}async setToCopy(i,e){let t=this.cutItems;this.cutItems=e?i:void 0,await this.clipboardService.writeResources(i.map(o=>o.resource)),this.view?.itemsCopied(i,e,t)}isCut(i){return!!this.cutItems&&this.cutItems.some(e=>this.uriIdentityService.extUri.isEqual(e.resource,i.resource))}getEditable(){return this.editable}getEditableData(i){return this.editable&&this.editable.stat===i?this.editable.data:void 0}isEditable(i){return!!this.editable&&(this.editable.stat===i||!i)}async select(i,e){if(!this.view)return;let t=e==="force",o=this.findClosest(i);if(o)return this.shouldAutoRevealItem(o,t)?(await this.view.selectResource(o.resource,e),Promise.resolve(void 0)):void 0;let n={resolveTo:[i],resolveMetadata:this.config.sortOrder==="modified"},r=this.findClosestRoot(i);if(r)try{let s=await this.fileService.resolve(r.resource,n),l=Tf.create(this.fileService,this.configurationService,this.filesConfigurationService,s,void 0,n.resolveTo);Tf.mergeLocalWithDisk(l,r);let c=r.find(i);if(await this.view.refresh(!0,r),c&&!this.shouldAutoRevealItem(c,t))return;await this.view.selectResource(c?c.resource:void 0,e)}catch(s){r.error=s,await this.view.refresh(!1,r)}}async refresh(i=!0){if(!this.view?.hasPhantomElements()&&(this.model.roots.forEach(e=>e.forgetChildren()),this.view)){await this.view.refresh(!0);let e=this.editorService.activeEditor?.resource,t=this.configurationService.getValue().explorer.autoReveal;i&&e&&t&&this.select(e,t)}}async onDidRunOperation(i){let e=this.config.fileNesting.enabled;if(i.isOperation(0)||i.isOperation(3)){let t=i.target,o=ai(t.resource),n=this.model.findAll(o);n.length&&await Promise.all(n.map(async r=>{let s=this.config.sortOrder==="modified";if(!r.isDirectoryResolved){let c=await this.fileService.resolve(r.resource,{resolveMetadata:s});if(c){let u=Tf.create(this.fileService,this.configurationService,this.filesConfigurationService,c,r.parent);Tf.mergeLocalWithDisk(u,r)}}let l=Tf.create(this.fileService,this.configurationService,this.filesConfigurationService,t,r.parent);r.removeChild(l),r.addChild(l),await this.view?.refresh(e,r)}))}else if(i.isOperation(2)){let t=i.resource,o=i.target,n=ai(t),r=ai(o.resource),s=this.model.findAll(t);if(s.every(c=>!c.nestedParent)&&this.uriIdentityService.extUri.isEqual(n,r))await Promise.all(s.map(async c=>{c.rename(o),await this.view?.refresh(e,c.parent)}));else{let c=this.model.findAll(r);c.length&&s.length&&await Promise.all(s.map(async(u,p)=>{let h=u.parent,g=u.nestedParent;u.move(c[p]),g&&await this.view?.refresh(!1,g),await this.view?.refresh(!1,h),await this.view?.refresh(e,c[p])}))}}else if(i.isOperation(1)){let t=this.model.findAll(i.resource);await Promise.all(t.map(async o=>{if(o.parent){let n=o.parent;n.removeChild(o),this.view?.focusNext();let r=o.nestedParent;r&&(r.removeChild(o),await this.view?.refresh(!1,r)),await this.view?.refresh(e,n),this.view?.getFocus().length===0&&this.view?.focusLast()}}))}}shouldAutoRevealItem(i,e){if(i===void 0||e)return!0;if(this.revealExcludeMatcher.matches(i.resource,n=>!!i.parent?.getChild(n)))return!1;let t=i.root,o=i.parent;for(;o!==t;){if(o===void 0)return!0;if(this.revealExcludeMatcher.matches(o.resource))return!1;o=o.parent}return!0}async onConfigurationUpdated(i){if(!i.affectsConfiguration("explorer"))return;let e=!1;i.affectsConfiguration("explorer.fileNesting")&&(e=!0);let t=this.configurationService.getValue(),o=t?.explorer?.sortOrder||"default";this.config.sortOrder!==o&&(e=this.config.sortOrder!==void 0);let n=t?.explorer?.sortOrderLexicographicOptions||"default";this.config.sortOrderLexicographicOptions!==n&&(e=e||this.config.sortOrderLexicographicOptions!==void 0);let r=t?.explorer?.sortOrderReverse||!1;this.config.sortOrderReverse!==r&&(e=e||this.config.sortOrderReverse!==void 0),this.config=t.explorer,e&&await this.refresh()}dispose(){this.disposables.dispose()}};pse=I([m(0,ge),m(1,B),m(2,Ae),m(3,Bi),m(4,ie),m(5,gt),m(6,Ka),m(7,Go),m(8,ti),m(9,fr)],pse);function INo(a,i,e,t){for(let[o,n]of a.children)if(i.isItemVisible(n)&&(e.some(r=>r.contains(n.resource,...t))||n.isDirectory&&n.isDirectoryResolved&&INo(n,i,e,t)))return!0;return!1}function JCn(a){let i=a?.explorer?.autoRevealExclude;return i||{}}var ySe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.fileService=e;this.configurationService=t;this.contextService=o;this.notificationService=n;this.openerService=r;this.uriIdentityService=s;this.hostService=l;this.telemetryService=c;this.watchedWorkspaces=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.registerListeners(),this.refresh()}static{this.ID="workbench.contrib.workspaceWatcher"}registerListeners(){this._register(this.contextService.onDidChangeWorkspaceFolders(e=>this.onDidChangeWorkspaceFolders(e))),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.onDidChangeWorkbenchState())),this._register(this.configurationService.onDidChangeConfiguration(e=>this.onDidChangeConfiguration(e))),this._register(this.fileService.onDidWatchError(e=>this.onDidWatchError(e)))}onDidChangeWorkspaceFolders(e){for(let t of e.removed)this.unwatchWorkspace(t);for(let t of e.added)this.watchWorkspace(t)}onDidChangeWorkbenchState(){this.refresh()}onDidChangeConfiguration(e){(e.affectsConfiguration("files.watcherExclude")||e.affectsConfiguration("files.watcherInclude"))&&this.refresh()}onDidWatchError(e){let t=e.toString(),o;t.indexOf("ENOSPC")>=0?(o="ENOSPC",this.notificationService.prompt(ft.Warning,d(12327,null),[{label:d(12329,null),run:()=>this.openerService.open(A.parse("https://go.microsoft.com/fwlink/?linkid=867693"))}],{sticky:!0,neverShowAgain:{id:"ignoreEnospcError",isSecondary:!0,scope:0}})):t.indexOf("EUNKNOWN")>=0?(o="EUNKNOWN",this.notificationService.prompt(ft.Warning,d(12328,null),[{label:d(12330,null),run:()=>this.hostService.reload()}],{sticky:!0,priority:2})):t.indexOf("ETERM")>=0&&(o="ETERM"),o&&this.telemetryService.publicLog2("fileWatcherError",{reason:o})}watchWorkspace(e){let t=[],o=this.configurationService.getValue({resource:e.uri});if(o.files?.watcherExclude)for(let s in o.files.watcherExclude)s&&o.files.watcherExclude[s]===!0&&t.push(s);let n=new dt(s=>this.uriIdentityService.extUri.getComparisonKey(s));if(n.set(e.uri,e.uri),o.files?.watcherInclude){for(let s of o.files.watcherInclude)if(s)if(Jl(s)){let l=A.file(s).with({scheme:e.uri.scheme});this.uriIdentityService.extUri.isEqualOrParent(l,e.uri)&&n.set(l,l)}else{let l=e.toResource(s);n.set(l,l)}}let r=new O;for(let[,s]of n)r.add(this.fileService.watch(s,{recursive:!0,excludes:t}));this.watchedWorkspaces.set(e.uri,r)}unwatchWorkspace(e){this.watchedWorkspaces.has(e.uri)&&(je(this.watchedWorkspaces.get(e.uri)),this.watchedWorkspaces.delete(e.uri))}refresh(){this.unwatchWorkspaces();for(let e of this.contextService.getWorkspace().folders)this.watchWorkspace(e)}unwatchWorkspaces(){for(let[,e]of this.watchedWorkspaces)e.dispose();this.watchedWorkspaces.clear()}dispose(){super.dispose(),this.unwatchWorkspaces()}};ySe=I([m(0,ge),m(1,B),m(2,Ae),m(3,Ne),m(4,Je),m(5,gt),m(6,ti),m(7,_e)],ySe);var wSe=class extends k{constructor(e,t,o){super();this.activityService=e;this.workingCopyService=t;this.filesConfigurationService=o;this.badgeHandle=this._register(new ue);this.lastKnownDirtyCount=0;this.updateActivityBadge(),this.registerListeners()}static{this.ID="workbench.contrib.dirtyFilesIndicator"}registerListeners(){this._register(this.workingCopyService.onDidChangeDirty(e=>this.onWorkingCopyDidChangeDirty(e)))}onWorkingCopyDidChangeDirty(e){let t=e.isDirty();t&&!(e.capabilities&2)&&this.filesConfigurationService.hasShortAutoSaveDelay(e.resource)||(t||this.lastKnownDirtyCount>0)&&this.updateActivityBadge()}updateActivityBadge(){let e=this.lastKnownDirtyCount=this.workingCopyService.dirtyCount;e>0?this.badgeHandle.value=this.activityService.showViewContainerActivity(Dv,{badge:new eu(e,t=>t===1?d(12331,null):d(12332,null,e))}):this.badgeHandle.clear()}};wSe=I([m(0,Al),m(1,$a),m(2,fr)],wSe);var f6t=class{canSerialize(i){return!0}serialize(i){let e=i,t=e.resource,o=e.preferredResource,n={resourceJSON:t.toJSON(),preferredResourceJSON:ze(t,o)?void 0:o,name:e.getPreferredName(),description:e.getPreferredDescription(),encoding:e.getEncoding(),modeId:e.getPreferredLanguageId()};return JSON.stringify(n)}deserialize(i,e){return i.invokeFunction(t=>{let o=JSON.parse(e),n=A.revive(o.resourceJSON),r=A.revive(o.preferredResourceJSON),s=o.name,l=o.description,c=o.encoding,u=o.modeId,p=t.get(TE).createTextEditor({resource:n,label:s,description:l,encoding:c,languageId:u,forceFile:!0});return r&&p.setPreferredResource(r),p})}},CSe=class extends k{constructor(e,t,o){super();this.textEditorService=t;this.fileService=o;this._register(e.registerHandler(this))}static{this.ID="workbench.contrib.fileEditorWorkingCopyEditorHandler"}handles(e){return e.typeId===vN&&this.fileService.canHandleResource(e.resource)}handlesSync(e){return e.typeId===vN&&this.fileService.hasProvider(e.resource)}isOpen(e,t){return this.handlesSync(e)?ze(e.resource,t.resource):!1}createEditor(e){return this.textEditorService.createTextEditor({resource:e.resource,forceFile:!0})}};CSe=I([m(0,If),m(1,TE),m(2,ge)],CSe);var Z9=class extends Lte{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super(Z9.ID,e,t,r,l,c,p,u,h,o);this.paneCompositeService=n;this.contextService=s;this.textFileService=g;this.explorerService=f;this.uriIdentityService=v;this.pathService=b;this.configurationService=S;this.preferencesService=y;this.hostService=w;this.filesConfigurationService=x;this._register(this.fileService.onDidFilesChange(E=>this.onDidFilesChange(E))),this._register(this.fileService.onDidRunOperation(E=>this.onDidRunOperation(E)))}static{this.ID=EW}onDidFilesChange(e){for(let t of e.rawDeleted)this.clearEditorViewState(t)}onDidRunOperation(e){e.operation===2&&e.target&&this.moveEditorViewState(e.resource,e.target.resource,this.uriIdentityService.extUri)}getTitle(){return this.input?this.input.getName():d(11970,null)}get input(){return this._input}async setInput(e,t,o,n){Wo("code/willSetInputToTextFileEditor"),await super.setInput(e,t,o,n);try{let r=await e.resolve(t);if(n.isCancellationRequested)return;if(r instanceof $G)return this.openAsBinary(e,t);let s=r,l=Ti(this.editorControl);if(l.setModel(s.textEditorModel),!f3(t?.viewState)){let c=this.loadEditorViewState(e,o);c&&(t?.selection&&(c.cursorState=[]),l.restoreViewState(c))}t&&x_(t,l,1),l.updateOptions(this.getReadonlyConfiguration(s.isReadonly())),l.handleInitialized&&l.handleInitialized()}catch(r){await this.handleSetInputError(r,e,t)}Wo("code/didSetInputToTextFileEditor")}async handleSetInputError(e,t,o){if(e.textFileOperationResult===0)return this.openAsBinary(t,o);if(e.fileOperationResult===0){let n=[];throw n.push(li({id:"workbench.files.action.openFolder",label:d(11968,null),run:async()=>this.hostService.openWindow([{folderUri:t.resource}],{forceNewWindow:!0})})),this.contextService.isInsideWorkspace(t.preferredResource)&&n.push(li({id:"workbench.files.action.reveal",label:d(11969,null),run:async()=>(await this.paneCompositeService.openPaneComposite(Dv,0,!0),this.explorerService.select(t.preferredResource,!0))})),b3(d(11965,null),n,{forceMessage:!0})}if(e.fileOperationResult===7){let n;throw e instanceof NF?n=d(11967,null,Ml.formatSize(e.size)):n=d(11966,null),A_e(this.group,t,o,n,this.preferencesService)}throw e.fileOperationResult===1&&!this.filesConfigurationService.isReadonly(t.preferredResource)&&await this.pathService.hasValidBasename(t.preferredResource)?b3(new ua(d(11971,null),1),[li({id:"workbench.files.action.createMissingFile",label:d(11964,null),run:async()=>(await this.textFileService.create([{resource:t.preferredResource}]),this.editorService.openEditor({resource:t.preferredResource,options:{pinned:!0}}))})],{allowDialog:!0}):e}openAsBinary(e,t){let o=this.configurationService.getValue("workbench.editor.defaultBinaryEditor"),n={...t,activation:3};o&&o!==""&&o!==Da.id?this.doOpenAsBinaryInDifferentEditor(this.group,o,e,n):this.doOpenAsBinaryInSameEditor(this.group,o,e,n)}doOpenAsBinaryInDifferentEditor(e,t,o,n){this.editorService.replaceEditors([{editor:o,replacement:{resource:o.resource,options:{...n,override:t}}}],e)}doOpenAsBinaryInSameEditor(e,t,o,n){t===Da.id?(o.setForceOpenAsText(),o.setPreferredLanguageId(nPe),n={...n,forceReload:!0}):o.setForceOpenAsBinary(),e.openEditor(o,n)}clearInput(){super.clearInput(),this.editorControl?.setModel(null)}createEditorControl(e,t){Wo("code/willCreateTextFileEditorControl"),super.createEditorControl(e,t),Wo("code/didCreateTextFileEditorControl")}tracksEditorViewState(e){return e instanceof dy}tracksDisposedEditorViewState(){return!0}};Z9=I([m(1,_e),m(2,ge),m(3,Es),m(4,F),m(5,Ae),m(6,de),m(7,Gn),m(8,ie),m(9,Pe),m(10,kt),m(11,Uo),m(12,Qa),m(13,gt),m(14,Pn),m(15,B),m(16,Qo),m(17,ti),m(18,fr)],Z9);var Tze=class{static{this.ID="workbench.contrib.fileUriLabel"}constructor(i){i.registerFormatter({scheme:Q.file,formatting:{label:"${authority}${path}",separator:Cu,tildify:!ii,normalizeDriveLetter:ii,authorityPrefix:Cu+Cu,workspaceSuffix:""}})}};Tze=I([m(0,nt)],Tze);Ce(Qa,pse,1);oe.as(en.EditorPane).registerEditorPane(os.create(Z9,Z9.ID,d(12284,null)),[new Vt(dy)]);oe.as(en.EditorPane).registerEditorPane(os.create(J9,J9.ID,d(12194,null)),[new Vt(dy)]);oe.as(en.EditorFactory).registerFileEditorFactory({typeId:khe,createFileEditor:(a,i,e,t,o,n,r,s)=>s.createInstance(dy,a,i,e,t,o,n,r),isFileEditor:a=>a instanceof dy});oe.as(en.EditorFactory).registerEditorSerializer(khe,f6t);bt(CSe.ID,CSe,vt.BlockRestore);bt(bSe.ID,bSe,vt.BlockStartup);bt(ISe.ID,ISe,vt.BlockStartup);bt(Ofe.ID,Ofe,vt.BlockStartup);bt(Tze.ID,Tze,vt.BlockStartup);bt(ySe.ID,ySe,vt.AfterRestored);bt(wSe.ID,wSe,vt.BlockStartup);var YUi=oe.as($t.Configuration),ZCn=Qr?{type:"string",scope:1,enum:[PI.OFF,PI.ON_EXIT,PI.ON_EXIT_AND_WINDOW_CLOSE],default:PI.ON_EXIT,markdownEnumDescriptions:[d(12255,null),d(12256,null),d(12257,null)],markdownDescription:d(12254,null,PI.ON_EXIT,PI.ON_EXIT_AND_WINDOW_CLOSE)}:{type:"string",scope:1,enum:[PI.OFF,PI.ON_EXIT_AND_WINDOW_CLOSE],default:PI.ON_EXIT_AND_WINDOW_CLOSE,markdownEnumDescriptions:[d(12255,null),d(12258,null)],markdownDescription:d(12254,null,PI.ON_EXIT,PI.ON_EXIT_AND_WINDOW_CLOSE)};YUi.registerConfiguration({id:"files",order:9,title:d(12248,null),type:"object",properties:{[zyt]:{type:"object",markdownDescription:d(12223,null),default:{"**/.git":!0,"**/.svn":!0,"**/.hg":!0,"**/.DS_Store":!0,"**/Thumbs.db":!0,...Ft?{"**/*.crswap":!0}:void 0},scope:5,additionalProperties:{anyOf:[{type:"boolean",enum:[!0,!1],enumDescriptions:[d(12288,null),d(12232,null)],description:d(12242,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",markdownDescription:d(12243,null)}}}]}},[F5]:{type:"object",markdownDescription:d(12182,null),additionalProperties:{type:"string"}},"files.encoding":{type:"string",enum:Object.keys(kC),default:"utf8",description:d(12217,null),scope:6,enumDescriptions:Object.keys(kC).map(a=>kC[a].labelLong),enumItemLabels:Object.keys(kC).map(a=>kC[a].labelLong)},"files.autoGuessEncoding":{type:"boolean",default:!1,markdownDescription:d(12183,null,"`#files.encoding#`"),scope:6},"files.candidateGuessEncodings":{type:"array",items:{type:"string",enum:Object.keys(nJe),enumDescriptions:Object.keys(nJe).map(a=>nJe[a].labelLong)},default:[],markdownDescription:d(12195,null,"`#files.encoding#`"),scope:6},"files.eol":{type:"string",enum:[`
`,`\r
`,"auto"],enumDescriptions:[d(12221,null),d(12220,null),d(12219,null)],default:"auto",description:d(12218,null),scope:6},"files.enableTrash":{type:"boolean",default:!0,description:d(12289,null)},"files.trimTrailingWhitespace":{type:"boolean",default:!1,description:d(12286,null),scope:6},"files.trimTrailingWhitespaceInRegexAndStrings":{type:"boolean",default:!0,description:d(12287,null),scope:6},"files.insertFinalNewline":{type:"boolean",default:!1,description:d(12259,null),scope:6},"files.trimFinalNewlines":{type:"boolean",default:!1,description:d(12285,null),scope:6},"files.autoSave":{type:"string",enum:[Qv.OFF,Qv.AFTER_DELAY,Qv.ON_FOCUS_CHANGE,Qv.ON_WINDOW_CHANGE],markdownEnumDescriptions:[d(12239,null),d(12238,null),d(12240,null),d(12241,null)],default:Ft?Qv.AFTER_DELAY:Qv.OFF,markdownDescription:d(12190,null,Qv.OFF,Qv.AFTER_DELAY,Qv.ON_FOCUS_CHANGE,Qv.ON_WINDOW_CHANGE,Qv.AFTER_DELAY),scope:6,agentsWindow:{default:"afterDelay"}},"files.autoSaveDelay":{type:"number",default:1e3,minimum:0,markdownDescription:d(12191,null,Qv.AFTER_DELAY),scope:6},"files.autoSaveWorkspaceFilesOnly":{type:"boolean",default:!1,markdownDescription:d(12193,null,"`#files.autoSave#`"),scope:6},"files.autoSaveWhenNoErrors":{type:"boolean",default:!1,markdownDescription:d(12192,null,"`#files.autoSave#`"),scope:6},"files.watcherExclude":{type:"object",patternProperties:{".*":{type:"boolean"}},default:{".git/objects/**":!0,".git/subtree-cache/**":!0,".hg/store/**":!0,"*/.git/objects/**":!0,"*/.git/subtree-cache/**":!0,"*/.hg/store/**":!0},markdownDescription:d(12290,null),scope:5},"files.watcherInclude":{type:"array",items:{type:"string"},default:[],description:d(12291,null),scope:5},"files.hotExit":ZCn,"files.defaultLanguage":{type:"string",markdownDescription:d(12209,null)},[Kyt]:{type:"object",patternProperties:{".*":{type:"boolean"}},default:{},markdownDescription:d(12251,null),scope:5},[Gyt]:{type:"object",patternProperties:{".*":{type:"boolean"}},default:{},markdownDescription:d(12249,null),scope:5},[yYi]:{type:"boolean",markdownDescription:d(12250,null),default:!1},"files.restoreUndoStack":{type:"boolean",description:d(12245,null),default:!0},"files.saveConflictResolution":{type:"string",enum:["askUser","overwriteFileOnDisk"],enumDescriptions:[d(12181,null),d(12265,null)],description:d(12246,null),default:"askUser",scope:6},"files.dialog.defaultPath":{type:"string",pattern:"^((\\/|\\\\\\\\|[a-zA-Z]:\\\\).*)?$",patternErrorMessage:d(12210,null),description:d(12233,null),scope:2},"files.simpleDialog.enable":{type:"boolean",description:d(12247,null),default:!1},"files.participants.timeout":{type:"number",default:6e4,markdownDescription:d(12244,null)}}});YUi.registerConfiguration({...wx,properties:{"editor.formatOnSave":{type:"boolean",markdownDescription:d(12252,null,"`#files.autoSave#`"),scope:6},"editor.formatOnSaveMode":{type:"string",default:"file",enum:["file","modifications","modificationsIfAvailable"],enumDescriptions:[d(12222,null),d(12260,null),d(12261,null)],markdownDescription:d(12253,null),scope:6}}});YUi.registerConfiguration({id:"explorer",order:10,title:d(12231,null),type:"object",properties:{"explorer.openEditors.visible":{type:"number",description:d(12263,null),default:9,minimum:1},"explorer.openEditors.minVisible":{type:"number",description:d(12264,null),default:0,minimum:0},"explorer.openEditors.sortOrder":{type:"string",enum:["editorOrder","alphabetical","fullPath"],description:d(12262,null),enumDescriptions:[d(12271,null),d(12269,null),d(12274,null)],default:"editorOrder"},"explorer.autoReveal":{type:["boolean","string"],enum:[!0,!1,"focusNoScroll"],default:!0,enumDescriptions:[d(12188,null),d(12187,null),d(12186,null)],description:d(12185,null)},"explorer.autoRevealExclude":{type:"object",markdownDescription:d(12189,null),default:{"**/node_modules":!0,"**/bower_components":!0},additionalProperties:{anyOf:[{type:"boolean",description:d(12226,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",description:d(12227,null,"$(basename)")}}}]}},"explorer.enableDragAndDrop":{type:"boolean",description:d(12212,null),default:!0},"explorer.confirmDragAndDrop":{type:"boolean",description:d(12198,null),default:!0},"explorer.confirmPasteNative":{type:"boolean",description:d(12199,null),default:!0},"explorer.confirmDelete":{type:"boolean",description:d(12197,null),default:!0},"explorer.enableUndo":{type:"boolean",description:d(12213,null),default:!0},"explorer.confirmUndo":{type:"string",enum:["verbose","default","light"],description:d(12200,null),default:"default",enumDescriptions:[d(12216,null),d(12214,null),d(12215,null)]},"explorer.expandSingleFolderWorkspaces":{type:"boolean",description:d(12225,null),default:!0},"explorer.sortOrder":{type:"string",enum:["default","mixed","filesFirst","type","modified","foldersNestsFiles"],default:"default",enumDescriptions:[d(12270,null),d(12275,null),d(12272,null),d(12277,null),d(12276,null),d(12273,null)],markdownDescription:d(12268,null)},"explorer.sortOrderLexicographicOptions":{type:"string",enum:["default","upper","lower","unicode"],default:"default",enumDescriptions:[d(12279,null),d(12282,null),d(12280,null),d(12281,null)],description:d(12278,null)},"explorer.sortOrderReverse":{type:"boolean",description:d(12283,null),default:!1},"explorer.decorations.colors":{type:"boolean",description:d(12229,null),default:!0},"explorer.decorations.badges":{type:"boolean",description:d(12228,null),default:!0},"explorer.incrementalNaming":{type:"string",enum:["simple","smart","disabled"],enumDescriptions:[d(12266,null),d(12267,null),d(12211,null)],description:d(12230,null),default:"simple"},"explorer.autoOpenDroppedFile":{type:"boolean",description:d(12184,null),default:!0},"explorer.compactFolders":{type:"boolean",description:d(12196,null),default:!0},"explorer.copyRelativePathSeparator":{type:"string",enum:["/","\\","auto"],enumDescriptions:[d(12208,null),d(12207,null),d(12206,null)],description:d(12205,null),default:"auto"},"explorer.copyPathSeparator":{type:"string",enum:["/","\\","auto"],enumDescriptions:[d(12204,null),d(12203,null),d(12202,null)],description:d(12201,null),default:"auto"},"explorer.excludeGitIgnore":{type:"boolean",markdownDescription:d(12224,null,"`#files.exclude#`"),default:!1,scope:5},"explorer.fileNesting.enabled":{type:"boolean",scope:5,markdownDescription:d(12235,null),default:!1},"explorer.fileNesting.expand":{type:"boolean",markdownDescription:d(12236,null,"`#explorer.fileNesting.enabled#`"),default:!0},"explorer.fileNesting.patterns":{type:"object",scope:5,markdownDescription:d(12237,null,"`#explorer.fileNesting.enabled#`"),patternProperties:{"^[^*]*\\*?[^*]*$":{markdownDescription:d(12234,null),type:"string",pattern:"^([^,*]*\\*?[^,*]*)(, ?[^,*]*\\*?[^,*]*)*$"}},additionalProperties:!1,default:{"*.ts":"${capture}.js","*.js":"${capture}.js.map, ${capture}.min.js, ${capture}.d.ts","*.jsx":"${capture}.js","*.tsx":"${capture}.ts","tsconfig.json":"tsconfig.*.json","package.json":"package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb, bun.lock"}}}});pD.addImplementation(110,"explorer",a=>{let i=a.get(wl),e=a.get(Qa),o=a.get(B).getValue().explorer.enableUndo;return e.hasViewFocus()&&i.canUndo(Eze)&&o?(i.undo(Eze),!0):!1});mD.addImplementation(110,"explorer",a=>{let i=a.get(wl),e=a.get(Qa),o=a.get(B).getValue().explorer.enableUndo;return e.hasViewFocus()&&i.canRedo(Eze)&&o?(i.redo(Eze),!0):!1});CA.registerLanguage({id:nPe,aliases:["Binary"],mimetypes:["text/x-code-binary"]});var ESe=class{constructor(){this.uris=[]}async perform(){return this}toString(){return"(noop)"}},v6t=class{constructor(i,e,t){this.newUri=i;this.oldUri=e;this.options=t;this.type="rename"}},xSe=class{constructor(i,e,t,o){this._edits=i;this._undoRedoInfo=e;this._workingCopyFileService=t;this._fileService=o}get uris(){return this._edits.flatMap(i=>[i.newUri,i.oldUri])}async perform(i){let e=[],t=[];for(let o of this._edits)o.options.overwrite===void 0&&o.options.ignoreIfExists&&await this._fileService.exists(o.newUri)||(e.push({file:{source:o.oldUri,target:o.newUri},overwrite:o.options.overwrite}),t.push(new v6t(o.oldUri,o.newUri,o.options)));return e.length===0?new ESe:(await this._workingCopyFileService.move(e,i,this._undoRedoInfo),new xSe(t,{isUndoing:!0},this._workingCopyFileService,this._fileService))}toString(){return`(rename ${this._edits.map(i=>`${i.oldUri} to ${i.newUri}`).join(", ")})`}};xSe=I([m(2,gm),m(3,ge)],xSe);var XUi=class{constructor(i,e,t){this.newUri=i;this.oldUri=e;this.options=t;this.type="copy"}},cut=class{constructor(i,e,t,o,n){this._edits=i;this._undoRedoInfo=e;this._workingCopyFileService=t;this._fileService=o;this._instaService=n}get uris(){return this._edits.flatMap(i=>[i.newUri,i.oldUri])}async perform(i){let e=[];for(let n of this._edits)n.options.overwrite===void 0&&n.options.ignoreIfExists&&await this._fileService.exists(n.newUri)||e.push({file:{source:n.oldUri,target:n.newUri},overwrite:n.options.overwrite});if(e.length===0)return new ESe;let t=await this._workingCopyFileService.copy(e,i,this._undoRedoInfo),o=[];for(let n=0;n<t.length;n++){let r=t[n],s=this._edits[n];o.push(new dut(r.resource,{recursive:!0,folder:this._edits[n].options.folder||r.isDirectory,...s.options},!1))}return this._instaService.createInstance(kSe,o,{isUndoing:!0})}toString(){return`(copy ${this._edits.map(i=>`${i.oldUri} to ${i.newUri}`).join(", ")})`}};cut=I([m(2,gm),m(3,ge),m(4,F)],cut);var b6t=class{constructor(i,e,t){this.newUri=i;this.options=e;this.contents=t;this.type="create"}},_ze=class{constructor(i,e,t,o,n,r){this._edits=i;this._undoRedoInfo=e;this._fileService=t;this._workingCopyFileService=o;this._instaService=n;this._textFileService=r}get uris(){return this._edits.map(i=>i.newUri)}async perform(i){let e=[],t=[],o=[];for(let n of this._edits)if(n.newUri.scheme!==Q.untitled&&!(n.options.overwrite===void 0&&n.options.ignoreIfExists&&await this._fileService.exists(n.newUri))){if(n.options.folder)e.push({resource:n.newUri});else{let r=typeof n.contents<"u"?n.contents:await this._textFileService.getEncodedReadable(n.newUri);t.push({resource:n.newUri,contents:r,overwrite:n.options.overwrite})}o.push(new dut(n.newUri,n.options,!n.options.folder&&!n.contents))}return e.length===0&&t.length===0?new ESe:(await this._workingCopyFileService.createFolder(e,i,this._undoRedoInfo),await this._workingCopyFileService.create(t,i,this._undoRedoInfo),this._instaService.createInstance(kSe,o,{isUndoing:!0}))}toString(){return`(create ${this._edits.map(i=>i.options.folder?`folder ${i.newUri}`:`file ${i.newUri} with ${i.contents?.byteLength||0} bytes`).join(", ")})`}};_ze=I([m(2,ge),m(3,gm),m(4,F),m(5,Uo)],_ze);var dut=class{constructor(i,e,t){this.oldUri=i;this.options=e;this.undoesCreate=t;this.type="delete"}},kSe=class{constructor(i,e,t,o,n,r,s){this._edits=i;this._undoRedoInfo=e;this._workingCopyFileService=t;this._fileService=o;this._configurationService=n;this._instaService=r;this._logService=s}get uris(){return this._edits.map(i=>i.oldUri)}async perform(i){let e=[],t=[];for(let o of this._edits){let n;try{n=await this._fileService.resolve(o.oldUri,{resolveMetadata:!0})}catch{if(!o.options.ignoreIfNotExists)throw new Error(`${o.oldUri} does not exist and can not be deleted`);continue}e.push({resource:o.oldUri,recursive:o.options.recursive,useTrash:!o.options.skipTrashBin&&this._fileService.hasCapability(o.oldUri,4096)&&this._configurationService.getValue("files.enableTrash")});let r,s=!1;if(!o.undoesCreate&&!o.options.folder&&(s=typeof o.options.maxSize=="number"&&n.size>o.options.maxSize,!s))try{r=await this._fileService.readFile(o.oldUri)}catch(l){this._logService.error(l)}s||t.push(new b6t(o.oldUri,o.options,r?.value))}return e.length===0?new ESe:(await this._workingCopyFileService.delete(e,i,this._undoRedoInfo),t.length===0?new ESe:this._instaService.createInstance(_ze,t,{isUndoing:!0}))}toString(){return`(delete ${this._edits.map(i=>i.oldUri).join(", ")})`}};kSe=I([m(2,gm),m(3,ge),m(4,B),m(5,F),m(6,re)],kSe);var JUi=class{constructor(i,e,t,o){this.label=i;this.code=e;this.operations=t;this.confirmBeforeUndo=o;this.type=1;this.resources=t.flatMap(n=>n.uris)}async undo(){await this._reverse()}async redo(){await this._reverse()}async _reverse(){for(let i=0;i<this.operations.length;i++){let t=await this.operations[i].perform(Ie.None);this.operations[i]=t}}toString(){return this.operations.map(i=>String(i)).join(", ")}},Dze=class{constructor(i,e,t,o,n,r,s,l,c,u){this._label=i;this._code=e;this._undoRedoGroup=t;this._undoRedoSource=o;this._confirmBeforeUndo=n;this._progress=r;this._token=s;this._edits=l;this._instaService=c;this._undoRedoService=u}async apply(){let i=[],e={undoRedoGroupId:this._undoRedoGroup.id},t=[];for(let r of this._edits)r.newResource&&r.oldResource&&!r.options?.copy?t.push(new v6t(r.newResource,r.oldResource,r.options??{})):r.newResource&&r.oldResource&&r.options?.copy?t.push(new XUi(r.newResource,r.oldResource,r.options??{})):!r.newResource&&r.oldResource?t.push(new dut(r.oldResource,r.options??{},!1)):r.newResource&&!r.oldResource&&t.push(new b6t(r.newResource,r.options??{},await r.options.contents));if(t.length===0)return[];let o=[];o[0]=[t[0]];for(let r=1;r<t.length;r++){let s=t[r],l=o.at(-1);l?.[0].type===s.type?l.push(s):o.push([s])}for(let r of o){if(this._token.isCancellationRequested)break;let s;switch(r[0].type){case"rename":s=this._instaService.createInstance(xSe,r,e);break;case"copy":s=this._instaService.createInstance(cut,r,e);break;case"delete":s=this._instaService.createInstance(kSe,r,e);break;case"create":s=this._instaService.createInstance(_ze,r,e);break}if(s){let l=await s.perform(this._token);i.push(l)}this._progress.report(void 0)}let n=new JUi(this._label,this._code,i,this._confirmBeforeUndo);return this._undoRedoService.pushElement(n,this._undoRedoGroup,this._undoRedoSource),n.resources}};Dze=I([m(8,F),m(9,wl)],Dze);var S6t=class{constructor(i){this._modelReference=i;this.model=this._modelReference.object.textEditorModel,this._edits=[]}dispose(){this._modelReference.dispose()}isNoOp(){return!(this._edits.length>0||this._newEol!==void 0&&this._newEol!==this.model.getEndOfLineSequence())}addEdit(i){this._expectedModelVersionId=i.versionId;let{textEdit:e}=i;if(typeof e.eol=="number"&&(this._newEol=e.eol),!e.range&&!e.text||G.isEmpty(e.range)&&!e.text)return;let t;e.range?t=G.lift(e.range):t=this.model.getFullModelRange(),this._edits.push({...Qn.replaceMove(t,e.text),insertAsSnippet:e.insertAsSnippet,keepWhitespace:e.keepWhitespace})}validate(){return typeof this._expectedModelVersionId>"u"||this.model.getVersionId()===this._expectedModelVersionId?{canApply:!0}:{canApply:!1,reason:this.model.uri}}getBeforeCursorState(){return null}apply(i){this._edits.length>0&&(this._edits=this._edits.map(this._transformSnippetStringToInsertText,this).sort((e,t)=>G.compareRangesUsingStarts(e.range,t.range)),this.model.pushEditOperations(null,this._edits,()=>null,void 0,i)),this._newEol!==void 0&&this.model.pushEOL(this._newEol)}_transformSnippetStringToInsertText(i){if(!i.insertAsSnippet||!i.text)return i;let e=Og.asInsertText(i.text);return{...i,insertAsSnippet:!1,text:e}}},ZUi=class extends S6t{constructor(i,e){super(i),this._editor=e}getBeforeCursorState(){return this._canUseEditor()?this._editor.getSelections():null}apply(i){if(!this._canUseEditor()){super.apply();return}if(this._edits.length>0){let e=ss.get(this._editor);if(e&&this._edits.some(t=>t.insertAsSnippet)){let t=[];for(let o of this._edits)o.range&&o.text!==null&&t.push({range:G.lift(o.range),template:o.insertAsSnippet?o.text:Og.escape(o.text),keepWhitespace:o.keepWhitespace});e.apply(t,{undoStopBefore:!1,undoStopAfter:!1})}else this._edits=this._edits.map(this._transformSnippetStringToInsertText,this).sort((t,o)=>G.compareRangesUsingStarts(t.range,o.range)),this._editor.executeEdits(i,this._edits)}this._newEol!==void 0&&this._editor.hasModel()&&this._editor.getModel().pushEOL(this._newEol)}_canUseEditor(){return this._editor?.getModel()?.uri.toString()===this.model.uri.toString()}},Rze=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._label=i;this._code=e;this._editor=t;this._undoRedoGroup=o;this._undoRedoSource=n;this._progress=r;this._token=s;this._editorWorker=c;this._modelService=u;this._textModelResolverService=p;this._undoRedoService=h;this._edits=new dt;for(let g of l){let f=this._edits.get(g.resource);f||(f=[],this._edits.set(g.resource,f)),f.push(g)}}_validateBeforePrepare(){for(let i of this._edits.values())for(let e of i)if(typeof e.versionId=="number"){let t=this._modelService.getModel(e.resource);if(t&&t.getVersionId()!==e.versionId)throw new Error(`${t.uri.toString()} has changed in the meantime`)}}async _createEditsTasks(){let i=[],e=[];for(let[t,o]of this._edits){let n=this._textModelResolverService.createModelReference(t).then(async r=>{let s,l=!1;if(this._editor?.getModel()?.uri.toString()===r.object.textEditorModel.uri.toString()?(s=new ZUi(r,this._editor),l=!0):s=new S6t(r),i.push(s),!l){o.forEach(s.addEdit,s);return}let c=async(h,g)=>{let f=o.slice(h,g),v=await this._editorWorker.computeMoreMinimalEdits(r.object.textEditorModel.uri,f.map(b=>b.textEdit),!1);v?v.forEach(b=>s.addEdit(new hl(r.object.textEditorModel.uri,b,void 0,void 0))):f.forEach(s.addEdit,s)},u=0,p=0;for(;p<o.length;p++)(o[p].textEdit.insertAsSnippet||o[p].metadata)&&(await c(u,p),s.addEdit(o[p]),u=p+1);await c(u,p)});e.push(n)}return await Promise.all(e),i}_validateTasks(i){for(let e of i){let t=e.validate();if(!t.canApply)return t}return{canApply:!0}}async apply(i){this._validateBeforePrepare();let e=await this._createEditsTasks();try{if(this._token.isCancellationRequested)return[];let t=[],o=this._validateTasks(e);if(!o.canApply)throw new Error(`${o.reason.toString()} has changed in the meantime`);if(e.length===1){let n=e[0];if(!n.isNoOp()){let r=new JL(this._label,this._code,n.model,n.getBeforeCursorState());this._undoRedoService.pushElement(r,this._undoRedoGroup,this._undoRedoSource),n.apply(i),r.close(),t.push(n.model.uri)}this._progress.report(void 0)}else{let n=new UB(this._label,this._code,e.map(r=>new JL(this._label,this._code,r.model,r.getBeforeCursorState())));this._undoRedoService.pushElement(n,this._undoRedoGroup,this._undoRedoSource);for(let r of e)r.apply(),this._progress.report(void 0),t.push(r.model.uri);n.close()}return t}finally{je(e)}}};Rze=I([m(8,Qs),m(9,_t),m(10,Bt),m(11,wl)],Rze);var Mze=class a extends sJ{constructor(e,t,o,n){super(n);this.resource=e;this.undo=t;this.redo=o}static is(e){return e instanceof a?!0:Di(e)&&!!(e.undo&&e.redo)}static lift(e){return e instanceof a?e:new a(e.resource,e.undo,e.redo,e.metadata)}},Lze=class{constructor(i,e,t,o,n,r){this._undoRedoGroup=i;this._undoRedoSource=e;this._progress=t;this._token=o;this._edits=n;this._undoRedoService=r}async apply(){let i=[];for(let e of this._edits){if(this._token.isCancellationRequested)break;await e.redo(),this._undoRedoService.pushElement({type:0,resource:e.resource,label:e.metadata?.label||"Custom Edit",code:"paste",undo:e.undo,redo:e.redo},this._undoRedoGroup,this._undoRedoSource),this._progress.report(void 0),i.push(e.resource)}return i}};Lze=I([m(5,wl)],Lze);function exn(a){return a.map(i=>{if(hl.is(i))return hl.lift(i);if(Yu.is(i))return Yu.lift(i);if(rb.is(i))return rb.lift(i);if(Mze.is(i))return Mze.lift(i);throw new Error("Unsupported edit")})}var uut=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._label=i;this._code=e;this._editor=t;this._progress=o;this._token=n;this._edits=r;this._undoRedoGroup=s;this._undoRedoSource=l;this._confirmBeforeUndo=c;this._instaService=u;this._logService=p}ariaMessage(){let i=new dt,e=new dt,t=0;for(let o of this._edits)o instanceof hl?(t+=1,e.set(o.resource,!0)):o instanceof Yu&&i.set(o.oldResource??o.newResource,!0);return this._edits.length===0?d(6218,null):i.size===0?t>1&&e.size>1?d(6220,null,t,e.size):d(6219,null,t):d(6221,null,t,e.size,i.size)}async perform(i){if(this._edits.length===0)return[];let e=[1];for(let s=1;s<this._edits.length;s++)Object.getPrototypeOf(this._edits[s-1])===Object.getPrototypeOf(this._edits[s])?e[e.length-1]++:e.push(1);let t=this._edits.length>1?0:void 0;this._progress.report({increment:t,total:100});let o={report:s=>this._progress.report({increment:100/this._edits.length})},n=[],r=0;for(let s of e){if(this._token.isCancellationRequested)break;let l=this._edits.slice(r,r+s);l[0]instanceof Yu?n.push(await this._performFileEdits(l,this._undoRedoGroup,this._undoRedoSource,this._confirmBeforeUndo,o)):l[0]instanceof hl?n.push(await this._performTextEdits(l,this._undoRedoGroup,this._undoRedoSource,o,i)):l[0]instanceof rb?n.push(await this._performCellEdits(l,this._undoRedoGroup,this._undoRedoSource,o)):l[0]instanceof Mze?n.push(await this._performOpaqueEdits(l,this._undoRedoGroup,this._undoRedoSource,o)):console.log("UNKNOWN EDIT"),r=r+s}return n.flat()}async _performFileEdits(i,e,t,o,n){return this._logService.debug("_performFileEdits",JSON.stringify(i)),await this._instaService.createInstance(Dze,this._label||d(6222,null),this._code||"undoredo.workspaceEdit",e,t,o,n,this._token,i).apply()}async _performTextEdits(i,e,t,o,n){return this._logService.debug("_performTextEdits",JSON.stringify(i)),await this._instaService.createInstance(Rze,this._label||d(6222,null),this._code||"undoredo.workspaceEdit",this._editor,e,t,o,this._token,i).apply(n)}async _performCellEdits(i,e,t,o){return this._logService.debug("_performCellEdits",JSON.stringify(i)),await this._instaService.createInstance(V_e,e,t,o,this._token,i).apply()}async _performOpaqueEdits(i,e,t,o){return this._logService.debug("_performOpaqueEdits",JSON.stringify(i)),await this._instaService.createInstance(Lze,e,t,o,this._token,i).apply()}};uut=I([m(9,F),m(10,re)],uut);var put=class{constructor(i,e,t,o,n,r,s){this._instaService=i;this._logService=e;this._editorService=t;this._lifecycleService=o;this._dialogService=n;this._workingCopyService=r;this._configService=s;this._activeUndoRedoGroups=new ra}setPreviewHandler(i){return this._previewHandler=i,ee(()=>{this._previewHandler===i&&(this._previewHandler=void 0)})}hasPreviewHandler(){return!!this._previewHandler}async apply(i,e){let t=exn(Array.isArray(i)?i:i.edits);if(t.length===0)return{ariaSummary:d(6213,null),isApplied:!1};this._previewHandler&&(e?.showPreview||t.some(u=>u.metadata?.needsConfirmation))&&(t=await this._previewHandler(t,e));let o=e?.editor;if(!o){let u=this._editorService.activeTextEditorControl;fn(u)?o=u:Lc(u)&&(o=u.getModifiedEditor())}o&&o.getOption(104)&&(o=void 0);let n,r=()=>{};if(typeof e?.undoRedoGroupId=="number"){for(let u of this._activeUndoRedoGroups)if(u.id===e.undoRedoGroupId){n=u;break}}n||(n=new DX,r=this._activeUndoRedoGroups.push(n));let s=e?.quotableLabel||e?.label,l=this._instaService.createInstance(uut,s,e?.code,o,e?.progress??nh.None,e?.token??Ie.None,t,n,e?.undoRedoSource,!!e?.confirmBeforeUndo),c;try{c=this._lifecycleService.onBeforeShutdown(p=>p.veto(this._shouldVeto(s,p.reason),"veto.blukEditService"));let u=await l.perform(e?.reason);return e?.respectAutoSaveConfig&&this._configService.getValue(yNo)===!0&&u.length>1&&await this._saveAll(u),{ariaSummary:l.ariaMessage(),isApplied:t.length>0}}catch(u){throw this._logService.error(u),u}finally{c?.dispose(),r()}}async _saveAll(i){let e=new xn(i),t=this._workingCopyService.dirtyWorkingCopies.map(async n=>{e.has(n.resource)&&await n.save()}),o=await Promise.allSettled(t);for(let n of o)n.status==="rejected"&&this._logService.warn(n.reason)}async _shouldVeto(i,e){let t;switch(e){case 1:t=d(6211,null);break;case 4:t=d(6210,null);break;case 3:t=d(6217,null);break;default:t=et?d(6215,null):d(6214,null);break}return!(await this._dialogService.confirm({message:t,detail:d(6209,null,i||d(6212,null))})).confirmed}};put=I([m(0,F),m(1,re),m(2,ie),m(3,to),m(4,ct),m(5,$a),m(6,B)],put);Ce(Ka,put,1);var yNo="files.refactoring.autoSave";oe.as($t.Configuration).registerConfiguration({id:"files",properties:{[yNo]:{description:d(6216,null),default:!0,type:"boolean"}}});var Pze=class{constructor(i,e,t,o){this._conflicts=new dt;this._disposables=new O;this._onDidConflict=new T;this.onDidConflict=this._onDidConflict.event;let n=new dt;for(let s of i)if(s instanceof hl){if(n.set(s.resource,!0),typeof s.versionId=="number"){let l=t.getModel(s.resource);l&&l.getVersionId()!==s.versionId&&(this._conflicts.set(s.resource,!0),this._onDidConflict.fire(this))}}else s instanceof Yu?s.newResource?n.set(s.newResource,!0):s.oldResource&&n.set(s.oldResource,!0):s instanceof rb?n.set(s.resource,!0):o.warn("UNKNOWN edit type",s);this._disposables.add(e.onDidFilesChange(s=>{for(let l of n.keys())if(!t.getModel(l)&&s.contains(l)){this._conflicts.set(l,!0),this._onDidConflict.fire(this);break}}));let r=s=>{n.has(s.uri)&&(this._conflicts.set(s.uri,!0),this._onDidConflict.fire(this))};for(let s of t.getModels())this._disposables.add(s.onDidChangeContent(()=>r(s)))}dispose(){this._disposables.dispose(),this._onDidConflict.dispose()}list(){return[...this._conflicts.keys()]}hasConflicts(){return this._conflicts.size>0}};Pze=I([m(1,ge),m(2,_t),m(3,re)],Pze);var e1i=class{constructor(){this._states=new WeakMap;this._checkedCount=0;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}get checkedCount(){return this._checkedCount}isChecked(i){return this._states.get(i)??!1}updateChecked(i,e){let t=this._states.get(i);t!==e&&(t===void 0?e&&(this._checkedCount+=1):e?this._checkedCount+=1:this._checkedCount-=1,this._states.set(i,e),this._onDidChange.fire(i))}},t1i=class{constructor(i,e){this.parent=i;this.textEdit=e}};var i1i=class{constructor(i,e){this.uri=i;this.parent=e;this.type=0;this.textEdits=[];this.originalEdits=new Map}addEdit(i,e,t){this.type|=e,this.originalEdits.set(i,t),t instanceof hl?this.textEdits.push(new t1i(this,t)):e===8&&(this.newUri=t.newResource)}needsConfirmation(){for(let[,i]of this.originalEdits)if(!this.parent.checked.isChecked(i))return!0;return!1}},I6t=class a{constructor(i=a._defaultMetadata){this.metadata=i;this.operationByResource=new Map}static{this._defaultMetadata=Object.freeze({label:d(6239,null),icon:L.symbolFile,needsConfirmation:!1})}static keyOf(i){return i?.label||"<default>"}get fileOperations(){return this.operationByResource.values()}},j$=class{constructor(i,e,t){this._bulkEdit=i;this._fileService=e;this.checked=new e1i;this.fileOperations=[];this.categories=[];this.conflicts=t.createInstance(Pze,i)}static async create(i,e){return await i.get(F).createInstance(j$,e)._init()}dispose(){this.checked.dispose(),this.conflicts.dispose()}async _init(){let i=new Map,e=new Map,t=new dt;for(let o=0;o<this._bulkEdit.length;o++){let n=this._bulkEdit[o],r,s;if(this.checked.updateChecked(n,!n.metadata?.needsConfirmation),n instanceof hl)s=1,r=n.resource;else if(n instanceof Yu)if(n.newResource&&n.oldResource){if(s=8,r=n.oldResource,n.options?.overwrite===void 0&&n.options?.ignoreIfExists&&await this._fileService.exists(r))continue;t.set(n.newResource,r)}else if(n.oldResource){if(s=4,r=n.oldResource,n.options?.ignoreIfNotExists&&!await this._fileService.exists(r))continue}else if(n.newResource){if(s=2,r=n.newResource,n.options?.overwrite===void 0&&n.options?.ignoreIfExists&&await this._fileService.exists(r))continue}else continue;else continue;let l=(p,h)=>{let g=Jn.getComparisonKey(p,!0),f=h.get(g);!f&&t.has(p)&&(p=t.get(p),g=Jn.getComparisonKey(p,!0),f=h.get(g)),f||(f=new i1i(p,this),h.set(g,f)),f.addEdit(o,s,n)};l(r,i);let c=I6t.keyOf(n.metadata),u=e.get(c);u||(u=new I6t(n.metadata),e.set(c,u)),l(r,u.operationByResource)}i.forEach(o=>this.fileOperations.push(o)),e.forEach(o=>this.categories.push(o));for(let o of this.fileOperations)if(o.type!==1){let n=!0;for(let r of o.originalEdits.values())r instanceof Yu&&(n=n&&this.checked.isChecked(r));if(!n)for(let r of o.originalEdits.values())this.checked.updateChecked(r,n)}return this.categories.sort((o,n)=>o.metadata.needsConfirmation===n.metadata.needsConfirmation?o.metadata.label.localeCompare(n.metadata.label):o.metadata.needsConfirmation?-1:1),this}getWorkspaceEdit(){let i=[],e=!0;for(let t=0;t<this._bulkEdit.length;t++){let o=this._bulkEdit[t];if(this.checked.isChecked(o)){i[t]=o;continue}e=!1}return e?this._bulkEdit:(Wj(i),i)}async getFileEditOperation(i){let e=await i.options.contents;if(e)return Qn.replaceMove(G.lift({startLineNumber:0,startColumn:0,endLineNumber:Number.MAX_VALUE,endColumn:0}),e.toString())}async getFileEdits(i){for(let e of this.fileOperations)if(e.uri.toString()===i.toString()){let t=[],o=!1;for(let n of e.originalEdits.values())n instanceof Yu?t.push(this.getFileEditOperation(n)):n instanceof hl?this.checked.isChecked(n)&&t.push(Promise.resolve(Qn.replaceMove(G.lift(n.textEdit.range),n.textEdit.insertAsSnippet?Og.asInsertText(n.textEdit.text):n.textEdit.text))):this.checked.isChecked(n)||(o=!0);return o?[]:(await Promise.all(t)).filter(n=>n!==void 0).sort((n,r)=>G.compareRangesUsingStarts(n.range,r.range))}return[]}getUriOfEdit(i){for(let e of this.fileOperations)for(let t of e.originalEdits.values())if(t===i)return e.uri;throw new Error("invalid edit")}};j$=I([m(1,ge),m(2,F)],j$);var H1=class{constructor(i,e,t,o){this._operations=i;this._languageService=e;this._modelService=t;this._textModelResolverService=o;this._disposables=new O;this._modelPreviewEdits=new Map;this._instanceId=ht();this._disposables.add(this._textModelResolverService.registerTextModelContentProvider(H1.Schema,this)),this._ready=this._init()}static{this.Schema="vscode-bulkeditpreview-editor"}static{this.emptyPreview=A.from({scheme:this.Schema,fragment:"empty"})}static fromPreviewUri(i){return A.parse(i.query)}dispose(){this._disposables.dispose()}asPreviewUri(i){let e=i.scheme===Q.untitled?`/${i.path}`:i.path;return A.from({scheme:H1.Schema,authority:this._instanceId,path:e,query:i.toString()})}async _init(){for(let i of this._operations.fileOperations)await this._applyTextEditsToPreviewModel(i.uri);this._disposables.add(U.debounce(this._operations.checked.onDidChange,(i,e)=>e,EL)(i=>{let e=this._operations.getUriOfEdit(i);this._applyTextEditsToPreviewModel(e)}))}async _applyTextEditsToPreviewModel(i){let e=await this._getOrCreatePreviewModel(i),t=this._modelPreviewEdits.get(e.id);t&&e.applyEdits(t);let o=await this._operations.getFileEdits(i),n=e.applyEdits(o,!0);this._modelPreviewEdits.set(e.id,n)}async _getOrCreatePreviewModel(i){let e=this.asPreviewUri(i),t=this._modelService.getModel(e);if(!t){try{let o=await this._textModelResolverService.createModelReference(i),n=o.object.textEditorModel;t=this._modelService.createModel(Uk(n.createSnapshot()),this._languageService.createById(n.getLanguageId()),e),o.dispose()}catch{t=this._modelService.createModel("",this._languageService.createByFilepathOrFirstLine(e),e)}queueMicrotask(async()=>{this._disposables.add(await this._textModelResolverService.createModelReference(t.uri))})}return t}async provideTextContent(i){return i.toString()===H1.emptyPreview.toString()?this._modelService.createModel("",null,i):(await this._ready,this._modelService.getModel(i))}};H1=I([m(1,Rt),m(2,_t),m(3,Bt)],H1);var z_=class{constructor(i,e){this.parent=i;this.category=e}isChecked(){let i=this.parent,e=!0;for(let t of this.category.fileOperations)for(let o of t.originalEdits.values())e=e&&i.checked.isChecked(o);return e}setChecked(i){let e=this.parent;for(let t of this.category.fileOperations)for(let o of t.originalEdits.values())e.checked.updateChecked(o,i)}},K_=class{constructor(i,e){this.parent=i;this.edit=e}isChecked(){let i=this.parent instanceof z_?this.parent.parent:this.parent,e=!0;this.edit.type===1&&(e=!this.edit.textEdits.every(t=>!i.checked.isChecked(t.textEdit)));for(let t of this.edit.originalEdits.values())t instanceof Yu&&(e=e&&i.checked.isChecked(t));if(this.parent instanceof z_&&this.edit.type===1){for(let t of i.categories)for(let o of t.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let n of o.originalEdits.values())n instanceof Yu&&(e=e&&i.checked.isChecked(n))}return e}setChecked(i){let e=this.parent instanceof z_?this.parent.parent:this.parent;for(let t of this.edit.originalEdits.values())e.checked.updateChecked(t,i);if(this.parent instanceof z_&&this.edit.type!==1){for(let t of e.categories)for(let o of t.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let n of o.originalEdits.values())e.checked.updateChecked(n,i)}}isDisabled(){if(this.parent instanceof z_&&this.edit.type===1){let i=this.parent.parent,e=!0;for(let t of i.categories)for(let o of t.fileOperations)if(o.uri.toString()===this.edit.uri.toString())for(let n of o.originalEdits.values())n instanceof Yu&&(e=e&&i.checked.isChecked(n));return!e}return!1}},KV=class{constructor(i,e,t,o,n,r,s){this.parent=i;this.idx=e;this.edit=t;this.prefix=o;this.selecting=n;this.inserting=r;this.suffix=s}isChecked(){let i=this.parent.parent;return i instanceof z_&&(i=i.parent),i.checked.isChecked(this.edit.textEdit)}setChecked(i){let e=this.parent.parent;if(e instanceof z_&&(e=e.parent),e.checked.updateChecked(this.edit.textEdit,i),i)for(let t of this.parent.edit.originalEdits.values())t instanceof Yu&&e.checked.updateChecked(t,i)}isDisabled(){return this.parent.isDisabled()}},Aze=class{constructor(i,e){this._textModelService=i;this._instantiationService=e;this.groupByFile=!0}hasChildren(i){return i instanceof K_?i.edit.textEdits.length>0:!(i instanceof KV)}async getChildren(i){if(i instanceof j$)return this.groupByFile?i.fileOperations.map(e=>new K_(i,e)):i.categories.map(e=>new z_(i,e));if(i instanceof z_)return Array.from(i.category.fileOperations,e=>new K_(i,e));if(i instanceof K_&&i.edit.textEdits.length>0){let e,t;try{let n=await this._textModelService.createModelReference(i.edit.uri);e=n.object.textEditorModel,t=n}catch{e=this._instantiationService.createInstance(Tp,"",es,Tp.DEFAULT_CREATION_OPTIONS,null),t=e}let o=i.edit.textEdits.map((n,r)=>{let s=e.validateRange(n.textEdit.textEdit.range),l=e.tokenization.getLineTokens(s.startLineNumber),c=23;for(let h=l.findTokenIndexAtOffset(s.startColumn-1)-1;c<50&&h>=0;h--)c=s.startColumn-l.getStartOffset(h);let u=e.tokenization.getLineTokens(s.endLineNumber),p=0;for(let h=u.findTokenIndexAtOffset(s.endColumn-1);p<50&&h<u.getCount();h++)p+=u.getEndOffset(h)-u.getStartOffset(h);return new KV(i,r,n,e.getValueInRange(new G(s.startLineNumber,s.startColumn-c,s.startLineNumber,s.startColumn)),e.getValueInRange(s),n.textEdit.textEdit.insertAsSnippet?Og.asInsertText(n.textEdit.textEdit.text):n.textEdit.textEdit.text,e.getValueInRange(new G(s.endLineNumber,s.endColumn,s.endLineNumber,s.endColumn+p)))});return t.dispose(),o}return[]}};Aze=I([m(0,Bt),m(1,F)],Aze);var y6t=class{compare(i,e){return i instanceof K_&&e instanceof K_?n1i(i.edit,e.edit):i instanceof KV&&e instanceof KV?G.compareRangesUsingStarts(i.edit.textEdit.textEdit.range,e.edit.textEdit.textEdit.range):0}};function n1i(a,i){return oc(a.uri.toString(),i.uri.toString())}var Nze=class{constructor(i){this._labelService=i}getWidgetAriaLabel(){return d(6250,null)}getRole(i){return"checkbox"}getAriaLabel(i){if(i instanceof K_){if(i.edit.textEdits.length>0)return i.edit.type&8&&i.edit.newUri?d(6248,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}),this._labelService.getUriLabel(i.edit.newUri,{relative:!0})):i.edit.type&2?d(6241,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0})):i.edit.type&4?d(6244,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0})):d(6245,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}));if(i.edit.type&8&&i.edit.newUri)return d(6247,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}),this._labelService.getUriLabel(i.edit.newUri,{relative:!0}));if(i.edit.type&2)return d(6240,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}));if(i.edit.type&4)return d(6243,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}))}if(i instanceof KV){if(i.selecting.length>0&&i.inserting.length>0)return d(6249,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting,i.inserting);if(i.selecting.length>0&&i.inserting.length===0)return d(6242,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting);if(i.selecting.length===0&&i.inserting.length>0)return d(6246,null,i.edit.textEdit.textEdit.range.startLineNumber,i.selecting)}return null}};Nze=I([m(0,nt)],Nze);var w6t=class{getId(i){return i instanceof K_?i.edit.uri+(i.parent instanceof z_?JSON.stringify(i.parent.category.metadata):""):i instanceof KV?i.parent.edit.uri.toString()+i.idx:JSON.stringify(i.category.metadata)}},o1i=class{constructor(i){i.classList.add("category"),this.icon=document.createElement("div"),i.appendChild(this.icon),this.label=new ld(i)}},e7=class{constructor(i){this._themeService=i;this.templateId=e7.id}static{this.id="CategoryElementRenderer"}renderTemplate(i){return new o1i(i)}renderElement(i,e,t){t.icon.style.setProperty("--background-dark",null),t.icon.style.setProperty("--background-light",null),t.icon.style.color="";let{metadata:o}=i.element.category;if(q.isThemeIcon(o.iconPath)){let n=q.asClassName(o.iconPath);t.icon.className=n?`theme-icon ${n}`:"",t.icon.style.color=o.iconPath.color?this._themeService.getColorTheme().getColor(o.iconPath.color.id)?.toString()??"":""}else A.isUri(o.iconPath)?(t.icon.className="uri-icon",t.icon.style.setProperty("--background-dark",cl(o.iconPath)),t.icon.style.setProperty("--background-light",cl(o.iconPath))):o.iconPath&&(t.icon.className="uri-icon",t.icon.style.setProperty("--background-dark",cl(o.iconPath.dark)),t.icon.style.setProperty("--background-light",cl(o.iconPath.light)));t.label.setLabel(o.label,o.description,{descriptionMatches:Wa(i.filterData)})}disposeTemplate(i){i.label.dispose()}};e7=I([m(0,Pe)],e7);var mut=class{constructor(i,e,t){this._labelService=t;this._disposables=new O;this._localDisposables=new O;this._checkbox=document.createElement("input"),this._checkbox.className="edit-checkbox",this._checkbox.type="checkbox",this._checkbox.setAttribute("role","checkbox"),i.appendChild(this._checkbox),this._label=e.create(i,{supportHighlights:!0}),this._details=document.createElement("span"),this._details.className="details",i.appendChild(this._details)}dispose(){this._localDisposables.dispose(),this._disposables.dispose(),this._label.dispose()}set(i,e){if(this._localDisposables.clear(),this._checkbox.checked=i.isChecked(),this._checkbox.disabled=i.isDisabled(),this._localDisposables.add($(this._checkbox,"change",()=>{i.setChecked(this._checkbox.checked)})),i.edit.type&8&&i.edit.newUri)this._label.setResource({resource:i.edit.uri,name:d(6254,null,this._labelService.getUriLabel(i.edit.uri,{relative:!0}),this._labelService.getUriLabel(i.edit.newUri,{relative:!0}))},{fileDecorations:{colors:!0,badges:!1}}),this._details.innerText=d(6253,null);else{let t={matches:Wa(e),fileKind:0,fileDecorations:{colors:!0,badges:!1},extraClasses:[]};i.edit.type&2?this._details.innerText=d(6251,null):i.edit.type&4?(this._details.innerText=d(6252,null),t.extraClasses.push("delete")):this._details.innerText="",this._label.setFile(i.edit.uri,t)}}};mut=I([m(2,nt)],mut);var t7=class{constructor(i,e){this._resourceLabels=i;this._labelService=e;this.templateId=t7.id}static{this.id="FileElementRenderer"}renderTemplate(i){return new mut(i,this._resourceLabels,this._labelService)}renderElement(i,e,t){t.set(i.element,i.filterData)}disposeTemplate(i){i.dispose()}};t7=I([m(1,nt)],t7);var hut=class{constructor(i,e){this._themeService=e;this._disposables=new O;this._localDisposables=new O;i.classList.add("textedit"),this._checkbox=document.createElement("input"),this._checkbox.className="edit-checkbox",this._checkbox.type="checkbox",this._checkbox.setAttribute("role","checkbox"),i.appendChild(this._checkbox),this._icon=document.createElement("div"),i.appendChild(this._icon),this._label=this._disposables.add(new ul(i))}dispose(){this._localDisposables.dispose(),this._disposables.dispose()}set(i){this._localDisposables.clear(),this._localDisposables.add($(this._checkbox,"change",l=>{i.setChecked(this._checkbox.checked),l.preventDefault()})),i.parent.isChecked()?(this._checkbox.checked=i.isChecked(),this._checkbox.disabled=i.isDisabled()):(this._checkbox.checked=i.isChecked(),this._checkbox.disabled=i.isDisabled());let e="";e+=i.prefix,e+=i.selecting,e+=i.inserting,e+=i.suffix;let t={start:i.prefix.length,end:i.prefix.length+i.selecting.length,extraClasses:["remove"]},o={start:t.end,end:t.end+i.inserting.length,extraClasses:["insert"]},n,{metadata:r}=i.edit.textEdit;r&&r.description?n=d(6255,null,r.label,r.description):r&&(n=r.label);let s=r?.iconPath;if(!s)this._icon.style.display="none";else if(this._icon.style.display="block",this._icon.style.setProperty("--background-dark",null),this._icon.style.setProperty("--background-light",null),q.isThemeIcon(s)){let l=q.asClassName(s);this._icon.className=l?`theme-icon ${l}`:"",this._icon.style.color=s.color?this._themeService.getColorTheme().getColor(s.color.id)?.toString()??"":""}else A.isUri(s)?(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",cl(s)),this._icon.style.setProperty("--background-light",cl(s))):(this._icon.className="uri-icon",this._icon.style.setProperty("--background-dark",cl(s.dark)),this._icon.style.setProperty("--background-light",cl(s.light)));this._label.set(e,[t,o],n,!0),this._icon.title=n||""}};hut=I([m(1,Pe)],hut);var i7=class{constructor(i){this._themeService=i;this.templateId=i7.id}static{this.id="TextEditElementRenderer"}renderTemplate(i){return new hut(i,this._themeService)}renderElement({element:i},e,t){t.set(i)}disposeTemplate(i){i.dispose()}};i7=I([m(0,Pe)],i7);var C6t=class{getHeight(){return 23}getTemplateId(i){return i instanceof K_?t7.id:i instanceof KV?i7.id:e7.id}},x6t=class{getKeyboardNavigationLabel(i){if(i instanceof K_)return Be(i.edit.uri);if(i instanceof z_)return i.category.metadata.label}};var zm=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super({...e,titleMenuId:R.BulkEditTitle},h,g,f,u,p,t,v,b,S);this._instaService=t;this._editorService=o;this._labelService=n;this._textModelService=r;this._dialogService=s;this._contextMenuService=l;this._storageService=c;this._treeViewStates=new Map;this._disposables=new O;this._sessionDisposables=new O;this._computeResourceDiffEditorInputs=new lY(async e=>{let t=new xy(async s=>{let l=s.uri,c=this._currentProvider.asPreviewUri(l);if(s.type&4)return{original:{resource:A.revive(c)},modified:{resource:void 0},goToFileResource:s.uri};{let u;try{(await this._textModelService.createModelReference(l)).dispose(),u=l}catch{u=H1.emptyPreview}return{original:{resource:A.revive(u)},modified:{resource:A.revive(c)},goToFileResource:u}}}),o=e.slice().sort(n1i),n=[];for(let s of o)n.push(await t.get(s));return{resources:n,getResourceDiffEditorInputIdOfOperation:async s=>{let l=await t.get(s);return{original:l.original.resource,modified:l.modified.resource}}}});this.element.classList.add("bulk-edit-panel","show-file-icons"),this._ctxHasCategories=zm.ctxHasCategories.bindTo(u),this._ctxGroupByFile=zm.ctxGroupByFile.bindTo(u),this._ctxHasCheckedChanges=zm.ctxHasCheckedChanges.bindTo(u)}static{this.ID="refactorPreview"}static{this.Schema="vscode-bulkeditpreview-multieditor"}static{this.ctxHasCategories=new Y("refactorPreview.hasCategories",!1)}static{this.ctxGroupByFile=new Y("refactorPreview.groupByFile",!0)}static{this.ctxHasCheckedChanges=new Y("refactorPreview.hasCheckedChanges",!0)}static{this._memGroupByFile=`${this.ID}.groupByFile`}dispose(){this._tree.dispose(),this._disposables.dispose(),this._sessionDisposables.dispose(),super.dispose()}renderBody(e){super.renderBody(e);let t=this._instaService.createInstance(jl,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._disposables.add(t);let o=document.createElement("div");o.className="content",e.appendChild(o);let n=document.createElement("div");o.appendChild(n),this._treeDataSource=this._instaService.createInstance(Aze),this._treeDataSource.groupByFile=this._storageService.getBoolean(zm._memGroupByFile,0,!0),this._ctxGroupByFile.set(this._treeDataSource.groupByFile),this._tree=this._instaService.createInstance(Rp,this.id,n,new C6t,[this._instaService.createInstance(i7),this._instaService.createInstance(t7,t),this._instaService.createInstance(e7)],this._treeDataSource,{accessibilityProvider:this._instaService.createInstance(Nze),identityProvider:new w6t,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,keyboardNavigationLabelProvider:new x6t,sorter:new y6t,selectionNavigation:!0}),this._disposables.add(this._tree.onContextMenu(this._onContextMenu,this)),this._disposables.add(this._tree.onDidOpen(u=>this._openElementInMultiDiffEditor(u)));let r=document.createElement("div");r.className="buttons",o.appendChild(r);let s=new sC(r);this._disposables.add(s);let l=s.addButton({supportIcons:!0,...Ro});l.label=d(6238,null),l.onDidClick(()=>this.accept(),this,this._disposables);let c=s.addButton({...Ro,secondary:!0});c.label=d(6234,null),c.onDidClick(()=>this.discard(),this,this._disposables),this._message=document.createElement("span"),this._message.className="message",this._message.innerText=d(6237,null),e.appendChild(this._message),this._setState("message")}layoutBody(e,t){super.layoutBody(e,t);let o=e-50;this._tree.getHTMLElement().parentElement.style.height=`${o}px`,this._tree.layout(o,t)}_setState(e){this.element.dataset.state=e}async setInput(e,t){this._setState("data"),this._sessionDisposables.clear(),this._treeViewStates.clear(),this._currentResolve&&(this._currentResolve(void 0),this._currentResolve=void 0);let o=await this._instaService.invokeFunction(j$.create,e);this._currentProvider=this._instaService.createInstance(H1,o),this._sessionDisposables.add(this._currentProvider),this._sessionDisposables.add(o);let n=o.categories.length>1;return this._ctxHasCategories.set(n),this._treeDataSource.groupByFile=!n||this._treeDataSource.groupByFile,this._ctxHasCheckedChanges.set(o.checked.checkedCount>0),this._currentInput=o,new Promise(r=>{t.onCancellationRequested(()=>r(void 0)),this._currentResolve=r,this._setTreeInput(o),this._sessionDisposables.add(o.checked.onDidChange(()=>{this._tree.updateChildren(),this._ctxHasCheckedChanges.set(o.checked.checkedCount>0)}))})}hasInput(){return!!this._currentInput}async _setTreeInput(e){let t=this._treeViewStates.get(this._treeDataSource.groupByFile);if(await this._tree.setInput(e,t),this._tree.domFocus(),t)return;let o=[...this._tree.getNode(e).children].slice(0,10);for(;o.length>0;){let{element:n}=o.shift();n instanceof K_&&await this._tree.expand(n,!0),n instanceof z_&&(await this._tree.expand(n,!0),o.push(...this._tree.getNode(n).children))}}accept(){let e=this._currentInput?.conflicts.list();if(!e||e.length===0){this._done(!0);return}let t;e.length===1?t=d(6235,null,this._labelService.getUriLabel(e[0],{relative:!0})):t=d(6236,null,e.length),this._dialogService.warn(t).finally(()=>this._done(!1))}discard(){this._done(!1)}_done(e){this._currentResolve?.(e?this._currentInput?.getWorkspaceEdit():void 0),this._currentInput=void 0,this._setState("message"),this._sessionDisposables.clear()}toggleChecked(){let[e]=this._tree.getFocus();((e instanceof K_||e instanceof KV)&&!e.isDisabled()||e instanceof z_)&&e.setChecked(!e.isChecked())}groupByFile(){this._treeDataSource.groupByFile||this.toggleGrouping()}groupByType(){this._treeDataSource.groupByFile&&this.toggleGrouping()}toggleGrouping(){let e=this._tree.getInput();if(e){let t=this._tree.getViewState();this._treeViewStates.set(this._treeDataSource.groupByFile,t),this._treeDataSource.groupByFile=!this._treeDataSource.groupByFile,this._setTreeInput(e),this._storageService.store(zm._memGroupByFile,this._treeDataSource.groupByFile,0,0),this._ctxGroupByFile.set(this._treeDataSource.groupByFile)}}async _openElementInMultiDiffEditor(e){let t=this._currentInput?.fileOperations;if(!t)return;let o,n;if(e.element instanceof KV)n=e.element.parent,o=e.element.edit.textEdit.textEdit.range;else if(e.element instanceof K_)n=e.element,o=e.element.edit.textEdits[0]?.textEdit.textEdit.range;else return;let r=await this._computeResourceDiffEditorInputs.get(t),s=await r.getResourceDiffEditorInputIdOfOperation(n.edit),l={...e.editorOptions,viewState:{revealData:{resource:s,range:o}}},c=A.from({scheme:zm.Schema}),u="Refactor Preview";this._editorService.openEditor({multiDiffSource:c,label:u,options:l,isTransient:!0,description:u,resources:r.resources},e.sideBySide?En:tr)}_onContextMenu(e){this._contextMenuService.showContextMenu({menuId:R.BulkEditContext,contextKeyService:this.contextKeyService,getAnchor:()=>e.anchor})}};zm=I([m(1,F),m(2,ie),m(3,nt),m(4,Bt),m(5,ct),m(6,Xe),m(7,de),m(8,X),m(9,ji),m(10,Le),m(11,Xe),m(12,B),m(13,Je),m(14,Pe),m(15,ot)],zm);async function TSe(a){let i=await a.openView(zm.ID,!0);if(i instanceof zm)return i}var gut=class{constructor(i,e){this._paneCompositeService=i;this._editorGroupsService=e;this._activePanel=i.getActivePaneComposite(1)?.getId()}async restore(i,e){if(i&&(typeof this._activePanel=="string"?await this._paneCompositeService.openPaneComposite(this._activePanel,1):this._paneCompositeService.hideActivePaneComposite(1)),e)for(let t of this._editorGroupsService.groups){let o=[];for(let n of t.editors)po.getCanonicalUri(n,{supportSideBySide:1})?.scheme===zm.Schema&&o.push(n);o.length&&t.closeEditors(o,{preserveFocus:!0})}}};gut=I([m(0,Es),m(1,kt)],gut);var k6t=class{constructor(i,e=new qe){this.uxState=i;this.cts=e}},G_=class{constructor(i,e,t,o,n,r){this._paneCompositeService=i;this._viewsService=e;this._editorGroupsService=t;this._dialogService=o;n.setPreviewHandler(s=>this._previewEdit(s)),this._ctxEnabled=G_.ctxEnabled.bindTo(r)}static{this.ID="workbench.contrib.bulkEditPreview"}static{this.ctxEnabled=new Y("refactorPreview.enabled",!1)}async _previewEdit(i){this._ctxEnabled.set(!0);let e=this._activeSession?.uxState??new gut(this._paneCompositeService,this._editorGroupsService),t=await TSe(this._viewsService);if(!t)return this._ctxEnabled.set(!1),i;if(t.hasInput()){let{confirmed:n}=await this._dialogService.confirm({type:wt.Info,message:d(6230,null),detail:d(6226,null),primaryButton:d(6225,null)});if(!n)return[]}let o;this._activeSession?(await this._activeSession.uxState.restore(!1,!0),this._activeSession.cts.dispose(!0),o=new k6t(e)):o=new k6t(e),this._activeSession=o;try{return await t.setInput(i,o.cts.token)??[]}finally{this._activeSession===o&&(await this._activeSession.uxState.restore(!0,!0),this._activeSession.cts.dispose(),this._ctxEnabled.set(!1),this._activeSession=void 0)}}};G_=I([m(0,Es),m(1,Gt),m(2,kt),m(3,ct),m(4,Ka),m(5,X)],G_);W(class extends z{constructor(){super({id:"refactorPreview.apply",title:P(6223,"Apply Refactoring"),category:P(6224,"Refactor Preview"),icon:L.check,precondition:C.and(G_.ctxEnabled,zm.ctxHasCheckedChanges),menu:[{id:R.BulkEditContext,order:1}],keybinding:{weight:90,when:C.and(G_.ctxEnabled,rc.isEqualTo(zm.ID)),primary:2051}})}async run(i){let e=i.get(Gt);(await TSe(e))?.accept()}});W(class extends z{constructor(){super({id:"refactorPreview.discard",title:P(6227,"Discard Refactoring"),category:P(6224,"Refactor Preview"),icon:L.clearAll,precondition:G_.ctxEnabled,menu:[{id:R.BulkEditContext,order:2}]})}async run(i){let e=i.get(Gt);(await TSe(e))?.discard()}});W(class extends z{constructor(){super({id:"refactorPreview.toggleCheckedState",title:P(6233,"Toggle Change"),category:P(6224,"Refactor Preview"),precondition:G_.ctxEnabled,keybinding:{weight:200,when:Nc,primary:10},menu:{id:R.BulkEditContext,group:"navigation"}})}async run(i){let e=i.get(Gt);(await TSe(e))?.toggleChecked()}});W(class extends z{constructor(){super({id:"refactorPreview.groupByFile",title:P(6228,"Group Changes By File"),category:P(6224,"Refactor Preview"),icon:L.ungroupByRefType,precondition:C.and(zm.ctxHasCategories,zm.ctxGroupByFile.negate(),G_.ctxEnabled),menu:[{id:R.BulkEditTitle,when:C.and(zm.ctxHasCategories,zm.ctxGroupByFile.negate()),group:"navigation",order:3}]})}async run(i){let e=i.get(Gt);(await TSe(e))?.groupByFile()}});W(class extends z{constructor(){super({id:"refactorPreview.groupByType",title:P(6229,"Group Changes By Type"),category:P(6224,"Refactor Preview"),icon:L.groupByRefType,precondition:C.and(zm.ctxHasCategories,zm.ctxGroupByFile,G_.ctxEnabled),menu:[{id:R.BulkEditTitle,when:C.and(zm.ctxHasCategories,zm.ctxGroupByFile),group:"navigation",order:3}]})}async run(i){let e=i.get(Gt);(await TSe(e))?.groupByType()}});W(class extends z{constructor(){super({id:"refactorPreview.toggleGrouping",title:P(6229,"Group Changes By Type"),category:P(6224,"Refactor Preview"),icon:L.listTree,toggled:zm.ctxGroupByFile.negate(),precondition:C.and(zm.ctxHasCategories,G_.ctxEnabled),menu:[{id:R.BulkEditContext,order:3}]})}async run(i){let e=i.get(Gt);(await TSe(e))?.toggleGrouping()}});bt(G_.ID,G_,vt.BlockRestore);var wNo=Oe("refactor-preview-view-icon",L.lightbulb,d(6232,null)),ixn=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:zm.ID,title:P(6231,"Refactor Preview"),hideIfEmpty:!0,ctorDescriptor:new Vt(Qc,[zm.ID,{mergeViewWithContainerWhenSingleView:!0}]),icon:wNo,storageId:zm.ID},1);oe.as(Kn.ViewsRegistry).registerViews([{id:zm.ID,name:P(6231,"Refactor Preview"),when:G_.ctxEnabled,ctorDescriptor:new Vt(zm),containerIcon:wNo}],ixn);function oxn(a){if(a.isUndoing||a.isRedoing||a.isFlush)return!1;for(let i of a.detailedReasons)if(!rxn(i))return!1;return a.detailedReasons.length>0}var nxn=new Set(["type","paste","cut","executeCommands","executeCommand","compositionType","compositionEnd"]);function rxn(a){let i=a.metadata;if(i.source!=="cursor")return!1;let e=i.kind;return nxn.has(e)}var r1i=class extends k{constructor(e){super();this._model=e;this._trackedWord=De(this,void 0);this.trackedWord=this._trackedWord;this._capturedWord=void 0;this._lastWordBeforeEdit=void 0;this._pendingContentChange=!1;this._lastCursorPosition=void 0;this._register(this._model.onDidChangeContent(t=>{if(!oxn(t)){let o=this._lastCursorPosition;this.reset(),o!==void 0&&o.lineNumber<=this._model.getLineCount()&&this.updateCursorPosition(o);return}this._pendingContentChange=!0}))}updateCursorPosition(e){this._lastCursorPosition=e;let t=this._model.getWordAtPosition(e);if(!t){this._lastWordBeforeEdit=void 0,this._pendingContentChange=!1;return}if(this._isPositionInComment(e)){this._lastWordBeforeEdit=void 0,this._pendingContentChange=!1;return}let o={word:t.word,range:new G(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn),position:e},n=this._pendingContentChange;if(this._pendingContentChange=!1,!n){this._lastWordBeforeEdit=o;return}if(!this._capturedWord){let l=this._lastWordBeforeEdit??o;this._capturedWord={...l},this._trackedWord.set({model:this._model,originalWord:l.word,originalPosition:l.position,originalRange:l.range,currentWord:o.word,currentRange:o.range},void 0),this._lastWordBeforeEdit=o;return}let r=this._capturedWord;if(this._rangesOverlap(r.range,o.range)||this._isAdjacent(r.range,o.range))this._trackedWord.set({model:this._model,originalWord:r.word,originalPosition:r.position,originalRange:r.range,currentWord:o.word,currentRange:o.range},void 0);else{let l=this._lastWordBeforeEdit??o;this._capturedWord={...l},this._trackedWord.set({model:this._model,originalWord:l.word,originalPosition:l.position,originalRange:l.range,currentWord:o.word,currentRange:o.range},void 0)}this._lastWordBeforeEdit=o}reset(){this._trackedWord.set(void 0,void 0),this._capturedWord=void 0,this._lastWordBeforeEdit=void 0,this._pendingContentChange=!1,this._lastCursorPosition=void 0}_isPositionInComment(e){this._model.tokenization.tokenizeIfCheap(e.lineNumber);let t=this._model.tokenization.getLineTokens(e.lineNumber),o=t.findTokenIndexAtOffset(e.column-1);return t.getStandardTokenType(o)===1}_rangesOverlap(e,t){return e.startLineNumber!==t.startLineNumber?!1:!(e.endColumn<t.startColumn||t.endColumn<e.startColumn)}_isAdjacent(e,t){return e.startLineNumber!==t.startLineNumber?!1:e.endColumn===t.startColumn||t.endColumn===e.startColumn}},fut=class extends k{constructor(e,t){super();this._codeEditorService=e;this._modelService=t;this._modelTrackers=new Map;this._editorFocusTrackingDisposables=new Map;this._focusedModelTracker=De(this,void 0);this.trackedWord=ke(this,e=>this._focusedModelTracker.read(e)?.trackedWord.read(e));for(let o of this._codeEditorService.listCodeEditors())this._setupEditorTracking(o);this._register(this._codeEditorService.onCodeEditorAdd(o=>{this._setupEditorTracking(o)})),this._register(this._codeEditorService.onCodeEditorRemove(o=>{let n=this._editorFocusTrackingDisposables.get(o);n&&(n.dispose(),this._editorFocusTrackingDisposables.delete(o))})),this._register(this._modelService.onModelRemoved(o=>{let n=this._modelTrackers.get(o);n&&(n.dispose(),this._modelTrackers.delete(o))}))}_setupEditorTracking(e){if(!e.isSimpleWidget&&!this._editorFocusTrackingDisposables.has(e)){let t=Ds(e),o=ve(n=>{let r=t.isFocused.read(n),s=t.model.read(n),l=t.cursorPosition.read(n);if(!r||!s)return;let c=this._modelTrackers.get(s);c||(c=new r1i(s),this._modelTrackers.set(s,c)),this._focusedModelTracker.read(void 0)!==c&&this._focusedModelTracker.set(c,void 0),l&&c.updateCursorPosition(l)});this._editorFocusTrackingDisposables.set(e,o)}}dispose(){for(let e of this._modelTrackers.values())e.dispose();this._modelTrackers.clear();for(let e of this._editorFocusTrackingDisposables.values())e.dispose();this._editorFocusTrackingDisposables.clear(),super.dispose()}};fut=I([m(0,Qt),m(1,_t)],fut);Ce(B_t,fut,1);var E6t=le("notebookSearchService");var vut=class{constructor(i,e,t){this._hasParameters=!1;this._replacePattern=i;let o,n;typeof e=="boolean"?(n=e,this._regExp=t):(o=e,n=!!o.isRegExp,this._regExp=Yj(o.pattern,!!o.isRegExp,{matchCase:o.isCaseSensitive,wholeWord:o.isWordMatch,multiline:o.isMultiline,global:!1,unicode:!0})),n&&this.parseReplaceString(i),this._regExp.global&&(this._regExp=Yj(this._regExp.source,!0,{matchCase:!this._regExp.ignoreCase,wholeWord:!1,multiline:this._regExp.multiline,global:!1})),this._caseOpsRegExp=new RegExp(/([\s\S]*?)((?:\\[uUlL])+?|)(\$[0-9]+)([\s\S]*?)/g)}get hasParameters(){return this._hasParameters}get pattern(){return this._replacePattern}get regExp(){return this._regExp}getReplaceString(i,e){this._regExp.lastIndex=0;let t=this._regExp.exec(i);if(t){if(this.hasParameters){let o=this.replaceWithCaseOperations(i,this._regExp,this.buildReplaceString(t,e));return t[0]===i?o:o.substr(t.index,t[0].length-(i.length-o.length))}return this.buildReplaceString(t,e)}return null}replaceWithCaseOperations(i,e,t){if(!/\\[uUlL]/.test(t))return i.replace(e,t);let o=e.exec(i);if(o===null)return i.replace(e,t);let n,r="",s=0,l="";for(;(n=this._caseOpsRegExp.exec(t))!==null;){s=n.index;let c=n[0];l=c;let u=n[2],p=n[3];if(!u){r+=c;continue}let h=o[parseInt(p.slice(1))];if(!h){r+=c;continue}let g=h.length;r+=n[1],u=u.replace(/\\/g,"");let f=0;for(;f<u.length;f++)switch(u[f]){case"U":r+=h.slice(f).toUpperCase(),f=g;break;case"u":r+=h[f].toUpperCase();break;case"L":r+=h.slice(f).toLowerCase(),f=g;break;case"l":r+=h[f].toLowerCase();break}f<g&&(r+=h.slice(f)),r+=n[4]}return r+=t.slice(s+l.length),i.replace(e,r)}buildReplaceString(i,e){return e?s6e(i,this._replacePattern):this._replacePattern}parseReplaceString(i){if(!i||i.length===0)return;let e=0,t="";for(let o=0,n=i.length;o<n;o++){let r=i.charCodeAt(o);if(r===92){if(o++,o>=n)break;let s=i.charCodeAt(o),l=null;switch(s){case 92:l="\\";break;case 110:l=`
`;break;case 116:l="	";break}l&&(t+=i.substring(e,o-1)+l,e=o+1)}if(r===36){if(o++,o>=n)break;let s=i.charCodeAt(o),l=null;switch(s){case 48:l="$&",this._hasParameters=!0;break;case 96:case 39:this._hasParameters=!0;break;default:{if(!this.between(s,49,57))break;if(o===i.length-1){this._hasParameters=!0;break}let c=i.charCodeAt(++o);if(!this.between(c,48,57)){this._hasParameters=!0,--o;break}if(o===i.length-1){this._hasParameters=!0;break}if(c=i.charCodeAt(++o),!this.between(c,48,57)){this._hasParameters=!0,--o;break}break}}l&&(t+=i.substring(e,o-1)+l,e=o+1)}}e!==0&&(this._replacePattern=t+i.substring(e))}between(i,e,t){return e<=i&&i<=t}};var Oze=class extends k{constructor(e,t,o,n){super();this.searchModel=e;this.instantiationService=t;this.modelService=o;this.notebookEditorService=n;this._onChange=this._register(new Ih({merge:w5t}));this.onChange=this._onChange.event;this._plainTextSearchResult=this._register(this.instantiationService.createInstance(QHe,this)),this._aiTextSearchResult=this._register(this.instantiationService.createInstance(C9,this)),this._register(this._plainTextSearchResult.onChange(r=>this._onChange.fire(r))),this._register(this._aiTextSearchResult.onChange(r=>this._onChange.fire(r))),this.modelService.getModels().forEach(r=>this.onModelAdded(r)),this._register(this.modelService.onModelAdded(r=>this.onModelAdded(r))),this._register(this.notebookEditorService.onDidAddNotebookEditor(r=>{r instanceof Lq&&this.onDidAddNotebookEditorWidget(r)})),this._id=NFi+Date.now().toString()}id(){return this._id}get plainTextSearchResult(){return this._plainTextSearchResult}get aiTextSearchResult(){return this._aiTextSearchResult}get children(){return this.textSearchResults}get hasChildren(){return!0}get textSearchResults(){return[this._plainTextSearchResult,this._aiTextSearchResult]}async batchReplace(e){try{this._onChange.pause(),await Promise.all(e.map(async t=>{let o=t.parent();(ru(o)||Bl(o))&&G6(o,e)||(Bl(t)?await t.parent().replace(t):pl(t)?await t.parent().replace(t):ru(t)&&await t.replaceAll())}))}finally{this._onChange.resume()}}batchRemove(e){let t=[];try{this._onChange.pause(),e.forEach(o=>{if(!G6(o,t)){if(Pv(o))o.hide();else if(!ru(o)||q6(o)||TV(o)){if(Bl(o))o.parent().remove(o);else if(pl(o))o.parent().remove(o);else if(q6(o))o.parent().remove(o);else if(TV(o)){let n=o.parent();Pv(n)&&n.remove(o)}t.push(o)}}})}finally{this._onChange.resume()}}get isDirty(){return this._aiTextSearchResult.isDirty||this._plainTextSearchResult.isDirty}get query(){return this._plainTextSearchResult.query}set query(e){this._plainTextSearchResult.query=e}setAIQueryUsingTextQuery(e){e||(e=this.query),this.aiTextSearchResult.query=sxn(e)}onDidAddNotebookEditorWidget(e){this._onWillChangeModelListener?.dispose(),this._onWillChangeModelListener=e.onWillChangeModel(t=>{t&&this.onNotebookEditorWidgetRemoved(e,t?.uri)}),this._onDidChangeModelListener?.dispose(),this._onDidChangeModelListener=e.onDidAttachViewModel(()=>{e.hasModel()&&this.onNotebookEditorWidgetAdded(e,e.textModel.uri)})}folderMatches(e=!1){return e?this._aiTextSearchResult.folderMatches():this._plainTextSearchResult.folderMatches()}onModelAdded(e){this._plainTextSearchResult.findFolderSubstr(e.uri)?.bindModel(e)}async onNotebookEditorWidgetAdded(e,t){await this._plainTextSearchResult.findFolderSubstr(t)?.bindNotebookEditorWidget(e,t)}onNotebookEditorWidgetRemoved(e,t){this._plainTextSearchResult.findFolderSubstr(t)?.unbindNotebookEditorWidget(e,t)}add(e,t,o,n=!1){this._plainTextSearchResult.hidden=!1,o?this._aiTextSearchResult.add(e,t,n):this._plainTextSearchResult.add(e,t,n)}clear(){this._plainTextSearchResult.clear(),this._aiTextSearchResult.clear()}remove(e,t=!1){t&&this._aiTextSearchResult.remove(e,t),this._plainTextSearchResult.remove(e,t)}replace(e){return this._plainTextSearchResult.replace(e)}matches(e){return e===void 0?this._plainTextSearchResult.matches().concat(this._aiTextSearchResult.matches()):e===!0?this._aiTextSearchResult.matches():this._plainTextSearchResult.matches()}isEmpty(){return this._plainTextSearchResult.isEmpty()&&this._aiTextSearchResult.isEmpty()}fileCount(e=!1){return e?this._plainTextSearchResult.fileCount():this._plainTextSearchResult.fileCount()+this._aiTextSearchResult.fileCount()}count(e=!1){return e?this._plainTextSearchResult.count():this._plainTextSearchResult.count()+this._aiTextSearchResult.count()}setCachedSearchComplete(e,t){t?this._aiTextSearchResult.cachedSearchComplete=e:this._plainTextSearchResult.cachedSearchComplete=e}getCachedSearchComplete(e){return e?this._aiTextSearchResult.cachedSearchComplete:this._plainTextSearchResult.cachedSearchComplete}toggleHighlights(e,t=!1){t?this._aiTextSearchResult.toggleHighlights(e):this._plainTextSearchResult.toggleHighlights(e)}getRangeHighlightDecorations(e=!1){return e?this._aiTextSearchResult.rangeHighlightDecorations:this._plainTextSearchResult.rangeHighlightDecorations}replaceAll(e){return this._plainTextSearchResult.replaceAll(e)}async dispose(){this._aiTextSearchResult?.dispose(),this._plainTextSearchResult?.dispose(),this._onWillChangeModelListener?.dispose(),this._onDidChangeModelListener?.dispose(),super.dispose()}};Oze=I([m(1,F),m(2,_t),m(3,hd)],Oze);function sxn(a){return a===null?null:{...a,contentPattern:a.contentPattern.pattern,type:3}}var Q$=class extends k{constructor(e,t,o,n,r,s){super();this.searchService=e;this.telemetryService=t;this.configurationService=o;this.instantiationService=n;this.logService=r;this.notebookSearchService=s;this._searchQuery=null;this._replaceActive=!1;this._replaceString=null;this._replacePattern=null;this._preserveCase=!1;this._startStreamDelay=Promise.resolve();this._resultQueue=[];this._aiResultQueue=[];this._onReplaceTermChanged=this._register(new T);this.onReplaceTermChanged=this._onReplaceTermChanged.event;this._onSearchResultChanged=this._register(new Ih({merge:w5t}));this.onSearchResultChanged=this._onSearchResultChanged.event;this.currentCancelTokenSource=null;this.currentAICancelTokenSource=null;this.searchCancelledForNewSearch=!1;this.aiSearchCancelledForNewSearch=!1;this.location=0;this._searchResult=this.instantiationService.createInstance(Oze,this),this._register(this._searchResult.onChange(l=>this._onSearchResultChanged.fire(l))),this._aiTextResultProviderName=new uo(async()=>this.searchService.getAIName()),this._id=O_o+Date.now().toString()}id(){return this._id}async getAITextResultProviderName(){let e=await this._aiTextResultProviderName.value;if(!e)throw Error("Fetching AI name when no provider present.");return e}isReplaceActive(){return this._replaceActive}set replaceActive(e){this._replaceActive=e}get replacePattern(){return this._replacePattern}get replaceString(){return this._replaceString||""}set preserveCase(e){this._preserveCase=e}get preserveCase(){return this._preserveCase}set replaceString(e){this._replaceString=e,this._searchQuery&&(this._replacePattern=new vut(e,this._searchQuery.contentPattern)),this._onReplaceTermChanged.fire()}get searchResult(){return this._searchResult}aiSearch(e){if(this.hasAIResults)throw Error("AI results already exist");if(!this._searchQuery)throw Error("No search query");let t=Date.now().toString(),o=new qe;this.currentAICancelTokenSource=o;let n=Date.now();return this.searchService.aiTextSearch({...this._searchQuery,contentPattern:this._searchQuery.contentPattern.pattern,type:3},o.token,async s=>{e(s),this.onSearchProgress(s,t,!1,!0)}).finally(()=>{o.dispose(!0)}).then(s=>(s.results.length===0&&e(void 0),this.onSearchCompleted(s,Date.now()-n,t,!0),s),s=>{throw this.onSearchError(s,Date.now()-n,!0),s})}doSearch(e,t,o,n,r,s){let l=async v=>{t.fire(),this.onSearchProgress(v,n,!1,!1),r?.(v)},c=v=>{t.fire(),this.onSearchProgress(v,n,!0),r?.(v)},u=this.currentCancelTokenSource=new qe(s),p=this.notebookSearchService.notebookSearch(e,u.token,n,l),h=this.searchService.textSearchSplitSyncAsync(o,u.token,l,p.openFilesToScan,p.allScannedFiles),g=h.syncResults.results;return g.forEach(v=>{v&&c(v)}),{asyncResults:(async()=>{let v=Date.now(),b=await h.asyncResults,S=await p.completeData,y=Date.now()-v,w={results:[...b.results,...S.results],messages:[...b.messages,...S.messages],limitHit:b.limitHit||S.limitHit,exit:b.exit,stats:b.stats};return this.logService.trace(`whole search time | ${y}ms`),w})().finally(()=>u.dispose(!0)),syncResults:g}}get hasAIResults(){return!!this.searchResult.getCachedSearchComplete(!0)||!!this.currentAICancelTokenSource&&!this.currentAICancelTokenSource.token.isCancellationRequested}get hasPlainResults(){return!!this.searchResult.getCachedSearchComplete(!1)||!!this.currentCancelTokenSource&&!this.currentCancelTokenSource.token.isCancellationRequested}search(e,t,o){this.cancelSearch(!0),this._searchQuery=e,this.searchConfig.searchOnType||this.searchResult.clear();let n=Date.now().toString();this._searchResult.query=this._searchQuery;let r=this._register(new T);this._replacePattern=new vut(this.replaceString,this._searchQuery.contentPattern),this._startStreamDelay=new Promise(g=>setTimeout(g,this.searchConfig.searchOnType?150:0));let s=this.doSearch(e,r,this._searchQuery,n,t,o),l=s.asyncResults,c=s.syncResults;t&&c.forEach(g=>{g&&t(g)});let u=Date.now(),p,h=new Promise(g=>(p=U.once(r.event)(g),p));Promise.race([l,h]).finally(()=>{p?.dispose(),this.telemetryService.publicLog("searchResultsFirstRender",{duration:Date.now()-u})});try{return{asyncResults:l.then(g=>(this.onSearchCompleted(g,Date.now()-u,n,!1),g),g=>{throw this.onSearchError(g,Date.now()-u,!1),g}),syncResults:c}}finally{this.telemetryService.publicLog("searchResultsFinished",{duration:Date.now()-u})}}onSearchCompleted(e,t,o,n){if(!this._searchQuery)throw new Error("onSearchCompleted must be called after a search is started");n?(this._searchResult.add(this._aiResultQueue,o,!0),this._aiResultQueue.length=0):(this._searchResult.add(this._resultQueue,o,!1),this._resultQueue.length=0),this.searchResult.setCachedSearchComplete(e,n);let r=Object.assign({},this._searchQuery.contentPattern);delete r.pattern;let s=e&&e.stats,l=this._searchQuery.folderQueries.every(p=>p.folder.scheme===Q.file),c=this._searchQuery.folderQueries.every(p=>p.folder.scheme!==Q.file),u=l?Q.file:c?"other":"mixed";return this.telemetryService.publicLog("searchResultsShown",{count:this._searchResult.count(),fileCount:this._searchResult.fileCount(),options:r,duration:t,type:s&&s.type,scheme:u,searchOnTypeEnabled:this.searchConfig.searchOnType}),e}onSearchError(e,t,o){Yi(e)&&(this.onSearchCompleted((o?this.aiSearchCancelledForNewSearch:this.searchCancelledForNewSearch)?{exit:1,results:[],messages:[]}:void 0,t,"",o),o?this.aiSearchCancelledForNewSearch=!1:this.searchCancelledForNewSearch=!1)}onSearchProgress(e,t,o=!0,n=!1){let r=n?this._aiResultQueue:this._resultQueue;e.resource&&(r.push(e),o?r.length&&(this._searchResult.add(r,t,!1,!0),r.length=0):this._startStreamDelay.then(()=>{r.length&&(this._searchResult.add(r,t,n,!n),r.length=0)}))}get searchConfig(){return this.configurationService.getValue("search")}cancelSearch(e=!1){return this.currentCancelTokenSource?(this.searchCancelledForNewSearch=e,this.currentCancelTokenSource.cancel(),!0):!1}cancelAISearch(e=!1){return this.currentAICancelTokenSource?(this.aiSearchCancelledForNewSearch=e,this.currentAICancelTokenSource.cancel(),!0):!1}clearAiSearchResults(){this._aiResultQueue.length=0,this._searchResult.aiTextSearchResult.clear(!1)}dispose(){this.cancelSearch(),this.cancelAISearch(),this.searchResult.dispose(),super.dispose()}};Q$=I([m(0,Gg),m(1,_e),m(2,B),m(3,F),m(4,re),m(5,E6t)],Q$);var Fze=class{constructor(i){this.instantiationService=i;this._searchModel=null}get searchModel(){return this._searchModel||(this._searchModel=this.instantiationService.createInstance(Q$)),this._searchModel}set searchModel(i){this._searchModel?.dispose(),this._searchModel=i}};Fze=I([m(0,F)],Fze);W(class extends z{constructor(){super({id:"search.action.copyMatch",title:P(15149,"Copy"),category:Hl,keybinding:{weight:200,when:Ri.FileMatchOrMatchFocusKey,primary:2081},menu:[{id:R.SearchContext,when:Ri.FileMatchOrMatchFocusKey,group:"search_2",order:1}]})}async run(i,e){await lxn(i,e)}});W(class extends z{constructor(){super({id:"search.action.copyPath",title:P(15150,"Copy Path"),category:Hl,keybinding:{weight:200,when:Ri.FileMatchOrFolderMatchWithResourceFocusKey,primary:2593,win:{primary:1569}},menu:[{id:R.SearchContext,when:Ri.FileMatchOrFolderMatchWithResourceFocusKey,group:"search_2",order:2}]})}async run(i,e){await axn(i,e)}});W(class extends z{constructor(){super({id:"search.action.copyAll",title:P(15148,"Copy All"),category:Hl,menu:[{id:R.SearchContext,when:Ri.HasSearchResults,group:"search_2",order:3}]})}async run(i,e){await cxn(i,e)}});W(class extends z{constructor(){super({id:"search.action.getSearchResults",title:P(15151,"Get Search Results"),category:Hl,f1:!1})}async run(i){let e=i.get(Gt),t=i.get(nt),o=vd(e);if(o){let n=o.searchResult,r=s1i(n.folderMatches(),t),s=s1i(n.folderMatches(!0),t);return`${r}${mse}${mse}${s}`}}});var mse=ii?`\r
`:`
`;async function axn(a,i){if(!i){let n=l1i(a);if(!Bl(n)||q6(n))return;i=n}let e=a.get(Bi),o=a.get(nt).getUriLabel(i.resource,{noPrefix:!0});await e.writeText(o)}async function lxn(a,i){if(!i){let n=l1i(a);if(!n)return;i=n}let e=a.get(Bi),t=a.get(nt),o;pl(i)?o=CNo(i):Bl(i)?o=xNo(i,t).text:ru(i)&&(o=a1i(i,t).text),o&&await e.writeText(o)}async function cxn(a,i){let e=a.get(Gt),t=a.get(Bi),o=a.get(nt),n=vd(e);if(n){let r=n.searchResult,s=uxn(i);i||(i=l1i(a));let l=s1i(r.folderMatches(s),o);await t.writeText(l)}}function CNo(a,i=0){let e=()=>`${a.range().startLineNumber},${a.range().startColumn}`,t=s=>a.range().startLineNumber+s+"",o=a.fullPreviewLines(),n=o.reduce((s,l,c)=>{let u=c===0?e().length:t(c).length;return Math.max(u,s)},0);return o.map((s,l)=>{let c=l===0?e():t(l),u=" ".repeat(n-c.length);return`${" ".repeat(i)}${c}: ${u}${s}`}).join(`
`)}function dxn(a,i){return Bl(a)?xNo(a,i):a1i(a,i)}function xNo(a,i){let e=a.matches().sort(TO).map(o=>CNo(o,2));return{text:`${i.getUriLabel(a.resource,{noPrefix:!0})}${mse}${e.join(mse)}`,count:e.length}}function a1i(a,i){let e=[],t=0;return a.matches().sort(TO).forEach(n=>{let r=dxn(n,i);t+=r.count,e.push(r.text)}),{text:e.join(mse+mse),count:t}}function s1i(a,i){let e=[];a=a.sort(TO);for(let t=0;t<a.length;t++){let o=a1i(a[t],i);o.count&&e.push(o.text)}return e.join(mse+mse)}function l1i(a){let i=a.get(Gt);return vd(i)?.getControl().getSelection()[0]}function uxn(a){return a?pl(a)?a.parent().parent().isAIContributed():Bl(a)?a.parent().isAIContributed():ru(a)?a.isAIContributed():Pv(a)?a.isAIContributed:!1:!1}W(class extends z{constructor(){super({id:"search.action.restrictSearchToFolder",title:P(15161,"Restrict Search to Folder"),category:Hl,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.ResourceFolderFocusKey),primary:1572},menu:[{id:R.SearchContext,group:"search",order:3,when:C.and(Ri.ResourceFolderFocusKey)}]})}async run(i,e){await c1i(i,!1,!0,void 0,e)}});W(class extends z{constructor(){super({id:"search.action.expandRecursively",title:d(15163,null),category:Hl,menu:[{id:R.SearchContext,when:C.and(Ri.FolderFocusKey,Ri.HasSearchResults),group:"search",order:4}]})}async run(i){return pxn(i)}});W(class extends z{constructor(){super({id:"search.action.excludeFromSearch",title:P(15153,"Exclude Folder from Search"),category:Hl,menu:[{id:R.SearchContext,group:"search",order:4,when:Ri.ResourceFolderFocusKey}]})}async run(i,e){await c1i(i,!1,!1,void 0,e)}});W(class extends z{constructor(){super({id:"search.action.excludeFileTypeFromSearch",title:P(15152,"Exclude File Type from Search"),category:Hl,menu:[{id:R.SearchContext,group:"search",order:5,when:Ri.FileFocusKey}]})}async run(i,e){await kNo(i,e,!0)}});W(class extends z{constructor(){super({id:"search.action.includeFileTypeInSearch",title:P(15159,"Include File Type from Search"),category:Hl,menu:[{id:R.SearchContext,group:"search",order:6,when:Ri.FileFocusKey}]})}async run(i,e){await kNo(i,e,!1)}});W(class extends z{constructor(){super({id:"search.action.revealInSideBar",title:P(15162,"Reveal in Explorer View"),category:Hl,menu:[{id:R.SearchContext,when:C.and(Ri.FileFocusKey,Ri.HasSearchResults),group:"search_3",order:1}]})}async run(i,e){let t=i.get(Es),o=i.get(Qa),n=i.get(Ae),r=vd(i.get(Gt));if(!r)return;let s;if(Bl(e))s=e;else{e=r.getControl().getFocus()[0];return}t.openPaneComposite(Dv,0,!1).then(l=>{if(!l)return;let c=l.getViewPaneContainer(),u=s.resource;if(u&&n.isInsideWorkspace(u)){let p=c.getExplorerView();p.setExpanded(!0),o.select(u,!0).then(()=>p.focus(),mt)}})}});W(class extends z{constructor(){super({id:"workbench.action.findInFiles",title:{...P(15154,"Find in Files"),mnemonicTitle:d(15160,null)},metadata:{description:d(15156,null),args:[{name:d(15155,null),schema:{type:"object",properties:{query:{type:"string"},replace:{type:"string"},preserveCase:{type:"boolean"},triggerSearch:{type:"boolean"},filesToInclude:{type:"string"},filesToExclude:{type:"string"},isRegex:{type:"boolean"},isCaseSensitive:{type:"boolean"},matchWholeWord:{type:"boolean"},useExcludeSettingsAndIgnoreFiles:{type:"boolean"},onlyOpenEditors:{type:"boolean"},showIncludesExcludes:{type:"boolean"}}}}]},category:Hl,keybinding:{weight:200,primary:3108},menu:[{id:R.MenubarEditMenu,group:"4_find_global",order:1,when:qo.negate()}],f1:!0,precondition:qo.negate()})}async run(i,e={}){a3t(i,e)}});W(class extends z{constructor(){super({id:"filesExplorer.findInFolder",title:P(15157,"Find in Folder..."),category:Hl,keybinding:{weight:200,when:C.and(rk,gu),primary:1572},menu:[{id:R.ExplorerContext,group:"4_search",order:10,when:gu}]})}async run(i,e){await c1i(i,!0,!0,e)}});W(class extends z{constructor(){super({id:"filesExplorer.findInWorkspace",title:P(15158,"Find in Workspace..."),category:Hl,menu:[{id:R.ExplorerContext,group:"4_search",order:10,when:C.and(nk,gu.toNegated())}]})}async run(i){let t=i.get(B).getValue().search?.mode;t==="view"?(await I9(i.get(Gt),!0))?.searchInFolders():await i.get(fe).executeCommand(Cre,{location:t==="newEditor"?"new":"reuse",filesToInclude:""})}});async function pxn(a){let i=a.get(Gt),e=vd(i);if(e){let t=e.getControl(),o=t.getFocus()[0];await YHe(t,o)}}function mxn(a){let i=a.split(".");return i.length<=1?a:`*.${i.slice(1).join(".")}`}function hxn(a,i){return a.trim()?a.split(",").map(t=>t.trim()).filter(t=>t.length>0).includes(i)?a:`${a}, ${i}`:i}async function c1i(a,i,e,t,o){let n=a.get(ge),r=a.get(Gt),s=a.get(Ae),l=a.get(fe),c=a.get(B).getValue().search,u=c?.mode,p;if(i)p=lV(t,a.get(Co),a.get(ie),a.get(kt),a.get(Qa));else{let g=vd(r);if(!g)return;p=gxn(g.getControl(),o,c)}let h=n.resolveAll(p.map(g=>({resource:g}))).then(g=>{let f=[];return g.forEach(v=>{v.success&&v.stat&&f.push(v.stat.isDirectory?v.stat.resource:ai(v.stat.resource))}),upo(f,s)});if(u==="view"){let g=await I9(r,!0);p&&p.length&&g&&(e?g.searchInFolders(await h):g.searchOutsideOfFolders(await h));return}else return e?l.executeCommand(Cre,{filesToInclude:(await h).join(", "),showIncludesExcludes:!0,location:u==="newEditor"?"new":"reuse"}):l.executeCommand(Cre,{filesToExclude:(await h).join(", "),showIncludesExcludes:!0,location:u==="newEditor"?"new":"reuse"})}function gxn(a,i,e){return wct(a,i,e).map(t=>pl(t)?null:t.resource).filter(t=>t!==null)}async function kNo(a,i,e){let t=a.get(Gt),o=vd(t);if(!o||!i)return;let r=i.resource.path.split("/").pop()||"",s=mxn(r),l=e?o.searchExcludePattern:o.searchIncludePattern,c=l.getValue(),u=hxn(c,s);u!==c&&(l.setValue(u),o.toggleQueryDetails(!1,!0),o.triggerQueryChange({preserveFocus:!1}))}W(class extends z{constructor(){super({id:"workbench.action.search.toggleQueryDetails",title:P(15177,"Toggle Query Details"),category:Hl,keybinding:{weight:200,when:C.or(Ri.SearchViewFocusedKey,SS),primary:3112}})}run(i,...e){let t=e[0],o=i.get(X).getContext(Un());if(o.getValue(SS.serialize()))i.get(ie).activeEditorPane.toggleQueryDetails(t?.show);else if(o.getValue(Ri.SearchViewFocusedKey.serialize())){let n=vd(i.get(Gt));Ti(n).toggleQueryDetails(void 0,t?.show)}}});W(class extends z{constructor(){super({id:"closeReplaceInFilesWidget",title:P(15165,"Close Replace Widget"),category:Hl,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.ReplaceInputBoxFocusedKey),primary:9}})}run(i){let e=vd(i.get(Gt));return e&&(e.searchAndReplaceWidget.toggleReplace(!1),e.searchAndReplaceWidget.focus()),Promise.resolve(null)}});W(class extends z{constructor(){super({id:"toggleSearchCaseSensitive",title:P(15175,"Toggle Case Sensitive"),category:Hl,keybinding:Object.assign({weight:200,when:et?C.and(Ri.SearchViewFocusedKey,Ri.FileMatchOrFolderMatchFocusKey.toNegated()):Ri.SearchViewFocusedKey},C4)})}async run(i){fxn(i)}});W(class extends z{constructor(){super({id:"toggleSearchWholeWord",title:P(15180,"Toggle Whole Word"),keybinding:Object.assign({weight:200,when:Ri.SearchViewFocusedKey},x4),category:Hl})}async run(i){return vxn(i)}});W(class extends z{constructor(){super({id:"toggleSearchRegex",title:P(15178,"Toggle Regex"),keybinding:Object.assign({weight:200,when:Ri.SearchViewFocusedKey},k4),category:Hl})}async run(i){return bxn(i)}});W(class extends z{constructor(){super({id:"toggleSearchPreserveCase",title:P(15176,"Toggle Preserve Case"),keybinding:Object.assign({weight:200,when:Ri.SearchViewFocusedKey},tue),category:Hl})}async run(i){return Sxn(i)}});W(class extends z{constructor(){super({id:"search.action.openResult",title:P(15172,"Open Match"),category:Hl,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.FileMatchOrMatchFocusKey),primary:3,mac:{primary:3,secondary:[2066]}}})}run(i){let e=vd(i.get(Gt));if(e){let t=e.getControl(),o=e.getControl(),n=t.getFocus()[0];ru(n)?o.toggleCollapsed(n):e.open(t.getFocus()[0],!1,!1,!0)}}});W(class extends z{constructor(){super({id:"search.action.openResultToSide",title:P(15173,"Open Match To Side"),category:Hl,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.FileMatchOrMatchFocusKey),primary:2051,mac:{primary:259}}})}run(i){let e=vd(i.get(Gt));if(e){let t=e.getControl();e.open(t.getFocus()[0],!1,!0,!0)}}});W(class extends z{constructor(){super({id:"addCursorsAtSearchResults",title:P(15164,"Add Cursors at Search Results"),keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.FileMatchOrMatchFocusKey),primary:3114},category:Hl})}async run(i){let e=vd(i.get(Gt));if(e){let t=e.getControl();e.openEditorWithMultiCursor(t.getFocus()[0])}}});W(class extends z{constructor(){super({id:"search.focus.nextInputBox",title:P(15166,"Focus Next Input"),category:Hl,keybinding:{weight:200,when:C.or(C.and(SS,Ri.InputBoxFocusedKey),C.and(Ri.SearchViewVisibleKey,Ri.InputBoxFocusedKey)),primary:2066}})}async run(i){let e=i.get(ie);e.activeEditor instanceof im&&e.activeEditorPane.focusNextInput(),vd(i.get(Gt))?.focusNextInputBox()}});W(class extends z{constructor(){super({id:"search.focus.previousInputBox",title:P(15168,"Focus Previous Input"),category:Hl,keybinding:{weight:200,when:C.or(C.and(SS,Ri.InputBoxFocusedKey),C.and(Ri.SearchViewVisibleKey,Ri.InputBoxFocusedKey,Ri.SearchInputBoxFocusedKey.toNegated())),primary:2064}})}async run(i){let e=i.get(ie);e.activeEditor instanceof im&&e.activeEditorPane.focusPrevInput(),vd(i.get(Gt))?.focusPreviousInputBox()}});W(class extends z{constructor(){super({id:"search.action.focusSearchFromResults",title:P(15170,"Focus Search From Results"),category:Hl,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,C.or(Ri.FirstMatchFocusKey,Oa)),primary:2064}})}run(i){vd(i.get(Gt))?.focusPreviousInputBox()}});W(class d1i extends z{static{this.searchOnTypeKey="search.searchOnType"}constructor(){super({id:"workbench.action.toggleSearchOnType",title:P(15179,"Toggle Search on Type"),category:Hl})}async run(i){let e=i.get(B),t=e.getValue(d1i.searchOnTypeKey);return e.updateValue(d1i.searchOnTypeKey,!t)}});W(class extends z{constructor(){super({id:"search.action.focusSearchList",title:P(15171,"Focus List"),category:Hl,f1:!0})}async run(i){Ixn(i)}});W(class extends z{constructor(){super({id:"search.action.focusNextSearchResult",title:P(15167,"Focus Next Search Result"),keybinding:[{primary:62,weight:200}],category:Hl,f1:!0,precondition:C.or(Ri.HasSearchResults,SS)})}async run(i){return await yxn(i)}});W(class extends z{constructor(){super({id:"search.action.focusPreviousSearchResult",title:P(15169,"Focus Previous Search Result"),keybinding:[{primary:1086,weight:200}],category:Hl,f1:!0,precondition:C.or(Ri.HasSearchResults,SS)})}async run(i){return await wxn(i)}});W(class extends z{constructor(){super({id:"workbench.action.replaceInFiles",title:P(15174,"Replace in Files"),keybinding:[{primary:3110,weight:200}],category:Hl,f1:!0,precondition:qo.negate(),menu:[{id:R.MenubarEditMenu,group:"4_find_global",order:2,when:qo.negate()}]})}async run(i){return await Cxn(i,!0)}});function fxn(a){vd(a.get(Gt))?.toggleCaseSensitive()}function vxn(a){vd(a.get(Gt))?.toggleWholeWords()}function bxn(a){vd(a.get(Gt))?.toggleRegex()}function Sxn(a){vd(a.get(Gt))?.togglePreserveCase()}var Ixn=a=>{let i=a.get(Gt);I9(i).then(e=>{e?.moveFocusToResults()})};async function yxn(a){let i=a.get(ie);return i.activeEditor instanceof im?i.activeEditorPane.focusNextResult():I9(a.get(Gt)).then(t=>t?.selectNextMatch())}async function wxn(a){let i=a.get(ie);return i.activeEditor instanceof im?i.activeEditorPane.focusPreviousResult():I9(a.get(Gt)).then(t=>t?.selectPreviousMatch())}async function Cxn(a,i){return I9(a.get(Gt),!1).then(e=>{if(e){e.searchAndReplaceWidget.toggleReplace(i);let o=e.updateTextFromFindWidgetOrSelection({allowUnselectedWord:!i});e.searchAndReplaceWidget.focus(void 0,o,o)}})}W(class extends z{constructor(){super({id:"search.action.remove",title:P(15183,"Dismiss"),category:Hl,icon:JLo,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.FileMatchOrMatchFocusKey),primary:20,mac:{primary:2049}},menu:[{id:R.SearchContext,group:"search",order:2},{id:R.SearchActionMenu,group:"inline",when:C.or(Ri.FileFocusKey,Ri.MatchFocusKey,Ri.FolderFocusKey),order:2}]})}async run(i,e){let t=i.get(Gt),o=i.get(B),n=vd(t);if(!n)return;let r=e?.element,s=e?.viewer;s||(s=n.getControl()),r||(r=s.getFocus()[0]??void 0);let l=wct(s,r,o.getValue("search")),c=s.getFocus()[0]??void 0;if(l.length===0)return;(!c||SO(c))&&(c=r);let u,p=cMo(l,c);c&&p&&(u=await ENo(s,c,l));let h=n.searchResult;h&&h.batchRemove(l),await n.queueRefreshTree(),c&&p?(u||(u=await TNo(s,c).catch(()=>{})),u&&!G6(u,l)&&(s.reveal(u),s.setFocus([u],GT()),s.setSelection([u],GT()))):eo(s.getFocus(),s.getSelection())||s.setSelection(s.getFocus()),s.domFocus()}});W(class extends z{constructor(){super({id:"search.action.replace",title:P(15182,"Replace"),category:Hl,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.ReplaceActiveKey,Ri.MatchFocusKey,Ri.IsEditableItemKey),primary:3094},icon:e3t,menu:[{id:R.SearchContext,when:C.and(Ri.ReplaceActiveKey,Ri.MatchFocusKey,Ri.IsEditableItemKey),group:"search",order:1},{id:R.SearchActionMenu,when:C.and(Ri.ReplaceActiveKey,Ri.MatchFocusKey,Ri.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return u1i(i,e)}});W(class extends z{constructor(){super({id:"search.action.replaceAllInFile",title:P(15181,"Replace All"),category:Hl,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.ReplaceActiveKey,Ri.FileFocusKey,Ri.IsEditableItemKey),primary:3094,secondary:[3075]},icon:e3t,menu:[{id:R.SearchContext,when:C.and(Ri.ReplaceActiveKey,Ri.FileFocusKey,Ri.IsEditableItemKey),group:"search",order:1},{id:R.SearchActionMenu,when:C.and(Ri.ReplaceActiveKey,Ri.FileFocusKey,Ri.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return u1i(i,e)}});W(class extends z{constructor(){super({id:"search.action.replaceAllInFolder",title:P(15181,"Replace All"),category:Hl,keybinding:{weight:200,when:C.and(Ri.SearchViewVisibleKey,Ri.ReplaceActiveKey,Ri.FolderFocusKey,Ri.IsEditableItemKey),primary:3094,secondary:[3075]},icon:e3t,menu:[{id:R.SearchContext,when:C.and(Ri.ReplaceActiveKey,Ri.FolderFocusKey,Ri.IsEditableItemKey),group:"search",order:1},{id:R.SearchActionMenu,when:C.and(Ri.ReplaceActiveKey,Ri.FolderFocusKey,Ri.IsEditableItemKey),group:"inline",order:1}]})}async run(i,e){return u1i(i,e)}});async function u1i(a,i){let e=a.get(B),t=a.get(Gt),o=a.get(F),n=vd(t),r=i?.viewer??n?.getControl();if(!r)return;let s=i?.element??r.getFocus()[0],l=wct(r,s??void 0,e.getValue("search")),c=r.getFocus()[0];if((!c||c&&!G6(c,l)||SO(c))&&(c=s),l.length===0)return;let u;c&&(u=await ENo(r,c,l));let p=n?.searchResult;p&&await p.batchReplace(l),await n?.queueRefreshTree(),c&&(u||(u=await TNo(r,c)),u&&(r.reveal(u),r.setFocus([u],GT()),r.setSelection([u],GT()),pl(u)?!e.getValue().search?.useReplacePreview||o.invokeFunction(g=>xxn(g,u))||u instanceof Tre?n?.open(u,!0):o.invokeFunction(g=>g.get(gy)).openReplacePreview(u,!0):Bl(u)&&n?.open(u,!0))),r.domFocus()}function xxn(a,i){if(!pl(i))return!1;let t=a.get(ie).activeEditor?.resource;return t?a.get(gt).extUri.isEqual(t,i.parent().resource):!1}function kxn(a,i){return pl(a)?pl(i)?0:-1:Bl(a)?pl(i)?1:Bl(i)?0:-1:ru(a)?Pv(i)?-1:ru(i)?0:1:Pv(i)?0:1}async function ENo(a,i,e){let t=a.navigate(i);if(ru(i))for(;t.next()&&(!ru(t.current())||G6(t.current(),e)););else if(Bl(i))for(;t.next()&&(!Bl(t.current())||G6(t.current(),e));){if(t.current()instanceof C9)return t.current();await a.expand(t.current())}else for(;t.next()&&(!pl(t.current())||G6(t.current(),e));){if(t.current()instanceof C9)return t.current();await a.expand(t.current())}return t.current()}async function TNo(a,i){let e=a.lastVisibleElement??null;for(;e;){let t=kxn(i,e);if(t===-1){if(!await a.expand(e))return e;e=a.lastVisibleElement}else if(t===1){let o=a.getParentElement(e);if(SO(o))break;e=o}else return e}}var _Se="%",Exn={_reason:"quickAccessSearch",disregardIgnoreFiles:!1,disregardExcludeSettings:!1,onlyOpenEditors:!1,expandPatterns:!0},p1i=30,Txn=10,_xn=75,Wze=class extends cg{constructor(e,t,o,n,r,s){super(_Se,{canAcceptInBackground:!0,shouldSkipTrimPickFilter:!0});this._instantiationService=e;this._contextService=t;this._editorService=o;this._labelService=n;this._viewsService=r;this._configurationService=s;this.currentAsyncSearch=Promise.resolve({results:[],messages:[]});this.queryBuilder=this._instantiationService.createInstance(JS),this.searchModel=this._register(this._instantiationService.createInstance(Q$)),this.editorViewState=this._register(this._instantiationService.createInstance(FG)),this.searchModel.location=1,this.editorSequencer=new Tm}_getTextQueryBuilderOptions(e){return{...Exn,extraFileResources:this._instantiationService.invokeFunction(Tee),maxResults:this.configuration.maxResults??void 0,isSmartCase:this.configuration.smartCase,previewOptions:{matchLines:1,charsPerLine:e}}}dispose(){this.searchModel.dispose(),super.dispose()}provide(e,t,o){let n=new O;_Se.length<e.value.length&&(e.valueSelection=[_Se.length,e.value.length]),e.buttons=[{location:2,iconClass:q.asClassName(L.goToSearch),tooltip:d(15021,null)}],this.editorViewState.reset(),n.add(e.onDidTriggerButton(async()=>{await this.moveToSearchViewlet(void 0),e.hide()}));let r=()=>{let[s]=e.activeItems;if(s?.match){this.editorViewState.set();let l=s.match;this.editorSequencer.queue(async()=>{await this.editorViewState.openTransientEditor({resource:l.parent().resource,options:{preserveFocus:!0,revealIfOpened:!0,ignoreError:!0,selection:l.range()}})})}};return n.add(U.debounce(e.onDidChangeActive,(s,l)=>l,_xn,!0)(r)),n.add(U.once(e.onWillHide)(({reason:s})=>{s===2&&this.editorViewState.restore()})),n.add(U.once(e.onDidHide)(({reason:s})=>{this.searchModel.searchResult.toggleHighlights(!1)})),n.add(super.provide(e,t,o)),n.add(e.onDidAccept(()=>this.searchModel.searchResult.toggleHighlights(!1))),n}get configuration(){let e=this._configurationService.getValue().workbench?.editor,t=this._configurationService.getValue().search;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview,preserveInput:t.quickAccess.preserveInput,maxResults:t.maxResults,smartCase:t.smartCase,sortOrder:t.sortOrder}}get defaultFilterValue(){if(this.configuration.preserveInput)return 1}doSearch(e,t){if(e==="")return;let o=this._contextService.getWorkspace().folders,n={pattern:e};this.searchModel.searchResult.toggleHighlights(!1);let r=n.isRegExp?1e4:1e3,s=this.queryBuilder.text(n,o.map(u=>u.uri),this._getTextQueryBuilderOptions(r)),l=this.searchModel.search(s,void 0,t),c=async()=>{this.currentAsyncSearch=l.asyncResults,await l.asyncResults;let u=new xn(l.syncResults.map(p=>p.resource));return this.searchModel.searchResult.matches(!1).filter(p=>!u.has(p.resource))};return{syncResults:this.searchModel.searchResult.matches(!1),asyncResults:c()}}async moveToSearchViewlet(e){this._viewsService.openView(ow,!1);let t=this._viewsService.getActiveViewWithId(ow);await t.replaceSearchModel(this.searchModel,this.currentAsyncSearch),this.searchModel=this._instantiationService.createInstance(Q$),this.searchModel.location=1;let o=t?.getControl();e?(o.setFocus([e],GT()),o.setSelection([e],GT()),o.reveal(e)):t.searchAndReplaceWidget.focus()}_getPicksFromMatches(e,t,o){e=e.sort((s,l)=>{if(o){if(o===s.resource)return-1;if(o===l.resource)return 1}return s3t(s,l,this.configuration.sortOrder)});let n=e.length>t?e.slice(0,t):e,r=[];for(let s=0;s<e.length;s++){if(s===t){r.push({type:"separator"}),r.push({label:d(15025,null),iconClass:q.asClassName(Tbe),accept:async()=>{await this.moveToSearchViewlet(e[t])}});break}let l=n[s],c=sl(l.resource),u=this._labelService.getUriLabel(ai(l.resource),{relative:!0});r.push({label:c,type:"separator",description:u,buttons:[{iconClass:q.asClassName(sMo),tooltip:d(15024,null)}],trigger:async()=>(await this.handleAccept(l,{}),1)});let p=l.matches()??[];for(let h=0;h<p.length;h++){let g=p[h];if(h===Txn){r.push({label:d(15023,null),iconClass:q.asClassName(Tbe),accept:async()=>{await this.moveToSearchViewlet(g)}});break}let f=g.preview(),v=(f.before+f.inside+f.after).trim().substring(0,999),b=[{start:f.before.length,end:f.before.length+f.inside.length}];r.push({label:`${v}`,highlights:{label:b},buttons:[{iconClass:q.asClassName(QLo),tooltip:d(15026,null)}],ariaLabel:`Match at location ${g.range().startLineNumber}:${g.range().startColumn} - ${v}`,accept:async(S,y)=>{await this.handleAccept(l,{keyMods:S,selection:TVi(g,this.searchModel),preserveFocus:y.inBackground,forcePinned:y.inBackground})},trigger:async()=>(await this.moveToSearchViewlet(g),1),match:g})}}return r}async handleAccept(e,t){let o={preserveFocus:t.preserveFocus,pinned:t.keyMods?.ctrlCmd||t.forcePinned||this.configuration.openEditorPinned,selection:t.selection},n=t.keyMods?.alt||this.configuration.openEditorPinned&&t.keyMods?.ctrlCmd||t.forceOpenSideBySide?En:tr;await this._editorService.openEditor({resource:e.resource,options:o},n)}_getPicks(e,t,o){let n=this.searchModel;if(e==="")return this.searchModel.searchResult.clear(),[{label:d(15020,null)}];let r=t.add(new qe);t.add(o.onCancellationRequested(()=>{n.location===1&&r.cancel()}));let s=this.doSearch(e,r.token);if(!s)return null;let l=s.syncResults,c=this._getPicksFromMatches(l,p1i,this._editorService.activeEditor?.resource);return c.length>0&&this.searchModel.searchResult.toggleHighlights(!0),l.length>=p1i?c:{picks:c,additionalPicks:s.asyncResults.then(u=>u.length+c.length===0?[{label:d(15022,null)}]:this._getPicksFromMatches(u,p1i-l.length)).then(u=>(u.length>0&&this.searchModel.searchResult.toggleHighlights(!0),u))}}};Wze=I([m(0,F),m(1,Ae),m(2,ie),m(3,nt),m(4,Gt),m(5,B)],Wze);W(class extends z{constructor(){super({id:"workbench.action.quickTextSearch",title:P(15187,"Quick Search"),category:Hl,f1:!0})}async run(i,e){let t=i.get($e),o=Dxn(i)??"";t.quickAccess.show(_Se+o,{preserveValue:!!o})}});function Dxn(a){let i=a.get(ie),e=a.get(B),t=i.activeTextEditorControl;return!t||!t.hasTextFocus()||!e.getValue("editor.find.seedSearchStringFromSelection")?null:_Vi(!1,t)}var DSe=class a extends EBe{static{this.GO_TO_LINE_PREFIX=":"}static{this.GO_TO_OFFSET_PREFIX="::"}static{this.ZERO_BASED_OFFSET_STORAGE_KEY="gotoLine.useZeroBasedOffset"}constructor(){super({canAcceptInBackground:!0})}get useZeroBasedOffset(){return this.storageService.getBoolean(a.ZERO_BASED_OFFSET_STORAGE_KEY,-1,!1)}set useZeroBasedOffset(i){this.storageService.store(a.ZERO_BASED_OFFSET_STORAGE_KEY,i,-1,0)}provideWithoutTextEditor(i){let e=d(1517,null);return i.items=[{label:e}],i.ariaLabel=e,k.None}provideWithTextEditor(i,e,t){let o=i.editor,n=new O;e.ariaLabel=d(1511,null),n.add(e.onDidAccept(c=>{let[u]=e.selectedItems;if(u){if(!u.lineNumber)return;this.gotoLocation(i,{range:this.toRange(u.lineNumber,u.column),keyMods:e.keyMods,preserveFocus:c.inBackground}),c.inBackground||e.hide()}}));let r={iconClass:q.asClassName(L.indexZero),tooltip:d(1520,null),location:3,toggle:{checked:this.useZeroBasedOffset}},s=()=>{let c=e.value.trim().substring(a.GO_TO_LINE_PREFIX.length),{inOffsetMode:u,lineNumber:p,column:h,label:g}=this.parsePosition(o,c);if(e.buttons=u?[r]:[],e.items=[{lineNumber:p,column:h,label:g,ariaLabel:p?d(1514,null,p,h||1):g}],!p){this.clearDecorations(o);return}let f=this.toRange(p,h);o.revealRangeInCenter(f,0),this.addDecorations(o,f)};n.add(e.onDidTriggerButton(c=>{c===r&&(this.useZeroBasedOffset=c.toggle?.checked??!this.useZeroBasedOffset,s())})),s(),n.add(e.onDidChangeValue(()=>s()));let l=da(o);return l&&l.getOptions().get(76).renderType===2&&(l.updateOptions({lineNumbers:"on"}),n.add(ee(()=>l.updateOptions({lineNumbers:"relative"})))),n}toRange(i=1,e=1){return{startLineNumber:i,startColumn:e,endLineNumber:i,endColumn:e}}parsePosition(i,e){let t=this.getModel(i);if(!t)return{label:d(1517,null)};if(e.startsWith(":")){let o=parseInt(e.substring(1),10),n=t.getValueLength();if(isNaN(o))return{inOffsetMode:!0,label:this.useZeroBasedOffset?d(1519,null,n-1):d(1518,null,n)};{let r=o<0;this.useZeroBasedOffset||(o-=Math.sign(o)),r&&(o+=n);let s=t.getPositionAt(o),l=Ll.visibleColumnFromColumn(t.getLineContent(s.lineNumber),s.column,t.getOptions().tabSize)+1;return{...s,inOffsetMode:!0,label:d(1513,null,s.lineNumber,l)}}}else{let o=e.split(/,|:|#/),n=t.getLineCount(),r=parseInt(o[0]?.trim(),10);if(o.length<1||isNaN(r))return{label:d(1516,null,n)};r=r>=0?r:n+1+r,r=Math.min(Math.max(1,r),n);let s=t.getOptions().tabSize,l=t.getLineContent(r),c=Ll.visibleColumnFromColumn(l,t.getLineMaxColumn(r),s)+1,u=parseInt(o[1]?.trim(),10);if(o.length<2||isNaN(u))return{lineNumber:r,column:1,label:o.length<2?d(1515,null,r):d(1512,null,r,c)};u=u>=0?u:c+u,u=Math.min(Math.max(1,u),c);let p=Ll.columnFromVisibleColumn(l,u-1,s);return{lineNumber:r,column:p,label:d(1513,null,r,u)}}}};W(class _No extends z{static{this.ID="workbench.action.showAllSymbols"}static{this.LABEL=d(15185,null)}static{this.ALL_SYMBOLS_PREFIX="#"}constructor(){super({id:"workbench.action.showAllSymbols",title:{...P(15186,"Go to Symbol in Workspace..."),mnemonicTitle:d(15184,null)},f1:!0,keybinding:{weight:200,primary:2098},menu:{id:R.MenubarGoMenu,group:"3_global_nav",order:2}})}async run(i){i.get($e).quickAccess.show(_No.ALL_SYMBOLS_PREFIX)}});var DNo=oe.as(Bu.Quickaccess);DNo.registerQuickAccessProvider({ctor:qC,prefix:qC.PREFIX,placeholder:d(15226,null,DSe.GO_TO_LINE_PREFIX,UE.PREFIX),contextKey:eEi,helpEntries:[{description:d(15225,null),commandId:"workbench.action.quickOpen",commandCenterOrder:10}]});DNo.registerQuickAccessProvider({ctor:HE,prefix:HE.PREFIX,placeholder:d(15228,null),contextKey:"inWorkspaceSymbolsPicker",helpEntries:[{description:d(15227,null),commandId:"workbench.action.showAllSymbols"}]});var LNo="replacePreview",RNo=a=>a.with({scheme:Q.internal,fragment:LNo,query:JSON.stringify({scheme:a.scheme})}),Rxn=a=>a.with({scheme:JSON.parse(a.query).scheme,fragment:"",query:""}),RSe=class{constructor(i,e){this.instantiationService=i;this.textModelResolverService=e;this.textModelResolverService.registerTextModelContentProvider(Q.internal,this)}static{this.ID="workbench.contrib.replacePreviewContentProvider"}provideTextContent(i){return i.fragment===LNo?this.instantiationService.createInstance(but).resolve(i):null}};RSe=I([m(0,F),m(1,Bt)],RSe);var but=class extends k{constructor(e,t,o,n,r){super();this.modelService=e;this.languageService=t;this.textModelResolverService=o;this.replaceService=n;this.searchWorkbenchService=r}async resolve(e){let t=Rxn(e),o=this.searchWorkbenchService.searchModel.searchResult.matches(!1).filter(c=>c.resource.toString()===t.toString())[0],r=this._register(await this.textModelResolverService.createModelReference(t)).object.textEditorModel,s=r.getLanguageId(),l=this.modelService.createModel(Uk(r.createSnapshot()),this.languageService.createById(s),e);return this._register(o.onChange(({forceUpdateModel:c})=>this.update(r,l,o,c))),this._register(this.searchWorkbenchService.searchModel.onReplaceTermChanged(()=>this.update(r,l,o))),this._register(o.onDispose(()=>l.dispose())),this._register(l.onWillDispose(()=>this.dispose())),this._register(r.onWillDispose(()=>this.dispose())),l}update(e,t,o,n=!1){!e.isDisposed()&&!t.isDisposed()&&this.replaceService.updateReplacePreview(o,n)}};but=I([m(0,_t),m(1,Rt),m(2,Bt),m(3,gy),m(4,kre)],but);var o7=class{constructor(i,e,t,o,n,r){this.textFileService=i;this.editorService=e;this.textModelResolverService=t;this.bulkEditorService=o;this.labelService=n;this.notebookEditorModelResolverService=r}static{this.REPLACE_SAVE_SOURCE=Qh.registerSource("searchReplace.source",d(15028,null))}async replace(i,e=void 0,t=null){let o=this.createEdits(i,t);await this.bulkEditorService.apply(o,{progress:e});let n=o.map(async r=>{if(r.resource.scheme===Q.vscodeNotebookCell){let s=sn.parse(r.resource)?.notebook;if(s){let l;try{l=await this.notebookEditorModelResolverService.resolve(s),await l.object.save({source:o7.REPLACE_SAVE_SOURCE})}finally{l?.dispose()}}return}else return this.textFileService.files.get(r.resource)?.save({source:o7.REPLACE_SAVE_SOURCE})});return vn.settled(n)}async openReplacePreview(i,e,t,o){let n=pl(i)?i.parent():i,r=await this.editorService.openEditor({original:{resource:n.resource},modified:{resource:RNo(n.resource)},label:d(15027,null,n.name(),n.name()),description:this.labelService.getUriLabel(ai(n.resource),{relative:!0}),options:{preserveFocus:e,pinned:o,revealIfVisible:!0}}),s=r?.input,l=n.onDispose(()=>{s?.dispose(),l.dispose()});if(await this.updateReplacePreview(n),r){let c=r.getControl();pl(i)&&c&&c.revealLineInCenter(i.range().startLineNumber,1)}}async updateReplacePreview(i,e=!1){let t=RNo(i.resource),[o,n]=await Promise.all([this.textModelResolverService.createModelReference(i.resource),this.textModelResolverService.createModelReference(t)]),r=o.object.textEditorModel,s=n.object.textEditorModel;try{r&&s&&(e?s.setValue(r.getValue()):s.undo(),this.applyEditsToPreview(i,s))}finally{o.dispose(),n.dispose()}}applyEditsToPreview(i,e){let t=this.createEdits(i,e.uri),o=[];for(let n of t)o.push(Qn.replaceMove(G.lift(n.textEdit.range),n.textEdit.text));e.pushEditOperations([],o.sort((n,r)=>G.compareRangesUsingStarts(n.range,r.range)),()=>[])}createEdits(i,e=null){let t=[];if(pl(i)&&!i.isReadonly)if(_1(i)){let o=i;t.push(this.createEdit(o,o.replaceString,o.cell?.uri))}else{let o=i;t.push(this.createEdit(o,o.replaceString,e))}return Bl(i)&&(i=[i]),i instanceof Array&&i.forEach(o=>{let n=o;n.count()>0&&t.push(...n.matches().flatMap(r=>this.createEdits(r,e)))}),t}createEdit(i,e,t=null){let o=i.parent();return new hl(t??o.resource,{range:i.range(),text:e},void 0,void 0)}};o7=I([m(0,Uo),m(1,ie),m(2,Bt),m(3,Ka),m(4,nt),m(5,Yh)],o7);function MNo(){Ce(gy,o7,1),bt(RSe.ID,RSe,vt.BlockStartup)}var Vze=class{constructor(i,e,t,o,n,r,s,l){this.uriIdentityService=i;this.notebookEditorService=e;this.logService=t;this.notebookService=o;this.configurationService=n;this.editorResolverService=r;this.searchService=s;this.queryBuilder=l.createInstance(JS)}notebookSearch(i,e,t,o){if(i.type!==2)return{openFilesToScan:new xn,completeData:Promise.resolve({messages:[],limitHit:!1,results:[]}),allScannedFiles:Promise.resolve(new xn)};let n=this.getLocalNotebookWidgets(),r=n.map(c=>c.viewModel.uri),l=(()=>{let c=Date.now(),u=this.getLocalNotebookResults(i,e??Ie.None,n,t),p=Date.now(),h=this.configurationService.getValue("search").experimental?.closedNotebookRichContentResults??!1,g=Promise.resolve(void 0);h&&(g=this.getClosedNotebookResults(i,new xn(r,v=>this.uriIdentityService.extUri.getComparisonKey(v)),e??Ie.None));let f=Promise.all([u,g]);return{completeData:f.then(v=>{let b=v[0],S=v[1],y=v.filter(E=>!!E),w=[...b.results.values(),...S?.results.values()??[]],x=ui(w);return o&&x.forEach(o),this.logService.trace(`local notebook search time | ${p-c}ms`),{messages:[],limitHit:y.reduce((E,M)=>E||M.limitHit,!1),results:x}}),allScannedFiles:f.then(v=>{let b=v[0],S=v[1],y=ui([...b.results.keys(),...S?.results.keys()??[]]);return new xn(y,w=>this.uriIdentityService.extUri.getComparisonKey(w))})}})();return{openFilesToScan:new xn(r),completeData:l.completeData,allScannedFiles:l.allScannedFiles}}async doesFileExist(i,e,t){let o=i.map(async n=>{let r=this.queryBuilder.file(e.map(s=>s.folder),{includePattern:n.startsWith("/")?n:"**/"+n,exists:!0,onlyFileScheme:!0});return this.searchService.fileSearch(r,t).then(s=>!!s.limitHit)});return Promise.any(o)}async getClosedNotebookResults(i,e,t){let o=this.editorResolverService.getAllUserAssociations(),n=new Map,r=this.notebookService.getContributedNotebookTypes();o.forEach(v=>{if(!v.filenamePattern)return;let b={isFromSettings:!0,filenamePatterns:[v.filenamePattern]},S=n.get(v.viewType);S?n.set(v.viewType,S.concat(b)):n.set(v.viewType,[b])});let s=[];r.forEach(v=>{v.selectors.length>0&&s.push((async()=>{let b=v.selectors.map(y=>(y.include||y).toString());if(await this.doesFileExist(b,i.folderQueries,t))return await this.notebookService.canResolve(v.id)?await(await this.notebookService.withNotebookDataProvider(v.id)).serializer.searchInNotebooks(i,t,n):void 0})())});let l=Date.now(),c=ui(await Promise.all(s)),u=c.flatMap(v=>v.results),p=c.some(v=>v.limitHit),h=new dt(v=>this.uriIdentityService.extUri.getComparisonKey(v)),g=0;for(let v of u){if(i.maxResults&&g>=i.maxResults){p=!0;break}!e.has(v.resource)&&!h.has(v.resource)&&(h.set(v.resource,v.cellResults.length>0?v:null),g++)}let f=Date.now();return this.logService.trace(`query: ${i.contentPattern.pattern}`),this.logService.trace(`closed notebook search time | ${f-l}ms`),{results:h,limitHit:p}}async getLocalNotebookResults(i,e,t,o){let n=new dt(s=>this.uriIdentityService.extUri.getComparisonKey(s)),r=!1;for(let s of t){if(!s.hasModel())continue;let l=(on(i.maxResults)?i.maxResults:M3)+1,c=s.viewModel.uri;if(!Fpe(i,c.fsPath))continue;let u=await s.find(i.contentPattern.pattern,{regex:i.contentPattern.isRegExp,wholeWord:i.contentPattern.isWordMatch,caseSensitive:i.contentPattern.isCaseSensitive,includeMarkupInput:i.contentPattern.notebookInfo?.isInNotebookMarkdownInput??!0,includeMarkupPreview:i.contentPattern.notebookInfo?.isInNotebookMarkdownPreview??!0,includeCodeInput:i.contentPattern.notebookInfo?.isInNotebookCellInput??!0,includeOutput:i.contentPattern.notebookInfo?.isInNotebookCellOutput??!0},e,!1,!0,o);if(u.length){l&&u.length>=l&&(r=!0,u=u.slice(0,l-1));let p=u.map(g=>{let f=S3t(g.contentMatches,g.cell),v=I3t(g.webviewMatches);return{cell:g.cell,index:g.index,contentResults:f,webviewResults:v}}),h={resource:c,cellResults:p};n.set(c,h)}else n.set(c,null)}return{results:n,limitHit:r}}getLocalNotebookWidgets(){return this.notebookEditorService.retrieveAllExistingWidgets().map(e=>e.value).filter(e=>!!e&&e.hasModel())}};Vze=I([m(0,gt),m(1,hd),m(2,re),m(3,kn),m(4,B),m(5,il),m(6,Gg),m(7,F)],Vze);function PNo(){Ce(E6t,Vze,1)}MNo();PNo();Ce(BHe,_O,1);oe.as($t.Configuration).registerConfiguration({...yRe,properties:{"search.searchOnType":{type:"boolean",default:!0,description:d(15029,null)},"search.searchOnTypeDebouncePeriod":{type:"number",default:300,markdownDescription:d(15030,null,"`#search.searchOnType#`")}}});var T6t=class{constructor(){this.priority=105;this.name="search";this.type="help";this.when=Ri.SearchInputBoxFocusedKey}getProvider(i){let e=i.get(kre),t=i.get(Gt),o=e.searchModel;if(o)return new m1i(o,t)}},m1i=class extends k{constructor(e,t){super();this._searchModel=e;this._viewsService=t;this.id="searchHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){vd(this._viewsService)?.focus()}provideContent(){let e=[],t=this._searchModel.searchResult.count(),o=this._searchModel.replaceActive;return e.push(d(15099,null)),e.push(d(15094,null)),e.push(""),e.push(d(15145,null)),e.push(d(15146,null)),t!==void 0?t===0?e.push(d(15120,null)):e.push(d(15130,null,t)):e.push(d(15121,null)),e.push(""),e.push(d(15107,null)),e.push(d(15106,null)),e.push(""),e.push(d(15105,null)),e.push(d(15104,null)),e.push(d(15100,null)),e.push(d(15101,null)),e.push(d(15102,null)),e.push(d(15103,null)),e.push(""),e.push(d(15098,null)),e.push(d(15095,null)),e.push(d(15096,null)),e.push(d(15097,null,"<keybinding:search.action.focusNextSearchResult>")),e.push(""),e.push(d(15109,null)),e.push(""),e.push(d(15114,null)),e.push(d(15110,null)),e.push(d(15117,null)),e.push(""),e.push(d(15113,null)),e.push(d(15108,null)),e.push(d(15115,null)),e.push(""),e.push(d(15112,null)),e.push(d(15111,null,"<keybinding:search.action.focusNextSearchResult>")),e.push(d(15116,null,"<keybinding:search.action.focusPreviousSearchResult>")),e.push(""),e.push(d(15124,null)),e.push(d(15122,null)),e.push(d(15125,null)),e.push(d(15123,null)),e.push(""),o&&(e.push(d(15128,null)),e.push(d(15126,null)),e.push(d(15127,null)),e.push(d(15129,null)),e.push("")),e.push(d(15139,null,"<keybinding:workbench.action.openSettings>")),e.push(d(15140,null)),e.push(d(15143,null)),e.push(d(15141,null)),e.push(d(15138,null)),e.push(d(15134,null)),e.push(d(15136,null)),e.push(d(15132,null)),e.push(d(15135,null)),e.push(d(15142,null)),e.push(d(15133,null)),e.push(d(15144,null)),e.push(d(15131,null)),o&&e.push(d(15137,null)),et&&(e.push(""),e.push(d(15119,null)),e.push(d(15118,null))),e.push(""),e.push(d(15093,null)),e.push(d(15092,null)),e.join(`
`)}};Ce(kre,Fze,1);hMo();bt(Lbe.ID,Lbe,vt.AfterRestored);_a.register(new T6t);var Lxn="search.mode",ANo=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:SSi,title:P(15041,"Search"),ctorDescriptor:new Vt(Qc,[SSi,{mergeViewWithContainerWhenSingleView:!0}]),hideIfEmpty:!0,icon:fVi,order:1},0,{doNotRegisterOpenCommand:!0}),Mxn={id:ow,containerIcon:fVi,name:P(15041,"Search"),ctorDescriptor:new Vt(M$),canToggleVisibility:!1,canMoveView:!0,openCommandActionDescriptor:{id:ANo.id,mnemonicTitle:d(15038,null),keybindings:{primary:3108,when:C.regex("neverMatch",/doesNotMatch/)},order:1}};oe.as(Kn.ViewsRegistry).registerViews([Mxn],ANo);var Pxn=oe.as(Bu.Quickaccess);Pxn.registerQuickAccessProvider({ctor:Wze,prefix:_Se,contextKey:"inTextSearchPicker",placeholder:d(15085,null),helpEntries:[{description:d(15084,null),commandId:"workbench.action.quickTextSearch",commandCenterOrder:25}]});var Axn=oe.as($t.Configuration);Axn.registerConfiguration({...yRe,properties:{[GPt]:{type:"object",markdownDescription:d(15031,null),default:{"**/node_modules":!0,"**/bower_components":!0,"**/*.code-search":!0},additionalProperties:{anyOf:[{type:"boolean",description:d(15032,null)},{type:"object",properties:{when:{type:"string",pattern:"\\w*\\$\\(basename\\)\\w*",default:"$(basename).ext",markdownDescription:d(15033,null)}}}]},scope:5},[Lxn]:{type:"string",enum:["view","reuseEditor","newEditor"],default:"view",markdownDescription:d(15058,null),enumDescriptions:[d(15061,null),d(15060,null),d(15059,null)]},"search.useRipgrep":{type:"boolean",description:d(15090,null),deprecationMessage:d(15091,null),default:!0},"search.maintainFileSearchCache":{type:"boolean",deprecationMessage:d(15037,null),description:d(15056,null),default:!1},"search.useIgnoreFiles":{type:"boolean",markdownDescription:d(15087,null),default:!0,scope:5},"search.useGlobalIgnoreFiles":{type:"boolean",markdownDescription:d(15086,null,"`#search.useIgnoreFiles#`"),default:!1,scope:5},"search.useParentIgnoreFiles":{type:"boolean",markdownDescription:d(15088,null,"`#search.useIgnoreFiles#`"),default:!1,scope:5},"search.quickOpen.includeSymbols":{type:"boolean",description:d(15064,null),default:!1},"search.ripgrep.maxThreads":{type:"number",description:d(15065,null),default:0},"search.quickOpen.includeHistory":{type:"boolean",description:d(15063,null),default:!0,agentsWindow:{default:!1}},"search.quickOpen.history.filterSortOrder":{type:"string",enum:["default","recency"],default:"default",enumDescriptions:[d(15035,null),d(15036,null)],description:d(15034,null)},"search.followSymlinks":{type:"boolean",description:d(15052,null),default:!0},"search.smartCase":{type:"boolean",description:d(15074,null),default:!1},"search.globalFindClipboard":{type:"boolean",default:!1,description:d(15053,null),included:et},"search.location":{type:"string",enum:["sidebar","panel"],default:"sidebar",description:d(15054,null),deprecationMessage:d(15055,null)},"search.maxResults":{type:["number","null"],default:M3,markdownDescription:d(15057,null)},"search.collapseResults":{type:"string",enum:["auto","alwaysCollapse","alwaysExpand"],enumDescriptions:[d(15046,null),"",""],default:"alwaysExpand",description:d(15045,null)},"search.useReplacePreview":{type:"boolean",default:!0,description:d(15077,null)},"search.showLineNumbers":{type:"boolean",default:!1,description:d(15073,null)},"search.usePCRE2":{type:"boolean",default:!1,description:d(15076,null),deprecationMessage:d(15089,null)},"search.actionsPosition":{type:"string",enum:["auto","right"],enumDescriptions:[d(15043,null),d(15044,null)],default:"right",description:d(15042,null)},"search.seedWithNearestWord":{type:"boolean",default:!1,description:d(15072,null)},"search.seedOnFocus":{type:"boolean",default:!1,markdownDescription:d(15071,null)},"search.sortOrder":{type:"string",enum:["default","fileNames","type","modified","countDescending","countAscending"],default:"default",enumDescriptions:[d(15080,null),d(15081,null),d(15083,null),d(15082,null),d(15079,null),d(15078,null)],description:d(15075,null)},"search.decorations.colors":{type:"boolean",description:d(15048,null),default:!0},"search.decorations.badges":{type:"boolean",description:d(15047,null),default:!0},"search.defaultViewMode":{type:"string",enum:["tree","list"],default:"list",enumDescriptions:[d(15040,null),d(15039,null)],description:d(15049,null)},"search.quickAccess.preserveInput":{type:"boolean",description:d(15062,null),default:!1},"search.experimental.closedNotebookRichContentResults":{type:"boolean",description:d(15050,null),default:!1},"search.experimental.useIgnoreFilesInFindFiles":{type:"boolean",default:!1,markdownDescription:d(15051,null),tags:["experimental"]},"search.searchView.semanticSearchBehavior":{type:"string",description:d(15067,null),enum:["manual","runOnEmpty","auto"],default:"manual",enumDescriptions:[d(15069,null),d(15070,null),d(15068,null)],tags:["preview"]},"search.searchView.keywordSuggestions":{type:"boolean",description:d(15066,null),default:!1,tags:["preview"]}}});Ge.registerCommand("_executeWorkspaceSymbolProvider",async function(a,...i){let[e]=i;return To(typeof e=="string"),(await uOt(e)).map(o=>o.symbol)});oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"search.experimental.quickAccess.preserveInput",migrateFn:(a,i)=>[["search.quickAccess.preserveInput",{value:a}],["search.experimental.quickAccess.preserveInput",{value:void 0}]]}]);var NNo=/^(\s+)(\d+)(: |  )(\s*)(.*)$/,ONo=/^(\S.*):$/,Y$=class extends Lte{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E){super(Y$.ID,e,t,c,n,v,o,S,b,w);this.modelService=r;this.contextService=s;this.labelService=l;this.contextViewService=u;this.commandService=p;this.openerService=h;this.notificationService=g;this.configurationService=y;this.logService=x;this.hoverService=E;this.runSearchDelayer=this._register(new rn(0));this.pauseSearching=!1;this.showingIncludesExcludes=!1;this.ongoingOperations=0;this.updatingModelForSearch=!1;this.container=_(".search-editor"),this.searchOperation=this._register(new uke(f)),this._register(this.messageDisposables=new O),this.searchHistoryDelayer=this._register(new rn(2e3)),this.searchModel=this._register(this.instantiationService.createInstance(Q$))}static{this.ID=Ict}static{this.SEARCH_EDITOR_VIEW_STATE_PREFERENCE_KEY="searchEditorViewState"}get searchResultEditor(){return this.editorControl}createEditor(e){D(e,this.container),this.queryEditorContainer=D(this.container,_(".query-container"));let t=D(this.container,_(".search-results"));super.createEditor(t),this.registerEditorListeners();let o=Ti(this.scopedContextKeyService);SS.bindTo(o).set(!0),this.createQueryEditor(this.queryEditorContainer,this._register(this.instantiationService.createChild(new Po([X,o]))),Ri.InputBoxFocusedKey.bindTo(o))}createQueryEditor(e,t,o){let n=MD({inputBorder:Nxn});this.queryEditorWidget=this._register(t.createInstance(jP,e,{_hideReplaceToggle:!0,showContextToggle:!0,inputBoxStyles:n,toggleStyles:zh})),this._register(this.queryEditorWidget.onReplaceToggled(()=>this.reLayout())),this._register(this.queryEditorWidget.onDidHeightChange(()=>this.reLayout())),this._register(this.queryEditorWidget.onSearchSubmit(({delay:p})=>this.triggerSearch({delay:p}))),this.queryEditorWidget.searchInput?this._register(this.queryEditorWidget.searchInput.onDidOptionChange(()=>this.triggerSearch({resetCursor:!1}))):this.logService.warn("SearchEditor: SearchWidget.searchInput is undefined, cannot register onDidOptionChange listener"),this._register(this.queryEditorWidget.onDidToggleContext(()=>this.triggerSearch({resetCursor:!1}))),this.includesExcludesContainer=D(e,_(".includes-excludes"));let r=d(15316,null);this.toggleQueryDetailsButton=D(this.includesExcludesContainer,_(".expand"+q.asCSSSelector(Tbe),{tabindex:0,role:"button","aria-label":r})),this._register(this.hoverService.setupManagedHover(yi("element"),this.toggleQueryDetailsButton,r)),this._register($(this.toggleQueryDetailsButton,ne.CLICK,p=>{Kt.stop(p),this.toggleIncludesExcludes()})),this._register($(this.toggleQueryDetailsButton,ne.KEY_UP,p=>{let h=new mi(p);(h.equals(3)||h.equals(10))&&(Kt.stop(p),this.toggleIncludesExcludes())})),this._register($(this.toggleQueryDetailsButton,ne.KEY_DOWN,p=>{new mi(p).equals(1026)&&(this.queryEditorWidget.isReplaceActive()?this.queryEditorWidget.focusReplaceAllAction():this.queryEditorWidget.isReplaceShown()?this.queryEditorWidget.replaceInput?.focusOnPreserve():this.queryEditorWidget.focusRegexAction(),Kt.stop(p))}));let s=D(this.includesExcludesContainer,_(".file-types.includes")),l=d(15321,null);D(s,_("h4",void 0,l)),this.inputPatternIncludes=this._register(t.createInstance(yre,s,this.contextViewService,{ariaLabel:d(15315,null),inputBoxStyles:n})),this._register(this.inputPatternIncludes.onSubmit(p=>this.triggerSearch({resetCursor:!1,delay:p?this.searchConfig.searchOnTypeDebouncePeriod:0}))),this._register(this.inputPatternIncludes.onChangeSearchInEditorsBox(()=>this.triggerSearch()));let c=D(this.includesExcludesContainer,_(".file-types.excludes")),u=d(15320,null);D(c,_("h4",void 0,u)),this.inputPatternExcludes=this._register(t.createInstance(wre,c,this.contextViewService,{ariaLabel:d(15314,null),inputBoxStyles:n})),this._register(this.inputPatternExcludes.onSubmit(p=>this.triggerSearch({resetCursor:!1,delay:p?this.searchConfig.searchOnTypeDebouncePeriod:0}))),this._register(this.inputPatternExcludes.onChangeIgnoreBox(()=>this.triggerSearch())),this.messageBox=D(e,_(".messages.text-search-provider-messages")),[this.queryEditorWidget.searchInputFocusTracker,this.queryEditorWidget.replaceInputFocusTracker,this.inputPatternExcludes.inputFocusTracker,this.inputPatternIncludes.inputFocusTracker].forEach(p=>{p&&(this._register(p.onDidFocus(()=>setTimeout(()=>o.set(!0),0))),this._register(p.onDidBlur(()=>o.set(!1))))})}toggleRunAgainMessage(e){if(St(this.messageBox),this.messageDisposables.clear(),e){let t=D(this.messageBox,_("a.pointer.prominent.message",{},d(15317,null)));this.messageDisposables.add($(t,ne.CLICK,async()=>{await this.triggerSearch(),this.searchResultEditor.focus()}))}}_getContributions(){let e=[XJ.ID];return ml.getEditorContributions().filter(t=>e.indexOf(t.id)===-1)}getCodeEditorWidgetOptions(){return{contributions:this._getContributions()}}registerEditorListeners(){this._register(this.searchResultEditor.onMouseUp(e=>{if(e.event.detail===1){let t=this.searchConfig.searchEditor.singleClickBehaviour,o=e.target.position;if(o&&t==="peekDefinition"){let n=this.searchResultEditor.getModel()?.getLineContent(o.lineNumber)??"";(n.match(ONo)||n.match(NNo))&&(this.searchResultEditor.setSelection(G.fromPositions(o)),this.commandService.executeCommand("editor.action.peekDefinition"))}}else if(e.event.detail===2){let t=this.searchConfig.searchEditor.doubleClickBehaviour,o=e.target.position;if(o&&t!=="selectWord"){let n=this.searchResultEditor.getModel()?.getLineContent(o.lineNumber)??"";n.match(NNo)?(this.searchResultEditor.setSelection(G.fromPositions(o)),this.commandService.executeCommand(t==="goToLocation"?"editor.action.goToDeclaration":"editor.action.openDeclarationToTheSide")):n.match(ONo)&&(this.searchResultEditor.setSelection(G.fromPositions(o)),this.commandService.executeCommand("editor.action.peekDefinition"))}}})),this._register(this.searchResultEditor.onDidChangeModelContent(()=>{this.updatingModelForSearch||this.getInput()?.setDirty(!0)}))}getControl(){return this.searchResultEditor}focus(){super.focus();let e=this.loadEditorViewState(this.getInput());e&&e.focused==="editor"?this.searchResultEditor.focus():this.queryEditorWidget.focus()}focusSearchInput(){this.queryEditorWidget.searchInput?.focus()}focusFilesToIncludeInput(){this.showingIncludesExcludes||this.toggleIncludesExcludes(!0),this.inputPatternIncludes.focus()}focusFilesToExcludeInput(){this.showingIncludesExcludes||this.toggleIncludesExcludes(!0),this.inputPatternExcludes.focus()}focusNextInput(){this.queryEditorWidget.searchInputHasFocus()?this.showingIncludesExcludes?this.inputPatternIncludes.focus():this.searchResultEditor.focus():this.inputPatternIncludes.inputHasFocus()?this.inputPatternExcludes.focus():this.inputPatternExcludes.inputHasFocus()?this.searchResultEditor.focus():this.searchResultEditor.hasWidgetFocus()}focusPrevInput(){this.queryEditorWidget.searchInputHasFocus()?this.searchResultEditor.focus():this.inputPatternIncludes.inputHasFocus()?this.queryEditorWidget.searchInput?.focus():this.inputPatternExcludes.inputHasFocus()?this.inputPatternIncludes.focus():this.searchResultEditor.hasWidgetFocus()}setQuery(e){this.queryEditorWidget.searchInput?.setValue(e)}selectQuery(){this.queryEditorWidget.searchInput?.select()}toggleWholeWords(){this.queryEditorWidget.searchInput?.setWholeWords(!this.queryEditorWidget.searchInput.getWholeWords()),this.triggerSearch({resetCursor:!1})}toggleRegex(){this.queryEditorWidget.searchInput?.setRegex(!this.queryEditorWidget.searchInput.getRegex()),this.triggerSearch({resetCursor:!1})}toggleCaseSensitive(){this.queryEditorWidget.searchInput?.setCaseSensitive(!this.queryEditorWidget.searchInput.getCaseSensitive()),this.triggerSearch({resetCursor:!1})}toggleContextLines(){this.queryEditorWidget.toggleContextLines()}modifyContextLines(e){this.queryEditorWidget.modifyContextLines(e)}toggleQueryDetails(e){this.toggleIncludesExcludes(e)}deleteResultBlock(){let e=new Set,t=this.searchResultEditor.getSelections(),o=this.searchResultEditor.getModel();if(!(t&&o))return;let n=o.getLineCount(),r=1,s=p=>{for(let h=p;h>=r;h--){let g=o.getLineContent(h);if(e.add(h),g[0]!==void 0&&g[0]!==" ")break}},l=p=>{e.add(p);for(let h=p+1;h<=n;h++){let g=o.getLineContent(h);if(g[0]!==void 0&&g[0]!==" ")return h;e.add(h)}},c=[];for(let p of t){let h=p.startLineNumber;c.push(l(h)),s(h);for(let g=p.startLineNumber;g<=p.endLineNumber;g++)e.add(g)}c.length===0&&c.push(1);let u=p=>p!==void 0;o.pushEditOperations(this.searchResultEditor.getSelections(),[...e].map(p=>({range:new G(p,1,p+1,1),text:""})),()=>c.filter(u).map(p=>new ei(p,1,p,1)))}cleanState(){this.getInput()?.setDirty(!1)}get searchConfig(){return this.configurationService.getValue("search")}iterateThroughMatches(e){let t=this.searchResultEditor.getModel();if(!t)return;let o=t.getLineCount()??1,n=t.getLineLength(o),r=e?new ye(o,n):new ye(1,1),s=this.searchResultEditor.getSelection()?.getStartPosition()??r,l=this.getInput()?.getMatchRanges();if(!l)return;let c=(e?Fxn:Oxn)(l,s);if(!c)return;this.searchResultEditor.setSelection(c),this.searchResultEditor.revealLineInCenterIfOutsideViewport(c.startLineNumber),this.searchResultEditor.focus();let u=t.getLineContent(c.startLineNumber),p=t.getValueInRange(c),h="";for(let g=c.startLineNumber;g>=1;g--)if(t.getValueInRange(new G(g,1,g,2))!==" "){h=t.getLineContent(g);break}cn(d(15319,null,p,u,h.slice(0,h.length-1)))}focusNextResult(){this.iterateThroughMatches(!1)}focusPreviousResult(){this.iterateThroughMatches(!0)}focusAllResults(){this.searchResultEditor.setSelections((this.getInput()?.getMatchRanges()??[]).map(e=>new ei(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn))),this.searchResultEditor.focus()}async triggerSearch(e){let t=this.searchConfig.searchEditor.focusResultsOnSearch;e===void 0?e={focusResults:t}:e.focusResults===void 0&&(e.focusResults=t);let o={resetCursor:!0,delay:0,...e};this.queryEditorWidget.searchInput?.inputBox.isInputValid()&&(this.pauseSearching||await this.runSearchDelayer.trigger(async()=>{this.toggleRunAgainMessage(!1),await this.doRunSearch(),o.resetCursor&&(this.searchResultEditor.setPosition(new ye(1,1)),this.searchResultEditor.setScrollPosition({scrollTop:0,scrollLeft:0})),o.focusResults&&this.searchResultEditor.focus()},o.delay))}readConfigFromWidget(){return{isCaseSensitive:this.queryEditorWidget.searchInput?.getCaseSensitive()??!1,contextLines:this.queryEditorWidget.getContextLines(),filesToExclude:this.inputPatternExcludes.getValue(),filesToInclude:this.inputPatternIncludes.getValue(),query:this.queryEditorWidget.searchInput?.getValue()??"",isRegexp:this.queryEditorWidget.searchInput?.getRegex()??!1,matchWholeWord:this.queryEditorWidget.searchInput?.getWholeWords()??!1,useExcludeSettingsAndIgnoreFiles:this.inputPatternExcludes.useExcludesAndIgnoreFiles(),onlyOpenEditors:this.inputPatternIncludes.onlySearchInOpenEditors(),showIncludesExcludes:this.showingIncludesExcludes,notebookSearchConfig:{includeMarkupInput:this.queryEditorWidget.getNotebookFilters().markupInput,includeMarkupPreview:this.queryEditorWidget.getNotebookFilters().markupPreview,includeCodeInput:this.queryEditorWidget.getNotebookFilters().codeInput,includeOutput:this.queryEditorWidget.getNotebookFilters().codeOutput}}}async doRunSearch(){this.searchModel.cancelSearch(!0);let e=this.getInput();if(!e)return;this.searchHistoryDelayer.trigger(()=>{this.queryEditorWidget.searchInput?.onSearchSubmit(),this.inputPatternExcludes.onSearchSubmit(),this.inputPatternIncludes.onSearchSubmit()});let t=this.readConfigFromWidget();if(!t.query)return;let o={pattern:t.query,isRegExp:t.isRegexp,isCaseSensitive:t.isCaseSensitive,isWordMatch:t.matchWholeWord},n={_reason:"searchEditor",extraFileResources:this.instantiationService.invokeFunction(Tee),maxResults:this.searchConfig.maxResults??void 0,disregardIgnoreFiles:!t.useExcludeSettingsAndIgnoreFiles||void 0,disregardExcludeSettings:!t.useExcludeSettingsAndIgnoreFiles||void 0,excludePattern:[{pattern:t.filesToExclude}],includePattern:t.filesToInclude,onlyOpenEditors:t.onlyOpenEditors,previewOptions:{matchLines:1,charsPerLine:1e3},surroundingContext:t.contextLines,isSmartCase:this.searchConfig.smartCase,expandPatterns:!0,notebookSearchConfig:{includeMarkupInput:t.notebookSearchConfig.includeMarkupInput,includeMarkupPreview:t.notebookSearchConfig.includeMarkupPreview,includeCodeInput:t.notebookSearchConfig.includeCodeInput,includeOutput:t.notebookSearchConfig.includeOutput}},r=this.contextService.getWorkspace().folders,s;try{s=this.instantiationService.createInstance(JS).text(o,r.map(h=>h.uri),n)}catch{return}this.searchOperation.start(500),this.ongoingOperations++;let{configurationModel:l}=await e.resolveModels();l.updateConfig(t);let c=this.searchModel.search(s);e.ongoingSearchOperation=c.asyncResults.finally(()=>{this.ongoingOperations--,this.ongoingOperations===0&&this.searchOperation.stop()});let u=await e.ongoingSearchOperation;await this.onSearchComplete(u,t,e)}async onSearchComplete(e,t,o){let n=this.getInput();if(!n||n!==o||JSON.stringify(t)!==JSON.stringify(this.readConfigFromWidget()))return;n.ongoingSearchOperation=void 0;let r=this.searchConfig.sortOrder;r==="modified"&&await this.retrieveFileStats(this.searchModel.searchResult),qT.get(this.searchResultEditor)?.closeWidget(!1);let l=p=>this.labelService.getUriLabel(p,{relative:!0}),c=c3t(this.searchModel.searchResult,t.filesToInclude,t.filesToExclude,t.contextLines,l,r,e?.limitHit),{resultsModel:u}=await n.resolveModels();if(this.updatingModelForSearch=!0,this.modelService.updateModel(u,c.text),this.updatingModelForSearch=!1,e&&e.messages)for(let p of e.messages)this.addMessage(p);this.reLayout(),n.setDirty(!n.hasCapability(4)),n.setMatchRanges(c.matchRanges)}addMessage(e){let t;this.messageBox.firstChild?t=this.messageBox.firstChild:t=D(this.messageBox,_(".message")),D(t,i3t(e,this.instantiationService,this.notificationService,this.openerService,this.commandService,this.messageDisposables,()=>this.triggerSearch()))}async retrieveFileStats(e){let t=e.matches().filter(o=>!o.fileStat).map(o=>o.resolveFileStat(this.fileService));await Promise.all(t)}layout(e){this.dimension=e,this.reLayout()}getSelected(){let e=this.searchResultEditor.getSelection();return e?this.searchResultEditor.getModel()?.getValueInRange(e)??"":""}reLayout(){this.dimension&&(this.queryEditorWidget.setWidth(this.dimension.width-28),this.searchResultEditor.layout({height:this.dimension.height-Uh(this.queryEditorContainer),width:this.dimension.width}),this.inputPatternExcludes.setWidth(this.dimension.width-28),this.inputPatternIncludes.setWidth(this.dimension.width-28))}getInput(){return this.input}setSearchConfig(e){this.priorConfig=e,e.query!==void 0&&this.queryEditorWidget.setValue(e.query),e.isCaseSensitive!==void 0&&this.queryEditorWidget.searchInput?.setCaseSensitive(e.isCaseSensitive),e.isRegexp!==void 0&&this.queryEditorWidget.searchInput?.setRegex(e.isRegexp),e.matchWholeWord!==void 0&&this.queryEditorWidget.searchInput?.setWholeWords(e.matchWholeWord),e.contextLines!==void 0&&this.queryEditorWidget.setContextLines(e.contextLines),e.filesToExclude!==void 0&&this.inputPatternExcludes.setValue(e.filesToExclude),e.filesToInclude!==void 0&&this.inputPatternIncludes.setValue(e.filesToInclude),e.onlyOpenEditors!==void 0&&this.inputPatternIncludes.setOnlySearchInOpenEditors(e.onlyOpenEditors),e.useExcludeSettingsAndIgnoreFiles!==void 0&&this.inputPatternExcludes.setUseExcludesAndIgnoreFiles(e.useExcludeSettingsAndIgnoreFiles),e.showIncludesExcludes!==void 0&&this.toggleIncludesExcludes(e.showIncludesExcludes)}async setInput(e,t,o,n){if(await super.setInput(e,t,o,n),n.isCancellationRequested)return;let{configurationModel:r,resultsModel:s}=await e.resolveModels();if(!n.isCancellationRequested&&(this.searchResultEditor.setModel(s),this.pauseSearching=!0,this.toggleRunAgainMessage(!e.ongoingSearchOperation&&s.getLineCount()===1&&s.getValueLength()===0&&r.config.query!==""),this.setSearchConfig(r.config),this._register(r.onConfigDidUpdate(l=>{l!==this.priorConfig&&(this.pauseSearching=!0,this.setSearchConfig(l),this.pauseSearching=!1)})),this.restoreViewState(o),t?.preserveFocus||this.focus(),this.pauseSearching=!1,e.ongoingSearchOperation)){let l=this.readConfigFromWidget();e.ongoingSearchOperation.then(c=>{this.onSearchComplete(c,l,e)})}}toggleIncludesExcludes(e){let t="expanded";e??!this.includesExcludesContainer.classList.contains(t)?(this.toggleQueryDetailsButton.setAttribute("aria-expanded","true"),this.includesExcludesContainer.classList.add(t)):(this.toggleQueryDetailsButton.setAttribute("aria-expanded","false"),this.includesExcludesContainer.classList.remove(t)),this.showingIncludesExcludes=this.includesExcludesContainer.classList.contains(t),this.reLayout()}toEditorViewStateResource(e){if(e.typeId===yct)return e.modelUri}computeEditorViewState(e){let o=this.getControl().saveViewState();if(o&&e.toString()===this.getInput()?.modelUri.toString())return{...o,focused:this.searchResultEditor.hasWidgetFocus()?"editor":"input"}}tracksEditorViewState(e){return e.typeId===yct}restoreViewState(e){let t=this.loadEditorViewState(this.getInput(),e);t&&this.searchResultEditor.restoreViewState(t)}getAriaLabel(){return this.getInput()?.getName()??d(15318,null)}};Y$=I([m(1,_e),m(2,Pe),m(3,de),m(4,_t),m(5,Ae),m(6,nt),m(7,F),m(8,qn),m(9,fe),m(10,Je),m(11,Ne),m(12,Hd),m(13,Gn),m(14,kt),m(15,ie),m(16,B),m(17,ge),m(18,re),m(19,ot)],Y$);var Nxn=te("searchEditor.textInputBorder",LI,d(15322,null));function Oxn(a,i){for(let e of a)if(ye.isBefore(i,e.getStartPosition()))return e;return a[0]}function Fxn(a,i){for(let e=a.length-1;e>=0;e--){let t=a[e];if(ye.isBefore(t.getStartPosition(),i))return t}return a[a.length-1]}var Wxn="search.action.openInEditor",Vxn="search.action.openNewEditorToSide",Bxn="search.action.focusQueryEditorWidget",Hxn="search.action.focusFilesToInclude",Uxn="search.action.focusFilesToExclude",zxn="toggleSearchEditorCaseSensitive",Kxn="toggleSearchEditorWholeWord",Gxn="toggleSearchEditorRegex",qxn="increaseSearchEditorContextLines",$xn="decreaseSearchEditorContextLines",jxn="rerunSearchEditorSearch",Qxn="cleanSearchEditorState",Yxn="selectAllSearchEditorMatches";oe.as($t.Configuration).registerConfiguration({...yRe,properties:{"search.searchEditor.doubleClickBehaviour":{type:"string",enum:["selectWord","goToLocation","openLocationToSide"],default:"goToLocation",enumDescriptions:[d(15338,null),d(15336,null),d(15337,null)],markdownDescription:d(15335,null)},"search.searchEditor.singleClickBehaviour":{type:"string",enum:["default","peekDefinition"],default:"default",enumDescriptions:[d(15342,null),d(15343,null)],markdownDescription:d(15341,null)},"search.searchEditor.reusePriorSearchConfiguration":{type:"boolean",default:!1,markdownDescription:d(15340,null)},"search.searchEditor.defaultNumberOfContextLines":{type:["number","null"],default:1,markdownDescription:d(15334,null)},"search.searchEditor.focusResultsOnSearch":{type:"boolean",default:!1,markdownDescription:d(15339,null)}}});oe.as(en.EditorPane).registerEditorPane(os.create(Y$,Y$.ID,d(15344,null)),[new Vt(im)]);var Bze=class{static{this.ID="workbench.contrib.searchEditor"}constructor(i,e){i.registerEditor("*"+zHe,{id:im.ID,label:d(15323,null),detail:Da.providerDisplayName,priority:"default"},{singlePerResource:!0,canSupportResource:t=>Ts(t)===zHe},{createEditorInput:({resource:t})=>({editor:e.invokeFunction(DO,{from:"existingFile",fileUri:t})})})}};Bze=I([m(0,il),m(1,F)],Bze);bt(Bze.ID,Bze,vt.BlockStartup);var h1i=class{canSerialize(i){return!!i.tryReadConfigSync()}serialize(i){if(!this.canSerialize(i))return;if(i.isDisposed())return JSON.stringify({modelUri:void 0,dirty:!1,config:i.tryReadConfigSync(),name:i.getName(),matchRanges:[],backingUri:i.backingUri?.toString()});let e;(i.modelUri.path||i.modelUri.fragment&&i.isDirty())&&(e=i.modelUri.toString());let t=i.tryReadConfigSync(),o=i.isDirty(),n=o?i.getMatchRanges():[],r=i.backingUri;return JSON.stringify({modelUri:e,dirty:o,config:t,name:i.getName(),matchRanges:n,backingUri:r?.toString()})}deserialize(i,e){let{modelUri:t,dirty:o,config:n,matchRanges:r,backingUri:s}=JSON.parse(e);if(n&&n.query!==void 0)if(t){let l=i.invokeFunction(DO,{from:"model",modelUri:A.parse(t),config:n,backupOf:s?A.parse(s):void 0});return l.setDirty(o),l.setMatchRanges(r),l}else return s?i.invokeFunction(DO,{from:"existingFile",fileUri:A.parse(s)}):i.invokeFunction(DO,{from:"rawData",resultsContents:"",config:n})}};oe.as(en.EditorFactory).registerEditorSerializer(im.ID,h1i);Ge.registerCommand(Qxn,a=>{let i=a.get(ie).activeEditorPane;i instanceof Y$&&i.cleanState()});var YE=P(15324,"Search Editor"),g1i=(a={})=>{let i={},e={includes:"filesToInclude",excludes:"filesToExclude",wholeWord:"matchWholeWord",caseSensitive:"isCaseSensitive",regexp:"isRegexp",useIgnores:"useExcludeSettingsAndIgnoreFiles"};return Object.entries(a).forEach(([t,o])=>{i[e[t]??t]=o}),i},f1i={description:"Open a new search editor. Arguments passed can include variables like ${relativeFileDirname}.",args:[{name:"Open new Search Editor args",schema:{properties:{query:{type:"string"},filesToInclude:{type:"string"},filesToExclude:{type:"string"},contextLines:{type:"number"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},isRegexp:{type:"boolean"},useExcludeSettingsAndIgnoreFiles:{type:"boolean"},showIncludesExcludes:{type:"boolean"},triggerSearch:{type:"boolean"},focusResults:{type:"boolean"},onlyOpenEditors:{type:"boolean"}}}}]};W(class extends z{constructor(){super({id:"search.searchEditor.action.deleteFileResults",title:P(15352,"Delete File Results"),keybinding:{weight:100,primary:3073},precondition:SS,category:YE,f1:!0})}async run(a){a.get(X).getContext(Un()).getValue(SS.serialize())&&a.get(ie).activeEditorPane.deleteResultBlock()}});W(class extends z{constructor(){super({id:aMo,title:P(15330,"New Search Editor"),category:YE,f1:!0,metadata:f1i})}async run(a,i){await a.get(F).invokeFunction(KHe,g1i({location:"new",...i}))}});W(class extends z{constructor(){super({id:Cre,title:P(15332,"Open Search Editor"),category:YE,f1:!0,metadata:f1i})}async run(a,i){await a.get(F).invokeFunction(KHe,g1i({location:"reuse",...i}))}});W(class extends z{constructor(){super({id:Vxn,title:P(15329,"Open New Search Editor to the Side"),category:YE,f1:!0,metadata:f1i})}async run(a,i){await a.get(F).invokeFunction(KHe,g1i(i),!0)}});W(class extends z{constructor(){super({id:Wxn,title:P(15331,"Open Results in Editor"),category:YE,f1:!0,keybinding:{primary:515,when:C.and(Ri.HasSearchResults,Ri.SearchViewFocusedKey),weight:200,mac:{primary:2051}}})}async run(a){let i=a.get(Gt),e=a.get(F),t=vd(i);t&&await e.invokeFunction(p3t,t.searchResult,t.searchIncludePattern.getValue(),t.searchExcludePattern.getValue(),t.searchIncludePattern.onlySearchInOpenEditors())}});W(class extends z{constructor(){super({id:jxn,title:P(15333,"Search Again"),category:YE,keybinding:{primary:3120,when:SS,weight:100},icon:t3t,menu:[...[R.EditorTitle,R.CompactWindowEditorTitle].map(a=>({id:a,group:"navigation",when:Tr.isEqualTo(Ict)})),{id:R.CommandPalette,when:Tr.isEqualTo(Ict)}]})}async run(a){let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.triggerSearch({resetCursor:!1})}});W(class extends z{constructor(){super({id:Bxn,title:P(15327,"Focus Search Editor Input"),category:YE,f1:!0,precondition:SS,keybinding:{primary:9,weight:100}})}async run(a){let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.focusSearchInput()}});W(class extends z{constructor(){super({id:Hxn,title:P(15326,"Focus Search Editor Files to Include"),category:YE,f1:!0,precondition:SS})}async run(a){let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.focusFilesToIncludeInput()}});W(class extends z{constructor(){super({id:Uxn,title:P(15325,"Focus Search Editor Files to Exclude"),category:YE,f1:!0,precondition:SS})}async run(a){let i=a.get(ie);i.activeEditor instanceof im&&i.activeEditorPane.focusFilesToExcludeInput()}});W(class extends z{constructor(){super({id:zxn,title:P(15348,"Toggle Match Case"),category:YE,f1:!0,precondition:SS,keybinding:Object.assign({weight:200,when:Ri.SearchInputBoxFocusedKey},C4)})}run(a){bMo(a)}});W(class extends z{constructor(){super({id:Kxn,title:P(15351,"Toggle Match Whole Word"),category:YE,f1:!0,precondition:SS,keybinding:Object.assign({weight:200,when:Ri.SearchInputBoxFocusedKey},x4)})}run(a){SMo(a)}});W(class extends z{constructor(){super({id:Gxn,title:P(15350,"Toggle Use Regular Expression"),category:YE,f1:!0,precondition:SS,keybinding:Object.assign({weight:200,when:Ri.SearchInputBoxFocusedKey},k4)})}run(a){IMo(a)}});W(class extends z{constructor(){super({id:n3t,title:P(15349,"Toggle Context Lines"),category:YE,f1:!0,precondition:SS,keybinding:{weight:200,primary:554,mac:{primary:2602}}})}run(a){yMo(a)}});W(class extends z{constructor(){super({id:qxn,title:P(15346,"Increase Context Lines"),category:YE,f1:!0,precondition:SS,keybinding:{weight:200,primary:598}})}run(a){EVi(a,!0)}});W(class extends z{constructor(){super({id:$xn,title:P(15345,"Decrease Context Lines"),category:YE,f1:!0,precondition:SS,keybinding:{weight:200,primary:600}})}run(a){EVi(a,!1)}});W(class extends z{constructor(){super({id:Yxn,title:P(15347,"Select All Matches"),category:YE,f1:!0,precondition:SS,keybinding:{weight:200,primary:3114}})}run(a){wMo(a)}});W(class extends z{constructor(){super({id:"search.action.openNewEditorFromView",title:d(15328,null),category:YE,icon:rMo,menu:[{id:R.ViewTitle,group:"navigation",order:2,when:C.equals("view",ow)}]})}run(i,...e){return CMo(i)}});var Hze=class extends k{constructor(e,t){super();this.instantiationService=e;this._register(t.registerHandler(this))}static{this.ID="workbench.contrib.searchEditorWorkingCopyEditorHandler"}handles(e){return e.resource.scheme===WHe}isOpen(e,t){return this.handles(e)?t instanceof im&&ze(e.resource,t.modelUri):!1}createEditor(e){let t=this.instantiationService.invokeFunction(DO,{from:"model",modelUri:e.resource});return t.setDirty(!0),t}};Hze=I([m(0,F),m(1,If)],Hze);bt(Hze.ID,Hze,vt.BlockRestore);var LSe=class extends k{constructor(e){super();this.configurationService=e;this.styleSheet=Pr();U.filter(e.onDidChangeConfiguration,n=>n.affectsConfiguration("workbench.sash.size"))(this.onDidChangeSize,this,this._store),this.onDidChangeSize(),U.filter(e.onDidChangeConfiguration,n=>n.affectsConfiguration("workbench.sash.hoverDelay"))(this.onDidChangeHoverDelay,this,this._store),this.onDidChangeHoverDelay()}static{this.ID="workbench.contrib.sash"}onDidChangeSize(){let e=this.configurationService.getValue("workbench.sash.size"),t=jn(e,4,20),o=jn(e,1,8);this.styleSheet.textContent=`
			.monaco-workbench {
				--vscode-sash-size: ${t}px;
				--vscode-sash-hover-size: ${o}px;
			}
		`,XZi(t)}onDidChangeHoverDelay(){eeo(this.configurationService.getValue("workbench.sash.hoverDelay"))}};LSe=I([m(0,B)],LSe);bt(LSe.ID,LSe,vt.AfterRestored);oe.as($t.Configuration).registerConfiguration({...jd,properties:{"workbench.sash.size":{type:"number",default:Tc?20:4,minimum:1,maximum:20,description:d(14762,null)},"workbench.sash.hoverDelay":{type:"number",default:300,minimum:0,maximum:2e3,description:d(14761,null)}}});Ce(cMe,lMe,1);var _6t={ActiveRepositoryName:new Y("scmActiveRepositoryName",""),ActiveRepositoryBranchName:new Y("scmActiveRepositoryBranchName","")},Uze=class extends k{constructor(e,t,o,n,r,s,l){super();this.activityService=e;this.configurationService=t;this.contextKeyService=o;this.scmService=n;this.scmViewService=r;this.statusbarService=s;this.titleService=l;this._activeRepositoryNameContextKey=_6t.ActiveRepositoryName.bindTo(this.contextKeyService),this._activeRepositoryBranchNameContextKey=_6t.ActiveRepositoryBranchName.bindTo(this.contextKeyService),this.titleService.registerVariables([{name:"activeRepositoryName",contextKey:_6t.ActiveRepositoryName.key},{name:"activeRepositoryBranchName",contextKey:_6t.ActiveRepositoryBranchName.key}]),this._countBadgeConfig=hr("scm.countBadge","all",this.configurationService),this._visibleRepositories=vi(this,U.any(this.scmViewService.onDidChangeVisibleRepositories,this.scmService.onDidAddRepository,this.scmService.onDidRemoveRepository),()=>this.scmViewService.visibleRepositories),this._activeRepositoryHistoryItemRefName=ke(c=>this.scmViewService.activeRepository.read(c)?.repository.provider.historyProvider.read(c)?.historyItemRef.read(c)?.name),this._countBadgeRepositories=ke(this,c=>{switch(this._countBadgeConfig.read(c)){case"all":return this._visibleRepositories.read(c).map(p=>({provider:p.provider,resourceCount:this._getRepositoryResourceCount(p)}));case"focused":{let u=this.scmViewService.activeRepository.read(c);return u?[{provider:u.repository.provider,resourceCount:this._getRepositoryResourceCount(u.repository)}]:[]}case"off":return[];default:throw new Error("Invalid countBadge setting")}}),this._countBadge=ke(this,c=>{let u=0;for(let p of this._countBadgeRepositories.read(c)){let h=p.provider.count?.read(c),g=p.resourceCount.read(c);u=u+(h??g)}return u}),this._register(ve(c=>{let u=this._countBadge.read(c);this._updateActivityCountBadge(u,c.store)})),this._register(ve(c=>{let u=this.scmViewService.activeRepository.read(c),p=u?.repository.provider.statusBarCommands.read(c);this._updateStatusBar(u,p??[],c.store)})),this._register(ve(c=>{let u=this.scmViewService.activeRepository.read(c),p=this._activeRepositoryHistoryItemRefName.read(c);this._updateActiveRepositoryContextKeys(u?.repository.provider.name,p)}))}_getRepositoryResourceCount(e){return vi(this,e.provider.onDidChangeResources,()=>HGt(e.provider))}_updateActivityCountBadge(e,t){if(e===0)return;let o=new eu(e,n=>d(14765,null,n));t.add(this.activityService.showViewActivity(wv,{badge:o}))}_updateStatusBar(e,t,o){if(!e)return;let n=e.repository.provider.rootUri?`${Be(e.repository.provider.rootUri)} (${e.repository.provider.label})`:e.repository.provider.label;for(let r=0;r<t.length;r++){let s=t[r],l=`${n}${s.tooltip?` - ${s.tooltip}`:""}`,c=HPi(s),u={name:d(14766,null)+(c?` ${c}`:""),text:s.title,ariaLabel:l,tooltip:l,command:s.id?s:void 0};o.add(r===0?this.statusbarService.addEntry(u,`status.scm.${r}`,0,1e4):this.statusbarService.addEntry(u,`status.scm.${r}`,0,{location:{id:`status.scm.${r-1}`,priority:1e4},alignment:1,compact:!0}))}if(this.scmViewService.repositories.length>1){let r=zGt(e,e.repository),s={name:d(14767,null),text:`$(${r.id}) ${e.repository.provider.name}`,ariaLabel:n,tooltip:n,command:"scm.setActiveProvider"};o.add(this.statusbarService.addEntry(s,"status.scm.provider",0,{location:{id:"status.scm.0",priority:1e4},alignment:0,compact:!0}))}}_updateActiveRepositoryContextKeys(e,t){this._activeRepositoryNameContextKey.set(e??""),this._activeRepositoryBranchNameContextKey.set(t??"")}};Uze=I([m(0,Al),m(1,B),m(2,X),m(3,lc),m(4,Au),m(5,Fr),m(6,aP)],Uze);var zze=class extends k{constructor(e,t,o){super();this.scmService=t;this.uriIdentityService=o;this._onDidRepositoryChange=new T;let n=new Y("scmActiveResourceHasChanges",!1,d(14763,null)),r=new Y("scmActiveResourceRepository",void 0,d(14764,null));this._repositories=vi(this,U.any(this.scmService.onDidAddRepository,this.scmService.onDidRemoveRepository),()=>this.scmService.repositories),this._register(ve(c=>{for(let u of this._repositories.read(c))c.store.add(U.runAndSubscribe(u.provider.onDidChangeResources,()=>{this._onDidRepositoryChange.fire()}))}));let s={contextKey:n,getGroupContextKeyValue:c=>this._getEditorHasChanges(c.activeEditor),onDidChange:this._onDidRepositoryChange.event},l={contextKey:r,getGroupContextKeyValue:c=>this._getEditorRepositoryId(c.activeEditor),onDidChange:this._onDidRepositoryChange.event};this._store.add(e.registerContextKeyProvider(s)),this._store.add(e.registerContextKeyProvider(l))}_getEditorHasChanges(e){let t=po.getOriginalUri(e);if(!t)return!1;let o=this.scmService.getRepository(t);for(let n of o?.provider.groups??[])if(n.resources.some(r=>this.uriIdentityService.extUri.isEqual(t,r.sourceUri)))return!0;return!1}_getEditorRepositoryId(e){let t=po.getOriginalUri(e);return t?this.scmService.getRepository(t)?.id:void 0}dispose(){this._onDidRepositoryChange.dispose(),super.dispose()}};zze=I([m(0,kt),m(1,lc),m(2,gt)],zze);var Kze=class extends Qc{constructor(i,e,t,o,n,r,s,l,c,u,p){super(Jpe,{mergeViewWithContainerWhenSingleView:!0},t,s,i,o,e,l,n,r,c,u,p)}create(i){super.create(i),i.classList.add("scm-viewlet")}getOptimalWidth(){return 400}};Kze=I([m(0,wi),m(1,_e),m(2,F),m(3,Xe),m(4,Pe),m(5,de),m(6,B),m(7,lt),m(8,Ae),m(9,ji),m(10,re)],Kze);var Gze=class extends cs{constructor(e){super();this.getSelectedRepositories=e}async runAction(e,t){if(!(e instanceof Do))return super.runAction(e,t);let o=[t],n=this.getSelectedRepositories().map(r=>r.provider);n.some(r=>r===t)&&o.push(...n.filter(r=>r!==t)),await e.run(...o)}},GV=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this.toolbarMenuId=i;this.actionViewItemProvider=e;this.commandService=t;this.contextKeyService=o;this.contextMenuService=n;this.keybindingService=r;this.labelService=s;this.menuService=l;this.scmViewService=c;this.telemetryService=u;this.uriIdentityService=p;this.onDidChangeVisibleRepositoriesSignal=qr(this,this.scmViewService.onDidChangeVisibleRepositories)}static{this.TEMPLATE_ID="repository"}get templateId(){return GV.TEMPLATE_ID}renderTemplate(i){let e=D(i,_(".scm-provider")),t=D(e,_(".icon")),o=new ld(e,{supportIcons:!1}),n=D(e,_(".actions")),r=new dl(n,{actionViewItemProvider:this.actionViewItemProvider,resetMenu:this.toolbarMenuId,responsiveBehavior:{enabled:!0,kind:"all",minItems:2}},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService),s=D(e,_(".count")),l=new eb(s,{},VI),c=r.onDidChangeDropdownVisibility(p=>e.classList.toggle("active",p)),u=Fn(o,c,r);return{icon:t,label:o,countContainer:s,count:l,toolBar:r,elementDisposables:new O,templateDisposable:u}}renderElement(i,e,t){let o=ou(i)?i:i.element;t.elementDisposables.add(ve(h=>{this.onDidChangeVisibleRepositoriesSignal.read(h);let g=this.scmViewService.isVisible(o),f=q.isThemeIcon(o.provider.iconPath)?o.provider.iconPath:L.repo,v=f.id===L.repo.id&&g&&this.scmViewService.repositories.length>1;t.icon.className=v?`icon ${q.asClassName(L.repoSelected)}`:`icon ${q.asClassName(f)}`}));let n;if(o.provider.rootUri){let h=this.scmViewService.repositories.filter(f=>f.provider.rootUri!==void 0&&this.uriIdentityService.extUri.isEqual(f.provider.rootUri,o.provider.rootUri)),g=this.scmViewService.repositories.filter(f=>f.provider.rootUri!==void 0&&f.provider.name===o.provider.name);if(h.length>1)n=o.provider.label;else if(g.length>1){let f=g.findIndex(b=>b===o);n=rxe(g.map(b=>this.labelService.getUriLabel(ai(b.provider.rootUri),{relative:!0})))[f]}}let r;if(this.scmViewService.explorerEnabledConfig.get()===!1)r=o.provider.name;else{let h=this.scmViewService.repositories.find(g=>g.provider.id===o.provider.parentId);r=h?`${h.provider.name} / ${o.provider.name}`:o.provider.name}let s=o.provider.rootUri?`${o.provider.label}: ${this.labelService.getUriLabel(o.provider.rootUri)}`:o.provider.label;t.label.setLabel(r,n,{title:s});let l=[],c=[],u=[],p=()=>{t.toolBar.setActions([...l,...c],u)};t.elementDisposables.add(ve(h=>{l=(o.provider.statusBarCommands.read(h)??[]).map(f=>h.store.add(new lst(f,this.commandService))),p()})),t.elementDisposables.add(ve(h=>{let g=o.provider.count.read(h)??HGt(o.provider);t.countContainer.setAttribute("data-count",String(g)),t.count.setCount(g)})),t.elementDisposables.add(ve(h=>{o.provider.contextValue.read(h);let g=this.scmViewService.menus.getRepositoryMenus(o.provider),f=this.toolbarMenuId===R.SCMTitle?g.titleMenu.menu:g.getRepositoryMenu(o);h.store.add(xoe(f,(v,b)=>{c=v,u=b,p()},this.toolbarMenuId===R.SCMTitle?"navigation":"inline"))})),t.toolBar.context=o.provider}renderCompressedElements(){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposable.dispose(),i.count.dispose()}};GV=I([m(2,fe),m(3,X),m(4,Xe),m(5,Le),m(6,nt),m(7,Yt),m(8,Au),m(9,_e),m(10,gt)],GV);function FNo(a,i){return a.id===i.id}var qze=class{constructor(i,e){this._actions=[];this._secondaryActions=[];this.disposables=new O;this._onDidChangeTitle=this.disposables.add(new T);this.onDidChangeTitle=this._onDidChangeTitle.event;this.menu=i.createMenu(R.SCMTitle,e),this.disposables.add(this.menu),this.menu.onDidChange(this.updateTitleActions,this,this.disposables),this.updateTitleActions()}get actions(){return this._actions}get secondaryActions(){return this._secondaryActions}updateTitleActions(){let{primary:i,secondary:e}=xl(this.menu.getActions({shouldForwardArgs:!0}));eo(i,this._actions,FNo)&&eo(e,this._secondaryActions,FNo)||(this._actions=i,this._secondaryActions=e,this._onDidChangeTitle.fire())}dispose(){this.disposables.dispose()}};qze=I([m(0,Yt),m(1,X)],qze);var v1i=class{constructor(i,e){this.contextKeyService=i;this.menuService=e}get resourceFolderMenu(){return this._resourceFolderMenu||(this._resourceFolderMenu=this.menuService.createMenu(R.SCMResourceFolderContext,this.contextKeyService)),this._resourceFolderMenu}getResourceGroupMenu(i){if(typeof i.contextValue>"u")return this.genericResourceGroupMenu||(this.genericResourceGroupMenu=this.menuService.createMenu(R.SCMResourceGroupContext,this.contextKeyService)),this.genericResourceGroupMenu;this.contextualResourceGroupMenus||(this.contextualResourceGroupMenus=new Map);let e=this.contextualResourceGroupMenus.get(i.contextValue);if(!e){let t=this.contextKeyService.createOverlay([["scmResourceGroupState",i.contextValue]]),o=this.menuService.createMenu(R.SCMResourceGroupContext,t);e={menu:o,dispose(){o.dispose()}},this.contextualResourceGroupMenus.set(i.contextValue,e)}return e.menu}getResourceMenu(i){if(typeof i.contextValue>"u")return this.genericResourceMenu||(this.genericResourceMenu=this.menuService.createMenu(R.SCMResourceContext,this.contextKeyService)),this.genericResourceMenu;this.contextualResourceMenus||(this.contextualResourceMenus=new Map);let e=this.contextualResourceMenus.get(i.contextValue);if(!e){let t=this.contextKeyService.createOverlay([["scmResourceState",i.contextValue]]),o=this.menuService.createMenu(R.SCMResourceContext,t);e={menu:o,dispose(){o.dispose()}},this.contextualResourceMenus.set(i.contextValue,e)}return e.menu}dispose(){this.genericResourceGroupMenu?.dispose(),this.genericResourceMenu?.dispose(),this._resourceFolderMenu?.dispose(),this.contextualResourceGroupMenus&&(je(this.contextualResourceGroupMenus.values()),this.contextualResourceGroupMenus.clear(),this.contextualResourceGroupMenus=void 0),this.contextualResourceMenus&&(je(this.contextualResourceMenus.values()),this.contextualResourceMenus.clear(),this.contextualResourceMenus=void 0)}},Sut=class{constructor(i,e,t,o){this.provider=i;this.menuService=o;this.artifactGroupMenus=new Map;this.artifactMenus=new Map;this.resourceGroupMenusItems=new Map;this.disposables=new O;this.contextKeyService=e.createOverlay([["scmProvider",i.providerId],["scmProviderRootUri",i.rootUri?.toString()],["scmProviderHasRootUri",!!i.rootUri]]);let n=new Po([X,this.contextKeyService]);t=t.createChild(n,this.disposables),this.titleMenu=t.createInstance(qze),this.disposables.add(this.titleMenu),i.onDidChangeResourceGroups(this.onDidChangeResourceGroups,this,this.disposables),this.onDidChangeResourceGroups()}getArtifactGroupMenu(i){let e=this.artifactGroupMenus.get(i.id);if(!e){let t=this.contextKeyService.createOverlay([["scmArtifactGroup",i.id]]),o=this.menuService.createMenu(R.SCMArtifactGroupContext,t);e={menu:o,dispose(){o.dispose()}},this.artifactGroupMenus.set(i.id,e)}return e.menu}getArtifactMenu(i,e){let o=this.provider.historyProvider.get()?.historyItemRef.get(),n=e.id===o?.id,r=n?`${i.id}|historyItemRef`:i.id,s=this.artifactMenus.get(r);if(!s){let l=this.contextKeyService.createOverlay([["scmArtifactGroupId",i.id],["scmArtifactIsHistoryItemRef",n]]),c=this.menuService.createMenu(R.SCMArtifactContext,l);s={menu:c,dispose(){c.dispose()}},this.artifactMenus.set(r,s)}return s.menu}getRepositoryMenu(i){let e=i.provider.contextValue.get();if(typeof e>"u")return this.genericRepositoryMenu||(this.genericRepositoryMenu=this.menuService.createMenu(R.SCMSourceControlInline,this.contextKeyService)),this.genericRepositoryMenu;this.contextualRepositoryMenus||(this.contextualRepositoryMenus=new Map);let t=this.contextualRepositoryMenus.get(e);if(!t){let o=this.contextKeyService.createOverlay([["scmProviderContext",e]]),n=this.menuService.createMenu(R.SCMSourceControlInline,o);t={menu:n,dispose(){n.dispose()}},this.contextualRepositoryMenus.set(e,t)}return t.menu}getRepositoryContextMenu(i){let e=i.provider.contextValue.get();if(typeof e>"u")return this.genericRepositoryContextMenu||(this.genericRepositoryContextMenu=this.menuService.createMenu(R.SCMSourceControl,this.contextKeyService)),this.genericRepositoryContextMenu;this.contextualRepositoryContextMenus||(this.contextualRepositoryContextMenus=new Map);let t=this.contextualRepositoryContextMenus.get(e);if(!t){let o=this.contextKeyService.createOverlay([["scmProviderContext",e]]),n=this.menuService.createMenu(R.SCMSourceControl,o);t={menu:n,dispose(){n.dispose()}},this.contextualRepositoryContextMenus.set(e,t)}return t.menu}getResourceGroupMenu(i){return this.getOrCreateResourceGroupMenusItem(i).getResourceGroupMenu(i)}getResourceMenu(i){return this.getOrCreateResourceGroupMenusItem(i.resourceGroup).getResourceMenu(i)}getResourceFolderMenu(i){return this.getOrCreateResourceGroupMenusItem(i).resourceFolderMenu}getOrCreateResourceGroupMenusItem(i){let e=this.resourceGroupMenusItems.get(i);if(!e){let t=this.contextKeyService.createOverlay([["scmResourceGroup",i.id],["multiDiffEditorEnableViewChanges",i.multiDiffEditorEnableViewChanges]]);e=new v1i(t,this.menuService),this.resourceGroupMenusItems.set(i,e)}return e}onDidChangeResourceGroups(){for(let i of this.resourceGroupMenusItems.keys())this.provider.groups.includes(i)||(this.resourceGroupMenusItems.get(i)?.dispose(),this.resourceGroupMenusItems.delete(i))}dispose(){this.genericRepositoryMenu?.dispose(),this.contextualRepositoryMenus&&(je(this.contextualRepositoryMenus.values()),this.contextualRepositoryMenus.clear(),this.contextualRepositoryMenus=void 0),this.resourceGroupMenusItems.forEach(i=>i.dispose()),this.disposables.dispose()}};Sut=I([m(1,X),m(2,F),m(3,Yt)],Sut);var $ze=class{constructor(i,e){this.instantiationService=e;this.disposables=new O;this.menus=new Map;this.titleMenu=e.createInstance(qze),i.onDidRemoveRepository(this.onDidRemoveRepository,this,this.disposables)}onDidRemoveRepository(i){this.menus.get(i.provider)?.dispose(),this.menus.delete(i.provider)}getRepositoryMenus(i){let e=this.menus.get(i);if(!e){let t=this.instantiationService.createInstance(Sut,i);e={menus:t,dispose:()=>{t.dispose(),this.menus.delete(i)}},this.menus.set(i,e)}return e.menus}dispose(){this.disposables.dispose()}};$ze=I([m(0,lc),m(1,F)],$ze);be.appendMenuItem(R.SCMResourceContext,{title:d(14768,null),submenu:R.SCMResourceContextShare,group:"45_share",order:3});function b1i(a){return`${a.providerId}:${a.label}${a.rootUri?`:${a.rootUri.toString()}`:""}`}function WNo(a,i){if(!i.provider.rootUri)return i.provider.label;let e=a.getWorkspaceFolder(i.provider.rootUri);return e?.uri.toString()===i.provider.rootUri.toString()?e.name:Be(i.provider.rootUri)}var Iut={RepositorySortKey:new Y("scmRepositorySortKey","discoveryTime"),RepositorySelectionMode:new Y("scmRepositorySelectionMode","single")},jze=class{constructor(i,e,t,o){this._placeHolder=i;this._autoQuickItemDescription=e;this._quickInputService=t;this._scmViewService=o;this._autoQuickPickItem={label:d(14985,null),description:this._autoQuickItemDescription,repository:"auto"}}async pickRepository(){let i=[this._autoQuickPickItem,{type:"separator"}],e=this._scmViewService.activeRepository.get(),t=e?.repository,o=e?.pinned===!0;i.push(...this._scmViewService.repositories.map(r=>{let s=zGt(e,r);return{label:r.provider.name,description:r.provider.rootUri?.fsPath,iconClass:q.asClassName(s),repository:r}}));let n=o?i.find(r=>r.type!=="separator"&&r.repository===t):this._autoQuickPickItem;return this._quickInputService.pick(i,{placeHolder:this._placeHolder,activeItem:n})}};jze=I([m(2,$e),m(3,Au)],jze);var X$=class{constructor(i,e,t,o,n,r,s,l){this.scmService=i;this.editorService=t;this.configurationService=r;this.storageService=s;this.workspaceContextService=l;this.didSelectRepository=!1;this.disposables=new O;this._repositories=[];this.didFinishLoadingRepositories=De(this,!1);this._onDidChangeRepositories=new T;this.onDidChangeRepositories=this._onDidChangeRepositories.event;this._onDidSetVisibleRepositories=new T;this.onDidChangeVisibleRepositories=U.any(this._onDidSetVisibleRepositories.event,U.debounce(this._onDidChangeRepositories.event,(i,e)=>{if(!i)return e;let t=new Set(i.added),o=new Set(i.removed);for(let n of e.added)o.delete(n)||t.add(n);for(let n of e.removed)t.delete(n)||o.add(n);return{added:t,removed:o}},0,void 0,void 0,void 0,this.disposables));this._onDidFocusRepository=new T;this.onDidFocusRepository=this._onDidFocusRepository.event;this.menus=n.createInstance($ze);let c=hr("scm.repositories.explorer",!1,this.configurationService);this.graphShowIncomingChangesConfig=hr("scm.graph.showIncomingChanges",!0,this.configurationService),this.graphShowOutgoingChangesConfig=hr("scm.graph.showOutgoingChanges",!0,this.configurationService),this.selectionModeConfig=hr("scm.repositories.selectionMode","multiple",this.configurationService),this.explorerEnabledConfig=ke(u=>c.read(u)===!0&&this.selectionModeConfig.read(u)==="single");try{this.previousState=JSON.parse(s.get("scm:view:visibleRepositories",1,"")),this.previousState&&this.previousState.visible.length>1&&this.selectionModeConfig.get()==="single"&&(this.previousState={...this.previousState,visible:[this.previousState.visible[0]]})}catch{}this._focusedRepositoryObs=Mb({owner:this,equalsFn:()=>!1},this.onDidFocusRepository,()=>this.focusedRepository),this._activeEditorObs=Mb({owner:this,equalsFn:()=>!1},this.editorService.onDidActiveEditorChange,()=>this.editorService.activeEditor),this._activeEditorRepositoryObs=mv(this,(u,p)=>{let h=this._activeEditorObs.read(u),g=po.getOriginalUri(h);if(!g)return p;let f=this.scmService.getRepository(g);return f?Object.create(f):p}),this._activeRepositoryPinnedObs=De(this,void 0),this._activeRepositoryObs=E4e(this,[this._activeEditorRepositoryObs,this._focusedRepositoryObs]),this.activeRepository=Js({owner:this,equalsFn:(u,p)=>u?.repository.id===p?.repository.id&&u?.pinned===p?.pinned},u=>{let p=this._activeRepositoryObs.read(u),h=this._activeRepositoryPinnedObs.read(u),g=h??p;return g?{repository:g,pinned:!!h}:void 0}),this.disposables.add(Zs(this.selectionModeConfig,u=>{if(u==="single"&&this.visibleRepositories.length>1){let p=this.visibleRepositories[0];this.visibleRepositories=[p]}else u==="multiple"&&this.repositories.length>1&&(this.visibleRepositories=this.repositories)})),this._repositoriesSortKey=this.previousState?.sortKey??this.getViewSortOrder(),this._sortKeyContextKey=Iut.RepositorySortKey.bindTo(e),this._sortKeyContextKey.set(this._repositoriesSortKey),this._selectionModelContextKey=Iut.RepositorySelectionMode.bindTo(e),this.disposables.add(ve(u=>{let p=this.selectionModeConfig.read(u);this._selectionModelContextKey.set(p)})),i.onDidAddRepository(this.onDidAddRepository,this,this.disposables),i.onDidRemoveRepository(this.onDidRemoveRepository,this,this.disposables);for(let u of i.repositories)this.onDidAddRepository(u);s.onWillSaveState(this.onWillSaveState,this,this.disposables),o.onWillStop(()=>{this.onWillSaveState(),this.didFinishLoadingRepositories.set(!1,void 0)},this,this.disposables)}get repositories(){return this._repositories.filter(i=>i.repository.provider.isHidden!==!0).map(i=>i.repository)}get visibleRepositories(){return this._repositoriesSortKey==="discoveryTime"?this._repositories.filter(i=>i.repository.provider.isHidden!==!0&&i.selectionIndex!==-1).sort((i,e)=>i.selectionIndex-e.selectionIndex).map(i=>i.repository):this._repositories.filter(i=>i.repository.provider.isHidden!==!0&&i.selectionIndex!==-1).map(i=>i.repository)}set visibleRepositories(i){let e=new Set(i),t=new Set,o=new Set;for(let n of this._repositories)!e.has(n.repository)&&n.selectionIndex!==-1&&(n.selectionIndex=-1,o.add(n.repository)),e.has(n.repository)&&(n.selectionIndex===-1&&t.add(n.repository),n.selectionIndex=i.indexOf(n.repository));t.size===0&&o.size===0||(this._onDidSetVisibleRepositories.fire({added:t,removed:o}),this._repositories.find(n=>n.focused&&n.selectionIndex===-1)&&this.focus(this._repositories.find(n=>n.selectionIndex!==-1)?.repository))}get focusedRepository(){return this._repositories.find(i=>i.focused)?.repository}onDidAddRepository(i){this.didFinishLoadingRepositories.get()||this.eventuallyFinishLoading();let e={repository:i,discoveryTime:Date.now(),focused:!1,selectionIndex:-1},t=yt.empty();if(this.previousState&&!this.didFinishLoadingRepositories.get()){let o=this.previousState.all.indexOf(b1i(i.provider));if(o===-1){let n=[];this.insertRepositoryView(this._repositories,e),(this.selectionModeConfig.get()==="multiple"||!this._repositories.find(r=>r.selectionIndex!==-1))&&(this._repositories.forEach((r,s)=>{r.selectionIndex===-1&&n.push(r.repository),r.selectionIndex=s}),this._onDidChangeRepositories.fire({added:n,removed:yt.empty()})),this.didSelectRepository=!1;return}if(this.previousState.visible.indexOf(o)===-1){if(this.didSelectRepository){this.insertRepositoryView(this._repositories,e),this._onDidChangeRepositories.fire({added:yt.empty(),removed:yt.empty()});return}}else this.didSelectRepository||(t=[...this.visibleRepositories],this._repositories.forEach(n=>{n.focused=!1,n.selectionIndex=-1}),this.didSelectRepository=!0)}if(this.selectionModeConfig.get()==="multiple"||!this._repositories.find(o=>o.selectionIndex!==-1)){let o=this.getMaxSelectionIndex();this.insertRepositoryView(this._repositories,{...e,selectionIndex:o+1}),this._onDidChangeRepositories.fire({added:[e.repository],removed:t})}else this.insertRepositoryView(this._repositories,e),this._onDidChangeRepositories.fire({added:yt.empty(),removed:t});this._repositories.find(o=>o.focused)||this.focus(i)}onDidRemoveRepository(i){this.didFinishLoadingRepositories.get()||this.eventuallyFinishLoading();let e=this._repositories.findIndex(n=>n.repository===i);if(e===-1)return;let t=yt.empty(),o=this._repositories.splice(e,1);this._repositories.length>0&&this.visibleRepositories.length===0&&(this._repositories[0].selectionIndex=0,t=[this._repositories[0].repository]),this._onDidChangeRepositories.fire({added:t,removed:o.map(n=>n.repository)}),o.length===1&&o[0].focused&&this.visibleRepositories.length>0&&this.focus(this.visibleRepositories[0]),o.length===1&&this._repositories.length===0&&this._onDidFocusRepository.fire(void 0),o.length===1&&o[0].repository===this._activeRepositoryPinnedObs.get()&&this._activeRepositoryPinnedObs.set(void 0,void 0)}isVisible(i){return this._repositories.find(e=>e.repository===i)?.selectionIndex!==-1}toggleVisibility(i,e){if(typeof e>"u")e=!this.isVisible(i);else if(this.isVisible(i)===e)return;if(e)this.selectionModeConfig.get()==="single"?this.visibleRepositories=[i]:this.selectionModeConfig.get()==="multiple"&&(this.visibleRepositories=[...this.visibleRepositories,i]);else{let t=this.visibleRepositories.indexOf(i);t>-1&&(this.visibleRepositories=[...this.visibleRepositories.slice(0,t),...this.visibleRepositories.slice(t+1)])}}toggleSortKey(i){this._repositoriesSortKey=i,this._sortKeyContextKey.set(this._repositoriesSortKey),this._repositories.sort(this.compareRepositories.bind(this)),this._onDidChangeRepositories.fire({added:yt.empty(),removed:yt.empty()})}toggleSelectionMode(i){this.configurationService.updateValue("scm.repositories.selectionMode",i)}focus(i){i&&!this.isVisible(i)||(this._repositories.forEach(e=>e.focused=e.repository===i),this._repositories.find(e=>e.focused)&&this._onDidFocusRepository.fire(i))}pinActiveRepository(i){this._activeRepositoryPinnedObs.set(i,void 0)}compareRepositories(i,e){if(this._repositoriesSortKey==="discoveryTime")return i.discoveryTime-e.discoveryTime;if(this._repositoriesSortKey==="path"&&i.repository.provider.rootUri&&e.repository.provider.rootUri)return Cte(i.repository.provider.rootUri.fsPath,e.repository.provider.rootUri.fsPath);let t=WNo(this.workspaceContextService,i.repository),o=WNo(this.workspaceContextService,e.repository),n=C_(t,o);return n===0&&i.repository.provider.rootUri&&e.repository.provider.rootUri?Cte(i.repository.provider.rootUri.fsPath,e.repository.provider.rootUri.fsPath):n}getMaxSelectionIndex(){return this._repositories.length===0?-1:Math.max(...this._repositories.map(i=>i.selectionIndex))}getViewSortOrder(){switch(this.configurationService.getValue("scm.repositories.sortOrder")){case"discovery time":return"discoveryTime";case"name":return"name";case"path":return"path";default:return"discoveryTime"}}insertRepositoryView(i,e){let t=Ek(i,e,this.compareRepositories.bind(this));i.splice(t<0?~t:t,0,e)}onWillSaveState(){if(!this.didFinishLoadingRepositories.get())return;let i=this.repositories.map(t=>b1i(t.provider)),e=this.visibleRepositories.map(t=>i.indexOf(b1i(t.provider)));this.previousState={all:i,visible:e,sortKey:this._repositoriesSortKey},this.storageService.store("scm:view:visibleRepositories",JSON.stringify(this.previousState),1,1)}eventuallyFinishLoading(){this.finishLoading()}finishLoading(){this.didFinishLoadingRepositories.get()||this.didFinishLoadingRepositories.set(!0,void 0)}dispose(){this.disposables.dispose(),this._onDidFocusRepository.dispose(),this._onDidChangeRepositories.dispose(),this._onDidSetVisibleRepositories.dispose()}};I([Tu(5e3)],X$.prototype,"eventuallyFinishLoading",1),X$=I([m(0,lc),m(1,X),m(2,ie),m(3,lt),m(4,F),m(5,B),m(6,de),m(7,Ae)],X$);var D6t={SCMInputHasValidationMessage:new Y("scmInputHasValidationMessage",!1)};var yut=class extends cs{constructor(e,t){super();this.input=e;this.storageService=t;this._runningActions=new Set}get runningActions(){return this._runningActions}async runAction(e){try{if(this.runningActions.size!==0&&(this._cts?.cancel(),e.id==="scm.input.cancelAction"))return;let t=[];for(let o of this.input.repository.provider.groups)t.push({resourceGroupId:o.id,resources:[...o.resources.map(n=>n.sourceUri)]});this._runningActions.add(e),this._cts=new qe,await e.run(this.input.repository.provider.rootUri,t,this._cts.token)}finally{if(this._runningActions.delete(e),this._runningActions.size===0){let t=e.id==="scm.input.triggerSetup"?$i.defaultChatAgent?.generateCommitMessageCommand??e.id:e.id;this.storageService.store("scm.input.lastActionId",t,0,0)}}}};yut=I([m(1,de)],yut);var wut=class extends dl{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r,l,s,u);this.menuService=o;this.contextKeyService=n;this.storageService=c;this._dropdownActions=[];this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._disposables=this._register(new ue);this._dropdownAction=new it("scmInputMoreActions",d(14964,null),"codicon-chevron-down"),this._cancelAction=new Do({id:"scm.input.cancelAction",title:d(14962,null),icon:L.stopCircle},void 0,void 0,void 0,void 0,n,s)}get dropdownActions(){return this._dropdownActions}get dropdownAction(){return this._dropdownAction}setInput(e){this._disposables.value=new O;let t=this.contextKeyService.createOverlay([["scmProvider",e.repository.provider.providerId],["scmProviderRootUri",e.repository.provider.rootUri?.toString()],["scmProviderHasRootUri",!!e.repository.provider.rootUri]]),o=this._disposables.value.add(this.menuService.createMenu(R.SCMInputBox,t,{emitEventsForSubmenuChanges:!0})),n=()=>e.repository.provider.groups.some(s=>s.resources.length>0),r=()=>{let s=Ng(o.getActions({shouldForwardArgs:!0}));for(let c of s)c.enabled=n();this._dropdownAction.enabled=n();let l;if(this.actionRunner.runningActions.size!==0)l=this._cancelAction;else if(s.length===1)l=s[0];else if(s.length>1){let c=this.storageService.get("scm.input.lastActionId",0,"");l=s.find(u=>u.id===c)??s[0]}this._dropdownActions=s.length===1?[]:s,super.setActions(l?[l]:[],[]),this._onDidChange.fire()};this._disposables.value.add(o.onDidChange(()=>r())),this._disposables.value.add(e.repository.provider.onDidChangeResources(()=>r())),this._disposables.value.add(this.storageService.onDidChangeValue(0,"scm.input.lastActionId",this._disposables.value)(()=>r())),this.actionRunner=this._disposables.value.add(new yut(e,this.storageService)),this._disposables.value.add(this.actionRunner.onWillRun(s=>{this.actionRunner.runningActions.size===0&&(super.setActions([this._cancelAction],[]),this._onDidChange.fire())})),this._disposables.value.add(this.actionRunner.onDidRun(s=>{this.actionRunner.runningActions.size===0&&r()})),r()}};wut=I([m(2,Yt),m(3,X),m(4,Xe),m(5,fe),m(6,Le),m(7,de),m(8,_e)],wut);var S1i=class{constructor(i,e){this.overflowWidgetsDomNode=i;this.configurationService=e;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this.defaultInputFontFamily=WF;this._disposables=new O;let t=U.filter(this.configurationService.onDidChangeConfiguration,o=>o.affectsConfiguration("editor.accessibilitySupport")||o.affectsConfiguration("editor.cursorBlinking")||o.affectsConfiguration("editor.cursorStyle")||o.affectsConfiguration("editor.cursorWidth")||o.affectsConfiguration("editor.emptySelectionClipboard")||o.affectsConfiguration("editor.fontFamily")||o.affectsConfiguration("editor.roundedSelection")||o.affectsConfiguration("editor.rulers")||o.affectsConfiguration("editor.wordWrap")||o.affectsConfiguration("editor.wordSegmenterLocales")||o.affectsConfiguration("scm.inputFontFamily")||o.affectsConfiguration("scm.inputFontSize"),this._disposables);this._disposables.add(t(()=>this._onDidChange.fire()))}getEditorConstructionOptions(){return{...ay(this.configurationService),...this.getEditorOptions(),dragAndDrop:!0,dropIntoEditor:{enabled:!0},formatOnType:!0,lineDecorationsWidth:6,overflowWidgetsDomNode:this.overflowWidgetsDomNode,padding:{top:2,bottom:2},quickSuggestions:!1,renderWhitespace:"none",scrollbar:{alwaysConsumeMouseWheel:!1,vertical:"hidden"},wrappingIndent:"none",wrappingStrategy:"advanced"}}getEditorOptions(){let i=this._getEditorFontFamily(),e=this._getEditorFontSize(),t=this._getEditorLineHeight(e),o=this.configurationService.getValue("editor.wordSegmenterLocales"),n=this.configurationService.getValue("editor.accessibilitySupport"),r=this.configurationService.getValue("editor.cursorBlinking"),s=this.configurationService.getValue("editor.cursorStyle"),l=this.configurationService.getValue("editor.cursorWidth")??1,c=this.configurationService.getValue("editor.emptySelectionClipboard")===!0,u=this.configurationService.getValue("editor.roundedSelection")===!0;return{...this._getEditorLanguageConfiguration(),accessibilitySupport:n,cursorBlinking:r,cursorStyle:s,cursorWidth:l,fontFamily:i,fontSize:e,lineHeight:t,emptySelectionClipboard:c,roundedSelection:u,wordSegmenterLocales:o}}_getEditorFontFamily(){let i=this.configurationService.getValue("scm.inputFontFamily").trim();return i.toLowerCase()==="editor"?this.configurationService.getValue("editor.fontFamily").trim():i.length!==0&&i.toLowerCase()!=="default"?i:this.defaultInputFontFamily}_getEditorFontSize(){return this.configurationService.getValue("scm.inputFontSize")}_getEditorLanguageConfiguration(){let i=this.configurationService.inspect("editor.rulers",{overrideIdentifier:"scminput"}),e=i.overrideIdentifiers?.includes("scminput")?PS.rulers.validate(i.value):[],t=this.configurationService.inspect("editor.wordWrap",{overrideIdentifier:"scminput"}),o=t.overrideIdentifiers?.includes("scminput")?PS.wordWrap.validate(t.value):"on";return{rulers:e,wordWrap:o}}_getEditorLineHeight(i){return Math.round(i*1.5)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}},hse=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.modelService=n;this.keybindingService=r;this.configurationService=s;this.scmViewService=l;this.contextViewService=c;this.openerService=u;this.accessibilityService=p;this.markdownRendererService=h;this.disposables=new O;this.repositoryDisposables=new O;this.validationHasFocus=!1;this.lastLayoutWasTrash=!1;this.shouldFocusAfterLayout=!1;this.element=D(i,_(".scm-editor")),this.editorContainer=D(this.element,_(".scm-editor-container")),this.toolbarContainer=D(this.element,_(".scm-editor-toolbar")),this.contextKeyService=this.disposables.add(t.createScoped(this.element)),this.repositoryIdContextKey=this.contextKeyService.createKey("scmRepository",void 0),this.validationMessageContextKey=D6t.SCMInputHasValidationMessage.bindTo(this.contextKeyService),this.inputEditorOptions=new S1i(e,this.configurationService),this.disposables.add(this.inputEditorOptions.onDidChange(this.onDidChangeEditorOptions,this)),this.disposables.add(this.inputEditorOptions);let g={contributions:ml.getSomeEditorContributions([Rm.ID,aC.ID,Vg.ID,Ju.ID,QEe.ID,Gh.ID,$x.ID,DJ.ID,ql.ID,jf.ID,cd.ID,nE.ID,dw.ID,Xu.ID,X4.ID,mw,ss.ID,Sc.ID]),isSimpleWidget:!0},f=new Po([X,this.contextKeyService]),v=o.createChild(f,this.disposables),b=this.inputEditorOptions.getEditorConstructionOptions();this.inputEditor=v.createInstance(us,this.editorContainer,b,g),this.disposables.add(this.inputEditor),this.disposables.add(this.inputEditor.onDidFocusEditorText(()=>{this.input?.repository&&this.scmViewService.focus(this.input.repository),this.element.classList.add("synthetic-focus"),this.renderValidation()})),this.disposables.add(this.inputEditor.onDidBlurEditorText(()=>{this.element.classList.remove("synthetic-focus"),setTimeout(()=>{(!this.validation||!this.validationHasFocus)&&this.clearValidation()},0)})),this.disposables.add(this.inputEditor.onDidBlurEditorWidget(()=>{Ju.get(this.inputEditor)?.clearWidgets(),Gh.get(this.inputEditor)?.clearWidgets()}));let S=this.contextKeyService.createKey("scmInputIsInFirstPosition",!1),y=this.contextKeyService.createKey("scmInputIsInLastPosition",!1);this.disposables.add(this.inputEditor.onDidChangeCursorPosition(({position:w})=>{let x=this.inputEditor._getViewModel(),E=x.getLineCount(),M=x.getLineLength(E)+1,N=x.coordinatesConverter.convertModelPositionToViewPosition(w);S.set(N.lineNumber===1&&N.column===1),y.set(N.lineNumber===E&&N.column===M)})),this.disposables.add(this.inputEditor.onDidScrollChange(w=>{this.toolbarContainer.classList.toggle("scroll-decoration",w.scrollTop>0)})),U.filter(this.configurationService.onDidChangeConfiguration,w=>w.affectsConfiguration("scm.showInputActionButton"))(()=>this.layout(),this,this.disposables),this.onDidChangeContentHeight=U.signal(U.filter(this.inputEditor.onDidContentSizeChange,w=>w.contentHeightChanged,this.disposables)),this.toolbar=v.createInstance(wut,this.toolbarContainer,{actionViewItemProvider:(w,x)=>w instanceof Do&&this.toolbar.dropdownActions.length>1?o.createInstance(BC,w,this.toolbar.dropdownAction,this.toolbar.dropdownActions,"",{actionRunner:this.toolbar.actionRunner,hoverDelegate:x.hoverDelegate}):ta(o,w,x),hiddenItemStrategy:-1,menuOptions:{shouldForwardArgs:!0}}),this.disposables.add(this.toolbar.onDidChange(()=>this.layout())),this.disposables.add(this.toolbar)}static{this.ValidationTimeouts={2:5e3,1:8e3,0:1e4}}get input(){return this.model?.input}set input(i){if(i===this.input)return;if(this.clearValidation(),this.element.classList.remove("synthetic-focus"),this.repositoryDisposables.clear(),this.repositoryIdContextKey.set(i?.repository.id),!i){this.inputEditor.setModel(void 0),this.model=void 0;return}let e=i.repository.provider.inputBoxTextModel;this.inputEditor.setModel(e),this.configurationService.getValue("editor.wordBasedSuggestions",{resource:e.uri})!=="off"&&this.configurationService.updateValue("editor.wordBasedSuggestions","off",{resource:e.uri},8);let t=new Aa(200),o=async()=>{let f=this.inputEditor.getSelection()?.getStartPosition(),v=f&&e.getOffsetAt(f),b=e.getValue();this.setValidation(await i.validateInput(b,v||0))},n=()=>t.trigger(o);this.repositoryDisposables.add(t),this.repositoryDisposables.add(this.inputEditor.onDidChangeCursorPosition(n));let r=this.modelService.getCreationOptions(e.getLanguageId(),e.uri,e.isForSimpleWidget),s=U.filter(this.inputEditor.onKeyDown,f=>f.keyCode===3,this.repositoryDisposables);this.repositoryDisposables.add(s(()=>e.detectIndentation(r.insertSpaces,r.tabSize))),e.setValue(i.value),this.repositoryDisposables.add(i.onDidChange(({value:f,reason:v})=>{let b=e.getValue();if(f===b)return;e.pushStackElement(),e.pushEditOperations(null,[Qn.replaceMove(e.getFullModelRange(),f)],()=>[]);let S=v===0?e.getFullModelRange().getStartPosition():e.getFullModelRange().getEndPosition();this.inputEditor.setPosition(S),this.inputEditor.revealPositionInCenterIfOutsideViewport(S)})),this.repositoryDisposables.add(i.onDidChangeFocus(()=>this.focus())),this.repositoryDisposables.add(i.onDidChangeValidationMessage(f=>this.setValidation(f,{focus:!0,timeout:!0}))),this.repositoryDisposables.add(i.onDidChangeValidateInput(f=>n())),this.repositoryDisposables.add(i.onDidClearValidation(()=>this.clearValidation())),this.repositoryDisposables.add(e.onDidChangeContent(()=>{i.setValue(e.getValue(),!0),n()}));let l=hr("accessibility.verbosity.sourceControl",!0,this.configurationService),c=(f,v)=>{if(v=v??l.get(),!v||!this.accessibilityService.isScreenReaderOptimized())return f;let b=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return b?d(14960,null,f,b):d(14961,null,f)},u=()=>{let f=this.keybindingService.lookupKeybinding("scm.acceptInput"),v=f?f.getLabel():et?"Cmd+Enter":"Ctrl+Enter";return Wd(i.placeholder,v)},p=()=>{let f=u(),v=c(f);this.inputEditor.updateOptions({ariaLabel:v,placeholder:f})};this.repositoryDisposables.add(i.onDidChangePlaceholder(p)),this.repositoryDisposables.add(this.keybindingService.onDidUpdateKeybindings(p)),this.repositoryDisposables.add(Zs(l,f=>{let v=u(),b=c(v,f);this.inputEditor.updateOptions({ariaLabel:b})})),p();let h="";this.repositoryDisposables.add(ve(f=>{if(!i.visible)return;let v=h;h=i.repository.provider.commitTemplate.read(f);let b=e.getValue();b&&b!==v||e.setValue(h)}));let g=f=>{this.inputEditor.updateOptions({readOnly:!f})};this.repositoryDisposables.add(i.onDidChangeEnablement(f=>g(f))),g(i.enabled),this.toolbar.setInput(i),this.model={input:i,textModel:e}}get selections(){return this.inputEditor.getSelections()}set selections(i){i&&this.inputEditor.setSelections(i)}setValidation(i,e){this._validationTimer&&(clearTimeout(this._validationTimer),this._validationTimer=void 0),this.validation=i,this.renderValidation(),e?.focus&&!this.hasFocus()&&this.focus(),i&&e?.timeout&&(this._validationTimer=setTimeout(()=>this.setValidation(void 0),hse.ValidationTimeouts[i.type]))}getContentHeight(){let i=this.inputEditor.getOption(75),{top:e,bottom:t}=this.inputEditor.getOption(96),o=this.configurationService.getValue("scm.inputMinLineCount"),r=(typeof o=="number"?jn(o,1,50):1)*i+e+t,s=this.configurationService.getValue("scm.inputMaxLineCount"),c=(typeof s=="number"?jn(s,1,50):10)*i+e+t;return jn(this.inputEditor.getContentHeight(),r,c)}layout(){let i=this.getContentHeight(),e=this.getToolbarWidth(),t=new di(this.element.clientWidth-e,i);if(t.width<0){this.lastLayoutWasTrash=!0;return}this.lastLayoutWasTrash=!1,this.inputEditor.layout(t),this.renderValidation();let o=this.configurationService.getValue("scm.showInputActionButton")===!0;this.toolbarContainer.classList.toggle("hidden",!o||this.toolbar?.isEmpty()===!0),this.shouldFocusAfterLayout&&(this.shouldFocusAfterLayout=!1,this.focus())}focus(){if(this.lastLayoutWasTrash){this.lastLayoutWasTrash=!1,this.shouldFocusAfterLayout=!0;return}this.inputEditor.focus(),this.element.classList.add("synthetic-focus")}hasFocus(){return this.inputEditor.hasTextFocus()}onDidChangeEditorOptions(){this.inputEditor.updateOptions(this.inputEditorOptions.getEditorOptions())}renderValidation(){if(this.clearValidation(),this.element.classList.toggle("validation-info",this.validation?.type===2),this.element.classList.toggle("validation-warning",this.validation?.type===1),this.element.classList.toggle("validation-error",this.validation?.type===0),!this.validation||!this.inputEditor.hasTextFocus())return;this.validationMessageContextKey.set(!0);let i=new O;this.validationContextView=this.contextViewService.showContextView({getAnchor:()=>this.element,render:e=>{this.element.style.borderBottomLeftRadius="0",this.element.style.borderBottomRightRadius="0";let t=D(e,_(".scm-editor-validation-container"));t.classList.toggle("validation-info",this.validation.type===2),t.classList.toggle("validation-warning",this.validation.type===1),t.classList.toggle("validation-error",this.validation.type===0),t.style.width=`${this.element.clientWidth+2}px`;let o=D(t,_(".scm-editor-validation")),n=this.validation.message;if(typeof n=="string")o.textContent=n;else{let c=nr(o);i.add(c),i.add(c.onDidFocus(()=>this.validationHasFocus=!0)),i.add(c.onDidBlur(()=>{this.validationHasFocus=!1,this.element.style.borderBottomLeftRadius="2px",this.element.style.borderBottomRightRadius="2px",this.contextViewService.hideContextView()}));let u=this.markdownRendererService.render(n,{actionHandler:(p,h)=>{WT(this.openerService,p,h.isTrusted),this.element.style.borderBottomLeftRadius="2px",this.element.style.borderBottomRightRadius="2px",this.contextViewService.hideContextView()}});i.add(u),o.appendChild(u.element)}let r=D(t,_(".scm-editor-validation-actions")),s=new oo(r),l=new it("scmInputWidget.validationMessage.close",d(14959,null),q.asClassName(L.close),!0,()=>{this.contextViewService.hideContextView(),this.element.style.borderBottomLeftRadius="2px",this.element.style.borderBottomRightRadius="2px"});return i.add(s),s.push(l,{icon:!0,label:!1}),k.None},onHide:()=>{this.validationHasFocus=!1,this.element.style.borderBottomLeftRadius="2px",this.element.style.borderBottomRightRadius="2px",i.dispose()},anchorAlignment:0})}getToolbarWidth(){let i=this.configurationService.getValue("scm.showInputActionButton");return!this.toolbar||!i||this.toolbar?.isEmpty()===!0?0:this.toolbar.dropdownActions.length===0?26:39}clearValidation(){this.validationContextView?.close(),this.validationContextView=void 0,this.validationHasFocus=!1,this.validationMessageContextKey.set(!1)}dispose(){this.input=void 0,this.repositoryDisposables.dispose(),this.clearValidation(),this.disposables.dispose()}};hse=I([m(2,X),m(3,F),m(4,_t),m(5,Le),m(6,B),m(7,Au),m(8,qn),m(9,Je),m(10,Ai),m(11,_n)],hse);W(class extends z{constructor(){super({id:"scm.input.triggerSetup",title:d(14963,null),icon:L.sparkle,f1:!1,menu:{id:R.SCMInputBox,when:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),Z.Setup.completed.negate(),C.equals("scmProvider","git"))}})}async run(a,...i){let e=a.get(fe);if(!await e.executeCommand(che))return;let o=$i.defaultChatAgent?.generateCommitMessageCommand;o&&await e.executeCommand(o,...i)}});rNe(".scm-view .scm-editor-container");function tkn(a,i){if(!i)return[void 0,void 0];if(!i.label)return[Wa(i),void 0];let e=Be(a),t=i.label,o=t.length-e.length,n=Wa(i.score);if(t===e)return[n,void 0];let r=[],s=[];for(let l of n)l.start>o?r.push({start:l.start-o,end:l.end-o}):l.end<o?s.push(l):(r.push({start:0,end:l.end-o}),s.push({start:l.start,end:o}));return[r,s]}var n7=class{constructor(i,e,t){this.commandService=i;this.contextMenuService=e;this.notificationService=t;this.actionButtons=new Map}static{this.DEFAULT_HEIGHT=28}static{this.TEMPLATE_ID="actionButton"}get templateId(){return n7.TEMPLATE_ID}renderTemplate(i){i.parentElement.parentElement.classList.add("cursor-default","force-no-hover");let e=D(i,_(".button-container")),t=new B1i(e,this.contextMenuService,this.commandService,this.notificationService);return{actionButton:t,disposable:k.None,templateDisposable:t}}renderElement(i,e,t){t.disposable.dispose();let o=new O,n=i.element;t.actionButton.setButton(i.element.button),this.actionButtons.set(n,t.actionButton),o.add({dispose:()=>this.actionButtons.delete(n)}),t.disposable=o}renderCompressedElements(){throw new Error("Should never happen since node is incompressible")}focusActionButton(i){this.actionButtons.get(i)?.focus()}disposeElement(i,e,t){t.disposable.dispose()}disposeTemplate(i){i.disposable.dispose(),i.templateDisposable.dispose()}};n7=I([m(0,fe),m(1,Xe),m(2,Ne)],n7);var I1i=class a{constructor(i){this.instantiationService=i}getDragURI(i){return pO(i)?i.sourceUri.toString():null}onDragStart(i,e){let t=a.getResourcesFromDragAndDropData(i);if(e.dataTransfer&&t?.length){this.instantiationService.invokeFunction(n=>kv(n,t,e));let o=t.filter(n=>n.scheme===Q.file).map(n=>n.fsPath);o.length&&e.dataTransfer.setData(Mc.FILES,JSON.stringify(o))}}getDragLabel(i,e){if(i.length===1){let t=i[0];if(pO(t))return Be(t.sourceUri)}return String(i.length)}onDragOver(i,e,t,o,n){return!0}drop(i,e,t,o,n){}static getResourcesFromDragAndDropData(i){let e=[];for(let t of[...i.context??[],...i.elements])pO(t)&&e.push(t.sourceUri);return e}dispose(){}},U1=class{constructor(i,e,t,o){this.outerLayout=i;this.overflowWidgetsDomNode=e;this.updateHeight=t;this.instantiationService=o;this.inputWidgets=new Map;this.contentHeights=new WeakMap;this.editorSelections=new WeakMap}static{this.DEFAULT_HEIGHT=26}static{this.TEMPLATE_ID="input"}get templateId(){return U1.TEMPLATE_ID}renderTemplate(i){i.parentElement.parentElement.classList.add("force-no-hover");let e=new O,t=D(i,_(".scm-input")),o=this.instantiationService.createInstance(hse,t,this.overflowWidgetsDomNode);return e.add(o),{inputWidget:o,inputWidgetHeight:U1.DEFAULT_HEIGHT,elementDisposables:new O,templateDisposable:e}}renderElement(i,e,t){let o=i.element;t.inputWidget.input=o,this.inputWidgets.set(o,t.inputWidget),t.elementDisposables.add({dispose:()=>this.inputWidgets.delete(o)});let n=this.editorSelections.get(o);n&&(t.inputWidget.selections=n),t.elementDisposables.add(ee(()=>{let c=t.inputWidget.selections;c&&this.editorSelections.set(o,c)})),t.inputWidgetHeight=U1.DEFAULT_HEIGHT;let r=()=>{let c=t.inputWidget.getContentHeight();this.contentHeights.set(o,c),t.inputWidgetHeight!==c&&(this.updateHeight(o,c+10),t.inputWidgetHeight=c,t.inputWidget.layout())};Zo(()=>{t.elementDisposables.add(t.inputWidget.onDidChangeContentHeight(r)),r()},0,t.elementDisposables);let l=()=>t.inputWidget.layout();t.elementDisposables.add(this.outerLayout.onDidChange(l)),l()}renderCompressedElements(){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposable.dispose()}getHeight(i){return(this.contentHeights.get(i)??U1.DEFAULT_HEIGHT)+10}getRenderedInputWidget(i){return this.inputWidgets.get(i)}getFocusedInput(){for(let[i,e]of this.inputWidgets)if(e.hasFocus())return i}clearValidation(){for(let[,i]of this.inputWidgets)i.clearValidation()}};U1=I([m(3,F)],U1);var gse=class{constructor(i,e,t,o,n,r,s,l,c){this.actionViewItemProvider=i;this.actionRunner=e;this.commandService=t;this.contextKeyService=o;this.contextMenuService=n;this.keybindingService=r;this.menuService=s;this.scmViewService=l;this.telemetryService=c}static{this.TEMPLATE_ID="resource group"}get templateId(){return gse.TEMPLATE_ID}renderTemplate(i){let e=D(i,_(".resource-group")),t=D(e,_(".name")),o=D(e,_(".actions")),n=new dl(o,{actionViewItemProvider:this.actionViewItemProvider,actionRunner:this.actionRunner},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService),r=D(e,_(".count")),s=new eb(r,{},VI),l=Fn(n,s);return{name:t,count:s,actionBar:n,elementDisposables:new O,disposables:l}}renderElement(i,e,t){let o=i.element;t.name.textContent=o.label,t.count.setCount(o.resources.length);let n=this.scmViewService.menus.getRepositoryMenus(o.provider);t.elementDisposables.add(xoe(n.getResourceGroupMenu(o),r=>{t.actionBar.setActions(r)},"inline")),t.actionBar.context=o}renderCompressedElements(i){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};gse=I([m(2,fe),m(3,X),m(4,Xe),m(5,Le),m(6,Yt),m(7,Au),m(8,_e)],gse);var R6t=class extends cs{constructor(e){super();this.getSelectedResources=e}async runAction(e,t){if(!(e instanceof Do))return super.runAction(e,t);let o=ww(t),n=this.getSelectedResources().filter(c=>ww(c)===o),l=(n.some(c=>c===t)?n:[t]).map(c=>Fm.isResourceNode(c)?Fm.collect(c):[c]).flat();await e.run(...l)}},fse=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this.viewMode=i;this.labels=e;this.actionViewItemProvider=t;this.actionRunner=o;this.commandService=n;this.contextKeyService=r;this.contextMenuService=s;this.keybindingService=l;this.labelService=c;this.menuService=u;this.scmViewService=p;this.telemetryService=h;this.themeService=g;this.disposables=new O;this.renderedResources=new Map;g.onDidColorThemeChange(this.onDidColorThemeChange,this,this.disposables)}static{this.TEMPLATE_ID="resource"}get templateId(){return fse.TEMPLATE_ID}renderTemplate(i){let e=D(i,_(".resource")),t=D(e,_(".name")),o=this.labels.create(t,{supportDescriptionHighlights:!0,supportHighlights:!0}),n=D(o.element,_(".actions")),r=new dl(n,{actionViewItemProvider:this.actionViewItemProvider,actionRunner:this.actionRunner},this.menuService,this.contextKeyService,this.contextMenuService,this.keybindingService,this.commandService,this.telemetryService),s=D(e,_(".decoration-icon")),l=new ue,c=Fn(r,o,l);return{element:e,name:t,fileLabel:o,decorationIcon:s,actionBar:r,actionBarMenu:void 0,actionBarMenuListener:l,elementDisposables:new O,disposables:c}}renderElement(i,e,t){let o=i.element,n=Fm.isResourceNode(o)?o.element:o,r=Fm.isResourceNode(o)?o.uri:o.sourceUri,s=Fm.isResourceNode(o)?1:0,l=!Fm.isResourceNode(o)&&o.decorations.tooltip||"",c=this.viewMode()==="tree",u,p,h;if(Fm.isResourceNode(o))if(o.element){let f=this.scmViewService.menus.getRepositoryMenus(o.element.resourceGroup.provider);this._renderActionBar(t,o,f.getResourceMenu(o.element)),t.element.classList.toggle("faded",o.element.decorations.faded),h=o.element.decorations.strikeThrough}else{let f=this.scmViewService.menus.getRepositoryMenus(o.context.provider);this._renderActionBar(t,o,f.getResourceFolderMenu(o.context)),u=Wa(i.filterData),t.element.classList.remove("faded")}else{let f=this.scmViewService.menus.getRepositoryMenus(o.resourceGroup.provider);this._renderActionBar(t,o,f.getResourceMenu(o)),[u,p]=tkn(r,i.filterData),t.element.classList.toggle("faded",o.decorations.faded),h=o.decorations.strikeThrough}let g={tooltip:l,uri:r,fileLabelOptions:{hidePath:c,fileKind:s,matches:u,descriptionMatches:p,strikethrough:h},iconResource:n};this.renderIcon(t,g),this.renderedResources.set(t,g),t.elementDisposables.add(ee(()=>this.renderedResources.delete(t))),t.element.setAttribute("data-tooltip",l)}disposeElement(i,e,t){t.elementDisposables.clear()}renderCompressedElements(i,e,t){let o=i.element,n=o.elements[o.elements.length-1],r=o.elements.map(u=>u.name),s=1,l=Wa(i.filterData);t.fileLabel.setResource({resource:n.uri,name:r},{fileDecorations:{colors:!1,badges:!0},fileKind:s,matches:l,separator:this.labelService.getSeparator(n.uri.scheme)});let c=this.scmViewService.menus.getRepositoryMenus(n.context.provider);this._renderActionBar(t,n,c.getResourceFolderMenu(n.context)),t.name.classList.remove("strike-through"),t.element.classList.remove("faded"),t.decorationIcon.style.display="none",t.decorationIcon.style.backgroundImage="",t.element.setAttribute("data-tooltip","")}disposeCompressedElements(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}_renderActionBar(i,e,t){(!i.actionBarMenu||i.actionBarMenu!==t)&&(i.actionBarMenu=t,i.actionBarMenuListener.value=xoe(t,o=>{i.actionBar.setActions(o)},"inline")),i.actionBar.context=e}onDidColorThemeChange(){for(let[i,e]of this.renderedResources)this.renderIcon(i,e)}renderIcon(i,e){let t=this.themeService.getColorTheme(),o=cm(t.type)?e.iconResource?.decorations.iconDark:e.iconResource?.decorations.icon;i.fileLabel.setFile(e.uri,{...e.fileLabelOptions,fileDecorations:{colors:!1,badges:!o}}),o?(q.isThemeIcon(o)?(i.decorationIcon.className=`decoration-icon ${q.asClassName(o)}`,o.color&&(i.decorationIcon.style.color=t.getColor(o.color.id)?.toString()??""),i.decorationIcon.style.display="",i.decorationIcon.style.backgroundImage=""):(i.decorationIcon.className="decoration-icon",i.decorationIcon.style.color="",i.decorationIcon.style.display="",i.decorationIcon.style.backgroundImage=cl(o)),i.decorationIcon.title=e.tooltip):(i.decorationIcon.className="decoration-icon",i.decorationIcon.style.color="",i.decorationIcon.style.display="none",i.decorationIcon.style.backgroundImage="",i.decorationIcon.title="")}dispose(){this.disposables.dispose()}};fse=I([m(4,fe),m(5,X),m(6,Xe),m(7,Le),m(8,nt),m(9,Yt),m(10,Au),m(11,_e),m(12,Pe)],fse);var y1i=class{constructor(i){this.inputRenderer=i}getHeight(i){return dO(i)?this.inputRenderer.getHeight(i):uO(i)?n7.DEFAULT_HEIGHT+8:22}getTemplateId(i){if(ou(i))return GV.TEMPLATE_ID;if(dO(i))return U1.TEMPLATE_ID;if(uO(i))return n7.TEMPLATE_ID;if(ww(i))return gse.TEMPLATE_ID;if(pO(i)||n6(i))return fse.TEMPLATE_ID;throw new Error("Unknown element")}},w1i=class{isIncompressible(i){return Fm.isResourceNode(i)?i.childrenCount===0||!i.parent||!i.parent.parent:!0}},C1i=class{filter(i){return ww(i)?i.resources.length>0||!i.hideWhenEmpty:!0}},x1i=class{constructor(i,e){this.viewMode=i;this.viewSortKey=e}compare(i,e){if(ou(i)){if(!ou(e))throw new Error("Invalid comparison");return 0}if(dO(i))return-1;if(dO(e))return 1;if(uO(i))return-1;if(uO(e))return 1;if(ww(i))return ww(e)?0:-1;if(this.viewMode()==="list"){if(this.viewSortKey()==="name"){let c=Be(i.sourceUri),u=Be(e.sourceUri);return C_(c,u)}if(this.viewSortKey()==="status"){let c=i.decorations.tooltip??"",u=e.decorations.tooltip??"";if(c!==u)return oc(c,u)}let s=i.sourceUri.fsPath,l=e.sourceUri.fsPath;return Cte(s,l)}let t=Fm.isResourceNode(i),o=Fm.isResourceNode(e);if(t!==o)return t?-1:1;let n=Fm.isResourceNode(i)?i.name:Be(i.sourceUri),r=Fm.isResourceNode(e)?e.name:Be(e.sourceUri);return C_(n,r)}},Cut=class{constructor(i,e){this.viewMode=i;this.labelService=e}getKeyboardNavigationLabel(i){if(Fm.isResourceNode(i))return i.name;if(ou(i)||dO(i)||uO(i))return;if(ww(i))return i.label;if(this.viewMode()==="list"){let e=Be(i.sourceUri),t=this.labelService.getUriLabel(i.sourceUri,{relative:!0});return[e,t]}else return Be(i.sourceUri)}getCompressedNodeKeyboardNavigationLabel(i){return i.map(t=>t.name).join("/")}};Cut=I([m(1,nt)],Cut);function ikn(a){if(ou(a))return`repo:${a.provider.id}`;if(dO(a))return`input:${a.repository.provider.id}`;if(uO(a))return`actionButton:${a.repository.provider.id}`;if(ww(a))return`resourceGroup:${a.provider.id}/${a.id}`;if(pO(a)){let i=a.resourceGroup;return`resource:${i.provider.id}/${i.id}/${a.sourceUri.toString()}`}else if(n6(a)){let i=a.context;return`folder:${i.provider.id}/${i.id}/$FOLDER/${a.uri.toString()}`}else throw new Error("Invalid tree element")}var k1i=class{getId(i){return ikn(i)}},xut=class{constructor(i,e,t,o){this.accessibilityService=i;this.configurationService=e;this.keybindingService=t;this.labelService=o}getWidgetAriaLabel(){return d(14974,null)}getAriaLabel(i){if(Fm.isResourceNode(i))return this.labelService.getUriLabel(i.uri,{relative:!0,noPrefix:!0})||i.name;if(ou(i))return`${i.provider.name} ${i.provider.label}`;if(dO(i)){if(!(this.configurationService.getValue("accessibility.verbosity.sourceControl")===!0)||!this.accessibilityService.isScreenReaderOptimized())return d(14976,null);let t=this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();return t?d(14977,null,t):d(14978,null)}else{if(uO(i))return i.button?.command.title??"";if(ww(i))return i.label;{let e=[];e.push(Be(i.sourceUri)),i.decorations.tooltip&&e.push(i.decorations.tooltip);let t=this.labelService.getUriLabel(ai(i.sourceUri),{relative:!0,noPrefix:!0});return t&&e.push(t),e.join(", ")}}}};xut=I([m(0,Ai),m(1,B),m(2,Le),m(3,nt)],xut);var J$={ViewSort:new R("SCMViewSort"),Repositories:new R("SCMRepositories"),ChangesSettings:new R("SCMChangesSettings")},Jc={SCMViewMode:new Y("scmViewMode","list"),SCMViewSortKey:new Y("scmViewSortKey","path"),SCMViewAreAllRepositoriesCollapsed:new Y("scmViewAreAllRepositoriesCollapsed",!1),SCMViewIsAnyRepositoryCollapsible:new Y("scmViewIsAnyRepositoryCollapsible",!1),SCMProvider:new Y("scmProvider",void 0),SCMProviderRootUri:new Y("scmProviderRootUri",void 0),SCMProviderHasRootUri:new Y("scmProviderHasRootUri",void 0),SCMHistoryItemCount:new Y("scmHistoryItemCount",0),SCMHistoryViewMode:new Y("scmHistoryViewMode","list"),SCMCurrentHistoryItemRefHasRemote:new Y("scmCurrentHistoryItemRefHasRemote",!1),SCMCurrentHistoryItemRefHasBase:new Y("scmCurrentHistoryItemRefHasBase",!1),SCMCurrentHistoryItemRefInFilter:new Y("scmCurrentHistoryItemRefInFilter",!1),RepositoryCount:new Y("scmRepositoryCount",0),RepositoryVisibilityCount:new Y("scmRepositoryVisibleCount",0),RepositoryVisibility(a){return new Y(`scmRepositoryVisible:${a.provider.id}`,!1)}};be.appendMenuItem(R.SCMTitle,{title:d(14981,null),submenu:J$.ViewSort,when:C.and(C.equals("view",wv),Jc.RepositoryCount.notEqualsTo(0)),group:"0_view&sort",order:1});be.appendMenuItem(J$.ViewSort,{title:d(14968,null),submenu:J$.Repositories,when:C.greater(Jc.RepositoryCount.key,1),group:"0_repositories"});var E1i=class extends z{constructor(i){super({id:`workbench.scm.action.toggleRepositoryVisibility.${i.provider.id}`,title:i.provider.name,f1:!1,precondition:C.or(Jc.RepositoryVisibilityCount.notEqualsTo(1),Jc.RepositoryVisibility(i).isEqualTo(!1)),toggled:Jc.RepositoryVisibility(i).isEqualTo(!0),menu:{id:J$.Repositories,group:"0_repositories"}}),this.repository=i}run(i){i.get(Au).toggleVisibility(this.repository)}},kut=class{constructor(i,e,t){this.contextKeyService=i;this.scmViewService=e;this.items=new Map;this.disposables=new O;this.repositoryCountContextKey=Jc.RepositoryCount.bindTo(i),this.repositoryVisibilityCountContextKey=Jc.RepositoryVisibilityCount.bindTo(i),e.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories,this,this.disposables),t.onDidAddRepository(this.onDidAddRepository,this,this.disposables),t.onDidRemoveRepository(this.onDidRemoveRepository,this,this.disposables);for(let o of t.repositories)this.onDidAddRepository(o)}onDidAddRepository(i){if(i.provider.isHidden)return;let e=W(class extends E1i{constructor(){super(i)}}),t=Jc.RepositoryVisibility(i).bindTo(this.contextKeyService);t.set(this.scmViewService.isVisible(i)),this.items.set(i,{contextKey:t,dispose(){t.reset(),e.dispose()}}),this.updateRepositoryContextKeys()}onDidRemoveRepository(i){this.items.get(i)?.dispose(),this.items.delete(i),this.updateRepositoryContextKeys()}onDidChangeVisibleRepositories(){let i=0;for(let[e,t]of this.items){let o=this.scmViewService.isVisible(e);t.contextKey.set(o),o&&i++}this.repositoryCountContextKey.set(this.items.size),this.repositoryVisibilityCountContextKey.set(i)}updateRepositoryContextKeys(){this.repositoryCountContextKey.set(this.items.size),this.repositoryVisibilityCountContextKey.set(yt.reduce(this.items.keys(),(i,e)=>i+(this.scmViewService.isVisible(e)?1:0),0))}dispose(){this.disposables.dispose(),je(this.items.values()),this.items.clear()}};kut=I([m(0,X),m(1,Au),m(2,lc)],kut);var L6t=class extends rr{constructor(i="workbench.scm.action.setListViewMode",e={}){super({id:i,title:d(14979,null),viewId:wv,f1:!1,icon:L.listTree,toggled:Jc.SCMViewMode.isEqualTo("list"),menu:{id:J$.ViewSort,group:"1_viewmode",...e}})}async runInView(i,e){e.viewMode="list"}},T1i=class extends L6t{constructor(){super("workbench.scm.action.setListViewModeNavigation",{id:R.SCMTitle,when:C.and(C.equals("view",wv),Jc.RepositoryCount.notEqualsTo(0),Jc.SCMViewMode.isEqualTo("tree")),group:"navigation",isHiddenByDefault:!0,order:-1e3})}},M6t=class extends rr{constructor(i="workbench.scm.action.setTreeViewMode",e={}){super({id:i,title:d(14980,null),viewId:wv,f1:!1,icon:L.listFlat,toggled:Jc.SCMViewMode.isEqualTo("tree"),menu:{id:J$.ViewSort,group:"1_viewmode",...e}})}async runInView(i,e){e.viewMode="tree"}},_1i=class extends M6t{constructor(){super("workbench.scm.action.setTreeViewModeNavigation",{id:R.SCMTitle,when:C.and(C.equals("view",wv),Jc.RepositoryCount.notEqualsTo(0),Jc.SCMViewMode.isEqualTo("list")),group:"navigation",isHiddenByDefault:!0,order:-1e3})}};W(L6t);W(M6t);W(T1i);W(_1i);var Tut=class extends z{constructor(e,t){super({id:`workbench.scm.action.repositories.setSortKey.${e}`,title:t,f1:!1,toggled:Iut.RepositorySortKey.isEqualTo(e),menu:[{id:J$.Repositories,group:"1_sort"},{id:R.SCMSourceControlTitle,group:"1_sort"}]});this.sortKey=e}run(e){e.get(Au).toggleSortKey(this.sortKey)}},D1i=class extends Tut{constructor(){super("discoveryTime",d(14971,null))}},R1i=class extends Tut{constructor(){super("name",d(14972,null))}},L1i=class extends Tut{constructor(){super("path",d(14973,null))}};W(D1i);W(R1i);W(L1i);var P6t=class extends z{constructor(e,t,o){super({id:`workbench.scm.action.repositories.setSelectionMode.${e}`,title:t,f1:!1,toggled:Iut.RepositorySelectionMode.isEqualTo(e),menu:[{id:J$.Repositories,when:C.and(C.has("scm.providerCount"),C.greater("scm.providerCount",1)),group:"2_selectionMode",order:o},{id:R.SCMSourceControlTitle,when:C.and(C.has("scm.providerCount"),C.greater("scm.providerCount",1)),group:"2_selectionMode",order:o}]});this.selectionMode=e}run(e){e.get(Au).toggleSelectionMode(this.selectionMode)}},M1i=class extends P6t{constructor(){super("single",d(14970,null),1)}},P1i=class extends P6t{constructor(){super("multiple",d(14969,null),2)}};W(M1i);W(P1i);var _ut=class extends rr{constructor(e,t){super({id:`workbench.scm.action.setSortKey.${e}`,title:t,viewId:wv,f1:!1,toggled:Jc.SCMViewSortKey.isEqualTo(e),precondition:Jc.SCMViewMode.isEqualTo("list"),menu:{id:J$.ViewSort,group:"2_sort"}});this.sortKey=e}async runInView(e,t){t.viewSortKey=this.sortKey}},A1i=class extends _ut{constructor(){super("name",d(14982,null))}},N1i=class extends _ut{constructor(){super("path",d(14983,null))}},O1i=class extends _ut{constructor(){super("status",d(14984,null))}};W(A1i);W(N1i);W(O1i);var F1i=class extends rr{constructor(){super({id:"workbench.scm.action.collapseAllRepositories",title:d(14966,null),viewId:wv,f1:!1,icon:L.collapseAll,menu:{id:R.SCMTitle,group:"navigation",when:C.and(C.equals("view",wv),Jc.SCMViewIsAnyRepositoryCollapsible.isEqualTo(!0),Jc.SCMViewAreAllRepositoriesCollapsed.isEqualTo(!1))}})}async runInView(i,e){e.collapseAllRepositories()}},W1i=class extends rr{constructor(){super({id:"workbench.scm.action.expandAllRepositories",title:d(14967,null),viewId:wv,f1:!1,icon:L.expandAll,menu:{id:R.SCMTitle,group:"navigation",when:C.and(C.equals("view",wv),Jc.SCMViewIsAnyRepositoryCollapsible.isEqualTo(!0),Jc.SCMViewAreAllRepositoriesCollapsed.isEqualTo(!0))}})}async runInView(i,e){e.expandAllRepositories()}};W(F1i);W(W1i);var V1i=class extends rr{constructor(){super({id:"workbench.scm.action.collapseAll",title:d(14975,null),viewId:wv,f1:!1,icon:L.collapseAll,menu:{id:R.SCMResourceGroupContext,group:"9_collapse",when:Jc.SCMViewMode.isEqualTo("tree")}})}async runInView(i,e,t){t&&e.collapseAllResources(t)}};W(V1i);var Qze=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super({...e,titleMenuId:R.SCMTitle},u,h,v,b,f,g,S,p,y);this.commandService=t;this.editorService=o;this.menuService=n;this.scmService=r;this.scmViewService=s;this.storageService=l;this.uriIdentityService=c;this._onDidChangeViewMode=this._register(new T);this.onDidChangeViewMode=this._onDidChangeViewMode.event;this._onDidChangeViewSortKey=this._register(new T);this.onDidChangeViewSortKey=this._onDidChangeViewSortKey.event;this.items=new Ot;this.visibilityDisposables=new O;this.treeOperationSequencer=new Tm;this.revealResourceThrottler=new am;this.updateChildrenThrottler=new am;this.disposables=new O;this._viewMode=this.getViewMode(),this._viewSortKey=this.getViewSortKey(),this.viewModeContextKey=Jc.SCMViewMode.bindTo(b),this.viewModeContextKey.set(this._viewMode),this.viewSortKeyContextKey=Jc.SCMViewSortKey.bindTo(b),this.viewSortKeyContextKey.set(this.viewSortKey),this.areAllRepositoriesCollapsedContextKey=Jc.SCMViewAreAllRepositoriesCollapsed.bindTo(b),this.isAnyRepositoryCollapsibleContextKey=Jc.SCMViewIsAnyRepositoryCollapsible.bindTo(b),this.scmProviderContextKey=Jc.SCMProvider.bindTo(b),this.scmProviderRootUriContextKey=Jc.SCMProviderRootUri.bindTo(b),this.scmProviderHasRootUriContextKey=Jc.SCMProviderHasRootUri.bindTo(b),this._onDidLayout=this._register(new T),this.layoutCache={height:void 0,width:void 0,onDidChange:this._onDidLayout.event},this.storageService.onDidChangeValue(1,void 0,this.disposables)(w=>{switch(w.key){case"scm.viewMode":this.viewMode=this.getViewMode();break;case"scm.viewSortKey":this.viewSortKey=this.getViewSortKey();break}},this,this.disposables),this.storageService.onWillSaveState(w=>{this.viewMode=this.getViewMode(),this.viewSortKey=this.getViewSortKey(),this.storeTreeViewState()},this,this.disposables),U.any(this.scmService.onDidAddRepository,this.scmService.onDidRemoveRepository)(()=>this._onDidChangeViewWelcomeState.fire(),this,this.disposables),this.disposables.add(this.revealResourceThrottler),this.disposables.add(this.updateChildrenThrottler)}get viewMode(){return this._viewMode}set viewMode(e){this._viewMode!==e&&(this._viewMode=e,this.viewSortKey=this.getViewSortKey(),this.updateChildren(),this.onDidActiveEditorChange(),this._onDidChangeViewMode.fire(e),this.viewModeContextKey.set(e),this.updateIndentStyles(this.themeService.getFileIconTheme()),this.storageService.store("scm.viewMode",e,1,0))}get viewSortKey(){return this._viewSortKey}set viewSortKey(e){this._viewSortKey!==e&&(this._viewSortKey=e,this.updateChildren(),this.viewSortKeyContextKey.set(e),this._onDidChangeViewSortKey.fire(e),this._viewMode==="list"&&this.storageService.store("scm.viewSortKey",e,1,0))}layoutBody(e=this.layoutCache.height,t=this.layoutCache.width){e!==void 0&&(t!==void 0&&super.layoutBody(e,t),this.layoutCache.height=e,this.layoutCache.width=t,this._onDidLayout.fire(),this.treeContainer.style.height=`${e}px`,this.tree.layout(e,t))}renderBody(e){super.renderBody(e),this.treeContainer=D(e,_(".scm-view.show-file-icons")),this.treeContainer.classList.add("file-icon-themable-tree"),this.treeContainer.classList.add("show-file-icons");let t=()=>this.treeContainer.classList.toggle("show-actions",this.configurationService.getValue("scm.alwaysShowActions"));U.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration("scm.alwaysShowActions"),this.disposables)(t,this,this.disposables),t();let o=()=>{let r=this.configurationService.getValue("scm.providerCountBadge");this.treeContainer.classList.toggle("hide-provider-counts",r==="hidden"),this.treeContainer.classList.toggle("auto-provider-counts",r==="auto")};U.filter(this.configurationService.onDidChangeConfiguration,r=>r.affectsConfiguration("scm.providerCountBadge"),this.disposables)(o,this,this.disposables),o();let n=this.loadTreeViewState();this.createTree(this.treeContainer,n),this.onDidChangeBodyVisibility(async r=>{r?this.treeOperationSequencer.queue(async()=>{await this.tree.setInput(this.scmViewService,n),U.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("scm.alwaysShowRepositories"),this.visibilityDisposables)(()=>{this.updateActions(),this.updateChildren()},this,this.visibilityDisposables),U.filter(this.configurationService.onDidChangeConfiguration,s=>s.affectsConfiguration("scm.inputMinLineCount")||s.affectsConfiguration("scm.inputMaxLineCount")||s.affectsConfiguration("scm.showActionButton"),this.visibilityDisposables)(()=>this.updateChildren(),this,this.visibilityDisposables),this.editorService.onDidActiveEditorChange(this.onDidActiveEditorChange,this,this.visibilityDisposables),this.scmViewService.onDidChangeVisibleRepositories(this.onDidChangeVisibleRepositories,this,this.visibilityDisposables),this.onDidChangeVisibleRepositories({added:this.scmViewService.visibleRepositories,removed:yt.empty()}),typeof this.treeScrollTop=="number"&&(this.tree.scrollTop=this.treeScrollTop,this.treeScrollTop=void 0),this.updateRepositoryCollapseAllContextKeys()}):(this.visibilityDisposables.clear(),this.onDidChangeVisibleRepositories({added:yt.empty(),removed:[...this.items.keys()]}),this.treeScrollTop=this.tree.scrollTop,this.updateRepositoryCollapseAllContextKeys())},this,this.disposables),this.disposables.add(this.instantiationService.createInstance(kut)),this.themeService.onDidFileIconThemeChange(this.updateIndentStyles,this,this.disposables),this.updateIndentStyles(this.themeService.getFileIconTheme())}createTree(e,t){let o=_(".scm-overflow-widgets-container.monaco-editor");this.inputRenderer=this.instantiationService.createInstance(U1,this.layoutCache,o,(l,c)=>{try{this.tree.updateElementHeight(l,c)}catch{}}),this.actionButtonRenderer=this.instantiationService.createInstance(n7),this.listLabels=this.instantiationService.createInstance(jl,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this.disposables.add(this.listLabels);let n=new R6t(()=>this.getSelectedResources());n.onWillRun(()=>this.tree.domFocus(),this,this.disposables),this.disposables.add(n);let r=this.instantiationService.createInstance(Eut,()=>this.viewMode);this.disposables.add(r);let s=hr("scm.compactFolders",!0,this.configurationService);this.tree=this.instantiationService.createInstance(qy,"SCM Tree Repo",e,new y1i(this.inputRenderer),new w1i,[this.inputRenderer,this.actionButtonRenderer,this.instantiationService.createInstance(GV,R.SCMTitle,koe(this.instantiationService)),this.instantiationService.createInstance(gse,koe(this.instantiationService),n),this.instantiationService.createInstance(fse,()=>this.viewMode,this.listLabels,koe(this.instantiationService),n)],r,{horizontalScrolling:!1,setRowLineHeight:!1,transformOptimization:!1,filter:new C1i,dnd:new I1i(this.instantiationService),identityProvider:new k1i,sorter:new x1i(()=>this.viewMode,()=>this.viewSortKey),keyboardNavigationLabelProvider:this.instantiationService.createInstance(Cut,()=>this.viewMode),overrideStyles:this.getLocationBasedColors().listOverrideStyles,compressionEnabled:s.get(),collapseByDefault:l=>!(ou(l)||ww(l)||n6(l)),accessibilityProvider:this.instantiationService.createInstance(xut),twistieAdditionalCssClass:l=>{if(uO(l)||dO(l))return"force-no-twistie"}}),this.disposables.add(this.tree),this.tree.onDidOpen(this.open,this,this.disposables),this.tree.onContextMenu(this.onListContextMenu,this,this.disposables),this.tree.onDidScroll(this.inputRenderer.clearValidation,this.inputRenderer,this.disposables),U.filter(this.tree.onDidChangeCollapseState,l=>ou(l.node.element?.element),this.disposables)(this.updateRepositoryCollapseAllContextKeys,this,this.disposables),this.disposables.add(ve(l=>{this.tree.updateOptions({compressionEnabled:s.read(l)})})),D(e,o)}async open(e){if(e.element){if(ou(e.element)){this.scmViewService.focus(e.element);return}else if(dO(e.element)){this.scmViewService.focus(e.element.repository);let t=this.inputRenderer.getRenderedInputWidget(e.element);if(t){t.focus(),this.tree.setFocus([],e.browserEvent);let o=this.tree.getSelection();o.length===1&&o[0]===e.element&&setTimeout(()=>this.tree.setSelection([]))}return}else if(uO(e.element)){this.scmViewService.focus(e.element.repository),this.actionButtonRenderer.focusActionButton(e.element),this.tree.setFocus([],e.browserEvent);return}else if(ww(e.element)){let t=e.element.provider,o=yt.find(this.scmService.repositories,n=>n.provider===t);o&&this.scmViewService.focus(o);return}else if(pO(e.element)){if(e.element.command?.id===Xg||e.element.command?.id===ik)if(Wbt(e.browserEvent)&&e.browserEvent.button===1){let n=e.element.resourceGroup,r=`${n.provider.label}: ${n.label}`;await $Le.openMultiFileDiffEditor(this.editorService,r,n.provider.rootUri,n.id,{...e.editorOptions,viewState:{revealData:{resource:{original:e.element.multiDiffEditorOriginalUri,modified:e.element.multiDiffEditorModifiedUri}}},preserveFocus:!0})}else await this.commandService.executeCommand(e.element.command.id,...e.element.command.arguments||[],e);else if(await e.element.open(!!e.editorOptions.preserveFocus),e.editorOptions.pinned){let n=this.editorService.activeEditorPane;n?.group.pinEditor(n.input)}let t=e.element.resourceGroup.provider,o=yt.find(this.scmService.repositories,n=>n.provider===t);o&&this.scmViewService.focus(o)}else if(n6(e.element)){let t=e.element.context.provider,o=yt.find(this.scmService.repositories,n=>n.provider===t);o&&this.scmViewService.focus(o);return}}else return}onDidActiveEditorChange(){if(!this.configurationService.getValue("scm.autoReveal"))return;let e=po.getOriginalUri(this.editorService.activeEditor,{supportSideBySide:1});e&&(this.tree.getFocus().some(t=>pO(t)&&this.uriIdentityService.extUri.isEqual(t.sourceUri,e))&&this.tree.getSelection().some(t=>pO(t)&&this.uriIdentityService.extUri.isEqual(t.sourceUri,e))||this.revealResourceThrottler.queue(()=>this.treeOperationSequencer.queue(async()=>{for(let t of this.scmViewService.visibleRepositories)if(this.items.get(t))for(let n=t.provider.groups.length-1;n>=0;n--){let r=t.provider.groups[n],s=this.viewMode==="tree"?r.resourceTree.getNode(e)?.element:r.resources.find(l=>this.uriIdentityService.extUri.isEqual(l.sourceUri,e));if(s){await this.tree.expandTo(s),this.tree.reveal(s),this.tree.setSelection([s]),this.tree.setFocus([s]);return}}})))}onDidChangeVisibleRepositories({added:e,removed:t}){for(let o of e){let n=new O;n.add(ve(l=>{o.provider.actionButton.read(l),this.updateChildren(o)})),n.add(o.input.onDidChangeVisibility(()=>this.updateChildren(o))),n.add(o.provider.onDidChangeResourceGroups(()=>this.updateChildren(o)));let r=n.add(new Ot),s=()=>{for(let[l]of r)o.provider.groups.includes(l)||r.deleteAndDispose(l);for(let l of o.provider.groups)if(!r.has(l)){let c=new O;c.add(l.onDidChange(()=>this.updateChildren(o))),c.add(l.onDidChangeResources(()=>this.updateChildren(o))),r.set(l,c)}};n.add(o.provider.onDidChangeResourceGroups(s)),s(),this.items.set(o,n)}for(let o of t)this.items.deleteAndDispose(o);this.updateChildren(),this.onDidActiveEditorChange()}onListContextMenu(e){if(!e.element){let l=this.menuService.getMenuActions(J$.ViewSort,this.contextKeyService),c=Lu(l);return this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>c,onHide:()=>{}})}let t=e.element,o=t,n=[],r=new O,s=new R6t(()=>this.getSelectedResources());if(r.add(s),ou(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.provider).getRepositoryContextMenu(t);o=t.provider,s=new Gze(()=>this.getSelectedRepositories()),r.add(s),n=a6(c)}else if(!(dO(t)||uO(t))){if(ww(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.provider).getResourceGroupMenu(t);n=a6(c)}else if(pO(t)){let c=this.scmViewService.menus.getRepositoryMenus(t.resourceGroup.provider).getResourceMenu(t);n=a6(c)}else if(n6(t))if(t.element){let c=this.scmViewService.menus.getRepositoryMenus(t.element.resourceGroup.provider).getResourceMenu(t.element);n=a6(c)}else{let c=this.scmViewService.menus.getRepositoryMenus(t.context.provider).getResourceFolderMenu(t.context);n=a6(c)}}r.add(s.onWillRun(()=>this.tree.domFocus())),this.contextMenuService.showContextMenu({actionRunner:s,getAnchor:()=>e.anchor,getActions:()=>n,getActionsContext:()=>o,onHide:()=>r.dispose()})}getSelectedRepositories(){let e=this.tree.getFocus().filter(o=>!!o&&ou(o)),t=this.tree.getSelection().filter(o=>!!o&&ou(o));return Array.from(new Set([...e,...t]))}getSelectedResources(){return this.tree.getSelection().filter(e=>ww(e)||pO(e)||n6(e))}getViewMode(){let e=this.configurationService.getValue("scm.defaultViewMode")==="list"?"list":"tree",t=this.storageService.get("scm.viewMode",1);return typeof t=="string"&&(e=t),e}getViewSortKey(){if(this._viewMode==="tree")return"path";let e;switch(this.configurationService.getValue("scm.defaultViewSortKey")){case"name":e="name";break;case"status":e="status";break;default:e="path";break}let o=this.storageService.get("scm.viewSortKey",1);return typeof o=="string"&&(e=o),e}loadTreeViewState(){let e=this.storageService.get("scm.viewState2",1);if(e)try{return JSON.parse(e)}catch{return}}storeTreeViewState(){this.tree&&this.storageService.store("scm.viewState2",JSON.stringify(this.tree.getViewState()),1,1)}updateChildren(e){this.updateChildrenThrottler.queue(()=>this.treeOperationSequencer.queue(async()=>{let t=this.inputRenderer.getFocusedInput();e&&this.tree.hasNode(e)?await this.tree.updateChildren(e):await this.tree.updateChildren(void 0),t&&this.inputRenderer.getRenderedInputWidget(t)?.focus(),this.updateScmProviderContextKeys(),this.updateRepositoryCollapseAllContextKeys()}))}updateIndentStyles(e){this.treeContainer.classList.toggle("list-view-mode",this.viewMode==="list"),this.treeContainer.classList.toggle("tree-view-mode",this.viewMode==="tree"),this.treeContainer.classList.toggle("align-icons-and-twisties",this.viewMode==="list"&&e.hasFileIcons||e.hasFileIcons&&!e.hasFolderIcons),this.treeContainer.classList.toggle("hide-arrows",this.viewMode==="tree"&&e.hidesExplorerArrows===!0)}updateScmProviderContextKeys(){if(!this.configurationService.getValue("scm.alwaysShowRepositories")&&this.items.size===1){let t=yt.first(this.items.keys()).provider;this.scmProviderContextKey.set(t.providerId),this.scmProviderRootUriContextKey.set(t.rootUri?.toString()),this.scmProviderHasRootUriContextKey.set(!!t.rootUri)}else this.scmProviderContextKey.set(void 0),this.scmProviderRootUriContextKey.set(void 0),this.scmProviderHasRootUriContextKey.set(!1)}updateRepositoryCollapseAllContextKeys(){if(!this.isBodyVisible()||this.items.size===1){this.isAnyRepositoryCollapsibleContextKey.set(!1),this.areAllRepositoriesCollapsedContextKey.set(!1);return}this.isAnyRepositoryCollapsibleContextKey.set(this.scmViewService.visibleRepositories.some(e=>this.tree.hasNode(e)&&this.tree.isCollapsible(e))),this.areAllRepositoriesCollapsedContextKey.set(this.scmViewService.visibleRepositories.every(e=>this.tree.hasNode(e)&&(!this.tree.isCollapsible(e)||this.tree.isCollapsed(e))))}collapseAllRepositories(){for(let e of this.scmViewService.visibleRepositories)this.tree.isCollapsible(e)&&this.tree.collapse(e)}expandAllRepositories(){for(let e of this.scmViewService.visibleRepositories)this.tree.isCollapsible(e)&&this.tree.expand(e)}collapseAllResources(e){for(let{element:t}of this.tree.getNode(e).children)cst(t)||this.tree.collapse(t,!0)}focusPreviousInput(){this.treeOperationSequencer.queue(()=>this.focusInput(-1))}focusNextInput(){this.treeOperationSequencer.queue(()=>this.focusInput(1))}async focusInput(e){if(!this.scmViewService.focusedRepository||this.scmViewService.visibleRepositories.length===0)return;let t=this.scmViewService.focusedRepository.input,o=this.scmViewService.visibleRepositories;if(!(o.length===1&&this.inputRenderer.getRenderedInputWidget(t)?.hasFocus()===!0)){if(o.length>1&&this.inputRenderer.getRenderedInputWidget(t)?.hasFocus()===!0){let n=o.indexOf(this.scmViewService.focusedRepository),r=SB(n+e,o.length);t=o[r].input}await this.tree.expandTo(t),this.tree.reveal(t),this.inputRenderer.getRenderedInputWidget(t)?.focus()}}focusPreviousResourceGroup(){this.treeOperationSequencer.queue(()=>this.focusResourceGroup(-1))}focusNextResourceGroup(){this.treeOperationSequencer.queue(()=>this.focusResourceGroup(1))}async focusResourceGroup(e){if(!this.scmViewService.focusedRepository||this.scmViewService.visibleRepositories.length===0)return;let t=Na(this.tree.getHTMLElement()),o=this.scmViewService.focusedRepository.provider.groups,n=this.tree.getFocus().find(l=>ww(l)),r=t&&n?o.indexOf(n):-1,s;if(r===-1){for(let l of o)if(this.tree.hasNode(l)){s=l;break}}else{let l=SB(r+e,o.length);for(;l!==r;){if(this.tree.hasNode(o[l])){s=o[l];break}l=SB(l+e,o.length)}}s&&(await this.tree.expandTo(s),this.tree.reveal(s),this.tree.setSelection([s]),this.tree.setFocus([s]),this.tree.domFocus())}shouldShowWelcome(){return this.scmService.repositoryCount===0}getActionsContext(){return this.scmViewService.visibleRepositories.length===1?this.scmViewService.visibleRepositories[0].provider:void 0}focus(){super.focus(),this.treeOperationSequencer.queue(()=>new Promise(e=>{if(this.isExpanded()){if(this.tree.getFocus().length===0)for(let t of this.scmViewService.visibleRepositories){let o=this.inputRenderer.getRenderedInputWidget(t.input);if(o){o.focus(),e();return}}this.tree.domFocus(),e()}}))}dispose(){this._onDidChangeViewMode.dispose(),this._onDidChangeViewSortKey.dispose(),this.visibilityDisposables.dispose(),this.disposables.dispose(),this.items.dispose(),super.dispose()}};Qze=I([m(1,fe),m(2,ie),m(3,Yt),m(4,lc),m(5,Au),m(6,de),m(7,gt),m(8,Le),m(9,Pe),m(10,Xe),m(11,F),m(12,ji),m(13,B),m(14,X),m(15,Je),m(16,ot)],Qze);var Eut=class extends k{constructor(e,t,o){super();this.viewMode=e;this.configurationService=t;this.scmViewService=o}async getChildren(e){let t=this.scmViewService.visibleRepositories.length,o=this.configurationService.getValue("scm.showActionButton")===!0,n=this.configurationService.getValue("scm.alwaysShowRepositories")===!0;if(cst(e)&&(t>1||n))return this.scmViewService.visibleRepositories;if(cst(e)&&t===1&&!n||ou(e)){let r=[];e=ou(e)?e:this.scmViewService.visibleRepositories[0];let s=e.provider.actionButton.get(),l=e.provider.groups;return e.input.visible&&r.push(e.input),o&&s&&r.push({type:"actionButton",repository:e,button:s}),(l.some(u=>u.resources.length>0)||t===1&&(!o||!s))&&r.push(...l),r}else if(ww(e)){if(this.viewMode()==="list")return e.resources;if(this.viewMode()==="tree"){let r=[];for(let s of e.resourceTree.root.children)r.push(s.element&&s.childrenCount===0?s.element:s);return r}}else if(n6(e)){let r=[];for(let s of e.children)r.push(s.element&&s.childrenCount===0?s.element:s);return r}return[]}getParent(e){if(n6(e)){if(e.parent===e.context.resourceTree.root)return e.context;if(e.parent)return e.parent;throw new Error("Invalid element passed to getParent")}else if(pO(e)){if(this.viewMode()==="list")return e.resourceGroup;let o=e.resourceGroup.resourceTree.getNode(e.sourceUri)?.parent;if(!o)throw new Error("Invalid element passed to getParent");return o===e.resourceGroup.resourceTree.root?e.resourceGroup:o}else{if(dO(e))return e.repository;if(uO(e))return e.repository;if(ww(e)){let t=this.scmViewService.visibleRepositories.find(o=>o.provider===e.provider);if(!t)throw new Error("Invalid element passed to getParent");return t}else{if(ou(e))return this.scmViewService;throw new Error("Unexpected call to getParent")}}}hasChildren(e){if(cst(e))return this.scmViewService.visibleRepositories.length!==0;if(ou(e))return!0;if(dO(e))return!1;if(uO(e))return!1;if(ww(e))return!0;if(pO(e))return!1;if(Fm.isResourceNode(e))return e.childrenCount>0;throw new Error("hasChildren not implemented.")}};Eut=I([m(1,B),m(2,Au)],Eut);var B1i=class{constructor(i,e,t,o){this.container=i;this.contextMenuService=e;this.commandService=t;this.notificationService=o;this.disposables=new ue}dispose(){this.disposables?.dispose()}setButton(i){if(this.clear(),!!i){if(i.secondaryCommands?.length){let e=[];for(let t=0;t<i.secondaryCommands.length;t++){let o=i.secondaryCommands[t];for(let n of o)e.push(li({id:n.id,label:n.title,enabled:!0,run:async()=>{await this.executeCommand(n.id,...n.arguments||[])}}));o.length&&e.push(new oi)}e.pop(),this.button=new Jv(this.container,{actions:e,addPrimaryActionToDropdown:!1,contextMenuProvider:this.contextMenuService,title:i.command.tooltip,supportIcons:!0,...Ro})}else this.button=new Pi(this.container,{supportIcons:!0,supportShortLabel:!!i.command.shortTitle,title:i.command.tooltip,...Ro});this.button.enabled=i.enabled,this.button.label=i.command.title,this.button instanceof Pi&&i.command.shortTitle&&(this.button.labelShort=i.command.shortTitle),this.button.onDidClick(async()=>await this.executeCommand(i.command.id,...i.command.arguments||[]),null,this.disposables.value),this.disposables.value.add(this.button)}}focus(){this.button?.focus()}clear(){this.disposables.value=new O,this.button=void 0,St(this.container)}async executeCommand(i,...e){try{await this.commandService.executeCommand(i,...e)}catch(t){this.notificationService.error(t)}}};var H1i=class{getHeight(){return 22}getTemplateId(i){if(ou(i))return GV.TEMPLATE_ID;if(t1(i))return vse.TEMPLATE_ID;if(_P(i)||s6(i))return bse.TEMPLATE_ID;throw new Error("Invalid tree element")}},vse=class{constructor(i,e,t,o,n,r,s,l){this.actionViewItemProvider=i;this._contextMenuService=e;this._contextKeyService=t;this._keybindingService=o;this._menuService=n;this._commandService=r;this._scmViewService=s;this._telemetryService=l}static{this.TEMPLATE_ID="artifactGroup"}get templateId(){return vse.TEMPLATE_ID}renderTemplate(i){let e=D(i,_(".scm-artifact-group")),t=D(e,_(".icon")),o=new ld(e,{supportIcons:!1}),n=D(e,_(".actions")),r=new dl(n,{actionViewItemProvider:this.actionViewItemProvider},this._menuService,this._contextKeyService,this._contextMenuService,this._keybindingService,this._commandService,this._telemetryService);return{icon:t,label:o,actionBar:r,elementDisposables:new O,templateDisposable:Fn(o,r)}}renderElement(i,e,t){let o=i.element.repository.provider,n=i.element.artifactGroup;t.icon.className=q.isThemeIcon(n.icon)?`icon ${q.asClassName(n.icon)}`:"",t.label.setLabel(n.name);let r=this._scmViewService.menus.getRepositoryMenus(o);t.elementDisposables.add(xoe(r.getArtifactGroupMenu(n),s=>{t.actionBar.setActions(s)},"inline",o)),t.actionBar.context=n}renderCompressedElements(i,e,t,o){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t,o){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposable.dispose()}};vse=I([m(1,Xe),m(2,X),m(3,Le),m(4,Yt),m(5,fe),m(6,Au),m(7,_e)],vse);var bse=class{constructor(i,e,t,o,n,r,s,l){this.actionViewItemProvider=i;this._contextMenuService=e;this._contextKeyService=t;this._keybindingService=o;this._menuService=n;this._commandService=r;this._scmViewService=s;this._telemetryService=l}static{this.TEMPLATE_ID="artifact"}get templateId(){return bse.TEMPLATE_ID}renderTemplate(i){let e=D(i,_(".scm-artifact")),t=D(e,_(".icon")),o=new ld(e,{supportIcons:!1}),n=D(e,_(".timestamp-container")),r=D(n,_(".timestamp")),s=D(e,_(".actions")),l=new dl(s,{actionViewItemProvider:this.actionViewItemProvider},this._menuService,this._contextKeyService,this._contextMenuService,this._keybindingService,this._commandService,this._telemetryService);return{icon:t,label:o,timestampContainer:n,timestamp:r,actionBar:l,elementDisposables:new O,templateDisposable:Fn(o,l)}}renderElement(i,e,t){let o=i.element;if(_P(o)){let n=o.group,r=o.artifact,s=r.icon??o.group.icon;t.icon.className=q.isThemeIcon(s)?`icon ${q.asClassName(s)}`:"";let l=n.supportsFolders?r.name.split("/").pop()??r.name:r.name;t.label.setLabel(l,r.description),t.timestamp.textContent=r.timestamp?ea(r.timestamp):"",t.timestampContainer.classList.toggle("duplicate",o.hideTimestamp),t.timestampContainer.style.display=""}else s6(o)&&(t.icon.className=`icon ${q.asClassName(L.folder)}`,t.label.setLabel(Be(o.uri)),t.timestamp.textContent="",t.timestampContainer.classList.remove("duplicate"),t.timestampContainer.style.display="none");this._renderActionBar(o,t)}renderCompressedElements(i,e,t,o){let n=i.element,r=n.elements[n.elements.length-1];if(_P(r)){let s=r.artifact,l=s.icon??r.group.icon;t.icon.className=q.isThemeIcon(l)?`icon ${q.asClassName(l)}`:"",t.label.setLabel(s.name,s.description),t.timestamp.textContent=s.timestamp?ea(s.timestamp):"",t.timestampContainer.classList.toggle("duplicate",r.hideTimestamp),t.timestampContainer.style.display=""}else s6(r)&&(t.icon.className=`icon ${q.asClassName(L.folder)}`,t.label.setLabel(r.uri.fsPath.substring(1)),t.timestamp.textContent="",t.timestampContainer.classList.remove("duplicate"),t.timestampContainer.style.display="none");this._renderActionBar(r,t)}_renderActionBar(i,e){if(_P(i)){let t=i.artifact,o=i.repository.provider,n=this._scmViewService.menus.getRepositoryMenus(o);e.elementDisposables.add(xoe(n.getArtifactMenu(i.group,t),r=>{e.actionBar.setActions(r)},"inline",o)),e.actionBar.context=t}else Fm.isResourceNode(i)&&(e.actionBar.setActions([]),e.actionBar.context=void 0)}disposeElement(i,e,t,o){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposable.dispose()}};bse=I([m(1,Xe),m(2,X),m(3,Le),m(4,Yt),m(5,fe),m(6,Au),m(7,_e)],bse);var Dut=class extends k{constructor(e){super();this.scmViewService=e}async getChildren(e){if(this.scmViewService.explorerEnabledConfig.get()===!1){let t=ou(e)?e.provider.id:void 0;return this.scmViewService.repositories.filter(n=>n.provider.parentId===t)}if(e instanceof X$){let t=this.scmViewService.repositories.filter(o=>o.provider.parentId===void 0);if(t.length!==this.scmViewService.repositories.length)for(let o of t){let n=this.scmViewService.repositories.filter(s=>s.provider.parentId===o.provider.id);if(n.length===0)continue;let r=t.indexOf(o);t.splice(r+1,0,...n)}return t}else{if(ou(e))return(await e.provider.artifactProvider.get()?.provideArtifactGroups()??[]).map(o=>({repository:e,artifactGroup:o,type:"artifactGroup"}));if(t1(e)){let t=e.repository,o=await t.provider.artifactProvider.get()?.provideArtifacts(e.artifactGroup.id)??[];if(e.artifactGroup.supportsFolders){let n=new Fm(e);for(let r=0;r<o.length;r++){let s=o[r],l=A.from({scheme:"scm-artifact",path:s.name}),c=s.id.lastIndexOf("/")>0?s.id.substring(0,s.id.lastIndexOf("/")):s.id,u=r>0?o[r-1]:void 0,p=u&&u.id.lastIndexOf("/")>0?u.id.substring(0,u.id.lastIndexOf("/")):u?.id,h=r>0&&s.timestamp!==void 0&&u?.timestamp!==void 0&&c===p&&ea(u.timestamp)===ea(s.timestamp);n.add(l,{repository:t,group:e.artifactGroup,artifact:s,hideTimestamp:h,type:"artifact"})}return yt.map(n.root.children,r=>r.element??r)}return o.map((n,r,s)=>({repository:t,group:e.artifactGroup,artifact:n,hideTimestamp:r>0&&n.timestamp!==void 0&&s[r-1].timestamp!==void 0&&ea(s[r-1].timestamp)===ea(n.timestamp),type:"artifact"}))}else if(s6(e))return yt.map(e.children,t=>t.element&&t.childrenCount===0?t.element:t)}return[]}hasChildren(e){if(this.scmViewService.explorerEnabledConfig.get()===!1){let t=ou(e)?e.provider.id:void 0;return this.scmViewService.repositories.filter(n=>n.provider.parentId===t).length>0}return e instanceof X$?this.scmViewService.repositories.length>0:ou(e)||t1(e)?!0:_P(e)?!1:s6(e)?e.childrenCount>0:!1}};Dut=I([m(0,Au)],Dut);var U1i=class{getId(i){if(ou(i))return`repo:${i.provider.id}`;if(t1(i))return`artifactGroup:${i.repository.provider.id}/${i.artifactGroup.id}`;if(_P(i))return`artifact:${i.repository.provider.id}/${i.group.id}/${i.artifact.id}`;if(s6(i))return`artifactFolder:${i.context.repository.provider.id}/${i.context.artifactGroup.id}/${i.uri.fsPath}`;throw new Error("Invalid tree element")}},z1i=class{isIncompressible(i){return Fm.isResourceNode(i)?i.childrenCount>1:!0}},Yze=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super({...e,titleMenuId:R.SCMSourceControlTitle},n,r,p,u,c,l,h,g,f);this.scmService=t;this.scmViewService=o;this.commandService=s;this.storageService=v;this.treeOperationSequencer=new Tm;this.updateChildrenThrottler=new am;this.visibilityDisposables=new O;this.repositoryDisposables=new Ot;this.visibleCountObs=hr("scm.repositories.visible",10,this.configurationService),this.providerCountBadgeObs=hr("scm.providerCountBadge","hidden",this.configurationService),this.storageService.onWillSaveState(()=>{this.storeTreeViewState()},this,this._store),this._register(this.updateChildrenThrottler)}renderBody(e){super.renderBody(e);let t=D(e,_(".scm-view.scm-repositories-view"));this._register(ve(n=>{let r=this.providerCountBadgeObs.read(n);t.classList.toggle("hide-provider-counts",r==="hidden"),t.classList.toggle("auto-provider-counts",r==="auto")}));let o=this.loadTreeViewState();this.createTree(t,o),this.onDidChangeBodyVisibility(async n=>{if(!n){this.visibilityDisposables.clear();return}this.treeOperationSequencer.queue(async()=>{await this.tree.setInput(this.scmViewService,o),this.visibilityDisposables.add(ve(s=>{let l=this.visibleCountObs.read(s);this.updateBodySize(this.tree.contentHeight,l)})),this.visibilityDisposables.add(Zs(this.scmViewService.explorerEnabledConfig,async()=>{await this.updateChildren(),this.updateBodySize(this.tree.contentHeight),this.scmViewService.repositories.length===1&&await this.treeOperationSequencer.queue(()=>this.tree.expand(this.scmViewService.repositories[0]))}));let r=qr(this,this.scmViewService.onDidChangeVisibleRepositories);this.visibilityDisposables.add(ve(async s=>{r.read(s),await this.treeOperationSequencer.queue(()=>this.updateTreeSelection())})),this.scmService.onDidAddRepository(this.onDidAddRepository,this,this.visibilityDisposables),this.scmService.onDidRemoveRepository(this.onDidRemoveRepository,this,this.visibilityDisposables);for(let s of this.scmService.repositories)this.onDidAddRepository(s);this.visibilityDisposables.add(ve(async s=>{let l=this.scmViewService.explorerEnabledConfig.read(s),c=this.scmViewService.didFinishLoadingRepositories.read(s);o===void 0&&l&&c&&this.scmViewService.repositories.length===1&&await this.treeOperationSequencer.queue(()=>this.tree.expand(this.scmViewService.repositories[0]))}))})},this,this._store)}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}createTree(e,t){this.treeIdentityProvider=new U1i,this.treeDataSource=this.instantiationService.createInstance(Dut),this._register(this.treeDataSource),this.tree=this.instantiationService.createInstance(qy,"SCM Repositories",e,new H1i,new z1i,[this.instantiationService.createInstance(GV,R.SCMSourceControlInline,koe(this.instantiationService)),this.instantiationService.createInstance(vse,koe(this.instantiationService)),this.instantiationService.createInstance(bse,koe(this.instantiationService))],this.treeDataSource,{identityProvider:this.treeIdentityProvider,horizontalScrolling:!1,collapseByDefault:o=>this.scmViewService.explorerEnabledConfig.get()===!1?!(ou(o)&&o.provider.parentId===void 0):t?.expanded&&(ou(o)||t1(o)||_P(o))?t.expanded.indexOf(this.treeIdentityProvider.getId(o))===-1:s6(o)?!(o.childrenCount===1&&yt.first(o.children)?.element===void 0):!0,compressionEnabled:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles,multipleSelectionSupport:this.scmViewService.selectionModeConfig.get()==="multiple",expandOnDoubleClick:!0,expandOnlyOnTwistieClick:!0,accessibilityProvider:{getAriaLabel(o){return ou(o)?o.provider.label:t1(o)?o.artifactGroup.name:_P(o)?o.artifact.name:""},getWidgetAriaLabel(){return d(14965,null)}}}),this._register(this.tree),this._register(ve(o=>{let n=this.scmViewService.selectionModeConfig.read(o);this.tree.updateOptions({multipleSelectionSupport:n==="multiple"})})),this._register(this.tree.onDidOpen(this.onTreeDidOpen,this)),this._register(this.tree.onDidChangeSelection(this.onTreeSelectionChange,this)),this._register(this.tree.onDidChangeFocus(this.onTreeDidChangeFocus,this)),this._register(this.tree.onDidFocus(this.onDidTreeFocus,this)),this._register(this.tree.onContextMenu(this.onTreeContextMenu,this)),this._register(this.tree.onDidChangeContentHeight(this.onTreeContentHeightChange,this))}async onDidAddRepository(e){let t=new O;t.add(ve(async o=>{let n=this.scmViewService.explorerEnabledConfig.read(o),r=e.provider.artifactProvider.read(o);!n||!r||o.store.add(r.onDidChangeArtifacts(async s=>{await this.updateRepository(e)}))})),t.add(ve(async o=>{let n=e.provider.historyProvider.read(o);n&&o.store.add(Zs(n.historyItemRef,async()=>{await this.updateRepository(e)}))})),await this.updateRepository(e),this.repositoryDisposables.set(e,t)}async onDidRemoveRepository(e){await this.updateRepository(e),this.repositoryDisposables.deleteAndDispose(e)}onTreeDidOpen(e){!e.element||!_P(e.element)||!e.element.artifact.command||this.commandService.executeCommand(e.element.artifact.command.id,e.element.repository.provider,e.element.artifact)}onTreeContextMenu(e){if(e.element){if(ou(e.element)){let t=e.element.provider,n=this.scmViewService.menus.getRepositoryMenus(t).getRepositoryContextMenu(e.element),r=a6(n),s=new O,l=new Gze(()=>this.getTreeSelection());s.add(l),s.add(l.onWillRun(()=>this.tree.domFocus())),this.contextMenuService.showContextMenu({actionRunner:l,getAnchor:()=>e.anchor,getActions:()=>r,getActionsContext:()=>t,onHide:()=>s.dispose()})}else if(_P(e.element)){let t=e.element.repository.provider,o=e.element.artifact,r=this.scmViewService.menus.getRepositoryMenus(t).getArtifactMenu(e.element.group,o),s=a6(r,t);this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,getActionsContext:()=>o})}}}onTreeSelectionChange(e){if(e.browserEvent&&e.elements.length>0){let t=this.tree.scrollTop;e.elements.every(o=>ou(o))?this.scmViewService.visibleRepositories=e.elements:e.elements.every(o=>t1(o)||_P(o))&&(this.scmViewService.visibleRepositories=e.elements.map(o=>o.repository)),this.tree.scrollTop=t}}onTreeDidChangeFocus(e){e.browserEvent&&e.elements.length>0&&ou(e.elements[0])&&this.scmViewService.focus(e.elements[0])}onDidTreeFocus(){let e=this.tree.getFocus();e.length>0&&(ou(e[0])?this.scmViewService.focus(e[0]):(t1(e[0])||_P(e[0]))&&this.scmViewService.focus(e[0].repository))}onTreeContentHeightChange(e){this.updateBodySize(e),this.treeOperationSequencer.queue(()=>this.updateTreeSelection())}async updateChildren(e){return this.updateChildrenThrottler.queue(()=>this.treeOperationSequencer.queue(async()=>{e&&this.tree.hasNode(e)?await this.tree.updateChildren(e,!0):await this.tree.updateChildren(void 0,!0)}))}async expand(e){await this.treeOperationSequencer.queue(()=>this.tree.expand(e,!0))}async updateRepository(e){if(this.scmViewService.explorerEnabledConfig.get()===!1){if(e.provider.parentId===void 0){await this.updateChildren();return}await this.updateParentRepository(e)}await this.updateChildren()}async updateParentRepository(e){let t=this.scmViewService.repositories.find(o=>o.provider.id===e.provider.parentId);t&&(await this.updateChildren(t),await this.expand(t))}updateBodySize(e,t){if(this.orientation!==1)if(this.scmViewService.explorerEnabledConfig.get()===!1){t=t??this.visibleCountObs.get();let o=this.scmViewService.repositories.length===0,n=Math.min(e/22,t)*22;this.minimumBodySize=t===0?22:n,this.maximumBodySize=t===0||o?Number.POSITIVE_INFINITY:n}else this.minimumBodySize=120,this.maximumBodySize=Number.POSITIVE_INFINITY}async updateTreeSelection(){let e=this.getTreeSelection(),t=new Set(e),o=new Set(this.scmViewService.visibleRepositories),n=new Set(yt.filter(o,c=>!t.has(c))),r=new Set(yt.filter(t,c=>!o.has(c)));if(n.size===0&&r.size===0)return;let s=e.filter(c=>!r.has(c));for(let c of this.scmViewService.repositories)n.has(c)&&s.push(c);let l=s.filter(c=>this.tree.hasNode(c));this.tree.setSelection(l),l.length>0&&!this.tree.getFocus().includes(l[0])&&(this.tree.setAnchor(l[0]),this.tree.setFocus([l[0]]))}getTreeSelection(){return this.tree.getSelection().map(e=>{if(ou(e))return e;if(t1(e)||_P(e))return e.repository;if(s6(e))return e.context.repository;throw new Error("Invalid tree element")})}loadTreeViewState(){let e=this.storageService.get("scm.repositoriesViewState",1);if(e)try{return JSON.parse(e)}catch{return}}storeTreeViewState(){this.tree&&this.storageService.store("scm.repositoriesViewState",JSON.stringify(this.tree.getViewState()),1,1)}dispose(){this.visibilityDisposables.dispose(),this.repositoryDisposables.dispose(),super.dispose()}};Yze=I([m(1,lc),m(2,Au),m(3,Le),m(4,Xe),m(5,fe),m(6,F),m(7,ji),m(8,X),m(9,B),m(10,Je),m(11,Pe),m(12,ot),m(13,de)],Yze);var Z$={IsEnabled:new Y("isWorkspaceTrustEnabled",!1,d(18352,null)),IsTrusted:new Y("isWorkspaceTrusted",!1,d(18351,null))},ej="workbench.trust.manage";var MSe=class extends k{constructor(e,t,o,n,r){super();this.configurationService=e;this.editorGroupsService=t;this.scmService=o;this.storageService=n;this.layoutService=r;this._repositoryDisposables=new Ot;this._enabledConfig=hr("scm.workingSets.enabled",!1,this.configurationService),this._store.add(ve(s=>{if(!this._enabledConfig.read(s)){this.storageService.remove("scm.workingSets",1),this._repositoryDisposables.clearAndDisposeAll();return}this._workingSets=this._loadWorkingSets(),this.scmService.onDidAddRepository(this._onDidAddRepository,this,s.store),this.scmService.onDidRemoveRepository(this._onDidRemoveRepository,this,s.store);for(let l of this.scmService.repositories)this._onDidAddRepository(l)}))}static{this.ID="workbench.contrib.scmWorkingSets"}_onDidAddRepository(e){let t=new O,o=ke(n=>e.provider.historyProvider.read(n)?.historyItemRef.read(n)?.id);t.add(ve(async n=>{let r=o.read(n);if(!r)return;let s=l6(e.provider),l=this._workingSets.get(s);if(!l){this._workingSets.set(s,{currentHistoryItemGroupId:r,editorWorkingSets:new Map});return}l.currentHistoryItemGroupId!==r&&(this._saveWorkingSet(s,r,l),await this._restoreWorkingSet(s,r))})),this._repositoryDisposables.set(e,t)}_onDidRemoveRepository(e){this._repositoryDisposables.deleteAndDispose(e)}_loadWorkingSets(){let e=new Map,t=this.storageService.get("scm.workingSets",1);if(!t)return e;for(let o of JSON.parse(t))e.set(o.providerKey,{currentHistoryItemGroupId:o.currentHistoryItemGroupId,editorWorkingSets:new Map(o.editorWorkingSets)});return e}_saveWorkingSet(e,t,o){let n=o.currentHistoryItemGroupId,r=o.editorWorkingSets,s=this.editorGroupsService.saveWorkingSet(n);this._workingSets.set(e,{currentHistoryItemGroupId:t,editorWorkingSets:r.set(n,s)});let l=[];for(let[c,{currentHistoryItemGroupId:u,editorWorkingSets:p}]of this._workingSets)l.push({providerKey:c,currentHistoryItemGroupId:u,editorWorkingSets:[...p]});this.storageService.store("scm.workingSets",JSON.stringify(l),1,1)}async _restoreWorkingSet(e,t){let o=this._workingSets.get(e);if(!o)return;let n=o.editorWorkingSets.get(t);if(!n&&this.configurationService.getValue("scm.workingSets.default")==="empty"&&(n="empty"),n){let r=this.layoutService.hasFocus("workbench.parts.panel");await this.editorGroupsService.applyWorkingSet(n,{preserveFocus:r})}}dispose(){this._repositoryDisposables.dispose(),super.dispose()}};MSe=I([m(0,B),m(1,kt),m(2,lc),m(3,de),m(4,wi)],MSe);var VNo="workbench.scm.action.graph.pickRepository",BNo="workbench.scm.action.graph.pickHistoryItemRefs",K1i=class extends ts{constructor(e,t,o){super(null,t,{...o,icon:!1,label:!0});this._repository=e}updateLabel(){if(this.options.label&&this.label){this.label.classList.add("scm-graph-repository-picker");let e=_(".icon"),t=q.isThemeIcon(this._repository.provider.iconPath)?q.asClassNameArray(this._repository.provider.iconPath):q.asClassNameArray(L.repo);e.classList.add(...t);let o=_(".name");o.textContent=this._repository.provider.name,Ii(this.label,e,o)}}getTooltip(){return this._repository.provider.name}},G1i=class extends ts{constructor(e,t,o,n){super(null,o,{...n,icon:!1,label:!0});this._repository=e;this._historyItemsFilter=t}updateLabel(){if(this.options.label&&this.label){this.label.classList.add("scm-graph-history-item-picker");let e=_(".icon");e.classList.add(...q.asClassNameArray(L.gitBranch));let t=_(".name");this._historyItemsFilter==="all"?t.textContent=d(14939,null):this._historyItemsFilter==="auto"?t.textContent=d(14941,null):this._historyItemsFilter.length===1?t.textContent=this._historyItemsFilter[0].name:t.textContent=d(14945,null,this._historyItemsFilter.length),Ii(this.label,e,t)}}getTooltip(){if(this._historyItemsFilter==="all")return d(14940,null);if(this._historyItemsFilter==="auto"){let e=this._repository.provider.historyProvider.get();return[e?.historyItemRef.get()?.name,e?.historyItemRemoteRef.get()?.name,e?.historyItemBaseRef.get()?.name].filter(t=>!!t).join(", ")}else return this._historyItemsFilter.length===1?this._historyItemsFilter[0].name:this._historyItemsFilter.map(e=>e.name).join(", ")}};W(class extends rr{constructor(){super({id:VNo,title:d(14952,null),viewId:mN,f1:!1,menu:{id:R.SCMHistoryTitle,when:C.and(C.has("scm.providerCount"),C.greater("scm.providerCount",1),C.equals("config.scm.repositories.selectionMode","multiple")),group:"navigation",order:0}})}async runInView(a,i){i.pickRepository()}});W(class extends rr{constructor(){super({id:BNo,title:d(14950,null),icon:L.gitBranch,viewId:mN,precondition:Jc.SCMHistoryItemCount.notEqualsTo(0),f1:!1,menu:{id:R.SCMHistoryTitle,group:"navigation",order:1}})}async runInView(a,i){i.pickHistoryItemRef()}});W(class extends rr{constructor(){super({id:"workbench.scm.action.graph.revealCurrentHistoryItem",title:d(14943,null),icon:L.target,viewId:mN,precondition:C.and(Jc.SCMHistoryItemCount.notEqualsTo(0),Jc.SCMCurrentHistoryItemRefInFilter.isEqualTo(!0)),f1:!1,menu:{id:R.SCMHistoryTitle,group:"navigation",order:2}})}async runInView(a,i){i.revealCurrentHistoryItem()}});W(class extends rr{constructor(){super({id:"workbench.scm.action.graph.refresh",title:d(14951,null),viewId:mN,f1:!1,icon:L.refresh,menu:{id:R.SCMHistoryTitle,group:"navigation",order:1e3}})}async runInView(a,i){i.refresh()}});W(class extends rr{constructor(){super({id:"workbench.scm.action.graph.setListViewMode",title:d(14957,null),viewId:mN,toggled:Jc.SCMHistoryViewMode.isEqualTo("list"),menu:{id:R.SCMHistoryTitle,group:"9_viewmode",order:1},f1:!1})}async runInView(a,i){i.setViewMode("list")}});W(class extends rr{constructor(){super({id:"workbench.scm.action.graph.setTreeViewMode",title:d(14958,null),viewId:mN,toggled:Jc.SCMHistoryViewMode.isEqualTo("tree"),menu:{id:R.SCMHistoryTitle,group:"9_viewmode",order:2},f1:!1})}async runInView(a,i){i.setViewMode("tree")}});W(class extends z{constructor(){super({id:"workbench.scm.action.graph.viewChanges",title:d(14947,null),icon:L.diffMultiple,f1:!1,menu:[{id:R.SCMHistoryItemContext,group:"inline",order:1},{id:R.SCMHistoryItemContext,group:"0_view",order:1}]})}async run(a,i,...e){let t=a.get(fe),o=i.historyProvider.get(),n=o?.historyItemRef.get(),r=o?.historyItemRemoteRef.get();if(!i||!o||!n||e.length===0)return;let s=e[0],l,c,u;if(r&&(s.id===rW||s.id===Nee)){let h=await o.resolveHistoryItemRefsCommonAncestor([n.name,r.name]);h&&s.id===rW?(l=`${s.subject} - ${n.name} \u2194 ${r.name}`,c=r.id,u=h):h&&s.id===Nee&&(l=`${s.subject} - ${r.name} \u2194 ${n.name}`,c=n.id,u=h)}else l=UGt(s),c=s.id,s.parentIds.length>0&&(s.parentIds[0]===rW&&r?u=await o.resolveHistoryItemRefsCommonAncestor([n.name,r.name]):u=s.parentIds[0]);if(!l||!c||!u)return;let p=Zx.getMultiDiffSourceUri(i,c,u,"");t.executeCommand("_workbench.openMultiDiffEditor",{title:l,multiDiffSourceUri:p})}});W(class extends z{constructor(){super({id:"workbench.scm.action.graph.openFile",title:d(14948,null),icon:L.goToFile,f1:!1,menu:[{id:R.SCMHistoryItemChangeContext,group:"inline",order:1},{id:R.SCMHistoryItemChangeContext,group:"0_view",order:1}]})}async run(a,i,e){let t=a.get(ie);if(!i||!e.modifiedUri)return;let o;i.id===rW?o=d(14944,null):i.id===Nee?o=d(14949,null):o=i.displayId??i.id;let n=Jo(e.modifiedUri.fsPath);await t.openEditor({resource:e.modifiedUri,label:`${n} (${o})`})}});var q1i=class{getHeight(){return 22}getTemplateId(i){if(mO(i))return Sse.TEMPLATE_ID;if(r6(i)||TFe(i))return Ise.TEMPLATE_ID;if(EFe(i))return yse.TEMPLATE_ID;throw new Error("Unknown element")}},Sse=class{constructor(i,e,t,o,n,r,s,l,c,u){this._viewContainerLocation=i;this._commandService=e;this._configurationService=t;this._contextKeyService=o;this._contextMenuService=n;this._hoverService=r;this._keybindingService=s;this._markdownRendererService=l;this._menuService=c;this._telemetryService=u;this._badgesConfig=hr("scm.graph.badges","filter",this._configurationService)}static{this.TEMPLATE_ID="history-item"}get templateId(){return Sse.TEMPLATE_ID}renderTemplate(i){let e=D(i,_(".history-item")),t=D(e,_(".graph-container")),o=new ld(e,{supportIcons:!0,supportHighlights:!0,supportDescriptionHighlights:!0}),n=D(e,_(".label-container")),r=D(e,_(".actions")),s=new dl(r,void 0,this._menuService,this._contextKeyService,this._contextMenuService,this._keybindingService,this._commandService,this._telemetryService);return{element:e,graphContainer:t,label:o,labelContainer:n,actionBar:s,elementDisposables:new O,disposables:Fn(o,s)}}renderElement(i,e,t){let o=i.element.repository.provider,n=i.element.historyItemViewModel,r=n.historyItem,{content:s,disposables:l}=sZe(this._markdownRendererService,r,!0),{hoverOptions:c,hoverLifecycleOptions:u}=this._getHoverOptions(),p=this._hoverService.setupDelayedHover(t.element,{...c,content:s},u);t.elementDisposables.add(p),t.elementDisposables.add(l),t.graphContainer.textContent="",t.graphContainer.classList.toggle("current",n.kind==="HEAD"),t.graphContainer.classList.toggle("incoming-changes",n.kind==="incoming-changes"),t.graphContainer.classList.toggle("outgoing-changes",n.kind==="outgoing-changes"),t.graphContainer.appendChild(Buo(n));let g=o.historyProvider.get()?.historyItemRef?.get()?.revision===r.id?["history-item-current"]:[],[f,v]=this._processMatches(n,i.filterData);t.label.setLabel(r.subject,r.author,{matches:f,descriptionMatches:v,extraClasses:g}),this._renderBadges(r,t);let b=this._menuService.getMenuActions(R.SCMHistoryItemContext,this._contextKeyService,{arg:o,shouldForwardArgs:!0});t.actionBar.context=r,t.actionBar.setActions(xl(b,"inline").primary)}renderCompressedElements(i,e,t){throw new Error("Should never happen since node is incompressible")}_renderBadges(i,e){e.elementDisposables.add(ve(t=>{let o=this._badgesConfig.read(t);e.labelContainer.replaceChildren();let n=i.references?i.references.slice(0):[];n.length>0&&n[0].color&&(this._renderBadge([n[0]],!0,e),n.splice(0,1));let r=yy(n,s=>s.color?s.color:"");for(let[s,l]of Object.entries(r)){if(s===""&&o!=="all"||!l)continue;let c=yy(l,u=>q.isThemeIcon(u.icon)?u.icon.id:"");for(let[u,p]of Object.entries(c))u===""||!p||this._renderBadge(p,!1,e)}}))}_renderBadge(i,e,t){if(i.length===0||!q.isThemeIcon(i[0].icon))return;let o=st("div.label",{style:{color:i[0].color?Tt(wwi):Tt(xo),backgroundColor:i[0].color?Tt(i[0].color):Tt(ywi)}},[st("div.count@count",{style:{display:i.length>1?"":"none"}}),st("div.icon@icon"),st("div.description@description",{style:{display:e?"":"none"}})]);o.count.textContent=i.length>1?i.length.toString():"",o.icon.classList.add(...q.asClassNameArray(i[0].icon)),o.description.textContent=e?i[0].name:"",D(t.labelContainer,o.root)}_getHoverOptions(){return this._viewContainerLocation===1?{hoverOptions:{additionalClasses:["history-item-hover"],appearance:{compact:!0},position:{hoverPosition:1},style:2},hoverLifecycleOptions:void 0}:{hoverOptions:{additionalClasses:["history-item-hover"],appearance:{compact:!0,showPointer:!0},position:{hoverPosition:1},style:1},hoverLifecycleOptions:{groupId:"scm-history-item"}}}_processMatches(i,e){return e?[i.historyItem.message===e.label?Wa(e.score):void 0,i.historyItem.author===e.label?Wa(e.score):void 0]:[void 0,void 0]}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};Sse=I([m(1,fe),m(2,B),m(3,X),m(4,Xe),m(5,ot),m(6,Le),m(7,_n),m(8,Yt),m(9,_e)],Sse);var Ise=class{constructor(i,e,t,o,n,r,s,l,c){this.viewMode=i;this.resourceLabels=e;this._commandService=t;this._contextKeyService=o;this._contextMenuService=n;this._keybindingService=r;this._labelService=s;this._menuService=l;this._telemetryService=c}static{this.TEMPLATE_ID="history-item-change"}get templateId(){return Ise.TEMPLATE_ID}renderTemplate(i){let e=i.parentElement,t=D(i,_(".history-item-change")),o=D(t,_(".graph-placeholder")),n=D(t,_(".label-container")),r=this.resourceLabels.create(n,{supportDescriptionHighlights:!0,supportHighlights:!0}),s=new O,l=D(r.element,_(".actions")),c=new dl(l,void 0,this._menuService,this._contextKeyService,this._contextMenuService,this._keybindingService,this._commandService,this._telemetryService);return s.add(c),{rowElement:e,element:t,graphPlaceholder:o,resourceLabel:r,actionBar:c,disposables:s}}renderElement(i,e,t,o){let n=r6(i.element)?i.element.historyItemViewModel:i.element.context.historyItemViewModel,r=r6(i.element)?i.element.historyItemChange:i.element,s=r6(i.element)?i.element.graphColumns:i.element.context.historyItemViewModel.outputSwimlanes;this._renderGraphPlaceholder(t,n,s);let l=this.viewMode()==="tree",c=r6(i.element)?0:1;if(t.resourceLabel.setFile(r.uri,{fileDecorations:{colors:!1,badges:!0},fileKind:c,hidePath:l}),c===0){let u=this._menuService.getMenuActions(R.SCMHistoryItemChangeContext,this._contextKeyService,{arg:n.historyItem,shouldForwardArgs:!0});t.actionBar.context=r,t.actionBar.setActions(xl(u,"inline").primary)}else t.actionBar.context=void 0,t.actionBar.setActions([])}renderCompressedElements(i,e,t,o){let n=i.element,r=n.elements[0].context.historyItemViewModel,s=n.elements[0].context.historyItemViewModel.outputSwimlanes;this._renderGraphPlaceholder(t,r,s);let l=n.elements.map(u=>u.name),c=n.elements[n.elements.length-1];t.resourceLabel.setResource({resource:c.uri,name:l},{fileDecorations:{colors:!1,badges:!0},fileKind:1,separator:this._labelService.getSeparator(c.uri.scheme)}),t.actionBar.context=void 0,t.actionBar.setActions([])}_renderGraphPlaceholder(i,e,t){let o=ng*(t.length+1),n=o-16;i.rowElement.style.marginLeft=`${n}px`,i.graphPlaceholder.textContent="",i.graphPlaceholder.style.left=`${-1*n}px`,i.graphPlaceholder.style.width=`${o}px`,i.graphPlaceholder.appendChild(Cwi(t,Uuo(e)))}disposeTemplate(i){i.disposables.dispose()}};Ise=I([m(2,fe),m(3,X),m(4,Xe),m(5,Le),m(6,nt),m(7,Yt),m(8,_e)],Ise);var yse=class{constructor(i,e,t){this._isLoadingMore=i;this._loadMoreCallback=e;this._configurationService=t}static{this.TEMPLATE_ID="historyItemLoadMore"}get templateId(){return yse.TEMPLATE_ID}renderTemplate(i){let e=D(i,_(".history-item-load-more")),t=D(e,_(".graph-placeholder")),o=D(e,_(".history-item-placeholder")),n=new ld(o,{supportIcons:!0});return{element:e,graphPlaceholder:t,historyItemPlaceholderContainer:o,historyItemPlaceholderLabel:n,elementDisposables:new O,disposables:n}}renderElement(i,e,t){t.graphPlaceholder.textContent="",t.graphPlaceholder.style.width=`${ng*(i.element.graphColumns.length+1)}px`,t.graphPlaceholder.appendChild(Cwi(i.element.graphColumns));let o=this._configurationService.getValue("scm.graph.pageOnScroll")===!0;t.historyItemPlaceholderContainer.classList.toggle("shimmer",o),o?(t.historyItemPlaceholderLabel.setLabel(""),this._loadMoreCallback()):t.elementDisposables.add(ve(n=>{let s=`$(${this._isLoadingMore.read(n)?"loading~spin":"fold-down"})`;t.historyItemPlaceholderLabel.setLabel(d(14946,null,s))}))}renderCompressedElements(i,e,t){throw new Error("Should never happen since node is incompressible")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.disposables.dispose()}};yse=I([m(2,B)],yse);var Rut=class extends cs{constructor(e){super();this._progressService=e}runAction(e,t){return this._progressService.withProgress({location:mN},async()=>await super.runAction(e,t))}};Rut=I([m(0,Go)],Rut);var $1i=class{getWidgetAriaLabel(){return d(14953,null)}getAriaLabel(i){if(ou(i))return`${i.provider.name} ${i.provider.label}`;if(mO(i)){let e=i.historyItemViewModel.historyItem;return`${Du(e.message).trim()}${e.author?`, ${e.author}`:""}`}else return""}},j1i=class{getId(i){if(ou(i))return`repo:${i.provider.id}`;if(mO(i)){let e=i.repository.provider,t=i.historyItemViewModel.historyItem;return`historyItem:${e.id}/${t.id}/${t.parentIds.join(",")}`}else if(r6(i)){let e=i.repository.provider,t=i.historyItemViewModel.historyItem;return`historyItemChange:${e.id}/${t.id}/${t.parentIds.join(",")}/${i.historyItemChange.uri.fsPath}`}else if(TFe(i)){let e=i.context.repository.provider,t=i.context.historyItemViewModel.historyItem;return`historyItemChangeFolder:${e.id}/${t.id}/${t.parentIds.join(",")}/${i.uri.fsPath}`}else{if(EFe(i))return`historyItemLoadMore:${i.repository.provider.id}`;throw new Error("Invalid tree element")}}},Q1i=class{getKeyboardNavigationLabel(i){if(!ou(i)){if(mO(i))return[i.historyItemViewModel.historyItem.message,i.historyItemViewModel.historyItem.author];if(EFe(i))return"";throw new Error("Invalid tree element")}}getCompressedNodeKeyboardNavigationLabel(i){return i.map(t=>t.name).join("/")}},Y1i=class{isIncompressible(i){return Fm.isResourceNode(i)?i.childrenCount===0||!i.parent||!i.parent.parent:!0}},X1i=class extends k{constructor(e){super();this.viewMode=e}async getChildren(e){let t=[];if(e instanceof PSe){let o=await e.getHistoryItems();t.push(...o);let n=e.repository.get(),r=o.at(-1);n&&r&&r.historyItemViewModel.outputSwimlanes.length>0&&t.push({repository:n,graphColumns:r.historyItemViewModel.outputSwimlanes,type:"historyItemLoadMore"})}else if(mO(e)){let o=e.repository.provider.historyProvider.get(),n=e.historyItemViewModel,r=n.historyItem,s,l;if(n.kind==="incoming-changes"||n.kind==="outgoing-changes"){let u=o?.historyItemRef.get(),p=o?.historyItemRemoteRef.get();if(!o||!u||!p)return[];s=n.kind==="incoming-changes"?p.id:u.id,l=await o.resolveHistoryItemRefsCommonAncestor([u.name,p.name])}else if(s=r.id,r.parentIds.length>0)if(r.parentIds[0]===rW){let u=o?.historyItemRef.get(),p=o?.historyItemRemoteRef.get();if(!o||!u||!p)return[];l=await o.resolveHistoryItemRefsCommonAncestor([u.name,p.name])}else l=r.parentIds[0];let c=await o?.provideHistoryItemChanges(s,l)??[];if(this.viewMode()==="list")t.push(...c.map(u=>({repository:e.repository,historyItemViewModel:e.historyItemViewModel,historyItemChange:u,graphColumns:e.historyItemViewModel.outputSwimlanes,type:"historyItemChangeViewModel"})));else if(this.viewMode()==="tree"){let u=e.repository.provider.rootUri??A.file("/"),p=new Fm(e,u);for(let h of c)p.add(h.uri,{repository:e.repository,historyItemViewModel:e.historyItemViewModel,historyItemChange:h,graphColumns:e.historyItemViewModel.outputSwimlanes,type:"historyItemChangeViewModel"});for(let h of p.root.children)t.push(h.element??h)}}else if(Fm.isResourceNode(e)&&TFe(e))for(let o of e.children)t.push(o.element&&o.childrenCount===0?o.element:o);return t}hasChildren(e){return e instanceof PSe||mO(e)||TFe(e)&&e.childrenCount>0}},J1i=class{getDragURI(i){let e=this._getTreeElementUri(i);return e?e.toString():null}onDragStart(i,e){if(!e.dataTransfer)return;let t=this._getDragAndDropData(i);t.length!==0&&e.dataTransfer.setData(Mc.SCM_HISTORY_ITEM,JSON.stringify(t))}getDragLabel(i,e){if(i.length===1){let t=i[0];return this._getTreeElementLabel(t)}return String(i.length)}onDragOver(i,e,t,o,n){return!1}drop(i,e,t,o,n){}_getDragAndDropData(i){let e=[];for(let t of[...i.context??[],...i.elements]){if(!mO(t))continue;let o=t.repository.provider,n=t.historyItemViewModel.historyItem,r=`$(${L.repo.id})\xA0${o.name}\xA0$(${L.gitCommit.id})\xA0${n.displayId??n.id}`,s=n.parentIds.length>0?n.parentIds[0]:void 0;e.push({name:r,resource:Zx.getMultiDiffSourceUri(o,n.id,s,n.displayId),historyItem:n})}return e}_getTreeElementLabel(i){if(mO(i)){let e=i.historyItemViewModel.historyItem;return e.displayId??e.id}}_getTreeElementUri(i){if(mO(i)){let e=i.repository.provider,t=i.historyItemViewModel.historyItem,o=t.parentIds.length>0?t.parentIds[0]:void 0;return Zx.getMultiDiffSourceUri(e,t.id,o,t.displayId)}}dispose(){}},PSe=class extends k{constructor(e,t,o,n,r,s){super();this._configurationService=e;this._contextKeyService=t;this._extensionService=o;this._scmService=n;this._scmViewService=r;this._storageService=s;this._selectedRepository=De(this,"auto");this.onDidChangeHistoryItemsFilter=zc(this);this.isViewModelEmpty=De(this,!1);this._repositoryState=new Map;this._repositoryFilterState=new Map;this._repositoryFilterState=this._loadHistoryItemsFilterState(),this.viewMode=De(this,this._getViewMode()),this._extensionService.onWillStop(this._saveHistoryItemsFilterState,this,this._store),this._storageService.onWillSaveState(this._saveHistoryItemsFilterState,this,this._store),this._scmHistoryItemCountCtx=Jc.SCMHistoryItemCount.bindTo(this._contextKeyService),this._scmHistoryViewModeCtx=Jc.SCMHistoryViewMode.bindTo(this._contextKeyService),this._scmHistoryViewModeCtx.set(this.viewMode.get());let l=this._scmService.repositoryCount>0?Fo(yt.first(this._scmService.repositories)):vi(this,U.once(this._scmService.onDidAddRepository),p=>p),c=ke(p=>{let h=this._selectedRepository.read(p);return h!=="auto"?h:this._scmViewService.activeRepository.read(p)?.repository});this.repository=E4e(this,[l,c]);let u=vi(this,this._scmService.onDidRemoveRepository,p=>p);this._register(ve(p=>{let h=u.read(p);h&&(this.repository.read(void 0)===h&&this._selectedRepository.set(yt.first(this._scmService.repositories)??"auto",void 0),this._repositoryState.delete(h))}))}clearRepositoryState(){let e=this.repository.get();e&&this._repositoryState.delete(e)}getHistoryItemsFilter(){let e=this.repository.get();if(!e)return;let t=this._repositoryFilterState.get(l6(e.provider))??"auto";return t==="all"||t==="auto"?t:this._repositoryState.get(e)?.historyItemsFilter}getCurrentHistoryItemTreeElement(){let e=this.repository.get();if(!e)return;let t=this._repositoryState.get(e);if(!t)return;let n=e?.provider.historyProvider.get()?.historyItemRef.get();return t.viewModels.find(r=>r.historyItemViewModel.historyItem.id===n?.revision)}loadMore(e){let t=this.repository.get();if(!t)return;let o=this._repositoryState.get(t);o&&this._repositoryState.set(t,{...o,loadMore:e??!0})}async getHistoryItems(){let e=this.repository.get(),t=e?.provider.historyProvider.get(),o=t?.historyItemRef.get(),n=t?.historyItemRemoteRef.get();if(!e||!t)return this._scmHistoryItemCountCtx.set(0),this.isViewModelEmpty.set(!0,void 0),[];let r=this._repositoryState.get(e);if(!r||r.loadMore!==!1){let s=r?.viewModels.filter(b=>b.historyItemViewModel.kind!=="incoming-changes"&&b.historyItemViewModel.kind!=="outgoing-changes").map(b=>b.historyItemViewModel.historyItem)??[],l=r?.historyItemsFilter??await this._resolveHistoryItemFilter(e,t),c=jn(this._configurationService.getValue("scm.graph.pageSize"),1,1e3),u=l.map(b=>b.revision??b.id);do s.push(...await t.provideHistoryItems({historyItemRefs:u,limit:c,skip:s.length})??[]);while(typeof r?.loadMore=="string"&&!s.find(b=>b.id===r?.loadMore));let p=o&&n&&r?.mergeBase===void 0?await t.resolveHistoryItemRefsCommonAncestor([o.name,n.name]):r?.mergeBase,h=this._getGraphColorMap(l),g=this._scmViewService.graphShowIncomingChangesConfig.get()&&l.some(b=>b.id===n?.id),f=this._scmViewService.graphShowOutgoingChangesConfig.get()&&l.some(b=>b.id===o?.id),v=Huo(s,h,t.historyItemRef.get(),t.historyItemRemoteRef.get(),t.historyItemBaseRef.get(),g,f,p).map(b=>({repository:e,historyItemViewModel:b,type:"historyItemViewModel"}));r={historyItemsFilter:l,viewModels:v,mergeBase:p,loadMore:!1},this._repositoryState.set(e,r),this._scmHistoryItemCountCtx.set(v.length),this.isViewModelEmpty.set(v.length===0,void 0)}return r.viewModels}setRepository(e){this._selectedRepository.set(e,void 0)}setHistoryItemsFilter(e){let t=this.repository.get();t&&(e!=="auto"?this._repositoryFilterState.set(l6(t.provider),e):this._repositoryFilterState.delete(l6(t.provider)),this._saveHistoryItemsFilterState(),this.onDidChangeHistoryItemsFilter.trigger(void 0))}setViewMode(e){e!==this.viewMode.get()&&(this.viewMode.set(e,void 0),this._scmHistoryViewModeCtx.set(e),this._storageService.store("scm.graphView.viewMode",e,1,0))}_getViewMode(){let e=this._configurationService.getValue("scm.defaultViewMode")==="list"?"list":"tree",t=this._storageService.get("scm.graphView.viewMode",1);return typeof t=="string"&&(e=t),e}_getGraphColorMap(e){let o=this.repository.get()?.provider.historyProvider.get(),n=o?.historyItemRef.get(),r=o?.historyItemRemoteRef.get(),s=o?.historyItemBaseRef.get(),l=new Map;n&&(l.set(n.id,n.color),r&&l.set(r.id,r.color),s&&l.set(s.id,s.color));for(let c of e)l.has(c.id)||l.set(c.id,void 0);return l}async _resolveHistoryItemFilter(e,t){let o=[],n=this._repositoryFilterState.get(l6(e.provider))??"auto";switch(n){case"all":o.push(...await t.provideHistoryItemRefs()??[]);break;case"auto":o.push(...[t.historyItemRef.get(),t.historyItemRemoteRef.get(),t.historyItemBaseRef.get()].filter(r=>!!r));break;default:{let r=(await t.provideHistoryItemRefs(n)??[]).filter(s=>n.some(l=>l===s.id));r.length===0?(o.push(...[t.historyItemRef.get(),t.historyItemRemoteRef.get(),t.historyItemBaseRef.get()].filter(s=>!!s)),this._repositoryFilterState.delete(l6(e.provider))):(o.push(...r),this._repositoryFilterState.set(l6(e.provider),r.map(s=>s.id))),this._saveHistoryItemsFilterState();break}}return o}_loadHistoryItemsFilterState(){try{let e=this._storageService.get("scm.graphView.referencesFilter",1);if(e)return new Map(JSON.parse(e))}catch{}return new Map}_saveHistoryItemsFilterState(){let e=Array.from(this._repositoryFilterState.entries());this._storageService.store("scm.graphView.referencesFilter",JSON.stringify(e),1,0)}dispose(){this._repositoryState.clear(),super.dispose()}};PSe=I([m(0,B),m(1,X),m(2,lt),m(3,lc),m(4,Au),m(5,de)],PSe);var Lut=class{constructor(i,e){this._quickInputService=i;this._scmViewService=e;this._autoQuickPickItem={label:d(14941,null),description:d(14938,null),repository:"auto"}}async pickRepository(){let i=[this._autoQuickPickItem,{type:"separator"}];return i.push(...this._scmViewService.repositories.map(e=>({label:e.provider.name,description:e.provider.rootUri?.fsPath,iconClass:q.isThemeIcon(e.provider.iconPath)?q.asClassName(e.provider.iconPath):q.asClassName(L.repo),repository:e}))),this._quickInputService.pick(i,{placeHolder:d(14955,null)})}};Lut=I([m(0,$e),m(1,Au)],Lut);var Mut=class extends k{constructor(e,t,o){super();this._historyProvider=e;this._historyItemsFilter=t;this._quickInputService=o;this._allQuickPickItem={id:"all",label:d(14939,null),description:d(14940,null),historyItemRef:"all"};this._autoQuickPickItem={id:"auto",label:d(14941,null),description:d(14942,null),historyItemRef:"auto"}}async pickHistoryItemRef(){let e=this._quickInputService.createQuickPick({useSeparators:!0});this._store.add(e),e.placeholder=d(14954,null),e.canSelectMany=!0,e.hideCheckAll=!0,e.busy=!0,e.show();let t=await this._createQuickPickItems(),o=[];if(this._historyItemsFilter==="all")o.push(this._allQuickPickItem);else if(this._historyItemsFilter==="auto")o.push(this._autoQuickPickItem);else{let n=0;for(;n<t.length;){if(t[n].type==="separator"){n++;continue}if(this._historyItemsFilter.some(r=>r.id===t[n].id)){let r=t.splice(n,1);o.push(...r)}else n++}t.splice(2,0,{type:"separator"},...o)}return e.items=t,e.selectedItems=o,e.busy=!1,new Promise(n=>{this._store.add(e.onDidChangeSelection(r=>{let{added:s}=dA(o,r,(l,c)=>oc(l.id??"",c.id??""));s.length>0&&(s[0].historyItemRef==="all"||s[0].historyItemRef==="auto"?e.selectedItems=[s[0]]:e.selectedItems=[...e.selectedItems.filter(l=>l.historyItemRef!=="all"&&l.historyItemRef!=="auto")]),o=[...e.selectedItems]})),this._store.add(e.onDidAccept(()=>{o.length===0?n(void 0):o.length===1&&o[0].historyItemRef==="all"?n("all"):o.length===1&&o[0].historyItemRef==="auto"?n("auto"):n(o.map(r=>r.historyItemRef.id)),e.hide()})),this._store.add(e.onDidHide(()=>{n(void 0),this.dispose()}))})}async _createQuickPickItems(){let e=[this._allQuickPickItem,this._autoQuickPickItem],t=await this._historyProvider.provideHistoryItemRefs()??[],o=Lf(t,(n,r)=>oc(n.category??"",r.category??""));for(let n of o)n.length!==0&&(e.push({type:"separator",label:n[0].category}),e.push(...n.map(r=>({id:r.id,label:r.name,description:r.description,iconClass:q.isThemeIcon(r.icon)?q.asClassName(r.icon):void 0,historyItemRef:r}))));return e}};Mut=I([m(2,$e)],Mut);var Xze=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super({...e,titleMenuId:R.SCMHistoryTitle,showActions:1},u,c,l,g,h,p,f,v,b);this._editorService=t;this._instantiationService=o;this._menuService=n;this._progressService=r;this._scmViewService=s;this._repositoryIsLoadingMore=De(this,!1);this._repositoryOutdated=De(this,!1);this._visibilityDisposables=new O;this._treeOperationSequencer=new Tm;this._treeLoadMoreSequencer=new Tm;this._refreshThrottler=new am;this._updateChildrenThrottler=new am;this._contextMenuDisposables=new ue;this._scmProviderCtx=Jc.SCMProvider.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefHasRemote=Jc.SCMCurrentHistoryItemRefHasRemote.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefHasBase=Jc.SCMCurrentHistoryItemRefHasBase.bindTo(this.scopedContextKeyService),this._scmCurrentHistoryItemRefInFilter=Jc.SCMCurrentHistoryItemRefInFilter.bindTo(this.scopedContextKeyService),this._actionRunner=this.instantiationService.createInstance(Rut),this._register(this._actionRunner),this._register(this._refreshThrottler),this._register(this._updateChildrenThrottler)}renderHeaderTitle(e){super.renderHeaderTitle(e,this.title);let t=st("div.scm-graph-view-badge-container",[st("div.scm-graph-view-badge.monaco-count-badge.long@badge")]);t.badge.textContent="Outdated",e.appendChild(t.root),this._register(ve(o=>{let n=this._repositoryOutdated.read(o);t.root.style.display=n?"":"none",n&&o.store.add(this.hoverService.setupDelayedHover(t.root,{appearance:{compact:!0,showPointer:!0},content:new he(d(14956,null,"$(refresh)"),{supportThemeIcons:!0}),position:{hoverPosition:2}}))}))}renderBody(e){super.renderBody(e),this._treeContainer=D(e,_(".scm-view.scm-history-view.show-file-icons")),this._treeContainer.classList.add("file-icon-themable-tree"),this._createTree(this._treeContainer),this.onDidChangeBodyVisibility(async t=>{if(!t){this._visibilityDisposables.clear();return}this._treeViewModel=this.instantiationService.createInstance(PSe),this._visibilityDisposables.add(this._treeViewModel);let o=ke(this,s=>this._treeViewModel.repository.read(s)?.provider.historyProvider.read(s)?.historyItemRef.read(s)!==void 0?!0:void 0);await yh(o),await this._progressService.withProgress({location:this.id},async()=>{await this._treeOperationSequencer.queue(async()=>{await this._tree.setInput(this._treeViewModel),this._tree.scrollTop=0})}),this._visibilityDisposables.add(ve(s=>{this._treeViewModel.isViewModelEmpty.read(s),this._onDidChangeViewWelcomeState.fire()})),this._visibilityDisposables.add(Zs(this._scmViewService.graphShowIncomingChangesConfig,async()=>{await this.refresh()})),this._visibilityDisposables.add(Zs(this._scmViewService.graphShowOutgoingChangesConfig,async()=>{await this.refresh()}));let n=!0;this._visibilityDisposables.add(ve(s=>{let l=this._treeViewModel.repository.read(s),c=l?.provider.historyProvider.read(s);if(!l||!c)return;let u=ke(p=>c.historyItemRef.read(p)?.id);s.store.add(Zs(u,async p=>{await this.refresh(),this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(p))})),s.store.add(Zs(c.historyItemRefChanges,p=>{if(p.silent){if(this._tree.scrollTop===0){this.refresh();return}this._repositoryOutdated.set(!0,void 0);return}this.refresh()})),s.store.add(Zs(this._treeViewModel.onDidChangeHistoryItemsFilter,async()=>{await this.refresh(),this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(u.read(void 0)))})),s.store.add(ve(p=>{this._scmCurrentHistoryItemRefHasRemote.set(!!c.historyItemRemoteRef.read(p))})),s.store.add(ve(p=>{this._scmCurrentHistoryItemRefHasBase.set(!!c.historyItemBaseRef.read(p))})),s.store.add(Zs(this._treeViewModel.viewMode,async()=>{await this._updateChildren()})),this._scmProviderCtx.set(l.provider.providerId),this._scmCurrentHistoryItemRefInFilter.set(this._isCurrentHistoryItemInFilter(u.read(void 0))),n||this.refresh(),n=!1}));let r=vi(this.themeService.onDidFileIconThemeChange,()=>this.themeService.getFileIconTheme());this._visibilityDisposables.add(ve(s=>{let l=r.read(s),c=this._treeViewModel.viewMode.read(s);this._updateIndentStyles(l,c)}))},this,this._store)}layoutBody(e,t){super.layoutBody(e,t),this._tree.layout(e,t)}getActionRunner(){return this._actionRunner}getActionsContext(){return this._treeViewModel?.repository.get()?.provider}createActionViewItem(e,t){if(e.id===VNo){let o=this._treeViewModel?.repository.get();if(o)return new K1i(o,e,t)}else if(e.id===BNo){let o=this._treeViewModel?.repository.get(),n=this._treeViewModel?.getHistoryItemsFilter();if(o&&n)return new G1i(o,n,e,t)}return super.createActionViewItem(e,t)}focus(){super.focus();let e=new KeyboardEvent("keydown");this._tree.focusFirst(e),this._tree.domFocus()}shouldShowWelcome(){return this._treeViewModel?.isViewModelEmpty.get()===!0}async refresh(){return this._refreshThrottler.queue(e=>this._refresh(e))}async _refresh(e){e.isCancellationRequested||(this._treeViewModel.clearRepositoryState(),await this._updateChildren(),!e.isCancellationRequested&&(this.updateActions(),this._repositoryOutdated.set(!1,void 0),this._tree.scrollTop=0))}async pickRepository(){let t=await this._instantiationService.createInstance(Lut).pickRepository();t&&this._treeViewModel.setRepository(t.repository)}async pickHistoryItemRef(){let t=this._treeViewModel.repository.get()?.provider.historyProvider.get(),o=this._treeViewModel.getHistoryItemsFilter();if(!t||!o)return;let r=await this._instantiationService.createInstance(Mut,t,o).pickHistoryItemRef();r&&this._treeViewModel.setHistoryItemsFilter(r)}async revealCurrentHistoryItem(){let e=this._treeViewModel.repository.get(),o=e?.provider.historyProvider.get()?.historyItemRef.get();if(!e||!o?.id||!o?.revision||!this._isCurrentHistoryItemInFilter(o.id))return;let n=()=>{let r=this._treeViewModel.getCurrentHistoryItemTreeElement();return r&&this._tree.hasNode(r)?(this._tree.reveal(r,.5),this._tree.setSelection([r]),this._tree.setFocus([r]),!0):!1};n()||(await this._loadMore(o.revision),n())}setViewMode(e){this._treeViewModel.setViewMode(e)}_createTree(e){this._treeIdentityProvider=new j1i;let t=this.instantiationService.createInstance(jl,{onDidChangeVisibility:this.onDidChangeBodyVisibility});this._register(t),this._treeDataSource=this.instantiationService.createInstance(X1i,()=>this._treeViewModel.viewMode.get()),this._register(this._treeDataSource);let o=hr("scm.compactFolders",!0,this.configurationService);this._tree=this.instantiationService.createInstance(qy,"SCM History Tree",e,new q1i,new Y1i,[this.instantiationService.createInstance(Sse,this.viewDescriptorService.getViewLocationById(this.id)),this.instantiationService.createInstance(Ise,()=>this._treeViewModel.viewMode.get(),t),this.instantiationService.createInstance(yse,this._repositoryIsLoadingMore,()=>this._loadMore())],this._treeDataSource,{accessibilityProvider:new $1i,identityProvider:this._treeIdentityProvider,collapseByDefault:n=>!TFe(n),compressionEnabled:o.get(),dnd:new J1i,keyboardNavigationLabelProvider:new Q1i,horizontalScrolling:!1,multipleSelectionSupport:!1,twistieAdditionalCssClass:n=>mO(n)||EFe(n)?"force-no-twistie":void 0}),this._register(this._tree),this._tree.onDidOpen(this._onDidOpen,this,this._store),this._tree.onContextMenu(this._onContextMenu,this,this._store)}_isCurrentHistoryItemInFilter(e){if(!e)return!1;let t=this._treeViewModel.getHistoryItemsFilter();return t==="all"||t==="auto"?!0:Array.isArray(t)&&!!t.find(o=>o.id===e)}async _onDidOpen(e){if(e.element)if(r6(e.element)){let t=e.element.historyItemChange,o=e.element.historyItemViewModel.historyItem,n=o.id===rW?d(14944,null):o.id===Nee?d(14949,null):o.displayId??o.id,r=o.parentIds.length>0?o.parentIds[0]:void 0,s=r&&o.displayId?r.substring(0,o.displayId.length):r;if(t.originalUri&&t.modifiedUri){let l=`${Jo(t.originalUri.fsPath)} (${s})`,c=`${Jo(t.modifiedUri.fsPath)} (${n})`,u=`${l} \u2194 ${c}`;await this._editorService.openEditor({label:u,original:{resource:t.originalUri},modified:{resource:t.modifiedUri},options:e.editorOptions})}else t.modifiedUri?await this._editorService.openEditor({label:`${Jo(t.modifiedUri.fsPath)} (${n})`,resource:t.modifiedUri,options:e.editorOptions}):t.originalUri&&await this._editorService.openEditor({label:`${Jo(t.originalUri.fsPath)} (${s})`,resource:t.originalUri,options:e.editorOptions})}else EFe(e.element)&&(this.configurationService.getValue("scm.graph.pageOnScroll")===!0||(this._loadMore(),this._tree.setSelection([])));else return}_onContextMenu(e){let t=e.element;if(mO(t)){if(t.historyItemViewModel.kind==="incoming-changes"||t.historyItemViewModel.kind==="outgoing-changes")return;this._contextMenuDisposables.value=new O;let n=t.repository.provider.historyProvider.get()?.historyItemRef.get(),r=t.historyItemViewModel.historyItem,s=be.getMenuItems(R.SCMHistoryItemRefContext).filter(u=>cT(u));if(s.length>0&&t.historyItemViewModel.historyItem.references?.length){let u=new Map;for(let p of t.historyItemViewModel.historyItem.references){let h=this.scopedContextKeyService.createOverlay([["scmHistoryItemRef",p.id]]),g=this._menuService.getMenuActions(R.SCMHistoryItemRefContext,h);for(let f of g.flatMap(v=>v[1]))u.has(f.id)||u.set(f.id,[]),u.get(f.id).push(p)}for(let p of s){let h=p.command.id;if(u.has(h)){this._contextMenuDisposables.value.add(be.appendMenuItem(R.SCMHistoryItemContext,{title:p.command.title,submenu:R.for(h),group:p?.group,order:p?.order}));for(let g of u.get(h)??[])this._contextMenuDisposables.value.add(W(class extends z{constructor(){super({id:`${h}.${g.id}`,title:g.name,menu:{id:R.for(h),group:g.category}})}run(f,...v){f.get(fe).executeCommand(h,...v,g.id)}}))}}}let l=this.scopedContextKeyService.createOverlay([["scmHistoryItemHasCurrentHistoryItemRef",r.references?.find(u=>u.id===n?.id)!==void 0]]),c=this._menuService.getMenuActions(R.SCMHistoryItemContext,l,{arg:t.repository.provider,shouldForwardArgs:!0}).filter(u=>u[0]!=="inline");this.contextMenuService.showContextMenu({contextKeyService:this.scopedContextKeyService,getAnchor:()=>e.anchor,getActions:()=>Lu(c),getActionsContext:()=>t.historyItemViewModel.historyItem})}else if(r6(t)){let o=this._menuService.getMenuActions(R.SCMHistoryItemChangeContext,this.scopedContextKeyService,{arg:t.historyItemViewModel.historyItem,shouldForwardArgs:!0}).filter(n=>n[0]!=="inline");this.contextMenuService.showContextMenu({contextKeyService:this.scopedContextKeyService,getAnchor:()=>e.anchor,getActions:()=>Lu(o),getActionsContext:()=>t.historyItemChange})}}async _loadMore(e){return this._treeLoadMoreSequencer.queue(async()=>{this._repositoryIsLoadingMore.get()||(this._repositoryIsLoadingMore.set(!0,void 0),this._treeViewModel.loadMore(e),await this._updateChildren(),this._repositoryIsLoadingMore.set(!1,void 0))})}_updateChildren(){return this._updateChildrenThrottler.queue(()=>this._treeOperationSequencer.queue(async()=>{await this._progressService.withProgress({location:this.id,delay:100},async()=>{await this._tree.updateChildren(void 0,void 0,void 0,{})})}))}_updateIndentStyles(e,t){this._treeContainer.classList.toggle("list-view-mode",t==="list"),this._treeContainer.classList.toggle("tree-view-mode",t==="tree"),this._treeContainer.classList.toggle("align-icons-and-twisties",t==="list"&&e.hasFileIcons||e.hasFileIcons&&!e.hasFolderIcons),this._treeContainer.classList.toggle("hide-arrows",t==="tree"&&e.hidesExplorerArrows===!0)}dispose(){this._contextMenuDisposables.dispose(),this._visibilityDisposables.dispose(),super.dispose()}};Xze=I([m(1,ie),m(2,F),m(3,Yt),m(4,Go),m(5,Au),m(6,B),m(7,Xe),m(8,Le),m(9,F),m(10,ji),m(11,X),m(12,Je),m(13,Pe),m(14,ot)],Xze);var A6t=class{constructor(){this.name="scm";this.type="help";this.priority=100;this.when=C.or(C.and(C.equals("activeViewlet","workbench.view.scm"),xH),C.equals(rc.key,YAt),C.equals(rc.key,wv),C.equals(rc.key,mN))}getProvider(i){let e=i.get(fe),t=i.get(Au),o=i.get(Gt);return new Put(e,t,o)}},Put=class extends k{constructor(e,t,o){super();this._commandService=e;this._scmViewService=t;this._viewsService=o;this.id="scm";this.verbositySettingKey="accessibility.verbosity.sourceControl";this.options={type:"help"};this._focusedView=this._viewsService.getFocusedViewName()}onClose(){switch(this._focusedView){case"Source Control":this._commandService.executeCommand("workbench.scm");break;case"Source Control Repositories":this._commandService.executeCommand("workbench.scm.repositories");break;case"Source Control Graph":this._commandService.executeCommand("workbench.scm.history");break;default:this._commandService.executeCommand("workbench.view.scm")}}provideContent(){let e=[];if(this._scmViewService.visibleRepositories.length>1){let o=this._scmViewService.visibleRepositories.map(n=>n.provider.name).join(", ");e.push(d(14912,null,o))}let t=this._scmViewService.focusedRepository;if(t){e.push(d(14913,null,t.provider.name));let o=t.provider.historyProvider.get()?.historyItemRef.get();o&&e.push(d(14914,null,o.name)),t.input.visible&&t.input.enabled&&t.input.value!==""&&e.push(d(14915,null,t.input.value));let n=t.provider.actionButton.get();if(n){let s=n.command.tooltip??n.command.title,l=n.enabled?d(14895,null):d(14894,null);e.push(d(14916,null,s,l))}let r=[];for(let s of t.provider.groups)r.push(`${s.label} (${s.resources.length} resource(s))`);t.provider.groups.map(s=>s.label).join(", "),e.push(d(14917,null,r.join(", ")))}return e.push(d(14906,null)),e.push(d(14907,null)),e.push(d(14908,null)),e.push(d(14909,null)),e.push(d(14910,null)),e.push(d(14911,null)),e.push(d(14901,null)),e.push(d(14902,null)),e.push(d(14903,null)),e.push(d(14904,null)),e.push(d(14905,null)),e.push(d(14896,null)),e.push(d(14897,null)),e.push(d(14898,null)),e.push(d(14899,null)),e.push(d(14900,null)),e.join(`
`)}};Put=I([m(0,fe),m(1,Au),m(2,Gt)],Put);CA.registerLanguage({id:"scminput",extensions:[],aliases:[],mimetypes:["text/x-scm-input"]});var F6t=Oe("source-control-view-icon",L.sourceControl,d(14893,null)),N6t=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:Jpe,title:P(14889,"Source Control"),ctorDescriptor:new Vt(Kze),storageId:"workbench.scm.views.state",icon:F6t,alwaysUseContainerInfo:!0,order:2,hideIfEmpty:!0},0,{doNotRegisterOpenCommand:!0}),ASe=oe.as(Kn.ViewsRegistry),O6t=d(14892,null);ASe.registerViewWelcomeContent(wv,{content:d(14823,null),when:"default"});ASe.registerViewWelcomeContent(wv,{content:d(14824,null),when:C.and(C.equals("scm.providerCount",0),Z$.IsEnabled,Z$.IsTrusted.toNegated())});ASe.registerViewWelcomeContent(wv,{content:`[${d(14820,null)}](command:${ej})`,when:C.and(C.equals("scm.providerCount",0),Z$.IsEnabled,Z$.IsTrusted.toNegated())});ASe.registerViewWelcomeContent(mN,{content:d(14822,null),when:Jc.SCMHistoryItemCount.isEqualTo(0)});ASe.registerViews([{id:YAt,containerTitle:O6t,name:P(14886,"Repositories"),singleViewPaneContainerTitle:d(14891,null),ctorDescriptor:new Vt(Yze),canToggleVisibility:!0,hideByDefault:!0,canMoveView:!0,weight:20,order:0,when:C.and(C.has("scm.providerCount"),C.notEquals("scm.providerCount",0)),containerIcon:F6t}],N6t);ASe.registerViews([{id:wv,containerTitle:O6t,name:P(14882,"Changes"),singleViewPaneContainerTitle:O6t,ctorDescriptor:new Vt(Qze),canToggleVisibility:!0,canMoveView:!0,weight:40,order:1,containerIcon:F6t,openCommandActionDescriptor:{id:N6t.id,mnemonicTitle:d(14821,null),keybindings:{primary:0,win:{primary:3109},linux:{primary:3109},mac:{primary:1317}},order:2}}],N6t);ASe.registerViews([{id:mN,containerTitle:O6t,name:P(14885,"Graph"),singleViewPaneContainerTitle:d(14890,null),ctorDescriptor:new Vt(Xze),canToggleVisibility:!0,canMoveView:!0,weight:40,order:2,when:C.and(C.has("scm.historyProviderCount"),C.notEquals("scm.historyProviderCount",0)),containerIcon:F6t}],N6t);oe.as(Zi.Workbench).registerWorkbenchContribution(Uze,3);oe.as(Zi.Workbench).registerWorkbenchContribution(zze,3);bt(MSe.ID,MSe,vt.AfterRestored);bt(she.ID,she,vt.AfterRestored);oe.as($t.Configuration).registerConfiguration({id:"scm",order:5,title:d(14883,null),type:"object",scope:5,properties:{"scm.diffDecorations":{type:"string",enum:["all","gutter","overview","minimap","none"],enumDescriptions:[d(14844,null),d(14845,null),d(14848,null),d(14846,null),d(14847,null)],default:"all",description:d(14810,null)},"scm.diffDecorationsGutterWidth":{type:"number",enum:[1,2,3,4,5],default:3,description:d(14815,null)},"scm.diffDecorationsGutterVisibility":{type:"string",enum:["always","hover"],enumDescriptions:[d(14853,null),d(14854,null)],description:d(14852,null),default:"always"},"scm.diffDecorationsGutterAction":{type:"string",enum:["diff","none"],enumDescriptions:[d(14850,null),d(14851,null)],description:d(14849,null),default:"diff"},"scm.diffDecorationsGutterPattern":{type:"object",description:d(14812,null),additionalProperties:!1,properties:{added:{type:"boolean",description:d(14813,null)},modified:{type:"boolean",description:d(14814,null)}},default:{added:!1,modified:!0}},"scm.diffDecorationsIgnoreTrimWhitespace":{type:"string",enum:["true","false","inherit"],enumDescriptions:[d(14857,null),d(14855,null),d(14856,null)],description:d(14811,null),default:"false"},"scm.alwaysShowActions":{type:"boolean",description:d(14807,null),default:!1},"scm.countBadge":{type:"string",enum:["all","focused","off"],enumDescriptions:[d(14834,null),d(14835,null),d(14836,null)],description:d(14833,null),default:"all"},"scm.providerCountBadge":{type:"string",enum:["hidden","auto","visible"],enumDescriptions:[d(14867,null),d(14866,null),d(14868,null)],markdownDescription:d(14865,null,"`#scm.alwaysShowRepositories#`"),default:"hidden"},"scm.defaultViewMode":{type:"string",enum:["tree","list"],enumDescriptions:[d(14839,null),d(14838,null)],description:d(14837,null),default:"list"},"scm.defaultViewSortKey":{type:"string",enum:["name","path","status"],enumDescriptions:[d(14841,null),d(14842,null),d(14843,null)],description:d(14840,null),default:"path"},"scm.autoReveal":{type:"boolean",description:d(14809,null),default:!0},"scm.inputFontFamily":{type:"string",markdownDescription:d(14816,null),default:"default"},"scm.inputFontSize":{type:"number",markdownDescription:d(14817,null),default:13},"scm.inputMaxLineCount":{type:"number",markdownDescription:d(14818,null),minimum:1,maximum:50,default:10},"scm.inputMinLineCount":{type:"number",markdownDescription:d(14819,null),minimum:1,maximum:50,default:1},"scm.alwaysShowRepositories":{type:"boolean",markdownDescription:d(14808,null),default:!1},"scm.repositories.sortOrder":{type:"string",enum:["discovery time","name","path"],enumDescriptions:[d(14873,null),d(14874,null),d(14875,null)],description:d(14828,null),default:"discovery time"},"scm.repositories.visible":{type:"number",description:d(14827,null),default:10},"scm.repositories.selectionMode":{type:"string",enum:["multiple","single"],enumDescriptions:[d(14871,null),d(14872,null)],description:d(14870,null),default:"multiple"},"scm.repositories.explorer":{type:"boolean",markdownDescription:d(14869,null,"`#scm.repositories.selectionMode#`","single"),default:!1,tags:["experimental"]},"scm.showActionButton":{type:"boolean",markdownDescription:d(14887,null),default:!0},"scm.showInputActionButton":{type:"boolean",markdownDescription:d(14888,null),default:!0},"scm.workingSets.enabled":{type:"boolean",description:d(14879,null),default:!1},"scm.workingSets.default":{type:"string",enum:["empty","current"],enumDescriptions:[d(14878,null),d(14877,null)],description:d(14876,null),default:"current"},"scm.compactFolders":{type:"boolean",description:d(14832,null),default:!0},"scm.graph.pageOnScroll":{type:"boolean",description:d(14861,null),default:!0},"scm.graph.pageSize":{type:"number",description:d(14862,null),minimum:1,maximum:1e3,default:50},"scm.graph.badges":{type:"string",enum:["all","filter"],enumDescriptions:[d(14859,null),d(14860,null)],description:d(14858,null),default:"filter"},"scm.graph.showIncomingChanges":{type:"boolean",description:d(14863,null),default:!0},"scm.graph.showOutgoingChanges":{type:"boolean",description:d(14864,null),default:!0}}});xt.registerCommandAndKeybindingRule({id:"scm.acceptInput",metadata:{description:d(14829,null),args:[]},weight:200,when:C.has("scmRepository"),primary:2051,handler:a=>{let t=a.get(X).getContext(Un()).getValue("scmRepository");if(!t)return Promise.resolve(null);let n=a.get(lc).getRepository(t);if(!n?.provider.acceptInputCommand)return Promise.resolve(null);let r=n.provider.acceptInputCommand.id,s=n.provider.acceptInputCommand.arguments;return a.get(fe).executeCommand(r,...s||[])}});xt.registerCommandAndKeybindingRule({id:"scm.clearValidation",weight:200,when:C.and(C.has("scmRepository"),D6t.SCMInputHasValidationMessage),primary:9,handler:async a=>{a.get(Au).activeRepository.get()?.repository.input.clearValidation()}});xt.registerCommandAndKeybindingRule({id:"scm.clearInput",weight:200,when:C.and(C.has("scmRepository"),ar.Visible.toNegated(),Za.inlineSuggestionVisible.toNegated(),D6t.SCMInputHasValidationMessage.toNegated(),me.hasNonEmptySelection.toNegated()),primary:9,handler:async a=>{let i=a.get(lc),o=a.get(X).getContext(Un()).getValue("scmRepository");(o?i.getRepository(o):void 0)?.input.setValue("",!0)}});var HNo={description:{description:d(14830,null),args:[]},weight:200,handler:a=>{let i=a.get(X),e=a.get(lc),o=i.getContext(Un()).getValue("scmRepository");(o?e.getRepository(o):void 0)?.input.showNextHistoryValue()}},UNo={description:{description:d(14831,null),args:[]},weight:200,handler:a=>{let i=a.get(X),e=a.get(lc),o=i.getContext(Un()).getValue("scmRepository");(o?e.getRepository(o):void 0)?.input.showPreviousHistoryValue()}};xt.registerCommandAndKeybindingRule({...HNo,id:"scm.viewNextCommit",when:C.and(C.has("scmRepository"),C.has("scmInputIsInLastPosition"),ar.Visible.toNegated()),primary:18});xt.registerCommandAndKeybindingRule({...UNo,id:"scm.viewPreviousCommit",when:C.and(C.has("scmRepository"),C.has("scmInputIsInFirstPosition"),ar.Visible.toNegated()),primary:16});xt.registerCommandAndKeybindingRule({...HNo,id:"scm.forceViewNextCommit",when:C.has("scmRepository"),primary:530});xt.registerCommandAndKeybindingRule({...UNo,id:"scm.forceViewPreviousCommit",when:C.has("scmRepository"),primary:528});Ge.registerCommand("scm.openInIntegratedTerminal",async(a,...i)=>{if(!i||i.length===0)return;let e=a.get(fe),t=a.get(Co),o=i.length===1?i[0]:void 0;if(!o){let n=t.lastFocusedList,r=n?.getHTMLElement();if(n instanceof bc&&r&&Na(r)){let[s]=n.getFocus(),l=n.element(s);ou(l)&&(o=l.provider)}}o?.rootUri&&await e.executeCommand("openInIntegratedTerminal",o.rootUri)});Ge.registerCommand("scm.openInTerminal",async(a,i)=>{if(!i||!i.rootUri)return;await a.get(fe).executeCommand("openInTerminal",i.rootUri)});Ge.registerCommand("scm.setActiveProvider",async a=>{let i=a.get(F),e=a.get(Au),t=d(14881,null),o=d(14880,null),r=await i.createInstance(jze,t,o).pickRepository();if(r?.repository){let s=r.repository!=="auto"?r.repository:void 0;e.pinActiveRepository(s)}});be.appendMenuItem(R.SCMSourceControl,{group:"99_terminal",command:{id:"scm.openInTerminal",title:d(14825,null)},when:C.and(Qb.isEqualTo(""),C.equals("scmProviderHasRootUri",!0),C.or(C.equals("config.terminal.sourceControlRepositoriesKind","external"),C.equals("config.terminal.sourceControlRepositoriesKind","both")))});be.appendMenuItem(R.SCMSourceControl,{group:"99_terminal",command:{id:"scm.openInIntegratedTerminal",title:d(14826,null)},when:C.and(C.equals("scmProviderHasRootUri",!0),C.or(C.equals("config.terminal.sourceControlRepositoriesKind","integrated"),C.equals("config.terminal.sourceControlRepositoriesKind","both")))});xt.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusPreviousInput",weight:200,when:Jc.RepositoryVisibilityCount.notEqualsTo(0),handler:async a=>{let e=await a.get(Gt).openView(wv);e&&e.focusPreviousInput()}});xt.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusNextInput",weight:200,when:Jc.RepositoryVisibilityCount.notEqualsTo(0),handler:async a=>{let e=await a.get(Gt).openView(wv);e&&e.focusNextInput()}});xt.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusPreviousResourceGroup",weight:200,handler:async a=>{let e=await a.get(Gt).openView(wv);e&&e.focusPreviousResourceGroup()}});xt.registerCommandAndKeybindingRule({id:"workbench.scm.action.focusNextResourceGroup",weight:200,handler:async a=>{let e=await a.get(Gt).openView(wv);e&&e.focusNextResourceGroup()}});W(class extends z{constructor(){super({id:"scm.editor.triggerSetup",title:d(14884,null),icon:L.chatSparkle,f1:!1,menu:{id:R.EditorContent,when:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate(),Z.Setup.completed.negate(),C.in(Ho.Resource.key,"git.mergeChanges"),C.equals("git.activeResourceHasMergeConflicts",!0))}})}async run(a,...i){let e=a.get(fe);if(!await e.executeCommand(che))return;let o=$i.defaultChatAgent?.resolveMergeConflictsCommand;o&&await e.executeCommand(o,...i)}});_a.register(new A6t);function okn(a){return(i,e)=>{if(i.rootUri&&!e.rootUri)return-1;if(!i.rootUri&&e.rootUri)return 1;if(!i.rootUri&&!e.rootUri)return 0;let t=Yr(a,i.rootUri),o=Yr(a,e.rootUri);return t&&o?zNo(i,e):t?-1:o?1:0}}function zNo(a,i){return a.kind==="primary"?-1:i.kind==="primary"?1:a.kind==="secondary"?-1:i.kind==="secondary"?1:0}var tj=class extends k{constructor(e,t){super();this.storageService=e;this.uriIdentityService=t;this.quickDiffProviders=new Set;this._onDidChangeQuickDiffProviders=this._register(new T);this.onDidChangeQuickDiffProviders=this._onDidChangeQuickDiffProviders.event;this.hiddenQuickDiffProviders=new Set;this.loadState()}static{this.STORAGE_KEY="workbench.scm.quickDiffProviders.hidden"}get providers(){return Array.from(this.quickDiffProviders).sort(zNo)}addQuickDiffProvider(e){return this.quickDiffProviders.add(e),this._onDidChangeQuickDiffProviders.fire(),{dispose:()=>{this.quickDiffProviders.delete(e),this._onDidChangeQuickDiffProviders.fire()}}}async getQuickDiffs(e,t="",o=!1){let n=Array.from(this.quickDiffProviders).filter(l=>!l.rootUri||this.uriIdentityService.extUri.isEqualOrParent(e,l.rootUri)).sort(okn(e)),r=await Promise.allSettled(n.map(async l=>{let u=(l.selector?gH(l.selector,e,t,o,void 0,void 0):10)>0?await l.getOriginalResource(e)??void 0:void 0;return{provider:l,originalResource:u}})),s=[];for(let l of r){if(l.status==="rejected")continue;let{provider:c,originalResource:u}=l.value;u&&s.push({id:c.id,label:c.label,kind:c.kind,originalResource:u})}return s}toggleQuickDiffProviderVisibility(e){this.isQuickDiffProviderVisible(e)?this.hiddenQuickDiffProviders.add(e):this.hiddenQuickDiffProviders.delete(e),this.saveState(),this._onDidChangeQuickDiffProviders.fire()}isQuickDiffProviderVisible(e){return!this.hiddenQuickDiffProviders.has(e)}loadState(){let e=this.storageService.get(tj.STORAGE_KEY,0);if(e)try{this.hiddenQuickDiffProviders=new Set(JSON.parse(e))}catch{}}saveState(){this.hiddenQuickDiffProviders.size===0?this.storageService.remove(tj.STORAGE_KEY,0):this.storageService.store(tj.STORAGE_KEY,JSON.stringify(Array.from(this.hiddenQuickDiffProviders)),0,0)}};tj=I([m(0,de),m(1,gt)],tj);async function KNo(a,i,e,t){let n=(await a.getQuickDiffs(i,e,t)).find(r=>r.kind==="primary");return n?n.originalResource:null}var W6t=new Y("quickDiffDecorationCount",0),q_=class extends k{constructor(e,t,o,n){super();this.codeEditor=e;this.quickDiffModelRef=t;this.configurationService=o;this.quickDiffService=n;let r=o.getValue("scm.diffDecorations"),s=r==="all"||r==="gutter",l=r==="all"||r==="overview",c=r==="all"||r==="minimap",u=d(14791,null),p={gutter:s,overview:{active:l,color:eee},minimap:{active:c,color:VDe},isWholeLine:!0};this.addedOptions=q_.createDecoration("dirty-diff-added primary",u,p),this.addedPatternOptions=q_.createDecoration("dirty-diff-added primary pattern",u,p),this.addedSecondaryOptions=q_.createDecoration("dirty-diff-added secondary",u,p),this.addedSecondaryPatternOptions=q_.createDecoration("dirty-diff-added secondary pattern",u,p);let h=d(14793,null),g={gutter:s,overview:{active:l,color:ZZ},minimap:{active:c,color:WDe},isWholeLine:!0};this.modifiedOptions=q_.createDecoration("dirty-diff-modified primary",h,g),this.modifiedPatternOptions=q_.createDecoration("dirty-diff-modified primary pattern",h,g),this.modifiedSecondaryOptions=q_.createDecoration("dirty-diff-modified secondary",h,g),this.modifiedSecondaryPatternOptions=q_.createDecoration("dirty-diff-modified secondary pattern",h,g);let f=d(14792,null),v={gutter:s,overview:{active:l,color:tee},minimap:{active:c,color:BDe},isWholeLine:!1};this.deletedOptions=q_.createDecoration("dirty-diff-deleted primary",f,v),this.deletedSecondaryOptions=q_.createDecoration("dirty-diff-deleted secondary",f,v),this._register(o.onDidChangeConfiguration(b=>{b.affectsConfiguration("scm.diffDecorationsGutterPattern")&&this.onDidChange()})),this._register(U.runAndSubscribe(this.quickDiffModelRef.object.onDidChange,()=>this.onDidChange()))}static createDecoration(e,t,o){let n={description:"dirty-diff-decoration",isWholeLine:o.isWholeLine};return o.gutter&&(n.linesDecorationsClassName=`dirty-diff-glyph ${e}`,n.linesDecorationsTooltip=t),o.overview.active&&(n.overviewRuler={color:_s(o.overview.color),position:1}),o.minimap.active&&(n.minimap={color:_s(o.minimap.color),position:2}),So.createDynamic(n)}onDidChange(){if(!this.codeEditor.hasModel())return;let e=this.configurationService.getValue("scm.diffDecorationsGutterPattern"),t=this.quickDiffModelRef.object.quickDiffs.find(r=>r.kind==="primary"),o=this.quickDiffModelRef.object.changes.filter(r=>r.providerId===t?.id),n=[];for(let r of this.quickDiffModelRef.object.changes){let s=this.quickDiffModelRef.object.quickDiffs.find(p=>p.id===r.providerId);if(!s||!this.quickDiffService.isQuickDiffProviderVisible(s.id)||s.kind!=="primary"&&o.some(p=>p.change2.modified.intersectsOrTouches(r.change2.modified)))continue;let l=FXe(r.change),c=r.change.modifiedStartLineNumber,u=r.change.modifiedEndLineNumber||c;switch(l){case 1:n.push({range:{startLineNumber:c,startColumn:1,endLineNumber:u,endColumn:1},options:s.kind==="primary"||s.kind==="contributed"?e.added?this.addedPatternOptions:this.addedOptions:e.added?this.addedSecondaryPatternOptions:this.addedSecondaryOptions});break;case 2:n.push({range:{startLineNumber:c,startColumn:Number.MAX_VALUE,endLineNumber:c,endColumn:Number.MAX_VALUE},options:s.kind==="primary"||s.kind==="contributed"?this.deletedOptions:this.deletedSecondaryOptions});break;case 0:n.push({range:{startLineNumber:c,startColumn:1,endLineNumber:u,endColumn:1},options:s.kind==="primary"||s.kind==="contributed"?e.modified?this.modifiedPatternOptions:this.modifiedOptions:e.modified?this.modifiedSecondaryPatternOptions:this.modifiedSecondaryOptions});break}}this.decorationsCollection?this.decorationsCollection.set(n):this.decorationsCollection=this.codeEditor.createDecorationsCollection(n)}dispose(){this.decorationsCollection&&this.decorationsCollection.clear(),this.decorationsCollection=void 0,this.quickDiffModelRef.dispose(),super.dispose()}};q_=I([m(2,B),m(3,l_)],q_);var Jze=class extends k{constructor(e,t,o,n,r,s){super();this.editorService=e;this.configurationService=t;this.quickDiffModelService=o;this.quickDiffService=n;this.uriIdentityService=r;this.enabled=!1;this.decorators=new dt;this.viewState={width:3,visibility:"always"};this.transientDisposables=this._register(new O);this.stylesheet=Pr(void 0,void 0,this._store),this.quickDiffDecorationCount=W6t.bindTo(s),this.activeEditor=vi(this,this.editorService.onDidActiveEditorChange,()=>this.editorService.activeEditor),this.quickDiffProviders=vi(this,this.quickDiffService.onDidChangeQuickDiffProviders,()=>this.quickDiffService.providers);let l=U.filter(t.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorations"));this._register(l(this.onDidChangeConfiguration,this)),this.onDidChangeConfiguration();let c=U.filter(t.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorationsGutterWidth"));this._register(c(this.onDidChangeDiffWidthConfiguration,this)),this.onDidChangeDiffWidthConfiguration();let u=U.filter(t.onDidChangeConfiguration,p=>p.affectsConfiguration("scm.diffDecorationsGutterVisibility"));this._register(u(this.onDidChangeDiffVisibilityConfiguration,this)),this.onDidChangeDiffVisibilityConfiguration()}onDidChangeConfiguration(){this.configurationService.getValue("scm.diffDecorations")!=="none"?this.enable():this.disable()}onDidChangeDiffWidthConfiguration(){let e=this.configurationService.getValue("scm.diffDecorationsGutterWidth");(isNaN(e)||e<=0||e>5)&&(e=3),this.setViewState({...this.viewState,width:e})}onDidChangeDiffVisibilityConfiguration(){let e=this.configurationService.getValue("scm.diffDecorationsGutterVisibility");this.setViewState({...this.viewState,visibility:e})}setViewState(e){this.viewState=e,this.stylesheet.textContent=`
			.monaco-editor .dirty-diff-added,
			.monaco-editor .dirty-diff-modified {
				border-left-width:${e.width}px;
			}
			.monaco-editor .dirty-diff-added.pattern,
			.monaco-editor .dirty-diff-added.pattern:before,
			.monaco-editor .dirty-diff-modified.pattern,
			.monaco-editor .dirty-diff-modified.pattern:before {
				background-size: ${e.width}px ${e.width}px;
			}
			.monaco-editor .dirty-diff-added,
			.monaco-editor .dirty-diff-modified,
			.monaco-editor .dirty-diff-deleted {
				opacity: ${e.visibility==="always"?1:0};
			}
		`}enable(){this.enabled&&this.disable(),this.transientDisposables.add(U.any(this.editorService.onDidCloseEditor,this.editorService.onDidVisibleEditorsChange)(()=>this.onEditorsChanged())),this.onEditorsChanged(),this.onDidActiveEditorChange(),this.onDidChangeQuickDiffProviders(),this.enabled=!0}disable(){if(this.enabled){this.transientDisposables.clear(),this.quickDiffDecorationCount.set(0);for(let[e,t]of this.decorators.entries())t.dispose(),this.decorators.delete(e);this.enabled=!1}}onDidActiveEditorChange(){this.transientDisposables.add(ve(e=>{let t=this.activeEditor.read(e),o=this.editorService.activeTextEditorControl;if(!fn(o)||!t?.resource){this.quickDiffDecorationCount.set(0);return}let n=this.quickDiffModelService.createQuickDiffModelReference(t.resource);if(!n){this.quickDiffDecorationCount.set(0);return}e.store.add(n);let r=vi(this,n.object.onDidChange,()=>{let s=n.object.quickDiffs.filter(l=>this.quickDiffService.isQuickDiffProviderVisible(l.id));return n.object.changes.filter(l=>s.some(c=>c.id===l.providerId)).length});e.store.add(ve(s=>{let l=r.read(s);this.quickDiffDecorationCount.set(l)}))}))}onDidChangeQuickDiffProviders(){this.transientDisposables.add(ve(e=>{let t=this.quickDiffProviders.read(e),o=[];for(let n=0;n<t.length;n++){let r=t[n];if(o.includes(r.label))continue;let s=this.quickDiffService.isQuickDiffProviderVisible(r.id),l=r.kind!=="contributed"?"0_scm":"1_contributed",c=n+1;e.store.add(W(class extends z{constructor(){super({id:`workbench.scm.action.toggleQuickDiffVisibility.${r.id}`,title:r.label,toggled:s?My.INSTANCE:Ww.INSTANCE,menu:{id:R.SCMQuickDiffDecorations,group:l,order:c},f1:!1})}run(u){u.get(l_).toggleQuickDiffProviderVisibility(r.id)}})),o.push(r.label)}}))}onEditorsChanged(){for(let e of this.editorService.visibleTextEditorControls){if(!fn(e))continue;let t=e.getModel();if(!t)continue;let o=e.getId();if(this.decorators.get(t.uri)?.has(o))continue;let n=this.quickDiffModelService.createQuickDiffModelReference(t.uri);n&&(this.decorators.has(t.uri)||this.decorators.set(t.uri,new Ot),this.decorators.get(t.uri).set(o,new q_(e,n,this.configurationService,this.quickDiffService)))}for(let[e,t]of this.decorators.entries()){for(let o of t.keys())this.editorService.visibleTextEditorControls.find(r=>fn(r)&&r.getId()===o&&this.uriIdentityService.extUri.isEqual(r.getModel()?.uri,e))||t.deleteAndDispose(o);t.size===0&&(t.dispose(),this.decorators.delete(e))}}dispose(){this.disable(),super.dispose()}};Jze=I([m(0,ie),m(1,B),m(2,Q0),m(3,l_),m(4,gt),m(5,X)],Jze);var ozi=new Y("dirtyDiffVisible",!1),Aut=class extends NK{constructor(e,t,o,n){let r={...nC},s=o.getColorTheme(),l=s.getColor(Bo),u=s.getColor(ZB)?.makeOpaque(l)??l;r.selectBackground=u.lighten(.6).toString();super(null,e,[],0,t,r,{ariaLabel:d(14804,null),useCustomDrawn:!BI(n)});this.optionsItems=[]}setSelection(e,t){this.optionsItems=e.map(n=>({providerId:n.id,text:n.label}));let o=this.optionsItems.findIndex(n=>n.providerId===t);this.setOptions(this.optionsItems,o)}getActionContext(e,t){return this.optionsItems[t]}render(e){super.render(e),this.setFocusable(!0)}};Aut=I([m(1,qn),m(2,Pe),m(3,B)],Aut);var Z1i=class a extends it{constructor(e){super(a.ID,a.LABEL,void 0,void 0);this.callback=e}static{this.ID="quickDiff.base.switch"}static{this.LABEL=d(14803,null)}async run(e){return this.callback(e)}},ezi=class extends cs{runAction(i,e){return i instanceof Do?i.run(...e):super.runAction(i,e)}},NSe=class extends it{constructor(i,e,t,o,n){let r=o.appendKeybinding(e.label,e.id);super(e.id,r,t),this.instantiationService=n,this.action=e,this.editor=i}run(){return Promise.resolve(this.instantiationService.invokeFunction(i=>this.action.run(i,this.editor,null)))}};NSe=I([m(3,Le),m(4,F)],NSe);var Nut=class extends zT{constructor(e,t,o,n,r,s,l){super(e,{isResizeable:!0,frameWidth:1,keepEditorSelection:!0,className:"dirty-diff"},n);this.model=t;this.themeService=o;this.menuService=r;this.contextKeyService=s;this.quickDiffService=l;this._index=0;this._providerId="";this.height=void 0;this._disposables.add(o.onDidColorThemeChange(this._applyTheme,this)),this._applyTheme(o.getColorTheme()),yt.isEmpty(this.model.originalTextModels)||(s=s.createOverlay([["originalResourceScheme",yt.first(this.model.originalTextModels)?.uri.scheme],["originalResourceSchemes",yt.map(this.model.originalTextModels,c=>c.uri.scheme)]])),this.create(),e.hasModel()?this.title=Be(e.getModel().uri):this.title="",this.setTitle(this.title)}get providerId(){return this._providerId}get index(){return this._index}get visibleRange(){let e=this.diffEditor.getModifiedEditor().getVisibleRanges();return e.length>=0?e[0]:void 0}showChange(e,t=!0){let o=this.model.changes[e],n=o.change;if(this._index=e,this.contextKeyService.createKey("originalResource",this.model.changes[e].original.toString()),this.contextKeyService.createKey("originalResourceScheme",this.model.changes[e].original.scheme),this.updateActions(),this.change=n,this._providerId=o.providerId,yt.isEmpty(this.model.originalTextModels))return;U.once(this.diffEditor.onDidUpdateDiff)(()=>setTimeout(()=>this.revealChange(n),0));let s=this.model.getDiffEditorModel(o.original);if(!s)return;this.diffEditor.setModel(s);let l=new ye(WXe(n),1),c=this.editor.getOption(75),u=this.editor.getLayoutInfo().height,p=Math.floor(u/c),h=Math.min(Jlo(n)+2+6,Math.floor(p/3));this.renderTitle(),this.updateDropdown();let g=FXe(n),f=Xlo(this.themeService.getColorTheme(),g);this.style({frameColor:f,arrowColor:f});let v=[],b=e;for(let S of this.model.changes)S.providerId===this.model.changes[this._index].providerId&&(v.push(S.change),o===S&&(b=v.length-1));this._actionbarWidget.context=[s.modified.uri,v,b],t&&(this.show(l,h+1/c),this.editor.setPosition(l),this.editor.focus())}renderTitle(){let e=this.model.quickDiffChanges.get(this._providerId),t=e.indexOf(this._index),o;if(this.shouldUseDropdown())o=this.model.changes.length>1?d(14802,null,t+1,e.length):d(14801,null,t+1,e.length),this.dropdownContainer.style.display="inherit";else{let n=this.model.quickDiffs.find(r=>r.id===this._providerId)?.label??"";o=this.model.changes.length>1?d(14795,null,n,t+1,e.length):d(14794,null,n,t+1,e.length),this.dropdownContainer.style.display="none"}this.setTitle(this.title,o)}switchQuickDiff(e){let t=e?.providerId;if(t===this.model.changes[this._index].providerId)return;let o=this._index<this.model.changes.length-1?this._index+1:0;for(let s=o;s!==this._index;s<this.model.changes.length-1?s++:s=0)if(this.model.changes[s].providerId===t){o=s;break}let n=this._index>0?this._index-1:this.model.changes.length-1;for(let s=n;s!==this._index;s>0?s--:s=this.model.changes.length-1)if(this.model.changes[s].providerId===t){n=s;break}let r=Math.abs(this.model.changes[o].change.modifiedEndLineNumber-this.model.changes[this._index].change.modifiedEndLineNumber)<Math.abs(this.model.changes[n].change.modifiedEndLineNumber-this.model.changes[this._index].change.modifiedEndLineNumber)?o:n;this.showChange(r,!1)}shouldUseDropdown(){return this.getQuickDiffsContainingChange().length>1}updateActions(){if(!this._actionbarWidget)return;let e=this.instantiationService.createInstance(NSe,this.editor,new V6t(this.editor),q.asClassName(WZi)),t=this.instantiationService.createInstance(NSe,this.editor,new B6t(this.editor),q.asClassName(VZi));this._disposables.add(e),this._disposables.add(t),this.menu&&this.menu.dispose(),this.menu=this.menuService.createMenu(R.SCMChangeContext,this.contextKeyService);let o=Ng(this.menu.getActions({shouldForwardArgs:!0}));this._actionbarWidget.clear(),this._actionbarWidget.push(o.reverse(),{label:!1,icon:!0}),this._actionbarWidget.push([t,e],{label:!1,icon:!0}),this._actionbarWidget.push(this._disposables.add(new it("peekview.close",d(14796,null),q.asClassName(L.close),!0,()=>this.dispose())),{label:!1,icon:!0})}updateDropdown(){let e=this.getQuickDiffsContainingChange();this.dropdown?.setSelection(e,this._providerId)}getQuickDiffsContainingChange(){let e=this.model.changes[this._index],t=this.model.changes.filter(o=>e.change2.modified.intersectsOrTouches(o.change2.modified)).map(o=>o.providerId);return this.model.quickDiffs.filter(o=>t.includes(o.id)&&this.quickDiffService.isQuickDiffProviderVisible(o.id))}_fillHead(e){super._fillHead(e,!0);let t=new Z1i(o=>this.switchQuickDiff(o));this._disposables.add(t),this.dropdownContainer=CI(this._titleElement,_(".dropdown")),this.dropdown=this.instantiationService.createInstance(Aut,t),this.dropdown.render(this.dropdownContainer)}_getActionBarOptions(){let e=new ezi;return this._disposables.add(e),this._disposables.add(e.onDidRun(t=>{!(t.action instanceof NSe)&&!t.error&&this.dispose()})),{...super._getActionBarOptions(),actionRunner:e}}_fillBody(e){let t={diffAlgorithm:"advanced",fixedOverflowWidgets:!0,ignoreTrimWhitespace:!1,minimap:{enabled:!1},readOnly:!1,renderGutterMenu:!1,renderIndicators:!1,renderOverviewRuler:!1,renderSideBySide:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1},scrollBeyondLastLine:!1,stickyScroll:{enabled:!1}};this.diffEditor=this.instantiationService.createInstance(nL,e,t,{},this.editor),this._disposables.add(this.diffEditor)}_onWidth(e){typeof this.height>"u"||this.diffEditor.layout({height:this.height,width:e})}_doLayoutBody(e,t){super._doLayoutBody(e,t),this.diffEditor.layout({height:e,width:t}),typeof this.height>"u"&&this.change&&this.revealChange(this.change),this.height=e}revealChange(e){let t,o;e.modifiedEndLineNumber===0?(t=e.modifiedStartLineNumber,o=e.modifiedStartLineNumber+1):e.originalEndLineNumber>0?(t=e.modifiedStartLineNumber-1,o=e.modifiedEndLineNumber+1):(t=e.modifiedStartLineNumber,o=e.modifiedEndLineNumber),this.diffEditor.revealLinesInCenter(t,o,1)}_applyTheme(e){let t=e.getColor(AD)||Ue.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(ZB)||Ue.transparent,primaryHeadingColor:e.getColor(n0),secondaryHeadingColor:e.getColor(r0)})}revealRange(e){this.editor.revealLineInCenterIfOutsideViewport(e.endLineNumber,0)}hasFocus(){return this.diffEditor.hasTextFocus()}toggleFocus(){this.diffEditor.hasTextFocus()?this.editor.focus():this.diffEditor.focus()}dispose(){this.dropdown?.dispose(),this.menu?.dispose(),super.dispose()}};Nut=I([m(2,Pe),m(3,F),m(4,Yt),m(5,X),m(6,l_)],Nut);var WO=class extends k{constructor(e,t,o,n,r){super();this.editor=e;this.configurationService=o;this.quickDiffModelService=n;this.instantiationService=r;this.model=null;this.widget=null;this.session=k.None;this.mouseDownInfo=null;this.enabled=!1;this.gutterActionDisposables=new O;if(this.enabled=!t.getContextKeyValue("isInDiffEditor"),this.stylesheet=Pr(void 0,void 0,this._store),this.enabled){this.isQuickDiffVisible=ozi.bindTo(t),this._register(e.onDidChangeModel(()=>this.close()));let s=U.filter(o.onDidChangeConfiguration,l=>l.affectsConfiguration("scm.diffDecorationsGutterAction"));this._register(s(this.onDidChangeGutterAction,this)),this.onDidChangeGutterAction()}}static{this.ID="editor.contrib.quickdiff"}static get(e){return e.getContribution(WO.ID)}onDidChangeGutterAction(){let e=this.configurationService.getValue("scm.diffDecorationsGutterAction");this.gutterActionDisposables.clear(),e==="diff"?(this.gutterActionDisposables.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.gutterActionDisposables.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.stylesheet.textContent=`
				.monaco-editor .dirty-diff-glyph {
					cursor: pointer;
				}

				.monaco-editor .margin-view-overlays .dirty-diff-glyph:hover::before {
					height: 100%;
					width: 6px;
					left: -6px;
				}

				.monaco-editor .margin-view-overlays .dirty-diff-deleted:hover::after {
					bottom: 0;
					border-top-width: 0;
					border-bottom-width: 0;
				}
			`):this.stylesheet.textContent=""}canNavigate(){return!this.widget||this.widget?.index===-1||!!this.model&&this.model.changes.length>1}refresh(){this.widget?.showChange(this.widget.index,!1)}toggleFocus(){this.widget&&this.widget.toggleFocus()}next(e){if(!this.assertWidget()||!this.widget||!this.model)return;let t;if(this.editor.hasModel()&&(typeof e=="number"||!this.widget.providerId))t=this.model.findNextClosestChange(typeof e=="number"?e:this.editor.getPosition().lineNumber,!0,this.widget.providerId);else{let o=this.model.quickDiffChanges.get(this.widget.providerId)??this.model.quickDiffChanges.values().next().value,n=o.findIndex(r=>r===this.widget.index);t=o[SB(n+1,o.length)]}this.widget.showChange(t)}previous(e){if(!this.assertWidget()||!this.widget||!this.model)return;let t;if(this.editor.hasModel()&&(typeof e=="number"||!this.widget.providerId))t=this.model.findPreviousClosestChange(typeof e=="number"?e:this.editor.getPosition().lineNumber,!0,this.widget.providerId);else{let o=this.model.quickDiffChanges.get(this.widget.providerId)??this.model.quickDiffChanges.values().next().value,n=o.findIndex(r=>r===this.widget.index);t=o[SB(n-1,o.length)]}this.widget.showChange(t)}close(){this.session.dispose(),this.session=k.None}assertWidget(){if(!this.enabled)return!1;if(this.widget)return!this.model||this.model.changes.length===0?(this.close(),!1):!0;let e=this.editor.getModel();if(!e)return!1;let t=this.quickDiffModelService.createQuickDiffModelReference(e.uri);if(!t)return!1;if(t.object.changes.length===0)return t.dispose(),!1;this.model=t.object,this.widget=this.instantiationService.createInstance(Nut,this.editor,this.model),this.isQuickDiffVisible.set(!0);let o=new O;return o.add(U.once(this.widget.onDidClose)(this.close,this)),U.chain(this.model.onDidChange,r=>r.filter(s=>s.diff.length>0).map(s=>s.diff))(this.onDidModelChange,this,o),o.add(t),o.add(this.widget),o.add(ee(()=>{this.model=null,this.widget=null,this.isQuickDiffVisible.set(!1),this.editor.focus()})),this.session=o,!0}onDidModelChange(e){if(!(!this.model||!this.widget||this.widget.hasFocus())){for(let t of e)if(t.start<=this.widget.index){this.next();return}this.refresh()}}onEditorMouseDown(e){this.mouseDownInfo=null;let t=e.target.range;if(!t||!e.event.leftButton||e.target.type!==4||!e.target.element||e.target.element.className.indexOf("dirty-diff-glyph")<0)return;let o=e.target.detail,n=e.target.element.offsetLeft,r=o.offsetX-n;r<-3||r>3||(this.mouseDownInfo={lineNumber:t.startLineNumber})}onEditorMouseUp(e){if(!this.mouseDownInfo)return;let{lineNumber:t}=this.mouseDownInfo;this.mouseDownInfo=null;let o=e.target.range;if(!o||o.startLineNumber!==t||e.target.type!==4)return;let n=this.editor.getModel();if(!n)return;let r=this.quickDiffModelService.createQuickDiffModelReference(n.uri);if(r)try{let s=r.object.changes.findIndex(l=>Zlo(t,l.change));if(s<0)return;s===this.widget?.index?this.close():this.next(t)}finally{r.dispose()}}dispose(){this.gutterActionDisposables.dispose(),super.dispose()}};WO=I([m(1,X),m(2,B),m(3,Q0),m(4,F)],WO);var V6t=class extends Mi{constructor(e){super({id:"editor.action.dirtydiff.previous",label:P(14806,"Show Previous Change"),precondition:GS.toNegated(),kbOpts:{kbExpr:me.editorTextFocus,primary:1597,weight:100}});this.outerEditor=e}run(e){let t=this.outerEditor??Zze(e);if(!t)return;let o=WO.get(t);o&&o.canNavigate()&&o.previous()}};ri(V6t);var B6t=class extends Mi{constructor(e){super({id:"editor.action.dirtydiff.next",label:P(14805,"Show Next Change"),precondition:GS.toNegated(),kbOpts:{kbExpr:me.editorTextFocus,primary:573,weight:100}});this.outerEditor=e}run(e){let t=this.outerEditor??Zze(e);if(!t)return;let o=WO.get(t);o&&o.canNavigate()&&o.next()}};ri(B6t);var tzi=class extends Mi{constructor(){super({id:"workbench.action.editor.previousChange",label:P(14800,"Go to Previous Change"),precondition:C.and(GS.toNegated(),W6t.notEqualsTo(0)),kbOpts:{kbExpr:me.editorTextFocus,primary:1599,weight:100}})}async run(i){let e=Zze(i),t=i.get(br),o=i.get(Ai),n=i.get(Qt),r=i.get(Q0);if(!e||!e.hasModel())return;let s=r.createQuickDiffModelReference(e.getModel().uri);try{if(!s||s.object.changes.length===0)return;let l=e.getPosition().lineNumber,c=s.object.findPreviousClosestChange(l,!1),u=s.object.changes[c];await qNo(u.change,t),GNo(u.change,e,o,n)}finally{s?.dispose()}}};ri(tzi);var izi=class extends Mi{constructor(){super({id:"workbench.action.editor.nextChange",label:P(14799,"Go to Next Change"),precondition:C.and(GS.toNegated(),W6t.notEqualsTo(0)),kbOpts:{kbExpr:me.editorTextFocus,primary:575,weight:100}})}async run(i){let e=i.get(br),t=Zze(i),o=i.get(Ai),n=i.get(Qt),r=i.get(Q0);if(!t||!t.hasModel())return;let s=r.createQuickDiffModelReference(t.getModel().uri);try{if(!s||s.object.changes.length===0)return;let l=t.getPosition().lineNumber,c=s.object.findNextClosestChange(l,!1),u=s.object.changes[c].change;await qNo(u,e),GNo(u,t,o,n)}finally{s?.dispose()}}};ri(izi);be.appendMenuItem(R.MenubarGoMenu,{group:"7_change_nav",command:{id:"editor.action.dirtydiff.next",title:d(14797,null)},order:1});be.appendMenuItem(R.MenubarGoMenu,{group:"7_change_nav",command:{id:"editor.action.dirtydiff.previous",title:d(14798,null)},order:2});xt.registerCommandAndKeybindingRule({id:"closeQuickDiff",weight:150,primary:9,secondary:[1033],when:C.and(ozi),handler:a=>{let i=Zze(a);if(!i)return;let e=WO.get(i);e&&e.close()}});xt.registerCommandAndKeybindingRule({id:"toggleQuickDiffWidgetFocus",weight:100,primary:Gi(2089,60),when:ozi,handler:a=>{let i=Zze(a);if(!i)return;let e=WO.get(i);e&&e.toggleFocus()}});function GNo(a,i,e,t){let o=new ye(a.modifiedStartLineNumber,1);i.setPosition(o),i.revealPositionInCenter(o),e.isScreenReaderOptimized()&&(i.setSelection({startLineNumber:a.modifiedStartLineNumber,startColumn:0,endLineNumber:a.modifiedStartLineNumber,endColumn:Number.MAX_VALUE}),t.getActiveCodeEditor()?.writeScreenReaderContent("diff-navigation"))}async function qNo(a,i){switch(FXe(a)){case 1:i.playSignal(tn.diffLineInserted,{allowManyInParallel:!0,source:"quickDiffDecoration"});break;case 2:i.playSignal(tn.diffLineDeleted,{allowManyInParallel:!0,source:"quickDiffDecoration"});break;case 0:i.playSignal(tn.diffLineModified,{allowManyInParallel:!0,source:"quickDiffDecoration"});break}}function Zze(a){let i=a.get(Qt).listDiffEditors();for(let e of i)if(e.hasTextFocus()&&e instanceof nL)return e.getParentEditor();return DEe(a)}be.appendMenuItem(R.EditorLineNumberContext,{title:d(14775,null),submenu:R.SCMQuickDiffDecorations,when:C.or(C.equals("config.scm.diffDecorations","all"),C.equals("config.scm.diffDecorations","gutter")),group:"9_quickDiffDecorations"});oe.as(Zi.Workbench).registerWorkbenchContribution(Jze,3);Eo(WO.ID,WO,1);oe.as($t.Configuration).registerConfiguration({id:"scm",order:5,title:d(14790,null),type:"object",scope:5,properties:{"scm.diffDecorations":{type:"string",enum:["all","gutter","overview","minimap","none"],enumDescriptions:[d(14776,null),d(14777,null),d(14780,null),d(14778,null),d(14779,null)],default:"all",description:d(14769,null)},"scm.diffDecorationsGutterWidth":{type:"number",enum:[1,2,3,4,5],default:3,description:d(14774,null)},"scm.diffDecorationsGutterVisibility":{type:"string",enum:["always","hover"],enumDescriptions:[d(14785,null),d(14786,null)],description:d(14784,null),default:"always"},"scm.diffDecorationsGutterAction":{type:"string",enum:["diff","none"],enumDescriptions:[d(14782,null),d(14783,null)],description:d(14781,null),default:"diff"},"scm.diffDecorationsGutterPattern":{type:"object",description:d(14771,null),additionalProperties:!1,properties:{added:{type:"boolean",description:d(14772,null)},modified:{type:"boolean",description:d(14773,null)}},default:{added:!1,modified:!0}},"scm.diffDecorationsIgnoreTrimWhitespace":{type:"string",enum:["true","false","inherit"],enumDescriptions:[d(14789,null),d(14787,null),d(14788,null)],description:d(14770,null),default:"false"}}});Ce(l_,tj,1);Ce(Q0,UDe,1);var nzi=class extends k{constructor(e,t){super();this.repository=e;this.history=t;this._value="";this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._placeholder="";this._onDidChangePlaceholder=this._register(new T);this.onDidChangePlaceholder=this._onDidChangePlaceholder.event;this._enabled=!0;this._onDidChangeEnablement=this._register(new T);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._visible=!0;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onDidChangeFocus=this._register(new T);this.onDidChangeFocus=this._onDidChangeFocus.event;this._onDidChangeValidationMessage=this._register(new T);this.onDidChangeValidationMessage=this._onDidChangeValidationMessage.event;this._onDidClearValidation=this._register(new T);this.onDidClearValidation=this._onDidClearValidation.event;this._validateInput=()=>Promise.resolve(void 0);this._onDidChangeValidateInput=this._register(new T);this.onDidChangeValidateInput=this._onDidChangeValidateInput.event;this.didChangeHistory=!1;this.repository.provider.rootUri?(this.historyNavigator=t.getHistory(this.repository.provider.label,this.repository.provider.rootUri),this._register(this.history.onWillSaveHistory(o=>{this.historyNavigator.isAtEnd()&&this.saveValue(),this.didChangeHistory&&o.historyDidIndeedChange(),this.didChangeHistory=!1}))):this.historyNavigator=new E4([""],100),this._value=this.historyNavigator.current()}get value(){return this._value}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this._onDidChangePlaceholder.fire(e)}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._onDidChangeEnablement.fire(e)}get visible(){return this._visible}set visible(e){this._visible=e,this._onDidChangeVisibility.fire(e)}setFocus(){this._onDidChangeFocus.fire()}showValidationMessage(e,t){this._onDidChangeValidationMessage.fire({message:e,type:t})}clearValidation(){this._onDidClearValidation.fire()}get validateInput(){return this._validateInput}set validateInput(e){this._validateInput=e,this._onDidChangeValidateInput.fire()}setValue(e,t,o){e!==this._value&&(t||(this.historyNavigator.replaceLast(this._value),this.historyNavigator.add(e),this.didChangeHistory=!0),this._value=e,this._onDidChange.fire({value:e,reason:o}))}showNextHistoryValue(){if(this.historyNavigator.isAtEnd())return;this.historyNavigator.has(this.value)||(this.saveValue(),this.historyNavigator.resetCursor());let e=this.historyNavigator.next();this.setValue(e,!0,1)}showPreviousHistoryValue(){this.historyNavigator.isAtEnd()?this.saveValue():this.historyNavigator.has(this._value)||(this.saveValue(),this.historyNavigator.resetCursor());let e=this.historyNavigator.previous();this.setValue(e,!0,0)}saveValue(){let e=this.historyNavigator.replaceLast(this._value);this.didChangeHistory=this.didChangeHistory||e!==this._value}},rzi=class{constructor(i,e,t,o){this.id=i;this.provider=e;this.disposables=t;this._selected=!1;this._onDidChangeSelection=new T;this.onDidChangeSelection=this._onDidChangeSelection.event;this.input=new nzi(this,o)}get selected(){return this._selected}setSelected(i){this._selected!==i&&(this._selected=i,this._onDidChangeSelection.fire(i))}dispose(){this.disposables.dispose(),this._onDidChangeSelection.dispose(),this.input.dispose(),this.provider.dispose()}},szi=class{constructor(){this._didChangeHistory=!1}get didChangeHistory(){return this._didChangeHistory}historyDidIndeedChange(){this._didChangeHistory=!0}},Out=class{constructor(i,e){this.storageService=i;this.workspaceContextService=e;this.disposables=new O;this.histories=new Map;this._onWillSaveHistory=this.disposables.add(new T);this.onWillSaveHistory=this._onWillSaveHistory.event;this.histories=new Map;let t=this.storageService.getObject("scm.history",1,[]);for(let[o,n,r]of t){let s=this.histories.get(o);s||(s=new dt,this.histories.set(o,s)),s.set(n,new E4(r,100))}this.migrateStorage()&&this.saveToStorage(),this.disposables.add(this.storageService.onDidChangeValue(1,"scm.history",this.disposables)(o=>{if(o.external&&o.key==="scm.history"){let n=this.storageService.getObject("scm.history",1,[]);for(let[r,s,l]of n){let c=this.getHistory(r,s);for(let u of yt.reverse(l))c.prepend(u)}}})),this.disposables.add(this.storageService.onWillSaveState(o=>{let n=new szi;this._onWillSaveHistory.fire(n),n.didChangeHistory&&this.saveToStorage()}))}saveToStorage(){let i=[];for(let[e,t]of this.histories)for(let[o,n]of t)n.size===1&&n.current()===""||i.push([e,o,[...n]]);this.storageService.store("scm.history",i,1,0)}getHistory(i,e){let t=this.histories.get(i);t||(t=new dt,this.histories.set(i,t));let o=t.get(e);return o||(o=new E4([""],100),t.set(e,o)),o}migrateStorage(){let i=!1,e=yt.filter(this.storageService.keys(-1,1),t=>t.startsWith("scm/input:"));for(let t of e)try{let o=JSON.parse(this.storageService.get(t,-1,"")),n=/^scm\/input:([^:]+):(.+)$/.exec(t);if(!n||!Array.isArray(o?.history)||!Number.isInteger(o?.timestamp)){this.storageService.remove(t,-1);continue}let[,r,s]=n,l=A.file(s);if(this.workspaceContextService.getWorkspaceFolder(l)){let c=this.getHistory(r,l);for(let u of yt.reverse(o.history))c.prepend(u);i=!0,this.storageService.remove(t,-1)}}catch{this.storageService.remove(t,-1)}return i}dispose(){this.disposables.dispose()}};Out=I([m(0,de),m(1,Ae)],Out);var eKe=class{constructor(i,e,t,o,n){this.logService=i;this.uriIdentityService=n;this._repositories=new Map;this._onDidAddProvider=new T;this.onDidAddRepository=this._onDidAddProvider.event;this._onDidRemoveProvider=new T;this.onDidRemoveRepository=this._onDidRemoveProvider.event;this.inputHistory=new Out(o,e),this.providerCount=t.createKey("scm.providerCount",0),this.historyProviderCount=t.createKey("scm.historyProviderCount",0)}get repositories(){return this._repositories.values()}get repositoryCount(){return this._repositories.size}registerSCMProvider(i){if(this.logService.trace("SCMService#registerSCMProvider"),this._repositories.has(i.id))throw new Error(`SCM Provider ${i.id} already exists.`);let e=new O,t=()=>Array.from(this._repositories.values()).filter(n=>!!n.provider.historyProvider.get()).length;e.add(ee(()=>{this._repositories.delete(i.id),this._onDidRemoveProvider.fire(o),this.providerCount.set(this._repositories.size),this.historyProviderCount.set(t())}));let o=new rzi(i.id,i,e,this.inputHistory);return this._repositories.set(i.id,o),e.add(Zs(i.historyProvider,()=>{this.historyProviderCount.set(t())})),this.providerCount.set(this._repositories.size),this.historyProviderCount.set(t()),this._onDidAddProvider.fire(o),o}getRepository(i){if(typeof i=="string")return this._repositories.get(i);if(i.scheme!==Q.file&&i.scheme!==Q.vscodeRemote)return;let e,t=Number.POSITIVE_INFINITY;for(let o of this.repositories){if(o.provider.isHidden===!0)continue;let n=o.provider.rootUri;if(!n)continue;let r=this.uriIdentityService.extUri.relativePath(n,i);r&&!/^\.\./.test(r)&&r.length<t&&(e=o,t=r.length)}return e}};eKe=I([m(0,re),m(1,Ae),m(2,X),m(3,de),m(4,gt)],eKe);Ce(lc,eKe,1);Ce(Au,X$,1);var azi="workbench.debug.viewlet.action.copyWorkspaceVariableValue",lzi=d(13551,null);W(class extends z{constructor(){super({id:azi,title:lzi,f1:!1})}run(a,i){let e=a.get(Bi);i.value&&e.writeText(i.value)}});W(class extends z{constructor(){super({id:"_executeNotebookVariableProvider",title:d(13552,null),f1:!1})}async run(a,i){if(!i)return[];let e=A.revive(i),t=a.get(Ql),n=a.get(kn).getNotebookTextModel(e);if(!n)return[];let r=t.getMatchingKernel(n).selected;if(r&&r.hasVariableProvider){let s=r.provideVariables(n.uri,void 0,"named",0,Ie.None),l=[];for await(let c of s)l.push(c);return l}return[]}});var OSe=class extends k{constructor(e,t,o,n){super();this._debugService=e;this._logService=t;this._accessibilityService=o;this._configurationService=n;this._listener=this._register(new ue);this._setListener(),this._register(n.onDidChangeConfiguration(r=>{r.affectsConfiguration("accessibility.debugWatchVariableAnnouncements")&&this._setListener()}))}static{this.ID="workbench.contrib.debugWatchAccessibilityAnnouncer"}_setListener(){this._configurationService.getValue("accessibility.debugWatchVariableAnnouncements")&&!this._listener.value?this._listener.value=this._debugService.getModel().onDidChangeWatchExpressionValue(t=>{!t||t.value===Fd.DEFAULT_VALUE||(this._accessibilityService.alert(`${t.name} = ${t.value}`),this._logService.trace(`debugAccessibilityAnnouncerValueChanged ${t.name} ${t.value}`))}):this._listener.clear()}};OSe=I([m(0,Hi),m(1,re),m(2,Ai),m(3,B)],OSe);var z1=class extends k{constructor(e,t,o,n,r){super();this.debugService=t;this.modelService=o;this.languageService=n;this.editorWorkerService=r;this.pendingUpdates=new Map;this._store.add(e.registerTextModelContentProvider(Ox,this)),z1.INSTANCE=this}dispose(){this.pendingUpdates.forEach(e=>e.dispose()),super.dispose()}provideTextContent(e){return this.createOrUpdateContentModel(e,!0)}static refreshDebugContent(e){z1.INSTANCE?.createOrUpdateContentModel(e,!1)}createOrUpdateContentModel(e,t){let o=this.modelService.getModel(e);if(!o&&!t)return null;let n;if(e.query){let s=J2.getEncodedDebugData(e);n=this.debugService.getModel().getSession(s.sessionId)}if(n||(n=this.debugService.getViewModel().focusedSession),!n)return Promise.reject(new ka(d(11089,null)));let r=s=>{this.debugService.sourceIsNotAvailable(e);let l=this.languageService.createById(es),c=s?d(11088,null,e.path,s):d(11087,null,e.path);return this.modelService.createModel(c,l,e)};return n.loadSource(e).then(s=>{if(s&&s.body)if(o){let l=s.body.content;this.pendingUpdates.get(o.id)?.cancel();let u=new qe;return this.pendingUpdates.set(o.id,u),this.editorWorkerService.computeMoreMinimalEdits(o.uri,[{text:l,range:o.getFullModelRange()}]).then(p=>(this.pendingUpdates.delete(o.id),!u.token.isCancellationRequested&&p&&p.length>0&&o.applyEdits(p.map(h=>Qn.replace(G.lift(h.range),h.text))),o))}else{let l=s.body.mimeType||aLe(e)[0],c=this.languageService.createByMimeType(l);return this.modelService.createModel(s.body.content,c,e)}return r()},s=>r(s.message))}};z1=I([m(0,Bt),m(1,Hi),m(2,_t),m(3,Rt),m(4,Qs)],z1);var tKe=class{constructor(i,e,t,o){this.debugService=e;this.configurationService=t;this.dialogService=o;this.disposable=i.onBeforeShutdown(async n=>n.veto(this.shouldVetoShutdown(n.reason),"veto.debug"))}shouldVetoShutdown(i){let e=this.debugService.getModel().getSessions().filter(o=>o.parentSession===void 0);return e.length===0||this.configurationService.getValue("debug").confirmOnExit==="never"?!1:this.showWindowCloseConfirmation(e.length)}dispose(){return this.disposable.dispose()}async showWindowCloseConfirmation(i){let e;return i===1?e=d(11102,null):e=d(11101,null),!(await this.dialogService.confirm({message:e,type:"warning",primaryButton:d(11103,null)})).confirmed}};tKe=I([m(0,to),m(1,Hi),m(2,B),m(3,ct)],tKe);var FSe=class extends k{static{this.ID="debug.replAccessibilityAnnouncer"}constructor(i,e,t){super();let o=i.getViewModel(),n=this._register(new ue);this._register(o.onDidFocusSession(r=>{n.clear(),r&&(n.value=r.onDidChangeReplElements(s=>{if(!s||!("originalExpression"in s))return;let l=s.toString();e.status(l),t.trace("ReplAccessibilityAnnouncer#onDidChangeReplElements",s.originalExpression+": "+l)}))}))}};FSe=I([m(0,Hi),m(1,Ai),m(2,re)],FSe);var $No="debug.actionswidgetposition",jNo="debug.actionswidgety",iKe=class extends ju{constructor(e,t,o,n,r,s,l,c,u,p){super(l);this.notificationService=e;this.telemetryService=t;this.debugService=o;this.layoutService=n;this.storageService=r;this.configurationService=s;this.instantiationService=c;this.isVisible=!1;this.isBuilt=!1;this.stopActionViewItemDisposables=this._register(new O);this.auxWindowCoordinates=new WeakMap;this.trackPixelRatioListener=this._register(new ue);this.$el=_("div.debug-toolbar");let h=oJ(this.configurationService)==="custom",g=h&&xm===1,f=h&&(xm===3||xm===2);this.$el.style.transform=`translate(
			min(
				max(${g?"60px":"0px"}, calc(-50% + (100vw * var(--x-position)))),
				calc(100vw - 100% - ${f?"100px":"0px"})
			),
			var(--y-position)
		)`,this.dragArea=D(this.$el,_("div.drag-area"+q.asCSSSelector(iyo)));let v=D(this.$el,_("div.action-bar-container"));this.debugToolBarMenu=u.createMenu(R.DebugToolBar,p),this._register(this.debugToolBarMenu),this.activeActions=[],this.actionBar=this._register(new oo(v,{orientation:0,actionViewItemProvider:(b,S)=>{if(b.id===qWe)return this.instantiationService.createInstance(z$,b,void 0);if(b.id===V_||b.id===MP){this.stopActionViewItemDisposables.clear();let y=this.instantiationService.invokeFunction(w=>Fut(b,this.stopActionViewItemDisposables,w,{hoverDelegate:S.hoverDelegate}));if(y)return y}return ta(this.instantiationService,b,S)}})),this.updateScheduler=this._register(new Dt(()=>{let b=this.debugService.state,S=this.configurationService.getValue("debug").toolBarLocation;if(b===0||S!=="floating"||this.debugService.getModel().getSessions().every(w=>w.suppressDebugToolbar)||b===1&&this.debugService.initializingOptions?.suppressDebugToolbar)return this.hide();let y=Ng(this.debugToolBarMenu.getActions({shouldForwardArgs:!0}));eo(y,this.activeActions,(w,x)=>w.id===x.id&&w.enabled===x.enabled)||(this.actionBar.clear(),this.actionBar.push(y,{icon:!0,label:!1}),this.activeActions=y),this.show()},20)),this.updateStyles(),this.registerListeners(),this.hide()}registerListeners(){this._register(this.debugService.onDidChangeState(()=>this.updateScheduler.schedule())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("debug.toolBarLocation")&&this.updateScheduler.schedule(),(e.affectsConfiguration("workbench.editor.showTabs")||e.affectsConfiguration("window.commandCenter"))&&(this._yRange=void 0,this.setCoordinates())})),this._register(this.debugToolBarMenu.onDidChange(()=>this.updateScheduler.schedule())),this._register(this.actionBar.actionRunner.onDidRun(e=>{e.error&&!Yi(e.error)&&this.notificationService.warn(e.error),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"debugActionsWidget"})})),this._register(Yle(this.dragArea,e=>{new Ln(Me(this.dragArea),e).detail===2&&(this.setCoordinates(.5,this.yDefault),this.storePosition())})),this._register(ML(this.dragArea,e=>{this.dragArea.classList.add("dragged");let t=Me(this.layoutService.activeContainer),o=new Ln(t,e),n=this.computeCurrentXPercent(),r=this.getCurrentYPosition(),s=Lwe(t,c=>{let u=new Ln(t,c);u.preventDefault(),this.setCoordinates(n+(u.posx-o.posx)/t.innerWidth,r+u.posy-o.posy)}),l=Yle(t,c=>{this.storePosition(),this.dragArea.classList.remove("dragged"),s.dispose(),l.dispose()})})),this._register(this.layoutService.onDidChangePartVisibility(()=>this.setCoordinates())),this._register(this.layoutService.onDidChangeActiveContainer(async()=>{this._yRange=void 0,await this.layoutService.whenContainerStylesLoaded(Me(this.layoutService.activeContainer)),this.isBuilt&&(this.doShowInActiveContainer(),this.setCoordinates())}))}computeCurrentXPercent(){let{left:e,width:t}=this.$el.getBoundingClientRect();return(e+t/2)/Me(this.$el).innerWidth}getCurrentXPercent(){return Number(this.$el.style.getPropertyValue("--x-position"))}getCurrentYPosition(){return parseInt(this.$el.style.getPropertyValue("--y-position"))}storePosition(){let e=Me(this.layoutService.activeContainer),t=this.layoutService.activeContainer===this.layoutService.mainContainer,o=this.getCurrentXPercent(),n=this.getCurrentYPosition();t?(this.storageService.store($No,o,0,1),this.storageService.store(jNo,n,0,1)):this.auxWindowCoordinates.set(e,{x:o,y:n})}updateStyles(){if(super.updateStyles(),this.$el){this.$el.style.backgroundColor=this.getColor(fyo)||"";let e=this.getColor(SD),t=this.getColor(vyo);e?this.$el.style.border=`1px solid ${e}`:(this.$el.style.border=t?`solid ${t}`:"none",this.$el.style.border="1px 0")}}getStoredXPosition(){let e=Me(this.layoutService.activeContainer),o=e===ut?Number(this.storageService.get($No,0)):this.auxWindowCoordinates.get(e)?.x;return o!==void 0&&!isNaN(o)?o:.5}getStoredYPosition(){let e=Me(this.layoutService.activeContainer);return(e===ut?this.storageService.getNumber(jNo,0):this.auxWindowCoordinates.get(e)?.y)??this.yDefault}setCoordinates(e,t){if(!this.isVisible)return;e??=this.getStoredXPosition(),t??=this.getStoredYPosition();let[o,n]=this.yRange;t=Math.max(o,Math.min(t,n)),this.$el.style.setProperty("--x-position",`${e}`),this.$el.style.setProperty("--y-position",`${t}px`)}get yDefault(){return this.layoutService.mainContainerOffset.top}get yRange(){if(!this._yRange){let e=this.layoutService.isVisible("workbench.parts.titlebar",Me(this.layoutService.activeContainer)),t=e?0:this.layoutService.mainContainerOffset.top,o=0;e&&(this.configurationService.getValue("window.commandCenter")===!0?o+=35:o+=28),this.configurationService.getValue("workbench.editor.showTabs")!=="none"&&(o+=35),this._yRange=[t,o]}return this._yRange}show(){if(this.isVisible){this.setCoordinates();return}this.isBuilt||(this.isBuilt=!0,this.doShowInActiveContainer()),this.isVisible=!0,Xo(this.$el),this.setCoordinates()}doShowInActiveContainer(){this.layoutService.activeContainer.appendChild(this.$el),this.trackPixelRatioListener.value=Gu.getInstance(Me(this.$el)).onDidChange(()=>this.setCoordinates())}hide(){this.isVisible=!1,Wi(this.$el)}dispose(){super.dispose(),this.$el?.remove()}};iKe=I([m(0,Ne),m(1,_e),m(2,Hi),m(3,wi),m(4,de),m(5,B),m(6,Pe),m(7,F),m(8,Yt),m(9,X)],iKe);function Fut(a,i,e,t){let o=e.get(Yt),n=e.get(X),r=e.get(F),s=o.getMenuActions(R.DebugToolBarStop,n,{shouldForwardArgs:!0}),l=Ng(s);if(!l.length)return;let c=i.add(new it("notebook.moreRunActions",d(10880,null),"codicon-chevron-down",!0));return r.createInstance(BC,a,c,l,"debug-stop-actions",t)}var czi=new O,K1=(a,i,e,t,o,n,r)=>{be.appendMenuItem(R.DebugToolBar,{group:"navigation",when:o,order:e,command:{id:a,title:i,icon:t,precondition:n},alt:r}),czi.add(be.appendMenuItem(R.ViewContainerTitle,{group:"navigation",when:C.and(o,C.equals("viewContainer",$g),ca.notEqualsTo("inactive"),C.equals("config.debug.toolBarLocation","docked")),order:e,command:{id:a,title:i,icon:t,precondition:n}}))};bp(be.onDidChangeMenu(a=>{if(a.has(R.DebugToolBar)){czi.clear();let i=be.getMenuItems(R.DebugToolBar);for(let e of i)czi.add(be.appendMenuItem(R.ViewContainerTitle,{...e,when:C.and(e.when,C.equals("viewContainer",$g),ca.notEqualsTo("inactive"),C.equals("config.debug.toolBarLocation","docked"))}))}}));var QNo=C.equals("config.debug.toolBarLocation","commandCenter");be.appendMenuItem(R.CommandCenterCenter,{submenu:R.DebugToolBar,title:"Debug",icon:L.debug,order:1,when:C.and(vl,QNo)});K1(s$,Mne,10,tfe,ca.isEqualTo("stopped"));K1(D6,Lne,10,efe,ca.notEqualsTo("stopped"),C.and(ca.isEqualTo("running"),j2.toNegated()));K1(V_,l$,70,NQ,Nx.toNegated(),void 0,{id:MP,title:M6,icon:tV,precondition:C.and(Nx.toNegated(),lN)});K1(MP,M6,70,tV,Nx,void 0,{id:V_,title:l$,icon:NQ,precondition:C.and(Nx,lN)});K1(o$,_ne,20,Zge,void 0,ca.isEqualTo("stopped"));K1(n$,Dne,30,Zie,void 0,ca.isEqualTo("stopped"));K1(r$,Rne,40,eoe,void 0,ca.isEqualTo("stopped"));K1(i$,Tne,60,Jge);K1(ANi,d(10882,null),50,Hnt,wXe,ca.isEqualTo("stopped"));K1(PNi,d(10881,null),55,Unt,wXe,ca.isEqualTo("stopped"));K1(qWe,JEo,100,L.listTree,C.and(MAt,QNo.negate()));be.appendMenuItem(R.DebugToolBarStop,{group:"navigation",when:C.and(Nx.toNegated(),lN),order:0,command:{id:MP,title:M6,icon:tV}});be.appendMenuItem(R.DebugToolBarStop,{group:"navigation",when:C.and(Nx,lN),order:0,command:{id:V_,title:l$,icon:NQ}});be.appendMenuItem(R.DebugToolBarStop,{group:"navigation",when:C.or(C.and(Nx.toNegated(),jZ,lN),C.and(Nx,jZ)),order:0,command:{id:GWe,title:aat,icon:tV}});var Ck=_;function XNo(a){return{sessionId:a.getId()}}function JNo(a){return{...XNo(a.session),threadId:a.getId()}}function rkn(a){return{...JNo(a.thread),frameId:a.getId(),frameName:a.name,frameLocation:{range:a.range,source:a.source.raw}}}function fzi(a){return a instanceof a_?rkn(a):a instanceof uN?JNo(a):G1(a)?XNo(a):void 0}function vzi(a){return a instanceof a_?a.source.inMemory?a.source.raw.path||a.source.reference||a.source.name:a.source.uri.toString():a instanceof uN?a.threadId:G1(a)?a.getId():""}function ZNo(a){let i=a.thread.getStaleCallStack();i=i.length>0?i:a.thread.getCallStack();let e=i.map(n=>n.source).filter(n=>n!==a.source),t=0;if(e.forEach(n=>{n.name===a.source.name&&(t=Math.max(t,lx(a.source.uri.path,n.uri.path)))}),t===0)return a.source.name;let o=Math.max(0,a.source.uri.path.lastIndexOf(Vo.sep,a.source.uri.path.length-t-1));return(o>0?"...":"")+a.source.uri.path.substring(o)}async function dzi(a,i){a.parentSession&&await dzi(a.parentSession,i),await i.expand(a)}var oKe=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(e,n,t,l,c,s,r,u,p,h);this.options=e;this.debugService=o;this.menuService=g;this.needsRefresh=!1;this.ignoreSelectionChangedEvent=!1;this.ignoreFocusStackFrameEvent=!1;this.autoExpandedSessions=new Set;this.selectionNeedsUpdate=!1;this.onCallStackChangeScheduler=this._register(new Dt(async()=>{let f=this.debugService.getModel().getSessions();f.length===0&&this.autoExpandedSessions.clear();let v=f.length===1&&f[0].getAllThreads().length===1?f[0].getAllThreads()[0]:void 0,b=f.length===1?f[0].getStoppedDetails():void 0;b&&(v||typeof b.threadId!="number")?(this.stateMessageLabel.textContent=U6t(b),this.stateMessageLabelHover.update(pzi(b)),this.stateMessageLabel.classList.toggle("exception",b.reason==="exception"),this.stateMessage.hidden=!1):f.length===1&&f[0].state===3?(this.stateMessageLabel.textContent=d(10528,null),this.stateMessageLabelHover.update(f[0].getLabel()),this.stateMessageLabel.classList.remove("exception"),this.stateMessage.hidden=!1):this.stateMessage.hidden=!0,this.updateActions(),this.needsRefresh=!1,await this.tree.updateChildren();try{let S=new Set;f.forEach(y=>{y.parentSession&&!this.autoExpandedSessions.has(y.parentSession)&&S.add(y.parentSession)});for(let y of S)await dzi(y,this.tree),this.autoExpandedSessions.add(y)}catch{}this.selectionNeedsUpdate&&(this.selectionNeedsUpdate=!1,await this.updateTreeSelection())},50))}renderHeaderTitle(e){super.renderHeaderTitle(e,this.options.title),this.stateMessage=D(e,Ck("span.call-stack-state-message")),this.stateMessage.hidden=!0,this.stateMessageLabel=D(this.stateMessage,Ck("span.label")),this.stateMessageLabelHover=this._register(this.hoverService.setupManagedHover(yi("mouse"),this.stateMessage,""))}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-call-stack");let t=vne(e);this.dataSource=new mzi(this.debugService),this.tree=this.instantiationService.createInstance(qy,"CallStackView",t,new uzi,new gzi(this.debugService),[this.instantiationService.createInstance(wse),this.instantiationService.createInstance(Cse),this.instantiationService.createInstance(xse),this.instantiationService.createInstance(kse),new nKe,new H6t],this.dataSource,{accessibilityProvider:new hzi,compressionEnabled:!0,autoExpandSingleChildren:!0,identityProvider:{getId:n=>typeof n=="string"?n:n instanceof Array?`showMore ${n[0].getId()}`:n.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:n=>G1(n)?n.getLabel():n instanceof uN?`${n.name} ${n.stateLabel}`:n instanceof a_||typeof n=="string"?n:n instanceof XZ?nKe.LABEL:d(10533,null),getCompressedNodeKeyboardNavigationLabel:n=>{let r=n[0];return G1(r)?r.getLabel():""}},expandOnlyOnTwistieClick:!0,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),Rlo.bindTo(this.tree.contextKeyService),this.tree.setInput(this.debugService.getModel()),this._register(this.tree),this._register(this.tree.onDidOpen(async n=>{if(this.ignoreSelectionChangedEvent)return;let r=(l,c,u,p={})=>{this.ignoreFocusStackFrameEvent=!0;try{this.debugService.focusStackFrame(l,c,u,{...p,explicit:!0})}finally{this.ignoreFocusStackFrameEvent=!1}},s=n.element;if(s instanceof a_){let l={preserveFocus:n.editorOptions.preserveFocus,sideBySide:n.sideBySide,pinned:n.editorOptions.pinned};r(s,s.thread,s.thread.session,l)}if(s instanceof uN&&r(void 0,s,s.session),G1(s)&&r(void 0,void 0,s),s instanceof XZ){let l=this.debugService.getModel().getSession(s.sessionId),c=l&&l.getThread(s.threadId);if(c){let u=c.stoppedDetails?.totalFrames,p=typeof u=="number"?u-c.getCallStack().length:void 0;await c.fetchCallStack(p),await this.tree.updateChildren()}}s instanceof Array&&(s.forEach(l=>this.dataSource.deemphasizedStackFramesToShow.add(l)),this.tree.updateChildren())})),this._register(this.debugService.getModel().onDidChangeCallStack(()=>{if(!this.isBodyVisible()){this.needsRefresh=!0;return}this.onCallStackChangeScheduler.isScheduled()||this.onCallStackChangeScheduler.schedule()}));let o=U.any(this.debugService.getViewModel().onDidFocusStackFrame,this.debugService.getViewModel().onDidFocusSession);this._register(o(async()=>{if(!this.ignoreFocusStackFrameEvent){if(!this.isBodyVisible()){this.needsRefresh=!0,this.selectionNeedsUpdate=!0;return}if(this.onCallStackChangeScheduler.isScheduled()){this.selectionNeedsUpdate=!0;return}await this.updateTreeSelection()}})),this._register(this.tree.onContextMenu(n=>this.onContextMenu(n))),this.debugService.state===2&&this.onCallStackChangeScheduler.schedule(0),this._register(this.onDidChangeBodyVisibility(n=>{n&&this.needsRefresh&&this.onCallStackChangeScheduler.schedule()})),this._register(this.debugService.onDidNewSession(n=>{let r=[];r.push(n.onDidChangeName(()=>{this.tree.hasNode(n)&&this.tree.rerender(n)})),r.push(n.onDidEndAdapter(()=>je(r))),n.parentSession&&this.autoExpandedSessions.delete(n.parentSession)}))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}collapseAll(){this.tree.collapseAll()}async updateTreeSelection(){if(!this.tree||!this.tree.getInput())return;let e=r=>{this.ignoreSelectionChangedEvent=!0;try{this.tree.setSelection([r]),this.tree.getRelativeTop(r)===null?this.tree.reveal(r,.5):this.tree.reveal(r)}catch{}finally{this.ignoreSelectionChangedEvent=!1}},t=this.debugService.getViewModel().focusedThread,o=this.debugService.getViewModel().focusedSession,n=this.debugService.getViewModel().focusedStackFrame;if(!t)o?e(o):this.tree.setSelection([]);else{try{await dzi(t.session,this.tree)}catch{}try{await this.tree.expand(t)}catch{}let r=n||o;r&&e(r)}}onContextMenu(e){let t=e.element,o=[];G1(t)?o=eOo(t):t instanceof uN?o=tOo(t):t instanceof a_&&(o=skn(t));let n=this.contextKeyService.createOverlay(o),r=this.menuService.getMenuActions(R.DebugCallStackContext,n,{arg:vzi(t),shouldForwardArgs:!0}),s=um(r,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s.secondary,getActionsContext:()=>fzi(t)})}};oKe=I([m(1,Xe),m(2,Hi),m(3,Le),m(4,F),m(5,ji),m(6,B),m(7,X),m(8,Je),m(9,Pe),m(10,ot),m(11,Yt)],oKe);function eOo(a){return[[ub.key,"session"],[kAt.key,jpe(a)],[zZ.key,a.state===2],[oIi.key,a.getAllThreads().length===1]]}var wse=class{constructor(i,e,t,o){this.instantiationService=i;this.contextKeyService=e;this.hoverService=t;this.menuService=o}static{this.ID="session"}get templateId(){return wse.ID}renderTemplate(i){let e=D(i,Ck(".session"));D(e,Ck(q.asCSSSelector(ryo)));let t=D(e,Ck(".name")),o=D(e,Ck("span.state.label.monaco-count-badge.long")),n=new O,r=n.add(new ul(t)),s=n.add(new O),l=n.add(new oo(e,{actionViewItemProvider:(u,p)=>{if((u.id===V_||u.id===MP)&&u instanceof Do){s.clear();let h=this.instantiationService.invokeFunction(g=>Fut(u,s,g,{...p,menuAsChild:!1}));if(h)return h}if(u instanceof Do)return this.instantiationService.createInstance(Cl,u,{hoverDelegate:p.hoverDelegate});if(u instanceof id)return this.instantiationService.createInstance(FT,u,{hoverDelegate:p.hoverDelegate})}})),c=n.add(new O);return{session:e,name:t,stateLabel:o,label:r,actionBar:l,elementDisposable:c,templateDisposable:n}}renderElement(i,e,t){this.doRenderElement(i.element,Wa(i.filterData),t)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1],n=Wa(i.filterData);this.doRenderElement(o,n,t)}doRenderElement(i,e,t){let o=t.elementDisposable.add(this.hoverService.setupManagedHover(yi("mouse"),t.session,d(10529,null)));t.label.set(i.getLabel(),e);let n=i.getStoppedDetails(),r=i.getAllThreads().find(u=>u.stopped),s=this.contextKeyService.createOverlay(eOo(i)),l=t.elementDisposable.add(this.menuService.createMenu(R.DebugCallStackContext,s)),c=()=>{t.actionBar.clear();let{primary:u}=xl(l.getActions({arg:vzi(i),shouldForwardArgs:!0}),"inline");t.actionBar.push(u,{icon:!0,label:!1}),t.actionBar.context=fzi(i)};t.elementDisposable.add(l.onDidChange(()=>c())),c(),t.stateLabel.style.display="",n?(t.stateLabel.textContent=U6t(n),o.update(`${i.getLabel()}: ${pzi(n)}`),t.stateLabel.classList.toggle("exception",n.reason==="exception")):r&&r.stoppedDetails?(t.stateLabel.textContent=U6t(r.stoppedDetails),o.update(`${i.getLabel()}: ${pzi(r.stoppedDetails)}`),t.stateLabel.classList.toggle("exception",r.stoppedDetails.reason==="exception")):(t.stateLabel.textContent=d(10528,null),t.stateLabel.classList.remove("exception"))}disposeTemplate(i){i.templateDisposable.dispose()}disposeElement(i,e,t){t.elementDisposable.clear()}disposeCompressedElements(i,e,t){t.elementDisposable.clear()}};wse=I([m(0,F),m(1,X),m(2,ot),m(3,Yt)],wse);function tOo(a){return[[ub.key,"thread"],[zZ.key,a.stopped]]}var Cse=class{constructor(i,e,t){this.contextKeyService=i;this.hoverService=e;this.menuService=t}static{this.ID="thread"}get templateId(){return Cse.ID}renderTemplate(i){let e=D(i,Ck(".thread")),t=D(e,Ck(".name")),o=D(e,Ck("span.state.label.monaco-count-badge.long")),n=new O,r=n.add(new ul(t)),s=n.add(new oo(e)),l=n.add(new O);return{thread:e,name:t,stateLabel:o,label:r,actionBar:s,elementDisposable:l,templateDisposable:n}}renderElement(i,e,t){let o=i.element;t.elementDisposable.add(this.hoverService.setupManagedHover(yi("mouse"),t.thread,o.name)),t.label.set(o.name,Wa(i.filterData)),t.stateLabel.textContent=o.stateLabel,t.stateLabel.classList.toggle("exception",o.stoppedDetails?.reason==="exception");let n=this.contextKeyService.createOverlay(tOo(o)),r=t.elementDisposable.add(this.menuService.createMenu(R.DebugCallStackContext,n)),s=()=>{t.actionBar.clear();let{primary:l}=xl(r.getActions({arg:vzi(o),shouldForwardArgs:!0}),"inline");t.actionBar.push(l,{icon:!0,label:!1}),t.actionBar.context=fzi(o)};t.elementDisposable.add(r.onDidChange(()=>s())),s()}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeElement(i,e,t){t.elementDisposable.clear()}disposeTemplate(i){i.templateDisposable.dispose()}};Cse=I([m(0,X),m(1,ot),m(2,Yt)],Cse);function skn(a){return[[ub.key,"stackFrame"],[_At.key,a.canRestart]]}var xse=class{constructor(i,e,t){this.hoverService=i;this.labelService=e;this.notificationService=t}static{this.ID="stackFrame"}get templateId(){return xse.ID}renderTemplate(i){let e=D(i,Ck(".stack-frame")),t=D(e,Ck("span.label.expression")),o=D(e,Ck(".file")),n=D(o,Ck("span.file-name")),r=D(o,Ck("span.line-number-wrapper")),s=D(r,Ck("span.line-number.monaco-count-badge")),l=new O,c=new O;l.add(c);let u=l.add(new ul(t)),p=l.add(new oo(e));return{file:o,fileName:n,label:u,lineNumber:s,stackFrame:e,actionBar:p,templateDisposable:l,elementDisposables:c}}renderElement(i,e,t){let o=i.element;t.stackFrame.classList.toggle("disabled",!o.source||!o.source.available||X2(o)),t.stackFrame.classList.toggle("label",o.presentationHint==="label");let n=!!o.thread.session.capabilities.supportsRestartFrame&&o.presentationHint!=="label"&&o.presentationHint!=="subtle"&&o.canRestart;t.stackFrame.classList.toggle("has-actions",n);let r=o.source.inMemory?o.source.uri.path:this.labelService.getUriLabel(o.source.uri);if(o.source.raw.origin&&(r+=`
${o.source.raw.origin}`),t.elementDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),t.file,r)),t.label.set(o.name,Wa(i.filterData),o.name),t.fileName.textContent=ZNo(o),o.range.startLineNumber!==void 0?(t.lineNumber.textContent=`${o.range.startLineNumber}`,o.range.startColumn&&(t.lineNumber.textContent+=`:${o.range.startColumn}`),t.lineNumber.classList.remove("unavailable")):t.lineNumber.classList.add("unavailable"),t.actionBar.clear(),n){let s=t.elementDisposables.add(new it("debug.callStack.restartFrame",d(10527,null),q.asClassName(Bnt),!0,async()=>{try{await o.restart()}catch(l){this.notificationService.error(l)}}));t.actionBar.push(s,{icon:!0,label:!1})}}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.templateDisposable.dispose()}};xse=I([m(0,ot),m(1,nt),m(2,Ne)],xse);var kse=class{constructor(i){this.hoverService=i}static{this.ID="error"}get templateId(){return kse.ID}renderTemplate(i){return{label:D(i,Ck(".error")),templateDisposable:new O}}renderElement(i,e,t){let o=i.element;t.label.textContent=o,t.templateDisposable.add(this.hoverService.setupManagedHover(yi("mouse"),t.label,o))}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}};kse=I([m(0,ot)],kse);var nKe=class a{static{this.ID="loadMore"}static{this.LABEL=d(10524,null)}constructor(){}get templateId(){return a.ID}renderTemplate(i){let e=D(i,Ck(".load-all"));return e.style.color=Tt(AS),{label:e}}renderElement(i,e,t){t.label.textContent=a.LABEL}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}},H6t=class a{static{this.ID="showMore"}constructor(){}get templateId(){return a.ID}renderTemplate(i){let e=D(i,Ck(".show-more"));return e.style.color=Tt(AS),{label:e}}renderElement(i,e,t){let o=i.element;o.every(n=>!!(n.source&&n.source.origin&&n.source.origin===o[0].source.origin))?t.label.textContent=d(10531,null,o.length,o[0].source.origin):t.label.textContent=d(10532,null,o.length)}renderCompressedElements(i,e,t){throw new Error("Method not implemented.")}disposeTemplate(i){}},uzi=class{getHeight(i){return i instanceof a_&&i.presentationHint==="label"||i instanceof XZ||i instanceof Array?16:22}getTemplateId(i){return G1(i)?wse.ID:i instanceof uN?Cse.ID:i instanceof a_?xse.ID:typeof i=="string"?kse.ID:i instanceof XZ?nKe.ID:H6t.ID}};function pzi(a){return a.text??U6t(a)}function U6t(a){return a.description||(a.reason?d(10526,null,a.reason):d(10525,null))}function YNo(a){return!!a&&typeof a.getSessions=="function"}function G1(a){return!!a&&typeof a.getAllThreads=="function"}var mzi=class{constructor(i){this.debugService=i;this.deemphasizedStackFramesToShow=new WeakSet}hasChildren(i){if(G1(i)){let e=i.getAllThreads();return e.length>1||e.length===1&&e[0].stopped||!!this.debugService.getModel().getSessions().find(t=>t.parentSession===i)}return YNo(i)||i instanceof uN&&i.stopped}async getChildren(i){if(YNo(i)){let e=i.getSessions();if(e.length===0)return Promise.resolve([]);if(e.length>1||this.debugService.getViewModel().isMultiSessionView())return Promise.resolve(e.filter(o=>!o.parentSession));let t=e[0].getAllThreads();return t.length===1?this.getThreadChildren(t[0]):Promise.resolve(t)}else if(G1(i)){let e=this.debugService.getModel().getSessions().filter(o=>o.parentSession===i),t=i.getAllThreads();return t.length===1?(await this.getThreadChildren(t[0])).concat(e):Promise.resolve(t.concat(e))}else return this.getThreadChildren(i)}getThreadChildren(i){return this.getThreadCallstack(i).then(e=>{let t=[];return e.forEach((o,n)=>{if(o instanceof a_&&o.source&&X2(o)&&!this.deemphasizedStackFramesToShow.has(o)){if(t.length){let s=t[t.length-1];if(s instanceof Array){s.push(o);return}}let r=n<e.length-1?e[n+1]:void 0;if(r instanceof a_&&r.source&&X2(r)){t.push([o]);return}}t.push(o)}),t})}async getThreadCallstack(i){let e=i.getCallStack();return(!e||!e.length)&&(await i.fetchCallStack(),e=i.getCallStack()),e.length===1&&i.session.capabilities.supportsDelayedStackTraceLoading&&i.stoppedDetails&&i.stoppedDetails.totalFrames&&i.stoppedDetails.totalFrames>1&&(e=e.concat(i.getStaleCallStack().slice(1))),i.stoppedDetails&&i.stoppedDetails.framesErrorMessage&&(e=e.concat([i.stoppedDetails.framesErrorMessage])),!i.reachedEndOfCallStack&&i.stoppedDetails&&(e=e.concat([new XZ(i.session.getId(),i.threadId)])),e}},hzi=class{getWidgetAriaLabel(){return d(10522,null)}getWidgetRole(){return"treegrid"}getRole(i){return"row"}getAriaLabel(i){if(i instanceof uN)return d(10535,null,i.name,i.stateLabel);if(i instanceof a_)return d(10534,null,i.name,i.range.startLineNumber,ZNo(i));if(G1(i)){let e=i.getAllThreads().find(o=>o.stopped),t=e?e.stateLabel:d(10528,null);return d(10530,null,i.getLabel(),t)}return typeof i=="string"?i:i instanceof Array?d(10532,null,i.length):nKe.LABEL}},gzi=class{constructor(i){this.debugService=i}isIncompressible(i){return G1(i)?!(i.compact||this.debugService.getModel().getSessions().some(t=>t.parentSession===i&&t.compact)):!0}};W(class extends rr{constructor(){super({id:"callStack.collapse",viewId:O3,title:d(10523,null),f1:!1,icon:L.collapseAll,precondition:ca.isEqualTo(HM(2)),menu:{id:R.ViewTitle,order:10,group:"navigation",when:C.equals("view",O3)}})}runInView(i,e){e.collapseAll()}});function Ese(a,i,e,t,o,n){be.appendMenuItem(R.DebugCallStackContext,{group:"inline",order:o,when:t,command:{id:a,title:i,icon:e,precondition:n}})}var Wut=C.or(ub.isEqualTo("thread"),C.and(ub.isEqualTo("session"),oIi));Ese(D6,Lne,efe,C.and(Wut,zZ.toNegated()),10,j2.toNegated());Ese(s$,Mne,tfe,C.and(Wut,zZ),10);Ese(o$,_ne,Zge,Wut,20,zZ);Ese(n$,Dne,Zie,Wut,30,zZ);Ese(r$,Rne,eoe,Wut,40,zZ);Ese(i$,Tne,Jge,ub.isEqualTo("session"),50);Ese(V_,l$,NQ,C.and(kAt.toNegated(),ub.isEqualTo("session")),60);Ese(MP,M6,tV,C.and(kAt,ub.isEqualTo("session")),60);var rKe=class extends cg{constructor(e,t,o){super(pat,{canAcceptInBackground:!0});this._debugService=e;this._viewsService=t;this._commandService=o}_getPicks(e,t,o){let n=[];this._debugService.getModel().getSessions(!0).filter(s=>s.hasSeparateRepl()).forEach((s,l)=>{let c=this._createPick(s,l,e);c&&n.push(c)}),n.length>0&&n.push({type:"separator"});let r=d(10733,null);return n.push({label:`$(plus) ${r}`,ariaLabel:r,accept:()=>this._commandService.executeCommand(R6)}),n}_createPick(e,t,o){let n=e.name,r=xh(o,n,!0);if(r)return{label:n,highlights:{label:r},accept:(s,l)=>{this._debugService.focusStackFrame(void 0,void 0,e,{explicit:!0}),this._viewsService.isViewVisible($d)||this._viewsService.openView($d,!0)}}}};rKe=I([m(0,Hi),m(1,Gt),m(2,fe)],rKe);var bzi={allowBreakpoint:!1,isBreakpointSet:!1,isBreakpointEnabled:!1,instructionReference:"",instructionOffset:0,instructionReferenceOffset:0,address:0n,instruction:{address:"-1",instruction:d(10893,null)}},$_=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p){super(IAt,e,t,o,n);this._configurationService=r;this._instantiationService=s;this._debugService=l;this._contextMenuService=c;this._instructionBpList=[];this._enableSourceCodeRender=!0;this._loadingLock=!1;this._referenceToMemoryAddress=new Map;this.menu=u.createMenu(R.DebugDisassemblyContext,p),this._register(this.menu),this._disassembledInstructions=void 0,this._onDidChangeStackFrame=this._register(new T({leakWarningThreshold:1e3,leakWarningName:"DisassemblyView._onDidChangeStackFrame"})),this._previousDebuggingState=l.state,this._register(r.onDidChangeConfiguration(h=>{if(h.affectsConfiguration("debug")){let g=this._configurationService.getValue("debug").disassemblyView.showSourceCode;this._enableSourceCodeRender!==g?this._enableSourceCodeRender=g:this._disassembledInstructions?.rerender()}}))}static{this.NUM_INSTRUCTIONS_TO_LOAD=50}get fontInfo(){return this._fontInfo||(this._fontInfo=this.createFontInfo(),this._register(this._configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("editor")&&(this._fontInfo=this.createFontInfo())}))),this._fontInfo}createFontInfo(){return RI(this._configurationService.getValue("editor"),Gu.getInstance(this.window).value)}get currentInstructionAddresses(){return this._debugService.getModel().getSessions(!1).map(e=>e.getAllThreads()).reduce((e,t)=>e.concat(t),[]).map(e=>e.getTopStackFrame()).map(e=>e?.instructionPointerReference).map(e=>e?this.getReferenceAddress(e):void 0)}get focusedCurrentInstructionReference(){return this._debugService.getViewModel().focusedStackFrame?.thread.getTopStackFrame()?.instructionPointerReference}get focusedCurrentInstructionAddress(){let e=this.focusedCurrentInstructionReference;return e?this.getReferenceAddress(e):void 0}get focusedInstructionReference(){return this._debugService.getViewModel().focusedStackFrame?.instructionPointerReference}get focusedInstructionAddress(){let e=this.focusedInstructionReference;return e?this.getReferenceAddress(e):void 0}get isSourceCodeRender(){return this._enableSourceCodeRender}get debugSession(){return this._debugService.getViewModel().focusedSession}get onDidChangeStackFrame(){return this._onDidChangeStackFrame.event}get focusedAddressAndOffset(){let e=this._disassembledInstructions?.getFocusedElements()[0];if(e)return this.getAddressAndOffset(e)}getAddressAndOffset(e){let t=e.instructionReference,o=Number(e.address-this.getReferenceAddress(t));return{reference:t,offset:o,address:e.address}}createEditor(e){this._enableSourceCodeRender=this._configurationService.getValue("debug").disassemblyView.showSourceCode;let t=this.fontInfo.lineHeight,o=this,n=new class{constructor(){this.headerRowHeight=0}getHeight(s){return o.isSourceCodeRender&&s.showSourceLocation&&s.instruction.location?.path&&s.instruction.line?s.instruction.endLine?t*Math.max(2,s.instruction.endLine-s.instruction.line+2):t*2:t}},r=this._register(this._instantiationService.createInstance(qV,this));this._disassembledInstructions=this._register(this._instantiationService.createInstance(Cx,"DisassemblyView",e,n,[{label:"",tooltip:"",weight:0,minimumWidth:this.fontInfo.lineHeight,maximumWidth:this.fontInfo.lineHeight,templateId:Tse.TEMPLATE_ID,project(s){return s}},{label:d(10888,null),tooltip:"",weight:.3,templateId:qV.TEMPLATE_ID,project(s){return s}}],[this._instantiationService.createInstance(Tse,this),r],{identityProvider:{getId:s=>s.instruction.address},horizontalScrolling:!1,overrideStyles:{listBackground:Bo},multipleSelectionSupport:!1,setRowLineHeight:!1,openOnSingleClick:!1,accessibilityProvider:new Szi,mouseSupport:!1})),this._disassembledInstructions.domNode.classList.add("disassembly-view"),this.focusedInstructionReference&&this.reloadDisassembly(this.focusedInstructionReference,0),this._register(this._disassembledInstructions.onDidScroll(s=>{if(this._disassembledInstructions?.row(0)!==bzi&&!this._loadingLock)if(s.oldScrollTop>s.scrollTop&&s.scrollTop<s.height){this._loadingLock=!0;let l=Math.floor(s.scrollTop/this.fontInfo.lineHeight);this.scrollUp_LoadDisassembledInstructions($_.NUM_INSTRUCTIONS_TO_LOAD).then(c=>{c>0&&this._disassembledInstructions.reveal(l+c,0)}).finally(()=>{this._loadingLock=!1})}else s.oldScrollTop<s.scrollTop&&s.scrollTop+s.height>s.scrollHeight-s.height&&(this._loadingLock=!0,this.scrollDown_LoadDisassembledInstructions($_.NUM_INSTRUCTIONS_TO_LOAD).finally(()=>{this._loadingLock=!1}))})),this._register(this._disassembledInstructions.onContextMenu(s=>this.onContextMenu(s))),this._register(this._debugService.getViewModel().onDidFocusStackFrame(({stackFrame:s})=>{this._disassembledInstructions&&s?.instructionPointerReference&&this.goToInstructionAndOffset(s.instructionPointerReference,0),this._onDidChangeStackFrame.fire()})),this._register(this._debugService.getModel().onDidChangeBreakpoints(s=>{if(s&&this._disassembledInstructions){let l=!1;s.added?.forEach(c=>{if(c instanceof YI){let u=this.getIndexFromReferenceAndOffset(c.instructionReference,c.offset);u>=0&&(this._disassembledInstructions.row(u).isBreakpointSet=!0,this._disassembledInstructions.row(u).isBreakpointEnabled=c.enabled,l=!0)}}),s.removed?.forEach(c=>{if(c instanceof YI){let u=this.getIndexFromReferenceAndOffset(c.instructionReference,c.offset);u>=0&&(this._disassembledInstructions.row(u).isBreakpointSet=!1,l=!0)}}),s.changed?.forEach(c=>{if(c instanceof YI){let u=this.getIndexFromReferenceAndOffset(c.instructionReference,c.offset);u>=0&&this._disassembledInstructions.row(u).isBreakpointEnabled!==c.enabled&&(this._disassembledInstructions.row(u).isBreakpointEnabled=c.enabled,l=!0)}}),this._instructionBpList=this._debugService.getModel().getInstructionBreakpoints();for(let c of this._instructionBpList)this.primeMemoryReference(c.instructionReference);l&&this._onDidChangeStackFrame.fire()}})),this._register(this._debugService.onDidChangeState(s=>{(s===3||s===2)&&this._previousDebuggingState!==3&&this._previousDebuggingState!==2&&(this.clear(),this._enableSourceCodeRender=this._configurationService.getValue("debug").disassemblyView.showSourceCode),this._previousDebuggingState=s,this._onDidChangeStackFrame.fire()}))}layout(e){this._disassembledInstructions?.layout(e.height)}async goToInstructionAndOffset(e,t,o){let n=this._referenceToMemoryAddress.get(e);n===void 0&&(await this.loadDisassembledInstructions(e,0,-$_.NUM_INSTRUCTIONS_TO_LOAD,$_.NUM_INSTRUCTIONS_TO_LOAD*2),n=this._referenceToMemoryAddress.get(e)),n&&this.goToAddress(n+BigInt(t),o)}getReferenceAddress(e){return this._referenceToMemoryAddress.get(e)}goToAddress(e,t){if(!this._disassembledInstructions||!e)return!1;let o=this.getIndexFromAddress(e);return o>=0?(this._disassembledInstructions.reveal(o),t&&(this._disassembledInstructions.domFocus(),this._disassembledInstructions.setFocus([o])),!0):!1}async scrollUp_LoadDisassembledInstructions(e){let t=this._disassembledInstructions?.row(0);return t?this.loadDisassembledInstructions(t.instructionReference,t.instructionReferenceOffset,t.instructionOffset-e,e):0}async scrollDown_LoadDisassembledInstructions(e){let t=this._disassembledInstructions?.row(this._disassembledInstructions?.length-1);return t?this.loadDisassembledInstructions(t.instructionReference,t.instructionReferenceOffset,t.instructionOffset+1,e):0}async primeMemoryReference(e){if(this._referenceToMemoryAddress.has(e))return!0;let t=await this.debugSession?.disassemble(e,0,0,1);if(t&&t.length>0)try{return this._referenceToMemoryAddress.set(e,BigInt(t[0].address)),!0}catch{return!1}return!1}async loadDisassembledInstructions(e,t,o,n){let r=this.debugSession,s=await r?.disassemble(e,t,o,n);if(!this._referenceToMemoryAddress.has(e)&&o!==0&&await this.loadDisassembledInstructions(e,0,0,$_.NUM_INSTRUCTIONS_TO_LOAD),r&&s&&this._disassembledInstructions){let l=[],c,u;for(let N=0;N<s.length;N++){let V=s[N],H=o+N;if(V.location&&(c=V.location,u=void 0),V.line){let J={startLineNumber:V.line,startColumn:V.column??0,endLineNumber:V.endLine??V.line,endColumn:V.endColumn??0};G.equalsRange(J,u??null)||(u=J,V.location=c)}let K;try{K=BigInt(V.address)}catch{console.error(`Could not parse disassembly address ${V.address} (in ${JSON.stringify(V)})`);continue}if(K===-1n)continue;let j={allowBreakpoint:!0,isBreakpointSet:!1,isBreakpointEnabled:!1,instructionReference:e,instructionReferenceOffset:t,instructionOffset:H,instruction:V,address:K};l.push(j),t===0&&H===0&&this._referenceToMemoryAddress.set(e,K)}if(l.length===0)return 0;let p=this._referenceToMemoryAddress.get(e),h=this._instructionBpList.map(N=>{let V=this._referenceToMemoryAddress.get(N.instructionReference);if(V)return{enabled:N.enabled,address:V+BigInt(N.offset||0)}});if(p!==void 0)for(let N of l){let V=h.find(H=>H?.address===N.address);V&&(N.isBreakpointSet=!0,N.isBreakpointEnabled=V.enabled)}let g=this._disassembledInstructions;g.length===1&&this._disassembledInstructions.row(0)===bzi&&g.splice(0,1);let f=l[0].address,v=l[l.length-1].address,b=cA(g.length,N=>Number(g.row(N).address-f)),S=b<0?~b:b,y=cA(g.length,N=>Number(g.row(N).address-v)),x=(y<0?~y:y+1)-S,E;for(let N=S-1;N>=0;N--){let{instruction:V}=g.row(N);if(V.location&&V.line!==void 0){E=V;break}}let M=N=>N.line!==void 0&&N.location!==void 0&&(!E||!qlo(N.location,E.location)||N.line!==E.line);for(let N of l)M(N.instruction)&&(N.showSourceLocation=!0,E=N.instruction);return g.splice(S,x,l),l.length-x}return 0}getIndexFromReferenceAndOffset(e,t){let o=this._referenceToMemoryAddress.get(e);return o===void 0?-1:this.getIndexFromAddress(o+BigInt(t))}getIndexFromAddress(e){let t=this._disassembledInstructions;return t&&t.length>0?cA(t.length,o=>{let n=t.row(o);return Number(n.address-e)}):-1}reloadDisassembly(e,t){this._disassembledInstructions&&(this._loadingLock=!0,this.clear(),this._instructionBpList=this._debugService.getModel().getInstructionBreakpoints(),this.loadDisassembledInstructions(e,t,-$_.NUM_INSTRUCTIONS_TO_LOAD*4,$_.NUM_INSTRUCTIONS_TO_LOAD*8).then(()=>{if(this._disassembledInstructions.length>0){let o,n=this._referenceToMemoryAddress.get(e);if(n!==void 0){let r=this._disassembledInstructions;o=cA(r.length,s=>Number(r.row(s).address-n)),o<0&&(o=~o)}o===void 0&&(o=Math.floor(this._disassembledInstructions.length/2)),this._disassembledInstructions.reveal(o,.5),this._disassembledInstructions.domFocus(),this._disassembledInstructions.setFocus([o])}this._loadingLock=!1}))}clear(){this._referenceToMemoryAddress.clear(),this._disassembledInstructions?.splice(0,this._disassembledInstructions.length,[bzi])}onContextMenu(e){let t=Lu(this.menu.getActions({shouldForwardArgs:!0}));this._contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t,getActionsContext:()=>e.element})}};$_=I([m(1,_e),m(2,Pe),m(3,de),m(4,B),m(5,F),m(6,Hi),m(7,Xe),m(8,Yt),m(9,X)],$_);var Tse=class{constructor(i,e){this._disassemblyView=i;this._debugService=e;this.templateId=Tse.TEMPLATE_ID;this._breakpointIcon="codicon-"+eV.regular.id;this._breakpointDisabledIcon="codicon-"+eV.disabled.id;this._breakpointHintIcon="codicon-"+Vnt.id;this._debugStackframe="codicon-"+Yge.id;this._debugStackframeFocused="codicon-"+Xge.id}static{this.TEMPLATE_ID="breakpoint"}renderTemplate(i){i.style.alignSelf="flex-end";let e=D(i,_(".codicon"));e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center",e.style.height=this._disassemblyView.fontInfo.lineHeight+"px";let t={element:void 0},o=[this._disassemblyView.onDidChangeStackFrame(()=>this.rerenderDebugStackframe(e,t.element)),Yo(i,"mouseover",()=>{t.element?.allowBreakpoint&&e.classList.add(this._breakpointHintIcon)}),Yo(i,"mouseout",()=>{t.element?.allowBreakpoint&&e.classList.remove(this._breakpointHintIcon)}),Yo(i,"click",()=>{if(t.element?.allowBreakpoint){e.classList.add(this._breakpointHintIcon);let n=t.element.instructionReference,r=t.element.address,s=Number(r-this._disassemblyView.getReferenceAddress(n));t.element.isBreakpointSet?this._debugService.removeInstructionBreakpoints(n,s,r):t.element.allowBreakpoint&&!t.element.isBreakpointSet&&this._debugService.addInstructionBreakpoint({instructionReference:n,offset:s,address:r,canPersist:!1})}})];return{currentElement:t,icon:e,disposables:o}}renderElement(i,e,t){t.currentElement.element=i,this.rerenderDebugStackframe(t.icon,i)}disposeTemplate(i){je(i.disposables),i.disposables=[]}rerenderDebugStackframe(i,e){e?.address===this._disassemblyView.focusedCurrentInstructionAddress?i.classList.add(this._debugStackframe):e?.address===this._disassemblyView.focusedInstructionAddress?i.classList.add(this._debugStackframeFocused):(i.classList.remove(this._debugStackframe),i.classList.remove(this._debugStackframeFocused)),i.classList.remove(this._breakpointHintIcon),e?.isBreakpointSet?e.isBreakpointEnabled?(i.classList.add(this._breakpointIcon),i.classList.remove(this._breakpointDisabledIcon)):(i.classList.remove(this._breakpointIcon),i.classList.add(this._breakpointDisabledIcon)):(i.classList.remove(this._breakpointIcon),i.classList.remove(this._breakpointDisabledIcon))}};Tse=I([m(1,Hi)],Tse);var qV=class extends k{constructor(e,t,o,n,r,s){super();this._disassemblyView=e;this.editorService=o;this.textModelService=n;this.uriService=r;this.logService=s;this.templateId=qV.TEMPLATE_ID;this._topStackFrameColor=t.getColorTheme().getColor(fVe),this._focusedStackFrameColor=t.getColorTheme().getColor(vVe),this._register(t.onDidColorThemeChange(l=>{this._topStackFrameColor=l.getColor(fVe),this._focusedStackFrameColor=l.getColor(vVe)}))}static{this.TEMPLATE_ID="instruction"}static{this.INSTRUCTION_ADDR_MIN_LENGTH=25}static{this.INSTRUCTION_BYTES_MIN_LENGTH=30}renderTemplate(e){let t=D(e,_(".sourcecode")),o=D(e,_(".instruction"));this.applyFontInfo(t),this.applyFontInfo(o);let n={element:void 0},r=[],s=[this._disassemblyView.onDidChangeStackFrame(()=>this.rerenderBackground(o,t,n.element)),Yo(t,"dblclick",()=>this.openSourceCode(n.element?.instruction))];return{currentElement:n,instruction:o,sourcecode:t,cellDisposable:r,disposables:s}}renderElement(e,t,o){this.renderElementInner(e,t,o)}async renderElementInner(e,t,o){o.currentElement.element=e;let n=e.instruction;o.sourcecode.innerText="";let r=new EI(1e3);if(this._disassemblyView.isSourceCodeRender&&e.showSourceLocation&&n.location?.path&&n.line!==void 0){let l=this.getUriFromSource(n);if(l){let c,u=new EI(1e4),p=await this.textModelService.createModelReference(l);if(o.currentElement.element!==e){p.dispose();return}if(c=p.object.textEditorModel,o.cellDisposable.push(p),c&&o.currentElement.element===e){let h=n.line;for(;h&&h>=1&&h<=c.getLineCount();){let g=c.getLineContent(h);if(u.appendString(`  ${h}: `),u.appendString(g+`
`),n.endLine&&h<n.endLine){h++;continue}break}o.sourcecode.innerText=u.build()}}}let s=10;if(n.address!=="-1"){r.appendString(n.address),n.address.length<qV.INSTRUCTION_ADDR_MIN_LENGTH&&(s=qV.INSTRUCTION_ADDR_MIN_LENGTH-n.address.length);for(let l=0;l<s;l++)r.appendString(" ")}if(n.instructionBytes){r.appendString(n.instructionBytes),s=10,n.instructionBytes.length<qV.INSTRUCTION_BYTES_MIN_LENGTH&&(s=qV.INSTRUCTION_BYTES_MIN_LENGTH-n.instructionBytes.length);for(let l=0;l<s;l++)r.appendString(" ")}r.appendString(n.instruction),o.instruction.innerText=r.build(),this.rerenderBackground(o.instruction,o.sourcecode,e)}disposeElement(e,t,o){je(o.cellDisposable),o.cellDisposable=[]}disposeTemplate(e){je(e.disposables),e.disposables=[]}rerenderBackground(e,t,o){o&&this._disassemblyView.currentInstructionAddresses.includes(o.address)?e.style.background=this._topStackFrameColor?.toString()||"transparent":o?.address===this._disassemblyView.focusedInstructionAddress?e.style.background=this._focusedStackFrameColor?.toString()||"transparent":e.style.background="transparent"}openSourceCode(e){if(e){let t=this.getUriFromSource(e),o=e.endLine?{startLineNumber:e.line,endLineNumber:e.endLine,startColumn:e.column||1,endColumn:e.endColumn||1073741824}:{startLineNumber:e.line,endLineNumber:e.line,startColumn:e.column||1,endColumn:e.endColumn||1073741824};this.editorService.openEditor({resource:t,description:d(10890,null),options:{preserveFocus:!1,selection:o,revealIfOpened:!0,selectionRevealType:1,pinned:!1}})}}getUriFromSource(e){let t=e.location.path;return t&&YZ(t)?this.uriService.asCanonicalUri(A.parse(t)):t&&Jl(t)?this.uriService.asCanonicalUri(A.file(t)):_Xe(e.location,e.location.path,this._disassemblyView.debugSession.getId(),this.uriService,this.logService)}applyFontInfo(e){ku(e,this._disassemblyView.fontInfo),e.style.whiteSpace="pre"}};qV=I([m(1,Pe),m(2,ie),m(3,Bt),m(4,gt),m(5,re)],qV);var Szi=class{getWidgetAriaLabel(){return d(10889,null)}getAriaLabel(i){let e="",t=i.instruction;return t.address!=="-1"&&(e+=`${d(10891,null)}: ${t.address}`),t.instructionBytes&&(e+=`, ${d(10892,null)}: ${t.instructionBytes}`),e+=`, ${d(10894,null)}: ${t.instruction}`,e}},sKe=class{constructor(i,e,t){t.bufferChangeEvents(()=>{this._languageSupportsDisassembleRequest=PAt.bindTo(t)});let o=()=>{this._onDidChangeModelLanguage&&(this._onDidChangeModelLanguage.dispose(),this._onDidChangeModelLanguage=void 0);let n=i.activeTextEditorControl;if(fn(n)){let r=n.getModel()?.getLanguageId();this._languageSupportsDisassembleRequest?.set(!!r&&e.getAdapterManager().someDebuggerInterestedInLanguage(r)),this._onDidChangeModelLanguage=n.onDidChangeModelLanguage(s=>{this._languageSupportsDisassembleRequest?.set(e.getAdapterManager().someDebuggerInterestedInLanguage(s.newLanguage))})}else this._languageSupportsDisassembleRequest?.set(!1)};o(),this._onDidActiveEditorChangeListener=i.onDidActiveEditorChange(o)}dispose(){this._onDidActiveEditorChangeListener.dispose(),this._onDidChangeModelLanguage?.dispose()}};sKe=I([m(0,ie),m(1,Hi),m(2,X)],sKe);Ge.registerCommand({metadata:{description:A$t},id:R$t,handler:async(a,i)=>{i?.instruction?.address&&a.get(Bi).writeText(i.instruction.address)}});var Izi=class extends z{constructor(){super({id:L$t,title:{...P(10755,"Toggle Breakpoint"),mnemonicTitle:d(10748,null)},category:P(10737,"Debug"),f1:!0,precondition:qa,keybinding:{when:C.or(me.editorTextFocus,Y2),primary:67,weight:100},menu:[{id:R.MenubarDebugMenu,when:qa,group:"4_new_breakpoint",order:1}]})}async run(i,e){let t=i.get(ie),o=i.get(Hi),n=t.activeEditorPane;if(n instanceof $_){let l=e?n.getAddressAndOffset(e):n.focusedAddressAndOffset;if(l){let u=o.getModel().getInstructionBreakpoints().find(p=>p.address===l.address);u?o.removeInstructionBreakpoints(u.instructionReference,u.offset):o.addInstructionBreakpoint({instructionReference:l.reference,offset:l.offset,address:l.address,canPersist:!1})}return}let r=i.get(Qt),s=r.getFocusedCodeEditor()||r.getActiveCodeEditor();if(s?.hasModel()){let l=s.getModel().uri,c=o.canSetBreakpointsIn(s.getModel()),u=[...new Set(s.getSelections().map(p=>p.getPosition().lineNumber))];await Promise.all(u.map(async p=>{let h=o.getModel().getBreakpoints({lineNumber:p,uri:l});h.length?await Promise.all(h.map(g=>o.removeBreakpoints(g.getId()))):c&&await o.addBreakpoints(l,[{lineNumber:p}])}))}}},yzi=class extends Mi{constructor(){super({id:"editor.debug.action.conditionalBreakpoint",label:P(10736,"Debug: Add Conditional Breakpoint..."),precondition:qa,menuOpts:{menuId:R.MenubarNewBreakpointMenu,title:d(10744,null),group:"1_breakpoints",order:1,when:qa}})}async run(i,e){let t=i.get(Hi),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(cN)?.showBreakpointWidget(o.lineNumber,void 0,0)}},wzi=class extends Mi{constructor(){super({id:"editor.debug.action.addLogPoint",label:P(10743,"Debug: Add Logpoint..."),precondition:qa,menuOpts:[{menuId:R.MenubarNewBreakpointMenu,title:d(10747,null),group:"1_breakpoints",order:4,when:qa}]})}async run(i,e){let t=i.get(Hi),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(cN)?.showBreakpointWidget(o.lineNumber,o.column,2)}},Czi=class extends Mi{constructor(){super({id:"editor.debug.action.triggerByBreakpoint",label:d(10758,null),precondition:qa,alias:"Debug: Triggered Breakpoint...",menuOpts:[{menuId:R.MenubarNewBreakpointMenu,title:d(10750,null),group:"1_breakpoints",order:4,when:qa}]})}async run(i,e){let t=i.get(Hi),o=e.getPosition();o&&e.hasModel()&&t.canSetBreakpointsIn(e.getModel())&&e.getContribution(cN)?.showBreakpointWidget(o.lineNumber,o.column,3)}},xzi=class extends Mi{constructor(){super({id:"editor.debug.action.editBreakpoint",label:d(10738,null),alias:"Debug: Edit Existing Breakpoint",precondition:qa,menuOpts:{menuId:R.MenubarNewBreakpointMenu,title:d(10746,null),group:"1_breakpoints",order:1,when:qa}})}async run(i,e){let t=i.get(Hi),o=e.getPosition(),n=t.getModel();if(!(e.hasModel()&&o))return;let r=n.getBreakpoints({lineNumber:o.lineNumber});if(r.length===0)return;let s=r.map(u=>u.column?Math.abs(u.column-o.column):o.column),l=s.indexOf(Math.min(...s)),c=r[l];e.getContribution(cN)?.showBreakpointWidget(c.lineNumber,c.column)}},kzi=class a extends z{static{this.ID="debug.action.openDisassemblyView"}constructor(){super({id:a.ID,title:{...P(10751,"Open Disassembly View"),mnemonicTitle:d(10745,null)},precondition:AAt,menu:[{id:R.EditorContext,group:"debug",order:5,when:C.and(vl,Rpe.toNegated(),ca.isEqualTo("stopped"),me.editorTextFocus,LDe,PAt)},{id:R.DebugCallStackContext,group:"z_commands",order:50,when:C.and(vl,ca.isEqualTo("stopped"),ub.isEqualTo("stackFrame"),LDe)},{id:R.CommandPalette,when:C.and(vl,ca.isEqualTo("stopped"),LDe)}]})}run(i){i.get(ie).openEditor(UM.instance,{pinned:!0,revealIfOpened:!0})}},Ezi=class a extends z{static{this.ID="debug.action.toggleDisassemblyViewSourceCode"}static{this.configID="debug.disassemblyView.showSourceCode"}constructor(){super({id:a.ID,title:{...P(10756,"Toggle Source Code in Disassembly View"),mnemonicTitle:d(10749,null)},metadata:{description:P(10757,"Shows or hides source code in disassembly")},f1:!0})}run(i,e,...t){let o=i.get(B);if(o){let n=o.getValue("debug").disassemblyView.showSourceCode;o.updateValue(a.configID,!n)}}},aKe=class a extends Mi{static{this.ID="editor.debug.action.runToCursor"}static{this.LABEL=P(10752,"Run to Cursor")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Run to Cursor",precondition:C.and(qa,Rpe.toNegated(),C.or(me.editorTextFocus,Y2),Z.inChatSession.negate()),contextMenuOpts:{group:"debug",order:2,when:vl}})}async run(i,e){let t=e.getPosition();if(!(e.hasModel()&&t))return;let o=e.getModel().uri,n=i.get(Hi),r=n.getViewModel(),s=i.get(gt),l,c=r.focusedStackFrame;c&&s.extUri.isEqual(c.source.uri,o)&&c.range.startLineNumber===t.lineNumber&&(l=t.column),await n.runTo(o,t.lineNumber,l)}},lKe=class a extends Mi{static{this.ID="editor.debug.action.selectionToRepl"}static{this.LABEL=P(10740,"Evaluate in Debug Console")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Evaluate in Console",precondition:C.and(vl,me.editorTextFocus,Z.inChatSession.negate()),contextMenuOpts:{group:"debug",order:0}})}async run(i,e){let t=i.get(Hi),o=i.get(Gt),r=t.getViewModel().focusedSession;if(!e.hasModel()||!r)return;let s=e.getSelection(),l;s.isEmpty()?l=e.getModel().getLineContent(s.selectionStartLineNumber).trim():l=e.getModel().getValueInRange(s),(await o.openView($d,!1))?.sendReplInput(l)}},cKe=class a extends Mi{static{this.ID="editor.debug.action.selectionToWatch"}static{this.LABEL=P(10734,"Add to Watch")}constructor(){super({id:a.ID,label:a.LABEL.value,alias:"Debug: Add to Watch",precondition:C.and(vl,me.editorTextFocus,Z.inChatSession.negate()),contextMenuOpts:{group:"debug",order:1}})}async run(i,e){let t=i.get(Hi),o=i.get(Gt),n=i.get(Jt);if(!e.hasModel())return;let r,s=e.getModel(),l=e.getSelection();if(!l.isEmpty())r=s.getValueInRange(l);else{let c=e.getPosition(),u=await WAt(n,s,c);if(!u)return;r=u.matchingExpression}r&&(await o.openView(vE),t.addWatchExpression(r))}},Tzi=class extends Mi{constructor(){super({id:"editor.debug.action.showDebugHover",label:P(10753,"Debug: Show Hover"),precondition:vl,kbOpts:{kbExpr:me.editorTextFocus,primary:Gi(2089,2087),weight:100}})}async run(i,e){let t=e.getPosition();if(!(!t||!e.hasModel()))return e.getContribution(OH)?.showHover(t,!0)}},iOo=d(10739,null),_zi=class a extends Mi{static{this.ID="editor.debug.action.stepIntoTargets"}static{this.LABEL=d(10754,null)}constructor(){super({id:a.ID,label:a.LABEL,alias:"Debug: Step Into Target",precondition:C.and(GZ,vl,ca.isEqualTo("stopped"),me.editorTextFocus),contextMenuOpts:{group:"debug",order:1.5}})}async run(i,e){let t=i.get(Hi),o=i.get(Xe),n=i.get(gt),r=t.getViewModel().focusedSession,s=t.getViewModel().focusedStackFrame,l=e.getSelection(),c=l?.getPosition()||s&&{lineNumber:s.range.startLineNumber,column:s.range.startColumn};if(!r||!s||!e.hasModel()||!n.extUri.isEqual(e.getModel().uri,s.source.uri)){c&&Xu.get(e)?.showMessage(iOo,c);return}let u=await r.stepInTargets(s.frameId);if(!u?.length){Xu.get(e)?.showMessage(iOo,c);return}if(l){let v=[];for(let y of u)y.line&&v.push({start:new ye(y.line,y.column||1),end:y.endLine?new ye(y.endLine,y.endColumn||1):void 0,target:y});v.sort((y,w)=>w.start.lineNumber-y.start.lineNumber||w.start.column-y.start.column);let b=l.getPosition(),S=v.find(y=>y.end&&b.isBefore(y.end)&&y.start.isBeforeOrEqual(b))||v.find(y=>y.end===void 0&&y.start.isBeforeOrEqual(b));if(S){r.stepIn(s.thread.threadId,S.target.id);return}}e.revealLineInCenterIfOutsideViewport(s.range.startLineNumber);let p=e.getScrolledVisiblePosition(c),h=ur(e.getDomNode()),g=h.left+p.left,f=h.top+p.top+p.height;o.showContextMenu({getAnchor:()=>({x:g,y:f}),getActions:()=>u.map(v=>li({id:`stepIntoTarget:${v.id}`,label:v.label,enabled:!0,run:()=>r.stepIn(s.thread.threadId,v.id)}))})}},z6t=class extends Mi{constructor(e,t){super(t);this.isNext=e}async run(e,t){let o=e.get(Hi),n=e.get(ie),r=e.get(gt);if(t.hasModel()){let s=t.getModel().uri,l=t.getPosition().lineNumber,c=o.getModel().getBreakpoints({enabledOnly:!0}),u=this.isNext?c.filter(p=>r.extUri.isEqual(p.uri,s)&&p.lineNumber>l).shift():c.filter(p=>r.extUri.isEqual(p.uri,s)&&p.lineNumber<l).pop();if(u||(u=this.isNext?c.filter(p=>p.uri.toString()>s.toString()).shift():c.filter(p=>p.uri.toString()<s.toString()).pop()),!u&&c.length&&(u=this.isNext?c[0]:c[c.length-1]),u)return KWe(u,!1,!0,!1,o,n)}}},Dzi=class extends z6t{constructor(){super(!0,{id:"editor.debug.action.goToNextBreakpoint",label:P(10741,"Debug: Go to Next Breakpoint"),precondition:qa})}},Rzi=class extends z6t{constructor(){super(!1,{id:"editor.debug.action.goToPreviousBreakpoint",label:P(10742,"Debug: Go to Previous Breakpoint"),precondition:qa})}},Lzi=class extends Mi{constructor(){super({id:"editor.debug.action.closeExceptionWidget",label:P(10735,"Close Exception Widget"),precondition:LAt,kbOpts:{primary:9,weight:100}})}async run(i,e){e.getContribution(OH)?.closeExceptionWidget()}};W(kzi);W(Ezi);W(Izi);ri(yzi);ri(wzi);ri(Czi);ri(xzi);ri(aKe);ri(_zi);ri(lKe);ri(cKe);ri(Tzi);ri(Dzi);ri(Rzi);ri(Lzi);var dKe=class{constructor(i,e,t){this.toDispose=[];let o,n=r=>{o&&(o.dispose(),o=void 0),r&&(o=r.onDidProgressStart(async s=>{let l=new Promise(u=>{let p=U.any(U.filter(r.onDidProgressEnd,h=>h.body.progressId===s.body.progressId),r.onDidEndAdapter)(()=>{p.dispose(),u()})});t.isViewContainerVisible($g)&&e.withProgress({location:$g},()=>l);let c=i.getAdapterManager().getDebuggerLabel(r.configuration.type);e.withProgress({location:15,title:s.body.title,cancellable:s.body.cancellable,source:c,delay:500},u=>{let p=0,h=f=>{let v;typeof f.percentage=="number"&&(v=f.percentage-p,p+=v),u.report({message:f.message,increment:v,total:typeof v=="number"?100:void 0})};s.body.message&&h(s.body);let g=r.onDidProgressUpdate(f=>{f.body.progressId===s.body.progressId&&h(f.body)});return l.then(()=>g.dispose())},()=>r.cancel(s.body.progressId))}))};this.toDispose.push(i.getViewModel().onDidFocusSession(n)),n(i.getViewModel().focusedSession),this.toDispose.push(i.onWillNewSession(r=>{o||n(r)}))}dispose(){je(this.toDispose)}};dKe=I([m(0,Hi),m(1,Go),m(2,Gt)],dKe);var uKe=class extends cg{constructor(e,t,o,n){super(uat,{noResultsPick:{label:d(10827,null)}});this.debugService=e;this.contextService=t;this.commandService=o;this.notificationService=n}async _getPicks(e){let t=[];if(!this.debugService.getAdapterManager().hasEnabledDebuggers())return[];t.push({type:"separator",label:"launch.json"});let o=this.debugService.getConfigurationManager(),n=o.selectedConfiguration,r;for(let c of o.getAllConfigurations()){let u=xh(e,c.name,!0);if(u){let p={label:c.name,description:this.contextService.getWorkbenchState()===3?c.launch.name:"",highlights:{label:u},buttons:[{iconClass:q.asClassName(YNe),tooltip:d(10825,null)}],trigger:()=>(c.launch.openConfigFile({preserveFocus:!1}),1),accept:async()=>{await o.selectConfiguration(c.launch,c.name);try{await this.debugService.startDebugging(c.launch,void 0,{startedByUser:!0})}catch(h){this.notificationService.error(h)}}};if(n.name===c.name&&n.launch===c.launch){let h={type:"separator",label:d(10826,null)};t.unshift(h,p);continue}r!==c.presentation?.group&&(t.push({type:"separator"}),r=c.presentation?.group),t.push(p)}}let s=await o.getDynamicProviders();s.length>0&&t.push({type:"separator",label:d(10824,null)}),o.getRecentDynamicConfigurations().forEach(({name:c,type:u})=>{let p=xh(e,c,!0);p&&t.push({label:c,highlights:{label:p},buttons:[{iconClass:q.asClassName(nyo),tooltip:d(10829,null)}],trigger:()=>(o.removeRecentDynamicConfigurations(c,u),1),accept:async()=>{await o.selectConfiguration(void 0,c,void 0,{type:u});try{let{launch:h,getConfig:g}=o.selectedConfiguration,f=await g();await this.debugService.startDebugging(h,f,{startedByUser:!0})}catch(h){this.notificationService.error(h)}}})}),s.forEach(c=>{t.push({label:`$(folder) ${c.label}...`,ariaLabel:d(10828,null,c.label),accept:async()=>{let u=await c.pick();u&&(await o.selectConfiguration(u.launch,u.config.name,u.config,{type:c.type}),this.debugService.startDebugging(u.launch,u.config,{startedByUser:!0}))}})});let l=o.getLaunches().filter(c=>!c.hidden);l.length>0&&t.push({type:"separator",label:d(10823,null)});for(let c of l){let u=this.contextService.getWorkbenchState()===3?d(10821,null,c.name):d(10822,null);t.push({label:u,description:this.contextService.getWorkbenchState()===3?c.name:"",highlights:{label:xh(e,u,!0)??void 0},accept:()=>this.commandService.executeCommand(Rve,c.uri.toString())})}return t}};uKe=I([m(0,Hi),m(1,Ae),m(2,fe),m(3,Ne)],uKe);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"debug.autoExpandLazyVariables",migrateFn:a=>a===!0?{value:"on"}:a===!1?{value:"off"}:[]}]);var pKe=class{constructor(i,e,t){this.statusBarService=i;this.debugService=e;this.toDispose=[];let o=()=>{this.entryAccessor=this.statusBarService.addEntry(this.entry,"status.debug",0,30)},n=()=>{this.showInStatusBar=t.getValue("debug").showInStatusBar,this.showInStatusBar==="always"&&!this.entryAccessor&&o()};n(),this.toDispose.push(this.debugService.onDidChangeState(r=>{r!==0&&this.showInStatusBar==="onFirstSessionStart"&&!this.entryAccessor&&o()})),this.toDispose.push(t.onDidChangeConfiguration(r=>{r.affectsConfiguration("debug.showInStatusBar")&&(n(),this.entryAccessor&&this.showInStatusBar==="never"&&(this.entryAccessor.dispose(),this.entryAccessor=void 0))})),this.toDispose.push(this.debugService.getConfigurationManager().onDidSelectConfiguration(r=>{this.entryAccessor?.update(this.entry)}))}get entry(){let i="",e=this.debugService.getConfigurationManager(),t=e.selectedConfiguration.name||"";return t&&e.selectedConfiguration.launch&&(i=e.getLaunches().length>1?`${t} (${e.selectedConfiguration.launch.name})`:t),{name:d(10863,null),text:"$(debug-alt-small) "+i,ariaLabel:d(10861,null,i),tooltip:d(10862,null),command:"workbench.action.debug.selectandstart"}}dispose(){this.entryAccessor?.dispose(),je(this.toDispose)}};pKe=I([m(0,Fr),m(1,Hi),m(2,B)],pKe);var mKe=class{constructor(i,e,t){this.toDispose=[];let o=()=>{i.state===2&&!e.hasFocus?t.updateProperties({prefix:"\u{1F534}"}):t.updateProperties({prefix:""})};this.toDispose.push(i.onDidChangeState(o)),this.toDispose.push(e.onDidChangeFocus(o))}dispose(){je(this.toDispose)}};mKe=I([m(0,Hi),m(1,ti),m(2,aP)],mKe);var Mzi="debugStartLanguage",akn=new Y(Mzi,void 0),oOo=new Y("debuggerInterestedInActiveEditor",!1),lL=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,o,n,r,s,p,u,h,t,f);this.debugService=l;this.editorService=c;this.debugStartLanguageContext=akn.bindTo(s),this.debuggerInterestedContext=oOo.bindTo(s);let v=g.get(Mzi,1);this.debugStartLanguageContext.set(v);let b=()=>{let y=this.editorService.activeTextEditorControl;if(Lc(y)&&(y=y.getModifiedEditor()),fn(y)){let w=y.getModel(),x=w?w.getLanguageId():void 0;if(x&&this.debugService.getAdapterManager().someDebuggerInterestedInLanguage(x)){this.debugStartLanguageContext.set(x),this.debuggerInterestedContext.set(!0),g.store(Mzi,x,1,1);return}}this.debuggerInterestedContext.set(!1)},S=new O;this._register(S),this._register(c.onDidActiveEditorChange(()=>{S.clear();let y=this.editorService.activeTextEditorControl;Lc(y)&&(y=y.getModifiedEditor()),fn(y)&&S.add(y.onDidChangeModelLanguage(b)),b()})),this._register(this.debugService.getAdapterManager().onDidRegisterDebugger(b)),this._register(this.onDidChangeBodyVisibility(y=>{y&&b()})),b(),nOo=this.keybindingService.appendKeybinding("",CV)}static{this.ID="workbench.debug.welcome"}static{this.LABEL=P(11019,"Run")}shouldShowWelcome(){return!0}};lL=I([m(1,Pe),m(2,Le),m(3,Xe),m(4,B),m(5,X),m(6,Hi),m(7,ie),m(8,F),m(9,ji),m(10,Je),m(11,de),m(12,ot)],lL);var Vut=oe.as(Kn.ViewsRegistry);Vut.registerViewWelcomeContent(lL.ID,{content:d(11018,null,PMe.ID),when:C.and(qa,oOo.toNegated()),group:"2_open"});var nOo="";Vut.registerViewWelcomeContent(lL.ID,{content:`[${d(11020,null)}${nOo}](command:${CV})`,when:qa,group:"4_debug",order:1});Vut.registerViewWelcomeContent(lL.ID,{content:d(11016,null,`${nc(a$,{addNew:!0}).toString()}`),when:C.and(qa,el.notEqualsTo("empty")),group:"4_debug"});Vut.registerViewWelcomeContent(lL.ID,{content:d(11017,null,nc(wW.ID).toString()),when:C.and(qa,el.isEqualTo("empty")),group:"4_debug"});Vut.registerViewWelcomeContent(lL.ID,{content:d(11015,null),when:DAt.toNegated(),group:"4_debug"});var hKe=class extends Qc{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super($g,{mergeViewWithContainerWhenSingleView:!0},r,h,e,u,t,p,c,l,s,v,b);this.progressService=o;this.debugService=n;this.contextViewService=g;this.contextKeyService=f;this.paneListeners=new Map;this.stopActionViewItemDisposables=this._register(new O);this._register(this.debugService.onDidChangeState(S=>this.onDebugServiceStateChange(S))),this._register(this.contextKeyService.onDidChangeContext(S=>{S.affectsSome(new Set([tIi,"inDebugMode"]))&&this.updateTitleArea()})),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.updateTitleArea())),this._register(this.configurationService.onDidChangeConfiguration(S=>{(S.affectsConfiguration("debug.toolBarLocation")||S.affectsConfiguration("debug.hideLauncherWhileDebugging"))&&this.updateTitleArea()}))}create(e){super.create(e),e.classList.add("debug-viewlet")}focus(){super.focus(),this.startDebugActionViewItem?this.startDebugActionViewItem.focus():this.focusView(lL.ID)}getActionViewItem(e,t){if(e.id===CV)return this.startDebugActionViewItem=this.instantiationService.createInstance(N1e,null,e,t),this.startDebugActionViewItem;if(e.id===qWe)return new z$(e,void 0,this.debugService,this.contextViewService,this.configurationService);if(e.id===V_||e.id===MP){this.stopActionViewItemDisposables.clear();let o=this.instantiationService.invokeFunction(n=>Fut(e,this.stopActionViewItemDisposables,n,{hoverDelegate:t.hoverDelegate}));if(o)return o}return ta(this.instantiationService,e,t)}focusView(e){let t=this.getView(e);t&&t.focus()}onDebugServiceStateChange(e){this.progressResolve&&(this.progressResolve(),this.progressResolve=void 0),e===1&&this.progressService.withProgress({location:$g},t=>new Promise(o=>this.progressResolve=o))}addPanes(e){super.addPanes(e);for(let{pane:t}of e)t.id===bE?(this.breakpointView=t,this.updateBreakpointsMaxSize()):this.paneListeners.set(t.id,t.onDidChange(()=>this.updateBreakpointsMaxSize()))}removePanes(e){super.removePanes(e);for(let t of e)je(this.paneListeners.get(t.id)),this.paneListeners.delete(t.id)}updateBreakpointsMaxSize(){if(this.breakpointView){let e=this.panes.every(t=>!t.isExpanded()||t===this.breakpointView);this.breakpointView.maximumBodySize=e?Number.POSITIVE_INFINITY:this.breakpointView.minimumBodySize}}};hKe=I([m(0,wi),m(1,_e),m(2,Go),m(3,Hi),m(4,F),m(5,Ae),m(6,de),m(7,Pe),m(8,Xe),m(9,lt),m(10,B),m(11,qn),m(12,X),m(13,ji),m(14,re)],hKe);be.appendMenuItem(R.ViewContainerTitle,{when:C.and(C.equals("viewContainer",$g),aN.notEqualsTo("simple"),el.notEqualsTo("empty"),C.or(ca.isEqualTo("inactive"),C.notEquals("config.debug.toolBarLocation","docked")),C.or(C.not("config.debug.hideLauncherWhileDebugging"),C.not("inDebugMode"))),order:10,group:"navigation",command:{precondition:ca.notEqualsTo(HM(1)),id:CV,title:lat}});W(class extends z{constructor(){super({id:a$,title:{value:$We,original:"Open 'launch.json'",mnemonicTitle:d(10884,null)},metadata:{description:P(10885,"Opens the file used to configure how your program is debugged")},f1:!0,icon:YNe,precondition:aN.notEqualsTo("simple"),menu:[{id:R.ViewContainerTitle,group:"navigation",order:20,when:C.and(C.equals("viewContainer",$g),aN.notEqualsTo("simple"),el.notEqualsTo("empty"),C.or(ca.isEqualTo("inactive"),C.notEquals("config.debug.toolBarLocation","docked")))},{id:R.ViewContainerTitle,order:20,when:C.and(C.equals("viewContainer",$g),ca.notEqualsTo("inactive"),C.equals("config.debug.toolBarLocation","docked"))},{id:R.MenubarDebugMenu,group:"2_configuration",order:1,when:qa}]})}async run(a,i){let e=a.get(Hi),t=a.get($e),o=e.getConfigurationManager(),n;if(o.selectedConfiguration.name)n=o.selectedConfiguration.launch;else{let r=o.getLaunches().filter(s=>!s.hidden);if(r.length===1)n=r[0];else{let s=r.map(c=>({label:c.name,launch:c})),l=await t.pick(s,{activeItem:s[0],placeHolder:d(10886,null)});l&&(n=l.launch)}}if(n){let{editor:r}=await n.openConfigFile({preserveFocus:!1});if(r&&i?.addNew){let s=r.getControl();s&&await s.getContribution(OH)?.addLaunchConfiguration()}}}});W(class extends z{constructor(){super({id:"debug.toggleReplIgnoreFocus",title:d(10883,null),toggled:C.has(`view.${$d}.visible`),menu:[{id:p8,group:"3_toggleRepl",order:30,when:C.and(C.equals("viewContainer",$g))}]})}async run(a){let i=a.get(Gt);i.isViewVisible($d)?i.closeView($d):await i.openView($d)}});be.appendMenuItem(R.ViewContainerTitle,{when:C.and(C.equals("viewContainer",$g),ca.notEqualsTo("inactive"),C.or(C.equals("config.debug.toolBarLocation","docked"),C.has("config.debug.hideLauncherWhileDebugging"))),order:10,command:{id:R6,title:d(10887,null)}});var rOo=!0,lkn=/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/,r7=class a{constructor(i,e,t=!1){this._parent=i;this._label=e;this.isIncompressible=t;this._children=new Map;this._showedMoreThanOne=!1}updateLabel(i){this._label=i}isLeaf(){return this._children.size===0}getSession(){if(this._parent)return this._parent.getSession()}setSource(i,e){if(this._source=e,this._children.clear(),e.raw&&e.raw.sources){for(let t of e.raw.sources)if(t.name&&t.path){let o=new a(this,t.name);this._children.set(t.path,o);let n=i.getSource(t);o.setSource(i,n)}}}createIfNeeded(i,e){let t=this._children.get(i);return t||(t=e(this,i),this._children.set(i,t)),t}getChild(i){return this._children.get(i)}remove(i){this._children.delete(i)}removeFromParent(){this._parent&&(this._parent.remove(this._label),this._parent._children.size===0&&this._parent.removeFromParent())}getTemplateId(){return"id"}getId(){let i=this.getParent();return i?`${i.getId()}/${this.getInternalId()}`:this.getInternalId()}getInternalId(){return this._label}getParent(){if(this._parent)return this._parent.isSkipped()?this._parent.getParent():this._parent}isSkipped(){return this._parent?!!this._parent.oneChild():!0}hasChildren(){let i=this.oneChild();return i?i.hasChildren():this._children.size>0}getChildren(){let i=this.oneChild();if(i)return i.getChildren();let e=[];for(let t of this._children.values())e.push(t);return e.sort((t,o)=>this.compare(t,o))}getLabel(i=!0){let e=this.oneChild();if(e){let t=this instanceof _se&&i?" \u2022 ":Vo.sep;return`${this._label}${t}${e.getLabel()}`}return this._label}getHoverLabel(){if(this._source&&this._parent&&this._parent._source)return this._source.raw.path||this._source.raw.name;let i=this.getLabel(!1),e=this.getParent();if(e){let t=e.getHoverLabel();if(t)return`${t}/${i}`}return i}getSource(){let i=this.oneChild();return i?i.getSource():this._source}compare(i,e){return i._label&&e._label?i._label.localeCompare(e._label):0}oneChild(){if(!this._source&&!this._showedMoreThanOne&&this.skipOneChild()){if(this._children.size===1)return this._children.values().next().value;this._children.size>1&&(this._showedMoreThanOne=!0)}}skipOneChild(){return rOo?this instanceof K6t:!(this instanceof _se)&&!(this instanceof Dse)}},_se=class extends r7{constructor(e,t){super(e,t.name,!0);this.folder=t}},K6t=class extends r7{constructor(e,t,o){super(void 0,"Root");this._pathService=e;this._contextService=t;this._labelService=o}add(e){return this.createIfNeeded(e.getId(),()=>new Dse(this._labelService,this,e,this._pathService,this._contextService))}find(e){return this.getChild(e.getId())}},Dse=class a extends r7{constructor(e,t,o,n,r){super(t,o.getLabel(),!0);this._pathService=n;this.rootProvider=r;this._map=new Map;this._labelService=e,this._session=o}static{this.URL_REGEXP=/^(https?:\/\/[^/]+)(\/.*)$/}getInternalId(){return this._session.getId()}getSession(){return this._session}getHoverLabel(){}hasChildren(){return!0}compare(e,t){let o=this.category(e),n=this.category(t);return o!==n?o-n:super.compare(e,t)}category(e){if(e instanceof _se)return e.folder.index;let t=e.getLabel();return t&&/^<.+>$/.test(t)?1e3:999}async addPath(e){let t,o,n=e.raw.path;if(!n)return;this._labelService&&lkn.test(n)&&(n=this._labelService.getUriLabel(A.parse(n)));let r=a.URL_REGEXP.exec(n);if(r&&r.length===3)o=r[1],n=decodeURI(r[2]);else if(Jl(n)){let l=A.file(n);t=this.rootProvider?this.rootProvider.getWorkspaceFolder(l):null,t?(n=Vh(ax(l.path.substring(t.uri.path.length),Vo.sep)),this.rootProvider.getWorkspace().folders.length>1?n=Vo.sep+n:t=null):(n=Vh(n),ii?n=dm(n):n=$3e(n,(await this._pathService.userHome()).fsPath))}let s=this;n.split(/[\/\\]/).forEach((l,c)=>{if(c===0&&t){let u=t;s=s.createIfNeeded(t.name,p=>new _se(p,u))}else c===0&&o?s=s.createIfNeeded(o,u=>new r7(u,o)):s=s.createIfNeeded(l,u=>new r7(u,l))}),s.setSource(this._session,e),e.raw.path&&this._map.set(e.raw.path,s)}removePath(e){if(e.raw.path){let t=this._map.get(e.raw.path);if(t)return t.removeFromParent(),!0}return!1}};function sOo(a,i){let e=a.getChildren(),t=i?!i.expanded.has(a.getId()):!(a instanceof Dse);return{element:a,collapsed:t,collapsible:a.hasChildren(),children:e.map(o=>sOo(o,i))}}var gKe=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super(e,o,t,s,c,r,n,f,v,b);this.editorService=l;this.contextService=u;this.debugService=p;this.labelService=h;this.pathService=g;this.treeNeedsRefreshOnVisible=!1;this.loadedScriptsItemType=Llo.bindTo(c)}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-loaded-scripts","show-file-icons"),this.treeContainer=vne(e),this.filter=new Nzi;let t=new K6t(this.pathService,this.contextService,this.labelService);this.treeLabels=this.instantiationService.createInstance(jl,{onDidChangeVisibility:this.onDidChangeBodyVisibility}),this._register(this.treeLabels);let o=p=>{this.treeContainer.classList.toggle("align-icons-and-twisties",p.hasFileIcons&&!p.hasFolderIcons),this.treeContainer.classList.toggle("hide-arrows",p.hidesExplorerArrows===!0)};this._register(this.themeService.onDidFileIconThemeChange(o)),o(this.themeService.getFileIconTheme()),this.tree=this.instantiationService.createInstance(l0,"LoadedScriptsView",this.treeContainer,new Pzi,[new G6t(this.treeLabels)],{compressionEnabled:rOo,collapseByDefault:!0,hideTwistiesOfChildlessElements:!0,identityProvider:{getId:p=>p.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:p=>p.getLabel(),getCompressedNodeKeyboardNavigationLabel:p=>p.map(h=>h.getLabel()).join("/")},filter:this.filter,accessibilityProvider:new Azi,overrideStyles:this.getLocationBasedColors().listOverrideStyles});let n=p=>this.tree.setChildren(null,sOo(t,p).children);n(),this.changeScheduler=new Dt(()=>{this.treeNeedsRefreshOnVisible=!1,this.tree&&n()},300),this._register(this.changeScheduler),this._register(this.tree.onDidOpen(p=>{if(p.element instanceof r7){let h=p.element.getSource();if(h&&h.available){let g={startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0};h.openInEditor(this.editorService,g,p.editorOptions.preserveFocus,p.sideBySide,p.editorOptions.pinned)}}})),this._register(this.tree.onDidChangeFocus(()=>{this.tree.getFocus()instanceof Dse?this.loadedScriptsItemType.set("session"):this.loadedScriptsItemType.reset()}));let r=()=>{this.isBodyVisible()?this.changeScheduler.schedule():this.treeNeedsRefreshOnVisible=!0},s=async p=>{if(p.capabilities.supportsLoadedSourcesRequest){let h=t.add(p),g=await p.getLoadedSources();for(let f of g)await h.addPath(f);r()}},l=this._register(new Ot),c=p=>{let h=new O;l.set(p.getId(),h),h.add(p.onDidChangeName(async()=>{let g=t.find(p);g&&(g.updateLabel(p.getLabel()),r())})),h.add(p.onDidLoadedSource(async g=>{let f;switch(g.reason){case"new":case"changed":f=t.add(p),await f.addPath(g.source),r(),g.reason==="changed"&&z1.refreshDebugContent(g.source.uri);break;case"removed":f=t.find(p),f&&f.removePath(g.source)&&r();break;default:this.filter.setFilter(g.source.name),this.tree.refilter();break}}))};this._register(this.debugService.onDidNewSession(c)),this.debugService.getModel().getSessions().forEach(c),this._register(this.debugService.onDidEndSession(({session:p})=>{l.deleteAndDispose(p.getId()),t.remove(p.getId()),this.changeScheduler.schedule()})),this.changeScheduler.schedule(0),this._register(this.onDidChangeBodyVisibility(p=>{p&&this.treeNeedsRefreshOnVisible&&this.changeScheduler.schedule()}));let u;this._register(this.tree.onDidChangeFindPattern(p=>{if(this.tree.findMode!==0)if(!u&&p){let h=new Set,g=f=>{f.element&&!f.collapsed&&h.add(f.element.getId());for(let v of f.children)g(v)};g(this.tree.getNode()),u={expanded:h},this.tree.expandAll()}else!p&&u&&(this.tree.setFocus([]),n(u),u=void 0)})),this.debugService.getModel().getSessions().forEach(p=>s(p))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}collapseAll(){this.tree.collapseAll()}dispose(){je(this.tree),je(this.treeLabels),super.dispose()}};gKe=I([m(1,Xe),m(2,Le),m(3,F),m(4,ji),m(5,B),m(6,ie),m(7,X),m(8,Ae),m(9,Hi),m(10,nt),m(11,Pn),m(12,Je),m(13,Pe),m(14,ot)],gKe);var Pzi=class{getHeight(i){return 22}getTemplateId(i){return G6t.ID}},G6t=class a{constructor(i){this.labels=i}static{this.ID="lsrenderer"}get templateId(){return a.ID}renderTemplate(i){return{label:this.labels.create(i,{supportHighlights:!0})}}renderElement(i,e,t){let o=i.element,n=o.getLabel();this.render(o,n,t,i.filterData)}renderCompressedElements(i,e,t){let o=i.element.elements[i.element.elements.length-1],n=i.element.elements.map(r=>r.getLabel());this.render(o,n,t,i.filterData)}render(i,e,t,o){let n={name:e},r={title:i.getHoverLabel()};if(i instanceof _se)r.fileKind=2;else if(i instanceof Dse)r.title=d(10910,null),r.hideIcon=!0;else if(i instanceof r7){let s=i.getSource();s&&s.uri?(n.resource=s.uri,r.fileKind=0):r.fileKind=1}r.matches=Wa(o),t.label.setResource(n,r)}disposeTemplate(i){i.label.dispose()}},Azi=class{getWidgetAriaLabel(){return d(10907,null)}getAriaLabel(i){return i instanceof _se?d(10909,null,i.getLabel()):i instanceof Dse?d(10911,null,i.getLabel()):i.hasChildren()?d(10908,null,i.getLabel()):d(10912,null,i.getLabel())}},Nzi=class{setFilter(i){this.filterText=i}filter(i,e){return this.filterText?i.isLeaf()?i.getLabel().indexOf(this.filterText)>=0?1:0:2:1}};W(class extends rr{constructor(){super({id:"loadedScripts.collapse",viewId:Kpe,title:d(10906,null),f1:!1,icon:L.collapseAll,menu:{id:R.ViewTitle,order:30,group:"navigation",when:C.equals("view",Kpe)}})}runInView(i,e){e.collapseAll()}});var q6t=class{constructor(){this.priority=120;this.name="replHelp";this.when=C.or(C.equals("focusedView","workbench.panel.repl.view"),j0);this.type="help"}getProvider(i){let e=i.get(Gt),t=Kre(e);if(t)return new Ozi(t)}},Ozi=class extends k{constructor(e){super();this._replView=e;this.id="replHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){this._replView.focusFilter()}provideContent(){let e=[];return e.push(d(10949,null)),e.push(d(10938,null)),e.push(""),e.push(d(10968,null)),e.push(d(10967,null)),e.push(""),e.push(d(10951,null)),e.push(d(10950,null)),e.push(""),e.push(d(10944,null)),e.push(d(10943,null)),e.push(""),e.push(d(10948,null)),e.push(d(10945,null)),e.push(d(10946,null)),e.push(d(10947,null)),e.push(""),e.push(d(10941,null)),e.push(d(10940,null)),e.push(d(10939,null)),e.push(d(10942,null,"<keybinding:workbench.panel.repl.view.focus>")),e.push(""),e.push(d(10970,null)),e.push(d(10971,null)),e.push(d(10969,null)),e.push(""),e.push(d(10952,null)),e.push(d(10953,null)),e.push(d(10956,null)),e.push(d(10954,null)),e.push(d(10955,null,"<keybinding:workbench.panel.repl.view.focus>")),e.push(""),e.push(d(10963,null,"<keybinding:workbench.action.openSettings>")),e.push(d(10964,null)),e.push(d(10965,null)),e.push(d(10957,null)),e.push(d(10960,null)),e.push(d(10959,null)),e.push(d(10966,null)),e.push(d(10961,null)),e.push(d(10958,null)),e.push(d(10962,null)),e.push(""),e.push(d(10937,null)),e.push(d(10936,null)),e.join(`
`)}};var $6t=class{constructor(){this.priority=70;this.name="debugConsole";this.when=C.equals("focusedView","workbench.panel.repl.view");this.type="view"}getProvider(i){let e=i.get(Gt),t=i.get(Kd),o=Kre(e);if(!o)return;let n=o.getFocusedElement();return new But(o,n,t)}},But=class extends k{constructor(e,t,o){super();this._replView=e;this._focusedElement=t;this._accessibleViewService=o;this.id="repl";this._onDidChangeContent=this._register(new T);this.onDidChangeContent=this._onDidChangeContent.event;this._onDidResolveChildren=this._register(new T);this.onDidResolveChildren=this._onDidResolveChildren.event;this.verbositySettingKey="accessibility.verbosity.debug";this.options={type:"view"};this._elementPositionMap=new Map;this._treeHadFocus=!1;this._treeHadFocus=!!t}provideContent(){let e=this._replView.getDebugSession();if(!e)return"No debug session available.";let t=e.getReplElements();return t.length?(this._content||this._updateContent(t),this._content??t.map(o=>o.toString(!0)).join(`
`)):"No output in the debug console."}onClose(){if(this._content=void 0,this._elementPositionMap.clear(),this._treeHadFocus)return this._replView.focusTree();this._replView.getReplInput().focus()}onOpen(){this._register(this.onDidResolveChildren(()=>{this._onDidChangeContent.fire(),queueMicrotask(()=>{if(this._focusedElement){let e=this._elementPositionMap.get(this._focusedElement.getId());e&&this._accessibleViewService.setPosition(e,!0)}})}))}async _updateContent(e){let t=this._replView.getReplDataSource();if(!t)return;let o=1,n=[];for(let r of e)if(n.push(r.toString().replace(/\n/g,"")),this._elementPositionMap.set(r.getId(),new ye(o,1)),o++,t.hasChildren(r)){let s=[],l=await t.getChildren(r);for(let c of l){let u=c.getId();this._elementPositionMap.has(u)||this._elementPositionMap.set(u,new ye(o,1)),s.push("  "+c.toString()),o++}n.push(s.join(`
`))}this._content=n.join(`
`),this._onDidResolveChildren.fire()}};But=I([m(2,Kd)],But);var j6t=class{constructor(){this.priority=120;this.name="runAndDebugHelp";this.when=C.or(C.and(C.equals("activeViewlet","workbench.view.debug"),xH),C.equals(rc.key,q2),C.equals(rc.key,vE),C.equals(rc.key,O3),C.equals(rc.key,Kpe),C.equals(rc.key,bE));this.type="help"}getProvider(i){return new Hut(i.get(fe),i.get(Gt))}},Hut=class extends k{constructor(e,t){super();this._commandService=e;this._viewsService=t;this.id="runAndDebug";this.verbositySettingKey="accessibility.verbosity.debug";this.options={type:"help"};this._focusedView=this._viewsService.getFocusedViewName()}onClose(){switch(this._focusedView){case"Watch":this._commandService.executeCommand("workbench.debug.action.focusWatchView");break;case"Variables":this._commandService.executeCommand("workbench.debug.action.focusVariablesView");break;case"Call Stack":this._commandService.executeCommand("workbench.debug.action.focusCallStackView");break;case"Breakpoints":this._commandService.executeCommand("workbench.debug.action.focusBreakpointsView");break;default:this._commandService.executeCommand("workbench.view.debug")}}provideContent(){return[d(10984,null,"<keybinding:workbench.view.debug>"),d(10985,null,"<keybinding:workbench.action.debug.start>"),d(10982,null,"<keybinding:workbench.panel.repl.view.focus>"),qc.setBreakpoint,qc.addToWatch,d(10992,null),d(10983,null,"<keybinding:workbench.action.debug.restart>"),d(10989,null,"<keybinding:workbench.action.debug.stop>"),d(10977,null,"<keybinding:workbench.action.debug.continue>"),d(10986,null,"<keybinding:workbench.action.debug.stepInto>"),d(10988,null,"<keybinding:workbench.action.debug.stepOver>"),d(10987,null,"<keybinding:workbench.action.debug.stepOut>"),d(10990,null),d(10978,null,"<keybinding:workbench.debug.action.focusBreakpointsView>"),d(10979,null,"<keybinding:workbench.debug.action.focusCallStackView>"),d(10980,null,"<keybinding:workbench.debug.action.focusVariablesView>"),d(10981,null,"<keybinding:workbench.debug.action.focusWatchView>"),d(10991,null,"accessibility.debugWatchVariableAnnouncements")].join(`
`)}};Hut=I([m(0,fe),m(1,Gt)],Hut);var aOo=te("statusBar.debuggingBackground",{dark:"#CC6633",light:"#CC6633",hcDark:"#BA592C",hcLight:"#B5200D"},d(10994,null)),ckn=te("statusBar.debuggingForeground",{dark:DM,light:DM,hcDark:DM,hcLight:"#FFFFFF"},d(10996,null)),dkn=te("statusBar.debuggingBorder",fpe,d(10995,null)),ukn=te("commandCenter.debuggingBackground",ni(aOo,.258),d(10993,null),!0),fKe=class{constructor(i,e,t,o){this.debugService=i;this.contextService=e;this.statusbarService=t;this.configurationService=o;this.disposables=new O;this.styleSheet=Pr();this.debugService.onDidChangeState(this.update,this,this.disposables),this.contextService.onDidChangeWorkbenchState(this.update,this,this.disposables),this.configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("debug.enableStatusBarColor")||n.affectsConfiguration("debug.toolBarLocation"))&&this.update()},void 0,this.disposables),this.update()}set enabled(i){i!==!!this.disposable&&(i?this.disposable=this.statusbarService.overrideStyle({priority:10,foreground:ckn,background:aOo,border:dkn}):(this.disposable.dispose(),this.disposable=void 0))}update(){let i=this.configurationService.getValue("debug"),e=pkn(this.debugService.state,this.debugService.getModel().getSessions());i.enableStatusBarColor?this.enabled=e:this.enabled=!1;let t=i.toolBarLocation==="commandCenter";this.styleSheet.textContent=t&&e?`
			.monaco-workbench {
				${kF(hso)}: ${Tt(ukn)};
			}
		`:""}dispose(){this.disposable?.dispose(),this.disposables.dispose()}};fKe=I([m(0,Hi),m(1,Ae),m(2,Fr),m(3,B)],fKe);function pkn(a,i){return!(a===0||a===1||i.every(e=>e.suppressDebugStatusbar||e.configuration?.noDebug))}var mkn=1024,Fzi=!1,Wzi=!1,vKe=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,n,t,l,c,s,r,u,p,h);this.debugService=o;this.menuService=g;this.logService=f;this.needsRefresh=!1;this.watchExpressionsUpdatedScheduler=this._register(new Dt(()=>{this.needsRefresh=!1,this.tree.updateChildren()},50)),this.watchExpressionsExist=IXe.bindTo(c),this.watchExpressionsExist.set(this.debugService.getModel().getWatchExpressions().length>0),this.expressionRenderer=r.createInstance(PP)}get treeSelection(){return this.tree.getSelection()}renderBody(e){super.renderBody(e),this.element.classList.add("debug-pane"),e.classList.add("debug-watch");let t=vne(e),o=this.instantiationService.createInstance(Rse,this.expressionRenderer);this.tree=this.instantiationService.createInstance(Rp,"WatchExpressions",t,new Vzi,[o,this.instantiationService.createInstance(AP,this.expressionRenderer),this.instantiationService.createInstance(BE,this.expressionRenderer)],this.instantiationService.createInstance(Bzi),{accessibilityProvider:new Uzi,identityProvider:{getId:r=>r.getId()},keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:r=>{if(r!==this.debugService.getViewModel().getSelectedExpression()?.expression)return w$t.getKeyboardNavigationLabel(r)}},dnd:new zzi(this.debugService),overrideStyles:this.getLocationBasedColors().listOverrideStyles}),this._register(this.tree),this.tree.setInput(this.debugService),SXe.bindTo(this.tree.contextKeyService),this._register(BE.rendererOnVisualizationRange(this.debugService.getViewModel(),this.tree)),this._register(this.tree.onContextMenu(r=>this.onContextMenu(r))),this._register(this.tree.onMouseDblClick(r=>this.onMouseDblClick(r))),this._register(this.debugService.getModel().onDidChangeWatchExpressions(async r=>{this.watchExpressionsExist.set(this.debugService.getModel().getWatchExpressions().length>0),this.isBodyVisible()?(r&&!r.name&&(Wzi=!0),await this.tree.updateChildren(),Wzi=!1,r instanceof Fd&&this.tree.reveal(r)):this.needsRefresh=!0})),this._register(this.debugService.getViewModel().onDidFocusStackFrame(()=>{if(!this.isBodyVisible()){this.needsRefresh=!0;return}this.watchExpressionsUpdatedScheduler.isScheduled()||this.watchExpressionsUpdatedScheduler.schedule()})),this._register(this.debugService.getViewModel().onWillUpdateViews(()=>{Fzi||this.tree.updateChildren()})),this._register(this.onDidChangeBodyVisibility(r=>{r&&this.needsRefresh&&this.watchExpressionsUpdatedScheduler.schedule()}));let n;this._register(this.debugService.getViewModel().onDidSelectExpression(r=>{let s=r?.expression;s&&this.tree.hasNode(s)?(n=this.tree.options.horizontalScrolling,n&&this.tree.updateOptions({horizontalScrolling:!1}),s.name&&this.tree.rerender(s)):!s&&n!==void 0&&(this.tree.updateOptions({horizontalScrolling:n}),n=void 0)})),this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async r=>{r instanceof ac&&this.tree.hasNode(r)&&(await this.tree.updateChildren(r,!1,!0),await this.tree.expand(r))}))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}focus(){super.focus(),this.tree.domFocus()}collapseAll(){this.tree.collapseAll()}onMouseDblClick(e){if(e.browserEvent.target.className.indexOf("twistie")>=0)return;let t=e.element,o=this.debugService.getViewModel().getSelectedExpression();t instanceof Fd&&t!==o?.expression||t instanceof zM&&t.treeItem.canEdit?this.debugService.getViewModel().setSelectedExpression(t,!1):t||this.debugService.addWatchExpression()}async onContextMenu(e){let t=e.element;if(!t)return;let o=this.tree.getSelection(),n=t&&await hkn(this.contextKeyService,t,this.debugService,this.logService),r=this.menuService.getMenuActions(R.DebugWatchContext,n,{arg:t,shouldForwardArgs:!1}),{secondary:s}=um(r,"inline");this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>s,getActionsContext:()=>t&&o.includes(t)?o:t?[t]:[]})}};vKe=I([m(1,Xe),m(2,Hi),m(3,Le),m(4,F),m(5,ji),m(6,B),m(7,X),m(8,Je),m(9,Pe),m(10,ot),m(11,Yt),m(12,re)],vKe);var Vzi=class{getHeight(i){return 22}getTemplateId(i){return i instanceof Fd?Rse.ID:i instanceof zM?BE.ID:AP.ID}};function lOo(a){return typeof a.getConfigurationManager=="function"}var Bzi=class extends Zq{hasChildren(i){return lOo(i)||i.hasChildren}doGetChildren(i){if(lOo(i)){let e=i,t=e.getModel().getWatchExpressions(),o=e.getViewModel();return Promise.all(t.map(n=>n.name&&!Wzi?n.evaluate(o.focusedSession,o.focusedStackFrame,"watch").then(()=>n):Promise.resolve(n)))}return i.getChildren()}},Rse=class extends p1{constructor(e,t,o,n,r,s,l){super(n,r,s);this.expressionRenderer=e;this.menuService=t;this.contextKeyService=o;this.configurationService=l}static{this.ID="watchexpression"}get templateId(){return Rse.ID}renderElement(e,t,o){o.elementDisposable.clear(),o.elementDisposable.add(this.configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("debug.showVariableTypes")&&super.renderExpressionElement(e.element,e,o)})),super.renderExpressionElement(e.element,e,o)}renderExpression(e,t,o){let n;t.type.textContent="";let r=this.configurationService.getValue("debug").showVariableTypes;r&&e.type?(n=typeof e.value=="string"?`${e.name}: `:e.name,t.type.textContent=e.type+" ="):n=typeof e.value=="string"?`${e.name} =`:e.name;let s;e.type?r?s=`${e.name}`:s=e.type===e.value?e.type:`${e.type}`:s=e.value,t.label.set(n,o,s),t.elementDisposable.add(this.expressionRenderer.renderValue(t.value,e,{showChanged:!0,maxValueLength:mkn,colorize:!0,session:e.getSession()}))}getInputBoxOptions(e,t){return t?{initialValue:e.value,ariaLabel:d(11009,null),onFinish:async(o,n)=>{if(n&&o){let r=this.debugService.getViewModel().focusedStackFrame;r&&(e instanceof ac||e instanceof Fd)&&(await e.setExpression(o,r),this.debugService.getViewModel().updateViews())}}}:{initialValue:e.name?e.name:"",ariaLabel:d(11012,null),placeholder:d(11013,null),onFinish:(o,n)=>{n&&o?(this.debugService.renameWatchExpression(e.getId(),o),Fzi=!0,this.debugService.getViewModel().updateViews(),Fzi=!1):e.name||this.debugService.removeWatchExpressions(e.getId())}}}renderActionBar(e,t){let o=Hzi(this.contextKeyService,t),n=t,r=this.menuService.getMenuActions(R.DebugWatchContext,o,{arg:n,shouldForwardArgs:!1}),{primary:s}=um(r,"inline");e.clear(),e.context=n,e.push(s,{icon:!0,label:!1})}};Rse=I([m(1,Yt),m(2,X),m(3,Hi),m(4,qn),m(5,ot),m(6,B)],Rse);function Hzi(a,i,e=[]){let t=i.getSession();return a.createOverlay([[NH.key,"evaluateName"in i],[$2.key,i instanceof Fd?"expression":i instanceof ac?"variable":void 0],[KZ.key,!!t?.capabilities.supportsReadMemoryRequest&&i.memoryReference!==void 0],[qpe.key,!!i.presentationHint?.attributes?.includes("readOnly")||i.presentationHint?.lazy],[QZ.key,i.type],[TDe.key,t?.configuration.type],...e])}async function hkn(a,i,e,t){let o=i.getSession();if(!o||!o.capabilities.supportsDataBreakpoints)return Hzi(a,i);let n=[],r=e.getViewModel().focusedStackFrame,s;try{"evaluateName"in i&&i.evaluateName?s=await o.dataBreakpointInfo(i.evaluateName,void 0,r?.frameId):i instanceof ac?s=await o.dataBreakpointInfo(i.name,i.parent.reference,r?.frameId):s=await o.dataBreakpointInfo(i.name,void 0,r?.frameId)}catch(u){t.error("Failed to get data breakpoint info for watch expression:",u)}let l=s?.dataId,c=s?.accessTypes;if(N$t(s),!c)n.push([Q2.key,!!l]);else for(let u of c)switch(u){case"read":n.push([$Z.key,!!l]);break;case"write":n.push([Q2.key,!!l]);break;case"readWrite":n.push([qZ.key,!!l]);break}return Hzi(a,i,n)}var Uzi=class{getWidgetAriaLabel(){return d(11010,null)}getAriaLabel(i){return i instanceof Fd?d(11011,null,i.name,i.value):d(11014,null,i.name,i.value)}},zzi=class{constructor(i){this.debugService=i}onDragStart(i,e){i instanceof Yw&&e.dataTransfer.setData("text/plain",i.elements[0].name)}onDragOver(i,e,t,o,n){if(!(i instanceof Yw))return!1;let r=i.elements;if(!(r.length>0&&r[0]instanceof Fd))return!1;let s;if(t===void 0)s="drop-target-after",t=-1;else switch(o){case 0:case 1:s="drop-target-before";break;case 2:case 3:s="drop-target-after";break}return{accept:!0,effect:{type:1,position:s},feedback:[t]}}getDragURI(i){return!(i instanceof Fd)||i===this.debugService.getViewModel().getSelectedExpression()?.expression?null:i.getId()}getDragLabel(i){if(i.length===1)return i[0].name}drop(i,e,t,o,n){if(!(i instanceof Yw))return;let r=i.elements[0];if(!(r instanceof Fd))throw new Error("Invalid dragged element");let s=this.debugService.getModel().getWatchExpressions(),l=s.indexOf(r),c;if(e instanceof Fd){switch(c=s.indexOf(e),o){case 3:case 2:c++;break}l<c&&c--}else c=s.length-1;this.debugService.moveWatchExpression(r.getId(),c)}dispose(){}};W(class extends rr{constructor(){super({id:"watch.collapse",viewId:vE,title:d(11006,null),f1:!1,icon:L.collapseAll,precondition:IXe,menu:{id:R.ViewTitle,order:30,group:"navigation",when:C.equals("view",vE)}})}runInView(i,e){e.collapseAll()}});var Kzi="workbench.debug.viewlet.action.addWatchExpression",Gzi=d(11005,null);W(class extends z{constructor(){super({id:Kzi,title:Gzi,f1:!1,icon:cyo,menu:{id:R.ViewTitle,group:"navigation",when:C.equals("view",vE)}})}run(i){i.get(Hi).addWatchExpression()}});var qzi="workbench.debug.viewlet.action.removeAllWatchExpressions",$zi=d(11008,null);W(class extends z{constructor(){super({id:qzi,title:$zi,f1:!1,icon:ayo,precondition:IXe,menu:{id:R.ViewTitle,order:20,group:"navigation",when:C.equals("view",vE)}})}run(i){i.get(Hi).removeWatchExpressions()}});W(class extends rr{constructor(){super({id:YEo,title:d(11007,null),f1:!1,viewId:vE,precondition:IXe,keybinding:{primary:2593,weight:200,when:C.and(rc.isEqualTo(vE),UZ.negate())},menu:{id:R.DebugWatchContext,order:20,group:"3_modification",when:$2.isEqualTo("expression")}})}runInView(i,e,t){let o=i.get(Bi);t||(t=e.treeSelection.at(-1)),t&&o.writeText(t.name)}});var Uut=class{constructor(i){this.debugService=i;this.type="pickerPick";this.label=d(10670,null);this.icon=L.debug;this.ordinal=-200}isEnabled(){let e=this.debugService.getViewModel().focusedSession;return!!e&&e.state===2}asPicker(i){let e=new O,t=De("debugPicker.mode","main"),o=De("debugPicker.query",""),n=this.createPicksObservable(t,o,e);return{placeholder:d(10675,null),picks:(r,s)=>{e.add(ve(c=>{o.set(r.read(c),void 0)}));let l=new qe(s);return e.add(ee(()=>l.dispose(!0))),n},goBack:()=>t.get()==="expression"?(t.set("main",void 0),!0):!1,dispose:()=>e.dispose()}}createPicksObservable(i,e,t){let o=vA(e,300);return ke(n=>i.read(n)==="expression"?this.getExpressionPicks(o,t):this.getMainPicks(i)).flatten()}getMainPicks(i){return ke(t=>new Uc(this.buildMainPicks(i))).map((t,o)=>{let n=t.promiseResult.read(o);return{picks:n?.data||[],busy:n===void 0}})}async buildMainPicks(i){let e=[],t=this.debugService.getViewModel(),o=t.focusedStackFrame;if(!t.focusedSession||!o)return e;e.push({label:d(10672,null),iconClass:q.asClassName(L.symbolVariable),asAttachment:()=>(i.set("expression",void 0),"noop")});let r=this.debugService.getModel().getWatchExpressions();if(r.length>0){e.push({type:"separator",label:d(10677,null)});for(let l of r)e.push({label:l.name,description:l.value,iconClass:q.asClassName(L.eye),asAttachment:()=>Q6t(o,Y6t(l))})}let s=[];try{s=await o.getScopes()}catch{}for(let l of s)if(!(l.expensive&&!l.childrenHaveBeenLoaded)){e.push({type:"separator",label:l.name});try{let c=await l.getChildren();c.length>1&&e.push({label:d(10669,null,l.name),iconClass:q.asClassName(L.symbolNamespace),asAttachment:()=>Q6t(o,cOo(l,c))});for(let u of c)e.push({label:u.name,description:gkn(u),iconClass:q.asClassName(L.symbolVariable),asAttachment:()=>Q6t(o,Y6t(u))})}catch{}}return e}getExpressionPicks(i,e){return ke(o=>{let n=i.read(o),r=new qe;return o.store.add(ee(()=>r.dispose(!0))),new Uc(this.evaluateExpression(n,r.token))}).map((o,n)=>{let r=o.promiseResult.read(n);return{picks:r?.data||[],busy:r===void 0}})}async evaluateExpression(i,e){if(!i.trim())return[{label:d(10676,null),disabled:!0,asAttachment:()=>"noop"}];let t=this.debugService.getViewModel(),o=t.focusedSession,n=t.focusedStackFrame;if(!o||!n)return[{label:d(10673,null),disabled:!0,asAttachment:()=>"noop"}];try{let r=await o.evaluate(i,n.frameId,"watch");if(e.isCancellationRequested)return[];if(r?.body){let s=r.body.result,l=r.body.type;return[{label:i,description:fkn(s,l),iconClass:q.asClassName(L.symbolVariable),asAttachment:()=>Q6t(n,{kind:"debugVariable",id:`debug-expression:${i}`,name:i,fullName:i,icon:L.debug,value:s,expression:i,type:l,modelDescription:jzi(i,s,l)})}]}else return[{label:i,description:d(10674,null),disabled:!0,asAttachment:()=>"noop"}]}catch(r){return[{label:i,description:r instanceof Error?r.message:d(10671,null),disabled:!0,asAttachment:()=>"noop"}]}}};Uut=I([m(0,Hi)],Uut);function Y6t(a){return{kind:"debugVariable",id:`debug-variable:${a.getId()}`,name:a.name,fullName:a.name,icon:L.debug,value:a.value,expression:a.name,type:a.type,modelDescription:jzi(a.name,a.value,a.type)}}function X6t(a){let i=a.source.uri,e=G.lift(a.range);return e.isEmpty()&&(e=e.setEndPosition(e.startLineNumber+1,1)),{kind:"file",value:{uri:i,range:e},id:`debug-paused-location:${i.toString()}:${e.startLineNumber}`,name:Be(i),modelDescription:"The debugger is currently paused at this location"}}function Q6t(a,i){return[X6t(a),i]}function cOo(a,i){let e=i.map(t=>`${t.name}: ${t.value}`).join(`
`);return{kind:"debugVariable",id:`debug-scope:${a.name}`,name:`Scope: ${a.name}`,fullName:`Scope: ${a.name}`,icon:L.debug,value:e,expression:a.name,type:"scope",modelDescription:`Debug scope "${a.name}" with ${i.length} variables:
${e}`}}function gkn(a){let i=a.value,e=a.type;return e&&i?`${e}: ${i}`:i||e||""}function fkn(a,i){return i&&a?`${i}: ${a}`:a||i||""}function jzi(a,i,e){let t=`Debug variable "${a}"`;return e&&(t+=` of type ${e}`),t+=` with value: ${i}`,t}var WSe=class extends k{static{this.ID="workbench.contrib.chat.debugChatContextContribution"}constructor(i,e){super(),this._register(i.registerChatContextItem(e.createInstance(Uut)))}};WSe=I([m(0,iI),m(1,F)],WSe);W(class extends z{constructor(){super({id:"workbench.debug.action.addVariableToChat",title:d(10668,null),f1:!1,menu:{id:R.DebugVariablesContext,group:"z_commands",order:110,when:Z.enabled}})}async run(a,i){let e=a.get(Lt),t=a.get(Hi),o=await e.revealWidget();if(!o)return;let n=bkn(i);if(n){let r=t.getViewModel().focusedStackFrame;r&&o.attachmentModel.addContext(X6t(r)),o.attachmentModel.addContext(n)}}});W(class extends z{constructor(){super({id:"workbench.debug.action.addWatchExpressionToChat",title:d(10668,null),f1:!1,menu:{id:R.DebugWatchContext,group:"z_commands",order:110,when:Z.enabled}})}async run(a,i){let e=a.get(Lt),t=a.get(Hi),o=await e.revealWidget();if(!i||!o)return;let n=t.getViewModel().focusedStackFrame;n&&o.attachmentModel.addContext(X6t(n)),o.attachmentModel.addContext(Y6t(i))}});W(class extends z{constructor(){super({id:"workbench.debug.action.addScopeToChat",title:d(10668,null),f1:!1,menu:{id:R.DebugScopesContext,group:"z_commands",order:1,when:Z.enabled}})}async run(a,i){let e=a.get(Lt),t=a.get(Hi),o=await e.revealWidget();if(!i||!o)return;let r=t.getViewModel().focusedStackFrame;if(r)try{let l=(await r.getScopes()).find(c=>c.name===i.scope.name);if(l){let c=await l.getChildren();o.attachmentModel.addContext(X6t(r)),o.attachmentModel.addContext(cOo(l,c))}}catch{}}});function vkn(a){return typeof a=="object"&&a!==null&&"variable"in a&&"sessionId"in a}function bkn(a){if(a instanceof ac)return Y6t(a);if(vkn(a)){let i=a.variable;return{kind:"debugVariable",id:`debug-variable:${i.name}`,name:i.name,fullName:i.evaluateName??i.name,icon:L.debug,value:i.value,expression:i.evaluateName??i.name,type:i.type,modelDescription:jzi(i.evaluateName||i.name,i.value,i.type)}}}var J6t=class{constructor(){this.stopped=!1;this.stopEmitter=new T;this.onDidSessionStop=this.stopEmitter.event}sessionStopped(){this.stopped||(this.stopped=!0,this.stopEmitter.fire())}};var Z6t="debug.breakpoint",e9t="debug.functionbreakpoint",t9t="debug.databreakpoint",i9t="debug.exceptionbreakpoint",o9t="debug.watchexpressions",dOo="debug.chosenenvironment",uOo="debug.uxstate",bKe=class extends k{constructor(e,t,o,n){super();this.storageService=e;this.textFileService=t;this.uriIdentityService=o;this.logService=n;this.breakpoints=De(this,this.loadBreakpoints()),this.functionBreakpoints=De(this,this.loadFunctionBreakpoints()),this.exceptionBreakpoints=De(this,this.loadExceptionBreakpoints()),this.dataBreakpoints=De(this,this.loadDataBreakpoints()),this.watchExpressions=De(this,this.loadWatchExpressions()),this._register(e.onDidChangeValue(1,void 0,this._store)(r=>{if(r.external)switch(r.key){case Z6t:return this.breakpoints.set(this.loadBreakpoints(),void 0);case e9t:return this.functionBreakpoints.set(this.loadFunctionBreakpoints(),void 0);case i9t:return this.exceptionBreakpoints.set(this.loadExceptionBreakpoints(),void 0);case t9t:return this.dataBreakpoints.set(this.loadDataBreakpoints(),void 0);case o9t:return this.watchExpressions.set(this.loadWatchExpressions(),void 0)}}))}loadDebugUxState(){return this.storageService.get(uOo,1,"default")}storeDebugUxState(e){this.storageService.store(uOo,e,1,1)}loadBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(Z6t,1,"[]")).map(t=>(t.uri=A.revive(t.uri),new pb(t,this.textFileService,this.uriIdentityService,this.logService,t.id)))}catch{}return e||[]}loadFunctionBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(e9t,1,"[]")).map(t=>new QI(t,t.id))}catch{}return e||[]}loadExceptionBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(i9t,1,"[]")).map(t=>new pN(t,t.id))}catch{}return e||[]}loadDataBreakpoints(){let e;try{e=JSON.parse(this.storageService.get(t9t,1,"[]")).map(t=>new rw(t,t.id))}catch{}return e||[]}loadWatchExpressions(){let e;try{e=JSON.parse(this.storageService.get(o9t,1,"[]")).map(t=>new Fd(t.name,t.id))}catch{}return e||[]}loadChosenEnvironments(){let e=JSON.parse(this.storageService.get(dOo,1,"{}"));return Uwe(e,t=>typeof t=="string"?{type:t}:t)}storeChosenEnvironments(e){this.storageService.store(dOo,JSON.stringify(e),1,1)}storeWatchExpressions(e){e.length?this.storageService.store(o9t,JSON.stringify(e.map(t=>({name:t.name,id:t.getId()}))),1,1):this.storageService.remove(o9t,1)}storeBreakpoints(e){let t=e.getBreakpoints();t.length?this.storageService.store(Z6t,JSON.stringify(t),1,1):this.storageService.remove(Z6t,1);let o=e.getFunctionBreakpoints();o.length?this.storageService.store(e9t,JSON.stringify(o),1,1):this.storageService.remove(e9t,1);let n=e.getDataBreakpoints().filter(s=>s.canPersist);n.length?this.storageService.store(t9t,JSON.stringify(n),1,1):this.storageService.remove(t9t,1);let r=e.getExceptionBreakpoints();r.length?this.storageService.store(i9t,JSON.stringify(r),1,1):this.storageService.remove(i9t,1)}};bKe=I([m(0,de),m(1,Uo),m(2,gt),m(3,re)],bKe);var SKe=class{constructor(i,e){this.model=i;this.telemetryService=e}logDebugSessionStart(i,e){let t=i.getMainExtensionDescriptor();this.telemetryService.publicLog("debugSessionStart",{type:i.type,breakpointCount:this.model.getBreakpoints().length,exceptionBreakpoints:this.model.getExceptionBreakpoints(),watchExpressionsCount:this.model.getWatchExpressions().length,extensionName:t.identifier.value,isBuiltin:t.isBuiltin,launchJsonExists:e})}logDebugSessionStop(i,e){let t=this.model.getBreakpoints();this.telemetryService.publicLog("debugSessionStop",{type:i&&i.configuration.type,success:e.emittedStopped||t.length===0,sessionLengthInSeconds:e.sessionLengthInSeconds,breakpointCount:t.length,watchExpressionsCount:this.model.getWatchExpressions().length})}};SKe=I([m(1,_e)],SKe);var n9t=class extends k{constructor(e){super();this.contextKeyService=e;this.firstSessionStart=!0;this._onDidFocusSession=this._register(new T);this._onDidFocusThread=this._register(new T);this._onDidFocusStackFrame=this._register(new T);this._onDidSelectExpression=this._register(new T);this._onDidEvaluateLazyExpression=this._register(new T);this._onWillUpdateViews=this._register(new T);this._onDidChangeVisualization=this._register(new T);this.visualized=new WeakMap;this.preferredVisualizers=new Map;e.bufferChangeEvents(()=>{this.expressionSelectedContextKey=UZ.bindTo(e),this.loadedScriptsSupportedContextKey=yXe.bindTo(e),this.stepBackSupportedContextKey=wXe.bindTo(e),this.focusedSessionIsAttach=Nx.bindTo(e),this.focusedSessionIsNoDebug=j2.bindTo(e),this.restartFrameSupportedContextKey=TAt.bindTo(e),this.stepIntoTargetsSupported=GZ.bindTo(e),this.jumpToCursorSupported=Gpe.bindTo(e),this.setVariableSupported=CXe.bindTo(e),this.setDataBreakpointAtByteSupported=DDe.bindTo(e),this.setExpressionSupported=xXe.bindTo(e),this.multiSessionDebug=MAt.bindTo(e),this.terminateDebuggeeSupported=lN.bindTo(e),this.suspendDebuggeeSupported=jZ.bindTo(e),this.terminateThreadsSupported=kXe.bindTo(e),this.disassembleRequestSupported=LDe.bindTo(e),this.focusedStackFrameHasInstructionPointerReference=AAt.bindTo(e)})}getId(){return"root"}get focusedSession(){return this._focusedSession}get focusedThread(){return this._focusedThread}get focusedStackFrame(){return this._focusedStackFrame}setFocus(e,t,o,n){let r=this._focusedStackFrame!==e,s=this._focusedSession!==o,l=this._focusedThread!==t;this._focusedStackFrame=e,this._focusedThread=t,this._focusedSession=o,this.contextKeyService.bufferChangeEvents(()=>{this.loadedScriptsSupportedContextKey.set(!!o?.capabilities.supportsLoadedSourcesRequest),this.stepBackSupportedContextKey.set(!!o?.capabilities.supportsStepBack),this.restartFrameSupportedContextKey.set(!!o?.capabilities.supportsRestartFrame),this.stepIntoTargetsSupported.set(!!o?.capabilities.supportsStepInTargetsRequest),this.jumpToCursorSupported.set(!!o?.capabilities.supportsGotoTargetsRequest),this.setVariableSupported.set(!!o?.capabilities.supportsSetVariable),this.setDataBreakpointAtByteSupported.set(!!o?.capabilities.supportsDataBreakpointBytes),this.setExpressionSupported.set(!!o?.capabilities.supportsSetExpression),this.terminateDebuggeeSupported.set(!!o?.capabilities.supportTerminateDebuggee),this.suspendDebuggeeSupported.set(!!o?.capabilities.supportSuspendDebuggee),this.terminateThreadsSupported.set(!!o?.capabilities.supportsTerminateThreadsRequest),this.disassembleRequestSupported.set(!!o?.capabilities.supportsDisassembleRequest),this.focusedStackFrameHasInstructionPointerReference.set(!!e?.instructionPointerReference);let c=!!o&&jpe(o);this.focusedSessionIsAttach.set(c),this.focusedSessionIsNoDebug.set(!!o&&!!o.configuration.noDebug)}),s&&this._onDidFocusSession.fire(o),r?this._onDidFocusStackFrame.fire({stackFrame:e,explicit:n,session:o}):l&&this._onDidFocusThread.fire({thread:t,explicit:n,session:o})}get onDidFocusSession(){return this._onDidFocusSession.event}get onDidFocusThread(){return this._onDidFocusThread.event}get onDidFocusStackFrame(){return this._onDidFocusStackFrame.event}get onDidChangeVisualization(){return this._onDidChangeVisualization.event}getSelectedExpression(){return this.selectedExpression}setSelectedExpression(e,t){this.selectedExpression=e?{expression:e,settingWatch:t}:void 0,this.expressionSelectedContextKey.set(!!e),this._onDidSelectExpression.fire(this.selectedExpression)}get onDidSelectExpression(){return this._onDidSelectExpression.event}get onDidEvaluateLazyExpression(){return this._onDidEvaluateLazyExpression.event}updateViews(){this._onWillUpdateViews.fire()}get onWillUpdateViews(){return this._onWillUpdateViews.event}isMultiSessionView(){return!!this.multiSessionDebug.get()}setMultiSessionView(e){this.multiSessionDebug.set(e)}setVisualizedExpression(e,t){let o=this.visualized.get(e)||e,n=this.getPreferredVisualizedKey(e);t?(this.visualized.set(e,t),this.preferredVisualizers.set(n,t.treeId)):(this.visualized.delete(e),this.preferredVisualizers.delete(n)),this._onDidChangeVisualization.fire({original:o,replacement:t||e})}getVisualizedExpression(e){return this.visualized.get(e)||this.preferredVisualizers.get(this.getPreferredVisualizedKey(e))}async evaluateLazyExpression(e){await e.evaluateLazy(),this._onDidEvaluateLazyExpression.fire(e)}getPreferredVisualizedKey(e){return JSON.stringify([e.name,e.type,!!e.memoryReference].join("\0"))}};var IKe=class{constructor(i,e){this.breakpointContribution=i;this.contextKeyService=e;this.breakpointsWhen=typeof i.when=="string"?C.deserialize(i.when):void 0}get language(){return this.breakpointContribution.language}get enabled(){return!this.breakpointsWhen||this.contextKeyService.contextMatchesRules(this.breakpointsWhen)}};IKe=I([m(1,X)],IKe);function r9t(a){a.pattern=a.pattern||"^(?!.*\\$\\{(env|config|command)\\.)",a.patternErrorMessage=a.patternErrorMessage||d(18779,null)}var yKe=class{constructor(i,e,t,o,n,r,s,l,c,u){this.adapterManager=i;this.configurationService=o;this.resourcePropertiesService=n;this.configurationResolverService=r;this.environmentService=s;this.debugService=l;this.contextKeyService=c;this.productService=u;this.mergedExtensionDescriptions=[];this.debuggerContribution={type:e.type},this.merge(e,t),this.debuggerWhen=typeof this.debuggerContribution.when=="string"?C.deserialize(this.debuggerContribution.when):void 0,this.debuggerHiddenWhen=typeof this.debuggerContribution.hiddenWhen=="string"?C.deserialize(this.debuggerContribution.hiddenWhen):void 0}merge(i,e){function t(o,n,r,s=0){return Di(o)?(Di(n)&&Object.keys(n).forEach(l=>{l!=="__proto__"&&(Di(o[l])&&Di(n[l])?t(o[l],n[l],r,s+1):l in o?r&&(s===0&&l==="type"||(o[l]=n[l])):o[l]=n[l])}),o):n}this.mergedExtensionDescriptions.indexOf(e)<0&&(this.mergedExtensionDescriptions.push(e),t(this.debuggerContribution,i,e.isBuiltin),Blo(i)&&(this.mainExtensionDescription=e))}async startDebugging(i,e){let t=this.debugService.getModel().getSession(e);return await this.debugService.startDebugging(void 0,i,{parentSession:t},void 0)}async createDebugAdapter(i){await this.adapterManager.activateDebuggers("onDebugAdapterProtocolTracker",this.type);let e=this.adapterManager.createDebugAdapter(i);if(e)return Promise.resolve(e);throw new Error(d(11090,null,this.type))}async substituteVariables(i,e){let t=await this.adapterManager.substituteVariables(this.type,i,e);return await this.configurationResolverService.resolveWithInteractionReplace(i,t,"launch",this.variables,t.__configurationTarget)}runInTerminal(i,e){return this.adapterManager.runInTerminal(this.type,i,e)}get label(){return this.debuggerContribution.label||this.debuggerContribution.type}get type(){return this.debuggerContribution.type}get variables(){return this.debuggerContribution.variables}get configurationSnippets(){return this.debuggerContribution.configurationSnippets}get languages(){return this.debuggerContribution.languages}get when(){return this.debuggerWhen}get hiddenWhen(){return this.debuggerHiddenWhen}get enabled(){return!this.debuggerWhen||this.contextKeyService.contextMatchesRules(this.debuggerWhen)}get isHiddenFromDropdown(){return this.debuggerHiddenWhen?this.contextKeyService.contextMatchesRules(this.debuggerHiddenWhen):!1}get strings(){return this.debuggerContribution.strings??this.debuggerContribution.uiMessages}interestedInLanguage(i){return!!(this.languages&&this.languages.indexOf(i)>=0)}hasInitialConfiguration(){return!!this.debuggerContribution.initialConfigurations}hasDynamicConfigurationProviders(){return this.debugService.getConfigurationManager().hasDebugConfigurationProvider(this.type,2)}hasConfigurationProvider(){return this.debugService.getConfigurationManager().hasDebugConfigurationProvider(this.type)}getInitialConfigurationContent(i){let e=this.debuggerContribution.initialConfigurations||[];i&&(e=e.concat(i));let t=this.resourcePropertiesService.getEOL(A.from({scheme:Q.untitled,path:"1"}))===`\r
`?`\r
`:`
`,o=JSON.stringify(e,null,"	").split(`
`).map(u=>"	"+u).join(t).trim(),n=d(11097,null),r=d(11098,null),s=d(11099,null,"https://go.microsoft.com/fwlink/?linkid=830387"),l=["{",`	// ${n}`,`	// ${r}`,`	// ${s}`,'	"version": "0.2.0",',`	"configurations": ${o}`,"}"].join(t),c=this.configurationService.getValue();return c.editor&&c.editor.insertSpaces&&(l=l.replace(new RegExp("	","g")," ".repeat(c.editor.tabSize))),Promise.resolve(l)}getMainExtensionDescriptor(){return this.mainExtensionDescription||this.mergedExtensionDescriptions[0]}getCustomTelemetryEndpoint(){let i=this.debuggerContribution.aiKey;if(!i)return;let e=KRt(this.environmentService.remoteAuthority,this.productService)!=="other";return{id:`${this.getMainExtensionDescriptor().publisher}.${this.type}`,aiKey:i,sendErrorTelemetry:e}}getSchemaAttributes(i){return this.debuggerContribution.configurationAttributes?Object.entries(this.debuggerContribution.configurationAttributes).map(([e,t])=>{let o=`${this.type}:${e}`,n=`${this.type}:${e}:platform`,r=["name","type","request"];t.required=t.required&&t.required.length?r.concat(t.required):r,t.additionalProperties=!1,t.type="object",t.properties||(t.properties={});let s=t.properties;s.type={enum:[this.type],enumDescriptions:[this.label],description:d(11094,null),pattern:"^(?!node2)",deprecationMessage:this.debuggerContribution.deprecated||(this.enabled?void 0:NAt(this.type)),doNotSuggest:!!this.debuggerContribution.deprecated,errorMessage:d(11095,null),patternErrorMessage:d(11100,null)},s.request={enum:[e],description:d(11093,null)};for(let c in i.common.properties)s[c]={$ref:`#/definitions/common/properties/${c}`};Object.keys(s).forEach(c=>{r9t(s[c])}),i[o]={...t},i[n]={type:"object",additionalProperties:!1,properties:yA(s,c=>c!=="type"&&c!=="request"&&c!=="name")};let l={...t};return l.properties={...s,windows:{$ref:`#/definitions/${n}`,description:d(11096,null)},osx:{$ref:`#/definitions/${n}`,description:d(11092,null)},linux:{$ref:`#/definitions/${n}`,description:d(11091,null)}},l}):null}};yKe=I([m(3,B),m(4,BL),m(5,Xp),m(6,Mt),m(7,Hi),m(8,X),m(9,Ze)],yKe);var hOo=zn.registerExtensionPoint({extensionPoint:"debuggers",defaultExtensionKind:["workspace"],jsonSchema:{description:d(11131,null),type:"array",defaultSnippets:[{body:[{type:""}]}],items:{additionalProperties:!1,type:"object",defaultSnippets:[{body:{type:"",program:"",runtime:""}}],properties:{type:{description:d(11149,null),type:"string"},label:{description:d(11138,null),type:"string"},program:{description:d(11144,null),type:"string"},args:{description:d(11132,null),type:"array"},runtime:{description:d(11145,null),type:"string"},runtimeArgs:{description:d(11146,null),type:"array"},variables:{description:d(11150,null),type:"object"},initialConfigurations:{description:d(11137,null),type:["array","string"]},languages:{description:d(11139,null),type:"array"},configurationSnippets:{description:d(11134,null),type:"array"},configurationAttributes:{description:d(11133,null),type:"object"},when:{description:d(11151,null),type:"string",default:""},hiddenWhen:{description:d(11136,null),type:"string",default:""},deprecated:{description:d(11135,null),type:"string",default:""},windows:{description:d(11152,null),type:"object",properties:{runtime:{description:d(11153,null),type:"string"}}},osx:{description:d(11142,null),type:"object",properties:{runtime:{description:d(11143,null),type:"string"}}},linux:{description:d(11140,null),type:"object",properties:{runtime:{description:d(11141,null),type:"string"}}},strings:{description:d(11147,null),type:"object",properties:{unverifiedBreakpoints:{description:d(11148,null),type:"string"}}}}}}}),gOo=zn.registerExtensionPoint({extensionPoint:"breakpoints",jsonSchema:{description:d(11128,null),type:"array",defaultSnippets:[{body:[{language:""}]}],items:{type:"object",additionalProperties:!1,defaultSnippets:[{body:{language:""}}],properties:{language:{description:d(11129,null),type:"string"},when:{description:d(11130,null),type:"string",default:""}}}}}),Yzi={type:"object",description:d(11123,null),properties:{hidden:{type:"boolean",default:!1,description:d(11125,null)},group:{type:"string",default:"",description:d(11124,null)},order:{type:"number",default:1,description:d(11126,null)}},default:{hidden:!1,group:"",order:1}},mOo={name:"Compound",configurations:[]},Lse={id:mU,type:"object",title:d(11117,null),allowTrailingCommas:!0,allowComments:!0,required:[],default:{version:"0.2.0",configurations:[],compounds:[]},properties:{version:{type:"string",description:d(11118,null),default:"0.2.0"},configurations:{type:"array",description:d(11116,null),items:{defaultSnippets:[],type:"object",oneOf:[]}},compounds:{type:"array",description:d(11114,null),items:{type:"object",required:["name","configurations"],properties:{name:{type:"string",description:d(11112,null)},presentation:Yzi,configurations:{type:"array",default:[],items:{oneOf:[{enum:[],description:d(11127,null)},{type:"object",required:["name"],properties:{name:{enum:[],description:d(11112,null)},folder:{enum:[],description:d(11111,null)}}}]},description:d(11115,null)},stopAll:{type:"boolean",default:!1,description:d(11113,null)},preLaunchTask:{type:"string",default:"",description:d(11119,null)}},default:mOo},default:[mOo]},inputs:dNe.definitions.inputs}},Qzi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.debuggers}render(e){let t=e.contributes?.debuggers||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(11120,null),d(11121,null)],n=t.map(r=>[r.label??"",r.type]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"debuggers",label:d(11122,null),access:{canToggle:!1},renderer:new Vt(Qzi)});var Ikn=oe.as(Ta.JSONContribution),wKe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.delegate=e;this.editorService=t;this.configurationService=o;this.quickInputService=n;this.instantiationService=r;this.commandService=s;this.extensionService=l;this.contextKeyService=c;this.languageService=u;this.dialogService=p;this.lifecycleService=h;this.tasksService=g;this.menuService=f;this.debugAdapterFactories=new Map;this._onDidRegisterDebugger=this._register(new T);this._onDidDebuggersExtPointRead=this._register(new T);this.breakpointContributions=[];this.debuggerWhenKeys=new Set;this.taskLabels=[];this.usedDebugTypes=new Set;this.adapterDescriptorFactories=[],this.debuggers=[],this.registerListeners(),this.contextKeyService.bufferChangeEvents(()=>{this.debuggersAvailable=qa.bindTo(c),this.debugExtensionsAvailable=DAt.bindTo(c)}),this._register(this.contextKeyService.onDidChangeContext(b=>{b.affectsSome(this.debuggerWhenKeys)&&(this.debuggersAvailable.set(this.hasEnabledDebuggers()),this.updateDebugAdapterSchema())})),this._register(this.onDidDebuggersExtPointRead(()=>{this.debugExtensionsAvailable.set(this.debuggers.length>0)}));let v=this._register(new Dt(()=>this.updateTaskLabels(),5e3));this._register(U.any(g.onDidChangeTaskConfig,g.onDidChangeTaskProviders)(()=>{v.cancel(),v.schedule()})),this.lifecycleService.when(4).then(()=>this.debugExtensionsAvailable.set(this.debuggers.length>0)),this._register(e.onDidNewSession(b=>{this.usedDebugTypes.add(b.configuration.type)})),v.schedule()}registerListeners(){hOo.setHandler((e,t)=>{t.added.forEach(o=>{o.value.forEach(n=>{if((!n.type||typeof n.type!="string")&&o.collector.error(d(10657,null)),n.type!=="*"){let r=this.getDebugger(n.type);if(r)r.merge(n,o.description);else{let s=this.instantiationService.createInstance(yKe,this,n,o.description);s.when?.keys().forEach(l=>this.debuggerWhenKeys.add(l)),this.debuggers.push(s)}}})}),e.forEach(o=>{o.value.forEach(n=>{n.type==="*"&&this.debuggers.forEach(r=>r.merge(n,o.description))})}),t.removed.forEach(o=>{let n=o.value.map(r=>r.type);this.debuggers=this.debuggers.filter(r=>n.indexOf(r.type)===-1)}),this.updateDebugAdapterSchema(),this._onDidDebuggersExtPointRead.fire()}),gOo.setHandler(e=>{this.breakpointContributions=e.flatMap(t=>t.value.map(o=>this.instantiationService.createInstance(IKe,o)))})}updateTaskLabels(){this.tasksService.getKnownTasks().then(e=>{this.taskLabels=e.map(t=>t._label),this.updateDebugAdapterSchema()})}updateDebugAdapterSchema(){let e=Lse.properties.configurations.items,t=xE.getJsonSchema(),o={common:{properties:{name:{type:"string",description:d(10656,null),default:"Launch"},debugServer:{type:"number",description:d(10660,null),default:4711},preLaunchTask:{anyOf:[t,{type:["string"]}],default:"",defaultSnippets:[{body:{task:"",type:""}}],description:d(10659,null),examples:this.taskLabels},postDebugTask:{anyOf:[t,{type:["string"]}],default:"",defaultSnippets:[{body:{task:"",type:""}}],description:d(10658,null),examples:this.taskLabels},presentation:Yzi,internalConsoleOptions:OAt,suppressMultipleSessionWarning:{type:"boolean",description:d(10667,null),default:!0}}}};Lse.definitions=o,e.oneOf=[],e.defaultSnippets=[],this.debuggers.forEach(n=>{let r=n.getSchemaAttributes(o);r&&e.oneOf&&e.oneOf.push(...r);let s=n.configurationSnippets;s&&e.defaultSnippets&&e.defaultSnippets.push(...s)}),Ikn.registerSchema(mU,Lse)}registerDebugAdapterFactory(e,t){return e.forEach(o=>this.debugAdapterFactories.set(o,t)),this.debuggersAvailable.set(this.hasEnabledDebuggers()),this._onDidRegisterDebugger.fire(),{dispose:()=>{e.forEach(o=>this.debugAdapterFactories.delete(o))}}}hasEnabledDebuggers(){for(let[e]of this.debugAdapterFactories){let t=this.getDebugger(e);if(t&&t.enabled)return!0}return!1}createDebugAdapter(e){let t=this.debugAdapterFactories.get(e.configuration.type);if(t)return t.createDebugAdapter(e)}substituteVariables(e,t,o){let n=this.debugAdapterFactories.get(e);return n?n.substituteVariables(t,o):Promise.resolve(o)}runInTerminal(e,t,o){let n=this.debugAdapterFactories.get(e);return n?n.runInTerminal(t,o):Promise.resolve(void 0)}registerDebugAdapterDescriptorFactory(e){return this.adapterDescriptorFactories.push(e),{dispose:()=>{this.unregisterDebugAdapterDescriptorFactory(e)}}}unregisterDebugAdapterDescriptorFactory(e){let t=this.adapterDescriptorFactories.indexOf(e);t>=0&&this.adapterDescriptorFactories.splice(t,1)}getDebugAdapterDescriptor(e){let t=e.configuration,o=this.adapterDescriptorFactories.filter(n=>n.type===t.type&&n.createDebugAdapterDescriptor);return o.length===1?o[0].createDebugAdapterDescriptor(e):Promise.resolve(void 0)}getDebuggerLabel(e){let t=this.getDebugger(e);if(t)return t.label}get onDidRegisterDebugger(){return this._onDidRegisterDebugger.event}get onDidDebuggersExtPointRead(){return this._onDidDebuggersExtPointRead.event}canSetBreakpointsIn(e){let t=e.getLanguageId();return!t||t==="jsonc"||t==="log"?!1:this.configurationService.getValue("debug").allowBreakpointsEverywhere?!0:this.breakpointContributions.some(o=>o.language===t&&o.enabled)}getDebugger(e){return this.debuggers.find(t=>xr(t.type,e))}getEnabledDebugger(e){let t=this.getDebugger(e);return t&&t.enabled?t:void 0}someDebuggerInterestedInLanguage(e){return!!this.debuggers.filter(t=>t.enabled).find(t=>t.interestedInLanguage(e))}async guessDebugger(e){let t=this.editorService.activeTextEditorControl,o=[],n=null,r=null;if(fn(t)){r=t.getModel();let g=r?r.getLanguageId():void 0;g&&(n=this.languageService.getLanguageName(g));let f=this.debuggers.filter(v=>v.enabled).filter(v=>g&&v.interestedInLanguage(g));if(f.length===1)return{debugger:f[0]};f.length>1&&(o=f)}if((!n||e||r&&this.canSetBreakpointsIn(r))&&o.length===0&&(await this.activateDebuggers("onDebugInitialConfigurations"),o=this.debuggers.filter(g=>g.enabled).filter(g=>g.hasInitialConfiguration()||g.hasDynamicConfigurationProviders()||g.hasConfigurationProvider())),o.length===0&&n){n.indexOf(" ")>=0&&(n=`'${n}'`);let{confirmed:g}=await this.dialogService.confirm({type:wt.Warning,message:d(10655,null,n),primaryButton:d(10661,null,n)});g&&await this.commandService.executeCommand("debug.installAdditionalDebuggers",n);return}this.initExtensionActivationsIfNeeded(),o.sort((g,f)=>g.label.localeCompare(f.label)),o=o.filter(g=>!g.isHiddenFromDropdown);let s=[],l=[];o.forEach(g=>{let f=g.getMainExtensionDescriptor();f.id&&this.earlyActivatedExtensions?.has(f.id)||this.usedDebugTypes.has(g.type)?s.push(g):l.push(g)});let c=[],u=await this.delegate.configurationManager().getDynamicProviders();if(s.length>0&&c.push({type:"separator",label:d(10666,null)},...s.map(g=>({label:g.label,pick:()=>({debugger:g})}))),l.length>0&&(c.length>0&&c.push({type:"separator",label:""}),c.push(...l.map(g=>({label:g.label,pick:()=>({debugger:g})})))),u.length){c.length&&c.push({type:"separator",label:""});for(let g of u)c.push({label:d(10664,null,g.label),pick:async()=>{let f=await g.pick();if(f)return f&&{debugger:this.getDebugger(g.type),withConfig:f}}})}c.push({type:"separator",label:""},{label:n?d(10663,null,n):d(10662,null)});let p=this.menuService.getMenuActions(R.DebugCreateConfiguration,this.contextKeyService);for(let[,g]of p)for(let f of g)c.push(f);let h=d(10665,null);return this.quickInputService.pick(c,{activeItem:c[0],placeHolder:h}).then(async g=>{if(g&&"pick"in g&&typeof g.pick=="function")return await g.pick();if(g instanceof Do){g.run();return}g&&this.commandService.executeCommand("debug.installAdditionalDebuggers",n)})}initExtensionActivationsIfNeeded(){if(!this.earlyActivatedExtensions){this.earlyActivatedExtensions=new Set;let e=this.extensionService.getExtensionsStatus();for(let t in e)e[t].activationTimes&&this.earlyActivatedExtensions.add(t)}}async activateDebuggers(e,t){this.initExtensionActivationsIfNeeded();let o=[this.extensionService.activateByEvent(e),this.extensionService.activateByEvent("onDebug")];t&&o.push(this.extensionService.activateByEvent(`${e}:${t}`)),await Promise.all(o)}};wKe=I([m(1,ie),m(2,B),m(3,$e),m(4,F),m(5,fe),m(6,lt),m(7,X),m(8,Rt),m(9,ct),m(10,to),m(11,yf),m(12,Yt)],wKe);var bOo=oe.as(Ta.JSONContribution);bOo.registerSchema(mU,Lse);var Xzi="debug.selectedconfigname",Jzi="debug.selectedroot",fOo="debug.selectedtype",Zzi="debug.recentdynamicconfigurations",CKe="onDebugDynamicConfigurations",xKe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.adapterManager=i;this.contextService=e;this.configurationService=t;this.quickInputService=o;this.instantiationService=n;this.storageService=r;this.extensionService=s;this.historyService=l;this.uriIdentityService=c;this.remoteAgentService=u;this.logService=h;this.getSelectedConfig=()=>Promise.resolve(void 0);this.selectedDynamic=!1;this._onDidSelectConfigurationName=new T;this._onDidChangeConfigurationProviders=new T;this.onDidChangeConfigurationProviders=this._onDidChangeConfigurationProviders.event;this.targetOperatingSystem=Ao;this.configProviders=[],this.toDispose=[this._onDidChangeConfigurationProviders,this._onDidSelectConfigurationName],this.initLaunches(),this.setCompoundSchemaValues(),this.registerListeners();let g=this.storageService.get(Jzi,1),f=this.storageService.get(fOo,1),v=this.launches.find(y=>y.uri.toString()===g),b=this.storageService.get(Xzi,1);this.debugConfigurationTypeContext=Dlo.bindTo(p);let S=f?{type:f}:void 0;v&&v.getConfigurationNames().length?this.selectConfiguration(v,b,void 0,S):this.launches.length>0&&this.selectConfiguration(void 0,b,void 0,S),this.resolveTargetOperatingSystem()}resolveTargetOperatingSystem(){this.remoteAgentService.getEnvironment().then(i=>{let e=i?.os??Ao;this.targetOperatingSystem!==e&&(this.targetOperatingSystem=e,this._onDidSelectConfigurationName.fire())},()=>{})}getTargetOperatingSystem(){return this.targetOperatingSystem}registerDebugConfigurationProvider(i){return this.configProviders.push(i),this._onDidChangeConfigurationProviders.fire(),{dispose:()=>{this.unregisterDebugConfigurationProvider(i),this._onDidChangeConfigurationProviders.fire()}}}unregisterDebugConfigurationProvider(i){let e=this.configProviders.indexOf(i);e>=0&&this.configProviders.splice(e,1)}hasDebugConfigurationProvider(i,e){return e===void 0&&(e=1),!!this.configProviders.find(o=>o.provideDebugConfigurations&&o.type===i&&o.triggerKind===e)}async resolveConfigurationByProviders(i,e,t,o){let n=async(l,c)=>{l!=="*"&&await this.adapterManager.activateDebuggers("onDebugResolve",l);for(let u of this.configProviders)u.type===l&&u.resolveDebugConfiguration&&c&&(c=await u.resolveDebugConfiguration(i,c,o));return c},r=t.type??e,s=t;for(let l=new Set;s&&!l.has(r);)l.add(r),s=await n(r,s),s=await n("*",s),r=s?.type??e;return s}async resolveDebugConfigurationWithSubstitutedVariables(i,e,t,o){let n=this.configProviders.filter(s=>s.type===e&&s.resolveDebugConfigurationWithSubstitutedVariables).concat(this.configProviders.filter(s=>s.type==="*"&&s.resolveDebugConfigurationWithSubstitutedVariables)),r=t;return await pbt(n.map(s=>async()=>{r&&(r=await s.resolveDebugConfigurationWithSubstitutedVariables(i,r,o))})),r}async provideDebugConfigurations(i,e,t){return await this.adapterManager.activateDebuggers("onDebugInitialConfigurations"),(await Promise.all(this.configProviders.filter(n=>n.type===e&&n.triggerKind===1&&n.provideDebugConfigurations).map(n=>n.provideDebugConfigurations(i,t)))).reduce((n,r)=>n.concat(r),[])}async getDynamicProviders(){await this.extensionService.whenInstalledExtensionsRegistered();let i=this.extensionService.extensions.reduce((e,t)=>{if(!t.activationEvents)return e;let o=[],n=!1;for(let r of t.activationEvents)r===CKe?n=!0:r.startsWith(`${CKe}:`)&&o.push(r.slice(CKe.length+1));if(o.length)o.forEach(r=>e.add(r));else if(n){let r=t.contributes?.debuggers?.[0].type;r&&e.add(r)}return e},new Set);for(let e of this.configProviders)e.triggerKind===2&&i.add(e.type);return[...i].map(e=>({label:this.adapterManager.getDebuggerLabel(e),getProvider:async()=>(await this.adapterManager.activateDebuggers(CKe,e),this.configProviders.find(t=>t.type===e&&t.triggerKind===2&&t.provideDebugConfigurations)),type:e,pick:async()=>{await this.adapterManager.activateDebuggers(CKe,e);let t=new O,o=new qe;t.add(o);let n=t.add(this.quickInputService.createQuickPick());n.busy=!0,n.placeholder=d(10730,null);let r=new Promise(c=>{t.add(n.onDidAccept(()=>c(n.activeItems[0]))),t.add(n.onDidTriggerItemButton(async u=>{c(void 0);let{launch:p,config:h}=u.item;await p.openConfigFile({preserveFocus:!1,type:h.type,suppressInitialConfigs:!0}),await p.writeConfiguration(h),await this.selectConfiguration(p,h.name),this.removeRecentDynamicConfigurations(h.name,h.type)})),t.add(n.onDidHide(()=>c(void 0)))}).finally(()=>o.cancel()),s;try{s=await this.getDynamicConfigurationsByType(e,o.token)}catch(c){this.logService.error(c),t.dispose();return}n.items=s,n.busy=!1,n.show();let l=await r;return t.dispose(),l}}))}async getDynamicConfigurationsByType(i,e=Ie.None){await this.adapterManager.activateDebuggers(CKe,i);let t=[],o=this.configProviders.find(n=>n.type===i&&n.triggerKind===2&&n.provideDebugConfigurations);return this.getLaunches().forEach(n=>{o&&t.push(o.provideDebugConfigurations(n.workspace?.uri,e).then(r=>r.map(s=>({label:s.name,description:n.name,config:s,buttons:[{iconClass:q.asClassName(YNe),tooltip:d(10729,null)}],launch:n}))))}),(await Promise.all(t)).flat()}getAllConfigurations(){let i=[];for(let e of this.launches)for(let t of e.getConfigurationNames()){let o=e.getConfiguration(t)||e.getCompound(t);o&&i.push({launch:e,name:t,presentation:o.presentation})}return lIi(i)}removeRecentDynamicConfigurations(i,e){let t=this.getRecentDynamicConfigurations().filter(o=>o.name!==i||o.type!==e);this.storageService.store(Zzi,JSON.stringify(t),1,1),this.selectedConfiguration.name===i&&this.selectedType===e&&this.selectedDynamic?this.selectConfiguration(void 0,void 0):this._onDidSelectConfigurationName.fire()}getRecentDynamicConfigurations(){return JSON.parse(this.storageService.get(Zzi,1,"[]"))}registerListeners(){this.toDispose.push(U.any(this.contextService.onDidChangeWorkspaceFolders,this.contextService.onDidChangeWorkbenchState)(()=>{this.initLaunches(),this.selectConfiguration(void 0),this.setCompoundSchemaValues()})),this.toDispose.push(this.configurationService.onDidChangeConfiguration(async i=>{i.affectsConfiguration("launch")&&(await this.selectConfiguration(void 0),this.setCompoundSchemaValues())})),this.toDispose.push(this.adapterManager.onDidDebuggersExtPointRead(()=>{this.setCompoundSchemaValues()}))}initLaunches(){this.launches=this.contextService.getWorkspace().folders.map(i=>this.instantiationService.createInstance(zut,this,this.adapterManager,i)),this.contextService.getWorkbenchState()===3&&this.launches.push(this.instantiationService.createInstance(kKe,this,this.adapterManager)),this.launches.push(this.instantiationService.createInstance(EKe,this,this.adapterManager)),this.selectedLaunch&&this.launches.indexOf(this.selectedLaunch)===-1&&this.selectConfiguration(void 0)}setCompoundSchemaValues(){let i=Lse.properties.compounds.items.properties.configurations,e=this.launches.map(o=>o.getConfigurationNames(!0)).reduce((o,n)=>o.concat(n),[]);i.items.oneOf[0].enum=e,i.items.oneOf[1].properties.name.enum=e;let t=this.contextService.getWorkspace().folders.map(o=>o.name);i.items.oneOf[1].properties.folder.enum=t,bOo.registerSchema(mU,Lse)}getLaunches(){return this.launches}getLaunch(i){if(A.isUri(i))return this.launches.find(e=>e.workspace&&this.uriIdentityService.extUri.isEqual(e.workspace.uri,i))}get selectedConfiguration(){return{launch:this.selectedLaunch,name:this.selectedName,getConfig:this.getSelectedConfig,type:this.selectedType}}get onDidSelectConfiguration(){return this._onDidSelectConfigurationName.event}getWorkspaceLaunch(){if(this.contextService.getWorkbenchState()===3)return this.launches[this.launches.length-1]}async selectConfiguration(i,e,t,o){if(typeof i>"u"){let u=this.historyService.getLastActiveWorkspaceRoot();i=this.getLaunch(u),(!i||i.getConfigurationNames().length===0)&&(i=this.launches.find(p=>!!(p&&p.getConfigurationNames().length))||i||this.launches[0])}let n=this.selectedLaunch,r=this.selectedName,s=this.selectedDynamic;this.selectedLaunch=i,this.selectedLaunch?this.storageService.store(Jzi,this.selectedLaunch.uri.toString(),1,1):this.storageService.remove(Jzi,1);let l=i?i.getConfigurationNames():[];this.getSelectedConfig=()=>{let u=this.selectedName?i?.getConfiguration(this.selectedName):void 0;return Promise.resolve(u||t)};let c=t?.type;if(e&&l.indexOf(e)>=0)this.setSelectedLaunchName(e);else if(o&&o.type){if(c=o.type,!t){let p=(await this.getDynamicProviders()).filter(h=>h.type===c);this.getSelectedConfig=async()=>{let h=await Promise.all(p.map(f=>f.getProvider())),g=h.length>0?h[0]:void 0;if(g&&i&&i.workspace){let f=new qe,b=(await g.provideDebugConfigurations(i.workspace.uri,f.token)).find(S=>S.name===e);if(b)return b}}}this.setSelectedLaunchName(e);let u=this.getRecentDynamicConfigurations();e&&o.type&&(u.unshift({name:e,type:o.type}),u=jo(u,p=>`${p.name} : ${p.type}`),this.storageService.store(Zzi,JSON.stringify(u),1,1))}else if(!this.selectedName||l.indexOf(this.selectedName)===-1){let u=l.length?l[0]:void 0;this.setSelectedLaunchName(u)}!t&&i&&this.selectedName&&(t=i.getConfiguration(this.selectedName),c=t?.type),this.selectedType=o?.type||t?.type,this.selectedDynamic=!!o,this.storageService.store(fOo,o?this.selectedType:void 0,1,1),c?this.debugConfigurationTypeContext.set(c):this.debugConfigurationTypeContext.reset(),(this.selectedLaunch!==n||this.selectedName!==r||s!==this.selectedDynamic)&&this._onDidSelectConfigurationName.fire()}setSelectedLaunchName(i){this.selectedName=i,this.selectedName?this.storageService.store(Xzi,this.selectedName,1,1):this.storageService.remove(Xzi,1)}dispose(){this.toDispose=je(this.toDispose)}};xKe=I([m(1,Ae),m(2,B),m(3,$e),m(4,F),m(5,de),m(6,lt),m(7,fa),m(8,gt),m(9,bo),m(10,X),m(11,re)],xKe);var Kut=class{constructor(i,e){this.configurationManager=i;this.adapterManager=e}getCompound(i){let e=this.getDeduplicatedConfig();if(!(!e||!e.compounds))return e.compounds.find(t=>t.name===i)}getConfigurationNames(i=!1){let e=this.getDeduplicatedConfig();if(!e||!Array.isArray(e.configurations)&&!Array.isArray(e.compounds))return[];{let t=[];if(e.configurations&&t.push(...e.configurations.filter(n=>n&&typeof n.name=="string")),i)return t.map(n=>n.name);e.compounds&&t.push(...e.compounds.filter(n=>typeof n.name=="string"&&n.configurations&&n.configurations.length));let o=t.map(n=>Olo(n)?cIi(n,this.configurationManager.getTargetOperatingSystem()):n);return lIi(o).map(n=>n.name)}}getConfiguration(i){let e=this.getDeduplicatedConfig();if(!e||!e.configurations)return;let t=e.configurations.find(n=>n&&n.name===i);if(!t)return;let o=cIi(t,this.configurationManager.getTargetOperatingSystem());return this instanceof EKe?{...o,__configurationTarget:2}:this instanceof kKe?{...o,__configurationTarget:5}:{...o,__configurationTarget:6}}async getInitialConfigurationContent(i,e,t,o){let n="",r=e?{debugger:this.adapterManager.getEnabledDebugger(e)}:await this.adapterManager.guessDebugger(!0);if(r?.withConfig&&r.debugger)n=await r.debugger.getInitialConfigurationContent([r.withConfig.config]);else if(r?.debugger){let s=t?await this.configurationManager.provideDebugConfigurations(i,r.debugger.type,o||Ie.None):[];n=await r.debugger.getInitialConfigurationContent(s)}return n}get hidden(){return!1}getDeduplicatedConfig(){let i=this.getConfig();if(!i)return;let e=i.compounds?.filter(o=>!!o&&typeof o.name=="string")??[],t=i.configurations?.filter(o=>!!o&&typeof o.name=="string")??[];return{version:i.version,compounds:vOo(e),configurations:vOo(t)}}};function vOo(a){let i=new Map;return a.map(e=>{let t=i.get(e.name)||0;return i.set(e.name,t+1),t===0?e:{...e,name:`${e.name} (${t})`}})}var zut=class extends Kut{constructor(e,t,o,n,r,s,l){super(e,t);this.workspace=o;this.fileService=n;this.textFileService=r;this.editorService=s;this.configurationService=l}get uri(){return Ve(this.workspace.uri,"/.vscode/launch.json")}get name(){return this.workspace.name}getConfig(){return this.configurationService.inspect("launch",{resource:this.workspace.uri}).workspaceFolderValue}async openConfigFile({preserveFocus:e,type:t,suppressInitialConfigs:o},n){let r=this.uri,s=!1,l="";try{l=(await this.fileService.readFile(r)).value.toString()}catch{if(l=await this.getInitialConfigurationContent(this.workspace.uri,t,!o,n),!l)return{editor:null,created:!1};s=!0;try{await this.textFileService.write(r,l)}catch(g){throw new Error(d(10728,null,g.message))}}let c=l.indexOf(`"${this.configurationManager.selectedConfiguration.name}"`),u=1;for(let g=0;g<c;g++)l.charAt(g)===`
`&&u++;let p=u>1?{startLineNumber:u,startColumn:4}:void 0;return{editor:await this.editorService.openEditor({resource:r,options:{selection:p,preserveFocus:e,pinned:s,revealIfVisible:!0}},tr)??null,created:s}}async writeConfiguration(e){let t={...this.getConfig()??{}};t.configurations=[...t.configurations||[],e],await this.configurationService.updateValue("launch",t,{resource:this.workspace.uri},6)}};zut=I([m(3,ge),m(4,Uo),m(5,ie),m(6,B)],zut);var kKe=class extends Kut{constructor(e,t,o,n,r){super(e,t);this.editorService=o;this.configurationService=n;this.contextService=r}get workspace(){}get uri(){return this.contextService.getWorkspace().configuration}get name(){return d(10732,null)}getConfig(){return this.configurationService.inspect("launch").workspaceValue}async openConfigFile({preserveFocus:e,type:t,useInitialConfigs:o},n){if(!!!this.getConfig()){let l=await this.getInitialConfigurationContent(void 0,t,o,n);if(l)await this.configurationService.updateValue("launch",is(l),5);else return{editor:null,created:!1}}return{editor:await this.editorService.openEditor({resource:this.contextService.getWorkspace().configuration,options:{preserveFocus:e}},tr)??null,created:!1}}};kKe=I([m(2,ie),m(3,B),m(4,Ae)],kKe);var EKe=class extends Kut{constructor(e,t,o,n){super(e,t);this.configurationService=o;this.preferencesService=n}get workspace(){}get uri(){return this.preferencesService.userSettingsResource}get name(){return d(10731,null)}get hidden(){return!0}getConfig(){return this.configurationService.inspect("launch").userValue}async openConfigFile({preserveFocus:e,type:t,useInitialContent:o}){return{editor:await this.preferencesService.openUserSettings({jsonEditor:!0,preserveFocus:e,revealSetting:{key:"launch"}})??null,created:!1}}};EKe=I([m(2,B),m(3,Qo)],EKe);var ykn=/range=([0-9]+):([0-9]+)/,s9t=class extends k{constructor(e){super();this.debugService=e;this.memoryFdCounter=0;this.fdMemory=new Map;this.changeEmitter=this._register(new T);this.onDidChangeCapabilities=U.None;this.onDidChangeFile=this.changeEmitter.event;this.capabilities=1028;this._register(e.onDidEndSession(({session:t})=>{for(let[o,n]of this.fdMemory)n.session===t&&this.close(o)}))}watch(e,t){if(t.recursive)return ee(()=>{});let{session:o,memoryReference:n,offset:r}=this.parseUri(e),s=new O;return s.add(o.onDidChangeState(()=>{(o.state===3||o.state===0)&&this.changeEmitter.fire([{type:2,resource:e}])})),s.add(o.onDidInvalidateMemory(l=>{l.body.memoryReference===n&&(r&&(l.body.offset>=r.toOffset||l.body.offset+l.body.count<r.fromOffset)||this.changeEmitter.fire([{resource:e,type:0}]))})),s}stat(e){let{readOnly:t}=this.parseUri(e);return Promise.resolve({type:1,mtime:0,ctime:0,size:0,permissions:t?1:void 0})}mkdir(){throw Ys("Not allowed","NoPermissions")}readdir(){throw Ys("Not allowed","NoPermissions")}delete(){throw Ys("Not allowed","NoPermissions")}rename(){throw Ys("Not allowed","NoPermissions")}open(e,t){let{session:o,memoryReference:n,offset:r}=this.parseUri(e),s=this.memoryFdCounter++,l=o.getMemory(n);return r&&(l=new eKi(l,r)),this.fdMemory.set(s,{session:o,region:l}),Promise.resolve(s)}close(e){return this.fdMemory.get(e)?.region.dispose(),this.fdMemory.delete(e),Promise.resolve()}async writeFile(e,t){let{offset:o}=this.parseUri(e);if(!o)throw Ys("Range must be present to read a file","EntryNotFound");let n=await this.open(e,{create:!1});try{await this.write(n,o.fromOffset,t,0,t.length)}finally{this.close(n)}}async readFile(e){let{offset:t}=this.parseUri(e);if(!t)throw Ys("Range must be present to read a file","EntryNotFound");let o=new Uint8Array(t.toOffset-t.fromOffset),n=await this.open(e,{create:!1});try{return await this.read(n,t.fromOffset,o,0,o.length),o}finally{this.close(n)}}async read(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Ys("No file with that descriptor open","Unavailable");let l=await s.region.read(t,r),c=0;for(let u of l)switch(u.type){case 1:return c;case 2:if(c>0)return c;throw Ys(u.error,"Unknown");case 0:{let p=Math.max(0,t-u.offset),h=u.data.slice(p,Math.min(u.data.byteLength,p+(r-c)));o.set(h.buffer,n+c),c+=h.byteLength;break}default:bs(u)}return c}write(e,t,o,n,r){let s=this.fdMemory.get(e);if(!s)throw Ys("No file with that descriptor open","Unavailable");return s.region.write(t,Ke.wrap(o).slice(n,n+r))}parseUri(e){if(e.scheme!==$pe)throw Ys(`Cannot open file with scheme ${e.scheme}`,"EntryNotFound");let t=this.debugService.getModel().getSession(e.authority);if(!t)throw Ys("Debug session not found","EntryNotFound");let o,n=ykn.exec(e.query);n&&(o={fromOffset:Number(n[1]),toOffset:Number(n[2])});let[,r]=e.path.split("/");return{session:t,offset:o,readOnly:!t.capabilities.supportsWriteMemoryRequest,sessionId:e.authority,memoryReference:decodeURIComponent(r)}}},eKi=class extends k{constructor(e,t){super();this.parent=e;this.range=t;this.invalidateEmitter=this._register(new T);this.onDidInvalidate=this.invalidateEmitter.event;this.writable=e.writable,this.width=t.toOffset-t.fromOffset,this._register(e),this._register(e.onDidInvalidate(o=>{let n=jn(o.fromOffset-t.fromOffset,0,this.width),r=jn(o.toOffset-t.fromOffset,0,this.width);r>n&&this.invalidateEmitter.fire({fromOffset:n,toOffset:r})}))}read(e,t){if(e<0)throw new RangeError(`Invalid fromOffset: ${e}`);return this.parent.read(this.range.fromOffset+e,this.range.fromOffset+Math.min(t,this.width))}write(e,t){return this.parent.write(this.range.fromOffset+e,t)}};var TKe=class{constructor(i,e,t,o,n,r,s,l){this.dbgr=e;this.sessionId=t;this.name=o;this.extensionHostDebugService=n;this.openerService=r;this.notificationService=s;this.dialogSerivce=l;this.allThreadsContinued=!0;this._readyForBreakpoints=!1;this.debugAdapterStopped=!1;this.inShutdown=!1;this.terminated=!1;this.firedAdapterExitEvent=!1;this.startTime=0;this.didReceiveStoppedEvent=!1;this.toDispose=new O;this._onDidInitialize=this.toDispose.add(new T);this._onDidStop=this.toDispose.add(new T);this._onDidContinued=this.toDispose.add(new T);this._onDidTerminateDebugee=this.toDispose.add(new T);this._onDidExitDebugee=this.toDispose.add(new T);this._onDidThread=this.toDispose.add(new T);this._onDidOutput=this.toDispose.add(new T);this._onDidBreakpoint=this.toDispose.add(new T);this._onDidLoadedSource=this.toDispose.add(new T);this._onDidProgressStart=this.toDispose.add(new T);this._onDidProgressUpdate=this.toDispose.add(new T);this._onDidProgressEnd=this.toDispose.add(new T);this._onDidInvalidated=this.toDispose.add(new T);this._onDidInvalidateMemory=this.toDispose.add(new T);this._onDidCustomEvent=this.toDispose.add(new T);this._onDidEvent=this.toDispose.add(new T);this._onDidExitAdapter=this.toDispose.add(new T);this.stoppedSinceLastStep=!1;this.debugAdapter=i,this._capabilities=Object.create(null),this.toDispose.add(this.debugAdapter.onError(c=>{this.shutdown(c)})),this.toDispose.add(this.debugAdapter.onExit(c=>{c!==0?this.shutdown(new Error(`exit code: ${c}`)):this.shutdown()})),this.debugAdapter.onEvent(c=>{switch(c.event){case"initialized":this._readyForBreakpoints=!0,this._onDidInitialize.fire(c);break;case"loadedSource":this._onDidLoadedSource.fire(c);break;case"capabilities":if(c.body){let u=c.body.capabilities;this.mergeCapabilities(u)}break;case"stopped":this.didReceiveStoppedEvent=!0,this.stoppedSinceLastStep=!0,this._onDidStop.fire(c);break;case"continued":this.allThreadsContinued=c.body.allThreadsContinued!==!1,this._onDidContinued.fire(c);break;case"thread":this._onDidThread.fire(c);break;case"output":this._onDidOutput.fire(c);break;case"breakpoint":this._onDidBreakpoint.fire(c);break;case"terminated":this._onDidTerminateDebugee.fire(c);break;case"exited":this._onDidExitDebugee.fire(c);break;case"progressStart":this._onDidProgressStart.fire(c);break;case"progressUpdate":this._onDidProgressUpdate.fire(c);break;case"progressEnd":this._onDidProgressEnd.fire(c);break;case"invalidated":this._onDidInvalidated.fire(c);break;case"memory":this._onDidInvalidateMemory.fire(c);break;case"process":break;case"module":break;default:this._onDidCustomEvent.fire(c);break}this._onDidEvent.fire(c)}),this.debugAdapter.onRequest(c=>this.dispatchRequest(c))}get isInShutdown(){return this.inShutdown}get onDidExitAdapter(){return this._onDidExitAdapter.event}get capabilities(){return this._capabilities}get readyForBreakpoints(){return this._readyForBreakpoints}get onDidInitialize(){return this._onDidInitialize.event}get onDidStop(){return this._onDidStop.event}get onDidContinued(){return this._onDidContinued.event}get onDidTerminateDebugee(){return this._onDidTerminateDebugee.event}get onDidExitDebugee(){return this._onDidExitDebugee.event}get onDidThread(){return this._onDidThread.event}get onDidOutput(){return this._onDidOutput.event}get onDidBreakpoint(){return this._onDidBreakpoint.event}get onDidLoadedSource(){return this._onDidLoadedSource.event}get onDidCustomEvent(){return this._onDidCustomEvent.event}get onDidProgressStart(){return this._onDidProgressStart.event}get onDidProgressUpdate(){return this._onDidProgressUpdate.event}get onDidProgressEnd(){return this._onDidProgressEnd.event}get onDidInvalidated(){return this._onDidInvalidated.event}get onDidInvalidateMemory(){return this._onDidInvalidateMemory.event}get onDidEvent(){return this._onDidEvent.event}async start(){if(!this.debugAdapter)return Promise.reject(new Error(d(10917,null)));await this.debugAdapter.startSession(),this.startTime=new Date().getTime()}async initialize(i){let e=await this.send("initialize",i,void 0,void 0,!1);return e&&this.mergeCapabilities(e.body),e}disconnect(i){let e=this.capabilities.supportTerminateDebuggee?i.terminateDebuggee:void 0,t=this.capabilities.supportTerminateDebuggee&&this.capabilities.supportSuspendDebuggee?i.suspendDebuggee:void 0;return this.shutdown(void 0,i.restart,e,t)}async launchOrAttach(i){let e=await this.send(i.request,i,void 0,void 0,!1);return e&&this.mergeCapabilities(e.body),e}terminate(i=!1){return this.capabilities.supportsTerminateRequest?this.terminated?this.disconnect({terminateDebuggee:!0,restart:i}):(this.terminated=!0,this.send("terminate",{restart:i},void 0)):Promise.reject(new Error("terminated not supported"))}restart(i){return this.capabilities.supportsRestartRequest?this.send("restart",i):Promise.reject(new Error("restart not supported"))}async next(i){this.stoppedSinceLastStep=!1;let e=await this.send("next",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}async stepIn(i){this.stoppedSinceLastStep=!1;let e=await this.send("stepIn",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}async stepOut(i){this.stoppedSinceLastStep=!1;let e=await this.send("stepOut",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}async continue(i){this.stoppedSinceLastStep=!1;let e=await this.send("continue",i);return e&&e.body&&e.body.allThreadsContinued!==void 0&&(this.allThreadsContinued=e.body.allThreadsContinued),this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId,this.allThreadsContinued),e}pause(i){return this.send("pause",i)}terminateThreads(i){return this.capabilities.supportsTerminateThreadsRequest?this.send("terminateThreads",i):Promise.reject(new Error("terminateThreads not supported"))}setVariable(i){return this.capabilities.supportsSetVariable?this.send("setVariable",i):Promise.reject(new Error("setVariable not supported"))}setExpression(i){return this.capabilities.supportsSetExpression?this.send("setExpression",i):Promise.reject(new Error("setExpression not supported"))}async restartFrame(i,e){if(this.capabilities.supportsRestartFrame){this.stoppedSinceLastStep=!1;let t=await this.send("restartFrame",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(e),t}return Promise.reject(new Error("restartFrame not supported"))}stepInTargets(i){return this.capabilities.supportsStepInTargetsRequest?this.send("stepInTargets",i):Promise.reject(new Error("stepInTargets not supported"))}completions(i,e){return this.capabilities.supportsCompletionsRequest?this.send("completions",i,e):Promise.reject(new Error("completions not supported"))}setBreakpoints(i){return this.send("setBreakpoints",i)}setFunctionBreakpoints(i){return this.capabilities.supportsFunctionBreakpoints?this.send("setFunctionBreakpoints",i):Promise.reject(new Error("setFunctionBreakpoints not supported"))}dataBreakpointInfo(i){return this.capabilities.supportsDataBreakpoints?this.send("dataBreakpointInfo",i):Promise.reject(new Error("dataBreakpointInfo not supported"))}setDataBreakpoints(i){return this.capabilities.supportsDataBreakpoints?this.send("setDataBreakpoints",i):Promise.reject(new Error("setDataBreakpoints not supported"))}setExceptionBreakpoints(i){return this.send("setExceptionBreakpoints",i)}breakpointLocations(i){return this.capabilities.supportsBreakpointLocationsRequest?this.send("breakpointLocations",i):Promise.reject(new Error("breakpointLocations is not supported"))}configurationDone(){return this.capabilities.supportsConfigurationDoneRequest?this.send("configurationDone",null):Promise.reject(new Error("configurationDone not supported"))}stackTrace(i,e){return this.send("stackTrace",i,e)}exceptionInfo(i){return this.capabilities.supportsExceptionInfoRequest?this.send("exceptionInfo",i):Promise.reject(new Error("exceptionInfo not supported"))}scopes(i,e){return this.send("scopes",i,e)}variables(i,e){return this.send("variables",i,e)}source(i){return this.send("source",i)}locations(i){return this.send("locations",i)}loadedSources(i){return this.capabilities.supportsLoadedSourcesRequest?this.send("loadedSources",i):Promise.reject(new Error("loadedSources not supported"))}threads(){return this.send("threads",null)}evaluate(i){return this.send("evaluate",i)}async stepBack(i){if(this.capabilities.supportsStepBack){this.stoppedSinceLastStep=!1;let e=await this.send("stepBack",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}return Promise.reject(new Error("stepBack not supported"))}async reverseContinue(i){if(this.capabilities.supportsStepBack){this.stoppedSinceLastStep=!1;let e=await this.send("reverseContinue",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}return Promise.reject(new Error("reverseContinue not supported"))}gotoTargets(i){return this.capabilities.supportsGotoTargetsRequest?this.send("gotoTargets",i):Promise.reject(new Error("gotoTargets is not supported"))}async goto(i){if(this.capabilities.supportsGotoTargetsRequest){this.stoppedSinceLastStep=!1;let e=await this.send("goto",i);return this.stoppedSinceLastStep||this.fireSimulatedContinuedEvent(i.threadId),e}return Promise.reject(new Error("goto is not supported"))}async setInstructionBreakpoints(i){return this.capabilities.supportsInstructionBreakpoints?await this.send("setInstructionBreakpoints",i):Promise.reject(new Error("setInstructionBreakpoints is not supported"))}async disassemble(i){return this.capabilities.supportsDisassembleRequest?await this.send("disassemble",i):Promise.reject(new Error("disassemble is not supported"))}async readMemory(i){return this.capabilities.supportsReadMemoryRequest?await this.send("readMemory",i):Promise.reject(new Error("readMemory is not supported"))}async writeMemory(i){return this.capabilities.supportsWriteMemoryRequest?await this.send("writeMemory",i):Promise.reject(new Error("writeMemory is not supported"))}cancel(i){return this.send("cancel",i)}custom(i,e){return this.send(i,e)}async shutdown(i,e=!1,t=void 0,o=void 0){if(!this.inShutdown)if(this.inShutdown=!0,this.debugAdapter)try{let n={restart:e};typeof t=="boolean"&&(n.terminateDebuggee=t),typeof o=="boolean"&&(n.suspendDebuggee=o),await this.send("disconnect",n,void 0,i?200:2e3)}catch{}finally{await this.stopAdapter(i)}else return this.stopAdapter(i)}async stopAdapter(i){try{if(this.debugAdapter){let e=this.debugAdapter;this.debugAdapter=null,await e.stopSession(),this.debugAdapterStopped=!0}}finally{this.fireAdapterExitEvent(i)}}fireAdapterExitEvent(i){if(!this.firedAdapterExitEvent){this.firedAdapterExitEvent=!0;let e={emittedStopped:this.didReceiveStoppedEvent,sessionLengthInSeconds:(new Date().getTime()-this.startTime)/1e3};i&&!this.debugAdapterStopped&&(e.error=i),this._onDidExitAdapter.fire(e)}}async dispatchRequest(i){let e={type:"response",seq:0,command:i.command,request_seq:i.seq,success:!0},t=o=>this.debugAdapter&&this.debugAdapter.sendResponse(o);if(i.command==="launchVSCode")try{let o=await this.launchVsCode(i.arguments);if(!o.success){let{confirmed:n}=await this.dialogSerivce.confirm({type:ft.Warning,message:d(10913,null),primaryButton:d(10914,null)});n?o=await this.launchVsCode(i.arguments):(e.success=!1,t(e),await this.shutdown())}e.body={rendererDebugAddr:o.rendererDebugAddr},t(e)}catch(o){e.success=!1,e.message=o.message,t(e)}else if(i.command==="runInTerminal")try{let o=await this.dbgr.runInTerminal(i.arguments,this.sessionId),n=e;n.body={},typeof o=="number"&&(n.body.shellProcessId=o),t(n)}catch(o){e.success=!1,e.message=o.message,t(e)}else if(i.command==="startDebugging")try{let o=i.arguments,n={...o.configuration,request:o.request,type:this.dbgr.type,name:o.configuration.name||this.name};await this.dbgr.startDebugging(n,this.sessionId)||(e.success=!1,e.message="Failed to start debugging"),t(e)}catch(o){e.success=!1,e.message=o.message,t(e)}else e.success=!1,e.message=`unknown request '${i.command}'`,t(e)}launchVsCode(i){let e=[];for(let t of i.args){let o=(t.prefix||"")+(t.path||""),n=/^--(.+)=(.+)$/.exec(o);if(n&&n.length===3){let r=n[1],s=n[2];(r==="file-uri"||r==="folder-uri")&&!YZ(t.path)&&(s=YZ(s)?s:A.file(s).toString()),e.push(`--${r}=${s}`)}else e.push(o)}return i.env&&e.push(`--extensionEnvironment=${JSON.stringify(i.env)}`),this.extensionHostDebugService.openExtensionDevelopmentHostWindow(e,!!i.debugRenderer)}send(i,e,t,o,n=!0){return new Promise((r,s)=>{if(!this.debugAdapter){this.inShutdown?r(void 0):s(new Error(d(10916,null,i)));return}let l,c=this.debugAdapter.sendRequest(i,e,u=>{l?.dispose(),u.success?r(u):s(u)},o);t&&(l=t.onCancellationRequested(()=>{l.dispose(),this.capabilities.supportsCancelRequest&&this.cancel({requestId:c})}))}).then(void 0,r=>Promise.reject(this.handleErrorResponse(r,n)))}handleErrorResponse(i,e){if(i.command==="canceled"&&i.message==="canceled")return new qi;let t=i?.body?.error,o=i?.message||"",n=t?Wlo(t.format,!1,t.variables):o,r=t?.url;if(t&&r){let l=t.urlLabel?t.urlLabel:d(10915,null),c=A.parse(r),u=c.scheme===Q.command?"debug.moreInfo.command":"debug.moreInfo";return Rz(n,[li({id:u,label:l,run:()=>this.openerService.open(c,{allowCommands:!0})})])}e&&t&&t.format&&t.showUser&&this.notificationService.error(n);let s=new ka(n);return s.showUser=t?.showUser,s}mergeCapabilities(i){i&&(this._capabilities=Cp(this._capabilities,i))}fireSimulatedContinuedEvent(i,e=!1){this._onDidContinued.fire({type:"event",event:"continued",body:{threadId:i,allThreadsContinued:e},seq:void 0})}dispose(){this.toDispose.dispose()}};TKe=I([m(4,jR),m(5,Je),m(6,Ne),m(7,ct)],TKe);var wkn=1500,_Ke=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M){this.id=i;this._configuration=e;this.root=t;this.model=o;this.debugService=r;this.telemetryService=s;this.hostService=l;this.configurationService=c;this.paneCompositeService=u;this.workspaceContextService=p;this.productService=h;this.notificationService=g;this.uriIdentityService=v;this.instantiationService=b;this.customEndpointTelemetryService=S;this.workbenchEnvironmentService=y;this.logService=w;this.testService=x;this.accessibilityService=M;this.initialized=!1;this.sources=new Map;this.threads=new Map;this.threadIds=[];this.cancellationMap=new Map;this.rawListeners=new O;this.globalDisposables=new O;this.fetchThreadsScheduler=new uo(()=>{let i=new Dt(()=>{this.fetchThreads()},100);return this.rawListeners.add(i),i});this.stoppedDetails=[];this.statusQueue=this.rawListeners.add(new tKi);this._onDidChangeState=new T;this._onDidEndAdapter=new T;this._onDidLoadedSource=new T;this._onDidCustomEvent=new T;this._onDidProgressStart=new T;this._onDidProgressUpdate=new T;this._onDidProgressEnd=new T;this._onDidInvalidMemory=new T;this._onDidChangeREPLElements=new T;this._onDidChangeName=new T;this._options=n||{},this.parentSession=this._options.parentSession,this.hasSeparateRepl()?this.repl=new x$t(this.configurationService):this.repl=this.parentSession.repl;let N=this.globalDisposables,V=N.add(new ue);V.value=this.repl.onDidChangeElements(j=>this._onDidChangeREPLElements.fire(j)),f&&N.add(f.onWillShutdown(()=>{this.shutdown(),je(N)})),this.correlatedTestRun=n?.testRun?E.getResult(n.testRun.runId):this.parentSession?.correlatedTestRun,this.correlatedTestRun&&N.add(this.correlatedTestRun.onComplete(()=>this.terminate()));let H=this._options.compoundRoot;H&&N.add(H.onDidSessionStop(()=>this.terminate())),this.passFocusScheduler=new Dt(()=>{if(this.debugService.getModel().getSessions().some(j=>j.state===2)||this.getAllThreads().some(j=>j.stopped))if(typeof this.lastContinuedThreadId=="number"){let j=this.debugService.getViewModel().focusedThread;if(j&&j.threadId===this.lastContinuedThreadId&&!j.stopped){let J=this.getStoppedDetails()?.threadId,se=typeof J=="number"?this.getThread(J):void 0;this.debugService.focusStackFrame(void 0,se)}}else{let j=this.debugService.getViewModel().focusedSession;j&&j.getId()===this.getId()&&j.state!==2&&this.debugService.focusStackFrame(void 0)}},800);let K=this._options.parentSession;K&&N.add(K.onDidEndAdapter(()=>{!this.hasSeparateRepl()&&this.raw?.isInShutdown===!1&&(this.repl=this.repl.clone(),V.value=this.repl.onDidChangeElements(j=>this._onDidChangeREPLElements.fire(j)),this.parentSession=void 0)}))}getId(){return this.id}setSubId(i){this._subId=i}getMemory(i){return new zAt(i,this)}get subId(){return this._subId}get configuration(){return this._configuration.resolved}get unresolvedConfiguration(){return this._configuration.unresolved}get lifecycleManagedByParent(){return!!this._options.lifecycleManagedByParent}get compact(){return!!this._options.compact}get saveBeforeRestart(){return this._options.saveBeforeRestart??!this._options?.parentSession}get compoundRoot(){return this._options.compoundRoot}get suppressDebugStatusbar(){return this._options.suppressDebugStatusbar??!1}get suppressDebugToolbar(){return this._options.suppressDebugToolbar??!1}get suppressDebugView(){return this._options.suppressDebugView??!1}get autoExpandLazyVariables(){let i=this.accessibilityService.isScreenReaderOptimized(),e=this.configurationService.getValue("debug").autoExpandLazyVariables;return e==="auto"&&i||e==="on"}setConfiguration(i){this._configuration=i}getLabel(){return this.workspaceContextService.getWorkspace().folders.length>1&&this.root?`${this.name} (${sl(this.root.uri)})`:this.name}setName(i){this._name=i,this._onDidChangeName.fire(i)}get name(){return this._name||this.configuration.name}get state(){if(!this.initialized)return 1;if(!this.raw)return 0;let i=this.debugService.getViewModel().focusedThread;return i&&i.session===this?i.stopped?2:3:this.getAllThreads().some(e=>e.stopped)?2:3}get capabilities(){return this.raw?this.raw.capabilities:Object.create(null)}get onDidChangeState(){return this._onDidChangeState.event}get onDidEndAdapter(){return this._onDidEndAdapter.event}get onDidChangeReplElements(){return this._onDidChangeREPLElements.event}get onDidChangeName(){return this._onDidChangeName.event}get onDidCustomEvent(){return this._onDidCustomEvent.event}get onDidLoadedSource(){return this._onDidLoadedSource.event}get onDidProgressStart(){return this._onDidProgressStart.event}get onDidProgressUpdate(){return this._onDidProgressUpdate.event}get onDidProgressEnd(){return this._onDidProgressEnd.event}get onDidInvalidateMemory(){return this._onDidInvalidMemory.event}async initialize(i){this.raw&&await this.shutdown();try{let e=await i.createDebugAdapter(this);this.raw=this.instantiationService.createInstance(TKe,e,i,this.id,this.configuration.name),await this.raw.start(),this.registerListeners(),await this.raw.initialize({clientID:"vscode",clientName:this.productService.nameLong,adapterID:this.configuration.type,pathFormat:"path",linesStartAt1:!0,columnsStartAt1:!0,supportsVariableType:!0,supportsVariablePaging:!0,supportsRunInTerminalRequest:!0,locale:Kr,supportsProgressReporting:!0,supportsInvalidatedEvent:!0,supportsMemoryReferences:!0,supportsArgsCanBeInterpretedByShell:!0,supportsMemoryEvent:!0,supportsStartDebuggingRequest:!0,supportsANSIStyling:!0}),this.initialized=!0,this._onDidChangeState.fire(),this.rememberedCapabilities=this.raw.capabilities,this.debugService.setExceptionBreakpointsForSession(this,this.raw&&this.raw.capabilities.exceptionBreakpointFilters||[]),this.debugService.getModel().registerBreakpointModes(this.configuration.type,this.raw.capabilities.breakpointModes||[])}catch(e){throw this.initialized=!0,this._onDidChangeState.fire(),await this.shutdown(),e}}async launchOrAttach(i){if(!this.raw)throw new Error(d(10855,null,"launch or attach"));if(this.parentSession&&this.parentSession.state===0)throw wy();i.__sessionId=this.getId();try{await this.raw.launchOrAttach(i)}catch(e){throw this.shutdown(),e}}cancelCorrelatedTestRun(){this.correlatedTestRun&&!this.correlatedTestRun.completedAt&&(this.didTerminateTestRun=!0,this.testService.cancelTestRun(this.correlatedTestRun.id))}async terminate(i=!1){this.raw||this.onDidExitAdapter(),this.cancelAllRequests(),this._options.lifecycleManagedByParent&&this.parentSession?await this.parentSession.terminate(i):this.correlatedTestRun&&!this.correlatedTestRun.completedAt&&!this.didTerminateTestRun?this.cancelCorrelatedTestRun():this.raw&&(this.raw.capabilities.supportsTerminateRequest&&this._configuration.resolved.request==="launch"?await this.raw.terminate(i):await this.raw.disconnect({restart:i,terminateDebuggee:!0})),i||this._options.compoundRoot?.sessionStopped()}async disconnect(i=!1,e=!1){this.raw||this.onDidExitAdapter(),this.cancelAllRequests(),this._options.lifecycleManagedByParent&&this.parentSession?await this.parentSession.disconnect(i,e):this.raw&&await this.raw.disconnect({restart:i,terminateDebuggee:!1,suspendDebuggee:e}),i||this._options.compoundRoot?.sessionStopped()}async restart(){if(!this.raw)throw new Error(d(10855,null,"restart"));this.cancelAllRequests(),this._options.lifecycleManagedByParent&&this.parentSession?await this.parentSession.restart():await this.raw.restart({arguments:this.configuration})}async sendBreakpoints(i,e,t){if(!this.raw)throw new Error(d(10855,null,"breakpoints"));if(!this.raw.readyForBreakpoints)return Promise.resolve(void 0);let o=this.getRawSource(i);e.length&&!o.adapterData&&(o.adapterData=e[0].adapterData),o.path&&(o.path=dm(o.path));let n=await this.raw.setBreakpoints({source:o,lines:e.map(r=>r.sessionAgnosticData.lineNumber),breakpoints:e.map(r=>r.toDAP()),sourceModified:t});if(n?.body){let r=new Map;for(let s=0;s<e.length;s++)r.set(e[s].getId(),n.body.breakpoints[s]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,r)}}async sendFunctionBreakpoints(i){if(!this.raw)throw new Error(d(10855,null,"function breakpoints"));if(this.raw.readyForBreakpoints){let e=await this.raw.setFunctionBreakpoints({breakpoints:i.map(t=>t.toDAP())});if(e?.body){let t=new Map;for(let o=0;o<i.length;o++)t.set(i[o].getId(),e.body.breakpoints[o]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,t)}}}async sendExceptionBreakpoints(i){if(!this.raw)throw new Error(d(10855,null,"exception breakpoints"));if(this.raw.readyForBreakpoints){let e=this.capabilities.supportsExceptionFilterOptions?{filters:[],filterOptions:i.map(o=>o.condition?{filterId:o.filter,condition:o.condition}:{filterId:o.filter})}:{filters:i.map(o=>o.filter)},t=await this.raw.setExceptionBreakpoints(e);if(t?.body&&t.body.breakpoints){let o=new Map;for(let n=0;n<i.length;n++)o.set(i[n].getId(),t.body.breakpoints[n]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,o)}}}dataBytesBreakpointInfo(i,e){if(this.raw?.capabilities.supportsDataBreakpointBytes===!1)throw new Error(d(10856,null));return this._dataBreakpointInfo({name:i,bytes:e,asAddress:!0})}dataBreakpointInfo(i,e,t){return this._dataBreakpointInfo({name:i,variablesReference:e,frameId:t})}async _dataBreakpointInfo(i){if(!this.raw)throw new Error(d(10855,null,"data breakpoints info"));if(!this.raw.readyForBreakpoints)throw new Error(d(10857,null));return(await this.raw.dataBreakpointInfo(i))?.body}async sendDataBreakpoints(i){if(!this.raw)throw new Error(d(10855,null,"data breakpoints"));if(this.raw.readyForBreakpoints){let e=await Promise.all(i.map(async o=>{try{return{dap:await o.toDAP(this),bp:o}}catch(n){return{bp:o,message:n.message}}})),t=await this.raw.setDataBreakpoints({breakpoints:e.map(o=>o.dap).filter(so)});if(t?.body){let o=new Map,n=0;for(let r of e)r.dap?n<t.body.breakpoints.length&&o.set(r.bp.getId(),t.body.breakpoints[n++]):o.set(r.bp.getId(),r.message);this.model.setBreakpointSessionData(this.getId(),this.capabilities,o)}}}async sendInstructionBreakpoints(i){if(!this.raw)throw new Error(d(10855,null,"instruction breakpoints"));if(this.raw.readyForBreakpoints){let e=await this.raw.setInstructionBreakpoints({breakpoints:i.map(t=>t.toDAP())});if(e?.body){let t=new Map;for(let o=0;o<i.length;o++)t.set(i[o].getId(),e.body.breakpoints[o]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,t)}}}async breakpointsLocations(i,e){if(!this.raw)throw new Error(d(10855,null,"breakpoints locations"));let t=this.getRawSource(i),o=await this.raw.breakpointLocations({source:t,line:e});if(!o||!o.body||!o.body.breakpoints)return[];let n=o.body.breakpoints.map(r=>({lineNumber:r.line,column:r.column||1}));return jo(n,r=>`${r.lineNumber}:${r.column}`)}getDebugProtocolBreakpoint(i){return this.model.getDebugProtocolBreakpoint(i,this.getId())}customRequest(i,e){if(!this.raw)throw new Error(d(10855,null,i));return this.raw.custom(i,e)}stackTrace(i,e,t,o){if(!this.raw)throw new Error(d(10855,null,"stackTrace"));let n=this.getNewCancellationToken(i,o);return this.raw.stackTrace({threadId:i,startFrame:e,levels:t},n)}async exceptionInfo(i){if(!this.raw)throw new Error(d(10855,null,"exceptionInfo"));let e=await this.raw.exceptionInfo({threadId:i});if(e)return{id:e.body.exceptionId,description:e.body.description,breakMode:e.body.breakMode,details:e.body.details}}scopes(i,e){if(!this.raw)throw new Error(d(10855,null,"scopes"));let t=this.getNewCancellationToken(e);return this.raw.scopes({frameId:i},t)}variables(i,e,t,o,n){if(!this.raw)throw new Error(d(10855,null,"variables"));let r=e?this.getNewCancellationToken(e):void 0;return this.raw.variables({variablesReference:i,filter:t,start:o,count:n},r)}evaluate(i,e,t,o){if(!this.raw)throw new Error(d(10855,null,"evaluate"));return this.raw.evaluate({expression:i,frameId:e,context:t,line:o?.line,column:o?.column,source:o?.source})}async restartFrame(i,e){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(10855,null,"restartFrame"));await this.raw.restartFrame({frameId:i},e)}setLastSteppingGranularity(i,e){let t=this.getThread(i);t&&(t.lastSteppingGranularity=e)}async next(i,e){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(10855,null,"next"));this.setLastSteppingGranularity(i,e),await this.raw.next({threadId:i,granularity:e})}async stepIn(i,e,t){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(10855,null,"stepIn"));this.setLastSteppingGranularity(i,t),await this.raw.stepIn({threadId:i,targetId:e,granularity:t})}async stepOut(i,e){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(10855,null,"stepOut"));this.setLastSteppingGranularity(i,e),await this.raw.stepOut({threadId:i,granularity:e})}async stepBack(i,e){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(10855,null,"stepBack"));this.setLastSteppingGranularity(i,e),await this.raw.stepBack({threadId:i,granularity:e})}async continue(i){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(10855,null,"continue"));await this.raw.continue({threadId:i})}async reverseContinue(i){if(await this.waitForTriggeredBreakpoints(),!this.raw)throw new Error(d(10855,null,"reverse continue"));await this.raw.reverseContinue({threadId:i})}async pause(i){if(!this.raw)throw new Error(d(10855,null,"pause"));await this.raw.pause({threadId:i})}async terminateThreads(i){if(!this.raw)throw new Error(d(10855,null,"terminateThreads"));await this.raw.terminateThreads({threadIds:i})}setVariable(i,e,t){if(!this.raw)throw new Error(d(10855,null,"setVariable"));return this.raw.setVariable({variablesReference:i,name:e,value:t})}setExpression(i,e,t){if(!this.raw)throw new Error(d(10855,null,"setExpression"));return this.raw.setExpression({expression:e,value:t,frameId:i})}gotoTargets(i,e,t){if(!this.raw)throw new Error(d(10855,null,"gotoTargets"));return this.raw.gotoTargets({source:i,line:e,column:t})}goto(i,e){if(!this.raw)throw new Error(d(10855,null,"goto"));return this.raw.goto({threadId:i,targetId:e})}loadSource(i){if(!this.raw)return Promise.reject(new Error(d(10855,null,"loadSource")));let e=this.getSourceForUri(i),t;if(e)t=e.raw;else{let o=J2.getEncodedDebugData(i);t={path:o.path,sourceReference:o.sourceReference}}return this.raw.source({sourceReference:t.sourceReference||0,source:t})}async getLoadedSources(){if(!this.raw)return Promise.reject(new Error(d(10855,null,"getLoadedSources")));let i=await this.raw.loadedSources({});return i?.body&&i.body.sources?i.body.sources.map(e=>this.getSource(e)):[]}async completions(i,e,t,o,n){if(!this.raw)return Promise.reject(new Error(d(10855,null,"completions")));let r=this.getNewCancellationToken(e,n);return this.raw.completions({frameId:i,text:t,column:o.column,line:o.lineNumber},r)}async stepInTargets(i){return this.raw?(await this.raw.stepInTargets({frameId:i}))?.body.targets:Promise.reject(new Error(d(10855,null,"stepInTargets")))}async cancel(i){return this.raw?this.raw.cancel({progressId:i}):Promise.reject(new Error(d(10855,null,"cancel")))}async disassemble(i,e,t,o){return this.raw?(await this.raw.disassemble({memoryReference:i,offset:e,instructionOffset:t,instructionCount:o,resolveSymbols:!0}))?.body?.instructions:Promise.reject(new Error(d(10855,null,"disassemble")))}readMemory(i,e,t){return this.raw?this.raw.readMemory({count:t,memoryReference:i,offset:e}):Promise.reject(new Error(d(10855,null,"readMemory")))}writeMemory(i,e,t,o){return this.raw?this.raw.writeMemory({memoryReference:i,offset:e,allowPartial:o,data:t}):Promise.reject(new Error(d(10855,null,"disassemble")))}async resolveLocationReference(i){if(!this.raw)throw new Error(d(10855,null,"locations"));let e=await this.raw.locations({locationReference:i});if(!e?.body)throw new Error(d(10855,null,"locations"));let t=this.getSource(e.body.source);return{column:1,...e.body,source:t}}getThread(i){return this.threads.get(i)}getAllThreads(){let i=[];return this.threadIds.forEach(e=>{let t=this.threads.get(e);t&&i.push(t)}),i}clearThreads(i,e=void 0){if(e!=null){let t=this.threads.get(e);t&&(t.clearCallStack(),t.stoppedDetails=void 0,t.stopped=!1,i&&this.threads.delete(e))}else this.threads.forEach(t=>{t.clearCallStack(),t.stoppedDetails=void 0,t.stopped=!1}),i&&(this.threads.clear(),this.threadIds=[],dN.allValues.clear())}getStoppedDetails(){return this.stoppedDetails.length>=1?this.stoppedDetails[0]:void 0}rawUpdate(i){this.threadIds=[],i.threads.forEach(t=>{if(this.threadIds.push(t.id),!this.threads.has(t.id))this.threads.set(t.id,new uN(this,t.name,t.id));else if(t.name){let o=this.threads.get(t.id);o&&(o.name=t.name)}}),this.threads.forEach(t=>{this.threadIds.indexOf(t.threadId)===-1&&this.threads.delete(t.threadId)});let e=i.stoppedDetails;if(e)if(e.allThreadsStopped)this.threads.forEach(t=>{t.stoppedDetails=t.threadId===e.threadId?e:{reason:t.stoppedDetails?.reason},t.stopped=!0,t.clearCallStack()});else{let t=typeof e.threadId=="number"?this.threads.get(e.threadId):void 0;t&&(t.stoppedDetails=e,t.clearCallStack(),t.stopped=!0)}}waitForTriggeredBreakpoints(){if(this._waitToResume)return Uu(this._waitToResume,wkn)}async fetchThreads(i){if(this.raw){let e=await this.raw.threads();e?.body&&e.body.threads&&this.model.rawUpdate({sessionId:this.getId(),threads:e.body.threads,stoppedDetails:i})}}initializeForTest(i){this.raw=i,this.registerListeners()}registerListeners(){if(!this.raw)return;this.rawListeners.add(this.raw.onDidInitialize(async()=>{Er(this.configuration.noDebug?d(10853,null):d(10852,null));let t=async()=>{if(this.raw&&this.raw.capabilities.supportsConfigurationDoneRequest)try{await this.raw.configurationDone()}catch(o){this.notificationService.error(o),this.raw?.disconnect({})}};try{await this.debugService.sendAllBreakpoints(this)}finally{await t(),await this.fetchThreads()}}));let i=this.statusQueue;this.rawListeners.add(this.raw.onDidStop(t=>this.handleStop(t.body))),this.rawListeners.add(this.raw.onDidThread(t=>{if(i.cancel([t.body.threadId]),t.body.reason==="started")this.fetchThreadsScheduler.value.isScheduled()||this.fetchThreadsScheduler.value.schedule();else if(t.body.reason==="exited"){this.model.clearThreads(this.getId(),!0,t.body.threadId);let o=this.debugService.getViewModel(),n=o.focusedThread;this.passFocusScheduler.cancel(),n&&t.body.threadId===n.threadId&&this.debugService.focusStackFrame(void 0,void 0,o.focusedSession,{explicit:!1})}})),this.rawListeners.add(this.raw.onDidTerminateDebugee(async t=>{Er(d(10854,null)),t.body&&t.body.restart?await this.debugService.restartSession(this,t.body.restart):this.raw&&await this.raw.disconnect({terminateDebuggee:!1})})),this.rawListeners.add(this.raw.onDidContinued(async t=>{let o=t.body.allThreadsContinued!==!1,n;o?this.fetchThreadsScheduler.value.isScheduled()?(this.fetchThreadsScheduler.value.cancel(),n=this.fetchThreads().then(()=>this.threadIds)):n=this.threadIds:(n=[t.body.threadId],this.threadIds.includes(t.body.threadId)?n=[t.body.threadId]:(this.fetchThreadsScheduler.rawValue?.cancel(),n=this.fetchThreads().then(()=>[t.body.threadId]))),i.cancel(o?void 0:[t.body.threadId]),await i.run(n,r=>{this.stoppedDetails=this.stoppedDetails.filter(l=>l.threadId!==r);let s=this.cancellationMap.get(r);return this.cancellationMap.delete(r),s?.forEach(l=>l.dispose(!0)),this.model.clearThreads(this.getId(),!1,r),Promise.resolve()}),this.lastContinuedThreadId=o?void 0:t.body.threadId,this.passFocusScheduler.schedule(),this._onDidChangeState.fire()}));let e=new Hh;this.rawListeners.add(this.raw.onDidOutput(async t=>{let o=t.body.category==="stderr"?wt.Error:t.body.category==="console"?wt.Warning:wt.Info;if(t.body.variablesReference){let n=t.body.source&&t.body.line?{lineNumber:t.body.line,column:t.body.column?t.body.column:1,source:this.getSource(t.body.source)}:void 0,s=new dN(this,void 0,t.body.variablesReference,ht()).getChildren();e.queue(async()=>{let l=await s;if(l.length===1){this.appendToRepl({output:t.body.output,expression:l[0],sev:o,source:n},t.body.category==="important");return}l.forEach(c=>{c.name=null,this.appendToRepl({output:"",expression:c,sev:o,source:n},t.body.category==="important")})});return}e.queue(async()=>{if(!t.body||!this.raw)return;if(t.body.category==="telemetry"){let r=this.raw.dbgr.getCustomTelemetryEndpoint();if(r&&this.telemetryService.telemetryLevel!==0){let s=t.body.data;!r.sendErrorTelemetry&&t.body.data&&(s=Vlo(t.body.data)),this.customEndpointTelemetryService.publicLog(r,t.body.output,s)}return}let n=t.body.source&&t.body.line?{lineNumber:t.body.line,column:t.body.column?t.body.column:1,source:this.getSource(t.body.source)}:void 0;if(t.body.group==="start"||t.body.group==="startCollapsed"){let r=t.body.group==="start";this.repl.startGroup(this,t.body.output||"",r,n);return}t.body.group==="end"&&(this.repl.endGroup(),!t.body.output)||typeof t.body.output=="string"&&this.appendToRepl({output:t.body.output,sev:o,source:n},t.body.category==="important")})})),this.rawListeners.add(this.raw.onDidBreakpoint(t=>{let o=t.body&&t.body.breakpoint?t.body.breakpoint.id:void 0,n=this.model.getBreakpoints().find(c=>c.getIdFromAdapter(this.getId())===o),r=this.model.getFunctionBreakpoints().find(c=>c.getIdFromAdapter(this.getId())===o),s=this.model.getDataBreakpoints().find(c=>c.getIdFromAdapter(this.getId())===o),l=this.model.getExceptionBreakpoints().find(c=>c.getIdFromAdapter(this.getId())===o);if(t.body.reason==="new"&&t.body.breakpoint.source&&t.body.breakpoint.line){let c=this.getSource(t.body.breakpoint.source),u=this.model.addBreakpoints(c.uri,[{column:t.body.breakpoint.column,enabled:!0,lineNumber:t.body.breakpoint.line}],!1);if(u.length===1){let p=new Map([[u[0].getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,p)}}if(t.body.reason==="removed"&&(n&&this.model.removeBreakpoints([n]),r&&this.model.removeFunctionBreakpoints(r.getId()),s&&this.model.removeDataBreakpoints(s.getId())),t.body.reason==="changed"){if(n){n.column||(t.body.breakpoint.column=void 0);let c=new Map([[n.getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,c)}if(r){let c=new Map([[r.getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,c)}if(s){let c=new Map([[s.getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,c)}if(l){let c=new Map([[l.getId(),t.body.breakpoint]]);this.model.setBreakpointSessionData(this.getId(),this.capabilities,c)}}})),this.rawListeners.add(this.raw.onDidLoadedSource(t=>{this._onDidLoadedSource.fire({reason:t.body.reason,source:this.getSource(t.body.source)})})),this.rawListeners.add(this.raw.onDidCustomEvent(t=>{this._onDidCustomEvent.fire(t)})),this.rawListeners.add(this.raw.onDidProgressStart(t=>{this._onDidProgressStart.fire(t)})),this.rawListeners.add(this.raw.onDidProgressUpdate(t=>{this._onDidProgressUpdate.fire(t)})),this.rawListeners.add(this.raw.onDidProgressEnd(t=>{this._onDidProgressEnd.fire(t)})),this.rawListeners.add(this.raw.onDidInvalidateMemory(t=>{this._onDidInvalidMemory.fire(t)})),this.rawListeners.add(this.raw.onDidInvalidated(async t=>{let o=t.body.areas||["all"];if(o.includes("threads")||o.includes("stacks")||o.includes("all")){this.cancelAllRequests(),this.model.clearThreads(this.getId(),!0);let r=this.stoppedDetails.slice();this.stoppedDetails.length=0,r.length?await Promise.all(r.map(s=>this.handleStop(s))):this.fetchThreadsScheduler.value.isScheduled()||this.fetchThreadsScheduler.value.schedule()}let n=this.debugService.getViewModel();n.focusedSession===this&&n.updateViews()})),this.rawListeners.add(this.raw.onDidExitAdapter(t=>this.onDidExitAdapter(t)))}async handleStop(i){this.passFocusScheduler.cancel(),this.stoppedDetails.push(i),i.hitBreakpointIds&&(this._waitToResume=this.enableDependentBreakpoints(i.hitBreakpointIds)),this.statusQueue.run(this.fetchThreads(i).then(()=>i.threadId===void 0?this.threadIds:[i.threadId]),async(e,t)=>{let o=i.threadId===void 0&&this.threadIds.length>10,n=this.debugService.getViewModel().focusedThread,r=n!==void 0&&n.session===this&&!this.threads.has(n.threadId);r&&this.debugService.focusStackFrame(void 0,void 0);let s=typeof e=="number"?this.getThread(e):void 0;if(s){let l=this.model.refreshTopOfCallstack(s,!o),c=async()=>{if(r||!i.preserveFocusHint&&s.getCallStack().length){let p=this.debugService.getViewModel().focusedStackFrame;if(!p||p.thread.session===this){let h=!this.configurationService.getValue("debug").focusEditorOnBreak;await this.debugService.focusStackFrame(void 0,s,void 0,{preserveFocus:h})}s.stoppedDetails&&!t.isCancellationRequested&&(s.stoppedDetails.reason==="breakpoint"&&this.configurationService.getValue("debug").openDebug==="openOnDebugBreak"&&!this.suppressDebugView&&await this.paneCompositeService.openPaneComposite($g,0),this.configurationService.getValue("debug").focusWindowOnBreak&&!this.workbenchEnvironmentService.extensionTestsLocationURI&&(zi().document.hasFocus()||await this.hostService.focus(ut,{mode:2})))}};if(await l.topCallStack,i.hitBreakpointIds||(this._waitToResume=this.enableDependentBreakpoints(s)),t.isCancellationRequested||(c(),await l.wholeCallStack,t.isCancellationRequested))return;let u=this.debugService.getViewModel().focusedStackFrame;(!u||X2(u))&&c()}this._onDidChangeState.fire()})}async enableDependentBreakpoints(i){let e;if(Array.isArray(i))e=this.model.getBreakpoints().filter(n=>i.includes(n.getIdFromAdapter(this.id)));else{let n=i.getTopStackFrame();if(n===void 0||i.stoppedDetails&&i.stoppedDetails.reason!=="breakpoint")return;e=this.getBreakpointsAtPosition(n.source.uri,n.range.startLineNumber,n.range.endLineNumber,n.range.startColumn,n.range.endColumn)}let t=new Set;this.model.getBreakpoints({triggeredOnly:!0,enabledOnly:!0}).forEach(n=>{e.forEach(r=>{n.enabled&&n.triggeredBy===r.getId()&&(n.setSessionDidTrigger(this.getId()),t.add(n.uri.toString()))})});let o=[];return t.forEach(n=>o.push(this.debugService.sendBreakpoints(A.parse(n),void 0,this))),Promise.all(o)}getBreakpointsAtPosition(i,e,t,o,n){return this.model.getBreakpoints({uri:i}).filter(r=>!(r.lineNumber<e||r.lineNumber>t||r.column&&(r.column<o||r.column>n)))}onDidExitAdapter(i){this.initialized=!0,this.model.setBreakpointSessionData(this.getId(),this.capabilities,void 0),this.shutdown(),this._onDidEndAdapter.fire(i)}shutdown(){this.rawListeners.clear(),this.raw&&(this.raw.disconnect({}),this.raw.dispose(),this.raw=void 0),this.passFocusScheduler.cancel(),this.passFocusScheduler.dispose(),this.model.clearThreads(this.getId(),!0),this.sources.clear(),this.threads.clear(),this.threadIds=[],this.stoppedDetails=[],this._onDidChangeState.fire()}dispose(){this.cancelAllRequests(),this.rawListeners.dispose(),this.globalDisposables.dispose(),this._onDidChangeState.dispose(),this._onDidEndAdapter.dispose(),this._onDidLoadedSource.dispose(),this._onDidCustomEvent.dispose(),this._onDidProgressStart.dispose(),this._onDidProgressUpdate.dispose(),this._onDidProgressEnd.dispose(),this._onDidInvalidMemory.dispose(),this._onDidChangeREPLElements.dispose(),this._onDidChangeName.dispose(),this._waitToResume=void 0}getSourceForUri(i){return this.sources.get(this.uriIdentityService.asCanonicalUri(i).toString())}getSource(i){let e=new J2(i,this.getId(),this.uriIdentityService,this.logService),t=e.uri.toString(),o=this.sources.get(t);return o?(e=o,e.raw=Cp(e.raw,i),e.raw&&i&&(e.raw.presentationHint=i.presentationHint)):this.sources.set(t,e),e}getRawSource(i){let e=this.getSourceForUri(i);if(e)return e.raw;{let t=J2.getEncodedDebugData(i);return{name:t.name,path:t.path,sourceReference:t.sourceReference}}}getNewCancellationToken(i,e){let t=new qe(e),o=this.cancellationMap.get(i)||[];return o.push(t),this.cancellationMap.set(i,o),t.token}cancelAllRequests(){this.cancellationMap.forEach(i=>i.forEach(e=>e.dispose(!0))),this.cancellationMap.clear()}getReplElements(){return this.repl.getReplElements()}hasSeparateRepl(){return!this.parentSession||this._options.repl!=="mergeWithParent"}removeReplExpressions(){this.repl.removeReplExpressions()}async addReplExpression(i,e){await this.repl.addReplExpression(this,i,e),this.debugService.getViewModel().updateViews()}appendToRepl(i,e){this.repl.appendToRepl(this,i),e&&this.notificationService.notify({message:i.output.toString(),severity:i.sev,source:this.name})}};_Ke=I([m(5,Hi),m(6,_e),m(7,ti),m(8,B),m(9,Es),m(10,Ae),m(11,Ze),m(12,Ne),m(13,to),m(14,gt),m(15,F),m(16,Zbt),m(17,Mt),m(18,re),m(19,Xs),m(20,Rd),m(21,Ai)],_Ke);var tKi=class extends k{constructor(){super(...arguments);this.pendingCancellations=[];this.threadOps=this._register(new Ot)}async run(e,t){let o=new Set;this.pendingCancellations.push(o);let n=await e;for(let r=0;r<this.pendingCancellations.length;r++){let s=this.pendingCancellations[r];if(s===o){this.pendingCancellations.splice(r,1);break}else for(let l of n)s.add(l)}o.has(void 0)||await Promise.all(n.map(r=>{if(o.has(r))return;this.threadOps.get(r)?.cancel();let s=new qe;return this.threadOps.set(r,s),t(r,s.token)}))}cancel(e){if(e)for(let t of e){this.threadOps.get(t)?.cancel(),this.threadOps.deleteAndDispose(t);for(let o of this.pendingCancellations)o.add(t)}else{for(let[t,o]of this.threadOps)o.cancel();this.threadOps.clearAndDisposeAll();for(let t of this.pendingCancellations)t.add(void 0)}}};var Ur;(b=>(b.MARKERS_CONTAINER_ID="workbench.panel.markers",b.MARKERS_VIEW_ID="workbench.panel.markers.view",b.MARKERS_VIEW_STORAGE_ID="workbench.panel.markers",b.MARKER_COPY_ACTION_ID="problems.action.copy",b.MARKER_COPY_MESSAGE_ACTION_ID="problems.action.copyMessage",b.RELATED_INFORMATION_COPY_MESSAGE_ACTION_ID="problems.action.copyRelatedInformationMessage",b.FOCUS_PROBLEMS_FROM_FILTER="problems.action.focusProblemsFromFilter",b.MARKERS_VIEW_FOCUS_FILTER="problems.action.focusFilter",b.MARKERS_VIEW_CLEAR_FILTER_TEXT="problems.action.clearFilterText",b.MARKERS_VIEW_SHOW_MULTILINE_MESSAGE="problems.action.showMultilineMessage",b.MARKERS_VIEW_SHOW_SINGLELINE_MESSAGE="problems.action.showSinglelineMessage",b.MARKER_OPEN_ACTION_ID="problems.action.open",b.MARKER_OPEN_SIDE_ACTION_ID="problems.action.openToSide",b.MARKER_SHOW_PANEL_ID="workbench.action.showErrorsWarnings",b.MARKER_SHOW_QUICK_FIX="problems.action.showQuickFixes",b.TOGGLE_MARKERS_VIEW_ACTION_ID="workbench.actions.view.toggleProblems"))(Ur||={});var om;(u=>(u.MarkersViewModeContextKey=new Y("problemsViewMode","tree"),u.MarkersTreeVisibilityContextKey=new Y("problemsVisibility",!1),u.MarkerFocusContextKey=new Y("problemFocus",!1),u.MarkerViewFilterFocusContextKey=new Y("problemsFilterFocus",!1),u.RelatedInformationFocusContextKey=new Y("relatedInformationFocus",!1),u.ShowErrorsFilterContextKey=new Y("problems.filter.errors",!0),u.ShowWarningsFilterContextKey=new Y("problems.filter.warnings",!0),u.ShowInfoFilterContextKey=new Y("problems.filter.info",!0),u.ShowActiveFileFilterContextKey=new Y("problems.filter.activeFile",!1),u.ShowExcludedFilesFilterContextKey=new Y("problems.filter.excludedFiles",!0)))(om||={});var iKi=(a,i)=>U.once(U.filter(a,i));var SOo="debug.taskerrorchoice",IOo=d(10864,null),Ckn=d(10866,null),xkn=d(10867,null),DKe=class{constructor(i,e,t,o,n,r,s,l){this.taskService=i;this.markerService=e;this.configurationService=t;this.viewsService=o;this.dialogService=n;this.storageService=r;this.commandService=s;this.progressService=l;this.globalCancellation=new qe}cancel(){this.globalCancellation.dispose(!0),this.globalCancellation=new qe}dispose(){this.globalCancellation.dispose(!0)}async runTaskAndCheckErrors(i,e){try{let t=await this.runTask(i,e,this.globalCancellation.token);if(t&&(t.exitCode===void 0||t.cancelled))return 0;let o=e?this.markerService.read({severities:8,take:2}).length:0,n=t&&t.exitCode===0,r=t&&t.exitCode!==0,s=this.configurationService.getValue("debug").onTaskErrors;if(n||s==="debugAnyway"||o===0&&!r)return 1;if(s==="showErrors")return await this.viewsService.openView(Ur.MARKERS_VIEW_ID,!0),Promise.resolve(0);if(s==="abort")return Promise.resolve(0);let l=typeof e=="string"?e:e?e.name:"",c=o>1?d(10872,null,l):o===1?d(10871,null,l):t&&typeof t.exitCode=="number"?d(10873,null,l,t.exitCode):d(10874,null,l),u;(y=>(y[y.DebugAnyway=1]="DebugAnyway",y[y.ShowErrors=2]="ShowErrors",y[y.Cancel=0]="Cancel"))(u||={});let{result:p,checkboxChecked:h}=await this.dialogService.prompt({type:wt.Warning,message:c,buttons:[{label:Ckn,run:()=>1},{label:d(10878,null),run:()=>2}],cancelButton:{label:IOo,run:()=>0},checkbox:{label:d(10875,null)}}),g=p===1,f=p===0;return h&&this.configurationService.updateValue("debug.onTaskErrors",p===1?"debugAnyway":f?"abort":"showErrors"),f?Promise.resolve(0):g?1:(await this.viewsService.openView(Ur.MARKERS_VIEW_ID,!0),Promise.resolve(0))}catch(t){let o=this.taskService.configureAction(),n=JSON.parse(this.storageService.get(SOo,1,"{}")),r=-1,s;if((p=>(p[p.DebugAnyway=0]="DebugAnyway",p[p.ConfigureTask=1]="ConfigureTask",p[p.Cancel=2]="Cancel"))(s||={}),n[t.message]!==void 0)r=n[t.message];else{let{result:l,checkboxChecked:c}=await this.dialogService.prompt({type:wt.Error,message:t.message,buttons:[{label:d(10866,null),run:()=>0},{label:o.label,run:()=>1}],cancelButton:{run:()=>2},checkbox:{label:d(10876,null)}});r=l,c&&(n[t.message]=r,this.storageService.store(SOo,JSON.stringify(n),1,1))}return r===1&&await o.run(),r===0?1:0}}async runTask(i,e,t=this.globalCancellation.token){if(!e)return Promise.resolve(null);if(!i)return Promise.reject(new Error(d(10870,null,typeof e=="string"?e:e.type)));let o=await this.taskService.getTask(i,e);if(!o){let g=typeof e=="string"?d(10869,null,e):d(10868,null);return Promise.reject(Rz(g,[li({id:a$,label:$We,enabled:!0,run:()=>this.commandService.executeCommand(a$)})]))}let n=!1,r=new O,s=g=>g.getKey()??g.getMapKey(),l=s(o),c=new Promise(g=>r.add(iKi(this.taskService.onDidStateChange,f=>(f.kind==="inactive"||f.kind==="processEnded"&&f.exitCode===void 0)&&s(f.__task)===l)(f=>{n=!0,g(f.kind==="processEnded"?{exitCode:f.exitCode}:null)})));r.add(iKi(this.taskService.onDidStateChange,g=>(g.kind==="active"||g.kind==="dependsOnStarted")&&s(g.__task)===l)(()=>{n=!0}));let u=r.add(new T);r.add(iKi(this.taskService.onDidStateChange,g=>g.kind==="acquiredInput"&&s(g.__task)===l)(()=>u.fire()));let p=this.taskService.getActiveTasks().then(async g=>{if(g.find(v=>s(v)===l))return u.fire(),(await this.taskService.getBusyTasks()).find(b=>s(b)===l)?(n=!0,c):Promise.resolve(null);let f=this.taskService.run(o);return o.configurationProperties.isBackground?c:f.then(v=>v??null)}),h=new Promise((g,f)=>{p.then(v=>{n=!0,g(v)},v=>f(v)),r.add(t.onCancellationRequested(()=>{g({exitCode:void 0,cancelled:!0}),this.taskService.terminate(o).catch(()=>{})})),r.add(u.event(()=>{let v=o.configurationProperties.isBackground?5e3:1e4;r.add(Zo(()=>{if(!n){let S=d(10879,null,typeof e=="string"?e:JSON.stringify(e));f({severity:wt.Error,message:S})}},v)),this.configurationService.getValue("debug").hideSlowPreLaunchWarning||r.add(Zo(()=>{let S=d(10877,null,o.configurationProperties.name),y=[xkn,IOo],w=o instanceof Zd||o instanceof ev;w&&y.splice(1,0,d(10865,null)),this.progressService.withProgress({location:15,title:S,buttons:y},()=>h.catch(()=>{}),x=>{x===void 0||(x===0?g({exitCode:0}):(g({exitCode:void 0,cancelled:!0}),this.taskService.terminate(o).catch(()=>{}),w&&x===1&&this.taskService.openConfig(o)))})},1e4))}))});return h.finally(()=>r.dispose())}};DKe=I([m(0,yf),m(1,ha),m(2,B),m(3,Gt),m(4,ct),m(5,de),m(6,fe),m(7,Go)],DKe);var RKe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E){this.editorService=i;this.paneCompositeService=e;this.viewsService=t;this.viewDescriptorService=o;this.notificationService=n;this.dialogService=r;this.layoutService=s;this.contextService=l;this.contextKeyService=c;this.lifecycleService=u;this.instantiationService=p;this.extensionService=h;this.fileService=g;this.configurationService=f;this.extensionHostDebugService=v;this.activityService=b;this.commandService=S;this.quickInputService=y;this.workspaceTrustRequestService=w;this.uriIdentityService=x;this.testService=E;this.restartingSessions=new Set;this.disposables=new O;this.initializing=!1;this.sessionCancellationTokens=new Map;this.haveDoneLazySetup=!1;this.breakpointsToSendOnResourceSaved=new Set,this._onDidChangeState=this.disposables.add(new T),this._onDidNewSession=this.disposables.add(new T),this._onWillNewSession=this.disposables.add(new T),this._onDidEndSession=this.disposables.add(new T),this.adapterManager=this.instantiationService.createInstance(wKe,{onDidNewSession:this.onDidNewSession,configurationManager:()=>this.configurationManager}),this.disposables.add(this.adapterManager),this.configurationManager=this.instantiationService.createInstance(xKe,this.adapterManager),this.disposables.add(this.configurationManager),this.debugStorage=this.disposables.add(this.instantiationService.createInstance(bKe)),this.chosenEnvironments=this.debugStorage.loadChosenEnvironments(),this.model=this.instantiationService.createInstance(PDe,this.debugStorage),this.telemetry=this.instantiationService.createInstance(SKe,this.model),this.viewModel=this.disposables.add(new n9t(c)),this.taskRunner=this.instantiationService.createInstance(DKe),this.disposables.add(this.fileService.onDidFilesChange(M=>this.onFileChanges(M))),this.disposables.add(this.lifecycleService.onWillShutdown(this.dispose,this)),this.disposables.add(this.extensionHostDebugService.onAttachSession(M=>{let N=this.model.getSession(M.sessionId,!0);N&&(N.configuration.request="attach",N.configuration.port=M.port,N.setSubId(M.subId),this.launchOrAttachToSession(N))})),this.disposables.add(this.extensionHostDebugService.onTerminateSession(M=>{let N=this.model.getSession(M.sessionId);N&&N.subId===M.subId&&N.disconnect()})),this.disposables.add(this.viewModel.onDidFocusStackFrame(()=>{this.onStateChange()})),this.disposables.add(this.viewModel.onDidFocusSession(M=>{this.onStateChange(),M&&this.setExceptionBreakpointFallbackSession(M.getId())})),this.disposables.add(U.any(this.adapterManager.onDidRegisterDebugger,this.configurationManager.onDidSelectConfiguration)(()=>{let M=this.state!==0||this.configurationManager.getAllConfigurations().length>0&&this.adapterManager.hasEnabledDebuggers()?"default":"simple";this.debugUx.set(M),this.debugStorage.storeDebugUxState(M)})),this.disposables.add(this.model.onDidChangeCallStack(()=>{let M=this.model.getSessions().filter(N=>!N.parentSession).length;if(this.activity?.dispose(),M>0){let N=this.viewDescriptorService.getViewContainerByViewId(O3);N&&(this.activity=this.activityService.showViewContainerActivity(N.id,{badge:new eu(M,V=>V===1?d(10830,null):d(10847,null,V))}))}})),this.disposables.add(i.onDidActiveEditorChange(()=>{this.contextKeyService.bufferChangeEvents(()=>{i.activeEditor===UM.instance?this.disassemblyViewFocus.set(!0):this.disassemblyViewFocus?.reset()})})),this.disposables.add(this.lifecycleService.onBeforeShutdown(()=>{for(let M of i.editors)M.resource?.scheme===$pe&&M.dispose()})),this.disposables.add(h.onWillStop(M=>{M.veto(this.model.getSessions().length>0,d(10831,null))})),this.initContextKeys(c)}initContextKeys(i){queueMicrotask(()=>{i.bufferChangeEvents(()=>{this.debugType=TDe.bindTo(i),this.debugState=ca.bindTo(i),this.hasDebugged=wAt.bindTo(i),this.inDebugMode=vl.bindTo(i),this.debugUx=aN.bindTo(i),this.debugUx.set(this.debugStorage.loadDebugUxState()),this.breakpointsExist=F3.bindTo(i),this.disassemblyViewFocus=Y2.bindTo(i)});let e=()=>this.breakpointsExist.set(!!(this.model.getBreakpoints().length||this.model.getDataBreakpoints().length||this.model.getFunctionBreakpoints().length));e(),this.disposables.add(this.model.onDidChangeBreakpoints(()=>e()))})}getModel(){return this.model}getViewModel(){return this.viewModel}getConfigurationManager(){return this.configurationManager}getAdapterManager(){return this.adapterManager}sourceIsNotAvailable(i){this.model.sourceIsNotAvailable(i)}dispose(){this.disposables.dispose()}get state(){let i=this.viewModel.focusedSession;return i?i.state:this.initializing?1:0}get initializingOptions(){return this._initializingOptions}startInitializingState(i){this.initializing||(this.initializing=!0,this._initializingOptions=i,this.onStateChange())}endInitializingState(){this.initializing&&(this.initializing=!1,this._initializingOptions=void 0,this.onStateChange())}cancelTokens(i){if(i){let e=this.sessionCancellationTokens.get(i);e&&(e.cancel(),this.sessionCancellationTokens.delete(i))}else this.sessionCancellationTokens.forEach(e=>e.cancel()),this.sessionCancellationTokens.clear()}onStateChange(){let i=this.state;this.previousState!==i&&(this.contextKeyService.bufferChangeEvents(()=>{this.debugState.set(HM(i)),this.inDebugMode.set(i!==0);let e=i!==0&&i!==1||this.adapterManager.hasEnabledDebuggers()&&this.configurationManager.selectedConfiguration.name?"default":"simple";this.debugUx.set(e),this.debugStorage.storeDebugUxState(e)}),this.previousState=i,this._onDidChangeState.fire(i))}get onDidChangeState(){return this._onDidChangeState.event}get onDidNewSession(){return this._onDidNewSession.event}get onWillNewSession(){return this._onWillNewSession.event}get onDidEndSession(){return this._onDidEndSession.event}lazySetup(){this.haveDoneLazySetup||(this.disposables.add(this.fileService.registerProvider($pe,this.disposables.add(new s9t(this)))),this.haveDoneLazySetup=!0)}async startDebugging(i,e,t,o=!t?.parentSession){let n=t&&t.noDebug?d(10851,null):d(10840,null);if(!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:n}))return!1;this.lazySetup(),this.startInitializingState(t),this.hasDebugged.set(!0);try{await this.extensionService.activateByEvent("onDebug"),o&&await TXe(this.configurationService,this.editorService),await this.extensionService.whenInstalledExtensionsRegistered();let s,l;if(e||(e=this.configurationManager.selectedConfiguration.name),typeof e=="string"&&i?(s=i.getConfiguration(e),l=i.getCompound(e)):typeof e!="string"&&(s=e),l){if(!l.configurations)throw new Error(d(10834,null));if(l.preLaunchTask&&await this.taskRunner.runTaskAndCheckErrors(i?.workspace||this.contextService.getWorkspace(),l.preLaunchTask)===0)return this.endInitializingState(),!1;l.stopAll&&(t={...t,compoundRoot:new J6t});let p=(await Promise.all(l.configurations.map(h=>{let g=typeof h=="string"?h:h.name;if(g===l.name)return Promise.resolve(!1);let f;if(typeof h=="string"){let v=this.configurationManager.getLaunches().filter(b=>!!b.getConfiguration(g));if(v.length===1)f=v[0];else if(i&&v.length>1&&v.indexOf(i)>=0)f=i;else throw new Error(v.length===0?d(10848,null,g):d(10845,null,g))}else if(h.folder){let v=this.configurationManager.getLaunches().filter(b=>b.workspace&&b.workspace.name===h.folder&&!!b.getConfiguration(h.name));if(v.length===1)f=v[0];else throw new Error(d(10849,null,h.folder,h.name,l.name))}return this.createSession(f,f.getConfiguration(g),t)}))).every(h=>!!h);return this.endInitializingState(),p}if(e&&!s){let u=i?d(10835,null,typeof e=="string"?e:e.name):d(10844,null);throw new Error(u)}let c=await this.createSession(i,s,t);return this.endInitializingState(),c}catch(s){return this.notificationService.error(s),this.endInitializingState(),Promise.reject(s)}}async createSession(i,e,t){let o;e?o=e.type:e=Object.create(null),(t&&t.noDebug||t&&typeof t.noDebug>"u"&&t.parentSession&&t.parentSession.configuration.noDebug)&&(e.noDebug=!0);let n=io(e),r,s;if(!o){if(s=this.editorService.activeEditor,s&&s.resource){let p=this.chosenEnvironments[s.resource.toString()];if(p&&(o=p.type,p.dynamicLabel)){let g=(await this.configurationManager.getDynamicConfigurationsByType(p.type)).find(f=>f.label===p.dynamicLabel);g&&(i=g.launch,Object.assign(e,g.config))}}o||(r=await this.adapterManager.guessDebugger(!1),r&&(o=r.debugger.type,r.withConfig&&(i=r.withConfig.launch,Object.assign(e,r.withConfig.config))))}let l=new qe,c=ht();this.sessionCancellationTokens.set(c,l);let u=await this.configurationManager.resolveConfigurationByProviders(i&&i.workspace?i.workspace.uri:void 0,o,e,l.token);if(u&&u.type)try{let p=await this.substituteVariables(i,u);if(!p||l.token.isCancellationRequested)return!1;let h=!1;if(t?.startedByUser&&p&&p.suppressMultipleSessionWarning!==!0){let y=this.model.getSessions(),w=i?.workspace,x=y.find(E=>E.configuration.name===p.name&&E.configuration.type===p.type&&E.configuration.request===p.request&&E.root===w);if(x){if(!await this.confirmConcurrentSession(x.getLabel()))return!1;h=!0}}let g=i?.workspace||this.contextService.getWorkspace();if(await this.taskRunner.runTaskAndCheckErrors(g,p.preLaunchTask)===0)return!1;let v=await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(i&&i.workspace?i.workspace.uri:void 0,p.type,p,l.token);if(!v)return i&&o&&v===null&&!l.token.isCancellationRequested&&await i.openConfigFile({preserveFocus:!0,type:o},l.token),!1;p=v;let b=this.adapterManager.getDebugger(p.type);if(!b||u.request!=="attach"&&u.request!=="launch"){let y;u.request!=="attach"&&u.request!=="launch"?y=u.request?d(10839,null,"request",u.request):d(10838,null,"request"):y=p.type?d(10842,null,p.type):d(10841,null);let w=[];return w.push(li({id:"installAdditionalDebuggers",label:d(10843,null,p.type),enabled:!0,run:async()=>this.commandService.executeCommand("debug.installAdditionalDebuggers",p?.type)})),await this.showError(y,w),!1}if(!b.enabled)return await this.showError(NAt(b.type),[]),!1;let S=await this.doCreateSession(c,i?.workspace,{resolved:p,unresolved:n},t,h);return S&&r&&s&&s.resource&&(this.chosenEnvironments[s.resource.toString()]={type:r.debugger.type,dynamicLabel:r.withConfig?.label},this.debugStorage.storeChosenEnvironments(this.chosenEnvironments)),S}catch(p){return p&&p.message?await this.showError(p.message):this.contextService.getWorkbenchState()===1&&await this.showError(d(10850,null)),i&&!l.token.isCancellationRequested&&await i.openConfigFile({preserveFocus:!0},l.token),!1}return i&&o&&u===null&&!l.token.isCancellationRequested&&await i.openConfigFile({preserveFocus:!0,type:o},l.token),!1}async doCreateSession(i,e,t,o,n=!1){let r=this.instantiationService.createInstance(_Ke,i,t,e,this.model,o);if(!n&&o?.startedByUser&&this.model.getSessions().some(l=>l.configuration.name===t.resolved.name&&l.configuration.type===t.resolved.type&&l.configuration.request===t.resolved.request&&l.root===e)&&t.resolved.suppressMultipleSessionWarning!==!0&&!await this.confirmConcurrentSession(r.getLabel()))return!1;this.model.addSession(r),this._onWillNewSession.fire(r);let s=this.configurationService.getValue("debug").openDebug;!t.resolved.noDebug&&(s==="openOnSessionStart"||s==="openOnFirstSessionStart"&&this.viewModel.firstSessionStart)&&!r.suppressDebugView&&await this.paneCompositeService.openPaneComposite($g,0);try{await this.launchOrAttachToSession(r);let l=r.configuration.internalConsoleOptions||this.configurationService.getValue("debug").internalConsoleOptions;(l==="openOnSessionStart"||this.viewModel.firstSessionStart&&l==="openOnFirstSessionStart")&&this.viewsService.openView($d,!1),this.viewModel.firstSessionStart=!1;let c=this.configurationService.getValue("debug").showSubSessionsInToolBar,u=this.model.getSessions();return(c?u:u.filter(h=>!h.parentSession)).length>1&&this.viewModel.setMultiSessionView(!0),this._onDidNewSession.fire(r),!0}catch(l){if(Yi(l)||(r&&r.getReplElements().length>0&&this.viewsService.openView($d,!1),r.configuration&&r.configuration.request==="attach"&&r.configuration.__autoAttach))return!1;let c=l instanceof Error?l.message:l;return l.showUser!==!1&&await this.showError(c,RY(l)?l.actions:[]),!1}}async confirmConcurrentSession(i){return(await this.dialogService.confirm({message:d(10846,null,i)})).confirmed}async launchOrAttachToSession(i,e=!1){this.registerSessionListeners(i);let t=this.adapterManager.getDebugger(i.configuration.type);try{await i.initialize(t),await i.launchOrAttach(i.configuration);let o=!!i.root&&!!this.configurationService.getValue("launch",{resource:i.root.uri});await this.telemetry.logDebugSessionStart(t,o),(e||!this.viewModel.focusedSession||i.parentSession===this.viewModel.focusedSession&&i.compact)&&await this.focusStackFrame(void 0,void 0,i)}catch(o){return this.viewModel.focusedSession===i&&await this.focusStackFrame(void 0),Promise.reject(o)}}registerSessionListeners(i){let e=new O;this.disposables.add(e);let t=e.add(new Dt(()=>{i.state===3&&this.viewModel.focusedSession===i&&this.viewModel.setFocus(void 0,this.viewModel.focusedThread,i,!1)},200));e.add(i.onDidChangeState(()=>{i.state===3&&this.viewModel.focusedSession===i&&t.schedule(),i===this.viewModel.focusedSession&&this.onStateChange()})),e.add(this.onDidEndSession(o=>{o.session===i&&this.disposables.delete(e)})),e.add(i.onDidEndAdapter(async o=>{o&&(o.error&&this.notificationService.error(d(10836,null,o.error.message||o.error.toString())),this.telemetry.logDebugSessionStop(i,o));let n=EXe(i);if(n&&n.state===3&&n.configuration.noDebug&&this.extensionHostDebugService.close(n.getId()),i.configuration.postDebugTask){let s=i.root??this.contextService.getWorkspace();try{await this.taskRunner.runTask(s,i.configuration.postDebugTask)}catch(l){this.notificationService.error(l)}}if(this.endInitializingState(),this.cancelTokens(i.getId()),this.configurationService.getValue("debug").closeReadonlyTabsOnEnd){let s=this.editorService.getEditors(1).filter(({editor:l})=>l.resource?.scheme===Ox&&i.getId()===J2.getEncodedDebugData(l.resource).sessionId);this.editorService.closeEditors(s)}this._onDidEndSession.fire({session:i,restart:this.restartingSessions.has(i)});let r=this.viewModel.focusedSession;if(r&&r.getId()===i.getId()){let{session:s,thread:l,stackFrame:c}=yOo(this.model,void 0,void 0,void 0,r);this.viewModel.setFocus(c,l,s,!1)}if(this.model.getSessions().length===0&&(this.viewModel.setMultiSessionView(!1),this.layoutService.isVisible("workbench.parts.sidebar")&&this.configurationService.getValue("debug").openExplorerOnEnd&&this.paneCompositeService.openPaneComposite(Dv,0),this.model.getDataBreakpoints().filter(l=>!l.canPersist).forEach(l=>this.model.removeDataBreakpoints(l.getId())),this.configurationService.getValue("debug").console.closeOnEnd)){let l=this.viewDescriptorService.getViewContainerByViewId($d);l&&this.viewsService.isViewContainerVisible(l.id)&&this.viewsService.closeViewContainer(l.id)}this.model.removeExceptionBreakpointsForSession(i.getId())}))}async restartSession(i,e){i.saveBeforeRestart&&await TXe(this.configurationService,this.editorService);let t=!!e,o=async()=>{if(t)return Promise.resolve(1);let h=i.root||this.contextService.getWorkspace();await this.taskRunner.runTask(h,i.configuration.preRestartTask),await this.taskRunner.runTask(h,i.configuration.postDebugTask);let g=await this.taskRunner.runTaskAndCheckErrors(h,i.configuration.preLaunchTask);return g!==1?g:this.taskRunner.runTaskAndCheckErrors(h,i.configuration.postRestartTask)},n=EXe(i);if(n){await o()===1&&this.extensionHostDebugService.reload(n.getId());return}let r=!1,s,l=i.root?this.configurationManager.getLaunch(i.root.uri):void 0;l&&(s=l.getConfiguration(i.configuration.name),s&&!Qi(s,i.unresolvedConfiguration)&&(s.noDebug=i.configuration.noDebug,r=!0));let c=i.configuration;if(l&&r&&s){let h=new qe;this.sessionCancellationTokens.set(i.getId(),h);let g=await this.configurationManager.resolveConfigurationByProviders(l.workspace?l.workspace.uri:void 0,s.type,s,h.token);g?(c=await this.substituteVariables(l,g),c&&!h.token.isCancellationRequested&&(c=await this.configurationManager.resolveDebugConfigurationWithSubstitutedVariables(l&&l.workspace?l.workspace.uri:void 0,c.type,c,h.token))):c=g}c&&i.setConfiguration({resolved:c,unresolved:s}),i.configuration.__restart=e;let u=async h=>{this.restartingSessions.add(i);let g=!1;try{g=await h()!==!1}catch(f){throw g=!1,f}finally{this.restartingSessions.delete(i),g||this._onDidEndSession.fire({session:i,restart:!1})}};for(let h of this.model.getBreakpoints({triggeredOnly:!0}))h.setSessionDidTrigger(i.getId(),!1);if(i.correlatedTestRun){i.correlatedTestRun.completedAt||(i.cancelCorrelatedTestRun(),await U.toPromise(i.correlatedTestRun.onComplete)),this.testService.runResolvedTests(i.correlatedTestRun.request);return}if(i.capabilities.supportsRestartRequest){await o()===1&&await u(async()=>(await i.restart(),!0));return}let p=!!this.viewModel.focusedSession&&i.getId()===this.viewModel.focusedSession.getId();return u(async()=>(t?await i.disconnect(!0):await i.terminate(!0),new Promise((h,g)=>{setTimeout(async()=>{if(await o()!==1||!c)return h(!1);try{await this.launchOrAttachToSession(i,p),this._onDidNewSession.fire(i),h(!0)}catch(v){g(v)}},300)})))}async stopSession(i,e=!1,t=!1){if(i)return e?i.disconnect(void 0,t):i.terminate();let o=this.model.getSessions();return o.length===0&&(this.taskRunner.cancel(),await this.quickInputService.cancel(),this.endInitializingState(),this.cancelTokens(void 0)),Promise.all(o.map(n=>e?n.disconnect(void 0,t):n.terminate()))}async substituteVariables(i,e){let t=this.adapterManager.getDebugger(e.type);if(t){let o;if(i&&i.workspace)o=i.workspace;else{let n=this.contextService.getWorkspace().folders;n.length===1&&(o=n[0])}try{return await t.substituteVariables(o,e)}catch(n){n.message!==X7&&this.showError(n.message,void 0,!!i?.getConfiguration(e.name));return}}return Promise.resolve(e)}async showError(i,e=[],t=!0){let o=li({id:a$,label:$We,enabled:!0,run:()=>this.commandService.executeCommand(a$)}),n=e.filter(r=>r.id.endsWith(".command")).length>0?e:[...e,...t?[o]:[]];await this.dialogService.prompt({type:wt.Error,message:i,buttons:n.map(r=>({label:r.label,run:()=>r.run()})),cancelButton:!0})}async focusStackFrame(i,e,t,o){let{stackFrame:n,thread:r,session:s}=yOo(this.model,i,e,t);if(n){let l=await n.openInEditor(this.editorService,o?.preserveFocus??!0,o?.sideBySide,o?.pinned);if(l&&l.input!==UM.instance){let c=l.getControl();if(n&&fn(c)&&c.hasModel()){let u=c.getModel(),p=n.range.startLineNumber;if(p>=1&&p<=u.getLineCount()){let h=c.getModel().getLineContent(p);cn(d(10837,null,h,r&&r.stoppedDetails?`, reason ${r.stoppedDetails.reason}`:"",n.source?n.source.name:"",n.range.startLineNumber))}}}}s?this.debugType.set(s.configuration.type):this.debugType.reset(),this.viewModel.setFocus(n,r,s,!!o?.explicit)}addWatchExpression(i){let e=this.model.addWatchExpression(i);i||this.viewModel.setSelectedExpression(e,!1),this.debugStorage.storeWatchExpressions(this.model.getWatchExpressions())}renameWatchExpression(i,e){this.model.renameWatchExpression(i,e),this.debugStorage.storeWatchExpressions(this.model.getWatchExpressions())}moveWatchExpression(i,e){this.model.moveWatchExpression(i,e),this.debugStorage.storeWatchExpressions(this.model.getWatchExpressions())}removeWatchExpressions(i){this.model.removeWatchExpressions(i),this.debugStorage.storeWatchExpressions(this.model.getWatchExpressions())}canSetBreakpointsIn(i){return this.adapterManager.canSetBreakpointsIn(i)}async enableOrDisableBreakpoints(i,e){e?(this.model.setEnablement(e,i),this.debugStorage.storeBreakpoints(this.model),e instanceof pb?(await this.makeTriggeredBreakpointsMatchEnablement(i,e),await this.sendBreakpoints(e.originalUri)):e instanceof QI?await this.sendFunctionBreakpoints():e instanceof rw?await this.sendDataBreakpoints():e instanceof YI?await this.sendInstructionBreakpoints():await this.sendExceptionBreakpoints()):(this.model.enableOrDisableAllBreakpoints(i),this.debugStorage.storeBreakpoints(this.model),await this.sendAllBreakpoints()),this.debugStorage.storeBreakpoints(this.model)}async addBreakpoints(i,e,t=!0){let o=this.model.addBreakpoints(i,e);return t&&o.forEach(n=>Er(d(10832,null,n.lineNumber,i.fsPath))),this.debugStorage.storeBreakpoints(this.model),await this.sendBreakpoints(i),this.debugStorage.storeBreakpoints(this.model),o}async updateBreakpoints(i,e,t){this.model.updateBreakpoints(e),this.debugStorage.storeBreakpoints(this.model),t?this.breakpointsToSendOnResourceSaved.add(i):(await this.sendBreakpoints(i),this.debugStorage.storeBreakpoints(this.model))}async removeBreakpoints(i){let e=this.model.getBreakpoints(),t=i===void 0?e:i instanceof Array?e.filter(n=>i.includes(n.getId())):e.filter(n=>n.getId()===i);t.forEach(n=>Er(d(10833,null,n.lineNumber,n.uri.fsPath)));let o=new Set(t.map(n=>n.originalUri.toString()));this.model.removeBreakpoints(t),this.unlinkTriggeredBreakpoints(e,t).forEach(n=>o.add(n.toString())),this.debugStorage.storeBreakpoints(this.model),await Promise.all([...o].map(n=>this.sendBreakpoints(A.parse(n))))}setBreakpointsActivated(i){return this.model.setBreakpointsActivated(i),this.sendAllBreakpoints()}async addFunctionBreakpoint(i,e){this.model.addFunctionBreakpoint(i??{name:""},e),i&&(this.debugStorage.storeBreakpoints(this.model),await this.sendFunctionBreakpoints(),this.debugStorage.storeBreakpoints(this.model))}async updateFunctionBreakpoint(i,e){this.model.updateFunctionBreakpoint(i,e),this.debugStorage.storeBreakpoints(this.model),await this.sendFunctionBreakpoints()}async removeFunctionBreakpoints(i){this.model.removeFunctionBreakpoints(i),this.debugStorage.storeBreakpoints(this.model),await this.sendFunctionBreakpoints()}async addDataBreakpoint(i){this.model.addDataBreakpoint(i),this.debugStorage.storeBreakpoints(this.model),await this.sendDataBreakpoints(),this.debugStorage.storeBreakpoints(this.model)}async updateDataBreakpoint(i,e){this.model.updateDataBreakpoint(i,e),this.debugStorage.storeBreakpoints(this.model),await this.sendDataBreakpoints()}async removeDataBreakpoints(i){this.model.removeDataBreakpoints(i),this.debugStorage.storeBreakpoints(this.model),await this.sendDataBreakpoints()}async addInstructionBreakpoint(i){this.model.addInstructionBreakpoint(i),this.debugStorage.storeBreakpoints(this.model),await this.sendInstructionBreakpoints(),this.debugStorage.storeBreakpoints(this.model)}async removeInstructionBreakpoints(i,e,t){this.model.removeInstructionBreakpoints(i,e,t),this.debugStorage.storeBreakpoints(this.model),await this.sendInstructionBreakpoints()}setExceptionBreakpointFallbackSession(i){this.model.setExceptionBreakpointFallbackSession(i),this.debugStorage.storeBreakpoints(this.model)}setExceptionBreakpointsForSession(i,e){this.model.setExceptionBreakpointsForSession(i.getId(),e),this.debugStorage.storeBreakpoints(this.model)}async setExceptionBreakpointCondition(i,e){this.model.setExceptionBreakpointCondition(i,e),this.debugStorage.storeBreakpoints(this.model),await this.sendExceptionBreakpoints()}async sendAllBreakpoints(i){let e=jo(this.model.getBreakpoints(),t=>t.originalUri.toString()).map(t=>this.sendBreakpoints(t.originalUri,!1,i));i?.capabilities.supportsConfigurationDoneRequest?await Promise.all([...e,this.sendFunctionBreakpoints(i),this.sendDataBreakpoints(i),this.sendInstructionBreakpoints(i),this.sendExceptionBreakpoints(i)]):(await Promise.all(e),await this.sendFunctionBreakpoints(i),await this.sendDataBreakpoints(i),await this.sendInstructionBreakpoints(i),await this.sendExceptionBreakpoints(i))}unlinkTriggeredBreakpoints(i,e){let t=[];for(let o of e)for(let n of i)!e.includes(n)&&n.triggeredBy===o.getId()&&(this.model.updateBreakpoints(new Map([[n.getId(),{triggeredBy:void 0}]])),t.push(n.originalUri));return t}async makeTriggeredBreakpointsMatchEnablement(i,e){if(i&&e.triggeredBy){let t=this.model.getBreakpoints().find(o=>e.triggeredBy===o.getId());t&&!t.enabled&&await this.enableOrDisableBreakpoints(i,t)}await Promise.all(this.model.getBreakpoints().filter(t=>t.triggeredBy===e.getId()&&t.enabled!==i).map(t=>this.enableOrDisableBreakpoints(i,t)))}async sendBreakpoints(i,e=!1,t){let o=this.model.getBreakpoints({originalUri:i,enabledOnly:!0});await Gut(this.model,t,async n=>{if(!n.configuration.noDebug){let r=o.filter(s=>!s.triggeredBy||s.getSessionDidTrigger(n.getId()));await n.sendBreakpoints(i,r,e)}})}async sendFunctionBreakpoints(i){let e=this.model.getFunctionBreakpoints().filter(t=>t.enabled&&this.model.areBreakpointsActivated());await Gut(this.model,i,async t=>{t.capabilities.supportsFunctionBreakpoints&&!t.configuration.noDebug&&await t.sendFunctionBreakpoints(e)})}async sendDataBreakpoints(i){let e=this.model.getDataBreakpoints().filter(t=>t.enabled&&this.model.areBreakpointsActivated());await Gut(this.model,i,async t=>{t.capabilities.supportsDataBreakpoints&&!t.configuration.noDebug&&await t.sendDataBreakpoints(e)})}async sendInstructionBreakpoints(i){let e=this.model.getInstructionBreakpoints().filter(t=>t.enabled&&this.model.areBreakpointsActivated());await Gut(this.model,i,async t=>{t.capabilities.supportsInstructionBreakpoints&&!t.configuration.noDebug&&await t.sendInstructionBreakpoints(e)})}sendExceptionBreakpoints(i){return Gut(this.model,i,async e=>{let t=this.model.getExceptionBreakpointsForSession(e.getId()).filter(o=>o.enabled);e.capabilities.supportsConfigurationDoneRequest&&(!e.capabilities.exceptionBreakpointFilters||e.capabilities.exceptionBreakpointFilters.length===0)||e.configuration.noDebug||await e.sendExceptionBreakpoints(t)})}onFileChanges(i){let e=this.model.getBreakpoints().filter(o=>i.contains(o.originalUri,2));e.length&&this.model.removeBreakpoints(e);let t=[];for(let o of this.breakpointsToSendOnResourceSaved)i.contains(o,0)&&t.push(o);for(let o of t)this.breakpointsToSendOnResourceSaved.delete(o),this.sendBreakpoints(o,!0)}async runTo(i,e,t){let o,n=this.getViewModel().focusedThread,r=async()=>{if(!!!this.getModel().getBreakpoints({column:t,lineNumber:e,uri:i}).length){let c=await this.addAndValidateBreakpoints(i,e,t);c.thread&&(n=c.thread),c.breakpoint&&(o=c.breakpoint)}return{threadToContinue:n,breakpointToRemove:o}},s=l=>l===2||l===0?(o&&this.removeBreakpoints(o.getId()),!0):!1;if(await r(),this.state===0){let{launch:l,name:c,getConfig:u}=this.getConfigurationManager().selectedConfiguration,p=await u(),h=p?Object.assign(io(p),{}):c,g=this.onDidChangeState(f=>{s(f)&&g.dispose()});await this.startDebugging(l,h,void 0,!0)}if(this.state===2){let l=this.getViewModel().focusedSession;if(!l||!n)return;let c=n.session.onDidChangeState(()=>{s(l.state)&&c.dispose()});await n.continue()}}async addAndValidateBreakpoints(i,e,t){let o=this.getModel(),n=this.getViewModel(),s=(await this.addBreakpoints(i,[{lineNumber:e,column:t}],!1))?.[0];if(!s)return{breakpoint:void 0,thread:n.focusedThread};if(!s.verified){let p;await Uu(new Promise(h=>{p=o.onDidChangeBreakpoints(()=>{s.verified&&h()})}),2e3),p.dispose()}let l;(v=>(v[v.Focused=0]="Focused",v[v.Verified=1]="Verified",v[v.VerifiedAndPausedInFile=2]="VerifiedAndPausedInFile",v[v.VerifiedAndFocused=3]="VerifiedAndFocused"))(l||={});let c=n.focusedThread,u=0;for(let p of s.sessionsThatVerified){let h=o.getSession(p);if(!h)continue;let g=h.getAllThreads().filter(f=>f.stopped);if(u<3&&n.focusedThread&&g.includes(n.focusedThread)&&(c=n.focusedThread,u=3),u<2){let f=g.find(v=>{let b=v.getTopStackFrame();return b&&this.uriIdentityService.extUri.isEqual(b.source.uri,i)});f&&(c=f,u=2)}u<1&&(c=g[0],u=2)}return{thread:c,breakpoint:s}}};RKe=I([m(0,ie),m(1,Es),m(2,Gt),m(3,ji),m(4,Ne),m(5,ct),m(6,wi),m(7,Ae),m(8,X),m(9,to),m(10,F),m(11,lt),m(12,ge),m(13,B),m(14,jR),m(15,Al),m(16,fe),m(17,$e),m(18,lp),m(19,gt),m(20,Xs)],RKe);function yOo(a,i,e,t,o){if(!t)if(i||e)t=i?i.thread.session:e.session;else{let n=a.getSessions();t=n.find(s=>s.state===2)||n.find(s=>s!==o&&s!==o?.parentSession)||(n.length?n[0]:void 0)}if(!e)if(i)e=i.thread;else{let n=t?t.getAllThreads():void 0;e=n&&n.find(s=>s.stopped)||(n&&n.length?n[0]:void 0)}return!i&&e&&(i=e.getTopStackFrame()),{session:t,thread:e,stackFrame:i}}async function Gut(a,i,e){i?await e(i):await Promise.all(a.getSessions().map(t=>e(t)))}Ce(Hi,RKe,1);Ce(JZ,ADe,1);var kkn=d(10586,null);byo();oe.as(Zi.Workbench).registerWorkbenchContribution(pKe,4);oe.as(Zi.Workbench).registerWorkbenchContribution(dKe,4);Ft&&oe.as(Zi.Workbench).registerWorkbenchContribution(mKe,4);oe.as(Zi.Workbench).registerWorkbenchContribution(iKe,3);oe.as(Zi.Workbench).registerWorkbenchContribution(z1,4);oe.as(Zi.Workbench).registerWorkbenchContribution(fKe,4);oe.as(Zi.Workbench).registerWorkbenchContribution(sKe,4);oe.as(Zi.Workbench).registerWorkbenchContribution(tKe,4);bt(WSe.ID,WSe,vt.AfterRestored);oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:uKe,prefix:uat,contextKey:"inLaunchConfigurationsPicker",placeholder:d(10639,null),helpEntries:[{description:d(10638,null),commandId:R6,commandCenterOrder:50}]});oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:rKe,prefix:pat,contextKey:"inDebugConsolePicker",placeholder:d(10641,null),helpEntries:[{description:d(10640,null),commandId:P$t}]});Eo("editor.contrib.callStack",gVe,1);Eo(cN,hVe,1);Eo(OH,P6,2);var hg=(a,i,e,t)=>{be.appendMenuItem(R.CommandPalette,{when:C.and(qa,e),group:kkn,command:{id:a,title:i,category:Ene,precondition:t}})};hg(i$,Tne);hg(M$t,P(10642,"Terminate Thread"),vl,kXe);hg(o$,_ne,vl,ca.isEqualTo("stopped"));hg(n$,Dne,vl,ca.isEqualTo("stopped"));hg(NNi,XEo,vl,C.and(GZ,vl,ca.isEqualTo("stopped")));hg(r$,Rne,vl,ca.isEqualTo("stopped"));hg(D6,Lne,vl,C.and(ca.isEqualTo("running"),j2.toNegated()));hg(MP,M6,vl,C.or(Nx,lN));hg(GWe,aat,vl,C.or(Nx,C.and(jZ,lN)));hg(V_,l$,vl,C.or(Nx.toNegated(),lN));hg(s$,Mne,vl,ca.isEqualTo("stopped"));hg(tat,P(10601,"Jump to Cursor"),Gpe);hg(tat,P(10630,"Set Next Statement"),Gpe);hg(aKe.ID,aKe.LABEL,qa);hg(lKe.ID,lKe.LABEL,vl);hg(cKe.ID,cKe.LABEL);hg(eat,P(10596,"Inline Breakpoint"));hg(CV,lat,C.and(qa,ca.notEqualsTo(HM(1))));hg(iat,jNi,C.and(qa,ca.notEqualsTo(HM(1))));hg(R6,ZEo,C.and(qa,ca.notEqualsTo(HM(1))));hg(HNi,eTo);hg(UNi,tTo);hg(zNi,iTo,vl,yXe);hg(P$t,aTo);hg(FNi,lTo);hg(KNi,oTo,vl,ca.isEqualTo("stopped"));hg(GNi,nTo,vl,ca.isEqualTo("stopped"));hg(qNi,rTo,vl,ca.isEqualTo("stopped"));hg($Ni,sTo,vl,ca.isEqualTo("stopped"));var bu=(a,i,e,t,o,n,r="navigation",s)=>{be.appendMenuItem(a,{group:r,when:o,order:t,icon:s,command:{id:i,title:e,icon:s,precondition:n}})};bu(R.DebugCallStackContext,i$,Tne,10,ub.isEqualTo("session"),void 0,"3_modification");bu(R.DebugCallStackContext,MP,M6,20,ub.isEqualTo("session"),void 0,"3_modification");bu(R.DebugCallStackContext,GWe,aat,21,C.and(ub.isEqualTo("session"),jZ,lN),void 0,"3_modification");bu(R.DebugCallStackContext,V_,l$,30,ub.isEqualTo("session"),void 0,"3_modification");bu(R.DebugCallStackContext,D6,Lne,10,C.and(ub.isEqualTo("thread"),C.and(ca.isEqualTo("running"),j2.toNegated())));bu(R.DebugCallStackContext,s$,Mne,10,C.and(ub.isEqualTo("thread"),ca.isEqualTo("stopped")));bu(R.DebugCallStackContext,o$,_ne,20,ub.isEqualTo("thread"),ca.isEqualTo("stopped"));bu(R.DebugCallStackContext,n$,Dne,30,ub.isEqualTo("thread"),ca.isEqualTo("stopped"));bu(R.DebugCallStackContext,r$,Rne,40,ub.isEqualTo("thread"),ca.isEqualTo("stopped"));bu(R.DebugCallStackContext,M$t,d(10643,null),10,ub.isEqualTo("thread"),kXe,"termination");bu(R.DebugCallStackContext,ONi,d(10626,null),10,C.and(ub.isEqualTo("stackFrame"),TAt),_At);bu(R.DebugCallStackContext,MNi,d(10550,null),20,ub.isEqualTo("stackFrame"),void 0,"3_modification");bu(R.DebugVariablesContext,mat,d(10646,null),15,KZ,vl,"inline",t2t);bu(R.DebugVariablesContext,oOi,d(10631,null),10,C.or(CXe,C.and(NH,xXe)),qpe.toNegated(),"3_modification");bu(R.DebugVariablesContext,L6,cat,10,void 0,void 0,"5_cutcopypaste");bu(R.DebugVariablesContext,kne,jWe,20,NH,void 0,"5_cutcopypaste");bu(R.DebugVariablesContext,oat,dat,100,NH,void 0,"z_commands");bu(R.DebugVariablesContext,sat,d(10546,null),200,$Z,void 0,"z_commands");bu(R.DebugVariablesContext,nat,d(10544,null),210,Q2,void 0,"z_commands");bu(R.DebugVariablesContext,rat,d(10545,null),220,qZ,void 0,"z_commands");bu(R.DebugHoverContext,mat,d(10646,null),15,KZ,vl,"inline",t2t);bu(R.DebugHoverContext,L6,cat,10,void 0,void 0,"5_cutcopypaste");bu(R.DebugHoverContext,kne,jWe,20,NH,void 0,"5_cutcopypaste");bu(R.DebugHoverContext,oat,dat,100,NH,void 0,"z_commands");bu(R.DebugHoverContext,sat,d(10546,null),200,$Z,void 0,"z_commands");bu(R.DebugHoverContext,nat,d(10544,null),210,Q2,void 0,"z_commands");bu(R.DebugHoverContext,rat,d(10545,null),220,qZ,void 0,"z_commands");bu(R.DebugWatchContext,Kzi,Gzi,10,void 0,void 0,"3_modification");bu(R.DebugWatchContext,WNi,d(10594,null),20,$2.isEqualTo("expression"),void 0,"3_modification");bu(R.DebugWatchContext,VNi,d(10631,null),30,C.or(C.and($2.isEqualTo("expression"),xXe),C.and($2.isEqualTo("variable"),CXe)),qpe.toNegated(),"3_modification");bu(R.DebugWatchContext,L6,d(10551,null),40,C.or($2.isEqualTo("expression"),$2.isEqualTo("variable")),vl,"3_modification");bu(R.DebugWatchContext,kne,jWe,50,NH,vl,"3_modification");bu(R.DebugWatchContext,mat,d(10646,null),10,KZ,void 0,"inline",t2t);bu(R.DebugWatchContext,BNi,d(10625,null),20,$2.isEqualTo("expression"),void 0,"inline",lyo);bu(R.DebugWatchContext,qzi,$zi,20,void 0,void 0,"z_commands");bu(R.DebugWatchContext,sat,d(10546,null),200,$Z,void 0,"z_commands");bu(R.DebugWatchContext,nat,d(10544,null),210,Q2,void 0,"z_commands");bu(R.DebugWatchContext,rat,d(10545,null),220,qZ,void 0,"z_commands");bu(R.NotebookVariablesContext,azi,lzi,20,RDe);xt.registerKeybindingRule({id:L6,weight:200,when:C.and(UZ.negate(),C.or(rc.isEqualTo(vE),rc.isEqualTo(q2))),primary:2081});if(et){let a=(i,e,t,o,n)=>{be.appendMenuItem(R.TouchBarContext,{command:{id:i,title:e,icon:{dark:n}},when:C.and(qa,o),group:"9_debug",order:t})};a(iat,jNi,0,vl.toNegated(),In.asFileUri("vs/workbench/contrib/debug/browser/media/continue-tb.png")),a(CV,lat,1,vl.toNegated(),In.asFileUri("vs/workbench/contrib/debug/browser/media/run-with-debugging-tb.png")),a(s$,Mne,0,ca.isEqualTo("stopped"),In.asFileUri("vs/workbench/contrib/debug/browser/media/continue-tb.png")),a(D6,Lne,1,C.and(vl,C.and(ca.isEqualTo("running"),j2.toNegated())),In.asFileUri("vs/workbench/contrib/debug/browser/media/pause-tb.png")),a(o$,_ne,2,vl,In.asFileUri("vs/workbench/contrib/debug/browser/media/stepover-tb.png")),a(n$,Dne,3,vl,In.asFileUri("vs/workbench/contrib/debug/browser/media/stepinto-tb.png")),a(r$,Rne,4,vl,In.asFileUri("vs/workbench/contrib/debug/browser/media/stepout-tb.png")),a(i$,Tne,5,vl,In.asFileUri("vs/workbench/contrib/debug/browser/media/restart-tb.png")),a(V_,l$,6,vl,In.asFileUri("vs/workbench/contrib/debug/browser/media/stop-tb.png"))}be.appendMenuItem(R.EditorTitle,{submenu:R.EditorTitleRun,isSplitButton:{togglePrimaryAction:!0},title:P(10627,"Run or Debug..."),icon:oyo,group:"navigation",order:-1});be.appendMenuItem(R.MenubarMainMenu,{submenu:R.MenubarDebugMenu,title:{...P(10629,"Run"),mnemonicTitle:d(10619,null)},order:6,when:qo.negate()});be.appendMenuItem(R.MenubarDebugMenu,{group:"1_debug",command:{id:CV,title:d(10611,null)},order:1,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"1_debug",command:{id:iat,title:d(10610,null)},order:2,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"1_debug",command:{id:V_,title:d(10615,null),precondition:vl},order:3,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"1_debug",command:{id:i$,title:d(10609,null),precondition:vl},order:4,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"2_configuration",command:{id:Rve,title:d(10604,null)},order:2,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"3_step",command:{id:o$,title:d(10614,null),precondition:ca.isEqualTo("stopped")},order:1,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"3_step",command:{id:n$,title:d(10612,null),precondition:ca.isEqualTo("stopped")},order:2,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"3_step",command:{id:r$,title:d(10613,null),precondition:ca.isEqualTo("stopped")},order:3,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"3_step",command:{id:s$,title:d(10605,null),precondition:ca.isEqualTo("stopped")},order:4,when:qa});be.appendMenuItem(R.MenubarNewBreakpointMenu,{group:"1_breakpoints",command:{id:eat,title:d(10606,null)},order:2,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"4_new_breakpoint",title:d(10608,null),submenu:R.MenubarNewBreakpointMenu,order:2,when:qa});be.appendMenuItem(R.DebugDisassemblyContext,{group:"1_edit",command:{id:R$t,title:A$t},order:2,when:qa});be.appendMenuItem(R.DebugDisassemblyContext,{group:"3_breakpoints",command:{id:L$t,title:d(10616,null)},order:2,when:qa});be.appendMenuItem(R.MenubarDebugMenu,{group:"z_install",command:{id:"debug.installAdditionalDebuggers",title:d(10607,null)},order:1});var Ekn=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:yAt,title:P(10588,"Debug Console"),icon:PLi,ctorDescriptor:new Vt(Qc,[yAt,{mergeViewWithContainerWhenSingleView:!0}]),storageId:yAt,hideIfEmpty:!0,order:2},1,{doNotRegisterOpenCommand:!0});oe.as(Kn.ViewsRegistry).registerViews([{id:$d,name:P(10588,"Debug Console"),containerIcon:PLi,canToggleVisibility:!0,canMoveView:!0,when:qa,ctorDescriptor:new Vt(N1),openCommandActionDescriptor:{id:"workbench.debug.action.toggleRepl",mnemonicTitle:d(10617,null),keybindings:{primary:3127},order:2}}],Ekn);var LKe=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:$g,title:P(10628,"Run and Debug"),openCommandActionDescriptor:{id:$g,mnemonicTitle:d(10618,null),keybindings:{primary:3106},order:3},ctorDescriptor:new Vt(hKe),icon:ALi,alwaysUseContainerInfo:!0,order:3},0),MKe=oe.as(Kn.ViewsRegistry);MKe.registerViews([{id:q2,name:P(10645,"Variables"),containerIcon:JIo,ctorDescriptor:new Vt(QWe),order:10,weight:40,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusVariablesView"},when:aN.isEqualTo("default")}],LKe);MKe.registerViews([{id:vE,name:P(10647,"Watch"),containerIcon:ZIo,ctorDescriptor:new Vt(vKe),order:20,weight:10,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusWatchView"},when:aN.isEqualTo("default")}],LKe);MKe.registerViews([{id:O3,name:P(10547,"Call Stack"),containerIcon:eyo,ctorDescriptor:new Vt(oKe),order:30,weight:30,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusCallStackView"},when:aN.isEqualTo("default")}],LKe);MKe.registerViews([{id:bE,name:P(10543,"Breakpoints"),containerIcon:YKt,ctorDescriptor:new Vt(zWe),order:40,weight:20,canToggleVisibility:!0,canMoveView:!0,focusCommand:{id:"workbench.debug.action.focusBreakpointsView"},when:C.or(F3,aN.isEqualTo("default"),wAt)}],LKe);MKe.registerViews([{id:lL.ID,name:lL.LABEL,containerIcon:ALi,ctorDescriptor:new Vt(lL),order:1,weight:40,canToggleVisibility:!0,when:aN.isEqualTo("simple")}],LKe);MKe.registerViews([{id:Kpe,name:P(10603,"Loaded Scripts"),containerIcon:tyo,ctorDescriptor:new Vt(gKe),order:35,weight:5,canToggleVisibility:!0,canMoveView:!0,collapsed:!0,when:C.and(yXe,aN.isEqualTo("default"))}],LKe);oe.as(en.EditorPane).registerEditorPane(os.create($_,IAt,d(10593,null)),[new Vt(UM)]);var Tkn=oe.as($t.Configuration);Tkn.registerConfiguration({id:"debug",order:20,title:d(10587,null),type:"object",properties:{"debug.showVariableTypes":{type:"boolean",description:d(10637,null),default:!1},"debug.allowBreakpointsEverywhere":{type:"boolean",description:d(10541,null),default:!1},"debug.gutterMiddleClickAction":{type:"string",enum:["logpoint","conditionalBreakpoint","triggeredBreakpoint","none"],description:d(10595,null),enumDescriptions:[d(10574,null),d(10573,null),d(10576,null),d(10575,null)],default:"logpoint"},"debug.openExplorerOnEnd":{type:"boolean",description:d(10623,null),default:!1},"debug.closeReadonlyTabsOnEnd":{type:"boolean",description:d(10549,null),default:!1},"debug.inlineValues":{type:"string",enum:["on","off","auto"],description:d(10597,null),enumDescriptions:[d(10600,null),d(10599,null),d(10598,null)],default:"auto"},"debug.toolBarLocation":{enum:["floating","docked","commandCenter","hidden"],markdownDescription:d(10644,null,"`#window.commandCenter#`"),default:"floating",markdownEnumDescriptions:[d(10591,null),d(10590,null),d(10589,null),d(10592,null)]},"debug.showInStatusBar":{enum:["never","always","onFirstSessionStart"],enumDescriptions:[d(10620,null),d(10542,null),d(10621,null)],description:d(10635,null),default:"onFirstSessionStart"},"debug.internalConsoleOptions":OAt,"debug.console.closeOnEnd":{type:"boolean",description:d(10561,null),default:!1},"debug.terminal.clearBeforeReusing":{type:"boolean",description:d(10584,null),default:!1},"debug.openDebug":{enum:["neverOpen","openOnSessionStart","openOnFirstSessionStart","openOnDebugBreak"],default:"openOnDebugBreak",description:d(10622,null)},"debug.showSubSessionsInToolBar":{type:"boolean",description:d(10636,null),default:!1},"debug.console.fontSize":{type:"number",description:d(10564,null),default:et?12:14},"debug.console.fontFamily":{type:"string",description:d(10563,null),default:"default"},"debug.console.lineHeight":{type:"number",description:d(10566,null),default:0},"debug.console.wordWrap":{type:"boolean",description:d(10568,null),default:!0},"debug.console.historySuggestions":{type:"boolean",description:d(10565,null),default:!0},"debug.console.collapseIdenticalLines":{type:"boolean",description:d(10562,null),default:!0},"debug.console.acceptSuggestionOnEnter":{enum:["off","on"],description:d(10560,null),default:"off"},"debug.console.maximumLines":{type:"number",description:d(10567,null),default:1e4},launch:{type:"object",description:d(10602,null),default:{configurations:[],compounds:[]},$ref:mU,disallowConfigurationDefault:!0},"debug.focusWindowOnBreak":{type:"boolean",description:d(10572,null),default:!0},"debug.focusEditorOnBreak":{type:"boolean",description:d(10571,null),default:!0},"debug.onTaskErrors":{enum:["debugAnyway","showErrors","prompt","abort"],enumDescriptions:[d(10585,null),d(10633,null),d(10624,null),d(10548,null)],description:d(10579,null),default:"prompt"},"debug.showBreakpointsInOverviewRuler":{type:"boolean",description:d(10632,null),default:!1},"debug.breakpointsView.presentation":{type:"string",description:d(10556,null),enum:["tree","list"],default:"list"},"debug.showInlineBreakpointCandidates":{type:"boolean",description:d(10634,null),default:!0},"debug.saveBeforeStart":{description:d(10580,null),enum:["allEditorsInActiveGroup","nonUntitledEditorsInActiveGroup","none"],enumDescriptions:[d(10581,null),d(10583,null),d(10582,null)],default:"allEditorsInActiveGroup",scope:6},"debug.confirmOnExit":{description:d(10557,null),type:"string",enum:["never","always"],enumDescriptions:[d(10559,null),d(10558,null)],default:"never"},"debug.disassemblyView.showSourceCode":{type:"boolean",default:!0,description:d(10569,null)},"debug.autoExpandLazyVariables":{type:"string",enum:["auto","on","off"],default:"auto",enumDescriptions:[d(10553,null),d(10555,null),d(10554,null)],description:d(10552,null)},"debug.enableStatusBarColor":{type:"boolean",description:d(10570,null),default:!0},"debug.hideLauncherWhileDebugging":{type:"boolean",markdownDescription:d(10577,null,"`#debug.toolBarLocation#`"),default:!1},"debug.hideSlowPreLaunchWarning":{type:"boolean",markdownDescription:d(10578,null),default:!1}}});_a.register(new $6t);_a.register(new q6t);_a.register(new j6t);bt(FSe.ID,FSe,vt.AfterRestored);bt(OSe.ID,OSe,vt.AfterRestored);var oKi=class{constructor(i){this._markerService=i;this.label=d(12812,null);this.onDidChange=i.onMarkerChanged}provideDecorations(i){let e=this._markerService.read({resource:i,severities:12}),t;for(let o of e)(!t||o.severity>t.severity)&&(t=o);if(t)return{weight:100*t.severity,bubble:!0,tooltip:e.length===1?d(12814,null):d(12815,null,e.length),letter:e.length<10?e.length.toString():"9+",color:t.severity===8?Ok:tK}}},qut=class{constructor(i,e,t){this._markerService=i;this._decorationsService=e;this._configurationService=t;this._disposables=[this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("problems.visibility")&&this._updateEnablement()})],this._updateEnablement()}dispose(){je(this._provider),je(this._disposables)}_updateEnablement(){let i=this._configurationService.getValue("problems.visibility");if(i===void 0)return;let e=this._configurationService.getValue("problems"),t=i&&e.decorations.enabled;if(t===this._enabled){(!i||!e.decorations.enabled)&&(this._provider?.dispose(),this._provider=void 0);return}if(this._enabled=t,this._enabled){let o=new oKi(this._markerService);this._provider=this._decorationsService.registerDecorationsProvider(o)}else this._provider&&this._provider.dispose()}};qut=I([m(0,ha),m(1,mb),m(2,B)],qut);oe.as($t.Configuration).registerConfiguration({id:"problems",order:101,type:"object",properties:{"problems.decorations.enabled":{markdownDescription:d(12813,null,"`#problems.visibility#`"),type:"boolean",default:!0}}});oe.as(Zi.Workbench).registerWorkbenchContribution(qut,3);function c9t(a,i){return Jn.compare(a.resource,i.resource)}function _kn(a,i){let[e]=a.markers,[t]=i.markers,o=0;return e&&t&&(o=Pl.compare(e.marker.severity,t.marker.severity)),o===0&&(o=a.path.localeCompare(i.path)||a.name.localeCompare(i.name)),o}var ZP=class a{constructor(i,e){this.id=i;this.resource=e;this._markersMap=new dt;this._total=0;this.path=this.resource.fsPath,this.name=Be(this.resource)}get markers(){return this._cachedMarkers||(this._cachedMarkers=[...this._markersMap.values()].flat().sort(a._compareMarkers)),this._cachedMarkers}has(i){return this._markersMap.has(i)}set(i,e){this.delete(i),Rr(e)&&(this._markersMap.set(i,e),this._total+=e.length,this._cachedMarkers=void 0)}delete(i){let e=this._markersMap.get(i);e&&(this._total-=e.length,this._cachedMarkers=void 0,this._markersMap.delete(i))}get total(){return this._total}static _compareMarkers(i,e){return Pl.compare(i.marker.severity,e.marker.severity)||Jn.compare(i.resource,e.resource)||G.compareRangesUsingStarts(i.marker,e.marker)}},gg=class{constructor(i,e,t=[]){this.id=i;this.marker=e;this.relatedInformation=t}get resource(){return this.marker.resource}get range(){return this.marker}get lines(){return this._lines||(this._lines=Hc(this.marker.message)),this._lines}toString(){return JSON.stringify({...this.marker,resource:this.marker.resource.path,relatedInformation:this.relatedInformation.length?this.relatedInformation.map(i=>({...i.raw,resource:i.raw.resource.path})):void 0},null,"	")}},VO=class extends gg{constructor(e,t,o,n,r){super(e.id,e.marker,e.relatedInformation);this.sourceMatches=t;this.codeMatches=o;this.messageMatches=n;this.fileMatches=r}},$V=class{constructor(i,e,t){this.id=i;this.marker=e;this.raw=t}},l9t=class{constructor(){this.cachedSortedResources=void 0;this._onDidChange=new T;this.onDidChange=this._onDidChange.event;this._total=0;this.resourcesByUri=new Map}get resourceMarkers(){return this.cachedSortedResources||(this.cachedSortedResources=[...this.resourcesByUri.values()].sort(_kn)),this.cachedSortedResources}reset(){let i=new Set;for(let e of this.resourcesByUri.values())i.add(e);this.resourcesByUri.clear(),this._total=0,this._onDidChange.fire({removed:i,added:new Set,updated:new Set})}get total(){return this._total}getResourceMarkers(i){return this.resourcesByUri.get(Jn.getComparisonKey(i,!0))??null}setResourceMarkers(i){let e={added:new Set,removed:new Set,updated:new Set};for(let[t,o]of i){if(bge.has(t.scheme))continue;let n=Jn.getComparisonKey(t,!0),r=this.resourcesByUri.get(n);if(Rr(o)){if(r)e.updated.add(r);else{let c=this.id(t.toString());r=new ZP(c,t.with({fragment:null})),this.resourcesByUri.set(n,r),e.added.add(r)}let s=new Set,l=[];for(let c of o){let u=YB.makeKey(c)+c.resource.toString();if(s.has(u))continue;s.add(u);let p=this.id(r.id,u,0,c.resource.toString()),h;c.relatedInformation&&(h=c.relatedInformation.map((g,f)=>new $V(this.id(p,g.resource.toString(),g.startLineNumber,g.startColumn,g.endLineNumber,g.endColumn,f),c,g))),l.push(new gg(p,c,h))}this._total-=r.total,r.set(t,l),this._total+=r.total}else r&&(this._total-=r.total,r.delete(t),this._total+=r.total,r.total===0?(this.resourcesByUri.delete(n),e.removed.add(r)):e.updated.add(r))}this.cachedSortedResources=void 0,(e.added.size||e.removed.size||e.updated.size)&&this._onDidChange.fire(e)}id(...i){return`${Lr(i)}`}dispose(){this._onDidChange.dispose(),this.resourcesByUri.clear()}};var Dkn=/(!)?@source:("[^"]*"|[^\s,]+)(\s*)/i,d9t=class{constructor(i,e,t){this.globalExpression=Eh(i),this.expressionsByRoot=Hp.forUris(o=>t.extUri.ignorePathCasing(o));for(let o of e)this.expressionsByRoot.set(o.root,{root:o.root,expression:Eh(o.expression)})}matches(i){let e=this.expressionsByRoot.findSubstr(i);if(e){let t=lu(e.root,i);if(t&&e.expression(t))return!0}return!!this.globalExpression(i.path)}},XE=class a{constructor(i,e,t,o,n,r){this.filter=i;this.showWarnings=!1;this.showErrors=!1;this.showInfos=!1;i=i.trim(),this.showWarnings=t,this.showErrors=o,this.showInfos=n;let s=Array.isArray(e)?e:[],l=Array.isArray(e)?dvi():e;for(let{expression:f}of s)for(let v of Object.keys(f))v.endsWith("/**")||(f[`${Bh(v,"/")}/**`]=f[v]);let c=[],u=[],p;for(;(p=Dkn.exec(i))!==null;){let f=!!p[1],v=p[2];v.startsWith('"')&&v.endsWith('"')&&(v=v.slice(1,-1)),f?u.push(v.toLowerCase()):c.push(v.toLowerCase()),i=(i.substring(0,p.index)+i.substring(p.index+p[0].length)).trim()}this.includeSourceFilters=c,this.excludeSourceFilters=u;let h=i.startsWith("!");this.textFilter={text:(h?ax(i,"!"):i).trim(),negate:h};let g=dvi();if(i){let f=wM(i,",").map(v=>v.trim()).filter(v=>!!v.length);for(let v of f)if(v.startsWith("!")){let b=ax(v,"!");b&&this.setPattern(l,b)}else this.setPattern(g,v)}this.excludesMatcher=new d9t(l,s,r),this.includesMatcher=new d9t(g,[],r)}static{this._filter=hke}static{this._messageFilter=xh}static EMPTY(i){return new a("",[],!1,!1,!1,i)}matchesSourceFilters(i){if(this.includeSourceFilters.length===0&&this.excludeSourceFilters.length===0)return!0;let e=i?.toLowerCase();return e&&this.excludeSourceFilters.includes(e)?!1:this.includeSourceFilters.length>0?e?this.includeSourceFilters.includes(e):!1:!0}setPattern(i,e){e[0]==="."&&(e="*"+e),i[`**/${e}/**`]=!0,i[`**/${e}`]=!0}};var nm=class{static{this.MARKERS_PANEL_TOGGLE_LABEL=d(12875,null)}static{this.MARKERS_PANEL_SHOW_LABEL=P(12874,"Focus Problems (Errors, Warnings, Infos)")}static{this.PROBLEMS_PANEL_CONFIGURATION_TITLE=d(12861,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL=d(12856,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_VIEW_MODE=d(12862,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_SHOW_CURRENT_STATUS=d(12860,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER=d(12857,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_SEVERITY=d(12859,null)}static{this.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_POSITION=d(12858,null)}static{this.MARKERS_PANEL_TITLE_PROBLEMS=P(12855,"Problems")}static{this.MARKERS_PANEL_NO_PROBLEMS_BUILT=d(12849,null)}static{this.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT=d(12848,null)}static{this.MARKERS_PANEL_NO_PROBLEMS_FILTERS=d(12850,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_MORE_FILTERS=d(12831,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_ERRORS=d(12839,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_WARNINGS=d(12841,null)}static{this.MARKERS_PANEL_FILTER_LABEL_SHOW_INFOS=d(12840,null)}static{this.MARKERS_PANEL_FILTER_LABEL_EXCLUDED_FILES=d(12842,null)}static{this.MARKERS_PANEL_FILTER_LABEL_ACTIVE_FILE=d(12834,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_FILTER=d(12830,null)}static{this.MARKERS_PANEL_ACTION_TOOLTIP_QUICKFIX=d(12832,null)}static{this.MARKERS_PANEL_FILTER_ARIA_LABEL=d(12835,null)}static{this.MARKERS_PANEL_FILTER_PLACEHOLDER=d(12838,null)}static{this.MARKERS_PANEL_FILTER_ERRORS=d(12836,null)}static{this.MARKERS_PANEL_FILTER_WARNINGS=d(12843,null)}static{this.MARKERS_PANEL_FILTER_INFOS=d(12837,null)}static{this.MARKERS_PANEL_SINGLE_ERROR_LABEL=d(12851,null)}static{this.MARKERS_PANEL_MULTIPLE_ERRORS_LABEL=i=>d(12844,null,""+i)}static{this.MARKERS_PANEL_SINGLE_WARNING_LABEL=d(12854,null)}static{this.MARKERS_PANEL_MULTIPLE_WARNINGS_LABEL=i=>d(12847,null,""+i)}static{this.MARKERS_PANEL_SINGLE_INFO_LABEL=d(12852,null)}static{this.MARKERS_PANEL_MULTIPLE_INFOS_LABEL=i=>d(12845,null,""+i)}static{this.MARKERS_PANEL_SINGLE_UNKNOWN_LABEL=d(12853,null)}static{this.MARKERS_PANEL_MULTIPLE_UNKNOWNS_LABEL=i=>d(12846,null,""+i)}static{this.MARKERS_PANEL_AT_LINE_COL_NUMBER=(i,e)=>d(12833,null,""+i,""+e)}static{this.MARKERS_TREE_ARIA_LABEL_RESOURCE=(i,e,t)=>d(12871,null,i,e,t)}static{this.MARKERS_TREE_ARIA_LABEL_MARKER=i=>{let e=i.relatedInformation.length?d(12869,null,i.relatedInformation.length):"";switch(i.marker.severity){case 8:return i.marker.source?d(12863,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(12864,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e);case 4:return i.marker.source?d(12872,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(12873,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,e);case 2:return i.marker.source?d(12865,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(12866,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e);default:return i.marker.source?d(12867,null,i.marker.source,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e,i.marker.source):d(12868,null,i.marker.message,i.marker.startLineNumber,i.marker.startColumn,e)}}}static{this.MARKERS_TREE_ARIA_LABEL_RELATED_INFORMATION=i=>d(12870,null,i.message,i.startLineNumber,i.startColumn,Be(i.resource))}static{this.SHOW_ERRORS_WARNINGS_ACTION_LABEL=d(12829,null)}};var u9t=class extends k{constructor(e,t){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._excludedFiles=om.ShowExcludedFilesFilterContextKey.bindTo(t),this._excludedFiles.set(e.excludedFiles),this._activeFile=om.ShowActiveFileFilterContextKey.bindTo(t),this._activeFile.set(e.activeFile),this._showWarnings=om.ShowWarningsFilterContextKey.bindTo(t),this._showWarnings.set(e.showWarnings),this._showInfos=om.ShowInfoFilterContextKey.bindTo(t),this._showInfos.set(e.showInfos),this._showErrors=om.ShowErrorsFilterContextKey.bindTo(t),this._showErrors.set(e.showErrors),this.filterHistory=e.filterHistory}get excludedFiles(){return!!this._excludedFiles.get()}set excludedFiles(e){this._excludedFiles.get()!==e&&(this._excludedFiles.set(e),this._onDidChange.fire({excludedFiles:!0}))}get activeFile(){return!!this._activeFile.get()}set activeFile(e){this._activeFile.get()!==e&&(this._activeFile.set(e),this._onDidChange.fire({activeFile:!0}))}get showWarnings(){return!!this._showWarnings.get()}set showWarnings(e){this._showWarnings.get()!==e&&(this._showWarnings.set(e),this._onDidChange.fire({showWarnings:!0}))}get showErrors(){return!!this._showErrors.get()}set showErrors(e){this._showErrors.get()!==e&&(this._showErrors.set(e),this._onDidChange.fire({showErrors:!0}))}get showInfos(){return!!this._showInfos.get()}set showInfos(e){this._showInfos.get()!==e&&(this._showInfos.set(e),this._onDidChange.fire({showInfos:!0}))}},VSe=class a extends it{constructor(e){super(a.ID,nm.MARKERS_PANEL_ACTION_TOOLTIP_QUICKFIX,a.CLASS,!1);this.marker=e;this._onShowQuickFixes=this._register(new T);this.onShowQuickFixes=this._onShowQuickFixes.event;this._quickFixes=[]}static{this.ID="workbench.actions.problems.quickfix"}static{this.CLASS="markers-panel-action-quickfix "+q.asClassName(L.lightBulb)}static{this.AUTO_FIX_CLASS=a.CLASS+" autofixable"}get quickFixes(){return this._quickFixes}set quickFixes(e){this._quickFixes=e,this.enabled=this._quickFixes.length>0}autoFixable(e){this.class=e?a.AUTO_FIX_CLASS:a.CLASS}run(){return this._onShowQuickFixes.fire(),Promise.resolve()}},Mse=class extends ts{constructor(e,t,o){super(null,e,{...t,icon:!0,label:!1});this.contextMenuService=o}onClick(e){Kt.stop(e,!0),this.showQuickFixes()}showQuickFixes(){if(!this.element||!this.isEnabled())return;let e=ur(this.element),t=this.action.quickFixes;t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>({x:e.left+10,y:e.top+e.height+4}),getActions:()=>t})}};Mse=I([m(2,Xe)],Mse);var Ose=_,Pse=class{constructor(i,e){this.markersViewModel=i;this.instantiationService=e;this.templateId=Pse.TEMPLATE_ID}static{this.TEMPLATE_ID="severity"}renderTemplate(i){let e=D(i,Ose(".severity")),t=D(e,Ose("")),o=D(i,Ose(".actions"));return{actionBar:new oo(o,{actionViewItemProvider:(r,s)=>r.id===VSe.ID?this.instantiationService.createInstance(Mse,r,s):void 0}),icon:t,elementDisposables:new O}}renderElement(i,e,t){t.elementDisposables.clear();let o=r=>{mr(r)||rf(t.icon,"monaco-table-td").classList.toggle("quickFix",r)};t.icon.title=Pl.toString(i.marker.severity),t.icon.className=`marker-icon ${wt.toString(Pl.toSeverity(i.marker.severity))} codicon ${eE.className(Pl.toSeverity(i.marker.severity))}`,t.actionBar.clear();let n=this.markersViewModel.getViewModel(i);if(n){let r=n.quickFixAction;t.actionBar.push([r],{icon:!0,label:!1}),o(n.quickFixAction.enabled),t.elementDisposables.add(r.onDidChange(({enabled:s})=>o(s))),t.elementDisposables.add(r.onShowQuickFixes(()=>{let s=t.actionBar.viewItems[0];s&&s.showQuickFixes()}))}}disposeTemplate(i){i.elementDisposables.dispose(),i.actionBar.dispose()}};Pse=I([m(1,F)],Pse);var Ase=class{constructor(i,e){this.hoverService=i;this.openerService=e;this.templateId=Ase.TEMPLATE_ID}static{this.TEMPLATE_ID="code"}renderTemplate(i){let e=new O,t=D(i,Ose(".code")),o=e.add(new ul(t));o.element.classList.add("source-label");let n=e.add(new ul(t));n.element.classList.add("code-label");let r=e.add(new Bg(t,{href:"",label:""},{},this.hoverService,this.openerService));return{codeColumn:t,sourceLabel:o,codeLabel:n,codeLink:r,templateDisposable:e}}renderElement(i,e,t){if(t.codeColumn.classList.remove("code-label"),t.codeColumn.classList.remove("code-link"),i.marker.source&&i.marker.code)if(typeof i.marker.code=="string")t.codeColumn.classList.add("code-label"),t.codeColumn.title=`${i.marker.source} (${i.marker.code})`,t.sourceLabel.set(i.marker.source,i.sourceMatches),t.codeLabel.set(i.marker.code,i.codeMatches);else{t.codeColumn.classList.add("code-link"),t.codeColumn.title=`${i.marker.source} (${i.marker.code.value})`,t.sourceLabel.set(i.marker.source,i.sourceMatches);let o=t.templateDisposable.add(new ul(Ose(".code-link-label")));o.set(i.marker.code.value,i.codeMatches),t.codeLink.link={href:i.marker.code.target.toString(!0),title:i.marker.code.target.toString(!0),label:o.element}}else t.codeColumn.title="",t.sourceLabel.set("-")}disposeTemplate(i){i.templateDisposable.dispose()}};Ase=I([m(0,ot),m(1,Je)],Ase);var p9t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="message"}renderTemplate(i){let e=D(i,Ose(".message")),t=new ul(e);return{columnElement:e,highlightedLabel:t}}renderElement(i,e,t){t.columnElement.title=i.marker.message,t.highlightedLabel.set(i.marker.message,i.messageMatches)}disposeTemplate(i){i.highlightedLabel.dispose()}},Nse=class{constructor(i){this.labelService=i;this.templateId=Nse.TEMPLATE_ID}static{this.TEMPLATE_ID="file"}renderTemplate(i){let e=D(i,Ose(".file")),t=new ul(e);t.element.classList.add("file-label");let o=new ul(e);return o.element.classList.add("file-position"),{columnElement:e,fileLabel:t,positionLabel:o}}renderElement(i,e,t){let o=nm.MARKERS_PANEL_AT_LINE_COL_NUMBER(i.marker.startLineNumber,i.marker.startColumn);t.columnElement.title=`${this.labelService.getUriLabel(i.marker.resource,{relative:!1})} ${o}`,t.fileLabel.set(this.labelService.getUriLabel(i.marker.resource,{relative:!0}),i.fileMatches),t.positionLabel.set(o,void 0)}disposeTemplate(i){i.fileLabel.dispose(),i.positionLabel.dispose()}};Nse=I([m(0,nt)],Nse);var m9t=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="source"}renderTemplate(i){let e=D(i,Ose(".source")),t=new ul(e);return{columnElement:e,highlightedLabel:t}}renderElement(i,e,t){t.columnElement.title=i.marker.source??"",t.highlightedLabel.set(i.marker.source??"",i.sourceMatches)}disposeTemplate(i){i.highlightedLabel.dispose()}},nKi=class a{constructor(){this.headerRowHeight=a.HEADER_ROW_HEIGHT}static{this.HEADER_ROW_HEIGHT=24}static{this.ROW_HEIGHT=24}getHeight(i){return a.ROW_HEIGHT}},PKe=class extends k{constructor(e,t,o,n,r,s,l){super();this.container=e;this.markersViewModel=t;this.resourceMarkers=o;this.filterOptions=n;this.instantiationService=s;this.labelService=l;this._itemCount=0;this.table=this.instantiationService.createInstance(Cx,"Markers",this.container,new nKi,[{label:"",tooltip:"",weight:0,minimumWidth:36,maximumWidth:36,templateId:Pse.TEMPLATE_ID,project(f){return f}},{label:d(12816,null),tooltip:"",weight:1,minimumWidth:100,maximumWidth:300,templateId:Ase.TEMPLATE_ID,project(f){return f}},{label:d(12818,null),tooltip:"",weight:4,templateId:p9t.TEMPLATE_ID,project(f){return f}},{label:d(12817,null),tooltip:"",weight:2,templateId:Nse.TEMPLATE_ID,project(f){return f}},{label:d(12819,null),tooltip:"",weight:1,minimumWidth:100,maximumWidth:300,templateId:m9t.TEMPLATE_ID,project(f){return f}}],[this.instantiationService.createInstance(Pse,this.markersViewModel),this.instantiationService.createInstance(Ase),this.instantiationService.createInstance(p9t),this.instantiationService.createInstance(Nse),this.instantiationService.createInstance(m9t)],r);let c=this.table.domNode.querySelector(".monaco-list-rows"),u=U.chain(this._register(new Zn(c,"mouseover")).event,f=>f.map(v=>rf(v.target,"monaco-list-row","monaco-list-rows")).filter(v=>!!v).map(v=>parseInt(v.getAttribute("data-index")))),p=U.map(this._register(new Zn(c,"mouseleave")).event,()=>-1),h=U.latch(U.any(u,p)),g=U.debounce(h,(f,v)=>v,500);this._register(g(f=>{f!==-1&&this.table.row(f)&&this.markersViewModel.onMarkerMouseHover(this.table.row(f))}))}get contextKeyService(){return this.table.contextKeyService}get onContextMenu(){return this.table.onContextMenu}get onDidOpen(){return this.table.onDidOpen}get onDidChangeFocus(){return this.table.onDidChangeFocus}get onDidChangeSelection(){return this.table.onDidChangeSelection}collapseMarkers(){}domFocus(){this.table.domFocus()}filterMarkers(e,t){this.filterOptions=t,this.reset(e)}getFocus(){let e=this.table.getFocus();return e.length>0?[...e.map(t=>this.table.row(t))]:[]}getHTMLElement(){return this.table.getHTMLElement()}getRelativeTop(e){return e?this.table.getRelativeTop(this.table.indexOf(e)):null}getSelection(){let e=this.table.getSelection();return e.length>0?[...e.map(t=>this.table.row(t))]:[]}getVisibleItemCount(){return this._itemCount}isVisible(){return!this.container.classList.contains("hidden")}layout(e,t){this.container.style.height=`${e}px`,this.table.layout(e,t)}reset(e){this.resourceMarkers=e;let t=[];for(let o of this.resourceMarkers)for(let n of o.markers){if(bge.has(n.resource.scheme)||this.filterOptions.excludesMatcher.matches(n.resource))continue;if(this.filterOptions.includesMatcher.matches(n.resource)){t.push(new VO(n));continue}if((this.filterOptions.showErrors&&8===n.marker.severity||this.filterOptions.showWarnings&&4===n.marker.severity||this.filterOptions.showInfos&&2===n.marker.severity)&&this.filterOptions.matchesSourceFilters(n.marker.source)){if(this.filterOptions.textFilter.text){let s=n.marker.source?XE._filter(this.filterOptions.textFilter.text,n.marker.source)??void 0:void 0,l=n.marker.code?XE._filter(this.filterOptions.textFilter.text,typeof n.marker.code=="string"?n.marker.code:n.marker.code.value)??void 0:void 0,c=XE._messageFilter(this.filterOptions.textFilter.text,n.marker.message)??void 0,u=XE._messageFilter(this.filterOptions.textFilter.text,this.labelService.getUriLabel(n.resource,{relative:!0}))??void 0,p=s||l||c||u;(p&&!this.filterOptions.textFilter.negate||!p&&this.filterOptions.textFilter.negate)&&t.push(new VO(n,s,l,c,u));continue}t.push(new VO(n))}}this._itemCount=t.length,this.table.splice(0,Number.POSITIVE_INFINITY,t.sort((o,n)=>{let r=Pl.compare(o.marker.severity,n.marker.severity);return r===0&&(r=c9t(o.marker,n.marker)),r===0&&(r=G.compareRangesUsingStarts(o.marker,n.marker)),r}))}revealMarkers(e,t,o){if(e){let n=this.resourceMarkers.indexOf(e);if(n!==-1)if(this.hasSelectedMarkerFor(e)){let r=this.table.getSelection();this.table.reveal(r[0],o),t&&this.table.setFocus(r)}else this.table.reveal(n,0),t&&(this.table.setFocus([n]),this.table.setSelection([n]))}else t&&(this.table.setSelection([]),this.table.focusFirst())}setAriaLabel(e){this.table.domNode.ariaLabel=e}setMarkerSelection(e,t){this.isVisible()&&(e&&e.length>0?(this.table.setSelection(e.map(o=>this.findMarkerIndex(o))),t&&t.length>0?this.table.setFocus(t.map(o=>this.findMarkerIndex(o))):this.table.setFocus([this.findMarkerIndex(e[0])]),this.table.reveal(this.findMarkerIndex(e[0]))):this.getSelection().length===0&&this.getVisibleItemCount()>0&&(this.table.setSelection([0]),this.table.setFocus([0]),this.table.reveal(0)))}toggleVisibility(e){this.container.classList.toggle("hidden",e)}update(e){for(let t of e){let o=this.resourceMarkers.indexOf(t);this.resourceMarkers.splice(o,1,t)}this.reset(this.resourceMarkers)}updateMarker(e){this.table.rerender()}findMarkerIndex(e){for(let t=0;t<this.table.length;t++)if(this.table.row(t).marker===e.marker)return t;return-1}hasSelectedMarkerFor(e){let t=this.getSelection();return!!(t&&t.length>0&&t[0]instanceof gg&&e.has(t[0].marker.resource))}};PKe=I([m(5,F),m(6,nt)],PKe);var AKe=class{constructor(i){this.labelService=i}getWidgetAriaLabel(){return d(12823,null)}getAriaLabel(i){if(i instanceof ZP){let e=this.labelService.getUriLabel(i.resource,{relative:!0})||i.resource.fsPath;return nm.MARKERS_TREE_ARIA_LABEL_RESOURCE(i.markers.length,i.name,yd(e))}return i instanceof gg||i instanceof VO?nm.MARKERS_TREE_ARIA_LABEL_MARKER(i):i instanceof $V?nm.MARKERS_TREE_ARIA_LABEL_RELATED_INFORMATION(i.raw):null}};AKe=I([m(0,nt)],AKe);var jut=class a{constructor(i){this.markersViewState=i}static{this.LINE_HEIGHT=22}getHeight(i){if(i instanceof gg){let e=this.markersViewState.getViewModel(i);return(!e||e.multiline?i.lines.length:1)*a.LINE_HEIGHT}return a.LINE_HEIGHT}getTemplateId(i){return i instanceof ZP?"rm":i instanceof gg?"m":"ri"}};var h9t=class{constructor(i,e){this.labels=i;this.renderedNodes=new Map;this.disposables=new O;this.templateId="rm";e(this.onDidChangeRenderNodeCount,this,this.disposables)}renderTemplate(i){let e=D(i,_(".resource-label-container")),t=this.labels.create(e,{supportHighlights:!0}),o=D(i,_(".count-badge-wrapper"));return{count:new eb(o,{},VI),resourceLabel:t}}renderElement(i,e,t){let o=i.element,n=i.filterData&&i.filterData.uriMatches||[];t.resourceLabel.setFile(o.resource,{matches:n}),this.updateCount(i,t);let r=this.renderedNodes.get(o)??[];this.renderedNodes.set(o,[...r,t])}disposeElement(i,e,t){let o=this.renderedNodes.get(i.element)??[],n=o.findIndex(r=>t===r);if(n<0)throw new Error("Disposing unknown resource marker");o.length===1?this.renderedNodes.delete(i.element):o.splice(n,1)}disposeTemplate(i){i.resourceLabel.dispose(),i.count.dispose()}onDidChangeRenderNodeCount(i){let e=this.renderedNodes.get(i.element);e&&e.forEach(t=>this.updateCount(i,t))}updateCount(i,e){e.count.setCount(i.children.reduce((t,o)=>t+(o.visible?1:0),0))}dispose(){this.disposables.dispose()}};var NKe=class{constructor(i,e,t,o){this.markersViewState=i;this.hoverService=e;this.instantiationService=t;this.openerService=o;this.templateId="m"}renderTemplate(i){let e=Object.create(null);return e.markerWidget=new sKi(i,this.markersViewState,this.hoverService,this.openerService,this.instantiationService),e}renderElement(i,e,t){t.markerWidget.render(i.element,i.filterData)}disposeTemplate(i){i.markerWidget.dispose()}};NKe=I([m(1,ot),m(2,F),m(3,Je)],NKe);var xOo=Oe("markers-view-multi-line-expanded",L.chevronUp,d(12821,null)),Rkn=Oe("markers-view-multi-line-collapsed",L.chevronDown,d(12820,null)),wOo="problems.action.toggleMultiline",rKi=class extends ts{render(i){super.render(i),this.updateExpandedAttribute()}updateClass(){super.updateClass(),this.updateExpandedAttribute()}updateExpandedAttribute(){this.element?.setAttribute("aria-expanded",`${this._action.class===q.asClassName(xOo)}`)}},sKi=class extends k{constructor(e,t,o,n,r){super();this.parent=e;this.markersViewModel=t;this._hoverService=o;this._openerService=n;this.disposables=this._register(new O);this.actionBar=this._register(new oo(D(e,_(".actions")),{actionViewItemProvider:(s,l)=>s.id===VSe.ID?r.createInstance(Mse,s,l):void 0})),this.iconContainer=D(e,_("")),this.icon=D(this.iconContainer,_("")),this.messageAndDetailsContainer=D(e,_(".marker-message-details-container")),this.messageAndDetailsContainerHover=this._register(this._hoverService.setupManagedHover(yi("mouse"),this.messageAndDetailsContainer,""))}render(e,t){this.actionBar.clear(),this.disposables.clear(),St(this.messageAndDetailsContainer),this.iconContainer.className=`marker-icon ${wt.toString(Pl.toSeverity(e.marker.severity))}`,this.icon.className=`codicon ${eE.className(Pl.toSeverity(e.marker.severity))}`,this.renderQuickfixActionbar(e),this.renderMessageAndDetails(e,t),this.disposables.add($(this.parent,ne.MOUSE_OVER,()=>this.markersViewModel.onMarkerMouseHover(e))),this.disposables.add($(this.parent,ne.MOUSE_LEAVE,()=>this.markersViewModel.onMarkerMouseLeave(e)))}renderQuickfixActionbar(e){let t=this.markersViewModel.getViewModel(e);if(t){let o=t.quickFixAction;this.actionBar.push([o],{icon:!0,label:!1}),this.iconContainer.classList.toggle("quickFix",o.enabled),o.onDidChange(({enabled:n})=>{mr(n)||this.iconContainer.classList.toggle("quickFix",n)},this,this.disposables),o.onShowQuickFixes(()=>{let n=this.actionBar.viewItems[0];n&&n.showQuickFixes()},this,this.disposables)}}renderMultilineActionbar(e,t){let o=this.disposables.add(new oo(D(t,_(".multiline-actions")),{actionViewItemProvider:(l,c)=>{if(l.id===wOo)return new rKi(void 0,l,{...c,icon:!0})}}));this.disposables.add(o);let n=this.markersViewModel.getViewModel(e),r=n&&n.multiline,s=this.disposables.add(new it(wOo));s.enabled=!!n&&e.lines.length>1,s.tooltip=r?d(12824,null):d(12822,null),s.class=q.asClassName(r?xOo:Rkn),s.run=()=>(n&&(n.multiline=!n.multiline),Promise.resolve()),o.push([s],{icon:!0,label:!1})}renderMessageAndDetails(e,t){let{marker:o,lines:n}=e,r=this.markersViewModel.getViewModel(e),s=!r||r.multiline,l=t&&t.lineMatches||[];this.messageAndDetailsContainerHover.update(e.marker.message);let c=[];for(let u=0;u<(s?n.length:1);u++){let p=D(this.messageAndDetailsContainer,_(".marker-message-line")),h=D(p,_(".marker-message"));this.disposables.add(new ul(h)).set(n[u].length>1e3?`${n[u].substring(0,1e3)}...`:n[u],l[u]),n[u]===""&&(p.style.height=`${jut.LINE_HEIGHT}px`),c.push(p)}this.renderDetails(o,t,c[0]),this.renderMultilineActionbar(e,c[0])}renderDetails(e,t,o){if(o.classList.add("details-container"),e.source||e.code){let r=this.disposables.add(new ul(D(o,_(".marker-source")))),s=t&&t.sourceMatches||[];if(r.set(e.source,s),e.code)if(typeof e.code=="string"){let l=this.disposables.add(new ul(D(o,_(".marker-code")))),c=t&&t.codeMatches||[];l.set(e.code,c)}else{let l=_(".marker-code"),c=this.disposables.add(new ul(l)),u=e.code.target.toString(!0);this.disposables.add(new Bg(o,{href:u,label:l,title:u},void 0,this._hoverService,this._openerService));let p=t&&t.codeMatches||[];c.set(e.code.value,p)}}let n=D(o,_("span.marker-line"));n.textContent=nm.MARKERS_PANEL_AT_LINE_COL_NUMBER(e.startLineNumber,e.startColumn)}},OKe=class{constructor(i){this.labelService=i;this.templateId="ri"}renderTemplate(i){let e=Object.create(null);D(i,_(".actions")),D(i,_(".icon")),e.resourceLabel=new ul(D(i,_(".related-info-resource"))),e.lnCol=D(i,_("span.marker-line"));let t=D(i,_("span.related-info-resource-separator"));return t.textContent=":",t.style.paddingRight="4px",e.description=new ul(D(i,_(".marker-description"))),e}renderElement(i,e,t){let o=i.element.raw,n=i.filterData&&i.filterData.uriMatches||[],r=i.filterData&&i.filterData.messageMatches||[],s=this.labelService.getUriLabel(o.resource,{relative:!0});t.resourceLabel.set(Be(o.resource),n,s),t.lnCol.textContent=nm.MARKERS_PANEL_AT_LINE_COL_NUMBER(o.startLineNumber,o.startColumn),t.description.set(o.message,r,o.message)}disposeTemplate(i){i.resourceLabel.dispose(),i.description.dispose()}};OKe=I([m(0,nt)],OKe);var g9t=class{constructor(i){this.options=i}filter(i,e){return i instanceof ZP?this.filterResourceMarkers(i):i instanceof gg?this.filterMarker(i,e):this.filterRelatedInformation(i,e)}filterResourceMarkers(i){if(bge.has(i.resource.scheme)||this.options.excludesMatcher.matches(i.resource))return!1;if(this.options.includesMatcher.matches(i.resource))return!0;if(this.options.textFilter.text&&!this.options.textFilter.negate){let e=XE._filter(this.options.textFilter.text,Be(i.resource));if(e)return{visibility:!0,data:{type:0,uriMatches:e||[]}}}return 2}filterMarker(i,e){if(!(this.options.showErrors&&8===i.marker.severity||this.options.showWarnings&&4===i.marker.severity||this.options.showInfos&&2===i.marker.severity)||!this.options.matchesSourceFilters(i.marker.source))return!1;if(!this.options.textFilter.text)return!0;let o=[];for(let l of i.lines){let c=XE._messageFilter(this.options.textFilter.text,l);o.push(c||[])}let n=i.marker.source?XE._filter(this.options.textFilter.text,i.marker.source):void 0,r=i.marker.code?XE._filter(this.options.textFilter.text,typeof i.marker.code=="string"?i.marker.code:i.marker.code.value):void 0,s=n||r||o.some(l=>l.length>0);return s&&!this.options.textFilter.negate?{visibility:!0,data:{type:1,lineMatches:o,sourceMatches:n||[],codeMatches:r||[]}}:s&&this.options.textFilter.negate&&e===2?!1:!s&&this.options.textFilter.negate&&e===2?!0:e}filterRelatedInformation(i,e){if(!this.options.textFilter.text)return!0;let t=XE._filter(this.options.textFilter.text,Be(i.raw.resource)),o=XE._messageFilter(this.options.textFilter.text,Jo(i.raw.message)),n=t||o;return n&&!this.options.textFilter.negate?{visibility:!0,data:{type:2,uriMatches:t||[],messageMatches:o||[]}}:n&&this.options.textFilter.negate&&e===2?!1:!n&&this.options.textFilter.negate&&e===2?!0:e}},$ut=class extends k{constructor(e,t,o,n,r){super();this.marker=e;this.modelService=t;this.instantiationService=o;this.editorService=n;this.languageFeaturesService=r;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.modelPromise=null;this.codeActionsPromise=null;this._multiline=!0;this._quickFixAction=null;this._register(ee(()=>{this.modelPromise&&this.modelPromise.cancel(),this.codeActionsPromise&&this.codeActionsPromise.cancel()}))}get multiline(){return this._multiline}set multiline(e){this._multiline!==e&&(this._multiline=e,this._onDidChange.fire())}get quickFixAction(){return this._quickFixAction||(this._quickFixAction=this._register(this.instantiationService.createInstance(VSe,this.marker))),this._quickFixAction}showLightBulb(){this.setQuickFixes(!0)}async setQuickFixes(e){let t=await this.getCodeActions(e);this.quickFixAction.quickFixes=t?this.toActions(t):[],this.quickFixAction.autoFixable(!!t&&t.hasAutoFix)}getCodeActions(e){return this.codeActionsPromise!==null?this.codeActionsPromise:this.getModel(e).then(t=>t?(this.codeActionsPromise||(this.codeActionsPromise=Hn(o=>cM(this.languageFeaturesService.codeActionProvider,t,new G(this.marker.range.startLineNumber,this.marker.range.startColumn,this.marker.range.endLineNumber,this.marker.range.endColumn),{type:1,triggerAction:"problems view",filter:{include:Nr.QuickFix}},nh.None,o).then(n=>this._register(n)))),this.codeActionsPromise):null)}toActions(e){return e.validActions.map(t=>li({id:t.action.command?t.action.command.id:t.action.title,label:t.action.title,run:async()=>(await this.openFileAtMarker(this.marker),await this.instantiationService.invokeFunction(v4,t,"fromProblemsView"))}))}openFileAtMarker(e){let{resource:t,selection:o}={resource:e.resource,selection:e.range};return this.editorService.openEditor({resource:t,options:{selection:o,preserveFocus:!0,pinned:!1,revealIfVisible:!0}},tr).then(()=>{})}getModel(e){let t=this.modelService.getModel(this.marker.resource);return t?Promise.resolve(t):e?(this.modelPromise||(this.modelPromise=Hn(o=>new Promise(n=>{this._register(this.modelService.onModelAdded(r=>{ze(r.uri,this.marker.resource)&&n(r)}))}))),this.modelPromise):Promise.resolve(null)}};$ut=I([m(1,_t),m(2,F),m(3,ie),m(4,Jt)],$ut);var FKe=class extends k{constructor(e=!0,t="tree",o,n){super();this.contextKeyService=o;this.instantiationService=n;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onDidChangeViewMode=this._register(new T);this.onDidChangeViewMode=this._onDidChangeViewMode.event;this.markersViewStates=new Map;this.markersPerResource=new Map;this.bulkUpdate=!1;this.hoveredMarker=null;this.hoverDelayer=this._register(new rn(300));this._multiline=!0;this._viewMode="tree";this._multiline=e,this._viewMode=t,this.viewModeContextKey=om.MarkersViewModeContextKey.bindTo(this.contextKeyService),this.viewModeContextKey.set(t)}add(e){if(!this.markersViewStates.has(e.id)){let t=this.instantiationService.createInstance($ut,e),o=[t];t.multiline=this.multiline,t.onDidChange(()=>{this.bulkUpdate||this._onDidChange.fire(e)},this,o),this.markersViewStates.set(e.id,{viewModel:t,disposables:o});let n=this.markersPerResource.get(e.resource.toString())||[];n.push(e),this.markersPerResource.set(e.resource.toString(),n)}}remove(e){let t=this.markersPerResource.get(e.toString())||[];for(let o of t){let n=this.markersViewStates.get(o.id);n&&je(n.disposables),this.markersViewStates.delete(o.id),this.hoveredMarker===o&&(this.hoveredMarker=null)}this.markersPerResource.delete(e.toString())}getViewModel(e){let t=this.markersViewStates.get(e.id);return t?t.viewModel:null}onMarkerMouseHover(e){this.hoveredMarker=e,this.hoverDelayer.trigger(()=>{if(this.hoveredMarker){let t=this.getViewModel(this.hoveredMarker);t&&t.showLightBulb()}})}onMarkerMouseLeave(e){this.hoveredMarker===e&&(this.hoveredMarker=null)}get multiline(){return this._multiline}set multiline(e){let t=!1;this._multiline!==e&&(this._multiline=e,t=!0),this.bulkUpdate=!0,this.markersViewStates.forEach(({viewModel:o})=>{o.multiline!==e&&(o.multiline=e,t=!0)}),this.bulkUpdate=!1,t&&this._onDidChange.fire(void 0)}get viewMode(){return this._viewMode}set viewMode(e){this._viewMode!==e&&(this._viewMode=e,this._onDidChangeViewMode.fire(e),this.viewModeContextKey.set(e))}dispose(){this.markersViewStates.forEach(({disposables:e})=>je(e)),this.markersViewStates.clear(),this.markersPerResource.clear(),super.dispose()}};FKe=I([m(2,X),m(3,F)],FKe);function kOo(a){return yt.map(a.markers,i=>{let e=yt.from(i.relatedInformation),t=yt.map(e,o=>({element:o}));return{element:i,children:t}})}var WKe=class extends lW{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){let S=new $l(Ur.MARKERS_VIEW_STORAGE_ID,g),y=S.getMemento(1,1);super({...e,filterOptions:{ariaLabel:nm.MARKERS_PANEL_FILTER_ARIA_LABEL,placeholder:nm.MARKERS_PANEL_FILTER_PLACEHOLDER,focusContextKey:om.MarkerViewFilterFocusContextKey.key,text:y.filter||"",history:y.filterHistory||[]}},h,u,r,l,o,t,f,v,b);this.editorService=n;this.markerService=s;this.workspaceContextService=c;this.uriIdentityService=p;this.lastSelectedRelativeTop=0;this.currentActiveResource=null;this.onVisibleDisposables=this._register(new O);this.widgetDisposables=this._register(new O);this.currentHeight=0;this.currentWidth=0;this.cachedFilterStats=void 0;this.currentResourceGotAddedToMarkersData=!1;this.onDidChangeVisibility=this.onDidChangeBodyVisibility;this.memento=S,this.panelState=y,this.markersModel=this._register(t.createInstance(l9t)),this.markersViewModel=this._register(t.createInstance(FKe,this.panelState.multiline,this.panelState.viewMode??this.getDefaultViewMode())),this._register(this.onDidChangeVisibility(w=>this.onDidChangeMarkersViewVisibility(w))),this._register(this.markersViewModel.onDidChangeViewMode(w=>this.onDidChangeViewMode())),this.widgetAccessibilityProvider=t.createInstance(AKe),this.widgetIdentityProvider={getId(w){return w.id}},this.setCurrentActiveEditor(),this.filter=new g9t(XE.EMPTY(p)),this.rangeHighlightDecorations=this._register(this.instantiationService.createInstance($W)),this.filters=this._register(new u9t({filterHistory:this.panelState.filterHistory||[],showErrors:this.panelState.showErrors!==!1,showWarnings:this.panelState.showWarnings!==!1,showInfos:this.panelState.showInfos!==!1,excludedFiles:!!this.panelState.useFilesExclude,activeFile:!!this.panelState.activeFile},this.contextKeyService)),this._register(this.configurationService.onDidChangeConfiguration(w=>{this.filters.excludedFiles&&w.affectsConfiguration("files.exclude")&&this.updateFilter()}))}render(){super.render(),this._register(p_({name:"markersView",focusNotifiers:[this,this.filterWidget],focusNextWidget:()=>{this.filterWidget.hasFocus()&&this.focus()},focusPreviousWidget:()=>{this.filterWidget.hasFocus()||this.focusFilter()}}))}renderBody(e){super.renderBody(e),e.classList.add("markers-panel"),this._register($(e,"keydown",o=>{let n=new mi(o);if(!this.keybindingService.mightProducePrintableCharacter(n))return;let r=this.keybindingService.softDispatch(n,n.target);r.kind===1||r.kind===2||this.focusFilter()}));let t=D(e,_(".markers-panel-container"));this.createArialLabelElement(t),this.createMessageBox(t),this.widgetContainer=D(t,_(".widget-container")),this.createWidget(this.widgetContainer),this.updateFilter(),this.renderContent()}getTitle(){return nm.MARKERS_PANEL_TITLE_PROBLEMS.value}layoutBodyContent(e=this.currentHeight,t=this.currentWidth){this.messageBoxContainer&&(this.messageBoxContainer.style.height=`${e}px`),this.widget.layout(e,t),this.currentHeight=e,this.currentWidth=t}focus(){super.focus(),!Na(this.widget.getHTMLElement())&&(this.hasNoProblems()?this.messageBoxContainer.focus():(this.widget.domFocus(),this.widget.setMarkerSelection()))}focusFilter(){this.filterWidget.focus()}updateBadge(e,t){this.filterWidget.updateBadge(e===t||e===0?void 0:d(12828,null,t,e))}checkMoreFilters(){this.filterWidget.checkMoreFilters(!this.filters.showErrors||!this.filters.showWarnings||!this.filters.showInfos||this.filters.excludedFiles||this.filters.activeFile)}clearFilterText(){this.filterWidget.setFilterText("")}showQuickFixes(e){let t=this.markersViewModel.getViewModel(e);t&&t.quickFixAction.run()}openFileAtElement(e,t,o,n){let{resource:r,selection:s}=e instanceof gg?{resource:e.resource,selection:e.range}:e instanceof $V?{resource:e.raw.resource,selection:e.raw}:"marker"in e?{resource:e.marker.resource,selection:e.marker.range}:{resource:null,selection:null};return r&&s?(this.editorService.openEditor({resource:r,options:{selection:s,preserveFocus:t,pinned:n,revealIfVisible:!0}},o?En:tr).then(l=>{l&&t?this.rangeHighlightDecorations.highlightRange({resource:r,range:s},l.getControl()):this.rangeHighlightDecorations.removeHighlightRange()}),!0):(this.rangeHighlightDecorations.removeHighlightRange(),!1)}refreshPanel(e){if(this.isVisible()){let t=this.widget.getSelection().length>0;e?e instanceof gg?this.widget.updateMarker(e):e.added.size||e.removed.size||this.filters.activeFile?this.resetWidget():this.widget.update([...e.updated]):this.resetWidget(),t&&this.widget.setMarkerSelection(),this.cachedFilterStats=void 0;let{total:o,filtered:n}=this.getFilterStats();this.toggleVisibility(o===0||n===0),this.renderMessage(),this.updateBadge(o,n),this.checkMoreFilters()}}onDidChangeViewState(e){this.refreshPanel(e)}resetWidget(){this.widget.reset(this.getResourceMarkers())}updateFilter(){this.filter.options=new XE(this.filterWidget.getFilterText(),this.getFilesExcludeExpressions(),this.filters.showWarnings,this.filters.showErrors,this.filters.showInfos,this.uriIdentityService),this.widget.filterMarkers(this.getResourceMarkers(),this.filter.options),this.cachedFilterStats=void 0;let{total:e,filtered:t}=this.getFilterStats();this.toggleVisibility(e===0||t===0),this.renderMessage(),this.updateBadge(e,t),this.checkMoreFilters()}getDefaultViewMode(){switch(this.configurationService.getValue("problems.defaultViewMode")){case"table":return"table";case"tree":return"tree";default:return"tree"}}getFilesExcludeExpressions(){if(!this.filters.excludedFiles)return[];let e=this.workspaceContextService.getWorkspace().folders;return e.length?e.map(t=>({root:t.uri,expression:this.getFilesExclude(t.uri)})):this.getFilesExclude()}getFilesExclude(e){return io(this.configurationService.getValue("files.exclude",{resource:e}))||{}}getResourceMarkers(){if(!this.filters.activeFile)return this.markersModel.resourceMarkers;let e=[];if(this.currentActiveResource){let t=this.markersModel.getResourceMarkers(this.currentActiveResource);t&&(e=[t])}return e}createMessageBox(e){this.messageBoxContainer=D(e,_(".message-box-container")),this.messageBoxContainer.setAttribute("aria-labelledby","markers-panel-arialabel")}createArialLabelElement(e){this.ariaLabelElement=D(e,_("")),this.ariaLabelElement.setAttribute("id","markers-panel-arialabel")}createWidget(e){this.widget=this.markersViewModel.viewMode==="table"?this.createTable(e):this.createTree(e),this.widgetDisposables.add(this.widget);let t=om.MarkerFocusContextKey.bindTo(this.widget.contextKeyService),o=om.RelatedInformationFocusContextKey.bindTo(this.widget.contextKeyService);this.widgetDisposables.add(this.widget.onDidChangeFocus(n=>{t.set(n.elements.some(r=>r instanceof gg)),o.set(n.elements.some(r=>r instanceof $V))})),this.widgetDisposables.add(U.debounce(this.widget.onDidOpen,(n,r)=>r,75,!0)(n=>{this.openFileAtElement(n.element,!!n.editorOptions.preserveFocus,n.sideBySide,!!n.editorOptions.pinned)})),this.widgetDisposables.add(U.any(this.widget.onDidChangeSelection,this.widget.onDidChangeFocus)(()=>{let n=[...this.widget.getSelection(),...this.widget.getFocus()];for(let r of n)r instanceof gg&&this.markersViewModel.getViewModel(r)?.showLightBulb()})),this.widgetDisposables.add(this.widget.onContextMenu(this.onContextMenu,this)),this.widgetDisposables.add(this.widget.onDidChangeSelection(this.onSelected,this))}createTable(e){return this.instantiationService.createInstance(PKe,D(e,_(".markers-table-container")),this.markersViewModel,this.getResourceMarkers(),this.filter.options,{accessibilityProvider:this.widgetAccessibilityProvider,dnd:this.instantiationService.createInstance(d8,o=>o instanceof VO?$L(o.resource,o.range):null),horizontalScrolling:!1,identityProvider:this.widgetIdentityProvider,multipleSelectionSupport:!0,selectionNavigation:!0})}createTree(e){let t=new Ig,o=this.instantiationService.createInstance(jl,this),n=new jut(this.markersViewModel),r=[this.instantiationService.createInstance(h9t,o,t.event),this.instantiationService.createInstance(NKe,this.markersViewModel),this.instantiationService.createInstance(OKe)],s=this.instantiationService.createInstance(Qut,"MarkersView",D(e,_(".tree-container.show-file-icons")),n,r,{filter:this.filter,accessibilityProvider:this.widgetAccessibilityProvider,identityProvider:this.widgetIdentityProvider,dnd:this.instantiationService.createInstance(Yut),expandOnlyOnTwistieClick:l=>l instanceof gg&&l.relatedInformation.length>0,overrideStyles:this.getLocationBasedColors().listOverrideStyles,selectionNavigation:!0,multipleSelectionSupport:!0});return t.input=s.onDidChangeRenderNodeCount,s}collapseAll(){this.widget.collapseMarkers()}setMultiline(e){this.markersViewModel.multiline=e}setViewMode(e){this.markersViewModel.viewMode=e}onDidChangeMarkersViewVisibility(e){if(this.onVisibleDisposables.clear(),e){for(let t of this.reInitialize())this.onVisibleDisposables.add(t);this.refreshPanel()}}reInitialize(){let e=[],t=o=>this.markerService.read({resource:o,severities:14});return this.markersModel.setResourceMarkers(Lf(t(),c9t).map(o=>[o[0].resource,o])),e.push(U.debounce(this.markerService.onMarkerChanged,(o,n)=>(o=o||new dt,n.forEach(r=>o.set(r,r)),o),64)(o=>{this.markersModel.setResourceMarkers([...o.values()].map(n=>[n,t(n)]))})),e.push(U.any(this.markersModel.onDidChange,this.editorService.onDidActiveEditorChange)(o=>{o?this.onDidChangeModel(o):this.onActiveEditorChanged()})),e.push(ee(()=>this.markersModel.reset())),this.markersModel.resourceMarkers.forEach(o=>o.markers.forEach(n=>this.markersViewModel.add(n))),e.push(this.markersViewModel.onDidChange(o=>this.onDidChangeViewState(o))),e.push(ee(()=>this.markersModel.resourceMarkers.forEach(o=>this.markersViewModel.remove(o.resource)))),e.push(this.filters.onDidChange(o=>{o.activeFile?this.refreshPanel():(o.excludedFiles||o.showWarnings||o.showErrors||o.showInfos)&&this.updateFilter()})),e.push(this.filterWidget.onDidChangeFilterText(o=>this.updateFilter())),e.push(ee(()=>{this.cachedFilterStats=void 0})),e.push(ee(()=>this.rangeHighlightDecorations.removeHighlightRange())),e}onDidChangeModel(e){let t=[...e.added,...e.removed,...e.updated],o=[];for(let{resource:n}of t){this.markersViewModel.remove(n);let r=this.markersModel.getResourceMarkers(n);if(r)for(let s of r.markers)this.markersViewModel.add(s);o.push(n)}this.currentResourceGotAddedToMarkersData=this.currentResourceGotAddedToMarkersData||this.isCurrentResourceGotAddedToMarkersData(o),this.refreshPanel(e),this.updateRangeHighlights(),this.currentResourceGotAddedToMarkersData&&(this.autoReveal(),this.currentResourceGotAddedToMarkersData=!1)}onDidChangeViewMode(){this.widgetContainer&&this.widget&&(this.widgetContainer.textContent="",this.widgetDisposables.clear());let e=new Set;for(let o of this.widget.getSelection())o instanceof ZP?o.markers.forEach(n=>e.add(n)):(o instanceof gg||o instanceof VO)&&e.add(o);let t=new Set;for(let o of this.widget.getFocus())(o instanceof gg||o instanceof VO)&&t.add(o);this.createWidget(this.widgetContainer),this.refreshPanel(),e.size>0&&(this.widget.setMarkerSelection(Array.from(e),Array.from(t)),this.widget.domFocus())}isCurrentResourceGotAddedToMarkersData(e){let t=this.currentActiveResource;return!t||this.getResourceForCurrentActiveResource()?!1:e.some(n=>n.toString()===t.toString())}onActiveEditorChanged(){this.setCurrentActiveEditor(),this.filters.activeFile&&this.refreshPanel(),this.autoReveal()}setCurrentActiveEditor(){let e=this.editorService.activeEditor;this.currentActiveResource=e?po.getOriginalUri(e,{supportSideBySide:1})??null:null}onSelected(){let e=this.widget.getSelection();e&&e.length>0&&(this.lastSelectedRelativeTop=this.widget.getRelativeTop(e[0])||0)}hasNoProblems(){let{total:e,filtered:t}=this.getFilterStats();return e===0||t===0}renderContent(){this.cachedFilterStats=void 0,this.resetWidget(),this.toggleVisibility(this.hasNoProblems()),this.renderMessage()}renderMessage(){if(!this.messageBoxContainer||!this.ariaLabelElement)return;St(this.messageBoxContainer);let{total:e,filtered:t}=this.getFilterStats();t===0?(this.messageBoxContainer.style.display="block",this.messageBoxContainer.setAttribute("tabIndex","0"),this.filters.activeFile?this.renderFilterMessageForActiveFile(this.messageBoxContainer):e>0?this.renderFilteredByFilterMessage(this.messageBoxContainer):this.renderNoProblemsMessage(this.messageBoxContainer)):(this.messageBoxContainer.style.display="none",t===e?this.setAriaLabel(d(12826,null,e)):this.setAriaLabel(d(12827,null,t,e)),this.messageBoxContainer.removeAttribute("tabIndex"))}renderFilterMessageForActiveFile(e){this.currentActiveResource&&this.markersModel.getResourceMarkers(this.currentActiveResource)?this.renderFilteredByFilterMessage(e):this.renderNoProblemsMessageForActiveFile(e)}renderFilteredByFilterMessage(e){let t=D(e,_("span"));t.textContent=nm.MARKERS_PANEL_NO_PROBLEMS_FILTERS;let o=D(e,_("a.messageAction"));o.textContent=d(12825,null),o.setAttribute("tabIndex","0");let n=D(e,_("span"));n.textContent=".",Yo(o,ne.CLICK,()=>this.clearFilters()),Yo(o,ne.KEY_DOWN,r=>{(r.equals(3)||r.equals(10))&&(this.clearFilters(),r.stopPropagation())}),this.setAriaLabel(nm.MARKERS_PANEL_NO_PROBLEMS_FILTERS)}renderNoProblemsMessageForActiveFile(e){let t=D(e,_("span"));t.textContent=nm.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT,this.setAriaLabel(nm.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT)}renderNoProblemsMessage(e){let t=D(e,_("span"));t.textContent=nm.MARKERS_PANEL_NO_PROBLEMS_BUILT,this.setAriaLabel(nm.MARKERS_PANEL_NO_PROBLEMS_BUILT)}setAriaLabel(e){this.widget.setAriaLabel(e),this.ariaLabelElement.setAttribute("aria-label",e)}clearFilters(){this.filterWidget.setFilterText(""),this.filters.excludedFiles=!1,this.filters.showErrors=!0,this.filters.showWarnings=!0,this.filters.showInfos=!0}autoReveal(e=!1){if(this.filters.activeFile)return;let t=this.configurationService.getValue("problems.autoReveal");if(typeof t=="boolean"&&t){let o=this.getResourceForCurrentActiveResource();this.widget.revealMarkers(o,e,this.lastSelectedRelativeTop)}}getResourceForCurrentActiveResource(){return this.currentActiveResource?this.markersModel.getResourceMarkers(this.currentActiveResource):null}updateRangeHighlights(){this.rangeHighlightDecorations.removeHighlightRange(),Na(this.widget.getHTMLElement())&&this.highlightCurrentSelectedMarkerRange()}highlightCurrentSelectedMarkerRange(){let e=this.widget.getSelection()??[];if(e.length!==1)return;let t=e[0];t instanceof gg&&this.rangeHighlightDecorations.highlightRange(t)}onContextMenu(e){let t=e.element;t&&(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,menuId:R.ProblemsPanelContext,contextKeyService:this.widget.contextKeyService,getActions:()=>this.getMenuActions(t),getActionViewItem:o=>{let n=this.keybindingService.lookupKeybinding(o.id);if(n)return new ts(o,o,{label:!0,keybinding:n.getLabel()})},onHide:o=>{o&&this.widget.domFocus()}}))}getMenuActions(e){let t=[];if(e instanceof gg){let o=this.markersViewModel.getViewModel(e);if(o){let n=o.quickFixAction.quickFixes;n.length&&(t.push(...n),t.push(new oi))}}return t}getFocusElement(){return this.widget.getFocus()[0]??void 0}getFocusedSelectedElements(){let e=this.getFocusElement();if(!e)return null;let t=this.widget.getSelection();if(t.includes(e)){let o=[];for(let n of t)n&&o.push(n);return o}else return[e]}getAllResourceMarkers(){return this.markersModel.resourceMarkers}getFilterStats(){return this.cachedFilterStats||(this.cachedFilterStats={total:this.markersModel.total,filtered:this.widget?.getVisibleItemCount()??0}),this.cachedFilterStats}toggleVisibility(e){this.widget.toggleVisibility(e),this.layoutBodyContent()}saveState(){this.panelState.filter=this.filterWidget.getFilterText(),this.panelState.filterHistory=this.filters.filterHistory,this.panelState.showErrors=this.filters.showErrors,this.panelState.showWarnings=this.filters.showWarnings,this.panelState.showInfos=this.filters.showInfos,this.panelState.useFilesExclude=this.filters.excludedFiles,this.panelState.activeFile=this.filters.activeFile,this.panelState.multiline=this.markersViewModel.multiline,this.panelState.viewMode=this.markersViewModel.viewMode,this.memento.saveMemento(),super.saveState()}dispose(){super.dispose()}};WKe=I([m(1,F),m(2,ji),m(3,ie),m(4,B),m(5,ha),m(6,X),m(7,Ae),m(8,Xe),m(9,gt),m(10,Le),m(11,de),m(12,Je),m(13,Pe),m(14,ot)],WKe);var Qut=class extends hf{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,o,n,r,s,l,c,p);this.container=t;this.visibilityContextKey=om.MarkersTreeVisibilityContextKey.bindTo(l)}collapseMarkers(){this.collapseAll(),this.setSelection([]),this.setFocus([]),this.getHTMLElement().focus(),this.focusFirst()}filterMarkers(){this.refilter()}getVisibleItemCount(){let e=0,t=this.getNode();for(let o of t.children)for(let n of o.children)o.visible&&n.visible&&e++;return e}isVisible(){return!this.container.classList.contains("hidden")}toggleVisibility(e){this.visibilityContextKey.set(!e),this.container.classList.toggle("hidden",e)}reset(e){this.setChildren(null,yt.map(e,t=>({element:t,children:kOo(t)})))}revealMarkers(e,t,o){e?this.hasElement(e)&&(!this.isCollapsed(e)&&this.hasSelectedMarkerFor(e)?(this.reveal(this.getSelection()[0],o),t&&this.setFocus(this.getSelection())):(this.expand(e),this.reveal(e,0),t&&(this.setFocus([e]),this.setSelection([e])))):t&&(this.setSelection([]),this.focusFirst())}setAriaLabel(e){this.ariaLabel=e}setMarkerSelection(e,t){if(this.isVisible()){if(e&&e.length>0)this.setSelection(e.map(o=>this.findMarkerNode(o))),t&&t.length>0?this.setFocus(t.map(o=>this.findMarkerNode(o))):this.setFocus([this.findMarkerNode(e[0])]),this.reveal(this.findMarkerNode(e[0]));else if(this.getSelection().length===0){let o=this.firstVisibleElement,n=o?o instanceof ZP?o.markers[0]:o instanceof gg?o:void 0:void 0;n&&(this.setSelection([n]),this.setFocus([n]),this.reveal(n))}}}update(e){for(let t of e)this.hasElement(t)&&(this.setChildren(t,kOo(t)),this.rerender(t))}updateMarker(e){this.rerender(e)}findMarkerNode(e){for(let t of this.getNode().children)for(let o of t.children)if(o.element instanceof gg&&o.element.marker===e.marker)return o.element;return null}hasSelectedMarkerFor(e){let t=this.getSelection();return!!(t&&t.length>0&&t[0]instanceof gg&&e.has(t[0].marker.resource))}dispose(){super.dispose()}layout(e,t){this.container.style.height=`${e}px`,super.layout(e,t)}};Qut=I([m(5,F),m(6,X),m(7,Co),m(8,Pe),m(9,B)],Qut);var Yut=class extends d8{constructor(i){super(e=>e instanceof VO?$L(e.resource,e.range):e instanceof ZP?e.resource:e instanceof gg?$L(e.resource,e.range):e instanceof $V?$L(e.raw.resource,e.raw):null,i)}onWillDragElements(i,e){let t=i.map(o=>{if(o instanceof $V||o instanceof gg)return o.marker;if(o instanceof ZP)return{uri:o.resource}}).filter(so);t.length&&kYi(t,e)}};Yut=I([m(0,F)],Yut);var Xut=class{constructor(i,e,t){this._markerService=i;this._labelService=e;this._editorService=t;this.type="pickerPick";this.label=d(12808,null);this.icon=L.error;this.ordinal=-100}isEnabled(i){return!!i.attachmentCapabilities.supportsProblemAttachments}asPicker(){return{placeholder:d(12809,null),picks:ohe(async(i,e)=>this.getPicksForQuery(i))}}getPicksForQuery(i){let e=this._markerService.read({severities:14}),t=Lf(e,(c,u)=>Jn.compare(c.resource,u.resource)),o=po.getCanonicalUri(this._editorService.activeEditor),n=t.sort((c,u)=>{let p=c[0].resource,h=u[0].resource;if(o){let g=Jn.isEqual(p,o),f=Jn.isEqual(h,o);if(g&&!f)return-1;if(!g&&f)return 1}return Jn.compare(p,h)}),r=new Set,s=[],l=0;for(let c of n){let u=c[0].resource,p=o&&Jn.isEqual(u,o),h=this._labelService.getUriLabel(u,{relative:!0}),g=p?`${h} (current file)`:h;s.push({type:"separator",label:g});for(let f of c)l++,r.add(f.severity),s.push({label:f.message,description:d(12811,null,""+f.startLineNumber,""+f.startColumn),asAttachment(){return nN.toEntry(nN.fromMarker(f))}})}return s.unshift({label:d(12810,null),asAttachment(){return nN.toEntry({filterSeverity:2})}}),s}};Xut=I([m(0,ha),m(1,nt),m(2,ie)],Xut);var BSe=class extends k{static{this.ID="workbench.contrib.chat.markerChatContextContribution"}constructor(i,e){super(),this._store.add(i.registerChatContextItem(e.createInstance(Xut)))}};BSe=I([m(0,iI),m(1,F)],BSe);var f9t=class{constructor(){this.type="help";this.priority=105;this.name="problemsFilter";this.when=om.MarkerViewFilterFocusContextKey}getProvider(i){return new aKi(i.get(Le))}},aKi=class extends k{constructor(e){super();this._keybindingService=e;this.id="problemsFilterHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}provideContent(){let e=[];return e.push(d(12778,null)),e.push(d(12769,null)),e.push(""),e.push(d(12803,null)),e.push(d(12802,null)),e.push(""),e.push(d(12780,null)),e.push(d(12779,null)),e.push(""),e.push(d(12772,null)),e.push(d(12770,null)),e.push(d(12771,null)),e.push(""),e.push(d(12777,null)),e.push(d(12773,null)),e.push(d(12774,null)),e.push(d(12775,null)),e.push(d(12776,null)),e.push(""),e.push(d(12806,null)),e.push(d(12807,null)),e.push(d(12805,null)),e.push(d(12804,null)),e.push(""),e.push(d(12798,null)),e.push(d(12800,null)),e.push(d(12797,null)),e.push(d(12801,null)),e.push(d(12799,null)),e.push(d(12795,null)),e.push(d(12796,null)),e.push(""),e.push(d(12781,null)),e.push(d(12782,null)),e.push(d(12787,null)),e.push(d(12783,null)),e.push(d(12785,null,this._describeCommand("editor.action.marker.nextInFiles")||"F8")),e.push(d(12786,null,this._describeCommand("editor.action.marker.prevInFiles")||"Shift+F8")),e.push(d(12784,null)),e.push(""),e.push(d(12789,null,this._describeCommand("workbench.action.openSettings")||"Ctrl+,")),e.push(d(12791,null)),e.push(d(12793,null)),e.push(d(12788,null)),e.push(d(12794,null)),e.push(d(12792,null)),e.push(d(12790,null)),e.push(""),e.push(d(12768,null)),e.push(d(12767,null)),e.join(`
`)}_describeCommand(e){return this._keybindingService.lookupKeybinding(e)?.getAriaLabel()??void 0}onClose(){}};xt.registerCommandAndKeybindingRule({id:Ur.MARKER_OPEN_ACTION_ID,weight:200,when:C.and(om.MarkerFocusContextKey),primary:3,mac:{primary:3,secondary:[2066]},handler:(a,i)=>{let e=a.get(Gt).getActiveViewWithId(Ur.MARKERS_VIEW_ID);e.openFileAtElement(e.getFocusElement(),!1,!1,!0)}});xt.registerCommandAndKeybindingRule({id:Ur.MARKER_OPEN_SIDE_ACTION_ID,weight:200,when:C.and(om.MarkerFocusContextKey),primary:2051,mac:{primary:259},handler:(a,i)=>{let e=a.get(Gt).getActiveViewWithId(Ur.MARKERS_VIEW_ID);e.openFileAtElement(e.getFocusElement(),!1,!0,!0)}});xt.registerCommandAndKeybindingRule({id:Ur.MARKER_SHOW_PANEL_ID,weight:200,when:void 0,primary:void 0,handler:async(a,i)=>{await a.get(Gt).openView(Ur.MARKERS_VIEW_ID)}});xt.registerCommandAndKeybindingRule({id:Ur.MARKER_SHOW_QUICK_FIX,weight:200,when:om.MarkerFocusContextKey,primary:2137,handler:(a,i)=>{let e=a.get(Gt).getActiveViewWithId(Ur.MARKERS_VIEW_ID),t=e.getFocusElement();t instanceof gg&&e.showQuickFixes(t)}});oe.as($t.Configuration).registerConfiguration({...pNt,properties:{"problems.autoReveal":{description:nm.PROBLEMS_PANEL_CONFIGURATION_AUTO_REVEAL,type:"boolean",default:!0},"problems.defaultViewMode":{description:nm.PROBLEMS_PANEL_CONFIGURATION_VIEW_MODE,type:"string",default:"tree",enum:["table","tree"]},"problems.showCurrentInStatus":{description:nm.PROBLEMS_PANEL_CONFIGURATION_SHOW_CURRENT_STATUS,type:"boolean",default:!1},"problems.sortOrder":{description:nm.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER,type:"string",default:"severity",enum:["severity","position"],enumDescriptions:[nm.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_SEVERITY,nm.PROBLEMS_PANEL_CONFIGURATION_COMPARE_ORDER_POSITION]}}});var EOo=Oe("markers-view-icon",L.warning,d(12740,null)),Lkn=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:Ur.MARKERS_CONTAINER_ID,title:nm.MARKERS_PANEL_TITLE_PROBLEMS,icon:EOo,hideIfEmpty:!0,order:0,ctorDescriptor:new Vt(Qc,[Ur.MARKERS_CONTAINER_ID,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Ur.MARKERS_VIEW_STORAGE_ID,windowEnablement:3},1,{doNotRegisterOpenCommand:!0});oe.as(Kn.ViewsRegistry).registerViews([{id:Ur.MARKERS_VIEW_ID,containerIcon:EOo,name:nm.MARKERS_PANEL_TITLE_PROBLEMS,canToggleVisibility:!0,canMoveView:!0,ctorDescriptor:new Vt(WKe),openCommandActionDescriptor:{id:"workbench.actions.view.problems",mnemonicTitle:d(12741,null),keybindings:{primary:3115},order:0},windowEnablement:3}],Lkn);var TOo=oe.as(Zi.Workbench);W(class extends rr{constructor(){super({id:`workbench.actions.table.${Ur.MARKERS_VIEW_ID}.viewAsTree`,title:d(12765,null),metadata:{description:P(12766,"Show the problems view as a tree.")},menu:{id:R.ViewTitle,when:C.and(C.equals("view",Ur.MARKERS_VIEW_ID),om.MarkersViewModeContextKey.isEqualTo("table")),group:"navigation",order:3},icon:L.listTree,viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.setViewMode("tree")}});W(class extends rr{constructor(){super({id:`workbench.actions.table.${Ur.MARKERS_VIEW_ID}.viewAsTable`,title:d(12763,null),metadata:{description:P(12764,"Show the problems view as a table.")},menu:{id:R.ViewTitle,when:C.and(C.equals("view",Ur.MARKERS_VIEW_ID),om.MarkersViewModeContextKey.isEqualTo("tree")),group:"navigation",order:3},icon:L.listFlat,viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.setViewMode("table")}});W(class extends rr{constructor(){super({id:`workbench.actions.${Ur.MARKERS_VIEW_ID}.toggleErrors`,title:d(12745,null),metadata:{description:P(12755,"Show or hide errors in the problems view.")},category:d(12743,null),toggled:om.ShowErrorsFilterContextKey,menu:{id:qx,group:"1_filter",when:C.equals("view",Ur.MARKERS_VIEW_ID),order:1},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showErrors=!i.filters.showErrors}});W(class extends rr{constructor(){super({id:`workbench.actions.${Ur.MARKERS_VIEW_ID}.toggleWarnings`,title:d(12750,null),metadata:{description:P(12758,"Show or hide warnings in the problems view.")},category:d(12743,null),toggled:om.ShowWarningsFilterContextKey,menu:{id:qx,group:"1_filter",when:C.equals("view",Ur.MARKERS_VIEW_ID),order:2},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showWarnings=!i.filters.showWarnings}});W(class extends rr{constructor(){super({id:`workbench.actions.${Ur.MARKERS_VIEW_ID}.toggleInfos`,title:d(12747,null),category:d(12743,null),toggled:om.ShowInfoFilterContextKey,metadata:{description:P(12757,"Show or hide infos in the problems view.")},menu:{id:qx,group:"1_filter",when:C.equals("view",Ur.MARKERS_VIEW_ID),order:3},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.showInfos=!i.filters.showInfos}});W(class extends rr{constructor(){super({id:`workbench.actions.${Ur.MARKERS_VIEW_ID}.toggleActiveFile`,title:d(12744,null),metadata:{description:P(12754,"Show or hide problems (errors, warnings, info) only from the active file in the problems view.")},category:d(12743,null),toggled:om.ShowActiveFileFilterContextKey,menu:{id:qx,group:"2_filter",when:C.equals("view",Ur.MARKERS_VIEW_ID),order:1},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.activeFile=!i.filters.activeFile}});W(class extends rr{constructor(){super({id:`workbench.actions.${Ur.MARKERS_VIEW_ID}.toggleExcludedFiles`,title:d(12746,null),metadata:{description:P(12756,"Show or hide excluded files in the problems view.")},category:d(12743,null),toggled:om.ShowExcludedFilesFilterContextKey.negate(),menu:{id:qx,group:"2_filter",when:C.equals("view",Ur.MARKERS_VIEW_ID),order:2},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.filters.excludedFiles=!i.filters.excludedFiles}});W(class extends z{constructor(){super({id:"workbench.action.problems.focus",title:nm.MARKERS_PANEL_SHOW_LABEL,category:Fe.View,f1:!0})}async run(a){a.get(Gt).openView(Ur.MARKERS_VIEW_ID,!0)}});var v9t=class extends rr{getSelectedMarkers(i){let e=i.getFocusedSelectedElements()||i.getAllResourceMarkers(),t=[],o=n=>{t.includes(n)||t.push(n)};for(let n of e)n instanceof ZP?n.markers.forEach(o):n instanceof gg&&o(n);return t}};W(class extends v9t{constructor(){let a=C.and(rc.isEqualTo(Ur.MARKERS_VIEW_ID),om.MarkersTreeVisibilityContextKey,om.RelatedInformationFocusContextKey.toNegated());super({id:Ur.MARKER_COPY_ACTION_ID,title:P(12735,"Copy"),menu:{id:R.ProblemsPanelContext,when:a,group:"navigation"},keybinding:{weight:200,primary:2081,when:a},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Bi),t=this.getSelectedMarkers(i);t.length&&await e.writeText(`[${t}]`)}});W(class extends v9t{constructor(){super({id:Ur.MARKER_COPY_MESSAGE_ACTION_ID,title:P(12736,"Copy Message"),menu:{id:R.ProblemsPanelContext,when:om.MarkerFocusContextKey,group:"navigation"},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Bi),t=this.getSelectedMarkers(i);t.length&&await e.writeText(t.map(o=>o.marker.message).join(`
`))}});W(class extends rr{constructor(){super({id:Ur.RELATED_INFORMATION_COPY_MESSAGE_ACTION_ID,title:P(12736,"Copy Message"),menu:{id:R.ProblemsPanelContext,when:om.RelatedInformationFocusContextKey,group:"navigation"},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){let e=a.get(Bi),t=i.getFocusElement();t instanceof $V&&await e.writeText(t.raw.message)}});W(class extends rr{constructor(){super({id:Ur.FOCUS_PROBLEMS_FROM_FILTER,title:d(12738,null),keybinding:{when:om.MarkerViewFilterFocusContextKey,weight:200,primary:2066},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.focus()}});W(class extends rr{constructor(){super({id:Ur.MARKERS_VIEW_FOCUS_FILTER,title:d(12737,null),keybinding:{when:rc.isEqualTo(Ur.MARKERS_VIEW_ID),weight:200,primary:2084},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.focusFilter()}});W(class extends rr{constructor(){super({id:Ur.MARKERS_VIEW_SHOW_MULTILINE_MESSAGE,title:P(12748,"Show message in multiple lines"),category:d(12743,null),menu:{id:R.CommandPalette,when:C.has(xYe(Ur.MARKERS_VIEW_ID))},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.setMultiline(!0)}});W(class extends rr{constructor(){super({id:Ur.MARKERS_VIEW_SHOW_SINGLELINE_MESSAGE,title:P(12749,"Show message in single line"),category:d(12743,null),menu:{id:R.CommandPalette,when:C.has(xYe(Ur.MARKERS_VIEW_ID))},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.setMultiline(!1)}});W(class extends rr{constructor(){super({id:Ur.MARKERS_VIEW_CLEAR_FILTER_TEXT,title:d(12733,null),category:d(12743,null),keybinding:{when:om.MarkerViewFilterFocusContextKey,weight:200,primary:9},viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){i.clearFilterText()}});W(class extends rr{constructor(){super({id:`workbench.actions.treeView.${Ur.MARKERS_VIEW_ID}.collapseAll`,title:d(12734,null),menu:{id:R.ViewTitle,when:C.and(C.equals("view",Ur.MARKERS_VIEW_ID),om.MarkersViewModeContextKey.isEqualTo("tree")),group:"navigation",order:2},icon:L.collapseAll,viewId:Ur.MARKERS_VIEW_ID})}async runInView(a,i){return i.collapseAll()}});W(class extends z{constructor(){super({id:Ur.TOGGLE_MARKERS_VIEW_ACTION_ID,title:nm.MARKERS_PANEL_TOGGLE_LABEL})}async run(a){let i=a.get(Gt);i.isViewVisible(Ur.MARKERS_VIEW_ID)?i.closeView(Ur.MARKERS_VIEW_ID):i.openView(Ur.MARKERS_VIEW_ID,!0)}});var Jut=class extends k{constructor(e,t,o){super();this.markerService=e;this.statusbarService=t;this.configurationService=o;this.markersStatusItem=this._register(this.statusbarService.addEntry(this.getMarkersItem(),"status.problems",0,50));let n=()=>{this.markersStatusItemOff=this.statusbarService.addEntry(this.getMarkersItemTurnedOff(),"status.problemsVisibility",0,49)},r=this.configurationService.getValue("problems.visibility");r||n(),this._register(this.markerService.onMarkerChanged(()=>{this.markersStatusItem.update(this.getMarkersItem())})),this._register(this.configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration("problems.visibility")&&(this.markersStatusItem.update(this.getMarkersItem()),r=this.configurationService.getValue("problems.visibility"),!r&&!this.markersStatusItemOff?n():r&&this.markersStatusItemOff&&(this.markersStatusItemOff.dispose(),this.markersStatusItemOff=void 0))}))}getMarkersItem(){let e=this.markerService.getStatistics(),t=this.getMarkersTooltip(e);return{name:d(12751,null),text:this.getMarkersText(e),ariaLabel:t,tooltip:t,command:"workbench.actions.view.toggleProblems"}}getMarkersItemTurnedOff(){this.statusbarService.updateEntryVisibility("status.problemsVisibility",!0);let e="workbench.action.openSettings",t="@id:problems.visibility",o=d(12753,null);return{name:d(12752,null),text:"$(whole-word)",ariaLabel:o,tooltip:o,kind:"warning",command:{title:e,arguments:[t],id:e}}}getMarkersTooltip(e){let t=s=>d(12759,null,s),o=s=>d(12762,null,s),n=s=>d(12760,null,s),r=[];return e.errors>0&&r.push(t(e.errors)),e.warnings>0&&r.push(o(e.warnings)),e.infos>0&&r.push(n(e.infos)),r.length===0?d(12742,null):r.join(", ")}getMarkersText(e){let t=[];return t.push("$(error) "+this.packNumber(e.errors)),t.push("$(warning) "+this.packNumber(e.warnings)),e.infos>0&&t.push("$(info) "+this.packNumber(e.infos)),t.join(" ")}packNumber(e){let t=d(12739,null);return e>9999?t:e>999?e.toString().charAt(0)+"K":e.toString()}};Jut=I([m(0,ha),m(1,Fr),m(2,B)],Jut);TOo.registerWorkbenchContribution(Jut,3);bt(BSe.ID,BSe,vt.AfterRestored);var Zut=class extends k{constructor(e,t){super();this.activityService=e;this.markerService=t;this.activity=this._register(new ue);this._register(this.markerService.onMarkerChanged(()=>this.updateBadge())),this.updateBadge()}updateBadge(){let{errors:e,warnings:t,infos:o}=this.markerService.getStatistics(),n=e+t+o;if(n>0){let r=d(12761,null,n);this.activity.value=this.activityService.showViewActivity(Ur.MARKERS_VIEW_ID,{badge:new eu(n,()=>r)})}else this.activity.value=void 0}};Zut=I([m(0,Al),m(1,ha)],Zut);TOo.registerWorkbenchContribution(Zut,3);_a.register(new f9t);var Mkn=Oe("process-explorer-editor-label-icon",L.serverProcess,d(14467,null)),jV=class a extends Ls{constructor(){super(...arguments);this.resource=a.RESOURCE}static{this.ID="workbench.editor.processExplorer"}static{this.RESOURCE=A.from({scheme:"process-explorer",path:"default"})}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}get typeId(){return a.ID}get editorId(){return a.ID}get capabilities(){return 10}getName(){return d(14468,null)}getIcon(){return Mkn}matches(e){return super.matches(e)?!0:e instanceof a}};var VKe=class{static{this.ID="workbench.contrib.processExplorerEditor"}constructor(i,e){i.registerEditor(`${jV.RESOURCE.scheme}:**/**`,{id:jV.ID,label:d(14456,null),priority:"exclusive"},{singlePerResource:!0,canSupportResource:t=>t.scheme===jV.RESOURCE.scheme},{createEditorInput:()=>({editor:e.createInstance(jV),options:{pinned:!0}})})}};VKe=I([m(0,il),m(1,F)],VKe);bt(VKe.ID,VKe,vt.BlockStartup);var lKi=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return jV.instance}};oe.as(en.EditorFactory).registerEditorSerializer(jV.ID,lKi);var _Oo=C.or(Mu.negate(),Qb.notEqualsTo("")),b9t=class a extends z{static{this.ID="workbench.action.openProcessExplorer"}static{this.STATE_KEY="workbench.processExplorerWindowState"}static{this.DEFAULT_STATE={bounds:{width:800,height:500}}}constructor(){super({id:a.ID,title:P(14455,"Open Process Explorer"),category:Fe.Developer,precondition:_Oo,f1:!0})}async run(i){let e=i.get(ie),t=i.get(kt),o=i.get(RR),n=i.get(de),r=await e.openEditor({resource:jV.RESOURCE,options:{pinned:!0,revealIfOpened:!0,auxiliary:{...this.loadState(n),compact:!0,alwaysOnTop:!0}}},ff);if(r){let s=r.input?.onWillDispose(()=>{s?.dispose(),this.saveState(r.group.id,n,t,o)})}}loadState(i){let e=i.get(a.STATE_KEY,-1);if(!e)return a.DEFAULT_STATE;try{return JSON.parse(e)}catch{return a.DEFAULT_STATE}}saveState(i,e,t,o){let n=o.getWindow(t.getPart(i).windowId);if(!n)return;let r=n.createState().bounds;r&&e.store(a.STATE_KEY,JSON.stringify({bounds:r}),-1,1)}};W(b9t);be.appendMenuItem(R.MenubarHelpMenu,{group:"5_tools",command:{id:b9t.ID,title:d(14454,null)},when:_Oo,order:2});var R$v=te("mergeEditor.change.background","#9bb95533",d(13364,null)),L$v=te("mergeEditor.change.word.background",{dark:"#9ccc2c33",light:"#9ccc2c66",hcDark:"#9ccc2c33",hcLight:"#9ccc2c66"},d(13365,null)),M$v=te("mergeEditor.changeBase.background",{dark:"#4B1818FF",light:"#FFCCCCFF",hcDark:"#4B1818FF",hcLight:"#FFCCCCFF"},d(13366,null)),P$v=te("mergeEditor.changeBase.word.background",{dark:"#6F1313FF",light:"#FFA3A3FF",hcDark:"#6F1313FF",hcLight:"#FFA3A3FF"},d(13367,null)),A$v=te("mergeEditor.conflict.unhandledUnfocused.border",{dark:"#ffa6007a",light:"#ffa600FF",hcDark:"#ffa6007a",hcLight:"#ffa6007a"},d(13375,null)),N$v=te("mergeEditor.conflict.unhandledFocused.border","#ffa600",d(13374,null)),O$v=te("mergeEditor.conflict.handledUnfocused.border","#86868649",d(13370,null)),F$v=te("mergeEditor.conflict.handledFocused.border","#c1c1c1cc",d(13369,null)),s7=te("mergeEditor.conflict.handled.minimapOverViewRuler","#adaca8ee",d(13368,null)),a7=te("mergeEditor.conflict.unhandled.minimapOverViewRuler","#fcba03FF",d(13373,null)),W$v=te("mergeEditor.conflictingLines.background","#ffea0047",d(13376,null)),DOo=.4,V$v=te("mergeEditor.conflict.input1.background",ni(M3e,DOo),d(13371,null)),B$v=te("mergeEditor.conflict.input2.background",ni(P3e,DOo),d(13372,null));var Fse=class extends k{constructor(e,t,o){super();this._editor=e;this._domNode=t;this.itemProvider=o;this.scrollTop=vi(this,this._editor.onDidScrollChange,s=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(s=>s===0),this.modelAttached=vi(this,this._editor.onDidChangeModel,s=>this._editor.hasModel()),this.editorOnDidChangeViewZones=qr("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=qr("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=zc("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";let n=this._domNode.appendChild(st("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),r=new ResizeObserver(()=>{Ki(s=>{this.domNodeSizeChanged.trigger(s)})});r.observe(this._domNode),this._register(ee(()=>r.disconnect())),this._register(ve(s=>{n.className=this.isScrollTopZero.read(s)?"":"scroll-decoration"})),this._register(ve(s=>this.render(s)))}dispose(){super.dispose(),Ii(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);let t=this.scrollTop.read(e),o=this._editor.getVisibleRanges(),n=new Set(this.views.keys());if(o.length>0){let r=o[0],s=jg.fromLength(r.startLineNumber,r.endLineNumber-r.startLineNumber).deltaEnd(1),l=this.itemProvider.getIntersectingGutterItems(s,e);for(let c of l){if(!c.range.intersectsOrTouches(s))continue;n.delete(c.id);let u=this.views.get(c.id);if(u)u.gutterItemView.update(c);else{let f=document.createElement("div");this._domNode.appendChild(f);let v=this.itemProvider.createView(c,f);u=new cKi(v,f),this.views.set(c.id,u)}let p=c.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(c.range.startLineNumber,!0)-t:this._editor.getBottomForLineNumber(c.range.startLineNumber-1,!1)-t,g=this._editor.getBottomForLineNumber(c.range.endLineNumberExclusive-1,!0)-t-p;u.domNode.style.top=`${p}px`,u.domNode.style.height=`${g}px`,u.gutterItemView.layout(p,g,0,this._domNode.clientHeight)}}for(let r of n){let s=this.views.get(r);s.gutterItemView.dispose(),s.domNode.remove(),this.views.delete(r)}}},cKi=class{constructor(i,e){this.gutterItemView=i;this.domNode=e}};var Wse=class extends k{constructor(e,t,o){super();this.instantiationService=e;this.viewModel=t;this.configurationService=o;this.model=this.viewModel.map(n=>n?.model),this.htmlElements=st("div.code-view",[st("div.header@header",[st("span.title@title"),st("span.description@description"),st("span.detail@detail"),st("span.toolbar@toolbar")]),st("div.container",[st("div.gutter@gutterDiv"),st("div@editor")])]),this._onDidViewChange=this._register(new T),this.view={element:this.htmlElements.root,minimumWidth:c_.width,maximumWidth:B3.width,minimumHeight:c_.height,maximumHeight:B3.height,onDidChange:this._onDidViewChange.event,layout:(n,r,s,l)=>{Cco(this.htmlElements.root,{width:n,height:r,top:s,left:l}),this.editor.layout({width:n-this.htmlElements.gutterDiv.clientWidth,height:r-this.htmlElements.header.clientHeight})}},this.checkboxesVisible=hr("mergeEditor.showCheckboxes",!1,this.configurationService),this.showDeletionMarkers=hr("mergeEditor.showDeletionMarkers",!0,this.configurationService),this.useSimplifiedDecorations=hr("mergeEditor.useSimplifiedDecorations",!1,this.configurationService),this.editor=this.instantiationService.createInstance(us,this.htmlElements.editor,{},{contributions:this.getEditorContributions()}),this.isFocused=vi(this,U.any(this.editor.onDidBlurEditorWidget,this.editor.onDidFocusEditorWidget),()=>this.editor.hasWidgetFocus()),this.cursorPosition=vi(this,this.editor.onDidChangeCursorPosition,()=>this.editor.getPosition()),this.selection=vi(this,this.editor.onDidChangeCursorSelection,()=>this.editor.getSelections()),this.cursorLineNumber=this.cursorPosition.map(n=>n?.lineNumber)}updateOptions(e){this.editor.updateOptions(e)}getEditorContributions(){return ml.getEditorContributions().filter(e=>e.id!==$f.ID&&e.id!==S4.ID)}};function BKe(a,i){let e=ke(t=>{let o=a.viewModel.read(t);if(!o)return[];let n=o.selectionInBase.read(t);return!n||n.sourceEditor===a?[]:n.rangesInBase.map(r=>i(r,o))});return ve(t=>{let o=e.read(t);o.length!==0&&a.editor.setSelections(o.map(n=>new ei(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn)))})}var ij=class extends k{constructor(i,e,t){super();let o=t.createInstance(pr,e,i,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:n=>n==="primary"}});this._store.add(o)}};ij=I([m(2,F)],ij);var HKe=class extends Wse{constructor(e,t,o){super(t,e,o);this.decorations=ke(this,e=>{let t=this.viewModel.read(e);if(!t)return[];let o=t.model,n=o.base,r=t.activeModifiedBaseRange.read(e),s=t.showNonConflictingChanges.read(e),l=this.showDeletionMarkers.read(e),c=[];for(let u of o.modifiedBaseRanges.read(e)){let p=u.baseRange;if(!p)continue;let h=o.isHandled(u).read(e);if(!u.isConflicting&&h&&!s)continue;let g=["merge-editor-block"],f=[0,0,0,0];h&&g.push("handled"),u===r&&(g.push("focused"),f=[0,2,0,2]),g.push("base");let v=t.baseShowDiffAgainst.read(e);if(v)for(let b of u.getInputDiffs(v)){let S=b.inputRange.toInclusiveRange();S&&c.push({range:S,options:{className:"merge-editor-diff base",description:"Merge Editor",isWholeLine:!0}});for(let y of b.rangeMappings)(l||!y.inputRange.isEmpty())&&c.push({range:y.inputRange,options:{className:y.inputRange.isEmpty()?"merge-editor-diff-empty-word base":"merge-editor-diff-word base",description:"Merge Editor",showIfCollapsed:!0}})}c.push({range:p.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:g.join(" "),blockPadding:f,blockIsAfterEnd:p.startLineNumber>n.getLineCount(),description:"Merge Editor",minimap:{position:2,color:{id:h?s7:a7}},overviewRuler:u.isConflicting?{position:2,color:{id:h?s7:a7}}:void 0}})}return c});this._register(BKe(this,(n,r)=>n)),this._register(t.createInstance(ij,R.MergeBaseToolbar,this.htmlElements.title)),this._register(Rl((n,r)=>{this.checkboxesVisible.read(n)&&r.add(new Fse(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(s,l)=>[],createView:(s,l)=>{throw new ci}}))})),this._register(ve(n=>{let r=this.viewModel.read(n);if(!r)return;this.editor.setModel(r.model.base),Ii(this.htmlElements.title,...ir(d(13395,null)));let s=r.baseShowDiffAgainst.read(n),l;if(s){let c=d(13396,null,s===1?r.model.input1.title:r.model.input2.title),u=d(13397,null);l=st("span",{title:u},[c]).root}Ii(this.htmlElements.description,...l?[l]:[])})),this._register(eRe(this.editor,this.decorations))}};HKe=I([m(1,F),m(2,B)],HKe);var S9t=class extends k{constructor(e,t,o,n,r,s){super();this.viewModel=e;this.input1View=t;this.input2View=o;this.baseView=n;this.inputResultView=r;this.layout=s;this.reentrancyBarrier=new uee;this._isSyncing=!0;let l=ke(c=>{let u=this.baseView.read(c),p=[this.input1View,this.input2View,this.inputResultView,u].filter(so),h=(g,f,v)=>{this.reentrancyBarrier.runExclusivelyOrSkip(()=>{if(f){let b=g.editor.getScrollLeft();for(let S of p)S!==g&&S.editor.setScrollLeft(b,1)}if(v){let b=g.editor.getScrollTop();for(let S of p)if(S!==g)if(this._shouldLock(g,S))S.editor.setScrollTop(b,1);else{let y=this._getMapping(g,S);y&&this._synchronizeScrolling(g.editor,S.editor,y)}}})};for(let g of p)c.store.add(g.editor.onDidScrollChange(f=>{this._isSyncing&&h(g,f.scrollLeftChanged,f.scrollTopChanged)}));return{update:()=>{h(this.inputResultView,!0,!0)}}}).recomputeInitiallyAndOnChange(this._store);this.updateScrolling=()=>{l.get().update()}}get model(){return this.viewModel.get()?.model}get lockResultWithInputs(){return this.layout.get().kind==="columns"}get lockBaseWithInputs(){return this.layout.get().kind==="mixed"&&!this.layout.get().showBaseAtTop}stopSync(){this._isSyncing=!1}startSync(){this._isSyncing=!0}_shouldLock(e,t){let o=n=>n===this.input1View||n===this.input2View;return o(e)&&t===this.inputResultView||o(t)&&e===this.inputResultView?this.lockResultWithInputs:o(e)&&t===this.baseView.get()||o(t)&&e===this.baseView.get()?this.lockBaseWithInputs:!!(o(e)&&o(t))}_getMapping(e,t){if(e===this.input1View){if(t===this.input2View)return;if(t===this.inputResultView)return this.model?.input1ResultMapping.get();if(t===this.baseView.get()){let o=this.model?.baseInput1Diffs.get();return o?new eW(o,-1).reverse():void 0}}else if(e===this.input2View){if(t===this.input1View)return;if(t===this.inputResultView)return this.model?.input2ResultMapping.get();if(t===this.baseView.get()){let o=this.model?.baseInput2Diffs.get();return o?new eW(o,-1).reverse():void 0}}else if(e===this.inputResultView){if(t===this.input1View)return this.model?.resultInput1Mapping.get();if(t===this.input2View)return this.model?.resultInput2Mapping.get();if(t===this.baseView.get()){let o=this.model?.resultBaseMapping.get();return o||void 0}}else if(e===this.baseView.get()){if(t===this.input1View){let o=this.model?.baseInput1Diffs.get();return o?new eW(o,-1):void 0}else if(t===this.input2View){let o=this.model?.baseInput2Diffs.get();return o?new eW(o,-1):void 0}else if(t===this.inputResultView){let o=this.model?.baseResultMapping.get();return o||void 0}}throw new ci}_synchronizeScrolling(e,t,o){if(!o)return;let n=e.getVisibleRanges();if(n.length===0)return;let r=n[0].startLineNumber-1,s=o.project(r),l=s.inputRange,c=s.outputRange,u=t.getTopForLineNumber(c.startLineNumber),p=t.getTopForLineNumber(c.endLineNumberExclusive),h=e.getTopForLineNumber(l.startLineNumber),g=e.getTopForLineNumber(l.endLineNumberExclusive),f=Math.min((e.getScrollTop()-h)/(g-h),1),v=u+(p-u)*f;t.setScrollTop(v,1)}};var UKe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.model=e;this.inputCodeEditorView1=t;this.inputCodeEditorView2=o;this.resultCodeEditorView=n;this.baseCodeEditorView=r;this.showNonConflictingChanges=s;this.configurationService=l;this.notificationService=c;this.manuallySetActiveModifiedBaseRange=De(this,{range:void 0,counter:0}),this.attachedHistory=this._register(new dKi(this.model.resultTextModel)),this.shouldUseAppendInsteadOfAccept=hr("mergeEditor.shouldUseAppendInsteadOfAccept",!1,this.configurationService),this.counter=0,this.lastFocusedEditor=k4e(this,(u,p)=>{let g=[this.inputCodeEditorView1,this.inputCodeEditorView2,this.resultCodeEditorView,this.baseCodeEditorView.read(u)].find(f=>f&&f.isFocused.read(u));return g?{view:g,counter:this.counter++}:p||{view:void 0,counter:this.counter++}}),this.baseShowDiffAgainst=ke(this,u=>{let p=this.lastFocusedEditor.read(u);if(p.view===this.inputCodeEditorView1)return 1;if(p.view===this.inputCodeEditorView2)return 2}),this.focusedEditorType=ke(this,u=>{let p=this.lastFocusedEditor.read(u);if(p.view){if(p.view===this.inputCodeEditorView1)return"input1";if(p.view===this.inputCodeEditorView2)return"input2";if(p.view===this.resultCodeEditorView)return"result";if(p.view===this.baseCodeEditorView.read(u))return"base"}}),this.selectionInBase=ke(this,u=>{let p=this.lastFocusedEditor.read(u).view;return p?{rangesInBase:(p.selection.read(u)||[]).map(f=>p===this.inputCodeEditorView1?this.model.translateInputRangeToBase(1,f):p===this.inputCodeEditorView2?this.model.translateInputRangeToBase(2,f):p===this.resultCodeEditorView?this.model.translateResultRangeToBase(f):(p===this.baseCodeEditorView.read(u),f)),sourceEditor:p}:void 0}),this.activeModifiedBaseRange=ke(this,u=>{let p=this.lastFocusedEditor.read(u),h=this.manuallySetActiveModifiedBaseRange.read(u);if(h.counter>p.counter)return h.range;if(!p.view)return;let g=p.view.cursorLineNumber.read(u);return g?this.model.modifiedBaseRanges.read(u).find(v=>{let b=this.getRangeOfModifiedBaseRange(p.view,v,u);return b.isEmpty?b.startLineNumber===g:b.contains(g)}):void 0}),this._register(n.editor.onDidChangeModelContent(u=>{if(this.model.isApplyingEditInResult||u.isRedoing||u.isUndoing)return;let p=[];for(let g of u.changes){let f=this.model.translateResultRangeToBase(G.lift(g.range)),v=this.model.findModifiedBaseRangesInRange(jg.fromLength(f.startLineNumber,f.endLineNumber-f.startLineNumber));v.length===1&&(this.model.isHandled(v[0]).get()||p.push(v[0]))}if(p.length===0)return;let h={model:this.model,redo(){Ki(g=>{for(let f of p)this.model.setHandled(f,!0,g)})},undo(){Ki(g=>{for(let f of p)this.model.setHandled(f,!1,g)})}};this.attachedHistory.pushAttachedHistoryElement(h),h.redo()}))}getRangeOfModifiedBaseRange(e,t,o){if(e===this.resultCodeEditorView)return this.model.getLineRangeInResult(t.baseRange,o);if(e===this.baseCodeEditorView.get())return t.baseRange;{let n=e===this.inputCodeEditorView1?1:2;return t.getInputRange(n)}}setActiveModifiedBaseRange(e,t){this.manuallySetActiveModifiedBaseRange.set({range:e,counter:this.counter++},t)}setState(e,t,o,n){this.manuallySetActiveModifiedBaseRange.set({range:e,counter:this.counter++},o),this.model.setState(e,t,n,o),this.lastFocusedEditor.clearCache(o)}goToConflict(e){let t=this.lastFocusedEditor.get().view;t||(t=this.resultCodeEditorView);let o=t.editor.getPosition()?.lineNumber;if(o===void 0)return;let n=e(t,o);if(n){let r=this.getRangeOfModifiedBaseRange(t,n,void 0);t.editor.focus();let s=r.startLineNumber,l=r.endLineNumberExclusive;r.startLineNumber>t.editor.getModel().getLineCount()&&(Ki(c=>{this.setActiveModifiedBaseRange(n,c)}),s=l=t.editor.getModel().getLineCount()),t.editor.setPosition({lineNumber:s,column:t.editor.getModel().getLineFirstNonWhitespaceColumn(s)}),t.editor.revealLinesNearTop(s,l,0)}}goToNextModifiedBaseRange(e){this.goToConflict((t,o)=>this.model.modifiedBaseRanges.get().find(n=>e(n)&&this.getRangeOfModifiedBaseRange(t,n,void 0).startLineNumber>o)||this.model.modifiedBaseRanges.get().find(n=>e(n)))}goToPreviousModifiedBaseRange(e){this.goToConflict((t,o)=>wu(this.model.modifiedBaseRanges.get(),n=>e(n)&&this.getRangeOfModifiedBaseRange(t,n,void 0).endLineNumberExclusive<o)||wu(this.model.modifiedBaseRanges.get(),n=>e(n)))}toggleActiveConflict(e){let t=this.activeModifiedBaseRange.get();if(!t){this.notificationService.error(d(13414,null));return}Ki(o=>{this.setState(t,this.model.getState(t).get().toggle(e),o,e)})}acceptAll(e){Ki(t=>{for(let o of this.model.modifiedBaseRanges.get())this.setState(o,this.model.getState(o).get().withInputValue(e,!0),t,e)})}};UKe=I([m(6,B),m(7,Ne)],UKe);var dKi=class extends k{constructor(e){super();this.model=e;this.attachedHistory=[],this.previousAltId=this.model.getAlternativeVersionId(),this._register(e.onDidChangeContent(t=>{let o=e.getAlternativeVersionId();if(t.isRedoing)for(let n of this.attachedHistory)this.previousAltId<n.altId&&n.altId<=o&&n.element.redo();else if(t.isUndoing)for(let n=this.attachedHistory.length-1;n>=0;n--){let r=this.attachedHistory[n];o<r.altId&&r.altId<=this.previousAltId&&r.element.undo()}else for(;this.attachedHistory.length>0&&this.attachedHistory[this.attachedHistory.length-1].altId>this.previousAltId;)this.attachedHistory.pop();this.previousAltId=o}))}pushAttachedHistoryElement(e){this.attachedHistory.push({altId:this.model.getAlternativeVersionId(),element:e})}};var I9t=class a extends k{constructor(e,t,o,n,r){super();this.editor=e;this.overlayWidgetId=`fixedZoneWidget-${a.counter++}`;this.widgetDomNode=st("div.fixed-zone-widget").root;this.overlayWidget={getId:()=>this.overlayWidgetId,getDomNode:()=>this.widgetDomNode,getPosition:()=>null};this.viewZoneId=t.addZone({domNode:document.createElement("div"),afterLineNumber:o,heightInPx:n,ordinal:50001,onComputedHeight:s=>{this.widgetDomNode.style.height=`${s}px`},onDomNodeTop:s=>{this.widgetDomNode.style.top=`${s}px`}}),r.push(this.viewZoneId),this._register(U.runAndSubscribe(this.editor.onDidLayoutChange,()=>{this.widgetDomNode.style.left=this.editor.getLayoutInfo().contentLeft+"px"})),this.editor.addOverlayWidget(this.overlayWidget),this._register({dispose:()=>{this.editor.removeOverlayWidget(this.overlayWidget)}})}static{this.counter=0}};var zKe=class extends k{constructor(e){super();this._editor=e;this._register(this._editor.onDidChangeConfiguration(t=>{(t.hasChanged(59)||t.hasChanged(25)||t.hasChanged(24))&&this._updateLensStyle()})),this._styleClassName="_conflictActionsFactory_"+Lr(this._editor.getId()).toString(16),this._styleElement=Pr(a5(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,void 0,this._store),this._updateLensStyle()}_updateLensStyle(){let{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),o=this._editor.getOption(24),n=this._editor.getOption(59),r=`--codelens-font-family${this._styleClassName}`,s=`--codelens-font-features${this._styleClassName}`,l=`
		.${this._styleClassName} { line-height: ${e}px; font-size: ${t}px; padding-right: ${Math.round(t*.5)}px; font-feature-settings: var(${s}) }
		.monaco-workbench .${this._styleClassName} span.codicon { line-height: ${e}px; font-size: ${t}px; }
		`;o&&(l+=`${this._styleClassName} { font-family: var(${r}), ${Ku.fontFamily}}`),this._styleElement.textContent=l,this._editor.getContainerDomNode().style?.setProperty(r,o??"inherit"),this._editor.getContainerDomNode().style?.setProperty(s,n.fontFeatureSettings)}_getLayoutInfo(){let e=Math.max(1.3,this._editor.getOption(75)/this._editor.getOption(61)),t=this._editor.getOption(25);return(!t||t<5)&&(t=this._editor.getOption(61)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}createWidget(e,t,o,n){let r=this._getLayoutInfo();return new uKi(this._editor,e,t,r.codeLensHeight+2,this._styleClassName,o,n)}},y9t=class{constructor(i,e){this.viewModel=i;this.modifiedBaseRange=e;this.itemsInput1=this.getItemsInput(1);this.itemsInput2=this.getItemsInput(2);this.resultItems=ke(this,i=>{let e=this.viewModel,t=this.modifiedBaseRange,o=e.model.getState(t).read(i),n=e.model,r=[];if(o.kind===4)r.push({text:d(13386,null),tooltip:d(13387,null)});else if(o.kind===0)r.push({text:d(13389,null),tooltip:d(13390,null)});else{let l=[];o.includesInput1&&l.push(n.input1.title),o.includesInput2&&l.push(n.input2.title),o.kind===3&&o.firstInput===2&&l.reverse(),r.push({text:`${l.join(" + ")}`})}let s=[];return o.includesInput1&&s.push(Vse(d(13391,null,n.input1.title),async()=>{Ki(l=>{n.setState(t,o.withInputValue(1,!1),!0,l),n.telemetry.reportRemoveInvoked(1,o.includesInput(2))})},d(13392,null,n.input1.title))),o.includesInput2&&s.push(Vse(d(13391,null,n.input2.title),async()=>{Ki(l=>{n.setState(t,o.withInputValue(2,!1),!0,l),n.telemetry.reportRemoveInvoked(2,o.includesInput(1))})},d(13392,null,n.input2.title))),o.kind===3&&o.firstInput===2&&s.reverse(),r.push(...s),o.kind===4&&r.push(Vse(d(13393,null),async()=>{Ki(l=>{n.setState(t,QS.base,!0,l),n.telemetry.reportResetToBaseInvoked()})},d(13394,null))),r});this.isEmpty=ke(this,i=>this.itemsInput1.read(i).length+this.itemsInput2.read(i).length+this.resultItems.read(i).length===0);this.inputIsEmpty=ke(this,i=>this.itemsInput1.read(i).length+this.itemsInput2.read(i).length===0)}getItemsInput(i){return ke(e=>{let t=this.viewModel,o=this.modifiedBaseRange;if(!t.model.hasBaseRange(o))return[];let n=t.model.getState(o).read(e),r=t.model.isHandled(o).read(e),s=t.model,l=[],c=i===1?t.model.input1:t.model.input2,u=t.showNonConflictingChanges.read(e);if(!o.isConflicting&&r&&!u)return[];let p=i===1?2:1;if(n.kind!==4&&!n.isInputIncluded(i)){if(!n.isInputIncluded(p)||!this.viewModel.shouldUseAppendInsteadOfAccept.read(e)){if(l.push(Vse(d(13377,null,c.title),async()=>{Ki(h=>{s.setState(o,n.withInputValue(i,!0,!1),i,h),s.telemetry.reportAcceptInvoked(i,n.includesInput(p))})},d(13381,null,c.title))),o.canBeCombined){let h=o.isOrderRelevant?d(13379,null,c.title):d(13378,null);l.push(Vse(h,async()=>{Ki(g=>{s.setState(o,QS.base.withInputValue(i,!0).withInputValue(p,!0,!0),!0,g),s.telemetry.reportSmartCombinationInvoked(n.includesInput(p))})},d(13380,null)))}}else l.push(Vse(d(13382,null,c.title),async()=>{Ki(h=>{s.setState(o,n.withInputValue(i,!0,!1),i,h),s.telemetry.reportAcceptInvoked(i,n.includesInput(p))})},d(13383,null,c.title))),o.canBeCombined&&l.push(Vse(d(13384,null,c.title),async()=>{Ki(h=>{s.setState(o,n.withInputValue(i,!0,!0),i,h),s.telemetry.reportSmartCombinationInvoked(n.includesInput(p))})},d(13380,null)));s.isInputHandled(o,i).read(e)||l.push(Vse(d(13385,null),async()=>{Ki(h=>{s.setInputHandled(o,i,!0,h)})},d(13388,null)))}return l})}};function Vse(a,i,e){return{text:a,action:i,tooltip:e}}var uKi=class extends I9t{constructor(e,t,o,n,r,s,l){super(e,t,o,n,l);this._domNode=st("div.merge-editor-conflict-actions").root;this.widgetDomNode.appendChild(this._domNode),this._domNode.classList.add(r),this._register(ve(c=>{let u=s.read(c);this.setState(u)}))}setState(e){let t=[],o=!0;for(let n of e){o?o=!1:t.push(_("span",void 0,"\xA0|\xA0"));let r=ir(n.text);n.action?t.push(_("a",{title:n.tooltip,role:"button",onclick:()=>n.action()},...r)):t.push(_("span",{title:n.tooltip},...r))}Ii(this._domNode,...t)}};function LOo(a){let i=ROo(a.input1Diffs.flatMap(s=>s.rangeMappings),a.baseRange.toExclusiveRange(),a.input1Range.toExclusiveRange()),e=ROo(a.input2Diffs.flatMap(s=>s.rangeMappings),a.baseRange.toExclusiveRange(),a.input2Range.toExclusiveRange()),t=Pkn(i,e),o=[];o.push([a.input1Range.startLineNumber-1,a.baseRange.startLineNumber-1,a.input2Range.startLineNumber-1]);function n(s){return s.every(l=>l!==void 0)}for(let s of t){let l=[s.output1Pos?.lineNumber,s.inputPos.lineNumber,s.output2Pos?.lineNumber],c=n(l),u=!0;if(c){let p=!o.some(h=>n(h)&&h.some((g,f)=>g!==void 0&&g===l[f]));p&&(o=o.filter(h=>!h.some((g,f)=>g!==void 0&&g===l[f]))),u=p}else u=!o.some(h=>h.some((g,f)=>g!==void 0&&g===l[f]));u?o.push(l):s.length.isGreaterThan(new Rc(1,0))&&o.push([s.output1Pos?s.output1Pos.lineNumber+1:void 0,s.inputPos.lineNumber+1,s.output2Pos?s.output2Pos.lineNumber+1:void 0])}let r=[a.input1Range.endLineNumberExclusive,a.baseRange.endLineNumberExclusive,a.input2Range.endLineNumberExclusive];return o=o.filter(s=>s.every((l,c)=>l!==r[c])),o.push(r),Wh(()=>Nw(o.map(s=>s[0]).filter(so),(s,l)=>s<l)&&Nw(o.map(s=>s[1]).filter(so),(s,l)=>s<=l)&&Nw(o.map(s=>s[2]).filter(so),(s,l)=>s<l)&&o.every(s=>s.filter(so).length>=2)),o}function ROo(a,i,e){let t=[],o=i.getStartPosition(),n=e.getStartPosition();for(let s of a){let l=new BH(G.fromPositions(o,s.inputRange.getStartPosition()),G.fromPositions(n,s.outputRange.getStartPosition()));Wh(()=>rJe(l.inputRange).equals(rJe(l.outputRange))),l.inputRange.isEmpty()||t.push(l),o=s.inputRange.getEndPosition(),n=s.outputRange.getEndPosition()}let r=new BH(G.fromPositions(o,i.getEndPosition()),G.fromPositions(n,e.getEndPosition()));return Wh(()=>rJe(r.inputRange).equals(rJe(r.outputRange))),r.inputRange.isEmpty()||t.push(r),t}function Pkn(a,i){let e=[],t=[];for(let[r,s]of[[0,a],[1,i]])for(let l of s)t.push({input:r,start:!0,inputPos:l.inputRange.getStartPosition(),outputPos:l.outputRange.getStartPosition()}),t.push({input:r,start:!1,inputPos:l.inputRange.getEndPosition(),outputPos:l.outputRange.getEndPosition()});t.sort(Il(r=>r.inputPos,ye.compare));let o=[void 0,void 0],n;for(let r of t){if(n&&o.some(s=>!!s)){let s=INt(n,r.inputPos);s.isZero()||(e.push({inputPos:n,length:s,output1Pos:o[0],output2Pos:o[1]}),o[0]&&(o[0]=sJe(o[0],s)),o[1]&&(o[1]=sJe(o[1],s)))}o[r.input]=r.start?r.outputPos:void 0,n=r.inputPos}return e}var w9t=class{constructor(i,e,t){this.input1Editor=i;this.input2Editor=e;this.resultEditor=t;this.conflictActionsFactoryInput1=new zKe(this.input1Editor),this.conflictActionsFactoryInput2=new zKe(this.input2Editor),this.conflictActionsFactoryResult=new zKe(this.resultEditor)}computeViewZones(i,e,t){let o=0,n=0,r=0,s=0,l=[],c=[],u=[],p=[],h=e.model,g=h.baseResultDiffs.read(i),f=yNt(h.modifiedBaseRanges.read(i),g,(w,x)=>w.baseRange.intersectsOrTouches(x.inputRange)?tx.neitherLessOrGreaterThan:jg.compareByStart(w.baseRange,x.inputRange)),v=t.codeLensesVisible,b=t.showNonConflictingChanges,S,y;for(let w of f){if(v&&w.left&&(w.left.isConflicting||b||!h.isHandled(w.left).read(i))){let M=new y9t(e,w.left);(t.shouldAlignResult||!M.inputIsEmpty.read(i))&&(l.push(new ept(this.conflictActionsFactoryInput1,w.left.input1Range.startLineNumber-1,M.itemsInput1)),c.push(new ept(this.conflictActionsFactoryInput2,w.left.input2Range.startLineNumber-1,M.itemsInput2)),t.shouldAlignBase&&u.push(new mKi(w.left.baseRange.startLineNumber-1,16)));let N=w.left.baseRange.startLineNumber+(y?.resultingDeltaFromOriginalToModified??0)-1;p.push(new ept(this.conflictActionsFactoryResult,N,M.resultItems))}let x=w.rights.at(-1);x&&(y=x);let E;w.left?(E=LOo(w.left).map(M=>({input1Line:M[0],baseLine:M[1],input2Line:M[2],resultLine:void 0})),S=w.left,E[E.length-1].resultLine=w.left.baseRange.endLineNumberExclusive+(y?y.resultingDeltaFromOriginalToModified:0)):E=[{baseLine:x.inputRange.endLineNumberExclusive,input1Line:x.inputRange.endLineNumberExclusive+(S?S.input1Range.endLineNumberExclusive-S.baseRange.endLineNumberExclusive:0),input2Line:x.inputRange.endLineNumberExclusive+(S?S.input2Range.endLineNumberExclusive-S.baseRange.endLineNumberExclusive:0),resultLine:x.outputRange.endLineNumberExclusive}];for(let{input1Line:M,baseLine:N,input2Line:V,resultLine:H}of E){if(!t.shouldAlignBase&&(M===void 0||V===void 0))continue;let K=M!==void 0?M+o:-1,j=V!==void 0?V+n:-1,J=N+r,se=H!==void 0?H+s:-1,ae=Math.max(t.shouldAlignBase?J:0,K,j,t.shouldAlignResult?se:0);if(M!==void 0){let ce=ae-K;ce>0&&(l.push(new KKe(M-1,ce)),o+=ce)}if(V!==void 0){let ce=ae-j;ce>0&&(c.push(new KKe(V-1,ce)),n+=ce)}if(t.shouldAlignBase){let ce=ae-J;ce>0&&(u.push(new KKe(N-1,ce)),r+=ce)}if(t.shouldAlignResult&&H!==void 0){let ce=ae-se;ce>0&&(p.push(new KKe(H-1,ce)),s+=ce)}}}return new pKi(l,c,u,p)}},pKi=class{constructor(i,e,t,o){this.input1ViewZones=i;this.input2ViewZones=e;this.baseViewZones=t;this.resultViewZones=o}},tpt=class{},KKe=class extends tpt{constructor(e,t){super();this.afterLineNumber=e;this.heightInLines=t}create(e,t,o){t.push(e.addZone({afterLineNumber:this.afterLineNumber,heightInLines:this.heightInLines,domNode:_("div.diagonal-fill")}))}},mKi=class extends tpt{constructor(e,t){super();this.afterLineNumber=e;this.heightPx=t}create(e,t,o){t.push(e.addZone({afterLineNumber:this.afterLineNumber,heightInPx:this.heightPx,domNode:_("div.conflict-actions-placeholder")}))}},ept=class extends tpt{constructor(e,t,o){super();this.conflictActionsFactory=e;this.lineNumber=t;this.items=o}create(e,t,o){o.add(this.conflictActionsFactory.createWidget(e,this.lineNumber,this.items,t))}};var HSe=class extends Wse{constructor(e,t,o,n,r){super(o,t,r);this.inputNumber=e;this.otherInputNumber=this.inputNumber===1?2:1,this.modifiedBaseRangeGutterItemInfos=Js({debugName:`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`},s=>{let l=this.viewModel.read(s);if(!l)return[];let c=l.model,u=this.inputNumber,p=l.showNonConflictingChanges.read(s);return c.modifiedBaseRanges.read(s).filter(h=>h.getInputDiffs(this.inputNumber).length>0&&(p||h.isConflicting||!c.isHandled(h).read(s))).map((h,g)=>new hKi(g.toString(),h,u,l))}),this.decorations=Js({debugName:`input${this.inputNumber}.decorations`},s=>{let l=this.viewModel.read(s);if(!l)return[];let c=l.model,u=(this.inputNumber===1?c.input1:c.input2).textModel,p=l.activeModifiedBaseRange.read(s),h=new Array,g=l.showNonConflictingChanges.read(s),f=this.showDeletionMarkers.read(s),b=!(l.baseCodeEditorView.read(s)!==void 0&&l.baseShowDiffAgainst.read(s)===this.inputNumber)&&this.useSimplifiedDecorations.read(s);for(let S of c.modifiedBaseRanges.read(s)){let y=S.getInputRange(this.inputNumber);if(!y)continue;let w=["merge-editor-block"],x=[0,0,0,0],E=c.isInputHandled(S,this.inputNumber).read(s);E&&w.push("handled"),S===p&&(w.push("focused"),x=[0,2,0,2]),S.isConflicting&&w.push("conflicting");let M=this.inputNumber===1?"input i1":"input i2";if(w.push(M),!(!S.isConflicting&&!g&&E)&&(b&&!E&&w.push("use-simplified-decorations"),h.push({range:y.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:w.join(" "),blockPadding:x,blockIsAfterEnd:y.startLineNumber>u.getLineCount(),description:"Merge Editor",minimap:{position:2,color:{id:E?s7:a7}},overviewRuler:S.isConflicting?{position:2,color:{id:E?s7:a7}}:void 0}}),!b&&(S.isConflicting||!c.isHandled(S).read(s)))){let N=S.getInputDiffs(this.inputNumber);for(let V of N){let H=V.outputRange.toInclusiveRange();if(H&&h.push({range:H,options:{className:`merge-editor-diff ${M}`,description:"Merge Editor",isWholeLine:!0}}),V.rangeMappings)for(let K of V.rangeMappings)(f||!K.outputRange.isEmpty())&&h.push({range:K.outputRange,options:{className:K.outputRange.isEmpty()?`merge-editor-diff-empty-word ${M}`:`merge-editor-diff-word ${M}`,description:"Merge Editor",showIfCollapsed:!0}})}}}return h}),this.htmlElements.root.classList.add("input"),this._register(new Fse(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(s,l)=>this.checkboxesVisible.read(l)?this.modifiedBaseRangeGutterItemInfos.read(l):[],createView:(s,l)=>new gKi(s,l,n)})),this._register(BKe(this,(s,l)=>l.model.translateBaseRangeToInput(this.inputNumber,s))),this._register(o.createInstance(ij,e===1?R.MergeInput1Toolbar:R.MergeInput2Toolbar,this.htmlElements.toolbar)),this._register(dD({debugName:`input${this.inputNumber}: update labels & text model`},s=>{let l=this.viewModel.read(s);if(!l)return;this.editor.setModel(this.inputNumber===1?l.model.input1.textModel:l.model.input2.textModel);let c=this.inputNumber===1?l.model.input1.title||d(13402,null):l.model.input2.title||d(13403,null),u=this.inputNumber===1?l.model.input1.description:l.model.input2.description,p=this.inputNumber===1?l.model.input1.detail:l.model.input2.detail;Ii(this.htmlElements.title,...ir(c)),Ii(this.htmlElements.description,...u?ir(u):[]),Ii(this.htmlElements.detail,...p?ir(p):[])})),this._register(eRe(this.editor,this.decorations))}};HSe=I([m(2,F),m(3,Xe),m(4,B)],HSe);var hKi=class{constructor(i,e,t,o){this.id=i;this.baseRange=e;this.inputNumber=t;this.viewModel=o;this.model=this.viewModel.model,this.range=this.baseRange.getInputRange(this.inputNumber),this.enabled=this.model.isUpToDate,this.toggleState=ke(this,n=>{let r=this.model.getState(this.baseRange).read(n).getInput(this.inputNumber);return r===2&&!this.baseRange.isOrderRelevant?1:r}),this.state=ke(this,n=>{let r=this.viewModel.activeModifiedBaseRange.read(n);return this.model.hasBaseRange(this.baseRange)?{handled:this.model.isHandled(this.baseRange).read(n),focused:this.baseRange===r}:{handled:!1,focused:!1}})}setState(i,e){this.viewModel.setState(this.baseRange,this.model.getState(this.baseRange).get().withInputValue(this.inputNumber,i),e,this.inputNumber)}toggleBothSides(){Ki(i=>{let e=this.model.getState(this.baseRange).get();this.model.setState(this.baseRange,e.toggle(this.inputNumber).toggle(this.inputNumber===1?2:1),!0,i)})}getContextMenuActions(){let i=this.model.getState(this.baseRange).get(),e=this.model.isHandled(this.baseRange).get(),t=r=>{Ki(s=>this.viewModel.setState(this.baseRange,r,s,this.inputNumber))};function o(r,s,l,c){let u=new it(r,s,void 0,!0,()=>{t(l)});return u.checked=c,u}let n=i.includesInput1&&i.includesInput2;return[this.baseRange.input1Diffs.length>0?o("mergeEditor.acceptInput1",d(13404,null,this.model.input1.title),i.toggle(1),i.includesInput1):void 0,this.baseRange.input2Diffs.length>0?o("mergeEditor.acceptInput2",d(13404,null,this.model.input2.title),i.toggle(2),i.includesInput2):void 0,this.baseRange.isConflicting?wNt(o("mergeEditor.acceptBoth",d(13405,null),i.withInputValue(1,!n).withInputValue(2,!n),n),{enabled:this.baseRange.canBeCombined}):void 0,new oi,this.baseRange.isConflicting?wNt(o("mergeEditor.swap",d(13407,null),i.swap(),!1),{enabled:!i.kind&&(!n||this.baseRange.isOrderRelevant)}):void 0,wNt(new it("mergeEditor.markAsHandled",d(13406,null),void 0,!0,()=>{Ki(r=>{this.model.setHandled(this.baseRange,!e,r)})}),{checked:e})].filter(so)}},gKi=class extends k{constructor(e,t,o){super();this.isMultiLine=De(this,!1);this.item=De(this,e);let n=new Lm({isChecked:!1,title:"",icon:L.check,...zh});n.domNode.classList.add("accept-conflict-group"),this._register($(n.domNode,ne.MOUSE_DOWN,r=>{let s=this.item.get();s&&(r.button===2?(r.stopPropagation(),r.preventDefault(),o.showContextMenu({getAnchor:()=>n.domNode,getActions:()=>s.getContextMenuActions()})):r.button===1&&(r.stopPropagation(),r.preventDefault(),s.toggleBothSides()))})),this._register(ve(r=>{let s=this.item.read(r),l=s.toggleState.read(r),u={0:{icon:void 0,checked:!1,title:d(13399,null)},3:{icon:L.circleFilled,checked:!1,title:d(13398,null)},1:{icon:L.check,checked:!0,title:d(13400,null)},2:{icon:L.checkAll,checked:!0,title:d(13401,null)}}[l];n.setIcon(u.icon),n.checked=u.checked,n.setTitle(u.title),s.enabled.read(r)?n.enable():n.disable()})),this._register(ve(r=>{let s=this.item.read(r).state.read(r),l=["merge-accept-gutter-marker",s.handled&&"handled",s.focused&&"focused",this.isMultiLine.read(r)?"multi-line":"single-line"];t.className=l.filter(c=>typeof c=="string").join(" ")})),this._register(n.onChange(()=>{Ki(r=>{this.item.get().setState(n.checked,r)})})),t.appendChild(st("div.background",[oF]).root),t.appendChild(this.checkboxDiv=st("div.checkbox",[st("div.checkbox-background",[n.domNode])]).root)}layout(e,t,o,n){let r=this.checkboxDiv.clientHeight,s=t/2-r/2,l=r,c=e+s,u=[l,o+n-l-r],p=[e+l,e+t-r-l];p[0]<p[1]&&(c=jn(c,u[0],u[1]),c=jn(c,p[0],p[1])),this.checkboxDiv.style.top=`${c-e}px`,Ki(h=>{this.isMultiLine.set(t>30,h)})}update(e){Ki(t=>{this.item.set(e,t)})}};var GKe=class extends Wse{constructor(e,t,o,n){super(t,e,n);this._labelService=o;this.decorations=ke(this,e=>{let t=this.viewModel.read(e);if(!t)return[];let o=t.model,n=o.resultTextModel,r=new Array,s=yNt(o.modifiedBaseRanges.read(e),o.baseResultDiffs.read(e),(u,p)=>u.baseRange.intersectsOrTouches(p.inputRange)?tx.neitherLessOrGreaterThan:jg.compareByStart(u.baseRange,p.inputRange)),l=t.activeModifiedBaseRange.read(e),c=t.showNonConflictingChanges.read(e);for(let u of s){let p=u.left;if(p){let h=["merge-editor-block"],g=[0,0,0,0],f=o.isHandled(p).read(e);if(f&&h.push("handled"),p===l&&(h.push("focused"),g=[0,2,0,2]),p.isConflicting&&h.push("conflicting"),h.push("result"),!p.isConflicting&&!c&&f)continue;let v=o.getLineRangeInResult(p.baseRange,e);r.push({range:v.toInclusiveRangeOrEmpty(),options:{showIfCollapsed:!0,blockClassName:h.join(" "),blockPadding:g,blockIsAfterEnd:v.startLineNumber>n.getLineCount(),description:"Result Diff",minimap:{position:2,color:{id:f?s7:a7}},overviewRuler:p.isConflicting?{position:2,color:{id:f?s7:a7}}:void 0}})}if(!p||p.isConflicting)for(let h of u.rights){let g=h.outputRange.toInclusiveRange();if(g&&r.push({range:g,options:{className:"merge-editor-diff result",description:"Merge Editor",isWholeLine:!0}}),h.rangeMappings)for(let f of h.rangeMappings)r.push({range:f.outputRange,options:{className:"merge-editor-diff-word result",description:"Merge Editor"}})}}return r});this.editor.invokeWithinContext(s=>{let l=s.get(X),c=TNt.bindTo(l);c.set(!0),this._register(ee(()=>c.reset()))}),this.htmlElements.gutterDiv.style.width="5px",this.htmlElements.root.classList.add("result"),this._register(Rl((s,l)=>{this.checkboxesVisible.read(s)&&l.add(new Fse(this.editor,this.htmlElements.gutterDiv,{getIntersectingGutterItems:(c,u)=>[],createView:(c,u)=>{throw new ci}}))})),this._register(ve(s=>{let l=this.viewModel.read(s);l&&(this.editor.setModel(l.model.resultTextModel),Ii(this.htmlElements.title,...ir(d(13412,null))),Ii(this.htmlElements.description,...ir(this._labelService.getUriLabel(l.model.resultTextModel.uri,{relative:!0}))))}));let r=this._register(new oo(this.htmlElements.detail));this._register(ve(s=>{let l=this.viewModel.read(s);if(!l)return;let c=l.model;if(!c)return;let u=c.unhandledConflictsCount.read(s),p=u===1?d(13411,null,u):d(13410,null,u);r.clear(),r.push({class:void 0,enabled:u>0,id:"nextConflict",label:p,run(){l.model.telemetry.reportConflictCounterClicked(),l.goToNextModifiedBaseRange(h=>!c.isHandled(h).read(void 0))},tooltip:u>0?d(13409,null):d(13408,null)})})),this._register(eRe(this.editor,this.decorations)),this._register(BKe(this,(s,l)=>l.model.translateBaseRangeToResult(s))),this._register(t.createInstance(ij,R.MergeInputResultToolbar,this.htmlElements.toolbar))}};GKe=I([m(1,F),m(2,nt),m(3,B)],GKe);var _b=class extends KM{constructor(e,t,o,n,r,s,l,c,u,p,h){super(_b.ID,e,n,t,r,l,s,c,u,p);this.contextKeyService=o;this._codeEditorService=h;this._sessionDisposables=new O,this._viewModel=De(this,void 0),this._grid=this._register(new ue),this.input1View=this._register(this.instantiationService.createInstance(HSe,1,this._viewModel)),this.baseView=De(this,void 0),this.baseViewOptions=De(this,void 0),this.input2View=this._register(this.instantiationService.createInstance(HSe,2,this._viewModel)),this.inputResultView=this._register(this.instantiationService.createInstance(GKe,this._viewModel)),this._layoutMode=this.instantiationService.createInstance(Bse),this._layoutModeObs=De(this,this._layoutMode.value),this._ctxIsMergeEditor=vm.bindTo(this.contextKeyService),this._ctxUsesColumnLayout=pee.bindTo(this.contextKeyService),this._ctxShowBase=iRe.bindTo(this.contextKeyService),this._ctxShowBaseAtTop=cJe.bindTo(this.contextKeyService),this._ctxResultUri=Eco.bindTo(this.contextKeyService),this._ctxBaseUri=DNt.bindTo(this.contextKeyService),this._ctxShowNonConflictingChanges=_Nt.bindTo(this.contextKeyService),this._inputModel=De(this,void 0),this.viewZoneComputer=new w9t(this.input1View.editor,this.input2View.editor,this.inputResultView.editor),this.scrollSynchronizer=this._register(new S9t(this._viewModel,this.input1View,this.input2View,this.baseView,this.inputResultView,this._layoutModeObs)),this._onDidChangeSizeConstraints=this._register(new T),this.onDidChangeSizeConstraints=this._onDidChangeSizeConstraints.event,this.baseViewDisposables=this._register(new O),this.showNonConflictingChangesStore=this.instantiationService.createInstance(ZDe,"mergeEditor/showNonConflictingChanges"),this.showNonConflictingChanges=De(this,this.showNonConflictingChangesStore.get()??!1)}static{this.ID="mergeEditor"}get viewModel(){return this._viewModel}get inputModel(){return this._inputModel}get model(){return this.inputModel.get()?.model}dispose(){this._sessionDisposables.dispose(),this._ctxIsMergeEditor.reset(),this._ctxUsesColumnLayout.reset(),this._ctxShowNonConflictingChanges.reset(),super.dispose()}get minimumWidth(){return this._layoutMode.value.kind==="mixed"?this.input1View.view.minimumWidth+this.input2View.view.minimumWidth:this.input1View.view.minimumWidth+this.input2View.view.minimumWidth+this.inputResultView.view.minimumWidth}getTitle(){return this.input?this.input.getName():d(13413,null)}createEditorControl(e,t){this.rootHtmlElement=e,e.classList.add("merge-editor"),this.applyLayout(this._layoutMode.value),this.applyOptions(t)}updateEditorControlOptions(e){this.applyOptions(e)}applyOptions(e){let t=CNt(e,{minimap:{enabled:!1},glyphMargin:!1,lineNumbersMinChars:2}),o=CNt(t,{readOnly:!0,readOnlyMessage:void 0});this.input1View.updateOptions(o),this.input2View.updateOptions(o),this.baseViewOptions.set({...this.input2View.editor.getRawOptions()},void 0),this.inputResultView.updateOptions(t)}getMainControl(){return this.inputResultView.editor}layout(e){this._grid.value?.layout(e.width,e.height)}async setInput(e,t,o,n){if(!(e instanceof Zb))throw new ci("ONLY MergeEditorInput is supported");await super.setInput(e,t,o,n),this._sessionDisposables.clear(),Ki(g=>{this._viewModel.set(void 0,g),this._inputModel.set(void 0,g)});let r=await e.resolve(),s=r.model,l=this.instantiationService.createInstance(UKe,s,this.input1View,this.input2View,this.inputResultView,this.baseView,this.showNonConflictingChanges);s.telemetry.reportMergeEditorOpened({combinableConflictCount:s.combinableConflictCount,conflictCount:s.conflictCount,baseTop:this._layoutModeObs.get().showBaseAtTop,baseVisible:this._layoutModeObs.get().showBase,isColumnView:this._layoutModeObs.get().kind==="columns"}),Ki(g=>{this._viewModel.set(l,g),this._inputModel.set(r,g)}),this._sessionDisposables.add(l),this._sessionDisposables.add(ve(g=>{let f=l.focusedEditorType.read(g);e instanceof Zb&&e.updateFocusedEditor(f||"result")})),this._ctxResultUri.set(r.resultUri.toString()),this._ctxBaseUri.set(s.base.uri.toString()),this._sessionDisposables.add(ee(()=>{this._ctxBaseUri.reset(),this._ctxResultUri.reset()}));let c=new O;this._sessionDisposables.add(c),this._sessionDisposables.add(Rl(g=>{let f=this.baseView.read(g),v=this.inputResultView.editor.getScrollTop();this.scrollSynchronizer.stopSync(),c.clear(),this.inputResultView.editor.changeViewZones(b=>{let S=this._layoutModeObs.read(g),y=S.kind==="columns",w=S.kind==="mixed"&&!S.showBaseAtTop;this.input1View.editor.changeViewZones(x=>{this.input2View.editor.changeViewZones(E=>{f?f.editor.changeViewZones(M=>{c.add(this.setViewZones(g,l,this.input1View.editor,x,this.input2View.editor,E,f.editor,M,w,this.inputResultView.editor,b,y))}):c.add(this.setViewZones(g,l,this.input1View.editor,x,this.input2View.editor,E,void 0,void 0,!1,this.inputResultView.editor,b,y))})})}),this.inputResultView.editor.setScrollTop(v,0),this.scrollSynchronizer.startSync(),this.scrollSynchronizer.updateScrolling()}));let u=this.loadEditorViewState(e,o);u?this._applyViewState(u):this._sessionDisposables.add(Rvt(s.onInitialized,()=>{let g=s.modifiedBaseRanges.get().find(f=>f.isConflicting);g&&(this.input1View.editor.revealLineInCenter(g.input1Range.startLineNumber),Ki(f=>{l.setActiveModifiedBaseRange(g,f)}))}));let p=g=>{let f=Oie(g,this._codeEditorService);XN(s.input2.textModel,f,this._codeEditorService),XN(s.input1.textModel,f,this._codeEditorService),XN(s.resultTextModel,f,this._codeEditorService);let v=this.baseView.get()?.editor.getModel();v&&XN(v,f,this._codeEditorService)};this._sessionDisposables.add(this._codeEditorService.onDidChangeTransientModelProperty(g=>{p(g)})),p(this.inputResultView.editor.getModel());let h=this;this._sessionDisposables.add(new class{constructor(){this._disposable=new O;for(let g of this.baseInput1Input2())this._disposable.add(g.onDidChangeContent(()=>this._checkBaseInput1Input2AllEmpty()))}dispose(){this._disposable.dispose()}*baseInput1Input2(){yield s.base,yield s.input1.textModel,yield s.input2.textModel}_checkBaseInput1Input2AllEmpty(){for(let g of this.baseInput1Input2())if(g.getValueLength()>0)return;h.editorService.replaceEditors([{editor:e,replacement:{resource:e.result,options:{preserveFocus:!0}},forceReplaceDirty:!0}],h.group)}})}setViewZones(e,t,o,n,r,s,l,c,u,p,h,g){let f=[],v=[],b=[],S=[],y=this.viewZoneComputer.computeViewZones(e,t,{codeLensesVisible:!0,showNonConflictingChanges:this.showNonConflictingChanges.read(e),shouldAlignBase:u,shouldAlignResult:g}),w=new O;if(c)for(let x of y.baseViewZones)x.create(c,b,w);for(let x of y.resultViewZones)x.create(h,S,w);for(let x of y.input1ViewZones)x.create(n,f,w);for(let x of y.input2ViewZones)x.create(s,v,w);return w.add({dispose:()=>{o.changeViewZones(x=>{for(let E of f)x.removeZone(E)}),r.changeViewZones(x=>{for(let E of v)x.removeZone(E)}),l?.changeViewZones(x=>{for(let E of b)x.removeZone(E)}),p.changeViewZones(x=>{for(let E of S)x.removeZone(E)})}}),w}setOptions(e){super.setOptions(e),e&&x_(e,this.inputResultView.editor,0)}clearInput(){super.clearInput(),this._sessionDisposables.clear();for(let{editor:e}of[this.input1View,this.input2View,this.inputResultView])e.setModel(null)}focus(){super.focus(),(this.getControl()??this.inputResultView.editor).focus()}hasFocus(){for(let{editor:e}of[this.input1View,this.input2View,this.inputResultView])if(e.hasTextFocus())return!0;return super.hasFocus()}setEditorVisible(e){super.setEditorVisible(e);for(let{editor:t}of[this.input1View,this.input2View,this.inputResultView])e?t.onVisible():t.onHide();this._ctxIsMergeEditor.set(e)}getControl(){return this.inputResultView.editor}get scopedContextKeyService(){return this.getControl()?.invokeWithinContext(t=>t.get(X))}toggleBase(){this.setLayout({...this._layoutMode.value,showBase:!this._layoutMode.value.showBase})}toggleShowBaseTop(){let e=this._layoutMode.value.showBase&&this._layoutMode.value.showBaseAtTop;this.setLayout({...this._layoutMode.value,showBaseAtTop:!0,showBase:!e})}toggleShowBaseCenter(){let e=this._layoutMode.value.showBase&&!this._layoutMode.value.showBaseAtTop;this.setLayout({...this._layoutMode.value,showBaseAtTop:!1,showBase:!e})}setLayoutKind(e){this.setLayout({...this._layoutMode.value,kind:e})}setLayout(e){let t=this._layoutMode.value;JSON.stringify(t)!==JSON.stringify(e)&&(this.model?.telemetry.reportLayoutChange({baseTop:e.showBaseAtTop,baseVisible:e.showBase,isColumnView:e.kind==="columns"}),this.applyLayout(e))}applyLayout(e){Ki(t=>{if(e.showBase&&!this.baseView.get()){this.baseViewDisposables.clear();let o=this.baseViewDisposables.add(this.instantiationService.createInstance(HKe,this.viewModel));this.baseViewDisposables.add(ve(n=>{let r=this.baseViewOptions.read(n);r&&o.updateOptions(r)})),this.baseView.set(o,t)}else!e.showBase&&this.baseView.get()&&(this.baseView.set(void 0,t),this.baseViewDisposables.clear());e.kind==="mixed"?this.setGrid([e.showBaseAtTop&&e.showBase?{size:38,data:this.baseView.get().view}:void 0,{size:38,groups:[{data:this.input1View.view},!e.showBaseAtTop&&e.showBase?{data:this.baseView.get().view}:void 0,{data:this.input2View.view}].filter(so)},{size:62,data:this.inputResultView.view}].filter(so)):e.kind==="columns"&&this.setGrid([e.showBase?{size:40,data:this.baseView.get().view}:void 0,{size:60,groups:[{data:this.input1View.view},{data:this.inputResultView.view},{data:this.input2View.view}]}].filter(so)),this._layoutMode.value=e,this._ctxUsesColumnLayout.set(e.kind),this._ctxShowBase.set(e.showBase),this._ctxShowBaseAtTop.set(e.showBaseAtTop),this._onDidChangeSizeConstraints.fire(),this._layoutModeObs.set(e,t)})}setGrid(e){let t=-1,o=-1;this._grid.value&&(t=this._grid.value.width,o=this._grid.value.height),this._grid.value=P8.from({orientation:0,size:100,groups:e},{styles:{separatorBorder:this.theme.getColor(Zot)??Ue.transparent},proportionalLayout:!0}),Ii(this.rootHtmlElement,this._grid.value.element),t!==-1&&this._grid.value.layout(t,o)}_applyViewState(e){e&&(this.inputResultView.editor.restoreViewState(e),e.input1State&&this.input1View.editor.restoreViewState(e.input1State),e.input2State&&this.input2View.editor.restoreViewState(e.input2State),e.focusIndex>=0&&[this.input1View.editor,this.input2View.editor,this.inputResultView.editor][e.focusIndex].focus())}computeEditorViewState(e){if(!ze(this.inputModel.get()?.resultUri,e))return;let t=this.inputResultView.editor.saveViewState();if(!t)return;let o=this.input1View.editor.saveViewState()??void 0,n=this.input2View.editor.saveViewState()??void 0,r=[this.input1View.editor,this.input2View.editor,this.inputResultView.editor].findIndex(s=>s.hasWidgetFocus());return{...t,input1State:o,input2State:n,focusIndex:r}}tracksEditorViewState(e){return e instanceof Zb}toggleShowNonConflictingChanges(){this.showNonConflictingChanges.set(!this.showNonConflictingChanges.get(),void 0),this.showNonConflictingChangesStore.set(this.showNonConflictingChanges.get()),this._ctxShowNonConflictingChanges.set(this.showNonConflictingChanges.get())}};_b=I([m(1,F),m(2,X),m(3,_e),m(4,de),m(5,Pe),m(6,Gn),m(7,ie),m(8,kt),m(9,ge),m(10,Qt)],_b);var Bse=class{constructor(i){this._storageService=i;this._value={kind:"mixed",showBase:!1,showBaseAtTop:!0};let e=i.get(Bse._key,0,"mixed");if(e==="mixed"||e==="columns")this._value={kind:e,showBase:!1,showBaseAtTop:!0};else if(e)try{this._value=JSON.parse(e)}catch(t){mt(t)}}static{this._key="mergeEditor/layout"}get value(){return this._value}set value(i){this._value!==i&&(this._value=i,this._storageService.store(Bse._key,JSON.stringify(this._value),0,0))}};Bse=I([m(0,de)],Bse);var qKe=class extends k{constructor(e,t){super();this._editorService=e;this._store.add(t.registerCodeEditorOpenHandler(this.openCodeEditorFromMergeEditor.bind(this)))}async openCodeEditorFromMergeEditor(e,t,o){let n=this._editorService.activeEditorPane;if(!o&&e.options&&n instanceof _b&&n.getControl()&&n.input instanceof Zb&&ze(e.resource,n.input.result)){let r=n.getControl();return x_(e.options,r,0),r}return null}};qKe=I([m(0,ie),m(1,Qt)],qKe);var USe=class extends k{static{this.ID="workbench.contrib.mergeEditorResolver"}constructor(i,e){super();let t=o=>({editor:e.createInstance(Zb,o.base.resource,{uri:o.input1.resource,title:o.input1.label??Be(o.input1.resource),description:o.input1.description??"",detail:o.input1.detail},{uri:o.input2.resource,title:o.input2.label??Be(o.input2.resource),description:o.input2.description??"",detail:o.input2.detail},o.result.resource)});this._register(i.registerEditor("*",{id:Da.id,label:Da.displayName,detail:Da.providerDisplayName,priority:"builtin"},{},{createMergeEditorInput:t}))}};USe=I([m(0,il),m(1,F)],USe);var BO=class extends z{constructor(i){super(i)}run(i){let{activeEditorPane:e}=i.get(ie);if(e instanceof _b){let t=e.viewModel.get();if(!t)return;this.runWithViewModel(t,i)}}},ipt=class extends z{constructor(i){super(i)}run(i,...e){let{activeEditorPane:t}=i.get(ie);if(t instanceof _b){let o=t.viewModel.get();return o?this.runWithMergeEditor({viewModel:o,inputModel:t.inputModel.get(),input:t.input,editorIdentifier:{editor:t.input,groupId:t.group.id}},i,...e):void 0}}},C9t=class extends z{constructor(){super({id:"_open.mergeEditor",title:P(13309,"Open Merge Editor")})}run(i,...e){let t=MOo.validate(e[0]),o={base:{resource:t.base},input1:{resource:t.input1.uri,label:t.input1.title,description:t.input1.description,detail:t.input1.detail},input2:{resource:t.input2.uri,label:t.input2.title,description:t.input2.description,detail:t.input2.detail},result:{resource:t.output},options:{preserveFocus:!0}};i.get(ie).openEditor(o)}},MOo;(o=>{function a(n){if(!n||typeof n!="object")throw new TypeError("invalid argument");let r=n,s=e(r.base),l=e(r.output),c=i(r.input1),u=i(r.input2);return{base:s,input1:c,input2:u,output:l}}o.validate=a;function i(n){if(typeof n=="string")return new $3(A.parse(n,!0),void 0,void 0,void 0);if(!n||typeof n!="object")throw new TypeError("invalid argument");if(t(n))return new $3(A.revive(n),void 0,void 0,void 0);let r=n,s=r.title,l=e(r.uri),c=r.detail,u=r.description;return new $3(l,s,c,u)}function e(n){if(typeof n=="string")return A.parse(n,!0);if(n&&typeof n=="object")return A.revive(n);throw new TypeError("invalid argument")}function t(n){if(!n||typeof n!="object")return!1;let r=n;return typeof r.scheme=="string"&&typeof r.authority=="string"&&typeof r.path=="string"&&typeof r.query=="string"&&typeof r.fragment=="string"}})(MOo||={});var x9t=class extends z{constructor(){super({id:"merge.mixedLayout",title:P(13283,"Mixed Layout"),toggled:pee.isEqualTo("mixed"),menu:[{id:R.EditorTitle,when:vm,group:"1_merge",order:9}],precondition:vm})}run(i){let{activeEditorPane:e}=i.get(ie);e instanceof _b&&e.setLayoutKind("mixed")}},k9t=class extends z{constructor(){super({id:"merge.columnLayout",title:P(13282,"Column Layout"),toggled:pee.isEqualTo("columns"),menu:[{id:R.EditorTitle,when:vm,group:"1_merge",order:10}],precondition:vm})}run(i){let{activeEditorPane:e}=i.get(ie);e instanceof _b&&e.setLayoutKind("columns")}},E9t=class extends z{constructor(){super({id:"merge.showNonConflictingChanges",title:P(13308,"Show Non-Conflicting Changes"),toggled:_Nt.isEqualTo(!0),menu:[{id:R.EditorTitle,when:vm,group:"3_merge",order:9}],precondition:vm})}run(i){let{activeEditorPane:e}=i.get(ie);e instanceof _b&&e.toggleShowNonConflictingChanges()}},T9t=class extends z{constructor(){super({id:"merge.showBase",title:P(13284,"Show Base"),toggled:iRe.isEqualTo(!0),menu:[{id:R.EditorTitle,when:C.and(vm,pee.isEqualTo("columns")),group:"2_merge",order:9}]})}run(i){let{activeEditorPane:e}=i.get(ie);e instanceof _b&&e.toggleBase()}},_9t=class extends z{constructor(){super({id:"merge.showBaseTop",title:P(13286,"Show Base Top"),toggled:C.and(iRe,cJe),menu:[{id:R.EditorTitle,when:C.and(vm,pee.isEqualTo("mixed")),group:"2_merge",order:10}]})}run(i){let{activeEditorPane:e}=i.get(ie);e instanceof _b&&e.toggleShowBaseTop()}},D9t=class extends z{constructor(){super({id:"merge.showBaseCenter",title:P(13285,"Show Base Center"),toggled:C.and(iRe,cJe.negate()),menu:[{id:R.EditorTitle,when:C.and(vm,pee.isEqualTo("mixed")),group:"2_merge",order:11}]})}run(i){let{activeEditorPane:e}=i.get(ie);e instanceof _b&&e.toggleShowBaseCenter()}},cL=P(13294,"Merge Editor"),R9t=class extends BO{constructor(){super({id:"merge.openResult",icon:L.goToFile,title:P(13307,"Open File"),category:cL,menu:[{id:R.EditorTitle,when:vm,group:"navigation",order:1}],precondition:vm})}runWithViewModel(i,e){e.get(ie).openEditor({resource:i.model.resultTextModel.uri})}},L9t=class extends BO{constructor(){super({id:"merge.goToNextUnhandledConflict",category:cL,title:P(13289,"Go to Next Unhandled Conflict"),icon:L.arrowDown,menu:[{id:R.EditorTitle,when:vm,group:"navigation",order:3}],f1:!0,precondition:vm})}runWithViewModel(i){i.model.telemetry.reportNavigationToNextConflict(),i.goToNextModifiedBaseRange(e=>!i.model.isHandled(e).get())}},M9t=class extends BO{constructor(){super({id:"merge.goToPreviousUnhandledConflict",category:cL,title:P(13290,"Go to Previous Unhandled Conflict"),icon:L.arrowUp,menu:[{id:R.EditorTitle,when:vm,group:"navigation",order:2}],f1:!0,precondition:vm})}runWithViewModel(i){i.model.telemetry.reportNavigationToPreviousConflict(),i.goToPreviousModifiedBaseRange(e=>!i.model.isHandled(e).get())}},P9t=class extends BO{constructor(){super({id:"merge.toggleActiveConflictInput1",category:cL,title:P(13292,"Toggle Current Conflict from Left"),f1:!0,precondition:vm})}runWithViewModel(i){i.toggleActiveConflict(1)}},A9t=class extends BO{constructor(){super({id:"merge.toggleActiveConflictInput2",category:cL,title:P(13293,"Toggle Current Conflict from Right"),f1:!0,precondition:vm})}runWithViewModel(i){i.toggleActiveConflict(2)}},N9t=class extends BO{constructor(){super({id:"mergeEditor.compareInput1WithBase",category:cL,title:P(13300,"Compare Input 1 With Base"),shortTitle:d(13302,null),f1:!0,precondition:vm,menu:{id:R.MergeInput1Toolbar,group:"primary"},icon:L.compareChanges})}runWithViewModel(i,e){let t=e.get(ie);POo(i,t,1)}},O9t=class extends BO{constructor(){super({id:"mergeEditor.compareInput2WithBase",category:cL,title:P(13301,"Compare Input 2 With Base"),shortTitle:d(13302,null),f1:!0,precondition:vm,menu:{id:R.MergeInput2Toolbar,group:"primary"},icon:L.compareChanges})}runWithViewModel(i,e){let t=e.get(ie);POo(i,t,2)}};async function POo(a,i,e){i.openEditor(i.activeEditor,{pinned:!0});let o=a.model.base,n=e===1?a.inputCodeEditorView1.editor:a.inputCodeEditorView2.editor,r=n.getPosition().lineNumber;await i.openEditor({original:{resource:o.uri},modified:{resource:n.getModel().uri},options:{selection:{startLineNumber:r,startColumn:1},revealIfOpened:!0,revealIfVisible:!0}})}var F9t=class extends BO{constructor(){super({id:"merge.openBaseEditor",category:cL,title:P(13291,"Open Base File"),f1:!0,precondition:vm})}runWithViewModel(i,e){e.get(Je).open(i.model.base.uri)}},W9t=class extends BO{constructor(){super({id:"merge.acceptAllInput1",category:cL,title:P(13287,"Accept All Incoming Changes from Left"),f1:!0,precondition:vm,menu:{id:R.MergeInput1Toolbar,group:"primary"},icon:L.checkAll})}runWithViewModel(i){i.acceptAll(1)}},V9t=class extends BO{constructor(){super({id:"merge.acceptAllInput2",category:cL,title:P(13288,"Accept All Current Changes from Right"),f1:!0,precondition:vm,menu:{id:R.MergeInput2Toolbar,group:"primary"},icon:L.checkAll})}runWithViewModel(i){i.acceptAll(2)}},B9t=class extends BO{constructor(){super({id:"mergeEditor.resetResultToBaseAndAutoMerge",category:cL,title:P(13304,"Reset Result"),shortTitle:d(13305,null),f1:!0,precondition:vm,menu:{id:R.MergeInputResultToolbar,group:"primary"},icon:L.discard})}runWithViewModel(i,e){i.model.reset()}},H9t=class extends z{constructor(){super({id:"mergeEditor.resetCloseWithConflictsChoice",category:cL,title:P(13303,"Reset Choice for 'Close with Conflicts'"),f1:!0})}run(i){i.get(de).remove(dJe,0)}},U9t=class extends ipt{constructor(){super({id:"mergeEditor.acceptAllCombination",category:cL,title:P(13295,"Accept All Combination"),f1:!0})}runWithMergeEditor(i,e,...t){let{viewModel:o}=i,n=o.model.modifiedBaseRanges.get(),r=o.model;return Ki(s=>{for(let l of n){let c=r.getState(l).get();c.kind!==4&&!c.isInputIncluded(1)&&(!c.isInputIncluded(2)||!o.shouldUseAppendInsteadOfAccept.get())&&l.canBeCombined&&(r.setState(l,c.withInputValue(1,!0).withInputValue(2,!0,!0),!0,s),r.telemetry.reportSmartCombinationInvoked(c.includesInput(2)))}}),{success:!0}}},z9t=class extends ipt{constructor(){super({id:"mergeEditor.acceptMerge",category:cL,title:P(13296,"Complete Merge"),f1:!0,precondition:vm,keybinding:[{primary:2051,weight:100,when:vm}]})}async runWithMergeEditor({inputModel:i,editorIdentifier:e,viewModel:t},o){let n=o.get(ct),r=o.get(ie);if(t.model.unhandledConflictsCount.get()>0){let{confirmed:s}=await n.confirm({message:d(13299,null,Be(i.resultUri)),detail:d(13298,null),primaryButton:d(13297,null)});if(!s)return{successful:!1}}return await i.accept(),await r.closeEditor(e),{successful:!0}}},K9t=class extends ipt{constructor(){super({id:"mergeEditor.toggleBetweenInputs",category:cL,title:P(13306,"Toggle Between Merge Editor Inputs"),f1:!0,precondition:vm,keybinding:[{primary:3122,weight:210,when:vm}]})}runWithMergeEditor({viewModel:i},e){i.inputCodeEditorView1.editor.hasWidgetFocus()?i.inputCodeEditorView2.editor.focus():i.inputCodeEditorView1.editor.focus()}};var fKi=P(13313,"Merge Editor (Dev)"),G9t=class extends z{constructor(){super({id:"merge.dev.copyContentsJson",category:fKi,title:P(13310,"Copy Merge Editor State as JSON"),icon:L.layoutCentered,f1:!0,precondition:vm})}run(i){let{activeEditorPane:e}=i.get(ie),t=i.get(Bi),o=i.get(Ne);if(!(e instanceof _b)){o.info({name:d(13314,null),message:d(13315,null)});return}let n=e.model;if(!n)return;let r={languageId:n.resultTextModel.getLanguageId(),base:n.base.getValue(),input1:n.input1.textModel.getValue(),input2:n.input2.textModel.getValue(),result:n.resultTextModel.getValue(),initialResult:n.getInitialResultValue()},s=JSON.stringify(r,void 0,4);t.writeText(s),o.info({name:d(13314,null),message:d(13317,null)})}},q9t=class extends z{constructor(){super({id:"merge.dev.saveContentsToFolder",category:fKi,title:P(13312,"Save Merge Editor State to Folder"),icon:L.layoutCentered,f1:!0,precondition:vm})}async run(i){let{activeEditorPane:e}=i.get(ie),t=i.get(Ne),o=i.get(nn),n=i.get(ge),r=i.get(Rt);if(!(e instanceof _b)){t.info({name:d(13314,null),message:d(13315,null)});return}let s=e.model;if(!s)return;let l=await o.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(13316,null)});if(!l)return;let c=l[0],u=r.getExtensions(s.resultTextModel.getLanguageId())[0]||"";async function p(h,g){await n.writeFile(A.joinPath(c,h+u),Ke.fromString(g),{})}await Promise.all([p("base",s.base.getValue()),p("input1",s.input1.textModel.getValue()),p("input2",s.input2.textModel.getValue()),p("result",s.resultTextModel.getValue()),p("initialResult",s.getInitialResultValue())]),t.info({name:d(13314,null),message:d(13318,null)})}},$9t=class extends z{constructor(){super({id:"merge.dev.loadContentsFromFolder",category:fKi,title:P(13311,"Load Merge Editor State from Folder"),icon:L.layoutCentered,f1:!0})}async run(i,e){let t=i.get(nn),o=i.get(ie),n=i.get(ge),r=i.get($e);e||(e={});let s;if(e.folderUri)s=e.folderUri;else{let b=await t.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,title:d(13316,null)});if(!b)return;s=b[0]}let l=await n.resolve(s);function c(b){return l.children.find(S=>S.name.startsWith(b))?.resource}let u=await Akn(r,e.resultState),p=c("base"),h=c("input1"),g=c("input2"),f=c(u?"initialResult":"result"),v={base:{resource:p},input1:{resource:h,label:"Input 1",description:"Input 1",detail:"(from file)"},input2:{resource:g,label:"Input 2",description:"Input 2",detail:"(from file)"},result:{resource:f}};o.openEditor(v)}};async function Akn(a,i){return i?i==="initial":(await a.pick([{label:"result",result:!1},{label:"initial result",result:!0}],{canPickMany:!1}))?.result}var j9t=class{canSerialize(){return!0}serialize(i){return JSON.stringify(this.toJSON(i))}toJSON(i){return{base:i.base,input1:i.input1,input2:i.input2,result:i.result}}deserialize(i,e){try{let t=Dm(e);return i.createInstance(Zb,t.base,new $3(t.input1.uri,t.input1.title,t.input1.detail,t.input1.description),new $3(t.input2.uri,t.input2.title,t.input2.detail,t.input2.description),t.result)}catch(t){mt(t);return}}};var Q9t=class{constructor(){this.name="mergeEditor";this.type="help";this.priority=125;this.when=CB.create("isMergeEditor",!0)}getProvider(i){let e=i.get(Qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=[d(13322,null),d(13323,null,"<keybinding:merge.goToNextUnhandledConflict>","<keybinding:merge.goToPreviousUnhandledConflict>"),d(13324,null,"<keybinding:merge.acceptAllInput1>","<keybinding:merge.acceptAllInput2>"),d(13325,null,"<keybinding:mergeEditor.acceptMerge>"),d(13326,null,"<keybinding:mergeEditor.toggleBetweenInputs>")];return new qp("mergeEditor",{type:"help"},()=>o.join(`
`),()=>t.focus(),"accessibility.verbosity.mergeEditor")}};oe.as(en.EditorPane).registerEditorPane(os.create(_b,_b.ID,d(13321,null)),[new Vt(Zb)]);oe.as(en.EditorFactory).registerEditorSerializer(Zb.ID,j9t);oe.as($t.Configuration).registerConfiguration({properties:{"mergeEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:"advanced",markdownEnumDescriptions:[d(13320,null),d(13319,null)]},"mergeEditor.showDeletionMarkers":{type:"boolean",default:!0,description:"Controls if deletions in base or one of the inputs should be indicated by a vertical bar."}}});W(R9t);W(x9t);W(k9t);W(C9t);W(F9t);W(E9t);W(T9t);W(_9t);W(D9t);W(L9t);W(M9t);W(P9t);W(A9t);W(N9t);W(O9t);W(W9t);W(V9t);W(B9t);W(z9t);W(H9t);W(U9t);W(K9t);W(G9t);W(q9t);W($9t);oe.as(Zi.Workbench).registerWorkbenchContribution(qKe,3);bt(USe.ID,USe,vt.BlockStartup);_a.register(new Q9t);var Y9t=class extends z{constructor(){super({id:"multiDiffEditor.goToFile",title:P(13441,"Open File"),icon:L.goToFile,precondition:Tr.isEqualTo(_f.ID),menu:{when:Tr.isEqualTo(_f.ID),id:R.MultiDiffEditorFileToolbar,order:22,group:"navigation"}})}async run(i,...e){let t=e[0],o=i.get(ie),n=o.activeEditorPane,r;if(!(n instanceof _f))return;let s=n.tryGetCodeEditor(t);s&&(r=s.editor.getSelections()??void 0);let l=t,c=n.findDocumentDiffItem(t);c&&c.goToFileUri&&(l=c.goToFileUri),await o.openEditor({label:c?.goToFileEditorTitle,resource:l,options:{selection:r?.[0],selectionRevealType:1}})}},X9t=class extends z{constructor(){super({id:"multiDiffEditor.goToNextChange",title:P(13442,"Go to Next Change"),icon:L.arrowDown,precondition:C.equals("activeEditor",_f.ID),menu:[R.EditorTitle,R.CompactWindowEditorTitle].map(i=>({id:i,when:C.equals("activeEditor",_f.ID),group:"navigation",order:2})),keybinding:{primary:575,weight:100,when:C.equals("activeEditor",_f.ID)},f1:!0})}async run(i){let t=i.get(ie).activeEditorPane;t instanceof _f&&t.goToNextChange()}},J9t=class extends z{constructor(){super({id:"multiDiffEditor.goToPreviousChange",title:P(13443,"Go to Previous Change"),icon:L.arrowUp,precondition:C.equals("activeEditor",_f.ID),menu:[R.EditorTitle,R.CompactWindowEditorTitle].map(i=>({id:i,when:C.equals("activeEditor",_f.ID),group:"navigation",order:1})),keybinding:{primary:1599,weight:100,when:C.equals("activeEditor",_f.ID)},f1:!0})}async run(i){let t=i.get(ie).activeEditorPane;t instanceof _f&&t.goToPreviousChange()}},Z9t=class extends z{constructor(){super({id:"multiDiffEditor.collapseAll",title:P(13439,"Collapse All Diffs"),icon:L.collapseAll,precondition:C.and(C.equals("activeEditor",_f.ID),C.not("multiDiffEditorAllCollapsed")),menu:[R.EditorTitle,R.CompactWindowEditorTitle].map(i=>({id:i,when:C.and(C.equals("activeEditor",_f.ID),C.not("multiDiffEditorAllCollapsed")),group:"navigation",order:100})),f1:!0})}async run(i,...e){let o=Zp(e,i.get(ie),i.get(kt),i.get(Co)).groupedEditors[0];if(!o)return;let n=o.editors[0];n instanceof Ou&&(await n.getViewModel()).collapseAll()}},e7t=class extends z{constructor(){super({id:"multiDiffEditor.expandAll",title:P(13440,"Expand All Diffs"),icon:L.expandAll,precondition:C.and(C.equals("activeEditor",_f.ID),C.has("multiDiffEditorAllCollapsed")),menu:[R.EditorTitle,R.CompactWindowEditorTitle].map(i=>({id:i,when:C.and(C.equals("activeEditor",_f.ID),C.has("multiDiffEditorAllCollapsed")),group:"navigation",order:100})),f1:!0})}async run(i,...e){let o=Zp(e,i.get(ie),i.get(kt),i.get(Co)).groupedEditors[0];if(!o)return;let n=o.editors[0];n instanceof Ou&&(await n.getViewModel()).expandAll()}};W(Y9t);W(X9t);W(J9t);W(Z9t);W(e7t);Ce(rG,LNt,1);bt(ume.ID,ume,vt.BlockStartup);oe.as(en.EditorPane).registerEditorPane(os.create(_f,_f.ID,d(13445,null)),[new Vt(Ou)]);oe.as(en.EditorFactory).registerEditorSerializer(Ou.ID,MNt);W($Le);bt(rhe.ID,rhe,vt.BlockStartup);var vKi=class extends z{constructor(){super({id:"runCommands",title:P(10225,"Run Commands"),f1:!1,metadata:{description:d(10227,null),args:[{name:"args",schema:{type:"object",required:["commands"],properties:{commands:{type:"array",description:d(10226,null),items:{anyOf:[{$ref:"vscode://schemas/keybindings#/definitions/commandNames"},{type:"string"},{type:"object",required:["command"],properties:{command:{anyOf:[{$ref:"vscode://schemas/keybindings#/definitions/commandNames"},{type:"string"}]}},$ref:"vscode://schemas/keybindings#/definitions/commandsSchemas"}]}}}}}]}})}async run(i,e){let t=i.get(Ne);if(!this._isCommandArgs(e)){t.error(d(10228,null));return}if(e.commands.length===0){t.warn(d(10229,null));return}let o=i.get(fe),n=i.get(re),r=0;try{for(;r<e.commands.length;++r){let s=e.commands[r];n.debug(`runCommands: executing ${r}-th command: ${gF(s)}`),await this._runCommand(o,s),n.debug(`runCommands: executed ${r}-th command`)}}catch(s){n.debug(`runCommands: executing ${r}-th command resulted in an error: ${s instanceof Error?s.message:gF(s)}`),t.error(s)}}_isCommandArgs(i){if(!i||typeof i!="object"||!("commands"in i)||!Array.isArray(i.commands))return!1;for(let e of i.commands)if(typeof e!="string"&&!(typeof e=="object"&&typeof e.command=="string"))return!1;return!0}_runCommand(i,e){let t,o;return typeof e=="string"?t=e:(t=e.command,o=e.args),o===void 0?i.executeCommand(t):Array.isArray(o)?i.executeCommand(t,...o):i.executeCommand(t,o)}};W(vKi);var zSe=class extends k{constructor(e,t,o,n){super();this._modelService=o;this._languageService=n;this._register(e.registerTextModelContentProvider(Q.commentsInput,this)),this._register(t.registerCodeEditorOpenHandler(async(r,s,l)=>!(s instanceof gR)||s.getModel()?.uri.toString()!==r.resource.toString()?null:(r.options&&x_(r.options,s,1),s)))}static{this.ID="comments.input.contentProvider"}async provideTextContent(e){return this._modelService.getModel(e)??this._modelService.createModel("",this._languageService.createById("markdown"),e)}};zSe=I([m(0,Bt),m(1,Qt),m(2,_t),m(3,Rt)],zSe);Eo(ECi,Qx,1);bt(zSe.ID,zSe,vt.BlockRestore);xt.registerCommandAndKeybindingRule({id:"editor.action.nextCommentThreadAction",handler:async(a,i)=>{let e=Hse(a);if(!e)return Promise.resolve();let t=Qx.get(e);if(!t)return Promise.resolve();t.nextCommentThread(!0)},weight:100,primary:579});xt.registerCommandAndKeybindingRule({id:"editor.action.previousCommentThreadAction",handler:async(a,i)=>{let e=Hse(a);if(!e)return Promise.resolve();let t=Qx.get(e);if(!t)return Promise.resolve();t.previousCommentThread(!0)},weight:100,primary:1603});W(class extends z{constructor(){super({id:"editor.action.nextCommentedRangeAction",title:{value:d(10298,null),original:"Go to Next Commented Range"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.activeEditorHasCommentingRange}],keybinding:{primary:580,weight:100,when:jc.activeEditorHasCommentingRange}})}run(a,...i){let e=Hse(a);if(!e)return;let t=Qx.get(e);t&&t.nextCommentThread(!1)}});W(class extends z{constructor(){super({id:"editor.action.previousCommentedRangeAction",title:{value:d(10300,null),original:"Go to Previous Commented Range"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.activeEditorHasCommentingRange}],keybinding:{primary:1604,weight:100,when:jc.activeEditorHasCommentingRange}})}run(a,...i){let e=Hse(a);if(!e)return;let t=Qx.get(e);t&&t.previousCommentThread(!1)}});W(class extends z{constructor(){super({id:"editor.action.nextCommentingRange",title:{value:d(10299,null),original:"Go to Next Commenting Range"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.activeEditorHasCommentingRange}],keybinding:{primary:Gi(2089,2578),weight:100,when:C.and(Oa,C.or(me.focus,jc.commentFocused,C.and(jx,Fu.isEqualTo("comments"))))}})}run(a,i){let e=Hse(a);if(!e)return;let t=Qx.get(e);t&&t.nextCommentingRange()}});W(class extends z{constructor(){super({id:"editor.action.previousCommentingRange",title:{value:d(10301,null),original:"Go to Previous Commenting Range"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.activeEditorHasCommentingRange}],keybinding:{primary:Gi(2089,2576),weight:100,when:C.and(Oa,C.or(me.focus,jc.commentFocused,C.and(jx,Fu.isEqualTo("comments"))))}})}async run(a,...i){let e=Hse(a);if(!e)return;let t=Qx.get(e);t&&t.previousCommentingRange()}});W(class extends z{constructor(){super({id:"workbench.action.toggleCommenting",title:{value:d(10302,null),original:"Toggle Editor Commenting"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(Wm),t=e.isCommentingEnabled;e.enableCommenting(!t)}});W(class extends z{constructor(){super({id:"workbench.action.addComment",title:{value:d(10292,null),original:"Add Comment on Current Selection"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.activeCursorHasCommentingRange}],keybinding:{primary:Gi(2089,2593),weight:100,when:jc.activeCursorHasCommentingRange}})}async run(a,i){let e=Hse(a);if(!e)return;let t=Qx.get(e);if(!t)return;let o=i?.range?new G(i.range.startLineNumber,i.range.startLineNumber,i.range.endLineNumber,i.range.endColumn):i?.fileComment?void 0:e.getSelection();await t.addOrToggleCommentAtLine(o,void 0)}});W(class extends z{constructor(){super({id:"workbench.action.focusCommentOnCurrentLine",title:{value:d(10297,null),original:"Focus Comment on Current Line"},category:{value:d(10303,null),original:"Comments"},f1:!0,precondition:jc.activeCursorHasComment})}async run(a,...i){let e=Hse(a);if(!e)return;let t=Qx.get(e);if(!t)return;let o=e.getSelection(),n=a.get(Ne),r=!1;try{let s=t.getCommentsAtLine(o);s.length===0?r=!0:await t.revealCommentThread(s[0].commentThread.threadId,void 0,!1,1)}catch{r=!0}r&&n.error(d(10296,null))}});function bKi(a,i){for(let e of a.commentsModel.resourceCommentThreads)for(let t of e.commentThreads)t.thread.collapsibleState=i(t.thread)}W(class extends z{constructor(){super({id:"workbench.action.collapseAllComments",title:{value:d(10293,null),original:"Collapse All Comments"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(Wm);bKi(e,()=>0)}});W(class extends z{constructor(){super({id:"workbench.action.expandAllComments",title:{value:d(10294,null),original:"Expand All Comments"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(Wm);bKi(e,()=>1)}});W(class extends z{constructor(){super({id:"workbench.action.expandUnresolvedComments",title:{value:d(10295,null),original:"Expand Unresolved Comments"},category:{value:d(10303,null),original:"Comments"},menu:[{id:R.CommandPalette,when:jc.WorkspaceHasCommenting}]})}run(a,...i){let e=a.get(Wm);bKi(e,t=>t.state===0?1:0)}});xt.registerCommandAndKeybindingRule({id:"editor.action.submitComment",weight:100,primary:2051,when:dLe,handler:(a,i)=>{let e=a.get(Qt).getFocusedCodeEditor();e instanceof gR&&e.getParentThread().submitComment()}});xt.registerCommandAndKeybindingRule({id:"workbench.action.hideComment",weight:100,primary:9,secondary:[1033],when:C.or(dLe,jc.commentFocused),handler:async(a,i)=>{let e=a.get(Qt).getFocusedCodeEditor(),t=a.get(Le),o=a.get(Ne),n=a.get(Wm);if(await t.enableKeybindingHoldMode("workbench.action.hideComment"),e instanceof gR)e.getParentThread().collapse();else if(e){let r=Qx.get(e);if(!r)return;let s=!1;try{let l=n.lastActiveCommentcontroller?.activeComment;l?r.collapseAndFocusRange(l.thread.threadId):s=!0}catch{s=!0}s&&o.error(d(10296,null))}}});xt.registerCommandAndKeybindingRule({id:"workbench.action.hideComment",weight:100,primary:2057,win:{primary:513},when:C.and(me.focus,jc.commentWidgetVisible),handler:async(a,i)=>{let e=a.get(Qt).getFocusedCodeEditor();if(await a.get(Le).enableKeybindingHoldMode("workbench.action.hideComment"),e){let o=Qx.get(e);o&&await o.collapseVisibleComments()}}});function Hse(a){let i=a.get(ie).activeTextEditorControl;return Lc(i)&&(i.getOriginalEditor().hasTextFocus()?i=i.getOriginalEditor():i=i.getModifiedEditor()),!fn(i)||!i.hasModel()?null:i}var t7t=class extends k{constructor(){super();this.priority=90;this.name="comment";this.when=WCi;this.type="view"}getProvider(e){let t=e.get(X),o=e.get(Gt),n=e.get(Yt),r=o.getActiveViewWithId(gp),s=r?.focusedCommentNode;if(!r||!s)return;let l=this._register(new Nme(n));return l.setContextKeyService(t),new SKi(r,s,l)}},i7t=class extends k{constructor(){super();this.priority=85;this.name="commentThread";this.when=jc.commentFocused;this.type="view"}getProvider(e){let t=e.get(Wm),o=e.get(ie),n=e.get(gt);if(t.commentsModel.hasCommentThreads())return new opt(t,o,n)}},SKi=class extends k{constructor(e,t,o){super();this._commentsView=e;this._focusedCommentNode=t;this._menus=o;this.id="comments";this.verbositySettingKey="accessibility.verbosity.comments";this.options={type:"view"};this.actions=[...this._menus.getResourceContextActions(this._focusedCommentNode)].filter(n=>n.enabled).map(n=>({...n,run:()=>{this._commentsView.focus(),n.run({thread:this._focusedCommentNode.thread,$mid:7,commentControlHandle:this._focusedCommentNode.controllerHandle,commentThreadHandle:this._focusedCommentNode.threadHandle})}}))}provideContent(){let e=this._commentsView.focusedCommentNode,t=this._commentsView.focusedCommentInfo?.toString();if(!e||!t)throw new Error("Comment tree is focused but no comment is selected");return t}onClose(){this._commentsView.focus()}provideNextContent(){return this._commentsView.focusNextNode(),this.provideContent()}providePreviousContent(){return this._commentsView.focusPreviousNode(),this.provideContent()}},opt=class extends k{constructor(e,t,o){super();this._commentService=e;this._editorService=t;this._uriIdentityService=o;this.id="commentThread";this.verbositySettingKey="accessibility.verbosity.comments";this.options={type:"view"}}get activeCommentInfo(){return!this._activeCommentInfo&&this._commentService.lastActiveCommentcontroller&&(this._activeCommentInfo=this._commentService.lastActiveCommentcontroller.activeComment),this._activeCommentInfo}provideContent(){if(!this.activeCommentInfo)throw new Error("No current comment thread");let e=this.activeCommentInfo.comment?.body,t=typeof e=="string"?e:e?.value??"",o=this.activeCommentInfo.thread.resource,n=this.activeCommentInfo.thread.range,r="";if(o&&n){let s=this._editorService.findEditors(A.parse(o))||[],l=this._editorService.activeEditorPane?.getControl();if(s?.length&&fn(l)){let c=l.getModel()?.getValueInRange(n);c&&(r=`
Corresponding code: 
`+c)}}return t+r}onClose(){let e=this._activeCommentInfo;this._activeCommentInfo=void 0,e&&Yee(this._commentService,this._editorService,this._uriIdentityService,e.thread,e.comment)}provideNextContent(){let e=TCi(this._activeCommentInfo,"next");if(e)return this._activeCommentInfo=e,this.provideContent()}providePreviousContent(){let e=TCi(this._activeCommentInfo,"previous");if(e)return this._activeCommentInfo=e,this.provideContent()}};opt=I([m(0,Wm),m(1,ie),m(2,gt)],opt);var dL;(h=>(h.intro=d(10275,null),h.tabFocus=d(10276,null,`<keybinding:${r7e.ID}>`),h.commentCommands=d(10273,null),h.escape=d(10274,null,"<keybinding:workbench.action.hideComment>"),h.nextRange=d(10277,null,"<keybinding:editor.action.nextCommentingRange>"),h.previousRange=d(10280,null,"<keybinding:editor.action.previousCommentingRange>"),h.nextCommentThread=d(10279,null,"<keybinding:editor.action.nextCommentThreadAction>"),h.previousCommentThread=d(10282,null,"<keybinding:editor.action.previousCommentThreadAction>"),h.nextCommentedRange=d(10278,null,"<keybinding:editor.action.nextCommentedRangeAction>"),h.previousCommentedRange=d(10281,null,"<keybinding:editor.action.previousCommentedRangeAction>"),h.addComment=d(10272,null,"<keybinding:workbench.action.addComment>"),h.submitComment=d(10283,null,"<keybinding:editor.action.submitComment>")))(dL||={});var IKi=class extends k{constructor(){super(...arguments);this.id="comments";this.verbositySettingKey="accessibility.verbosity.comments";this.options={type:"help"}}provideContent(){return[dL.tabFocus,dL.commentCommands,dL.escape,dL.addComment,dL.submitComment,dL.nextRange,dL.previousRange].join(`
`)}onClose(){this._element?.focus()}},o7t=class{constructor(){this.priority=110;this.name="comments";this.type="help";this.when=C.or(dLe,jc.commentFocused)}getProvider(i){return i.get(F).createInstance(IKi)}};W(class extends rr{constructor(){super({viewId:gp,id:"comments.collapse",title:d(10253,null),f1:!1,icon:L.collapseAll,menu:{id:R.ViewTitle,group:"navigation",when:C.and(C.and(C.equals("view",gp),XFt),JFt),order:100}})}runInView(i,e){e.collapseAll()}});W(class extends rr{constructor(){super({viewId:gp,id:"comments.expand",title:d(10267,null),f1:!1,icon:L.expandAll,menu:{id:R.ViewTitle,group:"navigation",when:C.and(C.and(C.equals("view",gp),XFt),C.not(JFt.key)),order:100}})}runInView(i,e){e.expandAll()}});W(class extends z{constructor(){super({id:"comments.reply",title:d(10269,null),icon:L.reply,precondition:C.equals("canReply",!0),menu:[{id:R.CommentsViewThreadActions,order:100},{id:R.AccessibleView,when:C.and(Jd,C.equals(Fu.key,"comments"))}]})}run(i,e){let t=i.get(Wm),o=i.get(ie),n=i.get(gt);Yee(t,o,n,e.thread,e.thread.comments[e.thread.comments.length-1],!0)}});oe.as($t.Configuration).registerConfiguration({id:"comments",order:20,title:d(10263,null),type:"object",properties:{"comments.openPanel":{enum:["neverOpen","openOnSessionStart","openOnSessionStartWithComments"],default:"openOnSessionStartWithComments",description:d(10268,null),restricted:!1,markdownDeprecationMessage:d(10256,null)},"comments.openView":{enum:["never","file","firstFile","firstFileUnresolved"],enumDescriptions:[d(10261,null),d(10258,null),d(10259,null),d(10260,null)],default:"firstFile",description:d(10257,null),restricted:!1},"comments.useRelativeTime":{type:"boolean",default:!0,description:d(10271,null)},"comments.visible":{type:"boolean",default:!0,description:d(10262,null)},"comments.maxHeight":{type:"boolean",default:!0,description:d(10255,null)},"comments.collapseOnResolve":{type:"boolean",default:!0,description:d(10254,null)},"comments.thread.confirmOnCollapse":{type:"string",enum:["whenHasUnsubmittedComments","never"],enumDescriptions:[d(10266,null),d(10265,null)],default:"whenHasUnsubmittedComments",description:d(10264,null)}}});Ce(Wm,tLe,1);var npt=class extends k{constructor(e,t){super();this._commentService=e;this.activityService=t;this.activity=this._register(new ue);this.totalUnresolved=0;this._register(this._commentService.onDidSetAllCommentThreads(this.onAllCommentsChanged,this)),this._register(this._commentService.onDidUpdateCommentThreads(this.onCommentsUpdated,this)),this._register(this._commentService.onDidDeleteDataProvider(this.onCommentsUpdated,this))}onAllCommentsChanged(e){let t=0;for(let o of e.commentThreads)o.state===0&&t++;this.updateBadge(t)}onCommentsUpdated(){let e=0;for(let t of this._commentService.commentsModel.resourceCommentThreads)for(let o of t.commentThreads)o.threadState===0&&e++;this.updateBadge(e)}updateBadge(e){if(e===this.totalUnresolved)return;this.totalUnresolved=e;let t=d(10270,null,this.totalUnresolved);this.activity.value=this.activityService.showViewActivity(gp,{badge:new eu(this.totalUnresolved,()=>t)})}};npt=I([m(0,Wm),m(1,Al)],npt);oe.as(Zi.Workbench).registerWorkbenchContribution(npt,4);_a.register(new t7t);_a.register(new i7t);_a.register(new o7t);var KSe=class extends k{static{this.ID="workbench.contrib.externalUriResolver"}constructor(i,e){super(),e.options?.resolveExternalUri&&this._register(i.registerExternalUriResolver({resolveExternalUri:async t=>({resolved:await e.options.resolveExternalUri(t),dispose:()=>{}})}))}};KSe=I([m(0,Je),m(1,Od)],KSe);var Nkn="trustedDomains",Okn={type:1,ctime:Date.now(),mtime:Date.now(),size:0},AOo=`// Links matching one or more entries in the list below can be opened without link protection.
// The following examples show what entries can look like:
// - "https://microsoft.com": Matches this specific domain using https
// - "https://microsoft.com:8080": Matches this specific domain on this port using https
// - "https://microsoft.com:*": Matches this specific domain on any port using https
// - "https://microsoft.com/foo": Matches https://microsoft.com/foo and https://microsoft.com/foo/bar,
//   but not https://microsoft.com/foobar or https://microsoft.com/bar
// - "https://*.microsoft.com": Match all domains ending in "microsoft.com" using https
// - "microsoft.com": Match this specific domain using either http or https
// - "*.microsoft.com": Match all domains ending in "microsoft.com" using either http or https
// - "http://192.168.0.1: Matches this specific IP using http
// - "http://192.168.0.*: Matches all IP's with this prefix using http
// - "*": Match all domains using either http or https
//
`,NOo=`//
// You can use the "Manage Trusted Domains" command to open this file.
// Save this file to apply the trusted domains rules.
`,Fkn=`[
	// "https://microsoft.com"
]`;function Wkn(a,i,e){let t=AOo;return a.length>0?(t+=`// By default, VS Code trusts "localhost" as well as the following domains:
`,a.forEach(o=>{t+=`// - "${o}"
`})):t+=`// By default, VS Code trusts "localhost".
`,t+=NOo,t+=e?`
// Currently configuring trust for ${e}
`:"",i.length===0?t+=Fkn:t+=JSON.stringify(i,null,2),t}var GSe=class{constructor(i,e,t){this.fileService=i;this.storageService=e;this.instantiationService=t;this.capabilities=2;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None;this.fileService.registerProvider(Nkn,this)}static{this.ID="workbench.contrib.trustedDomainsFileSystemProvider"}stat(i){return Promise.resolve(Okn)}async readFile(i){let e=this.storageService.get(uFt,-1),t=i.fragment,{defaultTrustedDomains:o,trustedDomains:n}=await this.instantiationService.invokeFunction(rpo);return(!e||e.indexOf(AOo)===-1||e.indexOf(NOo)===-1||e.indexOf(t??"")===-1||[...o,...n].some(s=>!Ti(e).includes(s)))&&(e=Wkn(o,n,t)),Ke.fromString(e).buffer}writeFile(i,e,t){try{let o=Ke.wrap(e).toString(),n=is(o);this.storageService.store(uFt,o,-1,0),this.storageService.store(WRe,JSON.stringify(n)||"",-1,0)}catch{}return Promise.resolve()}watch(i,e){return{dispose(){}}}mkdir(i){return Promise.resolve(void 0)}readdir(i){return Promise.resolve(void 0)}delete(i,e){return Promise.resolve(void 0)}rename(i,e,t){return Promise.resolve(void 0)}};GSe=I([m(0,ge),m(1,de),m(2,F)],GSe);var $Ke=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._openerService=i;this._storageService=e;this._dialogService=t;this._productService=o;this._quickInputService=n;this._editorService=r;this._clipboardService=s;this._telemetryService=l;this._instantiationService=c;this._configurationService=u;this._workspaceTrustService=p;this._trustedDomainService=h;this._openerService.registerValidator({shouldOpen:(g,f)=>this.validateLink(g,f)})}async validateLink(i,e){if(!hc(i,Q.http)&&!hc(i,Q.https)||e?.fromWorkspace&&this._workspaceTrustService.isWorkspaceTrusted()&&!this._configurationService.getValue("workbench.trustedDomains.promptInTrustedWorkspace"))return!0;let t=i,o;if(typeof i=="string"?o=A.parse(i):o=i,this._trustedDomainService.isValid(o))return!0;{let{scheme:n,authority:r,path:s,query:l,fragment:c}=o,u=`${n}://${r}${s}`,p=`${l?"?"+l:""}${c?"#"+c:""}`,h=Math.max(0,60-u.length),g=Math.min(Math.max(5,h),p.length);g===p.length?u+=p:u+=p.charAt(0)+"..."+p.substring(p.length-g+1);let{result:f}=await this._dialogService.prompt({type:wt.Info,message:d(17552,null,this._productService.nameShort),detail:typeof t=="string"?t:u,buttons:[{label:d(17551,null),run:()=>!0},{label:d(17550,null),run:()=>(this._clipboardService.writeText(typeof t=="string"?t:o.toString(!0)),!1)},{label:d(17549,null),run:async()=>{let{trustedDomains:v}=this._instantiationService.invokeFunction(VRe),b=`${n}://${r}`,S=await npo(v,b,o,this._quickInputService,this._storageService,this._editorService,this._telemetryService);return!!(S.indexOf("*")!==-1||mFt(o,S))}}],cancelButton:{run:()=>!1}});return f}}};$Ke=I([m(0,Je),m(1,de),m(2,ct),m(3,Ze),m(4,$e),m(5,ie),m(6,Bi),m(7,_e),m(8,F),m(9,B),m(10,Or),m(11,s8)],$Ke);var yKi=class a extends z{static{this.STORAGE_KEY="workbench.action.url.openUrl.lastInput"}constructor(){super({id:"workbench.action.url.openUrl",title:P(17553,"Open URL"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get($e),t=i.get(tS),o=i.get(de),n=o.get(a.STORAGE_KEY,1,"");return e.input({prompt:d(17554,null),value:n}).then(r=>{if(r){let s=A.parse(r);t.open(s,{originalUrl:r}),o.store(a.STORAGE_KEY,r,1,1)}})}};W(yKi);Ge.registerCommand(pFt);be.appendMenuItem(R.CommandPalette,{command:{id:pFt.id,title:pFt.description.description}});oe.as(Zi.Workbench).registerWorkbenchContribution($Ke,3);bt(GSe.ID,GSe,vt.BlockRestore);bt(KSe.ID,KSe,vt.BlockRestore);var Vkn=oe.as($t.Configuration);Vkn.registerConfiguration({...jd,properties:{"workbench.trustedDomains.promptInTrustedWorkspace":{scope:1,type:"boolean",default:!1,description:d(17555,null)}}});Ce(s8,HRe,1);var c7t=C.and(C.equals("activeEditor",qM.ID),me.focus.toNegated()),n7t=class a extends z{static{this.ID="editor.action.webvieweditor.showFind"}static{this.LABEL=d(17832,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:C.and(c7t,lAt),primary:2084,weight:100}})}run(i){d7t(i)?.showFind()}},r7t=class a extends z{static{this.ID="editor.action.webvieweditor.hideFind"}static{this.LABEL=d(17831,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:C.and(c7t,aAt),primary:9,weight:100}})}run(i){d7t(i)?.hideFind()}},s7t=class a extends z{static{this.ID="editor.action.webvieweditor.findNext"}static{this.LABEL=d(17829,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:C.and(c7t,K2),primary:3,weight:100}})}run(i){d7t(i)?.runFindAction(!1)}},a7t=class a extends z{static{this.ID="editor.action.webvieweditor.findPrevious"}static{this.LABEL=d(17830,null)}constructor(){super({id:a.ID,title:a.LABEL,keybinding:{when:C.and(c7t,K2),primary:1027,weight:100}})}run(i){d7t(i)?.runFindAction(!0)}},l7t=class a extends z{static{this.ID="workbench.action.webview.reloadWebviewAction"}static{this.LABEL=P(17833,"Reload Webviews")}constructor(){super({id:a.ID,title:a.LABEL,category:Fe.Developer,menu:[{id:R.CommandPalette}]})}async run(i){let e=i.get(Pu);for(let t of e.webviews)t.reload()}};function d7t(a){let e=a.get(ie).activeEditor;return e instanceof up?e.webview:void 0}var l7=class{constructor(i){this._webviewWorkbenchService=i}static{this.ID=up.typeId}canSerialize(i){return this._webviewWorkbenchService.shouldPersist(i)}serialize(i){if(!this.canSerialize(i))return;let e=this.toJson(i);try{return JSON.stringify(e)}catch{return}}deserialize(i,e){let t=this.fromJson(JSON.parse(e));return this._webviewWorkbenchService.openRevivedWebview({webviewInitInfo:{providedViewType:t.providedId,origin:t.origin,title:t.title,options:t.webviewOptions,contentOptions:t.contentOptions,extension:t.extension},viewType:t.viewType,title:t.title,iconPath:t.iconPath,state:t.state,group:t.group})}fromJson(i){return{...i,extension:wKi(i.extensionId,i.extensionLocation),iconPath:CKi(i.iconPath),state:Bkn(i.state),webviewOptions:i.options,contentOptions:xKi(i.options)}}toJson(i){return{origin:i.webview.origin,viewType:i.viewType,providedId:i.providerId,title:i.getName(),options:{...i.webview.options,...i.webview.contentOptions},extensionLocation:i.extension?.location,extensionId:i.extension?.id.value,state:i.webview.state,iconPath:i.iconPath?q.isThemeIcon(i.iconPath)?i.iconPath:{light:i.iconPath.light,dark:i.iconPath.dark}:void 0,group:i.group}}};l7=I([m(0,Hx)],l7);function wKi(a,i){if(!a)return;let e=u7t(i);if(e)return{id:new hi(a),location:e}}function CKi(a){if(!a)return;if(q.isThemeIcon(a))return a;let i=u7t(a.light),e=u7t(a.dark);return i&&e?{light:i,dark:e}:void 0}function u7t(a){if(a)try{return typeof a=="string"?A.parse(a):A.from(a)}catch{return}}function Bkn(a){return typeof a=="string"?a:void 0}function xKi(a){return{...a,localResourceRoots:a.localResourceRoots?.map(i=>u7t(i))}}oe.as(en.EditorPane).registerEditorPane(os.create(qM,qM.ID,d(17835,null)),[new Vt(up)]);var jKe=class extends k{constructor(e,t){super();this.editorGroupService=t;this._register(e.onWillOpenEditor(o=>{let n=t.getGroup(o.groupId);n&&this.onEditorOpening(o.editor,n)}))}static{this.ID="workbench.contrib.webviewPanel"}onEditorOpening(e,t){if(!(e instanceof up)||e.typeId!==up.typeId||t.contains(e))return;let o,n=this.editorGroupService.groups;for(let r of n)if(r.contains(e)){o=r;break}o&&o.closeEditor(e)}};jKe=I([m(0,ie),m(1,kt)],jKe);bt(jKe.ID,jKe,vt.BlockStartup);oe.as(en.EditorFactory).registerEditorSerializer(l7.ID,l7);Ce(Hx,QDe,1);W(n7t);W(r7t);W(s7t);W(a7t);W(l7t);Ce(QRe,wFt,1);var qSe=class extends l7{constructor(e,t,o){super(e);this._instantiationService=t;this._webviewService=o}static{this.ID=pp.typeId}serialize(e){let t=e.isDirty(),o={...this.toJson(e),editorResource:e.resource.toJSON(),dirty:t,backupId:t?e.backupId:void 0};try{return JSON.stringify(o)}catch{return}}fromJson(e){return{...super.fromJson(e),editorResource:A.from(e.editorResource),dirty:e.dirty}}deserialize(e,t){let o=this.fromJson(JSON.parse(t)),n=OOo(this._webviewService,o),r=this._instantiationService.createInstance(pp,{resource:o.editorResource,viewType:o.viewType,webviewTitle:o.title,preferredName:void 0,iconPath:o.iconPath},n,{startsDirty:o.dirty,backupId:o.backupId});return typeof o.group=="number"&&r.updateGroup(o.group),r}};qSe=I([m(0,Hx),m(1,F),m(2,Pu)],qSe);var $Se=class{constructor(i){this._instantiationService=i}static{this.ID=Sf.typeId}canSerialize(i){return i instanceof Sf}serialize(i){let e={originalResource:i.originalResource.toJSON(),modifiedResource:i.modifiedResource.toJSON(),viewType:i.viewType,label:i.getName(),description:i.getDescription(),dirty:i.isDirty()};try{return JSON.stringify(e)}catch{return}}deserialize(i,e){let t=JSON.parse(e);return Sf.create(this._instantiationService,{originalResource:A.revive(t.originalResource),modifiedResource:A.revive(t.modifiedResource),viewType:t.viewType,label:t.label,description:t.description,iconPath:void 0},void 0)}};$Se=I([m(0,F)],$Se);var jSe=class{constructor(i){this._instantiationService=i}static{this.ID=rg.typeId}canSerialize(i){return i instanceof rg}serialize(i){let e={originalResource:i.originalResource.toJSON(),modifiedResource:i.modifiedResource.toJSON(),viewType:i.viewType,label:i.getName(),description:i.getDescription(),dirty:i.isDirty(),diffId:i.diffId,side:i.side};try{return JSON.stringify(e)}catch{return}}deserialize(i,e){let t=JSON.parse(e);return rg.create(this._instantiationService,{originalResource:A.revive(t.originalResource),modifiedResource:A.revive(t.modifiedResource),viewType:t.viewType,label:t.label,description:t.description,iconPath:void 0,diffId:t.diffId,side:t.side},void 0)}};jSe=I([m(0,F)],jSe);function OOo(a,i){let e=a.createWebviewOverlay({providedViewType:i.viewType,origin:i.origin,title:i.title,options:{purpose:"customEditor",enableFindWidget:i.webviewOptions.enableFindWidget,retainContextWhenHidden:i.webviewOptions.retainContextWhenHidden},contentOptions:i.contentOptions,extension:i.extension});return e.state=i.state,e}var QSe=class extends k{constructor(e,t,o,n,r){super();this._instantiationService=e;this._workingCopyBackupService=o;this._webviewService=n;this._register(t.registerHandler(this))}static{this.ID="workbench.contrib.complexCustomWorkingCopyEditorHandler"}handles(e){return e.resource.scheme===Q.vscodeCustomEditor}isOpen(e,t){if(!this.handles(e))return!1;if(e.resource.authority==="jupyter-notebook-ipynb"&&t instanceof Ga)try{let o=JSON.parse(e.resource.query),n=A.from(o);return ze(n,t.resource)}catch{return!1}if(!(t instanceof pp)||e.resource.authority!==t.viewType.replace(/[^a-z0-9\-_]/gi,"-").toLowerCase())return!1;try{let o=JSON.parse(e.resource.query),n=A.from(o);return ze(n,t.resource)}catch{return!1}}async createEditor(e){let t=await this._workingCopyBackupService.resolve(e);if(!t?.meta)throw new Error(`No backup found for custom editor: ${e.resource}`);let o=t.meta,n=wKi(o.extension?.id,o.extension?.location),r=OOo(this._webviewService,{viewType:o.viewType,origin:o.webview.origin,webviewOptions:o.webview.options,contentOptions:xKi(o.webview.options),state:o.webview.state,extension:n,title:o.customTitle}),s=this._instantiationService.createInstance(pp,{resource:A.revive(o.editorResource),viewType:o.viewType,webviewTitle:o.customTitle,preferredName:void 0,iconPath:CKi(o.iconPath)},r,{backupId:o.backupId});return s.updateGroup(0),s}};QSe=I([m(0,F),m(1,If),m(2,Om),m(3,Pu),m(4,FH)],QSe);var p7t=class{constructor(){this._references=new Map}async getAllModels(i){let e=`${i.toString()}@@@`,t=[];for(let[o,n]of this._references)o.startsWith(e)&&n.model&&t.push(await n.model);return t}async get(i,e){let t=this.key(i,e);return this._references.get(t)?.model}tryRetain(i,e){let t=this.key(i,e),o=this._references.get(t);if(o)return o.counter++,o.model.then(n=>({object:n,dispose:bd(()=>{--o.counter<=0&&(o.model.then(r=>r.dispose()),this._references.delete(t))})}))}add(i,e,t){let o=this.key(i,e);if(this._references.get(o))throw new Error("Model already exists");return this._references.set(o,{viewType:e,model:t,counter:0}),this.tryRetain(i,e)}disposeAllModelsForView(i){for(let[e,t]of this._references)t.viewType===i&&(t.model.then(o=>o.dispose()),this._references.delete(e))}key(i,e){return`${i.toString()}@@@${e}`}};var q1=Object.freeze({viewType:"viewType",displayName:"displayName",selector:"selector",priority:"priority"}),m7t=Object.freeze({editor:"editor",diff:"diff",merge:"merge"}),h7t={type:"string",enum:["default","option"],markdownEnumDescriptions:[d(10385,null),d(10389,null)]},Ukn={type:"object",required:[q1.viewType,q1.displayName,q1.selector],additionalProperties:!1,properties:{[q1.viewType]:{type:"string",markdownDescription:d(10392,null)},[q1.displayName]:{type:"string",description:d(10383,null)},[q1.selector]:{type:"array",description:d(10390,null),items:{type:"object",defaultSnippets:[{body:{filenamePattern:"$1"}}],additionalProperties:!1,properties:{filenamePattern:{type:"string",description:d(10391,null)}}}},[q1.priority]:{markdownDescription:d(10384,null),anyOf:[h7t,{type:"object",required:[m7t.editor],additionalProperties:!1,properties:{[m7t.editor]:{...h7t,markdownDescription:d(10387,null)},[m7t.diff]:{...h7t,markdownDescription:d(10386,null)},[m7t.merge]:{...h7t,markdownDescription:d(10388,null)}}}],default:"default"}}},FOo=zn.registerExtensionPoint({extensionPoint:"customEditors",deps:[l8],jsonSchema:{description:d(10382,null),type:"array",defaultSnippets:[{body:[{[q1.viewType]:"$1",[q1.displayName]:"$2",[q1.selector]:[{filenamePattern:"$3"}]}]}],items:Ukn},activationEventsGenerator:function*(a){for(let i of a){let e=i[q1.viewType];e&&(yield`onCustomEditor:${e}`)}}}),kKi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.customEditors}render(e){let t=e.contributes?.customEditors||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(10396,null),d(10395,null),d(10394,null)],n=t.map(r=>[r.viewType,zkn(r.priority),ui(r.selector.map(s=>s.filenamePattern)).join(", ")]);return{data:{headers:o,rows:n},dispose:()=>{}}}};function zkn(a){return a?typeof a=="string"?a:ui([a.editor?`editor: ${a.editor}`:void 0,a.diff?`diff: ${a.diff}`:void 0,a.merge?`merge: ${a.merge}`:void 0]).join(", "):""}oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"customEditors",label:d(10393,null),access:{canToggle:!1},renderer:new Vt(kKi)});var g7t=class a extends k{constructor(e){super();this._editors=new Map;this._onChange=this._register(new T);this.onChange=this._onChange.event;this._memento=new $l(a.CUSTOM_EDITORS_STORAGE_ID,e);let t=this._memento.getMemento(0,1);for(let o of t[a.CUSTOM_EDITORS_ENTRY_ID]||[])this.add(new iJe(Kkn(o)));this._register(FOo.setHandler(o=>{this.update(o)}))}static{this.CUSTOM_EDITORS_STORAGE_ID="customEditors"}static{this.CUSTOM_EDITORS_ENTRY_ID="editors"}update(e){this._editors.clear();for(let o of e){let n=o.description.enabledApiProposals?.includes("customEditorPriority")??!1;for(let r of o.value){let s=Gkn(r.priority,o.description,n);this.add(new iJe({id:r.viewType,displayName:r.displayName,providerDisplayName:o.description.isBuiltin?d(10379,null):o.description.displayName||o.description.identifier.value,selector:r.selector||[],priority:s}))}}let t=this._memento.getMemento(0,1);t[a.CUSTOM_EDITORS_ENTRY_ID]=Array.from(this._editors.values()),this._memento.saveMemento(),this._onChange.fire()}[Symbol.iterator](){return this._editors.values()}get(e){return this._editors.get(e)}getContributedEditors(e){return Array.from(this._editors.values()).filter(t=>t.matches(e))}add(e){if(this._editors.has(e.id)){console.error(`Custom editor with id '${e.id}' already registered`);return}this._editors.set(e.id,e)}};function Kkn(a){return{id:a.id,displayName:a.displayName,providerDisplayName:a.providerDisplayName,selector:a.selector,priority:typeof a.priority=="string"?{editor:a.priority,diff:a.priority,merge:a.priority}:{editor:a.priority.editor,diff:a.priority.diff??a.priority.editor,merge:a.priority.merge??a.priority.editor}}}function Gkn(a,i,e){let t=EKi(typeof a=="string"?a:a?.editor,i)??"default";return{editor:t,diff:e&&typeof a!="string"?EKi(a?.diff,i)??t:t,merge:e&&typeof a!="string"?EKi(a?.merge,i)??t:t}}function EKi(a,i){switch(a){case"default":return"default";case"option":return"option";case"builtin":return i.isBuiltin?"builtin":"default";default:return}}var QKe=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.editorService=o;this.editorGroupService=n;this.instantiationService=r;this.uriIdentityService=s;this.editorResolverService=l;this.textResourceConfigurationService=c;this.extensionService=u;this._untitledCounter=0;this._editorResolverDisposables=this._register(new O);this._editorCapabilities=new Map;this._onDidChangeEditorTypes=this._register(new T);this.onDidChangeEditorTypes=this._onDidChangeEditorTypes.event;this._fileEditorFactory=oe.as(en.EditorFactory).getFileEditorFactory();this._models=new p7t,this._contributedEditors=this._register(new g7t(t)),this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this)),this._register(this._contributedEditors.onChange(()=>{this.editorResolverService.bufferChangeEvents(this.registerContributionPoints.bind(this)),this._onDidChangeEditorTypes.fire()}));let p={contextKey:dco,getGroupContextKeyValue:b=>this.getActiveCustomEditorId(b),onDidChange:this.onDidChangeEditorTypes},h={contextKey:uco,getGroupContextKeyValue:b=>this.getCustomEditorIsEditable(b),onDidChange:this.onDidChangeEditorTypes},g={contextKey:Epe,getGroupContextKeyValue:b=>this.getActiveCustomEditorDiffCanToggleLayout(b),onDidChange:this.onDidChangeEditorTypes},f={contextKey:$Mt,getGroupContextKeyValue:b=>this.getActiveCustomEditorTextDiff(b),onDidChange:this.onDidChangeEditorTypes};this._register(this.editorGroupService.registerContextKeyProvider(p)),this._register(this.editorGroupService.registerContextKeyProvider(h)),this._register(this.editorGroupService.registerContextKeyProvider(g)),this._register(this.editorGroupService.registerContextKeyProvider(f)),this._register(this.textResourceConfigurationService.onDidChangeConfiguration(b=>{this.updateCustomDiffEditorsForDiffConfigurationChange(b)})),this._register(e.onDidRunOperation(b=>{b.isOperation(2)&&this.handleMovedFileInOpenedFileEditors(b.resource,this.uriIdentityService.asCanonicalUri(b.target.resource))}));let v=105;this._register(pD.addImplementation(v,"custom-editor",()=>this.withActiveCustomEditor(b=>b.undo()))),this._register(mD.addImplementation(v,"custom-editor",()=>this.withActiveCustomEditor(b=>b.redo())))}getEditorTypes(){return[...this._contributedEditors]}withActiveCustomEditor(e){let t=this.getActiveCustomEditorUndoRedoInput();if(t){let o=e(t);return o||!0}return!1}getActiveCustomEditorUndoRedoInput(){let e=this.editorService.activeEditor;if(e instanceof pp||e instanceof Sf||e instanceof rg)return e;if(e instanceof Ba&&e.modified instanceof rg)return e.modified}registerContributionPoints(){this._editorResolverDisposables.clear();for(let e of this._contributedEditors)for(let t of e.selector)t.filenamePattern&&this._editorResolverDisposables.add(this.editorResolverService.registerEditor(t.filenamePattern,{id:e.id,label:e.displayName,detail:e.providerDisplayName,priority:e.priority},{singlePerResource:()=>!(this.getCustomEditorCapabilities(e.id)?.supportsMultipleEditorsPerDocument??!1)},{createEditorInput:({resource:o,label:n},r)=>({editor:pp.create(this.instantiationService,{resource:o,viewType:e.id,webviewTitle:void 0,preferredName:n,iconPath:void 0},r.id)}),createUntitledEditorInput:({resource:o},n)=>({editor:pp.create(this.instantiationService,{resource:o??A.from({scheme:Q.untitled,authority:`Untitled-${this._untitledCounter++}`}),viewType:e.id,webviewTitle:void 0,preferredName:void 0,iconPath:void 0},n.id)}),createDiffEditorInput:async(o,n)=>(await this.extensionService.activateByEvent(`onCustomEditor:${e.id}`),{editor:this.createDiffEditorInput(o,e,n)})}))}createDiffEditorInput(e,t,o){let n=Ti(e.original.resource),r=Ti(e.modified.resource),s=this.getDiffEditorLayout(t,r);if(s==="inline")return Sf.create(this.instantiationService,{originalResource:n,modifiedResource:r,viewType:t.id,label:e.label,description:e.description,iconPath:void 0},o);if(s==="sideBySide"){let u=ht(),p=rg.create(this.instantiationService,{originalResource:n,modifiedResource:r,viewType:t.id,diffId:u,side:"original",label:e.label,description:e.description,iconPath:void 0},o),h=rg.create(this.instantiationService,{originalResource:n,modifiedResource:r,viewType:t.id,diffId:u,side:"modified",label:e.label,description:e.description,iconPath:void 0},o);return this.instantiationService.createInstance(Ba,e.label,e.description,p,h,!0)}let l=pp.create(this.instantiationService,{resource:r,viewType:t.id,webviewTitle:void 0,preferredName:void 0,iconPath:void 0},o.id,{customClasses:"modified"}),c=pp.create(this.instantiationService,{resource:n,viewType:t.id,webviewTitle:void 0,preferredName:void 0,iconPath:void 0},o.id,{customClasses:"original"});return this.instantiationService.createInstance(Ba,e.label,e.description,c,l,!0)}getDiffEditorLayout(e,t){let o=this.getCustomEditorCapabilities(e.id),n=o?.supportsInlineDiff===!0,r=o?.supportsSideBySideDiff===!0;return n&&r?this.textResourceConfigurationService.getValue(t,"diffEditor.renderSideBySide")?"sideBySide":"inline":n?"inline":r?"sideBySide":void 0}async updateCustomDiffEditorsForDiffConfigurationChange(e){for(let t of this.editorGroupService.groups){let o=[];for(let n of t.editors){let r=this.getCustomEditorDiffInputInfo(n),s=r?this._contributedEditors.get(r.viewType):void 0;!r||!s||!e.affectsConfiguration(r.modifiedResource,"diffEditor.renderSideBySide")||!this.getCustomEditorCapabilities(s.id)?.supportsInlineDiff||!this.getCustomEditorCapabilities(s.id)?.supportsSideBySideDiff||this.getDiffEditorLayout(s,r.modifiedResource)===r.layout||o.push({editor:n,replacement:{original:{resource:r.originalResource},modified:{resource:r.modifiedResource},label:n.getName(),description:n.getDescription(),options:{override:r.viewType,pinned:t.isPinned(n),sticky:t.isSticky(n),preserveFocus:t.activeEditor!==n}}})}o.length&&await this.editorService.replaceEditors(o,t)}}getCustomEditorDiffInputInfo(e){if(e instanceof Sf)return{viewType:e.viewType,originalResource:e.originalResource,modifiedResource:e.modifiedResource,layout:"inline"};if(e instanceof Ba&&e.original instanceof rg&&e.modified instanceof rg&&e.original.side==="original"&&e.modified.side==="modified"&&e.original.viewType===e.modified.viewType&&e.original.diffId===e.modified.diffId)return{viewType:e.original.viewType,originalResource:e.original.originalResource,modifiedResource:e.original.modifiedResource,layout:"sideBySide"}}get models(){return this._models}getCustomEditor(e){return this._contributedEditors.get(e)}getContributedCustomEditors(e){return new jDe(this._contributedEditors.getContributedEditors(e))}getUserConfiguredCustomEditors(e){let t=this.editorResolverService.getAssociationsForResource(e);return new jDe(ui(t.map(o=>this._contributedEditors.get(o.viewType))))}getAllCustomEditors(e){return new jDe([...this.getUserConfiguredCustomEditors(e).allEditors,...this.getContributedCustomEditors(e).allEditors])}registerCustomEditorCapabilities(e,t){if(this._editorCapabilities.has(e))throw new Error(`Capabilities for ${e} already set`);return this._editorCapabilities.set(e,t),this._onDidChangeEditorTypes.fire(),ee(()=>{this._editorCapabilities.delete(e),this._onDidChangeEditorTypes.fire()})}getCustomEditorCapabilities(e){return this._editorCapabilities.get(e)}getActiveCustomEditorId(e){let o=e.activeEditorPane?.input,n=this.getCustomEditorDiffInputInfo(o);return n?n.viewType:o instanceof pp&&o.resource?o.viewType:""}getActiveCustomEditorDiffCanToggleLayout(e){let t=this.getCustomEditorDiffInputInfo(e.activeEditorPane?.input),o=t?this.getCustomEditorCapabilities(t.viewType):void 0;return o?.supportsInlineDiff===!0&&o.supportsSideBySideDiff===!0}getActiveCustomEditorTextDiff(e){let t=this.getCustomEditorDiffInputInfo(e.activeEditorPane?.input);return!!t&&this.getCustomEditorCapabilities(t.viewType)?.isTextEditor===!0}getCustomEditorIsEditable(e){let t=e.activeEditorPane;return t?.input?.resource?t?.input instanceof pp:!1}async handleMovedFileInOpenedFileEditors(e,t){if(Ts(e).toLowerCase()===Ts(t).toLowerCase())return;let o=this.getAllCustomEditors(t);if(!o.allEditors.some(r=>r.priority.editor!=="option"))return;let n=new Map;for(let r of this.editorGroupService.groups)for(let s of r.editors)if(this._fileEditorFactory.isFileEditor(s)&&!(s instanceof pp)&&ze(s.resource,t)){let l=n.get(r.id);l||(l=[],n.set(r.id,l)),l.push(s)}if(n.size)for(let[r,s]of n)this.editorService.replaceEditors(s.map(l=>{let c;if(o.defaultEditor){let u=o.defaultEditor.id;c=pp.create(this.instantiationService,{resource:t,viewType:u,webviewTitle:void 0,preferredName:void 0,iconPath:void 0},r)}else c={resource:t,options:{override:Da.id}};return{editor:l,replacement:c,options:{preserveFocus:!0}}}),r)}};QKe=I([m(0,ge),m(1,de),m(2,ie),m(3,kt),m(4,F),m(5,gt),m(6,il),m(7,Gn),m(8,lt)],QKe);Ce(FH,QKe,1);oe.as(en.EditorPane).registerEditorPane(os.create(qM,qM.ID,"Webview Editor"),[new Vt(pp),new Vt(Sf),new Vt(rg)]);oe.as(en.EditorFactory).registerEditorSerializer(qSe.ID,qSe);oe.as(en.EditorFactory).registerEditorSerializer($Se.ID,$Se);oe.as(en.EditorFactory).registerEditorSerializer(jSe.ID,jSe);bt(QSe.ID,QSe,vt.BlockStartup);Ce(Hee,GRe,1);oe.as($t.Configuration).registerConfiguration(Kwi);var Use=class extends k{constructor(e,t,o,n){super();this.contextService=e;this.modelService=t;this.languageFeaturesService=o;this.webWorkerService=n;this.disposeWorkerScheduler=this._register(new Dt(()=>this.disposeWorker(),Use.DISPOSE_WORKER_TIME)),this.registerListeners(),this.updateLinkProviderWorker()}static{this.DISPOSE_WORKER_TIME=180*1e3}registerListeners(){this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.updateLinkProviderWorker()))}updateLinkProviderWorker(){this.contextService.getWorkspace().folders.length>0?this.linkProviderRegistration||(this.linkProviderRegistration=this.languageFeaturesService.linkProvider.register([{language:TRe,scheme:"*"},{language:_Re,scheme:"*"}],{provideLinks:async t=>{let o=await this.provideLinks(t.uri);return o&&{links:o}}})):(je(this.linkProviderRegistration),this.linkProviderRegistration=void 0),this.disposeWorker(),this.disposeWorkerScheduler.cancel()}getOrCreateWorker(){return this.disposeWorkerScheduler.schedule(),this.worker||(this.worker=new rpt(this.contextService,this.modelService,this.webWorkerService)),this.worker}async provideLinks(e){return this.getOrCreateWorker().provideLinks(e)}disposeWorker(){this.worker&&(this.worker.dispose(),this.worker=void 0)}};Use=I([m(0,Ae),m(1,_t),m(2,Jt),m(3,Bw)],Use);var rpt=class extends k{constructor(e,t,o){super();this.contextService=e;this._workerClient=this._register(o.createWorkerClient(new Ak({esmModuleLocation:In.asBrowserUri("vs/workbench/contrib/output/common/outputLinkComputerMain.js"),label:"OutputLinkDetectionWorker"}))),this._workerTextModelSyncClient=this._register(YY.create(this._workerClient,t)),this._initializeBarrier=this._ensureWorkspaceFolders()}async _ensureWorkspaceFolders(){await this._workerClient.proxy.$setWorkspaceFolders(this.contextService.getWorkspace().folders.map(e=>e.uri.toString()))}async provideLinks(e){return await this._initializeBarrier,this._workerTextModelSyncClient.ensureSyncedResources([e]),this._workerClient.proxy.$computeLinks(e.toString())}};rpt=I([m(0,Ae),m(1,_t),m(2,Bw)],rpt);var WOo=/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3})\s(\[(info|trace|debug|error|warning)\])\s(\[(.*?)\])?/;function VOo(a,i){let e=a.getLineContent(i),t=WOo.exec(e);if(t){let o=new Date(t[1]).getTime(),n=new G(i,1,i,t[1].length),r=qkn(t[3]),s=new G(i,n.endColumn+1,i,n.endColumn+1+t[2].length),l=t[5],c=i,u=i,p=a.getLineCount();for(;u<p;){let g=a.getLineContent(u+1),f=u+1===p&&g==="";if(WOo.test(g)||f)break;u++}return{range:new G(c,1,u,a.getLineMaxColumn(u)),timestamp:o,timestampRange:n,logLevel:r,logLevelRange:s,category:l}}return null}function*TKi(a,i){for(let e=1;e<=a.getLineCount();e++){let t=VOo(a,e);t&&(yield i(t),e=t.range.endLineNumber)}}function BOo(a,i){return{...a,range:new G(i,a.range.startColumn,i+a.range.endLineNumber-a.range.startLineNumber,a.range.endColumn),timestampRange:new G(i,a.timestampRange.startColumn,i,a.timestampRange.endColumn),logLevelRange:new G(i,a.logLevelRange.startColumn,i,a.logLevelRange.endColumn)}}function qkn(a){switch(a.toLowerCase()){case"trace":return 1;case"debug":return 2;case"info":return 3;case"warning":return 4;case"error":return 5;default:throw new Error(`Unknown log level: ${a}`)}}var YKe=class extends k{constructor({name:e,resource:t},o,n,r){super();this.fileService=o;this.instantiationService=n;this.logService=r;this._onDidAppend=this._register(new T);this._onDidReset=this._register(new T);this.watching=!1;this.etag="";this.logEntries=[];this.startOffset=0;this.endOffset=0;this.name=e??"",this.resource=t,this.syncDelayer=new Aa(500),this._register(ee(()=>this.unwatch()))}get onDidAppend(){return this._onDidAppend.event}get onDidReset(){return this._onDidReset.event}reset(e){this.endOffset=this.startOffset=e??this.startOffset,this.logEntries=[]}resetToEnd(){this.startOffset=this.endOffset,this.logEntries=[]}watch(){this.watching||(this.logService.trace("Started polling",this.resource.toString()),this.poll(),this.watching=!0)}unwatch(){this.watching&&(this.syncDelayer.cancel(),this.watching=!1,this.logService.trace("Stopped polling",this.resource.toString()))}poll(){let e=()=>this.doWatch().then(()=>this.poll());this.syncDelayer.trigger(e).catch(t=>{if(!Yi(t))throw t})}async doWatch(){try{if(!this.fileService.hasProvider(this.resource))return;let e=await this.fileService.stat(this.resource);e.etag!==this.etag&&(this.etag=e.etag,on(e.size)&&this.endOffset>e.size?(this.reset(0),this._onDidReset.fire()):this._onDidAppend.fire())}catch(e){if(rp(e)!==1)throw e}}getLogEntries(){return this.logEntries}async getContent(e){try{if(!this.fileService.hasProvider(this.resource))return{name:this.name,content:"",consume:()=>{}};let t=await this.fileService.readFile(this.resource,{position:this.endOffset}),o=t.value.toString(),n=e?[]:this.parseLogEntries(o,this.logEntries[this.logEntries.length-1]),r=!1;return{name:this.name,content:o,consume:()=>{r||(r=!0,this.endOffset+=t.value.byteLength,this.etag=t.etag,this.logEntries.push(...n))}}}catch(t){if(rp(t)!==1)throw t;return{name:this.name,content:"",consume:()=>{}}}}parseLogEntries(e,t){let o=this.instantiationService.createInstance(Tp,e,Mee,Tp.DEFAULT_CREATION_OPTIONS,null);try{if(!VOo(o,1))return[];let n=[],r=t?t.range.endLineNumber+1:1;for(let s of TKi(o,l=>BOo(l,r)))n.push(s),r=s.range.endLineNumber+1;return n}finally{o.dispose()}}};YKe=I([m(1,ge),m(2,F),m(3,re)],YKe);var spt=class extends k{constructor(e,t,o,n){super();this.instantiationService=t;this.fileService=o;this.logService=n;this._onDidAppend=this._register(new T);this.onDidAppend=this._onDidAppend.event;this.onDidReset=U.None;this.logEntries=[];this.fileContentProviderItems=[];this.watching=!1;for(let r of e)this.fileContentProviderItems.push(this.createFileContentProvider(r));this._register(ee(()=>{for(let[,r]of this.fileContentProviderItems)r.dispose()}))}createFileContentProvider(e){let t=new O,o=t.add(new YKe(e,this.fileService,this.instantiationService,this.logService));return t.add(o.onDidAppend(()=>this._onDidAppend.fire())),[o,t]}watch(){if(!this.watching){this.watching=!0;for(let[e]of this.fileContentProviderItems)e.watch()}}unwatch(){if(this.watching){this.watching=!1;for(let[e]of this.fileContentProviderItems)e.unwatch()}}updateFiles(e){let t=this.watching;t&&this.unwatch();let o=Q5e(this.fileContentProviderItems.map(([n])=>n),e,(n,r)=>Jn.compare(n.resource,r.resource));for(let{start:n,deleteCount:r,toInsert:s}of o){let l=s.map(u=>this.createFileContentProvider(u)),c=this.fileContentProviderItems.splice(n,r,...l);for(let[,u]of c)u.dispose()}t&&this.watch()}reset(){for(let[e]of this.fileContentProviderItems)e.reset();this.logEntries=[]}resetToEnd(){for(let[e]of this.fileContentProviderItems)e.resetToEnd();this.logEntries=[]}getLogEntries(){return this.logEntries}async getContent(){let e=await Promise.all(this.fileContentProviderItems.map(([r])=>r.getContent(!0))),{content:t,logEntries:o}=this.combineLogEntries(e,this.logEntries[this.logEntries.length-1]),n=!1;return{content:t,consume:()=>{n||(n=!0,e.forEach(({consume:r})=>r()),this.logEntries.push(...o))}}}combineLogEntries(e,t){if(e=e.filter(p=>!!p.content),e.length===0)return{logEntries:[],content:""};let o=[],n=[],r=(p,h,g)=>{let f=p.getValueInRange(h.range),v=g?`${f.substring(0,h.logLevelRange.endColumn)} [${g}]${f.substring(h.logLevelRange.endColumn)}`:f;return[{...h,category:g,range:new G(h.range.startLineNumber,h.logLevelRange.startColumn,h.range.endLineNumber,g?h.range.endColumn+g.length+3:h.range.endColumn)},v]},s=this.instantiationService.createInstance(Tp,e[0].content,Mee,Tp.DEFAULT_CREATION_OPTIONS,null);try{for(let[p,h]of TKi(s,g=>r(s,g,e[0].name)))o.push(p),n.push(h)}finally{s.dispose()}for(let p=1;p<e.length;p++){let{content:h,name:g}=e[p],f=this.instantiationService.createInstance(Tp,h,Mee,Tp.DEFAULT_CREATION_OPTIONS,null);try{let v=TKi(f,S=>r(f,S,g)),b=v.next();for(;!b.done;){let[S,y]=b.value,w=[S],x=[y],E;if(S.timestamp>=o[o.length-1].timestamp)for(E=o.length,b=v.next();!b.done;b=v.next())w.push(b.value[0]),x.push(b.value[1]);else{if(S.timestamp<=o[0].timestamp)E=0;else{let M=Ek(o,S,(N,V)=>N.timestamp-V.timestamp);E=M<0?~M:M}for(b=v.next();!b.done&&b.value[0].timestamp<=o[E].timestamp;b=v.next())w.push(b.value[0]),x.push(b.value[1])}n.splice(E,0,...x),o.splice(E,0,...w)}}finally{f.dispose()}}let l="",c=[],u=t?t.range.endLineNumber+1:1;for(let p=0;p<o.length;p++){l+=n[p]+`
`;let h=BOo(o[p],u);c.push(h),u=h.range.endLineNumber+1}return{logEntries:c,content:l}}};spt=I([m(1,F),m(2,ge),m(3,re)],spt);var XKe=class extends k{constructor(e,t,o,n,r){super();this.modelUri=e;this.language=t;this.outputContentProvider=o;this.modelService=n;this.editorWorkerService=r;this._onDispose=this._register(new T);this.onDispose=this._onDispose.event;this.loadModelPromise=null;this.modelDisposable=this._register(new ue);this.model=null;this.modelUpdateInProgress=!1;this.modelUpdateCancellationSource=this._register(new ue);this.appendThrottler=this._register(new Aa(300))}async loadModel(){return this.loadModelPromise=vn.withAsyncBody(async(e,t)=>{try{this.modelDisposable.value=new O,this.model=this.modelService.createModel("",this.language,this.modelUri);let{content:o,consume:n}=await this.outputContentProvider.getContent();n(),this.doAppendContent(this.model,o),this.modelDisposable.value.add(this.outputContentProvider.onDidReset(()=>this.onDidContentChange(!0,!0))),this.modelDisposable.value.add(this.outputContentProvider.onDidAppend(()=>this.onDidContentChange(!1,!1))),this.outputContentProvider.watch(),this.modelDisposable.value.add(ee(()=>this.outputContentProvider.unwatch())),this.modelDisposable.value.add(this.model.onWillDispose(()=>{this.outputContentProvider.reset(),this.modelDisposable.value=void 0,this.cancelModelUpdate(),this.model=null})),e(this.model)}catch(o){t(o)}}),this.loadModelPromise}getLogEntries(){return this.outputContentProvider.getLogEntries()}onDidContentChange(e,t){e&&!this.modelUpdateInProgress&&this.doUpdate(3,!0),this.doUpdate(1,t)}doUpdate(e,t){if((e===3||e===2)&&this.cancelModelUpdate(),!this.model)return;this.modelUpdateInProgress=!0,this.modelUpdateCancellationSource.value||(this.modelUpdateCancellationSource.value=new qe);let o=this.modelUpdateCancellationSource.value.token;e===3?this.clearContent(this.model):e===2?this.replacePromise=this.replaceContent(this.model,o).finally(()=>this.replacePromise=void 0):this.appendContent(this.model,t,o)}clearContent(e){e.applyEdits([Qn.delete(e.getFullModelRange())]),this.modelUpdateInProgress=!1}appendContent(e,t,o){this.appendThrottler.trigger(async()=>{if(o.isCancellationRequested)return;if(this.replacePromise){try{await this.replacePromise}catch{}if(o.isCancellationRequested)return}let{content:n,consume:r}=await this.outputContentProvider.getContent();o.isCancellationRequested||(r(),this.doAppendContent(e,n),this.modelUpdateInProgress=!1)},t?0:void 0).catch(n=>{if(!Yi(n))throw n})}doAppendContent(e,t){let o=e.getLineCount(),n=e.getLineMaxColumn(o);e.applyEdits([Qn.insert(new ye(o,n),t)])}async replaceContent(e,t){let{content:o,consume:n}=await this.outputContentProvider.getContent();if(t.isCancellationRequested)return;let r=await this.getReplaceEdits(e,o.toString());t.isCancellationRequested||(n(),r.length&&e.applyEdits(r),this.modelUpdateInProgress=!1)}async getReplaceEdits(e,t){if(!t)return[Qn.delete(e.getFullModelRange())];if(t!==e.getValue()){let o=await this.editorWorkerService.computeMoreMinimalEdits(e.uri,[{text:t.toString(),range:e.getFullModelRange()}]);if(o?.length)return o.map(n=>Qn.replace(G.lift(n.range),n.text))}return[]}cancelModelUpdate(){this.modelUpdateCancellationSource.value?.cancel(),this.modelUpdateCancellationSource.value=void 0,this.appendThrottler.cancel(),this.replacePromise=void 0,this.modelUpdateInProgress=!1}isVisible(){return!!this.model}dispose(){this._onDispose.fire(),super.dispose()}append(e){throw new Error("Not supported")}replace(e){throw new Error("Not supported")}};XKe=I([m(3,_t),m(4,Qs)],XKe);var YSe=class extends XKe{constructor(e,t,o,n,r,s,l,c){let u=new YKe(o,n,s,l);super(e,t,u,r,c);this.source=o;this.fileOutput=this._register(u)}clear(){this.update(3,void 0,!0)}update(e,t,o){(this.loadModelPromise?this.loadModelPromise:Promise.resolve()).then(()=>{(e===3||e===2)&&(on(t)?this.fileOutput.reset(t):this.fileOutput.resetToEnd()),this.doUpdate(e,o)})}updateChannelSources(e){throw new Error("Not supported")}};YSe=I([m(3,ge),m(4,_t),m(5,F),m(6,re),m(7,Qs)],YSe);var JKe=class extends XKe{constructor(e,t,o,n,r,s,l,c){let u=new spt(o,c,n,s);super(e,t,u,r,l);this.source=o;this.multifileOutput=this._register(u)}updateChannelSources(e){this.multifileOutput.unwatch(),this.multifileOutput.updateFiles(e),this.multifileOutput.reset(),this.doUpdate(2,!0),this.isVisible()&&this.multifileOutput.watch()}clear(){(this.loadModelPromise?this.loadModelPromise:Promise.resolve()).then(()=>{this.multifileOutput.resetToEnd(),this.doUpdate(3,!0)})}update(e,t,o){throw new Error("Not supported")}};JKe=I([m(3,ge),m(4,_t),m(5,re),m(6,Qs),m(7,F)],JKe);var apt=class extends YSe{constructor(i,e,t,o,n,r,s,l,c,u){super(e,t,{resource:o,name:""},n,r,l,c,u),this.logger=s.createLogger(o,{logLevel:"always",donotRotate:!0,donotUseFormatters:!0,hidden:!0}),this._offset=0}append(i){this.write(i),this.update(1,void 0,this.isVisible())}replace(i){let e=this._offset;this.write(i),this.update(2,e,!0)}write(i){this._offset+=Ke.fromString(i).byteLength,this.logger.info(i),this.isVisible()&&this.logger.flush()}};apt=I([m(4,ge),m(5,_t),m(6,Ol),m(7,F),m(8,re),m(9,Qs)],apt);var ZKe=class extends k{constructor(e,t,o,n,r,s,l){super();this.instantiationService=s;this.fileService=l;this._onDispose=this._register(new T);this.onDispose=this._onDispose.event;this.outputChannelModel=this.createOutputChannelModel(e,t,o,n,r);let c=Ve(n,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`);this.source={resource:c}}async createOutputChannelModel(e,t,o,n,r){await r;let s=Ve(n,`${e.replace(/[\\/:\*\?"<>\|]/g,"")}.log`);await this.fileService.createFile(s);let l=this._register(this.instantiationService.createInstance(apt,e,t,o,s));return this._register(l.onDispose(()=>this._onDispose.fire())),l}getLogEntries(){return[]}append(e){this.outputChannelModel.then(t=>t.append(e))}update(e,t,o){this.outputChannelModel.then(n=>n.update(e,t,o))}loadModel(){return this.outputChannelModel.then(e=>e.loadModel())}clear(){this.outputChannelModel.then(e=>e.clear())}replace(e){this.outputChannelModel.then(t=>t.replace(e))}updateChannelSources(e){this.outputChannelModel.then(t=>t.updateChannelSources(e))}};ZKe=I([m(5,F),m(6,ge)],ZKe);var _Ki="output.activechannel",lpt=class extends k{constructor(e,t,o,n,r){super();this.outputChannelDescriptor=e;this.outputLocation=t;this.outputDirPromise=o;this.languageService=n;this.instantiationService=r;this.scrollLock=!1;this.id=e.id,this.label=e.label,this.uri=A.from({scheme:Q.outputChannel,path:this.id}),this.model=this._register(this.createOutputChannelModel(this.uri,e))}createOutputChannelModel(e,t){let o=t.languageId?this.languageService.createById(t.languageId):this.languageService.createByMimeType(t.log?Mee:TOt);return QH(t)?this.instantiationService.createInstance(JKe,e,o,[...t.source]):xN(t)?this.instantiationService.createInstance(YSe,e,o,t.source):this.instantiationService.createInstance(ZKe,this.id,e,o,this.outputLocation,this.outputDirPromise)}getLogEntries(){return this.model.getLogEntries()}append(e){this.model.append(e)}update(e,t){this.model.update(e,t,!0)}clear(){this.model.clear()}replace(e){this.model.replace(e)}};lpt=I([m(3,Rt),m(4,F)],lpt);var DKi=class extends k{constructor(e,t){super();this.contextKeyService=t;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._filterText="";this._includePatterns=[];this._excludePatterns=[];this._trace=NOt.bindTo(this.contextKeyService),this._trace.set(e.trace),this._debug=OOt.bindTo(this.contextKeyService),this._debug.set(e.debug),this._info=FOt.bindTo(this.contextKeyService),this._info.set(e.info),this._warning=WOt.bindTo(this.contextKeyService),this._warning.set(e.warning),this._error=VOt.bindTo(this.contextKeyService),this._error.set(e.error),this._categories=BOt.bindTo(this.contextKeyService),this._categories.set(e.sources),this.filterHistory=e.filterHistory}get text(){return this._filterText}set text(e){if(this._filterText!==e){this._filterText=e;let{includePatterns:t,excludePatterns:o}=this.parseText(e);this._includePatterns=t,this._excludePatterns=o,this._onDidChange.fire()}}parseText(e){let t=[],o=[],n=this.splitByCommaRespectingQuotes(e);for(let r of n){let s=r.trim();if(s.length!==0)if(s.startsWith("!")){let l=s.substring(1).trim();l.length>0&&o.push(l)}else t.push(s)}return{includePatterns:t,excludePatterns:o}}get includePatterns(){return this._includePatterns}get excludePatterns(){return this._excludePatterns}splitByCommaRespectingQuotes(e){let t=[],o="",n=!1,r="";for(let s=0;s<e.length;s++){let l=e[s];!n&&l==='"'?(n=!0,r=l,o+=l):n&&l===r?(n=!1,o+=l):!n&&l===","?(o.length>0&&t.push(o),o=""):o+=l}return o.length>0&&t.push(o),t}get trace(){return!!this._trace.get()}set trace(e){this._trace.get()!==e&&(this._trace.set(e),this._onDidChange.fire())}get debug(){return!!this._debug.get()}set debug(e){this._debug.get()!==e&&(this._debug.set(e),this._onDidChange.fire())}get info(){return!!this._info.get()}set info(e){this._info.get()!==e&&(this._info.set(e),this._onDidChange.fire())}get warning(){return!!this._warning.get()}set warning(e){this._warning.get()!==e&&(this._warning.set(e),this._onDidChange.fire())}get error(){return!!this._error.get()}set error(e){this._error.get()!==e&&(this._error.set(e),this._onDidChange.fire())}get categories(){return this._categories.get()||","}set categories(e){this._categories.set(e),this._onDidChange.fire()}toggleCategory(e){let t=this.categories;this.hasCategory(e)?this.categories=t.replace(`,${e},`,","):this.categories=`${t}${e},`}hasCategory(e){return e===","?!1:this.categories.includes(`,${e},`)}},e2e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.storageService=e;this.instantiationService=t;this.textModelService=o;this.logService=n;this.loggerService=r;this.lifecycleService=s;this.viewsService=l;this.defaultLogLevelsService=u;this.fileDialogService=p;this.fileService=h;this.channels=this._register(new Ot);this._onActiveOutputChannel=this._register(new T);this.onActiveOutputChannel=this._onActiveOutputChannel.event;this.outputFolderCreationPromise=null;this.activeChannelIdInStorage=this.storageService.get(_Ki,1,""),this.activeOutputChannelContext=AOt.bindTo(c),this.activeOutputChannelContext.set(this.activeChannelIdInStorage),this._register(this.onActiveOutputChannel(v=>this.activeOutputChannelContext.set(v))),this.activeFileOutputChannelContext=Nuo.bindTo(c),this.activeLogOutputChannelContext=DOt.bindTo(c),this.activeOutputChannelLevelSettableContext=ROt.bindTo(c),this.activeOutputChannelLevelContext=LOt.bindTo(c),this.activeOutputChannelLevelIsDefaultContext=MOt.bindTo(c),this.outputLocation=Ve(g.windowLogsPath,`output_${ISt(new Date).replace(/-|:|\.\d+Z$/g,"")}`),this._register(o.registerTextModelContentProvider(Q.outputChannel,this)),this._register(t.createInstance(Use));let f=oe.as(bb.OutputChannels);for(let v of f.getChannels())this.onDidRegisterChannel(v.id);if(this._register(f.onDidRegisterChannel(v=>this.onDidRegisterChannel(v))),this._register(f.onDidUpdateChannelSources(v=>this.onDidUpdateChannelSources(v))),this._register(f.onDidRemoveChannel(v=>this.onDidRemoveChannel(v))),!this.activeChannel){let v=this.getChannelDescriptors();this.setActiveChannel(v&&v.length>0?this.getChannel(v[0].id):void 0)}this._register(U.filter(this.viewsService.onDidChangeViewVisibility,v=>v.id===md&&v.visible)(()=>{this.activeChannel&&this.viewsService.getActiveViewWithId(md)?.showChannel(this.activeChannel,!0)})),this._register(this.loggerService.onDidChangeLogLevel(()=>{this.setLevelContext(),this.setLevelIsDefaultContext()})),this._register(this.defaultLogLevelsService.onDidChangeDefaultLogLevels(()=>{this.setLevelIsDefaultContext()})),this._register(this.lifecycleService.onDidShutdown(()=>this.dispose())),this.filters=this._register(new DKi({filterHistory:[],trace:!0,debug:!0,info:!0,warning:!0,error:!0,sources:""},c))}provideTextContent(e){let t=this.getChannel(e.path);return t?t.model.loadModel():null}async showChannel(e,t){let o=this.getChannel(e);this.activeChannel?.id!==o?.id&&(this.setActiveChannel(o),this._onActiveOutputChannel.fire(e));let n=await this.viewsService.openView(md,!t);n&&o&&n.showChannel(o,!!t)}getChannel(e){return this.channels.get(e)}getChannelDescriptor(e){return oe.as(bb.OutputChannels).getChannel(e)}getChannelDescriptors(){return oe.as(bb.OutputChannels).getChannels()}getActiveChannel(){return this.activeChannel}canSetLogLevel(e){return e.log&&e.id!==Zue}getLogLevel(e){if(!e.log)return;let t=xN(e)?[e.source]:QH(e)?e.source:[];if(t.length===0)return;let o=this.loggerService.getLogLevel();return t.reduce((n,r)=>Math.min(n,this.loggerService.getLogLevel(r.resource)??o),5)}setLogLevel(e,t){if(!e.log)return;let o=xN(e)?[e.source]:QH(e)?e.source:[];if(o.length!==0)for(let n of o)this.loggerService.setLogLevel(n.resource,t)}registerCompoundLogChannel(e){let t=oe.as(bb.OutputChannels);e.sort((n,r)=>n.label.localeCompare(r.label));let o=e.map(n=>n.id.toLowerCase()).join("-");return t.getChannel(o)||t.registerChannel({id:o,label:e.map(n=>n.label).join(", "),log:e.some(n=>n.log),user:!0,source:e.map(n=>{if(xN(n))return[{resource:n.source.resource,name:n.source.name??n.label}];if(QH(n))return n.source;let r=this.getChannel(n.id);return r?r.model.source:[]}).flat()}),o}async saveOutputAs(e,...t){let o;if(t.length>1){let n=this.registerCompoundLogChannel(t);o=this.getChannel(n)}else o=this.getChannel(t[0].id);if(o)try{let n=e;if(!n){let s=t.length>1?"output":t[0].label;n=await this.fileDialogService.showSaveDialog({title:d(14091,null),availableFileSystems:[Q.file],defaultUri:Ve(await this.fileDialogService.defaultFilePath(),`${s}.log`),filters:[{name:s,extensions:["log"]}]})}if(!n)return;let r=await this.textModelService.createModelReference(o.uri);try{await this.fileService.writeFile(n,Ke.fromString(r.object.textEditorModel.getValue()))}finally{r.dispose()}return}finally{t.length>1&&oe.as(bb.OutputChannels).removeChannel(o.id)}}async onDidRegisterChannel(e){let t=this.createChannel(e);this.channels.set(e,t),(!this.activeChannel||this.activeChannelIdInStorage===e)&&(this.setActiveChannel(t),this._onActiveOutputChannel.fire(e),this.viewsService.getActiveViewWithId(md)?.showChannel(t,!0))}onDidUpdateChannelSources(e){let t=this.channels.get(e.id);t&&t.model.updateChannelSources(e.source)}onDidRemoveChannel(e){if(this.activeChannel?.id===e.id){let t=this.getChannelDescriptors();t[0]&&this.showChannel(t[0].id)}this.channels.deleteAndDispose(e.id)}createChannel(e){let t=this.instantiateChannel(e);return this._register(U.once(t.model.onDispose)(()=>{if(this.activeChannel===t){let o=this.getChannelDescriptors(),n=o.length?this.getChannel(o[0].id):void 0;n&&this.viewsService.isViewVisible(md)?this.showChannel(n.id):this.setActiveChannel(void 0)}oe.as(bb.OutputChannels).removeChannel(e)})),t}instantiateChannel(e){let t=oe.as(bb.OutputChannels).getChannel(e);if(!t)throw this.logService.error(`Channel '${e}' is not registered yet`),new Error(`Channel '${e}' is not registered yet`);return this.outputFolderCreationPromise||(this.outputFolderCreationPromise=this.fileService.createFolder(this.outputLocation).then(()=>{})),this.instantiationService.createInstance(lpt,t,this.outputLocation,this.outputFolderCreationPromise)}setLevelContext(){let e=this.activeChannel?.outputChannelDescriptor,t=e?this.getLogLevel(e):void 0;this.activeOutputChannelLevelContext.set(t!==void 0?ux(t):"")}async setLevelIsDefaultContext(){let e=this.activeChannel?.outputChannelDescriptor,t=e?this.getLogLevel(e):void 0;if(t!==void 0){let o=this.defaultLogLevelsService.getDefaultLogLevel(e?.extensionId);this.activeOutputChannelLevelIsDefaultContext.set(o===t)}else this.activeOutputChannelLevelIsDefaultContext.set(!1)}setActiveChannel(e){this.activeChannel=e;let t=e?.outputChannelDescriptor;this.activeFileOutputChannelContext.set(!!t&&xN(t)),this.activeLogOutputChannelContext.set(!!t?.log),this.activeOutputChannelLevelSettableContext.set(t!==void 0&&this.canSetLogLevel(t)),this.setLevelIsDefaultContext(),this.setLevelContext(),this.activeChannel?this.storageService.store(_Ki,this.activeChannel.id,1,1):this.storageService.remove(_Ki,1)}};e2e=I([m(0,de),m(1,F),m(2,Bt),m(3,re),m(4,Ol),m(5,to),m(6,Gt),m(7,X),m(8,FR),m(9,nn),m(10,ge),m(11,Mt)],e2e);var t2e=class extends lW{constructor(e,t,o,n,r,s,l,c,u,p,h,g){let f=new $l(Ur.MARKERS_VIEW_STORAGE_ID,g),v=f.getMemento(1,1);super({...e,filterOptions:{placeholder:d(14095,null),focusContextKey:DRe.key,text:v.filter||"",history:[]}},t,o,n,r,s,l,c,u,p);this.outputService=h;this.editorPromise=null;this.memento=f,this.panelState=v;let b=h.filters;b.text=this.panelState.filter||"",b.trace=this.panelState.showTrace??!0,b.debug=this.panelState.showDebug??!0,b.info=this.panelState.showInfo??!0,b.warning=this.panelState.showWarning??!0,b.error=this.panelState.showError??!0,b.categories=this.panelState.categories??"",this.scrollLockContextKey=POt.bindTo(this.contextKeyService);let S=this._register(l.createChild(new Po([X,this.scopedContextKeyService])));this.editor=this._register(S.createInstance(cpt)),this._register(this.editor.onTitleAreaUpdate(()=>{this.updateTitle(this.editor.getTitle()),this.updateActions()})),this._register(this.onDidChangeBodyVisibility(()=>this.onDidChangeVisibility(this.isBodyVisible()))),this._register(this.filterWidget.onDidChangeFilterText(y=>h.filters.text=y)),this.checkMoreFilters(),this._register(h.filters.onDidChange(()=>this.checkMoreFilters()))}get scrollLock(){return!!this.scrollLockContextKey.get()}set scrollLock(e){this.scrollLockContextKey.set(e)}showChannel(e,t){this.channelId!==e.id&&this.setInput(e),t||this.focus()}focus(){super.focus(),this.editorPromise?.then(()=>this.editor.focus())}clearFilterText(){this.filterWidget.setFilterText("")}renderBody(e){super.renderBody(e),this.editor.create(e),e.classList.add("output-view");let t=this.editor.getControl();t.setAriaOptions({role:"document",activeDescendant:void 0}),this._register(t.onDidChangeModelContent(()=>{this.scrollLock||this.editor.revealLastLine()})),this._register(t.onDidChangeCursorPosition(o=>{if(o.reason!==3||!this.configurationService.getValue("output.smartScroll.enabled"))return;let n=t.getModel();if(n){let r=o.position.lineNumber,s=n.getLineCount();this.scrollLock=s!==r}}))}layoutBodyContent(e,t){this.editor.layout(new di(t,e))}onDidChangeVisibility(e){this.editor.setVisible(e),e||this.clearInput()}setInput(e){this.channelId=e.id,this.checkMoreFilters();let t=this.createInput(e);(!this.editor.input||!t.matches(this.editor.input))&&(this.editorPromise?.cancel(),this.editorPromise=Hn(o=>this.editor.setInput(t,{preserveFocus:!0},Object.create(null),o)))}checkMoreFilters(){let e=this.outputService.filters;this.filterWidget.checkMoreFilters(!e.trace||!e.debug||!e.info||!e.warning||!e.error||!!this.channelId&&e.categories.includes(`,${this.channelId}:`))}clearInput(){this.channelId=void 0,this.editor.clearInput(),this.editorPromise=null}createInput(e){return this.instantiationService.createInstance(Vx,e.uri,d(14094,null,e.label),d(14092,null,e.label),void 0,void 0)}saveState(){let e=this.outputService.filters;this.panelState.filter=e.text,this.panelState.showTrace=e.trace,this.panelState.showDebug=e.debug,this.panelState.showInfo=e.info,this.panelState.showWarning=e.warning,this.panelState.showError=e.error,this.panelState.categories=e.categories,this.memento.saveMemento(),super.saveState()}};t2e=I([m(1,Le),m(2,Xe),m(3,B),m(4,X),m(5,ji),m(6,F),m(7,Je),m(8,Pe),m(9,ot),m(10,Tl),m(11,de)],t2e);var cpt=class extends _he{constructor(e,t,o,n,r,s,l,c,u){super(md,l.activeGroup,e,t,o,r,s,l,c,u);this.configurationService=n;this.resourceContext=this._register(t.createInstance(Ho))}getId(){return md}getTitle(){return d(14093,null)}getConfigurationOverrides(e){let t=super.getConfigurationOverrides(e);t.wordWrap="on",t.lineNumbers="off",t.glyphMargin=!1,t.lineDecorationsWidth=20,t.rulers=[],t.folding=!1,t.scrollBeyondLastLine=!1,t.renderLineHighlight="none",t.minimap={enabled:!1},t.renderValidationDecorations="editable",t.padding=void 0,t.readOnly=!0,t.domReadOnly=!0,t.roundedSelection=!1,t.unicodeHighlight={nonBasicASCII:!1,invisibleCharacters:!1,ambiguousCharacters:!1};let o=this.configurationService.getValue("[Log]");return o&&(o["editor.minimap.enabled"]&&(t.minimap={enabled:!0}),o["editor.wordWrap"]&&(t.wordWrap=o["editor.wordWrap"])),t}getAriaLabel(){return this.input?this.input.getAriaLabel():d(14096,null)}computeAriaLabel(){return this.input?ree(this.input,void 0,void 0,this.editorGroupService.count):this.getAriaLabel()}async setInput(e,t,o,n){let r=!(t&&t.preserveFocus);this.input&&e.matches(this.input)||(this.input&&this.input.dispose(),await super.setInput(e,t,o,n),this.resourceContext.set(e.resource),r&&this.focus(),this.revealLastLine())}clearInput(){this.input&&this.input.dispose(),super.clearInput(),this.resourceContext.reset()}createEditor(e){e.setAttribute("role","document"),super.createEditor(e);let t=this.scopedContextKeyService;t&&_Ot.bindTo(t).set(!0)}_getContributions(){return[...ml.getEditorContributions(),{id:i2e.ID,ctor:i2e,instantiation:0}]}getCodeEditorWidgetOptions(){return{contributions:this._getContributions()}}};cpt=I([m(0,_e),m(1,F),m(2,de),m(3,B),m(4,Gn),m(5,Pe),m(6,kt),m(7,ie),m(8,ge)],cpt);var i2e=class extends k{constructor(e,t){super();this.editor=e;this.outputService=t;this.modelDisposables=this._register(new O);this.hiddenAreas=[];this.categories=new Map;this.decorationsCollection=e.createDecorationsCollection(),this._register(e.onDidChangeModel(()=>this.onDidChangeModel())),this._register(this.outputService.filters.onDidChange(()=>e.hasModel()&&this.filter(e.getModel())))}static{this.ID="output.editor.contrib.filterController"}onDidChangeModel(){if(this.modelDisposables.clear(),this.hiddenAreas=[],this.categories.clear(),!this.editor.hasModel())return;let e=this.editor.getModel();this.filter(e);let t=()=>{let n=e.getLineCount();return n>1&&e.getLineMaxColumn(n)===1?n-1:n},o=t();this.modelDisposables.add(e.onDidChangeContent(n=>{n.changes.every(r=>r.range.startLineNumber>o)?this.filterIncremental(e,o+1):this.filter(e),o=t()}))}filter(e){this.hiddenAreas=[],this.decorationsCollection.clear(),this.filterIncremental(e,1)}filterIncremental(e,t){let{findMatches:o,hiddenAreas:n,categories:r}=this.compute(e,t);if(this.hiddenAreas.push(...n),this.editor.setHiddenAreas(this.hiddenAreas,this),o.length&&this.decorationsCollection.append(o),r.size){let s=this;for(let[l,c]of r)this.categories.has(l)||(this.categories.set(l,c),this.modelDisposables.add(W(class extends z{constructor(){super({id:`workbench.actions.${md}.toggle.${l}`,title:c,toggled:C.regex(BOt.key,new RegExp(`.*,${Ss(l)},.*`)).negate(),menu:{id:qx,group:"1_category_filter",when:C.and(C.equals("view",md))}})}async run(){s.outputService.filters.toggleCategory(l)}})))}}shouldShowLine(e,t,o,n){let r=[];if(n.length>0){for(let s of n)if(e.findMatches(s,t,!1,!1,null,!1).length>0)return{show:!1,matches:[]}}if(o.length>0){let s=!1;for(let l of o){let c=e.findMatches(l,t,!1,!1,null,!1);if(c.length>0){s=!0;for(let u of c)r.push({range:u.range,options:w4._FIND_MATCH_DECORATION})}}return{show:s,matches:r}}return{show:!0,matches:r}}compute(e,t){let o=this.outputService.filters,n=this.outputService.getActiveChannel(),r=[],s=[],l=new Map,c=n?.getLogEntries();if(n&&c?.length){let p=!o.trace||!o.debug||!o.info||!o.warning||!o.error,h=c.findIndex(g=>t>=g.range.startLineNumber&&t<=g.range.endLineNumber);if(h===-1)return{findMatches:r,hiddenAreas:s,categories:l};for(let g=h;g<c.length;g++){let f=c[g];if(f.category&&l.set(`${n.id}:${f.category}`,f.category),p&&!this.shouldShowLogLevel(f,o)){s.push(f.range);continue}if(!this.shouldShowCategory(n.id,f,o)){s.push(f.range);continue}if(o.includePatterns.length>0||o.excludePatterns.length>0){let v=this.shouldShowLine(e,f.range,o.includePatterns,o.excludePatterns);v.show?r.push(...v.matches):s.push(f.range)}}return{findMatches:r,hiddenAreas:s,categories:l}}if(o.includePatterns.length===0&&o.excludePatterns.length===0)return{findMatches:r,hiddenAreas:s,categories:l};let u=e.getLineCount();for(let p=t;p<=u;p++){let h=new G(p,1,p,e.getLineMaxColumn(p)),g=this.shouldShowLine(e,h,o.includePatterns,o.excludePatterns);g.show?r.push(...g.matches):s.push(h)}return{findMatches:r,hiddenAreas:s,categories:l}}shouldShowLogLevel(e,t){switch(e.logLevel){case 1:return t.trace;case 2:return t.debug;case 3:return t.info;case 4:return t.warning;case 5:return t.error}return!0}shouldShowCategory(e,t,o){return t.category?!o.hasCategory(`${e}:${t.category}`):!0}};i2e=I([m(1,Tl)],i2e);var f7t=class{constructor(){this.type="help";this.priority=105;this.name="outputFilter";this.when=DRe}getProvider(i){return new RKi(i.get(Le))}},RKi=class extends k{constructor(e){super();this._keybindingService=e;this.id="outputFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}provideContent(){let e=[];return e.push(d(14072,null)),e.push(d(14064,null)),e.push(""),e.push(d(14084,null)),e.push(d(14083,null)),e.push(""),e.push(d(14074,null)),e.push(d(14073,null)),e.push(""),e.push(d(14067,null)),e.push(d(14065,null)),e.push(d(14066,null)),e.push(""),e.push(d(14071,null)),e.push(d(14068,null)),e.push(d(14069,null)),e.push(d(14070,null)),e.push(""),e.push(d(14088,null)),e.push(d(14090,null)),e.push(d(14087,null)),e.push(d(14085,null)),e.push(d(14089,null)),e.push(d(14086,null)),e.push(""),e.push(d(14075,null)),e.push(d(14076,null)),e.push(d(14078,null)),e.push(d(14077,null)),e.push(""),e.push(d(14079,null,this._describeCommand("workbench.action.openSettings")||"Ctrl+,")),e.push(d(14080,null)),e.push(d(14082,null)),e.push(d(14081,null)),e.push(""),e.push(d(14063,null)),e.push(d(14062,null)),e.join(`
`)}_describeCommand(e){return this._keybindingService.lookupKeybinding(e)?.getAriaLabel()??void 0}onClose(){}};var $kn="importedLog.";Ce(Tl,e2e,1);_a.register(new f7t);CA.registerLanguage({id:TRe,extensions:[],mimetypes:[TOt]});CA.registerLanguage({id:_Re,extensions:[],mimetypes:[Mee]});var HOo=Oe("output-view-icon",L.output,d(14049,null)),jkn=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:md,title:P(14044,"Output"),icon:HOo,order:1,ctorDescriptor:new Vt(Qc,[md,{mergeViewWithContainerWhenSingleView:!0}]),storageId:md,hideIfEmpty:!0,windowEnablement:3},1,{doNotRegisterOpenCommand:!0});oe.as(Kn.ViewsRegistry).registerViews([{id:md,name:P(14044,"Output"),containerIcon:HOo,canMoveView:!0,canToggleVisibility:!0,ctorDescriptor:new Vt(t2e),openCommandActionDescriptor:{id:"workbench.action.output.toggleOutput",mnemonicTitle:d(14039,null),keybindings:{primary:3123,linux:{primary:Gi(2089,2086)}},order:1},windowEnablement:3}],jkn);var dpt=class extends k{constructor(e,t){super();this.outputService=e;this.editorService=t;this.registerActions()}registerActions(){this.registerSwitchOutputAction(),this.registerAddCompoundLogAction(),this.registerRemoveLogAction(),this.registerShowOutputChannelsAction(),this.registerClearOutputAction(),this.registerToggleAutoScrollAction(),this.registerOpenActiveOutputFileAction(),this.registerOpenActiveOutputFileInAuxWindowAction(),this.registerSaveActiveOutputAsAction(),this.registerShowLogsAction(),this.registerOpenLogFileAction(),this.registerConfigureActiveOutputLogLevelAction(),this.registerLogLevelFilterActions(),this.registerClearFilterActions(),this.registerExportLogsAction(),this.registerImportLogAction()}registerSwitchOutputAction(){this._register(W(class extends z{constructor(){super({id:"workbench.output.action.switchBetweenOutputs",title:d(14057,null)})}async run(r,s){s&&r.get(Tl).showChannel(s,!0)}}));let e=new R("workbench.output.menu.switchOutput");this._register(be.appendMenuItem(R.ViewTitle,{submenu:e,title:d(14058,null),group:"navigation",when:C.equals("view",md),order:1,isSelection:!0}));let t=new Map;this._register(ee(()=>je(t.values())));let o=r=>{for(let s of r){let l=s.label,c=s.user?"2_user_outputchannels":s.extensionId?"0_ext_outputchannels":"1_core_outputchannels";t.set(s.id,W(class extends z{constructor(){super({id:`workbench.action.output.show.${s.id}`,title:l,toggled:AOt.isEqualTo(s.id),menu:{id:e,group:c}})}async run(u){return u.get(Tl).showChannel(s.id,!0)}}))}};o(this.outputService.getChannelDescriptors());let n=oe.as(bb.OutputChannels);this._register(n.onDidRegisterChannel(r=>{let s=this.outputService.getChannelDescriptor(r);s&&o([s])})),this._register(n.onDidRemoveChannel(r=>{t.get(r.id)?.dispose(),t.delete(r.id)}))}registerAddCompoundLogAction(){this._register(W(class extends z{constructor(){super({id:"workbench.action.output.addCompoundLog",title:P(14028,"Add Compound Log..."),category:P(14044,"Output"),f1:!0,menu:[{id:R.ViewTitle,when:C.equals("view",md),group:"2_add"}]})}async run(e){let t=e.get(Tl),o=e.get($e),n=[],r=[];for(let c of t.getChannelDescriptors())c.log&&!c.user&&(c.extensionId?n.push(c):r.push(c));let s=[];for(let c of r.sort((u,p)=>u.label.localeCompare(p.label)))s.push(c);n.length&&r.length&&s.push({type:"separator",label:d(14032,null)});for(let c of n.sort((u,p)=>u.label.localeCompare(p.label)))s.push(c);let l=await o.pick(s,{placeHolder:d(14052,null),canPickMany:!0});l?.length&&t.showChannel(t.registerCompoundLogChannel(l))}}))}registerRemoveLogAction(){this._register(W(class extends z{constructor(){super({id:"workbench.action.output.remove",title:P(14050,"Remove Output..."),category:P(14044,"Output"),f1:!0})}async run(e){let t=e.get(Tl),o=e.get($e),n=e.get(Ne),r=t.getChannelDescriptors().filter(c=>c.user);if(r.length===0){n.info(d(14040,null));return}let s=await o.pick(r,{placeHolder:d(14052,null),canPickMany:!0});if(!s?.length)return;let l=oe.as(bb.OutputChannels);for(let c of s)l.removeChannel(c.id)}}))}registerShowOutputChannelsAction(){this._register(W(class extends z{constructor(){super({id:"workbench.action.showOutputChannels",title:P(14056,"Show Output Channels..."),category:P(14044,"Output"),f1:!0})}async run(e){let t=e.get(Tl),o=e.get($e),n=[],r=[];for(let c of t.getChannelDescriptors())c.extensionId?n.push(c):r.push(c);let s=[];for(let{id:c,label:u}of n)s.push({id:c,label:u});n.length&&r.length&&s.push({type:"separator"});for(let{id:c,label:u}of r)s.push({id:c,label:u});let l=await o.pick(s,{placeHolder:d(14054,null)});if(l)return t.showChannel(l.id)}}))}registerClearOutputAction(){this._register(W(class extends z{constructor(){super({id:"workbench.output.action.clearOutput",title:P(14030,"Clear Output"),category:Fe.View,menu:[{id:R.ViewTitle,when:C.equals("view",md),group:"navigation",order:2},{id:R.CommandPalette},{id:R.EditorContext,when:_Ot}],icon:L.clearAll})}async run(e){let t=e.get(Tl),o=e.get(br),n=t.getActiveChannel();n&&(n.clear(),o.playSignal(tn.clear))}}))}registerToggleAutoScrollAction(){this._register(W(class extends z{constructor(){super({id:"workbench.output.action.toggleAutoScroll",title:P(14059,"Toggle Auto Scrolling"),tooltip:d(14047,null),menu:{id:R.ViewTitle,when:C.and(C.equals("view",md)),group:"navigation",order:3},icon:L.lock,toggled:{condition:POt,icon:L.unlock,tooltip:d(14048,null)}})}async run(e){let t=e.get(Gt).getActiveViewWithId(md);t.scrollLock=!t.scrollLock}}))}registerOpenActiveOutputFileAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.action.openActiveLogOutputFile",title:P(14041,"Open Output in Editor"),menu:[{id:R.ViewTitle,when:C.equals("view",md),group:"navigation",order:4,isHiddenByDefault:!0}],icon:L.goToFile})}async run(){e.openActiveOutput()}}))}registerOpenActiveOutputFileInAuxWindowAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.action.openActiveLogOutputFileInNewWindow",title:P(14042,"Open Output in New Window"),menu:[{id:R.ViewTitle,when:C.equals("view",md),group:"navigation",order:5,isHiddenByDefault:!0}],icon:L.emptyWindow})}async run(){e.openActiveOutput(ff)}}))}registerSaveActiveOutputAsAction(){this._register(W(class extends z{constructor(){super({id:"workbench.action.saveActiveLogOutputAs",title:P(14051,"Save Output As..."),menu:[{id:R.ViewTitle,when:C.equals("view",md),group:"1_export",order:1}]})}async run(e){let t=e.get(Tl),o=t.getActiveChannel();if(o){let n=t.getChannelDescriptors().find(r=>r.id===o.id);n&&await t.saveOutputAs(void 0,n)}}}))}async openActiveOutput(e){let t=this.outputService.getActiveChannel();t&&await this.editorService.openEditor({resource:t.uri,options:{pinned:!0}},e)}registerConfigureActiveOutputLogLevelAction(){let e=new R("workbench.output.menu.logLevel");this._register(be.appendMenuItem(R.ViewTitle,{submenu:e,title:d(14037,null),group:"navigation",when:C.and(C.equals("view",md),ROt),icon:L.gear,order:6}));let t=0,o=n=>{this._register(W(class extends z{constructor(){super({id:`workbench.action.output.activeOutputLogLevel.${n}`,title:z4e(n).value,toggled:LOt.isEqualTo(ux(n)),menu:{id:e,order:t++,group:"0_level"}})}async run(r){let s=r.get(Tl),l=s.getActiveChannel();if(l){let c=s.getChannelDescriptor(l.id);c&&s.setLogLevel(c,n)}}}))};o(1),o(2),o(3),o(4),o(5),o(0),this._register(W(class extends z{constructor(){super({id:"workbench.action.output.activeOutputLogLevelDefault",title:d(14038,null),menu:{id:e,order:t,group:"1_default"},precondition:MOt.negate()})}async run(n){let r=n.get(Tl),s=n.get(Ol),l=n.get(FR),c=r.getActiveChannel();if(c){let u=r.getChannelDescriptor(c.id);if(u&&xN(u)){let p=s.getLogLevel(u.source.resource);return await l.setDefaultLogLevel(p,u.extensionId)}}}}))}registerShowLogsAction(){this._register(W(class extends z{constructor(){super({id:"workbench.action.showLogs",title:P(14055,"Show Logs..."),category:Fe.Developer,menu:{id:R.CommandPalette}})}async run(e){let t=e.get(Tl),o=e.get($e),n=[],r=[];for(let c of t.getChannelDescriptors())c.log&&(c.extensionId?n.push(c):r.push(c));let s=[];for(let{id:c,label:u}of r)s.push({id:c,label:u});n.length&&r.length&&s.push({type:"separator",label:d(14032,null)});for(let{id:c,label:u}of n)s.push({id:c,label:u});let l=await o.pick(s,{placeHolder:d(14052,null)});if(l)return t.showChannel(l.id)}}))}registerOpenLogFileAction(){this._register(W(class extends z{constructor(){super({id:"workbench.action.openLogFile",title:P(14043,"Open Log..."),category:Fe.Developer,menu:{id:R.CommandPalette},metadata:{description:"workbench.action.openLogFile",args:[{name:"logFile",schema:{markdownDescription:d(14035,null),type:"string"}}]}})}async run(e,t){let o=e.get(Tl),n=e.get($e),r=e.get(ie),s,l=t&&typeof t=="string"?t:void 0,c=[],u=[];for(let p of o.getChannelDescriptors())if(p.log){let h={id:p.id,label:p.label};p.extensionId?c.push(h):u.push(h),h.id===l&&(s=h)}if(!s){let p=[...c.sort((h,g)=>h.label.localeCompare(g.label))];p.length&&u.length&&(p.push({type:"separator"}),p.push(...u.sort((h,g)=>h.label.localeCompare(g.label)))),s=await n.pick(p,{placeHolder:d(14053,null)})}if(s?.id){let p=o.getChannel(s.id);p&&await r.openEditor({resource:p.uri,options:{pinned:!0}})}}}))}registerLogLevelFilterActions(){let e=0,t=(o,n)=>{this._register(W(class extends rr{constructor(){super({id:`workbench.actions.${md}.toggle.${ux(o)}`,title:z4e(o).value,metadata:{description:P(14060,"Show or hide {0} messages in the output",ux(o))},toggled:n,menu:{id:qx,group:"2_log_filter",when:C.and(C.equals("view",md),DOt),order:e++},viewId:md})}async runInView(r,s){this.toggleLogLevelFilter(r.get(Tl),o)}toggleLogLevelFilter(r,s){switch(s){case 1:r.filters.trace=!r.filters.trace;break;case 2:r.filters.debug=!r.filters.debug;break;case 3:r.filters.info=!r.filters.info;break;case 4:r.filters.warning=!r.filters.warning;break;case 5:r.filters.error=!r.filters.error;break}}}))};t(1,NOt),t(2,OOt),t(3,FOt),t(4,WOt),t(5,VOt)}registerClearFilterActions(){this._register(W(class extends rr{constructor(){super({id:`workbench.actions.${md}.clearFilterText`,title:d(14029,null),keybinding:{when:DRe,weight:200,primary:9},viewId:md})}async runInView(e,t){t.clearFilterText()}}))}registerExportLogsAction(){this._register(W(class extends z{constructor(){super({id:"workbench.action.exportLogs",title:P(14031,"Export Logs..."),f1:!0,category:Fe.Developer,menu:[{id:R.ViewTitle,when:C.equals("view",md),group:"1_export",order:2}]})}async run(e,t){let o=e.get(Tl),n=e.get($e),r=[],s=[],l=[];for(let p of o.getChannelDescriptors())p.log&&(p.extensionId?r.push(p):p.user?l.push(p):s.push(p));let c=[];for(let p of s.sort((h,g)=>h.label.localeCompare(g.label)))c.push(p);r.length&&s.length&&c.push({type:"separator",label:d(14032,null)});for(let p of r.sort((h,g)=>h.label.localeCompare(g.label)))c.push(p);l.length&&(r.length||s.length)&&c.push({type:"separator",label:d(14061,null)});for(let p of l.sort((h,g)=>h.label.localeCompare(g.label)))c.push(p);let u;if(t?.outputChannelIds){let p=t.outputChannelIds.map(g=>g.trim().toLowerCase()),h=c.filter(g=>!(yo(g,{type:!0})&&g.type==="separator"));p.includes("*")?u=h:u=h.filter(g=>p.includes(g.id.toLowerCase()))}else u=await n.pick(c,{placeHolder:d(14052,null),canPickMany:!0});u?.length&&await o.saveOutputAs(t?.outputPath,...u)}}))}registerImportLogAction(){this._register(W(class extends z{constructor(){super({id:"workbench.action.importLog",title:P(14033,"Import Log..."),f1:!0,category:Fe.Developer,menu:[{id:R.ViewTitle,when:C.equals("view",md),group:"2_add",order:2}]})}async run(e){let t=e.get(Tl),n=await e.get(nn).showOpenDialog({title:d(14034,null),canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!0,filters:[{name:d(14036,null),extensions:["log"]}]});if(n?.length){let r=Be(n[0]),s=`${$kn}${Date.now()}`;oe.as(bb.OutputChannels).registerChannel({id:s,label:r,log:!0,user:!0,source:n.length===1?{resource:n[0]}:n.map(l=>({resource:l,name:Be(l).split(".")[0]}))}),t.showChannel(s)}}}))}};dpt=I([m(0,Tl),m(1,ie)],dpt);oe.as(Zi.Workbench).registerWorkbenchContribution(dpt,3);oe.as($t.Configuration).registerConfiguration({id:"output",order:30,title:d(14045,null),type:"object",properties:{"output.smartScroll.enabled":{type:"boolean",description:d(14046,null),default:!0,scope:4,tags:["output"]}}});xt.registerKeybindingRule({id:"cursorWordAccessibilityLeft",when:C.and(me.textInputFocus,Oa,cC,C.equals(rc.key,md)),primary:2063,weight:200});xt.registerKeybindingRule({id:"cursorWordAccessibilityLeftSelect",when:C.and(me.textInputFocus,Oa,cC,C.equals(rc.key,md)),primary:3087,weight:200});xt.registerKeybindingRule({id:"cursorWordAccessibilityRight",when:C.and(me.textInputFocus,Oa,cC,C.equals(rc.key,md)),primary:2065,weight:200});xt.registerKeybindingRule({id:"cursorWordAccessibilityRightSelect",when:C.and(me.textInputFocus,Oa,cC,C.equals(rc.key,md)),primary:3089,weight:200});var o2e=class extends k{constructor(e,t,o){super();this._loggerService=e;this._logger=this._loggerService.createLogger(Ve(o.logsHome,"terminal.log"),{id:"terminal",name:d(2571,null)}),this._register(U.runAndSubscribe(t.onDidChangeWorkspaceFolders,()=>{this._workspaceId=t.getWorkspace().id.substring(0,7)}))}get onDidChangeLogLevel(){return this._logger.onDidChangeLogLevel}getLevel(){return this._logger.getLevel()}setLevel(e){this._logger.setLevel(e)}flush(){this._logger.flush()}trace(e,...t){this._logger.trace(this._formatMessage(e),t)}debug(e,...t){this._logger.debug(this._formatMessage(e),t)}info(e,...t){this._logger.info(this._formatMessage(e),t)}warn(e,...t){this._logger.warn(this._formatMessage(e),t)}error(e,...t){if(e instanceof Error){this._logger.error(this._formatMessage(""),e,t);return}this._logger.error(this._formatMessage(e),t)}_formatMessage(e){return this._logger.getLevel()===1?`[${this._workspaceId}] ${e}`:e}};o2e=I([m(0,Ol),m(1,Ae),m(2,ko)],o2e);var n2e=class{constructor(i){this._viewsService=i}getEditableData(i){return this._editable&&this._editable.instance===i?this._editable.data:void 0}setEditable(i,e){e?this._editable={instance:i,data:e}:this._editable=void 0;let t=this._viewsService.getActiveViewWithId(Fc),o=this.isEditable(i);t?.terminalTabbedView?.setEditable(o)}isEditable(i){return!!this._editable&&(this._editable.instance===i||!i)}getEditingTerminal(){return this._editingTerminal}setEditingTerminal(i){this._editingTerminal=i}};n2e=I([m(0,Gt)],n2e);var zOo=`
- `+["`${cwd}`: "+d(16165,null),"`${cwdFolder}`: "+d(16166,null),"`${workspaceFolder}`: "+d(16326,null),"`${workspaceFolderName}`: "+d(16327,null),"`${local}`: "+d(16173,null),"`${process}`: "+d(16176,null),"`${progress}`: "+d(16177,null),"`${separator}`: "+d(16178,null,"(` - `)"),"`${sequence}`: "+d(16179,null),"`${task}`: "+d(16183,null),"`${shellType}`: "+d(16182,null),"`${shellCommand}`: "+d(16180,null),"`${shellPromptInput}`: "+d(16181,null)].join(`
- `),KOo=d(16325,null);KOo+=zOo;var GOo=d(16323,null);GOo+=zOo;var LKi=et?12:14,UOo={"terminal.integrated.sendKeybindingsToShell":{markdownDescription:d(16274,null,"`#terminal.integrated.commandsToSkipShell#`"),type:"boolean",default:!1},"terminal.integrated.tabs.defaultColor":{description:d(16291,null),...iyi,scope:5},"terminal.integrated.tabs.defaultIcon":{description:d(16292,null),...oyi,default:L.terminal.id,scope:5},"terminal.integrated.tabs.enabled":{description:d(16294,null),type:"boolean",default:!0},"terminal.integrated.tabs.enableAnimation":{description:d(16293,null),type:"boolean",default:!0},"terminal.integrated.tabs.hideCondition":{description:d(16298,null),type:"string",enum:["never","singleTerminal","singleGroup"],enumDescriptions:[d(16299,null),d(16301,null),d(16300,null)],default:"singleTerminal"},"terminal.integrated.tabs.showActiveTerminal":{description:d(16311,null),type:"string",enum:["always","singleTerminal","singleTerminalOrNarrow","never"],enumDescriptions:[d(16312,null),d(16314,null),d(16315,null),d(16313,null)],default:"singleTerminalOrNarrow"},"terminal.integrated.tabs.showActions":{description:d(16306,null),type:"string",enum:["always","singleTerminal","singleTerminalOrNarrow","never"],enumDescriptions:[d(16307,null),d(16309,null),d(16310,null),d(16308,null)],default:"singleTerminalOrNarrow"},"terminal.integrated.tabs.location":{type:"string",enum:["left","right"],enumDescriptions:[d(16303,null),d(16304,null)],default:"right",description:d(16302,null)},"terminal.integrated.defaultLocation":{type:"string",enum:["editor","view"],enumDescriptions:[d(16208,null),d(16209,null)],default:"view",description:d(16207,null),agentsWindow:{default:"view",readOnly:!0}},"terminal.integrated.tabs.focusMode":{type:"string",enum:["singleClick","doubleClick"],enumDescriptions:[d(16297,null),d(16296,null)],default:"doubleClick",description:d(16295,null)},"terminal.integrated.tabs.allowAgentCliTitle":{description:d(16290,null),type:"boolean",default:!0},"terminal.integrated.macOptionIsMeta":{description:d(16256,null),type:"boolean",default:!1},"terminal.integrated.macOptionClickForcesSelection":{description:d(16255,null),type:"boolean",default:!1},"terminal.integrated.altClickMovesCursor":{markdownDescription:d(16188,null,"`#editor.multiCursorModifier#`","`'alt'`"),type:"boolean",default:!0},"terminal.integrated.copyOnSelection":{description:d(16200,null),type:"boolean",default:!1},"terminal.integrated.enableMultiLinePasteWarning":{markdownDescription:d(16222,null),type:"string",enum:["auto","always","never"],markdownEnumDescriptions:[d(16224,null),d(16223,null),d(16225,null)],default:"auto"},"terminal.integrated.drawBoldTextInBrightColors":{description:d(16217,null),type:"boolean",default:!0},"terminal.integrated.fontFamily":{markdownDescription:d(16238,null,"`#editor.fontFamily#`"),type:"string"},"terminal.integrated.fontLigatures.enabled":{markdownDescription:d(16239,null,"`#terminal.integrated.fontFamily#`"),type:"boolean",default:!1},"terminal.integrated.fontLigatures.featureSettings":{markdownDescription:d(16241,null)+`

- `+['`"calt" off, "ss03"`','`"liga" on`','`"calt" off, "dlig" on`'].join(`
- `),type:"string",default:'"calt" on'},"terminal.integrated.fontLigatures.fallbackLigatures":{markdownDescription:d(16240,null,"`#terminal.integrated.gpuAcceleration#`","`#terminal.integrated.fontFamily#`"),type:"array",items:[{type:"string"}],default:["<--","<---","<<-","<-","->","->>","-->","--->","<==","<===","<<=","<=","=>","=>>","==>","===>",">=",">>=","<->","<-->","<--->","<---->","<=>","<==>","<===>","<====>","::",":::","<~~","</","</>","/>","~~>","==","!=","/=","~=","<>","===","!==","!===","<:",":=","*=","*+","<*","<*>","*>","<|","<|>","|>","+*","=*","=:",":>","/*","*/","+++","<!--","<!---"]},"terminal.integrated.fontSize":{description:d(16242,null),type:"number",default:LKi,minimum:6,maximum:100},"terminal.integrated.letterSpacing":{description:d(16253,null),type:"number",default:NNt},"terminal.integrated.lineHeight":{description:d(16254,null),type:"number",default:ONt},"terminal.integrated.minimumContrastRatio":{markdownDescription:d(16260,null),type:"number",default:4.5,tags:["accessibility"]},"terminal.integrated.tabStopWidth":{markdownDescription:d(16316,null),type:"number",minimum:1,default:8},"terminal.integrated.fastScrollSensitivity":{markdownDescription:d(16233,null),type:"number",default:5},"terminal.integrated.mouseWheelScrollSensitivity":{markdownDescription:d(16261,null),type:"number",default:1},"terminal.integrated.bellDuration":{markdownDescription:d(16189,null),type:"number",default:1e3},"terminal.integrated.fontWeight":{anyOf:[{type:"number",minimum:fJe,maximum:vJe,errorMessage:d(16245,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:uyi}],description:d(16243,null),default:"normal"},"terminal.integrated.fontWeightBold":{anyOf:[{type:"number",minimum:fJe,maximum:vJe,errorMessage:d(16245,null)},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:uyi}],description:d(16244,null),default:"bold"},"terminal.integrated.cursorBlinking":{description:d(16201,null),type:"boolean",default:!1},"terminal.integrated.textBlinking":{description:d(16317,null),type:"boolean",default:!1},"terminal.integrated.cursorStyle":{description:d(16202,null),enum:["block","line","underline"],default:"block"},"terminal.integrated.cursorStyleInactive":{description:d(16203,null),enum:["outline","block","line","underline","none"],default:"outline"},"terminal.integrated.cursorWidth":{markdownDescription:d(16204,null,"`#terminal.integrated.cursorStyle#`","`line`"),type:"number",default:1},"terminal.integrated.scrollback":{description:d(16273,null),type:"number",default:1e3},"terminal.integrated.detectLocale":{markdownDescription:d(16210,null),type:"string",enum:["auto","off","on"],markdownEnumDescriptions:[d(16211,null),d(16212,null),d(16213,null)],default:"auto"},"terminal.integrated.gpuAcceleration":{type:"string",enum:["auto","on","off"],markdownEnumDescriptions:[d(16247,null),d(16249,null),d(16248,null)],default:"auto",description:d(16246,null)},"terminal.integrated.tabs.separator":{type:"string",default:" - ",markdownDescription:d(16305,null,"`#terminal.integrated.tabs.title#`","`#terminal.integrated.tabs.description#`")},"terminal.integrated.tabs.title":{type:"string",default:"${process}",markdownDescription:KOo},"terminal.integrated.tabs.description":{type:"string",default:"${task}${separator}${local}${separator}${cwdFolder}",markdownDescription:GOo},"terminal.integrated.rightClickBehavior":{type:"string",enum:["default","copyPaste","paste","selectWord","nothing"],enumDescriptions:[d(16269,null),d(16268,null),d(16271,null),d(16272,null),d(16270,null)],default:et?"selectWord":ii?"copyPaste":"default",description:d(16267,null)},"terminal.integrated.middleClickBehavior":{type:"string",enum:["default","paste"],enumDescriptions:[d(16258,null),d(16259,null)],default:"default",description:d(16257,null)},"terminal.integrated.cwd":{restricted:!0,description:d(16206,null),type:"string",default:void 0,scope:5},"terminal.integrated.confirmOnExit":{description:d(16191,null),type:"string",enum:["never","always","hasChildProcesses"],enumDescriptions:[d(16194,null),d(16192,null),d(16193,null)],default:"never"},"terminal.integrated.confirmOnKill":{description:d(16195,null),type:"string",enum:["never","editor","panel","always"],enumDescriptions:[d(16198,null),d(16197,null),d(16199,null),d(16196,null)],default:"editor"},"terminal.integrated.enableBell":{markdownDeprecationMessage:d(16218,null),type:"boolean",default:!1},"terminal.integrated.enableVisualBell":{description:d(16227,null),type:"boolean",default:!1},"terminal.integrated.commandsToSkipShell":{markdownDescription:d(16190,null,bJe.sort().map(a=>`- ${a}`).join(`
`),`[${d(16174,null)}](command:workbench.action.openRawDefaultSettings '${d(16175,null)}')`),type:"array",items:{type:"string"},default:[]},"terminal.integrated.allowChords":{markdownDescription:d(16184,null,"`#terminal.integrated.commandsToSkipShell#`"),type:"boolean",default:!0},"terminal.integrated.allowMnemonics":{markdownDescription:d(16187,null),type:"boolean",default:!1},"terminal.integrated.env.osx":{restricted:!0,markdownDescription:d(16230,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.env.linux":{restricted:!0,markdownDescription:d(16229,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.env.windows":{restricted:!0,markdownDescription:d(16231,null),type:"object",additionalProperties:{type:["string","null"]},default:{}},"terminal.integrated.environmentChangesRelaunch":{markdownDescription:d(16232,null),type:"boolean",default:!0},"terminal.integrated.showExitAlert":{description:d(16284,null),type:"boolean",default:!0},"terminal.integrated.windowsUseConptyDll":{restricted:!0,markdownDescription:d(16321,null),type:"boolean",default:!0},"terminal.integrated.splitCwd":{description:d(16286,null),type:"string",enum:["workspaceRoot","initial","inherited"],enumDescriptions:[d(16289,null),d(16288,null),d(16287,null)],default:"inherited"},"terminal.integrated.wordSeparators":{markdownDescription:d(16322,null),type:"string",default:" ()[]{}',\"`\u2500\u2018\u2019\u201C\u201D|"},"terminal.integrated.enableFileLinks":{description:d(16219,null),type:"string",enum:["off","on","notRemote"],enumDescriptions:[d(16168,null),d(16169,null),d(16167,null)],default:"on"},"terminal.integrated.allowedLinkSchemes":{description:d(16185,null),type:"array",items:{type:"string"},default:["file","http","https","mailto","vscode","vscode-insiders"]},"terminal.integrated.unicodeVersion":{type:"string",enum:["6","11"],enumDescriptions:[d(16320,null),d(16319,null)],default:"11",description:d(16318,null)},"terminal.integrated.enablePersistentSessions":{description:d(16226,null),type:"boolean",default:!0},"terminal.integrated.persistentSessionReviveProcess":{markdownDescription:d(16262,null),type:"string",enum:["onExit","onExitAndWindowClose","never"],markdownEnumDescriptions:[d(16264,null),d(16265,null),d(16263,null)],default:"onExit"},"terminal.integrated.hideOnStartup":{description:d(16251,null),type:"string",enum:["never","whenEmpty","always"],markdownEnumDescriptions:[d(16171,null),d(16172,null),d(16170,null)],default:"never"},"terminal.integrated.hideOnLastClosed":{description:d(16250,null),type:"boolean",default:!0},"terminal.integrated.customGlyphs":{markdownDescription:d(16205,null,["- Box Drawing (U+2500-U+257F)","- Block Elements (U+2580-U+259F)","- Braille Patterns (U+2800-U+28FF)","- Powerline Symbols (U+E0A0-U+E0D4, Private Use Area)","- Progress Indicators (U+EE00-U+EE0B, Private Use Area)","- Git Branch Symbols (U+F5D0-U+F60D, Private Use Area)","- Symbols for Legacy Computing (U+1FB00-U+1FBFF)"].join(`
`),"`#terminal.integrated.gpuAcceleration#`"),type:"boolean",default:!0},"terminal.integrated.rescaleOverlappingGlyphs":{markdownDescription:d(16266,null),type:"boolean",default:!0},"terminal.integrated.enableKittyKeyboardProtocol":{restricted:!0,markdownDescription:d(16221,null),type:"boolean",default:!0,tags:["advanced"]},"terminal.integrated.enableWin32InputMode":{restricted:!0,markdownDescription:d(16228,null),type:"boolean",default:!1,tags:["experimental","advanced"],experiment:{mode:"auto"}},"terminal.integrated.shellIntegration.enabled":{restricted:!0,markdownDescription:d(16280,null,"`#terminal.integrated.shellIntegration.decorationsEnabled#`","`#editor.accessibilitySupport#`"),type:"boolean",default:!0},"terminal.integrated.shellIntegration.decorationsEnabled":{restricted:!0,markdownDescription:d(16275,null),type:"string",enum:["both","gutter","overviewRuler","never"],enumDescriptions:[d(16276,null),d(16277,null),d(16279,null),d(16278,null)],default:"both"},"terminal.integrated.shellIntegration.timeout":{restricted:!0,markdownDescription:d(16283,null,"`-1`"),type:"integer",minimum:-1,maximum:6e4,default:-1},"terminal.integrated.shellIntegration.quickFixEnabled":{restricted:!0,markdownDescription:d(16282,null),type:"boolean",default:!0},"terminal.integrated.shellIntegration.environmentReporting":{markdownDescription:d(16281,null,`\`#${Yp.SuggestEnabled}#\``),type:"boolean",default:$i.quality!=="stable"},"terminal.integrated.smoothScrolling":{markdownDescription:d(16285,null),type:"boolean",default:!1},"terminal.integrated.ignoreBracketedPasteMode":{markdownDescription:d(16252,null,"`\\x1b[200~`","`\\x1b[201~`"),type:"boolean",default:!1},"terminal.integrated.enableImages":{restricted:!0,markdownDescription:d(16220,null,"`#terminal.integrated.gpuAcceleration#`","`#terminal.integrated.windowsUseConptyDll#`"),type:"boolean",default:!1},"terminal.integrated.focusAfterRun":{markdownDescription:d(16234,null),enum:["terminal","accessible-buffer","none"],default:"none",tags:["accessibility"],markdownEnumDescriptions:[d(16237,null),d(16235,null),d(16236,null)]},"terminal.integrated.allowInUntrustedWorkspace":{restricted:!0,markdownDescription:d(16186,null),type:"boolean",default:!1},"terminal.integrated.developer.ptyHost.latency":{description:d(16215,null),type:"number",minimum:0,default:0,tags:["advanced"]},"terminal.integrated.developer.ptyHost.startupDelay":{description:d(16216,null),type:"number",minimum:0,default:0,tags:["advanced"]},"terminal.integrated.developer.devMode":{description:d(16214,null),type:"boolean",default:!1,tags:["advanced"]},...Xco};async function qOo(a){oe.as($t.Configuration).registerConfiguration({id:"terminal",order:100,title:d(16324,null),type:"object",properties:UOo}),UOo["terminal.integrated.fontFamily"].defaultSnippets=await a()}oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:Yp.DeprecatedAgentSandboxEnabled,migrateFn:(a,i)=>{if(typeof a!="boolean")return[];let e=[];return i(Yp.AgentSandboxEnabled)===void 0&&e.push([Yp.AgentSandboxEnabled,{value:a?"on":"off"}]),e.push([Yp.DeprecatedAgentSandboxEnabled,{value:void 0}]),e}},{key:Yp.DeprecatedAgentSandboxLinuxFileSystem,migrateFn:(a,i)=>{let e=[];return a!==void 0&&i(Yp.AgentSandboxLinuxFileSystem)===void 0&&e.push([Yp.AgentSandboxLinuxFileSystem,{value:a}]),e.push([Yp.DeprecatedAgentSandboxLinuxFileSystem,{value:void 0}]),e}},{key:Yp.DeprecatedAgentSandboxMacFileSystem,migrateFn:(a,i)=>{let e=[];return a!==void 0&&i(Yp.AgentSandboxMacFileSystem)===void 0&&e.push([Yp.AgentSandboxMacFileSystem,{value:a}]),e.push([Yp.DeprecatedAgentSandboxMacFileSystem,{value:void 0}]),e}},{key:"terminal.integrated.enableBell",migrateFn:(a,i)=>{let e=[],t=i("accessibility.signals.terminalBell")?.announcement??i("accessibility.alert.terminalBell");return t!==void 0&&!We(t)&&(t=t?"auto":"off"),e.push(["accessibility.signals.terminalBell",{value:{sound:a?"on":"off",announcement:t}}]),e.push(["terminal.integrated.enableBell",{value:void 0}]),e.push(["terminal.integrated.enableVisualBell",{value:a}]),e}}]);var vr={terminal:d(16357,null),new:d(16358,null),doNotShowAgain:d(16346,null),currentSessionCategory:d(16345,null),previousSessionCategory:d(16353,null),typeTask:d(16356,null),typeLocal:d(16349,null),actionCategory:P(16359,"Terminal"),focus:P(16363,"Focus Terminal"),focusInstance:P(16366,"Focus Terminal"),focusAndHideAccessibleBuffer:P(16364,"Focus Terminal and Hide Accessible Buffer"),kill:{...P(16347,"Kill Terminal"),short:d(16348,null)},moveToEditor:P(16351,"Move Terminal into Editor Area"),moveIntoNewWindow:P(16350,"Move Terminal into New Window"),newInNewWindow:P(16352,"New Terminal Window"),moveToTerminalPanel:P(16367,"Move Terminal into Panel"),changeIcon:P(16362,"Change Icon..."),changeColor:P(16361,"Change Color..."),split:{...P(16354,"Split Terminal"),short:d(16355,null)},unsplit:P(16360,"Unsplit Terminal"),rename:P(16369,"Rename..."),toggleSizeToContentWidth:P(16374,"Toggle Size to Content Width"),focusHover:P(16365,"Focus Hover"),newWithCwd:P(16368,"Create New Terminal Starting in a Custom Working Directory"),renameWithArgs:P(16370,"Rename the Currently Active Terminal"),scrollToPreviousCommand:P(16373,"Scroll to Previous Command"),scrollToNextCommand:P(16372,"Scroll to Next Command"),revealCommand:P(16371,"Reveal Command in Terminal")};var r2e=class extends k{constructor(e,t,o,n,r,s){super();this._ptyHostController=e;this._logService=t;this._workspaceContextService=s;this._isPtyHostUnresponsive=!1;this._onPtyHostConnected=this._register(new T);this.onPtyHostConnected=this._onPtyHostConnected.event;this._onPtyHostRestart=this._register(new T);this.onPtyHostRestart=this._onPtyHostRestart.event;this._onPtyHostUnresponsive=this._register(new T);this.onPtyHostUnresponsive=this._onPtyHostUnresponsive.event;this._onPtyHostResponsive=this._register(new T);this.onPtyHostResponsive=this._onPtyHostResponsive.event;let l,c,u=!1;this._register(this._ptyHostController.onPtyHostExit(()=>{this._logService.error("The terminal's pty host process exited, the connection to all terminal processes was lost")})),this._register(this.onPtyHostConnected(()=>u=!0)),this._register(this._ptyHostController.onPtyHostStart(()=>{this._logService.debug("The terminal's pty host process is starting"),u&&(this._logService.trace("IPtyHostController#onPtyHostRestart"),this._onPtyHostRestart.fire()),c?.dispose(),this._isPtyHostUnresponsive=!1})),this._register(this._ptyHostController.onPtyHostUnresponsive(()=>{c?.dispose(),l||(l={name:d(15919,null),text:`$(debug-disconnect) ${d(15921,null)}`,tooltip:d(15918,null),ariaLabel:d(15920,null),command:aw.DeveloperRestartPtyHost,kind:"warning"}),c=r.addEntry(l,"ptyHostStatus",0),this._isPtyHostUnresponsive=!0,this._onPtyHostUnresponsive.fire()})),this._register(this._ptyHostController.onPtyHostResponsive(()=>{this._isPtyHostUnresponsive&&(this._logService.info("The pty host became responsive again"),c?.dispose(),this._isPtyHostUnresponsive=!1,this._onPtyHostResponsive.fire())})),this._register(this._ptyHostController.onPtyHostRequestResolveVariables(async p=>{if(p.workspaceId!==this._workspaceContextService.getWorkspace().id)return;let h=o.getLastActiveWorkspaceRoot(Q.file),g=h?this._workspaceContextService.getWorkspaceFolder(h)??void 0:void 0,f=p.originalText.map(b=>n.resolveAsync(g,b)),v=await Promise.all(f);this._ptyHostController.acceptPtyHostResolvedVariables(p.requestId,v)}))}get isResponsive(){return!this._isPtyHostUnresponsive}restartPtyHost(){this._ptyHostController.restartPtyHost()}_deserializeTerminalState(e){if(e===void 0)return;let t=JSON.parse(e);if(!Ykn(t)){this._logService.warn("Could not revive serialized processes, wrong format",t);return}if(t.version!==1){this._logService.warn(`Could not revive serialized processes, wrong version "${t.version}"`,t);return}return t.state}_getWorkspaceId(){return this._workspaceContextService.getWorkspace().id}};function Ykn(a){return Di(a)&&"version"in a&&on(a.version)&&"state"in a&&Array.isArray(a.state)}var zse=class extends k{constructor(e,t){super();this.id=e;this.shouldPersist=t;this._properties={cwd:"",initialCwd:"",fixedDimensions:{cols:void 0,rows:void 0},title:"",shellType:void 0,hasChildProcesses:!0,resolvedShellLaunchConfig:{},overrideDimensions:void 0,failedShellIntegrationActivation:!1,usedShellIntegrationInjection:void 0,shellIntegrationInjectionFailureReason:void 0};this._lastDimensions={cols:-1,rows:-1};this._inReplay=!1;this._onProcessData=this._register(new T);this.onProcessData=this._onProcessData.event;this._onProcessReplayComplete=this._register(new T);this.onProcessReplayComplete=this._onProcessReplayComplete.event;this._onProcessReady=this._register(new T);this.onProcessReady=this._onProcessReady.event;this._onDidChangeProperty=this._register(new T);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onProcessExit=this._register(new T);this.onProcessExit=this._onProcessExit.event;this._onRestoreCommands=this._register(new T);this.onRestoreCommands=this._onRestoreCommands.event}async getInitialCwd(){return this._properties.initialCwd}async getCwd(){return this._properties.cwd||this._properties.initialCwd}handleData(e){this._onProcessData.fire(e)}handleExit(e){this._onProcessExit.fire(e)}handleReady(e){this._onProcessReady.fire(e)}handleDidChangeProperty({type:e,value:t}){switch(e){case"cwd":this._properties.cwd=t;break;case"initialCwd":this._properties.initialCwd=t;break;case"resolvedShellLaunchConfig":{let o=t;o.cwd&&!We(o.cwd)&&(o.cwd=A.revive(o.cwd));break}}this._onDidChangeProperty.fire({type:e,value:t})}async handleReplay(e){Wo(`code/terminal/willHandleReplay/${this.id}`);try{this._inReplay=!0;for(let t of e.events){(t.cols!==0||t.rows!==0)&&this._onDidChangeProperty.fire({type:"overrideDimensions",value:{cols:t.cols,rows:t.rows,forceExactSize:!0}});let o={data:t.data,trackCommit:!0};this._onProcessData.fire(o),await o.writePromise}}finally{this._inReplay=!1}e.commands&&this._onRestoreCommands.fire(e.commands),this._onDidChangeProperty.fire({type:"overrideDimensions",value:void 0}),Wo(`code/terminal/didHandleReplay/${this.id}`),this._onProcessReplayComplete.fire()}};var XSe=class extends zse{constructor(e,t,o,n,r){super(e,t);this._remoteTerminalChannel=o;this._remoteAgentService=n;this._logService=r;this._startBarrier=new ip}async start(){if(!await this._remoteAgentService.getEnvironment())throw new Error("Could not fetch remote environment");this._logService.trace("Spawning remote agent process",{terminalId:this.id});let t=await this._remoteTerminalChannel.start(this.id);return t&&yo(t,{message:!0})||this._startBarrier.open(),t}async detach(e){return await this._startBarrier.wait(),this._remoteTerminalChannel.detachFromProcess(this.id,e)}shutdown(e){this._startBarrier.wait().then(t=>{this._remoteTerminalChannel.shutdown(this.id,e)})}input(e){this._inReplay||this._startBarrier.wait().then(t=>{this._remoteTerminalChannel.input(this.id,e)})}sendSignal(e){this._inReplay||this._startBarrier.wait().then(t=>{this._remoteTerminalChannel.sendSignal(this.id,e)})}processBinary(e){return this._remoteTerminalChannel.processBinary(this.id,e)}resize(e,t,o,n){this._inReplay||this._lastDimensions.cols===e&&this._lastDimensions.rows===t||this._startBarrier.wait().then(r=>{this._lastDimensions.cols=e,this._lastDimensions.rows=t,this._remoteTerminalChannel.resize(this.id,e,t,o,n)})}async clearBuffer(){await this._remoteTerminalChannel.clearBuffer(this.id)}freePortKillProcess(e){if(!this._remoteTerminalChannel.freePortKillProcess)throw new Error("freePortKillProcess does not exist on the local pty service");return this._remoteTerminalChannel.freePortKillProcess(e)}acknowledgeDataEvent(e){this._inReplay||this._startBarrier.wait().then(t=>{this._remoteTerminalChannel.acknowledgeDataEvent(this.id,e)})}async setUnicodeVersion(e){return this._remoteTerminalChannel.setUnicodeVersion(this.id,e)}async refreshProperty(e){return this._remoteTerminalChannel.refreshProperty(this.id,e)}async updateProperty(e,t){return this._remoteTerminalChannel.updateProperty(this.id,e,t)}handleOrphanQuestion(){this._remoteTerminalChannel.orphanQuestionReply(this.id)}};XSe=I([m(3,bo),m(4,wa)],XSe);var $Oo="remoteterminal",s2e=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._remoteAuthority=i;this._channel=e;this._configurationService=t;this._workspaceContextService=o;this._resolverService=n;this._environmentVariableService=r;this._remoteAuthorityResolverService=s;this._logService=l;this._editorService=c;this._labelService=u;this._environmentService=p}get onPtyHostExit(){return this._channel.listen("$onPtyHostExitEvent")}get onPtyHostStart(){return this._channel.listen("$onPtyHostStartEvent")}get onPtyHostUnresponsive(){return this._channel.listen("$onPtyHostUnresponsiveEvent")}get onPtyHostResponsive(){return this._channel.listen("$onPtyHostResponsiveEvent")}get onPtyHostRequestResolveVariables(){return this._channel.listen("$onPtyHostRequestResolveVariablesEvent")}get onProcessData(){return this._channel.listen("$onProcessDataEvent")}get onProcessExit(){return this._channel.listen("$onProcessExitEvent")}get onProcessReady(){return this._channel.listen("$onProcessReadyEvent")}get onProcessReplay(){return this._channel.listen("$onProcessReplayEvent")}get onProcessOrphanQuestion(){return this._channel.listen("$onProcessOrphanQuestion")}get onExecuteCommand(){return this._channel.listen("$onExecuteCommand")}get onDidRequestDetach(){return this._channel.listen("$onDidRequestDetach")}get onDidChangeProperty(){return this._channel.listen("$onDidChangeProperty")}restartPtyHost(){return this._channel.call("$restartPtyHost",[])}async createProcess(i,e,t,o,n,r,s,l){await this._configurationService.whenRemoteConfigurationLoaded();let c=Object.create(null),u=t?this._workspaceContextService.getWorkspaceFolder(t)??void 0:void 0,p=eI.parse({shellLaunchConfig:i,configuration:e});try{await this._resolverService.resolveAsync(u,p)}catch(x){this._logService.error(x)}for(let[{inner:x},E]of p.resolved())(/^config:/.test(x)||x==="selectedText"||x==="lineNumber")&&(c[x]=E.value);let h=[];for(let[x,E]of this._environmentVariableService.collections.entries())h.push([x,Rme(E.map),lZe(E.descriptionMap)]);let g=await this._remoteAuthorityResolverService.resolveAuthority(this._remoteAuthority),f={...this._environmentService.debugExtensionHost.env??{},...g.options?.extensionHostEnv},v=this._workspaceContextService.getWorkspace(),b=v.folders,S=t?this._workspaceContextService.getWorkspaceFolder(t):null,y=po.getOriginalUri(this._editorService.activeEditor,{supportSideBySide:1,filterByScheme:[Q.file,Q.vscodeUserData,Q.vscodeRemote]}),w={configuration:e,resolvedVariables:c,envVariableCollections:h,shellLaunchConfig:i,workspaceId:v.id,workspaceName:this._labelService.getWorkspaceLabel(v),workspaceFolders:b,activeWorkspaceFolder:S,activeFileResource:y,shouldPersistTerminal:n,options:o,cols:r,rows:s,unicodeVersion:l,resolverEnv:f};return await this._channel.call("$createProcess",w)}requestDetachInstance(i,e){return this._channel.call("$requestDetachInstance",[i,e])}acceptDetachInstanceReply(i,e){return this._channel.call("$acceptDetachInstanceReply",[i,e])}attachToProcess(i){return this._channel.call("$attachToProcess",[i])}detachFromProcess(i,e){return this._channel.call("$detachFromProcess",[i,e])}listProcesses(){return this._channel.call("$listProcesses")}getLatency(){return this._channel.call("$getLatency")}getPerformanceMarks(){return this._channel.call("$getPerformanceMarks")}reduceConnectionGraceTime(){return this._channel.call("$reduceConnectionGraceTime")}processBinary(i,e){return this._channel.call("$processBinary",[i,e])}start(i){return this._channel.call("$start",[i])}input(i,e){return this._channel.call("$input",[i,e])}sendSignal(i,e){return this._channel.call("$sendSignal",[i,e])}acknowledgeDataEvent(i,e){return this._channel.call("$acknowledgeDataEvent",[i,e])}setUnicodeVersion(i,e){return this._channel.call("$setUnicodeVersion",[i,e])}setNextCommandId(i,e,t){return this._channel.call("$setNextCommandId",[i,e,t])}shutdown(i,e){return this._channel.call("$shutdown",[i,e])}resize(i,e,t,o,n){return this._channel.call("$resize",[i,e,t,o,n])}clearBuffer(i){return this._channel.call("$clearBuffer",[i])}getInitialCwd(i){return this._channel.call("$getInitialCwd",[i])}getCwd(i){return this._channel.call("$getCwd",[i])}orphanQuestionReply(i){return this._channel.call("$orphanQuestionReply",[i])}sendCommandResult(i,e,t){return this._channel.call("$sendCommandResult",[i,e,t])}freePortKillProcess(i){return this._channel.call("$freePortKillProcess",[i])}getDefaultSystemShell(i){return this._channel.call("$getDefaultSystemShell",[i])}getProfiles(i,e,t){return this._channel.call("$getProfiles",[this._workspaceContextService.getWorkspace().id,i,e,t])}acceptPtyHostResolvedVariables(i,e){return this._channel.call("$acceptPtyHostResolvedVariables",[i,e])}getEnvironment(){return this._channel.call("$getEnvironment")}getWslPath(i,e){return this._channel.call("$getWslPath",[i,e])}setTerminalLayoutInfo(i){let t={workspaceId:this._workspaceContextService.getWorkspace().id,tabs:i?i.tabs:[],background:i?i.background:null};return this._channel.call("$setTerminalLayoutInfo",t)}updateTitle(i,e,t){return this._channel.call("$updateTitle",[i,e,t])}updateIcon(i,e,t,o){return this._channel.call("$updateIcon",[i,e,t,o])}refreshProperty(i,e){return this._channel.call("$refreshProperty",[i,e])}updateProperty(i,e,t){return this._channel.call("$updateProperty",[i,e,t])}getTerminalLayoutInfo(){let e={workspaceId:this._workspaceContextService.getWorkspace().id};return this._channel.call("$getTerminalLayoutInfo",e)}reviveTerminalProcesses(i,e,t){return this._channel.call("$reviveTerminalProcesses",[i,e,t])}getRevivedPtyNewId(i){return this._channel.call("$getRevivedPtyNewId",[i])}serializeTerminalState(i){return this._channel.call("$serializeTerminalState",[i])}installAutoReply(i,e){return this._channel.call("$installAutoReply",[i,e])}uninstallAllAutoReplies(){return this._channel.call("$uninstallAllAutoReplies",[])}};s2e=I([m(2,Yg),m(3,Ae),m(4,Xp),m(5,gG),m(6,dd),m(7,wa),m(8,ie),m(9,nt),m(10,Mt)],s2e);var JSe=class{static{this.ID="remoteTerminalBackend"}constructor(i,e,t){let o=e.getConnection();if(o?.remoteAuthority){let n=i.createInstance(s2e,o.remoteAuthority,o.getChannel($Oo)),r=i.createInstance(upt,o.remoteAuthority,n);oe.as(HH.Backend).registerTerminalBackend(r),t.didRegisterBackend(r)}}};JSe=I([m(0,F),m(1,bo),m(2,uh)],JSe);var upt=class extends r2e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(t,r,h,p,f,u);this.remoteAuthority=e;this._remoteTerminalChannel=t;this._remoteAgentService=o;this._instantiationService=n;this._commandService=s;this._storageService=l;this._remoteAuthorityResolverService=c;this._historyService=h;this._configurationService=g;this._ptys=new Map;this._whenConnected=new Mo;this._onDidRequestDetach=this._register(new T);this.onDidRequestDetach=this._onDidRequestDetach.event;this._onRestoreCommands=this._register(new T);this.onRestoreCommands=this._onRestoreCommands.event;this._register(this._remoteTerminalChannel.onProcessData(b=>this._ptys.get(b.id)?.handleData(b.event))),this._register(this._remoteTerminalChannel.onProcessReplay(b=>{this._ptys.get(b.id)?.handleReplay(b.event),b.event.commands.commands.length>0&&this._onRestoreCommands.fire({id:b.id,commands:b.event.commands.commands})})),this._register(this._remoteTerminalChannel.onProcessOrphanQuestion(b=>this._ptys.get(b.id)?.handleOrphanQuestion())),this._register(this._remoteTerminalChannel.onDidRequestDetach(b=>this._onDidRequestDetach.fire(b))),this._register(this._remoteTerminalChannel.onProcessReady(b=>this._ptys.get(b.id)?.handleReady(b.event))),this._register(this._remoteTerminalChannel.onDidChangeProperty(b=>this._ptys.get(b.id)?.handleDidChangeProperty(b.property))),this._register(this._remoteTerminalChannel.onProcessExit(b=>{let S=this._ptys.get(b.id);S&&(S.handleExit(b.event),S.dispose(),this._ptys.delete(b.id))}));let v=["_remoteCLI.openExternal","_remoteCLI.windowOpen","_remoteCLI.getSystemStatus","_remoteCLI.manageExtensions"];this._register(this._remoteTerminalChannel.onExecuteCommand(async b=>{if(!this._ptys.get(b.persistentProcessId))return;let y=b.reqId,w=b.commandId;if(!v.includes(w)){this._remoteTerminalChannel.sendCommandResult(y,!0,"Invalid remote cli command: "+w);return}let x=b.commandArgs.map(E=>er(E));try{let E=await this._commandService.executeCommand(b.commandId,...x);this._remoteTerminalChannel.sendCommandResult(y,!1,E)}catch(E){this._remoteTerminalChannel.sendCommandResult(y,!0,E)}})),this._onPtyHostConnected.fire()}get whenReady(){return this._whenConnected.p}setReady(){this._whenConnected.complete()}async requestDetachInstance(e,t){if(!this._remoteTerminalChannel)throw new Error("Cannot request detach instance when there is no remote!");return this._remoteTerminalChannel.requestDetachInstance(e,t)}async acceptDetachInstanceReply(e,t){if(this._remoteTerminalChannel){if(!t){this._logService.warn("Cannot attach to feature terminals, custom pty terminals, or those without a persistentProcessId");return}}else throw new Error("Cannot accept detached instance when there is no remote!");return this._remoteTerminalChannel.acceptDetachInstanceReply(e,t)}async persistTerminalState(){if(!this._remoteTerminalChannel)throw new Error("Cannot persist terminal state when there is no remote!");let e=Array.from(this._ptys.keys()),t=await this._remoteTerminalChannel.serializeTerminalState(e);this._storageService.store("terminal.integrated.bufferState",t,1,1)}async createProcess(e,t,o,n,r,s,l,c){if(!this._remoteTerminalChannel)throw new Error("Cannot create remote terminal when there is no remote!");if(!await this._remoteAgentService.getEnvironment())throw new Error("Could not fetch remote environment");let p=this._configurationService.getValue(gb),h={"terminal.integrated.env.windows":this._configurationService.getValue("terminal.integrated.env.windows"),"terminal.integrated.env.osx":this._configurationService.getValue("terminal.integrated.env.osx"),"terminal.integrated.env.linux":this._configurationService.getValue("terminal.integrated.env.linux"),"terminal.integrated.cwd":this._configurationService.getValue("terminal.integrated.cwd"),"terminal.integrated.detectLocale":p.detectLocale},g={name:e.name,executable:e.executable,args:e.args,cwd:e.cwd,env:e.env,useShellEnvironment:e.useShellEnvironment,reconnectionProperties:e.reconnectionProperties,type:e.type,isFeatureTerminal:e.isFeatureTerminal,forceShellIntegration:e.forceShellIntegration,tabActions:e.tabActions,shellIntegrationEnvironmentReporting:e.shellIntegrationEnvironmentReporting},f=g6(e.cwd,this._workspaceContextService,this._historyService)?.uri,v=await this._remoteTerminalChannel.createProcess(g,h,f,l,c,o,n,r),b=this._instantiationService.createInstance(XSe,v.persistentTerminalId,c,this._remoteTerminalChannel);return this._ptys.set(v.persistentTerminalId,b),b}async attachToProcess(e){if(!this._remoteTerminalChannel)throw new Error("Cannot create remote terminal when there is no remote!");try{await this._remoteTerminalChannel.attachToProcess(e);let t=this._instantiationService.createInstance(XSe,e,!0,this._remoteTerminalChannel);return this._ptys.set(e,t),t}catch(t){this._logService.trace(`Couldn't attach to process ${t.message}`)}}async attachToRevivedProcess(e){if(!this._remoteTerminalChannel)throw new Error("Cannot create remote terminal when there is no remote!");try{let t=await this._remoteTerminalChannel.getRevivedPtyNewId(e)??e;return await this.attachToProcess(t)}catch(t){this._logService.trace(`Couldn't attach to process ${t.message}`)}}async listProcesses(){return this._remoteTerminalChannel.listProcesses()}async getLatency(){let e=new On,t=await this._remoteTerminalChannel.getLatency();return e.stop(),[{label:"window<->ptyhostservice<->ptyhost",latency:e.elapsed()},...t]}async updateProperty(e,t,o){await this._remoteTerminalChannel.updateProperty(e,t,o)}async updateTitle(e,t,o){await this._remoteTerminalChannel.updateTitle(e,t,o)}async updateIcon(e,t,o,n){await this._remoteTerminalChannel.updateIcon(e,t,o,n)}async setNextCommandId(e,t,o){await this._remoteTerminalChannel.setNextCommandId(e,t,o)}async getDefaultSystemShell(e){return this._remoteTerminalChannel.getDefaultSystemShell(e)||""}async getProfiles(e,t,o){return this._remoteTerminalChannel.getProfiles(e,t,o)||[]}async getEnvironment(){return this._remoteTerminalChannel.getEnvironment()||{}}async getShellEnvironment(){let e=this._remoteAgentService.getConnection();if(!e)return;let t=await this._remoteAuthorityResolverService.resolveAuthority(e.remoteAuthority),o={};if(t.options?.extensionHostEnv)for(let[n,r]of Object.entries(t.options.extensionHostEnv))r!==null&&(o[n]=r);return o}async getWslPath(e,t){return(await this._remoteAgentService.getEnvironment())?.os!==1?e:this._remoteTerminalChannel.getWslPath(e,t)||e}async setTerminalLayoutInfo(e){if(!this._remoteTerminalChannel)throw new Error("Cannot call setActiveInstanceId when there is no remote");return this._remoteTerminalChannel.setTerminalLayoutInfo(e)}async reduceConnectionGraceTime(){if(!this._remoteTerminalChannel)throw new Error("Cannot reduce grace time when there is no remote");return this._remoteTerminalChannel.reduceConnectionGraceTime()}async getTerminalLayoutInfo(){if(!this._remoteTerminalChannel)throw new Error("Cannot call getActiveInstanceId when there is no remote");let e=this._getWorkspaceId(),t=this._storageService.get("terminal.integrated.bufferState",1),o=this._deserializeTerminalState(t);if(o&&o.length>0)try{Wo("code/terminal/willReviveTerminalProcessesRemote"),await this._remoteTerminalChannel.reviveTerminalProcesses(e,o,Intl.DateTimeFormat().resolvedOptions().locale),Wo("code/terminal/didReviveTerminalProcessesRemote"),this._storageService.remove("terminal.integrated.bufferState",1);let n=this._storageService.get("terminal.integrated.layoutInfo",1);n&&(Wo("code/terminal/willSetTerminalLayoutInfoRemote"),await this._remoteTerminalChannel.setTerminalLayoutInfo(JSON.parse(n)),Wo("code/terminal/didSetTerminalLayoutInfoRemote"),this._storageService.remove("terminal.integrated.layoutInfo",1))}catch(n){this._logService.warn("RemoteTerminalBackend#getTerminalLayoutInfo Error",n.message??n)}return this._remoteTerminalChannel.getTerminalLayoutInfo()}async getPerformanceMarks(){return this._remoteTerminalChannel.getPerformanceMarks()}installAutoReply(e,t){return this._remoteTerminalChannel.installAutoReply(e,t)}uninstallAllAutoReplies(){return this._remoteTerminalChannel.uninstallAllAutoReplies()}};upt=I([m(2,bo),m(3,F),m(4,wa),m(5,fe),m(6,de),m(7,dd),m(8,Ae),m(9,Xp),m(10,fa),m(11,B),m(12,Fr)],upt);var c7=class{constructor(i){this.instanceId=i.instanceId}toJSON(){return{$mid:15,instanceId:this.instanceId}}},eIe=class extends cs{async runAction(i,e){if(Array.isArray(e)&&e.every(t=>t instanceof c7)){await i.run(e?.[0],e);return}return super.runAction(i,e)}};function d7(a,i,e,t,o,n){let r=new Ln(a,i),s=Lu(t.getActions({shouldForwardArgs:!0}));n&&s.push(...n);let l=e?Ec(e).map(u=>new c7(u)):[],c=new eIe;o.showContextMenu({actionRunner:c,getAnchor:()=>r,getActions:()=>s,getActionsContext:()=>l,onHide:()=>c.dispose()})}function tIe(a,i){let e=parseInt(i.get("terminal.integrated.tabs.showDetailed",-1)??"0"),t="",o=a.statusList.statuses,n=[];for(let l of o)e?(l.detailedTooltip??l.tooltip)&&(t+=`

---

${l.icon?`$(${l.icon?.id}) `:""}`+(l.detailedTooltip??l.tooltip??"")):l.tooltip&&(t+=`

---

${l.icon?`$(${l.icon?.id}) `:""}`+(l.tooltip??"")),l.hoverActions&&n.push(...l.hoverActions);n.push({commandId:"toggleDetailedInfo",label:e?d(16097,null):d(16100,null),run(){i.store("terminal.integrated.tabs.showDetailed",(e+1)%2,-1,0)}});let r=Xkn(a,!!e);return{content:new he(a.title+r+t,{supportThemeIcons:!0}),actions:n}}function Xkn(a,i){let e=[];if(a.processId&&a.processId>0&&e.push(d(16099,null,"PID",a.processId)+`
`),a.shellLaunchConfig.executable){let t="";if(!i&&a.shellLaunchConfig.executable.length>32){let n=Jo(a.shellLaunchConfig.executable),r=a.shellLaunchConfig.executable.length-n.length-1,s=a.shellLaunchConfig.executable.substring(r,r+1);t+=`\u2026${s}${n}`}else t+=a.shellLaunchConfig.executable;let o=Ec(a.injectedArgs||a.shellLaunchConfig.args||[]).map(n=>n.match(/\s/)?`'${n}'`:n).join(" ");o&&(t+=` ${o}`),e.push(d(16098,null,t))}return e.length?`

---

${e.join(`
`)}`:""}var a2e=class extends k{constructor(e){super();this._configurationService=e;this._statuses=new Map;this._statusTimeouts=new Map;this._onDidAddStatus=this._register(new T);this._onDidRemoveStatus=this._register(new T);this._onDidChangePrimaryStatus=this._register(new T)}get onDidAddStatus(){return this._onDidAddStatus.event}get onDidRemoveStatus(){return this._onDidRemoveStatus.event}get onDidChangePrimaryStatus(){return this._onDidChangePrimaryStatus.event}get primary(){let e;for(let t of this._statuses.values())(!e||t.severity>=e.severity)&&(t.icon||!e?.icon)&&(e=t);return e}get statuses(){return Array.from(this._statuses.values())}add(e,t){e=this._applyAnimationSetting(e);let o=this._statusTimeouts.get(e.id);if(o&&(ut.clearTimeout(o),this._statusTimeouts.delete(e.id)),t&&t>0){let r=ut.setTimeout(()=>this.remove(e),t);this._statusTimeouts.set(e.id,r)}let n=this._statuses.get(e.id);if(n&&n!==e&&(this._onDidRemoveStatus.fire(n),this._statuses.delete(n.id)),!this._statuses.has(e.id)){let r=this.primary;this._statuses.set(e.id,e),this._onDidAddStatus.fire(e);let s=this.primary;r!==s&&this._onDidChangePrimaryStatus.fire(s)}}remove(e){let t=We(e)?this._statuses.get(e):e;if(t&&this._statuses.get(t.id)){let o=this.primary?.id===t.id;this._statuses.delete(t.id),this._onDidRemoveStatus.fire(t),o&&this._onDidChangePrimaryStatus.fire(this.primary)}}toggle(e,t){t?this.add(e):this.remove(e)}_applyAnimationSetting(e){if(!e.icon||q.getModifier(e.icon)!=="spin"||this._configurationService.getValue("terminal.integrated.tabs.enableAnimation"))return e;let t;return e.icon.id===PT.id?t=L.play:t=q.modify(e.icon,void 0),{...e,icon:t}}};a2e=I([m(0,B)],a2e);function v7t(a){switch(a){case wt.Error:return Ok;case wt.Warning:return tK;default:return""}}var jOo=_;var Kse=class extends bc{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super("TerminalTabsList",e,{getHeight:()=>22,getTemplateId:()=>"terminal.tabs"},[c.createInstance(ppt,e,c.createInstance(jl,JH),()=>this.getSelectedElements(),{getHasText:()=>this.hasText,getHasActionBar:()=>this.hasActionBar})],{horizontalScrolling:!1,supportDynamicHeights:!1,selectionNavigation:!0,identityProvider:{getId:b=>b?.instanceId},accessibilityProvider:c.createInstance(mpt),smoothScrolling:n.getValue("workbench.list.smoothScrolling"),multipleSelectionSupport:!0,paddingBottom:22,dnd:c.createInstance(hpt),openOnSingleClick:!0},t,o,n,c);this._configurationService=n;this._terminalService=r;this._terminalGroupService=s;this._terminalEditingService=l;this._themeService=p;this._storageService=h;this._hoverService=f;this._hasText=!0;this._hasActionBar=!0;let v=[this._terminalGroupService.onDidChangeInstances(()=>this.refresh()),this._terminalGroupService.onDidChangeGroups(()=>this.refresh()),this._terminalGroupService.onDidShow(()=>this.refresh()),this._terminalGroupService.onDidChangeInstanceCapability(()=>this.refresh()),this._terminalService.onAnyInstanceTitleChange(()=>this.refresh()),this._terminalService.onAnyInstanceIconChange(()=>this.refresh()),this._terminalService.onAnyInstancePrimaryStatusChange(()=>this.refresh()),this._terminalService.onDidChangeConnectionState(()=>this.refresh()),this._themeService.onDidColorThemeChange(()=>this.refresh()),this._terminalGroupService.onDidChangeActiveInstance(b=>{if(b){let S=this._terminalGroupService.instances.indexOf(b);this.setSelection([S]),this.reveal(S)}this.refresh()}),this._storageService.onDidChangeValue(-1,"terminal.integrated.tabs.showDetailed",this.disposables)(()=>this.refresh())];this.disposables.add(g.onWillShutdown(b=>{je(v),v.length=0})),this.disposables.add(ee(()=>{je(v),v.length=0})),this.disposables.add(this.onMouseDblClick(async b=>{if(!b.element){b.browserEvent.preventDefault(),b.browserEvent.stopPropagation();let S=await this._terminalService.createTerminal({location:1});this._terminalGroupService.setActiveInstance(S),await S.focusWhenReady();return}this._terminalEditingService.getEditingTerminal()?.instanceId!==b.element.instanceId&&this._getFocusMode()==="doubleClick"&&this.getFocus().length===1&&b.element.focus(!0)})),this.disposables.add(this.onMouseClick(async b=>{this._terminalEditingService.getEditingTerminal()?.instanceId!==b.element?.instanceId&&(b.browserEvent.altKey&&b.element?await this._terminalService.createTerminal({location:{parentTerminal:b.element}}):this._getFocusMode()==="singleClick"&&this.getSelection().length<=1&&b.element?.focus(!0))})),this.disposables.add(this.onContextMenu(b=>{if(!b.element){this.setSelection([]);return}let S=this.getSelectedElements();(!S||!S.find(y=>b.element===y))&&this.setFocus(b.index!==void 0?[b.index]:[])})),this._terminalTabsSingleSelectedContextKey=pt.tabsSingularSelection.bindTo(t),this._isSplitContextKey=pt.splitTerminalTabFocused.bindTo(t),this.disposables.add(this.onDidChangeSelection(b=>this._updateContextKey())),this.disposables.add(this.onDidChangeFocus(()=>this._updateContextKey())),this.disposables.add(this.onDidOpen(async b=>{let S=b.element;S&&(this._terminalGroupService.setActiveInstance(S),b.editorOptions.preserveFocus||await S.focusWhenReady())})),this._decorationsProvider||(this._decorationsProvider=this.disposables.add(c.createInstance(gpt)),this.disposables.add(u.registerDecorationsProvider(this._decorationsProvider))),this.refresh()}get hasText(){return this._hasText}get hasActionBar(){return this._hasActionBar}_getFocusMode(){return this._configurationService.getValue("terminal.integrated.tabs.focusMode")}refresh(e=!0){e&&this._terminalEditingService.isEditable(void 0)&&this.domFocus(),this.splice(0,this.length,this._terminalGroupService.instances.slice())}focusHover(){let e=this.getSelectedElements()[0];e&&this._hoverService.showInstantHover({...tIe(e,this._storageService),target:this.getHTMLElement(),trapFocus:!0},!0)}_updateContextKey(){this._terminalTabsSingleSelectedContextKey.set(this.getSelectedElements().length===1);let e=this.getFocusedElements();this._isSplitContextKey.set(e.length>0&&this._terminalGroupService.instanceIsSplit(e[0]))}layout(e,t){super.layout(e,t);let o=t??this.getHTMLElement().clientWidth,n=o>=63,r=o>105;(this._hasText!==n||this._hasActionBar!==r)&&(this._hasText=n,this._hasActionBar=r,this.refresh())}};Kse=I([m(1,X),m(2,Co),m(3,B),m(4,an),m(5,Cc),m(6,hee),m(7,F),m(8,mb),m(9,Pe),m(10,de),m(11,to),m(12,ot)],Kse);var ppt=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){this._labels=e;this._getSelection=t;this._getVisibilityState=o;this._instantiationService=n;this._terminalConfigurationService=r;this._terminalService=s;this._terminalGroupService=l;this._terminalEditingService=c;this._hoverService=u;this._keybindingService=p;this._listService=h;this._storageService=g;this._themeService=f;this._contextViewService=v;this._commandService=b;this.templateId="terminal.tabs"}renderTemplate(i){let e=D(i,jOo(".terminal-tabs-entry")),t={},o=new O,n=o.add(this._labels.create(e,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:{delay:0,showHover:l=>this._hoverService.showDelayedHover({...l,actions:t.hoverActions,target:e,appearance:{showPointer:!0},position:{hoverPosition:this._terminalConfigurationService.config.tabs.location==="left"?1:0}},{groupId:"terminal-tabs-list"})}})),r=D(n.element,jOo(".actions")),s=o.add(new oo(r,{actionRunner:o.add(new eIe),actionViewItemProvider:(l,c)=>l instanceof Do?o.add(this._instantiationService.createInstance(Cl,l,{hoverDelegate:c.hoverDelegate})):void 0}));return{element:e,label:n,actionBar:s,context:t,elementDisposables:new O,templateDisposables:o}}renderElement(i,e,t){let o=this._getVisibilityState.getHasText(),n=this._getVisibilityState.getHasActionBar(),r=this._terminalGroupService.getGroupForInstance(i);if(!r)throw new Error(`Could not find group for instance "${i.instanceId}"`);t.element.classList.toggle("has-text",o),t.element.classList.toggle("is-active",this._terminalGroupService.activeInstance===i);let s="";if(r.terminalInstances.length>1){let v=r.terminalInstances.indexOf(i);v===0?s="\u250C ":v===r.terminalInstances.length-1?s="\u2514 ":s="\u251C "}let l=tIe(i,this._storageService);t.context.hoverActions=l.actions;let c=this._instantiationService.invokeFunction(vee,i),u="";if(o)this.fillActionBar(i,t),u=s,i.icon&&(u+=`$(${c}) ${i.title}`);else{let v=i.statusList.primary;v&&v.severity>wt.Ignore?u=`${s}$(${v.icon?.id||c})`:u=`${s}$(${c})`}n||t.actionBar.clear(),t.elementDisposables.add($(t.element,ne.AUXCLICK,v=>{v.stopImmediatePropagation(),v.button===1&&this._terminalService.safeDisposeTerminal(i)}));let p=[],h=lw(i);h&&p.push(h);let g=mR(i,this._themeService.getColorTheme().type);g&&p.push(...g),t.label.setResource({resource:i.resource,name:u,description:o?i.description:void 0},{fileDecorations:{colors:!0,badges:o},title:{markdown:l.content,markdownNotSupportedFallback:void 0},extraClasses:p});let f=this._terminalEditingService.getEditableData(i);t.label.element.classList.toggle("editable-tab",!!f),f&&(t.elementDisposables.add(this._renderInputBox(t.label.element.querySelector(".monaco-icon-label-container"),i,f)),t.actionBar.clear())}_renderInputBox(i,e,t){let o=e.title||"",n=new ad(i,this._contextViewService,{validationOptions:{validation:c=>{let u=t.validationMessage(c);return!u||u.severity!==wt.Error?null:{content:u.content,formatContent:!0,type:3}}},ariaLabel:d(16096,null),inputBoxStyles:Wl});n.element.style.height="22px",n.value=o,n.focus(),n.select({start:0,end:o.length});let r=bd((c,u)=>{n.element.style.display="none";let p=n.value;je(l),n.element.remove(),u&&t.onFinish(p,c)}),s=()=>{if(n.isInputValid()){let c=t.validationMessage(n.value);c?n.showMessage({content:c.content,formatContent:!0,type:c.severity===wt.Info?1:c.severity===wt.Warning?2:3}):n.hideMessage()}};s();let l=[n,Yo(n.inputElement,ne.KEY_DOWN,c=>{c.stopPropagation(),c.equals(3)?r(n.isInputValid(),!0):c.equals(9)&&r(!1,!0)}),Yo(n.inputElement,ne.KEY_UP,c=>{s()}),$(n.inputElement,ne.BLUR,()=>{r(n.isInputValid(),!0)})];return ee(()=>{r(!1,!1)})}disposeElement(i,e,t){t.elementDisposables.clear(),t.actionBar.clear()}disposeTemplate(i){i.elementDisposables.dispose(),i.templateDisposables.dispose()}fillActionBar(i,e){let t=[e.elementDisposables.add(new it("workbench.action.terminal.splitActiveTab",vr.split.short,q.asClassName(L.splitHorizontal),!0,async()=>{this._runForSelectionOrInstance(i,async o=>{this._terminalService.createTerminal({location:{parentTerminal:o}})})}))];if(i.shellLaunchConfig.tabActions)for(let o of i.shellLaunchConfig.tabActions)t.push(e.elementDisposables.add(new it(o.id,o.label,o.icon?q.asClassName(o.icon):void 0,!0,async()=>{this._runForSelectionOrInstance(i,n=>this._commandService.executeCommand(o.id,i))})));t.push(e.elementDisposables.add(new it("workbench.action.terminal.killActiveTab",vr.kill.short,q.asClassName(L.trashcan),!0,async()=>{this._runForSelectionOrInstance(i,o=>this._terminalService.safeDisposeTerminal(o))}))),e.actionBar.clear();for(let o of t)e.actionBar.push(o,{icon:!0,label:!1,keybinding:this._keybindingService.lookupKeybinding(o.id)?.getLabel()})}_runForSelectionOrInstance(i,e){let t=this._getSelection();if(t.includes(i))for(let o of t)o&&e(o);else e(i);this._terminalGroupService.focusTabs(),this._listService.lastFocusedList?.focusNext()}};ppt=I([m(4,F),m(5,mp),m(6,an),m(7,Cc),m(8,hee),m(9,ot),m(10,Le),m(11,Co),m(12,de),m(13,Pe),m(14,qn),m(15,fe)],ppt);var mpt=class{constructor(i){this._terminalGroupService=i}getWidgetAriaLabel(){return d(16094,null)}getAriaLabel(i){let e="",t=this._terminalGroupService.getGroupForInstance(i);if(t&&t.terminalInstances?.length>1){let o=t.terminalInstances.indexOf(i);e=d(16093,null,i.instanceId,i.title,o+1,t.terminalInstances.length)}else e=d(16095,null,i.instanceId,i.title);return e}};mpt=I([m(0,Cc)],mpt);var hpt=class extends k{constructor(e,t,o,n){super();this._terminalService=e;this._terminalGroupService=t;this._terminalEditingService=o;this._listService=n;this._autoFocusDisposable=k.None;this._primaryBackend=this._terminalService.getPrimaryBackend()}getDragURI(e){return this._terminalEditingService.getEditingTerminal()?.instanceId===e.instanceId?null:e.resource.toString()}getDragLabel(e,t){return e.length===1?e[0].title:void 0}onDragLeave(){this._autoFocusInstance=void 0,this._autoFocusDisposable.dispose(),this._autoFocusDisposable=k.None}onDragStart(e,t){if(!t.dataTransfer)return;let o=e.getData();if(!Array.isArray(o))return;let n=o.filter(QOo);n.length>0&&t.dataTransfer.setData("Terminals",JSON.stringify(n.map(r=>r.resource.toString())))}onDragOver(e,t,o,n,r){if(e instanceof PK&&!Up(r,Fl.FILES,Fl.RESOURCES,"Terminals",Mc.FILES))return!1;let s=this._autoFocusInstance!==t;return s&&(this._autoFocusDisposable.dispose(),this._autoFocusInstance=t),!t&&!Up(r,"Terminals")?e instanceof Yw:(s&&t&&(this._autoFocusDisposable=Zo(()=>{this._terminalService.setActiveInstance(t),this._autoFocusInstance=void 0},500,this._store)),{feedback:o?[o]:void 0,accept:!0,effect:{type:1,position:"drop-target"}})}async drop(e,t,o,n,r){this._autoFocusDisposable.dispose(),this._autoFocusInstance=void 0;let s,l=[],c=lze(r);if(c)for(let p of c){let h=this._terminalService.getInstanceFromResource(p);if(h)Array.isArray(s)?s.push(h):s=[h],this._terminalService.moveToTerminalView(h);else if(this._primaryBackend){let g=G$(p);g.instanceId&&l.push(this._primaryBackend.requestDetachInstance(g.workspaceId,g.instanceId))}}if(l.length){let p=await Promise.all(l);p=p.filter(g=>g!==void 0);let h;for(let g of p)h=await this._terminalService.createTerminal({config:{attachPersistentProcess:g}});h&&this._terminalService.setActiveInstance(h);return}if(s===void 0){if(!(e instanceof Yw)){this._handleExternalDrop(t,r);return}let p=e.getData();if(!p||!Array.isArray(p))return;s=[];for(let h of p)QOo(h)&&s.push(h)}if(!t){this._terminalGroupService.moveGroupToEnd(s),this._terminalService.setActiveInstance(s[0]);let p=this._terminalGroupService.getGroupForInstance(s[0]);if(p){let h=this._terminalGroupService.groups.indexOf(p);this._listService.lastFocusedList?.setSelection([h])}return}this._terminalGroupService.moveGroup(s,t),this._terminalService.setActiveInstance(s[0]);let u=this._terminalGroupService.getGroupForInstance(s[0]);if(u){let p=this._terminalGroupService.groups.indexOf(u);this._listService.lastFocusedList?.setSelection([p])}}async _handleExternalDrop(e,t){if(!e||!t.dataTransfer)return;let o,n=t.dataTransfer.getData(Fl.RESOURCES);n&&(o=A.parse(JSON.parse(n)[0]));let r=t.dataTransfer.getData(Mc.FILES);!o&&r&&(o=A.file(JSON.parse(r)[0])),!o&&t.dataTransfer.files.length>0&&wD(t.dataTransfer.files[0])&&(o=A.file(wD(t.dataTransfer.files[0]))),o&&(this._terminalService.setActiveInstance(e),e.focus(),await e.sendPath(o,!1))}};hpt=I([m(0,an),m(1,Cc),m(2,hee),m(3,Co)],hpt);var gpt=class extends k{constructor(e){super();this._terminalService=e;this.label=d(16092,null);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._register(this._terminalService.onAnyInstancePrimaryStatusChange(t=>this._onDidChange.fire([t.resource])))}provideDecorations(e){if(e.scheme!==Q.vscodeTerminal)return;let t=this._terminalService.getInstanceFromResource(e);if(!t)return;let o=t?.statusList?.primary;if(o?.icon)return{color:v7t(o.severity),letter:o.icon,tooltip:o.tooltip}}};gpt=I([m(0,an)],gpt);function QOo(a){return Di(a)&&"instanceId"in a}var AKi=d(15934,null),Zkn=vr.actionCategory,Ca=(()=>{let a=C.or(pt.processSupported,pt.terminalHasBeenCreated);return{terminalAvailable:a,terminalAvailable_and_opened:C.and(a,pt.isOpen),terminalAvailable_and_editorActive:C.and(a,pt.terminalEditorActive),terminalAvailable_and_singularSelection:C.and(a,pt.tabsSingularSelection),focusInAny_and_normalBuffer:C.and(pt.focusInAny,pt.altBufferActive.negate())}})();async function NKi(a,i,e,t){switch(t.config.splitCwd){case"workspaceRoot":if(i!==void 0&&e!==void 0){if(i.length===1)return i[0].uri;if(i.length>1){let o={placeHolder:d(15959,null)},n=await e.executeCommand(iP,[o]);return n?Promise.resolve(n.uri):void 0}}return"";case"initial":return a.getInitialCwd();case"inherited":return a.getSpeculativeCwd()}}var c2e=class extends it{constructor(e){super("workbench.action.terminal.launchHelp",d(15935,null));this._openerService=e}async run(){this._openerService.open("https://aka.ms/vscode-troubleshoot-terminal-launch")}};c2e=I([m(0,Je)],c2e);function Wr(a){a.f1=a.f1??!0,a.category=a.category??Zkn,a.precondition=a.precondition??pt.processSupported;let i=a.run,e=a;return delete e.run,W(class extends z{constructor(){super(e)}run(t,o,n){return i(XOo(t),t,o,n)}})}function eEn(a){if(Array.isArray(a)){if(a.every(i=>i instanceof c7))return a}else if(a instanceof c7)return[a]}function b7t(a){let i=a.run;return Wr({...a,run:async(e,t,o,n)=>{let r=tEn(t,n);if(!r){let l=(a.activeInstanceType==="view"?e.groupService:a.activeInstanceType==="editor"?e.editorService:e.service).activeInstance;if(!l)return;r=[l]}let s=[];for(let l of r)s.push(i(l,e,t,o));await Promise.all(s),a.runAfter&&a.runAfter(r,e,t,o)}})}function pc(a){let i=a.run;return Wr({...a,run:(e,t,o)=>{let n=e.service.activeInstance;if(n)return i(n,e,t,o)}})}function bh(a){let i=a.run;return Wr({...a,run:(e,t,o)=>{let n=yt.find(e.service.detachedInstances,s=>s.xterm.isFocused);if(n)return i(n.xterm,t,n,o);let r=e.service.activeInstance;if(r?.xterm)return i(r.xterm,t,r,o)}})}function XOo(a){return{service:a.get(an),configService:a.get(mp),groupService:a.get(Cc),instanceService:a.get(uh),editorService:a.get(hb),editingService:a.get(hee),profileService:a.get(fb),profileResolverService:a.get(ig)}}function JOo(){Wr({id:"workbench.action.terminal.newInActiveWorkspace",title:P(15955,"Create New Terminal (In Active Workspace)"),run:async i=>{if(i.service.isProcessSupportRegistered){let e=await i.service.createTerminal({location:i.configService.defaultLocation});if(!e)return;i.service.setActiveInstance(e),await iIe(e,i)}}}),OKi([]),Wr({id:"workbench.action.createTerminalEditor",title:P(15939,"Create New Terminal in Editor Area"),run:async(i,e,t)=>{function o(s){return Di(s)&&"location"in s}let n=o(t)?t:{location:{viewColumn:tr}};await(await i.service.createTerminal(n)).focusWhenReady()}}),Wr({id:"workbench.action.createTerminalEditorSameGroup",title:P(15939,"Create New Terminal in Editor Area"),f1:!1,run:async(i,e,t)=>{let o=e.get(kt);await(await i.service.createTerminal({location:{viewColumn:Fx(o,o.activeGroup)}})).focusWhenReady()}}),Wr({id:"workbench.action.createTerminalEditorSide",title:P(15940,"Create New Terminal in Editor Area to the Side"),run:async i=>{await(await i.service.createTerminal({location:{viewColumn:En}})).focusWhenReady()}}),Wr({id:"workbench.action.terminal.newInNewWindow",title:vr.newInNewWindow,precondition:Ca.terminalAvailable,keybinding:{primary:3675,mac:{primary:1883},weight:200},run:async i=>{await(await i.service.createTerminal({location:{viewColumn:ff,auxiliary:{compact:!0}}})).focusWhenReady()}}),b7t({id:"workbench.action.terminal.moveToEditor",title:vr.moveToEditor,precondition:Ca.terminalAvailable_and_opened,activeInstanceType:"view",run:(i,e)=>e.service.moveToEditor(i),runAfter:i=>i.at(-1)?.focus()}),b7t({id:"workbench.action.terminal.moveIntoNewWindow",title:vr.moveIntoNewWindow,precondition:Ca.terminalAvailable_and_opened,run:(i,e)=>e.service.moveIntoNewEditor(i),runAfter:i=>i.at(-1)?.focus()}),Wr({id:"workbench.action.terminal.moveToTerminalPanel",title:vr.moveToTerminalPanel,precondition:Ca.terminalAvailable_and_editorActive,run:(i,e,t)=>{let o=eFo(t)??i.editorService.activeInstance;o&&i.service.moveToTerminalView(o)}}),Wr({id:"workbench.action.terminal.focusPreviousPane",title:P(15946,"Focus Previous Terminal in Terminal Group"),keybinding:{primary:527,secondary:[528],mac:{primary:2575,secondary:[2576]},when:C.and(pt.focus,pt.splitTerminalActive),weight:201},precondition:Ca.terminalAvailable,run:async i=>{i.groupService.activeGroup?.focusPreviousPane(),await i.groupService.showPanel(!0)}}),Wr({id:"workbench.action.terminal.focusNextPane",title:P(15944,"Focus Next Terminal in Terminal Group"),keybinding:{primary:529,secondary:[530],mac:{primary:2577,secondary:[2578]},when:C.and(pt.focus,pt.splitTerminalActive),weight:201},precondition:Ca.terminalAvailable,run:async i=>{i.groupService.activeGroup?.focusNextPane(),await i.groupService.showPanel(!0)}}),Wr({id:"workbench.action.terminal.resizePaneLeft",title:P(15967,"Resize Terminal Left"),keybinding:{linux:{primary:3087},mac:{primary:2319},when:pt.focus,weight:200},precondition:Ca.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(0)}),Wr({id:"workbench.action.terminal.resizePaneRight",title:P(15968,"Resize Terminal Right"),keybinding:{linux:{primary:3089},mac:{primary:2321},when:pt.focus,weight:200},precondition:Ca.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(1)}),Wr({id:"workbench.action.terminal.resizePaneUp",title:P(15969,"Resize Terminal Up"),keybinding:{mac:{primary:2320},when:pt.focus,weight:200},precondition:Ca.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(2)}),Wr({id:"workbench.action.terminal.resizePaneDown",title:P(15966,"Resize Terminal Down"),keybinding:{mac:{primary:2322},when:pt.focus,weight:200},precondition:Ca.terminalAvailable,run:i=>i.groupService.activeGroup?.resizePane(3)}),Wr({id:"workbench.action.terminal.focus",title:vr.focus,keybinding:{when:C.and(Oa,GFt,Fu.isEqualTo("terminal")),primary:2066,weight:200},precondition:Ca.terminalAvailable,run:async i=>{let e=i.service.activeInstance||await i.service.createTerminal({location:1});e&&(i.service.setActiveInstance(e),await iIe(e,i))}}),Wr({id:"workbench.action.terminal.focusTabs",title:P(15942,"Focus Terminal Tabs View"),keybinding:{primary:3165,weight:200,when:C.or(pt.tabsFocus,pt.focus)},precondition:Ca.terminalAvailable,run:i=>i.groupService.focusTabs()}),Wr({id:"workbench.action.terminal.focusNext",title:P(15943,"Focus Next Terminal Group"),precondition:Ca.terminalAvailable,keybinding:{primary:2060,mac:{primary:3166},when:C.and(pt.focus,pt.editorFocus.negate()),weight:200},run:async i=>{i.groupService.setActiveGroupToNext(),await i.groupService.showPanel(!0)}}),Wr({id:"workbench.action.terminal.focusPrevious",title:P(15945,"Focus Previous Terminal Group"),precondition:Ca.terminalAvailable,keybinding:{primary:2059,mac:{primary:3164},when:C.and(pt.focus,pt.editorFocus.negate()),weight:200},run:async i=>{i.groupService.setActiveGroupToPrevious(),await i.groupService.showPanel(!0)}}),Wr({id:"workbench.action.terminal.runSelectedText",title:P(15972,"Run Selected Text In Active Terminal"),run:async(i,e)=>{let o=e.get(Qt).getActiveCodeEditor();if(!o||!o.hasModel())return;let n=await i.service.getActiveOrCreateInstance({acceptsInput:!0}),r=o.getSelection(),s;if(r.isEmpty())s=o.getModel().getLineContent(r.selectionStartLineNumber).trim();else{let l=ii?1:2;s=o.getModel().getValueInRange(r,l)}n.sendText(s,!0,!0),await i.service.revealActiveTerminal(!0)}}),Wr({id:"workbench.action.terminal.runActiveFile",title:P(15970,"Run Active File In Active Terminal"),precondition:Ca.terminalAvailable,run:async(i,e)=>{let t=e.get(Qt),o=e.get(Ne),n=e.get(Mt),r=t.getActiveCodeEditor();if(!r||!r.hasModel())return;let s=await i.service.getActiveOrCreateInstance({acceptsInput:!0}),l=s?s.hasRemoteAuthority:!!n.remoteAuthority,c=r.getModel().uri;if(!l&&c.scheme!==Q.file&&c.scheme!==Q.vscodeUserData||l&&c.scheme!==Q.vscodeRemote){o.warn(d(15971,null));return}return await s.sendPath(c,!0),i.groupService.showPanel()}}),bh({id:"workbench.action.terminal.scrollDown",title:P(15973,"Scroll Down (Line)"),keybinding:{primary:2572,linux:{primary:3090},when:Ca.focusInAny_and_normalBuffer,weight:200},precondition:Ca.terminalAvailable,run:i=>i.scrollDownLine()}),bh({id:"workbench.action.terminal.scrollDownPage",title:P(15974,"Scroll Down (Page)"),keybinding:{primary:1036,mac:{primary:12},when:Ca.focusInAny_and_normalBuffer,weight:200},precondition:Ca.terminalAvailable,run:i=>i.scrollDownPage()}),bh({id:"workbench.action.terminal.scrollToBottom",title:P(15975,"Scroll to Bottom"),keybinding:{primary:2061,linux:{primary:1037},when:Ca.focusInAny_and_normalBuffer,weight:200},precondition:Ca.terminalAvailable,run:i=>i.scrollToBottom()}),bh({id:"workbench.action.terminal.scrollUp",title:P(15977,"Scroll Up (Line)"),keybinding:{primary:2571,linux:{primary:3088},when:Ca.focusInAny_and_normalBuffer,weight:200},precondition:Ca.terminalAvailable,run:i=>i.scrollUpLine()}),bh({id:"workbench.action.terminal.scrollUpPage",title:P(15978,"Scroll Up (Page)"),f1:!0,keybinding:{primary:1035,mac:{primary:11},when:Ca.focusInAny_and_normalBuffer,weight:200},precondition:Ca.terminalAvailable,run:i=>i.scrollUpPage()}),bh({id:"workbench.action.terminal.scrollToTop",title:P(15976,"Scroll to Top"),keybinding:{primary:2062,linux:{primary:1038},when:Ca.focusInAny_and_normalBuffer,weight:200},precondition:Ca.terminalAvailable,run:i=>i.scrollToTop()}),bh({id:"workbench.action.terminal.clearSelection",title:P(15938,"Clear Selection"),keybinding:{primary:9,when:C.and(pt.focusInAny,pt.textSelected,pt.notFindVisible),weight:200},precondition:Ca.terminalAvailable,run:i=>{i.hasSelection()&&i.clearSelection()}}),Wr({id:"workbench.action.terminal.changeIcon",title:vr.changeIcon,precondition:Ca.terminalAvailable,run:(i,e,t)=>fpt(i,t)?.changeIcon()}),Wr({id:"workbench.action.terminal.changeIconActiveTab",title:vr.changeIcon,f1:!1,precondition:Ca.terminalAvailable_and_singularSelection,run:async(i,e,t)=>{let o;if(i.groupService.lastAccessedMenu==="inline-tab"){fpt(i,t)?.changeIcon();return}for(let n of l2e(e)??[])o=await n.changeIcon(o)}}),Wr({id:"workbench.action.terminal.changeColor",title:vr.changeColor,precondition:Ca.terminalAvailable,run:(i,e,t)=>fpt(i,t)?.changeColor()}),Wr({id:"workbench.action.terminal.changeColorActiveTab",title:vr.changeColor,f1:!1,precondition:Ca.terminalAvailable_and_singularSelection,run:async(i,e,t)=>{let o,n=0;if(i.groupService.lastAccessedMenu==="inline-tab"){fpt(i,t)?.changeColor();return}for(let r of l2e(e)??[]){let s=n!==0;o=await r.changeColor(o,s),n++}}}),Wr({id:"workbench.action.terminal.rename",title:vr.rename,precondition:Ca.terminalAvailable,run:(i,e,t)=>YOo(i,e,t)}),Wr({id:"workbench.action.terminal.renameActiveTab",title:vr.rename,f1:!1,keybinding:{primary:60,mac:{primary:3},when:C.and(pt.tabsFocus),weight:200},precondition:Ca.terminalAvailable_and_singularSelection,run:async(i,e)=>{let t=e.get(Cc),o=e.get(Ne),n=l2e(e),r=n?.[0];if(r){if(t.lastAccessedMenu==="inline-tab")return YOo(i,e,r);i.editingService.setEditingTerminal(r),i.editingService.setEditable(r,{validationMessage:s=>iEn(s),onFinish:async(s,l)=>{if(i.editingService.setEditable(r,null),i.editingService.setEditingTerminal(void 0),l){let c=[];for(let u of n)c.push((async()=>{await u.rename(s)})());try{await Promise.all(c)}catch(u){o.error(u)}}}})}}}),pc({id:"workbench.action.terminal.detachSession",title:P(15941,"Detach Session"),run:i=>i.detachProcessAndDispose(3)}),Wr({id:"workbench.action.terminal.attachToSession",title:P(15936,"Attach to Session"),run:async(i,e)=>{let t=e.get($e),o=e.get(nt),n=e.get(bo),r=e.get(Ne),s=n.getConnection()?.remoteAuthority??void 0,l=await e.get(uh).getBackend(s);if(!l)throw new Error(`No backend registered for remote authority '${s}'`);let c=await l.listProcesses();l.reduceConnectionGraceTime();let p=c.filter(g=>!i.service.isAttachedToTerminal(g)).map(g=>{let f=o.getUriLabel(A.file(g.cwd));return{label:g.title,detail:g.workspaceName?`${g.workspaceName} \u2E31 ${f}`:f,description:g.pid?String(g.pid):"",term:g}});if(p.length===0){r.info(d(15933,null));return}let h=await t.pick(p,{canPickMany:!1});if(h){let g=await i.service.createTerminal({config:{attachPersistentProcess:h.term}});i.service.setActiveInstance(g),await iIe(g,i)}}}),pc({id:"workbench.action.terminal.scrollToPreviousCommand",title:vr.scrollToPreviousCommand,keybinding:{primary:2064,when:C.and(pt.focus,Oa.negate()),weight:200},precondition:Ca.terminalAvailable,icon:L.arrowUp,menu:[{id:R.ViewTitle,group:"navigation",order:4,when:C.equals("view",Fc),isHiddenByDefault:!0},...[R.EditorTitle,R.CompactWindowEditorTitle].map(i=>({id:i,group:"1_shellIntegration",order:4,when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}))],run:i=>i.xterm?.markTracker.scrollToPreviousMark(void 0,void 0,i.capabilities.has(2))}),pc({id:"workbench.action.terminal.scrollToNextCommand",title:vr.scrollToNextCommand,keybinding:{primary:2066,when:C.and(pt.focus,Oa.negate()),weight:200},precondition:Ca.terminalAvailable,icon:L.arrowDown,menu:[{id:R.ViewTitle,group:"navigation",order:5,when:C.equals("view",Fc),isHiddenByDefault:!0},...[R.EditorTitle,R.CompactWindowEditorTitle].map(i=>({id:i,group:"1_shellIntegration",order:5,when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}))],run:i=>{i.xterm?.markTracker.scrollToNextMark(),i.focus()}}),pc({id:"workbench.action.terminal.selectToPreviousCommand",title:P(15983,"Select to Previous Command"),keybinding:{primary:3088,when:pt.focus,weight:200},precondition:Ca.terminalAvailable,run:i=>{i.xterm?.markTracker.selectToPreviousMark(),i.focus()}}),pc({id:"workbench.action.terminal.selectToNextCommand",title:P(15981,"Select to Next Command"),keybinding:{primary:3090,when:pt.focus,weight:200},precondition:Ca.terminalAvailable,run:i=>{i.xterm?.markTracker.selectToNextMark(),i.focus()}}),bh({id:"workbench.action.terminal.selectToPreviousLine",title:P(15984,"Select to Previous Line"),precondition:Ca.terminalAvailable,run:async(i,e,t)=>{i.markTracker.selectToPreviousLine(),(t||i).focus()}}),bh({id:"workbench.action.terminal.selectToNextLine",title:P(15982,"Select to Next Line"),precondition:Ca.terminalAvailable,run:async(i,e,t)=>{i.markTracker.selectToNextLine(),(t||i).focus()}}),Wr({id:"workbench.action.terminal.newWithCwd",title:vr.newWithCwd,metadata:{description:vr.newWithCwd.value,args:[{name:"args",schema:{type:"object",required:["cwd"],properties:{cwd:{description:d(15956,null),type:"string"}}}}]},run:async(i,e,t)=>{let o=t?PKi(t.cwd):void 0,n=await i.service.createTerminal({cwd:o});n&&(i.service.setActiveInstance(n),await iIe(n,i))}}),pc({id:"workbench.action.terminal.renameWithArg",title:vr.renameWithArgs,metadata:{description:vr.renameWithArgs.value,args:[{name:"args",schema:{type:"object",required:["name"],properties:{name:{description:d(15964,null),type:"string",minLength:1}}}}]},precondition:Ca.terminalAvailable,f1:!1,run:async(i,e,t,o)=>{let n=t.get(Ne),r=o?PKi(o.name):void 0;if(!r){n.warn(d(15965,null));return}i.rename(r)}}),pc({id:"workbench.action.terminal.relaunch",title:P(15962,"Relaunch Active Terminal"),run:i=>i.relaunch()}),Wr({id:"workbench.action.terminal.split",title:vr.split,precondition:C.or(pt.processSupported,pt.webExtensionContributedProfile),keybinding:{primary:3098,weight:200,mac:{primary:2141,secondary:[1306]},when:pt.focus},icon:L.splitHorizontal,run:async(i,e,t)=>{let o=Di(t)?t:void 0,n=e.get(fe),r=e.get(Ae),s=ZOo(o),l=(await i.service.getInstanceHost(s?.location)).activeInstance;if(!l)return;let c=await NKi(l,r.getWorkspace().folders,n,i.configService);if(c===void 0)return;let u=await i.service.createTerminal({location:{parentTerminal:l},config:s?.config,cwd:c});await iIe(u,i)}}),Wr({id:"workbench.action.terminal.splitActiveTab",title:vr.split,f1:!1,keybinding:{primary:3098,mac:{primary:2141,secondary:[1306]},weight:200,when:pt.tabsFocus},run:async(i,e)=>{let t=l2e(e);if(t){let o=[];for(let n of t)o.push((async()=>{await i.service.createTerminal({location:{parentTerminal:n}}),await i.groupService.showPanel(!0)})());await Promise.all(o)}}}),b7t({id:"workbench.action.terminal.unsplit",title:vr.unsplit,precondition:Ca.terminalAvailable,run:async(i,e)=>{let t=e.groupService.getGroupForInstance(i);t&&t?.terminalInstances.length>1&&e.groupService.unsplitInstance(i)}}),Wr({id:"workbench.action.terminal.joinActiveTab",title:P(15950,"Join Terminals"),precondition:C.and(Ca.terminalAvailable,pt.tabsSingularSelection.toNegated()),run:async(i,e)=>{let t=l2e(e);t&&t.length>1&&i.groupService.joinInstances(t)}}),Wr({id:"workbench.action.terminal.join",title:P(15947,"Join Terminals..."),precondition:Ca.terminalAvailable,run:async(i,e)=>{let t=e.get(Pe),o=e.get(Ne),n=e.get($e),r=[];if(i.groupService.instances.length<=1){o.warn(d(15948,null));return}let s=i.groupService.instances.filter(c=>c.instanceId!==i.groupService.activeInstance?.instanceId);for(let c of s)if(i.groupService.getGroupForInstance(c)?.terminalInstances.length===1){let h=`$(${vee(e,c)}): ${c.title}`,g=[],f=lw(c);f&&g.push(f);let v=mR(c,t.getColorTheme().type);v&&g.push(...v),r.push({terminal:c,label:h,iconClasses:g})}if(r.length===0){o.warn(d(15949,null));return}let l=await n.pick(r,{});l&&i.groupService.joinInstances([l.terminal,i.groupService.activeInstance])}}),pc({id:"workbench.action.terminal.splitInActiveWorkspace",title:P(15986,"Split Terminal (In Active Workspace)"),run:async(i,e)=>{(await e.service.createTerminal({location:{parentTerminal:i}}))?.target!==2&&await e.groupService.showPanel(!0)}}),bh({id:"workbench.action.terminal.selectAll",title:P(15979,"Select All"),precondition:Ca.terminalAvailable,keybinding:[{primary:0,mac:{primary:2079},weight:200,when:pt.focusInAny}],run:i=>i.selectAll()}),Wr({id:"workbench.action.terminal.new",title:P(15954,"Create New Terminal"),precondition:C.or(pt.processSupported,pt.webExtensionContributedProfile),icon:yEo,keybinding:{primary:3163,mac:{primary:1371},weight:200},run:async(i,e,t)=>{let o=Di(t)?t:void 0,n=e.get(Ae),r=e.get(fe),s=e.get(kt),l=n.getWorkspace().folders;if(o&&Wp(o)&&(o.altKey||o.ctrlKey)){await i.service.createTerminal({location:{splitActiveTerminal:!0}});return}if(i.service.isProcessSupportRegistered){o=!o||Wp(o)?{}:o,fI(zi())&&!o.location&&(o.location={viewColumn:Fx(s,s.activeGroup)});let c;if(l.length<=1)c=await i.service.createTerminal(o);else{let u=(await nEn(e))?.cwd;if(!u)return;o.cwd=u,c=await i.service.createTerminal(o)}i.service.setActiveInstance(c),await iIe(c,i)}else i.profileService.contributedProfiles.length>0?r.executeCommand("workbench.action.terminal.newWithProfile"):r.executeCommand("workbench.action.terminal.toggleTerminal")}});async function a(i,e){e&&(await i.service.safeDisposeTerminal(e),i.groupService.instances.length>0&&await i.groupService.showPanel(!0))}Wr({id:"workbench.action.terminal.kill",title:P(15951,"Kill the Active Terminal Instance"),precondition:C.or(Ca.terminalAvailable,pt.isOpen),icon:h$t,run:async i=>a(i,i.groupService.activeInstance)}),Wr({id:"workbench.action.terminal.killViewOrEditor",title:vr.kill,f1:!1,precondition:C.or(Ca.terminalAvailable,pt.isOpen),run:async i=>a(i,i.service.activeInstance)}),Wr({id:"workbench.action.terminal.killAll",title:P(15952,"Kill All Terminals"),precondition:C.or(Ca.terminalAvailable,pt.isOpen),icon:L.trash,run:async i=>{let e=[];for(let t of i.service.instances)e.push(i.service.safeDisposeTerminal(t));await Promise.all(e)}}),Wr({id:"workbench.action.terminal.killEditor",title:P(15953,"Kill the Active Terminal in Editor Area"),precondition:Ca.terminalAvailable,keybinding:{primary:2101,win:{primary:2110,secondary:[2101]},weight:200,when:C.and(pt.focus,pt.editorFocus)},run:(i,e)=>e.get(fe).executeCommand(ok)}),Wr({id:"workbench.action.terminal.killActiveTab",title:vr.kill,f1:!1,precondition:C.or(Ca.terminalAvailable,pt.isOpen),keybinding:{primary:20,mac:{primary:2049,secondary:[20]},weight:200,when:pt.tabsFocus},run:async(i,e)=>{let t=[];for(let o of l2e(e,!0)??[])t.push(i.service.safeDisposeTerminal(o));await Promise.all(t),i.groupService.focusTabs()}}),Wr({id:"workbench.action.terminal.focusHover",title:vr.focusHover,precondition:C.or(Ca.terminalAvailable,pt.isOpen),keybinding:{primary:Gi(2089,2087),weight:200,when:C.or(pt.tabsFocus,pt.focus)},run:i=>i.groupService.focusHover()}),pc({id:"workbench.action.terminal.clear",title:P(15937,"Clear"),precondition:Ca.terminalAvailable,keybinding:[{primary:0,mac:{primary:2089},weight:201,when:C.or(C.and(pt.focus,Oa.negate()),C.and(Oa,Jd,Fu.isEqualTo("terminal")))}],run:i=>i.clearBuffer()}),Wr({id:"workbench.action.terminal.selectDefaultShell",title:P(15980,"Select Default Profile"),run:i=>i.service.showProfileQuickPick("setDefault")}),Wr({id:"workbench.action.terminal.openSettings",title:P(15960,"Configure Terminal Settings"),precondition:Ca.terminalAvailable,run:(i,e)=>e.get(Qo).openSettings({jsonEditor:!1,query:"@feature:terminal"})}),pc({id:"workbench.action.terminal.setDimensions",title:P(15985,"Set Fixed Dimensions"),precondition:Ca.terminalAvailable_and_opened,run:i=>i.setFixedDimensions()}),b7t({id:"workbench.action.terminal.sizeToContentWidth",title:vr.toggleSizeToContentWidth,precondition:Ca.terminalAvailable_and_opened,keybinding:{primary:568,weight:200,when:pt.focus},run:i=>i.toggleSizeToContentWidth()}),Wr({id:"workbench.action.terminal.switchTerminal",title:P(15987,"Switch Terminal"),precondition:Ca.terminalAvailable,run:async(i,e,t)=>{let o=PKi(t);if(!o)return;if(o===GF.text){i.service.refreshActiveGroup();return}if(o===AKi){e.get(B).updateValue("terminal.integrated.tabs.enabled",!0);return}let r=/^([0-9]+): /.exec(o);if(r)return i.groupService.setActiveGroupByIndex(Number(r[1])-1),i.groupService.showPanel(!0);let s=i.profileService.availableProfiles,l=o.substring(4);if(s){let c=s.find(u=>u.profileName===l);if(c){let u=await i.service.createTerminal({config:c});i.service.setActiveInstance(u)}else console.warn(`No profile with name "${l}"`)}else console.warn(`Unmatched terminal item: "${o}"`)}})}function tEn(a,i){let e=a.get(an),t=[],o=eEn(i);if(o&&o.length>0){for(let n of o){let r=e.getInstanceFromId(n.instanceId);r&&t.push(r)}if(t.length>0)return t}}function l2e(a,i,e){let t=a.get(Co),o=a.get(Cc),n=[],r=t.lastFocusedList instanceof Kse?t.lastFocusedList:void 0,s=r?.getSelection();if(o.lastAccessedMenu==="inline-tab"&&!s?.length)return o.activeInstance?[o.activeInstance]:void 0;if(!r||!s)return;let l=r.getFocus(),c=o.instances;if(l.length===1&&!s.includes(l[0]))return n.push(c[l[0]]),n;for(let u of s)n.push(c[u]);return n.filter(u=>!!u)}function iEn(a){return!a||a.trim().length===0?{content:d(15929,null),severity:ft.Info}:null}function oEn(a){return Di(a)&&"profileName"in a}function ZOo(a){return oEn(a)?{config:a,location:a.location}:a}var MKi;function OKi(a){let i=ANt(a);return MKi?.dispose(),MKi=W(class extends z{constructor(){super({id:"workbench.action.terminal.newWithProfile",title:P(15957,"Create New Terminal (With Profile)"),f1:!0,precondition:C.or(pt.processSupported,pt.webExtensionContributedProfile),metadata:{description:"workbench.action.terminal.newWithProfile",args:[{name:"args",schema:{type:"object",required:["profileName"],properties:{profileName:{description:d(15958,null),type:"string",enum:i.values,markdownEnumDescriptions:i.markdownDescriptions},location:{description:d(15930,null),type:"string",enum:["view","editor"],enumDescriptions:[d(15932,null),d(15931,null)]}}}}]}})}async run(e,t,o){let n=XOo(e),r=e.get(Ae),s=e.get(fe),l,c,u,p;if(Di(t)&&t&&yo(t,{profileName:!0})){let f=function(v){return Di(v)&&"location"in v},g=n.profileService.availableProfiles.find(v=>v.profileName===t.profileName);if(!g)throw new Error(`Could not find terminal profile "${t.profileName}"`);if(c={config:g},f(t))switch(t.location){case"editor":c.location=2;break;case"view":c.location=1;break}}else Wp(t)||Wbt(t)||sf(t)?(l=t,c=o?{config:o}:void 0):c=ZOo(t);if(l&&(l.altKey||l.ctrlKey)){let g=n.service.activeInstance;if(g){await n.service.createTerminal({location:{parentTerminal:g},config:c?.config});return}}if(r.getWorkspace().folders.length>1){let g={placeHolder:d(15959,null)},f=await s.executeCommand(iP,[g]);if(!f)return;p=f.uri}c?(c.cwd=p,u=await n.service.createTerminal(c)):u=await n.service.showProfileQuickPick("createInstance",p),u&&(n.service.setActiveInstance(u),await iIe(u,n))}}),MKi}function fpt(a,i){return a.service.getInstanceFromResource(eFo(i))||a.service.activeInstance}async function nEn(a,i){let e=a.get($e),t=a.get(nt),o=a.get(Ae),n=a.get(_t),r=a.get(Rt),s=a.get(B),l=a.get(Xp),c=o.getWorkspace().folders;if(!c.length)return;let u=await Promise.all(c.map(b=>rEn(b,s,l))),p=sEn(u);if(p.length===1)return p[0];let h=p.map(b=>{let S=b.folder.name,y=b.isOverridden?d(15961,null,t.getUriLabel(b.cwd,{relative:!b.isAbsolute})):t.getUriLabel(ai(b.cwd),{relative:!0});return{label:S,description:y!==S?y:void 0,pair:b,iconClasses:Ia(n,r,b.cwd,2)}}),g={placeHolder:d(15959,null),matchOnDescription:!0,canPickMany:!1},f=i||Ie.None;return(await e.pick(h,g,f))?.pair}async function rEn(a,i,e){let t=i.getValue("terminal.integrated.cwd",{resource:a.uri});if(!We(t)||t.length===0)return{folder:a,cwd:a.uri,isAbsolute:!1,isOverridden:!1};let o=await e.resolveAsync(a,t);return Jl(o)||o.startsWith(eI.VARIABLE_LHS)?{folder:a,isAbsolute:!0,isOverridden:!0,cwd:A.from({...a.uri,path:o})}:{folder:a,isAbsolute:!1,isOverridden:!0,cwd:A.joinPath(a.uri,o)}}function sEn(a){let i=new Map;for(let o of a){let n=o.cwd.toString();(!i.get(n)||n===o.folder.uri.toString())&&i.set(n,o)}let e=new Set(i.values());return a.filter(o=>e.has(o))}async function iIe(a,i){let e=a??i.service.activeInstance??i.editorService.activeInstance??i.groupService.activeInstance;if(!e){i.groupService.instances.length>0&&await i.groupService.showPanel(!0);return}await i.service.focusInstance(e)}async function YOo(a,i,e){let t=e;if((!t||!t?.rename)&&(t=fpt(a,e)),t){let o=await i.get($e).input({value:t.title,prompt:d(15963,null)});o&&t.rename(o)}}function eFo(a){return A.isUri(a)?a:void 0}function PKi(a){return We(a)?a:void 0}function tFo(){aEn()}function aEn(){for(let a=0;a<9;a++){let i=a,e=a+1;xt.registerCommandAndKeybindingRule({id:`workbench.action.terminal.focusAtIndex${e}`,weight:200,when:void 0,primary:0,handler:t=>(t.get(Cc).setActiveInstanceByIndex(i),t.get(Cc).showPanel(!0))})}}var d2e=class extends k{constructor(e){super();this._configurationService=e;this._skipTerminalCommands=new Set(bJe);this._onConfigChanged=this._register(new T);this._fontMetrics=this._register(new FKi(this,this._configurationService)),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,t=>{(!t||t.affectsConfiguration(gb))&&this._updateConfig()}))}get config(){return this._config}get defaultLocation(){return this.config.defaultLocation==="editor"?2:1}get onConfigChanged(){return this._onConfigChanged.event}setPanelContainer(e){return this._fontMetrics.setPanelContainer(e)}configFontIsMonospace(){return this._fontMetrics.configFontIsMonospace()}getFont(e,t,o){return this._fontMetrics.getFont(e,t,o)}shouldCommandSkipShell(e){return this._skipTerminalCommands.has(e)}_updateConfig(){let e={...this._configurationService.getValue(gb)};e.fontWeight=this._normalizeFontWeight(e.fontWeight,edo),e.fontWeightBold=this._normalizeFontWeight(e.fontWeightBold,tdo),this._config=e;let t=new Set(bJe),o=e.commandsToSkipShell??[];for(let n=0;n<o.length;n++){let r=o[n];if(r[0]==="-"){t.delete(r.slice(1));continue}t.add(r)}this._skipTerminalCommands=t,this._onConfigChanged.fire()}_normalizeFontWeight(e,t){return e==="normal"||e==="bold"?e:WKi(e,fJe,vJe,t)}};d2e=I([m(0,B)],d2e);var FKi=class extends k{constructor(e,t){super();this._terminalConfigurationService=e;this._configurationService=t;this.linuxDistro=1;this._register(ee(()=>this._charMeasureElement?.remove()))}setPanelContainer(e){this._panelContainer=e}configFontIsMonospace(){let t=this._terminalConfigurationService.config.fontFamily||this._configurationService.getValue("editor").fontFamily||Ku.fontFamily,o=this._getBoundingRectFor("i",t,15),n=this._getBoundingRectFor("w",t,15);return!o||!n||!o.width||!n.width?!0:o.width===n.width}getFont(e,t,o){let n=this._configurationService.getValue("editor"),r=this._terminalConfigurationService.config.fontFamily||n.fontFamily||Ku.fontFamily||"monospace",s=WKi(this._terminalConfigurationService.config.fontSize,6,100,Ku.fontSize);this._terminalConfigurationService.config.fontFamily||(this.linuxDistro===2&&(r="'DejaVu Sans Mono'"),this.linuxDistro===3&&(r="'Ubuntu Mono'",s=WKi(s+2,6,100,Ku.fontSize))),r+=", monospace",et&&(r+=", AppleBraille");let l=this._terminalConfigurationService.config.letterSpacing?Math.max(Math.floor(this._terminalConfigurationService.config.letterSpacing),Zco):NNt,c=this._terminalConfigurationService.config.lineHeight?Math.max(this._terminalConfigurationService.config.lineHeight,1):ONt;if(o)return{fontFamily:r,fontSize:s,letterSpacing:l,lineHeight:c};if(t?._renderService?._renderer.value){let u=t._renderService.dimensions.css.cell;if(u?.width&&u?.height)return{fontFamily:r,fontSize:s,letterSpacing:l,lineHeight:c,charHeight:u.height/c,charWidth:u.width-Math.round(l)/e.devicePixelRatio}}return this._measureFont(e,r,s,l,c)}_createCharMeasureElementIfNecessary(){if(!this._panelContainer)throw new Error("Cannot measure element when terminal is not attached");return(!this._charMeasureElement||!this._charMeasureElement.parentElement)&&(this._charMeasureElement=document.createElement("div"),this._panelContainer.appendChild(this._charMeasureElement)),this._charMeasureElement}_getBoundingRectFor(e,t,o){let n;try{n=this._createCharMeasureElementIfNecessary()}catch{return}let r=n.style;r.display="inline-block",r.fontFamily=t,r.fontSize=o+"px",r.lineHeight="normal",n.innerText=e;let s=n.getBoundingClientRect();return r.display="none",s}_measureFont(e,t,o,n,r){let s=this._getBoundingRectFor("X",t,o);if(this._lastFontMeasurement&&(!s||!s.width||!s.height))return this._lastFontMeasurement;if(this._lastFontMeasurement={fontFamily:t,fontSize:o,letterSpacing:n,lineHeight:r,charWidth:0,charHeight:0},s&&s.width&&s.height)if(this._lastFontMeasurement.charHeight=Math.ceil(s.height),this._terminalConfigurationService.config.gpuAcceleration==="off")this._lastFontMeasurement.charWidth=s.width;else{let u=(Math.floor(s.width*e.devicePixelRatio)+Math.round(n))/e.devicePixelRatio;this._lastFontMeasurement.charWidth=u-Math.round(n)/e.devicePixelRatio}return this._lastFontMeasurement}};function WKi(a,i,e,t){if(a==null)return t;let o=We(a)?parseInt(a,10):a;return isNaN(o)?t:jn(o,i,e)}function nFo(){be.appendMenuItems([{id:R.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.new",title:d(16037,null)},order:1}},{id:R.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.newInNewWindow",title:d(16036,null),precondition:C.has("terminalIsOpen")},order:2,when:pt.processSupported}},{id:R.MenubarTerminalMenu,item:{group:"1_create",command:{id:"workbench.action.terminal.split",title:d(16040,null),precondition:C.has("terminalIsOpen")},order:2,when:pt.processSupported}},{id:R.MenubarTerminalMenu,item:{group:"3_run",command:{id:"workbench.action.terminal.runActiveFile",title:d(16038,null)},order:3,when:pt.processSupported}},{id:R.MenubarTerminalMenu,item:{group:"3_run",command:{id:"workbench.action.terminal.runSelectedText",title:d(16039,null)},order:4,when:pt.processSupported}}]),be.appendMenuItems([{id:R.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.killViewOrEditor",title:vr.kill.value},group:"7_kill"}},{id:R.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.copySelection",title:d(16048,null)},group:"3_edit",order:1}},{id:R.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.copySelectionAsHtml",title:d(16049,null)},group:"3_edit",order:2}},{id:R.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.paste",title:d(16053,null)},group:"3_edit",order:3}},{id:R.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.clear",title:d(16046,null)},group:"5_clear"}},{id:R.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:vr.toggleSizeToContentWidth},group:"9_config"}},{id:R.TerminalInstanceContext,item:{command:{id:"workbench.action.terminal.selectAll",title:d(16057,null)},group:"3_edit",order:3}}]),be.appendMenuItem(R.EditorTabsBarContext,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:vr.new},group:"1_zzz_file",order:30,when:pt.processSupported}),be.appendMenuItem(R.EmptyEditorGroupContext,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:vr.new},group:"1_zzz_file",order:30,when:pt.processSupported}),be.appendMenuItems([{id:R.TerminalEditorInstanceContext,item:{group:"1_create",command:{id:"workbench.action.terminal.split",title:vr.split.value}}},{id:R.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.new",title:vr.new},group:"1_create"}},{id:R.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.killEditor",title:vr.kill.value},group:"7_kill"}},{id:R.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.copySelection",title:d(16048,null)},group:"3_edit",order:1}},{id:R.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.copySelectionAsHtml",title:d(16049,null)},group:"3_edit",order:2}},{id:R.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.paste",title:d(16053,null)},group:"3_edit",order:3}},{id:R.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.clear",title:d(16046,null)},group:"5_clear"}},{id:R.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.selectAll",title:d(16057,null)},group:"3_edit",order:3}},{id:R.TerminalEditorInstanceContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:vr.toggleSizeToContentWidth},group:"9_config"}}]),be.appendMenuItems([{id:R.TerminalTabEmptyAreaContext,item:{command:{id:"workbench.action.terminal.newWithProfile",title:d(16051,null)},group:"1_create"}},{id:R.TerminalTabEmptyAreaContext,item:{command:{id:"workbench.action.terminal.new",title:vr.new},group:"1_create"}}]),be.appendMenuItems([{id:R.TerminalNewDropdownContext,item:{command:{id:"workbench.action.terminal.selectDefaultShell",title:P(16058,"Select Default Profile")},group:"3_configure"}},{id:R.TerminalNewDropdownContext,item:{command:{id:"workbench.action.terminal.openSettings",title:d(16052,null)},group:"3_configure"}},{id:R.TerminalNewDropdownContext,item:{command:{id:"workbench.action.tasks.runTask",title:d(16043,null)},when:ag,group:"4_tasks",order:1}},{id:R.TerminalNewDropdownContext,item:{command:{id:"workbench.action.tasks.configureTaskRunner",title:d(16042,null)},when:ag,group:"4_tasks",order:2}}]),be.appendMenuItems([{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.switchTerminal",title:P(16063,"Switch Terminal")},group:"navigation",order:0,when:C.and(C.equals("view",Fc),C.not("config.terminal.integrated.tabs.enabled"))}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.focus",title:vr.focus},alt:{id:"workbench.action.terminal.split",title:vr.split.value,icon:L.splitHorizontal},group:"navigation",order:0,when:C.and(C.not(mme.ChatHasHiddenTerminals),C.equals("view",Fc),C.has("config.terminal.integrated.tabs.enabled"),C.or(C.and(C.equals("config.terminal.integrated.tabs.showActiveTerminal","singleTerminal"),C.equals("terminalGroupCount",1)),C.and(C.equals("config.terminal.integrated.tabs.showActiveTerminal","singleTerminalOrNarrow"),C.or(C.equals("terminalGroupCount",1),C.has("isTerminalTabsNarrow"))),C.and(C.equals("config.terminal.integrated.tabs.showActiveTerminal","singleGroup"),C.equals("terminalGroupCount",1)),C.equals("config.terminal.integrated.tabs.showActiveTerminal","always")))}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.split",title:vr.split,icon:L.splitHorizontal},group:"navigation",order:2,when:pt.shouldShowViewInlineActions}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.kill",title:vr.kill,icon:L.trash},group:"navigation",order:3,when:pt.shouldShowViewInlineActions}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.new",title:vr.new,icon:L.plus},alt:{id:"workbench.action.terminal.split",title:vr.split.value,icon:L.splitHorizontal},group:"navigation",order:0,when:C.and(C.equals("view",Fc),C.or(pt.webExtensionContributedProfile,pt.processSupported))}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.clear",title:d(16047,null),icon:L.clearAll},group:"navigation",order:6,when:C.equals("view",Fc),isHiddenByDefault:!0}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.runActiveFile",title:d(16055,null),icon:L.run},group:"navigation",order:7,when:C.equals("view",Fc),isHiddenByDefault:!0}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.runSelectedText",title:d(16056,null),icon:L.selection},group:"navigation",order:8,when:C.equals("view",Fc),isHiddenByDefault:!0}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.startVoice",title:d(16059,null)},group:"navigation",order:9,when:C.and(C.equals("view",Fc),pt.terminalDictationInProgress.toNegated()),isHiddenByDefault:!0}},{id:R.ViewTitle,item:{command:{id:"workbench.action.terminal.stopVoice",title:d(16061,null)},group:"navigation",order:9,when:C.and(C.equals("view",Fc),pt.terminalDictationInProgress),isHiddenByDefault:!0}}]),be.appendMenuItems([{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.splitActiveTab",title:vr.split.value},group:"1_create",order:1}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.moveToEditor",title:vr.moveToEditor.value},group:"1_create",order:2}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.moveIntoNewWindow",title:vr.moveIntoNewWindow.value},group:"1_create",order:2}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.renameActiveTab",title:d(16054,null)},group:"3_edit"}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.changeIconActiveTab",title:d(16045,null)},group:"3_edit"}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.changeColorActiveTab",title:d(16044,null)},group:"3_edit"}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.sizeToContentWidth",title:vr.toggleSizeToContentWidth},group:"3_edit"}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.joinActiveTab",title:d(16050,null)},when:pt.tabsSingularSelection.toNegated(),group:"9_config"}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.unsplit",title:vr.unsplit.value},when:C.and(pt.tabsSingularSelection,pt.splitTerminalTabFocused),group:"9_config"}},{id:R.TerminalTabContext,item:{command:{id:"workbench.action.terminal.killActiveTab",title:vr.kill.value},group:"7_kill"}}]),be.appendMenuItem(R.EditorTitleContext,{command:{id:"workbench.action.terminal.moveToTerminalPanel",title:vr.moveToTerminalPanel},when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"}),be.appendMenuItem(R.EditorTitleContext,{command:{id:"workbench.action.terminal.rename",title:vr.rename},when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"}),be.appendMenuItem(R.EditorTitleContext,{command:{id:"workbench.action.terminal.changeColor",title:vr.changeColor},when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"}),be.appendMenuItem(R.EditorTitleContext,{command:{id:"workbench.action.terminal.changeIcon",title:vr.changeIcon},when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"}),be.appendMenuItem(R.EditorTitleContext,{command:{id:"workbench.action.terminal.sizeToContentWidth",title:vr.toggleSizeToContentWidth},when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),group:"2_files"});for(let a of[R.EditorTitle,R.CompactWindowEditorTitle])be.appendMenuItem(a,{command:{id:"workbench.action.createTerminalEditorSameGroup",title:vr.new,icon:L.plus},alt:{id:"workbench.action.terminal.split",title:vr.split.value,icon:L.splitHorizontal},group:"navigation",order:0,when:Ho.Scheme.isEqualTo(Q.vscodeTerminal)}),be.appendMenuItem(a,{command:{id:"workbench.action.terminal.clear",title:d(16047,null),icon:L.clearAll},group:"navigation",order:6,when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}),be.appendMenuItem(a,{command:{id:"workbench.action.terminal.runActiveFile",title:d(16055,null),icon:L.run},group:"navigation",order:7,when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}),be.appendMenuItem(a,{command:{id:"workbench.action.terminal.runSelectedText",title:d(16056,null),icon:L.selection},group:"navigation",order:8,when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}),be.appendMenuItem(a,{command:{id:"workbench.action.terminal.startVoice",title:d(16060,null),icon:L.mic},group:"navigation",order:9,when:C.and(Ho.Scheme.isEqualTo(Q.vscodeTerminal),pt.terminalDictationInProgress.negate()),isHiddenByDefault:!0}),be.appendMenuItem(a,{command:{id:"workbench.action.terminal.stopVoice",title:d(16062,null),icon:L.run},group:"navigation",order:10,when:C.and(Ho.Scheme.isEqualTo(Q.vscodeTerminal),YH,pt.terminalDictationInProgress),isHiddenByDefault:!0})}function u2e(a,i,e,t,o,n,r){i=i.filter(b=>!b.isAutoDetected);let[s,l]=cEn(i),[c,u]=dEn(t),p=[],h=[],g=a===2||typeof a=="object"&&yo(a,{viewColumn:!0})&&a.viewColumn===tr?{viewColumn:En}:{splitActiveTerminal:!0};a===2&&(a={viewColumn:tr}),p.push(r.add(new it("workbench.action.terminal.new",vr.new,void 0,!0,()=>o.createAndFocusTerminal()))),p.push(r.add(new it("workbench.action.terminal.newInNewWindow",vr.newInNewWindow.value,void 0,!0,()=>o.createAndFocusTerminal({location:{viewColumn:ff,auxiliary:{compact:!0}}})))),p.push(r.add(new it("workbench.action.terminal.split",vr.split.value,void 0,!0,()=>o.createAndFocusTerminal({location:g})))),p.push(new oi);for(let b of s)iFo(b,e,a,g,o,p,h,r);for(let b of c)oFo(b,e,a,g,o,p,h,r);(s.length>0||c.length>0)&&(l.length>0||u.length>0)&&p.push(new oi);for(let b of l)iFo(b,e,a,g,o,p,h,r);for(let b of u)oFo(b,e,a,g,o,p,h,r);p.length>0&&(p.push(new sa("split.profile",d(16041,null),h)),p.push(new oi));let f=n.getActions();return p.push(...oi.join(...f.map(b=>b[1]))),{dropdownAction:r.add(new it("refresh profiles",d(16035,null),"codicon-chevron-down",!0)),dropdownMenuActions:p,className:`terminal-tab-actions-${o.resolveLocation(a)}`}}function cEn(a){let i=[],e=[];for(let t of a)rFo(t.profileName)?i.push(t):e.push(t);return[i,e]}function dEn(a){let i=[],e=[];for(let t of a)uEn(t)?i.push(t):e.push(t);return[i,e]}function uEn(a){let i=a.extensionIdentifier.toLowerCase();return i==="github.copilot-chat"||i==="anthropic.claude-code"?!0:rFo(a.title)}function rFo(a){let i=a.toLowerCase();return i.includes("copilot")||i.includes("claude")}function iFo(a,i,e,t,o,n,r,s){let l=a.profileName===i,c={config:a,location:e},u={config:a,location:t},p=a.profileName.replace(/[\n\r\t]/g,"");n.push(s.add(new it("workbench.action.terminal.newWithProfile",l?d(16034,null,p):p,void 0,!0,async()=>{await o.createAndFocusTerminal(c)}))),r.push(s.add(new it("workbench.action.terminal.split",l?d(16034,null,p):p,void 0,!0,async()=>{await o.createAndFocusTerminal(u)})))}function oFo(a,i,e,t,o,n,r,s){let c=a.title===i?d(16034,null,a.title.replace(/[\n\r\t]/g,"")):a.title.replace(/[\n\r\t]/g,"");n.push(s.add(new it("contributed",c,void 0,!0,()=>o.createAndFocusTerminal({config:{extensionIdentifier:a.extensionIdentifier,id:a.id,title:c},location:e})))),r.push(s.add(new it("contributed-split",c,void 0,!0,()=>o.createAndFocusTerminal({config:{extensionIdentifier:a.extensionIdentifier,id:a.id,title:c},location:t}))))}var p2e=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(sG,e,t,o,n);this._terminalEditorService=r;this._terminalProfileResolverService=s;this._terminalService=l;this._terminalConfigurationService=c;this._instantiationService=h;this._contextMenuService=g;this._terminalProfileService=f;this._workbenchLayoutService=v;this._editorInput=void 0;this._cancelContextMenu=!1;this._newDropdown=this._register(new ue);this._sessionDisposables=this._register(new O);this._disposableStore=this._register(new O);this._dropdownMenu=this._register(p.createMenu(R.TerminalNewDropdownContext,u)),this._instanceMenu=this._register(p.createMenu(R.TerminalInstanceContext,u)),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(b=>this._updateTabActionBar(b)))}async setInput(e,t,o,n){this._editorInput?.terminalInstance?.detachFromElement(),this._editorInput=e,await super.setInput(e,t,o,n),this._editorInput.terminalInstance?.attachToElement(this._overflowGuardElement),this._lastDimension&&this.layout(this._lastDimension),this._editorInput.terminalInstance?.setVisible(this.isVisible()&&this._workbenchLayoutService.isVisible("workbench.parts.editor",this.window)),this._editorInput.terminalInstance&&(this._sessionDisposables.add(this._editorInput.terminalInstance.onDidFocus(()=>this._setActiveInstance())),this._editorInput.setCopyLaunchConfig(this._editorInput.terminalInstance.shellLaunchConfig))}clearInput(){super.clearInput(),this._sessionDisposables.clear(),this._overflowGuardElement&&this._editorInput?.terminalInstance?.domElement.parentElement===this._overflowGuardElement&&this._editorInput.terminalInstance?.detachFromElement(),this._editorInput=void 0}_setActiveInstance(){this._editorInput?.terminalInstance&&this._terminalEditorService.setActiveInstance(this._editorInput.terminalInstance)}focus(){super.focus(),this._editorInput?.terminalInstance?.focus(!0)}createEditor(e){this._editorInstanceElement=e,this._overflowGuardElement=_(".terminal-overflow-guard.terminal-editor"),this._editorInstanceElement.appendChild(this._overflowGuardElement),this._registerListeners()}_registerListeners(){this._editorInstanceElement&&(this._register($(this._editorInstanceElement,"mousedown",async e=>{let t=this._terminalEditorService.activeInstance;if(this._terminalEditorService.instances.length>0&&t){let o=await t.handleMouseEvent(e,this._instanceMenu);typeof o=="object"&&o.cancelContextMenu&&(this._cancelContextMenu=!0)}})),this._register($(this._editorInstanceElement,"contextmenu",e=>{let t=this._terminalConfigurationService.config.rightClickBehavior;if(t==="nothing"&&!e.shiftKey){e.preventDefault(),e.stopImmediatePropagation(),this._cancelContextMenu=!1;return}else!this._cancelContextMenu&&t!=="copyPaste"&&t!=="paste"&&(this._cancelContextMenu||d7(this.window,e,this._editorInput?.terminalInstance,this._instanceMenu,this._contextMenuService),e.preventDefault(),e.stopImmediatePropagation(),this._cancelContextMenu=!1)})))}_updateTabActionBar(e){this._disposableStore.clear();let t=u2e(2,e,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore);this._newDropdown.value?.update(t.dropdownAction,t.dropdownMenuActions)}layout(e){let t=this._editorInput?.terminalInstance;t&&(t.attachToElement(this._overflowGuardElement),t.layout(e)),this._lastDimension=e}setVisible(e){super.setVisible(e),this._editorInput?.terminalInstance?.setVisible(e&&this._workbenchLayoutService.isVisible("workbench.parts.editor",this.window))}getActionViewItem(e,t){switch(e.id){case"workbench.action.createTerminalEditorSameGroup":if(e instanceof Do){let o={viewColumn:tr};this._disposableStore.clear();let n=u2e(o,this._terminalProfileService.availableProfiles,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore);return this._newDropdown.value=this._instantiationService.createInstance(BC,e,n.dropdownAction,n.dropdownMenuActions,n.className,{hoverDelegate:t.hoverDelegate}),this._newDropdown.value?.update(n.dropdownAction,n.dropdownMenuActions),this._newDropdown.value}}return super.getActionViewItem(e,t)}_getDefaultProfileName(){let e;try{e=this._terminalProfileService.getDefaultProfileName()}catch{e=this._terminalProfileResolverService.defaultProfileName}return e}};p2e=I([m(1,_e),m(2,Pe),m(3,de),m(4,hb),m(5,ig),m(6,an),m(7,mp),m(8,X),m(9,Yt),m(10,F),m(11,Xe),m(12,fb),m(13,wi)],p2e);var m2e=class{constructor(i){this._terminalEditorService=i}canSerialize(i){return on(i.terminalInstance?.persistentProcessId)&&i.terminalInstance.shouldPersist}serialize(i){if(this.canSerialize(i))return JSON.stringify(this._toJson(i.terminalInstance))}deserialize(i,e){let t=JSON.parse(e);if(!pEn(t))throw new Error(`Could not revive terminal editor input, ${t}`);return this._terminalEditorService.reviveInput(t)}_toJson(i){return{id:i.persistentProcessId,pid:i.processId||0,title:i.title,titleSource:i.titleSource,cwd:"",icon:i.icon,color:i.color,hasChildProcesses:i.hasChildProcesses,isFeatureTerminal:i.shellLaunchConfig.isFeatureTerminal,hideFromUser:i.shellLaunchConfig.hideFromUser,reconnectionProperties:i.shellLaunchConfig.reconnectionProperties,shellIntegrationNonce:i.shellIntegrationNonce}}};m2e=I([m(0,hb)],m2e);function pEn(a){return Di(a)&&"id"in a&&"pid"in a}var h2e=class extends k{constructor(e,t,o,n,r,s){super();this._editorService=e;this._editorGroupsService=t;this._terminalInstanceService=o;this._instantiationService=n;this.instances=[];this._activeInstanceIndex=-1;this._isShuttingDown=!1;this._editorInputs=new Map;this._instanceDisposables=new Map;this._onDidDisposeInstance=this._register(new T);this.onDidDisposeInstance=this._onDidDisposeInstance.event;this._onDidFocusInstance=this._register(new T);this.onDidFocusInstance=this._onDidFocusInstance.event;this._onDidChangeInstanceCapability=this._register(new T);this.onDidChangeInstanceCapability=this._onDidChangeInstanceCapability.event;this._onDidChangeActiveInstance=this._register(new T);this.onDidChangeActiveInstance=this._onDidChangeActiveInstance.event;this._onDidChangeInstances=this._register(new T);this.onDidChangeInstances=this._onDidChangeInstances.event;this._terminalEditorActive=pt.terminalEditorActive.bindTo(s),this._register(ee(()=>{for(let l of this._instanceDisposables.values())je(l)})),this._register(r.onWillShutdown(()=>this._isShuttingDown=!0)),this._register(this._editorService.onDidActiveEditorChange(()=>{let l=this._editorService.activeEditor,c=l instanceof Zf?l?.terminalInstance:void 0,u=!!c&&l instanceof Zf;if(this._terminalEditorActive.set(u),u)l?.setGroup(this._editorService.activeEditorPane?.group),this.setActiveInstance(c);else for(let p of this.instances)p.resetFocusContextKey()})),this._register(this._editorService.onDidVisibleEditorsChange(()=>{let l=this.instances.map(p=>p.instanceId),u=this._getActiveTerminalEditors().find(p=>{let h=p instanceof Zf?p.terminalInstance?.instanceId:void 0;return h===void 0?!1:!l.includes(h)});u instanceof Zf&&u.terminalInstance&&(this._editorInputs.set(u.terminalInstance.resource.path,u),this.instances.push(u.terminalInstance))})),this._register(this._editorService.onDidCloseEditor(l=>{let c=l.editor instanceof Zf?l.editor.terminalInstance:void 0;if(c){let u=this.instances.findIndex(p=>p===c);if(u!==-1){let p=this.instances[u]===this.activeInstance;this._removeInstance(c),p&&this.setActiveInstance(void 0)}}}))}_getActiveTerminalEditors(){return this._editorService.visibleEditors.filter(e=>e instanceof Zf&&e.terminalInstance?.instanceId)}get activeInstance(){if(!(this.instances.length===0||this._activeInstanceIndex===-1))return this.instances[this._activeInstanceIndex]}setActiveInstance(e){this._activeInstanceIndex=e?this.instances.findIndex(t=>t===e):-1,this._onDidChangeActiveInstance.fire(this.activeInstance)}async focusInstance(e){this.instances.includes(e)&&(this.setActiveInstance(e),await this._revealEditor(e),await e.focusWhenReady(!0))}async focusActiveInstance(){return this.activeInstance?.focusWhenReady(!0)}async openEditor(e,t){let o=this.resolveResource(e);o&&(await this._activeOpenEditorRequest?.promise,this._activeOpenEditorRequest={instanceId:e.instanceId,promise:this._editorService.openEditor({resource:o,description:e.description||e.shellLaunchConfig.type,options:{pinned:!0,forceReload:!0,preserveFocus:t?.preserveFocus,auxiliary:t?.auxiliary}},t?.viewColumn??tr)},await this._activeOpenEditorRequest?.promise,this._activeOpenEditorRequest=void 0)}resolveResource(e){let t=e.resource,o=t.path,n=this._editorInputs.get(o);if(n)return n.resource;e.target=2;let r=this._instantiationService.createInstance(Zf,t,e);return this._registerInstance(o,r,e),r.resource}getInputFromResource(e){let t=this._editorInputs.get(e.path);if(!t)throw new Error(`Could not get input from resource: ${e.path}`);return t}_registerInstance(e,t,o){this._editorInputs.set(e,t),this._instanceDisposables.set(e,[o.onDidFocus(this._onDidFocusInstance.fire,this._onDidFocusInstance),o.onDisposed(this._onDidDisposeInstance.fire,this._onDidDisposeInstance),o.capabilities.onDidChangeCapabilities(()=>this._onDidChangeInstanceCapability.fire(o))]),this.instances.push(o),this._onDidChangeInstances.fire()}_removeInstance(e){let t=e.resource.path;this._editorInputs.delete(t);let o=this.instances.findIndex(r=>r===e);o!==-1&&this.instances.splice(o,1);let n=this._instanceDisposables.get(t);this._instanceDisposables.delete(t),n&&je(n),this._onDidChangeInstances.fire()}getInstanceFromResource(e){return cze(this.instances,e)}async splitInstance(e,t={}){if(e.target===2){let r=this._editorInputs.get(e.resource.path)?.group;r&&this._editorGroupsService.activateGroup(r)}let o=this._terminalInstanceService.createInstance(t,2),n=this.resolveResource(o);return n&&await this._editorService.openEditor({resource:A.revive(n),description:o.description,options:{pinned:!0,forceReload:!0}},En),o}reviveInput(e){let t={...e,findRevivedId:!0},o=this._terminalInstanceService.createInstance({attachPersistentProcess:t},2),n=this._instantiationService.createInstance(Zf,o.resource,o);return this._registerInstance(o.resource.path,n,o),n}detachInstance(e){let t=e.resource.path,o=this._editorInputs.get(t);o?.detachInstance(),this._removeInstance(e),this._isShuttingDown||o?.dispose()}async revealActiveEditor(e){let t=this.activeInstance;t&&await this._revealEditor(t,e)}async _revealEditor(e,t){if(this._activeOpenEditorRequest?.instanceId===e.instanceId){await this._activeOpenEditorRequest.promise;return}let o=this._editorInputs.get(e.resource.path);o&&await this._editorService.openEditor(o,{pinned:!0,forceReload:!0,preserveFocus:t,activation:3})}};h2e=I([m(0,ie),m(1,kt),m(2,uh),m(3,F),m(4,to),m(5,X)],h2e);var VKi=class extends k{constructor(e,t){super();this._container=e;this.orientation=t;this._splitViewDisposables=this._register(new O);this._children=[];this._terminalToPane=new Map;this._onDidChange=U.None;this._width=this._container.offsetWidth,this._height=this._container.offsetHeight,this._createSplitView(),this._splitView.layout(this.orientation===1?this._width:this._height)}get onDidChange(){return this._onDidChange}_createSplitView(){this._splitViewDisposables.clear(),this._splitView=new Gp(this._container,{orientation:this.orientation}),this._splitViewDisposables.add(this._splitView),this._splitViewDisposables.add(this._splitView.onDidSashReset(()=>this._splitView.distributeViewSizes()))}split(e,t){this._addChild(e,t)}resizePane(e,t,o){if(this._children.length<=1)return;let n=[];for(let l=0;l<this._splitView.length;l++)n.push(this._splitView.getViewSize(l));let r=e!==this._children.length-1,s=r?e+1:e-1;(r&&t===0||!r&&t===1||r&&t===2||!r&&t===3)&&(o*=-1),n[e]+o<80?o=80-n[e]:n[s]-o<80&&(o=n[s]-80),n[e]+=o,n[s]-=o;for(let l=0;l<this._splitView.length-1;l++)this._splitView.resizeView(l,n[l])}resizePanes(e){if(this._children.length<=1)return;e[e.length-1]+=1-e.reduce((o,n)=>o+n,0);let t=0;for(let o=0;o<this._splitView.length;o++)t+=this._splitView.getViewSize(o);for(let o=0;o<this._splitView.length;o++)this._splitView.resizeView(o,t*e[o])}getPaneSize(e){let t=this._terminalToPane.get(e);if(!t)return 0;let o=this._children.indexOf(t);return this._splitView.getViewSize(o)}_addChild(e,t){let o=new BKi(e,this.orientation===1?this._height:this._width);o.orientation=this.orientation,on(t)?this._children.splice(t,0,o):this._children.push(o),this._terminalToPane.set(e,this._children[this._children.indexOf(o)]),this._withDisabledLayout(()=>this._splitView.addView(o,Ac.Distribute,t)),this.layout(this._width,this._height),this._onDidChange=U.any(...this._children.map(n=>n.onDidChange))}remove(e){let t=null;for(let o=0;o<this._children.length;o++)this._children[o].instance===e&&(t=o);t!==null&&(this._children.splice(t,1),this._terminalToPane.delete(e),this._splitView.removeView(t,Ac.Distribute),e.detachFromElement())}layout(e,t){this._width=e,this._height=t,this.orientation===1?(this._children.forEach(o=>o.orthogonalLayout(t)),this._splitView.layout(e)):(this._children.forEach(o=>o.orthogonalLayout(e)),this._splitView.layout(t))}setOrientation(e){if(this.orientation!==e){for(this.orientation=e;this._container.children.length>0;)this._container.children[0].remove();this._createSplitView(),this._withDisabledLayout(()=>{this._children.forEach(t=>{t.orientation=e,this._splitView.addView(t,1)})})}}_withDisabledLayout(e){this._children.forEach(t=>t.instance.disableLayout=!0),e(),this._children.forEach(t=>t.instance.disableLayout=!1)}},BKi=class{constructor(i,e){this.instance=i;this.orthogonalSize=e;this.minimumSize=80;this.maximumSize=Number.MAX_VALUE;this._onDidChange=U.None;this.element=document.createElement("div"),this.element.className="terminal-split-pane",this.instance.attachToElement(this.element)}get onDidChange(){return this._onDidChange}layout(i){!i||!this.orthogonalSize||(this.orientation===0?this.instance.layout({width:this.orthogonalSize,height:i}):this.instance.layout({width:i,height:this.orthogonalSize}))}orthogonalLayout(i){this.orthogonalSize=i}},g2e=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._container=e;this._terminalConfigurationService=o;this._terminalInstanceService=n;this._paneCompositePartService=r;this._layoutService=s;this._viewDescriptorService=l;this._instantiationService=c;this._terminalInstances=[];this._panelPosition=2;this._terminalLocation=1;this._instanceDisposables=new Map;this._activeInstanceIndex=-1;this._hadFocusOnExit=!1;this._visible=!1;this._onDidDisposeInstance=this._register(new T);this.onDidDisposeInstance=this._onDidDisposeInstance.event;this._onDidFocusInstance=this._register(new T);this.onDidFocusInstance=this._onDidFocusInstance.event;this._onDidChangeInstanceCapability=this._register(new T);this.onDidChangeInstanceCapability=this._onDidChangeInstanceCapability.event;this._onDisposed=this._register(new T);this.onDisposed=this._onDisposed.event;this._onInstancesChanged=this._register(new T);this.onInstancesChanged=this._onInstancesChanged.event;this._onDidChangeActiveInstance=this._register(new T);this.onDidChangeActiveInstance=this._onDidChangeActiveInstance.event;this._onPanelOrientationChanged=this._register(new T);this.onPanelOrientationChanged=this._onPanelOrientationChanged.event;t&&this.addInstance(t),this._container&&this.attachToElement(this._container),this._onPanelOrientationChanged.fire(this._terminalLocation===1&&eg(this._panelPosition)?1:0),this._register(ee(()=>{this._container&&this._groupElement&&(this._groupElement.remove(),this._groupElement=void 0)}))}get terminalInstances(){return this._terminalInstances}get hadFocusOnExit(){return this._hadFocusOnExit}addInstance(e,t){let o,n=t?this._terminalInstances.findIndex(r=>r.instanceId===t):this._activeInstanceIndex;yo(e,{instanceId:!0})?o=e:o=this._terminalInstanceService.createInstance(e,1),this._terminalInstances.length===0?(this._terminalInstances.push(o),this._activeInstanceIndex=0):this._terminalInstances.splice(n+1,0,o),this._initInstanceListeners(o),this._splitPaneContainer&&this._splitPaneContainer.split(o,n+1),this._onInstancesChanged.fire()}dispose(){this._terminalInstances=[],this._onInstancesChanged.fire(),this._splitPaneContainer?.dispose(),super.dispose()}get activeInstance(){if(this._terminalInstances.length!==0)return this._terminalInstances[this._activeInstanceIndex]}getLayoutInfo(e){let t=this.terminalInstances.filter(n=>on(n.persistentProcessId)&&n.shouldPersist),o=t.map(n=>this._splitPaneContainer?.getPaneSize(n)||0).reduce((n,r)=>n+=r,0);return{isActive:e,activePersistentProcessId:this.activeInstance?this.activeInstance.persistentProcessId:void 0,terminals:t.map(n=>({relativeSize:o>0?this._splitPaneContainer.getPaneSize(n)/o:0,terminal:n.persistentProcessId||0}))}}_initInstanceListeners(e){this._instanceDisposables.set(e.instanceId,[e.onDisposed(t=>{this._onDidDisposeInstance.fire(t),this._handleOnDidDisposeInstance(t)}),e.onDidFocus(t=>{this._setActiveInstance(t),this._onDidFocusInstance.fire(t)}),e.capabilities.onDidChangeCapabilities(()=>this._onDidChangeInstanceCapability.fire(e))])}_handleOnDidDisposeInstance(e){this._removeInstance(e)}removeInstance(e){this._removeInstance(e)}_removeInstance(e){let t=this._terminalInstances.indexOf(e);if(t===-1)return;let o=e===this.activeInstance;if(this._terminalInstances.splice(t,1),o&&this._terminalInstances.length>0){let r=t<this._terminalInstances.length?t:this._terminalInstances.length-1;this.setActiveInstanceByIndex(r),this.activeInstance?.focus(!0)}else t<this._activeInstanceIndex&&this._activeInstanceIndex--;this._splitPaneContainer?.remove(e),this._terminalInstances.length===0?(this._hadFocusOnExit=e.hadFocusOnExit,this._onDisposed.fire(this),this.dispose()):this._onInstancesChanged.fire();let n=this._instanceDisposables.get(e.instanceId);n&&(je(n),this._instanceDisposables.delete(e.instanceId))}moveInstance(e,t,o){if(e=Ec(e),e.some(s=>!this.terminalInstances.includes(s)))return;let r=o==="before"?t:t+1;this._terminalInstances.splice(r,0,...e);for(let s of e){let l=o==="after"?this._terminalInstances.indexOf(s):this._terminalInstances.lastIndexOf(s);this._terminalInstances.splice(l,1)}if(this._splitPaneContainer)for(let s=0;s<e.length;s++){let l=e[s];this._splitPaneContainer.remove(l),this._splitPaneContainer.split(l,t+(o==="before"?s:0))}this._onInstancesChanged.fire()}_setActiveInstance(e){this.setActiveInstanceByIndex(this._getIndexFromId(e.instanceId))}_getIndexFromId(e){let t=-1;if(this.terminalInstances.forEach((o,n)=>{o.instanceId===e&&(t=n)}),t===-1)throw new Error(`Terminal with ID ${e} does not exist (has it already been disposed?)`);return t}setActiveInstanceByIndex(e,t){if(e<0||e>=this._terminalInstances.length)return;let o=this.activeInstance;this._activeInstanceIndex=e,(o!==this.activeInstance||t)&&(this._onInstancesChanged.fire(),this._onDidChangeActiveInstance.fire(this.activeInstance))}attachToElement(e){if(this._container=e,this._groupElement||(this._groupElement=document.createElement("div"),this._groupElement.classList.add("terminal-group")),this._container.appendChild(this._groupElement),!this._splitPaneContainer){this._panelPosition=this._layoutService.getPanelPosition(),this._terminalLocation=this._viewDescriptorService.getViewLocationById(Fc);let t=this._terminalLocation===1&&eg(this._panelPosition)?1:0;this._splitPaneContainer=this._instantiationService.createInstance(VKi,this._groupElement,t),this.terminalInstances.forEach(o=>this._splitPaneContainer.split(o,this._activeInstanceIndex+1))}}get title(){if(this._terminalInstances.length===0)return"";let e=this.terminalInstances[0].title+this._getBellTitle(this.terminalInstances[0]);this.terminalInstances[0].description&&(e+=` (${this.terminalInstances[0].description})`);for(let t=1;t<this.terminalInstances.length;t++){let o=this.terminalInstances[t];o.title&&(e+=`, ${o.title+this._getBellTitle(o)}`,o.description&&(e+=` (${o.description})`))}return e}_getBellTitle(e){return this._terminalConfigurationService.config.enableBell&&e.statusList.statuses.some(t=>t.id==="bell")?"*":""}setVisible(e){this._visible=e,this._groupElement&&(this._groupElement.style.display=e?"":"none"),this.terminalInstances.forEach(t=>t.setVisible(e))}split(e){let t=this._terminalInstanceService.createInstance(e,1);return this.addInstance(t,e.parentTerminalId),this._setActiveInstance(t),t}addDisposable(e){this._register(e)}layout(e,t){if(this._splitPaneContainer){let o=this._layoutService.getPanelPosition(),n=this._viewDescriptorService.getViewLocationById(Fc);if(o!==this._panelPosition||n!==this._terminalLocation){let s=n===1&&eg(o)?1:0;this._splitPaneContainer.setOrientation(s),this._panelPosition=o,this._terminalLocation=n,this._onPanelOrientationChanged.fire(this._splitPaneContainer.orientation)}this._splitPaneContainer.layout(e,t),this._initialRelativeSizes&&this._visible&&(this.resizePanes(this._initialRelativeSizes),this._initialRelativeSizes=void 0)}}focusPreviousPane(){let e=this._activeInstanceIndex===0?this._terminalInstances.length-1:this._activeInstanceIndex-1;this.setActiveInstanceByIndex(e)}focusNextPane(){let e=this._activeInstanceIndex===this._terminalInstances.length-1?0:this._activeInstanceIndex+1;this.setActiveInstanceByIndex(e)}_getPosition(){switch(this._terminalLocation){case 1:return this._panelPosition;case 0:return this._layoutService.getSideBarPosition();case 2:return this._layoutService.getSideBarPosition()===0?1:0;default:return this._panelPosition}}_getOrientation(){return eg(this._getPosition())?1:0}resizePane(e){if(!this._splitPaneContainer)return;let t=e===0||e===1,o=this._getOrientation(),n=t&&o===0||!t&&o===1,r=this._terminalConfigurationService.getFont(Me(this._groupElement)),s=t?r.charWidth:r.charHeight;if(s){let l=s*4;if(n){let c=this._getPosition();(c===0&&e===0||c===1&&e===1||c===2&&e===3||c===3&&e===2)&&(l*=-1),this._layoutService.resizePart(this._paneCompositePartService.getPartId(this._terminalLocation),l,l)}else this._splitPaneContainer.resizePane(this._activeInstanceIndex,e,l)}}resizePanes(e){if(!this._splitPaneContainer){this._initialRelativeSizes=e;return}this._splitPaneContainer.resizePanes(e)}};g2e=I([m(2,mp),m(3,uh),m(4,Es),m(5,wi),m(6,ji),m(7,F)],g2e);var f2e=class extends k{constructor(e,t,o,n,r){super();this._contextKeyService=e;this._instantiationService=t;this._viewsService=o;this._viewDescriptorService=n;this._quickInputService=r;this.groups=[];this.activeGroupIndex=-1;this.lastAccessedMenu="inline-tab";this._isQuickInputOpened=!1;this._onDidChangeActiveGroup=this._register(new T);this.onDidChangeActiveGroup=this._onDidChangeActiveGroup.event;this._onDidDisposeGroup=this._register(new T);this.onDidDisposeGroup=this._onDidDisposeGroup.event;this._onDidChangeGroups=this._register(new T);this.onDidChangeGroups=this._onDidChangeGroups.event;this._onDidShow=this._register(new T);this.onDidShow=this._onDidShow.event;this._onDidDisposeInstance=this._register(new T);this.onDidDisposeInstance=this._onDidDisposeInstance.event;this._onDidFocusInstance=this._register(new T);this.onDidFocusInstance=this._onDidFocusInstance.event;this._onDidChangeActiveInstance=this._register(new T);this.onDidChangeActiveInstance=this._onDidChangeActiveInstance.event;this._onDidChangeInstances=this._register(new T);this.onDidChangeInstances=this._onDidChangeInstances.event;this._onDidChangeInstanceCapability=this._register(new T);this.onDidChangeInstanceCapability=this._onDidChangeInstanceCapability.event;this._onDidChangePanelOrientation=this._register(new T);this.onDidChangePanelOrientation=this._onDidChangePanelOrientation.event;this._getValidTerminalGroups=e=>new Set(e.map(t=>this.getGroupForInstance(t)).filter(t=>t!==void 0));let s=pt.groupCount.bindTo(this._contextKeyService);this._register(U.runAndSubscribe(this.onDidChangeGroups,()=>s.set(this.groups.length)));let l=pt.splitTerminalActive.bindTo(this._contextKeyService);this._register(U.runAndSubscribe(this.onDidFocusInstance,()=>{let c=this.activeInstance;l.set(c?this.instanceIsSplit(c):!1)})),this._register(this.onDidDisposeGroup(c=>this._removeGroup(c))),this._register(U.any(this.onDidChangeActiveGroup,this.onDidChangeInstances)(()=>this.updateVisibility())),this._register(this._quickInputService.onShow(()=>this._isQuickInputOpened=!0)),this._register(this._quickInputService.onHide(()=>this._isQuickInputOpened=!1))}get instances(){return this.groups.reduce((e,t)=>e.concat(t.terminalInstances),[])}hidePanel(){let e=this._viewDescriptorService.getViewContainerByViewId(Fc);e&&this._viewDescriptorService.getViewContainerModel(e).visibleViewDescriptors.length===1&&(this._viewsService.closeView(Fc),pt.tabsMouse.bindTo(this._contextKeyService).set(!1))}get activeGroup(){if(!(this.activeGroupIndex<0||this.activeGroupIndex>=this.groups.length))return this.groups[this.activeGroupIndex]}set activeGroup(e){if(e===void 0)return;let t=this.groups.findIndex(o=>o===e);this.setActiveGroupByIndex(t)}get activeInstance(){return this.activeGroup?.activeInstance}setActiveInstance(e){this.setActiveInstanceByIndex(this._getIndexFromId(e.instanceId))}_getIndexFromId(e){let t=this.instances.findIndex(o=>o.instanceId===e);if(t===-1)throw new Error(`Terminal with ID ${e} does not exist (has it already been disposed?)`);return t}setContainer(e){this._container=e,this.groups.forEach(t=>t.attachToElement(e))}async focusTabs(){if(this.instances.length===0)return;await this.showPanel(!0),this._viewsService.getActiveViewWithId(Fc)?.terminalTabbedView?.focusTabs()}async focusHover(){if(this.instances.length===0)return;this._viewsService.getActiveViewWithId(Fc)?.terminalTabbedView?.focusHover()}async focusInstance(e){this.instances.includes(e)&&this.setActiveInstance(e),await this.showPanel(!0)}async focusActiveInstance(){return this.showPanel(!0)}createGroup(e){let t=this._instantiationService.createInstance(g2e,this._container,e);return this.groups.push(t),t.addDisposable(U.forward(t.onPanelOrientationChanged,this._onDidChangePanelOrientation)),t.addDisposable(U.forward(t.onDidDisposeInstance,this._onDidDisposeInstance)),t.addDisposable(U.forward(t.onDidFocusInstance,this._onDidFocusInstance)),t.addDisposable(U.forward(t.onDidChangeInstanceCapability,this._onDidChangeInstanceCapability)),t.addDisposable(U.forward(t.onInstancesChanged,this._onDidChangeInstances)),t.addDisposable(U.forward(t.onDisposed,this._onDidDisposeGroup)),t.addDisposable(t.onDidChangeActiveInstance(o=>{t===this.activeGroup&&this._onDidChangeActiveInstance.fire(o)})),t.terminalInstances.length>0&&this._onDidChangeInstances.fire(),this.instances.length===1&&this.setActiveInstanceByIndex(0),this._onDidChangeGroups.fire(),t}async showPanel(e){let t=this._viewsService.getActiveViewWithId(Fc)??await this._viewsService.openView(Fc,e);if(t?.setExpanded(!0),e){await Li(0);let o=this.activeInstance;o&&(t&&!t.isVisible()&&await this._viewsService.openView(Fc,e),await o.focusWhenReady(!0))}this._onDidShow.fire()}getInstanceFromResource(e){return cze(this.instances,e)}_removeGroup(e){let t=this.activeGroup,o=e===t,n=this.groups.indexOf(e);if(n!==-1&&(this.groups.splice(n,1),this._onDidChangeGroups.fire()),o){if(this.groups.length>0&&!this._isQuickInputOpened){let r=n<this.groups.length?n:this.groups.length-1;this.setActiveGroupByIndex(r,!0),e.hadFocusOnExit&&this.activeInstance?.focus(!0)}}else this.activeGroupIndex>n&&this.setActiveGroupByIndex(this.activeGroupIndex-1);this.activeGroupIndex>=this.groups.length&&this.setActiveGroupByIndex(this.groups.length-1),this._onDidChangeInstances.fire(),this._onDidChangeGroups.fire(),o&&(this._onDidChangeActiveGroup.fire(this.activeGroup),this._onDidChangeActiveInstance.fire(this.activeInstance))}setActiveGroupByIndex(e,t){if(e===-1&&this.groups.length===0){this.activeGroupIndex!==-1&&(this.activeGroupIndex=-1,this._onDidChangeActiveGroup.fire(this.activeGroup),this._onDidChangeActiveInstance.fire(this.activeInstance));return}if(e<0||e>=this.groups.length)return;let o=this.activeGroup;this.activeGroupIndex=e,(t||o!==this.activeGroup)&&(this._onDidChangeActiveGroup.fire(this.activeGroup),this._onDidChangeActiveInstance.fire(this.activeInstance))}_getInstanceLocation(e){let t=0;for(;e>=0&&t<this.groups.length;){let o=this.groups[t],n=o.terminalInstances.length;if(e<n)return{group:o,groupIndex:t,instance:o.terminalInstances[e],instanceIndex:e};e-=n,t++}}setActiveInstanceByIndex(e){let t=this.activeInstance,o=this._getInstanceLocation(e),n=o?.group.terminalInstances[o.instanceIndex];if(!o||t===n)return;let r=o.instanceIndex;this.activeGroupIndex=o.groupIndex,this._onDidChangeActiveGroup.fire(this.activeGroup),o.group.setActiveInstanceByIndex(r,!0)}setActiveGroupToNext(){if(this.groups.length<=1)return;let e=this.activeGroupIndex+1;e>=this.groups.length&&(e=0),this.setActiveGroupByIndex(e)}setActiveGroupToPrevious(){if(this.groups.length<=1)return;let e=this.activeGroupIndex-1;e<0&&(e=this.groups.length-1),this.setActiveGroupByIndex(e)}moveGroup(e,t){e=Ec(e);let o=this._getValidTerminalGroups(e),n=this.getGroupForInstance(t);if(!n||o.size===0)return;if(o.size===1&&o.has(n)){let p=n.terminalInstances.indexOf(t),h=e.sort((v,b)=>n.terminalInstances.indexOf(v)-n.terminalInstances.indexOf(b)),f=n.terminalInstances.indexOf(h[0])<p?"after":"before";n.moveInstance(h,p,f),this._onDidChangeInstances.fire();return}let r=this.groups.indexOf(n),s=Array.from(o).sort((p,h)=>this.groups.indexOf(p)-this.groups.indexOf(h)),c=this.groups.indexOf(s[0])<r?"after":"before",u=c==="after"?r+1:r;this.groups.splice(u,0,...s);for(let p of s){let h=c==="after"?this.groups.indexOf(p):this.groups.lastIndexOf(p);this.groups.splice(h,1)}this._onDidChangeInstances.fire()}moveGroupToEnd(e){e=Ec(e);let t=this._getValidTerminalGroups(e);if(t.size===0)return;let o=this.groups.length-1,n=Array.from(t).sort((r,s)=>this.groups.indexOf(r)-this.groups.indexOf(s));this.groups.splice(o+1,0,...n);for(let r of n){let s=this.groups.indexOf(r);this.groups.splice(s,1)}this._onDidChangeInstances.fire()}moveInstance(e,t,o){let n=this.getGroupForInstance(e),r=this.getGroupForInstance(t);if(!n||!r)return;n!==r&&(n.removeInstance(e),r.addInstance(e));let s=r.terminalInstances.indexOf(t)+(o==="after"?1:0);r.moveInstance(e,s,o)}unsplitInstance(e){let t=this.getGroupForInstance(e);!t||t.terminalInstances.length<2||(t.removeInstance(e),this.createGroup(e))}joinInstances(e){let t=this.getGroupForInstance(e[0]);if(t){let s=!0;for(let l=1;l<t.terminalInstances.length;l++)if(t.terminalInstances.includes(e[l])){s=!1;break}if(!s&&t.terminalInstances.length===e.length)return}let o,n;for(let s of e){let l=this.getGroupForInstance(s);if(l?.terminalInstances.length===1){o=s,n=l;break}}n||(n=this.createGroup());let r=this.activeGroup===n;for(let s of e){if(s===o)continue;let l=this.getGroupForInstance(s);l&&(l.removeInstance(s),n.addInstance(s))}this.setActiveInstance(e[0]),this._onDidChangeInstances.fire(),r||this._onDidChangeActiveGroup.fire(this.activeGroup)}instanceIsSplit(e){let t=this.getGroupForInstance(e);return t?t.terminalInstances.length>1:!1}getGroupForInstance(e){return this.groups.find(t=>t.terminalInstances.includes(e))}getGroupLabels(){return this.groups.filter(e=>e.terminalInstances.length>0).map((e,t)=>`${t+1}: ${e.title?e.title:""}`)}updateVisibility(){let e=this._viewsService.isViewVisible(Fc);this.groups.forEach((t,o)=>t.setVisible(e&&o===this.activeGroupIndex))}};f2e=I([m(0,X),m(1,F),m(2,Gt),m(3,ji),m(4,$e)],f2e);var S7t=class{constructor(i){this._process=i;this.type=1;this._cwd="";this._onDidChangeCwd=new T;this.onDidChangeCwd=this._onDidChangeCwd.event}async getCwd(){if(!this._process)return Promise.resolve("");let i=await this._process.getCwd();return i!==this._cwd&&this._onDidChangeCwd.fire(i),this._cwd=i,this._cwd}};var I7t=class{constructor(i,e){this._totalDataLength=0;this._entries=[{cols:i,rows:e,data:[]}]}handleResize(i,e){if(this._entries.length>0&&this._entries[this._entries.length-1].data.length===0&&this._entries.pop(),this._entries.length>0){let t=this._entries[this._entries.length-1];if(t.cols===i&&t.rows===e)return;if(t.cols===0&&t.rows===0){t.cols=i,t.rows=e;return}}this._entries.push({cols:i,rows:e,data:[]})}handleData(i){for(this._entries[this._entries.length-1].data.push(i),this._totalDataLength+=i.length;this._totalDataLength>10485760;){let t=this._entries[0],o=this._totalDataLength-10485760;o>=t.data[0].length?(this._totalDataLength-=t.data[0].length,t.data.shift(),t.data.length===0&&this._entries.shift()):(t.data[0]=t.data[0].substr(o),this._totalDataLength-=o)}}generateReplayEventSync(){return this._entries.forEach(i=>{i.data.length>0&&(i.data=[i.data.join("")])}),{events:this._entries.map(i=>({cols:i.cols,rows:i.rows,data:i.data[0]??""})),commands:{isWindowsPty:!1,hasRichCommandDetection:!1,commands:[],promptInputModel:void 0}}}async generateReplayEvent(){return this.generateReplayEventSync()}};var oIe=class{constructor(i,e,t,o,n){this._diff=i;this._terminalId=e;this._collection=t;this._terminalService=o;this._extensionService=n;this.requiresAction=!0}_getInfo(i){let e=new Set;y7t(e,this._diff.added.values()),y7t(e,this._diff.removed.values()),y7t(e,this._diff.changed.values());let t=d(15923,null);return t+=aFo(this._collection,i,this._extensionService,e),t}_getActions(){return[{label:d(15924,null),run:()=>this._terminalService.getInstanceFromId(this._terminalId)?.relaunch(),commandId:"workbench.action.terminal.relaunch"}]}getStatus(i){return{id:"relaunch-needed",severity:wt.Warning,icon:L.warning,tooltip:this._getInfo(i),hoverActions:this._getActions()}}};oIe=I([m(3,an),m(4,lt)],oIe);var Gse=class{constructor(i,e,t){this._collection=i;this._commandService=e;this._extensionService=t;this.requiresAction=!1}_getInfo(i){let e=new Set;y7t(e,this._collection.getVariableMap(i).values());let t=d(15922,null);return t+=aFo(this._collection,i,this._extensionService,e),t}_getActions(i){return[{label:d(15926,null),run:()=>this._commandService.executeCommand("workbench.action.terminal.showEnvironmentContributions",i),commandId:"workbench.action.terminal.showEnvironmentContributions"}]}getStatus(i){return{id:"env-var-info-changes-active",severity:wt.Info,tooltip:void 0,detailedTooltip:this._getInfo(i),hoverActions:this._getActions(i)}}};Gse=I([m(1,fe),m(2,lt)],Gse);function aFo(a,i,e,t){let o=[`
`],n=a.getDescriptionMap(void 0),r=a.getDescriptionMap(i);for(let s of t){let l=n.get(s);l&&(o.push(`
- \`${HKi(s,e)}\``),o.push(`: ${l}`));let c=r.get(s);if(c){let u=l?` (${d(15925,null)})`:"";o.push(`
- \`${HKi(s,e)}${u}\``),o.push(`: ${c}`)}!l&&!c&&o.push(`
- \`${HKi(s,e)}\``)}return o.join("")}function y7t(a,i){for(let e of i)for(let t of e)a.add(t.extensionIdentifier)}function HKi(a,i){return i.extensions.find(e=>e.id===a)?.displayName||a}var hEn=new Map([[2,"APPEND"],[3,"PREPEND"],[1,"REPLACE"]]),gEn=/^VSCODE_PYTHON_(PWSH|ZSH|BASH|FISH)_ACTIVATE/,fEn="ms-python.vscode-python-envs",v2e=class{constructor(i){this.collections=i;this.map=new Map;this.descriptionMap=new Map;i.forEach((e,t)=>{this.populateDescriptionMap(e,t);let o=e.map.entries(),n=o.next();for(;!n.done;){let r=n.value[1],s=n.value[0];if(this.blockPythonActivationVar(s,t)){n=o.next();continue}let l=this.map.get(s);if(l||(l=[],this.map.set(s,l)),l.length>0&&l[0].type===1){n=o.next();continue}let c={extensionIdentifier:t,value:r.value,type:r.type,scope:r.scope,variable:r.variable,options:r.options};c.scope||delete c.scope,l.unshift(c),n=o.next()}})}async applyToProcessEnvironment(i,e,t){let o;ii&&(o={},Object.keys(i).forEach(n=>o[n.toLowerCase()]=n));for(let[n,r]of this.getVariableMap(e)){let s=ii&&o[n.toLowerCase()]||n;for(let l of r){let c=t?await t(l.value):l.value;if(!this.blockPythonActivationVar(l.variable,l.extensionIdentifier)){if(l.options?.applyAtProcessCreation??!0)switch(l.type){case 2:i[s]=(i[s]||"")+c;break;case 3:i[s]=c+(i[s]||"");break;case 1:i[s]=c;break}if(l.options?.applyAtShellIntegration??!1){let u=`VSCODE_ENV_${hEn.get(l.type)}`;i[u]=(i[u]?i[u]+":":"")+n+"="+this._encodeColons(c)}}}}}_encodeColons(i){return i.replaceAll(":","\\x3a")}blockPythonActivationVar(i,e){return!!(gEn.test(i)&&fEn!==e)}diff(i,e){let t=new Map,o=new Map,n=new Map;if(i.getVariableMap(e).forEach((r,s)=>{let l=this.getVariableMap(e).get(s),c=cFo(r,l);c&&t.set(s,c)}),this.getVariableMap(e).forEach((r,s)=>{let l=i.getVariableMap(e).get(s),c=cFo(r,l);c&&n.set(s,c)}),this.getVariableMap(e).forEach((r,s)=>{let l=i.getVariableMap(e).get(s),c=vEn(r,l);c&&o.set(s,c)}),!(t.size===0&&o.size===0&&n.size===0))return{added:t,changed:o,removed:n}}getVariableMap(i){let e=new Map;for(let t of this.map.values()){let o=t.filter(n=>lFo(n,i));o.length>0&&e.set(o[0].variable,o)}return e}getDescriptionMap(i){let e=new Map;for(let t of this.descriptionMap.values()){let o=t.filter(n=>lFo(n,i,!0));for(let n of o)e.set(n.extensionIdentifier,n.description)}return e}populateDescriptionMap(i,e){if(!i.descriptionMap)return;let t=i.descriptionMap.entries(),o=t.next();for(;!o.done;){let n=o.value[1],r=o.value[0],s=this.descriptionMap.get(r);s||(s=[],this.descriptionMap.set(r,s));let l={extensionIdentifier:e,scope:n.scope,description:n.description};l.scope||delete l.scope,s.push(l),o=t.next()}}};function lFo(a,i,e=!1){return a.scope?!!(a.scope.workspaceFolder&&i?.workspaceFolder&&a.scope.workspaceFolder.index===i.workspaceFolder.index):e?i===a.scope:!0}function cFo(a,i){if(!i)return a;let e=new Set;i.forEach(o=>e.add(o.extensionIdentifier));let t=[];return a.forEach(o=>{e.has(o.extensionIdentifier)||t.push(o)}),t.length===0?void 0:t}function vEn(a,i){if(!i)return;let e=new Map;i.forEach(o=>e.set(o.extensionIdentifier,o));let t=[];return a.forEach(o=>{let n=e.get(o.extensionIdentifier);n&&(o.type!==n.type||o.value!==n.value||o.scope?.workspaceFolder?.index!==n.scope?.workspaceFolder?.index)&&t.push(n)}),t.length===0?void 0:t}var b2e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N){super();this._instanceId=e;this._historyService=r;this._instantiationService=s;this._logService=l;this._workspaceContextService=c;this._configurationResolverService=u;this._workbenchEnvironmentService=p;this._productService=h;this._remoteAgentService=g;this._pathService=f;this._environmentVariableService=v;this._terminalConfigurationService=b;this._terminalProfileResolverService=S;this._configurationService=y;this._terminalInstanceService=w;this._telemetryService=x;this._notificationService=E;this._accessibilityService=M;this._terminalService=N;this.processState=1;this.capabilities=this._register(new fk);this.processReadyTimestamp=0;this._isDisposed=!1;this._process=null;this._processType=0;this._preLaunchInputQueue=[];this._hasWrittenData=!1;this._hasChildProcesses=!1;this._ptyListenersAttached=!1;this._isDisconnected=!1;this._dimensions={cols:0,rows:0};this._onPtyDisconnect=this._register(new T);this.onPtyDisconnect=this._onPtyDisconnect.event;this._onPtyReconnect=this._register(new T);this.onPtyReconnect=this._onPtyReconnect.event;this._onProcessReady=this._register(new T);this.onProcessReady=this._onProcessReady.event;this._onProcessStateChange=this._register(new T);this.onProcessStateChange=this._onProcessStateChange.event;this._onBeforeProcessData=this._register(new T);this.onBeforeProcessData=this._onBeforeProcessData.event;this._onProcessData=this._register(new T);this.onProcessData=this._onProcessData.event;this._onProcessReplayComplete=this._register(new T);this.onProcessReplayComplete=this._onProcessReplayComplete.event;this._onDidChangeProperty=this._register(new T);this.onDidChangeProperty=this._onDidChangeProperty.event;this._onEnvironmentVariableInfoChange=this._register(new T);this.onEnvironmentVariableInfoChanged=this._onEnvironmentVariableInfoChange.event;this._onProcessExit=this._register(new T);this.onProcessExit=this._onProcessExit.event;this._onRestoreCommands=this._register(new T);this.onRestoreCommands=this._onRestoreCommands.event;this._cwdWorkspaceFolder=g6(t,this._workspaceContextService,this._historyService),this.ptyProcessReady=this._createPtyProcessReadyPromise(),this._ackDataBufferer=new UKi(V=>this._process?.acknowledgeDataEvent(V)),this._dataFilter=this._register(this._instantiationService.createInstance(vpt)),this._register(this._dataFilter.onProcessData(V=>{let K={data:We(V)?V:V.data};this._onBeforeProcessData.fire(K),K.data&&K.data.length>0&&(We(V)||(V.data=K.data),this._onProcessData.fire(We(V)?{data:K.data,trackCommit:!1}:V))})),t&&typeof t=="object"?this.remoteAuthority=N4(t):this.remoteAuthority=this._workbenchEnvironmentService.remoteAuthority,o&&(this._extEnvironmentVariableCollection=new v2e(o),this._register(this._environmentVariableService.onDidChangeCollections(V=>this._onEnvironmentVariableCollectionChange(V))),this.environmentVariableInfo=this._instantiationService.createInstance(Gse,this._extEnvironmentVariableCollection),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo)),this.shellIntegrationNonce=n??ht()}get persistentProcessId(){return this._process?.id}get shouldPersist(){return!!this.reconnectionProperties||(this._process?this._process.shouldPersist:!1)}get hasWrittenData(){return this._hasWrittenData}get hasChildProcesses(){return this._hasChildProcesses}get reconnectionProperties(){return this._shellLaunchConfig?.attachPersistentProcess?.reconnectionProperties||this._shellLaunchConfig?.reconnectionProperties||void 0}get extEnvironmentVariableCollection(){return this._extEnvironmentVariableCollection}get processTraits(){return this._processTraits}async freePortKillProcess(e){try{this._process?.freePortKillProcess&&await this._process?.freePortKillProcess(e)}catch(t){this._notificationService.notify({message:d(16064,null,e,t),severity:wt.Warning})}}dispose(e=!1){this._isDisposed=!0,this._process&&(this._setProcessState(5),this._process.shutdown(e),this._process=null),this._processListeners&&(je(this._processListeners),this._processListeners=void 0),super.dispose()}_createPtyProcessReadyPromise(){return new Promise(e=>{let t=U.once(this.onProcessReady)(()=>{this._logService.debug(`Terminal process ready (shellProcessId: ${this.shellProcessId})`),this._store.delete(t),e(void 0)});this._store.add(t)})}async detachFromProcess(e){await this._process?.detach?.(e),this._process=null}async createProcess(e,t,o,n=!0){this._shellLaunchConfig=e,this._dimensions.cols=t,this._dimensions.rows=o;let r;if(e.customPtyImplementation)this._processType=1,r=e.customPtyImplementation(this._instanceId,t,o);else{let l=await this._terminalInstanceService.getBackend(this.remoteAuthority);if(!l)throw new Error(`No terminal backend registered for remote authority '${this.remoteAuthority}'`);this.backend=l;let c={...await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority)};S0e(c,await l.getShellEnvironment());let u=Fqt(this._cwdWorkspaceFolder,c,this._configurationResolverService);if(this.userHome=this._pathService.resolvedUserHome?.fsPath,this.os=Ao,this.remoteAuthority){let p=await this._pathService.userHome();this.userHome=p.path;let h=await this._remoteAgentService.getEnvironment();if(!h)throw new Error(`Failed to get remote environment for remote authority "${this.remoteAuthority}"`);this.userHome=h.userHome.path,this.os=h.os;let g=await this._resolveEnvironment(l,u,e),f=(this._configurationService.getValue("task.reconnection")&&e.reconnectionProperties||!e.isFeatureTerminal)&&this._terminalConfigurationService.config.enablePersistentSessions&&!e.isTransient;if(e.attachPersistentProcess){let v=await l.attachToProcess(e.attachPersistentProcess.id);v?r=v:(this._logService.warn("Attach to process failed for terminal",e.attachPersistentProcess),e.attachPersistentProcess=void 0)}if(!r){await this._terminalProfileResolverService.resolveShellLaunchConfig(e,{remoteAuthority:this.remoteAuthority,os:this.os});let v={shellIntegration:{enabled:this._configurationService.getValue("terminal.integrated.shellIntegration.enabled"),suggestEnabled:this._configurationService.getValue(Yp.SuggestEnabled),nonce:this.shellIntegrationNonce},windowsUseConptyDll:this._terminalConfigurationService.config.windowsUseConptyDll??!1,environmentVariableCollections:this._extEnvironmentVariableCollection?.collections?Lwi(this._extEnvironmentVariableCollection.collections):void 0,workspaceFolder:this._cwdWorkspaceFolder,isScreenReaderOptimized:this._accessibilityService.isScreenReaderOptimized()};try{r=await l.createProcess(e,"",t,o,this._terminalConfigurationService.config.unicodeVersion,g,v,f)}catch(b){if(b?.message==="Could not fetch remote environment"){this._logService.trace("Could not fetch remote environment, silently failing");return}throw b}}this._isDisposed||this._setupPtyHostListeners(l)}else{if(e.attachPersistentProcess){let p=e.attachPersistentProcess.findRevivedId?await l.attachToRevivedProcess(e.attachPersistentProcess.id):await l.attachToProcess(e.attachPersistentProcess.id);p?r=p:(this._logService.warn("Attach to process failed for terminal",e.attachPersistentProcess),e.attachPersistentProcess=void 0)}r||(r=await this._launchLocalProcess(l,e,t,o,this.userHome,u)),this._isDisposed||this._setupPtyHostListeners(l)}}if(this._isDisposed){r.shutdown(!1);return}this._process=r,this._setProcessState(2),(this.os===3||this.os===2)&&this.capabilities.add(1,new S7t(this._process)),this._dataFilter.newProcess(this._process,n),this._processListeners&&je(this._processListeners),this._processListeners=[r.onProcessReady(l=>{this._logService.debug("onProcessReady",l),this._processTraits=l,this.shellProcessId=l.pid,this._initialCwd=l.cwd,this.processReadyTimestamp=Date.now(),this._onDidChangeProperty.fire({type:"initialCwd",value:this._initialCwd}),this._onProcessReady.fire(l),this._preLaunchInputQueue.length>0&&this._process&&(this._logService.debug("sending prelaunch input queue",this._preLaunchInputQueue),r.input(this._preLaunchInputQueue.join("")),this._preLaunchInputQueue.length=0)}),r.onProcessExit(l=>this._onExit(l)),r.onDidChangeProperty(({type:l,value:c})=>{switch(l){case"hasChildProcesses":this._hasChildProcesses=c;break;case"failedShellIntegrationActivation":this._telemetryService?.publicLog2("terminal/shellIntegrationActivationFailureCustomArgs");break}this._onDidChangeProperty.fire({type:l,value:c})})],r.onProcessReplayComplete&&this._processListeners.push(r.onProcessReplayComplete(()=>this._onProcessReplayComplete.fire())),r.onRestoreCommands&&this._processListeners.push(r.onRestoreCommands(l=>this._onRestoreCommands.fire(l))),setTimeout(()=>{this.processState===2&&this._setProcessState(3)},500);let s=await r.start();if(s)return s;Ff(zi(),()=>{this.backend?.getLatency().then(l=>{this._logService.info(`Latency measurements for ${this.remoteAuthority??"local"} backend
${l.map(c=>`${c.label}: ${c.latency.toFixed(2)}ms`).join(`
`)}`)})})}async relaunch(e,t,o,n){return this.ptyProcessReady=this._createPtyProcessReadyPromise(),this._logService.trace(`Relaunching terminal instance ${this._instanceId}`),this._isDisconnected&&(this._isDisconnected=!1,this._onPtyReconnect.fire()),this._hasWrittenData=!1,this.createProcess(e,t,o,n)}async _resolveEnvironment(e,t,o){let n=g6(o.cwd,this._workspaceContextService,this._historyService),r=ii?"windows":et?"osx":"linux",s=this._configurationService.getValue(`terminal.integrated.env.${r}`);this._logService.debug(`Resolving environment (useShellEnvironment=${o.useShellEnvironment}, platformKey=${r}, envFromConfig=${s?Object.keys(s).join(","):"none"})`);let l;if(o.useShellEnvironment){let u=await e.getShellEnvironment();if(!u)throw new ci("Cannot fetch shell environment to use");this._logService.debug(`Shell environment resolved with ${Object.keys(u).length} variables: ${Object.keys(u).sort().join(", ")}`),l=u}else l=await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority),this._logService.debug(`Profile environment resolved with ${Object.keys(l).length} variables`);let c=await Wqt(o,s,t,this._productService.version,this._terminalConfigurationService.config.detectLocale,l);return this._logService.debug(`Terminal environment created with ${Object.keys(c).length} variables: ${Object.keys(c).sort().join(", ")}`),!this._isDisposed&&Oqt(o)&&(this._extEnvironmentVariableCollection=this._environmentVariableService.mergedCollection,this._register(this._environmentVariableService.onDidChangeCollections(u=>this._onEnvironmentVariableCollectionChange(u))),await this._extEnvironmentVariableCollection.applyToProcessEnvironment(c,{workspaceFolder:n},t),this._extEnvironmentVariableCollection.getVariableMap({workspaceFolder:n}).size&&(this.environmentVariableInfo=this._instantiationService.createInstance(Gse,this._extEnvironmentVariableCollection),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo))),c}async _launchLocalProcess(e,t,o,n,r,s){await this._terminalProfileResolverService.resolveShellLaunchConfig(t,{remoteAuthority:void 0,os:Ao});let l=this._historyService.getLastActiveWorkspaceRoot(Q.file),c=await gko(t,r,s,l,this._terminalConfigurationService.config.cwd,this._logService),u=await this._resolveEnvironment(e,s,t),p={shellIntegration:{enabled:this._configurationService.getValue("terminal.integrated.shellIntegration.enabled"),suggestEnabled:this._configurationService.getValue(Yp.SuggestEnabled),nonce:this.shellIntegrationNonce},windowsUseConptyDll:this._terminalConfigurationService.config.windowsUseConptyDll??!1,environmentVariableCollections:this._extEnvironmentVariableCollection?Lwi(this._extEnvironmentVariableCollection.collections):void 0,workspaceFolder:this._cwdWorkspaceFolder,isScreenReaderOptimized:this._accessibilityService.isScreenReaderOptimized()},h=(this._configurationService.getValue("task.reconnection")&&t.reconnectionProperties||!t.isFeatureTerminal)&&this._terminalConfigurationService.config.enablePersistentSessions&&!t.isTransient;return await e.createProcess(t,c,o,n,this._terminalConfigurationService.config.unicodeVersion,u,p,h)}_setupPtyHostListeners(e){this._ptyListenersAttached||(this._ptyListenersAttached=!0,this._register(e.onPtyHostUnresponsive(()=>{this._isDisconnected=!0,this._onPtyDisconnect.fire()})),this._ptyResponsiveListener=e.onPtyHostResponsive(()=>{this._isDisconnected=!1,this._onPtyReconnect.fire()}),this._register(ee(()=>this._ptyResponsiveListener?.dispose())),this._register(e.onPtyHostRestart(async()=>{if(this._isDisconnected||(this._isDisconnected=!0,this._onPtyDisconnect.fire()),this._ptyResponsiveListener?.dispose(),this._ptyResponsiveListener=void 0,this._shellLaunchConfig)if(this._shellLaunchConfig.isFeatureTerminal&&!this.reconnectionProperties)this._onExit(-1);else{let t=d(16065,null),o="";this.os===1&&this._dimensions.rows>0&&(o=`\r
`.repeat(this._dimensions.rows-1)+"\x1B[H"),this._onProcessData.fire({data:QE(t,{loudFormatting:!0})+o,trackCommit:!1}),await this.relaunch(this._shellLaunchConfig,this._dimensions.cols,this._dimensions.rows,!1)}})),this._register(ee(()=>{this.ptyProcessReady=void 0})))}async getBackendOS(){let e=Ao;if(this.remoteAuthority){let t=await this._remoteAgentService.getEnvironment();if(!t)throw new Error(`Failed to get remote environment for remote authority "${this.remoteAuthority}"`);e=t.os}return e}setDimensions(e,t,o,n,r){if(o){this._resize(e,t,n,r);return}return this.ptyProcessReady.then(()=>this._resize(e,t,n,r))}async setUnicodeVersion(e){return this._process?.setUnicodeVersion(e)}async setNextCommandId(e,t){await this.ptyProcessReady;let o=this._process;o?.id&&await this._terminalService.setNextCommandId(o.id,e,t)}_resize(e,t,o,n){if(this._process){try{this._process.resize(e,t,o,n)}catch(r){if(r.code!=="EPIPE"&&r.code!=="ERR_IPC_CHANNEL_CLOSED")throw r}this._dimensions.cols=e,this._dimensions.rows=t}}async write(e){await this.ptyProcessReady,this._dataFilter.disableSeamlessRelaunch(),this._hasWrittenData=!0,this.shellProcessId||this._processType===1?this._process&&this._process.input(e):(this._logService.debug("queueing data in prelaunch input queue",e),this._preLaunchInputQueue.push(e))}async sendSignal(e){await this.ptyProcessReady,this._process&&this._process.sendSignal(e)}async processBinary(e){await this.ptyProcessReady,this._dataFilter.disableSeamlessRelaunch(),this._hasWrittenData=!0,this._process?.processBinary(e)}get initialCwd(){return this._initialCwd??""}async refreshProperty(e){if(!this._process)throw new Error("Cannot refresh property when process is not set");return this._process.refreshProperty(e)}async updateProperty(e,t){return this._process?.updateProperty(e,t)}acknowledgeDataEvent(e){this._ackDataBufferer.ack(e)}_onExit(e){this._process=null,this.processState===2&&this._setProcessState(4),this.processState===3&&this._setProcessState(6),this._onProcessExit.fire(e)}_setProcessState(e){this.processState=e,this._onProcessStateChange.fire()}_onEnvironmentVariableCollectionChange(e){let t=this._extEnvironmentVariableCollection.diff(e,{workspaceFolder:this._cwdWorkspaceFolder});if(t===void 0){this.environmentVariableInfo instanceof oIe&&(this.environmentVariableInfo=this._instantiationService.createInstance(Gse,this._extEnvironmentVariableCollection),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo));return}this.environmentVariableInfo=this._instantiationService.createInstance(oIe,t,this._instanceId,e),this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo)}async clearBuffer(){this._process?.clearBuffer?.()}};b2e=I([m(4,fa),m(5,F),m(6,wa),m(7,Ae),m(8,Xp),m(9,Mt),m(10,Ze),m(11,bo),m(12,Pn),m(13,gG),m(14,mp),m(15,ig),m(16,B),m(17,uh),m(18,_e),m(19,Ne),m(20,Ai),m(21,an)],b2e);var UKi=class{constructor(i){this._callback=i;this._unsentCharCount=0}ack(i){for(this._unsentCharCount+=i;this._unsentCharCount>5e3;)this._unsentCharCount-=5e3,this._callback(5e3)}};var vpt=class extends k{constructor(e){super();this._logService=e;this._firstDisposable=this._register(new ue);this._secondDisposable=this._register(new ue);this._dataListener=this._register(new ue);this._disableSeamlessRelaunch=!1;this._onProcessData=this._register(new T)}get onProcessData(){return this._onProcessData.event}newProcess(e,t){if(this._dataListener.clear(),this._activeProcess?.shutdown(!1),this._activeProcess=e,!this._firstRecorder||!t||this._disableSeamlessRelaunch){[this._firstRecorder,this._firstDisposable.value]=this._createRecorder(e),this._disableSeamlessRelaunch&&t&&this._onProcessData.fire("\x1Bc"),this._dataListener.value=e.onProcessData(n=>this._onProcessData.fire(n)),this._disableSeamlessRelaunch=!1;return}this._secondRecorder&&this.triggerSwap(),this._swapTimeout=ut.setTimeout(()=>this.triggerSwap(),3e3),this._dataListener.clear(),this._firstDisposable.clear();let o=this._createRecorder(e);[this._secondRecorder,this._secondDisposable.value]=o}disableSeamlessRelaunch(){this._disableSeamlessRelaunch=!0,this._stopRecording(),this.triggerSwap()}triggerSwap(){if(this._swapTimeout&&(ut.clearTimeout(this._swapTimeout),this._swapTimeout=void 0),!this._firstRecorder)return;if(!this._secondRecorder){this._firstRecorder=void 0,this._firstDisposable.clear();return}let e=this._getDataFromRecorder(this._firstRecorder),t=this._getDataFromRecorder(this._secondRecorder);e===t?this._logService.trace("Seamless terminal relaunch - identical content"):(this._logService.trace("Seamless terminal relaunch - resetting content"),this._onProcessData.fire({data:`\x1Bc${t}`,trackCommit:!1})),this._dataListener.value=this._activeProcess.onProcessData(o=>this._onProcessData.fire(o)),this._firstRecorder=this._secondRecorder,this._firstDisposable.value=this._secondDisposable.value,this._secondRecorder=void 0}_stopRecording(){this._swapTimeout||(this._firstRecorder=void 0,this._firstDisposable.clear(),this._secondRecorder=void 0,this._secondDisposable.clear())}_createRecorder(e){let t=new I7t(0,0),o=e.onProcessData(n=>t.handleData(We(n)?n:n.data));return[t,o]}_getDataFromRecorder(e){return e.generateReplayEventSync().events.filter(t=>!!t.data).map(t=>t.data).join("")}};vpt=I([m(0,wa)],vpt);var w7t=class extends k{constructor(e){super();this._initializationPromise=e;this._isOsSet=!1;this._onLineData=this._register(new T);this.onLineData=this._onLineData.event}async activate(e){this._xterm=e;let t=e.buffer;await this._initializationPromise,this._register(e.onLineFeed(()=>{let o=t.active.getLine(t.active.baseY+t.active.cursorY);o&&!o.isWrapped&&this._sendLineData(t.active,t.active.baseY+t.active.cursorY-1)})),this._register(ee(()=>{this._sendLineData(t.active,t.active.baseY+t.active.cursorY)}))}setOperatingSystem(e){if(!(this._isOsSet||!this._xterm)&&(this._isOsSet=!0,e===1)){let t=this._xterm;this._register(t.parser.registerCsiHandler({final:"H"},()=>{let o=t.buffer;return this._sendLineData(o.active,o.active.baseY+o.active.cursorY),!1}))}}_sendLineData(e,t){let o=e.getLine(t);if(!o)return;let n=o.translateToString(!0);for(;t>0&&o.isWrapped&&(o=e.getLine(--t),!!o);)n=o.translateToString(!1)+n;this._onLineData.fire(n)}};var C7t=class a extends k{constructor(e){super();this.options=e;this.domId=`icon_select_box_id_${++a.InstanceCount}`;this._onDidSelect=this._register(new T);this.onDidSelect=this._onDidSelect.event;this.renderedIcons=[];this.focusedItemIndex=0;this.numberOfElementsPerRow=1;this.iconContainerWidth=36;this.iconContainerHeight=36;this.domNode=_(".icon-select-box"),this._register(this.create())}static{this.InstanceCount=0}create(){let e=new O,t=D(this.domNode,_(".icon-select-box-container"));t.style.margin="10px 15px";let o=D(t,_(".icon-select-input-container"));o.style.paddingBottom="10px",this.inputBox=e.add(new ad(o,void 0,{placeholder:d(18,null),inputBoxStyles:this.options.inputBoxStyles}));let n=this.iconsContainer=_(".icon-select-icons-container",{id:`${this.domId}_icons`});n.role="listbox",n.tabIndex=0,this.scrollableElement=e.add(new Ar(n,{useShadows:!1,horizontal:2})),D(t,this.scrollableElement.getDomNode()),this.options.showIconInfo&&(this.iconIdElement=this._register(new ul(D(D(t,_(".icon-select-id-container")),_(".icon-select-id-label")))));let r=e.add(new ue);return r.value=this.renderIcons(this.options.icons,[],n),this.scrollableElement.scanDomNode(),e.add(this.inputBox.onDidChange(s=>{let l=[],c=[];for(let u of this.options.icons){let p=this.matchesContiguous(s,u.id);p&&(l.push(u),c.push(p))}l.length&&(r.value=this.renderIcons(l,c,n),this.scrollableElement?.scanDomNode())})),this.inputBox.inputElement.role="combobox",this.inputBox.inputElement.ariaHasPopup="menu",this.inputBox.inputElement.ariaAutoComplete="list",this.inputBox.inputElement.ariaExpanded="true",this.inputBox.inputElement.setAttribute("aria-controls",n.id),e}renderIcons(e,t,o){let n=new O;St(o);let r=this.renderedIcons[this.focusedItemIndex]?.icon,s=0,l=[];if(e.length)for(let c=0;c<e.length;c++){let u=e[c],p=D(o,_(".icon-container",{id:`${this.domId}_icons_${c}`}));p.style.width=`${this.iconContainerWidth}px`,p.style.height=`${this.iconContainerHeight}px`,p.title=u.id,p.role="button",p.setAttribute("aria-setsize",`${e.length}`),p.setAttribute("aria-posinset",`${c+1}`),D(p,_(q.asCSSSelector(u))),l.push({icon:u,element:p,highlightMatches:t[c]}),n.add($(p,ne.CLICK,h=>{h.stopPropagation(),this.setSelection(c)})),u===r&&(s=c)}else{let c=d(17,null);D(o,_(".icon-no-results",void 0,c)),cn(c)}return this.renderedIcons.splice(0,this.renderedIcons.length,...l),this.focusIcon(s),n}focusIcon(e){let t=this.renderedIcons[this.focusedItemIndex];t&&t.element.classList.remove("focused"),this.focusedItemIndex=e;let o=this.renderedIcons[e];o&&o.element.classList.add("focused"),this.inputBox&&(o?this.inputBox.inputElement.setAttribute("aria-activedescendant",o.element.id):this.inputBox.inputElement.removeAttribute("aria-activedescendant")),this.iconIdElement&&(o?this.iconIdElement.set(o.icon.id,o.highlightMatches):this.iconIdElement.set("")),this.reveal(e)}reveal(e){if(!this.scrollableElement||e<0||e>=this.renderedIcons.length)return;let t=this.renderedIcons[e].element;if(!t)return;let{height:o}=this.scrollableElement.getScrollDimensions(),{scrollTop:n}=this.scrollableElement.getScrollPosition();t.offsetTop+this.iconContainerHeight>n+o?this.scrollableElement.setScrollPosition({scrollTop:t.offsetTop+this.iconContainerHeight-o}):t.offsetTop<n&&this.scrollableElement.setScrollPosition({scrollTop:t.offsetTop})}matchesContiguous(e,t){let o=t.toLowerCase().indexOf(e.toLowerCase());return o!==-1?[{start:o,end:o+e.length}]:null}layout(e){this.domNode.style.width=`${e.width}px`,this.domNode.style.height=`${e.height}px`;let t=e.width-30;if(this.numberOfElementsPerRow=Math.floor(t/this.iconContainerWidth),this.numberOfElementsPerRow===0)throw new Error("Insufficient width");let o=t%this.iconContainerWidth,n=Math.floor(o/this.numberOfElementsPerRow);for(let{element:s}of this.renderedIcons)s.style.marginRight=`${n}px`;let r=o%this.numberOfElementsPerRow;this.iconsContainer&&(this.iconsContainer.style.paddingLeft=`${Math.floor(r/2)}px`,this.iconsContainer.style.paddingRight=`${Math.ceil(r/2)}px`),this.scrollableElement&&(this.scrollableElement.getDomNode().style.height=`${this.iconIdElement?e.height-80:e.height-40}px`,this.scrollableElement.scanDomNode())}getFocus(){return[this.focusedItemIndex]}setSelection(e){if(e<0||e>=this.renderedIcons.length)throw new Error(`Invalid index ${e}`);this.focusIcon(e),this._onDidSelect.fire(this.renderedIcons[e].icon)}clearInput(){this.inputBox&&(this.inputBox.value="")}focus(){this.inputBox?.focus(),this.focusIcon(0)}focusNext(){this.focusIcon((this.focusedItemIndex+1)%this.renderedIcons.length)}focusPrevious(){this.focusIcon((this.focusedItemIndex-1+this.renderedIcons.length)%this.renderedIcons.length)}focusNextRow(){let e=this.focusedItemIndex+this.numberOfElementsPerRow;e>=this.renderedIcons.length&&(e=(e+1)%this.numberOfElementsPerRow,e=e>=this.renderedIcons.length?0:e),this.focusIcon(e)}focusPreviousRow(){let e=this.focusedItemIndex-this.numberOfElementsPerRow;if(e<0){let t=Math.floor(this.renderedIcons.length/this.numberOfElementsPerRow);e=this.focusedItemIndex+this.numberOfElementsPerRow*t-1,e=e<0?this.renderedIcons.length-1:e>=this.renderedIcons.length?e-this.numberOfElementsPerRow:e}this.focusIcon(e)}getFocusedIcon(){return this.renderedIcons[this.focusedItemIndex].icon}};var S2e=new Y("iconSelectBoxFocus",!0),zKi=new Y("iconSelectBoxInputFocus",!0),KKi=new Y("iconSelectBoxInputEmpty",!0),Q_=class extends C7t{static getFocusedWidget(){return Q_.focusedWidget}constructor(i,e){if(super(i),this.contextKeyService=this._register(e.createScoped(this.domNode)),S2e.bindTo(this.contextKeyService),this.inputFocusContextKey=zKi.bindTo(this.contextKeyService),this.inputEmptyContextKey=KKi.bindTo(this.contextKeyService),this.inputBox){let t=this._register(nr(this.inputBox.inputElement));this._register(t.onDidFocus(()=>this.inputFocusContextKey.set(!0))),this._register(t.onDidBlur(()=>this.inputFocusContextKey.set(!1))),this._register(this.inputBox.onDidChange(()=>this.inputEmptyContextKey.set(this.inputBox?.value.length===0)))}}focus(){super.focus(),Q_.focusedWidget=this}};Q_=I([m(1,X)],Q_);xt.registerCommandAndKeybindingRule({id:"iconSelectBox.focusUp",weight:200,when:S2e,primary:16,handler:()=>{let a=Q_.getFocusedWidget();a&&a.focusPreviousRow()}});xt.registerCommandAndKeybindingRule({id:"iconSelectBox.focusDown",weight:200,when:S2e,primary:18,handler:()=>{let a=Q_.getFocusedWidget();a&&a.focusNextRow()}});xt.registerCommandAndKeybindingRule({id:"iconSelectBox.focusNext",weight:200,when:C.and(S2e,C.or(KKi,zKi.toNegated())),primary:17,handler:()=>{let a=Q_.getFocusedWidget();a&&a.focusNext()}});xt.registerCommandAndKeybindingRule({id:"iconSelectBox.focusPrevious",weight:200,when:C.and(S2e,C.or(KKi,zKi.toNegated())),primary:15,handler:()=>{let a=Q_.getFocusedWidget();a&&a.focusPrevious()}});xt.registerCommandAndKeybindingRule({id:"iconSelectBox.selectFocused",weight:200,when:S2e,primary:3,handler:()=>{let a=Q_.getFocusedWidget();a&&a.setSelection(a.getFocus()[0])}});var bEn=new uo(()=>{let a=Zw().getIcons(),i=new Set;return a.filter(t=>t.id===EY.blank.id||q.isThemeIcon(t.defaults)||i.has(t.defaults.fontCharacter)?!1:(i.add(t.defaults.fontCharacter),!0))}),I2e=class extends k{constructor(e,t,o){super();this._hoverService=t;this._layoutService=o;this._iconSelectBox=e.createInstance(Q_,{icons:bEn.value,inputBoxStyles:Wl})}async pickIcons(){let e=new di(486,260);return new Promise(t=>{this._register(this._iconSelectBox.onDidSelect(s=>{t(s),this._iconSelectBox.dispose()})),this._iconSelectBox.clearInput();let o=_m().body,n=o.getBoundingClientRect(),r=this._hoverService.showInstantHover({content:this._iconSelectBox.domNode,target:{targetElements:[o],x:n.left+(n.width-e.width)/2,y:n.top+this._layoutService.activeContainerOffset.top},position:{hoverPosition:2},persistence:{sticky:!0}},!0);r&&this._register(r),this._iconSelectBox.layout(e),this._iconSelectBox.focus()})}};I2e=I([m(0,F),m(1,ot),m(2,Kl)],I2e);var bpt=class extends k{constructor(e,t,o,n,r){super();this._isVisible=e;this._getXterm=t;this._resizeBothCallback=o;this._resizeXCallback=n;this._resizeYCallback=r;this._latestX=0;this._latestY=0;this._resizeXJob=this._register(new ue);this._resizeYJob=this._register(new ue)}async resize(e,t,o){if(this._store.isDisposed)return;if(this._latestX=e,this._latestY=t,o||this._getXterm().raw.buffer.normal.length<200){this._resizeXJob.clear(),this._resizeYJob.clear(),this._resizeBothCallback(e,t);return}let n=Me(this._getXterm().raw.element);if(n&&!this._isVisible()){this._resizeXJob.value||(this._resizeXJob.value=Ff(n,async()=>{this._store.isDisposed||(this._resizeXCallback(this._latestX),this._resizeXJob.clear())})),this._resizeYJob.value||(this._resizeYJob.value=Ff(n,async()=>{this._store.isDisposed||(this._resizeYCallback(this._latestY),this._resizeYJob.clear())}));return}this._resizeYCallback(t),this._latestX=e,this._debounceResizeX(e)}flush(){this._store.isDisposed||(this._resizeXJob.value||this._resizeYJob.value)&&(this._resizeXJob.clear(),this._resizeYJob.clear(),this._resizeBothCallback(this._latestX,this._latestY))}_debounceResizeX(e){this._store.isDisposed||this._resizeXCallback(e)}};I([Tu(100)],bpt.prototype,"_debounceResizeX",1);var x7t,IEn=["bash","zsh","pwsh","python"],yEn=new Map([["claude",/claude\s*code/i],["copilot",/\bcopilot\b/i],["gemini",/\bgemini\b/i]]),Ov=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce){super();this._terminalShellTypeContextKey=e;this._shellLaunchConfig=t;this._contextKeyService=o;this._contextMenuService=n;this._terminalConfigurationService=s;this._terminalProfileResolverService=l;this._pathService=c;this._fileService=u;this._keybindingService=p;this._notificationService=h;this._viewsService=f;this._themeService=v;this._configurationService=b;this._logService=S;this._accessibilityService=w;this._quickInputService=E;this._workbenchEnvironmentService=M;this._workspaceContextService=N;this._editorService=V;this._workspaceTrustRequestService=H;this._historyService=K;this._telemetryService=j;this._openerService=J;this._commandService=se;this._accessibilitySignalService=ae;this._viewDescriptorService=ce;this._contributions=new Map;this._latestXtermWriteData=0;this._latestXtermParseData=0;this._title="";this._titleSource=1;this._cols=0;this._rows=0;this._cwd=void 0;this._initialCwd=void 0;this._injectedArgs=void 0;this._layoutSettingsChanged=!0;this._areLinksReady=!1;this._initialDataEventsListener=this._register(new ue);this._initialDataEvents=[];this._messageTitleDisposable=this._register(new ue);this._dndObserver=this._register(new ue);this._processName="";this._usedShellIntegrationInjection=!1;this.capabilities=this._register(new f6);this.disableLayout=!1;this._targetRef=new Dvt(void 0);this._onExit=new T;this.onExit=this._onExit.event;this._onDisposed=this._register(new T);this.onDisposed=this._onDisposed.event;this._onProcessIdReady=this._register(new T);this.onProcessIdReady=this._onProcessIdReady.event;this._onProcessReplayComplete=this._register(new T);this.onProcessReplayComplete=this._onProcessReplayComplete.event;this._onTitleChanged=this._register(new T);this.onTitleChanged=this._onTitleChanged.event;this._onIconChanged=this._register(new T);this.onIconChanged=this._onIconChanged.event;this._onWillData=this._register(new T);this.onWillData=this._onWillData.event;this._onData=this._register(new T);this.onData=this._onData.event;this._onBinary=this._register(new T);this.onBinary=this._onBinary.event;this._onRequestExtHostProcess=this._register(new T);this.onRequestExtHostProcess=this._onRequestExtHostProcess.event;this._onDimensionsChanged=this._register(new T);this.onDimensionsChanged=this._onDimensionsChanged.event;this._onMaximumDimensionsChanged=this._register(new T);this.onMaximumDimensionsChanged=this._onMaximumDimensionsChanged.event;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidRequestFocus=this._register(new T);this.onDidRequestFocus=this._onDidRequestFocus.event;this._onDidBlur=this._register(new T);this.onDidBlur=this._onDidBlur.event;this._onDidInputData=this._register(new T);this.onDidInputData=this._onDidInputData.event;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event;this._onRequestAddInstanceToGroup=this._register(new T);this.onRequestAddInstanceToGroup=this._onRequestAddInstanceToGroup.event;this._onDidChangeHasChildProcesses=this._register(new T);this.onDidChangeHasChildProcesses=this._onDidChangeHasChildProcesses.event;this._onDidExecuteText=this._register(new T);this.onDidExecuteText=this._onDidExecuteText.event;this._onDidChangeTarget=this._register(new T);this.onDidChangeTarget=this._onDidChangeTarget.event;this._onDidSendText=this._register(new T);this.onDidSendText=this._onDidSendText.event;this._onDidChangeShellType=this._register(new T);this.onDidChangeShellType=this._onDidChangeShellType.event;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._onLineData=this._register(new T({onDidAddFirstListener:async()=>(this.xterm??await this._xtermReadyPromise)?.raw.loadAddon(this._lineDataEventAddon)}));this.onLineData=this._onLineData.event;this.sessionId=ht();if(this._wrapperElement=document.createElement("div"),this._wrapperElement.classList.add("terminal-wrapper"),this._widgetManager=this._register(r.createInstance(R0e)),this._isExiting=!1,this._hadFocusOnExit=!1,this._isVisible=!1,this._instanceId=Ov._instanceIdCounter++,this._fixedRows=t.attachPersistentProcess?.fixedDimensions?.rows,this._fixedCols=t.attachPersistentProcess?.fixedDimensions?.cols,this._shellLaunchConfig.shellIntegrationEnvironmentReporting=this._configurationService.getValue("terminal.integrated.shellIntegration.environmentReporting"),this._resource=aze(this._workspaceContextService.getWorkspace().id,this.instanceId,this.title),this._shellLaunchConfig.attachPersistentProcess?.hideFromUser&&(this._shellLaunchConfig.hideFromUser=this._shellLaunchConfig.attachPersistentProcess.hideFromUser),this._shellLaunchConfig.attachPersistentProcess?.isFeatureTerminal&&(this._shellLaunchConfig.isFeatureTerminal=this._shellLaunchConfig.attachPersistentProcess.isFeatureTerminal),this._shellLaunchConfig.attachPersistentProcess?.type&&(this._shellLaunchConfig.type=this._shellLaunchConfig.attachPersistentProcess.type),this._shellLaunchConfig.attachPersistentProcess?.tabActions&&(this._shellLaunchConfig.tabActions=this._shellLaunchConfig.attachPersistentProcess.tabActions),this.shellLaunchConfig.cwd){let Ee=We(this._shellLaunchConfig.cwd)?A.from({scheme:Q.file,path:this._shellLaunchConfig.cwd}):this._shellLaunchConfig.cwd;Ee&&(this._workspaceFolder=this._workspaceContextService.getWorkspaceFolder(Ee)??void 0)}if(!this._workspaceFolder){let Ee=this._historyService.getLastActiveWorkspaceRoot();this._workspaceFolder=Ee?this._workspaceContextService.getWorkspaceFolder(Ee)??void 0:void 0}let Se=this._register(o.createScoped(this._wrapperElement));this._scopedContextKeyService=Se,this._scopedInstantiationService=this._register(r.createChild(new Po([X,Se]))),this._terminalFocusContextKey=pt.focus.bindTo(Se),this._terminalHasFixedWidth=pt.terminalHasFixedWidth.bindTo(Se),this._terminalHasTextContextKey=pt.textSelected.bindTo(this._contextKeyService),this._terminalAltBufferActiveContextKey=pt.altBufferActive.bindTo(Se),this._terminalShellIntegrationEnabledContextKey=pt.terminalShellIntegrationEnabled.bindTo(Se),this._logService.trace(`terminalInstance#ctor (instanceId: ${this.instanceId})`,this._shellLaunchConfig),this._register(this.capabilities.onDidAddCapability(Ee=>this._logService.debug("terminalInstance added capability",Ee.id))),this._register(this.capabilities.onDidRemoveCapability(Ee=>this._logService.debug("terminalInstance removed capability",Ee.id)));let Re=this._register(new Ot);this._register(this.capabilities.onDidAddCapability(Ee=>{Re.get(Ee.id)?.dispose();let Te=()=>{this._labelComputer?.refreshLabel(this),this._refreshShellIntegrationInfoStatus(this)};switch(Ee.id){case 0:{Re.set(Ee.id,Ee.capability.onDidChangeCwd(It=>{this._cwd=It,this._setTitle(this.title,3)}));break}case 2:{Ee.capability.promptInputModel.setShellType(this.shellType);let It=new O;It.add(U.any(Ee.capability.promptInputModel.onDidStartInput,Ee.capability.promptInputModel.onDidChangeInput,Ee.capability.promptInputModel.onDidFinishInput)(Te)),It.add(Ee.capability.onCommandExecuted(async tt=>{if(!tt.id&&tt.command){let Oi=ht();this.xterm?.shellIntegration.setNextCommandId(tt.command,Oi),await this._processManager.setNextCommandId(tt.command,Oi)}})),Re.set(Ee.id,It);break}case 6:{Re.set(Ee.id,Ee.capability.onPromptTypeChanged(Te));break}}})),this._register(this.onDidChangeShellType(()=>this._refreshShellIntegrationInfoStatus(this))),this._register(this.capabilities.onDidRemoveCapability(Ee=>{Re.get(Ee.id)?.dispose()})),!this.shellLaunchConfig.executable&&!this._workbenchEnvironmentService.remoteAuthority&&this._terminalProfileResolverService.resolveIcon(this._shellLaunchConfig,Ao),this._icon=t.attachPersistentProcess?.icon||t.icon,this.shellLaunchConfig.customPtyImplementation&&!this._shellLaunchConfig.titleTemplate&&this._setTitle(this._shellLaunchConfig.name,0),this.statusList=this._register(this._scopedInstantiationService.createInstance(a2e)),this._initDimensions(),this._processManager=this._createProcessManager(),this._containerReadyBarrier=new t5(100),this._attachBarrier=new t5(1e3),this._xtermReadyPromise=this._createXterm(),this._xtermReadyPromise.then(async()=>{await this._containerReadyBarrier.wait();let Ee;if(!this.shellLaunchConfig.customPtyImplementation&&this._terminalConfigurationService.config.shellIntegration?.enabled&&!this.shellLaunchConfig.executable){Ee=await this._processManager.getBackendOS();let Te=await this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:this.remoteAuthority,os:Ee});this.shellLaunchConfig.executable=Te.path,this.shellLaunchConfig.args=Te.args,this.shellLaunchConfig.icon??=Te.icon,this.shellLaunchConfig.color??=Te.color,this.shellLaunchConfig.env??=Te.env}Ee&&this.shellLaunchConfig.executable&&this.setShellType(CEn(Ee,this.shellLaunchConfig.executable)),await this._createProcess(),this.shellLaunchConfig.attachPersistentProcess&&(this._cwd=this.shellLaunchConfig.attachPersistentProcess.cwd,this._setTitle(this.shellLaunchConfig.attachPersistentProcess.title,this.shellLaunchConfig.attachPersistentProcess.titleSource),this.setShellType(this.shellType)),this._fixedCols&&await this._addScrollbar()}).catch(Ee=>{if(!this.isDisposed)throw Ee}),this._register(this._configurationService.onDidChangeConfiguration(async Ee=>{Ee.affectsConfiguration("accessibility.verbosity.terminal")&&this._setAriaLabel(this.xterm?.raw,this._instanceId,this.title),Ee.affectsConfiguration("terminal.integrated")&&(this.updateConfig(),this.setVisible(this._isVisible)),["terminal.integrated.fontSize","terminal.integrated.fontFamily","terminal.integrated.fontWeight","terminal.integrated.fontWeightBold","terminal.integrated.letterSpacing","terminal.integrated.lineHeight","editor.fontFamily"].some(It=>Ee.affectsConfiguration(It))&&(this._layoutSettingsChanged=!0,await this._resize()),Ee.affectsConfiguration("terminal.integrated.unicodeVersion")&&this._updateUnicodeVersion(),Ee.affectsConfiguration("editor.accessibilitySupport")&&this.updateAccessibilitySupport(),(Ee.affectsConfiguration("terminal.integrated.tabs.title")||Ee.affectsConfiguration("terminal.integrated.tabs.separator")||Ee.affectsConfiguration("terminal.integrated.tabs.description"))&&this._labelComputer?.refreshLabel(this)})),this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(()=>this._labelComputer?.refreshLabel(this)));let xe=Me(this._container).setTimeout(()=>{xe=void 0,this._initialDataEvents=void 0,this._initialDataEventsListener.clear()},1e4);this._register(ee(()=>{xe&&Me(this._container).clearTimeout(xe)}));let He=Dst.getTerminalContributions();for(let Ee of He){if(this._contributions.has(Ee.id)){mt(new Error(`Cannot have two terminal contributions with the same id ${Ee.id}`));continue}let Te;try{Te=this._register(this._scopedInstantiationService.createInstance(Ee.ctor,{instance:this,processManager:this._processManager,widgetManager:this._widgetManager})),this._contributions.set(Ee.id,Te)}catch(It){mt(It)}this._xtermReadyPromise.then(It=>{It&&Te.xtermReady?.(It)}),this._register(this.onDisposed(()=>{Te.dispose(),this._contributions.delete(Ee.id)}))}}static{this._instanceIdCounter=1}get xtermReadyPromise(){return this._xtermReadyPromise}get domElement(){return this._wrapperElement}get usedShellIntegrationInjection(){return this._usedShellIntegrationInjection}get shellIntegrationInjectionFailureReason(){return this._shellIntegrationInjectionInfo}get store(){return this._store}get extEnvironmentVariableCollection(){return this._processManager.extEnvironmentVariableCollection}get waitOnExit(){return this._shellLaunchConfig.attachPersistentProcess?.waitOnExit||this._shellLaunchConfig.waitOnExit}set waitOnExit(e){this._shellLaunchConfig.waitOnExit=e}get isVisible(){return this._isVisible}get targetRef(){return this._targetRef}get target(){return this._targetRef.object}set target(e){this._targetRef.object=e,this._onDidChangeTarget.fire(e)}get instanceId(){return this._instanceId}get resource(){return this._resource}get cols(){return this._fixedCols!==void 0?this._fixedCols:this._dimensionsOverride&&this._dimensionsOverride.cols?this._dimensionsOverride.forceExactSize?this._dimensionsOverride.cols:Math.min(Math.max(this._dimensionsOverride.cols,2),this._cols):this._cols}get rows(){return this._fixedRows!==void 0?this._fixedRows:this._dimensionsOverride&&this._dimensionsOverride.rows?this._dimensionsOverride.forceExactSize?this._dimensionsOverride.rows:Math.min(Math.max(this._dimensionsOverride.rows,2),this._rows):this._rows}get isDisposed(){return this._store.isDisposed}get fixedCols(){return this._fixedCols}get fixedRows(){return this._fixedRows}get maxCols(){return this._cols}get maxRows(){return this._rows}get processId(){return this._processManager.shellProcessId}get processReady(){return this._processManager.ptyProcessReady}get hasChildProcesses(){return this.shellLaunchConfig.attachPersistentProcess?.hasChildProcesses||this._processManager.hasChildProcesses}get reconnectionProperties(){return this.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties||this.shellLaunchConfig.reconnectionProperties}get areLinksReady(){return this._areLinksReady}get initialDataEvents(){return this._initialDataEvents}get exitCode(){return this._exitCode}get exitReason(){return this._exitReason}get hadFocusOnExit(){return this._hadFocusOnExit}get isTitleSetByProcess(){return!!this._messageTitleDisposable.value}get shellLaunchConfig(){return this._shellLaunchConfig}get shellType(){return this._shellType}get os(){return this._processManager.os}get hasRemoteAuthority(){return this._processManager.remoteAuthority!==void 0}get remoteAuthority(){return this._processManager.remoteAuthority}get hasFocus(){return Is(this._wrapperElement)}get title(){return this._title}get titleSource(){return this._titleSource}get icon(){return this._getIcon()}get color(){return this._getColor()}get processName(){return this._processName}get sequence(){return this._sequence}get staticTitle(){return this._staticTitle}get progressState(){return this.xterm?.progressState}get workspaceFolder(){return this._workspaceFolder}get cwd(){return this._cwd}get initialCwd(){return this._initialCwd}get description(){if(this._description)return this._description;switch(this.shellLaunchConfig.attachPersistentProcess?.type||this.shellLaunchConfig.type){case"Task":return vr.typeTask;case"Local":return vr.typeLocal;default:return}}get userHome(){return this._userHome}get shellIntegrationNonce(){return this._processManager.shellIntegrationNonce}get injectedArgs(){return this._injectedArgs}getContribution(e){return this._contributions.get(e)}async _handleOnData(e){await this._processManager.write(e),this._onDidInputData.fire(e)}_getIcon(){return this._icon||(this._icon=this._processManager.processState>=2?Zw().getIcon(this._configurationService.getValue("terminal.integrated.tabs.defaultIcon")):void 0),this._icon}_getColor(){if(this.shellLaunchConfig.color)return this.shellLaunchConfig.color;if(this.shellLaunchConfig?.attachPersistentProcess?.color)return this.shellLaunchConfig.attachPersistentProcess.color;this._processManager.processState>=2}_initDimensions(){if(!this._container){this._cols=80,this._rows=30;return}let e=Me(this._container).getComputedStyle(this._container),t=parseInt(e.width),o=parseInt(e.height);this._evaluateColsAndRows(t,o)}_evaluateColsAndRows(e,t){if(!e||!t)return this._setLastKnownColsAndRows(),null;let o=this._getDimension(e,t);if(!o)return this._setLastKnownColsAndRows(),null;let n=this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Me(this.domElement)),r=QQt(Me(this.domElement),n,o.width,o.height);return r?((this._cols!==r.cols||this._rows!==r.rows)&&(this._cols=r.cols,this._rows=r.rows,this._fireMaximumDimensionsChanged()),o.width):(this._setLastKnownColsAndRows(),null)}_setLastKnownColsAndRows(){Ov._lastKnownGridDimensions&&(this._cols=Ov._lastKnownGridDimensions.cols,this._rows=Ov._lastKnownGridDimensions.rows)}_fireMaximumDimensionsChanged(){this._onMaximumDimensionsChanged.fire()}_getDimension(e,t){let o=this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Me(this.domElement));if(!o||!o.charWidth||!o.charHeight||!this.xterm?.raw.element)return;let n=Me(this.xterm.raw.element).getComputedStyle(this.xterm.raw.element),r=parseInt(n.paddingLeft)+parseInt(n.paddingRight)+14,s=parseInt(n.paddingTop)+parseInt(n.paddingBottom);return Ov._lastKnownCanvasDimensions=new di(Math.min(4096,e-r),t-s+(this._hasScrollBar&&this._horizontalScrollbar?-5:0)),Ov._lastKnownCanvasDimensions}get persistentProcessId(){return this._processManager.persistentProcessId}get shouldPersist(){return this._processManager.shouldPersist&&!this.shellLaunchConfig.isTransient&&(!this.reconnectionProperties||this._configurationService.getValue("task.reconnection")===!0)}static getXtermConstructor(e,t){let o=e.lookupKeybinding(aw.A11yFocusAccessibleBuffer,t);return x7t||(x7t=vn.withAsyncBody(async n=>{let r=(await vf("@xterm/xterm","lib/xterm.js")).Terminal;r.strings.promptLabel=d(16021,null),r.strings.tooMuchOutput=o?d(16022,null,o.getLabel()):d(16023,null),n(r)}),x7t)}async _createXterm(){let e=await Ov.getXtermConstructor(this._keybindingService,this._contextKeyService);if(this.isDisposed)return;let t=this.shellLaunchConfig.executable===void 0||this.shellType===void 0||!IEn.includes(this.shellType),o=this._scopedInstantiationService.createInstance(JP,this._resource,e,{cols:this._cols,rows:this._rows,xtermColorProvider:this._scopedInstantiationService.createInstance(rIe,this._targetRef),capabilities:this.capabilities,shellIntegrationNonce:this._processManager.shellIntegrationNonce,disableShellIntegrationReporting:t},this.onDidExecuteText);this.xterm=o,this._resizeDebouncer=this._register(new bpt(()=>this._isVisible,()=>o,async(s,l)=>{this.isDisposed||(o.resize(s,l),await this._updatePtyDimensions(o.raw))},async s=>{this.isDisposed||(o.resize(s,o.raw.rows),await this._updatePtyDimensions(o.raw))},async s=>{this.isDisposed||(o.resize(o.raw.cols,s),await this._updatePtyDimensions(o.raw))})),this._register(ee(()=>this._resizeDebouncer=void 0)),this.updateAccessibilitySupport(),this._register(this.xterm.onDidRequestRunCommand(s=>{this.sendText(s.command.command,!s.noNewLine)})),this._register(this.xterm.onDidRequestRefreshDimensions(()=>{this._lastLayoutDimensions&&this.layout(this._lastLayoutDimensions)}));let n=this._shellLaunchConfig.initialText?new Promise(s=>this._writeInitialText(o,s)):void 0,r=this._register(new w7t(n));if(this._register(r.onLineData(s=>this._onLineData.fire(s))),this._lineDataEventAddon=r,Zo(()=>{this._register(o.raw.onBell(()=>{(this._configurationService.getValue("terminal.integrated.enableBell")||this._configurationService.getValue("terminal.integrated.enableVisualBell"))&&this.statusList.add({id:"bell",severity:ft.Warning,icon:L.bell,tooltip:d(16005,null)},this._terminalConfigurationService.config.bellDuration),this._accessibilitySignalService.playSignal(tn.terminalBell)}))},1e3,this._store),this._register(o.raw.onSelectionChange(()=>this._onDidChangeSelection.fire(this))),this._register(o.raw.buffer.onBufferChange(()=>this._refreshAltBufferContextKey())),this._register(this._processManager.onProcessData(s=>this._onProcessData(s))),this._register(o.raw.onData(async s=>{await this._handleOnData(s)})),this._register(o.raw.onBinary(s=>this._processManager.processBinary(s))),this._register(this._processManager.onProcessReady(async s=>{s?.windowsPty?.backend==="conpty"&&this._register(o.raw.parser.registerCsiHandler({final:"c"},l=>l.length===0||l.length===1&&l[0]===0?(this._handleOnData("\x1B[?61;4c"),!0):!1)),this._processManager.os&&r.setOperatingSystem(this._processManager.os),o.raw.options.windowsPty=s.windowsPty,o.raw.options.reflowCursorLine=s?.windowsPty?.backend==="conpty"&&!!this._terminalConfigurationService.config.windowsUseConptyDll})),this._register(this._processManager.onRestoreCommands(s=>this.xterm?.shellIntegration.deserialize(s))),this._register(this._viewDescriptorService.onDidChangeLocation(({views:s})=>{s.some(l=>l.id===Fc)&&o.refresh()})),this._register(o.onDidChangeProgress(()=>this._labelComputer?.refreshLabel(this))),this._register(U.runAndSubscribe(o.shellIntegration.onDidChangeSeenSequences,()=>{o.shellIntegration.seenSequences.size>0&&this._refreshShellIntegrationInfoStatus(this)})),!this.capabilities.has(0)){let s=o.raw.onKey(l=>{new mi(l.domEvent).equals(3)&&this._updateProcessCwd()});this._register(this.capabilities.onDidAddCwdDetectionCapability(()=>{s?.dispose(),s=void 0}))}return this.xterm?.shellIntegration&&this.capabilities.add(this.xterm.shellIntegration.capabilities),this._pathService.userHome().then(s=>{this._userHome=s.fsPath}),this._isVisible&&this._open(),o}_refreshShellIntegrationInfoStatus(e){if(!e.xterm)return;let t=e.capabilities.get(2)?.hasRichCommandDetection?d(16020,null):e.capabilities.has(2)?d(16015,null):e.usedShellIntegrationInjection?d(16016,null):d(16018,null),o=[];e.shellType&&o.push(`Shell type: \`${e.shellType}\``);let n=e.cwd;n&&o.push(`Current working directory: \`${n}\``);let r=Array.from(e.xterm.shellIntegration.seenSequences);r.length>0&&o.push(`Seen sequences: ${r.map(u=>`\`${u}\``).join(", ")}`);let s=e.capabilities.get(6)?.promptType;s&&o.push(`Prompt type: \`${s}\``);let l=e.capabilities.get(2)?.promptInputModel.getCombinedString();l!==void 0&&o.push(`Prompt input: \`\`\`${l}\`\`\``);let c=o.length>0?`

`+o.map(u=>`- ${u}`).join(`
`):"";e.statusList.add({id:"shell-integration-info",severity:ft.Info,tooltip:`${d(16014,null)}: ${t}`,detailedTooltip:`${d(16014,null)}: ${t}${c}`})}async runCommand(e,t,o,n,r){let s=this.capabilities.get(2),l=this._configurationService.getValue("terminal.integrated.shellIntegration.enabled")===!0,c=Vqt(this._configurationService,l,this.hasRemoteAuthority,this._processManager.processReadyTimestamp);if(!s||s.promptInputModel.state!==1){let u=new O;await Promise.race([new Promise(p=>{u.add(this.capabilities.onDidAddCommandDetectionCapability(h=>{s=h,s.promptInputModel.state===1?p():u.add(s.promptInputModel.onDidStartInput(()=>{p()}))}))}),Li(c)]),u.dispose()}if(o&&s){let u=r??e;this.xterm?.shellIntegration.setNextCommandId(u,o),await this._processManager.setNextCommandId(u,o)}t&&(!s||s.promptInputModel.value.length>0)&&(await this.sendText("",!1),await Li(100)),await this.sendText(e,t,!t||n)}detachFromElement(){this._wrapperElement.remove(),this._container=void 0}attachToElement(e){this._container!==e&&(this._attachBarrier.isOpen()||this._attachBarrier.open(),this._container=e,this._container.appendChild(this._wrapperElement),this.xterm?.raw.element&&this.xterm.raw.open(this.xterm.raw.element),this.xterm?.refresh(),setTimeout(()=>{this._store.isDisposed||this._initDragAndDrop(e)},0))}_open(){if(!this.xterm||this.xterm.raw.element)return;if(!this._container||!this._container.isConnected)throw new Error("A container element needs to be set with `attachToElement` and be part of the DOM before calling `_open`");let e=document.createElement("div");e.classList.add("terminal-xterm-host"),this._wrapperElement.appendChild(e),this._container.appendChild(this._wrapperElement);let t=this.xterm;this._wrapperElement.xterm=t.raw;let o=t.attachToElement(e);for(let n of this._contributions.values())this.xterm?n.xtermOpen?.(this.xterm):this._xtermReadyPromise.then(r=>{r&&n.xtermOpen?.(r)});if(this._register(t.shellIntegration.onDidChangeStatus(()=>{this.hasFocus?this._setShellIntegrationContextKey():this._terminalShellIntegrationEnabledContextKey.reset()})),!t.raw.element||!t.raw.textarea)throw new Error("xterm elements not set after open");this._setAriaLabel(t.raw,this._instanceId,this._title),t.raw.attachCustomKeyEventHandler(n=>{if(this._isExiting)return!1;let r=new mi(n),s=this._keybindingService.softDispatch(r,r.target),l=s.kind===1&&this._terminalConfigurationService.config.allowChords&&n.key!=="Escape";return this._keybindingService.inChordMode||l||!this._terminalConfigurationService.config.sendKeybindingsToShell&&s.kind===2&&s.commandId&&(n.metaKey||this._terminalConfigurationService.shouldCommandSkipShell(s.commandId))?(n.preventDefault(),!1):this._terminalConfigurationService.config.allowMnemonics&&!et&&n.altKey||vD.getTabFocusMode()&&n.key==="Tab"?!1:n.key==="Tab"&&n.shiftKey?(n.preventDefault(),!0):!(ii&&n.altKey&&n.key==="F4"&&!n.ctrlKey||!of.clipboard.readText&&n.key==="v"&&n.ctrlKey)}),this._register($(t.raw.element,"mousedown",()=>{let n=$(t.raw.element.ownerDocument,"mouseup",()=>{setTimeout(()=>this._refreshSelectionContextKey(),0),n.dispose()})})),this._register($(t.raw.element,"touchstart",()=>{t.raw.focus()})),this._register($(t.raw.element,"keyup",()=>{setTimeout(()=>this._refreshSelectionContextKey(),0)})),this._register($(t.raw.textarea,"focus",()=>this._setFocus(!0))),this._register($(t.raw.textarea,"blur",()=>this._setFocus(!1))),this._register($(t.raw.textarea,"focusout",()=>this._setFocus(!1))),this._initDragAndDrop(this._container),this._widgetManager.attachToElement(o),this._lastLayoutDimensions&&this.layout(this._lastLayoutDimensions),this.updateConfig(),t.raw.options.disableStdin&&this._attachPressAnyKeyToCloseListener(t.raw)}_setFocus(e){e?(this._terminalFocusContextKey.set(!0),this._setShellIntegrationContextKey(),this._onDidFocus.fire(this)):(this.resetFocusContextKey(),this._onDidBlur.fire(this),this._refreshSelectionContextKey())}_setShellIntegrationContextKey(){this.xterm&&this._terminalShellIntegrationEnabledContextKey.set(this.xterm.shellIntegration.status===2)}resetFocusContextKey(){this._terminalFocusContextKey.reset(),this._terminalShellIntegrationEnabledContextKey.reset()}_initDragAndDrop(e){let t=new O,o=t.add(this._scopedInstantiationService.createInstance(Spt,e));t.add(o.onDropTerminal(n=>this._onRequestAddInstanceToGroup.fire(n))),t.add(o.onDropFile(async n=>{this.focus(),await this.sendPath(n,!1)})),t.add(new wg(e,o)),this._dndObserver.value=t}hasSelection(){return this.xterm?this.xterm.raw.hasSelection():!1}get selection(){return this.xterm&&this.hasSelection()?this.xterm.raw.getSelection():void 0}clearSelection(){this.xterm?.raw.clearSelection()}_refreshAltBufferContextKey(){this._terminalAltBufferActiveContextKey.set(!!(this.xterm&&this.xterm.raw.buffer.active===this.xterm.raw.buffer.alternate))}dispose(e){if(!(this.shellLaunchConfig.type==="Task"&&e===2&&this._exitCode!==0&&!this.shellLaunchConfig.waitOnExit)&&!this.isDisposed){this._logService.trace(`terminalInstance#dispose (instanceId: ${this.instanceId})`),je(this._widgetManager),this.xterm?.raw.element&&(this._hadFocusOnExit=this.hasFocus),this._wrapperElement.xterm&&(this._wrapperElement.xterm=void 0),this._horizontalScrollbar&&(this._horizontalScrollbar.dispose(),this._horizontalScrollbar=void 0),this._pressAnyKeyToCloseListener&&(this._pressAnyKeyToCloseListener.dispose(),this._pressAnyKeyToCloseListener=void 0),this._exitReason===void 0&&(this._exitReason=e??0),this._processManager.dispose(),this._onProcessExit(void 0),this._onDisposed.fire(this);try{this.xterm?.dispose()}catch(t){this._logService.error("Exception occurred during xterm disposal",t)}ed&&(this.resetFocusContextKey(),this._terminalHasTextContextKey.reset(),this._onDidBlur.fire(this)),super.dispose()}}async detachProcessAndDispose(e){await this._processManager.detachFromProcess(e===3),this.dispose(e)}focus(e){this._refreshAltBufferContextKey(),this.xterm&&(e||!zi().getSelection()?.toString())&&(this.xterm.raw.focus(),this._onDidRequestFocus.fire())}async focusWhenReady(e){await this._xtermReadyPromise,await this._attachBarrier.wait(),this.focus(e)}async sendText(e,t,o){o&&this.xterm?.raw.modes.bracketedPasteMode&&(e=`\x1B[200~${e}\x1B[201~`),e=e.replace(/\r?\n/g,"\r"),t&&!e.endsWith("\r")&&(e+="\r"),this._logService.debug("sending data (vscode)",e),await this._processManager.write(e),this._onDidInputData.fire(e),this._onDidSendText.fire(e),this.xterm?.scrollToBottom(),t&&this._onDidExecuteText.fire()}async sendSignal(e){this._logService.debug("sending signal (vscode)",e),await this._processManager.sendSignal(e)}async sendPath(e,t){return this.sendText(await this.preparePathForShell(e),t)}async preparePathForShell(e){return await this.processReady,fko(e,this.shellLaunchConfig.executable,this.title,this.shellType,this._processManager.backend,this._processManager.os)}async getUriLabelForShell(e){return await this.processReady,vko(e,this._processManager.backend,this.shellType,this.os)}setVisible(e){let t=this._isVisible!==e;this._isVisible=e,this._wrapperElement.classList.toggle("active",e),e&&this.xterm&&(this._open(),this._resizeDebouncer?.flush(),this._resize()),t&&this._onDidChangeVisibility.fire(e)}scrollDownLine(){this.xterm?.scrollDownLine()}scrollDownPage(){this.xterm?.scrollDownPage()}scrollToBottom(){this.xterm?.scrollToBottom()}scrollUpLine(){this.xterm?.scrollUpLine()}scrollUpPage(){this.xterm?.scrollUpPage()}scrollToTop(){this.xterm?.scrollToTop()}clearBuffer(){this._processManager.clearBuffer(),this.xterm?.clearBuffer()}_refreshSelectionContextKey(){let e=!!this._viewsService.getActiveViewWithId(Fc),t=!1,o=this._editorService.activeEditor;o&&(t=o instanceof Zf),this._terminalHasTextContextKey.set((e||t)&&this.hasSelection())}_createProcessManager(){let e;this.shellLaunchConfig.attachPersistentProcess?.environmentVariableCollections&&(e=Guo(this.shellLaunchConfig.attachPersistentProcess.environmentVariableCollections));let t=this._scopedInstantiationService.createInstance(b2e,this._instanceId,this.shellLaunchConfig?.cwd,e,this.shellLaunchConfig.shellIntegrationNonce??this.shellLaunchConfig.attachPersistentProcess?.shellIntegrationNonce);return this.capabilities.add(t.capabilities),this._register(t.onProcessReady(async o=>{this._onProcessIdReady.fire(this),this._initialCwd=await this.getInitialCwd(),this._labelComputer||(this._labelComputer=this._register(this._scopedInstantiationService.createInstance(nIe)),this._register(this._labelComputer.onDidChangeLabel(n=>{(this._title!==n.title||this._description!==n.description)&&(this._title=n.title,this._description=n.description,this._onTitleChanged.fire(this))}))),this._shellLaunchConfig.name&&!this._shellLaunchConfig.titleTemplate?this._setTitle(this._shellLaunchConfig.name,0):(setTimeout(()=>{this._xtermReadyPromise.then(n=>{n&&(this._messageTitleDisposable.value=n.raw.onTitleChange(r=>this._onTitleChange(r)))})}),this._shellLaunchConfig.titleTemplate&&this._shellLaunchConfig.name?this._setTitle(this._shellLaunchConfig.name,1):this._setTitle(this._shellLaunchConfig.executable,1))})),this._register(t.onProcessExit(o=>this._onProcessExit(o))),this._register(t.onDidChangeProperty(({type:o,value:n})=>{switch(o){case"cwd":this._cwd=n,this._labelComputer?.refreshLabel(this);break;case"initialCwd":this._initialCwd=n,this._cwd=this._initialCwd,this._setTitle(this.title,3),this._icon=this._shellLaunchConfig.attachPersistentProcess?.icon||this._shellLaunchConfig.icon,this._onIconChanged.fire({instance:this,userInitiated:!1});break;case"title":this._setTitle(n??"",1);break;case"overrideDimensions":this.setOverrideDimensions(n,!0);break;case"resolvedShellLaunchConfig":this._setResolvedShellLaunchConfig(n);break;case"shellType":this._handleShellTypeChange(n);break;case"hasChildProcesses":this._onDidChangeHasChildProcesses.fire(n);break;case"usedShellIntegrationInjection":this._usedShellIntegrationInjection=!0;break;case"shellIntegrationInjectionFailureReason":this._shellIntegrationInjectionInfo=n;break}})),this._initialDataEventsListener.value=t.onProcessData(o=>this._initialDataEvents?.push(o.data)),this._register(t.onProcessReplayComplete(()=>this._onProcessReplayComplete.fire())),this._register(t.onEnvironmentVariableInfoChanged(o=>this._onEnvironmentVariableInfoChanged(o))),this._register(t.onPtyDisconnect(()=>{this.xterm&&(this.xterm.raw.options.disableStdin=!0),this.statusList.add({id:"disconnected",severity:ft.Error,icon:L.debugDisconnect,tooltip:d(16007,null)})})),this._register(t.onPtyReconnect(()=>{this.xterm&&(this.xterm.raw.options.disableStdin=!1),this.statusList.remove("disconnected")})),t}async _createProcess(){if(this.isDisposed)return;let e=await this._trust(),t=!!this.remoteAuthority;!e&&!(t&&this._workbenchEnvironmentService.remoteAuthority)?this._onProcessExit({message:d(16033,null)}):this._workspaceContextService.getWorkspace().folders.length===0&&this._cwd&&this._userHome&&dm(this._cwd)!==dm(this._userHome)&&this._onProcessExit({message:d(16032,null,this._cwd,this._userHome)}),this._container&&this._cols===0&&this._rows===0&&(this._initDimensions(),this.xterm?.resize(this._cols||80,this._rows||30));let o=this.shellLaunchConfig.icon;await this._processManager.createProcess(this._shellLaunchConfig,this._cols||80,this._rows||30).then(n=>{n&&(yo(n,{message:!0})?this._onProcessExit(n):yo(n,{injectedArgs:!0})&&(this._injectedArgs=n.injectedArgs))}),!this.isDisposed&&(o!==this.shellLaunchConfig.icon||this.shellLaunchConfig.color)&&(this._icon=this._shellLaunchConfig.attachPersistentProcess?.icon||this._shellLaunchConfig.icon,this._onIconChanged.fire({instance:this,userInitiated:!1}))}registerMarker(e){return this.xterm?.raw.registerMarker(e)}addBufferMarker(e){this.capabilities.get(4)?.addMark(e)}scrollToMark(e,t,o){this.xterm?.markTracker.scrollToClosestMarker(e,t,o)}async freePortKillProcess(e,t){await this._processManager?.freePortKillProcess(e),this.runCommand(t,!1)}_onProcessData(e){let t=[],o=e.data.matchAll(/(?<seq>\x1b\][16]33;(?:C|D(?:;\d+)?)\x07)/g),n=0;for(let s of o){if(s.groups?.seq===void 0)throw new ci("seq must be defined");t.push(e.data.substring(n,s.index)),t.push(s.groups?.seq??""),n=s.index+s[0].length}let r=e.data.substring(n);for(let s=0;s<t.length;s++)this._writeProcessData(t[s]);e.trackCommit?e.writePromise=new Promise(s=>this._writeProcessData(r,s)):this._writeProcessData(r)}_writeProcessData(e,t){this._onWillData.fire(e);let o=++this._latestXtermWriteData;this.xterm?.raw.write(e,()=>{this._latestXtermParseData=o,this._processManager.acknowledgeDataEvent(e.length),t?.(),this._onData.fire(e)})}async _onProcessExit(e){if(this._isExiting||this.isDisposed)return;let t=wEn(e,this.shellLaunchConfig,this._processManager.processState,this._initialCwd);if(this._usedShellIntegrationInjection&&this._processManager.processState===4&&t?.code!==0){this._relaunchWithShellIntegrationDisabled(t?.message),this._onExit.fire(e);return}this._isExiting=!0,await this._flushXtermData(),this._exitCode=t?.code;let o=t?.message;this._logService.debug("Terminal process exit","instanceId",this.instanceId,"code",this._exitCode,"processState",this._processManager.processState),this._onExit.fire(e);let n=this.waitOnExit;n&&this._processManager.processState!==5?this._xtermReadyPromise.then(r=>{if(r){switch(o&&r.raw.write(QE(o)),typeof n){case"string":r.raw.write(QE(n,{excludeLeadingNewLine:!0}));break;case"function":this.exitCode!==void 0&&r.raw.write(QE(n(this.exitCode),{excludeLeadingNewLine:!0}));break}r.raw.options.disableStdin=!0,r.raw.textarea&&this._attachPressAnyKeyToCloseListener(r.raw)}}):(o&&(this._processManager.processState===4||this._terminalConfigurationService.config.showExitAlert&&this.xterm?.lastInputEvent!==""?this._notificationService.notify({message:o,severity:ft.Error,actions:{primary:[this._scopedInstantiationService.createInstance(c2e)]}}):this._logService.warn(o)),this.dispose(2)),this.isDisposed&&this._onExit.dispose()}_relaunchWithShellIntegrationDisabled(e){this._shellLaunchConfig.ignoreShellIntegration=!0,this.relaunch(),this.statusList.add({id:"shell-integration-attention-needed",severity:ft.Warning,icon:L.warning,tooltip:`${e} `+d(16011,null),hoverActions:[{commandId:"workbench.action.terminal.learnMore",label:d(16017,null),run:()=>{this._openerService.open("https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration")}},{commandId:"workbench.action.openSettings",label:d(16019,null),run:()=>{this._commandService.executeCommand("workbench.action.openSettings","terminal.integrated.shellIntegration.enabled")}}]}),this._telemetryService.publicLog2("terminal/shellIntegrationFailureProcessExit")}_flushXtermData(){if(this._latestXtermWriteData===this._latestXtermParseData)return Promise.resolve();let e=0;return new Promise(t=>{let o=Ly(zi().window,()=>{(this._latestXtermWriteData===this._latestXtermParseData||++e===5)&&(o.dispose(),t())},20)})}_attachPressAnyKeyToCloseListener(e){e.textarea&&!this._pressAnyKeyToCloseListener&&(this._pressAnyKeyToCloseListener=$(e.textarea,"keypress",t=>{this._pressAnyKeyToCloseListener&&(this._pressAnyKeyToCloseListener.dispose(),this._pressAnyKeyToCloseListener=void 0,this.dispose(2),t.preventDefault())}))}_writeInitialText(e,t){if(!this._shellLaunchConfig.initialText){t?.();return}let o=We(this._shellLaunchConfig.initialText)?this._shellLaunchConfig.initialText:this._shellLaunchConfig.initialText?.text;We(this._shellLaunchConfig.initialText)||this._shellLaunchConfig.initialText.trailingNewLine?e.raw.writeln(o,t):e.raw.write(o,t)}async reuseTerminal(e,t=!1){this._pressAnyKeyToCloseListener?.dispose(),this._pressAnyKeyToCloseListener=void 0;let o=this.xterm;o&&(t||await new Promise(n=>o.raw.write(`
\x1B[G`,n)),e.initialText&&(this._shellLaunchConfig.initialText=e.initialText,await new Promise(n=>this._writeInitialText(o,n))),this._isExiting&&this._shellLaunchConfig.waitOnExit&&(o.raw.options.disableStdin=!1,this._isExiting=!1),t&&o.clearDecorations()),this.statusList.remove("relaunch-needed"),t||(e.initialText=" "),this._shellLaunchConfig=e,this._agentShellTypeFromSequence=void 0,await this._processManager.relaunch(this._shellLaunchConfig,this._cols||80,this._rows||30,t).then(n=>{n&&(yo(n,{message:!0})?this._onProcessExit(n):yo(n,{injectedArgs:!0})&&(this._injectedArgs=n.injectedArgs))})}relaunch(){let e={...this._shellLaunchConfig};delete e.attachPersistentProcess,this.reuseTerminal(e,!0)}_onTitleChange(e){this.isTitleSetByProcess&&this._setTitle(e,2);for(let[t,o]of yEn)if(o.test(e)){this._agentShellTypeFromSequence=t,this.setShellType(t);break}}_handleShellTypeChange(e){if(this._agentShellTypeFromSequence){if(e==="node"||e===void 0)return;this._agentShellTypeFromSequence=void 0}this.setShellType(e)}async _trust(){return this._configurationService.getValue("terminal.integrated.allowInUntrustedWorkspace")?(this._logService.info("Workspace trust check bypassed due to terminal.integrated.allowInUntrustedWorkspace"),!0):await this._workspaceTrustRequestService.requestWorkspaceTrust({message:d(16024,null)})===!0}async _updateProcessCwd(){if(!(this.isDisposed||this.shellLaunchConfig.customPtyImplementation))try{let e=await this._refreshProperty("cwd");if(!We(e))throw new Error(`cwd is not a string ${e}`)}catch(e){if(e instanceof Error&&e.message==="Cannot refresh property when process is not set")return;throw e}}updateConfig(){this._refreshEnvironmentVariableInfoWidgetState(this._processManager.environmentVariableInfo)}async _updateUnicodeVersion(){this._processManager.setUnicodeVersion(this._terminalConfigurationService.config.unicodeVersion)}updateAccessibilitySupport(){this.xterm.raw.options.screenReaderMode=this._accessibilityService.isScreenReaderOptimized()}layout(e){if(this._lastLayoutDimensions=e,!(this.disableLayout||e.width<=0||e.height<=0||!this._evaluateColsAndRows(e.width,e.height))){this._resize(),this._containerReadyBarrier.isOpen()||this._containerReadyBarrier.open();for(let o of this._contributions.values())this.xterm?o.layout?.(this.xterm,e):this._xtermReadyPromise.then(n=>{n&&o.layout?.(n,e)})}}async _resize(e){if(!this.xterm)return;let t=this.cols,o=this.rows;if(this._isVisible&&this._layoutSettingsChanged){let n=this.xterm.getFont(),r=this._terminalConfigurationService.config;this.xterm.raw.options.letterSpacing=n.letterSpacing,this.xterm.raw.options.lineHeight=n.lineHeight,this.xterm.raw.options.fontSize=n.fontSize,this.xterm.raw.options.fontFamily=n.fontFamily,this.xterm.raw.options.fontWeight=r.fontWeight,this.xterm.raw.options.fontWeightBold=r.fontWeightBold,this._initDimensions(),t=this.cols,o=this.rows,this._layoutSettingsChanged=!1}isNaN(t)||isNaN(o)||((t!==this.xterm.raw.cols||o!==this.xterm.raw.rows)&&((this._fixedRows||this._fixedCols)&&await this._updateProperty("fixedDimensions",{cols:this._fixedCols,rows:this._fixedRows}),this._onDimensionsChanged.fire()),Ov._lastKnownGridDimensions={cols:t,rows:o},this._resizeDebouncer.resize(t,o,e??!1))}async _updatePtyDimensions(e){if(this.isDisposed)return;let t=e.dimensions?.css.canvas.width,o=e.dimensions?.css.canvas.height,n=t?Math.round(t):void 0,r=o?Math.round(o):void 0;await this._processManager.setDimensions(e.cols,e.rows,void 0,n,r)}setShellType(e){this._shellType!==e&&(this._shellType=e,e===void 0?this._terminalShellTypeContextKey.reset():this._terminalShellTypeContextKey.set(e?.toString()),this._onDidChangeShellType.fire(e),this._labelComputer?.refreshLabel(this))}_setAriaLabel(e,t,o){let n=[];if(e&&e.textarea){o&&o.length>0?n.push(d(16029,null,t,o)):n.push(d(16028,null,t)),this._accessibilityService.isScreenReaderOptimized()||n.push(d(16026,null));let s=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getLabel();this._configurationService.getValue("accessibility.verbosity.terminal")&&s&&n.push(d(16025,null,s)),e.textarea.setAttribute("aria-label",n.join(`
`))}}_updateTitleProperties(e,t){if(!e)return this._processName;switch(t){case 1:if(this._processManager.os===1)e=Gs.parse(e).name;else{let o=e.indexOf(" ");e.startsWith("/")?e=Jo(e):o>-1&&(e=e.substring(0,o))}this._processName=e;break;case 0:this._staticTitle=e,this._messageTitleDisposable.value=void 0;break;case 2:this._sequence=e,this._processManager.os===1&&e.match(/^[a-zA-Z]:\\.+\.[a-zA-Z]{1,3}/)&&(this._sequence=Gs.parse(e).name);break}return this._titleSource=t,e}setOverrideDimensions(e,t=!1){this._dimensionsOverride&&this._dimensionsOverride.forceExactSize&&!e&&this._rows===0&&this._cols===0&&(this._cols=this._dimensionsOverride.cols,this._rows=this._dimensionsOverride.rows),this._dimensionsOverride=e,t?this._resize(!0):this._resize()}async setFixedDimensions(){let e=await this._quickInputService.input({title:d(16012,null),placeHolder:"Enter a number of columns or leave empty for automatic width",validateInput:async o=>o.length>0&&!o.match(/^\d+$/)?{content:"Enter a number or leave empty size automatically",severity:ft.Error}:void 0});if(e===void 0)return;this._fixedCols=this._parseFixedDimension(e),this._labelComputer?.refreshLabel(this),this._terminalHasFixedWidth.set(!!this._fixedCols);let t=await this._quickInputService.input({title:d(16013,null),placeHolder:"Enter a number of rows or leave empty for automatic height",validateInput:async o=>o.length>0&&!o.match(/^\d+$/)?{content:"Enter a number or leave empty size automatically",severity:ft.Error}:void 0});t!==void 0&&(this._fixedRows=this._parseFixedDimension(t),this._labelComputer?.refreshLabel(this),await this._refreshScrollbar(),this._resize(),this.focus())}_parseFixedDimension(e){if(e==="")return;let t=parseInt(e);if(t<=0)throw new Error(`Could not parse dimension "${e}"`);return t}async toggleSizeToContentWidth(){if(this.xterm?.raw.buffer.active){if(this._hasScrollBar)this._terminalHasFixedWidth.set(!1),this._fixedCols=void 0,this._fixedRows=void 0,this._hasScrollBar=!1,this._initDimensions(),await this._resize();else{let e=this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Me(this.domElement)),t=Math.floor(4096/(e.charWidth??20)),o=Math.max(this.maxCols,Math.min(this.xterm.getLongestViewportWrappedLineLength(),t));o>this.xterm.raw.cols&&(this._fixedCols=o)}await this._refreshScrollbar(),this._labelComputer?.refreshLabel(this),this.focus()}}_refreshScrollbar(){return this._fixedCols||this._fixedRows?this._addScrollbar():this._removeScrollbar()}async _addScrollbar(){let e=(this.xterm?this.xterm.getFont():this._terminalConfigurationService.getFont(Me(this.domElement))).charWidth;if(!(!this.xterm?.raw.element||!this._container||!e||!this._fixedCols)&&(this._wrapperElement.classList.add("fixed-dims"),this._hasScrollBar=!0,this._initDimensions(),await this._resize(),this._terminalHasFixedWidth.set(!0),this._horizontalScrollbar||(this._horizontalScrollbar=this._register(new Ar(this._wrapperElement,{vertical:2,horizontal:1,useShadows:!1,scrollYToX:!1,consumeMouseWheelIfScrollbarIsNeeded:!1})),this._container.appendChild(this._horizontalScrollbar.getDomNode())),this._horizontalScrollbar.setScrollDimensions({width:this.xterm.raw.element.clientWidth,scrollWidth:this._fixedCols*e+40}),this._horizontalScrollbar.getDomNode().style.paddingBottom="16px",ii))for(let t=this.xterm.raw.buffer.active.viewportY;t<this.xterm.raw.buffer.active.length;t++){let o=this.xterm.raw.buffer.active.getLine(t);o._line.isWrapped=!1}}async _removeScrollbar(){!this._container||!this._horizontalScrollbar||(this._horizontalScrollbar.getDomNode().remove(),this._horizontalScrollbar.dispose(),this._horizontalScrollbar=void 0,this._wrapperElement.remove(),this._wrapperElement.classList.remove("fixed-dims"),this._container.appendChild(this._wrapperElement))}_setResolvedShellLaunchConfig(e){this._shellLaunchConfig.args=e.args,this._shellLaunchConfig.cwd=e.cwd,this._shellLaunchConfig.executable=e.executable,this._shellLaunchConfig.env=e.env}_onEnvironmentVariableInfoChanged(e){e.requiresAction&&this.xterm?.raw.textarea?.setAttribute("aria-label",d(16027,null,this._instanceId)),this._refreshEnvironmentVariableInfoWidgetState(e)}async _refreshEnvironmentVariableInfoWidgetState(e){if(!e){this.statusList.remove("relaunch-needed"),this.statusList.remove("env-var-info-changes-active");return}if(e.requiresAction&&this._terminalConfigurationService.config.environmentChangesRelaunch&&!this._processManager.hasWrittenData&&(!this._shellLaunchConfig.isFeatureTerminal||this.reconnectionProperties&&this._configurationService.getValue("task.reconnection")===!0)&&!this._shellLaunchConfig.customPtyImplementation&&!this._shellLaunchConfig.isExtensionOwnedTerminal&&!this._shellLaunchConfig.attachPersistentProcess&&!(this._processManager.remoteAuthority&&await this._processManager.getBackendOS()===1&&this._processManager.processTraits?.windowsPty?.buildNumber&&this._processManager.processTraits.windowsPty.buildNumber>=18309)){this.relaunch();return}let t=g6(this.shellLaunchConfig.cwd,this._workspaceContextService,this._historyService);this.statusList.add(e.getStatus({workspaceFolder:t}))}async getInitialCwd(){return this._initialCwd||(this._initialCwd=this._processManager.initialCwd),this._initialCwd}async getSpeculativeCwd(){return this.capabilities.has(0)?this.capabilities.get(0).getCwd():this.capabilities.has(1)?this.capabilities.get(1).getCwd():this._processManager.initialCwd}async getCwdResource(){let e=this.capabilities.get(0)?.getCwd();if(!e)return;let t;if(this.remoteAuthority?t=await this._pathService.fileURI(e):t=A.file(e),await this._fileService.exists(t))return t}async _refreshProperty(e){return await this.processReady,this._processManager.refreshProperty(e)}async _updateProperty(e,t){return this._processManager.updateProperty(e,t)}async rename(e,t){this._setTitle(e,t??0)}_setTitle(e,t){if((this._shellLaunchConfig?.type==="Task"||this._titleSource===0)&&t===1)return;let o=!e;e=this._updateTitleProperties(e,t);let n=e!==this._title;this._title=e,this._labelComputer?.refreshLabel(this,o),this._setAriaLabel(this.xterm?.raw,this._instanceId,this._title),n&&this._onTitleChanged.fire(this)}async changeIcon(e){if(e)return this._icon=e,this._onIconChanged.fire({instance:this,userInitiated:!0}),e;let t=this._scopedInstantiationService.createInstance(I2e),o=await t.pickIcons();if(t.dispose(),!!o)return this._icon=o,this._onIconChanged.fire({instance:this,userInitiated:!0}),o}async changeColor(e,t){if(e)return this.shellLaunchConfig.color=e,this._onIconChanged.fire({instance:this,userInitiated:!0}),e;if(t){this.shellLaunchConfig.color="",this._onIconChanged.fire({instance:this,userInitiated:!0});return}if(!this._getIcon())return;let n=this._themeService.getColorTheme(),r=VNt(n),s=dRe(n),l=[];for(let g of r){let f=lw(g);l.push({label:`$(${L.circleFilled.id}) ${g.replace("terminal.ansi","")}`,id:g,description:g,iconClasses:[f]})}l.push({type:"separator"});let c={label:"Reset to default"};l.push(c);let u=[],p=this._quickInputService.createQuickPick({useSeparators:!0});u.push(p),p.items=l,p.matchOnDescription=!0,p.placeholder=d(16006,null),p.show();let h=await new Promise(g=>{u.push(p.onDidHide(()=>g(void 0))),u.push(p.onDidAccept(()=>g(p.selectedItems[0])))});return je(u),h&&(this.shellLaunchConfig.color=h.id,this._onIconChanged.fire({instance:this,userInitiated:!0})),p.hide(),s.dispose(),h?.id}forceScrollbarVisibility(){this._wrapperElement.classList.add("force-scrollbar")}resetScrollbarVisibility(){this._wrapperElement.classList.remove("force-scrollbar")}setParentContextKeyService(e){this._scopedContextKeyService.updateParent(e)}async handleMouseEvent(e,t){if(go(e.target)&&(e.target.classList.contains("scrollbar")||e.target.classList.contains("slider")))return{cancelContextMenu:!0};for(let o of this._contributions.values())if((await o.handleMouseEvent?.(e))?.handled)return{cancelContextMenu:!0};if(e.which===2){switch(this._terminalConfigurationService.config.middleClickBehavior){default:this.focus();break}return}if(e.which===3){if(e.shiftKey){d7(zi(),e,this,t,this._contextMenuService);return}if(this._terminalConfigurationService.config.rightClickBehavior==="nothing")return e.shiftKey?void 0:{cancelContextMenu:!0}}}};I([Tu(50)],Ov.prototype,"_fireMaximumDimensionsChanged",1),I([Tu(500)],Ov.prototype,"_refreshShellIntegrationInfoStatus",1),I([Tu(1e3)],Ov.prototype,"relaunch",1),I([Tu(2e3)],Ov.prototype,"_updateProcessCwd",1),Ov=I([m(2,X),m(3,Xe),m(4,F),m(5,mp),m(6,ig),m(7,Pn),m(8,ge),m(9,Le),m(10,Ne),m(11,Qo),m(12,Gt),m(13,Pe),m(14,B),m(15,wa),m(16,de),m(17,Ai),m(18,Ze),m(19,$e),m(20,Mt),m(21,Ae),m(22,ie),m(23,lp),m(24,fa),m(25,_e),m(26,Je),m(27,fe),m(28,br),m(29,ji)],Ov);var Spt=class extends k{constructor(e,t,o){super();this._container=e;this._layoutService=t;this._viewDescriptorService=o;this._onDropFile=this._register(new T);this._onDropTerminal=this._register(new T);this._register(ee(()=>this._clearDropOverlay()))}get onDropFile(){return this._onDropFile.event}get onDropTerminal(){return this._onDropTerminal.event}_clearDropOverlay(){this._dropOverlay?.remove(),this._dropOverlay=void 0}onDragEnter(e){if(Up(e,Fl.FILES,Fl.RESOURCES,"Terminals",Mc.FILES)){if(this._dropOverlay||(this._dropOverlay=document.createElement("div"),this._dropOverlay.classList.add("terminal-drop-overlay")),Up(e,"Terminals")){let t=this._getDropSide(e);this._dropOverlay.classList.toggle("drop-before",t==="before"),this._dropOverlay.classList.toggle("drop-after",t==="after")}this._dropOverlay.parentElement||this._container.appendChild(this._dropOverlay)}}onDragLeave(e){this._clearDropOverlay()}onDragEnd(e){this._clearDropOverlay()}onDragOver(e){if(!(!e.dataTransfer||!this._dropOverlay)){if(Up(e,"Terminals")){let t=this._getDropSide(e);this._dropOverlay.classList.toggle("drop-before",t==="before"),this._dropOverlay.classList.toggle("drop-after",t==="after")}this._dropOverlay.style.opacity="1"}}async onDrop(e){if(this._clearDropOverlay(),!e.dataTransfer)return;let t=lze(e);if(t){for(let s of t){let l=this._getDropSide(e);this._onDropTerminal.fire({uri:s,side:l})}return}let o,n=e.dataTransfer.getData(Fl.RESOURCES);n&&(o=A.parse(JSON.parse(n)[0]));let r=e.dataTransfer.getData(Mc.FILES);!o&&r&&(o=A.file(JSON.parse(r)[0])),!o&&e.dataTransfer.files.length>0&&wD(e.dataTransfer.files[0])&&(o=A.file(wD(e.dataTransfer.files[0]))),o&&this._onDropFile.fire(o)}_getDropSide(e){let t=this._container;if(!t)return"after";let o=t.getBoundingClientRect();return this._getViewOrientation()===1?e.clientX-o.left<o.width/2?"before":"after":e.clientY-o.top<o.height/2?"before":"after"}_getViewOrientation(){let e=this._layoutService.getPanelPosition();return this._viewDescriptorService.getViewLocationById(Fc)===1&&eg(e)?1:0}};Spt=I([m(1,wi),m(2,ji)],Spt);var nIe=class extends k{constructor(e,t,o){super();this._fileService=e;this._terminalConfigurationService=t;this._workspaceContextService=o;this._title="";this._description="";this._onDidChangeLabel=this._register(new T);this.onDidChangeLabel=this._onDidChangeLabel.event}get title(){return this._title}get description(){return this._description}static{this.agentCliShellTypes=new Set(["claude","codex","copilot","gemini"])}refreshLabel(e,t){let o=this._terminalConfigurationService.config.tabs,n=o.allowAgentCliTitle&&nIe.agentCliShellTypes.has(e.shellType),r=e.shellLaunchConfig.titleTemplate??(n?"${sequence}":o.title);this._title=this.computeLabel(e,r,"title",t),this._description=this.computeLabel(e,o.description,"description"),(this._title!==e.title||this._description!==e.description||t)&&this._onDidChangeLabel.fire({title:this._title,description:this._description})}computeLabel(e,t,o,n){let r=e.shellLaunchConfig.attachPersistentProcess?.type||e.shellLaunchConfig.type,s=e.capabilities.get(2),l=s?.promptInputModel,c=r==="Task"?"":" $(loading~spin)",u={cwd:e.cwd||e.initialCwd||"",cwdFolder:"",workspaceFolderName:e.workspaceFolder?.name,workspaceFolder:e.workspaceFolder?Jo(e.workspaceFolder.uri.fsPath):void 0,local:r==="Local"?vr.typeLocal:void 0,process:e.processName,sequence:e.sequence,task:r==="Task"?vr.typeTask:void 0,fixedDimensions:e.fixedCols?e.fixedRows?`\u2194${e.fixedCols} \u2195${e.fixedRows}`:`\u2194${e.fixedCols}`:e.fixedRows?`\u2195${e.fixedRows}`:"",separator:{label:this._terminalConfigurationService.config.tabs.separator},shellType:e.shellType,shellCommand:s?.executingCommand&&s.executingCommandConfidence==="high"&&l?l.value+c:void 0,shellPromptInput:s?.executingCommand&&l?l.getCombinedString(!0)+c:l?.getCombinedString(!0),progress:this._getProgressStateString(e.progressState)};if(u.workspaceFolderName=e.workspaceFolder?.name??u.workspaceFolder,t=t.trim(),!t)return o==="title"&&e.processName||"";if(!n&&e.staticTitle&&o==="title")return e.staticTitle.replace(/[\n\r\t]/g,"")||u.process?.replace(/[\n\r\t]/g,"")||"";let p=e.capabilities.has(0)||e.capabilities.has(1),g=this._workspaceContextService.getWorkspace().folders.length>1;if(u.cwd&&p&&(!e.shellLaunchConfig.isFeatureTerminal||o==="title")){let v=A.from({scheme:e.workspaceFolder?.uri.scheme||Q.file,path:e.cwd?uA(e.cwd):void 0}),b=!1;if(g)b=!0;else if(e.workspaceFolder?.uri){let S=this._fileService.hasCapability(e.workspaceFolder.uri,1024);b=v.fsPath.localeCompare(e.workspaceFolder.uri.fsPath,void 0,{sensitivity:S?"case":"base"})!==0}b&&(u.cwdFolder=Jo(u.cwd))}let f=Fyt(t,u).replace(/[\n\r\t]/g,"").trim();return f===""&&o==="title"?e.processName||"":f}_getProgressStateString(e){if(!e)return"";switch(e.state){case 0:return"";case 1:return`${Math.round(e.value)}%`;case 2:return"$(error)";case 3:return"$(loading~spin)";case 4:return"$(alert)"}}};nIe=I([m(0,ge),m(1,mp),m(2,Ae)],nIe);function wEn(a,i,e,t){if(a===void 0||a===0)return{code:a,message:void 0};let o=on(a)?a:a.code,n;switch(typeof a){case"number":{let r;i.executable&&(r=i.executable,We(i.args)?r+=` ${i.args}`:i.args&&i.args.length&&(r+=i.args.map(s=>` '${s}'`).join())),e===4?r?n=d(16009,null,r,o):n=d(16010,null,o):r?n=d(16030,null,r,o):n=d(16031,null,o);break}case"object":{if(a.message.toString().includes("Could not find pty with id"))break;let r=a.message,s=a.message.match(/.*error code:\s*(\d+).*$/);if(s)switch(s.length>1?parseInt(s[1]):void 0){case 5:r=`Access was denied to the path containing your executable "${i.executable}". Manage and change your permissions to get this to work`;break;case 267:r=`Invalid starting directory "${t}", review your terminal.integrated.cwd setting`;break;case 1260:r="Windows cannot open this program because it has been prevented by a software restriction policy. For more information, open Event Viewer or contact your system Administrator";break}n=d(16008,null,r);break}}return{code:o,message:n}}var rIe=class{constructor(i,e){this._target=i;this._viewDescriptorService=e}getBackgroundColor(i){let e=i.getColor(fee);return e||(this._target.object===2?i.getColor(Bo):this._viewDescriptorService.getViewLocationById(Fc)===1?i.getColor(GI):i.getColor(ch))}};rIe=I([m(1,ji)],rIe);function CEn(a,i){let e=Jo(i),t=new Map([["julia",/^julia$/],["node",/^node$/],["nu",/^nu$/],["pwsh",/^pwsh(-preview)?|powershell$/],["python",/^py(?:thon)?$/],["xonsh",/^xonsh/]]);for(let[o,n]of t)if(e.match(n))return o;if(a===1){let o=new Map([["cmd",/^cmd$/],["gitbash",/^bash$/],["wsl",/^wsl$/]]);for(let[n,r]of o)if(e.match(r))return n}else{let o=["bash","csh","fish","ksh","sh","zsh"];for(let n of o)if(e===n)return n}}var sIe=class extends k{constructor(e,t,o){super();this._instantiationService=e;this._contextKeyService=t;this._backendRegistration=new Map;this._onDidCreateInstance=this._register(new T);this._onDidRegisterBackend=this._register(new T);this._terminalShellTypeContextKey=pt.shellType.bindTo(this._contextKeyService);for(let n of[void 0,o.remoteAuthority]){let{promise:r,resolve:s}=Ey();this._backendRegistration.set(n,{promise:r,resolve:s})}}get onDidCreateInstance(){return this._onDidCreateInstance.event}get onDidRegisterBackend(){return this._onDidRegisterBackend.event}createInstance(e,t){let o=this.convertProfileToShellLaunchConfig(e),n=this._instantiationService.createInstance(Ov,this._terminalShellTypeContextKey,o);return n.target=t,this._onDidCreateInstance.fire(n),n}convertProfileToShellLaunchConfig(e,t){if(e&&yo(e,{profileName:!0})){let o=e;return o.path?{executable:o.path,args:o.args,env:o.env,icon:o.icon,color:o.color,name:o.overrideName?o.profileName:void 0,cwd:t}:e}return e?(t&&(e.cwd=t),e):{}}async getBackend(e){let t=oe.as(HH.Backend).getTerminalBackend(e);return t||(await this._backendRegistration.get(e)?.promise,t=oe.as(HH.Backend).getTerminalBackend(e)),t}getRegisteredBackends(){return oe.as(HH.Backend).backends.values()}didRegisterBackend(e){this._backendRegistration.get(e.remoteAuthority)?.resolve(),this._onDidRegisterBackend.fire(e)}};sIe=I([m(0,F),m(1,X),m(2,Mt)],sIe);Ce(uh,sIe,1);var aIe=class extends k{static{this.ID="terminalMain"}constructor(i,e,t,o,n,r,s,l,c){super(),this._init(i,e,t,o,n,r,s,l,c)}async _init(i,e,t,o,n,r,s,l,c){this._register(e.onDidCreateTerminal(async u=>{let p=await r.createTerminal({config:u,location:1,skipContributedProfileCheck:!0});r.setActiveInstance(p),await r.revealActiveTerminal()})),await n.when(3),this._register(i.registerEditor(`${Q.vscodeTerminal}:/**`,{id:sG,label:vr.terminal,priority:"exclusive"},{canSupportResource:u=>u.scheme===Q.vscodeTerminal,singlePerResource:!0},{createEditorInput:async({resource:u,options:p})=>{let h=r.getInstanceFromResource(u);if(h)l.getGroupForInstance(h)?.removeInstance(h);else{let v=G$(u);if(!v.instanceId)throw new Error("Terminal identifier without instanceId");let b=r.getPrimaryBackend();if(!b)throw new Error("No terminal primary backend");let S=await b.requestDetachInstance(v.workspaceId,v.instanceId);if(!S)throw new Error("No terminal persistent process to attach");h=c.createInstance({attachPersistentProcess:S},2)}let g=s.resolveResource(h);return{editor:s.getInputFromResource(g),options:{...p,pinned:!0,forceReload:!0,override:sG}}}})),this._register(o.registerFormatter({scheme:Q.vscodeTerminal,formatting:{label:"${path}",separator:""}}))}};aIe=I([m(0,il),m(1,mDi),m(2,Mt),m(3,nt),m(4,to),m(5,an),m(6,hb),m(7,Cc),m(8,uh)],aIe);var xEn=zn.registerExtensionPoint(odo),y2e=le("terminalContributionsService"),k7t=class{constructor(){this._terminalProfiles=[];this._terminalCompletionProviders=[];this._onDidChangeTerminalCompletionProviders=new T;this.onDidChangeTerminalCompletionProviders=this._onDidChangeTerminalCompletionProviders.event;xEn.setHandler(i=>{this._terminalProfiles=i.map(e=>e.value?.profiles?.filter(t=>kEn(t)).map(t=>({...t,extensionIdentifier:e.description.identifier.value}))||[]).flat(),this._terminalCompletionProviders=i.map(e=>Va(e.description,"terminalCompletionProvider")?e.value?.completionProviders?.map(t=>({...t,extensionIdentifier:e.description.identifier.value}))||[]:[]).flat(),this._onDidChangeTerminalCompletionProviders.fire()})}get terminalProfiles(){return this._terminalProfiles}get terminalCompletionProviders(){return this._terminalCompletionProviders}};function kEn(a){function i(e){return Di(e)&&"light"in e&&A.isUri(e.light)&&"dark"in e&&A.isUri(e.dark)}return!a.icon||We(a.icon)||A.isUri(a.icon)||i(a.icon)}var lIe=class extends k{constructor(e,t,o,n,r,s,l){super();this._contextKeyService=e;this._configurationService=t;this._terminalContributionService=o;this._extensionService=n;this._remoteAgentService=r;this._environmentService=s;this._terminalInstanceService=l;this._contributedProfiles=[];this._internalContributedProfiles=[];this._platformConfigJustRefreshed=!1;this._refreshTerminalActionsDisposable=this._register(new ue);this._profileProviders=new Map;this._onDidChangeAvailableProfiles=this._register(new T);this._register(this._extensionService.onDidChangeExtensions(()=>this.refreshAvailableProfiles())),this._webExtensionContributedProfileContextKey=pt.webExtensionContributedProfile.bindTo(this._contextKeyService),this._updateWebContextKey(),this._profilesReadyPromise=this._remoteAgentService.getEnvironment().then(()=>(this._profilesReadyBarrier=new t5(2e4),this._profilesReadyBarrier.wait().then(()=>{}))),this.refreshAvailableProfiles(),this._setupConfigListener()}get onDidChangeAvailableProfiles(){return this._onDidChangeAvailableProfiles.event}get profilesReady(){return this._profilesReadyPromise}get availableProfiles(){return this._platformConfigJustRefreshed||this.refreshAvailableProfiles(),this._availableProfiles||[]}get contributedProfiles(){let e=this._availableProfiles?.map(t=>t.profileName)||[];return this._contributedProfiles?.filter(t=>!e.includes(t.title))||[]}async _setupConfigListener(){let e=await this.getPlatformKey();this._register(this._configurationService.onDidChangeConfiguration(async t=>{(t.affectsConfiguration("terminal.integrated.automationProfile."+e)||t.affectsConfiguration("terminal.integrated.defaultProfile."+e)||t.affectsConfiguration("terminal.integrated.profiles."+e)||t.affectsConfiguration("terminal.integrated.useWslProfiles"))&&(t.source!==7?(this.refreshAvailableProfiles(),this._platformConfigJustRefreshed=!1):this._platformConfigJustRefreshed=!0)}))}getDefaultProfileName(){return this._defaultProfileName}getDefaultProfile(e){let t;if(e){if(t=this._configurationService.getValue(`terminal.integrated.defaultProfile.${this._getOsKey(e)}`),!t||!We(t))return}else t=this._defaultProfileName;if(t)return this.availableProfiles.find(o=>o.profileName===t&&!o.isAutoDetected)}_getOsKey(e){switch(e){case 3:return"linux";case 2:return"osx";case 1:return"windows"}}refreshAvailableProfiles(){this._refreshAvailableProfilesNow()}async _refreshAvailableProfilesNow(){let e=await this._detectProfiles(!0),t=!eo(e,this._availableProfiles,TEn),o=await this._updateContributedProfiles(),n=await this.getPlatformKey(),r=this._configurationService.getValue(`terminal.integrated.automationProfile.${n}`),s=!Qi(r,this._automationProfile);(t||o||s)&&(this._availableProfiles=e,this._automationProfile=r,this._onDidChangeAvailableProfiles.fire(this._availableProfiles),this._profilesReadyBarrier.open(),this._updateWebContextKey(),await this._refreshPlatformConfig(this._availableProfiles))}async _updateContributedProfiles(){let e=await this.getPlatformKey(),t=[],o=this._configurationService.getValue("terminal.integrated.profiles."+e);for(let[s,l]of Object.entries(o))l===null&&t.push(s);let n=[...Array.from(this._terminalContributionService.terminalProfiles.filter(s=>!t.includes(s.title))),...this._internalContributedProfiles.filter(s=>!t.includes(s.title))],r=!eo(n,this._contributedProfiles,_En);return this._contributedProfiles=n,r}getContributedProfileProvider(e,t){return this._profileProviders.get(e)?.get(t)}async _detectProfiles(e){if(Ft&&!this._environmentService.remoteAuthority&&!([...this._terminalInstanceService.getRegisteredBackends()].length>0))return this._availableProfiles||[];let t=await this._terminalInstanceService.getBackend(this._environmentService.remoteAuthority);if(!t)return this._availableProfiles||[];let o=await this.getPlatformKey();return this._defaultProfileName=this._configurationService.getValue(`terminal.integrated.defaultProfile.${o}`)??void 0,t.getProfiles(this._configurationService.getValue(`terminal.integrated.profiles.${o}`),this._defaultProfileName,e)}_updateWebContextKey(){this._webExtensionContributedProfileContextKey.set(Ft&&this._contributedProfiles.length>0)}async _refreshPlatformConfig(e){let t=await this._remoteAgentService.getEnvironment();nyi({os:t?.os||Ao,profiles:e},this._contributedProfiles),this._refreshTerminalActionsDisposable.value=OKi(e)}async getPlatformKey(){let e=await this._remoteAgentService.getEnvironment();return e?e.os===1?"windows":e.os===2?"osx":"linux":ii?"windows":et?"osx":"linux"}registerTerminalProfileProvider(e,t,o){let n=this._profileProviders.get(e);return n||(n=new Map,this._profileProviders.set(e,n)),n.set(t,o),ee(()=>this._profileProviders.delete(t))}async registerContributedProfile(e){let t=await this.getPlatformKey(),o=await this._configurationService.getValue(`terminal.integrated.profiles.${t}`);if(typeof o=="object"){let n={extensionIdentifier:e.extensionIdentifier,icon:e.options.icon,id:e.id,title:e.title,color:e.options.color,titleTemplate:e.titleTemplate};o[e.title]=n}await this._configurationService.updateValue(`terminal.integrated.profiles.${t}`,o,2)}registerInternalContributedProfile(e){return this._internalContributedProfiles.push(e),this.refreshAvailableProfiles(),ee(()=>{let t=this._internalContributedProfiles.indexOf(e);t>=0&&(this._internalContributedProfiles.splice(t,1),this.refreshAvailableProfiles())})}overrideDefaultProfile(e,t){return this._defaultProfileOverride={extensionIdentifier:e,id:t},ee(()=>{this._defaultProfileOverride?.extensionIdentifier===e&&this._defaultProfileOverride?.id===t&&(this._defaultProfileOverride=void 0)})}async getContributedDefaultProfile(e){if(e&&!e.extHostTerminalId&&!yo(e,{executable:!0})){if(this._defaultProfileOverride){let r=this.contributedProfiles.find(s=>s.extensionIdentifier===this._defaultProfileOverride.extensionIdentifier&&s.id===this._defaultProfileOverride.id);if(r)return r}let t=await this.getPlatformKey(),o=this._configurationService.getValue(`terminal.integrated.defaultProfile.${t}`);return this.contributedProfiles.find(r=>r.title===o)}}};I([DA(2e3)],lIe.prototype,"refreshAvailableProfiles",1),lIe=I([m(0,X),m(1,B),m(2,y2e),m(3,lt),m(4,bo),m(5,Mt),m(6,uh)],lIe);function TEn(a,i){return a.profileName===i.profileName&&Aco(a.args,i.args)&&a.color===i.color&&Nco(a.icon,i.icon)&&a.isAutoDetected===i.isAutoDetected&&a.isDefault===i.isDefault&&a.overrideName===i.overrideName&&a.path===i.path}function _En(a,i){return a.extensionIdentifier===i.extensionIdentifier&&a.color===i.color&&a.icon===i.icon&&a.id===i.id&&a.title===i.title&&a.titleTemplate===i.titleTemplate}var w2e=class{constructor(i,e,t,o,n,r){this._terminalProfileService=i;this._terminalProfileResolverService=e;this._configurationService=t;this._quickInputService=o;this._themeService=n;this._notificationService=r}async showAndGetResult(i){let e=await this._terminalProfileService.getPlatformKey(),t="terminal.integrated.profiles."+e,o=await this._createAndShow(i),n=`terminal.integrated.defaultProfile.${e}`;if(o){if(i==="setDefault"){if(yo(o.profile,{id:!0}))return await this._configurationService.updateValue(n,o.profile.title,2),{config:{extensionIdentifier:o.profile.extensionIdentifier,id:o.profile.id,title:o.profile.title,options:{color:o.profile.color,icon:o.profile.icon}},keyMods:o.keyMods};if(yo(o.profile,{profileName:!0})){let r=await this._configurationService.getValue(t);if(typeof r=="object"){let s={path:o.profile.path};o.profile.args&&(s.args=o.profile.args),r[o.profile.profileName]=this._createNewProfileConfig(o.profile),await this._configurationService.updateValue(t,r,2)}}await this._configurationService.updateValue(n,o.profileName,2)}else if(i==="createInstance")if(yo(o.profile,{id:!0})){let r={extensionIdentifier:o.profile.extensionIdentifier,id:o.profile.id,title:o.profile.title,options:{icon:o.profile.icon,color:o.profile.color}};return o.profile.titleTemplate!==void 0&&(r.titleTemplate=o.profile.titleTemplate),{config:r,keyMods:o.keyMods}}else return{config:o.profile,keyMods:o.keyMods};return yo(o.profile,{profileName:!0})?o.profile.profileName:o.profile.title}}async _createAndShow(i){let e=await this._terminalProfileService.getPlatformKey(),t=this._terminalProfileService.availableProfiles,o="terminal.integrated.profiles."+e,n=this._terminalProfileService.getDefaultProfileName(),r,s={placeHolder:i==="createInstance"?d(16071,null):d(16070,null),onDidTriggerItemButton:async f=>{if(!await this._isProfileSafe(f.item.profile)||yo(f.item.profile,{id:!0}))return;let v=this._configurationService.getValue("terminal.integrated.profiles."+e),b=v?Object.keys(v):[],S=await this._quickInputService.input({prompt:d(16068,null),value:f.item.profile.profileName,validateInput:async w=>{if(b.includes(w))return d(16072,null)}});if(!S)return;let y={...v,[S]:this._createNewProfileConfig(f.item.profile)};await this._configurationService.updateValue(o,y,2)},onKeyMods:f=>r=f},l=[],c=t.filter(f=>!f.isAutoDetected),u=t.filter(f=>f.isAutoDetected);c.length>0&&(l.push({type:"separator",label:d(16073,null)}),l.push(...this._sortProfileQuickPickItems(c.map(f=>this._createProfileQuickPickItem(f)),n))),l.push({type:"separator",label:d(16069,null)});let p=[];for(let f of this._terminalProfileService.contributedProfiles){let v;We(f.icon)&&(f.icon.startsWith("$(")?v=q.fromString(f.icon):v=q.fromId(f.icon)),(!v||!Zw().getIcon(v.id))&&(v=this._terminalProfileResolverService.getDefaultIcon());let b=mR(f,this._themeService.getColorTheme().type,!0),S=lw(f),y=[];b&&y.push(...b),S&&y.push(S),p.push({label:`$(${v.id}) ${f.title}`,profile:{extensionIdentifier:f.extensionIdentifier,title:f.title,icon:f.icon,id:f.id,color:f.color,titleTemplate:f.titleTemplate},profileName:f.title,iconClasses:y})}p.length>0&&l.push(...this._sortProfileQuickPickItems(p,n)),u.length>0&&(l.push({type:"separator",label:d(16074,null)}),l.push(...this._sortProfileQuickPickItems(u.map(f=>this._createProfileQuickPickItem(f)),n)));let h=dRe(this._themeService.getColorTheme()),g=await this._quickInputService.pick(l,s);if(h.dispose(),!!g&&await this._isProfileSafe(g.profile))return r&&(g.keyMods=r),g}_createNewProfileConfig(i){let e={path:i.path};return i.args&&(e.args=i.args),i.env&&(e.env=i.env),e}async _isProfileSafe(i){let e=yo(i,{profileName:!0})&&i.isUnsafePath,t=yo(i,{profileName:!0})&&i.requiresUnsafePath;return!e&&!t?!0:await new Promise(o=>{let n=[];e&&n.push(i.path),t&&n.push(t);let r=this._notificationService.prompt(ft.Warning,d(16075,null,`"${n.join(",")}"`),[{label:d(16076,null),run:()=>o(!0)},{label:d(16066,null),run:()=>o(!1)}]);U.once(r.onDidClose)(()=>{o(!1)})})}_createProfileQuickPickItem(i){let e=[{iconClass:q.asClassName(wEo),tooltip:d(16067,null)}],o=`$(${(i.icon&&q.isThemeIcon(i.icon)?i.icon:L.terminal).id}) ${i.profileName}`,n=i.isFromPath?Jo(i.path):i.path,r=lw(i),s=[];if(r&&s.push(r),i.args){if(We(i.args))return{label:o,description:`${i.path} ${i.args}`,profile:i,profileName:i.profileName,buttons:e,iconClasses:s};let l=i.args.map(c=>c.includes(" ")?`"${c.replace(/"/g,'\\"')}"`:c).join(" ");return{label:o,description:`${n} ${l}`,profile:i,profileName:i.profileName,buttons:e,iconClasses:s}}return{label:o,description:n,profile:i,profileName:i.profileName,buttons:e,iconClasses:s}}_sortProfileQuickPickItems(i,e){return i.sort((t,o)=>o.profileName===e?1:t.profileName===e?-1:t.profileName.localeCompare(o.profileName))}};w2e=I([m(0,fb),m(1,ig),m(2,B),m(3,$e),m(4,Pe),m(5,Ne)],w2e);function uFo(a,i,e,t,o){let n=new O,r=n.add(new Cy),s=n.add(new Ot);function l(p,h){let g=r.add(U.map(o(h),v=>({instance:p,data:v}))),f=s.get(p.instanceId);f||(f=new Ot,s.set(p.instanceId,f)),f.set(h,g)}for(let p of a){let h=p.capabilities.get(t);h&&l(p,h)}n.add(e(p=>{s.deleteAndDispose(p.instanceId)}));let c=n.add(new Tle(a,i,e,p=>U.map(p.capabilities.createOnDidAddCapabilityOfTypeEvent(t),h=>({instance:p,changeEvent:h}))));n.add(c.event(p=>{l(p.instance,p.changeEvent)}));let u=n.add(new Tle(a,i,e,p=>U.map(p.capabilities.createOnDidRemoveCapabilityOfTypeEvent(t),h=>({instance:p,changeEvent:h}))));return n.add(u.event(p=>{s.get(p.instance.instanceId)?.deleteAndDispose(p.changeEvent)})),{dispose:()=>n.dispose(),event:r.event}}var JC=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M){super();this._contextKeyService=e;this._lifecycleService=t;this._logService=o;this._dialogService=n;this._instantiationService=r;this._remoteAgentService=s;this._configurationService=l;this._environmentService=c;this._terminalConfigurationService=u;this._terminalEditorService=p;this._terminalGroupService=h;this._terminalInstanceService=g;this._editorGroupsService=f;this._terminalProfileService=v;this._extensionService=b;this._notificationService=S;this._workspaceContextService=y;this._commandService=w;this._keybindingService=x;this._timerService=E;this._themeService=M;this._hostActiveTerminals=new Map;this._detachedXterms=new Set;this._detachedListenersRegistered=!1;this._isShuttingDown=!1;this._backgroundedTerminalInstances=[];this._backgroundedTerminalDisposables=new Map;this._connectionState=0;this._whenConnected=new Mo;this._restoredGroupCount=0;this._reconnectedTerminals=new Map;this._onDidCreateInstance=this._register(new T);this._onDidChangeInstanceDimensions=this._register(new T);this._onDidRegisterProcessSupport=this._register(new T);this._onDidChangeConnectionState=this._register(new T);this._onDidRequestStartExtensionTerminal=this._register(new T);this._onDidDisposeInstance=this._register(new T);this._onDidFocusInstance=this._register(new T);this._onDidChangeActiveInstance=this._register(new T);this._onDidChangeInstances=this._register(new T);this._onDidChangeInstanceCapability=this._register(new T);this._onDidChangeActiveGroup=this._register(new T);this._register(this.onDidCreateInstance(()=>this._terminalProfileService.refreshAvailableProfiles())),this._forwardInstanceHostEvents(this._terminalGroupService),this._forwardInstanceHostEvents(this._terminalEditorService),this._register(this._terminalGroupService.onDidChangeActiveGroup(this._onDidChangeActiveGroup.fire,this._onDidChangeActiveGroup)),this._register(this._terminalInstanceService.onDidCreateInstance(N=>{this._initInstanceListeners(N),this._onDidCreateInstance.fire(N)})),this._register(this._terminalGroupService.onDidChangeActiveInstance(N=>{!N&&!this._isShuttingDown&&this._terminalConfigurationService.config.hideOnLastClosed&&this._terminalGroupService.hidePanel(),N?.shellType?this._terminalShellTypeContextKey.set(N.shellType.toString()):(!N||!N.shellType)&&this._terminalShellTypeContextKey.reset()})),this._handleInstanceContextKeys(),this._terminalShellTypeContextKey=pt.shellType.bindTo(this._contextKeyService),this._processSupportContextKey=pt.processSupported.bindTo(this._contextKeyService),this._processSupportContextKey.set(!Ft||this._remoteAgentService.getConnection()!==null),this._terminalHasBeenCreated=pt.terminalHasBeenCreated.bindTo(this._contextKeyService),this._terminalCountContextKey=pt.count.bindTo(this._contextKeyService),this._register(t.onBeforeShutdown(async N=>N.veto(this._onBeforeShutdown(N.reason),"veto.terminal"))),this._register(t.onWillShutdown(N=>this._onWillShutdown(N))),this._initializePrimaryBackend(),Li(0).then(()=>this._register(this._instantiationService.createInstance(Ipt,ut.document.head)))}get isProcessSupportRegistered(){return!!this._processSupportContextKey.get()}get connectionState(){return this._connectionState}get whenConnected(){return this._whenConnected.p}get restoredGroupCount(){return this._restoredGroupCount}get instances(){return this._terminalGroupService.instances.concat(this._terminalEditorService.instances).concat(this._backgroundedTerminalInstances.map(e=>e.instance))}get foregroundInstances(){return this._terminalGroupService.instances.concat(this._terminalEditorService.instances)}get detachedInstances(){return this._detachedXterms}getReconnectedTerminals(e){return this._reconnectedTerminals.get(e)}get activeInstance(){for(let e of this._hostActiveTerminals.values())if(e?.hasFocus)return e;return this._activeInstance}get onDidCreateInstance(){return this._onDidCreateInstance.event}get onDidChangeInstanceDimensions(){return this._onDidChangeInstanceDimensions.event}get onDidRegisterProcessSupport(){return this._onDidRegisterProcessSupport.event}get onDidChangeConnectionState(){return this._onDidChangeConnectionState.event}get onDidRequestStartExtensionTerminal(){return this._onDidRequestStartExtensionTerminal.event}get onDidDisposeInstance(){return this._onDidDisposeInstance.event}get onDidFocusInstance(){return this._onDidFocusInstance.event}get onDidChangeActiveInstance(){return this._onDidChangeActiveInstance.event}get onDidChangeInstances(){return this._onDidChangeInstances.event}get onDidChangeInstanceCapability(){return this._onDidChangeInstanceCapability.event}get onDidChangeActiveGroup(){return this._onDidChangeActiveGroup.event}get onAnyInstanceData(){return this._register(this.createOnInstanceEvent(e=>U.map(e.onData,t=>({instance:e,data:t})))).event}get onAnyInstanceDataInput(){return this._register(this.createOnInstanceEvent(e=>U.map(e.onDidInputData,()=>e,e.store))).event}get onAnyInstanceIconChange(){return this._register(this.createOnInstanceEvent(e=>e.onIconChanged)).event}get onAnyInstanceMaximumDimensionsChange(){return this._register(this.createOnInstanceEvent(e=>U.map(e.onMaximumDimensionsChanged,()=>e,e.store))).event}get onAnyInstancePrimaryStatusChange(){return this._register(this.createOnInstanceEvent(e=>U.map(e.statusList.onDidChangePrimaryStatus,()=>e,e.store))).event}get onAnyInstanceProcessIdReady(){return this._register(this.createOnInstanceEvent(e=>e.onProcessIdReady)).event}get onAnyInstanceSelectionChange(){return this._register(this.createOnInstanceEvent(e=>e.onDidChangeSelection)).event}get onAnyInstanceTitleChange(){return this._register(this.createOnInstanceEvent(e=>e.onTitleChanged)).event}get onAnyInstanceShellTypeChanged(){return this._register(this.createOnInstanceEvent(e=>U.map(e.onDidChangeShellType,()=>e))).event}get onAnyInstanceAddedCapabilityType(){return this._register(this.createOnInstanceEvent(e=>U.map(e.capabilities.onDidAddCapability,t=>t.id))).event}async showProfileQuickPick(e,t){let n=await this._instantiationService.createInstance(w2e).showAndGetResult(e);if(!n||We(n))return;let r=n.keyMods;if(e==="createInstance"){let s=this.getDefaultInstanceHost().activeInstance,l=this._terminalConfigurationService.defaultLocation,c;if(n.config&&yo(n.config,{id:!0})){await this.createContributedTerminalProfile(n.config.extensionIdentifier,n.config.id,{icon:n.config.options?.icon,color:n.config.options?.color,location:r?.alt&&s?{splitActiveTerminal:!0}:l,titleTemplate:n.config.titleTemplate});return}else n.config&&yo(n.config,{profileName:!0})&&(r?.alt&&s?c=await this.createTerminal({location:{parentTerminal:s},config:n.config,cwd:t}):c=await this.createTerminal({location:l,config:n.config,cwd:t}));if(c&&l!==2)return this._terminalGroupService.showPanel(!0),this.setActiveInstance(c),c}}async _initializePrimaryBackend(){Wo("code/terminal/willGetTerminalBackend"),this._primaryBackend=await this._terminalInstanceService.getBackend(this._environmentService.remoteAuthority),Wo("code/terminal/didGetTerminalBackend");let e=this._terminalConfigurationService.config.enablePersistentSessions;this._connectionState=0;let t=!!this._environmentService.remoteAuthority&&e;this._primaryBackend&&this._register(this._primaryBackend.onDidRequestDetach(async n=>{let r=this.getInstanceFromResource(aze(n.workspaceId,n.instanceId));if(r){let s=r?.persistentProcessId;s&&!r.shellLaunchConfig.isFeatureTerminal&&!r.shellLaunchConfig.customPtyImplementation?(r.target===2?this._terminalEditorService.detachInstance(r):this._terminalGroupService.getGroupForInstance(r)?.removeInstance(r),await r.detachProcessAndDispose(3),await this._primaryBackend?.acceptDetachInstanceReply(n.requestId,s)):await this._primaryBackend?.acceptDetachInstanceReply(n.requestId,void 0)}})),Wo("code/terminal/willReconnect");let o;t?o=this._reconnectToRemoteTerminals():e?o=this._reconnectToLocalTerminals():o=Promise.resolve(),o.then(async()=>{this._setConnected(),Wo("code/terminal/didReconnect"),Wo("code/terminal/willReplay");let n=await this._reconnectedTerminalGroups?.then(r=>r.map(s=>s.terminalInstances).flat())??[];await Promise.all(n.map(r=>new Promise(s=>U.once(r.onProcessReplayComplete)(s)))),Wo("code/terminal/didReplay"),Wo("code/terminal/willGetPerformanceMarks"),await Promise.all(Array.from(this._terminalInstanceService.getRegisteredBackends()).map(async r=>{this._timerService.setPerformanceMarks(r.remoteAuthority===void 0?"localPtyHost":"remotePtyHost",await r.getPerformanceMarks()),r.setReady()})),Wo("code/terminal/didGetPerformanceMarks"),this._whenConnected.complete()})}getPrimaryBackend(){return this._primaryBackend}async setNextCommandId(e,t,o){!this._primaryBackend||e<=0||await this._primaryBackend.setNextCommandId(e,t,o)}_forwardInstanceHostEvents(e){this._register(e.onDidChangeInstances(this._onDidChangeInstances.fire,this._onDidChangeInstances)),this._register(e.onDidDisposeInstance(this._onDidDisposeInstance.fire,this._onDidDisposeInstance)),this._register(e.onDidChangeActiveInstance(t=>this._evaluateActiveInstance(e,t))),this._register(e.onDidFocusInstance(t=>{this._onDidFocusInstance.fire(t),this._evaluateActiveInstance(e,t)})),this._register(e.onDidChangeInstanceCapability(t=>{this._onDidChangeInstanceCapability.fire(t)})),this._hostActiveTerminals.set(e,void 0)}_evaluateActiveInstance(e,t){if(this._hostActiveTerminals.set(e,t),t===void 0)for(let o of this._hostActiveTerminals.values())o&&(t=o);this._activeInstance=t,this._onDidChangeActiveInstance.fire(t)}setActiveInstance(e){e&&(e.shellLaunchConfig.hideFromUser&&this.showBackgroundTerminal(e),e.target===2?this._terminalEditorService.setActiveInstance(e):this._terminalGroupService.setActiveInstance(e))}async focusInstance(e){if(this._activeInstance!==e&&this.setActiveInstance(e),e.target===2){await this._terminalEditorService.focusInstance(e);return}await this._terminalGroupService.focusInstance(e)}async focusActiveInstance(){if(this._activeInstance)return this.focusInstance(this._activeInstance)}async createContributedTerminalProfile(e,t,o){await this._extensionService.activateByEvent(`onTerminalProfile:${t}`);let n=this._terminalProfileService.getContributedProfileProvider(e,t);if(!n){this._notificationService.error(`No terminal profile provider registered for id "${t}"`);return}try{await n.createContributedTerminalProfile(o),this._terminalGroupService.setActiveInstanceByIndex(this._terminalGroupService.instances.length-1),await this._terminalGroupService.activeInstance?.focusWhenReady()}catch(r){this._notificationService.error(r.message)}}async safeDisposeTerminal(e){if(!(e.target!==2&&e.hasChildProcesses&&(this._terminalConfigurationService.config.confirmOnKill==="panel"||this._terminalConfigurationService.config.confirmOnKill==="always")&&await this._showTerminalCloseConfirmation(!0)))return new Promise(t=>{U.once(e.onExit)(()=>t()),e.dispose(3)})}_setConnected(){this._connectionState=1,this._onDidChangeConnectionState.fire(),this._logService.trace("Pty host ready")}async _reconnectToRemoteTerminals(){let e=this._environmentService.remoteAuthority;if(!e)return;let t=await this._terminalInstanceService.getBackend(e);if(!t)return;Wo("code/terminal/willGetTerminalLayoutInfo");let o=await t.getTerminalLayoutInfo();Wo("code/terminal/didGetTerminalLayoutInfo"),t.reduceConnectionGraceTime(),Wo("code/terminal/willRecreateTerminalGroups"),await this._recreateTerminalGroups(o),Wo("code/terminal/didRecreateTerminalGroups"),this._attachProcessLayoutListeners(),this._logService.trace("Reconnected to remote terminals")}async _reconnectToLocalTerminals(){let e=await this._terminalInstanceService.getBackend();if(!e)return;Wo("code/terminal/willGetTerminalLayoutInfo");let t=await e.getTerminalLayoutInfo();if(Wo("code/terminal/didGetTerminalLayoutInfo"),t&&(t.tabs.length>0||t?.background?.length)){Wo("code/terminal/willRecreateTerminalGroups"),this._reconnectedTerminalGroups=this._recreateTerminalGroups(t);let o=await this._reviveBackgroundTerminalInstances(t.background||[]);this._backgroundedTerminalInstances=o.map(n=>({instance:n})),Wo("code/terminal/didRecreateTerminalGroups")}this._attachProcessLayoutListeners(),this._logService.trace("Reconnected to local terminals")}_recreateTerminalGroups(e){let t=[],o;if(e){for(let n of e.tabs){let r=n.terminals.filter(s=>s.terminal&&s.terminal.isOrphan);if(r.length){this._restoredGroupCount+=r.length;let s=this._recreateTerminalGroup(n,r);t.push(s),n.isActive&&(o=s);let l=this.instances.find(c=>c.shellLaunchConfig.attachPersistentProcess?.id===n.activePersistentProcessId);l&&this.setActiveInstance(l)}}e.tabs.length&&o?.then(n=>this._terminalGroupService.activeGroup=n)}return Promise.all(t).then(n=>n.filter(r=>!!r))}async _reviveBackgroundTerminalInstances(e){let t=[];for(let o of e){let n=o;if(!n)continue;let r=await this.createTerminal({config:{attachPersistentProcess:n,hideFromUser:!0,forcePersist:!0},location:1});t.push(r)}return t}async _recreateTerminalGroup(e,t){let o;for(let r of t){let s=r.terminal;this._lifecycleService.startupKind!==3&&s.type==="Task"||(Wo(`code/terminal/willRecreateTerminal/${s.id}-${s.pid}`),o=this.createTerminal({config:{attachPersistentProcess:s},location:o?{parentTerminal:o}:1}),o.then(()=>Wo(`code/terminal/didRecreateTerminal/${s.id}-${s.pid}`)))}return o?.then(r=>{let s=this._terminalGroupService.getGroupForInstance(r);return s?.resizePanes(e.terminals.map(l=>l.relativeSize)),s})}_attachProcessLayoutListeners(){this._register(this.onDidChangeActiveGroup(()=>this._saveState())),this._register(this.onDidChangeActiveInstance(()=>this._saveState())),this._register(this.onDidChangeInstances(()=>this._saveState())),this._register(this.onAnyInstanceProcessIdReady(()=>this._saveState())),this._register(this.onAnyInstanceTitleChange(e=>this._updateTitle(e))),this._register(this.onAnyInstanceIconChange(e=>this._updateIcon(e.instance,e.userInitiated)))}_handleInstanceContextKeys(){let e=pt.isOpen.bindTo(this._contextKeyService),t=()=>{e.set(this.instances.length>0),this._terminalCountContextKey.set(this.instances.length)};this._register(this.onDidChangeInstances(()=>t()))}async getActiveOrCreateInstance(e){let t=this.activeInstance;if(!t)return this.createTerminal();if(!e?.acceptsInput||t.xterm?.isStdinDisabled!==!0)return t;let o=await this.createTerminal();return this.setActiveInstance(o),await this.revealActiveTerminal(),o}async revealTerminal(e,t){e.target===2?await this._terminalEditorService.revealActiveEditor(t):await this._terminalGroupService.showPanel()}async revealActiveTerminal(e){let t=this.activeInstance;t&&await this.revealTerminal(t,e)}requestStartExtensionTerminal(e,t,o){return new Promise(n=>{this._onDidRequestStartExtensionTerminal.fire({proxy:e,cols:t,rows:o,callback:n})})}_onBeforeShutdown(e){return Ft?(this._isShuttingDown=!0,!1):this._onBeforeShutdownAsync(e)}async _onBeforeShutdownAsync(e){if(this.instances.length===0)return!1;try{if(this._shutdownWindowCount=await this._nativeDelegate?.getWindowCount(),this._shouldReviveProcesses(e)&&await Promise.race([this._primaryBackend?.persistTerminalState(),Li(2e3)]),!(this._terminalConfigurationService.config.enablePersistentSessions&&e===3)&&(this._terminalConfigurationService.config.confirmOnExit==="always"&&this.foregroundInstances.length>0||this._terminalConfigurationService.config.confirmOnExit==="hasChildProcesses"&&this.foregroundInstances.some(r=>r.hasChildProcesses)))return this._onBeforeShutdownConfirmation(e)}catch(t){this._logService.warn("Exception occurred during terminal shutdown",t)}return this._isShuttingDown=!0,!1}setNativeDelegate(e){this._nativeDelegate=e}_shouldReviveProcesses(e){if(!this._terminalConfigurationService.config.enablePersistentSessions)return!1;switch(this._terminalConfigurationService.config.persistentSessionReviveProcess){case"onExit":return e===1&&this._shutdownWindowCount===1&&!et?!0:e===4||e===2;case"onExitAndWindowClose":return e!==3;default:return!1}}async _onBeforeShutdownConfirmation(e){let t=await this._showTerminalCloseConfirmation();return t||(this._isShuttingDown=!0),t}_onWillShutdown(e){let t=this._terminalConfigurationService.config.enablePersistentSessions&&e.reason===3;for(let o of[...this._terminalGroupService.instances,...this._backgroundedTerminalInstances.map(n=>n.instance)])t&&o.shouldPersist?o.detachProcessAndDispose(1):o.dispose(1);!t&&!this._shouldReviveProcesses(e.reason)&&this._primaryBackend?.setTerminalLayoutInfo(void 0)}_saveState(){if(this._isShuttingDown||!this._terminalConfigurationService.config.enablePersistentSessions)return;let t={tabs:this._terminalGroupService.groups.map(o=>o.getLayoutInfo(o===this._terminalGroupService.activeGroup)),background:this._backgroundedTerminalInstances.map(o=>o.instance).filter(o=>o.shellLaunchConfig.forcePersist).map(o=>o.persistentProcessId).filter(o=>o!==void 0)};this._primaryBackend?.setTerminalLayoutInfo(t)}_updateTitle(e){!this._terminalConfigurationService.config.enablePersistentSessions||!e||e.shellLaunchConfig.customPtyImplementation||!e.persistentProcessId||!e.title||e.isDisposed||(e.staticTitle?this._primaryBackend?.updateTitle(e.persistentProcessId,e.staticTitle,0):this._primaryBackend?.updateTitle(e.persistentProcessId,e.title,e.titleSource))}_updateIcon(e,t){!this._terminalConfigurationService.config.enablePersistentSessions||!e||e.shellLaunchConfig.customPtyImplementation||!e.persistentProcessId||!e.icon||e.isDisposed||this._primaryBackend?.updateIcon(e.persistentProcessId,t,e.icon,e.color)}refreshActiveGroup(){this._onDidChangeActiveGroup.fire(this._terminalGroupService.activeGroup)}getInstanceFromId(e){let t=-1;if(this._backgroundedTerminalInstances.forEach((o,n)=>{o.instance.instanceId===e&&(t=n)}),t!==-1)return this._backgroundedTerminalInstances[t].instance;try{return this.instances[this._getIndexFromId(e)]}catch{return}}getInstanceFromResource(e){return cze(this.instances,e)}openResource(e){let t=this.getInstanceFromResource(e);if(t){this.setActiveInstance(t),this.revealTerminal(t);let o=t.capabilities.get(2)?.commands,n=new URLSearchParams(e.query),r=o?.find(s=>s.id===n.get("command"));r&&t.xterm?.markTracker.revealCommand(r)}}isAttachedToTerminal(e){return this.instances.some(t=>t.processId===e.pid)}moveToEditor(e,t){if(e.target===2)return;let o=this._terminalGroupService.getGroupForInstance(e);o&&(o.removeInstance(e),this._terminalEditorService.openEditor(e,t?{viewColumn:t}:void 0))}moveIntoNewEditor(e){this.moveToEditor(e,ff)}async moveToTerminalView(e,t,o){if(A.isUri(e)&&(e=this.getInstanceFromResource(e)),!e)return;if(this._terminalEditorService.detachInstance(e),e.target!==2){await this._terminalGroupService.showPanel(!0);return}e.target=1;let n;if(t&&(n=this._terminalGroupService.getGroupForInstance(t)),n||(n=this._terminalGroupService.createGroup()),n.addInstance(e),this.setActiveInstance(e),await this._terminalGroupService.showPanel(!0),t&&o){let r=n.terminalInstances.indexOf(t)+(o==="after"?1:0);n.moveInstance(e,r,o)}this._onDidChangeInstances.fire(),this._onDidChangeActiveGroup.fire(this._terminalGroupService.activeGroup)}_initInstanceListeners(e){let t=new O;t.add(e.onDimensionsChanged(()=>{this._onDidChangeInstanceDimensions.fire(e),this._terminalConfigurationService.config.enablePersistentSessions&&this.isProcessSupportRegistered&&this._saveState()})),t.add(e.onDidFocus(this._onDidChangeActiveInstance.fire,this._onDidChangeActiveInstance)),t.add(e.onRequestAddInstanceToGroup(async n=>await this._addInstanceToGroup(e,n))),t.add(e.onDidChangeShellType(()=>this._extensionService.activateByEvent(`onTerminal:${e.shellType}`))),t.add(U.runAndSubscribe(e.capabilities.onDidAddCapability,(()=>{e.capabilities.has(2)&&this._extensionService.activateByEvent(`onTerminalShellIntegration:${e.shellType}`)})));let o=this._register(e.onDisposed(()=>{t.dispose(),this._store.delete(o)}))}async _addInstanceToGroup(e,t){let o=G$(t.uri);if(o.instanceId===void 0)return;let n=this.getInstanceFromResource(t.uri);if(!n){let r=await this._primaryBackend?.requestDetachInstance(o.workspaceId,o.instanceId);if(r){n=await this.createTerminal({config:{attachPersistentProcess:r},resource:t.uri}),this._terminalGroupService.moveInstance(n,e,t.side);return}}if(n=this._terminalGroupService.getInstanceFromResource(t.uri),n){this._terminalGroupService.moveInstance(n,e,t.side);return}if(n=this._terminalEditorService.getInstanceFromResource(t.uri),n){this.moveToTerminalView(n,e,t.side);return}}registerProcessSupport(e){e&&(this._processSupportContextKey.set(e),this._onDidRegisterProcessSupport.fire())}_getIndexFromId(e){let t=-1;if(this.instances.forEach((o,n)=>{o.instanceId===e&&(t=n)}),t===-1)throw new Error(`Terminal with ID ${e} does not exist (has it already been disposed?)`);return t}async _showTerminalCloseConfirmation(e){let t,o=this.foregroundInstances;o.length===1||e?t=d(16080,null):t=d(16079,null,o.length);let{confirmed:n}=await this._dialogService.confirm({type:"warning",message:t,primaryButton:d(16081,null)});return!n}getDefaultInstanceHost(){return this._terminalConfigurationService.defaultLocation===2?this._terminalEditorService:this._terminalGroupService}async getInstanceHost(e){if(e){if(e===2)return this._terminalEditorService;if(typeof e=="object"){if(yo(e,{viewColumn:!0}))return this._terminalEditorService;if(yo(e,{parentTerminal:!0}))return(await e.parentTerminal).target===2?this._terminalEditorService:this._terminalGroupService}else return this._terminalGroupService}return this}async createTerminal(e){let t=this._remoteAgentService.getConnection()&&A.isUri(e?.cwd)&&e?.cwd.scheme===Q.file;this._terminalProfileService.availableProfiles.length===0&&!(e?.config&&yo(e.config,{customPtyImplementation:!0}))&&!t&&(this._connectionState===0&&Wo("code/terminal/willGetProfiles"),await this._terminalProfileService.profilesReady,this._connectionState===0&&Wo("code/terminal/didGetProfiles"));let o=e?.config;if(!o&&t){let h=await(await this._terminalInstanceService.getBackend(void 0))?.getDefaultSystemShell();h&&(o={executable:h})}o||(o=this._terminalProfileService.getDefaultProfile());let n=o&&yo(o,{extensionIdentifier:!0})?{}:this._terminalInstanceService.convertProfileToShellLaunchConfig(o||{}),r=e?.skipContributedProfileCheck?void 0:await this._getContributedProfile(n,e),s=typeof e?.location=="object"&&yo(e.location,{splitActiveTerminal:!0})?e.location.splitActiveTerminal:typeof e?.location=="object"?yo(e.location,{parentTerminal:!0}):!1;if(await this._resolveCwd(n,s,e),!n.customPtyImplementation&&r){let p=await this.resolveLocation(e?.location),h;s?h=p===2?{viewColumn:En}:{splitActiveTerminal:!0}:h=typeof e?.location=="object"&&yo(e.location,{viewColumn:!0})?e.location:p,await this.createContributedTerminalProfile(r.extensionIdentifier,r.id,{icon:r.icon,color:r.color,location:h,cwd:n.cwd,titleTemplate:r.titleTemplate});let g=p===2?this._terminalEditorService:this._terminalGroupService,f=g.instances[g.instances.length-1];return await f?.focusWhenReady(),this._terminalHasBeenCreated.set(!0),f}if(!n.customPtyImplementation&&!this.isProcessSupportRegistered){let p=await this.resolveLocation(e?.location),h;s?h=p===2?{viewColumn:En}:{splitActiveTerminal:!0}:h=typeof e?.location=="object"&&yo(e.location,{viewColumn:!0})?e.location:p;let g=p===2?this._terminalEditorService:this._terminalGroupService;for(let f of this._terminalProfileService.contributedProfiles){let v=g.instances.length;await this.createContributedTerminalProfile(f.extensionIdentifier,f.id,{icon:f.icon,color:f.color,location:h,cwd:n.cwd,titleTemplate:f.titleTemplate});let b=g.instances[v];if(b)return await b.focusWhenReady(),this._terminalHasBeenCreated.set(!0),b}throw new Error("Could not create terminal when process support is not registered")}this._evaluateLocalCwd(n);let l=await this.resolveLocation(e?.location)||this._terminalConfigurationService.defaultLocation;if(n.hideFromUser){let p=this._terminalInstanceService.createInstance(n,l);return this._backgroundedTerminalInstances.push({instance:p,terminalLocationOptions:e?.location}),this._backgroundedTerminalDisposables.set(p.instanceId,[p.onDisposed(h=>{let g=this._backgroundedTerminalInstances.findIndex(f=>f.instance===h);g!==-1&&this._backgroundedTerminalInstances.splice(g,1),this._onDidDisposeInstance.fire(h)})]),this._onDidChangeInstances.fire(),p}let c=await this._getSplitParent(e?.location);this._terminalHasBeenCreated.set(!0),this._extensionService.activateByEvent("onTerminal:*");let u;return c?u=await this._splitTerminal(n,l,c):u=this._createTerminal(n,l,e),u.shellType&&this._extensionService.activateByEvent(`onTerminal:${u.shellType}`),u}async createAndFocusTerminal(e){let t=await this.createTerminal(e);return this.setActiveInstance(t),await t.focusWhenReady(),t}async _getContributedProfile(e,t){return t?.config&&yo(t.config,{extensionIdentifier:!0})?t.config:this._terminalProfileService.getContributedDefaultProfile(e)}async createDetachedTerminal(e){let t=await Ov.getXtermConstructor(this._keybindingService,this._contextKeyService),o=e.capabilities??new fk,n=this._instantiationService.createInstance(JP,void 0,t,{cols:e.cols,rows:e.rows,xtermColorProvider:e.colorProvider,capabilities:o,disableOverviewRuler:e.disableOverviewRuler,detached:!0},void 0);e.readonly&&n.raw.attachCustomKeyEventHandler(()=>!1);let r=new L0e(n,{...e,capabilities:o},this._instantiationService);this._detachedXterms.add(r),this._ensureDetachedTerminalListeners();let s=n.onDidDispose(()=>{this._detachedXterms.delete(r),s.dispose()});return r}_ensureDetachedTerminalListeners(){this._detachedListenersRegistered||(this._detachedListenersRegistered=!0,this._register(this._themeService.onDidColorThemeChange(()=>{for(let e of this._detachedXterms)e.xterm.updateTheme()})),this._register(this._configurationService.onDidChangeConfiguration(e=>{let t=e.affectsConfiguration("terminal.integrated")||e.affectsConfiguration("editor.fastScrollSensitivity")||e.affectsConfiguration("editor.mouseWheelScrollSensitivity")||e.affectsConfiguration("editor.multiCursorModifier"),o=e.affectsConfiguration("terminal.integrated.shellIntegration.decorationsEnabled");if(t||o)for(let n of this._detachedXterms)t&&n.xterm.updateConfig(),o&&n.xterm.updateTheme()})),this._register(this._logService.onDidChangeLogLevel(()=>{for(let e of this._detachedXterms)e.xterm.updateLogLevel()})))}async _resolveCwd(e,t,o){if(!e.cwd){if(o?.cwd)e.cwd=o.cwd;else if(t&&o?.location){let r=this.activeInstance;if(typeof o.location=="object"&&yo(o.location,{parentTerminal:!0})&&(r=await o.location.parentTerminal),!r)throw new Error("Cannot split without an active instance");e.cwd=await NKi(r,this._workspaceContextService.getWorkspace().folders,this._commandService,this._terminalConfigurationService)}}}async _splitTerminal(e,t,o){let n;if(typeof e.cwd!="object"&&typeof o.shellLaunchConfig.cwd=="object"){let r=e.cwd||o.shellLaunchConfig.cwd.path;o.shellLaunchConfig.cwd.authority&&r&&r[0]!=="/"&&(r="/"+r),e.cwd=A.from({scheme:o.shellLaunchConfig.cwd.scheme,authority:o.shellLaunchConfig.cwd.authority,path:r})}if(t===2||o.target===2)n=await this._terminalEditorService.splitInstance(o,e);else{let r=this._terminalGroupService.getGroupForInstance(o);if(!r)throw new Error(`Cannot split a terminal without a group (instanceId: ${o.instanceId}, title: ${o.title})`);e.parentTerminalId=o.instanceId,n=r.split(e)}return n}_createTerminal(e,t,o){let n;if(t===2){if(n=this._terminalInstanceService.createInstance(e,2),!e.hideFromUser){let r=this._getEditorOptions(o?.location);this._terminalEditorService.openEditor(n,r)}}else n=this._terminalGroupService.createGroup(e).terminalInstances[0];return n}async resolveLocation(e){if(e&&typeof e=="object")if(yo(e,{parentTerminal:!0})){let t=await e.parentTerminal;return t.target?t.target:1}else{if(yo(e,{viewColumn:!0}))return 2;if(yo(e,{splitActiveTerminal:!0}))return this._activeInstance?.target?this._activeInstance?.target:1}return e}async _getSplitParent(e){if(e&&typeof e=="object"&&yo(e,{parentTerminal:!0}))return e.parentTerminal;if(e&&typeof e=="object"&&yo(e,{splitActiveTerminal:!0}))return this.activeInstance}_getEditorOptions(e){if(e&&typeof e=="object"&&yo(e,{viewColumn:!0}))return e.viewColumn===tr&&fI(zi())?(e.viewColumn=this._editorGroupsService.activeGroup.id,e):(e.viewColumn=SE(this._editorGroupsService,this._configurationService,e.viewColumn),e)}_evaluateLocalCwd(e){this._environmentService.isSessionsWindow||!We(e.cwd)&&e.cwd?.scheme===Q.file&&(AM.getValue(this._contextKeyService)?(e.initialText=QE(d(16078,null,"\x1B[3m","\x1B[23m"),{excludeLeadingNewLine:!0,loudFormatting:!0}),e.type="Local"):this._remoteAgentService.getConnection()&&(e.initialText=QE(d(16077,null,"\x1B[3m","\x1B[23m"),{excludeLeadingNewLine:!0,loudFormatting:!0}),e.type="Local"))}moveToBackground(e){if(!this._backgroundedTerminalInstances.some(t=>t.instance===e)){if(e.target===2)this._terminalEditorService.detachInstance(e);else{let t=this._terminalGroupService.getGroupForInstance(e);if(!t)return;t.removeInstance(e)}e.detachFromElement(),this._backgroundedTerminalInstances.push({instance:e,terminalLocationOptions:e.target===2?{viewColumn:tr}:void 0}),this._backgroundedTerminalDisposables.set(e.instanceId,[e.onDisposed(t=>{let o=this._backgroundedTerminalInstances.findIndex(r=>r.instance===t);o!==-1&&this._backgroundedTerminalInstances.splice(o,1);let n=this._backgroundedTerminalDisposables.get(t.instanceId);n&&je(n),this._backgroundedTerminalDisposables.delete(t.instanceId),this._onDidDisposeInstance.fire(t)})]),this._onDidChangeInstances.fire()}}async showBackgroundTerminal(e,t){let o=this._backgroundedTerminalInstances.findIndex(s=>s.instance===e);if(o===-1)return;let n=this._backgroundedTerminalInstances[o];this._backgroundedTerminalInstances.splice(o,1);let r=this._backgroundedTerminalDisposables.get(e.instanceId);if(r&&je(r),this._backgroundedTerminalDisposables.delete(e.instanceId),e.target===1)this._terminalGroupService.createGroup(e),this.instances.length===1&&!t&&this._terminalGroupService.setActiveInstanceByIndex(0);else{let s=n.terminalLocationOptions?this._getEditorOptions(n.terminalLocationOptions):this._getEditorOptions(e.target);this._terminalEditorService.openEditor(e,s)}this._onDidChangeInstances.fire()}async setContainers(e,t){this._terminalConfigurationService.setPanelContainer(e),this._terminalGroupService.setContainer(t)}createOnInstanceEvent(e){return new Tle(this.instances,this.onDidCreateInstance,this.onDidDisposeInstance,e)}createOnInstanceCapabilityEvent(e,t){return uFo(this.instances,this.onDidCreateInstance,this.onDidDisposeInstance,e,t)}};I([bi],JC.prototype,"onAnyInstanceData",1),I([bi],JC.prototype,"onAnyInstanceDataInput",1),I([bi],JC.prototype,"onAnyInstanceIconChange",1),I([bi],JC.prototype,"onAnyInstanceMaximumDimensionsChange",1),I([bi],JC.prototype,"onAnyInstancePrimaryStatusChange",1),I([bi],JC.prototype,"onAnyInstanceProcessIdReady",1),I([bi],JC.prototype,"onAnyInstanceSelectionChange",1),I([bi],JC.prototype,"onAnyInstanceTitleChange",1),I([bi],JC.prototype,"onAnyInstanceShellTypeChanged",1),I([bi],JC.prototype,"onAnyInstanceAddedCapabilityType",1),I([Tu(500)],JC.prototype,"_saveState",1),I([Tu(500)],JC.prototype,"_updateTitle",1),I([Tu(500)],JC.prototype,"_updateIcon",1),JC=I([m(0,X),m(1,to),m(2,wa),m(3,ct),m(4,F),m(5,bo),m(6,B),m(7,Mt),m(8,mp),m(9,hb),m(10,Cc),m(11,uh),m(12,kt),m(13,fb),m(14,lt),m(15,Ne),m(16,Ae),m(17,fe),m(18,Le),m(19,Kx),m(20,Pe)],JC);var Ipt=class extends ju{constructor(e,t,o,n,r){super(o);this._terminalService=t;this._themeService=o;this._terminalProfileService=n;this._editorService=r;this._registerListeners(),this._styleElement=Pr(e),this._register(ee(()=>this._styleElement.remove())),this.updateStyles()}_registerListeners(){this._register(this._terminalService.onAnyInstanceIconChange(()=>this.updateStyles())),this._register(this._terminalService.onDidCreateInstance(()=>this.updateStyles())),this._register(this._editorService.onDidActiveEditorChange(()=>{this._editorService.activeEditor instanceof Zf&&this.updateStyles()})),this._register(this._editorService.onDidCloseEditor(()=>{this._editorService.activeEditor instanceof Zf&&this.updateStyles()})),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(()=>this.updateStyles()))}updateStyles(){super.updateStyles();let e=this._themeService.getColorTheme(),t="",o=this._themeService.getProductIconTheme();for(let r of this._terminalService.instances){let s=r.icon;if(!s)continue;let l;s instanceof A?l=s:s instanceof Object&&yo(s,{light:!0,dark:!0})&&(l=cm(e.type)?s.dark:s.light);let c=mR(r,e.type);if(l instanceof A&&c&&c.length>1&&(t+=pa`.monaco-workbench .terminal-tab.${_K(c[0])}::before
					{content: ''; background-image: ${cl(l)};}`),q.isThemeIcon(s)){let p=Zw().getIcon(s.id);if(p){let h=o.getIcon(p);h&&(t+=pa`.monaco-workbench .terminal-tab.codicon-${_K(s.id)}::before
							{content: ${FI(h.fontCharacter)} !important; font-family: ${FI(h.font?.id??"codicon")} !important;}`)}}}let n=e.getColor(C5);n&&(t+=pa`.monaco-workbench .show-file-icons .file-icon.terminal-tab::before { color: ${n}; }`),t+=Sdo(e,!0),this._styleElement.textContent=t}};Ipt=I([m(1,an),m(2,Pe),m(3,fb),m(4,ie)],Ipt);var cIe=class extends k{constructor(e,t,o,n){super();this._telemetryService=n;this._register(t.onDidCreateInstance(async r=>{let s=new O;this._store.add(s),await Promise.race([r.processReady.then(()=>Li(1e4)),U.toPromise(r.onDisposed,s),U.toPromise(e.onWillShutdown,s)]);let l=!1;try{let u=o.getInputFromResource(r.resource).group?.windowId;l=!!(u&&fI(gv(u,!0).window))}catch{}this._logCreateInstance(r,l),this._store.delete(s)})),this._register(t.onAnyInstanceShellTypeChanged(r=>{this._logShellTypeChanged(r)}))}static{this.ID="terminalTelemetry"}_logCreateInstance(e,t){let o=e.shellLaunchConfig,n=e.capabilities.get(2);this._telemetryService.publicLog2("terminal/createInstance",{location:e.target===1?"view":e.target===2?t?"editor-auxwindow":"editor":"unknown",shellType:new lh(MEn(o)),promptType:new lh(e.capabilities.get(6)?.promptType),isCustomPtyImplementation:!!o.customPtyImplementation,isExtensionOwnedTerminal:!!o.isExtensionOwnedTerminal,isLoginShell:(We(o.args)?o.args.split(" "):o.args)?.some(r=>r==="-l"||r==="--login")??!1,isReconnect:!!o.attachPersistentProcess,hasRemoteAuthority:e.hasRemoteAuthority,shellIntegrationQuality:n?.hasRichCommandDetection?2:n?1:0,shellIntegrationInjected:e.usedShellIntegrationInjection,shellIntegrationInjectionFailureReason:e.shellIntegrationInjectionFailureReason,imageAddonLoaded:e.xterm?.isImageAddonLoaded??!1,terminalSessionId:e.sessionId})}_logShellTypeChanged(e){this._telemetryService.publicLog2("terminal/shellTypeChanged",{shellType:new lh(e.shellType??"unknown"),terminalSessionId:e.sessionId})}};cIe=I([m(0,to),m(1,an),m(2,hb),m(3,_e)],cIe);var DEn=new Set(["cmd","wsl","bash","fish","pwsh","sh","ssh","tmux","zsh","amm","ash","csh","dash","elvish","ion","ksh","mksh","msh","nu","rc","scsh","tcsh","termux","xonsh","clj","sbcl","crystal","deno","iex","erl","fsi","go","ghci","jshell","julia","lua","node","ocaml","perl","php","swipl","python","R","irb","scala","racket","gst","pharo","tclsh","ts-node"]),REn=[{regex:/^(?:pwsh|powershell)-preview$/i,type:"pwsh-preview"},{regex:/^python(?:\d+(?:\.\d+)?)?$/i,type:"python"}],LEn=[{regex:/\\Cygwin(?:64)?\\.+\\bash\.exe$/i,type:"cygwin-bash"},{regex:/\\Git\\.+\\bash\.exe$/i,type:"git-bash"},{regex:/\\msys(?:32|64)\\.+\\(?:bash|msys2)\.exe$/i,type:"msys2-bash"},{regex:/\\WindowsPowerShell\\v1.0\\powershell.exe$/i,type:"windows-powershell"},{regex:/\\Windows\\(?:System32|SysWOW64|Sysnative)\\(?:bash|wsl)\.exe$/i,type:"wsl"}];function MEn(a){if(!a.executable)return"unknown";let e=Jo(a.executable).replace(/\.[^\.]+$/,"");for(let t of LEn)if(t.regex.test(a.executable))return t.type;for(let t of REn)if(t.regex.test(e))return t.type;return DEn.has(e)?e:"unknown"}var C2e=class extends k{constructor(e,t,o,n,r){super();this._tabContainer=t;this._commandService=o;this._terminalChatService=n;this._terminalService=r;this._entry=D(e,_(".terminal-tabs-chat-entry")),this._entry.tabIndex=0,this._entry.setAttribute("role","button");let s=D(this._entry,_(".terminal-tabs-entry"));D(s,_(".terminal-tabs-chat-entry-icon")).classList.add(...q.asClassNameArray(L.commentDiscussionSparkle)),this._label=D(s,_(".terminal-tabs-chat-entry-label")),this._deleteButton=D(s,_(".terminal-tabs-chat-entry-delete")),this._deleteButton.classList.add(...q.asClassNameArray(L.trashcan)),this._deleteButton.tabIndex=0,this._deleteButton.setAttribute("role","button"),this._deleteButton.setAttribute("aria-label",d(16087,null)),this._deleteButton.setAttribute("title",d(16088,null));let c=()=>{this._commandService.executeCommand("workbench.action.terminal.chat.viewHiddenChatTerminals")};this._register($(this._entry,ne.CLICK,u=>{u.target===this._deleteButton||this._deleteButton.contains(u.target)||(u.preventDefault(),c())})),this._register($(this._entry,ne.KEY_DOWN,u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),c())})),this._register($(this._deleteButton,ne.CLICK,async u=>{u.preventDefault(),u.stopPropagation(),await this._deleteAllHiddenTerminals()})),this._register($(this._deleteButton,ne.KEY_DOWN,async u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),await this._deleteAllHiddenTerminals())})),this.update()}dispose(){this._entry.remove(),this._label.remove(),this._deleteButton.remove(),super.dispose()}async _deleteAllHiddenTerminals(){let e=this._terminalChatService.getToolSessionTerminalInstances(!0);await Promise.all(e.map(t=>this._terminalService.safeDisposeTerminal(t)))}get element(){return this._entry}update(){let e=this._terminalChatService.getToolSessionTerminalInstances(!0).length;if(e<=0){this._entry.style.display="none",this._label.textContent="",this._entry.removeAttribute("aria-label"),this._entry.removeAttribute("title");return}this._entry.style.display="";let t=d(16091,null);this._entry.setAttribute("title",t),this._tabContainer.classList.contains("has-text")?this._label.textContent=e===1?d(16090,null,e):d(16089,null,e):this._label.textContent=`${e}`;let n=e===1?d(16086,null):d(16085,null,e);this._entry.setAttribute("aria-label",n)}};C2e=I([m(2,fe),m(3,tg),m(4,an)],C2e);var ypt=_;var x2e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._terminalService=t;this._terminalChatService=o;this._terminalConfigurationService=n;this._terminalGroupService=r;this._instantiationService=s;this._contextMenuService=l;this._configurationService=c;this._storageService=p;this._hoverService=g;this._cancelContextMenu=!1;this._emptyAreaDropTargetCount=0;this._tabContainer=ypt(".tabs-container");let f=ypt(".tabs-list-container");this._tabListContainer=f,this._tabListElement=ypt(".tabs-list"),f.appendChild(this._tabListElement),this._tabContainer.appendChild(f),this._instanceMenu=this._register(u.createMenu(R.TerminalInstanceContext,h)),this._tabsListMenu=this._register(u.createMenu(R.TerminalTabContext,h)),this._tabsListEmptyMenu=this._register(u.createMenu(R.TerminalTabEmptyAreaContext,h)),this._tabList=this._register(this._instantiationService.createInstance(Kse,this._tabListElement)),this._tabListDomElement=this._tabList.getHTMLElement(),this._chatEntry=this._register(this._instantiationService.createInstance(C2e,f,this._tabContainer));let v=ypt(".terminal-outer-container");this._terminalContainer=ypt(".terminal-groups-container"),v.appendChild(this._terminalContainer),this._terminalService.setContainers(e,this._terminalContainer),this._terminalIsTabsNarrowContextKey=pt.tabsNarrow.bindTo(h),this._terminalTabsFocusContextKey=pt.tabsFocus.bindTo(h),this._terminalTabsMouseContextKey=pt.tabsMouse.bindTo(h),this._tabTreeIndex=this._terminalConfigurationService.config.tabs.location==="left"?0:1,this._terminalContainerIndex=this._terminalConfigurationService.config.tabs.location==="left"?1:0,this._register(c.onDidChangeConfiguration(b=>{b.affectsConfiguration("terminal.integrated.tabs.enabled")||b.affectsConfiguration("terminal.integrated.tabs.hideCondition")?this._refreshShowTabs():b.affectsConfiguration("terminal.integrated.tabs.location")&&(this._tabTreeIndex=this._terminalConfigurationService.config.tabs.location==="left"?0:1,this._terminalContainerIndex=this._terminalConfigurationService.config.tabs.location==="left"?1:0,this._shouldShowTabs()&&(this._splitView.swapViews(0,1),this._removeSashListener(),this._addSashListener(),this._splitView.resizeView(this._tabTreeIndex,this._getLastListWidth())))})),this._register(U.any(this._terminalGroupService.onDidChangeInstances,this._terminalGroupService.onDidChangeGroups)(()=>{this._refreshShowTabs(),this._updateChatTerminalsEntry()})),this._register(U.any(this._terminalChatService.onDidRegisterTerminalInstanceWithToolSession,this._terminalService.onDidChangeInstances,this._terminalService.onDidDisposeInstance)(()=>{this._refreshShowTabs(),this._updateChatTerminalsEntry()})),this._register(h.onDidChangeContext(b=>{b.affectsSome(new Set([mme.ChatHasHiddenTerminals]))&&(this._refreshShowTabs(),this._updateChatTerminalsEntry())})),this._attachEventListeners(e,this._terminalContainer),this._register(this._terminalGroupService.onDidChangePanelOrientation(b=>{this._panelOrientation=b,this._panelOrientation===0?this._terminalContainer.classList.add("terminal-side-view"):this._terminalContainer.classList.remove("terminal-side-view")})),this._splitView=new Gp(e,{orientation:1,proportionalLayout:!1}),this._setupSplitView(v),this._updateChatTerminalsEntry()}_shouldShowTabs(){let e=this._terminalConfigurationService.config.tabs.enabled,t=this._terminalConfigurationService.config.tabs.hideCondition,o=this._terminalChatService.getToolSessionTerminalInstances(!0);if(!e)return!1;if(o.length>0)return!0;switch(t){case"never":return!0;case"singleTerminal":if(this._terminalGroupService.instances.length>1)return!0;break;case"singleGroup":if(this._terminalGroupService.groups.length>1)return!0;break}return!1}_refreshShowTabs(){this._shouldShowTabs()?this._splitView.length===1&&(this._addTabTree(),this._addSashListener(),this._splitView.resizeView(this._tabTreeIndex,this._getLastListWidth()),this.rerenderTabs()):this._splitView.length===2&&!this._terminalTabsMouseContextKey.get()&&(this._splitView.removeView(this._tabTreeIndex),this._plusButton?.remove(),this._removeSashListener())}_updateChatTerminalsEntry(){this._chatEntry?.update()}_getLastListWidth(){let e=this._panelOrientation===0?"tabs-list-width-vertical":"tabs-list-width-horizontal",t=this._storageService.get(e,0);return!t||!parseInt(t)?this._panelOrientation===0?46:120:parseInt(t)}_handleOnDidSashReset(){let e=80,t=document.createElement("canvas");t.width=1,t.height=1;let o=t.getContext("2d");if(o){let r=Me(this._tabListElement).getComputedStyle(this._tabListElement);o.font=`${r.fontStyle} ${r.fontSize} ${r.fontFamily}`;let s=this._terminalGroupService.instances.reduce((l,c)=>Math.max(l,o.measureText(c.title+(c.description||"")).width+this._getAdditionalWidth(c)),0);e=Math.ceil(Math.max(s,80))}Math.ceil(this._splitView.getViewSize(this._tabTreeIndex))===e&&(e=46),this._splitView.resizeView(this._tabTreeIndex,e),this._updateListWidth(e)}_getAdditionalWidth(e){let o=e.statusList.statuses.length>0?30:0;return 40+((this._terminalGroupService.getGroupForInstance(e)?.terminalInstances.length||0)>1?30:0)+o}_handleOnDidSashChange(){let e=this._splitView.getViewSize(this._tabTreeIndex);!this._width||e<=0||this._updateListWidth(e)}_updateListWidth(e){e<63&&e>=46?(e=46,this._splitView.resizeView(this._tabTreeIndex,e)):e>=63&&e<80&&(e=80,this._splitView.resizeView(this._tabTreeIndex,e)),this.rerenderTabs();let t=this._panelOrientation===0?"tabs-list-width-vertical":"tabs-list-width-horizontal";this._storageService.store(t,e,0,0)}_setupSplitView(e){this._register(this._splitView.onDidSashReset(()=>this._handleOnDidSashReset())),this._register(this._splitView.onDidSashChange(()=>this._handleOnDidSashChange())),this._shouldShowTabs()&&this._addTabTree(),this._splitView.addView({element:e,layout:t=>this._terminalGroupService.groups.forEach(o=>o.layout(t,this._height||0)),minimumSize:120,maximumSize:Number.POSITIVE_INFINITY,onDidChange:()=>k.None,priority:2},Ac.Distribute,this._terminalContainerIndex),this._shouldShowTabs()&&this._addSashListener()}_addTabTree(){this._splitView.addView({element:this._tabContainer,layout:e=>this._tabList.layout(this._height||0,e),minimumSize:46,maximumSize:500,onDidChange:()=>k.None,priority:1},Ac.Distribute,this._tabTreeIndex),this.rerenderTabs()}rerenderTabs(){this._updateHasText(),this._tabList.refresh()}_addSashListener(){let e;this._sashDisposables=[this._splitView.sashes[0].onDidStart(t=>{e=Ly(Me(this._splitView.el),()=>{this.rerenderTabs()},100)}),this._splitView.sashes[0].onDidEnd(t=>{e.dispose()})]}_removeSashListener(){this._sashDisposables&&(je(this._sashDisposables),this._sashDisposables=void 0)}_updateHasText(){let e=this._tabListElement.clientWidth>63;this._tabContainer.classList.toggle("has-text",e),this._terminalIsTabsNarrowContextKey.set(!e),this._updateChatTerminalsEntry()}layout(e,t){let o=this._chatEntry?.element.style.display==="none"?0:this._chatEntry?.element.clientHeight;this._height=t-(o??0),this._width=e,this._splitView.layout(e),this._shouldShowTabs()&&this._splitView.resizeView(this._tabTreeIndex,this._getLastListWidth()),this._updateHasText()}_attachEventListeners(e,t){this._register($(this._tabContainer,"mouseleave",async o=>{this._terminalTabsMouseContextKey.set(!1),this._refreshShowTabs(),o.stopPropagation()})),this._register($(this._tabContainer,"mouseenter",async o=>{this._terminalTabsMouseContextKey.set(!0),o.stopPropagation()})),this._register($(this._tabContainer,"dragenter",o=>{if(!this._shouldHandleEmptyAreaDrop(o)){this._resetEmptyAreaDropState();return}this._emptyAreaDropTargetCount++,this._setEmptyAreaDropState(!0)})),this._register($(this._tabContainer,"dragover",o=>{if(!this._shouldHandleEmptyAreaDrop(o)){this._resetEmptyAreaDropState();return}o.preventDefault(),this._setEmptyAreaDropState(!0),o.dataTransfer&&(o.dataTransfer.dropEffect="move")})),this._register($(this._tabContainer,"dragleave",o=>{if(!this._shouldHandleEmptyAreaDrop(o)){this._tabContainer.contains(o.relatedTarget)||this._resetEmptyAreaDropState();return}this._tabContainer.contains(o.relatedTarget)||(this._emptyAreaDropTargetCount=Math.max(0,this._emptyAreaDropTargetCount-1),this._emptyAreaDropTargetCount===0&&this._resetEmptyAreaDropState())})),this._register($(this._tabContainer,"drop",o=>{this._shouldHandleEmptyAreaDrop(o)&&this._handleContainerDrop(o)})),this._register($(t,"mousedown",async o=>{let n=this._terminalGroupService.activeInstance;if(this._terminalGroupService.instances.length>0&&n){let r=await n.handleMouseEvent(o,this._instanceMenu);typeof r=="object"&&r.cancelContextMenu&&(this._cancelContextMenu=!0)}})),this._register($(t,"contextmenu",o=>{this._terminalConfigurationService.config.rightClickBehavior==="nothing"&&!o.shiftKey&&(this._cancelContextMenu=!0),t.focus(),this._cancelContextMenu||d7(Me(t),o,this._terminalGroupService.activeInstance,this._instanceMenu,this._contextMenuService),o.preventDefault(),o.stopImmediatePropagation(),this._cancelContextMenu=!1})),this._register($(this._tabContainer,"contextmenu",o=>{if(this._terminalConfigurationService.config.rightClickBehavior==="nothing"&&!o.shiftKey&&(this._cancelContextMenu=!0),!this._cancelContextMenu){let r=this._tabList.getFocus().length===0;r||(this._terminalGroupService.lastAccessedMenu="tab-list");let s=this._tabList.getSelectedElements(),l=this._tabList.getFocusedElements()?.[0];l&&(s.splice(s.findIndex(c=>c.instanceId===l.instanceId),1),s.unshift(l)),d7(Me(this._tabContainer),o,s,r?this._tabsListEmptyMenu:this._tabsListMenu,this._contextMenuService,r?this._getTabActions():void 0)}o.preventDefault(),o.stopImmediatePropagation(),this._cancelContextMenu=!1})),this._register($(t.ownerDocument,"keydown",o=>{t.classList.toggle("alt-active",!!o.altKey)})),this._register($(t.ownerDocument,"keyup",o=>{t.classList.toggle("alt-active",!!o.altKey)})),this._register($(e,"keyup",o=>{o.keyCode===27&&o.stopPropagation()})),this._register($(this._tabContainer,ne.FOCUS_IN,()=>{this._terminalTabsFocusContextKey.set(!0)})),this._register($(this._tabContainer,ne.FOCUS_OUT,()=>{this._terminalTabsFocusContextKey.set(!1)}))}_shouldHandleEmptyAreaDrop(e){let t=e.target;return t&&(this._tabListDomElement.contains(t)||this._tabListElement.contains(t))?!1:!!e.dataTransfer&&Up(e,"Terminals")}_setEmptyAreaDropState(e){this._tabListContainer.classList.toggle("drop-target",e),this._tabContainer.classList.toggle("drop-target",e),this._chatEntry?.element.classList.toggle("drop-target",e)}_resetEmptyAreaDropState(){this._emptyAreaDropTargetCount=0,this._setEmptyAreaDropState(!1)}async _handleContainerDrop(e){e.preventDefault(),e.stopPropagation(),this._resetEmptyAreaDropState();let t=this._terminalService.getPrimaryBackend(),o=lze(e),n,r=[];if(o)for(let l of o){let c=this._terminalService.getInstanceFromResource(l);if(c)n?n.push(c):n=[c],this._terminalService.moveToTerminalView(c);else if(t){let u=G$(l);u.instanceId&&r.push(t.requestDetachInstance(u.workspaceId,u.instanceId))}}if(r.length){let l=(await Promise.all(r)).filter(u=>!!u),c;for(let u of l)c=await this._terminalService.createTerminal({config:{attachPersistentProcess:u}});c&&this._terminalService.setActiveInstance(c);return}if((!n||!n.length)&&(n=this._tabList.getSelectedElements(),!n.length))return;this._terminalGroupService.moveGroupToEnd(n),this._terminalService.setActiveInstance(n[0]);let s=n.map(l=>this._terminalGroupService.instances.indexOf(l)).filter(l=>l>=0);s.length&&(this._tabList.setSelection(s),this._tabList.setFocus([s[0]]))}_getTabActions(){return[new oi,this._configurationService.inspect("terminal.integrated.tabs.location").userValue==="left"?new it("moveRight",d(16084,null),void 0,void 0,async()=>{this._configurationService.updateValue("terminal.integrated.tabs.location","right")}):new it("moveLeft",d(16083,null),void 0,void 0,async()=>{this._configurationService.updateValue("terminal.integrated.tabs.location","left")}),new it("hideTabs",d(16082,null),void 0,void 0,async()=>{this._configurationService.updateValue("terminal.integrated.tabs.enabled",!1)})]}setEditable(e){e||this._tabList.domFocus(),this._tabList.refresh(!1)}focusTabs(){if(!this._shouldShowTabs())return;this._terminalTabsFocusContextKey.set(!0);let e=this._tabList.getSelection();this._tabList.domFocus(),e&&this._tabList.setFocus(e)}focus(){if(this._terminalService.connectionState===1){this._focus();return}let e=this._tabListElement.ownerDocument.activeElement;if(e){let t=this._register(U.once(this._terminalService.onDidChangeConnectionState)(()=>{Na(e)&&this._focus(),this._store.delete(t)}))}}focusHover(){if(this._shouldShowTabs()){this._tabList.focusHover();return}let e=this._terminalGroupService.activeInstance;e&&this._hoverService.showInstantHover({...tIe(e,this._storageService),target:this._terminalContainer,trapFocus:!0},!0)}_focus(){this._terminalGroupService.activeInstance?.focusWhenReady()}};x2e=I([m(1,an),m(2,tg),m(3,mp),m(4,Cc),m(5,F),m(6,Xe),m(7,B),m(8,Yt),m(9,de),m(10,X),m(11,ot)],x2e);var k2e=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(e,t,s,r,o,n,l,b,h,g);this._contextKeyService=o;this._configurationService=r;this._instantiationService=l;this._terminalService=c;this._terminalConfigurationService=u;this._terminalGroupService=p;this._notificationService=f;this._keybindingService=v;this._menuService=S;this._terminalProfileService=y;this._terminalProfileResolverService=w;this._isInitialized=!1;this._isTerminalBeingCreated=!1;this._newDropdown=this._register(new ue);this._disposableStore=this._register(new O);this._actionDisposables=this._register(new Ot);this._register(this._terminalService.onDidRegisterProcessSupport(()=>{this._onDidChangeViewWelcomeState.fire()})),this._register(this._terminalService.onDidChangeInstances(()=>{this._hasWelcomeScreen()&&this._terminalGroupService.instances.length<=1&&this._onDidChangeViewWelcomeState.fire(),this._parentDomElement&&(this._terminalTabbedView||this._createTabsView(),this.layoutBody(this._parentDomElement.offsetHeight,this._parentDomElement.offsetWidth))})),this._dropdownMenu=this._register(this._menuService.createMenu(R.TerminalNewDropdownContext,this._contextKeyService)),this._singleTabMenu=this._register(this._menuService.createMenu(R.TerminalTabContext,this._contextKeyService)),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(E=>this._updateTabActionBar(E))),this._viewShowing=pt.viewShowing.bindTo(this._contextKeyService),this._register(this.onDidChangeBodyVisibility(E=>{E&&this._terminalTabbedView?.rerenderTabs()})),this._register(this._configurationService.onDidChangeConfiguration(E=>{this._parentDomElement&&(E.affectsConfiguration("terminal.integrated.shellIntegration.decorationsEnabled")||E.affectsConfiguration("terminal.integrated.shellIntegration.enabled"))&&this._updateForShellIntegration(this._parentDomElement)}));let x=this._register(new ue);x.value=this._terminalService.onAnyInstanceAddedCapabilityType(E=>{E===2&&this._gutterDecorationsEnabled()&&(this._parentDomElement?.classList.add("shell-integration"),x.clear())})}get terminalTabbedView(){return this._terminalTabbedView}_updateForShellIntegration(e){e.classList.toggle("shell-integration",this._gutterDecorationsEnabled())}_gutterDecorationsEnabled(){let e=this._configurationService.getValue("terminal.integrated.shellIntegration.decorationsEnabled");return(e==="both"||e==="gutter")&&this._configurationService.getValue("terminal.integrated.shellIntegration.enabled")}_initializeTerminal(e){if(this.isBodyVisible()&&this._terminalService.isProcessSupportRegistered&&this._terminalService.connectionState===1){let t=this._isInitialized;this._isInitialized=!0;let o="never";t||(o=this._configurationService.getValue("terminal.integrated.hideOnStartup"),o==="always"&&this._terminalGroupService.hidePanel());let n=this._terminalGroupService.groups.length===0;if(e&&(n&&=this._terminalService.restoredGroupCount===0),!n)return;if(!t){switch(o){case"never":this._isTerminalBeingCreated=!0,this._terminalService.createTerminal({location:1}).finally(()=>this._isTerminalBeingCreated=!1);break;case"whenEmpty":this._terminalService.restoredGroupCount===0&&this._terminalGroupService.hidePanel();break}return}this._isTerminalBeingCreated||(this._isTerminalBeingCreated=!0,this._terminalService.createTerminal({location:1}).finally(()=>this._isTerminalBeingCreated=!1))}}renderBody(e){super.renderBody(e),this._parentDomElement||this._updateForShellIntegration(e),this._parentDomElement=e,this._parentDomElement.classList.add("integrated-terminal"),Pr(this._parentDomElement),this._instantiationService.createInstance(xpt,this._parentDomElement),this.shouldShowWelcome()||this._createTabsView(),this._register(this.configurationService.onDidChangeConfiguration(t=>{if((t.affectsConfiguration("terminal.integrated.fontFamily")||t.affectsConfiguration("editor.fontFamily"))&&!this._terminalConfigurationService.configFontIsMonospace()){let o=[{label:d(16102,null),run:()=>this.configurationService.updateValue("terminal.integrated.fontFamily","monospace")}];this._notificationService.prompt(ft.Warning,d(16101,null),o)}})),this._register(this.onDidChangeBodyVisibility(async t=>{if(this._viewShowing.set(t),t)this._hasWelcomeScreen()&&this._onDidChangeViewWelcomeState.fire(),this._initializeTerminal(!1),this._terminalGroupService.showPanel(!1);else for(let o of this._terminalGroupService.instances)o.resetFocusContextKey();this._terminalGroupService.updateVisibility()})),this._register(this._terminalService.onDidChangeConnectionState(()=>this._initializeTerminal(!0))),this.layoutBody(this._parentDomElement.offsetHeight,this._parentDomElement.offsetWidth)}_createTabsView(){this._parentDomElement&&(this._terminalTabbedView=this._register(this.instantiationService.createInstance(x2e,this._parentDomElement)))}layoutBody(e,t){super.layoutBody(e,t),this._terminalTabbedView?.layout(t,e)}createActionViewItem(e,t){switch(e.id){case"workbench.action.terminal.split":{let o=this,n=new O,r=n.add(new class extends it{constructor(){super(e.id,e.label,e.class,e.enabled),this.checked=e.checked,this.tooltip=e.tooltip}async run(){let l=o._terminalGroupService.activeInstance;if(l)return(await o._terminalService.createTerminal({location:{parentTerminal:l}}))?.focusWhenReady()}}),s=n.add(new ts(e,r,{...t,icon:!0,label:!1,keybinding:this._getKeybindingLabel(e)}));return this._actionDisposables.set(e.id,n),s}case"workbench.action.terminal.switchTerminal":{let o=this._instantiationService.createInstance(wpt,e);return this._actionDisposables.set(e.id,o),o}case"workbench.action.terminal.focus":{if(e instanceof Do){let o=Lu(this._singleTabMenu.getActions({shouldForwardArgs:!0})),n=this._instantiationService.createInstance(Cpt,e,o);return this._actionDisposables.set(e.id,n),n}break}case"workbench.action.terminal.new":if(e instanceof Do){this._disposableStore.clear();let o=u2e(1,this._terminalProfileService.availableProfiles,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore);return this._newDropdown.value=this._instantiationService.createInstance(BC,e,o.dropdownAction,o.dropdownMenuActions,o.className,{hoverDelegate:t.hoverDelegate,getKeyBinding:n=>this._keybindingService.lookupKeybinding(n.id,this._contextKeyService)}),this._newDropdown.value?.update(o.dropdownAction,o.dropdownMenuActions),this._newDropdown.value}}return super.createActionViewItem(e,t)}_getDefaultProfileName(){let e;try{e=this._terminalProfileService.getDefaultProfileName()}catch{e=this._terminalProfileResolverService.defaultProfileName}return e}_getKeybindingLabel(e){return this._keybindingService.lookupKeybinding(e.id)?.getLabel()??void 0}_updateTabActionBar(e){this._disposableStore.clear();let t=u2e(1,e,this._getDefaultProfileName(),this._terminalProfileService.contributedProfiles,this._terminalService,this._dropdownMenu,this._disposableStore);this._newDropdown.value?.update(t.dropdownAction,t.dropdownMenuActions)}focus(){if(super.focus(),this._terminalService.connectionState===1){this._terminalGroupService.instances.length===0&&!this._isTerminalBeingCreated&&(this._isTerminalBeingCreated=!0,this._terminalService.createTerminal({location:1}).finally(()=>this._isTerminalBeingCreated=!1)),this._terminalGroupService.showPanel(!0);return}let e=this.element.ownerDocument.activeElement;if(e){let t=this._register(U.once(this._terminalService.onDidChangeConnectionState)(()=>{e&&Na(e)&&this._terminalGroupService.showPanel(!0),this._store.delete(t)}))}}_hasWelcomeScreen(){return!this._terminalService.isProcessSupportRegistered}shouldShowWelcome(){return this._hasWelcomeScreen()&&this._terminalService.instances.length===0}};k2e=I([m(1,Le),m(2,X),m(3,ji),m(4,B),m(5,Xe),m(6,F),m(7,an),m(8,mp),m(9,Cc),m(10,Pe),m(11,ot),m(12,Ne),m(13,Le),m(14,Je),m(15,Yt),m(16,fb),m(17,ig)],k2e);var wpt=class extends NK{constructor(e,t,o,n,r,s){super(null,e,mFo(t,o),o.activeGroupIndex,n,nC,{ariaLabel:d(16104,null),optionsAsChildren:!0,useCustomDrawn:!BI(s)});this._terminalService=t;this._terminalGroupService=o;this._register(t.onDidChangeInstances(()=>this._updateItems(),this)),this._register(t.onDidChangeActiveGroup(()=>this._updateItems(),this)),this._register(t.onDidChangeActiveInstance(()=>this._updateItems(),this)),this._register(t.onAnyInstanceTitleChange(()=>this._updateItems(),this)),this._register(o.onDidChangeGroups(()=>this._updateItems(),this)),this._register(t.onDidChangeConnectionState(()=>this._updateItems(),this)),this._register(r.onDidChangeAvailableProfiles(()=>this._updateItems(),this)),this._register(t.onAnyInstancePrimaryStatusChange(()=>this._updateItems(),this))}render(e){super.render(e),e.classList.add("switch-terminal"),e.style.borderColor=Tt(RF)}_updateItems(){let e=mFo(this._terminalService,this._terminalGroupService);this.setOptions(e,this._terminalGroupService.activeGroupIndex)}};wpt=I([m(1,an),m(2,Cc),m(3,qn),m(4,fb),m(5,B)],wpt);function mFo(a,i){let e;return a.connectionState===1?e=i.getGroupLabels().map(t=>({text:t})):e=[{text:d(16103,null)}],e.push(GF),e.push({text:AKi}),e}var Cpt=class extends Cl{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,{draggable:!0,hoverDelegate:g.createInstance(kpt)},o,n,r,s,p,f);this._actions=t;this._terminalService=l;this._terminaConfigurationService=c;this._terminalGroupService=u;this._commandService=h;this._instantiationService=g;this._elementDisposables=[];this._register(U.debounce(U.any(this._terminalService.onAnyInstancePrimaryStatusChange,this._terminalGroupService.onDidChangeActiveInstance,U.map(this._terminalService.onAnyInstanceIconChange,v=>v.instance),this._terminalService.onAnyInstanceTitleChange,this._terminalService.onDidChangeInstanceCapability),(v,b)=>(v||(v=new Set),b&&v.add(b),v),EL)(v=>{for(let b of v)this.updateLabel(b)})),this._register(ee(()=>je(this._elementDisposables)))}async onClick(e){this._terminalGroupService.lastAccessedMenu="inline-tab",e.altKey&&this._menuItemAction.alt?this._commandService.executeCommand(this._menuItemAction.alt.id,{location:1}):this._openContextMenu()}updateLabel(e){if(!(e&&e!==this._terminalGroupService.activeInstance)&&(this._elementDisposables.length===0&&this.element&&this.label&&(this._elementDisposables.push($(this.element,ne.CONTEXT_MENU,t=>{t.button===2&&(this._openContextMenu(),t.stopPropagation(),t.preventDefault())})),this._elementDisposables.push($(this.element,ne.AUXCLICK,t=>{if(t.button===1){let o=this._terminalGroupService.activeInstance;o&&this._terminalService.safeDisposeTerminal(o),t.preventDefault()}})),this._elementDisposables.push($(this.element,ne.DRAG_START,t=>{let o=this._terminalGroupService.activeInstance;t.dataTransfer&&o&&t.dataTransfer.setData("Terminals",JSON.stringify([o.resource.toString()]))}))),this.label)){let t=this.label,o=this._terminalGroupService.activeInstance;if(!o){Ii(t,"");return}t.classList.add("single-terminal-tab");let n="",r=o.statusList.primary;if(r){let c=v7t(r.severity);this._themeService.getColorTheme();let u=this._themeService.getColorTheme().getColor(c);u&&(n=u.toString())}t.style.color=n,Ii(t,...ir(this._instantiationService.invokeFunction(PEn,o,this._terminaConfigurationService.config.tabs.separator,q.isThemeIcon(this._commandAction.item.icon)?this._commandAction.item.icon:void 0))),this._altCommand&&(t.classList.remove(this._altCommand),this._altCommand=void 0),this._color&&(t.classList.remove(this._color),this._color=void 0),this._class&&(t.classList.remove(this._class),t.classList.remove("terminal-uri-icon"),this._class=void 0);let s=lw(o);s&&(this._color=s,t.classList.add(s));let l=mR(o,this._themeService.getColorTheme().type);l&&(this._class=l?.[0],t.classList.add(...l)),this._commandAction.item.icon&&(this._altCommand="alt-command",t.classList.add(this._altCommand)),this.updateTooltip()}}_openContextMenu(){let e=new eIe;this._contextMenuService.showContextMenu({actionRunner:e,getAnchor:()=>this.element,getActions:()=>this._actions,getActionsContext:()=>{let t=this._terminalGroupService.activeInstance;return t?[new c7(t)]:[]},onHide:()=>e.dispose()})}};Cpt=I([m(2,Le),m(3,Ne),m(4,X),m(5,Pe),m(6,an),m(7,mp),m(8,Cc),m(9,Xe),m(10,fe),m(11,F),m(12,Ai)],Cpt);function PEn(a,i,e,t){if(!i||!i.title)return"";let o=q.isThemeIcon(i.icon)?i.icon.id:a.get(ig).getDefaultIcon().id,n=`$(${t?.id||o}) ${AEn(i,e)}`,r=i.statusList.primary;return r?.icon?`${n} $(${r.icon.id})`:n}function AEn(a,i){return a?a.description?`${a.title} ${i} ${a.description}`:a.title:""}var xpt=class extends ju{constructor(e,t,o,n){super(t);this._themeService=t;this._terminalService=o;this._terminalGroupService=n;this._registerListeners(),this._styleElement=Pr(e),this._register(ee(()=>this._styleElement.remove())),this.updateStyles()}_registerListeners(){this._register(this._terminalService.onAnyInstanceIconChange(()=>this.updateStyles())),this._register(this._terminalService.onDidChangeInstances(()=>this.updateStyles())),this._register(this._terminalGroupService.onDidChangeGroups(()=>this.updateStyles()))}updateStyles(){super.updateStyles();let e=this._themeService.getColorTheme(),t="";for(let o of this._terminalService.instances){let n=o.icon;if(!n)continue;let r;n instanceof A?r=n:n instanceof Object&&yo(n,{light:!0,dark:!0})&&(r=cm(e.type)?n.dark:n.light);let s=mR(o,e.type);r instanceof A&&s&&s.length>1&&(t+=`.monaco-workbench .${s[0]} .monaco-highlighted-label .codicon, .monaco-action-bar .terminal-uri-icon.single-terminal-tab.action-label:not(.alt-command) .codicon{background-image: ${cl(r)};}`)}for(let o of this._terminalService.instances){let n=lw(o);if(!n||!o.color)continue;let r=e.getColor(o.color);r&&(t+=`.monaco-workbench .${n} .codicon:first-child:not(.codicon-split-horizontal):not(.codicon-trashcan):not(.file-icon):not(.codicon-rerun-task){ color: ${r} !important; }`)}this._styleElement.textContent=t}};xpt=I([m(1,Pe),m(2,an),m(3,Cc)],xpt);var kpt=class{constructor(i,e,t,o){this._configurationService=i;this._hoverService=e;this._storageService=t;this._terminalGroupService=o;this._lastHoverHideTime=0;this.placement="element"}get delay(){return Date.now()-this._lastHoverHideTime<200?0:this._configurationService.getValue("workbench.hover.delay")}showHover(i,e){let t=this._terminalGroupService.activeInstance;if(!t)return;let o=tIe(t,this._storageService);return this._hoverService.showInstantHover({...i,content:o.content,actions:o.actions},e)}onDidHideHover(){this._lastHoverHideTime=Date.now()}};kpt=I([m(0,B),m(1,ot),m(2,de),m(3,Cc)],kpt);function GKi(a){return a.type.startsWith("session/")}function qKi(a,i){return`ahp-${a}-${i}`}function E7t(a,i){return`\x1B]633;SetMark;Id=${qKi(a,i)};Hidden\x07`}var FEn="<<<COPILOT_SENTINEL_";function hFo(a){return a.includes(FEn)}var Ept=class extends zse{constructor(e,t,o,n){super(e,!1);this._connection=t;this._terminalUri=o;this._options=n;this._startBarrier=new ip;this._subscriptionDisposables=this._register(new O);this._initialCwd="";this._onCommandExecuted=this._register(new T);this.onCommandExecuted=this._onCommandExecuted.event;this._onCommandFinished=this._register(new T);this.onCommandFinished=this._onCommandFinished.event;this._onSupportsCommandDetection=this._register(new T);this.onSupportsCommandDetection=this._onSupportsCommandDetection.event;this._supportsCommandDetection=!1;this._suppressedCommandIds=new Set}get supportsCommandDetection(){return this._supportsCommandDetection}async start(){try{this._options?.attachOnly||await this._connection.createTerminal({terminal:this._terminalUri.toString(),claim:{kind:"client",clientId:this._connection.clientId},name:this._options?.name,cwd:this._resolveCwdForProtocol(this._options?.cwd),cols:this._lastDimensions.cols>0?this._lastDimensions.cols:void 0,rows:this._lastDimensions.rows>0?this._lastDimensions.rows:void 0}),this._subscriptionRef=this._connection.getSubscription(2,this._terminalUri);let e=this._subscriptionRef.object;e.value===void 0&&await new Promise(o=>{let n=e.onDidChange(()=>{n.dispose(),o()});this._subscriptionDisposables.add(n)});let t=e.value;t.supportsCommandDetection&&(this._supportsCommandDetection=!0,this._onSupportsCommandDetection.fire()),this._replayContent(t.content),this._initialCwd=t.cwd?.toString()??"",this._properties.cwd=this._initialCwd,this._properties.initialCwd=this._initialCwd,t.title&&(this._properties.title=t.title),this._subscriptionDisposables.add(e.onDidApplyAction(o=>{this._handleAction(o)})),this._startBarrier.open(),this.handleReady({pid:-1,cwd:this._initialCwd,windowsPty:void 0});return}catch(e){return this._startBarrier.open(),{message:e instanceof Error?e.message:String(e)}}}_handleAction(e){let t=e.action;switch(t.type){case"terminal/data":this.handleData(t.data);break;case"terminal/exited":this.handleExit(t.exitCode);break;case"terminal/cwdChanged":this._properties.cwd=t.cwd.toString(),this.handleDidChangeProperty({type:"cwd",value:t.cwd.toString()});break;case"terminal/titleChanged":this._properties.title=t.title,this.handleDidChangeProperty({type:"title",value:t.title});break;case"terminal/resized":e.origin?.clientId!==this._connection.clientId&&this.handleDidChangeProperty({type:"overrideDimensions",value:{cols:t.cols,rows:t.rows}});break;case"terminal/commandDetectionAvailable":this._supportsCommandDetection||(this._supportsCommandDetection=!0,this._onSupportsCommandDetection.fire());break;case"terminal/commandExecuted":if(hFo(t.commandLine)){this._suppressedCommandIds.add(t.commandId);break}this.handleData(E7t(t.commandId,"s")),this._onCommandExecuted.fire({commandId:t.commandId,commandLine:t.commandLine,timestamp:t.timestamp});break;case"terminal/commandFinished":if(this._suppressedCommandIds.delete(t.commandId))break;this.handleData(E7t(t.commandId,"e")),this._onCommandFinished.fire({commandId:t.commandId,exitCode:t.exitCode,durationMs:t.durationMs});break}}_replayContent(e){for(let t of e)if(t.type==="unclassified")t.value&&this.handleData(t.value);else if(t.type==="command"){if(hFo(t.commandLine))continue;this.handleData(E7t(t.commandId,"s")),this._onCommandExecuted.fire({commandId:t.commandId,commandLine:t.commandLine,timestamp:t.timestamp,storedOutput:t.output}),t.output&&this.handleData(t.output),t.isComplete&&(this.handleData(E7t(t.commandId,"e")),this._onCommandFinished.fire({commandId:t.commandId,exitCode:t.exitCode,durationMs:t.durationMs}))}}_resolveCwdForProtocol(e){if(e)return e.scheme===IC?NZ(e).toString():e.toString()}input(e){this._inReplay||this._startBarrier.wait().then(()=>{this._connection.dispatch({type:"terminal/input",terminal:this._terminalUri.toString(),data:e})})}resize(e,t){this._inReplay||this._lastDimensions.cols===e&&this._lastDimensions.rows===t||(this._lastDimensions.cols=e,this._lastDimensions.rows=t,this._startBarrier.wait().then(()=>{this._connection.dispatch({type:"terminal/resized",terminal:this._terminalUri.toString(),cols:e,rows:t})}))}shutdown(e){this._startBarrier.wait().then(()=>{this._options?.attachOnly||this._connection.disposeTerminal(this._terminalUri),this._subscriptionRef?.dispose(),this._subscriptionRef=void 0,this._subscriptionDisposables.clear(),this.handleExit(void 0)})}async getInitialCwd(){return this._initialCwd}async getCwd(){return this._properties.cwd||this._initialCwd}async clearBuffer(){this._connection.dispatch({type:"terminal/cleared",terminal:this._terminalUri.toString()})}acknowledgeDataEvent(e){}async setUnicodeVersion(e){}processBinary(e){return Promise.resolve()}sendSignal(e){}async refreshProperty(e){return this._properties[e]}async updateProperty(e,t){}async reconnect(e){this._subscriptionDisposables.clear(),this._subscriptionRef?.dispose(),this._subscriptionRef=void 0,this._connection=e;try{this._subscriptionRef=this._connection.getSubscription(2,this._terminalUri);let t=this._subscriptionRef.object;t.value===void 0&&await new Promise((r,s)=>{let l=setTimeout(()=>{c.dispose(),s(new Error("Reconnect hydration timed out"))},1e4),c=t.onDidChange(()=>{clearTimeout(l),c.dispose(),r()});this._subscriptionDisposables.add(c)});let o=t.value;return o.supportsCommandDetection&&!this._supportsCommandDetection&&(this._supportsCommandDetection=!0,this._onSupportsCommandDetection.fire()),this.handleData("\x1B[2J\x1B[3J\x1B[H"),this._replayContent(o.content),o.cwd&&(this._properties.cwd=o.cwd.toString()),o.title&&(this._properties.title=o.title),this._subscriptionDisposables.add(t.onDidApplyAction(n=>{this._handleAction(n)})),!0}catch(t){return console.warn("[AgentHostPty] Reconnection failed:",t instanceof Error?t.message:String(t)),!1}}get terminalUri(){return this._terminalUri}dispose(){this._subscriptionRef?.dispose(),this._subscriptionRef=void 0,super.dispose()}};var $Ki=class{constructor(i,e,t,o){this.commandLineConfidence="high";this.isTrusted=!1;this.duration=0;this.cwd=void 0;this.exitCode=void 0;this.commandStartLineContent=void 0;this.markProperties=void 0;this.executedX=void 0;this.startX=void 0;this._isComplete=!1;this.id=i,this.command=e,this.timestamp=t,this._resolveMarker=o?.resolveMarker,this._storedOutput=o?.storedOutput,this.wasReplayed=o?.wasReplayed}get executedMarker(){return this._executedMarker===void 0&&this._resolveMarker&&(this._executedMarker=this._resolveMarker("s")),this._executedMarker}get endMarker(){return this._endMarker===void 0&&this._isComplete&&this._resolveMarker&&(this._endMarker=this._resolveMarker("e")),this._endMarker}set endMarker(i){this._endMarker=i}extractCommandLine(){return this.command}getOutput(){return this._storedOutput!==void 0?Hv(this._storedOutput):void 0}getRawOutput(){return this._storedOutput}hasOutput(){return this._storedOutput!==void 0?this._storedOutput.length>0:!1}getOutputMatch(i){}getPromptRowCount(){return 1}getCommandRowCount(){return 1}appendOutput(i){this._storedOutput===void 0?this._storedOutput=i:this._storedOutput+=i}finish(i,e){this.exitCode=i,this.duration=e??0,this._isComplete=!0}},T7t=class extends k{constructor(){super(...arguments);this._commands=[];this._onCommandExecuted=this._register(new T);this.onCommandExecuted=this._onCommandExecuted.event;this._onCommandFinished=this._register(new T);this.onCommandFinished=this._onCommandFinished.event}get commands(){return this._commands}get executingCommandObject(){return this._executingCommand}connect(e,t){this._terminalInstance=e,this._register(t.onCommandExecuted(o=>this._handleCommandExecuted(o))),this._register(t.onCommandFinished(o=>this._handleCommandFinished(o))),this._register(e.onWillData(o=>{this._executingCommand&&!this._executingCommand.wasReplayed&&this._executingCommand.appendOutput(o)}))}getCommandById(e){return this._executingCommand?.id===e?this._executingCommand:this._commands.find(t=>t.id===e)}_resolveMarkById(e,t){let o=qKi(e,t);return this._terminalInstance?.capabilities.get(4)?.getMark(o)}_handleCommandExecuted(e){let t=new $Ki(e.commandId,e.commandLine,e.timestamp,{resolveMarker:o=>this._resolveMarkById(e.commandId,o),storedOutput:e.storedOutput,wasReplayed:e.storedOutput!==void 0});this._executingCommand=t,this._onCommandExecuted.fire(t)}_handleCommandFinished(e){let t=this._executingCommand?.id===e.commandId?this._executingCommand:this._commands.find(o=>o.id===e.commandId);t&&(t.finish(e.exitCode,e.durationMs),this._executingCommand===t&&(this._executingCommand=void 0,this._commands.push(t)),this._onCommandFinished.fire(t))}};var jKi="vscode.agent-host-terminal",T2e=le("agentHostTerminalService"),E2e=class extends k{constructor(e,t,o,n){super();this._terminalService=e;this._terminalChatService=t;this._terminalProfileService=o;this._quickInputService=n;this._entries=[];this._usedHosts=new Set;this._profileRegistrations=this._register(new Ot);this._profiles=De("agentHostTerminalProfiles",[]);this.profiles=this._profiles;this._revivedInstances=new Map;this._activePtys=new Map;this._reviveSequencer=new II}registerEntry(e){return this._entries.push(e),this._reconcile(),ee(()=>{let t=this._entries.indexOf(e);t>=0&&(this._entries.splice(t,1),this._reconcile())})}getProfileForConnection(e){if(this._entries.find(o=>o.address===e))return this._profileRegistrations.has(e)||(this._usedHosts.add(e),this._reconcile()),this._profiles.get().find(o=>o.address===e)}setDefaultCwd(e){this._defaultCwd=e}_reconcile(){let e=this._entries,t=new Map;if(e.length!==0)if(e.length===1)t.set(e[0].address,e[0]);else{let n=0;for(let r of this._usedHosts){let s=e.find(l=>l.address===r);s&&(n++,t.set(s.address,s))}if(n===e.length-1){let r=e.find(s=>!this._usedHosts.has(s.address));r&&t.set(r.address,r)}else n<e.length&&t.set("__quickpick__",{name:d(15914,null),address:"__quickpick__",getConnection:()=>{}})}for(let[n,r]of t)this._profileRegistrations.has(n)||this._registerProfile(n,r,e);for(let n of this._profileRegistrations.keys())t.has(n)||this._profileRegistrations.deleteAndDispose(n);let o=[];for(let[n]of t)o.push({extensionIdentifier:jKi,profileId:n,title:n==="__quickpick__"?d(15914,null):d(15916,null,t.get(n).name),address:n});Ki(n=>{this._profiles.set(o,n)})}_registerProfile(e,t,o){let n={createContributedTerminalProfile:async l=>{let c,u=t.name;if(e==="__quickpick__"){let p=o.map(g=>({label:d(15916,null,g.name),address:g.address,hostName:g.name})),h=await this._quickInputService.pick(p,{placeHolder:d(15915,null)});if(!h)return;this._usedHosts.add(h.address),this._reconcile(),u=h.hostName,c=o.find(g=>g.address===h.address)?.getConnection()}else c=t.getConnection();c&&await this.createTerminal(c,{name:d(15916,null,u),cwd:l.cwd?typeof l.cwd=="string"?A.file(l.cwd):l.cwd:this._defaultCwd,location:l.location})}},r=e==="__quickpick__"?d(15914,null):d(15916,null,t.name),s=new O;s.add(this._terminalProfileService.registerTerminalProfileProvider(jKi,e,n)),s.add(this._terminalProfileService.registerInternalContributedProfile({extensionIdentifier:jKi,id:e,title:r,icon:"remote"})),this._profileRegistrations.set(e,s)}async createTerminalForEntry(e,t){let o=this._entries.find(r=>r.address===e);if(!o)return;let n=o.getConnection();if(n)return this.createTerminal(n,t)}async createTerminal(e,t){let o=A.from({scheme:"agenthost-terminal",path:`/${ht()}`}),n=t?.name??d(15913,null),r=o.toString(),s=await this._terminalService.createTerminal({config:{customPtyImplementation:(l,c,u)=>{let p=new Ept(l,e,o,{name:n,cwd:t?.cwd});return c>0&&u>0&&p.resize(c,u),this._activePtys.set(r,{pty:p,clientId:e.clientId}),p},name:n,icon:{id:"remote"},isFeatureTerminal:!1},location:t?.location});return this._register(s.onDisposed(()=>{this._activePtys.delete(r)})),s}async reviveTerminal(e,t,o){let n=t.toString();return this._reviveSequencer.queue(n,()=>this._doReviveTerminal(e,t,o,n))}async _doReviveTerminal(e,t,o,n){let r=this._revivedInstances.get(n);if(r)return r;let s=new O,l=s.add(new T7t);s.add(this._terminalChatService.registerAhpCommandSource(o,l));let c=await this._terminalService.createTerminal({config:{customPtyImplementation:(u,p,h)=>{let g=new Ept(u,e,t,{attachOnly:!0});return p>0&&h>0&&g.resize(p,h),s.isDisposed||l.connect(c,g),this._activePtys.set(n,{pty:g,clientId:e.clientId}),g},name:d(15917,null),isFeatureTerminal:!0,hideFromUser:!0}});return this._terminalChatService.registerTerminalInstanceWithToolSession(o,c),this._revivedInstances.set(n,c),c.store.add(s),this._register(c.onDisposed(()=>{this._revivedInstances.delete(n),this._activePtys.delete(n)})),c}async reconnectTerminals(e,t){let o=[...this._activePtys.entries()].filter(([,l])=>l.clientId===t),n=o.length,r=0,s=[];for(let[l,c]of o)s.push(c.pty.reconnect(e).then(u=>{u?(r++,c.clientId=e.clientId):console.warn(`[AgentHostTerminalService] Failed to reconnect terminal: ${l}`)}));return await Promise.all(s),{recovered:r,total:n}}};E2e=I([m(0,an),m(1,tg),m(2,fb),m(3,$e)],E2e);Ce(wa,o2e,1);Ce(mp,d2e,1);Ce(an,JC,1);Ce(hb,h2e,1);Ce(hee,n2e,1);Ce(Cc,f2e,1);Ce(uh,sIe,1);Ce(fb,lIe,1);Ce(T2e,E2e,1);bt(aIe.ID,aIe,vt.BlockStartup);bt(JSe.ID,JSe,vt.AfterRestored);bt(cIe.ID,cIe,vt.AfterRestored);Oco();qOo(Dwt);oe.as(en.EditorFactory).registerEditorSerializer(Zf.ID,m2e);oe.as(en.EditorPane).registerEditorPane(os.create(p2e,sG,vr.terminal),[new Vt(Zf)]);oe.as(WB.DragAndDropContribution).register({dataFormatKey:"Terminals",getEditorInputs(a){let i=[];try{let e=JSON.parse(a);for(let t of e)i.push({resource:A.parse(t)})}catch{}return i},setData(a,i){let e=a.filter(({resource:t})=>t.scheme===Q.vscodeTerminal);e.length&&i.dataTransfer?.setData("Terminals",JSON.stringify(e.map(({resource:t})=>t.toString())))}});var WEn=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:Fc,title:P(15928,"Terminal"),icon:hNi,ctorDescriptor:new Vt(Qc,[Fc,{mergeViewWithContainerWhenSingleView:!0}]),storageId:Fc,hideIfEmpty:!0,order:3,windowEnablement:3},1,{doNotRegisterOpenCommand:!0,isDefault:!0});oe.as(Kn.ViewsRegistry).registerViews([{id:Fc,name:P(15928,"Terminal"),containerIcon:hNi,canToggleVisibility:!0,canMoveView:!0,ctorDescriptor:new Vt(k2e),windowEnablement:3,openCommandActionDescriptor:{id:"workbench.action.terminal.toggleTerminal",mnemonicTitle:d(15927,null),keybindings:{primary:2139,mac:{primary:347}},order:3}}],WEn);JOo();tFo();nFo();bdo();var qse=class extends k{constructor(e,t){super();this._extensionService=e;this._storageService=t;this.collections=new Map;this._onDidChangeCollections=this._register(new T);this._storageService.remove("terminal.integrated.environmentVariableCollections",1);let o=this._storageService.get("terminal.integrated.environmentVariableCollectionsV2",1);o&&(JSON.parse(o).forEach(r=>this.collections.set(r.extensionIdentifier,{persistent:!0,map:cZe(r.collection),descriptionMap:dZe(r.description)})),this._invalidateExtensionCollections()),this.mergedCollection=this._resolveMergedCollection(),this._register(this._extensionService.onDidChangeExtensions(()=>this._invalidateExtensionCollections()))}get onDidChangeCollections(){return this._onDidChangeCollections.event}set(e,t){this.collections.set(e,t),this._updateCollections()}delete(e){this.collections.delete(e),this._updateCollections()}_updateCollections(){this._persistCollectionsEventually(),this.mergedCollection=this._resolveMergedCollection(),this._notifyCollectionUpdatesEventually()}_persistCollectionsEventually(){this._persistCollections()}_persistCollections(){let e=[];this.collections.forEach((o,n)=>{o.persistent&&e.push({extensionIdentifier:n,collection:Rme(this.collections.get(n).map),description:lZe(o.descriptionMap)})});let t=JSON.stringify(e);this._storageService.store("terminal.integrated.environmentVariableCollectionsV2",t,1,1)}_notifyCollectionUpdatesEventually(){this._notifyCollectionUpdates()}_notifyCollectionUpdates(){this._onDidChangeCollections.fire(this.mergedCollection)}_resolveMergedCollection(){return new v2e(this.collections)}async _invalidateExtensionCollections(){await this._extensionService.whenInstalledExtensionsRegistered();let e=this._extensionService.extensions,t=!1;this.collections.forEach((o,n)=>{e.some(s=>s.identifier.value===n)||(this.collections.delete(n),t=!0)}),t&&this._updateCollections()}};I([DA(1e3)],qse.prototype,"_persistCollectionsEventually",1),I([Tu(1e3)],qse.prototype,"_notifyCollectionUpdatesEventually",1),qse=I([m(0,lt),m(1,de)],qse);Ce(gG,qse,1);Ce(y2e,k7t,1);var _2e=class extends k{constructor(e,t,o){super();this._xterm=e;this._configurationService=t;this._logService=o;this._priorEditorViewportLineCount=0;this._lines=[];this.bufferToEditorLineMapping=new Map}get lines(){return this._lines}reset(){this._lines=[],this._lastCachedMarker=void 0,this.update()}update(){this._lastCachedMarker?.isDisposed&&(this._lines=[],this._lastCachedMarker=void 0),this._removeViewportContent(),this._updateCachedContent(),this._updateViewportContent(),this._lastCachedMarker=this._register(this._xterm.raw.registerMarker()),this._logService.debug("Buffer content tracker: set ",this._lines.length," lines")}_updateCachedContent(){let e=this._xterm.raw.buffer.active,t=this._lastCachedMarker?.line?this._lastCachedMarker.line-this._xterm.raw.rows+1:0,o=e.baseY;if(t<0||t>o)return;let r=this._configurationService.getValue("terminal.integrated.scrollback")+this._xterm.raw.rows-1,s=o-t;if(s+this._lines.length>r){let u=s+this._lines.length-r;for(let p=0;p<u;p++)this._lines.shift();this._logService.debug("Buffer content tracker: removed ",u," lines from top of cached lines, now ",this._lines.length," lines")}let l=[],c="";for(let u=t;u<o;u++){let p=e.getLine(u);if(!p)continue;this.bufferToEditorLineMapping.set(u,this._lines.length+l.length);let h=e.getLine(u+1)?.isWrapped;c+=p.translateToString(!h),(c&&!h||u===e.baseY+this._xterm.raw.rows-1)&&p.length&&(l.push(c),c="")}this._logService.debug("Buffer content tracker:",l.length," lines cached"),this._lines.push(...l)}_removeViewportContent(){if(!this._lines.length)return;let e=this._priorEditorViewportLineCount,t=1;for(;e;)this.bufferToEditorLineMapping.forEach((o,n)=>{o===this._lines.length-t&&this.bufferToEditorLineMapping.delete(n)}),this._lines.pop(),t++,e--;this._logService.debug("Buffer content tracker: removed lines from viewport, now ",this._lines.length," lines cached")}_updateViewportContent(){let e=this._xterm.raw.buffer.active;this._priorEditorViewportLineCount=0;let t="";for(let o=e.baseY;o<e.baseY+this._xterm.raw.rows;o++){let n=e.getLine(o);if(!n)continue;this.bufferToEditorLineMapping.set(o,this._lines.length);let r=e.getLine(o+1)?.isWrapped;t+=n.translateToString(!r),(t&&!r||o===e.baseY+this._xterm.raw.rows-1)&&t.length&&(this._priorEditorViewportLineCount++,this._lines.push(t),t="")}this._logService.debug("Viewport content update complete, ",this._lines.length," lines in the viewport")}};_2e=I([m(1,B),m(2,wa)],_2e);var dIe=class extends k{constructor(e,t,o,n,r){super();this._instance=e;this._commandService=o;this._configurationService=n;this._contextKeyService=r;this.id="terminal-help";this._hasShellIntegration=!1;this.options={type:"help",readMoreUrl:"https://code.visualstudio.com/docs/editor/accessibility#_terminal-accessibility"};this.verbositySettingKey="accessibility.verbosity.terminal";this._hasShellIntegration=t.shellIntegration.status===2}onClose(){C.and(Jd,C.equals(Fu.key,"terminal-help"))?.evaluate(this._contextKeyService.getContext(null))?this._commandService.executeCommand("workbench.action.terminal.focusAccessibleBuffer"):this._instance.focus(),this.dispose()}provideContent(){let e=[d(16382,null,"workbench.action.terminal.focusAccessibleBuffer"),d(16392,null),d(16391,null,"workbench.action.terminal.openDetectedLink"),d(16389,null,"workbench.action.terminal.newWithProfile"),d(16383,null,"terminal.integrated.focusAfterRun")];return this._configurationService.getValue("terminal.integrated.accessibleViewFocusOnCommandExecution")||e.push(d(16384,null)),this._configurationService.getValue("terminal.integrated.suggest.enabled")&&(e.push(d(16400,null,"workbench.action.terminal.triggerSuggest")),e.push(d(16395,null)),e.push(d(16396,null,"workbench.action.terminal.acceptSelectedSuggestion","workbench.action.terminal.configureSuggestSettings")),e.push(d(16397,null,"workbench.action.terminal.suggestToggleDetails","workbench.action.terminal.suggestToggleDetailsFocus")),e.push(d(16399,null,"workbench.action.terminal.suggestLearnMore")),e.push(d(16398,null,"workbench.action.terminal.configureSuggestSettings"))),this._instance.shellType==="cmd"&&e.push(d(16381,null)),this._hasShellIntegration?(e.push(d(16394,null)),e.push("- "+d(16385,null,"workbench.action.terminal.accessibleBufferGoToNextCommand")),e.push("- "+d(16386,null,"workbench.action.terminal.accessibleBufferGoToPreviousCommand")),e.push("- "+d(16388,null,"editor.action.accessibleViewGoToSymbol")),e.push("- "+d(16393,null,"workbench.action.terminal.runRecentCommand")),e.push("- "+d(16387,null,"workbench.action.terminal.goToRecentDirectory"))):e.push(d(16390,null)),e.join(`
`)}};dIe=I([m(2,fe),m(3,B),m(4,X)],dIe);var D2e=class extends k{constructor(e,t,o,n,r){super();this._instance=e;this._bufferTracker=t;this.id="terminal";this.options={type:"view",language:"terminal",id:"terminal"};this.verbositySettingKey="accessibility.verbosity.terminal";this._onDidRequestClearProvider=this._register(new T);this.onDidRequestClearLastProvider=this._onDidRequestClearProvider.event;this.options.customHelp=o,this.options.position=n.getValue("terminal.integrated.accessibleViewPreserveCursorPosition")?"initial-bottom":"bottom",this._register(this._instance.onDisposed(()=>this._onDidRequestClearProvider.fire("terminal"))),this._register(n.onDidChangeConfiguration(s=>{s.affectsConfiguration("terminal.integrated.accessibleViewPreserveCursorPosition")&&(this.options.position=n.getValue("terminal.integrated.accessibleViewPreserveCursorPosition")?"initial-bottom":"bottom")})),this._focusedInstance=r.activeInstance,this._register(r.onDidChangeActiveInstance(()=>{r.activeInstance&&this._focusedInstance?.instanceId!==r.activeInstance?.instanceId&&(this._onDidRequestClearProvider.fire("terminal"),this._focusedInstance=r.activeInstance)}))}onClose(){this._instance.focus()}provideContent(){return this._bufferTracker.update(),this._bufferTracker.lines.join(`
`)}getSymbols(){let e=this._getCommandsWithEditorLine()??[],t=[];for(let o of e){let n=o.command.command;n&&t.push({label:n,lineNumber:o.lineNumber})}return t}_getCommandsWithEditorLine(){let e=this._instance.capabilities.get(2),t=e?.commands,o=e?.currentCommand;if(!t?.length)return;let n=[];for(let r of t){let s=this._getEditorLineForCommand(r);s!==void 0&&n.push({command:r,lineNumber:s,exitCode:r.exitCode})}if(o){let r=this._getEditorLineForCommand(o);r!==void 0&&n.push({command:o,lineNumber:r})}return n}_getEditorLineForCommand(e){let t;if(XC(e)?t=e.marker?.line:t=e.commandStartMarker?.line,!(t===void 0||t<0)&&(t=this._bufferTracker.bufferToEditorLineMapping.get(t),t!==void 0))return t+1}};D2e=I([m(3,B),m(4,an)],D2e);var $se=class extends k{constructor(e,t,o,n){super();this._capabilities=e;this._accessibilityService=t;this._configurationService=o;this._logService=n;this._listeners=this._register(new ue);this._register(U.runAndSubscribe(U.any(this._capabilities.onDidChangeCapabilities,this._accessibilityService.onDidChangeScreenReaderOptimized),()=>{this._refreshListeners()}))}activate(e){this._terminal=e,this._refreshListeners()}_refreshListeners(){let e=this._capabilities.get(2);if(this._shouldBeActive()&&e){if(!this._listeners.value){let t=this._terminal?.textarea;t&&(this._listeners.value=U.runAndSubscribe(e.promptInputModel.onDidChangeInput,()=>this._sync(t)))}}else this._listeners.clear()}_shouldBeActive(){return this._accessibilityService.isScreenReaderOptimized()||this._configurationService.getValue("terminal.integrated.developer.devMode")}_sync(e){let t=this._capabilities.get(2);t&&(e.value=t.promptInputModel.value,e.selectionStart=t.promptInputModel.cursorIndex,e.selectionEnd=t.promptInputModel.cursorIndex,this._logService.debug(`TextAreaSyncAddon#sync: text changed to "${e.value}"`))}};I([Tu(50)],$se.prototype,"_sync",1),$se=I([m(1,Ai),m(2,B),m(3,wa)],$se);var jse=class extends O{constructor(e,t){super();this._ctx=e;this._instantiationService=t}static{this.ID="terminal.textAreaSync"}static get(e){return e.getContribution(jse.ID)}layout(e){this._addon||(this._addon=this.add(this._instantiationService.createInstance($se,this._ctx.instance.capabilities)),e.raw.loadAddon(this._addon),this._addon.activate(e.raw))}};jse=I([m(1,F)],jse);tm(jse.ID,jse);var $1=class extends k{constructor(e,t,o,n,r,s,l){super();this._ctx=e;this._accessibilitySignalService=t;this._accessibleViewService=o;this._configurationService=n;this._contextKeyService=r;this._instantiationService=s;this._terminalService=l;this._onDidRunCommand=this._register(new ue);this._register(Xee.addImplementation(90,"terminal",()=>this._terminalService.activeInstance!==this._ctx.instance?!1:(this.show(),!0),pt.focus)),this._register(this._ctx.instance.onDidExecuteText(()=>{let c=n.getValue("terminal.integrated.focusAfterRun");c==="terminal"?this._ctx.instance.focus(!0):c==="accessible-buffer"&&this.show()})),this._register(this._configurationService.onDidChangeConfiguration(c=>{c.affectsConfiguration("terminal.integrated.accessibleViewFocusOnCommandExecution")&&this._updateCommandExecutedListener()})),this._register(this._ctx.instance.capabilities.onDidAddCapability(c=>{c.capability.type===2&&this._updateCommandExecutedListener()}))}static{this.ID="terminal.accessibleBufferProvider"}static get(e){return e.getContribution($1.ID)}xtermReady(e){let t=this._instantiationService.createInstance($se,this._ctx.instance.capabilities);e.raw.loadAddon(t),t.activate(e.raw),this._xterm=e,this._register(this._xterm.raw.onWriteParsed(async()=>{this._terminalService.activeInstance===this._ctx.instance&&this._isTerminalAccessibleViewOpen()&&this._xterm.raw.buffer.active.baseY===0&&this.show()}));let o=U.latch(this._xterm.raw.onScroll);this._register(o(()=>{this._terminalService.activeInstance===this._ctx.instance&&this._isTerminalAccessibleViewOpen()&&this.show()}))}_updateCommandExecutedListener(){if(!this._ctx.instance.capabilities.has(2))return;if(this._configurationService.getValue("terminal.integrated.accessibleViewFocusOnCommandExecution")){if(this._onDidRunCommand.value)return}else{this._onDidRunCommand.clear();return}let e=this._ctx.instance.capabilities.get(2);this._onDidRunCommand.value=e.onCommandExecuted(()=>{this._ctx.instance.hasFocus&&this.show()})}_isTerminalAccessibleViewOpen(){return Fu.getValue(this._contextKeyService)==="terminal"}show(){if(!this._xterm)return;this._bufferTracker||(this._bufferTracker=this._register(this._instantiationService.createInstance(_2e,this._xterm))),this._bufferProvider||(this._bufferProvider=this._register(this._instantiationService.createInstance(D2e,this._ctx.instance,this._bufferTracker,()=>this._register(this._instantiationService.createInstance(dIe,this._ctx.instance,this._xterm)).provideContent())));let e=this._configurationService.getValue("terminal.integrated.accessibleViewPreserveCursorPosition")?this._accessibleViewService.getPosition("terminal"):void 0;this._accessibleViewService.show(this._bufferProvider,e)}navigateToCommand(e){let t=this._accessibleViewService.getPosition("terminal")?.lineNumber,o=this._getCommandsWithEditorLine();if(!o?.length||!t)return;let n=e==="previous"?o.filter(l=>l.lineNumber<t).sort((l,c)=>c.lineNumber-l.lineNumber):o.filter(l=>l.lineNumber>t).sort((l,c)=>l.lineNumber-c.lineNumber);if(!n.length)return;let r=n[0],s=r.command.command;!ii&&s?(this._accessibleViewService.setPosition(new ye(r.lineNumber,1),!0),cn(s)):this._accessibleViewService.setPosition(new ye(r.lineNumber,1),!0,!0),r.exitCode?this._accessibilitySignalService.playSignal(tn.terminalCommandFailed):this._accessibilitySignalService.playSignal(tn.terminalCommandSucceeded)}_getCommandsWithEditorLine(){let e=this._ctx.instance.capabilities.get(2),t=e?.commands,o=e?.currentCommand;if(!t?.length)return;let n=[];for(let r of t){let s=this._getEditorLineForCommand(r);s&&n.push({command:r,lineNumber:s,exitCode:r.exitCode})}if(o){let r=this._getEditorLineForCommand(o);r&&n.push({command:o,lineNumber:r})}return n}_getEditorLineForCommand(e){if(!this._bufferTracker)return;let t;if(XC(e)?t=e.marker?.line:t=e.commandStartMarker?.line,!(t===void 0||t<0)&&(t=this._bufferTracker.bufferToEditorLineMapping.get(t),t!==void 0))return t+1}};$1=I([m(1,br),m(2,Kd),m(3,B),m(4,X),m(5,F),m(6,an)],$1);tm($1.ID,$1);var _7t=class extends k{constructor(){super(),this._register(zme.addImplementation(105,"terminal",async i=>{let e=i.get(F),t=i.get(an),o=i.get(Kd),n=await t.getActiveOrCreateInstance();await t.revealActiveTerminal();let r=n?.xterm;r&&o.show(e.createInstance(dIe,n,r))},C.or(pt.focus,C.and(Jd,C.equals(Fu.key,"terminal")))))}};tm(_7t.ID,_7t);var QKi=class extends z{constructor(){super({id:"workbench.action.terminal.focusAccessibleBuffer",title:P(16378,"Focus Accessible Terminal View"),precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),keybinding:[{primary:572,secondary:[2064],linux:{primary:1596,secondary:[2064]},weight:200,when:C.and(Oa,pt.focus)}]})}async run(i,...e){let o=await i.get(an).getActiveOrCreateInstance();o?.xterm&&$1.get(o)?.show()}};W(QKi);Wr({id:"workbench.action.terminal.accessibleBufferGoToNextCommand",title:P(16376,"Accessible Buffer Go to Next Command"),precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated,C.and(Jd,C.equals(Fu.key,"terminal"))),keybinding:[{primary:530,when:C.and(C.and(Jd,C.equals(Fu.key,"terminal"))),weight:202}],run:async a=>{let i=a.service.activeInstance;i&&$1.get(i)?.navigateToCommand("next")}});Wr({id:"workbench.action.terminal.accessibleBufferGoToPreviousCommand",title:P(16377,"Accessible Buffer Go to Previous Command"),precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),C.and(Jd,C.equals(Fu.key,"terminal"))),keybinding:[{primary:528,when:C.and(C.and(Jd,C.equals(Fu.key,"terminal"))),weight:202}],run:async a=>{let i=a.service.activeInstance;i&&$1.get(i)?.navigateToCommand("previous")}});Wr({id:"workbench.action.terminal.scrollToBottomAccessibleView",title:P(16379,"Scroll to Accessible View Bottom"),precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),C.and(Jd,C.equals(Fu.key,"terminal"))),keybinding:{primary:2061,linux:{primary:1037},when:Fu.isEqualTo("terminal"),weight:200},run:(a,i)=>{let e=i.get(Kd),t=e.getLastPosition();t&&e.setPosition(t,!0)}});Wr({id:"workbench.action.terminal.scrollToTopAccessibleView",title:P(16380,"Scroll to Accessible View Top"),precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),C.and(Jd,C.equals(Fu.key,"terminal"))),keybinding:{primary:2062,linux:{primary:1038},when:Fu.isEqualTo("terminal"),weight:200},run:(a,i)=>i.get(Kd)?.setPosition(new ye(1,1),!0)});var R2e=class extends k{constructor(e,t){super();this._configurationService=e;for(let o of t.getRegisteredBackends())this._installListenersOnBackend(o);this._register(t.onDidRegisterBackend(async o=>this._installListenersOnBackend(o)))}static{this.ID="terminalAutoReplies"}_installListenersOnBackend(e){let t=this._configurationService.getValue(gb);for(let o of Object.keys(t.autoReplies)){let n=t.autoReplies[o];n&&e.installAutoReply(o,n)}this._register(this._configurationService.onDidChangeConfiguration(async o=>{if(o.affectsConfiguration("terminal.integrated.autoReplies")){e.uninstallAllAutoReplies();let n=this._configurationService.getValue(gb);for(let r of Object.keys(n.autoReplies)){let s=n.autoReplies[r];s&&e.installAutoReply(r,s)}}}))}};R2e=I([m(0,B),m(1,uh)],R2e);bt(R2e.ID,R2e,vt.AfterRestored);var YKi={id:"terminal_last_command",toolReferenceName:"terminalLastCommand",legacyToolReferenceFullNames:["runCommands/terminalLastCommand"],displayName:d(16475,null),modelDescription:"Get the last command run in the active terminal.",source:wn.Internal,icon:L.terminal},L2e=class extends k{constructor(e){super();this._terminalService=e}async prepareToolInvocation(e,t){return{invocationMessage:d(16474,null),pastTenseMessage:d(16473,null)}}async invoke(e,t,o,n){let r=this._terminalService.activeInstance;if(!r)return{content:[{kind:"text",value:"No active terminal instance found."}]};let s=r.capabilities.get(2);if(!s)return{content:[{kind:"text",value:"No command detection capability available in the active terminal."}]};let l=s.executingCommand;if(l){let h=[];h.push("The following command is currently executing in the terminal:"),h.push(l);let g=s.cwd;return g&&(h.push("It is running in the directory:"),h.push(g)),{content:[{kind:"text",value:h.join(`
`)}]}}let c=s.commands;if(!c||c.length===0)return{content:[{kind:"text",value:"No command has been run in the active terminal."}]};let u=c[c.length-1],p=[];if(u.command&&(p.push("The following is the last command run in the terminal:"),p.push(u.command)),u.cwd&&(p.push("It was run in the directory:"),p.push(u.cwd)),u.exitCode!==void 0&&p.push(`It exited with code: ${u.exitCode}`),u.hasOutput()&&u.getOutput){let h=u.getOutput();h&&h.trim().length>0&&(p.push("It has the following output:"),p.push(h))}return{content:[{kind:"text",value:p.join(`
`)}]}}};L2e=I([m(0,an)],L2e);var XKi={id:"kill_terminal",toolReferenceName:"killTerminal",displayName:d(16484,null),modelDescription:"Kill a terminal by its ID. Use this to clean up terminals that are no longer needed (e.g., after stopping a server or when a long-running task completes). The terminal ID is returned by run_in_terminal in async mode (legacy: isBackground=true).",icon:L.terminal,source:wn.Internal,inputSchema:{type:"object",properties:{id:{type:"string",description:"The ID of the persistent terminal to kill (returned by run_in_terminal in async mode).",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"}},required:["id"]}},D7t=class extends k{async prepareToolInvocation(i,e){return{invocationMessage:d(16483,null),pastTenseMessage:d(16482,null)}}async invoke(i,e,t,o){let n=i.parameters,r=ic.getExecution(n.id);if(!r)return{content:[{kind:"text",value:`Error: No active terminal execution found with ID ${n.id}. The terminal may have already been killed or the ID is invalid.`}]};let s=r.getOutput();ic.markKilledByTool(n.id),r.instance.dispose();let l=s?`Final output before termination:
${s}`:"No output was captured.";return{content:[{kind:"text",value:`Successfully killed persistent terminal ${n.id}. ${l}`}]}}};var JKi={id:"get_terminal_output",toolReferenceName:"getTerminalOutput",legacyToolReferenceFullNames:["runCommands/getTerminalOutput"],displayName:d(16478,null),modelDescription:"Get output from an active terminal execution (identified by the `id` returned from run_in_terminal).",icon:L.terminal,source:wn.Internal,inputSchema:{type:"object",properties:{id:{type:"string",description:"The ID of an active terminal execution to check (returned by run_in_terminal for async executions, or for sync executions that timed out and were moved to the background). This must be the exact opaque UUID returned by that tool; terminal names, labels, or integers are invalid.",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"}},required:["id"]}},Qse=class extends k{constructor(e,t){super();this._configurationService=e;this._lastOutputSnapshotByExecutionId=new Map;this._register(t.onDidDisposeInstance(o=>this._forgetTerminalInstance(o.instanceId)))}static{this._maxOutputSnapshots=100}async prepareToolInvocation(e,t){return{invocationMessage:d(16477,null),pastTenseMessage:d(16476,null)}}async invoke(e,t,o,n){let r=e.parameters;if(!r.id)return{content:[{kind:"text",value:"Error: 'id' (the persistent terminal UUID returned by run_in_terminal in async mode) must be provided."}]};let s=ic.getExecution(r.id);return s?{content:[{kind:"text",value:this._formatOutput(r.id,s.instance.instanceId,s.getOutput())}]}:(this._lastOutputSnapshotByExecutionId.delete(r.id),{content:[{kind:"text",value:`Error: No active terminal execution found with ID ${r.id}. The ID must be the exact value returned by run_in_terminal in async mode.`}]})}_formatOutput(e,t,o){if(!this._configurationService.getValue("chat.tools.terminal.outputDeltas"))return this._lastOutputSnapshotByExecutionId.clear(),`Output of terminal ${e}:
${o}`;let n=this._lastOutputSnapshotByExecutionId.get(e),r=this._createOutputSnapshot(t,o);if(this._rememberOutput(e,r),n===void 0)return`Output of terminal ${e}:
${o}`;if(r.length===n.length&&r.hash===n.hash)return`Output of terminal ${e} unchanged since previous poll (${o.length} characters already shown). No new output.`;if(o.length>n.length&&this._hashOutput(o,n.length)===n.hash){let s=o.slice(n.length);return`Output of terminal ${e} since previous poll (${s.length} new characters, ${o.length} total characters):
${s}`}return`Output of terminal ${e} changed since previous poll; returning current output (${o.length} characters):
${o}`}_rememberOutput(e,t){if(!this._lastOutputSnapshotByExecutionId.has(e)&&this._lastOutputSnapshotByExecutionId.size>=Qse._maxOutputSnapshots){let o=this._lastOutputSnapshotByExecutionId.keys().next().value;o!==void 0&&this._lastOutputSnapshotByExecutionId.delete(o)}this._lastOutputSnapshotByExecutionId.set(e,t)}_createOutputSnapshot(e,t){return{terminalInstanceId:e,length:t.length,hash:this._hashOutput(t)}}_forgetTerminalInstance(e){for(let[t,o]of this._lastOutputSnapshotByExecutionId)o.terminalInstanceId===e&&this._lastOutputSnapshotByExecutionId.delete(t)}_hashOutput(e,t=e.length){let o=new wI;return o.update(t===e.length?e:e.slice(0,t)),o.digest()}dispose(){this._lastOutputSnapshotByExecutionId.clear(),super.dispose()}};Qse=I([m(0,B),m(1,an)],Qse);var e2i={id:"send_to_terminal",toolReferenceName:"sendToTerminal",displayName:d(16554,null),modelDescription:"Send input text to an active terminal execution (identified by the `id` returned from run_in_terminal). The 'command' field may be empty or whitespace to press Enter (useful for interactive prompts). By default, returns the last 20 lines of terminal output captured shortly after sending. Set 'waitForOutput' to true for interactive programs (games, REPLs, etc.) to wait until the terminal becomes idle before returning output \u2014 this gives you the program's response to your input.",icon:L.terminal,source:wn.Internal,inputSchema:{type:"object",properties:{id:{type:"string",description:"The ID of an active terminal execution to send a command to (returned by run_in_terminal for async executions, or for sync executions that timed out and were moved to the background).",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"},command:{type:"string",description:"The input text to send to the terminal. The text is sent followed by Enter. Provide an empty or whitespace string to send just Enter (for interactive prompts)."},waitForOutput:{type:"boolean",description:"When true, waits for the terminal to become idle (no new output for a short period) before returning, instead of returning immediately. Use this for interactive programs where you need to see the full response to your input. Defaults to false."}},required:["id","command"]}};function HEn(a){return/^[\u0003\u0004\u001c]$/.test(a.trim())}var ZKi="workbench.action.terminal.chat.focusTerminalById";Ge.registerCommand(ZKi,async(a,i)=>{let e=a.get(an),t=e.getInstanceFromId(i);t&&(e.setActiveInstance(t),await e.revealActiveTerminal(),t.focus())});var UEn="workbench.action.terminal.chat.focusTerminalByExecutionId";Ge.registerCommand(UEn,async(a,i)=>{let e=ic.getExecution(i);if(e){let t=a.get(an);t.setActiveInstance(e.instance),await t.revealActiveTerminal(),e.instance.focus()}});var M2e=class extends k{constructor(e,t,o,n){super();this._configurationService=e;this._chatService=t;this._chatWidgetService=o;this._terminalChatService=n}async prepareToolInvocation(e,t){let o=e.parameters,n=!o.command||!o.command.trim(),r=this._getTerminalLabel(o),s=new he,l=new he,c=this._getQuestionContextForTerminal(e.chatSessionResource,o);if(n)s.appendMarkdown(d(16552,null)),l.appendMarkdown(d(16550,null));else{let w=ane(o.command),x=$xt(w);s.appendMarkdown(d(16551,null,x)),l.appendMarkdown(d(16549,null,x))}if(c){let w=` (${d(16553,null)}`;s.appendMarkdown(w),s.appendText(c),s.appendMarkdown(")"),l.appendMarkdown(w),l.appendText(c),l.appendMarkdown(")")}let u=this._getTerminalInstanceId(o),p=new he("",{isTrusted:{enabledCommands:[ZKi]}}),h=$xt(r),g=n?d(16547,null,h):d(16546,null,$xt(ane(o.command)),h);if(u!==void 0){let w=nc(ZKi,u);p.appendMarkdown(`${g} \u2014 [${d(16545,null)}](${w})`)}else p.appendMarkdown(g);let f=e.chatSessionResource,y=!(f&&(sve(f,this._configurationService,this._chatWidgetService,this._chatService)||this._terminalChatService.hasChatSessionAutoApproval(f)))&&!(c!==void 0)||e.forceConfirmationReason!==void 0?{title:d(16548,null),message:p,allowAutoConfirm:void 0}:void 0;return{invocationMessage:s,pastTenseMessage:l,confirmationMessages:y}}_getTerminalLabel(e){if(e.id){let t=ic.getExecution(e.id);if(t)return t.instance.title}return e.id??""}_getTerminalInstanceId(e){if(e.id){let t=ic.getExecution(e.id);if(t)return t.instance.instanceId}}_getQuestionContextForTerminal(e,t){if(!e)return;let o=this._chatService.getSession(e);if(!o||!t.id)return;let n=t.command?.trim(),r=o.getRequests();for(let s=r.length-1;s>=0;s--){let l=r[s].response;if(!l)continue;let c=l.response.value,u=-1,p;for(let v=c.length-1;v>=0;v--){let b=c[v];if(b.kind==="questionCarousel"){let S=b;if(!S.terminalId||S.questions.length===0)continue;if(S.terminalId===t.id){u=v,p=S;break}}}if(!p||u===-1)continue;let h=0;for(let v=u+1;v<c.length;v++)c[v].kind==="toolInvocation"&&c[v].toolId==="send_to_terminal"&&h++;let g=h;if(g>=p.questions.length)return;let f=p.questions[g];if(p.data){let v=p.data[f.id];if(this._answerMatchesCommand(v,n))return this._getQuestionText(f)}return}}_getQuestionText(e){let t=e.message??e.title;return yr(t)?t.value:t}_answerMatchesCommand(e,t){if(e===void 0)return t==="";if(typeof e=="string")return e.trim()===t;if(yo(e,{selectedValues:!0})){let o=e;return o.selectedValues.some(n=>n.trim()===t)||o.freeformValue?.trim()===t?!0:t===""&&o.selectedValues.length===0&&!o.freeformValue?.trim()}if(yo(e,{selectedValue:!0})){let o=e;return o.selectedValue?.trim()===t||o.freeformValue?.trim()===t?!0:t===""&&!o.selectedValue?.trim()&&!o.freeformValue?.trim()}return!1}async invoke(e,t,o,n){let r=e.parameters;if(!r.id)return{content:[{kind:"text",value:"Error: 'id' (the active terminal execution UUID returned by run_in_terminal) must be provided."}]};let s=ic.getExecution(r.id);if(!s)return{content:[{kind:"text",value:`Error: No active terminal execution found with ID ${r.id}. The terminal may have already been killed or the ID is invalid. The ID must be the exact value returned by run_in_terminal.`}]};let l=s.instance.registerMarker?.();lne(r.command)?await s.instance.sendText(r.command,!0,!0):await s.instance.sendText(Xxo(r.command),!0);let c;r.waitForOutput?c=await this._waitForIdleOutput(s,l,n):(await Li(2e3,n),c=h6(s.instance,l??void 0,{lastNLines:20}));let u=HEn(r.command)?`

Note: The input you sent was a cancel signal (Ctrl-C / Ctrl-D / Ctrl-\\). The previously running command was interrupted, not completed. This is not a signal to end the turn \u2014 if you intend to run a recovery or follow-up command, issue it now in this same turn. Call get_terminal_output first if you need to verify the shell is back at a prompt.`:"";return{content:[{kind:"text",value:`Successfully sent command to terminal ${r.id}.${c?`

Terminal output:
${c}`:""}${u}`}]}}async _waitForIdleOutput(e,t,o){let l=0,c=Date.now(),u=new qe(o),p=e.instance.onData(()=>{c=Date.now()});try{for(;!u.token.isCancellationRequested&&l<3e4&&(await Li(500,u.token),l+=500,!(Date.now()-c>=2e3)););}finally{p.dispose(),u.dispose()}return h6(e.instance,t??void 0)}};M2e=I([m(0,B),m(1,si),m(2,Lt),m(3,tg)],M2e);var t2i={id:"terminal_selection",toolReferenceName:"terminalSelection",legacyToolReferenceFullNames:["runCommands/terminalSelection"],displayName:d(16481,null),modelDescription:"Get the current selection in the active terminal.",source:wn.Internal,icon:L.terminal},P2e=class extends k{constructor(e){super();this._terminalService=e}async prepareToolInvocation(e,t){return{invocationMessage:d(16480,null),pastTenseMessage:d(16479,null)}}async invoke(e,t,o,n){let r=this._terminalService.activeInstance;if(!r)return{content:[{kind:"text",value:"No active terminal instance found."}]};let s=r.selection;return s?{content:[{kind:"text",value:`The active terminal's selection:
${s}`}]}:{content:[{kind:"text",value:"No text is currently selected in the active terminal."}]}}};P2e=I([m(0,an)],P2e);var vFo={id:"vscode_get_terminal_confirmation",displayName:d(16490,null),modelDescription:["This tool allows you to get explicit user confirmation for a terminal command without executing it.","","When to use:","- When you need to verify user approval before executing a command","- When you want to show command details, auto-approval status, and simplified versions to the user","- When you need the user to review a potentially risky command","","The tool will:","- Show the command with syntax highlighting","- Display auto-approval status if enabled","- Show simplified version of the command if applicable","- Provide custom actions for creating auto-approval rules","- Return approval/rejection status","","After confirmation, use a tool to actually execute the command."].join(`
`),userDescription:d(16491,null),source:wn.Internal,icon:L.shield,inputSchema:{type:"object",properties:{command:{type:"string",description:"The command to confirm with the user."},explanation:{type:"string",description:"A one-sentence description of what the command does. This will be shown to the user in the confirmation dialog."},goal:{type:"string",description:"A short description of the goal or purpose of the command."},mode:{type:"string",enum:["sync","async"],description:"Execution mode this command would use if run."}},required:["command","explanation","goal","mode"]}},R7t=class extends ic{get _enableCommandLineSandboxRewriting(){return!1}async prepareToolInvocation(i,e){let t=await super.prepareToolInvocation(i,e);return t&&(t.presentation="hiddenAfterComplete"),t}async invoke(i,e,t,o){return{content:[{kind:"text",value:"yes"}]}}};function A2e(a){let i=a.indexOf(": "),e=a.substring(0,i),t=i>0?a.substring(i+2):a;return/^\d+$/.test(t)&&(t=a),{taskLabel:t,taskType:e}}function i2i(a){if(Object.hasOwn(a,"label")&&a.label)return a.label;if(Object.hasOwn(a,"script")&&a.script)return a.script;if(Object.hasOwn(a,"command")&&a.command){let i=a.command;return We(i)?i:i.name?.toString()||""}return""}function bFo(a){return a.getKey()??a.getMapKey()}function uIe(a,i){return!a||!i?!1:bFo(a)===bFo(i)||a.getCommonTaskId?.()===i.getCommonTaskId?.()?!0:a._id===i._id}async function pIe(a,i,e,t,o,n){let r=0,s,l=await o.getWorkspaceTasks(),c=[];for(let b of l.keys()){let S=t.getValue("tasks",{resource:A.parse(b)});S?.tasks&&(c=c.concat(S.tasks))}for(let b of c)if(!(!n&&!b.type||Object.hasOwn(b,"hide")&&b.hide)){if((!(b.type&&i.taskType)||b.type===i.taskType)&&(i2i(b)===i?.taskLabel||a===b.label)){s=b;break}else if(!b.label&&a===`${b.type}: ${r}`){s=b;break}r++}if(!s)return;let u,p=b=>b.path.replace(/\/$/,"").toLowerCase(),h=p(A.file(e));for(let[b,S]of l)if(p(A.parse(b))===h){u=S;break}if(!u)return;let g=u.configurations?.byIdentifier,f=Object.values(g??{}).find(b=>b.type===s.type&&(b._label===s.label||b._label===`${s.type}: ${i2i(s)}`||b._label===i2i(s))),v;return f&&(v=await o.tryResolveTask(f)),v||(v=u.set?.tasks?.find(S=>s.label===S._label||s.label===S._label)),v}async function N2e(a,i,e,t){return a.configurationProperties?.dependsOn?(await Promise.all(a.configurationProperties.dependsOn.map(async n=>{let r=We(n.task)?n.task:n.task?._key;if(r)return await pIe(r,{taskLabel:r},i,e,t)}))).filter(n=>n!==void 0):void 0}async function O2e(a,i,e,t,o,n,r,s,l,c,u){let p=[];if(n.isCancellationRequested)return p;let h={},g={},f={};for(let y of l??[])h[y.getCommonTaskId()]=y,g[y._id]=y,f[y._label]=y;let v=a.map(y=>y.shellLaunchConfig.name??y.title??"unknown");o.report({message:new he(`Checking output for ${v.map(y=>`\`${y}\``).join(", ")}`)});let b=a.map(async y=>{let w=u?u.get(y.instanceId):y.registerMarker(),x=i;if(l?.length){let M=y.reconnectionProperties?.data;M?Object.hasOwn(h,M.lastTask)?x=h[M.lastTask]:Object.hasOwn(g,M.id)&&(x=g[M.id]):y.shellLaunchConfig.name&&Object.hasOwn(f,y.shellLaunchConfig.name)?x=f[y.shellLaunchConfig.name]:Object.hasOwn(f,y.title)&&(x=f[y.title])}let E={getOutput:M=>h6(y,M??w)??"",task:x,isActive:s?()=>s(x):void 0,instance:y,dependencyTasks:l,sessionResource:t.sessionResource};if(x.configurationProperties.problemMatchers&&x.configurationProperties.problemMatchers.length>0&&c){let N=Date.now();for(;!n.isCancellationRequested&&Date.now()-N<1e3&&!(await c.getBusyTasks()).some(H=>uIe(H,x));)await Li(100)}try{let M=x.configurationProperties.problemMatchers&&x.configurationProperties.problemMatchers.length>0,N=r.add(e.createInstance(cne,E,M?zEn:void 0,t,n,i._label));await Promise.race([U.toPromise(N.onDidFinishCommand),U.toPromise(n.onCancellationRequested)]);let V=N.pollingResult;return{name:y.shellLaunchConfig.name??y.title??"unknown",output:V?.output??"",pollDurationMs:V?.pollDurationMs??0,resources:V?.resources,state:V?.state||"Idle",inputToolManualAcceptCount:N.outputMonitorTelemetryCounters.inputToolManualAcceptCount??0,inputToolManualRejectCount:N.outputMonitorTelemetryCounters.inputToolManualRejectCount??0,inputToolManualChars:N.outputMonitorTelemetryCounters.inputToolManualChars??0,inputToolAutoAcceptCount:N.outputMonitorTelemetryCounters.inputToolAutoAcceptCount??0,inputToolAutoChars:N.outputMonitorTelemetryCounters.inputToolAutoChars??0,inputToolManualShownCount:N.outputMonitorTelemetryCounters.inputToolManualShownCount??0,inputToolFreeFormInputShownCount:N.outputMonitorTelemetryCounters.inputToolFreeFormInputShownCount??0,inputToolFreeFormInputCount:N.outputMonitorTelemetryCounters.inputToolFreeFormInputCount??0}}finally{w?.dispose()}}),S=await Promise.all(b);if(p.push(...S),u){let y=new Set(a.map(w=>w.instanceId));for(let[w,x]of u)y.has(w)||(x?.dispose(),u.delete(w))}return p}async function zEn(a,i,e){if(!i.isCancellationRequested){if(a.task){let t=e.getTaskProblems(a.instance.instanceId);if(t){let o=[],n=[];for(let[r,{resources:s,markers:l}]of t.entries())for(let c=0;c<l.length;c++){let u=s[c],p=l[c];n.push({uri:u,range:p.startLineNumber!==void 0&&p.startColumn!==void 0&&p.endLineNumber!==void 0&&p.endColumn!==void 0?new G(p.startLineNumber,p.startColumn,p.endLineNumber,p.endColumn):void 0});let h=p.message??"";o.push(`Problem: ${h} in ${u.fsPath} coming from ${r} starting on line ${p.startLineNumber}${p.startColumn?`, column ${p.startColumn} and ending on line ${p.endLineNumber}${p.endColumn?`, column ${p.endColumn}`:""}`:""}`)}if(o.length===0){let r=a.getOutput().split(`
`).filter(s=>s!=="").slice(-10).join(`
`);return{state:"Idle",output:`Task completed with output:
${r}`}}return{state:"Idle",output:o.join(`
`),resources:n}}}throw new Error("Polling failed")}}function F2e(a){return Array.from(new Map(a.flatMap(i=>i.resources?.filter(e=>e.uri).map(e=>{let t=e.range,o=t!==void 0?{uri:e.uri,range:t}:e.uri;return[t!==void 0?`${e.uri.toString()}-${t.toString()}`:`${e.uri.toString()}`,o]})??[])).values())}function W2e(a,i,e,t,o,n){let r="";if(a?.exitCode)r=d(16587,null,i,a.exitCode);else{r+=`\`${i}\` task `;let s=e.length;if(o)return s?new he(`Got output for ${r} with \`${s}\` problem${s===1?"":"s"}`):new he(`Got output for ${r}`);{let l=e.length;r+=t.every(c=>c.state==="Idle")?l?`finished with \`${l}\` problem${l===1?"":"s"}`:"finished":n?l?`started and will continue to run in the background with \`${l}\` problem${l===1?"":"s"}`:"started and will continue to run in the background":l?`started with \`${l}\` problem${l===1?"":"s"}`:"started"}}return new he(r)}var V2e=class{constructor(i,e,t,o,n,r){this._tasksService=i;this._telemetryService=e;this._terminalService=t;this._fileService=o;this._configurationService=n;this._instantiationService=r}async invoke(i,e,t,o){let n=i.parameters;if(!i.context)return{content:[{kind:"text",value:"No invocation context"}],toolResultMessage:"No invocation context"};let r=A.file(n.workspaceFolder).with({path:`${n.workspaceFolder}/.vscode/tasks.json`}),s=await this._fileService.exists(r),l={label:n.task.label,type:n.task.type,command:n.task.command,args:n.task.args,isBackground:n.task.isBackground,problemMatcher:n.task.problemMatcher,group:n.task.group},c=JSON.stringify({version:"2.0.0",tasks:[l]},null,"	");if(!s)await this._fileService.createFile(r,Ke.fromString(c),{overwrite:!0}),t.report({message:"Created tasks.json file"});else{let w=await this._fileService.readFile(r),x=JSON.parse(w.value.toString());x.tasks.push(l),await this._fileService.writeFile(r,Ke.fromString(JSON.stringify(x,null,"	"))),t.report({message:"Updated tasks.json file"})}t.report({message:new he(d(16557,null))});let u,p=Date.now();for(;Date.now()-p<5e3&&!o.isCancellationRequested&&(u=(await this._tasksService.tasks())?.find(w=>w._label===n.task.label),!u);)await Li(100);if(!u)return{content:[{kind:"text",value:`Task not found: ${n.task.label}`}],toolResultMessage:new he(d(16560,null,n.task.label))};let h=new O,g,f=[];try{let w=await N2e(u,n.workspaceFolder,this._configurationService,this._tasksService),x=new Map;for(let H of this._terminalService.instances){let K=H.registerMarker();x.set(H.instanceId,K),K&&h.add(K)}t.report({message:new he(d(16559,null,n.task.label))});let E=await Promise.race([this._tasksService.run(u,void 0,5),Li(3e3)]);g=E&&typeof E=="object"?E:void 0;let N=this._tasksService.getTerminalsForTasks(w??u)?.map(H=>this._terminalService.instances.find(K=>K.resource.path===H?.path&&K.resource.scheme===H.scheme)).filter(Boolean);if(!N||N.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${n.task.label}`}],toolResultMessage:new he(d(16558,null,n.task.label))};let V=new O;try{f=await O2e(N,u,this._instantiationService,i.context,t,o,V,H=>this._isTaskActive(H),w,this._tasksService,x)}finally{V.dispose()}}finally{h.dispose()}for(let w of f)this._telemetryService.publicLog2?.("copilotChat.runTaskTool.createAndRunTask",{taskId:n.task.label,bufferLength:w.output.length??0,pollDurationMs:w.pollDurationMs??0,inputToolManualAcceptCount:w.inputToolManualAcceptCount??0,inputToolManualRejectCount:w.inputToolManualRejectCount??0,inputToolManualChars:w.inputToolManualChars??0,inputToolManualShownCount:w.inputToolManualShownCount??0,inputToolFreeFormInputCount:w.inputToolFreeFormInputCount??0,inputToolFreeFormInputShownCount:w.inputToolFreeFormInputShownCount??0});let v=f.map(w=>`Terminal: ${w.name}
Output:
${w.output}`),b=Array.from(new Set(v)).join(`

`),S=F2e(f),y=W2e(g,n.task.label,S,f,void 0,u.configurationProperties.isBackground);return{content:[{kind:"text",value:b}],toolResultMessage:y,toolResultDetails:S}}async _isTaskActive(i){return(await this._tasksService.getBusyTasks())?.some(t=>uIe(t,i))??!1}async prepareToolInvocation(i,e){let o=i.parameters.task;return(await this._tasksService.tasks())?.find(s=>s._label===o.label)?{invocationMessage:new he(d(16566,null,o.label)),pastTenseMessage:new he(d(16567,null,o.label)),confirmationMessages:void 0}:(await this._tasksService.getActiveTasks()).find(s=>s._label===o.label)?{invocationMessage:new he(d(16556,null,o.label)),pastTenseMessage:new he(d(16556,null,o.label)),confirmationMessages:void 0}:{invocationMessage:new he(d(16563,null,o.label)),pastTenseMessage:new he(d(16564,null,o.label)),confirmationMessages:{title:d(16555,null),message:new he(d(16565,null,o.label,o.command,o.args?.length?` and args \`${o.args.join(" ")}\``:""))}}}};V2e=I([m(0,yf),m(1,_e),m(2,an),m(3,ge),m(4,B),m(5,F)],V2e);var n2i={id:"create_and_run_task",toolReferenceName:"createAndRunTask",legacyToolReferenceFullNames:["runTasks/createAndRunTask"],displayName:d(16561,null),modelDescription:"Creates and runs a build, run, or custom task for the workspace by generating or adding to a tasks.json file based on the project structure (such as package.json or README.md). If the user asks to build, run, launch and they have no tasks.json file, use this tool. If they ask to create or add a task, use this tool.",userDescription:d(16562,null),source:wn.Internal,inputSchema:{type:"object",properties:{workspaceFolder:{type:"string",description:"The absolute path of the workspace folder where the tasks.json file will be created."},task:{type:"object",description:"The task to add to the new tasks.json file.",properties:{label:{type:"string",description:"The label of the task."},type:{type:"string",description:"The type of the task. The only supported value is 'shell'.",enum:["shell"]},command:{type:"string",description:"The shell command to run for the task. Use this to specify commands for building or running the application."},args:{type:"array",description:"The arguments to pass to the command.",items:{type:"string"}},isBackground:{type:"boolean",description:"Whether the task runs in the background without blocking the UI or other tasks. Set to true for long-running processes like watch tasks or servers that should continue executing without requiring user attention. When false, the task will block the terminal until completion."},problemMatcher:{type:"array",description:"The problem matcher to use to parse task output for errors and warnings. Can be a predefined matcher like '$tsc' (TypeScript), '$eslint - stylish', '$gcc', etc., or a custom pattern defined in tasks.json. This helps VS Code display errors in the Problems panel and enables quick navigation to error locations.",items:{type:"string"}},group:{type:"string",description:"The group to which the task belongs."}},required:["label","type","command"]}},required:["task","workspaceFolder"]}};var r2i={id:"get_task_output",toolReferenceName:"getTaskOutput",legacyToolReferenceFullNames:["runTasks/getTaskOutput"],displayName:d(16573,null),modelDescription:"Get the output of a task",source:wn.Internal,inputSchema:{type:"object",properties:{id:{type:"string",description:"The task ID for which to get the output."},workspaceFolder:{type:"string",description:"The workspace folder path containing the task"}},required:["id","workspaceFolder"]}},B2e=class extends k{constructor(e,t,o,n,r){super();this._tasksService=e;this._terminalService=t;this._configurationService=o;this._instantiationService=n;this._telemetryService=r}async prepareToolInvocation(e,t){let o=e.parameters,n=A2e(o.id),r=await pIe(o.id,n,o.workspaceFolder,this._configurationService,this._tasksService,!0);if(!r)return{invocationMessage:new he(d(16571,null,o.id))};let s=r._label;return(await this._tasksService.getActiveTasks()).includes(r)?{invocationMessage:new he(d(16570,null,s))}:{invocationMessage:new he(d(16569,null,s)),pastTenseMessage:new he(d(16568,null,s))}}async invoke(e,t,o,n){let r=e.parameters,s=A2e(r.id),l=await pIe(r.id,s,r.workspaceFolder,this._configurationService,this._tasksService,!0);if(!l)return{content:[{kind:"text",value:`Task not found: ${r.id}`}],toolResultMessage:new he(d(16571,null,r.id))};let c=await N2e(l,r.workspaceFolder,this._configurationService,this._tasksService),u=this._tasksService.getTerminalsForTasks(c??l),p=l._label,h=u?.map(v=>this._terminalService.instances.find(b=>b.resource.path===v?.path&&b.resource.scheme===v.scheme)).filter(v=>!!v);if(!h||h.length===0)return{content:[{kind:"text",value:`Terminal not found for task ${p}`}],toolResultMessage:new he(d(16572,null,p))};let g=l.configurationProperties.isBackground?new Map:void 0;if(g)for(let v of h)g.set(v.instanceId,void 0);let f=new O;try{let v=await O2e(h,l,this._instantiationService,e.context,o,n,f,x=>this._isTaskActive(x),c,this._tasksService,g);for(let x of v)this._telemetryService.publicLog2?.("copilotChat.getTaskOutputTool.get",{taskId:r.id,bufferLength:x.output.length??0,pollDurationMs:x.pollDurationMs??0,inputToolManualAcceptCount:x.inputToolManualAcceptCount??0,inputToolManualRejectCount:x.inputToolManualRejectCount??0,inputToolManualChars:x.inputToolManualChars??0,inputToolManualShownCount:x.inputToolManualShownCount??0,inputToolFreeFormInputCount:x.inputToolFreeFormInputCount??0,inputToolFreeFormInputShownCount:x.inputToolFreeFormInputShownCount??0});let b=v.map(x=>`Terminal: ${x.name}
Output:
${x.output}`),S=Array.from(new Set(b)).join(`

`),y=F2e(v),w=W2e(void 0,p,y,v,!0,l.configurationProperties.isBackground);return{content:[{kind:"text",value:S}],toolResultMessage:w,toolResultDetails:y}}finally{f.dispose()}}async _isTaskActive(e){return(await this._tasksService.getBusyTasks())?.some(o=>uIe(o,e))??!1}};B2e=I([m(0,yf),m(1,an),m(2,B),m(3,F),m(4,_e)],B2e);var H2e=class{constructor(i,e,t,o,n){this._tasksService=i;this._telemetryService=e;this._terminalService=t;this._configurationService=o;this._instantiationService=n}async invoke(i,e,t,o){let n=i.parameters;if(!i.context)return{content:[{kind:"text",value:"No invocation context"}],toolResultMessage:"No invocation context"};let r=A2e(n.id),s=await pIe(n.id,r,n.workspaceFolder,this._configurationService,this._tasksService,!0);if(!s)return{content:[{kind:"text",value:`Task not found: ${n.id}`}],toolResultMessage:new he(d(16583,null,n.id))};let l=s._label;if((await this._tasksService.getActiveTasks()).includes(s))return{content:[{kind:"text",value:`The task ${l} is already running.`}],toolResultMessage:new he(d(16581,null,l))};let u=await N2e(s,n.workspaceFolder,this._configurationService,this._tasksService),p=new Map,h=new O;for(let g of this._terminalService.instances){let f=g.registerMarker();p.set(g.instanceId,f),f&&h.add(f)}try{let g=await Promise.race([this._tasksService.run(s,void 0,5),Li(3e3)]),f=g&&typeof g=="object"?g:void 0,v=this._tasksService.getTerminalsForTasks(u??s);if(!v||v.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${l}`}],toolResultMessage:new he(d(16576,null,l))};let b=this._terminalService.instances.filter(N=>v.some(V=>V.path===N.resource.path&&V.scheme===N.resource.scheme));if(b.length===0)return{content:[{kind:"text",value:`Task started but no terminal was found for: ${l}`}],toolResultMessage:new he(d(16576,null,l))};let S=new O,y=[];try{y=await O2e(b,s,this._instantiationService,i.context,t,o,S,N=>this._isTaskActive(N),u,this._tasksService,p)}finally{S.dispose()}for(let N of y)this._telemetryService.publicLog2?.("copilotChat.runTaskTool.run",{taskId:n.id,bufferLength:N.output.length??0,pollDurationMs:N.pollDurationMs??0,inputToolManualAcceptCount:N.inputToolManualAcceptCount??0,inputToolManualRejectCount:N.inputToolManualRejectCount??0,inputToolManualChars:N.inputToolManualChars??0,inputToolManualShownCount:N.inputToolManualShownCount??0,inputToolFreeFormInputShownCount:N.inputToolFreeFormInputShownCount??0,inputToolFreeFormInputCount:N.inputToolFreeFormInputCount??0});let w=y.map(N=>`Terminal: ${N.name}
Output:
${N.output}`),x=Array.from(new Set(w)).join(`

`),E=F2e(y),M=W2e(f,l,E,y,void 0,s.configurationProperties.isBackground);return{content:[{kind:"text",value:x}],toolResultMessage:M,toolResultDetails:E}}finally{h.dispose()}}async _isTaskActive(i){return(await this._tasksService.getBusyTasks())?.some(t=>uIe(t,i))??!1}async prepareToolInvocation(i,e){let t=i.parameters,o=A2e(t.id),n=await pIe(t.id,o,t.workspaceFolder,this._configurationService,this._tasksService,!0);if(!n)return{invocationMessage:new he(d(16583,null,t.id))};let r=n._label,s=await this._tasksService.getActiveTasks();return n&&s.includes(n)?{invocationMessage:new he(d(16580,null))}:await this._isTaskActive(n)?{invocationMessage:new he(d(16582,null,r)),pastTenseMessage:new he(d(16584,null,r)),confirmationMessages:void 0}:{invocationMessage:new he(d(16578,null,r)),pastTenseMessage:new he(n?.configurationProperties.isBackground?d(16579,null,r):d(16577,null,r)),confirmationMessages:n?{title:d(16575,null),message:d(16574,null,r)}:void 0}}};H2e=I([m(0,yf),m(1,_e),m(2,an),m(3,B),m(4,F)],H2e);var s2i={id:"run_task",toolReferenceName:"runTask",legacyToolReferenceFullNames:["runTasks/runTask"],displayName:d(16585,null),modelDescription:`Runs a VS Code task.

- If you see that an appropriate task exists for building or running code, prefer to use this tool to run the task instead of using the run_in_terminal tool.
- Make sure that any appropriate build or watch task is running before trying to run tests or execute code.
- If the user asks to run a task, use this tool to do so.`,userDescription:d(16586,null),icon:L.tools,source:wn.Internal,inputSchema:{type:"object",properties:{workspaceFolder:{type:"string",description:"The workspace folder path containing the task"},id:{type:"string",description:"The task ID to run."}},required:["workspaceFolder","id"]}};var KEn=new Set(["sudo","doas","time","command","builtin","exec","nice","ionice","nohup","env","xargs","stdbuf","unbuffer","script","timeout"]),SFo=/^[A-Za-z_][A-Za-z0-9_]*=.*$/;function GEn(a){let i=[],e="",t=!1,o=!1,n=!1;for(let r=0;r<a.length;r++){let s=a[r];if(t){s==="'"?t=!1:e+=s;continue}if(o){if(s==="\\"&&r+1<a.length){let l=a[r+1];if(l==="\\"||l==='"'||l==="$"||l==="`"){e+=l,r++;continue}e+=s;continue}s==='"'?o=!1:e+=s;continue}if(s==="\\"&&r+1<a.length){e+=a[r+1],r++,n=!0;continue}if(s==="'"){t=!0,n=!0;continue}if(s==='"'){o=!0,n=!0;continue}if(/\s/.test(s)){(e.length>0||n)&&(i.push(e),e="",n=!1);continue}e+=s,n=!0}return(e.length>0||n)&&i.push(e),i}function qEn(a){let i=[],e="",t=!1,o=!1,n=r=>{let s=e.trim();(s.length>0||r!==void 0)&&i.push({raw:s,sep:r}),e=""};for(let r=0;r<a.length;r++){let s=a[r];if(t){e+=s,s==="'"&&(t=!1);continue}if(o){if(s==="\\"&&r+1<a.length){e+=s+a[r+1],r++;continue}e+=s,s==='"'&&(o=!1);continue}if(s==="\\"&&r+1<a.length){e+=s+a[r+1],r++;continue}if(s==="'"){t=!0,e+=s;continue}if(s==='"'){o=!0,e+=s;continue}if(s==="|"&&a[r+1]==="|"){n("||"),r++;continue}if(s==="|"&&a[r+1]==="&"){n("|&"),r++;continue}if(s==="|"){n("|");continue}if(s==="&"&&a[r+1]==="&"){n("&&"),r++;continue}if(s===";"){n(";");continue}e+=s}return n(void 0),i}function $En(a){let i=[],e=[],t=0;for(;t<a.length&&SFo.test(a[t]);)i.push(a[t]),t++;for(;t<a.length;){let o=a[t];if(KEn.has(o)){for(e.push(o),t++;t<a.length;){let n=a[t];if(n==="--"){t++;break}if(n.startsWith("-")){t++;continue}if(SFo.test(n)){i.push(n),t++;continue}if((o==="timeout"||o==="nice"||o==="ionice")&&/^\d/.test(n)){t++;continue}break}continue}break}return{tokens:a.slice(t),envPrefixes:i,wrappers:e}}function eA(a){if(!a)return;let i=a.trim();if(!i)return;let e=qEn(i);if(e.length===0)return;let t=e.map(o=>{let n=GEn(o.raw),{tokens:r,envPrefixes:s,wrappers:l}=$En(n);return{raw:o.raw,rawTokens:n,tokens:r,envPrefixes:s,wrappers:l,trailingSeparator:o.sep}});return{raw:i,segments:t}}function uL(a){let i=a.tokens;if(i.length===0)return;let e=i[0],t;for(let o=1;o<i.length;o++)if(!i[o].startsWith("--")){t=i[o];break}return{head:e,sub:t}}function IFo(a,i){let e=i.filter(o=>o.length>1).map(o=>`--${o}`),t=i.filter(o=>o.length===1);for(let o of a.tokens){if(!o.startsWith("-")||o==="--")continue;if(o.startsWith("--")){let r=o.slice(2).split("=")[0];if(e.includes(`--${r}`))return!0;continue}let n=o.slice(1);for(let r of t)if(n.includes(r))return!0}return!1}var jEn={fast:3e4,medium:12e4,slow:3e5},QEn=256;function a2i(a){let i=eA(a);if(!i||i.segments.length===0)return{cls:void 0,invalidates:[]};if(i.segments.length>1){let t=[];for(let o of i.segments){let n=uL(o);if(n){let r=yFo(n);t.push(...r.invalidates)}}return{cls:void 0,invalidates:t}}let e=uL(i.segments[0]);return e?yFo(e):{cls:void 0,invalidates:[]}}function yFo(a){switch(a.head){case"git":return a.sub&&/^(add|commit|push|pull|fetch|merge|rebase|reset|checkout|switch|restore|cherry-pick|revert|stash|tag|branch|am|apply|clean|rm|mv)$/.test(a.sub)?{cls:void 0,invalidates:["git"]}:a.sub==="status"||a.sub==="diff"||a.sub==="show"||a.sub==="blame"?{cls:"fast",invalidates:[]}:a.sub==="log"||a.sub==="reflog"||a.sub==="shortlog"?{cls:"slow",invalidates:[]}:{cls:void 0,invalidates:[]};case"ls":case"pwd":case"tree":case"find":return{cls:a.head==="find"||a.head==="tree"?"slow":"fast",invalidates:[]};case"npm":case"pnpm":case"yarn":return a.sub==="ls"||a.sub==="list"||a.sub==="outdated"?{cls:"slow",invalidates:[]}:a.sub==="install"||a.sub==="i"||a.sub==="ci"||a.sub==="add"||a.sub==="remove"||a.sub==="uninstall"||a.sub==="update"?{cls:void 0,invalidates:["npm","pnpm","yarn"]}:a.sub==="test"||a.sub==="run"||a.sub===void 0?{cls:"medium",invalidates:[]}:{cls:void 0,invalidates:[]};case"pytest":case"jest":case"vitest":case"cargo":return a.head==="cargo"&&a.sub&&/^(test|nextest|check|build)$/.test(a.sub)?{cls:"medium",invalidates:[]}:a.head!=="cargo"?{cls:"medium",invalidates:[]}:{cls:void 0,invalidates:[]};case"go":return a.sub==="test"||a.sub==="build"||a.sub==="vet"?{cls:"medium",invalidates:[]}:{cls:void 0,invalidates:[]};case"docker":case"kubectl":return a.sub==="ps"||a.sub==="images"||a.sub==="get"||a.sub==="describe"?{cls:"fast",invalidates:[]}:{cls:void 0,invalidates:[]};case"env":case"printenv":return{cls:"slow",invalidates:[]};case"gh":return{cls:"medium",invalidates:[]}}return{cls:void 0,invalidates:[]}}function l2i(a){if(typeof a!="object"||a===null)return;let i=a;if(typeof i.command!="string"||!i.command.trim())return;let e=typeof i.cwd=="string"?i.cwd:"";return{command:i.command,cwd:e}}var L7t=class{constructor(i=()=>Date.now()){this.id="terminal.session-dedup";this.toolIds=["run_in_terminal"];this._entries=new Map;this._now=i}_key(i,e){return`${i}::${e.trim()}`}observe(i,e){let t=l2i(e);if(!t)return;let{invalidates:o}=a2i(t.command);o.length!==0&&this._invalidateByProgram(t.cwd,o)}lookup(i,e){let t=l2i(e);if(!t)return;let{cls:o}=a2i(t.command);if(o===void 0)return;let n=this._key(t.cwd,t.command),r=this._entries.get(n);if(!r)return;let s=jEn[r.cls];if(this._now()-r.timestamp>s){this._entries.delete(n);return}return{text:r.text,timestamp:r.timestamp}}record(i,e,t){let o=l2i(e);if(!o)return;let{cls:n}=a2i(o.command);if(n===void 0)return;let r=this._key(o.cwd,o.command);for(this._entries.has(r)&&this._entries.delete(r),this._entries.set(r,{cwd:o.cwd,command:o.command,text:t,timestamp:this._now(),cls:n});this._entries.size>QEn;){let s=this._entries.keys().next().value;if(s===void 0)break;this._entries.delete(s)}}invalidateCwd(i){for(let e of[...this._entries.keys()])this._entries.get(e).cwd===i&&this._entries.delete(e)}_invalidateByProgram(i,e){let t=new Set(e);for(let o of[...this._entries.keys()]){let n=this._entries.get(o);if(n.cwd!==i)continue;let r=uL(eA(n.command)?.segments[0]??{raw:"",tokens:[],rawTokens:[],envPrefixes:[],wrappers:[],trailingSeparator:void 0});r&&t.has(r.head)&&this._entries.delete(o)}}};function oj(a){if(typeof a!="object"||a===null)return!1;let i=a;return i.command===void 0||typeof i.command=="string"}function c2i(a){let i=a.sub==="*"||a.sub===void 0?void 0:a.sub===null?null:typeof a.sub=="string"?new Set([a.sub]):new Set(a.sub);return e=>{if(!oj(e))return!1;let t=eA(e.command);if(!t)return!1;for(let o of t.segments){let n=uL(o);if(!(!n||n.head!==a.head)){if(i===null){if(n.sub!==void 0)continue}else if(i!==void 0&&(n.sub===void 0||!i.has(n.sub)))continue;if(!(a.flag&&!a.flag(o)))return!0}}return!1}}var YEn={id:"terminal.git-diff",toolIds:["run_in_terminal"],matches:(a,i)=>c2i({head:"git",sub:["diff","show"]})(i),apply(a){let i=a.split(`
`),e=[],t=1,o=0,n=!1,r=-1,s=0,l=0,c=0,u=0,p=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,h=()=>{r<0||(e[r]=`@@ -${s},${c} +${l},${u} @@`,r=-1)},g=()=>{let v=o-t;v>0&&e.push(`... ${v} unchanged context line${v===1?"":"s"} omitted ...`),o=0};for(let v of i){if(v.startsWith("diff --git")){if(g(),h(),n=/package-lock\.json|yarn\.lock|pnpm-lock\.yaml|bun\.lockb|\.snap$/.test(v),n){e.push(v),e.push("... lockfile/snapshot diff omitted ...");continue}e.push(v);continue}if(n||v.startsWith("index ")||v.startsWith("similarity index ")||v.startsWith("dissimilarity index ")||v.startsWith("rename from ")||v.startsWith("rename to "))continue;let b=p.exec(v);if(b){g(),h(),s=parseInt(b[1],10),l=parseInt(b[3],10),c=0,u=0,r=e.length,e.push(v);continue}if(v.startsWith("+++ ")||v.startsWith("--- ")||v.startsWith("Binary files ")){g(),h(),e.push(v);continue}if(v.startsWith("+")){g(),e.push(v),u++;continue}if(v.startsWith("-")){g(),e.push(v),c++;continue}if(!v.startsWith(" ")){g(),e.push(v);continue}o++,o<=t&&(e.push(v),c++,u++)}g(),h();let f=e.join(`
`);return{text:f,compressed:f.length<a.length}}},XEn={id:"terminal.git-log",toolIds:["run_in_terminal"],matches:(a,i)=>c2i({head:"git",sub:["log","reflog","shortlog"]})(i),apply(a){let i=a.split(`
`),e=[],t=0;for(let n of i){if(n.trim()===""){t++,t<=1&&e.push(n);continue}t=0,e.push(n)}for(;e.length>0&&e[e.length-1].trim()==="";)e.pop();let o=e.join(`
`);return{text:o,compressed:o.length<a.length}}},JEn={id:"terminal.git-status",toolIds:["run_in_terminal"],matches:(a,i)=>c2i({head:"git",sub:"status"})(i),apply(a){let i=[/^\s*\(use "git add.*"\s+to.*\)\s*$/,/^\s*\(use "git restore.*"\s+to.*\)\s*$/,/^\s*\(use "git rm --cached.*"\s+to.*\)\s*$/,/^\s*\(use "git push" to publish.*\)\s*$/,/^\s*\(commit or discard.*\)\s*$/],e=a.split(`
`),t=[];for(let n of e)i.some(r=>r.test(n))||t.push(n);let o=t.join(`
`);return{text:o,compressed:o.length<a.length}}},ZEn={id:"terminal.ls",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);if(!e)return!1;for(let t of e.segments)if(uL(t)?.head==="ls"&&IFo(t,["l"]))return!0;return!1},apply(a){let i=a.split(`
`),e=[],t=/^[-dlcbpsDLCBPS][rwx\-tTsS@+.]{9,}\s+\d+\s+\S+\s+\S+\s+\d+\s+\S+\s+\S+\s+\S+\s+(.+)$/;for(let n of i){if(!n.trim()||n.startsWith("total "))continue;let r=t.exec(n);if(r){let s=n.startsWith("d");e.push(s?r[1]+"/":r[1])}else e.push(n)}let o=e.join(`
`);return{text:o,compressed:o.length<a.length}}},d2i=200;function u2i(a,i,e){let t=a.split(`
`);if(t.length<=i+1)return{text:a,compressed:!1};let o=t.slice(0,i),n=t.length-i;o.push(`... ${n} ${e} lines omitted ...`);let r=o.join(`
`);return{text:r,compressed:r.length<a.length}}var eTn={id:"terminal.find",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);return e?e.segments.some(t=>uL(t)?.head==="find"):!1},apply:a=>u2i(a,d2i,"find result")},tTn={id:"terminal.grep",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);return e?e.segments.some(t=>{let o=uL(t);return o!==void 0&&(o.head==="grep"||o.head==="rg"||o.head==="ack"||o.head==="ag")}):!1},apply:a=>u2i(a,d2i,"matching")},iTn={id:"terminal.tree",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);return e?e.segments.some(t=>uL(t)?.head==="tree"):!1},apply:a=>u2i(a,d2i,"tree")};function oTn(a){let i=a.split(`
`),e=[/^\s*PASS\s+\S+/,/^\s*ok\s+\d+\s+/,/^\s*\u2713\s/,/^\s*[.sSEFx]{10,}\s*$/,/^test\s.+ \.\.\. ok\s*$/,/^running \d+ tests?$/i],t=[];for(let n of i)e.some(r=>r.test(n))||t.push(n);let o=t.join(`
`);return{text:o,compressed:o.length<a.length}}var nTn={id:"terminal.test-runner",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);if(!e)return!1;for(let t of e.segments){let o=uL(t);if(o&&(o.head==="pytest"||o.head==="jest"||o.head==="vitest"||o.head==="playwright"||o.head==="mocha"||o.head==="cargo"&&o.sub&&/^(test|nextest)$/.test(o.sub)||o.head==="go"&&o.sub==="test"||(o.head==="npm"||o.head==="pnpm"||o.head==="yarn")&&o.sub==="test"||o.head==="npx"&&o.sub&&/^(jest|vitest|playwright|mocha)$/.test(o.sub)))return!0}return!1},apply:a=>oTn(a)};function rTn(a){let i=[/^\s*Compiling\s+\S+\s+v\S+/,/^\s*Downloading\s+\S+/,/^\s*Downloaded\s+\S+/,/^\s*Updating\s+crates\.io\s+index/,/^\s*Finished\s+(dev|release|test)/,/^make\[\d+\]: (Entering|Leaving) directory/,/^Download(ed|ing) https?:/,/^\[INFO\] Downloading from /,/^\[INFO\] Downloaded from /,/^> Task :/],e=a.split(`
`),t=[];for(let n of e)i.some(r=>r.test(n))||t.push(n);let o=t.join(`
`);return{text:o,compressed:o.length<a.length}}var sTn={id:"terminal.build-tool",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);if(!e)return!1;for(let t of e.segments){let o=uL(t);if(o&&(o.head==="cargo"&&o.sub&&/^(build|check|clippy)$/.test(o.sub)||o.head==="go"&&(o.sub==="build"||o.sub==="vet")||o.head==="make"||o.head==="tsc"||o.head==="gradle"||o.head==="mvn"||o.head==="dotnet"&&o.sub==="build"))return!0}return!1},apply:a=>rTn(a)};function aTn(a){let i=a.split(`
`),e=[/^\s*Success: no issues found\s*$/i,/^\s*All checks passed\.?\s*$/i,/^\s*Success:\s*0 errors/i],t=[];for(let n of i)e.some(r=>r.test(n))||t.push(n);let o=t.join(`
`);return{text:o,compressed:o.length<a.length}}var lTn={id:"terminal.linter",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);if(!e)return!1;for(let t of e.segments){let o=uL(t);if(o&&(o.head==="eslint"||o.head==="ruff"||o.head==="mypy"||o.head==="prettier"||o.head==="rubocop"||o.head==="golangci-lint"||o.head==="cargo"&&o.sub==="clippy"||o.head==="npx"&&o.sub&&/^(eslint|prettier|tsc)$/.test(o.sub)))return!0}return!1},apply:a=>aTn(a)},cTn={id:"terminal.npm-install",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);if(!e)return!1;for(let t of e.segments){let o=uL(t);if(o&&(o.head==="npm"&&o.sub&&/^(install|i|ci|add)$/.test(o.sub)||(o.head==="yarn"||o.head==="pnpm")&&(o.sub==="install"||o.sub==="add"||o.sub==="i"||o.sub===void 0)))return!0}return!1},apply(a){let i=a.split(`
`),e=[/^npm warn deprecated /i,/^\s*\[#+>?\s*\] /,/^npm http /i,/^npm timing /i,/^npm sill /i,/^npm verb /i,/^\s*\d+ packages? are looking for funding/i,/run `npm fund`/i,/^Run `npm audit/i],t=[];for(let n of i)e.some(r=>r.test(n))||t.push(n);let o=t.join(`
`);return{text:o,compressed:o.length<a.length}}},dTn={id:"terminal.env",toolIds:["run_in_terminal"],matches(a,i){if(!oj(i))return!1;let e=eA(i.command);if(!e)return!1;for(let t of e.segments){let o=uL(t);if(o?.head==="printenv"||o===void 0&&t.wrappers.length>0&&t.wrappers[t.wrappers.length-1]==="env"&&t.tokens.length===0)return!0}return!1},apply(a){let i=a.split(`
`).filter(o=>o.trim()!==""),t=Array.from(new Set(i)).sort().join(`
`);return{text:t,compressed:t.length<a.length}}};function wFo(a){a.registerFilter(YEn),a.registerFilter(XEn),a.registerFilter(JEn),a.registerFilter(ZEn),a.registerFilter(eTn),a.registerFilter(tTn),a.registerFilter(iTn),a.registerFilter(nTn),a.registerFilter(sTn),a.registerFilter(lTn),a.registerFilter(cTn),a.registerFilter(dTn),a.registerCache(new L7t)}Ce(LP,GR,1);var U2e=class extends k{static{this.ID="terminal.shellIntegrationTimeoutMigration"}constructor(i){super();let e=i.inspect("chat.tools.terminal.shellIntegrationTimeout"),t=i.inspect("terminal.integrated.shellIntegration.timeout");e.userValue!==void 0&&t.userValue===void 0&&on(e.userValue)&&i.updateValue("terminal.integrated.shellIntegration.timeout",e.userValue,2),e.workspaceValue!==void 0&&t.workspaceValue===void 0&&on(e.workspaceValue)&&i.updateValue("terminal.integrated.shellIntegration.timeout",e.workspaceValue,5)}};U2e=I([m(0,B)],U2e);bt(U2e.ID,U2e,vt.Eventually);var z2e=class extends k{static{this.ID="terminal.outputLocationMigration"}constructor(i){super(),i.getValue("chat.tools.terminal.outputLocation")==="none"&&i.updateValue("chat.tools.terminal.outputLocation","chat")}};z2e=I([m(0,B)],z2e);bt(z2e.ID,z2e,vt.Eventually);var K2e=class extends k{constructor(e,t,o,n){super();this._instantiationService=e;this._toolsService=t;this._configurationService=o;this._runInTerminalToolRegistration=this._register(new ue);this._runInTerminalToolRegistrationVersion=0;wFo(n);let r=e.createInstance(R7t);this._register(t.registerTool(vFo,r));let s=e.createInstance(Qse);this._register(t.registerTool(JKi,s)),this._register(t.executeToolSet.addTool(JKi));let l=e.createInstance(D7t);this._register(t.registerTool(XKi,l)),this._register(t.executeToolSet.addTool(XKi));let c=e.createInstance(M2e);this._register(t.registerTool(e2i,c)),this._register(t.executeToolSet.addTool(e2i)),this._registerRunInTerminalTool();let u=e.createInstance(P2e);this._register(t.registerTool(t2i,u));let p=e.createInstance(L2e);this._register(t.registerTool(YKi,p)),this._register(t.readToolSet.addTool(t2i)),this._register(t.readToolSet.addTool(YKi));let h=e.createInstance(H2e);this._register(t.registerTool(s2i,h));let g=e.createInstance(B2e);this._register(t.registerTool(r2i,g));let f=e.createInstance(V2e);this._register(t.registerTool(n2i,f)),this._register(t.executeToolSet.addTool(s2i)),this._register(t.executeToolSet.addTool(n2i)),this._register(t.readToolSet.addTool(r2i)),this._register(this._configurationService.onDidChangeConfiguration(v=>{(v.affectsConfiguration("chat.agent.sandbox.enabled")||v.affectsConfiguration("chat.agent.sandbox")||v.affectsConfiguration("chat.agent.sandbox.allowUnsandboxedCommands")||v.affectsConfiguration("chat.agent.allowedNetworkDomains")||v.affectsConfiguration("chat.agent.deniedNetworkDomains")||v.affectsConfiguration("chat.agent.sandboxNetwork.allowedDomains")||v.affectsConfiguration("chat.agent.sandboxNetwork.deniedDomains")||v.affectsConfiguration("chat.agent.sandbox.allowedNetworkDomains")||v.affectsConfiguration("chat.agent.sandbox.deniedNetworkDomains")||v.affectsConfiguration("chat.agent.sandbox.fileSystem.linux")||v.affectsConfiguration("chat.agent.sandboxFileSystem.linux")||v.affectsConfiguration("chat.agent.sandbox.fileSystem.mac")||v.affectsConfiguration("chat.agent.sandboxFileSystem.mac"))&&this._registerRunInTerminalTool()}))}static{this.ID="terminal.chatAgentTools"}_registerRunInTerminalTool(){let e=++this._runInTerminalToolRegistrationVersion;this._instantiationService.invokeFunction(Ako).then(t=>{if(this._store.isDisposed||e!==this._runInTerminalToolRegistrationVersion)return;this._runInTerminalTool||(this._runInTerminalTool=this._register(this._instantiationService.createInstance(ic))),this._runInTerminalToolRegistration.value=void 0;let o=new O;o.add(this._toolsService.registerToolData(t)),o.add(this._toolsService.registerToolImplementation(t.id,this._runInTerminalTool)),o.add(this._toolsService.executeToolSet.addTool(t)),this._runInTerminalToolRegistration.value=o})}};K2e=I([m(0,F),m(1,Wn),m(2,B),m(3,tUe)],K2e);bt(K2e.ID,K2e,vt.AfterRestored);pc({id:"workbench.action.terminal.chat.addTerminalSelection",title:d(16457,null),precondition:C.and(Z.enabled,Ca.terminalAvailable),menu:[{id:R.TerminalInstanceContext,group:"0_chat",order:1,when:C.and(Z.enabled,pt.textSelected)}],run:async(a,i,e)=>{let t=e.get(Lt),o=a.selection;if(!o)return;let n=t.lastFocusedWidget??await t.revealWidget();n&&(n.attachmentModel.addContext({id:`terminal-selection-${Date.now()}`,kind:"generic",name:d(16458,null),fullName:d(16458,null),value:o,icon:L.terminal}),n.focusInput())}});Wr({id:"workbench.action.terminal.showTextureAtlas",title:P(16684,"Show Terminal Texture Atlas"),category:Fe.Developer,precondition:C.or(pt.isOpen),run:async(a,i)=>{let e=i.get(ge),t=i.get(Je),o=i.get(Ae),n=await a.service.activeInstance?.xterm?.textureAtlas;if(!n)return;let r=o.getWorkspace().folders[0].uri,s=A.joinPath(r,"textureAtlas.png"),l=document.createElement("canvas");l.width=n.width,l.height=n.height;let c=l.getContext("bitmaprenderer");if(!c)return;c.transferFromImageBitmap(n);let u=await new Promise(p=>l.toBlob(p));u&&(await e.writeFile(s,Ke.wrap(new Uint8Array(await u.arrayBuffer()))),t.open(s))}});Wr({id:"workbench.action.terminal.writeDataToTerminal",title:P(16685,"Write Data to Terminal"),category:Fe.Developer,run:async(a,i)=>{let e=i.get($e),t=await a.service.getActiveOrCreateInstance();if(await a.service.revealActiveTerminal(),await t.processReady,!t.xterm)throw new Error("Cannot write data to terminal if xterm isn't initialized");let o=await e.input({value:"",placeHolder:"Enter data (supports \\n, \\r, \\xAB)",prompt:d(16686,null)});if(!o)return;let n=o.replace(/\\n/g,`
`).replace(/\\r/g,"\r");for(;;){let s=n.match(/\\x([0-9a-fA-F]{2})/);if(s===null||s.index===void 0||s.length<2)break;n=n.slice(0,s.index)+String.fromCharCode(parseInt(s[1],16))+n.slice(s.index+4)}t.xterm._writeText(n)}});Wr({id:"workbench.action.terminal.recordSession",title:P(16681,"Record Terminal Session"),category:Fe.Developer,run:async(a,i)=>{let e=i.get(Bi),t=i.get(fe),o=i.get(Fr),n=new O,r=d(16682,null),s={text:r,name:r,ariaLabel:r,showProgress:!0},l=o.addEntry(s,"recordSession",0);n.add(l);let c=await a.service.createTerminal();return a.service.setActiveInstance(c),await a.service.revealActiveTerminal(),await Promise.all([c.processReady,c.focusWhenReady(!0)]),new Promise(u=>{let p=[],h=()=>{let v=JSON.stringify(p,null,2);e.writeText(v),n.dispose(),u()},g=n.add(new rn(5e3));n.add(U.runAndSubscribe(c.onDimensionsChanged,()=>{p.push({type:"resize",cols:c.cols,rows:c.rows}),g.trigger(h)})),n.add(t.onWillExecuteCommand(v=>{p.push({type:"command",id:v.commandId}),g.trigger(h)})),n.add(c.onWillData(v=>{p.push({type:"output",data:v}),g.trigger(h)})),n.add(c.onDidSendText(v=>{p.push({type:"sendText",data:v}),g.trigger(h)})),n.add(c.xterm.raw.onData(v=>{p.push({type:"input",data:v}),g.trigger(h)}));let f=!1;n.add(U.runAndSubscribe(c.capabilities.onDidAddCapability,v=>{if(f)return;let b=c.capabilities.get(2);b&&(n.add(b.promptInputModel.onDidChangeInput(S=>{p.push({type:"promptInputChange",data:b.promptInputModel.getCombinedString()}),g.trigger(h)})),f=!0)}))})}});Wr({id:"workbench.action.terminal.restartPtyHost",title:P(16683,"Restart Pty Host"),category:Fe.Developer,run:async(a,i)=>{let e=i.get(wa),t=Array.from(a.instanceService.getRegisteredBackends()),o=t.filter(r=>!r.isResponsive),n=o.length>0?o:t;for(let r of n)e.warn(`Restarting pty host for authority "${r.remoteAuthority}"`),r.restartPtyHost()}});var Yse=class extends k{constructor(e,t){super();this._ctx=e;this._configurationService=t;this._activeDevModeDisposables=this._register(new ue);this._currentColor=0;this._state=0;this._register(this._configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration("terminal.integrated.developer.devMode")&&this._updateDevMode()}))}static{this.ID="terminal.devMode"}static get(e){return e.getContribution(Yse.ID)}xtermReady(e){this._xterm=e,this._updateDevMode()}_updateDevMode(){let e=this._isEnabled();this._xterm?.raw.element?.classList.toggle("dev-mode",e);let t=this._ctx.instance.capabilities.get(2);if(e)if(t){if(this._state===2)return;this._state=2;let o=new Ot,n=new O;this._activeDevModeDisposables.value=Fn(o,n,this._ctx.instance.onDidBlur(()=>this._updateDevMode()),this._ctx.instance.onDidFocus(()=>this._updateDevMode()),t.promptInputModel.onDidChangeInput(()=>this._updateDevMode()),t.onCommandFinished(r=>{let s=`color-${this._currentColor}`,l=[];if(o.set(r,Fn(...l)),r.promptStartMarker){let c=this._ctx.instance.xterm.raw?.registerDecoration({marker:r.promptStartMarker});c&&(l.push(c),n.add(c.onRender(u=>{u.textContent="A",u.classList.add("xterm-sequence-decoration","top","left",s)})))}if(r.marker){let c=this._ctx.instance.xterm.raw?.registerDecoration({marker:r.marker,x:r.startX});c&&(l.push(c),n.add(c.onRender(u=>{u.textContent="B",u.classList.add("xterm-sequence-decoration","top","right",s)})))}if(r.executedMarker){let c=this._ctx.instance.xterm.raw?.registerDecoration({marker:r.executedMarker,x:r.executedX});c&&(l.push(c),n.add(c.onRender(u=>{u.textContent="C",u.classList.add("xterm-sequence-decoration","bottom","left",s)})))}if(r.endMarker){let c=this._ctx.instance.xterm.raw?.registerDecoration({marker:r.endMarker});c&&(l.push(c),n.add(c.onRender(u=>{u.textContent="D",u.classList.add("xterm-sequence-decoration","bottom","right",s)})))}this._currentColor=(this._currentColor+1)%2}),t.onCommandInvalidated(r=>{for(let s of r){let l=o.get(s);l&&je(l),o.deleteAndDispose(s)}}))}else{if(this._state===1)return;this._state=1,this._activeDevModeDisposables.value=this._ctx.instance.capabilities.onDidAddCommandDetectionCapability(o=>{this._updateDevMode()})}else{if(this._state===0)return;this._state=0,this._activeDevModeDisposables.clear()}}_isEnabled(){return this._configurationService.getValue("terminal.integrated.developer.devMode")||!1}};Yse=I([m(1,B)],Yse);tm(Yse.ID,Yse);pc({id:"workbench.action.terminal.showEnvironmentContributions",title:P(16690,"Show Environment Contributions"),run:async(a,i,e,t)=>{let o=a.extEnvironmentVariableCollection;if(o){let n=t,s=e.get(F).createInstance(Xse),l=e.get(ie),c=new Date().getTime(),u=n?.workspaceFolder?` - ${n.workspaceFolder.name}`:"",p=await s.provideTextContent(A.from({scheme:Xse.scheme,path:`Environment changes${u}`,fragment:pTn(o,n),query:`environment-collection-${c}`}));p&&await l.openEditor({resource:p.uri})}}});function pTn(a,i){let e=`# ${d(16687,null)}`,t=a.getDescriptionMap(void 0),o=a.getDescriptionMap(i);for(let[n,r]of a.collections){e+=`

## ${d(16688,null,n)}`,e+=`
`;let s=t.get(n);s&&(e+=`
${s}
`);let l=o.get(n);if(l){let c=s?` (${d(16689,null)})`:"";e+=`
${l}${c}
`}for(let c of r.map.values())mTn(c,i)!==!1&&(e+=`
- \`${hTn(c.type,c.value,c.variable)}\``)}return e}function mTn(a,i){return!!(!a.scope||a.scope.workspaceFolder&&i?.workspaceFolder&&a.scope.workspaceFolder.index===i.workspaceFolder.index)}function hTn(a,i,e){switch(a){case 3:return`${e}=${i}\${env:${e}}`;case 2:return`${e}=\${env:${e}}${i}`;default:return`${e}=${i}`}}var Xse=class{constructor(i,e){this._modelService=e;i.registerTextModelContentProvider(Xse.scheme,this)}static{this.scheme="ENVIRONMENT_CHANGES_COLLECTION"}async provideTextContent(i){let e=this._modelService.getModel(i);return e&&!e.isDisposed()?e:this._modelService.createModel(i.fragment,{languageId:"markdown",onDidChange:U.None},i,!1)}};Xse=I([m(0,Bt),m(1,_t)],Xse);var p2i=d(10097,null),gTn=d(10100,null),fTn=d(10099,null),vTn=d(10098,null),bTn=d(10096,null),M7t=310,STn=73,Jse=class extends ll{constructor(e,t,o,n,r,s,l){super();this._keybindingService=r;this._configurationService=s;this._accessibilityService=l;this._isVisible=!1;this._foundMatch=!1;this._width=0;this._accessibilityHelpHintAnnounced=!1;this.state=this._register(new p2),this._matchesLimit=e.matchesLimit??Number.MAX_SAFE_INTEGER,this._findInput=this._register(new XK(null,t,{label:p2i,placeholder:gTn,validation:h=>{if(h.length===0||!this._findInput.getRegex())return null;try{return new RegExp(h),null}catch(g){return this._foundMatch=!1,this.updateButtons(this._foundMatch),{content:g.message}}},showCommonFindToggles:e.showCommonFindToggles,appendCaseSensitiveLabel:e.appendCaseSensitiveActionId?this._getKeybinding(e.appendCaseSensitiveActionId):void 0,appendRegexLabel:e.appendRegexActionId?this._getKeybinding(e.appendRegexActionId):void 0,appendWholeWordsLabel:e.appendWholeWordsActionId?this._getKeybinding(e.appendWholeWordsActionId):void 0,showHistoryHint:()=>mM(r),inputBoxStyles:Wl,toggleStyles:zh},o)),this._updateHistoryDelayer=this._register(new rn(500)),this._register(this._findInput.onInput(async h=>{(!e.checkImeCompletionState||!this._findInput.isImeSessionInProgress)&&(this._foundMatch=this._onInputChanged(),e.showResultCount&&await this.updateResultCount(),this.updateButtons(this._foundMatch),this.focusFindBox(),this._delayedUpdateHistory())})),this._findInput.setRegex(!!this.state.isRegex),this._findInput.setCaseSensitive(!!this.state.matchCase),this._findInput.setWholeWords(!!this.state.wholeWord),this._register(this._findInput.onDidOptionChange(()=>{this.state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this.state.onFindReplaceStateChange(()=>{this._findInput.setRegex(this.state.isRegex),this._findInput.setWholeWords(this.state.wholeWord),this._findInput.setCaseSensitive(this.state.matchCase),this.findFirst()}));let c={groupId:"simple-find-widget"};this.prevBtn=this._register(new UI({label:fTn+(e.previousMatchActionId?this._getKeybinding(e.previousMatchActionId):""),icon:p6e,hoverLifecycleOptions:c,onTrigger:()=>{this.find(!0)}},n)),this.nextBtn=this._register(new UI({label:vTn+(e.nextMatchActionId?this._getKeybinding(e.nextMatchActionId):""),icon:m6e,hoverLifecycleOptions:c,onTrigger:()=>{this.find(!1)}},n));let u=this._register(new UI({label:bTn+(e.closeWidgetActionId?this._getKeybinding(e.closeWidgetActionId):""),icon:MT,hoverLifecycleOptions:c,onTrigger:()=>{this.hide()}},n));this._innerDomNode=document.createElement("div"),this._innerDomNode.classList.add("simple-find-part"),this._innerDomNode.appendChild(this._findInput.domNode),this._innerDomNode.appendChild(this.prevBtn.domNode),this._innerDomNode.appendChild(this.nextBtn.domNode),this._innerDomNode.appendChild(u.domNode),this._domNode=document.createElement("div"),this._domNode.classList.add("simple-find-part-wrapper"),this._domNode.appendChild(this._innerDomNode),this.onkeyup(this._innerDomNode,h=>{if(h.equals(9)){this.hide(),h.preventDefault();return}}),this._focusTracker=this._register(nr(this._innerDomNode)),this._register(this._focusTracker.onDidFocus(this._onFocusTrackerFocus.bind(this))),this._register(this._focusTracker.onDidBlur(this._onFocusTrackerBlur.bind(this))),this._findInputFocusTracker=this._register(nr(this._findInput.domNode)),this._register(this._findInputFocusTracker.onDidFocus(this._onFindInputFocusTrackerFocus.bind(this))),this._register(this._findInputFocusTracker.onDidBlur(this._onFindInputFocusTrackerBlur.bind(this))),this._register($(this._innerDomNode,"click",h=>{h.stopPropagation()})),e?.showResultCount&&(this._domNode.classList.add("result-count"),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._findInput.domNode.insertAdjacentElement("afterend",this._matchesCount),this._register(this._findInput.onDidChange(async()=>{await this.updateResultCount()})),this._register(this._findInput.onDidOptionChange(async()=>{this._foundMatch=this._onInputChanged(),await this.updateResultCount(),this.focusFindBox(),this._delayedUpdateHistory()})));let p=e?.initialWidth;if(p&&(p=p<M7t?M7t:p,this._domNode.style.width=`${p}px`),e?.enableSash){let h=p??M7t,g=h,f=this._register(new kh(this._innerDomNode,this,{orientation:0,size:1}));this._register(f.onDidStart(()=>{g=parseFloat(mF(this._domNode).width)})),this._register(f.onDidChange(v=>{let b=g+v.startX-v.currentX;b<h||(this._domNode.style.width=`${b}px`)})),this._register(f.onDidReset(v=>{parseFloat(mF(this._domNode).width)===h?this._domNode.style.width="100%":this._domNode.style.width=`${h}px`}))}}getVerticalSashLeft(e){return 0}get inputValue(){return this._findInput.getValue()}get focusTracker(){return this._focusTracker}_getKeybinding(e){return this._keybindingService.appendKeybinding("",e)}dispose(){super.dispose(),this._domNode?.remove()}isVisible(){return this._isVisible}getDomNode(){return this._domNode}getFindInputDomNode(){return this._findInput.domNode}reveal(e,t=!0){if(e&&this._findInput.setValue(e),this._isVisible){this._findInput.select();return}this._isVisible=!0,this._updateFindInputAriaLabel(),this.updateResultCount(),this.layout(),setTimeout(()=>{this._innerDomNode.classList.toggle("suppress-transition",!t),this._innerDomNode.classList.add("visible","visible-transition"),this._innerDomNode.setAttribute("aria-hidden","false"),this._findInput.select(),t||setTimeout(()=>{this._innerDomNode.classList.remove("suppress-transition")},0)},0)}show(e){e&&!this._isVisible&&this._findInput.setValue(e),this._isVisible=!0,this.layout(),setTimeout(()=>{this._innerDomNode.classList.add("visible","visible-transition"),this._innerDomNode.setAttribute("aria-hidden","false")},0)}hide(e=!0){this._isVisible&&(this._accessibilityHelpHintAnnounced=!1,this._innerDomNode.classList.toggle("suppress-transition",!e),this._innerDomNode.classList.remove("visible-transition"),this._innerDomNode.setAttribute("aria-hidden","true"),setTimeout(()=>{this._isVisible=!1,this.updateButtons(this._foundMatch),this._innerDomNode.classList.remove("visible","suppress-transition")},e?200:0))}layout(e=this._width){if(this._width=e,!!this._isVisible&&this._matchesCount){let t=!1;M7t+STn+28>=e&&(t=!0),this._innerDomNode.classList.toggle("reduced-find-widget",t)}}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this))}_updateHistory(){this._findInput.inputBox.addToHistory()}_getRegexValue(){return this._findInput.getRegex()}_getWholeWordValue(){return this._findInput.getWholeWords()}_getCaseSensitiveValue(){return this._findInput.getCaseSensitive()}updateButtons(e){let t=this.inputValue.length>0;this.prevBtn.setEnabled(this._isVisible&&t&&e),this.nextBtn.setEnabled(this._isVisible&&t&&e)}focusFindBox(){this.nextBtn.focus(),this._findInput.inputBox.focus()}async updateResultCount(){if(!this._matchesCount){this.updateButtons(this._foundMatch);return}let e=await this._getResultCount();this._matchesCount.textContent="";let t=this.inputValue.length>0&&e?.resultCount===0;this._matchesCount.classList.toggle("no-results",t);let o="";if(e?.resultCount){let n=String(e.resultCount);e.resultCount>=this._matchesLimit&&(n+="+");let r=String(e.resultIndex+1);r==="0"&&(r="?"),o=Wd(h6e,r,n)}else o=e2;Er(this._announceSearchResults(o,this.inputValue)),this._matchesCount.appendChild(document.createTextNode(o)),this._foundMatch=!!e&&e.resultCount>0,this.updateButtons(this._foundMatch)}changeState(e){this.state.change(e,!1)}_updateFindInputAriaLabel(){let e=p2i;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue("accessibility.verbosity.find")&&this._accessibilityService.isScreenReaderOptimized()){let t=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();t&&(e+=", "+d(10091,null,t),this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=Zo(()=>{this._isVisible&&this._findInput.inputBox.setAriaLabel(p2i)},1e3))}this._findInput.inputBox.setAriaLabel(e)}_announceSearchResults(e,t){return t?e===e2?t===""?d(10094,null,e):d(10093,null,e,t):d(10095,null,e,t):d(10092,null)}},ITn=te("simpleFindWidget.sashBorder",{dark:"#454545",light:"#C8C8C8",hcDark:"#6FC3DF",hcLight:"#0F4A85"},d(10101,null));hs((a,i)=>{let e=a.getColor(ITn);i.addRule(`.monaco-workbench .simple-find-part .monaco-sash { background-color: ${e}; border-color: ${e} }`)});async function CFo(a,i,e){let t=a.get(B),o=a.get(ct),n=i.split(/\r?\n/);if(n.length===1)return!0;function r(g){return We(g)&&(g==="auto"||g==="always"||g==="never")?g:typeof g=="boolean"?g?"auto":"never":"auto"}let s=r(t.getValue("terminal.integrated.enableMultiLinePasteWarning"));if(s==="never")return!0;if(s==="auto"){if(e)return!0;if(n.length===2&&n[1].trim().length===0)return{modifiedText:n[0]}}let l=3,c=30,u=d(16678,null);for(let g=0;g<Math.min(n.length,l);g++){let f=n[g],v=f.length>c?`${f.slice(0,c)}\u2026`:f;u+=`
${v}`}n.length>l&&(u+=`
\u2026`);let{result:p,checkboxChecked:h}=await o.prompt({message:d(16674,null,n.length),detail:u,type:"warning",buttons:[{label:d(16676,null),run:()=>({confirmed:!0,singleLine:!1})},{label:d(16677,null),run:()=>({confirmed:!0,singleLine:!0})}],cancelButton:!0,checkbox:{label:d(16675,null)}});return p?(p.confirmed&&h&&await t.updateValue("terminal.integrated.enableMultiLinePasteWarning","never"),p.singleLine?{modifiedText:i.replace(/\r?\n/g,"")}:p.confirmed):!1}var pL=class extends k{constructor(e,t,o,n,r,s){super();this._ctx=e;this._clipboardService=t;this._configurationService=o;this._instantiationService=n;this._notificationService=r;this._terminalConfigurationService=s;this._overrideCopySelection=void 0;this._onWillPaste=this._register(new T);this.onWillPaste=this._onWillPaste.event;this._onDidPaste=this._register(new T);this.onDidPaste=this._onDidPaste.event}static{this.ID="terminal.clipboard"}static get(e){return e.getContribution(pL.ID)}xtermReady(e){this._xterm=e,this._register(e.onDidRequestCopyAsHtml(t=>this.copySelection(!0,t.command))),this._register(e.raw.onSelectionChange(async()=>{if(this._configurationService.getValue("terminal.integrated.copyOnSelection")){if(this._overrideCopySelection===!1)return;this._ctx.instance.hasSelection()&&await this.copySelection()}}))}async copySelection(e,t){this._xterm?.copySelection(e,t)}async paste(){let e=await this._clipboardService.readText();if(!e){let[t]=await this._clipboardService.readResources();t?.scheme===Q.file&&(e=t.fsPath)}await this._paste(e)}async pasteSelection(){await this._paste(await this._clipboardService.readText("selection"))}async _paste(e){if(!this._xterm)return;let t=e,o=await this._instantiationService.invokeFunction(CFo,t,this._xterm?.raw.modes.bracketedPasteMode);o&&(typeof o=="object"&&(t=o.modifiedText),this._ctx.instance.focus(),this._onWillPaste.fire(t),this._xterm.raw.paste(t),this._onDidPaste.fire(t))}async handleMouseEvent(e){switch(e.button){case 1:{if(this._terminalConfigurationService.config.middleClickBehavior==="paste")return this.paste(),{handled:!0};break}case 2:{if(e.shiftKey)return;let t=this._terminalConfigurationService.config.rightClickBehavior;return t!=="copyPaste"&&t!=="paste"?void 0:(t==="copyPaste"&&this._ctx.instance.hasSelection()?(await this.copySelection(),this._ctx.instance.clearSelection()):of.clipboard.readText?this.paste():this._notificationService.info(`This browser doesn't support the clipboard.readText API needed to trigger a paste, try ${et?"\u2318":"Ctrl"}+V instead.`),et&&setTimeout(()=>this._ctx.instance.clearSelection(),0),{handled:!0})}}}overrideCopyOnSelection(e){if(this._overrideCopySelection!==void 0)throw new Error("Cannot set a copy on selection override multiple times");return this._overrideCopySelection=e,ee(()=>this._overrideCopySelection=void 0)}};pL=I([m(1,Bi),m(2,B),m(3,F),m(4,Ne),m(5,mp)],pL);tm(pL.ID,pL,!1);var Zse=C.or(pt.processSupported,pt.terminalHasBeenCreated);pc({id:"workbench.action.terminal.copyLastCommand",title:P(16667,"Copy Last Command"),precondition:Zse,run:async(a,i,e)=>{let t=e.get(Bi),o=a.capabilities.get(2)?.commands;if(!o||o.length===0)return;let n=o[o.length-1];n.command&&await t.writeText(n.command)}});pc({id:"workbench.action.terminal.copyLastCommandOutput",title:P(16669,"Copy Last Command Output"),precondition:Zse,run:async(a,i,e)=>{let t=e.get(Bi),o=a.capabilities.get(2)?.commands;if(!o||o.length===0)return;let n=o[o.length-1];if(!n?.hasOutput())return;let r=n.getOutput();We(r)&&await t.writeText(r)}});pc({id:"workbench.action.terminal.copyLastCommandAndLastCommandOutput",title:P(16668,"Copy Last Command and Output"),precondition:Zse,run:async(a,i,e)=>{let t=e.get(Bi),o=a.capabilities.get(2)?.commands;if(!o||o.length===0)return;let n=o[o.length-1];if(!n?.hasOutput())return;let r=n.getOutput();We(r)&&await t.writeText(`${n.command!==""?n.command+`
`:""}${r}`)}});of.clipboard.writeText&&(bh({id:"workbench.action.terminal.copySelection",title:P(16670,"Copy Selection"),precondition:C.or(pt.textSelectedInFocused,C.and(Zse,pt.textSelected)),keybinding:[{primary:3105,mac:{primary:2081},weight:200,when:C.or(C.and(pt.textSelected,pt.focus),pt.textSelectedInFocused)}],run:a=>a.copySelection()}),bh({id:"workbench.action.terminal.copyAndClearSelection",title:P(16666,"Copy and Clear Selection"),precondition:C.or(pt.textSelectedInFocused,C.and(Zse,pt.textSelected)),keybinding:[{win:{primary:2081},weight:200,when:C.or(C.and(pt.textSelected,pt.focus),pt.textSelectedInFocused)}],run:async a=>{await a.copySelection(),a.clearSelection()}}),bh({id:"workbench.action.terminal.copySelectionAsHtml",title:P(16671,"Copy Selection as HTML"),f1:!0,category:vr.actionCategory,precondition:C.or(pt.textSelectedInFocused,C.and(Zse,pt.textSelected)),run:a=>a.copySelection(!0)}));of.clipboard.readText&&pc({id:"workbench.action.terminal.paste",title:P(16672,"Paste into Active Terminal"),precondition:Zse,keybinding:[{primary:2100,win:{primary:2100,secondary:[3124]},linux:{primary:3124},weight:200,when:pt.focus}],run:a=>pL.get(a)?.paste()});of.clipboard.readText&&Sn&&pc({id:"workbench.action.terminal.pasteSelection",title:P(16673,"Paste Selection into Active Terminal"),precondition:Zse,keybinding:[{linux:{primary:1043},weight:200,when:pt.focus}],run:a=>pL.get(a)?.pasteSelection()});var yTn=419,G2e=class extends Jse{constructor(e,t,o,n,r,s,l,c,u,p,h){super({showCommonFindToggles:!0,checkImeCompletionState:!0,showResultCount:!0,initialWidth:yTn,enableSash:!0,appendCaseSensitiveActionId:"workbench.action.terminal.toggleFindCaseSensitive",appendRegexActionId:"workbench.action.terminal.toggleFindRegex",appendWholeWordsActionId:"workbench.action.terminal.toggleFindWholeWord",previousMatchActionId:"workbench.action.terminal.findPrevious",nextMatchActionId:"workbench.action.terminal.findNext",closeWidgetActionId:"workbench.action.terminal.hideFind",type:"Terminal",matchesLimit:2e4},s,n,l,c,o,h);this._instance=e;this._overrideCopyOnSelectionDisposable=this._register(new ue);this._selectionDisposable=this._register(new ue);this._register(this.state.onFindReplaceStateChange(()=>{this.show()})),this._findInputFocused=pt.findInputFocus.bindTo(n),this._findWidgetFocused=pt.findFocus.bindTo(n),this._findWidgetVisible=pt.findVisible.bindTo(n);let g=this.getDomNode().firstChild;g&&(this._register($(g,"mousedown",v=>{v.stopPropagation()})),this._register($(g,"contextmenu",v=>{v.stopPropagation()})));let f=this.getFindInputDomNode();this._register($(f,"contextmenu",v=>{let b=Me(f),S=new Ln(b,v),y=Aki(t,p);r.showContextMenu({getAnchor:()=>S,getActions:()=>y,getActionsContext:()=>v.target}),v.stopPropagation()})),this._register(u.onDidColorThemeChange(()=>{this.isVisible()&&this.find(!0,!0)})),this._register(o.onDidChangeConfiguration(v=>{v.affectsConfiguration("workbench.colorCustomizations")&&this.isVisible()&&this.find(!0,!0)})),this._setupSearchEventListeners(),this.updateResultCount()}_setupSearchEventListeners(){let e=this._instance.xterm;e&&(this._register(e.onBeforeSearch(()=>{this._overrideCopyOnSelectionDisposable.clear(),this._overrideCopyOnSelectionDisposable.value=pL.get(this._instance)?.overrideCopyOnSelection(!1)})),this._register(e.onAfterSearch(()=>{this._overrideCopyOnSelectionDisposable.clear()})))}find(e,t){let o=this._instance.xterm;o&&(e?this._findPreviousWithEvent(o,this.inputValue,{regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue(),incremental:t}):this._findNextWithEvent(o,this.inputValue,{regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue()}))}reveal(){let t=(this._instance.hasSelection()&&!this._instance.selection.includes(`
`)?this._instance.selection:void 0)??this.inputValue,o=this._instance.xterm;o&&t&&t!==""&&this._findPreviousWithEvent(o,t,{incremental:!0,regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue()}).then(n=>{this.updateButtons(n),this._register(U.once(o.onDidChangeSelection)(()=>o.clearActiveSearchDecoration()))}),this.updateButtons(!1),super.reveal(t),this._findWidgetVisible.set(!0)}show(){let e=this._instance.hasSelection()&&!this._instance.selection.includes(`
`)?this._instance.selection:void 0;super.show(e),this._findWidgetVisible.set(!0)}hide(){super.hide(),this._overrideCopyOnSelectionDisposable.clear(),this._findWidgetVisible.reset(),this._instance.focus(!0),this._instance.xterm?.clearSearchDecorations()}async _getResultCount(){return this._instance.xterm?.findResult}_onInputChanged(){let e=this._instance.xterm;return e&&this._findPreviousWithEvent(e,this.inputValue,{regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue(),incremental:!0}).then(t=>{this.updateButtons(t)}),!1}_onFocusTrackerFocus(){this._overrideCopyOnSelectionDisposable.clear(),this._overrideCopyOnSelectionDisposable.value=pL.get(this._instance)?.overrideCopyOnSelection(!1),this._findWidgetFocused.set(!0)}_onFocusTrackerBlur(){this._overrideCopyOnSelectionDisposable.clear(),this._instance.xterm?.clearActiveSearchDecoration(),this._findWidgetFocused.reset()}_onFindInputFocusTrackerFocus(){this._findInputFocused.set(!0)}_onFindInputFocusTrackerBlur(){this._findInputFocused.reset()}findFirst(){let e=this._instance;e.hasSelection()&&e.clearSelection();let t=e.xterm;t&&this._findPreviousWithEvent(t,this.inputValue,{regex:this._getRegexValue(),wholeWord:this._getWholeWordValue(),caseSensitive:this._getCaseSensitiveValue()})}_registerSelectionChangeListener(e){this._selectionDisposable.value=U.once(e.onDidChangeSelection)(()=>e.clearActiveSearchDecoration())}async _findNextWithEvent(e,t,o){let n=await e.findNext(t,o);return this._registerSelectionChangeListener(e),n}async _findPreviousWithEvent(e,t,o){let n=await e.findPrevious(t,o);return this._registerSelectionChangeListener(e),n}};G2e=I([m(1,Bi),m(2,B),m(3,X),m(4,Xe),m(5,qn),m(6,ot),m(7,Le),m(8,Pe),m(9,re),m(10,Ai)],G2e);var P7t=class{constructor(){this.priority=105;this.name="terminal-find";this.type="help";this.when=pt.findFocus}getProvider(i){let e=i.get(fe);return new m2i(e)}},m2i=class extends k{constructor(e){super();this._commandService=e;this.id="terminalFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){setTimeout(()=>{this._commandService.executeCommand("workbench.action.terminal.focusFind")},200)}provideContent(){let e=[];return e.push(d(16706,null)),e.push(d(16701,null)),e.push(""),e.push(d(16727,null)),e.push(d(16726,null)),e.push(""),e.push(d(16713,null)),e.push(d(16712,null)),e.push(""),e.push(d(16711,null)),e.push(d(16710,null)),e.push(d(16707,null)),e.push(d(16708,null)),e.push(d(16709,null)),e.push(""),e.push(d(16705,null)),e.push(d(16702,null)),e.push(d(16703,null)),e.push(d(16704,null)),e.push(""),e.push(d(16714,null)),e.push(""),e.push(d(16716,null)),e.push(d(16715,null)),e.push(d(16718,null)),e.push(""),e.push(d(16717,null)),e.push(""),e.push(d(16721,null)),e.push(d(16719,null)),e.push(d(16722,null)),e.push(d(16720,null)),e.push(""),e.push(d(16724,null,"<keybinding:workbench.action.openSettings>")),e.push(d(16723,null)),e.push(d(16725,null)),e.push(""),e.push(d(16700,null)),e.push(d(16699,null)),e.join(`
`)}};var sv=class extends k{static{this.ID="terminal.find"}static get(i){return i.getContribution(sv.ID)}get findWidget(){return this._findWidget.value}constructor(i,e,t){super(),this._findWidget=new uo(()=>{let o=e.createInstance(G2e,i.instance);if(o.focusTracker.onDidFocus(()=>{sv.activeFindWidget=this,i.instance.forceScrollbarVisibility(),$M(i.instance)||t.setActiveInstance(i.instance)}),o.focusTracker.onDidBlur(()=>{sv.activeFindWidget=void 0,i.instance.resetScrollbarVisibility()}),!i.instance.domElement)throw new Error("FindWidget expected terminal DOM to be initialized");return i.instance.domElement?.appendChild(o.getDomNode()),this._lastLayoutDimensions&&o.layout(this._lastLayoutDimensions.width),o})}layout(i,e){this._lastLayoutDimensions=e,this._findWidget.rawValue?.layout(e.width)}xtermReady(i){this._register(i.onDidChangeFindResults(()=>this._findWidget.rawValue?.updateResultCount()))}dispose(){sv.activeFindWidget===this&&(sv.activeFindWidget=void 0),super.dispose(),this._findWidget.rawValue?.dispose()}};sv=I([m(1,F),m(2,an)],sv);tm(sv.ID,sv,!0);bh({id:"workbench.action.terminal.focusFind",title:P(16693,"Focus Find"),keybinding:{primary:2084,when:C.or(pt.findFocus,pt.focusInAny),weight:200},precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),run:(a,i,e)=>{(sv.activeFindWidget||sv.get(e))?.findWidget.reveal()}});bh({id:"workbench.action.terminal.hideFind",title:P(16694,"Hide Find"),keybinding:{primary:9,secondary:[1033],when:C.and(pt.focusInAny,pt.findVisible),weight:200},precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),run:(a,i,e)=>{(sv.activeFindWidget||sv.get(e))?.findWidget.hide()}});bh({id:"workbench.action.terminal.toggleFindRegex",title:P(16697,"Toggle Find Using Regex"),keybinding:{primary:560,mac:{primary:2608},when:pt.findVisible,weight:200},precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(sv.activeFindWidget||sv.get(e))?.findWidget.state;o?.change({isRegex:!o.isRegex},!1)}});bh({id:"workbench.action.terminal.toggleFindWholeWord",title:P(16698,"Toggle Find Using Whole Word"),keybinding:{primary:565,mac:{primary:2613},when:pt.findVisible,weight:200},precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(sv.activeFindWidget||sv.get(e))?.findWidget.state;o?.change({wholeWord:!o.wholeWord},!1)}});bh({id:"workbench.action.terminal.toggleFindCaseSensitive",title:P(16696,"Toggle Find Using Case Sensitive"),keybinding:{primary:545,mac:{primary:2593},when:pt.findVisible,weight:200},precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(sv.activeFindWidget||sv.get(e))?.findWidget.state;o?.change({matchCase:!o.matchCase},!1)}});bh({id:"workbench.action.terminal.findNext",title:P(16691,"Find Next"),keybinding:[{primary:61,mac:{primary:2085,secondary:[61]},when:C.or(pt.focusInAny,pt.findFocus),weight:200},{primary:1027,when:pt.findInputFocus,weight:200}],precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(sv.activeFindWidget||sv.get(e))?.findWidget;o&&(o.show(),o.find(!1))}});bh({id:"workbench.action.terminal.findPrevious",title:P(16692,"Find Previous"),keybinding:[{primary:1085,mac:{primary:3109,secondary:[1085]},when:C.or(pt.focusInAny,pt.findFocus),weight:200},{primary:3,when:pt.findInputFocus,weight:200}],precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),run:(a,i,e)=>{let o=(sv.activeFindWidget||sv.get(e))?.findWidget;o&&(o.show(),o.find(!0))}});pc({id:"workbench.action.terminal.searchWorkspace",title:P(16695,"Search Workspace"),keybinding:[{primary:3108,when:C.and(pt.processSupported,pt.focus,pt.textSelected),weight:250}],run:(a,i,e)=>a3t(e,{query:a.selection})});_a.register(new P7t);var kFo=te("terminalStickyScroll.background",null,d(16821,null)),EFo=te("terminalStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:"#E48B39",hcLight:"#0f4a85"},d(16823,null));te("terminalStickyScroll.border",{dark:null,light:null,hcDark:"#6fc3df",hcLight:"#0f4a85"},d(16822,null));var u7=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._instance=e;this._xterm=t;this._xtermColorProvider=o;this._commandDetection=n;this._contextMenuService=c;this._keybindingService=u;this._terminalConfigurationService=h;this._themeService=g;this._xtermAddonLoader=new uze;this._webglAddon=this._register(new ue);this._refreshListeners=this._register(new ue);this._state=0;this._isRefreshQueued=!1;this._rawMaxLineCount=5;this._ignoredCommands=[];this._pendingShowOperation=!1;this._contextMenu=this._register(p.createMenu(R.TerminalStickyScrollContext,l)),this._register(U.runAndSubscribe(this._xterm.raw.buffer.onBufferChange,f=>{this._setState((f??this._xterm.raw.buffer.active).type==="normal"?1:0)})),this._register(U.runAndSubscribe(s.onDidChangeConfiguration,f=>{(!f||f.affectsConfiguration("terminal.integrated.stickyScroll.maxLineCount"))&&(this._rawMaxLineCount=s.getValue("terminal.integrated.stickyScroll.maxLineCount")),(!f||f.affectsConfiguration("terminal.integrated.stickyScroll.ignoredCommands"))&&(this._ignoredCommands=s.getValue("terminal.integrated.stickyScroll.ignoredCommands"))})),this._register(this._instance.onDidChangeTarget(()=>this._syncOptions())),r.then(f=>{this._store.isDisposed||(this._stickyScrollOverlay=this._register(new f({rows:1,cols:this._xterm.raw.cols,allowProposedApi:!0,...this._getOptions()})),this._refreshGpuAcceleration(),this._register(s.onDidChangeConfiguration(v=>{v.affectsConfiguration(gb)&&this._syncOptions()})),this._register(this._themeService.onDidColorThemeChange(()=>{this._syncOptions()})),this._register(this._xterm.raw.onResize(()=>{this._syncOptions(),this._refresh()})),this._register(this._instance.onDidChangeVisibility(v=>{v&&this._refresh()})),this._xtermAddonLoader.importAddon("serialize").then(v=>{this._store.isDisposed||(this._serializeAddon=this._register(new v),this._xterm.raw.loadAddon(this._serializeAddon),this._refresh())}))})}lockHide(){this._element?.classList.add("lock-hide")}unlockHide(){this._element?.classList.remove("lock-hide")}_setState(e){if(this._state!==e)switch(e){case 0:{this._setVisible(!1),this._uninstallRefreshListeners();break}case 1:{this._refresh(),this._installRefreshListeners();break}}}_installRefreshListeners(){this._refreshListeners.value||(this._refreshListeners.value=Fn(U.any(this._xterm.raw.onScroll,this._xterm.raw.onLineFeed,this._xterm.raw.onCursorMove)(()=>this._refresh()),Yo(this._xterm.raw.element.querySelector(".xterm-viewport"),"scroll",()=>this._refresh())))}_uninstallRefreshListeners(){this._refreshListeners.clear()}_setVisible(e){e?(this._pendingShowOperation=!0,this._show()):this._hide()}_show(){this._pendingShowOperation&&(this._ensureElement(),this._element?.classList.toggle("visible",!0)),this._pendingShowOperation=!1}_hide(){this._pendingShowOperation=!1,this._element?.classList.toggle("visible",!1)}_refresh(){this._isRefreshQueued||(this._isRefreshQueued=!0,queueMicrotask(()=>{this._refreshNow(),this._isRefreshQueued=!1}))}_refreshNow(){let e=this._commandDetection.getCommandForLine(this._xterm.raw.buffer.active.viewportY);if(this._currentStickyCommand=void 0,!e||this._isIgnoredCommand(e)){this._setVisible(!1);return}if(!XC(e)){let o=this._commandDetection.currentCommand;if(o?.commandStartMarker&&o.commandExecutedMarker){this._updateContent(o,o.commandStartMarker);return}this._setVisible(!1);return}let t=e.marker;if(!t||t.line===-1){this._setVisible(!1);return}this._updateContent(e,t)}_updateContent(e,t){let o=this._xterm.raw;if(!o.element?.parentElement||!this._stickyScrollOverlay||!this._serializeAddon)return;if(e.promptStartMarker?.line===-1){this._setVisible(!1);return}let n=o.buffer.active,r=e.getPromptRowCount(),s=e.getCommandRowCount(),l=t.line-(r-1),c=!XC(e),u=!c&&e.endMarker?Math.max(n.viewportY-e.endMarker.line+1,0):0,p=Math.min(this._rawMaxLineCount,Math.floor(o.rows*.4)),h=Math.min(r+s-1,p)-u,g=h<r+s-1;if(n.viewportY<=l){this._setVisible(!1);return}if(c&&n.viewportY===n.baseY&&n.cursorY===o.rows-1){let v=n.getLine(n.baseY+o.rows-1);if(n.cursorX===1&&TFo(v,":")||n.cursorX===5&&TFo(v,"(END)")){this._setVisible(!1);return}}let f=this._serializeAddon.serialize({range:{start:l+u,end:l+u+Math.max(h-1,0)}})+(g?"\x1B[0m \u2026":"");if(c&&Hv(f).length===0){this._setVisible(!1);return}if((f&&this._currentContent!==f||this._stickyScrollOverlay.cols!==o.cols||this._stickyScrollOverlay.rows!==h)&&(this._stickyScrollOverlay.resize(this._stickyScrollOverlay.cols,h),this._stickyScrollOverlay.write("\x1B[0m\x1B[H\x1B[2J"),this._stickyScrollOverlay.write(f),this._currentContent=f),f){if(this._currentStickyCommand=e,this._setVisible(!0),this._element){let v=o.element.getBoundingClientRect();if(v.height>0){let b=v.height/o.rows,S=h*b,y=0;if(!c&&e.endMarker&&e.endMarker.line!==-1){let w=Math.min(e.endMarker.line,n.baseY+n.cursorY);n.viewportY+h>w&&(y=(n.viewportY+h-w)*b)}this._element.style.bottom=`${v.height-S+1+y}px`}}}else this._setVisible(!1)}_ensureElement(){if(this._element||!this._stickyScrollOverlay||!this._xterm?.raw.element?.parentElement)return;let e=this._stickyScrollOverlay,t=_(".hover-overlay");this._element=_(".terminal-sticky-scroll",void 0,t),this._xterm.raw.element.parentElement.append(this._element),this._register(ee(()=>this._element?.remove()));let o=d(16825,null),n=this._keybindingService.lookupKeybinding("workbench.action.terminal.scrollToPreviousCommand");if(n){let l=n.getLabel();l&&(o+=`
`+d(16824,null,vr.scrollToPreviousCommand.value,l))}let r=this._keybindingService.lookupKeybinding("workbench.action.terminal.scrollToNextCommand");if(r){let l=r.getLabel();l&&(o+=`
`+d(16824,null,vr.scrollToNextCommand.value,l))}t.title=o;let s=this._xterm.raw._core.viewport?.scrollBarWidth;s!==void 0&&(this._element.style.right=`${s}px`),this._stickyScrollOverlay.open(this._element),this._stickyScrollOverlay.attachCustomKeyEventHandler(l=>l.key!=="Tab"),this._xtermAddonLoader.importAddon("ligatures").then(l=>{this._store.isDisposed||!this._stickyScrollOverlay||(this._ligaturesAddon=new l,this._stickyScrollOverlay.loadAddon(this._ligaturesAddon))}),this._register(Yo(t,"click",()=>{this._xterm&&this._currentStickyCommand&&(this._xterm.markTracker.revealCommand(this._currentStickyCommand),this._instance.focus())})),this._register(Yo(t,"wheel",l=>this._xterm?.raw.element?.dispatchEvent(new WheelEvent(l.type,l)))),this._register($(t,"mousedown",l=>{l.stopImmediatePropagation(),l.preventDefault()})),this._register($(t,"contextmenu",l=>{l.stopImmediatePropagation(),l.preventDefault(),d7(Me(t),l,this._instance,this._contextMenu,this._contextMenuService)})),this._register(Yo(t,"mouseover",()=>e.options.theme=this._getTheme(!0))),this._register(Yo(t,"mouseleave",()=>e.options.theme=this._getTheme(!1)))}_syncOptions(){this._stickyScrollOverlay&&(this._stickyScrollOverlay.resize(this._xterm.raw.cols,this._stickyScrollOverlay.rows),this._stickyScrollOverlay.options=this._getOptions(),this._refreshGpuAcceleration())}_getOptions(){let e=this._xterm.raw.options;return{cursorInactiveStyle:"none",scrollback:0,logLevel:"off",theme:this._getTheme(!1),documentOverride:e.documentOverride,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontWeightBold:e.fontWeightBold,fontSize:e.fontSize,letterSpacing:e.letterSpacing,lineHeight:e.lineHeight,drawBoldTextInBrightColors:e.drawBoldTextInBrightColors,minimumContrastRatio:e.minimumContrastRatio,tabStopWidth:e.tabStopWidth}}async _refreshGpuAcceleration(){if(this._shouldLoadWebgl()&&(!this._webglAddon.value||this._webglAddonCustomGlyphs!==this._terminalConfigurationService.config.customGlyphs)){let e=await this._xtermAddonLoader.importAddon("webgl");if(this._store.isDisposed)return;this._webglAddon.value=new e({customGlyphs:this._terminalConfigurationService.config.customGlyphs}),this._webglAddonCustomGlyphs=this._terminalConfigurationService.config.customGlyphs,this._stickyScrollOverlay?.loadAddon(this._webglAddon.value)}else!this._shouldLoadWebgl()&&this._webglAddon.value&&this._webglAddon.clear()}_shouldLoadWebgl(){return this._terminalConfigurationService.config.gpuAcceleration==="auto"||this._terminalConfigurationService.config.gpuAcceleration==="on"}_getTheme(e){let t=this._themeService.getColorTheme();return{...this._xterm.getXtermTheme(),background:e?t.getColor(EFo)?.toString()??this._xtermColorProvider.getBackgroundColor(t)?.toString():t.getColor(kFo)?.toString()??this._xtermColorProvider.getBackgroundColor(t)?.toString(),selectionBackground:void 0,selectionInactiveBackground:void 0}}_isIgnoredCommand(e){if(!e.command)return!1;let t=e.command.trim().toLowerCase();return this._ignoredCommands.some(o=>o.toLowerCase()===t)}};I([Tu(100)],u7.prototype,"_show",1),I([DA(0)],u7.prototype,"_syncOptions",1),I([DA(0)],u7.prototype,"_refreshGpuAcceleration",1),u7=I([m(5,B),m(6,X),m(7,Xe),m(8,Le),m(9,Yt),m(10,mp),m(11,Pe)],u7);function TFo(a,i){if(!a)return!1;for(let e=0;e<i.length;e++)if(a.getCell(e)?.getChars()!==i[e])return!1;return!0}var QV=class extends k{constructor(e,t,o,n,r){super();this._ctx=e;this._configurationService=t;this._contextKeyService=o;this._instantiationService=n;this._keybindingService=r;this._overlay=this._register(new ue);this._enableListeners=this._register(new ue);this._disableListeners=this._register(new ue);this._richCommandDetectionListeners=this._register(new ue);this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,s=>{(!s||s.affectsConfiguration("terminal.integrated.stickyScroll.enabled"))&&this._refreshState()}))}static{this.ID="terminal.stickyScroll"}static get(e){return e.getContribution(QV.ID)}xtermReady(e){this._xterm=e,this._refreshState()}xtermOpen(e){this._refreshState()}hideLock(){this._overlay.value?.lockHide()}hideUnlock(){this._overlay.value?.unlockHide()}_refreshState(){this._overlay.value?this._tryDisable():this._tryEnable(),this._overlay.value?(this._enableListeners.clear(),this._disableListeners.value||(this._disableListeners.value=this._ctx.instance.capabilities.onDidRemoveCapability(e=>{e.id===2&&this._refreshState()}))):(this._disableListeners.clear(),this._enableListeners.value||(this._enableListeners.value=this._ctx.instance.capabilities.onDidAddCapability(e=>{e.id===2&&this._refreshState()})))}_tryEnable(){let e=this._ctx.instance.capabilities.get(2);if(this._shouldBeEnabled()){let t=Ov.getXtermConstructor(this._keybindingService,this._contextKeyService);this._overlay.value=this._instantiationService.createInstance(u7,this._ctx.instance,this._xterm,this._instantiationService.createInstance(rIe,this._ctx.instance.targetRef),e,t),this._richCommandDetectionListeners.clear()}else e&&!e.hasRichCommandDetection?this._richCommandDetectionListeners.value=e.onSetRichCommandDetection(()=>{this._refreshState()}):this._richCommandDetectionListeners.clear()}_tryDisable(){this._shouldBeEnabled()||(this._overlay.clear(),this._richCommandDetectionListeners.clear())}_shouldBeEnabled(){let e=this._ctx.instance.capabilities.get(2);return!!(this._configurationService.getValue("terminal.integrated.stickyScroll.enabled")&&e&&e.hasRichCommandDetection&&this._xterm?.raw?.element)}};QV=I([m(1,B),m(2,X),m(3,F),m(4,Le)],QV);var q2e=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._terminalElement=e;this._instance=t;this._xterm=o;this._chatService=r;this._storageService=s;this._chatAgentService=c;this._chatWidgetService=u;this._onDidHide=this._register(new T);this.onDidHide=this._onDidHide.event;this._messages=this._store.add(new T);this._viewStateStorageKey="terminal-inline-chat-view-state";this._terminalAgentName="terminal";this._model=this._register(new ue);this._sessionDisposables=this._register(new ue);this._requestInProgress=De(this,!1);this.requestInProgress=this._requestInProgress;this._focusedContextKey=ol.focused.bindTo(n),this._visibleContextKey=ol.visible.bindTo(n),this._requestActiveContextKey=ol.requestActive.bindTo(n),this._responseContainsCodeBlockContextKey=ol.responseContainsCodeBlock.bindTo(n),this._responseContainsMulitpleCodeBlocksContextKey=ol.responseContainsMultipleCodeBlocks.bindTo(n),this._container=document.createElement("div"),this._container.classList.add("terminal-inline-chat"),this._terminalElement.appendChild(this._container),this._inlineChatWidget=l.createInstance(Tpt,{location:"terminal",resolveData:()=>{}},{statusMenuId:{menu:tW,options:{buttonConfigProvider:h=>({showLabel:h.id!=="workbench.action.terminal.chat.rerunRequest",showIcon:h.id==="workbench.action.terminal.chat.rerunRequest",isSecondary:h.id!=="workbench.action.terminal.chat.runCommand"&&h.id!=="workbench.action.terminal.chat.runFirstCommand"})}},secondaryMenuId:JU,chatWidgetViewOptions:{menus:{telemetrySource:"terminal-inline-chat",executeToolbar:R.ChatExecute,inputSideToolbar:Mco},defaultMode:Bc.Ask}}),this._register(this._inlineChatWidget.chatWidget.onDidChangeViewModel(()=>this._saveViewState())),this._register(U.any(this._inlineChatWidget.onDidChangeHeight,this._instance.onDimensionsChanged,this._inlineChatWidget.chatWidget.onDidChangeContentHeight,U.fromObservableLight(this._inlineChatWidget.chatWidget.input.selectedLanguageModel),U.debounce(this._xterm.raw.onCursorMove,()=>{},EL))(()=>this._relayout()));let p=new ResizeObserver(()=>this._relayout());p.observe(this._terminalElement),this._register(ee(()=>p.disconnect())),this._resetPlaceholder(),this._container.appendChild(this._inlineChatWidget.domNode),this._focusTracker=this._register(nr(this._container)),this._register(this._focusTracker.onDidFocus(()=>this._focusedContextKey.set(!0))),this._register(this._focusTracker.onDidBlur(()=>this._focusedContextKey.set(!1))),this._register(ve(h=>{let g=this._inlineChatWidget.requestInProgress.read(h);this._container.classList.toggle("busy",g),this._inlineChatWidget.toggleStatus(!!this._inlineChatWidget.responseContent),g||!this._inlineChatWidget.responseContent?(this._responseContainsCodeBlockContextKey.set(!1),this._responseContainsMulitpleCodeBlocksContextKey.set(!1)):Promise.all([this._inlineChatWidget.getCodeBlockInfo(0),this._inlineChatWidget.getCodeBlockInfo(1)]).then(([f,v])=>{this._responseContainsCodeBlockContextKey.set(!!f),this._responseContainsMulitpleCodeBlocksContextKey.set(!!v),this._inlineChatWidget.updateToolbar(!0)})})),this.hide()}get inlineChatWidget(){return this._inlineChatWidget}get lastResponseContent(){return this._lastResponseContent}_relayout(){this._dimension&&this._doLayout()}_doLayout(){let e=this._xterm.raw.element;if(!e)return;let t=zi().getComputedStyle(e),o=parseInt(t.paddingLeft),n=e.clientWidth-o-12;if(n===0)return;let s=(this._getTerminalViewportHeight()??0)*.75,l=Math.max(Math.min(480,this._inlineChatWidget.contentHeight,s),this._inlineChatWidget.minHeight);l!==0&&(this._dimension=new di(n,l),this._inlineChatWidget.layout(this._dimension),this._inlineChatWidget.domNode.style.paddingLeft=`${o}px`,this._updateXtermViewportPosition())}_resetPlaceholder(){let e=this._chatAgentService.getDefaultAgent("terminal");this.inlineChatWidget.placeholder=e?.description??d(16450,null)}async reveal(){await this._createSession(),this._doLayout(),this._container.classList.remove("hide"),this._visibleContextKey.set(!0),this._resetPlaceholder(),this._inlineChatWidget.focus(),this._instance.scrollToBottom()}_getTerminalCursorTop(){let e=this._instance.xterm?.getFont();if(!e?.charHeight)return;let t=this._getTerminalViewportHeight()??0,o=e.charHeight*e.lineHeight,n=t-this._instance.rows*o,r=(this._instance.xterm?.raw.buffer.active.cursorY??0)+1;return n+r*o}_updateXtermViewportPosition(){let e=this._getTerminalCursorTop();if(!e)return;this._container.style.top=`${e}px`;let t=this._getTerminalViewportHeight();if(!t)return;let o=t*.75,n=Math.max(Math.min(480,this._inlineChatWidget.contentHeight,o),this._inlineChatWidget.minHeight);e>t-n&&t-n>0?this._setTerminalViewportOffset(e-(t-n)):this._setTerminalViewportOffset(void 0)}_getTerminalViewportHeight(){return this._terminalElement.clientHeight}hide(){this._container.classList.add("hide"),this._inlineChatWidget.reset(),this._resetPlaceholder(),this._inlineChatWidget.updateToolbar(!1),this._visibleContextKey.set(!1),this._inlineChatWidget.value="",this._instance.focus(),this._setTerminalViewportOffset(void 0),this._onDidHide.fire()}_setTerminalViewportOffset(e){e===void 0||this._container.classList.contains("hide")?(this._terminalElement.style.position="",this._terminalElement.style.bottom="",QV.get(this._instance)?.hideUnlock()):(this._terminalElement.style.position="relative",this._terminalElement.style.bottom=`${e}px`,QV.get(this._instance)?.hideLock())}focus(){this.inlineChatWidget.focus()}hasFocus(){return this._inlineChatWidget.hasFocus()}setValue(e){this._inlineChatWidget.value=e??""}async acceptCommand(e){let t=await this.inlineChatWidget.getCodeBlockInfo(0);if(!t)return;let o=t.getValue();this._instance.runCommand(o,e),this.clear()}get focusTracker(){return this._focusTracker}async _createSession(){this._sessionCtor=Hn(async e=>{if(!this._model.value){let t=this._chatService.startNewLocalSession("terminal");this._model.value=t;let o=t.object;this._inlineChatWidget.setChatModel(o),this._resetPlaceholder()}}),this._sessionDisposables.value=ee(()=>this._sessionCtor?.cancel())}_saveViewState(){let e=this._inlineChatWidget.chatWidget.getViewState();e&&this._storageService.store(this._viewStateStorageKey,JSON.stringify(e),0,0)}clear(){this.cancel(),this._model.clear(),this._responseContainsCodeBlockContextKey.reset(),this._requestActiveContextKey.reset(),this.hide(),this.setValue(void 0)}async acceptInput(e,t){this._model.value||await this.reveal(),this._messages.fire(32);let o=this._inlineChatWidget.value;if(!o)return;this._activeRequestCts?.cancel(),this._activeRequestCts=new qe;let n=new O;this._requestActiveContextKey.set(!0);let r=await this._inlineChatWidget.chatWidget.acceptInput(o,{isVoiceInput:t?.isVoiceInput});this._currentRequestId=r?.requestId;let s=new Mo;try{return this._requestActiveContextKey.set(!0),r&&n.add(r.onDidChange(async()=>{if(r.isCanceled){this._requestActiveContextKey.set(!1),s.complete(void 0);return}if(r.isComplete){this._requestActiveContextKey.set(!1),this._requestActiveContextKey.set(!1);let l=await this._inlineChatWidget.getCodeBlockInfo(0),c=await this._inlineChatWidget.getCodeBlockInfo(1);this._responseContainsCodeBlockContextKey.set(!!l),this._responseContainsMulitpleCodeBlocksContextKey.set(!!c),this._inlineChatWidget.updateToolbar(!0),s.complete(r)}})),await s.p,this._lastResponseContent=r?.response.getMarkdown(),r}catch{this._lastResponseContent=void 0;return}finally{n.dispose()}}cancel(){this._sessionCtor?.cancel(),this._sessionCtor=void 0,this._activeRequestCts?.cancel(),this._requestActiveContextKey.set(!1);let e=this._inlineChatWidget.getChatModel();e?.sessionResource&&this._chatService.cancelCurrentRequestForSession(e?.sessionResource,"terminalChat")}async viewInChat(){let e=await this._chatWidgetService.revealWidget(),t=this._inlineChatWidget.chatWidget.viewModel?.model.getRequests().find(n=>n.id===this._currentRequestId);if(!e||!t?.response)return;let o=[];for(let n of t.response.response.value)if(n.kind==="textEditGroup")for(let r of n.edits)o.push({kind:"textEdit",edits:r,uri:n.uri});else if(n.kind==="notebookEditGroup")for(let r of n.edits)nMe(r)?o.push({kind:"textEdit",edits:r.map(s=>s.edit),uri:r[0].uri}):o.push({kind:"notebookEdit",edits:r,uri:n.uri});else o.push(n);this._chatService.addCompleteRequest(e.viewModel.sessionResource,`@${this._terminalAgentName} ${t.message.text}`,t.variableData,t.attempt,{message:o,result:t.response.result,followups:t.response.followups}),e.focusResponseItem(),this.hide()}};q2e=I([m(3,X),m(4,si),m(5,de),m(6,F),m(7,gr),m(8,Lt)],q2e);var Tpt=class extends Tve{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(e,t,o,n,r,s,l,c,u,p,h,g,f);this._modelService=v}get value(){return this.chatWidget.getInput()}set value(e){this.chatWidget.setInput(e)}selectAll(){this.chatWidget.inputEditor.setSelection(new ei(1,1,Number.MAX_SAFE_INTEGER,1))}set placeholder(e){this.chatWidget.setInputPlaceholder(e)}toggleStatus(e){this._elements.toolbar1.classList.toggle("hidden",!e),this._elements.toolbar2.classList.toggle("hidden",!e),this._elements.status.classList.toggle("hidden",!e),this._elements.infoLabel.classList.toggle("hidden",!e),this._onDidChangeHeight.fire()}updateToolbar(e){this._elements.root.classList.toggle("toolbar",e),this._elements.toolbar1.classList.toggle("hidden",!e),this._elements.toolbar2.classList.toggle("hidden",!e),this._elements.status.classList.toggle("actions",e),this._elements.infoLabel.classList.toggle("hidden",e),this._onDidChangeHeight.fire()}get responseContent(){return this.chatWidget.viewModel?.model.getRequests()?.at(-1)?.response?.response.toString()}getChatModel(){return this.chatWidget.viewModel?.model}setChatModel(e){e.inputModel.setState({inputText:"",selections:[]}),this.chatWidget.setModel(e)}async getCodeBlockInfo(e){let{viewModel:t}=this.chatWidget;if(!t)return;let n=t.getItems().filter(p=>Ni(p)).at(-1);if(!n)return;let s=this.chatWidget.getCodeBlockInfosForResponse(n)[e];if(s?.uri)return this._modelService.getModel(s.uri)??void 0;let l=n.response.getMarkdown(),c=0,u;for(let p of l.split(`
`))if(p.startsWith("```")&&u===void 0)u="";else if(p.startsWith("```")&&u!==void 0){if(c===e)break;c++,u=void 0}else u!==void 0&&(u+=(u?`
`:"")+p);if(u!==void 0&&c===e)return this._modelService.createModel(u,null,void 0,!0)}};Tpt=I([m(2,F),m(3,X),m(4,Le),m(5,Ai),m(6,B),m(7,Kd),m(8,Bt),m(9,si),m(10,ot),m(11,dr),m(12,_n),m(13,_t)],Tpt);var Km=class extends k{constructor(e,t,o,n,r,s){super();this._ctx=e;this._contextKeyService=n;this._instantiationService=r;this._terminalService=s;this._forcedPlaceholder=void 0;this._register(o.onDidChangeSentiment(()=>{o.sentiment.hidden&&this._terminalChatWidget?.value.clear()})),this._register(t.registerProvider({getCodeBlockContext:l=>{if(!(!l||!this._terminalChatWidget?.hasValue||!this.hasFocus()))return{element:l,code:l.getValue(),codeBlockIndex:0,languageId:l.getModel().getLanguageId(),chatSessionResource:this._terminalChatWidget.value.inlineChatWidget.chatWidget.viewModel?.sessionResource}}},"terminal"))}static{this.ID="terminal.chat"}static get(e){return e.getContribution(Km.ID)}get terminalChatWidget(){return this._terminalChatWidget?.value}get lastResponseContent(){return this._lastResponseContent}get scopedContextKeyService(){return this._terminalChatWidget?.value.inlineChatWidget.scopedContextKeyService??this._contextKeyService}xtermReady(e){this._terminalChatWidget=new uo(()=>{let t=this._register(this._instantiationService.createInstance(q2e,this._ctx.instance.domElement,this._ctx.instance,e));if(this._register(t.focusTracker.onDidFocus(()=>{Km.activeChatController=this,$M(this._ctx.instance)||this._terminalService.setActiveInstance(this._ctx.instance)})),this._register(t.focusTracker.onDidBlur(()=>{Km.activeChatController=void 0,this._ctx.instance.resetScrollbarVisibility()})),!this._ctx.instance.domElement)throw new Error("FindWidget expected terminal DOM to be initialized");return t})}_updatePlaceholder(){let e=this._terminalChatWidget?.value.inlineChatWidget;e&&(e.placeholder=this._getPlaceholderText())}_getPlaceholderText(){return this._forcedPlaceholder??""}setPlaceholder(e){this._forcedPlaceholder=e,this._updatePlaceholder()}resetPlaceholder(){this._forcedPlaceholder=void 0,this._updatePlaceholder()}updateInput(e,t=!0){let o=this._terminalChatWidget?.value.inlineChatWidget;o&&(o.value=e,t&&o.selectAll())}focus(){this._terminalChatWidget?.value.focus()}hasFocus(){return this._terminalChatWidget?.rawValue?.hasFocus()??!1}async viewInChat(){let e=this.terminalChatWidget?.inlineChatWidget.chatWidget.viewModel?.model;e&&await this._instantiationService.invokeFunction(wTn,e),this._terminalChatWidget?.rawValue?.hide()}};Km=I([m(1,TZ),m(2,dr),m(3,X),m(4,F),m(5,an)],Km);async function wTn(a,i){let e=a.get(si),o=await a.get(Lt).revealWidget();if(o&&o.viewModel&&i){for(let n of i.getRequests().slice())await e.adoptRequest(o.viewModel.model.sessionResource,n);o.focusResponseItem()}}var A7t=class{constructor(){this.priority=105;this.name="terminalInlineChat";this.type="view";this.when=ol.focused}getProvider(i){let e=i.get(an),t=i.get(Yt),o=[],n=Km.activeChatController?.scopedContextKeyService;if(n){let l=t.getMenuActions(tW,n);for(let c of l)for(let u of c[1])u instanceof Do&&o.push(u)}let r=e.activeInstance?.getContribution(Km.ID)??void 0;if(!r?.lastResponseContent)return;let s=r.lastResponseContent;return new qp("terminal-chat",{type:"view"},()=>s,()=>{r.focus()},"accessibility.verbosity.inlineChat",void 0,o)}};bh({id:"workbench.action.terminal.chat.start",title:P(16445,"Open Inline Chat"),category:P(16446,"Terminal"),keybinding:{primary:2087,when:C.and(pt.focusInAny),weight:401},f1:!0,precondition:C.and(Z.enabled,C.or(pt.processSupported,pt.terminalHasBeenCreated),ol.hasChatAgent),menu:{id:R.TerminalInstanceContext,group:"0_chat",order:2,when:Z.enabled},run:(a,i,e,t)=>{if($M(e))return;let o=Km.activeChatController||Km.get(e);if(o){if(t){let n=function(r){return typeof r=="object"&&r!==null&&"query"in r&&We(r.query)};t=We(t)?{query:t}:t,n(t)&&(o.updateInput(t.query,!1),t.isPartialQuery||o.terminalChatWidget?.acceptInput())}o.terminalChatWidget?.reveal()}}});bh({id:"workbench.action.terminal.chat.close",title:P(16434,"Close"),category:$E.category,keybinding:{primary:9,when:C.and(C.or(pt.focus,ol.focused),ol.visible),weight:200},menu:[{id:tW,group:"0_main",order:2}],icon:L.close,f1:!0,precondition:C.and(Z.enabled,ol.visible),run:(a,i,e)=>{if($M(e))return;(Km.activeChatController||Km.get(e))?.terminalChatWidget?.clear()}});bh({id:"workbench.action.terminal.chat.runCommand",title:P(16440,"Run Chat Command"),shortTitle:P(16439,"Run"),category:$E.category,precondition:C.and(Z.enabled,C.or(pt.processSupported,pt.terminalHasBeenCreated),ol.requestActive.negate(),ol.responseContainsCodeBlock,ol.responseContainsMultipleCodeBlocks.negate()),icon:L.play,keybinding:{when:ol.requestActive.negate(),weight:200,primary:2051},menu:{id:tW,group:"0_main",order:0,when:C.and(ol.responseContainsCodeBlock,ol.responseContainsMultipleCodeBlocks.negate(),ol.requestActive.negate())},run:(a,i,e)=>{if($M(e))return;(Km.activeChatController||Km.get(e))?.terminalChatWidget?.acceptCommand(!0)}});bh({id:"workbench.action.terminal.chat.runFirstCommand",title:P(16442,"Run First Chat Command"),shortTitle:P(16441,"Run First"),category:$E.category,precondition:C.and(Z.enabled,C.or(pt.processSupported,pt.terminalHasBeenCreated),ol.requestActive.negate(),ol.responseContainsMultipleCodeBlocks),icon:L.play,keybinding:{when:ol.requestActive.negate(),weight:200,primary:2051},menu:{id:tW,group:"0_main",order:0,when:C.and(ol.responseContainsMultipleCodeBlocks,ol.requestActive.negate())},run:(a,i,e)=>{if($M(e))return;(Km.activeChatController||Km.get(e))?.terminalChatWidget?.acceptCommand(!0)}});bh({id:"workbench.action.terminal.chat.insertCommand",title:P(16436,"Insert Chat Command"),shortTitle:P(16435,"Insert"),category:$E.category,icon:L.insert,precondition:C.and(Z.enabled,C.or(pt.processSupported,pt.terminalHasBeenCreated),ol.requestActive.negate(),ol.responseContainsCodeBlock,ol.responseContainsMultipleCodeBlocks.negate()),keybinding:{when:ol.requestActive.negate(),weight:200,primary:515,secondary:[2563]},menu:{id:tW,group:"0_main",order:1,when:C.and(ol.responseContainsCodeBlock,ol.responseContainsMultipleCodeBlocks.negate(),ol.requestActive.negate())},run:(a,i,e)=>{if($M(e))return;(Km.activeChatController||Km.get(e))?.terminalChatWidget?.acceptCommand(!1)}});bh({id:"workbench.action.terminal.chat.insertFirstCommand",title:P(16438,"Insert First Chat Command"),shortTitle:P(16437,"Insert First"),category:$E.category,precondition:C.and(Z.enabled,C.or(pt.processSupported,pt.terminalHasBeenCreated),ol.requestActive.negate(),ol.responseContainsMultipleCodeBlocks),keybinding:{when:ol.requestActive.negate(),weight:200,primary:515,secondary:[2563]},menu:{id:tW,group:"0_main",order:1,when:C.and(ol.responseContainsMultipleCodeBlocks,ol.requestActive.negate())},run:(a,i,e)=>{if($M(e))return;(Km.activeChatController||Km.get(e))?.terminalChatWidget?.acceptCommand(!1)}});bh({id:"workbench.action.terminal.chat.rerunRequest",title:P(16432,"Rerun Request"),f1:!1,icon:L.refresh,category:$E.category,precondition:C.and(Z.enabled,C.or(pt.processSupported,pt.terminalHasBeenCreated),ol.requestActive.negate()),keybinding:{weight:200,primary:2096,when:ol.focused},menu:{id:tW,group:"0_main",order:5,when:C.and(ol.inputHasText.toNegated(),ol.requestActive.negate())},run:async(a,i,e)=>{let t=i.get(si),o=i.get(Lt),r=Km.activeChatController?.terminalChatWidget?.inlineChatWidget.chatWidget.viewModel?.model;if(!r)return;let s=r.getRequests().at(-1);if(s){let l=o.getWidgetBySessionResource(r.sessionResource);await t.resendRequest(s,{noCommandDetection:!1,attempt:s.attempt+1,location:"terminal",userSelectedModelId:l?.input.currentLanguageModel})}}});bh({id:"workbench.action.terminal.chat.viewInChat",title:P(16449,"View in Chat"),category:$E.category,precondition:C.and(Z.enabled,C.or(pt.processSupported,pt.terminalHasBeenCreated),ol.requestActive.negate()),icon:L.chatSparkle,menu:[{id:tW,group:"zzz",order:1,isHiddenByDefault:!0,when:C.and(ol.responseContainsCodeBlock,ol.requestActive.negate())}],run:(a,i,e)=>{if($M(e))return;(Km.activeChatController||Km.get(e))?.viewInChat()}});W(class extends z{constructor(){super({id:"workbench.action.terminal.chat.viewHiddenChatTerminals",title:P(16448,"View Hidden Chat Terminals"),category:P(16447,"Terminal"),f1:!0,precondition:C.and(ol.hasHiddenChatTerminals,Z.enabled),menu:[{id:R.ViewTitle,when:C.and(ol.hasHiddenChatTerminals,C.equals("view",Xr)),group:"terminal",order:0,isHiddenByDefault:!0}]})}async run(i){let e=i.get(an),t=i.get(Cc),o=i.get(hb),n=i.get(tg),r=i.get($e),s=i.get(F),l=i.get(si),c=new Set([...t.instances,...o.instances]),u=n.getToolSessionTerminalInstances();if(u.length===0)return;let p=new Map;for(let y of u)c.has(y)||p.set(y.instanceId,y);if(p.size===0)return;if(p.size===1){let y=Array.from(p.values())[0];e.setActiveInstance(y),await e.revealTerminal(y),await e.focusInstance(y);return}let h=[],g=y=>P(16433,"Last: {0}",y).value,f=80,v=[];for(let y of p.values()){let x=`$(${s.invokeFunction(vee,y)}) ${y.title}`,E=y.capabilities.get(2)?.commands.at(-1)?.command,M=n.getChatSessionResourceForInstance(y),N;M&&(N=l.getSession(M)?.title??l.getSessionTitle(M));let V=N,H,K;if(E){let j=E.split(`
`),J=j[0],se=J.length>f?J.substring(0,f)+"\u2026":J;H=g(se);let ae=J.length>f,ce=j.length>1;(ae||ce)&&(ce?K={value:`\`\`\`
${E}
\`\`\``,supportThemeIcons:!0}:K=g(E))}v.push({label:x,description:V,detail:H,tooltip:K,id:String(y.instanceId)})}for(let y of v)h.push({label:y.label,description:y.description,detail:y.detail,tooltip:y.tooltip,id:y.id});let b=r.createQuickPick();b.placeholder=P(16443,"Select a chat terminal to show and focus").value,b.items=h,b.canSelectMany=!1,b.title=P(16444,"Chat Terminals").value,b.matchOnDescription=!0,b.matchOnDetail=!0;let S=new O;S.add(b),S.add(b.onDidAccept(async()=>{let y=b.selectedItems[0];if(y){let w=p.get(Number(y.id));w?(e.setActiveInstance(w),await e.revealTerminal(w),b.hide(),await e.focusInstance(w)):b.hide()}else b.hide()})),S.add(b.onDidHide(()=>{S.dispose(),b.dispose()})),b.show()}});xt.registerCommandAndKeybindingRule({id:"workbench.action.terminal.chat.focusMostRecentChatTerminal",weight:200,when:Z.inChatSession,handler:async a=>{let e=a.get(tg).getMostRecentProgressPart();e&&await e.focusTerminal()}});xt.registerCommandAndKeybindingRule({id:"workbench.action.terminal.chat.focusMostRecentChatTerminalOutput",weight:200,when:Z.inChatSession,primary:3629,handler:async a=>{let e=a.get(tg).getMostRecentProgressPart();e&&await e.toggleOutputFromKeyboard()}});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.terminal.chat.focusMostRecentChatTerminal",title:d(16430,null)},when:Z.inChatSession});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.terminal.chat.focusMostRecentChatTerminalOutput",title:d(16431,null)},when:Z.inChatSession});Ge.registerCommand("workbench.action.terminal.chat.openTerminalSettingsLink",async(a,i)=>{let e=a.get(Qo);if(i==="global")e.openSettings({query:"@id:chat.tools.global.autoApprove"});else{let t=parseInt(i),o=isNaN(t)?void 0:t,n={jsonEditor:!0,revealSetting:{key:"chat.tools.terminal.autoApprove"}};switch(o){case 1:e.openApplicationSettings(n);break;case 2:case 3:e.openUserSettings(n);break;case 4:e.openRemoteSettings(n);break;case 5:case 6:e.openWorkspaceSettings(n);break;default:{e.openSettings({target:2,query:"@id:chat.tools.terminal.autoApprove"});break}}}});Ge.registerCommand("workbench.action.terminal.chat.disableSessionAutoApproval",async(a,i)=>{a.get(tg).setChatSessionAutoApproval(i,!1)});var N7t=class{constructor(){this.priority=110;this.name="terminalChat";this.when=ol.focused;this.type="help"}getProvider(i){let t=i.get(an).activeInstance;if(!t)return;let o=CTn(i);return new qp("terminal-chat",{type:"help"},()=>o,()=>Km.get(t)?.terminalChatWidget?.focus(),"accessibility.verbosity.terminalChat")}};function CTn(a){let i=a.get(Le),e=[],t=i.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel(),o=i.lookupKeybinding("workbench.action.terminal.chat.runCommand")?.getAriaLabel(),n=i.lookupKeybinding("workbench.action.terminal.chat.insertCommand")?.getAriaLabel(),r=i.lookupKeybinding("workbench.action.terminal.chat.makeRequest")?.getAriaLabel(),s=i.lookupKeybinding("workbench.action.terminal.chat.start")?.getAriaLabel(),l=i.lookupKeybinding("chat.action.focus")?.getAriaLabel(),c=i.lookupKeybinding("workbench.action.chat.focusInput")?.getAriaLabel();return e.push(d(16426,null)),e.push(d(16415,null,s)),e.push(r?d(16420,null,r):d(16421,null)),e.push(t?d(16424,null,t):d(16425,null)),e.push(l?d(16418,null,l):d(16419,null)),e.push(c?d(16416,null,c):d(16417,null)),e.push(o?d(16427,null,o):d(16428,null)),e.push(n?d(16422,null,n):d(16423,null)),e.push(d(16429,null)),e.push(d(16414,null)),e.join(`
`)}var mIe=class{constructor(i,e){this._store=new O;this._ctxHasProvider=ol.hasChatAgent.bindTo(e),this._store.add(U.runAndSubscribe(i.onDidChangeAgents,()=>{let t=!!i.getDefaultAgent("terminal");this._ctxHasProvider.set(t)}))}static{this.Id="terminalChat.enabler"}dispose(){this._ctxHasProvider.reset(),this._store.dispose()}};mIe=I([m(0,gr),m(1,X)],mIe);var $2e=class extends k{constructor(e,t,o,n,r){super();this._logService=e;this._terminalService=t;this._storageService=o;this._contextKeyService=n;this._chatService=r;this._terminalInstancesByToolSessionId=new Map;this._toolSessionIdByTerminalInstance=new Map;this._chatSessionResourceByTerminalInstance=new Map;this._terminalInstanceListenersByToolSessionId=this._register(new Ot);this._chatSessionListenersByTerminalInstance=this._register(new Ot);this._ahpCommandSources=new Map;this._onDidContinueInBackground=this._register(new T);this.onDidContinueInBackground=this._onDidContinueInBackground.event;this._onDidRegisterTerminalInstanceForToolSession=this._register(new T);this.onDidRegisterTerminalInstanceWithToolSession=this._onDidRegisterTerminalInstanceForToolSession.event;this._activeProgressParts=new Set;this._pendingRestoredMappings=new Map;this._sessionAutoApprovalEnabled=new dt;this._sessionAutoApproveRules=new dt;this._hasToolTerminalContext=ol.hasChatTerminals.bindTo(this._contextKeyService),this._hasHiddenToolTerminalContext=ol.hasHiddenChatTerminals.bindTo(this._contextKeyService),this._restoreFromStorage(),this._register(this._chatService.onDidDisposeSession(s=>{for(let l of s.sessionResources)this._sessionAutoApproveRules.delete(l),this._sessionAutoApprovalEnabled.delete(l)})),this._register(this._terminalService.onDidChangeInstances(()=>this._updateHasToolTerminalContextKeys()))}registerTerminalInstanceWithToolSession(e,t){if(!e){this._logService.warn("Attempted to register a terminal instance with an undefined tool session ID");return}let o=this._toolSessionIdByTerminalInstance.get(t);if(o===e)return;o!==void 0&&(this._terminalInstanceListenersByToolSessionId.deleteAndDispose(o),this._terminalInstancesByToolSessionId.delete(o)),this._terminalInstancesByToolSessionId.set(e,t),this._toolSessionIdByTerminalInstance.set(t,e),this._onDidRegisterTerminalInstanceForToolSession.fire(t);let n=new O;n.add(t.onDisposed(()=>{this._terminalInstancesByToolSessionId.delete(e),this._toolSessionIdByTerminalInstance.delete(t),this._terminalInstanceListenersByToolSessionId.deleteAndDispose(e),this._persistToStorage(),this._updateHasToolTerminalContextKeys()})),n.add(this._chatService.onDidDisposeSession(r=>{for(let s of r.sessionResources)Br.parseLocalSessionId(s)===e&&(this._terminalInstancesByToolSessionId.delete(e),this._toolSessionIdByTerminalInstance.delete(t),this._terminalInstanceListenersByToolSessionId.deleteAndDispose(e),this._sessionAutoApprovalEnabled.delete(s),this._persistToStorage(),this._updateHasToolTerminalContextKeys())})),this._terminalInstanceListenersByToolSessionId.set(e,n),(on(t.shellLaunchConfig?.attachPersistentProcess?.id)||on(t.persistentProcessId))&&this._persistToStorage(),this._updateHasToolTerminalContextKeys()}async getTerminalInstanceByToolSessionId(e){if(await this._terminalService.whenConnected,!!e){if(this._pendingRestoredMappings.has(e)){let t=this._terminalService.instances.find(o=>o.shellLaunchConfig.attachPersistentProcess?.id===this._pendingRestoredMappings.get(e));if(t)return this._tryAdoptRestoredMapping(t),t}return this._terminalInstancesByToolSessionId.get(e)}}getToolSessionTerminalInstances(e){if(e){let t=new Set(this._terminalService.foregroundInstances.map(n=>n.instanceId)),o=new Set(this._terminalInstancesByToolSessionId.values());return Array.from(o).filter(n=>!t.has(n.instanceId))}return Array.from(new Set(this._terminalInstancesByToolSessionId.values()))}getToolSessionIdForInstance(e){return this._toolSessionIdByTerminalInstance.get(e)}registerTerminalInstanceWithChatSession(e,t){let o=this._chatSessionResourceByTerminalInstance.get(t);if(o&&o.toString()===e.toString())return;this._chatSessionListenersByTerminalInstance.deleteAndDispose(t),this._chatSessionResourceByTerminalInstance.set(t,e);let n=t.onDisposed(()=>{this._chatSessionResourceByTerminalInstance.delete(t),this._chatSessionListenersByTerminalInstance.deleteAndDispose(t)});this._chatSessionListenersByTerminalInstance.set(t,n)}getChatSessionResourceForInstance(e){return this._chatSessionResourceByTerminalInstance.get(e)}isBackgroundTerminal(e){if(!e)return!1;let t=this._terminalInstancesByToolSessionId.get(e);return t?this._terminalService.instances.includes(t)&&!this._terminalService.foregroundInstances.includes(t):!1}registerProgressPart(e){return this._activeProgressParts.add(e),this._isAfter(e,this._mostRecentProgressPart)&&(this._mostRecentProgressPart=e),ee(()=>{this._activeProgressParts.delete(e),this._focusedProgressPart===e&&(this._focusedProgressPart=void 0),this._mostRecentProgressPart===e&&(this._mostRecentProgressPart=this._getLastActiveProgressPart())})}setFocusedProgressPart(e){this._focusedProgressPart=e}clearFocusedProgressPart(e){this._focusedProgressPart===e&&(this._focusedProgressPart=void 0)}getFocusedProgressPart(){return this._focusedProgressPart}getMostRecentProgressPart(){return(!this._mostRecentProgressPart||!this._activeProgressParts.has(this._mostRecentProgressPart))&&(this._mostRecentProgressPart=this._getLastActiveProgressPart()),this._mostRecentProgressPart}_getLastActiveProgressPart(){let e;for(let t of this._activeProgressParts)this._isAfter(t,e)&&(e=t);return e}_isAfter(e,t){return t?e.elementIndex===t.elementIndex?e.contentIndex>=t.contentIndex:e.elementIndex>t.elementIndex:!0}_restoreFromStorage(){try{let e=this._storageService.get("terminalChat.toolSessionMappings",1);if(!e)return;let t=JSON.parse(e);for(let[o,n]of t)We(o)&&on(n)&&this._pendingRestoredMappings.set(o,n)}catch(e){this._logService.warn("Failed to restore terminal chat tool session mappings",e)}}_tryAdoptRestoredMapping(e){if(this._pendingRestoredMappings.size!==0){for(let[t,o]of this._pendingRestoredMappings)if(o===e.shellLaunchConfig.attachPersistentProcess?.id){this._terminalInstancesByToolSessionId.set(t,e),this._toolSessionIdByTerminalInstance.set(e,t),this._onDidRegisterTerminalInstanceForToolSession.fire(e),this._terminalInstanceListenersByToolSessionId.set(t,e.onDisposed(()=>{this._terminalInstancesByToolSessionId.delete(t),this._toolSessionIdByTerminalInstance.delete(e),this._terminalInstanceListenersByToolSessionId.deleteAndDispose(t),this._persistToStorage()})),this._pendingRestoredMappings.delete(t),this._persistToStorage();break}}}_persistToStorage(){this._updateHasToolTerminalContextKeys();try{let e=[];for(let[t,o]of this._terminalInstancesByToolSessionId.entries()){let n=on(o.persistentProcessId)?o.persistentProcessId:o.shellLaunchConfig.attachPersistentProcess?.id,r=o.shouldPersist||o.shellLaunchConfig.forcePersist;on(n)&&r&&e.push([t,n])}e.length>0?this._storageService.store("terminalChat.toolSessionMappings",JSON.stringify(e),1,1):this._storageService.remove("terminalChat.toolSessionMappings",1)}catch(e){this._logService.warn("Failed to persist terminal chat tool session mappings",e)}}_updateHasToolTerminalContextKeys(){let e=this._terminalInstancesByToolSessionId.size;this._hasToolTerminalContext.set(e>0);let t=this.getToolSessionTerminalInstances(!0).length;this._hasHiddenToolTerminalContext.set(t>0)}setChatSessionAutoApproval(e,t){t?this._sessionAutoApprovalEnabled.set(e,!0):this._sessionAutoApprovalEnabled.delete(e)}hasChatSessionAutoApproval(e){return this._sessionAutoApprovalEnabled.has(e)}addSessionAutoApproveRule(e,t,o){let n=this._sessionAutoApproveRules.get(e);n||(n={},this._sessionAutoApproveRules.set(e,n)),n[t]=o}getSessionAutoApproveRules(e){return this._sessionAutoApproveRules.get(e)??{}}continueInBackground(e){this._onDidContinueInBackground.fire(e)}registerAhpCommandSource(e,t){return this._ahpCommandSources.set(e,t),ee(()=>{this._ahpCommandSources.get(e)===t&&this._ahpCommandSources.delete(e)})}getAhpCommandSource(e){return this._ahpCommandSources.get(e)}};$2e=I([m(0,re),m(1,an),m(2,de),m(3,X),m(4,si)],$2e);tm(Km.ID,Km,!1);_a.register(new A7t);_a.register(new N7t);bt(mIe.Id,mIe,vt.AfterRestored);Ce(tg,$2e,1);var eae=class extends k{constructor(e,t){super();this._ctx=e;this._configurationService=t;this._activeCommandGuide=this._register(new ue)}static{this.ID="terminal.commandGuide"}static get(e){return e.getContribution(eae.ID)}xtermOpen(e){this._xterm=e,this._refreshActivatedState(),this._register(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration("terminal.integrated.shellIntegration.showCommandGuide")&&this._refreshActivatedState()}))}_refreshActivatedState(){let e=this._xterm;if(!e)return;let t=this._configurationService.getValue(Vco).showCommandGuide;if(!!this._activeCommandGuide.value!==t)if(!t)this._activeCommandGuide.clear();else{let o=e.raw.element.querySelector(".xterm-screen"),n=e.raw.element.querySelector(".xterm-viewport");this._activeCommandGuide.value=Fn($(o,"mousemove",r=>this._tryShowHighlight(o,e,r)),$(n,"mousemove",r=>this._tryShowHighlight(o,e,r)),$(e.raw.element,"mouseleave",()=>e.markTracker.showCommandGuide(void 0)),e.raw.onData(()=>e.markTracker.showCommandGuide(void 0)),ee(()=>e.markTracker.showCommandGuide(void 0)))}}_tryShowHighlight(e,t,o){let n=e.getBoundingClientRect();if(!n)return;let r=Math.floor((o.clientY-n.top)/(n.height/t.raw.rows)),s=this._ctx.instance.capabilities.get(2)?.getCommandForLine(t.raw.buffer.active.viewportY+r);s&&XC(s)?t.markTracker.showCommandGuide(s):t.markTracker.showCommandGuide(void 0)}};eae=I([m(1,B)],eae);tm(eae.ID,eae,!1);var $Nb=te("terminalCommandGuide.foreground",{dark:ni(bv,1),light:ni(bv,1),hcDark:ob,hcLight:ob},d(16679,null));var h2i;function _pt(a){return h2i||(h2i=a.get(F).createInstance(j2e,"dirs")),h2i}var g2i;function Q2e(a){return g2i||(g2i=a.get(F).createInstance(j2e,"commands")),g2i}var j2e=class extends k{constructor(e,t,o){super();this._storageDataKey=e;this._configurationService=t;this._storageService=o;this._timestamp=0;this._isReady=!1;this._isStale=!0;this._entries=new Ua(this._getHistoryLimit()),this._register(this._configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("terminal.integrated.shellIntegration.history")&&(this._entries.limit=this._getHistoryLimit())})),this._register(this._storageService.onDidChangeValue(-1,this._getTimestampStorageKey(),this._store)(()=>{this._isStale||(this._isStale=this._storageService.getNumber(this._getTimestampStorageKey(),-1,0)!==this._timestamp)}))}get entries(){return this._ensureUpToDate(),this._entries.entries()}add(e,t){this._ensureUpToDate(),this._entries.set(e,t),this._saveState()}remove(e){this._ensureUpToDate(),this._entries.delete(e),this._saveState()}clear(){this._ensureUpToDate(),this._entries.clear(),this._saveState()}_ensureUpToDate(){this._isReady||(this._loadState(),this._isReady=!0),this._isStale&&(this._entries.clear(),this._loadState(),this._isStale=!1)}_loadState(){this._timestamp=this._storageService.getNumber(this._getTimestampStorageKey(),-1,0);let e=this._loadPersistedState();if(e)for(let t of e.entries)this._entries.set(t.key,t.value)}_loadPersistedState(){let e=this._storageService.get(this._getEntriesStorageKey(),-1);if(e===void 0||e.length===0)return;let t;try{t=JSON.parse(e)}catch{return}return t}_saveState(){let e={entries:[]};this._entries.forEach((t,o)=>e.entries.push({key:o,value:t})),this._storageService.store(this._getEntriesStorageKey(),JSON.stringify(e),-1,1),this._timestamp=Date.now(),this._storageService.store(this._getTimestampStorageKey(),this._timestamp,-1,1)}_getHistoryLimit(){let e=this._configurationService.getValue("terminal.integrated.shellIntegration.history");return on(e)?e:100}_getTimestampStorageKey(){return`terminal.history.timestamp.${this._storageDataKey}`}_getEntriesStorageKey(){return`terminal.history.entries.${this._storageDataKey}`}};j2e=I([m(1,B),m(2,de)],j2e);var O7t=new Map;async function _Fo(a,i){let e=O7t.get(i);if(e===null)return;if(e!==void 0)return e;let t;switch(i){case"bash":t=await xTn(a);break;case"pwsh":t=await TTn(a);break;case"zsh":t=await kTn(a);break;case"fish":t=await _Tn(a);break;case"python":t=await ETn(a);break;default:return}if(t===void 0){O7t.set(i,null);return}return O7t.set(i,t),t}function DFo(){O7t.clear()}async function xTn(a){let i=a.get(ge),e=a.get(bo),t=await e.getEnvironment();if(t?.os===1||!t&&ii)return;let o="~/.bash_history",n=t?.userHome?.fsPath??Sp.HOME,r=await Dpt(n,".bash_history",!1,i,e);if(r===void 0)return;let s=r.content.split(`
`),l=new Set,c,u,p;for(let h=0;h<s.length;h++){c=s[h],u===void 0?u=c:u+=`
${c}`;for(let g=0;g<c.length;g++)p?c[g]===p&&(p=void 0):c[g].match(/['"]/)&&(p=c[g]);p===void 0&&(u.length>0&&l.add(u.trim()),u=void 0)}return{sourceLabel:o,sourceResource:r.resource,commands:Array.from(l.values())}}async function kTn(a){let i=a.get(ge),e=a.get(bo),t=await e.getEnvironment();if(t?.os===1||!t&&ii)return;let o="~/.zsh_history",n=t?.userHome?.fsPath??Sp.HOME,r=await Dpt(n,".zsh_history",!1,i,e);if(r===void 0)return;let s=/^:\s\d+:\d+;/.test(r.content),l=r.content.split(s?/\:\s\d+\:\d+;/:/(?<!\\)\n/),c=new Set;for(let u=0;u<l.length;u++){let p=l[u].replace(/\\\n/g,`
`).trim();p.length>0&&c.add(p)}return{sourceLabel:o,sourceResource:r.resource,commands:Array.from(c.values())}}async function ETn(a){let i=a.get(ge),e=a.get(bo),t=await e.getEnvironment(),o="~/.python_history",n=t?.userHome?.fsPath??Sp.HOME,r=await Dpt(n,".python_history",!1,i,e);if(r===void 0)return;let s=r.content.split(`
`),l=new Set;return s.forEach(c=>{c.trim().length>0&&l.add(c.trim())}),{sourceLabel:o,sourceResource:r.resource,commands:Array.from(l.values())}}async function TTn(a){let i=a.get(ge),e=a.get(bo),t,o,n=await e.getEnvironment(),r=n?.os===1||!n&&ii,s;r?(t=Sp.APPDATA,o="Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt",s="$APPDATA\\Microsoft\\Windows\\PowerShell\\PSReadLine\\ConsoleHost_history.txt"):(t=n?.userHome?.fsPath??Sp.HOME,o=".local/share/powershell/PSReadline/ConsoleHost_history.txt",s=`~/${o}`);let l=await Dpt(t,o,r,i,e);if(l===void 0)return;let c=l.content.split(`
`),u=new Set,p,h,g;for(let f=0;f<c.length;f++){if(p=c[f],h===void 0?h=p:h+=`
${p}`,!p.endsWith("`")){let v=h.trim();v.length>0&&u.add(v),h=void 0;continue}for(let v=0;v<p.length;v++)g?p[v]===g&&(g=void 0):p[v].match(/`/)&&(g=p[v]);if(g)h=h.replace(/`$/,""),g=void 0;else{let v=h.trim();v.length>0&&u.add(v),h=void 0}}return{sourceLabel:s,sourceResource:l.resource,commands:Array.from(u.values())}}async function _Tn(a){let i=a.get(ge),e=a.get(bo),t=await e.getEnvironment();if(t?.os===1||!t&&ii)return;let o=Sp.XDG_DATA_HOME,n,r,s;o?(s="$XDG_DATA_HOME/fish/fish_history",n=Sp.XDG_DATA_HOME,r="fish/fish_history"):(s="~/.local/share/fish/fish_history",n=t?.userHome?.fsPath??Sp.HOME,r=".local/share/fish/fish_history");let l=await Dpt(n,r,!1,i,e);if(l===void 0)return;let c=new Set,u=l.content.split(`
`).filter(p=>p.startsWith("- cmd:")).map(p=>p.substring(6).trimStart());for(let p=0;p<u.length;p++){let h=DTn(u[p]).trim();h.length>0&&c.add(h)}return{sourceLabel:s,sourceResource:l.resource,commands:Array.from(c.values())}}function DTn(a){return RTn(/(^|[^\\])((?:\\\\)*)(\\n)/g,a,`$1$2
`)}function RTn(a,i,e){let t,o=i;for(;;)if(t=o,o=o.replace(a,e),o===t)return o}async function Dpt(a,i,e,t,o){if(!a)return;let n=o.getConnection(),r=!!n?.remoteAuthority,s=A.from({scheme:r?Q.vscodeRemote:Q.file,authority:r?n.remoteAuthority:void 0,path:A.file(td(a,i)).path}),l;try{l=await t.readFile(s)}catch(c){if(c instanceof ua&&c.fileOperationResult===1)return;throw c}if(l!==void 0)return{resource:s,content:l.value.toString()}}var MFo=q.asClassName(L.pin),f2i=q.asClassName(L.pinned),PFo=[MFo,f2i];function F7t(a,i,e,t){let o=e.items,n=RFo(i,e,a,void 0,t),r=new O;return r.add(e.onDidTriggerItemButton(async s=>{s.button.iconClass&&PFo.includes(s.button.iconClass)&&(e.items=o,n=RFo(i,e,a,s.item,t),e.items=e.value?o:n)})),r.add(e.onDidChangeValue(async s=>{e.items===n&&s?e.items=o:e.items===o&&!s&&(e.items=n)})),e.items=e.value?o:n,e.show(),r}function RFo(a,i,e,t,o){let n=[],r;t?r=MTn(a,t,e):r=AFo(a,e),r.length&&n.push({type:"separator",label:d(2519,null)});let s=new Set;for(let l of r){let c=i.items.find(u=>LTn(u,l));if(c){let u=Rpt(c),p={...c};(!o||!s.has(u))&&(s.add(u),LFo(p,!1),n.push(p))}}for(let l of i.items)LFo(l,!0),n.push(l);return n}function Rpt(a){return a.type==="separator"?"":a.id||`${a.label}${a.description}${a.detail}`}function LFo(a,i){if(a.type==="separator")return;let e=a.buttons?.filter(t=>t.iconClass&&!PFo.includes(t.iconClass))??[];e.unshift({iconClass:i?MFo:f2i,tooltip:i?d(2517,null):d(2518,null),alwaysVisible:!1}),a.buttons=e}function LTn(a,i){return Rpt(a)===Rpt(i)}function MTn(a,i,e){let t=i.buttons?.find(n=>n.iconClass===f2i),o=AFo(a,e);return t?o=o.filter(n=>Rpt(n)!==Rpt(i)):o.push(i),e.store(a,JSON.stringify(o.map(PTn)),1,1),o}function AFo(a,i){let e=i.get(a,1);return e?JSON.parse(e):[]}function PTn(a){return{label:a.label,description:a.description,detail:a.detail}}async function Lpt(a,i,e,t,o,n){if(!i.xterm)return;let r=a.get(Kd),s=a.get(ie),l=a.get(F),c=a.get($e),u=a.get(de),p=a.get(Pn),h=`terminal.pinnedRecentCommands.${i.shellType}`,g,f=[],v=new Set,b={iconClass:q.asClassName(EEo),tooltip:d(16734,null)},S={iconClass:q.asClassName(TEo),tooltip:d(16740,null),alwaysVisible:!1},y=[];if(t==="command"){let se=function(Re){return Re.replace(/\r?\n/g,"\u23CE").replace(/\s\s\s+/g,"\u22EF")};g=et?d(16736,null):d(16735,null);let K=i.capabilities.get(2),j=K?.commands,J=K?.executingCommand;if(J&&v.add(J),j&&j.length>0)for(let Re=j.length-1;Re>=0;Re--){let xe=j[Re],He=xe.command.trim();if(He.length===0||v.has(He))continue;let Ee=dko(xe.cwd,i.userHome,i.os===1?"\\":"/");xe.exitCode&&(xe.exitCode===-1?Ee+=" failed":Ee+=` exitCode: ${xe.exitCode}`),Ee=Ee.trim();let Te=[S],It=f.length>0?f[f.length-1]:void 0;if(It?.type!=="separator"&&It?.label===He){It.id=xe.timestamp.toString(),It.description=Ee;continue}f.push({label:se(He),rawLabel:He,description:Ee,id:xe.timestamp.toString(),command:xe,buttons:xe.hasOutput()?Te:void 0}),v.add(He)}J&&f.unshift({label:se(J),rawLabel:J,description:K.cwd}),f.length>0&&f.unshift({type:"separator",buttons:[],label:vr.currentSessionCategory});let ae=l.invokeFunction(Q2e),ce=[];for(let[Re,xe]of ae.entries)!v.has(Re)&&xe.shellType===i.shellType&&(ce.unshift({label:se(Re),rawLabel:Re,buttons:[b]}),v.add(Re));ce.length>0&&f.push({type:"separator",buttons:[],label:vr.previousSessionCategory},...ce);let Se=await l.invokeFunction(_Fo,i.shellType);if(Se!==void 0){let Re=[];for(let xe of Se.commands)v.has(xe)||Re.unshift({label:se(xe),rawLabel:xe});if(Re.length>0){let xe={iconClass:q.asClassName(DEo),tooltip:d(16733,null),alwaysVisible:!1,resource:Se.sourceResource};y.push(xe),f.push({type:"separator",buttons:[xe],label:d(16739,null,i.shellType),description:Se.sourceLabel},...Re)}}}else{g=et?d(16738,null):d(16737,null);let K=i.os===1?Tk:Jn,j=new xn(ce=>K.getComparisonKey(ce)),J=i.capabilities.get(0)?.cwds||[];if(J&&J.length>0){for(let ce of J){let Se=A.file(ce);j.has(Se)||(j.add(Se),f.push({label:await i.getUriLabelForShell(Se),rawLabel:ce}))}f=f.reverse(),f.unshift({type:"separator",label:vr.currentSessionCategory})}let se=l.invokeFunction(_pt),ae=[];for(let[ce,Se]of se.entries)if(Se===null||Se.remoteAuthority===i.remoteAuthority){let Re=Se?.remoteAuthority?await p.fileURI(ce):A.file(ce);j.has(Re)||(j.add(Re),ae.unshift({label:await i.getUriLabelForShell(Re),rawLabel:ce,buttons:[b]}))}ae.length>0&&f.push({type:"separator",label:vr.previousSessionCategory},...ae)}if(f.length===0)return;let w=new O,x={iconClass:q.asClassName(_Eo),tooltip:d(16732,null),toggle:{checked:o==="fuzzy"},location:3},E=w.add(l.createInstance(tae)),M=w.add(c.createQuickPick({useSeparators:!0})),N=f;M.items=[...N],M.sortByLabel=!1,M.placeholder=g,M.matchOnLabelMode=o||"contiguous",M.buttons=[x],w.add(M.onDidTriggerButton(K=>{K===x&&l.invokeFunction(Lpt,i,e,t,x.toggle.checked?"fuzzy":"contiguous",M.value)})),w.add(M.onDidTriggerItemButton(async K=>{if(K.button===b)t==="command"?l.invokeFunction(Q2e)?.remove(K.item.label):l.invokeFunction(_pt)?.remove(K.item.rawLabel);else if(K.button===S){let j=K.item.command,J=j?.getOutput();if(J&&j?.command){let se=await E.provideTextContent(A.from({scheme:tae.scheme,path:`${j.command}... ${ea(j.timestamp,!0)}`,fragment:J,query:`terminal-output-${j.timestamp}-${i.instanceId}`}));se&&await s.openEditor({resource:se.uri})}}await l.invokeFunction(Lpt,i,e,t,o,n)})),w.add(M.onDidTriggerSeparatorButton(async K=>{let j=y.find(J=>K.button===J)?.resource;j&&await s.openEditor({resource:j})})),w.add(M.onDidChangeValue(async K=>{K||await l.invokeFunction(Lpt,i,e,t,o,K)}));let V=!1;function H(){V=!1,i.xterm?.markTracker.restoreScrollState(),i.xterm?.markTracker.clear()}return w.add(M.onDidChangeActive(async()=>{let K=i.xterm;if(!K)return;let[j]=M.activeItems;if(!j)return;function J(se){return Di(se)&&"rawLabel"in se}if(J(j)&&j.command&&j.command.marker){V||(K.markTracker.saveScrollState(),V=!0);let se=j.command.getPromptRowCount(),ae=j.command.getCommandRowCount();K.markTracker.revealRange({start:{x:1,y:j.command.marker.line-(se-1)+1},end:{x:i.cols,y:j.command.marker.line+(ae-1)+1}})}else H()})),w.add(M.onDidAccept(async()=>{let K=M.activeItems[0],j;t==="cwd"?j=`cd ${await i.preparePathForShell(K.rawLabel)}`:j=K.rawLabel,M.hide(),V=!1,i.xterm?.markTracker.clear(),i.scrollToBottom(),i.runCommand(j,!M.keyMods.alt),M.keyMods.alt&&i.focus()})),w.add(M.onDidHide(()=>H())),n&&(M.value=n),new Promise(K=>{e.set(!0),w.add(F7t(u,h,M,!0)),w.add(M.onDidHide(()=>{e.set(!1),r.showLastProvider("terminal"),K(),w.dispose()}))})}var tae=class extends k{constructor(e,t){super();this._modelService=t;this._register(e.registerTextModelContentProvider(tae.scheme,this))}static{this.scheme="TERMINAL_OUTPUT"}async provideTextContent(e){let t=this._modelService.getModel(e);return t&&!t.isDisposed()?t:this._modelService.createModel(e.fragment,null,e,!1)}};tae=I([m(0,Bt),m(1,_t)],tae);var nj=class extends k{constructor(e,t,o){super();this._ctx=e;this._instantiationService=o;this._terminalInRunCommandPicker=pt.inTerminalRunCommandPicker.bindTo(t);let n=this._register(new Ot);this._register(e.instance.capabilities.onDidAddCapability(r=>{switch(n.deleteAndDispose(r.id),r.id){case 0:{let s=new O;s.add(r.capability.onDidChangeCwd(l=>{this._instantiationService.invokeFunction(_pt)?.add(l,{remoteAuthority:e.instance.remoteAuthority})})),n.set(r.id,s);break}case 2:{let s=new O;s.add(r.capability.onCommandFinished(l=>{l.command.trim().length>0&&this._instantiationService.invokeFunction(Q2e)?.add(l.command,{shellType:e.instance.shellType})})),n.set(r.id,s);break}}})),this._register(e.instance.capabilities.onDidRemoveCapability(r=>{n.deleteAndDispose(r.id)}))}static{this.ID="terminal.history"}static get(e){return e.getContribution(nj.ID)}async runRecent(e,t,o){return this._instantiationService.invokeFunction(Lpt,this._ctx.instance,this._terminalInRunCommandPicker,e,t,o)}};nj=I([m(1,X),m(2,F)],nj);tm(nj.ID,nj);var v2i=C.or(pt.processSupported,pt.terminalHasBeenCreated);Wr({id:"workbench.action.terminal.clearPreviousSessionHistory",title:P(16729,"Clear Previous Session History"),precondition:v2i,run:async(a,i)=>{Q2e(i).clear(),DFo()}});pc({id:"workbench.action.terminal.goToRecentDirectory",title:P(16730,"Go to Recent Directory..."),metadata:{description:P(16728,"Goes to a recent folder")},precondition:v2i,keybinding:{primary:2085,when:pt.focus,weight:200},menu:[{id:R.ViewTitle,group:"shellIntegration",order:0,when:C.equals("view",Fc),isHiddenByDefault:!0},...[R.EditorTitle,R.CompactWindowEditorTitle].map(a=>({id:a,group:"1_shellIntegration",order:0,when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}))],run:async(a,i)=>{let e=nj.get(a);e&&(await e.runRecent("cwd"),a?.target===2?await i.editorService.revealActiveEditor():await i.groupService.showPanel(!1))}});Wr({id:"workbench.action.terminal.runRecentCommand",title:P(16731,"Run Recent Command..."),precondition:v2i,keybinding:[{primary:2096,when:C.and(Oa,C.or(pt.focus,C.and(Jd,Fu.isEqualTo("terminal")))),weight:200},{primary:2608,mac:{primary:816},when:C.and(pt.focus,Oa.negate()),weight:200}],menu:[{id:R.ViewTitle,group:"shellIntegration",order:1,when:C.equals("view",Fc),isHiddenByDefault:!0},...[R.EditorTitle,R.CompactWindowEditorTitle].map(a=>({id:a,group:"1_shellIntegration",order:1,when:Ho.Scheme.isEqualTo(Q.vscodeTerminal),isHiddenByDefault:!0}))],run:async(a,i)=>{let e=a.service.activeInstance;if(!e){let o=e=await a.service.getActiveOrCreateInstance();await a.service.revealActiveTerminal();let n=new O,r=await new Promise(s=>{n.add(o.onDidChangeShellType(()=>s(!1))),n.add(o.onDisposed(()=>s(!0)))});if(n.dispose(),r)return}let t=nj.get(e);t&&(await t.runRecent("command"),e?.target===2?await a.editorService.revealActiveEditor():await a.groupService.showPanel(!1))}});var iae=_,b2i=class extends k{constructor(e,t){super();this._capabilities=e;this._onDidChangeAgents=t;this._onDidRequestCreateHint=this._register(new T);this._disposables=this._register(new ue)}get onDidRequestCreateHint(){return this._onDidRequestCreateHint.event}activate(e){let t=this._register(new O);this._disposables.value=t;let o=this._capabilities.get(2);o?t.add(U.once(o.promptInputModel.onDidStartInput)(()=>this._onDidRequestCreateHint.fire())):this._register(this._capabilities.onDidAddCapability(r=>{if(r.id===2){let s=r.capability;t.add(U.once(s.promptInputModel.onDidStartInput)(()=>this._onDidRequestCreateHint.fire())),s.promptInputModel.value||this._onDidRequestCreateHint.fire()}}));let n=this._onDidChangeAgents(r=>{r?.locations.includes("terminal")&&(this._onDidRequestCreateHint.fire(),n.dispose())});this._disposables.value?.add(n)}},oae=class extends k{constructor(e,t,o,n,r){super();this._ctx=e;this._chatAgentService=t;this._configurationService=o;this._instantiationService=n;this._terminalConfigurationService=r;this._decoration=this._register(new ue);this._cursorMoveListener=this._register(new ue)}static{this.ID="terminal.initialHint"}static get(e){return e.getContribution(oae.ID)}xtermOpen(e){yo(this._ctx.instance,{shellLaunchConfig:!0})&&(this._ctx.instance.shellLaunchConfig.isExtensionOwnedTerminal||this._ctx.instance.shellLaunchConfig.isFeatureTerminal||this._ctx.instance.shellLaunchConfig.hideFromUser)||this._configurationService.getValue("terminal.integrated.initialHint")&&(this._terminalConfigurationService.config.sendKeybindingsToShell||(this._xterm=e,this._addon=this._register(this._instantiationService.createInstance(b2i,this._ctx.instance.capabilities,this._chatAgentService.onDidChangeAgents)),this._xterm.raw.loadAddon(this._addon),this._register(this._addon.onDidRequestCreateHint(()=>this._createHint()))))}_disposeHint(){this._hintWidget?.remove(),this._hintWidget=void 0,this._decoration.clear()}_createHint(){let e=this._ctx.instance instanceof Ov?this._ctx.instance:void 0,t=e?.capabilities.get(2);if(!e||!this._xterm||this._hintWidget||!t||t.promptInputModel.value||e.shellLaunchConfig.attachPersistentProcess||t.commands.length>0||!this._configurationService.getValue("terminal.integrated.initialHint"))return;if(!this._decoration.value){let n=this._xterm.raw.registerMarker();if(!n||this._xterm.raw.buffer.active.cursorX===0)return;this._register(n),this._decoration.value=this._xterm.raw.registerDecoration({marker:n,x:this._xterm.raw.buffer.active.cursorX+1})}this._register(this._xterm.raw.onKey(()=>this.dispose())),this._register(this._configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("terminal.integrated.initialHint")&&!this._configurationService.getValue("terminal.integrated.initialHint")&&this.dispose()}));let o=t.promptInputModel;o&&this._register(o.onDidChangeInput(()=>{o.value&&this.dispose()})),this._cursorMoveListener.value=this._xterm.raw.onCursorMove(()=>{o?.value||(this._disposeHint(),this._createHint())}),this._decoration.value&&this._register(this._decoration.value.onRender(n=>{if(!this._hintWidget&&this._xterm?.isFocused){let r=this._register(this._instantiationService.createInstance(Mpt,e));if(this._addon?.dispose(),this._hintWidget=r.getDomNode(),!this._hintWidget)return;n.appendChild(this._hintWidget),n.classList.add("terminal-initial-hint");let s=this._xterm.getFont();s&&(n.style.fontFamily=s.fontFamily,n.style.fontSize=s.fontSize+"px")}if(this._hintWidget&&this._xterm){let r=this._hintWidget.parentElement;r&&(r.style.width=(this._xterm.raw.cols-this._xterm.raw.buffer.active.cursorX)/this._xterm.raw.cols*100+"%")}}))}};oae=I([m(1,gr),m(2,B),m(3,F),m(4,mp)],oae);tm(oae.ID,oae,!1);var Mpt=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._instance=e;this._chatAgentService=t;this._chatEntitlementService=o;this._commandService=n;this._configurationService=r;this._contextMenuService=s;this._keybindingService=l;this._telemetryService=c;this._toDispose=this._register(new O);this._isVisible=!1;this._ariaLabel="";this._toDispose.add(e.onDidFocus(()=>{this._instance.hasFocus&&this._isVisible&&this._ariaLabel&&this._configurationService.getValue("accessibility.verbosity.terminalChat")&&Er(this._ariaLabel)})),this._toDispose.add(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration("terminal.integrated.initialHint")&&!this._configurationService.getValue("terminal.integrated.initialHint")&&this.dispose()}))}_createWrappedHintElements(e,t,o){let[n,r]=e.split(t),s=iae("a",void 0,n);this._toDispose.add($(s,ne.CLICK,o));let l=iae("span.terminal-initial-hint-prose",void 0),c=iae("a",void 0,r);return this._toDispose.add($(c,ne.CLICK,o)),l.appendChild(c),{before:s,after:l}}_getHintInlineChat(){let e=[],t=()=>{this._telemetryService.publicLog2("workbenchActionExecuted",{id:"terminalInlineChat.hintAction",from:"hint"}),this._commandService.executeCommand("workbench.action.terminal.chat.start",{from:"hint"})},o=()=>{this._configurationService.updateValue("terminal.integrated.initialHint",!1)},n={disposables:this._toDispose,callback:(S,y)=>{S==="0"&&t()}},r={disposables:this._toDispose,callback:(S,y)=>{S==="0"&&o()}},s=iae("div.terminal-initial-hint");s.style.display="block";let l=this._configurationService.getValue("terminal.integrated.initialHintCopilotCli");if(!this._chatEntitlementService.sentiment.hidden)if(l){let S=()=>{this._telemetryService.publicLog2("workbenchActionExecuted",{id:"terminalCopilotCli.hintAction",from:"hint"}),this._instance.sendText("copilot",!1)},y=d(16742,null),w={callback:()=>S(),disposables:this._toDispose};s.appendChild(Jk(y,{actionHandler:w})),e.push(d(16743,null))}else{let S=this._keybindingService.lookupKeybinding("workbench.action.terminal.chat.start"),y=S?.getLabel();if(S&&y){if(this._chatAgentService.getActivatedAgents().filter(x=>x.locations.includes("terminal"))?.length){let x=d(16746,null,y),{before:E,after:M}=this._createWrappedHintElements(x,y,t);s.appendChild(E);let N=n.disposables.add(new ah(s,Ao));N.set(S),N.element.style.width="min-content",N.element.style.display="inline",N.element.style.cursor="pointer",this._toDispose.add($(N.element,ne.CLICK,t)),s.appendChild(M),s.appendChild(iae("span.terminal-initial-hint-separator")),e.push(x)}}else{let w=d(16751,null),x=Jk(w,{actionHandler:n});s.appendChild(x),e.push(d(16752,null))}}let u=!l&&this._configurationService.getValue("terminal.integrated.suggest.enabled")?this._keybindingService.lookupKeybinding("workbench.action.terminal.triggerSuggest"):void 0,p=u?.getLabel();if(u&&p){let S=d(16753,null,p),y=()=>{this._commandService.executeCommand("workbench.action.terminal.triggerSuggest")},{before:w,after:x}=this._createWrappedHintElements(S,p,y);s.appendChild(w);let E=n.disposables.add(new ah(s,Ao));E.set(u),E.element.style.width="min-content",E.element.style.display="inline",E.element.style.cursor="pointer",this._toDispose.add($(E.element,ne.CLICK,y)),s.appendChild(x),s.appendChild(iae("span.terminal-initial-hint-separator")),e.push(S)}if(e.length===0)return;let h=d(16747,null),g=Jk(h,{actionHandler:r});g.classList.add("detail","terminal-initial-hint-prose");let f=iae("span.terminal-initial-hint-prose",void 0,d(16750,null));s.appendChild(f),s.appendChild(g);let v=d(16749,null),b=Jk(v,{actionHandler:r});return b.classList.add("detail","terminal-initial-hint-compact"),s.appendChild(b),e.push(d(16748,null)),{ariaLabel:e.join(" "),hintHandler:n,hintElement:s}}getDomNode(){if(!this._domNode){let e=this._getHintInlineChat();if(!e)return;let{hintElement:t,ariaLabel:o}=e;this._domNode=iae(".terminal-initial-hint"),this._domNode.style.paddingLeft="4px",this._domNode.append(t),this._ariaLabel=o.concat(d(16744,null,"accessibility.verbosity.terminalChat")),this._toDispose.add($(this._domNode,"click",()=>{this._domNode?.remove(),this._domNode=void 0})),this._toDispose.add($(this._domNode,ne.CONTEXT_MENU,n=>{this._contextMenuService.showContextMenu({getAnchor:()=>new Ln(zi(),n),getActions:()=>[{id:"workench.action.disableTerminalInitialHint",label:d(16745,null),tooltip:d(16745,null),enabled:!0,class:void 0,run:()=>this._configurationService.updateValue("terminal.integrated.initialHint",!1)}]})}))}return this._domNode}dispose(){this._domNode?.remove(),super.dispose()}};Mpt=I([m(1,gr),m(2,dr),m(3,fe),m(4,B),m(5,Xe),m(6,Le),m(7,_e)],Mpt);function YV(a,i,e,t){let o={start:{x:e.startColumn,y:e.startLineNumber+t},end:{x:e.endColumn-1,y:e.endLineNumber+t}},n=0,r=Math.ceil(e.startColumn/i);for(let c=0;c<Math.min(r);c++){let u=Math.min(i,e.startColumn-1-c*i),p=0,h=a[c];if(!h)break;for(let g=0;g<Math.min(i,u+p);g++){let f=h.getCell(g);if(!f)break;f.getWidth()===2&&p++;let b=f.getChars();b.length>1&&(p-=b.length-1)}n+=p}let s=0,l=Math.ceil(e.endColumn/i);for(let c=Math.max(0,r-1);c<l;c++){let u=c===r-1?(e.startColumn-1+n)%i:0,p=Math.min(i,e.endColumn+n-c*i),h=0,g=a[c];if(!g)break;for(let f=u;f<Math.min(i,p+h);f++){let v=g.getCell(f);if(!v)break;let b=v.getWidth(),S=v.getChars();b===2&&h++,f===i-1&&S===""&&h++,S.length>1&&(h-=S.length-1)}s+=h}for(o.start.x+=n,o.end.x+=n+s;o.start.x>i;)o.start.x-=i,o.start.y++;for(;o.end.x>i;)o.end.x-=i,o.end.y++;return o}function Ppt(a,i){return{start:{x:a.start.x-1,y:a.start.y-i-1},end:{x:a.end.x-1,y:a.end.y-i-1}}}function XV(a,i,e,t){let o=Math.max(2048,t*2);e=Math.min(e,i+o);let n="";for(let r=i;r<=e;r++){let s=a.getLine(r);s&&(n+=s.translateToString(!0,0,t))}return n}function NFo(a,i,e,t){let o,n=-1,r=-1,s=[];for(let l=i;l<=e;l++){let c=a.getLine(l);if(c)for(let u=0;u<t;u++){let p=c.getCell(u);if(!p)break;let h=p.isBold()|p.isInverse()|p.isStrikethrough()|p.isUnderline(),g=p.isDim()|p.isItalic();if(n===-1||r===-1)o={x:u,y:l};else if(n!==h||r!==g){let f={x:u,y:l};s.push({start:o,end:f}),o={x:u,y:l}}n=h,r=g}}return s}function W7t(a,i,e,t,o){let n=a.get(2)?.getCwdForLine(i);if(o.trace("terminalLinkHelpers#updateLinkWithRelativeCwd cwd",n),!n)return;let r=[],s=t.sep;if(!e.includes(s))r.push(t.resolve(n+s+e));else{let l=0,c=0,u=n.split(s).reverse(),p=e.split(s);for(;c<u.length&&(r.push(t.resolve(n+s+p.slice(l).join(s))),u[c]===p[c]);){l++;c++}}return r}function Apt(a){return a===1?Gs:Vo}var V7t=class{constructor(i,e,t){this.id=i;this.xterm=e;this._provideLinks=t;this.maxLinkLength=2e3}async detect(i,e,t){let o=XV(this.xterm.buffer.active,e,t,this.xterm.cols);if(o===""||o.length>this.maxLinkLength)return[];let n=await this._provideLinks(o);return n?n.map(s=>{let l=YV(i,this.xterm.cols,{startColumn:s.startIndex+1,startLineNumber:1,endColumn:s.startIndex+s.length+1,endLineNumber:1},e);return{text:o.substring(s.startIndex,s.startIndex+s.length)||"",label:s.label,bufferRange:l,type:{id:this.id},activate:s.activate}}):[]}};var Y2e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this._xterm=e;this.range=t;this.text=o;this.uri=n;this.parsedLink=r;this.actions=s;this._viewportY=l;this._activateCallback=c;this._tooltipCallback=u;this._isHighConfidenceLink=p;this.label=h;this._type=g;this._configurationService=f;this._tooltipScheduler=this._register(new ue);this._hoverListeners=this._register(new ue);this._onInvalidated=this._register(new T);this.decorations={pointerCursor:!1,underline:this._isHighConfidenceLink}}get onInvalidated(){return this._onInvalidated.event}get type(){return this._type}activate(e,t){this._activateCallback(e,t)}hover(e,t){let o=Me(e),n=o.document,r=this._hoverListeners.value=new O;r.add($(n,"keydown",l=>{!l.repeat&&this._isModifierDown(l)&&this._enableDecorations()})),r.add($(n,"keyup",l=>{!l.repeat&&!this._isModifierDown(l)&&this._disableDecorations()})),r.add(this._xterm.onRender(l=>{let c=this.range.start.y-this._viewportY;c>=l.start&&c<=l.end&&this._onInvalidated.fire()})),this._isHighConfidenceLink&&(this._tooltipScheduler.value=new Dt(()=>{this._tooltipCallback(this,Ppt(this.range,this._viewportY),this._isHighConfidenceLink?()=>this._enableDecorations():void 0,this._isHighConfidenceLink?()=>this._disableDecorations():void 0),this._tooltipScheduler.clear()},this._configurationService.getValue("workbench.hover.delay")),this._tooltipScheduler.value.schedule());let s={x:e.pageX,y:e.pageY};r.add($(n,ne.MOUSE_MOVE,l=>{this._isModifierDown(l)?this._enableDecorations():this._disableDecorations(),(Math.abs(l.pageX-s.x)>o.devicePixelRatio*2||Math.abs(l.pageY-s.y)>o.devicePixelRatio*2)&&(s.x=l.pageX,s.y=l.pageY,this._tooltipScheduler.value?.schedule())}))}leave(){this._hoverListeners.clear(),this._tooltipScheduler.clear()}_enableDecorations(){this.decorations.pointerCursor||(this.decorations.pointerCursor=!0),this.decorations.underline||(this.decorations.underline=!0)}_disableDecorations(){this.decorations.pointerCursor&&(this.decorations.pointerCursor=!1),this.decorations.underline!==this._isHighConfidenceLink&&(this.decorations.underline=this._isHighConfidenceLink)}_isModifierDown(e){return this._configurationService.getValue("editor.multiCursorModifier")==="ctrlCmd"?!!e.altKey:et?e.metaKey:e.ctrlKey}};Y2e=I([m(12,B)],Y2e);var X2e=class extends k{constructor(e,t){super();this._detector=e;this._instantiationService=t;this._activeLinksStore=this._register(new O);this._onDidActivateLink=this._register(new T);this.onDidActivateLink=this._onDidActivateLink.event;this._onDidShowHover=this._register(new T);this.onDidShowHover=this._onDidShowHover.event;this._activeProvideLinkRequests=new Map}async provideLinks(e,t){let o=this._activeProvideLinkRequests.get(e);if(o){let r=await o;t(r);return}this._activeLinksStore.clear(),o=this._provideLinks(e),this._activeProvideLinkRequests.set(e,o);let n=await o;this._activeProvideLinkRequests.delete(e),t(n)}async _provideLinks(e){let t=[],o=e-1,n=o,r=[this._detector.xterm.buffer.active.getLine(o)],s=Math.max(this._detector.maxLinkLength,this._detector.xterm.cols),l=Math.ceil(s/this._detector.xterm.cols),c=Math.max(o-l,0),u=Math.min(n+l,this._detector.xterm.buffer.active.length);for(;o>=c&&this._detector.xterm.buffer.active.getLine(o)?.isWrapped;)r.unshift(this._detector.xterm.buffer.active.getLine(o-1)),o--;for(;n<u&&this._detector.xterm.buffer.active.getLine(n+1)?.isWrapped;)r.push(this._detector.xterm.buffer.active.getLine(n+1)),n++;let p=await this._detector.detect(r,o,n);for(let h of p){let g=this._createTerminalLink(h,async f=>this._onDidActivateLink.fire({link:h,event:f}));t.push(g),this._activeLinksStore.add(g)}return t}_createTerminalLink(e,t){return!e.disableTrimColon&&e.text.length>0&&e.text.charAt(e.text.length-1)===":"&&(e.text=e.text.slice(0,-1),e.bufferRange.end.x--),this._instantiationService.createInstance(Y2e,this._detector.xterm,e.bufferRange,e.text,e.uri,e.parsedLink,e.actions,this._detector.xterm.buffer.active.viewportY,t,(o,n,r,s)=>this._onDidShowHover.fire({link:o,viewportRange:n,modifierDownCallback:r,modifierUpCallback:s}),e.type!=="Search",e.label||this._getLabel(e.type),e.type)}_getLabel(e){switch(e){case"Search":return d(16764,null);case"LocalFile":return d(16762,null);case"LocalFolderInWorkspace":return d(16760,null);case"LocalFolderOutsideWorkspace":return d(16763,null);case"Url":default:return d(16761,null)}}};X2e=I([m(1,F)],X2e);var ATn=new uo(()=>FFo(!0)),OFo=new uo(()=>FFo(!1));function FFo(a){let i=0,e=0,t=0,o=0;function n(){return`(?<row${i++}>\\d+)`}function r(){return`(?<col${e++}>\\d+)`}function s(){return`(?<rowEnd${t++}>\\d+)`}function l(){return`(?<colEnd${o++}>\\d+)`}let c=a?"$":"",p=[`(?::|#| |['"],|, )${n()}([:.]${r()}(?:-(?:${s()}\\.)?${l()})?)?`+c,`['"]?(?:,? |: ?| on )lines? ${n()}(?:-${s()})?(?:,? (?:col(?:umn)?|characters?) ${r()}(?:-${l()})?)?`+c,`:? ?[\\[\\(]${n()}(?:(?:, ?|:)${r()})?[\\]\\)]`+c].join("|").replace(/ /g,"[\xA0 ]");return new RegExp(`(${p})`,a?void 0:"g")}function WFo(a){let i=Npt(a)?.suffix;return i?a.substring(0,i.index):a}function VFo(a){let i=a.startsWith("\\\\?\\")?4:0,e=a.indexOf("?",i);return e===-1?a:a.substring(0,e)}function NTn(a){let i,e=[];for(OFo.value.lastIndex=0;(i=OFo.value.exec(a))!==null;){let t=BFo(i);if(t===null)break;e.push(t)}return e}function Npt(a){return BFo(ATn.value.exec(a))}function BFo(a){let i=a?.groups;return!i||a.length<1?null:{row:B7t(i.row0||i.row1||i.row2),col:B7t(i.col0||i.col1||i.col2),rowEnd:B7t(i.rowEnd0||i.rowEnd1||i.rowEnd2),colEnd:B7t(i.colEnd0||i.colEnd1||i.colEnd2),suffix:{index:a.index,text:a[0]}}}function B7t(a){return a===void 0?a:parseInt(a)}var OTn=/(?<path>(?:file:\/\/\/)?[^\s\|<>\[\({][^\s\|<>]*)$/;function H7t(a,i){let e=WTn(a),t=HTn(a,i);return FTn(e,t),e}function FTn(a,i){a.length===0&&a.push(...i);for(let e of i)S2i(a,e,0,a.length)}function S2i(a,i,e,t){if(a.length===0){a.push(i);return}if(e>t)return;let o=Math.floor((e+t)/2);if(o>=a.length||i.path.index<a[o].path.index&&(o===0||i.path.index>a[o-1].path.index)){(o>=a.length||i.path.index+i.path.text.length<a[o].path.index&&(o===0||i.path.index>a[o-1].path.index+a[o-1].path.text.length))&&a.splice(o,0,i);return}i.path.index>a[o].path.index?S2i(a,i,o+1,t):S2i(a,i,e,o-1)}function WTn(a){let i=[],e=NTn(a);for(let t of e){let n=a.substring(0,t.suffix.index).match(OTn);if(n&&n.index!==void 0&&n.groups?.path){let r=n.index,s=n.groups.path,l,c=s.match(/^(?<prefix>['"]+)/);if(c?.groups?.prefix){if(l={index:r,text:c.groups.prefix},s=s.substring(l.text.length),s.trim().length===0)continue;if(c.groups.prefix.length>1&&t.suffix.text[0].match(/['"]/)&&c.groups.prefix[c.groups.prefix.length-1]===t.suffix.text[0]){let p=c.groups.prefix.length-1;l.index+=p,l.text=c.groups.prefix[c.groups.prefix.length-1],r+=p}}i.push({path:{index:r+(l?.text.length||0),text:s},prefix:l,suffix:t});let u=s.matchAll(/(?<bracket>[\[\(])(?![\]\)])/g);for(let p of u){let h=p.groups?.bracket;h&&i.push({path:{index:r+(l?.text.length||0)+p.index+1,text:s.substring(p.index+h.length)},prefix:l,suffix:t})}}}return i}var VTn="(?:(?:(?:\\.\\.?|\\~|file://)|(?:[^\\0<>\\?\\s!`&*()\\[\\]'\":;\\\\][^\\0<>\\?\\s!`&*()'\":;\\\\]*))?(?:\\/(?:[^\\0<>\\?\\s!`&*()'\":;\\\\])+)+)",I2i="(?:\\\\\\\\\\?\\\\|file:\\/\\/\\/)?[a-zA-Z]:",BTn=`(?:(?:(?:${I2i}|\\.\\.?|\\~)|(?:[^\\0<>\\?\\|\\/\\s!\`&*()\\[\\]'":;][^\\0<>\\?\\|\\/\\s!\`&*()'":;]*))?(?:(?:\\\\|\\/)(?:[^\\0<>\\?\\|\\/\\s!\`&*()'":;])+)+)`;function HTn(a,i){let e=[],t=new RegExp(i===1?BTn:VTn,"g"),o;for(;(o=t.exec(a))!==null;){let n=o[0],r=o.index;if(!n)break;((a.startsWith("--- a/")||a.startsWith("+++ b/"))&&r===4||a.startsWith("diff --git")&&(n.startsWith("a/")||n.startsWith("b/")))&&(n=n.substring(2),r+=2),e.push({path:{index:r,text:n},prefix:void 0,suffix:void 0})}return e}var UTn=[/^ *File (?<link>"(?<path>.+)"(, line (?<line>\d+))?)/,/^ +FILE +(?<link>(?<path>.+)(?::(?<line>\d+)(?::(?<col>\d+))?)?)/,/^(?<link>(?<path>.+)\((?<line>\d+)(?:, ?(?<col>\d+))?\)) ?:/,/^(?<link>(?<path>.+):(?<line>\d+)(?::(?<col>\d+))?) ?:/,/^(?:PS\s+)?(?<link>(?<path>[^>]+))>/,/^ *(?<link>(?<path>.+))/],p7=class{constructor(i,e,t,o,n,r,s){this.xterm=i;this._capabilities=e;this._processManager=t;this._linkResolver=o;this._logService=n;this._uriIdentityService=r;this._workspaceContextService=s;this.maxLinkLength=500}static{this.id="local"}async detect(i,e,t){let o=[],n=XV(this.xterm.buffer.active,e,t,this.xterm.cols);if(n===""||n.length>2e3)return[];let r=-1,s=0,l=this._processManager.os||Ao,c=H7t(n,l);this._logService.trace("terminalLocalLinkDetector#detect text",n),this._logService.trace("terminalLocalLinkDetector#detect parsedLinks",c);for(let u of c){if(u.path.text.length>1024)continue;let p=YV(i,this.xterm.cols,{startColumn:(u.prefix?.index??u.path.index)+1,startLineNumber:1,endColumn:u.path.index+u.path.text.length+(u.suffix?.suffix.text.length??0)+1,endLineNumber:1},e),h=[],g=Apt(l),f=u.path.text.startsWith("file://");if(g.isAbsolute(u.path.text)||u.path.text.startsWith("~")||f)h.push(u.path.text);else{if(this._capabilities.has(2)){let w=W7t(this._capabilities,p.start.y,u.path.text,g,this._logService);w&&h.push(...w)}h.length===0&&(h.push(u.path.text),u.path.text.match(/^(\.\.[\/\\])+/)&&h.push(u.path.text.replace(/^(\.\.[\/\\])+/,"")))}let v=/[\[\]"'\.]$/,b=new Map,S=[];for(let w of h){let x=w,E=x.replace(v,""),M=0;for(;E!==x;)u.suffix||M++,S.push(E),b.set(E,M),x=E,E=E.replace(v,"")}h.push(...S),this._logService.trace("terminalLocalLinkDetector#detect linkCandidates",h);let y=await this._validateAndGetLink(void 0,p,h,b);if(y&&(y.parsedLink=u,y.text=n.substring(u.prefix?.index??u.path.index,u.suffix?u.suffix.suffix.index+u.suffix.suffix.text.length:u.path.index+u.path.text.length),this._logService.trace("terminalLocalLinkDetector#detect verified link",y),o.push(y)),++s>=10)break}if(o.length===0)for(let u of UTn){let h=n.match(u)?.groups;if(!h)continue;let g=h?.link,f=h?.path,v=h?.line,b=h?.col;if(!g||!f||g.length>1024)continue;r=n.indexOf(g);let S=YV(i,this.xterm.cols,{startColumn:r+1,startLineNumber:1,endColumn:r+g.length+1,endLineNumber:1},e),y=v?`:${v}${b?`:${b}`:""}`:"",w=await this._validateAndGetLink(`${f}${y}`,S,[f]);w&&o.push(w)}if(o.length===0){let u=NFo(this.xterm.buffer.active,e,t,this.xterm.cols);for(let p of u){let h="";for(let f=p.start.y;f<=p.end.y;f++){let v=this.xterm.buffer.active.getLine(f);if(!v)break;let b=f===p.start.y?p.start.x:0,S=f===p.end.y?p.end.x:this.xterm.cols-1;h+=v.translateToString(!1,b,S)}p.start.x++,p.start.y++,p.end.y++;let g=await this._validateAndGetLink(h,p,[h]);if(g&&o.push(g),++s>=10)break}}return o}async _validateLinkCandidates(i){for(let e of i){let t;e.startsWith("file://")&&(t=A.parse(e));let o=await this._linkResolver.resolveLink(this._processManager,e,t);if(o)return o}}async _validateAndGetLink(i,e,t,o){let n=await this._validateLinkCandidates(t);if(n){let r=nae(n.uri,n.isDirectory,this._uriIdentityService,this._workspaceContextService),s=o?.get(n.link);return s&&(e.end.x-=s,e.end.x<0&&(e.end.y--,e.end.x+=this.xterm.cols)),{text:i??n.link,uri:n.uri,bufferRange:e,type:r}}}};p7=I([m(4,wa),m(5,gt),m(6,Ae)],p7);function nae(a,i,e,t){if(i){let o=t.getWorkspace().folders;for(let n=0;n<o.length;n++)if(e.extUri.isEqualOrParent(a,o[n].uri))return"LocalFolderInWorkspace";return"LocalFolderOutsideWorkspace"}else return"LocalFile"}var Z2e=class{constructor(i){this._editorService=i}async open(i){if(!i.uri)throw new Error("Tried to open file link without a resolved URI");let e=i.parsedLink?i.parsedLink.suffix:Npt(i.text),t=i.selection;t||(t=e?.row===void 0?void 0:{startLineNumber:e.row??1,startColumn:e.col??1,endLineNumber:e.rowEnd,endColumn:e.colEnd}),await this._editorService.openEditor({resource:i.uri,options:{pinned:!0,selection:t,revealIfOpened:!0}})}};Z2e=I([m(0,ie)],Z2e);var eGe=class{constructor(i){this._commandService=i}async open(i){if(!i.uri)throw new Error("Tried to open folder in workspace link without a resolved URI");await this._commandService.executeCommand("revealInExplorer",i.uri)}};eGe=I([m(0,fe)],eGe);var tGe=class{constructor(i){this._hostService=i}async open(i){if(!i.uri)throw new Error("Tried to open folder in workspace link without a resolved URI");this._hostService.openWindow([{folderUri:i.uri}],{forceNewWindow:!0})}};tGe=I([m(0,ti)],tGe);var iGe=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._capabilities=i;this._initialCwd=e;this._localFileOpener=t;this._localFolderInWorkspaceOpener=o;this._getOS=n;this._fileService=r;this._quickInputService=l;this._searchService=c;this._logService=u;this._workbenchEnvironmentService=p;this._workspaceContextService=h;this._fileQueryBuilder=s.createInstance(JS)}async open(i){let e=Apt(this._getOS()),t=e.sep,o=i.text.replace(/^file:\/\/\/?/,"");if(o=e.normalize(o).replace(/^(\.+[\\/])+/,""),i.contextLine&&!/:\d{2}:\d{2}[+-]\d{2}:\d{2}\.[a-z]+/.test(i.text)){let l=H7t(i.contextLine,this._getOS()).find(c=>c.suffix&&i.text.startsWith(c.path.text));l&&l.suffix?.row!==void 0&&(o=l.path.text,o+=`:${l.suffix.row}`,l.suffix?.col!==void 0&&(o+=`:${l.suffix.col}`))}o=o.replace(/:[^\\/\d][^\d]*$/,""),o=o.replace(/\.$/,""),this._workspaceContextService.getWorkspace().folders.forEach(r=>{if(o.substring(0,r.name.length+1)===r.name+t){o=o.substring(r.name.length+1);return}});let n=o;if(this._capabilities.has(2)&&(n=W7t(this._capabilities,i.bufferRange.start.y,o,e,this._logService)?.[0]||o),!await this._tryOpenExactLink(n,i)&&!(o!==n&&await this._tryOpenExactLink(o,i)))return this._quickInputService.quickAccess.show(o)}async _getExactMatch(i){let e=this._getOS(),t=Apt(e),o=t.isAbsolute(i),n=o?i:void 0;!o&&this._initialCwd.length>0&&(n=t.join(this._initialCwd,i));let r;if(n){let s=n;e===1&&(s=n.replace(/\\/g,"/"),s.match(/[a-z]:/i)&&(s=`/${s}`));let l;this._workbenchEnvironmentService.remoteAuthority?l=A.from({scheme:Q.vscodeRemote,authority:this._workbenchEnvironmentService.remoteAuthority,path:s}):l=A.file(s);try{let c=await this._fileService.stat(l);r={uri:l,isDirectory:c.isDirectory}}catch{}}if(!r){let s=await this._searchService.fileSearch(this._fileQueryBuilder.file(this._workspaceContextService.getWorkspace().folders,{filePattern:i,maxResults:2}));if(s.results.length>0){if(s.results.length===1)r={uri:s.results[0].resource};else if(!o){let c=(await this._searchService.fileSearch(this._fileQueryBuilder.file(this._workspaceContextService.getWorkspace().folders,{filePattern:`**/${i}`}))).results.filter(u=>u.resource.toString().endsWith(i));c.length===1&&(r={uri:c[0].resource})}}}return r}async _tryOpenExactLink(i,e){let t=i.replace(/:\d+(:\d+)?$/,"");try{let o=await this._getExactMatch(t);if(o){let{uri:n,isDirectory:r}=o,s={text:o.uri.path+(i.match(/:\d+(:\d+)?$/)?.[0]||""),uri:n,bufferRange:e.bufferRange,type:e.type};if(n)return await(r?this._localFolderInWorkspaceOpener.open(s):this._localFileOpener.open(s)),!0}}catch{return!1}return!1}};iGe=I([m(5,ge),m(6,F),m(7,$e),m(8,Gg),m(9,wa),m(10,Mt),m(11,Ae)],iGe);var oGe=class{constructor(i,e,t,o,n,r,s,l,c,u){this._isRemote=i;this._localFileOpener=e;this._localFolderInWorkspaceOpener=t;this._localFolderOutsideWorkspaceOpener=o;this._openerService=n;this._configurationService=r;this._fileService=s;this._uriIdentityService=l;this._workspaceContextService=c;this._logService=u}async open(i){if(!i.uri)throw new Error("Tried to open a url without a resolved URI");if(i.uri.scheme===Q.file)return this._openFileSchemeLink(i);this._openerService.open(i.text,{allowTunneling:this._isRemote&&this._configurationService.getValue("remote.forwardOnOpen"),allowContributedOpeners:!0,openExternal:!0})}async _openFileSchemeLink(i){if(i.uri){try{let t=(await this._fileService.stat(i.uri)).isDirectory;switch(nae(i.uri,t,this._uriIdentityService,this._workspaceContextService)){case"LocalFile":await this._localFileOpener.open(i);return;case"LocalFolderInWorkspace":await this._localFolderInWorkspaceOpener.open(i);return;case"LocalFolderOutsideWorkspace":await this._localFolderOutsideWorkspaceOpener.open(i);return;case"Url":await this.open(i);return}}catch{this._logService.warn("Open file via native file explorer")}this._openerService.open(i.text,{allowTunneling:this._isRemote&&this._configurationService.getValue("remote.forwardOnOpen"),allowContributedOpeners:!0,openExternal:!0})}}};oGe=I([m(4,Je),m(5,B),m(6,ge),m(7,gt),m(8,Ae),m(9,wa)],oGe);var rae=class{constructor(i,e,t,o,n,r){this.xterm=i;this._processManager=e;this._linkResolver=t;this._logService=o;this._uriIdentityService=n;this._workspaceContextService=r;this.maxLinkLength=2048}static{this.id="uri"}async detect(i,e,t){let o=[],n=new y2i(this.xterm,e,t),r=f3e.computeLinks(n),s=0;this._logService.trace("terminalUriLinkDetector#detect computedLinks",r);for(let l of r){let c=YV(i,this.xterm.cols,l.range,e),u=l.url?We(l.url)?A.parse(this._excludeLineAndColSuffix(l.url)):l.url:void 0;if(!u)continue;let p=l.url?.toString()||"";if(p.length>this.maxLinkLength)continue;if(u.scheme!==Q.file){o.push({text:p,uri:u,bufferRange:c,type:"Url"});continue}if(u.authority.length!==2&&u.authority.endsWith(":"))continue;let h=[u];u.authority.length>0&&h.push(A.from({...u,authority:void 0})),this._logService.trace("terminalUriLinkDetector#detect uriCandidates",h);for(let g of h){let f=await this._linkResolver.resolveLink(this._processManager,p,g);if(f){let v=nae(g,f.isDirectory,this._uriIdentityService,this._workspaceContextService),b={text:We(l.url)?l.url:f.link,uri:g,bufferRange:c,type:v};this._logService.trace("terminalUriLinkDetector#detect verified link",b),o.push(b),s++;break}}if(++s>=10)break}return o}_excludeLineAndColSuffix(i){return i.replace(/:\d+(:\d+)?$/,"")}};rae=I([m(3,wa),m(4,gt),m(5,Ae)],rae);var y2i=class{constructor(i,e,t){this._xterm=i;this._lineStart=e;this._lineEnd=t}getLineCount(){return 1}getLineContent(){return XV(this._xterm.buffer.active,this._lineStart,this._lineEnd,this._xterm.cols)}};var sae=class extends k{constructor(e,t,o){super();this.xterm=e;this._configurationService=t;this._productService=o;this.maxLinkLength=100;this._refreshSeparatorCodes(),this._register(this._configurationService.onDidChangeConfiguration(n=>{n.affectsConfiguration("terminal.integrated.wordSeparators")&&this._refreshSeparatorCodes()}))}static{this.id="word"}detect(e,t,o){let n=[],r=XV(this.xterm.buffer.active,t,o,this.xterm.cols);if(r===""||r.length>2e3)return[];let s=this._parseWords(r);for(let l of s){if(l.text==="")continue;l.text.length>0&&l.text.charAt(l.text.length-1)===":"&&(l.text=l.text.slice(0,-1),l.endIndex--);let c=YV(e,this.xterm.cols,{startColumn:l.startIndex+1,startLineNumber:1,endColumn:l.endIndex+1,endLineNumber:1},t);if(hc(l.text,this._productService.urlProtocol)){let u=A.parse(l.text);u&&n.push({text:l.text,uri:u,bufferRange:c,type:"Url"});continue}n.push({text:l.text,bufferRange:c,type:"Search",contextLine:r})}return n}_parseWords(e){let t=[],o=e.split(this._separatorRegex),n=0;for(let r=0;r<o.length;r++)t.push({text:o[r],startIndex:n,endIndex:n+o[r].length}),n+=o[r].length+1;return t}_refreshSeparatorCodes(){let e=this._configurationService.getValue(gb).wordSeparators,t="";for(let o=57520;o<=57535;o++)t+=String.fromCharCode(o);this._separatorRegex=new RegExp(`[${Ss(e)}${t}]`,"g")}};sae=I([m(1,B),m(2,Ze)],sae);var U7t=_,nGe=class extends k{constructor(e,t,o,n,r,s){super();this._targetOptions=e;this._text=t;this._actions=o;this._linkHandler=n;this._hoverService=r;this._configurationService=s;this.id="hover"}attach(e){if(!this._configurationService.getValue("terminal.integrated.showLinkHover"))return;let o=new w2i(e,this._targetOptions),n=this._hoverService.showInstantHover({target:o,content:this._text,actions:this._actions,linkHandler:this._linkHandler,additionalClasses:["xterm-hover"]});n&&this._register(n)}};nGe=I([m(4,ot),m(5,B)],nGe);var w2i=class extends ll{constructor(e,t){super();this._options=t;this._targetElements=[];this._domNode=U7t("div.terminal-hover-targets.xterm-hover");let o=this._options.viewportRange.end.y-this._options.viewportRange.start.y+1,n=(this._options.viewportRange.end.y>this._options.viewportRange.start.y?this._options.terminalDimensions.width-this._options.viewportRange.start.x:this._options.viewportRange.end.x-this._options.viewportRange.start.x+1)*this._options.cellDimensions.width,r=U7t("div.terminal-hover-target.hoverHighlight");if(r.style.left=`${this._options.viewportRange.start.x*this._options.cellDimensions.width}px`,r.style.bottom=`${(this._options.terminalDimensions.height-this._options.viewportRange.start.y-1)*this._options.cellDimensions.height}px`,r.style.width=`${n}px`,r.style.height=`${this._options.cellDimensions.height}px`,this._targetElements.push(this._domNode.appendChild(r)),o>2){let s=U7t("div.terminal-hover-target.hoverHighlight");s.style.left="0px",s.style.bottom=`${(this._options.terminalDimensions.height-this._options.viewportRange.start.y-1-(o-2))*this._options.cellDimensions.height}px`,s.style.width=`${this._options.terminalDimensions.width*this._options.cellDimensions.width}px`,s.style.height=`${(o-2)*this._options.cellDimensions.height}px`,this._targetElements.push(this._domNode.appendChild(s))}if(o>1){let s=U7t("div.terminal-hover-target.hoverHighlight");s.style.left="0px",s.style.bottom=`${(this._options.terminalDimensions.height-this._options.viewportRange.end.y-1)*this._options.cellDimensions.height}px`,s.style.width=`${(this._options.viewportRange.end.x+1)*this._options.cellDimensions.width}px`,s.style.height=`${this._options.cellDimensions.height}px`,this._targetElements.push(this._domNode.appendChild(s))}if(this._options.modifierDownCallback&&this._options.modifierUpCallback){let s=!1;this._register($(e.ownerDocument,"keydown",l=>{l.ctrlKey&&!s&&(s=!0,this._options.modifierDownCallback())})),this._register($(e.ownerDocument,"keyup",l=>{l.ctrlKey||(s=!1,this._options.modifierUpCallback())}))}e.appendChild(this._domNode),this._register(ee(()=>this._domNode?.remove()))}get targetElements(){return this._targetElements}};var zTn=[/^ *(?<link>(?<line>\d+):(?<col>\d+)?)/],KTn=[/^(?<link>@@ .+ \+(?<toFileLine>\d+),(?<toFileCount>\d+) @@)/],hIe=class{constructor(i,e,t,o,n,r){this.xterm=i;this._processManager=e;this._linkResolver=t;this._logService=o;this._uriIdentityService=n;this._workspaceContextService=r;this.maxLinkLength=500}static{this.id="multiline"}async detect(i,e,t){let o=[],n=XV(this.xterm.buffer.active,e,t,this.xterm.cols);if(n===""||n.length>2e3)return[];this._logService.trace("terminalMultiLineLinkDetector#detect text",n);for(let r of zTn){let l=n.match(r)?.groups;if(!l)continue;let c=l?.link,u=l?.line,p=l?.col;if(!c||u===void 0||c.length>1024)continue;this._logService.trace("terminalMultiLineLinkDetector#detect candidate",c);let h;for(let f=e-1;f>=0;f--){if(this.xterm.buffer.active.getLine(f).isWrapped)continue;let v=XV(this.xterm.buffer.active,f,f,this.xterm.cols);if(!v.match(/^\s*\d/)){h=v;break}}if(!h)continue;let g=await this._linkResolver.resolveLink(this._processManager,h);if(g){let f=nae(g.uri,g.isDirectory,this._uriIdentityService,this._workspaceContextService),v=YV(i,this.xterm.cols,{startColumn:1,startLineNumber:1,endColumn:1+n.length,endLineNumber:1},e),b={text:c,uri:g.uri,selection:{startLineNumber:parseInt(u),startColumn:p?parseInt(p):1},disableTrimColon:!0,bufferRange:v,type:f};this._logService.trace("terminalMultiLineLinkDetector#detect verified link",b),o.push(b);break}}if(o.length===0)for(let r of KTn){let l=n.match(r)?.groups;if(!l)continue;let c=l?.link,u=l?.toFileLine,p=l?.toFileCount;if(!c||u===void 0||c.length>1024)continue;this._logService.trace("terminalMultiLineLinkDetector#detect candidate",c);let h;for(let f=e-1;f>=0;f--){if(this.xterm.buffer.active.getLine(f).isWrapped)continue;let b=XV(this.xterm.buffer.active,f,f,this.xterm.cols).match(/\+\+\+ b\/(?<path>.+)/);if(b){h=b.groups?.path;break}}if(!h)continue;let g=await this._linkResolver.resolveLink(this._processManager,h);if(g){let f=nae(g.uri,g.isDirectory,this._uriIdentityService,this._workspaceContextService),v=YV(i,this.xterm.cols,{startColumn:1,startLineNumber:1,endColumn:1+c.length,endLineNumber:1},e),b={text:c,uri:g.uri,selection:{startLineNumber:parseInt(u),startColumn:1,endLineNumber:parseInt(u)+parseInt(p)},bufferRange:v,type:f};this._logService.trace("terminalMultiLineLinkDetector#detect verified link",b),o.push(b);break}}return o}};hIe=I([m(3,wa),m(4,gt),m(5,Ae)],hIe);var rGe=class extends O{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this._xterm=e;this._processInfo=t;this._linkResolver=n;this._configurationService=r;this._instantiationService=s;this._telemetryService=c;this._logService=p;this._tunnelService=h;this._standardLinkProviders=new Map;this._linkProvidersDisposables=[];this._externalLinkProviders=[];this._openers=new Map;let g=!0;switch(this._configurationService.getValue(gb).enableFileLinks){case"off":case!1:g=!1;break;case"notRemote":g=!this._processInfo.remoteAuthority;break}g&&(this._setupLinkDetector(hIe.id,this._instantiationService.createInstance(hIe,this._xterm,this._processInfo,this._linkResolver)),this._setupLinkDetector(p7.id,this._instantiationService.createInstance(p7,this._xterm,o,this._processInfo,this._linkResolver))),this._setupLinkDetector(rae.id,this._instantiationService.createInstance(rae,this._xterm,this._processInfo,this._linkResolver)),this._setupLinkDetector(sae.id,this.add(this._instantiationService.createInstance(sae,this._xterm)));let v=this._instantiationService.createInstance(Z2e),b=this._instantiationService.createInstance(eGe),S=this._instantiationService.createInstance(tGe);this._openers.set("LocalFile",v),this._openers.set("LocalFolderInWorkspace",b),this._openers.set("LocalFolderOutsideWorkspace",S),this._openers.set("Search",this._instantiationService.createInstance(iGe,o,this._processInfo.initialCwd,v,b,()=>this._processInfo.os||Ao)),this._openers.set("Url",this._instantiationService.createInstance(oGe,!!this._processInfo.remoteAuthority,v,b,S)),this._registerStandardLinkProviders();let y,w,x,E=()=>{y?.dispose(),y=void 0,w?.dispose(),w=void 0,x?.dispose(),x=void 0};this.add(ee(()=>{this._clearLinkProviders(),je(this._externalLinkProviders),E()})),this._xterm.options.linkHandler={allowNonHttpProtocols:!0,activate:async(M,N)=>{if(!this._isLinkActivationModifierDown(M))return;let V=N.indexOf(":");if(V===-1)throw new Error(`Could not find scheme in link "${N}"`);let H=N.substring(0,V);u.config.allowedLinkSchemes.indexOf(H)===-1&&!await new Promise(j=>{l.prompt(ft.Warning,d(16769,null,H),[{label:d(16765,null,H),run:()=>{let J=[...u.config.allowedLinkSchemes,H];this._configurationService.updateValue("terminal.integrated.allowedLinkSchemes",J),j(!0)}}],{onCancel:()=>j(!1)})})||this._openers.get("Url")?.open({type:"Url",text:N,bufferRange:null,uri:A.parse(N)})},hover:(M,N,V)=>{E(),w=new Dt(()=>{let H=this._xterm._core,K={width:H._renderService.dimensions.css.cell.width,height:H._renderService.dimensions.css.cell.height},j={width:this._xterm.cols,height:this._xterm.rows},J=this._xterm.buffer.active.viewportY;y=this._showHover({viewportRange:Ppt(V,J),cellDimensions:K,terminalDimensions:j},this._getLinkHoverString(N,N),void 0,se=>this._xterm.options.linkHandler?.activate(M,se,V)),x=new O,x.add(this._xterm.onScroll(()=>E())),x.add(this._xterm.onRender(se=>{let ae=Ppt(V,J);ae.start.y<=se.end&&ae.end.y>=se.start&&E()})),w?.dispose(),w=void 0},this._configurationService.getValue("workbench.hover.delay")),w.schedule()},leave:()=>{E()}}}_setupLinkDetector(e,t,o=!1){let n=this.add(this._instantiationService.createInstance(X2e,t));return this.add(n.onDidActivateLink(r=>{r.event?.preventDefault(),!(r.event&&!(r.event instanceof pme)&&!this._isLinkActivationModifierDown(r.event))&&(r.link.activate?r.link.activate(r.link.text):this._openLink(r.link))})),this.add(n.onDidShowHover(r=>this._tooltipCallback(r.link,r.viewportRange,r.modifierDownCallback,r.modifierUpCallback))),o||this._standardLinkProviders.set(e,n),n}async _openLink(e){this._logService.debug("Opening link",e);let t=this._openers.get(e.type);if(!t)throw new Error(`No matching opener for link type "${e.type}"`);this._telemetryService.publicLog2("terminal/openLink",{linkType:We(e.type)?e.type:`extension:${e.type.id}`}),await t.open(e)}async openRecentLink(e){let t,o=this._xterm.buffer.active.length;for(;(!t||t.length===0)&&o>=this._xterm.buffer.active.viewportY;)t=await this._getLinksForType(o,e),o--;if(!t||t.length<1)return;let n=new pme(ne.CLICK);return t[0].activate(n,t[0].text),t[0]}async getLinks(){let e=[];for(let l=this._xterm.buffer.active.viewportY+this._xterm.rows-1;l>=this._xterm.buffer.active.viewportY;l--)e.push(this._getLinksForLine(l));let t=await Promise.all(e),o={wordLinks:[],webLinks:[],fileLinks:[],folderLinks:[]};for(let l of t)if(l){let{wordLinks:c,webLinks:u,fileLinks:p,folderLinks:h}=l;c?.length&&o.wordLinks.push(...c.reverse()),u?.length&&o.webLinks.push(...u.reverse()),p?.length&&o.fileLinks.push(...p.reverse()),h?.length&&o.folderLinks.push(...h.reverse())}let n=[];for(let l=this._xterm.buffer.active.viewportY-1;l>=0;l--)n.push(this._getLinksForLine(l));let r=[];for(let l=this._xterm.buffer.active.length-1;l>=this._xterm.buffer.active.viewportY+this._xterm.rows;l--)r.push(this._getLinksForLine(l));let s=Promise.all(n).then(async l=>{let c=await Promise.all(r),u={wordLinks:[...o.wordLinks],webLinks:[...o.webLinks],fileLinks:[...o.fileLinks],folderLinks:[...o.folderLinks]};for(let p of[...c,...l])if(p){let{wordLinks:h,webLinks:g,fileLinks:f,folderLinks:v}=p;h?.length&&u.wordLinks.push(...h.reverse()),g?.length&&u.webLinks.push(...g.reverse()),f?.length&&u.fileLinks.push(...f.reverse()),v?.length&&u.folderLinks.push(...v.reverse())}return u});return{viewport:o,all:s}}async _getLinksForLine(e){let t=await this._getLinksForType(e,"word"),o=await this._getLinksForType(e,"url"),n=await this._getLinksForType(e,"localFile"),r=await this._getLinksForType(e,"localFolder"),s=new Set,l;if(t){l=[];for(let c of t)!s.has(c.text)&&c.text.length>1&&(l.push(c),s.add(c.text))}return{wordLinks:l,webLinks:o,fileLinks:n,folderLinks:r}}async _getLinksForType(e,t){switch(t){case"word":return await new Promise(o=>this._standardLinkProviders.get(sae.id)?.provideLinks(e,o));case"url":return await new Promise(o=>this._standardLinkProviders.get(rae.id)?.provideLinks(e,o));case"localFile":return(await new Promise(n=>this._standardLinkProviders.get(p7.id)?.provideLinks(e,n)))?.filter(n=>n.type==="LocalFile");case"localFolder":return(await new Promise(n=>this._standardLinkProviders.get(p7.id)?.provideLinks(e,n)))?.filter(n=>n.type==="LocalFolderInWorkspace")}}_tooltipCallback(e,t,o,n){if(!this._widgetManager)return;let r=this._xterm._core,s={width:r._renderService.dimensions.css.cell.width,height:r._renderService.dimensions.css.cell.height},l={width:this._xterm.cols,height:this._xterm.rows};this._showHover({viewportRange:t,cellDimensions:s,terminalDimensions:l,modifierDownCallback:o,modifierUpCallback:n},this._getLinkHoverString(e.text,e.label),e.actions,c=>e.activate(void 0,c),e)}_showHover(e,t,o,n,r){if(this._widgetManager){let s=this._instantiationService.createInstance(nGe,e,t,o,n),l=this._widgetManager.attachWidget(s);return l&&r?.onInvalidated(()=>l.dispose()),l}}setWidgetManager(e){this._widgetManager=e}_clearLinkProviders(){je(this._linkProvidersDisposables),this._linkProvidersDisposables.length=0}_registerStandardLinkProviders(){let e=async n=>this.externalProvideLinksCb?.(n),t=`extension-${this._externalLinkProviders.length}`,o=this._setupLinkDetector(t,new V7t(t,this._xterm,e),!0);this._linkProvidersDisposables.push(this._xterm.registerLinkProvider(o));for(let n of this._standardLinkProviders.values())this._linkProvidersDisposables.push(this._xterm.registerLinkProvider(n))}_isLinkActivationModifierDown(e){return this._configurationService.getValue("editor").multiCursorModifier==="ctrlCmd"?!!e.altKey:et?e.metaKey:e.ctrlKey}_getLinkHoverString(e,t){let o=this._configurationService.getValue("editor"),n="";o.multiCursorModifier==="ctrlCmd"?et?n=d(16771,null):n=d(16770,null):et?n=d(16772,null):n=d(16773,null);let r=d(16767,null);try{this._tunnelService.canTunnel(A.parse(e))&&(r=d(16766,null))}catch{}let s=new he("",!0);return t&&(t=s.appendText(t).value,s.value=""),e&&(e=s.appendText(e).value,s.value=""),t=t||r,e=e||t,/(\s|&nbsp;)/.test(e)&&(e=d(16768,null)),s.appendLink(e,t).appendMarkdown(` (${n})`)}};rGe=I([m(4,B),m(5,F),m(6,Ne),m(7,_e),m(8,mp),m(9,wa),m(10,Jp)],rGe);var z7t=class{constructor(){this._linkProviders=new Set;this._onDidAddLinkProvider=new T;this._onDidRemoveLinkProvider=new T}get linkProviders(){return this._linkProviders}get onDidAddLinkProvider(){return this._onDidAddLinkProvider.event}get onDidRemoveLinkProvider(){return this._onDidRemoveLinkProvider.event}registerLinkProvider(i){let e=[];return this._linkProviders.add(i),this._onDidAddLinkProvider.fire(i),{dispose:()=>{for(let t of e)t.dispose();this._linkProviders.delete(i),this._onDidRemoveLinkProvider.fire(i)}}}};var sGe=class extends O{constructor(e,t,o,n){super();this._accessibleViewService=e;this._labelService=o;this._quickInputService=n;this._editorSequencer=new Tm;this._onDidRequestMoreLinks=this.add(new T);this.onDidRequestMoreLinks=this._onDidRequestMoreLinks.event;this._terminalScrollStateSaved=!1;this._editorViewState=this.add(t.createInstance(FG))}async show(e,t){this._instance=e;let o=await Promise.race([t.all,Li(500)]),n=typeof o=="object",r=n?o:t.viewport,s=r.wordLinks?await this._generatePicks(r.wordLinks):void 0,l=r.fileLinks?await this._generatePicks(r.fileLinks):void 0,c=r.folderLinks?await this._generatePicks(r.folderLinks):void 0,u=r.webLinks?await this._generatePicks(r.webLinks):void 0,p=[];u&&(p.push({type:"separator",label:d(16778,null)}),p.push(...u)),l&&(p.push({type:"separator",label:d(16774,null)}),p.push(...l)),c&&(p.push({type:"separator",label:d(16775,null)}),p.push(...c)),s&&(p.push({type:"separator",label:d(16777,null)}),p.push(...s));let h=this._quickInputService.createQuickPick({useSeparators:!0}),g=new O;g.add(h),h.items=p,h.placeholder=d(16776,null),h.sortByLabel=!1,h.show(),h.activeItems.length>0&&this._previewItem(h.activeItems[0]);let f=!1;return n||g.add(U.once(h.onDidChangeValue)(async()=>{let v=await t.all;if(f)return;let b=[...v.fileLinks??[],...v.folderLinks??[],...v.webLinks??[]],S=v.wordLinks?await this._generatePicks(v.wordLinks,b):void 0,y=v.fileLinks?await this._generatePicks(v.fileLinks):void 0,w=v.folderLinks?await this._generatePicks(v.folderLinks):void 0,x=v.webLinks?await this._generatePicks(v.webLinks):void 0,E=[];x&&(E.push({type:"separator",label:d(16778,null)}),E.push(...x)),y&&(E.push({type:"separator",label:d(16774,null)}),E.push(...y)),w&&(E.push({type:"separator",label:d(16775,null)}),E.push(...w)),S&&(E.push({type:"separator",label:d(16777,null)}),E.push(...S)),h.items=E})),g.add(h.onDidChangeActive(async()=>{let[v]=h.activeItems;this._previewItem(v)})),new Promise(v=>{g.add(h.onDidHide(({reason:b})=>{if(this._terminalScrollStateSaved){let S=this._instance?.xterm?.markTracker;S&&(S.restoreScrollState(),S.clear(),this._terminalScrollStateSaved=!1)}b===2&&this._editorViewState.restore(),g.dispose(),h.selectedItems.length===0&&this._accessibleViewService.showLastProvider("terminal"),v()})),g.add(U.once(h.onDidAccept)(()=>{if(this._terminalScrollStateSaved){let y=this._instance?.xterm?.markTracker;y&&(y.restoreScrollState(),y.clear(),this._terminalScrollStateSaved=!1)}f=!0;let b=new pme(ne.CLICK),S=h.activeItems?.[0];S&&yo(S,{link:!0})&&S.link.activate(b,S.label),g.dispose(),v()}))})}async _generatePicks(e,t){if(!e)return;let o=new Set,n=new Set,r=[];for(let s of e){let l=s.text;if(!o.has(l)&&(!t||!t.some(c=>c.text===l))){o.add(l);let c;if(yo(s,{uri:!0})&&s.uri){if((s.type==="LocalFile"||s.type==="LocalFolderInWorkspace"||s.type==="LocalFolderOutsideWorkspace")&&(l=sl(s.uri),c=this._labelService.getUriLabel(ai(s.uri),{relative:!0})),s.type==="LocalFile"&&s.parsedLink?.suffix?.row!==void 0&&(l+=`:${s.parsedLink.suffix.row}`,s.parsedLink?.suffix?.rowEnd!==void 0&&(l+=`-${s.parsedLink.suffix.rowEnd}`),s.parsedLink?.suffix?.col!==void 0&&(l+=`:${s.parsedLink.suffix.col}`,s.parsedLink?.suffix?.colEnd!==void 0&&(l+=`-${s.parsedLink.suffix.colEnd}`))),n.has(l+"|"+(c??"")))continue;n.add(l+"|"+(c??""))}r.push({label:l,link:s,description:c})}}return r.length>0?r:void 0}_previewItem(e){if(!e||!yo(e,{link:!0})||!e.link)return;let t=e.link;this._previewItemInTerminal(t),!(!yo(t,{uri:!0})||!t.uri)&&t.type==="LocalFile"&&this._previewItemInEditor(t)}_previewItemInEditor(e){let t=e.parsedLink?e.parsedLink.suffix:Npt(e.text),o=t?.row===void 0?void 0:{startLineNumber:t.row??1,startColumn:t.col??1,endLineNumber:t.rowEnd,endColumn:t.colEnd};this._editorViewState.set(),this._editorSequencer.queue(async()=>{await this._editorViewState.openTransientEditor({resource:e.uri,options:{preserveFocus:!0,revealIfOpened:!0,ignoreError:!0,selection:o}})})}_previewItemInTerminal(e){let t=this._instance?.xterm;t&&(this._terminalScrollStateSaved||(t.markTracker.saveScrollState(),this._terminalScrollStateSaved=!0),t.markTracker.revealRange(e.range))}};sGe=I([m(0,Kd),m(1,F),m(2,nt),m(3,$e)],sGe);var aGe=class{constructor(i){this._fileService=i;this._resolvedLinkCaches=new Map}async resolveLink(i,e,t){t&&t.scheme===Q.file&&i.remoteAuthority&&(t=t.with({scheme:Q.vscodeRemote,authority:i.remoteAuthority}));let o=this._resolvedLinkCaches.get(i.remoteAuthority??"");o||(o=new C2i,this._resolvedLinkCaches.set(i.remoteAuthority??"",o));let n=o.get(t||e);if(n!==void 0)return n;if(t)try{let s=await this._fileService.stat(t),l={uri:t,link:e,isDirectory:s.isDirectory};return o.set(t,l),l}catch{return o.set(t,null),null}let r=WFo(e);if(r=VFo(r),r.length===0)return o.set(e,null),null;if(ii&&e.match(/^\/mnt\/[a-z]/i)&&i.backend)r=await i.backend.getWslPath(r,"unix-to-win");else if(!(ii&&e.match(/^(?:\/\/|\\\\)wsl(?:\$|\.localhost)(\/|\\)/))){let s=this._preprocessPath(r,i.initialCwd,i.os,i.userHome);if(!s)return o.set(e,null),null;r=s}try{let s;i.remoteAuthority?s=A.from({scheme:Q.vscodeRemote,authority:i.remoteAuthority,path:r}):s=A.file(r);try{let l=await this._fileService.stat(s),c={uri:s,link:e,isDirectory:l.isDirectory};return o.set(e,c),c}catch{return o.set(e,null),null}}catch{return o.set(e,null),null}}_preprocessPath(i,e,t,o){let n=this._getOsPath(t);if(i.charAt(0)==="~"){if(!o)return null;i=n.join(o,i.substring(1))}else if(i.charAt(0)!=="/"&&i.charAt(0)!=="~")if(t===1)if(!i.match("^"+I2i)&&!i.startsWith("\\\\?\\")){if(!e)return null;i=n.join(e,i)}else i=i.replace(/^\\\\\?\\/,"");else{if(!e)return null;i=n.join(e,i)}return i=n.normalize(i),i}_getOsPath(i){return(i??Ao)===1?Gs:Vo}};aGe=I([m(0,ge)],aGe);var C2i=class{constructor(){this._cache=new Map;this._cacheTilTimeout=0}set(i,e){this._cacheTilTimeout&&ut.clearTimeout(this._cacheTilTimeout),this._cacheTilTimeout=ut.setTimeout(()=>this._cache.clear(),1e4),this._cache.set(this._getKey(i),e)}get(i){return this._cache.get(this._getKey(i))}_getKey(i){return A.isUri(i)?i.toString():i}};Ce(uZe,z7t,1);var j1=class extends O{constructor(e,t,o){super();this._ctx=e;this._instantiationService=t;this._terminalLinkProviderService=o;this._linkResolver=this._instantiationService.createInstance(aGe)}static{this.ID="terminal.link"}static get(e){return e.getContribution(j1.ID)}xtermReady(e){let t=this._linkManager=this.add(this._instantiationService.createInstance(rGe,e.raw,this._ctx.processManager,this._ctx.instance.capabilities,this._linkResolver));if(ido(this._ctx.processManager)){let o=t.add(U.once(this._ctx.processManager.onProcessReady)(()=>{t.setWidgetManager(this._ctx.widgetManager),this.delete(o)}))}else t.setWidgetManager(this._ctx.widgetManager);if(!$M(this._ctx.instance)){for(let o of this._terminalLinkProviderService.linkProviders)t.externalProvideLinksCb=o.provideLinks.bind(o,this._ctx.instance);t.add(this._terminalLinkProviderService.onDidAddLinkProvider(o=>{t.externalProvideLinksCb=o.provideLinks.bind(o,this._ctx.instance)}))}t.add(this._terminalLinkProviderService.onDidRemoveLinkProvider(()=>t.externalProvideLinksCb=void 0))}async showLinkQuickpick(e){this._terminalLinkQuickpick||(this._terminalLinkQuickpick=this.add(this._instantiationService.createInstance(sGe)),this.add(this._terminalLinkQuickpick.onDidRequestMoreLinks(()=>{this.showLinkQuickpick(!0)})));let t=await this._getLinks();return await this._terminalLinkQuickpick.show(this._ctx.instance,t)}async _getLinks(){if(!this._linkManager)throw new Error("terminal links are not ready, cannot generate link quick pick");return this._linkManager.getLinks()}async openRecentLink(e){if(!this._linkManager)throw new Error("terminal links are not ready, cannot open a link");this._linkManager.openRecentLink(e)}};j1=I([m(1,F),m(2,uZe)],j1);tm(j1.ID,j1,!0);var x2i=vr.actionCategory;pc({id:"workbench.action.terminal.openDetectedLink",title:P(16756,"Open Detected Link..."),f1:!0,category:x2i,precondition:pt.terminalHasBeenCreated,keybinding:[{primary:3117,weight:201,when:pt.focus},{primary:3109,weight:201,when:C.and(Jd,C.equals(Fu.key,"terminal"))}],run:a=>j1.get(a)?.showLinkQuickpick()});pc({id:"workbench.action.terminal.openUrlLink",title:P(16758,"Open Last URL Link"),metadata:{description:P(16759,"Opens the last detected URL/URI link in the terminal")},f1:!0,category:x2i,precondition:pt.terminalHasBeenCreated,run:a=>j1.get(a)?.openRecentLink("url")});pc({id:"workbench.action.terminal.openFileLink",title:P(16757,"Open Last Local File Link"),f1:!0,category:x2i,precondition:pt.terminalHasBeenCreated,run:a=>j1.get(a)?.openRecentLink("localFile")});var K7t=class extends k{constructor(e){super();this._host=e;this._osc99PendingNotifications=new Map;this._osc99ActiveNotifications=new Map}handleSequence(e){let{metadata:t,payload:o}=this._splitOsc99Data(e),n=this._parseOsc99Metadata(t),r=n.get("p"),s=r&&r.length>0?r[r.length-1]:void 0,l=s&&s.length>0?s:"title",c=this._sanitizeOsc99Id(n.get("i")?.[0]);if(!this._host.isEnabled())return!0;switch(l){case"?":return this._sendOsc99QueryResponse(c),!0;case"alive":return this._sendOsc99AliveResponse(c),!0;case"close":return this._closeOsc99Notification(c),!0}let u=this._getOrCreateOsc99State(c);this._updateOsc99StateFromMetadata(u,n);let p=n.get("e")?.[0]==="1",h=this._decodeOsc99Payload(o,p),g=n.get("d")?.[0]!=="0";switch(l){case"title":u.title+=h;break;case"body":u.body+=h;break;case"buttons":u.buttonsPayload+=h;break;default:return!0}return g?this._shouldHonorOsc99Occasion(u.occasion)?(this._showOsc99Notification(u)&&this._clearOsc99PendingState(c),!0):(this._clearOsc99PendingState(c),!0):!0}_splitOsc99Data(e){let t=e.indexOf(";");return t===-1?{metadata:e,payload:""}:{metadata:e.substring(0,t),payload:e.substring(t+1)}}_parseOsc99Metadata(e){let t=new Map;if(!e)return t;for(let o of e.split(":")){if(!o)continue;let n=o.indexOf("=");if(n===-1)continue;let r=o.substring(0,n),s=o.substring(n+1);if(!r)continue;let l=t.get(r);l||(l=[],t.set(r,l)),l.push(s)}return t}_decodeOsc99Payload(e,t){if(!t)return e;try{return Ws(e).toString()}catch{return this._host.logWarn("Failed to decode OSC 99 payload"),""}}_sanitizeOsc99Id(e){if(!e)return;let t=e.replace(/[^a-zA-Z0-9_\-+.]/g,"");return t.length>0?t:void 0}_sanitizeOsc99MessageText(e){return e.replace(/\[([^\]]+)\]\(([^)]+)\)/g,"$1")}_getOrCreateOsc99State(e){if(!e)return this._osc99PendingAnonymous||(this._osc99PendingAnonymous=this._createOsc99State(void 0)),this._osc99PendingAnonymous;let t=this._osc99PendingNotifications.get(e);return t||(t=this._createOsc99State(e),this._osc99PendingNotifications.set(e,t)),t}_createOsc99State(e){return{id:e,title:"",body:"",buttonsPayload:"",focusOnActivate:!0,reportOnActivate:!1,reportOnClose:!1,urgency:void 0,autoCloseMs:void 0,occasion:void 0}}_clearOsc99PendingState(e){if(!e){this._osc99PendingAnonymous=void 0;return}this._osc99PendingNotifications.delete(e)}_updateOsc99StateFromMetadata(e,t){let o=t.get("a"),n=o&&o.length>0?o[o.length-1]:void 0;if(n!==void 0){let f=this._parseOsc99Actions(n);e.focusOnActivate=f.focusOnActivate,e.reportOnActivate=f.reportOnActivate}let r=t.get("c"),s=r&&r.length>0?r[r.length-1]:void 0;s!==void 0&&(e.reportOnClose=s==="1");let l=t.get("u"),c=l&&l.length>0?l[l.length-1]:void 0;if(c!==void 0){let f=Number.parseInt(c,10);Number.isNaN(f)||(e.urgency=f)}let u=t.get("w"),p=u&&u.length>0?u[u.length-1]:void 0;if(p!==void 0){let f=Number.parseInt(p,10);Number.isNaN(f)||(e.autoCloseMs=f)}let h=t.get("o"),g=h&&h.length>0?h[h.length-1]:void 0;(g==="always"||g==="unfocused"||g==="invisible")&&(e.occasion=g)}_parseOsc99Actions(e){let t=!0,o=!1;for(let n of e.split(","))switch(n){case"focus":t=!0;break;case"-focus":t=!1;break;case"report":o=!0;break;case"-report":o=!1;break}return{focusOnActivate:t,reportOnActivate:o}}_shouldHonorOsc99Occasion(e){if(!e||e==="always")return!0;let t=this._host.isWindowFocused();switch(e){case"unfocused":return!t;case"invisible":return!t&&!this._host.isTerminalVisible();default:return!0}}_showOsc99Notification(e){let t=this._getOsc99NotificationMessage(e);if(!t)return!1;let o=e.urgency===2?ft.Warning:ft.Info,n=this._getOsc99NotificationPriority(e.urgency),r={id:"terminal",label:d(16781,null)},s=e.buttonsPayload.length>0?e.buttonsPayload.split("\u2028"):[],l=this._register(new O),c={current:void 0},u={current:void 0},p=(S,y)=>{(y||e.focusOnActivate)&&this._host.focusTerminal(),e.reportOnActivate&&this._sendOsc99ActivationReport(e.id,S)},h=[];for(let S=0;S<s.length;S++){let y=s[S];if(!y)continue;let w=l.add(new it(`terminal.osc99.button.${S}`,y,void 0,!0,()=>{u.current&&(u.current.closeReason="button"),p(S+1),c.current?.close()}));h.push(w)}let g=[];g.push(l.add(new it("terminal.osc99.dismiss",d(16780,null),void 0,!0,()=>{u.current&&(u.current.closeReason="secondary"),c.current?.close()}))),g.push(l.add(new it("terminal.osc99.disable",d(16779,null),void 0,!0,async()=>{await this._host.updateEnableNotifications(!1),u.current&&(u.current.closeReason="secondary"),c.current?.close()})));let f={primary:h,secondary:g};if(e.id){let S=this._osc99ActiveNotifications.get(e.id);if(S)return u.current=S,c.current=S.handle,S.handle.updateMessage(t),S.handle.updateSeverity(o),S.handle.updateActions(f),S.actionStore.dispose(),S.actionStore=l,S.focusOnActivate=e.focusOnActivate,S.reportOnActivate=e.reportOnActivate,S.reportOnClose=e.reportOnClose,S.autoCloseDisposable?.dispose(),S.autoCloseDisposable=this._scheduleOsc99AutoClose(S,e.autoCloseMs),!0}let v=this._host.notify({id:e.id?`terminal.osc99.${e.id}`:void 0,severity:o,message:t,source:r,actions:f,priority:n});c.current=v;let b={id:e.id,handle:v,actionStore:l,autoCloseDisposable:void 0,reportOnActivate:e.reportOnActivate,reportOnClose:e.reportOnClose,focusOnActivate:e.focusOnActivate,closeReason:void 0};return u.current=b,b.autoCloseDisposable=this._scheduleOsc99AutoClose(b,e.autoCloseMs),this._register(v.onDidClose(()=>{b.reportOnActivate&&b.closeReason===void 0&&(b.focusOnActivate&&this._host.focusTerminal(),this._sendOsc99ActivationReport(b.id)),b.reportOnClose&&this._sendOsc99CloseReport(b.id),b.actionStore.dispose(),b.autoCloseDisposable?.dispose(),b.id&&this._osc99ActiveNotifications.delete(b.id)})),b.id&&this._osc99ActiveNotifications.set(b.id,b),!0}_getOsc99NotificationMessage(e){let t=this._sanitizeOsc99MessageText(e.title),o=this._sanitizeOsc99MessageText(e.body),n=t.trim().length>0,r=o.trim().length>0;if(n&&r)return`${t}: ${o}`;if(n)return t;if(r)return o}_getOsc99NotificationPriority(e){switch(e){case 0:return 2;case 1:return 0;case 2:return 3;default:return}}_scheduleOsc99AutoClose(e,t){if(!(t===void 0||t<=0))return Zo(()=>{e.closeReason="auto",e.handle.close()},t,this._store)}_closeOsc99Notification(e){if(!e)return;let t=this._osc99ActiveNotifications.get(e);t&&(t.closeReason="protocol",t.handle.close()),this._osc99PendingNotifications.delete(e)}_sendOsc99QueryResponse(e){let t=e??"0";this._sendOsc99Response([`i=${t}`,"p=?","a=report,focus","c=1","o=always,unfocused,invisible","p=title,body,buttons,close,alive,?","u=0,1,2","w=1"])}_sendOsc99AliveResponse(e){let t=e??"0",o=Array.from(this._osc99ActiveNotifications.keys()).join(",");this._sendOsc99Response([`i=${t}`,"p=alive"],o)}_sendOsc99ActivationReport(e,t){let o=e??"0";this._sendOsc99Response([`i=${o}`],t!==void 0?String(t):"")}_sendOsc99CloseReport(e){let t=e??"0";this._sendOsc99Response([`i=${t}`,"p=close"])}_sendOsc99Response(e,t=""){let o=e.join(":");this._host.writeToProcess(`\x1B]99;${o};${t}\x1B\\`)}};var lGe=class extends k{constructor(e,t,o,n){super();this._ctx=e;this._configurationService=t;this._notificationService=o;this._logService=n;this._handler=this._register(new K7t({isEnabled:()=>this._configurationService.getValue("terminal.integrated.enableNotifications")===!0,isWindowFocused:()=>zi().document.hasFocus(),isTerminalVisible:()=>this._ctx.instance.isVisible,focusTerminal:()=>this._ctx.instance.focus(!0),notify:r=>this._notificationService.notify(r),updateEnableNotifications:r=>this._configurationService.updateValue("terminal.integrated.enableNotifications",r),logWarn:r=>this._logService.warn(r),writeToProcess:r=>{this._ctx.instance.sendText(r,!1)}}))}static{this.ID="terminal.oscNotifications"}xtermReady(e){this._register(e.raw.parser.registerOscHandler(99,t=>this._handler.handleSequence(t)))}};lGe=I([m(1,B),m(2,Ne),m(3,wa)],lGe);tm(lGe.ID,lGe);var aae=class extends k{constructor(e,t){super();this._configurationService=t;this._listener=this._register(new ue)}static{this.ID="terminal.mouseWheelZoom"}static get(e){return e.getContribution(aae.ID)}xtermOpen(e){this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,t=>{(!t||t.affectsConfiguration("terminal.integrated.mouseWheelZoom"))&&(this._configurationService.getValue("terminal.integrated.mouseWheelZoom")?this._setupMouseWheelZoomListener(e.raw):this._listener.clear())}))}_getConfigFontSize(){return this._configurationService.getValue("terminal.integrated.fontSize")}_clampFontSize(e){return k2i(e)}_setupMouseWheelZoomListener(e){let t=sK.INSTANCE,o=0,n=this._getConfigFontSize(),r=!1,s=0,l=c=>{if(t.isPhysicalMouseWheel()){if(this._hasMouseWheelZoomModifiers(c)){let u=c.deltaY>0?-1:1,p=this._clampFontSize(this._getConfigFontSize()+u);this._configurationService.updateValue("terminal.integrated.fontSize",p),c.preventDefault(),c.stopPropagation()}}else if(Date.now()-o>50&&(n=this._getConfigFontSize(),r=this._hasMouseWheelZoomModifiers(c),s=0),o=Date.now(),s+=c.deltaY,r){let u=Math.ceil(Math.abs(s/5)),p=s>0?-1:1,h=u*p,g=this._clampFontSize(n+h);this._configurationService.updateValue("terminal.integrated.fontSize",g),s+=c.deltaY,c.preventDefault(),c.stopPropagation()}};this._listener.value=$(e.element,ne.MOUSE_WHEEL,l,{capture:!0,passive:!1})}_hasMouseWheelZoomModifiers(e){return et?(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.shiftKey&&!e.altKey}};aae=I([m(1,B)],aae);tm(aae.ID,aae,!0);Wr({id:"workbench.action.terminal.fontZoomIn",title:P(16959,"Increase Font Size"),run:async(a,i)=>{let e=i.get(B),t=e.getValue("terminal.integrated.fontSize");if(on(t)){let o=k2i(t+1);await e.updateValue("terminal.integrated.fontSize",o)}}});Wr({id:"workbench.action.terminal.fontZoomOut",title:P(16960,"Decrease Font Size"),run:async(a,i)=>{let e=i.get(B),t=e.getValue("terminal.integrated.fontSize");if(on(t)){let o=k2i(t-1);await e.updateValue("terminal.integrated.fontSize",o)}}});Wr({id:"workbench.action.terminal.fontZoomReset",title:P(16961,"Reset Font Size"),run:async(a,i)=>{await i.get(B).updateValue("terminal.integrated.fontSize",LKi)}});function k2i(a){return Math.max(6,Math.min(100,a))}tm(QV.ID,QV);Wr({id:"workbench.action.terminal.toggleStickyScroll",title:P(16820,"Toggle Sticky Scroll"),toggled:{condition:C.equals("config.terminal.integrated.stickyScroll.enabled",!0),title:d(16819,null),mnemonicTitle:d(16818,null)},run:(a,i)=>{let e=i.get(B),t=!e.getValue("terminal.integrated.stickyScroll.enabled");return e.updateValue("terminal.integrated.stickyScroll.enabled",t)},menu:[{id:R.TerminalStickyScrollContext}]});var Q1=[],rj=class extends cg{constructor(e,t,o,n,r,s,l){super(rj.PREFIX,{canAcceptInBackground:!0});this._commandService=e;this._editorService=t;this._instantiationService=o;this._terminalEditorService=n;this._terminalGroupService=r;this._terminalService=s;this._themeService=l}static{this.PREFIX="term "}_getPicks(e){Q1=[],Q1.push({type:"separator",label:"panel"});let t=this._terminalGroupService.groups;for(let s=0;s<t.length;s++){let l=t[s];for(let c=0;c<l.terminalInstances.length;c++){let u=l.terminalInstances[c],p=this._createPick(u,c,e,{groupIndex:s,groupSize:l.terminalInstances.length});p&&Q1.push(p)}}Q1.length>0&&Q1.push({type:"separator",label:"editor"});let o=this._terminalEditorService.instances;for(let s=0;s<o.length;s++){let l=o[s];l.target=2;let c=this._createPick(l,s,e);c&&Q1.push(c)}Q1.length>0&&Q1.push({type:"separator"});let n=d(16787,null);Q1.push({label:`$(plus) ${n}`,ariaLabel:n,accept:()=>this._commandService.executeCommand("workbench.action.terminal.new")});let r=d(16788,null);return Q1.push({label:`$(plus) ${r}`,ariaLabel:r,accept:()=>this._commandService.executeCommand("workbench.action.terminal.newWithProfile")}),Q1}_createPick(e,t,o,n){let r=this._instantiationService.invokeFunction(vee,e),s=n?n.groupSize>1?`${n.groupIndex+1}.${t+1}`:`${n.groupIndex+1}`:`${t+1}`,l=`$(${r}) ${s}: ${e.title}`,c=[],u=lw(e);u&&c.push(u);let p=mR(e,this._themeService.getColorTheme().type);p&&c.push(...p);let h=zB(o,MA(l),!0);if(h)return{label:l,description:e.description,highlights:{label:h},buttons:[{iconClass:q.asClassName(IEo),tooltip:d(16786,null)},{iconClass:q.asClassName(h$t),tooltip:vr.kill.value}],iconClasses:c,trigger:g=>{switch(g){case 0:return this._commandService.executeCommand("workbench.action.terminal.rename",e),0;case 1:return this._terminalService.safeDisposeTerminal(e),3}return 0},accept:(g,f)=>{if(e.target===2){let v=this._editorService.findEditors(e.resource);this._terminalEditorService.openEditor(e,{viewColumn:v?.[0].groupId}),this._terminalEditorService.setActiveInstance(e)}else this._terminalGroupService.showPanel(!f.inBackground),this._terminalGroupService.setActiveInstance(e)}}}};rj=I([m(0,fe),m(1,ie),m(2,F),m(3,hb),m(4,Cc),m(5,an),m(6,Pe)],rj);var GTn=oe.as(Bu.Quickaccess),qTn="inTerminalPicker";GTn.registerQuickAccessProvider({ctor:rj,prefix:rj.PREFIX,contextKey:qTn,placeholder:d(16785,null),helpEntries:[{description:d(16784,null),commandId:"workbench.action.quickOpenTerm"}]});var HFo="workbench.action.quickOpenNavigateNextInTerminalPicker";Ge.registerCommand({id:HFo,handler:xR(HFo,!0)});var UFo="workbench.action.quickOpenNavigatePreviousInTerminalPicker";Ge.registerCommand({id:UFo,handler:xR(UFo,!1)});Wr({id:"workbench.action.quickOpenTerm",title:P(16783,"Switch Active Terminal"),precondition:C.or(pt.processSupported,pt.terminalHasBeenCreated),run:(a,i)=>i.get($e).quickAccess.show(rj.PREFIX)});var $Tn=["quick-fix","codicon","terminal-command-decoration","xterm-decoration"],cGe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this._sessionId=e;this._aliases=t;this._capabilities=o;this._accessibilitySignalService=n;this._actionWidgetService=r;this._commandService=s;this._configurationService=l;this._extensionService=c;this._labelService=u;this._openerService=p;this._telemetryService=h;this._quickFixService=g;this._commandListeners=new Map;this._decoration=this._register(new ue);this._decorationDisposables=this._register(new ue);this._registeredSelectors=new Set;this._didRun=!1;this._onDidRequestRerunCommand=this._register(new T);this.onDidRequestRerunCommand=this._onDidRequestRerunCommand.event;this._onDidUpdateQuickFixes=this._register(new T);this.onDidUpdateQuickFixes=this._onDidUpdateQuickFixes.event;this._capabilities.get(2)?this._registerCommandHandlers():this._register(this._capabilities.onDidAddCommandDetectionCapability(()=>{this._registerCommandHandlers()})),this._register(this._quickFixService.onDidRegisterProvider(v=>this.registerCommandFinishedListener(QTn(v)))),this._quickFixService.extensionQuickFixes.then(v=>{for(let b of v)this.registerCommandSelector(b)}),this._register(this._quickFixService.onDidRegisterCommandSelector(v=>this.registerCommandSelector(v))),this._register(this._quickFixService.onDidUnregisterProvider(v=>this._commandListeners.delete(v))),this._register(this._configurationService.onDidChangeConfiguration(v=>{v.affectsConfiguration("terminal.integrated.shellIntegration.quickFixEnabled")&&(this._decoration.clear(),this._decorationDisposables.clear())}))}activate(e){this._terminal=e}showMenu(){if(!this._currentRenderContext)return;let e=this._currentRenderContext.quickFixes.map(n=>new E2i(n,n.type,n.source,n.label,n.kind)),t={allActions:e,hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1,validActions:e,dispose:()=>{}},o={onSelect:async n=>{n.action?.run(),this._actionWidgetService.hide()},onHide:()=>{this._terminal?.focus()}};this._actionWidgetService.show("quickFixWidget",!1,YTn(t.validActions,!0),o,this._currentRenderContext.anchor,this._currentRenderContext.parentElement)}registerCommandSelector(e){if(this._registeredSelectors.has(e.id))return;let t=e.commandLineMatcher.toString(),o=this._commandListeners.get(t)||[];o.push({id:e.id,type:"unresolved",commandLineMatcher:e.commandLineMatcher,outputMatcher:e.outputMatcher,commandExitResult:e.commandExitResult,kind:e.kind}),this._registeredSelectors.add(e.id),this._commandListeners.set(t,o)}registerCommandFinishedListener(e){let t=e.commandLineMatcher.toString(),o=this._commandListeners.get(t)||[];o=o.filter(n=>n.id!==e.id),o.push(e),this._commandListeners.set(t,o)}_registerCommandHandlers(){let e=this._terminal,t=this._capabilities.get(2);!e||!t||this._register(t.onCommandFinished(async o=>await this._resolveQuickFixes(o,this._aliases)))}async _resolveQuickFixes(e,t){let o=this._terminal;if(!o||e.wasReplayed)return;e.command!==""&&this._lastQuickFixId&&this._disposeQuickFix(e,this._lastQuickFixId);let n=async(s,l)=>{if(l===void 0)return;let c=s.id;return await this._extensionService.activateByEvent(`onTerminalQuickFixRequest:${c}`),this._quickFixService.providers.get(c)?.provideTerminalQuickFixes(e,l,{type:"resolved",commandLineMatcher:s.commandLineMatcher,outputMatcher:s.outputMatcher,commandExitResult:s.commandExitResult,kind:s.kind,id:s.id},new qe().token)},r=await jTn(t,o,e,this._commandListeners,this._commandService,this._openerService,this._labelService,this._onDidRequestRerunCommand,n);r&&(this._quickFixes=r,this._lastQuickFixId=this._quickFixes[0].id,this._registerQuickFixDecoration(),this._onDidUpdateQuickFixes.fire({command:e,actions:this._quickFixes}),this._quickFixes=void 0)}_disposeQuickFix(e,t){this._telemetryService?.publicLog2("terminal/quick-fix",{quickFixId:t,ranQuickFix:this._didRun,terminalSessionId:this._sessionId}),this._decoration.clear(),this._decorationDisposables.clear(),this._onDidUpdateQuickFixes.fire({command:e,actions:this._quickFixes}),this._quickFixes=void 0,this._lastQuickFixId=void 0,this._didRun=!1}_registerQuickFixDecoration(){if(!this._terminal||!this._configurationService.getValue("terminal.integrated.shellIntegration.quickFixEnabled"))return;this._decoration.clear(),this._decorationDisposables.clear();let t=this._quickFixes;if(!t||t.length===0)return;let o=this._terminal.registerMarker();if(!o)return;let n=this._decoration.value=this._terminal.registerDecoration({marker:o,width:2,layer:"top"});if(!n)return;let r=this._decorationDisposables.value=new O;r.add(n.onRender(s=>{let l=s.getBoundingClientRect(),c={x:l.x,y:l.y,width:l.width,height:l.height};if(s.classList.contains("quick-fix")){this._currentRenderContext&&(this._currentRenderContext.anchor=c);return}s.classList.add(...$Tn);let u=t.every(h=>h.kind==="explain");u&&s.classList.add("explainOnly"),s.classList.add(...q.asClassNameArray(u?L.sparkle:L.lightBulb)),LWe(this._configurationService,s),this._accessibilitySignalService.playSignal(tn.terminalQuickFix);let p=s.closest(".xterm")?.parentElement;p&&(this._currentRenderContext={quickFixes:t,anchor:c,parentElement:p},this._register($(s,ne.CLICK,()=>this.showMenu())))})),r.add(n.onDispose(()=>this._currentRenderContext=void 0))}};cGe=I([m(3,br),m(4,kd),m(5,fe),m(6,B),m(7,lt),m(8,nt),m(9,Je),m(10,_e),m(11,PRe)],cGe);async function jTn(a,i,e,t,o,n,r,s,l){let c=new Set,u=new Set,p=[],h=e.command;for(let g of t.values())for(let f of g){if(f.commandExitResult==="success"&&e.exitCode!==0||f.commandExitResult==="error"&&e.exitCode===0)continue;let v;if(f.type==="resolved")v=await f.getQuickFixes(e,MUi(i.buffer.active,e,i.cols,f.outputMatcher),f,new qe().token);else if(f.type==="unresolved"){if(!l)throw new Error("No resolved fix provider");v=await l(f,f.outputMatcher?MUi(i.buffer.active,e,i.cols,f.outputMatcher):void 0)}else if(f.type==="internal"){let b=h.match(f.commandLineMatcher);if(!b)continue;let S=f.outputMatcher,y;if(S&&(y=e.getOutputMatch(S)),!y)continue;let w={commandLineMatch:b,outputMatch:y,commandLine:e.command};v=f.getQuickFixes(w)}if(v)for(let b of Ec(v)){let S;if(yo(b,{type:!0})){switch(b.type){case 0:{let y=b;if(c.has(y.terminalCommand))continue;c.add(y.terminalCommand);let w=d(16790,null,y.terminalCommand);S={type:0,kind:f.kind,class:void 0,source:b.source,id:b.id,label:w,enabled:!0,run:()=>{s?.fire({command:y.terminalCommand,shouldExecute:y.shouldExecute??!0})},tooltip:w,command:y.terminalCommand,shouldExecute:y.shouldExecute};break}case 1:{let y=b;if(!y.uri)return;if(u.has(y.uri.toString()))continue;u.add(y.uri.toString());let x=y.uri.scheme===Q.http||y.uri.scheme===Q.https?encodeURI(y.uri.toString(!0)):r.getUriLabel(y.uri),E=d(16791,null,x);S={source:b.source,id:b.id,label:E,type:1,kind:f.kind,class:void 0,enabled:!0,run:()=>n.open(y.uri),tooltip:E,uri:y.uri};break}case 2:{let y=b;S={source:"builtin",type:y.type,kind:f.kind,id:y.id,label:y.label,class:y.class,enabled:y.enabled,run:()=>{y.run()},tooltip:y.tooltip};break}case 3:{let y=b;S={source:b.source,type:y.type,kind:f.kind,id:y.id,label:y.title,class:void 0,enabled:!0,run:()=>o.executeCommand(y.id),tooltip:y.title};break}}S&&p.push(S)}}}return p.length>0?p:void 0}function QTn(a){return{id:a.selector.id,type:"resolved",commandLineMatcher:a.selector.commandLineMatcher,outputMatcher:a.selector.outputMatcher,commandExitResult:a.selector.commandExitResult,kind:a.selector.kind,getQuickFixes:a.provider.provideTerminalQuickFixes}}var E2i=class{constructor(i,e,t,o,n="fix"){this.action=i;this.type=e;this.source=t;this.title=o;this.kind=n;this.disabled=!1}};function YTn(a,i){let e=[];e.push({kind:"header",group:{kind:Nr.QuickFix,title:d(16789,null)}});for(let t of i?a:a.filter(o=>!!o.action))!t.disabled&&t.action&&e.push({kind:"action",item:t,group:{kind:Nr.QuickFix,icon:XTn(t),title:t.action.label},disabled:!1,label:t.title});return e}function XTn(a){if(a.kind==="explain")return L.sparkle;switch(a.type){case 1:if(a.action.uri)return a.action.uri.scheme===Q.http||a.action.uri.scheme===Q.https?L.linkExternal:L.goToFile;case 0:return L.run;case 2:return L.debugDisconnect;case 3:return L.lightbulb}}var T2i=/git/,JTn=/and can be fast-forwarded/,GFo=/git\s+push/,ZTn=/error: did you mean `--(.+)` \(with two dashes\)\?/,e_n=/(?:(most similar commands? (is|are)))/,t_n=/(?:address already in use (?:0\.0\.0\.0|127\.0\.0\.1|localhost|::):|Unable to bind [^ ]*:|can't listen on port |listen EADDRINUSE [^ ]*:)(?<portNumber>\d{4,5})/,i_n=/git push --set-upstream origin (?<branchName>[^\s]+)/,o_n=/remote:\s*(?<link>https:\/\/github\.com\/.+\/.+\/pull\/new\/.+)/,zFo=/Suggestion \[General\]:/,KFo=/Suggestion \[cmd-not-found\]:/;function qFo(){return{id:"Git Similar",type:"internal",commandLineMatcher:T2i,outputMatcher:{lineMatcher:e_n,anchor:"bottom",offset:0,length:10},commandExitResult:"error",getQuickFixes:a=>{let i=a.outputMatch?.regexMatch[0];if(!i||!a.outputMatch)return;let e=[],t=a.outputMatch.outputLines.findIndex(n=>n.includes(i))+1,o=a.outputMatch.outputLines.map(n=>n.trim());for(let n=t;n<o.length;n++){let r=o[n];r&&e.push({id:"Git Similar",type:0,terminalCommand:a.commandLine.replace(/git\s+[^\s]+/,()=>`git ${r}`),shouldExecute:!0,source:"builtin"})}return e}}}function $Fo(){return{id:"Git Fast Forward Pull",type:"internal",commandLineMatcher:T2i,outputMatcher:{lineMatcher:JTn,anchor:"bottom",offset:0,length:8},commandExitResult:"success",getQuickFixes:a=>({type:0,id:"Git Fast Forward Pull",terminalCommand:"git pull",shouldExecute:!0,source:"builtin"})}}function jFo(){return{id:"Git Two Dashes",type:"internal",commandLineMatcher:T2i,outputMatcher:{lineMatcher:ZTn,anchor:"bottom",offset:0,length:2},commandExitResult:"error",getQuickFixes:a=>{let i=a?.outputMatch?.regexMatch?.[1];if(i)return{type:0,id:"Git Two Dashes",terminalCommand:a.commandLine.replace(` -${i}`,()=>` --${i}`),shouldExecute:!0,source:"builtin"}}}}function QFo(a){return{id:"Free Port",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:t_n,anchor:"bottom",offset:0,length:30},commandExitResult:"error",getQuickFixes:i=>{let e=i?.outputMatch?.regexMatch?.groups?.portNumber;if(!e)return;let t=d(16794,null,e);return{type:2,class:void 0,tooltip:t,id:"Free Port",label:t,enabled:!0,source:"builtin",run:()=>a(e,i.commandLine)}}}}function YFo(){return{id:"Git Push Set Upstream",type:"internal",commandLineMatcher:GFo,outputMatcher:{lineMatcher:i_n,anchor:"bottom",offset:0,length:8},commandExitResult:"error",getQuickFixes:a=>{let i=a.outputMatch,e="git push --set-upstream origin ${group:branchName}";if(!i)return;let t=i.regexMatch.groups;if(!t)return;let o=[],n=e;for(let[r,s]of Object.entries(t)){let l=`\${group:${r}}`;if(!e.includes(l))return[];n=n.replaceAll(l,()=>s)}if(n)return o.push({type:0,id:"Git Push Set Upstream",terminalCommand:n,shouldExecute:!0,source:"builtin"}),o}}}function XFo(){return{id:"Git Create Pr",type:"internal",commandLineMatcher:GFo,outputMatcher:{lineMatcher:o_n,anchor:"bottom",offset:4,length:12},commandExitResult:"success",getQuickFixes:a=>{let i=a?.outputMatch?.regexMatch?.groups?.link?.trimEnd();return i?{id:"Git Create Pr",label:d(16793,null,i),enabled:!0,type:1,uri:A.parse(i),source:"builtin"}:void 0}}}function JFo(){return{id:"Pwsh General Error",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:zFo,anchor:"bottom",offset:0,length:10},commandExitResult:"error",getQuickFixes:a=>{let i=a.outputMatch?.regexMatch.input?.split(`
`);if(!i)return;let e=0,t=!1;for(;e<i.length;e++)if(i[e].match(zFo)){t=!0;break}if(!t)return;let o=i[e+1].match(/The most similar commands are: (?<values>.+)./)?.groups?.values?.split(", ");if(!o)return;let n=[];for(let r of o)n.push({id:"Pwsh General Error",type:0,terminalCommand:r,source:"builtin"});return n}}}function ZFo(){return{id:"Unix Command Not Found",type:"internal",commandLineMatcher:/.+/,outputMatcher:{lineMatcher:KFo,anchor:"bottom",offset:0,length:10},commandExitResult:"error",getQuickFixes:a=>{let i=a.outputMatch?.regexMatch.input?.split(`
`);if(!i)return;let e=0,t=!1;for(;e<i.length;e++)if(i[e].match(KFo)){t=!0;break}if(!t)return;let o=[],n=!1;for(;e<i.length;e++){let r=i[e].trim();if(r.length===0)break;let s=r.match(/You also have .+ installed, you can run '(?<command>.+)' instead./)?.groups?.command;if(s){o.push({id:"Pwsh Unix Command Not Found Error",type:0,terminalCommand:s,source:"builtin"}),n=!1;continue}if(r.match(/Command '.+' not found, but can be installed with:/)){n=!0;continue}n&&o.push({id:"Pwsh Unix Command Not Found Error",type:0,terminalCommand:r.trim(),source:"builtin"})}return o}}}var G7t=class{constructor(){this._selectors=new Map;this._providers=new Map;this._pendingProviders=new Map;this._onDidRegisterProvider=new T;this.onDidRegisterProvider=this._onDidRegisterProvider.event;this._onDidRegisterCommandSelector=new T;this.onDidRegisterCommandSelector=this._onDidRegisterCommandSelector.event;this._onDidUnregisterProvider=new T;this.onDidUnregisterProvider=this._onDidUnregisterProvider.event;this.extensionQuickFixes=new Promise(i=>n_n.setHandler(e=>{i(e.filter(t=>Va(t.description,"terminalQuickFixProvider")).map(t=>t.value?t.value.map(o=>({...o,extensionIdentifier:t.description.identifier.value})):[]).flat())})),this.extensionQuickFixes.then(i=>{for(let e of i)this.registerCommandSelector(e)})}get providers(){return this._providers}registerCommandSelector(i){this._selectors.set(i.id,i),this._onDidRegisterCommandSelector.fire(i);let e=this._pendingProviders.get(i.id);e&&(this._pendingProviders.delete(i.id),this._providers.set(i.id,e),this._onDidRegisterProvider.fire({selector:i,provider:e}))}registerQuickFixProvider(i,e){let t=!1;return this.extensionQuickFixes.then(()=>{if(t)return;let o=this._selectors.get(i);o?(this._providers.set(i,e),this._onDidRegisterProvider.fire({selector:o,provider:e})):this._pendingProviders.set(i,e)}),ee(()=>{t=!0,this._providers.delete(i),this._pendingProviders.delete(i);let o=this._selectors.get(i);o&&(this._selectors.delete(i),this._onDidUnregisterProvider.fire(o.id))})}},n_n=zn.registerExtensionPoint({extensionPoint:"terminalQuickFixes",defaultExtensionKind:["workspace"],activationEventsGenerator:function*(a){for(let i of a??[])yield`onTerminalQuickFixRequest:${i.id}`},jsonSchema:{description:d(16795,null),type:"array",items:{type:"object",additionalProperties:!1,required:["id","commandLineMatcher","outputMatcher","commandExitResult"],defaultSnippets:[{body:{id:"$1",commandLineMatcher:"$2",outputMatcher:"$3",exitStatus:"$4"}}],properties:{id:{description:d(16798,null),type:"string"},commandLineMatcher:{description:d(16797,null),type:"string"},outputMatcher:{markdownDescription:d(16800,null),type:"object",required:["lineMatcher","anchor","offset","length"],properties:{lineMatcher:{description:"A regular expression or string to test the command line against",type:"string"},anchor:{description:"Where the search should begin in the buffer",enum:["top","bottom"]},offset:{description:"The number of lines vertically from the anchor in the buffer to start matching against",type:"number"},length:{description:"The number of rows to match against, this should be as small as possible for performance reasons",type:"number"}}},commandExitResult:{description:d(16796,null),enum:["success","error"],enumDescriptions:["The command exited with an exit code of zero.","The command exited with a non-zero exit code."]},kind:{description:d(16799,null,'`"fix"`'),enum:["default","explain"],enumDescriptions:["A high confidence quick fix.","An explanation of the problem."]}}}}});Ce(PRe,G7t,1);var m7=class extends O{constructor(e,t){super();this._ctx=e;this._instantiationService=t;this._quickFixMenuItems=this.add(new ue)}static{this.ID="quickFix"}static get(e){return e.getContribution(m7.ID)}get addon(){return this._addon}xtermReady(e){this._addon=this._instantiationService.createInstance(cGe,this._ctx.instance.sessionId,void 0,this._ctx.instance.capabilities),e.raw.loadAddon(this._addon),this.add(this._addon.onDidRequestRerunCommand(t=>this._ctx.instance.runCommand(t.command,t.shouldExecute||!1))),this.add(this._addon.onDidUpdateQuickFixes(t=>{this._quickFixMenuItems.value=t.actions?e.decorationAddon.registerMenuItems(t.command,t.actions):void 0}));for(let t of[jFo(),$Fo(),QFo((o,n)=>this._ctx.instance.freePortKillProcess(o,n)),qFo(),YFo(),XFo(),ZFo(),JFo()])this._addon.registerCommandFinishedListener(t)}};m7=I([m(1,F)],m7);tm(m7.ID,m7);pc({id:"workbench.action.terminal.showQuickFixes",title:P(16792,"Show Terminal Quick Fixes"),precondition:pt.focus,keybinding:{primary:2137,weight:200},run:a=>m7.get(a)?.addon?.showMenu()});var r_n=/^\x1b\[[0-9;]*m/,s_n=/^\x1b\[?([0-9]*)(;[35])?O?([DC])/,a_n=/[^a-z0-9]/i;var l_n=/^(\x1b\[(\??25[hl]|\??[0-9;]+n))+/,A2i=a=>a._core,i0o=a=>{};var _2i=class a{constructor(i,e,t){this.rows=i;this.cols=e;this._buffer=t;this._x=0;this._y=1;this._baseY=1;this._x=t.cursorX,this._y=t.cursorY,this._baseY=t.baseY}get x(){return this._x}get y(){return this._y}get baseY(){return this._baseY}get coordinate(){return{x:this._x,y:this._y,baseY:this._baseY}}getLine(){return this._buffer.getLine(this._y+this._baseY)}getCell(i){return this.getLine()?.getCell(this._x,i)}moveTo(i){return this._x=i.x,this._y=i.y+i.baseY-this._baseY,this.moveInstruction()}clone(){let i=new a(this.rows,this.cols,this._buffer);return i.moveTo(this),i}move(i,e){return this._x=i,this._y=e,this.moveInstruction()}shift(i=0,e=0){return this._x+=i,this._y+=e,this.moveInstruction()}moveInstruction(){return this._y>=this.rows?(this._baseY+=this._y-(this.rows-1),this._y=this.rows-1):this._y<0&&(this._baseY-=this._y,this._y=0),`\x1B[${this._y+1};${this._x+1}H`}},c_n=(a,i,e)=>{let t=!1;e<0&&i.shift(-1);let o;for(;i.x>=0;){if(o=i.getCell(o),!o?.getCode())return;let n=o.getChars();if(a_n.test(n)){if(t)break}else t=!0;i.shift(e)}e<0&&i.shift(1)};var q7t=class{constructor(i){this._input=i;this.index=0}get remaining(){return this._input.length-this.index}get eof(){return this.index===this._input.length}get rest(){return this._input.slice(this.index)}eatChar(i){if(this._input[this.index]===i)return this.index++,i}eatStr(i){if(this._input.slice(this.index,i.length)===i)return this.index+=i.length,i}eatGradually(i){let e=this.index;for(let t=0;t<i.length;t++){if(t>0&&this.eof)return 2;if(!this.eatChar(i[t]))return this.index=e,1}return 0}eatRe(i){let e=i.exec(this._input.slice(this.index));if(e)return this.index+=e[0].length,e}eatCharCode(i=0,e=i+1){let t=this._input.charCodeAt(this.index);if(!(t<i||t>=e))return this.index++,t}},D2i=class{constructor(){this.clearAfterTimeout=!1}apply(){return""}rollback(){return""}rollForwards(){return""}matches(){return 1}},$7t=class{constructor(i){this.inner=i}apply(i,e){return this._appliedCursor=e.clone(),this.inner.apply(i,this._appliedCursor),""}rollback(i){return this.inner.rollback(i.clone()),""}rollForwards(i,e){return this._appliedCursor&&i.moveTo(this._appliedCursor),e}matches(i){return this.inner.matches(i)}},d_n=a=>a instanceof $7t&&a.inner instanceof Fpt,Fpt=class a{constructor(i,e){this._style=i;this._char=e;this.affectsStyle=!0}apply(i,e){let t=e.getCell();return this.appliedAt=t?{pos:e.coordinate,oldAttributes:Wpt(t),oldChar:t.getChars()}:{pos:e.coordinate,oldAttributes:"",oldChar:""},e.shift(1),this._style.apply+this._char+this._style.undo}rollback(i){if(!this.appliedAt)return"";let{oldAttributes:e,oldChar:t,pos:o}=this.appliedAt;return i.moveTo(o)+(t?`${e}${t}${i.moveTo(o)}`:"\x1B[X")}rollForwards(i,e){return this.appliedAt?i.clone().moveTo(this.appliedAt.pos)+e:""}matches(i,e){let t=i.index;for(;i.eatRe(r_n););if(i.eof)return 2;if(i.eatChar(this._char))return 0;if(e instanceof a){let o=i.eatGradually(`\b${e._char}${this._char}`);if(o!==1)return o}return i.index=t,1}},j7t=class{constructor(i){this._terminal=i}apply(i,e){let t=!e.getLine()?.translateToString(void 0,e.x).trim(),o=e.coordinate,n=e.shift(-1),r=e.getCell();return this._appliedAt=r?{isLastChar:t,pos:o,oldAttributes:Wpt(r),oldChar:r.getChars()}:{isLastChar:t,pos:o,oldAttributes:"",oldChar:""},n+"\x1B[X"}rollback(i){if(!this._appliedAt)return"";let{oldAttributes:e,oldChar:t,pos:o}=this._appliedAt;return t?e+t+i.moveTo(o)+Wpt(A2i(this._terminal)._inputHandler._curAttrData):i.moveTo(o)+"\x1B[X"}rollForwards(){return""}matches(i){if(this._appliedAt?.isLastChar){let e=i.eatGradually("\b\x1B[K");if(e!==1)return e;let t=i.eatGradually("\b \b");if(t!==1)return t}return 1}},Q7t=class{apply(i,e){return this._prevPosition=e.coordinate,e.move(0,e.y+1),`\r
`}rollback(i){return this._prevPosition?i.moveTo(this._prevPosition):""}rollForwards(){return""}matches(i){return i.eatGradually(`\r
`)}},R2i=class extends Q7t{apply(i,e){return this._prevPosition=e.coordinate,e.move(0,e.y+1)," \r"}matches(i){let e=i.eatGradually(" \r");return e!==1?i.eatGradually("\x1B[K")===2?2:e:i.eatGradually(`\r
`)}},Opt=class{constructor(i,e,t){this._direction=i;this._moveByWords=e;this._amount=t}apply(i,e){let t=e.x,o=e.getCell(),n=o?Wpt(o):"",{_amount:r,_direction:s,_moveByWords:l}=this,c=s==="D"?-1:1,u=e.clone();if(l)for(let p=0;p<r;p++)c_n(i,u,c);else u.shift(c*r);return this._applied={amount:Math.abs(e.x-u.x),prevPosition:t,prevAttrs:n,rollForward:e.moveTo(u)},this._applied.rollForward}rollback(i){return this._applied?i.move(this._applied.prevPosition,i.y)+this._applied.prevAttrs:""}rollForwards(){return""}matches(i){if(!this._applied)return 1;let e=this._direction,{amount:t,rollForward:o}=this._applied;if(i.eatStr(`\x1B[${e}`.repeat(t))||e==="D"&&i.eatStr("\b".repeat(t)))return 0;if(o){let n=i.eatGradually(o);if(n!==1)return n}return i.eatGradually(`\x1B[${t}${e}`)}},L2i=class extends k{constructor(e){super();this._stats=[];this._index=0;this._addedAtTime=new WeakMap;this._changeEmitter=this._register(new T);this.onChange=this._changeEmitter.event;this._register(e.onPredictionAdded(t=>this._addedAtTime.set(t,Date.now()))),this._register(e.onPredictionSucceeded(this._pushStat.bind(this,!0))),this._register(e.onPredictionFailed(this._pushStat.bind(this,!1)))}get accuracy(){let e=0;for(let[,t]of this._stats)t&&e++;return e/(this._stats.length||1)}get sampleSize(){return this._stats.length}get latency(){let e=this._stats.filter(([,t])=>t).map(([t])=>t).sort();return{count:e.length,min:e[0],median:e[Math.floor(e.length/2)],max:e[e.length-1]}}get maxLatency(){let e=-1/0;for(let[t,o]of this._stats)o&&(e=Math.max(t,e));return e}_pushStat(e,t){let o=this._addedAtTime.get(t);this._stats[this._index]=[Date.now()-o,e],this._index=(this._index+1)%24,this._changeEmitter.fire()}},M2i=class extends k{constructor(e,t){super();this.terminal=e;this._style=t;this._expected=[];this._currentGen=0;this._showPredictions=!1;this._addedEmitter=this._register(new T);this.onPredictionAdded=this._addedEmitter.event;this._failedEmitter=this._register(new T);this.onPredictionFailed=this._failedEmitter.event;this._succeededEmitter=this._register(new T);this.onPredictionSucceeded=this._succeededEmitter.event}get _currentGenerationPredictions(){return this._expected.filter(({gen:e})=>e===this._expected[0].gen).map(({p:e})=>e)}get isShowingPredictions(){return this._showPredictions}get length(){return this._expected.length}setShowPredictions(e){if(e===this._showPredictions)return;this._showPredictions=e;let t=this._getActiveBuffer();if(!t)return;let o=this._currentGenerationPredictions;e?(this.clearCursor(),this._style.expectIncomingStyle(o.reduce((n,r)=>r.affectsStyle?n+1:n,0)),this.terminal.write(o.map(n=>n.apply(t,this.physicalCursor(t))).join(""))):this.terminal.write(o.reverse().map(n=>n.rollback(this.physicalCursor(t))).join(""))}undoAllPredictions(){let e=this._getActiveBuffer();this._showPredictions&&e&&this.terminal.write(this._currentGenerationPredictions.reverse().map(t=>t.rollback(this.physicalCursor(e))).join("")),this._expected=[]}beforeServerInput(e){let t=e;if(this._inputBuffer&&(e=this._inputBuffer+e,this._inputBuffer=void 0),!this._expected.length)return this._clearPredictionState(),e;let o=this._getActiveBuffer();if(!o)return this._clearPredictionState(),e;let n="",r=new q7t(e),s=this._expected[0].gen,l=()=>{let c=r.eatRe(l_n);c&&(n+=c[0])};e:for(;this._expected.length&&r.remaining>0;){l();let{p:c,gen:u}=this._expected[0],p=this.physicalCursor(o),h=r.index;switch(c.matches(r,this._lookBehind)){case 0:{let g=e.slice(h,r.index);u===s?n+=c.rollForwards?.(p,g):(c.apply(o,this.physicalCursor(o)),n+=g),this._succeededEmitter.fire(c),this._lookBehind=c,this._expected.shift();break}case 2:this._inputBuffer=e.slice(h),r.index=e.length;break e;case 1:{let g=this._expected.filter(f=>f.gen===s).reverse();n+=g.map(({p:f})=>f.rollback(this.physicalCursor(o))).join(""),g.some(f=>f.p.affectsStyle)&&(n+=Wpt(A2i(this.terminal)._inputHandler._curAttrData)),this._clearPredictionState(),this._failedEmitter.fire(c);break e}}}if(l(),r.eof||(n+=r.rest,this._clearPredictionState()),this._expected.length&&s!==this._expected[0].gen)for(let{p:c,gen:u}of this._expected){if(u!==this._expected[0].gen)break;c.affectsStyle&&this._style.expectIncomingStyle(),n+=c.apply(o,this.physicalCursor(o))}return this._showPredictions?(n.length===0||n===e||(this._physicalCursor&&(n+=this._physicalCursor.moveInstruction()),n="\x1B[?25l"+n+"\x1B[?25h"),n):t}_clearPredictionState(){this._expected=[],this.clearCursor(),this._lookBehind=void 0}addPrediction(e,t){if(this._expected.push({gen:this._currentGen,p:t}),this._addedEmitter.fire(t),this._currentGen!==this._expected[0].gen)return t.apply(e,this.tentativeCursor(e)),!1;let o=t.apply(e,this.physicalCursor(e));return this._tenativeCursor=void 0,this._showPredictions&&o&&(t.affectsStyle&&this._style.expectIncomingStyle(),this.terminal.write(o)),!0}addBoundary(e,t){let o=!1;return e&&t&&(o=this.addPrediction(e,new $7t(t)),t.apply(e,this.tentativeCursor(e))),this._currentGen++,o}peekEnd(){return this._expected[this._expected.length-1]?.p}peekStart(){return this._expected[0]?.p}physicalCursor(e){return this._physicalCursor||(this._showPredictions&&i0o(this.terminal),this._physicalCursor=new _2i(this.terminal.rows,this.terminal.cols,e)),this._physicalCursor}tentativeCursor(e){return this._tenativeCursor||(this._tenativeCursor=this.physicalCursor(e).clone()),this._tenativeCursor}clearCursor(){this._physicalCursor=void 0,this._tenativeCursor=void 0}_getActiveBuffer(){let e=this.terminal.buffer.active;return e.type==="normal"?e:void 0}},o0o=a=>{if(a.isAttributeDefault())return[0];let i=[];return a.isBold()&&i.push(1),a.isDim()&&i.push(2),a.isItalic()&&i.push(3),a.isUnderline()&&i.push(4),a.isBlink()&&i.push(5),a.isInverse()&&i.push(7),a.isInvisible()&&i.push(8),a.isFgRGB()&&i.push(38,2,a.getFgColor()>>>24,a.getFgColor()>>>16&255,a.getFgColor()&255),a.isFgPalette()&&i.push(38,5,a.getFgColor()),a.isFgDefault()&&i.push(39),a.isBgRGB()&&i.push(48,2,a.getBgColor()>>>24,a.getBgColor()>>>16&255,a.getBgColor()&255),a.isBgPalette()&&i.push(48,5,a.getBgColor()),a.isBgDefault()&&i.push(49),i},Wpt=a=>`\x1B[${o0o(a).join(";")}m`,e0o=(a,i,e)=>{if(a.length-i>e.length)return!1;for(let t=0;t<e.length;t++,i++)if(e[i]!==a[i])return!1;return!0},u_n=(a,i)=>{let e=[0,0,-1,0,0,0],t=0,o=0;do{let n=a[i+o];if(e[o+t]=on(n)?n:n[0],!on(n)){let r=0;do e[1]===5&&(t=1),e[o+r+1+t]=n[r];while(++r<n.length&&r+o+1+t<e.length);break}if(e[1]===5&&o+t>=2||e[1]===2&&o+t>=5)break;e[1]&&(t=1)}while(++o+i<a.length&&o+t<e.length);return o},dGe=class dGe{constructor(i,e){this._terminal=e;this._expectedIncomingStyles=0;this.onUpdate(i)}static _compileArgs(i){return`\x1B[${i.join(";")}m`}expectIncomingStyle(i=1){this._expectedIncomingStyles+=i*2}startTracking(){this._expectedIncomingStyles=0,this._onDidWriteSGR(o0o(A2i(this._terminal)._inputHandler._curAttrData)),this._csiHandler=this._terminal.parser.registerCsiHandler({final:"m"},i=>(this._onDidWriteSGR(i),!1))}debounceStopTracking(){this._stopTracking()}dispose(){this._stopTracking()}_stopTracking(){this._csiHandler?.dispose(),this._csiHandler=void 0}_onDidWriteSGR(i){let e=this._undoArgs;for(let t=0;t<i.length;){let o=i[t],n=on(o)?o:o[0];if(this._expectedIncomingStyles){if(e0o(i,t,this._undoArgs)){this._expectedIncomingStyles--,t+=this._undoArgs.length;continue}if(e0o(i,t,this._applyArgs)){this._expectedIncomingStyles--,t+=this._applyArgs.length;continue}}let r=n===38||n===48||n===58?u_n(i,t):1;switch(this._applyArgs[0]){case 1:n===2?this._undoArgs=[22,2]:(n===22||n===0)&&(this._undoArgs=[22]);break;case 2:n===1?this._undoArgs=[22,1]:(n===22||n===0)&&(this._undoArgs=[22]);break;case 38:n===0||n===39||n===100?this._undoArgs=[39]:(n>=30&&n<=38||n>=90&&n<=97)&&(this._undoArgs=i.slice(t,t+r));break;default:n===this._applyArgs[0]?this._undoArgs=this._applyArgs:n===0&&(this._undoArgs=this._originalUndoArgs)}t+=r}e!==this._undoArgs&&(this.undo=dGe._compileArgs(this._undoArgs))}onUpdate(i){let{applyArgs:e,undoArgs:t}=this._getArgs(i);this._applyArgs=e,this._undoArgs=this._originalUndoArgs=t,this.apply=dGe._compileArgs(this._applyArgs),this.undo=dGe._compileArgs(this._undoArgs)}_getArgs(i){switch(i){case"bold":return{applyArgs:[1],undoArgs:[22]};case"dim":return{applyArgs:[2],undoArgs:[22]};case"italic":return{applyArgs:[3],undoArgs:[23]};case"underlined":return{applyArgs:[4],undoArgs:[24]};case"inverted":return{applyArgs:[7],undoArgs:[27]};default:{let e;try{e=Ue.fromHex(i)}catch{e=new Ue(new Ut(255,0,0,1))}let{r:t,g:o,b:n}=e.rgba;return{applyArgs:[38,2,t,o,n],undoArgs:[39]}}}}};I([Tu(2e3)],dGe.prototype,"debounceStopTracking",1);var P2i=dGe,t0o=(a=cyi)=>new RegExp(`\\b(${a.map(Ss).join("|")})\\b`,"i");var gIe=class extends k{constructor(e,t,o){super();this._processManager=e;this._configurationService=t;this._telemetryService=o;this._terminalTitle="";this._typeaheadThreshold=this._configurationService.getValue(gb).localEchoLatencyThreshold,this._excludeProgramRe=t0o(this._configurationService.getValue(gb).localEchoExcludePrograms),this._register(ee(()=>this._clearPredictionDebounce?.dispose()))}activate(e){let t=this._typeaheadStyle=this._register(new P2i(this._configurationService.getValue(gb).localEchoStyle,e)),o=this._timeline=this._register(new M2i(e,this._typeaheadStyle)),n=this.stats=this._register(new L2i(this._timeline));o.setShowPredictions(this._typeaheadThreshold===0),this._register(e.onData(s=>this._onUserData(s))),this._register(e.onTitleChange(s=>{this._terminalTitle=s,this._reevaluatePredictorState(n,o)})),this._register(e.onResize(()=>{o.setShowPredictions(!1),o.clearCursor(),this._reevaluatePredictorState(n,o)})),this._register(this._configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration(gb)&&(t.onUpdate(this._configurationService.getValue(gb).localEchoStyle),this._typeaheadThreshold=this._configurationService.getValue(gb).localEchoLatencyThreshold,this._excludeProgramRe=t0o(this._configurationService.getValue(gb).localEchoExcludePrograms),this._reevaluatePredictorState(n,o))})),this._register(this._timeline.onPredictionSucceeded(s=>{this._lastRow?.charState===1&&d_n(s)&&s.inner.appliedAt&&s.inner.appliedAt.pos.y+s.inner.appliedAt.pos.baseY===this._lastRow.y&&(this._lastRow.charState=2)})),this._register(this._processManager.onBeforeProcessData(s=>this._onBeforeProcessData(s)));let r;this._register(n.onChange(()=>{r||(r=setTimeout(()=>{this._sendLatencyStats(n),r=void 0},3e5)),o.length===0&&t.debounceStopTracking(),this._reevaluatePredictorState(n,o)}))}reset(){this._lastRow=void 0}_deferClearingPredictions(){if(!(!this.stats||!this._timeline)){if(this._clearPredictionDebounce?.dispose(),this._timeline.length===0||this._timeline.peekStart()?.clearAfterTimeout===!1){this._clearPredictionDebounce=void 0;return}this._clearPredictionDebounce=Zo(()=>{this._timeline?.undoAllPredictions(),this._lastRow?.charState===1&&(this._lastRow.charState=0)},Math.max(500,this.stats.maxLatency*3/2),this._store)}}_reevaluatePredictorState(e,t){this._reevaluatePredictorStateNow(e,t)}_reevaluatePredictorStateNow(e,t){if(this._excludeProgramRe.test(this._terminalTitle))t.setShowPredictions(!1);else if(this._typeaheadThreshold<0)t.setShowPredictions(!1);else if(this._typeaheadThreshold===0)t.setShowPredictions(!0);else if(e.sampleSize>5&&e.accuracy>.3){let o=e.latency.median;o>=this._typeaheadThreshold?t.setShowPredictions(!0):o<this._typeaheadThreshold/.5&&t.setShowPredictions(!1)}}_sendLatencyStats(e){this._telemetryService.publicLog("terminalLatencyStats",{...e.latency,predictionAccuracy:e.accuracy})}_onUserData(e){if(this._timeline?.terminal.buffer.active.type!=="normal")return;let t=this._timeline.terminal,o=t.buffer.active;if(o.cursorX===1&&o.cursorY===t.rows-1&&o.getLine(o.cursorY+o.baseY)?.getCell(0)?.getChars()===":")return;let n=o.baseY+o.cursorY;n!==this._lastRow?.y?this._lastRow={y:n,startingX:o.cursorX,endingX:o.cursorX,charState:0}:(this._lastRow.startingX=Math.min(this._lastRow.startingX,o.cursorX),this._lastRow.endingX=Math.max(this._lastRow.endingX,this._timeline.physicalCursor(o).x));let r=c=>this._timeline.tentativeCursor(o).x<=this._lastRow.startingX?this._timeline.addBoundary(o,c):this._timeline.addPrediction(o,c),s=c=>this._timeline.tentativeCursor(o).x>=this._lastRow.endingX-1?this._timeline.addBoundary(o,c):this._timeline.addPrediction(o,c),l=new q7t(e);for(;l.remaining>0;){if(l.eatCharCode(127)){let u=this._timeline.peekEnd();u&&u instanceof Fpt&&this._timeline.addBoundary(),this._timeline.isShowingPredictions&&i0o(this._timeline.terminal),this._timeline.tentativeCursor(o).x<=this._lastRow.startingX?this._timeline.addBoundary(o,new j7t(this._timeline.terminal)):(this._lastRow.endingX--,this._timeline.addPrediction(o,new j7t(this._timeline.terminal)));continue}if(l.eatCharCode(32,126)){let u=e[l.index-1],p=new Fpt(this._typeaheadStyle,u);this._lastRow.charState===0?(this._timeline.addBoundary(o,p),this._lastRow.charState=1):this._timeline.addPrediction(o,p),this._timeline.tentativeCursor(o).x>=t.cols&&this._timeline.addBoundary(o,new R2i);continue}let c=l.eatRe(s_n);if(c){let u=c[3],p=new Opt(u,!!c[2],Number(c[1])||1);u==="D"?r(p):s(p);continue}if(l.eatStr("\x1Bf")){s(new Opt("C",!0,1));continue}if(l.eatStr("\x1Bb")){r(new Opt("D",!0,1));continue}if(l.eatChar("\r")&&o.cursorY<t.rows-1){this._timeline.addPrediction(o,new Q7t);continue}this._timeline.addBoundary(o,new D2i);break}this._timeline.length===1&&(this._deferClearingPredictions(),this._typeaheadStyle.startTracking())}_onBeforeProcessData(e){this._timeline&&(e.data=this._timeline.beforeServerInput(e.data),this._deferClearingPredictions())}};I([Tu(100)],gIe.prototype,"_reevaluatePredictorState",1),gIe=I([m(1,B),m(2,_e)],gIe);var lae=class extends O{constructor(e,t,o){super();this._ctx=e;this._configurationService=t;this._instantiationService=o;this.add(ee(()=>this._addon?.dispose()))}static{this.ID="terminal.typeAhead"}static get(e){return e.getContribution(lae.ID)}xtermReady(e){this._loadTypeAheadAddon(e.raw),this.add(this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration("terminal.integrated.localEchoEnabled")&&this._loadTypeAheadAddon(e.raw)})),this.add(this._ctx.processManager.onProcessReady(()=>{this._addon?.reset()}))}_loadTypeAheadAddon(e){let t=this._configurationService.getValue(gb).localEchoEnabled,o=!!this._ctx.processManager.remoteAuthority;if(t==="off"||t==="auto"&&!o){this._addon?.dispose(),this._addon=void 0;return}this._addon||(t==="on"||t==="auto"&&o)&&(this._addon=this._instantiationService.createInstance(gIe,this._ctx.processManager),e.loadAddon(this._addon))}};lae=I([m(1,B),m(2,F)],lae);tm(lae.ID,lae);var Y7t=class extends k{constructor(e,t){super();this._container=e;this._resizeOverlayHideTimeout=this._register(new ue);this._register(t.raw.onResize(o=>this._handleDimensionsChanged(o))),this._register(ee(()=>{this._resizeOverlay?.remove(),this._resizeOverlay=void 0}))}_handleDimensionsChanged(e){let t=this._container;if(!t||!t.isConnected)return;let o=this._ensureResizeOverlay(t);o.textContent=`${e.cols} x ${e.rows}`,o.classList.add("visible"),this._resizeOverlayHideTimeout.value=Zo(()=>{this._resizeOverlay?.classList.remove("visible")},500)}_ensureResizeOverlay(e){return this._resizeOverlay?e.contains(this._resizeOverlay)||e.appendChild(this._resizeOverlay):(this._resizeOverlay=_(".terminal-resize-overlay"),this._resizeOverlay.setAttribute("role","status"),this._resizeOverlay.setAttribute("aria-live","polite"),e.appendChild(this._resizeOverlay)),this._resizeOverlay}};var X7t=class extends k{constructor(e){super();this._ctx=e;this._overlay=this._register(new ue)}static{this.ID="terminal.resizeDimensionsOverlay"}xtermOpen(e){this._ctx.processManager.ptyProcessReady.then(()=>{Li(1e3).then(()=>{this._store.isDisposed||(this._overlay.value=new Y7t(this._ctx.instance.domElement,e))})})}};tm(X7t.ID,X7t);function p_n(a){return We(a)?a:void 0}var r0o=async(a,i)=>{let e=a.get($e),t=a.get(Xp),o=a.get(Ae),n=a.get(fa),s=a.get(an).activeInstance;if(s){let c=function(g){return Di(g)&&"text"in g}(i)?p_n(i.text):void 0;if(!c){if(c=await e.input({value:"",placeHolder:"Enter sequence to send (supports \\n, \\r, \\xAB)",prompt:d(16803,null)}),!c)return;let g=c.replace(/\\n/g,`
`).replace(/\\r/g,"\r");for(;;){let f=g.match(/\\x([0-9a-fA-F]{2})/);if(f===null||f.index===void 0||f.length<2)break;g=g.slice(0,f.index)+String.fromCharCode(parseInt(f[1],16))+g.slice(f.index+4)}c=g}let u=n.getLastActiveWorkspaceRoot(s.hasRemoteAuthority?Q.vscodeRemote:Q.file),p=u?o.getWorkspaceFolder(u)??void 0:void 0,h=await t.resolveAsync(p,c);s.sendText(h,!1)}},n0o=P(16801,"Send Sequence");Wr({id:"workbench.action.terminal.sendSequence",title:n0o,f1:!0,metadata:{description:n0o.value,args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{description:d(16802,null),type:"string"}}}}]},run:(a,i,e)=>r0o(i,e)});function kw(a,i){xt.registerCommandAndKeybindingRule({id:"workbench.action.terminal.sendSequence",weight:200,when:i.when||pt.focus,primary:i.primary,mac:i.mac,linux:i.linux,win:i.win,handler:r0o,args:{text:a}})}ii&&xt.registerCommandAndKeybindingRule({id:"workbench.action.terminal.pastePwsh",weight:200,when:C.and(pt.focus,C.equals("terminalShellType","pwsh"),Oa.negate()),primary:2100,handler:async i=>{let e=i.get(Bi),t=i.get(fe);return!await e.readText()&&await e.hasResources()?t.executeCommand("workbench.action.terminal.paste"):t.executeCommand("workbench.action.terminal.sendSequence",{text:""})}});kw("\x1B[24~a",{when:C.and(pt.focus,C.equals("terminalShellType","pwsh"),pt.terminalShellIntegrationEnabled,C.equals("config.terminal.integrated.enableWin32InputMode",!0),Oa.negate()),primary:2058,mac:{primary:266}});kw("\x1B[24~b",{when:C.and(pt.focus,C.equals("terminalShellType","pwsh"),pt.terminalShellIntegrationEnabled,C.equals("config.terminal.integrated.enableWin32InputMode",!0),Oa.negate()),primary:522});kw("\x1B[24~c",{when:C.and(pt.focus,C.equals("terminalShellType","pwsh"),pt.terminalShellIntegrationEnabled,C.equals("config.terminal.integrated.enableWin32InputMode",!0),Oa.negate()),primary:1027});kw("\x1B[24~d",{when:C.and(pt.focus,C.equals("terminalShellType","pwsh"),pt.terminalShellIntegrationEnabled,C.equals("config.terminal.integrated.enableWin32InputMode",!0),Oa.negate()),mac:{primary:3089}});kw("\x1B[1;2H",{when:C.and(pt.focus,C.equals("terminalShellType","pwsh"),C.equals("config.terminal.integrated.enableWin32InputMode",!0)),mac:{primary:3087}});kw("\x1B[1;5A",{when:C.and(pt.focus),primary:528});kw("\x1B[1;5B",{when:C.and(pt.focus),primary:530});kw("\x1B"+(et?"f":"[1;5C"),{when:C.and(pt.focus),primary:529});kw("\x1B"+(et?"b":"[1;5D"),{when:C.and(pt.focus),primary:527});kw("",{when:C.and(pt.focus,Oa),primary:2608,mac:{primary:816}});kw("\x07",{when:pt.focus,primary:2597,mac:{primary:805}});Tc&&kw("",{when:C.and(pt.focus),primary:289});kw("",{primary:2049,mac:{primary:513}});ii&&kw("\b",{when:C.and(pt.focus,C.equals("terminalShellType","cmd")),primary:2049});kw("\x1Bd",{primary:2068,mac:{primary:532}});kw("",{mac:{primary:2049}});kw("",{mac:{primary:2063}});kw("",{mac:{primary:2065}});kw("\0",{primary:3095,mac:{primary:1303}});kw("",{primary:3099,mac:{primary:1307}});function m_n(a){return We(a)?a:void 0}var s0o=P(16807,"Send Signal");Wr({id:"workbench.action.terminal.sendSignal",title:s0o,f1:!ii,metadata:{description:s0o.value,args:[{name:"args",schema:{type:"object",required:["signal"],properties:{signal:{description:d(16808,null),type:"string"}}}}]},run:async(a,i,e)=>{let t=i.get($e),o=a.service.activeInstance;if(!o)return;function n(s){return Di(s)&&"signal"in s}let r=n(e)?m_n(e.signal):void 0;if(!r){let s=[{label:"SIGINT",description:d(16811,null)},{label:"SIGTERM",description:d(16815,null)},{label:"SIGKILL",description:d(16812,null)},{label:"SIGSTOP",description:d(16814,null)},{label:"SIGCONT",description:d(16809,null)},{label:"SIGHUP",description:d(16810,null)},{label:"SIGQUIT",description:d(16813,null)},{label:"SIGUSR1",description:d(16816,null)},{label:"SIGUSR2",description:d(16817,null)},{type:"separator"},{label:d(16805,null)}],l=await t.pick(s,{placeHolder:d(16806,null)});if(!l)return;if(l.label===d(16805,null)){let c=await t.input({prompt:d(16804,null)});if(!c)return;r=c}else r=l.label}await o.sendSignal(r)}});var Vpt=class{constructor(i,e){this.leadingLineContent=i;this.characterCountDelta=e}};var J7t=class{constructor(i,e,t){this._items=i;this._lineContext=e;this._rawCompareFn=t;this._refilterKind=1;this._fuzzyScoreOptions={...i4.default,firstMatchCanBeWeak:!0};this._options={}}get items(){return this._ensureCachedState(),this._filteredItems}get stats(){return this._ensureCachedState(),this._stats}get lineContext(){return this._lineContext}set lineContext(i){(this._lineContext.leadingLineContent!==i.leadingLineContent||this._lineContext.characterCountDelta!==i.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<i.characterCountDelta&&this._filteredItems?2:1,this._lineContext=i)}forceRefilterAll(){this._refilterKind=1}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){let i=[],{leadingLineContent:e,characterCountDelta:t}=this._lineContext,o="",n="",r=this._refilterKind===1?this._items:this._filteredItems,s=[],l=!this._options.filterGraceful||r.length>2e3?eM:Hxt;for(let c=0;c<r.length;c++){let u=r[c];if(u.isInvalid)continue;let p=u.completion.replacementRange?u.completion.replacementRange[1]-u.completion.replacementRange[0]:0,h=p+t;if(o.length!==h&&(o=h===0?"":e.slice(-h),n=o.toLowerCase()),u.word=o,h===0)u.score=Xv.Default;else{let g=0;for(;g<p;){let f=o.charCodeAt(g);if(f===32||f===9)g+=1;else break}if(g>=h)u.score=Xv.Default;else{let f=l(o,n,g,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!f&&o!=="")continue;u.score=f||Xv.Default}}u.idx=c,s.push(u),i.push(u.textLabel.length)}this._filteredItems=s.sort(this._rawCompareFn?.bind(void 0,e)),this._refilterKind=0,this._stats={pLabelLen:i.length?tY(i.length-.85,i,(c,u)=>c-u):0}}};function O2i(a){return`simple-suggest-aria-id-${a}`}var uGe=class{constructor(i,e,t,o,n){this._getFontInfo=i;this._onDidFontConfigurationChange=e;this._themeService=t;this._modelService=o;this._languageService=n;this._onDidToggleDetails=new T;this.onDidToggleDetails=this._onDidToggleDetails.event;this._disposables=new O;this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose(),this._disposables.dispose()}renderTemplate(i){let e=new O,t=i;t.classList.add("show-file-icons");let o=D(i,_(".icon")),n=D(o,_("span.colorspan")),r=D(i,_(".contents")),s=D(r,_(".main")),l=D(s,_(".icon-label.codicon")),c=D(s,_("span.left")),u=D(s,_("span.right")),p=new ld(c,{supportHighlights:!0,supportIcons:!0});e.add(p);let h=D(c,_("span.signature-label")),g=D(c,_("span.qualifier-label")),f=D(u,_("span.details-label")),v=()=>{let{fontFamily:S,fontSize:y,lineHeight:w,fontWeight:x,letterSpacing:E}=this._getFontInfo(),M=`${y}px`,N=`${w}px`,V=`${E}px`;t.style.fontSize=M,t.style.fontWeight=x,t.style.letterSpacing=V,s.style.fontFamily=S,s.style.fontFeatureSettings="",s.style.lineHeight=N,o.style.height=N,o.style.width=N};return v(),this._disposables.add(this._onDidFontConfigurationChange(()=>v())),{root:t,left:c,right:u,icon:o,colorspan:n,iconLabel:p,iconContainer:l,parametersLabel:h,qualifierLabel:g,detailsLabel:f,disposables:e}}renderElement(i,e,t){let{completion:o}=i;t.root.id=O2i(e),t.colorspan.style.backgroundColor="";let n={labelEscapeNewLines:!0,matches:Wa(i.score)};if(o.kindLabel==="File"&&this._themeService.getFileIconTheme().hasFileIcons){t.icon.className="icon hide",t.iconContainer.className="icon hide";let r=Ia(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),0),s=Ia(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),0);n.extraClasses=r.length>s.length?r:s}else o.kindLabel==="Folder"&&this._themeService.getFileIconTheme().hasFolderIcons?(t.icon.className="icon hide",t.iconContainer.className="icon hide",n.extraClasses=[Ia(this._modelService,this._languageService,A.from({scheme:"fake",path:i.textLabel}),1),Ia(this._modelService,this._languageService,A.from({scheme:"fake",path:o.detail}),1)].flat()):(t.icon.className="icon hide",t.iconContainer.className="",t.iconContainer.classList.add("suggest-icon",...q.asClassNameArray(o.icon||L.symbolText)));if(t.iconLabel.setLabel(i.textLabel,void 0,n),typeof o.label=="string")t.parametersLabel.textContent="",t.detailsLabel.textContent=N2i(o.detail||""),t.root.classList.add("string-label");else{let r=N2i(o.label.detail||"");t.parametersLabel.textContent=g_n(r),t.detailsLabel.textContent=N2i(o.label.description||""),t.root.classList.remove("string-label")}Xo(t.detailsLabel),t.right.classList.remove("can-expand-details")}disposeTemplate(i){i.disposables.dispose()}};uGe=I([m(2,Pe),m(3,_t),m(4,Rt)],uGe);function N2i(a){return a.replace(/\r\n|\r|\n/g,"")}var h_n=/^[\s()[\]{}<>"'`~!@#$%^&*+=,.:;?/\\|-]/;function g_n(a){return a?h_n.test(a)?a:` ${a}`:""}function F2i(a){return!!a&&!!(a.completion.documentation||a.completion.detail&&a.completion.detail!==a.completion.label)}var a0o="suggest-details";var pGe=class{constructor(i,e,t,o,n){this._getFontInfo=i;this._getAdvancedExplainModeDetails=t;this.markdownRendererService=n;this._onDidClose=new T;this.onDidClose=this._onDidClose.event;this._onDidChangeContents=new T;this.onDidChangeContents=this._onDidChangeContents.event;this._disposables=new O;this._renderDisposeable=this._disposables.add(new O);this._borderWidth=1;this._size=new di(330,0);this.domNode=_(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=_(".body"),this._scrollbar=new Ar(this._body,{alwaysConsumeMouseWheel:!0}),D(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=D(this._body,_(".header")),this._close=D(this._header,_("span"+q.asCSSSelector(L.close))),this._close.title=d(19269,null),this._close.role="button",this._close.tabIndex=-1,this._type=D(this._header,_("p.type")),this._docs=D(this._body,_("p.docs")),this._configureFont(),this._disposables.add(e(()=>this._configureFont()))}_configureFont(){let i=this._getFontInfo(),e=i.fontFamily,t=i.fontSize,o=i.lineHeight,n=i.fontWeight,r=`${t}px`,s=`${o}px`;this.domNode.style.fontSize=r,this.domNode.style.lineHeight=`${o/t}`,this.domNode.style.fontWeight=n,this._type.style.fontFamily=e,this._close.style.height=s,this._close.style.width=s}dispose(){this._disposables.dispose(),this._onDidClose.dispose(),this._onDidChangeContents.dispose()}getLayoutInfo(){let i=this._getFontInfo().lineHeight,e=this._borderWidth,t=e*2;return{lineHeight:i,borderWidth:e,borderHeight:t,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=d(19270,null),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(i,e){this._renderDisposeable.clear();let{detail:t,documentation:o}=i.completion,n="";if(e){n+=`score: ${i.score[0]}
`,n+=`prefix: ${i.word??"(no prefix)"}
`;let c=i.completion.replacementRange;if(n+=`valueSelection: ${c?`[${c[0]}, ${c[1]}]`:"undefined"}
`,n+=`index: ${i.idx}
`,this._getAdvancedExplainModeDetails){let u=this._getAdvancedExplainModeDetails();u&&(n+=`${u}
`)}t=`Provider: ${i.completion.provider}`,o=new he().appendCodeblock("empty",n)}let r=typeof t=="string"?t.trim().length>0:!!t,s=typeof o=="string"?o.trim().length>0:!!(o&&o.value?.trim().length>0),l=()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)};if(!e&&(!F2i(i)||!r&&!s)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),r&&t){let c=t.length>1e5?`${t.substr(0,1e5)}\u2026`:t;this._type.textContent=c,this._type.title=c,Xo(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(c))}else St(this._type),this._type.title="",Wi(this._type),this.domNode.classList.add("no-type");if(St(this._docs),s&&typeof o=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=o;else if(s&&o&&typeof o!="string"){this._docs.classList.add("markdown-docs"),St(this._docs);let c=this.markdownRendererService.render(o,{asyncRenderCallback:()=>{l()}});this._docs.appendChild(c.element),this._renderDisposeable.add(c)}else this._docs.classList.remove("markdown-docs");this.domNode.classList.toggle("detail-and-doc",r&&s),this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=c=>{c.preventDefault(),c.stopPropagation()},this._close.onclick=c=>{c.preventDefault(),c.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,l()}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(i,e){let t=new di(i,e);di.equals(t,this._size)||(this._size=t,PL(this.domNode,i,e)),this._scrollbar.scanDomNode()}scrollDown(i=8){this._body.scrollTop+=i}scrollUp(i=8){this._body.scrollTop-=i}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(i){this._borderWidth=i}get borderWidth(){return this._borderWidth}focus(){this.domNode.focus()}};pGe=I([m(3,F),m(4,_n)],pGe);var Z7t=class{constructor(i,e,t){this.widget=i;this._container=e;this._disposables=new O;this._added=!1;this._resizable=this._disposables.add(new uM),this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(i.domNode),this._resizable.enableSashes(!1,!0,!0,!1),this._preventPlacements=t&&t.length?new Set(t):void 0;let o,n,r=0,s=0;this._disposables.add(this._resizable.onDidWillResize(()=>{o=this._topLeft,n=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(l=>{if(o&&n){this.widget.layout(l.dimension.width,l.dimension.height);let c=!1;l.west&&(s=n.width-l.dimension.width,c=!0),l.north&&(r=n.height-l.dimension.height,c=!0),c&&this._applyTopLeft({top:o.top+r,left:o.left+s})}l.done&&(o=void 0,n=void 0,r=0,s=0,this._userSize=l.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size)}))}dispose(){this.widget.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}show(){this._added||(this._container.appendChild(this._resizable.domNode),this._added=!0)}hide(i=!1){this._resizable.clearSashHoverState(),this._added&&(this._container.removeChild(this._resizable.domNode),this._added=!1,this._anchorBox=void 0),i&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(i){let e=i.getBoundingClientRect();this._anchorBox=e,this.widget.layout(this._resizable.size.width,this._resizable.size.height),this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size)}_placeAtAnchor(i,e){let t=wh(this.getDomNode().ownerDocument.body),o=this.widget.getLayoutInfo(),n=new di(220,2*o.lineHeight),r=i.top,s=(function(){let N=t.width-(i.left+i.width+o.borderWidth+o.horizontalPadding),V=-o.borderWidth+i.left+i.width,H=new di(N,t.height-i.top-o.borderHeight-o.verticalPadding),K=H.with(void 0,i.top+i.height-o.borderHeight-o.verticalPadding);return{top:r,left:V,fit:N-e.width,maxSizeTop:H,maxSizeBottom:K,minSize:n.with(Math.min(N,n.width))}})(),l=(function(){let N=i.left-o.borderWidth-o.horizontalPadding,V=Math.max(o.horizontalPadding,i.left-e.width-o.borderWidth),H=new di(N,t.height-i.top-o.borderHeight-o.verticalPadding),K=H.with(void 0,i.top+i.height-o.borderHeight-o.verticalPadding);return{top:r,left:V,fit:N-e.width,maxSizeTop:H,maxSizeBottom:K,minSize:n.with(Math.min(N,n.width))}})(),c=(function(){let N=i.left,V=-o.borderWidth+i.top+i.height,H=new di(i.width-o.borderHeight,t.height-i.top-i.height-o.verticalPadding);return{top:V,left:N,fit:H.height-e.height,maxSizeBottom:H,maxSizeTop:H,minSize:n.with(H.width)}})(),u=(function(){let N=Math.max(i.width-o.borderHeight,0),V=i.left,H=Math.max(i.top-o.verticalPadding,0),K=Math.min(e.height,H),j=i.top-o.borderWidth-K,J=new di(N,Math.max(H,0));return{top:j,left:V,fit:J.height-e.height,maxSizeTop:J,maxSizeBottom:J,minSize:n.with(J.width)}})(),p=[[0,s],[2,c],[3,u],[1,l]],h=(this._preventPlacements?p.filter(([N])=>!this._preventPlacements.has(N)):p).map(([,N])=>N),g=h.length?h:p.map(([,N])=>N),f=g.find(N=>N.fit>=0)??g.reduce((N,V)=>!N||V.fit>N.fit?V:N,void 0)??s,v=i.top+i.height-o.borderHeight,b,S=e.height,y=Math.max(f.maxSizeTop.height,f.maxSizeBottom.height);S>y&&(S=y);let w;S<=f.maxSizeTop.height?(b=!0,w=f.maxSizeTop):(b=!1,w=f.maxSizeBottom);let{top:x,left:E}=f;!b&&S>i.height&&(x=v-S);let M=this._container;if(M){let N=M.getBoundingClientRect();x-=N.top,E-=N.left}this._applyTopLeft({left:E,top:x}),this._resizable.enableSashes(!b,f===s,b,f!==s),this._resizable.minSize=f.minSize,this._resizable.maxSize=w,this._resizable.layout(S,Math.min(w.width,e.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(i){this._topLeft=i,this._resizable.domNode.style.top=`${i.top}px`,this._resizable.domNode.style.left=`${i.left}px`,this._resizable.domNode.style.position="absolute"}};var f_n=_;var HO={HasFocusedSuggestion:new Y("simpleSuggestWidgetHasFocusedSuggestion",!1,d(19264,null)),HasNavigated:new Y("simpleSuggestWidgetHasNavigated",!1,d(19265,null)),FirstSuggestionFocused:new Y("simpleSuggestWidgetFirstSuggestionFocused",!1,d(19263,null)),ExplicitlyInvoked:new Y("simpleSuggestWidgetExplicitlyInvoked",!1,d(19262,null))};var Y1=class extends k{constructor(e,t,o,n,r,s,l,c,u,p){super();this._container=e;this._persistedSize=t;this._options=o;this._getFontInfo=n;this._onDidFontConfigurationChange=r;this._getAdvancedExplainModeDetails=s;this._instantiationService=l;this._configurationService=c;this._storageService=u;this._state=0;this._forceRenderingAbove=!1;this._explainMode=!1;this._pendingShowDetails=this._register(new ue);this._pendingLayout=this._register(new ue);this._ignoreFocusEvents=!1;this._showTimeout=this._register(new Nl);this._onDidSelect=this._register(new T);this.onDidSelect=this._onDidSelect.event;this._onDidHide=this._register(new T);this.onDidHide=this._onDidHide.event;this._onDidShow=this._register(new T);this.onDidShow=this._onDidShow.event;this._onDidFocus=new Ih;this.onDidFocus=this._onDidFocus.event;this._onDidBlurDetails=this._register(new T);this.onDidBlurDetails=this._onDidBlurDetails.event;this.element=this._register(new uM),this.element.domNode.classList.add("workbench-suggest-widget"),this._container.appendChild(this.element.domNode),this._ctxSuggestWidgetHasFocusedSuggestion=HO.HasFocusedSuggestion.bindTo(p),this._ctxSuggestWidgetHasBeenNavigated=HO.HasNavigated.bindTo(p),this._ctxFirstSuggestionFocused=HO.FirstSuggestionFocused.bindTo(p),this._ctxSuggestWidgetExplicitlyInvoked=HO.ExplicitlyInvoked.bindTo(p);class h{constructor(y,w,x=!1,E=!1){this.persistedSize=y;this.currentSize=w;this.persistHeight=x;this.persistWidth=E}}let g;this._register(this.element.onDidWillResize(()=>{g=new h(this._persistedSize.restore(),this.element.size)})),this._register(this.element.onDidResize(S=>{if(this._resize(S.dimension.width,S.dimension.height),g&&(g.persistHeight=g.persistHeight||!!S.north||!!S.south,g.persistWidth=g.persistWidth||!!S.east||!!S.west),!!S.done){if(g){let{itemHeight:y,defaultSize:w}=this._getLayoutInfo(),x=Math.round(y/2),{width:E,height:M}=this.element.size;(!g.persistHeight||Math.abs(g.currentSize.height-M)<=x)&&(M=g.persistedSize?.height??w.height),(!g.persistWidth||Math.abs(g.currentSize.width-E)<=x)&&(E=g.persistedSize?.width??w.width),this._persistedSize.store(new di(E,M))}g=void 0}}));let f=()=>this.element.domNode.classList.toggle("no-icons",!c.getValue("editor.suggest.showIcons"));f();let v=this._instantiationService.createInstance(uGe,this._getFontInfo.bind(this),this._onDidFontConfigurationChange.bind(this));this._register(v),this._listElement=D(this.element.domNode,f_n(".tree")),this._list=this._register(new Gc("SuggestWidget",this._listElement,{getHeight:()=>this._getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[v],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>ii?"listitem":"option",getWidgetAriaLabel:()=>d(19266,null),getWidgetRole:()=>"listbox",getAriaLabel:S=>{let y=S.textLabel,w=S.completion.kindLabel??"";if(typeof S.completion.label!="string"){let{detail:N,description:V}=S.completion.label;N&&V?y=d(19261,null,y,N,V,w):N?y=d(19260,null,y,N,w):V&&(y=d(19259,null,y,V,w))}else y=d(19258,null,y,w);let{documentation:x,detail:E}=S.completion,M=Wd("{0}{1}",E||"",x?typeof x=="string"?x:x.value:"");return d(19257,null,y,M)}}})),this._register(this._list.onDidChangeFocus(S=>{S.indexes.length&&S.indexes[0]!==0&&this._ctxSuggestWidgetHasBeenNavigated.set(!0)})),this._messageElement=D(this.element.domNode,_(".message"));let b=this._register(l.createInstance(pGe,this._getFontInfo.bind(this),this._onDidFontConfigurationChange.bind(this),this._getAdvancedExplainModeDetails.bind(this)));this._register(b.onDidClose(()=>this.toggleDetails())),this._details=this._register(new Z7t(b,this._listElement,this._options.preventDetailsPlacements)),this._register($(this._details.widget.domNode,"blur",S=>this._onDidBlurDetails.fire(S))),o.statusBarMenuId&&o.showStatusBarSettingId&&c.getValue(o.showStatusBarSettingId)&&(this._status=this._register(l.createInstance(z4,this.element.domNode,o.statusBarMenuId,{showIconsNoKeybindings:!0})),this.element.domNode.classList.toggle("with-status-bar",!0)),this._register(this._list.onMouseDown(S=>this._onListMouseDownOrTap(S))),this._register(this._list.onTap(S=>this._onListMouseDownOrTap(S))),this._register(this._list.onDidChangeFocus(S=>this._onListFocus(S))),this._register(this._list.onDidChangeSelection(S=>this._onListSelection(S))),this._register(this._onDidFontConfigurationChange(()=>{this._completionModel&&this._list.splice(0,this._completionModel.items.length,this._completionModel.items)})),this._register(c.onDidChangeConfiguration(S=>{if(S.affectsConfiguration("editor.suggest.showIcons")&&f(),o.statusBarMenuId&&o.showStatusBarSettingId&&S.affectsConfiguration(o.showStatusBarSettingId)){let y=c.getValue(o.showStatusBarSettingId);y&&!this._status?(this._status=this._register(l.createInstance(z4,this.element.domNode,o.statusBarMenuId,{showIconsNoKeybindings:!0})),this._status.show()):y&&this._status?this._status.show():this._status&&(this._status.element.remove(),this._status.dispose(),this._status=void 0,this._layout(void 0)),this.element.domNode.classList.toggle("with-status-bar",y)}}))}static{this.LOADING_MESSAGE=d(19267,null)}static{this.NO_SUGGESTIONS_MESSAGE=d(19268,null)}get list(){return this._list}_onListFocus(e){if(this._ignoreFocusEvents)return;if(this._state===5&&this._setState(3),!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0,this._ctxSuggestWidgetHasFocusedSuggestion.set(!1)),this._clearAriaActiveDescendant();return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);let t=e.elements[0],o=e.indexes[0];if(t!==this._focusedItem){this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(o);let n=O2i(o),r=zi().document.activeElement;r&&n?(r.setAttribute("aria-haspopup","true"),r.setAttribute("aria-autocomplete","list"),r.setAttribute("aria-activedescendant",n)):this._clearAriaActiveDescendant(),this._currentSuggestionDetails=Hn(async s=>{let l=Zo(()=>{this._isDetailsVisible()&&this._showDetails(!0,!1)},250),c=s.onCancellationRequested(()=>l.dispose());try{return await Promise.resolve()}finally{l.dispose(),c.dispose()}}),this._currentSuggestionDetails.then(()=>{o>=this._list.length||t!==this._list.element(o)||(this._ignoreFocusEvents=!0,this._list.splice(o,1,[t]),this._list.setFocus([o]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this._showDetails(!1,!1):this.element.domNode.classList.remove("docs-side"))}).catch()}this._ctxFirstSuggestionFocused.set(o===0),this._onDidFocus.fire({item:t,index:o,model:this._completionModel})}_clearAriaActiveDescendant(){let e=zi().document.activeElement;e&&(e.setAttribute("aria-haspopup","false"),e.setAttribute("aria-autocomplete","both"),e.removeAttribute("aria-activedescendant"))}setCompletionModel(e){this._completionModel=e}hasCompletions(){return this._completionModel?.items.length!==0}resetWidgetSize(){this._persistedSize.reset()}relayout(e){this._state!==0&&(this._cursorPosition=e,this._layout(this.element.size),this._afterRender())}showTriggered(e,t){this._state===0&&(this._cursorPosition=t,this._ctxSuggestWidgetExplicitlyInvoked.set(!!e),this._ctxSuggestWidgetExplicitlyInvoked.get()&&(this._loadingTimeout=Zo(()=>this._setState(1),250)))}showSuggestions(e,t,o,n){this._cursorPosition=n,this._loadingTimeout?.dispose();let r=this._options?.selectionModeSettingId?this._configurationService.getValue(this._options.selectionModeSettingId):void 0,s=!this._ctxSuggestWidgetExplicitlyInvoked.get()&&r==="never";if(t&&this._state!==2&&this._state!==0){this._setState(4);return}if((this._completionModel?.items.length??0)===0){this._setState(o?0:2),this._completionModel=void 0;return}this._list.splice(0,this._list.length,this._completionModel?.items??[]),this._setState(t?4:3),this._list.reveal(e,0),this._list.setFocus(s?[]:[e]),this._pendingLayout.value=Cg(Me(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size)}),this._updateListStyles(),this._afterRender()}_updateListStyles(){if(this._options.selectionModeSettingId){let e=this._configurationService.getValue(this._options.selectionModeSettingId),t=!this._ctxSuggestWidgetExplicitlyInvoked.get()&&e==="partial";this._list.style(l0o(t)),this.element.domNode.classList.toggle("partial-selection",t)}}setLineContext(e){this._completionModel&&(this._completionModel.lineContext=e)}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:this._status&&Wi(this._status.element),Wi(this._listElement),Wi(this._messageElement),Wi(this.element.domNode),this._details.hide(!0),this._status?.hide(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=Y1.LOADING_MESSAGE,Wi(this._listElement),this._status&&Wi(this._status.element),Xo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Er(Y1.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Y1.NO_SUGGESTIONS_MESSAGE,Wi(this._listElement),this._status&&Wi(this._status.element),Xo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Er(Y1.NO_SUGGESTIONS_MESSAGE);break;case 3:Wi(this._messageElement),this._showListAndStatus(),this._show();break;case 4:Wi(this._messageElement),this._showListAndStatus(),this._show();break;case 5:Wi(this._messageElement),this._showListAndStatus(),this._details.show(),this._show();break}}_showListAndStatus(){this._status?Xo(this._listElement,this._status.element):Xo(this._listElement)}_show(){this._status?.show(),Xo(this.element.domNode),this._layout(this._persistedSize.restore()),this._onDidShow.fire(this),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible")},100)}toggleDetailsFocus(){this._state===5?(this._list.setFocus(this._list.getFocus()),this._setState(3)):this._state===3&&(this._setState(5),this._isDetailsVisible()?this._details.widget.focus():this.toggleDetails(!0))}toggleDetails(e=!1){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(F2i(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._setDetailsVisible(!0),this._showDetails(!1,e))}_showDetails(e,t){this._pendingShowDetails.value=Cg(Me(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let o=!1;e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details"),t&&(this._details.widget.focus(),o=!0))})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this._showDetails(!1,!1):this.toggleDetails())}hide(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout?.dispose(),this._ctxSuggestWidgetHasBeenNavigated.reset(),this._ctxFirstSuggestionFocused.reset(),this._ctxSuggestWidgetExplicitlyInvoked.reset(),this._setState(0),this._onDidHide.fire(this),Wi(this.element.domNode),this.element.clearSashHoverState();let e=this._persistedSize.restore(),t=Math.ceil(this._getLayoutInfo().itemHeight*4.3);e&&e.height<t&&this._persistedSize.store(e.with(void 0,t))}_layout(e){if(!this._cursorPosition)return;let t=wh(this._container.ownerDocument.body),o=this._getLayoutInfo();e||(e=o.defaultSize);let n=e.height,r=e.width;this._status&&(this._status.element.style.height=`${o.itemHeight}px`);let s=t.width-o.borderHeight-2*o.horizontalPadding;r>s&&(r=s);let l=this._completionModel?this._completionModel.stats.pLabelLen*o.typicalHalfwidthCharacterWidth:r,c=Math.min(this._list.contentHeight,o.itemHeight*12),u=o.statusBarHeight+c+this._messageElement.clientHeight+o.borderHeight,p=o.itemHeight+o.statusBarHeight,h=ur(this._container),g={top:this._cursorPosition.top-h.top,left:this._cursorPosition.left,height:this._cursorPosition.height},f=h.top+g.top+g.height,v=Math.min(t.height-f-o.verticalPadding,u),b=h.top+g.top-o.verticalPadding,S=Math.min(b,u),y=Math.min(Math.max(S,v)+o.borderHeight,u);n===this._cappedHeight?.capped&&(n=this._cappedHeight.wanted),n<p&&(n=p),n>y&&(n=y),n>v&&S>v||this._forceRenderingAbove&&b>150?(this._preference=0,this.element.enableSashes(!0,!0,!1,!1),y=S):(this._preference=1,this.element.enableSashes(!1,!0,!0,!1),y=v),this.element.preferredSize=new di(l,o.defaultSize.height),this.element.maxSize=new di(s,y),this.element.minSize=new di(220,p),this._cappedHeight=n===u?{wanted:this._cappedHeight?.wanted??e.height,capped:n}:void 0;let x=this._cursorPosition.left;x+r>t.width&&(x=this._cursorPosition.left-r),this.element.domNode.style.left=`${x}px`,this._preference===0?this.element.domNode.style.top=`${this._cursorPosition.top-n-o.borderHeight}px`:this.element.domNode.style.top=`${this._cursorPosition.top+this._cursorPosition.height}px`,this._resize(r,n)}_afterRender(){this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_resize(e,t){let{width:o,height:n}=this.element.maxSize;e=Math.min(o,e),n&&(t=Math.min(n,t));let{statusBarHeight:r}=this._getLayoutInfo();this._list.layout(t-r,e),this._listElement.style.height=`${t-r}px`,this._listElement.style.width=`${e}px`,this.element.layout(t,e),this._cursorPosition&&this._preference===0&&(this.element.domNode.style.top=`${this._cursorPosition.top-t}px`),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode)}_getLayoutInfo(){let e=this._getFontInfo(),t=jn(e.lineHeight,8,1e3),o=!this._options.statusBarMenuId||!this._options.showStatusBarSettingId||!this._configurationService.getValue(this._options.showStatusBarSettingId)||this._state===2||this._state===1?0:t,n=this._details.widget.borderWidth,r=2*n;return{itemHeight:t,statusBarHeight:o,borderWidth:n,borderHeight:r,typicalHalfwidthCharacterWidth:10,verticalPadding:22,horizontalPadding:14,defaultSize:new di(430,o+12*t+r)}}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){let o=this._completionModel;o&&this._onDidSelect.fire({item:e,index:t,model:o})}selectNext(){this._clearPartialSelectionState(),this._list.focusNext(1,!0);let e=this._list.getFocus();return e.length>0&&this._list.reveal(e[0]),!0}selectNextPage(){this._clearPartialSelectionState(),this._list.focusNextPage();let e=this._list.getFocus();return e.length>0&&this._list.reveal(e[0]),!0}selectPrevious(){this._clearPartialSelectionState(),this._list.focusPrevious(1,!0);let e=this._list.getFocus();return e.length>0&&this._list.reveal(e[0]),!0}selectPreviousPage(){this._clearPartialSelectionState(),this._list.focusPreviousPage();let e=this._list.getFocus();return e.length>0&&this._list.reveal(e[0]),!0}_clearPartialSelectionState(){this._list.style(l0o(!1)),this.element.domNode.classList.remove("partial-selection")}getFocusedItem(){if(this._completionModel)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};Y1=I([m(6,F),m(7,B),m(8,de),m(9,X)],Y1);function l0o(a){return a?WS({listInactiveFocusOutline:Kc,listInactiveFocusForeground:Mgi}):WS({listInactiveFocusBackground:Pgi,listInactiveFocusOutline:la})}var tYt=class extends J7t{constructor(i,e){super(i,e,v_n)}},v_n=(a,i,e)=>{if(i.completion.kind===101&&i.completion.kind!==e.completion.kind)return-1;if(e.completion.kind===101&&i.completion.kind!==e.completion.kind)return 1;let t=e.score[0]-i.score[0];if(t!==0)return t;if(i.completion.kind===100&&i.completion.kind!==e.completion.kind)return-1;if(e.completion.kind===100&&i.completion.kind!==e.completion.kind)return 1;if(i.punctuationPenalty!==e.punctuationPenalty)return i.punctuationPenalty-e.punctuationPenalty;if(!a.includes(" ")&&i.completion.kind===0&&e.completion.kind===0){if(i.labelLowExcludeFileExt!==e.labelLowExcludeFileExt)return i.labelLowExcludeFileExt.localeCompare(e.labelLowExcludeFileExt,void 0,{ignorePunctuation:!0});if(t=i.labelLowExcludeFileExt.length-e.labelLowExcludeFileExt.length,t!==0||(t=c0o(e.fileExtLow)-c0o(i.fileExtLow),t!==0)||(t=i.fileExtLow.length-e.fileExtLow.length,t!==0))return t}if(i.completion.kind===4&&e.completion.kind===4&&/^\s*git\b/.test(a)){let n=We(i.completion.label)?i.completion.label:i.completion.label.label,r=We(e.completion.label)?e.completion.label:e.completion.label.label,s=n==="main"||n==="master",l=r==="main"||r==="master";if(s&&!l)return-1;if(l&&!s)return 1}if(i.completion.kind===2&&e.completion.kind===2&&(!We(i.completion.label)&&i.completion.label.description&&!We(e.completion.label)&&e.completion.label.description?t=0:!We(i.completion.label)&&i.completion.label.description?t=-2:!We(e.completion.label)&&e.completion.label.description&&(t=2),t+=(e.completion.detail?1:0)+(e.completion.documentation?2:0)-(i.completion.detail?1:0)-(i.completion.documentation?2:0),t!==0))return t;if(i.completion.kind===1&&e.completion.kind===1&&i.labelLowNormalizedPath&&e.labelLowNormalizedPath){if(t=rT(i.labelLowNormalizedPath,"/")-rT(e.labelLowNormalizedPath,"/"),t!==0)return t;if(e.labelLowNormalizedPath.startsWith(i.labelLowNormalizedPath))return-1;if(i.labelLowNormalizedPath.startsWith(e.labelLowNormalizedPath))return 1}if(i.completion.kind!==e.completion.kind){if((i.completion.kind===2||i.completion.kind===3)&&e.completion.kind!==2&&e.completion.kind!==3)return-1;if((e.completion.kind===2||e.completion.kind===3)&&i.completion.kind!==2&&i.completion.kind!==3)return 1;if(i.completion.kind===4&&e.completion.kind!==4)return-1;if(e.completion.kind===4&&i.completion.kind!==4||eYt(i.completion.kind)&&!eYt(e.completion.kind))return 1;if(eYt(e.completion.kind)&&!eYt(i.completion.kind))return-1}return i.labelLow.localeCompare(e.labelLow,void 0,{ignorePunctuation:!0})},eYt=a=>a===0||a===1||a===8||a===9,b_n=new Map(ii?[["ps1",.09],["exe",.08],["bat",.07],["cmd",.07],["msi",.06],["com",.06],["sh",-.05],["bash",-.05],["zsh",-.05],["fish",-.05],["csh",-.06],["ksh",-.06]]:[["ps1",.05],["bat",-.05],["cmd",-.05],["exe",-.05],["sh",.05],["bash",.05],["zsh",.05],["fish",.05],["csh",.04],["ksh",.04],["py",.05],["pl",.05]]);function c0o(a){return b_n.get(a)||0}var mGe=class extends k{constructor(e,t,o){super();this._promptInputModel=t;this._telemetryService=o;this._kindMap=new Map([[0,"File"],[1,"Folder"],[2,"Method"],[3,"Alias"],[4,"Argument"],[5,"Option"],[6,"Option Value"],[7,"Flag"],[100,"Inline Suggestion"],[101,"Inline Suggestion"]]);this._register(e.onCommandFinished(n=>{this._sendTelemetryInfo(!1,n.exitCode),this._acceptedCompletions=void 0})),this._register(this._promptInputModel.onDidInterrupt(()=>{this._sendTelemetryInfo(!0),this._acceptedCompletions=void 0}))}acceptCompletion(e,t,o){if(!t||!o){this._acceptedCompletions=void 0;return}this._acceptedCompletions=this._acceptedCompletions||[],this._acceptedCompletions.push({label:We(t.label)?t.label:t.label.label,kind:this._kindMap.get(t.kind),sessionId:e,provider:t.provider})}logCompletionLatency(e,t,o){this._telemetryService.publicLog2("terminal.suggest.completionLatency",{terminalSessionId:e,latency:t,firstWindow:o.window,firstShell:o.shell})}_sendTelemetryInfo(e,t){let o=this._promptInputModel?.value;for(let n of this._acceptedCompletions||[]){let r=n?.label,s=n?.kind,l=n?.provider;if(r===void 0||o===void 0||s===void 0||l===void 0)return;let c;e?c="Interrupted":o.trim()&&o.includes(r)?c="Accepted":S_n(o,r)?c="AcceptedWithEdit":c="Deleted",this._telemetryService.publicLog2("terminal.suggest.acceptedCompletion",{kind:s,outcome:c,exitCode:t,terminalSessionId:n.sessionId,provider:l})}}};mGe=I([m(2,_e)],mGe);function S_n(a,i){return a.includes(i.substring(0,Math.ceil(i.length/2)))}var I_n=te("terminalSymbolIcon.flagForeground",uui,d(16884,null)),y_n=te("terminalSymbolIcon.aliasForeground",mui,d(16878,null)),w_n=te("terminalSymbolIcon.optionValueForeground",Veo,d(16882,null)),C_n=te("terminalSymbolIcon.methodForeground",mui,d(16887,null)),x_n=te("terminalSymbolIcon.argumentForeground",Beo,d(16879,null)),k_n=te("terminalSymbolIcon.optionForeground",uui,d(16888,null)),E_n=te("terminalSymbolIcon.inlineSuggestionForeground",null,d(16886,null)),T_n=te("terminalSymbolIcon.fileForeground",XB,d(16883,null)),__n=te("terminalSymbolIcon.folderForeground",pui,d(16885,null)),D_n=te("terminalSymbolIcon.commitForeground",XB,d(16881,null)),R_n=te("terminalSymbolIcon.branchForeground",XB,d(16880,null)),L_n=te("terminalSymbolIcon.tagForeground",XB,d(16896,null)),M_n=te("terminalSymbolIcon.stashForeground",XB,d(16892,null)),P_n=te("terminalSymbolIcon.remoteForeground",XB,d(16891,null)),A_n=te("terminalSymbolIcon.pullRequestForeground",XB,d(16890,null)),N_n=te("terminalSymbolIcon.pullRequestDoneForeground",XB,d(16889,null)),O_n=te("terminalSymbolIcon.symbolicLinkFileForeground",XB,d(16893,null)),F_n=te("terminalSymbolIcon.symbolicLinkFolderForeground",pui,d(16894,null)),W_n=te("terminalSymbolIcon.symbolText",XB,d(16895,null)),d0o=Oe("terminal-symbol-flag",L.flag,d(16876,null),I_n),u0o=Oe("terminal-symbol-alias",L.symbolMethod,d(16871,null),y_n),p0o=Oe("terminal-symbol-option-value",L.symbolEnumMember,d(16900,null),w_n),m0o=Oe("terminal-symbol-method",L.symbolMethod,d(16898,null),C_n),h0o=Oe("terminal-symbol-argument",L.symbolVariable,d(16872,null),x_n),g0o=Oe("terminal-symbol-option",L.symbolEnum,d(16899,null),k_n),W2i=Oe("terminal-symbol-inline-suggestion",L.star,d(16897,null),E_n),f0o=Oe("terminal-symbol-file",L.symbolFile,d(16875,null),T_n),v0o=Oe("terminal-symbol-folder",L.symbolFolder,d(16877,null),__n),b0o=Oe("terminal-symbol-commit",L.gitCommit,d(16874,null),D_n),S0o=Oe("terminal-symbol-branch",L.gitBranch,d(16873,null),R_n),I0o=Oe("terminal-symbol-tag",L.tag,d(16908,null),L_n),y0o=Oe("terminal-symbol-stash",L.gitStash,d(16904,null),M_n),w0o=Oe("terminal-symbol-remote",L.remote,d(16903,null),P_n),C0o=Oe("terminal-symbol-pull-request",L.gitPullRequest,d(16902,null),A_n),x0o=Oe("terminal-symbol-pull-request-done",L.gitPullRequestDone,d(16901,null),N_n),k0o=Oe("terminal-symbol-symbolic-link-file",L.fileSymlinkFile,d(16905,null),O_n),E0o=Oe("terminal-symbol-symbolic-link-folder",L.fileSymlinkDirectory,d(16906,null),F_n),T0o=Oe("terminal-symbol-symbol-text",L.symbolKey,d(16907,null),W_n);var _0o="terminal.suggest.increasedDiscoverability",D0o="terminal.suggest.increasedDiscoverabilityCount",V_n=10,B_n=1e4,hGe=class extends k{constructor(e,t,o){super();this._shellType=e;this._storageService=t;this._extensionService=o;this._firstShownTracker=void 0;this._done=this._storageService.getBoolean(_0o,-1,!1),this._count=this._storageService.getNumber(D0o,-1,0),this._register(this._extensionService.onWillStop(()=>this._firstShownTracker=void 0))}get done(){return this._done}resetState(){this._done=!1,this._count=0,this._start=void 0,this._firstShownTracker=void 0}resetTimer(){this._timeout&&(this._timeout.cancel(),this._timeout=void 0),this._start=void 0}update(e){this._done||(this._count++,this._storageService.store(D0o,this._count,-1,0),e&&!e.classList.contains("increased-discoverability")&&e.classList.add("increased-discoverability"),this._count>=V_n?this._setDone(e):this._start||(this.resetTimer(),this._start=Date.now(),this._timeout=this._register(new Nl(()=>{this._setDone(e)},B_n))))}_setDone(e){this._done=!0,this._storageService.store(_0o,!0,-1,0),e&&e.classList.remove("increased-discoverability"),this._timeout&&(this._timeout.cancel(),this._timeout=void 0),this._start=void 0}getFirstShown(e){if(!this._firstShownTracker)return this._firstShownTracker={window:!0,shell:new Set([e])},{window:!0,shell:!0};let t=this._firstShownTracker.window,o=!this._firstShownTracker.shell.has(e);return(t||o)&&this.updateShown(),{window:t,shell:o}}updateShown(){!this._shellType||!this._firstShownTracker||(this._firstShownTracker.window=!1,this._firstShownTracker.shell.add(this._shellType))}};hGe=I([m(1,de),m(2,lt)],hGe);function R0o(a){return a?a==="bash"||a==="zsh"||a==="fish"||a==="pwsh"||a==="gitbash":!1}var sj=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._sessionId=e;this._capabilities=o;this._terminalSuggestWidgetVisibleContextKey=n;this._terminalCompletionService=r;this._configurationService=s;this._instantiationService=l;this._terminalConfigurationService=c;this._logService=u;this._promptInputModelSubscriptions=this._register(new ue);this._enableWidget=!0;this._isFilteringDirectories=!1;this._cursorIndexDelta=0;this._requestedCompletionsIndex=0;this._lastUserDataTimestamp=0;this._ignoreFocusEvents=!1;this._requestCompletionsOnNextSync=!1;this.isPasting=!1;this._onBell=this._register(new T);this.onBell=this._onBell.event;this._onAcceptedCompletion=this._register(new T);this.onAcceptedCompletion=this._onAcceptedCompletion.event;this._onDidReceiveCompletions=this._register(new T);this.onDidReceiveCompletions=this._onDidReceiveCompletions.event;this._onDidFontConfigurationChange=this._register(new T);this.onDidFontConfigurationChange=this._onDidFontConfigurationChange.event;this._kindToIconMap=new Map([[0,f0o],[1,v0o],[8,k0o],[9,E0o],[2,m0o],[3,u0o],[4,h0o],[5,g0o],[6,p0o],[7,d0o],[10,b0o],[11,S0o],[12,I0o],[13,y0o],[14,w0o],[15,C0o],[16,x0o],[100,W2i],[101,W2i]]);this._kindToKindLabelMap=new Map([[0,d(16856,null)],[1,d(16858,null)],[8,d(16868,null)],[9,d(16869,null)],[2,d(16861,null)],[3,d(16852,null)],[4,d(16853,null)],[5,d(16862,null)],[6,d(16863,null)],[7,d(16857,null)],[10,d(16855,null)],[11,d(16854,null)],[12,d(16870,null)],[13,d(16867,null)],[14,d(16866,null)],[15,d(16864,null)],[16,d(16865,null)],[100,d(16859,null)],[101,d(16860,null)]]);this._inlineCompletion={label:"",inputData:"\x1B[C",replacementRange:[0,0],provider:"core:inlineSuggestion",detail:"Inline suggestion",kind:100,kindLabel:"Inline suggestion",icon:this._kindToIconMap.get(100)};this._inlineCompletionItem=new ARe(this._inlineCompletion);this._shouldSyncWhenReady=!1;if(this.shellType=t,this.shellType)this._shellTypeInit=Promise.resolve();else{let p=this._register(new ky),h=this._register(new Nl);this._shellTypeInit=new Promise(g=>{p.cancelAndSet(()=>{this.shellType&&g()},50),h.cancelAndSet(g,5e3)}).then(()=>{this._store.delete(p),this._store.delete(h)})}this._register(U.runAndSubscribe(this._capabilities.onDidChangeCapabilities,()=>{let p=this._capabilities.get(2);p?this._promptInputModel!==p.promptInputModel&&(this._promptInputModel=p.promptInputModel,this._suggestTelemetry=this._register(this._instantiationService.createInstance(mGe,p,this._promptInputModel)),this._promptInputModelSubscriptions.value=Fn(this._promptInputModel.onDidChangeInput(h=>this._sync(h)),this._promptInputModel.onDidFinishInput(()=>{this.hideSuggestWidget(!0)})),this._shouldSyncWhenReady&&(this._sync(this._promptInputModel),this._shouldSyncWhenReady=!1)):this._promptInputModel=void 0})),this._register(this._terminalConfigurationService.onConfigChanged(()=>this._cachedFontInfo=void 0)),this._register(U.runAndSubscribe(this._configurationService.onDidChangeConfiguration,p=>{if(!p||p.affectsConfiguration("terminal.integrated.suggest.inlineSuggestion")){let h=this._configurationService.getValue(aG).inlineSuggestion;this._inlineCompletionItem.isInvalid=h==="off",h==="alwaysOnTopExceptExactMatch"?this._inlineCompletion.kind=100:this._inlineCompletion.kind=101,this._model?.forceRefilterAll()}}))}static{this.lastAcceptedCompletionTimestamp=0}activate(e){this._terminal=e,this._register(e.onKey(async t=>{this._lastUserData=t.key,this._lastUserDataTimestamp=Date.now()})),this._register(e.onScroll(()=>this.hideSuggestWidget(!0))),this._register(e.onResize(()=>this._relayoutOnResize()))}async _handleCompletionProviders(e,t,o){if(this._logService.trace("SuggestAddon#_handleCompletionProviders"),!e?.element||!this._enableWidget||!this._promptInputModel||!Is(e.element))return;await this._shellTypeInit;let n=!1;if(this._promptInputModel.value!==""&&this._lastUserDataTimestamp<sj.lastAcceptedCompletionTimestamp&&(n=!0),this._currentPromptInputState={value:this._promptInputModel.value,prefix:this._promptInputModel.prefix,suffix:this._promptInputModel.suffix,cursorIndex:this._promptInputModel.cursorIndex,ghostTextIndex:this._promptInputModel.ghostTextIndex},this._requestedCompletionsIndex=this._currentPromptInputState.cursorIndex,o&&this._container){let S=this._ensureSuggestWidget(e),y=this._getCursorPosition(e);y&&S.showTriggered(!0,y)}let r=ayi(this._configurationService.getValue(aG).quickSuggestions),s=o||r.unknown==="on";this._logService.trace("SuggestAddon#_handleCompletionProviders provideCompletions");let l=this._mostRecentPromptInputState?.ghostTextIndex===void 0?-1:this._mostRecentPromptInputState?.ghostTextIndex,c=l>-1?this._currentPromptInputState.value.substring(0,l):this._currentPromptInputState.value,u=await this._terminalCompletionService.provideCompletions(c,this._currentPromptInputState.cursorIndex,s,this.shellType,this._capabilities,t,!1,n,o);if(this._logService.trace("SuggestAddon#_handleCompletionProviders provideCompletions done"),t.isCancellationRequested)return;this._onDidReceiveCompletions.fire(),this._cursorIndexDelta=this._promptInputModel.cursorIndex-this._requestedCompletionsIndex,this._leadingLineContent=this._promptInputModel.prefix.substring(0,this._requestedCompletionsIndex+this._cursorIndexDelta);let p=u?.flat()||[];if(!o&&!p.length){this.hideSuggestWidget(!0);return}let h=this._leadingLineContent.length===0?"":this._leadingLineContent[0];(this._leadingLineContent.includes(" ")||h==="[")&&(this._leadingLineContent=this._promptInputModel.prefix);let g=this._leadingLineContent;if(this._isFilteringDirectories=p.some(S=>S.kind===1),this._isFilteringDirectories){let S=p.find(x=>x.kind===1),w=(We(S?.label)?S.label:S?.label.label)?.match(/(?<sep>[\\\/])/)?.groups?.sep;w&&(this._pathSeparator=w),this._pathSeparator&&(g=L0o(g,this._pathSeparator))}this._refreshInlineCompletion(p);for(let S of p)S.icon||(S.kind!==void 0?(S.icon=this._kindToIconMap.get(S.kind),S.kindLabel=this._kindToKindLabelMap.get(S.kind)):S.icon=T0o);let f=new Vpt(g,this._cursorIndexDelta),v=p.filter(S=>!!S.label).map(S=>new ARe(S,this._pathSeparator));R0o(this.shellType)&&v.push(this._inlineCompletionItem),this._logService.trace("TerminalCompletionService#_collectCompletions create model");let b=new tYt(v,f);if(this._logService.trace("TerminalCompletionService#_collectCompletions create model done"),t.isCancellationRequested){this._completionRequestTimestamp=void 0;return}this._showCompletions(b,o)}setContainerWithOverflow(e){let t=this._container!==e,o=this._suggestWidget?.element.domNode.parentElement!==e;!t&&!o||(this._container=e,this._suggestWidget&&e.appendChild(this._suggestWidget.element.domNode))}setScreen(e){this._screen=e}toggleExplainMode(){this._suggestWidget?.toggleExplainMode()}toggleSuggestionFocus(){this._suggestWidget?.toggleDetailsFocus()}toggleSuggestionDetails(){this._suggestWidget?.toggleDetails()}resetWidgetSize(){this._suggestWidget?.resetWidgetSize()}async requestCompletions(e){if(this._logService.trace("SuggestAddon#requestCompletions"),!this._promptInputModel){this._shouldSyncWhenReady=!0;return}if(this.isPasting)return;this._cancellationTokenSource&&(this._cancellationTokenSource.cancel(),this._cancellationTokenSource.dispose()),this._cancellationTokenSource=new qe;let t=this._cancellationTokenSource.token;this._completionRequestTimestamp=Date.now(),await this._handleCompletionProviders(this._terminal,t,e),this._terminalSuggestWidgetVisibleContextKey.get()||(this._completionRequestTimestamp=void 0)}_addPropertiesToInlineCompletionItem(e){let t=(We(this._inlineCompletionItem.completion.label)?this._inlineCompletionItem.completion.label:this._inlineCompletionItem.completion.label.label).trim(),o=e.findIndex(n=>We(n.label)?n.label===t:n.label.label===t);if(o!==-1){let n=e.splice(o,1)[0];this._inlineCompletionItem.completion.label=n.label,this._inlineCompletionItem.completion.detail=n.detail,this._inlineCompletionItem.completion.documentation=n.documentation}else this._inlineCompletionItem.completion&&(this._inlineCompletionItem.completion.detail=void 0,this._inlineCompletionItem.completion.documentation=void 0)}_requestTriggerCharQuickSuggestCompletions(){return!this._wasLastInputVerticalArrowKey()&&!this._wasLastInputTabKey()&&(!this._wasLastInputIncludedEscape()||this._terminalSuggestWidgetVisibleContextKey.get())?(this.requestCompletions(),!0):!1}_checkProviderTriggerCharacters(e){for(let t of this._terminalCompletionService.providers)if(t.triggerCharacters){for(let o of t.triggerCharacters)if(e===o)return!0}return!1}_wasLastInputRightArrowKey(){return!!this._lastUserData?.match(/^\x1b[\[O]?C$/)}_wasLastInputVerticalArrowKey(){return!!this._lastUserData?.match(/^\x1b[\[O]?[A-B]$/)}_wasLastInputIncludedEscape(){return!!this._lastUserData?.includes("\x1B")}_wasLastInputArrowKey(){return!!this._lastUserData?.match(/^\x1b[\[O]?[A-D]$/)}_wasLastInputTabKey(){return this._lastUserData==="	"}_sync(e){let t=this._configurationService.getValue(aG),o=ayi(t.quickSuggestions);{let s=!1;if(this._requestCompletionsOnNextSync&&(this._requestCompletionsOnNextSync=!1,s=this._requestTriggerCharQuickSuggestCompletions()),!this._mostRecentPromptInputState||e.cursorIndex>this._mostRecentPromptInputState.cursorIndex){if(!this._terminalSuggestWidgetVisibleContextKey.get()){let l=e.prefix.trim().match(/\s/);(!l&&o.commands==="on"||l&&o.arguments==="on")&&e.prefix.match(/[^\s]$/)&&(s=this._requestTriggerCharQuickSuggestCompletions())}if(t.suggestOnTriggerCharacters&&!s){let l=e.prefix;if((l?.match(/\s[\-]$/)||this._isFilteringDirectories&&l?.match(/[\\\/]$/))&&(s=this._requestTriggerCharQuickSuggestCompletions()),!s){for(let c of this._terminalCompletionService.providers)if(c.triggerCharacters){for(let u of c.triggerCharacters)if(l?.endsWith(u)){s=this._requestTriggerCharQuickSuggestCompletions();break}}}}}if(this._mostRecentPromptInputState&&e.cursorIndex<this._mostRecentPromptInputState.cursorIndex&&e.cursorIndex>0&&this._terminalSuggestWidgetVisibleContextKey.get()&&t.suggestOnTriggerCharacters&&!s&&this._mostRecentPromptInputState.cursorIndex>0){let l=this._mostRecentPromptInputState.value[this._mostRecentPromptInputState.cursorIndex-1];l&&(this._isFilteringDirectories&&l.match(/[\\\/]$/)||this._checkProviderTriggerCharacters(l))&&(s=this._requestTriggerCharQuickSuggestCompletions())}}if(this._wasLastInputRightArrowKey()&&this._mostRecentPromptInputState?.ghostTextIndex!==-1&&e.ghostTextIndex===-1&&this._mostRecentPromptInputState?.value===e.value&&this.hideSuggestWidget(!1),this._mostRecentPromptInputState=e,!this._promptInputModel||!this._terminal||!this._suggestWidget||this._leadingLineContent===void 0)return;let n=this._currentPromptInputState;if(this._currentPromptInputState=e,this._currentPromptInputState.cursorIndex>1&&this._currentPromptInputState.value.at(this._currentPromptInputState.cursorIndex-1)===" "&&!this._wasLastInputArrowKey()){this.hideSuggestWidget(!1);return}if(this._currentPromptInputState&&this._currentPromptInputState.cursorIndex<this._leadingLineContent.length&&(this._currentPromptInputState.cursorIndex<=0||n?.value[this._currentPromptInputState.cursorIndex]?.match(/[\\\/\s]/))){this.hideSuggestWidget(!1);return}if(this._terminalSuggestWidgetVisibleContextKey.get()){this._cursorIndexDelta=this._currentPromptInputState.cursorIndex-this._requestedCompletionsIndex;let s=this._currentPromptInputState.value.substring(0,this._requestedCompletionsIndex+this._cursorIndexDelta);this._isFilteringDirectories&&this._pathSeparator&&(s=L0o(s,this._pathSeparator));let l=new Vpt(s,this._cursorIndexDelta);this._suggestWidget.setLineContext(l)}if(this._refreshInlineCompletion(this._model?.items.map(s=>s.completion)||[]),!this._suggestWidget.hasCompletions()){this.hideSuggestWidget(!1);return}let r=this._getCursorPosition(this._terminal);r&&this._suggestWidget.showSuggestions(0,!1,!0,r)}_refreshInlineCompletion(e){if(!R0o(this.shellType))return;let t=this._inlineCompletionItem.isInvalid;if(!this._currentPromptInputState||this._currentPromptInputState.ghostTextIndex===-1)this._inlineCompletionItem.isInvalid=!0;else{this._inlineCompletionItem.isInvalid=!1;let o=this._currentPromptInputState.value.lastIndexOf(" ",this._currentPromptInputState.ghostTextIndex-1),n=o===-1?0:o+1,r=this._currentPromptInputState.value.substring(n);this._inlineCompletion.label=r;let s=this._currentPromptInputState.cursorIndex-this._cursorIndexDelta;this._inlineCompletion.replacementRange=[n,s],this._addPropertiesToInlineCompletionItem(e);let l=new ARe(this._inlineCompletion,this._pathSeparator);this._inlineCompletionItem.idx=l.idx,this._inlineCompletionItem.score=l.score,this._inlineCompletionItem.labelLow=l.labelLow,this._inlineCompletionItem.textLabel=l.textLabel,this._inlineCompletionItem.fileExtLow=l.fileExtLow,this._inlineCompletionItem.labelLowExcludeFileExt=l.labelLowExcludeFileExt,this._inlineCompletionItem.labelLowNormalizedPath=l.labelLowNormalizedPath,this._inlineCompletionItem.punctuationPenalty=l.punctuationPenalty,this._inlineCompletionItem.word=l.word,this._model?.forceRefilterAll()}this._inlineCompletionItem.isInvalid!==t&&this._model?.forceRefilterAll()}_getTerminalDimensions(){let e=this._terminal._core._renderService.dimensions.css.cell;return{width:e.width,height:e.height}}_getCursorPosition(e){let t=this._getTerminalDimensions();if(!t.width||!t.height)return;let o=this._screen.getBoundingClientRect();return{left:o.left+e.buffer.active.cursorX*t.width,top:o.top+e.buffer.active.cursorY*t.height,height:t.height}}_getFontInfo(){if(this._cachedFontInfo)return this._cachedFontInfo;let e=this._terminal._core,t=this._terminalConfigurationService.getFont(zi(),e),o=t.lineHeight,n=t.fontSize,r=t.fontFamily,s=t.letterSpacing,l=this._configurationService.getValue("editor.fontWeight");o=o*n,o=Math.round(o);let c=qoi*n;o<c&&(o=c);let u={fontSize:n,lineHeight:o,fontWeight:l.toString(),letterSpacing:s,fontFamily:r};return this._cachedFontInfo=u,u}_getAdvancedExplainModeDetails(){return`promptInputModel: ${this._promptInputModel?.getCombinedString()}`}_showCompletions(e,t){if(this._logService.trace("SuggestAddon#_showCompletions"),!this._terminal?.element||!this._container)return;let o=this._ensureSuggestWidget(this._terminal);if(this._logService.trace("SuggestAddon#_showCompletions setCompletionModel"),o.setCompletionModel(e),this._register(o.onDidFocus(()=>this._terminal?.focus())),!this._promptInputModel||!t&&e.items.length===0)return;this._model=e;let n=this._getCursorPosition(this._terminal);if(n){if(this._completionRequestTimestamp!==void 0){let r=Date.now()-this._completionRequestTimestamp;if(this._suggestTelemetry&&this._discoverability){let s=this._discoverability.getFirstShown(this.shellType);this._discoverability.updateShown(),this._suggestTelemetry.logCompletionLatency(this._sessionId,r,s)}this._completionRequestTimestamp=void 0}this._logService.trace("SuggestAddon#_showCompletions suggestWidget.showSuggestions"),o.showSuggestions(0,!1,!t,n)}}_ensureSuggestWidget(e){return this._suggestWidget||(this._suggestWidget=this._register(this._instantiationService.createInstance(Y1,this._container,this._instantiationService.createInstance(Bpt),{statusBarMenuId:R.MenubarTerminalSuggestStatusMenu,showStatusBarSettingId:"terminal.integrated.suggest.showStatusBar",selectionModeSettingId:"terminal.integrated.suggest.selectionMode",preventDetailsPlacements:[1]},this._getFontInfo.bind(this),this._onDidFontConfigurationChange.event.bind(this),this._getAdvancedExplainModeDetails.bind(this))),this._register(this._suggestWidget.onDidSelect(async o=>this.acceptSelectedSuggestion(o))),this._register(this._suggestWidget.onDidHide(()=>this._terminalSuggestWidgetVisibleContextKey.reset())),this._register(this._suggestWidget.onDidShow(()=>this._terminalSuggestWidgetVisibleContextKey.set(!0))),this._register(this._configurationService.onDidChangeConfiguration(o=>{(o.affectsConfiguration("terminal.integrated.fontFamily")||o.affectsConfiguration("terminal.integrated.fontSize")||o.affectsConfiguration("terminal.integrated.lineHeight")||o.affectsConfiguration("terminal.integrated.fontFamily")||o.affectsConfiguration("editor.fontSize")||o.affectsConfiguration("editor.fontFamily"))&&this._onDidFontConfigurationChange.fire()})),this._register(this._suggestWidget.onDidFocus(async o=>{if(this._ignoreFocusEvents)return;let n=o.item,r=o.index;n!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=n,n&&(!n.completion.documentation||!n.completion.detail)&&(this._currentSuggestionDetails=Hn(async s=>{try{await n.resolve(s)}catch(l){this._logService.warn(`Failed to resolve suggestion details for item ${n} at index ${r}`,l)}}),this._currentSuggestionDetails.then(()=>{n!==this._focusedItem||!this._suggestWidget?.list||r>=this._suggestWidget.list.length||(this._ignoreFocusEvents=!0,this._suggestWidget.list.splice(r,1,[n]),this._suggestWidget.list.setFocus([r]),this._ignoreFocusEvents=!1)})))})),this._terminal?.element?.querySelector(".xterm-helper-textarea")&&this._register($(_m(),"click",o=>{let n=o.target;this._terminal?.element?.contains(n)&&this._suggestWidget?.hide()})),this._register(this._suggestWidget.onDidShow(()=>this._updateDiscoverabilityState())),this._register(this._suggestWidget.onDidBlurDetails(o=>{let n=o.relatedTarget;this._terminal?.element?.contains(n)||this._suggestWidget?.hide()})),this._terminalSuggestWidgetVisibleContextKey.set(!1)),this._suggestWidget}_updateDiscoverabilityState(){this._discoverability||(this._discoverability=this._register(this._instantiationService.createInstance(hGe,this.shellType))),!(!this._suggestWidget||this._discoverability?.done)&&this._discoverability?.update(this._suggestWidget.element.domNode)}resetDiscoverability(){this._discoverability?.resetState()}selectPreviousSuggestion(){this._suggestWidget?.selectPrevious()}selectPreviousPageSuggestion(){this._suggestWidget?.selectPreviousPage()}selectNextSuggestion(){this._suggestWidget?.selectNext()}selectNextPageSuggestion(){this._suggestWidget?.selectNextPage()}acceptSelectedSuggestion(e,t){e||(e=this._suggestWidget?.getFocusedItem());let o=this._mostRecentPromptInputState;if(!e?.item||!o||this._leadingLineContent===void 0||!this._model){this._suggestTelemetry?.acceptCompletion(this._sessionId,void 0,this._mostRecentPromptInputState?.value);return}sj.lastAcceptedCompletionTimestamp=Date.now(),this._suggestWidget?.hide();let n=this._currentPromptInputState??o,r=e.item.completion.replacementRange?.[0]??n.cursorIndex,s=n.value.substring(r,n.cursorIndex),l="";if((n.ghostTextIndex===-1||n.ghostTextIndex>n.cursorIndex)&&n.value.length>n.cursorIndex+1&&n.value.at(n.cursorIndex)!==" "){let h=n.value.substring(n.cursorIndex,n.ghostTextIndex===-1?void 0:n.ghostTextIndex).indexOf(" ");l=n.value.substring(n.cursorIndex,h===-1?void 0:n.cursorIndex+h)}let c=e.item.completion,u=c.inputData;if(u===void 0){let h=We(c.label)?c.label:c.label.label;(c.kind===1||c.isFileOverride)&&h.includes(" ")&&(h=h.replaceAll(" ","\\ "));let g=!1;if(t)switch(this._configurationService.getValue(aG).runOnEnter){case"always":{g=!0;break}case"exactMatch":{g=s.toLowerCase()===h.toLowerCase();break}case"exactMatchIgnoreExtension":{g=s.toLowerCase()===h.toLowerCase(),c.isFileOverride&&(g||=s.toLowerCase()===h.toLowerCase().replace(/\.[^\.]+$/,""));break}}let f=Af(s,h),v=s.substring(s.length-1-f,s.length-1),b=h.substring(f);n.suffix.length>0&&n.prefix.endsWith(v)&&n.suffix.startsWith(b)?u="\x1BOC".repeat(h.length-f):u=["\x7F".repeat(s.length-f),"\x1B[3~".repeat(l.length),b,g?"\r":""].join("")}c.kind===1&&(sj.lastAcceptedCompletionTimestamp=0),this._configurationService.getValue(aG).insertTrailingSpace&&c.kind!==1&&c.kind!==9&&(u+=" ",this._lastUserDataTimestamp=Date.now(),this._requestCompletionsOnNextSync=!0),this._onAcceptedCompletion.fire(u),this._suggestTelemetry?.acceptCompletion(this._sessionId,c,this._mostRecentPromptInputState?.value),this.hideSuggestWidget(!0)}hideSuggestWidget(e){this._discoverability?.resetTimer(),e&&(this._cancellationTokenSource?.cancel(),this._cancellationTokenSource=void 0,this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0),this._currentPromptInputState=void 0,this._leadingLineContent=void 0,this._focusedItem=void 0,this._suggestWidget?.hide()}_relayoutOnResize(){if(!this._terminalSuggestWidgetVisibleContextKey.get()||!this._terminal)return;let e=this._getCursorPosition(this._terminal);if(!e){this.hideSuggestWidget(!0);return}this._suggestWidget?.relayout(e)}};sj=I([m(4,Vee),m(5,B),m(6,F),m(7,mp),m(8,wa)],sj);var Bpt=class{constructor(i){this._storageService=i;this._key="terminal.integrated.suggestSize"}restore(){let i=this._storageService.get(this._key,0)??"";try{let e=JSON.parse(i);if(di.is(e))return di.lift(e)}catch{}}store(i){this._storageService.store(this._key,JSON.stringify(i),0,1)}reset(){this._storageService.remove(this._key,0)}};Bpt=I([m(0,de)],Bpt);function L0o(a,i){return i==="/"?a.replaceAll("\\","/"):a.replaceAll("/","\\")}var iYt=class extends k{constructor(e,t,o){super();this.id="lsp";this.isBuiltin=!0;this.shellTypes=["python"];this._provider=e,this._textVirtualModel=t,this._lspTerminalModelContentProvider=o,this.triggerCharacters=e.triggerCharacters?[...e.triggerCharacters," ","("]:[" ","("]}activate(e){}async provideCompletions(e,t,o){this._lspTerminalModelContentProvider.trackPromptInputToVirtualFile(e);let n=e.substring(0,t),r=n.split(`
`),s=r[r.length-1].length+1,l=this._textVirtualModel.object.textEditorModel.getLineCount(),c=new ye(l,s),u=[];if(this._provider&&this._provider._debugDisplayName!=="wordbasedCompletions"){let p=await this._provider.provideCompletionItems(this._textVirtualModel.object.textEditorModel,c,{triggerKind:1},o);for(let h of p?.suggestions||[]){let g=h.kind?quo(h.kind):2,f=H_n(t,n,g,"lspCompletionItem",void 0),v={label:h.label,provider:`lsp:${h.extensionId?.value}`,detail:h.detail,documentation:h.documentation,kind:g,replacementRange:f.replacementRange};this._provider.resolveCompletionItem&&(!h.detail||!h.documentation)&&(v._unresolvedItem=h,v._resolveProvider=this._provider),u.push(v)}}return u}};function H_n(a,i,e,t,o){let n=U_n(i);return{label:t,detail:o??"",replacementRange:[a-n.length,a],kind:e??2}}function U_n(a){if(a.endsWith(" ")||a.endsWith("."))return"";let i=a.lastIndexOf(" "),e=a.lastIndexOf("."),t=a.lastIndexOf("("),o=Math.max(i,e,t);return o===-1?a:a.substring(o+1)}var gGe=`vscode_lsp_terminal_prompt_tracker= {}
`,z_n=new Set([{shellType:"python",languageId:"python",extension:"py"}]);function M0o(a){for(let i of z_n)if(i.shellType===a)return i}var cae=class extends k{constructor(e,t,o,n,r,s,l){super();this._modelService=s;this._languageService=l;this._onCommandFinishedListener=this._register(new ue);this._register(r.registerTextModelContentProvider(cae.scheme,this)),this._capabilitiesStore=e,this._commandDetection=this._capabilitiesStore.get(2),this._registerTerminalCommandFinishedListener(),this._virtualTerminalDocumentUri=o,this._shellType=n}static{this.scheme=Q.vscodeTerminal}shellTypeChanged(e){this._shellType=e}setContent(e){let t=this._modelService.getModel(this._virtualTerminalDocumentUri);if(this._shellType&&t){let o=t.getValue();if(o==="")t.setValue(gGe);else{let n=o.lastIndexOf(gGe),s=(n!==-1?o.substring(0,n):o)+`
`+e+`
`+gGe;t.setValue(s)}}}trackPromptInputToVirtualFile(e){this._commandDetection=this._capabilitiesStore.get(2);let t=this._modelService.getModel(this._virtualTerminalDocumentUri);if(this._shellType&&t){let o=t.getValue(),n=o.lastIndexOf(gGe),s=(n!==-1?o.substring(0,n):o)+gGe+e;t.setValue(s)}}_registerTerminalCommandFinishedListener(){let e=()=>{this._onCommandFinishedListener.value||this._commandDetection&&this._commandDetection.onCommandFinished&&(this._onCommandFinishedListener.value=this._register(this._commandDetection.onCommandFinished(t=>{t.exitCode===0&&this._shellType&&this.setContent(t.command)})))};e(),this._register(this._capabilitiesStore.onDidAddCommandDetectionCapability(t=>{this._commandDetection=t,e()}))}async provideTextContent(e){let t=this._modelService.getModel(e);if(t&&!t.isDisposed())return t;let o=this._languageService.guessLanguageIdByFilepathOrFirstLine(e),n=o?this._languageService.createById(o):this._languageService.createById("plaintext");return this._modelService.createModel("",n,e,!1)}};cae=I([m(4,Bt),m(5,_t),m(6,Rt)],cae);function P0o(a,i){return A.from({scheme:Q.vscodeTerminal,path:`/terminal${a}.${i}`})}Ce(Vee,NRe,1);var vy=class extends O{constructor(e,t,o,n,r,s,l){super();this._ctx=e;this._contextKeyService=t;this._configurationService=o;this._instantiationService=n;this._terminalCompletionService=r;this._textModelService=s;this._languageFeaturesService=l;this._addon=new ue;this._lspAddons=this.add(new Ot);this._lspModelProvider=new ue;this.add(ee(()=>{this._addon?.dispose(),this._lspModelProvider?.value?.dispose(),this._lspModelProvider?.dispose()})),this._terminalSuggestWidgetVisibleContextKey=pt.suggestWidgetVisible.bindTo(this._contextKeyService),this.add(this._configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("terminal.integrated.suggest.enabled")){let u=this._configurationService.getValue(aG).enabled;u||(this._addon.clear(),this._lspAddons.clearAndDisposeAll());let p=this._ctx.instance.xterm?.raw;p&&u&&this._loadAddons(p)}})),fIe.initialize(this._instantiationService),this.add(this._ctx.instance.onDidChangeTarget(c=>{this._updateContainerForTarget(c)})),this.add(this._ctx.instance.onDidFocus(()=>{let c=this._ctx.instance.xterm?.raw;c&&this._prepareAddonLayout(c)}))}static{this.ID="terminal.suggest"}static get(e){return e.getContribution(vy.ID)}get addon(){return this._addon.value}get lspAddons(){return Array.from(this._lspAddons.values())}xtermOpen(e){this._configurationService.getValue(aG).enabled&&(this._loadAddons(e.raw),this.add(U.runAndSubscribe(this._ctx.instance.onDidChangeShellType,async()=>{this._refreshAddons(),this._lspModelProvider.value?.shellTypeChanged(this._ctx.instance.shellType)})))}async _loadLspCompletionAddon(e){let t;if(!this._ctx.instance.shellType||!(t=M0o(this._ctx.instance.shellType))){this._lspAddons.clearAndDisposeAll();return}let o=P0o(this._ctx.instance.instanceId,t.extension);this._lspModelProvider.value=this._instantiationService.createInstance(cae,this._ctx.instance.capabilities,this._ctx.instance.instanceId,o,this._ctx.instance.shellType),this.add(this._lspModelProvider.value);let n=await this._textModelService.createModelReference(o);this.add(n);let s=this._languageFeaturesService.completionProvider.all(n.object.textEditorModel).filter(l=>l._debugDisplayName!=="wordbasedCompletions");for(let l of s){let c=this._instantiationService.createInstance(iYt,l,n,this._lspModelProvider.value);this._lspAddons.set(l._debugDisplayName,c),e.loadAddon(c),this.add(this._terminalCompletionService.registerTerminalCompletionProvider("lsp",c.id,c,...c.triggerCharacters??[]))}}_loadAddons(e){if(this._addon.value)return;let t=this._addon.value=this._instantiationService.createInstance(sj,this._ctx.instance.sessionId,this._ctx.instance.shellType,this._ctx.instance.capabilities,this._terminalSuggestWidgetVisibleContextKey);e.loadAddon(t),this._loadLspCompletionAddon(e),this._prepareAddonLayout(e),this.add($(this._ctx.instance.domElement,ne.FOCUS_OUT,n=>{n.relatedTarget?.classList.contains(a0o)||t.hideSuggestWidget(!0)})),this.add(t.onAcceptedCompletion(async n=>{this._ctx.instance.focus(),this._ctx.instance.sendText(n,!1)}));let o=pL.get(this._ctx.instance);if(this.add(o.onWillPaste(()=>t.isPasting=!0)),this.add(o.onDidPaste(()=>{setTimeout(()=>t.isPasting=!1,100)})),!ii){let n;this.add(t.onDidReceiveCompletions(()=>{n?.open(),n=void 0}))}}_refreshAddons(){let e=this._addon.value;e&&(e.shellType=this._ctx.instance.shellType,this._ctx.instance.xterm?.raw&&this._loadLspCompletionAddon(this._ctx.instance.xterm.raw))}_updateContainerForTarget(e){!this._addon.value||!this._ctx.instance.xterm?.raw||this._prepareAddonLayout(this._ctx.instance.xterm.raw)}async _prepareAddonLayout(e){let t=this._addon.value;if(!t||this.isDisposed)return;let o=e.element??await this._waitForXtermElement(e);if(!o||this.isDisposed||t!==this._addon.value)return;let n=this._resolveAddonContainer(o);t.setContainerWithOverflow(n);let r=o?.querySelector(".xterm-screen");go(r)&&t.setScreen(r)}async _waitForXtermElement(e){if(e.element)return e.element;if(await Promise.race([U.toPromise(U.filter(this._ctx.instance.onDidChangeVisibility,t=>t)),U.toPromise(this._ctx.instance.onDisposed)]),!(this.isDisposed||this._ctx.instance.isDisposed))return e.element??void 0}_resolveAddonContainer(e){return this._ctx.instance.target===2?e:rf(e,"panel")??e}};vy=I([m(1,X),m(2,B),m(3,F),m(4,Vee),m(5,Bt),m(6,Jt)],vy);tm(vy.ID,vy);Wr({id:"workbench.action.terminal.changeSelectionModeNever",title:P(16833,"Selection Mode: None"),tooltip:P(16834,"Do not select the top suggestion until down is pressed, at which point Tab or Enter will accept the suggestion. Activate to change."),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible,C.equals("config.terminal.integrated.suggest.selectionMode","never")),menu:{id:R.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:C.and(C.equals("config.terminal.integrated.suggest.selectionMode","never"),C.or(C.equals("config.terminal.integrated.suggest.quickSuggestions",!0),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","partial")}});Wr({id:"workbench.action.terminal.changeSelectionModePartial",title:P(16835,"Selection Mode: Partial (Tab)"),tooltip:P(16836,"Partially select the top suggestion, Tab will accept a suggestion when visible. Activate to change."),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible,C.equals("config.terminal.integrated.suggest.selectionMode","partial")),menu:{id:R.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:C.and(C.equals("config.terminal.integrated.suggest.selectionMode","partial"),C.or(C.equals("config.terminal.integrated.suggest.quickSuggestions",!0),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","always")}});Wr({id:"workbench.action.terminal.changeSelectionModeAlways",title:P(16831,"Selection Mode: Always (Tab or Enter)"),tooltip:P(16832,"Always select the top suggestion, Tab or Enter will accept a suggestion when visible. Activate to change."),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),menu:{id:R.MenubarTerminalSuggestStatusMenu,group:"left",order:1,when:C.and(C.equals("config.terminal.integrated.suggest.selectionMode","always"),C.or(C.equals("config.terminal.integrated.suggest.quickSuggestions",!0),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0)))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.selectionMode","never")}});Wr({id:"workbench.action.terminal.doNotShowSuggestOnType",title:P(16838,"Don't show IntelliSense unless triggered explicitly. This disables the quick suggestions and suggest on trigger characters settings."),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),icon:L.eye,menu:{id:R.MenubarTerminalSuggestStatusMenu,group:"right",order:1,when:C.and(C.or(C.equals("config.terminal.integrated.suggest.quickSuggestions.commands","on"),C.equals("config.terminal.integrated.suggest.quickSuggestions.arguments","on")),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!0))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.quickSuggestions",{commands:"off",arguments:"off",unknown:"off"}),i.get(B).updateValue("terminal.integrated.suggest.suggestOnTriggerCharacters",!1)}});Wr({id:"workbench.action.terminal.showSuggestOnType",title:P(16847,"Show IntelliSense while typing. This enables the quick suggestions for commands and arguments, and suggest on trigger characters settings."),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),icon:L.eyeClosed,menu:{id:R.MenubarTerminalSuggestStatusMenu,group:"right",order:1,when:C.or(C.and(C.equals("config.terminal.integrated.suggest.quickSuggestions.commands","off"),C.equals("config.terminal.integrated.suggest.quickSuggestions.arguments","off")),C.equals("config.terminal.integrated.suggest.suggestOnTriggerCharacters",!1))},run:(a,i)=>{i.get(B).updateValue("terminal.integrated.suggest.quickSuggestions",{commands:"on",arguments:"on",unknown:"off"}),i.get(B).updateValue("terminal.integrated.suggest.suggestOnTriggerCharacters",!0)}});Wr({id:"workbench.action.terminal.suggestLearnMore",title:P(16841,"Learn More"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),icon:L.question,menu:{id:R.MenubarTerminalSuggestStatusMenu,group:"right",order:2},run:(a,i)=>{i.get(Je).open("https://aka.ms/vscode-terminal-intellisense")}});Wr({id:"workbench.action.terminal.configureSuggestSettings",title:P(16837,"Configure"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),icon:L.gear,menu:{id:R.MenubarTerminalSuggestStatusMenu,group:"right",order:3},run:(a,i)=>i.get(Qo).openSettings({query:aG})});pc({id:"workbench.action.terminal.triggerSuggest",title:P(16851,"Trigger Suggest"),f1:!1,keybinding:{primary:2058,mac:{primary:266},weight:201,when:C.and(pt.focus,pt.suggestWidgetVisible.negate(),C.equals("config.terminal.integrated.suggest.enabled",!0))},run:a=>vy.get(a)?.addon?.requestCompletions(!0)});pc({id:"workbench.action.terminal.resetSuggestWidgetSize",title:P(16842,"Reset Suggest Widget Size"),run:a=>vy.get(a)?.addon?.resetWidgetSize()});pc({id:"workbench.action.terminal.selectPrevSuggestion",title:P(16846,"Select the Previous Suggestion"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:{primary:16,weight:201,when:C.or(HO.HasNavigated,C.equals("config.terminal.integrated.suggest.upArrowNavigatesHistory",!1))},run:a=>vy.get(a)?.addon?.selectPreviousSuggestion()});pc({id:"workbench.action.terminal.selectPrevPageSuggestion",title:P(16845,"Select the Previous Page Suggestion"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:{primary:11,weight:201},run:a=>vy.get(a)?.addon?.selectPreviousPageSuggestion()});pc({id:"workbench.action.terminal.selectNextSuggestion",title:P(16844,"Select the Next Suggestion"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:{primary:18,weight:201},run:a=>vy.get(a)?.addon?.selectNextSuggestion()});pc({id:"terminalSuggestToggleExplainMode",title:P(16850,"Suggest Toggle Explain Modes"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:{weight:201,primary:2138},run:a=>vy.get(a)?.addon?.toggleExplainMode()});pc({id:"workbench.action.terminal.suggestToggleDetailsFocus",title:P(16849,"Suggest Toggle Suggestion Focus"),f1:!1,precondition:me.textInputFocus.negate(),keybinding:{weight:200,primary:2570,mac:{primary:778}},run:a=>vy.get(a)?.addon?.toggleSuggestionFocus()});pc({id:"workbench.action.terminal.suggestToggleDetails",title:P(16848,"Suggest Toggle Details"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.isOpen,pt.focus,pt.suggestWidgetVisible,HO.HasFocusedSuggestion),keybinding:{weight:402,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},run:a=>vy.get(a)?.addon?.toggleSuggestionDetails()});pc({id:"workbench.action.terminal.selectNextPageSuggestion",title:P(16843,"Select the Next Page Suggestion"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:{primary:12,weight:201},run:a=>vy.get(a)?.addon?.selectNextPageSuggestion()});pc({id:"workbench.action.terminal.acceptSelectedSuggestion",title:P(16829,"Insert"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:[{primary:2,weight:202,when:C.and(HO.HasFocusedSuggestion)},{primary:3,when:C.and(HO.HasFocusedSuggestion,C.or(HO.ExplicitlyInvoked,C.notEquals("config.terminal.integrated.suggest.selectionMode","partial"),HO.FirstSuggestionFocused.toNegated(),HO.HasNavigated)),weight:201}],run:a=>vy.get(a)?.addon?.acceptSelectedSuggestion()});pc({id:"workbench.action.terminal.acceptSelectedSuggestionEnter",title:P(16830,"Accept Selected Suggestion (Enter)"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:{primary:3,weight:201,when:C.notEquals("config.terminal.integrated.suggest.runOnEnter","never")},run:async a=>vy.get(a)?.addon?.acceptSelectedSuggestion(void 0,!0)});pc({id:"workbench.action.terminal.hideSuggestWidget",title:P(16839,"Hide Suggest Widget"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:{primary:9,weight:201},run:a=>vy.get(a)?.addon?.hideSuggestWidget(!0)});pc({id:"workbench.action.terminal.hideSuggestWidgetAndNavigateHistory",title:P(16840,"Hide Suggest Widget and Navigate History"),f1:!1,precondition:C.and(C.or(pt.processSupported,pt.terminalHasBeenCreated),pt.focus,pt.isOpen,pt.suggestWidgetVisible),keybinding:{primary:16,when:C.and(HO.HasNavigated.negate(),C.equals("config.terminal.integrated.suggest.upArrowNavigatesHistory",!0)),weight:202},run:a=>{vy.get(a)?.addon?.hideSuggestWidget(!0),a.sendText("\x1B[A",!1)}});var fIe=class extends k{constructor(e,t){super();this._terminalCompletionService=e;this._terminalContributionService=t;this._register(this._terminalCompletionService.onDidChangeProviders(()=>{this._updateConfiguration()})),this._register(this._terminalContributionService.onDidChangeTerminalCompletionProviders(()=>{this._updateConfiguration()})),this._updateConfiguration()}static initialize(e){this._instance||(this._instance=e.createInstance(fIe))}_updateConfiguration(){let e=new Map;this._terminalContributionService.terminalCompletionProviders.forEach(t=>e.set(t.extensionIdentifier,{...t,id:t.extensionIdentifier}));for(let{id:t}of this._terminalCompletionService.providers)t&&!e.has(t)&&e.set(t,{id:t});lyi(e)}};fIe=I([m(0,Vee),m(1,y2e)],fIe);var fGe=class extends k{static{this.ID="terminalWslRecommendation"}constructor(i,e,t,o,n){if(super(),!ii)return;let r=o.exeBasedExtensionTips;if(!r||!r.wsl)return;let s=n.onDidCreateInstance(async l=>{async function c(p){return(await i.getInstalled()).some(g=>g.identifier.id===p)}if(!l.shellLaunchConfig.executable||Jo(l.shellLaunchConfig.executable).toLowerCase()!=="wsl.exe")return;s?.dispose(),s=void 0;let u=Object.keys(r.wsl.recommendations).find(p=>r.wsl.recommendations[p].important);!u||await c(u)||t.prompt(ft.Info,d(16958,null,r.wsl.friendlyName),[{label:d(16957,null),run:()=>{e.createInstance(tO,u).run()}}],{priority:1,neverShowAgain:{id:"terminalConfigHelper/launchRecommendationsIgnore",scope:2},onCancel:()=>{}})})}};fGe=I([m(0,xs),m(1,F),m(2,Ne),m(3,Ze),m(4,an)],fGe);bt(fGe.ID,fGe,vt.Eventually);var K_n={Ampersand:"&",ampersand:"&",Dollar:"$",dollar:"$",Percent:"%",percent:"%",Asterisk:"*",asterisk:"*",Plus:"+",plus:"+",Equals:"=",equals:"=",Exclamation:"!",exclamation:"!",Slash:"/",slash:"/",Backslash:"\\",backslash:"\\",Dot:".",dot:".",Period:".",period:".",Quote:"'",quote:"'","double quote":'"',"Double quote":'"'},JV=class extends k{constructor(e,t,o,n){super();this._speechService=e;this._terminalService=t;this._configurationService=o;this._input="";this._register(this._terminalService.onDidChangeActiveInstance(()=>this.stop())),this._register(this._terminalService.onDidDisposeInstance(()=>this.stop())),this._disposables=this._register(new O),this._terminalDictationInProgress=pt.terminalDictationInProgress.bindTo(n)}static{this._instance=void 0}static getInstance(e){return JV._instance||(JV._instance=e.createInstance(JV)),JV._instance}async start(){this.stop();let e=this._configurationService.getValue("accessibility.voice.speechTimeout");(!on(e)||e<0)&&(e=VZe),this._acceptTranscriptionScheduler=this._disposables.add(new Dt(()=>{this._sendText(),this.stop()},e)),this._cancellationTokenSource=new qe,this._register(ee(()=>this._cancellationTokenSource?.dispose(!0)));let t=await this._speechService.createSpeechToTextSession(this._cancellationTokenSource?.token,"terminal");this._disposables.add(t.onDidChange(o=>{if(!this._cancellationTokenSource?.token.isCancellationRequested)switch(o.status){case 1:this._terminalDictationInProgress.set(!0),this._decoration||this._createDecoration();break;case 2:{this._updateInput(o),this._renderGhostText(o),this._updateDecoration(),e>0&&this._acceptTranscriptionScheduler.cancel();break}case 3:this._updateInput(o),this._sendText(),this._ghostText?.dispose(),this._ghostText=void 0,this._ghostTextMarker?.dispose(),this._ghostTextMarker=void 0,this._updateDecoration(),this._input="";break;case 4:this.stop();break}}))}stop(e){this._setInactive(),e&&(this._acceptTranscriptionScheduler.cancel(),this._sendText()),this._ghostText=void 0,this._decoration?.dispose(),this._decoration=void 0,this._marker?.dispose(),this._marker=void 0,this._ghostTextMarker=void 0,this._cancellationTokenSource?.cancel(),this._disposables.clear(),this._input="",this._terminalDictationInProgress.reset()}_sendText(){this._terminalService.activeInstance?.sendText(this._input,!1),cn(d(16948,null,this._input))}_updateInput(e){if(e.text){let t=e.text.replaceAll(/[.,?;!]/g,"");for(let o of Object.entries(K_n))t=t.replace(new RegExp("\\b"+o[0]+"\\b"),o[1]);this._input=" "+t}}_createDecoration(){let e=this._terminalService.activeInstance,t=e?.xterm?.raw;if(!t)return;let o=t.buffer.active.cursorY===0,n=this._input.length,r=t.buffer.active.cursorX+n;if(this._marker=e.registerMarker(o?0:-1),!!this._marker){if(this._decoration=t.registerDecoration({marker:this._marker,layer:"top",x:r}),!this._decoration){this._marker.dispose(),this._marker=void 0;return}this._decoration.onRender(s=>{s.classList.add(...q.asClassNameArray(L.micFilled),"terminal-voice","recording"),s.style.transform=o?"translate(10px, -2px)":"translate(-6px, -5px)"})}}_updateDecoration(){this._decoration?.dispose(),this._marker?.dispose(),this._decoration=void 0,this._marker=void 0,this._createDecoration()}_setInactive(){this._decoration?.element?.classList.remove("recording")}_renderGhostText(e){this._ghostText?.dispose();let t=e.text;if(!t)return;let o=this._terminalService.activeInstance,n=o?.xterm?.raw;if(!n||(this._ghostTextMarker=o.registerMarker(),!this._ghostTextMarker))return;this._disposables.add(this._ghostTextMarker);let r=n.buffer.active.cursorY===0;this._ghostText=n.registerDecoration({marker:this._ghostTextMarker,layer:"top",x:r?n.buffer.active.cursorX+4:n.buffer.active.cursorX+1}),this._ghostText&&this._disposables.add(this._ghostText),this._ghostText?.onRender(s=>{s.classList.add("terminal-voice-progress-text"),s.textContent=t,s.style.width=(n.cols-n.buffer.active.cursorX)/n.cols*100+"%"})}};JV=I([m(0,Gx),m(1,an),m(2,B),m(3,X)],JV);var A0o=P(16954,"Voice");function N0o(){pc({id:"workbench.action.terminal.startVoice",title:P(16955,"Start Dictation in Terminal"),category:A0o,precondition:C.and(Aee.toNegated(),Ca.terminalAvailable),f1:!0,icon:L.mic,run:async(a,i,e)=>{let t=e.get(X),o=e.get(fe),n=e.get(ct),r=e.get(As),s=e.get(xs);if(YH.getValue(t)){let b=e.get(F);JV.getInstance(b).start();return}let c=(await s.getInstalled()).find(b=>b.identifier.id==="ms-vscode.vscode-speech"),u=c&&!r.isEnabled(c),p,h,g;u?(h=d(16952,null),g=d(16949,null),p=()=>r.setEnablement([c],13)):(h=d(16953,null),p=()=>o.executeCommand("workbench.extensions.installExtension","ms-vscode.vscode-speech"),g=d(16950,null));let f=d(16951,null);(await n.confirm({message:h,primaryButton:g,type:"info",detail:f})).confirmed&&await p()}}),pc({id:"workbench.action.terminal.stopVoice",title:P(16956,"Stop Dictation in Terminal"),category:A0o,precondition:pt.terminalDictationInProgress,f1:!0,keybinding:{primary:9,weight:300},run:(a,i,e)=>{let t=e.get(F);JV.getInstance(t).stop(!0)}})}N0o();var O0o=le("externalTerminal");var F0o="openInTerminal",W0o="openInIntegratedTerminal";function V0o(a,i){Ge.registerCommand({id:a,handler:async(e,t)=>{let o=e.get(B),n=e.get(ge),r=e.get(an),s=e.get(bo),l=e.get(Cc),c;try{c=e.get(O0o)}catch{}let u=lV(t,e.get(Co),e.get(ie),e.get(kt),e.get(Qa));return n.resolveAll(u.map(p=>({resource:p}))).then(async p=>{let h=o.getValue(),g=s.getConnection()||i==="integrated",f=jo(p.filter(v=>v.success));if(g){let v={},b=f.map(({stat:S})=>{let y=S.resource;return S.isDirectory?y:A.from({scheme:y.scheme,authority:y.authority,fragment:y.fragment,query:y.query,path:yd(y.path)})});for(let S of b){if(v[S.path])return;v[S.path]=!0;let y=await r.createTerminal({config:{cwd:S}});y&&y.target!==2&&(u.length===1||!t||S.path===t.path||S.path===yd(t.path))&&(r.setActiveInstance(y),l.showPanel(!0))}}else c&&jo(f.map(({stat:v})=>v.isDirectory?v.resource.fsPath:yd(v.resource.fsPath))).forEach(v=>{c.openTerminal(h.terminal.external,v)})})}})}V0o(F0o,"external");V0o(W0o,"integrated");var Hpt=class extends k{constructor(e){super();this._configurationService=e;let t=C.and(Ho.Scheme.isEqualTo(Q.file),C.or(C.equals("config.terminal.explorerKind","integrated"),C.equals("config.terminal.explorerKind","both"))),o=C.and(Ho.Scheme.isEqualTo(Q.file),C.or(C.equals("config.terminal.explorerKind","external"),C.equals("config.terminal.explorerKind","both")));this._openInIntegratedTerminalMenuItem={group:"navigation",order:30,command:{id:W0o,title:d(11943,null)},when:C.or(t,Ho.Scheme.isEqualTo(Q.vscodeRemote))},this._openInTerminalMenuItem={group:"navigation",order:31,command:{id:F0o,title:d(11942,null)},when:o},be.appendMenuItem(R.ExplorerContext,this._openInTerminalMenuItem),be.appendMenuItem(R.ExplorerContext,this._openInIntegratedTerminalMenuItem),this._register(this._configurationService.onDidChangeConfiguration(n=>{(n.affectsConfiguration("terminal.explorerKind")||n.affectsConfiguration("terminal.external"))&&this._refreshOpenInTerminalMenuItemTitle()})),this._refreshOpenInTerminalMenuItemTitle()}isWindows(){let e=this._configurationService.getValue().terminal;if(ii&&e.external?.windowsExec){let t=Jo(e.external.windowsExec);if(t==="wt"||t==="wt.exe")return!0}return!1}_refreshOpenInTerminalMenuItemTitle(){this.isWindows()&&(this._openInTerminalMenuItem.command.title=d(11944,null))}};Hpt=I([m(0,B)],Hpt);oe.as(Zi.Workbench).registerWorkbenchContribution(Hpt,3);var vIe=class extends k{constructor(e,t,o,n,r,s,l){super();this.hostService=e;this.configurationService=t;this.userDataSyncService=o;this.userDataSyncEnablementService=n;this.productService=s;this.dialogService=l;this.titleBarStyle=new yS("string");this.menuStyle=new yS("string");this.nativeTabs=new yS("boolean");this.nativeFullScreen=new yS("boolean");this.clickThroughInactive=new yS("boolean");this.controlsStyle=new yS("string");this.updateMode=new yS("string");this.workspaceTrustEnabled=new yS("boolean");this.experimentsEnabled=new yS("boolean");this.enablePPEExtensionsGallery=new yS("boolean");this.restrictUNCAccess=new yS("boolean");this.accessibilityVerbosityDebug=new yS("boolean");this.telemetryFeedbackEnabled=new yS("boolean");this.extensionUnificationEnabled=new yS("boolean");this.agentHostEnabled=new yS("boolean");this.agentHostOTelEnabled=new yS("boolean");this.agentHostOTelExporterType=new yS("string");this.agentHostOTelOtlpEndpoint=new yS("string");this.agentHostOTelCaptureContent=new yS("boolean");this.agentHostOTelOutfile=new yS("string");this.agentHostOTelDbSpanExporterEnabled=new yS("boolean");this.update(!1),this._register(this.configurationService.onDidChangeConfiguration(c=>this.onConfigurationChange(c))),this._register(r.onDidTurnOnSync(c=>this.update(!0)))}static{this.SETTINGS=["window.titleBarStyle","window.menuStyle","window.nativeTabs","window.nativeFullScreen","window.clickThroughInactive","window.controlsStyle","update.mode","editor.accessibilitySupport","security.workspace.trust.enabled","workbench.enableExperiments","_extensionsGallery.enablePPE","security.restrictUNCAccess","accessibility.verbosity.debug","telemetry.feedback.enabled","chat.extensionUnification.enabled","chat.agentHost.enabled","chat.agentHost.otel.enabled","chat.agentHost.otel.exporterType","chat.agentHost.otel.otlpEndpoint","chat.agentHost.otel.captureContent","chat.agentHost.otel.outfile","chat.agentHost.otel.dbSpanExporter.enabled"]}onConfigurationChange(e){e&&!vIe.SETTINGS.some(t=>e.affectsConfiguration(t))||this.isTurningOnSyncInProgress()||this.update(e.source!==7)}isTurningOnSyncInProgress(){return!this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncService.status==="syncing"}update(e){let t=!1;function o(r){t=t||r}let n=this.configurationService.getValue();Qr&&(o((n.window.titleBarStyle==="native"||n.window.titleBarStyle==="custom")&&this.titleBarStyle.handleChange(n.window?.titleBarStyle)),o(!et&&this.menuStyle.handleChange(n.window?.menuStyle)),o(et&&this.nativeTabs.handleChange(n.window?.nativeTabs)),o(et&&this.nativeFullScreen.handleChange(n.window?.nativeFullScreen)),o(et&&this.clickThroughInactive.handleChange(n.window?.clickThroughInactive)),o(!et&&this.controlsStyle.handleChange(n.window?.controlsStyle)),o(this.updateMode.handleChange(n.update?.mode)),Sn&&typeof n.editor?.accessibilitySupport=="string"&&n.editor.accessibilitySupport!==this.accessibilitySupport&&(this.accessibilitySupport=n.editor.accessibilitySupport,this.accessibilitySupport==="on"&&(t=!0)),o(this.workspaceTrustEnabled.handleChange(n?.security?.workspace?.trust?.enabled)),o(this.restrictUNCAccess.handleChange(n?.security?.restrictUNCAccess)),o(this.accessibilityVerbosityDebug.handleChange(n?.accessibility?.verbosity?.debug))),o(this.experimentsEnabled.handleChange(n.workbench?.enableExperiments)),o(this.productService.quality!=="stable"&&this.enablePPEExtensionsGallery.handleChange(n._extensionsGallery?.enablePPE)),o(this.telemetryFeedbackEnabled.handleChange(n.telemetry?.feedback?.enabled)),o(this.extensionUnificationEnabled.handleChange(n.chat?.extensionUnification?.enabled)&&n.chat?.extensionUnification?.enabled===!0),o(this.agentHostEnabled.handleChange(n.chat?.agentHost?.enabled)),o(this.agentHostOTelEnabled.handleChange(n.chat?.agentHost?.otel?.enabled)),o(this.agentHostOTelExporterType.handleChange(n.chat?.agentHost?.otel?.exporterType)),o(this.agentHostOTelOtlpEndpoint.handleChange(n.chat?.agentHost?.otel?.otlpEndpoint)),o(this.agentHostOTelCaptureContent.handleChange(n.chat?.agentHost?.otel?.captureContent)),o(this.agentHostOTelOutfile.handleChange(n.chat?.agentHost?.otel?.outfile)),o(this.agentHostOTelDbSpanExporterEnabled.handleChange(n.chat?.agentHost?.otel?.dbSpanExporter?.enabled)),e&&t&&this.hostService.hasFocus&&this.doConfirm(Qr?d(14504,null):d(14505,null),Qr?d(14502,null,this.productService.nameLong):d(14503,null,this.productService.nameLong),Qr?d(14506,null):d(14508,null),()=>this.hostService.restart())}async doConfirm(e,t,o,n){let{confirmed:r}=await this.dialogService.confirm({message:e,detail:t,primaryButton:o});r&&n()}};vIe=I([m(0,ti),m(1,B),m(2,ny),m(3,Yl),m(4,ry),m(5,Ze),m(6,ct)],vIe);var yS=class a{constructor(i){this.typeName=i;this.lastValue=void 0}static create(i){return new a(i)}handleChange(i){return typeof i===this.typeName&&i!==this.lastValue?(this.lastValue=i,!0):!1}},Upt=class extends k{constructor(e,t,o,n){super();this.contextService=e;this.extensionHostRestarter=this._register(new Dt(async()=>{n.extensionTestsLocationURI||n.isSessionsWindow||(n.remoteAuthority?o.reload():Qr&&await t.stopExtensionHosts(d(14507,null))&&t.startExtensionHosts())},10)),this.contextService.getCompleteWorkspace().then(r=>{this.firstFolderResource=r.folders.length>0?r.folders[0].uri:void 0,this.handleWorkbenchState(),this._register(this.contextService.onDidChangeWorkbenchState(()=>setTimeout(()=>this.handleWorkbenchState())))}),this._register(ee(()=>{this.onDidChangeWorkspaceFoldersUnbind?.dispose()}))}handleWorkbenchState(){if(this.contextService.getWorkbenchState()===3){let e=this.contextService.getWorkspace();this.firstFolderResource=e.folders.length>0?e.folders[0].uri:void 0,this.onDidChangeWorkspaceFoldersUnbind||(this.onDidChangeWorkspaceFoldersUnbind=this.contextService.onDidChangeWorkspaceFolders(()=>this.onDidChangeWorkspaceFolders()))}else je(this.onDidChangeWorkspaceFoldersUnbind),this.onDidChangeWorkspaceFoldersUnbind=void 0}onDidChangeWorkspaceFolders(){let e=this.contextService.getWorkspace(),t=e.folders.length>0?e.folders[0].uri:void 0;ze(this.firstFolderResource,t)||(this.firstFolderResource=t,this.extensionHostRestarter.schedule())}};Upt=I([m(0,Ae),m(1,lt),m(2,ti),m(3,Mt)],Upt);var B0o=oe.as(Zi.Workbench);B0o.registerWorkbenchContribution(vIe,3);B0o.registerWorkbenchContribution(Upt,3);var vGe=class{constructor(){this._state=0}get state(){return this._state}set state(i){i>this._state&&(this._state=i)}isOK(){return this._state===0}isFatal(){return this._state===4}},zpt=class{constructor(i){this._problemReporter=i}reset(){this._problemReporter.status.state=0}get problemReporter(){return this._problemReporter}info(i){this._problemReporter.info(i)}warn(i){this._problemReporter.warn(i)}error(i){this._problemReporter.error(i)}fatal(i){this._problemReporter.fatal(i)}};var bGe=(n=>(n[n.Default=0]="Default",n[n.Relative=1]="Relative",n[n.Absolute=2]="Absolute",n[n.AutoDetect=3]="AutoDetect",n[n.Search=4]="Search",n))(bGe||{});(i=>{function a(e){return e=e.toLowerCase(),e==="absolute"?2:e==="relative"?1:e==="autodetect"?3:e==="search"?4:void 0}i.fromString=a})(bGe||={});var sYt=(e=>(e[e.File=0]="File",e[e.Location=1]="Location",e))(sYt||{});(i=>{function a(e){return e=e.toLowerCase(),e==="file"?0:e==="location"?1:void 0}i.fromString=a})(sYt||={});var Kpt=(t=>(t[t.allDocuments=0]="allDocuments",t[t.openDocuments=1]="openDocuments",t[t.closedDocuments=2]="closedDocuments",t))(Kpt||{});(i=>{function a(e){return e=e.toLowerCase(),e==="alldocuments"?0:e==="opendocuments"?1:e==="closeddocuments"?2:void 0}i.fromString=a})(Kpt||={});function z2i(a){return!!(a&&We(a.name))}async function SGe(a,i,e){let t=i.fileLocation,o;if(t===2)o=a;else if(t===1&&i.filePrefix&&We(i.filePrefix))o=td(i.filePrefix,a);else if(t===3){let n=io(i);if(n.fileLocation=1,e){let r=await SGe(a,n),s;try{s=await e.stat(r)}catch{}if(s)return r}return n.fileLocation=2,SGe(a,n)}else if(t===4&&e){let n=e.getProvider(Q.file);if(n&&(o=(await q_n(a,n,i.filePrefix))?.path),!o){let r=io(i);return r.fileLocation=2,SGe(a,r)}}if(o===void 0)throw new Error("FileLocationKind is not actionable. Does the matcher have a filePrefix? This should never happen.");return o=Vh(o),o=o.replace(/\\/g,"/"),o[0]!=="/"&&(o="/"+o),i.uriProvider!==void 0?i.uriProvider(o):A.file(o)}async function q_n(a,i,e){let t=new Set(Ec(e.exclude||[]).map(n=>A.file(n).path));async function o(n){if(t.has(n.path))return;let r=await i.readdir(n),s=[];for(let[l,c]of r){if(c===2){s.push(A.joinPath(n,l));continue}if(c===1){let u=A.joinPath(n,l);if(u.path.endsWith(a))return u}}for(let l of s){let c=await o(l);if(c)return c}}for(let n of Ec(e.include||[])){let r=await o(A.file(n));if(r)return r}}function H0o(a,i,e){let t=a.pattern;return Array.isArray(t)?new B2i(a,i,e):new V2i(a,i,e)}var $_n=Ao===1?`\r
`:`
`,oYt=class{constructor(i,e,t){this.matcher=i,this.fileService=e,this.logService=t}handle(i,e=0){return{match:null,continue:!1}}next(i){return null}regexpExec(i,e){let t=Date.now(),o=i.exec(e),n=Date.now()-t;return n>5&&this.logService?.trace(`ProblemMatcher: slow regexp took ${n}ms to execute`,i.source),o}fillProblemData(i,e,t){return i?(this.fillProperty(i,"file",e,t,!0),this.appendProperty(i,"message",e,t,!0),this.fillProperty(i,"code",e,t,!0),this.fillProperty(i,"severity",e,t,!0),this.fillProperty(i,"location",e,t,!0),this.fillProperty(i,"line",e,t),this.fillProperty(i,"character",e,t),this.fillProperty(i,"endLine",e,t),this.fillProperty(i,"endCharacter",e,t),!0):!1}appendProperty(i,e,t,o,n=!1){let r=t[e];if(bn(i[e]))this.fillProperty(i,e,t,o,n);else if(!bn(r)&&r<o.length){let s=o[r];n&&(s=CL(s)),i[e]=i[e]+$_n+s}}fillProperty(i,e,t,o,n=!1){let r=t[e];if(bn(i[e])&&!bn(r)&&r<o.length){let s=o[r];s!==void 0&&(n&&(s=CL(s)),i[e]=s)}}getMarkerMatch(i){try{let e=this.getLocation(i);if(i.file&&e&&i.message){let t={severity:this.getSeverity(i),startLineNumber:e.startLineNumber,startColumn:e.startCharacter,endLineNumber:e.endLineNumber,endColumn:e.endCharacter,message:i.message};return i.code!==void 0&&(t.code=i.code),this.matcher.source!==void 0&&(t.source=this.matcher.source),{description:this.matcher,resource:this.getResource(i.file),marker:t}}}catch{console.error(`Failed to convert problem data into match: ${JSON.stringify(i)}`)}}getResource(i){return SGe(i,this.matcher,this.fileService)}getLocation(i){if(i.kind===0)return this.createLocation(0,0,0,0);if(i.location)return this.parseLocationInfo(i.location);if(!i.line)return null;let e=parseInt(i.line),t=i.character?parseInt(i.character):void 0,o=i.endLine?parseInt(i.endLine):void 0,n=i.endCharacter?parseInt(i.endCharacter):void 0;return this.createLocation(e,t,o,n)}parseLocationInfo(i){if(!i||!i.match(/(\d+|\d+,\d+|\d+,\d+,\d+,\d+)/))return null;let e=i.split(","),t=parseInt(e[0]),o=e.length>1?parseInt(e[1]):void 0;return e.length>3?this.createLocation(t,o,parseInt(e[2]),parseInt(e[3])):this.createLocation(t,o,void 0,void 0)}createLocation(i,e,t,o){return e!==void 0&&o!==void 0?{startLineNumber:i,startCharacter:e,endLineNumber:t||i,endCharacter:o}:e!==void 0?{startLineNumber:i,startCharacter:e,endLineNumber:i,endCharacter:e}:{startLineNumber:i,startCharacter:1,endLineNumber:i,endCharacter:2**31-1}}getSeverity(i){let e=null;if(i.severity){let t=i.severity;t&&(e=wt.fromValue(t),e===wt.Ignore&&(t==="E"?e=wt.Error:t==="W"?e=wt.Warning:t==="I"?e=wt.Info:xr(t,"hint")?e=wt.Info:xr(t,"note")&&(e=wt.Info)))}return(e===null||e===wt.Ignore)&&(e=this.matcher.severity||wt.Error),Pl.fromSeverity(e)}},V2i=class extends oYt{constructor(i,e,t){super(i,e,t),this.pattern=i.pattern}get matchLength(){return 1}handle(i,e=0){rY(i.length-e===1);let t=Object.create(null);this.pattern.kind!==void 0&&(t.kind=this.pattern.kind);let o=this.regexpExec(this.pattern.regexp,i[e]);if(o){this.fillProblemData(t,this.pattern,o),t.kind===1&&!t.location&&!t.line&&t.file&&(t.kind=0);let n=this.getMarkerMatch(t);if(n)return{match:n,continue:!1}}return{match:null,continue:!1}}next(i){return null}},B2i=class extends oYt{constructor(i,e,t){super(i,e,t),this.patterns=i.pattern}get matchLength(){return this.patterns.length}handle(i,e=0){rY(i.length-e===this.patterns.length),this.data=Object.create(null);let t=this.data;t.kind=this.patterns[0].kind;for(let r=0;r<this.patterns.length;r++){let s=this.patterns[r],l=this.regexpExec(s.regexp,i[r+e]);if(l)s.loop&&r===this.patterns.length-1&&(t=io(t)),this.fillProblemData(t,s,l);else return{match:null,continue:!1}}let o=!!this.patterns[this.patterns.length-1].loop;o||(this.data=void 0);let n=t?this.getMarkerMatch(t):null;return{match:n||null,continue:o}}next(i){let e=this.patterns[this.patterns.length-1];rY(e.loop===!0&&this.data!==null);let t=this.regexpExec(e.regexp,i);if(!t)return this.data=void 0,null;let o=io(this.data),n;return this.fillProblemData(o,e,t)&&(n=this.getMarkerMatch(o)),n||null}},dae;(s=>{let a;(c=>{function l(u){let p=u;return p&&We(p.regexp)}c.is=l})(a=s.CheckedProblemPattern||={});let i;(c=>{function l(u){let p=u;return p&&We(p.name)}c.is=l})(i=s.NamedProblemPattern||={});let e;(c=>{function l(u){let p=u;return p&&i.is(p)&&We(p.regexp)}c.is=l})(e=s.NamedCheckedProblemPattern||={});let t;(c=>{function l(u){return Array.isArray(u)}c.is=l})(t=s.MultiLineProblemPattern||={});let o;(c=>{function l(u){if(!t.is(u))return!1;for(let p of u)if(!s.CheckedProblemPattern.is(p))return!1;return!0}c.is=l})(o=s.MultiLineCheckedProblemPattern||={});let n;(c=>{function l(u){let p=u;return p&&We(p.name)&&Array.isArray(p.patterns)&&o.is(p.patterns)}c.is=l})(n=s.NamedMultiLineCheckedProblemPattern||={});function r(l){return We(l.name)}s.isNamedProblemMatcher=r})(dae||={});var nYt=class extends zpt{constructor(i){super(i)}parse(i){if(dae.NamedMultiLineCheckedProblemPattern.is(i))return this.createNamedMultiLineProblemPattern(i);if(dae.MultiLineCheckedProblemPattern.is(i))return this.createMultiLineProblemPattern(i);if(dae.NamedCheckedProblemPattern.is(i)){let e=this.createSingleProblemPattern(i);return e.name=i.name,e}else return dae.CheckedProblemPattern.is(i)?this.createSingleProblemPattern(i):(this.error(d(15855,null)),null)}createSingleProblemPattern(i){let e=this.doCreateSingleProblemPattern(i,!0);return e===void 0?null:(e.kind===void 0&&(e.kind=1),this.validateProblemPattern([e])?e:null)}createNamedMultiLineProblemPattern(i){let e=this.createMultiLineProblemPattern(i.patterns);return e?{name:i.name,label:i.label?i.label:i.name,patterns:e}:null}createMultiLineProblemPattern(i){let e=[];for(let t=0;t<i.length;t++){let o=this.doCreateSingleProblemPattern(i[t],!1);if(o===void 0)return null;t<i.length-1&&!bn(o.loop)&&o.loop&&(o.loop=!1,this.error(d(15850,null))),e.push(o)}return!e||e.length===0?(this.error(d(15851,null)),null):(e[0].kind===void 0&&(e[0].kind=1),this.validateProblemPattern(e)?e:null)}doCreateSingleProblemPattern(i,e){let t=this.createRegularExpression(i.regexp);if(t===void 0)return;let o={regexp:t};i.kind&&(o.kind=sYt.fromString(i.kind));function n(r,s,l,c){let u=s[c];typeof u=="number"&&(r[l]=u)}return n(o,i,"file","file"),n(o,i,"location","location"),n(o,i,"line","line"),n(o,i,"character","column"),n(o,i,"endLine","endLine"),n(o,i,"endCharacter","endColumn"),n(o,i,"severity","severity"),n(o,i,"code","code"),n(o,i,"message","message"),(i.loop===!0||i.loop===!1)&&(o.loop=i.loop),e&&(o.location||o.kind===0?o=Cp(o,{file:1,message:0},!1):o=Cp(o,{file:1,line:2,character:3,message:0},!1)),o}validateProblemPattern(i){if(!i||i.length===0)return this.error(d(15851,null)),!1;let e=!1,t=!1,o=!1,n=!1,r=i[0].kind===void 0?1:i[0].kind;return i.forEach((s,l)=>{l!==0&&s.kind&&this.error(d(15852,null)),e=e||!bn(s.file),t=t||!bn(s.message),o=o||!bn(s.location),n=n||!bn(s.line)}),e&&t?r===1&&!(o||n)?(this.error(d(15853,null)),!1):!0:(this.error(d(15854,null)),!1)}createRegularExpression(i){let e;try{e=new RegExp(i)}catch{this.error(d(15849,null,i))}return e}},rYt=class{constructor(i,e=new vGe){this._collector=i;this._validationStatus=e}info(i){this._validationStatus.state=1,this._collector.info(i)}warn(i){this._validationStatus.state=2,this._collector.warn(i)}error(i){this._validationStatus.state=3,this._collector.error(i)}fatal(i){this._validationStatus.state=4,this._collector.error(i)}get status(){return this._validationStatus}},bIe;(c=>(c.ProblemPattern={default:{regexp:"^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$",file:1,location:2,message:3},type:"object",additionalProperties:!1,properties:{regexp:{type:"string",description:d(15867,null)},kind:{type:"string",description:d(15862,null)},file:{type:"integer",description:d(15861,null)},location:{type:"integer",description:d(15864,null)},line:{type:"integer",description:d(15863,null)},column:{type:"integer",description:d(15858,null)},endLine:{type:"integer",description:d(15860,null)},endColumn:{type:"integer",description:d(15859,null)},severity:{type:"integer",description:d(15868,null)},code:{type:"integer",description:d(15857,null)},message:{type:"integer",description:d(15866,null)},loop:{type:"boolean",description:d(15865,null)}}},c.NamedProblemPattern=io(c.ProblemPattern),c.NamedProblemPattern.properties=io(c.NamedProblemPattern.properties)||{},c.NamedProblemPattern.properties.name={type:"string",description:d(15819,null)},c.MultiLineProblemPattern={type:"array",items:c.ProblemPattern},c.NamedMultiLineProblemPattern={type:"object",additionalProperties:!1,properties:{name:{type:"string",description:d(15815,null)},patterns:{type:"array",description:d(15816,null),items:c.ProblemPattern}}},c.WatchingPattern={type:"object",additionalProperties:!1,properties:{regexp:{type:"string",description:d(15870,null)},file:{type:"integer",description:d(15869,null)}}},c.PatternType={anyOf:[{type:"string",description:d(15821,null)},c.ProblemPattern,c.MultiLineProblemPattern],description:d(15820,null)},c.ProblemMatcher={type:"object",additionalProperties:!1,properties:{base:{type:"string",description:d(15838,null)},owner:{type:"string",description:d(15840,null)},source:{type:"string",description:d(15842,null)},severity:{type:"string",enum:["error","warning","info"],description:d(15841,null)},applyTo:{type:"string",enum:["allDocuments","openDocuments","closedDocuments"],description:d(15833,null)},pattern:c.PatternType,fileLocation:{oneOf:[{type:"string",enum:["absolute","relative","autoDetect","search"]},{type:"array",prefixItems:[{type:"string",enum:["absolute","relative","autoDetect","search"]}],minItems:1,maxItems:1,additionalItems:!1},{type:"array",prefixItems:[{type:"string",enum:["relative","autoDetect"]},{type:"string"}],minItems:2,maxItems:2,additionalItems:!1,examples:[["relative","${workspaceFolder}"],["autoDetect","${workspaceFolder}"]]},{type:"array",prefixItems:[{type:"string",enum:["search"]},{type:"object",properties:{include:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},exclude:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]}},required:["include"]}],minItems:2,maxItems:2,additionalItems:!1,examples:[["search",{include:["${workspaceFolder}"]}],["search",{include:["${workspaceFolder}"],exclude:[]}]]}],description:d(15839,null)},background:{type:"object",additionalProperties:!1,description:d(15834,null),properties:{activeOnStart:{type:"boolean",description:d(15835,null)},beginsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(15836,null)},endsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(15837,null)}}},watching:{type:"object",additionalProperties:!1,deprecationMessage:d(15846,null),description:d(15843,null),properties:{activeOnStart:{type:"boolean",description:d(15844,null)},beginsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(15845,null)},endsPattern:{oneOf:[{type:"string"},c.WatchingPattern],description:d(15847,null)}}}}},c.LegacyProblemMatcher=io(c.ProblemMatcher),c.LegacyProblemMatcher.properties=io(c.LegacyProblemMatcher.properties)||{},c.LegacyProblemMatcher.properties.watchedTaskBeginsRegExp={type:"string",deprecationMessage:d(15810,null),description:d(15809,null)},c.LegacyProblemMatcher.properties.watchedTaskEndsRegExp={type:"string",deprecationMessage:d(15812,null),description:d(15811,null)},c.NamedProblemMatcher=io(c.ProblemMatcher),c.NamedProblemMatcher.properties=io(c.NamedProblemMatcher.properties)||{},c.NamedProblemMatcher.properties.name={type:"string",description:d(15818,null)},c.NamedProblemMatcher.properties.label={type:"string",description:d(15817,null)}))(bIe||={});var U0o=zn.registerExtensionPoint({extensionPoint:"problemPatterns",jsonSchema:{description:d(15848,null),type:"array",items:{anyOf:[bIe.NamedProblemPattern,bIe.NamedMultiLineProblemPattern]}}}),H2i=class{constructor(){this.patterns=Object.create(null),this.fillDefaults(),this.readyPromise=new Promise((i,e)=>{U0o.setHandler((t,o)=>{try{o.removed.forEach(n=>{let r=n.value;for(let s of r)this.patterns[s.name]&&delete this.patterns[s.name]}),o.added.forEach(n=>{let r=n.value,s=new nYt(new rYt(n.collector));for(let l of r){if(dae.NamedMultiLineCheckedProblemPattern.is(l)){let c=s.parse(l);s.problemReporter.status.state<3?this.add(c.name,c.patterns):(n.collector.error(d(15856,null)),n.collector.error(JSON.stringify(l,void 0,4)))}else if(dae.NamedProblemPattern.is(l)){let c=s.parse(l);s.problemReporter.status.state<3?this.add(l.name,c):(n.collector.error(d(15856,null)),n.collector.error(JSON.stringify(l,void 0,4)))}s.reset()}})}catch{}i(void 0)})})}onReady(){return this.readyPromise}add(i,e){this.patterns[i]=e}get(i){return this.patterns[i]}fillDefaults(){this.add("msCompile",{regexp:/^\s*(?:\s*\d+>)?(\S.*?)(?:\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\))?\s*:\s+(?:(\S+)\s+)?((?:fatal +)?error|warning|info)\s+(\w+\d+)?\s*:\s*(.*)$/,kind:1,file:1,location:2,severity:4,code:5,message:6}),this.add("gulp-tsc",{regexp:/^([^\s].*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(\d+)\s+(.*)$/,kind:1,file:1,location:2,code:3,message:4}),this.add("cpp",{regexp:/^(\S.*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(error|warning|info)\s+(C\d+)\s*:\s*(.*)$/,kind:1,file:1,location:2,severity:3,code:4,message:5}),this.add("csc",{regexp:/^(\S.*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(error|warning|info)\s+(CS\d+)\s*:\s*(.*)$/,kind:1,file:1,location:2,severity:3,code:4,message:5}),this.add("vb",{regexp:/^(\S.*)\((\d+|\d+,\d+|\d+,\d+,\d+,\d+)\):\s+(error|warning|info)\s+(BC\d+)\s*:\s*(.*)$/,kind:1,file:1,location:2,severity:3,code:4,message:5}),this.add("lessCompile",{regexp:/^\s*(.*) in file (.*) line no. (\d+)$/,kind:1,message:1,file:2,line:3}),this.add("jshint",{regexp:/^(.*):\s+line\s+(\d+),\s+col\s+(\d+),\s(.+?)(?:\s+\((\w)(\d+)\))?$/,kind:1,file:1,line:2,character:3,message:4,severity:5,code:6}),this.add("jshint-stylish",[{regexp:/^(.+)$/,kind:1,file:1},{regexp:/^\s+line\s+(\d+)\s+col\s+(\d+)\s+(.+?)(?:\s+\((\w)(\d+)\))?$/,line:1,character:2,message:3,severity:4,code:5,loop:!0}]),this.add("eslint-compact",{regexp:/^(.+):\sline\s(\d+),\scol\s(\d+),\s(Error|Warning|Info)\s-\s(.+)\s\((.+)\)$/,file:1,kind:1,line:2,character:3,severity:4,message:5,code:6}),this.add("eslint-stylish",[{regexp:/^((?:[a-zA-Z]:)*[./\\]+.*?)$/,kind:1,file:1},{regexp:/^\s+(\d+):(\d+)\s+(error|warning|info)\s+(.+?)(?:\s\s+(.*))?$/,line:1,character:2,severity:3,message:4,code:5,loop:!0}]),this.add("go",{regexp:/^([^:]*: )?((.:)?[^:]*):(\d+)(:(\d+))?: (.*)$/,kind:1,file:2,line:4,character:6,message:7})}},aj=new H2i,IGe=class extends zpt{constructor(i){super(i)}parse(i){let e=this.createProblemMatcher(i);if(this.checkProblemMatcherValid(i,e))return this.addWatchingMatcher(i,e),e}checkProblemMatcherValid(i,e){return e?e.pattern?e.owner?bn(e.fileLocation)?(this.error(d(15825,null,JSON.stringify(i,null,4))),!1):!0:(this.error(d(15827,null,JSON.stringify(i,null,4))),!1):(this.error(d(15829,null,JSON.stringify(i,null,4))),!1):(this.error(d(15828,null,JSON.stringify(i,null,4))),!1)}createProblemMatcher(i){let e=null,t=We(i.owner)?i.owner:ht(),o=We(i.source)?i.source:void 0,n=We(i.applyTo)?Kpt.fromString(i.applyTo):0;n||(n=0);let r,s,l;if(bn(i.fileLocation))r=1,s="${workspaceFolder}";else if(We(i.fileLocation))l=bGe.fromString(i.fileLocation),l&&(r=l,l===1||l===3?s="${workspaceFolder}":l===4&&(s={include:["${workspaceFolder}"]}));else if(vI(i.fileLocation)){let p=i.fileLocation;p.length>0&&(l=bGe.fromString(p[0]),p.length===1&&l===2?r=l:p.length===2&&(l===1||l===3)&&p[1]&&(r=l,s=p[1]))}else Array.isArray(i.fileLocation)&&bGe.fromString(i.fileLocation[0])===4&&(r=4,s=i.fileLocation[1]??{include:["${workspaceFolder}"]});let c=i.pattern?this.createProblemPattern(i.pattern):void 0,u=i.severity?wt.fromValue(i.severity):void 0;if(u===wt.Ignore&&(this.info(d(15832,null,i.severity)),u=wt.Error),We(i.base)){let p=i.base;if(p.length>1&&p[0]==="$"){let h=wS.get(p.substring(1));h&&(e=io(h),i.owner!==void 0&&t!==void 0&&(e.owner=t),i.source!==void 0&&o!==void 0&&(e.source=o),i.fileLocation!==void 0&&r!==void 0&&(e.fileLocation=r,e.filePrefix=s),i.pattern!==void 0&&c!==void 0&&c!==null&&(e.pattern=c),i.severity!==void 0&&u!==void 0&&(e.severity=u),i.applyTo!==void 0&&n!==void 0&&(e.applyTo=n))}}else r&&c&&(e={owner:t,applyTo:n,fileLocation:r,pattern:c},o&&(e.source=o),s&&(e.filePrefix=s),u&&(e.severity=u));return dae.isNamedProblemMatcher(i)&&(e.name=i.name,e.label=We(i.label)?i.label:i.name),e}createProblemPattern(i){if(We(i)){let e=i;if(e.length>1&&e[0]==="$"){let t=aj.get(e.substring(1));return t||this.error(d(15824,null,e)),t}else e.length===0?this.error(d(15826,null)):this.error(d(15830,null,e))}else if(i){let e=new nYt(this.problemReporter);return Array.isArray(i),e.parse(i)}return null}addWatchingMatcher(i,e){let t=this.createRegularExpression(i.watchedTaskBeginsRegExp),o=this.createRegularExpression(i.watchedTaskEndsRegExp);if(t&&o){e.watching={activeOnStart:!1,beginsPattern:{regexp:t},endsPattern:{regexp:o}};return}let n=i.background||i.watching;if(mr(n))return;let r=this.createWatchingPattern(n.beginsPattern),s=this.createWatchingPattern(n.endsPattern);if(r&&s){e.watching={activeOnStart:Xa(n.activeOnStart)?n.activeOnStart:!1,beginsPattern:r,endsPattern:s};return}(r||s)&&this.error(d(15831,null))}createWatchingPattern(i){if(mr(i))return null;let e,t;return We(i)?e=this.createRegularExpression(i):(e=this.createRegularExpression(i.regexp),on(i.file)&&(t=i.file)),e?t?{regexp:e,file:t}:{regexp:e,file:1}:null}createRegularExpression(i){let e=null;if(!i)return e;try{e=new RegExp(i)}catch{this.error(d(15823,null,i))}return e}},j_n=zn.registerExtensionPoint({extensionPoint:"problemMatchers",deps:[U0o],jsonSchema:{description:d(15822,null),type:"array",items:bIe.NamedProblemMatcher}}),U2i=class{constructor(){this._onMatchersChanged=new T;this.onMatcherChanged=this._onMatchersChanged.event;this.matchers=Object.create(null),this.fillDefaults(),this.readyPromise=new Promise((i,e)=>{j_n.setHandler((t,o)=>{try{o.removed.forEach(r=>{let s=r.value;for(let l of s)this.matchers[l.name]&&delete this.matchers[l.name]}),o.added.forEach(r=>{let s=r.value,l=new IGe(new rYt(r.collector));for(let c of s){let u=l.parse(c);u&&z2i(u)&&this.add(u)}}),(o.removed.length>0||o.added.length>0)&&this._onMatchersChanged.fire()}catch{}let n=this.get("tsc-watch");n&&(n.tscWatch=!0),i(void 0)})})}onReady(){return aj.onReady(),this.readyPromise}add(i){this.matchers[i.name]=i}get(i){return this.matchers[i]}keys(){return Object.keys(this.matchers)}fillDefaults(){this.add({name:"msCompile",label:d(15814,null),owner:"msCompile",source:"cpp",applyTo:0,fileLocation:2,pattern:aj.get("msCompile")}),this.add({name:"lessCompile",label:d(15813,null),deprecated:!0,owner:"lessCompile",source:"less",applyTo:0,fileLocation:2,pattern:aj.get("lessCompile"),severity:wt.Error}),this.add({name:"gulp-tsc",label:d(15806,null),owner:"typescript",source:"ts",applyTo:2,fileLocation:1,filePrefix:"${workspaceFolder}",pattern:aj.get("gulp-tsc")}),this.add({name:"jshint",label:d(15807,null),owner:"jshint",source:"jshint",applyTo:0,fileLocation:2,pattern:aj.get("jshint")}),this.add({name:"jshint-stylish",label:d(15808,null),owner:"jshint",source:"jshint",applyTo:0,fileLocation:2,pattern:aj.get("jshint-stylish")}),this.add({name:"eslint-compact",label:d(15803,null),owner:"eslint",source:"eslint",applyTo:0,fileLocation:2,filePrefix:"${workspaceFolder}",pattern:aj.get("eslint-compact")}),this.add({name:"eslint-stylish",label:d(15804,null),owner:"eslint",source:"eslint",applyTo:0,fileLocation:2,pattern:aj.get("eslint-stylish")}),this.add({name:"go",label:d(15805,null),owner:"go",source:"go",applyTo:0,fileLocation:1,filePrefix:"${workspaceFolder}",pattern:aj.get("go")})}},wS=new U2i;var z0o="task.hasPromptedForAutomaticTasks.v2",Gpt="task.allowAutomaticTasks",yGe=class extends k{constructor(e,t,o,n,r,s,l){super();this._taskService=e;this._configurationService=t;this._workspaceTrustManagementService=o;this._logService=n;this._storageService=r;this._notificationService=s;this._openerService=l;this._hasRunTasks=!1;this._taskService.isReconnected?this._tryRunTasks():this._register(U.once(this._taskService.onDidReconnectToTasks)(async()=>await this._tryRunTasks())),this._register(this._workspaceTrustManagementService.onDidChangeTrust(async()=>await this._tryRunTasks()))}async _tryRunTasks(){if(!this._workspaceTrustManagementService.isWorkspaceTrusted())return;let{value:e,userValue:t}=this._configurationService.inspect(Gpt);if(this._hasRunTasks||e==="off"&&t!==void 0)return;this._hasRunTasks=!0,this._logService.trace("RunAutomaticTasks: Trying to run tasks."),this._taskService.hasTaskSystemInfo||(this._logService.trace("RunAutomaticTasks: Awaiting task system info."),await U.toPromise(U.once(this._taskService.onDidChangeTaskSystemInfo)));let o=await this._taskService.getWorkspaceTasks(2);this._logService.trace(`RunAutomaticTasks: Found ${o.size} automatic tasks`);let n=this._findAutoTasks(this._taskService,o);if(this._logService.trace(`RunAutomaticTasks: taskNames=${JSON.stringify(n.taskNames)}`),n.taskNames.length===0){if(!await Promise.race([new Promise(s=>{U.toPromise(U.once(this._taskService.onDidChangeTaskConfig)).then(()=>s(!0))}),new Promise(s=>{let l=setTimeout(()=>{clearTimeout(l),s(!1)},1e4)})])){this._logService.trace("RunAutomaticTasks: waited some extra time, but no update of tasks configuration");return}o=await this._taskService.getWorkspaceTasks(2),n=this._findAutoTasks(this._taskService,o),this._logService.trace(`RunAutomaticTasks: updated taskNames=${JSON.stringify(n.taskNames)}`)}this._runWithPermission(this._taskService,this._configurationService,this._storageService,this._notificationService,this._openerService,n.tasks,n.taskNames,n.locations)}_runTasks(e,t){t.forEach(o=>{o instanceof Promise?o.then(n=>{n&&e.run(n)}):e.run(o)})}_getTaskSource(e){switch(Vl.toConfigurationTarget(e.kind)){case 6:return Ve(e.config.workspaceFolder.uri,e.config.file);case 5:return e.config.workspace?.configuration??void 0}}_findAutoTasks(e,t){let o=new Array,n=new Array,r=new Map;return t&&t.forEach(s=>{if(s.set&&s.set.tasks.forEach(l=>{if(l.runOptions.runOn===2){o.push(l),n.push(l._label);let c=this._getTaskSource(l._source);c&&r.set(c.fsPath,c)}}),s.configurations){for(let l of Object.values(s.configurations.byIdentifier))if(l.runOptions.runOn===2){o.push(new Promise(u=>{e.getTask(s.workspaceFolder,l._id,!0).then(p=>u(p))})),l._label?n.push(l._label):n.push(l.configures.task);let c=this._getTaskSource(l._source);c&&r.set(c.fsPath,c)}}}),{tasks:o,taskNames:n,locations:r}}async _runWithPermission(e,t,o,n,r,s,l,c){if(l.length===0)return;if(t.getValue(Gpt)==="on"){this._runTasks(e,s);return}if(o.getBoolean(z0o,1,!1))return;await this._showPrompt(n,o,r,t,l,c)&&this._runTasks(e,s)}_showPrompt(e,t,o,n,r,s){return new Promise(l=>{e.prompt(ft.Info,d(15583,null,r.join(", "),Array.from(s.keys()).join(", ")),[{label:d(15579,null),run:()=>{l(!0),n.updateValue(Gpt,"on",2)}},{label:d(15580,null),run:()=>{l(!1),n.updateValue(Gpt,"off",2)}},{label:s.size===1?d(15581,null):d(15582,null),run:async()=>{for(let c of s)await o.open(c[1]);l(!1)}}],{onCancel:()=>l(!1)}),t.store(z0o,!0,1,1)})}};yGe=I([m(0,yf),m(1,B),m(2,Or),m(3,re),m(4,de),m(5,Ne),m(6,Je)],yGe);var wGe=class a extends z{static{this.ID="workbench.action.tasks.manageAutomaticRunning"}static{this.LABEL=d(15586,null)}constructor(){super({id:a.ID,title:a.LABEL,category:Yx})}async run(i){let e=i.get($e),t=i.get(B),o={label:d(15584,null)},n={label:d(15585,null)},r=await e.pick([o,n],{canPickMany:!1});r&&t.updateValue(Gpt,r===o?"on":"off",2)}};var Y_n={definitions:{showOutputType:{type:"string",enum:["always","silent","never"]},options:{type:"object",description:d(15775,null),properties:{cwd:{type:"string",description:d(15776,null)},env:{type:"object",additionalProperties:{type:"string"},description:d(15777,null)}},additionalProperties:{type:["string","array","object"]}},problemMatcherType:{oneOf:[{type:"string",errorMessage:d(15790,null)},bIe.LegacyProblemMatcher,{type:"array",items:{anyOf:[{type:"string",errorMessage:d(15790,null)},bIe.LegacyProblemMatcher]}}]},shellConfiguration:{type:"object",additionalProperties:!1,description:d(15781,null),properties:{executable:{type:"string",description:d(15780,null)},args:{type:"array",description:d(15779,null),items:{type:"string"}}}},commandConfiguration:{type:"object",additionalProperties:!1,properties:{command:{type:"string",description:d(15772,null)},args:{type:"array",description:d(15785,null),items:{type:"string"}},options:{$ref:"#/definitions/options"}}},taskDescription:{type:"object",required:["taskName"],additionalProperties:!1,properties:{taskName:{type:"string",description:d(15795,null)},command:{type:"string",description:d(15772,null)},args:{type:"array",description:d(15785,null),items:{type:"string"}},options:{$ref:"#/definitions/options"},windows:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(15799,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(15791,null)}}}]},osx:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(15789,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(15791,null)}}}]},linux:{anyOf:[{$ref:"#/definitions/commandConfiguration",description:d(15788,null)},{properties:{problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(15791,null)}}}]},suppressTaskName:{type:"boolean",description:d(15794,null),default:!0},showOutput:{$ref:"#/definitions/showOutputType",description:d(15793,null)},echoCommand:{type:"boolean",description:d(15773,null),default:!0},isWatching:{type:"boolean",deprecationMessage:d(15798,null),description:d(15797,null),default:!0},isBackground:{type:"boolean",description:d(15786,null),default:!0},promptOnClose:{type:"boolean",description:d(15792,null),default:!1},isBuildCommand:{type:"boolean",description:d(15787,null),default:!0},isTestCommand:{type:"boolean",description:d(15796,null),default:!0},problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(15791,null)}}},taskRunnerConfiguration:{type:"object",required:[],properties:{command:{type:"string",description:d(15772,null)},args:{type:"array",description:d(15770,null),items:{type:"string"}},options:{$ref:"#/definitions/options"},showOutput:{$ref:"#/definitions/showOutputType",description:d(15782,null)},isWatching:{type:"boolean",deprecationMessage:d(15802,null),description:d(15801,null),default:!0},isBackground:{type:"boolean",description:d(15771,null),default:!0},promptOnClose:{type:"boolean",description:d(15778,null),default:!1},echoCommand:{type:"boolean",description:d(15773,null),default:!0},suppressTaskName:{type:"boolean",description:d(15783,null),default:!0},taskSelector:{type:"string",description:d(15800,null)},problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(15774,null)},tasks:{type:"array",description:d(15784,null),items:{type:"object",$ref:"#/definitions/taskDescription"}}}}}},aYt=Y_n;var lYt={oneOf:[{allOf:[{type:"object",required:["version"],properties:{version:{type:"string",enum:["0.1.0"],deprecationMessage:d(15685,null),description:d(15684,null)},_runner:{deprecationMessage:d(15679,null)},runner:{type:"string",enum:["process","terminal"],default:"process",description:d(15682,null)},windows:{$ref:"#/definitions/taskRunnerConfiguration",description:d(15686,null)},osx:{$ref:"#/definitions/taskRunnerConfiguration",description:d(15681,null)},linux:{$ref:"#/definitions/taskRunnerConfiguration",description:d(15680,null)}}},{$ref:"#/definitions/taskRunnerConfiguration"}]}]},G2i={type:"boolean",default:!0,description:d(15683,null)};lYt.definitions=io(aYt.definitions);var h7=lYt.definitions;h7.commandConfiguration.properties.isShellCommand=io(G2i);h7.taskDescription.properties.isShellCommand=io(G2i);h7.taskRunnerConfiguration.properties.isShellCommand=io(G2i);Object.getOwnPropertyNames(h7).forEach(a=>{let i=a+"1";h7[i]=h7[a],delete h7[a]});function K2i(a){Array.isArray(a)?a.forEach(i=>{typeof i=="object"&&i!==null&&K2i(i)}):typeof a=="object"&&(a.$ref&&(a.$ref=a.$ref+"1"),Object.getOwnPropertyNames(a).forEach(i=>{let e=a[i];(Array.isArray(e)||typeof e=="object")&&K2i(e)}))}K2i(lYt);wS.onReady().then(()=>{try{let a=wS.keys().map(i=>"$"+i);h7.problemMatcherType1.oneOf[0].enum=a,h7.problemMatcherType1.oneOf[2].items.anyOf[1].enum=a}catch{console.log("Installing problem matcher ids failed")}});var q2i=lYt;function cYt(a){Array.isArray(a)?a.forEach(i=>{typeof i=="object"&&i!==null&&cYt(i)}):typeof a=="object"&&(a.$ref&&(a.$ref=a.$ref+"2"),Object.getOwnPropertyNames(a).forEach(i=>{let e=a[i];(Array.isArray(e)||typeof e=="object"&&e!==null)&&cYt(e)}))}var $2i={anyOf:[{type:"boolean",default:!0,description:d(15698,null)},{$ref:"#/definitions/shellConfiguration"}],deprecationMessage:d(15732,null)},q0o={type:"boolean",description:d(15694,null),default:!0},$0o={type:"boolean",description:d(15695,null),default:!1},K0o={type:"object",additionalProperties:!0,properties:{type:{type:"string",description:d(15704,null)}}},j0o={anyOf:[{type:"string",description:d(15705,null)},K0o,{type:"array",description:d(15703,null),items:{anyOf:[{type:"string"},K0o]}}],description:d(15702,null)},Q0o={type:"string",enum:["parallel","sequence"],enumDescriptions:[d(15707,null),d(15708,null)],default:"parallel",description:d(15706,null)},Y0o={type:"string",description:d(15709,null)},X0o={type:"object",description:d(15719,null),properties:{id:{description:d(15721,null),type:["string","null"],enum:Array.from(l5(),a=>a.id),markdownEnumDescriptions:Array.from(l5(),a=>`$(${a.id})`)},color:{description:d(15720,null),type:["string","null"],enum:["terminal.ansiBlack","terminal.ansiRed","terminal.ansiGreen","terminal.ansiYellow","terminal.ansiBlue","terminal.ansiMagenta","terminal.ansiCyan","terminal.ansiWhite"]}}},dYt={type:"object",default:{echo:!0,reveal:"always",focus:!1,panel:"shared",showReuseMessage:!0,clear:!1},description:d(15736,null),additionalProperties:!1,properties:{echo:{type:"boolean",default:!0,description:d(15739,null)},focus:{type:"boolean",default:!1,description:d(15740,null)},revealProblems:{type:"string",enum:["always","onProblem","never"],enumDescriptions:[d(15749,null),d(15751,null),d(15750,null)],default:"never",description:d(15748,null)},reveal:{type:"string",enum:["always","silent","never"],enumDescriptions:[d(15745,null),d(15747,null),d(15746,null)],default:"always",description:d(15744,null)},panel:{type:"string",enum:["shared","dedicated","new"],default:"shared",description:d(15742,null)},showReuseMessage:{type:"boolean",default:!0,description:d(15752,null)},clear:{type:"boolean",default:!1,description:d(15737,null)},group:{type:"string",description:d(15741,null)},close:{type:"boolean",description:d(15738,null)},preserveTerminalName:{type:"boolean",default:!1,description:d(15743,null)}}},J0o=io(dYt);J0o.deprecationMessage=d(15766,null);var G0o={type:"string",enum:["build","test","none"],enumDescriptions:[d(15712,null),d(15718,null),d(15717,null)],description:d(15716,null)},j2i={oneOf:[G0o,{type:"object",properties:{kind:G0o,isDefault:{type:["boolean","string"],default:!1,description:d(15715,null)}}}],defaultSnippets:[{body:{kind:"build",isDefault:!0},description:d(15713,null)},{body:{kind:"test",isDefault:!0},description:d(15714,null)}],description:d(15711,null)},Z0o={type:"string",enum:["shell"],default:"process",description:d(15767,null)},X_n={oneOf:[{oneOf:[{type:"string"},{type:"array",items:{type:"string"},description:d(15692,null)}]},{type:"object",required:["value","quoting"],properties:{value:{oneOf:[{type:"string"},{type:"array",items:{type:"string"},description:d(15692,null)}],description:d(15690,null)},quoting:{type:"string",enum:["escape","strong","weak"],enumDescriptions:[d(15754,null),d(15755,null),d(15756,null)],default:"strong",description:d(15691,null)}}}],description:d(15689,null)},eWo={type:"array",items:{oneOf:[{type:"string"},{type:"object",required:["value","quoting"],properties:{value:{type:"string",description:d(15687,null)},quoting:{type:"string",enum:["escape","strong","weak"],enumDescriptions:[d(15754,null),d(15755,null),d(15756,null)],default:"strong",description:d(15688,null)}}}]},description:d(15699,null)},J_n={type:"string",description:d(15734,null)},tWo={type:"string",enum:["2.0.0"],description:d(15768,null)},iWo={type:"string",description:d(15722,null),deprecationMessage:d(15723,null)},oWo={type:"object",additionalProperties:!1,properties:{reevaluateOnRerun:{type:"boolean",description:d(15757,null),default:!0},runOn:{type:"string",enum:["default","folderOpen","worktreeCreated"],description:d(15758,null),default:"default"},instanceLimit:{type:"number",description:d(15724,null),default:1},instancePolicy:{type:"string",enum:["terminateNewest","terminateOldest","prompt","warn","silent"],enumDescriptions:[d(15728,null),d(15729,null),d(15726,null),d(15730,null),d(15727,null)],description:d(15725,null),default:"prompt"}},description:d(15759,null)},Q2i=aYt.definitions,nWo=io(Q2i.options),Z_n=nWo.properties;Z_n.shell=io(Q2i.shellConfiguration);var rWo={type:"object",additionalProperties:!1,properties:{label:{type:"string",description:d(15762,null)},taskName:{type:"string",description:d(15763,null),deprecationMessage:d(15764,null)},identifier:io(iWo),group:io(j2i),isBackground:{type:"boolean",description:d(15700,null),default:!0},promptOnClose:{type:"boolean",description:d(15753,null),default:!1},presentation:io(dYt),icon:io(X0o),hide:io(q0o),inAgents:io($0o),options:nWo,problemMatcher:{$ref:"#/definitions/problemMatcherType",description:d(15735,null)},runOptions:io(oWo),dependsOn:io(j0o),dependsOrder:io(Q0o),detail:io(Y0o)}},CGe=[];xE.onReady().then(()=>{Y2i()});function Y2i(){for(let a of xE.all()){if(CGe.find(t=>t.properties?.type?.enum?.find?t.properties?.type.enum.find(o=>o===a.taskType):void 0))continue;let i=io(rWo),e=i.properties;if(e.type={type:"string",description:d(15693,null),enum:[a.taskType]},a.required?i.required=a.required.slice():i.required=[],i.required.push("type"),a.properties)for(let t of Object.keys(a.properties)){let o=a.properties[t];e[t]=io(o)}cYt(i),CGe.push(i)}}var qpt=io(rWo);qpt.properties.customize={type:"string",deprecationMessage:d(15701,null)};qpt.required||(qpt.required=[]);qpt.required.push("customize");CGe.push(qpt);var Y_=io(Q2i),uYt=Y_.taskDescription;uYt.required=["label"];var by=uYt.properties;by.label=io(J_n);by.command=io(X_n);by.args=io(eWo);by.isShellCommand=io($2i);by.dependsOn=j0o;by.hide=io(q0o);by.inAgents=io($0o);by.dependsOrder=Q0o;by.identifier=io(iWo);by.type=io(Z0o);by.presentation=io(dYt);by.terminal=J0o;by.icon=io(X0o);by.group=io(j2i);by.runOptions=io(oWo);by.detail=Y0o;by.taskName.deprecationMessage=d(15764,null);var pYt=io(uYt);uYt.default={label:"My Task",type:"shell",command:"echo Hello",problemMatcher:[]};Y_.showOutputType.deprecationMessage=d(15760,null);by.echoCommand.deprecationMessage=d(15710,null);by.suppressTaskName.deprecationMessage=d(15761,null);by.isBuildCommand.deprecationMessage=d(15731,null);by.isTestCommand.deprecationMessage=d(15733,null);pYt.properties.type={type:"string",enum:["process"],default:"process",description:d(15767,null)};pYt.required.push("command");pYt.required.push("type");CGe.push(pYt);CGe.push({$ref:"#/definitions/taskDescription"});var g7=Y_.taskRunnerConfiguration.properties,eDn=g7.tasks;eDn.items={oneOf:CGe};g7.inputs=dNe.definitions.inputs;Y_.commandConfiguration.properties.isShellCommand=io($2i);Y_.commandConfiguration.properties.args=io(eWo);Y_.options.properties.shell={$ref:"#/definitions/shellConfiguration"};g7.isShellCommand=io($2i);g7.type=io(Z0o);g7.group=io(j2i);g7.presentation=io(dYt);g7.suppressTaskName.deprecationMessage=d(15761,null);g7.taskSelector.deprecationMessage=d(15765,null);var X2i=io(Y_.taskRunnerConfiguration);delete X2i.properties.tasks;X2i.additionalProperties=!1;Y_.osSpecificTaskRunnerConfiguration=X2i;g7.version=io(tWo);var J2i={oneOf:[{allOf:[{type:"object",required:["version"],properties:{version:io(tWo),windows:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(15769,null)},osx:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(15697,null)},linux:{$ref:"#/definitions/osSpecificTaskRunnerConfiguration",description:d(15696,null)}}},{$ref:"#/definitions/taskRunnerConfiguration"}]}]};J2i.definitions=Y_;function sWo(a,i){let e=a[i].properties;e?Object.keys(e).forEach(t=>{sWo(e,t)}):r9t(a[i])}Object.getOwnPropertyNames(Y_).forEach(a=>{let i=a+"2";Y_[i]=Y_[a],delete Y_[a],sWo(Y_,i)});cYt(J2i);function Z2i(){try{let a=wS.keys().map(i=>"$"+i);Y_.problemMatcherType2.oneOf[0].enum=a,Y_.problemMatcherType2.oneOf[2].items.anyOf[0].enum=a}catch{console.log("Installing problem matcher ids failed")}}wS.onReady().then(()=>{Z2i()});var eGi=J2i;var xGe=class{constructor(i,e,t){this.task=i,this.resolver=e,this.trigger=t}verify(){let i=!1;return this.trigger&&this.resolvedVariables&&this.workspaceFolder&&this.shellLaunchConfig!==void 0&&(i=!0),i}getVerifiedTask(){if(this.verify())return{task:this.task,resolver:this.resolver,trigger:this.trigger,resolvedVariables:this.resolvedVariables,systemInfo:this.systemInfo,workspaceFolder:this.workspaceFolder,shellLaunchConfig:this.shellLaunchConfig};throw new Error("VerifiedTask was not checked. verify must be checked before getVerifiedTask.")}},mL=class{constructor(i,e,t){this.severity=i,this.message=e,this.code=t}},SIe;(t=>(t.shortcut="shortcut",t.command="command",t.reconnect="reconnect"))(SIe||={});var tDn={id:"dotnetCore",label:".NET Core",sort:"NET Core",autoDetect:!1,description:d(15904,null),content:["{","	// See https://go.microsoft.com/fwlink/?LinkId=733558","	// for the documentation about the tasks.json format",'	"version": "2.0.0",','	"tasks": [',"		{",'			"label": "build",','			"command": "dotnet",','			"type": "shell",','			"args": [','				"build",',"				// Ask dotnet build to generate full paths for file names.",'				"/property:GenerateFullPaths=true",',"				// Do not generate summary otherwise it leads to duplicate errors in Problems panel",'				"/consoleloggerparameters:NoSummary"',"			],",'			"group": "build",','			"presentation": {','				"reveal": "silent"',"			},",'			"problemMatcher": "$msCompile"',"		}","	]","}"].join(`
`)},iDn={id:"msbuild",label:"MSBuild",autoDetect:!1,description:d(15907,null),content:["{","	// See https://go.microsoft.com/fwlink/?LinkId=733558","	// for the documentation about the tasks.json format",'	"version": "2.0.0",','	"tasks": [',"		{",'			"label": "build",','			"type": "shell",','			"command": "msbuild",','			"args": [',"				// Ask msbuild to generate full paths for file names.",'				"/property:GenerateFullPaths=true",','				"/t:build",',"				// Do not generate summary otherwise it leads to duplicate errors in Problems panel",'				"/consoleloggerparameters:NoSummary"',"			],",'			"group": "build",','			"presentation": {',"				// Reveal the output only if unrecognized errors occur.",'				"reveal": "silent"',"			},","			// Use the standard MS compiler pattern to detect errors, warnings and infos",'			"problemMatcher": "$msCompile"',"		}","	]","}"].join(`
`)},oDn={id:"externalCommand",label:"Others",autoDetect:!1,description:d(15905,null),content:["{","	// See https://go.microsoft.com/fwlink/?LinkId=733558","	// for the documentation about the tasks.json format",'	"version": "2.0.0",','	"tasks": [',"		{",'			"label": "echo",','			"type": "shell",','			"command": "echo Hello"',"		}","	]","}"].join(`
`)},nDn={id:"maven",label:"maven",sort:"MVN",autoDetect:!1,description:d(15906,null),content:["{","	// See https://go.microsoft.com/fwlink/?LinkId=733558","	// for the documentation about the tasks.json format",'	"version": "2.0.0",','	"tasks": [',"		{",'			"label": "verify",','			"type": "shell",','			"command": "mvn -B verify",','			"group": "build"',"		},","		{",'			"label": "test",','			"type": "shell",','			"command": "mvn -B test",','			"group": "test"',"		}","	]","}"].join(`
`)},mYt=null;function aWo(){return mYt||(mYt=[tDn,iDn,nDn].sort((a,i)=>(a.sort||a.label).localeCompare(i.sort||i.label)),mYt.push(oDn)),mYt}var lWo;(i=>{function a(e){return e!==void 0&&We(e.type)}i.is=a})(lWo||={});var lDn;(i=>{function a(e){return We(e)?e:vI(e)?e.join(" "):We(e.value)?e.value:e.value.join(" ")}i.value=a})(lDn||={});var rGi=[];Object.freeze(rGi);function UO(a,i,e){let t=i[e];t!==void 0&&(a[e]=t)}function lj(a,i,e){let t=i[e];a[e]===void 0&&t!==void 0&&(a[e]=t)}function v7(a,i,e=!1){if(a==null||i===void 0)return!0;for(let t of i){let o=a[t.property];if(o!=null){if(t.type!==void 0&&!t.type.isEmpty(o))return!1;if(!Array.isArray(o)||o.length>0||e)return!1}}return!0}function sGi(a,i,e){if(!i||v7(i,e))return a;if(!a||v7(a,e))return i;for(let t of e){let o=t.property,n;t.type!==void 0?n=t.type.assignProperties(a[o],i[o]):n=i[o],n!=null&&(a[o]=n)}return a}function jpt(a,i,e,t=!1){if(!i||v7(i,e))return a;if(!a||v7(a,e,t))return i;for(let o of e){let n=o.property,r;o.type?r=o.type.fillProperties(a[n],i[n]):a[n]===void 0&&(r=i[n]),r!=null&&(a[n]=r)}return a}function cWo(a,i,e,t){if(a&&Object.isFrozen(a))return a;if(a==null||i===void 0||i===null)return i!=null?io(i):void 0;for(let o of e){let n=o.property;if(a[n]!==void 0)continue;let r;o.type?r=o.type.fillDefaults(a[n],t):r=i[n],r!=null&&(a[n]=r)}return a}function tGi(a,i){if(a!=null){if(Object.isFrozen(a))return a;for(let e of i)if(e.type){let t=a[e.property];t&&e.type.freeze(t)}return Object.freeze(a),a}}var dWo;(i=>{function a(e){if(!e)return 1;switch(e.toLowerCase()){case"folderopen":return 2;case"worktreecreated":return 3;default:return 1}}i.fromString=a})(dWo||={});var $pt;(o=>{let a=[{property:"reevaluateOnRerun"},{property:"runOn"},{property:"instanceLimit"},{property:"instancePolicy"}];function i(n){return{reevaluateOnRerun:n?n.reevaluateOnRerun:!0,runOn:n?dWo.fromString(n.runOn):1,instanceLimit:n?.instanceLimit?Math.max(n.instanceLimit,1):1,instancePolicy:n?uWo.fromString(n.instancePolicy):"prompt"}}o.fromConfiguration=i;function e(n,r){return sGi(n,r,a)}o.assignProperties=e;function t(n,r){return jpt(n,r,a)}o.fillProperties=t})($pt||={});var uWo;(i=>{function a(e){if(!e)return"prompt";switch(e.toLowerCase()){case"terminatenewest":return"terminateNewest";case"terminateoldest":return"terminateOldest";case"warn":return"warn";case"silent":return"silent";default:return"prompt"}}i.fromString=a})(uWo||={});var IIe;(l=>{let a=[{property:"executable"},{property:"args"},{property:"quoting"}];function i(c){let u=c;return u&&(We(u.executable)||vI(u.args))}l.is=i;function e(c,u){if(!i(c))return;let p={};return c.executable!==void 0&&(p.executable=c.executable),c.args!==void 0&&(p.args=c.args.slice()),c.quoting!==void 0&&(p.quoting=io(c.quoting)),p}l.from=e;function t(c){return v7(c,a,!0)}l.isEmpty=t;function o(c,u){return sGi(c,u,a)}l.assignProperties=o;function n(c,u){return jpt(c,u,a,!0)}l.fillProperties=n;function r(c,u){return c}l.fillDefaults=r;function s(c){if(c)return Object.freeze(c)}l.freeze=s})(IIe||={});var f7;(l=>{let a=[{property:"cwd"},{property:"env"},{property:"shell",type:IIe}],i={cwd:"${workspaceFolder}"};function e(c,u){let p={};return c.cwd!==void 0&&(We(c.cwd)?p.cwd=c.cwd:u.taskLoadIssues.push(d(15873,null,c.cwd))),c.env!==void 0&&(p.env=io(c.env)),p.shell=IIe.from(c.shell,u),t(p)?void 0:p}l.from=e;function t(c){return v7(c,a)}l.isEmpty=t;function o(c,u){if(u===void 0||t(u))return c;if(c===void 0||t(c))return u;if(UO(c,u,"cwd"),c.env===void 0)c.env=u.env;else if(u.env!==void 0){let p=Object.create(null);c.env!==void 0&&Object.keys(c.env).forEach(h=>p[h]=c.env[h]),u.env!==void 0&&Object.keys(u.env).forEach(h=>p[h]=u.env[h]),c.env=p}return c.shell=IIe.assignProperties(c.shell,u.shell),c}l.assignProperties=o;function n(c,u){return jpt(c,u,a)}l.fillProperties=n;function r(c,u){return cWo(c,i,a,u)}l.fillDefaults=r;function s(c){return tGi(c,a)}l.freeze=s})(f7||={});var ZV;(h=>{let a;(x=>{let g=[{property:"echo"},{property:"reveal"},{property:"revealProblems"},{property:"focus"},{property:"panel"},{property:"showReuseMessage"},{property:"clear"},{property:"group"},{property:"close"},{property:"preserveTerminalName"}];function f(E,M){let N,V,H,K,j,J,se,ae,ce,Se,Re=!1;Xa(E.echoCommand)&&(N=E.echoCommand,Re=!0),We(E.showOutput)&&(V=$me.fromString(E.showOutput),Re=!0);let xe=E.presentation||E.terminal;if(xe&&(Xa(xe.echo)&&(N=xe.echo),We(xe.reveal)&&(V=$me.fromString(xe.reveal)),We(xe.revealProblems)&&(H=DLe.fromString(xe.revealProblems)),Xa(xe.focus)&&(K=xe.focus),We(xe.panel)&&(j=RLe.fromString(xe.panel)),Xa(xe.showReuseMessage)&&(J=xe.showReuseMessage),Xa(xe.clear)&&(se=xe.clear),We(xe.group)&&(ae=xe.group),Xa(xe.close)&&(ce=xe.close),Xa(xe.preserveTerminalName)&&(Se=xe.preserveTerminalName),Re=!0),!!Re)return{echo:N,reveal:V,revealProblems:H,focus:K,panel:j,showReuseMessage:J,clear:se,group:ae,close:ce,preserveTerminalName:Se}}x.from=f;function v(E,M){return sGi(E,M,g)}x.assignProperties=v;function b(E,M){return jpt(E,M,g)}x.fillProperties=b;function S(E,M){let N=M.engine===2;return cWo(E,{echo:N,reveal:1,revealProblems:1,focus:!1,panel:1,showReuseMessage:!0,clear:!1,preserveTerminalName:!1},g,M)}x.fillDefaults=S;function y(E){return tGi(E,g)}x.freeze=y;function w(E){return v7(E,g)}x.isEmpty=w})(a=h.PresentationOptions||={});let i;(f=>{function g(v){if(v!=null){if(We(v))return v;if(vI(v))return v.join(" ");{let b=_Le.from(v.quoting),S=We(v.value)?v.value:vI(v.value)?v.value.join(" "):void 0;return S?{value:S,quoting:b}:void 0}}}f.from=g})(i||={});let e=[{property:"runtime"},{property:"name"},{property:"options",type:f7},{property:"args"},{property:"taskSelector"},{property:"suppressTaskName"},{property:"presentation",type:a}];function t(g,f){let v=o(g,f),b;return g.windows&&f.platform===3?b=o(g.windows,f):g.osx&&f.platform===1?b=o(g.osx,f):g.linux&&f.platform===2&&(b=o(g.linux,f)),b&&(v=s(v,b,f.schemaVersion===2)),r(v)?void 0:v}h.from=t;function o(g,f){let v=i.from(g.command),b;We(g.type)&&(g.type==="shell"||g.type==="process")&&(b=g8.fromString(g.type)),Xa(g.isShellCommand)||IIe.is(g.isShellCommand)?b=1:g.isShellCommand!==void 0&&(b=g.isShellCommand?1:2);let S={name:v,runtime:b,presentation:a.from(g,f)};if(g.args!==void 0){S.args=[];for(let y of g.args){let w=i.from(y);w!==void 0?S.args.push(w):f.taskLoadIssues.push(d(15872,null,y?JSON.stringify(y,void 0,4):"undefined"))}}return g.options!==void 0&&(S.options=f7.from(g.options,f),S.options&&S.options.shell===void 0&&IIe.is(g.isShellCommand)&&(S.options.shell=IIe.from(g.isShellCommand,f),f.engine!==2&&f.taskLoadIssues.push(d(15877,null)))),We(g.taskSelector)&&(S.taskSelector=g.taskSelector),Xa(g.suppressTaskName)&&(S.suppressTaskName=g.suppressTaskName),r(S)?void 0:S}function n(g){return g&&!!g.name}h.hasCommand=n;function r(g){return v7(g,e)}h.isEmpty=r;function s(g,f,v){return r(f)?g:r(g)?f:(UO(g,f,"name"),UO(g,f,"runtime"),UO(g,f,"taskSelector"),UO(g,f,"suppressTaskName"),f.args!==void 0&&(g.args===void 0||v?g.args=f.args:g.args=g.args.concat(f.args)),g.presentation=a.assignProperties(g.presentation,f.presentation),g.options=f7.assignProperties(g.options,f.options),g)}h.assignProperties=s;function l(g,f){return jpt(g,f,e)}h.fillProperties=l;function c(g,f,v){if(f===void 0||r(f))return g;if(g=g||{name:void 0,runtime:void 0,presentation:void 0},g.name===void 0){lj(g,f,"name"),lj(g,f,"taskSelector"),lj(g,f,"suppressTaskName");let b=f.args?f.args.slice():[];!g.suppressTaskName&&v&&(g.taskSelector!==void 0?b.push(g.taskSelector+v):b.push(v)),g.args&&(b=b.concat(g.args)),g.args=b}return lj(g,f,"runtime"),g.presentation=a.fillProperties(g.presentation,f.presentation),g.options=f7.fillProperties(g.options,f.options),g}h.fillGlobals=c;function u(g,f){!g||Object.isFrozen(g)||(g.name!==void 0&&g.runtime===void 0&&(g.runtime=2),g.presentation=a.fillDefaults(g.presentation,f),r(g)||(g.options=f7.fillDefaults(g.options,f)),g.args===void 0&&(g.args=rGi),g.suppressTaskName===void 0&&(g.suppressTaskName=f.schemaVersion===2))}h.fillDefaults=u;function p(g){return tGi(g,e)}h.freeze=p})(ZV||={});var Qpt;(n=>{function a(r,s){let l=Object.create(null);return Array.isArray(r)&&r.forEach(c=>{let u=new IGe(s.problemReporter).parse(c);z2i(u)?l[u.name]=u:s.problemReporter.error(d(15876,null,JSON.stringify(c,void 0,4)))}),l}n.namedFrom=a;function i(r,s){let l={},c=r;return c.windows?.problemMatcher&&s.platform===3?l=e(c.windows.problemMatcher,s):c.osx?.problemMatcher&&s.platform===1?l=e(c.osx.problemMatcher,s):c.linux?.problemMatcher&&s.platform===2?l=e(c.linux.problemMatcher,s):r.problemMatcher&&(l=e(r.problemMatcher,s)),l}n.fromWithOsConfig=i;function e(r,s){let l=[];if(r===void 0)return{value:l};let c=[];function u(h){h.value&&l.push(h.value),h.errors&&c.push(...h.errors)}let p=t(r);if(p===0){let h=d(15882,null,JSON.stringify(r,null,4));s.problemReporter.warn(h)}else p===1||p===2?u(o(r,s)):p===3&&r.forEach(g=>{u(o(g,s))});return{value:l,errors:c}}n.from=e;function t(r){return We(r)?1:Array.isArray(r)?3:bn(r)?0:2}function o(r,s){if(We(r)){let l=r;if(l.length>1&&l[0]==="$"){l=l.substring(1);let c=wS.get(l);if(c)return{value:io(c)};let u=s.namedProblemMatchers[l];if(u)return u=io(u),delete u.name,{value:u}}return{errors:[d(15874,null,r)]}}else{let l=r;return{value:new IGe(s.problemReporter).parse(l)}}}})(Qpt||={});var wIe;(e=>{function a(t){if(t!==void 0){if(We(t)&&Lh.is(t))return{_id:t,isDefault:!1};if(We(t.kind)&&Lh.is(t.kind)){let o=t.kind,n=bn(t.isDefault)?!1:t.isDefault;return{_id:o,isDefault:n}}}}e.from=a;function i(t){return We(t)?t:t.isDefault?{kind:t._id,isDefault:t.isDefault}:t._id}e.to=i})(wIe||={});var iGi;(e=>{function a(t,o){switch(o){case 2:return oU;case 0:return t.workspaceFolder.uri;default:return t.workspace&&t.workspace.configuration?t.workspace.configuration:t.workspaceFolder.uri}}function i(t,o,n){return We(t)?{uri:a(o,n),task:t}:lWo.is(t)?{uri:a(o,n),task:nU.createTaskIdentifier(t,o.problemReporter)}:void 0}e.from=i})(iGi||={});var pWo;(i=>{function a(e){switch(e){case"sequence":return"sequence";case"parallel":default:return"parallel"}}i.from=a})(pWo||={});var aGi;(t=>{let a=[{property:"name"},{property:"identifier"},{property:"group"},{property:"isBackground"},{property:"promptOnClose"},{property:"dependsOn"},{property:"presentation",type:ZV.PresentationOptions},{property:"problemMatchers"},{property:"options"},{property:"icon"},{property:"hide"},{property:"inAgents"}];function i(o,n,r,s,l){if(!o)return{};let c={};if(l)for(let p of Object.keys(l))o[p]!==void 0&&(c[p]=io(o[p]));if(We(o.taskName)&&(c.name=o.taskName),We(o.label)&&n.schemaVersion===2&&(c.name=o.label),We(o.identifier)&&(c.identifier=o.identifier),c.icon=o.icon,c.hide=o.hide,c.inAgents=o.inAgents,o.isBackground!==void 0&&(c.isBackground=!!o.isBackground),o.promptOnClose!==void 0&&(c.promptOnClose=!!o.promptOnClose),c.group=wIe.from(o.group),o.dependsOn!==void 0)if(Array.isArray(o.dependsOn))c.dependsOn=o.dependsOn.reduce((p,h)=>{let g=iGi.from(h,n,s);return g&&p.push(g),p},[]);else{let p=iGi.from(o.dependsOn,n,s);c.dependsOn=p?[p]:void 0}c.dependsOrder=pWo.from(o.dependsOrder),r&&(o.presentation!==void 0||o.terminal!==void 0)&&(c.presentation=ZV.PresentationOptions.from(o,n)),r&&o.options!==void 0&&(c.options=f7.from(o.options,n));let u=Qpt.fromWithOsConfig(o,n);return u.value!==void 0&&(c.problemMatchers=u.value),o.detail&&(c.detail=o.detail),e(c)?{}:{value:c,errors:u.errors}}t.from=i;function e(o){return v7(o,a)}t.isEmpty=e})(aGi||={});var EGe="Workspace",mWo;(r=>{let a="grunt.",i="jake.",e="gulp.",t="vscode.npm.",o="vscode.typescript.";function n(s,l,c,u,p){if(!s)return;let h=s.type,g=s.customize;if(!h&&!g){l.problemReporter.error(d(15879,null,JSON.stringify(s,null,4)));return}let f=h?p?.get?.(h)||xE.get(h):void 0;if(!f){let E=d(15881,null,h);l.problemReporter.error(E);return}let v;if(We(g)?g.indexOf(a)===0?v={type:"grunt",task:g.substring(a.length)}:g.indexOf(i)===0?v={type:"jake",task:g.substring(i.length)}:g.indexOf(e)===0?v={type:"gulp",task:g.substring(e.length)}:g.indexOf(t)===0?v={type:"npm",script:g.substring(t.length+4)}:g.indexOf(o)===0&&(v={type:"typescript",tsconfig:g.substring(o.length+6)}):We(s.type)&&(v=s),v===void 0){l.problemReporter.error(d(15875,null,JSON.stringify(s,void 0,0)));return}let b=nU.createTaskIdentifier(v,l.problemReporter);if(b===void 0){l.problemReporter.error(d(15871,null,JSON.stringify(s,void 0,0)));return}let S={workspaceFolder:l.workspaceFolder,file:".vscode/tasks.json",index:c,element:s},y;switch(u){case 2:{y={kind:Vl.User,config:S,label:EGe};break}case 1:{y={kind:Vl.WorkspaceFile,config:S,label:EGe};break}default:{y={kind:Vl.Workspace,config:S,label:EGe};break}}let w=new ev(`${f.extensionId}.${b._key}`,y,void 0,h,b,$pt.fromConfiguration(s.runOptions),{hide:s.hide,inAgents:s.inAgents}),x=aGi.from(s,l,!0,u,f.properties);if(w.addTaskLoadMessages(x.errors),x.value){if(w.configurationProperties=Object.assign(w.configurationProperties,x.value),w.configurationProperties.name)w._label=w.configurationProperties.name;else{let E=w.configures.type;if(f.required&&f.required.length>0)for(let M of f.required){let N=w.configures[M];if(N){E=E+": "+N;break}}w._label=E}w.configurationProperties.identifier||(w.configurationProperties.identifier=b._key)}return w}r.from=n})(mWo||={});var yIe;(o=>{function a(n,r,s,l){if(!n)return;let c=n.type;if(c==null&&(c=h8),c!==h8&&c!=="shell"&&c!=="process"){r.problemReporter.error(d(15880,null,JSON.stringify(n,null,4)));return}let u=n.taskName;if(We(n.label)&&r.schemaVersion===2&&(u=n.label),!u){r.problemReporter.error(d(15878,null,JSON.stringify(n,null,4)));return}let p;switch(l){case 2:{p={kind:Vl.User,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder},label:EGe};break}case 1:{p={kind:Vl.WorkspaceFile,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder,workspace:r.workspace},label:EGe};break}default:{p={kind:Vl.Workspace,config:{index:s,element:n,file:".vscode/tasks.json",workspaceFolder:r.workspaceFolder},label:EGe};break}}let h=new Zd(r.uuidMap.getUUID(u),p,u,h8,void 0,!1,$pt.fromConfiguration(n.runOptions),{name:u,identifier:u}),g=aGi.from(n,r,!1,l);if(h.addTaskLoadMessages(g.errors),g.value&&(h.configurationProperties=Object.assign(h.configurationProperties,g.value)),!0){let b=n;h.configurationProperties.isBackground===void 0&&b.isWatching!==void 0&&(h.configurationProperties.isBackground=!!b.isWatching),h.configurationProperties.group===void 0&&(b.isBuildCommand===!0?h.configurationProperties.group=Lh.Build:b.isTestCommand===!0&&(h.configurationProperties.group=Lh.Test))}let v=ZV.from(n,r);return v&&(h.command=v),n.command!==void 0&&(v.suppressTaskName=!0),h}o.from=a;function i(n,r){(ZV.hasCommand(n.command)||n.configurationProperties.dependsOn===void 0)&&(n.command=ZV.fillGlobals(n.command,r.command,n.configurationProperties.name)),n.configurationProperties.problemMatchers===void 0&&r.problemMatcher!==void 0&&(n.configurationProperties.problemMatchers=io(r.problemMatcher),n.hasDefinedMatchers=!0),n.configurationProperties.promptOnClose===void 0&&n.configurationProperties.isBackground===void 0&&r.promptOnClose!==void 0&&(n.configurationProperties.promptOnClose=r.promptOnClose)}o.fillGlobals=i;function e(n,r){ZV.fillDefaults(n.command,r),n.configurationProperties.promptOnClose===void 0&&(n.configurationProperties.promptOnClose=n.configurationProperties.isBackground!==void 0?!n.configurationProperties.isBackground:!0),n.configurationProperties.isBackground===void 0&&(n.configurationProperties.isBackground=!1),n.configurationProperties.problemMatchers===void 0&&(n.configurationProperties.problemMatchers=rGi)}o.fillDefaults=e;function t(n,r){let s=new Zd(r._id,Object.assign({},r._source,{customizes:n.defines}),r.configurationProperties.name||n._label,h8,n.command,!1,n.runOptions,{name:r.configurationProperties.name||n.configurationProperties.name,identifier:r.configurationProperties.identifier||n.configurationProperties.identifier,icon:r.configurationProperties.icon,hide:r.configurationProperties.hide,inAgents:r.configurationProperties.inAgents});s.addTaskLoadMessages(r.taskLoadMessages);let l=s.configurationProperties;UO(l,r.configurationProperties,"group"),UO(l,r.configurationProperties,"isBackground"),UO(l,r.configurationProperties,"dependsOn"),UO(l,r.configurationProperties,"problemMatchers"),UO(l,r.configurationProperties,"promptOnClose"),UO(l,r.configurationProperties,"detail"),s.command.presentation=ZV.PresentationOptions.assignProperties(s.command.presentation,r.configurationProperties.presentation),s.command.options=f7.assignProperties(s.command.options,r.configurationProperties.options),s.runOptions=$pt.assignProperties(s.runOptions,r.runOptions);let c=n.configurationProperties;return lj(l,c,"group"),lj(l,c,"isBackground"),lj(l,c,"dependsOn"),lj(l,c,"problemMatchers"),lj(l,c,"promptOnClose"),lj(l,c,"detail"),s.command.presentation=ZV.PresentationOptions.fillProperties(s.command.presentation,c.presentation),s.command.options=f7.fillProperties(s.command.options,c.options),s.runOptions=$pt.fillProperties(s.runOptions,n.runOptions),n.hasDefinedMatchers===!0&&(s.hasDefinedMatchers=!0),s}o.createCustomTask=t})(yIe||={});var kGe;(o=>{function a(n){let r=n.type;return n.customize===void 0&&(r==null||r===h8||r==="shell"||r==="process")}let i={shell:Qme,process:LLe};function e(n,r,s,l,c){let u={custom:[],configured:[]};if(!n)return u;let p={task:void 0,rank:-1},h={task:void 0,rank:-1},g=s.schemaVersion===2,f=io(s.taskLoadIssues);for(let S=0;S<n.length;S++){let y=n[S],w=y.type?c?.get?.(y.type)||xE.get(y.type):void 0,x=!1;if(w&&w.when&&!s.contextKeyService.contextMatchesRules(w.when))x=!0;else if(!w&&y.type){for(let E of Object.keys(i))if(y.type===E){x=!Qme.evaluate(s.contextKeyService.getContext(null));break}}if(x){s.problemReporter.info(d(15885,null,y.type));continue}if(a(y)){let E=yIe.from(y,s,S,l);if(E){if(yIe.fillGlobals(E,r),yIe.fillDefaults(E,s),g){if((E.command===void 0||E.command.name===void 0)&&(E.configurationProperties.dependsOn===void 0||E.configurationProperties.dependsOn.length===0)){s.problemReporter.error(d(15884,null,E.configurationProperties.name,JSON.stringify(y,void 0,4)));continue}}else if(E.command===void 0||E.command.name===void 0){s.problemReporter.warn(d(15883,null,E.configurationProperties.name,JSON.stringify(y,void 0,4)));continue}E.configurationProperties.group===Lh.Build&&p.rank<2?(p.task=E,p.rank=2):E.configurationProperties.group===Lh.Test&&h.rank<2?(h.task=E,h.rank=2):E.configurationProperties.name==="build"&&p.rank<1?(p.task=E,p.rank=1):E.configurationProperties.name==="test"&&h.rank<1&&(h.task=E,h.rank=1),E.addTaskLoadMessages(s.taskLoadIssues),u.custom.push(E)}}else{let E=mWo.from(y,s,S,l,c);E&&(E.addTaskLoadMessages(s.taskLoadIssues),u.configured.push(E))}s.taskLoadIssues=io(f)}let v=We(p.task?.configurationProperties.group)?p.task?.configurationProperties.group:p.task?.configurationProperties.group?._id,b=We(h.task?.configurationProperties.group)?h.task?.configurationProperties.group:h.task?.configurationProperties.group?._id;return v!==Lh.Build._id&&p.rank>-1&&p.rank<2&&p.task?p.task.configurationProperties.group=Lh.Build:b!==Lh.Test._id&&h.rank>-1&&h.rank<2&&h.task&&(h.task.configurationProperties.group=Lh.Test),u}o.from=e;function t(n,r){if(r===void 0||r.length===0)return n;if(n===void 0||n.length===0)return r;if(r){let s=Object.create(null);n.forEach(c=>{s[c.configurationProperties.name]=c}),r.forEach(c=>{s[c.configurationProperties.name]=c});let l=[];n.forEach(c=>{l.push(s[c.configurationProperties.name]),delete s[c.configurationProperties.name]}),Object.keys(s).forEach(c=>l.push(s[c])),n=l}return n}o.assignTasks=t})(kGe||={});var hWo;(r=>{function a(s,l){let c=i(s,l),u;s.windows&&l.platform===3?u=i(s.windows,l):s.osx&&l.platform===1?u=i(s.osx,l):s.linux&&l.platform===2&&(u=i(s.linux,l)),u&&(c=r.assignProperties(c,u));let p=ZV.from(s,l);return p&&(c.command=p),r.fillDefaults(c,l),r.freeze(c),c}r.from=a;function i(s,l){let c={};return s.suppressTaskName!==void 0&&(c.suppressTaskName=!!s.suppressTaskName),s.promptOnClose!==void 0&&(c.promptOnClose=!!s.promptOnClose),s.problemMatcher&&(c.problemMatcher=Qpt.from(s.problemMatcher,l).value),c}r.fromBase=i;function e(s){return!s||s.command===void 0&&s.promptOnClose===void 0&&s.suppressTaskName===void 0}r.isEmpty=e;function t(s,l){return e(l)?s:e(s)?l:(UO(s,l,"promptOnClose"),UO(s,l,"suppressTaskName"),s)}r.assignProperties=t;function o(s,l){s&&(ZV.fillDefaults(s.command,l),s.suppressTaskName===void 0&&(s.suppressTaskName=l.schemaVersion===2),s.promptOnClose===void 0&&(s.promptOnClose=!0))}r.fillDefaults=o;function n(s){Object.freeze(s),s.command&&ZV.freeze(s.command)}r.freeze=n})(hWo||={});var TGe;(i=>{function a(e){let t=e.runner||e._runner,o;if(t)switch(t){case"terminal":o=2;break;case"process":o=1;break}let n=Ypt.from(e);if(n===1)return o||1;if(n===2)return 2;throw new Error("Shouldn't happen.")}i.from=a})(TGe||={});var Ypt;(e=>{let a=2;function i(t){let o=t.version;if(!o)return a;switch(o){case"0.1.0":return 1;case"2.0.0":return 2;default:return a}}e.from=i})(Ypt||={});var oGi=class{constructor(i){if(this.current=Object.create(null),i)for(let e of Object.keys(i.current)){let t=i.current[e];Array.isArray(t)?this.current[e]=t.slice():this.current[e]=t}}start(){this.last=this.current,this.current=Object.create(null)}getUUID(i){let e=this.last?this.last[i]:void 0,t;e!==void 0&&(Array.isArray(e)?(t=e.shift(),e.length===0&&delete this.last[i]):(t=e,delete this.last[i])),t===void 0&&(t=ht());let o=this.current[i];if(o===void 0)this.current[i]=t;else if(Array.isArray(o))o.push(t);else{let n=[o];n.push(t),this.current[i]=n}return t}finish(){this.last=void 0}};var nGi=class{constructor(i,e,t,o,n){this.workspaceFolder=i,this.workspace=e,this.platform=t,this.problemReporter=o,this.uuidMap=n}run(i,e,t){let o=TGe.from(i),n=Ypt.from(i),r={workspaceFolder:this.workspaceFolder,workspace:this.workspace,problemReporter:this.problemReporter,uuidMap:this.uuidMap,namedProblemMatchers:{},engine:o,schemaVersion:n,platform:this.platform,taskLoadIssues:[],contextKeyService:t},s=this.createTaskRunnerConfiguration(i,r,e);return{validationStatus:this.problemReporter.status,custom:s.custom,configured:s.configured,engine:o}}createTaskRunnerConfiguration(i,e,t){let o=hWo.from(i,e);if(this.problemReporter.status.isFatal())return{custom:[],configured:[]};e.namedProblemMatchers=Qpt.namedFrom(i.declares,e);let n,r;if(i.windows&&e.platform===3?(n=kGe.from(i.windows.tasks,o,e,t).custom,r=i.windows.tasks):i.osx&&e.platform===1?(n=kGe.from(i.osx.tasks,o,e,t).custom,r=i.osx.tasks):i.linux&&e.platform===2&&(n=kGe.from(i.linux.tasks,o,e,t).custom,r=i.linux.tasks),e.schemaVersion===2&&n&&n.length>0&&r&&r.length>0){let l=[];for(let c of r)l.push(JSON.stringify(c,null,4));e.problemReporter.error(d(15886,null,l.join(`
`)))}let s={custom:[],configured:[]};if(i.tasks&&(s=kGe.from(i.tasks,o,e,t)),n&&(s.custom=kGe.assignTasks(s.custom,n)),(!s.custom||s.custom.length===0)&&o.command&&o.command.name){let l=Qpt.from(i.problemMatcher,e).value??[],c=i.isBackground?!!i.isBackground:i.isWatching?!!i.isWatching:void 0,u=f8.value(o.command.name),p=new Zd(e.uuidMap.getUUID(u),Object.assign({},t,"workspace",{config:{index:-1,element:i,workspaceFolder:e.workspaceFolder}}),u,h8,{name:void 0,runtime:void 0,presentation:void 0,suppressTaskName:!0},!1,{reevaluateOnRerun:!0},{name:u,identifier:u,group:Lh.Build,isBackground:c,problemMatchers:l}),h=wIe.from(i.group);h!==void 0?p.configurationProperties.group=h:i.group==="none"&&(p.configurationProperties.group=void 0),yIe.fillGlobals(p,o),yIe.fillDefaults(p,e),s.custom=[p]}return s.custom=s.custom||[],s.configured=s.configured||[],s}},cDn=new Map,dDn=new Map;function lGi(a,i,e,t,o,n,r,s=!1){let l=s?dDn:cDn,c=l.get(n);c||(l.set(n,new Map),c=l.get(n));let u=c.get(a.uri.toString());u||(u=new oGi,c.set(a.uri.toString(),u));try{return u.start(),new nGi(a,i,e,o,u).run(t,n,r)}finally{u.finish()}}function _Ge(a,i){return yIe.createCustomTask(a,i)}var Xpt;(i=>{function a(e,t){return Object.freeze({kind:e,capturedVariables:t})}i.create=a})(Xpt||={});var hYt=class extends k{constructor(e,t,o,n,r){super();this.problemMatchers=e;this.markerService=t;this.modelService=o;this.logService=r;this.modelListeners=new O;this._onDidFindFirstMatch=this._register(new T);this.onDidFindFirstMatch=this._onDidFindFirstMatch.event;this._onDidFindErrors=this._register(new T);this.onDidFindErrors=this._onDidFindErrors.event;this._onDidRequestInvalidateLastMarker=this._register(new T);this.onDidRequestInvalidateLastMarker=this._onDidRequestInvalidateLastMarker.event;this.matchers=Object.create(null),this.bufferLength=1,e.map(s=>H0o(s,n,r)).forEach(s=>{let l=s.matchLength;l>this.bufferLength&&(this.bufferLength=l);let c=this.matchers[l];c||(c=[],this.matchers[l]=c),c.push(s)}),this.buffer=[],this.activeMatcher=null,this._numberOfMatches=0,this._maxMarkerSeverity=void 0,this.openModels=Object.create(null),this.applyToByOwner=new Map;for(let s of e){let l=this.applyToByOwner.get(s.owner);l===void 0?this.applyToByOwner.set(s.owner,s.applyTo):this.applyToByOwner.set(s.owner,this.mergeApplyTo(l,s.applyTo))}this.resourcesToClean=new Map,this.markers=new Map,this.deliveredMarkers=new Map,this._register(this.modelService.onModelAdded(s=>{this.openModels[s.uri.toString()]=!0},this,this.modelListeners)),this._register(this.modelService.onModelRemoved(s=>{delete this.openModels[s.uri.toString()]},this,this.modelListeners)),this.modelService.getModels().forEach(s=>this.openModels[s.uri.toString()]=!0),this._onDidStateChange=this._register(new T)}get onDidStateChange(){return this._onDidStateChange.event}processLine(e){if(this.tail){let t=this.tail;this.tail=t.then(()=>this.processLineInternal(e))}else this.tail=this.processLineInternal(e)}dispose(){super.dispose(),this.modelListeners.dispose()}get numberOfMatches(){return this._numberOfMatches}get maxMarkerSeverity(){return this._maxMarkerSeverity}tryFindMarker(e){let t=null;if(this.activeMatcher){if(t=this.activeMatcher.next(e),t)return this.captureMatch(t),t;this.clearBuffer(),this.activeMatcher=null}if(this.buffer.length<this.bufferLength)this.buffer.push(e);else{let o=this.buffer.length-1;for(let n=0;n<o;n++)this.buffer[n]=this.buffer[n+1];this.buffer[o]=e}return t=this.tryMatchers(),t&&this.clearBuffer(),t}async shouldApplyMatch(e){switch(e.description.applyTo){case 0:return!0;case 1:return!!this.openModels[(await e.resource).toString()];case 2:return!this.openModels[(await e.resource).toString()];default:return!0}}mergeApplyTo(e,t){return e===t||e===0?e:0}tryMatchers(){this.activeMatcher=null;let e=this.buffer.length;for(let t=0;t<e;t++){let o=this.matchers[e-t];if(o)for(let n of o){let r=n.handle(this.buffer,t);if(r.match)return this.captureMatch(r.match),r.continue&&(this.activeMatcher=n),r.match}}return null}captureMatch(e){this._numberOfMatches++,(this._maxMarkerSeverity===void 0||e.marker.severity>this._maxMarkerSeverity)&&(this._maxMarkerSeverity=e.marker.severity)}clearBuffer(){this.buffer.length>0&&(this.buffer=[])}recordResourcesToClean(e){let t=this.getResourceSetToClean(e);this.markerService.read({owner:e}).forEach(o=>t.set(o.resource.toString(),o.resource))}recordResourceToClean(e,t){this.getResourceSetToClean(e).set(t.toString(),t)}removeResourceToClean(e,t){this.resourcesToClean.get(e)?.delete(t)}getResourceSetToClean(e){let t=this.resourcesToClean.get(e);return t||(t=new Map,this.resourcesToClean.set(e,t)),t}cleanAllMarkers(){this.resourcesToClean.forEach((e,t)=>{this._cleanMarkers(t,e)}),this.resourcesToClean=new Map}cleanMarkers(e){let t=this.resourcesToClean.get(e);t&&(this._cleanMarkers(e,t),this.resourcesToClean.delete(e))}_cleanMarkers(e,t){let o=[],n=this.applyToByOwner.get(e);t.forEach((r,s)=>{(n===0||n===1&&this.openModels[s]||n===2&&!this.openModels[s])&&o.push(r)}),this.markerService.remove(e,o)}recordMarker(e,t,o){let n=this.markers.get(t);n||(n=new Map,this.markers.set(t,n));let r=n.get(o);r||(r=new Map,n.set(o,r));let s=YB.makeKeyOptionalMessage(e,!1),l;r.has(s)?(l=r.get(s))!==void 0&&l.message.length<e.message.length&&ii&&r.set(s,e):r.set(s,e)}reportMarkers(){this.markers.forEach((e,t)=>{let o=this.getDeliveredMarkersPerOwner(t);e.forEach((n,r)=>{this.deliverMarkersPerOwnerAndResourceResolved(t,r,n,o)})})}deliverMarkersPerOwnerAndResource(e,t){let o=this.markers.get(e);if(!o)return;let n=this.getDeliveredMarkersPerOwner(e),r=o.get(t);r&&this.deliverMarkersPerOwnerAndResourceResolved(e,t,r,n)}deliverMarkersPerOwnerAndResourceResolved(e,t,o,n){if(o.size!==n.get(t)){let r=[];o.forEach(s=>r.push(s)),this.markerService.changeOne(e,A.parse(t),r),n.set(t,o.size)}}getDeliveredMarkersPerOwner(e){let t=this.deliveredMarkers.get(e);return t||(t=new Map,this.deliveredMarkers.set(e,t)),t}cleanMarkerCaches(){this._numberOfMatches=0,this._maxMarkerSeverity=void 0,this.markers.clear(),this.deliveredMarkers.clear()}done(){this.reportMarkers(),this.cleanAllMarkers()}};var DGe=class extends hYt{constructor(e,t,o,n=0,r,s){super(e,t,o,r,s);this._hasStarted=!1;let l=Object.create(null);e.forEach(c=>l[c.owner]=!0),this.owners=Object.keys(l),this.owners.forEach(c=>{this.recordResourcesToClean(c)})}async processLineInternal(e){this._hasStarted||(this._hasStarted=!0,this._onDidStateChange.fire(Xpt.create("backgroundProcessingBegins")));let t=this.tryFindMarker(e);if(!t)return;let o=t.description.owner,r=(await t.resource).toString();this.removeResourceToClean(o,r),await this.shouldApplyMatch(t)&&(this.recordMarker(t.marker,o,r),(this.currentOwner!==o||this.currentResource!==r)&&(this.currentOwner&&this.currentResource&&this.deliverMarkersPerOwnerAndResource(this.currentOwner,this.currentResource),this.currentOwner=o,this.currentResource=r))}},gYt=class extends hYt{constructor(e,t,o,n,r){super(e,t,o,n,r);this.lines=[];this.beginPatterns=[];this.resetCurrentResource(),this.backgroundPatterns=[],this._activeBackgroundMatchers=new Set,this.problemMatchers.forEach(s=>{if(s.watching){let l=ht();this.backgroundPatterns.push({key:l,matcher:s,begin:s.watching.beginsPattern,end:s.watching.endsPattern}),this.beginPatterns.push(s.watching.beginsPattern.regexp)}}),this.modelListeners.add(this.modelService.onModelRemoved(s=>{let l=U.debounce(this.markerService.onMarkerChanged,(c,u)=>(c??[]).concat(u),500,!1,!0)(async c=>{if(c.length===0)return;let u=s.uri.toString();if(!c.some(h=>h.toString()===u)||this.markerService.read({resource:s.uri}).length!==0)return;let p=Array.from(this.lines);for(let h of p)await this.processLineInternal(h)});setTimeout(()=>{if(l){let c=l;l=void 0,c.dispose()}},600)}))}aboutToStart(){for(let e of this.backgroundPatterns)e.matcher.watching&&e.matcher.watching.activeOnStart&&(this._activeBackgroundMatchers.add(e.key),this._onDidStateChange.fire(Xpt.create("backgroundProcessingBegins")),this.recordResourcesToClean(e.matcher.owner))}async processLineInternal(e){if(await this.tryBegin(e)||this.tryFinish(e))return;this.lines.push(e);let t=this.tryFindMarker(e);if(!t)return;let o=await t.resource,n=t.description.owner,r=o.toString();this.removeResourceToClean(n,r),await this.shouldApplyMatch(t)&&(this.recordMarker(t.marker,n,r),(this.currentOwner!==n||this.currentResource!==r)&&(this.reportMarkersForCurrentResource(),this.currentOwner=n,this.currentResource=r))}forceDelivery(){this.reportMarkersForCurrentResource()}async tryBegin(e){let t=!1;for(let o of this.backgroundPatterns){let n=Date.now(),r=o.begin.regexp.exec(e),s=Date.now()-n;if(s>5&&this.logService?.trace(`ProblemMatcher: slow begin regexp took ${s}ms to execute`,o.begin.regexp.source),r){if(this._activeBackgroundMatchers.has(o.key))continue;this._activeBackgroundMatchers.add(o.key),t=!0,this._onDidFindFirstMatch.fire(),this.lines=[],this.lines.push(e),this._onDidStateChange.fire(Xpt.create("backgroundProcessingBegins")),this.cleanMarkerCaches(),this.resetCurrentResource();let l=o.matcher.owner,c=r[o.begin.file];if(c){let u=SGe(c,o.matcher);this.recordResourceToClean(l,await u)}else this.recordResourcesToClean(l)}}return t}tryFinish(e){let t=!1;for(let o of this.backgroundPatterns){let n=Date.now(),r=o.end.regexp.exec(e),s=Date.now()-n;if(s>5&&this.logService?.trace(`ProblemMatcher: slow end regexp took ${s}ms to execute`,o.end.regexp.source),r&&(this._numberOfMatches>0?this._onDidFindErrors.fire(this.markerService.read({owner:o.matcher.owner})):this._onDidRequestInvalidateLastMarker.fire(),this._activeBackgroundMatchers.delete(o.key))){this.resetCurrentResource();let l=r.groups?new Map(Object.entries(r.groups)):void 0;this._onDidStateChange.fire(Xpt.create("backgroundProcessingEnds",l)),t=!0,this.lines.push(e);let c=o.matcher.owner;this.cleanMarkers(c),this.cleanMarkerCaches()}}return t}resetCurrentResource(){this.reportMarkersForCurrentResource(),this.currentOwner=void 0,this.currentResource=void 0}reportMarkersForCurrentResource(){this.currentOwner&&this.currentResource&&this.deliverMarkersPerOwnerAndResource(this.currentOwner,this.currentResource)}done(){[...this.applyToByOwner.keys()].forEach(e=>{this.recordResourcesToClean(e)}),super.done()}isWatching(){return this.backgroundPatterns.length>0}};var cj="task_terminal_status",pDn={id:cj,icon:PT,severity:wt.Info,tooltip:d(15656,null)},mDn={id:cj,icon:L.check,severity:wt.Info,tooltip:d(15661,null)},hDn={id:cj,icon:L.check,severity:wt.Info,tooltip:d(15662,null)},gDn={id:cj,icon:L.error,severity:wt.Error,tooltip:d(15657,null)},fDn={id:cj,icon:L.error,severity:wt.Error,tooltip:d(15658,null)},vDn={id:cj,icon:L.warning,severity:wt.Warning,tooltip:d(15663,null)},bDn={id:cj,icon:L.warning,severity:wt.Warning,tooltip:d(15664,null)},SDn={id:cj,icon:L.info,severity:wt.Info,tooltip:d(15659,null)},IDn={id:cj,icon:L.info,severity:wt.Info,tooltip:d(15660,null)},RGe=class extends k{constructor(e,t){super();this._accessibilitySignalService=t;this.terminalMap=this._register(new Ot);this._register(e.onDidStateChange(o=>{switch(o.kind){case"processStarted":case"active":this.eventActive(o);break;case"inactive":this.eventInactive(o);break;case"processEnded":this.eventEnd(o);break}}))}addTerminal(e,t,o){let n={id:cj,severity:wt.Info};t.statusList.add(n);let r=new O;r.add(o.onDidFindFirstMatch(()=>{this._marker=t.registerMarker(),this._marker&&r.add(this._marker)})),r.add(o.onDidFindErrors(()=>{this._marker&&t.addBufferMarker({marker:this._marker,hoverMessage:d(15655,null),disableCommandStorage:!0})})),r.add(o.onDidRequestInvalidateLastMarker(()=>{this._marker?.dispose(),this._marker=void 0})),r.add(t.onDisposed(()=>{this.terminalMap.deleteAndDispose(t.instanceId)})),this.terminalMap.set(t.instanceId,{terminal:t,task:e,status:n,problemMatcher:o,taskRunEnded:!1,dispose(){r.dispose()}})}terminalFromEvent(e){if(!(!Object.hasOwn(e,"terminalId")||!e.terminalId))return this.terminalMap.get(e.terminalId)}eventEnd(e){let t=this.terminalFromEvent(e);if(t)if(t.taskRunEnded=!0,t.terminal.statusList.remove(t.status),e.exitCode===0&&(!t.problemMatcher.maxMarkerSeverity||t.problemMatcher.maxMarkerSeverity<4))if(this._accessibilitySignalService.playSignal(tn.taskCompleted),t.task.configurationProperties.isBackground)for(let o of t.terminal.statusList.statuses)t.terminal.statusList.remove(o);else t.terminal.statusList.add(mDn);else e.exitCode||t.problemMatcher.maxMarkerSeverity!==void 0&&t.problemMatcher.maxMarkerSeverity===8?(this._accessibilitySignalService.playSignal(tn.taskFailed),t.terminal.statusList.add(gDn)):t.problemMatcher.maxMarkerSeverity===4?(this._accessibilitySignalService.playSignal(tn.taskFailed),t.terminal.statusList.add(vDn)):t.problemMatcher.maxMarkerSeverity===2&&t.terminal.statusList.add(SDn)}eventInactive(e){let t=this.terminalFromEvent(e);!t||!t.problemMatcher||t.taskRunEnded||(t.terminal.statusList.remove(t.status),t.problemMatcher.numberOfMatches===0?(this._accessibilitySignalService.playSignal(tn.taskCompleted),t.terminal.statusList.add(hDn)):t.problemMatcher.maxMarkerSeverity===8?(this._accessibilitySignalService.playSignal(tn.taskFailed),t.terminal.statusList.add(fDn)):t.problemMatcher.maxMarkerSeverity===4?t.terminal.statusList.add(bDn):t.problemMatcher.maxMarkerSeverity===2&&t.terminal.statusList.add(IDn))}eventActive(e){let t=this.terminalFromEvent(e);t&&(t.taskRunEnded=!1,t.terminal.statusList.remove(t.status),(t.problemMatcher instanceof DGe||t.problemMatcher?.problemMatchers.length>0||e.runType==="singleRun")&&t.terminal.statusList.add(pDn))}};RGe=I([m(0,yf),m(1,br)],RGe);function b7(a,i){return yDn(633,a,i)}function yDn(a,i,e){let t=`\x1B]${a};${i}`;return e&&(t+=`;${e}`),t+="\x07",t}var fYt=class extends k{constructor(){super();this.terminalMarkerMap=new Map;this.terminalDisposables=new Ot}addTerminal(e,t){this.terminalMarkerMap.set(e.instanceId,{resources:new Map,markers:new Map});let o=new O;this.terminalDisposables.set(e.instanceId,o),o.add(e.onDisposed(()=>{this.terminalMarkerMap.delete(e.instanceId),this.terminalDisposables.deleteAndDispose(e.instanceId)})),o.add(t.onDidFindErrors(n=>{let r=this.terminalMarkerMap.get(e.instanceId);if(r){r.markers.clear(),r.resources.clear();for(let s of n)if(s.severity===8){r.resources.set(s.resource.toString(),s.resource);let c=r.markers.get(s.owner);c||(c=new Map,r.markers.set(s.owner,c)),c.set(s.resource.toString(),s),this.terminalMarkerMap.set(e.instanceId,r)}}})),o.add(t.onDidRequestInvalidateLastMarker(()=>{let n=this.terminalMarkerMap.get(e.instanceId);n?.markers.clear(),n?.resources.clear(),this.terminalMarkerMap.set(e.instanceId,{resources:new Map,markers:new Map})}))}getTaskProblems(e){let t=this.terminalMarkerMap.get(e);if(t){if(t.markers.size===0)return new Map}else return;let o=new Map;for(let[n,r]of t.markers){let s=[],l=[];for(let[c,u]of r)s.push(t.resources.get(c)),l.push(u);o.set(n,{resources:s,markers:l})}return o}};var Jpt="Task",Zpt=class a{constructor(i,e,t,o){this.workspaceFolder=i;this.taskSystemInfo=e;this.values=t;this._service=o}static{this._regex=/\$\{(.*?)\}/g}async resolve(i){let e=[];i.replace(a._regex,(o,...n)=>(e.push(this._replacer(o,n)),o));let t=await Promise.all(e);return i.replace(a._regex,()=>t.shift())}async _replacer(i,e){let t=this.values.get(i.substring(2,i.length-1));return t??(this._service?this._service.resolveAsync(this.workspaceFolder,i):i)}},uae=class a extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M){super();this._terminalService=e;this._terminalGroupService=t;this._outputService=o;this._paneCompositeService=n;this._viewsService=r;this._markerService=s;this._modelService=l;this._configurationResolverService=c;this._contextService=u;this._environmentService=p;this._outputChannelId=h;this._fileService=g;this._terminalProfileResolverService=f;this._pathService=v;this._viewDescriptorService=b;this._logService=S;this._notificationService=y;this._taskLookup=M;this._isRerun=!1;this._terminalCreationQueue=Promise.resolve();this._hasReconnected=!1;this._terminalTabActions=[{id:b0t,label:d(15668,null),icon:v0t}];this._taskStartTimes=new Map;this._capturedTaskVariables=new Map;this._activeTasks=Object.create(null),this._busyTasks=Object.create(null),this._taskErrors=Object.create(null),this._taskDependencies=Object.create(null),this._terminals=Object.create(null),this._idleTaskTerminals=new uz,this._sameTaskTerminals=Object.create(null),this._onDidStateChange=this._register(new T),this._taskSystemInfoResolver=E,this._register(this._terminalStatusManager=x.createInstance(RGe)),this._register(this._taskProblemMonitor=x.createInstance(fYt)),this._taskTerminalActive=$Ze.bindTo(w),this._register(this._terminalService.onDidChangeActiveInstance(N=>this._taskTerminalActive.set(N?.shellLaunchConfig.type==="Task")))}static{this.TelemetryEventName="taskService"}static{this.ProcessVarName="__process__"}static{this._shellQuotes={cmd:{strong:'"'},powershell:{escape:{escapeChar:"`",charsToEscape:` "'()`},strong:"'",weak:'"'},bash:{escape:{escapeChar:"\\",charsToEscape:` "'`},strong:"'",weak:'"'},zsh:{escape:{escapeChar:"\\",charsToEscape:` "'`},strong:"'",weak:'"'}}}static{this._osShellQuotes={Linux:a._shellQuotes.bash,Mac:a._shellQuotes.bash,Windows:a._shellQuotes.powershell}}taskShellIntegrationStartSequence(e){return b7("P","HasRichCommandDetection=True")+b7("A")+b7("P","Task=True")+(e?b7("P",`Cwd=${typeof e=="string"?e:e.fsPath}`):"")+b7("B")}getTaskShellIntegrationOutputSequence(e){return(e?b7("E",`${oNo(e.commandLine)};${e.nonce}`):"")+b7("C")}get onDidStateChange(){return this._onDidStateChange.event}_log(e){this._appendOutput(e+`
`)}_showOutput(){this._outputService.showChannel(this._outputChannelId,!0)}reconnect(e,t){return this._reconnectToTerminals(),this.run(e,t,SIe.reconnect)}run(e,t,o=SIe.command){e=e.clone();let n=h_.is(e)||this._isTaskEmpty(e)?[]:this._getInstances(e),r=n.length<((e.runOptions&&e.runOptions.instanceLimit)??1),s=n[0]?.count?.count??0;if(this._currentTask=new xGe(e,t,o),s>0&&(e.instance=s),!r){let l=n[n.length-1];return this._lastTask=this._currentTask,{kind:2,task:l.task,active:{same:!0,background:e.configurationProperties.isBackground},promise:l.promise}}try{let l={kind:1,task:e,started:{},promise:this._executeTask(e,t,o,new Set,new Map,void 0)};return l.promise.then(c=>{this._lastTask=this._currentTask}),l}catch(l){throw l instanceof mL?l:l instanceof Error?(this._log(l.message),new mL(wt.Error,l.message,7)):(this._log(l.toString()),new mL(wt.Error,d(15677,null),7))}}getTerminalsForTasks(e){let t=[];for(let o of Ec(e))for(let n of Object.keys(this._terminals)){let r=this._terminals[n];r.lastTask===o.getMapKey()&&t.push(r.terminal.resource)}return t.length>0?t:void 0}getTaskProblems(e){return this._taskProblemMonitor.getTaskProblems(e)}rerun(){if(this._lastTask&&this._lastTask.verify()){this._lastTask.task.runOptions.reevaluateOnRerun!==void 0&&!this._lastTask.task.runOptions.reevaluateOnRerun&&(this._isRerun=!0);let e=this.run(this._lastTask.task,this._lastTask.resolver);return e.promise.then(t=>{this._isRerun=!1}),e}else return}get lastTask(){return this._lastTask}set lastTask(e){this._lastTask=e}_showTaskLoadErrors(e){e.taskLoadMessages&&e.taskLoadMessages.length>0&&(e.taskLoadMessages.forEach(o=>{this._log(o+`
`)}),this._notificationService.prompt(wt.Warning,d(15676,null,e._label),[{label:"Show Output",run:()=>this._showOutput()}]))}isTaskVisible(e){let t=this._activeTasks[e.getMapKey()];if(!t?.terminal)return!1;let o=this._terminalService.activeInstance;return!!this._viewsService.getActiveViewWithId(Fc)&&o?.instanceId===t.terminal.instanceId}revealTask(e){let t=this._activeTasks[e.getMapKey()];if(!t?.terminal)return!1;let o=this._viewDescriptorService.getViewLocationById(Fc)===1;return o&&this.isTaskVisible(e)?(this._previousPanelId?(this._previousTerminalInstance&&this._terminalService.setActiveInstance(this._previousTerminalInstance),this._paneCompositeService.openPaneComposite(this._previousPanelId,1)):this._paneCompositeService.hideActivePaneComposite(1),this._previousPanelId=void 0,this._previousTerminalInstance=void 0):(o&&(this._previousPanelId=this._paneCompositeService.getActivePaneComposite(1)?.getId(),this._previousPanelId===Fc&&(this._previousTerminalInstance=this._terminalService.activeInstance??void 0)),this._terminalService.setActiveInstance(t.terminal),(Zd.is(e)||sg.is(e))&&this._terminalGroupService.showPanel(e.command.presentation.focus)),!0}isActive(){return Promise.resolve(this.isActiveSync())}isActiveSync(){return Object.values(this._activeTasks).some(e=>!!e.terminal)}canAutoTerminate(){return Object.values(this._activeTasks).every(e=>!e.task.configurationProperties.promptOnClose)}getActiveTasks(){return Object.values(this._activeTasks).flatMap(e=>e.terminal?e.task:[])}getLastInstance(e){let t=e.getKey();return Object.values(this._activeTasks).reverse().find(o=>t&&t===o.task.getKey())?.task}getFirstInstance(e){let t=e.getKey();for(let o of this.getActiveTasks())if(t&&t===o.getKey())return o}getBusyTasks(){return Object.keys(this._busyTasks).map(e=>this._busyTasks[e])}customExecutionComplete(e,t){return this._activeTasks[e.getMapKey()]?.terminal?new Promise(n=>{n()}):Promise.reject(new Error("Expected to have a terminal for a custom execution task"))}_getInstances(e){let t=e.getKey();return Object.values(this._activeTasks).filter(o=>t&&t===o.task.getKey())}_removeFromActiveTasks(e){let t=typeof e=="string"?e:e.getMapKey();this._activeTasks[t]&&delete this._activeTasks[t]}_fireTaskEvent(e){if(e.kind!=="changed"&&e.kind!=="problemMatcherEnded"&&e.kind!=="problemMatcherStarted"){let t=this._activeTasks[e.__task.getMapKey()];t&&(t.state=e.kind)}this._onDidStateChange.fire(e)}terminate(e){let t=this._activeTasks[e.getMapKey()];if(!t)return Promise.resolve({success:!1,task:void 0});let o=t.terminal;return o?new Promise((n,r)=>{let s=o.onDisposed(c=>{this._fireTaskEvent(Mp.terminated(e,c.instanceId,c.exitReason)),s.dispose()}),l=o.onExit(()=>{let c=t.task;try{l.dispose(),this._fireTaskEvent(Mp.terminated(c,o.instanceId,o.exitReason))}catch{}n({success:!0,task:c})});o.dispose()}):Promise.resolve({success:!1,task:void 0})}terminateAll(){let e=[];for(let[t,o]of Object.entries(this._activeTasks)){let n=o?.terminal;n&&(e.push(new Promise((r,s)=>{let l=n.onExit(()=>{let c=o.task;try{l.dispose(),this._fireTaskEvent(Mp.terminated(c,n.instanceId,n.exitReason))}catch{}this._activeTasks[t]===o&&delete this._activeTasks[t],r({success:!0,task:o.task})})})),n.dispose())}return Promise.all(e)}_showDependencyCycleMessage(e){this._log(d(15666,null,e._label)),this._showOutput()}_executeTask(e,t,o,n,r,s){this._showTaskLoadErrors(e);let l=e.getMapKey(),c=Promise.resolve().then(async()=>{s=s??new Map;let g=[];if(e.configurationProperties.dependsOn){let f=new Set(n).add(e.getCommonTaskId());for(let v of e.configurationProperties.dependsOn){let b=await t.resolve(v.uri,v.task);if(b){this._adoptConfigurationForDependencyTask(b,e);let S=e.getMapKey(),y=b.getMapKey();this._taskDependencies[S]||(this._taskDependencies[S]=[]),this._taskDependencies[S].includes(y)||this._taskDependencies[S].push(y);let w,x=b.getCommonTaskId();if(f.has(x))this._showDependencyCycleMessage(b),w=Promise.resolve({});else if(w=r.get(x),!w){let E=this._activeTasks[b.getMapKey()]??this._getInstances(b).pop();w=E&&this._getDependencyPromise(E)}if(w||(this._fireTaskEvent(Mp.general("dependsOnStarted",e)),w=this._executeDependencyTask(b,t,o,f,r,s)),r.set(x,w),g.push(w),e.configurationProperties.dependsOrder==="sequence"&&(await w).exitCode!==0)break}else this._log(d(15667,null,We(v.task)?v.task:JSON.stringify(v.task,void 0,0),v.uri.toString())),this._showOutput()}}return Promise.all(g).then(f=>{for(let v of f)if(v.exitCode!==0)return{exitCode:v.exitCode};return(sg.is(e)||Zd.is(e))&&e.command?this._isRerun?this._reexecuteCommand(e,o,s):this._executeCommand(e,o,s):{exitCode:0}})}).finally(()=>{delete this._activeTasks[l]}),p=this._getInstances(e).pop()?.count??{count:0};p.count++;let h={task:e,promise:c,count:p};return this._activeTasks[l]=h,c}_createInactiveDependencyPromise(e){return new Promise(t=>{let o=this.onDidStateChange(n=>{n.kind==="inactive"&&n.__task===e&&(o.dispose(),t({exitCode:0}))})})}_taskHasErrors(e){let t=e.getMapKey();if(this._taskErrors[t])return!0;let o=this._taskDependencies[t];if(o){for(let n of o)if(this._taskErrors[n])return!0}return!1}_cleanupTaskTracking(e){let t=e.getMapKey();delete this._taskErrors[t],delete this._taskDependencies[t]}_adoptConfigurationForDependencyTask(e,t){e.configurationProperties.icon?(e.configurationProperties.icon.id||=t.configurationProperties.icon?.id,e.configurationProperties.icon.color||=t.configurationProperties.icon?.color):e.configurationProperties.icon=t.configurationProperties.icon}async _getDependencyPromise(e){return!e.task.configurationProperties.isBackground||!e.task.configurationProperties.problemMatchers||e.task.configurationProperties.problemMatchers.length===0?e.promise:e.state==="inactive"?{exitCode:0}:this._createInactiveDependencyPromise(e.task)}async _executeDependencyTask(e,t,o,n,r,s){if(!e.configurationProperties.isBackground)return this._executeTask(e,t,o,n,r,s);let l=this._createInactiveDependencyPromise(e);return Promise.race([l,this._executeTask(e,t,o,n,r,s)])}async _resolveAndFindExecutable(e,t,o,n,r){let s=await this._configurationResolverService.resolveAsync(t,f8.value(o.command.name));n=n?await this._configurationResolverService.resolveAsync(t,n):void 0;let l=(await this._pathService.path).delimiter,c=r?await Promise.all(r.split(l).map(p=>this._configurationResolverService.resolveAsync(t,p))):void 0,u=await e?.findExecutable(s,n,c);return u||(Jl(s)?s:td(n??"",s))}_findUnresolvedVariables(e,t){if(t.size===0)return e;let o=new Set;for(let n of e)t.has(n.substring(2,n.length-1))||o.add(n);return o}_mergeMaps(e,t){for(let o of t)e.has(o[0])||e.set(o[0],o[1])}async _acquireInput(e,t,o,n,r){let s=await this._resolveVariablesFromSet(e,t,o,n,r);return this._fireTaskEvent(Mp.general("acquiredInput",o)),s}_resolveVariablesFromSet(e,t,o,n,r){let s=o.command&&o.command.runtime===2,l=o.command&&o.command.options?o.command.options:void 0,c=l?l.cwd:void 0,u;if(l&&l.env){for(let g of Object.keys(l.env))if(g.toLowerCase()==="path"){We(l.env[g])&&(u=l.env[g]);break}}let p=this._findUnresolvedVariables(n,r),h;if(e&&t){let g={variables:p};return e.platform===3&&s&&(g.process={name:f8.value(o.command.name)},c&&(g.process.cwd=c),u&&(g.process.path=u)),h=e.resolveVariables(t,g,Vl.toConfigurationTarget(o._source.kind)).then(async f=>{if(f){if(this._mergeMaps(r,f.variables),f.variables=new Map(r),s){let v=f8.value(o.command.name);e.platform===3&&(v=await this._resolveAndFindExecutable(e,t,o,c,u)),f.variables.set(a.ProcessVarName,v)}return f}}),h}else{let g=new Array;return p.forEach(f=>g.push(f)),new Promise((f,v)=>{this._configurationResolverService.resolveWithInteraction(t,g,"tasks",void 0,Vl.toConfigurationTarget(o._source.kind)).then(async b=>{if(b){if(this._mergeMaps(r,b),b=new Map(r),s){let y;ii?y=await this._resolveAndFindExecutable(e,t,o,c,u):y=await this._configurationResolverService.resolveAsync(t,f8.value(o.command.name)),b.set(a.ProcessVarName,y)}f({variables:b})}else f(void 0)},b=>{v(b)})})}}_executeCommand(e,t,o){let n=e.getWorkspaceFolder(),r;if(n)r=this._currentTask.workspaceFolder=n;else{let u=this._contextService.getWorkspace().folders;r=u.length>0?u[0]:void 0}let s=this._currentTask.systemInfo=this._taskSystemInfoResolver(r),l=new Set;return this._collectTaskVariables(l,e),this._acquireInput(s,r,e,l,o).then(u=>u&&!this._isTaskEmpty(e)?(this._currentTask.resolvedVariables=u,this._executeInTerminal(e,t,new Zpt(r,s,u.variables,this._configurationResolverService),r)):(this._fireTaskEvent(Mp.general("end",e)),Promise.resolve({exitCode:0})),u=>Promise.reject(u))}_isTaskEmpty(e){let t=e.command.runtime===3;return!(e.command!==void 0&&e.command.runtime&&(t||e.command.name!==void 0))}_reexecuteCommand(e,t,o){let n=this._lastTask;if(!n)return Promise.reject(new Error("No task previously run"));let r=this._currentTask.workspaceFolder=n.workspaceFolder,s=new Set;this._collectTaskVariables(s,e);let l=!0;return s.forEach(c=>{Object.hasOwn(n.getVerifiedTask().resolvedVariables,c.substring(2,c.length-1))&&(l=!1)}),l?(this._currentTask.resolvedVariables=n.getVerifiedTask().resolvedVariables,this._executeInTerminal(e,t,new Zpt(n.getVerifiedTask().workspaceFolder,n.getVerifiedTask().systemInfo,n.getVerifiedTask().resolvedVariables.variables,this._configurationResolverService),r)):this._acquireInput(n.getVerifiedTask().systemInfo,n.getVerifiedTask().workspaceFolder,e,s,o).then(c=>c?(this._currentTask.resolvedVariables=c,this._executeInTerminal(e,t,new Zpt(n.getVerifiedTask().workspaceFolder,n.getVerifiedTask().systemInfo,c.variables,this._configurationResolverService),r)):(this._fireTaskEvent(Mp.general("end",e)),{exitCode:0}),c=>Promise.reject(c))}async _executeInTerminal(e,t,o,n){let r,s,l;if(e.configurationProperties.isBackground){let u=await this._resolveMatchers(o,e.configurationProperties.problemMatchers),p=new gYt(u,this._markerService,this._modelService,this._fileService,this._logService);u.length>0&&!p.isWatching()&&(this._appendOutput(d(15675,null,e._label)),this._showOutput());let h=new O,g=0,f=e.getMapKey();h.add(p.onDidStateChange(y=>{if(y.kind==="backgroundProcessingBegins")g++,this._busyTasks[f]=e,this._fireTaskEvent(Mp.general("active",e,r?.instanceId));else if(y.kind==="backgroundProcessingEnds"&&(g--,this._busyTasks[f]&&delete this._busyTasks[f],y.capturedVariables&&this._registerCapturedVariables(y.capturedVariables),this._fireTaskEvent(Mp.inactive(e,r?.instanceId,this._takeTaskDuration(r?.instanceId))),g===0))if(p.numberOfMatches>0&&p.maxMarkerSeverity&&p.maxMarkerSeverity>=8){this._taskErrors[e.getMapKey()]=!0,this._fireTaskEvent(Mp.general("problemMatcherFoundErrors",e,r?.instanceId));let w=e.command.presentation.reveal;e.command.presentation.revealProblems===2?this._viewsService.openView(Ur.MARKERS_VIEW_ID,!0):w===2&&(this._terminalService.setActiveInstance(r),this._terminalGroupService.showPanel(!1))}else this._fireTaskEvent(Mp.problemMatcherEnded(e,this._taskHasErrors(e),r?.instanceId))})),p.aboutToStart();let v;if([r,s]=await this._createTerminal(e,o,n),s)return Promise.reject(new Error(s.message));if(!r)return Promise.reject(new Error(`Failed to create terminal for task ${e._label}`));this._terminalStatusManager.addTerminal(e,r,p),this._taskProblemMonitor.addTerminal(r,p);let b=!1;r.processReady.then(()=>{b||(this._fireTaskEvent(Mp.processStarted(e,r.instanceId,r.processId)),b=!0)},y=>{this._logService.error("Task terminal process never got ready")}),this._taskStartTimes.set(r.instanceId,Date.now()),this._fireTaskEvent(Mp.start(e,r.instanceId,o.values));let S;if(u.length&&(S=r.onLineData(y=>{p.processLine(y),v||(v=new rn(3e3)),v.trigger(()=>{p.forceDelivery(),v=void 0})})),l=new Promise((y,w)=>{let x=r.onExit(E=>{let M=typeof E=="number"?E:E?.code;S?.dispose(),x.dispose();let N=e.getMapKey();if(this._busyTasks[f]&&delete this._busyTasks[f],this._removeFromActiveTasks(e),this._fireTaskEvent(Mp.changed()),E!==void 0)switch(e.command.presentation.panel){case 2:this._sameTaskTerminals[N]=r.instanceId.toString();break;case 1:this._idleTaskTerminals.set(N,r.instanceId.toString(),1);break}if(e.command.presentation.reveal===2&&(M!==0||p.numberOfMatches>0&&p.maxMarkerSeverity&&p.maxMarkerSeverity>=8))try{this._terminalService.setActiveInstance(r),this._terminalGroupService.showPanel(!1)}catch{}p.done(),p.dispose(),b||(this._fireTaskEvent(Mp.processStarted(e,r.instanceId,r.processId)),b=!0);let H=this._takeTaskDuration(r.instanceId);this._fireTaskEvent(Mp.processEnded(e,r.instanceId,M,H));for(let K=0;K<g;K++)this._fireTaskEvent(Mp.inactive(e,r.instanceId));g=0,this._fireTaskEvent(Mp.general("end",e)),h.dispose(),y({exitCode:M??void 0})})}),t===SIe.reconnect&&r.xterm){let y=[],w=r.xterm.getBufferReverseIterator(),x=new RegExp(p.beginPatterns.map(M=>M.source).join("|"));for(let M of w)if(y.push(M),x.test(M))break;let E;for(let M=y.length-1;M>=0;M--)p.processLine(y[M]),E||(E=new rn(3e3)),E.trigger(()=>{p.forceDelivery(),E=void 0})}}else{if([r,s]=await this._createTerminal(e,o,n),s)return Promise.reject(new Error(s.message));if(!r)return Promise.reject(new Error(`Failed to create terminal for task ${e._label}`));this._taskStartTimes.set(r.instanceId,Date.now()),this._fireTaskEvent(Mp.start(e,r.instanceId,o.values));let u=e.getMapKey();this._busyTasks[u]=e,this._fireTaskEvent(Mp.general("active",e,r.instanceId));let p=await this._resolveMatchers(o,e.configurationProperties.problemMatchers),h=new DGe(p,this._markerService,this._modelService,0,this._fileService,this._logService);this._terminalStatusManager.addTerminal(e,r,h),this._taskProblemMonitor.addTerminal(r,h);let g=h.onDidStateChange(b=>{b.kind==="backgroundProcessingBegins"?this._fireTaskEvent(Mp.general("problemMatcherStarted",e,r?.instanceId)):b.kind==="backgroundProcessingEnds"&&(h.numberOfMatches&&h.maxMarkerSeverity&&h.maxMarkerSeverity>=8?(this._taskErrors[e.getMapKey()]=!0,this._fireTaskEvent(Mp.general("problemMatcherFoundErrors",e,r?.instanceId))):this._fireTaskEvent(Mp.problemMatcherEnded(e,this._taskHasErrors(e),r?.instanceId)))}),f=!1;r.processReady.then(()=>{f||(this._fireTaskEvent(Mp.processStarted(e,r.instanceId,r.processId)),f=!0)},b=>{});let v=r.onLineData(b=>{h.processLine(b)});l=new Promise((b,S)=>{let y=r.onExit(w=>{let x=typeof w=="number"?w:w?.code;y.dispose();let E=e.getMapKey();if(this._removeFromActiveTasks(e),this._fireTaskEvent(Mp.changed()),w!==void 0)switch(e.command.presentation.panel){case 2:this._sameTaskTerminals[E]=r.instanceId.toString();break;case 1:this._idleTaskTerminals.set(E,r.instanceId.toString(),1);break}let M=e.command.presentation.reveal,N=e.command.presentation.revealProblems;if(r&&N===2&&h.numberOfMatches>0)this._viewsService.openView(Ur.MARKERS_VIEW_ID);else if(r&&M===2&&(x!==0||h.numberOfMatches>0&&h.maxMarkerSeverity&&h.maxMarkerSeverity>=8))try{this._terminalService.setActiveInstance(r),this._terminalGroupService.showPanel(!1)}catch{}setTimeout(()=>{v.dispose(),h.done(),h.dispose(),g.dispose()},100),!f&&r&&(this._fireTaskEvent(Mp.processStarted(e,r.instanceId,r.processId)),f=!0);let H=this._takeTaskDuration(r?.instanceId);this._fireTaskEvent(Mp.processEnded(e,r?.instanceId,x??void 0,H)),this._busyTasks[u]&&delete this._busyTasks[u],this._fireTaskEvent(Mp.inactive(e,r?.instanceId,H)),h.numberOfMatches&&h.maxMarkerSeverity&&h.maxMarkerSeverity>=8?(this._taskErrors[e.getMapKey()]=!0,this._fireTaskEvent(Mp.general("problemMatcherFoundErrors",e,r?.instanceId))):this._fireTaskEvent(Mp.problemMatcherEnded(e,this._taskHasErrors(e),r?.instanceId)),this._fireTaskEvent(Mp.general("end",e,r?.instanceId)),this._cleanupTaskTracking(e),b({exitCode:x??void 0})})})}return e.command.presentation&&e.command.presentation.revealProblems===3?this._viewsService.openView(Ur.MARKERS_VIEW_ID):e.command.presentation&&(e.command.presentation.focus||e.command.presentation.reveal===1)&&(this._terminalService.setActiveInstance(r),await this._terminalService.revealTerminal(r),e.command.presentation.focus&&r&&await this._terminalService.focusInstance(r)),this._activeTasks[e.getMapKey()]?this._activeTasks[e.getMapKey()].terminal=r:this._logService.warn("No active tasks found for the terminal."),this._fireTaskEvent(Mp.changed()),l}_takeTaskDuration(e){if(e===void 0)return;let t=this._taskStartTimes.get(e);if(t!==void 0)return this._taskStartTimes.delete(e),Date.now()-t}_registerCapturedVariables(e){for(let[t,o]of e)this._capturedTaskVariables.set(t,o),this._configurationResolverService.resolvableVariables.has(`taskVar:${t}`)||this._configurationResolverService.contributeVariable(`taskVar:${t}`,async()=>this._capturedTaskVariables.get(t))}_createTerminalName(e){return this._contextService.getWorkbenchState()===3?e.getQualifiedLabel():e.configurationProperties.name||""}async _createShellLaunchConfig(e,t,o,n,r,s,l,c,u){let p,h=e.command.runtime===1,g=this._contextService.getWorkbenchState()===3,f=this._createTerminalName(e),v=Jpt,b=e.command.name,S;if(r.cwd&&(S=r.cwd,Jl(S)||t&&t.uri.scheme===Q.file&&(S=td(t.uri.fsPath,S)),S=Xj(S)?S:Nf(A.from({scheme:Q.file,path:S}),this._environmentService.remoteAuthority,this._pathService.defaultUriScheme)),h){let y;switch(n){case 3:y=1;break;case 1:y=2;break;case 2:default:y=3;break}let w=await this._terminalProfileResolverService.getDefaultProfile({allowAutomationShell:!0,os:y,remoteAuthority:this._environmentService.remoteAuthority}),x;if(e.configurationProperties.icon?.id)x=q.fromId(e.configurationProperties.icon.id);else{let ae=e.configurationProperties.group?wIe.to(e.configurationProperties.group):void 0;x=(typeof ae=="string"?ae:ae?.kind)==="test"?q.fromId(L.beaker.id):w.icon}p={name:f,type:v,executable:w.path,args:w.args,env:{...w.env},icon:x,color:e.configurationProperties.icon?.color||void 0,waitOnExit:c};let E=!1,M=e.command.options&&e.command.options.shell;M&&(M.executable&&(M.executable!==p.executable&&(p.args=void 0),p.executable=await this._resolveVariable(o,M.executable),E=!0),M.args&&(p.args=await this._resolveVariables(o,M.args.slice()))),p.args===void 0&&(p.args=[]);let N=Array.isArray(p.args)?p.args.slice(0):[p.args],V=[],H=Vo.basename((await this._pathService.fileURI(p.executable)).path).toLowerCase(),K=this._buildShellCommandLine(n,H,M,s,b,l),j=!1;if(n===3){j=!0;let ae=await this._pathService.userHome();if(H==="cmd.exe"&&(r.cwd&&Xj(r.cwd)||!r.cwd&&Xj(ae.fsPath)))return;H==="powershell.exe"||H==="pwsh.exe"?E||V.push("-Command"):H==="bash.exe"||H==="zsh.exe"?(j=!1,E||V.push("-c")):H==="wsl.exe"?E||V.push("-e"):H==="nu.exe"?E||V.push("-c"):E||V.push("/d","/c")}else E||(1,V.push("-c"));let J=this._addAllArgument(V,N);J.push(K),p.shellIntegrationNonce=ht();let se={commandLine:K,nonce:p.shellIntegrationNonce};if(p.args=j?J.join(" "):J,e.command.presentation&&e.command.presentation.echo)if(g&&t){let ae=S&&typeof S=="object"&&Object.hasOwn(S,"path")?Jo(S.path):t.name;p.initialText=this.taskShellIntegrationStartSequence(S)+QE(d(15673,null,ae,K),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(se)}else p.initialText=this.taskShellIntegrationStartSequence(S)+QE(d(15672,null,K),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(se);else p.initialText={text:this.taskShellIntegrationStartSequence(S)+this.getTaskShellIntegrationOutputSequence(se),trailingNewLine:!1}}else{let y=e.command.runtime!==3?f8.value(s):void 0,w=h?y:await this._resolveVariable(o,await this._resolveVariable(o,"${"+a.ProcessVarName+"}"));if(p={name:f,type:v,icon:e.configurationProperties.icon?.id?q.fromId(e.configurationProperties.icon.id):void 0,color:e.configurationProperties.icon?.color||void 0,executable:w,args:l.map(x=>We(x)?x:x.value),waitOnExit:c},e.command.presentation&&e.command.presentation.echo){let x=E=>!E||E.length===0?"":We(E)?E:E.join(" ");g&&t?p.initialText=this.taskShellIntegrationStartSequence(S)+QE(d(15673,null,t.name,`${p.executable} ${x(p.args)}`),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(void 0):p.initialText=this.taskShellIntegrationStartSequence(S)+QE(d(15671,null,`${p.executable} ${x(p.args)}`),{excludeLeadingNewLine:!0})+this.getTaskShellIntegrationOutputSequence(void 0)}else p.initialText={text:this.taskShellIntegrationStartSequence(S)+this.getTaskShellIntegrationOutputSequence(void 0),trailingNewLine:!1}}return S&&(p.cwd=S),r.env&&(p.env?p.env={...p.env,...r.env}:p.env=r.env),p.isFeatureTerminal=!0,p.useShellEnvironment=!0,p.tabActions=this._terminalTabActions,p}_addAllArgument(e,t){let o=io(t);return e.forEach(n=>{t.every((s,l)=>s.toLowerCase()===n&&t.length>l+1?!t.slice(l+1).every(c=>c.startsWith("-")):s.toLowerCase()!==n)&&o.push(n)}),o}async _reconnectToTerminal(e){return this._terminalService.instances.filter(o=>o.reconnectionProperties?.ownerId===Jpt).find(o=>vWo(o)?.lastTask===e.getCommonTaskId())}async _doCreateTerminal(e,t,o){let n=await this._reconnectToTerminal(e),r=l=>{let c=l.onDisposed(()=>{this._fireTaskEvent(Mp.terminated(e,l.instanceId,l.exitReason)),c.dispose()})};if(n)return(Zd.is(e)||sg.is(e))&&e.command.presentation&&(n.waitOnExit=gWo(e.command.presentation,e.configurationProperties)),r(n),this._logService.trace("reconnected to task and terminal",e._id),n;if(t){for(let l of Object.values(this._terminals))if(l.group===t){this._logService.trace(`Found terminal to split for group ${t}`);let c=l.terminal,u=await this._terminalService.createTerminal({location:{parentTerminal:c},config:o});if(r(u),u)return u}this._logService.trace(`No terminal found to split for group ${t}`)}let s=await this._terminalService.createTerminal({config:o});return r(s),s}_reconnectToTerminals(){if(this._hasReconnected){this._logService.trace("Already reconnected to terminals, so returning");return}let e=this._terminalService.instances.filter(t=>t.reconnectionProperties?.ownerId===Jpt);if(this._logService.trace(`Attempting reconnection of ${e.length} terminals`),!e.length)this._logService.trace("No terminals to reconnect to so returning");else for(let t of e){let o=vWo(t);if(o){let n={lastTask:o.lastTask,group:o.group,terminal:t,shellIntegrationNonce:o.shellIntegrationNonce};this._terminals[t.instanceId]=n;let r=t.onDisposed(()=>{this._deleteTaskAndTerminal(t,n),r.dispose()});this._logService.trace("Reconnecting to task terminal",n.lastTask,t.instanceId)}}this._hasReconnected=!0}_deleteTaskAndTerminal(e,t){delete this._terminals[e.instanceId],delete this._sameTaskTerminals[t.lastTask],this._idleTaskTerminals.delete(t.lastTask);let o=t.lastTask;this._removeFromActiveTasks(o),this._busyTasks[o]&&delete this._busyTasks[o]}async _createTerminal(e,t,o){let n=t.taskSystemInfo?t.taskSystemInfo.platform:xm,r=await this._resolveOptions(t,e.command.options),s=e.command.presentation;if(!s)throw new Error("Task presentation options should not be undefined here.");let l=gWo(s,e.configurationProperties),c,u,p;if(e.command.runtime===3)this._currentTask.shellLaunchConfig=p={customPtyImplementation:(E,M,N)=>new Fee(E,M,N,this._terminalService),waitOnExit:l,name:this._createTerminalName(e),initialText:e.command.presentation&&e.command.presentation.echo?QE(d(15670,null,e._label),{excludeLeadingNewLine:!0}):void 0,isFeatureTerminal:!0,icon:e.configurationProperties.icon?.id?q.fromId(e.configurationProperties.icon.id):void 0,color:e.configurationProperties.icon?.color||void 0};else{let E=await this._resolveCommandAndArgs(t,e.command);if(c=E.command,u=E.args,this._currentTask.shellLaunchConfig=p=await this._createShellLaunchConfig(e,o,t,n,r,c,u,l,s),p===void 0)return[void 0,new mL(wt.Error,d(15674,null),7)]}let h=s.panel===2,g=s.panel===1,f=s.group,v=e.getMapKey(),b;if(h){let E=this._sameTaskTerminals[v];E&&(b=this._terminals[E],delete this._sameTaskTerminals[v])}else if(g){let E=this._idleTaskTerminals.remove(v);if(!E)for(let M of this._idleTaskTerminals.keys()){let N=this._idleTaskTerminals.get(M);if(N&&this._terminals[N]&&this._terminals[N].group===f){E=this._idleTaskTerminals.remove(M);break}}E&&(b=this._terminals[E])}if(b){if(!p)throw new Error("Task shell launch configuration should not be undefined here.");return b.terminal.scrollToBottom(),e.configurationProperties.isBackground&&(p.reconnectionProperties={ownerId:Jpt,data:{lastTask:e.getCommonTaskId(),group:f,label:e._label,id:e._id}}),b.shellIntegrationNonce&&We(p.initialText)&&p.shellIntegrationNonce&&(p.initialText=p.initialText.replace(p.shellIntegrationNonce,b.shellIntegrationNonce)),await b.terminal.reuseTerminal(p),e.command.presentation&&e.command.presentation.clear&&b.terminal.clearBuffer(),this._terminals[b.terminal.instanceId.toString()].lastTask=v,[b.terminal,void 0]}this._terminalCreationQueue=this._terminalCreationQueue.then(()=>this._doCreateTerminal(e,f,p));let S=await this._terminalCreationQueue;e.configurationProperties.isBackground&&(S.shellLaunchConfig.reconnectionProperties={ownerId:Jpt,data:{lastTask:e.getCommonTaskId(),group:f,label:e._label,id:e._id}});let y=S.instanceId.toString(),w={terminal:S,lastTask:v,group:f,shellIntegrationNonce:S.shellLaunchConfig.shellIntegrationNonce},x=S.onDisposed(()=>{this._deleteTaskAndTerminal(S,w),x.dispose()});return this._terminals[y]=w,S.shellLaunchConfig.tabActions=this._terminalTabActions,[S,void 0]}_buildShellCommandLine(e,t,o,n,r,s){let l=jj(t).name.toLowerCase(),c=this._getQuotingOptions(l,o,e);function u(w){if(w.length>=2&&(w[0]===c.strong?c.strong:w[0]===c.weak?c.weak:void 0)===w[w.length-1])return!1;let x;for(let E=0;E<w.length;E++){let M=w[E];if(M===x)x=void 0;else{if(x!==void 0)continue;if(M===c.escape)E++;else if(M===c.strong||M===c.weak)x=M;else if(M===" ")return!0}}return!1}function p(w,x){if(x===2&&c.strong)return[c.strong+w+c.strong,!0];if(x===3&&c.weak)return[c.weak+w+c.weak,!0];if(x===1&&c.escape){if(We(c.escape))return[w.replace(/ /g,c.escape+" "),!0];{let E=[];for(let V of c.escape.charsToEscape)E.push(`\\${V}`);let M=new RegExp("["+E.join(",")+"]","g"),N=c.escape.escapeChar;return[w.replace(M,V=>N+V),!0]}}return[w,!1]}function h(w){return We(w)?u(w)?p(w,2):[w,!1]:p(w.value,w.quoting)}if((!s||s.length===0)&&We(n)&&(n===r||u(r)))return n;let g=[],f=!1,v=!1,b,S;[b,S]=h(n),g.push(b),f=S;for(let w of s)[b,S]=h(w),g.push(b),v=v||S;let y=g.join(" ");return e===3&&(l==="cmd"&&f&&v?y='"'+y+'"':(l==="powershell"||l==="pwsh")&&f&&(y="& "+y)),y}_getQuotingOptions(e,t,o){return t&&t.quoting?t.quoting:a._shellQuotes[e]||a._osShellQuotes[oD(o)]}_collectTaskVariables(e,t){if(t.command&&t.command.name&&this._collectCommandVariables(e,t.command,t),this._collectMatcherVariables(e,t.configurationProperties.problemMatchers),t.command.runtime===3&&(Zd.is(t)||sg.is(t))){let o;Zd.is(t)?o=t._source.config.element:(o=io(t.defines),delete o._key,delete o.type),this._collectDefinitionVariables(e,o)}}_collectDefinitionVariables(e,t){if(We(t))this._collectVariables(e,t);else if(Array.isArray(t))t.forEach(o=>this._collectDefinitionVariables(e,o));else if(Di(t))for(let o of Object.keys(t))this._collectDefinitionVariables(e,t[o])}_collectCommandVariables(e,t,o){if(t.runtime===3)return;if(t.name===void 0)throw new Error("Command name should never be undefined here.");if(this._collectVariables(e,t.name),t.args?.forEach(r=>this._collectVariables(e,r)),o._source.scope!==1&&e.add("${workspaceFolder}"),t.options){let r=t.options;r.cwd&&this._collectVariables(e,r.cwd);let s=r.env;s&&Object.keys(s).forEach(l=>{let c=s[l];We(c)&&this._collectVariables(e,c)}),r.shell&&(r.shell.executable&&this._collectVariables(e,r.shell.executable),r.shell.args?.forEach(l=>this._collectVariables(e,l)))}}_collectMatcherVariables(e,t){t==null||t.length===0||t.forEach(o=>{let n;if(We(o)?o[0]==="$"?n=wS.get(o.substring(1)):n=wS.get(o):n=o,n&&n.filePrefix)if(We(n.filePrefix))this._collectVariables(e,n.filePrefix);else for(let r of[...Ec(n.filePrefix.include||[]),...Ec(n.filePrefix.exclude||[])])this._collectVariables(e,r)})}_collectVariables(e,t){let o=We(t)?t:t.value,n=/\$\{(.*?)\}/g,r;do r=n.exec(o),r&&e.add(r[0]);while(r)}async _resolveCommandAndArgs(e,t){let o=t.args?t.args.slice():[];return o=await this._resolveVariables(e,o),{command:await this._resolveVariable(e,t.name),args:o}}async _resolveVariables(e,t){return Promise.all(t.map(o=>this._resolveVariable(e,o)))}async _resolveMatchers(e,t){if(t==null||t.length===0)return[];let o=[];for(let n of t){let r;if(We(n)?n[0]==="$"?r=wS.get(n.substring(1)):r=wS.get(n):r=n,!r){this._appendOutput(d(15678,null));continue}let s=e.taskSystemInfo,l=r.filePrefix!==void 0,c=s!==void 0&&s.uriProvider!==void 0;if(!l&&!c)o.push(r);else{let u=io(r);if(c&&s!==void 0&&(u.uriProvider=s.uriProvider),l){let p=u.filePrefix;We(p)?u.filePrefix=await this._resolveVariable(e,p):p!==void 0&&(p.include&&(p.include=Array.isArray(p.include)?await Promise.all(p.include.map(h=>this._resolveVariable(e,h))):await this._resolveVariable(e,p.include)),p.exclude&&(p.exclude=Array.isArray(p.exclude)?await Promise.all(p.exclude.map(h=>this._resolveVariable(e,h))):await this._resolveVariable(e,p.exclude)))}o.push(u)}}return o}async _resolveVariable(e,t){if(We(t))return e.resolve(t);if(t!==void 0)return{value:await e.resolve(t.value),quoting:t.quoting};throw new Error("Should never try to resolve undefined.")}async _resolveOptions(e,t){if(t==null){let n;try{n=await this._resolveVariable(e,"${workspaceFolder}")}catch{}return{cwd:n}}let o=We(t.cwd)?{cwd:await this._resolveVariable(e,t.cwd)}:{cwd:await this._resolveVariable(e,"${workspaceFolder}")};if(t.env){o.env=Object.create(null);for(let n of Object.keys(t.env)){let r=t.env[n];We(r)?o.env[n]=await this._resolveVariable(e,r):o.env[n]=String(r)}}return o}static{this.WellKnownCommands={ant:!0,cmake:!0,eslint:!0,gradle:!0,grunt:!0,gulp:!0,jake:!0,jenkins:!0,jshint:!0,make:!0,maven:!0,msbuild:!0,msc:!0,nmake:!0,npm:!0,rake:!0,tsc:!0,xbuild:!0}}getSanitizedCommand(e){let t=e.toLowerCase(),o=t.lastIndexOf(Cu);return o!==-1&&(t=t.substring(o+1)),a.WellKnownCommands[t]?t:"other"}async getTaskForTerminal(e){for(let o of Object.keys(this._activeTasks)){let n=this._activeTasks[o];if(n.terminal?.instanceId===e)return n.task}let t=this._terminals[e.toString()];if(t?.lastTask)return await this._taskLookup(t.lastTask)}_appendOutput(e){this._outputService.getChannel(this._outputChannelId)?.append(e)}};function gWo(a,i){return(a.close===void 0||a.close===!1)&&(a.reveal!==3||!i.isBackground||a.close===!1)?a.panel===3?fWo(d(15665,null)):a.showReuseMessage?fWo(d(15669,null)):!0:!a.close}function fWo(a){return i=>`${b7("D",i.toString())}${a}`}function vWo(a){return a.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties?.data}var dGi="task.quickOpen.detail",bYt="task.quickOpen.skip";function uGi(a){return"uri"in a}var cGi=d(15650,null),vYt=Oe("tasks-list-configure",L.gear,d(15639,null)),bWo=Oe("tasks-remove",L.close,d(15644,null)),xDn="runTaskStorageKey",Db=class extends k{constructor(e,t,o,n,r,s,l){super();this._taskService=e;this._configurationService=t;this._quickInputService=o;this._notificationService=n;this._themeService=r;this._dialogService=s;this._storageService=l;this._sorter=this._taskService.createSorter()}_showDetail(){return!!this._configurationService.getValue(dGi)}_guessTaskLabel(e){if(e._label)return e._label;if(ev.is(e)){let t=e.configures.type,o=io(e.configures);return delete o._key,delete o.type,Object.keys(o).forEach(n=>t+=`: ${o[n]}`),t}return""}static getTaskLabelWithIcon(e,t){let o=t||e._label,n=e.configurationProperties.icon;return n?n.id?`$(${n.id}) ${o}`:`$(${L.tools.id}) ${o}`:`${o}`}static applyColorStyles(e,t,o){if(e.configurationProperties.icon?.color){let n=o.getColorTheme(),r=dRe(n);return t.iconClasses=[lw(e.configurationProperties.icon.color)],r}}_createTaskEntry(e,t=[]){let o=[{iconClass:q.asClassName(vYt),tooltip:d(15638,null)},...t],n={label:Db.getTaskLabelWithIcon(e,this._guessTaskLabel(e)),description:this._taskService.getTaskDescription(e),task:e,detail:this._showDetail()?e.configurationProperties.detail:void 0,buttons:o},r=Db.applyColorStyles(e,n,this._themeService);return r&&this._register(r),n}_createEntriesForGroup(e,t,o,n=[]){e.push({type:"separator",label:o}),t.forEach(r=>{r.configurationProperties.hide||e.push(this._createTaskEntry(r,n))})}_createTypeEntries(e,t){e.push({type:"separator",label:d(15640,null)}),t.forEach(o=>{e.push({label:`$(folder) ${o}`,task:o,ariaLabel:d(15652,null,o)})}),e.push({label:cGi,task:cGi,alwaysShow:!0})}_handleFolderTaskResult(e){let t=[];return Array.from(e).forEach(([o,n])=>{if(n.set&&t.push(...n.set.tasks),n.configurations)for(let r in n.configurations.byIdentifier)t.push(n.configurations.byIdentifier[r])}),t}_dedupeConfiguredAndRecent(e,t){let o=[],n=Array(e.length).fill(!1);for(let s=0;s<t.length;s++){let l=t[s].getWorkspaceFolder()?.uri.toString(),c=t[s].getDefinition()?._key,u=t[s].type,p=t[s]._label,h=t[s].getKey(),g=e.findIndex(f=>l&&c&&f.getWorkspaceFolder()?.uri.toString()===l&&(f.getDefinition()?._key===c||f.type===u&&f._label===p)||h&&f.getKey()===h);g===-1?o.push(t[s]):(e[g]=t[s],n[g]=!0)}o=o.sort((s,l)=>this._sorter.compare(s,l));let r=[];for(let s=0;s<e.length;s++)(n[s]||ev.is(e[s]))&&r.push(e[s]);return{configuredTasks:o,recentTasks:r}}async getTopLevelEntries(e){if(this._topLevelEntries!==void 0)return{entries:this._topLevelEntries};let t=(await this._taskService.getSavedTasks("historical")).reverse(),o=this._handleFolderTaskResult(await this._taskService.getWorkspaceTasks()),n=this._taskService.taskTypes();this._topLevelEntries=[];let r=this._dedupeConfiguredAndRecent(t,o),s=r.configuredTasks;if(t=r.recentTasks,t.length>0){let l={iconClass:q.asClassName(bWo),tooltip:d(15643,null)};this._createEntriesForGroup(this._topLevelEntries,t,d(15642,null),[l])}return o.length>0&&s.length>0&&this._createEntriesForGroup(this._topLevelEntries,s,d(15637,null)),e&&o.length===0&&(this._topLevelEntries.push({type:"separator",label:d(15637,null)}),this._topLevelEntries.push(e)),n.length>0&&this._createTypeEntries(this._topLevelEntries,n),{entries:this._topLevelEntries,isSingleConfigured:o.length===1?o[0]:void 0}}async handleSettingOption(e){let{confirmed:t}=await this._dialogService.confirm({type:ft.Warning,message:d(15645,null,e),cancelButton:d(15646,null)});if(t)return await this._configurationService.updateValue(`${e}.autoDetect`,"on"),await new Promise(o=>setTimeout(()=>o(),100)),this.show(d(15651,null),void 0,e)}async show(e,t,o,n){let r=new O,s=r.add(this._quickInputService.createQuickPick({useSeparators:!0}));s.placeholder=e,s.matchOnDescription=!0,s.ignoreFocusOut=!1,r.add(s.onDidTriggerItemButton(async c=>{let u=c.item.task;if(c.button.iconClass===q.asClassName(bWo)){let p=u&&!We(u)?u.getKey():void 0;p&&this._taskService.removeRecentlyUsedTask(p);let h=s.items.indexOf(c.item);h>=0&&(s.items=[...s.items.slice(0,h),...s.items.slice(h+1)])}else if(c.button.iconClass===q.asClassName(vYt)){if(this._quickInputService.cancel(),sg.is(u))this._taskService.customize(u,void 0,!0);else if(Zd.is(u)||ev.is(u)){let p=!1;try{p=await this._taskService.openConfig(u)}catch{}p||this._taskService.customize(u,void 0,!0)}}})),n&&(s.value=n);let l=o;if(!l){let c=await this.getTopLevelEntries(t);if(c.isSingleConfigured&&this._configurationService.getValue(bYt))return r.dispose(),this._toTask(c.isSingleConfigured);let u=c.entries;l=await this._doPickerFirstLevel(s,u,r)}do if(We(l)){if(n){await this._doPickerFirstLevel(s,(await this.getTopLevelEntries(t)).entries,r),r.dispose();return}let c=await this.doPickerSecondLevel(s,r,l);if(c&&!c.settingType&&c.task===null)s.value="",l=await this._doPickerFirstLevel(s,(await this.getTopLevelEntries(t)).entries,r);else return c&&We(c.settingType)?(r.dispose(),this.handleSettingOption(c.settingType)):(r.dispose(),c?.task&&!We(c?.task)?this._toTask(c?.task):void 0)}else return l?(r.dispose(),this._toTask(l)):(r.dispose(),l);while(!0)}async _doPickerFirstLevel(e,t,o){return e.items=t,o.add(F7t(this._storageService,xDn,e,!0)),(await new Promise(r=>{o.add(U.once(e.onDidAccept)(async()=>{r(e.selectedItems?e.selectedItems[0]:void 0)}))}))?.task}async doPickerSecondLevel(e,t,o,n){if(e.busy=!0,o===cGi){let s=(await this._taskService.tasks()).filter(l=>!l.configurationProperties.hide).sort((l,c)=>this._sorter.compare(l,c)).map(l=>this._createTaskEntry(l));s.push(...Db.allSettingEntries(this._configurationService)),e.items=s}else e.value=n||"",e.items=await this._getEntriesForProvider(o);return await e.show(),e.busy=!1,await new Promise(s=>{t.add(U.once(e.onDidAccept)(async()=>{s(e.selectedItems?e.selectedItems[0]:void 0)}))})}static allSettingEntries(e){let t=[],o=Db.getSettingEntry(e,"grunt");o&&t.push(o);let n=Db.getSettingEntry(e,"gulp");n&&t.push(n);let r=Db.getSettingEntry(e,"jake");return r&&t.push(r),t}static getSettingEntry(e,t){if(e.getValue(`${t}.autoDetect`)==="off")return{label:"$(gear) "+d(15647,null,t[0].toUpperCase()+t.slice(1),t),task:null,settingType:t,alwaysShow:!0}}async _getEntriesForProvider(e){let t=(await this._taskService.tasks({type:e})).sort((r,s)=>this._sorter.compare(r,s)),o=[];if(t.length>0){for(let r of t)r.configurationProperties.hide||o.push(this._createTaskEntry(r));o.push({type:"separator"},{label:d(15648,null),task:null,alwaysShow:!0})}else o=[{label:d(15649,null,e),task:null,alwaysShow:!0}];let n=Db.getSettingEntry(this._configurationService,e);return n&&o.push(n),o}async _toTask(e){if(!ev.is(e))return e;let t=await this._taskService.tryResolveTask(e);return t||this._notificationService.error(d(15641,null,e.type)),t}};Db=I([m(0,yf),m(1,B),m(2,$e),m(3,Ne),m(4,Pe),m(5,ct),m(6,de)],Db);var SYt="task.quickOpen.history",pGi="task.problemMatchers.neverPrompt",EDn="task.quickOpen.showAll",TDn="Task",CIe;(e=>(e.ID="workbench.action.tasks.configureTaskRunner",e.TEXT=P(15473,"Configure Task")))(CIe||={});var IYt=class{constructor(i){this._outputChannel=i;this._onDidError=new T;this.onDidError=this._onDidError.event;this._validationStatus=new vGe}info(i){this._validationStatus.state=1,this._outputChannel.append(i+`
`)}warn(i){this._validationStatus.state=2,this._outputChannel.append(i+`
`)}error(i){this._validationStatus.state=3,this._outputChannel.append(i+`
`),this._onDidError.fire(i)}fatal(i){this._validationStatus.state=4,this._outputChannel.append(i+`
`),this._onDidError.fire(i)}get status(){return this._validationStatus}},S7=class a{constructor(){this._store=new Map}forEach(i){this._store.forEach(i)}static getKey(i){let e;if(We(i))e=i;else{let t=uGi(i)?i.uri:i.configuration;e=t?t.toString():""}return e}get(i){let e=a.getKey(i),t=this._store.get(e);return t||(t=[],this._store.set(e,t)),t}add(i,...e){let t=a.getKey(i),o=this._store.get(t);o||(o=[],this._store.set(t,o)),o.push(...e)}all(){let i=[];return this._store.forEach(e=>i.push(...e)),i}},CS=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce,Se,Re,xe,He,Ee,Te,It,tt,Oi){super();this._configurationService=e;this._markerService=t;this._outputService=o;this._paneCompositeService=n;this._viewsService=r;this._commandService=s;this._editorService=l;this._fileService=c;this._contextService=u;this._telemetryService=p;this._textFileService=h;this._modelService=g;this._extensionService=f;this._quickInputService=v;this._configurationResolverService=b;this._terminalService=S;this._terminalGroupService=y;this._storageService=w;this._progressService=x;this._openerService=E;this._dialogService=M;this._notificationService=N;this._contextKeyService=V;this._environmentService=H;this._terminalProfileResolverService=K;this._pathService=j;this._textModelResolverService=J;this._preferencesService=se;this._viewDescriptorService=ae;this._workspaceTrustRequestService=ce;this._workspaceTrustManagementService=Se;this._logService=Re;this._themeService=xe;this._lifecycleService=He;this._instantiationService=Te;this._chatService=It;this._chatAgentService=tt;this._hostService=Oi;this._tasksReconnected=!1;this._taskSystemListeners=[];this._onDidRegisterSupportedExecutions=this._register(new T);this._onDidRegisterAllSupportedExecutions=this._register(new T);this._onDidChangeTaskSystemInfo=this._register(new T);this._willRestart=!1;this.onDidChangeTaskSystemInfo=this._onDidChangeTaskSystemInfo.event;this._onDidReconnectToTasks=this._register(new T);this.onDidReconnectToTasks=this._onDidReconnectToTasks.event;this._onDidChangeTaskConfig=this._register(new T);this.onDidChangeTaskConfig=this._onDidChangeTaskConfig.event;this._onDidChangeTaskProviders=this._register(new T);this.onDidChangeTaskProviders=this._onDidChangeTaskProviders.event;this._taskRunStartTimes=new Map;this._taskRunSources=new Map;this._activatedTaskProviders=new Set;this.toast=this._register(new ue);this._whenTaskSystemReady=U.toPromise(this.onDidChangeTaskSystemInfo),this._workspaceTasksPromise=void 0,this._taskSystem=void 0,this._taskSystemListeners=void 0,this._outputChannel=this._outputService.getChannel(CS.OutputChannelId),this._providers=new Map,this._providerTypes=new Map,this._taskSystemInfos=new Map,this._register(this._contextService.onDidChangeWorkspaceFolders(()=>{let zt=this._computeWorkspaceFolderSetup();return this.executionEngine!==zt[2]&&(this._disposeTaskSystemListeners(),this._taskSystem=void 0),this._updateSetup(zt),this._updateWorkspaceTasks(2)})),this._register(this._configurationService.onDidChangeConfiguration(async zt=>{if(!zt.affectsConfiguration("tasks")||!this._taskSystem&&!this._workspaceTasksPromise)return;(!this._taskSystem||this._taskSystem instanceof uae)&&this._outputChannel.clear(),zt.affectsConfiguration("task.reconnection")&&(this._configurationService.getValue("task.reconnection")||(this._persistentTasks?.clear(),this._storageService.remove(CS.PersistentTasks_Key,1))),this._setTaskLRUCacheLimit();let mo=await this._updateWorkspaceTasks(3);this._onDidChangeTaskConfig.fire();for(let[dn,No]of mo)if(No.set?.tasks?.length)for(let _i of No.set.tasks){let ln=_i._id,Tn=this._taskSystem?.lastTask?.task._id;if(Tn&&Tn===ln&&dn!=="setting"){let Ko=new xGe(_i,this._taskSystem.lastTask.resolver,SIe.command);this._taskSystem.lastTask=Ko}}})),this._taskRunningState=TLe.bindTo(V),this._tasksAvailableState=imo.bindTo(V),this._onDidStateChange=this._register(new T),this._registerCommands().then(()=>I0t.bindTo(this._contextKeyService).set(!0)),y0t.bindTo(this._contextKeyService).set(Ft&&!Ee.getConnection()?.remoteAuthority),this._configurationResolverService.contributeVariable("defaultBuildTask",async()=>{let zt=await this._getTasksForGroup(Lh.Build,!0);if(zt.length>0){let _i=this._getDefaultTasks(zt);if(_i.length===1)return _i[0]._label}zt=await this._getTasksForGroup(Lh.Build);let mo=this._getDefaultTasks(zt);if(mo.length===1)return mo[0]._label;mo.length&&(zt=mo);let dn;zt&&zt.length>0&&(dn=await this._showQuickPick(zt,d(15537,null)));let No=dn?dn.task:void 0;if(No)return No._label}),this._register(this._lifecycleService.onBeforeShutdown(zt=>{this._willRestart=zt.reason!==3})),this._register(this.onDidStateChange(async zt=>{switch(this._log(d(15493,null,zt.kind),!0),zt.kind){case"start":this._taskRunStartTimes.set(zt.taskId,Date.now());break;case"processEnded":{let mo=zt,dn=this._taskRunStartTimes.get(zt.taskId);if(!dn)break;let No=mo.durationMs??Date.now()-dn;No!==void 0&&this._handleLongRunningTaskCompletion(mo,No),this._taskRunStartTimes.delete(zt.taskId),this._taskRunSources.delete(zt.taskId);break}case"inactive":{let mo=zt,dn=this._taskRunStartTimes.get(zt.taskId);if(!dn)break;let No=mo.durationMs??Date.now()-dn;No!==void 0&&this._handleLongRunningTaskCompletion(mo,No),this._taskRunStartTimes.delete(zt.taskId),this._taskRunSources.delete(zt.taskId);break}case"terminated":this._taskRunStartTimes.delete(zt.taskId),this._taskRunSources.delete(zt.taskId);break}if(zt.kind!=="changed")if((this._willRestart||zt.kind==="terminated"&&zt.exitReason===3)&&zt.taskId){let mo=zt.__task.getKey();mo&&this.removePersistentTask(mo)}else zt.kind==="start"&&zt.__task&&zt.__task.getWorkspaceFolder()&&this._setPersistentTask(zt.__task)})),this._waitForAllSupportedExecutions=new Promise(zt=>{U.once(this._onDidRegisterAllSupportedExecutions.event)(()=>zt())}),this._terminalService.whenConnected.then(()=>{this._terminalService.instances.filter(mo=>mo.reconnectionProperties?.ownerId===TDn).length?this._attemptTaskReconnection():(this._tasksReconnected=!0,this._onDidReconnectToTasks.fire())}),this._upgrade()}static{this.RecentlyUsedTasks_Key="workbench.tasks.recentlyUsedTasks"}static{this.RecentlyUsedTasks_KeyV2="workbench.tasks.recentlyUsedTasks2"}static{this.PersistentTasks_Key="workbench.tasks.persistentTasks"}static{this.IgnoreTask010DonotShowAgain_key="workbench.tasks.ignoreTask010Shown"}static{this.OutputChannelId="tasks"}static{this.OutputChannelLabel=d(15495,null)}static{this._nextHandle=0}get isReconnected(){return this._tasksReconnected}registerSupportedExecutions(e,t,o){e!==void 0&&exi.bindTo(this._contextKeyService).set(e);let n=!!AM.getValue(this._contextKeyService);t!==void 0&&Qme.bindTo(this._contextKeyService).set(t&&!n),o!==void 0&&LLe.bindTo(this._contextKeyService).set(o&&!n),this._workspaceTasksPromise=void 0,this._onDidRegisterSupportedExecutions.fire(),(y0t.getValue(this._contextKeyService)||e&&t&&o)&&this._onDidRegisterAllSupportedExecutions.fire()}_attemptTaskReconnection(){if(this._lifecycleService.startupKind!==3&&(this._log(d(15551,null),!0),this._tasksReconnected=!0,this._storageService.remove(CS.PersistentTasks_Key,1)),!this._configurationService.getValue("task.reconnection")||this._tasksReconnected){this._log(d(15529,null,this._configurationService.getValue("task.reconnection"),this._tasksReconnected),!0),this._tasksReconnected=!0;return}this._log(d(15546,null),!0),this.getWorkspaceTasks(4).then(async()=>{this._tasksReconnected=await this._reconnectTasks(),this._log(d(15545,null),!0),this._onDidReconnectToTasks.fire()})}async _handleLongRunningTaskCompletion(e,t){let o=this._configurationService.getValue("task.notifyWindowOnTaskCompletion");if(o===-1||o>0&&t<o||this._taskRunSources.get(e.taskId)===5)return;let r=this._terminalService.instances.find(g=>g.instanceId===e.terminalId);if(!r)return;let s=r.title,l=Me(r.domElement);if(l.document.hasFocus())return;let c=this._formatTaskDuration(t),u=s?d(15489,null,s,c):d(15488,null,c);this._hostService.focus(l,{mode:1});let p=new qe;this.toast.value=ee(()=>p.dispose(!0));let{clicked:h}=await this._hostService.showToast({title:u},p.token);this.toast.clear(),h&&this._hostService.focus(l,{mode:2})}_formatTaskDuration(e){let t=Math.max(1,Math.round(e/1e3)),o=Math.floor(t/60),n=t%60;return o>0?n>0?d(15491,null,o,n):d(15490,null,o):d(15492,null,n)}async _reconnectTasks(){let e=await this.getSavedTasks("persistent");if(!e.length)return this._log(d(15527,null),!0),!0;let t=e.map(o=>o._label).join(", ");this._log(d(15547,null,t),!0);for(let o of e)if(ev.is(o)){let n=await this.tryResolveTask(o);n&&this.run(n,void 0,4)}else this.run(o,void 0,4);return!0}get onDidStateChange(){return this._onDidStateChange.event}get supportsMultipleTaskExecutions(){return this.inTerminal()}async _registerCommands(){Ge.registerCommand({id:"workbench.action.tasks.runTask",handler:async(e,t)=>{await this._trust()&&await this._runTaskCommand(t)},metadata:{description:"Run Task",args:[{name:"args",isOptional:!0,description:d(15479,null),schema:{anyOf:[{type:"string",description:d(15480,null)},{type:"object",properties:{type:{type:"string",description:d(15482,null)},task:{type:"string",description:d(15481,null)}}}]}}]}}),Ge.registerCommand("workbench.action.tasks.reRunTask",async e=>{await this._trust()&&this._reRunTaskCommand()}),Ge.registerCommand("workbench.action.tasks.restartTask",async(e,t)=>{await this._trust()&&this._runRestartTaskCommand(t)}),Ge.registerCommand(S0t,async e=>{await this._trust()&&this._runRerunAllRunningTasksCommand()}),Ge.registerCommand("workbench.action.tasks.terminate",async(e,t)=>{await this._trust()&&this._runTerminateCommand(t)}),Ge.registerCommand("workbench.action.tasks.showLog",()=>{this._showOutput(void 0,!0)}),Ge.registerCommand("workbench.action.tasks.build",async()=>{await this._trust()&&this._runBuildCommand()}),Ge.registerCommand("workbench.action.tasks.test",async()=>{await this._trust()&&this._runTestCommand()}),Ge.registerCommand("workbench.action.tasks.configureTaskRunner",async()=>{await this._trust()&&this._runConfigureTasks()}),Ge.registerCommand("workbench.action.tasks.configureDefaultBuildTask",async()=>{await this._trust()&&this._runConfigureDefaultBuildTask()}),Ge.registerCommand("workbench.action.tasks.configureDefaultTestTask",async()=>{await this._trust()&&this._runConfigureDefaultTestTask()}),Ge.registerCommand("workbench.action.tasks.showTasks",async()=>{if(await this._trust())return this.runShowTasks()}),Ge.registerCommand("workbench.action.tasks.toggleProblems",()=>this._commandService.executeCommand(Ur.TOGGLE_MARKERS_VIEW_ACTION_ID)),Ge.registerCommand("workbench.action.tasks.openUserTasks",async()=>{let e=this._getResourceForKind(Vl.User);e&&this._openTaskFile(e,Vl.User)}),Ge.registerCommand("workbench.action.tasks.openWorkspaceFileTasks",async()=>{let e=this._getResourceForKind(Vl.WorkspaceFile);e&&this._openTaskFile(e,Vl.WorkspaceFile)})}get workspaceFolders(){return this._workspaceFolders||this._updateSetup(),this._workspaceFolders}get ignoredWorkspaceFolders(){return this._ignoredWorkspaceFolders||this._updateSetup(),this._ignoredWorkspaceFolders}get executionEngine(){return this._executionEngine===void 0&&this._updateSetup(),this._executionEngine}get schemaVersion(){return this._schemaVersion===void 0&&this._updateSetup(),this._schemaVersion}get showIgnoreMessage(){return this._showIgnoreMessage===void 0&&(this._showIgnoreMessage=!this._storageService.getBoolean(CS.IgnoreTask010DonotShowAgain_key,1,!1)),this._showIgnoreMessage}_getActivationEvents(e){let t=[];if(t.push("onCommand:workbench.action.tasks.runTask"),e)t.push(`onTaskType:${e}`);else for(let o of xE.all())t.push(`onTaskType:${o.taskType}`);return t}async _activateTaskProviders(e){await this._extensionService.whenInstalledExtensionsRegistered(),this._activatedTaskProviders.has(e??"all")||this._log("Activating task providers "+(e??"all")),await Uu(Promise.all(this._getActivationEvents(e).map(n=>this._extensionService.activateByEvent(n))),5e3,()=>this._logService.warn("Timed out activating extensions for task providers"))&&this._activatedTaskProviders.add(e??"all")}_updateSetup(e){if(e||(e=this._computeWorkspaceFolderSetup()),this._workspaceFolders=e[0],this._ignoredWorkspaceFolders)if(this._ignoredWorkspaceFolders.length!==e[1].length)this._showIgnoreMessage=void 0;else{let t=new Set;this._ignoredWorkspaceFolders.forEach(o=>t.add(o.uri.toString()));for(let o of e[1])if(!t.has(o.uri.toString())){this._showIgnoreMessage=void 0;break}}this._ignoredWorkspaceFolders=e[1],this._executionEngine=e[2],this._schemaVersion=e[3],this._workspace=e[4]}_showOutput(e=1,t,o){if(!AM.getValue(this._contextKeyService)&&(e===1||e===3))if(t)this._outputService.showChannel(this._outputChannel.id,!0);else{let n=this._chatService.isEnabled("panel"),r=[];if(n&&o){let s=/^(.*?)\s*\{[\s\S]*$/,l=o.match(s);if(l&&l.length>1){let c=l[1],u=c===o?`\`${c}\``:`\`${c}\`
\`\`\`json${o}\`\`\``;this._chatAgentService.getDefaultAgent("panel")&&r.push({label:d(15577,null),run:async()=>{this._commandService.executeCommand(tk,{mode:"agent",query:`Fix this task configuration error: ${u}`})}})}}r.push({label:d(15487,null),run:()=>{this._outputService.showChannel(this._outputChannel.id,!0)}}),n&&r.length>1?this._notificationService.prompt(wt.Warning,d(15559,null),r):this._notificationService.prompt(wt.Warning,d(15558,null),r)}}_disposeTaskSystemListeners(){this._taskSystemListeners&&(je(this._taskSystemListeners),this._taskSystemListeners=void 0)}registerTaskProvider(e,t){if(!e)return{dispose:()=>{}};let o=CS._nextHandle++;return this._providers.set(o,e),this._providerTypes.set(o,t),this._onDidChangeTaskProviders.fire(),{dispose:()=>{this._providers.delete(o),this._providerTypes.delete(o),this._onDidChangeTaskProviders.fire()}}}get hasTaskSystemInfo(){let e=Array.from(this._taskSystemInfos.values()).flat().length;return this._environmentService.remoteAuthority?e>1:e>0}registerTaskSystem(e,t){if(t.platform===0&&(e=this.workspaceFolders.length?this.workspaceFolders[0].uri.scheme:e),!this._taskSystemInfos.has(e))this._taskSystemInfos.set(e,[t]);else{let o=this._taskSystemInfos.get(e);t.platform===0?o.push(t):o.unshift(t)}this.hasTaskSystemInfo&&this._onDidChangeTaskSystemInfo.fire()}_getTaskSystemInfo(e){let t=this._taskSystemInfos.get(e);return t&&t.length?t[0]:void 0}extensionCallbackTaskComplete(e,t){return this._taskSystem?this._taskSystem.customExecutionComplete(e,t):Promise.resolve()}async _findWorkspaceTasks(e){let t=[],o=await this.getWorkspaceTasks();for(let[,n]of o){if(n.configurations)for(let r of Object.keys(n.configurations.byIdentifier)){let s=n.configurations.byIdentifier[r];e(s,n.workspaceFolder)&&t.push(s)}if(n.set)for(let r of n.set.tasks)e(r,n.workspaceFolder)&&t.push(r)}return t}async _findWorkspaceTasksInGroup(e,t){return this._findWorkspaceTasks(o=>{let n=o.configurationProperties.group;return n&&typeof n!="string"?n._id===e._id&&(!t||!!n.isDefault):!1})}async getTask(e,t,o=!1,n=void 0){if(!await this._trust())return;let r=We(e)?e:uGi(e)?e.name:e.configuration?Be(e.configuration):void 0;if(this.ignoredWorkspaceFolders.some(h=>h.name===r))return Promise.reject(new Error(d(15496,null,r)));let s=We(t)?t:nU.createTaskIdentifier(t,console);if(s===void 0)return Promise.resolve(void 0);let l=S7.getKey(e),c=await this._findWorkspaceTasks((h,g)=>{let f=S7.getKey(g);return f!==l&&f!==oU?!1:h.matches(s,o)});if(c.sort(h=>h._source.kind===Vl.Extension?1:-1),c.length>0){let h=c[0];return ev.is(h)?this.tryResolveTask(h):h}let u=await this._getGroupedTasks({type:n}),p=u.get(e);if(p=p.concat(u.get(oU)),!!p)return p=p.filter(h=>h.matches(s,o)).sort(h=>h._source.kind===Vl.Extension?1:-1),p.length>0?p[0]:void 0}async tryResolveTask(e){if(!await this._trust())return;await this._activateTaskProviders(e.type);let t,o=!1;for(let[r,s]of this._providers){let l=this._providerTypes.get(r);if(e.type===l){if(l&&!this._isTaskProviderEnabled(l)){o=!0;continue}t=s;break}}if(!t){o&&this._log(d(15544,null,e.configures.type));return}try{let r=await t.resolveTask(e);if(r&&r._id===e._id)return _Ge(r,e)}catch{}let n=await this.tasks({type:e.type});for(let r of n)if(r._id===e._id)return _Ge(r,e)}async tasks(e){return await this._trust()?this._versionAndEngineCompatible(e)?this._getGroupedTasks(e).then(t=>this.applyFilterToTaskMap(e,t)):Promise.resolve([]):[]}async getKnownTasks(e){return this._versionAndEngineCompatible(e)?this._getGroupedTasks(e,!0,!0).then(t=>this.applyFilterToTaskMap(e,t)):Promise.resolve([])}taskTypes(){let e=[];if(this._isProvideTasksEnabled())for(let t of xE.all())this._isTaskProviderEnabled(t.taskType)&&e.push(t.taskType);return e}createSorter(){return new h0t(this._contextService.getWorkspace()?this._contextService.getWorkspace().folders:[])}_isActive(){return this._taskSystem?this._taskSystem.isActive():Promise.resolve(!1)}async getActiveTasks(){return this._taskSystem?this._taskSystem.getActiveTasks():[]}async getBusyTasks(){return this._taskSystem?this._taskSystem.getBusyTasks():[]}getRecentlyUsedTasksV1(){if(this._recentlyUsedTasksV1)return this._recentlyUsedTasksV1;let e=this._configurationService.getValue(SYt);this._recentlyUsedTasksV1=new Ua(e);let t=this._storageService.get(CS.RecentlyUsedTasks_Key,1);if(t)try{let o=JSON.parse(t);if(Array.isArray(o))for(let n of o)this._recentlyUsedTasksV1.set(n,n)}catch{}return this._recentlyUsedTasksV1}applyFilterToTaskMap(e,t){if(!e||!e.type)return t.all();let o=[];return t.forEach(n=>{for(let r of n)if(sg.is(r)&&(r.defines.type===e.type||r._source.label===e.type))o.push(r);else if(Zd.is(r))if(r.type===e.type)o.push(r);else{let s=r.customizes();s&&s.type===e.type&&o.push(r)}}),o}_getTasksFromStorage(e){return e==="persistent"?this._getPersistentTasks():this._getRecentTasks()}_getRecentTasks(){if(this._recentlyUsedTasks)return this._recentlyUsedTasks;let e=this._configurationService.getValue(SYt);this._recentlyUsedTasks=new Ua(e);let t=this._storageService.get(CS.RecentlyUsedTasks_KeyV2,1);if(t)try{let o=JSON.parse(t);if(Array.isArray(o))for(let n of o)this._recentlyUsedTasks.set(n[0],n[1])}catch{}return this._recentlyUsedTasks}_getPersistentTasks(){if(this._persistentTasks)return this._log(d(15513,null,this._persistentTasks.size),!0),this._persistentTasks;this._persistentTasks=new Ua(10);let e=this._storageService.get(CS.PersistentTasks_Key,1);if(e)try{let t=JSON.parse(e);if(Array.isArray(t))for(let o of t)this._persistentTasks.set(o[0],o[1])}catch{}return this._persistentTasks}_getFolderFromTaskKey(e){let t=JSON.parse(e);return{folder:t.folder,isWorkspaceFile:t.id?.endsWith(Vl.WorkspaceFile)}}async getSavedTasks(e){let t=Object.create(null);this.workspaceFolders.forEach(p=>{t[p.uri.toString()]=p});let o=new Map,n=new Map,r=this._getTasksFromStorage(e),s=[];this._log(d(15508,null),!0);function l(p,h,g){h&&!p.has(h)&&p.set(h,[]),h&&(t[h]||h===oU)&&g&&p.get(h).push(g)}for(let p of r.entries())try{let h=p[0],g=JSON.parse(p[1]),f=this._getFolderFromTaskKey(h);this._log(d(15510,null,h,g,f.folder),!0),l(f.isWorkspaceFile?n:o,f.folder,g)}catch(h){this._log(d(15509,null,h),!0)}let c=new Map;async function u(p,h,g){for(let f of h.keys()){let v=[],b=Object.create(null),S=t[f]?g?1:0:2;await p._computeTasksForSingleConfig(t[f]??await p._getAFolder(),{version:"2.0.0",tasks:h.get(f)},0,v,b,S,!0),v.forEach(y=>{let w=y.getKey();w&&c.set(w,y)});for(let y of Object.keys(b)){let w=b[y].getKey();w&&c.set(w,b[y])}}}await u(this,o,!1),await u(this,n,!0);for(let p of r.keys())c.has(p)?(s.push(c.get(p)),this._log(d(15511,null,p),!0)):this._log(d(15512,null,p),!0);return s}removeRecentlyUsedTask(e){this._getTasksFromStorage("historical").delete(e)&&this._saveRecentlyUsedTasks()}removePersistentTask(e){this._log(d(15548,null,e),!0),this._getTasksFromStorage("persistent").delete(e)&&this._savePersistentTasks()}_setTaskLRUCacheLimit(){let e=this._configurationService.getValue(SYt);this._recentlyUsedTasks&&(this._recentlyUsedTasks.limit=e)}async _setRecentlyUsedTask(e){let t=e.getKey();if(!h_.is(e)&&t){let o=this._createCustomizableTask(e);if(sg.is(e)&&o){let n=[],r=Object.create(null);await this._computeTasksForSingleConfig(e._source.workspaceFolder??this.workspaceFolders[0],{version:"2.0.0",tasks:[o]},0,n,r,0,!0);for(let s of Object.keys(r))t=r[s].getKey()}this._getTasksFromStorage("historical").set(t,JSON.stringify(o)),this._saveRecentlyUsedTasks()}}_saveRecentlyUsedTasks(){if(!this._recentlyUsedTasks)return;let e=this._configurationService.getValue(SYt);if(e===0)return;let t=[...this._recentlyUsedTasks.keys()];t.length>e&&(t=t.slice(0,e));let o=[];for(let n of t)o.push([n,this._recentlyUsedTasks.get(n,0)]);this._storageService.store(CS.RecentlyUsedTasks_KeyV2,JSON.stringify(o),1,1)}async _setPersistentTask(e){if(!this._configurationService.getValue("task.reconnection"))return;let t=e.getKey();if(!h_.is(e)&&t){let o=this._createCustomizableTask(e);if(sg.is(e)&&o){let n=[],r=Object.create(null);await this._computeTasksForSingleConfig(e._source.workspaceFolder??this.workspaceFolders[0],{version:"2.0.0",tasks:[o]},0,n,r,0,!0);for(let s of Object.keys(r))t=r[s].getKey()}if(!e.configurationProperties.isBackground)return;this._log(d(15550,null,t),!0),this._getTasksFromStorage("persistent").set(t,JSON.stringify(o)),this._savePersistentTasks()}}_savePersistentTasks(){this._persistentTasks=this._getTasksFromStorage("persistent");let e=[...this._persistentTasks.keys()],t=[];for(let o of e)t.push([o,this._persistentTasks.get(o,0)]);this._log(d(15485,null,e.join(", ")),!0),this._storageService.store(CS.PersistentTasks_Key,JSON.stringify(t),1,1)}_openDocumentation(){this._openerService.open(A.parse("https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher"))}async _findSingleWorkspaceTaskOfGroup(e){let t=await this._findWorkspaceTasksInGroup(e,!0);if(t.length===1&&typeof t[0].configurationProperties.group!="string"&&t[0].configurationProperties.group?.isDefault){let o;if(ev.is(t[0])?o=await this.tryResolveTask(t[0]):o=t[0],o)return this.run(o,void 0,1)}}async _build(){let e=await this._findSingleWorkspaceTaskOfGroup(Lh.Build);return e||this._getGroupedTasksAndExecute()}async _runTest(){let e=await this._findSingleWorkspaceTaskOfGroup(Lh.Test);return e||this._getGroupedTasksAndExecute(!0)}async _getGroupedTasksAndExecute(e){let t=await this._getGroupedTasks(),o=this._createRunnableTask(t,e?Lh.Test:Lh.Build);if(!o||!o.task)throw e?this.schemaVersion===1?new mL(wt.Info,d(15530,null),3):new mL(wt.Info,d(15531,null),3):this.schemaVersion===1?new mL(wt.Info,d(15518,null),2):new mL(wt.Info,d(15519,null),2);let n;try{n=await this._executeTask(o.task,o.resolver,1)}catch(r){return this._handleError(r),Promise.reject(r)}return n}async run(e,t,o=0){if(!await this._trust())return;if(!e)throw new mL(wt.Info,d(15497,null),5);let n=this._createResolver(),r;try{if(t&&t.attachProblemMatcher&&this._shouldAttachProblemMatcher(e)&&!h_.is(e)){let s=await this._attachProblemMatcher(e);s&&(r=await this._executeTask(s,n,o))}else r=await this._executeTask(e,n,o);return r}catch(s){return this._handleError(s),Promise.reject(s)}}_isProvideTasksEnabled(){return this._configurationService.getValue("task.autoDetect")==="on"}_isProblemMatcherPromptEnabled(e){let t=this._configurationService.getValue(pGi);return Xa(t)?!t:e===void 0?!0:!t[e]}_getTypeForTask(e){let t;return Zd.is(e)?t=e._source.config.element.type??"":t=e.getDefinition().type,t}_shouldAttachProblemMatcher(e){return this._isProblemMatcherPromptEnabled(this._getTypeForTask(e))===!1||!this._canCustomize(e)||e.configurationProperties.group!==void 0&&e.configurationProperties.group!==Lh.Build||e.configurationProperties.problemMatchers!==void 0&&e.configurationProperties.problemMatchers.length>0?!1:sg.is(e)?!e.hasDefinedMatchers&&!!e.configurationProperties.problemMatchers&&e.configurationProperties.problemMatchers.length===0:Zd.is(e)?e._source.config.element.problemMatcher===void 0&&!e.hasDefinedMatchers:!1}async _updateNeverProblemMatcherSetting(e){let t=this._configurationService.getValue(pGi);if(t===!0)return;let o;return t!==!1?o=t:o=Object.create(null),o[e]=!0,this._configurationService.updateValue(pGi,o)}async _attachProblemMatcher(e){let t=[];for(let r of wS.keys()){let s=wS.get(r);s.deprecated||(s.name===s.label?t.push({label:s.name,matcher:s}):t.push({label:s.label,description:`$${s.name}`,matcher:s}))}if(t.length===0)return;t=t.sort((r,s)=>r.label&&s.label?r.label.localeCompare(s.label):0),t.unshift({type:"separator",label:d(15498,null)});let o;Zd.is(e)?o=e._source.config.element.type??"":o=e.getDefinition().type,t.unshift({label:d(15499,null),matcher:void 0},{label:d(15501,null),matcher:void 0,never:!0},{label:d(15502,null,o),matcher:void 0,setting:o},{label:d(15500,null),matcher:void 0,learnMore:!0});let n=await this._quickInputService.pick(t,{placeHolder:d(15486,null)});if(!n)return e;if(n.learnMore){this._openDocumentation();return}if(n.never)return this.customize(e,{problemMatcher:[]},!0),e;if(n.matcher){let r=e.clone(),s=`$${n.matcher.name}`,l={problemMatcher:[s]};r.configurationProperties.problemMatchers=[s];let c=wS.get(n.matcher.name);return c&&c.watching!==void 0&&(l.isBackground=!0,r.configurationProperties.isBackground=!0),this.customize(e,l,!0),r}return n.setting&&await this._updateNeverProblemMatcherSetting(n.setting),e}async _getTasksForGroup(e,t){let o=await this._getGroupedTasks(void 0,t),n=[];return o.forEach(r=>{for(let s of r)Lh.from(s.configurationProperties.group)?._id===e._id&&n.push(s)}),n}needsFolderQualification(){return this._contextService.getWorkbenchState()===3}_canCustomize(e){return this.schemaVersion!==2?!1:Zd.is(e)?!0:sg.is(e)?!!e.getWorkspaceFolder():!1}async _formatTaskForJson(e,t){let o,n="";try{o=await this._textModelResolverService.createModelReference(e);let r=o.object.textEditorModel,{tabSize:s,insertSpaces:l}=r.getOptions(),c=r.getEOL(),u=dW(t,{eol:c,tabSize:s,insertSpaces:l}),p=new RegExp(c+(l?" ".repeat(s):"\\t"),"g");u=u.replace(p,c+(l?" ".repeat(s*3):"			"));let h=l?" ".repeat(s*2):"		";n=h+u.slice(0,u.length-1)+h+u.slice(u.length-1)}finally{o?.dispose()}return n}async _openEditorAtTask(e,t,o=-1){if(e===void 0)return Promise.resolve(!1);let r=(await this._fileService.readFile(e)).value;if(!r||!t)return!1;let s=r.toString(),l;if(o!==-1){let g=this._configurationService.getValue("tasks",{resource:e});g.tasks&&g.tasks.length>o&&(l=await this._formatTaskForJson(e,g.tasks[o]))}l||(typeof t=="string"?l=t:l=await this._formatTaskForJson(e,t));let c=s.indexOf(l),u=1;for(let g=0;g<c;g++)s.charAt(g)===`
`&&u++;let p=u;for(let g=0;g<l.length;g++)l.charAt(g)===`
`&&p++;let h=u>1?{startLineNumber:u,startColumn:u===p?4:3,endLineNumber:p,endColumn:u===p?void 0:4}:void 0;return await this._editorService.openEditor({resource:e,options:{pinned:!1,forceReload:!0,selection:h,selectionRevealType:1}}),!!h}_createCustomizableTask(e){let t,o=Zd.is(e)||ev.is(e)?e._source.config:void 0;if(o&&o.element)t={...o.element};else if(sg.is(e)){t={};let n=Object.assign(Object.create(null),e.defines);delete n._key,Object.keys(n).forEach(r=>t[r]=n[r]),e.configurationProperties.problemMatchers&&e.configurationProperties.problemMatchers.length>0&&vI(e.configurationProperties.problemMatchers)&&(t.problemMatcher=e.configurationProperties.problemMatchers),e.configurationProperties.group&&(t.group=wIe.to(e.configurationProperties.group))}if(t)return(t.problemMatcher===void 0&&e.configurationProperties.problemMatchers===void 0||e.configurationProperties.problemMatchers&&e.configurationProperties.problemMatchers.length===0)&&(t.problemMatcher=[]),e._source.label!=="Workspace"?t.label=e.configurationProperties.identifier:t.label=e._label,t.detail=e.configurationProperties.detail,t}async customize(e,t,o){if(!await this._trust())return;let n=e.getWorkspaceFolder();if(!n)return Promise.resolve(void 0);let r=this._getConfiguration(n,e._source.kind);if(r.hasParseErrors)return this._notificationService.warn(d(15474,null)),Promise.resolve(void 0);let s=r.config,l=this._createCustomizableTask(e);if(!l)return Promise.resolve(void 0);let c=Zd.is(e)?e._source.config.index:void 0;if(t)for(let u of Object.getOwnPropertyNames(t)){let p=t[u];p!=null&&(l[u]=p)}if(s)c===-1&&t?t.problemMatcher!==void 0?(s.problemMatcher=t.problemMatcher,await this._writeConfiguration(n,"tasks.problemMatchers",s.problemMatcher,e._source.kind)):t.group!==void 0&&(s.group=t.group,await this._writeConfiguration(n,"tasks.group",s.group,e._source.kind)):(Array.isArray(s.tasks)||(s.tasks=[]),c===void 0?s.tasks.push(l):s.tasks[c]=l,await this._writeConfiguration(n,"tasks.tasks",s.tasks,e._source.kind));else{let u={version:"2.0.0",tasks:[l]},p=["{",d(15560,null)].join(`
`)+JSON.stringify(u,null,"	").substr(1),h=this._configurationService.getValue();h.editor.insertSpaces&&(p=p.replace(/(\n)(\t+)/g,(g,f,v)=>f+" ".repeat(v.length*h.editor.tabSize))),await this._textFileService.create([{resource:n.toResource(".vscode/tasks.json"),value:p}])}o&&this._openEditorAtTask(this._getResourceForTask(e),l)}_writeConfiguration(e,t,o,n){let r;switch(n){case Vl.User:r=2;break;case Vl.WorkspaceFile:r=5;break;default:this._contextService.getWorkbenchState()===2?r=5:this._contextService.getWorkbenchState()===3&&(r=6)}if(r)return this._configurationService.updateValue(t,o,{resource:e.uri},r)}_getResourceForKind(e){switch(this._updateSetup(),e){case Vl.User:return Ve(ai(this._preferencesService.userSettingsResource),"tasks.json");case Vl.WorkspaceFile:if(this._workspace&&this._workspace.configuration)return this._workspace.configuration;default:return}}_getResourceForTask(e){if(Zd.is(e)){let t=this._getResourceForKind(e._source.kind);if(!t){let o=e.getWorkspaceFolder();o?t=o.toResource(e._source.config.file):t=this.workspaceFolders[0].uri}return t}else return e.getWorkspaceFolder().toResource(".vscode/tasks.json")}async openConfig(e){let t;return e?t=this._getResourceForTask(e):t=this._workspaceFolders&&this._workspaceFolders.length>0?this._workspaceFolders[0].toResource(".vscode/tasks.json"):void 0,this._openEditorAtTask(t,e?e._label:void 0,e?e._source.config.index:-1)}_createRunnableTask(e,t){let o=new Map,n=[],r=[];e.forEach((l,c)=>{let u=o.get(c);u||(u={id:new Map,label:new Map,identifier:new Map},o.set(c,u));for(let p of l)u.id.set(p._id,p),u.label.set(p._label,p),p.configurationProperties.identifier&&u.identifier.set(p.configurationProperties.identifier,p),t&&p.configurationProperties.group===t&&(p._source.kind===Vl.Workspace?n.push(p):r.push(p))});let s={resolve:async(l,c)=>{let u=o.get(typeof l=="string"?l:l.toString());if(u)return u.id.get(c)||u.label.get(c)||u.identifier.get(c)}};if(n.length>0)return n.length>1&&this._log(d(15477,null)),{task:n[0],resolver:s};if(r.length!==0){if(r.length===1)return{task:r[0],resolver:s};{let l=ht();return{task:new h_(l,{kind:Vl.InMemory,label:"inMemory"},l,"inMemory",{reevaluateOnRerun:!0},{identifier:l,dependsOn:r.map(u=>({uri:u.getWorkspaceFolder().uri,task:u._id})),name:l}),resolver:s}}}}_createResolver(e){let t;async function o(s,l,c){let u=await s._findWorkspaceTasks(h=>{let g=ev.is(h)||Zd.is(h)?h._source.config.workspaceFolder?.uri:void 0,f=typeof l=="string"?l:l.toString();if(g?.toString()!==f)return!1;if(We(c))return h._label===c||h.configurationProperties.identifier===c;{let v=h.getDefinition(!0),b=nU.createTaskIdentifier(c,console);return b&&v?b._key===v._key:!1}});if(u.length===0)return;let p=u[0];return ev.is(p)?s.tryResolveTask(p):p}async function n(s){return t===void 0&&(t=new Map,(e||await s._getGroupedTasks()).forEach((l,c)=>{let u=t.get(c);u||(u={label:new Map,identifier:new Map,taskIdentifier:new Map},t.set(c,u));for(let p of l){u.label.set(p._label,p),p.configurationProperties.identifier&&u.identifier.set(p.configurationProperties.identifier,p);let h=p.getDefinition(!0);h!==void 0&&u.taskIdentifier.set(h._key,p)}})),t}async function r(s,l,c){let p=(await n(s)).get(typeof l=="string"?l:l.toString());if(p){if(We(c))return p.label.get(c)||p.identifier.get(c);{let h=nU.createTaskIdentifier(c,console);return h!==void 0?p.taskIdentifier.get(h._key):void 0}}}return{resolve:async(s,l)=>{if(l)return t===void 0&&e===void 0?await o(this,s,l)??r(this,s,l):r(this,s,l)}}}async _saveBeforeRun(){let e;(s=>(s.Always="always",s.Never="never",s.Prompt="prompt"))(e||={});let t=this._configurationService.getValue("task.saveBeforeRun");if(t==="never")return!1;if(t==="prompt"&&this._editorService.editors.some(o=>o.isDirty())){let{confirmed:o}=await this._dialogService.confirm({message:d(15569,null),detail:d(15475,null),primaryButton:d(15484,null),cancelButton:d(15483,null)});if(!o)return!1}return await this._editorService.saveAll({reason:1}),!0}async _executeTask(e,t,o){let n=e;if(await this._saveBeforeRun()){await this._configurationService.reloadConfiguration(),await this._updateWorkspaceTasks();let s=e.getWorkspaceFolder(),l=e.configurationProperties.identifier,c=Zd.is(e)?e.customizes()?.type:sg.is(e)?e.type:void 0;n=(s&&l&&o===1?await this.getTask(s,l,!1,c):e)??e}await wS.onReady();let r=o===4?this._getTaskSystem().reconnect(n,t):this._getTaskSystem().run(n,t);return r?this._handleExecuteResult(r,o):{exitCode:0}}async _handleExecuteResult(e,t){if(t&&e.task._id&&this._taskRunSources.set(e.task._id,t),t===1&&await this._setRecentlyUsedTask(e.task),e.kind===2){let o=e.active;if(o&&o.same&&t===2||t===4)return this._logService.debug("Ignoring task that is already active",e.task),e.promise;if(o&&o.same)this._handleInstancePolicy(e.task,e.task.runOptions.instancePolicy);else throw new mL(wt.Warning,d(15563,null),1)}return this._setRecentlyUsedTask(e.task),e.promise}_handleInstancePolicy(e,t){switch(this._taskSystem?.isTaskVisible(e)||this._taskSystem?.revealTask(e),t){case"terminateNewest":this._restart(this._getTaskSystem().getLastInstance(e)??e);break;case"terminateOldest":this._restart(this._getTaskSystem().getFirstInstance(e)??e);break;case"silent":break;case"warn":this._notificationService.warn(d(15565,null));break;case"prompt":default:this._environmentService.isSessionsWindow&&this._logService.warn(`[tasks] InstancePolicy.prompt hit in sessions window for task '${e._label}'
${new Error().stack}`),this._showQuickPick(this._taskSystem.getActiveTasks().filter(o=>e._id===o._id),d(15516,null),{label:d(15522,null),task:void 0},!1,!0,void 0).then(o=>{let n=o?o.task:void 0;n!=null&&this._restart(n)})}}async _restart(e){if(!this._taskSystem)return;if(await this.getActiveTasks().then(o=>o.some(n=>n.getMapKey()===e.getMapKey()))&&!(await this._taskSystem.terminate(e)).success){this._notificationService.warn(d(15568,null,We(e)?e:e.configurationProperties.name));return}try{let o=await this._findUpdatedTask(e);if(o)await this.run(o);else{let n=await this.run(e);(!n||typeof n.exitCode=="number"&&n.exitCode!==0)&&this._notificationService.warn(d(15570,null,e.configurationProperties.name))}}catch{}}async _findUpdatedTask(e){let t=await this._updateWorkspaceTasks(0);for(let[o,n]of t)if(!(!n.set?.tasks?.length&&!n.configurations?.byIdentifier)){if(n.set?.tasks){for(let r of n.set.tasks)if(r._id===e._id)return r}if(n.configurations?.byIdentifier){for(let[r,s]of Object.entries(n.configurations.byIdentifier))if(s._id===e._id)return this.tryResolveTask(s)}}if(sg.is(e)){let o=await this.tasks({type:e.type});for(let n of o)if(n._id===e._id)return n}}async terminate(e){return await this._trust()?this._taskSystem?this._taskSystem.terminate(e):{success:!0,task:void 0}:{success:!0,task:void 0}}_terminateAll(){return this._taskSystem?this._taskSystem.terminateAll():Promise.resolve([])}_createTerminalTaskSystem(){return new uae(this._terminalService,this._terminalGroupService,this._outputService,this._paneCompositeService,this._viewsService,this._markerService,this._modelService,this._configurationResolverService,this._contextService,this._environmentService,CS.OutputChannelId,this._fileService,this._terminalProfileResolverService,this._pathService,this._viewDescriptorService,this._logService,this._notificationService,this._contextKeyService,this._instantiationService,e=>{if(e)return this._getTaskSystemInfo(e.uri.scheme);if(this._taskSystemInfos.size>0){let t=Array.from(this._taskSystemInfos.entries()),o=t.filter(n=>n[0]!==Q.file);return o.length>0?o[0][1][0]:t[0][1][0]}else return},async e=>{let o=(await this._getGroupedTasks()).all();for(let n of o)if(n.getMapKey()===e)return n})}_isTaskProviderEnabled(e){let t=xE.get(e);return!t||!t.when||this._contextKeyService.contextMatchesRules(t.when)}async _getGroupedTasks(e,t,o){await this._waitForAllSupportedExecutions;let n=e?.type,r=this._needsRecentTasksMigration();t||await this._activateTaskProviders(e?.type);let s=Object.create(null);xE.all().forEach(p=>s[p.taskType]=!0),s.shell=!0,s.process=!0;let l=await new Promise(p=>{let h=[],g=0,f=b=>{b&&h.push(b),--g===0&&p(h)},v=b=>{try{Yi(b)||(b&&We(b.message)?(this._log(`Error: ${b.message}
`),this._showOutput(void 0,void 0,b.message)):(this._log("Unknown error received while collecting tasks from providers."),this._showOutput()))}finally{--g===0&&p(h)}};if(this._isProvideTasksEnabled()&&this.schemaVersion===2&&this._providers.size>0){let b=!1;for(let[S,y]of this._providers){let w=this._providerTypes.get(S);if(n===void 0||n===w){if(w&&!this._isTaskProviderEnabled(w))continue;b=!0,g++,Uu(y.provideTasks(s).then(x=>{for(let E of x.tasks)if(E.type!==this._providerTypes.get(S)){this._log(d(15578,null,this._providerTypes.get(S),E.type)),E.type!=="shell"&&E.type!=="process"&&this._showOutput();break}return f(x)},v),5e3,()=>{f(void 0)})}}b||p(h)}else p(h)}),c=new S7,u=new S7;for(let p of l)for(let h of p.tasks){let g=h.getWorkspaceFolder();g&&u.add(g,h)}try{let p=[];return(!o||this._workspaceTrustManagementService.isWorkspaceTrusted())&&(p=Array.from(await this.getWorkspaceTasks())),await Promise.all(this._getCustomTaskPromises(p,e,c,u,t)),r&&await this._migrateRecentTasks(c.all()),c}catch{let p=new S7;for(let h of l)for(let g of h.tasks){let f=g.getWorkspaceFolder();f&&p.add(f,g)}return p}}_getCustomTaskPromises(e,t,o,n,r){return e.map(async([s,l])=>{let c=n.get(s);if(!l.set){c&&o.add(s,...c);return}if(this._contextService.getWorkbenchState()===1)o.add(s,...l.set.tasks);else{let u=l.configurations,p=l.set?this._getLegacyTaskConfigurations(l.set):void 0,h=[];if(u||p){let g=new Set;u&&Object.keys(u.byIdentifier).forEach(b=>g.add(b));for(let b of c)if(sg.is(b))if(u){let S=u.byIdentifier[b.defines._key];S?(g.delete(b.defines._key),o.add(s,_Ge(b,S))):o.add(s,b)}else if(p){let S=p[b.defines._key];S?(o.add(s,_Ge(b,S)),h.push(S)):o.add(s,b)}else o.add(s,b);if(h.length>0){let b=h.reduce((S,y)=>(S[y._id]=!0,S),Object.create(null));for(let S of l.set.tasks)b[S._id]||o.add(s,S)}else o.add(s,...l.set.tasks);let v=Array.from(g).map(async b=>{let S=u.byIdentifier[b];if(t?.type&&t.type!==S.configures.type)return;let y=!1;for(let[w,x]of this._providers){let E=this._providerTypes.get(w);if(S.type===E){if(E&&!this._isTaskProviderEnabled(E)){y=!0;continue}try{let M=await x.resolveTask(S);if(M&&M._id===S._id){o.add(s,_Ge(M,S));return}}catch{}}}y?this._log(d(15544,null,S.configures.type)):r||this._log(d(15520,null,S.configures.type,JSON.stringify(S._source.config.element,void 0,4)))});await Promise.all(v)}else o.add(s,...l.set.tasks),o.add(s,...c)}})}_getLegacyTaskConfigurations(e){let t;function o(){return t||(t=Object.create(null),t)}for(let n of e.tasks)if(Zd.is(n)){let r=n.command&&n.command.name;if(r==="gulp"||r==="grunt"||r==="jake"){let s=qZe.create({type:r,task:n.configurationProperties.name});o()[s._key]=n}}return t}async getWorkspaceTasks(e=1){return await this._trust()?(await Uu(this._waitForAllSupportedExecutions,2e3,()=>{this._logService.warn("Timed out waiting for all supported executions")}),await this._whenTaskSystemReady,this._workspaceTasksPromise?this._workspaceTasksPromise:this._updateWorkspaceTasks(e)):new Map}getTaskProblems(e){return this._taskSystem?.getTaskProblems(e)}_updateWorkspaceTasks(e=1){return this._workspaceTasksPromise=this._computeWorkspaceTasks(e),this._workspaceTasksPromise}async _getAFolder(){let e=this.workspaceFolders.length>0?this.workspaceFolders[0]:void 0;if(!e){let t=await this._pathService.userHome();e=new Ode({uri:t,name:Be(t),index:0})}return e}getTerminalsForTasks(e){return this._taskSystem?.getTerminalsForTasks(e)}async _computeWorkspaceTasks(e=1){let t=[];for(let c of this.workspaceFolders)t.push(this._computeWorkspaceFolderTasks(c,e));let o=await Promise.all(t),n=new Map;for(let c of o)c&&n.set(c.workspaceFolder.uri.toString(),c);let r=await this._getAFolder();if(this._contextService.getWorkbenchState()!==1){let c=await this._computeWorkspaceFileTasks(r,e);c&&this._workspace&&this._workspace.configuration&&n.set(this._workspace.configuration.toString(),c)}let s=await this._computeUserTasks(r,e);s&&n.set(oU,s);let l=Array.from(n.values()).some(c=>c.set?.tasks&&c.set.tasks.length>0||c.configurations?.byIdentifier&&Object.keys(c.configurations.byIdentifier).length>0);return this._tasksAvailableState.set(l),n}get _jsonTasksSupported(){return Qme.getValue(this._contextKeyService)===!0&&LLe.getValue(this._contextKeyService)===!0}async _computeWorkspaceFolderTasks(e,t=1){let o=this._executionEngine===1?await this._computeLegacyConfiguration(e):await this._computeConfiguration(e);if(!o||!o.config||o.hasErrors)return Promise.resolve({workspaceFolder:e,set:void 0,configurations:void 0,hasErrors:o?o.hasErrors:!1});await wS.onReady();let n=this._getTaskSystemInfo(e.uri.scheme),r=new IYt(this._outputChannel);this._register(r.onDidError(u=>this._showOutput(t,void 0,u)));let s=lGi(e,void 0,n?n.platform:xm,o.config,r,0,this._contextKeyService),l=!1;if(!s.validationStatus.isOK()&&s.validationStatus.state!==1&&(l=!0),r.status.isFatal())return r.fatal(d(15564,null)),{workspaceFolder:e,set:void 0,configurations:void 0,hasErrors:l};let c;if(s.configured&&s.configured.length>0){c={byIdentifier:Object.create(null)};for(let u of s.configured)c.byIdentifier[u.configures._key]=u}return!this._jsonTasksSupported&&s.custom.length>0&&this._logService.warn("Custom workspace tasks are not supported."),{workspaceFolder:e,set:{tasks:this._jsonTasksSupported?s.custom:[]},configurations:c,hasErrors:l}}_testParseExternalConfig(e,t){if(!e)return{config:void 0,hasParseErrors:!1};let o=e.$parseErrors;if(o){let n=!1;for(let r of o)if(/tasks\.json$/.test(r)){n=!0;break}if(n)return this._log(d(15567,null,t)),this._showOutput(void 0,void 0,d(15567,null,t)),{config:e,hasParseErrors:!0}}return{config:e,hasParseErrors:!1}}_log(e,t){(!t||this._configurationService.getValue("task.verboseLogging"))&&this._outputChannel.append(e+`
`)}async _computeWorkspaceFileTasks(e,t=1){if(this._executionEngine===1)return this._emptyWorkspaceTaskResults(e);let o=this._getConfiguration(e,Vl.WorkspaceFile),n=this._testParseExternalConfig(o.config,d(15562,null)),r={byIdentifier:Object.create(null)},s=[];return await this._computeTasksForSingleConfig(e,n.config,t,s,r.byIdentifier,1),(n.config?TGe.from(n.config):2)===1?(this._notificationService.warn(d(15573,null)),this._emptyWorkspaceTaskResults(e)):{workspaceFolder:e,set:{tasks:s},configurations:r,hasErrors:n.hasParseErrors}}async _computeUserTasks(e,t=1){if(this._executionEngine===1)return this._emptyWorkspaceTaskResults(e);let o=this._getConfiguration(e,Vl.User),n=this._testParseExternalConfig(o.config,d(15561,null)),r={byIdentifier:Object.create(null)},s=[];return await this._computeTasksForSingleConfig(e,n.config,t,s,r.byIdentifier,2),(n.config?TGe.from(n.config):2)===1?(this._notificationService.warn(d(15572,null)),this._emptyWorkspaceTaskResults(e)):{workspaceFolder:e,set:{tasks:s},configurations:r,hasErrors:n.hasParseErrors}}_emptyWorkspaceTaskResults(e){return{workspaceFolder:e,set:void 0,configurations:void 0,hasErrors:!1}}async _computeTasksForSingleConfig(e,t,o,n,r,s,l=!1){if(t){if(!e)return this._logService.trace("TaskService.computeTasksForSingleConfig: no workspace folder for worskspace",this._workspace?.id),!1}else return!1;let c=this._getTaskSystemInfo(e.uri.scheme),u=new IYt(this._outputChannel),p=lGi(e,this._workspace,c?c.platform:xm,t,u,s,this._contextKeyService,l),h=!1;if(!p.validationStatus.isOK()&&p.validationStatus.state!==1&&(this._showOutput(o),h=!0),u.status.isFatal())return u.fatal(d(15564,null)),h;if(p.configured&&p.configured.length>0)for(let g of p.configured)r[g.configures._key]=g;if(!this._jsonTasksSupported&&p.custom.length>0)this._logService.warn("Custom workspace tasks are not supported.");else for(let g of p.custom)n.push(g);return h}_computeConfiguration(e){let{config:t,hasParseErrors:o}=this._getConfiguration(e);return Promise.resolve({workspaceFolder:e,config:t,hasErrors:o})}_computeWorkspaceFolderSetup(){let e=[],t=[],o=2,n=2,r;if(this._contextService.getWorkbenchState()===2){let s=this._contextService.getWorkspace().folders[0];e.push(s),o=this._computeExecutionEngine(s),n=this._computeJsonSchemaVersion(s)}else if(this._contextService.getWorkbenchState()===3){r=this._contextService.getWorkspace();for(let s of this._contextService.getWorkspace().folders)n===this._computeJsonSchemaVersion(s)?e.push(s):(t.push(s),this._log(d(15515,null,s.uri.fsPath)))}return[e,t,o,n,r]}_computeExecutionEngine(e){let{config:t}=this._getConfiguration(e);return t?TGe.from(t):jme._default}_computeJsonSchemaVersion(e){let{config:t}=this._getConfiguration(e);return t?Ypt.from(t):2}_getConfiguration(e,t){let o;if(t!==Vl.User&&this._contextService.getWorkbenchState()===1)o=void 0;else{let r=this._configurationService.inspect("tasks",{resource:e.uri});switch(t){case Vl.User:{r.userValue!==r.workspaceFolderValue&&(o=io(r.userValue));break}case Vl.Workspace:o=io(r.workspaceFolderValue);break;case Vl.WorkspaceFile:{this._contextService.getWorkbenchState()===3&&r.workspaceFolderValue!==r.workspaceValue&&(o=io(r.workspaceValue));break}default:o=io(r.workspaceFolderValue)}}if(!o)return{config:void 0,hasParseErrors:!1};let n=o.$parseErrors;if(n){let r=!1;for(let s of n)if(/tasks\.json$/.test(s)){r=!0;break}if(r)return this._log(d(15566,null)),this._showOutput(void 0,void 0,d(15566,null)),{config:void 0,hasParseErrors:!0}}return{config:o,hasParseErrors:!1}}inTerminal(){return this._taskSystem?this._taskSystem instanceof uae:this._executionEngine===2}configureAction(){let e=this;return new class extends it{constructor(){super(CIe.ID,CIe.TEXT.value,void 0,!0,()=>(e._runConfigureTasks(),Promise.resolve(void 0)))}}}_handleError(e){let t=!0;if(e instanceof mL){let o=e,n=o.code===0||o.code===2||o.code===3,r=o.code===1;n||r?this._notificationService.prompt(o.severity,o.message,[{label:n?CIe.TEXT.value:d(15575,null),run:()=>{n?this._runConfigureTasks():this._runTerminateCommand()}}]):this._notificationService.notify({severity:o.severity,message:o.message})}else if(e instanceof Error){let o=e;this._notificationService.error(o.message),t=!1}else We(e)?this._notificationService.error(e):this._notificationService.error(d(15571,null));t&&this._showOutput(void 0,void 0,We(e)?e:void 0)}_showDetail(){return this._configurationService.getValue(dGi)}async _createTaskQuickPickEntries(e,t=!1,o=!1,n,r=!0){let s={};if(e==null||e.length===0)return[];let l=p=>{let h={label:p._label,description:this.getTaskDescription(p),task:p,detail:this._showDetail()?p.configurationProperties.detail:void 0};return s[p._id]?(s[p._id].length===1&&(s[p._id][0].label+=" (1)"),h.label=h.label+" ("+(s[p._id].length+1).toString()+")"):s[p._id]=[],s[p._id].push(h),h};function c(p,h,g){h.length&&p.push({type:"separator",label:g});for(let f of h){let v=l(f);v.buttons=[{iconClass:q.asClassName(vYt),tooltip:d(15472,null)}],n&&f===n.task?p.unshift(n):p.push(v)}}let u;if(t)if(u=[],e.length===1)u.push(l(e[0]));else{let p=await this.getSavedTasks("historical"),h=[],g=new Set,f=[],v=[],b=Object.create(null);e.forEach(y=>{let w=y.getCommonTaskId();w&&(b[w]=y)}),p.reverse().forEach(y=>{let w=y.getCommonTaskId();if(w){g.add(w);let x=b[w];x&&h.push(x)}});for(let y of e){let w=y.getCommonTaskId();(!w||!g.has(w))&&(y._source.kind===Vl.Workspace||y._source.kind===Vl.User?f.push(y):v.push(y))}let S=this.createSorter();r&&c(u,h,d(15478,null)),f=f.sort((y,w)=>S.compare(y,w)),c(u,f,d(15471,null)),v=v.sort((y,w)=>S.compare(y,w)),c(u,v,d(15476,null))}else{if(o){let p=this.createSorter();e=e.sort((h,g)=>p.compare(h,g))}u=e.map(p=>l(p))}return s={},u}async _showTwoLevelQuickPick(e,t,o,n){let r=this._instantiationService.createInstance(Db);try{return await r.show(e,t,o,n)}finally{r.dispose()}}async _showQuickPick(e,t,o,n=!1,r=!1,s,l,c){let u=await e,p=await Uu(this._createTaskQuickPickEntries(u,n,r,s),200,()=>{});if(p)return p.length===1&&this._configurationService.getValue(bYt)?p[0]:(p.length===0&&o?p.push(o):p.length>1&&l&&l.length>0&&(p.push({type:"separator",label:""}),p.push(l[0])),this._quickInputService.pick(p,{value:c,placeHolder:t,matchOnDescription:!0,onDidTriggerItemButton:h=>{let g=h.item.task;this._quickInputService.cancel(),sg.is(g)?this.customize(g,void 0,!0):Zd.is(g)&&this.openConfig(g)}}))}_needsRecentTasksMigration(){return this.getRecentlyUsedTasksV1().size>0&&this._getTasksFromStorage("historical").size===0}async _migrateRecentTasks(e){if(!this._needsRecentTasksMigration())return;let t=this.getRecentlyUsedTasksV1(),o=Object.create(null);e.forEach(r=>{let s=r.getKey();s&&(o[s]=r)});let n=[...t.keys()].reverse();for(let r in n){let s=o[r];s&&await this._setRecentlyUsedTask(s)}this._storageService.remove(CS.RecentlyUsedTasks_Key,1)}_showIgnoredFoldersMessage(){return this.ignoredWorkspaceFolders.length===0||!this.showIgnoreMessage||this._notificationService.prompt(wt.Info,d(15514,null,this.ignoredWorkspaceFolders.map(e=>e.name).join(", ")),[{label:d(15524,null),isSecondary:!0,run:()=>{this._storageService.store(CS.IgnoreTask010DonotShowAgain_key,!0,1,1),this._showIgnoreMessage=!1}}]),Promise.resolve(void 0)}async _trust(){let e=this._contextKeyService.getContext(Un());return y0t.getValue(this._contextKeyService)&&!ag?.evaluate(e)?!1:(await this._workspaceTrustManagementService.workspaceTrustInitialized,this._workspaceTrustManagementService.isWorkspaceTrusted()?!0:await this._workspaceTrustRequestService.requestWorkspaceTrust({message:d(15549,null)})===!0)}async _runTaskCommand(e){if(!this._tasksReconnected)return;if(!e)return this._doRunTaskCommand();let t=typeof e=="string"?void 0:e.type,o=typeof e=="string"?e:e.task,n=await this._getGroupedTasks({type:t}),r=this._getTaskIdentifier(e),s=n.all(),l=this._createResolver(n),c=this._contextService.getWorkspace().folders.map(p=>p.uri);if(this._contextService.getWorkbenchState()===3&&c.push(this._contextService.getWorkspace().configuration),c.push(oU),r)for(let p of c){let h=await l.resolve(p,r);if(h){this.run(h);return}}if(!(o?s.find(p=>p.configurationProperties.identifier===o):void 0))return this._doRunTaskCommand(s,t,o);for(let p of c){let h=await l.resolve(p,o);if(h){await this.run(h,{attachProblemMatcher:!0},1);return}}}_tasksAndGroupedTasks(e){if(!this._versionAndEngineCompatible(e))return{tasks:Promise.resolve([]),grouped:Promise.resolve(new S7)};let t=this._getGroupedTasks(e);return{tasks:t.then(n=>{if(!e||!e.type)return n.all();let r=[];return n.forEach(s=>{for(let l of s)if(sg.is(l)&&l.defines.type===e.type)r.push(l);else if(Zd.is(l))if(l.type===e.type)r.push(l);else{let c=l.customizes();c&&c.type===e.type&&r.push(l)}}),r}),grouped:t}}_doRunTaskCommand(e,t,o){let n=s=>{s!==void 0&&(s===null?this._runConfigureTasks():this.run(s,{attachProblemMatcher:!0},1).then(void 0,l=>{}))},r=d(15540,null);this._showIgnoredFoldersMessage().then(()=>{if(this._configurationService.getValue(EDn)){let s;e||(s=this._tasksAndGroupedTasks()),this._showQuickPick(e||s.tasks,r,{label:"$(plus) "+d(15521,null),task:null},!0,void 0,void 0,void 0,o).then(l=>n(l?l.task:void 0))}else this._showTwoLevelQuickPick(r,{label:"$(plus) "+d(15521,null),task:null},t,o).then(n)})}async rerun(e){let t=await this._taskSystem?.getTaskForTerminal(e);t?this._restart(t):this._reRunTaskCommand(!0)}_reRunTaskCommand(e){wS.onReady().then(()=>this._editorService.saveAll({reason:1}).then(()=>{let t=this._getTaskSystem().rerun();return t?this._handleExecuteResult(t):(!e&&!this._taskRunningState.get()&&this._doRunTaskCommand(),Promise.resolve(void 0))}))}_getDefaultTasks(e,t=!1){let o=[];for(let n of e.filter(r=>!!r.configurationProperties.group))(t&&typeof n.configurationProperties.group.isDefault=="string"||!t&&n.configurationProperties.group.isDefault===!0)&&o.push(n);return o}_runTaskGroupCommand(e,t,o,n){if(this.schemaVersion===1){n();return}let r={location:10,title:t.fetching},s=(async()=>{async function l(v,b,S){S.run(v,b,1).then(void 0,y=>{})}let c=v=>{this._showIgnoredFoldersMessage().then(()=>{this._showQuickPick(v,t.select,{label:t.notFoundConfigure,task:null},!0).then(b=>{let S=b?b.task:void 0;if(S!==void 0){if(S===null){o.apply(this);return}l(S,{attachProblemMatcher:!0},this)}})})},u=[],{globGroupTasks:p,globTasksDetected:h}=await this._getGlobTasks(e._id);u=[...p],!h&&u.length===0&&(u=await this._findWorkspaceTasksInGroup(e,!0));let g=v=>this._getTasksForGroup(e).then(b=>{if(b.length>0){let S=this._getDefaultTasks(b,v);if(S.length===1){l(S[0],void 0,this);return}else S.length>0&&(b=S)}c(b)}),f=v=>{ev.is(v)?this.tryResolveTask(v).then(b=>{l(b,void 0,this)}):l(v,void 0,this)};return u.length===1?f(u[0]):h&&u.length>1?g(!0):(u.length||(u=await this._findWorkspaceTasksInGroup(e,!0)),u.length===1?f(u[0]):g(!1))})();this._progressService.withProgress(r,()=>s)}async _getGlobTasks(e){let t=!1,o=po.getOriginalUri(this._editorService.activeEditor);if(o){let n=this._contextService.getWorkspaceFolder(o);if(n){let r=this._getConfiguration(n)?.config?.tasks;if(r&&(t=r.filter(s=>s.group&&typeof s.group!="string"&&typeof s.group.isDefault=="string").length>0,t)){let s=n?.uri?lu(n.uri,o)??o.path:o.path;return{globGroupTasks:await this._findWorkspaceTasks(c=>{let u=c.configurationProperties.group;return u&&typeof u!="string"&&typeof u.isDefault=="string"?u._id===e&&qd(u.isDefault,s,{ignoreCase:!0}):(t=!1,!1)}),globTasksDetected:t}}}}return{globGroupTasks:[],globTasksDetected:t}}_runBuildCommand(){if(this._tasksReconnected)return this._runTaskGroupCommand(Lh.Build,{fetching:d(15506,null),select:d(15536,null),notFoundConfigure:d(15517,null)},this._runConfigureDefaultBuildTask,this._build)}_runTestCommand(){return this._runTaskGroupCommand(Lh.Test,{fetching:d(15507,null),select:d(15543,null),notFoundConfigure:d(15532,null)},this._runConfigureDefaultTestTask,this._runTest)}_runTerminateCommand(e){if(e==="terminateAll"){this._terminateAll();return}let t=o=>{this._showQuickPick(o||this.getActiveTasks(),d(15553,null),{label:d(15526,null),task:void 0},!1,!0,void 0,[{label:d(15555,null),id:"terminateAll",task:void 0}]).then(n=>{n&&n.id==="terminateAll"&&this._terminateAll();let r=n?n.task:void 0;r!=null&&this.terminate(r)})};if(this.inTerminal()){let o=this._getTaskIdentifier(e),n;o!==void 0?(n=this.getActiveTasks(),n.then(r=>{for(let s of r)if(s.matches(o)){this.terminate(s);return}t(n)})):t()}else this._isActive().then(o=>{o&&this._terminateAll().then(n=>{let r=n[0];r.success||(r.code&&r.code===3?this._notificationService.error(d(15576,null)):this._notificationService.error(d(15574,null)))})})}async _runRestartTaskCommand(e){let t=await this.getActiveTasks();if(t.length===1){this._restart(t[0]);return}if(this.inTerminal()){let o=this._getTaskIdentifier(e);if(o!==void 0){for(let r of t)if(r.matches(o)){this._restart(r);return}}let n=await this._showQuickPick(t,d(15552,null),{label:d(15528,null),task:null},!1,!0);n&&n.task&&this._restart(n.task)}else t.length>0&&this._restart(t[0])}async _runRerunAllRunningTasksCommand(){let e=await this.getActiveTasks();if(e.length===0){this._notificationService.info(d(15523,null));return}let t=e.map(o=>this._restart(o));await Promise.allSettled(t)}_getTaskIdentifier(e){let t;return We(e)?t=e:e&&We(e.type)&&(t=nU.createTaskIdentifier(e,console)),t}_configHasTasks(e){return!!e&&!!e.tasks&&e.tasks.length>0}_openTaskFile(e,t){let o=!1;this._fileService.stat(e).then(n=>n,()=>{}).then(async n=>{let r=!!n,s=this._configurationService.inspect("tasks",{resource:e}),l,c;switch(t){case Vl.User:l=this._configHasTasks(s.userValue),c=2;break;case Vl.WorkspaceFile:l=this._configHasTasks(s.workspaceValue),c=5;break;default:l=this._configHasTasks(s.workspaceFolderValue),c=6}let u;if(!l){let p=await this._quickInputService.pick(aWo(),{placeHolder:d(15554,null)});if(!p)return Promise.resolve(void 0);u=p.content;let h=this._configurationService.getValue();h.editor.insertSpaces&&(u=u.replace(/(\n)(\t+)/g,(g,f,v)=>f+" ".repeat(v.length*h.editor.tabSize))),o=!0}if(!r&&u)return this._textFileService.create([{resource:e,value:u}]).then(p=>p[0].resource);if(r&&(l||u)){let p=n?.resource;return u&&p&&this._configurationService.updateValue("tasks",is(u),{resource:p},c),p}}).then(n=>{n&&this._editorService.openEditor({resource:n,options:{pinned:o}})})}_isTaskEntry(e){let t=e;return t&&!!t.task}_isSettingEntry(e){let t=e;return t&&!!t.settingType}_configureTask(e){sg.is(e)?this.customize(e,void 0,!0):Zd.is(e)?this.openConfig(e):ev.is(e)}_handleSelection(e){if(e)if(this._isTaskEntry(e))this._configureTask(e.task);else if(this._isSettingEntry(e))this._instantiationService.createInstance(Db).handleSettingOption(e.settingType);else if(e.folder&&this._contextService.getWorkbenchState()!==1)this._openTaskFile(e.folder.toResource(".vscode/tasks.json"),Vl.Workspace);else{let t=this._getResourceForKind(Vl.User);t&&this._openTaskFile(t,Vl.User)}}getTaskDescription(e){let t;if(e._source.kind===Vl.User)t=d(15494,null);else if(e._source.kind===Vl.WorkspaceFile)t=e.getWorkspaceFileName();else if(this.needsFolderQualification()){let o=e.getWorkspaceFolder();o&&(t=o.name)}return t}async _runConfigureTasks(){if(!await this._trust())return;let e;this.schemaVersion===2?e=this._getGroupedTasks():e=Promise.resolve(new S7);let t=this._contextService.getWorkspace().folders.map(p=>this._fileService.stat(p.toResource(".vscode/tasks.json")).then(h=>h,()=>{})),o=d(15503,null),n=d(15535,null),r=new qe,s=r.token,l=Promise.all(t).then(p=>e.then(h=>{let g=[],f=0,v=h.all();if(v.length>0){v=v.sort((S,y)=>S._label.localeCompare(y._label));for(let S of v){let y={label:Db.getTaskLabelWithIcon(S),task:S,description:this.getTaskDescription(S),detail:this._showDetail()?S.configurationProperties.detail:void 0};Db.applyColorStyles(S,y,this._themeService),g.push(y),sg.is(S)||f++}}let b=f===0;if(b||h.get(oU).length===f){let S=p[0]!==void 0?n:o;g.length&&g.push({type:"separator"}),g.push({label:S,folder:this._contextService.getWorkspace().folders[0]})}return g.length===1&&!b&&r.cancel(),g}));if(!await Promise.race([new Promise(p=>{l.then(()=>p(!1))}),new Promise(p=>{let h=setTimeout(()=>{clearTimeout(h),p(!0)},200)})])&&(await l).length===1&&this._configurationService.getValue(bYt)){let p=(await l)[0];if(p.task){this._handleSelection(p);return}}let u=l.then(p=>(p.push(...Db.allSettingEntries(this._configurationService)),p));this._quickInputService.pick(u,{placeHolder:d(15542,null)},s).then(async p=>{if(s.isCancellationRequested){let h=(await l)[0];h.task&&(p=h)}this._handleSelection(p)})}_runConfigureDefaultBuildTask(){this.schemaVersion===2?this.tasks().then((e=>{if(e.length===0){this._runConfigureTasks();return}let t=[],o,n;this._showIgnoredFoldersMessage().then(async()=>{let{globGroupTasks:r}=await this._getGlobTasks(Lh.Build._id),s=r;s?.length||(s=this._getDefaultTasks(e,!1));let l;if(s.length===1){let p=s[0].configurationProperties.group;p&&(typeof p=="string"&&Lh.Build._id,l=s[0])}for(let p of e)if(p===l){let h=d(15504,null,Db.getTaskLabelWithIcon(p,p.getQualifiedLabel()));o=p,n={label:h,task:p,description:this.getTaskDescription(p),detail:this._showDetail()?p.configurationProperties.detail:void 0},Db.applyColorStyles(p,n,this._themeService)}else{let h={label:Db.getTaskLabelWithIcon(p),task:p,description:this.getTaskDescription(p),detail:this._showDetail()?p.configurationProperties.detail:void 0};Db.applyColorStyles(p,h,this._themeService),t.push(h)}n&&t.unshift(n);let u=new qe().token;this._quickInputService.pick(t,{placeHolder:d(15542,null)},u).then(async p=>{if(u.isCancellationRequested){let g=(await t)[0];g.task&&(p=g)}let h=p&&Object.hasOwn(p,"task")?p.task:void 0;h!=null&&(h===o&&Zd.is(h)&&this.openConfig(h),h_.is(h)||this.customize(h,{group:{kind:"build",isDefault:!0}},!0).then(()=>{o&&h!==o&&!h_.is(o)&&this.customize(o,{group:"build"},!1)}))}),this._quickInputService.pick(t,{placeHolder:d(15538,null)}).then(p=>{let h=p&&Object.hasOwn(p,"task")?p.task:void 0;h!=null&&(h===o&&Zd.is(h)&&this.openConfig(h),h_.is(h)||this.customize(h,{group:{kind:"build",isDefault:!0}},!0).then(()=>{o&&h!==o&&!h_.is(o)&&this.customize(o,{group:"build"},!1)}))})})})):this._runConfigureTasks()}_runConfigureDefaultTestTask(){this.schemaVersion===2?this.tasks().then((e=>{if(e.length===0){this._runConfigureTasks();return}let t,o;for(let n of e){let r=Lh.from(n.configurationProperties.group);if(r&&r.isDefault&&r._id===Lh.Test._id){t=n;break}}t&&(o={label:d(15505,null,t.getQualifiedLabel()),task:t,detail:this._showDetail()?t.configurationProperties.detail:void 0}),this._showIgnoredFoldersMessage().then(()=>{this._showQuickPick(e,d(15539,null),void 0,!0,!1,o).then(n=>{let r=n&&Object.hasOwn(n,"task")?n.task:void 0;r&&(r===t&&Zd.is(r)&&this.openConfig(r),h_.is(r)||this.customize(r,{group:{kind:"test",isDefault:!0}},!0).then(()=>{t&&r!==t&&!h_.is(t)&&this.customize(t,{group:"test"},!1)}))})})})):this._runConfigureTasks()}async runShowTasks(){let e=this.getActiveTasks(),t=await e,o;t.length===1?this._taskSystem.revealTask(t[0]):t.length&&t.every(n=>h_.is(n)?!1:(o||(o=n.command.presentation?.group),n.command.presentation?.group&&n.command.presentation.group===o))?this._taskSystem.revealTask(t[0]):this._showQuickPick(e,d(15541,null),{label:d(15525,null),task:null},!1,!0).then(n=>{let r=n?n.task:void 0;r!=null&&this._taskSystem.revealTask(r)})}async _createTasksDotOld(e){let t=e.toResource(".vscode/tasks.json");if(await this._fileService.exists(t)){let o=t.with({path:`${t.path}.old`});return await this._fileService.copy(t,o,!0),[o,t]}}_upgradeTask(e,t,o){if(!Zd.is(e))return;let n={label:e._label},r=new Set(["gulp","jake","grunt"]);We(e.command.name)&&r.has(e.command.name)?(n.type=e.command.name,n.task=e.command.args[0]):(e.command.runtime===1&&(n.type=g8.toString(1)),e.command.name&&!t&&!o.windows?.command&&!o.osx?.command&&!o.linux?.command?n.command=e.command.name:t&&(n.command=e._source.config.element.command),e.command.args&&(!Array.isArray(e.command.args)||e.command.args.length>0)&&(!o.windows?.args&&!o.osx?.args&&!o.linux?.args?n.args=e.command.args:n.args=e._source.config.element.args)),e.configurationProperties.presentation&&(n.presentation=e.configurationProperties.presentation),e.configurationProperties.isBackground&&(n.isBackground=e.configurationProperties.isBackground),e.configurationProperties.problemMatchers&&(n.problemMatcher=e._source.config.element.problemMatcher),e.configurationProperties.group&&(n.group=e.configurationProperties.group),e._source.config.element=n;let s=new Zd(e._id,e._source,e._label,e.type,e.command,e.hasDefinedMatchers,e.runOptions,e.configurationProperties),l=this._createCustomizableTask(s);if(l)return l}async _upgrade(){if(this.schemaVersion===2)return;if(!this._workspaceTrustManagementService.isWorkspaceTrusted()){this._register(U.once(this._workspaceTrustManagementService.onDidChangeTrust)(o=>{o&&this._upgrade()}));return}let e=await this._getGroupedTasks(),t=[];for(let o of this.workspaceFolders){let n=await this._createTasksDotOld(o);if(n&&t.push(n),!n)continue;let r=[],s=!!this._configurationService.getValue("tasks.suppressTaskName",{resource:o.uri}),l={windows:this._configurationService.getValue("tasks.windows",{resource:o.uri}),osx:this._configurationService.getValue("tasks.osx",{resource:o.uri}),linux:this._configurationService.getValue("tasks.linux",{resource:o.uri})};e.get(o).forEach(c=>{let u=this._upgradeTask(c,s,l);u&&r.push(u)}),this._taskSystem=void 0,this._workspaceTasksPromise=void 0,await this._writeConfiguration(o,"tasks.tasks",r),await this._writeConfiguration(o,"tasks.version","2.0.0"),this._configurationService.getValue("tasks.showOutput",{resource:o.uri})&&await this._configurationService.updateValue("tasks.showOutput",void 0,{resource:o.uri}),this._configurationService.getValue("tasks.isShellCommand",{resource:o.uri})&&await this._configurationService.updateValue("tasks.isShellCommand",void 0,{resource:o.uri}),this._configurationService.getValue("tasks.suppressTaskName",{resource:o.uri})&&await this._configurationService.updateValue("tasks.suppressTaskName",void 0,{resource:o.uri})}this._updateSetup(),this._notificationService.prompt(wt.Warning,t.length===1?d(15556,null):d(15557,null),[{label:t.length===1?d(15533,null):d(15534,null),run:async()=>{for(let o of t)await this._editorService.openEditor({original:{resource:o[0]},modified:{resource:o[1]}})}}])}};CS=I([m(0,B),m(1,ha),m(2,Tl),m(3,Es),m(4,Gt),m(5,fe),m(6,ie),m(7,ge),m(8,Ae),m(9,_e),m(10,Uo),m(11,_t),m(12,lt),m(13,$e),m(14,Xp),m(15,an),m(16,Cc),m(17,de),m(18,Go),m(19,Je),m(20,ct),m(21,Ne),m(22,X),m(23,Mt),m(24,ig),m(25,Pn),m(26,Bt),m(27,Qo),m(28,ji),m(29,lp),m(30,Or),m(31,re),m(32,Pe),m(33,to),m(34,bo),m(35,F),m(36,si),m(37,gr),m(38,ti)],CS);var I7=class extends cg{constructor(e,t,o,n,r,s,l,c){super(I7.PREFIX,{noResultsPick:{label:d(15653,null)}});this._taskService=t;this._configurationService=o;this._quickInputService=n;this._notificationService=r;this._dialogService=s;this._themeService=l;this._storageService=c}static{this.PREFIX="task "}async _getPicks(e,t,o){if(o.isCancellationRequested)return[];let n=new Db(this._taskService,this._configurationService,this._quickInputService,this._notificationService,this._themeService,this._dialogService,this._storageService),r=await n.getTopLevelEntries(),s=[];for(let l of r.entries){let c=xh(e,l.label);if(!c)continue;l.type==="separator"&&s.push(l);let u=l.task,p=l;p.highlights={label:c},p.trigger=h=>{if(h===1&&p.buttons?.length===2){let g=u&&!We(u)?u.getKey():void 0;return g&&this._taskService.removeRecentlyUsedTask(g),2}else return sg.is(u)?this._taskService.customize(u,void 0,!0):Zd.is(u)&&this._taskService.openConfig(u),1},p.accept=async()=>{if(We(u)){let h=await n.show(d(15654,null),void 0,u);h&&this._taskService.run(h,{attachProblemMatcher:!0})}else this._taskService.run(await this._toTask(u),{attachProblemMatcher:!0})},s.push(p)}return s}async _toTask(e){return ev.is(e)?this._taskService.tryResolveTask(e):e}};I7=I([m(0,lt),m(1,yf),m(2,B),m(3,$e),m(4,Ne),m(5,ct),m(6,Pe),m(7,de)],I7);var gGi=oe.as(Zi.Workbench);gGi.registerWorkbenchContribution(yGe,4);W(wGe);be.appendMenuItem(R.CommandPalette,{command:{id:wGe.ID,title:wGe.LABEL,category:Yx},when:ag});var emt=class extends k{constructor(e,t,o){super();this._taskService=e;this._statusbarService=t;this._progressService=o;this._activeTasksCount=0;this._registerListeners()}_registerListeners(){let e,t;this._register(this._taskService.onDidStateChange(o=>{if(o.kind==="changed"&&this._updateRunningTasksStatus(),!this._ignoreEventForUpdateRunningTasksCount(o))switch(o.kind){case"active":this._activeTasksCount++,this._activeTasksCount===1&&(e||({promise:e,resolve:t}=Ey()));break;case"inactive":this._activeTasksCount>0&&(this._activeTasksCount--,this._activeTasksCount===0&&e&&t&&t());break;case"terminated":this._activeTasksCount!==0&&(this._activeTasksCount=0,e&&t&&t());break}e&&o.kind==="active"&&this._activeTasksCount===1&&this._progressService.withProgress({location:10,command:"workbench.action.tasks.showTasks"},n=>(n.report({message:d(15588,null)}),e)).then(()=>{e=void 0})}))}async _updateRunningTasksStatus(){let e=await this._taskService.getActiveTasks();if(e.length===0)this._runningTasksStatusItem&&(this._runningTasksStatusItem.dispose(),this._runningTasksStatusItem=void 0);else{let t={name:d(15606,null),text:`$(tools) ${e.length}`,ariaLabel:d(15598,null,e.length),tooltip:d(15602,null),command:"workbench.action.tasks.showTasks"};this._runningTasksStatusItem?this._runningTasksStatusItem.update(t):this._runningTasksStatusItem=this._statusbarService.addEntry(t,"status.runningTasks",0,{location:{id:"status.problems",priority:50},alignment:1})}}_ignoreEventForUpdateRunningTasksCount(e){return!this._taskService.inTerminal()||e.kind==="changed"?!1:(We(e.group)?e.group:e.group?._id)!==Lh.Build._id?!0:e.__task.configurationProperties.problemMatchers===void 0||e.__task.configurationProperties.problemMatchers.length===0}};emt=I([m(0,yf),m(1,Fr),m(2,Go)],emt);gGi.registerWorkbenchContribution(emt,3);be.appendMenuItem(R.MenubarTerminalMenu,{group:"3_run",command:{id:"workbench.action.tasks.runTask",title:d(15596,null)},order:1,when:ag});be.appendMenuItem(R.MenubarTerminalMenu,{group:"3_run",command:{id:"workbench.action.tasks.build",title:d(15591,null)},order:2,when:ag});be.appendMenuItem(R.MenubarTerminalMenu,{group:"5_manage",command:{precondition:TLe,id:"workbench.action.tasks.showTasks",title:d(15595,null)},order:1,when:ag});be.appendMenuItem(R.MenubarTerminalMenu,{group:"5_manage",command:{precondition:TLe,id:"workbench.action.tasks.restartTask",title:d(15594,null)},order:2,when:ag});be.appendMenuItem(R.MenubarTerminalMenu,{group:"5_manage",command:{precondition:TLe,id:"workbench.action.tasks.terminate",title:d(15597,null)},order:3,when:ag});be.appendMenuItem(R.MenubarTerminalMenu,{group:"7_configure",command:{id:"workbench.action.tasks.configureTaskRunner",title:d(15593,null)},order:1,when:ag});be.appendMenuItem(R.MenubarTerminalMenu,{group:"7_configure",command:{id:"workbench.action.tasks.configureDefaultBuildTask",title:d(15592,null)},order:2,when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.openWorkspaceFileTasks",title:P(15635,"Open Workspace Tasks"),category:Yx},when:C.and(el.isEqualTo("workspace"),ag)});be.appendMenuItem(R.CommandPalette,{command:{id:CIe.ID,title:CIe.TEXT,category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.showLog",title:P(15604,"Show Task Log"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.runTask",title:P(15603,"Run Task"),category:Yx}});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.reRunTask",title:P(15600,"Rerun Last Task"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.restartTask",title:P(15601,"Restart Running Task"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:S0t,title:P(15599,"Rerun All Running Tasks"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.showTasks",title:P(15605,"Show Running Tasks"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.terminate",title:P(15632,"Terminate Task"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.build",title:P(15587,"Run Build Task"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.test",title:P(15633,"Run Test Task"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.configureDefaultBuildTask",title:P(15589,"Configure Default Build Task"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.configureDefaultTestTask",title:P(15590,"Configure Default Test Task"),category:Yx},when:ag});be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.action.tasks.openUserTasks",title:P(15634,"Open User Tasks"),category:Yx},when:ag});var mGi=class extends k{constructor(){super(),this.registerActions()}registerActions(){let i="workbench.action.tasks.openUserTasks",e=d(15628,null);this._register(be.appendMenuItem(R.GlobalActivity,{command:{id:i,title:e},when:ag,group:"2_configuration",order:6})),this._register(be.appendMenuItem(R.MenubarPreferencesMenu,{command:{id:i,title:e},when:ag,group:"2_configuration",order:6}))}};gGi.registerWorkbenchContribution(mGi,3);xt.registerKeybindingRule({id:"workbench.action.tasks.build",weight:200,when:I0t,primary:3104});var _Dn=oe.as(bb.OutputChannels);_Dn.registerChannel({id:CS.OutputChannelId,label:CS.OutputChannelLabel,log:!1});var DDn=oe.as(Bu.Quickaccess),RDn="inTasksPicker";DDn.registerQuickAccessProvider({ctor:I7,prefix:I7.PREFIX,contextKey:RDn,placeholder:d(15631,null),helpEntries:[{description:d(15630,null),commandCenterOrder:60}]});var fGi={id:She,description:"Task definition file",type:"object",allowTrailingCommas:!0,allowComments:!0,default:{version:"2.0.0",tasks:[{label:"My Task",command:"echo hello",type:"shell",args:[],problemMatcher:["$tsc"],presentation:{reveal:"always"},group:"build"}]}};fGi.definitions={...q2i.definitions,...eGi.definitions};fGi.oneOf=[...eGi.oneOf||[],...q2i.oneOf||[]];var hGi=oe.as(Ta.JSONContribution);hGi.registerSchema(She,fGi);var yYt=class extends k{static{this.ID="taskRegistryContribution"}constructor(){super(),this._register(wS.onMatcherChanged(()=>{Z2i(),hGi.notifySchemaChanged(She)})),this._register(xE.onDefinitionsChanged(()=>{Y2i(),hGi.notifySchemaChanged(She)}))}};bt(yYt.ID,yYt,vt.AfterRestored);var LDn=oe.as($t.Configuration);LDn.registerConfiguration({id:"task",order:100,title:d(15629,null),type:"object",properties:{"task.problemMatchers.neverPrompt":{markdownDescription:d(15612,null),oneOf:[{type:"boolean",markdownDescription:d(15614,null)},{type:"object",patternProperties:{".*":{type:"boolean"}},markdownDescription:d(15613,null),default:{shell:!0}}],default:!1},"task.autoDetect":{markdownDescription:d(15610,null),type:"string",enum:["on","off"],default:"on"},"task.slowProviderWarning":{markdownDescription:d(15624,null),oneOf:[{type:"boolean",markdownDescription:d(15626,null)},{type:"array",items:{type:"string",markdownDescription:d(15625,null)}}],default:!0},"task.quickOpen.history":{markdownDescription:d(15616,null),type:"number",default:30,minimum:0,maximum:30},"task.quickOpen.detail":{markdownDescription:d(15615,null),type:"boolean",default:!0},"task.quickOpen.skip":{type:"boolean",description:d(15618,null),default:!1},"task.quickOpen.showAll":{type:"boolean",description:d(15617,null),default:!1},"task.allowAutomaticTasks":{type:"string",enum:["on","off"],enumDescriptions:[d(15609,null),d(15608,null)],description:d(15607,null),default:"off",scope:1,restricted:!0},"task.reconnection":{type:"boolean",description:d(15619,null),default:!0},"task.saveBeforeRun":{markdownDescription:d(15620,null),type:"string",enum:["always","never","prompt"],enumDescriptions:[d(15621,null),d(15622,null),d(15623,null)],default:"always"},"task.notifyWindowOnTaskCompletion":{type:"integer",markdownDescription:d(15611,null),default:6e4,minimum:-1,agentsWindow:{default:-1}},"task.verboseLogging":{type:"boolean",description:d(15627,null),default:!1}}});W(class extends z{constructor(){super({id:b0t,icon:v0t,title:P(15636,"Rerun Task"),precondition:$Ze,menu:[{id:R.TerminalInstanceContext,when:$Ze}],keybinding:{when:pt.focus,primary:3120,mac:{primary:1328},weight:200}})}async run(a,i){let e=a.get(an),t=a.get(yf),o=i??e.activeInstance;o&&await t.rerun(o.instanceId)}});var PDn=30*1e3;function bGi(a){switch(a){case 1:return"Management";case 2:return"ExtensionHost";case 3:return"Tunnel"}}function SWo(a){let i=new qe;return setTimeout(()=>i.cancel(),a),i.token}function ADn(a,i){if(a.isCancellationRequested||i.isCancellationRequested)return Ie.Cancelled;let e=new qe;return a.onCancellationRequested(()=>e.cancel()),i.onCancellationRequested(()=>e.cancel()),e.token}var LGe=class{get didTimeout(){return this._state==="timedout"}constructor(i){this._state="pending",this._disposables=new O,{promise:this.promise,resolve:this._resolvePromise,reject:this._rejectPromise}=Ey(),i.isCancellationRequested?this._timeout():this._disposables.add(i.onCancellationRequested(()=>this._timeout()))}registerDisposable(i){this._state==="pending"?this._disposables.add(i):i.dispose()}_timeout(){this._state==="pending"&&(this._disposables.dispose(),this._state="timedout",this._rejectPromise(this._createTimeoutError()))}_createTimeoutError(){let i=new Error("Time limit reached");return i.code="ETIMEDOUT",i.syscall="connect",i}resolve(i){this._state==="pending"&&(this._disposables.dispose(),this._state="resolved",this._resolvePromise(i))}reject(i){this._state==="pending"&&(this._disposables.dispose(),this._state="rejected",this._rejectPromise(i))}};function NDn(a,i){let e=new LGe(i);return e.registerDisposable(a.onControlMessage(t=>{let o=JSON.parse(t.toString()),n=TWo(o);n?e.reject(n):e.resolve(o)})),e.promise}function ODn(a,i,e,t,o,n,r,s){let l=new LGe(s),c=On.create(!1);return a.info(`Creating a socket (${r})...`),Wo(`code/willCreateSocket/${n}`),i.connect(e,t,o,r).then(u=>{l.didTimeout?(Wo(`code/didCreateSocketError/${n}`),a.info(`Creating a socket (${r}) finished after ${c.elapsed()} ms, but this is too late and has timed out already.`),u?.dispose()):(Wo(`code/didCreateSocketOK/${n}`),a.info(`Creating a socket (${r}) was successful after ${c.elapsed()} ms.`),l.resolve(u))},u=>{Wo(`code/didCreateSocketError/${n}`),a.info(`Creating a socket (${r}) returned an error after ${c.elapsed()} ms.`),a.error(u),l.reject(u)}),l.promise}function vGi(a,i){let e=new LGe(i);return a.then(t=>{e.didTimeout||e.resolve(t)},t=>{e.didTimeout||e.reject(t)}),e.promise}async function FDn(a,i,e,t){let o=_Wo(a,i);a.logService.trace(`${o} 1/6. invoking socketFactory.connect().`);let n;try{n=await ODn(a.logService,a.remoteSocketFactoryService,a.connectTo,xL.getServerRootPath(),`reconnectionToken=${a.reconnectionToken}&reconnection=${a.reconnectionProtocol?"true":"false"}`,bGi(i),`renderer-${bGi(i)}-${a.reconnectionToken}`,t)}catch(u){throw a.logService.error(`${o} socketFactory.connect() failed or timed out. Error:`),a.logService.error(u),u}a.logService.trace(`${o} 2/6. socketFactory.connect() was successful.`);let r,s;a.reconnectionProtocol?(a.reconnectionProtocol.beginAcceptReconnection(n,null),r=a.reconnectionProtocol,s=!1):(r=new COt({socket:n}),s=!0),a.logService.trace(`${o} 3/6. sending AuthRequest control message.`);let l=await vGi(a.signService.createNewMessage(ht()),t),c={type:"auth",auth:a.connectionToken||"00000000000000000000",data:l.data};r.sendControl(Ke.fromString(JSON.stringify(c)));try{let u=await NDn(r,ADn(t,SWo(1e4)));if(u.type!=="sign"||typeof u.data!="string"){let f=new Error("Unexpected handshake message");throw f.code="VSCODE_CONNECTION_ERROR",f}if(a.logService.trace(`${o} 4/6. received SignRequest control message.`),!await vGi(a.signService.validate(l,u.signedData),t)){let f=new Error("Refused to connect to unsupported server");throw f.code="VSCODE_CONNECTION_ERROR",f}let h=await vGi(a.signService.sign(u.data),t),g={type:"connectionType",commit:a.commit,signedData:h,desiredConnectionType:i};return e&&(g.args=e),a.logService.trace(`${o} 5/6. sending ConnectionTypeRequest control message.`),r.sendControl(Ke.fromString(JSON.stringify(g))),{protocol:r,ownsProtocol:s}}catch(u){throw u&&u.code==="ETIMEDOUT"&&(a.logService.error(`${o} the handshake timed out. Error:`),a.logService.error(u)),u&&u.code==="VSCODE_CONNECTION_ERROR"&&(a.logService.error(`${o} received error control message when negotiating connection. Error:`),a.logService.error(u)),s&&kGi(r),u}}async function IWo(a,i,e,t){let o=Date.now(),n=_Wo(a,i),{protocol:r,ownsProtocol:s}=await FDn(a,i,e,t),l=new LGe(t);return l.registerDisposable(r.onControlMessage(c=>{let u=JSON.parse(c.toString()),p=TWo(u);p?(a.logService.error(`${n} received error control message when negotiating connection. Error:`),a.logService.error(p),s&&kGi(r),l.reject(p)):(a.reconnectionProtocol?.endAcceptReconnection(),a.logService.trace(`${n} 6/6. handshake finished, connection is up and running after ${UDn(o)}!`),l.resolve({protocol:r,firstMessage:u}))})),l.promise}async function yWo(a,i){let{protocol:e}=await IWo(a,1,void 0,i);return{protocol:e}}async function wWo(a,i,e){let{protocol:t,firstMessage:o}=await IWo(a,2,i,e),n=o&&o.debugPort;return{protocol:t,debugPort:n}}async function CWo(a,i,e){let{connectTo:t,connectionToken:o}=await a.addressProvider.getAddress();return{commit:a.commit,quality:a.quality,connectTo:t,connectionToken:o,reconnectionToken:i,reconnectionProtocol:e,remoteSocketFactoryService:a.remoteSocketFactoryService,signService:a.signService,logService:a.logService}}async function xWo(a,i,e){return EWo(a,async t=>{let{protocol:o}=await yWo(t,Ie.None);return new CGi(a,i,e,t.reconnectionToken,o)})}async function kWo(a,i){return EWo(a,async e=>{let{protocol:t,debugPort:o}=await wWo(e,i,Ie.None);return new xGi(a,i,e.reconnectionToken,t,o)})}async function EWo(a,i){for(let t=1;;t++)try{let o=ht(),n=await CWo(a,o,null);return await i(n)}catch(o){if(t<5)a.logService.error(`[remote-connection][attempt ${t}] An error occurred in initial connection! Will retry... Error:`),a.logService.error(o);else throw a.logService.error(`[remote-connection][attempt ${t}]  An error occurred in initial connection! It will be treated as a permanent error. Error:`),a.logService.error(o),pae.triggerPermanentFailure(0,0,mC.isHandled(o)),o}}function WDn(a){return Hn(i=>new Promise((e,t)=>{let o=setTimeout(e,a*1e3);i.onCancellationRequested(()=>{clearTimeout(o),e()})}))}var SGi=class{constructor(i,e){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.type=0}},IGi=class{constructor(i,e,t,o){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.durationSeconds=t;this.cancellableTimer=o;this.type=1}skipWait(){this.cancellableTimer.cancel()}},yGi=class{constructor(i,e,t){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.type=2}},wYt=class{constructor(i,e,t){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.type=4}},wGi=class{constructor(i,e,t,o){this.reconnectionToken=i;this.millisSinceLastIncomingData=e;this.attempt=t;this.handled=o;this.type=3}},pae=class a extends k{constructor(e,t,o,n,r){super();this._connectionType=e;this._options=t;this.reconnectionToken=o;this.protocol=n;this._reconnectionFailureIsFatal=r;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 wYt(this.reconnectionToken,0,0)),this._register(n.onSocketClose(s=>{let l=tmt(this._connectionType,this.reconnectionToken,!0);s?s.type===0?(this._options.logService.info(`${l} received socket close event (hadError: ${s.hadError}).`),s.error&&this._options.logService.error(s.error)):(this._options.logService.info(`${l} received socket close event (wasClean: ${s.wasClean}, code: ${s.code}, reason: ${s.reason}).`),s.event&&this._options.logService.error(s.event)):this._options.logService.info(`${l} received socket close event.`),this._beginReconnecting()})),this._register(n.onSocketTimeout(s=>{let l=tmt(this._connectionType,this.reconnectionToken,!0);this._options.logService.info(`${l} received socket timeout event (reason: ${s.reason}, unacknowledgedMsgCount: ${s.unacknowledgedMsgCount}, timeSinceOldestUnacknowledgedMsg: ${s.timeSinceOldestUnacknowledgedMsg}, timeSinceLastReceivedSomeData: ${s.timeSinceLastReceivedSomeData}).`),this._beginReconnecting()})),a._instances.push(this),this._register(ee(()=>{let s=a._instances.indexOf(this);s>=0&&a._instances.splice(s,1)})),this._isPermanentFailure&&this._gotoPermanentFailure(a._permanentFailureMillisSinceLastIncomingData,a._permanentFailureAttempt,a._permanentFailureHandled)}static triggerPermanentFailure(e,t,o){this._permanentFailure=!0,this._permanentFailureMillisSinceLastIncomingData=e,this._permanentFailureAttempt=t,this._permanentFailureHandled=o,this._instances.forEach(n=>n._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||a._permanentFailure}updateGraceTime(e){let t=VDn(e,108e5),o=tmt(this._connectionType,this.reconnectionToken,!1);this._options.logService.trace(`${o} Applying reconnection grace time: ${t}ms (${Math.floor(t/1e3)}s)`),this._reconnectionGraceTime=t}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=tmt(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 SGi(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData()));let t=[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 n=Date.now(),r=-1;do{r++;let s=r<t.length?t[r]:t[t.length-1];try{if(s>0){let c=WDn(s);this._onDidStateChange.fire(new IGi(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),s,c)),this._options.logService.info(`${e} waiting for ${s} seconds before reconnecting...`);try{await c}catch{}}if(this._isPermanentFailure){this._options.logService.error(`${e} permanent failure occurred while running the reconnecting loop.`);break}this._onDidStateChange.fire(new yGi(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),r+1)),this._options.logService.info(`${e} resolving connection...`);let l=await CWo(this._options,this.reconnectionToken,this.protocol);this._options.logService.info(`${e} connecting to ${l.connectTo}...`),await this._reconnect(l,SWo(PDn)),this._options.logService.info(`${e} reconnected!`),this._onDidStateChange.fire(new wYt(this.reconnectionToken,this.protocol.getMillisSinceLastIncomingData(),r+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(),r+1,!1);break}if(Date.now()-n>=o){let c=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 (${c}s) has expired! Will give up now! Error:`),this._options.logService.error(l),this._onReconnectionPermanentFailure(this.protocol.getMillisSinceLastIncomingData(),r+1,!1);break}if(mC.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(Yi(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 mC){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(),r+1,mC.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(),r+1,!1);break}}while(!this._isPermanentFailure&&!this._isDisposed)}_onReconnectionPermanentFailure(e,t,o){this._reconnectionFailureIsFatal?a.triggerPermanentFailure(e,t,o):this._gotoPermanentFailure(e,t,o)}_gotoPermanentFailure(e,t,o){this._onDidStateChange.fire(new wGi(this.reconnectionToken,e,t,o)),kGi(this.protocol)}_pauseSocketWriting(){this.protocol.pauseSocketWriting()}},CGi=class extends pae{constructor(i,e,t,o,n){super(1,i,o,n,!0),this.client=this._register(new wOt(n,{remoteAuthority:e,clientId:t},i.ipcLogger))}async _reconnect(i,e){await yWo(i,e)}},xGi=class extends pae{constructor(i,e,t,o,n){super(2,i,t,o,!1),this._startArguments=e,this.debugPort=n}async _reconnect(i,e){await wWo(i,this._startArguments,e)}};function kGi(a){try{a.acceptDisconnect();let i=a.getSocket();a.dispose(),i.dispose()}catch(i){mt(i)}}function TWo(a){if(a&&a.type==="error"){let i=new Error(`Connection error: ${a.reason}`);return i.code="VSCODE_CONNECTION_ERROR",i}return null}function VDn(a,i){return typeof a!="number"||!isFinite(a)||a<0?i:a>Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:Math.floor(a)}function BDn(a,i){for(;a.length<i;)a+=" ";return a}function HDn(a,i){return`[remote-connection][${BDn(bGi(a),13)}][${i.substr(0,5)}\u2026]`}function tmt(a,i,e){return`${HDn(a,i)}[${e?"reconnect":"initial"}]`}function _Wo(a,i){return`${tmt(i,a.reconnectionToken,!!a.reconnectionProtocol)}[${a.connectTo}]`}function UDn(a){return`${Date.now()-a} ms`}var CYt=class{constructor(i){this.service=i}listen(i,e,t){throw new Error("Invalid listen")}call(i,e,t){if(e==="download")return this.service.download(A.revive(t[0]),A.revive(t[1]),t[2]??"downloadIpc");throw new Error("Invalid call")}};var xYt=class extends oSt{constructor(e,t,o,n,r){super(t,o,n);this.windowId=e;this.channel=r;this._register(r.listen("onDidChangeLogLevel",e)(s=>{LY(s)?super.setLogLevel(s):super.setLogLevel(A.revive(s[0]),s[1])})),this._register(r.listen("onDidChangeVisibility",e)(([s,l])=>super.setVisibility(A.revive(s),l))),this._register(r.listen("onDidChangeLoggers",e)(({added:s,removed:l})=>{for(let c of s)super.registerLogger({...c,resource:A.revive(c.resource)});for(let c of l)super.deregisterLogger(c.resource)}))}createConsoleMainLogger(){return new H4e({log:(e,t)=>{this.channel.call("consoleLog",[e,t])}})}registerLogger(e){super.registerLogger(e),this.channel.call("registerLogger",[e,this.windowId])}deregisterLogger(e){let t=this.toResource(e);super.deregisterLogger(t),this.channel.call("deregisterLogger",[t,this.windowId])}setLogLevel(e,t){super.setLogLevel(e,t),this.channel.call("setLogLevel",[e,t])}setVisibility(e,t){super.setVisibility(e,t),this.channel.call("setVisibility",[this.toResource(e),t])}doCreateLogger(e,t,o){return new EGi(this.channel,e,t,o,this.windowId)}static setLogLevel(e,t,o){return e.call("setLogLevel",[t,o])}},EGi=class extends Vwe{constructor(e,t,o,n,r){super(n?.logLevel==="always");this.channel=e;this.file=t;this.isLoggerCreated=!1;this.buffer=[];this.setLevel(o),this.channel.call("createLogger",[t,n,r]).then(()=>{this.doLog(this.buffer),this.isLoggerCreated=!0})}log(e,t){let o=[[e,t]];this.isLoggerCreated?this.doLog(o):this.buffer.push(...o)}doLog(e){this.channel.call("log",[this.file,e])}};var kYt=class extends k{constructor(i,e){super(),e.call("setLogLevel",[i.getLogLevel()]),this._register(i.onDidChangeLogLevel(t=>e.call("setLogLevel",[t]))),e.call("getRegisteredLoggers").then(t=>{for(let o of t)i.registerLogger({...o,resource:A.revive(o.resource)})}),this._register(e.listen("onDidChangeVisibility")(([t,o])=>i.setVisibility(A.revive(t),o))),this._register(e.listen("onDidChangeLoggers")(({added:t,removed:o})=>{for(let n of t)i.registerLogger({...n,resource:A.revive(n.resource)});for(let n of o)i.deregisterLogger(n.resource)}))}};var EYt="remote.defaultExtensionsIfInstalledLocally";var DWo="([a-z0-9A-Z][a-z0-9-A-Z]*)\\.([a-z0-9A-Z][a-z0-9-A-Z]*)$",MGe=class{constructor(i,e){this.labelService=i;this.remoteAgentService=e;this.registerFormatters()}static{this.ID="workbench.contrib.remoteLabel"}registerFormatters(){this.remoteAgentService.getEnvironment().then(i=>{let e=i?.os||Ao,t={label:"${path}",separator:e===1?"\\":"/",tildify:e!==1,normalizeDriveLetter:e===1,workspaceSuffix:Ft?void 0:Q.vscodeRemote};this.labelService.registerFormatter({scheme:Q.vscodeRemote,formatting:t}),i&&this.labelService.registerFormatter({scheme:Q.vscodeUserData,formatting:t})})}};MGe=I([m(0,nt),m(1,bo)],MGe);var imt=class extends k{constructor(i,e,t){super();let o=i.getConnection();o&&(o.registerChannel("download",new CYt(e)),o.withChannel("logger",async n=>this._register(new kYt(t,n))))}};imt=I([m(0,bo),m(1,aW),m(2,Ol)],imt);var PGe=class extends k{constructor(e,t,o,n,r,s){super();this.fileService=e;this.dialogService=t;this.environmentService=o;this.contextService=n;this.fileDialogService=r;this.environmentService.remoteAuthority&&s.getEnvironment().then(l=>{l&&this.validateRemoteWorkspace()})}static{this.ID="workbench.contrib.remoteInvalidWorkspaceDetector"}async validateRemoteWorkspace(){let e=this.contextService.getWorkspace(),t=e.configuration??e.folders.at(0)?.uri;if(!t||await this.fileService.exists(t))return;if((await this.dialogService.confirm({type:"warning",message:d(14656,null),detail:d(14655,null),primaryButton:d(14657,null)})).confirmed)return e.configuration?this.fileDialogService.pickWorkspaceAndOpen({}):this.fileDialogService.pickFolderAndOpen({})}};PGe=I([m(0,ge),m(1,ct),m(2,Mt),m(3,Ae),m(4,nn),m(5,bo)],PGe);var zDn=oe.as(Zi.Workbench);bt(MGe.ID,MGe,vt.BlockStartup);zDn.registerWorkbenchContribution(imt,3);bt(PGe.ID,PGe,vt.BlockStartup);var KDn=!0;if(KDn){class a extends z{constructor(){super({id:"workbench.action.triggerReconnect",title:P(14688,"Connection: Trigger Reconnect"),category:Fe.Developer,f1:!0})}async run(t){pae.debugTriggerReconnection()}}class i extends z{constructor(){super({id:"workbench.action.pauseSocketWriting",title:P(14658,"Connection: Pause socket writing"),category:Fe.Developer,f1:!0})}async run(t){pae.debugPauseSocketWriting()}}W(a),W(i)}var RWo={type:"string",enum:["ui","workspace"],enumDescriptions:[d(14689,null),d(14690,null)]};oe.as($t.Configuration).registerConfiguration({id:"remote",title:d(14659,null),type:"object",properties:{"remote.extensionKind":{type:"object",markdownDescription:d(14668,null),patternProperties:{[DWo]:{oneOf:[{type:"array",items:RWo},RWo],default:["ui"]}},default:{"pub.name":["ui"]}},"remote.restoreForwardedPorts":{type:"boolean",markdownDescription:d(14687,null),default:!0},"remote.autoForwardPorts":{type:"boolean",markdownDescription:d(14661,null,"`#remote.autoForwardPortsSource#`"),default:!0},"remote.autoForwardPortsSource":{type:"string",markdownDescription:d(14662,null,"`#remote.autoForwardPorts#`","`#remote.autoForwardPortsSource#`"),enum:["process","output","hybrid"],enumDescriptions:[d(14665,null),d(14664,null),d(14663,null)],default:"process"},"remote.autoForwardPortsFallback":{type:"number",default:20,markdownDescription:d(14660,null)},"remote.forwardOnOpen":{type:"boolean",description:d(14669,null),default:!0},"remote.portsAttributes":{type:"object",patternProperties:{"(^\\d+(-\\d+)?$)|(.+)":{type:"object",description:d(14683,null),properties:{onAutoForward:{type:"string",enum:["notify","openBrowser","openBrowserOnce","openPreview","silent","ignore"],enumDescriptions:[d(14677,null),d(14679,null),d(14680,null),d(14681,null),d(14686,null),d(14674,null)],description:d(14678,null),default:"notify"},elevateIfNeeded:{type:"boolean",description:d(14673,null),default:!1},label:{type:"string",description:d(14675,null),default:d(14676,null)},requireLocalPort:{type:"boolean",markdownDescription:d(14685,null),default:!1},protocol:{type:"string",enum:["http","https"],description:d(14684,null)}},default:{label:d(14676,null),onAutoForward:"notify"}}},markdownDescription:d(14671,null),defaultSnippets:[{body:{"${1:3000}":{label:"${2:Application}",onAutoForward:"openPreview"}}}],errorMessage:d(14682,null),additionalProperties:!1,default:{443:{protocol:"https"},8443:{protocol:"https"}}},"remote.otherPortsAttributes":{type:"object",properties:{onAutoForward:{type:"string",enum:["notify","openBrowser","openPreview","silent","ignore"],enumDescriptions:[d(14677,null),d(14679,null),d(14681,null),d(14686,null),d(14674,null)],description:d(14678,null),default:"notify"},elevateIfNeeded:{type:"boolean",description:d(14673,null),default:!1},label:{type:"string",description:d(14675,null),default:d(14676,null)},requireLocalPort:{type:"boolean",markdownDescription:d(14685,null),default:!1},protocol:{type:"string",enum:["http","https"],description:d(14684,null)}},defaultSnippets:[{body:{onAutoForward:"ignore"}}],markdownDescription:d(14672,null,"`#remote.portsAttributes#`"),additionalProperties:!1},"remote.localPortHost":{type:"string",enum:["localhost","allInterfaces"],default:"localhost",description:d(14670,null)},[EYt]:{type:"array",markdownDescription:d(14667,null),default:$i?.remoteDefaultExtensionsIfInstalledLocally||[],items:{type:"string",pattern:DWo,patternErrorMessage:d(14666,null)}}}});var xIe=class extends k{static{this.ID="workbench.contrib.showPortCandidate"}constructor(i,e){super();let t=e.options?.tunnelProvider?.showPortCandidate;t&&this._register(i.setCandidateFilter(async o=>{let n=await Promise.all(o.map(s=>t(s.host,s.port,s.detail??""))),r=[];if(n.length!==o.length)return o;for(let s=0;s<o.length;s++)n[s]&&r.push(o[s]);return r}))}};xIe=I([m(0,Wu),m(1,Od)],xIe);var kIe=class extends k{constructor(e,t,o,n,r,s){super();this.openerService=o;let l=t.options?.tunnelProvider?.tunnelFactory;if(l){s.createKey(Xme.key,!0);let c=t.options?.tunnelProvider?.features?.privacyOptions??[];t.options?.tunnelProvider?.features?.public&&c.length===0&&(c=[{id:"private",label:d(14594,null),themeIcon:"lock"},{id:"public",label:d(14595,null),themeIcon:"eye"}]),this._register(e.setTunnelProvider({forwardPort:async(p,h)=>{let g;try{g=l(p,h)}catch{r.trace("tunnelFactory: tunnel provider error")}if(!g)return;let f;try{f=await g}catch(S){return r.trace("tunnelFactory: tunnel provider promise error"),S instanceof Error?S.message:void 0}let v=f.localAddress.startsWith("http")?f.localAddress:`http://${f.localAddress}`;return{tunnelRemotePort:f.remoteAddress.port,tunnelRemoteHost:f.remoteAddress.host,localAddress:await this.resolveExternalUri(v),privacy:f.privacy??(f.public?"public":"private"),protocol:f.protocol??"http",dispose:async()=>{await f.dispose()}}}}));let u=t.options?.tunnelProvider?.features?{features:{elevation:!!t.options?.tunnelProvider?.features?.elevation,public:!!t.options?.tunnelProvider?.features?.public,privacyOptions:c,protocol:t.options?.tunnelProvider?.features?.protocol===void 0?!0:!!t.options?.tunnelProvider?.features?.protocol}}:void 0;n.setTunnelInformation(u)}}static{this.ID="workbench.contrib.tunnelFactory"}async resolveExternalUri(e){try{return(await this.openerService.resolveExternalUri(A.parse(e))).resolved.toString()}catch{return e}}};kIe=I([m(0,Jp),m(1,Od),m(2,Je),m(3,Wu),m(4,re),m(5,X)],kIe);var LWo=new Y("selectedRemoteInExplorer",""),AGe=class extends k{constructor(e,t,o,n,r){super();this.contextKeyService=e;this.remoteExplorerService=t;this.environmentService=o;this.storageService=n;this.workspaceContextService=r;this.completedRemotes=this._register(new Ot);this.selectedRemoteContext=LWo.bindTo(e),this.switchRemoteMenu=R.for("workbench.remote.menu.switchRemoteMenu"),this._register(be.appendMenuItem(R.ViewContainerTitle,{submenu:this.switchRemoteMenu,title:d(14509,null),group:"navigation",when:C.equals("viewContainer",bU),order:1,isSelection:!0})),this._register(t.onDidChangeTargetType(s=>{this.select(s)}))}setSelectionForConnection(){let e=!1;if(this.completedRemotes.size>0){let t,o=this.environmentService.remoteAuthority,n;o||(n=PM(this.workspaceContextService.getWorkspace())?.scheme),e=!0;let r=o?[o.split("+")[0]]:n?[n]:this.storageService.get(ZZe,1)?.split(",")??this.storageService.get(ZZe,0)?.split(",");r!==void 0&&(t=this.getAuthorityForExplorerType(r)),t&&this.select(t)}return e}select(e){this.selectedRemoteContext.set(e[0]),this.remoteExplorerService.targetType=e}getAuthorityForExplorerType(e){let t;for(let o of this.completedRemotes)for(let n of o[1].authority)for(let r of e)if(n===r){t=o[1].authority;break}else if(o[1].virtualWorkspace===r){t=o[1].authority;break}return t}removeOptionItems(e){for(let t of e)if(t.group&&t.group.startsWith("targets")&&t.remoteAuthority&&(!t.when||this.contextKeyService.contextMatchesRules(t.when))){let o=vI(t.remoteAuthority)?t.remoteAuthority:[t.remoteAuthority];this.completedRemotes.deleteAndDispose(o[0])}}createOptionItems(e){let t=this.completedRemotes.size;for(let o of e)if(o.group&&o.group.startsWith("targets")&&o.remoteAuthority&&(!o.when||this.contextKeyService.contextMatchesRules(o.when))){let n=o.name,r=vI(o.remoteAuthority)?o.remoteAuthority:[o.remoteAuthority];if(this.completedRemotes.has(r[0]))continue;let s=this,l=W(class extends z{constructor(){super({id:`workbench.action.remoteExplorer.show.${r[0]}`,title:n,toggled:LWo.isEqualTo(r[0]),menu:{id:s.switchRemoteMenu}})}async run(){s.select(r)}});this.completedRemotes.set(r[0],{text:n.value,authority:r,virtualWorkspace:o.virtualWorkspace,dispose:()=>l.dispose()})}this.completedRemotes.size>t&&this.setSelectionForConnection()}};AGe=I([m(0,X),m(1,Wu),m(2,Mt),m(3,de),m(4,Ae)],AGe);var MWo=()=>`
<checklist>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${fl.COLOR_THEME_DARK}" checked-on="config.workbench.colorTheme == '${fl.COLOR_THEME_DARK}'">
			<img width="200" src="./dark.png"/>
			${Cr(d(18111,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${fl.COLOR_THEME_LIGHT}" checked-on="config.workbench.colorTheme == '${fl.COLOR_THEME_LIGHT}'">
			<img width="200" src="./light.png"/>
			${Cr(d(18114,null))}
		</checkbox>
	</div>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${fl.COLOR_THEME_HC_DARK}" checked-on="config.workbench.colorTheme == '${fl.COLOR_THEME_HC_DARK}'">
			<img width="200" src="./dark-hc.png"/>
			${Cr(d(18112,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${fl.COLOR_THEME_HC_LIGHT}" checked-on="config.workbench.colorTheme == '${fl.COLOR_THEME_HC_LIGHT}'">
			<img width="200" src="./light-hc.png"/>
			${Cr(d(18113,null))}
		</checkbox>
	</div>
</checklist>
<checkbox class="theme-picker-link" when-checked="command:workbench.action.selectTheme" checked-on="false">
	${Cr(d(18115,null))}
</checkbox>
`;var PWo=()=>`
<checklist>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${fl.COLOR_THEME_DARK}" checked-on="config.workbench.colorTheme == '${fl.COLOR_THEME_DARK}'">
			<img width="150" src="./dark.png"/>
			${Cr(d(18116,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${fl.COLOR_THEME_LIGHT}" checked-on="config.workbench.colorTheme == '${fl.COLOR_THEME_LIGHT}'">
			<img width="150" src="./light.png"/>
			${Cr(d(18119,null))}
		</checkbox>
	</div>
	<div class="theme-picker-row">
		<checkbox when-checked="setTheme:${fl.COLOR_THEME_HC_DARK}" checked-on="config.workbench.colorTheme == '${fl.COLOR_THEME_HC_DARK}'">
			<img width="150" src="./dark-hc.png"/>
			${Cr(d(18117,null))}
		</checkbox>
		<checkbox when-checked="setTheme:${fl.COLOR_THEME_HC_LIGHT}" checked-on="config.workbench.colorTheme == '${fl.COLOR_THEME_HC_LIGHT}'">
			<img width="150" src="./light-hc.png"/>
			${Cr(d(18118,null))}
		</checkbox>
	</div>
</checklist>
`;var TGi=a=>nc("notebook.setProfile",{profile:a}).toString(),_Gi=400,AWo=()=>`
<vertically-centered>
<checklist>
	<checkbox on-checked="${TGi("default")}" checked-on="config.notebook.cellFocusIndicator == 'border' && config.notebook.insertToolbarLocation == 'both' && config.notebook.globalToolbar == false && config.notebook.compactView == true && config.notebook.showCellStatusBar == 'visible'">
		<img width="${_Gi}" src="./notebookThemes/default.png"/>
		${Cr(d(18109,null))}
	</checkbox>
	<checkbox on-checked="${TGi("jupyter")}" checked-on="config.notebook.cellFocusIndicator == 'gutter' && config.notebook.insertToolbarLocation == 'notebookToolbar' && config.notebook.globalToolbar == true && config.notebook.compactView == true  && config.notebook.showCellStatusBar == 'visible'">
		<img width="${_Gi}" src="./notebookThemes/jupyter.png"/>
		${Cr(d(18110,null))}
	</checkbox>
	<checkbox on-checked="${TGi("colab")}" checked-on="config.notebook.cellFocusIndicator == 'border' && config.notebook.insertToolbarLocation == 'betweenCells' && config.notebook.globalToolbar == false && config.notebook.compactView == false && config.notebook.showCellStatusBar == 'hidden'">
		<img width="${_Gi}" src="./notebookThemes/colab.png"/>
		${Cr(d(18108,null))}
	</checkbox>
</checklist>
</vertically-centered>
`;var omt={documentationUrl:$i.defaultChatAgent?.documentationUrl??"",provider:$i.defaultChatAgent?.provider??{default:{name:""}},publicCodeMatchesUrl:$i.defaultChatAgent?.publicCodeMatchesUrl??"",termsStatementUrl:$i.defaultChatAgent?.termsStatementUrl??"",privacyStatementUrl:$i.defaultChatAgent?.privacyStatementUrl??""};var DGi=class{constructor(){this.providers=new Map}registerProvider(i,e){this.providers.set(i,e)}getProvider(i){return this.providers.get(i)}},NGe=new DGi;NGe.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker",MWo);NGe.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker_small",PWo);NGe.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile",AWo);NGe.registerProvider("vs/workbench/contrib/welcomeGettingStarted/common/media/empty",()=>"");var TYt=Oe("getting-started-setup",L.zap,d(17976,null)),GDn=Oe("getting-started-beginner",L.lightbulb,d(17975,null)),RGi=[{id:"welcome.showNewFileEntries",title:d(18019,null),description:d(18018,null),icon:L.newFile,content:{type:"startEntry",command:"command:welcome.showNewFileEntries"}},{id:"topLevelOpenMac",title:d(18031,null),description:d(18030,null),icon:L.folderOpened,when:"!isWeb && isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFileFolder"}},{id:"topLevelOpenFile",title:d(18027,null),description:d(18026,null),icon:L.goToFile,when:"isWeb || !isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFile"}},{id:"topLevelOpenFolder",title:d(18029,null),description:d(18028,null),icon:L.folderOpened,when:"!isWeb && !isMac",content:{type:"startEntry",command:"command:workbench.action.files.openFolder"}},{id:"topLevelOpenFolderWeb",title:d(18029,null),description:d(18028,null),icon:L.folderOpened,when:"!openFolderWorkspaceSupport && workbenchState == 'workspace'",content:{type:"startEntry",command:"command:workbench.action.files.openFolderViaWorkspace"}},{id:"topLevelGitClone",title:d(18062,null),description:d(18061,null),when:"config.git.enabled && !git.missing",icon:L.sourceControl,content:{type:"startEntry",command:"command:git.clone"}},{id:"topLevelGitOpen",title:d(18064,null),description:d(18063,null),when:"workspacePlatform == 'webworker'",icon:L.sourceControl,content:{type:"startEntry",command:"command:remoteHub.openRepository"}},{id:"topLevelRemoteOpen",title:d(18068,null),description:d(18067,null),when:"!isWeb",icon:L.remote,content:{type:"startEntry",command:"command:workbench.action.remote.showMenu"}},{id:"topLevelOpenTunnel",title:d(18066,null),description:d(18065,null),when:"isWeb && showRemoteStartEntryInWeb",icon:L.remote,content:{type:"startEntry",command:"command:workbench.action.remote.showWebStartEntryActions"}},{id:"topLevelNewWorkspaceChat",title:d(18021,null),description:d(18020,null),icon:L.chatSparkle,when:"!isWeb && !chatSetupHidden && !chatSetupDisabledInWorkspace",content:{type:"startEntry",command:"command:welcome.newWorkspaceChat"}}],Zc=(a,i)=>`[${a}](${i})`,qDn=d(17996,null),NWo=d(17994,null,omt.documentationUrl??""),$Dn=d(17995,null,omt.provider.default.name,omt.provider.default.name,omt.termsStatementUrl,omt.privacyStatementUrl),jDn=Zc(d(18093,null),"command:workbench.action.chat.triggerSetupAnonymousWithoutDialog"),QDn=Zc(d(18093,null),"command:workbench.action.chat.triggerSetup"),YDn=Zc(d(18093,null),"command:workbench.action.chat.triggerSetup"),XDn=Zc(d(18092,null),"command:workbench.action.chat.open");function _Yt(a,i,e,t){let o=t?`${NWo}
${$Dn}
${i}`:`${NWo}
${i}`;return{id:a,title:qDn,description:o,when:`${e} && !chatSetupHidden && !chatSetupDisabledInWorkspace`,media:{type:"svg",altText:"VS Code Copilot multi file edits",path:"multi-file-edits.svg"}}}var LGi=[{id:"Setup",title:d(18047,null),description:d(18044,null),isFeatured:!0,icon:TYt,when:"!isWeb",walkthroughPageTitle:d(18048,null),next:"Beginner",content:{type:"steps",steps:[_Yt("CopilotSetupAnonymous",jDn,"chatAnonymous && !chatSetupCompleted",!0),_Yt("CopilotSetupSignedOut",QDn,"chatEntitlementSignedOut && !chatAnonymous && !github.copilot.hasByokModels",!1),_Yt("CopilotSetupComplete",XDn,"chatSetupCompleted && !chatSetupDisabled && (chatAnonymous || chatPlanPro || chatPlanProPlus || chatPlanMax || chatPlanBusiness || chatPlanEnterprise || chatPlanFree)",!1),_Yt("CopilotSetupSignedIn",YDn,"!chatEntitlementSignedOut && (!chatSetupCompleted || chatSetupDisabled || chatPlanCanSignUp)",!1),{id:"pickColorTheme",title:d(18033,null),description:d(18032,null,Zc(d(18098,null),"command:workbench.action.selectTheme")),completionEvents:["onSettingChanged:workbench.colorTheme","onCommand:workbench.action.selectTheme"],media:{type:"markdown",path:"theme_picker"}},{id:"videoTutorial",title:d(18072,null),description:d(18071,null,Zc(d(18106,null),"https://aka.ms/vscode-getting-started-video")),media:{type:"svg",altText:"VS Code Settings",path:"learn.svg"}}]}},{id:"SetupWeb",title:d(18053,null),description:d(18052,null),isFeatured:!0,icon:TYt,when:"isWeb",next:"Beginner",walkthroughPageTitle:d(18054,null),content:{type:"steps",steps:[{id:"pickColorThemeWeb",title:d(18033,null),description:d(18032,null,Zc(d(18098,null),"command:workbench.action.selectTheme")),completionEvents:["onSettingChanged:workbench.colorTheme","onCommand:workbench.action.selectTheme"],media:{type:"markdown",path:"theme_picker"}},{id:"menuBarWeb",title:d(18017,null),description:d(18016,null,Zc(d(18102,null),"command:workbench.action.toggleMenuBar")),when:"isWeb",media:{type:"svg",altText:"Comparing menu dropdown with the visible menu bar.",path:"menuBar.svg"}},{id:"extensionsWebWeb",title:d(18002,null),description:d(18003,null,Zc(d(17970,null),"command:workbench.extensions.action.showPopularExtensions")),when:"workspacePlatform == 'webworker'",media:{type:"svg",altText:"VS Code extension marketplace with featured language extensions",path:"extensions-web.svg"}},{id:"findLanguageExtensionsWeb",title:d(18005,null),description:d(18004,null,Zc(d(17968,null),"command:workbench.extensions.action.showLanguageExtensions")),when:"workspacePlatform != 'webworker'",media:{type:"svg",altText:"Language extensions",path:"languages.svg"}},{id:"settingsSyncWeb",title:d(18043,null),description:d(18042,null,Zc(d(17973,null),"command:workbench.userDataSync.actions.turnOn")),when:"syncStatus != uninitialized",completionEvents:["onEvent:sync-enabled"],media:{type:"svg",altText:'The "Turn on Sync" entry in the settings gear menu.',path:"settingsSync.svg"}},{id:"commandPaletteTaskWeb",title:d(17991,null),description:d(17990,null,Zc(d(17972,null),"command:workbench.action.showCommands")),media:{type:"svg",altText:"Command Palette overlay for searching and executing commands.",path:"commandPalette.svg"}},{id:"pickAFolderTask-WebWeb",title:d(18045,null),description:d(18046,null,Zc(d(18083,null),"command:workbench.action.addRootFolder"),Zc(d(18085,null),"command:remoteHub.openRepository")),when:"workspaceFolderCount == 0",media:{type:"svg",altText:"Explorer view showing buttons for opening folder and cloning repository.",path:"openFolder.svg"}},{id:"quickOpenWeb",title:d(18035,null),description:d(18034,null,Zc(d(18088,null),"command:toSide:workbench.action.quickOpen")),when:"workspaceFolderCount != 0",media:{type:"svg",altText:"Go to file in quick search.",path:"search.svg"}}]}},{id:"SetupAccessibility",title:d(18050,null),description:d(18049,null),isFeatured:!0,icon:TYt,when:Oa.key,next:"Setup",walkthroughPageTitle:d(18051,null),content:{type:"steps",steps:[{id:"accessibilityHelp",title:d(17978,null),description:d(17977,null,Zc(d(18080,null),"command:editor.action.accessibilityHelp")),media:{type:"markdown",path:"empty"}},{id:"accessibleView",title:d(17984,null),description:d(17983,null,Zc(d(18082,null),"command:editor.action.accessibleView")),media:{type:"markdown",path:"empty"}},{id:"verbositySettings",title:d(18070,null),description:d(18069,null,Zc(d(18087,null),"command:workbench.action.openAccessibilitySettings")),media:{type:"markdown",path:"empty"}},{id:"commandPaletteTaskAccessibility",title:d(17993,null),description:d(17992,null,Zc(d(17972,null),"command:workbench.action.showCommands")),media:{type:"markdown",path:"empty"}},{id:"keybindingsAccessibility",title:d(18015,null),description:d(18014,null,Zc(d(18077,null),"command:toSide:workbench.action.openGlobalKeybindings")),media:{type:"markdown",path:"empty"}},{id:"accessibilitySignals",title:d(17982,null),description:d(17981,null,Zc(d(18079,null),"command:signals.sounds.help"),Zc(d(18078,null),"command:accessibility.announcement.help")),media:{type:"markdown",path:"empty"}},{id:"hover",title:d(18009,null),description:d(18008,null,Zc(d(18094,null),"command:editor.action.showHover")),media:{type:"markdown",path:"empty"}},{id:"goToSymbol",title:d(18007,null),description:d(18006,null,Zc(d(18084,null),"command:editor.action.goToSymbol")),media:{type:"markdown",path:"empty"}},{id:"codeFolding",title:d(17989,null),description:d(17988,null,Zc(d(18100,null),"command:editor.toggleFold"),Zc(d(18101,null),"command:editor.toggleFoldRecursively")),media:{type:"markdown",path:"empty"}},{id:"intellisense",title:d(18013,null),description:d(18012,null,Zc(d(18104,null),"command:editor.action.triggerSuggest"),Zc(d(18103,null),"command:editor.action.inlineSuggest.trigger")),media:{type:"markdown",path:"empty"}},{id:"accessibilitySettings",title:d(17980,null),description:d(17979,null,Zc(d(18081,null),"command:workbench.action.openAccessibilitySettings")),media:{type:"markdown",path:"empty"}},{id:"dictation",title:d(18000,null),description:d(17999,null,Zc(d(18099,null),"command:workbench.action.editorDictation.start"),Zc(d(18096,null),"command:workbench.action.terminal.startVoice"),Zc(d(18097,null),"command:workbench.action.terminal.stopVoice")),when:"hasSpeechProvider",media:{type:"markdown",path:"empty"}}]}},{id:"Beginner",isFeatured:!1,title:d(17986,null),icon:GDn,description:d(17985,null),walkthroughPageTitle:d(17987,null),content:{type:"steps",steps:[{id:"settingsAndSync",title:d(18040,null),description:d(18041,null,Zc(d(18105,null),"command:toSide:workbench.action.openSettings")),when:"workspacePlatform != 'webworker' && syncStatus != uninitialized",completionEvents:["onEvent:sync-enabled"],media:{type:"svg",altText:"VS Code Settings",path:"settings.svg"}},{id:"extensions",title:d(18002,null),description:d(18001,null,Zc(d(17969,null),"command:workbench.extensions.action.showPopularExtensions")),when:"workspacePlatform != 'webworker'",media:{type:"svg",altText:"VS Code extension marketplace with featured language extensions",path:"extensions.svg"}},{id:"terminal",title:d(18060,null),description:d(18059,null,Zc(d(18095,null),"command:workbench.action.terminal.toggleTerminal")),when:"workspacePlatform != 'webworker' && remoteName != codespaces && !terminalIsOpen",media:{type:"svg",altText:"Integrated terminal running a few npm commands",path:"terminal.svg"}},{id:"debugging",title:d(17998,null),description:d(17997,null,Zc(d(18089,null),"command:workbench.action.debug.selectandstart")),when:"workspacePlatform != 'webworker' && workspaceFolderCount != 0",media:{type:"svg",altText:"Run and debug view.",path:"debug.svg"}},{id:"scmClone",title:d(18037,null),description:d(18038,null,Zc(d(17971,null),"command:git.clone")),when:"config.git.enabled && !git.missing && workspaceFolderCount == 0",media:{type:"svg",altText:"Source Control view.",path:"git.svg"}},{id:"scmSetup",title:d(18037,null),description:d(18039,null,Zc(d(18075,null),"command:git.init")),when:"config.git.enabled && !git.missing && workspaceFolderCount != 0 && gitOpenRepositoryCount == 0",media:{type:"svg",altText:"Source Control view.",path:"git.svg"}},{id:"scm",title:d(18037,null),description:d(18036,null,Zc(d(18086,null),"command:workbench.view.scm")),when:"config.git.enabled && !git.missing && workspaceFolderCount != 0 && gitOpenRepositoryCount != 0 && activeViewlet != 'workbench.view.scm'",media:{type:"svg",altText:"Source Control view.",path:"git.svg"}},{id:"installGit",title:d(18011,null),description:d(18010,null,Zc(d(18076,null),"https://aka.ms/vscode-install-git"),"[","](command:workbench.action.reloadWindow)"),when:"git.missing",media:{type:"svg",altText:"Install Git.",path:"git.svg"},completionEvents:["onContext:git.state == initialized"]},{id:"tasks",title:d(18058,null),when:"workspaceFolderCount != 0 && workspacePlatform != 'webworker'",description:d(18057,null,Zc(d(18090,null),"command:workbench.action.tasks.runTask")),media:{type:"svg",altText:"Task runner.",path:"runTask.svg"}},{id:"shortcuts",title:d(18056,null),description:d(18055,null,Zc(d(18077,null),"command:toSide:workbench.action.openGlobalKeybindings")),media:{type:"svg",altText:"Interactive shortcuts.",path:"shortcuts.svg"}},{id:"workspaceTrust",title:d(18074,null),description:d(18073,null,Zc(d(18107,null),"https://code.visualstudio.com/docs/editor/workspace-trust"),Zc(d(17974,null),"command:toSide:workbench.trust.manage")),when:"workspacePlatform != 'webworker' && !isWorkspaceTrusted && workspaceFolderCount == 0",media:{type:"svg",altText:"Workspace Trust editor in Restricted mode and a primary button for switching to Trusted mode.",path:"workspaceTrust.svg"}}]}},{id:"notebooks",title:d(18022,null),description:"",icon:TYt,isFeatured:!1,when:`config.${Ct.openGettingStarted} && userHasOpenedNotebook`,walkthroughPageTitle:d(18023,null),content:{type:"steps",steps:[{completionEvents:["onCommand:notebook.setProfile"],id:"notebookProfile",title:d(18025,null),description:d(18024,null),when:"userHasOpenedNotebook",media:{type:"markdown",path:"notebookProfile"}}]}}];var OGe=d(17924,null),OWo=zn.registerExtensionPoint({extensionPoint:"walkthroughs",jsonSchema:{description:d(17925,null),type:"array",items:{type:"object",required:["id","title","description","steps"],defaultSnippets:[{body:{id:"$1",title:"$2",description:"$3",steps:[]}}],properties:{id:{type:"string",description:d(17929,null)},title:{type:"string",description:d(17956,null)},icon:{type:"string",description:d(17928,null)},description:{type:"string",description:d(17926,null)},featuredFor:{type:"array",description:d(17927,null),items:{type:"string"}},when:{type:"string",description:d(17957,null)},steps:{type:"array",description:d(17930,null),items:{type:"object",required:["id","title","media"],defaultSnippets:[{body:{id:"$1",title:"$2",description:"$3",completionEvents:["$5"],media:{}}}],properties:{id:{type:"string",description:d(17943,null)},title:{type:"string",description:d(17954,null)},description:{type:"string",description:d(17940,null,`[${OGe}](command:myext.command)`,`[${OGe}](command:toSide:myext.command)`,`[${OGe}](https://aka.ms)`)},button:{deprecationMessage:d(17931,null,`[${OGe}](command:myext.command)`,`[${OGe}](command:toSide:myext.command)`,`[${OGe}](https://aka.ms)`)},media:{type:"object",description:d(17944,null),oneOf:[{required:["image","altText"],additionalProperties:!1,properties:{path:{deprecationMessage:d(17923,null)},image:{description:d(17950,null),oneOf:[{type:"string"},{type:"object",required:["dark","light","hc","hcLight"],properties:{dark:{description:d(17946,null),type:"string"},light:{description:d(17949,null),type:"string"},hc:{description:d(17947,null),type:"string"},hcLight:{description:d(17948,null),type:"string"}}}]},altText:{type:"string",description:d(17945,null)}}},{required:["svg","altText"],additionalProperties:!1,properties:{svg:{description:d(17951,null),type:"string"},altText:{type:"string",description:d(17945,null)}}},{required:["markdown"],additionalProperties:!1,properties:{path:{deprecationMessage:d(17923,null)},markdown:{description:d(17952,null),type:"string"}}}]},completionEvents:{description:d(17932,null),type:"array",items:{type:"string",defaultSnippets:[{label:"onCommand",description:d(17934,null),body:"onCommand:${1:commandId}"},{label:"onLink",description:d(17936,null),body:"onLink:${2:linkId}"},{label:"onView",description:d(17938,null),body:"onView:${2:viewId}"},{label:"onSettingChanged",description:d(17937,null),body:"onSettingChanged:${2:settingName}"},{label:"onContext",description:d(17935,null),body:"onContext:${2:key}"},{label:"onExtensionInstalled",description:d(17933,null),body:"onExtensionInstalled:${3:extensionId}"},{label:"onStepSelected",description:d(17939,null),body:"onStepSelected"}]}},doneOn:{description:d(17941,null),deprecationMessage:d(17942,null),type:"object",required:["command"],defaultSnippets:[{body:{command:"$1"}}],properties:{command:{description:d(17953,null),type:"string"}}},when:{type:"string",description:d(17955,null)}}}}}}},activationEventsGenerator:function*(a){for(let i of a)i.id&&(yield`onWalkthrough:${i.id}`)}});var DYt="workbench.editors.gettingStartedInput",av=class a extends Ls{static{this.ID=DYt}static{this.RESOURCE=A.from({scheme:Q.walkThrough,authority:"vscode_getting_started_page"})}get typeId(){return a.ID}get editorId(){return this.typeId}toUntyped(){return{resource:a.RESOURCE,options:{override:a.ID,pinned:!1}}}get resource(){return a.RESOURCE}matches(i){return super.matches(i)?!0:i instanceof a}constructor(i){super(),this._selectedCategory=i.selectedCategory,this._selectedStep=i.selectedStep,this._showTelemetryNotice=!!i.showTelemetryNotice,this._showWelcome=i.showWelcome??!0,this._walkthroughPageTitle=i.walkthroughPageTitle,this._returnToCommand=i.returnToCommand}getName(){return this.walkthroughPageTitle?d(17961,null,this.walkthroughPageTitle):d(17960,null)}get selectedCategory(){return this._selectedCategory}set selectedCategory(i){this._selectedCategory=i,this._onDidChangeLabel.fire()}get selectedStep(){return this._selectedStep}set selectedStep(i){this._selectedStep=i}get showTelemetryNotice(){return this._showTelemetryNotice}set showTelemetryNotice(i){this._showTelemetryNotice=i}get showWelcome(){return this._showWelcome}set showWelcome(i){this._showWelcome=i}get walkthroughPageTitle(){return this._walkthroughPageTitle}set walkthroughPageTitle(i){this._walkthroughPageTitle=i}get returnToCommand(){return this._returnToCommand}set returnToCommand(i){this._returnToCommand=i}};var JDn=new Y("hasMultipleNewFileEntries",!1),tA=le("walkthroughsService"),MYt="workbench.welcomePage.hiddenCategories",LYt="workbench.welcomePage.walkthroughMetadata",ZDn=d(17962,null),eRn=1440*60*1e3,MGi=7*eRn,rmt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.storageService=e;this.commandService=t;this.instantiationService=o;this.workspaceContextService=n;this.contextService=r;this.userDataSyncEnablementService=s;this.configurationService=l;this.extensionManagementService=c;this.hostService=u;this.viewsService=p;this.telemetryService=h;this.tasExperimentService=g;this.layoutService=f;this.editorService=v;this._onDidAddWalkthrough=this._register(new T);this.onDidAddWalkthrough=this._onDidAddWalkthrough.event;this._onDidRemoveWalkthrough=this._register(new T);this.onDidRemoveWalkthrough=this._onDidRemoveWalkthrough.event;this._onDidChangeWalkthrough=this._register(new T);this.onDidChangeWalkthrough=this._onDidChangeWalkthrough.event;this._onDidProgressStep=this._register(new T);this.onDidProgressStep=this._onDidProgressStep.event;this.sessionEvents=new Set;this.completionListeners=new Map;this.gettingStartedContributions=new Map;this.steps=new Map;this.sessionInstalledExtensions=new Set;this.categoryVisibilityContextKeys=new Set;this.stepCompletionContextKeyExpressions=new Set;this.stepCompletionContextKeys=new Set;this.metadata=new Map(JSON.parse(this.storageService.get(LYt,0,"[]"))),this.memento=new $l("gettingStartedService",this.storageService),this.stepProgress=this.memento.getMemento(0,0),this.initCompletionEventListeners(),JDn.bindTo(this.contextService).set(!1),this.registerWalkthroughs()}registerWalkthroughs(){LGi.forEach(async(e,t)=>{this._registerWalkthrough({...e,icon:{type:"icon",icon:e.icon},order:LGi.length-t,source:ZDn,when:C.deserialize(e.when)??C.true(),steps:e.content.steps.map((o,n)=>({...o,completionEvents:o.completionEvents??[],description:smt(o.description),category:e.id,order:n,when:C.deserialize(o.when)??C.true(),media:o.media.type==="image"?{type:"image",altText:o.media.altText,path:tRn(o.media.path)}:o.media.type==="svg"?{type:"svg",altText:o.media.altText,path:FWo(o.media.path).with({query:JSON.stringify({moduleId:"vs/workbench/contrib/welcomeGettingStarted/common/media/"+o.media.path})})}:o.media.type==="markdown"?{type:"markdown",path:FWo(o.media.path).with({query:JSON.stringify({moduleId:"vs/workbench/contrib/welcomeGettingStarted/common/media/"+o.media.path})}),base:In.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),root:In.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/")}:{type:"video",path:RYt(In.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),o.media.path),altText:o.media.altText,root:In.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),poster:o.media.poster?RYt(In.asFileUri("vs/workbench/contrib/welcomeGettingStarted/common/media/"),o.media.poster):void 0}}))})}),OWo.setHandler((e,{added:t,removed:o})=>{t.map(n=>this.registerExtensionWalkthroughContributions(n.description)),o.map(n=>this.unregisterExtensionWalkthroughContributions(n.description))})}initCompletionEventListeners(){this._register(this.commandService.onDidExecuteCommand(e=>this.progressByEvent(`onCommand:${e.commandId}`))),this.extensionManagementService.getInstalled().then(e=>{e.forEach(t=>this.progressByEvent(`extensionInstalled:${t.identifier.id.toLowerCase()}`))}),this._register(this.extensionManagementService.onDidInstallExtensions(e=>{for(let t of e)t?.context?.[vH]||t?.context?.[_Rt]||this.sessionInstalledExtensions.add(t.identifier.id.toLowerCase()),this.progressByEvent(`extensionInstalled:${t.identifier.id.toLowerCase()}`)})),this._register(this.contextService.onDidChangeContext(e=>{e.affectsSome(this.stepCompletionContextKeys)&&this.stepCompletionContextKeyExpressions.forEach(t=>{e.affectsSome(new Set(t.keys()))&&this.contextService.contextMatchesRules(t)&&this.progressByEvent("onContext:"+t.serialize())})})),this._register(this.viewsService.onDidChangeViewVisibility(e=>{e.visible&&this.progressByEvent("onView:"+e.id)})),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectedKeys.forEach(t=>{this.progressByEvent("onSettingChanged:"+t)})})),this.userDataSyncEnablementService.isEnabled()&&this.progressByEvent("onEvent:sync-enabled"),this._register(this.userDataSyncEnablementService.onDidChangeEnablement(()=>{this.userDataSyncEnablementService.isEnabled()&&this.progressByEvent("onEvent:sync-enabled")}))}markWalkthroughOpened(e){let t=this.gettingStartedContributions.get(e),o=this.metadata.get(e);o&&t&&this.metadata.set(e,{...o,manaullyOpened:!0,stepIDs:t.steps.map(n=>n.id)}),this.storageService.store(LYt,JSON.stringify([...this.metadata.entries()]),0,0)}async registerExtensionWalkthroughContributions(e){let t=c=>c.startsWith("https://")?A.parse(c,!0):In.uriToFileUri(Ve(e.extensionLocation,c)),o=c=>{let u=p=>p.startsWith("https://")?A.parse(p,!0):In.uriToBrowserUri(Ve(e.extensionLocation,p));if(typeof c=="string"){let p=u(c);return{hcDark:p,hcLight:p,dark:p,light:p}}else return{hcDark:u(c.hc),hcLight:u(c.hcLight??c.light),light:u(c.light),dark:u(c.dark)}};if(!e.contributes?.walkthroughs?.length)return;let n,r=Math.min();await Promise.all(e.contributes?.walkthroughs?.map(async(c,u)=>{let p=e.identifier.value+"#"+c.id,h=!this.metadata.get(p);h&&this.metadata.set(p,{firstSeen:+new Date,stepIDs:c.steps?.map(y=>y.id)??[],manaullyOpened:!1});let g=await Promise.race([this.tasExperimentService?.getTreatment(`gettingStarted.overrideCategory.${e.identifier.value+"."+c.id}.when`),new Promise(y=>setTimeout(()=>y(c.when),5e3))]);this.sessionInstalledExtensions.has(e.identifier.value.toLowerCase())&&this.contextService.contextMatchesRules(C.deserialize(g??c.when)??C.true())&&(this.sessionInstalledExtensions.delete(e.identifier.value.toLowerCase()),u<r&&h&&(n=p,r=u));let f=(c.steps??[]).map((y,w)=>{let x=smt(y.description||""),E=e.identifier.value+"#"+c.id+"#"+y.id,M;if(!y.media)throw Error("missing media in walkthrough step: "+c.id+"@"+y.id);if(y.media.image){let N=y.media.altText;N===void 0&&console.error("Walkthrough item:",E,"is missing altText for its media element."),M={type:"image",altText:N,path:o(y.media.image)}}else if(y.media.markdown)M={type:"markdown",path:t(y.media.markdown),base:t(yd(y.media.markdown)),root:In.uriToFileUri(e.extensionLocation)};else if(y.media.svg)M={type:"svg",path:t(y.media.svg),altText:y.media.svg};else if(y.media.video){let N=In.uriToFileUri(e.extensionLocation);M={type:"video",path:RYt(N,y.media.video),root:In.uriToFileUri(e.extensionLocation),altText:y.media.altText,poster:y.media.poster?RYt(N,y.media.poster):void 0}}else throw new Error("Unknown walkthrough format detected for "+E);return{description:x,media:M,completionEvents:y.completionEvents?.filter(N=>typeof N=="string")??[],id:E,title:y.title,when:C.deserialize(y.when)??C.true(),category:p,order:w}}),v=!1;if(c.featuredFor){let y=this.workspaceContextService.getWorkspace().folders.map(x=>x.uri),w=new qe;setTimeout(()=>w.cancel(),2e3),v=await this.instantiationService.invokeFunction(x=>ZRe(x,y,c.featuredFor,w.token))}let b=c.icon??e.icon,S={description:c.description,title:c.title,id:p,isFeatured:v,source:e.displayName??e.name,order:0,walkthroughPageTitle:e.displayName??e.name,steps:f,icon:b?{type:"image",path:In.uriToBrowserUri(Ve(e.extensionLocation,b)).toString(!0)}:{icon:cqt,type:"icon"},when:C.deserialize(g??c.when)??C.true()};this._registerWalkthrough(S),this._onDidAddWalkthrough.fire(this.resolveWalkthrough(S))})),this.storageService.store(LYt,JSON.stringify([...this.metadata.entries()]),0,0);let s=await this.hostService.hadLastFocus(),l=this.configurationService.getValue("workbench.startupEditor");s&&n&&this.configurationService.getValue("workbench.welcomePage.walkthroughs.openOnInstall")&&l!=="agentSessionsWelcomePage"&&(this.telemetryService.publicLog2("gettingStarted.didAutoOpenWalkthrough",{id:n}),this.editorService.activeEditor instanceof av&&this.commandService.executeCommand("workbench.action.keepEditor"),this.commandService.executeCommand("workbench.action.openWalkthrough",n,{inactive:this.layoutService.hasFocus("workbench.parts.editor")}))}unregisterExtensionWalkthroughContributions(e){e.contributes?.walkthroughs?.length&&e.contributes?.walkthroughs?.forEach(t=>{let o=e.identifier.value+"#"+t.id;t.steps.forEach(n=>{let r=e.identifier.value+"#"+t.id+"#"+n.id;this.steps.delete(r)}),this.gettingStartedContributions.delete(o),this._onDidRemoveWalkthrough.fire(o)})}getWalkthrough(e){let t=this.gettingStartedContributions.get(e);if(!t)throw Error("Trying to get unknown walkthrough: "+e);return this.resolveWalkthrough(t)}getWalkthroughs(){return[...this.gettingStartedContributions.values()].map(o=>({...o,content:{type:"steps",steps:o.steps}})).filter(o=>o.content.type!=="steps"||o.content.steps.length).filter(o=>o.id!=="NewWelcomeExperience").map(o=>this.resolveWalkthrough(o))}resolveWalkthrough(e){let t=e.steps.map(h=>this.getStepProgress(h)),o=this.metadata.get(e.id)?.manaullyOpened,n=this.metadata.get(e.id)?.firstSeen,r=n&&n>+new Date-MGi,s=this.metadata.get(e.id)?.stepIDs,l=this.gettingStartedContributions.get(e.id);if(!l)throw Error("Could not find walkthrough with id "+e.id);let c=l.steps.map(h=>h.id),u=s&&(c.length!==s.length||c.some((h,g)=>h!==s[g])),p=0;if(n){let g=+new Date-n;p=Math.max(0,(MGi-g)/MGi)}return{...e,recencyBonus:p,steps:t,newItems:!!u,newEntry:!!(r&&!o)}}getStepProgress(e){return{...e,done:!1,...this.stepProgress[e.id]}}progressStep(e){let t=this.stepProgress[e];if(!t||t.done!==!0){this.stepProgress[e]={done:!0},this.memento.saveMemento();let o=this.getStep(e);if(!o)throw Error("Tried to progress unknown step");this._onDidProgressStep.fire(this.getStepProgress(o))}}deprogressStep(e){delete this.stepProgress[e],this.memento.saveMemento();let t=this.getStep(e);this._onDidProgressStep.fire(this.getStepProgress(t))}progressByEvent(e){this.sessionEvents.has(e)||(this.sessionEvents.add(e),this.completionListeners.get(e)?.forEach(t=>this.progressStep(t)))}registerWalkthrough(e){this._registerWalkthrough({...e,steps:e.steps.map(t=>({...t,description:smt(t.description)}))})}_registerWalkthrough(e){if(this.gettingStartedContributions.get(e.id)){console.error(`Skipping attempt to overwrite walkthrough. (${e.id})`);return}this.gettingStartedContributions.set(e.id,e),e.steps.forEach(o=>{if(this.steps.has(o.id))throw Error("Attempting to register step with id "+o.id+" twice. Second is dropped.");this.steps.set(o.id,o),o.when.keys().forEach(n=>this.categoryVisibilityContextKeys.add(n)),this.registerDoneListeners(o)}),e.when.keys().forEach(o=>this.categoryVisibilityContextKeys.add(o))}registerDoneListeners(e){if(e.doneOn){console.error("wakthrough step",e,"uses deprecated 'doneOn' property. Adopt 'completionEvents' to silence this warning");return}e.completionEvents.length||(e.completionEvents=ui(e.description.filter(t=>t.nodes.length===1).flatMap(t=>t.nodes.filter((o=>typeof o!="string")).map(({href:o})=>{if(o.startsWith("command:"))return"onCommand:"+o.slice(8,o.includes("?")?o.indexOf("?"):void 0);if(o.startsWith("https://")||o.startsWith("http://"))return"onLink:"+o})))),e.completionEvents.length||e.completionEvents.push("stepSelected");for(let t of e.completionEvents){let[o,n,r]=/^([^:]*):?(.*)$/.exec(t)??[];if(!n){console.error(`Unknown completionEvent ${t} when registering step ${e.id}`);continue}switch(n){case"onLink":case"onEvent":case"onView":case"onSettingChanged":break;case"onContext":{let s=C.deserialize(r);s?(this.stepCompletionContextKeyExpressions.add(s),s.keys().forEach(l=>this.stepCompletionContextKeys.add(l)),t=n+":"+s.serialize(),this.contextService.contextMatchesRules(s)&&this.sessionEvents.add(t)):console.error("Unable to parse context key expression:",s,"in walkthrough step",e.id);break}case"onStepSelected":case"stepSelected":t="stepSelected:"+e.id;break;case"onCommand":t=n+":"+r.replace(/^toSide:/,"");break;case"onExtensionInstalled":case"extensionInstalled":t="extensionInstalled:"+r.toLowerCase();break;default:console.error(`Unknown completionEvent ${t} when registering step ${e.id}`);continue}this.registerCompletionListener(t,e)}}registerCompletionListener(e,t){this.completionListeners.has(e)||this.completionListeners.set(e,new Set),this.completionListeners.get(e)?.add(t.id)}getStep(e){let t=this.steps.get(e);if(!t)throw Error("Attempting to access step which does not exist in registry "+e);return t}};rmt=I([m(0,de),m(1,fe),m(2,F),m(3,Ae),m(4,X),m(5,Yl),m(6,B),m(7,xs),m(8,ti),m(9,Gt),m(10,_e),m(11,wN),m(12,wi),m(13,ie)],rmt);var smt=a=>a.split(`
`).filter(i=>i).map(i=>ZS(i)),FWo=a=>a.startsWith("https://")?A.parse(a,!0):In.asFileUri(`vs/workbench/contrib/welcomeGettingStarted/common/media/${a}`),nmt=a=>a.startsWith("https://")?A.parse(a,!0):In.asBrowserUri(`vs/workbench/contrib/welcomeGettingStarted/common/media/${a}`),tRn=a=>{if(typeof a=="string"){let i=nmt(a);return{hcDark:i,hcLight:i,dark:i,light:i}}else return{hcDark:nmt(a.hc),hcLight:nmt(a.hcLight??a.light),light:nmt(a.light),dark:nmt(a.dark)}},RYt=(a,i)=>{let e=t=>t.startsWith("https://")?A.parse(t,!0):ioe(Ve(a,t));if(typeof i=="string"){let t=e(i);return{hcDark:t,hcLight:t,dark:t,light:t}}else return{hcDark:e(i.hc),hcLight:e(i.hcLight??i.light),light:e(i.light),dark:e(i.dark)}};W(class extends z{constructor(){super({id:"resetGettingStartedProgress",category:P(17963,"Developer"),title:P(17965,"Reset Welcome Page Walkthrough Progress"),f1:!0,metadata:{description:P(17964,"Reset the progress of all Walkthrough steps on the Welcome Page to make them appear as if they are being viewed for the first time, providing a fresh start to the getting started experience.")}})}run(a){let i=a.get(tA),e=a.get(de);e.store(MYt,JSON.stringify([]),0,0),e.store(LYt,JSON.stringify([]),0,0);let t=new $l("gettingStartedService",a.get(de)),o=t.getMemento(0,0);for(let n in o)if(Object.prototype.hasOwnProperty.call(o,n))try{i.deprogressStep(n)}catch(r){console.error(r)}t.saveMemento()}});Ce(tA,rmt,1);var PGi=class{getHeight(i){return 22}getTemplateId(i){return"HelpItemTemplate"}},AGi=class{constructor(){this.templateId="HelpItemTemplate"}renderTemplate(i){i.classList.add("remote-help-tree-node-item");let e=D(i,_(".remote-help-tree-node-item-icon"));return{parent:i,icon:e}}renderElement(i,e,t){let o=t.parent;D(o,t.icon),t.icon.classList.add(...i.element.iconClasses);let n=D(o,_(".help-item-label"));n.innerText=i.element.label}disposeTemplate(i){}},NGi=class{hasChildren(i){return i instanceof lmt}getChildren(i){return i instanceof lmt&&i.items?i.items:[]}},lmt=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.viewModel=e;this.openerService=t;this.quickInputService=o;this.commandService=n;this.remoteExplorerService=r;this.environmentService=s;this.workspaceContextService=l;this.walkthroughsService=c;this.updateItems(),this._register(e.onDidChangeHelpInformation(()=>this.updateItems()))}createHelpItemValue(e,t){return new OGi(this.commandService,this.walkthroughsService,e.extensionDescription,typeof e.remoteName=="string"?[e.remoteName]:e.remoteName,e.virtualWorkspace,e[t])}updateItems(){let e=[],t=this.viewModel.helpInformation.filter(r=>r.getStarted);if(t.length){let r=t.map(l=>this.createHelpItemValue(l,"getStarted")),s=this.items?.find(l=>l.icon===iTi)??new FGi(iTi,d(14523,null),r,this.quickInputService,this.environmentService,this.openerService,this.remoteExplorerService,this.workspaceContextService,this.commandService);s.values=r,e.push(s)}let o=this.viewModel.helpInformation.filter(r=>r.documentation);if(o.length){let r=o.map(l=>this.createHelpItemValue(l,"documentation")),s=this.items?.find(l=>l.icon===oTi)??new PYt(oTi,d(14522,null),r,this.quickInputService,this.environmentService,this.openerService,this.remoteExplorerService,this.workspaceContextService);s.values=r,e.push(s)}let n=this.viewModel.helpInformation.filter(r=>r.issues);if(n.length){let r=n.map(l=>this.createHelpItemValue(l,"issues")),s=this.items?.find(l=>l.icon===nTi)??new PYt(nTi,d(14524,null),r,this.quickInputService,this.environmentService,this.openerService,this.remoteExplorerService,this.workspaceContextService);s.values=r,e.push(s)}if(e.length){let r=this.viewModel.helpInformation.map(l=>this.createHelpItemValue(l,"reportIssue")),s=this.items?.find(l=>l.icon===rTi)??new WGi(rTi,d(14525,null),r,this.quickInputService,this.environmentService,this.commandService,this.openerService,this.remoteExplorerService,this.workspaceContextService);s.values=r,e.push(s)}e.length&&(this.items=e)}},OGi=class{constructor(i,e,t,o,n,r){this.commandService=i;this.walkthroughService=e;this.extensionDescription=t;this.remoteAuthority=o;this.virtualWorkspace=n;this.urlOrCommandOrId=r}get description(){return this.getUrl().then(()=>this._description)}get url(){return this.getUrl()}async getUrl(){if(this._url===void 0){if(typeof this.urlOrCommandOrId=="string")if(A.parse(this.urlOrCommandOrId).authority)this._url=this.urlOrCommandOrId;else{let e=this.commandService.executeCommand(this.urlOrCommandOrId).then(o=>(this._url=o,this._url)),t=new Promise(o=>setTimeout(()=>o(""),500));this._url=await Promise.race([e,t])}else if(this.urlOrCommandOrId?.id)try{let i=`${this.extensionDescription.id}#${this.urlOrCommandOrId.id}`,e=await this.walkthroughService.getWalkthrough(i);this._description=e.title,this._url=i}catch{}}return this._url===void 0&&(this._url=""),this._url}},cmt=class{constructor(i,e,t,o,n,r,s){this.icon=i;this.label=e;this.values=t;this.quickInputService=o;this.environmentService=n;this.remoteExplorerService=r;this.workspaceContextService=s;this.iconClasses=[];this.iconClasses.push(...q.asClassNameArray(i)),this.iconClasses.push("remote-help-tree-node-item-icon")}async getActions(){return(await Promise.all(this.values.map(async i=>({label:i.extensionDescription.displayName||i.extensionDescription.identifier.value,description:await i.description??await i.url,url:await i.url,extensionDescription:i.extensionDescription})))).filter(i=>i.description)}async handleClick(){let i=this.environmentService.remoteAuthority;if(i){for(let e=0;e<this.remoteExplorerService.targetType.length;e++)if(i.startsWith(this.remoteExplorerService.targetType[e])){for(let t of this.values)if(t.remoteAuthority){for(let o of t.remoteAuthority)if(i.startsWith(o)){await this.takeAction(t.extensionDescription,await t.url);return}}}}else{let e=PM(this.workspaceContextService.getWorkspace())?.scheme;if(e){for(let t=0;t<this.remoteExplorerService.targetType.length;t++)for(let o of this.values)if(o.virtualWorkspace&&o.remoteAuthority){for(let n of o.remoteAuthority)if(this.remoteExplorerService.targetType[t].startsWith(n)&&e.startsWith(o.virtualWorkspace)){await this.takeAction(o.extensionDescription,await o.url);return}}}}if(this.values.length>1){let e=await this.getActions();if(e.length){let t=await this.quickInputService.pick(e,{placeHolder:d(14511,null)});t&&await this.takeAction(t.extensionDescription,t.url)}}else await this.takeAction(this.values[0].extensionDescription,await this.values[0].url)}},FGi=class extends cmt{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r,l,c);this.openerService=s;this.commandService=u}async takeAction(e,t){if([Q.http,Q.https].includes(A.parse(t).scheme)){this.openerService.open(t,{allowCommands:!0});return}this.commandService.executeCommand("workbench.action.openWalkthrough",t)}},PYt=class extends cmt{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,l,c);this.openerService=s}async takeAction(e,t){await this.openerService.open(A.parse(t),{allowCommands:!0})}},WGi=class extends cmt{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r,c,u);this.commandService=s;this.openerService=l}async getActions(){return Promise.all(this.values.map(async e=>({label:e.extensionDescription.displayName||e.extensionDescription.identifier.value,description:"",url:await e.url,extensionDescription:e.extensionDescription})))}async takeAction(e,t){t?await this.openerService.open(A.parse(t)):await this.commandService.executeCommand("workbench.action.openIssueReporter",[e.identifier.value])}},EIe=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(t,o,n,s,r,c,l,u,v,b);this.viewModel=e;this.quickInputService=p;this.commandService=h;this.remoteExplorerService=g;this.environmentService=f;this.workspaceContextService=S;this.walkthroughsService=y}static{this.ID="~remote.helpPanel"}static{this.TITLE=P(14521,"Help and feedback")}renderBody(e){super.renderBody(e),e.classList.add("remote-help");let t=document.createElement("div");t.classList.add("remote-help-content"),e.appendChild(t),this.tree=this.instantiationService.createInstance(Rp,"RemoteHelp",t,new PGi,[new AGi],new NGi,{accessibilityProvider:{getAriaLabel:n=>n.label,getWidgetAriaLabel:()=>d(14526,null)}});let o=this._register(new lmt(this.viewModel,this.openerService,this.quickInputService,this.commandService,this.remoteExplorerService,this.environmentService,this.workspaceContextService,this.walkthroughsService));this.tree.setInput(o),this._register(U.debounce(this.tree.onDidOpen,(n,r)=>r,75,!0)(n=>{n.element?.handleClick()}))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}};EIe=I([m(2,Le),m(3,Xe),m(4,X),m(5,B),m(6,F),m(7,ji),m(8,Je),m(9,$e),m(10,fe),m(11,Wu),m(12,Mt),m(13,Pe),m(14,ot),m(15,Ae),m(16,tA)],EIe);var VGi=class{constructor(i){this.id=EIe.ID;this.name=EIe.TITLE;this.canToggleVisibility=!0;this.hideByDefault=!1;this.group="help@50";this.order=-10;this.ctorDescriptor=new Vt(EIe,[i])}},amt=class extends rie{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super(bU,p.onDidChangeTargetType,r,e,t,n,s,l,c,u,o,h,g);this.remoteExplorerService=p;this.helpPanelDescriptor=new VGi(this);this.helpInformation=[];this._onDidChangeHelpInformation=this._register(new T);this.onDidChangeHelpInformation=this._onDidChangeHelpInformation.event;this.hasRegisteredHelpView=!1;this.addConstantViewDescriptors([this.helpPanelDescriptor]),this._register(this.remoteSwitcher=this.instantiationService.createInstance(AGe)),this._register(this.remoteExplorerService.onDidChangeHelpInformation(v=>{this._setHelpInformation(v)})),this._setHelpInformation(this.remoteExplorerService.helpInformation);let f=oe.as(Kn.ViewsRegistry);this.remoteSwitcher.createOptionItems(f.getViews(this.viewContainer)),this._register(f.onViewsRegistered(v=>{let b=[];for(let S of v)S.viewContainer.id===bU&&b.push(...S.views);b.length>0&&this.remoteSwitcher.createOptionItems(b)})),this._register(f.onViewsDeregistered(v=>{v.viewContainer.id===bU&&this.remoteSwitcher.removeOptionItems(v.views)}))}_setHelpInformation(e){let t=[];for(let n of e)this._handleRemoteInfoExtensionPoint(n,t);this.helpInformation=t,this._onDidChangeHelpInformation.fire();let o=oe.as(Kn.ViewsRegistry);this.helpInformation.length&&!this.hasRegisteredHelpView?(o.getView(this.helpPanelDescriptor.id)||o.registerViews([this.helpPanelDescriptor],this.viewContainer),this.hasRegisteredHelpView=!0):this.hasRegisteredHelpView&&(o.deregisterViews([this.helpPanelDescriptor],this.viewContainer),this.hasRegisteredHelpView=!1)}_handleRemoteInfoExtensionPoint(e,t){Va(e.description,"contribRemoteHelp")&&(!e.value.documentation&&!e.value.getStarted&&!e.value.issues||t.push({extensionDescription:e.description,getStarted:e.value.getStarted,documentation:e.value.documentation,reportIssue:e.value.reportIssue,issues:e.value.issues,remoteName:e.value.remoteName,virtualWorkspace:e.value.virtualWorkspace}))}getFilterOn(e){return vI(e.remoteAuthority)?e.remoteAuthority[0]:e.remoteAuthority}setFilter(e){this.remoteExplorerService.targetType=vI(e.remoteAuthority)?e.remoteAuthority:[e.remoteAuthority]}getTitle(){return d(14519,null)}};amt=I([m(0,wi),m(1,_e),m(2,Ae),m(3,de),m(4,B),m(5,F),m(6,Pe),m(7,Xe),m(8,lt),m(9,Wu),m(10,ji),m(11,re)],amt);oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:bU,title:P(14520,"Remote Explorer"),ctorDescriptor:new Vt(amt),hideIfEmpty:!0,viewOrderDelegate:{getOrder:a=>{if(!a)return;let i=/^targets@(\d+)$/.exec(a);if(i)return-1e3;if(i=/^details(@(\d+))?$/.exec(a),i)return-500+Number(i[2]);if(i=/^help(@(\d+))?$/.exec(a),i)return-10}},icon:nfo,order:4},0);var FGe=class{constructor(i,e){i.getEnvironment().then(t=>{t&&e.setPerformanceMarks("server",t.marks)})}};FGe=I([m(0,bo),m(1,Kx)],FGe);var BGi=class{get lastReport(){return this._lastReport}constructor(i,e,t,o,n){this.location=e,this._isDisposed=!1,this._lastReport=t,this._currentProgressPromiseResolve=null,this._currentProgress=null,this._currentTimer=null;let r=new Promise(s=>this._currentProgressPromiseResolve=s);i.withProgress({location:e,buttons:o},s=>(this._isDisposed||(this._currentProgress=s),r),s=>n(s,this._lastReport)),this._lastReport&&this.report()}dispose(){this._isDisposed=!0,this._currentProgressPromiseResolve&&(this._currentProgressPromiseResolve(),this._currentProgressPromiseResolve=null),this._currentProgress=null,this._currentTimer&&(this._currentTimer.dispose(),this._currentTimer=null)}report(i){i&&(this._lastReport=i),this._lastReport&&this._currentProgress&&this._currentProgress.report({message:this._lastReport})}startTimer(i){this.stopTimer(),this._currentTimer=new HGi(this,i)}stopTimer(){this._currentTimer&&(this._currentTimer.dispose(),this._currentTimer=null)}},HGi=class{constructor(i,e){this._parent=i,this._completionTime=e,this._renderInterval=Ly(ut,()=>this._render(),1e3),this._render()}dispose(){this._renderInterval.dispose()}_render(){let i=this._completionTime-Date.now();if(i<0)return;let e=Math.ceil(i/1e3);e===1?this._parent.report(d(14515,null,e)):this._parent.report(d(14514,null,e))}},WWo=40*1e3,WGe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._reloadWindowShown=!1;let u=e.getConnection();if(u){let v=function(M,N,V=null){return h&&(h.dispose(),h=null),M||(M=p?15:20),new BGi(t,M,V,N.map(H=>H.label),(H,K)=>{typeof H<"u"&&N[H]?N[H].callback():M===20?h=v(15,N,K):b()})},b=function(){h&&(h.dispose(),h=null)},p=!1;this._register(r.onShow(()=>p=!0)),this._register(r.onHide(()=>p=!1));let h=null,g=null,f=this._register(new ue),S="",y=0,w=0,x={label:d(14516,null),callback:()=>{g?.skipWait()}},E={label:d(14517,null),callback:()=>{c.publicLog2("remoteReconnectionReload",{remoteName:Gb(l.remoteAuthority),reconnectionToken:S,millisSinceLastIncomingData:Date.now()-y,attempt:w}),n.executeCommand(bte.ID)}};this._register(u.onDidStateChange(M=>{switch(h?.stopTimer(),f.clear(),M.type){case 0:S=M.reconnectionToken,y=Date.now()-M.millisSinceLastIncomingData,w=0,c.publicLog2("remoteConnectionLost",{remoteName:Gb(l.remoteAuthority),reconnectionToken:M.reconnectionToken}),(h||M.millisSinceLastIncomingData>WWo)&&(h||(h=v(null,[x,E])),h.report(d(14510,null)));break;case 1:h&&(g=M,h=v(null,[x,E]),h.startTimer(Date.now()+1e3*M.durationSeconds));break;case 2:S=M.reconnectionToken,y=Date.now()-M.millisSinceLastIncomingData,w=M.attempt,c.publicLog2("remoteReconnectionRunning",{remoteName:Gb(l.remoteAuthority),reconnectionToken:M.reconnectionToken,millisSinceLastIncomingData:M.millisSinceLastIncomingData,attempt:M.attempt}),(h||M.millisSinceLastIncomingData>WWo)&&(h=v(null,[E]),h.report(d(14513,null)),f.value=r.onShow(()=>{h&&h.location===20&&(h=v(15,[E],h.lastReport))}));break;case 3:S=M.reconnectionToken,y=Date.now()-M.millisSinceLastIncomingData,w=M.attempt,c.publicLog2("remoteReconnectionPermanentFailure",{remoteName:Gb(l.remoteAuthority),reconnectionToken:M.reconnectionToken,millisSinceLastIncomingData:M.millisSinceLastIncomingData,attempt:M.attempt,handled:M.handled}),b(),M.handled?s.info("Error handled: Not showing a notification for the error."):this._reloadWindowShown||(this._reloadWindowShown=!0,o.confirm({type:wt.Error,message:d(14512,null),primaryButton:d(14518,null)}).then(N=>{N.confirmed&&n.executeCommand(bte.ID)}));break;case 4:S=M.reconnectionToken,y=Date.now()-M.millisSinceLastIncomingData,w=M.attempt,c.publicLog2("remoteConnectionGain",{remoteName:Gb(l.remoteAuthority),reconnectionToken:M.reconnectionToken,millisSinceLastIncomingData:M.millisSinceLastIncomingData,attempt:M.attempt}),b();break}}))}}};WGe=I([m(0,bo),m(1,Go),m(2,ct),m(3,fe),m(4,$e),m(5,re),m(6,Mt),m(7,_e)],WGe);var ef=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N){super();this.statusbarService=e;this.environmentService=t;this.labelService=o;this.contextKeyService=n;this.menuService=r;this.quickInputService=s;this.commandService=l;this.extensionService=c;this.remoteAgentService=u;this.remoteAuthorityResolverService=p;this.hostService=h;this.workspaceContextService=g;this.logService=f;this.extensionGalleryService=v;this.telemetryService=b;this.productService=S;this.extensionManagementService=y;this.extensionsWorkbenchService=w;this.dialogService=x;this.lifecycleService=E;this.openerService=M;this.configurationService=N;this.virtualWorkspaceLocation=void 0;this.connectionState=void 0;this.connectionToken=void 0;this.networkState=void 0;this.measureNetworkConnectionLatencyScheduler=void 0;this.loggedInvalidGroupNames=Object.create(null);this._remoteExtensionMetadata=void 0;this.remoteMetadataInitialized=!1;this._onDidChangeEntries=this._register(new T);this.onDidChangeEntries=this._onDidChangeEntries.event;this.unrestrictedRemoteIndicatorMenu=this._register(this.menuService.createMenu(R.StatusBarWindowIndicatorMenu,this.contextKeyService)),this.remoteIndicatorMenu=this._register(this.menuService.createMenu(R.StatusBarRemoteIndicatorMenu,this.contextKeyService)),this.connectionStateContextKey=new Y("remoteConnectionState","").bindTo(this.contextKeyService),this.remoteAuthority?(this.connectionState="initializing",this.connectionStateContextKey.set(this.connectionState)):this.updateVirtualWorkspaceLocation(),this.registerActions(),this.registerListeners(),this.updateWhenInstalledExtensionsRegistered(),this.updateRemoteStatusIndicator()}static{this.ID="workbench.contrib.remoteStatusIndicator"}static{this.REMOTE_ACTIONS_COMMAND_ID="workbench.action.remote.showMenu"}static{this.CLOSE_REMOTE_COMMAND_ID="workbench.action.remote.close"}static{this.SHOW_CLOSE_REMOTE_COMMAND_ID=!Ft}static{this.INSTALL_REMOTE_EXTENSIONS_ID="workbench.action.remote.extensions"}static{this.DEFAULT_REMOTE_STATUS_LABEL="$(remote)"}static{this.REMOTE_STATUS_LABEL_MAX_LENGTH=40}static{this.REMOTE_CONNECTION_LATENCY_SCHEDULER_DELAY=60*1e3}static{this.REMOTE_CONNECTION_LATENCY_SCHEDULER_FIRST_RUN_DELAY=10*1e3}get remoteExtensionMetadata(){if(!this._remoteExtensionMetadata){let e={...this.productService.remoteExtensionTips,...this.productService.virtualWorkspaceExtensionTips};this._remoteExtensionMetadata=Object.values(e).filter(t=>t.startEntry!==void 0).map(t=>({id:t.extensionId,installed:!1,friendlyName:t.friendlyName,isPlatformCompatible:!1,dependencies:[],helpLink:t.startEntry?.helpLink??"",startConnectLabel:t.startEntry?.startConnectLabel??"",startCommand:t.startEntry?.startCommand??"",priority:t.startEntry?.priority??10,supportedPlatforms:t.supportedPlatforms})),this.remoteExtensionMetadata.sort((t,o)=>t.priority-o.priority)}return this._remoteExtensionMetadata}get remoteAuthority(){return this.environmentService.remoteAuthority}registerActions(){let e=P(14580,"Remote"),t=this;this._register(W(class extends z{constructor(){super({id:ef.REMOTE_ACTIONS_COMMAND_ID,category:e,title:P(14584,"Show Remote Menu"),f1:!0,keybinding:{weight:200,primary:2605}});this.run=()=>t.showRemoteMenu()}})),ef.SHOW_CLOSE_REMOTE_COMMAND_ID&&(this._register(W(class extends z{constructor(){super({id:ef.CLOSE_REMOTE_COMMAND_ID,category:e,title:P(14581,"Close Remote Connection"),f1:!0,precondition:C.and(C.or(Qb,AM),qo.negate())});this.run=()=>t.hostService.openWindow({forceReuseWindow:!0,remoteAuthority:null})}})),this.remoteAuthority&&be.appendMenuItem(R.MenubarFileMenu,{group:"6_close",command:{id:ef.CLOSE_REMOTE_COMMAND_ID,title:d(14575,null)},when:qo.negate(),order:3.5})),this.extensionGalleryService.isEnabled()&&this._register(W(class extends z{constructor(){super({id:ef.INSTALL_REMOTE_EXTENSIONS_ID,category:e,title:P(14582,"Install Remote Development Extensions"),f1:!0});this.run=(n,r)=>n.get(Ui).openSearch("@recommended:remotes")}}))}registerListeners(){let e=()=>{this.remoteMenuActionsGroups=void 0,this.updateRemoteStatusIndicator()};this._register(this.unrestrictedRemoteIndicatorMenu.onDidChange(e)),this._register(this.remoteIndicatorMenu.onDidChange(e)),this._register(this.labelService.onDidChangeFormatters(()=>this.updateRemoteStatusIndicator()));let t=this.environmentService.options?.windowIndicator;if(t&&t.onDidChange&&this._register(t.onDidChange(()=>this.updateRemoteStatusIndicator())),this.remoteAuthority){let o=this.remoteAgentService.getConnection();o&&this._register(o.onDidStateChange(n=>{switch(n.type){case 0:case 2:case 1:this.setConnectionState("reconnecting");break;case 3:this.setConnectionState("disconnected");break;case 4:this.setConnectionState("connected");break}}))}else this._register(this.workspaceContextService.onDidChangeWorkbenchState(()=>{this.updateVirtualWorkspaceLocation(),this.updateRemoteStatusIndicator()}));Ft&&this._register(U.any(this._register(new Zn(ut,"online")).event,this._register(new Zn(ut,"offline")).event)(()=>this.setNetworkState(navigator.onLine?"online":"offline"))),this._register(this.extensionService.onDidChangeExtensions(async o=>{for(let n of o.added){let r=this.remoteExtensionMetadata.findIndex(s=>hi.equals(s.id,n.identifier));r>-1&&(this.remoteExtensionMetadata[r].installed=!0)}})),this._register(this.extensionManagementService.onDidUninstallExtension(async o=>{let n=this.remoteExtensionMetadata.findIndex(r=>hi.equals(r.id,o.identifier.id));n>-1&&(this.remoteExtensionMetadata[n].installed=!1)}))}async initializeRemoteMetadata(){if(this.remoteMetadataInitialized)return;let e=oD(xm);for(let t=0;t<this.remoteExtensionMetadata.length;t++){let o=this.remoteExtensionMetadata[t].id,n=this.remoteExtensionMetadata[t].supportedPlatforms,r=!!(await this.extensionManagementService.getInstalled()).find(s=>hi.equals(s.identifier.id,o));this.remoteExtensionMetadata[t].installed=r,r?this.remoteExtensionMetadata[t].isPlatformCompatible=!0:n&&!n.includes(e)?this.remoteExtensionMetadata[t].isPlatformCompatible=!1:this.remoteExtensionMetadata[t].isPlatformCompatible=!0}this.remoteMetadataInitialized=!0,this._onDidChangeEntries.fire(),this.updateRemoteStatusIndicator()}updateVirtualWorkspaceLocation(){this.virtualWorkspaceLocation=PM(this.workspaceContextService.getWorkspace())}async updateWhenInstalledExtensionsRegistered(){await this.extensionService.whenInstalledExtensionsRegistered();let e=this.remoteAuthority;e&&(async()=>{try{let{authority:t}=await this.remoteAuthorityResolverService.resolveAuthority(e);this.connectionToken=t.connectionToken,this.setConnectionState("connected")}catch{this.setConnectionState("disconnected")}})(),this.updateRemoteStatusIndicator(),this.initializeRemoteMetadata()}setConnectionState(e){this.connectionState!==e&&(this.connectionState=e,this.connectionState==="reconnecting"?this.connectionStateContextKey.set("disconnected"):this.connectionStateContextKey.set(this.connectionState),this.updateRemoteStatusIndicator(),e==="connected"&&this.scheduleMeasureNetworkConnectionLatency())}scheduleMeasureNetworkConnectionLatency(){!this.remoteAuthority||this.measureNetworkConnectionLatencyScheduler||(this.measureNetworkConnectionLatencyScheduler=this._register(new Dt(()=>this.measureNetworkConnectionLatency(),ef.REMOTE_CONNECTION_LATENCY_SCHEDULER_DELAY)),this.measureNetworkConnectionLatencyScheduler.schedule(ef.REMOTE_CONNECTION_LATENCY_SCHEDULER_FIRST_RUN_DELAY))}async measureNetworkConnectionLatency(){if(this.hostService.hasFocus&&this.networkState!=="offline"){let e=await L0.measure(this.remoteAgentService);e&&(e.high?this.setNetworkState("high-latency"):this.networkState==="high-latency"&&this.setNetworkState("online"))}this.measureNetworkConnectionLatencyScheduler?.schedule()}setNetworkState(e){if(this.networkState!==e){let t=this.networkState;this.networkState=e,e==="high-latency"&&this.logService.warn(`Remote network connection appears to have high latency (${L0.latency?.current?.toFixed(2)}ms last, ${L0.latency?.average?.toFixed(2)}ms average)`),this.connectionToken&&(e==="online"&&t==="high-latency"?this.logNetworkConnectionHealthTelemetry(this.connectionToken,"good"):e==="high-latency"&&t==="online"&&this.logNetworkConnectionHealthTelemetry(this.connectionToken,"poor")),this.updateRemoteStatusIndicator()}}logNetworkConnectionHealthTelemetry(e,t){this.telemetryService.publicLog2("remoteConnectionHealth",{remoteName:Gb(this.remoteAuthority),reconnectionToken:e,connectionHealth:t})}validatedGroup(e){return e.match(/^(remote|virtualfs)_(\d\d)_(([a-z][a-z0-9+.-]*)_(.*))$/)?!0:(this.loggedInvalidGroupNames[e]||(this.loggedInvalidGroupNames[e]=!0,this.logService.warn(`Invalid group name used in "statusBar/remoteIndicator" menu contribution: ${e}. Entries ignored. Expected format: 'remote_$ORDER_$REMOTENAME_$GROUPING or 'virtualfs_$ORDER_$FILESCHEME_$GROUPING.`)),!1)}getRemoteMenuActions(e){return(!this.remoteMenuActionsGroups||e)&&(this.remoteMenuActionsGroups=this.remoteIndicatorMenu.getActions().filter(t=>this.validatedGroup(t[0])).concat(this.unrestrictedRemoteIndicatorMenu.getActions())),this.remoteMenuActionsGroups}updateRemoteStatusIndicator(){let e=this.environmentService.options?.windowIndicator;if(e){let t=e.label.trim();t.startsWith("$(")||(t=`$(remote) ${t}`),this.renderRemoteStatusIndicator(tF(t,ef.REMOTE_STATUS_LABEL_MAX_LENGTH),e.tooltip,e.command);return}if(this.remoteAuthority){let t=this.labelService.getHostLabel(Q.vscodeRemote,this.remoteAuthority)||this.remoteAuthority;switch(this.connectionState){case"initializing":this.renderRemoteStatusIndicator(d(14572,null),d(14572,null),void 0,!0);break;case"reconnecting":this.renderRemoteStatusIndicator(`${d(14573,null,tF(t,ef.REMOTE_STATUS_LABEL_MAX_LENGTH))}`,void 0,void 0,!0);break;case"disconnected":this.renderRemoteStatusIndicator(`$(alert) ${d(14571,null,tF(t,ef.REMOTE_STATUS_LABEL_MAX_LENGTH))}`);break;default:{let o=new he("",{isTrusted:!0,supportThemeIcons:!0}),n=this.labelService.getHostTooltip(Q.vscodeRemote,this.remoteAuthority);n?o.appendMarkdown(n):o.appendText(d(14574,null,t)),this.renderRemoteStatusIndicator(`$(remote) ${tF(t,ef.REMOTE_STATUS_LABEL_MAX_LENGTH)}`,o)}}return}if(this.virtualWorkspaceLocation){let t=this.labelService.getHostLabel(this.virtualWorkspaceLocation.scheme,this.virtualWorkspaceLocation.authority);if(t){let o=new he("",{isTrusted:!0,supportThemeIcons:!0}),n=this.labelService.getHostTooltip(this.virtualWorkspaceLocation.scheme,this.virtualWorkspaceLocation.authority);n?o.appendMarkdown(n):o.appendText(d(14592,null,t)),(!Ft||this.remoteAuthority)&&(o.appendMarkdown(`

`),o.appendMarkdown(d(14593,null,`command:${zH}`))),this.renderRemoteStatusIndicator(`$(remote) ${tF(t,ef.REMOTE_STATUS_LABEL_MAX_LENGTH)}`,o);return}}this.renderRemoteStatusIndicator(ef.DEFAULT_REMOTE_STATUS_LABEL,d(14578,null))}renderRemoteStatusIndicator(e,t,o,n){let{text:r,tooltip:s,ariaLabel:l}=this.withNetworkStatus(e,t,n),c={name:d(14589,null),kind:this.networkState==="offline"?"offline":r!==ef.DEFAULT_REMOTE_STATUS_LABEL?"remote":void 0,ariaLabel:l,text:r,showProgress:n,tooltip:s,command:o??ef.REMOTE_ACTIONS_COMMAND_ID};this.remoteStatusEntry?this.remoteStatusEntry.update(c):this.remoteStatusEntry=this.statusbarService.addEntry(c,"status.host",0,Number.POSITIVE_INFINITY)}withNetworkStatus(e,t,o){let n=e,r=t,s=AK(n);function l(){return!o&&e.startsWith(ef.DEFAULT_REMOTE_STATUS_LABEL)?e.replace(ef.DEFAULT_REMOTE_STATUS_LABEL,"$(alert)"):e}switch(this.networkState){case"offline":{let c=d(14577,null);n=l(),r=this.appendTooltipLine(r,c),s=`${s}, ${c}`;break}case"high-latency":n=l(),r=this.appendTooltipLine(r,d(14576,null,L0.latency?.current?.toFixed(2),L0.latency?.average?.toFixed(2)));break}return{text:n,tooltip:r,ariaLabel:s}}appendTooltipLine(e,t){let o;return typeof e=="string"?o=new he(e,{isTrusted:!0,supportThemeIcons:!0}):o=e??new he("",{isTrusted:!0,supportThemeIcons:!0}),o.value.length>0&&o.appendMarkdown(`

`),o.appendMarkdown(t),o}async installExtension(e,t){try{await this.extensionsWorkbenchService.install(e,{isMachineScoped:!1,donotIncludePackAndDependencies:!1,context:{[vH]:!0}})}catch(o){if(!this.lifecycleService.willShutdown){let{confirmed:n}=await this.dialogService.confirm({type:wt.Error,message:d(14591,null,t),detail:o&&!Yi(o)?Mn(o):void 0,primaryButton:d(14590,null)});if(n)return this.installExtension(e,t)}throw o}}async runRemoteStartCommand(e,t){await g8i(async()=>{let o=await this.extensionService.getExtension(e);if(!o)throw Error("Failed to find installed remote extension");return o},300,10),this.commandService.executeCommand(t),this.telemetryService.publicLog2("workbenchActionExecuted",{id:"remoteInstallAndRun",detail:e,from:"remote indicator"})}showRemoteMenu(){let e=s=>{if(s.item.category)return typeof s.item.category=="string"?s.item.category:s.item.category.value},t=()=>{if(this.remoteAuthority)return new RegExp(`^remote_\\d\\d_${Gb(this.remoteAuthority)}_`);if(this.virtualWorkspaceLocation)return new RegExp(`^virtualfs_\\d\\d_${this.virtualWorkspaceLocation.scheme}_`)},o=()=>{let s=this.getRemoteMenuActions(!0),l=[],c=t();c&&(s=s.sort((g,f)=>{let v=c.test(g[0]),b=c.test(f[0]);return v!==b?v?-1:1:g[0]!==""&&f[0]===""?-1:g[0]===""&&f[0]!==""?1:g[0].localeCompare(f[0])}));let u;for(let g of s){let f=!1;for(let v of g[1])if(v instanceof Do){if(!f){let S=e(v);S!==u&&(l.push({type:"separator",label:S}),u=S),f=!0}let b=typeof v.item.title=="string"?v.item.title:v.item.title.value;l.push({type:"item",id:v.item.id,label:b})}}if(this.configurationService.getValue("workbench.remoteIndicator.showExtensionRecommendations")&&this.extensionGalleryService.isEnabled()&&this.remoteMetadataInitialized){let g=[];for(let f of this.remoteExtensionMetadata)if(!f.installed&&f.isPlatformCompatible){let v=f.startConnectLabel,b=[{iconClass:q.asClassName(Ef),tooltip:d(14585,null)}];g.push({type:"item",id:f.id,label:v,buttons:b})}l.push({type:"separator",label:d(14586,null)}),l.push(...g)}l.push({type:"separator"});let h=l.length;return ef.SHOW_CLOSE_REMOTE_COMMAND_ID&&(this.remoteAuthority?(l.push({type:"item",id:ef.CLOSE_REMOTE_COMMAND_ID,label:d(14569,null)}),this.connectionState==="disconnected"&&l.push({type:"item",id:bte.ID,label:d(14579,null)})):this.virtualWorkspaceLocation&&l.push({type:"item",id:ef.CLOSE_REMOTE_COMMAND_ID,label:d(14570,null)})),l.length===h&&l.pop(),l},n=new O,r=n.add(this.quickInputService.createQuickPick({useSeparators:!0}));r.placeholder=d(14588,null),r.items=o(),r.sortByLabel=!1,r.canSelectMany=!1,n.add(U.once(r.onDidAccept)((async s=>{let l=r.selectedItems;if(l.length===1){let c=l[0].id,u=this.remoteExtensionMetadata.find(p=>hi.equals(p.id,c));if(u){r.items=[],r.busy=!0,r.placeholder=d(14587,null);try{await this.installExtension(u.id,l[0].label)}catch{return}finally{r.hide()}await this.runRemoteStartCommand(u.id,u.startCommand)}else this.telemetryService.publicLog2("workbenchActionExecuted",{id:c,from:"remote indicator"}),this.commandService.executeCommand(c),r.hide()}}))),n.add(U.once(r.onDidTriggerItemButton)(async s=>{let l=this.remoteExtensionMetadata.find(c=>hi.equals(c.id,s.item.id));l&&await this.openerService.open(A.parse(l.helpLink))})),n.add(this.unrestrictedRemoteIndicatorMenu.onDidChange(()=>r.items=o())),n.add(this.remoteIndicatorMenu.onDidChange(()=>r.items=o())),n.add(r.onDidHide(()=>n.dispose())),this.remoteMetadataInitialized||(r.busy=!0,n.add(this.onDidChangeEntries(()=>{r.busy=!1,r.items=o()}))),r.show()}};ef=I([m(0,Fr),m(1,Od),m(2,nt),m(3,X),m(4,Yt),m(5,$e),m(6,fe),m(7,lt),m(8,bo),m(9,dd),m(10,ti),m(11,Ae),m(12,re),m(13,ga),m(14,_e),m(15,Ze),m(16,xs),m(17,Ui),m(18,ct),m(19,to),m(20,Je),m(21,B)],ef);oe.as($t.Configuration).registerConfiguration({...jd,properties:{"workbench.remoteIndicator.showExtensionRecommendations":{type:"boolean",markdownDescription:d(14583,null),default:!0}}});var VWo="remote.unsupportedConnectionChoice",iRn="workbench.banner.remote.unsupportedConnection.dismissed",oRn="workbench.banner.remote.arm32Deprecation.dismissed",VGe=class{constructor(i,e,t,o,n,r,s,l,c){this._remoteAgentService=i;this._environmentService=e;this._telemetryService=t;this.bannerService=o;this.dialogService=n;this.openerService=r;this.hostService=s;this.storageService=l;this.productService=c;this._environmentService.remoteAuthority&&this._checkInitialRemoteConnectionHealth()}async _confirmConnection(){let i;(l=>(l[l.Allow=1]="Allow",l[l.LearnMore=2]="LearnMore",l[l.Cancel=0]="Cancel"))(i||={});let{result:e,checkboxChecked:t}=await this.dialogService.prompt({type:wt.Warning,message:d(14534,null,this.productService.nameLong),buttons:[{label:d(14527,null),run:()=>1},{label:d(14530,null),run:async()=>(await this.openerService.open("https://aka.ms/vscode-remote/faq/old-linux"),2)}],cancelButton:{run:()=>0},checkbox:{label:d(14531,null)}});if(e===2)return await this._confirmConnection();let o=e===1;return o&&t&&this.storageService.store(`${VWo}.${this._environmentService.remoteAuthority}`,o,0,1),o}async _checkInitialRemoteConnectionHealth(){try{let i=await this._remoteAgentService.getRawEnvironment(),e=i?.os===3&&i.arch==="arm";if(i&&i.isUnsupportedGlibc){let t=this.storageService.getBoolean(`${VWo}.${this._environmentService.remoteAuthority}`,0);if(t===void 0&&(t=await this._confirmConnection()),t)this._showVersionedBanner("unsupportedGlibcWarning.banner",iRn,d(14535,null,this.productService.nameLong),[{label:d(14533,null),href:"https://aka.ms/vscode-remote/faq/old-linux"}]);else{this.hostService.openWindow({forceReuseWindow:!0,remoteAuthority:null});return}}e&&this._showVersionedBanner("arm32ServerDeprecation.banner",oRn,d(14528,null,this.productService.nameLong),[{label:d(14529,null),href:"https://aka.ms/vscode-remote-linux-arm-32-eol"}]),this._telemetryService.publicLog2("remoteConnectionSuccess",{web:Ft,connectionTimeMs:await this._remoteAgentService.getConnection()?.getInitialConnectionTimeMs(),remoteName:Gb(this._environmentService.remoteAuthority),tunnelName:c_t(this._environmentService.remoteAuthority)}),await this._measureExtHostLatency()}catch(i){this._telemetryService.publicLog2("remoteConnectionFailure",{web:Ft,connectionTimeMs:await this._remoteAgentService.getConnection()?.getInitialConnectionTimeMs(),remoteName:Gb(this._environmentService.remoteAuthority),message:i?i.message:""})}}_showVersionedBanner(i,e,t,o){let n=this.storageService.get(e,0)??"";n.slice(0,n.lastIndexOf("."))!==this.productService.version.slice(0,this.productService.version.lastIndexOf("."))&&this.bannerService.show({id:i,message:t,actions:o,icon:L.warning,closeLabel:d(14532,null,this.productService.version),onClose:()=>{this.storageService.store(e,this.productService.version,0,1)}})}async _measureExtHostLatency(){let i=await L0.measure(this._remoteAgentService);i!==void 0&&this._telemetryService.publicLog2("remoteConnectionLatency",{web:Ft,remoteName:Gb(this._environmentService.remoteAuthority),latencyMs:i.current})}};VGe=I([m(0,bo),m(1,Mt),m(2,_e),m(3,LR),m(4,ct),m(5,Je),m(6,ti),m(7,de),m(8,Ze)],VGe);var BGe=oe.as(Zi.Workbench);bt(xIe.ID,xIe,vt.BlockRestore);bt(kIe.ID,kIe,vt.BlockRestore);BGe.registerWorkbenchContribution(WGe,4);bt(ef.ID,ef,vt.BlockStartup);BGe.registerWorkbenchContribution(sPe,3);BGe.registerWorkbenchContribution(aPe,4);BGe.registerWorkbenchContribution(lPe,4);BGe.registerWorkbenchContribution(FGe,4);BGe.registerWorkbenchContribution(VGe,3);var zGi=class a{static{this._grammars={}}constructor(i){Object.keys(a._grammars).length||this.fillModeScopeMap(i)}fillModeScopeMap(i){i.forEach(e=>{e.value.forEach(t=>{t.language&&t.scopeName&&(a._grammars[t.language]=t.scopeName)})})}getGrammar(i){return a._grammars[i]}},AYt=class a extends Mi{constructor(e){super(e);this._lastGrammarContributions=null;this._lastExtensionService=null;this.emmetActionName=e.actionName}static{this.emmetSupportedModes=["html","css","xml","xsl","haml","jade","jsx","slim","scss","sass","less","stylus","styl","svg"]}_withGrammarContributions(e){return this._lastExtensionService!==e&&(this._lastExtensionService=e,this._lastGrammarContributions=e.readExtensionPointContributions(BU).then(t=>new zGi(t))),this._lastGrammarContributions||Promise.resolve(null)}run(e,t){let o=e.get(lt),n=e.get(fe);return this._withGrammarContributions(o).then(r=>{if(this.id==="editor.emmet.action.expandAbbreviation"&&r)return n.executeCommand("emmet.expandAbbreviation",a.getLanguage(t,r))})}static getLanguage(e,t){let o=e.getModel(),n=e.getSelection();if(!o||!n)return null;let r=n.getStartPosition();o.tokenization.tokenizeIfCheap(r.lineNumber);let l=o.getLanguageIdAtPosition(r.lineNumber,r.column).split(".").pop();return l?{language:l,parentMode:(()=>{let u=t.getGrammar(l);if(!u)return l;let p=u.split(".");if(p.length<2)return l;for(let h=1;h<p.length;h++){let g=p[p.length-h];if(this.emmetSupportedModes.indexOf(g)!==-1)return g}return l})()}:null}};var KGi=class extends AYt{constructor(){super({id:"editor.emmet.action.expandAbbreviation",label:P(11265,"Emmet: Expand Abbreviation"),precondition:me.writable,actionName:"expand_abbreviation",kbOpts:{primary:2,kbExpr:C.and(me.editorTextFocus,me.tabDoesNotMoveFocus,C.has("config.emmet.triggerExpansionOnTab")),weight:100},menuOpts:{menuId:R.MenubarEditMenu,group:"5_insert",title:d(11266,null),order:3,when:qo.negate()}})}};ri(KGi);var GGi=class extends z{constructor(){super({id:"editor.action.toggleScreenReaderAccessibilityMode",title:P(9955,"Toggle Screen Reader Accessibility Mode"),metadata:{description:P(9956,"Toggles an optimized mode for usage with screen readers, braille devices, and other assistive technologies.")},f1:!0,keybinding:[{primary:2083,weight:210,when:jx},{primary:1595,linux:{primary:1598},weight:210}]})}async run(i){let e=i.get(Ai),t=i.get(B),o=e.isScreenReaderOptimized();t.updateValue("editor.accessibilitySupport",o?"off":"on",2),cn(o?qc.screenReaderModeDisabled:qc.screenReaderModeEnabled)}};W(GGi);var qGi=class extends z{constructor(){super({id:"editor.action.announceCursorPosition",title:P(9952,"Announce Cursor Position"),f1:!0,metadata:{description:P(9953,"Announce the current cursor position (line and column) via screen reader.")},keybinding:{primary:3621,weight:210,when:C.and(me.editorTextFocus,Oa)}})}async run(i){let t=i.get(Qt).getFocusedCodeEditor();if(!t)return;let o=t.getPosition(),n=t.getModel();if(!o||!n)return;let r=n.getOptions().tabSize,s=n.getLineContent(o.lineNumber),l=Ll.visibleColumnFromColumn(s,o.column,r)+1;cn(d(9954,null,o.lineNumber,l))}};W(qGi);var NYt=class extends k{constructor(){super(),this._register(zme.addImplementation(90,"editor",async i=>{let e=i.get(Qt),t=i.get(Kd),o=i.get(F),n=i.get(fe),r=e.getActiveCodeEditor()||e.getFocusedCodeEditor();r||(await n.executeCommand(aV),r=e.getActiveCodeEditor()),t.show(o.createInstance(dmt,r))}))}},dmt=class extends k{constructor(e,t,o,n,r){super();this._editor=e;this._keybindingService=t;this._contextKeyService=o;this.accessibilityService=n;this._configurationService=r;this.id="editor";this.options={type:"help",readMoreUrl:"https://go.microsoft.com/fwlink/?linkid=851010"};this.verbositySettingKey="accessibility.verbosity.editor"}onClose(){this._editor.focus()}provideContent(){let e=this._editor.getOptions(),t=[];e.get(70)?e.get(104)?t.push(qc.readonlyDiffEditor):t.push(qc.editableDiffEditor):e.get(104)?t.push(qc.readonlyEditor):t.push(qc.editableEditor),this.accessibilityService.isScreenReaderOptimized()&&this._configurationService.getValue("accessibility.windowTitleOptimized")?t.push(qc.defaultWindowTitleIncludesEditorState):t.push(qc.defaultWindowTitleExcludingEditorState),t.push(qc.toolbar);let o=rRn(this._keybindingService,this._contextKeyService,this._editor);o&&t.push(o),t.push(qc.listSignalSounds),t.push(qc.listAlerts),t.push(qc.announceCursorPosition),t.push(qc.focusNotifications);let n=nRn(this._keybindingService,this._contextKeyService);n&&t.push(n);let r=$Gi(this._keybindingService,this._contextKeyService,this._editor);return r&&t.push(r),t.push(qc.suggestActions),t.push(qc.acceptSuggestAction),t.push(qc.toggleSuggestionFocus),e.get(131).enabled&&t.push(qc.stickScroll),e.get(164)?t.push(qc.tabFocusModeOnMsg):t.push(qc.tabFocusModeOffMsg),t.push(qc.codeFolding),t.push(qc.intellisense),t.push(qc.showOrFocusHover),t.push(qc.goToSymbol),t.push(qc.startDebugging),t.push(qc.setBreakpoint),t.push(qc.debugExecuteSelection),t.push(qc.addToWatch),t.join(`
`)}};dmt=I([m(1,Le),m(2,X),m(3,Ai),m(4,B)],dmt);function $Gi(a,i,e){if(i.getContext(e.getDomNode()).getValue(jc.activeEditorHasCommentingRange.key))return[dL.intro,dL.addComment,dL.nextCommentThread,dL.previousCommentThread,dL.nextRange,dL.previousRange].join(`
`)}function nRn(a,i){if(Z.enabled.getValue(i))return[qc.quickChat,qc.startInlineChat].join(`
`)}function rRn(a,i,e){let t=i.getContext(e.getDomNode());if(t.getValue(Cb.key))return qc.chatEditorModification+`
`+qc.chatEditActions;if(t.getValue(EP.key))return qc.chatEditorRequestInProgress}var OYt=class{constructor(){this.priority=105;this.name="diff-editor";this.when=CB.create("isInDiffEditor",!0);this.type="help"}getProvider(i){let e=i.get(ie),t=i.get(Qt),o=i.get(Le),n=i.get(X);if(!(e.activeTextEditorControl instanceof _p))return;let r=t.getActiveCodeEditor()||t.getFocusedCodeEditor();if(!r)return;let s=d(9964,null,"<keybinding:diffEditor.switchSide>"),l=d(9966,null),c=["accessibility.signals.diffLineDeleted","accessibility.signals.diffLineInserted","accessibility.signals.diffLineModified"],u=[d(9962,null),d(9963,null,"<keybinding:"+WK.id+">","<keybinding:"+Hde.id+">"),s,l,d(9965,null,c.join(", "))],p=$Gi(o,n,r);return p&&u.push(p),new qp("diffEditor",{type:"help"},()=>u.join(`
`),()=>r.focus(),"accessibility.verbosity.diffEditor")}};var HGe=class extends k{constructor(e,t,o,n){super();this._diffEditor=e;this._instantiationService=t;this._textResourceConfigurationService=o;this._notificationService=n;if(!(this._diffEditor instanceof nL)){let l=vi(this,c=>this._diffEditor.onDidUpdateDiff(c),()=>this._diffEditor.getDiffComputationResult()).map(c=>c&&!c.identical&&c.changes2.length===0);this._register(Rl((c,u)=>{if(l.read(c)){let p=u.add(this._instantiationService.createInstance(Dge,this._diffEditor.getModifiedEditor(),d(9968,null),null));u.add(p.onClick(()=>{this._textResourceConfigurationService.updateValue(this._diffEditor.getModel().modified.uri,"diffEditor.ignoreTrimWhitespace",!1)})),p.render()}})),this._register(this._diffEditor.onDidUpdateDiff(()=>{let c=this._diffEditor.getDiffComputationResult();c&&c.quitEarly&&this._notificationService.prompt(ft.Warning,d(9967,null,this._diffEditor.maxComputationTime),[{label:d(9969,null),run:()=>{this._textResourceConfigurationService.updateValue(this._diffEditor.getModel().modified.uri,"diffEditor.maxComputationTime",0)}}],{})}))}}static{this.ID="editor.contrib.diffEditorHelper"}};HGe=I([m(1,F),m(2,Gn),m(3,Ne)],HGe);aSt(HGe.ID,HGe);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations([{key:"diffEditor.experimental.collapseUnchangedRegions",migrateFn:(a,i)=>[["diffEditor.hideUnchangedRegions.enabled",{value:a}],["diffEditor.experimental.collapseUnchangedRegions",{value:void 0}]]}]);_a.register(new OYt);var UGe=class extends k{constructor(e,t){super();this._instantiationService=t;this._instantiated=!1;this._register(e.onWillCreateCodeEditor(()=>this._instantiate())),this._register(e.onWillCreateDiffEditor(()=>this._instantiate())),(e.listCodeEditors().length>0||e.listDiffEditors().length>0)&&this._instantiate()}static{this.ID="workbench.contrib.editorFeaturesInstantiator"}_instantiate(){if(this._instantiated)return;this._instantiated=!0;let e=Jeo();for(let t of e)try{let o=this._instantiationService.createInstance(t);typeof o.dispose=="function"&&this._register(o)}catch(o){mt(o)}}};UGe=I([m(0,Qt),m(1,F)],UGe);bt(UGe.ID,UGe,vt.BlockRestore);var jGi=class{constructor(){this.priority=105;this.name="editor-find";this.when=AEt;this.type="help"}getProvider(i){let e=i.get(Qt),t=e.getActiveCodeEditor()||e.getFocusedCodeEditor();if(!t)return;let o=Sv.get(t);if(o)return new QGi(o)}},QGi=class extends k{constructor(e){super();this._findController=e;this.id="editorFindHelp";this.verbositySettingKey="accessibility.verbosity.find";this.options={type:"help"}}onClose(){this._findController.focusLastElement()}provideContent(){let e=this._findController.getState(),t=e.isReplaceRevealed,o=e.searchString,n=e.matchesCount,r=e.matchesPosition,s=[];if(t){s.push(d(10035,null)),s.push(d(10028,null)),s.push(""),s.push(d(10084,null)),o?(s.push(d(10067,null,o)),n!==void 0&&r!==void 0&&(n===0?s.push(d(10057,null)):s.push(d(10056,null,r,n)))):s.push(d(10059,null));let l=e.replaceString;l?s.push(d(10066,null,l)):s.push(d(10058,null)),s.push(""),s.push(d(10030,null)),s.push(d(10029,null)),s.push(""),s.push(d(10040,null)),s.push(d(10039,null)),s.push(d(10036,null)),s.push(d(10037,null)),s.push(d(10038,null)),s.push(""),s.push(d(10034,null)),s.push(d(10031,null)),s.push(d(10032,null)),s.push(d(10033,null)),s.push(""),s.push(d(10041,null)),s.push(""),s.push(d(10045,null)),s.push(d(10042,null)),s.push(d(10051,null)),s.push(d(10053,null)),s.push(""),s.push(d(10047,null)),s.push(d(10049,null)),s.push(d(10050,null,"<keybinding:editor.action.replaceOne>")),s.push(d(10048,null,"<keybinding:editor.action.replaceAll>")),s.push(""),s.push(d(10044,null)),s.push(d(10043,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(10052,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(""),s.push(d(10046,null)),s.push(""),s.push(d(10064,null)),s.push(d(10060,null)),s.push(d(10065,null)),s.push(d(10062,null)),s.push(d(10063,null)),s.push(d(10061,null)),s.push(""),s.push(d(10081,null,"<keybinding:workbench.action.openSettings>")),s.push(d(10082,null)),s.push(d(10083,null)),s.push(d(10072,null)),s.push(d(10069,null)),s.push(d(10077,null)),s.push(d(10068,null)),s.push(d(10073,null)),s.push(d(10070,null)),s.push(d(10071,null)),s.push(d(10076,null)),s.push(d(10074,null)),s.push(d(10075,null)),s.push(d(10078,null)),s.push(d(10079,null)),s.push(d(10080,null)),et&&(s.push(""),s.push(d(10055,null)),s.push(d(10054,null))),s.push(""),s.push(d(10027,null)),s.push(d(10026,null))}else s.push(d(9978,null)),s.push(d(9972,null)),s.push(""),s.push(d(10025,null)),o?(s.push(d(10008,null,o)),n!==void 0&&r!==void 0&&(n===0?s.push(d(9996,null)):s.push(d(9995,null,r,n)))):s.push(d(9997,null)),s.push(""),s.push(d(9974,null)),s.push(d(9973,null)),s.push(""),s.push(d(9984,null)),s.push(d(9983,null)),s.push(d(9979,null)),s.push(d(9980,null)),s.push(d(9981,null)),s.push(d(9982,null)),s.push(""),s.push(d(10006,null)),s.push(d(10004,null)),s.push(d(10005,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(10007,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(d(10003,null)),s.push(""),s.push(d(9977,null)),s.push(d(9975,null)),s.push(d(9976,null)),s.push(""),s.push(d(9985,null)),s.push(""),s.push(d(9989,null)),s.push(d(9986,null)),s.push(d(9991,null)),s.push(""),s.push(d(9988,null)),s.push(d(9987,null,"<keybinding:editor.action.nextMatchFindAction>")),s.push(d(9992,null,"<keybinding:editor.action.previousMatchFindAction>")),s.push(""),s.push(d(9990,null)),s.push(""),s.push(d(10001,null)),s.push(d(9998,null)),s.push(d(10002,null)),s.push(d(9999,null)),s.push(d(10000,null)),s.push(""),s.push(d(10022,null,"<keybinding:workbench.action.openSettings>")),s.push(d(10023,null)),s.push(d(10024,null)),s.push(d(10013,null)),s.push(d(10011,null)),s.push(d(10018,null)),s.push(d(10009,null)),s.push(d(10015,null)),s.push(d(10010,null)),s.push(d(10012,null)),s.push(d(10014,null)),s.push(d(10016,null)),s.push(d(10017,null)),s.push(d(10019,null)),s.push(d(10020,null)),s.push(d(10021,null)),et&&(s.push(""),s.push(d(9994,null)),s.push(d(9993,null))),s.push(""),s.push(d(9971,null)),s.push(d(9970,null));return s.join(`
`)}};_a.register(new jGi);oe.as(fm.ConfigurationMigration).registerConfigurationMigrations(Nce.items.map(a=>({key:`editor.${a.key}`,migrateFn:(i,e)=>{let t=[],o=(n,r)=>t.push([`editor.${n}`,{value:r}]);return a.migrate(i,n=>e(`editor.${n}`),o),t}})));var YGi=class extends z{constructor(){super({id:"workbench.action.inspectKeyMappings",title:P(10104,"Inspect Key Mappings"),category:Fe.Developer,f1:!0})}run(i,e){let t=i.get(Le);i.get(ie).openEditor({resource:void 0,contents:t._dumpDebugInfo(),options:{pinned:!0}})}};W(YGi);var XGi=class extends z{constructor(){super({id:"workbench.action.inspectKeyMappingsJSON",title:P(10105,"Inspect Key Mappings (JSON)"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(ie),t=i.get(Le);await e.openEditor({resource:void 0,contents:t._dumpDebugInfoJSON(),options:{pinned:!0}})}};W(XGi);var zGe=class extends k{constructor(e,t,o){super();this._editor=e;this._notificationService=t;this._configurationService=o;this._register(this._editor.onDidChangeModel(n=>this._update())),this._update()}static{this.ID="editor.contrib.largeFileOptimizationsWarner"}_update(){let e=this._editor.getModel();if(e&&e.isTooLargeForTokenization()){let t=d(10106,null,Jo(e.uri.path));this._notificationService.prompt(ft.Info,t,[{label:d(10107,null),run:()=>{this._configurationService.updateValue("editor.largeFileOptimizations",!1).then(()=>{this._notificationService.info(d(10108,null))},o=>{this._notificationService.error(o)})}}],{neverShowAgain:{id:"editor.contrib.largeFileOptimizationsWarner"}})}}};zGe=I([m(1,Ne),m(2,B)],zGe);Eo(zGe.ID,zGe,1);var y7=class extends DSe{constructor(e,t,o){super();this.editorService=e;this.configurationService=t;this.storageService=o;this.onDidActiveTextEditorControlChange=this.editorService.onDidActiveEditorChange}get configuration(){let e=this.configurationService.getValue().workbench?.editor;return{openEditorPinned:!e?.enablePreviewFromQuickOpen||!e?.enablePreview}}get activeTextEditorControl(){return this.editorService.activeTextEditorControl}gotoLocation(e,t){if((t.keyMods.alt||this.configuration.openEditorPinned&&t.keyMods.ctrlCmd||t.forceSideBySide)&&this.editorService.activeEditor){e.restoreViewState?.();let o={selection:t.range,pinned:t.keyMods.ctrlCmd||this.configuration.openEditorPinned,preserveFocus:t.preserveFocus};this.editorService.openEditor(this.editorService.activeEditor,o,En)}else super.gotoLocation(e,t)}};y7=I([m(0,ie),m(1,B),m(2,de)],y7);var FYt=class a extends z{static{this.ID="workbench.action.gotoLine"}constructor(){super({id:a.ID,title:P(10114,"Go to Line/Column..."),f1:!0,keybinding:{weight:200,when:null,primary:2085,mac:{primary:293}}})}async run(i){i.get($e).quickAccess.show(y7.GO_TO_LINE_PREFIX)}};W(FYt);oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:y7,prefix:DSe.GO_TO_LINE_PREFIX,placeholder:d(10116,null),helpEntries:[{description:d(10115,null),commandId:FYt.ID}]});var WYt=class a extends z{static{this.ID="workbench.action.gotoOffset"}constructor(){super({id:a.ID,title:P(10117,"Go to Offset..."),f1:!0})}async run(i){i.get($e).quickAccess.show(y7.GO_TO_OFFSET_PREFIX)}};W(WYt);oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:y7,prefix:y7.GO_TO_OFFSET_PREFIX,placeholder:d(10116,null),helpEntries:[{description:d(10118,null),commandId:WYt.ID}]});ri(class extends Mi{constructor(){super({id:"editor.action.formatChanges",label:P(12380,"Format Modified Lines"),precondition:C.and(me.writable,me.hasDocumentSelectionFormattingProvider)})}async run(i,e){let t=i.get(F);if(!e.hasModel())return;let o=await t.invokeFunction(JGi,e.getModel());if(Rr(o))return t.invokeFunction(kue,e,o,1,nh.None,Ie.None,!0)}});async function JGi(a,i){let e=a.get(l_),t=a.get(Qs),o=a.get(Bt),n=await KNo(e,i.uri,i.getLanguageId(),Pk(i));if(!n)return null;let r=[],s=await o.createModelReference(n);try{if(!t.canComputeDirtyDiff(n,i.uri))return;let l=await t.computeDirtyDiff(n,i.uri,!1);if(!Rr(l))return;for(let c of l)r.push(i.validateRange(new G(c.modifiedStartLineNumber,1,c.modifiedEndLineNumber||c.modifiedStartLineNumber,Number.MAX_SAFE_INTEGER)))}finally{s.dispose()}return r}var umt=class{constructor(i,e){this.configurationService=i;this.codeEditorService=e}async participate(i,e){if(!i.textEditorModel)return;let t=this.configurationService.getValue("files.trimTrailingWhitespace",{overrideIdentifier:i.textEditorModel.getLanguageId(),resource:i.resource}),o=this.configurationService.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:i.textEditorModel.getLanguageId(),resource:i.resource});t&&this.doTrimTrailingWhitespace(i.textEditorModel,e.reason===2,o)}doTrimTrailingWhitespace(i,e,t){let o=[],n=[],r=VYt(i,this.codeEditorService);if(r&&(o=r.getSelections(),e)){n=o.map(c=>c.getPosition());let l=ss.get(r)?.getSessionEnclosingRange();if(l)for(let c=l.startLineNumber;c<=l.endLineNumber;c++)n.push(new ye(c,i.getLineMaxColumn(c)))}let s=r9e(i,n,t);s.length&&i.pushEditOperations(o,s,l=>o)}};umt=I([m(0,B),m(1,Qt)],umt);function VYt(a,i){let e=null;if(a.isAttachedToEditor()){for(let t of i.listCodeEditors())if(t.hasModel()&&t.getModel()===a){if(t.hasTextFocus())return t;e=t}}return e}var pmt=class{constructor(i,e){this.configurationService=i;this.codeEditorService=e}async participate(i,e){i.textEditorModel&&this.configurationService.getValue("files.insertFinalNewline",{overrideIdentifier:i.textEditorModel.getLanguageId(),resource:i.resource})&&this.doInsertFinalNewLine(i.textEditorModel)}doInsertFinalNewLine(i){let e=i.getLineCount(),t=i.getLineContent(e),o=Bv(t)===-1;if(!e||o)return;let n=[Qn.insert(new ye(e,i.getLineMaxColumn(e)),i.getEOL())],r=VYt(i,this.codeEditorService);r?r.executeEdits("insertFinalNewLine",n,r.getSelections()):i.pushEditOperations([],n,()=>null)}};pmt=I([m(0,B),m(1,Qt)],pmt);var mmt=class{constructor(i,e){this.configurationService=i;this.codeEditorService=e}async participate(i,e){i.textEditorModel&&this.configurationService.getValue("files.trimFinalNewlines",{overrideIdentifier:i.textEditorModel.getLanguageId(),resource:i.resource})&&this.doTrimFinalNewLines(i.textEditorModel,e.reason===2)}findLastNonEmptyLine(i){for(let e=i.getLineCount();e>=1;e--)if(i.getLineLength(e)>0)return e;return 0}doTrimFinalNewLines(i,e){let t=i.getLineCount();if(t===1)return;let o=[],n=0,r=VYt(i,this.codeEditorService);if(r&&(o=r.getSelections(),e))for(let u=0,p=o.length;u<p;u++){let h=o[u].positionLineNumber;h>n&&(n=h)}let s=this.findLastNonEmptyLine(i),l=Math.max(s+1,n+1),c=i.validateRange(new G(l,1,t,i.getLineMaxColumn(t)));c.isEmpty()||(i.pushEditOperations(o,[Qn.delete(c)],u=>o),r?.setSelections(o))}};mmt=I([m(0,B),m(1,Qt)],mmt);var hmt=class{constructor(i,e,t){this.configurationService=i;this.codeEditorService=e;this.instantiationService=t}async participate(i,e,t,o){if(!i.textEditorModel||e.reason===2)return;let n=i.textEditorModel,r={overrideIdentifier:n.getLanguageId(),resource:n.uri},s=new nh(p=>{t.report({message:d(10128,null,p.displayName||p.extensionId&&p.extensionId.value||"???",nc("workbench.action.openSettings","editor.formatOnSave").toString())})});if(!this.configurationService.getValue("editor.formatOnSave",r))return;let c=VYt(n,this.codeEditorService)||n,u=this.configurationService.getValue("editor.formatOnSaveMode",r);if(u==="file")await this.instantiationService.invokeFunction(Eue,c,2,s,o);else{let p=await this.instantiationService.invokeFunction(JGi,fn(c)?c.getModel():c);p===null&&u==="modificationsIfAvailable"?await this.instantiationService.invokeFunction(Eue,c,2,s,o):p&&await this.instantiationService.invokeFunction(kue,c,p,2,s,o,!1)}}};hmt=I([m(0,B),m(1,Qt),m(2,F)],hmt);var gmt=class extends k{constructor(e,t,o,n,r,s){super();this.configurationService=e;this.instantiationService=t;this.languageFeaturesService=o;this.hostService=n;this.editorService=r;this.codeEditorService=s;this._register(this.hostService.onDidChangeFocus(()=>{this.triggerCodeActionsCommand()})),this._register(this.editorService.onDidActiveEditorChange(()=>{this.triggerCodeActionsCommand()}))}async triggerCodeActionsCommand(){if(this.configurationService.getValue("editor.codeActions.triggerOnFocusChange")&&this.configurationService.getValue("files.autoSave")==="afterDelay"){let e=this.codeEditorService.getActiveCodeEditor()?.getModel();if(!e)return;let t={overrideIdentifier:e.getLanguageId(),resource:e.uri},o=this.configurationService.getValue("editor.codeActionsOnSave",t);if(!o||Array.isArray(o))return;let n=Object.keys(o).filter(l=>o[l]&&o[l]==="always"&&Nr.Source.contains(new Rs(l))),r=new qe,s=[];for(let l of n)s.push(new Rs(l));await this.applyOnSaveActions(e,s,[],nh.None,r.token)}}async participate(e,t,o,n){if(!e.textEditorModel)return;let r=e.textEditorModel,s={overrideIdentifier:r.getLanguageId(),resource:r.uri},l=this.configurationService.getValue("editor.codeActionsOnSave",s);if(!l||t.reason===2||t.reason!==1&&Array.isArray(l))return;let c=Array.isArray(l)?l:Object.keys(l).filter(g=>l[g]&&l[g]!=="never"),u=this.createCodeActionsOnSave(c);if(Array.isArray(l)||u.sort((g,f)=>Nr.SourceFixAll.contains(g)?Nr.SourceFixAll.contains(f)?0:-1:Nr.SourceFixAll.contains(f)?1:0),!u.length)return;let p=Array.isArray(l)?[]:Object.keys(l).filter(g=>l[g]==="never"||!1).map(g=>new Rs(g));o.report({message:d(10125,null)});let h=Array.isArray(l)?u:u.filter(g=>l[g.value]==="always"||(l[g.value]==="explicit"||l[g.value]===!0)&&t.reason===1);await this.applyOnSaveActions(r,h,p,o,n)}createCodeActionsOnSave(e){let t=e.map(o=>new Rs(o));return t.filter(o=>t.every(n=>n.equals(o)||!n.contains(o)))}async applyOnSaveActions(e,t,o,n,r){let s=new class{constructor(){this._names=new Set}_report(){n.report({message:d(10127,null,[...this._names].map(l=>`'${l}'`).join(", "),nc("workbench.action.openSettings","editor.codeActionsOnSave").toString())})}report(l){l.displayName&&!this._names.has(l.displayName)&&(this._names.add(l.displayName),this._report())}};for(let l of t){let c=await this.getActionsToRun(e,l,o,s,r);if(r.isCancellationRequested){c.dispose();return}try{for(let u of c.validActions)if(n.report({message:d(10126,null,u.action.title)}),await this.instantiationService.invokeFunction(v4,u,"onSave",{},r),r.isCancellationRequested)return}catch{}finally{c.dispose()}}}getActionsToRun(e,t,o,n,r){return cM(this.languageFeaturesService.codeActionProvider,e,e.getFullModelRange(),{type:2,triggerAction:"save participants",filter:{include:t,excludes:o,includeSourceActions:!0}},n,r)}};gmt=I([m(0,B),m(1,F),m(2,Jt),m(3,ti),m(4,ie),m(5,Qt)],gmt);var fmt=class extends k{constructor(e,t){super();this.instantiationService=e;this.textFileService=t;this.registerSaveParticipants()}registerSaveParticipants(){this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(umt))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(gmt))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(hmt))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(pmt))),this._register(this.textFileService.files.addSaveParticipant(this.instantiationService.createInstance(mmt)))}};fmt=I([m(0,F),m(1,Uo)],fmt);var sRn=oe.as(Zi.Workbench);sRn.registerWorkbenchContribution(fmt,3);var ZGi=class a extends z{static{this.ID="editor.action.toggleColumnSelection"}constructor(){super({id:a.ID,title:{...P(10130,"Toggle Column Selection Mode"),mnemonicTitle:d(10129,null)},f1:!0,toggled:C.equals("config.editor.columnSelection",!0),menu:{id:R.MenubarSelectionMenu,group:"4_config",order:2}})}async run(i){let e=i.get(B),t=i.get(Qt),o=e.getValue("editor.columnSelection"),n=this._getCodeEditor(t);await e.updateValue("editor.columnSelection",!o);let r=e.getValue("editor.columnSelection");if(!n||n!==this._getCodeEditor(t)||o===r||!n.hasModel()||typeof o!="boolean"||typeof r!="boolean")return;let s=n._getViewModel();if(n.getOption(28)){let l=n.getSelection(),c=new ye(l.selectionStartLineNumber,l.selectionStartColumn),u=s.coordinatesConverter.convertModelPositionToViewPosition(c),p=new ye(l.positionLineNumber,l.positionColumn),h=s.coordinatesConverter.convertModelPositionToViewPosition(p);Vf.MoveTo.runCoreEditorCommand(s,{position:c,viewPosition:u});let g=s.cursorConfig.visibleColumnFromColumn(s,h);Vf.ColumnSelect.runCoreEditorCommand(s,{position:p,viewPosition:h,doColumnSelect:!0,mouseColumn:g+1})}else{let l=s.getCursorColumnSelectData(),c=s.cursorConfig.columnFromVisibleColumn(s,l.fromViewLineNumber,l.fromViewVisualColumn),u=s.coordinatesConverter.convertViewPositionToModelPosition(new ye(l.fromViewLineNumber,c)),p=s.cursorConfig.columnFromVisibleColumn(s,l.toViewLineNumber,l.toViewVisualColumn),h=s.coordinatesConverter.convertViewPositionToModelPosition(new ye(l.toViewLineNumber,p));n.setSelection(new ei(u.lineNumber,u.column,h.lineNumber,h.column))}}_getCodeEditor(i){let e=i.getFocusedCodeEditor();return e||i.getActiveCodeEditor()}};W(ZGi);var eqi=class a extends z{static{this.ID="editor.action.toggleMinimap"}constructor(){super({id:a.ID,title:{...P(10132,"Toggle Minimap"),mnemonicTitle:d(10131,null)},category:Fe.View,f1:!0,toggled:C.equals("config.editor.minimap.enabled",!0),menu:{id:R.MenubarAppearanceMenu,group:"4_editor",order:1}})}async run(i){let e=i.get(B),t=!e.getValue("editor.minimap.enabled");return e.updateValue("editor.minimap.enabled",t)}};W(eqi);var tqi=class extends z{constructor(){super({id:"editor.action.toggleOvertypeInsertMode",title:{...P(10138,"Toggle Overtype/Insert Mode"),mnemonicTitle:d(10137,null)},metadata:{description:P(10139,"Toggle between overtype and insert mode")},keybinding:{weight:200,primary:19,mac:{primary:2605}},f1:!0,category:Fe.View})}async run(i){let t=_B.getInputMode()==="insert"?"overtype":"insert";_B.setInputMode(t)}};W(tqi);var bmt=class a extends z{static{this.ID="workbench.action.toggleMultiCursorModifier"}static{this.multiCursorModifierConfigurationKey="editor.multiCursorModifier"}constructor(){super({id:a.ID,title:P(10136,"Toggle Multi-Cursor Modifier"),f1:!0})}run(i){let e=i.get(B),o=e.getValue("editor").multiCursorModifier==="ctrlCmd"?"alt":"ctrlCmd";return e.updateValue(a.multiCursorModifierConfigurationKey,o)}},iqi=new Y("multiCursorModifier","altKey"),vmt=class extends k{constructor(e,t){super();this.configurationService=e;this._multiCursorModifier=iqi.bindTo(t),this._update(),this._register(e.onDidChangeConfiguration(o=>{o.affectsConfiguration("editor.multiCursorModifier")&&this._update()}))}_update(){let t=this.configurationService.getValue("editor").multiCursorModifier==="ctrlCmd"?"ctrlCmd":"altKey";this._multiCursorModifier.set(t)}};vmt=I([m(0,B),m(1,X)],vmt);oe.as(Zi.Workbench).registerWorkbenchContribution(vmt,3);W(bmt);be.appendMenuItem(R.MenubarSelectionMenu,{group:"4_config",command:{id:bmt.ID,title:d(10133,null)},when:iqi.isEqualTo("ctrlCmd"),order:1});be.appendMenuItem(R.MenubarSelectionMenu,{group:"4_config",command:{id:bmt.ID,title:et?d(10134,null):d(10135,null)},when:iqi.isEqualTo("altKey"),order:1});var oqi=class a extends z{static{this.ID="editor.action.toggleRenderControlCharacter"}constructor(){super({id:a.ID,title:{...P(10141,"Toggle Control Characters"),mnemonicTitle:d(10140,null)},category:Fe.View,f1:!0,toggled:C.equals("config.editor.renderControlCharacters",!0),menu:{id:R.MenubarAppearanceMenu,group:"4_editor",order:5}})}run(i){let e=i.get(B),t=!e.getValue("editor.renderControlCharacters");return e.updateValue("editor.renderControlCharacters",t)}};W(oqi);var eB="editor.renderWhitespace",nqi=class a extends z{static{this.ID="editor.action.renderWhitespace.none"}constructor(){super({id:a.ID,title:P(10149,"Set Render Whitespace to None"),shortTitle:P(10145,"None"),category:Fe.View,f1:!1,toggled:C.equals(`config.${eB}`,"none"),menu:{id:R.EditorRenderWhitespaceSubmenu,group:"1_config",order:1}})}run(i){return i.get(B).updateValue(eB,"none")}},rqi=class a extends z{static{this.ID="editor.action.renderWhitespace.boundary"}constructor(){super({id:a.ID,title:P(10148,"Set Render Whitespace to Boundary"),shortTitle:P(10144,"Boundary"),category:Fe.View,f1:!1,toggled:C.equals(`config.${eB}`,"boundary"),menu:{id:R.EditorRenderWhitespaceSubmenu,group:"1_config",order:2}})}run(i){return i.get(B).updateValue(eB,"boundary")}},sqi=class a extends z{static{this.ID="editor.action.renderWhitespace.selection"}constructor(){super({id:a.ID,title:P(10150,"Set Render Whitespace to Selection"),shortTitle:P(10146,"Selection"),category:Fe.View,f1:!1,toggled:C.equals(`config.${eB}`,"selection"),menu:{id:R.EditorRenderWhitespaceSubmenu,group:"1_config",order:3}})}run(i){return i.get(B).updateValue(eB,"selection")}},aqi=class a extends z{static{this.ID="editor.action.renderWhitespace.trailing"}constructor(){super({id:a.ID,title:P(10151,"Set Render Whitespace to Trailing"),shortTitle:P(10152,"Trailing"),category:Fe.View,f1:!1,toggled:C.equals(`config.${eB}`,"trailing"),menu:{id:R.EditorRenderWhitespaceSubmenu,group:"1_config",order:4}})}run(i){return i.get(B).updateValue(eB,"trailing")}},lqi=class a extends z{static{this.ID="editor.action.renderWhitespace.all"}constructor(){super({id:a.ID,title:P(10147,"Set Render Whitespace to All"),shortTitle:P(10143,"All"),category:Fe.View,f1:!1,toggled:C.equals(`config.${eB}`,"all"),menu:{id:R.EditorRenderWhitespaceSubmenu,group:"1_config",order:5}})}run(i){return i.get(B).updateValue(eB,"all")}},cqi=class a extends z{static{this.ID="editor.action.toggleRenderWhitespace"}constructor(){super({id:a.ID,title:P(10153,"Toggle Render Whitespace"),category:Fe.View,f1:!0})}run(i){let e=i.get(B),t=e.getValue(eB),o;return t==="none"?o="all":o="none",e.updateValue(eB,o)}};W(nqi);W(rqi);W(sqi);W(aqi);W(lqi);W(cqi);be.appendMenuItem(R.MenubarAppearanceMenu,{submenu:R.EditorRenderWhitespaceSubmenu,title:d(10142,null),group:"4_editor",order:4});var Smt=class extends qT{constructor(i,e,t,o,n,r,s){super(!1,i,e,t,o,n,r,s)}};Smt=I([m(1,X),m(2,Qt),m(3,Ne),m(4,F),m(5,de),m(6,B)],Smt);Eo(qT.ID,Smt,4);var DrS=te("markdownAlert.note.foreground",eh,d(12730,null)),RrS=te("markdownAlert.tip.foreground",k5,d(12731,null)),LrS=te("markdownAlert.important.foreground",JIt,d(12729,null)),MrS=te("markdownAlert.warning.foreground",Tg,d(12732,null)),PrS=te("markdownAlert.caution.foreground",$v,d(12728,null));var dqi=class a extends z{constructor(){super({id:"workbench.action.toggleKeybindingsLog",title:P(12603,"Toggle Keyboard Shortcuts Troubleshooting"),category:Fe.Developer,f1:!0})}run(i){if(i.get(Le).toggleLogging()&&i.get(fe).executeCommand(OG),a.disposable){a.disposable.dispose(),a.disposable=void 0;return}let t=i.get(Kl),o=new O,n=t.activeContainer,r=D(n,_(".focus-troubleshooting-marker"));o.add(ee(()=>r.remove()));let s=Pr(void 0,void 0,o);Eg(".focus-troubleshooting-marker",`
			position: fixed;
			pointer-events: none;
			z-index: 100000;
			background-color: rgba(255, 0, 0, 0.2);
			border: 2px solid rgba(255, 0, 0, 0.8);
			border-radius: 2px;
			display: none;
		`,s);let l=o.add(new T);function c(u,p){p.add($(u,"keydown",h=>l.fire(h),!0))}for(let{window:u,disposables:p}of dx())c(u,p);o.add(Of(({window:u,disposables:p})=>c(u,p))),o.add(t.onDidChangeActiveContainer(()=>{t.activeContainer.appendChild(r)})),o.add(l.event(u=>{let p=u.target;if(p){let h=ur(p);r.style.top=`${h.top}px`,r.style.left=`${h.left}px`,r.style.width=`${h.width}px`,r.style.height=`${h.height}px`,r.style.display="block",setTimeout(()=>{r.style.display="none"},800)}})),a.disposable=o}};W(dqi);Ce(uw,cLe,1);var BWo={category:P(15374,"Snippets")},KGe=class extends z{constructor(i){super({...BWo,...i})}},GGe=class extends yl{constructor(i){super({...BWo,...i})}};var UWo;(i=>{function a(e){return!!e&&A.isUri(e.filepath)}i.is=a})(UWo||={});async function aRn(a,i,e,t){let o=[],n=[],r=new Set,s=new Map;for(let c of await a.getSnippetFiles())if(c.source!==3)if(c.isGlobalSnippets){await c.load();let u=new Set,p;e:for(let v of c.data){p||(p=v.source);for(let b of v.scopes){let S=e.getLanguageName(b);if(S)if(u.size>=4){u.add(`${S}...`);break e}else u.add(S)}}let h={label:Be(c.location),filepath:c.location,description:u.size===0?d(15380,null):d(15379,null,[...u].join(", "))};if(o.push(h),!p)continue;let g=d(15378,null,p,t.getUriLabel(c.location,{relative:!0})),f=s.get(Be(c.location));f&&(h.detail=g,f.snippet.detail=f.detail),s.set(Be(c.location),{snippet:h,detail:g})}else{let u=Be(c.location).replace(/\.json$/,"");o.push({label:Be(c.location),description:`(${e.getLanguageName(u)??u})`,filepath:c.location}),r.add(u)}let l=i.currentProfile.snippetsHome;for(let c of e.getRegisteredLanguageIds()){let u=e.getLanguageName(c);u&&!r.has(c)&&n.push({label:c,description:`(${u})`,filepath:Ve(l,`${c}.json`),hint:!0,iconClasses:v2(c)})}return o.sort((c,u)=>{let p=km(c.filepath.path),h=km(u.filepath.path);return p===h?c.label.localeCompare(u.label):p===".code-snippets"?-1:1}),n.sort((c,u)=>c.label.localeCompare(u.label)),{existing:o,future:n}}async function HWo(a,i,e,t,o,n){function r(c){let u=km(c)!==".code-snippets"?`${c}.code-snippets`:c;return Ve(i,u)}await t.createFolder(i);let s=await e.input({placeHolder:d(15383,null),async validateInput(c){if(!c)return d(15375,null);if(!Ez(c))return d(15376,null,c);if(await t.exists(r(c)))return d(15377,null,c)}});if(!s)return;let l=r(s);await o.write(l,["{","	// Place your "+a+" snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and ","	// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope ","	// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is ","	// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: ","	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. ","	// Placeholders with the same ids are connected.","	// Example:",'	// "Print to console": {','	// 	"scope": "javascript,typescript",','	// 	"prefix": "log",','	// 	"body": [',`	// 		"console.log('$1');",`,'	// 		"$2"',"	// 	],",'	// 	"description": "Log output to console"',"	// }","	//","	// You can also restrict snippets to specific files using include/exclude patterns:",'	// "Test snippet": {','	// 	"scope": "javascript,typescript",','	// 	"prefix": "test",',`	// 	"body": "test('$1', () => {\\n\\t$0\\n});",`,'	// 	"include": ["**/*.test.ts", "*.spec.ts"],','	// 	"exclude": ["**/temp/*.ts"],','	// 	"description": "Insert test block"',"	// }","}"].join(`
`)),await n.open(l)}async function lRn(a,i,e){if(await i.exists(a.filepath))return;let t=["{","	// Place your snippets for "+a.label+" here. Each snippet is defined under a snippet name and has a prefix, body and ","	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:","	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the ","	// same ids are connected.","	// Example:",'	// "Print to console": {','	// 	"prefix": "log",','	// 	"body": [',`	// 		"console.log('$1');",`,'	// 		"$2"',"	// 	],",'	// 	"description": "Log output to console"',"	// }","	//","	// You can also restrict snippets to specific files using include/exclude patterns:",'	// "Test snippet": {','	// 	"prefix": "test",',`	// 	"body": "test('$1', () => {\\n\\t$0\\n});",`,'	// 	"include": ["**/*.test.ts", "*.spec.ts"],','	// 	"exclude": ["**/temp/*.ts"],','	// 	"description": "Insert test block"',"	// }","}"].join(`
`);await e.write(a.filepath,t)}var BYt=class extends KGe{constructor(){super({id:"workbench.action.openSnippets",title:P(15389,"Configure Snippets"),shortTitle:{...P(15391,"Snippets"),mnemonicTitle:d(15382,null)},f1:!0,menu:[{id:R.MenubarPreferencesMenu,group:"2_configuration",order:5},{id:R.GlobalActivity,group:"2_configuration",order:5}]})}async run(i){let e=i.get(uw),t=i.get($e),o=i.get(Je),n=i.get(Rt),r=i.get(gn),s=i.get(Ae),l=i.get(ge),c=i.get(Uo),u=i.get(nt),p=await aRn(e,r,n,u),h=p.existing,g=[{scope:d(15386,null),label:d(15385,null),uri:r.currentProfile.snippetsHome}],f=[];for(let b of s.getWorkspace().folders)f.push({scope:d(15388,null,b.name),label:d(15384,null,b.name),uri:b.toResource(".vscode")});h.length>0?(h.unshift({type:"separator",label:d(15381,null)}),h.push({type:"separator",label:d(15387,null)})):h.push({type:"separator",label:d(15387,null)});let v=await t.pick([].concat(h,g,f,p.future),{placeHolder:d(15390,null),matchOnDescription:!0});if(g.indexOf(v)>=0)return HWo(v.scope,v.uri,t,l,c,o);if(f.indexOf(v)>=0)return HWo(v.scope,v.uri,t,l,c,o);if(UWo.is(v))return v.hint&&await lRn(v,l,c),o.open(v.filepath)}};var qGe=class a extends KGe{static{this.Id="workbench.action.populateFileFromSnippet"}constructor(){super({id:a.Id,title:P(15392,"Fill File with Snippet"),f1:!0})}async run(i){let e=i.get(uw),t=i.get($e),o=i.get(ie),n=i.get(Rt),r=da(o.activeTextEditorControl);if(!r||!r.hasModel())return;let s=r.getModel().uri,l=await e.getSnippets(void 0,s,{fileTemplateSnippets:!0,noRecencySort:!0,includeNoPrefixSnippets:!0});if(l.length===0)return;let c=await this._pick(t,n,l);c&&r.hasModel()&&(r.getModel().setLanguage(n.createById(c.langId),a.Id),ss.get(r)?.apply([{range:r.getModel().getFullModelRange(),template:c.snippet.body}]),r.focus())}async _pick(i,e,t){let o=[];for(let l of t)if(YO(l.scopes))o.push({langId:"",snippet:l});else for(let c of l.scopes)o.push({langId:c,snippet:l});let n=[],r=Lf(o,(l,c)=>oc(l.langId,c.langId));for(let l of r){let c=!0;for(let u of l)c&&(n.push({type:"separator",label:e.getLanguageName(u.langId)??u.langId}),c=!1),n.push({snippet:u,label:u.snippet.prefix||u.snippet.name,detail:u.snippet.description})}return(await i.pick(n,{placeHolder:d(15393,null),matchOnDetail:!0}))?.snippet}};async function HYt(a,i,e){let t=a.get(uw),o=a.get($e),n;Array.isArray(i)?n=i:n=await t.getSnippets(i,e,{includeDisabledSnippets:!0,includeNoPrefixSnippets:!0}),n.sort((u,p)=>u.snippetSource-p.snippetSource);let r=()=>{let u=[],p;for(let h of n){let g={label:h.prefix||h.name,detail:h.description||h.body,snippet:h};if(!p||p.snippetSource!==h.snippetSource||p.source!==h.source){let f="";switch(h.snippetSource){case 1:f=d(15407,null);break;case 3:f=h.source;break;case 2:f=d(15408,null);break}u.push({type:"separator",label:f})}h.snippetSource===3&&(t.isEnabled(h)?g.buttons=[{iconClass:q.asClassName(L.eyeClosed),tooltip:d(15402,null)}]:(g.description=d(15404,null),g.buttons=[{iconClass:q.asClassName(L.eye),tooltip:d(15403,null)}])),u.push(g),p=h}return u},s=new O,l=s.add(o.createQuickPick({useSeparators:!0}));l.placeholder=d(15406,null),l.matchOnDetail=!0,l.ignoreFocusOut=!1,l.keepScrollPosition=!0,s.add(l.onDidTriggerItemButton(u=>{let p=t.isEnabled(u.item.snippet);t.updateEnablement(u.item.snippet,!p),l.items=r()})),l.items=r(),l.items.length||(l.validationMessage=d(15405,null)),l.show(),await Promise.race([U.toPromise(l.onDidAccept),U.toPromise(l.onDidHide)]);let c=l.selectedItems[0]?.snippet;return s.dispose(),c}var uqi=class a{constructor(i,e,t){this.snippet=i;this.name=e;this.langId=t}static fromUser(i){if(!i||typeof i!="object")return a._empty;let{snippet:e,name:t,langId:o}=i;return typeof e!="string"&&(e=void 0),typeof t!="string"&&(t=void 0),typeof o!="string"&&(o=void 0),new a(e,t,o)}static{this._empty=new a(void 0,void 0,void 0)}},UYt=class extends GGe{constructor(){super({id:"editor.action.insertSnippet",title:P(15394,"Insert Snippet"),f1:!0,precondition:me.writable,metadata:{description:"Insert Snippet",args:[{name:"args",schema:{type:"object",properties:{snippet:{type:"string"},langId:{type:"string"},name:{type:"string"}}}}]}})}async runEditorCommand(i,e,t){let o=i.get(Rt),n=i.get(uw);if(!e.hasModel())return;let r=i.get(Bi),s=i.get(F),l=await new Promise((u,p)=>{let{lineNumber:h,column:g}=e.getPosition(),{snippet:f,name:v,langId:b}=uqi.fromUser(t);if(f)return u(new Wme(!1,[],"","","",f,"",1,`random/${Math.random()}`));let S;if(b){if(!o.isRegisteredLanguageId(b))return u(void 0);S=b}else e.getModel().tokenization.tokenizeIfCheap(h),S=e.getModel().getLanguageIdAtPosition(h,g),o.getLanguageName(S)||(S=e.getModel().getLanguageId());v?n.getSnippets(S,void 0,{includeNoPrefixSnippets:!0}).then(y=>y.find(w=>w.name===v)).then(u,p):u(s.invokeFunction(HYt,S,e.getModel().uri))});if(!l)return;let c;l.needsClipboard&&(c=await r.readText()),e.focus(),ss.get(e)?.insert(l.codeSnippet,{clipboardText:c}),n.updateUsageTimestamp(l)}};async function pqi(a,i,e,t){let{lineNumber:o,column:n}=e;i.tokenization.tokenizeIfCheap(o);let r=i.getLanguageIdAtPosition(o,n);return(await a.getSnippets(r,i.uri,{includeNoPrefixSnippets:!0,includeDisabledSnippets:t})).filter(l=>l.usesSelection)}var TIe=class a extends GGe{static{this.options={id:"editor.action.surroundWithSnippet",title:P(15395,"Surround with Snippet...")}}constructor(){super({...a.options,precondition:C.and(me.writable,me.hasNonEmptySelection),f1:!0})}async runEditorCommand(i,e){if(!e.hasModel())return;let t=i.get(F),o=i.get(uw),n=i.get(Bi),r=e.getModel(),s=await pqi(o,r,e.getPosition(),!0);if(!s.length)return;let l=await t.invokeFunction(HYt,s,r.uri);if(!l)return;let c;l.needsClipboard&&(c=await n.readText()),e.focus(),ss.get(e)?.insert(l.codeSnippet,{clipboardText:c}),o.updateUsageTimestamp(l)}};var mae=class{constructor(i){this._snippetService=i}static{this._MAX_CODE_ACTIONS=4}static{this._overflowCommandCodeAction={kind:Nr.SurroundWith.value,title:d(15397,null),command:{id:TIe.options.id,title:TIe.options.title.value}}}async provideCodeActions(i,e){if(e.isEmpty())return;let t=ei.isISelection(e)?e.getPosition():e.getStartPosition(),o=await pqi(this._snippetService,i,t,!1);if(!o.length)return;let n=[];for(let r of o){if(n.length>=mae._MAX_CODE_ACTIONS){n.push(mae._overflowCommandCodeAction);break}n.push({title:d(15396,null,r.name),kind:Nr.SurroundWith.value,edit:zWo(i,e,r)})}return{actions:n,dispose(){}}}};mae=I([m(0,uw)],mae);var hae=class{constructor(i){this._snippetService=i;this.providedCodeActionKinds=[Nr.SurroundWith.value]}static{this._MAX_CODE_ACTIONS=4}static{this._overflowCommandCodeAction={title:d(15398,null),kind:Nr.SurroundWith.value,command:{id:qGe.Id,title:""}}}async provideCodeActions(i){if(i.getValueLength()!==0)return;let e=await this._snippetService.getSnippets(i.getLanguageId(),i.uri,{fileTemplateSnippets:!0,includeNoPrefixSnippets:!0}),t=[];for(let o of e){if(t.length>=hae._MAX_CODE_ACTIONS){t.push(hae._overflowCommandCodeAction);break}t.push({title:d(15399,null,o.name),kind:Nr.SurroundWith.value,edit:zWo(i,i.getFullModelRange(),o)})}return{actions:t,dispose(){}}}};hae=I([m(0,uw)],hae);function zWo(a,i,e){return{edits:[{versionId:a.getVersionId(),resource:a.uri,textEdit:{range:i,text:e.body,insertAsSnippet:!0}}]}}var $Ge=class{constructor(i,e,t){this._store=new O;let o="editor.snippets.codeActions.enabled",n=new O,r=()=>{n.clear(),t.getValue(o)&&(n.add(e.codeActionProvider.register("*",i.createInstance(mae))),n.add(e.codeActionProvider.register("*",i.createInstance(hae))))};r(),this._store.add(t.onDidChangeConfiguration(s=>s.affectsConfiguration(o)&&r())),this._store.add(n)}dispose(){this._store.dispose()}};$Ge=I([m(0,F),m(1,Jt),m(2,B)],$Ge);W(UYt);Ge.registerCommandAlias("editor.action.showSnippets","editor.action.insertSnippet");W(TIe);W(qGe);W(BYt);var cRn=oe.as(Zi.Workbench);cRn.registerWorkbenchContribution($Ge,3);oe.as($t.Configuration).registerConfiguration({...wx,properties:{"editor.snippets.codeActions.enabled":{description:d(15409,null),type:"boolean",default:!0}}});var KWo="vscode://schemas/snippets",GWo={prefix:{description:d(15417,null),type:["string","array"]},isFileTemplate:{description:d(15416,null),type:"boolean"},body:{markdownDescription:d(15411,null),type:["string","array"],items:{type:"string"}},description:{description:d(15413,null),type:["string","array"]},include:{markdownDescription:d(15415,null),type:["string","array"],items:{type:"string"}},exclude:{markdownDescription:d(15414,null),type:["string","array"],items:{type:"string"}}},dRn={id:KWo,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(15412,null),body:{"${1:snippetName}":{prefix:"${2:prefix}",body:"${3:snippet}",description:"${4:description}"}}}],type:"object",description:d(15410,null),additionalProperties:{type:"object",required:["body"],properties:GWo,additionalProperties:!1}},qWo="vscode://schemas/global-snippets",uRn={id:qWo,allowComments:!0,allowTrailingCommas:!0,defaultSnippets:[{label:d(15412,null),body:{"${1:snippetName}":{scope:"${2:scope}",prefix:"${3:prefix}",body:"${4:snippet}",description:"${5:description}"}}}],type:"object",description:d(15410,null),additionalProperties:{type:"object",required:["body"],properties:{...GWo,scope:{description:d(15418,null),type:"string"}},additionalProperties:!1}},$Wo=oe.as(Ta.JSONContribution);$Wo.registerSchema(KWo,dRn);$Wo.registerSchema(qWo,uRn);ri(class extends Mi{constructor(){super({id:"editor.action.formatDocument.none",label:P(12376,"Format Document"),precondition:C.and(me.writable,me.hasDocumentFormattingProvider.toNegated()),kbOpts:{kbExpr:me.editorTextFocus,primary:1572,linux:{primary:3111},weight:100}})}async run(i,e){if(!e.hasModel())return;let t=i.get(fe),o=i.get(Ui),n=i.get(Ne),r=i.get(ct),s=i.get(Jt),l=e.getModel(),c=s.documentFormattingEditProvider.all(l).length;if(c>1)return t.executeCommand("editor.action.formatDocument.multiple");if(c===1)return t.executeCommand("editor.action.formatDocument");if(l.isTooLargeForSyncing())n.warn(d(12379,null));else{let u=l.getLanguageId(),p=d(12378,null,u),{confirmed:h}=await r.confirm({message:p,primaryButton:d(12377,null)});h&&o.openSearch(`category:formatters ${u}`)}}});var xS=class extends k{constructor(e,t){super();this._extensionService=e;this._configurationService=t;this._store.add(this._extensionService.onDidChangeExtensions(this._updateConfigValues,this)),this._store.add($f.setFoldingRangeProviderSelector(this._selectFoldingRangeProvider.bind(this))),this._updateConfigValues()}static{this.configName="editor.defaultFoldingRangeProvider"}static{this.extensionIds=[]}static{this.extensionItemLabels=[]}static{this.extensionDescriptions=[]}async _updateConfigValues(){await this._extensionService.whenInstalledExtensionsRegistered(),xS.extensionIds.length=0,xS.extensionItemLabels.length=0,xS.extensionDescriptions.length=0,xS.extensionIds.push(null),xS.extensionItemLabels.push(d(12355,null)),xS.extensionDescriptions.push(d(12356,null));let e=[],t=[];for(let n of this._extensionService.extensions)(n.main||n.browser)&&(n.categories?.find(r=>r==="Programming Languages")?e.push(n):t.push(n));let o=(n,r)=>n.name.localeCompare(r.name);for(let n of e.sort(o))xS.extensionIds.push(n.identifier.value),xS.extensionItemLabels.push(n.displayName??""),xS.extensionDescriptions.push(n.description??"");for(let n of t.sort(o))xS.extensionIds.push(n.identifier.value),xS.extensionItemLabels.push(n.displayName??""),xS.extensionDescriptions.push(n.description??"")}_selectFoldingRangeProvider(e,t){let o=this._configurationService.getValue(xS.configName,{overrideIdentifier:t.getLanguageId()});if(o)return e.filter(n=>n.id===o)}};xS=I([m(0,lt),m(1,B)],xS);oe.as($t.Configuration).registerConfiguration({...wx,properties:{[xS.configName]:{description:d(12354,null),type:["string","null"],default:null,enum:xS.extensionIds,enumItemLabels:xS.extensionItemLabels,markdownEnumDescriptions:xS.extensionDescriptions}}});oe.as(Zi.Workbench).registerWorkbenchContribution(xS,3);var pRn="workbench.action.openSettings",mRn=d(12621,null),Imt=class extends k{constructor(i,e){super();let o=[new mqi,new hqi].map(s=>new gqi(e,s));o.forEach(s=>this._register(s));let n,r=()=>{let s=i.activeTextEditorControl;if(s===n)return;n=s;let l=da(s);o.forEach(c=>c.onActiveEditorChanged(l))};this._register(i.onDidActiveEditorChange(r)),r()}};Imt=I([m(0,ie),m(1,$H)],Imt);var mqi=class{constructor(){this.id="decoratorsLimitInfo";this.name=d(12617,null);this.label=d(12623,null);this.source=d(12618,null);this.settingsId="editor.colorDecoratorsLimit"}getLimitReporter(i){return aC.get(i)?.limitReporter}},hqi=class{constructor(){this.id="foldingLimitInfo";this.name=d(12619,null);this.label=d(12624,null);this.source=d(12620,null);this.settingsId="editor.foldingMaximumRegions"}getLimitReporter(i){return $f.get(i)?.limitReporter}},gqi=class{constructor(i,e){this.languageStatusService=i;this.accessor=e}onActiveEditorChanged(i){this._indicatorChangeListener&&(this._indicatorChangeListener.dispose(),this._indicatorChangeListener=void 0);let e;return i&&(e=this.accessor.getLimitReporter(i)),this.updateStatusItem(e),e?(this._indicatorChangeListener=e.onDidChange(t=>{this.updateStatusItem(e)}),!0):!1}updateStatusItem(i){if(this._limitStatusItem&&(this._limitStatusItem.dispose(),this._limitStatusItem=void 0),i&&i.limited!==!1){let e={id:this.accessor.id,selector:"*",name:this.accessor.name,severity:wt.Warning,label:this.accessor.label,detail:d(12622,null,i.limited),command:{id:pRn,arguments:[this.accessor.settingsId],title:mRn},accessibilityInfo:void 0,source:this.accessor.source,busy:!1};this._limitStatusItem=this.languageStatusService.addStatus(e)}}dispose(){this._limitStatusItem?.dispose(),this._limitStatusItem=void 0,this._indicatorChangeListener?.dispose(),this._indicatorChangeListener=void 0}};oe.as(Zi.Workbench).registerWorkbenchContribution(Imt,3);var tB=class{constructor(i,e,t,o){this._editor=i;this._accessibilitySignalService=t;this._instaService=o;this._sessionDispoosables=new O;this._ariaElement=document.createElement("span"),this._ariaElement.style.position="fixed",this._ariaElement.className="inlayhint-accessibility-element",this._ariaElement.tabIndex=0,this._ariaElement.setAttribute("aria-description",d(12403,null)),this._ctxIsReading=tB.IsReading.bindTo(e)}static{this.IsReading=new Y("isReadingLineWithInlayHints",!1,{type:"boolean",description:d(12404,null)})}static{this.ID="editor.contrib.InlayHintsAccessibility"}static get(i){return i.getContribution(tB.ID)??void 0}dispose(){this._sessionDispoosables.dispose(),this._ctxIsReading.reset(),this._ariaElement.remove()}_reset(){St(this._ariaElement),this._sessionDispoosables.clear(),this._ctxIsReading.reset()}async _read(i,e){if(this._sessionDispoosables.clear(),this._ariaElement.isConnected||this._editor.getDomNode()?.appendChild(this._ariaElement),!this._editor.hasModel()||!this._ariaElement.isConnected){this._ctxIsReading.set(!1);return}let t=new qe;this._sessionDispoosables.add(t);for(let l of e)await l.resolve(t.token);if(t.token.isCancellationRequested)return;let o=this._editor.getModel(),n=[],r=0,s=!1;for(let l of e){let c=o.getValueInRange({startLineNumber:i,startColumn:r+1,endLineNumber:i,endColumn:l.hint.position.column});if(c.length>0&&(n.push(c),r=l.hint.position.column-1),r>750){n.push("\u2026"),s=!0;break}let u=document.createElement("em"),{label:p}=l.hint;if(typeof p=="string")u.innerText=p;else for(let h of p)if(h.command){let g=this._instaService.createInstance(Bg,u,{href:iTt(h.command),label:h.label,title:h.command.title},void 0);this._sessionDispoosables.add(g)}else u.innerText+=h.label;n.push(u)}s||n.push(o.getValueInRange({startLineNumber:i,startColumn:r+1,endLineNumber:i,endColumn:Number.MAX_SAFE_INTEGER})),Ii(this._ariaElement,...n),this._ariaElement.focus(),this._ctxIsReading.set(!0),this._sessionDispoosables.add($(this._ariaElement,"focusout",()=>{this._reset()}))}startInlayHintsReading(){if(!this._editor.hasModel())return;let i=this._editor.getPosition().lineNumber,e=$T.get(this._editor)?.getInlayHintsForLine(i);!e||e.length===0?this._accessibilitySignalService.playSignal(tn.noInlayHints):this._read(i,e)}stopInlayHintsReading(){this._reset(),this._editor.focus()}};tB=I([m(1,X),m(2,br),m(3,F)],tB);W(class extends yl{constructor(){super({id:"inlayHints.startReadingLineWithHint",title:P(12405,"Read Line with Inlay Hints"),precondition:me.hasInlayHintsProvider,f1:!0})}runEditorCommand(i,e){tB.get(e)?.startInlayHintsReading()}});W(class extends yl{constructor(){super({id:"inlayHints.stopReadingLineWithHint",title:P(12406,"Stop Inlay Hints Reading"),precondition:tB.IsReading,f1:!0,keybinding:{weight:100,primary:9}})}runEditorCommand(i,e){tB.get(e)?.stopInlayHintsReading()}});Eo(tB.ID,tB,4);var hRn=Oe("theme-selection-manage-extension",L.gear,d(17362,null));var jGe=class{constructor(i,e,t,o,n,r,s,l,c,u){this.getMarketplaceColorThemes=i;this.marketplaceQuery=e;this.extensionGalleryService=t;this.extensionManagementService=o;this.quickInputService=n;this.logService=r;this.progressService=s;this.extensionsWorkbenchService=l;this.dialogService=c;this.environmentService=u;this._marketplaceExtensions=new Set;this._marketplaceThemes=[];this._searchOngoing=!1;this._searchError=void 0;this._onDidChange=new T;this._queryDelayer=new Aa(200);this._installedExtensions=o.getInstalled().then(p=>{let h=new Set;for(let g of p)h.add(g.identifier.id);return h})}get themes(){return this._marketplaceThemes}get onDidChange(){return this._onDidChange.event}trigger(i){this._tokenSource&&(this._tokenSource.cancel(),this._tokenSource=void 0),this._queryDelayer.trigger(()=>(this._tokenSource=new qe,this.doSearch(i,this._tokenSource.token)))}async doSearch(i,e){this._searchOngoing=!0,this._onDidChange.fire();try{let t=await this._installedExtensions,o={text:`${this.marketplaceQuery} ${i}`,pageSize:20},n=await this.extensionGalleryService.query(o,e);for(let r=0;r<n.total&&r<1&&!e.isCancellationRequested;r++){let s=this._marketplaceThemes.length,l=r===0?n.firstPage:await n.getPage(r,e),c=[],u=[];for(let h=0;h<l.length&&!e.isCancellationRequested;h++){let g=l[h];this.environmentService.isSessionsWindow&&g.properties.executesCode||!t.has(g.identifier.id)&&!this._marketplaceExtensions.has(g.identifier.id)&&(this._marketplaceExtensions.add(g.identifier.id),c.push(this.getMarketplaceColorThemes(g.publisher,g.name,g.version)),u.push(g))}let p=await Promise.all(c);for(let h=0;h<p.length;h++){let g=u[h];for(let f of p[h])this._marketplaceThemes.push({id:f.id,theme:f,label:f.label,description:`${g.displayName} \xB7 ${g.publisherDisplayName}`,galleryExtension:g,buttons:[fqi]})}s!==this._marketplaceThemes.length&&(this._marketplaceThemes.sort((h,g)=>h.label.localeCompare(g.label)),this._onDidChange.fire())}}catch(t){Yi(t)||(this.logService.error("Error while searching for themes:",t),this._searchError="message"in t?t.message:String(t))}finally{this._searchOngoing=!1,this._onDidChange.fire()}}openQuickPick(i,e,t){let o,n=new O;return new Promise((r,s)=>{let l=n.add(this.quickInputService.createQuickPick());l.items=[],l.sortByLabel=!1,l.matchOnDescription=!0,l.buttons=[this.quickInputService.backButton],l.title="Marketplace Themes",l.placeholder=d(17381,null),l.canSelectMany=!1,n.add(l.onDidChangeValue(()=>this.trigger(l.value))),n.add(l.onDidAccept(async c=>{let u=l.selectedItems[0];if(u?.galleryExtension){o="selected",l.hide();let p=await this.installExtension(u.galleryExtension);t(p?u.theme:e,!0)}})),n.add(l.onDidTriggerItemButton(c=>{if(zYt(c.item)){let u=c.item.theme?.extensionData?.extensionId;u?this.extensionsWorkbenchService.openSearch(`@id:${u}`):this.extensionsWorkbenchService.openSearch(`${this.marketplaceQuery} ${l.value}`)}})),n.add(l.onDidChangeActive(c=>{o===void 0&&t(c[0]?.theme,!1)})),n.add(l.onDidHide(()=>{o===void 0&&(t(e,!0),o="cancelled"),r(o)})),n.add(l.onDidTriggerButton(c=>{c===this.quickInputService.backButton&&(o="back",l.hide())})),n.add(this.onDidChange(()=>{let c=this.themes;this._searchOngoing?c=c.concat({label:"$(loading~spin) Searching for themes...",id:void 0,alwaysShow:!0}):c.length===0&&this._searchError&&(c=[{label:`$(error) ${d(17368,null,this._searchError)}`,id:void 0,alwaysShow:!0}]);let u=l.activeItems[0]?.id,p=u?c.find(h=>zYt(h)&&h.id===u):void 0;l.items=c,p&&(l.activeItems=[p])})),this.trigger(i),l.show()}).finally(()=>{n.dispose()})}async installExtension(i){if(this.extensionsWorkbenchService.openSearch(`@id:${i.identifier.id}`),!(await this.dialogService.confirm({message:d(17357,null,i.displayName,i.publisherDisplayName),primaryButton:d(17356,null)})).confirmed)return!1;try{return await this.progressService.withProgress({location:15,title:d(17359,null,i.displayName)},async()=>{await this.extensionManagementService.installFromGallery(i,{isMachineScoped:!1})}),!0}catch(t){return this.logService.error(`Problem installing extension ${i.identifier.id}`,t),!1}}dispose(){this._tokenSource&&(this._tokenSource.cancel(),this._tokenSource=void 0),this._queryDelayer.dispose(),this._marketplaceExtensions.clear(),this._marketplaceThemes.length=0,this._onDidChange.dispose()}};jGe=I([m(2,ga),m(3,xs),m(4,$e),m(5,re),m(6,Go),m(7,Ui),m(8,ct),m(9,Mt)],jGe);var _Ie=class{constructor(i,e,t,o,n,r,s,l){this.options=i;this.setTheme=e;this.getMarketplaceColorThemes=t;this.quickInputService=o;this.extensionGalleryService=n;this.extensionsWorkbenchService=r;this.extensionResourceLoaderService=s;this.instantiationService=l}async openQuickPick(i,e){let t;this.extensionGalleryService.isEnabled()&&(await this.extensionResourceLoaderService.supportsExtensionGalleryResources()&&this.options.browseMessage?(t=this.instantiationService.createInstance(jGe,this.getMarketplaceColorThemes.bind(this),this.options.marketplaceTag),i=[jWo(this.options.browseMessage,"marketplace"),...i]):i=[...i,{type:"separator"},jWo(this.options.installMessage,"extensions")]);let o,n=(s,l)=>{o&&clearTimeout(o),o=ut.setTimeout(()=>{o=void 0;let c=s??e;this.setTheme(c,l?"auto":"preview").then(void 0,u=>{mt(u),this.setTheme(e,void 0)})},l?0:200)},r=s=>{let l=new O;return new Promise((c,u)=>{let p=!1,h=i.findIndex(f=>zYt(f)&&f.id===s),g=l.add(this.quickInputService.createQuickPick({useSeparators:!0}));g.items=i,g.title=this.options.title,g.description=this.options.description,g.placeholder=this.options.placeholderMessage,g.activeItems=[i[h]],g.canSelectMany=!1,g.buttons=this.options.buttons??[],l.add(g.onDidTriggerButton(f=>this.options.onButton?.(f,g))),g.matchOnDescription=!0,l.add(g.onDidAccept(async f=>{p=!0;let v=g.selectedItems[0];!v||v.configureItem?!v||v.configureItem==="extensions"?this.extensionsWorkbenchService.openSearch(`${this.options.marketplaceTag} ${g.value}`):v.configureItem==="marketplace"&&t&&await t.openQuickPick(g.value,e,n)==="back"&&await r(void 0):n(v.theme,!0),g.hide(),c()})),l.add(g.onDidChangeActive(f=>n(f[0]?.theme,!1))),l.add(g.onDidHide(()=>{p||(n(e,!0),c()),g.dispose()})),l.add(g.onDidTriggerItemButton(f=>{if(zYt(f.item)){let v=f.item.theme?.extensionData?.extensionId;v?this.extensionsWorkbenchService.openSearch(`@id:${v}`):this.extensionsWorkbenchService.openSearch(`${this.options.marketplaceTag} ${g.value}`)}})),g.show()}).finally(()=>{l.dispose()})};await r(e.id),t?.dispose()}};_Ie=I([m(3,$e),m(4,ga),m(5,Ui),m(6,aE),m(7,F)],_Ie);var QWo="workbench.action.selectTheme";W(class extends z{constructor(){super({id:QWo,title:P(17371,"Color Theme"),category:Fe.Preferences,f1:!0,keybinding:{weight:200,primary:Gi(2089,2098)}})}getTitle(a){switch(a){case"dark":return d(17385,null);case"light":return d(17388,null);case"hcDark":return d(17384,null);case"hcLight":return d(17387,null);default:return d(17386,null)}}async run(a){let i=a.get(ep),e=a.get(Qo),t=i.getPreferredColorScheme(),o={tooltip:t?d(17378,null):d(17377,null),iconClass:q.asClassName(L.colorMode),location:2},n={installMessage:d(17355,null),browseMessage:"$(plus) "+d(17346,null),placeholderMessage:this.getTitle(t),marketplaceTag:"category:themes",buttons:[o],onButton:async(b,S)=>{S.hide(),await e.openSettings({query:"window.autoDetectColorScheme"})}},r=(b,S)=>i.setColorTheme(b,S),s=(b,S,y)=>i.getMarketplaceColorThemes(b,S,y),c=a.get(F).createInstance(_Ie,n,r,s),u=await i.getColorThemes(),p=i.getColorTheme(),h=ymt(u.filter(b=>b.type==="light"),d(17376,null)),g=ymt(u.filter(b=>b.type==="dark"),d(17374,null)),f=ymt(u.filter(b=>Uf(b.type)),d(17375,null)),v;switch(t){case"dark":v=[...g,...h,...f];break;case"hcDark":case"hcLight":v=[...f,...h,...g];break;case"light":default:v=[...h,...g,...f];break}await c.openQuickPick(v,p)}});var YWo="workbench.action.selectIconTheme";W(class extends z{constructor(){super({id:YWo,title:P(17369,"File Icon Theme"),category:Fe.Preferences,f1:!0})}async run(a){let i=a.get(ep),e={installMessage:d(17358,null),placeholderMessage:d(17379,null),marketplaceTag:"tag:icon-theme"},t=(l,c)=>i.setFileIconTheme(l,c),o=(l,c,u)=>i.getMarketplaceFileIconThemes(l,c,u),r=a.get(F).createInstance(_Ie,e,t,o),s=[{type:"separator",label:d(17352,null)},{id:"",theme:TU.noIconTheme,label:d(17365,null),description:d(17364,null)},...ymt(await i.getFileIconThemes())];await r.openQuickPick(s,i.getFileIconTheme())}});var XWo="workbench.action.selectProductIconTheme";W(class extends z{constructor(){super({id:XWo,title:P(17370,"Product Icon Theme"),category:Fe.Preferences,f1:!0})}async run(a){let i=a.get(ep),e={installMessage:d(17360,null),browseMessage:"$(plus) "+d(17347,null),placeholderMessage:d(17382,null),marketplaceTag:"tag:product-icon-theme"},t=(l,c)=>i.setProductIconTheme(l,c),o=(l,c,u)=>i.getMarketplaceProductIconThemes(l,c,u),r=a.get(F).createInstance(_Ie,e,t,o),s=[{type:"separator",label:d(17367,null)},{id:ige,theme:_U.defaultTheme,label:d(17351,null)},...ymt(await i.getProductIconThemes())];await r.openQuickPick(s,i.getProductIconTheme())}});W(class extends z{constructor(){super({id:"workbench.action.tryNewDefaultThemes",title:P(17390,"Try New Default Themes"),category:Fe.Preferences,f1:!0})}async run(a){let i=a.get(ep),e=a.get($e),t=a.get(B),o=i.getColorTheme(),n=await i.getColorThemes(),r=new Set([fl.COLOR_THEME_LIGHT,fl.COLOR_THEME_DARK]),s=n.filter(f=>r.has(f.settingsId)),l=s.map(f=>({id:f.id,label:f.label,description:f.description})),c=new O,u=c.add(e.createQuickPick());u.items=l,u.placeholder=d(17366,null),u.canSelectMany=!1;let p=o.type==="light"||o.type==="hcLight"?fl.COLOR_THEME_LIGHT:fl.COLOR_THEME_DARK,h=l.find(f=>s.find(v=>v.id===f.id)?.settingsId===p);h&&(u.activeItems=[h]),c.add(u.onDidChangeActive(f=>{if(f[0]){let v=s.find(b=>b.id===f[0].id);v&&i.setColorTheme(v,"preview")}})),c.add(u.onDidAccept(()=>{let f=u.activeItems[0],v=f?s.find(b=>b.id===f.id):void 0;u.hide(),v&&(async()=>{try{await i.setColorTheme(v,"auto"),await t.updateValue("workbench.preferredLightColorTheme",fl.COLOR_THEME_LIGHT),await t.updateValue("workbench.preferredDarkColorTheme",fl.COLOR_THEME_DARK)}catch(b){Yi(b)||mt(b)}})()}));let g=new Promise(f=>{c.add(u.onDidHide(()=>{u.selectedItems.length||i.setColorTheme(o,void 0),f()}))}).finally(()=>c.dispose());return u.show(),g}});Ge.registerCommand("workbench.action.previewColorTheme",async function(a,i,e){let t=a.get(ep),o=gRn(await t.getColorThemes(),i);o.length===0&&(o=await t.getMarketplaceColorThemes(i.publisher,i.name,i.version));for(let n of o)if(!e||n.settingsId===e)return await t.setColorTheme(n,"preview"),n.settingsId});function gRn(a,i){return a.filter(({extensionData:e})=>e&&e.extensionIsBuiltin&&xr(e.extensionPublisher,i.publisher)&&xr(e.extensionName,i.name))}function jWo(a,i){return{id:void 0,label:a,alwaysShow:!0,buttons:[fqi],configureItem:i}}function zYt(a){return a.type!=="separator"}var fRn={[fl.COLOR_THEME_LIGHT]:d(17350,null),[fl.COLOR_THEME_DARK]:d(17349,null)};function vRn(a){let i=a.settingsId??void 0,e={id:a.id,theme:a,label:a.label,description:fRn[i??""]??a.description??(a.label===i?void 0:i)};return a.extensionData&&(e.buttons=[fqi]),e}function ymt(a,i){let e=new Set([fl.COLOR_THEME_DARK,fl.COLOR_THEME_LIGHT]),t=(n,r)=>{let s=e.has(n.theme?.settingsId??""),l=e.has(r.theme?.settingsId??"");return s!==l?s?-1:1:n.label.localeCompare(r.label)},o=a.map(vRn).sort(t);return o.length>0&&i&&o.unshift({type:"separator",label:i}),o}var fqi={iconClass:q.asClassName(hRn),tooltip:d(17361,null)};W(class extends z{constructor(){super({id:"workbench.action.generateColorTheme",title:P(17353,"Generate Color Theme From Current Settings"),category:Fe.Developer,f1:!0})}run(a){let e=a.get(ep).getColorTheme(),o=oe.as(Fce.ColorContribution).getColors().filter(u=>!u.deprecationMessage).map(u=>u.id).sort(),n={},r=[];for(let u of o){let p=e.getColor(u,!1);p?n[u]=Ue.Format.CSS.formatHexA(p,!0):r.push(u)}let s=[];for(let u of r){let p=e.getColor(u);p?n["__"+u]=Ue.Format.CSS.formatHexA(p,!0):s.push(u)}for(let u of s)n["__"+u]=null;let l=JSON.stringify({$schema:L_i,type:e.type,colors:n,tokenColors:e.tokenColors.filter(u=>!!u.scope)},null,"	");return l=l.replace(/\"__/g,'//"'),a.get(ie).openEditor({resource:void 0,contents:l,languageId:"jsonc",options:{pinned:!0}})}});var bRn="workbench.action.toggleLightDarkThemes";W(class extends z{constructor(){super({id:bRn,title:P(17389,"Toggle between Light/Dark Themes"),category:Fe.Preferences,f1:!0})}async run(a){let i=a.get(ep),e=a.get(B),t=a.get(Ne),o=a.get(Qo);if(e.getValue("window.autoDetectColorScheme")){let l=d(17348,null,"window.autoDetectColorScheme");t.prompt(ft.Info,l,[{label:d(17354,null),run:()=>o.openUserSettings({query:"window.autoDetectColorScheme"})}]);return}let n=i.getColorTheme(),r="workbench.preferredDarkColorTheme";switch(n.type){case"light":r="workbench.preferredDarkColorTheme";break;case"dark":r="workbench.preferredLightColorTheme";break;case"hcLight":r="workbench.preferredHighContrastColorTheme";break;case"hcDark":r="workbench.preferredHighContrastLightColorTheme";break}let s=e.getValue(r);if(s&&typeof s=="string"){let l=(await i.getColorThemes()).find(c=>c.settingsId===s);l&&i.setColorTheme(l.id,"auto")}}});var SRn="workbench.action.browseColorThemesInMarketplace";W(class extends z{constructor(){super({id:SRn,title:P(17345,"Browse Color Themes in Marketplace"),category:Fe.Preferences,f1:!0})}async run(a){let i="category:themes",e=a.get(ep),t=a.get(ga),o=a.get(aE),n=a.get(Ui),r=a.get(F);if(!t.isEnabled())return;if(!await o.supportsExtensionGalleryResources()){await n.openSearch(i);return}let s=e.getColorTheme(),l=(h,g,f)=>e.getMarketplaceColorThemes(h,g,f),c,u=(h,g)=>{c&&clearTimeout(c),c=ut.setTimeout(()=>{c=void 0;let f=h??s;e.setColorTheme(f,g?"auto":"preview").then(void 0,v=>{mt(v),e.setColorTheme(s,void 0)})},g?0:200)};await r.createInstance(jGe,l,i).openQuickPick("",e.getColorTheme(),u).then(void 0,mt)}});var wmt=new R("ThemesSubMenu");be.appendMenuItem(R.GlobalActivity,{title:d(17373,null),submenu:wmt,group:"2_configuration",order:7});be.appendMenuItem(R.MenubarPreferencesMenu,{title:d(17363,null),submenu:wmt,group:"2_configuration",order:7});be.appendMenuItem(wmt,{command:{id:QWo,title:d(17372,null)},order:1});be.appendMenuItem(wmt,{command:{id:YWo,title:d(17380,null)},order:2});be.appendMenuItem(wmt,{command:{id:XWo,title:d(17383,null)},order:3});var IRn=oe.as($t.Configuration);IRn.registerConfiguration({id:"update",order:15,title:d(2953,null),type:"object",properties:{"update.mode":{type:"string",enum:["none","manual","start","default"],default:"default",scope:1,description:d(2954,null),tags:["usesOnlineServices"],enumDescriptions:[d(2949,null),d(2948,null),d(2952,null),d(2944,null)],policy:{name:"UpdateMode",category:"Update",minimumVersion:"1.67",localization:{description:{key:"updateMode",value:d(2954,null)},enumDescriptions:[{key:"none",value:d(2949,null)},{key:"manual",value:d(2948,null)},{key:"start",value:d(2952,null)},{key:"default",value:d(2944,null)}]}}},"update.channel":{type:"string",default:"default",scope:1,description:d(2954,null),deprecationMessage:d(2945,null,"update.mode")},"update.enableWindowsBackgroundUpdates":{type:"boolean",default:!0,scope:1,title:d(2947,null),description:d(2946,null),included:ii&&!Ft},"update.showReleaseNotes":{type:"boolean",default:!0,scope:1,description:d(2951,null),tags:["usesOnlineServices"],agentsWindow:{default:!1,readOnly:!0}},"update.showPostInstallInfo":{type:"boolean",default:!1,scope:1,description:d(2950,null),tags:["usesOnlineServices"]},"update.titleBar":{type:"boolean",default:!0,scope:1,description:d(2955,null),included:!Ft}}});var QGe=class{constructor(i,e,t,o,n){this._configurationService=i;this._contextMenuService=e;this._preferencesService=t;this._telemetryService=o;this._clipboardService=n;this._updatedSettings=new Map;this._encounteredSettings=new Map;this._featuredSettings=new Map;this.codeSettingAnchorRegex=new RegExp('^<a (href)=".*code.*://settings/([^\\s"]+)"(?:\\s*codesetting="([^"]+)")?>'),this.codeSettingSimpleRegex=new RegExp("^setting\\(([^\\s:)]+)(?::([^)]+))?\\)$")}get featuredSettingStates(){let i=new Map;for(let[e,t]of this._featuredSettings)i.set(e,this._configurationService.getValue(e)===t);return i}replaceAnchor(i){let e=this.codeSettingAnchorRegex.exec(i);if(e&&e.length===4){let t=e[2],o=this.render(t,e[3]);if(o)return i.replace(this.codeSettingAnchorRegex,o)}}replaceSimple(i){let e=this.codeSettingSimpleRegex.exec(i);if(e&&e.length===3){let t=e[1],o=this.render(t,e[2]);if(o)return i.replace(this.codeSettingSimpleRegex,o)}}getHtmlRenderer(){return({raw:i})=>{let e=this.replaceAnchor(i);return e&&(i=e),i}}getCodeSpanRenderer(){return({text:i})=>{let e=this.replaceSimple(i);return e||`<code>${i}</code>`}}settingToUriString(i,e){return`${Q.codeSetting}://${i}${e?`/${e}`:""}`}getSetting(i){return this._encounteredSettings.has(i)?this._encounteredSettings.get(i):this._preferencesService.getSetting(i)}parseValue(i,e){if(e==="undefined"||e==="")return;let t=this.getSetting(i);if(!t)return e;switch(t.type){case"boolean":return e==="true";case"number":return parseInt(e,10);default:return e}}render(i,e){let t=this.getSetting(i);return t?this.renderSetting(t,e):`<code>${i}</code>`}viewInSettingsMessage(i,e){if(e)return d(12726,null);{let t=IQ(i);return d(12727,null,t.category,t.label)}}restorePreviousSettingMessage(i){let e=IQ(i);return d(12723,null,e.category,e.label)}isAlreadySet(i,e){let t=this._configurationService.getValue(i.key);return t===e||t===void 0&&i.value===e}booleanSettingMessage(i,e){let t=IQ(i.key);return this.isAlreadySet(i,e)?e?d(12716,null,t.category,t.label):d(12715,null,t.category,t.label):e?d(12725,null,t.category,t.label):d(12721,null,t.category,t.label)}stringSettingMessage(i,e){let t=IQ(i.key);return this.isAlreadySet(i,e)?d(12718,null,t.category,t.label,e):d(12724,null,t.category,t.label,e)}numberSettingMessage(i,e){let t=IQ(i.key);return this.isAlreadySet(i,e)?d(12717,null,t.category,t.label,e):d(12722,null,t.category,t.label,e)}renderSetting(i,e){let t=this.settingToUriString(i.key,e),o=d(12719,null);return`<code tabindex="0"><a href="${t}" class="codesetting" title="${o}" aria-role="button"><svg width="14" height="14" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M9.1 4.4L8.6 2H7.4l-.5 2.4-.7.3-2-1.3-.9.8 1.3 2-.2.7-2.4.5v1.2l2.4.5.3.8-1.3 2 .8.8 2-1.3.8.3.4 2.3h1.2l.5-2.4.8-.3 2 1.3.8-.8-1.3-2 .3-.8 2.3-.4V7.4l-2.4-.5-.3-.8 1.3-2-.8-.8-2 1.3-.7-.2zM9.4 1l.5 2.4L12 2.1l2 2-1.4 2.1 2.4.4v2.8l-2.4.5L14 12l-2 2-2.1-1.4-.5 2.4H6.6l-.5-2.4L4 13.9l-2-2 1.4-2.1L1 9.4V6.6l2.4-.5L2.1 4l2-2 2.1 1.4.4-2.4h2.8zm.6 7c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zM8 9c.6 0 1-.4 1-1s-.4-1-1-1-1 .4-1 1 .4 1 1 1z"/></svg>
			<span class="separator"></span>
			<span class="setting-name">${i.key}</span>
		</a></code>`}getSettingMessage(i,e){if(i.type==="boolean")return this.booleanSettingMessage(i,e);if(i.type==="string")return this.stringSettingMessage(i,e);if(i.type==="number")return this.numberSettingMessage(i,e)}async restoreSetting(i){let e=this._updatedSettings.get(i);return this._updatedSettings.delete(i),this._configurationService.updateValue(i,e,2)}async setSetting(i,e,t){return this._updatedSettings.set(i,e),this._configurationService.updateValue(i,t,2)}getActions(i){if(i.scheme!==Q.codeSetting)return;let e=[],t=i.authority,o=this.parseValue(i.authority,i.path.substring(1)),n=this._configurationService.inspect(t).userValue;if(o!==void 0&&o===n&&this._updatedSettings.has(t)){let s=this.restorePreviousSettingMessage(t);e.push({class:void 0,id:"restoreSetting",enabled:!0,tooltip:s,label:s,run:()=>this.restoreSetting(t)})}else if(o!==void 0){let s=this.getSetting(t),l=s?this.getSettingMessage(s,o):void 0;s&&l&&e.push({class:void 0,id:"trySetting",enabled:!this.isAlreadySet(s,o),tooltip:l,label:l,run:()=>{this.setSetting(t,n,o)}})}let r=this.viewInSettingsMessage(t,e.length>0);return e.push({class:void 0,enabled:!0,id:"viewInSettings",tooltip:r,label:r,run:()=>this._preferencesService.openApplicationSettings({query:`@id:${t}`})}),e.push({class:void 0,enabled:!0,id:"copySettingId",tooltip:d(12720,null),label:d(12720,null),run:()=>{this._clipboardService.writeText(t)}}),e}showContextMenu(i,e,t){let o=this.getActions(i);o&&this._contextMenuService.showContextMenu({getAnchor:()=>({x:e,y:t}),getActions:()=>o,getActionViewItem:n=>new ts(n,n,{label:!0})})}async updateSetting(i,e,t){if(i.scheme===Q.codeSetting)return this._telemetryService.publicLog2("releaseNotesSettingAction",{settingId:i.authority}),this.showContextMenu(i,e,t)}};QGe=I([m(0,B),m(1,Xe),m(2,Qo),m(3,_e),m(4,Bi)],QGe);var YGe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this._environmentService=e;this._keybindingService=t;this._languageService=o;this._openerService=n;this._requestService=r;this._configurationService=s;this._editorService=l;this._editorGroupService=c;this._codeEditorService=u;this._webviewWorkbenchService=p;this._extensionService=h;this._productService=g;this._instantiationService=f;this._releaseNotesCache=new Map;this._currentReleaseNotes=void 0;this._register(vc.onDidChange(()=>this.updateHtml())),this._register(s.onDidChangeConfiguration(v=>this.onDidChangeConfiguration(v))),this._register(p.onDidChangeActiveWebviewEditor(v=>this.onDidChangeActiveWebviewEditor(v))),this._simpleSettingRenderer=this._instantiationService.createInstance(QGe)}async updateHtml(){if(!this._currentReleaseNotes||!this._lastMeta)return;let e=await this.renderBody(this._lastMeta);this._currentReleaseNotes&&this._currentReleaseNotes.webview.setHtml(e)}async getBase(e){if(e){let t=this._codeEditorService.getActiveCodeEditor()?.getModel()?.uri;if(t)return ai(t)}return A.parse("https://code.visualstudio.com/raw")}async show(e,t){let o=await this.loadReleaseNotes(e,t),n=await this.getBase(t);this._lastMeta={text:o,base:n};let r=await this.renderBody(this._lastMeta),s=d(17438,null,e),l=this._editorService.activeEditorPane;if(this._currentReleaseNotes)this._currentReleaseNotes.setWebviewTitle(s),this._currentReleaseNotes.webview.setHtml(r),this._webviewWorkbenchService.revealWebview(this._currentReleaseNotes,l?l.group:this._editorGroupService.activeGroup,!1);else{this._currentReleaseNotes=this._webviewWorkbenchService.openWebview({title:s,options:{tryRestoreScrollPosition:!0,enableFindWidget:!0,disableServiceWorker:!t},contentOptions:{localResourceRoots:t?[n]:[],allowScripts:!0},extension:void 0},"releaseNotes",s,L.vscode,{group:tr,preserveFocus:!1});let c=new O;c.add(this._currentReleaseNotes.webview.onDidClickLink(u=>this.onDidClickLink(A.parse(u)))),c.add(this._currentReleaseNotes.webview.onMessage(u=>{if(u.message.type==="showReleaseNotes")this._configurationService.updateValue("update.showReleaseNotes",u.message.value);else if(u.message.type==="clickSetting"){let p=this._currentReleaseNotes?.webview.container.offsetLeft+u.message.value.x,h=this._currentReleaseNotes?.webview.container.offsetTop+u.message.value.y;this._simpleSettingRenderer.updateSetting(A.parse(u.message.value.uri),p,h)}})),c.add(this._currentReleaseNotes.onWillDispose(()=>{c.dispose(),this._currentReleaseNotes=void 0})),this._currentReleaseNotes.webview.setHtml(r)}return!0}async loadReleaseNotes(e,t){let o=/^(\d+\.\d+)\./.exec(e);if(!o)throw new Error("not found");let s=`https://code.visualstudio.com/raw/v${o[1].replace(/\./g,"_")}.md`,l=d(17440,null),c=h=>Cr(h).replace(/\\/g,"\\\\"),u=h=>{let g=(S,y)=>{let w=this._keybindingService.lookupKeybinding(y);return w&&w.getLabel()||l},f=(S,y)=>{let w=dP.parseKeybinding(y);if(!w)return l;let x=this._keybindingService.resolveKeybinding(w);return x.length===0?l:x[0].getLabel()||l},v=(S,y)=>{let w=g(S,y);return w&&`<code title="${y}">${c(w)}</code>`},b=(S,y)=>{let w=f(S,y);return w&&`<code title="${y}">${c(w)}</code>`};return h.replace(/`kb\(([a-z.\d\-]+)\)`/gi,v).replace(/`kbstyle\(([^\)]+)\)`/gi,b).replace(/kb\(([a-z.\d\-]+)\)/gi,(S,y)=>Ru(g(S,y))).replace(/kbstyle\(([^\)]+)\)/gi,(S,y)=>Ru(f(S,y)))},p=async()=>{let h;try{if(t){let g=this._codeEditorService.getActiveCodeEditor()?.getModel()?.getValue();h=g?g.substring(g.indexOf("#")):void 0}else h=await gC(await this._requestService.request({url:s,callSite:"releaseNotesEditor.fetchReleaseNotes"},Ie.None))}catch{throw new Error("Failed to fetch release notes")}if(!h||!/^#\s/.test(h)&&!t)throw new Error("Invalid release notes");return u(h)};return t?p():(this._releaseNotesCache.has(e)||this._releaseNotesCache.set(e,(async()=>{try{return await p()}catch(h){throw this._releaseNotesCache.delete(e),h}})()),this._releaseNotesCache.get(e))}async onDidClickLink(e){e.scheme===Q.codeSetting||this.addGAParameters(e,"ReleaseNotes").then(t=>this._openerService.open(t,{allowCommands:["workbench.action.openSettings","summarize.release.notes"]})).then(void 0,mt)}async addGAParameters(e,t,o="1"){return EM(this._productService,this._environmentService)&&Yy(this._configurationService)===3&&e.scheme==="https"&&e.authority==="code.visualstudio.com"?e.with({query:`${e.query?e.query+"&":""}utm_source=VsCode&utm_medium=${encodeURIComponent(t)}&utm_content=${encodeURIComponent(o)}`}):e}async renderBody(e){let t=ht(),o=await wRn(e.text,this._extensionService,this._languageService,this._simpleSettingRenderer,this._productService.quality),n=vc.getColorMap(),r=n?ED(n):"",s=!!this._configurationService.getValue("update.showReleaseNotes");return`<!DOCTYPE html>
		<html>
			<head>
				<base href="${ioe(e.base).toString(!0)}/" >
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https: data:; media-src https:; style-src 'nonce-${t}' https://code.visualstudio.com; script-src 'nonce-${t}';">
				<style nonce="${t}">
					${D1}
					${r}

					/* codesetting */

					code:has(.codesetting) {
						background-color: var(--vscode-textPreformat-background);
						color: var(--vscode-textPreformat-foreground);
						padding-left: 1px;
						margin-right: 3px;
						padding-right: 0px;
					}

					code:has(.codesetting):focus {
						border: 1px solid var(--vscode-button-border, transparent);
					}

					.codesetting {
						color: var(--vscode-textPreformat-foreground);
						padding: 0px 1px 1px 0px;
						font-size: 0px;
						overflow: hidden;
						text-overflow: ellipsis;
						outline-offset: 2px !important;
						box-sizing: border-box;
						text-align: center;
						cursor: pointer;
						display: inline;
						margin-right: 3px;
					}
					.codesetting svg {
						font-size: 12px;
						text-align: center;
						cursor: pointer;
						border: 1px solid var(--vscode-button-secondaryBorder, transparent);
						outline: 1px solid transparent;
						line-height: 9px;
						margin-bottom: -5px;
						padding-left: 0px;
						padding-top: 2px;
						padding-bottom: 2px;
						padding-right: 2px;
						display: inline-block;
						text-decoration: none;
						text-rendering: auto;
						text-transform: none;
						-webkit-font-smoothing: antialiased;
						-moz-osx-font-smoothing: grayscale;
						user-select: none;
						-webkit-user-select: none;
					}
					.codesetting .setting-name {
						font-size: 13px;
						padding-left: 2px;
						padding-right: 3px;
						padding-top: 1px;
						padding-bottom: 1px;
						margin-top: -3px;
					}
					.codesetting:hover {
						color: var(--vscode-textPreformat-foreground) !important;
						text-decoration: none !important;
					}
					code:has(.codesetting):hover {
						filter: brightness(140%);
						text-decoration: none !important;
					}
					.codesetting:focus {
						outline: 0 !important;
						text-decoration: none !important;
						color: var(--vscode-button-hoverForeground) !important;
					}
					.codesetting .separator {
						width: 1px;
						height: 14px;
						margin-bottom: -3px;
						display: inline-block;
						background-color: var(--vscode-editor-background);
						font-size: 12px;
						margin-right: 4px;
					}

					header { display: flex; align-items: center; padding-top: 1em; }

					/* Release notes enhancements from vscode-docs */
					html {
						font-size: 10px;
						height: 100%;
						overscroll-behavior: none;
					}

					body {
						margin: 0 auto;
						max-width: 980px;
						height: auto;
						overflow-y: auto;
						overscroll-behavior: none;
					}

					/* Scroll to top button */
					#scroll-to-top {
						position: fixed;
						width: 40px;
						height: 40px;
						right: 25px;
						bottom: 25px;
						background-color: var(--vscode-button-background, #444);
						border-color: var(--vscode-button-border);
						border-radius: 50%;
						cursor: pointer;
						box-shadow: 1px 1px 1px rgba(0,0,0,.25);
						outline: none;
						display: flex;
						justify-content: center;
						align-items: center;
					}

					#scroll-to-top:hover {
						background-color: var(--vscode-button-hoverBackground);
						box-shadow: 2px 2px 2px rgba(0,0,0,.25);
					}

					body.vscode-high-contrast #scroll-to-top {
						border-width: 2px;
						border-style: solid;
						box-shadow: none;
					}

					#scroll-to-top span.icon::before {
						content: "";
						display: block;
						background: var(--vscode-button-foreground);
						/* Chevron up icon */
						-webkit-mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						mask-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPHN0eWxlIHR5cGU9InRleHQvY3NzIj4KCS5zdDB7ZmlsbDojRkZGRkZGO30KCS5zdDF7ZmlsbDpub25lO30KPC9zdHlsZT4KPHRpdGxlPnVwY2hldnJvbjwvdGl0bGU+CjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik04LDUuMWwtNy4zLDcuM0wwLDExLjZsOC04bDgsOGwtMC43LDAuN0w4LDUuMXoiLz4KPHJlY3QgY2xhc3M9InN0MSIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2Ii8+Cjwvc3ZnPgo=');
						width: 16px;
						height: 16px;
					}

					/* Header styling */
					h2 {
						margin-top: 1.2em;
						scroll-margin-top: 1.2em;
					}

					h2:not(:first-of-type) {
						margin-top: 4em;
						scroll-margin-top: 1em;
					}

					h3 {
						margin-top: 4em;
						scroll-margin-top: 1em;
					}

					h2 + h3 {
						margin-top: 0;
					}

					/* Highlights table styling */
					.highlights-table {
						border-collapse: collapse;
						border: none;
					}

					.highlights-table th {
						vertical-align: top;
						border: none;
						padding-top: 2em;
						font-weight: bold;
					}

					.highlights-table td {
						vertical-align: top;
						border: none;
					}

					.highlights-table tr:nth-child(2) td {
						padding-bottom: 1em;
					}

					/* Main content layout */
					.toc-nav-layout {
						display: flex;
						align-items: flex-start;
					}

					/* TOC Navigation */
					#toc-nav {
						position: sticky;
						top: 20px;
						width: 10vw;
						min-width: 120px;
						margin-right: 32px;
						margin-top: 2em;
					}

					#toc-nav > div {
						font-weight: bold;
						font-size: 1em;
						margin-bottom: 1em;
						text-transform: uppercase;
					}

					#toc-nav ul {
						list-style: none;
						padding: 0;
						margin: 0;
					}

					#toc-nav ul li {
						margin-bottom: 0.5em;
					}

					#toc-nav a {
						color: var(--vscode-editor-foreground, #ccc);
						text-decoration: none !important;
						transition: background-color 0.2s, color 0.2s;
						padding: 4px 6px;
						margin: -4px -6px;
						border-radius: 4px;
						display: block;
						outline: none;
					}

					#toc-nav a:hover {
						background-color: var(--vscode-button-secondaryHoverBackground, #1177bb);
						color: var(--vscode-button-secondaryForeground, #ffffff);
						cursor: pointer;
						text-decoration: none !important;
					}

					/* Main content area */
					.notes-main {
						flex: 1;
						min-width: 0;
					}

					/* Responsive breakpoint - Hide TOC on smaller screens */
					@media (max-width: 576px) {
						#toc-nav {
							display: none;
						}

						.toc-nav-layout {
							flex-direction: column;
						}

						.notes-main {
							margin-left: 0;
						}
					}

				</style>
			</head>
			<body>
				${o}
				<script nonce="${t}">
					const vscode = acquireVsCodeApi();
					const container = document.createElement('p');
					container.style.display = 'flex';
					container.style.alignItems = 'center';

					const input = document.createElement('input');
					input.type = 'checkbox';
					input.id = 'showReleaseNotes';
					input.checked = ${s};
					container.appendChild(input);

					const label = document.createElement('label');
					label.htmlFor = 'showReleaseNotes';
					label.textContent = '${d(17439,null)}';
					container.appendChild(label);

					const beforeElement = document.querySelector("body > h1")?.nextElementSibling;
					if (beforeElement) {
						document.body.insertBefore(container, beforeElement);
					} else {
						document.body.appendChild(container);
					}

					window.addEventListener('message', event => {
						if (event.data.type === 'showReleaseNotes') {
							input.checked = event.data.value;
						}
					});

					window.addEventListener('click', event => {
						const href = event.target.href ?? event.target.parentElement?.href ?? event.target.parentElement?.parentElement?.href;
						if (href && (href.startsWith('${Q.codeSetting}'))) {
							vscode.postMessage({ type: 'clickSetting', value: { uri: href, x: event.clientX, y: event.clientY }});
						}
					});

					window.addEventListener('keypress', event => {
						if (event.keyCode === 13) {
							if (event.target.children.length > 0 && event.target.children[0].href) {
								const clientRect = event.target.getBoundingClientRect();
								vscode.postMessage({ type: 'clickSetting', value: { uri: event.target.children[0].href, x: clientRect.right , y: clientRect.bottom }});
							}
						}
					});

					input.addEventListener('change', event => {
						vscode.postMessage({ type: 'showReleaseNotes', value: input.checked }, '*');
					});
				</script>
			</body>
		</html>`}onDidChangeConfiguration(e){e.affectsConfiguration("update.showReleaseNotes")&&this.updateCheckboxWebview()}onDidChangeActiveWebviewEditor(e){e&&e===this._currentReleaseNotes&&this.updateCheckboxWebview()}updateCheckboxWebview(){this._currentReleaseNotes&&this._currentReleaseNotes.webview.postMessage({type:"showReleaseNotes",value:this._configurationService.getValue("update.showReleaseNotes")})}};YGe=I([m(0,ko),m(1,Le),m(2,Rt),m(3,Je),m(4,Ra),m(5,B),m(6,ie),m(7,kt),m(8,Qt),m(9,Hx),m(10,lt),m(11,Ze),m(12,F)],YGe);function yRn(a,i){return a.replace(/<!--\s*%IF\s+(\w+)\s*%([\s\S]*?)%ENDIF\s*%\s*-->/gi,(e,t,o)=>i.has(t.toUpperCase())?o:"")}async function wRn(a,i,e,t,o){a=a.toString().replace(/<!--\s*TOC\s*/gi,"").replace(/\s*Navigation End\s*-->/gi,"");let n=new Set(["IN_PRODUCT"]);return o==="stable"?n.add("STABLE"):o==="insider"&&n.add("INSIDERS"),a=yRn(a,n),P$(a,i,e,{sanitizerConfig:{allowRelativeMediaPaths:!0,allowedLinkProtocols:{override:[Q.http,Q.https,Q.command,Q.codeSetting]},allowedTags:{augment:["nav","svg","path"]},allowedAttributes:{augment:["aria-role","viewBox","fill","xmlns","d"]}},markedExtensions:[{renderer:{html:t.getHtmlRenderer(),codespan:t.getCodeSpanRenderer()}}]})}function XGe(a,i){if(!(a===void 0||i===void 0||i<=0))return Math.max(Math.min(Math.round(a/i*100),100),0)}function JWo(a){let{downloadedBytes:i,totalBytes:e,startTime:t}=a;if(i===void 0||e===void 0||t===void 0)return;let o=Date.now()-t;if(i<=0||e<=0||o<=0)return;let n=e-i;if(n<=0)return 0;let r=i/o;if(r<=0)return;let s=n/r;return Math.ceil(s/1e3)}function ZWo(a){let{downloadedBytes:i,startTime:e}=a;if(i===void 0||e===void 0)return;let t=Date.now()-e;if(!(t<=0||i<=0))return i/t*1e3}function eVo(a){return`https://code.visualstudio.com/raw/v${a.replace(/\./g,"_").replace(/_0$/,"")}_update.md`}function tVo(a){let i=a/3600;if(i>=1){let t=KYt(i);return t==="1"?d(17539,null,t):d(17540,null,t)}let e=Math.floor(a/60);return e>=1?d(17541,null,e):d(17542,null,a)}function GYt(a){if(a<1024)return d(17535,null,a);let i=a/1024;if(i<1024)return d(17537,null,KYt(i));let e=i/1024;if(e<1024)return d(17538,null,KYt(e));let t=e/1024;return d(17536,null,KYt(t))}function iVo(a){if(a!==void 0)try{let i=Date.parse(a);return isNaN(i)?void 0:i}catch{return}}function oVo(a){return new Date(a).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function KYt(a){let i=Math.round(a*10)/10;return i%1===0?i.toString():i.toFixed(1)}function DIe(a){if(a===void 0)return;let i=/^(\d{1,10})\.(\d{1,10})\.(\d{1,10})/.exec(a);if(i)try{return{major:parseInt(i[1]),minor:parseInt(i[2]),patch:parseInt(i[3])}}catch{return}}function nVo(a,i){let e=DIe(a),t=DIe(i);return!!e&&!!t&&(e.major!==t.major||e.minor!==t.minor)}var hL=new Y("updateState","uninitialized"),rVo=new Y("majorMinorUpdateAvailable",!1),vqi;function Cmt(a,i,e){return vqi||(vqi=a.createInstance(YGe)),vqi.show(i,e)}async function CRn(a){let i=a.get(Je),e=a.get(Ze);if(e.releaseNotesUrl){let t=A.parse(e.releaseNotesUrl);await i.open(t)}else throw new Error(d(17461,null,e.nameLong))}async function xRn(a,i){let e=a.get(F);try{await Cmt(e,i,!1)}catch(t){try{await e.invokeFunction(CRn)}catch(o){throw new Error(`${t.message} and ${o.message}`)}}}function kRn(a,i){be.appendMenuItem(a,{group:i,command:{id:"update.check",title:d(17441,null)},when:hL.isEqualTo("idle")}),be.appendMenuItem(a,{group:i,command:{id:"update.checking",title:d(17443,null),precondition:C.false()},when:hL.isEqualTo("checking for updates")}),be.appendMenuItem(a,{group:i,command:{id:"update.downloadNow",title:d(17444,null)},when:hL.isEqualTo("available for download")}),be.appendMenuItem(a,{group:i,command:{id:"update.downloading",title:d(17446,null),precondition:C.false()},when:hL.isEqualTo("downloading")}),be.appendMenuItem(a,{group:i,command:{id:"update.install",title:d(17448,null)},when:hL.isEqualTo("downloaded")}),be.appendMenuItem(a,{group:i,command:{id:"update.updating",title:d(17447,null),precondition:C.false()},when:hL.isEqualTo("updating")}),be.appendMenuItem(a,{group:i,order:2,command:{id:"update.restart",title:d(17455,null)},when:hL.isEqualTo("ready")})}function sVo(a,i){return a.major<i.major||a.minor<i.minor}var w7=class{static{this.KEY="releaseNotes/lastVersion"}constructor(i,e,t,o,n,r,s,l){Ft||s.hadLastFocus().then(async c=>{if(!c)return;let u=DIe(i.get(w7.KEY,-1,"")),p=DIe(l.version),h=r.getValue("update.showReleaseNotes"),g=r.getValue("update.showPostInstallInfo"),f=l.releaseNotesUrl;h&&!g&&!o.skipReleaseNotes&&f&&u&&p&&sVo(u,p)&&Cmt(e,l.version,!1).then(void 0,()=>{t.prompt(wt.Info,d(17449,null,l.nameLong,l.version),[{label:d(17453,null),run:()=>{let v=A.parse(f);n.open(v)}}],{priority:1})}),i.store(w7.KEY,l.version,-1,1)})}};w7=I([m(0,de),m(1,F),m(2,Ne),m(3,Od),m(4,Je),m(5,B),m(6,ti),m(7,Ze)],w7);var JGe=class extends k{constructor(e,t,o,n,r,s){super();this.instantiationService=t;this.updateService=o;this.activityService=n;this.productService=s;this.badgeDisposable=this._register(new ue);this.state=o.state,this.updateStateContextKey=hL.bindTo(r),this.majorMinorUpdateAvailableContextKey=rVo.bindTo(r),this._register(o.onStateChange(this.onUpdateStateChange,this)),this.onUpdateStateChange(this.updateService.state);let l=this.productService.commit,c=e.get("update/lastKnownVersion",-1);l!==c&&(e.remove("update/lastKnownVersion",-1),e.remove("update/updateNotificationTime",-1)),this.registerGlobalActivityActions()}async onUpdateStateChange(e){switch(this.updateStateContextKey.set(e.type),e.type){case"ready":{let o=e.update.productVersion;if(o){let n=DIe(this.productService.version),r=DIe(o);this.majorMinorUpdateAvailableContextKey.set(!!(n&&r&&sVo(n,r)))}break}}let t;e.type==="available for download"||e.type==="downloaded"||e.type==="ready"?t=new eu(1,()=>d(17462,null,this.productService.nameShort)):e.type==="checking for updates"?t=new Jx(()=>d(17442,null,this.productService.nameShort)):e.type==="downloading"||e.type==="overwriting"?t=new Jx(()=>d(17445,null,this.productService.nameShort)):e.type==="updating"&&(t=new Jx(()=>d(17463,null,this.productService.nameShort))),this.badgeDisposable.clear(),t&&(this.badgeDisposable.value=this.activityService.showGlobalActivity({badge:t})),this.state=e}registerGlobalActivityActions(){Ge.registerCommand("update.check",()=>this.updateService.checkForUpdates(!0)),Ge.registerCommand("update.checking",()=>{}),Ge.registerCommand("update.downloadNow",()=>this.updateService.downloadUpdate(!0)),Ge.registerCommand("update.downloading",()=>{}),Ge.registerCommand("update.install",()=>this.updateService.applyUpdate()),Ge.registerCommand("update.updating",()=>{}),Ge.registerCommand("update.restart",()=>this.updateService.quitAndInstall()),Ge.registerCommand("_update.state",()=>this.state),kRn(R.GlobalActivity,"7_update"),this.productService.quality==="stable"&&(Ge.registerCommand("update.showUpdateReleaseNotes",()=>{if(this.updateService.state.type!=="ready")return;let e=this.updateService.state.update.productVersion;e&&this.instantiationService.invokeFunction(t=>xRn(t,e))}),be.appendMenuItem(R.GlobalActivity,{group:"7_update",order:1,command:{id:"update.showUpdateReleaseNotes",title:d(17458,null)},when:C.and(hL.isEqualTo("ready"),rVo)}))}};JGe=I([m(0,de),m(1,F),m(2,Lp),m(3,Al),m(4,X),m(5,Ze)],JGe);var ZGe=class extends k{constructor(e,t){super();this.productService=e;this.environmentService=t;this.registerGlobalActivityActions()}registerGlobalActivityActions(){let e=this.productService.quality,t=this.environmentService.options?.productQualityChangeHandler;if(t&&(e==="stable"||e==="insider")){let o=e==="stable"?"insider":"stable",n=`update.switchQuality.${o}`,r=o==="insider";this._register(W(class extends z{constructor(){super({id:n,title:r?d(17459,null):d(17460,null),precondition:Mu,menu:{id:R.GlobalActivity,when:Mu,group:"7_update"}})}async run(l){let c=l.get(ct),u=l.get(Yl),p=l.get(uP),h=l.get(de),g=l.get(ry),f=l.get(ny),v=l.get(Ne);try{let b="switchQuality.selectSettingsSyncServiceDialogShown",S=p.userDataSyncStore,y;if(S&&r&&u.isEnabled()&&!h.getBoolean(b,-1,!1)){if(y=await this.selectSettingsSyncService(c),!y)return;h.store(b,!0,-1,0),y==="stable"&&await p.switch(y)}if((await c.confirm({type:"info",message:d(17452,null),detail:o==="insider"?d(17450,null):d(17451,null),primaryButton:d(17454,null)})).confirmed){let x=[];f.status==="syncing"&&x.push(U.toPromise(U.filter(f.onDidChangeStatus,E=>E!=="syncing"))),r&&y&&x.push(g.synchroniseUserDataSyncStoreType()),await vn.settled(x),t(o)}else y&&h.remove(b,-1)}catch(b){v.error(b)}}async selectSettingsSyncService(l){let{result:c}=await l.prompt({type:ft.Info,message:d(17457,null),detail:d(17456,null),buttons:[{label:d(17464,null),run:()=>"insiders"},{label:d(17465,null),run:()=>"stable"}],cancelButton:!0});return c}}))}}};ZGe=I([m(0,Ze),m(1,Od)],ZGe);var dj=class extends k{constructor(e,t,o){super();this.updateService=e;this.defaultAccountService=t;this.storageService=o;this.$aH=void 0;this.throttler=this._register(new am);!Ft&&(this.$aH=this.storageService.get(dj.STORAGE_KEY,-1,void 0),this.throttler.queue(()=>this.updateService.setInternalOrg(this.$aH)),this.refresh(),this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>this.refresh())))}static{this.STORAGE_KEY="update/internalOrg"}$aH;refresh(){this.throttler.queue(()=>this.doRefresh())}async doRefresh(){try{let e=await this.defaultAccountService.getDefaultAccount(),t=mOt(e?.entitlementsData?.organization_login_list);if(t===this.$aH)return;this.$aH=t,await this.updateService.setInternalOrg(this.$aH),this.$aH?this.storageService.store(dj.STORAGE_KEY,t,-1,1):this.storageService.remove(dj.STORAGE_KEY,-1)}catch{}}};dj=I([m(0,Lp),m(1,Nd),m(2,de)],dj);var eqe=class extends k{constructor(e,t,o,n,r,s){super();this.clipboardService=e;this.commandService=t;this.configurationService=o;this.hoverService=n;this.meteredConnectionService=r;this.productService=s;this.domNode=_(".update-tooltip");let l=D(this.domNode,_(".header"));this.titleNode=D(l,_(".title")),this.productInfoNode=D(this.domNode,_(".product-info"));let c=D(this.productInfoNode,_(".product-logo"));c.setAttribute("role","img"),c.setAttribute("aria-label",this.productService.nameLong);let u=D(this.productInfoNode,_(".product-details"));this.productNameNode=D(u,_(".product-name")),this.productNameNode.textContent=this.productService.nameLong;let p=this.createVersionRow(u);this.currentVersionNode=p.label,this.currentVersionCopyValue=p.copyValue;let h=this.createVersionRow(u);this.latestVersionNode=h.label,this.latestVersionCopyValue=h.copyValue,this.releaseDateNode=D(u,_(".product-release-date")),this.progressContainer=D(this.domNode,_(".progress-container"));let g=D(this.progressContainer,_(".progress-bar"));this.progressFill=D(g,_(".progress-fill"));let f=D(this.progressContainer,_(".progress-text"));this.progressPercentNode=D(f,_("span")),this.progressSizeNode=D(f,_("span")),this.downloadStatsContainer=D(this.progressContainer,_(".download-stats")),this.timeRemainingNode=D(this.downloadStatsContainer,_(".time-remaining")),this.speedInfoNode=D(this.downloadStatsContainer,_(".speed-info")),this.messageNode=D(this.domNode,_(".state-message")),this.buttonBar=D(this.domNode,_(".button-bar")),this.releaseNotesButton=D(this.buttonBar,_("button.release-notes-button")),this.releaseNotesButton.textContent=d(17534,null),this._register($(this.releaseNotesButton,"click",()=>{this.releaseNotesVersion&&this.runCommandAndClose(B$,this.releaseNotesVersion)})),this.actionButton=D(this.buttonBar,_("button.action-button")),this._register($(this.actionButton,"click",()=>{let v=this.actionButton.dataset.commandId;v&&this.runCommandAndClose(v)})),this.updateCurrentVersion()}updateCurrentVersion(){let e=this.productService.version;if(e){let t=this.productService.commit?.substring(0,7);this.currentVersionNode.textContent=t?d(17497,null,e,t):d(17496,null,e),this.currentVersionCopyValue.value=t?`${e} (${this.productService.commit})`:e,this.currentVersionNode.parentElement.style.display=""}else this.currentVersionNode.parentElement.style.display="none"}hideAll(){this.productInfoNode.style.display="",this.progressContainer.style.display="none",this.speedInfoNode.textContent="",this.timeRemainingNode.textContent="",this.messageNode.style.display="none",this.actionButton.style.display="none",this.actionButton.dataset.commandId="",this.releaseNotesButton.style.marginRight=""}renderState(e){switch(this.hideAll(),e.type){case"uninitialized":this.renderUninitialized();break;case"disabled":this.renderDisabled(e);break;case"idle":this.renderIdle(e);break;case"checking for updates":this.renderCheckingForUpdates();break;case"available for download":this.renderAvailableForDownload(e);break;case"downloading":this.renderDownloading(e);break;case"downloaded":this.renderDownloaded(e);break;case"updating":this.renderUpdating(e);break;case"ready":this.renderReady(e);break;case"overwriting":this.renderOverwriting(e);break;case"restarting":this.renderRestarting(e);break}}renderUninitialized(){this.renderTitleAndInfo(d(17513,null)),this.renderMessage(d(17512,null))}renderDisabled({reason:e}){switch(this.renderTitleAndInfo(d(17532,null)),e){case 0:this.renderMessage(d(17504,null),L.info);break;case 1:this.renderMessage(d(17498,null),L.warning);break;case 2:this.renderMessage(d(17502,null),L.warning);break;case 3:this.renderMessage(d(17499,null),L.info);break;case 4:this.renderMessage(d(17503,null),L.info);break;case 5:this.renderMessage(d(17501,null),L.error);break;case 6:this.renderMessage(d(17505,null,this.productService.nameShort),L.warning);break;default:this.renderMessage(d(17500,null),L.warning);break}}renderIdle({error:e,notAvailable:t}){if(e){this.renderTitleAndInfo(d(17529,null)),this.renderMessage(e,L.error);return}if(t){this.renderTitleAndInfo(d(17521,null)),this.renderMessage(d(17520,null),L.info);return}switch(this.renderTitleAndInfo(d(17533,null)),this.configurationService.getValue("update.mode")){case"none":this.renderMessage(d(17491,null),L.warning);break;case"manual":this.renderMessage(d(17490,null));break;case"start":this.renderMessage(d(17492,null));break;case"default":this.meteredConnectionService.isConnectionMetered?this.renderMessage(d(17519,null),L.radioTower):this.renderMessage(d(17489,null),L.smiley);break}}renderCheckingForUpdates(){this.renderTitleAndInfo(d(17493,null)),this.renderMessage(d(17494,null))}renderAvailableForDownload({update:e}){this.renderTitleAndInfo(d(17528,null),e),this.renderActionButton(d(17506,null),"update.downloadNow")}renderDownloading(e){this.renderTitleAndInfo(d(17510,null),e.update);let{downloadedBytes:t,totalBytes:o}=e;if(t!==void 0&&o!==void 0&&o>0){let n=XGe(t,o)??0;this.progressFill.style.width=`${n}%`,this.progressPercentNode.textContent=`${n}%`,this.progressSizeNode.textContent=`${GYt(t)} / ${GYt(o)}`,this.progressContainer.style.display="";let r=ZWo(e);r!==void 0&&r>0&&(this.speedInfoNode.textContent=d(17511,null,GYt(r)));let s=JWo(e);s!==void 0&&s>0&&(this.timeRemainingNode.textContent=`~${tVo(s)} ${d(17527,null)}`),this.downloadStatsContainer.style.display=""}else this.renderMessage(d(17509,null))}renderDownloaded({update:e}){this.renderTitleAndInfo(d(17531,null),e),this.renderActionButton(d(17514,null),"update.install")}renderUpdating({update:e,currentProgress:t,maxProgress:o}){this.renderTitleAndInfo(d(17516,null),e);let n=XGe(t,o);n!==void 0?(this.progressFill.style.width=`${n}%`,this.progressPercentNode.textContent=`${n}%`,this.progressSizeNode.textContent="",this.progressContainer.style.display=""):this.renderMessage(d(17515,null))}renderReady({update:e}){this.configurationService.getValue("update.mode")==="manual"?(this.renderTitleAndInfo(d(17530,null),e),this.renderActionButton(d(17523,null),"update.restart")):this.renderTitleAndInfo(d(17526,null),e)}renderOverwriting({update:e}){this.renderTitleAndInfo(d(17508,null),e),this.renderMessage(d(17507,null))}renderRestarting({update:e}){this.renderTitleAndInfo(d(17525,null,this.productService.nameShort),e),this.renderMessage(d(17524,null))}renderTitleAndInfo(e,t){this.titleNode.textContent=e;let o=t?.productVersion;if(o){let r=t.version?.substring(0,7);this.latestVersionNode.textContent=r?d(17518,null,o,r):d(17517,null,o),this.latestVersionCopyValue.value=r?`${o} (${t.version})`:o,this.latestVersionNode.parentElement.style.display=""}else this.latestVersionNode.parentElement.style.display="none";let n=t?.timestamp??iVo(this.productService.date);typeof n=="number"&&n>0?(this.releaseDateNode.textContent=d(17522,null,oVo(n)),this.releaseDateNode.style.display=""):this.releaseDateNode.style.display="none",this.releaseNotesVersion=o??this.productService.version,this.releaseNotesButton.style.display=this.releaseNotesVersion?"":"none",this.releaseNotesButton.style.marginRight=this.releaseNotesVersion?"auto":"",this.buttonBar.style.display=this.releaseNotesVersion?"":"none"}renderActionButton(e,t){this.actionButton.textContent=e,this.actionButton.dataset.commandId=t,this.actionButton.style.display=""}renderMessage(e,t){St(this.messageNode),t&&D(this.messageNode,_(".state-message-icon")).classList.add(...q.asClassNameArray(t)),D(this.messageNode,document.createTextNode(e)),this.messageNode.style.display=""}createVersionRow(e){let t=D(e,_(".product-version")),o=D(t,_("span")),n={value:""},r=D(t,_("a.copy-version-button"));r.setAttribute("role","button"),r.setAttribute("tabindex","0");let s=d(17495,null);return r.title=s,r.setAttribute("aria-label",s),D(r,_(".copy-icon")).classList.add(...q.asClassNameArray(L.copy)),this._register($(r,"click",c=>{c.preventDefault(),c.stopPropagation(),n.value&&this.clipboardService.writeText(n.value)})),{label:o,copyValue:n}}runCommandAndClose(e,...t){this.commandService.executeCommand(e,...t),this.hoverService.hideHover(!0)}};eqe=I([m(0,Bi),m(1,fe),m(2,B),m(3,ot),m(4,MG),m(5,Ze)],eqe);var qYt="workbench.actions.updateIndicator",$Yt=new Y("updateTitleBar",!1),aVo="update/disabledReminderLastShown",TRn=720*60*60*1e3,lVo="update.titleBar",bqi=["available for download","downloaded","ready"],_Rn=[...bqi,"checking for updates","downloading","updating","overwriting"],cVo;W(class extends z{constructor(){super({id:qYt,title:d(17488,null),f1:!1,menu:[{id:R.TitleBarAdjacentCenter,order:0,when:C.and($Yt,Yf.negate(),C.not("inDebugMode"))}]})}async run(){}});var tqe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.chatService=t;this.configurationService=o;this.hostService=r;this.storageService=l;this.tooltipVisible=!1;this.pendingShow=this._register(new ue);if(!Ft){if(this.context=$Yt.bindTo(n),this.tooltip=this._register(s.createInstance(eqe)),this.state=c.state,this._register(c.onStateChange(u=>{this.state=u,this.onStateChange()})),this._register(this.configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(lVo)&&this.onStateChange()})),this._register(e.register(R.TitleBarAdjacentCenter,qYt,(u,p)=>this.createEntry(s,u,p))),cVo){let{menuId:u,item:p}=cVo;be.appendMenuItem(u,{...p,command:{id:qYt,title:d(17488,null)},when:p.when?C.and($Yt,p.when):$Yt}),this._register(e.register(u,qYt,(h,g)=>this.createEntry(s,h,g)))}this.onStateChange(!0)}}createEntry(e,t,o){return this.entry=e.createInstance(xmt,t,o,this.tooltip,()=>{this.tooltipVisible=!1,!bqi.includes(this.state.type)&&!_Rn.includes(this.state.type)&&this.context.set(!1)}),this.tooltipVisible&&this.entry.showTooltip(),this.entry}async onStateChange(e=!1){if(this.pendingShow.clear(),this.configurationService.getValue(lVo)===!1){this.context.set(!1);return}if(bqi.includes(this.state.type)?await this.setContextWhenChatIdle(!0):this.context.set(!1),this.tooltipVisible||!await this.hostService.hadLastFocus()){this.tooltip.renderState(this.state);return}this.tooltip.renderState(this.state);let t=!1;switch(this.state.type){case"disabled":if(e){let o=this.state.reason;if(o===5||o===6){let n=this.storageService.getNumber(aVo,-1);t=n===void 0||Date.now()-n>=TRn}}break;case"idle":t=!!this.state.error;break;case"downloading":case"updating":case"overwriting":this.context.set(this.state.explicit);break;case"restarting":this.context.set(!0);break}t&&(this.tooltipVisible=!0,this.context.set(!0),this.entry?.showTooltip(),this.state.type==="disabled"&&this.storageService.store(aVo,Date.now(),-1,1))}async setContextWhenChatIdle(e){if(!this.chatService.requestInProgressObs.get()){this.context.set(e);return}let t=new qe;this.pendingShow.value=ee(()=>t.dispose(!0));try{await yh(this.chatService.requestInProgressObs,o=>!o,void 0,t.token),this.context.set(e)}catch{}}};tqe=I([m(0,sh),m(1,si),m(2,B),m(3,X),m(4,ti),m(5,F),m(6,de),m(7,Lp)],tqe);var xmt=class extends Ja{constructor(e,t,o,n,r,s,l,c){super(void 0,e,t);this.tooltip=o;this.onUserDismissedTooltip=n;this.commandService=r;this.hoverService=s;this.telemetryService=l;this.updateService=c;this.showTooltipOnRender=!1;this.action.run=()=>this.runAction(),this._register(this.updateService.onStateChange(u=>this.onStateChange(u)))}render(e){super.render(e),this.content=D(e,_(".update-indicator")),this.updateTooltip(),this.onStateChange(this.updateService.state),this.showTooltipOnRender&&(this.showTooltipOnRender=!1,kr(Me(e),()=>this.showTooltip()))}showTooltip(e=!1){if(!this.element?.isConnected){this.showTooltipOnRender=!0;return}this.hoverService.showInstantHover({content:this.tooltip.domNode,target:{targetElements:[this.element],dispose:()=>{this.element?.isConnected&&this.onUserDismissedTooltip()}},persistence:{sticky:!0},appearance:{showPointer:!0,compact:!0}},e)}getHoverContents(){return this.tooltip.domNode}async runAction(){let e;switch(this.updateService.state.type){case"available for download":e="update.downloadNow";break;case"downloaded":e="update.install";break;case"ready":e="update.restart";break;default:this.showTooltip(!0);return}this.telemetryService.publicLog2("workbenchActionExecuted",{id:e,from:"titlebar"}),await this.commandService.executeCommand(e)}onStateChange(e){if(!this.content)return;St(this.content),this.content.classList.remove("prominent","progress-indefinite","progress-percent","update-disabled"),this.content.style.removeProperty("--update-progress");let t=D(this.content,_(".indicator-label"));switch(e.type){case"disabled":t.textContent=d(17487,null),this.content.classList.add("update-disabled");break;case"checking for updates":t.textContent=d(17482,null),this.renderProgressState(this.content);break;case"overwriting":t.textContent=d(17485,null),this.renderProgressState(this.content);break;case"available for download":case"downloaded":case"ready":t.textContent=d(17487,null),this.content.classList.add("prominent");break;case"downloading":t.textContent=d(17483,null),this.renderProgressState(this.content,XGe(e.downloadedBytes,e.totalBytes));break;case"updating":t.textContent=d(17484,null),this.renderProgressState(this.content,XGe(e.currentProgress,e.maxProgress));break;case"restarting":t.textContent=d(17486,null),this.renderProgressState(this.content);break;default:t.textContent=d(17487,null);break}}renderProgressState(e,t){t!==void 0?(e.classList.add("progress-percent"),e.style.setProperty("--update-progress",`${t}%`)):e.classList.add("progress-indefinite")}};xmt=I([m(4,fe),m(5,ot),m(6,_e),m(7,Lp)],xmt);var DRn=5;function uVo(a){let i=a.replace(/^\uFEFF/,"");return RRn(i)??LRn(i)}function RRn(a){let i=a.trim();if(!(!i.startsWith("{")||!i.endsWith("}")))try{let e=JSON.parse(i);return typeof e.markdown!="string"?void 0:pVo(e.markdown,e)}catch{return}}function pVo(a,i){let e={markdown:a,buttons:MRn(i.buttons)};typeof i.bannerImageUrl=="string"&&(e.bannerImageUrl=i.bannerImageUrl),typeof i.badge=="string"&&(e.badge=i.badge),typeof i.title=="string"&&(e.title=i.title);let t=PRn(i.features);return t&&(e.features=t),e}function LRn(a){let i=a.match(/^---[ \t]*\r?\n(?<json>[\s\S]*?)\r?\n---[ \t]*(?:\r?\n(?<body>[\s\S]*))?$/);if(i?.groups)return dVo(a,i.groups.json,i.groups.body??"");let e=a.match(/^---[ \t]*(?<json>\{.*\})[ \t]*---[ \t]*(?<body>[\s\S]*)$/);return e?.groups?dVo(a,e.groups.json,e.groups.body):{markdown:a}}function dVo(a,i,e){try{let t=JSON.parse(i);return pVo(e,t)}catch{return{markdown:a}}}function MRn(a){if(!Array.isArray(a))return;let i=[];for(let e of a){if(typeof e!="object"||e===null||!yo(e,{label:!0,commandId:!0})||typeof e.label!="string"||typeof e.commandId!="string")continue;let t=yo(e,{style:!0})&&(e.style==="primary"||e.style==="secondary")?e.style:void 0,o=yo(e,{args:!0})&&Array.isArray(e.args)?e.args:void 0;i.push({label:e.label,commandId:e.commandId,args:o,style:t})}return i.length?i:void 0}function PRn(a){if(!Array.isArray(a))return;let i=[];for(let e of a){if(typeof e!="object"||e===null)continue;let t=e;if(typeof t.title!="string"||typeof t.description!="string")continue;let o=typeof t.icon=="string"?t.icon:void 0;if(i.push({icon:o,title:t.title,description:t.description}),i.length>=DRn)break}return i.length?i:void 0}var mVo="postUpdateWidget/lastKnownVersion",gae=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.commandService=e;this.configurationService=t;this.hostService=o;this.hoverService=n;this.layoutService=r;this.markdownRendererService=s;this.openerService=l;this.productService=c;this.requestService=u;this.storageService=p;this.telemetryService=h;!Ft&&(this._register(Ge.registerCommand("_update.showUpdateInfo",(g,f)=>this.showUpdateInfo(f))),this.tryShowOnStartup())}static{this.idCounter=0}async tryShowOnStartup(){await this.hostService.hadLastFocus()&&this.detectVersionChange()&&this.configurationService.getValue("update.showPostInstallInfo")!==!1&&await this.showUpdateInfo()}async showUpdateInfo(e){let t=await this.getUpdateInfo(e);if(!t)return;let o=new O,n=this.layoutService.mainContainer,{clientWidth:r}=n,l=Math.max(r-420-80,16);this.hoverService.showInstantHover({content:this.buildContent(t,o),target:{targetElements:[n],x:l,y:40,dispose:()=>o.dispose()},additionalClasses:["post-update-widget-hover"],persistence:{sticky:!0},appearance:{showPointer:!1,compact:!0,maxHeightRatio:1},trapFocus:!0},!0)}async getUpdateInfo(e){if(!e)try{let o=eVo(this.productService.version),n=await this.requestService.request({url:o,callSite:"postUpdateWidget"},Ie.None);e=await gC(n)}catch{}if(!e)return;let t=uVo(e);return t?.buttons?.length||(t={...t,buttons:[{label:d(17436,null),commandId:B$,args:[this.productService.version],style:"secondary"}]}),t}buildContent(e,t){let{markdown:o,buttons:n,bannerImageUrl:r,badge:s,title:l,features:c}=e,u=_(".post-update-widget"),p=`post-update-widget-title-${gae.idCounter++}`;u.setAttribute("role","dialog"),u.setAttribute("aria-labelledby",p);let h=D(u,_(".banner"));h.setAttribute("aria-hidden","true");let g=ARn(r);g&&h.style.setProperty("background-image",`url(${JSON.stringify(g)})`);let f=D(u,_("button.banner-close"));f.setAttribute("aria-label",d(17435,null)),D(f,_(q.asCSSSelector(L.close))).setAttribute("aria-hidden","true"),t.add($(f,"click",()=>{this.hoverService.hideHover(!0)}));let b=D(u,_(".body"));if(s){let y=D(b,_(".badge"));y.textContent=s}let S=D(b,_(".title"));if(S.id=p,S.textContent=l??d(17437,null,this.productService.version),c?.length){let y=D(b,_(".features"));y.setAttribute("role","list");for(let w of c){let x=D(y,_(".feature"));x.setAttribute("role","listitem");let E=D(x,_(".feature-icon")),M=w.icon??L.sparkle.id,N=q.fromId(M);E.classList.add(...q.asClassNameArray(N)),E.setAttribute("aria-hidden","true");let V=D(x,_(".feature-text")),H=D(V,_(".feature-title"));H.textContent=w.title;let K=D(V,_(".feature-description")),j=t.add(this.markdownRendererService.render(new he(w.description,{isTrusted:!0,supportThemeIcons:!0}),{actionHandler:(J,se)=>{WT(this.openerService,J,se.isTrusted),this.hoverService.hideHover(!0)}}));K.appendChild(j.element)}}else if(o){let y=D(b,_(".update-markdown")),w=t.add(this.markdownRendererService.render(new he(o,{isTrusted:!0,supportHtml:!0,supportThemeIcons:!0}),{actionHandler:(x,E)=>{WT(this.openerService,x,E.isTrusted),this.hoverService.hideHover(!0)}}));y.appendChild(w.element)}if(n?.length){let y=D(b,_(".button-bar")),w=n.length===1,x=!1;for(let{label:E,style:M,commandId:N,args:V}of n){let H=D(y,_("button"));H.textContent=E,M==="secondary"?(H.classList.add("update-button-secondary"),!x&&n.length>1&&(H.classList.add("update-button-leading-secondary"),x=!0)):H.classList.add("update-button-primary"),w&&H.classList.add("update-button-full-width"),t.add($(H,"click",()=>{this.telemetryService.publicLog2("workbenchActionExecuted",{id:N,from:"postUpdateWidget"}),this.commandService.executeCommand(N,...V??[]),this.hoverService.hideHover(!0)}))}}return u}detectVersionChange(){let e;try{e=this.storageService.getObject(mVo,-1)}catch{}let t={version:this.productService.version,commit:this.productService.commit,timestamp:Date.now()};return e?.commit===t.commit?!1:(this.storageService.store(mVo,JSON.stringify(t),-1,1),e?nVo(e.version,t.version):!1)}};gae=I([m(0,fe),m(1,B),m(2,ti),m(3,ot),m(4,Kl),m(5,_n),m(6,Je),m(7,Ze),m(8,Ra),m(9,de),m(10,_e)],gae);function ARn(a){if(a)try{let i=A.parse(a,!0);if(i.scheme==="https"||i.scheme==="data"&&/^image\//i.test(i.path))return i.toString(!0)}catch{}}var iqe=oe.as(Zi.Workbench);iqe.registerWorkbenchContribution(w7,3);iqe.registerWorkbenchContribution(JGe,3);iqe.registerWorkbenchContribution(ZGe,3);iqe.registerWorkbenchContribution(dj,4);iqe.registerWorkbenchContribution(tqe,3);iqe.registerWorkbenchContribution(gae,3);var jYt=class extends z{static{this.AVAILABLE=!!$i.releaseNotesUrl}constructor(){super({id:B$,title:{...P(17476,"Show Release Notes"),mnemonicTitle:d(17471,null)},category:{value:$i.nameShort,original:$i.nameShort},f1:!0,menu:[{id:R.MenubarHelpMenu,group:"1_welcome",order:5}]})}async run(i,e){let t=i.get(F),o=i.get(Ze),n=i.get(Je),r=e??o.version;try{await Cmt(t,r,!1)}catch{if(o.releaseNotesUrl)await n.open(A.parse(o.releaseNotesUrl));else throw new Error(d(17480,null,o.nameLong))}}},Sqi=class extends z{constructor(){super({id:aPo,title:{...P(17477,"Open Current File as Release Notes"),mnemonicTitle:d(17471,null)},category:P(17468,"Developer"),f1:!0})}async run(i){let e=i.get(F),t=i.get(Ze);try{await Cmt(e,t.version,!0)}catch{throw new Error(d(17474,null))}}};jYt.AVAILABLE&&W(jYt);W(Sqi);var Iqi=class extends z{constructor(){super({id:"update.checkForUpdate",title:P(17467,"Check for Updates..."),category:{value:$i.nameShort,original:$i.nameShort},f1:!0,precondition:hL.isEqualTo("idle")})}async run(i){return i.get(Lp).checkForUpdates(!0)}},yqi=class extends z{constructor(){super({id:"update.downloadUpdate",title:P(17469,"Download Update"),category:{value:$i.nameShort,original:$i.nameShort},f1:!0,precondition:hL.isEqualTo("available for download")})}async run(i){await i.get(Lp).downloadUpdate(!0)}},wqi=class extends z{constructor(){super({id:"update.installUpdate",title:P(17470,"Install Update"),category:{value:$i.nameShort,original:$i.nameShort},f1:!0,precondition:hL.isEqualTo("downloaded")})}async run(i){await i.get(Lp).applyUpdate()}},Cqi=class extends z{constructor(){super({id:"update.restartToUpdate",title:P(17475,"Restart to Update"),category:{value:$i.nameShort,original:$i.nameShort},f1:!0,precondition:hL.isEqualTo("ready")})}async run(i){await i.get(Lp).quitAndInstall()}},QYt=class a extends z{static{this.ID="workbench.action.download"}static{this.AVAILABLE=!!$i.downloadUrl}constructor(){super({id:a.ID,title:P(17472,"Download {0}",$i.nameLong),precondition:Mu,f1:!0,menu:[{id:R.StatusBarWindowIndicatorMenu,when:Mu}]})}run(i){let e=i.get(Ze),t=i.get(Je);e.downloadUrl&&t.open(A.parse(e.downloadUrl))}};QYt.AVAILABLE&&W(QYt);W(Iqi);W(yqi);W(wqi);W(Cqi);if(ii){class a extends z{constructor(){super({id:"_update.applyupdate",title:P(17466,"Apply Update..."),category:Fe.Developer,f1:!0,precondition:hL.isEqualTo("idle")})}async run(e){let t=e.get(Lp),n=await e.get(nn).showOpenDialog({title:d(17473,null),filters:[{name:"Setup",extensions:["exe"]}],canSelectFiles:!0,openLabel:FB(d(17481,null))});!n||!n[0]||await t._applySpecificUpdate(n[0].fsPath)}}W(a)}W(class extends z{constructor(){super({id:"update.showUpdateInfo",title:P(17478,"Show Update Info"),category:Fe.Developer,f1:!0,precondition:Mu.negate()})}async run(i){let e=i.get(fe),o=await i.get($e).input({prompt:d(17479,null)});o!==void 0&&await e.executeCommand("_update.showUpdateInfo",o||void 0)}});var NRn=.15,xqi="nps/sessionCount",hVo="nps/lastSessionDate",YYt="nps/skipVersion",XYt="nps/isCandidate",kmt=class{constructor(i,e,t,o,n,r,s){if(!n.npsSurveyUrl||!r.getValue("telemetry.feedback.enabled")||s.isSessionsWindow||i.get(YYt,-1,""))return;let c=new Date().toDateString(),u=i.get(hVo,-1,new Date(0).toDateString());if(c===u)return;let p=(i.getNumber(xqi,-1,0)||0)+1;if(i.store(hVo,c,-1,0),i.store(xqi,p,-1,0),p<9)return;let h=i.getBoolean(XYt,-1,!1)||Math.random()<NRn;if(i.store(XYt,h,-1,0),!h){i.store(YYt,n.version,-1,0);return}e.prompt(ft.Info,d(15469,null),[{label:d(15470,null),run:()=>{o.open(A.parse(`${n.npsSurveyUrl}?o=${encodeURIComponent(XO)}&v=${encodeURIComponent(n.version)}&m=${encodeURIComponent(t.machineId)}`)),i.store(XYt,!1,-1,0),i.store(YYt,n.version,-1,0)}},{label:d(15468,null),run:()=>i.store(xqi,p-3,-1,0)},{label:d(15467,null),run:()=>{i.store(XYt,!1,-1,0),i.store(YYt,n.version,-1,0)}}],{priority:3})}};kmt=I([m(0,de),m(1,Ne),m(2,_e),m(3,Je),m(4,Ze),m(5,B),m(6,Mt)],kmt);Kr==="en"&&oe.as(Zi.Workbench).registerWorkbenchContribution(kmt,3);var kqi=class extends k{constructor(i,e,t,o,n,r,s,l){super();let c=`${i.surveyId}.sessionCount`,u=`${i.surveyId}.lastSessionDate`,p=`${i.surveyId}.skipVersion`,h=`${i.surveyId}.isCandidate`,g=`${i.surveyId}.editedCount`,f=`${i.surveyId}.editedDate`;if(e.get(p,-1,""))return;let b=new Date().toDateString();if(e.getNumber(g,-1,0)<i.editCount){let x=this._register(new hA(E=>{E.forEach(M=>{if(M.getLanguageId()===i.languageId&&b!==e.get(f,-1)){let N=e.getNumber(g,-1,0)+1;e.store(g,N,-1,0),e.store(f,b,-1,0)}})},250));this._register(r.files.onDidSave(E=>x.work(E.model)))}let S=e.get(u,-1,new Date(0).toDateString());if(b===S)return;let y=e.getNumber(c,-1,0)+1;if(e.store(u,b,-1,0),e.store(c,y,-1,0),y<9||e.getNumber(g,-1,0)<i.editCount)return;let w=e.getBoolean(h,-1,!1)||Math.random()<i.userProbability;if(e.store(h,w,-1,0),!w){e.store(p,l.version,-1,0);return}t.prompt(ft.Info,d(15463,null,n.getLanguageName(i.languageId)??i.languageId),[{label:d(15466,null),run:()=>{o.publicLog(`${i.surveyId}.survey/takeShortSurvey`),s.open(A.parse(`${i.surveyUrl}?o=${encodeURIComponent(XO)}&v=${encodeURIComponent(l.version)}&m=${encodeURIComponent(o.machineId)}`)),e.store(h,!1,-1,0),e.store(p,l.version,-1,0)}},{label:d(15465,null),run:()=>{o.publicLog(`${i.surveyId}.survey/remindMeLater`),e.store(c,y-3,-1,0)}},{label:d(15464,null),isSecondary:!0,run:()=>{o.publicLog(`${i.surveyId}.survey/dontShowAgain`),e.store(h,!1,-1,0),e.store(p,l.version,-1,0)}}],{priority:1})}},Emt=class{constructor(i,e,t,o,n,r,s,l){this.storageService=i;this.notificationService=e;this.telemetryService=t;this.textFileService=o;this.openerService=n;this.productService=r;this.languageService=s;this.extensionService=l;this.handleSurveys()}async handleSurveys(){this.productService.surveys&&(await this.extensionService.whenInstalledExtensionsRegistered(),this.productService.surveys.filter(i=>i.surveyId&&i.editCount&&i.languageId&&i.surveyUrl&&i.userProbability).map(i=>new kqi(i,this.storageService,this.notificationService,this.telemetryService,this.languageService,this.textFileService,this.openerService,this.productService)))}};Emt=I([m(0,de),m(1,Ne),m(2,_e),m(3,Uo),m(4,Je),m(5,Ze),m(6,Rt),m(7,lt)],Emt);Kr==="en"&&oe.as(Zi.Workbench).registerWorkbenchContribution(Emt,3);var WhS=te("welcomePage.background",null,d(17917,null)),VhS=te("welcomePage.tileBackground",{dark:qu,light:qu,hcDark:"#000",hcLight:qu},d(17920,null)),BhS=te("welcomePage.tileHoverBackground",{dark:Bf(qu,.2),light:Eu(qu,.1),hcDark:null,hcLight:null},d(17922,null)),HhS=te("welcomePage.tileBorder",{dark:"#ffffff1a",light:"#0000001a",hcDark:Ei,hcLight:Ei},d(17921,null)),UhS=te("welcomePage.progress.background",Hf,d(17918,null)),zhS=te("welcomePage.progress.foreground",AS,d(17919,null)),KhS=te("walkthrough.stepTitle.foreground",{light:"#000000",dark:"#ffffff",hcDark:null,hcLight:null},d(17916,null));var oqe=class{constructor(i,e,t,o){this.fileService=i;this.notificationService=e;this.extensionService=t;this.languageService=o;this.mdCache=new dt;this.svgCache=new dt}async renderMarkdown(i,e){let t=await this.readAndCacheStepMarkdown(i,e),o=ht(),n=vc.getColorMap(),r=n?ED(n):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; ${document.location.protocol==="http:"?"img-src https: data: http:":"img-src https: data:"}; media-src https:; script-src 'nonce-${o}'; style-src 'nonce-${o}';">
				<style nonce="${o}">
					${D1}
					${r}
					body > img {
						align-self: flex-start;
					}
					body > img[centered] {
						align-self: center;
					}
					body {
						display: flex;
						flex-direction: column;
						padding: 0;
						height: inherit;
					}
					.theme-picker-row {
						display: flex;
						justify-content: center;
						gap: 32px;
					}
					checklist {
						display: flex;
						gap: 32px;
						flex-direction: column;
					}
					checkbox {
						display: flex;
						flex-direction: column;
						align-items: center;
						margin: 5px;
						cursor: pointer;
					}
					checkbox > img {
						margin-bottom: 8px !important;
					}
					checkbox.checked > img {
						box-sizing: border-box;
					}
					checkbox.checked > img {
						outline: 2px solid var(--vscode-focusBorder);
						outline-offset: 4px;
						border-radius: 4px;
					}
					.theme-picker-link {
						margin-top: 16px;
						color: var(--vscode-textLink-foreground);
					}
					blockquote > p:first-child {
						margin-top: 0;
					}
					body > * {
						margin-block-end: 0.25em;
						margin-block-start: 0.25em;
					}
					vertically-centered {
						padding-top: 5px;
						padding-bottom: 5px;
						display: flex;
						justify-content: center;
						flex-direction: column;
					}
					html {
						height: 100%;
						padding-right: 32px;
					}
					h1 {
						font-size: 19.5px;
					}
					h2 {
						font-size: 18.5px;
					}
				</style>
			</head>
			<body>
				<vertically-centered>
					${t}
				</vertically-centered>
			</body>
			<script nonce="${o}">
				const vscode = acquireVsCodeApi();

				document.querySelectorAll('[when-checked]').forEach(el => {
					el.addEventListener('click', () => {
						vscode.postMessage(el.getAttribute('when-checked'));
					});
				});

				let ongoingLayout = undefined;
				const doLayout = () => {
					document.querySelectorAll('vertically-centered').forEach(element => {
						element.style.marginTop = Math.max((document.body.clientHeight - element.scrollHeight) * 3/10, 0) + 'px';
					});
					ongoingLayout = undefined;
				};

				const layout = () => {
					if (ongoingLayout) {
						clearTimeout(ongoingLayout);
					}
					ongoingLayout = setTimeout(doLayout, 0);
				};

				layout();

				document.querySelectorAll('img').forEach(element => {
					element.onload = layout;
				})

				window.addEventListener('message', event => {
					if (event.data.layoutMeNow) {
						layout();
					}
					if (event.data.enabledContextKeys) {
						document.querySelectorAll('.checked').forEach(element => element.classList.remove('checked'))
						for (const key of event.data.enabledContextKeys) {
							document.querySelectorAll('[checked-on="' + key + '"]').forEach(element => element.classList.add('checked'))
						}
					}
				});
		</script>
		</html>`}async renderSVG(i){let e=await this.readAndCacheSVGFile(i),t=ht(),o=vc.getColorMap(),n=o?ED(o):"";return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'nonce-${t}';">
				<style nonce="${t}">
					${D1}
					${n}
					svg {
						position: fixed;
						height: 100%;
						width: 80%;
						left: 50%;
						top: 50%;
						max-width: 530px;
						min-width: 350px;
						transform: translate(-50%,-50%);
					}
				</style>
			</head>
			<body>
				${e}
			</body>
		</html>`}async renderVideo(i,e,t){let o=ht();return`<!DOCTYPE html>
		<html>
			<head>
				<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
				<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src https:; media-src https:; script-src 'nonce-${o}'; style-src 'nonce-${o}';">
				<style nonce="${o}">
					video {
						max-width: 100%;
						max-height: 100%;
						object-fit: cover;
					}
				</style>
			</head>
			<body>
				<video controls autoplay ${e?`poster="${e.toString(!0)}"`:""} muted ${t?`aria-label="${t}"`:""}>
					<source src="${i.toString(!0)}" type="video/mp4">
				</video>
			</body>
		</html>`}async readAndCacheSVGFile(i){if(!this.svgCache.has(i)){let e=await this.readContentsOfPath(i,!1);this.svgCache.set(i,e)}return Ti(this.svgCache.get(i))}async readAndCacheStepMarkdown(i,e){if(!this.mdCache.has(i)){let t=await this.readContentsOfPath(i),o=await P$(ORn(t,e),this.extensionService,this.languageService,{sanitizerConfig:{allowedLinkProtocols:{override:"*"},allowedTags:{augment:["select","checkbox","checklist"]},allowedAttributes:{augment:["x-dispatch","data-command","when-checked","checked-on","checked"]}}});this.mdCache.set(i,o)}return Ti(this.mdCache.get(i))}async readContentsOfPath(i,e=!0){try{let t=JSON.parse(i.query).moduleId;if(e&&t)return await new Promise((n,r)=>{let s=NGe.getProvider(t);s?n(s()):r(`Getting started: no provider registered for ${t}`)})}catch{}try{let t=i.with({path:i.path.replace(/\.md$/,`.nls.${Kr}.md`)}),o=Kr?.replace(/-.*$/,""),n=i.with({path:i.path.replace(/\.md$/,`.nls.${o}.md`)}),r=u=>this.fileService.stat(u).then(p=>!!p.size).catch(()=>!1),[s,l]=await Promise.all([r(t),r(n)]);return(await this.fileService.readFile(s?t:l?n:i)).value.toString()}catch(t){return this.notificationService.error("Error reading markdown document at `"+i+"`: "+t),""}}};oqe=I([m(0,ge),m(1,Ne),m(2,lt),m(3,Rt)],oqe);var gVo=(a,i)=>{let e=Ve(i,a);return ioe(e).toString(!0)},ORn=(a,i)=>a.replace(/src="([^"]*)"/g,(e,t)=>t.startsWith("https://")?`src="${t}"`:`src="${gVo(t,i)}"`).replace(/!\[([^\]]*)\]\(([^)]*)\)/g,(e,t,o)=>o.startsWith("https://")?`![${t}](${o})`:`![${t}](${gVo(o,i)})`);var JYt=Oe("getting-started-step-unchecked",L.circleLargeOutline,d(17959,null)),ZYt=Oe("getting-started-step-checked",L.passFilled,d(17958,null));var Tmt=le("onboardingService");function Eqi(a){switch(a){case"onboarding.signIn":return d(18195,null);case"onboarding.personalize":return d(18193,null);case"onboarding.aiPreference":return d(18191,null);case"onboarding.agentSessions":return d(18189,null)}}function fVo(a){switch(a){case"onboarding.signIn":return d(18196,null);case"onboarding.personalize":return d(18194,null);case"onboarding.aiPreference":return d(18192,null);case"onboarding.agentSessions":return d(18190,null,et?"\u2318\u2303I":"Ctrl+Alt+I")}}var vVo=["onboarding.signIn","onboarding.personalize","onboarding.agentSessions"];var Tqi=[{id:"code-first",label:d(18187,null),description:d(18188,null),icon:"edit"},{id:"balanced",label:d(18185,null),description:d(18186,null),icon:"layoutSidebarRight"},{id:"agent-forward",label:d(18183,null),description:d(18184,null),icon:"copilot"}],_qi="welcomeOnboarding.state";var nqe="workbench.welcomePage.restorableWalkthroughs",SVo="workbench.startupEditor",WRn="workbench.welcome.enabled",bVo="workbench.telemetryOptOutShown",RIe=class extends k{constructor(e,t){super();this.instantiationService=e;this._register(t.registerEditor(`${av.RESOURCE.scheme}:/**`,{id:av.ID,label:d(17967,null),priority:"builtin"},{singlePerResource:!0,canSupportResource:o=>o.scheme===av.RESOURCE.scheme},{createEditorInput:({options:o})=>({editor:this.instantiationService.createInstance(av,o),options:{...o,pinned:!1}})}))}static{this.ID="workbench.contrib.startupPageEditorResolver"}};RIe=I([m(0,F),m(1,il)],RIe);var LIe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.configurationService=e;this.editorService=t;this.fileService=o;this.contextService=n;this.lifecycleService=r;this.layoutService=s;this.productService=l;this.commandService=c;this.environmentService=u;this.storageService=p;this.notificationService=h;this.contextKeyService=g;this.onboardingService=f;this.tryShowOnboarding(),this.run().then(void 0,mt),this._register(this.editorService.onDidCloseEditor(v=>{v.editor instanceof av&&(v.editor.selectedCategory=void 0,v.editor.selectedStep=void 0)}))}static{this.ID="workbench.contrib.startupPageRunner"}async run(){if(await this.lifecycleService.when(3),M2.getValue(this.contextKeyService)||(this.productService.enableTelemetry&&this.productService.showTelemetryOptOut&&Yy(this.configurationService)!==0&&!this.environmentService.skipWelcome&&!this.storageService.get(bVo,0)&&this.storageService.store(bVo,!0,0,0),this.tryOpenWalkthroughForFolder()))return;if(VRn(this.configurationService,this.contextService,this.environmentService)&&this.lifecycleService.startupKind!==3&&(!this.editorService.activeEditor||this.layoutService.openedDefaultEditors)){let t=this.configurationService.inspect(SVo);t.value==="readme"?await this.openReadme():t.value==="welcomePage"||t.value==="welcomePageInEmptyWorkbench"?await this.openGettingStarted(!0):t.value==="terminal"&&this.commandService.executeCommand("workbench.action.createTerminalEditor")}}tryOpenWalkthroughForFolder(){let e=this.storageService.get(nqe,0);if(e){let t=JSON.parse(e),o=this.contextService.getWorkspace();if(t.folder===Kke.id||t.folder===o.folders[0].uri.toString()){let n={selectedCategory:t.category,selectedStep:t.step,pinned:!1,preserveFocus:this.shouldPreserveFocus()};return this.editorService.openEditor({resource:av.RESOURCE,options:n}),this.storageService.remove(nqe,0),!0}}else return!1;return!1}async openReadme(){let e=ui(await Promise.all(this.contextService.getWorkspace().folders.map(async t=>{let o=t.uri,n=await this.fileService.resolve(o).catch(mt),r=n?.children?n.children.map(l=>l.name).sort():[],s=r.find(l=>l.toLowerCase()==="readme.md")||r.find(l=>l.toLowerCase().startsWith("readme"));if(s)return Ve(o,s)})));if(!this.editorService.activeEditor)if(e.length){let t=o=>o.path.toLowerCase().endsWith(".md");await Promise.all([this.commandService.executeCommand("markdown.showPreview",null,e.filter(t),{locked:!0}).catch(o=>{this.notificationService.error(d(17966,null,o.message))}),this.editorService.openEditors(e.filter(o=>!t(o)).map(o=>({resource:o,options:{preserveFocus:this.shouldPreserveFocus()}})))])}else await this.openGettingStarted()}async openGettingStarted(e){let t=DYt,o=this.editorService.activeEditor;o?.typeId===t||this.editorService.editors.some(n=>n.typeId===t)||t===DYt&&this.editorService.openEditor({resource:av.RESOURCE,options:{index:o?0:void 0,pinned:!1,preserveFocus:this.shouldPreserveFocus(),showTelemetryNotice:e}})}shouldPreserveFocus(){let e=Un();return!(!e||e===ut.document.body||this.layoutService.hasFocus("workbench.parts.editor"))}tryShowOnboarding(){this.environmentService.skipWelcome||Ft||this.configurationService.getValue("workbench.welcomePage.experimentalOnboarding")&&this.storageService.isNew(-1)&&(this.storageService.getBoolean(_qi,-1)||(this.onboardingService.show(),this._register(this.onboardingService.onDidDismiss(()=>{this.storageService.store(_qi,!0,-1,0)}))))}};LIe=I([m(0,B),m(1,ie),m(2,ge),m(3,Ae),m(4,to),m(5,wi),m(6,Ze),m(7,fe),m(8,Mt),m(9,de),m(10,Ne),m(11,X),m(12,Tmt)],LIe);function VRn(a,i,e){if(e.skipWelcome)return!1;let t=a.inspect(SVo);if(!t.userValue&&!t.workspaceValue){let o=a.inspect(WRn);if(o.value!==void 0&&o.value!==null)return o.value}return t.value==="welcomePage"||t.value==="readme"||i.getWorkbenchState()===1&&t.value==="welcomePageInEmptyWorkbench"||t.value==="terminal"}var rqe=class extends k{constructor(e){super();this.options=e;this._onDidChangeEntries=this._register(new T);this.onDidChangeEntries=this._onDidChangeEntries.event;this.isDisposed=!1;this.contextKeysToWatch=new Set;this.contextService=e.contextService,this.entries=void 0,this.itemCount=0,this.list=_("ul"),this.scrollbar=this._register(new Ar(this.list,{})),this._register(this.onDidChangeEntries(()=>this.scrollbar.scanDomNode())),this.domElement=_(".index-list."+e.klass,{},_("h2",{},e.title),this.scrollbar.getDomNode()),this._register(this.contextService.onDidChangeContext(t=>{t.affectsSome(this.contextKeysToWatch)&&this.rerender()}))}getDomElement(){return this.domElement}layout(e){this.scrollbar.scanDomNode()}onDidChange(e){this._register(this.onDidChangeEntries(e))}register(e){this.isDisposed?e.dispose():this._register(e)}dispose(){this.isDisposed=!0,super.dispose()}setLimit(e){this.options.limit=e,this.setEntries(this.entries)}rerender(){this.setEntries(this.entries)}setEntries(e){let t=e??[];this.itemCount=0;let o=this.options.rankElement;o&&(t=t.filter(l=>o(l)!==null),t.sort((l,c)=>o(c)-o(l)));let n=t.filter(l=>!l.when||this.contextService.contextMatchesRules(l.when)),r=n.slice(0,this.options.limit),s=r.map(l=>l.id);if(!(this.entries===e&&eo(s,this.lastRendered))){for(this.entries=e,this.contextKeysToWatch.clear(),t.forEach(l=>{l.when?.keys()?.forEach(u=>this.contextKeysToWatch.add(u))}),this.lastRendered=s,this.itemCount=r.length;this.list.firstChild;)this.list.firstChild.remove();this.itemCount=r.length;for(let l of r){let c=this.options.renderElement(l);this.list.appendChild(c)}n.length>r.length&&this.options.more?this.list.appendChild(this.options.more):e!==void 0&&this.itemCount===0&&this.options.empty?this.list.appendChild(this.options.empty):this.options.footer&&this.list.appendChild(this.options.footer),this._onDidChangeEntries.fire()}}};function eXt(a){let i=a.sentiment;return i.hidden||i.disabled?!1:!!Ge.getCommand(Y_e)}function tXt(a,i,e){let t=new O,o=a.label??d(6818,null),n=_("button.agents-banner-button",{title:o},_(".codicon.codicon-agent.icon-widget"),_("span.category-title",{},o));return t.add($(n,"click",()=>{a.onButtonClick?.(),e.publicLog2("agentsBanner.clicked",{source:a.source,action:"openAgentsWindow"}),i.executeCommand(Y_e,{forceNewWindow:!0})})),{element:_(`.${a.cssClass}`,{},n),disposables:t}}var BRn=250,Dqi="workbench.startupEditor",IVo=new Y("allWalkthroughsHidden",!1),_mt=new Y("inWelcome",!1),HRn=RGi.map((a,i)=>({command:a.content.command,description:a.description,icon:{type:"icon",icon:a.icon},id:a.id,order:i,title:a.title,when:C.deserialize(a.when)??C.true()})),yVo="workbench.welcomePage.preferReducedMotion",iA=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j){super(iA.ID,e,l,h,g);this.commandService=t;this.productService=o;this.keybindingService=n;this.gettingStartedService=r;this.configurationService=s;this.languageService=c;this.fileService=u;this.openerService=p;this.themeService=h;this.storageService=g;this.extensionService=f;this.instantiationService=v;this.notificationService=b;this.groupsService=S;this.quickInputService=w;this.workspacesService=x;this.labelService=E;this.hostService=M;this.webviewService=N;this.workspaceContextService=V;this.accessibilityService=H;this.markdownRendererService=K;this.chatEntitlementService=j;this.inProgressScroll=Promise.resolve();this.dispatchListeners=new O;this.stepDisposables=new O;this.detailsPageDisposables=new O;this.mediaDisposables=new O;this.buildSlideThrottle=this._register(new am);this.showFeaturedWalkthrough=!0;this.currentMediaComponent=void 0;this.currentMediaType=void 0;this.container=_(".gettingStartedContainer",{role:"document",tabindex:0,"aria-label":d(17886,null)}),this.stepMediaComponent=_(".getting-started-media"),this.stepMediaComponent.id=ht(),this.categoriesSlideDisposables=this._register(new O),this.detailsRenderer=new oqe(this.fileService,this.notificationService,this.extensionService,this.languageService),this.contextService=this._register(y.createScoped(this.container)),_mt.bindTo(this.contextService).set(!0),this.gettingStartedCategories=this.gettingStartedService.getWalkthroughs(),this._register(this.dispatchListeners);let J=()=>{if(this.gettingStartedCategories=this.gettingStartedService.getWalkthroughs(),this.currentWalkthrough){let se=this.currentWalkthrough.steps.map(ce=>ce.id),ae=this.gettingStartedCategories.find(ce=>this.currentWalkthrough?.id===ce.id);if(ae){let ce=ae.steps.map(Se=>Se.id);eo(ce,se)||this.buildSlideThrottle.queue(()=>this.buildCategoriesSlide())}}else this.buildSlideThrottle.queue(()=>this.buildCategoriesSlide())};this._register(this.gettingStartedService.onDidAddWalkthrough(J)),this._register(this.gettingStartedService.onDidRemoveWalkthrough(J)),this.recentlyOpened=this.workspacesService.getRecentlyOpened(),this._register(x.onDidChangeRecentlyOpened(()=>{this.recentlyOpened=x.getRecentlyOpened(),this.refreshRecentlyOpened()})),this._register(this.gettingStartedService.onDidChangeWalkthrough(se=>{let ae=this.gettingStartedCategories.find(ce=>ce.id===se.id);ae&&(ae.title=se.title,ae.description=se.description,this.container.querySelectorAll(`[x-category-title-for="${se.id}"]`).forEach(ce=>ce.innerText=ae.title),this.container.querySelectorAll(`[x-category-description-for="${se.id}"]`).forEach(ce=>ce.innerText=ae.description))})),this._register(this.configurationService.onDidChangeConfiguration(se=>{se.affectsConfiguration(yVo)&&this.container.classList.toggle("animatable",this.shouldAnimate())})),this._register(this.gettingStartedService.onDidProgressStep(se=>{let ae=this.gettingStartedCategories.find(Re=>Re.id===se.category);if(!ae)throw Error("Could not find category with ID: "+se.category);let ce=ae.steps.find(Re=>Re.id===se.id);if(!ce)throw Error("Could not find step with ID: "+se.id);let Se=this.getWalkthroughCompletionStats(ae);!ce.done&&Se.stepsComplete===Se.stepsTotal-1&&this.hideCategory(ae.id),ce.done=se.done,ae.id===this.currentWalkthrough?.id&&(Ti(this.window.document.querySelectorAll(`[data-done-step-id="${se.id}"]`)).forEach(xe=>{se.done?(xe.setAttribute("aria-checked","true"),xe.parentElement?.setAttribute("aria-checked","true"),xe.classList.remove(...q.asClassNameArray(JYt)),xe.classList.add("complete",...q.asClassNameArray(ZYt)),xe.setAttribute("aria-label",d(17879,null,se.title))):(xe.setAttribute("aria-checked","false"),xe.parentElement?.setAttribute("aria-checked","false"),xe.classList.remove("complete",...q.asClassNameArray(ZYt)),xe.classList.add(...q.asClassNameArray(JYt)),xe.setAttribute("aria-label",d(17880,null,se.title)))}),se.done&&Er(d(17878,null,se.title))),this.updateCategoryProgress()})),this._register(this.storageService.onWillSaveState(se=>{if(se.reason!==1||this.workspaceContextService.getWorkspace().folders.length!==0||!this.editorInput||!this.currentWalkthrough||!this.editorInput.selectedCategory||!this.editorInput.selectedStep||!(this.groupsService.activeGroup.activeEditorPane instanceof iA))return;let ce={folder:Kke.id,category:this.editorInput.selectedCategory,step:this.editorInput.selectedStep};this.storageService.store(nqe,JSON.stringify(ce),0,1)}))}static{this.ID="gettingStartedPage"}get editorInput(){return this._input}shouldAnimate(){return!(this.configurationService.getValue(yVo)||this.accessibilityService.isMotionReduced())}getWalkthroughCompletionStats(e){let t=e.steps.filter(o=>this.contextService.contextMatchesRules(o.when));return{stepsComplete:t.filter(o=>o.done).length,stepsTotal:t.length}}async setInput(e,t,o,n){await super.setInput(e,t,o,n);let r=t?.selectedCategory??e.selectedCategory,s=t?.selectedStep??e.selectedStep;await this.applyInput({...t,selectedCategory:r,selectedStep:s})}async setOptions(e){super.setOptions(e),this.editorInput&&(this.editorInput.selectedCategory!==e?.selectedCategory||this.editorInput.selectedStep!==e?.selectedStep)&&await this.applyInput(e)}async applyInput(e){this.editorInput&&(this.editorInput.showTelemetryNotice=e?.showTelemetryNotice??!0,this.editorInput.selectedCategory=e?.selectedCategory,this.editorInput.selectedStep=e?.selectedStep,this.editorInput.returnToCommand=e?.returnToCommand,this.container.classList.remove("animatable"),await this.buildCategoriesSlide(e?.preserveFocus),this.shouldAnimate()&&setTimeout(()=>this.container.classList.add("animatable"),0))}async makeCategoryVisibleWhenAvailable(e,t){this.scrollToCategory(e,t)}registerDispatchListeners(){this.dispatchListeners.clear(),this.container.querySelectorAll("[x-dispatch]").forEach(e=>{let t=e.getAttribute("x-dispatch")??"",o,n;t.startsWith("openLink:https")?[o,n]=["openLink",t.replace("openLink:","")]:[o,n]=t.split(":"),o&&(this.dispatchListeners.add($(e,"click",r=>{r.stopPropagation(),this.runDispatchCommand(o,n)})),this.dispatchListeners.add($(e,"keyup",r=>{let s=new mi(r);switch(r.stopPropagation(),s.keyCode){case 3:case 10:this.runDispatchCommand(o,n);return}})))})}async runDispatchCommand(e,t){switch(this.commandService.executeCommand("workbench.action.keepEditor"),this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:e,argument:t,walkthroughId:this.currentWalkthrough?.id}),e){case"scrollPrev":{this.scrollPrev();break}case"skip":{this.runSkip();break}case"showMoreRecents":{this.commandService.executeCommand(yW.ID);break}case"seeAllWalkthroughs":{await this.openWalkthroughSelector();break}case"openFolder":{this.contextService.contextMatchesRules(C.and(el.isEqualTo("workspace")))?this.commandService.executeCommand(Ste.ID):this.commandService.executeCommand("workbench.action.files.openFolder");break}case"selectCategory":{this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"selectCategory",argument:t,walkthroughId:this.currentWalkthrough?.id}),this.scrollToCategory(t),this.gettingStartedService.markWalkthroughOpened(t);break}case"selectStartEntry":{let o=RGi.find(n=>n.id===t);if(o)this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"selectStartEntry",argument:t,walkthroughId:this.currentWalkthrough?.id}),this.runStepCommand(o.content.command);else throw Error("could not find start entry with id: "+t);break}case"hideCategory":{this.hideCategory(t);break}case"selectTask":{this.selectStep(t);break}case"toggleStepCompletion":{this.toggleStepCompletion(t);break}case"allDone":{this.markAllStepsComplete();break}case"nextSection":{let o=this.currentWalkthrough?.next;o?(this.prevWalkthrough=this.currentWalkthrough,this.scrollToCategory(o)):console.error("Error scrolling to next section of",this.currentWalkthrough);break}case"openLink":{this.openerService.open(t);break}default:{console.error("Dispatch to",e,t,"not defined");break}}}hideCategory(e){if(!this.gettingStartedCategories.find(o=>o.id===e))throw Error("Could not find category with ID "+e);this.setHiddenCategories([...this.getHiddenCategories().add(e)]),this.gettingStartedList?.rerender()}markAllStepsComplete(){if(this.currentWalkthrough)this.currentWalkthrough?.steps.forEach(e=>{e.done||this.gettingStartedService.progressStep(e.id)}),this.hideCategory(this.currentWalkthrough?.id),this.scrollPrev();else throw Error("No walkthrough opened")}toggleStepCompletion(e){Ti(this.currentWalkthrough?.steps.find(o=>o.id===e)).done?this.gettingStartedService.deprogressStep(e):this.gettingStartedService.progressStep(e)}async openWalkthroughSelector(){let e=await this.quickInputService.pick(this.gettingStartedCategories.filter(t=>this.contextService.contextMatchesRules(t.when)).map(t=>({id:t.id,label:t.title,detail:t.description,description:t.source})),{canPickMany:!1,matchOnDescription:!0,matchOnDetail:!0,title:d(17872,null)});e&&this.runDispatchCommand("selectCategory",e.id)}getHiddenCategories(){return new Set(JSON.parse(this.storageService.get(MYt,0,"[]")))}setHiddenCategories(e){this.storageService.store(MYt,JSON.stringify(e),0,0)}async buildMediaComponent(e,t=!1){if(!this.currentWalkthrough)throw Error("no walkthrough selected");let o=Ti(this.currentWalkthrough.steps.find(n=>n.id===e));if(!(!t&&this.currentMediaComponent===e)){if(this.currentMediaComponent=e,this.stepDisposables.clear(),this.stepDisposables.add({dispose:()=>{this.currentMediaComponent=void 0}}),this.currentMediaType!==o.media.type&&(this.mediaDisposables.clear(),this.currentMediaType=o.media.type,this.mediaDisposables.add(ee(()=>{this.currentMediaType=void 0})),St(this.stepMediaComponent),o.media.type==="svg"?(this.webview=this.mediaDisposables.add(this.webviewService.createWebviewElement({title:void 0,options:{disableServiceWorker:!0},contentOptions:{},extension:void 0})),this.webview.mountTo(this.stepMediaComponent,this.window)):o.media.type==="markdown"?(this.webview=this.mediaDisposables.add(this.webviewService.createWebviewElement({options:{},contentOptions:{localResourceRoots:[o.media.root],allowScripts:!0},title:"",extension:void 0})),this.webview.mountTo(this.stepMediaComponent,this.window)):o.media.type==="video"&&(this.webview=this.mediaDisposables.add(this.webviewService.createWebviewElement({options:{},contentOptions:{localResourceRoots:[o.media.root],allowScripts:!0},title:"",extension:void 0})),this.webview.mountTo(this.stepMediaComponent,this.window))),o.media.type==="image"){this.stepsContent.classList.add("image"),this.stepsContent.classList.remove("markdown"),this.stepsContent.classList.remove("video");let n=o.media,r=_("img");St(this.stepMediaComponent),this.stepMediaComponent.appendChild(r),r.setAttribute("alt",n.altText),this.updateMediaSourceForColorMode(r,n.path),this.stepDisposables.add($(this.stepMediaComponent,"click",()=>{let s=o.description.map(l=>l.nodes.filter(c=>typeof c!="string").map(c=>c.href)).flat();if(s.length===1){let l=s[0];l.startsWith("http")&&(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"runStepAction",argument:l,walkthroughId:this.currentWalkthrough?.id}),this.openerService.open(l))}})),this.stepDisposables.add(this.themeService.onDidColorThemeChange(()=>this.updateMediaSourceForColorMode(r,n.path)))}else if(o.media.type==="svg"){this.stepsContent.classList.add("image"),this.stepsContent.classList.remove("markdown"),this.stepsContent.classList.remove("video");let n=o.media;this.webview.setHtml(await this.detailsRenderer.renderSVG(n.path));let r=!1;this.stepDisposables.add(ee(()=>{r=!0})),this.stepDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let s=await this.detailsRenderer.renderSVG(n.path);r||this.webview.setHtml(s)})),this.stepDisposables.add($(this.stepMediaComponent,"click",()=>{let s=o.description.map(l=>l.nodes.filter(c=>typeof c!="string").map(c=>c.href)).flat();if(s.length===1){let l=s[0];l.startsWith("http")&&(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"runStepAction",argument:l,walkthroughId:this.currentWalkthrough?.id}),this.openerService.open(l))}})),this.stepDisposables.add(this.webview.onDidClickLink(s=>{(hc(s,Q.https)||hc(s,Q.http)||hc(s,Q.command))&&this.openerService.open(s,{allowCommands:!0})}))}else if(o.media.type==="markdown"){this.stepsContent.classList.remove("image"),this.stepsContent.classList.add("markdown"),this.stepsContent.classList.remove("video");let n=o.media,r=await this.detailsRenderer.renderMarkdown(n.path,n.base);this.webview.setHtml(r);let s=r.match(/checked-on=\"([^'][^"]*)\"/g)?.map(p=>p.slice(12,-1).replace(/&#39;/g,"'").replace(/&amp;/g,"&")),l=()=>{let p=s?.filter(h=>this.contextService.contextMatchesRules(C.deserialize(h)));p&&this.webview.postMessage({enabledContextKeys:p})};if(s){let p=ui(s.map(g=>C.deserialize(g))),h=new Set(p.flatMap(g=>g.keys()));this.stepDisposables.add(this.contextService.onDidChangeContext(g=>{g.affectsSome(h)&&l()}))}let c=!1;this.stepDisposables.add(ee(()=>{c=!0})),this.stepDisposables.add(this.webview.onDidClickLink(p=>{if(hc(p,Q.https)||hc(p,Q.http)||hc(p,Q.command)){let h=p.startsWith("command:toSide:");h&&(p=p.replace("command:toSide:","command:"),this.focusSideEditorGroup()),this.openerService.open(p,{allowCommands:!0,openToSide:h})}})),r.indexOf("<code>")>=0&&this.stepDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let p=await this.detailsRenderer.renderMarkdown(n.path,n.base);c||(this.webview.setHtml(p),l())}));let u=new rn(50);this.layoutMarkdown=()=>{u.trigger(()=>{this.webview.postMessage({layoutMeNow:!0})})},this.stepDisposables.add(u),this.stepDisposables.add({dispose:()=>this.layoutMarkdown=void 0}),l(),this.stepDisposables.add(this.webview.onMessage(async p=>{let h=p.message;if(h.startsWith("command:"))this.openerService.open(h,{allowCommands:!0});else if(h.startsWith("setTheme:")){let g=h.slice(9),f=(await this.themeService.getColorThemes()).find(v=>v.settingsId===g);f&&this.themeService.setColorTheme(f.id,2)}else console.error("Unexpected message",h)}))}else if(o.media.type==="video"){this.stepsContent.classList.add("video"),this.stepsContent.classList.remove("markdown"),this.stepsContent.classList.remove("image");let n=o.media,r=this.themeService.getColorTheme().type,s=n.path[r],l=n.poster?n.poster[r]:void 0,c=n.altText?n.altText:d(17882,null,o.title),u=await this.detailsRenderer.renderVideo(s,l,c);this.webview.setHtml(u);let p=!1;this.stepDisposables.add(ee(()=>{p=!0})),this.stepDisposables.add(this.themeService.onDidColorThemeChange(async()=>{let h=this.themeService.getColorTheme().type,g=n.path[h],f=n.poster?n.poster[h]:void 0,v=await this.detailsRenderer.renderVideo(g,f,c);p||this.webview.setHtml(v)}))}}}async selectStepLoose(e){if(this.editorInput)if(e.startsWith(`${this.editorInput.selectedCategory}#`))this.selectStep(e);else{let t=this.editorInput.selectedCategory+"#"+e;this.selectStep(t)}}provideScreenReaderUpdate(){if(this.configurationService.getValue("accessibility.verbosity.walkthrough")){let e=this.keybindingService.lookupKeybinding(Xee.id)?.getAriaLabel();return e?d(17853,null,e):d(17854,null)}return""}async selectStep(e,t=!0,o){if(this.editorInput){if(e){let n=this.container.querySelector(`[data-step-id="${e}"]`);if(!n){if(n=this.container.querySelector("[data-step-id]"),!n)return;e=Ti(n.getAttribute("data-step-id"))}n.parentElement?.querySelectorAll(".expanded").forEach(l=>{if(l.getAttribute("data-step-id")!==e){l.classList.remove("expanded"),l.setAttribute("aria-expanded","false");let c=l.querySelector(".codicon");c&&c.removeAttribute("tabindex")}}),o||setTimeout(()=>n.focus(),t&&this.shouldAnimate()?BRn:0),this.editorInput.selectedStep=e,n.classList.add("expanded"),n.setAttribute("aria-expanded","true"),this.buildMediaComponent(e,!0);let r=n.querySelector(".codicon");r&&r.setAttribute("tabindex","0"),this.gettingStartedService.progressByEvent("stepSelected:"+e);let s=this.currentWalkthrough?.steps?.find(l=>l.id===e);s&&n.setAttribute("aria-label",`${this.provideScreenReaderUpdate()} ${s.title}`)}else this.editorInput.selectedStep=void 0;this.detailsPageScrollbar?.scanDomNode(),this.detailsScrollbar?.scanDomNode()}}updateMediaSourceForColorMode(e,t){let o=this.themeService.getColorTheme().type,n=t[o].toString(!0).replace(/ /g,"%20");e.srcset=n.toLowerCase().endsWith(".svg")?n:n+" 1.5x"}createEditor(e){this.detailsPageScrollbar&&this.detailsPageScrollbar.dispose(),this.categoriesPageScrollbar&&this.categoriesPageScrollbar.dispose(),this.categoriesSlide=_(".gettingStartedSlideCategories.gettingStartedSlide");let t=_("button.prev-button.button-link",{"x-dispatch":"scrollPrev"},_("span.scroll-button.codicon.codicon-chevron-left"),_("span.moreText",{},d(17864,null)));this.stepsSlide=_(".gettingStartedSlideDetails.gettingStartedSlide",{},t),this.stepsContent=_(".gettingStartedDetailsContent",{}),this.detailsPageScrollbar=this._register(new Ar(this.stepsContent,{className:"full-height-scrollable",vertical:2})),this.categoriesPageScrollbar=this._register(new Ar(this.categoriesSlide,{className:"full-height-scrollable categoriesScrollbar",vertical:2})),this.stepsSlide.appendChild(this.detailsPageScrollbar.getDomNode());let o=_(".gettingStarted",{},this.categoriesPageScrollbar.getDomNode(),this.stepsSlide);this.container.appendChild(o),this.categoriesPageScrollbar.scanDomNode(),this.detailsPageScrollbar.scanDomNode(),e.appendChild(this.container)}async buildCategoriesSlide(e){this.categoriesSlideDisposables.clear();let t=new Lm({icon:L.check,actionClassName:"getting-started-checkbox",isChecked:this.configurationService.getValue(Dqi)==="welcomePage",title:d(17856,null),...zh});t.domNode.id="showOnStartup";let o=_("label.caption",{for:"showOnStartup"},d(17890,null)),n=()=>{t.checked?(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"showOnStartupChecked",argument:void 0,walkthroughId:this.currentWalkthrough?.id}),this.configurationService.updateValue(Dqi,"welcomePage")):(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"showOnStartupUnchecked",argument:void 0,walkthroughId:this.currentWalkthrough?.id}),this.configurationService.updateValue(Dqi,"none"))};this.categoriesSlideDisposables.add(t),this.categoriesSlideDisposables.add(t.onChange(()=>{n()})),this.categoriesSlideDisposables.add($(o,"click",()=>{t.checked=!t.checked,n()}));let r=_(".header",{},_("h1.product-name.caption",{},this.productService.nameLong),_("p.subtitle.description",{},d(17861,null))),s=_(".categories-column.categories-column-left",{}),l=_(".categories-column.categories-column-right",{}),c=this.buildStartList(),u=this.buildRecentlyOpenedList(),p=this.buildGettingStartedWalkthroughsList(),h=[];if(eXt(this.chatEntitlementService)){let S=tXt({cssClass:"getting-started-category.agents-banner",source:"welcomePage"},this.commandService,this.telemetryService);this.categoriesSlideDisposables.add(S.disposables),h.push(S.element)}h.push(_("p.showOnStartup",{},t.domNode,o));let g=_(".footer",{},...h),f=()=>{p.itemCount?(this.container.classList.remove("noWalkthroughs"),Ii(l,p.getDomElement())):(this.container.classList.add("noWalkthroughs"),Ii(l)),setTimeout(()=>this.categoriesPageScrollbar?.scanDomNode(),50),v()},v=()=>{this.container.classList.contains("noWalkthroughs")?(u.setLimit(10),Ii(s,c.getDomElement()),Ii(l,u.getDomElement())):(u.setLimit(5),Ii(s,c.getDomElement(),u.getDomElement()))};p.onDidChange(f),f(),Ii(this.categoriesSlide,_(".gettingStartedCategoriesContainer",{},r,s,l,g)),this.categoriesPageScrollbar?.scanDomNode(),this.updateCategoryProgress(),this.registerDispatchListeners();let b=this.editorInput;if(b?.selectedCategory){if(this.currentWalkthrough=this.gettingStartedCategories.find(S=>S.id===b.selectedCategory),this.currentWalkthrough){this.buildCategorySlide(b.selectedCategory,b.selectedStep,e),this.setSlide("details");return}else if(this.gettingStartedCategories=this.gettingStartedService.getWalkthroughs(),this.currentWalkthrough=this.gettingStartedCategories.find(S=>S.id===b.selectedCategory),this.currentWalkthrough){this.buildCategorySlide(b.selectedCategory,b.selectedStep,e),this.setSlide("details");return}}if(this.editorInput?.showTelemetryNotice&&this.productService.openToWelcomeMainPage){let S=_("p.telemetry-notice");this.buildTelemetryFooter(S),g.appendChild(S)}else if(!this.productService.openToWelcomeMainPage&&this.showFeaturedWalkthrough&&this.storageService.isNew(-1)&&!this.configurationService.getValue("workbench.welcomePage.experimentalOnboarding")){let S=this.storageService.get(eSt,-1)||new Date().toUTCString();if(((+new Date-+new Date(S))/1e3/60/60/24<1?"openToFirstCategory":"index")==="openToFirstCategory"){let x=this.gettingStartedCategories.filter(E=>!E.when||this.contextService.contextMatchesRules(E.when))[0];if(x&&this.editorInput){this.currentWalkthrough=x,this.editorInput.selectedCategory=this.currentWalkthrough?.id,this.editorInput.walkthroughPageTitle=this.currentWalkthrough.walkthroughPageTitle,this.buildCategorySlide(this.editorInput.selectedCategory,void 0,e),this.setSlide("details",!0);return}}}this.setSlide("categories")}buildRecentlyOpenedList(){let e=o=>{let n,r,s;YM(o)?(r={folderUri:o.folderUri},n=o.label||this.labelService.getWorkspaceLabel(o.folderUri,{verbose:2}),s=o.folderUri):(n=o.label||this.labelService.getWorkspaceLabel(o.workspace,{verbose:2}),r={workspaceUri:o.workspace.configPath},s=o.workspace.configPath);let{name:l,parentPath:c}=Wyt(n),u=_("li"),p=_("button.button-link");p.innerText=l,p.title=n,p.setAttribute("aria-label",d(17887,null,l,c)),p.addEventListener("click",v=>{this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"openRecent",argument:void 0,walkthroughId:this.currentWalkthrough?.id}),this.hostService.openWindow([r],{forceNewWindow:v.ctrlKey||v.metaKey,remoteAuthority:o.remoteAuthority||null}),v.preventDefault(),v.stopPropagation()}),u.appendChild(p);let h=_("span");h.classList.add("path"),h.classList.add("detail"),h.innerText=c,h.title=n,u.appendChild(h);let g=_("a.codicon.codicon-close.hide-category-button.recently-opened-delete-button",{tabindex:0,role:"button",title:d(17888,null),"aria-label":d(17889,null,l)}),f=async v=>{v.preventDefault(),v.stopPropagation(),await this.workspacesService.removeRecentlyOpened([s])};return g.addEventListener("click",f),g.addEventListener("keydown",async v=>{let b=new mi(v);(b.keyCode===3||b.keyCode===10)&&await f(v)}),u.appendChild(g),u};this.recentlyOpenedList&&this.recentlyOpenedList.dispose();let t=this.recentlyOpenedList=new rqe({title:d(17874,null),klass:"recently-opened",limit:5,empty:_(".empty-recent",{},d(17869,null),_("button.button-link",{"x-dispatch":"openFolder"},d(17870,null)),d(17881,null)),more:_(".more",{},_("button.button-link",{"x-dispatch":"showMoreRecents",title:d(17875,null,this.getKeybindingLabel(yW.ID))},d(17876,null))),renderElement:e,contextService:this.contextService});return t.onDidChange(()=>this.registerDispatchListeners()),this.recentlyOpened.then(({workspaces:o})=>{let n=this.filterRecentlyOpened(o),r=()=>{t.setEntries(n)};r(),t.register(this.labelService.onDidChangeFormatters(()=>r()))}).catch(mt),t}filterRecentlyOpened(e){return e.filter(t=>!this.workspaceContextService.isCurrentWorkspace(TN(t)?t.workspace:t.folderUri)).map(t=>({...t,id:TN(t)?t.workspace.id:t.folderUri.toString()}))}refreshRecentlyOpened(){this.recentlyOpenedList&&this.recentlyOpened.then(({workspaces:e})=>{let t=this.filterRecentlyOpened(e);this.recentlyOpenedList?.setEntries(t)}).catch(mt)}buildStartList(){let e=o=>_("li",{},_("button.button-link",{"x-dispatch":"selectStartEntry:"+o.id,title:o.description+" "+this.getKeybindingLabel(o.command)},this.iconWidgetFor(o),_("span",{},o.title)));this.startList&&this.startList.dispose();let t=this.startList=new rqe({title:d(17877,null),klass:"start-container",limit:10,renderElement:e,rankElement:o=>-o.order,contextService:this.contextService});return t.setEntries(HRn),t.onDidChange(()=>this.registerDispatchListeners()),t}buildGettingStartedWalkthroughsList(){let e=n=>{let r=(n.newItems||n.newEntry)&&!n.isFeatured,s=_(".new-badge",{});n.newEntry?Ii(s,_(".new-category",{},d(17866,null))):n.newItems&&Ii(s,_(".new-items",{},d(17867,null)));let l=_(".featured-badge",{}),c=_(".description-content",{});n.isFeatured&&this.showFeaturedWalkthrough&&(Ii(l,_(".featured",{},_("span.featured-icon.codicon.codicon-star-full"))),Ii(c,...ir(n.description)));let u=_("h3.category-title.max-lines-3",{"x-category-title-for":n.id});return Ii(u,...ir(n.title)),_("button.getting-started-category"+(n.isFeatured&&this.showFeaturedWalkthrough?".featured":""),{"x-dispatch":"selectCategory:"+n.id,title:n.description},l,_(".main-content",{},this.iconWidgetFor(n),u,r?s:_(".no-badge"),_("a.codicon.codicon-close.hide-category-button",{tabindex:0,"x-dispatch":"hideCategory:"+n.id,title:d(17857,null),role:"button","aria-label":d(17858,null)})),c,_(".category-progress",{"x-data-category-id":n.id},_(".progress-bar-outer",{role:"progressbar"},_(".progress-bar-inner"))))};this.gettingStartedList&&this.gettingStartedList.dispose();let t=n=>{let r=n.order;return n.isFeatured&&(r+=7),n.newEntry&&(r+=3),n.newItems&&(r+=2),n.recencyBonus&&(r+=4*n.recencyBonus),this.getHiddenCategories().has(n.id)&&(r=null),r},o=this.gettingStartedList=new rqe({title:d(17884,null),klass:"getting-started",limit:5,footer:_("span.button-link.see-all-walkthroughs",{"x-dispatch":"seeAllWalkthroughs",tabindex:0},d(17876,null)),renderElement:e,rankElement:t,contextService:this.contextService});return o.onDidChange(()=>{let r=this.getHiddenCategories().size||o.itemCount<this.gettingStartedCategories.filter(s=>this.contextService.contextMatchesRules(s.when)).length;this.container.classList.toggle("someWalkthroughsHidden",!!r),this.registerDispatchListeners(),IVo.bindTo(this.contextService).set(o.itemCount===0),this.updateCategoryProgress()}),o.setEntries(this.gettingStartedCategories),IVo.bindTo(this.contextService).set(o.itemCount===0),o}layout(e){this.detailsScrollbar?.scanDomNode(),this.categoriesPageScrollbar?.scanDomNode(),this.detailsPageScrollbar?.scanDomNode(),this.startList?.layout(e),this.gettingStartedList?.layout(e),this.recentlyOpenedList?.layout(e),this.editorInput?.selectedStep&&this.currentMediaType&&(this.mediaDisposables.clear(),this.stepDisposables.clear(),this.buildMediaComponent(this.editorInput.selectedStep)),this.layoutMarkdown?.(),this.container.classList.toggle("height-constrained",e.height<=600),this.container.classList.toggle("width-constrained",e.width<=400),this.container.classList.toggle("width-semi-constrained",e.width<=950),this.categoriesPageScrollbar?.scanDomNode(),this.detailsPageScrollbar?.scanDomNode(),this.detailsScrollbar?.scanDomNode()}updateCategoryProgress(){this.window.document.querySelectorAll(".category-progress").forEach(e=>{let t=e.getAttribute("x-data-category-id"),o=this.gettingStartedCategories.find(l=>l.id===t);if(!o)return;let n=this.getWalkthroughCompletionStats(o),r=Ti(e.querySelector(".progress-bar-inner"));r.setAttribute("aria-valuemin","0"),r.setAttribute("aria-valuenow",""+n.stepsComplete),r.setAttribute("aria-valuemax",""+n.stepsTotal);let s=n.stepsComplete/n.stepsTotal*100;r.style.width=`${s}%`,e.parentElement.classList.toggle("no-progress",n.stepsComplete===0),n.stepsTotal===n.stepsComplete?r.title=d(17860,null,n.stepsComplete):r.title=d(17863,null,n.stepsComplete,n.stepsTotal)})}async scrollToCategory(e,t){this.gettingStartedCategories.some(n=>n.id===e)||(this.gettingStartedCategories=this.gettingStartedService.getWalkthroughs());let o=this.gettingStartedCategories.find(n=>n.id===e);if(!o)throw Error("Could not find category with ID: "+e);this.inProgressScroll=this.inProgressScroll.then(async()=>{this.editorInput&&(Ii(this.stepsContent),this.editorInput.selectedCategory=e,this.editorInput.selectedStep=t,this.editorInput.walkthroughPageTitle=o.walkthroughPageTitle,this.currentWalkthrough=o,this.buildCategorySlide(e,t),this.setSlide("details"))})}iconWidgetFor(e){let t=e.icon.type==="icon"?_(q.asCSSSelector(e.icon.icon)):_("img.category-icon",{src:e.icon.path});return t.classList.add("icon-widget"),t}focusSideEditorGroup(){let e=this.groupsService.getPart(this.group).contentDimension;if(!e||e.width<=700||this.container.classList.contains("width-constrained")||this.container.classList.contains("width-semi-constrained"))return;if(this.groupsService.count===1){let o=Zy(this.configurationService),n=this.groupsService.addGroup(this.groupsService.groups[0],o);this.groupsService.activateGroup(n)}let t=this.groupsService.getGroups(1).find(o=>!(o.activeEditor instanceof av));t&&(this.groupsService.activateGroup(t),t.focus())}runStepCommand(e){let t=e.startsWith("command:"),o=e.startsWith("command:toSide:"),n=e.replace(/command:(toSide:)?/,"command:");if(this.telemetryService.publicLog2("gettingStarted.ActionExecuted",{command:"runStepAction",argument:e,walkthroughId:this.currentWalkthrough?.id}),o&&this.focusSideEditorGroup(),t){let r=A.parse(n),s=[];try{s=Dm(decodeURIComponent(r.query))}catch{try{s=Dm(r.query)}catch{}}if(Array.isArray(s)||(s=[s]),(r.path===AMe.ID.toString()||r.path===wW.ID.toString())&&this.workspaceContextService.getWorkspace().folders.length===0){let l=this.currentWalkthrough?.steps.findIndex(c=>c.id===this.editorInput?.selectedStep);if(l!==void 0&&l>-1&&this.currentWalkthrough?.steps.slice(l+1).some(c=>!c.done)){let c={folder:Kke.id,category:this.editorInput?.selectedCategory,step:this.editorInput?.selectedStep};this.storageService.store(nqe,JSON.stringify(c),0,1)}}this.commandService.executeCommand(r.path,...s).then(l=>{let c=l?.openFolder;if(c){if(!A.isUri(c)){console.warn("Warn: Running walkthrough command",e,"yielded non-URI `openFolder` result",c,". It will be disregarded.");return}let u={folder:c.toString(),category:this.editorInput?.selectedCategory,step:this.editorInput?.selectedStep};this.storageService.store(nqe,JSON.stringify(u),0,1),this.hostService.openWindow([{folderUri:c}])}})}else this.openerService.open(n,{allowCommands:!0});!t&&(e.startsWith("https://")||e.startsWith("http://"))&&this.gettingStartedService.progressByEvent("onLink:"+e)}buildMarkdownDescription(e,t){for(;e.firstChild;)e.firstChild.remove();for(let o of t)if(o.nodes.length===1&&typeof o.nodes[0]!="string"){let n=o.nodes[0],r=D(e,_(".button-container")),s=new Pi(r,{title:n.title,supportIcons:!0,...Ro}),l=n.href.startsWith("command:"),c=n.href.replace(/command:(toSide:)?/,"command:");if(s.label=n.label,s.onDidClick(u=>{u.stopPropagation(),u.preventDefault(),this.runStepCommand(n.href)},null,this.detailsPageDisposables),l){let u=this.getKeyBinding(c);if(u){let p=_("span.shortcut-message",{},d(17862,null));e.appendChild(p);let h=new ah(p,Ao,{...qk});h.set(u),this.detailsPageDisposables.add(h)}}this.detailsPageDisposables.add(s)}else{let n=D(e,_("p"));for(let r of o.nodes)if(typeof r=="string"){let s=ir(r);for(let l of s)typeof l=="string"?n.appendChild(Jk(l,{renderCodeSegments:!0},_("span"))):n.appendChild(l)}else{let s=hc(r.href,Q.http)||hc(r.href,Q.https)?{...r,title:r.href}:r,l=this.instantiationService.createInstance(Bg,n,s,{opener:c=>this.runStepCommand(c)});this.detailsPageDisposables.add(l)}}return e}clearInput(){this.stepDisposables.clear(),super.clearInput()}buildCategorySlide(e,t,o){if(!this.editorInput)return;this.detailsScrollbar&&this.detailsScrollbar.dispose(),this.extensionService.whenInstalledExtensionsRegistered().then(()=>{this.extensionService.activateByEvent(`onWalkthrough:${e.replace(/[^#]+#/,"")}`)}),this.detailsPageDisposables.clear(),this.mediaDisposables.clear();let n=this.gettingStartedCategories.find(S=>S.id===e);if(!n)throw Error("could not find category with ID "+e);let r=_(".category-description.description.max-lines-3",{"x-category-description-for":n.id});this.buildMarkdownDescription(r,smt(n.description));let s=_(".getting-started-category",{},_(".category-description-container",{},_("h2.category-title.max-lines-3",{"x-category-title-for":n.id},...ir(n.title)),r)),l=_(".step-list-container");this.detailsPageDisposables.add($(l,"keydown",S=>{let y=new mi(S),w=()=>n.steps.findIndex(x=>x.id===this.editorInput?.selectedStep);if(y.keyCode===16){let x=n.steps.filter((E,M)=>M<w()&&this.contextService.contextMatchesRules(E.when));x.length&&this.selectStep(x[x.length-1].id,!1)}if(y.keyCode===18){let x=n.steps.find((E,M)=>M>w()&&this.contextService.contextMatchesRules(E.when));x&&this.selectStep(x.id,!1)}}));let c,u=new Set(n.steps.flatMap(S=>S.when.keys())),p=()=>{n.steps.sort((y,w)=>y.order-w.order);let S=n.steps.filter(y=>this.contextService.contextMatchesRules(y.when));eo(c,S,(y,w)=>y.id===w.id)||(c=S,Ii(l,...c.map(y=>{let w=_(".codicon"+(y.done?".complete"+q.asCSSSelector(ZYt):q.asCSSSelector(JYt)),{"data-done-step-id":y.id,"x-dispatch":"toggleStepCompletion:"+y.id,role:"checkbox","aria-checked":y.done?"true":"false","aria-label":y.done?d(17879,null,y.title):d(17880,null,y.title)}),x=_(".step-description-container",{"x-step-description-for":y.id});this.buildMarkdownDescription(x,y.description);let E=_("h3.step-title.max-lines-3",{"x-step-title-for":y.id});Ii(E,...ir(y.title));let M=_(".step-container",{},E,x);return y.media.type==="image"?M.appendChild(_(".image-description",{"aria-label":d(17865,null,y.media.altText)})):y.media.type==="video"&&M.appendChild(_(".video-description",{"aria-label":d(17883,null,y.media.altText)})),_("button.getting-started-step",{"x-dispatch":"selectTask:"+y.id,"data-step-id":y.id,"aria-expanded":"false","aria-checked":y.done?"true":"false",role:"button"},w,M)})))};p(),this.detailsPageDisposables.add(this.contextService.onDidChangeContext(S=>{S.affectsSome(u)&&this.currentWalkthrough&&this.editorInput&&(p(),this.registerDispatchListeners(),this.selectStep(this.editorInput.selectedStep,!1))}));let h=this.gettingStartedCategories.find(S=>S.id===n.next),g=_(".getting-started-detail-container",{role:"list"},l,_(".done-next-container",{},_("button.button-link.all-done",{"x-dispatch":"allDone"},_("span.codicon.codicon-check-all"),d(17855,null)),...h?[_("button.button-link.next",{"x-dispatch":"nextSection"},d(17868,null),_("span.codicon.codicon-arrow-right"))]:[]));this.detailsScrollbar=this._register(new Ar(g,{className:"steps-container"}));let f=this.detailsScrollbar.getDomNode(),v=_(".getting-started-footer");this.editorInput.showTelemetryNotice&&Yy(this.configurationService)!==0&&this.productService.enableTelemetry&&this.buildTelemetryFooter(v),Ii(this.stepsContent,s,f,this.stepMediaComponent,v);let b=n.steps.find(S=>this.contextService.contextMatchesRules(S.when)&&!S.done)??n.steps[0];this.selectStep(t??b.id,!t,o),this.detailsScrollbar.scanDomNode(),this.detailsPageScrollbar?.scanDomNode(),this.registerDispatchListeners()}buildTelemetryFooter(e){let o=`[${d(17873,null)}](command:workbench.action.openPrivacyStatementUrl)`,r=`[${d(17871,null)}](command:settings.filterByTelemetry)`,s=d(17859,null,this.productService.nameShort,o,r),l=this.detailsPageDisposables.add(this.markdownRendererService.render({value:s,isTrusted:!0}));e.append(l.element)}getKeybindingLabel(e){e=e.replace(/^command:/,"");let t=this.keybindingService.lookupKeybinding(e)?.getLabel();return t?`(${t})`:""}getKeyBinding(e){return e=e.replace(/^command:/,""),this.keybindingService.lookupKeybinding(e)}async scrollPrev(){this.inProgressScroll=this.inProgressScroll.then(async()=>{this.prevWalkthrough&&this.prevWalkthrough!==this.currentWalkthrough?(this.currentWalkthrough=this.prevWalkthrough,this.prevWalkthrough=void 0,this.makeCategoryVisibleWhenAvailable(this.currentWalkthrough.id)):this.editorInput?.returnToCommand?this.commandService.executeCommand(this.editorInput.returnToCommand):(this.currentWalkthrough=void 0,this.editorInput&&(this.editorInput.selectedCategory=void 0,this.editorInput.selectedStep=void 0,this.editorInput.showTelemetryNotice=!1,this.editorInput.walkthroughPageTitle=void 0),this.gettingStartedCategories.length!==this.gettingStartedList?.itemCount&&this.buildCategoriesSlide(),this.selectStep(void 0),this.setSlide("categories"),this.container.focus())})}runSkip(){this.commandService.executeCommand("workbench.action.closeActiveEditor")}escape(){this.editorInput?.selectedCategory?this.scrollPrev():this.runSkip()}setSlide(e,t=!1){let o=Ti(this.container.querySelector(".gettingStarted"));if(e==="categories")o.classList.remove("showDetails"),o.classList.add("showCategories"),this.container.querySelector(".prev-button.button-link").style.display="none",this.container.querySelector(".gettingStartedSlideDetails").querySelectorAll("button").forEach(n=>n.disabled=!0),this.container.querySelector(".gettingStartedSlideCategories").querySelectorAll("button").forEach(n=>n.disabled=!1),this.container.querySelector(".gettingStartedSlideCategories").querySelectorAll("input").forEach(n=>n.disabled=!1);else{o.classList.add("showDetails"),o.classList.remove("showCategories");let n=this.container.querySelector(".prev-button.button-link");n.style.display=this.editorInput?.showWelcome||this.editorInput?.returnToCommand||this.prevWalkthrough?"block":"none";let r=n.querySelector(".moreText");r.textContent=t?d(17885,null):d(17864,null),this.container.querySelector(".gettingStartedSlideDetails").querySelectorAll("button").forEach(s=>s.disabled=!1),this.container.querySelector(".gettingStartedSlideCategories").querySelectorAll("button").forEach(s=>s.disabled=!0),this.container.querySelector(".gettingStartedSlideCategories").querySelectorAll("input").forEach(s=>s.disabled=!0)}}focus(){super.focus();let e=this.container.ownerDocument.activeElement,t=this.container.parentElement;for(;t&&t!==e;)t=t.parentElement;t&&this.container.focus()}};iA=I([m(1,fe),m(2,Ze),m(3,Le),m(4,tA),m(5,B),m(6,_e),m(7,Rt),m(8,ge),m(9,Je),m(10,ep),m(11,de),m(12,lt),m(13,F),m(14,Ne),m(15,kt),m(16,X),m(17,$e),m(18,bm),m(19,nt),m(20,ti),m(21,Pu),m(22,Ae),m(23,Ai),m(24,_n),m(25,dr)],iA);var iXt=class{canSerialize(i){return!0}serialize(i){return JSON.stringify({selectedCategory:i.selectedCategory,selectedStep:i.selectedStep})}deserialize(i,e){return i.invokeFunction(t=>{try{let{selectedCategory:o,selectedStep:n}=JSON.parse(e);return new av({selectedCategory:o,selectedStep:n})}catch{}return new av({})})}};var oXt=class{constructor(){this.type="view";this.priority=110;this.name="walkthroughs";this.when=_mt;this.getProvider=i=>{let t=i.get(ie).activeEditorPane;if(!(t instanceof iA))return;let o=t.input;if(!(o instanceof av)||!o.selectedCategory)return;let r=i.get(tA).getWalkthrough(o.selectedCategory),s=o.selectedStep;if(r)return new Rqi(i.get(X),i.get(fe),i.get(Je),t,r,s)}}},Rqi=class extends k{constructor(e,t,o,n,r,s){super();this.contextService=e;this.commandService=t;this.openerService=o;this._gettingStartedPage=n;this._walkthrough=r;this._focusedStep=s;this._currentStepIndex=0;this._activeWalkthroughSteps=[];this.id="walkthrough";this.verbositySettingKey="accessibility.verbosity.walkthrough";this.options={type:"view"};this._activeWalkthroughSteps=r.steps.filter(l=>!l.when||this.contextService.contextMatchesRules(l.when))}get actions(){let e=[],o=this._activeWalkthroughSteps[this._currentStepIndex].description.map(n=>n.nodes.filter(r=>typeof r!="string").map(r=>({href:r.href,label:r.label}))).flat();if(o.length===1){let n=o[0];e.push(new it("walthrough.step.action",n.label,q.asClassName(L.run),!0,()=>{let r=n.href.startsWith("command:"),s=n.href.replace(/command:(toSide:)?/,"command:");if(r){let l=A.parse(s),c=[];try{c=Dm(decodeURIComponent(l.query))}catch{try{c=Dm(l.query)}catch{}}Array.isArray(c)||(c=[c]),this.commandService.executeCommand(l.path,...c)}else this.openerService.open(s,{allowCommands:!0})}))}return e}provideContent(){if(this._focusedStep){let e=this._activeWalkthroughSteps.findIndex(t=>t.id===this._focusedStep);e!==-1&&(this._currentStepIndex=e)}return this._getContent(this._walkthrough,this._activeWalkthroughSteps[this._currentStepIndex],!0)}_getContent(e,t,o){let n=t.description.map(s=>s.nodes.filter(l=>typeof l=="string")).join(`
`),r=d(17914,null,t.title,n);return o?[d(17915,null,e.title),d(17913,null,e.description),r].join(`
`):r}provideNextContent(){if(++this._currentStepIndex>=this._activeWalkthroughSteps.length){--this._currentStepIndex;return}return this._getContent(this._walkthrough,this._activeWalkthroughSteps[this._currentStepIndex])}providePreviousContent(){if(--this._currentStepIndex<0){++this._currentStepIndex;return}return this._getContent(this._walkthrough,this._activeWalkthroughSteps[this._currentStepIndex])}onClose(){if(this._currentStepIndex>-1){let e=this._activeWalkthroughSteps[this._currentStepIndex];this._gettingStartedPage.makeCategoryVisibleWhenAvailable(this._walkthrough.id,e.id)}}};var URn="workbench.editors.agentSessionsWelcomeInput",zO=class a extends Ls{static{this.ID=URn}static{this.RESOURCE=A.from({scheme:Q.walkThrough,authority:"vscode_agent_sessions_welcome"})}get typeId(){return a.ID}get editorId(){return this.typeId}toUntyped(){return{resource:a.RESOURCE,options:{override:a.ID,pinned:!1}}}get resource(){return a.RESOURCE}matches(i){return super.matches(i)?!0:i instanceof a}constructor(i={}){super(),this._showTelemetryNotice=!!i.showTelemetryNotice,this._initiator=i.initiator??"command",this._workspaceKind=i.workspaceKind}getName(){return d(17852,null)}get showTelemetryNotice(){return this._showTelemetryNotice}set showTelemetryNotice(i){this._showTelemetryNotice=i}get initiator(){return this._initiator}get workspaceKind(){return this._workspaceKind}getTelemetryDescriptor(){let i=super.getTelemetryDescriptor();return i.initiator=this._initiator,i.workspaceKind=this._workspaceKind,i}};var Lqi="workbench.startupEditor",wVo=6,KRn=10,GRn=10,CVo=150,qRn=50,$Rn=72,jRn=CVo+qRn+$Rn,X_=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V){super(X_.ID,e,t,o,n);this.storageService=n;this.instantiationService=r;this.layoutService=l;this.commandService=c;this.editorService=u;this.agentSessionsService=p;this.configurationService=h;this.productService=g;this.walkthroughsService=f;this.chatService=v;this.chatEntitlementService=b;this.markdownRendererService=S;this.workspaceContextService=y;this.workspacesService=w;this.hostService=x;this.workspaceTrustManagementService=E;this.viewDescriptorService=M;this.chatWidgetService=N;this.logService=V;this.sessionsControlDisposables=this._register(new O);this.contentDisposables=this._register(new O);this.walkthroughs=[];this._selectedSessionProvider=zo.Local;this._recentTrustedWorkspaces=[];this._isEmptyWorkspace=!1;this._workspaceKind="empty";this._openedAt=0;this.container=_(".agentSessionsWelcome",{role:"document",tabindex:0,"aria-label":d(17836,null)}),this.contextService=this._register(s.createScoped(this.container)),Z.inAgentSessionsWelcome.bindTo(this.contextService).set(!0),this._register(this.chatEntitlementService.onDidChangeSentiment(()=>{let H=this.input||this._storedInput;this.chatEntitlementService.sentiment.hidden&&H&&(this._closedBy="chatHidden",this.group.closeEditor(H))}))}static{this.ID="agentSessionsWelcomePage"}static{this.COMMAND_ID="workbench.action.openAgentSessionsWelcome"}createEditor(e){e.appendChild(this.container),this.contentContainer=_(".agentSessionsWelcome-content"),this.scrollableElement=this._register(new Ar(this.contentContainer,{className:"agentSessionsWelcome-scrollable",vertical:1})),this.container.appendChild(this.scrollableElement.getDomNode())}async setInput(e,t,o,n){this._storedInput=e,this._openedAt=Date.now(),await super.setInput(e,t,o,n),this._workspaceKind=e.workspaceKind??"empty",await this.buildContent()}clearInput(){if(this._openedAt>0){let e=Date.now()-this._openedAt;this.telemetryService.publicLog2("agentSessionsWelcome.closed",{visibleDurationMs:e,closedBy:this._closedBy??"disposed"}),this._openedAt=0,this._closedBy=void 0}super.clearInput()}async buildContent(){if(this.contentDisposables.clear(),this.sessionsControlDisposables.clear(),this.sessionsControl=void 0,St(this.contentContainer),this._isEmptyWorkspace=this.workspaceContextService.getWorkbenchState()===1,this._isEmptyWorkspace){let l=await this.getRecentlyOpenedWorkspaces(!0);this._recentTrustedWorkspaces=l.slice(0,KRn)}this.walkthroughs=this.walkthroughsService.getWalkthroughs();let e=D(this.contentContainer,_(".agentSessionsWelcome-header"));D(e,_("h1.product-name",{},this.productService.nameLong));let t=D(e,_(".agentSessionsWelcome-startEntries"));await this.buildStartEntries(t);let o=D(this.contentContainer,_(".agentSessionsWelcome-chatSection"));this.buildChatWidget(o);let n=D(this.contentContainer,_(".agentSessionsWelcome-sessionsSection"));this.buildSessionsOrPrompts(n);let r=D(this.contentContainer,_(".agentSessionsWelcome-footer"));this.buildFooter(r);let s=this.agentSessionsService.model.sessions.length>0;this.contentDisposables.add(this.agentSessionsService.model.onDidChangeSessions(()=>{let l=this.agentSessionsService.model.sessions.length>0;l!==s&&(s=l,St(n),this.buildSessionsOrPrompts(n)),this.layoutSessionsControl()})),this.scrollableElement?.scanDomNode()}async buildStartEntries(e){let n=[(await this.getRecentlyOpenedWorkspaces(!1)).length>0?{icon:L.folderOpened,label:d(17843,null),command:"workbench.action.openRecent"}:{icon:L.folderOpened,label:d(17842,null),command:"workbench.action.files.openFolder"},{icon:L.newFile,label:d(17840,null),command:"welcome.showNewFileEntries"},{icon:L.repoClone,label:d(17838,null),command:"git.clone"}];for(let r of n){let s=D(e,_("button.agentSessionsWelcome-startEntry"));s.appendChild(un(r.icon)),s.appendChild(document.createTextNode(r.label)),s.onclick=()=>{this.telemetryService.publicLog2("agentSessionsWelcome.ActionExecuted",{welcomeKind:"agentSessionsWelcomePage",action:"executeCommand",actionId:r.command}),this.commandService.executeCommand(r.command)}}}buildChatWidget(e){let t=D(e,_(".agentSessionsWelcome-chatWidget")),o=this.layoutService.getContainer(Me(t)).appendChild(_(".chat-editor-overflow.monaco-editor"));this.contentDisposables.add(ee(()=>o.remove()));let n=this.contentDisposables.add(this.contextService.createScoped(t)),r=this.contentDisposables.add(this.instantiationService.createChild(new Po([X,n]))),s=this.contentDisposables.add(new T),l=async g=>{if(this.chatWidget&&this.chatModelRef){this.chatWidget.setModel(void 0),this.chatModelRef.dispose();let f=Gxi({type:g,position:"sidebar",displayName:""}),v=await this.chatService.acquireOrLoadSession(f,"panel",Ie.None);this.chatModelRef=v??this.chatService.startNewLocalSession("panel"),this.contentDisposables.add(this.chatModelRef),this.chatModelRef.object&&this.chatWidget.setModel(this.chatModelRef.object)}},c={getActiveSessionProvider:()=>this._selectedSessionProvider,setActiveSessionProvider:g=>{this._selectedSessionProvider=g,s.fire(g);try{l(g)}catch{}},onDidChangeActiveSessionProvider:s.event},u=this.contentDisposables.add(new T),p=this.contentDisposables.add(new T),h=this._isEmptyWorkspace?{getWorkspaces:()=>this._recentTrustedWorkspaces.map(g=>({uri:this.getWorkspaceUri(g),label:this.getWorkspaceLabel(g),isFolder:YM(g)})),getSelectedWorkspace:()=>this._selectedWorkspace,setSelectedWorkspace:g=>{this._selectedWorkspace=g,u.fire(g)},onDidChangeSelectedWorkspace:u.event,onDidChangeWorkspaces:p.event,openFolderCommand:"workbench.action.files.openFolder"}:void 0;this.chatWidget=this.contentDisposables.add(r.createInstance(my,"panel",{},{autoScroll:g=>g!=="ask",renderFollowups:!1,supportsFileReferences:!0,renderInputOnTop:!0,rendererOptions:{renderTextEditsAsSummary:()=>!0,referencesExpandedWhenEmptyResponse:!1,progressMessageAtBottomOfResponse:g=>g!=="ask"},editorOverflowWidgetsDomNode:o,enableImplicitContext:!0,enableWorkingSet:"explicit",supportsChangingModes:!0,sessionTypePickerDelegate:c,workspacePickerDelegate:h,submitHandler:this._isEmptyWorkspace?(g,f)=>this.handleWorkspaceSubmission(g,f):void 0},{listForeground:QA,listBackground:Bo,overlayBackground:Bo,inputEditorBackground:Bo,resultEditorBackground:Bo})),this.chatWidget.render(t),this.chatWidget.setVisible(!0),this.contentDisposables.add(kr(Me(t),()=>{this.layoutChatWidget()})),this.chatModelRef=this.chatService.startNewLocalSession("panel"),this.contentDisposables.add(this.chatModelRef),this.chatModelRef.object&&this.chatWidget.setModel(this.chatModelRef.object),this.contentDisposables.add($(t,"mousedown",()=>{this.chatWidget?.focusInput()})),this.contentDisposables.add(this.chatService.onDidSubmitRequest(({chatSessionResource:g})=>{if(this.chatModelRef?.object?.sessionResource.toString()===g.toString()){let f=this.chatWidget?.input.currentModeObs.get().name.get()||"unknown";this.telemetryService.publicLog2("agentSessionsWelcome.chatSubmitted",{mode:f,provider:this._selectedSessionProvider,workspaceKind:this._workspaceKind,selectedRecentWorkspace:this._selectedWorkspace!==void 0}),this._closedBy="chatSubmission",this.openSessionInChat(g)}})),this.applyPrefillData()}getWorkspaceLabel(e){return YM(e)?e.label||Be(e.folderUri):TN(e)?e.label||Be(e.workspace.configPath):""}getWorkspaceUri(e){if(YM(e))return e.folderUri;if(TN(e))return e.workspace.configPath;throw new Error("Invalid workspace type")}async handleWorkspaceSubmission(e,t){if(!this._selectedWorkspace||!e.trim())return!1;let o={query:e,mode:t,timestamp:Date.now()};this.storageService.store("chat.welcomeViewPrefill",JSON.stringify(o),-1,1);let n=this._recentTrustedWorkspaces.find(r=>this.getWorkspaceUri(r).toString()===this._selectedWorkspace?.uri.toString());if(n)try{return YM(n)?await this.hostService.openWindow([{folderUri:n.folderUri}]):TN(n)&&await this.hostService.openWindow([{workspaceUri:n.workspace.configPath}]),!0}catch{}return this.storageService.remove("chat.welcomeViewPrefill",-1),!1}applyPrefillData(){let e=this.storageService.get("chat.welcomeViewPrefill",-1);if(e){this.storageService.remove("chat.welcomeViewPrefill",-1);try{let{query:t,mode:o,timestamp:n}=JSON.parse(e);if(n&&Date.now()-n>60*1e3)return;t&&this.chatWidget&&this.chatWidget.setInput(t),o!==void 0&&this.chatWidget&&this.chatWidget.input.setChatMode(o,!1),this.chatWidget?.focusInput()}catch{}}}buildSessionsOrPrompts(e){this.sessionsControlDisposables.clear(),this.sessionsControl=void 0;let t=this.agentSessionsService.model.sessions.filter(o=>!o.isArchived());t.length>0?this.buildSessionsGrid(e,t):this.buildWalkthroughs(e)}buildSessionsGrid(e,t){this.sessionsControlContainer=D(e,_(".agentSessionsWelcome-sessionsGrid"));let o={overrideStyles:WS({listBackground:Bo}),filter:this.sessionsControlDisposables.add(this.instantiationService.createInstance(EV,{limitResults:()=>wVo,overrideExclude:n=>n.isArchived()?!0:void 0})),getHoverPosition:()=>2,trackActiveEditorSession:()=>!1,source:"welcomeView",notifySessionOpened:()=>{this.configurationService.getValue("chat.agentSessionProjection.enabled")||(this._closedBy="sessionClicked",this.revealMaximizedChat())}};if(this.sessionsControl=this.sessionsControlDisposables.add(this.instantiationService.createInstance(qP,this.sessionsControlContainer,o)),this.sessionsControlDisposables.add(this.agentSessionsService.model.onDidResolve(()=>{this.layoutSessionsControl()})),this.agentSessionsService.model.resolved&&this.layoutSessionsControl(),this.sessionsControlDisposables.add(kr(Me(this.sessionsControlContainer),()=>{this.layoutSessionsControl()})),eXt(this.chatEntitlementService)){let n=tXt({cssClass:"agentSessionsWelcome-agentsBanner",source:"agentSessionsWelcome",label:d(17848,null),onButtonClick:()=>{this._closedBy="viewAllSessions"}},this.commandService,this.telemetryService);this.sessionsControlDisposables.add(n.disposables),D(e,n.element)}}buildWalkthroughs(e){let t=this.walkthroughs.filter(f=>!f.when||this.contextService.contextMatchesRules(f.when)).slice(0,GRn);if(t.length===0)return;let o=0,n=D(e,_(".agentSessionsWelcome-walkthroughCard")),r=D(n,_(".agentSessionsWelcome-walkthroughCard-icon")),s=D(n,_(".agentSessionsWelcome-walkthroughCard-content")),l=D(s,_(".agentSessionsWelcome-walkthroughCard-title")),c=D(s,_(".agentSessionsWelcome-walkthroughCard-description")),u=D(n,_(".agentSessionsWelcome-walkthroughCard-nav")),p=D(u,_("button.nav-button"));p.appendChild(un(L.chevronLeft)),p.title=d(17844,null);let h=D(u,_("button.nav-button"));h.appendChild(un(L.chevronRight)),h.title=d(17841,null);let g=()=>{let f=t[o];St(r),f.icon.type==="icon"&&r.appendChild(un(f.icon.icon)),l.textContent=f.title,c.textContent=f.description||"",p.disabled=o===0,h.disabled=o===t.length-1};g(),n.onclick=()=>{let f=t[o];this.telemetryService.publicLog2("agentSessionsWelcome.ActionExecuted",{welcomeKind:"agentSessionsWelcomePage",action:"openWalkthrough",actionId:f.id});let v={selectedCategory:f.id,returnToCommand:X_.COMMAND_ID};this.editorService.openEditor({resource:av.RESOURCE,options:v})},p.onclick=f=>{f.stopPropagation(),o>0&&(o--,g())},h.onclick=f=>{f.stopPropagation(),o<t.length-1&&(o++,g())}}static{this.PRIVACY_NOTICE_DISMISSED_KEY="agentSessionsWelcome.privacyNoticeDismissed"}buildPrivacyNotice(e){if(!this.chatEntitlementService.anonymous||this.storageService.getBoolean(X_.PRIVACY_NOTICE_DISMISSED_KEY,-1,!1))return;let t=this.productService.defaultChatAgent?.provider;if(!t||!t.default||!this.productService.defaultChatAgent?.termsStatementUrl||!this.productService.defaultChatAgent?.privacyStatementUrl)return;let o=D(e,_(".agentSessionsWelcome-walkthroughCard.agentSessionsWelcome-tosCard")),n=()=>{this.storageService.store(X_.PRIVACY_NOTICE_DISMISSED_KEY,!0,-1,0),o.remove()};this.contentDisposables.add(this.chatService.onDidSubmitRequest(()=>n())),D(o,_(".agentSessionsWelcome-walkthroughCard-icon")).appendChild(un(L.chatSparkle));let s=D(o,_(".agentSessionsWelcome-walkthroughCard-content")),l=D(s,_(".agentSessionsWelcome-walkthroughCard-title"));l.textContent=d(17847,null);let c=D(s,_(".agentSessionsWelcome-walkthroughCard-description")),u=new he(d(17846,null,t.default.name,this.productService.defaultChatAgent.termsStatementUrl,this.productService.defaultChatAgent.privacyStatementUrl),{isTrusted:!0}),p=this.markdownRendererService.render(u);c.appendChild(p.element);let h=D(o,_("button.agentSessionsWelcome-tosCard-dismiss"));h.appendChild(un(L.close)),h.title=d(17839,null),h.onclick=g=>{g.stopPropagation(),n()}}buildFooter(e){this.buildPrivacyNotice(e);let t=D(e,_(".agentSessionsWelcome-showOnStartup")),o=this.contentDisposables.add(new Lm({icon:L.check,actionClassName:"agentSessionsWelcome-checkbox",isChecked:this.configurationService.getValue(Lqi)==="agentSessionsWelcomePage",title:d(17837,null),...peo({inputActiveOptionBackground:"var(--vscode-descriptionForeground)",inputActiveOptionForeground:"var(--vscode-editor-background)",inputActiveOptionBorder:"var(--vscode-descriptionForeground)"})}));o.domNode.id="showOnStartup";let n=_("label.caption",{for:"showOnStartup"},d(17845,null)),r=()=>{o.checked?this.configurationService.updateValue(Lqi,"agentSessionsWelcomePage"):this.configurationService.updateValue(Lqi,"none")};this.contentDisposables.add(o.onChange(()=>r())),this.contentDisposables.add($(n,"click",()=>{o.checked=!o.checked,r()})),t.appendChild(o.domNode),t.appendChild(n)}layout(e){this.lastDimension=e,this.container.style.height=`${e.height}px`,this.container.style.width=`${e.width}px`,this.layoutChatWidget(),this.layoutSessionsControl(),this.scrollableElement?.scanDomNode()}layoutChatWidget(){if(!this.chatWidget||!this.lastDimension)return;let e=Math.min(800,this.lastDimension.width-80);this.chatWidget.setInputPartMaxHeightOverride(jRn),this.chatWidget.layout(CVo,e)}layoutSessionsControl(){if(!this.sessionsControl||!this.sessionsControlContainer||!this.lastDimension)return;let e=Math.min(800,this.lastDimension.width-80),t=Math.min(this.agentSessionsService.model.sessions.filter(r=>!r.isArchived()).length,wVo),o=t*jve.ITEM_HEIGHT;this.sessionsControl.layout(o,e);let n=Math.floor(t/2)*jve.ITEM_HEIGHT;this.sessionsControl.element.style.marginBottom=`-${n}px`}focus(){super.focus(),this.chatWidget?.focusInput()}async revealMaximizedChat(){try{await this.closeEditorAndMaximizeAuxiliaryBar()}catch(e){this.logService.error("Failed to open maximized chat: {0}",Mn(e))}}async openSessionInChat(e){try{await this.closeEditorAndMaximizeAuxiliaryBar(e)}catch(t){this.logService.error("Failed to open agent session: {0}",Mn(t))}}async closeEditorAndMaximizeAuxiliaryBar(e){let t=this.input||this._storedInput;t&&this.group.contains(t)&&await new Promise(n=>{let r=this.group.onDidActiveEditorChange(s=>{r.dispose(),n()});this.group.closeEditor(t)}),e?await this.chatWidgetService.openSession(e):await this.commandService.executeCommand("workbench.action.chat.open"),this.viewDescriptorService.getViewLocationById(Xr)===2&&this.layoutService.setAuxiliaryBarMaximized(!0)}async getRecentlyOpenedWorkspaces(e=!1){let o=(await this.workspacesService.getRecentlyOpened()).workspaces.map(async s=>{let l=TN(s)?s.workspace.configPath:s.folderUri,c=await this.workspaceTrustManagementService.getUriTrustInfo(l);return{workspace:s,trusted:c.trusted}});return(await Promise.all(o)).filter(s=>e?s.trusted:!0).map(s=>s.workspace)}};X_=I([m(1,_e),m(2,Pe),m(3,de),m(4,F),m(5,X),m(6,wi),m(7,fe),m(8,ie),m(9,Vc),m(10,B),m(11,Ze),m(12,tA),m(13,si),m(14,dr),m(15,_n),m(16,Ae),m(17,bm),m(18,ti),m(19,Or),m(20,ji),m(21,Lt),m(22,re)],X_);var nXt=class{canSerialize(i){return!0}serialize(i){return JSON.stringify({})}deserialize(i,e){return new zO({})}};W(class extends z{constructor(){super({id:"workbench.action.openWalkthrough",title:P(17893,"Welcome"),category:Fe.Help,f1:!0,menu:{id:R.MenubarHelpMenu,group:"1_welcome",order:1},metadata:{description:P(17892,"Opens a Walkthrough to help you get started in VS Code.")}})}run(a,i,e){let t=a.get(ie),o=a.get(fe),n=a.get(B),r=a.get(dr),s=typeof e=="object"?e.toSide:e,l=typeof e=="object"?e.inactive:!1,c=t.activeEditor;if(!i&&!r.sentiment.hidden&&n.getValue("workbench.startupEditor")==="agentSessionsWelcomePage"){o.executeCommand(X_.COMMAND_ID);return}else if(i){let u=typeof i=="string"?i:i.category,p;if(typeof i=="object"&&"category"in i&&"step"in i?p=`${i.category}#${i.step}`:p=void 0,p&&c instanceof av&&c.selectedCategory===u){c.showWelcome=!1,o.executeCommand("walkthroughs.selectStep",p);return}let h;u?h={selectedCategory:u,selectedStep:p,showWelcome:!1,preserveFocus:s??!1,inactive:l}:h={selectedCategory:u,selectedStep:p,showWelcome:!0,preserveFocus:s??!1,inactive:l},t.openEditor({resource:av.RESOURCE,options:h},s?En:void 0)}else t.openEditor({resource:av.RESOURCE,options:{preserveFocus:s??!1,inactive:l}},s?En:void 0)}});oe.as(en.EditorFactory).registerEditorSerializer(av.ID,iXt);oe.as(en.EditorPane).registerEditorPane(os.create(iA,iA.ID,d(17895,null)),[new Vt(av)]);var rXt=P(17896,"Welcome");W(class extends z{constructor(){super({id:"welcome.goBack",title:P(17897,"Go Back"),category:rXt,keybinding:{weight:100,primary:9,when:_mt},precondition:C.equals("activeEditor","gettingStartedPage"),f1:!0})}run(a){let e=a.get(ie).activeEditorPane;e instanceof iA&&e.escape()}});Ge.registerCommand({id:"walkthroughs.selectStep",handler:(a,i)=>{let t=a.get(ie).activeEditorPane;t instanceof iA?t.selectStepLoose(i):console.error("Cannot run walkthroughs.selectStep outside of walkthrough context")}});W(class extends z{constructor(){super({id:"welcome.markStepComplete",title:d(17898,null),category:rXt})}run(a,i){if(!i)return;a.get(tA).progressStep(i)}});W(class extends z{constructor(){super({id:"welcome.markStepIncomplete",title:d(17899,null),category:rXt})}run(a,i){if(!i)return;a.get(tA).deprogressStep(i)}});W(class extends z{constructor(){super({id:"welcome.showAllWalkthroughs",title:P(17900,"Open Walkthrough..."),category:rXt,f1:!0,menu:{id:R.MenubarHelpMenu,group:"1_welcome",order:3}})}async getQuickPickItems(a,i){return(await i.getWalkthroughs()).filter(t=>a.contextMatchesRules(t.when)).map(t=>({id:t.id,label:t.title,detail:t.description,description:t.source}))}async run(a){let i=a.get(fe),e=a.get(X),t=a.get($e),o=a.get(tA),n=a.get(lt),r=new O,s=r.add(t.createQuickPick());s.canSelectMany=!1,s.matchOnDescription=!0,s.matchOnDetail=!0,s.placeholder=d(17894,null),s.items=await this.getQuickPickItems(e,o),s.busy=!0,r.add(s.onDidAccept(()=>{let l=s.selectedItems[0];l&&i.executeCommand("workbench.action.openWalkthrough",l.id),s.hide()})),r.add(s.onDidHide(()=>r.dispose())),await n.whenInstalledExtensionsRegistered(),r.add(o.onDidAddWalkthrough(async()=>{s.items=await this.getQuickPickItems(e,o)})),s.show(),s.busy=!1}});Ge.registerCommand({id:"welcome.newWorkspaceChat",handler:(a,i)=>{a.get(fe).executeCommand("workbench.action.chat.open",{mode:"agent",query:"#new ",isPartialQuery:!0})}});var Dmt=new Y("workspacePlatform",void 0,d(17912,null)),sqe=class{constructor(i,e,t){this.extensionManagementServerService=i;this.remoteAgentService=e;this.contextService=t;this.remoteAgentService.getEnvironment().then(o=>{let n=o?.os,r=n===2?"mac":n===1?"windows":n===3?"linux":void 0;r?Dmt.bindTo(this.contextService).set(r):this.extensionManagementServerService.localExtensionManagementServer?et?Dmt.bindTo(this.contextService).set("mac"):Sn?Dmt.bindTo(this.contextService).set("linux"):ii&&Dmt.bindTo(this.contextService).set("windows"):this.extensionManagementServerService.webExtensionManagementServer?Dmt.bindTo(this.contextService).set("webworker"):console.error("Error: Unable to detect workspace platform")})}static{this.ID="workbench.contrib.workspacePlatform"}};sqe=I([m(0,$c),m(1,bo),m(2,X)],sqe);var QRn=oe.as($t.Configuration);QRn.registerConfiguration({...jd,properties:{"workbench.welcomePage.walkthroughs.openOnInstall":{scope:2,type:"boolean",default:!0,description:d(17911,null)},"workbench.startupEditor":{scope:5,type:"string",enum:["none","welcomePage","readme","newUntitledFile","welcomePageInEmptyWorkbench","terminal","agentSessionsWelcomePage"],enumDescriptions:[d(17904,null),d(17907,null),d(17905,null),d(17903,null),d(17908,null),d(17906,null),d(17902,null)],default:"welcomePage",description:d(17901,null),experiment:{mode:"auto"},agentsWindow:{default:"none",readOnly:!0}},"workbench.welcomePage.preferReducedMotion":{scope:1,type:"boolean",default:!1,deprecationMessage:d(17891,null),description:d(17910,null)},"workbench.welcomePage.experimentalOnboarding":{scope:1,type:"boolean",default:!0,tags:["experimental"],description:d(17909,null),experiment:{mode:"auto"}}}});bt(sqe.ID,sqe,vt.AfterRestored);bt(RIe.ID,RIe,vt.BlockRestore);bt(LIe.ID,LIe,vt.AfterRestored);_a.register(new oXt);var YRn="workbench.editors.agentSessionsWelcomeInput";oe.as(en.EditorFactory).registerEditorSerializer(YRn,nXt);oe.as(en.EditorPane).registerEditorPane(os.create(X_,X_.ID,d(17849,null)),[new Vt(zO)]);var Mqi=a=>{switch(a.getWorkbenchState()){case 1:return"empty";case 2:return"folder";case 3:return"workspace";default:return"empty"}},aqe=class extends k{static{this.ID="workbench.contrib.agentSessionsWelcomeEditorResolver"}constructor(i,e,t){super(),this._register(i.registerEditor(`${zO.RESOURCE.scheme}:${zO.RESOURCE.authority}/**`,{id:X_.ID,label:d(17850,null),priority:"builtin"},{singlePerResource:!0,canSupportResource:o=>o.scheme===zO.RESOURCE.scheme&&o.authority===zO.RESOURCE.authority},{createEditorInput:()=>({editor:e.createInstance(zO,{workspaceKind:Mqi(t)})})}))}};aqe=I([m(0,il),m(1,F),m(2,Ae)],aqe);W(class extends z{constructor(){super({id:X_.COMMAND_ID,title:d(17851,null),precondition:Z.enabled})}async run(i){let e=i.get(ie),t=i.get(F),o=i.get(Ae),n=t.createInstance(zO,{initiator:"command",workspaceKind:Mqi(o)});await e.openEditor(n,{pinned:!0})}});var lqe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=e;this.editorService=t;this.editorGroupsService=o;this.instantiationService=n;this.contextKeyService=r;this.storageService=s;this.workspaceContextService=l;this.chatEntitlementService=c;this.run()}static{this.ID="workbench.contrib.agentSessionsWelcomeRunner"}async run(){if(this.chatEntitlementService.sentiment.hidden||this.configurationService.getValue("workbench.startupEditor")!=="agentSessionsWelcomePage"||(await this.editorGroupsService.whenReady,M2.getValue(this.contextKeyService)))return;let t=!!this.storageService.get("chat.welcomeViewPrefill",-1);if(this.editorService.activeEditor&&!t)return;let o=this.instantiationService.createInstance(zO,{initiator:"startup",workspaceKind:Mqi(this.workspaceContextService)});await this.editorService.openEditor(o,{pinned:!1})}};lqe=I([m(0,B),m(1,ie),m(2,kt),m(3,F),m(4,X),m(5,de),m(6,Ae),m(7,dr)],lqe);bt(aqe.ID,aqe,vt.BlockStartup);bt(lqe.ID,lqe,vt.AfterRestored);var Pqi=class{constructor(){this.providers=new Map}registerProvider(i,e){this.providers.set(i,e)}getProvider(i){return this.providers.get(i)}},Aqi=new Pqi;async function Nqi(a,i){if(!i.query)throw new Error("Walkthrough: invalid resource");let e=JSON.parse(i.query);if(!e.moduleId)throw new Error("Walkthrough: invalid resource");let t=Aqi.getProvider(e.moduleId);if(!t)throw new Error(`Walkthrough: no provider registered for ${e.moduleId}`);return a.invokeFunction(t)}var MIe=class{constructor(i,e,t,o){this.textModelResolverService=i;this.languageService=e;this.modelService=t;this.instantiationService=o;this.loads=new Map;this.textModelResolverService.registerTextModelContentProvider(Q.walkThroughSnippet,this)}static{this.ID="workbench.contrib.walkThroughSnippetContentProvider"}async textBufferFactoryFromResource(i){let e=this.loads.get(i.toString());return e||(e=Nqi(this.instantiationService,i).then(t=>t4(t)).finally(()=>this.loads.delete(i.toString())),this.loads.set(i.toString(),e)),e}async provideTextContent(i){let e=await this.textBufferFactoryFromResource(i.with({fragment:""})),t=this.modelService.getModel(i);if(!t){let o=parseInt(i.fragment),n=0,r=new zl.Renderer;r.code=({text:p,lang:h})=>{n++;let g=typeof h=="string"&&this.languageService.getLanguageIdByLanguageName(h)||"",f=this.languageService.createById(g),v=this.modelService.createModel(p,f,i.with({fragment:`${n}.${h}`}));return n===o&&(t=v),""};let s=e.create(1).textBuffer,l=s.getLineCount(),c=new G(1,1,l,s.getLineLength(l)+1),u=s.getValueInRange(c,0);zl(u,{renderer:r})}return Ti(t)}};MIe=I([m(0,Bt),m(1,Rt),m(2,_t),m(3,F)],MIe);var sXt=class extends Zh{constructor(e,t){super();this.mainRef=e;this.snippetRefs=t}get main(){return this.mainRef}get snippets(){return this.snippetRefs.map(e=>e.object)}dispose(){this.snippetRefs.forEach(e=>e.dispose()),super.dispose()}},xk=class extends Ls{constructor(e,t,o){super();this.options=e;this.instantiationService=t;this.textModelResolverService=o;this.promise=null;this.maxTopScroll=0;this.maxBottomScroll=0}get capabilities(){return 8|super.capabilities}get resource(){return this.options.resource}get typeId(){return this.options.typeId}getName(){return this.options.name}getDescription(){return this.options.description||""}getTelemetryFrom(){return this.options.telemetryFrom}getTelemetryDescriptor(){let e=super.getTelemetryDescriptor();return e.target=this.getTelemetryFrom(),e}get onReady(){return this.options.onReady}get layout(){return this.options.layout}resolve(){return this.promise||(this.promise=Nqi(this.instantiationService,this.options.resource).then(e=>{if(this.resource.path.endsWith(".html"))return new sXt(e,[]);let t=[],o=0,n=new zl.Renderer;return n.code=({lang:s})=>{o++;let l=this.options.resource.with({scheme:Q.walkThroughSnippet,fragment:`${o}.${s}`});return t.push(this.textModelResolverService.createModelReference(l)),`<div id="snippet-${l.fragment}" class="walkThroughEditorContainer" ></div>`},e=new s4({renderer:n},L3t()).parse(e,{async:!1}),Promise.all(t).then(s=>new sXt(e,s))})),this.promise}matches(e){return super.matches(e)?!0:e instanceof xk?ze(e.options.resource,this.options.resource):!1}dispose(){this.promise&&(this.promise.then(e=>e.dispose()),this.promise=null),super.dispose()}relativeScrollPosition(e,t){this.maxTopScroll=Math.max(this.maxTopScroll,e),this.maxBottomScroll=Math.max(this.maxBottomScroll,t)}};xk=I([m(1,F),m(2,Bt)],xk);var SyS=te("walkThrough.embeddedEditorBackground",{dark:new Ue(new Ut(0,0,0,.4)),light:"#f4f4f4",hcDark:null,hcLight:null},d(18222,null));var cqe=new Y("interactivePlaygroundFocus",!1),xVo=d(18221,null),XRn="walkThroughEditorViewState",gL=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(gL.ID,e,t,o,c);this.instantiationService=r;this.openerService=s;this.keybindingService=l;this.contextKeyService=u;this.configurationService=p;this.notificationService=h;this.extensionService=g;this.disposables=new O;this.contentDisposables=[];this.editorFocus=cqe.bindTo(this.contextKeyService),this.editorMemento=this.getEditorMemento(f,n,XRn)}static{this.ID="workbench.editor.walkThroughPart"}createEditor(e){this.content=document.createElement("div"),this.content.classList.add("welcomePageFocusElement"),this.content.tabIndex=0,this.content.style.outlineStyle="none",this.scrollbar=new Ar(this.content,{horizontal:1,vertical:1}),this.disposables.add(this.scrollbar),e.appendChild(this.scrollbar.getDomNode()),this.registerFocusHandlers(),this.registerClickHandler(),this.disposables.add(this.scrollbar.onScroll(t=>this.updatedScrollPosition()))}updatedScrollPosition(){let e=this.scrollbar.getScrollDimensions(),t=this.scrollbar.getScrollPosition(),o=e.scrollHeight;if(o&&this.input instanceof xk){let n=t.scrollTop,r=e.height;this.input.relativeScrollPosition(n/o,(n+r)/o)}}onTouchChange(e){e.preventDefault(),e.stopPropagation();let t=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:t.scrollTop-e.translationY})}addEventListener(e,t,o,n){return e.addEventListener(t,o,n),ee(()=>{e.removeEventListener(t,o,n)})}registerFocusHandlers(){this.disposables.add(this.addEventListener(this.content,"mousedown",e=>{this.focus()})),this.disposables.add(this.addEventListener(this.content,"focus",e=>{this.editorFocus.set(!0)})),this.disposables.add(this.addEventListener(this.content,"blur",e=>{this.editorFocus.reset()})),this.disposables.add(this.addEventListener(this.content,"focusin",e=>{if(go(e.target)&&e.target.classList.contains("zone-widget-container")){let t=this.scrollbar.getScrollPosition();this.content.scrollTop=t.scrollTop,this.content.scrollLeft=t.scrollLeft}go(e.target)&&(this.lastFocus=e.target)}))}registerClickHandler(){this.disposables.add(this.addEventListener(this.content,"click",e=>{for(let t=e.target;t;t=t.parentNode)if(L4e(t)&&t.href){let o=t.ownerDocument.getElementsByTagName("base")[0]||this.window.location;if(o&&t.href.indexOf(o.href)>=0&&t.hash){let n=this.content.querySelector(t.hash),r=this.content.firstElementChild;if(n&&r){let s=n.getBoundingClientRect().top-20,l=r.getBoundingClientRect().top;this.scrollbar.setScrollPosition({scrollTop:s-l})}}else this.open(A.parse(t.href));e.preventDefault();break}else if(pQi(t)){let o=t.getAttribute("data-href");o&&this.open(A.parse(o));break}else if(t===e.currentTarget)break}))}open(e){if(e.scheme==="command"&&e.path==="git.clone"&&!Ge.getCommand("git.clone")){this.notificationService.info(d(18220,null));return}this.openerService.open(this.addFrom(e),{allowCommands:!0})}addFrom(e){if(e.scheme!=="command"||!(this.input instanceof xk))return e;let t=e.query?JSON.parse(e.query):{};return t.from=this.input.getTelemetryFrom(),e.with({query:JSON.stringify(t)})}layout(e){this.size=e,PL(this.content,e.width,e.height),this.updateSizeClasses(),this.contentDisposables.forEach(o=>{o instanceof us&&o.layout()});let t=this.input instanceof xk&&this.input;t&&t.layout&&t.layout(e),this.scrollbar.scanDomNode()}updateSizeClasses(){let e=this.content.firstElementChild;this.size&&e&&e.classList.toggle("max-height-685px",this.size.height<=685)}focus(){super.focus();let e=this.content.ownerDocument.activeElement;for(;e&&e!==this.content;)e=e.parentElement;e||(this.lastFocus||this.content).focus(),this.editorFocus.set(!0)}arrowUp(){let e=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:e.scrollTop-this.getArrowScrollHeight()})}arrowDown(){let e=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:e.scrollTop+this.getArrowScrollHeight()})}getArrowScrollHeight(){let e=this.configurationService.getValue("editor.fontSize");return(typeof e!="number"||e<1)&&(e=12),3*e}pageUp(){let e=this.scrollbar.getScrollDimensions(),t=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:t.scrollTop-e.height})}pageDown(){let e=this.scrollbar.getScrollDimensions(),t=this.scrollbar.getScrollPosition();this.scrollbar.setScrollPosition({scrollTop:t.scrollTop+e.height})}setInput(e,t,o,n){let r=new O;return this.contentDisposables.push(r),this.content.innerText="",super.setInput(e,t,o,n).then(async()=>(e.resource.path.endsWith(".md")&&await this.extensionService.whenInstalledExtensionsRegistered(),e.resolve())).then(s=>{if(n.isCancellationRequested)return;let l=s.main;if(!e.resource.path.endsWith(".md")){this.safeSetInnerHtml(this.content,l),this.updateSizeClasses(),this.decorateContent(),this.contentDisposables.push(this.keybindingService.onDidUpdateKeybindings(()=>this.decorateContent())),e.onReady?.(this.content.firstElementChild,r),this.scrollbar.scanDomNode(),this.loadTextEditorViewState(e),this.updatedScrollPosition();return}let c=document.createElement("div");c.classList.add("walkThroughContent");let u=this.expandMacros(l);this.safeSetInnerHtml(c,u),this.content.appendChild(c),s.snippets.forEach((p,h)=>{let g=p.textEditorModel;if(!g)return;let f=`snippet-${g.uri.fragment}`,v=c.querySelector(`#${f.replace(/[\\.]/g,"\\$&")}`),b=this.getEditorOptions(g.getLanguageId()),S={target:this.input instanceof xk?this.input.getTelemetryFrom():void 0,snippet:h},y=this.instantiationService.createInstance(us,v,b,{telemetryData:S});y.setModel(g),this.contentDisposables.push(y);let w=x=>{let E=y.getPosition(),M=E?y.getLineHeightForPosition(E):y.getOption(75),N=`${Math.max(g.getLineCount()+1,4)*M}px`;v.style.height!==N&&(v.style.height=N,y.layout(),x||this.scrollbar.scanDomNode())};w(!0),this.contentDisposables.push(y.onDidChangeModelContent(()=>w(!1))),this.contentDisposables.push(y.onDidChangeCursorPosition(x=>{let E=this.content.firstElementChild;if(E){let M=v.getBoundingClientRect().top,N=E.getBoundingClientRect().top,V=y.getLineHeightForPosition(x.position),H=M+(x.position.lineNumber-1)*V-N,K=H+V,j=this.scrollbar.getScrollDimensions(),se=this.scrollbar.getScrollPosition().scrollTop,ae=j.height;se>H?this.scrollbar.setScrollPosition({scrollTop:H}):se<K-ae&&this.scrollbar.setScrollPosition({scrollTop:K-ae})}})),this.contentDisposables.push(this.configurationService.onDidChangeConfiguration(x=>{x.affectsConfiguration("editor")&&p.textEditorModel&&y.updateOptions(this.getEditorOptions(p.textEditorModel.getLanguageId()))}))}),this.updateSizeClasses(),this.multiCursorModifier(),this.contentDisposables.push(this.configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("editor.multiCursorModifier")&&this.multiCursorModifier()})),e.onReady?.(c,r),this.scrollbar.scanDomNode(),this.loadTextEditorViewState(e),this.updatedScrollPosition(),this.contentDisposables.push(ds.addTarget(c)),this.contentDisposables.push($(c,Vn.Change,p=>this.onTouchChange(p)))})}safeSetInnerHtml(e,t){AA(e,t,{allowedAttributes:{augment:["id","class","style","data-command","data-href"]}})}getEditorOptions(e){let t=io(this.configurationService.getValue("editor",{overrideIdentifier:e}));return{...Di(t)?t:Object.create(null),scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:3,fixedOverflowWidgets:!1,lineNumbersMinChars:1,minimap:{enabled:!1}}}expandMacros(e){return e.replace(/kb\(([a-z.\d\-]+)\)/gi,(t,o)=>{let n=this.keybindingService.lookupKeybinding(o),r=n?n.getLabel()||"":xVo;return`<span class="shortcut">${Cr(r)}</span>`})}decorateContent(){let e=this.content.querySelectorAll(".shortcut[data-command]");Array.prototype.forEach.call(e,o=>{let n=o.getAttribute("data-command"),r=n&&this.keybindingService.lookupKeybinding(n),s=r?r.getLabel()||"":xVo;for(;o.firstChild;)o.firstChild.remove();o.appendChild(document.createTextNode(s))});let t=this.content.querySelectorAll(".if_shortcut[data-command]");Array.prototype.forEach.call(t,o=>{let n=o.getAttribute("data-command"),r=n&&this.keybindingService.lookupKeybinding(n);o.style.display=r?"":"none"})}multiCursorModifier(){let e=nM.modifierLabels[Ao],t=this.configurationService.getValue("editor.multiCursorModifier"),o=e[t==="ctrlCmd"?Ao===2?"metaKey":"ctrlKey":"altKey"],n=this.content.querySelectorAll(".multi-cursor-modifier");Array.prototype.forEach.call(n,r=>{for(;r.firstChild;)r.firstChild.remove();r.appendChild(document.createTextNode(o))})}saveTextEditorViewState(e){let t=this.scrollbar.getScrollPosition();this.editorMemento.saveEditorState(this.group,e,{viewState:{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}})}loadTextEditorViewState(e){let t=this.editorMemento.loadEditorState(this.group,e);t&&this.scrollbar.setScrollPosition(t.viewState)}clearInput(){this.input instanceof xk&&this.saveTextEditorViewState(this.input),this.contentDisposables=je(this.contentDisposables),super.clearInput()}saveState(){this.input instanceof xk&&this.saveTextEditorViewState(this.input),super.saveState()}dispose(){this.editorFocus.reset(),this.contentDisposables=je(this.contentDisposables),this.disposables.dispose(),super.dispose()}};gL=I([m(1,_e),m(2,Pe),m(3,Gn),m(4,F),m(5,Je),m(6,Le),m(7,de),m(8,X),m(9,B),m(10,Ne),m(11,lt),m(12,kt)],gL);var kVo={id:"workbench.action.interactivePlayground.arrowUp",weight:200,when:C.and(cqe,me.editorTextFocus.toNegated()),primary:16,handler:a=>{let e=a.get(ie).activeEditorPane;e instanceof gL&&e.arrowUp()}},EVo={id:"workbench.action.interactivePlayground.arrowDown",weight:200,when:C.and(cqe,me.editorTextFocus.toNegated()),primary:18,handler:a=>{let e=a.get(ie).activeEditorPane;e instanceof gL&&e.arrowDown()}},TVo={id:"workbench.action.interactivePlayground.pageUp",weight:200,when:C.and(cqe,me.editorTextFocus.toNegated()),primary:11,handler:a=>{let e=a.get(ie).activeEditorPane;e instanceof gL&&e.pageUp()}},_Vo={id:"workbench.action.interactivePlayground.pageDown",weight:200,when:C.and(cqe,me.editorTextFocus.toNegated()),primary:12,handler:a=>{let e=a.get(ie).activeEditorPane;e instanceof gL&&e.pageDown()}};function Oqi(a){let i=Ft&&!a.get(Mt).remoteAuthority;return`
## Interactive Editor Playground
The core editor in VS Code is packed with features.  This page highlights a number of them and lets you interactively try them out through the use of a number of embedded editors.  For full details on the editor features for VS Code and more head over to our [documentation](https://code.visualstudio.com/docs).

* [Multi-cursor Editing](#multi-cursor-editing) - block selection, select all occurrences, add additional cursors and more.
* [IntelliSense](#intellisense) - get code assistance and parameter suggestions for your code and external modules.
* [Line Actions](#line-actions) - quickly move lines around to re-order your code.${i?"":`
* [Rename Refactoring](#rename-refactoring) - quickly rename symbols across your code base.`}
* [Formatting](#formatting) - keep your code looking great with inbuilt document & selection formatting.
* [Code Folding](#code-folding) - focus on the most relevant parts of your code by folding other areas.
* [Errors and Warnings](#errors-and-warnings) - see errors and warnings as you type.
* [Snippets](#snippets) - spend less time typing with snippets.
* [Emmet](#emmet) - integrated Emmet support takes HTML and CSS editing to the next level.
* [JavaScript Type Checking](#javascript-type-checking) - perform type checking on your JavaScript file using TypeScript with zero configuration.



### Multi-Cursor Editing
Using multiple cursors allows you to edit multiple parts of the document at once, greatly improving your productivity.  Try the following actions in the code block below:
1. Box Selection - press <span class="mac-only windows-only">any combination of kb(cursorColumnSelectDown), kb(cursorColumnSelectRight), kb(cursorColumnSelectUp), kb(cursorColumnSelectLeft) to select a block of text. You can also press</span> <span class="shortcut mac-only">|\u21E7\u2325|</span><span class="shortcut windows-only linux-only">|Shift+Alt|</span> while selecting text with the mouse or drag-select using the middle mouse button.
2. Add a cursor - press kb(editor.action.insertCursorAbove) to add a new cursor above, or kb(editor.action.insertCursorBelow) to add a new cursor below. You can also use your mouse with <span class="shortcut"><span class="multi-cursor-modifier"></span>+Click</span> to add a cursor anywhere.
3. Create cursors on all occurrences of a string - select one instance of a string e.g. |background-color| and press kb(editor.action.selectHighlights).  Now you can replace all instances by simply typing.

That is the tip of the iceberg for multi-cursor editing. Have a look at the selection menu and our handy [keyboard reference guide](command:workbench.action.keybindingsReference) for additional actions.

|||css
#p1 {background-color: #ff0000;}                /* red in HEX format */
#p2 {background-color: hsl(120, 100%, 50%);}    /* green in HSL format */
#p3 {background-color: rgba(0, 4, 255, 0.733);} /* blue with alpha channel in RGBA format */
|||

> **CSS Tip:** You may have noticed in the example above we also provide color swatches inline for CSS, additionally if you hover over an element such as |#p1| we will show how this is represented in HTML.  These swatches also act as color pickers that allow you to easily change a color value.  A simple example of some language-specific editor features.

### IntelliSense

Visual Studio Code comes with the powerful IntelliSense for JavaScript and TypeScript pre-installed. In the below example, position the text cursor right after the dot and press kb(editor.action.triggerSuggest) to invoke IntelliSense.  Notice how the suggestions come from the Canvas API.

|||js
const canvas = document.querySelector('canvas');
const context = canvas.getContext('2d');

context.strokeStyle = 'blue';
context.
|||

>**Tip:** While we ship JavaScript and TypeScript support out of the box other languages can be upgraded with better IntelliSense through one of the many [extensions](command:workbench.extensions.action.showPopularExtensions).


### Line Actions
Since it's very common to work with the entire text in a line we provide a set of useful shortcuts to help with this.
1. <span class="mac-only windows-only">Copy a line and insert it above or below the current position with kb(editor.action.copyLinesDownAction) or kb(editor.action.copyLinesUpAction) respectively.</span><span class="linux-only">Copy the entire current line when no text is selected with kb(editor.action.clipboardCopyAction).</span>
2. Move an entire line or selection of lines up or down with kb(editor.action.moveLinesUpAction) and kb(editor.action.moveLinesDownAction) respectively.
3. Delete the entire line with kb(editor.action.deleteLines).

|||json
{
	"name": "John",
	"age": 31,
	"city": "New York"
}
|||

>**Tip:** Another very common task is to comment out a block of code - you can toggle commenting by pressing kb(editor.action.commentLine).


${i?"":`
### Rename Refactoring
It's easy to rename a symbol such as a function name or variable name.  Hit kb(editor.action.rename) while in the symbol |Book| to rename all instances - this will occur across all files in a project. You also have |Rename Symbol| in the right-click context menu.

|||js
// Reference the function
new Book("War of the Worlds", "H G Wells");
new Book("The Martian", "Andy Weir");

/**
 * Represents a book.
 *
 * @param {string} title Title of the book
 * @param {string} author Who wrote the book
 */
function Book(title, author) {
	this.title = title;
	this.author = author;
}
|||

> **JSDoc Tip:** VS Code's IntelliSense uses JSDoc comments to provide richer suggestions. The types and documentation from JSDoc comments show up when you hover over a reference to |Book| or in IntelliSense when you create a new instance of |Book|.

`}
### Formatting
Keeping your code looking great is hard without a good formatter.  Luckily it's easy to format content, either for the entire document with kb(editor.action.formatDocument) or for the current selection with kb(editor.action.formatSelection).  Both of these options are also available through the right-click context menu.

|||js
const cars = ["\u{1F697}", "\u{1F699}", "\u{1F695}"];

for (const car of cars){
	// Drive the car
	console.log(|This is the car \${car}|);
}
|||

>**Tip:** Additional formatters are available in the [extension gallery](command:workbench.extensions.action.showPopularExtensions).  Formatting support can also be configured via [settings](command:workbench.action.openGlobalSettings) e.g. enabling |editor.formatOnSave|.


### Code Folding
In a large file it can often be useful to collapse sections of code to increase readability.  To do this, you can simply press kb(editor.fold) to fold or press kb(editor.unfold) to unfold the ranges at the current cursor position.  Folding can also be done with the down and right angle bracket icons in the left gutter.  To fold all sections use kb(editor.foldAll) or to unfold all use kb(editor.unfoldAll).

|||html
<div>
	<header>
		<ul>
			<li><a href=""></a></li>
			<li><a href=""></a></li>
		</ul>
	</header>
	<footer>
		<p></p>
	</footer>
</div>
|||

>**Tip:** Folding is based on indentation and as a result can apply to all languages.  Simply indent your code to create a foldable section you can fold a certain number of levels with shortcuts like kb(editor.foldLevel1) through to kb(editor.foldLevel5).

### Errors and Warnings
Errors and warnings are highlighted as you edit your code with squiggles.  In the sample below you can see a number of syntax errors.  By pressing kb(editor.action.marker.nextInFiles) you can navigate across them in sequence and see the detailed error message.  As you correct them the squiggles and scrollbar indicators will update.

|||js
// This code has a few syntax errors
Console.log(add(1, 1.5));


function Add(a, b)
	return a + b;
}
|||


###  Snippets
You can greatly accelerate your editing through the use of snippets.  Simply start typing |try| and select |trycatch| from the suggestion list and press kb(insertSnippet) to create a |try|->|catch| block.  Your cursor will be placed on the text |error| for easy editing.  If more than one parameter exists then press kb(jumpToNextSnippetPlaceholder) to jump to it.

|||js

|||

>**Tip:** The [extension gallery](command:workbench.extensions.action.showPopularExtensions) includes snippets for almost every framework and language imaginable.  You can also create your own [user-defined snippets](command:workbench.action.openSnippets).


### Emmet
Emmet takes the snippets idea to a whole new level: you can type CSS-like expressions that can be dynamically parsed, and produce output depending on what you type in the abbreviation. Try it by selecting |Emmet: Expand Abbreviation| from the |Edit| menu with the cursor at the end of a valid Emmet abbreviation or snippet and the expansion will occur.

|||html
ul>li.item$*5
|||

>**Tip:** The [Emmet cheat sheet](https://docs.emmet.io/cheat-sheet/) is a great source of Emmet syntax suggestions. To expand Emmet abbreviations and snippets using the |tab| key use the |emmet.triggerExpansionOnTab| [setting](command:workbench.action.openGlobalSettings). Check out the docs on [Emmet in VS Code](https://code.visualstudio.com/docs/editor/emmet) to learn more.



### JavaScript Type Checking
Sometimes type checking your JavaScript code can help you spot mistakes you might have not caught otherwise. You can run the TypeScript type checker against your existing JavaScript code by simply adding a |// @ts-check| comment to the top of your file.

|||js
// @ts-nocheck

let easy = true;
easy = 42;
|||

>**Tip:** You can also enable the checks workspace or application wide by adding |"js/ts.implicitProjectConfig.checkJs": true| to your workspace or user settings and explicitly ignoring files or lines using |// @ts-nocheck| and |// @ts-expect-error|. Check out the docs on [JavaScript in VS Code](https://code.visualstudio.com/docs/languages/javascript) to learn more.


## Thanks!
Well if you have got this far then you will have touched on some of the editing features in Visual Studio Code.  But don't stop now :)  We have lots of additional [documentation](https://code.visualstudio.com/docs), [introductory videos](https://code.visualstudio.com/docs/getstarted/introvideos) and [tips and tricks](https://go.microsoft.com/fwlink/?linkid=852118) for the product that will help you learn how to use it.  And while you are here, here are a few additional things you can try:
- Open the Integrated Terminal by pressing kb(workbench.action.terminal.toggleTerminal), then see what's possible by [reviewing the terminal documentation](https://code.visualstudio.com/docs/editor/integrated-terminal)
- Work with version control by pressing kb(workbench.view.scm). Understand how to stage, commit, change branches, and view diffs and more by reviewing the [version control documentation](https://code.visualstudio.com/docs/editor/versioncontrol)
- Browse thousands of extensions in our integrated gallery by pressing kb(workbench.view.extensions). The [documentation](https://code.visualstudio.com/docs/editor/extension-gallery) will show you how to see the most popular extensions, disable installed ones and more.

That's all for now,

Happy Coding! \u{1F389}

`.replace(/\|/g,"`")}Aqi.registerProvider("vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough",Oqi);var DVo="workbench.editors.walkThroughInput",RVo={typeId:DVo,name:d(18216,null),resource:In.asBrowserUri("vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough.md").with({scheme:Q.walkThrough,query:JSON.stringify({moduleId:"vs/workbench/contrib/welcomeWalkthrough/browser/editor/vs_code_editor_walkthrough"})}),telemetryFrom:"walkThrough"},aXt=class a extends z{static{this.ID="workbench.action.showInteractivePlayground"}static{this.LABEL=P(18215,"Interactive Editor Playground")}constructor(){super({id:a.ID,title:a.LABEL,category:Fe.Help,f1:!0,metadata:{description:P(18217,"Opens an interactive playground for learning about the editor.")}})}run(i){let e=i.get(ie),o=i.get(F).createInstance(xk,RVo);return e.openEditor(o,{pinned:!0}).then(()=>{})}},Rmt=class{static{this.ID=DVo}canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(xk,RVo)}};oe.as(en.EditorPane).registerEditorPane(os.create(gL,gL.ID,d(18219,null)),[new Vt(xk)]);W(aXt);oe.as(en.EditorFactory).registerEditorSerializer(Rmt.ID,Rmt);bt(MIe.ID,MIe,{editorTypeId:gL.ID});xt.registerCommandAndKeybindingRule(kVo);xt.registerCommandAndKeybindingRule(EVo);xt.registerCommandAndKeybindingRule(TVo);xt.registerCommandAndKeybindingRule(_Vo);be.appendMenuItem(R.MenubarHelpMenu,{group:"1_welcome",command:{id:"workbench.action.showInteractivePlayground",title:d(18218,null)},order:3});var Fqi={explorer:"workbench.explorer.emptyView",debug:"workbench.debug.welcome",scm:"workbench.scm",testing:"workbench.view.testing"},JRn=Object.freeze({type:"array",description:d(18208,null),items:{type:"object",description:d(18209,null),required:["view","contents"],properties:{view:{anyOf:[{type:"string",description:d(18213,null)},{type:"string",description:d(18213,null),enum:Object.keys(Fqi)}]},contents:{type:"string",description:d(18210,null)},when:{type:"string",description:d(18214,null)},group:{type:"string",description:d(18212,null)},enablement:{type:"string",description:d(18211,null)}}}}),LVo={extensionPoint:"viewsWelcome",jsonSchema:JRn};var ZRn=oe.as(Kn.ViewsRegistry),lXt=class extends k{constructor(e){super();this.viewWelcomeContents=new Map;e.setHandler((t,{added:o,removed:n})=>{for(let s of n)for(let l of s.value)this.viewWelcomeContents.get(l)?.dispose();let r=new Map;for(let s of o)for(let l of s.value){let{group:c,order:u}=eLn(l,s),p=C.deserialize(l.enablement),h=Fqi[l.view]??l.view,g=r.get(h);g||(g=new Map,r.set(h,g)),g.set(l,{content:l.contents,when:C.deserialize(l.when),precondition:p,group:c,order:u})}for(let[s,l]of r){let c=ZRn.registerViewWelcomeContent2(s,l);for(let[u,p]of c)this.viewWelcomeContents.set(u,p)}})}};function eLn(a,i){let e,t;if(a.group){if(!Va(i.description,"contribViewsWelcome"))return i.collector.warn(d(18207,null,i.description.identifier.value)),{group:e,order:t};let o=a.group.lastIndexOf("@");o>0?(e=a.group.substr(0,o),t=Number(a.group.substr(o+1))||void 0):e=a.group}return{group:e,order:t}}var tLn=zn.registerExtensionPoint(LVo),Lmt=class{constructor(i){i.createInstance(lXt,tLn)}};Lmt=I([m(0,F)],Lmt);oe.as(Zi.Workbench).registerWorkbenchContribution(Lmt,3);var cXt=d(18197,null),iLn=P(18199,"Create");W(class extends z{constructor(){super({id:"welcome.showNewFileEntries",title:P(18206,"New File..."),category:iLn,f1:!0,precondition:qo.negate(),keybinding:{primary:2860,weight:200},menu:{id:R.MenubarFileMenu,group:"1_new",order:2,when:qo.negate()}})}async run(a){return Ti(uj.Instance).run()}});var uj=class extends k{constructor(e,t,o,n,r){super();this.quickInputService=e;this.contextKeyService=t;this.commandService=o;this.keybindingService=n;uj.Instance=this,this._register({dispose(){uj.Instance===this&&(uj.Instance=void 0)}}),this.menu=r.createMenu(R.NewFile,t)}allEntries(){let e=[];for(let[t,o]of this.menu.getActions({renderShortTitle:!0}))for(let n of o)n instanceof Do&&e.push({commandID:n.item.id,from:n.item.source?.title??cXt,title:n.label,group:t});return e}async run(){let e=this.allEntries();if(e.length===0)throw Error("Unexpected empty new items list");return e.length===1?(this.commandService.executeCommand(e[0].commandID),!0):this.selectNewEntry(e)}async selectNewEntry(e){let{promise:t,resolve:o}=Ey(),n=new O,r=this.quickInputService.createQuickPick({useSeparators:!0});r.title=d(18204,null),r.placeholder=d(18203,null),r.sortByLabel=!1,r.matchOnDetail=!0,r.matchOnDescription=!0;let s=(u,p)=>{let h={file:1,notebook:2};if(h[u.group]&&h[p.group]){if(h[u.group]!==h[p.group])return h[p.group]-h[u.group]}else{if(h[u.group])return 1;if(h[p.group])return-1}return u.from===cXt?1:p.from===cXt?-1:u.from.localeCompare(p.from)},l={file:d(18200,null),notebook:d(18205,null)},c=u=>{let p=[],h;u.sort((g,f)=>-s(g,f)).forEach(g=>{let f=g.commandID,v=this.keybindingService.lookupKeybinding(f||"",this.contextKeyService);h!==g.group&&(p.push({type:"separator",label:l[g.group]??g.group}),h=g.group),p.push({...g,label:g.title,type:"item",keybinding:v,buttons:f?[{iconClass:"codicon codicon-gear",tooltip:d(18198,null)}]:[],detail:"",description:g.from})}),r.items=p};return c(e),n.add(this.menu.onDidChange(()=>c(this.allEntries()))),n.add(r.onDidChangeValue(u=>{if(u===""){c(e);return}let p={commandID:"workbench.action.files.newFile",commandArgs:{languageId:void 0,viewType:void 0,fileName:u},title:d(18202,null,u),group:"file",from:cXt};c([p,...e])})),n.add(r.onDidAccept(async u=>{let p=r.selectedItems[0];o(!!p),r.hide(),p&&await this.commandService.executeCommand(p.commandID,p.commandArgs)})),n.add(r.onDidHide(()=>{r.dispose(),n.dispose(),o(!1)})),n.add(r.onDidTriggerItemButton(u=>{r.hide(),this.commandService.executeCommand("workbench.action.openGlobalKeybindings",u.item.commandID),o(!1)})),r.show(),t}};uj=I([m(0,$e),m(1,X),m(2,fe),m(3,Le),m(4,Yt)],uj);oe.as(Zi.Workbench).registerWorkbenchContribution(uj,3);be.appendMenuItem(R.NewFile,{group:"file",command:{id:"workbench.action.files.newUntitledFile",title:d(18201,null)},order:1});Z5e($i.defaultChatAgent,"Onboarding requires a default chat agent product configuration.");var iB=$i.defaultChatAgent,dqe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.layoutService=e;this.themeService=t;this.defaultAccountService=o;this.extensionGalleryService=n;this.extensionManagementService=r;this.configurationService=s;this.notificationService=l;this.quickInputService=c;this.fileService=u;this.pathService=p;this.telemetryService=h;this.commandService=g;this.accessibilityService=f;this._onDidComplete=this._register(new T);this.onDidComplete=this._onDidComplete.event;this._onDidDismiss=this._register(new T);this.onDidDismiss=this._onDidDismiss.event;this.currentStepIndex=0;this.steps=vVo;this.disposables=this._register(new O);this.stepDisposables=this._register(new O);this._isShowing=!1;this.footerFocusableElements=[];this.stepFocusableElements=[];this.selectedThemeId="dark-2026";this.selectedKeymapId="vscode";this._userSignedIn=!1;this.selectedAiMode="balanced";let v=this.themeService.getColorTheme(),S=($i.onboardingThemes??[]).find(y=>y.themeId===v.settingsId);S&&(this.selectedThemeId=S.id),this._detectInstalledEditors().then(y=>{this._detectedEditorIds=y})}get isShowing(){return this._isShowing}show(){if(this.overlay)return;this._isShowing=!0,this.previouslyFocusedElement=zi().document.activeElement;let e=this.layoutService.activeContainer;this.overlay=D(e,_(".onboarding-a-overlay")),this.overlay.setAttribute("role","dialog"),this.overlay.setAttribute("aria-modal","true"),this.overlay.setAttribute("aria-label",d(18120,null)),this.card=D(this.overlay,_(".onboarding-a-card")),this.closeButton=D(this.card,_("button.onboarding-a-close-btn")),this.closeButton.type="button",this.closeButton.setAttribute("aria-label",d(18125,null)),this.closeButton.appendChild(un(L.close));let t=D(this.card,_(".onboarding-a-header"));this.progressContainer=D(t,_(".onboarding-a-progress")),this.stepLabelEl=D(this.progressContainer,_("span.onboarding-a-step-label")),this._renderProgress(),this.bodyEl=D(this.card,_(".onboarding-a-body")),this.titleEl=D(this.bodyEl,_("h2.onboarding-a-step-title")),this.subtitleEl=D(this.bodyEl,_("p.onboarding-a-step-subtitle")),this.contentEl=D(this.bodyEl,_(".onboarding-a-step-content")),this._renderStep(),this._logStepView();let o=D(this.card,_(".onboarding-a-footer"));this.footerLeft=D(o,_(".onboarding-a-footer-left"));let n=D(o,_(".onboarding-a-footer-right"));this.backButton=D(n,_("button.onboarding-a-btn.onboarding-a-btn-secondary")),this.backButton.textContent=d(18124,null),this.backButton.type="button",this.footerFocusableElements.push(this.backButton),this.nextButton=D(n,_("button.onboarding-a-btn.onboarding-a-btn-primary")),this.nextButton.type="button",this.footerFocusableElements.push(this.nextButton),this._updateButtonStates(),this.disposables.add($(this.closeButton,ne.CLICK,()=>{this._logAction("skip"),this._dismiss("skip")})),this.disposables.add($(this.backButton,ne.CLICK,()=>{this._logAction("back"),this._prevStep()})),this.disposables.add($(this.nextButton,ne.CLICK,()=>{this._isLastStep()?(this._logAction("complete"),this._dismiss("complete")):this.currentStepIndex===0?(this._logAction("continueWithoutSignIn"),this._nextStep()):(this._logAction("next"),this._nextStep())})),this.disposables.add($(this.overlay,ne.MOUSE_DOWN,r=>{r.target===this.overlay&&this._dismiss("skip")})),this.disposables.add($(this.overlay,ne.KEY_DOWN,r=>{let s=new mi(r);if(r.stopPropagation(),s.keyCode===9){r.preventDefault(),this._dismiss("skip");return}s.keyCode===2&&this._trapTab(r,s.shiftKey)})),this.overlay.classList.add("entering"),zi().requestAnimationFrame(()=>{this.overlay?.classList.remove("entering"),this.overlay?.classList.add("visible")}),this._focusCurrentStepElement()}_dismiss(e){if(!this.overlay)return;this._logAction("dismiss",void 0,e),this.overlay.classList.remove("visible"),this.overlay.classList.add("exiting");let t=!1,o=()=>{t||(t=!0,this._removeFromDOM(),e==="complete"&&this._onDidComplete.fire(),this._onDidDismiss.fire())};this.overlay.addEventListener("transitionend",o,{once:!0}),setTimeout(o,400)}_nextStep(){this.currentStepIndex<this.steps.length-1&&(this.steps[this.currentStepIndex]==="onboarding.personalize"&&this._applyKeymap(this.selectedKeymapId),this.currentStepIndex++,this._renderStep(),this._renderProgress(),this._updateButtonStates(),this._focusCurrentStepElement(),this._logStepView())}_prevStep(){this.currentStepIndex>0&&(this.currentStepIndex--,this._renderStep(),this._renderProgress(),this._updateButtonStates(),this._focusCurrentStepElement(),this._logStepView())}_isLastStep(){return this.currentStepIndex===this.steps.length-1}_renderProgress(){if(!(!this.progressContainer||!this.stepLabelEl)){St(this.progressContainer);for(let e=0;e<this.steps.length;e++){let t=D(this.progressContainer,_("span.onboarding-a-progress-dot"));e===this.currentStepIndex?t.classList.add("active"):e<this.currentStepIndex&&t.classList.add("completed")}this.progressContainer.appendChild(this.stepLabelEl),this.stepLabelEl.textContent=d(18180,null,this.currentStepIndex+1,this.steps.length)}}_renderStep(){if(!this.titleEl||!this.subtitleEl||!this.contentEl)return;this.stepDisposables.clear(),this.stepFocusableElements.length=0;let e=this.steps[this.currentStepIndex],t=e==="onboarding.signIn";switch(this.titleEl.style.display=t?"none":"",this.subtitleEl.style.display=t?"none":"",this.titleEl.textContent=Eqi(e),e==="onboarding.agentSessions"?this._renderAgentSessionsSubtitle(this.subtitleEl):e==="onboarding.personalize"?this._renderPersonalizeSubtitle(this.subtitleEl):this.subtitleEl.textContent=fVo(e),St(this.contentEl),e){case"onboarding.signIn":this._renderSignInStep(this.contentEl);break;case"onboarding.personalize":this._renderPersonalizeStep(this.contentEl);break;case"onboarding.aiPreference":this._renderAiPreferenceStep(this.contentEl);break;case"onboarding.agentSessions":this._renderAgentSessionsStep(this.contentEl);break}this.bodyEl?.setAttribute("aria-label",d(18179,null,this.currentStepIndex+1,this.steps.length,Eqi(e)))}_updateButtonStates(){this.backButton&&(this.backButton.style.display=this.currentStepIndex===0?"none":""),this.nextButton&&(this.currentStepIndex===0?(this.nextButton.className="onboarding-a-btn onboarding-a-btn-secondary",this.nextButton.textContent=d(18126,null)):this._isLastStep()?(this.nextButton.className="onboarding-a-btn onboarding-a-btn-primary",this.nextButton.textContent=d(18127,null)):(this.nextButton.className="onboarding-a-btn onboarding-a-btn-primary",this.nextButton.textContent=d(18130,null))),this.footerLeft&&(this._isLastStep()?!this._footerSignInBtn&&!this._userSignedIn&&(this._footerSignInBtn=D(this.footerLeft,_("button.onboarding-a-signin-nudge-btn")),this._footerSignInBtn.type="button",this._footerSignInBtn.textContent=d(18153,null),this.stepDisposables.add($(this._footerSignInBtn,ne.CLICK,async()=>{this._logAction("signInNudge"),await this._handleSignIn(),this._userSignedIn&&this._footerSignInBtn&&(this._footerSignInBtn.style.display="none")}))):this._footerSignInBtn&&(this._footerSignInBtn.remove(),this._footerSignInBtn=void 0))}_renderSignInStep(e){let t=D(e,_(".onboarding-a-signin")),o=D(t,_(".onboarding-a-signin-brand")),n=D(o,_("span.onboarding-a-signin-brand-icon"));n.setAttribute("role","img"),n.setAttribute("aria-label",$i.nameLong);let r=D(t,_(".onboarding-a-signin-content")),s=D(r,_(".onboarding-a-signin-content-main")),l=D(s,_("h2.onboarding-a-signin-title"));l.textContent=d(18177,null);let c=D(s,_("p.onboarding-a-signin-subtitle"));c.textContent=d(18176,null);let u=D(s,_(".onboarding-a-signin-actions")),p=this._registerStepFocusable(this._createSignInButton(u,"github",d(18173,null),{emphasized:!0,label:d(18174,null)}));this.stepDisposables.add($(p,ne.CLICK,()=>{this._logAction("signIn",void 0,"github"),this._handleSignIn()}));let h=this._registerStepFocusable(this._createSignInButton(u,"google",d(18175,null),{iconOnly:!0,label:d(18175,null)}));this.stepDisposables.add($(h,ne.CLICK,()=>{this._logAction("signIn",void 0,"google"),this._handleSignIn("google")}));let g=this._registerStepFocusable(this._createSignInButton(u,"apple",d(18154,null),{iconOnly:!0,label:d(18154,null)}));this.stepDisposables.add($(g,ne.CLICK,()=>{this._logAction("signIn",void 0,"apple"),this._handleSignIn("apple")}));let f=this._registerStepFocusable(this._createSignInButton(u,"github-enterprise",d(18171,null),{textOnly:!0,label:d(18172,null)}));this.stepDisposables.add($(f,ne.CLICK,()=>{this._logAction("signIn",void 0,"github-enterprise"),this._handleEnterpriseSignIn()}));let v=D(t,_(".onboarding-a-signin-footer")),b=D(v,_(".onboarding-a-signin-disclaimer-col")),S=D(b,_(".onboarding-a-signin-disclaimer"));S.append(d(18158,null,iB.provider.default.name)),this._createInlineLink(S,d(18164,null),iB.termsStatementUrl),S.append(d(18157,null)),this._createInlineLink(S,d(18159,null),iB.privacyStatementUrl),S.append(d(18155,null,iB.provider.default.name)),this._createInlineLink(S,d(18160,null),iB.publicCodeMatchesUrl),S.append(d(18156,null)),S.append(" "),S.append(d(18162,null)),this._createInlineLink(S,d(18161,null),this.defaultAccountService.resolveGitHubUrl(SM.copilotSettings)),S.append(d(18163,null))}_createSignInButton(e,t,o,n){let r=n?.iconOnly||n?.textOnly,s=D(e,_(r?"button.onboarding-a-signin-icon-btn":"button.onboarding-a-signin-btn"));if(s.type="button",s.title=n?.label??o,s.setAttribute("aria-label",n?.label??o),n?.emphasized&&s.classList.add("primary"),!n?.textOnly){let l=D(s,_("span.onboarding-a-provider-mark"));l.classList.add(t),l.setAttribute("aria-hidden","true"),(t==="github"||t==="github-enterprise")&&l.appendChild(un(L.github))}if(!n?.iconOnly){let l=D(s,_("span.onboarding-a-signin-btn-label"));l.textContent=o}return s}async _handleSignIn(e){let t=e??"github",o=On.create();try{await this.defaultAccountService.signIn({extraAuthorizeParameters:{get_started_with:"copilot-vscode"},provider:e})&&(this._userSignedIn=!0,this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"installed",installDuration:o.elapsed(),signUpErrorCode:void 0,provider:t}),this.commandService.executeCommand("workbench.action.chat.triggerSetup",void 0,{disableChatViewReveal:!0,setupStrategy:1}),this._nextStep())}catch(n){if(Yi(n)){this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"cancelled",installDuration:o.elapsed(),signUpErrorCode:void 0,provider:t});return}this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedNotSignedIn",installDuration:o.elapsed(),signUpErrorCode:void 0,provider:t}),this.notificationService.notify({severity:ft.Error,message:d(18170,null)})}}async _handleEnterpriseSignIn(){let e=On.create();try{if(!await this._ensureEnterpriseInstance())return;let o=iB.provider.enterprise.id;await this.defaultAccountService.signIn({extraAuthorizeParameters:{get_started_with:"copilot-vscode"}})&&(this._userSignedIn=!0,this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"installed",installDuration:e.elapsed(),signUpErrorCode:void 0,provider:o}),this.commandService.executeCommand("workbench.action.chat.triggerSetup",void 0,{disableChatViewReveal:!0,setupStrategy:1}),this._nextStep())}catch(t){if(Yi(t)){this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"cancelled",installDuration:e.elapsed(),signUpErrorCode:void 0,provider:iB.provider.enterprise.id});return}this.telemetryService.publicLog2("commandCenter.chatInstall",{installResult:"failedNotSignedIn",installDuration:e.elapsed(),signUpErrorCode:void 0,provider:iB.provider.enterprise.id}),this.notificationService.notify({severity:ft.Error,message:d(18165,null)})}}async _ensureEnterpriseInstance(){let e=/^[a-zA-Z\-_]+$/,t=/^(https:\/\/)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.ghe\.com\/?$/,o=this.configurationService.getValue(iB.providerUriSetting);if(typeof o=="string"&&t.test(o))return!0;let n=!1,r=await this.quickInputService.input({prompt:d(18168,null,iB.provider.enterprise.name),placeHolder:d(18167,null),ignoreFocusLost:!0,value:o,validateInput:async l=>{if(n=!1,!!l){if(e.test(l))return n=!0,{content:d(18169,null,`https://${l}.ghe.com`),severity:ft.Info};if(!t.test(l))return{content:d(18166,null,iB.provider.enterprise.name),severity:ft.Error}}}});if(!r)return!1;let s=r;return n?s=`https://${s}.ghe.com`:r.toLowerCase().startsWith("https://")||(s=`https://${r}`),await this.configurationService.updateValue(iB.providerUriSetting,s,2),!0}_renderPersonalizeStep(e){let t=D(e,_(".onboarding-a-personalize")),o=D(t,_("div.onboarding-a-section-label"));o.textContent=d(18134,null);let n=D(t,_("div.onboarding-a-theme-hint"));n.textContent=d(18135,null);let r=D(t,_(".onboarding-a-theme-grid"));r.setAttribute("role","radiogroup"),r.setAttribute("aria-label",d(18136,null));let s=this._hasOtherEditors(),l=$i.onboardingThemes??[],c=s?l.filter(h=>!h.id.startsWith("solarized")):l;s||r.classList.add("theme-grid-expanded");let u=[];for(let h of c)this._createThemeCard(r,h,u);for(let h of u)h.setAttribute("tabindex","0");let p=this._detectedEditorIds?($i.onboardingKeymaps??[]).filter(h=>this._detectedEditorIds.has(h.id)):[];if(s){let h=D(t,_("div.onboarding-a-section-label.onboarding-a-section-label-keymap"));h.textContent=d(18131,null);let g=D(t,_("div.onboarding-a-theme-hint"));g.textContent=d(18132,null);let f=D(t,_(".onboarding-a-keymap-list"));f.setAttribute("role","radiogroup"),f.setAttribute("aria-label",d(18133,null));let v=[];for(let S of p){let y=this._registerStepFocusable(D(f,_("button.onboarding-a-keymap-pill")));y.type="button",y.setAttribute("role","radio"),y.setAttribute("aria-checked",S.id===this.selectedKeymapId?"true":"false"),y.title=S.description,v.push(y);let w=D(y,_("span"));w.textContent=S.label,S.id===this.selectedKeymapId&&y.classList.add("selected"),this.stepDisposables.add($(y,ne.CLICK,()=>{this._logAction("selectKeymap",void 0,S.id),this.selectedKeymapId=S.id;for(let x of v)x.classList.remove("selected"),x.setAttribute("aria-checked","false");y.classList.add("selected"),y.setAttribute("aria-checked","true"),this.accessibilityService.alert(d(18129,null,S.label))}))}let b=p.findIndex(S=>S.id===this.selectedKeymapId);this._setupRadioGroupNavigation(v,Math.max(0,b))}}_renderPersonalizeSubtitle(e){St(e);let t=et?"Cmd":"Ctrl";e.append(d(18139,null),this._createKbd(d(18137,null,t)),"+",this._createKbd(d(18140,null)),"+",this._createKbd(d(18138,null)),d(18141,null))}_createThemeCard(e,t,o){let n=this._registerStepFocusable(D(e,_("div.onboarding-a-theme-card")));o.push(n),n.setAttribute("role","radio"),n.setAttribute("aria-checked",t.id===this.selectedThemeId?"true":"false"),n.setAttribute("aria-label",t.label),t.id===this.selectedThemeId&&n.classList.add("selected");let r=D(n,_("div.onboarding-a-theme-preview")),s=D(r,_("img.onboarding-a-theme-preview-img"));s.alt="",s.src=In.asBrowserUri(`vs/workbench/contrib/welcomeOnboarding/browser/media/theme-preview-${t.id}.svg`).toString(!0);let l=D(n,_("div.onboarding-a-theme-label"));l.textContent=t.label,this.stepDisposables.add($(n,ne.CLICK,()=>{this._logAction("selectTheme",void 0,t.id),this._selectTheme(t);for(let c of o)c.classList.remove("selected"),c.setAttribute("aria-checked","false");n.classList.add("selected"),n.setAttribute("aria-checked","true"),this.accessibilityService.alert(d(18181,null,t.label))})),this.stepDisposables.add($(n,ne.KEY_DOWN,c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),n.click())}))}async _selectTheme(e){this.selectedThemeId=e.id;let o=(await this.themeService.getColorThemes()).find(n=>n.settingsId===e.themeId);o&&this.themeService.setColorTheme(o.id,2)}async _applyKeymap(e){let t=($i.onboardingKeymaps??[]).find(o=>o.id===e);if(t?.extensionId)try{let o=await this.extensionGalleryService.getExtensions([{id:t.extensionId}],Ie.None);o.length>0&&await this.extensionManagementService.installFromGallery(o[0],{context:{[vH]:!0}})}catch{this.notificationService.notify({severity:ft.Warning,message:d(18128,null,t.label)})}}_hasOtherEditors(){return(this._detectedEditorIds?($i.onboardingKeymaps??[]).filter(t=>this._detectedEditorIds.has(t.id)):[]).some(t=>t.id!=="vscode")}async _detectInstalledEditors(){let e=new Set(["vscode"]),t=this.pathService.userHome({preferLocal:!0}),o=[];if(ii){let n=A.joinPath(t,"AppData","Local");o.push({id:"sublime",paths:[A.file("C:\\Program Files\\Sublime Text\\sublime_text.exe"),A.file("C:\\Program Files\\Sublime Text 3\\sublime_text.exe")]},{id:"intellij",paths:[A.joinPath(n,"JetBrains","Toolbox")]},{id:"vim",paths:[A.joinPath(t,"_vimrc"),A.joinPath(n,"nvim","init.vim"),A.joinPath(n,"nvim","init.lua")]},{id:"eclipse",paths:[A.file("C:\\Program Files\\Eclipse\\eclipse.exe"),A.file("C:\\Program Files\\eclipse\\eclipse.exe")]},{id:"notepadpp",paths:[A.file("C:\\Program Files\\Notepad++\\notepad++.exe"),A.file("C:\\Program Files (x86)\\Notepad++\\notepad++.exe")]})}else et?o.push({id:"sublime",paths:[A.file("/Applications/Sublime Text.app")]},{id:"intellij",paths:[A.file("/Applications/IntelliJ IDEA.app"),A.file("/Applications/IntelliJ IDEA CE.app")]},{id:"vim",paths:[A.joinPath(t,".vimrc"),A.joinPath(t,".config","nvim","init.vim"),A.joinPath(t,".config","nvim","init.lua")]},{id:"eclipse",paths:[A.file("/Applications/Eclipse.app"),A.file("/Applications/Eclipse IDE.app")]},{id:"notepadpp",paths:[A.file("/Applications/Notepad++.app")]}):Sn&&o.push({id:"sublime",paths:[A.file("/usr/bin/subl"),A.file("/opt/sublime_text/sublime_text")]},{id:"intellij",paths:[A.joinPath(t,".local","share","JetBrains","Toolbox"),A.file("/opt/idea")]},{id:"vim",paths:[A.joinPath(t,".vimrc"),A.joinPath(t,".config","nvim","init.vim"),A.joinPath(t,".config","nvim","init.lua")]},{id:"eclipse",paths:[A.file("/usr/bin/eclipse"),A.file("/opt/eclipse/eclipse"),A.joinPath(t,"eclipse","eclipse")]},{id:"notepadpp",paths:[A.file("/usr/bin/notepadqq"),A.file("/snap/notepad-plus-plus/current")]});return await Promise.all(o.map(async n=>{for(let r of n.paths)try{if(await this.fileService.exists(r)){e.add(n.id);return}}catch{}})),e}_renderAiPreferenceStep(e){let t=D(e,_(".onboarding-a-ai-pref")),o=D(t,_(".onboarding-a-ai-pref-cards"));o.setAttribute("role","radiogroup"),o.setAttribute("aria-label",d(18122,null));let n=[];for(let l of Tqi){let c=this._registerStepFocusable(D(o,_("button.onboarding-a-ai-pref-card")));c.type="button",c.dataset.id=l.id,c.setAttribute("role","radio"),c.setAttribute("aria-checked",l.id===this.selectedAiMode?"true":"false"),n.push(c),l.id===this.selectedAiMode&&c.classList.add("selected");let u=D(c,_("span.onboarding-a-ai-pref-card-icon"));u.setAttribute("aria-hidden","true");let p=L[l.icon]??L.sparkle;u.appendChild(un(p));let h=D(c,_("div.onboarding-a-ai-pref-card-title"));h.textContent=l.label;let g=D(c,_("div.onboarding-a-ai-pref-card-desc"));g.textContent=l.description,this.stepDisposables.add($(c,ne.CLICK,()=>{this._logAction("selectAiMode",void 0,l.id),this.selectedAiMode=l.id;for(let f of n)f.classList.toggle("selected",f.dataset.id===l.id),f.setAttribute("aria-checked",f.dataset.id===l.id?"true":"false");this._applyAiPreference(l.id),this.accessibilityService.alert(d(18123,null,l.label))}))}let r=Tqi.findIndex(l=>l.id===this.selectedAiMode);this._setupRadioGroupNavigation(n,Math.max(0,r));let s=D(t,_("div.onboarding-a-ai-pref-hint"));s.textContent=d(18121,null)}_applyAiPreference(e){switch(e){case"code-first":this.configurationService.updateValue("chat.agent.autoFix",!1,2);break;case"balanced":this.configurationService.updateValue("chat.agent.autoFix",!0,2);break;case"agent-forward":this.configurationService.updateValue("chat.agent.autoFix",!0,2);break}}_renderAgentSessionsSubtitle(e){St(e);let o=(et?["\u2318","\u2303","I"]:["Ctrl","Alt","I"]).map(n=>this._createKbd(n));e.append(d(18178,null));for(let n=0;n<o.length;n++)n>0&&e.append("+"),e.append(o[n])}_renderAgentSessionsStep(e){let t=D(e,_(".onboarding-a-sessions")),o=D(t,_(".onboarding-a-sessions-features")),n=D(o,_(".onboarding-a-sessions-group")),r=D(n,_("div.onboarding-a-sessions-group-label"));r.textContent=d(18147,null);let s=D(n,_(".onboarding-a-sessions-grid.onboarding-a-sessions-grid-2"));this._createFeatureCard(s,L.listOrdered,d(18149,null),d(18150,null)),this._createFeatureCard(s,L.commentDiscussion,d(18142,null),d(18143,null));let l=D(o,_(".onboarding-a-sessions-group")),c=D(l,_("div.onboarding-a-sessions-group-label"));c.textContent=d(18148,null);let u=D(l,_(".onboarding-a-sessions-grid.onboarding-a-sessions-grid-2"));this._createFeatureCard(u,L.rocket,d(18151,null),d(18152,null)),this._createFeatureCard(u,L.settingsGear,d(18145,null),d(18146,null));let p=D(t,_(".onboarding-a-sessions-docs"));this._createDocLink(p,d(18144,null),"https://code.visualstudio.com/docs/copilot/agents/agents-tutorial","agentsTutorial")}_createFeatureCard(e,t,o,n){let r=this._registerStepFocusable(D(e,_("div.onboarding-a-feature-card")));r.setAttribute("tabindex","0"),r.setAttribute("role","group"),r.setAttribute("aria-label",o),D(r,_("div.onboarding-a-feature-icon")).appendChild(un(t));let l=D(r,_("div.onboarding-a-feature-text")),c=D(l,_("div.onboarding-a-feature-title"));c.textContent=o;let u=D(l,_("div.onboarding-a-feature-desc"));return n&&(u.textContent=n),u}_createKbd(e){let t=_("kbd.onboarding-a-kbd");return t.textContent=e,t}_createDocLink(e,t,o,n){let r=this._registerStepFocusable(D(e,_("a.onboarding-a-doc-link")));r.textContent=t,r.href=o,r.target="_blank",r.rel="noopener",r.prepend(un(L.linkExternal)),n&&this.stepDisposables.add($(r,ne.CLICK,()=>{this._logAction("docLinkClick",void 0,n)}))}_createInlineLink(e,t,o){let n=this._registerStepFocusable(D(e,_("a.onboarding-a-inline-link")));return n.textContent=t,n.href=o,n.target="_blank",n.rel="noopener",n}_setupRadioGroupNavigation(e,t){for(let o=0;o<e.length;o++)e[o].setAttribute("tabindex",o===t?"0":"-1");for(let o=0;o<e.length;o++)this.stepDisposables.add($(e[o],ne.KEY_DOWN,n=>{let r=new mi(n),s;r.keyCode===17||r.keyCode===18?s=(o+1)%e.length:r.keyCode===15||r.keyCode===16?s=(o-1+e.length)%e.length:r.keyCode===14?s=0:r.keyCode===13&&(s=e.length-1),s!==void 0&&(n.preventDefault(),n.stopPropagation(),e[o].setAttribute("tabindex","-1"),e[s].setAttribute("tabindex","0"),e[s].focus(),e[s].click())}))}_trapTab(e,t){if(!this.overlay)return;let o=this._getFocusableElements();if(o.length===0){e.preventDefault();return}let n=o[0],r=o[o.length-1];t&&zi().document.activeElement===n?(e.preventDefault(),r.focus()):!t&&zi().document.activeElement===r&&(e.preventDefault(),n.focus())}_getFocusableElements(){return[...this.closeButton?[this.closeButton]:[],...this.stepFocusableElements,...this.footerFocusableElements].filter(e=>this._isTabbable(e))}_focusCurrentStepElement(){(this.stepFocusableElements.find(t=>this._isTabbable(t))??this.nextButton??this.closeButton)?.focus()}_registerStepFocusable(e){return this.stepFocusableElements.push(e),e}_isTabbable(e){if(!e.isConnected||e.getAttribute("aria-hidden")==="true"||e.tabIndex===-1||e.hasAttribute("disabled"))return!1;let t=zi().getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_logStepView(){let e=this.steps[this.currentStepIndex];this.telemetryService.publicLog2("welcomeOnboarding.stepView",{step:e,stepNumber:this.currentStepIndex+1})}_logAction(e,t,o){this.telemetryService.publicLog2("welcomeOnboarding.actionExecuted",{action:e,step:t??this.steps[this.currentStepIndex],argument:o??void 0})}_removeFromDOM(){this.overlay&&(this.overlay.remove(),this.overlay=void 0),this.card=void 0,this.bodyEl=void 0,this.progressContainer=void 0,this.stepLabelEl=void 0,this.titleEl=void 0,this.subtitleEl=void 0,this.contentEl=void 0,this.backButton=void 0,this.nextButton=void 0,this.closeButton=void 0,this.footerLeft=void 0,this._footerSignInBtn=void 0,this.footerFocusableElements.length=0,this.stepFocusableElements.length=0,this._isShowing=!1,this.disposables.clear(),this.stepDisposables.clear(),this.previouslyFocusedElement&&(this.previouslyFocusedElement.focus(),this.previouslyFocusedElement=void 0),this.currentStepIndex=0}dispose(){this._removeFromDOM(),super.dispose()}};dqe=I([m(0,Kl),m(1,ep),m(2,Nd),m(3,ga),m(4,xs),m(5,B),m(6,Ne),m(7,$e),m(8,ge),m(9,Pn),m(10,_e),m(11,fe),m(12,Ai)],dqe);Ce(Tmt,dqe,1);W(class extends z{constructor(){super({id:"workbench.action.welcomeOnboarding2026",title:P(18182,"Welcome Onboarding 2026"),category:Fe.Developer,f1:!0})}run(a){a.get(Tmt).show()}});var uqe=class{constructor(i,e,t,o){this.item=i;this.locations=e;this.model=t;this.parent=o}static compare(i,e){let t=oc(i.item.uri.toString(),e.item.uri.toString());return t===0&&(t=G.compareRangesUsingStarts(i.item.range,e.item.range)),t}},dXt=class{constructor(i){this.getDirection=i}hasChildren(){return!0}async getChildren(i){if(i instanceof bme)return i.roots.map(o=>new uqe(o,void 0,i,void 0));let{model:e,item:t}=i;return this.getDirection()==="outgoingCalls"?(await e.resolveOutgoingCalls(t,Ie.None)).map(o=>new uqe(o.to,o.fromRanges.map(n=>({range:n,uri:t.uri})),e,i)):(await e.resolveIncomingCalls(t,Ie.None)).map(o=>new uqe(o.from,o.fromRanges.map(n=>({range:n,uri:o.from.uri})),e,i))}},uXt=class{compare(i,e){return uqe.compare(i,e)}},pXt=class{constructor(i){this.getDirection=i}getId(i){let e=this.getDirection()+JSON.stringify(i.item.uri)+JSON.stringify(i.item.range);return i.parent&&(e+=this.getId(i.parent)),e}},Wqi=class{constructor(i,e){this.icon=i;this.label=e}},Mmt=class a{constructor(){this.templateId=a.id}static{this.id="CallRenderer"}renderTemplate(i){i.classList.add("callhierarchy-element");let e=document.createElement("div");i.appendChild(e);let t=new ld(i,{supportHighlights:!0});return new Wqi(e,t)}renderElement(i,e,t){let{element:o,filterData:n}=i,r=o.item.tags?.includes(1);t.icon.className="",t.icon.classList.add("inline","codicon-colored",...q.asClassNameArray(Zm.toIcon(o.item.kind))),t.label.setLabel(o.item.name,o.item.detail,{labelEscapeNewLines:!0,matches:Wa(n),strikethrough:r})}disposeTemplate(i){i.label.dispose()}},mXt=class{getHeight(i){return 22}getTemplateId(i){return Mmt.id}},hXt=class{constructor(i){this.getDirection=i}getWidgetAriaLabel(){return d(6275,null)}getAriaLabel(i){return this.getDirection()==="outgoingCalls"?d(6273,null,i.item.name):d(6274,null,i.item.name)}};var gXt=class{constructor(i,e){this.ratio=i;this.height=e}static store(i,e){e.store("callHierarchyPeekLayout",JSON.stringify(i),0,1)}static retrieve(i){let e=i.get("callHierarchyPeekLayout",0,"{}"),t={ratio:.7,height:17};try{return{...t,...JSON.parse(e)}}catch{return t}}},Vqi=class extends Rp{},X1=class extends zT{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{showFrame:!0,showArrow:!0,isResizeable:!0,isAccessible:!0},h);this._where=t;this._direction=o;this._peekViewService=r;this._editorService=s;this._textModelService=l;this._storageService=c;this._menuService=u;this._contextKeyService=p;this._instantiationService=h;this._treeViewStates=new Map;this._previewDisposable=new O;this.create(),this._peekViewService.addExclusiveWidget(e,this),this._applyTheme(n.getColorTheme()),this._disposables.add(n.onDidColorThemeChange(this._applyTheme,this)),this._disposables.add(this._previewDisposable)}static{this.TitleMenu=new R("callhierarchy/title")}dispose(){gXt.store(this._layoutInfo,this._storageService),this._splitView.dispose(),this._tree.dispose(),this._editor.dispose(),super.dispose()}get direction(){return this._direction}_applyTheme(e){let t=e.getColor(AD)||Ue.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(ZB)||Ue.transparent,primaryHeadingColor:e.getColor(n0),secondaryHeadingColor:e.getColor(r0)})}_fillHead(e){super._fillHead(e,!0);let t=this._menuService.createMenu(X1.TitleMenu,this._contextKeyService),o=()=>{let n=Ng(t.getActions());this._actionbarWidget.clear(),this._actionbarWidget.push(n,{label:!1,icon:!0})};this._disposables.add(t),this._disposables.add(t.onDidChange(o)),o()}_fillBody(e){this._layoutInfo=gXt.retrieve(this._storageService),this._dim=new di(0,0),this._parent=e,e.classList.add("call-hierarchy");let t=document.createElement("div");t.classList.add("message"),e.appendChild(t),this._message=t,this._message.tabIndex=0;let o=document.createElement("div");o.classList.add("results"),e.appendChild(o),this._splitView=new Gp(o,{orientation:1});let n=document.createElement("div");n.classList.add("editor"),o.appendChild(n);let r={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._editor=this._instantiationService.createInstance(Ed,n,r,{},this.editor);let s=document.createElement("div");s.classList.add("tree"),o.appendChild(s);let l={sorter:new uXt,accessibilityProvider:new hXt(()=>this._direction),identityProvider:new pXt(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:yJ}};this._tree=this._instantiationService.createInstance(Vqi,"CallHierarchyPeek",s,new mXt,[this._instantiationService.createInstance(Mmt)],this._instantiationService.createInstance(dXt,()=>this._direction),l),this._splitView.addView({onDidChange:U.None,element:n,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:c})}},Ac.Distribute),this._splitView.addView({onDidChange:U.None,element:s,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._tree.layout(this._dim.height,c)}},Ac.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this._layoutInfo.ratio=this._splitView.getViewSize(0)/this._dim.width)})),this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview,this)),this._disposables.add(this._editor.onMouseDown(c=>{let{event:u,target:p}=c;if(u.detail!==2)return;let[h]=this._tree.getFocus();h&&(this.dispose(),this._editorService.openEditor({resource:h.item.uri,options:{selection:p.range}}))})),this._disposables.add(this._tree.onMouseDblClick(c=>{c.target!==1&&c.element&&(this.dispose(),this._editorService.openEditor({resource:c.element.item.uri,options:{selection:c.element.item.selectionRange,pinned:!0}}))})),this._disposables.add(this._tree.onDidChangeSelection(c=>{let[u]=c.elements;u&&sf(c.browserEvent)&&(this.dispose(),this._editorService.openEditor({resource:u.item.uri,options:{selection:u.item.selectionRange,pinned:!0}}))}))}async _updatePreview(){let[e]=this._tree.getFocus();if(!e)return;this._previewDisposable.clear();let t={description:"call-hierarchy-decoration",stickiness:1,className:"call-decoration",overviewRuler:{color:_s(oTt),position:2}},o;this._direction==="outgoingCalls"?o=e.parent?e.parent.item.uri:e.model.root.uri:o=e.item.uri;let n=await this._textModelService.createModelReference(o);this._editor.setModel(n.object.textEditorModel);let r=[],s,l=e.locations;l||(l=[{uri:e.item.uri,range:e.item.selectionRange}]);for(let u of l)u.uri.toString()===o.toString()&&(r.push({range:u.range,options:t}),s=s?G.plusRange(u.range,s):u.range);if(s){this._editor.revealRangeInCenter(s,1);let u=this._editor.createDecorationsCollection(r);this._previewDisposable.add(ee(()=>u.clear()))}this._previewDisposable.add(n);let c=this._direction==="outgoingCalls"?d(6268,null,e.model.root.name):d(6269,null,e.model.root.name);this.setTitle(c)}showLoading(){this._parent.dataset.state="loading",this.setTitle(d(6272,null)),this._show()}showMessage(e){this._parent.dataset.state="message",this.setTitle(""),this.setMetaTitle(""),this._message.innerText=e,this._show(),this._message.focus()}async showModel(e){this._show();let t=this._treeViewStates.get(this._direction);await this._tree.setInput(e,t);let o=this._tree.getNode(e).children[0];await this._tree.expand(o.element),o.children.length===0?this.showMessage(this._direction==="outgoingCalls"?d(6270,null,e.root.name):d(6271,null,e.root.name)):(this._parent.dataset.state="data",(!t||this._tree.getFocus().length===0)&&this._tree.setFocus([o.children[0].element]),this._tree.domFocus(),this._updatePreview())}getModel(){return this._tree.getInput()}getFocused(){return this._tree.getFocus()[0]}async updateDirection(e){let t=this._tree.getInput();t&&e!==this._direction&&(this._treeViewStates.set(this._direction,this._tree.getViewState()),this._direction=e,await this.showModel(t))}_show(){this._isShowing||(this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber,0),super.show(G.fromPositions(this._where),this._layoutInfo.height))}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){(this._dim.height!==e||this._dim.width!==t)&&(super._doLayoutBody(e,t),this._dim=new di(t,e),this._layoutInfo.height=this._viewZone?this._viewZone.heightInLines:this._layoutInfo.height,this._splitView.layout(t),this._splitView.resizeView(0,t*this._layoutInfo.ratio))}};X1=I([m(3,Pe),m(4,T4),m(5,ie),m(6,Bt),m(7,de),m(8,Yt),m(9,X),m(10,F)],X1);var Bqi=new Y("editorHasCallHierarchyProvider",!1,d(6259,null)),Amt=new Y("callHierarchyVisible",!1,d(6257,null)),Pmt=new Y("callHierarchyDirection",void 0,{type:"string",description:d(6256,null)});function nLn(a){return a==="outgoingCalls"||a==="incomingCalls"?a:"incomingCalls"}var J_=class{constructor(i,e,t,o,n){this._editor=i;this._contextKeyService=e;this._storageService=t;this._editorService=o;this._instantiationService=n;this._dispoables=new O;this._sessionDisposables=new O;this._ctxIsVisible=Amt.bindTo(this._contextKeyService),this._ctxHasProvider=Bqi.bindTo(this._contextKeyService),this._ctxDirection=Pmt.bindTo(this._contextKeyService),this._dispoables.add(U.any(i.onDidChangeModel,i.onDidChangeModelLanguage,Sme.onDidChange)(()=>{this._ctxHasProvider.set(i.hasModel()&&Sme.has(i.getModel()))})),this._dispoables.add(this._sessionDisposables)}static{this.Id="callHierarchy"}static get(i){return i.getContribution(J_.Id)}static{this._StorageDirection="callHierarchy/defaultDirection"}dispose(){this._ctxHasProvider.reset(),this._ctxIsVisible.reset(),this._dispoables.dispose()}async startCallHierarchyFromEditor(){if(this._sessionDisposables.clear(),!this._editor.hasModel())return;let i=this._editor.getModel(),e=this._editor.getPosition();if(!Sme.has(i))return;let t=new qe,o=bme.create(i,e,t.token),n=nLn(this._storageService.get(J_._StorageDirection,0,"incomingCalls"));this._showCallHierarchyWidget(e,n,o,t)}async startCallHierarchyFromCallHierarchy(){if(!this._widget)return;let i=this._widget.getModel(),e=this._widget.getFocused();if(!e||!i)return;let t=await this._editorService.openCodeEditor({resource:e.item.uri},this._editor);if(!t)return;let o=i.fork(e.item);this._sessionDisposables.clear(),J_.get(t)?._showCallHierarchyWidget(G.lift(o.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(o),new qe)}_showCallHierarchyWidget(i,e,t,o){this._ctxIsVisible.set(!0),this._ctxDirection.set(e),U.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endCallHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(X1,this._editor,i,e),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endCallHierarchy(),this._storageService.store(J_._StorageDirection,this._widget.direction,0,0)})),this._sessionDisposables.add({dispose(){o.dispose(!0)}}),this._sessionDisposables.add(this._widget),t.then(n=>{o.token.isCancellationRequested||(n?(this._sessionDisposables.add(n),this._widget.showModel(n)):this._widget.showMessage(d(6261,null)))}).catch(n=>{if(Yi(n)){this.endCallHierarchy();return}this._widget.showMessage(d(6260,null))})}showOutgoingCalls(){this._widget?.updateDirection("outgoingCalls"),this._ctxDirection.set("outgoingCalls")}showIncomingCalls(){this._widget?.updateDirection("incomingCalls"),this._ctxDirection.set("incomingCalls")}endCallHierarchy(){this._sessionDisposables.clear(),this._ctxIsVisible.set(!1),this._editor.focus()}};J_=I([m(1,X),m(2,de),m(3,Qt),m(4,F)],J_);Eo(J_.Id,J_,0);W(class extends yl{constructor(){super({id:"editor.showCallHierarchy",title:P(6264,"Peek Call Hierarchy"),menu:{id:R.EditorContextPeek,group:"navigation",order:1e3,when:C.and(Bqi,Fg.notInPeekEditor,me.isInEmbeddedEditor.toNegated())},keybinding:{when:me.editorTextFocus,weight:200,primary:1574},precondition:C.and(Bqi,Fg.notInPeekEditor),f1:!0})}async runEditorCommand(i,e){return J_.get(e)?.startCallHierarchyFromEditor()}});W(class extends yl{constructor(){super({id:"editor.showIncomingCalls",title:P(6265,"Show Incoming Calls"),icon:Oe("callhierarchy-incoming",L.callIncoming,d(6262,null)),precondition:C.and(Amt,Pmt.isEqualTo("outgoingCalls")),keybinding:{weight:200,primary:1574},menu:{id:X1.TitleMenu,when:Pmt.isEqualTo("outgoingCalls"),order:1}})}runEditorCommand(a,i){return J_.get(i)?.showIncomingCalls()}});W(class extends yl{constructor(){super({id:"editor.showOutgoingCalls",title:P(6266,"Show Outgoing Calls"),icon:Oe("callhierarchy-outgoing",L.callOutgoing,d(6263,null)),precondition:C.and(Amt,Pmt.isEqualTo("incomingCalls")),keybinding:{weight:200,primary:1574},menu:{id:X1.TitleMenu,when:Pmt.isEqualTo("incomingCalls"),order:1}})}runEditorCommand(a,i){return J_.get(i)?.showOutgoingCalls()}});W(class extends yl{constructor(){super({id:"editor.refocusCallHierarchy",title:P(6267,"Refocus Call Hierarchy"),precondition:Amt,keybinding:{weight:200,primary:1027}})}async runEditorCommand(a,i){return J_.get(i)?.startCallHierarchyFromCallHierarchy()}});W(class extends yl{constructor(){super({id:"editor.closeCallHierarchy",title:d(6258,null),icon:L.close,precondition:Amt,keybinding:{weight:210,primary:9,when:C.not("config.editor.stablePeek")},menu:{id:X1.TitleMenu,order:1e3}})}runEditorCommand(a,i){return J_.get(i)?.endCallHierarchy()}});var pqe=class{constructor(i,e,t){this.item=i;this.model=e;this.parent=t}static compare(i,e){let t=oc(i.item.uri.toString(),e.item.uri.toString());return t===0&&(t=G.compareRangesUsingStarts(i.item.range,e.item.range)),t}},fXt=class{constructor(i){this.getDirection=i}hasChildren(){return!0}async getChildren(i){if(i instanceof Ime)return i.roots.map(o=>new pqe(o,i,void 0));let{model:e,item:t}=i;return this.getDirection()==="supertypes"?(await e.provideSupertypes(t,Ie.None)).map(o=>new pqe(o,e,i)):(await e.provideSubtypes(t,Ie.None)).map(o=>new pqe(o,e,i))}},vXt=class{compare(i,e){return pqe.compare(i,e)}},bXt=class{constructor(i){this.getDirection=i}getId(i){let e=this.getDirection()+JSON.stringify(i.item.uri)+JSON.stringify(i.item.range);return i.parent&&(e+=this.getId(i.parent)),e}},Hqi=class{constructor(i,e){this.icon=i;this.label=e}},Nmt=class a{constructor(){this.templateId=a.id}static{this.id="TypeRenderer"}renderTemplate(i){i.classList.add("typehierarchy-element");let e=document.createElement("div");i.appendChild(e);let t=new ld(i,{supportHighlights:!0});return new Hqi(e,t)}renderElement(i,e,t){let{element:o,filterData:n}=i,r=o.item.tags?.includes(1);t.icon.classList.add("inline","codicon-colored",...q.asClassNameArray(Zm.toIcon(o.item.kind))),t.label.setLabel(o.item.name,o.item.detail,{labelEscapeNewLines:!0,matches:Wa(n),strikethrough:r})}disposeTemplate(i){i.label.dispose()}},SXt=class{getHeight(i){return 22}getTemplateId(i){return Nmt.id}},IXt=class{constructor(i){this.getDirection=i}getWidgetAriaLabel(){return d(17434,null)}getAriaLabel(i){return this.getDirection()==="supertypes"?d(17433,null,i.item.name):d(17432,null,i.item.name)}};var yXt=class{constructor(i,e){this.ratio=i;this.height=e}static store(i,e){e.store("typeHierarchyPeekLayout",JSON.stringify(i),0,1)}static retrieve(i){let e=i.get("typeHierarchyPeekLayout",0,"{}"),t={ratio:.7,height:17};try{return{...t,...JSON.parse(e)}}catch{return t}}},Uqi=class extends Rp{},J1=class extends zT{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,{showFrame:!0,showArrow:!0,isResizeable:!0,isAccessible:!0},h);this._where=t;this._direction=o;this._peekViewService=r;this._editorService=s;this._textModelService=l;this._storageService=c;this._menuService=u;this._contextKeyService=p;this._instantiationService=h;this._treeViewStates=new Map;this._previewDisposable=new O;this.create(),this._peekViewService.addExclusiveWidget(e,this),this._applyTheme(n.getColorTheme()),this._disposables.add(n.onDidColorThemeChange(this._applyTheme,this)),this._disposables.add(this._previewDisposable)}static{this.TitleMenu=new R("typehierarchy/title")}dispose(){yXt.store(this._layoutInfo,this._storageService),this._splitView.dispose(),this._tree.dispose(),this._editor.dispose(),super.dispose()}get direction(){return this._direction}_applyTheme(e){let t=e.getColor(AD)||Ue.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(ZB)||Ue.transparent,primaryHeadingColor:e.getColor(n0),secondaryHeadingColor:e.getColor(r0)})}_fillHead(e){super._fillHead(e,!0);let t=this._menuService.createMenu(J1.TitleMenu,this._contextKeyService),o=()=>{let n=Ng(t.getActions());this._actionbarWidget.clear(),this._actionbarWidget.push(n,{label:!1,icon:!0})};this._disposables.add(t),this._disposables.add(t.onDidChange(o)),o()}_fillBody(e){this._layoutInfo=yXt.retrieve(this._storageService),this._dim=new di(0,0),this._parent=e,e.classList.add("type-hierarchy");let t=document.createElement("div");t.classList.add("message"),e.appendChild(t),this._message=t,this._message.tabIndex=0;let o=document.createElement("div");o.classList.add("results"),e.appendChild(o),this._splitView=new Gp(o,{orientation:1});let n=document.createElement("div");n.classList.add("editor"),o.appendChild(n);let r={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._editor=this._instantiationService.createInstance(Ed,n,r,{},this.editor);let s=document.createElement("div");s.classList.add("tree"),o.appendChild(s);let l={sorter:new vXt,accessibilityProvider:new IXt(()=>this._direction),identityProvider:new bXt(()=>this._direction),expandOnlyOnTwistieClick:!0,overrideStyles:{listBackground:yJ}};this._tree=this._instantiationService.createInstance(Uqi,"TypeHierarchyPeek",s,new SXt,[this._instantiationService.createInstance(Nmt)],this._instantiationService.createInstance(fXt,()=>this._direction),l),this._splitView.addView({onDidChange:U.None,element:n,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._editor.layout({height:this._dim.height,width:c})}},Ac.Distribute),this._splitView.addView({onDidChange:U.None,element:s,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:c=>{this._dim.height&&this._tree.layout(this._dim.height,c)}},Ac.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this._layoutInfo.ratio=this._splitView.getViewSize(0)/this._dim.width)})),this._disposables.add(this._tree.onDidChangeFocus(this._updatePreview,this)),this._disposables.add(this._editor.onMouseDown(c=>{let{event:u,target:p}=c;if(u.detail!==2)return;let[h]=this._tree.getFocus();h&&(this.dispose(),this._editorService.openEditor({resource:h.item.uri,options:{selection:p.range}}))})),this._disposables.add(this._tree.onMouseDblClick(c=>{c.target!==1&&c.element&&(this.dispose(),this._editorService.openEditor({resource:c.element.item.uri,options:{selection:c.element.item.selectionRange,pinned:!0}}))})),this._disposables.add(this._tree.onDidChangeSelection(c=>{let[u]=c.elements;u&&sf(c.browserEvent)&&(this.dispose(),this._editorService.openEditor({resource:u.item.uri,options:{selection:u.item.selectionRange,pinned:!0}}))}))}async _updatePreview(){let[e]=this._tree.getFocus();if(!e)return;this._previewDisposable.clear();let t={description:"type-hierarchy-decoration",stickiness:1,className:"type-decoration",overviewRuler:{color:_s(oTt),position:2}},o;this._direction==="supertypes"?o=e.parent?e.parent.item.uri:e.model.root.uri:o=e.item.uri;let n=await this._textModelService.createModelReference(o);this._editor.setModel(n.object.textEditorModel);let r=[],s,l={uri:e.item.uri,range:e.item.selectionRange};if(l.uri.toString()===o.toString()&&(r.push({range:l.range,options:t}),s=s?G.plusRange(l.range,s):l.range),s){this._editor.revealRangeInCenter(s,1);let u=this._editor.createDecorationsCollection(r);this._previewDisposable.add(ee(()=>u.clear()))}this._previewDisposable.add(n);let c=this._direction==="supertypes"?d(17430,null,e.model.root.name):d(17429,null,e.model.root.name);this.setTitle(c)}showLoading(){this._parent.dataset.state="loading",this.setTitle(d(17431,null)),this._show()}showMessage(e){this._parent.dataset.state="message",this.setTitle(""),this.setMetaTitle(""),this._message.innerText=e,this._show(),this._message.focus()}async showModel(e){this._show();let t=this._treeViewStates.get(this._direction);await this._tree.setInput(e,t);let o=this._tree.getNode(e).children[0];await this._tree.expand(o.element),o.children.length===0?this.showMessage(this._direction==="supertypes"?d(17428,null,e.root.name):d(17427,null,e.root.name)):(this._parent.dataset.state="data",(!t||this._tree.getFocus().length===0)&&this._tree.setFocus([o.children[0].element]),this._tree.domFocus(),this._updatePreview())}getModel(){return this._tree.getInput()}getFocused(){return this._tree.getFocus()[0]}async updateDirection(e){let t=this._tree.getInput();t&&e!==this._direction&&(this._treeViewStates.set(this._direction,this._tree.getViewState()),this._direction=e,await this.showModel(t))}_show(){this._isShowing||(this.editor.revealLineInCenterIfOutsideViewport(this._where.lineNumber,0),super.show(G.fromPositions(this._where),this._layoutInfo.height))}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){(this._dim.height!==e||this._dim.width!==t)&&(super._doLayoutBody(e,t),this._dim=new di(t,e),this._layoutInfo.height=this._viewZone?this._viewZone.heightInLines:this._layoutInfo.height,this._splitView.layout(t),this._splitView.resizeView(0,t*this._layoutInfo.ratio))}};J1=I([m(3,Pe),m(4,T4),m(5,ie),m(6,Bt),m(7,de),m(8,Yt),m(9,X),m(10,F)],J1);var zqi=new Y("editorHasTypeHierarchyProvider",!1,d(17418,null)),Fmt=new Y("typeHierarchyVisible",!1,d(17426,null)),Omt=new Y("typeHierarchyDirection",void 0,{type:"string",description:d(17425,null)});function sLn(a){return a==="subtypes"||a==="supertypes"?a:"subtypes"}var Z_=class{constructor(i,e,t,o,n){this._editor=i;this._contextKeyService=e;this._storageService=t;this._editorService=o;this._instantiationService=n;this._disposables=new O;this._sessionDisposables=new O;this._ctxHasProvider=zqi.bindTo(this._contextKeyService),this._ctxIsVisible=Fmt.bindTo(this._contextKeyService),this._ctxDirection=Omt.bindTo(this._contextKeyService),this._disposables.add(U.any(i.onDidChangeModel,i.onDidChangeModelLanguage,yme.onDidChange)(()=>{this._ctxHasProvider.set(i.hasModel()&&yme.has(i.getModel()))})),this._disposables.add(this._sessionDisposables)}static{this.Id="typeHierarchy"}static get(i){return i.getContribution(Z_.Id)}static{this._storageDirectionKey="typeHierarchy/defaultDirection"}dispose(){this._disposables.dispose()}async startTypeHierarchyFromEditor(){if(this._sessionDisposables.clear(),!this._editor.hasModel())return;let i=this._editor.getModel(),e=this._editor.getPosition();if(!yme.has(i))return;let t=new qe,o=Ime.create(i,e,t.token),n=sLn(this._storageService.get(Z_._storageDirectionKey,0,"subtypes"));this._showTypeHierarchyWidget(e,n,o,t)}_showTypeHierarchyWidget(i,e,t,o){this._ctxIsVisible.set(!0),this._ctxDirection.set(e),U.any(this._editor.onDidChangeModel,this._editor.onDidChangeModelLanguage)(this.endTypeHierarchy,this,this._sessionDisposables),this._widget=this._instantiationService.createInstance(J1,this._editor,i,e),this._widget.showLoading(),this._sessionDisposables.add(this._widget.onDidClose(()=>{this.endTypeHierarchy(),this._storageService.store(Z_._storageDirectionKey,this._widget.direction,0,0)})),this._sessionDisposables.add({dispose(){o.dispose(!0)}}),this._sessionDisposables.add(this._widget),t.then(n=>{o.token.isCancellationRequested||(n?(this._sessionDisposables.add(n),this._widget.showModel(n)):this._widget.showMessage(d(17420,null)))}).catch(n=>{if(Yi(n)){this.endTypeHierarchy();return}this._widget.showMessage(d(17419,null))})}async startTypeHierarchyFromTypeHierarchy(){if(!this._widget)return;let i=this._widget.getModel(),e=this._widget.getFocused();if(!e||!i)return;let t=await this._editorService.openCodeEditor({resource:e.item.uri},this._editor);if(!t)return;let o=i.fork(e.item);this._sessionDisposables.clear(),Z_.get(t)?._showTypeHierarchyWidget(G.lift(o.root.selectionRange).getStartPosition(),this._widget.direction,Promise.resolve(o),new qe)}showSupertypes(){this._widget?.updateDirection("supertypes"),this._ctxDirection.set("supertypes")}showSubtypes(){this._widget?.updateDirection("subtypes"),this._ctxDirection.set("subtypes")}endTypeHierarchy(){this._sessionDisposables.clear(),this._ctxIsVisible.set(!1),this._editor.focus()}};Z_=I([m(1,X),m(2,de),m(3,Qt),m(4,F)],Z_);Eo(Z_.Id,Z_,0);W(class extends yl{constructor(){super({id:"editor.showTypeHierarchy",title:P(17421,"Peek Type Hierarchy"),menu:{id:R.EditorContextPeek,group:"navigation",order:1e3,when:C.and(zqi,Fg.notInPeekEditor)},precondition:C.and(zqi,Fg.notInPeekEditor),f1:!0})}async runEditorCommand(i,e){return Z_.get(e)?.startTypeHierarchyFromEditor()}});W(class extends yl{constructor(){super({id:"editor.showSupertypes",title:P(17424,"Show Supertypes"),icon:L.typeHierarchySuper,precondition:C.and(Fmt,Omt.isEqualTo("subtypes")),keybinding:{weight:200,primary:1574},menu:{id:J1.TitleMenu,when:Omt.isEqualTo("subtypes"),order:1}})}runEditorCommand(a,i){return Z_.get(i)?.showSupertypes()}});W(class extends yl{constructor(){super({id:"editor.showSubtypes",title:P(17423,"Show Subtypes"),icon:L.typeHierarchySub,precondition:C.and(Fmt,Omt.isEqualTo("supertypes")),keybinding:{weight:200,primary:1574},menu:{id:J1.TitleMenu,when:Omt.isEqualTo("supertypes"),order:1}})}runEditorCommand(a,i){return Z_.get(i)?.showSubtypes()}});W(class extends yl{constructor(){super({id:"editor.refocusTypeHierarchy",title:P(17422,"Refocus Type Hierarchy"),precondition:Fmt,keybinding:{weight:200,primary:1027}})}async runEditorCommand(a,i){return Z_.get(i)?.startTypeHierarchyFromTypeHierarchy()}});W(class extends yl{constructor(){super({id:"editor.closeTypeHierarchy",title:d(17417,null),icon:L.close,precondition:Fmt,keybinding:{weight:210,primary:9,when:C.not("config.editor.stablePeek")},menu:{id:J1.TitleMenu,order:1e3}})}runEditorCommand(a,i){return Z_.get(i)?.endTypeHierarchy()}});var wXt=class{getKeyboardNavigationLabel(i){return i instanceof pC?i.label:i.symbol.name}},CXt=class{constructor(i){this._ariaLabel=i}getWidgetAriaLabel(){return this._ariaLabel}getAriaLabel(i){return i instanceof pC?i.label:kIt(i.symbol.name,i.symbol.kind)}},xXt=class{getId(i){return i.id}},mqe=class{constructor(i){this._instantiationService=i}getDragURI(i){let e=h0.get(i)?.uri;if(!e)return null;if(i instanceof Iv){let t=aLn(e,i.symbol);return t.fsPath+(t.fragment?"#"+t.fragment:"")}else return e.fsPath}getDragLabel(i,e){if(i.length!==1)return;let t=i[0];return t instanceof Iv?t.symbol.name:t.label}onDragStart(i,e){let o=i.elements[0];if(!o||!e.dataTransfer)return;let n=h0.get(o)?.uri;if(!n)return;let r=o instanceof Iv?[o]:Array.from(o.children.values());uxe(r.map(s=>({name:s.symbol.name,fsPath:n.fsPath,range:s.symbol.range,kind:s.symbol.kind})),e),this._instantiationService.invokeFunction(s=>kv(s,r.map(l=>({resource:n,selection:l.symbol.range})),e))}onDragOver(){return!1}drop(){}dispose(){}};mqe=I([m(0,F)],mqe);function aLn(a,i){return $L(a,i.range)}var Wmt=class{constructor(i,e){this.labelContainer=i;this.label=e}static{this.id="DocumentSymbolGroupTemplate"}dispose(){this.label.dispose()}},Vmt=class{constructor(i,e,t,o){this.container=i;this.iconLabel=e;this.iconClass=t;this.decoration=o}static{this.id="DocumentSymbolTemplate"}},kXt=class{getHeight(i){return 22}getTemplateId(i){return i instanceof pC?Wmt.id:Vmt.id}},EXt=class{constructor(){this.templateId=Wmt.id}renderTemplate(i){let e=_(".outline-element-label");return i.classList.add("outline-element"),D(i,e),new Wmt(e,new ul(e))}renderElement(i,e,t){t.label.set(i.element.label,Wa(i.filterData))}disposeTemplate(i){i.dispose()}},hqe=class{constructor(i,e,t,o){this._renderMarker=i;this._configurationService=t;this._themeService=o;this.templateId=Vmt.id}renderTemplate(i){i.classList.add("outline-element");let e=new ld(i,{supportHighlights:!0}),t=_(".outline-element-icon"),o=_(".outline-element-decoration");return i.prepend(t),i.appendChild(o),new Vmt(i,e,t,o)}renderElement(i,e,t){let{element:o}=i,n=["nowrap"],r={matches:Wa(i.filterData),labelEscapeNewLines:!0,extraClasses:n,title:d(10113,null,o.symbol.name,kri[o.symbol.kind])};this._configurationService.getValue("outline.icons")&&(t.iconClass.className="",t.iconClass.classList.add("outline-element-icon","inline","codicon-colored",...q.asClassNameArray(Zm.toIcon(o.symbol.kind)))),o.symbol.tags.indexOf(1)>=0&&(n.push("deprecated"),r.matches=[]),t.iconLabel.setLabel(o.symbol.name,o.symbol.detail,r),this._renderMarker&&this._renderMarkerInfo(o,t)}_renderMarkerInfo(i,e){if(!i.marker){Wi(e.decoration),e.container.style.removeProperty("--outline-element-color");return}let{count:t,topSev:o}=i.marker,n=this._themeService.getColorTheme().getColor(o===8?Ok:tK),r=n?n.toString():"inherit",s=this._configurationService.getValue("problems.visibility"),l=this._configurationService.getValue("outline.problems.colors");if(!s||!l?e.container.style.removeProperty("--outline-element-color"):e.container.style.setProperty("--outline-element-color",r),s===void 0)return;!this._configurationService.getValue("outline.problems.badges")||!s?Wi(e.decoration):t>0?(Xo(e.decoration),e.decoration.classList.remove("bubble"),e.decoration.textContent=t<10?t.toString():"+9",e.decoration.title=t===1?d(10110,null):d(10112,null,t),e.decoration.style.setProperty("--outline-element-color",r)):(Xo(e.decoration),e.decoration.classList.add("bubble"),e.decoration.textContent="\uEA71",e.decoration.title=d(10111,null),e.decoration.style.setProperty("--outline-element-color",r))}disposeTemplate(i){i.iconLabel.dispose()}};hqe=I([m(2,B),m(3,Pe)],hqe);var pj=class{constructor(i,e){this._prefix=i;this._textResourceConfigService=e}static{this.kindToConfigName=Object.freeze({0:"showFiles",1:"showModules",2:"showNamespaces",3:"showPackages",4:"showClasses",5:"showMethods",6:"showProperties",7:"showFields",8:"showConstructors",9:"showEnums",10:"showInterfaces",11:"showFunctions",12:"showVariables",13:"showConstants",14:"showStrings",15:"showNumbers",16:"showBooleans",17:"showArrays",18:"showObjects",19:"showKeys",20:"showNull",21:"showEnumMembers",22:"showStructs",23:"showEvents",24:"showOperators",25:"showTypeParameters"})}filter(i){let e=h0.get(i);if(!(i instanceof Iv))return!0;let t=pj.kindToConfigName[i.symbol.kind],o=`${this._prefix}.${t}`;return this._textResourceConfigService.getValue(e?.uri,o)}};pj=I([m(1,Gn)],pj);var TXt=class{constructor(){this._collator=nd.Collator(void 0,{numeric:!0})}compareByPosition(i,e){return i instanceof pC&&e instanceof pC?i.order-e.order:i instanceof Iv&&e instanceof Iv?G.compareRangesUsingStarts(i.symbol.range,e.symbol.range)||this._collator.value.compare(i.symbol.name,e.symbol.name):0}compareByType(i,e){return i instanceof pC&&e instanceof pC?i.order-e.order:i instanceof Iv&&e instanceof Iv?i.symbol.kind-e.symbol.kind||this._collator.value.compare(i.symbol.name,e.symbol.name):0}compareByName(i,e){return i instanceof pC&&e instanceof pC?i.order-e.order:i instanceof Iv&&e instanceof Iv?this._collator.value.compare(i.symbol.name,e.symbol.name)||G.compareRangesUsingStarts(i.symbol.range,e.symbol.range):0}};var Bmt=class{constructor(i,e){this._editor=i;this._textResourceConfigurationService=e;this._breadcrumbs=[]}getBreadcrumbElements(){return this._breadcrumbs}clear(){this._breadcrumbs=[]}update(i,e){let t=this._computeBreadcrumbs(i,e);this._breadcrumbs=t.map(o=>({element:o,label:o instanceof Iv?o.symbol.name:""}))}_computeBreadcrumbs(i,e){let t=i.getItemEnclosingPosition(e);if(!t)return[];let o=[];for(;t;){o.push(t);let r=t.parent;if(r instanceof h0||r instanceof pC&&r.parent&&r.parent.children.size===1)break;t=r}let n=[];for(let r=o.length-1;r>=0;r--){let s=o[r];if(this._isFiltered(s))break;n.push(s)}return n.length===0?[]:n}_isFiltered(i){if(!(i instanceof Iv))return!1;let e=`breadcrumbs.${pj.kindToConfigName[i.symbol.kind]}`,t;return this._editor&&this._editor.getModel()&&(t=this._editor.getModel().uri),!this._textResourceConfigurationService.getValue(t,e)}};Bmt=I([m(1,Gn)],Bmt);var Hmt=class{constructor(i,e,t,o,n,r,s,l,c,u){this._editor=i;this._languageFeaturesService=o;this._codeEditorService=n;this._outlineModelService=r;this._configurationService=s;this._markerDecorationsService=l;this._disposables=new O;this._onDidChange=this._disposables.add(new T);this.onDidChange=this._onDidChange.event;this._outlineDisposables=new O;this.outlineKind="documentSymbols";this._breadcrumbsDataSource=new Bmt(i,c);let p=new kXt,h=[new EXt,u.createInstance(hqe,!0,e)],g={getChildren:y=>y instanceof Iv||y instanceof pC?y.children.values():y===this&&this._outlineModel?this._outlineModel.children.values():[]},f=new TXt,v=c.getValue(i.getModel()?.uri,"outline.collapseItems"),b={collapseByDefault:e===2||e===1&&v==="alwaysCollapse",expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,identityProvider:new xXt,keyboardNavigationLabelProvider:new wXt,accessibilityProvider:new CXt(d(10109,null)),filter:e===1?u.createInstance(pj,"outline"):e===2?u.createInstance(pj,"breadcrumbs"):void 0,dnd:u.createInstance(mqe)};this.config={breadcrumbsDataSource:this._breadcrumbsDataSource,delegate:p,renderers:h,treeDataSource:g,comparator:f,options:b,quickPickDataSource:{getQuickPickElements:()=>{throw new Error("not implemented")}}},this._disposables.add(o.documentSymbolProvider.onDidChange(y=>this._createOutline())),this._disposables.add(this._editor.onDidChangeModel(y=>this._createOutline())),this._disposables.add(this._editor.onDidChangeModelLanguage(y=>this._createOutline()));let S=new Nl;this._disposables.add(S),this._disposables.add(this._editor.onDidChangeModelContent(y=>{let w=this._editor.getModel();if(w){let x=r.getDebounceValue(w);S.cancelAndSet(()=>this._createOutline(y),x)}})),this._disposables.add(this._editor.onDidDispose(()=>this._outlineDisposables.clear())),this._createOutline().finally(()=>t.open())}get activeElement(){let i=this._editor.getPosition();if(!(!i||!this._outlineModel))return this._outlineModel.getItemEnclosingPosition(i)}dispose(){this._disposables.dispose(),this._outlineDisposables.dispose()}get isEmpty(){return!this._outlineModel||fM.empty(this._outlineModel)}get uri(){return this._outlineModel?.uri}async reveal(i,e,t,o){let n=h0.get(i);!n||!(i instanceof Iv)||await this._codeEditorService.openCodeEditor({resource:n.uri,options:{...e,selection:o?i.symbol.range:G.collapseToStart(i.symbol.selectionRange),selectionRevealType:3}},this._editor,t)}preview(i){if(!(i instanceof Iv))return k.None;let{symbol:e}=i;this._editor.revealRangeInCenterIfOutsideViewport(e.range,0);let t=this._editor.createDecorationsCollection([{range:e.range,options:{description:"document-symbols-outline-range-highlight",className:"rangeHighlight",isWholeLine:!0}}]);return ee(()=>t.clear())}captureViewState(){let i=this._editor.saveViewState();return ee(()=>{i&&this._editor.restoreViewState(i)})}async _createOutline(i){if(this._outlineDisposables.clear(),i||this._setOutlineModel(void 0),!this._editor.hasModel())return;let e=this._editor.getModel();if(!this._languageFeaturesService.documentSymbolProvider.has(e))return;let t=new qe,o=e.getVersionId(),n=new Nl;this._outlineDisposables.add(n),this._outlineDisposables.add(ee(()=>t.dispose(!0)));try{let r=await this._outlineModelService.getOrCreate(e,t.token);if(t.token.isCancellationRequested)return;if(fM.empty(r)||!this._editor.hasModel()){this._setOutlineModel(r);return}if(i&&this._outlineModel&&e.getLineCount()>=25){let s=fM.size(r),l=e.getValueLength(),c=s/l,u=fM.size(this._outlineModel),p=l-i.changes.reduce((g,f)=>g+f.rangeLength,0),h=u/p;if((c<=h*.5||c>=h*1.5)&&!await Ea(Li(2e3).then(()=>!0),t.token,!1))return}this._applyMarkersToOutline(r),this._outlineDisposables.add(this._markerDecorationsService.onDidChangeMarker(s=>{ze(r.uri,s.uri)&&(this._applyMarkersToOutline(r),this._onDidChange.fire({}))})),this._outlineDisposables.add(this._configurationService.onDidChangeConfiguration(s=>{if(s.affectsConfiguration("outline.problems.enabled")||s.affectsConfiguration("problems.visibility")){let l=this._configurationService.getValue("problems.visibility"),c=this._configurationService.getValue("outline.problems.enabled");!l||!c?r.updateMarker([]):this._applyMarkersToOutline(r),this._onDidChange.fire({})}s.affectsConfiguration("outline")&&this._onDidChange.fire({}),s.affectsConfiguration("breadcrumbs")&&this._editor.hasModel()&&(this._breadcrumbsDataSource.update(r,this._editor.getPosition()),this._onDidChange.fire({}))})),this._outlineDisposables.add(this._configurationService.onDidChangeConfiguration(s=>{s.affectsConfiguration("outline.icons")&&this._onDidChange.fire({}),s.affectsConfiguration("outline")&&this._onDidChange.fire({})})),this._outlineDisposables.add(this._editor.onDidChangeCursorPosition(s=>{n.cancelAndSet(()=>{!e.isDisposed()&&o===e.getVersionId()&&this._editor.hasModel()&&(this._breadcrumbsDataSource.update(r,this._editor.getPosition()),this._onDidChange.fire({affectOnlyActiveElement:!0}))},150)})),this._setOutlineModel(r)}catch(r){this._setOutlineModel(void 0),mt(r)}}_applyMarkersToOutline(i){let e=this._configurationService.getValue("problems.visibility"),t=this._configurationService.getValue("outline.problems.enabled");if(!i||!e||!t)return;let o=[];for(let[n,r]of this._markerDecorationsService.getLiveMarkers(i.uri))(r.severity===8||r.severity===4)&&o.push({...n,severity:r.severity});i.updateMarker(o)}_setOutlineModel(i){let e=this._editor.getPosition();!e||!i?(this._outlineModel=void 0,this._breadcrumbsDataSource.clear()):(this._outlineModel?.merge(i)||(this._outlineModel=i),this._breadcrumbsDataSource.update(i,e)),this._onDidChange.fire({})}};Hmt=I([m(3,Jt),m(4,Qt),m(5,kx),m(6,B),m(7,Yz),m(8,Gn),m(9,F)],Hmt);var Umt=class{constructor(i){let e=i.registerOutlineCreator(this);this.dispose=()=>e.dispose()}matches(i){let e=i.getControl();return fn(e)||Lc(e)}async createOutline(i,e,t){let o=i.getControl(),n;if(fn(o)?n=o:Lc(o)&&(n=o.getModifiedEditor()),!n)return;let r=new ip,s=n.invokeWithinContext(l=>l.get(F).createInstance(Hmt,n,e,r));return await r.wait(),s}};Umt=I([m(0,sP)],Umt);oe.as(Zi.Workbench).registerWorkbenchContribution(Umt,4);var _Xt=class{constructor(){this._followCursor=!1;this._filterOnType=!0;this._sortBy=0;this._onDidChange=new T;this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}set followCursor(i){i!==this._followCursor&&(this._followCursor=i,this._onDidChange.fire({followCursor:!0}))}get followCursor(){return this._followCursor}get filterOnType(){return this._filterOnType}set filterOnType(i){i!==this._filterOnType&&(this._filterOnType=i,this._onDidChange.fire({filterOnType:!0}))}set sortBy(i){i!==this._sortBy&&(this._sortBy=i,this._onDidChange.fire({sortBy:!0}))}get sortBy(){return this._sortBy}persist(i){i.store("outline/state",JSON.stringify({followCursor:this.followCursor,sortBy:this.sortBy,filterOnType:this.filterOnType}),1,1)}restore(i){let e=i.get("outline/state",1);if(!e)return;let t;try{t=JSON.parse(e)}catch{return}this.followCursor=t.followCursor,this.sortBy=t.sortBy??0,typeof t.filterOnType=="boolean"&&(this.filterOnType=t.filterOnType)}};var Kqi=class{constructor(i,e){this._comparator=i;this.order=e}compare(i,e){return this.order===2?this._comparator.compareByType(i,e):this.order===1?this._comparator.compareByName(i,e):this._comparator.compareByPosition(i,e)}},gqe=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,c,p,l,u,n,o,h,g,f);this._outlineService=t;this._instantiationService=o;this._storageService=r;this._editorService=s;this._disposables=new O;this._editorControlDisposables=new O;this._editorPaneDisposables=new O;this._outlineViewState=new _Xt;this._editorListener=new ue;this._treeStates=new Ua(10);this._editorControlChangePromise=Promise.resolve();this._outlineViewState.restore(this._storageService),this._disposables.add(this._outlineViewState),u.bufferChangeEvents(()=>{this._ctxFollowsCursor=j2t.bindTo(u),this._ctxFilterOnType=Q2t.bindTo(u),this._ctxSortMode=iFe.bindTo(u),this._ctxAllCollapsed=xrt.bindTo(u)});let v=()=>{this._ctxFollowsCursor.set(this._outlineViewState.followCursor),this._ctxFilterOnType.set(this._outlineViewState.filterOnType),this._ctxSortMode.set(this._outlineViewState.sortBy)};v(),this._disposables.add(this._outlineViewState.onDidChange(v))}static{this.Id="outline"}dispose(){this._disposables.dispose(),this._editorPaneDisposables.dispose(),this._editorControlDisposables.dispose(),this._editorListener.dispose(),super.dispose()}focus(){this._editorControlChangePromise.then(()=>{super.focus(),this._tree?.domFocus()})}renderBody(e){super.renderBody(e),this._domNode=e,e.classList.add("outline-pane");let t=_(".outline-progress");this._message=_(".outline-message"),this._progressBar=new Cv(t,oC),this._treeContainer=_(".outline-tree"),D(e,t,this._message,this._treeContainer),this._disposables.add(this.onDidChangeBodyVisibility(o=>{if(!o)this._editorListener.clear(),this._editorPaneDisposables.clear(),this._editorControlDisposables.clear();else if(!this._editorListener.value){let n=U.any(this._editorService.onDidActiveEditorChange,this._outlineService.onDidChange);this._editorListener.value=n(()=>this._handleEditorChanged(this._editorService.activeEditorPane)),this._handleEditorChanged(this._editorService.activeEditorPane)}}))}layoutBody(e,t){super.layoutBody(e,t),this._tree?.layout(e,t),this._treeDimensions=new di(t,e)}collapseAll(){this._tree?.collapseAll()}expandAll(){this._tree?.expandAll()}get outlineViewState(){return this._outlineViewState}_showMessage(e){this._domNode.classList.add("message"),this._progressBar.stop().hide(),this._message.textContent=e}_captureViewState(e){if(this._tree){let t=this._tree.getInput();if(e||(e=t?.uri),t&&e)return this._treeStates.set(`${t.outlineKind}/${e}`,this._tree.getViewState()),!0}return!1}_handleEditorChanged(e){this._editorPaneDisposables.clear(),e&&this._editorPaneDisposables.add(e.onDidChangeControl(()=>{this._editorControlChangePromise=this._handleEditorControlChanged(e)})),this._editorControlChangePromise=this._handleEditorControlChanged(e)}async _handleEditorControlChanged(e){let t=po.getOriginalUri(e?.input),o=this._captureViewState();if(this._editorControlDisposables.clear(),!e||!this._outlineService.canCreateOutline(e)||!t)return this._showMessage(d(14026,null));let n;o||(n=new Nl(()=>{this._showMessage(d(14025,null,Be(t)))},100)),this._progressBar.infinite().show(500);let r=new qe;this._editorControlDisposables.add(ee(()=>r.dispose(!0)));let s=await this._outlineService.createOutline(e,1,r.token);if(n?.dispose(),!s)return;if(r.token.isCancellationRequested){s?.dispose();return}this._editorControlDisposables.add(s),this._progressBar.stop().hide();let l=new Kqi(s.config.comparator,this._outlineViewState.sortBy),c=this._instantiationService.createInstance(c0,"OutlinePane",this._treeContainer,s.config.delegate,s.config.renderers,s.config.treeDataSource,{...s.config.options,sorter:l,expandOnDoubleClick:!1,expandOnlyOnTwistieClick:!0,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,defaultFindMode:this._outlineViewState.filterOnType?1:0,overrideStyles:this.getLocationBasedColors().listOverrideStyles});vwo.bindTo(c.contextKeyService);let u=()=>{if(s.isEmpty)this._showMessage(d(14027,null,Be(t))),this._captureViewState(t),c.setInput(void 0);else if(c.getInput())this._domNode.classList.remove("message"),c.updateChildren();else{this._domNode.classList.remove("message");let v=this._treeStates.get(`${s.outlineKind}/${s.uri}`);c.setInput(s,v&&y6e.lift(v))}};u(),this._editorControlDisposables.add(s.onDidChange(u)),this._editorControlDisposables.add(this.viewDescriptorService.onDidChangeLocation(({views:v})=>{v.some(b=>b.id===this.id)&&c.updateOptions({overrideStyles:this.getLocationBasedColors().listOverrideStyles})})),this._editorControlDisposables.add(c.onDidChangeFindMode(v=>this._outlineViewState.filterOnType=v===1));let p=0;this._editorControlDisposables.add(c.onDidOpen(async v=>{let b=++p,S=v.browserEvent?.type==="dblclick";!S&&(await Li(150),b!==p)||await s.reveal(v.element,v.editorOptions,v.sideBySide,S)}));let h=()=>{if(!this._outlineViewState.followCursor||!s.activeElement)return;let v=s.activeElement;for(;v;){if(c.getRelativeTop(v)===null&&c.reveal(v,.5),c.getRelativeTop(v)!==null){c.setFocus([v]),c.setSelection([v]);break}v=c.getParentElement(v)}};h(),this._editorControlDisposables.add(s.onDidChange(h)),this._editorControlDisposables.add(this._outlineViewState.onDidChange(v=>{this._outlineViewState.persist(this._storageService),v.filterOnType&&(c.findMode=this._outlineViewState.filterOnType?1:0),v.followCursor&&h(),v.sortBy&&(l.order=this._outlineViewState.sortBy,c.resort())}));let g;this._editorControlDisposables.add(c.onDidChangeFindPattern(v=>{c.findMode!==0&&(!g&&v?(g=c.getViewState(),c.expandAll()):!v&&g&&(c.setInput(c.getInput(),g),g=void 0))}));let f=()=>{this._ctxAllCollapsed.set(c.getNode(null).children.every(v=>!v.collapsible||v.collapsed))};this._editorControlDisposables.add(c.onDidChangeCollapseState(f)),this._editorControlDisposables.add(c.onDidChangeModel(f)),f(),c.layout(this._treeDimensions?.height,this._treeDimensions?.width),this._tree=c,this._editorControlDisposables.add(ee(()=>{c.dispose(),this._tree=void 0}))}};gqe=I([m(1,sP),m(2,F),m(3,ji),m(4,de),m(5,ie),m(6,B),m(7,Le),m(8,X),m(9,Xe),m(10,Je),m(11,Pe),m(12,ot)],gqe);W(class extends rr{constructor(){super({viewId:yw.Id,id:"outline.collapse",title:d(14018,null),f1:!1,icon:L.collapseAll,menu:{id:R.ViewTitle,group:"navigation",when:C.and(C.equals("view",yw.Id),xrt.isEqualTo(!1))}})}runInView(i,e){e.collapseAll()}});W(class extends rr{constructor(){super({viewId:yw.Id,id:"outline.expand",title:d(14019,null),f1:!1,icon:L.expandAll,menu:{id:R.ViewTitle,group:"navigation",when:C.and(C.equals("view",yw.Id),xrt.isEqualTo(!0))}})}runInView(i,e){e.expandAll()}});W(class extends rr{constructor(){super({viewId:yw.Id,id:"outline.followCursor",title:d(14021,null),f1:!1,toggled:j2t,menu:{id:R.ViewTitle,group:"config",order:1,when:C.equals("view",yw.Id)}})}runInView(i,e){e.outlineViewState.followCursor=!e.outlineViewState.followCursor}});W(class extends rr{constructor(){super({viewId:yw.Id,id:"outline.filterOnType",title:d(14020,null),f1:!1,toggled:Q2t,menu:{id:R.ViewTitle,group:"config",order:2,when:C.equals("view",yw.Id)}})}runInView(i,e){e.outlineViewState.filterOnType=!e.outlineViewState.filterOnType}});W(class extends rr{constructor(){super({viewId:yw.Id,id:"outline.sortByPosition",title:d(14024,null),f1:!1,toggled:iFe.isEqualTo(0),menu:{id:R.ViewTitle,group:"sort",order:1,when:C.equals("view",yw.Id)}})}runInView(i,e){e.outlineViewState.sortBy=0}});W(class extends rr{constructor(){super({viewId:yw.Id,id:"outline.sortByName",title:d(14023,null),f1:!1,toggled:iFe.isEqualTo(1),menu:{id:R.ViewTitle,group:"sort",order:2,when:C.equals("view",yw.Id)}})}runInView(i,e){e.outlineViewState.sortBy=1}});W(class extends rr{constructor(){super({viewId:yw.Id,id:"outline.sortByKind",title:d(14022,null),f1:!1,toggled:iFe.isEqualTo(2),menu:{id:R.ViewTitle,group:"sort",order:3,when:C.equals("view",yw.Id)}})}runInView(i,e){e.outlineViewState.sortBy=2}});var lLn=Oe("outline-view-icon",L.symbolClass,d(14017,null));oe.as(Kn.ViewsRegistry).registerViews([{id:yw.Id,name:P(14008,"Outline"),containerIcon:lLn,ctorDescriptor:new Vt(gqe),canToggleVisibility:!0,canMoveView:!0,hideByDefault:!1,collapsed:!0,order:2,weight:30,focusCommand:{id:"outline.focus"}}],SSe);oe.as($t.Configuration).registerConfiguration({id:"outline",order:117,title:d(14016,null),type:"object",properties:{"outline.icons":{description:d(14014,null),type:"boolean",default:!0},"outline.collapseItems":{description:d(14009,null),type:"string",scope:6,enum:["alwaysCollapse","alwaysExpand"],enumDescriptions:[d(14010,null),d(14011,null)],default:"alwaysExpand"},"outline.problems.enabled":{markdownDescription:d(14015,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.problems.colors":{markdownDescription:d(14012,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.problems.badges":{markdownDescription:d(14013,null,"`#problems.visibility#`"),type:"boolean",default:!0},"outline.showFiles":{type:"boolean",scope:6,default:!0,markdownDescription:d(13991,null)},"outline.showModules":{type:"boolean",scope:6,default:!0,markdownDescription:d(13996,null)},"outline.showNamespaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(13997,null)},"outline.showPackages":{type:"boolean",default:!0,scope:6,markdownDescription:d(14002,null)},"outline.showClasses":{type:"boolean",default:!0,scope:6,markdownDescription:d(13984,null)},"outline.showMethods":{type:"boolean",default:!0,scope:6,markdownDescription:d(13995,null)},"outline.showProperties":{type:"boolean",default:!0,scope:6,markdownDescription:d(14003,null)},"outline.showFields":{type:"boolean",default:!0,scope:6,markdownDescription:d(13990,null)},"outline.showConstructors":{type:"boolean",default:!0,scope:6,markdownDescription:d(13986,null)},"outline.showEnums":{type:"boolean",default:!0,scope:6,markdownDescription:d(13987,null)},"outline.showInterfaces":{type:"boolean",default:!0,scope:6,markdownDescription:d(13993,null)},"outline.showFunctions":{type:"boolean",default:!0,scope:6,markdownDescription:d(13992,null)},"outline.showVariables":{type:"boolean",default:!0,scope:6,markdownDescription:d(14007,null)},"outline.showConstants":{type:"boolean",default:!0,scope:6,markdownDescription:d(13985,null)},"outline.showStrings":{type:"boolean",default:!0,scope:6,markdownDescription:d(14004,null)},"outline.showNumbers":{type:"boolean",default:!0,scope:6,markdownDescription:d(13999,null)},"outline.showBooleans":{type:"boolean",scope:6,default:!0,markdownDescription:d(13983,null)},"outline.showArrays":{type:"boolean",default:!0,scope:6,markdownDescription:d(13982,null)},"outline.showObjects":{type:"boolean",default:!0,scope:6,markdownDescription:d(14000,null)},"outline.showKeys":{type:"boolean",default:!0,scope:6,markdownDescription:d(13994,null)},"outline.showNull":{type:"boolean",default:!0,scope:6,markdownDescription:d(13998,null)},"outline.showEnumMembers":{type:"boolean",default:!0,scope:6,markdownDescription:d(13988,null)},"outline.showStructs":{type:"boolean",default:!0,scope:6,markdownDescription:d(14005,null)},"outline.showEvents":{type:"boolean",default:!0,scope:6,markdownDescription:d(13989,null)},"outline.showOperators":{type:"boolean",default:!0,scope:6,markdownDescription:d(14001,null)},"outline.showTypeParameters":{type:"boolean",default:!0,scope:6,markdownDescription:d(14006,null)}}});var Gqi="editor.detectLanguage",PIe=class{constructor(i,e,t,o,n,r){this._languageDetectionService=i;this._statusBarService=e;this._configurationService=t;this._editorService=o;this._languageService=n;this._keybindingService=r;this._disposables=new O;this._delayer=new Aa(1e3);this._renderDisposables=new O;o.onDidActiveEditorChange(()=>this._update(!0),this,this._disposables),this._update(!1)}static{this._id="status.languageDetectionStatus"}dispose(){this._disposables.dispose(),this._delayer.dispose(),this._combinedEntry?.dispose(),this._renderDisposables.dispose()}_update(i){i&&(this._combinedEntry?.dispose(),this._combinedEntry=void 0),this._delayer.trigger(()=>this._doUpdate())}async _doUpdate(){let i=da(this._editorService.activeTextEditorControl);this._renderDisposables.clear(),i?.onDidChangeModelLanguage(()=>this._update(!0),this,this._renderDisposables),i?.onDidChangeModelContent(()=>this._update(!1),this,this._renderDisposables);let e=i?.getModel(),t=e?.uri,o=e?.getLanguageId(),n=this._configurationService.getValue("workbench.editor.languageDetectionHints");if(!(typeof n=="object"&&n?.untitledEditors)||t?.scheme!==Q.untitled||!o||!t)this._combinedEntry?.dispose(),this._combinedEntry=void 0;else{let l=await this._languageDetectionService.detectLanguage(t),c={jsonc:"json"},u=e.getLanguageId();if(l&&l!==u&&c[u]!==l){let p=this._languageService.getLanguageName(l)||l,h=this._keybindingService.appendKeybinding(d(12608,null,p),Gqi),g={name:d(12606,null),ariaLabel:d(12605,null,l),tooltip:h,command:Gqi,text:"$(lightbulb-autofix)"};this._combinedEntry?this._combinedEntry.update(g):this._combinedEntry=this._statusBarService.addEntry(g,PIe._id,1,{location:{id:"status.editor.mode",priority:100.1},alignment:1,compact:!0})}else this._combinedEntry?.dispose(),this._combinedEntry=void 0}}};PIe=I([m(0,jS),m(1,Fr),m(2,B),m(3,ie),m(4,Rt),m(5,Le)],PIe);oe.as(Zi.Workbench).registerWorkbenchContribution(PIe,3);W(class extends z{constructor(){super({id:Gqi,title:P(12604,"Detect Language from Content"),f1:!0,precondition:C.and(cc.toNegated(),me.editorTextFocus),keybinding:{primary:1570,weight:200}})}async run(a){let i=a.get(ie),e=a.get(jS),t=da(i.activeTextEditorControl),o=a.get(Ne),n=t?.getModel()?.uri;if(n){let r=await e.detectLanguage(n);r?t.getModel()?.setLanguage(r,JXe):o.warn(d(12607,null))}}});var DXt=class{constructor(i,e){this.combined=i;this.dedicated=e}isEqual(i){return eo(this.combined,i.combined)&&eo(this.dedicated,i.dedicated)}},zmt=class{constructor(i,e){this._storageService=i;this._key=e}get value(){return this._storageService.getNumber(this._key,0,0)}increment(){let i=this.value+1;return this._storageService.store(this._key,i,0,1),i}};zmt=I([m(0,de)],zmt);var AIe=class extends k{constructor(e){super();this.editorGroupService=e;for(let t of e.parts)this.createLanguageStatus(t);this._register(e.onDidCreateAuxiliaryEditorPart(t=>this.createLanguageStatus(t)))}static{this.Id="status.languageStatus"}createLanguageStatus(e){let t=new O;U.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);t.add(o.createInstance(eD))}};AIe=I([m(0,kt)],AIe);var eD=class{constructor(i,e,t,o,n,r){this._languageStatusService=i;this._statusBarService=e;this._editorService=t;this._hoverService=o;this._openerService=n;this._storageService=r;this._disposables=new O;this._dedicated=new Set;this._dedicatedEntries=new Map;this._renderDisposables=new O;this._combinedEntryTooltip=document.createElement("div");r.onDidChangeValue(0,eD._keyDedicatedItems,this._disposables)(this._handleStorageChange,this,this._disposables),this._restoreState(),this._interactionCounter=new zmt(r,"languageStatus.interactCount"),i.onDidChange(this._update,this,this._disposables),t.onDidActiveEditorChange(this._update,this,this._disposables),this._update(),e.onDidChangeEntryVisibility(s=>{!s.visible&&this._dedicated.has(s.id)&&(this._dedicated.delete(s.id),this._update(),this._storeState())},void 0,this._disposables)}static{this._id="status.languageStatus"}static{this._keyDedicatedItems="languageStatus.dedicated"}dispose(){this._disposables.dispose(),this._combinedEntry?.dispose(),je(this._dedicatedEntries.values()),this._renderDisposables.dispose()}_handleStorageChange(){this._restoreState(),this._update()}_restoreState(){let i=this._storageService.get(eD._keyDedicatedItems,0,"[]");try{let e=JSON.parse(i);this._dedicated=new Set(e)}catch{this._dedicated.clear()}}_storeState(){if(this._dedicated.size===0)this._storageService.remove(eD._keyDedicatedItems,0);else{let i=JSON.stringify(Array.from(this._dedicated.keys()));this._storageService.store(eD._keyDedicatedItems,i,0,0)}}_createViewModel(i){if(!i?.hasModel())return new DXt([],[]);let e=this._languageStatusService.getLanguageStatus(i.getModel()),t=[],o=[];for(let n of e)this._dedicated.has(n.id)&&o.push(n),t.push(n);return new DXt(t,o)}_update(){let i=da(this._editorService.activeTextEditorControl),e=this._createViewModel(i);if(this._model?.isEqual(e))return;if(this._renderDisposables.clear(),this._model=e,i?.onDidChangeModelLanguage(this._update,this,this._renderDisposables),e.combined.length===0)this._combinedEntry?.dispose(),this._combinedEntry=void 0;else{let[o]=e.combined,n=o.severity>=wt.Warning,r=eD._severityToComboCodicon(o.severity),s=!1,l=[];for(let f of e.combined){let v=e.dedicated.includes(f);this._renderStatus(this._combinedEntryTooltip,f,n,v,this._renderDisposables),l.push(eD._accessibilityInformation(f).label),s=s||!v&&f.busy}let c={name:d(12612,null),ariaLabel:d(12611,null,l.join(", next: ")),tooltip:this._combinedEntryTooltip,command:i3,text:s?"$(loading~spin)":r};this._combinedEntry?this._combinedEntry.update(c):this._combinedEntry=this._statusBarService.addEntry(c,eD._id,1,{location:{id:"status.editor.mode",priority:100.1},alignment:0,compact:!0});let u=this._interactionCounter.value>=3,p=Me(i?.getContainerDomNode()),h=p.document.querySelector(".monaco-workbench .statusbar DIV#status\\.languageStatus A>SPAN.codicon"),g=p.document.querySelector(".monaco-workbench .statusbar DIV#status\\.languageStatus");if(go(h)&&g){let f="wiggle",v="flash";s?(h.classList.remove(f),g.classList.remove(v)):(h.classList.toggle(f,n||!u),this._renderDisposables.add($(h,"animationend",b=>h.classList.remove(f))),g.classList.toggle(v,n),this._renderDisposables.add($(g,"animationend",b=>g.classList.remove(v))))}if(!u){let f=p.document.querySelector(".monaco-workbench .context-view");if(go(f)){let v=new MutationObserver(()=>{p.document.contains(this._combinedEntryTooltip)&&(this._interactionCounter.increment(),v.disconnect())});v.observe(f,{childList:!0,subtree:!0}),this._renderDisposables.add(ee(()=>v.disconnect()))}}}let t=new Map;for(let o of e.dedicated){let n=eD._asStatusbarEntry(o),r=t.get(o.id)??this._dedicatedEntries.get(o.id);r?(r.update(n),this._dedicatedEntries.delete(o.id)):r=this._statusBarService.addEntry(n,o.id,1,{location:{id:"status.editor.mode",priority:100.1},alignment:1}),t.set(o.id,r)}je(this._dedicatedEntries.values()),this._dedicatedEntries=t}_renderStatus(i,e,t,o,n){let r=document.createElement("div");r.classList.add("hover-language-status"),i.appendChild(r),n.add(ee(()=>r.remove()));let s=document.createElement("div");s.classList.add("severity",`sev${e.severity}`),s.classList.toggle("show",t);let l=eD._severityToSingleCodicon(e.severity);D(s,...ir(l)),r.appendChild(s);let c=document.createElement("div");c.classList.add("element"),r.appendChild(c);let u=document.createElement("div");u.classList.add("left"),c.appendChild(u);let p=typeof e.label=="string"?e.label:e.label.value;D(u,...ir(NVo(p,e.busy))),this._renderTextPlus(u,e.detail,n);let h=document.createElement("div");h.classList.add("right"),c.appendChild(h);let{command:g}=e;g&&n.add(new Bg(h,{label:g.title,title:g.tooltip,href:A.from({scheme:"command",path:g.id,query:g.arguments&&JSON.stringify(g.arguments)}).toString()},{hoverDelegate:rC},this._hoverService,this._openerService));let f=new oo(h,{hoverDelegate:rC}),v=o?d(12616,null):d(12614,null);f.setAriaLabel(v),n.add(f);let b;return o?b=new it("unpin",v,q.asClassName(L.pinned),!0,()=>{this._dedicated.delete(e.id),this._statusBarService.updateEntryVisibility(e.id,!1),this._update(),this._storeState()}):b=new it("pin",v,q.asClassName(L.pin),!0,()=>{this._dedicated.add(e.id),this._statusBarService.updateEntryVisibility(e.id,!0),this._update(),this._storeState()}),f.push(b,{icon:!0,label:!1}),n.add(b),r}static _severityToComboCodicon(i){switch(i){case wt.Error:return"$(bracket-error)";case wt.Warning:return"$(bracket-dot)";default:return"$(bracket)"}}static _severityToSingleCodicon(i){switch(i){case wt.Error:return"$(error)";case wt.Warning:return"$(info)";default:return"$(check)"}}_renderTextPlus(i,e,t){let o=!1;for(let n of ZS(e).nodes)if(o||(D(i,_("span.separator")),o=!0),typeof n=="string"){let r=ir(n);D(i,...r)}else t.add(new Bg(i,n,void 0,this._hoverService,this._openerService))}static _accessibilityInformation(i){if(i.accessibilityInfo)return i.accessibilityInfo;let e=typeof i.label=="string"?i.label:i.label.value;return i.detail?{label:d(12609,null,e,i.detail)}:{label:d(12610,null,e)}}static _asStatusbarEntry(i){let e;i.severity===wt.Warning?e="warning":i.severity===wt.Error&&(e="error");let t=typeof i.label=="string"?i.label:i.label.shortValue;return{name:d(12613,null,i.name),text:NVo(t,i.busy),ariaLabel:eD._accessibilityInformation(i).label,role:i.accessibilityInfo?.role,tooltip:i.command?.tooltip||new he(i.detail,{isTrusted:!0,supportThemeIcons:!0}),kind:e,command:i.command}}};eD=I([m(0,$H),m(1,Fr),m(2,ie),m(3,ot),m(4,Je),m(5,de)],eD);var RXt=class extends z{constructor(){super({id:"editor.inlayHints.Reset",title:P(12615,"Reset Language Status Interaction Counter"),category:Fe.View,f1:!0})}run(i){i.get(de).remove("languageStatus.interactCount",0)}};function NVo(a,i){return z3i([a!==""&&a,i&&"$(loading~spin)"],"\xA0\xA0")}bt(AIe.Id,AIe,vt.AfterRestored);W(RXt);var LXt=class extends z{constructor(){super({id:"_signOutOfAccount",title:d(6005,null),f1:!1})}async run(i,{providerId:e,accountLabel:t}){let o=i.get(ks),n=i.get(RN),r=i.get(mE),s=i.get(ct);if(!e||!t)throw new Error("Invalid arguments. Expected: { providerId: string; accountLabel: string }");let c=(await o.getSessions(e)).filter(h=>h.account.label===t),u=n.readAccountUsages(e,t),{confirmed:p}=await s.confirm({type:wt.Info,message:u.length?d(6003,null,t,u.map(h=>h.extensionName).join(`
`)):d(6004,null,t),primaryButton:d(6002,null)});if(p){let h=c.map(g=>o.removeSession(e,g.id));await Promise.all(h),n.removeAccountUsage(e,t),r.removeAllowedExtensions(e,t)}}};var MXt=class extends z{constructor(){super({id:"_manageTrustedExtensionsForAccount",title:P(5983,"Manage Trusted Extensions For Account"),category:P(5979,"Accounts"),f1:!0})}run(i,e){return i.get(F).createInstance(Kmt).run(e)}},Kmt=class{constructor(i,e,t,o,n,r,s){this._extensionService=i;this._dialogService=e;this._quickInputService=t;this._authenticationService=o;this._authenticationQueryService=n;this._commandService=r;this._extensionsWorkbenchService=s;this._viewDetailsButton={tooltip:d(5989,null),iconClass:q.asClassName(L.info)};this._managePreferencesButton={tooltip:d(5978,null),iconClass:q.asClassName(L.settingsGear)}}async run(i){let e=await this._resolveAccountQuery(i?.providerId,i?.accountLabel);if(!e)return;let t=await this._getItems(e);if(!t.length)return;let o=this._createQuickPick(e);o.items=t,o.selectedItems=t.filter(n=>n.type!=="separator"&&!!n.picked),o.show()}async _resolveAccountQuery(i,e){if(i&&e)return this._authenticationQueryService.provider(i).account(e);let t=await this._getAllAvailableAccounts(),o=await this._quickInputService.pick(t,{placeHolder:d(5986,null),matchOnDescription:!0});return o?this._authenticationQueryService.provider(o.providerId).account(o.label):void 0}async _getAllAvailableAccounts(){let i=[];for(let e of this._authenticationService.getProviderIds()){let t=this._authenticationService.getProvider(e),o=await this._authenticationService.getSessions(e),n=new Set;for(let r of o)n.has(r.account.label)||(n.add(r.account.label),i.push({providerId:e,label:r.account.label,description:t.label}))}return i}async _getItems(i){let e=i.extensions().getAllowedExtensions(),t=new Map;(await Promise.all(e.map(u=>this._extensionService.getExtension(u.id)))).forEach((u,p)=>{u&&t.set(e[p].id,u.displayName||u.name)});let n=e.filter(u=>t.has(u.id)).map(u=>{let p=i.extension(u.id).getUsage();return{...u,name:t.get(u.id),lastUsed:p.length>0?Math.max(...p.map(h=>h.lastUsed)):u.lastUsed}});if(!n.length)return this._dialogService.info(d(5984,null)),[];let r=n.filter(u=>u.trusted),s=n.filter(u=>!u.trusted),l=(u,p)=>(p.lastUsed||0)-(u.lastUsed||0),c=this._toQuickPickItem.bind(this);return[...s.sort(l).map(c),{type:"separator",label:d(5987,null)},...r.sort(l).map(c)]}_toQuickPickItem(i){let e=i.lastUsed,t=e?d(5977,null,ea(e,!0)):d(5985,null),o,n;return i.trusted&&(o=d(5988,null),n=!0),{label:i.name,extension:i,description:t,tooltip:o,disabled:n,buttons:[this._viewDetailsButton,this._managePreferencesButton],picked:i.allowed===void 0||i.allowed}}_createQuickPick(i){let e=new O,t=e.add(this._quickInputService.createQuickPick({useSeparators:!0}));return t.canSelectMany=!0,t.customButton=!0,t.customLabel=d(5982,null),t.customButtonSecondary=!0,t.title=d(5981,null),t.placeholder=d(5980,null),e.add(t.onDidAccept(()=>{let o=t.items.filter(r=>r.type!=="separator").map(r=>r.extension),n=new Set(t.selectedItems.map(r=>r.extension));for(let r of o){let s=n.has(r);i.extension(r.id).setAccessAllowed(s,r.name)}t.hide()})),e.add(t.onDidHide(()=>e.dispose())),e.add(t.onDidCustom(()=>t.hide())),e.add(t.onDidTriggerItemButton(o=>{o.button===this._managePreferencesButton?this._commandService.executeCommand("_manageAccountPreferencesForExtension",o.item.extension.id,i.providerId):o.button===this._viewDetailsButton&&this._extensionsWorkbenchService.open(o.item.extension.id)})),t}};Kmt=I([m(0,lt),m(1,ct),m(2,$e),m(3,ks),m(4,gP),m(5,fe),m(6,Ui)],Kmt);var PXt=class extends z{constructor(){super({id:"_manageAccountPreferencesForExtension",title:P(5939,"Manage Extension Account Preferences..."),category:P(5937,"Accounts"),f1:!0,menu:[{id:R.AccountsContext,order:100}]})}run(i,e,t){return i.get(F).createInstance(Gmt).run(e,t)}},Gmt=class{constructor(i,e,t,o,n,r){this._authenticationService=i;this._quickInputService=e;this._dialogService=t;this._authenticationQueryService=o;this._extensionService=n;this._logService=r}async run(i,e){if(!i){let u=this._extensionService.extensions.filter(h=>this._authenticationQueryService.extension(h.identifier.value).getAllAccountPreferences().size>0).sort((h,g)=>(h.displayName??h.name).localeCompare(g.displayName??g.name));i=(await this._quickInputService.pick(u.map(h=>({label:h.displayName??h.name,id:h.identifier.value})),{placeHolder:d(5944,null),title:d(5942,null)}))?.id}if(!i)return;let t=await this._extensionService.getExtension(i);if(!t)throw new Error(`No extension with id ${i}`);if(!e){let p=await this._authenticationQueryService.extension(i).getProvidersWithAccess();if(!p.length){await this._dialogService.info(d(5941,null));return}if(e=p[0],p.length>1){let h=await this._quickInputService.pick(p.map(g=>({label:this._authenticationService.getProvider(g).label,id:g})),{placeHolder:d(5945,null),title:d(5942,null)});if(!h)return;e=h.id}}let o=await this._authenticationService.getAccounts(e),n=this._authenticationQueryService.provider(e).extension(i).getPreferredAccount(),r=this._getItems(o,e,n),s=this._authenticationService.getProvider(e);if(s.supportsMultipleAccounts){let u=o.flatMap(p=>this._authenticationQueryService.provider(e).account(p.label).extension(i).getUsage()).sort((p,h)=>h.lastUsed-p.lastUsed)[0]?.scopes;u&&(r.push({type:"separator"}),r.push({providerId:e,scopes:u,label:d(5947,null)}))}let l=new O,c=this._createQuickPick(l,i,t.displayName??t.name,s.label);if(r.length===0){l.add(this._handleNoAccounts(c));return}c.items=r,c.show()}_createQuickPick(i,e,t,o){let n=i.add(this._quickInputService.createQuickPick({useSeparators:!0}));return i.add(n.onDidHide(()=>{i.dispose()})),n.placeholder=d(5943,null,t,o),n.title=d(5946,null,t),n.sortByLabel=!1,i.add(n.onDidAccept(async()=>{n.hide(),await this._accept(e,n.selectedItems)})),n}_getItems(i,e,t){return i.map(o=>t===o.label?{label:o.label,account:o,providerId:e,description:d(5938,null),picked:!0}:{label:o.label,account:o,providerId:e})}_handleNoAccounts(i){return i.validationMessage=d(5940,null),i.buttons=[this._quickInputService.backButton],i.show(),U.filter(i.onDidTriggerButton,e=>e===this._quickInputService.backButton)(()=>this.run())}async _accept(i,e){for(let t of e){let o;if(t.account)o=t.account;else try{o=(await this._authenticationService.createSession(t.providerId,[...t.scopes])).account}catch(l){this._logService.error(l);continue}let n=t.providerId,r=this._authenticationQueryService.provider(n).extension(i);r.getPreferredAccount()!==o.label&&r.setPreferredAccount(o)}}};Gmt=I([m(0,ks),m(1,$e),m(2,ct),m(3,gP),m(4,lt),m(5,re)],Gmt);var AXt=class extends z{constructor(){super({id:"_manageAccountPreferencesForMcpServer",title:P(5950,"Manage MCP Server Account Preferences"),category:P(5948,"Accounts"),f1:!1})}run(i,e,t){return i.get(F).createInstance(qmt).run(e,t)}},qmt=class{constructor(i,e,t,o,n,r){this._authenticationService=i;this._quickInputService=e;this._dialogService=t;this._authenticationQueryService=o;this._mcpService=n;this._logService=r}async run(i,e){if(!i)return;let t=this._mcpService.servers.get().find(u=>u.definition.id===i);if(!t)throw new Error(`No MCP server with id ${i}`);if(!e){let p=await this._authenticationQueryService.mcpServer(i).getProvidersWithAccess();if(!p.length){await this._dialogService.info(d(5952,null));return}if(e=p[0],p.length>1){let h=await this._quickInputService.pick(p.map(g=>({label:this._authenticationService.getProvider(g).label,id:g})),{placeHolder:d(5955,null),title:d(5953,null)});if(!h)return;e=h.id}}let o=await this._authenticationService.getAccounts(e),n=this._authenticationQueryService.provider(e).mcpServer(i).getPreferredAccount(),r=this._getItems(o,e,n),s=this._authenticationService.getProvider(e);if(s.supportsMultipleAccounts){let u=o.flatMap(p=>this._authenticationQueryService.provider(e).account(p.label).mcpServer(i).getUsage()).sort((p,h)=>h.lastUsed-p.lastUsed)[0]?.scopes;u&&(r.push({type:"separator"}),r.push({providerId:e,scopes:u,label:d(5957,null)}))}let l=new O,c=this._createQuickPick(l,i,t.definition.label,s.label);if(r.length===0){l.add(this._handleNoAccounts(c));return}c.items=r,c.show()}_createQuickPick(i,e,t,o){let n=i.add(this._quickInputService.createQuickPick({useSeparators:!0}));return i.add(n.onDidHide(()=>{i.dispose()})),n.placeholder=d(5954,null,t,o),n.title=d(5956,null,t),n.sortByLabel=!1,i.add(n.onDidAccept(async()=>{n.hide(),await this._accept(e,n.selectedItems)})),n}_getItems(i,e,t){return i.map(o=>t===o.label?{label:o.label,account:o,providerId:e,description:d(5949,null),picked:!0}:{label:o.label,account:o,providerId:e})}_handleNoAccounts(i){return i.validationMessage=d(5951,null),i.buttons=[this._quickInputService.backButton],i.show(),U.filter(i.onDidTriggerButton,e=>e===this._quickInputService.backButton)(()=>this.run())}async _accept(i,e){for(let t of e){let o;if(t.account)o=t.account;else try{o=(await this._authenticationService.createSession(t.providerId,[...t.scopes])).account}catch(l){this._logService.error(l);continue}let n=t.providerId,r=this._authenticationQueryService.provider(n).mcpServer(i);r.getPreferredAccount()!==o.label&&r.setPreferredAccount(o)}}};qmt=I([m(0,ks),m(1,$e),m(2,ct),m(3,gP),m(4,Vs),m(5,re)],qmt);var NXt=class extends z{constructor(){super({id:"_manageTrustedMCPServersForAccount",title:P(5996,"Manage Trusted MCP Servers For Account"),category:P(5992,"Accounts"),f1:!0,precondition:C.and(Z.Setup.hidden.negate(),Z.Setup.disabledInWorkspace.negate())})}run(i,e){return i.get(F).createInstance($mt).run(e)}},$mt=class{constructor(i,e,t,o,n,r){this._mcpServerService=i;this._dialogService=e;this._quickInputService=t;this._mcpServerAuthenticationService=o;this._authenticationQueryService=n;this._commandService=r}async run(i){let e=await this._resolveAccountQuery(i?.providerId,i?.accountLabel);if(!e)return;let t=await this._getItems(e);if(!t.length)return;let o=this._createQuickPick(e);o.items=t,o.selectedItems=t.filter(n=>n.type!=="separator"&&!!n.picked),o.show()}async _resolveAccountQuery(i,e){if(i&&e)return this._authenticationQueryService.provider(i).account(e);let t=await this._getAllAvailableAccounts(),o=await this._quickInputService.pick(t,{placeHolder:d(5999,null),matchOnDescription:!0});return o?this._authenticationQueryService.provider(o.providerId).account(o.label):void 0}async _getAllAvailableAccounts(){let i=[];for(let e of this._mcpServerAuthenticationService.getProviderIds()){let t=this._mcpServerAuthenticationService.getProvider(e),o=await this._mcpServerAuthenticationService.getSessions(e),n=new Set;for(let r of o)n.has(r.account.label)||(n.add(r.account.label),i.push({providerId:e,label:r.account.label,description:t.label}))}return i}async _getItems(i){let e=i.mcpServers().getAllowedMcpServers(),t=new Map(this._mcpServerService.servers.get().map(l=>[l.definition.id,l.definition.label])),o=e.filter(l=>t.has(l.id)).map(l=>{let c=i.mcpServer(l.id).getUsage();return{...l,name:t.get(l.id),lastUsed:c.length>0?Math.max(...c.map(u=>u.lastUsed)):l.lastUsed}});if(!o.length)return this._dialogService.info(d(5997,null)),[];let n=o.filter(l=>l.trusted),r=o.filter(l=>!l.trusted),s=(l,c)=>(c.lastUsed||0)-(l.lastUsed||0);return[...r.sort(s).map(this._toQuickPickItem),{type:"separator",label:d(6000,null)},...n.sort(s).map(this._toQuickPickItem)]}_toQuickPickItem(i){let e=i.lastUsed,t=e?d(5990,null,ea(e,!0)):d(5998,null),o,n;return i.trusted&&(o=d(6001,null),n=!0),{label:i.name,mcpServer:i,description:t,tooltip:o,disabled:n,buttons:[{tooltip:d(5991,null),iconClass:q.asClassName(L.settingsGear)}],picked:i.allowed===void 0||i.allowed}}_createQuickPick(i){let e=new O,t=e.add(this._quickInputService.createQuickPick({useSeparators:!0}));return t.canSelectMany=!0,t.customButton=!0,t.customLabel=d(5995,null),t.customButtonSecondary=!0,t.title=d(5994,null),t.placeholder=d(5993,null),e.add(t.onDidAccept(()=>{t.hide();let o=t.items.filter(r=>r.type!=="separator").map(r=>r.mcpServer),n=new Set(t.selectedItems.map(r=>r.mcpServer));for(let r of o){let s=n.has(r);i.mcpServer(r.id).setAccessAllowed(s,r.name)}})),e.add(t.onDidHide(()=>e.dispose())),e.add(t.onDidCustom(()=>t.hide())),e.add(t.onDidTriggerItemButton(o=>this._commandService.executeCommand("_manageAccountPreferencesForMcpServer",o.item.mcpServer.id,i.providerId))),t}};$mt=I([m(0,Vs),m(1,ct),m(2,$e),m(3,ks),m(4,gP),m(5,fe)],$mt);var OXt=class a extends z{static{this.ID="workbench.action.removeDynamicAuthenticationProviders"}constructor(){super({id:a.ID,title:P(5975,"Remove Dynamic Authentication Providers"),category:P(5967,"Authentication"),f1:!0})}async run(i){let e=i.get($e),t=i.get(ote),o=i.get(ks),n=i.get(ct),r=t.getInteractedProviders();if(r.length===0){await n.info(d(5972,null),d(5973,null));return}let s=r.map(h=>({label:h.label,description:d(5968,null,h.clientId),provider:h})),l=await e.pick(s,{placeHolder:d(5976,null),canPickMany:!0});if(!l||l.length===0)return;let c=l.map(h=>h.provider.label).join(", "),u=l.length===1?d(5971,null,c):d(5970,null,l.length,c);if((await n.confirm({message:u,detail:d(5969,null),primaryButton:d(5974,null),type:"warning"})).confirmed)for(let h of l){let g=h.provider.providerId;o.isAuthenticationProviderRegistered(g)&&o.unregisterAuthenticationProvider(g),await t.removeDynamicProvider(g)}}};var FXt=class extends z{constructor(){super({id:"workbench.action.manageAccounts",title:P(5960,"Manage Accounts"),category:P(5958,"Accounts"),f1:!0})}run(i){return i.get(F).createInstance(jmt).run()}},jmt=class{constructor(i,e,t,o,n){this.quickInputService=i;this.authenticationService=e;this.commandService=t;this.secretStorageService=o;this.productService=n}async run(){let i=d(5964,null),e=await this.listAccounts();if(!e.length){await this.quickInputService.pick([{label:d(5963,null)}],{placeHolder:i});return}let t=await this.quickInputService.pick(e,{placeHolder:i,matchOnDescription:!0});t&&await this.showAccountActions(t)}async listAccounts(){let i=new uo(()=>ite(this.secretStorageService,this.productService)),e=[];for(let t of this.authenticationService.getProviderIds()){let o=this.authenticationService.getProvider(t);for(let{label:n,id:r}of await this.authenticationService.getAccounts(t))e.push({label:n,description:o.label,providerId:t,canUseMcp:!!o.authorizationServers?.length,canSignOut:async()=>this.canSignOut(o,r,await i.value)})}return e}async canSignOut(i,e,t){return t&&!t.canSignOut&&t.providerId===i.id?!(await this.authenticationService.getSessions(i.id)).some(n=>n.id===t.id&&n.account.id===e):!0}async showAccountActions(i){let{providerId:e,label:t,canUseMcp:o,canSignOut:n}=i,r=new O,s=r.add(this.quickInputService.createQuickPick());s.title=d(5959,null,t),s.placeholder=d(5965,null),s.buttons=[this.quickInputService.backButton];let l=[{label:d(5961,null),action:()=>this.commandService.executeCommand("_manageTrustedExtensionsForAccount",{providerId:e,accountLabel:t})}];o&&l.push({label:d(5962,null),action:()=>this.commandService.executeCommand("_manageTrustedMCPServersForAccount",{providerId:e,accountLabel:t})}),await n()&&l.push({label:d(5966,null),action:()=>this.commandService.executeCommand("_signOutOfAccount",{providerId:e,accountLabel:t})}),s.items=l,r.add(s.onDidAccept(()=>{let c=s.selectedItems[0];c&&(s.hide(),c.action())})),r.add(s.onDidTriggerButton(c=>{c===this.quickInputService.backButton&&this.run()})),r.add(s.onDidHide(()=>r.dispose())),s.show()}};jmt=I([m(0,$e),m(1,ks),m(2,fe),m(3,fC),m(4,Ze)],jmt);var cLn=Ge.registerCommand("workbench.getCodeExchangeProxyEndpoints",function(a,i){return a.get(Od).options?.codeExchangeProxyEndpoints}),qqi=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.authentication}render(e){let t=e.contributes?.authentication||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(6008,null),d(6007,null),d(6009,null)],n=t.sort((r,s)=>r.label.localeCompare(s.label)).map(r=>[r.label,r.id,(r.authorizationServerGlobs??[]).join(`,
`)]);return{data:{headers:o,rows:n},dispose:()=>{}}}},dLn=oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"authentication",label:d(6006,null),access:{canToggle:!1},renderer:new Vt(qqi)}),WXt=class extends k{static{this.ID="workbench.contrib.authentication"}constructor(){super(),this._register(cLn),this._register(dLn),this._registerActions()}_registerActions(){this._register(W(FXt)),this._register(W(LXt)),this._register(W(MXt)),this._register(W(PXt)),this._register(W(NXt)),this._register(W(AXt)),this._register(W(OXt))}},fqe=class{constructor(i){this._authenticationUsageService=i;this._initializeExtensionUsageCache()}static{this.ID="workbench.contrib.authenticationUsage"}async _initializeExtensionUsageCache(){await this._authenticationUsageService.initializeExtensionUsageCache()}};fqe=I([m(0,RN)],fqe);bt(WXt.ID,WXt,vt.AfterRestored);bt(fqe.ID,fqe,vt.Eventually);var vqe=class extends _R{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,o,n,r,s,l,c,u,p,h,g,y);this.editorService=t;this.userDataSyncService=f;this.userDataSyncWorkbenchService=v;this.userDataSyncEnablementService=b;this.userDataProfilesService=S;this._register(this.userDataSyncService.onDidChangeConflicts(()=>this.treeView.refresh())),this.registerActions()}renderTreeView(e){super.renderTreeView(D(e,_("")));let t=this;this.treeView.message=d(17751,null),this.treeView.dataProvider={getChildren(){return t.getTreeItems()}}}async getTreeItems(){let e=[],t=this.userDataSyncService.conflicts.map(n=>n.conflicts.map(r=>({...r,syncResource:n.syncResource,profile:n.profile}))).flat().sort((n,r)=>n.profile.id===r.profile.id?0:n.profile.isDefault?-1:r.profile.isDefault?1:n.profile.name.localeCompare(r.profile.name)),o=[];for(let n of t){let r=o[o.length-1]?.[0].id===n.profile.id?o[o.length-1][1]:void 0;r||o.push([n.profile,r=[]]),r.push(n)}for(let[n,r]of o){let s=[];for(let l of r){let c=JSON.stringify(l),u={handle:c,resourceUri:l.remoteResource,label:{label:Be(l.remoteResource),strikethrough:l.mergeState==="accepted"&&(l.localChange===3||l.remoteChange===3)},description:wb(l.syncResource),collapsibleState:0,command:{id:"workbench.actions.sync.openConflicts",title:"",arguments:[{$treeViewId:"",$treeItemHandle:c}]},contextValue:"sync-conflict-resource"};s.push(u)}e.push({handle:n.id,label:{label:n.name},collapsibleState:2,children:s})}return o.length===1&&o[0][0].isDefault?e[0].children??[]:e}parseHandle(e){let t=JSON.parse(e);return{syncResource:t.syncResource,profile:iC(t.profile,this.userDataProfilesService.profilesHome.scheme),localResource:A.revive(t.localResource),remoteResource:A.revive(t.remoteResource),baseResource:A.revive(t.baseResource),previewResource:A.revive(t.previewResource),acceptedResource:A.revive(t.acceptedResource),localChange:t.localChange,remoteChange:t.remoteChange,mergeState:t.mergeState}}registerActions(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.actions.sync.openConflicts",title:d(17757,null)})}async run(o,n){let r=e.parseHandle(n.$treeItemHandle);return e.open(r)}})),this._register(W(class extends z{constructor(){super({id:"workbench.actions.sync.acceptRemote",title:d(17756,null),icon:L.cloudDownload,menu:{id:R.ViewItemContext,when:C.and(C.equals("view",uie),C.equals("viewItem","sync-conflict-resource")),group:"inline",order:1}})}async run(o,n){let r=e.parseHandle(n.$treeItemHandle);await e.userDataSyncWorkbenchService.accept({syncResource:r.syncResource,profile:r.profile},r.remoteResource,void 0,e.userDataSyncEnablementService.isEnabled())}})),this._register(W(class extends z{constructor(){super({id:"workbench.actions.sync.acceptLocal",title:d(17755,null),icon:L.cloudUpload,menu:{id:R.ViewItemContext,when:C.and(C.equals("view",uie),C.equals("viewItem","sync-conflict-resource")),group:"inline",order:2}})}async run(o,n){let r=e.parseHandle(n.$treeItemHandle);await e.userDataSyncWorkbenchService.accept({syncResource:r.syncResource,profile:r.profile},r.localResource,void 0,e.userDataSyncEnablementService.isEnabled())}}))}async open(e){if(!this.userDataSyncService.conflicts.some(({conflicts:n})=>n.some(({localResource:r})=>ze(r,e.localResource))))return;let t=d(17753,null,Be(e.remoteResource)),o=d(17752,null,Be(e.remoteResource));await this.editorService.openEditor({input1:{resource:e.remoteResource,label:d(17754,null),description:t},input2:{resource:e.localResource,label:d(17758,null),description:o},base:{resource:e.baseResource},result:{resource:e.previewResource},options:{preserveFocus:!0,revealIfVisible:!0,pinned:!0,override:Da.id}})}};vqe=I([m(1,ie),m(2,Le),m(3,Xe),m(4,B),m(5,X),m(6,ji),m(7,F),m(8,Je),m(9,Pe),m(10,Ne),m(11,ot),m(12,ny),m(13,ry),m(14,Yl),m(15,hn),m(16,tPe)],vqe);var bqe=class extends k{constructor(e,t,o,n,r){super();this.instantiationService=t;this.userDataSyncEnablementService=o;this.userDataSyncMachinesService=n;this.userDataSyncService=r;this.registerViews(e)}registerViews(e){this.registerConflictsView(e),this.registerActivityView(e,!0),this.registerMachinesView(e),this.registerActivityView(e,!1),this.registerTroubleShootView(e),this.registerExternalActivityView(e)}registerConflictsView(e){let t=oe.as(Kn.ViewsRegistry),o=P(17760,"Conflicts"),n={id:uie,name:o,ctorDescriptor:new Vt(vqe),when:C.and(U1t,die),canToggleVisibility:!1,canMoveView:!1,treeView:this.instantiationService.createInstance(GG,uie,o.value),collapsed:!1,order:100};t.registerViews([n],e)}registerMachinesView(e){let t="workbench.views.sync.machines",o=P(17776,"Synced Machines"),n=this.instantiationService.createInstance(GG,t,o.value),r=this.instantiationService.createInstance(Xmt,n);n.showRefreshAction=!0,n.canSelectMany=!0,n.dataProvider=r,this._register(U.any(this.userDataSyncMachinesService.onDidChange,this.userDataSyncService.onDidResetRemote)(()=>n.refresh()));let s=oe.as(Kn.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Vt(_R),when:C.and(bw.notEqualsTo("uninitialized"),NU.isEqualTo("available"),gge),canToggleVisibility:!0,canMoveView:!1,treeView:n,collapsed:!1,order:300};s.registerViews([l],e),this._register(W(class extends z{constructor(){super({id:"workbench.actions.sync.editMachineName",title:d(17783,null),icon:L.edit,menu:{id:R.ViewItemContext,when:C.and(C.equals("view",t)),group:"inline"}})}async run(c,u){await r.rename(u.$treeItemHandle)&&await n.refresh()}})),this._register(W(class extends z{constructor(){super({id:"workbench.actions.sync.turnOffSyncOnMachine",title:d(17787,null),menu:{id:R.ViewItemContext,when:C.and(C.equals("view",t),C.equals("viewItem","sync-machine"))}})}async run(c,u,p){await r.disable((p||[u]).map(h=>h.$treeItemHandle))&&await n.refresh()}}))}registerActivityView(e,t){let o=`workbench.views.sync.${t?"remote":"local"}Activity`,n=t?P(17769,"Sync Activity (Remote)"):P(17765,"Sync Activity (Local)"),r=this.instantiationService.createInstance(GG,o,n.value);r.showCollapseAllAction=!0,r.showRefreshAction=!0,r.dataProvider=t?this.instantiationService.createInstance(Qmt):this.instantiationService.createInstance($qi),this._register(U.any(this.userDataSyncEnablementService.onDidChangeResourceEnablement,this.userDataSyncEnablementService.onDidChangeEnablement,this.userDataSyncService.onDidResetLocal,this.userDataSyncService.onDidResetRemote)(()=>r.refresh()));let s=oe.as(Kn.ViewsRegistry),l={id:o,name:n,ctorDescriptor:new Vt(_R),when:C.and(bw.notEqualsTo("uninitialized"),NU.isEqualTo("available"),gge),canToggleVisibility:!0,canMoveView:!1,treeView:r,collapsed:!1,order:t?200:400,hideByDefault:!t};s.registerViews([l],e),this.registerDataViewActions(o)}registerExternalActivityView(e){let t="workbench.views.sync.externalActivity",o=P(17762,"Sync Activity (Developer)"),n=this.instantiationService.createInstance(Ymt,void 0),r=this.instantiationService.createInstance(GG,t,o.value);r.showCollapseAllAction=!1,r.showRefreshAction=!1,r.dataProvider=n;let s=oe.as(Kn.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Vt(_R),when:gge,canToggleVisibility:!0,canMoveView:!1,treeView:r,collapsed:!1,hideByDefault:!1};s.registerViews([l],e),this._register(W(class extends z{constructor(){super({id:"workbench.actions.sync.loadActivity",title:d(17784,null),icon:L.cloudUpload,menu:{id:R.ViewTitle,when:C.equals("view",t),group:"navigation"}})}async run(c){let p=await c.get(nn).showOpenDialog({title:d(17773,null),canSelectFiles:!0,canSelectFolders:!0,canSelectMany:!1});p?.[0]&&(n.activityDataResource=p[0],await r.refresh())}}))}registerDataViewActions(e){this._register(W(class extends z{constructor(){super({id:`workbench.actions.sync.${e}.resolveResource`,title:d(17786,null),menu:{id:R.ViewItemContext,when:C.and(C.equals("view",e),C.regex("viewItem",/sync-resource-.*/i))}})}async run(t,o){let{resource:n}=JSON.parse(o.$treeItemHandle);await t.get(ie).openEditor({resource:A.parse(n),options:{pinned:!0}})}})),this._register(W(class extends z{constructor(){super({id:`workbench.actions.sync.${e}.compareWithLocal`,title:d(17782,null),menu:{id:R.ViewItemContext,when:C.and(C.equals("view",e),C.regex("viewItem",/sync-associatedResource-.*/i))}})}async run(t,o){let n=t.get(fe),{resource:r,comparableResource:s}=JSON.parse(o.$treeItemHandle),l=A.parse(r),c=A.parse(s);return n.executeCommand(ik,l,c,d(17770,null,d(17764,null,Be(l)),d(17772,null,Be(c))),void 0)}})),this._register(W(class extends z{constructor(){super({id:`workbench.actions.sync.${e}.replaceCurrent`,title:d(17785,null),icon:L.discard,menu:{id:R.ViewItemContext,when:C.and(C.equals("view",e),C.regex("viewItem",/sync-resource-.*/i),C.notEquals("viewItem","sync-resource-profiles")),group:"inline"}})}async run(t,o){let n=t.get(ct),r=t.get(ny),{syncResourceHandle:s,syncResource:l}=JSON.parse(o.$treeItemHandle);if((await n.confirm({message:d(17759,null,wb(l)),type:"info",title:ug.value})).confirmed)return r.replace({created:s.created,uri:A.revive(s.uri)})}}))}registerTroubleShootView(e){let t="workbench.views.sync.troubleshoot",o=P(17777,"Troubleshoot"),n=this.instantiationService.createInstance(GG,t,o.value),r=this.instantiationService.createInstance(Jmt);n.showRefreshAction=!0,n.dataProvider=r;let s=oe.as(Kn.ViewsRegistry),l={id:t,name:o,ctorDescriptor:new Vt(_R),when:gge,canToggleVisibility:!0,canMoveView:!1,treeView:n,collapsed:!1,order:500,hideByDefault:!0};s.registerViews([l],e)}};bqe=I([m(1,F),m(2,Yl),m(3,mie),m(4,ny)],bqe);var NIe=class{constructor(i,e,t,o,n,r){this.userDataSyncService=i;this.userDataSyncResourceProviderService=e;this.userDataAutoSyncService=t;this.userDataSyncWorkbenchService=o;this.notificationService=n;this.userDataProfilesService=r;this.syncResourceHandlesByProfile=new Map}async getChildren(i){try{if(!i)return await this.getRoots();if(i.profile||i.handle===this.userDataProfilesService.defaultProfile.id){let e=this.syncResourceHandlesByProfile.get(i.handle);return e||this.syncResourceHandlesByProfile.set(i.handle,e=this.getSyncResourceHandles(i.profile)),await e}return i.syncResourceHandle?await this.getChildrenForSyncResourceTreeItem(i):[]}catch(e){throw e instanceof Cf||(e=Cf.toUserDataSyncError(e)),e instanceof Cf&&e.code==="IncompatibleRemoteContent"?this.notificationService.notify({severity:ft.Error,message:e.message,actions:{primary:[li({id:"reset",label:d(17771,null),run:()=>this.userDataSyncWorkbenchService.resetSyncedData()})]}}):this.notificationService.error(e),e}}async getRoots(){this.syncResourceHandlesByProfile.clear();let i=[],e=await this.getProfiles();if(e.length){let t={handle:this.userDataProfilesService.defaultProfile.id,label:{label:this.userDataProfilesService.defaultProfile.name},collapsibleState:2};i.push(t)}else{let t=await this.getSyncResourceHandles();i.push(...t)}for(let t of e){let o={handle:t.id,label:{label:t.name},collapsibleState:1,profile:t};i.push(o)}return i}async getChildrenForSyncResourceTreeItem(i){let e=i.syncResourceHandle,t=await this.userDataSyncResourceProviderService.getAssociatedResources(e),o=e.previous?await this.userDataSyncResourceProviderService.getAssociatedResources(e.previous):[];return t.map(({resource:n,comparableResource:r})=>{let s=JSON.stringify({resource:n.toString(),comparableResource:r.toString()}),l=o.find(c=>Be(c.resource)===Be(n))?.resource;return{handle:s,collapsibleState:0,resourceUri:n,command:l?{id:ik,title:"",arguments:[l,n,d(17774,null,`${Be(n)} (${ea(e.previous.created,!0)})`,`${Be(n)} (${ea(e.created,!0)})`),void 0]}:{id:Xg,title:"",arguments:[n,void 0,void 0]},contextValue:`sync-associatedResource-${e.syncResource}`}})}async getSyncResourceHandles(i){let e=[],o=(await Promise.all(rge.map(async n=>{let r=await this.getResourceHandles(n,i);return r.map((s,l)=>({...s,syncResource:n,previous:r[l+1]}))}))).flat().sort((n,r)=>r.created-n.created);for(let n of o){let r=JSON.stringify({syncResourceHandle:n,syncResource:n.syncResource});e.push({handle:r,collapsibleState:1,label:{label:wb(n.syncResource)},description:ea(n.created,!0),tooltip:new Date(n.created).toLocaleString(),themeIcon:W5,syncResourceHandle:n,contextValue:`sync-resource-${n.syncResource}`})}return e}};NIe=I([m(0,ny),m(1,cAe),m(2,T_),m(3,ry),m(4,Ne),m(5,hn)],NIe);var $qi=class extends NIe{getResourceHandles(i,e){return this.userDataSyncResourceProviderService.getLocalSyncResourceHandles(i,e)}async getProfiles(){return this.userDataProfilesService.profiles.filter(i=>!i.isDefault).map(i=>({id:i.id,collection:i.id,name:i.name}))}},Qmt=class extends NIe{constructor(e,t,o,n,r,s,l){super(e,t,o,r,s,l);this.userDataSyncMachinesService=n}async getChildren(e){return e||(this.machinesPromise=void 0),super.getChildren(e)}getMachines(){return this.machinesPromise===void 0&&(this.machinesPromise=this.userDataSyncMachinesService.getMachines()),this.machinesPromise}getResourceHandles(e,t){return this.userDataSyncResourceProviderService.getRemoteSyncResourceHandles(e,t)}getProfiles(){return this.userDataSyncResourceProviderService.getRemoteSyncedProfiles()}async getChildrenForSyncResourceTreeItem(e){let t=await super.getChildrenForSyncResourceTreeItem(e);if(t.length){let o=await this.userDataSyncResourceProviderService.getMachineId(e.syncResourceHandle);if(o){let r=(await this.getMachines()).find(({id:s})=>s===o);t[0].description=r?.isCurrent?d(17761,null):r?.name}}return t}};Qmt=I([m(0,ny),m(1,cAe),m(2,T_),m(3,mie),m(4,ry),m(5,Ne),m(6,hn)],Qmt);var Ymt=class extends NIe{constructor(e,t,o,n,r,s,l,c,u){super(t,o,n,r,s,l);this.activityDataResource=e;this.fileService=c;this.uriIdentityService=u}async getChildren(e){if(!e){if(this.machinesPromise=void 0,!this.activityDataResource)return[];if((await this.fileService.resolve(this.activityDataResource)).isDirectory)this.activityDataLocation=this.activityDataResource;else{this.activityDataLocation=this.uriIdentityService.extUri.joinPath(this.uriIdentityService.extUri.dirname(this.activityDataResource),"remoteActivity");try{await this.fileService.del(this.activityDataLocation,{recursive:!0})}catch{}await this.userDataSyncService.extractActivityData(this.activityDataResource,this.activityDataLocation)}}return super.getChildren(e)}getResourceHandles(e,t){return this.userDataSyncResourceProviderService.getLocalSyncResourceHandles(e,t,this.activityDataLocation)}async getProfiles(){return this.userDataSyncResourceProviderService.getLocalSyncedProfiles(this.activityDataLocation)}async getChildrenForSyncResourceTreeItem(e){let t=await super.getChildrenForSyncResourceTreeItem(e);if(t.length){let o=await this.userDataSyncResourceProviderService.getMachineId(e.syncResourceHandle);if(o){let r=(await this.getMachines()).find(({id:s})=>s===o);t[0].description=r?.isCurrent?d(17761,null):r?.name}}return t}getMachines(){return this.machinesPromise===void 0&&(this.machinesPromise=this.userDataSyncResourceProviderService.getLocalSyncedMachines(this.activityDataLocation)),this.machinesPromise}};Ymt=I([m(1,ny),m(2,cAe),m(3,T_),m(4,ry),m(5,Ne),m(6,hn),m(7,ge),m(8,gt)],Ymt);var Xmt=class{constructor(i,e,t,o,n,r){this.treeView=i;this.userDataSyncMachinesService=e;this.quickInputService=t;this.notificationService=o;this.dialogService=n;this.userDataSyncWorkbenchService=r}async getChildren(i){i||(this.machinesPromise=void 0);try{let e=await this.getMachines();return e=e.filter(t=>!t.disabled).sort((t,o)=>t.isCurrent?-1:1),this.treeView.message=e.length?void 0:d(17766,null),e.map(({id:t,name:o,isCurrent:n,platform:r})=>({handle:t,collapsibleState:0,label:{label:o},description:n?d(17761,null):void 0,themeIcon:r&&vbo(r)?L.globe:L.vm,contextValue:"sync-machine"}))}catch(e){return this.notificationService.error(e),[]}}getMachines(){return this.machinesPromise===void 0&&(this.machinesPromise=this.userDataSyncMachinesService.getMachines()),this.machinesPromise}async disable(i){let t=(await this.getMachines()).filter(({id:r})=>i.includes(r));if(!t.length)throw new Error(d(17767,null,i.join(",")));if(!(await this.dialogService.confirm({type:"info",message:t.length>1?d(17780,null):d(17779,null,t[0].name),primaryButton:d(17778,null)})).confirmed)return!1;t.some(r=>r.isCurrent)&&await this.userDataSyncWorkbenchService.turnoff(!1);let n=t.filter(r=>!r.isCurrent).map(r=>[r.id,!1]);return n.length&&await this.userDataSyncMachinesService.setEnablements(n),!0}async rename(i){let e=new O,t=e.add(this.quickInputService.createInputBox());t.placeholder=d(17768,null),t.busy=!0,t.show();let o=await this.getMachines(),n=o.find(({id:l})=>l===i),r=o.filter(({disabled:l})=>!l);if(!n)throw t.hide(),e.dispose(),new Error(d(17767,null,i));t.busy=!1,t.value=n.name;let s=l=>(l=l.trim(),l&&!r.some(c=>c.id!==i&&c.name===l)?l:null);return e.add(t.onDidChangeValue(()=>t.validationMessage=s(t.value)?"":d(17781,null))),new Promise((l,c)=>{e.add(t.onDidAccept(async()=>{let u=s(t.value);if(e.dispose(),u&&u!==n.name)try{await this.userDataSyncMachinesService.renameMachine(i,u),l(!0)}catch(p){c(p)}else l(!1)}))})}};Xmt=I([m(1,mie),m(2,$e),m(3,Ne),m(4,ct),m(5,ry)],Xmt);var Jmt=class{constructor(i,e,t,o){this.fileService=i;this.userDataSyncWorkbenchService=e;this.environmentService=t;this.uriIdentityService=o}async getChildren(i){return i?i.handle==="LAST_SYNC_STATES"?this.getLastSyncStates():i.handle==="SYNC_LOGS"?this.getSyncLogs():[]:[{handle:"SYNC_LOGS",collapsibleState:1,label:{label:d(17775,null)},themeIcon:L.folder},{handle:"LAST_SYNC_STATES",collapsibleState:1,label:{label:d(17763,null)},themeIcon:L.folder}]}async getLastSyncStates(){let i=[];for(let e of rge){let t=qit(void 0,e,this.environmentService,this.uriIdentityService.extUri);await this.fileService.exists(t)&&i.push({handle:t.toString(),label:{label:wb(e)},collapsibleState:0,resourceUri:t,command:{id:Xg,title:"",arguments:[t,void 0,void 0]}})}return i}async getSyncLogs(){let i=await this.userDataSyncWorkbenchService.getAllLogResources(),e=[];for(let t of i){let o=this.uriIdentityService.extUri.dirname(t);e.push({handle:t.toString(),collapsibleState:0,resourceUri:t,label:{label:this.uriIdentityService.extUri.basename(o)},description:this.uriIdentityService.extUri.isEqual(o,this.environmentService.logsHome)?d(17761,null):void 0,command:{id:Xg,title:"",arguments:[t,void 0,void 0]}})}return e}};Jmt=I([m(0,ge),m(1,ry),m(2,ko),m(3,gt)],Jmt);var VXt={id:"workbench.userDataSync.actions.turnOff",title:P(17719,"Turn Off")},BXt={id:bot,title:P(17681,"Configure...")},OVo="workbench.userDataSync.actions.showConflicts",Zmt={id:"workbench.userDataSync.actions.syncNow",title:P(17723,"Sync Now"),description(a){if(a.status==="syncing")return d(17726,null);if(a.lastSyncTime)return d(17725,null,ea(a.lastSyncTime,!0))}},HXt={id:"workbench.userDataSync.actions.settings",title:P(17724,"Show Settings")},UXt={id:"workbench.userDataSync.actions.showSyncedData",title:P(17712,"Show Synced Data")},zXt=new Y("userDataSyncTurningOn",!1),Sqe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V){super();this.userDataSyncEnablementService=e;this.userDataSyncService=t;this.userDataSyncWorkbenchService=o;this.activityService=r;this.notificationService=s;this.editorService=l;this.userDataProfileService=c;this.dialogService=u;this.quickInputService=p;this.instantiationService=h;this.outputService=g;this.preferencesService=b;this.telemetryService=S;this.productService=y;this.openerService=w;this.authenticationService=x;this.userDataSyncStoreManagementService=E;this.hostService=M;this.commandService=N;this.workbenchIssueService=V;this.globalActivityBadgeDisposable=this._register(new ue);this.accountBadgeDisposable=this._register(new ue);this.conflictsDisposables=new Map;this.invalidContentErrorDisposables=new Map;this.conflictsActionDisposable=this._register(new ue);this.turningOnSyncContext=zXt.bindTo(n),o.enabled&&(Jvo(),this.updateAccountBadge(),this.updateGlobalActivityBadge(),this.onDidChangeConflicts(this.userDataSyncService.conflicts),this._register(U.any(U.debounce(t.onDidChangeStatus,()=>{},500),this.userDataSyncEnablementService.onDidChangeEnablement,this.userDataSyncWorkbenchService.onDidChangeAccountStatus)(()=>{this.updateAccountBadge(),this.updateGlobalActivityBadge()})),this._register(t.onDidChangeConflicts(()=>this.onDidChangeConflicts(this.userDataSyncService.conflicts))),this._register(e.onDidChangeEnablement(()=>this.onDidChangeConflicts(this.userDataSyncService.conflicts))),this._register(t.onSyncErrors(H=>this.onSynchronizerErrors(H))),this._register(f.onError(H=>this.onAutoSyncError(H))),this.registerActions(),this.registerViews(),v.registerTextModelContentProvider(lk,h.createInstance(eht)),this._register(U.any(t.onDidChangeStatus,e.onDidChangeEnablement)(()=>this.turningOnSync=!e.isEnabled()&&t.status!=="idle")))}get turningOnSync(){return!!this.turningOnSyncContext.get()}set turningOnSync(e){this.turningOnSyncContext.set(e),this.updateGlobalActivityBadge()}toKey({syncResource:e,profile:t}){return`${t.id}:${e}`}onDidChangeConflicts(e){if(this.updateGlobalActivityBadge(),this.registerShowConflictsAction(),!!this.userDataSyncEnablementService.isEnabled())if(e.length){for(let[t,o]of this.conflictsDisposables.entries())e.some(n=>this.toKey(n)===t)||(o.dispose(),this.conflictsDisposables.delete(t));for(let t of this.userDataSyncService.conflicts){let o=this.toKey(t);if(!this.conflictsDisposables.has(o)){let n=wb(t.syncResource),r=this.notificationService.prompt(ft.Warning,d(17684,null,n.toLowerCase()),[{label:d(17700,null),run:()=>{this.acceptLocal(t,t.conflicts[0])}},{label:d(17699,null),run:()=>{this.acceptRemote(t,t.conflicts[0])}},{label:d(17708,null),run:()=>{this.telemetryService.publicLog2("sync/showConflicts",{source:t.syncResource}),this.userDataSyncWorkbenchService.showConflicts(t.conflicts[0])}}],{sticky:!0});this.conflictsDisposables.set(o,ee(()=>{r.close(),this.conflictsDisposables.delete(o)}))}}}else this.conflictsDisposables.forEach(t=>t.dispose()),this.conflictsDisposables.clear()}async acceptRemote(e,t){try{await this.userDataSyncService.accept(e,t.remoteResource,void 0,this.userDataSyncEnablementService.isEnabled())}catch{this.notificationService.error(d(17675,null,`command:${BW}`))}}async acceptLocal(e,t){try{await this.userDataSyncService.accept(e,t.localResource,void 0,this.userDataSyncEnablementService.isEnabled())}catch{this.notificationService.error(d(17675,null,`command:${BW}`))}}onAutoSyncError(e){switch(e.code){case"SessionExpired":this.notificationService.notify({severity:ft.Info,message:d(17707,null),actions:{primary:[li({id:"turn on sync",label:d(17737,null),run:()=>this.turnOn()})]}});break;case"TurnedOff":this.notificationService.notify({severity:ft.Info,message:d(17738,null),actions:{primary:[li({id:"turn on sync",label:d(17737,null),run:()=>this.turnOn()})]}});break;case"TooLarge":if(e.resource==="keybindings"||e.resource==="settings"||e.resource==="tasks"){this.disableSync(e.resource);let t=wb(e.resource);this.handleTooLargeError(e.resource,d(17727,null,t.toLowerCase(),t.toLowerCase(),"100kb"),e)}break;case"LocalTooManyProfiles":this.disableSync("profiles"),this.notificationService.error(d(17729,null));break;case"IncompatibleLocalContent":case"Gone":case"UpgradeRequired":{let t=d(17689,null,this.productService.version,this.productService.commit),o=e.operationId?d(17698,null,e.operationId):void 0;this.notificationService.notify({severity:ft.Error,message:o?`${t} ${o}`:t});break}case"MethodNotFound":{let t=d(17695,null),o=e.operationId?d(17698,null,e.operationId):void 0;this.notificationService.notify({severity:ft.Error,message:o?`${t} ${o}`:t,actions:{primary:[li({id:"Show Sync Logs",label:d(17711,null),run:()=>this.commandService.executeCommand(BW)}),li({id:"Report Issue",label:d(17701,null),run:()=>this.workbenchIssueService.openReporter()})]}});break}case"IncompatibleRemoteContent":this.notificationService.notify({severity:ft.Error,message:d(17687,null),actions:{primary:[li({id:"reset",label:d(17702,null),run:()=>this.userDataSyncWorkbenchService.resetSyncedData()}),li({id:"show synced data",label:d(17713,null),run:()=>this.userDataSyncWorkbenchService.showSyncActivity()})]}});return;case"ServiceChanged":this.notificationService.notify({severity:ft.Info,message:this.userDataSyncStoreManagementService.userDataSyncStore?.type==="insiders"?d(17705,null):d(17706,null)});return;case"DefaultServiceChanged":this.userDataSyncEnablementService.isEnabled()?this.notificationService.notify({severity:ft.Info,message:d(17741,null)}):this.notificationService.notify({severity:ft.Info,message:d(17704,null,this.productService.nameLong),actions:{primary:[li({id:"turn on sync",label:d(17737,null),run:()=>this.turnOn()})]}});return}}handleTooLargeError(e,t,o){let n=o.operationId?d(17698,null,o.operationId):void 0;this.notificationService.notify({severity:ft.Error,message:n?`${t} ${n}`:t,actions:{primary:[li({id:"open sync file",label:d(17697,null,wb(e)),run:()=>e==="settings"?this.preferencesService.openUserSettings({jsonEditor:!0}):this.preferencesService.openGlobalKeybindingSettings(!0)})]}})}onSynchronizerErrors(e){if(e.length)for(let{profile:t,syncResource:o,error:n}of e)if(n.code==="LocalInvalidContent")this.handleInvalidContentError({profile:t,syncResource:o});else{let r=`${t.id}:${o}`,s=this.invalidContentErrorDisposables.get(r);s&&(s.dispose(),this.invalidContentErrorDisposables.delete(r))}else this.invalidContentErrorDisposables.forEach(t=>t.dispose()),this.invalidContentErrorDisposables.clear()}handleInvalidContentError({profile:e,syncResource:t}){if(this.userDataProfileService.currentProfile.id!==e.id)return;let o=`${e.id}:${t}`;if(this.invalidContentErrorDisposables.has(o)||t!=="settings"&&t!=="keybindings"&&t!=="tasks"||!this.hostService.hasFocus)return;let n=t==="settings"?this.userDataProfileService.currentProfile.settingsResource:t==="keybindings"?this.userDataProfileService.currentProfile.keybindingsResource:this.userDataProfileService.currentProfile.tasksResource,r=po.getCanonicalUri(this.editorService.activeEditor,{supportSideBySide:1});if(ze(n,r))return;let s=wb(t),l=this.notificationService.notify({severity:ft.Error,message:d(17691,null,s.toLowerCase()),actions:{primary:[li({id:"open sync file",label:d(17697,null,s),run:()=>t==="settings"?this.preferencesService.openUserSettings({jsonEditor:!0}):this.preferencesService.openGlobalKeybindingSettings(!0)})]}});this.invalidContentErrorDisposables.set(o,ee(()=>{l.close(),this.invalidContentErrorDisposables.delete(o)}))}getConflictsCount(){return this.userDataSyncService.conflicts.reduce((e,{conflicts:t})=>e+t.length,0)}async updateGlobalActivityBadge(){this.globalActivityBadgeDisposable.clear();let e;this.userDataSyncService.conflicts.length&&this.userDataSyncEnablementService.isEnabled()?e=new eu(this.getConflictsCount(),()=>d(17693,null,ug.value)):this.turningOnSync&&(e=new Jx(()=>d(17740,null))),e&&(this.globalActivityBadgeDisposable.value=this.activityService.showGlobalActivity({badge:e}))}async updateAccountBadge(){this.accountBadgeDisposable.clear();let e;this.userDataSyncService.status!=="uninitialized"&&this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncWorkbenchService.accountStatus==="unavailable"&&(e=new eu(1,()=>d(17717,null))),e&&(this.accountBadgeDisposable.value=this.activityService.showAccountsActivity({badge:e}))}async turnOn(){try{if(!this.userDataSyncWorkbenchService.authenticationProviders.length)throw new Error(d(17696,null));if(!await this.askToConfigure())return;this.userDataSyncStoreManagementService.userDataSyncStore?.canSwitch&&await this.selectSettingsSyncService(this.userDataSyncStoreManagementService.userDataSyncStore),await this.userDataSyncWorkbenchService.turnOn()}catch(e){if(Yi(e))return;if(e instanceof Cf){switch(e.code){case"TooLarge":if(e.resource==="keybindings"||e.resource==="settings"||e.resource==="tasks"){this.handleTooLargeError(e.resource,d(17728,null,wb(e.resource).toLowerCase(),"100kb"),e);return}break;case"IncompatibleLocalContent":case"Gone":case"UpgradeRequired":{let t=d(17690,null,this.productService.version,this.productService.commit),o=e.operationId?d(17698,null,e.operationId):void 0;this.notificationService.notify({severity:ft.Error,message:o?`${t} ${o}`:t});return}case"IncompatibleRemoteContent":this.notificationService.notify({severity:ft.Error,message:d(17688,null),actions:{primary:[li({id:"reset",label:d(17702,null),run:()=>this.userDataSyncWorkbenchService.resetSyncedData()}),li({id:"show synced data",label:d(17713,null),run:()=>this.userDataSyncWorkbenchService.showSyncActivity()})]}});return;case"Unauthorized":case"Forbidden":this.notificationService.error(d(17676,null));return}this.notificationService.error(d(17736,null,`command:${BW}`))}else this.notificationService.error(d(17735,null,Dn(e)))}}async askToConfigure(){return new Promise((e,t)=>{let o=new O,n=this.quickInputService.createQuickPick();o.add(n),n.title=ug.value,n.ok=!1,n.customButton=!0,n.customLabel=d(17715,null),n.description=d(17680,null),n.canSelectMany=!0,n.ignoreFocusOut=!0,n.hideInput=!0,n.hideCheckAll=!0;let r=this.getConfigureSyncQuickPickItems();n.items=r,n.selectedItems=r.filter(l=>this.userDataSyncEnablementService.isResourceEnabled(l.id,!0));let s=!1;o.add(U.any(n.onDidAccept,n.onDidCustom)(()=>{s=!0,n.hide()})),o.add(n.onDidHide(()=>{try{s&&this.updateConfiguration(r,n.selectedItems),e(s)}catch(l){t(l)}finally{o.dispose()}})),n.show()})}getConfigureSyncQuickPickItems(){return[{id:"settings",label:wb("settings")},{id:"keybindings",label:wb("keybindings")},{id:"snippets",label:wb("snippets")},{id:"tasks",label:wb("tasks")},{id:"mcp",label:wb("mcp")},{id:"globalState",label:wb("globalState")},{id:"extensions",label:wb("extensions")},{id:"profiles",label:wb("profiles")},{id:"prompts",label:wb("prompts")}]}updateConfiguration(e,t){for(let o of e){let n=this.userDataSyncEnablementService.isResourceEnabled(o.id),r=!!t.filter(s=>s.id===o.id)[0];n!==r&&this.userDataSyncEnablementService.setResourceEnablement(o.id,r)}}async configureSyncOptions(){return new Promise((e,t)=>{let o=new O,n=this.quickInputService.createQuickPick();o.add(n),n.title=d(17683,null,ug.value),n.placeholder=d(17682,null),n.canSelectMany=!0,n.ignoreFocusOut=!0,n.ok=!0;let r=this.getConfigureSyncQuickPickItems();n.items=r,n.selectedItems=r.filter(s=>this.userDataSyncEnablementService.isResourceEnabled(s.id)),o.add(n.onDidAccept(async()=>{n.selectedItems.length&&(this.updateConfiguration(r,n.selectedItems),n.hide())})),o.add(n.onDidHide(()=>{o.dispose(),e()})),n.show()})}async turnOff(){let e=await this.dialogService.confirm({message:d(17732,null),detail:d(17733,null),primaryButton:d(17730,null),checkbox:this.userDataSyncWorkbenchService.accountStatus==="available"?{label:d(17734,null)}:void 0});if(e.confirmed)return this.userDataSyncWorkbenchService.turnoff(!!e.checkboxChecked)}disableSync(e){switch(e){case"settings":return this.userDataSyncEnablementService.setResourceEnablement("settings",!1);case"keybindings":return this.userDataSyncEnablementService.setResourceEnablement("keybindings",!1);case"snippets":return this.userDataSyncEnablementService.setResourceEnablement("snippets",!1);case"tasks":return this.userDataSyncEnablementService.setResourceEnablement("tasks",!1);case"extensions":return this.userDataSyncEnablementService.setResourceEnablement("extensions",!1);case"globalState":return this.userDataSyncEnablementService.setResourceEnablement("globalState",!1);case"profiles":return this.userDataSyncEnablementService.setResourceEnablement("profiles",!1)}}showSyncActivity(){return this.outputService.showChannel(age)}async selectSettingsSyncService(e){return new Promise((t,o)=>{let n=new O,r=n.add(this.quickInputService.createQuickPick());r.title=d(17721,null,ug.value),r.description=d(17720,null),r.hideInput=!0,r.ignoreFocusOut=!0;let s=l=>{if(ze(l,e.defaultUrl))return d(17685,null)};r.items=[{id:"insiders",label:d(17694,null),description:s(e.insidersUrl)},{id:"stable",label:d(17718,null),description:s(e.stableUrl)}],n.add(r.onDidAccept(async()=>{try{await this.userDataSyncStoreManagementService.switch(r.selectedItems[0].id),t()}catch(l){o(l)}finally{r.hide()}})),n.add(r.onDidHide(()=>n.dispose())),r.show()})}registerActions(){this.userDataSyncEnablementService.canToggleEnablement()&&(this.registerTurnOnSyncAction(),this.registerTurnOffSyncAction()),this.registerTurningOnSyncAction(),this.registerCancelTurnOnSyncAction(),this.registerSignInAction(),this.registerShowConflictsAction(),this.registerEnableSyncViewsAction(),this.registerManageSyncAction(),this.registerSyncNowAction(),this.registerConfigureSyncAction(),this.registerShowSettingsAction(),this.registerHelpAction(),this.registerShowLogAction(),this.registerResetSyncDataAction(),this.registerAcceptMergesAction(),Ft&&this.registerDownloadSyncActivityAction()}registerTurnOnSyncAction(){let e=this,t=C.and(bw.notEqualsTo("uninitialized"),NR.toNegated(),zXt.negate());this._register(W(class extends z{constructor(){super({id:"workbench.userDataSync.actions.turnOn",title:P(17692,"Backup and Sync Settings..."),category:ug,f1:!0,precondition:t,menu:[{group:"3_configuration",id:R.GlobalActivity,when:t,order:2},{group:"3_configuration",id:R.MenubarPreferencesMenu,when:t,order:2},{group:"1_settings",id:R.AccountsContext,when:t,order:2}]})}async run(){return e.turnOn()}}))}registerTurningOnSyncAction(){let e=C.and(bw.notEqualsTo("uninitialized"),NR.toNegated(),zXt);this._register(W(class extends z{constructor(){super({id:"workbench.userData.actions.turningOn",title:d(17739,null),precondition:C.false(),menu:[{group:"3_configuration",id:R.GlobalActivity,when:e,order:2},{group:"1_settings",id:R.AccountsContext,when:e}]})}async run(){}}))}registerCancelTurnOnSyncAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.userData.actions.cancelTurnOn",title:d(17677,null),icon:L.stopCircle,menu:{id:R.ViewContainerTitle,when:C.and(zXt,C.equals("viewContainer",OU)),group:"navigation",order:1}})}async run(){return e.userDataSyncWorkbenchService.turnoff(!1)}}))}registerSignInAction(){let e=this,t="workbench.userData.actions.signin",o=C.and(bw.notEqualsTo("uninitialized"),NR,NU.isEqualTo("unavailable"));this._register(W(class extends z{constructor(){super({id:"workbench.userData.actions.signin",title:d(17716,null),menu:{group:"3_configuration",id:R.GlobalActivity,when:o,order:2}})}async run(){try{await e.userDataSyncWorkbenchService.signIn()}catch(r){e.notificationService.error(r)}}})),this._register(be.appendMenuItem(R.AccountsContext,{group:"1_settings",command:{id:t,title:d(17714,null)},when:o}))}getShowConflictsTitle(){return P(17703,"Show Conflicts ({0})",this.getConflictsCount())}registerShowConflictsAction(){this.conflictsActionDisposable.value=void 0;let e=this;this.conflictsActionDisposable.value=W(class extends z{constructor(){super({id:OVo,get title(){return e.getShowConflictsTitle()},category:ug,f1:!0,precondition:die,menu:[{group:"3_configuration",id:R.GlobalActivity,when:die,order:2},{group:"3_configuration",id:R.MenubarPreferencesMenu,when:die,order:2}]})}async run(){return e.userDataSyncWorkbenchService.showConflicts()}})}registerManageSyncAction(){let e=this,t=C.and(NR,NU.notEqualsTo("unavailable"),bw.notEqualsTo("uninitialized"));this._register(W(class extends z{constructor(){super({id:"workbench.userDataSync.actions.manage",title:d(17722,null),toggled:My.INSTANCE,menu:[{id:R.GlobalActivity,group:"3_configuration",when:t,order:2},{id:R.MenubarPreferencesMenu,group:"3_configuration",when:t,order:2},{id:R.AccountsContext,group:"1_settings",when:t}]})}run(n){return new Promise((r,s)=>{let l=n.get($e),c=n.get(fe),u=new O,p=l.createQuickPick({useSeparators:!0});u.add(p);let h=[];if(e.userDataSyncService.conflicts.length&&(h.push({id:OVo,label:`${ug.value}: ${e.getShowConflictsTitle().original}`}),h.push({type:"separator"})),h.push({id:BXt.id,label:`${ug.value}: ${BXt.title.original}`}),h.push({id:HXt.id,label:`${ug.value}: ${HXt.title.original}`}),h.push({id:UXt.id,label:`${ug.value}: ${UXt.title.original}`}),h.push({type:"separator"}),h.push({id:Zmt.id,label:`${ug.value}: ${Zmt.title.original}`,description:Zmt.description(e.userDataSyncService)}),e.userDataSyncEnablementService.canToggleEnablement()){let g=e.userDataSyncWorkbenchService.current;h.push({id:VXt.id,label:`${ug.value}: ${VXt.title.original}`,description:g?`${g.accountName} (${e.authenticationService.getProvider(g.authenticationProviderId).label})`:void 0})}p.items=h,u.add(p.onDidAccept(()=>{p.selectedItems[0]&&p.selectedItems[0].id&&c.executeCommand(p.selectedItems[0].id),p.hide()})),u.add(p.onDidHide(()=>{u.dispose(),r()})),p.show()})}}))}registerEnableSyncViewsAction(){let e=this,t=C.and(NU.isEqualTo("available"),bw.notEqualsTo("uninitialized"));this._register(W(class extends z{constructor(){super({id:UXt.id,title:UXt.title,category:ug,precondition:t,menu:{id:R.CommandPalette,when:t}})}run(n){return e.userDataSyncWorkbenchService.showSyncActivity()}}))}registerSyncNowAction(){let e=this;this._register(W(class extends z{constructor(){super({id:Zmt.id,title:Zmt.title,category:ug,menu:{id:R.CommandPalette,when:C.and(NR,NU.isEqualTo("available"),bw.notEqualsTo("uninitialized"))}})}run(o){return e.userDataSyncWorkbenchService.syncNow()}}))}registerTurnOffSyncAction(){let e=this;this._register(W(class extends z{constructor(){super({id:VXt.id,title:VXt.title,category:ug,menu:{id:R.CommandPalette,when:C.and(bw.notEqualsTo("uninitialized"),NR)}})}async run(){try{await e.turnOff()}catch(o){Yi(o)||e.notificationService.error(d(17731,null,`command:${BW}`))}}}))}registerConfigureSyncAction(){let e=this,t=C.and(bw.notEqualsTo("uninitialized"),NR);this._register(W(class extends z{constructor(){super({id:BXt.id,title:BXt.title,category:ug,icon:L.settingsGear,tooltip:d(17679,null),menu:[{id:R.CommandPalette,when:t},{id:R.ViewContainerTitle,when:C.and(NR,C.equals("viewContainer",OU)),group:"navigation",order:2}]})}run(){return e.configureSyncOptions()}}))}registerShowLogAction(){let e=this;this._register(W(class extends z{constructor(){super({id:BW,title:d(17709,null,ug.value),tooltip:d(17710,null),icon:L.output,menu:[{id:R.CommandPalette,when:C.and(bw.notEqualsTo("uninitialized"))},{id:R.ViewContainerTitle,when:C.equals("viewContainer",OU),group:"navigation",order:1}]})}run(){return e.showSyncActivity()}}))}registerShowSettingsAction(){this._register(W(class extends z{constructor(){super({id:HXt.id,title:HXt.title,category:ug,menu:{id:R.CommandPalette,when:C.and(bw.notEqualsTo("uninitialized"))}})}run(t){t.get(Qo).openUserSettings({jsonEditor:!1,query:"@tag:sync"})}}))}registerHelpAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.userDataSync.actions.help",title:ug,category:Fe.Help,menu:[{id:R.CommandPalette,when:C.and(bw.notEqualsTo("uninitialized"))}]})}run(){return e.openerService.open(A.parse("https://aka.ms/vscode-settings-sync-help"))}})),be.appendMenuItem(R.ViewContainerTitle,{command:{id:"workbench.userDataSync.actions.help",title:Fe.Help.value},when:C.equals("viewContainer",OU),group:"1_help"})}registerAcceptMergesAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.userDataSync.actions.acceptMerges",title:d(17678,null),menu:[{id:R.EditorContent,when:C.and(TNt,C.regex(DNt.key,new RegExp(`^${lk}:`)))}]})}async run(o,n){let r=o.get(Uo);await r.save(n);let s=await r.read(n);await e.userDataSyncService.accept(this.getSyncResource(n),n,s.value,!0)}getSyncResource(o){let n=e.userDataSyncService.conflicts.find(({conflicts:r})=>r.some(s=>ze(s.previewResource,o)));if(n)return n;throw new Error(`Unknown resource: ${o.toString()}`)}}))}registerDownloadSyncActivityAction(){this._register(W(class extends z{constructor(){super(z1t)}async run(t){let o=t.get(ry),n=t.get(Ne);await o.downloadSyncActivity()&&n.info(d(17686,null))}}))}registerViews(){let e=this.registerViewContainer();this.registerDataViews(e)}registerViewContainer(){return oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:OU,title:ug,ctorDescriptor:new Vt(Qc,[OU,{mergeViewWithContainerWhenSingleView:!0}]),icon:cbo,hideIfEmpty:!0},0)}registerResetSyncDataAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.actions.syncData.reset",title:d(17742,null),menu:[{id:R.ViewContainerTitle,when:C.equals("viewContainer",OU),group:"0_configure"}]})}run(){return e.userDataSyncWorkbenchService.resetSyncedData()}}))}registerDataViews(e){this._register(this.instantiationService.createInstance(bqe,e))}};Sqe=I([m(0,Yl),m(1,ny),m(2,ry),m(3,X),m(4,Al),m(5,Ne),m(6,ie),m(7,gn),m(8,ct),m(9,$e),m(10,F),m(11,Tl),m(12,T_),m(13,Bt),m(14,Qo),m(15,_e),m(16,Ze),m(17,Je),m(18,ks),m(19,uP),m(20,ti),m(21,fe),m(22,R_)],Sqe);var eht=class{constructor(i,e,t){this.userDataSyncService=i;this.modelService=e;this.languageService=t}provideTextContent(i){return i.scheme===lk?this.userDataSyncService.resolveContent(i).then(e=>this.modelService.createModel(e||"",this.languageService.createById("jsonc"),i)):null}};eht=I([m(0,ny),m(1,_t),m(2,Rt)],eht);var Iqe=class extends k{constructor(e,t,o,n,r){super();this.userDataProfilesService=t;let s=U.filter(U.any(U.map(e.onDidActiveEditorChange,()=>this.getUserDataEditorInputSource(e.activeEditor)),U.map(U.filter(o.onDidChangeViewContainerVisibility,l=>l.id===Rh&&l.visible),l=>l.id)),l=>l!==void 0);Ft?this._register(U.debounce(U.any(U.map(r.onDidChangeFocus,()=>"windowFocus"),U.map(s,l=>l)),(l,c)=>l?[...l,c]:[c],1e3)(l=>n.triggerSync(l,{skipIfSyncedRecently:!0}))):this._register(s(l=>n.triggerSync([l],{skipIfSyncedRecently:!0})))}getUserDataEditorInputSource(e){if(!e)return;if(e instanceof PR)return"settingsEditor";if(e instanceof MR)return"keybindingsEditor";let t=e.resource;if(ze(t,this.userDataProfilesService.defaultProfile.settingsResource))return"settingsEditor";if(ze(t,this.userDataProfilesService.defaultProfile.keybindingsResource))return"keybindingsEditor"}};Iqe=I([m(0,ie),m(1,hn),m(2,Gt),m(3,T_),m(4,ti)],Iqe);var tht=class extends k{constructor(e,t,o,n,r){super();this.notificationService=t;this.productService=o;this.commandService=n;this.hostService=r;this._register(e.onError(s=>this.onAutoSyncError(s)))}onAutoSyncError(e){switch(e.code){case"LocalTooManyRequests":{let t=Ft?d(17743,null,this.productService.nameLong):d(17744,null,this.productService.nameLong);this.notificationService.notify({severity:ft.Error,message:t,actions:{primary:[li({id:"Show Sync Logs",label:d(17750,null),run:()=>this.commandService.executeCommand(BW)}),li({id:"Restart",label:Ft?d(17746,null):d(17747,null),run:()=>this.hostService.restart()})]}});return}case"RemoteTooManyRequests":{let t=e.operationId?d(17745,null,e.operationId):void 0,o=d(17748,null);this.notificationService.notify({severity:ft.Error,message:t?`${o} ${t}`:o,source:e.operationId?d(17749,null,e.operationId):void 0,actions:{primary:[li({id:"Show Sync Logs",label:d(17750,null),run:()=>this.commandService.executeCommand(BW)})]}});return}}}};tht=I([m(0,T_),m(1,Ne),m(2,Ze),m(3,fe),m(4,ti)],tht);var jqi=oe.as(Zi.Workbench);jqi.registerWorkbenchContribution(Sqe,3);jqi.registerWorkbenchContribution(Iqe,4);jqi.registerWorkbenchContribution(tht,4);var uLn=/^([^@:]+@)?([^:]+):/,pLn=/^([^@:]+@)?([^:]+):(.+)$/,mLn=/^([^@]+@)?([^:]+)(:\d+)?$/,hLn=/([^@:.]+\.[^@:.]+)(:\d+)?$/,VVo=/^\s*url\s*=\s*(.+\S)\s*$/mg,gLn=/[^.]/g,BVo=["github.com","bitbucket.org","visualstudio.com","gitlab.com","heroku.com","azurewebsites.net","ibm.com","amazon.com","amazonaws.com","cloudapp.net","rhcloud.com","google.com","azure.com"];function FVo(a){let i=a.match(hLn);return i?i[1]:null}function fLn(a){if(a.indexOf("://")===-1){let i=a.match(uLn);return i?FVo(i[2]):null}try{let i=A.parse(a);if(i.authority)return FVo(i.authority)}catch{}return null}function HVo(a,i){let e=new Set,t;for(;t=VVo.exec(a);){let n=fLn(t[1]);n&&e.add(n)}let o=new Set(i);return Array.from(e).map(n=>o.has(n)?n:n.replace(gLn,"a"))}function vLn(a){let i=a.match(mLn);return i?i[2]:null}function WVo(a,i,e){return a&&i?(e&&i.endsWith(".git")&&(i=i.substr(0,i.length-4)),i.indexOf("/")===0?`${a}${i}`:`${a}/${i}`):null}function bLn(a,i){if(a.indexOf("://")===-1){let e=a.match(pLn);if(e)return WVo(e[2],e[3],i)}try{let e=A.parse(a);if(e.authority)return WVo(vLn(e.authority),e.path,i)}catch{}return null}function UVo(a,i=!1){let e=[],t;for(;t=VVo.exec(a);){let o=bLn(t[1],i);o&&e.push(o)}return e}var yqe=le("workspaceTagsService");async function zVo(a,i=!1,e){return Promise.all(UVo(a,i).map(t=>e(t)))}var KXt=class{constructor(i,e,t){this.userDataProfileService=i;this.fileService=e;this.logService=t}async initialize(i){let e=JSON.parse(i);if(!e.mcp){this.logService.info("Initializing Profile: No MCP servers to apply...");return}await this.fileService.writeFile(this.userDataProfileService.currentProfile.mcpResource,Ke.fromString(e.mcp))}};KXt=I([m(0,gn),m(1,ge),m(2,re)],KXt);var fae=class{constructor(i,e){this.fileService=i;this.logService=e}async getContent(i){let e=await this.getMcpResourceContent(i);return JSON.stringify(e)}async getMcpResourceContent(i){return{mcp:await this.getMcpContent(i)}}async apply(i,e){let t=JSON.parse(i);if(!t.mcp){this.logService.info(`Importing Profile (${e.name}): No MCP servers to apply...`);return}await this.fileService.writeFile(e.mcpResource,Ke.fromString(t.mcp))}async getMcpContent(i){try{return(await this.fileService.readFile(i.mcpResource)).value.toString()}catch(e){if(e instanceof ua&&e.fileOperationResult===1)return null;throw e}}};fae=I([m(0,ge),m(1,re)],fae);var wqe=class{constructor(i,e,t){this.profile=i;this.uriIdentityService=e;this.instantiationService=t;this.type="mcp";this.handle="mcp";this.label={label:d(19525,null)};this.collapsibleState=2}async getChildren(){return[{handle:this.profile.mcpResource.toString(),resourceUri:this.profile.mcpResource,collapsibleState:0,parent:this,accessibilityInformation:{label:this.uriIdentityService.extUri.basename(this.profile.mcpResource)},command:{id:Xg,title:"",arguments:[this.profile.mcpResource,void 0,void 0]}}]}async hasContent(){return(await this.instantiationService.createInstance(fae).getMcpResourceContent(this.profile)).mcp!==null}async getContent(){return this.instantiationService.createInstance(fae).getContent(this.profile)}isFromDefaultProfile(){return!this.profile.isDefault&&!!this.profile.useDefaultFlags?.mcp}};wqe=I([m(1,gt),m(2,F)],wqe);function Yqi(a){return a.resourceType!==void 0}function KVo(a){return a.label!==void 0}var KO=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.userDataProfileManagementService=s;this.userDataProfilesService=l;this.commandService=c;this.workspaceContextService=u;this.hostService=p;this.uriIdentityService=h;this.fileService=g;this.extensionManagementService=f;this.instantiationService=v;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.saveScheduler=this._register(new Dt(()=>this.doSave(),500));this._name="";this._active=!1;this._disabled=!1;this._name=e,this._icon=t,this._flags=o,this._workspaces=n,this._active=r,this._register(this.onDidChange(b=>{b.message||this.validate(),this.save()})),this._register(this.extensionManagementService.onProfileAwareDidInstallExtensions(b=>{let S=this.getProfileToWatch();S&&b.some(y=>!y.error&&(y.applicationScoped||this.uriIdentityService.extUri.isEqual(y.profileLocation,S.extensionsResource)))&&this._onDidChange.fire({extensions:!0})})),this._register(this.extensionManagementService.onProfileAwareDidUninstallExtension(b=>{let S=this.getProfileToWatch();S&&!b.error&&(b.applicationScoped||this.uriIdentityService.extUri.isEqual(b.profileLocation,S.extensionsResource))&&this._onDidChange.fire({extensions:!0})})),this._register(this.extensionManagementService.onProfileAwareDidUpdateExtensionMetadata(b=>{let S=this.getProfileToWatch();(S&&b.local.isApplicationScoped||this.uriIdentityService.extUri.isEqual(b.profileLocation,S?.extensionsResource))&&this._onDidChange.fire({extensions:!0})}))}get name(){return this._name}set name(e){e=e.trim(),this._name!==e&&(this._name=e,this._onDidChange.fire({name:!0}))}get icon(){return this._icon}set icon(e){this._icon!==e&&(this._icon=e,this._onDidChange.fire({icon:!0}))}get workspaces(){return this._workspaces}set workspaces(e){eo(this._workspaces,e,(t,o)=>t.toString()===o.toString())||(this._workspaces=e,this._onDidChange.fire({workspaces:!0}))}get flags(){return this._flags}set flags(e){Qi(this._flags,e)||(this._flags=e,this._onDidChange.fire({flags:!0}))}get active(){return this._active}set active(e){this._active!==e&&(this._active=e,this._onDidChange.fire({active:!0}))}get message(){return this._message}set message(e){this._message!==e&&(this._message=e,this._onDidChange.fire({message:!0}))}get disabled(){return this._disabled}set disabled(e){this._disabled!==e&&(this._disabled=e,this._onDidChange.fire({disabled:!0}))}getFlag(e){return this.flags?.[e]??!1}setFlag(e,t){let o=this.flags?{...this.flags}:{};t?o[e]=!0:delete o[e],this.flags=o}validate(){if(!this.name){this.message=d(17667,null);return}if(this.shouldValidateName()&&this.name!==this.getInitialName()&&this.userDataProfilesService.profiles.some(e=>e.name===this.name)){this.message=d(17672,null,this.name);return}if(this.flags&&this.flags.settings&&this.flags.keybindings&&this.flags.tasks&&this.flags.snippets&&this.flags.extensions){this.message=d(17666,null);return}this.message=void 0}async getChildren(e){if(e===void 0){let t=["settings","keybindings","tasks","mcp","snippets","extensions"];return Promise.all(t.map(async o=>{let n=o==="settings"||o==="keybindings"||o==="tasks"||o==="mcp"?await this.getChildrenForResourceType(o):[];return{handle:o,checkbox:void 0,resourceType:o,openAction:n.length?li({id:"_open",label:d(17669,null),class:q.asClassName(L.goToFile),run:()=>n[0]?.openAction?.run()}):void 0}}))}return this.getChildrenForResourceType(e)}async getChildrenForResourceType(e){return[]}async getChildrenFromProfile(e,t){e=this.getFlag(t)?this.userDataProfilesService.defaultProfile:e;let o=[];switch(t){case"settings":o=await this.instantiationService.createInstance(nQ,e).getChildren();break;case"keybindings":o=await this.instantiationService.createInstance(rQ,e).getChildren();break;case"snippets":o=await this.instantiationService.createInstance(sQ,e).getChildren()??[];break;case"tasks":o=await this.instantiationService.createInstance(aQ,e).getChildren();break;case"mcp":o=await this.instantiationService.createInstance(wqe,e).getChildren();break;case"extensions":o=await this.instantiationService.createInstance(lQ,e).getChildren();break}return o.map(n=>this.toUserDataProfileResourceChildElement(n))}toUserDataProfileResourceChildElement(e,t,o){return{handle:e.handle,checkbox:e.checkbox,label:e.label?yr(e.label.label)?e.label.label.value:e.label.label:"",description:We(e.description)?e.description:void 0,resource:A.revive(e.resourceUri),icon:e.themeIcon,openAction:li({id:"_openChild",label:d(17669,null),class:q.asClassName(L.goToFile),run:async()=>{e.parent.type==="extensions"?await this.commandService.executeCommand("extension.open",e.handle,void 0,!0,void 0,!0):e.resourceUri&&await this.commandService.executeCommand(Xg,e.resourceUri,[En],void 0)}}),actions:{primary:t,contextMenu:o}}}getInitialName(){return""}shouldValidateName(){return!0}getCurrentWorkspace(){let e=this.workspaceContextService.getWorkspace();return e.configuration??e.folders[0]?.uri}openWorkspace(e){this.uriIdentityService.extUri.extname(e)===kQe?this.hostService.openWindow([{workspaceUri:e}],{forceNewWindow:!0}):this.hostService.openWindow([{folderUri:e}],{forceNewWindow:!0})}save(){this.saveScheduler.schedule()}hasUnsavedChanges(e){return this.name!==e.name||this.icon!==e.icon||!Qi(this.flags??{},e.useDefaultFlags??{})||!eo(this.workspaces??[],e.workspaces??[],(t,o)=>t.toString()===o.toString())}async saveProfile(e){if(!this.hasUnsavedChanges(e)||(this.validate(),this.message))return;let t=this.flags?this.flags.settings&&this.flags.keybindings&&this.flags.tasks&&this.flags.globalState&&this.flags.extensions?void 0:this.flags:void 0;return await this.userDataProfileManagementService.updateProfile(e,{name:this.name,icon:this.icon,useDefaultFlags:e.useDefaultFlags&&!t?{}:t,workspaces:this.workspaces})}};KO=I([m(5,s_),m(6,hn),m(7,fe),m(8,Ae),m(9,ti),m(10,gt),m(11,ge),m(12,Dd),m(13,F)],KO);var Gm=class extends KO{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super(e.name,e.icon,e.useDefaultFlags,e.workspaces,n.currentProfile.id===e.id,s,l,c,u,p,h,g,f,v);this._profile=e;this.titleButtons=t;this.actions=o;this.userDataProfileService=n;this.configurationService=r;this._isNewWindowProfile=!1;this._isNewWindowProfile=this.configurationService.getValue(fN)===this.profile.name,this._register(r.onDidChangeConfiguration(b=>{b.affectsConfiguration(fN)&&(this.isNewWindowProfile=this.configurationService.getValue(fN)===this.profile.name)})),this._register(this.userDataProfileService.onDidChangeCurrentProfile(()=>this.active=this.userDataProfileService.currentProfile.id===this.profile.id)),this._register(this.userDataProfilesService.onDidChangeProfiles(({updated:b})=>{let S=b.find(y=>y.id===this.profile.id);S&&(this._profile=S,this.reset(),this._onDidChange.fire({profile:!0}))})),this._register(g.watch(this.profile.snippetsHome)),this._register(g.onDidFilesChange(b=>{b.affects(this.profile.snippetsHome)&&this._onDidChange.fire({snippets:!0})}))}get profile(){return this._profile}getProfileToWatch(){return this.profile}reset(){this.name=this._profile.name,this.icon=this._profile.icon,this.flags=this._profile.useDefaultFlags,this.workspaces=this._profile.workspaces}updateWorkspaces(e,t){let o=new xn(this.workspaces??[]);for(let n of e)o.add(n);for(let n of t)o.delete(n);this.workspaces=[...o.values()]}async toggleNewWindowProfile(){this._isNewWindowProfile?await this.configurationService.updateValue(fN,null):await this.configurationService.updateValue(fN,this.profile.name)}get isNewWindowProfile(){return this._isNewWindowProfile}set isNewWindowProfile(e){this._isNewWindowProfile!==e&&(this._isNewWindowProfile=e,this._onDidChange.fire({newWindowProfile:!0}))}async toggleCurrentWindowProfile(){this.userDataProfileService.currentProfile.id===this.profile.id?await this.userDataProfileManagementService.switchProfile(this.userDataProfilesService.defaultProfile):await this.userDataProfileManagementService.switchProfile(this.profile)}async doSave(){await this.saveProfile(this.profile)}async getChildrenForResourceType(e){return e==="extensions"?(await this.instantiationService.createInstance(lQ,this.profile).getChildren()).map(o=>this.toUserDataProfileResourceChildElement(o,void 0,[{id:"applyToAllProfiles",label:d(17656,null),checked:o.applicationScoped,enabled:!0,class:"",tooltip:"",run:async()=>{let r=(await this.extensionManagementService.getInstalled(void 0,this.profile.extensionsResource)).find(s=>Ht(s.identifier,o.identifier));r&&await this.extensionManagementService.toggleApplicationScope(r,this.profile.extensionsResource)}}])):this.getChildrenFromProfile(this.profile,e)}getInitialName(){return this.profile.name}};Gm=I([m(3,gn),m(4,B),m(5,s_),m(6,hn),m(7,fe),m(8,Ae),m(9,ti),m(10,gt),m(11,ge),m(12,Dd),m(13,F)],Gm);var Qqi="userdataprofiletemplatepreview",Ew=class extends KO{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super("",void 0,void 0,void 0,!1,r,s,l,c,u,p,h,g,f);this.titleButtons=t;this.actions=o;this.userDataProfileImportExportService=n;this._copyFromTemplates=new dt;this.template=null;this.previewProfileWatchDisposables=this._register(new O);this.name=this.defaultName=this.getNewProfileName(),this._copyFrom=e,this._copyFlags=this.getCopyFlagsFrom(e),this.initialize(),this._register(this.fileService.registerProvider(Qqi,this._register(new PU))),this._register(ee(()=>{this.previewProfile&&this.userDataProfilesService.removeProfile(this.previewProfile)}))}get copyFromTemplates(){return this._copyFromTemplates}get copyFrom(){return this._copyFrom}set copyFrom(e){this._copyFrom!==e&&(this._copyFrom=e,this._onDidChange.fire({copyFrom:!0}),this.flags=void 0,this.copyFlags=this.getCopyFlagsFrom(e),e instanceof A&&(this.templatePromise?.cancel(),this.templatePromise=void 0),this.initialize())}get copyFlags(){return this._copyFlags}set copyFlags(e){Qi(this._copyFlags,e)||(this._copyFlags=e,this._onDidChange.fire({copyFlags:!0}))}get previewProfile(){return this._previewProfile}set previewProfile(e){this._previewProfile!==e&&(this._previewProfile=e,this._onDidChange.fire({preview:!0}),this.previewProfileWatchDisposables.clear(),this._previewProfile&&(this.previewProfileWatchDisposables.add(this.fileService.watch(this._previewProfile.snippetsHome)),this.previewProfileWatchDisposables.add(this.fileService.onDidFilesChange(t=>{this._previewProfile&&t.affects(this._previewProfile.snippetsHome)&&this._onDidChange.fire({snippets:!0})}))))}getProfileToWatch(){return this.previewProfile}getCopyFlagsFrom(e){return e?{settings:!0,keybindings:!0,snippets:!0,tasks:!0,extensions:!0,mcp:!0}:void 0}async initialize(){this.disabled=!0;try{if(this.copyFrom instanceof A){await this.resolveTemplate(this.copyFrom),this.template&&(this.copyFromTemplates.set(this.copyFrom,this.template.name),this.defaultName===this.name&&(this.name=this.defaultName=this.template.name??""),this.defaultIcon===this.icon&&(this.icon=this.defaultIcon=this.template.icon),this.setCopyFlag("settings",!!this.template.settings),this.setCopyFlag("keybindings",!!this.template.keybindings),this.setCopyFlag("tasks",!!this.template.tasks),this.setCopyFlag("snippets",!!this.template.snippets),this.setCopyFlag("extensions",!!this.template.extensions),this.setCopyFlag("mcp",!!this.template.mcp),this._onDidChange.fire({copyFromInfo:!0}));return}if(QF(this.copyFrom)){this.defaultName===this.name&&(this.name=this.defaultName=d(17658,null,this.copyFrom.name)),this.defaultIcon===this.icon&&(this.icon=this.defaultIcon=this.copyFrom.icon),this.setCopyFlag("settings",!0),this.setCopyFlag("keybindings",!0),this.setCopyFlag("tasks",!0),this.setCopyFlag("snippets",!0),this.setCopyFlag("extensions",!0),this.setCopyFlag("mcp",!0),this._onDidChange.fire({copyFromInfo:!0});return}this.defaultName===this.name&&(this.name=this.defaultName=this.getNewProfileName()),this.defaultIcon===this.icon&&(this.icon=this.defaultIcon=void 0),this.setCopyFlag("settings",!1),this.setCopyFlag("keybindings",!1),this.setCopyFlag("tasks",!1),this.setCopyFlag("snippets",!1),this.setCopyFlag("extensions",!1),this.setCopyFlag("mcp",!1),this._onDidChange.fire({copyFromInfo:!0})}finally{this.disabled=!1}}getNewProfileName(){let e=d(17674,null),t=new RegExp(`${e}\\s(\\d+)`),o=0;for(let n of this.userDataProfilesService.profiles){let r=t.exec(n.name),s=r?parseInt(r[1]):0;o=s>o?s:o}return`${e} ${o+1}`}async resolveTemplate(e){return this.templatePromise||(this.templatePromise=Hn(async t=>{let o=await this.userDataProfileImportExportService.resolveProfileTemplate(e);t.isCancellationRequested||(this.template=o)})),await this.templatePromise,this.template}hasResource(e){if(this.template)switch(e){case"settings":return!!this.template.settings;case"keybindings":return!!this.template.keybindings;case"snippets":return!!this.template.snippets;case"tasks":return!!this.template.tasks;case"extensions":return!!this.template.extensions}return!0}getCopyFlag(e){return this.copyFlags?.[e]??!1}setCopyFlag(e,t){let o=this.copyFlags?{...this.copyFlags}:{};o[e]=t,this.copyFlags=o}getCopyFromName(){if(QF(this.copyFrom))return this.copyFrom.name;if(this.copyFrom instanceof A)return this.copyFromTemplates.get(this.copyFrom)}async getChildrenForResourceType(e){return this.getFlag(e)?this.getChildrenFromProfile(this.userDataProfilesService.defaultProfile,e):this.getCopyFlag(e)?this.previewProfile?this.getChildrenFromProfile(this.previewProfile,e):this.copyFrom instanceof A?(await this.resolveTemplate(this.copyFrom),this.template?this.getChildrenFromProfileTemplate(this.template,e):[]):this.copyFrom?this.getChildrenFromProfile(this.copyFrom,e):[]:[]}async getChildrenFromProfileTemplate(e,t){let o=A.from({scheme:Qqi,path:`/root/profiles/${e.name}`}),n=A.from({scheme:Qqi,path:`/root/cache/${e.name}`}),r=Wde(ht(),this.name,o,n);switch(t){case"settings":return e.settings?(await this.instantiationService.createInstance(NW).apply(e.settings,r),this.getChildrenFromProfile(r,t)):[];case"keybindings":return e.keybindings?(await this.instantiationService.createInstance(OW).apply(e.keybindings,r),this.getChildrenFromProfile(r,t)):[];case"snippets":return e.snippets?(await this.instantiationService.createInstance(qN).apply(e.snippets,r),this.getChildrenFromProfile(r,t)):[];case"tasks":return e.tasks?(await this.instantiationService.createInstance(FW).apply(e.tasks,r),this.getChildrenFromProfile(r,t)):[];case"mcp":return e.mcp?(await this.instantiationService.createInstance(fae).apply(e.mcp,r),this.getChildrenFromProfile(r,t)):[];case"extensions":return e.extensions?(await this.instantiationService.createInstance(vAe,e.extensions).getChildren()).map(l=>this.toUserDataProfileResourceChildElement(l)):[]}return[]}shouldValidateName(){return!this.copyFrom}getInitialName(){return this.previewProfile?.name??""}async doSave(){if(this.previewProfile){let e=await this.saveProfile(this.previewProfile);e&&(this.previewProfile=e)}}};Ew=I([m(3,MH),m(4,s_),m(5,hn),m(6,fe),m(7,Ae),m(8,ti),m(9,gt),m(10,ge),m(11,Dd),m(12,F)],Ew);var Z1=class extends Zh{constructor(e,t,o,n,r,s,l,c,u,p){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.userDataProfileManagementService=o;this.userDataProfileImportExportService=n;this.dialogService=r;this.telemetryService=s;this.hostService=l;this.productService=c;this.openerService=u;this.instantiationService=p;this._profiles=[];this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;for(let h of t.profiles)h.isInternal||this._profiles.push(this.createProfileElement(h));this._register(ee(()=>this._profiles.splice(0,this._profiles.length).map(([,h])=>h.dispose()))),this._register(t.onDidChangeProfiles(h=>this.onDidChangeProfiles(h)))}static getInstance(e){return Z1.INSTANCE||(Z1.INSTANCE=e.createInstance(Z1)),Z1.INSTANCE}get profiles(){return this._profiles.map(([e])=>e).sort((e,t)=>e instanceof Ew?1:t instanceof Ew||e instanceof Gm&&e.profile.isDefault?-1:t instanceof Gm&&t.profile.isDefault?1:e.name.localeCompare(t.name))}onDidChangeProfiles(e){let t=!1;for(let o of e.added)!o.isInternal&&o.name!==this.newProfileElement?.name&&(t=!0,this._profiles.push(this.createProfileElement(o)));for(let o of e.removed){o.id===this.newProfileElement?.previewProfile?.id&&(this.newProfileElement.previewProfile=void 0);let n=this._profiles.findIndex(([r])=>r instanceof Gm&&r.profile.id===o.id);n!==-1&&(t=!0,this._profiles.splice(n,1).map(([,r])=>r.dispose()))}t&&this._onDidChange.fire(void 0)}getTemplates(){return this.templates||(this.templates=this.userDataProfileManagementService.getBuiltinProfileTemplates()),this.templates}createProfileElement(e){let t=new O,o=t.add(new it("userDataProfile.activate",d(17655,null),q.asClassName(L.check),!0,()=>this.userDataProfileManagementService.switchProfile(p.profile))),n=t.add(new it("userDataProfile.copyFromProfile",d(17659,null),q.asClassName(L.copy),!0,()=>this.createNewProfile(p.profile))),r=t.add(new it("userDataProfile.export",d(17664,null),q.asClassName(L.export),!0,()=>this.userDataProfileImportExportService.exportProfile(e))),s=t.add(new it("userDataProfile.delete",d(17661,null),q.asClassName(L.trash),!0,()=>this.removeProfile(p.profile))),l=t.add(new it("userDataProfile.newWindow",d(17670,null),q.asClassName(L.emptyWindow),!0,()=>this.openWindow(p.profile))),c=[];c.push(o),c.push(l);let u=[];u.push(n),u.push(r),e.isDefault||(u.push(new oi),u.push(s));let p=t.add(this.instantiationService.createInstance(Gm,e,[[],[]],[c,u]));return o.enabled=this.userDataProfileService.currentProfile.id!==p.profile.id,t.add(this.userDataProfileService.onDidChangeCurrentProfile(()=>o.enabled=this.userDataProfileService.currentProfile.id!==p.profile.id)),[p,t]}async createNewProfile(e){if(this.newProfileElement){if(!(await this.dialogService.confirm({type:"info",message:d(17668,null),primaryButton:d(17663,null),cancelButton:d(17657,null)})).confirmed)return;this.revert()}if(e instanceof A)try{await this.userDataProfileImportExportService.resolveProfileTemplate(e)}catch(t){this.dialogService.error(Dn(t));return}if(!this.newProfileElement){let t=new O,o=new qe;t.add(ee(()=>o.dispose(!0)));let n=[],r=[],s=t.add(new it("userDataProfile.create",d(17660,null),void 0,!0,()=>this.saveNewProfile(!1,o.token)));n.push(s),Ft&&e instanceof A&&pDe(e)&&n.push(t.add(new it("userDataProfile.createInDesktop",d(17665,null,this.productService.nameLong),void 0,!0,()=>this.openerService.open(e,{openExternal:!0}))));let l=t.add(new it("userDataProfile.cancel",d(17657,null),q.asClassName(L.trash),!0,()=>this.discardNewProfile()));r.push(l);let c=t.add(new it("userDataProfile.preview",d(17671,null),q.asClassName(L.openPreview),!0,()=>this.previewNewProfile(o.token)));r.push(c);let u=t.add(new it("userDataProfile.export",d(17664,null),q.asClassName(L.export),QF(e),()=>this.exportNewProfile(o.token)));this.newProfileElement=t.add(this.instantiationService.createInstance(Ew,e,[n,r],[[l],[u]]));let p=()=>{s.enabled&&(this.newProfileElement?.copyFrom&&this.userDataProfilesService.profiles.some(h=>!h.isInternal&&h.name===this.newProfileElement?.name)?s.label=d(17673,null):s.label=d(17660,null))};p(),t.add(this.newProfileElement.onDidChange(h=>{(h.preview||h.disabled||h.message)&&(s.enabled=!this.newProfileElement?.disabled&&!this.newProfileElement?.message,c.enabled=!this.newProfileElement?.previewProfile&&!this.newProfileElement?.disabled&&!this.newProfileElement?.message),(h.name||h.copyFrom)&&(p(),u.enabled=QF(this.newProfileElement?.copyFrom))})),t.add(this.userDataProfilesService.onDidChangeProfiles(h=>{p(),this.newProfileElement?.validate()})),this._profiles.push([this.newProfileElement,t]),this._onDidChange.fire(this.newProfileElement)}return this.newProfileElement}revert(){this.removeNewProfile(),this._onDidChange.fire(void 0)}removeNewProfile(){if(this.newProfileElement){let e=this._profiles.findIndex(([t])=>t===this.newProfileElement);e!==-1&&this._profiles.splice(e,1).map(([,t])=>t.dispose()),this.newProfileElement=void 0}}async previewNewProfile(e){if(!this.newProfileElement||this.newProfileElement.previewProfile)return;let t=await this.saveNewProfile(!0,e);t&&(this.newProfileElement.previewProfile=t,Ft?await this.userDataProfileManagementService.switchProfile(t):await this.openWindow(t))}async exportNewProfile(e){if(!this.newProfileElement||!QF(this.newProfileElement.copyFrom))return;let t=Wde(ht(),this.newProfileElement.name,this.newProfileElement.copyFrom.location,this.newProfileElement.copyFrom.cacheHome,{icon:this.newProfileElement.icon,useDefaultFlags:this.newProfileElement.flags},this.userDataProfilesService.defaultProfile);await this.userDataProfileImportExportService.exportProfile(t,this.newProfileElement.copyFlags)}async saveNewProfile(e,t){if(!this.newProfileElement||(this.newProfileElement.validate(),this.newProfileElement.message))return;this.newProfileElement.disabled=!0;let o;try{if(this.newProfileElement.previewProfile)e||(o=await this.userDataProfileManagementService.updateProfile(this.newProfileElement.previewProfile,{transient:!1}));else{let{flags:n,icon:r,name:s,copyFrom:l}=this.newProfileElement,c=n?n.settings&&n.keybindings&&n.tasks&&n.globalState&&n.extensions?void 0:n:void 0,u={source:l instanceof A?"template":QF(l)?"profile":l?"external":void 0};if(l instanceof A){let p=await this.newProfileElement.resolveTemplate(l);p&&(this.telemetryService.publicLog2("userDataProfile.createFromTemplate",u),o=await this.userDataProfileImportExportService.createProfileFromTemplate(p,{name:s,useDefaultFlags:c,icon:r,resourceTypeFlags:this.newProfileElement.copyFlags,transient:e},t??Ie.None))}else QF(l)?o=await this.userDataProfileImportExportService.createFromProfile(l,{name:s,useDefaultFlags:c,icon:r,resourceTypeFlags:this.newProfileElement.copyFlags,transient:e},t??Ie.None):o=await this.userDataProfileManagementService.createProfile(s,{useDefaultFlags:c,icon:r,transient:e})}}finally{this.newProfileElement&&(this.newProfileElement.disabled=!1)}if(t?.isCancellationRequested){if(o)try{await this.userDataProfileManagementService.removeProfile(o)}catch{}return}if(o&&!o.isInternal&&this.newProfileElement){this.removeNewProfile();let n=this._profiles.find(([r])=>r.name===o.name);n?this._onDidChange.fire(n[0]):this.onDidChangeProfiles({added:[o],removed:[],updated:[],all:this.userDataProfilesService.profiles})}return o}async discardNewProfile(){if(this.newProfileElement){if(this.newProfileElement.previewProfile){await this.userDataProfileManagementService.removeProfile(this.newProfileElement.previewProfile);return}this.removeNewProfile(),this._onDidChange.fire(void 0)}}async removeProfile(e){(await this.dialogService.confirm({type:"info",message:d(17662,null,e.name),primaryButton:d(17661,null),cancelButton:d(17657,null)})).confirmed&&await this.userDataProfileManagementService.removeProfile(e)}async openWindow(e){await this.hostService.openWindow({forceProfile:e.name})}};Z1=I([m(0,gn),m(1,hn),m(2,s_),m(3,MH),m(4,ct),m(5,_e),m(6,ti),m(7,Ze),m(8,Je),m(9,F)],Z1);var SLn=Oe("profiles-editor-edit-folder",L.edit,d(17607,null)),ILn=Oe("profiles-editor-remove-folder",L.close,d(17645,null)),yLn=te("profiles.sashBorder",ob,d(17644,null)),i$i=WS({listActiveSelectionBackground:Bo,listActiveSelectionForeground:xo,listFocusAndSelectionBackground:Bo,listFocusAndSelectionForeground:xo,listFocusBackground:Bo,listFocusForeground:xo,listHoverForeground:xo,listHoverBackground:Bo,listHoverOutline:Bo,listFocusOutline:Bo,listInactiveSelectionBackground:Bo,listInactiveSelectionForeground:xo,listInactiveFocusBackground:Bo,listInactiveFocusOutline:Bo,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,tableOddRowsBackgroundColor:Bo}),C7=class extends zs{constructor(e,t,o,n,r,s,l,c){super(C7.ID,e,t,o,n);this.quickInputService=r;this.fileDialogService=s;this.contextMenuService=l;this.instantiationService=c;this.templates=[]}static{this.ID="workbench.editor.userDataProfiles"}layout(e,t){if(this.container&&this.splitView){let o=e.height-20;this.splitView.layout(this.container?.clientWidth,o),this.splitView.el.style.height=`${o}px`}}createEditor(e){this.container=D(e,_(".profiles-editor"));let t=D(this.container,_(".sidebar-view")),o=D(t,_(".sidebar-container")),n=D(this.container,_(".contents-view")),r=D(n,_(".contents-container"));this.profileWidget=this._register(this.instantiationService.createInstance(oht,r)),this.splitView=new Gp(this.container,{orientation:1,proportionalLayout:!0}),this.renderSidebar(o),this.splitView.addView({onDidChange:U.None,element:t,minimumSize:200,maximumSize:350,layout:(s,l,c)=>{if(t.style.width=`${s}px`,c&&this.profilesList){let u=c-40-15;this.profilesList.getHTMLElement().style.height=`${u}px`,this.profilesList.layout(u,s)}}},300,void 0,!0),this.splitView.addView({onDidChange:U.None,element:n,minimumSize:550,maximumSize:Number.POSITIVE_INFINITY,layout:(s,l,c)=>{n.style.width=`${s}px`,c&&this.profileWidget?.layout(new di(s,c))}},Ac.Distribute,void 0,!0),this.registerListeners(),this.updateStyles()}updateStyles(){let e=this.theme.getColor(yLn);this.splitView?.style({separatorBorder:e})}renderSidebar(e){this.renderNewProfileButton(D(e,_(".new-profile-button")));let t=this.instantiationService.createInstance(iht),o=new Xqi;this.profilesList=this._register(this.instantiationService.createInstance(bc,"ProfilesList",D(e,_(".profiles-list")),o,[t],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(n){return n?.name??""},getWidgetAriaLabel(){return d(17643,null)}},openOnSingleClick:!0,identityProvider:{getId(n){return n instanceof Gm?n.profile.id:n.name}},alwaysConsumeMouseWheel:!1}))}renderNewProfileButton(e){let t=this._register(new Jv(e,{actions:{getActions:()=>{let o=[];return this.templates.length&&(o.push(new sa("from.template",d(17615,null),this.getCreateFromTemplateActions())),o.push(new oi)),o.push(li({id:"importProfile",label:d(17626,null),run:()=>this.importProfile()})),o}},addPrimaryActionToDropdown:!1,contextMenuProvider:this.contextMenuService,supportIcons:!0,...Ro}));t.label=d(17633,null),this._register(t.onDidClick(o=>this.createNewProfile()))}getCreateFromTemplateActions(){return this.templates.map(e=>li({id:`template:${e.url}`,label:e.name,run:()=>this.createNewProfile(A.parse(e.url))}))}registerListeners(){this.profilesList&&(this._register(this.profilesList.onDidChangeSelection(e=>{let[t]=e.elements;t instanceof KO&&this.profileWidget?.render(t)})),this._register(this.profilesList.onContextMenu(e=>{let t=[];e.element||t.push(...this.getTreeContextMenuActions()),e.element instanceof KO&&t.push(...e.element.actions[1]),t.length&&this.contextMenuService.showContextMenu({getAnchor:()=>e.anchor,getActions:()=>t,getActionsContext:()=>e.element})})),this._register(this.profilesList.onMouseDblClick(e=>{e.element||this.createNewProfile()})))}getTreeContextMenuActions(){let e=[];e.push(li({id:"newProfile",label:d(17633,null),run:()=>this.createNewProfile()}));let t=this.getCreateFromTemplateActions();return t.length&&e.push(new sa("from.template",d(17632,null),t)),e.push(new oi),e.push(li({id:"importProfile",label:d(17626,null),run:()=>this.importProfile()})),e}async importProfile(){let e=new O,t=e.add(this.quickInputService.createQuickPick()),o=n=>{let r=[];n&&r.push({label:t.value,description:d(17622,null)}),r.push({label:d(17621,null)}),t.items=r};t.title=d(17625,null),t.placeholder=d(17624,null),t.ignoreFocusOut=!0,e.add(t.onDidChangeValue(o)),o(),t.matchOnLabel=!1,t.matchOnDescription=!1,e.add(t.onDidAccept(async()=>{t.hide();let n=t.selectedItems[0];if(!n)return;let r=n.label===t.value?A.parse(t.value):await this.getProfileUriFromFileSystem();r&&this.createNewProfile(r)})),e.add(t.onDidHide(()=>e.dispose())),t.show()}async createNewProfile(e){await this.model?.createNewProfile(e)}selectProfile(e){let t=this.model?.profiles.findIndex(o=>o instanceof Gm&&o.profile.id===e.id);t!==void 0&&t>=0&&this.profilesList?.setSelection([t])}async getProfileUriFromFileSystem(){let e=await this.fileDialogService.showOpenDialog({canSelectFolders:!1,canSelectFiles:!0,canSelectMany:!1,filters:JYe,title:d(17623,null)});return e?e[0]:null}async setInput(e,t,o,n){await super.setInput(e,t,o,n),this.model=await e.resolve(),this.model.getTemplates().then(r=>{this.templates=r,this.profileWidget&&(this.profileWidget.templates=r)}),this.updateProfilesList(),this._register(this.model.onDidChange(r=>this.updateProfilesList(r)))}focus(){super.focus(),this.profilesList?.domFocus()}updateProfilesList(e){if(!this.model)return;let t=this.profilesList?.getSelection()?.[0],o=t!==void 0?this.profilesList?.element(t):void 0;if(this.profilesList?.splice(0,this.profilesList.length,this.model.profiles),e)this.profilesList?.setSelection([this.model.profiles.indexOf(e)]);else if(o){if(!this.model.profiles.includes(o)){let n=this.model.profiles.find(r=>r.name===o.name)??this.model.profiles[0];n&&this.profilesList?.setSelection([this.model.profiles.indexOf(n)])}}else{let n=this.model.profiles.find(r=>r.active)??this.model.profiles[0];n&&this.profilesList?.setSelection([this.model.profiles.indexOf(n)])}}};C7=I([m(1,_e),m(2,Pe),m(3,de),m(4,$e),m(5,nn),m(6,Xe),m(7,F)],C7);var Xqi=class{getHeight(i){return 22}getTemplateId(){return"profileListElement"}},iht=class{constructor(i){this.instantiationService=i;this.templateId="profileListElement"}renderTemplate(i){let e=new O,t=new O;i.classList.add("profile-list-item");let o=D(i,_(".profile-list-item-icon")),n=D(i,_(".profile-list-item-label")),r=D(i,_(`span${q.asCSSSelector(L.circleFilled)}`)),s=D(i,_(".profile-list-item-description"));D(s,_(`span${q.asCSSSelector(L.check)}`),_("span",void 0,d(17583,null)));let l=D(i,_(".profile-tree-item-actions-container")),c=e.add(this.instantiationService.createInstance(dl,l,{hoverDelegate:e.add(Dg()),highlightToggledItems:!0}));return{label:n,icon:o,dirty:r,description:s,actionBar:c,disposables:e,elementDisposables:t}}renderElement(i,e,t){t.elementDisposables.clear(),t.label.textContent=i.name,t.label.classList.toggle("new-profile",i instanceof Ew),t.icon.className=q.asClassName(i.icon?q.fromId(i.icon):Q8),t.dirty.classList.toggle("hide",!(i instanceof Ew)),t.description.classList.toggle("hide",!i.active),t.elementDisposables.add(i.onDidChange(r=>{r.name&&(t.label.textContent=i.name),r.icon&&(i.icon?t.icon.className=q.asClassName(q.fromId(i.icon)):t.icon.className="hide"),r.active&&t.description.classList.toggle("hide",!i.active)}));let o=()=>t.actionBar.setActions(i.actions[0].filter(r=>r.enabled),i.actions[1].filter(r=>r.enabled));o();let n=[];for(let r of i.actions.flat())r instanceof it&&n.push(r.onDidChange);t.elementDisposables.add(U.any(...n)(r=>{r.enabled!==void 0&&o()}))}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.disposables.dispose(),i.elementDisposables.dispose()}};iht=I([m(0,F)],iht);var oht=class extends k{constructor(e,t,o){super();this.editorProgressService=t;this.instantiationService=o;this._profileElement=this._register(new ue);this.layoutParticipants=[];let n=D(e,_(".profile-header")),r=D(n,_(".profile-title-container"));this.profileTitle=D(r,_(".profile-title")),this.builtInLabel=D(r,_(".profile-built-in-label",void 0,d(17587,null))),this.builtInLabel.classList.add("hide");let s=D(e,_(".profile-body")),l=new Jqi,c=this._register(this.instantiationService.createInstance(cht)),u=this._register(this.instantiationService.createInstance(dht));this.layoutParticipants.push(u),this.copyFromProfileRenderer=this._register(this.instantiationService.createInstance(lht)),this.profileTreeContainer=D(s,_(".profile-tree")),this.profileTree=this._register(this.instantiationService.createInstance(Rp,"ProfileEditor-Tree",this.profileTreeContainer,l,[this._register(this.instantiationService.createInstance(rht)),this._register(this.instantiationService.createInstance(sht)),this._register(this.instantiationService.createInstance(aht)),this._register(this.instantiationService.createInstance(t$i)),this.copyFromProfileRenderer,c,u],this.instantiationService.createInstance(Zqi),{multipleSelectionSupport:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(p){return p?.element??""},getWidgetAriaLabel(){return""}},identityProvider:{getId(p){return p.element}},expandOnlyOnTwistieClick:!0,renderIndentGuides:"none",enableStickyScroll:!1,openOnSingleClick:!1,setRowLineHeight:!1,supportDynamicHeights:!0,alwaysConsumeMouseWheel:!1})),this.profileTree.style(i$i),this._register(c.onDidChangeContentHeight(p=>this.profileTree.updateElementHeight(p,void 0))),this._register(u.onDidChangeContentHeight(p=>this.profileTree.updateElementHeight(p,void 0))),this._register(c.onDidChangeSelection(p=>{p.selected&&(this.profileTree.setFocus([]),this.profileTree.setSelection([]))})),this._register(this.profileTree.onDidChangeContentHeight(p=>{this.dimension&&this.layout(this.dimension)})),this._register(this.profileTree.onDidChangeSelection(p=>{p.elements.length&&c.clearSelection()})),this.buttonContainer=D(s,_(".profile-row-container.profile-button-container"))}set templates(e){this.copyFromProfileRenderer.setTemplates(e),this.profileTree.rerender()}layout(e){this.dimension=e;let t=this.profileTree.contentHeight,o=Math.min(t,e.height-(this._profileElement.value?.element instanceof Ew?116:54));this.profileTreeContainer.style.height=`${o}px`,this.profileTree.layout(o,e.width);for(let n of this.layoutParticipants)n.layout()}render(e){if(this._profileElement.value?.element===e)return;this._profileElement.value?.element instanceof Gm&&this._profileElement.value.element.reset(),this.profileTree.setInput(e);let t=new O;this._profileElement.value={element:e,dispose:()=>t.dispose()},this.profileTitle.textContent=e.name,this.builtInLabel.classList.toggle("hide",!(e instanceof Gm&&e.profile.isDefault)),t.add(e.onDidChange(r=>{r.name&&(this.profileTitle.textContent=e.name)}));let[o,n]=e.titleButtons;if(o?.length||n?.length){if(this.buttonContainer.classList.remove("hide"),n?.length)for(let r of n){let s=t.add(new Pi(this.buttonContainer,{...Ro,secondary:!0}));s.label=r.label,s.enabled=r.enabled,t.add(s.onDidClick(()=>this.editorProgressService.showWhile(r.run()))),t.add(r.onDidChange(l=>{bn(l.enabled)||(s.enabled=r.enabled),bn(l.label)||(s.label=r.label)}))}if(o?.length)for(let r of o){let s=t.add(new Pi(this.buttonContainer,{...Ro}));s.label=r.label,s.enabled=r.enabled,t.add(s.onDidClick(()=>this.editorProgressService.showWhile(r.run()))),t.add(r.onDidChange(l=>{bn(l.enabled)||(s.enabled=r.enabled),bn(l.label)||(s.label=r.label)})),t.add(e.onDidChange(l=>{l.message&&(s.setTitle(e.message??r.label),s.element.classList.toggle("error",!!e.message))}))}}else this.buttonContainer.classList.add("hide");e instanceof Ew&&this.profileTree.focusFirst(),this.dimension&&this.layout(this.dimension)}};oht=I([m(1,Hd),m(2,F)],oht);var Jqi=class extends LK{getTemplateId({element:i}){return i}hasDynamicHeight({element:i}){return i==="contents"||i==="workspaces"}estimateHeight({element:i,root:e}){switch(i){case"name":return 72;case"icon":return 68;case"copyFrom":return 90;case"useForCurrent":case"useAsDefault":return 68;case"contents":return 258;case"workspaces":return(e.workspaces?e.workspaces.length*24+30:0)+112}}},Zqi=class{hasChildren(i){return i instanceof KO}async getChildren(i){if(i instanceof KO){let e=[];return i instanceof Ew?(e.push({element:"name",root:i}),e.push({element:"icon",root:i}),e.push({element:"copyFrom",root:i}),e.push({element:"contents",root:i})):i instanceof Gm&&(i.profile.isDefault||(e.push({element:"name",root:i}),e.push({element:"icon",root:i})),e.push({element:"useAsDefault",root:i}),e.push({element:"contents",root:i}),e.push({element:"workspaces",root:i})),e}return[]}},e$i=class{getTemplateId(i){return i.element.resourceType?i.root instanceof Ew?bae.TEMPLATE_ID:vae.TEMPLATE_ID:Sae.TEMPLATE_ID}getHeight(i){return 24}},nht=class{constructor(i){this.editorProgressService=i}hasChildren(i){if(i instanceof KO)return!0;if(i.element.resourceType){if(i.element.resourceType!=="extensions"&&i.element.resourceType!=="snippets")return!1;if(i.root instanceof Ew){let e=i.element.resourceType;if(i.root.getFlag(e))return!0;if(!i.root.hasResource(e)||i.root.copyFrom===void 0||!i.root.getCopyFlag(e))return!1}return!0}return!1}async getChildren(i){if(i instanceof KO)return(await i.getChildren()).map(t=>({element:t,root:i}));if(i.element.resourceType){let e=this.editorProgressService.show(!0,500);try{return(await i.root.getChildren(i.element.resourceType)).map(o=>({element:o,root:i.root}))}finally{e.done()}}return[]}};nht=I([m(0,Hd)],nht);var xqe=class extends k{getResourceTypeTitle(i){switch(i){case"settings":return d(17646,null);case"keybindings":return d(17627,null);case"snippets":return d(17647,null);case"tasks":return d(17648,null);case"mcp":return d(17629,null);case"extensions":return d(17611,null)}return""}disposeElement(i,e,t){t.elementDisposables.clear()}disposeTemplate(i){i.disposables.dispose()}},x7=class extends xqe{renderElement({element:i},e,t){t.elementDisposables.clear(),t.element=i}},rht=class extends x7{constructor(e,t){super();this.userDataProfilesService=e;this.contextViewService=t;this.templateId="name"}renderTemplate(e){let t=new O,o=t.add(new O),n,r=D(e,_(".profile-row-container"));D(r,_(".profile-label-element",void 0,d(17630,null)));let s=t.add(new ad(r,this.contextViewService,{inputBoxStyles:MD({inputBorder:__}),ariaLabel:d(17642,null),placeholder:d(17642,null),validationOptions:{validation:u=>{if(!u)return{content:d(17631,null),type:2};if(n?.root.disabled||!n?.root.shouldValidateName())return null;let p=n?.root.getInitialName();return u=u.trim(),p!==u&&this.userDataProfilesService.profiles.some(h=>!h.isInternal&&h.name===u)?{content:d(17641,null,u),type:2}:null}}}));t.add(s.onDidChange(u=>{n&&u&&(n.root.name=u)}));let l=t.add(nr(s.inputElement));t.add(l.onDidBlur(()=>{n&&!s.value&&(s.value=n.root.name)}));let c=u=>{s.value=u.root.name,s.validate();let p=u.root instanceof Gm&&u.root.profile.isDefault;u.root.disabled||p?s.disable():s.enable(),p?s.setTooltip(d(17605,null)):s.setTooltip(d(17642,null))};return{set element(u){n=u,c(n),o.add(n.root.onDidChange(p=>{(p.name||p.disabled)&&c(u),p.profile&&s.validate()}))},disposables:t,elementDisposables:o}}};rht=I([m(0,hn),m(1,qn)],rht);var sht=class extends x7{constructor(e,t){super();this.instantiationService=e;this.hoverService=t;this.templateId="icon";this.hoverDelegate=yi("element")}renderTemplate(e){let t=new O,o=t.add(new O),n,r=D(e,_(".profile-row-container"));D(r,_(".profile-label-element",void 0,d(17620,null)));let s=D(r,_(".profile-icon-container")),l=D(s,_(`${q.asCSSSelector(Q8)}`,{tabindex:"0",role:"button","aria-label":d(17618,null)})),c=t.add(this.hoverService.setupManagedHover(this.hoverDelegate,l,"")),u=t.add(this.instantiationService.createInstance(Q_,{icons:Zfo,inputBoxStyles:Wl})),p,h=()=>{n?.root instanceof Gm&&n.root.profile.isDefault||n?.root.disabled||n?.root instanceof Gm&&n.root.profile.isDefault||(u.clearInput(),p=this.hoverService.showInstantHover({content:u.domNode,target:l,position:{hoverPosition:2},persistence:{sticky:!0},appearance:{showPointer:!0}},!0),p&&(u.layout(new di(486,292)),u.focus()))};t.add($(l,ne.CLICK,f=>{Kt.stop(f,!0),h()})),t.add($(l,ne.KEY_DOWN,f=>{let v=new mi(f);(v.equals(3)||v.equals(10))&&(Kt.stop(v,!0),h())})),t.add($(u.domNode,ne.KEY_DOWN,f=>{let v=new mi(f);v.equals(9)&&(Kt.stop(v,!0),p?.dispose(),l.focus())})),t.add(u.onDidSelect(f=>{p?.dispose(),l.focus(),n&&(n.root.icon=f.id)})),D(s,_(".profile-description-element",void 0,d(17619,null)));let g=f=>{f?.root instanceof Gm&&f.root.profile.isDefault?(s.classList.add("disabled"),c.update(d(17604,null))):(c.update(d(17589,null)),s.classList.remove("disabled")),f.root.icon?l.className=q.asClassName(q.fromId(f.root.icon)):l.className=q.asClassName(q.fromId(Q8.id))};return{set element(f){n=f,g(n),o.add(n.root.onDidChange(v=>{v.icon&&g(f)}))},disposables:t,elementDisposables:o}}};sht=I([m(0,F),m(1,ot)],sht);var aht=class extends x7{constructor(e){super();this.userDataProfileService=e;this.templateId="useForCurrent"}renderTemplate(e){let t=new O,o=t.add(new O),n,r=D(e,_(".profile-row-container"));D(r,_(".profile-label-element",void 0,d(17652,null)));let s=D(r,_(".profile-use-for-current-container")),l=d(17609,null),c=t.add(new qf(l,!1,Ag));D(s,c.domNode);let u=D(s,_(".profile-description-element",void 0,l));t.add(c.onChange(()=>{n?.root instanceof Gm&&n.root.toggleCurrentWindowProfile()})),t.add($(u,ne.CLICK,()=>{n?.root instanceof Gm&&n.root.toggleCurrentWindowProfile()}));let p=g=>{c.checked=g.root instanceof Gm&&this.userDataProfileService.currentProfile.id===g.root.profile.id,c.checked&&this.userDataProfileService.currentProfile.isDefault?c.disable():c.enable()},h=this;return{set element(g){n=g,p(n),o.add(h.userDataProfileService.onDidChangeCurrentProfile(f=>{p(g)}))},disposables:t,elementDisposables:o}}};aht=I([m(0,gn)],aht);var t$i=class extends x7{constructor(){super(...arguments);this.templateId="useAsDefault"}renderTemplate(e){let t=new O,o=t.add(new O),n,r=D(e,_(".profile-row-container"));D(r,_(".profile-label-element",void 0,d(17653,null)));let s=D(r,_(".profile-use-as-default-container")),l=d(17610,null),c=t.add(new qf(l,!1,Ag));D(s,c.domNode);let u=D(s,_(".profile-description-element",void 0,l));t.add(c.onChange(()=>{n?.root instanceof Gm&&n.root.toggleNewWindowProfile()})),t.add($(u,ne.CLICK,()=>{n?.root instanceof Gm&&n.root.toggleNewWindowProfile()}));let p=h=>{c.checked=h.root instanceof Gm&&h.root.isNewWindowProfile};return{set element(h){n=h,p(n),o.add(n.root.onDidChange(g=>{g.newWindowProfile&&p(h)}))},disposables:t,elementDisposables:o}}},lht=class extends x7{constructor(e,t,o,n){super();this.userDataProfilesService=e;this.instantiationService=t;this.uriIdentityService=o;this.contextViewService=n;this.templateId="copyFrom";this.templates=[]}renderTemplate(e){let t=new O,o=t.add(new O),n,r=D(e,_(".profile-row-container.profile-copy-from-container"));D(r,_(".profile-label-element",void 0,d(17598,null))),D(r,_(".profile-description-element",void 0,d(17594,null)));let s=t.add(this.instantiationService.createInstance(Jw,[],0,this.contextViewService,nC,{useCustomDrawn:!0,ariaLabel:d(17597,null)}));s.render(D(r,_(".profile-select-container")));let l=(u,p)=>{s.setOptions(p);let h=u.copyFrom instanceof A?u.copyFrom.toString():u.copyFrom?.id,g=h?p.findIndex(f=>f.id===h):0;s.select(g)},c=this;return{set element(u){if(n=u,n.root instanceof Ew){let p=n.root,h=c.getCopyFromOptions(p);l(p,h),s.setEnabled(!p.previewProfile&&!p.disabled),o.add(n.root.onDidChange(g=>{(g.copyFrom||g.copyFromInfo)&&(h=c.getCopyFromOptions(p),l(p,h)),(g.preview||g.disabled)&&s.setEnabled(!p.previewProfile&&!p.disabled)})),o.add(s.onDidSelect(g=>{p.copyFrom=h[g.index].source}))}},disposables:t,elementDisposables:o}}setTemplates(e){this.templates=e}getCopyFromOptions(e){let t=[];t.push({text:d(17608,null)});for(let[o,n]of e.copyFromTemplates)this.templates.some(r=>this.uriIdentityService.extUri.isEqual(A.parse(r.url),o))||t.push({text:`${n} (${Be(o)})`,id:o.toString(),source:o});if(this.templates.length){t.push({...GF,decoratorRight:d(17616,null)});for(let o of this.templates)t.push({text:o.name,id:o.url,source:A.parse(o.url)})}t.push({...GF,decoratorRight:d(17614,null)});for(let o of this.userDataProfilesService.profiles)o.isInternal||t.push({text:o.name,id:o.id,source:o});return t}};lht=I([m(0,hn),m(1,F),m(2,gt),m(3,qn)],lht);var cht=class extends x7{constructor(e,t,o){super();this.userDataProfilesService=e;this.contextMenuService=t;this.instantiationService=o;this.templateId="contents";this._onDidChangeContentHeight=this._register(new T);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event}renderTemplate(e){let t=new O,o=t.add(new O),n,r=D(e,_(".profile-row-container"));D(r,_(".profile-label-element",void 0,d(17590,null)));let s=D(r,_(".profile-description-element")),l=D(r,_(".profile-content-tree-header")),c=_(".options-header",void 0,_("span",void 0,d(17639,null)));D(l,_(""),_("",void 0,d(17590,null)),c,_(""));let u=new e$i,p=this.profilesContentTree=t.add(this.instantiationService.createInstance(Rp,"ProfileEditor-ContentsTree",D(r,_(".profile-content-tree.file-icon-themable-tree.show-file-icons")),u,[this.instantiationService.createInstance(vae),this.instantiationService.createInstance(bae),this.instantiationService.createInstance(Sae)],this.instantiationService.createInstance(nht),{multipleSelectionSupport:!1,horizontalScrolling:!1,accessibilityProvider:{getAriaLabel(f){return(f?.element).resourceType?(f?.element).resourceType:(f?.element).label?(f?.element).label:""},getWidgetAriaLabel(){return""}},identityProvider:{getId(f){return f?.element.handle?f.element.handle:""}},expandOnlyOnTwistieClick:!0,renderIndentGuides:"none",enableStickyScroll:!1,openOnSingleClick:!1,alwaysConsumeMouseWheel:!1}));this.profilesContentTree.style(i$i),t.add(ee(()=>this.profilesContentTree=void 0)),t.add(this.profilesContentTree.onDidChangeContentHeight(f=>{this.profilesContentTree?.layout(f),n&&this._onDidChangeContentHeight.fire(n)})),t.add(this.profilesContentTree.onDidChangeSelection((f=>{n&&this._onDidChangeSelection.fire({element:n,selected:!!f.elements.length})}))),t.add(this.profilesContentTree.onDidOpen(async f=>{f.browserEvent&&f.element?.element.openAction&&await f.element.element.openAction.run()})),t.add(this.profilesContentTree.onContextMenu(async f=>{f.element?.element.actions?.contextMenu?.length&&this.contextMenuService.showContextMenu({getAnchor:()=>f.anchor,getActions:()=>f.element?.element?.actions?.contextMenu??[],getActionsContext:()=>f.element})}));let h=f=>{St(s);let v=new he;if(f.root instanceof Gm&&f.root.profile.isDefault)v.appendMarkdown(d(17603,null));else if(v.appendMarkdown(d(17591,null)),f.root instanceof Ew){let b=f.root.getCopyFromName(),S=b===this.userDataProfilesService.defaultProfile.name?d(17593,null,b):b;S&&v.appendMarkdown(d(17596,null,S,b)),v.appendMarkdown(d(17602,null)).appendMarkdown(d(17637,null))}D(s,o.add(Lg(v)).element)},g=this;return{set element(f){n=f,h(f),f.root instanceof Ew?l.classList.remove("default-profile"):f.root instanceof Gm&&l.classList.toggle("default-profile",f.root.profile.isDefault),p.setInput(n.root),o.add(n.root.onDidChange(v=>{(v.copyFrom||v.copyFlags||v.flags||v.extensions||v.snippets||v.preview)&&p.updateChildren(f.root),v.copyFromInfo&&(h(f),g._onDidChangeContentHeight.fire(f))}))},disposables:t,elementDisposables:o}}clearSelection(){this.profilesContentTree&&(this.profilesContentTree.setSelection([]),this.profilesContentTree.setFocus([]))}};cht=I([m(0,hn),m(1,Xe),m(2,F)],cht);var dht=class extends x7{constructor(e,t,o,n){super();this.labelService=e;this.uriIdentityService=t;this.fileDialogService=o;this.instantiationService=n;this.templateId="workspaces";this._onDidChangeContentHeight=this._register(new T);this.onDidChangeContentHeight=this._onDidChangeContentHeight.event;this._onDidChangeSelection=this._register(new T);this.onDidChangeSelection=this._onDidChangeSelection.event}renderTemplate(e){let t=new O,o=t.add(new O),n,r=D(e,_(".profile-row-container"));D(r,_(".profile-label-element",void 0,d(17612,null)));let s=D(r,_(".profile-description-element")),l=D(r,_(".profile-associations-table")),c=this.workspacesTable=t.add(this.instantiationService.createInstance(Cx,"ProfileEditor-AssociationsTable",l,new class{constructor(){this.headerRowHeight=30}getHeight(){return 24}},[{label:"",tooltip:"",weight:1,minimumWidth:30,maximumWidth:30,templateId:GXt.TEMPLATE_ID,project(v){return v}},{label:d(17617,null),tooltip:"",weight:2,templateId:Iae.TEMPLATE_ID,project(v){return v}},{label:d(17640,null),tooltip:"",weight:7,templateId:yae.TEMPLATE_ID,project(v){return v}},{label:"",tooltip:"",weight:1,minimumWidth:84,maximumWidth:84,templateId:wae.TEMPLATE_ID,project(v){return v}}],[new GXt,this.instantiationService.createInstance(Iae),this.instantiationService.createInstance(yae),this.instantiationService.createInstance(wae)],{horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,openOnSingleClick:!1,multipleSelectionSupport:!1,accessibilityProvider:{getAriaLabel:v=>{let b=GVo(this.labelService,v.workspace);return b===void 0||b.length===0?d(17649,null,this.labelService.getUriLabel(v.workspace)):d(17651,null,this.labelService.getUriLabel(v.workspace),b)},getWidgetAriaLabel:()=>d(17650,null)},identityProvider:{getId(v){return v.workspace.toString()}}}));this.workspacesTable.style(i$i),t.add(ee(()=>this.workspacesTable=void 0)),t.add(this.workspacesTable.onDidChangeSelection((v=>{n&&this._onDidChangeSelection.fire({element:n,selected:!!v.elements.length})})));let u=D(r,_(".profile-workspaces-button-container")),p=t.add(new sC(u)),h=this._register(p.addButton({title:d(17584,null),...Ro}));h.label=d(17584,null),t.add(h.onDidClick(async()=>{let v=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!0,openLabel:d(17585,null),title:d(17586,null)});v&&n?.root instanceof Gm&&n.root.updateWorkspaces(v,[])})),t.add(c.onDidOpen(v=>{v?.element&&v.element.profileElement.openWorkspace(v.element.workspace)}));let g=()=>{n?.root instanceof Gm&&n.root.workspaces?.length?(s.textContent=d(17613,null),l.classList.remove("hide"),c.splice(0,c.length,n.root.workspaces.map(v=>({workspace:v,profileElement:n.root})).sort((v,b)=>this.uriIdentityService.extUri.compare(v.workspace,b.workspace))),this.layout()):(s.textContent=d(17634,null),l.classList.add("hide"))},f=this;return{set element(v){n=v,v.root instanceof Gm&&g(),o.add(n.root.onDidChange(b=>{n&&b.workspaces&&(g(),f._onDidChangeContentHeight.fire(n))}))},disposables:t,elementDisposables:o}}layout(){this.workspacesTable&&this.workspacesTable.layout(this.workspacesTable.length*24+30,void 0)}clearSelection(){this.workspacesTable&&(this.workspacesTable.setSelection([]),this.workspacesTable.setFocus([]))}};dht=I([m(0,nt),m(1,gt),m(2,nn),m(3,F)],dht);var vae=class extends xqe{constructor(e){super();this.instantiationService=e;this.templateId=vae.TEMPLATE_ID}static{this.TEMPLATE_ID="ExistingProfileResourceTemplate"}renderTemplate(e){let t=new O,o=D(e,_(".profile-tree-item-container.existing-profile-resource-type-container")),n=D(o,_(".profile-resource-type-label")),r=t.add(new nbe({items:[]}));D(D(o,_(".profile-resource-options-container")),r.domNode);let s=D(o,_(".profile-resource-actions-container")),l=t.add(this.instantiationService.createInstance(dl,s,{hoverDelegate:t.add(Dg()),highlightToggledItems:!0}));return{label:n,radio:r,actionBar:l,disposables:t,elementDisposables:t.add(new O)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n,root:r}=e;if(!(r instanceof Gm))throw new Error("ExistingProfileResourceTreeRenderer can only render existing profile element");if(We(n)||!Yqi(n))throw new Error("Invalid profile resource element");let s=()=>{o.radio.setItems([{text:d(17600,null),tooltip:d(17601,null,l),isActive:r.getFlag(n.resourceType)},{text:r.name,tooltip:d(17599,null,l,r.name),isActive:!r.getFlag(n.resourceType)}])},l=this.getResourceTypeTitle(n.resourceType);o.label.textContent=l,r instanceof Gm&&r.profile.isDefault?o.radio.domNode.classList.add("hide"):(o.radio.domNode.classList.remove("hide"),s(),o.elementDisposables.add(r.onDidChange(u=>{u.name&&s()})),o.elementDisposables.add(o.radio.onDidSelect(u=>r.setFlag(n.resourceType,u===0))));let c=[];n.openAction&&c.push(n.openAction),n.actions?.primary&&c.push(...n.actions.primary),o.actionBar.setActions(c)}};vae=I([m(0,F)],vae);var bae=class extends xqe{constructor(e,t){super();this.userDataProfilesService=e;this.instantiationService=t;this.templateId=bae.TEMPLATE_ID}static{this.TEMPLATE_ID="NewProfileResourceTemplate"}renderTemplate(e){let t=new O,o=D(e,_(".profile-tree-item-container.new-profile-resource-type-container")),n=D(o,_(".profile-resource-type-label-container")),r=D(n,_("span.profile-resource-type-label")),s=t.add(new nbe({items:[]}));D(D(o,_(".profile-resource-options-container")),s.domNode);let l=D(o,_(".profile-resource-actions-container")),c=t.add(this.instantiationService.createInstance(dl,l,{hoverDelegate:t.add(Dg()),highlightToggledItems:!0}));return{label:r,radio:s,actionBar:c,disposables:t,elementDisposables:t.add(new O)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n,root:r}=e;if(!(r instanceof Ew))throw new Error("NewProfileResourceTreeRenderer can only render new profile element");if(We(n)||!Yqi(n))throw new Error("Invalid profile resource element");let s=this.getResourceTypeTitle(n.resourceType);o.label.textContent=s;let l=()=>{let u=[{text:d(17600,null),tooltip:d(17601,null,s)},{text:d(17635,null),tooltip:d(17636,null,s)}],p=r.getCopyFromName(),h=p===this.userDataProfilesService.defaultProfile.name?d(17593,null,p):p;r.copyFrom&&h?(o.radio.setItems([{text:h,tooltip:h?d(17595,null,s,h):d(17592,null)},...u]),o.radio.setActiveItem(r.getCopyFlag(n.resourceType)?0:r.getFlag(n.resourceType)?1:2)):(o.radio.setItems(u),o.radio.setActiveItem(r.getFlag(n.resourceType)?0:1))};r.copyFrom?o.elementDisposables.add(o.radio.onDidSelect(u=>{r.setFlag(n.resourceType,u===1),r.setCopyFlag(n.resourceType,u===0)})):o.elementDisposables.add(o.radio.onDidSelect(u=>{r.setFlag(n.resourceType,u===0)})),l(),o.radio.setEnabled(!r.disabled&&!r.previewProfile),o.elementDisposables.add(r.onDidChange(u=>{(u.disabled||u.preview)&&o.radio.setEnabled(!r.disabled&&!r.previewProfile),(u.copyFrom||u.copyFromInfo)&&l()}));let c=[];n.openAction&&c.push(n.openAction),n.actions?.primary&&c.push(...n.actions.primary),o.actionBar.setActions(c)}};bae=I([m(0,hn),m(1,F)],bae);var Sae=class extends xqe{constructor(e){super();this.instantiationService=e;this.templateId=Sae.TEMPLATE_ID;this.labels=e.createInstance(jl,JH),this.hoverDelegate=this._register(e.createInstance(Kf,"mouse",void 0,{}))}static{this.TEMPLATE_ID="ProfileResourceChildTreeItemTemplate"}renderTemplate(e){let t=new O,o=D(e,_(".profile-tree-item-container.profile-resource-child-container")),n=t.add(new qf("",!1,Ag));D(o,n.domNode);let r=t.add(this.labels.create(o,{hoverDelegate:this.hoverDelegate})),s=D(o,_(".profile-resource-actions-container")),l=t.add(this.instantiationService.createInstance(dl,s,{hoverDelegate:t.add(Dg()),highlightToggledItems:!0}));return{checkbox:n,resourceLabel:r,actionBar:l,disposables:t,elementDisposables:t.add(new O)}}renderElement({element:e},t,o){o.elementDisposables.clear();let{element:n}=e;if(We(n)||!KVo(n))throw new Error("Invalid profile resource element");n.checkbox?(o.checkbox.domNode.setAttribute("tabindex","0"),o.checkbox.domNode.classList.remove("hide"),o.checkbox.checked=n.checkbox.isChecked,o.checkbox.domNode.ariaLabel=n.checkbox.accessibilityInformation?.label??"",n.checkbox.accessibilityInformation?.role&&(o.checkbox.domNode.role=n.checkbox.accessibilityInformation.role)):(o.checkbox.domNode.removeAttribute("tabindex"),o.checkbox.domNode.classList.add("hide")),o.resourceLabel.setResource({name:n.resource?Be(n.resource):n.label,description:n.description,resource:n.resource},{forceLabel:!0,icon:n.icon,hideIcon:!n.resource&&!n.icon});let r=[];n.openAction&&r.push(n.openAction),n.actions?.primary&&r.push(...n.actions.primary),o.actionBar.setActions(r)}};Sae=I([m(0,F)],Sae);var GXt=class a{constructor(){this.templateId=a.TEMPLATE_ID}static{this.TEMPLATE_ID="empty"}renderTemplate(i){return{}}renderElement(i,e,t){}disposeTemplate(){}},Iae=class{constructor(i,e){this.uriIdentityService=i;this.labelService=e;this.templateId=Iae.TEMPLATE_ID}static{this.TEMPLATE_ID="host"}renderTemplate(i){let e=new O,t=e.add(new O),o=i.appendChild(_(".host")),n=o.appendChild(_("div.host-label")),r=o.appendChild(_("div.button-bar"));return{element:o,hostContainer:n,buttonBarContainer:r,disposables:e,renderDisposables:t}}renderElement(i,e,t){t.renderDisposables.clear(),t.renderDisposables.add({dispose:()=>{St(t.buttonBarContainer)}}),t.hostContainer.innerText=GVo(this.labelService,i.workspace),t.element.classList.toggle("current-workspace",this.uriIdentityService.extUri.isEqual(i.workspace,i.profileElement.getCurrentWorkspace())),t.hostContainer.style.display="",t.buttonBarContainer.style.display="none"}disposeTemplate(i){i.disposables.dispose()}};Iae=I([m(0,gt),m(1,nt)],Iae);var yae=class{constructor(i,e){this.uriIdentityService=i;this.hoverService=e;this.templateId=yae.TEMPLATE_ID;this.hoverDelegate=yi("mouse")}static{this.TEMPLATE_ID="path"}renderTemplate(i){let e=new O,t=i.appendChild(_(".path")),o=t.appendChild(_("div.path-label")),n=e.add(this.hoverService.setupManagedHover(this.hoverDelegate,o,"")),r=e.add(new O);return{element:t,pathLabel:o,pathHover:n,disposables:e,renderDisposables:r}}renderElement(i,e,t){t.renderDisposables.clear();let o=this.formatPath(i.workspace);t.pathLabel.innerText=o,t.element.classList.toggle("current-workspace",this.uriIdentityService.extUri.isEqual(i.workspace,i.profileElement.getCurrentWorkspace())),t.pathHover.update(o)}disposeTemplate(i){i.disposables.dispose(),i.renderDisposables.dispose()}formatPath(i){if(i.scheme===Q.file)return dm(i.fsPath);if(i.path.startsWith(Vo.sep)){let e=i.path.substring(1);if(pY(e,!0))return dm(Gs.normalize(e),!0)}return i.path}};yae=I([m(0,gt),m(1,ot)],yae);var Cqe=class{constructor(i,e,t,o){this.item=i;this.userDataProfilesService=e;this.id="changeProfile";this.label="Change Profile";this.class=q.asClassName(SLn);this.tooltip=d(17588,null);this.checked=!1;this.enabled=!t.extUri.isEqual(i.workspace,o.agentSessionsWorkspace)}run(){}getSwitchProfileActions(){return this.userDataProfilesService.profiles.filter(i=>!i.isInternal).sort((i,e)=>i.isDefault?-1:e.isDefault?1:i.name.localeCompare(e.name)).map(i=>({id:`switchProfileTo${i.id}`,label:i.name,class:void 0,enabled:!0,checked:i.id===this.item.profileElement.profile.id,tooltip:"",run:()=>{i.id!==this.item.profileElement.profile.id&&this.userDataProfilesService.updateProfile(i,{workspaces:[...i.workspaces??[],this.item.workspace]})}}))}};Cqe=I([m(1,hn),m(2,gt),m(3,ko)],Cqe);var wae=class{constructor(i,e,t,o,n){this.userDataProfilesService=i;this.userDataProfileManagementService=e;this.contextMenuService=t;this.uriIdentityService=o;this.environmentService=n;this.templateId=wae.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=new O,t=i.appendChild(_(".profile-workspaces-actions-container")),o=e.add(Dg());return{actionBar:e.add(new oo(t,{hoverDelegate:o,actionViewItemProvider:r=>{if(r instanceof Cqe)return new rh(r,{getActions:()=>r.getSwitchProfileActions()},this.contextMenuService,{classNames:r.class,hoverDelegate:o})}})),disposables:e}}renderElement(i,e,t){t.actionBar.clear();let o=[];o.push(this.createOpenAction(i)),o.push(new Cqe(i,this.userDataProfilesService,this.uriIdentityService,this.environmentService)),o.push(this.createDeleteAction(i)),t.actionBar.push(o,{icon:!0})}createOpenAction(i){return{label:"",class:q.asClassName(L.window),enabled:!this.uriIdentityService.extUri.isEqual(i.workspace,i.profileElement.getCurrentWorkspace()),id:"openWorkspace",tooltip:d(17638,null),run:()=>i.profileElement.openWorkspace(i.workspace)}}createDeleteAction(i){let e=this.uriIdentityService.extUri.isEqual(i.workspace,this.environmentService.agentSessionsWorkspace);return{label:"",class:q.asClassName(ILn),enabled:this.userDataProfileManagementService.getDefaultProfileToUse().id!==i.profileElement.profile.id&&!e,id:"deleteTrustedUri",tooltip:d(17606,null),run:()=>i.profileElement.updateWorkspaces([],[i.workspace])}}disposeTemplate(i){i.disposables.dispose()}};wae=I([m(0,hn),m(1,s_),m(2,Xe),m(3,gt),m(4,ko)],wae);function GVo(a,i){return i.authority?a.getHostLabel(i.scheme,i.authority):d(17628,null)}var GO=class extends Ls{constructor(e){super();this.instantiationService=e;this.resource=void 0;this._dirty=!1;this.model=Z1.getInstance(this.instantiationService),this._register(this.model.onDidChange(t=>this.dirty=this.model.profiles.some(o=>o instanceof Ew)))}static{this.ID="workbench.input.userDataProfiles"}get dirty(){return this._dirty}set dirty(e){this._dirty!==e&&(this._dirty=e,this._onDidChangeDirty.fire())}get capabilities(){return 2048}get typeId(){return GO.ID}getName(){return d(17654,null)}getIcon(){return Fao}async resolve(){return await this.model.resolve(),this.model}isDirty(){return this.dirty}async save(){return await this.model.saveNewProfile(),this}async revert(){this.model.revert()}matches(e){return e instanceof GO}dispose(){for(let e of this.model.profiles)e instanceof Gm&&e.reset();super.dispose()}};GO=I([m(0,F)],GO);var qXt=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(GO)}};var o$i=new R("OpenProfile"),$Xt=new R("Profiles"),OIe=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.userDataProfileManagementService=o;this.telemetryService=n;this.workspaceContextService=r;this.workspaceTagsService=s;this.editorService=c;this.instantiationService=u;this.lifecycleService=p;this.urlService=h;this.profilesDisposable=this._register(new ue);this.currentProfileContext=ZYe.bindTo(l),this.currentProfileContext.set(this.userDataProfileService.currentProfile.id),this._register(this.userDataProfileService.onDidChangeCurrentProfile(f=>{this.currentProfileContext.set(this.userDataProfileService.currentProfile.id)})),this.hasProfilesContext=L3.bindTo(l),this.hasProfilesContext.set(this.userDataProfilesService.profiles.filter(f=>!f.isInternal).length>1),this._register(this.userDataProfilesService.onDidChangeProfiles(f=>this.hasProfilesContext.set(this.userDataProfilesService.profiles.filter(v=>!v.isInternal).length>1))),this.registerEditor(),this.registerActions(),this._register(this.urlService.registerHandler(this)),Ft&&p.when(4).then(()=>t.cleanUp()),this.reportWorkspaceProfileInfo(),g.options?.profileToPreview&&p.when(3).then(()=>this.handleURL(A.revive(g.options.profileToPreview))),this.registerDropHandler()}static{this.ID="workbench.contrib.userDataProfiles"}async handleURL(e){if(pDe(e)){let t=await this.openProfilesEditor();if(t)return t.createNewProfile(e),!0}return!1}async openProfilesEditor(){return await this.editorService.openEditor(new GO(this.instantiationService))}registerEditor(){oe.as(en.EditorPane).registerEditorPane(os.create(C7,C7.ID,d(17579,null)),[new Vt(GO)]),oe.as(en.EditorFactory).registerEditorSerializer(GO.ID,qXt)}registerDropHandler(){let e=oe.as(WB.DragAndDropContribution),t=this;this._register(e.registerDropHandler(new class{async handleDrop(n,r){let s=r.get(gt),l=r.get(MH),c=r.get(ie),u=r.get(TE),p=r.get(Ne);if(s.extUri.extname(n)===`.${XYe}`){if(!await l.resolveProfileTemplate(n))return p.warn(d(17563,null)),c.openEditor(u.createTextEditor({resource:n})),!0;let g=await t.openProfilesEditor();if(g)try{await g.createNewProfile(n)}catch{return!1}return!0}return!1}}))}registerActions(){this.registerProfileSubMenu(),this._register(this.registerManageProfilesAction()),this._register(this.registerSwitchProfileAction()),this.registerOpenProfileSubMenu(),this.registerNewWindowWithProfileAction(),this.registerProfilesActions(),this._register(this.userDataProfilesService.onDidChangeProfiles(()=>this.registerProfilesActions())),this._register(this.registerExportCurrentProfileAction()),this.registerCreateFromCurrentProfileAction(),this.registerNewProfileAction(),this.registerDeleteProfileAction(),this.registerHelpAction()}registerProfileSubMenu(){let e=()=>d(17575,null,this.userDataProfileService.currentProfile.name);be.appendMenuItem(R.GlobalActivity,{get title(){return e()},submenu:$Xt,group:"2_configuration",order:1,when:L3}),be.appendMenuItem(R.MenubarPreferencesMenu,{get title(){return e()},submenu:$Xt,group:"2_configuration",order:1,when:C.and(L3,qo.negate())})}registerOpenProfileSubMenu(){be.appendMenuItem(R.MenubarFileMenu,{title:d(17566,null),submenu:o$i,group:"1_new",order:4})}registerProfilesActions(){this.profilesDisposable.value=new O;for(let e of this.userDataProfilesService.profiles)e.isInternal||(this.profilesDisposable.value.add(this.registerProfileEntryAction(e)),this.profilesDisposable.value.add(this.registerNewWindowAction(e)))}registerProfileEntryAction(e){let t=this;return W(class extends z{constructor(){super({id:`workbench.profiles.actions.profileEntry.${e.id}`,title:e.name,metadata:{description:P(17556,"Switch to {0} profile",e.name)},toggled:C.equals(ZYe.key,e.id),menu:[{id:$Xt,group:"0_profiles"}]})}async run(n){if(t.userDataProfileService.currentProfile.id!==e.id)return t.userDataProfileManagementService.switchProfile(e)}})}registerNewWindowWithProfileAction(){return W(class extends z{constructor(){super({id:"workbench.profiles.actions.newWindowWithProfile",title:P(17568,"New Window with Profile..."),category:z0,precondition:L3,f1:!0})}async run(t){let o=t.get($e),n=t.get(hn),r=t.get(ti),s=await o.pick(n.profiles.filter(l=>!l.isInternal).map(l=>({label:l.name,profile:l})),{title:d(17567,null),placeHolder:d(17573,null),canPickMany:!1});if(s)return r.openWindow({remoteAuthority:null,forceProfile:s.profile.name})}})}registerNewWindowAction(e){let t=new O,o=`workbench.action.openProfile.${e.name.replace("/s+/","_")}`,n=L3;return t.add(W(class extends z{constructor(){super({id:o,title:P(17572,"{0}",e.name),metadata:{description:P(17570,"Open New Window with {0} Profile",e.name)},menu:{id:o$i,group:"0_profiles",when:n}})}run(s){return s.get(ti).openWindow({remoteAuthority:null,forceProfile:e.name})}})),t.add(be.appendMenuItem(R.CommandPalette,{command:{id:o,category:z0,title:P(17569,"Open {0} Profile",e.name),precondition:n}})),t}registerSwitchProfileAction(){let e=this;return W(class extends z{constructor(){super({id:"workbench.profiles.actions.switchProfile",title:P(17578,"Switch Profile..."),category:z0,f1:!0})}async run(o){let n=o.get($e),r=[];for(let l of e.userDataProfilesService.profiles)l.isInternal||r.push({id:l.id,label:l.id===e.userDataProfileService.currentProfile.id?`$(check) ${l.name}`:l.name,profile:l});let s=await n.pick(r.sort((l,c)=>l.profile.name.localeCompare(c.profile.name)),{placeHolder:d(17577,null)});s&&await e.userDataProfileManagementService.switchProfile(s.profile)}})}registerManageProfilesAction(){let e=new O;return e.add(W(class extends z{constructor(){super({id:"workbench.profiles.actions.manageProfiles",title:{...P(17564,"Profiles"),mnemonicTitle:d(17565,null)},menu:[{id:R.GlobalActivity,group:"2_configuration",order:1,when:L3.negate()},{id:R.MenubarPreferencesMenu,group:"2_configuration",order:1,when:C.and(L3.negate(),qo.negate())},{id:$Xt,group:"1_manage",order:1}]})}run(o){let n=o.get(ie),r=o.get(F);return n.openEditor(new GO(r))}})),e.add(be.appendMenuItem(R.CommandPalette,{command:{id:"workbench.profiles.actions.manageProfiles",category:Fe.Preferences,title:P(17571,"Open Profiles (UI)")}})),e}registerExportCurrentProfileAction(){let e=this,t=new O,o="workbench.profiles.actions.exportProfile";return t.add(W(class extends z{constructor(){super({id:o,title:P(17561,"Export Profile..."),category:z0,f1:!0})}async run(){(await e.openProfilesEditor())?.selectProfile(e.userDataProfileService.currentProfile)}})),t.add(be.appendMenuItem(R.MenubarShare,{command:{id:o,title:P(17562,"Export Profile ({0})...",e.userDataProfileService.currentProfile.name)}})),t}registerCreateFromCurrentProfileAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.profiles.actions.createFromCurrentProfile",title:P(17576,"Save Current Profile As..."),category:z0,f1:!0})}async run(){(await e.openProfilesEditor())?.createNewProfile(e.userDataProfileService.currentProfile)}}))}registerNewProfileAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.profiles.actions.createProfile",title:P(17557,"New Profile..."),category:z0,f1:!0,menu:[{id:o$i,group:"1_manage_profiles",order:1}]})}async run(o){return(await e.openProfilesEditor())?.createNewProfile()}}))}registerDeleteProfileAction(){this._register(W(class extends z{constructor(){super({id:"workbench.profiles.actions.deleteProfile",title:P(17559,"Delete Profile..."),category:z0,f1:!0,precondition:L3})}async run(t){let o=t.get($e),n=t.get(gn),r=t.get(hn),s=t.get(s_),l=t.get(Ne),c=r.profiles.filter(u=>!u.isDefault&&!u.isInternal);if(c.length){let u=await o.pick(c.map(p=>({label:p.name,description:p.id===n.currentProfile.id?d(17558,null):void 0,profile:p})),{title:d(17560,null),placeHolder:d(17574,null),canPickMany:!0});if(u)try{await Promise.all(u.map(p=>s.removeProfile(p.profile)))}catch(p){l.error(p)}}}}))}registerHelpAction(){this._register(W(class extends z{constructor(){super({id:"workbench.profiles.actions.help",title:vSi,category:Fe.Help,menu:[{id:R.CommandPalette}]})}run(t){return t.get(Je).open(A.parse("https://aka.ms/vscode-profiles-help"))}}))}async reportWorkspaceProfileInfo(){await this.lifecycleService.when(4);let e=this.userDataProfilesService.profiles.filter(o=>!o.isInternal).length-1;e>0&&this.telemetryService.publicLog2("profiles:count",{count:e});let t=await this.workspaceTagsService.getTelemetryWorkspaceId(this.workspaceContextService.getWorkspace(),this.workspaceContextService.getWorkbenchState());this.telemetryService.publicLog2("workspaceProfileInfo",{workspaceId:t,defaultProfile:this.userDataProfileService.currentProfile.isDefault})}};OIe=I([m(0,gn),m(1,hn),m(2,s_),m(3,_e),m(4,Ae),m(5,yqe),m(6,X),m(7,ie),m(8,F),m(9,to),m(10,tS),m(11,Od)],OIe);var n$i=class a extends z{static{this.ID="workbench.profiles.actions.createTemporaryProfile"}static{this.TITLE=P(17581,"New Window with Temporary Profile")}constructor(){super({id:a.ID,title:a.TITLE,category:z0,f1:!0})}async run(i){i.get(ti).openWindow({forceTempProfile:!0})}};W(n$i);W(class extends z{constructor(){super({id:"workbench.profiles.actions.cleanupProfiles",title:P(17580,"Cleanup Profiles"),category:Fe.Developer,f1:!0})}async run(i){return i.get(hn).cleanUp()}});W(class extends z{constructor(){super({id:"workbench.profiles.actions.resetWorkspaces",title:P(17582,"Reset Workspace Profiles Associations"),category:Fe.Developer,f1:!0})}async run(i){return i.get(hn).resetWorkspaces()}});bt(OIe.ID,OIe,vt.BlockRestore);var k7=P(11245,"Cloud Changes"),ez=le("IEditSessionsStorageService"),uht=le("IEditSessionsLogService");var qVo=3,kqe="editSessionsSignedIn",$Vo=new Y(kqe,!1),jXt="editSessionsPending",jVo=new Y(jXt,!1),r$i="workbench.view.editSessions",QXt="workbench.views.editSessions.data",FIe=P(11245,"Cloud Changes"),QVo=Oe("edit-sessions-view-icon",L.cloudDownload,d(11246,null)),YXt=new Y("editSessionsShowView",!1),Eqe="vscode-edit-sessions";function XXt(a,i){switch(a){case 1:return Ke.fromString(i);case 2:return Ws(i);default:throw new Error("Upgrade to a newer version to decode this content.")}}function JXt(a){let i=new wI;return i.update(a),i.digest()}var pht="editSessions";var tz=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.fileService=e;this.storageService=t;this.quickInputService=o;this.authenticationService=n;this.extensionService=r;this.environmentService=s;this.logService=l;this.productService=c;this.contextKeyService=u;this.dialogService=p;this.secretStorageService=h;this.SIZE_LIMIT=Math.floor(1024*1024*1.9);this.initialized=!1;this._didSignIn=this._register(new T);this._didSignOut=this._register(new T);this._lastWrittenResources=new Map;this._lastReadResources=new Map;this.serverConfiguration=this.productService["editSessions.store"],this._register(this.authenticationService.onDidChangeSessions(g=>this.onDidChangeSessions(g.event))),this._register(this.storageService.onDidChangeValue(-1,tz.CACHED_SESSION_STORAGE_KEY,this._store)(()=>this.onDidChangeStorage())),this.registerSignInAction(),this.registerResetAuthenticationAction(),this.signedInContext=$Vo.bindTo(this.contextKeyService),this.signedInContext.set(this.existingSessionId!==void 0)}static{this.CACHED_SESSION_STORAGE_KEY="editSessionAccountPreference"}get isSignedIn(){return this.existingSessionId!==void 0}get onDidSignIn(){return this._didSignIn.event}get onDidSignOut(){return this._didSignOut.event}get lastWrittenResources(){return this._lastWrittenResources}get lastReadResources(){return this._lastReadResources}async write(e,t){if(await this.initialize("write",!1),!this.initialized)throw new Error("Please sign in to store your edit session.");typeof t!="string"&&t.machine===void 0&&(t.machine=await this.getOrCreateCurrentMachineId()),t=typeof t=="string"?t:JSON.stringify(t);let o=await this.storeClient.writeResource(e,t,null,void 0,$it(ht()));return this._lastWrittenResources.set(e,{ref:o,content:t}),o}async read(e,t){if(await this.initialize("read",!1),!this.initialized)throw new Error("Please sign in to apply your latest edit session.");let o,n=$it(ht());try{if(t!==void 0)o=await this.storeClient?.resolveResourceContent(e,t,void 0,n);else{let r=await this.storeClient?.readResource(e,null,void 0,n);o=r?.content,t=r?.ref}}catch(r){this.logService.error(r)}if(o!=null&&t!==void 0)return this._lastReadResources.set(e,{ref:t,content:o}),{ref:t,content:o}}async delete(e,t){if(await this.initialize("write",!1),!this.initialized)throw new Error(`Unable to delete edit session with ref ${t}.`);try{await this.storeClient?.deleteResource(e,t)}catch(o){this.logService.error(o)}}async list(e){if(await this.initialize("read",!1),!this.initialized)throw new Error("Unable to list edit sessions.");try{return this.storeClient?.getAllResourceRefs(e)??[]}catch(t){this.logService.error(t)}return[]}async initialize(e,t=!1){return this.initialized?!0:(this.initialized=await this.doInitialize(e,t),this.signedInContext.set(this.initialized),this.initialized&&this._didSignIn.fire(),this.initialized)}async doInitialize(e,t){if(await this.extensionService.whenInstalledExtensionsRegistered(),!this.serverConfiguration?.url)throw new Error("Unable to initialize sessions sync as session sync preference is not configured in product.json.");if(this.storeClient===void 0)return!1;if(this._register(this.storeClient.onTokenFailed(()=>{this.logService.info("Clearing edit sessions authentication preference because of successive token failures."),this.clearAuthenticationPreference()})),this.machineClient===void 0&&(this.machineClient=new HW(this.environmentService,this.fileService,this.storageService,this.storeClient,this.logService,this.productService)),this.authenticationInfo!==void 0)return!0;let o=await this.getAuthenticationSession(e,t);return o!==void 0&&(this.authenticationInfo=o,this.storeClient.setAuthToken(o.token,o.providerId)),o!==void 0}async getMachineById(e){if(await this.initialize("read",!1),!this.cachedMachines){let t=await this.machineClient.getMachines();this.cachedMachines=t.reduce((o,n)=>o.set(n.id,n.name),new Map)}return this.cachedMachines.get(e)}async getOrCreateCurrentMachineId(){let e=await this.machineClient.getMachines().then(t=>t.find(o=>o.isCurrent)?.id);return e===void 0?(await this.machineClient.addCurrentMachine(),await this.machineClient.getMachines().then(t=>t.find(o=>o.isCurrent).id)):e}async getAuthenticationSession(e,t){if(this.existingSessionId){this.logService.info(`Searching for existing authentication session with ID ${this.existingSessionId}`);let n=await this.getExistingSession();if(n)return this.logService.info(`Found existing authentication session with ID ${n.session.id}`),{sessionId:n.session.id,token:n.session.idToken??n.session.accessToken,providerId:n.session.providerId};this._didSignOut.fire()}if(this.shouldAttemptEditSessionInit()){this.logService.info("Reusing user data sync enablement");let n=await ite(this.secretStorageService,this.productService);if(n!==void 0)return this.logService.info(`Using current authentication session with ID ${n.id}`),this.existingSessionId=n.id,{sessionId:n.id,token:n.accessToken,providerId:n.providerId}}if(t)return;let o=await this.getAccountPreference(e);if(o!==void 0)return this.existingSessionId=o.id,{sessionId:o.id,token:o.idToken??o.accessToken,providerId:o.providerId}}shouldAttemptEditSessionInit(){return Ft&&this.storageService.isNew(-1)&&this.storageService.isNew(1)}async getAccountPreference(e){let t=new O,o=t.add(this.quickInputService.createQuickPick({useSeparators:!0}));return o.ok=!1,o.placeholder=e==="read"?d(11222,null):d(11221,null),o.ignoreFocusOut=!0,o.items=await this.createQuickpickItems(),new Promise((n,r)=>{t.add(o.onDidHide(s=>{r(new qi),t.dispose()})),t.add(o.onDidAccept(async s=>{let l=o.selectedItems[0],c="provider"in l?{...await this.authenticationService.createSession(l.provider.id,l.provider.scopes),providerId:l.provider.id}:"session"in l?l.session:void 0;n(c),o.hide()})),o.show()})}async createQuickpickItems(){let e=[];e.push({type:"separator",label:d(11230,null)});let t=await this.getAllSessions();e.push(...t),e.push({type:"separator",label:d(11224,null)});for(let o of await this.getAuthenticationProviders())if(!t.some(r=>r.session.providerId===o.id)||this.authenticationService.getProvider(o.id).supportsMultipleAccounts){let r=this.authenticationService.getProvider(o.id).label;e.push({label:d(11228,null,r),provider:o})}return e}async getAllSessions(){let e=await this.getAuthenticationProviders(),t=new Map,o;for(let n of e){let r=await this.authenticationService.getSessions(n.id,n.scopes);for(let s of r){let l={label:s.account.label,description:this.authenticationService.getProvider(n.id).label,session:{...s,providerId:n.id}};t.set(l.session.account.id,l),this.existingSessionId===s.id&&(o=l)}}return o!==void 0&&t.set(o.session.account.id,o),[...t.values()].sort((n,r)=>n.label.localeCompare(r.label))}async getAuthenticationProviders(){if(!this.serverConfiguration)throw new Error("Unable to get configured authentication providers as session sync preference is not configured in product.json.");let e=this.serverConfiguration.authenticationProviders,t=Object.keys(e).reduce((n,r)=>(n.push({id:r,scopes:e[r].scopes}),n),[]),o=this.authenticationService.declaredProviders;return t.filter(({id:n})=>o.some(r=>r.id===n))}get existingSessionId(){return this.storageService.get(tz.CACHED_SESSION_STORAGE_KEY,-1)}set existingSessionId(e){this.logService.trace(`Saving authentication session preference for ID ${e}.`),e===void 0?this.storageService.remove(tz.CACHED_SESSION_STORAGE_KEY,-1):this.storageService.store(tz.CACHED_SESSION_STORAGE_KEY,e,-1,1)}async getExistingSession(){return(await this.getAllSessions()).find(t=>t.session.id===this.existingSessionId)}async onDidChangeStorage(){let e=this.existingSessionId,t=this.authenticationInfo?.sessionId;t!==e&&(this.logService.trace(`Resetting authentication state because authentication session ID preference changed from ${t} to ${e}.`),this.authenticationInfo=void 0,this.initialized=!1)}clearAuthenticationPreference(){this.authenticationInfo=void 0,this.initialized=!1,this.existingSessionId=void 0,this.signedInContext.set(!1)}onDidChangeSessions(e){this.authenticationInfo?.sessionId&&e.removed?.find(t=>t.id===this.authenticationInfo?.sessionId)&&this.clearAuthenticationPreference()}registerSignInAction(){if(!this.serverConfiguration?.url)return;let e=this,t="workbench.editSessions.actions.signIn",o=C.and(C.equals(jXt,!1),C.equals(kqe,!1));this._register(W(class extends z{constructor(){super({id:t,title:d(11226,null),category:k7,precondition:o,menu:[{id:R.CommandPalette},{id:R.AccountsContext,group:"2_editSessions",when:o}]})}async run(){return await e.initialize("write",!1)}})),this._register(be.appendMenuItem(R.AccountsContext,{group:"2_editSessions",command:{id:t,title:d(11227,null)},when:C.and(C.equals(jXt,!0),C.equals(kqe,!1))}))}registerResetAuthenticationAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.resetAuth",title:d(11225,null),category:k7,precondition:C.equals(kqe,!0),menu:[{id:R.CommandPalette},{id:R.AccountsContext,group:"2_editSessions",when:C.equals(kqe,!0)}]})}async run(){let o=await e.dialogService.confirm({message:d(11229,null),checkbox:{label:d(11223,null)}});o.confirmed&&(o.checkboxChecked&&e.storeClient?.deleteResource("editSessions",null),e.clearAuthenticationPreference())}}))}};tz=I([m(0,ge),m(1,de),m(2,$e),m(3,ks),m(4,lt),m(5,ko),m(6,uht),m(7,Ze),m(8,X),m(9,ct),m(10,fC)],tz);var Tqe=class extends Mz{constructor(i,e){super(),this.logger=this._register(i.createLogger(Ve(e.logsHome,`${pht}.log`),{id:pht,name:d(11247,null),group:eP}))}trace(i,...e){this.logger.trace(i,...e)}debug(i,...e){this.logger.debug(i,...e)}info(i,...e){this.logger.info(i,...e)}warn(i,...e){this.logger.warn(i,...e)}error(i,...e){this.logger.error(i,...e)}flush(){this.logger.flush()}};Tqe=I([m(0,Ol),m(1,ko)],Tqe);var s$i="editSessionsCount",wLn=new Y(s$i,0),_qe=class extends k{constructor(e,t){super();this.instantiationService=t;this.registerViews(e)}registerViews(e){let t=QXt,o=this.instantiationService.createInstance(GG,t,FIe.value);o.showCollapseAllAction=!0,o.showRefreshAction=!0,o.dataProvider=this.instantiationService.createInstance(mht);let n=oe.as(Kn.ViewsRegistry);n.registerViews([{id:t,name:FIe,ctorDescriptor:new Vt(_R),canToggleVisibility:!0,canMoveView:!1,treeView:o,collapsed:!1,when:C.and(YXt),order:100,hideByDefault:!0}],e),n.registerViewWelcomeContent(t,{content:d(11238,null,`[${d(11240,null)}](${nc("workbench.editSessions.actions.store")})`),when:C.equals(s$i,0),order:1}),this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.resume",title:d(11243,null),icon:L.desktopDownload,menu:{id:R.ViewItemContext,when:C.and(C.equals("view",t),C.regex("viewItem",/edit-session/i)),group:"inline"}})}async run(r,s){let l=A.parse(s.$treeItemHandle).path.substring(1);await r.get(fe).executeCommand("workbench.editSessions.actions.resumeLatest",l,!0),await o.refresh()}})),this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.store",title:d(11244,null),icon:L.cloudUpload})}async run(r,s){await r.get(fe).executeCommand("workbench.editSessions.actions.storeCurrent"),await o.refresh()}})),this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.delete",title:d(11241,null),icon:L.trash,menu:{id:R.ViewItemContext,when:C.and(C.equals("view",t),C.regex("viewItem",/edit-session/i)),group:"inline"}})}async run(r,s){let l=A.parse(s.$treeItemHandle).path.substring(1),c=r.get(ct),u=r.get(ez);(await c.confirm({message:d(11236,null,l),detail:d(11235,null),type:"warning",title:FIe.value})).confirmed&&(await u.delete("editSessions",l),await o.refresh())}})),this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.deleteAll",title:d(11242,null),icon:L.trash,menu:{id:R.ViewTitle,when:C.and(C.equals("view",t),C.greater(s$i,0))}})}async run(r){let s=r.get(ct),l=r.get(ez);(await s.confirm({message:d(11233,null),detail:d(11234,null),type:"warning",title:FIe.value})).confirmed&&(await l.delete("editSessions",null),await o.refresh())}}))}};_qe=I([m(1,F)],_qe);var mht=class{constructor(i,e,t,o){this.editSessionsStorageService=i;this.contextKeyService=e;this.workspaceContextService=t;this.fileService=o;this.editSessionsCount=wLn.bindTo(this.contextKeyService)}async getChildren(i){if(!i)return this.getAllEditSessions();let[e,t,o]=A.parse(i.handle).path.substring(1).split("/");return e&&!t?this.getEditSession(e):e&&t&&!o?this.getEditSessionFolderContents(e,t):[]}async getAllEditSessions(){let i=await this.editSessionsStorageService.list("editSessions");this.editSessionsCount.set(i.length);let e=[];for(let t of i){let o=A.from({scheme:Eqe,authority:"remote-session-content",path:`/${t.ref}`}),n=await this.editSessionsStorageService.read("editSessions",t.ref);if(!n)continue;let r=JSON.parse(n.content),s=r.folders.map(p=>p.name).join(", ")??t.ref,l=r.machine,c=l?await this.editSessionsStorageService.getMachineById(l):void 0,u=c===void 0?ea(t.created,!0):`${ea(t.created,!0)}\xA0\xA0\u2022\xA0\xA0${c}`;e.push({handle:o.toString(),collapsibleState:1,label:{label:s},description:u,themeIcon:L.repo,contextValue:"edit-session"})}return e}async getEditSession(i){let e=await this.editSessionsStorageService.read("editSessions",i);if(!e)return[];let t=JSON.parse(e.content);if(t.folders.length===1){let o=t.folders[0];return this.getEditSessionFolderContents(i,o.name)}return t.folders.map(o=>({handle:A.from({scheme:Eqe,authority:"remote-session-content",path:`/${e.ref}/${o.name}`}).toString(),collapsibleState:1,label:{label:o.name},themeIcon:L.folder}))}async getEditSessionFolderContents(i,e){let t=await this.editSessionsStorageService.read("editSessions",i);if(!t)return[];let o=JSON.parse(t.content),n=this.workspaceContextService.getWorkspace().folders.find(s=>s.name===e),r=o.folders.find(s=>s.name===e);return r?Promise.all(r.workingChanges.map(async s=>{let l=A.from({scheme:Eqe,authority:"remote-session-content",path:`/${t.ref}/${e}/${s.relativeFilePath}`});if(n?.uri){let c=Ve(n.uri,s.relativeFilePath);if(s.type===1&&await this.fileService.exists(c))return{handle:l.toString(),resourceUri:l,collapsibleState:0,label:{label:s.relativeFilePath},themeIcon:L.file,command:{id:"vscode.diff",title:d(11232,null),arguments:[c,l,`${Jo(s.relativeFilePath)} (${d(11237,null)} \u2194 ${d(11231,null)})`,void 0]}}}return{handle:l.toString(),resourceUri:l,collapsibleState:0,label:{label:s.relativeFilePath},themeIcon:L.file,command:{id:Xg,title:d(11239,null),arguments:[l,void 0,void 0]}}})):[]}};mht=I([m(0,ez),m(1,X),m(2,Ae),m(3,ge)],mht);var WIe=class{constructor(i){this.editSessionsStorageService=i;this.capabilities=2050;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None}static{this.SCHEMA=Eqe}async readFile(i){let e=/(?<ref>[^/]+)\/(?<folderName>[^/]+)\/(?<filePath>.*)/.exec(i.path.substring(1));if(!e?.groups)throw"EntryNotFound";let{ref:t,folderName:o,filePath:n}=e.groups,r=await this.editSessionsStorageService.read("editSessions",t);if(!r)throw"EntryNotFound";let s=JSON.parse(r.content),l=s.folders.find(c=>c.name===o)?.workingChanges.find(c=>c.relativeFilePath===n);if(!l||l.type===2)throw"EntryNotFound";return XXt(s.version,l.contents).buffer}async stat(i){let e=await this.readFile(i),t=Date.now();return{type:1,permissions:1,mtime:t,ctime:t,size:e.byteLength}}watch(i,e){return k.None}async mkdir(i){}async readdir(i){return[]}async rename(i,e,t){}async delete(i,e){}async writeFile(){throw new Pj}};WIe=I([m(0,ez)],WIe);var ght=le("IWorkspaceIdentityService"),hht=class{constructor(i,e){this.workspaceContextService=i;this.editSessionIdentityService=e}async getWorkspaceStateFolders(i){let e=[];for(let t of this.workspaceContextService.getWorkspace().folders){let o=await this.editSessionIdentityService.getEditSessionIdentifier(t,i);o&&e.push({resourceUri:t.uri.toString(),workspaceFolderIdentity:o})}return e}async matches(i,e){let t={},o={};for(let l of i)o[l.workspaceFolderIdentity]=l.resourceUri;let n=new Map;for(let l of this.workspaceContextService.getWorkspace().folders){let c=await this.editSessionIdentityService.getEditSessionIdentifier(l,e);c&&n.set(l,c)}for(let[l,c]of n.entries()){let u=o[c];if(u){t[u]=l.uri.toString();continue}let p=!1;for(let[h,g]of Object.entries(o))if(await this.editSessionIdentityService.provideEditSessionIdentityMatch(l,c,h,e)===100){t[g]=l.uri.toString(),p=!0;break}if(!p)return!1}let r=l=>{for(let c of Object.keys(t)){let u=A.parse(c);if(Yr(u,l)){let p=t[c],h=lu(u,l);if(h)return Ve(A.parse(p),h)}}return l},s=(l,c=0)=>{if(!l||c>200||l instanceof Ke||l instanceof Uint8Array)return l;if(A.isUri(l))return r(l);if(Array.isArray(l))for(let u=0;u<l.length;++u)l[u]=s(l[u],c+1);else for(let u in l)Object.hasOwnProperty.call(l,u)&&(l[u]=s(l[u],c+1));return l};return s}};hht=I([m(0,Ae),m(1,mG)],hht);Ce(ght,hht,1);var a$i=class{async writeResource(){}async getAllResourceRefs(){return[]}async resolveResourceContent(){return null}},l$i=class{constructor(){this._onDidChangeEnablement=new T;this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._onDidChangeResourceEnablement=new T;this.onDidChangeResourceEnablement=this._onDidChangeResourceEnablement.event}isEnabled(){return!0}canToggleEnablement(){return!0}setEnablement(i){}isResourceEnabled(i){return!0}isResourceEnablementConfigured(i){return!1}setResourceEnablement(i,e){}getResourceSyncStateVersion(i){}},Dqe=class extends WU{constructor(e,t,o,n,r,s,l,c,u,p,h,g){let f=new a$i,v=new l$i;super({syncResource:"workspaceState",profile:e},t,r,s,u,o,f,v,l,n,c,p);this.workspaceIdentityService=h;this.editSessionsStorageService=g;this.version=1}async sync(){let e=new qe,t=await this.workspaceIdentityService.getWorkspaceStateFolders(e.token);if(!t.length)return null;await this.storageService.flush();let o=this.storageService.keys(1,0);if(!o.length)return null;let n={};o.forEach(s=>{let l=this.storageService.get(s,1);l&&(n[s]=l)});let r={folders:t,storage:n,version:this.version};return await this.editSessionsStorageService.write("workspaceState",nxe(r)),null}async apply(){let e=this.editSessionsStorageService.lastReadResources.get("editSessions")?.content,t=e?JSON.parse(e).workspaceStateId:void 0,o=await this.editSessionsStorageService.read("workspaceState",t);if(!o)return null;let n=Dm(o.content);if(!n)return this.logService.info("Skipping initializing workspace state because remote workspace state does not exist."),null;let r=new qe,s=await this.workspaceIdentityService.matches(n.folders,r.token);if(!s)return this.logService.info("Skipping initializing workspace state because remote workspace state does not match current workspace."),null;let l={};for(let c of Object.keys(n.storage))l[c]=n.storage[c];if(Object.keys(l).length){let c=[];for(let u of Object.keys(l))try{let p=Dm(l[u]);s(p),c.push({key:u,value:p,scope:1,target:0})}catch{c.push({key:u,value:l[u],scope:1,target:0})}this.storageService.storeAll(c,!0)}return this.editSessionsStorageService.delete("workspaceState",o.ref),null}applyResult(e,t,o,n){throw new Error("Method not implemented.")}async generateSyncPreview(e,t,o,n,r){return[]}getMergeResult(e,t){throw new Error("Method not implemented.")}getAcceptResult(e,t,o,n){throw new Error("Method not implemented.")}async hasRemoteChanged(e){return!0}async hasLocalData(){return!1}async resolveContent(e){return null}};Dqe=I([m(4,ge),m(5,ko),m(6,_e),m(7,B),m(8,de),m(9,gt),m(10,ght),m(11,ez)],Dqe);var ZXt=class extends FU{};Ce(uht,Tqe,1);Ce(ez,tz,1);var eJt={id:"_workbench.editSessions.actions.continueEditSession",title:P(11182,"Continue Working On..."),precondition:i_.notEqualsTo("0"),f1:!0},tJt={id:"_workbench.editSessions.actions.continueEditSession.openLocalFolder",title:P(11180,"Open In Local Folder"),category:k7,precondition:C.and(Mu.toNegated(),AM)},JVo={id:"workbench.editSessions.actions.showOutputChannel",title:P(11214,"Show Log"),category:k7},fht={id:"workbench.action.continueOn.extensions",title:d(11194,null)};W(class extends z{constructor(){super({...fht,f1:!1})}async run(a){return a.get(Ui).openSearch("@tag:continueOn")}});var c$i=`[${d(11212,null)}](command:${JVo.id})`,Rqe={location:10,type:"syncing"},XVo="editSessionId",xLn="workbench.editSessions.continueOn",E7=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae){super();this.editSessionsStorageService=e;this.fileService=t;this.progressService=o;this.openerService=n;this.telemetryService=r;this.scmService=s;this.notificationService=l;this.dialogService=c;this.logService=u;this.environmentService=p;this.instantiationService=h;this.productService=g;this.configurationService=f;this.contextService=v;this.editSessionIdentityService=b;this.quickInputService=S;this.commandService=y;this.contextKeyService=w;this.fileDialogService=x;this.lifecycleService=E;this.storageService=M;this.activityService=N;this.editorService=V;this.remoteAgentService=H;this.extensionService=K;this.requestService=j;this.userDataProfilesService=J;this.uriIdentityService=se;this.workspaceIdentityService=ae;this.continueEditSessionOptions=[];this.accountsMenuBadgeDisposable=this._register(new ue);this.registeredCommands=new Set;this.shouldShowViewsContext=YXt.bindTo(this.contextKeyService),this.pendingEditSessionsContext=jVo.bindTo(this.contextKeyService),this.pendingEditSessionsContext.set(!1),this.productService["editSessions.store"]?.url&&(this.editSessionsStorageClient=new ZXt(A.parse(this.productService["editSessions.store"].url),this.productService,this.requestService,this.logService,this.environmentService,this.fileService,this.storageService),this.editSessionsStorageService.storeClient=this.editSessionsStorageClient,this.workspaceStateSynchronizer=new Dqe(this.userDataProfilesService.defaultProfile,void 0,this.editSessionsStorageClient,this.logService,this.fileService,this.environmentService,this.telemetryService,this.configurationService,this.storageService,this.uriIdentityService,this.workspaceIdentityService,this.editSessionsStorageService),this.autoResumeEditSession(),this.registerActions(),this.registerViews(),this.registerContributedEditSessionOptions(),this._register(this.fileService.registerProvider(WIe.SCHEMA,new WIe(this.editSessionsStorageService))),this._register(this.lifecycleService.onWillShutdown(ce=>{ce.reason!==3&&this.editSessionsStorageService.isSignedIn&&this.configurationService.getValue("workbench.experimental.cloudChanges.autoStore")==="onShutdown"&&!Ft&&ce.join(this.autoStoreEditSession(),{id:"autoStoreWorkingChanges",label:d(11172,null)})})),this._register(this.editSessionsStorageService.onDidSignIn(()=>this.updateAccountsMenuBadge())),this._register(this.editSessionsStorageService.onDidSignOut(()=>this.updateAccountsMenuBadge())))}static{this.APPLICATION_LAUNCHED_VIA_CONTINUE_ON_STORAGE_KEY="applicationLaunchedViaContinueOn"}async autoResumeEditSession(){let e=this.configurationService.getValue("workbench.cloudChanges.autoResume")==="onReload";if(this.environmentService.editSessionId!==void 0)this.logService.info(`Resuming cloud changes, reason: found editSessionId ${this.environmentService.editSessionId} in environment service...`),await this.progressService.withProgress(Rqe,async t=>await this.resumeEditSession(this.environmentService.editSessionId,void 0,void 0,void 0,t).finally(()=>this.environmentService.editSessionId=void 0));else if(e&&this.editSessionsStorageService.isSignedIn)this.logService.info("Resuming cloud changes, reason: cloud changes enabled..."),await this.progressService.withProgress(Rqe,async t=>await this.resumeEditSession(void 0,!0,void 0,void 0,t));else if(e){let t=this.storageService.getBoolean(E7.APPLICATION_LAUNCHED_VIA_CONTINUE_ON_STORAGE_KEY,-1,!1);this.logService.info(`Prompting to enable cloud changes, has application previously launched from Continue On flow: ${t}`);let o=()=>{this.logService.info("Showing badge to enable cloud changes in accounts menu..."),this.updateAccountsMenuBadge(),this.pendingEditSessionsContext.set(!0);let n=this.editSessionsStorageService.onDidSignIn(async()=>{n.dispose(),this.logService.info("Showing badge to enable cloud changes in accounts menu succeeded, resuming cloud changes..."),await this.progressService.withProgress(Rqe,async r=>await this.resumeEditSession(void 0,!0,void 0,void 0,r)),this.storageService.remove(E7.APPLICATION_LAUNCHED_VIA_CONTINUE_ON_STORAGE_KEY,-1),this.environmentService.continueOn=void 0})};this.environmentService.continueOn!==void 0&&!this.editSessionsStorageService.isSignedIn&&t===!1?(this.storageService.store(E7.APPLICATION_LAUNCHED_VIA_CONTINUE_ON_STORAGE_KEY,!0,-1,1),this.logService.info("Prompting to enable cloud changes..."),await this.editSessionsStorageService.initialize("read"),this.editSessionsStorageService.isSignedIn?(this.logService.info("Prompting to enable cloud changes succeeded, resuming cloud changes..."),await this.progressService.withProgress(Rqe,async n=>await this.resumeEditSession(void 0,!0,void 0,void 0,n))):o()):!this.editSessionsStorageService.isSignedIn&&t===!0&&o()}else this.logService.debug("Auto resuming cloud changes disabled.")}updateAccountsMenuBadge(){if(this.editSessionsStorageService.isSignedIn)return this.accountsMenuBadgeDisposable.clear();let e=new eu(1,()=>d(11176,null));this.accountsMenuBadgeDisposable.value=this.activityService.showAccountsActivity({badge:e})}async autoStoreEditSession(){let e=new qe;await this.progressService.withProgress({location:10,type:"syncing",title:d(11215,null)},async()=>this.storeEditSession(!1,e.token),()=>{e.cancel(),e.dispose()})}registerViews(){let e=oe.as(Kn.ViewContainersRegistry).registerViewContainer({id:r$i,title:FIe,ctorDescriptor:new Vt(Qc,[r$i,{mergeViewWithContainerWhenSingleView:!0}]),icon:QVo,hideIfEmpty:!0},0,{doNotRegisterOpenCommand:!0});this._register(this.instantiationService.createInstance(_qe,e))}registerActions(){this.registerContinueEditSessionAction(),this.registerResumeLatestEditSessionAction(),this.registerStoreLatestEditSessionAction(),this.registerContinueInLocalFolderAction(),this.registerShowEditSessionViewAction(),this.registerShowEditSessionOutputChannelAction()}registerShowEditSessionOutputChannelAction(){this._register(W(class extends z{constructor(){super(JVo)}run(t,...o){t.get(Tl).showChannel(pht)}}))}registerShowEditSessionViewAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.showEditSessions",title:P(11213,"Show Cloud Changes"),category:k7,f1:!0})}async run(o){e.shouldShowViewsContext.set(!0),await o.get(Gt).openView(QXt)}}))}registerContinueEditSessionAction(){let e=this;this._register(W(class extends z{constructor(){super(eJt)}async run(o,n,r){let s=n;if(!r&&!s&&(r=await e.pickContinueEditSessionDestination(),!r)){e.telemetryService.publicLog2("continueOn.editSessions.pick.outcome",{outcome:"noSelection"});return}let l=await e.shouldContinueOnWithEditSession(),c;if(l){e.telemetryService.publicLog2("continueOn.editSessions.store");let u=new qe;try{c=await e.progressService.withProgress({location:15,cancellable:!0,type:"syncing",title:d(11217,null)},async()=>{let p=await e.storeEditSession(!1,u.token);return p!==void 0?e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeSucceeded",hashedId:JXt(p)}):e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeSkipped"}),p},()=>{u.cancel(),u.dispose(),e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeCancelledByUser"})})}catch(p){throw e.telemetryService.publicLog2("continueOn.editSessions.store.outcome",{outcome:"storeFailed"}),p}}if(s=r?await e.resolveDestination(r):s,s!==void 0)if(c!==void 0&&s!=="noDestinationUri"){let u=encodeURIComponent(c);s=s.with({query:s.query.length>0?s.query+`&${XVo}=${u}&continueOn=1`:`${XVo}=${u}&continueOn=1`}),e.logService.info(`Opening ${s.toString()}`),await e.openerService.open(s,{openExternal:!0})}else(!l||c===void 0)&&s!=="noDestinationUri"?(e.logService.info(`Opening ${s.toString()}`),await e.openerService.open(s,{openExternal:!0})):c===void 0&&l&&e.logService.warn(`Failed to store working changes when invoking ${eJt.id}.`)}}))}registerResumeLatestEditSessionAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.resumeLatest",title:P(11211,"Resume Latest Changes from Cloud"),category:k7,f1:!0})}async run(o,n,r){await e.progressService.withProgress({...Rqe,title:c$i},async()=>await e.resumeEditSession(n,void 0,r))}})),this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.resumeFromSerializedPayload",title:P(11207,"Resume Changes from Serialized Data"),category:"Developer",f1:!0})}async run(o,n){let r=await e.quickInputService.input({prompt:"Enter serialized data"});r&&e.editSessionsStorageService.lastReadResources.set("editSessions",{content:r,ref:""}),await e.progressService.withProgress({...Rqe,title:c$i},async()=>await e.resumeEditSession(n,void 0,void 0,void 0,void 0,r))}}))}registerStoreLatestEditSessionAction(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.editSessions.actions.storeCurrent",title:P(11216,"Store Working Changes in Cloud"),category:k7,f1:!0})}async run(o){let n=new qe;await e.progressService.withProgress({location:15,title:d(11218,null)},async()=>{e.telemetryService.publicLog2("editSessions.store"),await e.storeEditSession(!0,n.token)},()=>{n.cancel(),n.dispose()})}}))}async resumeEditSession(e,t,o,n,r,s){if(await this.remoteAgentService.getEnvironment(),this.contextService.getWorkbenchState()===1||(this.logService.info(e!==void 0?`Resuming changes from cloud with ref ${e}...`:"Checking for pending cloud changes..."),t&&!await this.editSessionsStorageService.initialize("read",!0)))return;this.telemetryService.publicLog2("editSessions.resume"),performance.mark("code/willResumeEditSessionFromIdentifier"),r?.report({message:d(11177,null)});let l=s?{content:s,ref:""}:await this.editSessionsStorageService.read("editSessions",e);if(!l){e===void 0&&!t?this.notificationService.info(d(11201,null)):e!==void 0&&this.notificationService.warn(d(11202,null,e)),this.logService.info(e!==void 0?`Aborting resuming changes from cloud as no edit session content is available to be applied from ref ${e}.`:"Aborting resuming edit session as no edit session content is available to be applied");return}r?.report({message:c$i});let c=JSON.parse(l.content);if(e=l.ref,c.version>qVo){this.notificationService.error(d(11178,null,this.productService.nameLong)),this.telemetryService.publicLog2("editSessions.resume.outcome",{hashedId:JXt(e),outcome:"clientUpdateNeeded"});return}try{let{changes:u,conflictingChanges:p}=await this.generateChanges(c,e,o,n);if(u.length===0)return;if(p.length>0){let{confirmed:h}=await this.dialogService.confirm({type:ft.Warning,message:p.length>1?d(11209,null,p.length):d(11208,null,Be(p[0].uri)),detail:p.length>1?fx(p.map(g=>g.uri)):void 0});if(!h)return}for(let{uri:h,type:g,contents:f}of u)g===1?await this.fileService.writeFile(h,XXt(c.version,f)):g===2&&await this.fileService.exists(h)&&await this.fileService.del(h);await this.workspaceStateSynchronizer?.apply(),this.logService.info(`Deleting edit session with ref ${e} after successfully applying it to current workspace...`),await this.editSessionsStorageService.delete("editSessions",e),this.logService.info(`Deleted edit session with ref ${e}.`),this.telemetryService.publicLog2("editSessions.resume.outcome",{hashedId:JXt(e),outcome:"resumeSucceeded"})}catch(u){this.logService.error("Failed to resume edit session, reason: ",u.toString()),this.notificationService.error(d(11210,null))}performance.mark("code/didResumeEditSessionFromIdentifier")}async generateChanges(e,t,o=!1,n=!1){let r=[],s=[],l=this.contextService.getWorkspace().folders,c=new qe;for(let u of e.folders){let p;if(u.canonicalIdentity)for(let g of l){let f=await this.editSessionIdentityService.getEditSessionIdentifier(g,c.token);if(this.logService.info(`Matching identity ${f} against edit session folder identity ${u.canonicalIdentity}...`),Qi(f,u.canonicalIdentity)||o){p=g;break}if(f!==void 0){let v=await this.editSessionIdentityService.provideEditSessionIdentityMatch(g,f,u.canonicalIdentity,c.token);if(v===100){p=g;break}else if(v===50&&this.configurationService.getValue("workbench.experimental.cloudChanges.partialMatches.enabled")===!0)if(!n)this.notificationService.prompt(ft.Info,d(11199,null),[{label:d(11206,null),run:()=>this.resumeEditSession(t,!1,void 0,!0)}]);else{p=g;break}}}else p=l.find(g=>g.name===u.name);if(!p)return this.logService.info(`Skipping applying ${u.workingChanges.length} changes from edit session with ref ${t} as no matching workspace folder was found.`),{changes:[],conflictingChanges:[],contributedStateHandlers:[]};let h=new Set;for(let g of this.scmService.repositories)g.provider.rootUri!==void 0&&this.contextService.getWorkspaceFolder(g.provider.rootUri)?.name===u.name&&this.getChangedResources(g).forEach(v=>h.add(v.toString()));for(let g of u.workingChanges){let f=Ve(p.uri,g.relativeFilePath);r.push({uri:f,type:g.type,contents:g.contents}),await this.willChangeLocalContents(h,f,g)&&s.push({uri:f,type:g.type,contents:g.contents})}}return{changes:r,conflictingChanges:s}}async willChangeLocalContents(e,t,o){if(!e.has(t.toString()))return!1;let{contents:n,type:r}=o;switch(r){case 1:{let[s,l]=await Promise.all([bB(n),bB(gc((await this.fileService.readFile(t)).value))]);return s!==l}case 2:return await this.fileService.exists(t);default:throw new Error("Unhandled change type.")}}async storeEditSession(e,t){let o=[],n=0,r=!1;await this.editorService.saveAll();let s=new xn;for(let c of this.scmService.repositories){let u=this.getChangedResources(c);if(u.size)for(let p of u){let h=this.contextService.getWorkspaceFolder(p);!h||s.has(p)||(s.add(p),await this.editSessionIdentityService.onWillCreateEditSessionIdentity(h,t))}}for(let c of this.scmService.repositories){let u=this.getChangedResources(c),p=[],{rootUri:h}=c.provider,g=h?this.contextService.getWorkspaceFolder(h):void 0,f=g?.name;for(let b of u){let S=this.contextService.getWorkspaceFolder(b);if(!S){this.logService.info(`Skipping working change ${b.toString()} as no associated workspace folder was found.`);continue}f=f??S.name;let y=lu(S.uri,b)??b.path;try{if(!(await this.fileService.stat(b)).isFile)continue}catch{}if(r=!0,await this.fileService.exists(b)){let w=gc((await this.fileService.readFile(b)).value);if(n+=w.length,n>this.editSessionsStorageService.SIZE_LIMIT){this.notificationService.error(d(11205,null));return}p.push({type:1,fileType:1,contents:w,relativeFilePath:y})}else p.push({type:2,fileType:1,contents:void 0,relativeFilePath:y})}let v;g!=null&&(v=await this.editSessionIdentityService.getEditSessionIdentifier(g,t)),o.push({workingChanges:p,name:f??"",canonicalIdentity:v??void 0,absoluteUri:g?.uri.toString()})}if(await this.workspaceStateSynchronizer?.sync(),!r){this.logService.info("Skipped storing working changes in the cloud as there are no edits to store."),e&&this.notificationService.info(d(11203,null));return}let l={folders:o,version:2,workspaceStateId:this.editSessionsStorageService.lastWrittenResources.get("workspaceState")?.ref};try{this.logService.info("Storing edit session...");let c=await this.editSessionsStorageService.write("editSessions",l);return this.logService.info(`Stored edit session with ref ${c}.`),c}catch(c){this.logService.error("Failed to store edit session, reason: ",c.toString()),c instanceof mh&&(c.code==="TooLarge"?(this.telemetryService.publicLog2("editSessions.upload.failed",{reason:"TooLarge"}),this.notificationService.error(d(11205,null))):(this.telemetryService.publicLog2("editSessions.upload.failed",{reason:"unknown"}),this.notificationService.error(d(11204,null))))}}getChangedResources(e){return e.provider.groups.reduce((t,o)=>(o.resources.forEach(n=>t.add(n.sourceUri)),t),new Set)}hasEditSession(){for(let e of this.scmService.repositories)if(this.getChangedResources(e).size>0)return!0;return!1}async shouldContinueOnWithEditSession(){if(this.editSessionsStorageService.isSignedIn)return this.hasEditSession();if(this.configurationService.getValue(xLn)==="off")return this.telemetryService.publicLog2("continueOn.editSessions.canStore.outcome",{outcome:"disabledEditSessionsViaSetting"}),!1;if(this.hasEditSession()){let e=new O,t=e.add(this.quickInputService.createQuickPick());t.placeholder=d(11181,null),t.ok=!1,t.ignoreFocusOut=!0;let o={label:d(11219,null)},n={label:d(11220,null)};t.items=[o,n];let r=await new Promise((l,c)=>{e.add(t.onDidAccept(()=>{l(t.selectedItems[0]===o),e.dispose()})),e.add(t.onDidHide(()=>{c(new qi),e.dispose()})),t.show()});if(!r)return this.telemetryService.publicLog2("continueOn.editSessions.canStore.outcome",{outcome:"didNotEnableEditSessionsWhenPrompted"}),r;let s=await this.editSessionsStorageService.initialize("write");return s||this.telemetryService.publicLog2("continueOn.editSessions.canStore.outcome",{outcome:"didNotEnableEditSessionsWhenPrompted"}),s}return!1}registerContributedEditSessionOptions(){ELn.setHandler(e=>{let t=[];for(let o of e)if(Va(o.description,"contribEditSessions")&&Array.isArray(o.value))for(let n of o.value){let r=be.getCommand(n.command);if(!r)return;let s=r.icon,l=typeof r.title=="string"?r.title:r.title.value,c=C.deserialize(n.when);t.push(new vht(q.isThemeIcon(s)?`$(${s.id}) ${l}`:l,r.id,r.source?.title,c,n.documentation)),n.qualifiedName&&this.generateStandaloneOptionCommand(r.id,n.qualifiedName,n.category??r.category,c,n.remoteGroup)}this.continueEditSessionOptions=t})}generateStandaloneOptionCommand(e,t,o,n,r){let s={id:`${eJt.id}.${e}`,title:{original:t,value:t},category:typeof o=="string"?{original:o,value:o}:o,precondition:n,f1:!0};this.registeredCommands.has(s.id)||(this.registeredCommands.add(s.id),this._register(W(class extends z{constructor(){super(s)}async run(c){return c.get(fe).executeCommand(eJt.id,void 0,e)}})),r!==void 0&&be.appendMenuItem(R.StatusBarRemoteIndicatorMenu,{group:r,command:s,when:s.precondition}))}registerContinueInLocalFolderAction(){let e=this;this._register(W(class extends z{constructor(){super(tJt)}async run(o){let n=await e.fileDialogService.showOpenDialog({title:d(11183,null),canSelectFolders:!0,canSelectMany:!1,canSelectFiles:!1,availableFileSystems:[Q.file]});return n?.length!==1?void 0:A.from({scheme:e.productService.urlProtocol,authority:Q.file,path:n[0].path})}})),PM(this.contextService.getWorkspace())!==void 0&&Qr&&this.generateStandaloneOptionCommand(tJt.id,d(11198,null),void 0,tJt.precondition,void 0)}async pickContinueEditSessionDestination(){let e=new O,t=e.add(this.quickInputService.createQuickPick({useSeparators:!0})),o=this.contextService.getWorkbenchState()===2?this.contextService.getWorkspace().folders[0].name:this.contextService.getWorkspace().folders.map(r=>r.name).join(", ");t.placeholder=d(11193,null,`'${o}'`),t.items=this.createPickItems(),e.add(this.extensionService.onDidChangeExtensions(()=>{t.items=this.createPickItems()}));let n=await new Promise((r,s)=>{e.add(t.onDidHide(()=>{e.dispose(),r(void 0)})),e.add(t.onDidAccept(l=>{let c=t.activeItems[0].command;c===fht.id?this.commandService.executeCommand(fht.id):(r(c),t.hide())})),t.show(),e.add(t.onDidTriggerItemButton(async l=>{if(l.item.documentation!==void 0){let c=A.isUri(l.item.documentation)?A.parse(l.item.documentation):await this.commandService.executeCommand(l.item.documentation);c&&this.openerService.open(c,{openExternal:!0})}}))});return t.dispose(),n}async resolveDestination(e){try{let t=await this.commandService.executeCommand(e);if(t===void 0)return this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"noDestinationUri"}),"noDestinationUri";if(A.isUri(t))return this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"resolvedUri"}),t;this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"invalidDestination"});return}catch(t){t instanceof qi?this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"cancelled"}):this.telemetryService.publicLog2("continueOn.openDestination.outcome",{selection:e,outcome:"unknownError"});return}}createPickItems(){let e=[...this.continueEditSessionOptions].filter(o=>o.when===void 0||this.contextKeyService.contextMatchesRules(o.when));return PM(this.contextService.getWorkspace())!==void 0&&Qr&&e.push(new vht("$(folder) "+d(11192,null),tJt.id,d(11191,null))),e.sort((o,n)=>o.label.localeCompare(n.label)).concat({type:"separator"},new vht(fht.title,fht.id))}};E7=I([m(0,ez),m(1,ge),m(2,Go),m(3,Je),m(4,_e),m(5,lc),m(6,Ne),m(7,ct),m(8,uht),m(9,ko),m(10,F),m(11,Ze),m(12,B),m(13,Ae),m(14,mG),m(15,$e),m(16,fe),m(17,X),m(18,nn),m(19,to),m(20,de),m(21,Al),m(22,ie),m(23,bo),m(24,lt),m(25,Ra),m(26,hn),m(27,gt),m(28,ght)],E7);var kLn=q.asClassName(L.info),vht=class{constructor(i,e,t,o,n){this.label=i;this.command=e;this.description=t;this.when=o;this.documentation=n;n!==void 0&&(this.buttons=[{iconClass:kLn,tooltip:d(11200,null)}])}},ELn=zn.registerExtensionPoint({extensionPoint:"continueEditSession",jsonSchema:{description:d(11184,null),type:"array",items:{type:"object",properties:{command:{description:d(11185,null),type:"string"},group:{description:d(11187,null),type:"string"},qualifiedName:{description:d(11188,null),type:"string"},description:{description:d(11186,null),type:"string"},remoteGroup:{description:d(11189,null),type:"string"},when:{description:d(11190,null),type:"string"}},required:["command"]}}}),TLn=oe.as(Zi.Workbench);TLn.registerWorkbenchContribution(E7,3);oe.as($t.Configuration).registerConfiguration({...jd,properties:{"workbench.experimental.cloudChanges.autoStore":{enum:["onShutdown","off"],enumDescriptions:[d(11174,null),d(11173,null)],type:"string",tags:["experimental","usesOnlineServices"],default:"off",markdownDescription:d(11175,null)},"workbench.cloudChanges.autoResume":{enum:["onReload","off"],enumDescriptions:[d(11171,null),d(11170,null)],type:"string",tags:["usesOnlineServices"],default:"onReload",markdownDescription:d(11169,null)},"workbench.cloudChanges.continueOn":{enum:["prompt","off"],enumDescriptions:[d(11197,null),d(11196,null)],type:"string",tags:["usesOnlineServices"],default:"prompt",markdownDescription:d(11195,null)},"workbench.experimental.cloudChanges.partialMatches.enabled":{type:"boolean",tags:["experimental","usesOnlineServices"],default:!1,markdownDescription:d(11179,null)}}});var _Ln=zn.registerExtensionPoint({extensionPoint:"remoteCodingAgents",jsonSchema:{description:d(14696,null),type:"array",items:{type:"object",properties:{id:{description:d(14701,null),type:"string"},command:{description:d(14697,null),type:"string"},displayName:{description:d(14699,null),type:"string"},description:{description:d(14698,null),type:"string"},followUpRegex:{description:d(14700,null),type:"string"},when:{description:d(14702,null),type:"string"}},required:["command","displayName"]}}}),bht=class extends k{constructor(e){super();this.remoteCodingAgentsService=e;_Ln.setHandler(t=>{for(let o of t)if(Va(o.description,"remoteCodingAgents")&&Array.isArray(o.value))for(let n of o.value){if(!be.getCommand(n.command))continue;let s={id:n.id,command:n.command,displayName:n.displayName,description:n.description,followUpRegex:n.followUpRegex,when:n.when};this.remoteCodingAgentsService.registerAgent(s)}})}};bht=I([m(0,Fct)],bht);var DLn=oe.as(Zi.Workbench);DLn.registerWorkbenchContribution(bht,3);var RLn=a=>({type:"string",enum:["always","explicit","never",!0,!1],enumDescriptions:[d(9940,null),d(9945,null),d(9949,null),d(9946,null),d(9950,null)],default:"explicit",description:a}),LLn=a=>({type:["string","boolean"],enum:["explicit","never",!0,!1],enumDescriptions:[d(9943,null),d(9947,null),d(9944,null),d(9948,null)],default:"explicit",description:a}),d$i={oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"array",items:{type:"string"}}],markdownDescription:d(9942,null,"`#files.autoSave#`"),type:["object","array"],additionalProperties:{type:"string",enum:["always","explicit","never",!0,!1]},default:{},scope:6},p$i=Object.freeze({...wx,properties:{"editor.codeActionsOnSave":d$i}}),u$i={oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"array",items:{type:"string"}}],markdownDescription:d(9951,null,"`#files.autoSave#`"),type:"object",additionalProperties:{type:["string","boolean"],enum:["explicit","never",!0,!1]},default:{}},ZVo=Object.freeze({...wx,properties:{"notebook.codeActionsOnSave":u$i}}),Lqe=class extends k{constructor(e,t){super();this.languageFeatures=t;this._onDidChangeSchemaContributions=this._register(new T);this._allProvidedCodeActionKinds=[];this._register(U.runAndSubscribe(U.debounce(t.codeActionProvider.onDidChange,()=>{},1e3),()=>{this._allProvidedCodeActionKinds=this.getAllProvidedCodeActionKinds(),this.updateConfigurationSchema(this._allProvidedCodeActionKinds),this._onDidChangeSchemaContributions.fire()})),this._register(e.registerSchemaContribution({getSchemaAdditions:()=>this.getKeybindingSchemaAdditions(),onDidChange:this._onDidChangeSchemaContributions.event}))}getAllProvidedCodeActionKinds(){let e=new Map;for(let t of this.languageFeatures.codeActionProvider.allNoModel())for(let o of t.providedCodeActionKinds??[])e.set(o,new Rs(o));return Array.from(e.values())}updateConfigurationSchema(e){let t={...d$i.properties},o={...u$i.properties};for(let n of e)Nr.Source.contains(n)&&!t[n.value]&&(t[n.value]=RLn(d(9941,null,n.value)),o[n.value]=LLn(d(9941,null,n.value)));d$i.properties=t,u$i.properties=o,oe.as($t.Configuration).notifyConfigurationSchemaUpdated(p$i)}getKeybindingSchemaAdditions(){let e=(o,n)=>({if:{required:["command"],properties:{command:{const:o}}},then:{properties:{args:{required:["kind"],properties:{kind:{anyOf:[{enum:Array.from(n)},{type:"string"}]}}}}}}),t=o=>{let n=new Set;for(let r of this._allProvidedCodeActionKinds)o.contains(r)&&n.add(r.value);return Array.from(n)};return[e(aEe,t(Rs.Empty)),e(cEe,t(Nr.Refactor)),e(dEe,t(Nr.Source))]}};Lqe=I([m(0,Le),m(1,Jt)],Lqe);oe.as($t.Configuration).registerConfiguration(p$i);oe.as($t.Configuration).registerConfiguration(ZVo);oe.as(Zi.Workbench).registerWorkbenchContribution(Lqe,4);var iJt=new Y("timelineHasProvider",!1),Mqe=class extends k{constructor(e,t,o,n){super();this.logService=e;this.viewsService=t;this.configurationService=o;this.contextKeyService=n;this._onDidChangeProviders=this._register(new T);this.onDidChangeProviders=this._onDidChangeProviders.event;this._onDidChangeTimeline=this._register(new T);this.onDidChangeTimeline=this._onDidChangeTimeline.event;this._onDidChangeUri=this._register(new T);this.onDidChangeUri=this._onDidChangeUri.event;this.providers=new Map;this.providerSubscriptions=this._register(new Ot);this.hasProviderContext=iJt.bindTo(this.contextKeyService),this.updateHasProviderContext()}getSources(){return[...this.providers.values()].map(e=>({id:e.id,label:e.label}))}getTimeline(e,t,o,n){this.logService.trace(`TimelineService#getTimeline(${e}): uri=${t.toString()}`);let r=this.providers.get(e);if(r!==void 0){if(typeof r.scheme=="string"){if(r.scheme!=="*"&&r.scheme!==t.scheme)return}else if(!r.scheme.includes(t.scheme))return;return{result:r.provideTimeline(t,o,n.token).then(s=>{if(s!==void 0)return s.items=s.items.map(l=>({...l,source:r.id})),s.items.sort((l,c)=>c.timestamp-l.timestamp||c.source.localeCompare(l.source,void 0,{numeric:!0,sensitivity:"base"})),s}),options:o,source:r.id,tokenSource:n,uri:t}}}registerTimelineProvider(e){this.logService.trace(`TimelineService#registerTimelineProvider: id=${e.id}`);let t=e.id,o=this.providers.get(t);if(o)try{o?.dispose()}catch{}return this.providers.set(t,e),this.updateHasProviderContext(),e.onDidChange&&this.providerSubscriptions.set(t,e.onDidChange(n=>this._onDidChangeTimeline.fire(n))),this._onDidChangeProviders.fire({added:[t]}),{dispose:()=>{this.providers.delete(t),this._onDidChangeProviders.fire({removed:[t]})}}}unregisterTimelineProvider(e){this.logService.trace(`TimelineService#unregisterTimelineProvider: id=${e}`),this.providers.has(e)&&(this.providers.delete(e),this.providerSubscriptions.deleteAndDispose(e),this.updateHasProviderContext(),this._onDidChangeProviders.fire({removed:[e]}))}setUri(e){this.viewsService.openView(W0t,!0),this._onDidChangeUri.fire(e)}updateHasProviderContext(){this.hasProviderContext.set(this.providers.size!==0)}};Mqe=I([m(0,re),m(1,Gt),m(2,B),m(3,X)],Mqe);var tBo=22;function oJt(a){return a instanceof wht}function yht(a){return!!a&&!a.handle.startsWith("vscode-command:")}function eBo(a,i){return a.relativeTime=yht(a)?ea(a.timestamp):void 0,a.relativeTimeFullWord=yht(a)?ea(a.timestamp,!1,!0):void 0,i===void 0||a.relativeTime!==i?(i=a.relativeTime,a.hideRelativeTime=!1):a.hideRelativeTime=!0,i}var m$i=class{constructor(i){this._stale=!1;this._requiresReset=!1;this.source=i.source,this.items=i.items,this._cursor=i.paging?.cursor,this.lastRenderedIndex=-1}get cursor(){return this._cursor}get more(){return this._cursor!==void 0}get newest(){return this.items[0]}get oldest(){return this.items[this.items.length-1]}add(i,e){let t=!1;if(i.items.length!==0&&this.items.length!==0){t=!0;let o=new Set,n=new Set;for(let l of i.items)l.id===void 0?n.add(l.timestamp):o.add(l.id);let r=this.items.length,s;for(;r--;)s=this.items[r],(s.id!==void 0&&o.has(s.id)||n.has(s.timestamp))&&this.items.splice(r,1);(i.items[i.items.length-1]?.timestamp??0)>=(this.newest?.timestamp??0)?this.items.splice(0,0,...i.items):this.items.push(...i.items)}else i.items.length!==0&&(t=!0,this.items.push(...i.items));return(e.cursor!==void 0||typeof e.limit!="object")&&(this._cursor=i.paging?.cursor),t&&this.items.sort((o,n)=>n.timestamp-o.timestamp||(o.source===void 0?n.source===void 0?0:1:n.source===void 0?-1:n.source.localeCompare(o.source,void 0,{numeric:!0,sensitivity:"base"}))),t}get stale(){return this._stale}get requiresReset(){return this._requiresReset}invalidate(i){this._stale=!0,this._requiresReset=i}},wht=class{constructor(i){this.handle="vscode-command:loadMore";this.timestamp=0;this.description=void 0;this.tooltip=void 0;this.contextValue=void 0;this.id=void 0;this.icon=void 0;this.iconDark=void 0;this.source=void 0;this.relativeTime=void 0;this.relativeTimeFullWord=void 0;this.hideRelativeTime=void 0;this._loading=!1;this._loading=i}get loading(){return this._loading}set loading(i){this._loading=i}get ariaLabel(){return this.label}get label(){return this.loading?d(17405,null):d(17406,null)}get themeIcon(){}},h$i=new Y("timelineFollowActiveEditor",!0,!0),MLn=new Y("timelineExcludeSources","[]",!0),PLn=new Y("timelineFocused",!0),Cae=class extends na{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super({...e,titleMenuId:R.TimelineTitle},t,o,r,n,l,c,f,v,b);this.storageService=s;this.editorService=u;this.commandService=p;this.progressService=h;this.timelineService=g;this.labelService=S;this.uriIdentityService=y;this.extensionService=w;this.pendingRequests=new Map;this.timelinesBySource=new Map;this._followActiveEditor=!0;this._isEmpty=!0;this._maxItemCount=0;this._visibleItemCount=0;this._pendingRefresh=!1;this.commands=this._register(this.instantiationService.createInstance(Iht,this)),this.followActiveEditorContext=h$i.bindTo(this.contextKeyService),this.timelineExcludeSourcesContext=MLn.bindTo(this.contextKeyService);let x=s.get("timeline.excludeSources",0,"[]");this.timelineExcludeSourcesContext.set(x),this.excludedSources=new Set(JSON.parse(x)),this._register(s.onDidChangeValue(0,"timeline.excludeSources",this._store)(this.onStorageServiceChanged,this)),this._register(r.onDidChangeConfiguration(this.onConfigurationChanged,this)),this._register(g.onDidChangeProviders(this.onProvidersChanged,this)),this._register(g.onDidChangeTimeline(this.onTimelineChanged,this)),this._register(g.onDidChangeUri(E=>this.setUri(E),this))}static{this.TITLE=P(17400,"Timeline")}get followActiveEditor(){return this._followActiveEditor}set followActiveEditor(e){this._followActiveEditor!==e&&(this._followActiveEditor=e,this.followActiveEditorContext.set(e),this.updateFilename(this._filename),e&&this.onActiveEditorChanged())}get pageOnScroll(){return this._pageOnScroll===void 0&&(this._pageOnScroll=this.configurationService.getValue("timeline.pageOnScroll")??!1),this._pageOnScroll}get pageSize(){let e=this.configurationService.getValue("timeline.pageSize");return e==null&&(e=Math.max(20,Math.floor((this.tree?.renderHeight??0/tBo)+(this.pageOnScroll?1:-1)))),e}reset(){this.loadTimeline(!0)}setUri(e){this.setUriCore(e,!0)}setUriCore(e,t){t&&(this.followActiveEditor=!1),this.uri=e,this.updateFilename(e?this.labelService.getUriBasenameLabel(e):void 0),this.treeRenderer?.setUri(e),this.loadTimeline(!0)}onStorageServiceChanged(){let e=this.storageService.get("timeline.excludeSources",0,"[]");this.timelineExcludeSourcesContext.set(e),this.excludedSources=new Set(JSON.parse(e));let t=this.timelineService.getSources().filter(({id:o})=>!this.excludedSources.has(o)&&!this.timelinesBySource.has(o));t.length!==0?this.loadTimeline(!0,t.map(({id:o})=>o)):this.refresh()}onConfigurationChanged(e){e.affectsConfiguration("timeline.pageOnScroll")&&(this._pageOnScroll=void 0)}onActiveEditorChanged(){if(!this.followActiveEditor||!this.isExpanded())return;let e=po.getOriginalUri(this.editorService.activeEditor,{supportSideBySide:1});if(this.uriIdentityService.extUri.isEqual(e,this.uri)&&e!==void 0||e?.fsPath===this.uri?.fsPath&&(e?.scheme===Q.file||e?.scheme==="git")&&(this.uri?.scheme===Q.file||this.uri?.scheme==="git")){for(let t of this.timelineService.getSources()){if(this.excludedSources.has(t.id))continue;let o=this.timelinesBySource.get(t.id);o!==void 0&&!o.stale||(o!==void 0?this.updateTimeline(o,o.requiresReset):this.loadTimelineForSource(t.id,e,!0))}return}this.setUriCore(e,!1)}onProvidersChanged(e){if(e.removed){for(let t of e.removed)this.timelinesBySource.delete(t);this.refresh()}e.added&&this.loadTimeline(!0,e.added)}onTimelineChanged(e){if(e?.uri===void 0||this.uriIdentityService.extUri.isEqual(A.revive(e.uri),this.uri)){let t=this.timelinesBySource.get(e.id);if(t===void 0)return;this.isBodyVisible()?this.updateTimeline(t,e.reset):t.invalidate(e.reset)}}updateFilename(e){this._filename=e,this.followActiveEditor||!e?this.updateTitleDescription(e):this.updateTitleDescription(`${e} (pinned)`)}get message(){return this._message}set message(e){this._message=e,this.updateMessage()}updateMessage(){this._message!==void 0?this.showMessage(this._message):this.hideMessage()}showMessage(e){this.$message&&(this.$message.classList.remove("hide"),this.resetMessageElement(),this.$message.textContent=e)}hideMessage(){this.resetMessageElement(),this.$message.classList.add("hide")}resetMessageElement(){St(this.$message)}get hasVisibleItems(){return this._visibleItemCount>0}clear(e){if(this._visibleItemCount=0,this._maxItemCount=this.pageSize,this.timelinesBySource.clear(),e){for(let t of this.pendingRequests.values())t.request.tokenSource.cancel(),t.dispose();this.pendingRequests.clear(),!this.isBodyVisible()&&this.tree&&(this.tree.setChildren(null,void 0),this._isEmpty=!0)}}async loadTimeline(e,t){if(t===void 0){if(e&&this.clear(!0),this.uri?.scheme===Q.vscodeSettings||this.uri?.scheme===Q.webviewPanel||this.uri?.scheme===Q.walkThrough){this.uri=void 0,this.clear(!1),this.refresh();return}this._isEmpty&&this.uri!==void 0&&this.setLoadingUriMessage()}if(this.uri===void 0){this.clear(!1),this.refresh();return}if(!this.isBodyVisible())return;let o=!1;for(let n of t??this.timelineService.getSources().map(r=>r.id))this.loadTimelineForSource(n,this.uri,e)&&(o=!0);o?this._isEmpty&&this.setLoadingUriMessage():this.refresh()}loadTimelineForSource(e,t,o,n){if(this.excludedSources.has(e))return!1;let r=this.timelinesBySource.get(e);if(!o&&n?.cursor!==void 0&&r!==void 0&&(!r?.more||r.items.length>r.lastRenderedIndex+this.pageSize))return!1;if(n===void 0){if(!o&&r!==void 0&&r.items.length>0&&!r.more)return!1;n={cursor:o?void 0:r?.cursor,limit:this.pageSize}}let s=this.pendingRequests.get(e);s!==void 0&&(n.cursor=s.request.options.cursor,typeof n.limit=="number"&&(typeof s.request.options.limit=="number"?n.limit+=s.request.options.limit:n.limit=s.request.options.limit)),s?.request?.tokenSource.cancel(),s?.dispose(),n.cacheResults=!0,n.resetCache=o;let l=new qe,c=this.timelineService.getTimeline(e,t,n,l);if(c===void 0)return l.dispose(),!1;let u=new O;return this.pendingRequests.set(e,{request:c,dispose:()=>u.dispose()}),u.add(l),u.add(l.token.onCancellationRequested(()=>this.pendingRequests.delete(e))),this.handleRequest(c),!0}updateTimeline(e,t){if(t){this.timelinesBySource.delete(e.source);let{oldest:o}=e;this.loadTimelineForSource(e.source,this.uri,!0,o!==void 0?{limit:{timestamp:o.timestamp,id:o.id}}:void 0)}else{let{newest:o}=e;this.loadTimelineForSource(e.source,this.uri,!1,o!==void 0?{limit:{timestamp:o.timestamp,id:o.id}}:{limit:this.pageSize})}}async handleRequest(e){let t;try{t=await this.progressService.withProgress({location:this.id},()=>e.result)}catch{}if(e.tokenSource.token.isCancellationRequested||(this.pendingRequests.get(e.source)?.dispose(),this.pendingRequests.delete(e.source)),t===void 0||e.uri!==this.uri){this.pendingRequests.size===0&&this._pendingRefresh&&this.refresh();return}let o=e.source,n=!1,r=this.timelinesBySource.get(o);r===void 0?(this.timelinesBySource.set(o,new m$i(t)),n=!0):n=r.add(t,e.options),n?(this._pendingRefresh=!0,this.hasVisibleItems&&this.pendingRequests.size!==0?this.refreshDebounced():this.refresh()):this.pendingRequests.size===0&&(this._pendingRefresh?this.refresh():this.tree.rerender())}*getItems(){let e=!1;if(this.uri===void 0||this.timelinesBySource.size===0){this._visibleItemCount=0;return}let t=this._maxItemCount,o=0;if(this.timelinesBySource.size===1){let[n,r]=yt.first(this.timelinesBySource);if(r.lastRenderedIndex=-1,this.excludedSources.has(n)){this._visibleItemCount=0;return}r.items.length!==0&&(this._visibleItemCount=1),e=r.more;let s;for(let l of r.items){if(l.relativeTime=void 0,l.hideRelativeTime=void 0,o++,o>t){e=!0;break}s=eBo(l,s),yield{element:l}}r.lastRenderedIndex=o-1}else{let l=function(){return n.filter(p=>!p.nextItem.done).reduce((p,h)=>p===void 0||h.nextItem.value.timestamp>=p.nextItem.value.timestamp?h:p,void 0)},n=[],r=!1,s=0;for(let[p,h]of this.timelinesBySource){if(h.lastRenderedIndex=-1,this.excludedSources.has(p)||h.stale)continue;if(h.items.length!==0&&(r=!0),h.more){e=!0;let f=h.items[Math.min(t,h.items.length-1)];f.timestamp>s&&(s=f.timestamp)}let g=h.items[Symbol.iterator]();n.push({timeline:h,iterator:g,nextItem:g.next()})}this._visibleItemCount=r?1:0;let c,u;for(;u=l();){u.timeline.lastRenderedIndex++;let p=u.nextItem.value;if(p.relativeTime=void 0,p.hideRelativeTime=void 0,p.timestamp>=s){if(o++,o>t){e=!0;break}c=eBo(p,c),yield{element:p}}u.nextItem=u.iterator.next()}}this._visibleItemCount=o,o>0&&(e?yield{element:new wht(this.pendingRequests.size!==0)}:this.pendingRequests.size!==0&&(yield{element:new wht(!0)}))}refresh(){if(this.isBodyVisible()){if(this.tree.setChildren(null,this.getItems()),this._isEmpty=!this.hasVisibleItems,this.uri===void 0)this.updateFilename(void 0),this.message=d(17403,null);else if(this._isEmpty)if(this.pendingRequests.size!==0)this.setLoadingUriMessage();else{this.updateFilename(this.labelService.getUriBasenameLabel(this.uri));let e=this.contextKeyService.getContextKeyValue("scm.providerCount");this.timelineService.getSources().filter(({id:t})=>!this.excludedSources.has(t)).length===0?this.message=d(17411,null):this.configurationService.getValue("workbench.localHistory.enabled")&&!this.excludedSources.has("timeline.localHistory")?this.message=d(17407,null):this.excludedSources.size>0?this.message=d(17410,null):this.message=d(17409,null),(!e||e===0)&&(this.message+=" "+d(17408,null))}else this.updateFilename(this.labelService.getUriBasenameLabel(this.uri)),this.message=void 0;this._pendingRefresh=!1}}refreshDebounced(){this.refresh()}focus(){super.focus(),this.tree.domFocus()}setExpanded(e){let t=super.setExpanded(e);return t&&this.isBodyVisible()&&(this.followActiveEditor?this.onActiveEditorChanged():this.setUriCore(this.uri,!0)),t}setVisible(e){e?(this.extensionService.activateByEvent("onView:timeline"),this.visibilityDisposables?.dispose(),this.visibilityDisposables=new O,this.editorService.onDidActiveEditorChange(this.onActiveEditorChanged,this,this.visibilityDisposables),this.onDidFocus(()=>this.refreshDebounced(),this,this.visibilityDisposables),super.setVisible(e),this.onActiveEditorChanged()):(this.visibilityDisposables?.dispose(),super.setVisible(e))}layoutBody(e,t){super.layoutBody(e,t),this.tree.layout(e,t)}renderHeaderTitle(e){super.renderHeaderTitle(e,this.title),e.classList.add("timeline-view")}renderBody(e){super.renderBody(e),this.$container=e,e.classList.add("tree-explorer-viewlet-tree-view","timeline-tree-view"),this.$message=D(this.$container,_(".message")),this.$message.classList.add("timeline-subtle"),this.message=d(17403,null),this.$tree=document.createElement("div"),this.$tree.classList.add("customview-tree","file-icon-themable-tree","hide-arrows"),e.appendChild(this.$tree),this.treeRenderer=this._register(this.instantiationService.createInstance(Sht,this.commands,this.viewDescriptorService.getViewLocationById(this.id))),this._register(this.treeRenderer.onDidScrollToEnd(t=>{this.pageOnScroll&&this.loadMore(t)})),this.tree=this.instantiationService.createInstance(hf,"TimelinePane",this.$tree,new v$i,[this.treeRenderer],{identityProvider:new g$i,accessibilityProvider:{getAriaLabel(t){return oJt(t)?t.ariaLabel:t.accessibilityInformation?t.accessibilityInformation.label:d(17402,null,t.relativeTimeFullWord??"",t.label)},getRole(t){return oJt(t)?"treeitem":t.accessibilityInformation&&t.accessibilityInformation.role?t.accessibilityInformation.role:"treeitem"},getWidgetAriaLabel(){return d(17401,null)}},keyboardNavigationLabelProvider:new f$i,multipleSelectionSupport:!1,overrideStyles:this.getLocationBasedColors().listOverrideStyles}),PLn.bindTo(this.tree.contextKeyService),this._register(this.tree.onContextMenu(t=>this.onContextMenu(this.commands,t))),this._register(this.tree.onDidChangeSelection(t=>this.ensureValidItems())),this._register(this.tree.onDidOpen(t=>{if(!t.browserEvent||!this.ensureValidItems())return;let o=this.tree.getSelection(),n;if(o.length===1&&(n=o[0]),n!==null)if(yht(n)){if(n.command){let r=n.command.arguments??[];(n.command.id===Xg||n.command.id===ik)&&(r=[...r,t]),this.commandService.executeCommand(n.command.id,...r)}}else oJt(n)&&this.loadMore(n)}))}loadMore(e){e.loading||(e.loading=!0,this.tree.rerender(e),this.pendingRequests.size===0&&(this._maxItemCount=this._visibleItemCount+this.pageSize,this.loadTimeline(!1)))}ensureValidItems(){return!this.hasVisibleItems||!this.timelineService.getSources().some(({id:e})=>!this.excludedSources.has(e)&&this.timelinesBySource.has(e))?(this.tree.setChildren(null,void 0),this._isEmpty=!0,this.setLoadingUriMessage(),!1):!0}setLoadingUriMessage(){let e=this.uri&&this.labelService.getUriBasenameLabel(this.uri);this.updateFilename(e),this.message=e?d(17404,null,e):""}onContextMenu(e,t){let o=t.element;if(o===null)return;let n=t.browserEvent;if(n.preventDefault(),n.stopPropagation(),!this.ensureValidItems())return;this.tree.setFocus([o]);let r=e.getItemContextActions(o);r.length&&this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>r,getActionViewItem:s=>{let l=this.keybindingService.lookupKeybinding(s.id);if(l)return new ts(s,s,{label:!0,keybinding:l.getLabel()})},onHide:s=>{s&&this.tree.domFocus()},getActionsContext:()=>({uri:this.uri,item:o}),actionRunner:new nJt})}};I([Tu(500)],Cae.prototype,"refreshDebounced",1),Cae=I([m(1,Le),m(2,Xe),m(3,X),m(4,B),m(5,de),m(6,ji),m(7,F),m(8,ie),m(9,fe),m(10,Go),m(11,rU),m(12,Je),m(13,Pe),m(14,ot),m(15,nt),m(16,gt),m(17,lt)],Cae);var Cht=class{static{this.id="TimelineElementTemplate"}constructor(i,e,t){i.classList.add("custom-view-tree-node-item"),this.icon=D(i,_(".custom-view-tree-node-item-icon")),this.iconLabel=new ld(i,{supportHighlights:!0,supportIcons:!0,hoverDelegate:t});let o=D(this.iconLabel.element,_(".timeline-timestamp-container"));this.timestamp=D(o,_("span.timeline-timestamp"));let n=D(this.iconLabel.element,_(".actions"));this.actionBar=new oo(n,{actionViewItemProvider:e})}dispose(){this.iconLabel.dispose(),this.actionBar.dispose()}reset(){this.icon.className="",this.icon.style.backgroundImage="",this.actionBar.clear()}},g$i=class{getId(i){return i.handle}},nJt=class extends cs{async runAction(i,{uri:e,item:t}){if(!yht(t)){await i.run();return}await i.run({$mid:12,handle:t.handle,source:t.source,uri:e},e,t.source)}},f$i=class{getKeyboardNavigationLabel(i){return i.label}},v$i=class{getHeight(i){return tBo}getTemplateId(i){return Cht.id}},Sht=class extends k{constructor(e,t,o,n){super();this.commands=e;this.viewContainerLocation=t;this.instantiationService=o;this.themeService=n;this._onDidScrollToEnd=this._register(new T);this.onDidScrollToEnd=this._onDidScrollToEnd.event;this.templateId=Cht.id;this.actionViewItemProvider=ta.bind(void 0,this.instantiationService),this._hoverDelegate=this.instantiationService.createInstance(Kf,this.viewContainerLocation===1?"mouse":"element",{instantHover:this.viewContainerLocation!==1},{position:{hoverPosition:1}})}setUri(e){this.uri=e}renderTemplate(e){return new Cht(e,this.actionViewItemProvider,this._hoverDelegate)}renderElement(e,t,o){o.reset();let{element:n}=e,r=this.themeService.getColorTheme(),s=cm(r.type)?n.iconDark:n.icon,l=s?A.revive(s):null;l?(o.icon.className="custom-view-tree-node-item-icon",o.icon.style.backgroundImage=cl(l),o.icon.style.color=""):n.themeIcon?(o.icon.className=`custom-view-tree-node-item-icon ${q.asClassName(n.themeIcon)}`,n.themeIcon.color?o.icon.style.color=r.getColor(n.themeIcon.color.id)?.toString()??"":o.icon.style.color="",o.icon.style.backgroundImage=""):(o.icon.className="custom-view-tree-node-item-icon",o.icon.style.backgroundImage="",o.icon.style.color="");let c=n.tooltip?We(n.tooltip)?n.tooltip:{markdown:n.tooltip,markdownNotSupportedFallback:ma(n.tooltip)}:void 0;o.iconLabel.setLabel(n.label,n.description,{title:c,matches:Wa(e.filterData)}),o.timestamp.textContent=n.relativeTime??"",o.timestamp.ariaLabel=n.relativeTimeFullWord??"",o.timestamp.parentElement.classList.toggle("timeline-timestamp--duplicate",yht(n)&&n.hideRelativeTime),o.actionBar.context={uri:this.uri,item:n},o.actionBar.actionRunner=new nJt,o.actionBar.push(this.commands.getItemActions(n),{icon:!0,label:!1}),oJt(n)&&setTimeout(()=>this._onDidScrollToEnd.fire(n),0)}disposeElement(e,t,o){o.actionBar.actionRunner.dispose()}disposeTemplate(e){e.dispose()}};Sht=I([m(2,F),m(3,Pe)],Sht);var ALn=Oe("timeline-refresh",L.refresh,d(17415,null)),NLn=Oe("timeline-pin",L.pin,d(17414,null)),OLn=Oe("timeline-unpin",L.pinned,d(17416,null)),Iht=class extends k{constructor(e,t,o,n,r){super();this.pane=e;this.timelineService=t;this.storageService=o;this.contextKeyService=n;this.menuService=r;this._register(this.sourceDisposables=new O),this._register(W(class extends z{constructor(){super({id:"timeline.refresh",title:P(17399,"Refresh"),icon:ALn,category:P(17400,"Timeline"),menu:{id:R.TimelineTitle,group:"navigation",order:99}})}run(s,...l){e.reset()}})),this._register(Ge.registerCommand("timeline.toggleFollowActiveEditor",(s,...l)=>e.followActiveEditor=!e.followActiveEditor)),this._register(be.appendMenuItem(R.TimelineTitle,{command:{id:"timeline.toggleFollowActiveEditor",title:P(17412,"Pin the Current Timeline"),icon:NLn,category:P(17400,"Timeline")},group:"navigation",order:98,when:h$i})),this._register(be.appendMenuItem(R.TimelineTitle,{command:{id:"timeline.toggleFollowActiveEditor",title:P(17413,"Unpin the Current Timeline"),icon:OLn,category:P(17400,"Timeline")},group:"navigation",order:98,when:h$i.toNegated()})),this._register(t.onDidChangeProviders(()=>this.updateTimelineSourceFilters())),this.updateTimelineSourceFilters()}getItemActions(e){return this.getActions(R.TimelineItemContext,{key:"timelineItem",value:e.contextValue}).primary}getItemContextActions(e){return this.getActions(R.TimelineItemContext,{key:"timelineItem",value:e.contextValue}).secondary}getActions(e,t){let o=this.contextKeyService.createOverlay([["view",this.pane.id],[t.key,t.value]]),n=this.menuService.getMenuActions(e,o,{shouldForwardArgs:!0});return um(n,"inline")}updateTimelineSourceFilters(){this.sourceDisposables.clear();let e=new Set(JSON.parse(this.storageService.get("timeline.excludeSources",0,"[]")));for(let t of this.timelineService.getSources())this.sourceDisposables.add(W(class extends z{constructor(){super({id:`timeline.toggleExcludeSource:${t.id}`,title:t.label,menu:{id:R.TimelineFilterSubMenu,group:"navigation"},toggled:C.regex("timelineExcludeSources",new RegExp(`\\b${Ss(t.id)}\\b`)).negate()})}run(o,...n){e.delete(t.id)||e.add(t.id),o.get(de).store("timeline.excludeSources",JSON.stringify([...e.keys()]),0,0)}}))}};Iht=I([m(1,rU),m(2,de),m(3,X),m(4,Yt)],Iht);var FLn=Oe("timeline-view-icon",L.history,d(17398,null)),WLn=Oe("timeline-open",L.history,d(17397,null)),b$i=class{constructor(){this.id=W0t;this.name=Cae.TITLE;this.containerIcon=FLn;this.ctorDescriptor=new Vt(Cae);this.order=2;this.weight=30;this.collapsed=!0;this.canToggleVisibility=!0;this.hideByDefault=!1;this.canMoveView=!0;this.when=iJt;this.focusCommand={id:"timeline.focus"}}},VLn=oe.as($t.Configuration);VLn.registerConfiguration({id:"timeline",order:1001,title:d(17395,null),type:"object",properties:{"timeline.pageSize":{type:["number","null"],default:50,markdownDescription:d(17394,null)},"timeline.pageOnScroll":{type:"boolean",default:!0,description:d(17393,null)}}});oe.as(Kn.ViewsRegistry).registerViews([new b$i],SSe);var xht;(t=>{t.ID="files.openTimeline",t.LABEL=d(17391,null);function e(){return(o,n)=>{let r=o.get(rU);if(A.isUri(n))return r.setUri(n)}}t.handler=e})(xht||={});Ge.registerCommand(xht.ID,xht.handler());be.appendMenuItem(R.ExplorerContext,{group:"4_timeline",order:1,command:{id:xht.ID,title:xht.LABEL,icon:WLn},when:C.and(gu.toNegated(),Ho.HasResource,iJt)});var BLn=Oe("timeline-filter",L.filter,d(17396,null));be.appendMenuItem(R.TimelineTitle,{submenu:R.TimelineFilterSubMenu,title:d(17392,null),group:"navigation",order:100,icon:BLn});Ce(rU,Mqe,1);var Tw=le("workingCopyHistoryService"),Pqe=20;var tD=class a{constructor(i){this.fileService=i;this.mapSchemeToProvider=new Map;this.onDidChangeCapabilities=U.None;this.onDidChangeFile=U.None}static{this.SCHEMA="vscode-local-history"}static toLocalHistoryFileSystem(i){let e={location:i.location.toString(!0),associatedResource:i.associatedResource.toString(!0)};return i.associatedResource.with({scheme:a.SCHEMA,query:JSON.stringify(e)})}static fromLocalHistoryFileSystem(i){let e=JSON.parse(i.query);return{location:A.parse(e.location),associatedResource:A.parse(e.associatedResource)}}static{this.EMPTY_RESOURCE=A.from({scheme:a.SCHEMA,path:"/empty"})}static{this.EMPTY={location:a.EMPTY_RESOURCE,associatedResource:a.EMPTY_RESOURCE}}get capabilities(){return 2050}async withProvider(i){let e=i.scheme,t=this.mapSchemeToProvider.get(e);if(!t){let o=this.fileService.getProvider(e);o?t=Promise.resolve(o):t=new Promise(n=>{let r=this.fileService.onDidChangeFileSystemProviderRegistrations(s=>{s.added&&s.provider&&s.scheme===e&&(r.dispose(),n(s.provider))})}),this.mapSchemeToProvider.set(e,t)}return t}async stat(i){let e=a.fromLocalHistoryFileSystem(i).location;return ze(a.EMPTY_RESOURCE,e)?{type:1,ctime:0,mtime:0,size:0}:(await this.withProvider(e)).stat(e)}async readFile(i){let e=a.fromLocalHistoryFileSystem(i).location;if(ze(a.EMPTY_RESOURCE,e))return Ke.fromString("").buffer;let t=await this.withProvider(e);if(yD(t))return t.readFile(e);throw new Error("Unsupported")}async writeFile(i,e,t){}async mkdir(i){}async readdir(i){return[]}async rename(i,e,t){}async delete(i,e){}watch(i,e){return k.None}};var S$i;function rJt(){if(!S$i){let a={year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric"},i=nd.DateTimeFormat(Kr,a).value;S$i={format:e=>i.format(e)}}return S$i}var I$i="localHistory:item",iz=C.equals("timelineItem",I$i),iBo=Oe("localHistory-icon",L.circleOutline,d(12632,null)),oBo=Oe("localHistory-restore",L.check,d(12633,null));var w$i=P(12644,"Local History"),sJt=C.has("config.workbench.localHistory.enabled"),C$i=P(12645,"Compare with File");W(class extends z{constructor(){super({id:"workbench.action.localHistory.compareWithFile",title:C$i,menu:{id:R.TimelineItemContext,group:"1_compare",order:1,when:iz}})}async run(a,i){let e=a.get(fe),t=a.get(Tw),{entry:o}=await oz(t,i);if(o)return e.executeCommand(ik,...Nqe(o,o.workingCopy.resource))}});W(class extends z{constructor(){super({id:"workbench.action.localHistory.compareWithPrevious",title:P(12646,"Compare with Previous"),menu:{id:R.TimelineItemContext,group:"1_compare",order:2,when:iz}})}async run(a,i){let e=a.get(fe),t=a.get(Tw),o=a.get(ie),{entry:n,previous:r}=await oz(t,i);if(n)return r?e.executeCommand(ik,...Nqe(r,n)):x$i(n,o)}});var y$i,nBo=new Y("localHistoryItemSelectedForCompare",!1,!0);W(class extends z{constructor(){super({id:"workbench.action.localHistory.selectForCompare",title:P(12656,"Select for Compare"),menu:{id:R.TimelineItemContext,group:"2_compare_with",order:2,when:iz}})}async run(a,i){let e=a.get(Tw),t=a.get(X),{entry:o}=await oz(e,i);o&&(y$i=i,nBo.bindTo(t).set(!0))}});W(class extends z{constructor(){super({id:"workbench.action.localHistory.compareWithSelected",title:P(12647,"Compare with Selected"),menu:{id:R.TimelineItemContext,group:"2_compare_with",order:1,when:C.and(iz,nBo)}})}async run(a,i){let e=a.get(Tw),t=a.get(fe);if(!y$i)return;let o=(await oz(e,y$i)).entry;if(!o)return;let{entry:n}=await oz(e,i);if(n)return t.executeCommand(ik,...Nqe(o,n))}});W(class extends z{constructor(){super({id:"workbench.action.localHistory.open",title:P(12651,"Show Contents"),menu:{id:R.TimelineItemContext,group:"3_contents",order:1,when:iz}})}async run(a,i){let e=a.get(Tw),t=a.get(ie),{entry:o}=await oz(e,i);if(o)return x$i(o,t)}});var rBo=P(12653,"Restore Contents");W(class extends z{constructor(){super({id:"workbench.action.localHistory.restoreViaEditor",title:rBo,menu:{id:R.EditorTitle,group:"navigation",order:-10,when:Ho.Scheme.isEqualTo(tD.SCHEMA)},icon:oBo})}async run(a,i){let{associatedResource:e,location:t}=tD.fromLocalHistoryFileSystem(i);return sBo(a,{uri:e,handle:sl(t)})}});W(class extends z{constructor(){super({id:"workbench.action.localHistory.restore",title:rBo,menu:{id:R.TimelineItemContext,group:"3_contents",order:2,when:iz}})}async run(a,i){return sBo(a,i)}});var HLn=Qh.registerSource("localHistoryRestore.source",d(12660,null));async function sBo(a,i){let e=a.get(ge),t=a.get(ct),o=a.get($a),n=a.get(Tw),r=a.get(ie),{entry:s}=await oz(n,i);if(s){let{confirmed:l}=await t.confirm({type:"warning",message:d(12639,null,Be(s.workingCopy.resource)),detail:d(12638,null),primaryButton:d(12663,null)});if(!l)return;let c=o.getAll(s.workingCopy.resource);if(c)for(let u of c)u.isDirty()&&await u.revert({soft:!0});try{await e.cloneFile(s.location,s.workingCopy.resource)}catch(u){await t.error(d(12666,null,Be(s.workingCopy.resource)),Mn(u));return}if(c)for(let u of c)await u.revert({force:!0});await r.openEditor({resource:s.workingCopy.resource}),await n.addEntry({resource:s.workingCopy.resource,source:HLn},Ie.None),await aBo(s,r)}}W(class extends z{constructor(){super({id:"workbench.action.localHistory.restoreViaPicker",title:P(12654,"Find Entry to Restore"),f1:!0,category:w$i,precondition:sJt})}async run(a){let i=a.get(Tw),e=a.get($e),t=a.get(_t),o=a.get(Rt),n=a.get(nt),r=a.get(ie),s=a.get(ge),l=a.get(fe),c=a.get(fa),u=new O,p=u.add(e.createQuickPick()),h=new qe;u.add(p.onDidHide(()=>h.dispose(!0))),p.busy=!0,p.show();let g=new xn(await i.getAll(h.token)),f=new xn(ui(c.getHistory().map(({resource:x})=>x))),v=[];for(let x of f)g.has(x)&&(v.push(x),g.delete(x));v.push(...[...g].sort((x,E)=>x.fsPath<E.fsPath?-1:1)),p.busy=!1,p.placeholder=d(12665,null),p.matchOnLabel=!0,p.matchOnDescription=!0,p.items=[...v].map(x=>({resource:x,label:sl(x),description:n.getUriLabel(ai(x),{relative:!0}),iconClasses:Ia(t,o,x)})),await U.toPromise(p.onDidAccept),u.dispose();let b=p.selectedItems.at(0)?.resource;if(!b)return;let S=new O,y=S.add(e.createQuickPick());h=new qe,S.add(y.onDidHide(()=>h.dispose(!0))),y.busy=!0,y.show();let w=await i.getEntries(b,h.token);y.busy=!1,y.canAcceptInBackground=!0,y.placeholder=d(12664,null),y.matchOnLabel=!0,y.matchOnDescription=!0,y.items=Array.from(w).reverse().map(x=>({entry:x,label:`$(circle-outline) ${Qh.getSourceLabel(x.source)}`,description:Aqe(x.timestamp)})),S.add(y.onDidAccept(async x=>{x.inBackground||S.dispose();let E=y.selectedItems.at(0);return E?await s.exists(E.entry.workingCopy.resource)?l.executeCommand(ik,...Nqe(E.entry,E.entry.workingCopy.resource,{preserveFocus:x.inBackground})):x$i(E.entry,r,{preserveFocus:x.inBackground}):void 0}))}});be.appendMenuItem(R.TimelineTitle,{command:{id:"workbench.action.localHistory.restoreViaPicker",title:P(12655,"Local History: Find Entry to Restore...")},group:"submenu",order:1,when:sJt});W(class extends z{constructor(){super({id:"workbench.action.localHistory.rename",title:P(12652,"Rename"),menu:{id:R.TimelineItemContext,group:"5_edit",order:1,when:iz}})}async run(a,i){let e=a.get(Tw),t=a.get($e),{entry:o}=await oz(e,i);if(o){let n=new O,r=n.add(t.createInputBox());r.title=d(12661,null),r.ignoreFocusOut=!0,r.placeholder=d(12662,null),r.value=Qh.getSourceLabel(o.source),r.show(),n.add(r.onDidAccept(()=>{r.value&&e.updateEntry(o,{source:r.value},Ie.None),n.dispose()}))}}});W(class extends z{constructor(){super({id:"workbench.action.localHistory.delete",title:P(12649,"Delete"),menu:{id:R.TimelineItemContext,group:"5_edit",order:2,when:iz}})}async run(a,i){let e=a.get(Tw),t=a.get(ie),o=a.get(ct),{entry:n}=await oz(e,i);if(n){let{confirmed:r}=await o.confirm({type:"warning",message:d(12637,null,n.workingCopy.name,Aqe(n.timestamp)),detail:d(12636,null),primaryButton:d(12643,null)});if(!r)return;await e.removeEntry(n,Ie.None),await aBo(n,t)}}});W(class extends z{constructor(){super({id:"workbench.action.localHistory.deleteAll",title:P(12650,"Delete All"),f1:!0,category:w$i,precondition:sJt})}async run(a){let i=a.get(ct),e=a.get(Tw),{confirmed:t}=await i.confirm({type:"warning",message:d(12635,null),detail:d(12634,null),primaryButton:d(12642,null)});t&&await e.removeAll(Ie.None)}});W(class extends z{constructor(){super({id:"workbench.action.localHistory.create",title:P(12648,"Create Entry"),f1:!0,category:w$i,precondition:C.and(sJt,Tr)})}async run(a){let i=a.get(Tw),e=a.get($e),t=a.get(ie),o=a.get(nt),n=a.get(Pn),r=po.getOriginalUri(t.activeEditor,{supportSideBySide:1});if(r?.scheme!==n.defaultUriScheme&&r?.scheme!==Q.vscodeUserData)return;let s=new O,l=s.add(e.createInputBox());l.title=d(12640,null),l.ignoreFocusOut=!0,l.placeholder=d(12641,null,o.getUriBasenameLabel(r)),l.show(),s.add(l.onDidAccept(async()=>{let c=l.value;s.dispose(),c&&await i.addEntry({resource:r,source:l.value},Ie.None)}))}});async function x$i(a,i,e){let t=tD.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource});await i.openEditor({resource:t,label:d(12659,null,a.workingCopy.name,Qh.getSourceLabel(a.source),Aqe(a.timestamp)),options:e})}async function aBo(a,i){let e=tD.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource}),t=i.findEditors(e,{supportSideBySide:4});await i.closeEditors(t,{preserveFocus:!0})}function Nqe(a,i,e){let t=tD.toLocalHistoryFileSystem({location:a.location,associatedResource:a.workingCopy.resource}),o,n;if(A.isUri(i))n=i,o=d(12657,null,a.workingCopy.name,Qh.getSourceLabel(a.source),Aqe(a.timestamp),a.workingCopy.name);else{let r=i;n=tD.toLocalHistoryFileSystem({location:r.location,associatedResource:r.workingCopy.resource}),o=d(12658,null,a.workingCopy.name,Qh.getSourceLabel(a.source),Aqe(a.timestamp),r.workingCopy.name,Qh.getSourceLabel(r.source),Aqe(r.timestamp))}return[t,n,o,e?[void 0,e]:void 0]}async function oz(a,i){let e=i.uri;e.scheme===tD.SCHEMA&&(e=tD.fromLocalHistoryFileSystem(e).associatedResource);let t=await a.getEntries(e,Ie.None),o,n;for(let r=0;r<t.length;r++){let s=t[r];if(s.id===i.handle){o=s,n=t[r-1];break}}return{entry:o,previous:n}}var ULn=/\//g;function Aqe(a){return`${rJt().format(a).replace(ULn,"-")}`}var mj=class extends k{constructor(e,t,o,n,r,s,l){super();this.timelineService=e;this.workingCopyHistoryService=t;this.pathService=o;this.fileService=n;this.environmentService=r;this.configurationService=s;this.contextService=l;this.id="timeline.localHistory";this.label=d(12667,null);this.scheme="*";this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.timelineProviderDisposable=this._register(new ue);this.registerComponents(),this.registerListeners()}static{this.ID="workbench.contrib.localHistoryTimeline"}static{this.LOCAL_HISTORY_ENABLED_SETTINGS_KEY="workbench.localHistory.enabled"}registerComponents(){this.updateTimelineRegistration(),this._register(this.fileService.registerProvider(tD.SCHEMA,new tD(this.fileService)))}updateTimelineRegistration(){this.configurationService.getValue(mj.LOCAL_HISTORY_ENABLED_SETTINGS_KEY)?this.timelineProviderDisposable.value=this.timelineService.registerTimelineProvider(this):this.timelineProviderDisposable.clear()}registerListeners(){this._register(this.workingCopyHistoryService.onDidAddEntry(e=>this.onDidChangeWorkingCopyHistoryEntry(e.entry))),this._register(this.workingCopyHistoryService.onDidChangeEntry(e=>this.onDidChangeWorkingCopyHistoryEntry(e.entry))),this._register(this.workingCopyHistoryService.onDidReplaceEntry(e=>this.onDidChangeWorkingCopyHistoryEntry(e.entry))),this._register(this.workingCopyHistoryService.onDidRemoveEntry(e=>this.onDidChangeWorkingCopyHistoryEntry(e.entry))),this._register(this.workingCopyHistoryService.onDidRemoveEntries(()=>this.onDidChangeWorkingCopyHistoryEntry(void 0))),this._register(this.workingCopyHistoryService.onDidMoveEntries(()=>this.onDidChangeWorkingCopyHistoryEntry(void 0))),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(mj.LOCAL_HISTORY_ENABLED_SETTINGS_KEY)&&this.updateTimelineRegistration()}))}onDidChangeWorkingCopyHistoryEntry(e){this._onDidChange.fire({id:this.id,uri:e?.workingCopy.resource,reset:!0})}async provideTimeline(e,t,o){let n=[],r;if(e.scheme===tD.SCHEMA?r=tD.fromLocalHistoryFileSystem(e).associatedResource:e.scheme===this.pathService.defaultUriScheme||e.scheme===Q.vscodeUserData?r=e:this.fileService.hasProvider(e)&&(r=A.from({scheme:this.pathService.defaultUriScheme,authority:this.environmentService.remoteAuthority??Rso(this.contextService.getWorkspace()),path:e.path})),r){let s=await this.workingCopyHistoryService.getEntries(r,o);for(let l of s)n.push(this.toTimelineItem(l))}return{source:this.id,items:n}}toTimelineItem(e){return{handle:e.id,label:Qh.getSourceLabel(e.source),tooltip:new he(`$(history) ${rJt().format(e.timestamp)}

${Qh.getSourceLabel(e.source)}${e.sourceDescription?` (${e.sourceDescription})`:""}`,{supportThemeIcons:!0}),source:this.id,timestamp:e.timestamp,themeIcon:iBo,contextValue:I$i,command:{id:ik,title:C$i.value,arguments:Nqe(e,e.workingCopy.resource)}}}};mj=I([m(0,rU),m(1,Tw),m(2,Pn),m(3,ge),m(4,Mt),m(5,B),m(6,Ae)],mj);bt(mj.ID,mj,vt.BlockRestore);var E$i=Oe("workspace-trust-banner",L.shield,d(18310,null)),zLn=Oe("workspace-trust-editor-check",L.check,d(18293,null)),KLn=Oe("workspace-trust-editor-cross",L.x,d(18350,null)),GLn=Oe("workspace-trust-editor-folder-picker",L.folder,d(18298,null)),qLn=Oe("workspace-trust-editor-edit-folder",L.edit,d(18296,null)),$Ln=Oe("workspace-trust-editor-remove-folder",L.close,d(18307,null)),kht=class extends k{constructor(e,t,o,n,r,s,l){super();this.container=e;this.instantiationService=t;this.workspaceService=o;this.workspaceTrustManagementService=n;this.uriService=r;this.labelService=s;this.fileDialogService=l;this._onDidAcceptEdit=this._register(new T);this.onDidAcceptEdit=this._onDidAcceptEdit.event;this._onDidRejectEdit=this._register(new T);this.onDidRejectEdit=this._onDidRejectEdit.event;this._onEdit=this._register(new T);this.onEdit=this._onEdit.event;this._onDelete=this._register(new T);this.onDelete=this._onDelete.event;this.descriptionElement=e.appendChild(_(".workspace-trusted-folders-description"));let c=e.appendChild(_(".trusted-uris-table")),u=e.appendChild(_(".trusted-uris-button-bar"));this.table=this.instantiationService.createInstance(Cx,"WorkspaceTrust",c,new Eht,[{label:d(18299,null),tooltip:"",weight:1,templateId:Eae.TEMPLATE_ID,project(g){return g}},{label:d(18305,null),tooltip:"",weight:8,templateId:kae.TEMPLATE_ID,project(g){return g}},{label:"",tooltip:"",weight:1,minimumWidth:75,maximumWidth:75,templateId:xae.TEMPLATE_ID,project(g){return g}}],[this.instantiationService.createInstance(Eae),this.instantiationService.createInstance(kae,this),this.instantiationService.createInstance(xae,this,this.currentWorkspaceUri)],{horizontalScrolling:!1,alwaysConsumeMouseWheel:!1,openOnSingleClick:!1,multipleSelectionSupport:!1,accessibilityProvider:{getAriaLabel:g=>{let f=aJt(this.labelService,g);return f===void 0||f.length===0?d(18317,null,this.labelService.getUriLabel(g.uri)):d(18321,null,this.labelService.getUriLabel(g.uri),f)},getWidgetAriaLabel:()=>d(18318,null)},identityProvider:{getId(g){return g.uri.toString()}}}),this._register(this.table.onDidOpen(g=>{g&&g.element&&!g.browserEvent?.defaultPrevented&&this.edit(g.element,!0)}));let p=this._register(new sC(u)),h=this._register(p.addButton({title:d(18292,null),...Ro}));h.label=d(18292,null),this._register(h.onDidClick(async()=>{let g=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:this.currentWorkspaceUri,openLabel:d(18336,null),title:d(18309,null)});g&&this.workspaceTrustManagementService.setUrisTrust(g,!0)})),this._register(this.workspaceTrustManagementService.onDidChangeTrustedFolders(()=>{this.updateTable()}))}getIndexOfTrustedUriEntry(e){let t=this.trustedUriEntries.indexOf(e);if(t===-1){for(let o=0;o<this.trustedUriEntries.length;o++)if(this.trustedUriEntries[o].uri===e.uri)return o}return t}selectTrustedUriEntry(e,t=!0){let o=this.getIndexOfTrustedUriEntry(e);o!==-1&&(t&&(this.table.domFocus(),this.table.setFocus([o])),this.table.setSelection([o]))}get currentWorkspaceUri(){return this.workspaceService.getWorkspace().folders[0]?.uri||A.file("/")}get trustedUriEntries(){let e=this.workspaceService.getWorkspace(),t=e.folders.map(r=>r.uri);return e.configuration&&t.push(e.configuration),this.workspaceTrustManagementService.getTrustedUris().map(r=>{let s=!1;for(let l of t)s=s||this.uriService.extUri.isEqualOrParent(l,r);return{uri:r,parentOfWorkspaceItem:s}}).sort((r,s)=>{if(r.uri.scheme!==s.uri.scheme){if(r.uri.scheme===Q.file)return-1;if(s.uri.scheme===Q.file)return 1}let l=r.uri.path.endsWith(".code-workspace"),c=s.uri.path.endsWith(".code-workspace");if(l!==c){if(l)return 1;if(c)return-1}return r.uri.fsPath.localeCompare(s.uri.fsPath)})}layout(){this.table.layout(this.trustedUriEntries.length*Eht.ROW_HEIGHT+Eht.HEADER_ROW_HEIGHT,void 0)}updateTable(){let e=this.trustedUriEntries;this.container.classList.toggle("empty",e.length===0),this.descriptionElement.innerText=e.length?d(18319,null):d(18304,null),this.table.splice(0,Number.POSITIVE_INFINITY,this.trustedUriEntries),this.layout()}validateUri(e,t){if(!t)return null;if(t.uri.scheme==="vscode-vfs"){let o=e.split(Vo.sep).filter(n=>n.length);if(o.length===0&&e.startsWith(Vo.sep))return{type:2,content:d(18311,null,aJt(this.labelService,t))};if(o.length===1)return{type:2,content:d(18334,null,o[0],aJt(this.labelService,t))};if(o.length>2)return{type:3,content:d(18300,null,e)}}return null}acceptEdit(e,t){let o=this.workspaceTrustManagementService.getTrustedUris(),n=o.findIndex(r=>this.uriService.extUri.isEqual(r,e.uri));n>=o.length||n===-1?o.push(t):o[n]=t,this.workspaceTrustManagementService.setTrustedUris(o),this._onDidAcceptEdit.fire(e)}rejectEdit(e){this._onDidRejectEdit.fire(e)}async delete(e){this.table.focusNext(),await this.workspaceTrustManagementService.setUrisTrust([e.uri],!1),this.table.getFocus().length===0&&this.table.focusLast(),this._onDelete.fire(e),this.table.domFocus()}async edit(e,t){if((e.uri.scheme===Q.file||e.uri.scheme===this.currentWorkspaceUri.scheme&&this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority,e.uri.authority)&&!ype(e.uri))&&t){let n=await this.fileDialogService.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.uri,openLabel:d(18336,null),title:d(18309,null)});n?this.acceptEdit(e,n[0]):this.rejectEdit(e)}else this.selectTrustedUriEntry(e),this._onEdit.fire(e)}};kht=I([m(1,F),m(2,Ae),m(3,Or),m(4,gt),m(5,nt),m(6,nn)],kht);var Eht=class a{constructor(){this.headerRowHeight=a.HEADER_ROW_HEIGHT}static{this.HEADER_ROW_HEIGHT=30}static{this.ROW_HEIGHT=24}getHeight(i){return a.ROW_HEIGHT}},xae=class{constructor(i,e,t){this.table=i;this.currentWorkspaceUri=e;this.uriService=t;this.templateId=xae.TEMPLATE_ID}static{this.TEMPLATE_ID="actions"}renderTemplate(i){let e=i.appendChild(_(".actions"));return{actionBar:new oo(e)}}renderElement(i,e,t){t.actionBar.clear();let o=i.uri.scheme===Q.file||i.uri.scheme===this.currentWorkspaceUri.scheme&&this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority,i.uri.authority)&&!ype(i.uri),n=[];o&&n.push(this.createPickerAction(i)),n.push(this.createEditAction(i)),n.push(this.createDeleteAction(i)),t.actionBar.push(n,{icon:!0})}createEditAction(i){return{label:"",class:q.asClassName(qLn),enabled:!0,id:"editTrustedUri",tooltip:d(18297,null),run:()=>{this.table.edit(i,!1)}}}createPickerAction(i){return{label:"",class:q.asClassName(GLn),enabled:!0,id:"pickerTrustedUri",tooltip:d(18306,null),run:()=>{this.table.edit(i,!0)}}}createDeleteAction(i){return{label:"",class:q.asClassName($Ln),enabled:!0,id:"deleteTrustedUri",tooltip:d(18294,null),run:async()=>{await this.table.delete(i)}}}disposeTemplate(i){i.actionBar.dispose()}};xae=I([m(2,gt)],xae);var kae=class{constructor(i,e){this.table=i;this.contextViewService=e;this.templateId=kae.TEMPLATE_ID}static{this.TEMPLATE_ID="path"}renderTemplate(i){let e=i.appendChild(_(".path")),t=e.appendChild(_("div.path-label")),o=new ad(e,this.contextViewService,{validationOptions:{validation:s=>this.table.validateUri(s,this.currentItem)},inputBoxStyles:Wl}),n=new O,r=n.add(new O);return{element:e,pathLabel:t,pathInput:o,disposables:n,renderDisposables:r}}renderElement(i,e,t){t.renderDisposables.clear(),this.currentItem=i,t.renderDisposables.add(this.table.onEdit(async l=>{i===l&&(t.element.classList.add("input-mode"),t.pathInput.focus(),t.pathInput.select(),t.element.parentElement.style.paddingLeft="0px")})),t.renderDisposables.add($(t.pathInput.element,ne.DBLCLICK,l=>{Kt.stop(l)}));let o=()=>{t.element.classList.remove("input-mode"),t.element.parentElement.style.paddingLeft="5px"},n=()=>{o();let l=t.pathInput.value,c=pY(l)?i.uri.with({path:Vo.sep+kz(l)}):i.uri.with({path:l});t.pathLabel.innerText=this.formatPath(c),c&&this.table.acceptEdit(i,c)},r=()=>{o(),t.pathInput.value=s,this.table.rejectEdit(i)};t.renderDisposables.add(Yo(t.pathInput.inputElement,ne.KEY_DOWN,l=>{let c=!1;l.equals(3)?(n(),c=!0):l.equals(9)&&(r(),c=!0),c&&(l.preventDefault(),l.stopPropagation())})),t.renderDisposables.add($(t.pathInput.inputElement,ne.BLUR,()=>{r()}));let s=this.formatPath(i.uri);t.pathInput.value=s,t.pathLabel.innerText=s,t.element.classList.toggle("current-workspace-parent",i.parentOfWorkspaceItem)}disposeTemplate(i){i.disposables.dispose(),i.renderDisposables.dispose()}formatPath(i){if(i.scheme===Q.file)return dm(i.fsPath);if(i.path.startsWith(Vo.sep)){let e=i.path.substring(1);if(pY(e,!0))return dm(Gs.normalize(e),!0)}return i.path}};kae=I([m(1,qn)],kae);function aJt(a,i){return i.uri.authority?a.getHostLabel(i.uri.scheme,i.uri.authority):d(18302,null)}var Eae=class{constructor(i){this.labelService=i;this.templateId=Eae.TEMPLATE_ID}static{this.TEMPLATE_ID="host"}renderTemplate(i){let e=new O,t=e.add(new O),o=i.appendChild(_(".host")),n=o.appendChild(_("div.host-label")),r=o.appendChild(_("div.button-bar"));return{element:o,hostContainer:n,buttonBarContainer:r,disposables:e,renderDisposables:t}}renderElement(i,e,t){t.renderDisposables.clear(),t.renderDisposables.add({dispose:()=>{St(t.buttonBarContainer)}}),t.hostContainer.innerText=aJt(this.labelService,i),t.element.classList.toggle("current-workspace-parent",i.parentOfWorkspaceItem),t.hostContainer.style.display="",t.buttonBarContainer.style.display="none"}disposeTemplate(i){i.disposables.dispose()}};Eae=I([m(0,nt)],Eae);var hj=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(hj.ID,e,t,o,n);this.workspaceService=r;this.extensionWorkbenchService=s;this.extensionManifestPropertiesService=l;this.instantiationService=c;this.workspaceTrustManagementService=u;this.configurationService=p;this.extensionEnablementService=h;this.productService=g;this.keybindingService=f;this.rendering=!1;this.rerenderDisposables=this._register(new O);this.layoutParticipants=[]}static{this.ID="workbench.editor.workspaceTrust"}createEditor(e){this.rootElement=D(e,_(".workspace-trust-editor",{tabindex:"0"})),this.createHeaderElement(this.rootElement);let t=_(".workspace-trust-editor-body");this.bodyScrollBar=this._register(new Ar(t,{horizontal:2,vertical:1})),D(this.rootElement,this.bodyScrollBar.getDomNode()),this.createAffectedFeaturesElement(t),this.createConfigurationElement(t),this.rootElement.style.setProperty("--workspace-trust-selected-color",Tt(th)),this.rootElement.style.setProperty("--workspace-trust-unselected-color",Tt(_5)),this.rootElement.style.setProperty("--workspace-trust-check-color",Tt(XNe)),this.rootElement.style.setProperty("--workspace-trust-x-color",Tt($v)),this._register($(this.rootElement,ne.KEY_DOWN,o=>{let n=new mi(o);if(n.equals(16)||n.equals(18)){let r=[this.headerContainer,this.trustedContainer,this.untrustedContainer,this.configurationContainer],l=r.findIndex(c=>Is(c));n.equals(18)?l++:n.equals(16)&&(l=Math.max(0,l),l--),l+=r.length,l%=r.length,r[l].focus()}else n.equals(9)?this.rootElement.focus():n.equals(2051)?this.workspaceTrustManagementService.canSetWorkspaceTrust()&&this.workspaceTrustManagementService.setWorkspaceTrust(!this.workspaceTrustManagementService.isWorkspaceTrusted()):n.equals(3075)&&this.workspaceTrustManagementService.canSetParentFolderTrust()&&this.workspaceTrustManagementService.setParentFolderTrust(!0)}))}focus(){super.focus(),this.rootElement.focus()}async setInput(e,t,o,n){await super.setInput(e,t,o,n),!n.isCancellationRequested&&(await this.workspaceTrustManagementService.workspaceTrustInitialized,this.registerListeners(),await this.render())}registerListeners(){this._register(this.extensionWorkbenchService.onChange(()=>this.render())),this._register(this.configurationService.onDidChangeRestrictedSettings(()=>this.render())),this._register(this.workspaceTrustManagementService.onDidChangeTrust(()=>this.render())),this._register(this.workspaceTrustManagementService.onDidChangeTrustedFolders(()=>this.render()))}getHeaderContainerClass(e){return e?"workspace-trust-header workspace-trust-trusted":"workspace-trust-header workspace-trust-untrusted"}getHeaderTitleText(e){if(e){if(this.workspaceTrustManagementService.isWorkspaceTrustForced())return d(18328,null);switch(this.workspaceService.getWorkbenchState()){case 1:return d(18324,null);case 2:return d(18323,null);case 3:return d(18325,null)}}return d(18342,null)}getHeaderTitleIconClassNames(e){return q.asClassNameArray(E$i)}getFeaturesHeaderText(e){let t="",o="";switch(this.workspaceService.getWorkbenchState()){case 1:{t=e?d(18329,null):d(18346,null),o=e?d(18330,null):d(18345,null);break}case 2:{t=e?d(18316,null):d(18346,null),o=e?d(18320,null):d(18341,null);break}case 3:{t=e?d(18331,null):d(18346,null),o=e?d(18332,null):d(18348,null);break}}return[t,o]}async render(){if(this.rendering)return;this.rendering=!0,this.rerenderDisposables.clear();let e=this.workspaceTrustManagementService.isWorkspaceTrusted();this.rootElement.classList.toggle("trusted",e),this.rootElement.classList.toggle("untrusted",!e),this.headerTitleText.innerText=this.getHeaderTitleText(e),this.headerTitleIcon.className="workspace-trust-title-icon",this.headerTitleIcon.classList.add(...this.getHeaderTitleIconClassNames(e)),this.headerDescription.innerText="";let t=D(this.headerDescription,_("div"));t.innerText=e?d(18314,null):d(18338,null,this.productService.nameShort);let o=D(this.headerDescription,_("div")),n=d(18349,null,"command:workbench.trust.configure");for(let c of ZS(n).nodes)typeof c=="string"?D(o,document.createTextNode(c)):this.rerenderDisposables.add(this.instantiationService.createInstance(Bg,o,{...c,tabIndex:-1},{}));this.headerContainer.className=this.getHeaderContainerClass(e),this.rootElement.setAttribute("aria-label",`${d(18308,null)}:  ${this.headerContainer.innerText}`);let r=this.configurationService.restrictedSettings,s=oe.as($t.Configuration),l=r.default.filter(c=>{let u=s.getConfigurationProperties()[c];if(u.scope&&(MC.includes(u.scope)||u.scope===2))return!1;if(u.deprecationMessage||u.markdownDeprecationMessage){if(r.workspace?.includes(c))return!0;if(r.workspaceFolder){for(let p of r.workspaceFolder.values())if(p.includes(c))return!0}return!1}return!0}).length;this.renderAffectedFeatures(l,this.getExtensionCount()),this.workspaceTrustedUrisTable.updateTable(),this.bodyScrollBar.getDomNode().style.height=`calc(100% - ${this.headerContainer.clientHeight}px)`,this.bodyScrollBar.scanDomNode(),this.rendering=!1}getExtensionCount(){let e=new Set,t=R0(this.workspaceService.getWorkspace()),o=this.extensionWorkbenchService.local.filter(n=>n.local).map(n=>n.local);for(let n of o){let r=this.extensionEnablementService.getEnablementState(n);if(r!==12&&r!==13&&r!==0&&r!==8||t&&this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(n.manifest)===!1)continue;if(this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(n.manifest)!==!0){e.add(n.identifier.id);continue}ipe(o,n).some(l=>this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(l.manifest)===!1)&&e.add(n.identifier.id)}return e.size}createHeaderElement(e){this.headerContainer=D(e,_(".workspace-trust-header",{tabIndex:"0"})),this.headerTitleContainer=D(this.headerContainer,_(".workspace-trust-title")),this.headerTitleIcon=D(this.headerTitleContainer,_(".workspace-trust-title-icon")),this.headerTitleText=D(this.headerTitleContainer,_(".workspace-trust-title-text")),this.headerDescription=D(this.headerContainer,_(".workspace-trust-description"))}createConfigurationElement(e){this.configurationContainer=D(e,_(".workspace-trust-settings",{tabIndex:"0"}));let t=D(this.configurationContainer,_(".workspace-trusted-folders-title"));t.innerText=d(18318,null),this.workspaceTrustedUrisTable=this._register(this.instantiationService.createInstance(kht,this.configurationContainer))}createAffectedFeaturesElement(e){this.affectedFeaturesContainer=D(e,_(".workspace-trust-features")),this.trustedContainer=D(this.affectedFeaturesContainer,_(".workspace-trust-limitations.trusted",{tabIndex:"0"})),this.untrustedContainer=D(this.affectedFeaturesContainer,_(".workspace-trust-limitations.untrusted",{tabIndex:"0"}))}async renderAffectedFeatures(e,t){St(this.trustedContainer),St(this.untrustedContainer);let[o,n]=this.getFeaturesHeaderText(!0);this.renderLimitationsHeaderElement(this.trustedContainer,o,n);let r=this.workspaceService.getWorkbenchState()===1?[d(18327,null),d(18313,null),d(18315,null)]:[d(18327,null),d(18313,null),d(18326,null),d(18315,null)];this.renderLimitationsListElement(this.trustedContainer,r,q.asClassNameArray(zLn));let[s,l]=this.getFeaturesHeaderText(!1);this.renderLimitationsHeaderElement(this.untrustedContainer,s,l);let c=this.workspaceService.getWorkbenchState()===1?[d(18344,null),d(18337,null),k$i(d(18339,null,t,`command:${zH}`))]:[d(18344,null),d(18337,null),k$i(e?d(18343,null,e,"command:settings.filterUntrusted"):d(18303,null)),k$i(d(18339,null,t,`command:${zH}`))];this.renderLimitationsListElement(this.untrustedContainer,c,q.asClassNameArray(KLn)),this.workspaceTrustManagementService.isWorkspaceTrusted()?this.workspaceTrustManagementService.canSetWorkspaceTrust()?this.addDontTrustButtonToElement(this.untrustedContainer):this.addTrustedTextToElement(this.untrustedContainer):this.workspaceTrustManagementService.canSetWorkspaceTrust()&&this.addTrustButtonToElement(this.trustedContainer)}createButtonRow(e,t,o){let n=D(e,_(".workspace-trust-buttons-row")),r=D(n,_(".workspace-trust-buttons")),s=this.rerenderDisposables.add(new sC(r));for(let{action:l,keybinding:c}of t){let u=s.addButtonWithDescription(Ro);u.label=l.label,u.enabled=o!==void 0?o:l.enabled,u.description=c.getLabel(),u.element.ariaLabel=l.label+", "+d(18301,null,c.getAriaLabel()),this.rerenderDisposables.add(u.onDidClick(p=>{p&&Kt.stop(p,!0),l.run()}))}}addTrustButtonToElement(e){let o=[{action:this.rerenderDisposables.add(new it("workspace.trust.button.action.grant",d(18312,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setWorkspaceTrust(!0)})),keybinding:this.keybindingService.resolveUserBinding(et?"Cmd+Enter":"Ctrl+Enter")[0]}];if(this.workspaceTrustManagementService.canSetParentFolderTrust()){let n=pf(this.workspaceService.getWorkspace()),r=Be(ai(n.uri)),s=D(e,_(".trust-message-box"));s.innerText=d(18333,null,r);let l=this.rerenderDisposables.add(new it("workspace.trust.button.action.grantParent",d(18335,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setParentFolderTrust(!0)}));o.push({action:l,keybinding:this.keybindingService.resolveUserBinding(et?"Cmd+Shift+Enter":"Ctrl+Shift+Enter")[0]})}this.createButtonRow(e,o)}addDontTrustButtonToElement(e){this.createButtonRow(e,[{action:this.rerenderDisposables.add(new it("workspace.trust.button.action.deny",d(18295,null),void 0,!0,async()=>{await this.workspaceTrustManagementService.setWorkspaceTrust(!1)})),keybinding:this.keybindingService.resolveUserBinding(et?"Cmd+Enter":"Ctrl+Enter")[0]}])}addTrustedTextToElement(e){if(this.workspaceService.getWorkbenchState()===1)return;let t=D(e,_(".workspace-trust-untrusted-description"));this.workspaceTrustManagementService.isWorkspaceTrustForced()?t.innerText=d(18322,null):t.innerText=this.workspaceService.getWorkbenchState()===3?d(18347,null):d(18340,null)}renderLimitationsHeaderElement(e,t,o){let n=D(e,_(".workspace-trust-limitations-header")),r=D(n,_(".workspace-trust-limitations-title")),s=D(r,_(".workspace-trust-limitations-title-text")),l=D(n,_(".workspace-trust-limitations-subtitle"));s.innerText=t,l.innerText=o}renderLimitationsListElement(e,t,o){let n=D(e,_(".workspace-trust-limitations-list-container")),r=D(n,_("ul"));for(let s of t){let l=D(r,_("li")),c=D(l,_(".list-item-icon")),u=D(l,_(".list-item-text"));c.classList.add(...o);let p=ZS(s);for(let h of p.nodes)typeof h=="string"?D(u,document.createTextNode(h)):this.rerenderDisposables.add(this.instantiationService.createInstance(Bg,u,{...h,tabIndex:-1},{}))}}layout(e){this.isVisible()&&(this.workspaceTrustedUrisTable.layout(),this.layoutParticipants.forEach(t=>{t.layout()}),this.bodyScrollBar.scanDomNode())}};I([Tu(100)],hj.prototype,"render",1),hj=I([m(1,_e),m(2,Pe),m(3,de),m(4,Ae),m(5,Ui),m(6,hm),m(7,F),m(8,Or),m(9,Yg),m(10,As),m(11,Ze),m(12,Le)],hj);function k$i(a){let i=/(.*)\[(.+)\]\s*\((.+)\)(.*)/;return a.replace(i,"$1[$2]($3)$4")}var jLn=Oe("workspace-trust-editor-label-icon",L.shield,d(19686,null)),VIe=class a extends Ls{constructor(){super(...arguments);this.resource=A.from({scheme:Q.vscodeWorkspaceTrust,path:"workspaceTrustEditor"})}static{this.ID="workbench.input.workspaceTrust"}get capabilities(){return super.capabilities|8|2048}get typeId(){return a.ID}matches(e){return super.matches(e)||e instanceof a}getName(){return d(19685,null)}getIcon(){return jLn}};var lBo="workbench.banner.restrictedMode",cBo="workspace.trust.startupPrompt.shown",dBo="workbench.banner.restrictedMode.dismissed";function lJt(a,i,e){if(a.isSessionsWindow)return e?d(18260,null,i.nameLong):d(18259,null,i.nameLong)}var Tht=class extends k{constructor(i,e,t){super(),this._ctxWorkspaceTrustEnabled=Z$.IsEnabled.bindTo(i),this._ctxWorkspaceTrustEnabled.set(e.isWorkspaceTrustEnabled()),this._ctxWorkspaceTrustState=Z$.IsTrusted.bindTo(i),this._ctxWorkspaceTrustState.set(t.isWorkspaceTrusted()),this._register(t.onDidChangeTrust(o=>this._ctxWorkspaceTrustState.set(o)))}};Tht=I([m(0,X),m(1,yM),m(2,Or)],Tht);oe.as(Zi.Workbench).registerWorkbenchContribution(Tht,3);var Oqe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.dialogService=e;this.commandService=t;this.labelService=o;this.workspaceContextService=n;this.workspaceTrustManagementService=r;this.workspaceTrustRequestService=s;this.environmentService=l;this.productService=c;this.registerListeners()}static{this.ID="workbench.contrib.workspaceTrustRequestHandler"}get useWorkspaceLanguage(){return!Pg(pf(this.workspaceContextService.getWorkspace()))}registerListeners(){this._register(this.workspaceTrustRequestService.onDidInitiateOpenFilesTrustRequest(async()=>{await this.workspaceTrustManagementService.workspaceResolved;let e=[this.workspaceContextService.getWorkbenchState()!==1?d(18246,null):d(18243,null),d(18242,null)];await this.dialogService.prompt({type:ft.Info,message:this.workspaceContextService.getWorkbenchState()!==1?d(18247,null):d(18244,null),buttons:[{label:d(18241,null),run:({checkboxChecked:t})=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(1,!!t)},{label:d(18239,null),run:({checkboxChecked:t})=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(2,!!t)}],cancelButton:{run:()=>this.workspaceTrustRequestService.completeOpenFilesTrustRequest(3)},checkbox:{label:d(18245,null),checked:!1},custom:{icon:L.shield,markdownDetails:e.map(t=>({markdown:new he(t)}))}})})),this._register(this.workspaceTrustRequestService.onDidInitiateResourcesTrustRequest(async e=>{await this.workspaceTrustManagementService.workspaceResolved;let t=[e?.message??d(18248,null),d(18249,null),`\`${this.labelService.getUriLabel(e.uri)}\``],o=lJt(this.environmentService,this.productService,!1);o&&t.push(o),await this.dialogService.prompt({type:ft.Info,message:d(18250,null),buttons:[{label:d(18271,null),run:()=>this.workspaceTrustRequestService.completeResourcesTrustRequest(e.uri,1)}],cancelButton:{run:()=>this.workspaceTrustRequestService.completeResourcesTrustRequest(e.uri,3)},custom:{icon:L.shield,markdownDetails:t.map(n=>({markdown:new he(n)}))}})})),this._register(this.workspaceTrustRequestService.onDidInitiateWorkspaceTrustRequest(async e=>{await this.workspaceTrustManagementService.workspaceResolved;let t=this.useWorkspaceLanguage?d(18290,null):d(18232,null),o=d(18236,null),n=e?.message??o,r=e?.buttons??[{label:this.useWorkspaceLanguage?d(18234,null):d(18233,null),type:"ContinueWithTrust"},{label:d(18238,null),type:"Manage"}];r.some(u=>u.type==="Cancel")||r.push({label:d(18225,null),type:"Cancel"});let s=[{markdown:new he(n)},{markdown:new he(d(18235,null))}],l=lJt(this.environmentService,this.productService,this.useWorkspaceLanguage);l&&s.push({markdown:new he(l)});let{result:c}=await this.dialogService.prompt({type:ft.Info,message:t,custom:{icon:L.shield,markdownDetails:s},buttons:r.filter(u=>u.type!=="Cancel").map(u=>({label:u.label,run:()=>u.type})),cancelButton:(()=>{let u=r.find(p=>p.type==="Cancel");if(u)return{label:u.label,run:()=>u.type}})()});switch(c){case"ContinueWithTrust":await this.workspaceTrustRequestService.completeWorkspaceTrustRequest(!0);break;case"ContinueWithoutTrust":await this.workspaceTrustRequestService.completeWorkspaceTrustRequest(void 0);break;case"Manage":this.workspaceTrustRequestService.cancelWorkspaceTrustRequest(),await this.commandService.executeCommand(ej);break;case"Cancel":this.workspaceTrustRequestService.cancelWorkspaceTrustRequest();break}}))}};Oqe=I([m(0,ct),m(1,fe),m(2,nt),m(3,Ae),m(4,Or),m(5,lp),m(6,Mt),m(7,Ze)],Oqe);var _ht=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.dialogService=e;this.workspaceContextService=t;this.workspaceTrustEnablementService=o;this.workspaceTrustManagementService=n;this.configurationService=r;this.statusbarService=s;this.storageService=l;this.workspaceTrustRequestService=c;this.bannerService=u;this.labelService=p;this.hostService=h;this.productService=g;this.remoteAgentService=f;this.environmentService=v;this.fileService=b;this.entryId="status.workspaceTrust";this.statusbarEntryAccessor=this._register(new ue),(async()=>{if(await this.workspaceTrustManagementService.workspaceTrustInitialized,this.workspaceTrustEnablementService.isWorkspaceTrustEnabled())if(this.registerListeners(),this.updateStatusbarEntry(this.workspaceTrustManagementService.isWorkspaceTrusted()),this.hostService.hasFocus)this.showModalOnStart();else{let S=this.hostService.onDidChangeFocus(y=>{y&&(S.dispose(),this.showModalOnStart())})}})()}registerListeners(){this._register(this.workspaceContextService.onWillChangeWorkspaceFolders(e=>{if(e.fromCache||!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled())return;let t=async o=>{if(this.workspaceTrustManagementService.isWorkspaceTrusted()&&(o.changes.added.length||o.changes.changed.length)){let r=await Promise.all(o.changes.added.map(s=>this.workspaceTrustManagementService.getUriTrustInfo(s.uri)));if(!r.map(s=>s.trusted).every(s=>s)){let s=d(18223,null),l=lJt(this.environmentService,this.productService,!1);l&&(s+=`

`+l);let{confirmed:c}=await this.dialogService.confirm({type:ft.Info,message:d(18224,null),detail:s,cancelButton:d(18240,null),custom:{icon:L.shield}});await this.workspaceTrustManagementService.setUrisTrust(r.map(u=>u.uri),c)}}};return e.join(t(e))})),this._register(this.workspaceTrustManagementService.onDidChangeTrust(e=>{this.updateWorkbenchIndicators(e)})),this._register(this.workspaceTrustRequestService.onDidInitiateWorkspaceTrustRequestOnStartup(async()=>{let e,t,o,n,r=await this.isAiGeneratedWorkspace();r&&this.productService.aiGeneratedWorkspaceTrust?(e=this.productService.aiGeneratedWorkspaceTrust.title,t=this.productService.aiGeneratedWorkspaceTrust.startupTrustRequestLearnMore,o=this.productService.aiGeneratedWorkspaceTrust.trustOption,n=this.productService.aiGeneratedWorkspaceTrust.dontTrustOption):console.warn("AI generated workspace trust dialog contents not available.");let s=e??(this.useWorkspaceLanguage?d(18290,null):d(18232,null)),l,c=pf(this.workspaceContextService.getWorkspace()),u=Pg(c),p=u4(c);if(!r&&this.workspaceTrustManagementService.canSetParentFolderTrust()){let f=Be(ai(c.uri));l=d(18226,null,f)}let h=[u?d(18231,null,this.productService.nameShort):d(18289,null,this.productService.nameShort),t??d(18261,null),p?"":`\`${this.labelService.getWorkspaceLabel(c,{verbose:2})}\``],g=lJt(this.environmentService,this.productService,!u);g&&h.push(g),this.doShowModal(s,{label:o??d(18270,null),sublabel:u?d(18269,null):d(18272,null)},{label:n??d(18229,null),sublabel:u?d(18228,null):d(18230,null)},h,l)}))}updateWorkbenchIndicators(e){let t=this.getBannerItem(!e);this.updateStatusbarEntry(e),t&&(e?this.bannerService.hide(lBo):this.bannerService.show(t))}async doShowModal(e,t,o,n,r){await this.dialogService.prompt({type:ft.Info,message:e,checkbox:r?{label:r}:void 0,buttons:[{label:t.label,run:async({checkboxChecked:s})=>{s?await this.workspaceTrustManagementService.setParentFolderTrust(!0):await this.workspaceTrustRequestService.completeWorkspaceTrustRequest(!0)}},{label:o.label,run:()=>{this.updateWorkbenchIndicators(!1),this.workspaceTrustRequestService.cancelWorkspaceTrustRequest()}}],custom:{buttonDetails:[t.sublabel,o.sublabel],disableCloseAction:!0,icon:L.shield,markdownDetails:n.map(s=>({markdown:new he(s)}))}}),this.storageService.store(cBo,!0,1,1)}async showModalOnStart(){if(this.workspaceTrustManagementService.isWorkspaceTrusted()){this.updateWorkbenchIndicators(!0);return}if(this.workspaceTrustManagementService.canSetWorkspaceTrust()){if(R0(this.workspaceContextService.getWorkspace())){this.updateWorkbenchIndicators(!1);return}if(this.workspaceContextService.getWorkbenchState()===1){this.updateWorkbenchIndicators(!1);return}if(this.startupPromptSetting==="never"){this.updateWorkbenchIndicators(!1);return}if(this.startupPromptSetting==="once"&&this.storageService.getBoolean(cBo,1,!1)){this.updateWorkbenchIndicators(!1);return}this.workspaceTrustRequestService.requestWorkspaceTrustOnStartup()}}get startupPromptSetting(){return this.configurationService.getValue(XSi)}get useWorkspaceLanguage(){return!Pg(pf(this.workspaceContextService.getWorkspace()))}async isAiGeneratedWorkspace(){let e=A.joinPath(this.environmentService.workspaceStorageHome,"aiGeneratedWorkspaces.json");return await this.fileService.exists(e).then(async t=>{if(t)try{let o=await this.fileService.readFile(e);if(JSON.parse(o.value.toString()).indexOf(this.workspaceContextService.getWorkspace().folders[0].uri.toString())>-1)return!0}catch{}return!1})}getBannerItem(e){let t=this.storageService.getBoolean(dBo,1,!1);if(this.bannerSetting==="never"||this.bannerSetting==="untilDismissed"&&t)return;let o=[{label:d(18255,null),href:"command:"+ej},{label:d(18254,null),href:"https://aka.ms/vscode-workspace-trust"}];return{id:lBo,icon:E$i,ariaLabel:this.getBannerItemAriaLabels(),message:this.getBannerItemMessages(),actions:o,onClose:()=>{e&&this.storageService.store(dBo,!0,1,1)}}}getBannerItemAriaLabels(){switch(this.workspaceContextService.getWorkbenchState()){case 1:return d(18252,null);case 2:return d(18251,null);case 3:return d(18253,null)}}getBannerItemMessages(){switch(this.workspaceContextService.getWorkbenchState()){case 1:return d(18257,null);case 2:return d(18256,null);case 3:return d(18258,null)}}get bannerSetting(){let e=this.configurationService.getValue(JSi);return e!=="always"&&Ft&&!this.remoteAgentService.getConnection()?.remoteAuthority?"never":e}getRestrictedModeStatusbarEntry(){let e="",t;switch(this.workspaceContextService.getWorkbenchState()){case 1:{e=d(18263,null),t={value:d(18266,null,`command:${zH}`,`command:${ej}`),isTrusted:!0,supportThemeIcons:!0};break}case 2:{e=d(18262,null),t={value:d(18265,null,`command:${zH}`,`command:${ej}`),isTrusted:!0,supportThemeIcons:!0};break}case 3:{e=d(18264,null),t={value:d(18267,null,`command:${zH}`,`command:${ej}`),isTrusted:!0,supportThemeIcons:!0};break}}return{name:d(18268,null),text:`$(shield) ${d(18273,null)}`,ariaLabel:e,tooltip:t,command:ej,kind:"prominent"}}updateStatusbarEntry(e){if(e&&this.statusbarEntryAccessor.value){this.statusbarEntryAccessor.clear();return}if(!e&&!this.statusbarEntryAccessor.value){let t=this.getRestrictedModeStatusbarEntry();this.statusbarEntryAccessor.value=this.statusbarService.addEntry(t,this.entryId,0,{location:{id:"status.host",priority:Number.POSITIVE_INFINITY},alignment:1})}}};_ht=I([m(0,ct),m(1,Ae),m(2,yM),m(3,Or),m(4,B),m(5,Fr),m(6,de),m(7,lp),m(8,LR),m(9,nt),m(10,ti),m(11,Ze),m(12,bo),m(13,Mt),m(14,ge)],_ht);bt(Oqe.ID,Oqe,vt.BlockRestore);oe.as(Zi.Workbench).registerWorkbenchContribution(_ht,3);var T$i=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return i.createInstance(VIe)}};oe.as(en.EditorFactory).registerEditorSerializer(VIe.ID,T$i);oe.as(en.EditorPane).registerEditorPane(os.create(hj,hj.ID,d(18291,null)),[new Vt(VIe)]);var QLn="workbench.trust.configure",uBo=P(18288,"Workspaces");W(class extends z{constructor(){super({id:QLn,title:P(18227,"Configure Workspace Trust Settings"),precondition:C.and(Z$.IsEnabled,C.equals(`config.${gXe}`,!0)),category:uBo,f1:!0})}run(a){a.get(Qo).openUserSettings({jsonEditor:!1,query:`@tag:${fQ}`})}});W(class extends z{constructor(){super({id:ej,title:P(18237,"Manage Workspace Trust"),precondition:C.and(Z$.IsEnabled,C.equals(`config.${gXe}`,!0)),category:uBo,f1:!0})}run(a){let i=a.get(ie),t=a.get(F).createInstance(VIe);i.openEditor(t,{pinned:!0})}});oe.as($t.Configuration).registerConfiguration({...tJe,properties:{[gXe]:{type:"boolean",default:!0,description:d(18278,null),tags:[fQ],scope:1},[XSi]:{type:"string",default:"once",description:d(18281,null),tags:[fQ],scope:1,enum:["always","once","never"],enumDescriptions:[d(18280,null),d(18283,null),d(18282,null)]},[JSi]:{type:"string",default:"untilDismissed",description:d(18275,null),tags:[fQ],scope:1,enum:["always","untilDismissed","never"],enumDescriptions:[d(18274,null),d(18277,null),d(18276,null)]},[hXe]:{type:"string",default:"prompt",markdownDescription:d(18284,null,mAt),tags:[fQ],scope:1,enum:["prompt","open","newWindow"],enumDescriptions:[d(18287,null),d(18286,null),d(18285,null)]},[mAt]:{type:"boolean",default:!0,markdownDescription:d(18279,null,hXe),tags:[fQ],scope:1}}});var Dht=class extends k{constructor(e,t,o,n,r){super();this.environmentService=e;this.telemetryService=t;this.workspaceContextService=o;this.workspaceTrustEnablementService=n;this.workspaceTrustManagementService=r;this.workspaceTrustManagementService.workspaceTrustInitialized.then(()=>{this.logInitialWorkspaceTrustInfo(),this.logWorkspaceTrust(this.workspaceTrustManagementService.isWorkspaceTrusted()),this._register(this.workspaceTrustManagementService.onDidChangeTrust(s=>this.logWorkspaceTrust(s)))})}logInitialWorkspaceTrustInfo(){if(!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()){let e=this.environmentService.disableWorkspaceTrust;this.telemetryService.publicLog2("workspaceTrustDisabled",{reason:e?"cli":"setting"});return}this.telemetryService.publicLog2("workspaceTrustFolderCounts",{trustedFoldersCount:this.workspaceTrustManagementService.getTrustedUris().length})}async logWorkspaceTrust(e){if(this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()&&(this.telemetryService.publicLog2("workspaceTrustStateChanged",{workspaceId:this.workspaceContextService.getWorkspace().id,isTrusted:e}),e)){let t=o=>{let n=uA(o),r=0;for(;yd(n)!==n&&r<100;)n=yd(n),r++;return r};for(let o of this.workspaceContextService.getWorkspace().folders){let{trusted:n,uri:r}=await this.workspaceTrustManagementService.getUriTrustInfo(o.uri);if(!n)continue;let s=t(o.uri.fsPath),l=t(r.fsPath),c=s-l;this.telemetryService.publicLog2("workspaceFolderDepthBelowTrustedFolder",{workspaceFolderDepth:s,trustedFolderDepth:l,delta:c})}}}};Dht=I([m(0,Mt),m(1,_e),m(2,Ae),m(3,yM),m(4,Or)],Dht);oe.as(Zi.Workbench).registerWorkbenchContribution(Dht,3);var Rht=class extends k{constructor(e,t,o,n,r,s){super();this.contextService=e;this.notificationService=t;this.fileService=o;this.quickInputService=n;this.hostService=r;this.storageService=s;this.findWorkspaces()}async findWorkspaces(){let e=this.contextService.getWorkspace().folders[0];if(!e||this.contextService.getWorkbenchState()!==2||R0(this.contextService.getWorkspace()))return;let t=(await this.fileService.resolve(e.uri)).children?.map(o=>o.name);if(Array.isArray(t)){let o=t.filter(jF);o.length>0&&this.doHandleWorkspaceFiles(e.uri,o)}}doHandleWorkspaceFiles(e,t){let o={id:"workspaces.dontPromptToOpen",scope:0,isSecondary:!0};if(t.length===1){let n=t[0];this.notificationService.prompt(ft.Info,d(18354,null,n,"https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:d(18356,null),run:()=>this.hostService.openWindow([{workspaceUri:Ve(e,n)}])}],{neverShowAgain:o,priority:this.storageService.isNew(1)?1:2})}else t.length>1&&this.notificationService.prompt(ft.Info,d(18355,null,"https://go.microsoft.com/fwlink/?linkid=2025315"),[{label:d(18359,null),run:()=>{this.quickInputService.pick(t.map(n=>({label:n})),{placeHolder:d(18358,null)}).then(n=>{n&&this.hostService.openWindow([{workspaceUri:Ve(e,n.label)}])})}}],{neverShowAgain:o,priority:this.storageService.isNew(1)?1:2})}};Rht=I([m(0,Ae),m(1,Ne),m(2,ge),m(3,$e),m(4,ti),m(5,de)],Rht);oe.as(Zi.Workbench).registerWorkbenchContribution(Rht,4);W(class extends z{constructor(){super({id:"workbench.action.openWorkspaceFromEditor",title:P(18357,"Open Workspace"),f1:!1,menu:{id:R.EditorContent,when:C.and(Ho.Extension.isEqualTo(kQe),Tr.isEqualTo(EW),HMt.toNegated(),qo.toNegated())}})}async run(a,i){let e=a.get(ti),t=a.get(Ae),o=a.get(Ne);if(t.getWorkbenchState()===3){let n=t.getWorkspace().configuration;if(n&&ze(n,i)){o.info(d(18353,null));return}}return e.openWindow([{workspaceUri:i}])}});var Fqe=class extends k{constructor(e,t){super();this._table=e;this._quickInputService=t}async show(){let e=[];this._table.getColumnLabels().forEach((r,s)=>{r&&e.push({label:r,index:s})});let t=await this._quickInputService.pick(e,{placeHolder:d(12631,null)});if(!t)return;let o=await this._quickInputService.input({placeHolder:d(12629,null),prompt:d(12630,null,t.label),validateInput:r=>this._validateColumnResizeValue(r)}),n=o?Number.parseInt(o):void 0;n&&this._table.resizeColumn(t.index,n)}async _validateColumnResizeValue(e){let t=Number.parseInt(e);return e&&!Number.isInteger(t)?d(12628,null):t<0||t>100?d(12627,null):null}};Fqe=I([m(1,$e)],Fqe);var cJt=class extends z{constructor(){super({id:"list.resizeColumn",title:{value:d(12626,null),original:"Resize Column"},category:{value:d(12625,null),original:"List"},precondition:Nc,f1:!0})}async run(i){let e=i.get(Co),t=i.get(F),o=e.lastFocusedList;o instanceof s0&&await t.createInstance(Fqe,o).show()}};var Wqe=class{static{this.ID="workbench.contrib.listContext"}constructor(i){i.createKey("listSupportsTypeNavigation",!0),i.createKey("listSupportsKeyboardNavigation",!0)}};Wqe=I([m(0,X)],Wqe);bt(Wqe.ID,Wqe,vt.BlockStartup);W(cJt);var Vqe=class extends k{constructor(e,t){super();this.accessibilitySignalService=t;let o=vi(this,t.onSoundEnabledChanged(tn.onDebugBreak),()=>t.isSoundEnabled(tn.onDebugBreak));this._register(Rl((n,r)=>{if(!o.read(n))return;let s=new Map;r.add(ee(()=>{s.forEach(l=>l.dispose()),s.clear()})),r.add(e.onDidNewSession(l=>s.set(l,this.handleSession(l)))),r.add(e.onDidEndSession(({session:l})=>{s.get(l)?.dispose(),s.delete(l)})),e.getModel().getSessions().forEach(l=>s.set(l,this.handleSession(l)))}))}handleSession(e){return e.onDidChangeState(t=>{let o=e.getStoppedDetails();o&&o.reason==="breakpoint"&&this.accessibilitySignalService.playSignal(tn.onDebugBreak)})}};Vqe=I([m(0,Hi),m(1,br)],Vqe);var dJt=class a extends z{static{this.ID="signals.sounds.help"}constructor(){super({id:a.ID,title:P(5933,"Help: List Signal Sounds"),f1:!0,metadata:{description:d(5929,null)}})}async run(i){let e=i.get(br),t=i.get($e),o=i.get(B),n=i.get(Ai),r=i.get(Qo),s=[tn.save,tn.format],l=tn.allAccessibilitySignals.map((p,h)=>({label:s.includes(p)?`${p.name} (${o.getValue(p.settingsKey+".sound")})`:p.name,signal:p,buttons:s.includes(p)?[{iconClass:q.asClassName(L.settingsGear),tooltip:d(5935,null),alwaysVisible:!0}]:[]})).sort((p,h)=>p.label.localeCompare(h.label)),c=new O,u=c.add(t.createQuickPick());u.items=l,u.selectedItems=l.filter(p=>e.isSoundEnabled(p.signal)||s.includes(p.signal)&&o.getValue(p.signal.settingsKey+".sound")!=="never"),c.add(u.onDidAccept(()=>{let p=u.selectedItems.map(g=>g.signal),h=u.items.map(g=>g.signal).filter(g=>!p.includes(g));for(let g of p){let{sound:f,announcement:v}=o.getValue(g.settingsKey);f=s.includes(g)?"userGesture":n.isScreenReaderOptimized()?"auto":"on",v?o.updateValue(g.settingsKey,{sound:f,announcement:v}):o.updateValue(g.settingsKey,{sound:f})}for(let g of h){let f=o.getValue(g.settingsKey+".announcement"),v=pBo(s.includes(g),n.isScreenReaderOptimized()),b=f?{sound:v,announcement:f}:{sound:v};o.updateValue(g.settingsKey,b)}u.hide()})),c.add(u.onDidTriggerItemButton(p=>{r.openUserSettings({jsonEditor:!0,revealSetting:{key:p.item.signal.settingsKey,edit:!0}})})),c.add(u.onDidChangeActive(()=>{e.playSound(u.activeItems[0].signal.sound.getSound(!0),!0,SJi)})),c.add(u.onDidHide(()=>c.dispose())),u.placeholder=d(5934,null),u.canSelectMany=!0,await u.show()}};function pBo(a,i){return i?a?"never":"off":a?"never":"auto"}var uJt=class a extends z{static{this.ID="accessibility.announcement.help"}constructor(){super({id:a.ID,title:P(5927,"Help: List Signal Announcements"),f1:!0,metadata:{description:d(5928,null)}})}async run(i){let e=i.get(br),t=i.get($e),o=i.get(B),n=i.get(Ai),r=i.get(Qo),s=[tn.save,tn.format],l=tn.allAccessibilitySignals.filter(h=>!!h.legacyAnnouncementSettingsKey).map((h,g)=>({label:s.includes(h)?`${h.name} (${o.getValue(h.settingsKey+".announcement")})`:h.name,signal:h,buttons:s.includes(h)?[{iconClass:q.asClassName(L.settingsGear),tooltip:d(5932,null),alwaysVisible:!0}]:[]})).sort((h,g)=>h.label.localeCompare(g.label)),c=new O,u=c.add(t.createQuickPick());u.items=l,u.selectedItems=l.filter(h=>e.isAnnouncementEnabled(h.signal)||s.includes(h.signal)&&o.getValue(h.signal.settingsKey+".announcement")!=="never");let p=n.isScreenReaderOptimized();c.add(u.onDidAccept(()=>{if(!p){u.hide();return}let h=u.selectedItems.map(f=>f.signal),g=tn.allAccessibilitySignals.filter(f=>!!f.legacyAnnouncementSettingsKey&&!h.includes(f));for(let f of h){let{sound:v,announcement:b}=o.getValue(f.settingsKey);b=s.includes(f)?"userGesture":f.announcementMessage&&n.isScreenReaderOptimized()?"auto":void 0,o.updateValue(f.settingsKey,{sound:v,announcement:b})}for(let f of g){let v=pBo(s.includes(f),!0),b=o.getValue(f.settingsKey+".sound"),S=v?{sound:b,announcement:v}:{sound:b};o.updateValue(f.settingsKey,S)}u.hide()})),c.add(u.onDidTriggerItemButton(h=>{r.openUserSettings({jsonEditor:!0,revealSetting:{key:h.item.signal.settingsKey,edit:!0}})})),c.add(u.onDidHide(()=>c.dispose())),u.placeholder=p?d(5930,null):d(5931,null),u.canSelectMany=!0,await u.show()}};var Bqe=class extends k{constructor(e,t,o){super();this._editorService=e;this._instantiationService=t;this._accessibilitySignalService=o;this._textProperties=[this._instantiationService.createInstance(Hqe,tn.errorAtPosition,tn.errorOnLine,8),this._instantiationService.createInstance(Hqe,tn.warningAtPosition,tn.warningOnLine,4),this._instantiationService.createInstance(_$i),this._instantiationService.createInstance(Lht)],this._someAccessibilitySignalIsEnabled=ke(this,n=>this._textProperties.flatMap(r=>[r.lineSignal,r.positionSignal]).filter(so).some(r=>qle(this,this._accessibilitySignalService.getEnabledState(r,!1)).read(n))),this._activeEditorObservable=vi(this,this._editorService.onDidActiveEditorChange,n=>{let r=this._editorService.activeTextEditorControl,s=Lc(r)?r.getOriginalEditor():fn(r)?r:void 0;return s&&s.hasModel()?{editor:s,model:s.getModel()}:void 0}),this._register(Rl((n,r)=>{if(!this._someAccessibilitySignalIsEnabled.read(n))return;let s=this._activeEditorObservable.read(n);s&&this._registerAccessibilitySignalsForEditor(s.editor,s.model,r)}))}_registerAccessibilitySignalsForEditor(e,t,o){let n=-1,r=new Set,s=o.add(new O),l=this._textProperties.map(u=>({source:u.createSource(e,t),property:u})),c=loi(e.onDidChangeModelContent,100,o);o.add(e.onDidChangeCursorPosition(u=>{if(s.clear(),u&&u.reason!==3&&u.reason!==0){r.clear();return}let p=(f,v,b)=>{let S=b==="line"?f.lineSignal:f.positionSignal;if(!(!S||!this._accessibilitySignalService.getEnabledState(S,!1).value||!v.isPresent(h,b,void 0))){for(let y of["sound","announcement"])if(this._accessibilitySignalService.getEnabledState(S,!1,y).value){let w=this._accessibilitySignalService.getDelayMs(S,y,b)+(c.get()?1e3:0);s.add(Zo(()=>{v.isPresent(h,b,void 0)&&((b!=="line"||!r.has(f))&&this._accessibilitySignalService.playSignal(S,{modality:y}),r.add(f))},w))}}},h=u.position,g=h.lineNumber;if(g!==n){r.clear(),n=g;for(let f of l)p(f.property,f.source,"line")}for(let f of l)p(f.property,f.source,"positional");for(let f of l){if(![f.property.lineSignal,f.property.positionSignal].some(S=>S&&this._accessibilitySignalService.getEnabledState(S,!1).value))return;let v,b;s.add(ve(S=>{let y=f.source.isPresentAtPosition(u.position,S),w=f.source.isPresentOnLine(u.position.lineNumber,S);v!==void 0&&v!==void 0&&(!v&&y&&p(f.property,f.source,"positional"),!b&&w&&p(f.property,f.source,"line")),v=y,b=w}))}}))}};Bqe=I([m(0,ie),m(1,F),m(2,br)],Bqe);var Uqe=class a{static{this.notPresent=new a({isPresentAtPosition:()=>!1,isPresentOnLine:()=>!1})}constructor(i){this.isPresentOnLine=i.isPresentOnLine,this.isPresentAtPosition=i.isPresentAtPosition??(()=>!1)}isPresent(i,e,t){return e==="line"?this.isPresentOnLine(i.lineNumber,t):this.isPresentAtPosition(i,t)}},Hqe=class{constructor(i,e,t,o){this.positionSignal=i;this.lineSignal=e;this.severity=t;this.markerService=o;this.debounceWhileTyping=!0}createSource(i,e){let t=qr("onMarkerChanged",this.markerService.onMarkerChanged);return new Uqe({isPresentAtPosition:(o,n)=>(t.read(n),this.markerService.read({resource:e.uri}).some(s=>s.severity===this.severity&&s.startLineNumber<=o.lineNumber&&o.lineNumber<=s.endLineNumber&&s.startColumn<=o.column&&o.column<=s.endColumn)),isPresentOnLine:(o,n)=>(t.read(n),this.markerService.read({resource:e.uri}).some(s=>s.severity===this.severity&&s.startLineNumber<=o&&o<=s.endLineNumber))})}};Hqe=I([m(3,ha)],Hqe);var _$i=class{constructor(){this.lineSignal=tn.foldedArea}createSource(i,e){let t=$f.get(i);if(!t)return Uqe.notPresent;let o=x4e(t.getFoldingModel()??Promise.resolve(void 0));return new Uqe({isPresentOnLine(n,r){let l=o.read(r).value?.getRegionAtLine(n);return l?l.isCollapsed&&l.startLineNumber===n:!1}})}},Lht=class{constructor(i){this.debugService=i;this.lineSignal=tn.break}createSource(i,e){let t=qr("onDidChangeBreakpoints",this.debugService.getModel().onDidChangeBreakpoints),o=this.debugService;return new Uqe({isPresentOnLine(n,r){return t.read(r),o.getModel().getBreakpoints({uri:e.uri,lineNumber:n}).length>0}})}};Lht=I([m(0,Hi)],Lht);Ce(br,cke,1);bt("EditorTextPropertySignalsContribution",sno(()=>Bqe),vt.AfterRestored);bt("AccessibilitySignalLineDebuggerContribution",Vqe,vt.AfterRestored);W(dJt);W(uJt);var Mht=class{constructor(i,e,t){this.configurationService=i;this.extensionsWorkbenchService=e;this.telemetryService=t;this.init().catch(mt)}async init(){let i="coenraads.bracket-pair-colorizer-2";await this.extensionsWorkbenchService.queryLocal();let e=this.extensionsWorkbenchService.installed.find(n=>n.identifier.id===i);if(!e||e.enablementState!==12&&e.enablementState!==13)return;let o=!!this.configurationService.getValue("editor.bracketPairColorization.enabled");this.telemetryService.publicLog2("bracketPairColorizerTwoUsage",{nativeColorizationEnabled:o})}};Mht=I([m(0,B),m(1,Ui),m(2,_e)],Mht);oe.as(Zi.Workbench).registerWorkbenchContribution(Mht,3);var zqe=class extends k{constructor(e){super();this._styleElementDisposables=void 0;this._register(ee(()=>this._removeStyleElement())),this._register(U.runAndSubscribe(e.onDidChangeConfiguration,t=>{if(t&&!t.affectsConfiguration("accessibility.dimUnfocused.enabled")&&!t.affectsConfiguration("accessibility.dimUnfocused.opacity"))return;let o="";if(YLn(e.getValue("accessibility.dimUnfocused.enabled"),!1)){let r=jn(XLn(e.getValue("accessibility.dimUnfocused.opacity"),.75),.2,1);if(r!==1){let s=new Set,l=`filter: opacity(${r});`;s.add(`.monaco-workbench .pane-body.integrated-terminal:not(:focus-within) .tabs-container { ${l} }`),s.add(`.monaco-workbench .pane-body.integrated-terminal .terminal-wrapper:not(:focus-within) { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .breadcrumbs-below-tabs { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .terminal-wrapper { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .settings-editor { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .keybindings-editor { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .monaco-editor-pane-placeholder { ${l} }`),s.add(`.monaco-workbench .editor-instance:not(:focus-within) .gettingStartedContainer { ${l} }`),o=[...s].join(`
`)}}o.length===0?this._removeStyleElement():this._getStyleElement().textContent=o}))}_getStyleElement(){return this._styleElement||(this._styleElementDisposables=new O,this._styleElement=Pr(void 0,void 0,this._styleElementDisposables),this._styleElement.className="accessibilityUnfocusedViewOpacity"),this._styleElement}_removeStyleElement(){this._styleElementDisposables?.dispose(),this._styleElementDisposables=void 0,this._styleElement=void 0}};zqe=I([m(0,B)],zqe);function YLn(a,i){return typeof a=="boolean"?a:i}function XLn(a,i){return typeof a=="number"?a:i}var BIe=class extends k{constructor(e,t,o,n,r){super();this.configurationService=e;this.notificationService=t;this.accessibilityService=o;this.statusbarService=n;this.openerService=r;this.screenReaderNotification=null;this.promptedScreenReader=!1;this.screenReaderModeElement=this._register(new ue);this._register(Ge.registerCommand({id:"showEditorScreenReaderNotification",handler:()=>this.showScreenReaderNotification()})),this.updateScreenReaderModeElement(this.accessibilityService.isScreenReaderOptimized()),this.registerListeners()}static{this.ID="workbench.contrib.accessibilityStatus"}registerListeners(){this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(()=>this.onScreenReaderModeChange())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("editor.accessibilitySupport")&&this.onScreenReaderModeChange()}))}showScreenReaderNotification(){this.screenReaderNotification=this.notificationService.prompt(wt.Info,d(5884,null,"editor.accessibilitySupport"),[{label:d(5883,null),run:()=>{this.configurationService.updateValue("editor.accessibilitySupport","on",2)}},{label:d(5882,null),run:()=>{this.configurationService.updateValue("editor.accessibilitySupport","off",2)}},{label:d(5881,null),run:()=>{this.openerService.open("https://code.visualstudio.com/docs/editor/accessibility#_screen-readers")}}],{sticky:!0,priority:3}),U.once(this.screenReaderNotification.onDidClose)(()=>this.screenReaderNotification=null)}updateScreenReaderModeElement(e){if(e){if(!this.screenReaderModeElement.value){let t=d(5880,null);this.screenReaderModeElement.value=this.statusbarService.addEntry({name:d(5885,null),text:t,ariaLabel:t,command:"showEditorScreenReaderNotification",kind:"prominent",showInAllWindows:!0},"status.editor.screenReaderMode",1,100.6)}}else this.screenReaderModeElement.clear()}onScreenReaderModeChange(){this.accessibilityService.isScreenReaderOptimized()&&this.configurationService.getValue("editor.accessibilitySupport")==="auto"&&(this.promptedScreenReader||(this.promptedScreenReader=!0,setTimeout(()=>this.showScreenReaderNotification(),100))),this.screenReaderNotification&&this.screenReaderNotification.close(),this.updateScreenReaderModeElement(this.accessibilityService.isScreenReaderOptimized())}};BIe=I([m(0,B),m(1,Ne),m(2,Ai),m(3,Fr),m(4,Je)],BIe);var HIe=class extends k{constructor(e,t){super();this._accessibilitySignalService=e;this._workingCopyService=t;this._register(this._workingCopyService.onDidSave(o=>this._accessibilitySignalService.playSignal(tn.save,{userGesture:o.reason===1})))}static{this.ID="workbench.contrib.saveAccessibilitySignal"}};HIe=I([m(0,br),m(1,$a)],HIe);var UIe=class extends k{constructor(e,t,o){super();this._editorService=e;this._accessibilityService=t;this._configurationService=o;this._register(U.runAndSubscribe(t.onDidChangeScreenReaderOptimized,()=>this._updateListener())),this._register(o.onDidChangeConfiguration(n=>{n.affectsConfiguration("accessibility.verbosity.diffEditorActive")&&this._updateListener()}))}static{this.ID="workbench.contrib.diffEditorActiveAnnouncement"}_updateListener(){let e=this._configurationService.getValue("accessibility.verbosity.diffEditorActive"),t=this._accessibilityService.isScreenReaderOptimized();if(!e||!t){this._onDidActiveEditorChangeListener?.dispose(),this._onDidActiveEditorChangeListener=void 0;return}this._onDidActiveEditorChangeListener||(this._onDidActiveEditorChangeListener=this._register(this._editorService.onDidActiveEditorChange(()=>{Lc(this._editorService.activeTextEditorControl)&&this._accessibilityService.alert(d(5936,null))})))}};UIe=I([m(0,ie),m(1,Ai),m(2,B)],UIe);var zIe=class extends k{constructor(e,t){super();this._accessibilitySignalService=e;this._speechService=t;this._register(this._speechService.onDidStartSpeechToTextSession(()=>this._accessibilitySignalService.playSignal(tn.voiceRecordingStarted))),this._register(this._speechService.onDidEndSpeechToTextSession(()=>this._accessibilitySignalService.playSignal(tn.voiceRecordingStopped)))}static{this.ID="workbench.contrib.speechAccessibilitySignal"}};zIe=I([m(0,br),m(1,Gx)],zIe);function mBo(a,i){if(!i)return;let e=[],t=[],o=i.matchAll(/(\<keybinding:(?<commandId>[^\<]*)\>)/gm);for(let r of[...o]){let s=r?.groups?.commandId,l;if(r?.length&&s){let c=a.lookupKeybinding(s)?.getAriaLabel();c?(l=" ("+c+")",t.push({label:s,id:s})):(l=" (unassigned keybinding)",e.push({label:s,id:s})),i=i.replace(r[0],l)}}let n=new he(i);return n.isTrusted=!0,{content:n,configureKeybindingItems:e.length?e:void 0,configuredKeybindingItems:t.length?t:void 0}}var Pht=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._openerService=e;this._instantiationService=t;this._configurationService=o;this._modelService=n;this._contextViewService=r;this._contextKeyService=s;this._accessibilityService=l;this._keybindingService=c;this._layoutService=u;this._menuService=p;this._commandService=h;this._codeBlockContextProviderService=g;this._storageService=f;this._quickInputService=v;this._accessibilitySignalService=b;this._isInQuickPick=!1;this._lastProviderPosition=new Map;this._accessiblityHelpIsShown=jx.bindTo(this._contextKeyService),this._accessibleViewIsShown=Jd.bindTo(this._contextKeyService),this._accessibleViewSupportsNavigation=Hme.bindTo(this._contextKeyService),this._accessibleViewVerbosityEnabled=NZe.bindTo(this._contextKeyService),this._accessibleViewGoToSymbolSupported=OZe.bindTo(this._contextKeyService),this._accessibleViewCurrentProviderId=Fu.bindTo(this._contextKeyService),this._accessibleViewInCodeBlock=fLe.bindTo(this._contextKeyService),this._accessibleViewContainsCodeBlocks=Ume.bindTo(this._contextKeyService),this._onLastLine=GFt.bindTo(this._contextKeyService),this._hasUnassignedKeybindings=FZe.bindTo(this._contextKeyService),this._hasAssignedKeybindings=WZe.bindTo(this._contextKeyService),this._container=document.createElement("div"),this._container.classList.add("accessible-view"),this._configurationService.getValue("accessibility.hideAccessibleView")&&this._container.classList.add("hide");let S={contributions:ml.getEditorContributions().filter(M=>M.id!==Rm.ID&&M.id!==Cie.ID&&M.id!==fH.ID)},y=document.createElement("div");y.classList.add("accessible-view-title-bar"),this._title=document.createElement("div"),this._title.classList.add("accessible-view-title"),y.appendChild(this._title);let w=document.createElement("div");w.classList.add("accessible-view-action-bar"),y.appendChild(w),this._container.appendChild(y),this._toolbar=this._register(t.createInstance(dl,w,{orientation:0})),this._toolbar.context={viewId:"accessibleView"};let x=this._toolbar.getElement();x.tabIndex=0;let E={...ay(this._configurationService),lineDecorationsWidth:6,dragAndDrop:!1,cursorWidth:1,wordWrap:"off",wrappingStrategy:"advanced",wrappingIndent:"none",padding:{top:2,bottom:2},quickSuggestions:!1,renderWhitespace:"none",dropIntoEditor:{enabled:!1},readOnly:!0,fontFamily:"var(--monaco-monospace-font)"};this._editorWidget=this._register(this._instantiationService.createInstance(us,this._container,E,S)),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>{this._currentProvider&&this._accessiblityHelpIsShown.get()&&this.show(this._currentProvider)})),this._register(this._configurationService.onDidChangeConfiguration(M=>{CDt(this._currentProvider)&&M.affectsConfiguration(this._currentProvider.verbositySettingKey)&&(this._accessiblityHelpIsShown.get()&&this.show(this._currentProvider),this._accessibleViewVerbosityEnabled.set(this._configurationService.getValue(this._currentProvider.verbositySettingKey)),this._updateToolbar(this._currentProvider.actions,this._currentProvider.options.type)),M.affectsConfiguration("accessibility.hideAccessibleView")&&this._container.classList.toggle("hide",this._configurationService.getValue("accessibility.hideAccessibleView"))})),this._register(this._editorWidget.onDidDispose(()=>this._resetContextKeys())),this._register(this._editorWidget.onDidChangeCursorPosition(()=>{this._onLastLine.set(this._editorWidget.getPosition()?.lineNumber===this._editorWidget.getModel()?.getLineCount());let M=this._editorWidget.getPosition()?.lineNumber;if(this._codeBlocks&&M!==void 0){let N=this._codeBlocks.find(V=>V.startLine<=M&&V.endLine>=M)!==void 0;this._accessibleViewInCodeBlock.set(N)}this._playDiffSignals()}))}get editorWidget(){return this._editorWidget}_playDiffSignals(){if(this._currentProvider?.id!=="diffEditor"&&this._currentProvider?.id!=="inlineCompletions")return;let e=this._editorWidget.getPosition(),t=this._editorWidget.getModel();if(!e||!t)return;let o=t.getLineContent(e.lineNumber);o?.startsWith("+")?this._accessibilitySignalService.playSignal(tn.diffLineInserted):o?.startsWith("-")&&this._accessibilitySignalService.playSignal(tn.diffLineDeleted)}_resetContextKeys(){this._accessiblityHelpIsShown.reset(),this._accessibleViewIsShown.reset(),this._accessibleViewSupportsNavigation.reset(),this._accessibleViewVerbosityEnabled.reset(),this._accessibleViewGoToSymbolSupported.reset(),this._accessibleViewCurrentProviderId.reset(),this._hasAssignedKeybindings.reset(),this._hasUnassignedKeybindings.reset()}getPosition(e){if(!(!e||!this._lastProvider||this._lastProvider.id!==e))return this._editorWidget.getPosition()||void 0}setPosition(e,t,o){if(this._editorWidget.setPosition(e),t&&this._editorWidget.revealPosition(e),o){let n=this._editorWidget.getModel()?.getLineLength(e.lineNumber)??0;n&&this._editorWidget.setSelection({startLineNumber:e.lineNumber,startColumn:1,endLineNumber:e.lineNumber,endColumn:n+1})}}getCodeBlockContext(){let e=this._editorWidget.getPosition();if(!this._codeBlocks?.length||!e)return;let t=this._codeBlocks?.findIndex(n=>n.startLine<=e?.lineNumber&&n.endLine>=e?.lineNumber),o=t!==void 0&&t>-1?this._codeBlocks[t]:void 0;if(!(!o||t===void 0))return{code:o.code,languageId:o.languageId,codeBlockIndex:t,element:void 0,chatSessionResource:o.chatSessionResource}}navigateToCodeBlock(e){let t=this._editorWidget.getPosition();if(!this._codeBlocks?.length||!t)return;let o,n=this._codeBlocks.slice();e==="previous"?o=n.reverse().find(r=>r.endLine<t.lineNumber):o=n.find(r=>r.startLine>t.lineNumber),o&&this.setPosition(new ye(o.startLine,1),!0)}showLastProvider(e){!this._lastProvider||this._lastProvider.options.id!==e||this.show(this._lastProvider)}show(e,t,o,n){if(e=e??this._currentProvider,!e)return;e.onOpen?.();let r={getAnchor:()=>({x:zi().innerWidth/2-Math.min(this._layoutService.activeContainerDimension.width*.75,900)/2,y:this._layoutService.activeContainerOffset.quickPickTop}),render:s=>(this._viewContainer=s,this._viewContainer.classList.add("accessible-view-container"),this._render(e,s,o)),onHide:()=>{if(!o){if(this._updateLastProvider(),this._currentProvider){let s=this._editorWidget.getPosition();s&&this._lastProviderPosition.set(this._currentProvider.id,s)}this._currentProvider?.dispose(),this._currentProvider=void 0,this._resetContextKeys()}}};this._contextViewService.showContextView(r),n&&queueMicrotask(()=>{this._editorWidget.revealLine(n.lineNumber),this._editorWidget.setSelection({startLineNumber:n.lineNumber,startColumn:n.column,endLineNumber:n.lineNumber,endColumn:n.column})}),t&&this._currentProvider&&this.showSymbol(this._currentProvider,t),e instanceof qp&&e.onDidRequestClearLastProvider&&this._register(e.onDidRequestClearLastProvider(s=>{this._lastProvider?.options.id===s&&(this._lastProvider=void 0),this._lastProviderPosition.delete(s)})),e.options.id&&(this._lastProvider=e),(e.id==="panelChat"||e.id==="quickChat")&&this._register(this._codeBlockContextProviderService.registerProvider({getCodeBlockContext:()=>this.getCodeBlockContext()},"accessibleView")),e instanceof KJ&&this._storageService.store(`${$4e}${e.id}`,!0,-1,0),e.onDidChangeContent&&this._register(e.onDidChangeContent(()=>{this._viewContainer&&this._render(e,this._viewContainer,o)}))}previous(){let e=this._currentProvider?.providePreviousContent?.();!this._currentProvider||!this._viewContainer||!e||this._render(this._currentProvider,this._viewContainer,void 0,e)}next(){let e=this._currentProvider?.provideNextContent?.();!this._currentProvider||!this._viewContainer||!e||this._render(this._currentProvider,this._viewContainer,void 0,e)}_verbosityEnabled(){return this._currentProvider?CDt(this._currentProvider)?this._configurationService.getValue(this._currentProvider.verbositySettingKey)===!0:this._storageService.getBoolean(`${$4e}${this._currentProvider.id}`,-1,!1):!1}goToSymbol(){this._currentProvider&&(this._isInQuickPick=!0,this._instantiationService.createInstance(Aht,this).show(this._currentProvider))}calculateCodeBlocks(e){if(!e||this._currentProvider?.id!=="panelChat"&&this._currentProvider?.id!=="quickChat"||this._currentProvider.options.language&&this._currentProvider.options.language!=="markdown")return;let t=e.split(`
`);this._codeBlocks=[];let o=!1,n=0,r;t.forEach((s,l)=>{if(!o&&s.startsWith("```"))o=!0,n=l+1,r=s.substring(3).trim();else if(o&&s.endsWith("```")){o=!1;let c=l,u=t.slice(n,c).join(`
`);this._codeBlocks?.push({startLine:n,endLine:c,code:u,languageId:r,chatSessionResource:void 0})}}),this._accessibleViewContainsCodeBlocks.set(this._codeBlocks.length>0)}getSymbols(){let e=this._currentProvider?this._currentProvider:void 0;if(!this._currentContent||!e)return;let t="getSymbols"in e?e.getSymbols?.()||[]:[];if(t?.length)return t;if(e.options.language&&e.options.language!=="markdown")return;let o=zl.lexer(this._currentContent);if(o)return this._convertTokensToSymbols(o,t),t.length?t:void 0}openHelpLink(){this._currentProvider?.options.readMoreUrl&&this._openerService.open(A.parse(this._currentProvider.options.readMoreUrl))}configureKeybindings(e){this._isInQuickPick=!0;let t=this._updateLastProvider(),o=e?t?.options?.configureKeybindingItems:t?.options?.configuredKeybindingItems;if(!o)return;let n=this._register(new O),r=n.add(this._quickInputService.createQuickPick());r.items=o,r.title=d(5908,null),r.placeholder=d(5911,null),r.show(),n.add(r.onDidAccept(async()=>{let s=r.selectedItems[0];s&&await this._commandService.executeCommand("workbench.action.openGlobalKeybindings",s.id),r.dispose()})),n.add(r.onDidHide(()=>{!r.selectedItems.length&&t&&this.show(t),n.dispose(),this._isInQuickPick=!1}))}_convertTokensToSymbols(e,t){let o;for(let n of e){let r;if("type"in n)switch(n.type){case"heading":case"paragraph":case"code":r=n.text;break;case"list":{let s=n.items[0];if(!s)break;o=`- ${s.text}`,r=n.items.map(l=>l.text).join(", ");break}}r&&(t.push({markdownToParse:r,label:d(5912,null,n.type,r),ariaLabel:d(5913,null,n.type,r),firstListItem:o}),o=void 0)}}showSymbol(e,t){if(!this._currentContent)return;let o=t.lineNumber,n=t.markdownToParse;if(!(o===void 0&&n===void 0)){if(o===void 0&&n){let r=this._currentContent.split(`
`).findIndex(s=>s.includes(n.split(`
`)[0])||t.firstListItem&&s.includes(t.firstListItem))??-1;r>=0&&(o=r+1)}o!==void 0&&(this._isInQuickPick=!1,this.show(e,void 0,void 0,{lineNumber:o,column:1}),this._updateContextKeys(e,!0))}}disableHint(){CDt(this._currentProvider)&&(this._configurationService.updateValue(this._currentProvider?.verbositySettingKey,!1),cn(d(5902,null,this._currentProvider.verbositySettingKey)))}_updateContextKeys(e,t){e.options.type==="help"?(this._accessiblityHelpIsShown.set(t),this._accessibleViewIsShown.reset()):(this._accessibleViewIsShown.set(t),this._accessiblityHelpIsShown.reset()),this._accessibleViewSupportsNavigation.set(e.provideNextContent!==void 0||e.providePreviousContent!==void 0),this._accessibleViewVerbosityEnabled.set(this._verbosityEnabled()),this._accessibleViewGoToSymbolSupported.set(this._goToSymbolsSupported()?this.getSymbols()?.length>0:!1)}_getStableUri(e){return A.from({path:`accessible-view-${e}`,scheme:Q.accessibleView})}_updateContent(e,t){let o=t??e.provideContent();if(e.options.type==="view"){this._currentContent=o,this._hasUnassignedKeybindings.reset(),this._hasAssignedKeybindings.reset();return}let n=this._readMoreHint(e),r=this._disableVerbosityHint(e),s=this._screenReaderModeHint(e),l=this._exitDialogHint(e),c="",u="",p=mBo(this._keybindingService,s+o+n+r+l);p&&(o=p.content.value,p.configureKeybindingItems?(e.options.configureKeybindingItems=p.configureKeybindingItems,this._hasUnassignedKeybindings.set(!0),c=this._configureUnassignedKbHint()):this._hasAssignedKeybindings.reset(),p.configuredKeybindingItems?(e.options.configuredKeybindingItems=p.configuredKeybindingItems,this._hasAssignedKeybindings.set(!0),u=this._configureAssignedKbHint()):this._hasAssignedKeybindings.reset()),this._currentContent=o+c+u}_render(e,t,o,n){let s=this._currentProvider?.id===e.id?this._editorWidget.getPosition():void 0;this._currentProvider=e,this._accessibleViewCurrentProviderId.set(e.id);let l=this._verbosityEnabled();this._updateContent(e,n),this.calculateCodeBlocks(this._currentContent),this._updateContextKeys(e,!0);let c=this._editorWidget.hasTextFocus()||this._editorWidget.hasWidgetFocus(),u=this._getStableUri(e.id);this._getTextModel(u).then(g=>{if(!g)return;let f=this._currentContent??"";if(g.getValue()!==f&&g.setValue(f),this._editorWidget.getModel()!==g&&this._editorWidget.setModel(g),!this._editorWidget.getDomNode())return;g.setLanguage(e.options.language??"markdown"),t.appendChild(this._container);let b="",S=this._accessibleViewSupportsNavigation.get()||this._accessibleViewVerbosityEnabled.get()||this._accessibleViewGoToSymbolSupported.get()||e.actions?.length;l&&!o&&S&&(b=e.options.position?d(5899,null):d(5898,null));let y=e.options.type==="help"?d(5886,null):d(5888,null);if(this._title.textContent=y,b&&e.options.type==="view"?y=d(5889,null,b):b&&(y=d(5887,null,b)),ii&&c&&(y=""),this._editorWidget.updateOptions({ariaLabel:y}),this._editorWidget.focus(),this._currentProvider?.options.position){let w=this._editorWidget.getPosition(),x=w?.lineNumber===1&&w.column===1;if(this._currentProvider.options.position==="bottom"||this._currentProvider.options.position==="initial-bottom"&&x){let E=this.editorWidget.getModel()?.getLineCount(),M=E!==void 0&&E>0?new ye(E,1):void 0;M&&(this._editorWidget.setPosition(M),this._editorWidget.revealLine(M.lineNumber))}}else if(s)this._editorWidget.setPosition(s);else{let w=this._lastProviderPosition.get(e.id);if(w){let x=this._editorWidget.getModel()?.getLineCount()??0;w.lineNumber<=x&&(this._editorWidget.setPosition(w),this._editorWidget.revealPosition(w))}}}),this._updateToolbar(this._currentProvider.actions,e.options.type);let p=g=>{if(!Me(this._editorWidget.getDomNode()).document.hasFocus()){g?.preventDefault(),g?.stopPropagation();return}if(this._isInQuickPick||e.onClose(),g?.stopPropagation(),this._contextViewService.hideContextView(),this._isInQuickPick)return;this._updateContextKeys(e,!1);let v=this._editorWidget.getPosition();v&&this._lastProviderPosition.set(e.id,v),this._lastProvider=void 0,this._currentContent=void 0,this._currentProvider?.dispose(),this._currentProvider=void 0},h=new O;return h.add(this._editorWidget.onKeyDown(g=>{if(g.keyCode===3)this._commandService.executeCommand("editor.action.openLink");else if(g.keyCode===9||JLn(g.browserEvent,this._keybindingService,this._configurationService))p(g);else if(g.keyCode===38&&e.options.readMoreUrl){let f=e.options.readMoreUrl;cn(qc.openingDocs),this._openerService.open(A.parse(f)),g.preventDefault(),g.stopPropagation()}e instanceof qp&&e.onKeyDown?.(g)})),h.add($(this._toolbar.getElement(),ne.KEY_DOWN,g=>{new mi(g).equals(9)&&p(g)})),h.add(this._editorWidget.onDidBlurEditorWidget(()=>{Na(this._toolbar.getElement())||p()})),h.add(this._editorWidget.onDidContentSizeChange(()=>this._layout())),h.add(this._layoutService.onDidLayoutActiveContainer(()=>this._layout())),h}_updateToolbar(e,t){this._toolbar.setAriaLabel(t==="help"?d(5890,null):d(5894,null));let o=this._register(this._menuService.createMenu(R.AccessibleView,this._contextKeyService)),n=Ng(o.getActions({}));if(e){for(let r of e)r.class=r.class||q.asClassName(L.primitiveSquare),r.checked=void 0;this._toolbar.setActions([...e,...n])}else this._toolbar.setActions(n)}_layout(){let e=this._layoutService.activeContainerDimension,t=e.height&&e.height*.6,o=Math.min(t,this._editorWidget.getContentHeight()),n=Math.min(e.width*.75,900);this._editorWidget.layout({width:n,height:o})}async _getTextModel(e){let t=this._modelService.getModel(e);return t&&!t.isDisposed()?t:this._modelService.createModel("",null,e,!1)}_goToSymbolsSupported(){return this._currentProvider?this._currentProvider.options.type==="help"||this._currentProvider.options.language==="markdown"||this._currentProvider.options.language===void 0||this._currentProvider instanceof qp&&!!this._currentProvider.getSymbols?.():!1}_updateLastProvider(){let e=this._currentProvider;return e?e instanceof qp?new qp(e.id,e.options,e.provideContent.bind(e),e.onClose.bind(e),e.verbositySettingKey,e.onOpen?.bind(e),e.actions,e.provideNextContent?.bind(e),e.providePreviousContent?.bind(e),e.onDidChangeContent?.bind(e),e.onKeyDown?.bind(e),e.getSymbols?.bind(e)):new KJ(e.id,e.options,e.provideContent.bind(e),e.onClose.bind(e),e.onOpen?.bind(e),e.provideNextContent?.bind(e),e.providePreviousContent?.bind(e),e.actions,e.onDidChangeContent?.bind(e)):void 0}showAccessibleViewHelp(){let e=this._updateLastProvider();if(!e)return;let t;e instanceof qp?t=new qp(e.id,{type:"help"},()=>e.options.customHelp?e?.options.customHelp():this._accessibleViewHelpDialogContent(this._goToSymbolsSupported()),()=>{this._contextViewService.hideContextView(),queueMicrotask(()=>this.show(e))},e.verbositySettingKey):t=new KJ(e.id,{type:"help"},()=>e.options.customHelp?e?.options.customHelp():this._accessibleViewHelpDialogContent(this._goToSymbolsSupported()),()=>{this._contextViewService.hideContextView(),queueMicrotask(()=>this.show(e))}),this._contextViewService.hideContextView(),t&&queueMicrotask(()=>this.show(t,void 0,!0))}_accessibleViewHelpDialogContent(e){let t=this._navigationHint(),o=this._goToSymbolHint(e),n=d(5914,null),r=this._getChatHints(),s=d(5907,null);return t&&(s+=" - "+t+`
`),o&&(s+=" - "+o+`
`),n&&(s+=" - "+n+`
`),r&&(s+=r),s}_getChatHints(){if(!(this._currentProvider?.id!=="panelChat"&&this._currentProvider?.id!=="quickChat"))return[d(5905,null,"<keybinding:workbench.action.chat.insertCodeBlock>"),d(5906,null,"<keybinding:workbench.action.chat.insertIntoNewFile>"),d(5910,null,"<keybinding:workbench.action.chat.runInTerminal>")].join(`
`)}_navigationHint(){return d(5891,null,"<keybinding:editor.action.accessibleViewNext>","<keybinding:editor.action.accessibleViewPrevious>")}_disableVerbosityHint(e){return e.options.type==="help"&&this._verbosityEnabled()?d(5895,null,"<keybinding:editor.action.accessibleViewDisableHint>"):""}_goToSymbolHint(e){if(e)return d(5904,null,"<keybinding:editor.action.accessibleViewGoToSymbol>")}_configureUnassignedKbHint(){let e=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelpConfigureKeybindings")?.getAriaLabel(),t=e?"("+e+")":"by assigning a keybinding to the command Accessibility Help Configure Unassigned Keybindings.";return d(5900,null,t)}_configureAssignedKbHint(){let e=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelpConfigureAssignedKeybindings")?.getAriaLabel(),t=e?"("+e+")":"by assigning a keybinding to the command Accessibility Help Configure Assigned Keybindings.";return d(5901,null,t)}_screenReaderModeHint(e){let t=this._accessibilityService.isScreenReaderOptimized(),o="",n=et?qc.changeConfigToOnMac:qc.changeConfigToOnWinLinux;return t&&e.id==="editor"?(o=qc.auto_on,o+=`
`):t||(o=qc.auto_off+`
`+n,o+=`
`),o}_exitDialogHint(e){return this._verbosityEnabled()&&!e.options.position?d(5903,null):""}_readMoreHint(e){return e.options.readMoreUrl?d(5909,null,"<keybinding:editor.action.accessibilityHelpOpenHelpLink>"):""}};Pht=I([m(0,Je),m(1,F),m(2,B),m(3,_t),m(4,qn),m(5,X),m(6,Ai),m(7,Le),m(8,Kl),m(9,Yt),m(10,fe),m(11,TZ),m(12,de),m(13,$e),m(14,br)],Pht);var Kqe=class extends k{constructor(e,t,o){super();this._instantiationService=e;this._configurationService=t;this._keybindingService=o}show(e,t){this._accessibleView||(this._accessibleView=this._register(this._instantiationService.createInstance(Pht))),this._accessibleView.show(e,void 0,void 0,t)}configureKeybindings(e){this._accessibleView?.configureKeybindings(e)}openHelpLink(){this._accessibleView?.openHelpLink()}showLastProvider(e){this._accessibleView?.showLastProvider(e)}next(){this._accessibleView?.next()}previous(){this._accessibleView?.previous()}goToSymbol(){this._accessibleView?.goToSymbol()}getOpenAriaHint(e){if(!this._configurationService.getValue(e))return null;let t=this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel(),o=null;return t?o=d(5896,null,t):o=d(5897,null),o}disableHint(){this._accessibleView?.disableHint()}showAccessibleViewHelp(){this._accessibleView?.showAccessibleViewHelp()}getPosition(e){return this._accessibleView?.getPosition(e)??void 0}getLastPosition(){let e=this._accessibleView?.editorWidget.getModel()?.getLineCount();return e!==void 0&&e>0?new ye(e,1):void 0}setPosition(e,t,o){this._accessibleView?.setPosition(e,t,o)}getCodeBlockContext(){return this._accessibleView?.getCodeBlockContext()}navigateToCodeBlock(e){this._accessibleView?.navigateToCodeBlock(e)}};Kqe=I([m(0,F),m(1,B),m(2,Le)],Kqe);var Aht=class{constructor(i,e){this._accessibleView=i;this._quickInputService=e}show(i){let e=new O,t=e.add(this._quickInputService.createQuickPick());t.placeholder=d(5892,null),t.title=d(5893,null);let o=[],n=this._accessibleView.getSymbols();if(n){for(let r of n)o.push({label:r.label,ariaLabel:r.ariaLabel,firstListItem:r.firstListItem,lineNumber:r.lineNumber,endLineNumber:r.endLineNumber,markdownToParse:r.markdownToParse});t.canSelectMany=!1,t.items=o,t.show(),e.add(t.onDidAccept(()=>{this._accessibleView.showSymbol(i,t.selectedItems[0]),t.hide()})),e.add(t.onDidHide(()=>{t.selectedItems.length===0&&this._accessibleView.show(i),e.dispose()}))}}};Aht=I([m(1,$e)],Aht);function JLn(a,i,e){if(!e.getValue("accessibility.accessibleView.closeOnKeyPress"))return!1;let t=new mi(a),n=i.softDispatch(t,t.target).kind===1;return i.inChordMode||n?!1:ZLn(a)&&!a.ctrlKey&&!a.altKey&&!a.metaKey&&!a.shiftKey}function ZLn(a){return!!a.code.match(/^(Key[A-Z]|Digit[0-9]|Equal|Comma|Period|Slash|Quote|Backquote|Backslash|Minus|Semicolon|Space|Enter)$/)}var pJt=class extends k{constructor(){super(),this._register(zme.addImplementation(115,"accessible-view-help",i=>(i.get(Kd).showAccessibleViewHelp(),!0),Jd))}},mJt=class extends k{constructor(){super(),_a.getImplementations().forEach(i=>{let e=t=>{let o=i.getProvider(t);if(!o)return!1;try{return t.get(Kd).show(o),!0}catch{return o.dispose(),!1}};i.type==="view"?this._register(Xee.addImplementation(i.priority,i.name,e,i.when)):this._register(zme.addImplementation(i.priority,i.name,e,i.when))})}};var KIe=class extends k{constructor(e){super();this._viewHelpDialogMap=this._register(new Ot);this._register(oe.as(Kn.ViewsRegistry).onViewsRegistered(t=>{for(let o of t)for(let n of o.views)n.accessibilityHelpContent&&this._viewHelpDialogMap.set(n.id,hBo(e,n))})),this._register(oe.as(Kn.ViewsRegistry).onViewsDeregistered(t=>{for(let o of t.views)o.accessibilityHelpContent&&this._viewHelpDialogMap.get(o.id)?.dispose()}))}static{this.ID="extensionAccessibilityHelpDialogContribution"}};KIe=I([m(0,Le)],KIe);function hBo(a,i){let e=new O,t=i.accessibilityHelpContent?.value;if(!t)throw new Error("No content provided for the accessibility help dialog");return e.add(_a.register({priority:95,name:i.id,type:"help",when:rc.isEqualTo(i.id),getProvider:o=>{let n=o.get(Gt);return new KJ(i.id,{type:"help"},()=>t,()=>n.openView(i.id,!0))}})),e.add(a.onDidUpdateKeybindings(()=>{e.clear(),e.add(hBo(a,i))})),e}zpo();Ce(Kd,Kqe,1);Ce(tPe,ePe,1);var hJt=oe.as(Zi.Workbench);hJt.registerWorkbenchContribution(NYt,4);hJt.registerWorkbenchContribution(zqe,3);hJt.registerWorkbenchContribution(pJt,4);hJt.registerWorkbenchContribution(mJt,4);bt(BIe.ID,BIe,vt.BlockRestore);bt(KIe.ID,KIe,vt.BlockRestore);bt(HIe.ID,HIe,vt.AfterRestored);bt(zIe.ID,zIe,vt.AfterRestored);bt(UIe.ID,UIe,vt.AfterRestored);bt(Bme.ID,Bme,vt.AfterRestored);var T7=class extends k{constructor(e,t){super();this.meteredConnectionService=e;this.statusbarService=t;this.statusBarEntry=this._register(new ue);this.updateStatusBarEntry(this.meteredConnectionService.isConnectionMetered),this._register(this.meteredConnectionService.onDidChangeIsConnectionMetered(o=>{this.updateStatusBarEntry(o)}))}static{this.ID="workbench.contrib.meteredConnectionStatus"}updateStatusBarEntry(e){e?this.statusBarEntry.value||(this.statusBarEntry.value=this.statusbarService.addEntry(this.getStatusBarEntry(),T7.ID,1,-Number.MAX_VALUE)):this.statusBarEntry.clear()}getStatusBarEntry(){return{name:d(13435,null),text:"$(radio-tower)",ariaLabel:d(13436,null),tooltip:d(13438,null),command:{id:"workbench.action.configureMeteredConnection",title:d(13437,null)},showInAllWindows:!0}}};T7=I([m(0,MG),m(1,Fr)],T7);var eMn=oe.as($t.Configuration);eMn.registerConfiguration({id:"network",order:14,title:d(2465,null),type:"object",properties:{"network.meteredConnection":{type:"string",enum:["auto","on","off"],enumDescriptions:[d(2462,null),d(2464,null),d(2463,null)],default:"auto",scope:1,description:d(2461,null),tags:["usesOnlineServices"]}}});bt(T7.ID,T7,vt.AfterRestored);W(class gBo extends z{static{this.ID="workbench.action.configureMeteredConnection"}constructor(){super({id:gBo.ID,title:P(13427,"Configure Metered Connection"),f1:!0})}async run(i){let e=i.get($e),t=i.get(B),o=t.getValue(aMe),n=[{value:"auto",label:d(13428,null),description:d(13429,null),picked:o==="auto"},{value:"on",label:d(13432,null),description:d(13433,null),picked:o==="on"},{value:"off",label:d(13430,null),description:d(13431,null),picked:o==="off"}],r=await e.pick(n,{placeHolder:d(13434,null),activeItem:n.find(s=>s.picked)});r&&await t.updateValue(aMe,r.value)}});var gJt=new Y("shareProviderCount",0,d(15370,null)),Gqe=class{constructor(i,e,t,o,n){this.contextKeyService=i;this.labelService=e;this.quickInputService=t;this.codeEditorService=o;this.telemetryService=n;this._providers=new Set;this.providerCount=gJt.bindTo(this.contextKeyService)}registerShareProvider(i){return this._providers.add(i),this.providerCount.set(this._providers.size),{dispose:()=>{this._providers.delete(i),this.providerCount.set(this._providers.size)}}}getShareActions(){return[]}async provideShare(i,e){let t=this.codeEditorService.getActiveCodeEditor()?.getModel()?.getLanguageId()??"",o=[...this._providers.values()].filter(s=>gH(s.selector,i.resourceUri,t,!0,void 0,void 0)>0).sort((s,l)=>s.priority-l.priority);if(o.length===0)return;if(o.length===1)return this.telemetryService.publicLog2("shareService.share",{providerId:o[0].id}),o[0].provideShare(i,e);let n=o.map(s=>({label:s.label,provider:s})),r=await this.quickInputService.pick(n,{canPickMany:!1,placeHolder:d(15373,null,this.labelService.getUriLabel(i.resourceUri))},e);if(r!==void 0)return this.telemetryService.publicLog2("shareService.share",{providerId:r.provider.id}),r.provider.provideShare(i,e)}};Gqe=I([m(0,X),m(1,nt),m(2,$e),m(3,Qt),m(4,_e)],Gqe);W(class extends UP{constructor(){super("workbench.experimental.share.enabled",d(15371,null),d(15372,null),3,C.and(N0.toNegated(),C.has("config.window.commandCenter"),C.and(gJt.notEqualsTo(0),i_.notEqualsTo(0))))}});var tMn=[R.EditorContextShare,R.SCMResourceContextShare,R.OpenEditorsContextShare,R.EditorTitleContextShare,R.MenubarShare,R.ExplorerContextShare],_7=class extends k{constructor(e,t){super();this.shareService=e;this.configurationService=t;this.configurationService.getValue(_7.SHARE_ENABLED_SETTING)&&this.registerActions(),this._register(this.configurationService.onDidChangeConfiguration(o=>{if(o.affectsConfiguration(_7.SHARE_ENABLED_SETTING)){let n=this.configurationService.getValue(_7.SHARE_ENABLED_SETTING);n===!0&&this._disposables===void 0?this.registerActions():n===!1&&this._disposables!==void 0&&(this._disposables?.clear(),this._disposables=void 0)}}))}static{this.SHARE_ENABLED_SETTING="workbench.experimental.share.enabled"}dispose(){super.dispose(),this._disposables?.dispose()}registerActions(){this._disposables||(this._disposables=new O),this._disposables.add(W(class D$i extends z{static{this.ID="workbench.action.share"}static{this.LABEL=P(15367,"Share...")}constructor(){super({id:D$i.ID,title:D$i.LABEL,f1:!0,icon:L.linkExternal,precondition:C.and(gJt.notEqualsTo(0),i_.notEqualsTo(0)),keybinding:{weight:200,primary:2609},menu:[{id:R.CommandCenter,order:3}]})}async run(o,...n){let r=o.get(HLe),s=o.get(ie)?.activeEditor,l=(s&&po.getOriginalUri(s,{supportSideBySide:1}))??o.get(Ae).getWorkspace().folders[0].uri,c=o.get(Bi),u=o.get(ct),p=o.get(Je),h=o.get(Go),g=o.get(Qt).getActiveCodeEditor()?.getSelection()??void 0,f=await h.withProgress({location:10,detail:d(15365,null)},async()=>r.provideShare({resourceUri:l,selection:g},Ie.None));if(f){let v=f.toString(),b=typeof f=="string";await c.writeText(v),u.prompt({type:ft.Info,message:b?d(15369,null):d(15368,null),custom:{icon:L.check,markdownDetails:[{markdown:new he(`<div aria-label='${v}'>${v}</div>`,{supportHtml:!0}),classes:[b?"share-dialog-input-text":"share-dialog-input-link"]}]},cancelButton:d(15363,null),buttons:b?[]:[{label:d(15366,null),run:()=>{p.open(f,{openExternal:!0})}}]})}}}));let e=this.shareService.getShareActions();for(let t of tMn)for(let o of e)this._disposables.add(be.appendMenuItem(t,o))}};_7=I([m(0,HLe),m(1,B)],_7);Ce(HLe,Gqe,1);var iMn=oe.as(Zi.Workbench);iMn.registerWorkbenchContribution(_7,4);oe.as($t.Configuration).registerConfiguration({...jd,properties:{"workbench.experimental.share.enabled":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(15364,null,"`#window.commandCenter#`","`true`"),restricted:!1}}});var GIe=class extends k{constructor(e,t){super();this.editorService=e;this.statusbarService=t;this.paneInitialScrollTop=new Map;this.syncScrollDispoasbles=this._register(new O);this.paneDisposables=this._register(new O);this.statusBarEntry=this._register(new ue);this.isActive=!1;this._reentrancyBarrier=new uee;this.registerActions()}static{this.ID="workbench.contrib.syncScrolling"}registerActiveListeners(){this.syncScrollDispoasbles.add(this.editorService.onDidVisibleEditorsChange(()=>this.trackVisiblePanes()))}activate(){this.registerActiveListeners(),this.trackVisiblePanes()}toggle(){this.isActive?this.deactivate():this.activate(),this.isActive=!this.isActive,this.toggleStatusbarItem(this.isActive)}trackVisiblePanes(){this.paneDisposables.clear(),this.paneInitialScrollTop.clear();for(let e of this.getAllVisiblePanes())LMt(e)&&(this.paneInitialScrollTop.set(e,e.getScrollPosition()),this.paneDisposables.add(e.onDidChangeScroll(()=>this._reentrancyBarrier.runExclusivelyOrSkip(()=>{this.onDidEditorPaneScroll(e)}))))}onDidEditorPaneScroll(e){let t=this.paneInitialScrollTop.get(e);if(t===void 0)throw new Error("Scrolled pane not tracked");if(!LMt(e))throw new Error("Scrolled pane does not support scrolling");let o=e.getScrollPosition(),n={scrollTop:o.scrollTop-t.scrollTop,scrollLeft:o.scrollLeft!==void 0&&t.scrollLeft!==void 0?o.scrollLeft-t.scrollLeft:void 0};for(let r of this.getAllVisiblePanes()){if(r===e||!LMt(r))continue;let s=this.paneInitialScrollTop.get(r);if(s===void 0)throw new Error("Could not find initial offset for pane");let l=r.getScrollPosition(),c={scrollTop:s.scrollTop+n.scrollTop,scrollLeft:s.scrollLeft!==void 0&&n.scrollLeft!==void 0?s.scrollLeft+n.scrollLeft:void 0};l.scrollTop===c.scrollTop&&l.scrollLeft===c.scrollLeft||r.setScrollPosition(c)}}getAllVisiblePanes(){let e=[];for(let t of this.editorService.visibleEditorPanes){if(t instanceof iv){let o=t.getPrimaryEditorPane(),n=t.getSecondaryEditorPane();o&&e.push(o),n&&e.push(n);continue}e.push(t)}return e}deactivate(){this.paneDisposables.clear(),this.syncScrollDispoasbles.clear(),this.paneInitialScrollTop.clear()}toggleStatusbarItem(e){if(e){if(!this.statusBarEntry.value){let t=d(15004,null),o=d(15003,null);this.statusBarEntry.value=this.statusbarService.addEntry({name:t,text:t,tooltip:o,ariaLabel:t,command:{id:"workbench.action.toggleLockedScrolling",title:""},kind:"prominent",showInAllWindows:!0},"status.scrollLockingEnabled",1,102)}}else this.statusBarEntry.clear()}registerActions(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.action.toggleLockedScrolling",title:{...P(15006,"Toggle Locked Scrolling Across Editors"),mnemonicTitle:d(15002,null)},category:Fe.View,f1:!0,metadata:{description:d(15005,null)}})}run(){e.toggle()}})),this._register(W(class extends z{constructor(){super({id:"workbench.action.holdLockedScrolling",title:{...P(15000,"Hold Locked Scrolling Across Editors"),mnemonicTitle:d(15001,null)},category:Fe.View})}run(t){let o=t.get(Le);e.toggle();let n=o.enableKeybindingHoldMode("workbench.action.holdLockedScrolling");n&&n.finally(()=>{e.toggle()})}}))}dispose(){this.deactivate(),super.dispose()}};GIe=I([m(0,ie),m(1,Fr)],GIe);bt(GIe.ID,GIe,vt.Eventually);var qIe=class extends k{constructor(e,t,o){super();this._languageStatusService=e;this._editorService=t;this._chatEntitlementService=o;this._activeEditor=vi(this,t.onDidActiveEditorChange,()=>this._editorService.activeTextEditorControl),this._sentiment=this._chatEntitlementService.sentimentObs,this._state=ke(this,n=>{let r=this._activeEditor.read(n);if(!r||!fn(r))return;let l=cd.get(r)?.model.read(n);if(l)return{model:l,status:vA(l.status,300)}}),this._register(Rl((n,r)=>{if(this._sentiment.read(n).hidden)return;let l=this._state.read(n);if(!l)return;let c=l.status.read(n),u={loading:{shortLabel:"",label:d(12474,null),loading:!0},ghostText:{shortLabel:"$(lightbulb)",label:"$(copilot) "+d(12472,null),loading:!1},inlineEdit:{shortLabel:"$(lightbulb-sparkle)",label:"$(copilot) "+d(12473,null),loading:!1},noSuggestion:{shortLabel:"$(circle-slash)",label:"$(copilot) "+d(12477,null),loading:!1}};r.add(this._languageStatusService.addStatus({accessibilityInfo:void 0,busy:u[c].loading,command:void 0,detail:d(12476,null),id:"inlineSuggestions",label:{value:u[c].label,shortValue:u[c].shortLabel},name:d(12475,null),selector:{pattern:l.model.textModel.uri.fsPath},severity:wt.Info,source:"inlineSuggestions"}))}))}static{this.hot=TK(this)}static{this.Id="vs.contrib.inlineCompletionLanguageStatusBarContribution"}static{this.languageStatusBarDisposables=new Set}};qIe=I([m(0,$H),m(1,ie),m(2,dr)],qIe);bt(qIe.Id,p_t(qIe.hot),vt.Eventually);var qqe=class extends k{constructor(e){super();this._languageFeaturesService=e;let t=oe.as(Ta.JSONContribution),o=vi(this,this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.allNoModel());this._register(ve(n=>{let r=o.read(n);t.registerSchema(ifi,{enum:Y4i(r.flatMap(s=>ofi(s)))},n.store)}))}static{this.Id="vs.contrib.InlineCompletionSchemaContribution"}};qqe=I([m(0,Jt)],qqe);bt(qqe.Id,qqe,vt.Eventually);var $Ie=class{constructor(i){this._preferencesService=i;Ju.setConfigureDefaultAction(li({id:"workbench.action.configurePreferredPasteAction",label:d(11164,null),run:()=>this.configurePreferredPasteAction()})),Gh.setConfigureDefaultAction(li({id:"workbench.action.configurePreferredDropAction",label:d(11163,null),run:()=>this.configurePreferredDropAction()}))}static{this.ID="workbench.contrib.dropOrPasteInto"}configurePreferredPasteAction(){return this._preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:KQe,edit:!0}})}configurePreferredDropAction(){return this._preferencesService.openUserSettings({jsonEditor:!0,revealSetting:{key:$6e,edit:!0}})}};$Ie=I([m(0,Qo)],$Ie);var R$i=[],oMn={type:"array",scope:6,description:d(11166,null),default:[],items:{description:d(11165,null),anyOf:[{type:"string"},{enum:R$i}]}},L$i=[],nMn={type:"array",scope:6,description:d(11168,null),default:[],items:{description:d(11167,null),anyOf:[{type:"string"},{enum:L$i}]}},M$i=Object.freeze({...wx,properties:{[KQe]:nMn,[$6e]:oMn}}),jIe=class extends k{constructor(e,t){super();this.languageFeatures=t;this._onDidChangeSchemaContributions=this._register(new T);this._allProvidedDropKinds=[];this._allProvidedPasteKinds=[];this._register(U.runAndSubscribe(U.debounce(U.any(t.documentPasteEditProvider.onDidChange,t.documentPasteEditProvider.onDidChange),()=>{},1e3),()=>{this.updateProvidedKinds(),this.updateConfigurationSchema(),this._onDidChangeSchemaContributions.fire()})),this._register(e.registerSchemaContribution({getSchemaAdditions:()=>this.getKeybindingSchemaAdditions(),onDidChange:this._onDidChangeSchemaContributions.event}))}static{this.ID="workbench.contrib.dropOrPasteIntoSchema"}updateProvidedKinds(){let e=new Map;for(let o of this.languageFeatures.documentDropEditProvider.allNoModel())for(let n of o.providedDropEditKinds??[])e.set(n.value,n);this._allProvidedDropKinds=Array.from(e.values());let t=new Map;for(let o of this.languageFeatures.documentPasteEditProvider.allNoModel())for(let n of o.providedPasteEditKinds??[])t.set(n.value,n);this._allProvidedPasteKinds=Array.from(t.values())}updateConfigurationSchema(){L$i.length=0;for(let e of this._allProvidedPasteKinds)L$i.push(e.value);R$i.length=0;for(let e of this._allProvidedDropKinds)R$i.push(e.value);oe.as($t.Configuration).notifyConfigurationSchemaUpdated(M$i)}getKeybindingSchemaAdditions(){return[{if:{required:["command"],properties:{command:{const:Dmi}}},then:{properties:{args:{oneOf:[{required:["kind"],properties:{kind:{anyOf:[{enum:Array.from(this._allProvidedPasteKinds.map(e=>e.value))},{type:"string"}]}}},{required:["preferences"],properties:{preferences:{type:"array",items:{anyOf:[{enum:Array.from(this._allProvidedPasteKinds.map(e=>e.value))},{type:"string"}]}}}}]}}}}]}};jIe=I([m(0,Le),m(1,Jt)],jIe);bt($Ie.ID,$Ie,vt.Eventually);bt(jIe.ID,jIe,vt.Eventually);oe.as($t.Configuration).registerConfiguration(M$i);function P$i(a,i,e){return a.reduce((t,o)=>{let n=e(o);return t[n]=(t[n]||0)+i(o),t},{})}function fBo(a,i,e){let t=De("mapped",a.get());return e.add(Zs(a,(o,n,r)=>{Ki(s=>{for(let l of r)t.set(o,s,i(l))})})),t}function vBo(a,i){return new Fp(e=>{if(!i.isDisposed)return i.add(Zs(a,(t,o,n)=>{e.emitOne({value:t,prevValue:o,change:n})})),new Promise(t=>{i.add(ee(()=>{t(void 0)}))})})}var fJt=class extends k{constructor(e){super();this._originalDoc=e;let t=this.value=De(this,e.value.get());this._register(Zs(this._originalDoc.value,(o,n,r)=>{let s=Fy.compose(r.map(l=>{let c=new A$i(l.reason);return l.mapData(()=>c)}));t.set(o,void 0,{edit:s})}))}waitForQueue(){return Promise.resolve()}},A$i=class{constructor(i){this.editSource=i;this.key=this.editSource.toKey(1),this.source=D7.create(this.editSource)}join(i){if(this.editSource===i.editSource)return this}toEditSourceData(){return new N$i(this.key,this.source,this.editSource)}},N$i=class{constructor(i,e,t){this.key=i;this.source=e;this.representative=t}join(i){if(this.key===i.key&&this.source===i.source)return this}},D7=class{static{this._cache=new xy({getCacheKey:i=>i.toString()},i=>i)}static create(i){let e=i.metadata;switch(e.source){case"reloadFromDisk":return this._cache.get(new F$i);case"inlineCompletionPartialAccept":case"inlineCompletionAccept":{let t="type"in e?e.type:void 0;return"$nes"in e&&e.$nes?this._cache.get(new vJt("nes",e.$extensionId??"",e.$providerId??"",t)):this._cache.get(new vJt("completion",e.$extensionId??"",e.$providerId??"",t))}case"snippet":return this._cache.get(new SJt("suggest"));case"unknown":return e.name?e.name==="formatEditsCommand"?this._cache.get(new SJt("format")):this._cache.get(new Oht):this._cache.get(new Oht);case"Chat.applyEdits":return this._cache.get(new bJt("sidebar"));case"inlineChat.applyEdits":return this._cache.get(new bJt("inline"));case"cursor":return this._cache.get(new O$i);default:return this._cache.get(new Oht)}}},vJt=class extends D7{constructor(e,t,o,n){super();this.kind=e;this.extensionId=t;this.providerId=o;this.type=n;this.category="ai";this.feature="inlineSuggest"}toString(){return`${this.category}/${this.feature}/${this.kind}/${this.extensionId}/${this.type}`}getColor(){return"#00ff0033"}},bJt=class extends D7{constructor(e){super();this.kind=e;this.category="ai";this.feature="chat"}toString(){return`${this.category}/${this.feature}/${this.kind}`}getColor(){return"#00ff0066"}},SJt=class extends D7{constructor(e){super();this.feature=e;this.category="ide"}toString(){return`${this.category}/${this.feature}`}getColor(){return this.feature==="format"?"#0000ff33":"#80808033"}},O$i=class extends D7{constructor(){super();this.category="user"}toString(){return this.category}getColor(){return"#d3d3d333"}},F$i=class extends D7{constructor(){super();this.category="external"}toString(){return this.category}getColor(){return"#009ab254"}},Oht=class extends D7{constructor(){super();this.category="unknown"}toString(){return this.category}getColor(){return"#ff000033"}},$qe=class extends k{constructor(e,t){super();this._originalDoc=e;this._instantiationService=t;this._runStore=this._register(new O);this._runQueue=Promise.resolve();this._diffService=this._instantiationService.createInstance(Nht),this.value=this._value=De(this,e.value.get()),this._restart()}async _restart(){this._runStore.clear();let e=vBo(this._originalDoc.value,this._runStore)[Symbol.asyncIterator](),t=this._runQueue;this._runQueue=this._runQueue.then(()=>this._run(e)),await t}async _run(e){let t=new ubt(e);for(;;){let o=await t.peek();if(o===gY)return;if(bBo(o)){let n=o,r=n,s=Fy.empty;do{t.readBufferedOrThrow(),r=o,s=s.compose(Fy.compose(o.change.map(c=>c.edit)));let l=await t.peekTimeout(1e3);if(!l)break;o=l}while(o!==gY&&bBo(o));if(!s.isEmpty()){let l=s.replacements[0].data,u=(await this._diffService.computeDiff(n.prevValue.value,r.value.value)).mapData(p=>l);this._value.set(r.value,void 0,{edit:u})}}else{t.readBufferedOrThrow();let n=Fy.compose(o.change.map(r=>r.edit));this._value.set(o.value,void 0,{edit:n})}}}async waitForQueue(){await this._originalDoc.waitForQueue(),await this._restart()}};$qe=I([m(1,F)],$qe);var Nht=class{constructor(i){this._editorWorkerService=i}async computeDiff(i,e){return await this._editorWorkerService.computeStringEditFromDiff(i,e,{maxComputationTimeMs:500},"advanced")}};Nht=I([m(0,Qs)],Nht);function bBo(a){return a.change.every(i=>i.edit.replacements.every(e=>e.data.source.category==="ai"&&e.data.source.feature==="chat"))}var IJt=class extends k{constructor(e){super();this._originalDoc=e;let t=this.value=De(this,e.value.get()),o=this._originalDoc.value.get().value;this._register(Zs(this._originalDoc.value,(n,r,s)=>{let c=Fy.compose(s.map(u=>u.edit)).removeCommonSuffixAndPrefix(o);o=n.value,t.set(n,void 0,{edit:c})}))}async waitForQueue(){await this._originalDoc.waitForQueue()}};function QIe(a,i){return{value:fBo(a.value,t=>({edit:t.edit.mapData(o=>o.data.toEditSourceData())}),i),waitForQueue:()=>a.waitForQueue()}}var jqe=class extends k{constructor(e,t){super();this._workspace=e;this._instantiationService=t;let o=this._instantiationService.createInstance(Fht);this._states=Pb(this,this._workspace.documents,(n,r)=>{let s=ke(c=>o.isVisible(n.uri,c));return mv(this,(c,u)=>u||s.read(c)).map(c=>c?r.add(this._instantiationService.createInstance(Wht,n,s)):void 0)}),this.documents=this._states.map((n,r)=>n.map(s=>s.read(r)).filter(so)),this.documents.recomputeInitiallyAndOnChange(this._store)}};jqe=I([m(1,F)],jqe);var Fht=class{constructor(i){this._editorGroupsService=i;let e=qr(this,this._editorGroupsService.onDidAddGroup),t=qr(this,this._editorGroupsService.onDidRemoveGroup),o=ke(this,n=>(e.read(n),t.read(n),this._editorGroupsService.groups));this.visibleUris=Pb(this,o,n=>vi(this,n.onDidModelChange,()=>n.editors).map(s=>s.map(l=>po.getCanonicalUri(l)))).map((n,r)=>{let s=new Map;for(let l of n)for(let c of l.read(r))so(c)&&s.set(c.toString(),c);return s})}isVisible(i,e){return this.visibleUris.read(e).has(i.toString())}};Fht=I([m(0,kt)],Fht);var Wht=class extends k{constructor(e,t,o){super();this.document=e;this.isVisible=t;this._instantiationService=o;let n=this._store.add(new fJt(e));n=this._store.add(this._instantiationService.createInstance($qe,n)),n=this._store.add(new IJt(n)),this.documentWithAnnotations=n}};Wht=I([m(2,F)],Wht);var yJt=class{constructor(i,e){this._valueBeforeTrackedEdit=i;this._trackedEdit=e.removeCommonSuffixPrefix(i.getValue()),this._updatedTrackedEdit=this._trackedEdit.mapData(()=>new wJt(!0))}getOriginalCharacterCount(){return Pw(this._trackedEdit.replacements,i=>i.getNewLength())}handleEdits(i){let e=i.mapData(o=>new wJt(!1)),t=this._updatedTrackedEdit.compose(e);this._updatedTrackedEdit=t}getAcceptedRestrainedCharactersCount(){return Pw(this._updatedTrackedEdit.replacements,e=>e.data.isTrackedEdit?e.getNewLength():0)}getDebugState(){return{edits:this._updatedTrackedEdit.replacements.map(i=>({range:i.replaceRange.toString(),newText:i.newText,isTrackedEdit:i.data.isTrackedEdit}))}}getLineCountInfo(){let i=this._updatedTrackedEdit.toStringEdit(n=>n.data.isTrackedEdit),e=q5.fromStringEdit(i,this._valueBeforeTrackedEdit),t=Pw(e.replacements,n=>n.lineRange.length),o=Pw(e.getNewLineRanges(),n=>n.length);return{deletedLineCounts:t,insertedLineCounts:o}}getValues(){return{arc:this.getAcceptedRestrainedCharactersCount(),...this.getLineCountInfo()}}},wJt=class{constructor(i){this.isTrackedEdit=i}join(i){if(this.isTrackedEdit===i.isTrackedEdit)return this}};var YIe=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._timesMs=e;this._documentValueBeforeTrackedEdit=t;this._document=o;this._gitRepo=n;this._trackedEdit=r;this._sendTelemetryEvent=s;this._dispose=l;this._telemetryService=c;this._arcTracker=new yJt(this._documentValueBeforeTrackedEdit,this._trackedEdit),this._store.add(Zs(this._document.value,(u,p,h)=>{let g=TCe.composeOrUndefined(h.map(f=>f.edit));g&&this._arcTracker.handleEdits(g)})),this._initialLineCounts=this._arcTracker.getLineCountInfo(),this._initialBranchName=this._gitRepo.get()?.headBranchNameObs.get();for(let u=0;u<this._timesMs.length;u++){let p=this._timesMs[u];p<=0?this._report(p):this._reportAfter(p,u===this._timesMs.length-1?()=>{this._dispose()}:void 0)}}_reportAfter(e,t){let o=new Nl(()=>{this._report(e),o.dispose(),t&&t()},e);this._store.add(o)}_report(e){let o=this._gitRepo.get()?.headBranchNameObs.get()!==this._initialBranchName,n=this._arcTracker.getLineCountInfo();this._sendTelemetryEvent({telemetryService:this._telemetryService,timeDelayMs:e,didBranchChange:o,arc:this._arcTracker.getAcceptedRestrainedCharactersCount(),originalCharCount:this._arcTracker.getOriginalCharacterCount(),currentLineCount:n.insertedLineCounts,currentDeletedLineCount:n.deletedLineCounts,originalLineCount:this._initialLineCounts.insertedLineCounts,originalDeletedLineCount:this._initialLineCounts.deletedLineCounts})}};YIe=I([m(7,_e)],YIe);var Tae=le("randomService"),CJt=class{generateUuid(){return ht()}generatePrefixedUuid(i){return`${i}-${this.generateUuid()}`}};var Qqe=class extends k{constructor(e,t,o){super();this._instantiationService=o;this._register(Zs(e.value,(n,r,s)=>{let l=Fy.compose(s.map(h=>h.edit));if(!l.replacements.some(h=>h.data.editSource.metadata.source==="inlineCompletionAccept"))return;if(!l.replacements.every(h=>h.data.editSource.metadata.source==="inlineCompletionAccept")){mt(new Error("ArcTelemetrySender: Not all edits are inline completion accept edits!"));return}if(l.replacements[0].data.editSource.metadata.source!=="inlineCompletionAccept")return;let c=l.replacements[0].data.editSource.metadata,u=QIe(e,this._store),p=this._store.add(this._instantiationService.createInstance(YIe,[0,30,120,300,600,900].map(h=>h*1e3),r,u,t,l,h=>{h.telemetryService.publicLog2("editTelemetry.reportInlineEditArc",{extensionId:c.$extensionId??"",extensionVersion:c.$extensionVersion??"",opportunityId:c.$$requestUuid??"unknown",languageId:c.$$languageId,correlationId:c.$$correlationId,didBranchChange:h.didBranchChange?1:0,timeDelayMs:h.timeDelayMs,originalCharCount:h.originalCharCount,originalLineCount:h.originalLineCount,originalDeletedLineCount:h.originalDeletedLineCount,arc:h.arc,currentLineCount:h.currentLineCount,currentDeletedLineCount:h.currentDeletedLineCount,...aH(f0(c.$extensionId))})},()=>{this._store.delete(p)}))}))}};Qqe=I([m(2,F)],Qqe);var Yqe=class extends k{constructor(e,t){super();this._aiEditTelemetryService=t;this._register(Zs(e.value,(o,n,r)=>{let s=Fy.compose(r.map(g=>g.edit)),l=new Set(["Chat.applyEdits","inlineChat.applyEdits"]);if(!s.replacements.some(g=>l.has(g.data.editSource.metadata.source)))return;if(!s.replacements.every(g=>l.has(g.data.editSource.metadata.source))){mt(new Error(`ArcTelemetrySender: Not all edits are ${s.replacements[0].data.editSource.metadata.source}!`));return}let c,u=s.replacements[0].data.editSource,p;u.metadata.source==="Chat.applyEdits"?(p="sideBarChat",u.metadata.$$mode==="applyCodeBlock"&&(c=u.metadata.$$codeBlockSuggestionId)):p="inlineChat";let h=new zz(u.props.$extensionId,u.props.$extensionVersion,u.props.$providerId);this._aiEditTelemetryService.createSuggestionId({applyCodeBlockSuggestionId:c,languageId:u.props.$$languageId,presentation:"highlightedEdit",feature:p,source:h,modelId:u.props.$modelId,modeId:u.props.$$mode,editDeltaInfo:Uy.fromEdit(s,n),sourceRequestId:void 0})}))}};Yqe=I([m(1,XS)],Yqe);var Xqe=class extends k{constructor(e,t,o,n){super();this._instantiationService=o;this._randomService=n;this._register(Zs(e.value,(r,s,l)=>{let c=Fy.compose(l.map(v=>v.edit)),u=new Set(["Chat.applyEdits","inlineChat.applyEdits"]);if(!c.replacements.some(v=>u.has(v.data.editSource.metadata.source)))return;if(!c.replacements.every(v=>u.has(v.data.editSource.metadata.source))){mt(new Error(`ArcTelemetrySender: Not all edits are ${c.replacements[0].data.editSource.metadata.source}!`));return}let p=c.replacements[0].data.editSource,h=this._randomService.generateUuid(),g=QIe(e,this._store),f=this._store.add(this._instantiationService.createInstance(YIe,[0,60,300].map(v=>v*1e3),s,g,t,c,v=>{v.telemetryService.publicLog2("editTelemetry.reportEditArc",{sourceKeyCleaned:p.toKey(Number.MAX_SAFE_INTEGER,{$extensionId:!1,$extensionVersion:!1,$$requestUuid:!1,$$sessionId:!1,$$requestId:!1,$$languageId:!1,$modelId:!1}),extensionId:p.props.$extensionId,extensionVersion:p.props.$extensionVersion,opportunityId:p.props.$$requestUuid,editSessionId:p.props.$$sessionId,requestId:p.props.$$requestId,modelId:p.props.$modelId,languageId:p.props.$$languageId,mode:p.props.$$mode,uniqueEditId:h,didBranchChange:v.didBranchChange?1:0,timeDelayMs:v.timeDelayMs,originalCharCount:v.originalCharCount,originalLineCount:v.originalLineCount,originalDeletedLineCount:v.originalDeletedLineCount,arc:v.arc,currentLineCount:v.currentLineCount,currentDeletedLineCount:v.currentDeletedLineCount,...aH(f0(p.props.$extensionId))})},()=>{this._store.delete(f)}))}))}};Xqe=I([m(2,F),m(3,Tae)],Xqe);var _ae=class extends k{constructor(e,t){super();this._doc=e;this.data=t;this._edits=Fy.empty;this._pendingExternalEdits=Fy.empty;this._update=zc(this);this._representativePerKey=new Map;this._sumAddedCharactersPerKey=new Map;this._register(Zs(this._doc.value,(o,n,r)=>{let s=Fy.compose(r.map(l=>l.edit));s.replacements.every(l=>l.data.source.category==="external")?this._edits.isEmpty()||(this._pendingExternalEdits=this._pendingExternalEdits.compose(s)):(this._pendingExternalEdits.isEmpty()||(this._applyEdit(this._pendingExternalEdits),this._pendingExternalEdits=Fy.empty),this._applyEdit(s)),this._update.trigger(void 0)}))}_applyEdit(e){for(let t of e.replacements){let o=this._sumAddedCharactersPerKey.get(t.data.key);o===void 0&&(o=0,this._representativePerKey.set(t.data.key,t.data.representative));let n=o+t.getNewLength();this._sumAddedCharactersPerKey.set(t.data.key,n)}this._edits=this._edits.compose(e)}async waitForQueue(){await this._doc.waitForQueue()}getTotalInsertedCharactersCount(e){return this._sumAddedCharactersPerKey.get(e)??0}getAllKeys(){return Array.from(this._sumAddedCharactersPerKey.keys())}getRepresentative(e){return this._representativePerKey.get(e)}getTrackedRanges(e){return this._update.read(e),this._edits.getNewRanges().map((o,n)=>{let r=this._edits.replacements[n];return new W$i(r.replaceRange,o,r.data.key,r.data.source,r.data.representative)})}isEmpty(){return this._edits.isEmpty()}_getDebugVisualization(){let e=this.getTrackedRanges();return{$fileExtension:"text.w",value:this._doc.value.get().value,decorations:e.map(o=>({range:[o.range.start,o.range.endExclusive],color:o.source.getColor()}))}}},W$i=class{constructor(i,e,t,o,n){this.originalRange=i;this.range=e;this.sourceKey=t;this.source=o;this.sourceRepresentative=n}};var Jqe=class{constructor(i){this._scmService=i;this._repos=new Qvt(i=>new V$i(i));this._reposChangedSignal=qr(this,U.any(this._scmService.onDidAddRepository,this._scmService.onDidRemoveRepository))}getRepo(i,e){this._reposChangedSignal.read(e);let t=this._scmService.getRepository(i);if(t)return this._repos.get(t)}};Jqe=I([m(0,lc)],Jqe);var V$i=class{constructor(i){this._repo=i;this.headBranchNameObs=ke(i=>this._repo.provider.historyProvider.read(i)?.historyItemRef.read(i)?.name);this.headCommitHashObs=ke(i=>this._repo.provider.historyProvider.read(i)?.historyItemRef.read(i)?.revision)}async isIgnored(i){return!1}};var Zqe=class extends k{constructor(e,t,o){super();this._statsEnabled=e;this._annotatedDocuments=t;this._instantiationService=o;let n=this._instantiationService.createInstance(Jqe);this._states=Pb(this,this._annotatedDocuments.documents,(r,s)=>[r.document,s.add(this._instantiationService.createInstance(Vht,r,n,this._statsEnabled))]),this.docsState=this._states.map(r=>new Map(r)),this.docsState.recomputeInitiallyAndOnChange(this._store)}};Zqe=I([m(2,F)],Zqe);var Vht=class extends k{constructor(e,t,o,n,r,s,l){super();this._doc=e;this._scm=t;this._statsEnabled=o;this._instantiationService=n;this._telemetryService=r;this._randomService=s;this._userAttentionService=l;this._repo=ke(this,f=>this._scm.getRepo(e.document.uri,f));let c=QIe(e.documentWithAnnotations,this._store),u=zc("resetSignal"),p="closed";this.longtermTracker=ke(f=>{if(!this._statsEnabled.read(f))return;u.read(f);let v=f.store.add(new _ae(c,void 0)),b=this._userAttentionService.totalFocusTimeMs,S=Date.now();return f.store.add(ee(()=>{v.isEmpty()||this.sendTelemetry("longterm",p,v,this._userAttentionService.totalFocusTimeMs-b,Date.now()-S),v.dispose()})),v}).recomputeInitiallyAndOnChange(this._store),this._store.add(new ky).cancelAndSet(()=>{p="10hours",u.trigger(void 0),p="closed"},600*60*1e3),this._store.add(ve(f=>{let v=this._repo.read(f);v&&(f.store.add(Zs(v.headCommitHashObs,()=>{p="hashChange",u.trigger(void 0),p="closed"})),f.store.add(Zs(v.headBranchNameObs,()=>{p="branchChange",u.trigger(void 0),p="closed"})))})),this._store.add(this._instantiationService.createInstance(Qqe,e.documentWithAnnotations,this._repo)),this._store.add(this._instantiationService.createInstance(Xqe,e.documentWithAnnotations,this._repo)),this._store.add(this._instantiationService.createInstance(Yqe,e.documentWithAnnotations));let h=zc("resetSignal");this.windowedTracker=ke(f=>{if(!this._statsEnabled.read(f)||!this._doc.isVisible.read(f))return;h.read(f),f.store.add(this._userAttentionService.fireAfterGivenFocusTimePassed(600*1e3,()=>{h.trigger(void 0)}));let v=f.store.add(new _ae(c,void 0)),b=this._userAttentionService.totalFocusTimeMs,S=Date.now();return f.store.add(ee(async()=>{this.sendTelemetry("10minFocusWindow","time",v,this._userAttentionService.totalFocusTimeMs-b,Date.now()-S),v.dispose()})),v}).recomputeInitiallyAndOnChange(this._store);let g=zc("focusResetSignal");this.windowedFocusTracker=ke(f=>{if(!this._statsEnabled.read(f)||!this._doc.isVisible.read(f))return;g.read(f),f.store.add(this._userAttentionService.fireAfterGivenFocusTimePassed(1200*1e3,()=>{g.trigger(void 0)}));let v=f.store.add(new _ae(c,void 0)),b=this._userAttentionService.totalFocusTimeMs,S=Date.now();return f.store.add(ee(async()=>{this.sendTelemetry("20minFocusWindow","time",v,this._userAttentionService.totalFocusTimeMs-b,Date.now()-S),v.dispose()})),v}).recomputeInitiallyAndOnChange(this._store)}async sendTelemetry(e,t,o,n,r){let s=o.getTrackedRanges(),l=o.getAllKeys();if(l.length===0)return;let c=this.getTelemetryData(s),u=this._randomService.generateUuid(),p=P$i(s,f=>f.range.length,f=>f.sourceKey),h=Object.entries(p).filter(([f,v])=>v!==void 0);h.sort(wle(Il(([f,v])=>v,Hu))),h.length=e==="longterm"?30:10;for(let f of l)p[f]||(p[f]=0);for(let[f,v]of Object.entries(p)){if(v===void 0)continue;let b=o.getRepresentative(f),S=o.getTotalInsertedCharactersCount(f);this._telemetryService.publicLog2("editTelemetry.editSources.details",{mode:e,sourceKey:f,sourceKeyCleaned:b.toKey(1,{$extensionId:!1,$extensionVersion:!1,$modelId:!1}),extensionId:b.props.$extensionId,extensionVersion:b.props.$extensionVersion,modelId:b.props.$modelId,trigger:t,languageId:this._doc.document.languageId.get(),statsUuid:u,conversationId:b.props.$$sessionId,requestId:b.props.$$requestId,modifiedCount:v,deltaModifiedCount:S,totalModifiedCount:c.totalModifiedCharactersInFinalState})}let g=await c.isTrackedByGit;this._telemetryService.publicLog2("editTelemetry.editSources.stats",{mode:e,languageId:this._doc.document.languageId.get(),statsUuid:u,nesModifiedCount:c.nesModifiedCount,inlineCompletionsCopilotModifiedCount:c.inlineCompletionsCopilotModifiedCount,inlineCompletionsNESModifiedCount:c.inlineCompletionsNESModifiedCount,otherAIModifiedCount:c.otherAIModifiedCount,unknownModifiedCount:c.unknownModifiedCount,userModifiedCount:c.userModifiedCount,ideModifiedCount:c.ideModifiedCount,totalModifiedCharacters:c.totalModifiedCharactersInFinalState,externalModifiedCount:c.externalModifiedCount,isTrackedByGit:g?1:0,focusTime:n,actualTime:r,trigger:t})}getTelemetryData(e){let t=r=>r.category==="ai"&&r.kind==="nes"?"nes":r.category==="ai"&&r.kind==="completion"&&r.extensionId==="github.copilot"||r.category==="ai"&&r.kind==="completion"&&r.extensionId==="github.copilot-chat"&&r.providerId==="completions"?"inlineCompletionsCopilot":r.category==="ai"&&r.kind==="completion"&&r.extensionId==="github.copilot-chat"&&r.providerId==="nes"?"inlineCompletionsNES":r.category==="ai"&&r.kind==="completion"?"inlineCompletionsOther":r.category==="ai"?"otherAI":r.category==="user"?"user":r.category==="ide"?"ide":r.category==="external"?"external":(r.category==="unknown","unknown"),o=P$i(e,r=>r.range.length,r=>t(r.source)),n=Pw(e,r=>r.range.length);return{nesModifiedCount:o.nes??0,inlineCompletionsCopilotModifiedCount:o.inlineCompletionsCopilot??0,inlineCompletionsNESModifiedCount:o.inlineCompletionsNES??0,otherAIModifiedCount:o.otherAI??0,userModifiedCount:o.user??0,ideModifiedCount:o.ide??0,unknownModifiedCount:o.unknown??0,externalModifiedCount:o.external??0,totalModifiedCharactersInFinalState:n,languageId:this._doc.document.languageId.get(),isTrackedByGit:this._repo.get()?.isIgnored(this._doc.document.uri)}}};Vht=I([m(3,F),m(4,_e),m(5,Tae),m(6,hzt)],Vht);var xJt="telemetry.editStats.details.enabled",kJt="telemetry.editStats.showDecorations",EJt="telemetry.editStats.showStatusBar";var e$e=class extends k{constructor(e,t,o,n,r,s,l){super();this._workspace=e;this._annotatedDocuments=t;this._configurationService=o;this._instantiationService=n;this._statusbarService=r;this._editorService=s;this._extensionService=l;this._showStateInMarkdownDoc="editTelemetry.showDebugDetails";this._toggleDecorations="editTelemetry.toggleDebugDecorations";this._editSourceTrackingShowDecorations=rMn(hr(kJt,!1,this._configurationService)),this._editSourceTrackingShowStatusBar=hr(EJt,!1,this._configurationService);let c=hr(xJt,!1,this._configurationService),u=vi(this._extensionService.onDidChangeExtensions,()=>this._extensionService.extensions),p=ke(y=>new Set(u.read(y).map(w=>w.id?.toLowerCase())));function h(y,w){let x=y.toLowerCase();return ke(E=>p.read(E).has(x))}let g=h("GitHub.copilot",this._extensionService),f=h("GitHub.copilot-chat",this._extensionService),v=ke(y=>c.read(y)||!!g.read(y)||!!f.read(y)),b=this._instantiationService.createChild(new Po([_e,this._instantiationService.createInstance(g0)])),S=this._register(b.createInstance(Zqe,v,this._annotatedDocuments));this._register(ve(y=>{if(!this._editSourceTrackingShowDecorations.read(y))return;let w=vi(this,this._editorService.onDidVisibleEditorsChange,()=>this._editorService.visibleTextEditorControls);Pb(this,w,(x,E)=>{if(x instanceof us){let M=Ds(x),N=new uX(x),V=new xy(H=>E.add(N.createClassNameRef({backgroundColor:H.getColor()})).className);E.add(M.setDecorations(ke(H=>{let K=M.model.read(H)?.uri;if(!K)return[];let j=this._workspace.getDocument(K);if(!j)return[];let J=S.docsState.read(H).get(j);return J?(J.longtermTracker.read(H)?.getTrackedRanges(H)??[]).map(ae=>({range:j.value.read(void 0).getTransformer().getRange(ae.range),options:{description:"editSourceTracking",inlineClassName:V.get(ae.source)}})):[]})))}}).recomputeInitiallyAndOnChange(y.store)})),this._register(ve(y=>{if(!this._editSourceTrackingShowStatusBar.read(y))return;let w=y.store.add(this._statusbarService.addEntry({name:"",text:"",command:this._showStateInMarkdownDoc,tooltip:"Edit Source Tracking",ariaLabel:""},"editTelemetry",1,100)),x=ke(M=>{let N=S.docsState.read(M),V=0;for(let H of N.values()){let K=H.longtermTracker.read(M);if(!K)continue;let j=H.getTelemetryData(K.getTrackedRanges(M));V+=j.totalModifiedCharactersInFinalState}return V}),E=ke(M=>{let N=S.docsState.read(M),V=[],H=[];for(let[se,ae]of N){let ce=ae.longtermTracker.read(M);if(!ce)continue;let Se=ce.getTrackedRanges(M),Re=ae.getTelemetryData(Se);if(Re.totalModifiedCharactersInFinalState===0)continue;H.push(...Se.map(He=>He.source));let xe=Object.fromEntries(Object.entries(Re).filter(([He,Ee])=>typeof Ee!="number"||Ee!==0));V.push([`### ${se.uri.fsPath}`,"```json",JSON.stringify(xe,void 0,"	"),"```",`
`].join(`
`))}let K;V.length===0?K="No modified documents":V.length<=3?K=V.join(`

`):K=`...

`+V.slice(-3).join(`

`);let j=this._createEditSourceAgenda(H),J=new he(K+`

[View Details](command:`+this._showStateInMarkdownDoc+")");return J.appendMarkdown(`

`+j+`

Toggle decorations: [Click here](command:`+this._toggleDecorations+")"),J.isTrusted={enabledCommands:[this._toggleDecorations]},J.supportHtml=!0,J});y.store.add(ve(M=>{w.update({name:"editTelemetry",text:`$(edit) ${x.read(M)} chars inserted`,ariaLabel:`Edit Source Tracking: ${x.read(M)} modified characters`,tooltip:E.read(M),command:this._showStateInMarkdownDoc})})),y.store.add(Ge.registerCommand(this._toggleDecorations,()=>{this._editSourceTrackingShowDecorations.set(!this._editSourceTrackingShowDecorations.read(void 0),void 0)}))}))}_createEditSourceAgenda(e){let t=new Set,o=[];for(let r of e)t.has(r.toString())||(t.add(r.toString()),o.push({name:r.toString(),color:r.getColor()}));return o.map(r=>`<span style="background-color:${r.color};border-radius:3px;">${r.name}</span>`).join(" ")}};e$e=I([m(2,B),m(3,F),m(4,Fr),m(5,ie),m(6,lt)],e$e);function rMn(a){let i=De("overrideObs",void 0);return r5(i,e=>i.read(e)??a.read(e),(e,t)=>{i.set(e,t)})}var TJt=class{constructor(){this._version=0;this.onDidOpenDocumentChange=Ewe({owner:this,changeTracker:{createChangeSummary:()=>({didChange:!1}),handleChange:(i,e)=>(i.didChange(this.documents)||(e.didChange=!0),!0)}},(i,e)=>{let t=this.documents.read(i);for(let o of t)o.value.read(i);return e.didChange&&this._version++,this._version});this.lastActiveDocument=ke(i=>{let e=De("lastActiveDocument",void 0);return i.store.add(ve(t=>{let o=this.documents.read(t);for(let n of o)t.store.add(Zs(n.value,()=>{e.set(n,void 0)}))})),e}).flatten()}getFirstOpenDocument(){return this.documents.get()[0]}getDocument(i){return this.documents.get().find(e=>e.uri.toString()===i.toString())}},_Jt=class a extends Ad{constructor(e,t){super(e);this.reason=t}static replace(e,t,o=sd.unknown({})){return new a([new xd(e,t)],o)}};var t$e=class extends TJt{constructor(e){super();this._textModelService=e;this._store=new O;let t=qr(this,this._textModelService.onModelAdded),o=qr(this,this._textModelService.onModelRemoved),n=ke(this,s=>(t.read(s),o.read(s),this._textModelService.getModels())),r=Pb(this,n,(s,l)=>{if(!s.isTooLargeForSyncing())return l.add(new B$i(s))}).recomputeInitiallyAndOnChange(this._store).map(s=>s.filter(so));this._documents=r}get documents(){return this._documents}dispose(){this._store.dispose()}};t$e=I([m(0,_t)],t$e);var B$i=class extends k{constructor(e){super();this.textModel=e;this._value=De(this,new _I(this.textModel.getValue())),this._version=De(this,this.textModel.getVersionId()),this._languageId=De(this,this.textModel.getLanguageId()),this._register(this.textModel.onDidChangeContent(t=>{Ki(o=>{let n=AX(t.changes);t.detailedReasons.length!==1&&mt(new Error(`Unexpected number of detailed reasons: ${t.detailedReasons.length}`));let r=new _Jt(n.replacements,t.detailedReasons[0]);this._value.set(new _I(this.textModel.getValue()),o,r),this._version.set(this.textModel.getVersionId(),o)})})),this._register(this.textModel.onDidChangeLanguage(t=>{Ki(o=>{this._languageId.set(this.textModel.getLanguageId(),o)})}))}get uri(){return this.textModel.uri}get value(){return this._value}get version(){return this._version}get languageId(){return this._languageId}};var DJt="telemetry.editStats.enabled",i$e="editor.aiStats.enabled";function sMn(a){let i=new Map;for(let e of a){let t=new Date(e.startTime),o=t.toISOString().split("T")[0],n=t.toLocaleDateString(void 0,{month:"short",day:"numeric"}),r=i.get(o);r||(r={date:o,displayDate:n,aiRate:0,totalAiChars:0,totalTypedChars:0,inlineSuggestions:0,chatEdits:0,sessionCount:0},i.set(o,r)),r.totalAiChars+=e.aiCharacters,r.totalTypedChars+=e.typedCharacters,r.inlineSuggestions+=e.acceptedInlineSuggestions??0,r.chatEdits+=e.chatEditCount??0,r.sessionCount+=1}for(let e of i.values()){let t=e.totalAiChars+e.totalTypedChars;e.aiRate=t>0?e.totalAiChars/t:0}return Array.from(i.values()).sort((e,t)=>e.date.localeCompare(t.date))}function SBo(a){let{sessions:i,viewMode:e}=a,t=280,o=100,n={top:10,right:10,bottom:25,left:30},r=t-n.left-n.right,s=o-n.top-n.bottom,l=_(".ai-stats-chart-container");l.style.position="relative",l.style.marginTop="8px";let c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.setAttribute("width",`${t}px`),c.setAttribute("height",`${o}px`),c.setAttribute("viewBox",`0 0 ${t} ${o}`),c.style.display="block",l.appendChild(c);let u=document.createElementNS("http://www.w3.org/2000/svg","g");if(u.setAttribute("transform",`translate(${n.left},${n.top})`),c.appendChild(u),i.length===0){let v=document.createElementNS("http://www.w3.org/2000/svg","text");return v.setAttribute("x",`${r/2}`),v.setAttribute("y",`${s/2}`),v.setAttribute("text-anchor","middle"),v.setAttribute("fill",Tt(OCe)),v.setAttribute("font-size","11px"),v.textContent=d(11248,null),u.appendChild(v),l}let p=document.createElementNS("http://www.w3.org/2000/svg","line");p.setAttribute("x1","0"),p.setAttribute("y1",`${s}`),p.setAttribute("x2",`${r}`),p.setAttribute("y2",`${s}`),p.setAttribute("stroke",Tt(XIt)),p.setAttribute("stroke-width","1px"),u.appendChild(p);let h=document.createElementNS("http://www.w3.org/2000/svg","line");h.setAttribute("x1","0"),h.setAttribute("y1","0"),h.setAttribute("x2","0"),h.setAttribute("y2",`${s}`),h.setAttribute("stroke",Tt(XIt)),h.setAttribute("stroke-width","1px"),u.appendChild(h);for(let v of[0,50,100]){let b=s-v/100*s,S=document.createElementNS("http://www.w3.org/2000/svg","text");if(S.setAttribute("x","-4"),S.setAttribute("y",`${b+3}`),S.setAttribute("text-anchor","end"),S.setAttribute("fill",Tt(OCe)),S.setAttribute("font-size","9px"),S.textContent=`${v}%`,u.appendChild(S),v>0){let y=document.createElementNS("http://www.w3.org/2000/svg","line");y.setAttribute("x1","0"),y.setAttribute("y1",`${b}`),y.setAttribute("x2",`${r}`),y.setAttribute("y2",`${b}`),y.setAttribute("stroke",Tt(XIt)),y.setAttribute("stroke-width","0.5px"),y.setAttribute("stroke-dasharray","2,2"),u.appendChild(y)}}e==="days"?g():f();function g(){let v=sMn(i),b=v.length,S=Math.min(20,(r-(b-1)*2)/b),y=2,w=b*S+(b-1)*y,x=(r-w)/2,E=40,N=Math.max(2,Math.floor(w/E)),V=Math.max(1,Math.ceil(b/N));v.forEach((H,K)=>{let j=x+K*(S+y),J=H.aiRate*s,se=s-J,ae=document.createElementNS("http://www.w3.org/2000/svg","rect");ae.setAttribute("x",`${j}`),ae.setAttribute("y",`${se}`),ae.setAttribute("width",`${S}`),ae.setAttribute("height",`${Math.max(1,J)}`),ae.setAttribute("fill",Tt(O3e)),ae.setAttribute("rx","2"),u.appendChild(ae);let ce=K===0,Se=K===b-1,Re=K%V===0;if(ce||Se||Re&&b>2){if(!ce&&!Se){let He=K*(S+y),Ee=(b-1-K)*(S+y);if(He<E||Ee<E)return}let xe=document.createElementNS("http://www.w3.org/2000/svg","text");xe.setAttribute("x",`${j+S/2}`),xe.setAttribute("y",`${s+12}`),xe.setAttribute("text-anchor","middle"),xe.setAttribute("fill",Tt(OCe)),xe.setAttribute("font-size","8px"),xe.textContent=H.displayDate,u.appendChild(xe)}})}function f(){let v=i.length,b=Math.min(8,(r-(v-1)*1)/v),S=1,y=v*b+(v-1)*S,w=(r-y)/2;i.forEach((H,K)=>{let j=H.aiCharacters+H.typedCharacters,J=j>0?H.aiCharacters/j:0,se=w+K*(b+S),ae=J*s,ce=s-ae,Se=document.createElementNS("http://www.w3.org/2000/svg","rect");Se.setAttribute("x",`${se}`),Se.setAttribute("y",`${ce}`),Se.setAttribute("width",`${b}`),Se.setAttribute("height",`${Math.max(1,ae)}`),Se.setAttribute("fill",Tt(O3e)),Se.setAttribute("rx","1"),u.appendChild(Se)});let x=40;if(v===0)return;let E=i[0],M=w,N=new Date(E.startTime),V=document.createElementNS("http://www.w3.org/2000/svg","text");if(V.setAttribute("x",`${M+b/2}`),V.setAttribute("y",`${s+12}`),V.setAttribute("text-anchor","start"),V.setAttribute("fill",Tt(OCe)),V.setAttribute("font-size","8px"),V.textContent=N.toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(V),v>1&&y>=x){let H=i[v-1],K=w+(v-1)*(b+S),j=new Date(H.startTime),J=document.createElementNS("http://www.w3.org/2000/svg","text");J.setAttribute("x",`${K+b/2}`),J.setAttribute("y",`${s+12}`),J.setAttribute("text-anchor","end"),J.setAttribute("fill",Tt(OCe)),J.setAttribute("font-size","8px"),J.textContent=j.toLocaleDateString(void 0,{month:"short",day:"numeric"}),u.appendChild(J)}}return l}var o$e=class extends k{constructor(e,t,o,n){super();this._aiStatsFeature=e;this._statusbarService=t;this._commandService=o;this._telemetryService=n;this._register(ve(r=>{let s=this._createStatusBar().keepUpdated(r.store),l=this._register(new O);r.store.add(this._statusbarService.addEntry({name:d(11253,null),ariaLabel:d(11254,null),text:"",tooltip:{element:async c=>(this._sendHoverTelemetry(),l.clear(),aMn({data:this._aiStatsFeature,onOpenSettings:()=>cMn({ids:[i$e]}).run(this._commandService)}).keepUpdated(l).element),markdownNotSupportedFallback:void 0},content:s.element},"aiStatsStatusBar",1,100))}))}static{this.hot=TK(this)}_sendHoverTelemetry(){this._telemetryService.publicLog2("aiStatsStatusBar.hover",{aiRate:this._aiStatsFeature.aiRate.get()})}_createStatusBar(){return $o.div({style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",marginLeft:"3px",marginRight:"3px"}},[$o.div({class:"ai-stats-status-bar",style:{display:"flex",flexDirection:"column",width:50,height:6,borderRadius:6,borderWidth:"1px",borderStyle:"solid"}},[$o.div({style:{flex:1,display:"flex",overflow:"hidden",borderRadius:6,border:"1px solid transparent"}},[$o.div({style:{width:this._aiStatsFeature.aiRate.map(e=>`${e*100}%`),backgroundColor:"currentColor"}})])])])}};o$e=I([m(1,Fr),m(2,fe),m(3,_e)],o$e);function aMn(a){let i=De("chartViewMode","days"),e=a.data.aiRate.map(o=>`${Math.round(o*100)}%`),t=(o,n,r)=>ke(s=>{let c=i.read(s)===o;return $o.div({class:["chart-toggle-button",c?"active":""],style:{padding:"2px 4px",borderRadius:"3px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},onclick:()=>{i.set(o,void 0)},title:n},[$o.div({class:q.asClassName(r),style:{fontSize:"14px"}})])});return $o.div({class:"ai-stats-status-bar"},[$o.div({class:"header",style:{minWidth:"280px"}},[$o.div({style:{flex:1}},[d(11250,null)]),$o.div({style:{marginLeft:"auto"}},a.onOpenSettings?lMn([{action:{id:"aiStats.statusBar.settings",label:"",enabled:!0,run:a.onOpenSettings,class:q.asClassName(L.gear),tooltip:d(11249,null)},options:{icon:!0,label:!1,hoverDelegate:rC}}]):[])]),$o.div({style:{display:"flex"}},[$o.div({style:{flex:1,paddingRight:"4px"}},[d(11255,null,e.get())])]),$o.div({style:{flex:1,paddingRight:"4px"}},[d(11256,null,a.data.acceptedInlineSuggestionsToday.get())]),$o.div({style:{marginTop:"8px",borderTop:"1px solid var(--vscode-widget-border)",paddingTop:"8px"}},[$o.div({class:"header",style:{display:"flex",alignItems:"center",marginBottom:"4px"}},[$o.div({style:{flex:1}},[i.map(o=>o==="days"?d(11251,null):d(11252,null))]),$o.div({class:"chart-view-toggle",style:{marginLeft:"auto",display:"flex",gap:"2px"}},[t("days",d(11257,null),L.calendar),t("sessions",d(11258,null),L.listFlat)])]),ke(o=>{let n=a.data.sessions.read(o),r=i.read(o);return $o.div({ref:s=>{let l=SBo({sessions:n,viewMode:r});s.appendChild(l)}})})])])}function lMn(a,i){return ke(e=>$o.div({class:[],style:{},ref:t=>{let o=e.store.add(new oo(t,i));for(let{action:n,options:r}of a)o.push(n,r)}}))}var H$i=class{constructor(i,e=[]){this.commandId=i;this.args=e}run(i){i.executeCommand(this.commandId,...this.args)}};function cMn(a={}){return new H$i("workbench.action.openSettings",[{query:a.ids?a.ids.map(i=>`@id:${i}`).join(" "):void 0}])}var n$e=class extends k{constructor(e,t,o){super();this._storageService=t;this._instantiationService=o;this._dataVersion=De(this,0);this.aiRate=this._dataVersion.map(()=>{let e=this._data.getValue();return e?dMn(e.sessions,o=>{let n=o.typedCharacters+o.aiCharacters;return n===0?0:o.aiCharacters/n}):0});this.sessionCount=ke(this,e=>{this._dataVersion.read(e);let t=this._data.getValue();return t?t.sessions.length:0});this.sessions=ke(this,e=>{this._dataVersion.read(e);let t=this._data.getValue();return t?t.sessions:[]});this.acceptedInlineSuggestionsToday=ke(this,e=>{this._dataVersion.read(e);let t=this._data.getValue();if(!t)return 0;let o=new Date;o.setHours(0,0,0,0);let n=t.sessions.filter(r=>r.startTime>o.getTime());return Pw(n,r=>r.acceptedInlineSuggestions??0)});let n=pMn(this._storageService,"aiStats",1,0);this._data=uMn(n,1/60,this._store),this.aiRate.recomputeInitiallyAndOnChange(this._store),this._register(ve(l=>{l.store.add(this._instantiationService.createInstance(o$e.hot.read(l),this))}));let r=[];Pb(this,e.documents,(l,c)=>{c.add(Zs(l.documentWithAnnotations.value,(u,p,h)=>{let g=Fy.compose(h.map(v=>v.edit)),f=new uo(()=>this._getDataAndSession());for(let v of g.replacements)VXi(v.data.editSource)?f.value.currentSession.aiCharacters+=v.newText.length:BXi(v.data.editSource)&&(f.value.currentSession.typedCharacters+=v.newText.length);if(g.replacements.length>0){let v=f.value.currentSession,b=g.replacements[0].data.editSource;b.metadata.source==="inlineCompletionAccept"&&(v.acceptedInlineSuggestions===void 0&&(v.acceptedInlineSuggestions=0),v.acceptedInlineSuggestions+=1),b.metadata.source==="Chat.applyEdits"&&b.metadata.$$requestId!==void 0&&(r.includes(b.metadata.$$requestId)||(r.push(b.metadata.$$requestId),r.length>10&&r.shift(),v.chatEditCount===void 0&&(v.chatEditCount=0),v.chatEditCount+=1))}f.hasValue&&(this._data.writeValue(f.value.data),this._dataVersion.set(this._dataVersion.get()+1,void 0))}))}).recomputeInitiallyAndOnChange(this._store)}_getDataAndSession(){let e=this._data.getValue()??{sessions:[]},t=300*1e3,o=e.sessions.at(-1),n=Date.now();if(!o||n-o.startTime>t){e.sessions.push({startTime:n,typedCharacters:0,aiCharacters:0,acceptedInlineSuggestions:0,chatEditCount:0}),o=e.sessions.at(-1);let r=1440*60*1e3;for(;e.sessions.length>r/t;)e.sessions.shift()}return{data:e,currentSession:o}}};n$e=I([m(1,de),m(2,F)],n$e);function dMn(a,i){return a.length===0?0:Pw(a,i)/a.length}function uMn(a,i,e){let t=new fwe,o,n=0,r=0;return e.add(ee(()=>{n!==r&&(a.writeValue(o),r=n)})),{writeValue(s){n++;let l=n;o=s,t.clearPending(),t.schedule(async()=>{a.writeValue(s),r=l,await Li(5e3)})},getValue(){return n>0?o:a.getValue()}}}function pMn(a,i,e,t){let o,n=!1;return{writeValue(r){r===void 0?a.remove(i,e):a.store(i,JSON.stringify(r),e,t),o=r},getValue(){if(n)return o;let r=a.get(i,e);return o=r===void 0?void 0:JSON.parse(r),n=!0,o}}}var RJt=class extends k{constructor(e){super();this._trackers=new dt;this._documentsByUri=new dt;this._register(ve(t=>{let o=e.documents.read(t),n=new dt;for(let r of o){let s=r.document.uri;n.set(s,!0),this._documentsByUri.set(s,r),this._trackers.has(s)||this._trackers.set(s,this._createTrackerEntry(r))}for(let[r,s]of this._trackers)n.has(r)||(s.trackerStore.dispose(),this._trackers.delete(r),this._documentsByUri.delete(r))})),this._register(Ge.registerCommand("_aiEdits.hasAiContributions",(t,o,n)=>this._hasAiContributions(o,n))),this._register(Ge.registerCommand("_aiEdits.clearAiContributions",(t,o)=>{this._clearAiContributions(o)})),this._register(Ge.registerCommand("_aiEdits.clearAllAiContributions",()=>{this._clearAiContributions()}))}dispose(){for(let[,e]of this._trackers)e.trackerStore.dispose();super.dispose()}_createTrackerEntry(e){let t=new O,o=QIe(e.documentWithAnnotations,t),n=t.add(new _ae(o,void 0));return{trackerStore:t,tracker:n}}_hasAiContributions(e,t){for(let o of e){let n=this._trackers.get(A.revive(o));if(n){for(let r of n.tracker.getTrackedRanges())if(r.source.category==="ai"&&(t==="all"||r.source.feature==="chat"))return!0}}return!1}_clearAiContributions(e){let t=e?e.map(o=>A.revive(o)):[...this._trackers.keys()];for(let o of t){let n=this._trackers.get(o);if(n){n.trackerStore.dispose();let r=this._documentsByUri.get(o);r?this._trackers.set(o,this._createTrackerEntry(r)):(this._trackers.delete(o),this._documentsByUri.delete(o))}}}};var r$e=class extends k{constructor(i,e,t,o){super();let n=ke(u=>u.store.add(i.createInstance(t$e))),r=ke(u=>u.store.add(i.createInstance(jqe,n.read(u)))),s=hr(DJt,!0,e);this._register(ve(u=>{!s.read(u)||!BQi(t,3)||u.store.add(i.createInstance(e$e,n.read(u),r.read(u)))}));let l=hr(i$e,!0,e);this._register(ve(u=>{let p=l.read(u),h=o.sentimentObs.read(u).hidden;!p||h||u.store.add(i.createInstance(n$e,r.read(u)))})),this._register(Ge.registerCommand("_aiEdits.hasAiContributions",()=>!1)),this._register(Ge.registerCommand("_aiEdits.clearAiContributions",()=>{})),this._register(Ge.registerCommand("_aiEdits.clearAllAiContributions",()=>{}));let c=hr("git.addAICoAuthor","off",e);this._register(ve(u=>{c.read(u)==="off"||o.sentimentObs.read(u).hidden||u.store.add(i.createInstance(RJt,r.read(u)))}))}};r$e=I([m(0,F),m(1,B),m(2,_e),m(3,dr)],r$e);var s$e=class{constructor(i,e){this.instantiationService=i;this._randomService=e;this._telemetryService=this.instantiationService.createInstance(g0)}createSuggestionId(i){let e=Kai.newId(t=>this._randomService.generatePrefixedUuid(t));return this._telemetryService.publicLog2("editTelemetry.codeSuggested",{eventId:this._randomService.generatePrefixedUuid("evt"),suggestionId:e,presentation:i.presentation,feature:i.feature,sourceExtensionId:i.source?.extensionId,sourceExtensionVersion:i.source?.extensionVersion,sourceProviderId:i.source?.providerId,languageId:i.languageId,editCharsInserted:i.editDeltaInfo?.charsAdded,editCharsDeleted:i.editDeltaInfo?.charsRemoved,editLinesInserted:i.editDeltaInfo?.linesAdded,editLinesDeleted:i.editDeltaInfo?.linesRemoved,modeId:i.modeId,modelId:Wwe(i.modelId),applyCodeBlockSuggestionId:i.applyCodeBlockSuggestionId,sourceRequestId:i.sourceRequestId,...aH(f0(i.source?.extensionId))}),e}handleCodeAccepted(i){this._telemetryService.publicLog2("editTelemetry.codeAccepted",{eventId:this._randomService.generatePrefixedUuid("evt"),suggestionId:i.suggestionId,presentation:i.presentation,feature:i.feature,sourceExtensionId:i.source?.extensionId,sourceExtensionVersion:i.source?.extensionVersion,sourceProviderId:i.source?.providerId,languageId:i.languageId,editCharsInserted:i.editDeltaInfo?.charsAdded,editCharsDeleted:i.editDeltaInfo?.charsRemoved,editLinesInserted:i.editDeltaInfo?.linesAdded,editLinesDeleted:i.editDeltaInfo?.linesRemoved,modeId:i.modeId,modelId:Wwe(i.modelId),applyCodeBlockSuggestionId:i.applyCodeBlockSuggestionId,sourceRequestId:i.sourceRequestId,acceptanceMethod:i.acceptanceMethod,...aH(f0(i.source?.extensionId))})}handleCodeRejected(i){this._telemetryService.publicLog2("editTelemetry.codeRejected",{eventId:this._randomService.generatePrefixedUuid("evt"),suggestionId:i.suggestionId,presentation:i.presentation,feature:i.feature,sourceExtensionId:i.source?.extensionId,sourceExtensionVersion:i.source?.extensionVersion,sourceProviderId:i.source?.providerId,languageId:i.languageId,editCharsInserted:i.editDeltaInfo?.charsAdded,editCharsDeleted:i.editDeltaInfo?.charsRemoved,editLinesInserted:i.editDeltaInfo?.linesAdded,editLinesDeleted:i.editDeltaInfo?.linesRemoved,modeId:i.modeId,modelId:Wwe(i.modelId),applyCodeBlockSuggestionId:i.applyCodeBlockSuggestionId,sourceRequestId:i.sourceRequestId,rejectionMethod:i.rejectionMethod,...aH(f0(i.source?.extensionId))})}};s$e=I([m(0,F),m(1,Tae)],s$e);bt("EditTelemetryContribution",r$e,vt.AfterRestored);var mMn=oe.as($t.Configuration);mMn.registerConfiguration({id:"task",order:100,title:d(11260,null),type:"object",properties:{[DJt]:{markdownDescription:d(11262,null),type:"boolean",default:!0,tags:["experimental"],experiment:{mode:"auto"}},[i$e]:{markdownDescription:d(11259,null),type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"}},[xJt]:{markdownDescription:d(11261,null),type:"boolean",default:!1,tags:["experimental"],experiment:{mode:"auto"}},[EJt]:{markdownDescription:d(11264,null),type:"boolean",default:!1,tags:["experimental"]},[kJt]:{markdownDescription:d(11263,null),type:"boolean",default:!1,tags:["experimental"]}}});Ce(XS,s$e,1);Ce(Tae,CJt,1);var a$e=class extends k{constructor(e,t,o,n){super();this.commandService=t;this.fileService=o;this.workspaceContextService=n;this._register(e.registerOpener(this))}static{this.ID="workbench.contrib.opener"}async open(e,t){try{if(t?.openExternal)return!1;let o=typeof e=="string"?A.parse(e):e;if(this.workspaceContextService.isInsideWorkspace(o)&&(await this.fileService.stat(o)).isDirectory)return await this.commandService.executeCommand(sV,o),!0}catch{}return!1}};a$e=I([m(0,Je),m(1,fe),m(2,ge),m(3,Ae)],a$e);bt(a$e.ID,a$e,vt.Eventually);Ce(vw,KAe,1);Ce(Mm,GAe,1);Ce(uq,zAe,1);Ce(x2,iq,1);Ce(hG,DC,1);Ce(qn,vzt,1);Ce(Co,STt,1);Ce(Yz,FAe,1);Ce(ha,bzt,1);Ce(X,WAe,1);Ce(Gn,BAe,1);Ce(aW,HAe,1);Ce(Je,UAe,1);Ce(Bw,$Nt,1);Ce(pq,qAe,1);Ce(fP,$Ae,1);hs((a,i)=>{let e=_0(a);i.addRule(`.monaco-workbench { background-color: ${e}; }`);let t=a.getColor(KIt);if(t&&i.addRule(`.monaco-workbench ::selection { background-color: ${t}; }`),Ft){let o=a.getColor(uZ);if(o){let n="monaco-workbench-meta-theme-color",r=ut.document.getElementById(n);r||(r=Obt(),r.name="theme-color",r.id=n),r.content=o.toString()}}_S&&i.addRule(`
			body.web {
				touch-action: none;
			}
			.monaco-workbench .monaco-editor .view-lines {
				user-select: text;
				-webkit-user-select: text;
			}
		`),Tc&&owe()&&i.addRule(`body { background-color: ${e}; }`)});var LJt="notifications.showList",XIe="notifications.hideList",IBo="notifications.toggleList",U$i="notifications.hideToasts",yBo="notifications.focusToasts",hMn="notifications.focusNextToast",gMn="notifications.focusPreviousToast",fMn="notifications.focusFirstToast",vMn="notifications.focusLastToast",MJt="notification.collapse",PJt="notification.expand",wBo="notification.acceptPrimaryAction",bMn="notification.toggle",AJt="notification.clear",Bht="notifications.clearAll",Hht="notifications.toggleDoNotDisturbMode",Uht="notifications.toggleDoNotDisturbModeBySource";function Dae(a,i){if(qWt(i))return i;let e=a.lastFocusedList;if(e instanceof bc){let t=e.getFocusedElements()[0];if(qWt(t)||e.isDOMFocused()&&(t=e.element(0)),qWt(t))return t}}function CBo(a,i,e){xt.registerCommandAndKeybindingRule({id:LJt,weight:200,primary:Gi(2089,3116),handler:()=>{i.hide(),a.show()}}),xt.registerCommandAndKeybindingRule({id:XIe,weight:250,when:CYe,primary:9,handler:()=>a.hide()}),Ge.registerCommand(IBo,()=>{a.isVisible?a.hide():(i.hide(),a.show())}),xt.registerCommandAndKeybindingRule({id:AJt,weight:200,when:YD,primary:20,mac:{primary:2049},handler:(o,n)=>{let r=o.get(br),s=Dae(o.get(Co),n);s&&!s.hasProgress&&(s.close(),r.playSignal(tn.clear))}}),xt.registerCommandAndKeybindingRule({id:PJt,weight:200,when:YD,primary:17,handler:(o,n)=>{Dae(o.get(Co),n)?.expand()}}),xt.registerCommandAndKeybindingRule({id:wBo,weight:201,when:C.or(YD,kH),primary:3103,handler:o=>{let n=o.get(F).createInstance(R7),r=Dae(o.get(Co))||e.notifications.at(0);if(!r)return;let s=r.actions?.primary?r.actions.primary.at(0):void 0;s&&(n.run(s,r),r.close(),n.dispose())}}),xt.registerCommandAndKeybindingRule({id:MJt,weight:200,when:YD,primary:15,handler:(o,n)=>{Dae(o.get(Co),n)?.collapse()}}),xt.registerCommandAndKeybindingRule({id:bMn,weight:200,when:YD,primary:10,secondary:[3],handler:o=>{Dae(o.get(Co))?.toggle()}}),Ge.registerCommand(U$i,o=>{i.hide()}),xt.registerKeybindingRule({id:U$i,weight:150,when:kH,primary:9}),xt.registerKeybindingRule({id:U$i,weight:300,when:C.and(kH,YD),primary:9}),Ge.registerCommand(yBo,()=>i.focus()),xt.registerCommandAndKeybindingRule({id:hMn,weight:200,when:C.and(YD,kH),primary:18,handler:()=>{i.focusNext()}}),xt.registerCommandAndKeybindingRule({id:gMn,weight:200,when:C.and(YD,kH),primary:16,handler:()=>{i.focusPrevious()}}),xt.registerCommandAndKeybindingRule({id:fMn,weight:200,when:C.and(YD,kH),primary:11,secondary:[14],handler:()=>{i.focusFirst()}}),xt.registerCommandAndKeybindingRule({id:vMn,weight:200,when:C.and(YD,kH),primary:12,secondary:[13],handler:()=>{i.focusLast()}}),Ge.registerCommand(Bht,()=>a.clearAll()),Ge.registerCommand(Hht,o=>{let n=o.get(Ne);n.setFilter(n.getFilter()===1?0:1)}),Ge.registerCommand(Uht,o=>{let n=o.get(Ne),r=o.get($e),s=n.getFilters().sort((u,p)=>u.label.localeCompare(p.label)),l=new O,c=l.add(r.createQuickPick());c.items=s.map(u=>({id:u.id,label:u.label,tooltip:`${u.label} (${u.id})`,filter:u.filter})),c.canSelectMany=!0,c.placeholder=d(5016,null),c.selectedItems=c.items.filter(u=>u.filter===0),c.show(),l.add(c.onDidAccept(async()=>{for(let u of c.items)n.setFilter({id:u.id,label:u.label,filter:c.selectedItems.includes(u)?0:1});c.hide()})),l.add(c.onDidHide(()=>l.dispose()))});let t=P(5012,"Notifications");be.appendMenuItem(R.CommandPalette,{command:{id:LJt,title:P(5017,"Show Notifications"),category:t}}),be.appendMenuItem(R.CommandPalette,{command:{id:XIe,title:P(5011,"Hide Notifications"),category:t},when:CYe}),be.appendMenuItem(R.CommandPalette,{command:{id:Bht,title:P(5009,"Clear All Notifications"),category:t}}),be.appendMenuItem(R.CommandPalette,{command:{id:wBo,title:P(5008,"Accept Notification Primary Action"),category:t}}),be.appendMenuItem(R.CommandPalette,{command:{id:Hht,title:P(5018,"Toggle Do Not Disturb Mode"),category:t}}),be.appendMenuItem(R.CommandPalette,{command:{id:Uht,title:P(5019,"Toggle Do Not Disturb Mode By Source..."),category:t}}),be.appendMenuItem(R.CommandPalette,{command:{id:yBo,title:P(5010,"Focus Notification Toast"),category:t},when:kH}),be.appendMenuItem(R.TitleBar,{command:{id:IBo,title:d(5020,null),icon:L.bell},group:"navigation",order:1e4,when:C.and(C.equals("config.workbench.notifications.position","top-right"),C.equals("config.workbench.notifications.showInTitleBar",!0))})}W(class extends z{constructor(){super({id:"workbench.action.setNotificationsPosition.bottomRight",title:P(5014,"Bottom Right"),toggled:C.equals("config.workbench.notifications.position","bottom-right"),menu:{id:R.NotificationsCenterPositionMenu,order:1}})}run(i){i.get(B).updateValue("workbench.notifications.position","bottom-right")}});W(class extends z{constructor(){super({id:"workbench.action.setNotificationsPosition.bottomLeft",title:P(5013,"Bottom Left"),toggled:C.equals("config.workbench.notifications.position","bottom-left"),menu:{id:R.NotificationsCenterPositionMenu,order:2}})}run(i){i.get(B).updateValue("workbench.notifications.position","bottom-left")}});W(class extends z{constructor(){super({id:"workbench.action.setNotificationsPosition.topRight",title:P(5015,"Top Right"),toggled:C.equals("config.workbench.notifications.position","top-right"),menu:{id:R.NotificationsCenterPositionMenu,order:3}})}run(i){i.get(B).updateValue("workbench.notifications.position","top-right")}});var R7=class extends cs{constructor(e,t){super();this.telemetryService=e;this.notificationService=t}async runAction(e,t){this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.id,from:"message"});try{await super.runAction(e,t)}catch(o){this.notificationService.error(o)}}};R7=I([m(0,_e),m(1,Ne)],R7);var SMn=Oe("notifications-clear",L.close,d(4977,null)),IMn=Oe("notifications-clear-all",L.clearAll,d(4976,null)),z$i=Oe("notifications-hide",L.chevronDown,d(4992,null)),xBo=Oe("notifications-hide-up",L.chevronUp,d(4994,null)),kBo=Oe("notifications-expand",L.chevronUp,d(4990,null)),yMn=Oe("notifications-expand-down",L.chevronDown,d(4989,null)),EBo=Oe("notifications-collapse",L.chevronDown,d(4980,null)),wMn=Oe("notifications-collapse-up",L.chevronUp,d(4982,null)),CMn=Oe("notifications-configure",L.gear,d(4984,null)),TBo=Oe("notifications-do-not-disturb",L.bellSlash,d(4988,null)),xMn=Oe("notifications-position",L.arrowSwap,d(4995,null));function _Bo(a){return a==="top-right"?yMn:kBo}function DBo(a){return a==="top-right"?wMn:EBo}var Rae=class extends it{constructor(e,t,o){super(e,t,q.asClassName(SMn));this.commandService=o}static{this.ID=AJt}static{this.LABEL=d(4978,null)}async run(e){this.commandService.executeCommand(AJt,e)}};Rae=I([m(2,fe)],Rae);var Lae=class extends it{constructor(e,t,o){super(e,t,q.asClassName(IMn));this.commandService=o}static{this.ID=Bht}static{this.LABEL=d(4979,null)}async run(){this.commandService.executeCommand(Bht)}};Lae=I([m(2,fe)],Lae);var JIe=class extends it{constructor(e,t,o){super(e,t,q.asClassName(TBo));this.commandService=o}static{this.ID=Hht}static{this.LABEL=d(4996,null)}async run(){this.commandService.executeCommand(Hht)}};JIe=I([m(2,fe)],JIe);var ZIe=class extends it{constructor(e,t,o){super(e,t);this.commandService=o}static{this.ID=Uht}static{this.LABEL=d(4997,null)}async run(){this.commandService.executeCommand(Uht)}};ZIe=I([m(2,fe)],ZIe);var eye=class extends it{static{this.ID="workbench.action.configureDoNotDisturbMode"}static{this.LABEL=d(4983,null)}constructor(i,e){super(i,e,q.asClassName(TBo))}},tye=class extends it{static{this.ID="workbench.action.configureNotificationsPosition"}static{this.LABEL=d(4986,null)}constructor(i,e){super(i,e,q.asClassName(xMn))}},Mae=class extends it{constructor(e,t,o){super(e,t,q.asClassName(z$i));this.commandService=o}static{this.ID=XIe}static{this.LABEL=d(4993,null)}async run(){this.commandService.executeCommand(XIe)}};Mae=I([m(2,fe)],Mae);var Pae=class extends it{constructor(e,t,o){super(e,t,q.asClassName(kBo));this.commandService=o}static{this.ID=PJt}static{this.LABEL=d(4991,null)}async run(e){this.commandService.executeCommand(PJt,e)}};Pae=I([m(2,fe)],Pae);var Aae=class extends it{constructor(e,t,o){super(e,t,q.asClassName(EBo));this.commandService=o}static{this.ID=MJt}static{this.LABEL=d(4981,null)}async run(e){this.commandService.executeCommand(MJt,e)}};Aae=I([m(2,fe)],Aae);var iye=class extends it{constructor(e,t,o){super(e,t,q.asClassName(CMn));this.notification=o}static{this.ID="workbench.action.configureNotification"}static{this.LABEL=d(4985,null)}},Nae=class extends it{constructor(e,t,o){super(e,t);this.clipboardService=o}static{this.ID="workbench.action.copyNotificationMessage"}static{this.LABEL=d(4987,null)}run(e){return this.clipboardService.writeText(e.message.raw)}};Nae=I([m(2,Bi)],Nae);var NJt=class a{static{this.ROW_HEIGHT=42}static{this.LINE_HEIGHT=22}constructor(i){this.offsetHelper=this.createOffsetHelper(i)}createOffsetHelper(i){return i.appendChild(_(".notification-offset-helper"))}getHeight(i){if(!i.expanded)return a.ROW_HEIGHT;let e=a.ROW_HEIGHT,t=this.computePreferredHeight(i);if(a.LINE_HEIGHT<t){let n=t-a.LINE_HEIGHT;e+=n}return(i.source||Rr(i.actions?.primary))&&(e+=a.ROW_HEIGHT),e===a.ROW_HEIGHT&&i.collapse(!0),e}computePreferredHeight(i){let e=0;i.hasProgress||e++,i.canCollapse&&e++,Rr(i.actions?.secondary)&&e++,this.offsetHelper.style.width=`${450-(40+e*30-Math.max(e-1,0)*4)}px`;let t=OJt.render(i.message);this.offsetHelper.appendChild(t);let o=Math.max(this.offsetHelper.offsetHeight,this.offsetHelper.scrollHeight);return St(this.offsetHelper),o}getTemplateId(i){if(i instanceof gMe)return L7.TEMPLATE_ID;throw new Error("unknown element type: "+i)}},OJt=class{static render(i,e){let t=_("span");for(let o of i.linkedText.nodes)if(typeof o=="string")t.appendChild(document.createTextNode(o));else{let n=o.title;!n&&o.href.startsWith("command:")?n=d(5042,null,o.href.substr(8)):n||(n=o.href);let r=_("a",{href:o.href,title:n,tabIndex:0},o.label);if(e){let s=h=>{Vbt(h)&&Kt.stop(h,!0),e.callback(o.href)},l=e.toDispose.add(new Zn(r,ne.CLICK)).event,c=e.toDispose.add(new Zn(r,ne.KEY_DOWN)).event,u=U.chain(c,h=>h.filter(g=>{let f=new mi(g);return f.equals(10)||f.equals(3)}));e.toDispose.add(ds.addTarget(r));let p=e.toDispose.add(new Zn(r,Vn.Tap)).event;U.any(l,p,u)(s,null,e.toDispose)}t.appendChild(r)}return t}},L7=class{constructor(i,e,t,o){this.actionRunner=i;this.contextMenuService=e;this.instantiationService=t;this.notificationService=o}static{this.TEMPLATE_ID="notification"}get templateId(){return L7.TEMPLATE_ID}renderTemplate(i){let e=Object.create(null);e.toDispose=new O,e.container=_(".notification-list-item"),e.mainRow=_(".notification-list-item-main-row"),e.icon=_(".notification-list-item-icon.codicon"),e.message=_(".notification-list-item-message");let t=this,o=_(".notification-list-item-toolbar-container");return e.toolbar=new oo(o,{ariaLabel:d(5043,null),actionViewItemProvider:(n,r)=>{if(n instanceof iye)return e.toDispose.add(new rh(n,{getActions(){let s=[],l={id:n.notification.sourceId,label:n.notification.source};if(yX(l)){let c=t.notificationService.getFilter(l)===1;s.push(li({id:l.id,label:c?d(5046,null,l.label):d(5045,null,l.label),run:()=>t.notificationService.setFilter({...l,filter:c?0:1})})),n.notification.actions?.secondary?.length&&s.push(new oi)}return Array.isArray(n.notification.actions?.secondary)&&s.push(...n.notification.actions.secondary),s}},this.contextMenuService,{...r,actionRunner:this.actionRunner,classNames:n.class}))},actionRunner:this.actionRunner}),e.toDispose.add(e.toolbar),e.detailsRow=_(".notification-list-item-details-row"),e.source=_(".notification-list-item-source"),e.buttonsContainer=_(".notification-list-item-buttons-container"),i.appendChild(e.container),e.container.appendChild(e.detailsRow),e.detailsRow.appendChild(e.source),e.detailsRow.appendChild(e.buttonsContainer),e.container.appendChild(e.mainRow),e.mainRow.appendChild(e.icon),e.mainRow.appendChild(e.message),e.mainRow.appendChild(o),e.progress=new Cv(i,oC),e.toDispose.add(e.progress),e.renderer=this.instantiationService.createInstance(ZC,e,this.actionRunner),e.toDispose.add(e.renderer),e}renderElement(i,e,t){t.renderer.setInput(i)}disposeTemplate(i){je(i.toDispose)}};L7=I([m(1,Xe),m(2,F),m(3,Ne)],L7);var ZC=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.template=e;this.actionRunner=t;this.openerService=o;this.instantiationService=n;this.keybindingService=r;this.contextMenuService=s;this.hoverService=l;this.inputDisposables=this._register(new O);ZC.closeNotificationAction||(ZC.closeNotificationAction=n.createInstance(Rae,Rae.ID,Rae.LABEL),ZC.expandNotificationAction=n.createInstance(Pae,Pae.ID,Pae.LABEL),ZC.collapseNotificationAction=n.createInstance(Aae,Aae.ID,Aae.LABEL),ZC.updateExpandCollapseIcons(c)),this._register(c.onDidChangeConfiguration(u=>{u.affectsConfiguration("workbench.notifications.position")&&ZC.updateExpandCollapseIcons(c)}))}static updateExpandCollapseIcons(e){if(!ZC.expandNotificationAction)return;let t=NN(e);ZC.expandNotificationAction.class=q.asClassName(_Bo(t)),ZC.collapseNotificationAction.class=q.asClassName(DBo(t))}static{this.SEVERITIES=[ft.Info,ft.Warning,ft.Error]}setInput(e){this.inputDisposables.clear(),this.render(e)}render(e){this.template.container.classList.toggle("expanded",e.expanded),this.inputDisposables.add($(this.template.container,ne.MOUSE_UP,r=>{r.button===1&&Kt.stop(r,!0)})),this.inputDisposables.add($(this.template.container,ne.AUXCLICK,r=>{!e.hasProgress&&r.button===1&&(Kt.stop(r,!0),e.close())})),this.renderSeverity(e);let t=this.inputDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),this.template.message,"")),o=this.renderMessage(e,t);this.renderSecondaryActions(e,o);let n=this.inputDisposables.add(this.hoverService.setupManagedHover(yi("mouse"),this.template.source,""));this.renderSource(e,n),this.renderButtons(e),this.renderProgress(e),this.inputDisposables.add(e.onDidChangeContent(r=>{switch(r.kind){case 0:this.renderSeverity(e);break;case 3:this.renderProgress(e);break;case 1:this.renderMessage(e,t);break}}))}renderSeverity(e){ZC.SEVERITIES.forEach(t=>{e.severity!==t&&this.template.icon.classList.remove(...q.asClassNameArray(this.toSeverityIcon(t)))}),this.template.icon.classList.add(...q.asClassNameArray(this.toSeverityIcon(e.severity)))}renderMessage(e,t){St(this.template.message),this.template.message.appendChild(OJt.render(e.message,{callback:n=>this.openerService.open(A.parse(n),{allowCommands:!0}),toDispose:this.inputDisposables}));let o=e.canCollapse&&!e.expanded&&this.template.message.scrollWidth>this.template.message.clientWidth;return t.update(o?this.template.message.textContent+"":""),o}renderSecondaryActions(e,t){let o=[];if(Rr(e.actions?.secondary)){let r=this.instantiationService.createInstance(iye,iye.ID,iye.LABEL,e);o.push(r),this.inputDisposables.add(r)}let n=!1;e.canCollapse&&(e.expanded||e.source||t)&&(n=!0),n&&o.push(e.expanded?ZC.collapseNotificationAction:ZC.expandNotificationAction),e.hasProgress||o.push(ZC.closeNotificationAction),this.template.toolbar.clear(),this.template.toolbar.context=e,o.forEach(r=>this.template.toolbar.push(r,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(r)}))}renderSource(e,t){e.expanded&&e.source?(this.template.source.textContent=d(5044,null,e.source),t.update(e.source)):(this.template.source.textContent="",t.update(""))}renderButtons(e){St(this.template.buttonsContainer);let t=e.actions?e.actions.primary:void 0;if(e.expanded&&Rr(t)){let o=this,n=this.inputDisposables.add(new class extends cs{async runAction(s){o.actionRunner.run(s,e),(!(s instanceof dhe)||!s.keepOpen)&&e.close()}}),r=this.inputDisposables.add(new sC(this.template.buttonsContainer));for(let s=0;s<t.length;s++){let l=t[s],c={title:!0,secondary:s>0,...Ro},u=l instanceof dhe?l.menu:void 0,p=this.inputDisposables.add(u?r.addButtonWithDropdown({...c,contextMenuProvider:this.contextMenuService,actions:u,actionRunner:n}):r.addButton(c));p.label=l.label,this.inputDisposables.add(p.onDidClick(h=>{h&&Kt.stop(h,!0),n.run(l)}))}}}renderProgress(e){if(!e.hasProgress){this.template.progress.stop().hide();return}let t=e.progress.state;t.infinite?this.template.progress.infinite().show():typeof t.total=="number"||typeof t.worked=="number"?(typeof t.total=="number"&&!this.template.progress.hasTotal()&&this.template.progress.total(t.total),typeof t.worked=="number"&&this.template.progress.setWorked(t.worked).show()):this.template.progress.done().hide()}toSeverityIcon(e){switch(e){case ft.Warning:return L.warning;case ft.Error:return L.error}return L.info}getKeybindingLabel(e){let t=this.keybindingService.lookupKeybinding(e.id);return t?t.getLabel():null}};ZC=I([m(2,Je),m(3,F),m(4,Le),m(5,Xe),m(6,ot),m(7,B)],ZC);var Oae=class extends k{constructor(e,t,o,n){super();this.container=e;this.options=t;this.instantiationService=o;this.contextMenuService=n;this.viewModel=[]}show(){this.isVisible||(this.list||this.createNotificationsList(),this.isVisible=!0)}createNotificationsList(){this.listContainer=_(".notifications-list-container");let e=this._register(this.instantiationService.createInstance(R7)),t=this.instantiationService.createInstance(L7,e),o=this.listDelegate=new NJt(this.listContainer),n=this.options,r=this.list=this._register(this.instantiationService.createInstance(bc,"NotificationsList",this.listContainer,o,[t],{...n,setRowLineHeight:!1,horizontalScrolling:!1,overrideStyles:{listBackground:dZ},accessibilityProvider:this.instantiationService.createInstance(zht,n)})),s=this._register(this.instantiationService.createInstance(Nae,Nae.ID,Nae.LABEL));this._register(r.onContextMenu(c=>{c.element&&this.contextMenuService.showContextMenu({getAnchor:()=>c.anchor,getActions:()=>[s],getActionsContext:()=>c.element,actionRunner:e})})),this._register(r.onMouseDblClick(c=>c.element.toggle()));let l=this._register(nr(r.getHTMLElement()));this._register(l.onDidBlur(()=>{Me(this.listContainer).document.hasFocus()&&r.setFocus([])})),YD.bindTo(r.contextKeyService),this._register(r.onDidChangeSelection(c=>{c.indexes.length>0&&r.setSelection([])})),this.container.appendChild(this.listContainer)}updateNotificationsList(e,t,o=[]){let[n,r]=Ow(this.list,this.listContainer),s=Is(r),l=n.getFocus()[0],c=this.viewModel[l],u=null;if(typeof l=="number"&&(u=n.getRelativeTop(l)),this.viewModel.splice(e,t,...o),n.splice(e,t,o),n.layout(),this.viewModel.length===0)this.hide();else if(typeof l=="number"){let p=0;if(c){let h=this.viewModel.indexOf(c);h===-1&&(h=l-1),h<this.viewModel.length&&h>=0&&(p=h)}typeof u=="number"&&n.reveal(p,u),n.setFocus([p])}this.isVisible&&s&&n.domFocus()}updateNotificationHeight(e){let t=this.viewModel.indexOf(e);if(t===-1)return;let[o,n]=Ow(this.list,this.listDelegate);o.updateElementHeight(t,n.getHeight(e)),o.layout()}hide(){!this.isVisible||!this.list||(this.isVisible=!1,this.list.splice(0,this.viewModel.length),this.viewModel=[])}focusFirst(){this.list&&(this.list.focusFirst(),this.list.domFocus())}hasFocus(){return this.listContainer?Is(this.listContainer):!1}layout(e,t){this.listContainer&&this.list&&(this.listContainer.style.width=`${e}px`,typeof t=="number"&&(this.list.getHTMLElement().style.maxHeight=`${t}px`),this.list.layout())}dispose(){this.hide(),super.dispose()}};Oae=I([m(2,F),m(3,Xe)],Oae);var zht=class{constructor(i,e,t){this._options=i;this._keybindingService=e;this._configurationService=t}getAriaLabel(i){let e,t=this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel();return this._configurationService.getValue("accessibility.verbosity.notification")&&(e=t?d(5021,null,t):d(5022,null)),i.source?wX(e?d(5027,null,i.message.raw,i.source,e):d(5026,null,i.message.raw,i.source),i.severity):wX(e?d(5024,null,i.message.raw,e):d(5023,null,i.message.raw),i.severity)}getWidgetAriaLabel(){return this._options.widgetAriaLabel??d(5025,null)}getRole(){return"dialog"}};zht=I([m(1,Le),m(2,B)],zht);var nz=class extends ju{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(o);this.container=e;this.model=t;this.instantiationService=n;this.layoutService=r;this.contextKeyService=s;this.editorGroupService=l;this.keybindingService=c;this.notificationService=u;this.accessibilitySignalService=p;this.contextMenuService=h;this.configurationService=g;this.menuService=f;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.notificationsCenterVisibleContextKey=CYe.bindTo(s),this.registerListeners()}static{this.MAX_DIMENSIONS=new di(450,400)}static{this.MAX_NOTIFICATION_SOURCES=10}registerListeners(){this._register(this.model.onDidChangeNotification(e=>this.onDidChangeNotification(e))),this._register(this.layoutService.onDidLayoutMainContainer(e=>this.layout(di.lift(e)))),this._register(this.notificationService.onDidChangeFilter(()=>this.onDidChangeFilter())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.notifications.position")&&this.updatePositionClass()}))}updatePositionClass(){if(!this.notificationsCenterContainer)return;let e=NN(this.configurationService);this.notificationsCenterContainer.classList.remove("bottom-right","bottom-left","top-right"),this.notificationsCenterContainer.classList.add(e),this.updateHideActionIcon(),this.updateTopOffset()}updateHideActionIcon(){if(!this.hideAction)return;let e=NN(this.configurationService);this.hideAction.class=q.asClassName(e==="top-right"?xBo:z$i)}updateTopOffset(){if(!this.notificationsCenterContainer)return;if(NN(this.configurationService)==="top-right"){let t=7;this.layoutService.isVisible("workbench.parts.titlebar",ut)&&(t+=nJ),this.notificationsCenterContainer.style.top=`${t}px`}else this.notificationsCenterContainer.style.top=""}onDidChangeFilter(){this.notificationService.getFilter()===1&&this.hide()}get isVisible(){return!!this._isVisible}show(){if(this._isVisible){let o=Ti(this.notificationsList);o.show(),o.focusFirst();return}this.notificationsCenterContainer||this.create(),this.updateTitle();let[e,t]=Ow(this.notificationsList,this.notificationsCenterContainer);this._isVisible=!0,t.classList.add("visible"),e.show(),this.layout(this.workbenchDimensions),e.updateNotificationsList(0,0,this.model.notifications),e.focusFirst(),this.updateStyles(),this.model.notifications.forEach(o=>o.updateVisibility(!0)),this.notificationsCenterVisibleContextKey.set(!0),this._onDidChangeVisibility.fire()}updateTitle(){let[e,t]=Ow(this.notificationsCenterTitle,this.clearAllAction);this.model.notifications.length===0?(e.textContent=d(5004,null),t.enabled=!1):(e.textContent=d(5002,null),t.enabled=this.model.notifications.some(o=>!o.hasProgress))}create(){this.notificationsCenterContainer=_(".notifications-center"),this.updatePositionClass(),this.notificationsCenterHeader=_(".notifications-center-header"),this.notificationsCenterContainer.appendChild(this.notificationsCenterHeader),this.notificationsCenterTitle=_("span.notifications-center-header-title"),this.notificationsCenterHeader.appendChild(this.notificationsCenterTitle);let e=_(".notifications-center-header-toolbar");this.notificationsCenterHeader.appendChild(e);let t=this._register(this.instantiationService.createInstance(R7)),o=this,n=this._register(new oo(e,{ariaLabel:d(5005,null),actionRunner:t,actionViewItemProvider:(s,l)=>s.id===tye.ID?this._register(this.instantiationService.createInstance(rh,s,{getActions:()=>oi.join(...this.menuService.getMenuActions(R.NotificationsCenterPositionMenu,this.contextKeyService).map(([,c])=>c))},this.contextMenuService,{...l,actionRunner:t,classNames:s.class,keybindingProvider:c=>this.keybindingService.lookupKeybinding(c.id)})):s.id===eye.ID?this._register(this.instantiationService.createInstance(rh,s,{getActions(){let c=[li({id:JIe.ID,label:o.notificationService.getFilter()===0?d(5007,null):d(5006,null),run:()=>o.notificationService.setFilter(o.notificationService.getFilter()===0?1:0)})],u=o.notificationService.getFilters().sort((p,h)=>p.label.localeCompare(h.label));for(let p of u.slice(0,nz.MAX_NOTIFICATION_SOURCES))c.length===1&&c.push(new oi),c.push(li({id:`${JIe.ID}.${p.id}`,label:p.label,checked:p.filter!==1,run:()=>o.notificationService.setFilter({...p,filter:p.filter===1?0:1})}));return u.length>nz.MAX_NOTIFICATION_SOURCES&&(c.push(new oi),c.push(o._register(o.instantiationService.createInstance(ZIe,ZIe.ID,d(5001,null))))),c}},this.contextMenuService,{...l,actionRunner:t,classNames:s.class,keybindingProvider:c=>this.keybindingService.lookupKeybinding(c.id)})):ta(this.instantiationService,s,l)}));this.clearAllAction=this._register(this.instantiationService.createInstance(Lae,Lae.ID,Lae.LABEL)),n.push(this.clearAllAction,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(this.clearAllAction)}),this.configureDoNotDisturbAction=this._register(this.instantiationService.createInstance(eye,eye.ID,eye.LABEL)),n.push(this.configureDoNotDisturbAction,{icon:!0,label:!1});let r=this._register(this.instantiationService.createInstance(tye,tye.ID,tye.LABEL));n.push(r,{icon:!0,label:!1}),this.hideAction=this._register(this.instantiationService.createInstance(Mae,Mae.ID,Mae.LABEL)),this.updateHideActionIcon(),n.push(this.hideAction,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(this.hideAction)}),this.notificationsList=this.instantiationService.createInstance(Oae,this.notificationsCenterContainer,{widgetAriaLabel:d(5003,null)}),this.container.appendChild(this.notificationsCenterContainer)}getKeybindingLabel(e){let t=this.keybindingService.lookupKeybinding(e.id);return t?t.getLabel():null}onDidChangeNotification(e){if(!this._isVisible)return;let t=!1,[o,n]=Ow(this.notificationsList,this.notificationsCenterContainer);switch(e.kind){case 0:o.updateNotificationsList(e.index,0,[e.item]),e.item.updateVisibility(!0);break;case 1:switch(e.detail){case 2:o.updateNotificationsList(e.index,1,[e.item]);break;case 1:e.item.expanded&&o.updateNotificationHeight(e.item);break}break;case 2:o.updateNotificationsList(e.index,1,[e.item]);break;case 3:t=Is(n),o.updateNotificationsList(e.index,1),e.item.updateVisibility(!1);break}this.updateTitle(),this.model.notifications.length===0&&(this.hide(),t&&this.editorGroupService.activeGroup.focus())}hide(){if(!this._isVisible||!this.notificationsCenterContainer||!this.notificationsList)return;let e=Is(this.notificationsCenterContainer);this._isVisible=!1,this.notificationsCenterContainer.classList.remove("visible"),this.notificationsList.hide(),this.model.notifications.forEach(t=>t.updateVisibility(!1)),this.notificationsCenterVisibleContextKey.set(!1),this._onDidChangeVisibility.fire(),e&&this.editorGroupService.activeGroup.focus()}updateStyles(){if(this.notificationsCenterContainer&&this.notificationsCenterHeader){let e=this.getColor(gso);this.notificationsCenterContainer.style.border=e?`1px solid ${e}`:"";let t=this.getColor(vso);this.notificationsCenterHeader.style.color=t??"";let o=this.getColor(Rbi);this.notificationsCenterHeader.style.background=o??""}}layout(e){if(this.workbenchDimensions=e,this._isVisible&&this.notificationsCenterContainer){let t=nz.MAX_DIMENSIONS.width,o=nz.MAX_DIMENSIONS.height,n=t,r=o;this.workbenchDimensions&&(n=this.workbenchDimensions.width,n-=16,r=this.workbenchDimensions.height-35,this.layoutService.isVisible("workbench.parts.statusbar",ut)&&(r-=22),this.layoutService.isVisible("workbench.parts.titlebar",ut)&&(r-=22),r-=24),this.updateTopOffset(),Ti(this.notificationsList).layout(Math.min(t,n),Math.min(o,r))}}clearAll(){this.hide();for(let e of[...this.model.notifications])e.hasProgress||e.close(),this.accessibilitySignalService.playSignal(tn.clear)}};nz=I([m(2,Pe),m(3,F),m(4,wi),m(5,X),m(6,kt),m(7,Le),m(8,Ne),m(9,br),m(10,Xe),m(11,B),m(12,Yt)],nz);var FJt=class extends k{constructor(e){super();this.model=e;for(let t of e.notifications)this.triggerAriaAlert(t);this.registerListeners()}registerListeners(){this._register(this.model.onDidChangeNotification(e=>this.onDidChangeNotification(e)))}onDidChangeNotification(e){e.kind===0&&(this.triggerAriaAlert(e.item),e.item.severity===ft.Error&&(e.item.message.original instanceof Error?console.error(e.item.message.original):console.error(Mn(e.item.message.linkedText.toString(),!0))))}triggerAriaAlert(e){if(e.priority===2)return;let t=e.onDidChangeContent(o=>{o.kind===1&&this.doTriggerAriaAlert(e)});U.once(e.onDidClose)(()=>t.dispose()),this.doTriggerAriaAlert(e)}doTriggerAriaAlert(e){let t;e.severity===ft.Error?t=d(4998,null,e.message.linkedText.toString()):e.severity===ft.Warning?t=d(5000,null,e.message.linkedText.toString()):t=d(4999,null,e.message.linkedText.toString()),cn(t)}};var l$e=class extends k{constructor(e,t,o,n){super();this.model=e;this.statusbarService=t;this.notificationService=o;this.configurationService=n;this.newNotificationsCount=0;this.isNotificationsCenterVisible=!1;this.isNotificationsToastsVisible=!1;this.updateNotificationsCenterStatusItem(),e.statusMessage&&this.doSetStatusMessage(e.statusMessage),this.registerListeners()}registerListeners(){this._register(this.model.onDidChangeNotification(e=>this.onDidChangeNotification(e))),this._register(this.model.onDidChangeStatusMessage(e=>this.onDidChangeStatusMessage(e))),this._register(this.notificationService.onDidChangeFilter(()=>this.updateNotificationsCenterStatusItem())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.notifications.position")&&this.updateNotificationsCenterStatusItem()}))}onDidChangeNotification(e){this.isNotificationsCenterVisible||(e.kind===0?this.newNotificationsCount++:e.kind===3&&this.newNotificationsCount>0&&this.newNotificationsCount--),this.updateNotificationsCenterStatusItem()}updateNotificationsCenterStatusItem(){let e=0;if(!this.isNotificationsCenterVisible&&!this.isNotificationsToastsVisible)for(let n of this.model.notifications)n.hasProgress&&e++;let t={name:d(5038,null),text:`${e>0||this.newNotificationsCount>0?"$(bell-dot)":"$(bell)"}`,ariaLabel:d(5038,null),command:this.isNotificationsCenterVisible?XIe:LJt,tooltip:this.getTooltip(e),showBeak:this.isNotificationsCenterVisible};if(this.notificationService.getFilter()===1&&(t={...t,text:`${e>0||this.newNotificationsCount>0?"$(bell-slash-dot)":"$(bell-slash)"}`,ariaLabel:d(5035,null),tooltip:d(5036,null)}),NN(this.configurationService)==="top-right")this.notificationsCenterStatusItem?.dispose(),this.notificationsCenterStatusItem=void 0,this.currentAlignment=void 0;else{let n=this.getDesiredAlignment();this.currentAlignment!==n&&(this.notificationsCenterStatusItem?.dispose(),this.notificationsCenterStatusItem=void 0,this.currentAlignment=n),this.notificationsCenterStatusItem?this.notificationsCenterStatusItem.update(t):this.notificationsCenterStatusItem=this.statusbarService.addEntry(t,"status.notifications",this.currentAlignment,this.currentAlignment===0?Number.MAX_SAFE_INTEGER:Number.NEGATIVE_INFINITY)}}getDesiredAlignment(){switch(NN(this.configurationService)){case"bottom-left":return 0;case"top-right":case"bottom-right":default:return 1}}getTooltip(e){return this.isNotificationsCenterVisible?d(5028,null):this.model.notifications.length===0?d(5039,null):e===0?this.newNotificationsCount===0?d(5029,null):this.newNotificationsCount===1?d(5033,null):d(5031,null,this.newNotificationsCount):this.newNotificationsCount===0?d(5030,null,e):this.newNotificationsCount===1?d(5034,null,e):d(5032,null,this.newNotificationsCount,e)}update(e,t){let o=!1;this.isNotificationsCenterVisible!==e&&(this.isNotificationsCenterVisible=e,this.newNotificationsCount=0,o=!0),this.isNotificationsToastsVisible!==t&&(this.isNotificationsToastsVisible=t,o=!0),o&&this.updateNotificationsCenterStatusItem()}onDidChangeStatusMessage(e){let t=e.item;switch(e.kind){case 0:this.doSetStatusMessage(t);break;case 1:this.currentStatusMessage&&this.currentStatusMessage[0]===t&&(je(this.currentStatusMessage[1]),this.currentStatusMessage=void 0);break}}doSetStatusMessage(e){let t=e.message,o=e.options&&typeof e.options.showAfter=="number"?e.options.showAfter:0,n=e.options&&typeof e.options.hideAfter=="number"?e.options.hideAfter:-1;this.currentStatusMessage&&je(this.currentStatusMessage[1]);let r,s=setTimeout(()=>{r=this.statusbarService.addEntry({name:d(5037,null),text:t,ariaLabel:t},"status.message",0,Number.NEGATIVE_INFINITY),s=void 0},o),l,c={dispose:()=>{s&&clearTimeout(s),l&&clearTimeout(l),r?.dispose()}};n>0&&(l=setTimeout(()=>c.dispose(),n)),this.currentStatusMessage=[e,c]}};l$e=I([m(1,Fr),m(2,Ne),m(3,B)],l$e);var oB=class extends ju{constructor(e,t,o,n,r,s,l,c,u,p,h){super(r);this.container=e;this.model=t;this.instantiationService=o;this.layoutService=n;this.editorGroupService=s;this.lifecycleService=c;this.hostService=u;this.environmentService=p;this.configurationService=h;this._onDidChangeVisibility=this._register(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this._isVisible=!1;this.mapNotificationToToast=new Map;this.mapNotificationToDisposable=new Map;this.addedToastsIntervalCounter=new lbt(oB.SPAM_PROTECTION.interval);this.notificationsToastsVisibleContextKey=kH.bindTo(l),this.registerListeners()}static{this.MAX_WIDTH=450}static{this.MAX_NOTIFICATIONS=3}static{this.PURGE_TIMEOUT={[ft.Info]:1e4,[ft.Warning]:12e3,[ft.Error]:15e3}}static{this.SPAM_PROTECTION={interval:800,limit:this.MAX_NOTIFICATIONS}}get isVisible(){return!!this._isVisible}registerListeners(){this._register(this.layoutService.onDidLayoutMainContainer(e=>this.layout(di.lift(e)))),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.notifications.position")&&this.updateNotificationPosition()})),this.lifecycleService.when(3).then(()=>{this.model.notifications.forEach(e=>this.addToast(e)),this._register(this.model.onDidChangeNotification(e=>this.onDidChangeNotification(e)))}),this._register(this.model.onDidChangeFilter(({global:e,sources:t})=>{if(e===1)this.hide();else if(t)for(let[o]of this.mapNotificationToToast)typeof o.sourceId=="string"&&t.get(o.sourceId)===1&&o.severity!==ft.Error&&o.priority!==3&&this.removeToast(o)}))}updateNotificationPosition(){if(!this.notificationsToastsContainer)return;let e=NN(this.configurationService);this.notificationsToastsContainer.classList.remove("bottom-right","bottom-left","top-right"),this.notificationsToastsContainer.classList.add(e),this.updateTopOffset()}updateTopOffset(){if(!this.notificationsToastsContainer)return;if(NN(this.configurationService)==="top-right"){let t=3;this.layoutService.isVisible("workbench.parts.titlebar",ut)&&(t+=nJ),this.notificationsToastsContainer.style.top=`${t}px`}else this.notificationsToastsContainer.style.top=""}onDidChangeNotification(e){switch(e.kind){case 0:return this.addToast(e.item);case 3:return this.removeToast(e.item)}}addToast(e){if(this.isNotificationsCenterVisible||this.environmentService.enableSmokeTestDriver||e.priority===2)return;if(e.priority===1){let o=Un();if(go(o)&&Ch(o)&&this.isElementInNotificationQuarter(o))return}if(this.addedToastsIntervalCounter.increment()>oB.SPAM_PROTECTION.limit)return;let t=new O;this.mapNotificationToDisposable.set(e,t),t.add(kr(Me(this.container),()=>this.doAddToast(e,t)))}isElementInNotificationQuarter(e){let t=NN(this.configurationService),o=ur(e),n=wh(this.layoutService.mainContainer);switch(t){case"bottom-left":return o.left<n.width/2&&o.top>n.height/2;case"top-right":return o.left>n.width/2&&o.top<n.height/2;case"bottom-right":default:return o.left>n.width/2&&o.top>n.height/2}}doAddToast(e,t){let o=this.notificationsToastsContainer;o||(o=this.notificationsToastsContainer=_(".notifications-toasts"),this.container.appendChild(o)),this.updateNotificationPosition(),o.classList.add("visible");let n=_(".notification-toast-container"),r=o.firstChild;r?o.insertBefore(n,r):o.appendChild(n);let s=_(".notification-toast");n.appendChild(s);let l=this.instantiationService.createInstance(Oae,s,{verticalScrollMode:2,widgetAriaLabel:e.source?wX(d(5041,null,e.message.raw,e.source),e.severity):wX(d(5040,null,e.message.raw),e.severity)});t.add(l);let c={item:e,list:l,container:n,toast:s};this.mapNotificationToToast.set(e,c),t.add(ee(()=>this.updateToastVisibility(c,!1))),l.show();let u=this.computeMaxDimensions();this.layoutLists(u.width),l.updateNotificationsList(0,0,[e]),this.layoutContainer(u.height),t.add(e.onDidChangeExpansion(()=>{l.updateNotificationsList(0,1,[e])})),t.add(e.onDidChangeContent(p=>{switch(p.kind){case 2:l.updateNotificationsList(0,1,[e]);break;case 1:e.expanded&&l.updateNotificationHeight(e);break}})),U.once(e.onDidClose)(()=>{this.removeToast(e)}),this.purgeNotification(e,n,l,t),this.updateStyles(),this.notificationsToastsVisibleContextKey.set(!0),s.classList.add("notification-fade-in"),t.add($(s,"transitionend",()=>{s.classList.remove("notification-fade-in"),s.classList.add("notification-fade-in-done")})),e.updateVisibility(!0),this._isVisible||(this._isVisible=!0,this._onDidChangeVisibility.fire())}purgeNotification(e,t,o,n){let r=!1;n.add($(t,ne.MOUSE_OVER,()=>r=!0)),n.add($(t,ne.MOUSE_OUT,()=>r=!1));let s,l,c=()=>{s=setTimeout(()=>{this.hostService.hasFocus?e.sticky||o.hasFocus()||r?c():this.removeToast(e):l||(l=this.hostService.onDidChangeFocus(u=>{u&&c()}),n.add(l))},oB.PURGE_TIMEOUT[e.severity])};c(),n.add(ee(()=>clearTimeout(s)))}removeToast(e){let t=!1,o=this.mapNotificationToToast.get(e);o&&(Is(o.container)&&(t=!(this.focusNext()||this.focusPrevious())),this.mapNotificationToToast.delete(e));let n=this.mapNotificationToDisposable.get(e);n&&(je(n),this.mapNotificationToDisposable.delete(e)),this.mapNotificationToToast.size>0?this.layout(this.workbenchDimensions):(this.doHide(),t&&this.editorGroupService.activeGroup.focus())}removeToasts(){this.mapNotificationToToast.clear(),this.mapNotificationToDisposable.forEach(e=>je(e)),this.mapNotificationToDisposable.clear(),this.doHide()}doHide(){this.notificationsToastsContainer?.classList.remove("visible"),this.notificationsToastsVisibleContextKey.set(!1),this._isVisible&&(this._isVisible=!1,this._onDidChangeVisibility.fire())}hide(){let e=this.notificationsToastsContainer?Is(this.notificationsToastsContainer):!1;this.removeToasts(),e&&this.editorGroupService.activeGroup.focus()}focus(){let e=this.getToasts(2);return e.length>0?(e[0].list.focusFirst(),!0):!1}focusNext(){let e=this.getToasts(2);for(let t=0;t<e.length;t++)if(e[t].list.hasFocus()){let n=e[t+1];if(n)return n.list.focusFirst(),!0;break}return!1}focusPrevious(){let e=this.getToasts(2);for(let t=0;t<e.length;t++)if(e[t].list.hasFocus()){let n=e[t-1];if(n)return n.list.focusFirst(),!0;break}return!1}focusFirst(){let e=this.getToasts(2)[0];return e?(e.list.focusFirst(),!0):!1}focusLast(){let e=this.getToasts(2);return e.length>0?(e[e.length-1].list.focusFirst(),!0):!1}update(e){this.isNotificationsCenterVisible!==e&&(this.isNotificationsCenterVisible=e,this.isNotificationsCenterVisible&&this.removeToasts())}updateStyles(){this.mapNotificationToToast.forEach(({toast:e})=>{let t=this.getColor(dZ);e.style.background=t||"";let o=this.getColor(fso);e.style.border=o?`1px solid ${o}`:""})}getToasts(e){let t=[];return this.mapNotificationToToast.forEach(o=>{switch(e){case 0:t.push(o);break;case 1:this.isToastInDOM(o)||t.push(o);break;case 2:this.isToastInDOM(o)&&t.push(o);break}}),t.reverse()}layout(e){this.workbenchDimensions=e;let t=this.computeMaxDimensions();this.updateTopOffset(),t.height&&this.layoutContainer(t.height),this.layoutLists(t.width)}computeMaxDimensions(){let e=oB.MAX_WIDTH,t=e,o;return this.workbenchDimensions&&(t=this.workbenchDimensions.width,t-=16,o=this.workbenchDimensions.height,this.layoutService.isVisible("workbench.parts.statusbar",ut)&&(o-=22),this.layoutService.isVisible("workbench.parts.titlebar",ut)&&(o-=22),o-=24),new di(Math.min(e,t),o??0)}layoutLists(e){this.mapNotificationToToast.forEach(({list:t})=>t.layout(e))}layoutContainer(e){let t=e,o=Math.round(e*.618),n=0;for(let r of this.getToasts(0)){r.container.style.opacity="0",this.updateToastVisibility(r,!0),t-=r.container.offsetHeight,o-=r.container.offsetHeight;let s=!1;n===oB.MAX_NOTIFICATIONS?s=!1:(n===0&&t>=0||n>0&&o>=0)&&(s=!0),this.updateToastVisibility(r,s),r.container.style.opacity="",s&&n++}}updateToastVisibility(e,t){if(this.isToastInDOM(e)===t)return;let o=Ti(this.notificationsToastsContainer);t?o.appendChild(e.container):e.container.remove(),e.item.updateVisibility(t)}isToastInDOM(e){return!!e.container.parentElement}};oB=I([m(2,F),m(3,wi),m(4,Pe),m(5,kt),m(6,X),m(7,to),m(8,ti),m(9,Mt),m(10,B)],oB);var c$e=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.contextKeyService=e;this.contextService=t;this.configurationService=o;this.environmentService=n;this.productService=r;this.editorGroupService=s;this.editorService=l;this.layoutService=c;this.workingCopyService=u;fTt.bindTo(this.contextKeyService),aue.bindTo(this.contextKeyService),cC.bindTo(this.contextKeyService),Mu.bindTo(this.contextKeyService),Zk.bindTo(this.contextKeyService),vTt.bindTo(this.contextKeyService),qto.bindTo(this.contextKeyService),Qb.bindTo(this.contextKeyService).set(Gb(this.environmentService.remoteAuthority)||""),this.virtualWorkspaceContext=AM.bindTo(this.contextKeyService),this.temporaryWorkspaceContext=HMt.bindTo(this.contextKeyService),this.isSessionsWindowContext=qo.bindTo(this.contextKeyService),this.isSessionsWindowContext.set(this.environmentService.isSessionsWindow),this.updateWorkspaceContextKeys(),UMt.bindTo(this.contextKeyService).set(Vk.supported(ut));let p=!this.environmentService.isBuilt||this.environmentService.isExtensionDevelopment;_4.bindTo(this.contextKeyService).set(p),NQi(_4.key,p),D4.bindTo(this.contextKeyService).set(this.productService.quality||""),zso.bindTo(this.contextKeyService).set(r.embedderIdentifier),this.inAutomationContext=zMt.bindTo(this.contextKeyService),this.inAutomationContext.set(!!this.environmentService.enableSmokeTestDriver),this.activeEditorGroupEmpty=Tpe.bindTo(this.contextKeyService),this.activeEditorGroupIndex=qso.bindTo(this.contextKeyService),this.activeEditorGroupLast=$so.bindTo(this.contextKeyService),this.activeEditorGroupLocked=o_.bindTo(this.contextKeyService),this.multipleEditorGroupsContext=qS.bindTo(this.contextKeyService),this.editorsVisibleContext=ZMt.bindTo(this.contextKeyService),this.dirtyWorkingCopiesContext=bYe.bindTo(this.contextKeyService),this.dirtyWorkingCopiesContext.set(this.workingCopyService.hasDirty),this.workbenchStateContext=el.bindTo(this.contextKeyService),this.updateWorkbenchStateContextKey(),this.workspaceFolderCountContext=i_.bindTo(this.contextKeyService),this.updateWorkspaceFolderCountContextKey(),this.openFolderWorkspaceSupportContext=P0.bindTo(this.contextKeyService),this.openFolderWorkspaceSupportContext.set(Qr||typeof this.environmentService.remoteAuthority=="string"),this.emptyWorkspaceSupportContext=SZ.bindTo(this.contextKeyService),this.emptyWorkspaceSupportContext.set(Qr||typeof this.environmentService.remoteAuthority=="string"),this.enterMultiRootWorkspaceSupportContext=QD.bindTo(this.contextKeyService),this.enterMultiRootWorkspaceSupportContext.set(Qr||typeof this.environmentService.remoteAuthority=="string"),this.splitEditorsVerticallyContext=Dpe.bindTo(this.contextKeyService),this.updateSplitEditorsVerticallyContext(),this.isMainWindowFullscreenContext=ZA.bindTo(this.contextKeyService),this.isAuxiliaryWindowFocusedContext=ew.bindTo(this.contextKeyService),this.inZenModeContext=Yf.bindTo(this.contextKeyService),this.isMainEditorCenteredLayoutContext=yYe.bindTo(this.contextKeyService),this.mainEditorAreaVisibleContext=ePt.bindTo(this.contextKeyService),this.editorTabsVisibleContext=L2.bindTo(this.contextKeyService),this.sideBarVisibleContext=eN.bindTo(this.contextKeyService),this.sideBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.sidebar")),this.titleAreaVisibleContext=w3.bindTo(this.contextKeyService),this.titleBarStyleContext=yZ.bindTo(this.contextKeyService),this.updateTitleBarContextKeys(),this.panelPositionContext=wZ.bindTo(this.contextKeyService),this.panelPositionContext.set(Bx(this.layoutService.getPanelPosition())),this.panelVisibleContext=CZ.bindTo(this.contextKeyService),this.panelVisibleContext.set(this.layoutService.isVisible("workbench.parts.panel")),this.panelMaximizedContext=tPt.bindTo(this.contextKeyService),this.panelMaximizedContext.set(this.layoutService.isPanelMaximized()),this.panelAlignmentContext=EH.bindTo(this.contextKeyService),this.panelAlignmentContext.set(this.layoutService.getPanelAlignment()),this.auxiliaryBarVisibleContext=tN.bindTo(this.contextKeyService),this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.auxiliarybar")),this.auxiliaryBarMaximizedContext=M2.bindTo(this.contextKeyService),this.auxiliaryBarMaximizedContext.set(this.layoutService.isAuxiliaryBarMaximized()),this.registerListeners()}registerListeners(){this.editorGroupService.whenReady.then(()=>{this.updateEditorAreaContextKeys(),this.updateActiveEditorGroupContextKeys(),this.updateVisiblePanesContextKeys()}),this._register(this.editorService.onDidActiveEditorChange(()=>this.updateActiveEditorGroupContextKeys())),this._register(this.editorService.onDidVisibleEditorsChange(()=>this.updateVisiblePanesContextKeys())),this._register(this.editorGroupService.onDidAddGroup(()=>this.updateEditorGroupsContextKeys())),this._register(this.editorGroupService.onDidRemoveGroup(()=>this.updateEditorGroupsContextKeys())),this._register(this.editorGroupService.onDidChangeGroupIndex(()=>this.updateActiveEditorGroupContextKeys())),this._register(this.editorGroupService.onDidChangeGroupLocked(()=>this.updateActiveEditorGroupContextKeys())),this._register(this.editorGroupService.onDidChangeEditorPartOptions(()=>this.updateEditorAreaContextKeys())),this._register(this.contextService.onDidChangeWorkbenchState(()=>this.updateWorkbenchStateContextKey())),this._register(this.contextService.onDidChangeWorkspaceFolders(()=>{this.updateWorkspaceFolderCountContextKey(),this.updateWorkspaceContextKeys()})),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration("workbench.editor.openSideBySideDirection")&&this.updateSplitEditorsVerticallyContext()})),this._register(this.layoutService.onDidChangeZenMode(e=>this.inZenModeContext.set(e))),this._register(this.layoutService.onDidChangeActiveContainer(()=>this.isAuxiliaryWindowFocusedContext.set(this.layoutService.activeContainer!==this.layoutService.mainContainer))),this._register(ZO(e=>{e===ut.vscodeWindowId&&this.isMainWindowFullscreenContext.set(rx(ut))})),this._register(this.layoutService.onDidChangeMainEditorCenteredLayout(e=>this.isMainEditorCenteredLayoutContext.set(e))),this._register(this.layoutService.onDidChangePanelPosition(e=>this.panelPositionContext.set(e))),this._register(this.layoutService.onDidChangePanelAlignment(e=>this.panelAlignmentContext.set(e))),this._register(this.layoutService.onDidChangePartVisibility(()=>{this.mainEditorAreaVisibleContext.set(this.layoutService.isVisible("workbench.parts.editor",ut)),this.panelVisibleContext.set(this.layoutService.isVisible("workbench.parts.panel")),this.panelMaximizedContext.set(this.layoutService.isPanelMaximized()),this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.auxiliarybar")),this.sideBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.sidebar")),this.updateTitleBarContextKeys()})),this._register(this.layoutService.onDidChangeAuxiliaryBarMaximized(()=>{this.auxiliaryBarMaximizedContext.set(this.layoutService.isAuxiliaryBarMaximized())})),this._register(this.workingCopyService.onDidChangeDirty(e=>this.dirtyWorkingCopiesContext.set(e.isDirty()||this.workingCopyService.hasDirty)))}updateVisiblePanesContextKeys(){this.editorService.visibleEditorPanes.length>0?this.editorsVisibleContext.set(!0):this.editorsVisibleContext.reset()}updateActiveEditorGroupContextKeys(){this.editorService.activeEditor?this.activeEditorGroupEmpty.reset():this.activeEditorGroupEmpty.set(!0);let e=this.editorGroupService.activeGroup;this.activeEditorGroupIndex.set(e.index+1),this.activeEditorGroupLocked.set(e.isLocked),this.updateEditorGroupsContextKeys()}updateEditorGroupsContextKeys(){let e=this.editorGroupService.count;e>1?this.multipleEditorGroupsContext.set(!0):this.multipleEditorGroupsContext.reset();let t=this.editorGroupService.activeGroup;this.activeEditorGroupLast.set(t.index===e-1)}updateEditorAreaContextKeys(){this.editorTabsVisibleContext.set(this.editorGroupService.partOptions.showTabs==="multiple")}updateWorkbenchStateContextKey(){this.workbenchStateContext.set(this.getWorkbenchStateString())}updateWorkspaceFolderCountContextKey(){this.workspaceFolderCountContext.set(this.contextService.getWorkspace().folders.length)}updateSplitEditorsVerticallyContext(){let e=Zy(this.configurationService);this.splitEditorsVerticallyContext.set(e===1)}getWorkbenchStateString(){switch(this.contextService.getWorkbenchState()){case 1:return"empty";case 2:return"folder";case 3:return"workspace"}}updateTitleBarContextKeys(){this.titleAreaVisibleContext.set(this.layoutService.isVisible("workbench.parts.titlebar",ut)),this.titleBarStyleContext.set(oJ(this.configurationService))}updateWorkspaceContextKeys(){this.virtualWorkspaceContext.set(MMt(this.contextService.getWorkspace())||""),this.temporaryWorkspaceContext.set(tC(this.contextService.getWorkspace()))}};c$e=I([m(0,X),m(1,Ae),m(2,B),m(3,Mt),m(4,Ze),m(5,kt),m(6,ie),m(7,wi),m(8,$a)],c$e);var MBo=["chat.agentsControl.enabled","chat.unifiedAgentsBar.enabled","workbench.navigationControl.enabled","workbench.experimental.share.enabled"],kMn=["workbench.activityBar.location","window.commandCenter",...MBo,"workbench.editor.editorActionsLocation","workbench.layoutControl.enabled","window.menuBarVisibility","window.titleBarStyle","window.customTitleBarVisibility"],RBo=new di(Ldi.width,Ldi.height),G$i=new di(Mdi.width,Mdi.height),WJt=class extends k{constructor(e,t){super();this.parent=e;this.layoutOptions=t;this._onDidChangeZenMode=this._register(new T);this.onDidChangeZenMode=this._onDidChangeZenMode.event;this._onDidChangeMainEditorCenteredLayout=this._register(new T);this.onDidChangeMainEditorCenteredLayout=this._onDidChangeMainEditorCenteredLayout.event;this._onDidChangePanelAlignment=this._register(new T);this.onDidChangePanelAlignment=this._onDidChangePanelAlignment.event;this._onDidChangeWindowMaximized=this._register(new T);this.onDidChangeWindowMaximized=this._onDidChangeWindowMaximized.event;this._onDidChangePanelPosition=this._register(new T);this.onDidChangePanelPosition=this._onDidChangePanelPosition.event;this._onDidChangePartVisibility=this._register(new T);this.onDidChangePartVisibility=this._onDidChangePartVisibility.event;this._onDidChangeNotificationsVisibility=this._register(new T);this.onDidChangeNotificationsVisibility=this._onDidChangeNotificationsVisibility.event;this._onDidChangeAuxiliaryBarMaximized=this._register(new T);this.onDidChangeAuxiliaryBarMaximized=this._onDidChangeAuxiliaryBarMaximized.event;this._onDidLayoutMainContainer=this._register(new T);this.onDidLayoutMainContainer=this._onDidLayoutMainContainer.event;this._onDidLayoutActiveContainer=this._register(new T);this.onDidLayoutActiveContainer=this._onDidLayoutActiveContainer.event;this._onDidLayoutContainer=this._register(new T);this.onDidLayoutContainer=this._onDidLayoutContainer.event;this._onDidAddContainer=this._register(new T);this.onDidAddContainer=this._onDidAddContainer.event;this._onDidChangeActiveContainer=this._register(new T);this.onDidChangeActiveContainer=this._onDidChangeActiveContainer.event;this.mainContainer=document.createElement("div");this.containerStylesLoaded=new Map;this.parts=new Map;this.initialized=!1;this.disposed=!1;this._openedDefaultEditors=!1;this.whenReadyPromise=new Mo;this.whenReady=this.whenReadyPromise.p;this.whenRestoredPromise=new Mo;this.whenRestored=this.whenRestoredPromise.p;this.restored=!1;this.inMaximizedAuxiliaryBarTransition=!1}get activeContainer(){return this.getContainerFromDocument(_m())}get containers(){let e=[];for(let{window:t}of dx())e.push(this.getContainerFromDocument(t.document));return e}getContainerFromDocument(e){return e===this.mainContainer.ownerDocument?this.mainContainer:e.body.getElementsByClassName("monaco-workbench")[0]}whenContainerStylesLoaded(e){return this.containerStylesLoaded.get(e.vscodeWindowId)}get mainContainerDimension(){return this._mainContainerDimension}get activeContainerDimension(){return this.getContainerDimension(this.activeContainer)}getContainerDimension(e){return e===this.mainContainer?this.mainContainerDimension:wh(e)}get mainContainerOffset(){return this.computeContainerOffset(ut)}get activeContainerOffset(){return this.computeContainerOffset(Me(this.activeContainer))}computeContainerOffset(e){let t=0,o=0;this.isVisible("workbench.parts.banner")&&(t=this.getPart("workbench.parts.banner").maximumHeight,o=t);let n=this.isVisible("workbench.parts.titlebar",e);return n&&(t+=this.getPart("workbench.parts.titlebar").maximumHeight,o=t),n&&this.configurationService.getValue("window.commandCenter")!==!1&&(o=6),{top:t,quickPickTop:o}}initLayout(e){this.environmentService=e.get(Od),this.configurationService=e.get(B),this.hostService=e.get(ti),this.contextService=e.get(Ae),this.storageService=e.get(de),this.themeService=e.get(Pe),this.extensionService=e.get(lt),this.logService=e.get(re),this.telemetryService=e.get(_e),this.auxiliaryWindowService=e.get(RR),this.editorService=e.get(ie),this.editorGroupService=e.get(kt),this.mainPartEditorService=this.editorService.createScoped(this.editorGroupService.mainPart,this._store),this.paneCompositeService=e.get(Es),this.viewDescriptorService=e.get(ji),this.titleService=e.get(aP),this.notificationService=e.get(Ne),this.statusBarService=e.get(Fr),e.get(LR),this.registerLayoutListeners(),this.initLayoutState(e.get(to),e.get(ge))}registerLayoutListeners(){let e=n=>{this.isVisible("workbench.parts.editor",ut)||this.mainPartEditorService.visibleEditors.length===0||(this.isAuxiliaryBarMaximized()?n!==!1&&this.toggleMaximizedAuxiliaryBar():this.toggleMaximizedPanel())},t=()=>this.mainPartEditorService.visibleEditors.length===0&&this.configurationService.getValue("workbench.secondarySideBar.forceMaximized")===!0?(this.setAuxiliaryBarMaximized(!0),!0):!1;this.editorGroupService.whenRestored.then(()=>{this._register(this.mainPartEditorService.onDidVisibleEditorsChange(n=>{t()||e(n.isExplicit)})),this._register(this.editorGroupService.mainPart.onDidActivateGroup(n=>{n.reason!==1&&e()})),this._register(this.mainPartEditorService.onDidActiveEditorChange(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(Io.MAIN_EDITOR_CENTERED))))}),this._register(this.configurationService.onDidChangeConfiguration(n=>{if([...kMn,"workbench.sideBar.location","workbench.statusBar.visible"].some(r=>n.affectsConfiguration(r))){if(MBo.some(p=>n.affectsConfiguration(p)&&this.configurationService.getValue(p)===!0)&&this.configurationService.getValue("window.commandCenter")===!1){this.configurationService.updateValue("window.commandCenter",!0);return}let s=n.affectsConfiguration("workbench.editor.editorActionsLocation")&&this.configurationService.getValue("workbench.editor.editorActionsLocation")==="titleBar",l=n.affectsConfiguration("window.commandCenter")&&this.configurationService.getValue("window.commandCenter"),c=n.affectsConfiguration("workbench.layoutControl.enabled")&&this.configurationService.getValue("workbench.layoutControl.enabled");if((n.affectsConfiguration("workbench.activityBar.location")&&["top","bottom"].includes(this.configurationService.getValue("workbench.activityBar.location"))||s||l||c)&&this.configurationService.getValue("window.customTitleBarVisibility")==="never"){this.configurationService.updateValue("window.customTitleBarVisibility","auto");return}this.doUpdateLayoutConfiguration()}if(n.affectsConfiguration("workbench.shadows")&&this.updateShadows(),n.affectsConfiguration("workbench.secondarySideBar.forceMaximized")){let r=this.configurationService.getValue("workbench.secondarySideBar.forceMaximized");r===!0&&this.mainPartEditorService.visibleEditors.length===0?this.setAuxiliaryBarMaximized(!0):r===!1&&this.isAuxiliaryBarMaximized()&&this.setAuxiliaryBarMaximized(!1)}})),this._register(ZO(n=>this.onFullscreenChanged(n))),this._register(this.editorGroupService.mainPart.onDidAddGroup(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(Io.MAIN_EDITOR_CENTERED)))),this._register(this.editorGroupService.mainPart.onDidRemoveGroup(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(Io.MAIN_EDITOR_CENTERED)))),this._register(this.editorGroupService.mainPart.onDidChangeGroupMaximized(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(Io.MAIN_EDITOR_CENTERED)))),this._register($(this.mainContainer,ne.SCROLL,()=>this.mainContainer.scrollTop=0)),(ii||Sn||Ft)&&!yx(this.configurationService)&&this._register(this.titleService.onMenubarVisibilityChange(n=>this.onMenubarToggled(n))),this._register(this.themeService.onDidColorThemeChange(()=>this.updateWindowBorder())),this._register(this.hostService.onDidChangeFocus(n=>this.onWindowFocusChanged(n))),this._register(this.hostService.onDidChangeActiveWindow(()=>this.onActiveWindowChanged())),Ft&&typeof navigator.windowControlsOverlay=="object"&&this._register($(navigator.windowControlsOverlay,"geometrychange",()=>this.onDidChangeWCO())),this._register(this.auxiliaryWindowService.onDidOpenAuxiliaryWindow(({window:n,disposables:r})=>{let s=n.window.vscodeWindowId;this.containerStylesLoaded.set(s,n.whenStylesHaveLoaded),n.whenStylesHaveLoaded.then(()=>this.containerStylesLoaded.delete(s)),r.add(ee(()=>this.containerStylesLoaded.delete(s)));let l=r.add(new O);this._onDidAddContainer.fire({container:n.container,disposables:l}),r.add(n.onDidLayout(c=>this.handleContainerDidLayout(n.container,c)))}))}onMenubarToggled(e){if(e!==this.state.runtime.menuBar.toggled){this.state.runtime.menuBar.toggled=e;let t=sM(this.configurationService);Ft&&t==="toggle"?this.workbenchGrid.setViewVisible(this.titleBarPartView,WH(this.configurationService,ut,this.state.runtime.menuBar.toggled)):this.state.runtime.mainWindowFullscreen&&(t==="toggle"||t==="classic")&&this.workbenchGrid.setViewVisible(this.titleBarPartView,WH(this.configurationService,ut,this.state.runtime.menuBar.toggled)),this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension)}}handleContainerDidLayout(e,t){e===this.mainContainer&&this._onDidLayoutMainContainer.fire(t),Nbt(e)&&this._onDidLayoutActiveContainer.fire(t),this._onDidLayoutContainer.fire({container:e,dimension:t})}onFullscreenChanged(e){e===ut.vscodeWindowId&&(this.state.runtime.mainWindowFullscreen=rx(ut),this.state.runtime.mainWindowFullscreen?this.mainContainer.classList.add("fullscreen"):(this.mainContainer.classList.remove("fullscreen"),this.stateModel.getRuntimeValue(Io.ZEN_MODE_EXIT_INFO).transitionedToFullScreen&&this.isZenModeActive()&&this.toggleZenMode()),this.workbenchGrid.edgeSnapping=this.state.runtime.mainWindowFullscreen,JF(this.configurationService)&&(this.workbenchGrid.setViewVisible(this.titleBarPartView,WH(this.configurationService,ut,this.state.runtime.menuBar.toggled)),this.updateWindowBorder(!0)))}onActiveWindowChanged(){let e=this.getActiveContainerId();this.state.runtime.activeContainerId!==e&&(this.state.runtime.activeContainerId=e,this.updateWindowBorder(),this._onDidChangeActiveContainer.fire())}onWindowFocusChanged(e){this.state.runtime.hasFocus!==e&&(this.state.runtime.hasFocus=e,this.updateWindowBorder())}getActiveContainerId(){let e=this.activeContainer;return Me(e).vscodeWindowId}doUpdateLayoutConfiguration(e){this.updateCustomTitleBarVisibility(),this.updateMenubarVisibility(!!e),this.editorGroupService.whenRestored.then(()=>this.centerMainEditorLayout(this.stateModel.getRuntimeValue(Io.MAIN_EDITOR_CENTERED),e))}isShadowsDisabled(){return this.configurationService.getValue("workbench.shadows")===!1}updateShadows(){let e=this.isShadowsDisabled();for(let t of Array.from(this.containers))t.classList.toggle("no-shadows",e)}setSideBarPosition(e){let t=this.getPart("workbench.parts.activitybar"),o=this.getPart("workbench.parts.sidebar"),n=this.getPart("workbench.parts.auxiliarybar"),r=e===0?"left":"right",s=e===1?"left":"right",l=this.getPanelAlignment(),c=this.getPanelPosition();this.stateModel.setRuntimeValue(Io.SIDEBAR_POSITON,e);let u=Ti(t.getContainer()),p=Ti(o.getContainer()),h=Ti(n.getContainer());u.classList.remove(s),p.classList.remove(s),u.classList.add(r),p.classList.add(r),h.classList.remove(r),h.classList.add(s),t.updateStyles(),o.updateStyles(),n.updateStyles(),this.adjustPartPositions(e,l,c)}updateWindowBorder(e=!1){if(Ft||ii||(ii||Sn)&&jke(this.configurationService)||yx(this.configurationService))return;let t=this.themeService.getColorTheme(),o=t.getColor(T_e),n=t.getColor(__e),r=this.hasMainWindowBorder();for(let s of this.containers){let l=s===this.mainContainer,c=this.activeContainer===s,u=!1;if(!this.state.runtime.mainWindowFullscreen&&(o||n)){u=!0;let p=c&&this.state.runtime.hasFocus?o:n??o;s.style.setProperty("--window-border-color",p?.toString()??"transparent")}l&&(this.state.runtime.mainWindowBorder=u),s.classList.toggle("border",u)}!e&&r!==this.hasMainWindowBorder()&&this.layout()}initLayoutState(e,t){this._mainContainerDimension=wh(this.parent,this.contextService.getWorkbenchState()===1?RBo:G$i),this.stateModel=new q$i(this.storageService,this.configurationService,this.contextService,this.environmentService),this.stateModel.load({mainContainerDimension:this._mainContainerDimension,resetLayout:!!this.layoutOptions?.resetLayout}),this._register(this.stateModel.onDidChangeState(s=>{s.key===Io.ACTIVITYBAR_HIDDEN&&this.setActivityBarHidden(s.value),s.key===Io.STATUSBAR_HIDDEN&&this.setStatusBarHidden(s.value),s.key===Io.SIDEBAR_POSITON&&this.setSideBarPosition(s.value),s.key===Io.PANEL_POSITION&&this.setPanelPosition(s.value),s.key===Io.PANEL_ALIGNMENT&&this.setPanelAlignment(s.value),this.doUpdateLayoutConfiguration()}));let o=this.getInitialEditorsState();o&&this.logService.trace("Initial editor state",o);let n={layout:{editors:o?.layout},editor:{restoreEditors:this.shouldRestoreEditors(this.contextService,o),editorsToOpen:this.resolveEditorsToOpen(t,o)},views:{defaults:this.getDefaultLayoutViews(this.environmentService,this.storageService),containerToRestore:{}}},r={activeContainerId:this.getActiveContainerId(),mainWindowFullscreen:rx(ut),hasFocus:this.hostService.hasFocus,maximized:new Set,mainWindowBorder:!1,menuBar:{toggled:!1},zenMode:{transitionDisposables:new Ot}};if(this.state={initialization:n,runtime:r},this.isVisible("workbench.parts.sidebar")){let s=this.storageService.get(JG.activeViewletSettingsKey,1,this.viewDescriptorService.getDefaultViewContainer(0)?.id);!this.environmentService.isBuilt||e.startupKind===3||this.environmentService.isExtensionDevelopment&&!this.environmentService.extensionTestsLocationURI||s!==this.viewDescriptorService.getDefaultViewContainer(0)?.id&&s!==this.viewDescriptorService.getDefaultViewContainer(2)?.id&&(s=this.viewDescriptorService.getDefaultViewContainer(0)?.id),s?this.state.initialization.views.containerToRestore.sideBar=s:this.stateModel.setRuntimeValue(Io.SIDEBAR_HIDDEN,!0)}if(this.isVisible("workbench.parts.panel")){let s=this.storageService.get(XG.activePanelSettingsKey,1,this.viewDescriptorService.getDefaultViewContainer(1)?.id);s?this.state.initialization.views.containerToRestore.panel=s:this.stateModel.setRuntimeValue(Io.PANEL_HIDDEN,!0)}if(this.isVisible("workbench.parts.auxiliarybar")){let s=this.storageService.get(UN.activeViewSettingsKey,1,this.viewDescriptorService.getDefaultViewContainer(2)?.id);s?this.state.initialization.views.containerToRestore.auxiliaryBar=s:this.stateModel.setRuntimeValue(Io.AUXILIARYBAR_HIDDEN,!0)}this.updateWindowBorder(!0)}getDefaultLayoutViews(e,t){let o=e.options?.defaultLayout;if(!o||!o.force&&!t.isNew(1))return;let{views:n}=o;if(n?.length)return n.map(r=>r.id)}shouldRestoreEditors(e,t){return tC(e.getWorkspace())||this.configurationService.getValue("workbench.editor.restoreEditors")===!1?!1:!!(this.configurationService.getValue("window.restoreWindows")==="preserve")||t===void 0}willRestoreEditors(){return this.state.initialization.editor.restoreEditors}async resolveEditorsToOpen(e,t){if(t){let o=ui(await O_e(t.filesToMerge,e,this.logService));if(o.length===4&&zg(o[0])&&zg(o[1])&&zg(o[2])&&zg(o[3]))return[{editor:{input1:{resource:o[0].resource},input2:{resource:o[1].resource},base:{resource:o[2].resource},result:{resource:o[3].resource},options:{pinned:!0}}}];let n=ui(await O_e(t.filesToDiff,e,this.logService));if(n.length===2)return[{editor:{original:{resource:n[0].resource},modified:{resource:n[1].resource},options:{pinned:!0}}}];let r=[],s=await O_e(t.filesToOpenOrCreate,e,this.logService);for(let l=0;l<s.length;l++){let c=s[l];c&&r.push({editor:c,viewColumn:t.filesToOpenOrCreate?.[l].viewColumn})}return r}else if(this.contextService.getWorkbenchState()===1&&this.configurationService.getValue("workbench.startupEditor")==="newUntitledFile")return this.editorGroupService.hasRestorableState?[]:[{editor:{resource:void 0}}];return[]}get openedDefaultEditors(){return this._openedDefaultEditors}getInitialEditorsState(){let e=this.environmentService.options?.defaultLayout;if((e?.editors?.length||e?.layout?.editors)&&(e.force||this.storageService.isNew(1)))return this._openedDefaultEditors=!0,{layout:e.layout?.editors,filesToOpenOrCreate:e?.editors?.map(r=>({viewColumn:r.viewColumn,fileUri:A.revive(r.uri),openOnlyIfExists:r.openOnlyIfExists,options:r.options}))};let{filesToOpenOrCreate:t,filesToDiff:o,filesToMerge:n}=this.environmentService;if(t||o||n)return{filesToOpenOrCreate:t,filesToDiff:o,filesToMerge:n}}isRestored(){return this.restored}restoreParts(){let e=[],t=[];e.push((async()=>{Wo("code/willRestoreEditors"),await this.editorGroupService.whenReady,Wo("code/restoreEditors/editorGroupsReady"),this.state.initialization.layout?.editors&&this.editorGroupService.mainPart.applyLayout(this.state.initialization.layout.editors);let s=await this.state.initialization.editor.editorsToOpen;Wo("code/restoreEditors/editorsToOpenResolved");let l;if(s.length){let c=this.editorGroupService.mainPart.getGroups(2),u=new Map;for(let p of s){let h=c[(p.viewColumn??1)-1],g=u.get(h.id);g||(g=new Set,u.set(h.id,g)),g.add(p.editor)}l=Promise.all(Array.from(u).map(async([p,h])=>{try{await this.editorService.openEditors(Array.from(h),p,{validateTrust:!0})}catch(g){this.logService.error(g)}}))}t.push(Promise.all([l?.finally(()=>Wo("code/restoreEditors/editorsOpened")),this.editorGroupService.whenRestored.finally(()=>Wo("code/restoreEditors/editorGroupsRestored"))]).finally(()=>{Wo("code/didRestoreEditors")}))})());let o=(async()=>{if(this.state.initialization.views.defaults?.length){Wo("code/willOpenDefaultViews");let s=[],l=p=>{let h=this.viewDescriptorService.getViewLocationById(p.id);if(h!==null){let g=this.viewDescriptorService.getViewContainerByViewId(p.id);if(g){p.order>=(s?.[h]?.order??0)&&(s[h]={id:g.id,order:p.order});let f=this.viewDescriptorService.getViewContainerModel(g);return f.setCollapsed(p.id,!1),f.setVisible(p.id,!0),!0}}return!1},c=[...this.state.initialization.views.defaults].reverse().map((p,h)=>({id:p,order:h})),u=c.length;for(;u;)u--,l(c[u])&&c.splice(u,1);if(c.length){await this.extensionService.whenInstalledExtensionsRegistered();let p=c.length;for(;p;)p--,l(c[p])&&c.splice(p,1)}s[0]&&(this.state.initialization.views.containerToRestore.sideBar=s[0].id),s[1]&&(this.state.initialization.views.containerToRestore.panel=s[1].id),s[2]&&(this.state.initialization.views.containerToRestore.auxiliaryBar=s[2].id),Wo("code/didOpenDefaultViews")}})();e.push(o),e.push((async()=>{await o,this.state.initialization.views.containerToRestore.sideBar&&(Wo("code/willRestoreViewlet"),await this.openViewContainer(0,this.state.initialization.views.containerToRestore.sideBar),Wo("code/didRestoreViewlet"))})()),e.push((async()=>{await o,this.state.initialization.views.containerToRestore.panel&&(Wo("code/willRestorePanel"),await this.openViewContainer(1,this.state.initialization.views.containerToRestore.panel),Wo("code/didRestorePanel"))})()),e.push((async()=>{await o,this.state.initialization.views.containerToRestore.auxiliaryBar&&(Wo("code/willRestoreAuxiliaryBar"),await this.openViewContainer(2,this.state.initialization.views.containerToRestore.auxiliaryBar),Wo("code/didRestoreAuxiliaryBar"))})());let n=this.isZenModeActive(),r=LBo(this.configurationService).restore;n&&(this.setZenModeActive(!r),this.toggleZenMode(!1,!0)),this.stateModel.getRuntimeValue(Io.MAIN_EDITOR_CENTERED)&&this.centerMainEditorLayout(!0,!0),vn.settled(e).finally(()=>{Un()===ut.document.body&&(this.isPanelMaximized()||this.isAuxiliaryBarMaximized())&&this.focus(),this.whenReadyPromise.complete(),vn.settled(t).finally(()=>{this.editorService.editors.length===0&&this.isVisible("workbench.parts.auxiliarybar")&&!this.hasFocus("workbench.parts.auxiliarybar")&&!this.environmentService.enableSmokeTestDriver&&this.focusPart("workbench.parts.auxiliarybar"),this.restored=!0,this.whenRestoredPromise.complete()})})}async openViewContainer(e,t,o){let n=await this.paneCompositeService.openPaneComposite(t,e,o);n||(n=await this.paneCompositeService.openPaneComposite(this.viewDescriptorService.getDefaultViewContainer(e)?.id,e,o),!n&&await this.paneCompositeService.openPaneComposite(this.paneCompositeService.getVisiblePaneCompositeIds(e).at(0),e,o))}registerPart(e){let t=e.getId();return this.parts.set(t,e),ee(()=>this.parts.delete(t))}getPart(e){let t=this.parts.get(e);if(!t)throw new Error(`Unknown part ${e}`);return t}registerNotifications(e){this._register(e.onDidChangeNotificationsVisibility(t=>this._onDidChangeNotificationsVisibility.fire(t)))}hasFocus(e){let t=this.getContainer(zi(),e);if(!t)return!1;let o=Un();return o?cQi(o,t):!1}_getFocusedPart(){for(let e of this.parts.keys())if(this.hasFocus(e))return e}focusPart(e,t=ut){let o=this.getContainer(t,e)??this.mainContainer;switch(e){case"workbench.parts.editor":this.editorGroupService.getPart(o).activeGroup.focus();break;case"workbench.parts.panel":{this.paneCompositeService.getActivePaneComposite(1)?.focus();break}case"workbench.parts.sidebar":{this.paneCompositeService.getActivePaneComposite(0)?.focus();break}case"workbench.parts.auxiliarybar":{this.paneCompositeService.getActivePaneComposite(2)?.focus();break}case"workbench.parts.activitybar":this.getPart("workbench.parts.sidebar").focusActivityBar();break;case"workbench.parts.statusbar":this.statusBarService.getPart(o).focus();break;default:o?.focus()}}getContainer(e,t){if(typeof t>"u")return this.getContainerFromDocument(e.document);if(e===ut)return this.getPart(t).getContainer();let o;if(t==="workbench.parts.editor"?o=this.editorGroupService.getPart(this.getContainerFromDocument(e.document)):t==="workbench.parts.statusbar"?o=this.statusBarService.getPart(this.getContainerFromDocument(e.document)):t==="workbench.parts.titlebar"&&(o=this.titleService.getPart(this.getContainerFromDocument(e.document))),o instanceof k_)return o.getContainer()}isVisible(e,t=ut){if(t!==ut&&e==="workbench.parts.editor")return!0;switch(e){case"workbench.parts.titlebar":return this.initialized?this.workbenchGrid.isViewVisible(this.titleBarPartView):WH(this.configurationService,ut,this.state.runtime.menuBar.toggled);case"workbench.parts.sidebar":return!this.stateModel.getRuntimeValue(Io.SIDEBAR_HIDDEN);case"workbench.parts.panel":return!this.stateModel.getRuntimeValue(Io.PANEL_HIDDEN);case"workbench.parts.auxiliarybar":return!this.stateModel.getRuntimeValue(Io.AUXILIARYBAR_HIDDEN);case"workbench.parts.statusbar":return!this.stateModel.getRuntimeValue(Io.STATUSBAR_HIDDEN);case"workbench.parts.activitybar":return!this.stateModel.getRuntimeValue(Io.ACTIVITYBAR_HIDDEN);case"workbench.parts.editor":return!this.stateModel.getRuntimeValue(Io.EDITOR_HIDDEN);case"workbench.parts.banner":return this.initialized?this.workbenchGrid.isViewVisible(this.bannerPartView):!1;default:return!1}}shouldShowBannerFirst(){return Ft&&!_le()}focus(){this.isPanelMaximized()&&this.mainContainer===this.activeContainer?this.focusPart("workbench.parts.panel"):this.isAuxiliaryBarMaximized()&&this.mainContainer===this.activeContainer?this.focusPart("workbench.parts.auxiliarybar"):this.focusPart("workbench.parts.editor",Me(this.activeContainer))}focusPanelOrEditor(){let e=this.paneCompositeService.getActivePaneComposite(1);(this.hasFocus("workbench.parts.panel")||!this.isVisible("workbench.parts.editor"))&&e?e.focus():this.focus()}getMaximumEditorDimensions(e){let t=Me(e),o=this.getContainerDimension(e);if(e===this.mainContainer){let n=eg(this.getPanelPosition()),r=(this.isVisible("workbench.parts.activitybar")?this.activityBarPartView.minimumWidth:0)+(this.isVisible("workbench.parts.sidebar")?this.sideBarPartView.minimumWidth:0)+(this.isVisible("workbench.parts.panel")&&!n?this.panelPartView.minimumWidth:0)+(this.isVisible("workbench.parts.auxiliarybar")?this.auxiliaryBarPartView.minimumWidth:0),s=(this.isVisible("workbench.parts.titlebar",t)?this.titleBarPartView.minimumHeight:0)+(this.isVisible("workbench.parts.statusbar",t)?this.statusBarPartView.minimumHeight:0)+(this.isVisible("workbench.parts.panel")&&n?this.panelPartView.minimumHeight:0),l=o.width-r,c=o.height-s;return{width:l,height:c}}else{let n=(this.isVisible("workbench.parts.titlebar",t)?this.titleBarPartView.minimumHeight:0)+(this.isVisible("workbench.parts.statusbar",t)?this.statusBarPartView.minimumHeight:0);return{width:o.width,height:o.height-n}}}isZenModeActive(){return this.stateModel.getRuntimeValue(Io.ZEN_MODE_ACTIVE)}setZenModeActive(e){this.stateModel.setRuntimeValue(Io.ZEN_MODE_ACTIVE,e)}toggleZenMode(e,t=!1){let o=this._getFocusedPart();this.setZenModeActive(!this.isZenModeActive()),this.state.runtime.zenMode.transitionDisposables.clearAndDisposeAll();let n=c=>{for(let u of this.mainPartEditorService.visibleTextEditorControls){if(!c&&fn(u)&&u.hasModel()){let p=u.getModel();c=this.configurationService.getValue("editor.lineNumbers",{resource:p.uri,overrideIdentifier:p.getLanguageId()})}c||(c=this.configurationService.getValue("editor.lineNumbers")),u.updateOptions({lineNumbers:c})}},r=!1,s=LBo(this.configurationService),l=this.stateModel.getRuntimeValue(Io.ZEN_MODE_EXIT_INFO);this.isZenModeActive()?(r=!this.state.runtime.mainWindowFullscreen&&s.fullScreen&&!Tc,t||(l.transitionedToFullScreen=r,l.transitionedToCenteredEditorLayout=!this.isMainEditorLayoutCentered()&&s.centerLayout,l.handleNotificationsDoNotDisturbMode=this.notificationService.getFilter()===0,l.wasVisible.sideBar=this.isVisible("workbench.parts.sidebar"),l.wasVisible.panel=this.isVisible("workbench.parts.panel"),l.wasVisible.auxiliaryBar=this.isVisible("workbench.parts.auxiliarybar"),this.stateModel.setRuntimeValue(Io.ZEN_MODE_EXIT_INFO,l)),this.setPanelHidden(!0,!0),this.setAuxiliaryBarHidden(!0,!0),this.setSideBarHidden(!0),s.hideActivityBar&&this.setActivityBarHidden(!0),s.hideStatusBar&&this.setStatusBarHidden(!0),s.hideLineNumbers&&(n("off"),this.state.runtime.zenMode.transitionDisposables.set("zenMode.hideLineNumbers",this.mainPartEditorService.onDidVisibleEditorsChange(()=>n("off")))),s.showTabs!==this.editorGroupService.partOptions.showTabs&&this.state.runtime.zenMode.transitionDisposables.set("zenMode.showTabs",this.editorGroupService.mainPart.enforcePartOptions({showTabs:s.showTabs})),s.silentNotifications&&l.handleNotificationsDoNotDisturbMode&&this.notificationService.setFilter(1),s.centerLayout&&this.centerMainEditorLayout(!0,!0),this.state.runtime.zenMode.transitionDisposables.set("configurationChange",this.configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("zenMode.hideActivityBar")||c.affectsConfiguration("workbench.activityBar.location")){let u=this.configurationService.getValue("zenMode.hideActivityBar"),p=this.configurationService.getValue("workbench.activityBar.location");this.setActivityBarHidden(u?!0:p==="top"||p==="bottom")}if(c.affectsConfiguration("zenMode.hideStatusBar")){let u=this.configurationService.getValue("zenMode.hideStatusBar");this.setStatusBarHidden(u)}if(c.affectsConfiguration("zenMode.centerLayout")){let u=this.configurationService.getValue("zenMode.centerLayout");this.centerMainEditorLayout(u,!0)}if(c.affectsConfiguration("zenMode.showTabs")){let u=this.configurationService.getValue("zenMode.showTabs")??"multiple";this.state.runtime.zenMode.transitionDisposables.set("zenMode.showTabs",this.editorGroupService.mainPart.enforcePartOptions({showTabs:u}))}if(c.affectsConfiguration("zenMode.silentNotifications")){let u=!!this.configurationService.getValue("zenMode.silentNotifications");l.handleNotificationsDoNotDisturbMode&&this.notificationService.setFilter(u?1:0)}if(c.affectsConfiguration("zenMode.hideLineNumbers")){let u=this.configurationService.getValue("zenMode.hideLineNumbers")?"off":void 0;n(u),this.state.runtime.zenMode.transitionDisposables.set("zenMode.hideLineNumbers",this.mainPartEditorService.onDidVisibleEditorsChange(()=>n(u)))}}))):(l.wasVisible.panel&&this.setPanelHidden(!1,!0),l.wasVisible.auxiliaryBar&&this.setAuxiliaryBarHidden(!1,!0),l.wasVisible.sideBar&&this.setSideBarHidden(!1),this.stateModel.getRuntimeValue(Io.ACTIVITYBAR_HIDDEN,!0)||this.setActivityBarHidden(!1),this.stateModel.getRuntimeValue(Io.STATUSBAR_HIDDEN,!0)||this.setStatusBarHidden(!1),l.transitionedToCenteredEditorLayout&&this.centerMainEditorLayout(!1,!0),l.handleNotificationsDoNotDisturbMode&&this.notificationService.setFilter(0),n(),r=l.transitionedToFullScreen&&this.state.runtime.mainWindowFullscreen),e||this.layout(),r&&this.hostService.toggleFullScreen(ut),o&&this.isVisible(o,Me(this.activeContainer))?hco(o)?this.focusPart(o,Me(this.activeContainer)):this.focusPart(o):this.focus(),this._onDidChangeZenMode.fire(this.isZenModeActive())}setStatusBarHidden(e){this.stateModel.setRuntimeValue(Io.STATUSBAR_HIDDEN,e),e?this.mainContainer.classList.add("nostatusbar"):this.mainContainer.classList.remove("nostatusbar"),this.workbenchGrid.setViewVisible(this.statusBarPartView,!e)}createWorkbenchLayout(){let e=this.getPart("workbench.parts.titlebar"),t=this.getPart("workbench.parts.banner"),o=this.getPart("workbench.parts.editor"),n=this.getPart("workbench.parts.activitybar"),r=this.getPart("workbench.parts.panel"),s=this.getPart("workbench.parts.auxiliarybar"),l=this.getPart("workbench.parts.sidebar"),c=this.getPart("workbench.parts.statusbar");this.titleBarPartView=e,this.bannerPartView=t,this.sideBarPartView=l,this.activityBarPartView=n,this.editorPartView=o,this.panelPartView=r,this.auxiliaryBarPartView=s,this.statusBarPartView=c;let u={"workbench.parts.activitybar":this.activityBarPartView,"workbench.parts.banner":this.bannerPartView,"workbench.parts.titlebar":this.titleBarPartView,"workbench.parts.editor":this.editorPartView,"workbench.parts.panel":this.panelPartView,"workbench.parts.sidebar":this.sideBarPartView,"workbench.parts.statusbar":this.statusBarPartView,"workbench.parts.auxiliarybar":this.auxiliaryBarPartView},p=({type:g})=>u[g],h=P8.deserialize(this.createGridDescriptor(),{fromJSON:p},{proportionalLayout:!1});this.mainContainer.prepend(h.element),this.mainContainer.setAttribute("role","application"),this.workbenchGrid=h,this.workbenchGrid.edgeSnapping=this.state.runtime.mainWindowFullscreen;for(let g of[e,o,n,r,l,c,s,t])this._register(g.onDidVisibilityChange(f=>{this.inMaximizedAuxiliaryBarTransition||(g===l?this.setSideBarHidden(!f):g===r&&this.stateModel.getRuntimeValue(Io.PANEL_HIDDEN)===f?this.setPanelHidden(!f,!0):g===s?this.setAuxiliaryBarHidden(!f,!0):g===o&&this.setEditorHidden(!f)),this._onDidChangePartVisibility.fire({partId:g.getId(),visible:f}),this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension)}));this._register(this.storageService.onWillSaveState(()=>{let g=this.stateModel.getRuntimeValue(Io.SIDEBAR_HIDDEN)?this.workbenchGrid.getViewCachedVisibleSize(this.sideBarPartView):this.workbenchGrid.getViewSize(this.sideBarPartView).width;this.stateModel.setInitializationValue(Io.SIDEBAR_SIZE,g);let f=this.stateModel.getRuntimeValue(Io.PANEL_HIDDEN)?this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView):eg(this.stateModel.getRuntimeValue(Io.PANEL_POSITION))?this.workbenchGrid.getViewSize(this.panelPartView).height:this.workbenchGrid.getViewSize(this.panelPartView).width;this.stateModel.setInitializationValue(Io.PANEL_SIZE,f);let v=this.stateModel.getRuntimeValue(Io.AUXILIARYBAR_HIDDEN)?this.workbenchGrid.getViewCachedVisibleSize(this.auxiliaryBarPartView):this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width;this.stateModel.setInitializationValue(Io.AUXILIARYBAR_SIZE,v),this.stateModel.save(!0,!0)})),this._register(U.any(this.paneCompositeService.onDidPaneCompositeOpen,this.paneCompositeService.onDidPaneCompositeClose)(()=>{this.stateModel.setInitializationValue(Io.AUXILIARYBAR_EMPTY,this.paneCompositeService.getPaneCompositeIds(2).length===0)}))}layout(){this.disposed||(this._mainContainerDimension=wh(this.state.runtime.mainWindowFullscreen?ut.document.body:this.parent,this.contextService.getWorkbenchState()===1?RBo:G$i),this.logService.trace(`Layout#layout, height: ${this._mainContainerDimension.height}, width: ${this._mainContainerDimension.width}`),PL(this.mainContainer,this._mainContainerDimension.width,this._mainContainerDimension.height),this.workbenchGrid.layout(this._mainContainerDimension.width,this._mainContainerDimension.height),this.initialized=!0,this.handleContainerDidLayout(this.mainContainer,this._mainContainerDimension))}isMainEditorLayoutCentered(){return this.stateModel.getRuntimeValue(Io.MAIN_EDITOR_CENTERED)}centerMainEditorLayout(e,t){this.stateModel.setRuntimeValue(Io.MAIN_EDITOR_CENTERED,e);let n=ui(this.editorGroupService.mainPart.groups.map(c=>c.activeEditor)).some(c=>c instanceof Ba?this.configurationService.getValue("diffEditor.renderSideBySide"):!!c?.hasCapability(256)),r=this.editorGroupService.getLayout(),s=!1;r.orientation===0?s=r.groups.length>1:s=r.groups.some(c=>c.groups&&c.groups.length>1),this.configurationService.getValue("workbench.editor.centeredLayoutAutoResize")&&(s&&!this.editorGroupService.mainPart.hasMaximizedGroup()||n)&&(e=!1),this.editorGroupService.mainPart.isLayoutCentered()!==e&&(this.editorGroupService.mainPart.centerLayout(e),t||this.layout()),this._onDidChangeMainEditorCenteredLayout.fire(this.stateModel.getRuntimeValue(Io.MAIN_EDITOR_CENTERED))}getSize(e){return this.workbenchGrid.getViewSize(this.getPart(e))}setSize(e,t){this.workbenchGrid.resizeView(this.getPart(e),t)}resizePart(e,t,o){let n=Math.sign(t)*Owe(zi(),Math.abs(t)),r=Math.sign(o)*Owe(zi(),Math.abs(o)),s;switch(e){case"workbench.parts.sidebar":s=this.workbenchGrid.getViewSize(this.sideBarPartView),this.workbenchGrid.resizeView(this.sideBarPartView,{width:s.width+n,height:s.height});break;case"workbench.parts.panel":s=this.workbenchGrid.getViewSize(this.panelPartView),this.workbenchGrid.resizeView(this.panelPartView,{width:s.width+(eg(this.getPanelPosition())?0:n),height:s.height+(eg(this.getPanelPosition())?r:0)});break;case"workbench.parts.auxiliarybar":s=this.workbenchGrid.getViewSize(this.auxiliaryBarPartView),this.workbenchGrid.resizeView(this.auxiliaryBarPartView,{width:s.width+n,height:s.height});break;case"workbench.parts.editor":if(s=this.workbenchGrid.getViewSize(this.editorPartView),this.editorGroupService.mainPart.count===1)this.workbenchGrid.resizeView(this.editorPartView,{width:s.width+n,height:s.height+r});else{let l=this.editorGroupService.mainPart.activeGroup,{width:c,height:u}=this.editorGroupService.mainPart.getSize(l);this.editorGroupService.mainPart.setSize(l,{width:c+n,height:u+r});let{width:p,height:h}=this.editorGroupService.mainPart.getSize(l);(r&&u===h||n&&c===p)&&this.workbenchGrid.resizeView(this.editorPartView,{width:s.width+(n&&c===p?n:0),height:s.height+(r&&u===h?r:0)})}break;default:return}}setActivityBarHidden(e){this.stateModel.setRuntimeValue(Io.ACTIVITYBAR_HIDDEN,e),this.workbenchGrid.setViewVisible(this.activityBarPartView,!e)}setBannerHidden(e){this.workbenchGrid.setViewVisible(this.bannerPartView,!e)}setEditorHidden(e){!e&&this.setAuxiliaryBarMaximized(!1)&&this.isVisible("workbench.parts.editor")||(this.stateModel.setRuntimeValue(Io.EDITOR_HIDDEN,e),e?this.mainContainer.classList.add("nomaineditorarea"):this.mainContainer.classList.remove("nomaineditorarea"),this.workbenchGrid.setViewVisible(this.editorPartView,!e),e&&!this.isVisible("workbench.parts.panel")&&!this.isAuxiliaryBarMaximized()&&this.setPanelHidden(!1,!0))}getLayoutClasses(){return ui([this.isVisible("workbench.parts.sidebar")?void 0:"nosidebar",this.isVisible("workbench.parts.editor",ut)?void 0:"nomaineditorarea",this.isVisible("workbench.parts.panel")?void 0:"nopanel",this.isVisible("workbench.parts.auxiliarybar")?void 0:"noauxiliarybar",this.isVisible("workbench.parts.statusbar")?void 0:"nostatusbar",this.state.runtime.mainWindowFullscreen?"fullscreen":void 0,this.isShadowsDisabled()?"no-shadows":void 0])}setSideBarHidden(e){if(!(!e&&this.setAuxiliaryBarMaximized(!1)&&this.isVisible("workbench.parts.sidebar"))){if(this.stateModel.setRuntimeValue(Io.SIDEBAR_HIDDEN,e),e?this.mainContainer.classList.add("nosidebar"):this.mainContainer.classList.remove("nosidebar"),this.workbenchGrid.setViewVisible(this.sideBarPartView,!e),e&&this.paneCompositeService.getActivePaneComposite(0))this.paneCompositeService.hideActivePaneComposite(0),this.isAuxiliaryBarMaximized()||this.focusPanelOrEditor();else if(!e&&!this.paneCompositeService.getActivePaneComposite(0)){let t=this.paneCompositeService.getLastActivePaneCompositeId(0);t&&this.openViewContainer(0,t)}}}hasViews(e){let t=this.viewDescriptorService.getViewContainerById(e);if(!t)return!1;let o=this.viewDescriptorService.getViewContainerModel(t);return o?o.activeViewDescriptors.length>=1:!1}adjustPartPositions(e,t,o){let n=!eg(o),r=n||!(t==="center"||e===0&&t==="right"||e===1&&t==="left"),s=n||!(t==="center"||e===1&&t==="right"||e===0&&t==="left"),l=this.isVisible("workbench.parts.panel")?this.workbenchGrid.getViewSize(this.panelPartView).width:IW.Invisible(this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView)??this.panelPartView.minimumWidth),c=this.isVisible("workbench.parts.panel")?this.workbenchGrid.getViewSize(this.panelPartView).height:IW.Invisible(this.workbenchGrid.getViewCachedVisibleSize(this.panelPartView)??this.panelPartView.minimumHeight),u=this.isVisible("workbench.parts.sidebar")?this.workbenchGrid.getViewSize(this.sideBarPartView).width:IW.Invisible(this.workbenchGrid.getViewCachedVisibleSize(this.sideBarPartView)??this.sideBarPartView.minimumWidth),p=this.isVisible("workbench.parts.auxiliarybar")?this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width:IW.Invisible(this.workbenchGrid.getViewCachedVisibleSize(this.auxiliaryBarPartView)??this.auxiliaryBarPartView.minimumWidth),h=["workbench.parts.panel","workbench.parts.sidebar","workbench.parts.auxiliarybar"].find(g=>this.hasFocus(g));e===0?(this.workbenchGrid.moveViewTo(this.activityBarPartView,[2,0]),this.workbenchGrid.moveView(this.sideBarPartView,u,r?this.editorPartView:this.activityBarPartView,r?2:3),s?this.workbenchGrid.moveView(this.auxiliaryBarPartView,p,this.editorPartView,3):this.workbenchGrid.moveViewTo(this.auxiliaryBarPartView,[2,-1])):(this.workbenchGrid.moveViewTo(this.activityBarPartView,[2,-1]),this.workbenchGrid.moveView(this.sideBarPartView,u,r?this.editorPartView:this.activityBarPartView,r?3:2),s?this.workbenchGrid.moveView(this.auxiliaryBarPartView,p,this.editorPartView,2):this.workbenchGrid.moveViewTo(this.auxiliaryBarPartView,[2,0])),h&&this.focusPart(h),n&&(this.workbenchGrid.moveView(this.panelPartView,l,this.editorPartView,o===0?2:3),this.workbenchGrid.resizeView(this.panelPartView,{height:c,width:l})),this.isVisible("workbench.parts.sidebar")&&this.workbenchGrid.resizeView(this.sideBarPartView,{height:this.workbenchGrid.getViewSize(this.sideBarPartView).height,width:u}),this.isVisible("workbench.parts.auxiliarybar")&&this.workbenchGrid.resizeView(this.auxiliaryBarPartView,{height:this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).height,width:p})}setPanelAlignment(e){eg(this.getPanelPosition())||this.setPanelPosition(2),e!=="center"&&this.isPanelMaximized()&&this.toggleMaximizedPanel(),this.setAuxiliaryBarMaximized(!1),this.stateModel.setRuntimeValue(Io.PANEL_ALIGNMENT,e),this.adjustPartPositions(this.getSideBarPosition(),e,this.getPanelPosition()),this._onDidChangePanelAlignment.fire(e)}setPanelHidden(e,t){if(!this.workbenchGrid||!e&&this.setAuxiliaryBarMaximized(!1)&&this.isVisible("workbench.parts.panel"))return;let o=!this.isVisible("workbench.parts.panel"),n=this.isPanelMaximized();this.stateModel.setRuntimeValue(Io.PANEL_HIDDEN,e);let r=this.panelOpensMaximized();e?this.mainContainer.classList.add("nopanel"):this.mainContainer.classList.remove("nopanel"),e&&n&&this.toggleMaximizedPanel(),this.workbenchGrid.setViewVisible(this.panelPartView,!e);let s=!1;if(e&&this.paneCompositeService.getActivePaneComposite(1))this.paneCompositeService.hideActivePaneComposite(1),!Tc&&!this.isAuxiliaryBarMaximized()&&(s=!0);else if(!e&&!this.paneCompositeService.getActivePaneComposite(1)){let l=this.paneCompositeService.getLastActivePaneCompositeId(1);(!l||!this.hasViews(l))&&(l=this.viewDescriptorService.getViewContainersByLocation(1).find(c=>this.hasViews(c.id))?.id),l&&this.openViewContainer(1,l,!t)}o!==e&&(e?this.stateModel.setRuntimeValue(Io.PANEL_WAS_LAST_MAXIMIZED,n):!t&&n!==r&&this.toggleMaximizedPanel(),s&&this.editorGroupService.mainPart.activeGroup.focus())}isAuxiliaryBarMaximized(){return this.stateModel.getRuntimeValue(Io.AUXILIARYBAR_WAS_LAST_MAXIMIZED)}toggleMaximizedAuxiliaryBar(){this.setAuxiliaryBarMaximized(!this.isAuxiliaryBarMaximized())}setAuxiliaryBarMaximized(e){if(this.inMaximizedAuxiliaryBarTransition||e===this.isAuxiliaryBarMaximized())return!1;if(e){let t={sideBarVisible:this.isVisible("workbench.parts.sidebar"),editorVisible:this.isVisible("workbench.parts.editor"),panelVisible:this.isVisible("workbench.parts.panel"),auxiliaryBarVisible:this.isVisible("workbench.parts.auxiliarybar")};this.stateModel.setRuntimeValue(Io.AUXILIARYBAR_WAS_LAST_MAXIMIZED,!0),this.inMaximizedAuxiliaryBarTransition=!0;try{t.auxiliaryBarVisible||this.setAuxiliaryBarHidden(!1);let o=this.workbenchGrid.getViewSize(this.auxiliaryBarPartView).width;this.stateModel.setRuntimeValue(Io.AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE,o),t.sideBarVisible&&this.setSideBarHidden(!0),t.panelVisible&&this.setPanelHidden(!0),t.editorVisible&&this.setEditorHidden(!0),this.stateModel.setRuntimeValue(Io.AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY,t)}finally{this.inMaximizedAuxiliaryBarTransition=!1}}else{let t=Ti(this.stateModel.getRuntimeValue(Io.AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY));this.stateModel.setRuntimeValue(Io.AUXILIARYBAR_WAS_LAST_MAXIMIZED,!1),this.inMaximizedAuxiliaryBarTransition=!0;try{this.setEditorHidden(!t?.editorVisible),this.setPanelHidden(!t?.panelVisible),this.setSideBarHidden(!t?.sideBarVisible);let o=this.workbenchGrid.getViewSize(this.auxiliaryBarPartView);this.workbenchGrid.resizeView(this.auxiliaryBarPartView,{width:this.stateModel.getRuntimeValue(Io.AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE),height:o.height})}finally{this.inMaximizedAuxiliaryBarTransition=!1}}return this.focusPart("workbench.parts.auxiliarybar"),this._onDidChangeAuxiliaryBarMaximized.fire(),!0}isPanelMaximized(){return(this.getPanelAlignment()==="center"||!eg(this.getPanelPosition()))&&!this.isVisible("workbench.parts.editor",ut)&&!this.isAuxiliaryBarMaximized()}toggleMaximizedPanel(){let e=this.workbenchGrid.getViewSize(this.panelPartView),t=this.getPanelPosition(),o=!this.isPanelMaximized();o?(this.isVisible("workbench.parts.panel")&&(eg(t)?this.stateModel.setRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_HEIGHT,e.height):this.stateModel.setRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_WIDTH,e.width)),this.setEditorHidden(!0)):(this.setEditorHidden(!1),this.workbenchGrid.resizeView(this.panelPartView,{width:eg(t)?e.width:this.stateModel.getRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_WIDTH),height:eg(t)?this.stateModel.getRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_HEIGHT):e.height})),this.stateModel.setRuntimeValue(Io.PANEL_WAS_LAST_MAXIMIZED,o)}panelOpensMaximized(){if(this.getPanelAlignment()!=="center"&&eg(this.getPanelPosition()))return!1;let e=mco(this.configurationService.getValue("workbench.panel.opensMaximized")),t=this.stateModel.getRuntimeValue(Io.PANEL_WAS_LAST_MAXIMIZED);return e===0||e===2&&t}setAuxiliaryBarHidden(e,t){if(!(e&&this.setAuxiliaryBarMaximized(!1)&&!this.isVisible("workbench.parts.auxiliarybar"))){if(this.stateModel.setRuntimeValue(Io.AUXILIARYBAR_HIDDEN,e),e?this.mainContainer.classList.add("noauxiliarybar"):this.mainContainer.classList.remove("noauxiliarybar"),this.workbenchGrid.setViewVisible(this.auxiliaryBarPartView,!e),e&&this.paneCompositeService.getActivePaneComposite(2))this.paneCompositeService.hideActivePaneComposite(2),this.focusPanelOrEditor();else if(!e&&!this.paneCompositeService.getActivePaneComposite(2)){let o=this.paneCompositeService.getLastActivePaneCompositeId(2);(!o||!this.hasViews(o))&&(o=this.viewDescriptorService.getViewContainersByLocation(2).find(n=>this.hasViews(n.id))?.id),o&&this.openViewContainer(2,o,!t)}}}setPartHidden(e,t){switch(t){case"workbench.parts.activitybar":return this.setActivityBarHidden(e);case"workbench.parts.sidebar":return this.setSideBarHidden(e);case"workbench.parts.editor":return this.setEditorHidden(e);case"workbench.parts.banner":return this.setBannerHidden(e);case"workbench.parts.auxiliarybar":return this.setAuxiliaryBarHidden(e);case"workbench.parts.panel":return this.setPanelHidden(e)}}hasMainWindowBorder(){return this.state.runtime.mainWindowBorder}getMainWindowBorderRadius(){return this.state.runtime.mainWindowBorder&&et?"10px":void 0}getSideBarPosition(){return this.stateModel.getRuntimeValue(Io.SIDEBAR_POSITON)}getPanelAlignment(){return this.stateModel.getRuntimeValue(Io.PANEL_ALIGNMENT)}updateMenubarVisibility(e){let t=WH(this.configurationService,ut,this.state.runtime.menuBar.toggled);!e&&this.workbenchGrid&&t!==this.isVisible("workbench.parts.titlebar",ut)&&this.workbenchGrid.setViewVisible(this.titleBarPartView,t)}updateCustomTitleBarVisibility(){let e=WH(this.configurationService,ut,this.state.runtime.menuBar.toggled),t=this.isVisible("workbench.parts.titlebar");e!==t&&this.workbenchGrid.setViewVisible(this.titleBarPartView,e)}toggleMenuBar(){let e=sM(this.configurationService);typeof e!="string"&&(e="classic");let t;e==="visible"||e==="classic"?t=XF(this.configurationService)?"toggle":"compact":t="classic",this.configurationService.updateValue("window.menuBarVisibility",t)}getPanelPosition(){return this.stateModel.getRuntimeValue(Io.PANEL_POSITION)}setPanelPosition(e){this.isVisible("workbench.parts.panel")||this.setPanelHidden(!1);let t=this.getPart("workbench.parts.panel"),o=Bx(this.getPanelPosition()),n=Bx(e),r=Ti(t.getContainer());r.classList.remove(o),r.classList.add(n),t.updateStyles();let s=this.workbenchGrid.getViewSize(this.panelPartView),l=this.workbenchGrid.getViewSize(this.sideBarPartView),c=this.workbenchGrid.getViewSize(this.auxiliaryBarPartView),u=!this.isVisible("workbench.parts.editor",ut);n!==o&&!u&&(eg(e)?this.stateModel.setRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_WIDTH,s.width):eg(nme(o))&&this.stateModel.setRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_HEIGHT,s.height)),eg(e)&&this.getPanelAlignment()!=="center"&&u&&(this.toggleMaximizedPanel(),u=!1),this.stateModel.setRuntimeValue(Io.PANEL_POSITION,e);let p=this.isVisible("workbench.parts.sidebar"),h=this.isVisible("workbench.parts.auxiliarybar"),g=this.hasFocus("workbench.parts.panel");e===2?this.workbenchGrid.moveView(this.panelPartView,u?s.height:this.stateModel.getRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_HEIGHT),this.editorPartView,1):e===3?this.workbenchGrid.moveView(this.panelPartView,u?s.height:this.stateModel.getRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_HEIGHT),this.editorPartView,0):e===1?this.workbenchGrid.moveView(this.panelPartView,u?s.width:this.stateModel.getRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_WIDTH),this.editorPartView,3):this.workbenchGrid.moveView(this.panelPartView,u?s.width:this.stateModel.getRuntimeValue(Io.PANEL_LAST_NON_MAXIMIZED_WIDTH),this.editorPartView,2),g&&this.focusPart("workbench.parts.panel"),this.workbenchGrid.resizeView(this.sideBarPartView,l),p||this.setSideBarHidden(!0),this.workbenchGrid.resizeView(this.auxiliaryBarPartView,c),h||this.setAuxiliaryBarHidden(!0),eg(e)&&this.adjustPartPositions(this.getSideBarPosition(),this.getPanelAlignment(),e),this._onDidChangePanelPosition.fire(n)}isWindowMaximized(e){return this.state.runtime.maximized.has(hv(e))}updateWindowMaximizedState(e,t){this.mainContainer.classList.toggle("maximized",t);let o=hv(e);t!==this.state.runtime.maximized.has(o)&&(t?this.state.runtime.maximized.add(o):this.state.runtime.maximized.delete(o),this.updateWindowBorder(),this._onDidChangeWindowMaximized.fire({windowId:o,maximized:t}))}getVisibleNeighborPart(e,t){if(!this.workbenchGrid||!this.isVisible(e,ut))return;let o=this.workbenchGrid.getNeighborViews(this.getPart(e),t,!1);if(o)for(let n of o){let r=["workbench.parts.activitybar","workbench.parts.editor","workbench.parts.panel","workbench.parts.auxiliarybar","workbench.parts.sidebar","workbench.parts.statusbar","workbench.parts.titlebar"].find(s=>this.getPart(s)===n&&this.isVisible(s,ut));if(r!==void 0)return r}}onDidChangeWCO(){let e=this.workbenchGrid.getNeighborViews(this.titleBarPartView,0,!1).length>0,t=this.shouldShowBannerFirst();e!==t&&this.workbenchGrid.moveView(this.bannerPartView,IW.Distribute,this.titleBarPartView,t?0:1),this.workbenchGrid.setViewVisible(this.titleBarPartView,WH(this.configurationService,ut,this.state.runtime.menuBar.toggled))}arrangeEditorNodes(e,t,o){if(!e.sideBar&&!e.auxiliaryBar)return e.editor.size=t,e.editor;let n=[e.editor];return e.editor.size=o,e.sideBar&&(this.stateModel.getRuntimeValue(Io.SIDEBAR_POSITON)===0?n.splice(0,0,e.sideBar):n.push(e.sideBar),e.editor.size-=this.stateModel.getRuntimeValue(Io.SIDEBAR_HIDDEN)?0:e.sideBar.size),e.auxiliaryBar&&(this.stateModel.getRuntimeValue(Io.SIDEBAR_POSITON)===1?n.splice(0,0,e.auxiliaryBar):n.push(e.auxiliaryBar),e.editor.size-=this.stateModel.getRuntimeValue(Io.AUXILIARYBAR_HIDDEN)?0:e.auxiliaryBar.size),{type:"branch",data:n,size:t,visible:n.some(r=>r.visible)}}arrangeMiddleSectionNodes(e,t,o){let n=this.stateModel.getRuntimeValue(Io.ACTIVITYBAR_HIDDEN)?0:e.activityBar.size,r=this.stateModel.getRuntimeValue(Io.SIDEBAR_HIDDEN)?0:e.sideBar.size,s=this.stateModel.getRuntimeValue(Io.AUXILIARYBAR_HIDDEN)?0:e.auxiliaryBar.size,l=this.stateModel.getInitializationValue(Io.PANEL_SIZE)?0:e.panel.size,c=this.stateModel.getRuntimeValue(Io.PANEL_POSITION),u=this.stateModel.getRuntimeValue(Io.SIDEBAR_POSITON),p=[];if(!eg(c))p.push(e.editor),e.editor.size=t-n-r-l-s,c===1?p.push(e.panel):p.splice(0,0,e.panel),u===0?(p.push(e.auxiliaryBar),p.splice(0,0,e.sideBar),p.splice(0,0,e.activityBar)):(p.splice(0,0,e.auxiliaryBar),p.push(e.sideBar),p.push(e.activityBar));else{let h=this.stateModel.getRuntimeValue(Io.PANEL_ALIGNMENT),g=!(h==="center"||u===0&&h==="right"||u===1&&h==="left"),f=!(h==="center"||u===1&&h==="right"||u===0&&h==="left"),v=t-n-(g?0:r)-(f?0:s),b=this.arrangeEditorNodes({editor:e.editor,sideBar:g?e.sideBar:void 0,auxiliaryBar:f?e.auxiliaryBar:void 0},o-l,v),S=c===2?[b,e.panel]:[e.panel,b];p.push({type:"branch",data:S,size:v,visible:S.some(y=>y.visible)}),g||(u===0?p.splice(0,0,e.sideBar):p.push(e.sideBar)),f||(u===1?p.splice(0,0,e.auxiliaryBar):p.push(e.auxiliaryBar)),u===0?p.splice(0,0,e.activityBar):p.push(e.activityBar)}return p}createGridDescriptor(){let{width:e,height:t}=this._mainContainerDimension,o=this.stateModel.getInitializationValue(Io.SIDEBAR_SIZE),n=this.stateModel.getInitializationValue(Io.AUXILIARYBAR_SIZE),r=this.stateModel.getInitializationValue(Io.PANEL_SIZE),s=this.titleBarPartView.minimumHeight,l=this.bannerPartView.minimumHeight,c=this.statusBarPartView.minimumHeight,u=this.activityBarPartView.minimumWidth,p=t-s-c,h=[{type:"leaf",data:{type:"workbench.parts.titlebar"},size:s,visible:this.isVisible("workbench.parts.titlebar",ut)},{type:"leaf",data:{type:"workbench.parts.banner"},size:l,visible:!1}],g={type:"leaf",data:{type:"workbench.parts.activitybar"},size:u,visible:!this.stateModel.getRuntimeValue(Io.ACTIVITYBAR_HIDDEN)},f={type:"leaf",data:{type:"workbench.parts.sidebar"},size:o,visible:!this.stateModel.getRuntimeValue(Io.SIDEBAR_HIDDEN)},v={type:"leaf",data:{type:"workbench.parts.auxiliarybar"},size:n,visible:this.isVisible("workbench.parts.auxiliarybar")},b={type:"leaf",data:{type:"workbench.parts.editor"},size:0,visible:!this.stateModel.getRuntimeValue(Io.EDITOR_HIDDEN)},S={type:"leaf",data:{type:"workbench.parts.panel"},size:r,visible:!this.stateModel.getRuntimeValue(Io.PANEL_HIDDEN)},y=this.arrangeMiddleSectionNodes({activityBar:g,auxiliaryBar:v,editor:b,panel:S,sideBar:f},e,p),w={root:{type:"branch",size:e,data:[...this.shouldShowBannerFirst()?h.reverse():h,{type:"branch",data:y,size:p},{type:"leaf",data:{type:"workbench.parts.statusbar"},size:c,visible:!this.stateModel.getRuntimeValue(Io.STATUSBAR_HIDDEN)}]},orientation:0,width:e,height:t},x={activityBarVisible:!this.stateModel.getRuntimeValue(Io.ACTIVITYBAR_HIDDEN),sideBarVisible:!this.stateModel.getRuntimeValue(Io.SIDEBAR_HIDDEN),auxiliaryBarVisible:!this.stateModel.getRuntimeValue(Io.AUXILIARYBAR_HIDDEN),panelVisible:!this.stateModel.getRuntimeValue(Io.PANEL_HIDDEN),statusbarVisible:!this.stateModel.getRuntimeValue(Io.STATUSBAR_HIDDEN),sideBarPosition:Bx(this.stateModel.getRuntimeValue(Io.SIDEBAR_POSITON)),panelPosition:Bx(this.stateModel.getRuntimeValue(Io.PANEL_POSITION))};return this.telemetryService.publicLog2("startupLayout",x),w}dispose(){super.dispose(),this.disposed=!0}};function LBo(a){return a.getValue("zenMode")}var VJt=class{constructor(i,e,t,o){this.name=i;this.scope=e;this.target=t;this.defaultValue=o}},hI=class extends VJt{constructor(e,t,o,n,r){super(e,t,o,n);this.zenModeIgnore=r;this.runtime=!0}},d$e=class extends VJt{constructor(){super(...arguments);this.runtime=!1}},Io={MAIN_EDITOR_CENTERED:new hI("editor.centered",1,1,!1),ZEN_MODE_ACTIVE:new hI("zenMode.active",1,1,!1),ZEN_MODE_EXIT_INFO:new hI("zenMode.exitInfo",1,1,{transitionedToCenteredEditorLayout:!1,transitionedToFullScreen:!1,handleNotificationsDoNotDisturbMode:!1,wasVisible:{auxiliaryBar:!1,panel:!1,sideBar:!1}}),SIDEBAR_SIZE:new d$e("sideBar.size",0,1,300),AUXILIARYBAR_SIZE:new d$e("auxiliaryBar.size",0,1,300),PANEL_SIZE:new d$e("panel.size",0,1,300),PANEL_LAST_NON_MAXIMIZED_HEIGHT:new hI("panel.lastNonMaximizedHeight",0,1,300),PANEL_LAST_NON_MAXIMIZED_WIDTH:new hI("panel.lastNonMaximizedWidth",0,1,300),PANEL_WAS_LAST_MAXIMIZED:new hI("panel.wasLastMaximized",1,1,!1),AUXILIARYBAR_WAS_LAST_MAXIMIZED:new hI("auxiliaryBar.wasLastMaximized",1,1,!1),AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE:new hI("auxiliaryBar.lastNonMaximizedSize",0,1,300),AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY:new hI("auxiliaryBar.lastNonMaximizedVisibility",1,1,{sideBarVisible:!1,editorVisible:!1,panelVisible:!1,auxiliaryBarVisible:!1}),AUXILIARYBAR_EMPTY:new d$e("auxiliaryBar.empty",0,1,!1),SIDEBAR_POSITON:new hI("sideBar.position",1,1,0),PANEL_POSITION:new hI("panel.position",1,1,2),PANEL_ALIGNMENT:new hI("panel.alignment",0,0,"center"),ACTIVITYBAR_HIDDEN:new hI("activityBar.hidden",1,1,!1,!0),SIDEBAR_HIDDEN:new hI("sideBar.hidden",1,1,!1),EDITOR_HIDDEN:new hI("editor.hidden",1,1,!1),PANEL_HIDDEN:new hI("panel.hidden",1,1,!0),AUXILIARYBAR_HIDDEN:new hI("auxiliaryBar.hidden",1,1,!0),STATUSBAR_HIDDEN:new hI("statusBar.hidden",1,1,!1,!0)};var q$i=class a extends k{constructor(e,t,o,n){super();this.storageService=e;this.configurationService=t;this.contextService=o;this.environmentService=n;this._onDidChangeState=this._register(new T);this.onDidChangeState=this._onDidChangeState.event;this.stateCache=new Map;this.isNew={1:this.storageService.isNew(1),0:this.storageService.isNew(0),[-1]:this.storageService.isNew(-1),[-2]:this.storageService.isNew(-2)},this._register(this.configurationService.onDidChangeConfiguration(r=>this.updateStateFromLegacySettings(r)))}static{this.STORAGE_PREFIX="workbench."}updateStateFromLegacySettings(e){e.affectsConfiguration("workbench.activityBar.location")&&this.setRuntimeValueAndFire(Io.ACTIVITYBAR_HIDDEN,this.isActivityBarHidden()),e.affectsConfiguration("workbench.statusBar.visible")&&this.setRuntimeValueAndFire(Io.STATUSBAR_HIDDEN,!this.configurationService.getValue("workbench.statusBar.visible")),e.affectsConfiguration("workbench.sideBar.location")&&this.setRuntimeValueAndFire(Io.SIDEBAR_POSITON,nme(this.configurationService.getValue("workbench.sideBar.location")??"left"))}updateLegacySettingsFromState(e,t){let o=this.getRuntimeValue(Io.ZEN_MODE_ACTIVE);e.zenModeIgnore&&o||(e===Io.ACTIVITYBAR_HIDDEN?this.configurationService.updateValue("workbench.activityBar.location",t?"hidden":void 0):e===Io.STATUSBAR_HIDDEN?this.configurationService.updateValue("workbench.statusBar.visible",!t):e===Io.SIDEBAR_POSITON&&this.configurationService.updateValue("workbench.sideBar.location",Bx(t)))}load(e){let t;if(!e.resetLayout)for(t in Io){let s=Io[t],l=this.loadKeyFromStorage(s);l!==void 0&&this.stateCache.set(s.name,l)}this.stateCache.set(Io.ACTIVITYBAR_HIDDEN.name,this.isActivityBarHidden()),this.stateCache.set(Io.STATUSBAR_HIDDEN.name,!this.configurationService.getValue("workbench.statusBar.visible")),this.stateCache.set(Io.SIDEBAR_POSITON.name,nme(this.configurationService.getValue("workbench.sideBar.location")??"left"));let o=this.configurationService.getValue("workbench.secondarySideBar.forceMaximized"),n=this.contextService.getWorkbenchState(),r=e.mainContainerDimension;Io.SIDEBAR_SIZE.defaultValue=Math.min(300,r.width/4),Io.SIDEBAR_HIDDEN.defaultValue=n===1||o===!0,Io.AUXILIARYBAR_SIZE.defaultValue=o?Math.max(300,r.width/2):Math.min(300,r.width/4),Io.AUXILIARYBAR_HIDDEN.defaultValue=(()=>{if(Ft&&!this.environmentService.remoteAuthority)return!0;if(o===!0)return!1;let s=this.configurationService.inspect("workbench.secondarySideBar.defaultVisibility");if(s.defaultValue!=="hidden"&&!m5(s)&&this.stateCache.get(Io.AUXILIARYBAR_EMPTY.name))return!0;if(this.isNew[-1]&&s.value!=="hidden")return!1;switch(s.value){case"hidden":return!0;case"visibleInWorkspace":case"maximizedInWorkspace":return n===1;default:return!1}})(),Io.PANEL_SIZE.defaultValue=this.stateCache.get(Io.PANEL_POSITION.name)??eg(Io.PANEL_POSITION.defaultValue)?r.height/3:r.width/4,Io.PANEL_POSITION.defaultValue=nme(this.configurationService.getValue("workbench.panel.defaultLocation")??"bottom");for(t in Io){let s=Io[t];this.stateCache.get(s.name)===void 0&&this.stateCache.set(s.name,s.defaultValue)}this.applyOverrides(e),this._register(this.storageService.onDidChangeValue(0,void 0,this._store)(s=>{let l;for(l in Io){let c=Io[l];if(c instanceof hI&&c.scope===0&&c.target===0&&`${a.STORAGE_PREFIX}${c.name}`===s.key){let u=this.loadKeyFromStorage(c)??c.defaultValue;this.stateCache.get(c.name)!==u&&(this.stateCache.set(c.name,u),this._onDidChangeState.fire({key:c,value:u}))}}}))}applyOverrides(e){if(this.isNew[1]){let t=this.configurationService.getValue("workbench.secondarySideBar.defaultVisibility");this.configurationService.getValue("workbench.startupEditor")==="agentSessionsWelcomePage"?this.applyAuxiliaryBarHiddenOverride(!0):(t==="maximized"||t==="maximizedInWorkspace"&&this.contextService.getWorkbenchState()!==1)&&this.applyAuxiliaryBarMaximizedOverride()}this.getRuntimeValue(Io.PANEL_HIDDEN)&&this.getRuntimeValue(Io.EDITOR_HIDDEN)&&!this.getRuntimeValue(Io.AUXILIARYBAR_WAS_LAST_MAXIMIZED)&&this.setRuntimeValue(Io.EDITOR_HIDDEN,!1),this.isNew[1]&&e.mainContainerDimension.width<=G$i.width&&(this.setInitializationValue(Io.SIDEBAR_SIZE,Math.min(300,e.mainContainerDimension.width/4)),this.setInitializationValue(Io.AUXILIARYBAR_SIZE,Math.min(300,e.mainContainerDimension.width/4)))}applyAuxiliaryBarMaximizedOverride(){this.setRuntimeValue(Io.AUXILIARYBAR_LAST_NON_MAXIMIZED_VISIBILITY,{sideBarVisible:!this.getRuntimeValue(Io.SIDEBAR_HIDDEN),panelVisible:!this.getRuntimeValue(Io.PANEL_HIDDEN),editorVisible:!this.getRuntimeValue(Io.EDITOR_HIDDEN),auxiliaryBarVisible:!this.getRuntimeValue(Io.AUXILIARYBAR_HIDDEN)}),this.setRuntimeValue(Io.SIDEBAR_HIDDEN,!0),this.setRuntimeValue(Io.PANEL_HIDDEN,!0),this.setRuntimeValue(Io.EDITOR_HIDDEN,!0),this.setRuntimeValue(Io.AUXILIARYBAR_HIDDEN,!1),this.setRuntimeValue(Io.AUXILIARYBAR_LAST_NON_MAXIMIZED_SIZE,this.getInitializationValue(Io.AUXILIARYBAR_SIZE)),this.setRuntimeValue(Io.AUXILIARYBAR_WAS_LAST_MAXIMIZED,!0)}applyAuxiliaryBarHiddenOverride(e){this.setRuntimeValue(Io.AUXILIARYBAR_HIDDEN,e)}save(e,t){let o,n=this.getRuntimeValue(Io.ZEN_MODE_ACTIVE);for(o in Io){let r=Io[o];if(e&&r.scope===1||t&&r.scope===0){if(n&&r instanceof hI&&r.zenModeIgnore)continue;this.saveKeyToStorage(r)}}}getInitializationValue(e){return this.stateCache.get(e.name)}setInitializationValue(e,t){this.stateCache.set(e.name,t)}getRuntimeValue(e,t){if(t)switch(e){case Io.ACTIVITYBAR_HIDDEN:this.stateCache.set(e.name,this.isActivityBarHidden());break;case Io.STATUSBAR_HIDDEN:this.stateCache.set(e.name,!this.configurationService.getValue("workbench.statusBar.visible"));break;case Io.SIDEBAR_POSITON:this.stateCache.set(e.name,this.configurationService.getValue("workbench.sideBar.location")??"left");break}return this.stateCache.get(e.name)}setRuntimeValue(e,t){this.stateCache.set(e.name,t);let o=this.getRuntimeValue(Io.ZEN_MODE_ACTIVE);e.scope===0&&(!o||!e.zenModeIgnore)&&(this.saveKeyToStorage(e),this.updateLegacySettingsFromState(e,t))}isActivityBarHidden(){let e=this.configurationService.getValue("workbench.activityBar.visible");return e!==void 0?!e:this.configurationService.getValue("workbench.activityBar.location")!=="default"}setRuntimeValueAndFire(e,t){this.stateCache.get(e.name)!==t&&(this.setRuntimeValue(e,t),this._onDidChangeState.fire({key:e,value:t}))}saveKeyToStorage(e){let t=this.stateCache.get(e.name);this.storageService.store(`${a.STORAGE_PREFIX}${e.name}`,typeof t=="object"?JSON.stringify(t):t,e.scope,e.target)}loadKeyFromStorage(e){let t=this.storageService.get(`${a.STORAGE_PREFIX}${e.name}`,e.scope);if(t!==void 0)switch(this.isNew[e.scope]=!1,typeof e.defaultValue){case"boolean":return t==="true";case"number":return parseInt(t);case"object":return JSON.parse(t)}return t}};var BJt=class{constructor(){this.priority=90;this.name="notifications";this.when=YD;this.type="view"}getProvider(i){let e=i.get(Kd),t=i.get(Co),o=i.get(fe),n=i.get(br);function r(){let s=Dae(t);if(!s)return;o.executeCommand("notifications.showList");let l,c=t.lastFocusedList;if(c instanceof bc&&(l=c.indexOf(s)),l===void 0)return;function u(){if(o.executeCommand("notifications.showList"),c&&l!==void 0){c.domFocus();try{c.setFocus([l])}catch{}}}function p(){let g=Dae(t),f=g?.message.original.toString();if(!(!g||!f))return wX(g.source?d(4975,null,f,g.source):f,g.severity)}let h=p();if(h)return s.onDidClose(()=>e.next()),new qp("notification",{type:"view"},()=>h,()=>u(),"accessibility.verbosity.notification",void 0,EMn(s,n),()=>{if(c)return u(),c.focusNext(),p()},()=>{if(c)return u(),c.focusPrevious(),p()})}return r()}};function EMn(a,i){let e;if(a.actions&&(e=[],a.actions.primary&&e.push(...a.actions.primary),a.actions.secondary&&e.push(...a.actions.secondary)),e)for(let o of e){o.class=q.asClassName(L.bell);let n=o.run;o.run=()=>{n(),a.close()}}let t=e?.find(o=>o.label.includes("Manage Extension"));return t&&(t.class=q.asClassName(L.gear)),e&&e.push({id:"clearNotification",label:d(4974,null),tooltip:d(4974,null),run:()=>{a.close(),i.playSignal(tn.clear)},enabled:!0,class:q.asClassName(L.clearAll)}),e}var M7=class{constructor(i,e){this._configurationService=i;this._languageService=e}static{this._ttpTokenizer=zf("tokenizeToString",{createHTML(i){return i}})}async renderCodeBlock(i,e,t){let o=fn(t.context)?t.context:void 0,n;i?n=this._languageService.getLanguageIdByLanguageName(i):o&&(n=o.getModel()?.getLanguageId()),n||(n=es);let r=await EK(this._languageService,e,n),s=M7._ttpTokenizer?M7._ttpTokenizer.createHTML(r)??r:r,l=document.createElement("span");l.innerHTML=s;let c=l.querySelector(".monaco-tokenized-source");return go(c)?(ku(c,this.getFontInfo(o)),l):document.createElement("span")}getFontInfo(i){return i?i.getOption(59):RI({fontFamily:this._configurationService.getValue("editor").fontFamily},1)}};M7=I([m(0,B),m(1,Rt)],M7);var HJt=class extends WJt{constructor(e,t,o,n){super(e,{resetLayout:!!t?.resetLayout});this.options=t;this.serviceCollection=o;this._onWillShutdown=this._register(new T);this.onWillShutdown=this._onWillShutdown.event;this._onDidShutdown=this._register(new T);this.onDidShutdown=this._onDidShutdown.event;this.previousUnexpectedError={message:void 0,time:0};Wo("code/willStartWorkbench"),this.registerErrorHandler(n)}registerErrorHandler(e){ed||(Error.stackTraceLimit=100),ut.addEventListener("unhandledrejection",t=>{mt(t.reason),t.preventDefault()}),V4i(t=>this.handleUnexpectedError(t,e))}handleUnexpectedError(e,t){let o=Mn(e,!0);if(!o)return;let n=Date.now();o===this.previousUnexpectedError.message&&n-this.previousUnexpectedError.time<=1e3||(this.previousUnexpectedError.time=n,this.previousUnexpectedError.message=o,t.error(o))}startup(){try{this._register(C3i(175));let e=this.initServices(this.serviceCollection);return e.invokeFunction(t=>{let o=t.get(to),n=t.get(de),r=t.get(B),s=t.get(ti),l=t.get(ot),c=t.get(ct),u=t.get(Ne);t.get(_n).setDefaultCodeBlockRenderer(e.createInstance(M7)),IJi((h,g)=>e.createInstance(Kf,h,{instantHover:g},{})),RZi(l),this.initLayout(t),oe.as(Zi.Workbench).start(t),oe.as(en.EditorFactory).start(t),this._register(e.createInstance(c$e)),this.registerListeners(o,n,r,s,c),this.renderWorkbench(e,u,n,r),this.createWorkbenchLayout(),this.layout(),this.restore(o)}),e}catch(e){throw mt(e),e}}initServices(e){e.set(wi,this);let t=b6i();for(let[n,r]of t)e.set(n,r);let o=new xNe(e,!0);return o.invokeFunction(n=>{let r=n.get(to),s=n.get(B);s&&"acquireInstantiationService"in s&&s.acquireInstantiationService(o),r.phase=2}),o}registerListeners(e,t,o,n,r){this._register(o.onDidChangeConfiguration(s=>this.updateFontAliasing(s,o))),Qr?this._register(t.onWillSaveState(s=>{s.reason===1&&this.storeFontInfo(t)})):this._register(e.onWillShutdown(()=>this.storeFontInfo(t))),this._register(e.onWillShutdown(s=>this._onWillShutdown.fire(s))),this._register(e.onDidShutdown(()=>{this._onDidShutdown.fire(),this.dispose()})),this._register(n.onDidChangeFocus(s=>{s||t.flush()})),this._register(r.onWillShowDialog(()=>this.mainContainer.classList.add("modal-dialog-visible"))),this._register(r.onDidShowDialog(()=>this.mainContainer.classList.remove("modal-dialog-visible")))}updateFontAliasing(e,t){if(!et||e&&!e.affectsConfiguration("workbench.fontAliasing"))return;let o=t.getValue("workbench.fontAliasing");if(this.fontAliasing===o)return;this.fontAliasing=o;let n=["antialiased","none","auto"];this.mainContainer.classList.remove(...n.map(r=>`monaco-font-aliasing-${r}`)),n.some(r=>r===o)&&this.mainContainer.classList.add(`monaco-font-aliasing-${o}`)}restoreFontInfo(e,t){let o=e.get("editorFontInfo",-1);if(o)try{let n=JSON.parse(o);Array.isArray(n)&&zw.restoreFontInfo(ut,n)}catch{}zw.readFontInfo(ut,RI(t.getValue("editor"),Gu.getInstance(ut).value))}storeFontInfo(e){let t=zw.serializeFontInfo(ut);t&&e.store("editorFontInfo",JSON.stringify(t),-1,1)}renderWorkbench(e,t,o,n){DQi(this.mainContainer),Ipo((l,c)=>e.createInstance(tre,l,c));let s=ui(["monaco-workbench",ii?"windows":Sn?"linux":"mac",Ft?"web":void 0,Iz?"chromium":ed?"firefox":_S?"safari":void 0,...this.getLayoutClasses(),...this.options?.extraClasses?this.options.extraClasses:[]]);this.mainContainer.classList.add(...s),this.updateFontAliasing(void 0,n),this.restoreFontInfo(o,n);for(let{id:l,role:c,classes:u,options:p}of[{id:"workbench.parts.titlebar",role:"none",classes:["titlebar"]},{id:"workbench.parts.banner",role:"banner",classes:["banner"]},{id:"workbench.parts.activitybar",role:"none",classes:["activitybar",this.getSideBarPosition()===0?"left":"right"]},{id:"workbench.parts.sidebar",role:"none",classes:["sidebar",this.getSideBarPosition()===0?"left":"right"]},{id:"workbench.parts.editor",role:"main",classes:["editor"],options:{restorePreviousState:this.willRestoreEditors()}},{id:"workbench.parts.panel",role:"none",classes:["panel","basepanel",Bx(this.getPanelPosition())]},{id:"workbench.parts.auxiliarybar",role:"none",classes:["auxiliarybar","basepanel",this.getSideBarPosition()===0?"right":"left"]},{id:"workbench.parts.statusbar",role:"status",classes:["statusbar"]}]){let h=this.createPart(l,c,u);Wo(`code/willCreatePart/${l}`),this.getPart(l).create(h,p),Wo(`code/didCreatePart/${l}`)}this.createNotificationsHandlers(e,t),this.parent.appendChild(this.mainContainer)}createPart(e,t,o){let n=document.createElement(t==="status"?"footer":"div");return n.classList.add("part",...o),n.id=e,n.setAttribute("role",t),t==="status"&&n.setAttribute("aria-live","off"),n}createNotificationsHandlers(e,t){let o=this._register(e.createInstance(nz,this.mainContainer,t.model)),n=this._register(e.createInstance(oB,this.mainContainer,t.model));this._register(e.createInstance(FJt,t.model));let r=e.createInstance(l$e,t.model);this._register(o.onDidChangeVisibility(()=>{r.update(o.isVisible,n.isVisible),n.update(o.isVisible)})),this._register(n.onDidChangeVisibility(()=>{r.update(o.isVisible,n.isVisible)})),CBo(o,n,t.model),_a.register(new BJt),this.registerNotifications({onDidChangeNotificationsVisibility:U.map(U.any(n.onDidChangeVisibility,o.onDidChangeVisibility),()=>n.isVisible||o.isVisible)})}restore(e){try{this.restoreParts()}catch(t){mt(t)}this.whenReady.finally(()=>Promise.race([this.whenRestored,Li(2e3)]).finally(()=>{function t(){Wo("code/didStartWorkbench"),performance.measure("perf: workbench create & restore","code/didLoadWorkbenchMain","code/didStartWorkbench")}this.isRestored()?t():this.whenRestored.finally(()=>t()),e.phase=3,this._register(new Dt(()=>{this._register(Ff(ut,()=>e.phase=4,2500))},2500)).schedule()}))}};var u$e=globalThis.vscode,Xl=u$e.ipcRenderer,PBo=u$e.ipcMessagePort,ABo=u$e.webFrame,JE=u$e.process,YuI=u$e.context,XuI=u$e.webUtils;var Kht=8,Ght=-8;function gj(a,i){a=Math.min(Math.max(a,Ght),Kht);let e=[];i===1?e.push(zi()):i===2?e.push(...Array.from(dx()).map(({window:t})=>t)):e.push(i);for(let t of e)TMn(t)?.webFrame?.setZoomLevel(a),D3i(Bde(a),t),_3i(a,t)}function TMn(a){if(a===ut)return{ipcRenderer:Xl,webFrame:ABo};{let i=a;if(i?.vscode?.ipcRenderer&&i?.vscode?.webFrame)return i.vscode}}var p$e=le("integrityService");var Jr=ko,fg=class extends Zu{constructor(e,t){super(e,{homeDir:e.homeDir,tmpDir:e.tmpDir,userDataDir:e.userDataDir},t);this.configuration=e}get mainPid(){return this.configuration.mainPid}get machineId(){return this.configuration.machineId}get sqmId(){return this.configuration.sqmId}get devDeviceId(){return this.configuration.devDeviceId}get isPortable(){return this.configuration.isPortable}get remoteAuthority(){return this.configuration.remoteAuthority}get expectsResolverExtension(){return!!this.configuration.remoteAuthority?.includes("+")}get execPath(){return this.configuration.execPath}get backupPath(){return this.configuration.backupPath}get window(){return{id:this.configuration.windowId,handle:this.configuration.handle,colorScheme:this.configuration.colorScheme,maximized:this.configuration.maximized,accessibilitySupport:this.configuration.accessibilitySupport,perfMarks:this.configuration.perfMarks,isInitialStartup:this.configuration.isInitialStartup,isCodeCaching:typeof this.configuration.codeCachePath=="string"}}get windowLogsPath(){return Ve(this.logsHome,`window${this.configuration.windowId}`)}get logFile(){return Ve(this.windowLogsPath,"renderer.log")}get extHostLogsPath(){return Ve(this.windowLogsPath,"exthost")}get webviewExternalEndpoint(){return`${Q.vscodeWebview}://{{uuid}}`}get skipReleaseNotes(){return!!this.args["skip-release-notes"]}get skipWelcome(){return!!this.args["skip-welcome"]}get logExtensionHostCommunication(){return!!this.args.logExtensionHostCommunication}get enableSmokeTestDriver(){return!!this.args["enable-smoke-test-driver"]}get extensionEnabledProposedApi(){if(Array.isArray(this.args["enable-proposed-api"]))return this.args["enable-proposed-api"];if("enable-proposed-api"in this.args)return[]}get os(){return this.configuration.os}get filesToOpenOrCreate(){return this.configuration.filesToOpenOrCreate}get filesToDiff(){return this.configuration.filesToDiff}get filesToMerge(){return this.configuration.filesToMerge}get filesToWait(){return this.configuration.filesToWait}get isSessionsWindow(){return!!this.configuration.isSessionsWindow}};I([bi],fg.prototype,"mainPid",1),I([bi],fg.prototype,"machineId",1),I([bi],fg.prototype,"sqmId",1),I([bi],fg.prototype,"devDeviceId",1),I([bi],fg.prototype,"isPortable",1),I([bi],fg.prototype,"remoteAuthority",1),I([bi],fg.prototype,"expectsResolverExtension",1),I([bi],fg.prototype,"execPath",1),I([bi],fg.prototype,"backupPath",1),I([bi],fg.prototype,"window",1),I([bi],fg.prototype,"windowLogsPath",1),I([bi],fg.prototype,"logFile",1),I([bi],fg.prototype,"extHostLogsPath",1),I([bi],fg.prototype,"webviewExternalEndpoint",1),I([bi],fg.prototype,"skipReleaseNotes",1),I([bi],fg.prototype,"skipWelcome",1),I([bi],fg.prototype,"logExtensionHostCommunication",1),I([bi],fg.prototype,"enableSmokeTestDriver",1),I([bi],fg.prototype,"extensionEnabledProposedApi",1),I([bi],fg.prototype,"os",1),I([bi],fg.prototype,"filesToOpenOrCreate",1),I([bi],fg.prototype,"filesToDiff",1),I([bi],fg.prototype,"filesToMerge",1),I([bi],fg.prototype,"filesToWait",1),I([bi],fg.prototype,"isSessionsWindow",1);var rm=le("mainProcessService");var UJt=class{constructor(i,e,t,o){let n=t.getChannel(i);return _Mn(e)?o.createInstance(new Vt(e.channelClientCtor,[n])):Xd.toService(n,e?.proxyOptions)}};function _Mn(a){return!!a?.channelClientCtor}var qht=class extends UJt{constructor(i,e,t,o){super(i,e,t,o)}};qht=I([m(2,rm),m(3,F)],qht);function _w(a,i,e){Ce(a,new Vt(qht,[i,e],!0))}var kS=le("sharedProcessService"),$ht=class extends UJt{constructor(i,e,t,o){super(i,e,t,o)}};$ht=I([m(2,kS),m(3,F)],$ht);function lv(a,i,e){Ce(a,new Vt($ht,[i,e],!0))}var $$i=class{constructor(i){this.port=i;this.onMessage=U.fromDOMEventEmitter(this.port,"message",e=>e.data?Ke.wrap(e.data):Ke.alloc(0)),i.start()}send(i){this.port.postMessage(i.buffer)}disconnect(){this.port.close()}},fj=class extends Ree{constructor(i,e){let t=new $$i(i);super(t,e),this.protocol=t}dispose(){this.protocol.disconnect(),super.dispose()}};async function rz(a,i,e=ht()){PBo.acquire(i,e),typeof a=="string"&&Xl.send(a,e);let t=U.fromDOMEventEmitter(ut,"message",n=>({nonce:n.data,port:n.ports[0],source:n.source})),{port:o}=await U.toPromise(U.once(U.filter(t,n=>n.nonce===e&&n.source===ut)));return o}var NBo="utilityProcessWorker";var zJt=le("utilityProcessWorkerWorkbenchService"),m$e=class extends k{constructor(e,t,o){super();this.windowId=e;this.logService=t;this.mainProcessService=o;this._utilityProcessWorkerService=void 0;this.restoredBarrier=new ip}get utilityProcessWorkerService(){if(!this._utilityProcessWorkerService){let e=this.mainProcessService.getChannel(NBo);this._utilityProcessWorkerService=Xd.toService(e)}return this._utilityProcessWorkerService}async createWorker(e){this.logService.trace("Renderer->UtilityProcess#createWorker"),await Promise.race([this.restoredBarrier.wait(),Li(2e3)]);let t=ht(),o="vscode:createUtilityProcessWorkerMessageChannelResult",n=rz(void 0,o,t),r=this.utilityProcessWorkerService.createWorker({process:e,reply:{windowId:this.windowId,channel:o,nonce:t}}),s=new O;s.add(ee(()=>{this.logService.trace("Renderer->UtilityProcess#disposeWorker",e),this.utilityProcessWorkerService.disposeWorker({process:e,reply:{windowId:this.windowId}})}));let l=await n,c=s.add(new fj(l,`window:${this.windowId},module:${e.moduleId}`));return this.logService.trace("Renderer->UtilityProcess#createWorkerChannel: connection established"),r.then(({reason:u})=>{u?.code===0?this.logService.trace(`[UtilityProcessWorker]: terminated normally with code ${u.code}, signal: ${u.signal}`):this.logService.error(`[UtilityProcessWorker]: terminated unexpectedly with code ${u?.code}, signal: ${u?.signal}`)}),{client:c,onDidTerminate:r,dispose:()=>s.dispose()}}notifyRestored(){this.restoredBarrier.isOpen()||this.restoredBarrier.open()}};m$e=I([m(1,re),m(2,rm)],m$e);var vj=class extends DR{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce,Se,Re,xe,He,Ee,Te,It,tt){super(ut,void 0,It,b,tt,M);this.editorService=e;this.editorGroupService=t;this.configurationService=o;this.titleService=n;this.themeService=r;this.notificationService=s;this.commandService=l;this.keybindingService=c;this.telemetryService=u;this.workspaceEditingService=p;this.fileService=h;this.menuService=g;this.lifecycleService=f;this.integrityService=v;this.nativeEnvironmentService=b;this.accessibilityService=S;this.contextService=y;this.openerService=w;this.nativeHostService=x;this.tunnelService=E;this.workingCopyService=N;this.filesConfigurationService=V;this.productService=H;this.remoteAuthorityResolverService=K;this.dialogService=j;this.storageService=J;this.logService=se;this.instantiationService=ae;this.sharedProcessService=ce;this.progressService=Se;this.labelService=Re;this.bannerService=xe;this.uriIdentityService=He;this.preferencesService=Ee;this.utilityProcessWorkerWorkbenchService=Te;this.customTitleContextMenuDisposable=this._register(new O);this.addRemoveFoldersScheduler=this._register(new Dt(()=>this.doAddRemoveFolders(),100));this.pendingFoldersToAdd=[];this.pendingFoldersToRemove=[];this.isDocumentedEdited=!1;this.touchBarDisposables=this._register(new O);this.mapWindowIdToZoomStatusEntry=new Map;this.configuredWindowZoomLevel=this.resolveConfiguredWindowZoomLevel(),this.registerListeners(),this.create()}registerListeners(){this._register($(ut,ne.RESIZE,()=>this.layoutService.layout())),this._register(this.editorService.onDidActiveEditorChange(()=>this.updateTouchbarMenu()));for(let t of[ne.DRAG_OVER,ne.DROP])this._register($(ut.document.body,t,o=>{Kt.stop(o)}));Xl.on("vscode:runAction",async(t,...o)=>{let n=o[0],r=n.args||[];if(n.from==="touchbar"){let s=this.editorService.activeEditor;if(s){let l=po.getOriginalUri(s,{supportSideBySide:1});l&&r.push(l)}}else r.push({from:n.from});try{await this.commandService.executeCommand(n.id,...r),this.telemetryService.publicLog2("workbenchActionExecuted",{id:n.id,from:n.from})}catch(s){this.notificationService.error(s)}}),Xl.on("vscode:runKeybinding",(t,...o)=>{let n=o[0],r=Un();r&&this.keybindingService.dispatchByUserSettingsLabel(n.userSettingsLabel,r)}),Xl.on("vscode:reportSharedProcessCrash",(t,...o)=>{this.notificationService.prompt(ft.Error,d(18498,null),[{label:d(18495,null),run:()=>this.nativeHostService.relaunch()}],{priority:3})}),Xl.on("vscode:openFiles",(t,...o)=>{this.onOpenFiles(o[0])}),Xl.on("vscode:addRemoveFolders",(t,...o)=>this.onAddRemoveFoldersRequest(o[0])),Xl.on("vscode:showInfoMessage",(t,...o)=>this.notificationService.info(o[0])),Xl.on("vscode:showResolveShellEnvError",(t,...o)=>{let n=o[0];this.notificationService.prompt(ft.Error,n,[{label:d(18495,null),run:()=>this.nativeHostService.relaunch()},{label:d(18484,null),run:()=>this.preferencesService.openUserSettings({query:"application.shellEnvironmentResolutionTimeout"})},{label:d(18487,null),run:()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2149667")}])}),Xl.on("vscode:showCredentialsError",(t,...o)=>{let n=o[0];this.notificationService.prompt(ft.Error,d(18486,null,n),[{label:d(18515,null),run:()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2190713")}])}),Xl.on("vscode:showTranslatedBuildWarning",()=>{this.notificationService.prompt(ft.Warning,d(18497,null,this.productService.nameLong),[{label:d(18485,null),run:()=>{let t=this.productService.quality;this.openerService.open(t==="stable"?"https://code.visualstudio.com/docs/?dv=osx":"https://code.visualstudio.com/docs/?dv=osx&build=insiders")}}],{priority:3})}),Xl.on("vscode:showArgvParseWarning",()=>{this.notificationService.prompt(ft.Warning,d(18499,null),[{label:d(18500,null),run:()=>this.editorService.openEditor({resource:this.nativeEnvironmentService.argvResource})}],{priority:3})}),Xl.on("vscode:enterFullScreen",()=>Gj(!0,ut)),Xl.on("vscode:leaveFullScreen",()=>Gj(!1,ut)),Xl.on("vscode:openProxyAuthenticationDialog",async(t,...o)=>{let n=o[0],r="window.rememberProxyCredentials",s=this.storageService.getBoolean(r,-1),l=await this.dialogService.input({type:"warning",message:d(18491,null),primaryButton:d(18488,null),inputs:[{placeholder:d(18516,null),value:n.username},{placeholder:d(18490,null),type:"password",value:n.password}],detail:d(18492,null,`${n.authInfo.host}:${n.authInfo.port}`),checkbox:{label:d(18493,null),checked:s}});if(!l.confirmed||!l.values)Xl.send(n.replyChannel);else{l.checkboxChecked?this.storageService.store(r,!0,-1,1):this.storageService.remove(r,-1);let[c,u]=l.values;Xl.send(n.replyChannel,{username:c,password:u,remember:!!l.checkboxChecked})}}),Xl.on("vscode:accessibilitySupportChanged",(t,...o)=>{let n=o[0];this.accessibilityService.setAccessibilitySupport(n?2:1)}),Xl.on("vscode:configureAllowedUNCHost",async(t,...o)=>{let n=o[0];if(!ii)return;let r=new Set,s=this.configurationService.getValue("security.allowedUNCHosts")??[];if(Array.isArray(s))for(let l of s)typeof l=="string"&&r.add(l);r.has(n)||(r.add(n),await ERt(z3.ID).ready,this.configurationService.updateValue("security.allowedUNCHosts",[...r.values()],2))}),Xl.on("vscode:disablePromptForProtocolHandling",(t,...o)=>{let r=o[0]==="local"?"security.promptForLocalFileProtocolHandling":"security.promptForRemoteFileProtocolHandling";this.configurationService.updateValue(r,!1)}),this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration("window.zoomLevel")||t.affectsConfiguration("window.zoomPerWindow")&&this.configurationService.getValue("window.zoomPerWindow")===!1?this.onDidChangeConfiguredWindowZoomLevel():t.affectsConfiguration("keyboard.touchbar.enabled")||t.affectsConfiguration("keyboard.touchbar.ignored")?this.updateTouchbarMenu():t.affectsConfiguration("window.border")&&this.updateWindowBorder()})),this._register(twe(t=>this.handleOnDidChangeZoomLevel(t)));for(let t of this.editorGroupService.parts)this.createWindowZoomStatusEntry(t);this._register(this.editorGroupService.onDidCreateAuxiliaryEditorPart(t=>this.createWindowZoomStatusEntry(t))),this._register(U.debounce(this.editorService.onDidVisibleEditorsChange,()=>{},0,void 0,void 0,void 0,this._store)(()=>this.maybeCloseWindow()));let e=this.nativeEnvironmentService.filesToWait;if(e&&this.trackClosedWaitFiles(e.waitMarkerFileUri,ui(e.paths.map(t=>t.fileUri))),et){for(let t of this.editorGroupService.parts)this.handleRepresentedFilename(t);this._register(this.editorGroupService.onDidCreateAuxiliaryEditorPart(t=>this.handleRepresentedFilename(t)))}this._register(this.workingCopyService.onDidChangeDirty(t=>{let o=t.isDirty();o&&!(t.capabilities&2)&&this.filesConfigurationService.hasShortAutoSaveDelay(t.resource)||this.updateDocumentEdited(o?!0:void 0)})),this.updateDocumentEdited(void 0),this._register(U.any(U.map(U.filter(this.nativeHostService.onDidMaximizeWindow,t=>!!yY(t)),t=>({maximized:!0,windowId:t})),U.map(U.filter(this.nativeHostService.onDidUnmaximizeWindow,t=>!!yY(t)),t=>({maximized:!1,windowId:t})))(t=>this.layoutService.updateWindowMaximizedState(gv(t.windowId).window,t.maximized))),this.layoutService.updateWindowMaximizedState(ut,this.nativeEnvironmentService.window.maximized??!1),this._register(this.layoutService.onDidChangePanelPosition(t=>this.onDidChangePanelPosition(nme(t)))),this.onDidChangePanelPosition(this.layoutService.getPanelPosition()),this._register(this.themeService.onDidColorThemeChange(()=>this.updateWindowBorder())),this._register(this.hostService.onDidChangeActiveWindow(()=>this.updateWindowBorder())),this._register(this.hostService.onDidChangeFocus(()=>this.updateWindowBorder())),this._register(this.lifecycleService.onBeforeShutdown(t=>this.onBeforeShutdown(t))),this._register(this.lifecycleService.onBeforeShutdownError(t=>this.onBeforeShutdownError(t))),this._register(this.lifecycleService.onWillShutdown(t=>this.onWillShutdown(t)))}handleRepresentedFilename(e){let t=new O;U.once(e.onWillDispose)(()=>t.dispose()),this.editorGroupService.getScopedInstantiationService(e).invokeFunction(o=>{let n=o.get(ie);t.add(n.onDidActiveEditorChange(()=>this.updateRepresentedFilename(n,e.windowId)))})}updateRepresentedFilename(e,t){let o=po.getOriginalUri(e.activeEditor,{supportSideBySide:1,filterByScheme:Q.file});this.nativeHostService.setRepresentedFilename(o?.fsPath??"",{targetWindowId:t}),t===ut.vscodeWindowId&&this.provideCustomTitleContextMenu(o?.fsPath)}onBeforeShutdown({veto:e,reason:t}){if(t===1){let o=this.configurationService.getValue("window.confirmBeforeClose"),n=o==="always"||o==="keyboardOnly"&&Ab.getInstance().isModifierPressed;if(n)return e((async()=>{let r=t;t===1&&!et&&await this.nativeHostService.getWindowCount()===1&&(r=2);let s=!0;return n&&(s=await this.instantiationService.invokeFunction(l=>vj.confirmOnShutdown(l,r))),s&&this.progressOnBeforeShutdown(t),!s})(),"veto.confirmBeforeClose")}this.progressOnBeforeShutdown(t)}progressOnBeforeShutdown(e){this.progressService.withProgress({location:10,delay:800,title:this.toShutdownLabel(e,!1)},()=>U.toPromise(U.any(this.lifecycleService.onWillShutdown,this.lifecycleService.onShutdownVeto,this.dialogService.onWillShowDialog)))}onBeforeShutdownError({error:e,reason:t}){this.dialogService.error(this.toShutdownLabel(t,!0),d(18502,null,Mn(e)))}onWillShutdown({reason:e,force:t,joiners:o}){let n=new Dt(()=>{let r=o();this.progressService.withProgress({location:20,buttons:[this.toForceShutdownLabel(e)],cancellable:!1,sticky:!0,title:this.toShutdownLabel(e,!1),detail:r.length>0?d(18517,null,r.map(s=>`- ${s.label}`).join(`
`)):void 0},()=>U.toPromise(this.lifecycleService.onDidShutdown),()=>{t()})},1200);n.schedule(),U.once(this.lifecycleService.onDidShutdown)(()=>n.dispose())}toShutdownLabel(e,t){if(t)switch(e){case 1:return d(18501,null);case 2:return d(18504,null);case 3:return d(18505,null);case 4:return d(18503,null)}switch(e){case 1:return d(18510,null);case 2:return d(18512,null);case 3:return d(18513,null);case 4:return d(18511,null)}}toForceShutdownLabel(e){switch(e){case 1:return d(18506,null);case 2:return d(18508,null);case 3:return d(18509,null);case 4:return d(18507,null)}}updateDocumentEdited(e){let t;typeof e=="boolean"?t=e:t=this.workingCopyService.hasDirty,(!this.isDocumentedEdited&&t||this.isDocumentedEdited&&!t)&&(this.isDocumentedEdited=t,this.nativeHostService.setDocumentEdited(t))}getWindowMinimumWidth(e=this.layoutService.getPanelPosition()){return e===0||e===1?qke.WIDTH_WITH_VERTICAL_PANEL:qke.WIDTH}onDidChangePanelPosition(e){let t=this.getWindowMinimumWidth(e);this.nativeHostService.setMinimumSize(t,void 0)}maybeCloseWindow(){if(this.configurationService.getValue("window.closeWhenEmpty")||this.nativeEnvironmentService.args.wait)for(let t of this.editorGroupService.parts)t.groups.some(o=>!o.isEmpty)||t===this.editorGroupService.mainPart&&(this.contextService.getWorkbenchState()!==1||this.environmentService.isExtensionDevelopment||this.editorService.visibleEditors.length>0)||(t===this.editorGroupService.mainPart?this.nativeHostService.closeWindow():t.removeGroup(t.activeGroup))}provideCustomTitleContextMenu(e){if(this.customTitleContextMenuDisposable.clear(),!e||yx(this.configurationService))return;let t=e.split(Vo.sep);for(let o=t.length;o>0;o--){let n=o===t.length,r=o;n||r++;let s=A.file(t.slice(0,r).join(Vo.sep)),l;n?l=this.labelService.getUriBasenameLabel(s):l=this.labelService.getUriBasenameLabel(ai(s));let c=`workbench.action.revealPathInFinder${o}`;this.customTitleContextMenuDisposable.add(Ge.registerCommand(c,()=>this.nativeHostService.showItemInFolder(s.fsPath))),this.customTitleContextMenuDisposable.add(be.appendMenuItem(R.TitleBarTitleContext,{command:{id:c,title:l||Vo.sep},order:-o,group:"1_file"}))}}create(){this.setupOpenHandlers(),this.lifecycleService.when(2).then(()=>this.nativeHostService.notifyReady()),this.lifecycleService.when(3).then(()=>{this.sharedProcessService.notifyRestored(),this.utilityProcessWorkerWorkbenchService.notifyRestored()}),this.handleWarnings(),this.updateTouchbarMenu(),this.updateWindowBorder(),this.environmentService.enableSmokeTestDriver&&vUt(this.instantiationService)}async handleWarnings(){if(await this.lifecycleService.when(3),(async()=>{let t=await this.nativeHostService.isAdmin(),{isPure:o}=await this.integrityService.isPure();this.titleService.updateProperties({isPure:o,isAdmin:t}),t&&!ii&&this.notificationService.warn(d(18496,null,this.productService.nameShort))})(),this.environmentService.isBuilt&&!this.environmentService.extensionDevelopmentLocationURI?.length){let t;et?t=ai(ai(ai(A.file(this.nativeEnvironmentService.appRoot)))):t=ai(ai(A.file(this.nativeEnvironmentService.appRoot)));for(let o of this.contextService.getWorkspace().folders)if(this.uriIdentityService.extUri.isEqualOrParent(o.uri,t)){this.bannerService.show({id:"appRootWarning.banner",message:d(18483,null,this.labelService.getUriLabel(t)),icon:L.warning});break}}if(et){let t=this.nativeEnvironmentService.os.release.split(".")[0],o=new Map([["20","macOS Big Sur"]]);if(o.has(t)){let n=d(18489,null,this.productService.nameLong,o.get(t));this.notificationService.prompt(ft.Warning,n,[{label:d(18487,null),run:()=>this.openerService.open(A.parse("https://aka.ms/vscode-faq-old-macOS"))}],{neverShowAgain:{id:"macoseol",isSecondary:!0,scope:2},priority:3,sticky:!0})}}let e=JE.shellEnv();this.progressService.withProgress({title:d(18494,null),location:10,delay:1600,buttons:[d(18487,null)]},()=>e,()=>this.openerService.open("https://go.microsoft.com/fwlink/?linkid=2149667"))}async resolveExternalUri(e,t){let o;if(t?.allowTunneling){let n=NLe(e),r=dmo(e);if(r&&(o=await this.openTunnel(r.address,r.port),o&&typeof o!="string")){if(o.tunnelRemotePort!==r.port)o.dispose(),o=void 0;else if(!n){let s=o;return{resolved:e,dispose:()=>s.dispose()}}}if(n){let s=await this.openTunnel(n.address,n.port);if(s&&typeof s!="string"){let l=A.parse(s.localAddress).with({path:e.path});return{resolved:l.scheme.startsWith(e.scheme)?l:e.with({authority:s.localAddress}),dispose(){s.dispose(),o&&typeof o!="string"&&o.dispose()}}}}}if(!t?.openExternal&&await this.fileService.canHandleResource(e))return{resolved:A.from({scheme:this.productService.urlProtocol,path:"workspace",query:e.toString()}),dispose(){}}}async openTunnel(e,t){let o=this.environmentService.remoteAuthority,n=o?{getAddress:async()=>(await this.remoteAuthorityResolverService.resolveAuthority(o)).authority}:void 0,r=await this.tunnelService.getExistingTunnel(e,t);return!r||typeof r=="string"?this.tunnelService.openTunnel(n,e,t):r}setupOpenHandlers(){this.openerService.setDefaultExternalOpener({openExternal:async e=>{if(!await this.nativeHostService.openExternal(e,this.configurationService.getValue("workbench.externalBrowser"))){let o=A.parse(e);o.scheme===Q.file&&await this.nativeHostService.showItemInFolder(o.fsPath)}return!0}}),this.openerService.registerExternalUriResolver({resolveExternalUri:async(e,t)=>this.resolveExternalUri(e,t)})}updateTouchbarMenu(){if(!et)return;this.touchBarDisposables.clear(),this.touchBarMenu=void 0;let e=this.touchBarDisposables.add(new Dt(()=>this.doUpdateTouchbarMenu(e),300));e.schedule()}doUpdateTouchbarMenu(e){if(!this.touchBarMenu){let c=this.editorService.activeEditorPane?.scopedContextKeyService||this.editorGroupService.activeGroup.scopedContextKeyService;this.touchBarMenu=this.menuService.createMenu(R.TouchBarContext,c),this.touchBarDisposables.add(this.touchBarMenu),this.touchBarDisposables.add(this.touchBarMenu.onDidChange(()=>e.schedule()))}let t=this.configurationService.getValue("keyboard.touchbar.enabled")===!1,o=this.configurationService.getValue("keyboard.touchbar.ignored"),n=Array.isArray(o)?o:[],r=Ng(this.touchBarMenu.getActions()),s=[],l=[];if(!t){for(let c of r)if(c instanceof Do){if(n.indexOf(c.item.id)>=0)continue;l.push(c.item)}else c instanceof oi&&(l.length&&s.push(l),l=[]);l.length&&s.push(l)}Qi(this.lastInstalledTouchedBar,s)||(this.lastInstalledTouchedBar=s,this.nativeHostService.updateTouchBar(s))}updateWindowBorder(){if(!ii)return;let e=this.themeService.getColorTheme(),t=e.getColor(T_e)?.toString(),o=e.getColor(__e)?.toString(),n=this.configurationService.getValue("window.border");n==="off"?(t="off",o=void 0):n==="default"?t=t??"default":n==="system"?(t="default",o=void 0):(t=n,o=void 0),this.nativeHostService.updateWindowAccentColor(t,o)}onAddRemoveFoldersRequest(e){this.pendingFoldersToAdd.push(...e.foldersToAdd.map(t=>A.revive(t))),this.pendingFoldersToRemove.push(...e.foldersToRemove.map(t=>A.revive(t))),this.addRemoveFoldersScheduler.isScheduled()||this.addRemoveFoldersScheduler.schedule()}async doAddRemoveFolders(){let e=this.pendingFoldersToAdd.map(o=>({uri:o})),t=this.pendingFoldersToRemove.slice(0);this.pendingFoldersToAdd=[],this.pendingFoldersToRemove=[],e.length&&await this.workspaceEditingService.addFolders(e),t.length&&await this.workspaceEditingService.removeFolders(t)}async onOpenFiles(e){let t=!!(e.filesToDiff&&e.filesToDiff.length===2),o=!!(e.filesToMerge&&e.filesToMerge.length===4),n=ui(await O_e(o?e.filesToMerge:t?e.filesToDiff:e.filesToOpenOrCreate,this.fileService,this.logService));if(n.length){let r=await this.openResources(n,t,o);if(e.filesToWait)return r.length?this.trackClosedWaitFiles(A.revive(e.filesToWait.waitMarkerFileUri),ui(e.filesToWait.paths.map(s=>A.revive(s.fileUri)))):this.fileService.del(A.revive(e.filesToWait.waitMarkerFileUri))}}async trackClosedWaitFiles(e,t){await this.instantiationService.invokeFunction(o=>ico(o,t)),await this.fileService.del(e)}async openResources(e,t,o){let n=[];if(o&&zg(e[0])&&zg(e[1])&&zg(e[2])&&zg(e[3])){let r={input1:{resource:e[0].resource},input2:{resource:e[1].resource},base:{resource:e[2].resource},result:{resource:e[3].resource},options:{pinned:!0}};n.push(r)}else if(t&&zg(e[0])&&zg(e[1])){let r={original:{resource:e[0].resource},modified:{resource:e[1].resource},options:{pinned:!0}};n.push(r)}else n.push(...e);return this.editorService.openEditors(n,void 0,{validateTrust:!0})}resolveConfiguredWindowZoomLevel(){let e=this.configurationService.getValue("window.zoomLevel");return typeof e=="number"?e:0}handleOnDidChangeZoomLevel(e){if(this.updateWindowZoomStatusEntry(e),e===ut.vscodeWindowId){let t=nx(ut),o;this.configuredWindowZoomLevel!==t&&(o=t),Xl.invoke("vscode:notifyZoomLevel",o)}}createWindowZoomStatusEntry(e){let t=new O;U.once(e.onWillDispose)(()=>t.dispose());let o=this.editorGroupService.getScopedInstantiationService(e);this.mapWindowIdToZoomStatusEntry.set(e.windowId,t.add(o.createInstance(jht))),t.add(ee(()=>this.mapWindowIdToZoomStatusEntry.delete(e.windowId))),this.updateWindowZoomStatusEntry(e.windowId)}updateWindowZoomStatusEntry(e){let t=gv(e),o=this.mapWindowIdToZoomStatusEntry.get(e);if(o&&t){let n=nx(t.window),r;n<this.configuredWindowZoomLevel?r="$(zoom-out)":n>this.configuredWindowZoomLevel&&(r="$(zoom-in)"),o.updateZoomEntry(r??!1,e)}}onDidChangeConfiguredWindowZoomLevel(){this.configuredWindowZoomLevel=this.resolveConfiguredWindowZoomLevel();let e=!1;for(let{window:t}of dx())if(nx(t)!==this.configuredWindowZoomLevel){e=!0;break}e&&gj(this.configuredWindowZoomLevel,2);for(let[t]of this.mapWindowIdToZoomStatusEntry)this.updateWindowZoomStatusEntry(t)}dispose(){super.dispose();for(let[,e]of this.mapWindowIdToZoomStatusEntry)e.dispose()}};vj=I([m(0,ie),m(1,kt),m(2,B),m(3,aP),m(4,ep),m(5,Ne),m(6,fe),m(7,Le),m(8,_e),m(9,iS),m(10,ge),m(11,Yt),m(12,to),m(13,p$e),m(14,Jr),m(15,Ai),m(16,Ae),m(17,Je),m(18,wo),m(19,Jp),m(20,wi),m(21,$a),m(22,fr),m(23,Ze),m(24,dd),m(25,ct),m(26,de),m(27,re),m(28,F),m(29,kS),m(30,Go),m(31,nt),m(32,LR),m(33,gt),m(34,Qo),m(35,zJt),m(36,ti),m(37,Xe)],vj);var jht=class extends k{constructor(e,t,o){super();this.statusbarService=e;this.commandService=t;this.keybindingService=o;this.disposable=this._register(new ue);this.zoomLevelLabel=void 0}updateZoomEntry(e,t){typeof e=="string"?(this.disposable.value||this.createZoomEntry(e),this.updateZoomLevelLabel(t)):this.disposable.clear()}createZoomEntry(e){let t=new O;this.disposable.value=t;let o=_(".zoom-status"),n=_(".zoom-status-left");o.appendChild(n);let r=t.add(new it("workbench.action.zoomOut",d(18520,null),q.asClassName(L.remove),!0,()=>this.commandService.executeCommand(r.id))),s=t.add(new it("workbench.action.zoomIn",d(18518,null),q.asClassName(L.plus),!0,()=>this.commandService.executeCommand(s.id))),l=t.add(new it("workbench.action.zoomReset",d(18521,null),void 0,!0,()=>this.commandService.executeCommand(l.id)));l.tooltip=this.keybindingService.appendKeybinding(l.label,l.id);let c=t.add(new it("workbench.action.openSettings",d(18522,null),q.asClassName(L.settingsGear),!0,()=>this.commandService.executeCommand(c.id,"window.zoom"))),u=t.add(new it("zoomLabel",void 0,void 0,!1));this.zoomLevelLabel=u,t.add(ee(()=>this.zoomLevelLabel=void 0));let p=t.add(new oo(n,{hoverDelegate:rC}));p.push(r,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(r.id)?.getLabel()}),p.push(this.zoomLevelLabel,{icon:!1,label:!0}),p.push(s,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(s.id)?.getLabel()});let h=_(".zoom-status-right");o.appendChild(h);let g=t.add(new oo(h,{hoverDelegate:rC}));g.push(l,{icon:!1,label:!0}),g.push(c,{icon:!0,label:!1,keybinding:this.keybindingService.lookupKeybinding(c.id)?.getLabel()});let f=d(18514,null);t.add(this.statusbarService.addEntry({name:f,text:e,tooltip:o,ariaLabel:f,command:i3,kind:"prominent"},"status.windowZoom",1,102))}updateZoomLevelLabel(e){if(this.zoomLevelLabel){let t=gv(e,!0).window,o=Math.round(uv(t)*100),n=nx(t);this.zoomLevelLabel.label=`${n}`,this.zoomLevelLabel.tooltip=d(18519,null,n,o)}}};jht=I([m(0,Fr),m(1,fe),m(2,Le)],jht);function Qht(a){return Object.isFrozen(a)?a:jQi(a)}var Su=class a{constructor(i,e,t,o,n){this._contents=i;this._keys=e;this._overrides=t;this._raw=o;this.logService=n;this.overrideConfigurations=new Map}static createEmptyModel(i){return new a({},[],[],void 0,i)}get rawConfiguration(){if(!this._rawConfiguration)if(this._raw){let i=(Array.isArray(this._raw)?this._raw:[this._raw]).map(e=>{if(e instanceof a)return e;let t=new qO("",this.logService);return t.parseRaw(e),t.configurationModel});this._rawConfiguration=i.reduce((e,t)=>t===e?t:e.merge(t),i[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(i=>i instanceof a)))return this._raw}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(i){return i?e3e(this.contents,i):this.contents}inspect(i,e){let t=this;return{get value(){return Qht(t.rawConfiguration.getValue(i))},get override(){return e?Qht(t.rawConfiguration.getOverrideValue(i,e)):void 0},get merged(){return Qht(e?t.rawConfiguration.override(e).getValue(i):t.rawConfiguration.getValue(i))},get overrides(){let o=[];for(let{contents:n,identifiers:r,keys:s}of t.rawConfiguration.overrides){let l=new a(n,s,[],void 0,t.logService).getValue(i);l!==void 0&&o.push({identifiers:r,value:l})}return o.length?Qht(o):void 0}}}getOverrideValue(i,e){let t=this.getContentsForOverrideIdentifer(e);return t?i?e3e(t,i):t:void 0}getKeysForOverrideIdentifier(i){let e=[];for(let t of this.overrides)t.identifiers.includes(i)&&e.push(...t.keys);return jo(e)}getAllOverrideIdentifiers(){let i=[];for(let e of this.overrides)i.push(...e.identifiers);return jo(i)}override(i){let e=this.overrideConfigurations.get(i);return e||(e=this.createOverrideConfigurationModel(i),this.overrideConfigurations.set(i,e)),e}merge(...i){let e=io(this.contents),t=io(this.overrides),o=[...this.keys],n=this._raw?Array.isArray(this._raw)?[...this._raw]:[this._raw]:[this];for(let r of i)if(n.push(...r._raw?Array.isArray(r._raw)?r._raw:[r._raw]:[r]),!r.isEmpty()){this.mergeContents(e,r.contents);for(let s of r.overrides){let[l]=t.filter(c=>eo(c.identifiers,s.identifiers));l?(this.mergeContents(l.contents,s.contents),l.keys.push(...s.keys),l.keys=jo(l.keys)):t.push(io(s))}for(let s of r.keys)o.indexOf(s)===-1&&o.push(s)}return new a(e,o,t,!n.length||n.every(r=>r instanceof a)?void 0:n,this.logService)}createOverrideConfigurationModel(i){let e=this.getContentsForOverrideIdentifer(i);if(!e||typeof e!="object"||!Object.keys(e).length)return this;let t={};for(let o of jo([...Object.keys(this.contents),...Object.keys(e)])){let n=this.contents[o],r=e[o];r&&(typeof n=="object"&&typeof r=="object"?(n=io(n),this.mergeContents(n,r)):n=r),t[o]=n}return new a(t,this.keys,this.overrides,void 0,this.logService)}mergeContents(i,e){for(let t of Object.keys(e)){if(t in i&&Di(i[t])&&Di(e[t])){this.mergeContents(i[t],e[t]);continue}i[t]=io(e[t])}}getContentsForOverrideIdentifer(i){let e=null,t=null,o=n=>{n&&(t?this.mergeContents(t,n):t=io(n))};for(let n of this.overrides)n.identifiers.length===1&&n.identifiers[0]===i?e=n.contents:n.identifiers.includes(i)&&o(n.contents);return o(e),t}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}addValue(i,e){this.updateValue(i,e,!0)}setValue(i,e){this.updateValue(i,e,!1)}removeValue(i){let e=this.keys.indexOf(i);e!==-1&&(this.keys.splice(e,1),g6i(this.contents,i),af.test(i)&&this.overrides.splice(this.overrides.findIndex(t=>eo(t.identifiers,Hz(i))),1))}updateValue(i,e,t){if(Yni(this.contents,i,e,o=>this.logService.error(o)),t=t||this.keys.indexOf(i)===-1,t&&this.keys.push(i),af.test(i)){let o=this.contents[i],n=Hz(i),r={identifiers:n,keys:Object.keys(o),contents:hce(o,l=>this.logService.error(l))},s=this.overrides.findIndex(l=>eo(l.identifiers,n));s!==-1?this.overrides[s]=r:this.overrides.push(r)}}},qO=class{constructor(i,e){this._name=i;this.logService=e;this._raw=null;this._configurationModel=null;this._restrictedConfigurations=[];this._parseErrors=[]}get configurationModel(){return this._configurationModel||Su.createEmptyModel(this.logService)}get restrictedConfigurations(){return this._restrictedConfigurations}get errors(){return this._parseErrors}parse(i,e){if(!mr(i)){let t=this.doParseContent(i);this.parseRaw(t,e)}}reparse(i){this._raw&&this.parseRaw(this._raw,i)}parseRaw(i,e){this._raw=i;let{contents:t,keys:o,overrides:n,restricted:r,hasExcludedProperties:s}=this.doParseRaw(i,e);this._configurationModel=new Su(t,o,n,s?[i]:void 0,this.logService),this._restrictedConfigurations=r||[]}doParseContent(i){let e={},t=null,o=[],n=[],r=[];function s(c){Array.isArray(o)?o.push(c):t!==null&&(o[t]=c)}let l={onObjectBegin:()=>{let c={};s(c),n.push(o),o=c,t=null},onObjectProperty:c=>{t=c},onObjectEnd:()=>{o=n.pop()},onArrayBegin:()=>{let c=[];s(c),n.push(o),o=c,t=null},onArrayEnd:()=>{o=n.pop()},onLiteralValue:s,onError:(c,u,p)=>{r.push({error:c,offset:u,length:p})}};if(i)try{rE(i,l),e=o[0]||{}}catch(c){this.logService.error(`Error while parsing settings file ${this._name}: ${c}`),this._parseErrors=[c]}return e}doParseRaw(i,e){let t=oe.as($t.Configuration),o=t.getConfigurationProperties(),n=t.getExcludedConfigurationProperties(),r=this.filter(i,o,n,!0,e);i=r.raw;let s=hce(i,u=>this.logService.error(`Conflict in settings file ${this._name}: ${u}`)),l=Object.keys(i),c=this.toOverrides(i,u=>this.logService.error(`Conflict in settings file ${this._name}: ${u}`));return{contents:s,keys:l,overrides:c,restricted:r.restricted,hasExcludedProperties:r.hasExcludedProperties}}filter(i,e,t,o,n){let r=!1;if(!n?.scopes&&!n?.skipRestricted&&!n?.skipUnregistered&&!n?.exclude?.length)return{raw:i,restricted:[],hasExcludedProperties:r};let s={},l=[];for(let c in i)if(af.test(c)&&o){let u=this.filter(i[c],e,t,!1,n);s[c]=u.raw,r=r||u.hasExcludedProperties,l.push(...u.restricted)}else{let u=e[c];u?.restricted&&l.push(c),this.shouldInclude(c,u,t,n)?s[c]=i[c]:r=!0}return{raw:s,restricted:l,hasExcludedProperties:r}}shouldInclude(i,e,t,o){if(o.exclude?.includes(i))return!1;if(o.include?.includes(i))return!0;if(o.skipRestricted&&e?.restricted||o.skipUnregistered&&!e)return!1;let n=e??t[i],r=n?typeof n.scope<"u"?n.scope:4:void 0;return r===void 0||o.scopes===void 0?!0:o.scopes.includes(r)}toOverrides(i,e){let t=[];for(let o of Object.keys(i))if(af.test(o)){let n={},r=i[o];for(let s in r)n[s]=r[s];t.push({identifiers:Hz(o),keys:Object.keys(n),contents:hce(n,e)})}return t}},Yht=class extends k{constructor(e,t,o,n,r){super();this.userSettingsResource=e;this.parseOptions=t;this.fileService=n;this.logService=r;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.parser=new qO(this.userSettingsResource.toString(),r),this._register(this.fileService.watch(o.dirname(this.userSettingsResource))),this._register(this.fileService.watch(this.userSettingsResource)),this._register(U.any(U.filter(this.fileService.onDidFilesChange,s=>s.contains(this.userSettingsResource)),U.filter(this.fileService.onDidRunOperation,s=>(s.isOperation(0)||s.isOperation(3)||s.isOperation(1)||s.isOperation(4))&&o.isEqual(s.resource,e)))(()=>this._onDidChange.fire()))}async loadConfiguration(){try{let e=await this.fileService.readFile(this.userSettingsResource);return this.parser.parse(e.value.toString()||"{}",this.parseOptions),this.parser.configurationModel}catch{return Su.createEmptyModel(this.logService)}}reparse(e){return e&&(this.parseOptions=e),this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}},j$i=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this.key=i;this.overrides=e;this._value=t;this.overrideIdentifiers=o;this.defaultConfiguration=n;this.policyConfiguration=r;this.applicationConfiguration=s;this.userConfiguration=l;this.localUserConfiguration=c;this.remoteUserConfiguration=u;this.workspaceConfiguration=p;this.folderConfigurationModel=h;this.memoryConfigurationModel=g}get value(){return Qht(this._value)}toInspectValue(i){return i?.value!==void 0||i?.override!==void 0||i?.overrides!==void 0?i: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)}},Xht=class a{constructor(i,e,t,o,n,r,s,l,c,u){this._defaultConfiguration=i;this._policyConfiguration=e;this._applicationConfiguration=t;this._localUserConfiguration=o;this._remoteUserConfiguration=n;this._workspaceConfiguration=r;this._folderConfigurations=s;this._memoryConfiguration=l;this._memoryConfigurationByResource=c;this.logService=u;this._workspaceConsolidatedConfiguration=null;this._foldersConsolidatedConfigurations=new dt;this._userConfiguration=null}getValue(i,e,t){return this.getConsolidatedConfigurationModel(i,e,t).getValue(i)}updateValue(i,e,t={}){let o;t.resource?(o=this._memoryConfigurationByResource.get(t.resource),o||(o=Su.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(t.resource,o))):o=this._memoryConfiguration,e===void 0?o.removeValue(i):o.setValue(i,e),t.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(i,e,t){let o=this.getConsolidatedConfigurationModel(i,e,t),n=this.getFolderConfigurationModelForResource(e.resource,t),r=e.resource?this._memoryConfigurationByResource.get(e.resource)||this._memoryConfiguration:this._memoryConfiguration,s=new Set;for(let l of o.overrides)for(let c of l.identifiers)o.getOverrideValue(i,c)!==void 0&&s.add(c);return new j$i(i,e,o.getValue(i),s.size?[...s]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,t?this._workspaceConfiguration:void 0,n||void 0,r)}keys(i){let e=this.getFolderConfigurationModelForResource(void 0,i);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(i){this._defaultConfiguration=i,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updatePolicyConfiguration(i){this._policyConfiguration=i}updateApplicationConfiguration(i){this._applicationConfiguration=i,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateLocalUserConfiguration(i){this._localUserConfiguration=i,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateRemoteUserConfiguration(i){this._remoteUserConfiguration=i,this._userConfiguration=null,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateWorkspaceConfiguration(i){this._workspaceConfiguration=i,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations.clear()}updateFolderConfiguration(i,e){this._folderConfigurations.set(i,e),this._foldersConsolidatedConfigurations.delete(i)}deleteFolderConfiguration(i){this.folderConfigurations.delete(i),this._foldersConsolidatedConfigurations.delete(i)}compareAndUpdateDefaultConfiguration(i,e){let t=[];if(!e){let{added:o,updated:n,removed:r}=Fae(this._defaultConfiguration,i);e=[...o,...n,...r]}for(let o of e)for(let n of Hz(o)){let r=this._defaultConfiguration.getKeysForOverrideIdentifier(n),s=i.getKeysForOverrideIdentifier(n),l=[...s.filter(c=>r.indexOf(c)===-1),...r.filter(c=>s.indexOf(c)===-1),...r.filter(c=>!Qi(this._defaultConfiguration.override(n).getValue(c),i.override(n).getValue(c)))];t.push([n,l])}return this.updateDefaultConfiguration(i),{keys:e,overrides:t}}compareAndUpdatePolicyConfiguration(i){let{added:e,updated:t,removed:o}=Fae(this._policyConfiguration,i),n=[...e,...t,...o];return n.length&&this.updatePolicyConfiguration(i),{keys:n,overrides:[]}}compareAndUpdateApplicationConfiguration(i){let{added:e,updated:t,removed:o,overrides:n}=Fae(this.applicationConfiguration,i),r=[...e,...t,...o];return r.length&&this.updateApplicationConfiguration(i),{keys:r,overrides:n}}compareAndUpdateLocalUserConfiguration(i){let{added:e,updated:t,removed:o,overrides:n}=Fae(this.localUserConfiguration,i),r=[...e,...t,...o];return r.length&&this.updateLocalUserConfiguration(i),{keys:r,overrides:n}}compareAndUpdateRemoteUserConfiguration(i){let{added:e,updated:t,removed:o,overrides:n}=Fae(this.remoteUserConfiguration,i),r=[...e,...t,...o];return r.length&&this.updateRemoteUserConfiguration(i),{keys:r,overrides:n}}compareAndUpdateWorkspaceConfiguration(i){let{added:e,updated:t,removed:o,overrides:n}=Fae(this.workspaceConfiguration,i),r=[...e,...t,...o];return r.length&&this.updateWorkspaceConfiguration(i),{keys:r,overrides:n}}compareAndUpdateFolderConfiguration(i,e){let t=this.folderConfigurations.get(i),{added:o,updated:n,removed:r,overrides:s}=Fae(t,e),l=[...o,...n,...r];return(l.length||!t)&&this.updateFolderConfiguration(i,e),{keys:l,overrides:s}}compareAndDeleteFolderConfiguration(i){let e=this.folderConfigurations.get(i);if(!e)throw new Error("Unknown folder");this.deleteFolderConfiguration(i);let{added:t,updated:o,removed:n,overrides:r}=Fae(e,void 0);return{keys:[...t,...o,...n],overrides:r}}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 i=this._localUserConfiguration.merge(this._remoteUserConfiguration);this._userConfiguration=new Su(i.contents,i.keys,i.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(i,e,t){let o=this.getConsolidatedConfigurationModelForResource(e,t);if(e.overrideIdentifier&&(o=o.override(e.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(i)!==void 0){o=o.merge();for(let n of this._policyConfiguration.keys)o.setValue(n,this._policyConfiguration.getValue(n))}return o}getConsolidatedConfigurationModelForResource({resource:i},e){let t=this.getWorkspaceConsolidatedConfiguration();if(e&&i){let o=e.getFolder(i);o&&(t=this.getFolderConsolidatedConfiguration(o.uri)||t);let n=this._memoryConfigurationByResource.get(i);n&&(t=t.merge(n))}return t}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(i){let e=this._foldersConsolidatedConfigurations.get(i);if(!e){let t=this.getWorkspaceConsolidatedConfiguration(),o=this._folderConfigurations.get(i);o?(e=t.merge(o),this._foldersConsolidatedConfigurations.set(i,e)):e=t}return e}getFolderConfigurationModelForResource(i,e){if(e&&i){let t=e.getFolder(i);if(t)return this._folderConfigurations.get(t.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((i,e)=>{let{contents:t,overrides:o,keys:n}=this._folderConfigurations.get(e);return i.push([e,{contents:t,overrides:o,keys:n}]),i},[])}}allKeys(){let i=new Set;return this._defaultConfiguration.keys.forEach(e=>i.add(e)),this.userConfiguration.keys.forEach(e=>i.add(e)),this._workspaceConfiguration.keys.forEach(e=>i.add(e)),this._folderConfigurations.forEach(e=>e.keys.forEach(t=>i.add(t))),[...i.values()]}allOverrideIdentifiers(){let i=new Set;return this._defaultConfiguration.getAllOverrideIdentifiers().forEach(e=>i.add(e)),this.userConfiguration.getAllOverrideIdentifiers().forEach(e=>i.add(e)),this._workspaceConfiguration.getAllOverrideIdentifiers().forEach(e=>i.add(e)),this._folderConfigurations.forEach(e=>e.getAllOverrideIdentifiers().forEach(t=>i.add(t))),[...i.values()]}getAllKeysForOverrideIdentifier(i){let e=new Set;return this._defaultConfiguration.getKeysForOverrideIdentifier(i).forEach(t=>e.add(t)),this.userConfiguration.getKeysForOverrideIdentifier(i).forEach(t=>e.add(t)),this._workspaceConfiguration.getKeysForOverrideIdentifier(i).forEach(t=>e.add(t)),this._folderConfigurations.forEach(t=>t.getKeysForOverrideIdentifier(i).forEach(o=>e.add(o))),[...e.values()]}static parse(i,e){let t=this.parseConfigurationModel(i.defaults,e),o=this.parseConfigurationModel(i.policy,e),n=this.parseConfigurationModel(i.application,e),r=this.parseConfigurationModel(i.userLocal,e),s=this.parseConfigurationModel(i.userRemote,e),l=this.parseConfigurationModel(i.workspace,e),c=i.folders.reduce((u,p)=>(u.set(A.revive(p[0]),this.parseConfigurationModel(p[1],e)),u),new dt);return new a(t,o,n,r,s,l,c,Su.createEmptyModel(e),new dt,e)}static parseConfigurationModel(i,e){return new Su(i.contents,i.keys,i.overrides,i.raw,e)}};function Q$i(...a){if(a.length===0)return{keys:[],overrides:[]};if(a.length===1)return a[0];let i=new Set,e=new Map;for(let o of a)o.keys.forEach(n=>i.add(n)),o.overrides.forEach(([n,r])=>{let s=cB(e,n,new Set);r.forEach(l=>s.add(l))});let t=[];return e.forEach((o,n)=>t.push([n,[...o.values()]])),{keys:[...i.values()],overrides:t}}var KJt=class{constructor(i,e,t,o,n){this.change=i;this.previous=e;this.currentConfiguraiton=t;this.currentWorkspace=o;this.logService=n;this._marker=`
`;this._markerCode1=this._marker.charCodeAt(0);this._markerCode2=46;this.affectedKeys=new Set;this._previousConfiguration=void 0;for(let r of i.keys)this.affectedKeys.add(r);for(let[,r]of i.overrides)for(let s of r)this.affectedKeys.add(s);this._affectsConfigStr=this._marker;for(let r of this.affectedKeys)this._affectsConfigStr+=r+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=Xht.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(i,e){let t=this._marker+i,o=this._affectsConfigStr.indexOf(t);if(o<0)return!1;let n=o+t.length;if(n>=this._affectsConfigStr.length)return!1;let r=this._affectsConfigStr.charCodeAt(n);if(r!==this._markerCode1&&r!==this._markerCode2)return!1;if(e){let s=this.previousConfiguration?this.previousConfiguration.getValue(i,e,this.previous?.workspace):void 0,l=this.currentConfiguraiton.getValue(i,e,this.currentWorkspace);return!Qi(s,l)}return!0}};function Fae(a,i){let{added:e,removed:t,updated:o}=OBo(i?.rawConfiguration,a?.rawConfiguration),n=[],r=a?.getAllOverrideIdentifiers()||[],s=i?.getAllOverrideIdentifiers()||[];if(i){let l=s.filter(c=>!r.includes(c));for(let c of l)n.push([c,i.getKeysForOverrideIdentifier(c)])}if(a){let l=r.filter(c=>!s.includes(c));for(let c of l)n.push([c,a.getKeysForOverrideIdentifier(c)])}if(i&&a){for(let l of r)if(s.includes(l)){let c=OBo({contents:a.getOverrideValue(void 0,l)||{},keys:a.getKeysForOverrideIdentifier(l)},{contents:i.getOverrideValue(void 0,l)||{},keys:i.getKeysForOverrideIdentifier(l)});n.push([l,[...c.added,...c.removed,...c.updated]])}}return{added:e,removed:t,updated:o,overrides:n}}function OBo(a,i){let e=a?i?a.keys.filter(n=>i.keys.indexOf(n)===-1):[...a.keys]:[],t=i?a?i.keys.filter(n=>a.keys.indexOf(n)===-1):[...i.keys]:[],o=[];if(a&&i){for(let n of i.keys)if(a.keys.indexOf(n)!==-1){let r=e3e(i.contents,n),s=e3e(a.contents,n);Qi(r,s)||o.push(n)}}return{added:e,removed:t,updated:o}}var GJt=class extends k{constructor(e){super();this.logService=e;this._onDidChangeConfiguration=this._register(new T);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._configurationModel=Su.createEmptyModel(e)}get configurationModel(){return this._configurationModel}async initialize(){return this.resetConfigurationModel(),this._register(oe.as($t.Configuration).onDidUpdateConfiguration(({properties:e,defaultsOverrides:t})=>this.onDidUpdateConfiguration(Array.from(e),t))),this.configurationModel}reload(){return this.resetConfigurationModel(),this.configurationModel}onDidUpdateConfiguration(e,t){this.updateConfigurationModel(e,oe.as($t.Configuration).getConfigurationProperties()),this._onDidChangeConfiguration.fire({defaults:this.configurationModel,properties:e})}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=Su.createEmptyModel(this.logService);let e=oe.as($t.Configuration).getConfigurationProperties();this.updateConfigurationModel(Object.keys(e),e)}updateConfigurationModel(e,t){let o=this.getConfigurationDefaultOverrides();for(let n of e){let r=o[n],s=t[n];r!==void 0?this._configurationModel.setValue(n,r):s?this._configurationModel.setValue(n,this.getDefaultValue(n,s)):this._configurationModel.removeValue(n)}}getDefaultValue(e,t){return io(t.default)}},qJt=class{constructor(){this.onDidChangeConfiguration=U.None;this.configurationModel=Su.createEmptyModel(new nSt)}async initialize(){return this.configurationModel}},h$e=class extends k{constructor(e,t,o){super();this.defaultConfiguration=e;this.policyService=t;this.logService=o;this._onDidChangeConfiguration=this._register(new T);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._configurationModel=Su.createEmptyModel(this.logService),this.configurationRegistry=oe.as($t.Configuration)}get configurationModel(){return this._configurationModel}async initialize(){return this.logService.trace("PolicyConfiguration#initialize"),this.update(await this.updatePolicyDefinitions(this.defaultConfiguration.configurationModel.keys),!1),this.update(await this.updatePolicyDefinitions(Object.keys(this.configurationRegistry.getExcludedConfigurationProperties())),!1),this._register(this.policyService.onDidChange(e=>this.onDidChangePolicies(e))),this._register(this.defaultConfiguration.onDidChangeConfiguration(async({properties:e})=>this.update(await this.updatePolicyDefinitions(e),!0))),this._configurationModel}async updatePolicyDefinitions(e){this.logService.trace("PolicyConfiguration#updatePolicyDefinitions",e);let t={},o=[],n=this.configurationRegistry.getConfigurationProperties(),r=this.configurationRegistry.getExcludedConfigurationProperties();for(let s of e){let l=n[s]??r[s];if(!l){o.push(s);continue}if(l.policy){if(l.type!=="string"&&l.type!=="number"&&l.type!=="array"&&l.type!=="object"&&l.type!=="boolean"){this.logService.warn(`Policy ${l.policy.name} has unsupported type ${l.type}`);continue}let{value:c,restrictedValue:u}=l.policy;o.push(s),t[l.policy.name]={type:l.type==="number"?"number":l.type==="boolean"?"boolean":"string",value:c,restrictedValue:u}}}return dv(t)||await this.policyService.updatePolicyDefinitions(t),o}onDidChangePolicies(e){this.logService.trace("PolicyConfiguration#onDidChangePolicies",e);let t=this.configurationRegistry.getPolicyConfigurations(),o=ui(e.map(n=>t.get(n)));this.update(o,!0)}update(e,t){this.logService.trace("PolicyConfiguration#update",e);let o=this.configurationRegistry.getConfigurationProperties(),n=this.configurationRegistry.getExcludedConfigurationProperties(),r=[],s=this._configurationModel.isEmpty();for(let l of e){let c=o[l]??n[l],u=c?.policy?.name;if(u){let p=this.policyService.getPolicyValue(u);if(We(p)&&c.type!=="string")try{p=this.parse(p)}catch(h){this.logService.error(`Error parsing policy value ${u}:`,Dn(h));continue}(s?p!==void 0:!Qi(this._configurationModel.getValue(l),p))&&r.push([l,p])}else this._configurationModel.getValue(l)!==void 0&&r.push([l,void 0])}if(r.length){this.logService.trace("PolicyConfiguration#changed",r);let l=this._configurationModel;this._configurationModel=Su.createEmptyModel(this.logService);for(let c of l.keys)this._configurationModel.setValue(c,l.getValue(c));for(let[c,u]of r)u===void 0?this._configurationModel.removeValue(c):this._configurationModel.setValue(c,u);t&&this._onDidChangeConfiguration.fire(this._configurationModel)}}parse(e){let t={},o=null,n=[],r=[],s=[];function l(u){if(Array.isArray(n))n.push(u);else if(o!==null){if(n[o]!==void 0)throw new Error(`Duplicate property found: ${o}`);n[o]=u}}if(e&&(rE(e,{onObjectBegin:()=>{let u={};l(u),r.push(n),n=u,o=null},onObjectProperty:u=>{o=u},onObjectEnd:()=>{n=r.pop()},onArrayBegin:()=>{let u=[];l(u),r.push(n),n=u,o=null},onArrayEnd:()=>{n=r.pop()},onLiteralValue:l,onError:(u,p,h)=>{s.push({error:u,offset:p,length:h})}}),t=n[0]||t),s.length>0)throw new Error(s.map(u=>Dn(u.error)).join(`
`));return t}};h$e=I([m(1,q_e),m(2,re)],h$e);var oye=class extends qO{constructor(e,t){super(e,t);this._folders=[];this._transient=!1;this._settingsModelParser=new qO(e,t),this._launchModel=Su.createEmptyModel(t),this._tasksModel=Su.createEmptyModel(t)}get folders(){return this._folders}get transient(){return this._transient}get settingsModel(){return this._settingsModelParser.configurationModel}get launchModel(){return this._launchModel}get tasksModel(){return this._tasksModel}reparseWorkspaceSettings(e){this._settingsModelParser.reparse(e)}getRestrictedWorkspaceSettings(){return this._settingsModelParser.restrictedConfigurations}doParseRaw(e,t){return this._folders=e.folders||[],this._transient=Xa(e.transient)&&e.transient,this._settingsModelParser.parseRaw(e.settings,t),this._launchModel=this.createConfigurationModelFrom(e,"launch"),this._tasksModel=this.createConfigurationModelFrom(e,"tasks"),super.doParseRaw(e,t)}createConfigurationModelFrom(e,t){let o=e[t];if(o){let n=hce(o,l=>console.error(`Conflict in settings file ${this._name}: ${l}`)),r=Object.create(null);r[t]=n;let s=Object.keys(o).map(l=>`${t}.${l}`);return new Su(r,s,[],void 0,this.logService)}return Su.createEmptyModel(this.logService)}},Jht=class extends qO{constructor(e,t,o){super(e,o);this.scope=t}doParseRaw(e,t){let o=hce(e,s=>console.error(`Conflict in settings file ${this._name}: ${s}`)),n=Object.create(null);n[this.scope]=o;let r=Object.keys(e).map(s=>`${this.scope}.${s}`);return{contents:n,keys:r,overrides:[]}}},Zht=class extends Xht{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,r,s,l,c,u,h);this._workspace=p}getValue(e,t={}){return super.getValue(e,t,this._workspace)}inspect(e,t={}){return super.inspect(e,t,this._workspace)}keys(){return super.keys(this._workspace)}compareAndDeleteFolderConfiguration(e){return this._workspace&&this._workspace.folders.length>0&&this._workspace.folders[0].uri.toString()===e.toString()?{keys:[],overrides:[]}:super.compareAndDeleteFolderConfiguration(e)}compare(e){let t=(s,l,c)=>{let u=[];return u.push(...l.filter(p=>s.indexOf(p)===-1)),u.push(...s.filter(p=>l.indexOf(p)===-1)),u.push(...s.filter(p=>l.indexOf(p)===-1?!1:Qi(this.getValue(p,{overrideIdentifier:c}),e.getValue(p,{overrideIdentifier:c}))?this._workspace&&this._workspace.folders.some(h=>!Qi(this.getValue(p,{resource:h.uri,overrideIdentifier:c}),e.getValue(p,{resource:h.uri,overrideIdentifier:c}))):!0)),u},o=t(this.allKeys(),e.allKeys()),n=[],r=jo([...this.allOverrideIdentifiers(),...e.allOverrideIdentifiers()]);for(let s of r){let l=t(this.getAllKeysForOverrideIdentifier(s),e.getAllKeysForOverrideIdentifier(s),s);l.length&&n.push([s,l])}return{keys:o,overrides:n}}};var $Jt=class extends ka{constructor(e,t){super(e);this.code=t}};var g$e=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g){this.remoteSettingsResource=i;this.configurationService=e;this.contextService=t;this.userDataProfileService=o;this.userDataProfilesService=n;this.fileService=r;this.textModelResolverService=s;this.textFileService=l;this.notificationService=c;this.preferencesService=u;this.editorService=p;this.uriIdentityService=h;this.filesConfigurationService=g;this.queue=new Hh}async writeConfiguration(i,e,t={}){let o=this.getConfigurationEditOperation(i,e,t.scopes||{});return this.queue.queue(async()=>{try{await this.doWriteConfiguration(o,t)}catch(n){if(t.donotNotifyError)throw n;await this.onError(n,o,t.scopes)}})}async doWriteConfiguration(i,e){await this.validate(i.target,i,!e.handleDirtyFile,e.scopes||{});let t=i.resource,o=await this.resolveModelReference(t);try{let n=this.getFormattingOptions(o.object.textEditorModel);await this.updateConfiguration(i,o.object.textEditorModel,n,e)}finally{o.dispose()}}async updateConfiguration(i,e,t,o){if(this.hasParseErrors(e.getValue(),i))throw this.toConfigurationEditingError(11,i.target,i);if(this.textFileService.isDirty(e.uri)&&o.handleDirtyFile)switch(o.handleDirtyFile){case"save":await this.save(e,i);break;case"revert":await this.textFileService.revert(e.uri);break}let n=this.getEdits(i,e.getValue(),t)[0];if(n){let r;try{r=this.filesConfigurationService.enableAutoSaveAfterShortDelay(e.uri),this.applyEditsToBuffer(n,e)&&await this.save(e,i)}finally{r?.dispose()}}}async save(i,e){try{await this.textFileService.save(i.uri,{ignoreErrorHandler:!0})}catch(t){throw t.fileOperationResult===3?this.toConfigurationEditingError(10,e.target,e):new $Jt(d(18748,null,this.stringifyTarget(e.target),t.message),13)}}applyEditsToBuffer(i,e){let t=e.getPositionAt(i.offset),o=e.getPositionAt(i.offset+i.length),n=new G(t.lineNumber,t.column,o.lineNumber,o.column),r=e.getValueInRange(n);if(i.content!==r){let s=r?Qn.replace(n,i.content):Qn.insert(t,i.content);return e.pushEditOperations([new ei(t.lineNumber,t.column,t.lineNumber,t.column)],[s],()=>[]),!0}return!1}getEdits({value:i,jsonPath:e},t,o){return e.length?rS(t,e,i,o):[{content:JSON.stringify(i,null,o.insertSpaces&&o.tabSize?" ".repeat(o.tabSize):"	"),length:t.length,offset:0}]}getFormattingOptions(i){let{insertSpaces:e,tabSize:t}=i.getOptions(),o=i.getEOL();return{insertSpaces:e,tabSize:t,eol:o}}async onError(i,e,t){switch(i.code){case 11:this.onInvalidConfigurationError(i,e);break;case 9:this.onConfigurationFileDirtyError(i,e,t);break;case 10:return this.doWriteConfiguration(e,{scopes:t,handleDirtyFile:"revert"});default:this.notificationService.error(i.message)}}onInvalidConfigurationError(i,e){let t=e.workspaceStandAloneConfigurationKey===w_?d(18752,null):e.workspaceStandAloneConfigurationKey===WG?d(18750,null):e.workspaceStandAloneConfigurationKey===yb?d(18751,null):null;t?this.notificationService.prompt(ft.Error,i.message,[{label:t,run:()=>this.openFile(e.resource)}]):this.notificationService.prompt(ft.Error,i.message,[{label:d(18749,null),run:()=>this.openSettings(e)}])}onConfigurationFileDirtyError(i,e,t){let o=e.workspaceStandAloneConfigurationKey===w_?d(18752,null):e.workspaceStandAloneConfigurationKey===WG?d(18750,null):null;o?this.notificationService.prompt(ft.Error,i.message,[{label:d(18754,null),run:()=>{let n=e.key?`${e.workspaceStandAloneConfigurationKey}.${e.key}`:e.workspaceStandAloneConfigurationKey;this.writeConfiguration(e.target,{key:n,value:e.value},{handleDirtyFile:"save",scopes:t})}},{label:o,run:()=>this.openFile(e.resource)}]):this.notificationService.prompt(ft.Error,i.message,[{label:d(18754,null),run:()=>this.writeConfiguration(e.target,{key:e.key,value:e.value},{handleDirtyFile:"save",scopes:t})},{label:d(18749,null),run:()=>this.openSettings(e)}])}openSettings(i){let e={jsonEditor:!0};switch(i.target){case 1:this.preferencesService.openUserSettings(e);break;case 2:this.preferencesService.openRemoteSettings(e);break;case 3:this.preferencesService.openWorkspaceSettings(e);break;case 4:if(i.resource){let t=this.contextService.getWorkspaceFolder(i.resource);t&&this.preferencesService.openFolderSettings({folderUri:t.uri,jsonEditor:!0})}break}}openFile(i){this.editorService.openEditor({resource:i,options:{pinned:!0}})}toConfigurationEditingError(i,e,t){let o=this.toErrorMessage(i,e,t);return new $Jt(o,i)}toErrorMessage(i,e,t){switch(i){case 12:return d(18740,null,t.key);case 0:return d(18746,null,this.stringifyTarget(e),t.key);case 1:return d(18732,null,t.key);case 2:return d(18733,null,t.key);case 3:return d(18724,null,t.key);case 4:return d(18731,null,t.key);case 5:return d(18734,null,t.key);case 6:return d(18725,null);case 7:return d(18729,null,t.key);case 8:return d(18739,null,this.stringifyTarget(e));case 11:{if(t.workspaceStandAloneConfigurationKey===w_)return d(18730,null);if(t.workspaceStandAloneConfigurationKey===WG)return d(18726,null);if(t.workspaceStandAloneConfigurationKey===yb)return d(18727,null);switch(e){case 1:return d(18721,null);case 2:return d(18728,null);case 3:return d(18723,null);case 4:{let o="<<unknown>>";if(t.resource){let n=this.contextService.getWorkspaceFolder(t.resource);n&&(o=n.name)}return d(18722,null,o)}default:return""}}case 9:{if(t.workspaceStandAloneConfigurationKey===w_)return d(18743,null);if(t.workspaceStandAloneConfigurationKey===WG)return d(18735,null);if(t.workspaceStandAloneConfigurationKey===yb)return d(18737,null);switch(e){case 1:return d(18715,null);case 2:return d(18741,null);case 3:return d(18717,null);case 4:{let o="<<unknown>>";if(t.resource){let n=this.contextService.getWorkspaceFolder(t.resource);n&&(o=n.name)}return d(18716,null,o)}default:return""}}case 10:if(t.workspaceStandAloneConfigurationKey===w_)return d(18744,null);if(t.workspaceStandAloneConfigurationKey===WG)return d(18736,null);if(t.workspaceStandAloneConfigurationKey===yb)return d(18738,null);switch(e){case 1:return d(18718,null);case 2:return d(18742,null);case 3:return d(18720,null);case 4:return d(18719,null)}case 13:return d(18745,null,this.stringifyTarget(e))}}stringifyTarget(i){switch(i){case 1:return d(18755,null);case 2:return d(18753,null);case 3:return d(18756,null);case 4:return d(18747,null);default:return""}}defaultResourceValue(i){let e=this.uriIdentityService.extUri.basename(i);return e.substr(0,e.length-this.uriIdentityService.extUri.extname(i).length)===w_?vgo:"{}"}async resolveModelReference(i){return await this.fileService.exists(i)||await this.textFileService.write(i,this.defaultResourceValue(i),{encoding:"utf8"}),this.textModelResolverService.createModelReference(i)}hasParseErrors(i,e){if(e.workspaceStandAloneConfigurationKey&&!e.key)return!1;let t=[];return is(i,t,{allowTrailingComma:!0,allowEmptyContent:!0}),t.length>0}async validate(i,e,t,o){if(this.configurationService.inspect(e.key).policyValue!==void 0)throw this.toConfigurationEditingError(12,i,e);let r=oe.as($t.Configuration).getConfigurationProperties()[e.key]?.scope;if(!e.workspaceStandAloneConfigurationKey&&this.configurationService.keys().default.indexOf(e.key)<0&&!af.test(e.key)&&e.value!==void 0)throw this.toConfigurationEditingError(0,i,e);if(e.workspaceStandAloneConfigurationKey&&e.workspaceStandAloneConfigurationKey!==w_&&e.workspaceStandAloneConfigurationKey!==yb&&(i===1||i===2))throw this.toConfigurationEditingError(4,i,e);if((i===3||i===4)&&this.contextService.getWorkbenchState()===1)throw this.toConfigurationEditingError(8,i,e);if(i===3&&!e.workspaceStandAloneConfigurationKey&&!af.test(e.key)){if(r&&MC.includes(r))throw this.toConfigurationEditingError(1,i,e);if(r===2)throw this.toConfigurationEditingError(2,i,e)}if(i===4){if(!e.resource)throw this.toConfigurationEditingError(6,i,e);if(!e.workspaceStandAloneConfigurationKey&&!af.test(e.key)&&r!==void 0&&!yte.includes(r))throw this.toConfigurationEditingError(3,i,e)}if(o.overrideIdentifiers?.length&&r!==6)throw this.toConfigurationEditingError(7,i,e);if(!e.resource)throw this.toConfigurationEditingError(6,i,e);if(t&&this.textFileService.isDirty(e.resource))throw this.toConfigurationEditingError(9,i,e)}getConfigurationEditOperation(i,e,t){if(e.key){let c=i===1?TVt:kR,u=Object.keys(c);for(let p of u){let h=this.getConfigurationFileResource(i,p,c[p],t.resource,void 0);if(e.key===p){let f=this.isWorkspaceConfigurationResource(h)?[p]:[];return{key:f[f.length-1],jsonPath:f,value:e.value,resource:h??void 0,workspaceStandAloneConfigurationKey:p,target:i}}let g=`${p}.`;if(e.key.indexOf(g)===0){let f=this.isWorkspaceConfigurationResource(h)?[p,e.key.substring(g.length)]:[e.key.substring(g.length)];return{key:f[f.length-1],jsonPath:f,value:e.value,resource:h??void 0,workspaceStandAloneConfigurationKey:p,target:i}}}}let o=e.key,r=oe.as($t.Configuration).getConfigurationProperties()[o]?.scope,s=t.overrideIdentifiers?.length?[ASt(t.overrideIdentifiers),o]:[o];if(i===1||i===2)return{key:o,jsonPath:s,value:e.value,resource:this.getConfigurationFileResource(i,o,"",null,r)??void 0,target:i};let l=this.getConfigurationFileResource(i,o,dgo,t.resource,r);return this.isWorkspaceConfigurationResource(l)&&(s=["settings",...s]),{key:o,jsonPath:s,value:e.value,resource:l??void 0,target:i}}isWorkspaceConfigurationResource(i){let e=this.contextService.getWorkspace();return!!(e.configuration&&i&&e.configuration.fsPath===i.fsPath)}getConfigurationFileResource(i,e,t,o,n){if(i===1)return e===w_?this.userDataProfileService.currentProfile.tasksResource:e===yb?this.userDataProfileService.currentProfile.mcpResource:!this.userDataProfileService.currentProfile.isDefault&&this.configurationService.isSettingAppliedForAllProfiles(e)?this.userDataProfilesService.defaultProfile.settingsResource:this.userDataProfileService.currentProfile.settingsResource;if(i===2)return this.remoteSettingsResource;let r=this.contextService.getWorkbenchState();if(r!==1){let s=this.contextService.getWorkspace();if(i===3){if(r===3)return s.configuration??null;if(r===2)return s.folders[0].toResource(t)}if(i===4&&o){let l=this.contextService.getWorkspaceFolder(o);if(l)return l.toResource(t)}}return null}};g$e=I([m(1,Yg),m(2,Ae),m(3,gn),m(4,hn),m(5,ge),m(6,Bt),m(7,Uo),m(8,Ne),m(9,Qo),m(10,ie),m(11,gt),m(12,fr)],g$e);var jJt=class a extends GJt{constructor(e,t,o,n){super(n);this.configurationCache=t;this.configurationRegistry=oe.as($t.Configuration);this.cachedConfigurationDefaultsOverrides={};this.cacheKey={type:"defaults",key:`${e}-configurationDefaultsOverrides`},o.options?.configurationDefaults&&this.configurationRegistry.registerDefaultConfigurations([{overrides:o.options.configurationDefaults}])}static{this.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY="DefaultOverridesCacheExists"}getConfigurationDefaultOverrides(){return this.cachedConfigurationDefaultsOverrides}async initialize(){return await this.initializeCachedConfigurationDefaultsOverrides(),super.initialize()}reload(){return this.cachedConfigurationDefaultsOverrides={},this.updateCachedConfigurationDefaultsOverrides(),super.reload()}hasCachedConfigurationDefaultsOverrides(){return!dv(this.cachedConfigurationDefaultsOverrides)}initializeCachedConfigurationDefaultsOverrides(){return this.initiaizeCachedConfigurationDefaultsOverridesPromise||(this.initiaizeCachedConfigurationDefaultsOverridesPromise=(async()=>{try{if(localStorage.getItem(a.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY)){let e=await this.configurationCache.read(this.cacheKey);e&&(this.cachedConfigurationDefaultsOverrides=JSON.parse(e))}}catch{}this.cachedConfigurationDefaultsOverrides=Di(this.cachedConfigurationDefaultsOverrides)?this.cachedConfigurationDefaultsOverrides:{}})()),this.initiaizeCachedConfigurationDefaultsOverridesPromise}onDidUpdateConfiguration(e,t){super.onDidUpdateConfiguration(e,t),t&&this.updateCachedConfigurationDefaultsOverrides()}async updateCachedConfigurationDefaultsOverrides(){let e={},t=this.configurationRegistry.getRegisteredDefaultConfigurations();for(let o of t)if(!o.donotCache){for(let[n,r]of Object.entries(o.overrides))if(!af.test(n)&&r!==void 0){let s=e[n];Di(s)&&Di(r)?e[n]={...s,...r}:e[n]=r}}try{Object.keys(e).length?(localStorage.setItem(a.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY,"yes"),await this.configurationCache.write(this.cacheKey,JSON.stringify(e))):(localStorage.removeItem(a.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY),await this.configurationCache.remove(this.cacheKey))}catch{}}},QJt=class extends Yht{constructor(e,t,o,n){super(e.defaultProfile.settingsResource,{scopes:MC,skipUnregistered:!0},o.extUri,t,n);this._onDidChangeConfiguration=this._register(new T);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._register(this.onDidChange(()=>this.reloadConfigurationScheduler.schedule())),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.loadConfiguration().then(r=>this._onDidChangeConfiguration.fire(r)),50))}async initialize(){return this.loadConfiguration()}async loadConfiguration(){let e=await super.loadConfiguration(),t=e.getValue(gw),o=Array.isArray(t)?t:[];return this.parseOptions.include||o.length?this.reparse({...this.parseOptions,include:o}):e}},YJt=class extends k{constructor(e,t,o,n,r,s,l){super();this.settingsResource=e;this.tasksResource=t;this.mcpResource=o;this.configurationParseOptions=n;this.fileService=r;this.uriIdentityService=s;this.logService=l;this._onDidChangeConfiguration=this._register(new T);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this.userConfiguration=this._register(new ue);this.userConfigurationChangeDisposable=this._register(new ue);this.userConfiguration.value=new Yht(e,this.configurationParseOptions,s.extUri,this.fileService,l),this.userConfigurationChangeDisposable.value=this.userConfiguration.value.onDidChange(()=>this.reloadConfigurationScheduler.schedule()),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.userConfiguration.value.loadConfiguration().then(c=>this._onDidChangeConfiguration.fire(c)),50))}get hasTasksLoaded(){return this.userConfiguration.value instanceof v$e}async reset(e,t,o,n){return this.settingsResource=e,this.tasksResource=t,this.mcpResource=o,this.configurationParseOptions=n,this.doReset()}async doReset(e){let t=this.uriIdentityService.extUri.dirname(this.settingsResource),o=[];this.tasksResource&&o.push([w_,this.tasksResource]),this.mcpResource&&o.push([yb,this.mcpResource]);let n=new v$e(t.toString(),this.settingsResource,o,this.configurationParseOptions,this.fileService,this.uriIdentityService,this.logService),r=await n.loadConfiguration(e);return this.userConfiguration.value=n,this.userConfigurationChangeDisposable.value&&(this.userConfigurationChangeDisposable.value=this.userConfiguration.value.onDidChange(()=>this.reloadConfigurationScheduler.schedule())),r}async initialize(){return this.userConfiguration.value.loadConfiguration()}async reload(e){return this.hasTasksLoaded?this.userConfiguration.value.loadConfiguration():this.doReset(e)}reparse(e){return this.configurationParseOptions={...this.configurationParseOptions,...e},this.userConfiguration.value.reparse(this.configurationParseOptions)}getRestrictedSettings(){return this.userConfiguration.value.getRestrictedSettings()}},v$e=class extends k{constructor(e,t,o,n,r,s,l){super();this.settingsResource=t;this.standAloneConfigurationResources=o;this.fileService=r;this.uriIdentityService=s;this.logService=l;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.allResources=[this.settingsResource,...this.standAloneConfigurationResources.map(([,c])=>c)],this._register(Fn(...this.allResources.map(c=>Fn(this.fileService.watch(s.extUri.dirname(c)),this.fileService.watch(c))))),this._folderSettingsModelParser=new qO(e,l),this._folderSettingsParseOptions=n,this._standAloneConfigurations=[],this._cache=Su.createEmptyModel(this.logService),this._register(U.debounce(U.any(U.filter(this.fileService.onDidFilesChange,c=>this.handleFileChangesEvent(c)),U.filter(this.fileService.onDidRunOperation,c=>this.handleFileOperationEvent(c))),()=>{},100)(()=>this._onDidChange.fire()))}async resolveContents(e){let t=async r=>Promise.all(r.map(async s=>{try{return(await this.fileService.readFile(s,{atomic:!0})).value.toString()}catch(l){this.logService.trace(`Error while resolving configuration file '${s.toString()}': ${Dn(l)}`),l.fileOperationResult!==1&&l.fileOperationResult!==9&&this.logService.error(l)}return"{}"})),[[o],n]=await Promise.all([e?Promise.resolve([void 0]):t([this.settingsResource]),t(this.standAloneConfigurationResources.map(([,r])=>r))]);return[o,n.map((r,s)=>[this.standAloneConfigurationResources[s][0],r])]}async loadConfiguration(e){let[t,o]=await this.resolveContents(!!e);this._standAloneConfigurations=[],this._folderSettingsModelParser.parse("",this._folderSettingsParseOptions),t!==void 0&&this._folderSettingsModelParser.parse(t,this._folderSettingsParseOptions);for(let n=0;n<o.length;n++){let r=o[n][1];if(r!==void 0){let s=new Jht(this.standAloneConfigurationResources[n][1].toString(),this.standAloneConfigurationResources[n][0],this.logService);s.parse(r),this._standAloneConfigurations.push(s.configurationModel)}}return this.consolidate(e),this._cache}getRestrictedSettings(){return this._folderSettingsModelParser.restrictedConfigurations}reparse(e){let t=this._folderSettingsModelParser.configurationModel.contents;return this._folderSettingsParseOptions=e,this._folderSettingsModelParser.reparse(this._folderSettingsParseOptions),Qi(t,this._folderSettingsModelParser.configurationModel.contents)||this.consolidate(),this._cache}consolidate(e){this._cache=(e??this._folderSettingsModelParser.configurationModel).merge(...this._standAloneConfigurations)}handleFileChangesEvent(e){return!!(this.allResources.some(t=>e.contains(t))||this.allResources.some(t=>e.contains(this.uriIdentityService.extUri.dirname(t),2)))}handleFileOperationEvent(e){return!!((e.isOperation(0)||e.isOperation(3)||e.isOperation(1)||e.isOperation(4))&&this.allResources.some(t=>this.uriIdentityService.extUri.isEqual(e.resource,t))||e.isOperation(1)&&this.allResources.some(t=>this.uriIdentityService.extUri.isEqual(e.resource,this.uriIdentityService.extUri.dirname(t))))}},XJt=class extends k{constructor(e,t,o,n,r,s){super();this._userConfigurationInitializationPromise=null;this._onDidChangeConfiguration=this._register(new T);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._onDidInitialize=this._register(new T);this.onDidInitialize=this._onDidInitialize.event;this._fileService=o,this._userConfiguration=this._cachedConfiguration=new Y$i(e,t,{scopes:BMe},s),r.getEnvironment().then(async l=>{if(l){let c=this._register(new egt(l.settingsPath,{scopes:BMe},this._fileService,n,s));this._register(c.onDidChangeConfiguration(p=>this.onDidUserConfigurationChange(p))),this._userConfigurationInitializationPromise=c.initialize();let u=await this._userConfigurationInitializationPromise;this._userConfiguration.dispose(),this._userConfiguration=c,this.onDidUserConfigurationChange(u),this._onDidInitialize.fire(u)}})}async initialize(){if(this._userConfiguration instanceof egt)return this._userConfiguration.initialize();let e=await this._userConfiguration.initialize();return this._userConfigurationInitializationPromise&&(e=await this._userConfigurationInitializationPromise,this._userConfigurationInitializationPromise=null),e}reload(){return this._userConfiguration.reload()}reparse(){return this._userConfiguration.reparse({scopes:BMe})}getRestrictedSettings(){return this._userConfiguration.getRestrictedSettings()}onDidUserConfigurationChange(e){this.updateCache(),this._onDidChangeConfiguration.fire(e)}async updateCache(){if(this._userConfiguration instanceof egt){let e;try{e=await this._userConfiguration.resolveContent()}catch(t){if(t.fileOperationResult!==1)return}await this._cachedConfiguration.updateConfiguration(e)}}},egt=class extends k{constructor(e,t,o,n,r){super();this.configurationResource=e;this.fileService=o;this.uriIdentityService=n;this.logService=r;this._onDidChangeConfiguration=this._register(new T);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this.fileWatcherDisposable=this._register(new ue);this.directoryWatcherDisposable=this._register(new ue);this.parser=new qO(this.configurationResource.toString(),r),this.parseOptions=t,this._register(o.onDidFilesChange(s=>this.handleFileChangesEvent(s))),this._register(o.onDidRunOperation(s=>this.handleFileOperationEvent(s))),this.reloadConfigurationScheduler=this._register(new Dt(()=>this.reload().then(s=>this._onDidChangeConfiguration.fire(s)),50)),this._register(ee(()=>{this.stopWatchingResource(),this.stopWatchingDirectory()}))}watchResource(){this.fileWatcherDisposable.value=this.fileService.watch(this.configurationResource)}stopWatchingResource(){this.fileWatcherDisposable.value=void 0}watchDirectory(){let e=this.uriIdentityService.extUri.dirname(this.configurationResource);this.directoryWatcherDisposable.value=this.fileService.watch(e)}stopWatchingDirectory(){this.directoryWatcherDisposable.value=void 0}async initialize(){let e=await this.fileService.exists(this.configurationResource);return this.onResourceExists(e),this.reload()}async resolveContent(){return(await this.fileService.readFile(this.configurationResource,{atomic:!0})).value.toString()}async reload(){try{let e=await this.resolveContent();return this.parser.parse(e,this.parseOptions),this.parser.configurationModel}catch{return Su.createEmptyModel(this.logService)}}reparse(e){return this.parseOptions=e,this.parser.reparse(this.parseOptions),this.parser.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}handleFileChangesEvent(e){let t=!1;e.contains(this.configurationResource,1)?(t=!0,this.onResourceExists(!0)):e.contains(this.configurationResource,2)?(t=!0,this.onResourceExists(!1)):e.contains(this.configurationResource,0)&&(t=!0),t&&this.reloadConfigurationScheduler.schedule()}handleFileOperationEvent(e){(e.isOperation(0)||e.isOperation(3)||e.isOperation(1)||e.isOperation(4))&&this.uriIdentityService.extUri.isEqual(e.resource,this.configurationResource)&&this.reloadConfigurationScheduler.schedule()}onResourceExists(e){e?(this.stopWatchingDirectory(),this.watchResource()):(this.stopWatchingResource(),this.watchDirectory())}},Y$i=class extends k{constructor(e,t,o,n){super();this.configurationCache=t;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.key={type:"user",key:e},this.parser=new qO("CachedRemoteUserConfiguration",n),this.parseOptions=o,this.configurationModel=Su.createEmptyModel(n)}getConfigurationModel(){return this.configurationModel}initialize(){return this.reload()}reparse(e){return this.parseOptions=e,this.parser.reparse(this.parseOptions),this.configurationModel=this.parser.configurationModel,this.configurationModel}getRestrictedSettings(){return this.parser.restrictedConfigurations}async reload(){try{let e=await this.configurationCache.read(this.key),t=JSON.parse(e);t.content&&(this.parser.parse(t.content,this.parseOptions),this.configurationModel=this.parser.configurationModel)}catch{}return this.configurationModel}async updateConfiguration(e){return e?this.configurationCache.write(this.key,JSON.stringify({content:e})):this.configurationCache.remove(this.key)}},JJt=class extends k{constructor(e,t,o,n){super();this.configurationCache=e;this.fileService=t;this.uriIdentityService=o;this.logService=n;this._workspaceConfigurationDisposables=this._register(new O);this._workspaceIdentifier=null;this._isWorkspaceTrusted=!1;this._onDidUpdateConfiguration=this._register(new T);this.onDidUpdateConfiguration=this._onDidUpdateConfiguration.event;this._initialized=!1;this.fileService=t,this._workspaceConfiguration=this._cachedConfiguration=new X$i(e,n)}get initialized(){return this._initialized}async initialize(e,t){this._workspaceIdentifier=e,this._isWorkspaceTrusted=t,this._initialized||(this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)?(this._workspaceConfiguration=this._cachedConfiguration,this.waitAndInitialize(this._workspaceIdentifier)):this.doInitialize(new f$e(this.fileService,this.uriIdentityService,this.logService))),await this.reload()}async reload(){this._workspaceIdentifier&&await this._workspaceConfiguration.load(this._workspaceIdentifier,{scopes:N8,skipRestricted:this.isUntrusted()})}getFolders(){return this._workspaceConfiguration.getFolders()}setFolders(e,t){return this._workspaceIdentifier?t.write(this._workspaceIdentifier.configPath,[{path:["folders"],value:e}],!0).then(()=>this.reload()):Promise.resolve()}isTransient(){return this._workspaceConfiguration.isTransient()}getConfiguration(){return this._workspaceConfiguration.getWorkspaceSettings()}updateWorkspaceTrust(e){return this._isWorkspaceTrusted=e,this.reparseWorkspaceSettings()}reparseWorkspaceSettings(e){return this._workspaceConfiguration.reparseWorkspaceSettings({scopes:N8,skipRestricted:this.isUntrusted(),...e}),this.getConfiguration()}getRestrictedSettings(){return this._workspaceConfiguration.getRestrictedSettings()}async waitAndInitialize(e){if(await Wsi(e.configPath,this.fileService),!(this._workspaceConfiguration instanceof f$e)){let t=this._register(new f$e(this.fileService,this.uriIdentityService,this.logService));await t.load(e,{scopes:N8,skipRestricted:this.isUntrusted()}),this.doInitialize(t),this.onDidWorkspaceConfigurationChange(!1,!0)}}doInitialize(e){this._workspaceConfigurationDisposables.clear(),this._workspaceConfiguration=this._workspaceConfigurationDisposables.add(e),this._workspaceConfigurationDisposables.add(this._workspaceConfiguration.onDidChange(t=>this.onDidWorkspaceConfigurationChange(!0,!1))),this._initialized=!0}isUntrusted(){return!this._isWorkspaceTrusted}async onDidWorkspaceConfigurationChange(e,t){e&&await this.reload(),this.updateCache(),this._onDidUpdateConfiguration.fire(t)}async updateCache(){if(this._workspaceIdentifier&&this.configurationCache.needsCaching(this._workspaceIdentifier.configPath)&&this._workspaceConfiguration instanceof f$e){let e=await this._workspaceConfiguration.resolveContent(this._workspaceIdentifier);await this._cachedConfiguration.updateWorkspace(this._workspaceIdentifier,e)}}},f$e=class extends k{constructor(e,t,o){super();this.fileService=e;this.logService=o;this._workspaceIdentifier=null;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.workspaceConfigurationModelParser=new oye("",o),this.workspaceSettings=Su.createEmptyModel(o),this._register(U.any(U.filter(this.fileService.onDidFilesChange,n=>!!this._workspaceIdentifier&&n.contains(this._workspaceIdentifier.configPath)),U.filter(this.fileService.onDidRunOperation,n=>!!this._workspaceIdentifier&&(n.isOperation(0)||n.isOperation(3)||n.isOperation(1)||n.isOperation(4))&&t.extUri.isEqual(n.resource,this._workspaceIdentifier.configPath)))(()=>this.reloadConfigurationScheduler.schedule())),this.reloadConfigurationScheduler=this._register(new Dt(()=>this._onDidChange.fire(),50)),this.workspaceConfigWatcher=this._register(this.watchWorkspaceConfigurationFile())}get workspaceIdentifier(){return this._workspaceIdentifier}async resolveContent(e){return(await this.fileService.readFile(e.configPath,{atomic:!0})).value.toString()}async load(e,t){(!this._workspaceIdentifier||this._workspaceIdentifier.id!==e.id)&&(this._workspaceIdentifier=e,this.workspaceConfigurationModelParser=new oye(this._workspaceIdentifier.id,this.logService),je(this.workspaceConfigWatcher),this.workspaceConfigWatcher=this._register(this.watchWorkspaceConfigurationFile()));let o="";try{o=await this.resolveContent(this._workspaceIdentifier)}catch(n){await this.fileService.exists(this._workspaceIdentifier.configPath)&&this.logService.error(n)}this.workspaceConfigurationModelParser.parse(o,t),this.consolidate()}getConfigurationModel(){return this.workspaceConfigurationModelParser.configurationModel}getFolders(){return this.workspaceConfigurationModelParser.folders}isTransient(){return this.workspaceConfigurationModelParser.transient}getWorkspaceSettings(){return this.workspaceSettings}reparseWorkspaceSettings(e){return this.workspaceConfigurationModelParser.reparseWorkspaceSettings(e),this.consolidate(),this.getWorkspaceSettings()}getRestrictedSettings(){return this.workspaceConfigurationModelParser.getRestrictedWorkspaceSettings()}consolidate(){this.workspaceSettings=this.workspaceConfigurationModelParser.settingsModel.merge(this.workspaceConfigurationModelParser.launchModel,this.workspaceConfigurationModelParser.tasksModel)}watchWorkspaceConfigurationFile(){return this._workspaceIdentifier?this.fileService.watch(this._workspaceIdentifier.configPath):k.None}},X$i=class{constructor(i,e){this.configurationCache=i;this.logService=e;this.onDidChange=U.None;this.workspaceConfigurationModelParser=new oye("",e),this.workspaceSettings=Su.createEmptyModel(e)}async load(i,e){try{let t=this.getKey(i),o=await this.configurationCache.read(t),n=JSON.parse(o);n.content&&(this.workspaceConfigurationModelParser=new oye(t.key,this.logService),this.workspaceConfigurationModelParser.parse(n.content,e),this.consolidate())}catch{}}get workspaceIdentifier(){return null}getConfigurationModel(){return this.workspaceConfigurationModelParser.configurationModel}getFolders(){return this.workspaceConfigurationModelParser.folders}isTransient(){return this.workspaceConfigurationModelParser.transient}getWorkspaceSettings(){return this.workspaceSettings}reparseWorkspaceSettings(i){return this.workspaceConfigurationModelParser.reparseWorkspaceSettings(i),this.consolidate(),this.getWorkspaceSettings()}getRestrictedSettings(){return this.workspaceConfigurationModelParser.getRestrictedWorkspaceSettings()}consolidate(){this.workspaceSettings=this.workspaceConfigurationModelParser.settingsModel.merge(this.workspaceConfigurationModelParser.launchModel,this.workspaceConfigurationModelParser.tasksModel)}async updateWorkspace(i,e){try{let t=this.getKey(i);e?await this.configurationCache.write(t,JSON.stringify({content:e})):await this.configurationCache.remove(t)}catch{}}getKey(i){return{type:"workspaces",key:i.id}}},J$i=class{constructor(i,e,t,o,n){this.configurationCache=o;this.logService=n;this.onDidChange=U.None;this.key={type:"folder",key:Lr(Ve(i,e).toString()).toString(16)},this._folderSettingsModelParser=new qO("CachedFolderConfiguration",n),this._folderSettingsParseOptions=t,this._standAloneConfigurations=[],this.configurationModel=Su.createEmptyModel(n)}async loadConfiguration(){try{let i=await this.configurationCache.read(this.key),{content:e}=JSON.parse(i.toString());if(e)for(let t of Object.keys(e))if(t===dtt)this._folderSettingsModelParser.parse(e[t],this._folderSettingsParseOptions);else{let o=new Jht(t,t,this.logService);o.parse(e[t]),this._standAloneConfigurations.push(o.configurationModel)}this.consolidate()}catch{}return this.configurationModel}async updateConfiguration(i,e){let t={};i&&(t[dtt]=i),e.forEach(([o,n])=>{n&&(t[o]=n)}),Object.keys(t).length?await this.configurationCache.write(this.key,JSON.stringify({content:t})):await this.configurationCache.remove(this.key)}getRestrictedSettings(){return this._folderSettingsModelParser.restrictedConfigurations}reparse(i){return this._folderSettingsParseOptions=i,this._folderSettingsModelParser.reparse(this._folderSettingsParseOptions),this.consolidate(),this.configurationModel}consolidate(){this.configurationModel=this._folderSettingsModelParser.configurationModel.merge(...this._standAloneConfigurations)}getUnsupportedKeys(){return[]}},ZJt=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this.workspaceFolder=t;this.workbenchState=n;this.workspaceTrusted=r;this.configurationCache=u;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.scopes=3===this.workbenchState?yte:N8,this.configurationFolder=l.extUri.joinPath(t.uri,o),this.cachedFolderConfiguration=new J$i(t.uri,o,{scopes:this.scopes,skipRestricted:this.isUntrusted()},u,c),e&&this.configurationCache.needsCaching(t.uri)?(this.folderConfiguration=this.cachedFolderConfiguration,Wsi(t.uri,s).then(()=>{this.folderConfiguration=this._register(this.createFileServiceBasedConfiguration(s,l,c)),this._register(this.folderConfiguration.onDidChange(p=>this.onDidFolderConfigurationChange())),this.onDidFolderConfigurationChange()})):(this.folderConfiguration=this._register(this.createFileServiceBasedConfiguration(s,l,c)),this._register(this.folderConfiguration.onDidChange(p=>this.onDidFolderConfigurationChange())))}loadConfiguration(){return this.folderConfiguration.loadConfiguration()}updateWorkspaceTrust(e){return this.workspaceTrusted=e,this.reparse()}reparse(){let e=this.folderConfiguration.reparse({scopes:this.scopes,skipRestricted:this.isUntrusted()});return this.updateCache(),e}getRestrictedSettings(){return this.folderConfiguration.getRestrictedSettings()}isUntrusted(){return!this.workspaceTrusted}onDidFolderConfigurationChange(){this.updateCache(),this._onDidChange.fire()}createFileServiceBasedConfiguration(e,t,o){let n=t.extUri.joinPath(this.configurationFolder,`${dtt}.json`),r=[w_,WG,yb].map(s=>[s,t.extUri.joinPath(this.configurationFolder,`${s}.json`)]);return new v$e(this.configurationFolder.toString(),n,r,{scopes:this.scopes,skipRestricted:this.isUntrusted()},e,t,o)}async updateCache(){if(this.configurationCache.needsCaching(this.configurationFolder)&&this.folderConfiguration instanceof v$e){let[e,t]=await this.folderConfiguration.resolveContents();this.cachedFolderConfiguration.updateConfiguration(e,t)}}addRelated(e){this._register(e)}};function FBo(a,i){return a.isDefault||a.useDefaultFlags?.settings?i?EVt:void 0:i?fEi:fgo}var igt=class extends wkt{constructor(){super(...arguments);this.initialized=!1}},eZt=class extends k{constructor({remoteAuthority:e,configurationCache:t},o,n,r,s,l,c,u,p){super();this.userDataProfileService=n;this.userDataProfilesService=r;this.fileService=s;this.remoteAgentService=l;this.uriIdentityService=c;this.logService=u;this.initialized=!1;this.applicationConfiguration=null;this.remoteUserConfiguration=null;this.cachedFolderConfigs=this._register(new Ot(new dt));this._onDidChangeConfiguration=this._register(new T);this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;this._onWillChangeWorkspaceFolders=this._register(new T);this.onWillChangeWorkspaceFolders=this._onWillChangeWorkspaceFolders.event;this._onDidChangeWorkspaceFolders=this._register(new T);this.onDidChangeWorkspaceFolders=this._onDidChangeWorkspaceFolders.event;this._onDidChangeWorkspaceName=this._register(new T);this.onDidChangeWorkspaceName=this._onDidChangeWorkspaceName.event;this._onDidChangeWorkbenchState=this._register(new T);this.onDidChangeWorkbenchState=this._onDidChangeWorkbenchState.event;this.isWorkspaceTrusted=!0;this._restrictedSettings={default:[]};this._onDidChangeRestrictedSettings=this._register(new T);this.onDidChangeRestrictedSettings=this._onDidChangeRestrictedSettings.event;if(this.configurationRegistry=oe.as($t.Configuration),this.initRemoteUserConfigurationBarrier=new ip,this.completeWorkspaceBarrier=new ip,this.defaultConfiguration=this._register(new jJt(n.currentProfile.id,t,o,u)),this.policyConfiguration=p instanceof rPt?new qJt:this._register(new h$e(this.defaultConfiguration,p,u)),this.configurationCache=t,this._configuration=new Zht(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,Su.createEmptyModel(u),Su.createEmptyModel(u),Su.createEmptyModel(u),Su.createEmptyModel(u),new dt,Su.createEmptyModel(u),new dt,this.workspace,u),this.applicationConfigurationDisposables=this._register(new O),this.createApplicationConfiguration(),this.localUserConfiguration=this._register(new YJt(n.currentProfile.settingsResource,n.currentProfile.tasksResource,n.currentProfile.mcpResource,{scopes:FBo(n.currentProfile,!!e)},s,c,u)),this._register(this.localUserConfiguration.onDidChangeConfiguration(h=>this.onLocalUserConfigurationChanged(h))),e){let h=this.remoteUserConfiguration=this._register(new XJt(e,t,s,c,l,u));this._register(h.onDidInitialize(g=>{this._register(h.onDidChangeConfiguration(f=>this.onRemoteUserConfigurationChanged(f))),this.onRemoteUserConfigurationChanged(g),this.initRemoteUserConfigurationBarrier.open()}))}else this.initRemoteUserConfigurationBarrier.open();this.workspaceConfiguration=this._register(new JJt(t,s,c,u)),this._register(this.workspaceConfiguration.onDidUpdateConfiguration(h=>{this.onWorkspaceConfigurationChanged(h).then(()=>{this.workspace.initialized=this.workspaceConfiguration.initialized,this.checkAndMarkWorkspaceComplete(h)})})),this._register(this.defaultConfiguration.onDidChangeConfiguration(({properties:h,defaults:g})=>this.onDefaultConfigurationChanged(g,h))),this._register(this.policyConfiguration.onDidChangeConfiguration(h=>this.onPolicyConfigurationChanged(h))),this._register(n.onDidChangeCurrentProfile(h=>this.onUserDataProfileChanged(h))),this.workspaceEditingQueue=new Hh}get restrictedSettings(){return this._restrictedSettings}createApplicationConfiguration(){this.applicationConfigurationDisposables.clear(),this.userDataProfileService.currentProfile.isDefault||this.userDataProfileService.currentProfile.useDefaultFlags?.settings?this.applicationConfiguration=null:(this.applicationConfiguration=this.applicationConfigurationDisposables.add(this._register(new QJt(this.userDataProfilesService,this.fileService,this.uriIdentityService,this.logService))),this.applicationConfigurationDisposables.add(this.applicationConfiguration.onDidChangeConfiguration(e=>this.onApplicationConfigurationChanged(e))))}async getCompleteWorkspace(){return await this.completeWorkspaceBarrier.wait(),this.getWorkspace()}getWorkspace(){return this.workspace}getWorkbenchState(){return this.workspace.configuration?3:this.workspace.folders.length===1?2:1}hasWorkspaceData(){return this.getWorkbenchState()!==1}getWorkspaceFolder(e){return this.workspace.getFolder(e)}addFolders(e,t){return this.updateFolders(e,[],t)}removeFolders(e){return this.updateFolders([],e)}async updateFolders(e,t,o){return this.workspaceEditingQueue.queue(()=>this.doUpdateFolders(e,t,o))}isInsideWorkspace(e){return!!this.getWorkspaceFolder(e)}isCurrentWorkspace(e){switch(this.getWorkbenchState()){case 2:{let t;return A.isUri(e)?t=e:Pg(e)&&(t=e.uri),A.isUri(t)&&this.uriIdentityService.extUri.isEqual(t,this.workspace.folders[0].uri)}case 3:return Gy(e)&&this.workspace.id===e.id}return!1}async doUpdateFolders(e,t,o){if(this.getWorkbenchState()!==3||e.length+t.length===0)return Promise.resolve(void 0);let n=!1,r=this.getWorkspace().folders,s=r.map(l=>l.raw).filter((l,c)=>UCi(l)?!this.contains(t,r[c].uri):!0);if(n=r.length!==s.length,e.length){let l=this.getWorkspace().configuration,c=this.uriIdentityService.extUri.dirname(l);r=t0t(s,l,this.uriIdentityService.extUri);let u=r.map(h=>h.uri),p=[];for(let h of e){let g=h.uri;if(!this.contains(u,g)){try{if(!(await this.fileService.stat(g)).isDirectory)continue}catch{}p.push(zCi(g,!1,h.name,c,this.uriIdentityService.extUri))}}p.length>0&&(n=!0,typeof o=="number"&&o>=0&&o<s.length?(s=s.slice(0),s.splice(o,0,...p)):s=[...s,...p])}return n?this.setFolders(s):Promise.resolve(void 0)}async setFolders(e){if(!this.instantiationService)throw new Error("Cannot update workspace folders because workspace service is not yet ready to accept writes.");return await this.instantiationService.invokeFunction(t=>this.workspaceConfiguration.setFolders(e,t.get(Zg))),this.onWorkspaceConfigurationChanged(!1)}contains(e,t){return e.some(o=>this.uriIdentityService.extUri.isEqual(o,t))}getConfigurationData(){return this._configuration.toData()}getValue(e,t){let o=typeof e=="string"?e:void 0,n=LSt(e)?e:LSt(t)?t:void 0;return this._configuration.getValue(o,n)}async updateValue(e,t,o,n,r){let s=h6i(o)?o:LSt(o)?{resource:o.resource,overrideIdentifiers:o.overrideIdentifier?[o.overrideIdentifier]:void 0}:void 0,l=s?n:o,c=l?[l]:[];if(s?.overrideIdentifiers&&(s.overrideIdentifiers=jo(s.overrideIdentifiers),s.overrideIdentifiers=s.overrideIdentifiers.length?s.overrideIdentifiers:void 0),!c.length){if(s?.overrideIdentifiers&&s.overrideIdentifiers.length>1)throw new Error("Configuration Target is required while updating the value for multiple override identifiers");let u=this.inspect(e,{resource:s?.resource,overrideIdentifier:s?.overrideIdentifiers?s.overrideIdentifiers[0]:void 0});c.push(...this.deriveConfigurationTargets(e,t,u)),Qi(t,u.defaultValue)&&c.length===1&&(c[0]===2||c[0]===3)&&(t=void 0)}await vn.settled(c.map(u=>this.writeConfigurationValue(e,t,u,s,r)))}async reloadConfiguration(e){if(e===void 0){this.reloadDefaultConfiguration();let t=await this.reloadApplicationConfiguration(!0),{local:o,remote:n}=await this.reloadUserConfiguration();await this.reloadWorkspaceConfiguration(),await this.loadConfiguration(t,o,n,!0);return}if(eC(e)){await this.reloadWorkspaceFolderConfiguration(e);return}switch(e){case 7:this.reloadDefaultConfiguration();return;case 2:{let{local:t,remote:o}=await this.reloadUserConfiguration();await this.loadConfiguration(this._configuration.applicationConfiguration,t,o,!0);return}case 3:await this.reloadLocalUserConfiguration();return;case 4:await this.reloadRemoteUserConfiguration();return;case 5:case 6:await this.reloadWorkspaceConfiguration();return}}hasCachedConfigurationDefaultsOverrides(){return this.defaultConfiguration.hasCachedConfigurationDefaultsOverrides()}inspect(e,t){return this._configuration.inspect(e,t)}keys(){return this._configuration.keys()}async whenRemoteConfigurationLoaded(){await this.initRemoteUserConfigurationBarrier.wait()}async initialize(e){Wo("code/willInitWorkspaceService");let t=this.initialized;this.initialized=!1;let o=await this.createWorkspace(e);await this.updateWorkspaceAndInitializeConfiguration(o,t),this.checkAndMarkWorkspaceComplete(!1),Wo("code/didInitWorkspaceService")}updateWorkspaceTrust(e){if(this.isWorkspaceTrusted!==e){this.isWorkspaceTrusted=e;let t=this._configuration.toData(),o=[];for(let r of this.workspace.folders){let s=this.cachedFolderConfigs.get(r.uri),l;s&&(l=s.updateWorkspaceTrust(this.isWorkspaceTrusted),this._configuration.updateFolderConfiguration(r.uri,l)),o.push(l)}this.getWorkbenchState()===2?o[0]&&this._configuration.updateWorkspaceConfiguration(o[0]):this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.updateWorkspaceTrust(this.isWorkspaceTrusted)),this.updateRestrictedSettings();let n=[];this.restrictedSettings.userLocal&&n.push(...this.restrictedSettings.userLocal),this.restrictedSettings.userRemote&&n.push(...this.restrictedSettings.userRemote),this.restrictedSettings.workspace&&n.push(...this.restrictedSettings.workspace),this.restrictedSettings.workspaceFolder?.forEach(r=>n.push(...r)),n=jo(n),n.length&&this.triggerConfigurationChange({keys:n,overrides:[]},{data:t,workspace:this.workspace},5)}}acquireInstantiationService(e){this.instantiationService=e}isSettingAppliedForAllProfiles(e){let t=this.configurationRegistry.getConfigurationProperties()[e]?.scope;if(t&&MC.includes(t))return!0;let o=this.getValue(gw)??[];return Array.isArray(o)&&o.includes(e)}async createWorkspace(e){return Gy(e)?this.createMultiFolderWorkspace(e):Pg(e)?this.createSingleFolderWorkspace(e):this.createEmptyWorkspace(e)}async createMultiFolderWorkspace(e){await this.workspaceConfiguration.initialize({id:e.id,configPath:e.configPath},this.isWorkspaceTrusted);let t=e.configPath,o=t0t(this.workspaceConfiguration.getFolders(),t,this.uriIdentityService.extUri),n=e.id,r=new igt(n,o,this.workspaceConfiguration.isTransient(),t,s=>this.uriIdentityService.extUri.ignorePathCasing(s));return r.initialized=this.workspaceConfiguration.initialized,r}createSingleFolderWorkspace(e){let t=new igt(e.id,[tJ(e.uri)],!1,null,o=>this.uriIdentityService.extUri.ignorePathCasing(o));return t.initialized=!0,t}createEmptyWorkspace(e){let t=new igt(e.id,[],!1,null,o=>this.uriIdentityService.extUri.ignorePathCasing(o));return t.initialized=!0,Promise.resolve(t)}checkAndMarkWorkspaceComplete(e){!this.completeWorkspaceBarrier.isOpen()&&this.workspace.initialized&&(this.completeWorkspaceBarrier.open(),this.validateWorkspaceFoldersAndReload(e))}async updateWorkspaceAndInitializeConfiguration(e,t){let o=!!this.workspace,n,r,s=[];if(o?(n=this.getWorkbenchState(),r=this.workspace.configuration?this.workspace.configuration.fsPath:void 0,s=this.workspace.folders,this.workspace.update(e)):this.workspace=e,await this.initializeConfiguration(t),o){let l=this.getWorkbenchState();n&&l!==n&&this._onDidChangeWorkbenchState.fire(l);let c=this.workspace.configuration?this.workspace.configuration.fsPath:void 0;(r&&c!==r||l!==n)&&this._onDidChangeWorkspaceName.fire();let u=this.compareFolders(s,this.workspace.folders);u&&(u.added.length||u.removed.length||u.changed.length)&&(await this.handleWillChangeWorkspaceFolders(u,!1),this._onDidChangeWorkspaceFolders.fire(u))}this.localUserConfiguration.hasTasksLoaded||this._register(Ff(ut,()=>this.reloadLocalUserConfiguration(!1,this._configuration.localUserConfiguration)))}compareFolders(e,t){let o={added:[],removed:[],changed:[]};o.added=t.filter(n=>!e.some(r=>n.uri.toString()===r.uri.toString()));for(let n=0;n<e.length;n++){let r=e[n],s=0;for(s=0;s<t.length&&r.uri.toString()!==t[s].uri.toString();s++);s<t.length?(n!==s||r.name!==t[s].name)&&o.changed.push(r):o.removed.push(r)}return o}async initializeConfiguration(e){await this.defaultConfiguration.initialize();let t=this.policyConfiguration.initialize(),o=this.applicationConfiguration?this.applicationConfiguration.initialize():Promise.resolve(Su.createEmptyModel(this.logService)),n=async()=>{Wo("code/willInitUserConfiguration");let c=await Promise.all([this.localUserConfiguration.initialize(),this.remoteUserConfiguration?this.remoteUserConfiguration.initialize():Promise.resolve(Su.createEmptyModel(this.logService))]);if(this.applicationConfiguration){let u=await o;c[0]=this.localUserConfiguration.reparse({exclude:u.getValue(gw)})}return Wo("code/didInitUserConfiguration"),c},[,r,[s,l]]=await Promise.all([t,o,n()]);Wo("code/willInitWorkspaceConfiguration"),await this.loadConfiguration(r,s,l,e),Wo("code/didInitWorkspaceConfiguration")}reloadDefaultConfiguration(){this.onDefaultConfigurationChanged(this.defaultConfiguration.reload())}async reloadApplicationConfiguration(e){if(!this.applicationConfiguration)return Su.createEmptyModel(this.logService);let t=await this.applicationConfiguration.loadConfiguration();return e||this.onApplicationConfigurationChanged(t),t}async reloadUserConfiguration(){let[e,t]=await Promise.all([this.reloadLocalUserConfiguration(!0),this.reloadRemoteUserConfiguration(!0)]);return{local:e,remote:t}}async reloadLocalUserConfiguration(e,t){let o=await this.localUserConfiguration.reload(t);return e||this.onLocalUserConfigurationChanged(o),o}async reloadRemoteUserConfiguration(e){if(this.remoteUserConfiguration){let t=await this.remoteUserConfiguration.reload();return e||this.onRemoteUserConfigurationChanged(t),t}return Su.createEmptyModel(this.logService)}async reloadWorkspaceConfiguration(){let e=this.getWorkbenchState();if(e===2)return this.onWorkspaceFolderConfigurationChanged(this.workspace.folders[0]);if(e===3)return this.workspaceConfiguration.reload().then(()=>this.onWorkspaceConfigurationChanged(!1))}reloadWorkspaceFolderConfiguration(e){return this.onWorkspaceFolderConfigurationChanged(e)}async loadConfiguration(e,t,o,n){this.cachedFolderConfigs.clearAndDisposeAll();let r=this.workspace.folders,s=await this.loadFolderConfigurations(r),l=this.getWorkspaceConfigurationModel(s),c=new dt;s.forEach((p,h)=>c.set(r[h].uri,p));let u=this._configuration;if(this._configuration=new Zht(this.defaultConfiguration.configurationModel,this.policyConfiguration.configurationModel,e,t,o,l,c,Su.createEmptyModel(this.logService),new dt,this.workspace,this.logService),this.initialized=!0,n){let p=this._configuration.compare(u);this.triggerConfigurationChange(p,{data:u.toData(),workspace:this.workspace},5)}this.updateRestrictedSettings()}getWorkspaceConfigurationModel(e){switch(this.getWorkbenchState()){case 2:return e[0];case 3:return this.workspaceConfiguration.getConfiguration();default:return Su.createEmptyModel(this.logService)}}onUserDataProfileChanged(e){e.join((async()=>{let t=[];t.push(this.localUserConfiguration.reset(e.profile.settingsResource,e.profile.tasksResource,e.profile.mcpResource,{scopes:FBo(e.profile,!!this.remoteUserConfiguration)})),(e.previous.isDefault!==e.profile.isDefault||!!e.previous.useDefaultFlags?.settings!=!!e.profile.useDefaultFlags?.settings)&&(this.createApplicationConfiguration(),this.applicationConfiguration&&t.push(this.reloadApplicationConfiguration(!0)));let[o,n]=await Promise.all(t);n=n??this._configuration.applicationConfiguration,this.applicationConfiguration&&(o=this.localUserConfiguration.reparse({exclude:n.getValue(gw)})),await this.loadConfiguration(n,o,this._configuration.remoteUserConfiguration,!0)})())}onDefaultConfigurationChanged(e,t){if(this.workspace){let o=this._configuration.toData(),n=this._configuration.compareAndUpdateDefaultConfiguration(e,t);if(this.applicationConfiguration&&this._configuration.updateApplicationConfiguration(this.applicationConfiguration.reparse()),this.remoteUserConfiguration&&(this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse()),this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reparse())),this.getWorkbenchState()===2){let r=this.cachedFolderConfigs.get(this.workspace.folders[0].uri);r&&(this._configuration.updateWorkspaceConfiguration(r.reparse()),this._configuration.updateFolderConfiguration(this.workspace.folders[0].uri,r.reparse()))}else{this._configuration.updateWorkspaceConfiguration(this.workspaceConfiguration.reparseWorkspaceSettings());for(let r of this.workspace.folders){let s=this.cachedFolderConfigs.get(r.uri);s&&this._configuration.updateFolderConfiguration(r.uri,s.reparse())}}this.triggerConfigurationChange(n,{data:o,workspace:this.workspace},7),this.updateRestrictedSettings()}}onPolicyConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.compareAndUpdatePolicyConfiguration(e);this.triggerConfigurationChange(o,t,7)}onApplicationConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.applicationConfiguration.getValue(gw)??[],n=this._configuration.compareAndUpdateApplicationConfiguration(e),r=this.getValue(gw)??[],s=this.configurationRegistry.getConfigurationProperties(),l=[];for(let c of n.keys){let u=s[c]?.scope;if(u&&MC.includes(u)){if(l.push(c),c===gw){for(let p of o)r.includes(p)||l.push(p);for(let p of r)o.includes(p)||l.push(p)}}else r.includes(c)&&l.push(c)}n.keys=l,n.keys.includes(gw)&&this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse({exclude:r})),this.triggerConfigurationChange(n,t,2)}onLocalUserConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.compareAndUpdateLocalUserConfiguration(e);this.triggerConfigurationChange(o,t,2)}onRemoteUserConfigurationChanged(e){let t={data:this._configuration.toData(),workspace:this.workspace},o=this._configuration.compareAndUpdateRemoteUserConfiguration(e);this.triggerConfigurationChange(o,t,2)}async onWorkspaceConfigurationChanged(e){if(this.workspace&&this.workspace.configuration){let t=t0t(this.workspaceConfiguration.getFolders(),this.workspace.configuration,this.uriIdentityService.extUri);if(this.workspace.initialized){let{added:o,removed:n,changed:r}=this.compareFolders(this.workspace.folders,t);o.length||n.length||r.length?t=await this.toValidWorkspaceFolders(t):t=this.workspace.folders}await this.updateWorkspaceConfiguration(t,this.workspaceConfiguration.getConfiguration(),e)}}updateRestrictedSettings(){let e=[],t=this.configurationRegistry.getConfigurationProperties(),o=Object.keys(t).filter(v=>t[v].restricted).sort((v,b)=>v.localeCompare(b)),n=dA(o,this._restrictedSettings.default,(v,b)=>v.localeCompare(b));e.push(...n.added,...n.removed);let r=(this.applicationConfiguration?.getRestrictedSettings()||[]).sort((v,b)=>v.localeCompare(b)),s=dA(r,this._restrictedSettings.application||[],(v,b)=>v.localeCompare(b));e.push(...s.added,...s.removed);let l=this.localUserConfiguration.getRestrictedSettings().sort((v,b)=>v.localeCompare(b)),c=dA(l,this._restrictedSettings.userLocal||[],(v,b)=>v.localeCompare(b));e.push(...c.added,...c.removed);let u=(this.remoteUserConfiguration?.getRestrictedSettings()||[]).sort((v,b)=>v.localeCompare(b)),p=dA(u,this._restrictedSettings.userRemote||[],(v,b)=>v.localeCompare(b));e.push(...p.added,...p.removed);let h=new dt;for(let v of this.workspace.folders){let S=(this.cachedFolderConfigs.get(v.uri)?.getRestrictedSettings()||[]).sort((x,E)=>x.localeCompare(E));S.length&&h.set(v.uri,S);let y=this._restrictedSettings.workspaceFolder?.get(v.uri)||[],w=dA(S,y,(x,E)=>x.localeCompare(E));e.push(...w.added,...w.removed)}let g=this.getWorkbenchState()===3?this.workspaceConfiguration.getRestrictedSettings().sort((v,b)=>v.localeCompare(b)):this.workspace.folders[0]?h.get(this.workspace.folders[0].uri)||[]:[],f=dA(g,this._restrictedSettings.workspace||[],(v,b)=>v.localeCompare(b));e.push(...f.added,...f.removed),e.length&&(this._restrictedSettings={default:o,application:r.length?r:void 0,userLocal:l.length?l:void 0,userRemote:u.length?u:void 0,workspace:g.length?g:void 0,workspaceFolder:h.size?h:void 0},this._onDidChangeRestrictedSettings.fire(this.restrictedSettings))}async updateWorkspaceConfiguration(e,t,o){let n={data:this._configuration.toData(),workspace:this.workspace},r=this._configuration.compareAndUpdateWorkspaceConfiguration(t),s=this.compareFolders(this.workspace.folders,e);if(s.added.length||s.removed.length||s.changed.length){this.workspace.folders=e;let l=await this.onFoldersChanged();await this.handleWillChangeWorkspaceFolders(s,o),this.triggerConfigurationChange(l,n,6),this._onDidChangeWorkspaceFolders.fire(s)}else this.triggerConfigurationChange(r,n,5);this.updateRestrictedSettings()}async handleWillChangeWorkspaceFolders(e,t){let o=[];this._onWillChangeWorkspaceFolders.fire({join(n){o.push(n)},changes:e,fromCache:t});try{await vn.settled(o)}catch{}}async onWorkspaceFolderConfigurationChanged(e){let[t]=await this.loadFolderConfigurations([e]),o={data:this._configuration.toData(),workspace:this.workspace},n=this._configuration.compareAndUpdateFolderConfiguration(e.uri,t);if(this.getWorkbenchState()===2){let r=this._configuration.compareAndUpdateWorkspaceConfiguration(t);this.triggerConfigurationChange(Q$i(n,r),o,5)}else this.triggerConfigurationChange(n,o,6);this.updateRestrictedSettings()}async onFoldersChanged(){let e=[];for(let o of this.cachedFolderConfigs.keys())this.workspace.folders.filter(n=>n.uri.toString()===o.toString())[0]||(this.cachedFolderConfigs.deleteAndDispose(o),e.push(this._configuration.compareAndDeleteFolderConfiguration(o)));let t=this.workspace.folders.filter(o=>!this.cachedFolderConfigs.has(o.uri));return t.length&&(await this.loadFolderConfigurations(t)).forEach((n,r)=>{e.push(this._configuration.compareAndUpdateFolderConfiguration(t[r].uri,n))}),Q$i(...e)}loadFolderConfigurations(e){return Promise.all([...e.map(t=>{let o=this.cachedFolderConfigs.get(t.uri);return o||(o=new ZJt(!this.initialized,t,WMe,this.getWorkbenchState(),this.isWorkspaceTrusted,this.fileService,this.uriIdentityService,this.logService,this.configurationCache),o.addRelated(o.onDidChange(()=>this.onWorkspaceFolderConfigurationChanged(t))),this.cachedFolderConfigs.set(t.uri,o)),o.loadConfiguration()})])}async validateWorkspaceFoldersAndReload(e){let t=await this.toValidWorkspaceFolders(this.workspace.folders),{removed:o}=this.compareFolders(this.workspace.folders,t);o.length&&await this.updateWorkspaceConfiguration(t,this.workspaceConfiguration.getConfiguration(),e)}async toValidWorkspaceFolders(e){let t=[];for(let o of e){try{if(!(await this.fileService.stat(o.uri)).isDirectory)continue}catch(n){this.logService.warn(`Ignoring the error while validating workspace folder ${o.uri.toString()} - ${Mn(n)}`)}t.push(o)}return t}async writeConfigurationValue(e,t,o,n,r){if(!this.instantiationService)throw new Error("Cannot write configuration because the configuration service is not yet ready to accept writes.");if(o===7)throw new Error("Invalid configuration target");if(o===8){let l={data:this._configuration.toData(),workspace:this.workspace};this._configuration.updateValue(e,t,n),this.triggerConfigurationChange({keys:n?.overrideIdentifiers?.length?[ASt(n.overrideIdentifiers),e]:[e],overrides:n?.overrideIdentifiers?.length?n.overrideIdentifiers.map(c=>[c,[e]]):[]},l,o);return}let s=this.toEditableConfigurationTarget(o,e);if(!s)throw new Error("Invalid configuration target");if(s===2&&!this.remoteUserConfiguration)throw new Error("Invalid configuration target");if(n?.overrideIdentifiers?.length&&n.overrideIdentifiers.length>1){let l=this.getConfigurationModelForEditableConfigurationTarget(s,n.resource);if(l){let c=n.overrideIdentifiers.sort(),u=l.overrides.find(p=>eo([...p.identifiers].sort(),c));u&&(n.overrideIdentifiers=u.identifiers)}}switch(this.configurationEditing=this.configurationEditing??this.createConfigurationEditingService(this.instantiationService),await(await this.configurationEditing).writeConfiguration(s,{key:e,value:t},{scopes:n,...r}),s){case 1:this.applicationConfiguration&&this.isSettingAppliedForAllProfiles(e)?await this.reloadApplicationConfiguration():await this.reloadLocalUserConfiguration();return;case 2:return this.reloadRemoteUserConfiguration().then(()=>{});case 3:return this.reloadWorkspaceConfiguration();case 4:{let l=n&&n.resource?this.workspace.getFolder(n.resource):null;if(l)return this.reloadWorkspaceFolderConfiguration(l)}}}async createConfigurationEditingService(e){let t=(await this.remoteAgentService.getEnvironment())?.settingsPath??null;return e.createInstance(g$e,t)}getConfigurationModelForEditableConfigurationTarget(e,t){switch(e){case 1:return this._configuration.localUserConfiguration;case 2:return this._configuration.remoteUserConfiguration;case 3:return this._configuration.workspaceConfiguration;case 4:return t?this._configuration.folderConfigurations.get(t):void 0}}getConfigurationModel(e,t){switch(e){case 3:return this._configuration.localUserConfiguration;case 4:return this._configuration.remoteUserConfiguration;case 5:return this._configuration.workspaceConfiguration;case 6:return t?this._configuration.folderConfigurations.get(t):void 0;default:return}}deriveConfigurationTargets(e,t,o){if(Qi(t,o.value))return[];let n=[];return o.workspaceFolderValue!==void 0&&n.push(6),o.workspaceValue!==void 0&&n.push(5),o.userRemoteValue!==void 0&&n.push(4),o.userLocalValue!==void 0&&n.push(3),o.applicationValue!==void 0&&n.push(1),t===void 0?n:[n[0]||2]}triggerConfigurationChange(e,t,o){if(e.keys.length){o!==7&&this.logService.debug(`Configuration keys changed in ${HY(o)} target`,...e.keys);let n=new KJt(e,t,this._configuration,this.workspace,this.logService);n.source=o,this._onDidChangeConfiguration.fire(n)}}toEditableConfigurationTarget(e,t){if(e===1)return 1;if(e===2){if(this.remoteUserConfiguration){let o=this.configurationRegistry.getConfigurationProperties()[t]?.scope;if(o===2||o===7||o===3)return 2;if(this.inspect(t).userRemoteValue!==void 0)return 2}return 1}return e===3?1:e===4?2:e===5?3:e===6?4:null}},tgt=class extends k{constructor(e,t,o,n,r){super();this.workspaceContextService=e;this.environmentService=t;this.workspaceTrustManagementService=o;n.whenInstalledExtensionsRegistered().then(()=>{this.registerConfigurationSchemas();let s=oe.as($t.Configuration),l=this._register(new rn(50));this._register(U.any(s.onDidUpdateConfiguration,s.onDidSchemaChange,o.onDidChangeTrust)(()=>l.trigger(()=>this.registerConfigurationSchemas(),r.phase===4?void 0:2500)))})}registerConfigurationSchemas(){for(let u of Object.keys(Ay.properties)){let p=Ay.properties[u];p.markdownDeprecationMessage&&p.deprecationMessage===p.markdownDeprecationMessage&&(p.deprecationMessage=ma({value:HUt(p.markdownDeprecationMessage)}))}let e={properties:Ay.properties,patternProperties:Ay.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},t=this.environmentService.remoteAuthority?{properties:Object.assign({},iCe.properties,Bz.properties,SF.properties),patternProperties:Ay.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:e,o={properties:Object.assign({},fce.properties,Vz.properties,Bz.properties,SF.properties),patternProperties:Ay.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},n={properties:Object.assign({},oCe.properties,fce.properties,Vz.properties,Bz.properties,SF.properties),patternProperties:Ay.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},r={properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(Vz.properties),this.checkAndFilterPropertiesRequiringTrust(Bz.properties),this.checkAndFilterPropertiesRequiringTrust(SF.properties)),patternProperties:Ay.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},s={properties:Object.keys(Ay.properties).reduce((u,p)=>(u[p]=Object.assign({deprecationMessage:void 0},Ay.properties[p]),u),{}),patternProperties:Object.keys(Ay.patternProperties).reduce((u,p)=>(u[p]=Object.assign({deprecationMessage:void 0},Ay.patternProperties[p]),u),{}),additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},l=3===this.workspaceContextService.getWorkbenchState()?{properties:Object.assign({},this.checkAndFilterPropertiesRequiringTrust(Vz.properties),this.checkAndFilterPropertiesRequiringTrust(SF.properties)),patternProperties:Ay.patternProperties,additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0}:r,c={type:"object",description:d(18713,null),properties:Object.assign({},this.filterDefaultOverridableProperties(Vz.properties),this.filterDefaultOverridableProperties(Bz.properties),this.filterDefaultOverridableProperties(SF.properties)),patternProperties:{[Wz]:{type:"object",default:{},$ref:h5}},additionalProperties:!1};this.registerSchemas({defaultSettingsSchema:s,userSettingsSchema:t,profileSettingsSchema:o,machineSettingsSchema:n,workspaceSettingsSchema:r,folderSettingsSchema:l,configDefaultsSchema:c})}registerSchemas(e){let t=oe.as(Ta.JSONContribution);t.registerSchema(ugo,e.defaultSettingsSchema),t.registerSchema(pgo,e.userSettingsSchema),t.registerSchema(mgo,e.profileSettingsSchema),t.registerSchema(hgo,e.machineSettingsSchema),t.registerSchema(kVt,e.workspaceSettingsSchema),t.registerSchema(ggo,e.folderSettingsSchema),t.registerSchema(PSt,e.configDefaultsSchema)}checkAndFilterPropertiesRequiringTrust(e){if(this.workspaceTrustManagementService.isWorkspaceTrusted())return e;let t={};return Object.entries(e).forEach(([o,n])=>{n.restricted||(t[o]=n)}),t}filterDefaultOverridableProperties(e){let t={};return Object.entries(e).forEach(([o,n])=>{n.disallowConfigurationDefault||(t[o]=n)}),t}};tgt=I([m(0,Ae),m(1,Mt),m(2,Or),m(3,lt),m(4,to)],tgt);var b$e=class extends k{constructor(e,t,o,n){super();this.workbenchAssignmentService=e;this.extensionService=t;this.configurationService=o;this.logService=n;this.processedExperimentalSettings=new Set;this.autoExperimentalSettings=new Set;this.configurationRegistry=oe.as($t.Configuration);this.throttler=this._register(new am);this.throttler.queue(()=>this.updateDefaults()),this._register(e.onDidRefetchAssignments(()=>this.throttler.queue(()=>this.processExperimentalSettings(this.autoExperimentalSettings,!0)))),this._register(this.configurationRegistry.onDidUpdateConfiguration(({properties:r})=>this.processExperimentalSettings(r,!1)))}static{this.ID="workbench.contrib.configurationDefaultOverridesContribution"}async updateDefaults(){this.logService.trace("ConfigurationService#updateDefaults: begin");try{await this.processExperimentalSettings(Object.keys(this.configurationRegistry.getConfigurationProperties()),!1)}finally{await this.extensionService.whenInstalledExtensionsRegistered(),this.logService.trace("ConfigurationService#updateDefaults: resetting the defaults"),this.configurationService.reloadConfiguration(7)}}async processExperimentalSettings(e,t){let o={},n=this.configurationRegistry.getConfigurationProperties(),r=this.configurationRegistry.getRegisteredDefaultConfigurations().filter(s=>s.preventExperimentOverride);for(let s of e){let l=n[s];if(!l?.experiment)continue;let c=l.defaultValueSource&&!(l.defaultValueSource instanceof Map)?l.defaultValueSource:void 0;if(!(c&&r.some(u=>iri(u.source,c)&&u.overrides?.[s]!==void 0))&&!(!t&&this.processedExperimentalSettings.has(s))){this.processedExperimentalSettings.add(s),l.experiment.mode==="auto"&&this.autoExperimentalSettings.add(s);try{let u=await this.workbenchAssignmentService.getTreatment(l.experiment.name??`config.${s}`);!bn(u)&&!Qi(u,l.default)&&(o[s]=u)}catch{}}}Object.keys(o).length&&this.configurationRegistry.registerDefaultConfigurations([{overrides:o}])}};b$e=I([m(0,wN),m(1,lt),m(2,B),m(3,re)],b$e);var RMn=oe.as(Zi.Workbench);RMn.registerWorkbenchContribution(tgt,3);bt(b$e.ID,b$e,vt.BlockRestore);var LMn=oe.as($t.Configuration);LMn.registerConfiguration({...jd,properties:{[gw]:{type:"array",description:d(18714,null),default:[],scope:1,additionalProperties:!0,uniqueItems:!0}}});var tZt=class extends Vde{constructor(e,t,o,n){super();this.remoteService=o;this.environmentService=n;this.profileStorageDisposables=this._register(new O);this.workspaceStorageDisposables=this._register(new O);this.applicationStorageProfile=t.defaultProfile,this.applicationStorage=this.createApplicationStorage(),this.applicationSharedStorage=this.createApplicationSharedStorage(),this.profileStorageProfile=t.currentProfile,this.profileStorage=this.createProfileStorage(this.profileStorageProfile),this.workspaceStorageId=e?.id,this.workspaceStorage=this.createWorkspaceStorage(e)}createApplicationStorage(){let e=this._register(new hAe(this.remoteService.getChannel("storage"))),t=this._register(new Gk(e));return this._register(t.onDidChangeStorage(o=>this.emitDidChangeValue(-1,o))),t}createApplicationSharedStorage(){let e=this._register(new gAe(this.remoteService.getChannel("storage"))),t=this._register(new Gk(e));return this._register(t.onDidChangeStorage(o=>this.emitDidChangeValue(-2,o))),t}createProfileStorage(e){this.profileStorageDisposables.clear(),this.profileStorageProfile=e;let t;if(Gke(e))t=this.applicationStorage;else{let o=this.profileStorageDisposables.add(new fAe(this.remoteService.getChannel("storage"),e));t=this.profileStorageDisposables.add(new Gk(o))}return this.profileStorageDisposables.add(t.onDidChangeStorage(o=>this.emitDidChangeValue(0,o))),t}createWorkspaceStorage(e){this.workspaceStorageDisposables.clear(),this.workspaceStorageId=e?.id;let t;if(e){let o=this.workspaceStorageDisposables.add(new C1t(this.remoteService.getChannel("storage"),e));t=this.workspaceStorageDisposables.add(new Gk(o)),this.workspaceStorageDisposables.add(t.onDidChangeStorage(n=>this.emitDidChangeValue(1,n)))}return t}async doInitialize(){await vn.settled([this.applicationStorage.init(),this.applicationSharedStorage.init(),this.profileStorage.init(),this.workspaceStorage?.init()??Promise.resolve()])}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 Ve(this.environmentService.appSharedDataHome,"sharedStorage").with({scheme:Q.file}).fsPath;case-1:return this.applicationStorageProfile.globalStorageHome.with({scheme:Q.file}).fsPath;case 0:return this.profileStorageProfile?.globalStorageHome.with({scheme:Q.file}).fsPath;default:return this.workspaceStorageId?`${Ve(this.environmentService.workspaceStorageHome,this.workspaceStorageId,"state.vscdb").with({scheme:Q.file}).fsPath}`:void 0}}async close(){this.stopFlushWhenIdle(),this.emitWillSaveState(1),await vn.settled([this.applicationStorage.close(),this.applicationSharedStorage.close(),this.profileStorage.close(),this.workspaceStorage?.close()??Promise.resolve()])}async switchToProfile(e){if(!this.canSwitchProfile(this.profileStorageProfile,e))return;let t=this.profileStorage,o=t.items;t!==this.applicationStorage&&await t.close(),this.profileStorage=this.createProfileStorage(e),await this.profileStorage.init(),this.switchData(o,this.profileStorage,0)}async switchToWorkspace(e,t){let o=this.workspaceStorage,n=o?.items??new Map;await o?.close(),this.workspaceStorage=this.createWorkspaceStorage(e),await this.workspaceStorage.init(),this.switchData(n,this.workspaceStorage,1)}hasScope(e){return QF(e)?this.profileStorageProfile.id===e.id:this.workspaceStorageId===e.id}};var iZt=class extends tZt{constructor(e,t,o,n,r){super(e,{currentProfile:t.currentProfile,defaultProfile:o.defaultProfile},n,r);this.userDataProfileService=t;this.workbenchEnvironmentService=r;this.registerListeners()}createApplicationSharedStorage(){let e=this.remoteService.getChannel("storage"),t=this._register(new gAe(e)),o=this._register(new xQe(t));return this._register(o.onDidChangeStorage(n=>this.emitDidChangeValue(-2,n))),o}async doInitialize(){await super.doInitialize();let e=this.getStorage(-2);if(e instanceof xQe){let t;if(this.workbenchEnvironmentService.isSessionsWindow){let o=this.remoteService.getChannel("storage");t=this._register(new Gk(this._register(new x1t(o)))),await t.init()}else t=this.getStorage(-1);t&&e.setFallbackStorage(t,this.workbenchEnvironmentService.isSessionsWindow)}}registerListeners(){this._register(this.userDataProfileService.onDidChangeCurrentProfile(e=>e.join(this.switchToProfile(e.profile))))}};var Z$i={request:"vscode:createSharedProcessChannelConnection",response:"vscode:createSharedProcessChannelConnectionResult"},eji={request:"vscode:createSharedProcessRawConnection",response:"vscode:createSharedProcessRawConnectionResult"};var S$e=class extends k{constructor(e,t){super();this.windowId=e;this.logService=t;this.restoredBarrier=new ip;this.withSharedProcessConnection=this.connect()}async connect(){this.logService.trace("Renderer->SharedProcess#connect"),await Promise.race([this.restoredBarrier.wait(),Li(2e3)]),Wo("code/willConnectSharedProcess"),this.logService.trace("Renderer->SharedProcess#connect: before acquirePort");let e=await rz(Z$i.request,Z$i.response);return Wo("code/didConnectSharedProcess"),this.logService.trace("Renderer->SharedProcess#connect: connection established"),this._register(new fj(e,`window:${this.windowId}`))}notifyRestored(){this.restoredBarrier.isOpen()||this.restoredBarrier.open()}getChannel(e){return jH(this.withSharedProcessConnection.then(t=>t.getChannel(e)))}registerChannel(e,t){this.withSharedProcessConnection.then(o=>o.registerChannel(e,t))}async createRawConnection(){await this.withSharedProcessConnection,this.logService.trace("Renderer->SharedProcess#createRawConnection: before acquirePort");let e=await rz(eji.request,eji.response);return this.logService.trace("Renderer->SharedProcess#createRawConnection: connection established"),e}};S$e=I([m(1,re)],S$e);var I$e=class extends k{constructor(e,t){super();this.remoteResourceLoader=t;this._onDidChangeConnectionData=this._register(new T);this.onDidChangeConnectionData=this._onDidChangeConnectionData.event;this._resolveAuthorityRequests=new Map,this._connectionTokens=new Map,this._canonicalURIRequests=new Map,this._canonicalURIProvider=null,xL.setServerRootPath(e,void 0)}resolveAuthority(e){return this._resolveAuthorityRequests.has(e)||this._resolveAuthorityRequests.set(e,new Mo),this._resolveAuthorityRequests.get(e).p}async getCanonicalURI(e){let t=e.toString(),o=this._canonicalURIRequests.get(t);if(o)return o.result.p;let n=new Mo;return this._canonicalURIProvider?.(e).then(r=>n.complete(r),r=>n.error(r)),this._canonicalURIRequests.set(t,{input:e,result:n}),n.p}getConnectionData(e){if(!this._resolveAuthorityRequests.has(e))return null;let t=this._resolveAuthorityRequests.get(e);if(!t.isResolved)return null;let o=this._connectionTokens.get(e);return{connectTo:t.value.authority.connectTo,connectionToken:o}}_clearResolvedAuthority(e){this._resolveAuthorityRequests.has(e)&&(this._resolveAuthorityRequests.get(e).cancel(),this._resolveAuthorityRequests.delete(e))}_setResolvedAuthority(e,t){if(this._resolveAuthorityRequests.has(e.authority)){let o=this._resolveAuthorityRequests.get(e.authority);e.connectTo.type===0?xL.set(e.authority,e.connectTo.host,e.connectTo.port):xL.setDelegate(this.remoteResourceLoader.getResourceUriProvider()),e.connectionToken&&xL.setConnectionToken(e.authority,e.connectionToken),o.complete({authority:e,options:t}),this._onDidChangeConnectionData.fire()}}_setResolvedAuthorityError(e,t){this._resolveAuthorityRequests.has(e)&&this._resolveAuthorityRequests.get(e).error(ka.fromError(t))}_setAuthorityConnectionToken(e,t){this._connectionTokens.set(e,t),xL.setConnectionToken(e,t),this._onDidChangeConnectionData.fire()}_setCanonicalURIProvider(e){this._canonicalURIProvider=e,this._canonicalURIRequests.forEach(({result:t,input:o})=>{this._canonicalURIProvider(o).then(n=>t.complete(n),n=>t.error(n))})}};I$e=I([m(0,Ze)],I$e);var bj=class{static async getEnvironmentData(i,e,t){let o={remoteAuthority:e,profile:t},n=await i.call("getEnvironmentData",o),r=typeof n.reconnectionGraceTime=="number"&&n.reconnectionGraceTime>=0?n.reconnectionGraceTime:108e5;return{pid:n.pid,connectionToken:n.connectionToken,appRoot:A.revive(n.appRoot),execPath:n.execPath,tmpDir:A.revive(n.tmpDir),settingsPath:A.revive(n.settingsPath),mcpResource:A.revive(n.mcpResource),logsPath:A.revive(n.logsPath),extensionHostLogsPath:A.revive(n.extensionHostLogsPath),globalStorageHome:A.revive(n.globalStorageHome),workspaceStorageHome:A.revive(n.workspaceStorageHome),localHistoryHome:A.revive(n.localHistoryHome),userHome:A.revive(n.userHome),os:n.os,arch:n.arch,marks:n.marks,useHostProxy:n.useHostProxy,profiles:er(n.profiles),isUnsupportedGlibc:n.isUnsupportedGlibc,reconnectionGraceTime:r}}static async getExtensionHostExitInfo(i,e,t){let o={remoteAuthority:e,reconnectionToken:t};return i.call("getExtensionHostExitInfo",o)}static getDiagnosticInfo(i,e){return i.call("getDiagnosticInfo",e)}static updateTelemetryLevel(i,e){return i.call("updateTelemetryLevel",{telemetryLevel:e})}static logTelemetry(i,e,t){return i.call("logTelemetry",{eventName:e,data:t})}static flushTelemetry(i){return i.call("flushTelemetry")}static async ping(i){await i.call("ping")}};var MMn="signService",Wae=le(MMn);var y$e=class extends k{constructor(e,t,o,n,r,s,l){super();this.remoteSocketFactoryService=e;this.userDataProfileService=t;this._environmentService=o;this._remoteAuthorityResolverService=r;this._logService=l;this._environmentService.remoteAuthority?this._connection=this._register(new tji(this._environmentService.remoteAuthority,n.commit,n.quality,this.remoteSocketFactoryService,this._remoteAuthorityResolverService,s,this._logService)):this._connection=null,this._environment=null}getConnection(){return this._connection}getEnvironment(){return this.getRawEnvironment().then(void 0,()=>null)}getRawEnvironment(){return this._environment||(this._environment=this._withChannel(async(e,t)=>{let o=await bj.getEnvironmentData(e,t.remoteAuthority,this.userDataProfileService.currentProfile.isDefault?void 0:this.userDataProfileService.currentProfile.id);return this._remoteAuthorityResolverService._setAuthorityConnectionToken(t.remoteAuthority,o.connectionToken),typeof o.reconnectionGraceTime=="number"?(this._logService.info(`[reconnection-grace-time] Client received grace time from server: ${o.reconnectionGraceTime}ms (${Math.floor(o.reconnectionGraceTime/1e3)}s)`),t.updateGraceTime(o.reconnectionGraceTime)):this._logService.info("[reconnection-grace-time] Server did not provide grace time, using default"),o},null)),this._environment}getExtensionHostExitInfo(e){return this._withChannel((t,o)=>bj.getExtensionHostExitInfo(t,o.remoteAuthority,e),null)}getDiagnosticInfo(e){return this._withChannel(t=>bj.getDiagnosticInfo(t,e),void 0)}updateTelemetryLevel(e){return this._withTelemetryChannel(t=>bj.updateTelemetryLevel(t,e),void 0)}logTelemetry(e,t){return this._withTelemetryChannel(o=>bj.logTelemetry(o,e,t),void 0)}flushTelemetry(){return this._withTelemetryChannel(e=>bj.flushTelemetry(e),void 0)}getRoundTripTime(){return this._withTelemetryChannel(async e=>{let t=Date.now();return await bj.ping(e),Date.now()-t},void 0)}async endConnection(){this._connection&&(await this._connection.end(),this._connection.dispose())}_withChannel(e,t){let o=this.getConnection();return o?o.withChannel("remoteextensionsenvironment",n=>e(n,o)):Promise.resolve(t)}_withTelemetryChannel(e,t){let o=this.getConnection();return o?o.withChannel("telemetry",n=>e(n,o)):Promise.resolve(t)}};y$e=I([m(0,pG),m(1,gn),m(2,Mt),m(3,Ze),m(4,dd),m(5,Wae),m(6,re)],y$e);var tji=class extends k{constructor(e,t,o,n,r,s,l){super();this._commit=t;this._quality=o;this._remoteSocketFactoryService=n;this._remoteAuthorityResolverService=r;this._signService=s;this._logService=l;this._onReconnecting=this._register(new T);this.onReconnecting=this._onReconnecting.event;this._onDidStateChange=this._register(new T);this.onDidStateChange=this._onDidStateChange.event;this._managementConnection=null;this.end=()=>Promise.resolve();this.remoteAuthority=e,this._connection=null}getChannel(e){return jH(this._getOrCreateConnection().then(t=>t.getChannel(e)))}withChannel(e,t){let o=this.getChannel(e);return t(o)}registerChannel(e,t){this._getOrCreateConnection().then(o=>o.registerChannel(e,t))}async getInitialConnectionTimeMs(){try{await this._getOrCreateConnection()}catch{}return this._initialConnectionMs}getManagementConnection(){return this._managementConnection}updateGraceTime(e){this._managementConnection&&this._managementConnection.updateGraceTime(e)}_getOrCreateConnection(){return this._connection||(this._connection=this._createConnection()),this._connection}async _createConnection(){let e=!0,t={commit:this._commit,quality:this._quality,addressProvider:{getAddress:async()=>{e?e=!1:this._onReconnecting.fire(void 0);let{authority:r}=await this._remoteAuthorityResolverService.resolveAuthority(this.remoteAuthority);return{connectTo:r.connectTo,connectionToken:r.connectionToken}}},remoteSocketFactoryService:this._remoteSocketFactoryService,signService:this._signService,logService:this._logService,ipcLogger:null},o,n=Date.now();try{o=this._register(await xWo(t,this.remoteAuthority,"renderer")),this._managementConnection=o}finally{this._initialConnectionMs=Date.now()-n}return this._register(o.protocol.onDidDispose(()=>{o.dispose()})),this.end=()=>(o.protocol.sendDisconnect(),o.protocol.drain()),this._register(o.onDidStateChange(r=>this._onDidStateChange.fire(r))),o.client}};var w$e=class extends y$e{constructor(i,e,t,o,n,r,s){super(i,e,t,o,n,r,s)}};w$e=I([m(0,pG),m(1,gn),m(2,Mt),m(3,Ze),m(4,dd),m(5,Wae),m(6,re)],w$e);var C$e=class{constructor(i,e,t,o,n,r,s){this._remoteAgentService=i;this._remoteAuthorityResolverService=r;this._remoteAgentService.getRawEnvironment().then(void 0,l=>{if(!mC.isHandled(l)){let c=[{label:d(19247,null),run:()=>n.openDevTools()}],u=this._getTroubleshootingURL();u&&c.push({label:d(19248,null),run:()=>s.open(u,{openExternal:!0})}),e.prompt(ft.Error,d(19246,null,l?l.message:""),c)}})}static{this.ID="workbench.contrib.nativeRemoteConnectionFailureNotification"}_getTroubleshootingURL(){let i=this._remoteAgentService.getConnection();if(!i)return null;let e=this._remoteAuthorityResolverService.getConnectionData(i.remoteAuthority);return!e||e.connectTo.type!==0?null:A.from({scheme:"http",authority:`${e.connectTo.host}:${e.connectTo.port}`,path:"/version"})}};C$e=I([m(0,bo),m(1,Ne),m(2,Mt),m(3,_e),m(4,wo),m(5,dd),m(6,Je)],C$e);bt(C$e.ID,C$e,vt.BlockRestore);async function WBo(a,i,e,t,o,n){let r;try{await PMn(a,i,e,t,o,n)}catch(s){r=s}finally{r&&o.errorTransformer&&(r=o.errorTransformer(r)),typeof r<"u"&&e.error(r),e.end()}}async function PMn(a,i,e,t,o,n){iji(n);let r=await a.open(i,{create:!1});try{iji(n);let s=0,l=0,c=o&&typeof o.length=="number"?o.length:void 0,u=Ke.alloc(Math.min(o.bufferSize,typeof c=="number"?c:o.bufferSize)),p=o&&typeof o.position=="number"?o.position:0,h=0;do l=await a.read(r,p,u.buffer,h,u.byteLength-h),p+=l,h+=l,s+=l,typeof c=="number"&&(c-=l),h===u.byteLength&&(await e.write(t(u)),u=Ke.alloc(Math.min(o.bufferSize,typeof c=="number"?c:o.bufferSize)),h=0);while(l>0&&(typeof c!="number"||c>0)&&iji(n)&&AMn(s,o));if(h>0){let g=h;typeof c=="number"&&(g=Math.min(h,c)),e.write(t(u.slice(0,g)))}}catch(s){throw N5(s)}finally{await a.close(r)}}function iji(a){if(a.isCancellationRequested)throw wy();return!0}function AMn(a,i){if(typeof i?.limits?.size=="number"&&a>i.limits.size)throw Ys(d(2354,null),"EntryTooLarge");return!0}var Vae=class extends k{constructor(e){super();this.logService=e;this.BUFFER_SIZE=256*1024;this._onDidChangeFileSystemProviderRegistrations=this._register(new T);this.onDidChangeFileSystemProviderRegistrations=this._onDidChangeFileSystemProviderRegistrations.event;this._onWillActivateFileSystemProvider=this._register(new T);this.onWillActivateFileSystemProvider=this._onWillActivateFileSystemProvider.event;this._onDidChangeFileSystemProviderCapabilities=this._register(new T);this.onDidChangeFileSystemProviderCapabilities=this._onDidChangeFileSystemProviderCapabilities.event;this.provider=new Map;this._onDidRunOperation=this._register(new T);this.onDidRunOperation=this._onDidRunOperation.event;this.internalOnDidFilesChange=this._register(new T);this._onDidUncorrelatedFilesChange=this._register(new T);this.onDidFilesChange=this._onDidUncorrelatedFilesChange.event;this._onDidWatchError=this._register(new T);this.onDidWatchError=this._onDidWatchError.event;this.activeWatchers=new Map;this.writeQueue=this._register(new Tz)}registerProvider(e,t){if(this.provider.has(e))throw new Error(`A filesystem provider for the scheme '${e}' is already registered.`);Wo(`code/registerFilesystem/${e}`);let o=new O;return this.provider.set(e,t),this._onDidChangeFileSystemProviderRegistrations.fire({added:!0,scheme:e,provider:t}),o.add(t.onDidChangeFile(n=>{let r=new AF(n,!this.isPathCaseSensitive(t));this.internalOnDidFilesChange.fire(r),r.hasCorrelation()||this._onDidUncorrelatedFilesChange.fire(r)})),typeof t.onDidWatchError=="function"&&o.add(t.onDidWatchError(n=>this._onDidWatchError.fire(new Error(n)))),o.add(t.onDidChangeCapabilities(()=>this._onDidChangeFileSystemProviderCapabilities.fire({provider:t,scheme:e}))),ee(()=>{this._onDidChangeFileSystemProviderRegistrations.fire({added:!1,scheme:e,provider:t}),this.provider.delete(e),je(o)})}getProvider(e){return this.provider.get(e)}async activateProvider(e){let t=[];this._onWillActivateFileSystemProvider.fire({scheme:e,join(o){t.push(o)}}),!this.provider.has(e)&&await vn.settled(t)}async canHandleResource(e){return await this.activateProvider(e.scheme),this.hasProvider(e)}hasProvider(e){return this.provider.has(e.scheme)}hasCapability(e,t){let o=this.provider.get(e.scheme);return!!(o&&o.capabilities&t)}listCapabilities(){return yt.map(this.provider,([e,t])=>({scheme:e,capabilities:t.capabilities}))}async withProvider(e){if(!abt(e))throw new ua(d(2343,null,this.resourceForError(e)),8);await this.activateProvider(e.scheme);let t=this.provider.get(e.scheme);if(!t){let o=new ka;throw o.message=d(2345,null,e.toString()),o}return t}async withReadProvider(e){let t=await this.withProvider(e);if(A5(t)||yD(t)||Hyt(t))return t;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite, FileReadStream nor FileOpenReadWriteClose capability which is needed for the read operation.`)}async withWriteProvider(e){let t=await this.withProvider(e);if(A5(t)||yD(t))return t;throw new Error(`Filesystem provider for scheme '${e.scheme}' neither has FileReadWrite nor FileOpenReadWriteClose capability which is needed for the write operation.`)}async resolve(e,t){try{return await this.doResolveFile(e,t)}catch(o){throw O5(o)==="EntryNotFound"?new ua(d(2340,null,this.resourceForError(e)),1):N5(o)}}async doResolveFile(e,t){let o=await this.withProvider(e),n=this.isPathCaseSensitive(o),r=t?.resolveTo,s=t?.resolveSingleChildDescendants,l=t?.resolveMetadata,c=await o.stat(e),u;return this.toFileStat(o,e,c,void 0,!!l,(p,h)=>(u||(u=Hp.forUris(()=>!n),u.set(e,!0),r&&u.fill(!0,r)),u.get(p.resource)||u.findSuperstr(p.resource.with({query:null,fragment:null}))?!0:p.isDirectory&&s?h===1:!1))}async toFileStat(e,t,o,n,r,s){let{providerExtUri:l}=this.getExtUri(e),c={resource:t,name:l.basename(t),isFile:(o.type&1)!==0,isDirectory:(o.type&2)!==0,isSymbolicLink:(o.type&64)!==0,mtime:o.mtime,ctime:o.ctime,size:o.size,readonly:!!((o.permissions??0)&1)||!!(e.capabilities&2048),locked:!!((o.permissions??0)&2),executable:!!((o.permissions??0)&4),etag:Fsi({mtime:o.mtime,size:o.size}),children:void 0};if(c.isDirectory&&s(c,n)){try{let u=await e.readdir(t),p=await vn.settled(u.map(async([h,g])=>{try{let f=l.joinPath(t,h),v=r?await e.stat(f):{type:g};return await this.toFileStat(e,f,v,u.length,r,s)}catch(f){return this.logService.trace(f),null}}));c.children=ui(p)}catch(u){this.logService.trace(u),c.children=[]}return c}return c}async resolveAll(e){return vn.settled(e.map(async t=>{try{return{stat:await this.doResolveFile(t.resource,t.options),success:!0}}catch(o){return this.logService.trace(o),{stat:void 0,success:!1}}}))}async stat(e){let t=await this.withProvider(e),o=await t.stat(e);return this.toFileStat(t,e,o,void 0,!0,()=>!1)}async realpath(e){let t=await this.withProvider(e);if(bYi(t)){let o=await t.realpath(e);return e.with({path:o})}}async exists(e){let t=await this.withProvider(e);try{return!!await t.stat(e)}catch{return!1}}async canCreateFile(e,t){try{await this.doValidateCreateFile(e,t)}catch(o){return o}return!0}async doValidateCreateFile(e,t){if(!t?.overwrite&&await this.exists(e))throw new ua(d(2336,null,this.resourceForError(e)),3,t)}async createFile(e,t=Ke.fromString(""),o){await this.doValidateCreateFile(e,o);let n=await this.writeFile(e,t);return this._onDidRunOperation.fire(new PF(e,0,n)),n}async writeFile(e,t,o){let n=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),{providerExtUri:r}=this.getExtUri(n),s=o;if(Nsi(n)&&!s?.atomic){let l=n.enforceAtomicWriteFile?.(e);l&&(s={...o,atomic:l})}try{let{stat:l,buffer:c}=await this.validateWriteFile(n,e,t,s);l||await this.mkdirp(n,r.dirname(e)),c||(c=await this.peekBufferForWriting(n,t)),!A5(n)||yD(n)&&c instanceof Ke||yD(n)&&Nsi(n)&&s?.atomic?await this.doWriteUnbuffered(n,e,s,c):await this.doWriteBuffered(n,e,s,c instanceof Ke?Iwe(c):c),this._onDidRunOperation.fire(new PF(e,4))}catch(l){throw new ua(d(2335,null,this.resourceForError(e),N5(l).toString()),rp(l),s)}return this.resolve(e,{resolveMetadata:!0})}async peekBufferForWriting(e,t){let o;if(yD(e)&&!(t instanceof Ke))if(fY(t)){let n=await hbt(t,3);n.ended?o=Ke.concat(n.buffer):o=n}else o=b8i(t,n=>Ke.concat(n),3);else o=t;return o}async validateWriteFile(e,t,o,n){let r=!!n?.unlock;if(r&&!(e.capabilities&8192))throw new Error(d(2353,null,this.resourceForError(t)));if(n?.append&&!vYi(e))throw new ua(d(2332,null,this.resourceForError(t)),6);if(!!n?.atomic){if(!(e.capabilities&32768))throw new Error(d(2351,null,this.resourceForError(t)));if(!(e.capabilities&2))throw new Error(d(2352,null,this.resourceForError(t)));if(r)throw new Error(d(2350,null,this.resourceForError(t)))}let l;try{l=await e.stat(t)}catch{return Object.create(null)}if((l.type&2)!==0)throw new ua(d(2338,null,this.resourceForError(t)),0,n);this.throwIfFileIsReadonly(t,l);let c;if(typeof n?.mtime=="number"&&typeof n.etag=="string"&&n.etag!==GL&&typeof l.mtime=="number"&&typeof l.size=="number"&&n.mtime<l.mtime&&n.etag!==Fsi({mtime:n.mtime,size:l.size})){if(c=await this.peekBufferForWriting(e,o),c instanceof Ke&&c.byteLength===l.size)try{let{value:u}=await this.readFile(t,{limits:{size:l.size}});if(c.equals(u))return{stat:l,buffer:c}}catch{}throw new ua(d(2339,null),3,n)}return{stat:l,buffer:c}}async readFile(e,t,o){let n=await this.withReadProvider(e);return t?.atomic?this.doReadFileAtomic(n,e,t,o):this.doReadFile(n,e,t,o)}async doReadFileAtomic(e,t,o,n){return new Promise((r,s)=>{this.writeQueue.queueFor(t,async()=>{try{let l=await this.doReadFile(e,t,o,n);r(l)}catch(l){s(l)}},this.getExtUri(e).providerExtUri)})}async doReadFile(e,t,o,n){let r=await this.doReadFileStream(e,t,{...o,preferUnbuffered:!0},n);return{...r,value:await yI(r.value)}}async readFileStream(e,t,o){let n=await this.withReadProvider(e);return this.doReadFileStream(n,e,t,o)}async doReadFileStream(e,t,o,n){let r=new qe(n),s=o;Uyt(e)&&e.enforceAtomicReadFile?.(t)&&(s={...o,atomic:!0});let l=this.validateReadFile(t,s).then(u=>u,u=>{throw r.dispose(!0),u}),c;try{return typeof s?.etag=="string"&&s.etag!==GL&&await l,s?.atomic&&Uyt(e)||!(A5(e)||Hyt(e))||yD(e)&&s?.preferUnbuffered?c=this.readFileUnbuffered(e,t,s):Hyt(e)?c=this.readFileStreamed(e,t,r.token,s):c=this.readFileBuffered(e,t,r.token,s),c.on("end",()=>r.dispose()),c.on("error",()=>r.dispose()),{...await l,value:c}}catch(u){throw c&&await Swe(c),this.restoreReadError(u,t,s)}}restoreReadError(e,t,o){let n=d(2333,null,this.resourceForError(t),N5(e).toString());return e instanceof lK?new lK(n,e.stat,o):e instanceof NF?new NF(n,e.fileOperationResult,e.size,e.options):new ua(n,rp(e),o)}readFileStreamed(e,t,o,n=Object.create(null)){let r=e.readFileStream(t,n,o);return Wii(r,{data:s=>s instanceof Ke?s:Ke.wrap(s),error:s=>this.restoreReadError(s,t,n)},s=>Ke.concat(s))}readFileBuffered(e,t,o,n=Object.create(null)){let r=ywe();return WBo(e,t,r,s=>s,{...n,bufferSize:this.BUFFER_SIZE,errorTransformer:s=>this.restoreReadError(s,t,n)},o),r}readFileUnbuffered(e,t,o){let n=Ty(r=>Ke.concat(r));return(async()=>{try{let r;o?.atomic&&Uyt(e)?r=await e.readFile(t,{atomic:!0}):r=await e.readFile(t),typeof o?.position=="number"&&(r=r.slice(o.position)),typeof o?.length=="number"&&(r=r.slice(0,o.length)),this.validateReadFileLimits(t,r.byteLength,o),n.end(Ke.wrap(r))}catch(r){n.error(r),n.end()}})(),n}async validateReadFile(e,t){let o=await this.resolve(e,{resolveMetadata:!0});if(o.isDirectory)throw new ua(d(2337,null,this.resourceForError(e)),0,t);if(typeof t?.etag=="string"&&t.etag!==GL&&t.etag===o.etag)throw new lK(d(2341,null),o,t);return this.validateReadFileLimits(e,o.size,t),o}validateReadFileLimits(e,t,o){if(typeof o?.limits?.size=="number"&&t>o.limits.size)throw new NF(d(2342,null,this.resourceForError(e)),7,t,o)}async canMove(e,t,o){return this.doCanMoveCopy(e,t,"move",o)}async canCopy(e,t,o){return this.doCanMoveCopy(e,t,"copy",o)}async doCanMoveCopy(e,t,o,n){if(e.toString()!==t.toString())try{let r=o==="move"?this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e):await this.withReadProvider(e),s=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t);await this.doValidateMoveCopy(r,e,s,t,o,n)}catch(r){return r}return!0}async move(e,t,o){let n=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(e),e),r=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),s=await this.doMoveCopy(n,e,r,t,"move",!!o),l=await this.resolve(t,{resolveMetadata:!0});return this._onDidRunOperation.fire(new PF(e,s==="move"?2:3,l)),l}async copy(e,t,o){let n=await this.withReadProvider(e),r=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t),s=await this.doMoveCopy(n,e,r,t,"copy",!!o),l=await this.resolve(t,{resolveMetadata:!0});return this._onDidRunOperation.fire(new PF(e,s==="copy"?3:2,l)),l}async doMoveCopy(e,t,o,n,r,s){if(t.toString()===n.toString())return r;let{exists:l,isSameResourceWithDifferentPathCase:c}=await this.doValidateMoveCopy(e,t,o,n,r,s);if(l&&!c&&s&&await this.del(n,{recursive:!0}),await this.mkdirp(o,this.getExtUri(o).providerExtUri.dirname(n)),r==="copy"){if(e===o&&Q3e(e))await e.copy(t,n,{overwrite:s});else{let u=await this.resolve(t);u.isDirectory?await this.doCopyFolder(e,u,o,n):await this.doCopyFile(e,t,o,n)}return r}else return e===o?(await e.rename(t,n,{overwrite:s}),r):(await this.doMoveCopy(e,t,o,n,"copy",s),await this.del(t,{recursive:!0}),"copy")}async doCopyFile(e,t,o,n){if(A5(e)&&A5(o))return this.doPipeBuffered(e,t,o,n);if(A5(e)&&yD(o))return this.doPipeBufferedToUnbuffered(e,t,o,n);if(yD(e)&&A5(o))return this.doPipeUnbufferedToBuffered(e,t,o,n);if(yD(e)&&yD(o))return this.doPipeUnbuffered(e,t,o,n)}async doCopyFolder(e,t,o,n){await o.mkdir(n),Array.isArray(t.children)&&await vn.settled(t.children.map(async r=>{let s=this.getExtUri(o).providerExtUri.joinPath(n,r.name);return r.isDirectory?this.doCopyFolder(e,await this.resolve(r.resource),o,s):this.doCopyFile(e,r.resource,o,s)}))}async doValidateMoveCopy(e,t,o,n,r,s){let l=!1;if(e===o){let{providerExtUri:u,isPathCaseSensitive:p}=this.getExtUri(e);if(p||(l=u.isEqual(t,n)),l&&r==="copy")throw new Error(d(2346,null,this.resourceForError(t),this.resourceForError(n)));if(!l&&u.isEqualOrParent(n,t))throw new Error(d(2347,null,this.resourceForError(t),this.resourceForError(n)))}let c=await this.exists(n);if(c&&!l){if(!s)throw new ua(d(2348,null,this.resourceForError(t),this.resourceForError(n)),4);if(e===o){let{providerExtUri:u}=this.getExtUri(e);if(u.isEqualOrParent(t,n))throw new Error(d(2349,null,this.resourceForError(t),this.resourceForError(n)))}}return{exists:c,isSameResourceWithDifferentPathCase:l}}getExtUri(e){let t=this.isPathCaseSensitive(e);return{providerExtUri:t?Jn:Tk,isPathCaseSensitive:t}}isPathCaseSensitive(e){return!!(e.capabilities&1024)}async createFolder(e){let t=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e);await this.mkdirp(t,e);let o=await this.resolve(e,{resolveMetadata:!0});return this._onDidRunOperation.fire(new PF(e,0,o)),o}async mkdirp(e,t){let o=[],{providerExtUri:n}=this.getExtUri(e);for(;!n.isEqual(t,n.dirname(t));)try{if(((await e.stat(t)).type&2)===0)throw new Error(d(2344,null,this.resourceForError(t)));break}catch(r){if(O5(r)!=="EntryNotFound")throw r;o.push(n.basename(t)),t=n.dirname(t)}for(let r=o.length-1;r>=0;r--){t=n.joinPath(t,o[r]);try{await e.mkdir(t)}catch(s){if(O5(s)!=="EntryExists")throw s}}}async canDelete(e,t){try{await this.doValidateDelete(e,t)}catch(o){return o}return!0}async doValidateDelete(e,t){let o=this.throwIfFileSystemIsReadonly(await this.withProvider(e),e),n=!!t?.useTrash;if(n&&!(o.capabilities&4096))throw new Error(d(2331,null,this.resourceForError(e)));let r=t?.atomic;if(r&&!(o.capabilities&65536))throw new Error(d(2327,null,this.resourceForError(e)));if(n&&r)throw new Error(d(2330,null,this.resourceForError(e)));let s;try{s=await o.stat(e)}catch{}if(s)this.throwIfFileIsReadonly(e,s);else throw new ua(d(2329,null,this.resourceForError(e)),1);if(!!!t?.recursive){let c=await this.resolve(e);if(c.isDirectory&&Array.isArray(c.children)&&c.children.length>0)throw new Error(d(2328,null,this.resourceForError(e)))}return o}async del(e,t){let o=await this.doValidateDelete(e,t),n=t;if(SYi(o)&&!n?.atomic){let c=o.enforceAtomicDelete?.(e);c&&(n={...t,atomic:c})}let r=!!n?.useTrash,s=!!n?.recursive,l=n?.atomic??!1;await o.delete(e,{recursive:s,useTrash:r,atomic:l}),this._onDidRunOperation.fire(new PF(e,1))}async cloneFile(e,t){let o=await this.withProvider(e),n=this.throwIfFileSystemIsReadonly(await this.withWriteProvider(t),t);if(!(o===n&&this.getExtUri(o).providerExtUri.isEqual(e,t)))return o===n&&Byt(o)?o.cloneFile(e,t):(await this.mkdirp(n,this.getExtUri(n).providerExtUri.dirname(t)),o===n&&Q3e(o)?this.writeQueue.queueFor(e,()=>o.copy(e,t,{overwrite:!0}),this.getExtUri(o).providerExtUri):this.writeQueue.queueFor(e,()=>this.doCopyFile(o,e,n,t),this.getExtUri(o).providerExtUri))}static{this.WATCHER_CORRELATION_IDS=0}createWatcher(e,t){return this.watch(e,{...t,correlationId:Vae.WATCHER_CORRELATION_IDS++})}watch(e,t={recursive:!1,excludes:[]}){let o=new O,n=!1,r=()=>{n=!0};o.add(ee(()=>r())),(async()=>{try{let l=await this.doWatch(e,t);n?je(l):r=()=>je(l)}catch(l){this.logService.error(l)}})();let s=t.correlationId;if(typeof s=="number"){let l=o.add(new T);return o.add(this.internalOnDidFilesChange.event(u=>{u.correlates(s)&&l.fire(u)})),{onDidChange:l.event,dispose:()=>o.dispose()}}return o}async doWatch(e,t){let o=await this.withProvider(e),n=Lr([this.getExtUri(o).providerExtUri.getComparisonKey(e),t]),r=this.activeWatchers.get(n);return r||(r={count:0,disposable:o.watch(e,t)},this.activeWatchers.set(n,r)),r.count+=1,ee(()=>{r&&(r.count--,r.count===0&&(je(r.disposable),this.activeWatchers.delete(n)))})}dispose(){super.dispose();for(let[,e]of this.activeWatchers)je(e.disposable);this.activeWatchers.clear()}async doWriteBuffered(e,t,o,n){return this.writeQueue.queueFor(t,async()=>{let r=await e.open(t,{create:!0,unlock:o?.unlock??!1,append:o?.append??!1});try{fY(n)||mbt(n)?await this.doWriteStreamBufferedQueued(e,r,n):await this.doWriteReadableBufferedQueued(e,r,n)}catch(s){throw N5(s)}finally{await e.close(r)}},this.getExtUri(e).providerExtUri)}async doWriteStreamBufferedQueued(e,t,o){let n=0,r;if(mbt(o)){if(o.buffer.length>0){let s=Ke.concat(o.buffer);await this.doWriteBuffer(e,t,s,s.byteLength,n,0),n+=s.byteLength}if(o.ended)return;r=o.stream}else r=o;return new Promise((s,l)=>{_L(r,{onData:async c=>{r.pause();try{await this.doWriteBuffer(e,t,c,c.byteLength,n,0)}catch(u){return l(u)}n+=c.byteLength,setTimeout(()=>r.resume())},onError:c=>l(c),onEnd:()=>s()})})}async doWriteReadableBufferedQueued(e,t,o){let n=0,r;for(;(r=o.read())!==null;)await this.doWriteBuffer(e,t,r,r.byteLength,n,0),n+=r.byteLength}async doWriteBuffer(e,t,o,n,r,s){let l=0;for(;l<n;){let c=await e.write(t,r+l,o.buffer,s+l,n-l);l+=c}}async doWriteUnbuffered(e,t,o,n){return this.writeQueue.queueFor(t,()=>this.doWriteUnbufferedQueued(e,t,o,n),this.getExtUri(e).providerExtUri)}async doWriteUnbufferedQueued(e,t,o,n){let r;n instanceof Ke?r=n:fY(n)?r=await yI(n):mbt(n)?r=await _8i(n):r=vbt(n),await e.writeFile(t,r.buffer,{create:!0,overwrite:!0,unlock:o?.unlock??!1,atomic:o?.atomic??!1,append:o?.append??!1})}async doPipeBuffered(e,t,o,n){return this.writeQueue.queueFor(n,()=>this.doPipeBufferedQueued(e,t,o,n),this.getExtUri(o).providerExtUri)}async doPipeBufferedQueued(e,t,o,n){let r,s;try{r=await e.open(t,{create:!1}),s=await o.open(n,{create:!0,unlock:!1});let l=Ke.alloc(this.BUFFER_SIZE),c=0,u=0,p=0;do p=await e.read(r,c,l.buffer,u,l.byteLength-u),await this.doWriteBuffer(o,s,l,p,c,u),c+=p,u+=p,u===l.byteLength&&(u=0);while(p>0)}catch(l){throw N5(l)}finally{await vn.settled([typeof r=="number"?e.close(r):Promise.resolve(),typeof s=="number"?o.close(s):Promise.resolve()])}}async doPipeUnbuffered(e,t,o,n){return this.writeQueue.queueFor(n,()=>this.doPipeUnbufferedQueued(e,t,o,n),this.getExtUri(o).providerExtUri)}async doPipeUnbufferedQueued(e,t,o,n){return o.writeFile(n,await e.readFile(t),{create:!0,overwrite:!0,unlock:!1,atomic:!1})}async doPipeUnbufferedToBuffered(e,t,o,n){return this.writeQueue.queueFor(n,()=>this.doPipeUnbufferedToBufferedQueued(e,t,o,n),this.getExtUri(o).providerExtUri)}async doPipeUnbufferedToBufferedQueued(e,t,o,n){let r=await o.open(n,{create:!0,unlock:!1});try{let s=await e.readFile(t);await this.doWriteBuffer(o,r,Ke.wrap(s),s.byteLength,0,0)}catch(s){throw N5(s)}finally{await o.close(r)}}async doPipeBufferedToUnbuffered(e,t,o,n){let r=await yI(this.readFileBuffered(e,t,Ie.None));await this.doWriteUnbuffered(o,n,void 0,r)}throwIfFileSystemIsReadonly(e,t){if(e.capabilities&2048)throw new ua(d(2334,null,this.resourceForError(t)),6);return e}throwIfFileIsReadonly(e,t){if((t.permissions??0)&1)throw new ua(d(2334,null,this.resourceForError(e)),6)}resourceForError(e){return e.scheme===Q.file?e.fsPath:e.toString(!0)}};Vae=I([m(0,re)],Vae);function VBo(a){return a.recursive===!0}var oji=class a extends k{constructor(e,t,o,n){super();this.onFileChanges=e;this.onLogMessage=t;this.verboseLogging=o;this.options=n;this.watcherDisposables=this._register(new ue);this.requests=void 0;this.restartCounter=0}static{this.MAX_RESTARTS=5}init(){let e=new O;this.watcherDisposables.value=e,this.watcher=this.createWatcher(e),this.watcher.setVerboseLogging(this.verboseLogging),e.add(this.watcher.onDidChangeFile(t=>this.onFileChanges(t))),e.add(this.watcher.onDidLogMessage(t=>this.onLogMessage(t))),e.add(this.watcher.onDidError(t=>this.onError(t.error,t.request)))}onError(e,t){this.canRestart(e,t)?this.restartCounter<a.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,t){return!(!this.options.restartOnError||t||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()}};var oZt=class extends oji{constructor(i,e,t){super(i,e,t,{type:"universal",restartOnError:!0})}};function ogt(a){return a.map(i=>({type:i.type,resource:A.revive(i.resource),cId:i.cId}))}var BBo="localFilesystem",x$e=class extends k{constructor(e,t){super();this.channel=e;this.extraCapabilities=t;this.onDidChangeCapabilities=U.None;this._onDidChange=this._register(new T);this.onDidChangeFile=this._onDidChange.event;this._onDidWatchError=this._register(new T);this.onDidWatchError=this._onDidWatchError.event;this.sessionId=ht();this.registerFileChangeListeners()}get capabilities(){return this._capabilities||(this._capabilities=1040414,this.extraCapabilities.pathCaseSensitive&&(this._capabilities|=1024),this.extraCapabilities.trash&&(this._capabilities|=4096)),this._capabilities}stat(e){return this.channel.call("stat",[e])}realpath(e){return this.channel.call("realpath",[e])}readdir(e){return this.channel.call("readdir",[e])}async readFile(e,t){let{buffer:o}=await this.channel.call("readFile",[e,t]);return o}readFileStream(e,t,o){let n=Ty(s=>Ke.concat(s.map(l=>Ke.wrap(l))).buffer),r=new O;return r.add(this.channel.listen("readFileStream",[e,t])(s=>{if(s instanceof Ke)n.write(s.buffer);else{if(s==="end")n.end();else{let l;if(s instanceof Error)l=s;else{let c=s;l=Ys(c.message??Mn(c),c.code??"Unknown")}n.error(l),n.end()}r.dispose()}})),r.add(o.onCancellationRequested(()=>{n.error(wy()),n.end(),r.dispose()})),n}writeFile(e,t,o){return this.channel.call("writeFile",[e,Ke.wrap(t),o])}open(e,t){return this.channel.call("open",[e,t])}close(e){return this.channel.call("close",[e])}async read(e,t,o,n,r){let[s,l]=await this.channel.call("read",[e,t,r]);return o.set(s.buffer.slice(0,l),n),l}write(e,t,o,n,r){return this.channel.call("write",[e,t,Ke.wrap(o),n,r])}mkdir(e){return this.channel.call("mkdir",[e])}delete(e,t){return this.channel.call("delete",[e,t])}rename(e,t,o){return this.channel.call("rename",[e,t,o])}copy(e,t,o){return this.channel.call("copy",[e,t,o])}cloneFile(e,t){return this.channel.call("cloneFile",[e,t])}registerFileChangeListeners(){this._register(this.channel.listen("fileChange",[this.sessionId])(e=>{if(Array.isArray(e)){let t=e;this._onDidChange.fire(ogt(t))}else{let t=e;this._onDidWatchError.fire(t)}}))}watch(e,t){let o=ht();return this.channel.call("watch",[this.sessionId,o,e,t]),ee(()=>this.channel.call("unwatch",[this.sessionId,o]))}};var NMn="remoteFilesystem",nZt=class a extends x$e{static register(i,e,t){let o=i.getConnection();if(!o)return k.None;let n=new O,r=(async()=>{try{let s=await i.getRawEnvironment();s?e.registerProvider(Q.vscodeRemote,n.add(new a(s,o))):t.error("Cannot register remote filesystem provider. Remote environment doesnot exist.")}catch(s){t.error("Cannot register remote filesystem provider. Error while fetching remote environment.",Dn(s))}})();return n.add(e.onWillActivateFileSystemProvider(s=>{s.scheme===Q.vscodeRemote&&s.join(r)})),n}constructor(i,e){super(e.getChannel(NMn),{pathCaseSensitive:i.os===3})}};var rZt=class{constructor(i,e,t){this.donotCacheResourcesWithSchemes=i;this.fileService=t;this.cachedConfigurations=new Map;this.cacheHome=e.cacheHome}needsCaching(i){return!this.donotCacheResourcesWithSchemes.includes(i.scheme)}read(i){return this.getCachedConfiguration(i).read()}write(i,e){return this.getCachedConfiguration(i).save(e)}remove(i){return this.getCachedConfiguration(i).remove()}getCachedConfiguration({type:i,key:e}){let t=`${i}:${e}`,o=this.cachedConfigurations.get(t);return o||(o=new nji({type:i,key:e},this.cacheHome,this.fileService),this.cachedConfigurations.set(t,o)),o}},nji=class{constructor({type:i,key:e},t,o){this.fileService=o;this.cachedConfigurationFolderResource=Ve(t,"CachedConfigurations",i,e),this.cachedConfigurationFileResource=Ve(this.cachedConfigurationFolderResource,i==="workspaces"?"workspace.json":"configuration.json"),this.queue=new Hh}async read(){try{return(await this.fileService.readFile(this.cachedConfigurationFileResource)).value.toString()}catch{return""}}async save(i){await this.createCachedFolder()&&await this.queue.queue(async()=>{await this.fileService.writeFile(this.cachedConfigurationFileResource,Ke.fromString(i))})}async remove(){try{await this.queue.queue(()=>this.fileService.del(this.cachedConfigurationFolderResource,{recursive:!0,useTrash:!1}))}catch(i){if(i.fileOperationResult!==1)throw i}}async createCachedFolder(){if(await this.fileService.exists(this.cachedConfigurationFolderResource))return!0;try{return await this.fileService.createFolder(this.cachedConfigurationFolderResource),!0}catch{return!1}}};var sZt=class a{constructor(i){this.uri=i;this.time=a._clock++}static{this._clock=0}touch(){return this.time=a._clock++,this}},nye=class{constructor(i){this._fileService=i;this._dispooables=new O;this._limit=2**16;let e=new Map,t=o=>{let n=e.get(o.scheme);return n===void 0&&(n=i.hasProvider(o)&&!this._fileService.hasCapability(o,1024),e.set(o.scheme,n)),n};this._dispooables.add(U.any(i.onDidChangeFileSystemProviderRegistrations,i.onDidChangeFileSystemProviderCapabilities)(o=>{if(e.get(o.scheme)===void 0)return;e.delete(o.scheme);let r=t(A.from({scheme:o.scheme}));if(r!==r)for(let[s,l]of this._canonicalUris.entries())l.uri.scheme===o.scheme&&this._canonicalUris.delete(s)})),this.extUri=new Wle(t),this._canonicalUris=new Map}dispose(){this._dispooables.dispose(),this._canonicalUris.clear()}asCanonicalUri(i){this._fileService.hasProvider(i)&&(i=Jj(i));let e=this.extUri.getComparisonKey(i,!0),t=this._canonicalUris.get(e);return t?t.touch().uri.with({fragment:i.fragment}):(this._canonicalUris.set(e,new sZt(i)),this._checkTrim(),i)}_checkTrim(){if(this._canonicalUris.size<this._limit)return;sZt._clock=1;let i=[...this._canonicalUris.values()].map(t=>t.time),e=tY(Math.floor(i.length/2),i,(t,o)=>t-o);for(let[t,o]of this._canonicalUris.entries())o.time<=e?this._canonicalUris.delete(t):o.time=0}};nye=I([m(0,ge)],nye);Ce(gt,nye,1);var aZt=le("nativeKeyboardLayoutService"),k$e=class extends k{constructor(e){super();this._onDidChangeKeyboardLayout=this._register(new T);this.onDidChangeKeyboardLayout=this._onDidChangeKeyboardLayout.event;this._keyboardLayoutService=Xd.toService(e.getChannel("keyboardLayout")),this._initPromise=null,this._keyboardMapping=null,this._keyboardLayoutInfo=null,this._register(this._keyboardLayoutService.onDidChangeKeyboardLayout(async({keyboardLayoutInfo:t,keyboardMapping:o})=>{await this.initialize(),!OMn(this._keyboardMapping,o)&&(this._keyboardMapping=o,this._keyboardLayoutInfo=t,this._onDidChangeKeyboardLayout.fire())}))}initialize(){return this._initPromise||(this._initPromise=this._doInitialize()),this._initPromise}async _doInitialize(){let e=await this._keyboardLayoutService.getKeyboardLayoutData(),{keyboardLayoutInfo:t,keyboardMapping:o}=e;this._keyboardMapping=o,this._keyboardLayoutInfo=t}getRawKeyboardMapping(){return this._keyboardMapping}getCurrentKeyboardLayout(){return this._keyboardLayoutInfo}};k$e=I([m(0,rm)],k$e);function OMn(a,i){return Ao===1?mvo(a,i):hvo(a,i)}var lZt=class{constructor(i,e){this.sender=i;this.onMessage=e}send(i){try{this.sender.send("vscode:message",i.buffer)}catch{}}disconnect(){this.sender.send("vscode:disconnect",null)}};var cZt=class a extends Ree{static createProtocol(){let i=U.fromNodeEventEmitter(Xl,"vscode:message",(e,t)=>Ke.wrap(t));return Xl.send("vscode:hello"),new lZt(Xl,i)}constructor(i){let e=a.createProtocol();super(e,i),this.protocol=e}dispose(){this.protocol.disconnect(),super.dispose()}};var dZt=class extends k{constructor(i){super(),this.mainProcessConnection=this._register(new cZt(`window:${i}`))}getChannel(i){return this.mainProcessConnection.getChannel(i)}registerChannel(i,e){this.mainProcessConnection.registerChannel(i,e)}};var Bae=class extends k{constructor(i,e=[]){super(),this.logger=new iSt([i,...e]),this._register(i.onDidChangeLogLevel(t=>this.setLevel(t)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(i){this.logger.setLevel(i)}getLevel(){return this.logger.getLevel()}trace(i,...e){this.logger.trace(i,...e)}debug(i,...e){this.logger.debug(i,...e)}info(i,...e){this.logger.info(i,...e)}warn(i,...e){this.logger.warn(i,...e)}error(i,...e){this.logger.error(i,...e)}flush(){this.logger.flush()}};var uZt=class extends Bae{constructor(i,e){let t=new O,o=t.add(i.createLogger(e.logFile,{id:ghe,name:eP.name,group:eP})),n;e.isExtensionDevelopment&&e.extensionTestsLocationURI?n=i.createConsoleMainLogger():n=new tSt(o.getLevel()),super(o,[n]),!e.isBuilt&&rSt&&this._register(GQi(this)),this._register(t)}};var pZt=class extends k{constructor(e,t){super();this.logService=e;this.options=t;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 Aa(this.getRefreshWatchersDelay(this.universalWatchRequests.length)));this.nonRecursiveWatchRequests=[];this.nonRecursiveWatchRequestDelayer=this._register(new Aa(this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)))}watch(e,t){return t.recursive||this.options?.watcher?.forceUniversal?this.watchUniversal(e,t):this.watchNonRecursive(e,t)}getRefreshWatchersDelay(e){return e>200?500:0}watchUniversal(e,t){let o=this.toWatchRequest(e,t),n=vg(this.universalWatchRequests,o);return this.refreshUniversalWatchers(),ee(()=>{n(),this.refreshUniversalWatchers()})}toWatchRequest(e,t){let o={path:this.toWatchPath(e),excludes:t.excludes,includes:t.includes,recursive:t.recursive,filter:t.filter,correlationId:t.correlationId};if(VBo(o)){let n=this.options?.watcher?.recursive?.usePolling;n===!0?o.pollingInterval=this.options?.watcher?.recursive?.pollingInterval??5e3:Array.isArray(n)&&n.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=>mt(e))}doRefreshUniversalWatchers(){return this.universalWatcher||(this.universalWatcher=this._register(this.createUniversalWatcher(e=>this._onDidChangeFile.fire(ogt(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,t){let o={path:this.toWatchPath(e),excludes:t.excludes,includes:t.includes,recursive:!1,filter:t.filter,correlationId:t.correlationId},n=vg(this.nonRecursiveWatchRequests,o);return this.refreshNonRecursiveWatchers(),ee(()=>{n(),this.refreshNonRecursiveWatchers()})}refreshNonRecursiveWatchers(){this.nonRecursiveWatchRequestDelayer.trigger(()=>this.doRefreshNonRecursiveWatchers(),this.getRefreshWatchersDelay(this.nonRecursiveWatchRequests.length)).catch(e=>mt(e))}doRefreshNonRecursiveWatchers(){return this.nonRecursiveWatcher||(this.nonRecursiveWatcher=this._register(this.createNonRecursiveWatcher(e=>this._onDidChangeFile.fire(ogt(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 Vh(e.fsPath)}toWatchPath(e){let t=this.toFilePath(e);return o8i(t)}};var mZt=class extends oZt{constructor(e,t,o,n){super(e,t,o);this.utilityProcessWorkerWorkbenchService=n;this.init()}createWatcher(e){return Xd.toService(jH((async()=>{let{client:o,onDidTerminate:n}=e.add(await this.utilityProcessWorkerWorkbenchService.createWorker({moduleId:"vs/platform/files/node/watcher/watcherMain",type:"fileWatcher",name:"file-watcher"}));return n.then(({reason:r})=>{r?.code===0?this.trace(`terminated by itself with code ${r.code}, signal: ${r.signal}`):this.onError(`terminated by itself unexpectedly with code ${r?.code}, signal: ${r?.signal} (ETERM)`)}),o.getChannel("watcher")})()))}};var hZt=class extends pZt{constructor(e,t,o,n){super(o,{watcher:{forceUniversal:!0}});this.utilityProcessWorkerWorkbenchService=t;this.loggerService=n;this._watcherLogService=void 0;this.provider=this._register(new x$e(e.getChannel(BBo),{pathCaseSensitive:Sn,trash:!0})),this.registerListeners()}registerListeners(){this._register(this.provider.onDidChangeFile(e=>this._onDidChangeFile.fire(e))),this._register(this.provider.onDidWatchError(e=>this._onDidWatchError.fire(e)))}get onDidChangeCapabilities(){return this.provider.onDidChangeCapabilities}get capabilities(){return this.provider.capabilities}stat(e){return this.provider.stat(e)}realpath(e){return this.provider.realpath(e)}readdir(e){return this.provider.readdir(e)}readFile(e,t){return this.provider.readFile(e,t)}readFileStream(e,t,o){return this.provider.readFileStream(e,t,o)}writeFile(e,t,o){return this.provider.writeFile(e,t,o)}open(e,t){return this.provider.open(e,t)}close(e){return this.provider.close(e)}read(e,t,o,n,r){return this.provider.read(e,t,o,n,r)}write(e,t,o,n,r){return this.provider.write(e,t,o,n,r)}mkdir(e){return this.provider.mkdir(e)}delete(e,t){return this.provider.delete(e,t)}rename(e,t,o){return this.provider.rename(e,t,o)}copy(e,t,o){return this.provider.copy(e,t,o)}cloneFile(e,t){return this.provider.cloneFile(e,t)}createUniversalWatcher(e,t,o){return new mZt(n=>e(n),n=>t(n),o,this.utilityProcessWorkerWorkbenchService)}createNonRecursiveWatcher(){throw new Error("Method not implemented in sandbox.")}get watcherLogService(){return this._watcherLogService||(this._watcherLogService=new Bae(this.loggerService.createLogger("fileWatcher",{name:d(19078,null)}))),this._watcherLogService}logWatcherMessage(e){this.watcherLogService[e.type](e.message),e.type!=="trace"&&e.type!=="debug"&&super.logWatcherMessage(e)}};var gZt=class extends k{constructor(e,t,o,n,r,s){super();this.fileSystemScheme=e;this.fileSystemProvider=t;this.userDataScheme=o;this.userDataProfilesService=n;this.uriIdentityService=r;this.logService=s;this.capabilities=this.fileSystemProvider.capabilities,this.onDidChangeCapabilities=this.fileSystemProvider.onDidChangeCapabilities,this._onDidChangeFile=this._register(new T),this.onDidChangeFile=this._onDidChangeFile.event,this.watchResources=Hp.forUris(()=>!(this.capabilities&1024)),this.atomicReadWriteResources=new xn(l=>this.uriIdentityService.extUri.getComparisonKey(this.toFileSystemResource(l))),this.updateAtomicReadWritesResources(),this._register(n.onDidChangeProfiles(()=>this.updateAtomicReadWritesResources())),this._register(this.fileSystemProvider.onDidChangeFile(l=>this.handleFileChanges(l)))}updateAtomicReadWritesResources(){this.atomicReadWriteResources.clear();for(let e of this.userDataProfilesService.profiles)this.atomicReadWriteResources.add(e.settingsResource),this.atomicReadWriteResources.add(e.keybindingsResource),this.atomicReadWriteResources.add(e.tasksResource),this.atomicReadWriteResources.add(e.extensionsResource)}open(e,t){return this.fileSystemProvider.open(this.toFileSystemResource(e),t)}close(e){return this.fileSystemProvider.close(e)}read(e,t,o,n,r){return this.fileSystemProvider.read(e,t,o,n,r)}write(e,t,o,n,r){return this.fileSystemProvider.write(e,t,o,n,r)}watch(e,t){this.watchResources.set(e,e);let o=this.fileSystemProvider.watch(this.toFileSystemResource(e),t);return ee(()=>{this.watchResources.delete(e),o.dispose()})}stat(e){return this.fileSystemProvider.stat(this.toFileSystemResource(e))}mkdir(e){return this.fileSystemProvider.mkdir(this.toFileSystemResource(e))}rename(e,t,o){return this.fileSystemProvider.rename(this.toFileSystemResource(e),this.toFileSystemResource(t),o)}readFile(e,t){return this.fileSystemProvider.readFile(this.toFileSystemResource(e),t)}readFileStream(e,t,o){return this.fileSystemProvider.readFileStream(this.toFileSystemResource(e),t,o)}readdir(e){return this.fileSystemProvider.readdir(this.toFileSystemResource(e))}enforceAtomicReadFile(e){return this.atomicReadWriteResources.has(e)}writeFile(e,t,o){return this.fileSystemProvider.writeFile(this.toFileSystemResource(e),t,o)}enforceAtomicWriteFile(e){return this.atomicReadWriteResources.has(e)?{postfix:".vsctmp"}:!1}delete(e,t){return this.fileSystemProvider.delete(this.toFileSystemResource(e),t)}copy(e,t,o){if(Q3e(this.fileSystemProvider))return this.fileSystemProvider.copy(this.toFileSystemResource(e),this.toFileSystemResource(t),o);throw new Error("copy not supported")}cloneFile(e,t){if(Byt(this.fileSystemProvider))return this.fileSystemProvider.cloneFile(this.toFileSystemResource(e),this.toFileSystemResource(t));throw new Error("clone not supported")}handleFileChanges(e){let t=[];for(let o of e){if(o.resource.scheme!==this.fileSystemScheme)continue;let n=this.toUserDataResource(o.resource);this.watchResources.findSubstr(n)&&t.push({resource:n,type:o.type,cId:o.cId})}t.length&&(this.logService.debug("User data changed"),this._onDidChangeFile.fire(t))}toFileSystemResource(e){return e.with({scheme:this.fileSystemScheme})}toUserDataResource(e){return e.with({scheme:this.userDataScheme})}};var fZt=class extends kZ{constructor(e,t){super();this.channel=t;for(let o in e){let{definition:n,value:r}=e[o];this.policyDefinitions[o]=n,r!==void 0&&this.policies.set(o,r)}this.channel.listen("onDidChange")(o=>{for(let n in o){let r=o[n];r===null?this.policies.delete(n):this.policies.set(n,r)}this._onDidChange.fire(Object.keys(o))})}async _updatePolicyDefinitions(e){let t=await this.channel.call("updatePolicyDefinitions",e);for(let o in t)this.policies.set(o,t[o])}};var vZt=class extends k{constructor(e){super();this._onDidChangeCurrentProfile=this._register(new T);this.onDidChangeCurrentProfile=this._onDidChangeCurrentProfile.event;this._currentProfile=e}get currentProfile(){return this._currentProfile}async updateCurrentProfile(e){if(Qi(this._currentProfile,e))return;let t=this._currentProfile;this._currentProfile=e;let o=[];this._onDidChangeCurrentProfile.fire({previous:t,profile:e,join(n){o.push(n)}}),await vn.settled(o)}};var rji=class extends k{constructor(e,t){super();this._onData=this._register(new T);this.onData=this._onData.event;this._onOpen=this._register(new T);this.onOpen=this._onOpen.event;this._onClose=this._register(new T);this.onClose=this._onClose.event;this._onError=this._register(new T);this.onError=this._onError.event;this._debugLabel=t,this._socket=new WebSocket(e),this.traceSocketEvent("created",{type:"BrowserWebSocket",url:e}),this._fileReader=new FileReader,this._queue=[],this._isReading=!1,this._isClosed=!1,this._fileReader.onload=u=>{this._isReading=!1;let p=u.target.result;this.traceSocketEvent("read",p),this._onData.fire(p),this._queue.length>0&&o(this._queue.shift())};let o=u=>{if(this._isReading){this._queue.push(u);return}this._isReading=!0,this._fileReader.readAsArrayBuffer(u)};this._socketMessageListener=u=>{let p=u.data;this.traceSocketEvent("browserWebSocketBlobReceived",{type:p.type,size:p.size}),o(p)},this._socket.addEventListener("message",this._socketMessageListener),this._register($(this._socket,"open",u=>{this.traceSocketEvent("open"),this._onOpen.fire()}));let n=null,r=()=>{let u=n;n=null,this._onError.fire(u)},s=this._register(new Dt(r,0)),l=u=>{s.cancel(),n=u,s.schedule()},c=u=>{s.cancel(),n=u,r()};this._register($(this._socket,"close",u=>{this.traceSocketEvent("close",{code:u.code,reason:u.reason,wasClean:u.wasClean}),this._isClosed=!0,n&&(navigator.onLine?u.wasClean?(s.cancel(),r()):c(new mC(u.reason||`WebSocket close with status code ${u.code}`,"TemporarilyNotAvailable",u)):c(new mC("Browser is offline","TemporarilyNotAvailable",u))),this._onClose.fire({code:u.code,reason:u.reason,wasClean:u.wasClean,event:u})})),this._register($(this._socket,"error",u=>{this.traceSocketEvent("error",{message:u?.message}),l(u)}))}traceSocketEvent(e,t){ERe.traceSocketEvent(this._socket,this._debugLabel,e,t)}send(e){this._isClosed||(this.traceSocketEvent("write",e),this._socket.send(e))}close(){this._isClosed=!0,this.traceSocketEvent("close"),this._socket.close(),this._socket.removeEventListener("message",this._socketMessageListener),this.dispose()}},FMn=new class{create(a,i){return new rji(a,i)}},sji=class{traceSocketEvent(i,e){typeof this.socket.traceSocketEvent=="function"?this.socket.traceSocketEvent(i,e):ERe.traceSocketEvent(this.socket,this.debugLabel,i,e)}constructor(i,e){this.socket=i,this.debugLabel=e}dispose(){this.socket.close()}onData(i){return this.socket.onData(e=>i(Ke.wrap(new Uint8Array(e))))}onClose(i){let e=t=>{i(typeof t>"u"?t:{type:1,code:t.code,reason:t.reason,wasClean:t.wasClean,event:t.event})};return this.socket.onClose(e)}onEnd(i){return k.None}write(i){this.socket.send(i.buffer)}end(){this.socket.close()}drain(){return Promise.resolve()}},bZt=class{constructor(i){this._webSocketFactory=i||FMn}supports(i){return!0}connect({host:i,port:e},t,o,n){return new Promise((r,s)=>{let l=/^https:/.test(ut.location.href)?"wss":"ws",c=this._webSocketFactory.create(`${l}://${/:/.test(i)&&!/\[/.test(i)?`[${i}]`:i}:${e}${t}?${o}&skipWebSocketFrames=false`,n),u=new O;u.add(c.onError(s)),u.add(c.onOpen(()=>{u.dispose(),r(new sji(c,n))}))})}};var HBo="request",UBo="remoteResourceHandler";var E$e=class extends k{constructor(e,t,o){super();this.windowId=e;this.fileService=o;let n={listen(r,s){throw new Error(`Event not found: ${s}`)},call:(r,s,l)=>{if(s===HBo)return this.doRequest(A.revive(l[0]));throw new Error(`Call not found: ${s}`)}};t.registerChannel(UBo,n)}async doRequest(e){let t;try{let n=new URLSearchParams(e.query),r=e.with({scheme:n.get("scheme"),authority:n.get("authority"),query:""});t=await this.fileService.readFile(r)}catch(n){let r=gc(Ke.fromString(n.message));return n instanceof ua&&n.fileOperationResult===1?{statusCode:404,body:r}:{statusCode:500,body:r}}let o=e.path&&S6i(e.path);return{statusCode:200,body:gc(t.value),mimeType:o}}getResourceUriProvider(){return e=>e.with({scheme:Q.vscodeManagedRemoteResource,authority:`window:${this.windowId}`,query:new URLSearchParams({authority:e.authority,scheme:e.scheme}).toString()})}};E$e=I([m(1,rm),m(2,ge)],E$e);var T$e=class extends kZ{constructor(e,t){super();this.policyServices=e;this.logService=t;this.updatePolicies(),this._register(U.any(...this.policyServices.map(o=>o.onDidChange))(o=>{this.updatePolicies(),this._onDidChange.fire(o)}))}async updatePolicyDefinitions(e){return await this._updatePolicyDefinitions(e),yt.reduce(this.policies.entries(),(t,[o,n])=>({...t,[o]:n}),{})}async _updatePolicyDefinitions(e){await Promise.all(this.policyServices.map(t=>t.updatePolicyDefinitions(e))),this.updatePolicies()}updatePolicies(){this.policies.clear();let e=[];for(let o of this.policyServices){let n=o.policyDefinitions;for(let r in n){let s=o.getPolicyValue(r);this.policyDefinitions[r]=n[r],s!==void 0&&(e.push(r),this.policies.set(r,s))}}let t=new Set;for(let o of e)t.has(o)&&this.logService.warn(`MultiplexPolicyService#_updatePolicyDefinitions - Found overlapping keys in policy services: ${o}`),t.add(o)}};T$e=I([m(1,re)],T$e);var aji=class extends k{constructor(e){super();this.configuration=e;this.init()}init(){this.reviveUris(),Gj(!!this.configuration.fullscreen,ut)}reviveUris(){let e=aeo(this.configuration.workspace);(Gy(e)||Pg(e))&&(this.configuration.workspace=e);let t=this.configuration.filesToWait,o=t?.paths;for(let n of[o,this.configuration.filesToOpenOrCreate,this.configuration.filesToDiff,this.configuration.filesToMerge])if(Array.isArray(n))for(let r of n)r.fileUri&&(r.fileUri=A.revive(r.fileUri));t&&(t.waitMarkerFileUri=A.revive(t.waitMarkerFileUri))}async open(){let[e]=await Promise.all([this.initServices(),vQi(ut)]);this.applyWindowZoomLevel(e.configurationService);let t=new HJt(ut.document.body,{extraClasses:this.getExtraClasses(),resetLayout:this.configuration["disable-layout-restore"]===!0},e.serviceCollection,e.logService);this.registerListeners(t,e.storageService);let o=t.startup();this._register(o.createInstance(vj))}applyWindowZoomLevel(e){let t;if(this.configuration.isCustomZoomLevel&&typeof this.configuration.zoomLevel=="number")t=this.configuration.zoomLevel;else{let o=e.getValue();t=typeof o.window?.zoomLevel=="number"?o.window.zoomLevel:0}gj(t,ut)}getExtraClasses(){return et&&Ovt(this.configuration.os.release)?["macos-tahoe"]:[]}registerListeners(e,t){this._register(e.onWillShutdown(o=>o.join(t.close(),{id:"join.closeStorage",label:d(18480,null)}))),this._register(e.onDidShutdown(()=>this.dispose()))}async initServices(){let e=new Po,t=this._register(new dZt(this.configuration.windowId));e.set(rm,t);let o={_serviceBrand:void 0,...$i};e.set(Ze,o);let n=new fg(this.configuration,o);e.set(Jr,n);let r=this.configuration.loggers.map(se=>({...se,resource:A.revive(se.resource)})),s=new xYt(this.configuration.windowId,this.configuration.logLevel,n.windowLogsPath,r,t.getChannel("logger"));e.set(Ol,s);let l=this._register(new uZt(s,n));e.set(re,l),Pf&&l.info("workbench#open()"),l.getLevel()===1&&l.trace("workbench#open(): with configuration",gF({...this.configuration,nls:void 0}));let c=this._register(new QAe(o));e.set(Nd,c);let u,p=this.configuration.policiesData?new fZt(this.configuration.policiesData,t.getChannel("policy")):void 0,h=new $_e(l,c,p);p?u=new T$e([p,h],l):u=h,e.set(q_e,u),e.set(j_e,h);let g=new S$e(this.configuration.windowId,l);e.set(kS,g);let f=new m$e(this.configuration.windowId,l,t);e.set(zJt,f);let v=Xd.toService(t.getChannel("sign"));e.set(Wae,v);let b=this._register(new Vae(l));e.set(ge,b);let S=new I$e(o,new E$e(n.window.id,t,b));e.set(dd,S);let y=this._register(new hZt(t,f,l,s));b.registerProvider(Q.file,y);let w=new nye(b);e.set(gt,w);let x=new yAe(this.configuration.profiles.all,A.revive(this.configuration.profiles.home).with({scheme:n.userRoamingDataHome.scheme}),t.getChannel("userDataProfiles"));e.set(hn,x);let E=new vZt(iC(this.configuration.profiles.profile,x.profilesHome.scheme));e.set(gn,E),b.registerProvider(Q.vscodeUserData,this._register(new gZt(Q.file,y,Q.vscodeUserData,x,w,l)));let M=new kOt;M.register(0,new bZt(null)),e.set(pG,M);let N=this._register(new w$e(M,E,n,o,S,v,l));e.set(bo,N),this._register(nZt.register(N,b,l));let V=this.resolveWorkspaceIdentifier(n),[H,K]=await Promise.all([this.createWorkspaceService(V,n,E,x,b,N,w,l,u).then(se=>(e.set(Ae,se),e.set(Yg,se),se)),this.createStorageService(V,n,E,x,t).then(se=>(e.set(de,se),se)),this.createKeyboardLayoutService(t).then(se=>(e.set(aZt,se),se))]),j=new xDe(H,n);e.set(yM,j);let J=new kDe(H,S,K,w,n,H,j,b);return e.set(Or,J),H.updateWorkspaceTrust(J.isWorkspaceTrusted()),this._register(J.onDidChangeTrust(()=>H.updateWorkspaceTrust(J.isWorkspaceTrusted()))),{serviceCollection:e,logService:l,storageService:K,configurationService:H}}resolveWorkspaceIdentifier(e){return this.configuration.workspace?this.configuration.workspace:pf(this.configuration.backupPath,e.isExtensionDevelopment)}async createWorkspaceService(e,t,o,n,r,s,l,c,u){let p=new rZt([Q.file,Q.vscodeUserData],t,r),h=new eZt({remoteAuthority:t.remoteAuthority,configurationCache:p},t,o,n,r,s,l,c,u);try{return await h.initialize(e),h}catch(g){return mt(g),h}}async createStorageService(e,t,o,n,r){let s=new iZt(e,o,n,r,t);try{return await s.initialize(),s}catch(l){return mt(l),s}}async createKeyboardLayoutService(e){let t=new k$e(e);try{return await t.initialize(),t}catch(o){return mt(o),t}}};function WMn(a){return new aji(a).open()}var SZt=class extends z{constructor(){super({id:"workbench.action.toggleDevTools",title:P(18375,"Toggle Developer Tools"),category:Fe.Developer,f1:!0,keybinding:{weight:250,when:_4,primary:3111,mac:{primary:2599}},menu:{id:R.MenubarHelpMenu,group:"5_tools",order:1}})}async run(i){return i.get(wo).toggleDevTools({targetWindowId:zi().vscodeWindowId})}},IZt=class extends z{constructor(){super({id:"workbench.action.configureRuntimeArguments",title:P(18360,"Configure Runtime Arguments"),category:Fe.Preferences,f1:!0})}async run(i){let e=i.get(ie),t=i.get(Mt);await e.openEditor({resource:t.argvResource,options:{pinned:!0}})}},yZt=class extends z{constructor(){super({id:"workbench.action.reloadWindowWithExtensionsDisabled",title:P(18361,"Reload with Extensions Disabled"),category:Fe.Developer,f1:!0})}async run(i){return i.get(wo).reload({disableExtensions:!0})}},wZt=class extends z{constructor(){super({id:"workbench.action.revealUserDataFolder",title:P(18362,"Reveal User Data Folder"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(wo),t=i.get(Jr);return e.showItemInFolder(A.file(t.userDataPath).fsPath)}},CZt=class extends z{constructor(){super({id:"workbench.action.showGPUInfo",title:P(18364,"Show GPU Info"),category:Fe.Developer,f1:!0})}run(i){i.get(wo).openGPUInfoWindow()}},xZt=class extends z{constructor(){super({id:"workbench.action.showContentTracing",title:P(18363,"Show Content Tracing"),category:Fe.Developer,f1:!0})}run(i){i.get(wo).openContentTracingWindow()}},ngt,kZt=class extends z{constructor(){super({id:"workbench.action.startTracing",title:P(18365,"Start Tracing"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(wo),t=i.get(Fr),o=["content","renderer_host","browser","renderer","blink","blink.user_timing","netlog","net","v8","disabled-by-default-v8.cpu_profiler","disabled-by-default-devtools.timeline","disabled-by-default-network","disabled-by-default-net","disabled-by-default-v8.gc_stats","disabled-by-default-v8.stack_trace"];await e.startTracing(o.join(",")),ngt?.dispose(),ngt=t.addEntry({name:d(18367,null),text:"$(record) "+d(18368,null),ariaLabel:d(18366,null),tooltip:d(18369,null),kind:"error",command:rgt.ID},"status.tracing",0,-Number.MAX_VALUE)}},rgt=class a extends z{static{this.ID="workbench.action.stopTracing"}constructor(){super({id:a.ID,title:P(18370,"Stop Tracing"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(wo),t=i.get(Jr),o=i.get(ct),n=i.get(Go);if(!ngt&&!t.args.trace){let{confirmed:r}=await o.confirm({message:d(18373,null),primaryButton:d(18371,null)});return r?e.relaunch({addArgs:["--trace"]}):void 0}await n.withProgress({location:20,title:d(18374,null),cancellable:!1,detail:d(18372,null)},()=>e.stopTracing()),ngt?.dispose(),ngt=void 0}};var sgt=class a extends z{static{this.ID="workbench.action.closeWindow"}constructor(){super({id:a.ID,title:{...P(18384,"Close Window"),mnemonicTitle:d(18388,null)},f1:!0,keybinding:{weight:200,mac:{primary:3125},linux:{primary:574,secondary:[3125]},win:{primary:574,secondary:[3125]}},menu:{id:R.MenubarFileMenu,group:"6_close",order:4}})}async run(i){return i.get(wo).closeWindow({targetWindowId:zi().vscodeWindowId})}},EZt=class a extends z{static{this.ID="workbench.action.closeOtherWindows"}constructor(){super({id:a.ID,title:P(18383,"Close Other Windows"),f1:!0})}async run(i){let e=i.get(wo),t=zi().vscodeWindowId,o=await e.getWindows({includeAuxiliaryWindows:!1});for(let n of o)n.id!==t&&e.closeWindow({targetWindowId:n.id})}},agt=class a extends z{static{this.ZOOM_LEVEL_SETTING_KEY="window.zoomLevel"}static{this.ZOOM_PER_WINDOW_SETTING_KEY="window.zoomPerWindow"}async setZoomLevel(i,e){let t=i.get(B),o;t.getValue(a.ZOOM_PER_WINDOW_SETTING_KEY)!==!1?o=1:o=2;let n;if(typeof e=="number")n=Math.round(e);else if(o===2)n=0;else{let r=t.getValue(a.ZOOM_LEVEL_SETTING_KEY);typeof r=="number"?n=r:n=0}n>Kht||n<Ght||(o===2&&await t.updateValue(a.ZOOM_LEVEL_SETTING_KEY,n),gj(n,o))}},TZt=class extends agt{constructor(){super({id:"workbench.action.zoomIn",title:{...P(18399,"Zoom In"),mnemonicTitle:d(18389,null)},category:Fe.View,f1:!0,keybinding:{weight:200,primary:2134,secondary:[3158,2157]},menu:{id:R.MenubarAppearanceMenu,group:"5_zoom",order:1}})}run(i){return super.setZoomLevel(i,nx(zi())+1)}},_Zt=class extends agt{constructor(){super({id:"workbench.action.zoomOut",title:{...P(18400,"Zoom Out"),mnemonicTitle:d(18390,null)},category:Fe.View,f1:!0,keybinding:{weight:200,primary:2136,secondary:[3160,2159],linux:{primary:2136,secondary:[2159]}},menu:{id:R.MenubarAppearanceMenu,group:"5_zoom",order:2}})}run(i){return super.setZoomLevel(i,nx(zi())-1)}},DZt=class extends agt{constructor(){super({id:"workbench.action.zoomReset",title:{...P(18401,"Reset Zoom"),mnemonicTitle:d(18391,null)},category:Fe.View,f1:!0,keybinding:{weight:200,primary:2146},menu:{id:R.MenubarAppearanceMenu,group:"5_zoom",order:3}})}run(i){return super.setZoomLevel(i,!0)}},RZt=class extends z{constructor(){super(...arguments);this.closeWindowAction={iconClass:q.asClassName(L.removeClose),tooltip:d(18381,null)};this.closeDirtyWindowAction={iconClass:"dirty-window "+q.asClassName(L.closeDirty),tooltip:d(18381,null),alwaysVisible:!0};this.closeActiveWindowAction={iconClass:"active-window "+q.asClassName(L.windowActive),tooltip:d(18382,null),alwaysVisible:!0}}async run(e){let t=e.get($e),o=e.get(Le),n=e.get(_t),r=e.get(Rt),s=e.get(wo),l=zi().vscodeWindowId,c=await s.getWindows({includeAuxiliaryWindows:!0}),u=new Set,p=new Map;for(let v of c)if(veo(v)){let b=p.get(v.parentId);b||(b=new Set,p.set(v.parentId,b)),b.add(v)}else u.add(v);function h(v){return typeof v?.windowId=="number"}let g=[];for(let v of u){let b=p.get(v.id);p.size>0&&g.push({type:"separator",label:b?d(18398,null):void 0});let S=v.filename?A.file(v.filename):Pg(v.workspace)?v.workspace.uri:Gy(v.workspace)?v.workspace.configPath:void 0,y=v.filename?0:Pg(v.workspace)?1:Gy(v.workspace)?2:0,w={windowId:v.id,label:v.title,ariaLabel:v.dirty?d(18397,null,v.title):v.title,iconClasses:Ia(n,r,S,y),description:l===v.id?d(18385,null):void 0,buttons:v.dirty?[this.closeDirtyWindowAction]:l===v.id?[this.closeActiveWindowAction]:[this.closeWindowAction]};if(g.push(w),b)for(let x of b){let E={windowId:x.id,label:x.title,iconClasses:Ia(n,r,x.filename?A.file(x.filename):void 0,0),description:l===x.id?d(18385,null):void 0,buttons:l===x.id?[this.closeActiveWindowAction]:[this.closeWindowAction]};g.push(E)}}let f=await t.pick(g,{contextKey:"inWindowsPicker",activeItem:(()=>{for(let v=0;v<g.length;v++){let b=g[v];if(h(b)&&b.windowId===l){let S=g[v+1];if(h(S)||(S=g[v+2],h(S)))return S}}})(),placeHolder:d(18395,null),quickNavigate:this.isQuickNavigate()?{keybindings:o.lookupKeybindings(this.desc.id)}:void 0,hideInput:this.isQuickNavigate(),onDidTriggerItemButton:async v=>{await s.closeWindow({targetWindowId:v.item.windowId}),v.removeItem()}});f&&s.focusWindow({targetWindowId:f.windowId})}},LZt=class extends RZt{constructor(){super({id:"workbench.action.switchWindow",title:P(18394,"Switch Window..."),f1:!0,keybinding:{weight:200,primary:0,mac:{primary:309}}})}isQuickNavigate(){return!1}},MZt=class extends RZt{constructor(){super({id:"workbench.action.quickSwitchWindow",title:P(18392,"Quick Switch Window..."),f1:!1})}isQuickNavigate(){return!0}},PZt=class extends z{constructor(){super({id:"workbench.action.switchToMainWindow",title:P(18393,"Switch to Main Window"),f1:!0,precondition:Qf})}async run(i){return i.get(wo).focusWindow({targetWindowId:ut.vscodeWindowId})}};function _$e(a){return et?a.get(B).getValue("window.nativeTabs")===!0:!1}var zBo=function(a){if(_$e(a))return a.get(wo).newWindowTab()},KBo=function(a){if(_$e(a))return a.get(wo).showPreviousWindowTab()},GBo=function(a){if(_$e(a))return a.get(wo).showNextWindowTab()},qBo=function(a){if(_$e(a))return a.get(wo).moveWindowTabToNewWindow()},$Bo=function(a){if(_$e(a))return a.get(wo).mergeAllWindowTabs()},jBo=function(a){if(_$e(a))return a.get(wo).toggleWindowTabsBar()},AZt=class a extends z{static{this.ID="workbench.action.toggleWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:P(18396,"Toggle Window Always on Top"),f1:!0,precondition:ew})}async run(i){let e=i.get(wo),t=zi();if(fI(t.window))return e.toggleWindowAlwaysOnTop({targetWindowId:zi().vscodeWindowId})}},NZt=class a extends z{static{this.ID="workbench.action.enableWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:d(18387,null),icon:L.pin,menu:{id:R.LayoutControlMenu,when:C.and(SYe.toNegated(),Qf),order:1}})}async run(i){let e=i.get(wo),t=zi();if(fI(t.window))return e.setWindowAlwaysOnTop(!0,{targetWindowId:t.vscodeWindowId})}},OZt=class a extends z{static{this.ID="workbench.action.disableWindowAlwaysOnTop"}constructor(){super({id:a.ID,title:d(18386,null),icon:L.pinned,menu:{id:R.LayoutControlMenu,when:C.and(SYe,Qf),order:1}})}async run(i){let e=i.get(wo),t=zi();if(fI(t.window))return e.setWindowAlwaysOnTop(!1,{targetWindowId:t.vscodeWindowId})}};var QBo=P(18377,"Shell Command"),FZt=class extends z{constructor(){super({id:"workbench.action.installCommandLine",title:P(18376,"Install '{0}' command in PATH",$i.applicationName),category:QBo,f1:!0})}async run(i){let e=i.get(wo),t=i.get(ct),o=i.get(Ze);try{await e.installShellCommand(),t.info(d(18379,null,o.applicationName))}catch(n){if(Yi(n))return;t.error(Mn(n))}}},WZt=class extends z{constructor(){super({id:"workbench.action.uninstallCommandLine",title:P(18380,"Uninstall '{0}' command from PATH",$i.applicationName),category:QBo,f1:!0})}async run(i){let e=i.get(wo),t=i.get(ct),o=i.get(Ze);try{await e.uninstallShellCommand(),t.info(d(18378,null,o.applicationName))}catch(n){if(Yi(n))return;t.error(Mn(n))}}};(function(){if(W(TZt),W(_Zt),W(DZt),W(LZt),W(MZt),W(PZt),W(sgt),W(EZt),W(AZt),W(NZt),W(OZt),et&&xt.registerKeybindingRule({id:sgt.ID,weight:200,when:C.and(ZMt.toNegated(),jso),primary:2101}),et&&(W(FZt),W(WZt)),xt.registerCommandAndKeybindingRule({id:"workbench.action.quit",weight:200,async handler(i){let e=i.get(wo),o=i.get(B).getValue("window.confirmBeforeClose");(o==="always"||o==="keyboardOnly"&&Ab.getInstance().isModifierPressed)&&!await vj.confirmOnShutdown(i,2)||e.quit()},when:void 0,mac:{primary:2095},linux:{primary:2095}}),et)for(let i of[{handler:zBo,id:"workbench.action.newWindowTab",title:P(18428,"New Window Tab")},{handler:KBo,id:"workbench.action.showPreviousWindowTab",title:P(18436,"Show Previous Window Tab")},{handler:GBo,id:"workbench.action.showNextWindowTab",title:P(18435,"Show Next Window Tab")},{handler:qBo,id:"workbench.action.moveWindowTabToNewWindow",title:P(18427,"Move Window Tab to New Window")},{handler:$Bo,id:"workbench.action.mergeAllWindowTabs",title:P(18425,"Merge All Windows")},{handler:jBo,id:"workbench.action.toggleWindowTabsBar",title:P(18440,"Toggle Window Tabs Bar")}])Ge.registerCommand(i.id,i.handler),be.appendMenuItem(R.CommandPalette,{command:i,when:C.equals("config.window.nativeTabs",!0)});W(yZt),W(IZt),W(SZt),W(wZt),W(CZt),W(xZt),W(rgt),W(kZt)})();(function(){be.appendMenuItem(R.MenubarFileMenu,{group:"z_Exit",command:{id:"workbench.action.quit",title:d(18426,null)},order:1,when:fTt.toNegated()})})();(function(){let i=oe.as($t.Configuration);i.registerConfiguration({...uNt,properties:{"application.shellEnvironmentResolutionTimeout":{type:"number",default:10,minimum:1,maximum:120,included:!ii,scope:1,markdownDescription:d(18402,null)}}}),i.registerConfiguration({id:"window",order:8,title:d(18477,null),type:"object",properties:{"window.confirmSaveUntitledWorkspace":{type:"boolean",default:!0,description:d(18420,null)},"window.openWithoutArgumentsInNewWindow":{type:"string",enum:["on","off"],enumDescriptions:[d(18471,null),d(18470,null)],default:et?"off":"on",scope:1,markdownDescription:d(18430,null)},"window.restoreWindows":{type:"string",enum:["preserve","all","folders","one","none"],enumDescriptions:[d(18476,null),d(18472,null),d(18473,null),d(18475,null),d(18474,null)],default:"all",scope:1,description:d(18432,null)},"window.restoreFullscreen":{type:"boolean",default:!1,scope:1,description:d(18431,null)},"window.zoomLevel":{type:"number",default:0,minimum:Ght,maximum:Kht,markdownDescription:d(18478,null,"`#window.zoomPerWindow#`"),ignoreSync:!0,tags:["accessibility"]},"window.zoomPerWindow":{type:"boolean",default:!0,markdownDescription:d(18479,null,"`#window.zoomLevel#`"),tags:["accessibility"]},"window.newWindowDimensions":{type:"string",enum:["default","inherit","offset","maximized","fullscreen"],enumDescriptions:[d(18465,null),d(18467,null),d(18469,null),d(18468,null),d(18466,null)],default:"default",scope:1,description:d(18429,null)},"window.closeWhenEmpty":{type:"boolean",default:!1,description:d(18419,null)},"window.doubleClickIconToClose":{type:"boolean",default:!1,scope:1,markdownDescription:d(18454,null,"`#window.titleBarStyle#`")},"window.titleBarStyle":{type:"string",enum:["native","custom"],default:"custom",scope:1,description:d(18439,null)},"window.controlsStyle":{type:"string",enum:["native","custom","hidden"],default:"native",included:!et,scope:1,description:d(18421,null)},"window.customTitleBarVisibility":{type:"string",enum:["auto","windowed","never"],markdownEnumDescriptions:[d(18451,null),d(18453,null),d(18452,null,"`#window.titleBarStyle#`")],default:"auto",scope:1,markdownDescription:d(18450,null,"`#window.titleBarStyle#`")},"window.menuStyle":{type:"string",enum:["custom","native","inherit"],markdownEnumDescriptions:et?[d(18457,null),d(18462,null),d(18459,null,"`#window.titleBarStyle#`")]:[d(18456,null),d(18461,null,"`#window.titleBarStyle#`","`custom`"),d(18458,null,"`#window.titleBarStyle#`")],default:$i.quality!=="stable"?"inherit":et?"native":"inherit",scope:1,markdownDescription:et?d(18460,null,"`#window.titleBarStyle#`"):d(18455,null,"`#window.titleBarStyle#`"),agentsWindow:{default:"custom"}},"window.dialogStyle":{type:"string",enum:["native","custom"],default:"native",scope:1,description:d(18422,null),agentsWindow:{default:"custom"}},"window.nativeTabs":{type:"boolean",default:!1,scope:1,description:d(18464,null),included:et},"window.nativeFullScreen":{type:"boolean",default:!0,description:d(18463,null),scope:1,included:et},"window.clickThroughInactive":{type:"boolean",default:!0,scope:1,description:d(18449,null),included:et},"window.border":{type:"string",default:"default",markdownDescription:(()=>{let e=d(18446,null);return e+=`
- `+[d(18444,null,"`default`"),d(18448,null,"`system`"),d(18445,null,"`off`"),d(18443,null,"`<color>`")].join(`
- `),e+=`

`+d(18447,null,"`#workbench.colorCustomizations#`","`#window.titleBarStyle#`","`native`"),e})(),included:ii}}}),i.registerConfiguration({id:"telemetry",order:110,title:d(18438,null),type:"object",properties:{"telemetry.enableCrashReporter":{type:"boolean",description:d(18437,null),default:!0,tags:["usesOnlineServices","telemetry"],markdownDeprecationMessage:d(18423,null,`\`#${dT}#\``)}}}),i.registerConfiguration({id:"keyboard",order:15,type:"object",title:d(18424,null),properties:{"keyboard.touchbar.enabled":{type:"boolean",default:!0,description:d(18441,null),included:et},"keyboard.touchbar.ignored":{type:"array",items:{type:"string"},default:[],markdownDescription:d(18442,null),included:et}}}),i.registerConfiguration({...tJe,properties:{"security.promptForLocalFileProtocolHandling":{type:"boolean",default:!0,markdownDescription:d(18433,null),scope:1},"security.promptForRemoteFileProtocolHandling":{type:"boolean",default:!0,markdownDescription:d(18434,null),scope:1}}})})();(function(){let i="vscode://schemas/argv",e=oe.as(Ta.JSONContribution),t={id:i,allowComments:!0,allowTrailingCommas:!0,description:"VSCode static command line definition file",type:"object",additionalProperties:!1,properties:{locale:{type:"string",description:d(18413,null)},"disable-lcd-text":{type:"boolean",description:d(18406,null)},"proxy-bypass-list":{type:"string",description:d(18416,null)},"disable-hardware-acceleration":{type:"boolean",description:d(18405,null)},"force-color-profile":{type:"string",markdownDescription:d(18411,null)},"enable-crash-reporter":{type:"boolean",markdownDescription:d(18407,null)},"crash-reporter-id":{type:"string",markdownDescription:d(18403,null)},"enable-proposed-api":{type:"array",description:d(18409,null),items:{type:"string"}},"log-level":{type:["string","array"],description:d(18414,null)},"disable-chromium-sandbox":{type:"boolean",description:d(18404,null)},"use-inmemory-secretstorage":{type:"boolean",description:d(18418,null)},"remote-debugging-port":{type:"string",description:d(18417,null)},"js-flags":{type:"string",description:d(18412,null)}}};Sn&&(t.properties["force-renderer-accessibility"]={type:"boolean",description:d(18410,null)},t.properties["password-store"]={type:"string",description:d(18415,null)}),ii&&(t.properties["enable-rdp-display-tracking"]={type:"boolean",description:d(18408,null)}),e.registerSchema(i,t)})();var Hae=class extends sxe{constructor(e,t,o,n,r,s,l,c){super();this.logService=e;this.layoutService=t;this.keybindingService=o;this.clipboardService=r;this.openerService=s;this.markdownRendererService=l;this.hostService=c}static{this.ALLOWABLE_COMMANDS=new Set(["copy","cut","editor.action.selectAll","editor.action.clipboardCopyAction","editor.action.clipboardCutAction","editor.action.clipboardPasteAction"])}async prompt(e){this.logService.trace("DialogService#prompt",e.message);let t=this.getPromptButtons(e),{button:o,checkboxChecked:n}=await this.doShow(e.type,e.message,t,e.detail,e.cancelButton?t.length-1:-1,e.checkbox,void 0,typeof e?.custom=="object"?e.custom:void 0,e.token);return this.getPromptResult(e,o,n)}async confirm(e){this.logService.trace("DialogService#confirm",e.message);let t=this.getConfirmationButtons(e),{button:o,checkboxChecked:n}=await this.doShow(e.type??"question",e.message,t,e.detail,t.length-1,e.checkbox,void 0,typeof e?.custom=="object"?e.custom:void 0,e.token);return{confirmed:o===0,checkboxChecked:n}}async input(e){this.logService.trace("DialogService#input",e.message);let t=this.getInputButtons(e),{button:o,checkboxChecked:n,values:r}=await this.doShow(e.type??"question",e.message,t,e.detail,t.length-1,e?.checkbox,e.inputs,typeof e.custom=="object"?e.custom:void 0,e.token);return{confirmed:o===0,checkboxChecked:n,values:r}}async about(e,t,o){let{button:n}=await this.doShow(wt.Info,e,[d(4475,null),d(4476,null)],t,1);n===0&&this.clipboardService.writeText(o)}async doShow(e,t,o,n,r,s,l,c,u){let p=new O,h=c?v=>{v.classList.add(...c.classes||[]),c.markdownDetails?.forEach(b=>{let S=p.add(this.markdownRendererService.render(b.markdown,{actionHandler:b.actionHandler||((y,w)=>WT(this.openerService,y,w.isTrusted,!0))}));v.appendChild(S.element),S.element.classList.add(...b.classes||[])})}:void 0,g=new jte(this.layoutService.activeContainer,t,o,GPe({detail:n,cancelId:r,type:this.getDialogType(e),renderBody:h,icon:c?.icon,disableCloseAction:c?.disableCloseAction,buttonOptions:c?.buttonDetails?.map(v=>({sublabel:v})),checkboxLabel:s?.label,checkboxChecked:s?.checked,inputs:l},this.keybindingService,this.layoutService,this.hostService,Hae.ALLOWABLE_COMMANDS));p.add(g),u&&p.add(u.onCancellationRequested(()=>p.dispose()));let f=await g.show();return p.dispose(),f}};Hae=I([m(0,re),m(1,Kl),m(2,Le),m(3,F),m(4,Bi),m(5,Je),m(6,_n),m(7,ti)],Hae);var D$e=class extends sxe{constructor(e,t,o){super();this.logService=e;this.nativeHostService=t;this.clipboardService=o}async prompt(e){this.logService.trace("DialogService#prompt",e.message);let t=this.getPromptButtons(e),{response:o,checkboxChecked:n}=await this.nativeHostService.showMessageBox({type:this.getDialogType(e.type),title:e.title,message:e.message,detail:e.detail,buttons:t,cancelId:e.cancelButton?t.length-1:-1,checkboxLabel:e.checkbox?.label,checkboxChecked:e.checkbox?.checked,targetWindowId:zi().vscodeWindowId});return this.getPromptResult(e,o,n)}async confirm(e){this.logService.trace("DialogService#confirm",e.message);let t=this.getConfirmationButtons(e),{response:o,checkboxChecked:n}=await this.nativeHostService.showMessageBox({type:this.getDialogType(e.type)??"question",title:e.title,message:e.message,detail:e.detail,buttons:t,cancelId:t.length-1,checkboxLabel:e.checkbox?.label,checkboxChecked:e.checkbox?.checked,targetWindowId:zi().vscodeWindowId});return{confirmed:o===0,checkboxChecked:n}}input(){throw new Error("Unsupported")}async about(e,t,o){let{response:n}=await this.nativeHostService.showMessageBox({type:"info",message:e,detail:`
${t}`,buttons:[d(18481,null),d(18482,null)],targetWindowId:zi().vscodeWindowId});n===0&&this.clipboardService.writeText(o)}};D$e=I([m(0,re),m(1,wo),m(2,Bi)],D$e);function YBo(a,i){let e=a.version;a.target?e=`${e} (${a.target} setup)`:a.darwinUniversalAssetId&&(e=`${e} (Universal)`);let t=r=>d(2132,null,e,a.commit||"Unknown",a.date?`${a.date}${r?" ("+ea(new Date(a.date),!0)+")":""}`:"Unknown",JE.versions.electron,JE.versions["microsoft-build"],JE.versions.chrome,JE.versions.node,JE.versions.v8,`${i.type} ${i.arch} ${i.release}${Uye?" snap":""}`),o=t(!0),n=t(!1);return{title:a.nameLong,details:o,detailsToCopy:n}}var R$e=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.configurationService=e;this.dialogService=t;this.productService=r;this.nativeHostService=l;this.environmentService=c;this.browserImpl=new uo(()=>n.createInstance(Hae)),this.nativeImpl=new uo(()=>new D$e(o,l,s)),this.model=this.dialogService.model,this._register(this.model.onWillShowDialog(()=>{this.currentDialog||this.processDialogs()})),this.processDialogs()}static{this.ID="workbench.contrib.dialogHandler"}async processDialogs(){for(;this.model.dialogs.length;){this.currentDialog=this.model.dialogs[0];let e;try{if(this.currentDialog.args.confirmArgs){let t=this.currentDialog.args.confirmArgs;e=this.useCustomDialog||t?.confirmation.custom?await this.browserImpl.value.confirm(t.confirmation):await this.nativeImpl.value.confirm(t.confirmation)}else if(this.currentDialog.args.inputArgs){let t=this.currentDialog.args.inputArgs;e=await this.browserImpl.value.input(t.input)}else if(this.currentDialog.args.promptArgs){let t=this.currentDialog.args.promptArgs;e=this.useCustomDialog||t?.prompt.custom?await this.browserImpl.value.prompt(t.prompt):await this.nativeImpl.value.prompt(t.prompt)}else{let t=YBo(this.productService,await this.nativeHostService.getOSProperties());this.useCustomDialog?await this.browserImpl.value.about(t.title,t.details,t.detailsToCopy):await this.nativeImpl.value.about(t.title,t.details,t.detailsToCopy)}}catch(t){e=t}this.currentDialog.close(e),this.currentDialog=void 0}}get useCustomDialog(){return this.configurationService.getValue("window.dialogStyle")==="custom"||!!this.environmentService.enableSmokeTestDriver}};R$e=I([m(0,B),m(1,ct),m(2,re),m(3,F),m(4,Ze),m(5,Bi),m(6,wo),m(7,Mt)],R$e);bt(R$e.ID,R$e,vt.BlockStartup);var L$e=class extends k{constructor(e,t){super();this.logService=e;this.progressService=t;this.saveParticipants=new ra}addSaveParticipant(e){let t=this.saveParticipants.push(e);return ee(()=>t())}async participate(e,t,o,n){let r=new qe(n);e.textEditorModel?.pushStackElement(),o.report({message:d(19288,null)});let s=!1;if(await this.progressService.withProgress({priority:3,location:15,cancellable:d(19289,null),delay:e.isDirty()?5e3:3e3},async l=>{let c=Array.from(this.saveParticipants).sort((u,p)=>{let h=u.ordinal??0,g=p.ordinal??0;return h-g});for(let u of c){if(r.token.isCancellationRequested||!e.textEditorModel)break;try{let p=u.participate(e,t,l,r.token);await Ea(p,r.token)}catch(p){Yi(p)?r.token.isCancellationRequested||(r.cancel(),s=!0):this.logService.error(p)}}},()=>{r.cancel()}),e.textEditorModel?.pushStackElement(),r.dispose(),s)throw new qi}dispose(){this.saveParticipants.clear(),super.dispose()}};L$e=I([m(0,re),m(1,Go)],L$e);var M$e=class extends k{constructor(e,t,o,n,r){super();this.instantiationService=e;this.fileService=t;this.notificationService=o;this.workingCopyFileService=n;this.uriIdentityService=r;this._onDidCreate=this._register(new T({leakWarningThreshold:500,leakWarningName:"TextFileEditorModelManager._onDidCreate"}));this.onDidCreate=this._onDidCreate.event;this._onDidResolve=this._register(new T);this.onDidResolve=this._onDidResolve.event;this._onDidRemove=this._register(new T);this.onDidRemove=this._onDidRemove.event;this._onDidChangeDirty=this._register(new T);this.onDidChangeDirty=this._onDidChangeDirty.event;this._onDidChangeReadonly=this._register(new T);this.onDidChangeReadonly=this._onDidChangeReadonly.event;this._onDidChangeOrphaned=this._register(new T);this.onDidChangeOrphaned=this._onDidChangeOrphaned.event;this._onDidSaveError=this._register(new T);this.onDidSaveError=this._onDidSaveError.event;this._onDidSave=this._register(new T);this.onDidSave=this._onDidSave.event;this._onDidRevert=this._register(new T);this.onDidRevert=this._onDidRevert.event;this._onDidChangeEncoding=this._register(new T);this.onDidChangeEncoding=this._onDidChangeEncoding.event;this.mapResourceToModel=new dt;this.mapResourceToModelListeners=new dt;this.mapResourceToDisposeListener=new dt;this.mapResourceToPendingModelResolvers=new dt;this.modelResolveQueue=this._register(new Tz);this.saveErrorHandler=(()=>{let e=this.notificationService;return{onSaveError(t,o){e.error(d(19287,null,o.name,Mn(t,!1)))}}})();this.mapCorrelationIdToModelsToRestore=new Map;this.saveParticipants=this._register(this.instantiationService.createInstance(L$e)),this.registerListeners()}get models(){return[...this.mapResourceToModel.values()]}registerListeners(){this._register(this.fileService.onDidFilesChange(e=>this.onDidFilesChange(e))),this._register(this.fileService.onDidChangeFileSystemProviderCapabilities(e=>this.onDidChangeFileSystemProviderCapabilities(e))),this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(e=>this.onDidChangeFileSystemProviderRegistrations(e))),this._register(this.workingCopyFileService.onWillRunWorkingCopyFileOperation(e=>this.onWillRunWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidFailWorkingCopyFileOperation(e=>this.onDidFailWorkingCopyFileOperation(e))),this._register(this.workingCopyFileService.onDidRunWorkingCopyFileOperation(e=>this.onDidRunWorkingCopyFileOperation(e)))}onDidFilesChange(e){for(let t of this.models)t.isDirty()||e.contains(t.resource,0,1)&&this.queueModelReload(t)}onDidChangeFileSystemProviderCapabilities(e){this.queueModelReloads(e.scheme)}onDidChangeFileSystemProviderRegistrations(e){e.added&&this.queueModelReloads(e.scheme)}queueModelReloads(e){for(let t of this.models)t.isDirty()||e===t.resource.scheme&&this.queueModelReload(t)}queueModelReload(e){this.modelResolveQueue.queueSize(e.resource)<=1&&this.modelResolveQueue.queueFor(e.resource,async()=>{try{await this.reload(e)}catch(o){mt(o)}})}onWillRunWorkingCopyFileOperation(e){if(e.operation===2||e.operation===3){let t=[];for(let{source:o,target:n}of e.files)if(o){if(this.uriIdentityService.extUri.isEqual(o,n))continue;let r=[];for(let s of this.models)this.uriIdentityService.extUri.isEqualOrParent(s.resource,o)&&r.push(s);for(let s of r){let l=s.resource,c;this.uriIdentityService.extUri.isEqual(l,o)?c=n:c=Ve(n,l.path.substr(o.path.length+1));let u=s.getLanguageId();t.push({source:l,target:c,language:u?{id:u,explicit:s.languageChangeSource==="user"}:void 0,encoding:s.getEncoding(),snapshot:s.isDirty()?s.createSnapshot():void 0})}}this.mapCorrelationIdToModelsToRestore.set(e.correlationId,t)}}onDidFailWorkingCopyFileOperation(e){if(e.operation===2||e.operation===3){let t=this.mapCorrelationIdToModelsToRestore.get(e.correlationId);t&&(this.mapCorrelationIdToModelsToRestore.delete(e.correlationId),t.forEach(o=>{o.snapshot&&this.get(o.source)?.setDirty(!0)}))}}onDidRunWorkingCopyFileOperation(e){switch(e.operation){case 0:e.waitUntil((async()=>{for(let{target:t}of e.files){let o=this.get(t);o&&!o.isDisposed()&&await o.revert()}})());break;case 2:case 3:e.waitUntil((async()=>{let t=this.mapCorrelationIdToModelsToRestore.get(e.correlationId);t&&(this.mapCorrelationIdToModelsToRestore.delete(e.correlationId),await vn.settled(t.map(async o=>{let n=this.uriIdentityService.asCanonicalUri(o.target),r=await this.resolve(n,{reload:{async:!1},contents:o.snapshot?Uk(o.snapshot):void 0,encoding:o.encoding});o.language?.id&&o.language.id!==es&&(o.language.explicit?r.setLanguageId(o.language.id):r.getLanguageId()===es&&Ts(n)!==o3e&&r.updateTextEditorModel(void 0,o.language.id))})))})());break}}get(e){return this.mapResourceToModel.get(e)}has(e){return this.mapResourceToModel.has(e)}async reload(e){await this.joinPendingResolves(e.resource),!(e.isDirty()||e.isDisposed()||!this.has(e.resource))&&await this.doResolve(e,{reload:{async:!1}})}async resolve(e,t){let o=this.joinPendingResolves(e);return o&&await o,this.doResolve(e,t)}async doResolve(e,t){let o,n;A.isUri(e)?(n=e,o=this.get(n)):(n=e.resource,o=e);let r,s=!1;if(o)t?.contents?r=o.resolve(t):t?.reload?t.reload.async?(r=Promise.resolve(),(async()=>{try{await o.resolve(t)}catch(l){o.isDisposed()||mt(l)}})()):r=o.resolve(t):r=Promise.resolve();else{s=!0;let l=o=this.instantiationService.createInstance(MW,n,t?t.encoding:void 0,t?t.languageId:void 0);r=o.resolve(t),this.registerModel(l)}this.mapResourceToPendingModelResolvers.set(n,r),this.add(n,o),s&&(this._onDidCreate.fire(o),o.isDirty()&&this._onDidChangeDirty.fire(o));try{await r}catch(l){throw s&&o.dispose(),l}finally{this.mapResourceToPendingModelResolvers.delete(n)}return t?.languageId&&o.setLanguageId(t.languageId),s&&o.isDirty()&&this._onDidChangeDirty.fire(o),o}joinPendingResolves(e){if(this.mapResourceToPendingModelResolvers.get(e))return this.doJoinPendingResolves(e)}async doJoinPendingResolves(e){let t;for(;this.mapResourceToPendingModelResolvers.has(e);){let o=this.mapResourceToPendingModelResolvers.get(e);if(o===t)return;t=o;try{await o}catch{}}}registerModel(e){let t=new O;t.add(e.onDidResolve(o=>this._onDidResolve.fire({model:e,reason:o}))),t.add(e.onDidChangeDirty(()=>this._onDidChangeDirty.fire(e))),t.add(e.onDidChangeReadonly(()=>this._onDidChangeReadonly.fire(e))),t.add(e.onDidChangeOrphaned(()=>this._onDidChangeOrphaned.fire(e))),t.add(e.onDidSaveError(()=>this._onDidSaveError.fire(e))),t.add(e.onDidSave(o=>this._onDidSave.fire({model:e,...o}))),t.add(e.onDidRevert(()=>this._onDidRevert.fire(e))),t.add(e.onDidChangeEncoding(()=>this._onDidChangeEncoding.fire(e))),this.mapResourceToModelListeners.set(e.resource,t)}add(e,t){if(this.mapResourceToModel.get(e)===t)return;this.mapResourceToDisposeListener.get(e)?.dispose(),this.mapResourceToModel.set(e,t),this.mapResourceToDisposeListener.set(e,t.onWillDispose(()=>this.remove(e)))}remove(e){let t=this.mapResourceToModel.delete(e),o=this.mapResourceToDisposeListener.get(e);o&&(je(o),this.mapResourceToDisposeListener.delete(e));let n=this.mapResourceToModelListeners.get(e);n&&(je(n),this.mapResourceToModelListeners.delete(e)),t&&this._onDidRemove.fire(e)}addSaveParticipant(e){return this.saveParticipants.addSaveParticipant(e)}runSaveParticipants(e,t,o,n){return this.saveParticipants.participate(e,t,o,n)}canDispose(e){return e.isDisposed()||!this.mapResourceToPendingModelResolvers.has(e.resource)&&!e.isDirty()?!0:this.doCanDispose(e)}async doCanDispose(e){let t=this.joinPendingResolves(e.resource);return t?(await t,this.canDispose(e)):e.isDirty()?(await U.toPromise(e.onDidChangeDirty),this.canDispose(e)):!0}dispose(){super.dispose(),this.mapResourceToModel.clear(),this.mapResourceToPendingModelResolvers.clear(),je(this.mapResourceToDisposeListener.values()),this.mapResourceToDisposeListener.clear(),je(this.mapResourceToModelListeners.values()),this.mapResourceToModelListeners.clear()}};M$e=I([m(0,F),m(1,ge),m(2,Ne),m(3,gm),m(4,gt)],M$e);var P7=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super();this.fileService=e;this.lifecycleService=o;this.instantiationService=n;this.modelService=r;this.environmentService=s;this.dialogService=l;this.fileDialogService=c;this.textResourceConfigurationService=u;this.filesConfigurationService=p;this.codeEditorService=h;this.pathService=g;this.workingCopyFileService=f;this.uriIdentityService=v;this.languageService=b;this.logService=S;this.elevatedFileService=y;this.decorationsService=w;this.files=this._register(this.instantiationService.createInstance(M$e)),this.untitled=t,this.provideDecorations()}static{this.TEXTFILE_SAVE_CREATE_SOURCE=Qh.registerSource("textFileCreate.source",d(19281,null))}static{this.TEXTFILE_SAVE_REPLACE_SOURCE=Qh.registerSource("textFileOverwrite.source",d(19283,null))}provideDecorations(){let e=this._register(new class extends k{constructor(o){super();this.files=o;this.label=d(19282,null);this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.registerListeners()}registerListeners(){this._register(this.files.onDidResolve(({model:o})=>{(o.isReadonly()||o.hasState(4))&&this._onDidChange.fire([o.resource])})),this._register(this.files.onDidRemove(o=>this._onDidChange.fire([o]))),this._register(this.files.onDidChangeReadonly(o=>this._onDidChange.fire([o.resource]))),this._register(this.files.onDidChangeOrphaned(o=>this._onDidChange.fire([o.resource])))}provideDecorations(o){let n=this.files.get(o);if(!n||n.isDisposed())return;let r=n.isReadonly(),s=n.hasState(4);if(r&&s)return{color:Ok,letter:L.lockSmall,strikethrough:!0,tooltip:d(19279,null)};if(r)return{letter:L.lockSmall,tooltip:d(19278,null)};if(s)return{color:Ok,strikethrough:!0,tooltip:d(19274,null)}}}(this.files));this._register(this.decorationsService.registerDecorationsProvider(e))}get encoding(){return this._encoding||(this._encoding=this._register(this.instantiationService.createInstance(lgt))),this._encoding}async read(e,t){let[o,n]=await this.doRead(e,{...t,preferUnbuffered:!0});return{...o,encoding:n.detected.encoding||Jb,value:await Swe(n.stream,r=>r.join(""))}}async readStream(e,t){let[o,n]=await this.doRead(e,t);return{...o,encoding:n.detected.encoding||Jb,value:await OX(n.stream)}}async doRead(e,t){let o=new qe,n;if(t?.preferUnbuffered){let r=await this.fileService.readFile(e,t,o.token);n={...r,value:lD(r.value)}}else n=await this.fileService.readFileStream(e,t,o.token);try{let r=await this.doGetDecodedStream(e,n.value,t);return[n,r]}catch(r){throw o.dispose(!0),r.decodeStreamErrorKind===1?new UAt(d(19275,null),0,t):r}}async create(e,t){let o=await Promise.all(e.map(async n=>{let r=await this.getEncodedReadable(n.resource,n.value);return{resource:n.resource,contents:r,overwrite:n.options?.overwrite}}));return this.workingCopyFileService.create(o,Ie.None,t)}async write(e,t,o){let n=await this.getEncodedReadable(e,t,o);return o?.writeElevated&&this.elevatedFileService.isSupported(e)?this.elevatedFileService.writeFileElevated(e,n,o):this.fileService.writeFile(e,n,o)}async getEncodedReadable(e,t,o){let{encoding:n,addBOM:r}=await this.encoding.getWriteEncoding(e,o);if(n===Jb&&!r)return typeof t>"u"?void 0:$lo(t);t=t||"";let s=typeof t=="string"?MDe(t):t;return vco(s,n,{addBOM:r})}async getDecodedStream(e,t,o){return(await this.doGetDecodedStream(e,t,o)).stream}doGetDecodedStream(e,t,o){return fco(t,{acceptTextOnly:o?.acceptTextOnly??!1,guessEncoding:o?.autoGuessEncoding||this.textResourceConfigurationService.getValue(e,"files.autoGuessEncoding"),candidateGuessEncodings:o?.candidateGuessEncodings||this.textResourceConfigurationService.getValue(e,"files.candidateGuessEncodings"),overwriteEncoding:async n=>this.validateDetectedEncoding(e,n??void 0,o)})}getEncoding(e){return(e.scheme===Q.untitled?this.untitled.get(e):this.files.get(e))?.getEncoding()??this.encoding.getUnvalidatedEncodingForResource(e)}async resolveDecoding(e,t){return{preferredEncoding:(await this.encoding.getPreferredReadEncoding(e,t,void 0)).encoding,guessEncoding:t?.autoGuessEncoding||this.textResourceConfigurationService.getValue(e,"files.autoGuessEncoding"),candidateGuessEncodings:t?.candidateGuessEncodings||this.textResourceConfigurationService.getValue(e,"files.candidateGuessEncodings")}}async validateDetectedEncoding(e,t,o){let{encoding:n}=await this.encoding.getPreferredReadEncoding(e,o,t);return n}resolveEncoding(e,t){return this.encoding.getWriteEncoding(e,t)}async save(e,t){if(e.scheme===Q.untitled){let o=this.untitled.get(e);if(o){let n;if(o.hasAssociatedFilePath?n=await this.suggestSavePath(e):n=await this.fileDialogService.pickFileToSave(await this.suggestSavePath(e),t?.availableFileSystems),n)return this.saveAs(e,n,t)}}else{let o=this.files.get(e);if(o)return await o.save(t)?e:void 0}}async saveAs(e,t,o){if(t||(t=await this.fileDialogService.pickFileToSave(await this.suggestSavePath(o?.suggestedTarget??e),o?.availableFileSystems)),!!t){if(this.filesConfigurationService.isReadonly(t))if(await this.confirmMakeWriteable(t))this.filesConfigurationService.updateReadonly(t,!1);else return;return ze(e,t)?this.save(e,{...o,force:!0}):this.fileService.hasProvider(e)&&this.uriIdentityService.extUri.isEqual(e,t)&&await this.fileService.exists(e)?(await this.workingCopyFileService.move([{file:{source:e,target:t}}],Ie.None),await this.save(e,o)||await this.save(t,o),t):this.doSaveAs(e,t,o)}}async doSaveAs(e,t,o){let n=!1,r;if(e.scheme!==Q.untitled){let s=this.files.get(e);s?.isResolved()&&(r=s)}else{let s=this.untitled.get(e);s?.isResolved()&&(r=s)}if(r)n=await this.doSaveAsTextFile(r,e,t,o);else if(this.fileService.hasProvider(e))await this.fileService.copy(e,t,!0),n=!0;else{let s=this.modelService.getModel(e);s&&(n=await this.doSaveAsTextFile(s,e,t,o))}if(n){try{await this.revert(e)}catch(s){this.logService.error(s)}return e.scheme===Q.untitled&&this.untitled.notifyDidSave(e,t),t}}async doSaveAsTextFile(e,t,o,n){let r,s=e;typeof s.getEncoding=="function"&&(r=s.getEncoding());let l=!1,c=this.files.get(o);if(c?.isResolved())l=!0;else{l=await this.fileService.exists(o),l||await this.create([{resource:o,value:""}]);try{c=await this.files.resolve(o,{encoding:r})}catch(g){if(l&&(g.textFileOperationResult===0||g.fileOperationResult===7))return await this.fileService.del(o),this.doSaveAsTextFile(e,t,o,n);throw g}}let u;if(e instanceof uR&&e.hasAssociatedFilePath&&l&&this.uriIdentityService.extUri.isEqual(o,Nf(e.resource,this.environmentService.remoteAuthority,this.pathService.defaultUriScheme))?u=await this.confirmOverwrite(o):u=!0,!u)return!1;let p;e instanceof CC?e.isResolved()&&(p=e.textEditorModel??void 0):p=e;let h;if(c.isResolved()&&(h=c.textEditorModel),p&&h){c.updatePreferredEncoding(r),this.modelService.updateModel(h,Uk(p.createSnapshot()));let g=p.getLanguageId(),f=h.getLanguageId();g!==es&&f===es&&h.setLanguage(g);let v=p.getOptions();h.updateOptions({tabSize:v.tabSize,indentSize:v.indentSize,insertSpaces:v.insertSpaces});let b=p.getEndOfLineSequence();h.setEOL(b);let S=this.codeEditorService.getTransientModelProperties(p);if(S)for(let[y,w]of S)this.codeEditorService.setTransientModelProperty(h,y,w)}return n?.source||(n={...n,source:l?P7.TEXTFILE_SAVE_REPLACE_SOURCE:P7.TEXTFILE_SAVE_CREATE_SOURCE}),c.save({...n,from:t})}async confirmOverwrite(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(19273,null,Be(e)),detail:d(19277,null,Be(e),Be(ai(e))),primaryButton:d(19280,null)});return t}async confirmMakeWriteable(e){let{confirmed:t}=await this.dialogService.confirm({type:"warning",message:d(19271,null,Be(e)),detail:d(19272,null),primaryButton:d(19276,null)});return t}async suggestSavePath(e){if(this.fileService.hasProvider(e))return e;let t=this.environmentService.remoteAuthority,o=await this.fileDialogService.defaultFilePath(),n;if(e.scheme===Q.untitled){let r=this.untitled.get(e);if(r){if(r.hasAssociatedFilePath)return Nf(e,t,this.pathService.defaultUriScheme);let s;await this.pathService.hasValidBasename(Ve(o,r.name),r.name)?s=r.name:s=Be(e);let l=r.getLanguageId();l&&l!==es?n=this.suggestFilename(l,s):n=s}}return n||(n=Be(e)),Ve(o,n)}suggestFilename(e,t){if(!this.languageService.getLanguageName(e))return t;let n=km(t),r=this.languageService.getExtensions(e);if(r.includes(n))return t;let s=r.at(0);if(s)return n?`${t.substring(0,t.indexOf(n))}${s}`:`${t}${s}`;let l=this.languageService.getFilenames(e);return l.includes(t)?t:l.at(0)??t}async revert(e,t){if(e.scheme===Q.untitled){let o=this.untitled.get(e);if(o)return o.revert(t)}else{let o=this.files.get(e);if(o&&(o.isDirty()||t?.force))return o.revert(t)}}isDirty(e){let t=e.scheme===Q.untitled?this.untitled.get(e):this.files.get(e);return t?t.isDirty():!1}};P7=I([m(0,ge),m(1,yE),m(2,to),m(3,F),m(4,_t),m(5,Mt),m(6,ct),m(7,nn),m(8,Gn),m(9,fr),m(10,Qt),m(11,Pn),m(12,gm),m(13,gt),m(14,Rt),m(15,re),m(16,pW),m(17,mb)],P7);var lgt=class extends k{constructor(e,t,o,n){super();this.textResourceConfigurationService=e;this.environmentService=t;this.contextService=o;this.uriIdentityService=n;this._encodingOverrides=this.getDefaultEncodingOverrides(),this.registerListeners()}get encodingOverrides(){return this._encodingOverrides}set encodingOverrides(e){this._encodingOverrides=e}registerListeners(){this._register(this.contextService.onDidChangeWorkspaceFolders(()=>this.encodingOverrides=this.getDefaultEncodingOverrides()))}getDefaultEncodingOverrides(){let e=[];return e.push({parent:this.environmentService.userRoamingDataHome,encoding:Jb}),e.push({extension:OT,encoding:Jb}),e.push({parent:this.environmentService.untitledWorkspacesHome,encoding:Jb}),this.contextService.getWorkspace().folders.forEach(t=>{e.push({parent:Ve(t.uri,".vscode"),encoding:Jb})}),e}async getWriteEncoding(e,t){let{encoding:o,hasBOM:n}=await this.getPreferredWriteEncoding(e,t?t.encoding:void 0);return{encoding:o,addBOM:n}}async getPreferredWriteEncoding(e,t){let o=await this.getValidatedEncodingForResource(e,t);return{encoding:o,hasBOM:o===K3||o===G3||o===VH}}async getPreferredReadEncoding(e,t,o){let n;t?.encoding?o===VH&&t.encoding===Jb?n=VH:n=t.encoding:typeof o=="string"?n=o:this.textResourceConfigurationService.getValue(e,"files.encoding")===VH&&(n=Jb);let r=await this.getValidatedEncodingForResource(e,n);return{encoding:r,hasBOM:r===K3||r===G3||r===VH}}getUnvalidatedEncodingForResource(e,t){let o,n=this.getEncodingOverride(e);return n?o=n:t?o=t:o=this.textResourceConfigurationService.getValue(e,"files.encoding"),o||Jb}async getValidatedEncodingForResource(e,t){let o=this.getUnvalidatedEncodingForResource(e,t);return o!==Jb&&!await bco(o)&&(o=Jb),o}getEncodingOverride(e){if(e&&this.encodingOverrides?.length){for(let t of this.encodingOverrides)if(t.parent&&this.uriIdentityService.extUri.isEqualOrParent(e,t.parent)||t.extension&&Ts(e)===`.${t.extension}`)return t.encoding}}};lgt=I([m(0,Gn),m(1,Mt),m(2,Ae),m(3,gt)],lgt);var cgt=class extends P7{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,S,b,y),this.environmentService=r,this.registerListeners()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(i=>i.join(this.onWillShutdown(),{id:"join.textFiles",label:d(19290,null)})))}async onWillShutdown(){let i;for(;(i=this.files.models.filter(e=>e.hasState(2))).length>0;)await vn.settled(i.map(e=>e.joinState(2)))}async read(i,e){return e=this.ensureLimits(e),super.read(i,e)}async readStream(i,e){return e=this.ensureLimits(e),super.readStream(i,e)}ensureLimits(i){let e;i?e=i:e=Object.create(null);let t;return e.limits?t=e.limits:(t=Object.create(null),e={...e,limits:t}),e}};cgt=I([m(0,ge),m(1,yE),m(2,to),m(3,F),m(4,_t),m(5,Jr),m(6,ct),m(7,nn),m(8,Gn),m(9,fr),m(10,Qt),m(11,Pn),m(12,gm),m(13,gt),m(14,Rt),m(15,pW),m(16,re),m(17,mb)],cgt);Ce(Uo,cgt,0);var A$e;(t=>{t.ID="workbench.action.files.openLocalFile",t.LABEL=d(18812,null);function e(){return o=>o.get(nn).pickFileAndOpen({forceNewWindow:!1,availableFileSystems:[Q.file]})}t.handler=e})(A$e||={});var N$e;(t=>{t.ID="workbench.action.files.saveLocalFile",t.LABEL=d(18832,null);function e(){return o=>{let n=o.get(ie),r=n.activeEditorPane;return r?n.save({groupId:r.group.id,editor:r.input},{saveAs:!0,availableFileSystems:[Q.file],reason:1}):Promise.resolve(void 0)}}t.handler=e})(N$e||={});var O$e;(t=>{t.ID="workbench.action.files.openLocalFolder",t.LABEL=d(18814,null);function e(){return o=>o.get(nn).pickFolderAndOpen({forceNewWindow:!1,availableFileSystems:[Q.file]})}t.handler=e})(O$e||={});var F$e;(t=>{t.ID="workbench.action.files.openLocalFileFolder",t.LABEL=d(18813,null);function e(){return o=>o.get(nn).pickFileFolderAndOpen({forceNewWindow:!1,availableFileSystems:[Q.file]})}t.handler=e})(F$e||={});var W$e=new Y("remoteFileDialogVisible",!1),P$e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.fileService=e;this.quickInputService=t;this.labelService=o;this.workspaceContextService=n;this.notificationService=r;this.fileDialogService=s;this.modelService=l;this.languageService=c;this.environmentService=u;this.remoteAgentService=p;this.pathService=h;this.keybindingService=g;this.accessibilityService=v;this.storageService=b;this.hidden=!1;this.allowFileSelection=!0;this.allowFolderSelection=!1;this.requiresTrailing=!1;this.userEnteredPathSegment="";this.autoCompletePathSegment="";this.isWindows=!1;this.separator="/";this.scopedPathPrefix="";this.onBusyChangeEmitter=this._register(new T);this._showDotFiles=!0;this.remoteAuthority=this.environmentService.remoteAuthority,this.contextKey=W$e.bindTo(f),this.scheme=this.pathService.defaultUriScheme,this.getShowDotFiles();let S=this._register(new O);S.add(this.storageService.onDidChangeValue(1,"remoteFileDialog.showDotFiles",S)(async y=>{this.getShowDotFiles(),this.setButtons();let w=this.filePickBox.value,x=this.pathFromUri(this.currentFolder,!0);this.filePickBox.value=x,await this.tryUpdateItems(x,this.currentFolder,!0),this.filePickBox.value=w}))}setShowDotFiles(e){this.storageService.store("remoteFileDialog.showDotFiles",e,1,0)}getShowDotFiles(){this._showDotFiles=this.storageService.getBoolean("remoteFileDialog.showDotFiles",1,!0)}set busy(e){this.filePickBox.busy!==e&&(this.filePickBox.busy=e,this.onBusyChangeEmitter.fire(e))}get busy(){return this.filePickBox.busy}async showOpenDialog(e={}){this.scheme=this.getScheme(e.availableFileSystems,e.defaultUri),this.scopedAuthority=this.getScopedAuthority(e.defaultUri),this.scopedPathPrefix=e.defaultUri&&this.scopedAuthority?this.computeScopedPathPrefix(e.defaultUri):"",this.userHome=await this.getUserHome(),this.trueHome=await this.getUserHome(!0);let t=this.getOptions(e);if(!t)return Promise.resolve(void 0);this.options=t;let o=await this.pickResource();return Array.isArray(o)?o:o?[o]:void 0}async showSaveDialog(e){this.scheme=this.getScheme(e.availableFileSystems,e.defaultUri),this.scopedAuthority=this.getScopedAuthority(e.defaultUri),this.scopedPathPrefix=e.defaultUri&&this.scopedAuthority?this.computeScopedPathPrefix(e.defaultUri):"",this.userHome=await this.getUserHome(),this.trueHome=await this.getUserHome(!0),this.requiresTrailing=!0;let t=this.getOptions(e,!0);return t?(this.options=t,this.options.canSelectFolders=!0,this.options.canSelectFiles=!0,new Promise(o=>{this.pickResource(!0).then(n=>{o(Array.isArray(n)?n[0]:n)})})):Promise.resolve(void 0)}getOptions(e,t=!1){let o,n;if(e.defaultUri&&(o=this.scheme===e.defaultUri.scheme?e.defaultUri:void 0,n=t?Be(e.defaultUri):void 0),o||(o=this.userHome,n&&(o=Ve(o,n))),this.scheme!==Q.file&&!this.fileService.hasProvider(o)){this.notificationService.info(d(18820,null,o.toString()));return}let r=io(e);return r.defaultUri=o,r}remoteUriFrom(e,t){if(e.startsWith("\\\\")||(e=e.replace(/\\/g,"/")),this.scopedAuthority)return A.from({scheme:this.scheme,authority:this.scopedAuthority,path:this.scopedPathPrefix+e,query:t?.query,fragment:t?.fragment});let o=this.scheme===Q.file?A.file(e):A.from({scheme:this.scheme,path:e,query:t?.query,fragment:t?.fragment}),n=o.scheme===Q.file?void 0:this.remoteAuthority??t?.authority;return Nf(o,n,n?this.pathService.defaultUriScheme:o.scheme)}getScheme(e,t){return e&&e.length>0?t&&e.indexOf(t.scheme)>=0?t.scheme:e[0]:t?t.scheme:Q.file}getScopedAuthority(e){if(e&&e.scheme===this.scheme&&e.authority&&e.authority!==this.remoteAuthority)return e.authority}computeScopedPathPrefix(e){let t=e.path,o=this.labelService.getUriLabel(e);return o&&t.endsWith(o)?t.substring(0,t.length-o.length):""}async getRemoteAgentEnvironment(){return this.remoteAgentEnvironment===void 0&&(this.remoteAgentEnvironment=await this.remoteAgentService.getEnvironment()),this.remoteAgentEnvironment}getUserHome(e=!1){return this.scopedAuthority?Promise.resolve(A.from({scheme:this.scheme,authority:this.scopedAuthority,path:this.scopedPathPrefix+"/"})):e?this.pathService.userHome({preferLocal:this.scheme===Q.file}):this.fileDialogService.preferredHome(this.scheme)}normalizeUri(e){return e=Zj(e,this.separator),e=Ble(e),e}async pickResource(e=!1){this.allowFolderSelection=!!this.options.canSelectFolders,this.allowFileSelection=!!this.options.canSelectFiles,this.separator=this.scopedAuthority?"/":this.labelService.getSeparator(this.scheme,this.remoteAuthority),this.hidden=!1,this.isWindows=this.scopedAuthority?!1:await this.checkIsWindowsOS();let t=this.options.defaultUri?this.options.defaultUri:this.workspaceContextService.getWorkspace().folders[0].uri,o,n=Ts(t);if(this.options.defaultUri){try{o=await this.fileService.stat(this.options.defaultUri)}catch{}(!o||!o.isDirectory)&&(t=ai(this.options.defaultUri),this.trailing=Be(this.options.defaultUri))}return new Promise(r=>{if(this.filePickBox=this._register(this.quickInputService.createQuickPick()),this.busy=!0,this.filePickBox.matchOnLabel=!1,this.filePickBox.sortByLabel=!1,this.filePickBox.ignoreFocusOut=!0,this.filePickBox.placeholder=d(18821,null),this.filePickBox.ok=!0,this.filePickBox.okLabel=typeof this.options.openLabel=="string"?this.options.openLabel:this.options.openLabel?.withoutMnemonic,this.scheme!==Q.file&&this.options&&this.options.availableFileSystems&&this.options.availableFileSystems.length>1&&this.options.availableFileSystems.indexOf(Q.file)>-1){this.filePickBox.customButton=!0,this.filePickBox.customLabel=d(18819,null),this.filePickBox.customButtonSecondary=!0;let h;e?h=N$e:h=this.allowFileSelection?this.allowFolderSelection?F$e:A$e:O$e;let g=this.keybindingService.lookupKeybinding(h.ID);if(g){let f=g.getLabel();f&&(this.filePickBox.customHover=Wd("{0} ({1})",h.LABEL,f))}}this.setButtons(),this._register(this.filePickBox.onDidTriggerButton(h=>{this.setShowDotFiles(!this._showDotFiles)}));let s=0,l=!1;this.currentFolder=ai(t),this.userEnteredPathSegment="",this.autoCompletePathSegment="",this.filePickBox.title=this.options.title,this.filePickBox.value=this.pathFromUri(this.currentFolder,!0),this.filePickBox.valueSelection=[this.filePickBox.value.length,this.filePickBox.value.length];let c=h=>{h&&(Array.isArray(h)?h=h.map(g=>this.normalizeUri(g)):h=this.normalizeUri(h)),r(h),this.contextKey.set(!1),this.dispose()};this._register(this.filePickBox.onDidCustom(()=>{if(!(l||this.busy))return l=!0,s++,this.options.availableFileSystems&&this.options.availableFileSystems.length>1&&(this.options.availableFileSystems=this.options.availableFileSystems.slice(1)),this.filePickBox.hide(),e?this.fileDialogService.showSaveDialog(this.options).then(h=>{c(h)}):this.fileDialogService.showOpenDialog(this.options).then(h=>{c(h)})}));let u=this._register(new ue),p=()=>{if(this.busy){u.value=this.onBusyChangeEmitter.event(h=>{h||p()});return}else if(l)return;l=!0,s++,this.onDidAccept().then(h=>{h?(this.filePickBox.hide(),c(h)):this.hidden?c(void 0):(s--,l=!1)})};this._register(this.filePickBox.onDidAccept(h=>{p()})),this._register(this.filePickBox.onDidChangeActive(h=>{if(l=!1,h.length===1&&this.isSelectionChangeFromUser()){this.filePickBox.validationMessage=void 0;let g=this.constructFullUserPath();xr(this.filePickBox.value.substring(0,g.length),g)||(this.filePickBox.valueSelection=[0,this.filePickBox.value.length],this.insertText(g,g)),this.setAutoComplete(g,this.userEnteredPathSegment,h[0],!0)}})),this._register(this.filePickBox.onDidChangeValue(async h=>this.handleValueChange(h))),this._register(this.filePickBox.onDidHide(()=>{this.hidden=!0,s===0&&c(void 0)})),this.filePickBox.show(),this.contextKey.set(!0),this.updateItems(t,!0,this.trailing).then(()=>{this.trailing?this.filePickBox.valueSelection=[this.filePickBox.value.length-this.trailing.length,this.filePickBox.value.length-n.length]:this.filePickBox.valueSelection=[this.filePickBox.value.length,this.filePickBox.value.length],this.busy=!1})})}async handleValueChange(e){try{if(this.isValueChangeFromUser())if(!xr(e,this.constructFullUserPath())&&(!this.isBadSubpath(e)||this.canTildaEscapeHatch(e))){this.filePickBox.validationMessage=void 0;let t=this.filePickBoxValue(),o=3;Tk.isEqual(this.currentFolder,t)||(o=await this.tryUpdateItems(e,t)),(o===3||o===1)&&this.setActiveItems(e)}else this.filePickBox.activeItems=[],this.userEnteredPathSegment=""}catch{}}setButtons(){this.filePickBox.buttons=[{iconClass:this._showDotFiles?q.asClassName(L.eye):q.asClassName(L.eyeClosed),tooltip:this._showDotFiles?d(18817,null):d(18822,null),alwaysVisible:!0}]}isBadSubpath(e){return this.badPath&&e.length>this.badPath.length&&xr(e.substring(0,this.badPath.length),this.badPath)}isValueChangeFromUser(){return!xr(this.filePickBox.value,this.pathAppend(this.currentFolder,this.userEnteredPathSegment+this.autoCompletePathSegment))}isSelectionChangeFromUser(){return this.activeItem!==(this.filePickBox.activeItems?this.filePickBox.activeItems[0]:void 0)}constructFullUserPath(){let e=this.pathFromUri(this.currentFolder);return xr(this.filePickBox.value.substr(0,this.userEnteredPathSegment.length),this.userEnteredPathSegment)?xr(this.filePickBox.value.substr(0,e.length),e)?e:this.userEnteredPathSegment:this.pathAppend(this.currentFolder,this.userEnteredPathSegment)}filePickBoxValue(){let e=this.remoteUriFrom(this.filePickBox.value.trimRight(),this.currentFolder),t=this.pathFromUri(this.currentFolder);if(xr(this.filePickBox.value,t))return this.currentFolder;let o=this.remoteUriFrom(t,this.currentFolder),n=lu(o,e),r=this.filePickBox.value.length>1&&t.length>1?xr(this.filePickBox.value.substr(0,2),t.substr(0,2)):!1;if(n&&r){let s=Ve(this.currentFolder,n),l=Be(e);return(l==="."||l==="..")&&(s=this.remoteUriFrom(this.pathAppend(s,l),this.currentFolder)),Vle(e)?Zj(s):s}else return e}async onDidAccept(){if(this.busy=!0,!this.updatingPromise&&this.filePickBox.activeItems.length===1){let t=this.filePickBox.selectedItems[0];if(t.isFolder){if(this.trailing)await this.updateItems(t.uri,!0,this.trailing);else{let o=this.pathFromUri(t.uri);aT(o,this.filePickBox.value)&&xr(t.label,Be(t.uri))?(this.filePickBox.valueSelection=[this.pathFromUri(this.currentFolder).length,this.filePickBox.value.length],this.insertText(o,this.basenameWithTrailingSlash(t.uri))):t.label===".."&&aT(this.filePickBox.value,o)?(this.filePickBox.valueSelection=[o.length,this.filePickBox.value.length],this.insertText(o,"")):await this.updateItems(t.uri,!0)}this.filePickBox.busy=!1;return}}else if(!this.updatingPromise&&await this.tryUpdateItems(this.filePickBox.value,this.filePickBoxValue())!==3){this.filePickBox.busy=!1;return}let e;if(this.filePickBox.activeItems.length===0?e=this.filePickBoxValue():this.filePickBox.activeItems.length===1&&(e=this.filePickBox.selectedItems[0].uri),e&&(e=this.addPostfix(e)),await this.validate(e))return this.busy=!1,e;this.busy=!1}root(e){let t=e,o=ai(e);for(;!ze(t,o);)t=o,o=ai(o);return o}canTildaEscapeHatch(e){return!!(e.endsWith("~")&&this.isBadSubpath(e))}tildaReplace(e){let t=this.trueHome;return e.length>0&&e[0]==="~"?Ve(t,e.substring(1)):this.canTildaEscapeHatch(e)?t:this.remoteUriFrom(e)}tryAddTrailingSeparatorToDirectory(e,t){return t.isDirectory&&!this.endsWithSlash(e.path)?Zj(e):e}async tryUpdateItems(e,t,o=!1){if(e.length>0&&(e[0]==="~"||this.canTildaEscapeHatch(e))){let n=this.tildaReplace(e);return await this.updateItems(n,!0)?1:0}else{if(e==="\\")return t=this.root(this.currentFolder),e=this.pathFromUri(t),await this.updateItems(t,!0)?1:0;{let n=Tk.isEqual(this.currentFolder,t),r=Tk.isEqual(this.currentFolder,ai(t)),s=Tk.isEqualOrParent(this.currentFolder,ai(t)),l=!s&&!r;if(!n&&(this.endsWithSlash(e)||s||l)||o){let c;try{c=await this.fileService.stat(t)}catch{}if(c?.isDirectory&&Be(t)!=="."&&this.endsWithSlash(e))return t=this.tryAddTrailingSeparatorToDirectory(t,c),await this.updateItems(t)?1:0;if(this.endsWithSlash(e))return this.filePickBox.validationMessage=d(18815,null),this.badPath=e,4;{let u=ai(t),p=Ble(Zj(this.currentFolder)),h=Ble(Zj(u));if(!Tk.isEqual(p,h)&&(!/^[a-zA-Z]:$/.test(this.filePickBox.value)||!xr(this.pathFromUri(this.currentFolder).substring(0,this.filePickBox.value.length),this.filePickBox.value))){let g;try{g=await this.fileService.stat(u)}catch{}if(g?.isDirectory)return this.badPath=void 0,u=this.tryAddTrailingSeparatorToDirectory(u,g),await this.updateItems(u,!1,Be(t))?1:0}}}}}return this.badPath=void 0,3}tryUpdateTrailing(e){let t=Ts(e);this.trailing&&t&&(this.trailing=Be(e))}setActiveItems(e){e=this.pathFromUri(this.tildaReplace(e));let t=this.remoteUriFrom(e),o=Be(t),n=this.constructFullUserPath();if(xr(n,e.substring(0,n.length))||xr(e,n.substring(0,e.length))){let s=!1;for(let l=0;l<this.filePickBox.items.length;l++){let c=this.filePickBox.items[l];if(this.setAutoComplete(e,o,c)){s=!0;break}}if(!s){let l=o.length>=2?n.substring(n.length-o.length+2):"";this.userEnteredPathSegment=l===o?o:"",this.autoCompletePathSegment="",this.filePickBox.activeItems=[],this.tryUpdateTrailing(t)}}else this.userEnteredPathSegment=o,this.autoCompletePathSegment="",this.filePickBox.activeItems=[],this.tryUpdateTrailing(t)}setAutoComplete(e,t,o,n=!1){if(this.busy)return this.userEnteredPathSegment=t,this.autoCompletePathSegment="",!1;let r=o.label;return r===".."?(this.userEnteredPathSegment="",this.autoCompletePathSegment="",this.activeItem=o,n&&_m().execCommand("insertText",!1,""),!1):!n&&r.length>=t.length&&xr(r.substr(0,t.length),t)?(this.userEnteredPathSegment=t,this.activeItem=o,this.autoCompletePathSegment="",o.isFolder||!this.trailing?this.filePickBox.activeItems=[o]:this.filePickBox.activeItems=[],!0):n&&!xr(this.basenameWithTrailingSlash(o.uri),this.userEnteredPathSegment+this.autoCompletePathSegment)?(this.userEnteredPathSegment="",this.accessibilityService.isScreenReaderOptimized()||(this.autoCompletePathSegment=this.trimTrailingSlash(r)),this.activeItem=o,this.accessibilityService.isScreenReaderOptimized()||(this.filePickBox.valueSelection=[this.pathFromUri(this.currentFolder,!0).length,this.filePickBox.value.length],this.insertText(this.pathAppend(this.currentFolder,this.autoCompletePathSegment),this.autoCompletePathSegment),this.filePickBox.valueSelection=[this.filePickBox.value.length-this.autoCompletePathSegment.length,this.filePickBox.value.length]),!0):(this.userEnteredPathSegment=t,this.autoCompletePathSegment="",!1)}insertText(e,t){this.filePickBox.inputHasFocus()?(_m().execCommand("insertText",!1,t),this.filePickBox.value!==e&&(this.filePickBox.value=e,this.handleValueChange(e))):(this.filePickBox.value=e,this.handleValueChange(e))}addPostfix(e){let t=e;if(this.requiresTrailing&&this.options.filters&&this.options.filters.length>0&&!Vle(e)){let o=!1,n=Ts(e).substr(1);for(let r=0;r<this.options.filters.length;r++){for(let s=0;s<this.options.filters[r].extensions.length;s++)if(this.options.filters[r].extensions[s]==="*"||this.options.filters[r].extensions[s]===n){o=!0;break}if(o)break}o||(t=Ve(ai(e),Be(e)+"."+this.options.filters[0].extensions[0]))}return t}trimTrailingSlash(e){return e.length>1&&this.endsWithSlash(e)?e.substr(0,e.length-1):e}yesNoPrompt(e,t){let o=new O,n=o.add(this.quickInputService.createQuickPick());n.title=t,n.ignoreFocusOut=!0,n.ok=!0,n.customButton=!0,n.customLabel=d(18816,null),n.customButtonSecondary=!0,n.value=this.pathFromUri(e);let r=!1;return new Promise(s=>{o.add(n.onDidAccept(()=>{r=!0,n.hide(),s(!0)})),o.add(n.onDidHide(()=>{r||s(!1),this.filePickBox.show(),this.hidden=!1,o.dispose()})),o.add(n.onDidChangeValue(()=>{n.hide()})),o.add(n.onDidCustom(()=>{n.hide()})),n.show()})}async validate(e){if(e===void 0)return this.filePickBox.validationMessage=d(18818,null),Promise.resolve(!1);let t,o;try{o=await this.fileService.stat(ai(e)),t=await this.fileService.stat(e)}catch{}if(this.requiresTrailing){if(t?.isDirectory)return this.filePickBox.validationMessage=d(18827,null),Promise.resolve(!1);if(t){let n=d(18825,null,Be(e));return this.yesNoPrompt(e,n)}else if(Ez(Be(e),this.isWindows))if(o)if(o.isDirectory){if(o.readonly)return this.filePickBox.validationMessage=d(18830,null),Promise.resolve(!1)}else return this.filePickBox.validationMessage=d(18829,null),Promise.resolve(!1);else{let n=d(18824,null,Be(ai(e)));return this.yesNoPrompt(e,n)}else return this.filePickBox.validationMessage=d(18823,null),Promise.resolve(!1)}else if(t){if(e.path==="/"&&this.isWindows)return this.filePickBox.validationMessage=d(18831,null),Promise.resolve(!1);if(t.isDirectory&&!this.allowFolderSelection)return this.filePickBox.validationMessage=d(18826,null),Promise.resolve(!1);if(!t.isDirectory&&!this.allowFileSelection)return this.filePickBox.validationMessage=d(18828,null),Promise.resolve(!1)}else return this.filePickBox.validationMessage=d(18829,null),Promise.resolve(!1);return Promise.resolve(!0)}async updateItems(e,t=!1,o){this.busy=!0,this.autoCompletePathSegment="";let n=o==="..";o=n?void 0:o;let r=!!o,s=!1,l=Hn(async c=>{let u;try{u=await this.fileService.resolve(e),u.isDirectory||(o=Be(e),e=ai(e),u=void 0,s=!0)}catch{}let p=o?this.pathAppend(e,o):this.pathFromUri(e,!0);return this.currentFolder=this.endsWithSlash(e.path)?e:Zj(e,this.separator),this.userEnteredPathSegment=o||"",this.createItems(u,this.currentFolder,c).then(h=>c.isCancellationRequested?(this.busy=!1,!1):(this.filePickBox.itemActivation=0,this.filePickBox.items=h,!xr(this.filePickBox.value,p)&&(t||n)&&(this.filePickBox.valueSelection=[0,this.filePickBox.value.length],this.insertText(p,p)),t&&o&&r?this.filePickBox.valueSelection=[this.filePickBox.value.length-o.length,this.filePickBox.value.length-o.length]:o||(this.filePickBox.valueSelection=[this.filePickBox.value.length,this.filePickBox.value.length]),this.busy=!1,this.updatingPromise=void 0,s))});return this.updatingPromise!==void 0&&this.updatingPromise.cancel(),this.updatingPromise=l,l}pathFromUri(e,t=!1){let o;if(this.scopedAuthority){let n=e.path;this.scopedPathPrefix&&n.startsWith(this.scopedPathPrefix)&&(n=n.substring(this.scopedPathPrefix.length)),o=n.replace(/\n/g,"")}else o=dm(e.fsPath,this.isWindows).replace(/\n/g,"");return this.separator==="/"?o=o.replace(/\\/g,this.separator):o=o.replace(/\//g,this.separator),t&&!this.endsWithSlash(o)&&(o=o+this.separator),o}pathAppend(e,t){return t===".."||t==="."?this.pathFromUri(e,!0)+t:this.pathFromUri(Ve(e,t))}async checkIsWindowsOS(){let e=ii,t=await this.getRemoteAgentEnvironment();return t&&(e=t.os===1),e}endsWithSlash(e){return/[\/\\]$/.test(e)}basenameWithTrailingSlash(e){let t=this.pathFromUri(e,!0),o=this.pathFromUri(ai(e),!0);return t.substring(o.length)}async createBackItem(e){if(this.scopedPathPrefix){let s=e.path.substring(this.scopedPathPrefix.length);if(s==="/"||s==="")return}let t=this.scopedAuthority?this.scheme:Q.file,o=this.scopedAuthority??"",n=this.currentFolder.with({scheme:t,authority:o}),r=ai(n);if(!ze(n,r)){let s=ai(e);if(await this.fileService.exists(s))return{label:"..",uri:Zj(s,this.separator),isFolder:!0}}}async createItems(e,t,o){let n=[],r=await this.createBackItem(t);try{e||(e=await this.fileService.resolve(t));let l=this._showDotFiles?e.children:e.children?.filter(u=>!u.name.startsWith(".")),c=l?await Promise.all(l.map(u=>this.createItem(u,t,o))):[];for(let u of c)u&&n.push(u)}catch(l){console.log(l)}if(o.isCancellationRequested)return[];let s=n.sort((l,c)=>{if(l.isFolder!==c.isFolder)return l.isFolder?-1:1;let u=this.endsWithSlash(l.label)?l.label.substr(0,l.label.length-1):l.label,p=this.endsWithSlash(c.label)?c.label.substr(0,c.label.length-1):c.label;return u.localeCompare(p)});return r&&s.unshift(r),s}filterFile(e){if(this.options.filters){for(let t=0;t<this.options.filters.length;t++)for(let o=0;o<this.options.filters[t].extensions.length;o++){let n=this.options.filters[t].extensions[o];if(n==="*"||e.path.endsWith("."+n))return!0}return!1}return!0}async createItem(e,t,o){if(o.isCancellationRequested)return;let n=Ve(t,e.name);if(e.isDirectory){let r=Be(n);return n=Zj(n,this.separator),{label:r,uri:n,isFolder:!0,iconClasses:Ia(this.modelService,this.languageService,n||void 0,1)}}else if(!e.isDirectory&&this.allowFileSelection&&this.filterFile(n))return{label:e.name,uri:n,isFolder:!1,iconClasses:Ia(this.modelService,this.languageService,n||void 0)}}};P$e=I([m(0,ge),m(1,$e),m(2,nt),m(3,Ae),m(4,Ne),m(5,nn),m(6,_t),m(7,Rt),m(8,Mt),m(9,bo),m(10,Pn),m(11,Le),m(12,X),m(13,Ai),m(14,de)],P$e);var V$e=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){this.hostService=i;this.contextService=e;this.historyService=t;this.environmentService=o;this.instantiationService=n;this.configurationService=r;this.fileService=s;this.openerService=l;this.dialogService=c;this.languageService=u;this.workspacesService=p;this.labelService=h;this.pathService=g;this.commandService=f;this.editorService=v;this.codeEditorService=b;this.logService=S;this.remoteAgentService=y}async defaultFilePath(i=this.getSchemeFilterForWindow(),e=this.getAuthorityFilterForWindow()){let t=this.historyService.getLastActiveFile(i,e);return t&&await this.isRemoteUserData(t)&&(this.logService.debug(`[FileDialogService] Skipping last active file as it is a remote user data resource: ${t}`),t=void 0),t?(this.logService.debug(`[FileDialogService] Default file path using parent of last active file: ${t}`),t=ai(t)):(t=this.historyService.getLastActiveWorkspaceRoot(i,e),t&&this.logService.debug(`[FileDialogService] Default file path using last active workspace root: ${t}`)),t||(t=await this.preferredHome(i),this.logService.debug(`[FileDialogService] Default file path using preferred home: ${t}`)),t}async defaultFolderPath(i=this.getSchemeFilterForWindow(),e=this.getAuthorityFilterForWindow()){let t=this.historyService.getLastActiveWorkspaceRoot(i,e);if(t?this.logService.debug(`[FileDialogService] Default folder path using last active workspace root: ${t}`):(t=this.historyService.getLastActiveFile(i,e),t&&await this.isRemoteUserData(t)&&(this.logService.debug(`[FileDialogService] Skipping last active file as it is a remote user data resource: ${t}`),t=void 0),t&&this.logService.debug(`[FileDialogService] Default folder path using parent of last active file: ${t}`)),!t){let o=await this.preferredHome(i);return this.logService.debug(`[FileDialogService] Default folder path using preferred home: ${o}`),o}return ai(t)}async preferredHome(i=this.getSchemeFilterForWindow()){let e=i===Q.file,t=this.configurationService.inspect("files.dialog.defaultPath"),o=e?t.userLocalValue:t.userRemoteValue;if(this.logService.debug(`[FileDialogService] Preferred home: preferLocal=${e}, userLocalValue=${t.userLocalValue}, userRemoteValue=${t.userRemoteValue}`),o)if(e?Jl(o):(await this.pathService.path).isAbsolute(o)){let s=e?Vh(o):(await this.pathService.path).normalize(o),l=Nf(await this.pathService.fileURI(s),this.environmentService.remoteAuthority,this.pathService.defaultUriScheme);if(await this.fileService.exists(l))return this.logService.debug(`[FileDialogService] Preferred home using files.dialog.defaultPath setting: ${l}`),l;this.logService.debug(`[FileDialogService] Preferred home files.dialog.defaultPath path does not exist: ${l}`)}else this.logService.debug(`[FileDialogService] Preferred home files.dialog.defaultPath is not absolute: ${o}`);let n=this.pathService.userHome({preferLocal:e});return this.logService.debug(`[FileDialogService] Preferred home using user home: ${n}`),n}async defaultWorkspacePath(i=this.getSchemeFilterForWindow()){let e;if(this.contextService.getWorkbenchState()===3){let t=this.contextService.getWorkspace().configuration;t?.scheme===i&&Fde(t,this.environmentService)&&!tC(t)&&(e=ai(t))}return e||(e=await this.defaultFilePath(i)),e}async showSaveConfirm(i){return this.skipDialogs()?(this.logService.trace("FileDialogService: refused to show save confirmation dialog in tests."),1):this.doShowSaveConfirm(i)}skipDialogs(){return this.environmentService.enableSmokeTestDriver&&this.logService.warn("DialogService: Dialog requested during smoke test."),this.environmentService.isExtensionDevelopment&&!!this.environmentService.extensionTestsLocationURI}async doShowSaveConfirm(i){if(i.length===0)return 1;let e,t=d(18808,null);i.length===1?e=d(18809,null,typeof i[0]=="string"?i[0]:Be(i[0])):(e=d(18810,null,i.length),t=fx(i)+`
`+t);let{result:o}=await this.dialogService.prompt({type:wt.Warning,message:e,detail:t,buttons:[{label:i.length>1?d(18806,null):d(18805,null),run:()=>0},{label:d(18798,null),run:()=>1}],cancelButton:{run:()=>2}});return o}addFileSchemaIfNeeded(i,e){return i===Q.untitled?[Q.file]:i!==Q.file?[i,Q.file]:[i]}async pickFileFolderAndOpenSimplified(i,e,t){let o=d(18802,null),n=this.addFileSchemaIfNeeded(i),s=(await this.pickResource({canSelectFiles:!0,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.defaultUri,title:o,availableFileSystems:n}))?.[0];if(s){let l=await this.fileService.stat(s),c=l.isDirectory?{folderUri:s}:{fileUri:s};!$ke(c)&&Seo(c)&&this.addFileToRecentlyOpened(c.fileUri),l.isDirectory||e.forceNewWindow||t?await this.hostService.openWindow([c],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority}):await this.editorService.openEditors([{resource:s,options:{source:1,pinned:!0}}],void 0,{validateTrust:!0})}}async pickFileAndOpenSimplified(i,e,t){let o=d(18801,null),n=this.addFileSchemaIfNeeded(i),s=(await this.pickResource({canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,defaultUri:e.defaultUri,title:o,availableFileSystems:n}))?.[0];s&&(this.addFileToRecentlyOpened(s),e.forceNewWindow||t?await this.hostService.openWindow([{fileUri:s}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority}):await this.editorService.openEditors([{resource:s,options:{source:1,pinned:!0}}],void 0,{validateTrust:!0}))}addFileToRecentlyOpened(i){this.workspacesService.addRecentlyOpened([{fileUri:i,label:this.labelService.getUriLabel(i,{appendWorkspaceSuffix:!0})}])}async pickFolderAndOpenSimplified(i,e){let t=d(18803,null),o=this.addFileSchemaIfNeeded(i,!0),r=(await this.pickResource({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:e.defaultUri,title:t,availableFileSystems:o}))?.[0];if(r)return this.hostService.openWindow([{folderUri:r}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority})}async pickWorkspaceAndOpenSimplified(i,e){let t=d(18804,null),o=[{name:d(18799,null),extensions:[OT]}],n=this.addFileSchemaIfNeeded(i,!0),s=(await this.pickResource({canSelectFiles:!0,canSelectFolders:!1,canSelectMany:!1,defaultUri:e.defaultUri,title:t,filters:o,availableFileSystems:n}))?.[0];if(s)return this.hostService.openWindow([{workspaceUri:s}],{forceNewWindow:e.forceNewWindow,remoteAuthority:e.remoteAuthority})}async pickFileToSaveSimplified(i,e){e.availableFileSystems||(e.availableFileSystems=this.addFileSchemaIfNeeded(i)),e.title=d(18811,null);let t=await this.saveRemoteResource(e);return t&&this.addFileToRecentlyOpened(t),t}async showSaveDialogSimplified(i,e){return e.availableFileSystems||(e.availableFileSystems=this.addFileSchemaIfNeeded(i)),this.saveRemoteResource(e)}async showOpenDialogSimplified(i,e){return e.availableFileSystems||(e.availableFileSystems=this.addFileSchemaIfNeeded(i,e.canSelectFolders)),this.pickResource(e)}getSimpleFileDialog(){return this.instantiationService.createInstance(P$e)}pickResource(i){return this.getSimpleFileDialog().showOpenDialog(i)}saveRemoteResource(i){return this.getSimpleFileDialog().showSaveDialog(i)}async isRemoteUserData(i){if(!this.environmentService.remoteAuthority)return!1;let e=await this.remoteAgentService.getEnvironment();if(e){let t=ai(ai(e.settingsPath));if(!ze(t,t.with({path:"/"}))&&Yr(i,t))return!0}return!1}getSchemeFilterForWindow(i){return i??this.pathService.defaultUriScheme}getAuthorityFilterForWindow(){return this.environmentService.remoteAuthority}getFileSystemSchema(i){return i.availableFileSystems?.[0]||this.getSchemeFilterForWindow(i.defaultUri?.scheme)}getWorkspaceAvailableFileSystems(i){if(i.availableFileSystems&&i.availableFileSystems.length>0)return i.availableFileSystems;let e=[Q.file];return this.environmentService.remoteAuthority&&e.unshift(Q.vscodeRemote),e}getPickFileToSaveDialogOptions(i,e){let t={defaultUri:i,title:d(18807,null),availableFileSystems:e},o=i?Ts(i):void 0,n,r=this.languageService.getSortedRegisteredLanguageNames(),s=ui(r.map(({languageName:l,languageId:c})=>{let u=this.languageService.getExtensions(c);if(!u.length)return null;let p={name:l,extensions:jo(u).slice(0,10).map(g=>CL(g,"."))},h=o||o3e;if(!n&&u.includes(h)){n=p;let g=CL(h,".");return p.extensions.includes(g)||p.extensions.unshift(g),null}return p}));return!n&&o&&(n={name:CL(o,".").toUpperCase(),extensions:[CL(o,".")]}),t.filters=ui([{name:d(18797,null),extensions:["*"]},n,...s,{name:d(18800,null),extensions:[""]}]),t}};V$e=I([m(0,ti),m(1,Ae),m(2,fa),m(3,Mt),m(4,F),m(5,B),m(6,ge),m(7,Je),m(8,ct),m(9,Rt),m(10,bm),m(11,nt),m(12,Pn),m(13,fe),m(14,ie),m(15,Qt),m(16,re),m(17,bo)],V$e);var dgt=class extends V$e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super(e,t,o,n,r,s,l,c,p,h,g,f,v,b,S,y,w,x);this.nativeHostService=u}toNativeOpenDialogOptions(e){return{forceNewWindow:e.forceNewWindow,telemetryExtraData:e.telemetryExtraData,defaultPath:e.defaultUri?.fsPath}}shouldUseSimplified(e){let t=this.configurationService.getValue("files.simpleDialog.enable")===!0,o=this.configurationService.getValue("window.openFilesInNewWindow")==="on";return{useSimplified:e!==Q.file&&e!==Q.vscodeUserData||t||!!this.environmentService.enableSmokeTestDriver,isSetting:o}}async pickFileFolderAndOpen(e){let t=this.getFileSystemSchema(e);e.defaultUri||(e.defaultUri=await this.defaultFilePath(t));let o=this.shouldUseSimplified(t);return o.useSimplified?this.pickFileFolderAndOpenSimplified(t,e,o.isSetting):this.nativeHostService.pickFileFolderAndOpen(this.toNativeOpenDialogOptions(e))}async pickFileAndOpen(e){let t=this.getFileSystemSchema(e);e.defaultUri||(e.defaultUri=await this.defaultFilePath(t));let o=this.shouldUseSimplified(t);return o.useSimplified?this.pickFileAndOpenSimplified(t,e,o.isSetting):this.nativeHostService.pickFileAndOpen(this.toNativeOpenDialogOptions(e))}async pickFolderAndOpen(e){let t=this.getFileSystemSchema(e);return e.defaultUri||(e.defaultUri=await this.defaultFolderPath(t)),this.shouldUseSimplified(t).useSimplified?this.pickFolderAndOpenSimplified(t,e):this.nativeHostService.pickFolderAndOpen(this.toNativeOpenDialogOptions(e))}async pickWorkspaceAndOpen(e){e.availableFileSystems=this.getWorkspaceAvailableFileSystems(e);let t=this.getFileSystemSchema(e);return e.defaultUri||(e.defaultUri=await this.defaultWorkspacePath(t)),this.shouldUseSimplified(t).useSimplified?this.pickWorkspaceAndOpenSimplified(t,e):this.nativeHostService.pickWorkspaceAndOpen(this.toNativeOpenDialogOptions(e))}async pickFileToSave(e,t){let o=this.getFileSystemSchema({defaultUri:e,availableFileSystems:t}),n=this.getPickFileToSaveDialogOptions(e,t);if(this.shouldUseSimplified(o).useSimplified)return this.pickFileToSaveSimplified(o,n);{let r=await this.nativeHostService.showSaveDialog(this.toNativeSaveDialogOptions(n));if(r&&!r.canceled&&r.filePath){let s=A.file(r.filePath);return this.addFileToRecentlyOpened(s),s}}}toNativeSaveDialogOptions(e){return e.defaultUri=e.defaultUri?A.file(e.defaultUri.path):void 0,{defaultPath:e.defaultUri?.fsPath,buttonLabel:typeof e.saveLabel=="string"?e.saveLabel:e.saveLabel?.withMnemonic,filters:e.filters,title:e.title,targetWindowId:zi().vscodeWindowId}}async showSaveDialog(e){let t=this.getFileSystemSchema(e);if(this.shouldUseSimplified(t).useSimplified)return this.showSaveDialogSimplified(t,e);let o=await this.nativeHostService.showSaveDialog(this.toNativeSaveDialogOptions(e));if(o&&!o.canceled&&o.filePath)return A.file(o.filePath)}async showOpenDialog(e){let t=this.getFileSystemSchema(e);if(this.shouldUseSimplified(t).useSimplified)return this.showOpenDialogSimplified(t,e);let o={title:e.title,defaultPath:e.defaultUri?.fsPath,buttonLabel:typeof e.openLabel=="string"?e.openLabel:e.openLabel?.withMnemonic,filters:e.filters,properties:[],targetWindowId:zi().vscodeWindowId};o.properties.push("createDirectory"),e.canSelectFiles&&o.properties.push("openFile"),e.canSelectFolders&&o.properties.push("openDirectory"),e.canSelectMany&&o.properties.push("multiSelections");let n=await this.nativeHostService.showOpenDialog(o);return n&&Array.isArray(n.filePaths)&&n.filePaths.length>0?n.filePaths.map(A.file):void 0}};dgt=I([m(0,ti),m(1,Ae),m(2,fa),m(3,Mt),m(4,F),m(5,B),m(6,ge),m(7,Je),m(8,wo),m(9,ct),m(10,Rt),m(11,bm),m(12,nt),m(13,Pn),m(14,fe),m(15,ie),m(16,Qt),m(17,re),m(18,bo)],dgt);Ce(nn,dgt,1);var ugt=class{constructor(i,e){return Xd.toService(i.getChannel("workspaces"),{context:e.windowId})}};ugt=I([m(0,rm),m(1,wo)],ugt);Ce(bm,ugt,1);var VZt=le("menubarService");_w(VZt,"menubar");var BZt=class{constructor(i){this.channel=i;this.disposables=new O;this._onStateChange=this.disposables.add(new T);this.onStateChange=this._onStateChange.event;this._state=kdo.Uninitialized;this.disposables.add(this.channel.listen("onStateChange")(e=>this.state=e)),this.channel.call("_getInitialState").then(e=>this.state=e)}get state(){return this._state}set state(i){this._state=i,this._onStateChange.fire(i)}checkForUpdates(i){return this.channel.call("checkForUpdates",i)}downloadUpdate(i){return this.channel.call("downloadUpdate",i)}applyUpdate(){return this.channel.call("applyUpdate")}quitAndInstall(){return this.channel.call("quitAndInstall")}isLatestVersion(){return this.channel.call("isLatestVersion")}_applySpecificUpdate(i){return this.channel.call("_applySpecificUpdate",i)}setInternalOrg(i){return this.channel.call("setInternalOrg",i)}dispose(){this.disposables.dispose()}};_w(Lp,"update",{channelClientCtor:BZt});var HZt=class{constructor(i){this.handler=i}listen(i,e){throw new Error(`Event not found: ${e}`)}call(i,e,t){if(e==="handleURL")return this.handler.handleURL(A.revive(t[0]),t[1]);throw new Error(`Call not found: ${e}`)}};var lji=class extends k{constructor(){super(...arguments);this.handlers=new Set}open(e,t){let o=[...this.handlers.values()];return Ule(o.map(n=>()=>n.handleURL(e,t)),void 0,!1).then(n=>n||!1)}registerHandler(e){return this.handlers.add(e),ee(()=>this.handlers.delete(e))}},B$e=class extends lji{constructor(e){super();this.productService=e}create(e){let{authority:t,path:o,query:n,fragment:r}=e||{authority:void 0,path:void 0,query:void 0,fragment:void 0};return t&&o&&o.indexOf("/")!==0&&(o=`/${o}`),A.from({scheme:this.productService.urlProtocol,authority:t,path:o,query:n,fragment:r})}};B$e=I([m(0,Ze)],B$e);var pgt=class extends B$e{constructor(e,t,o,n,r){super(n);this.nativeHostService=o;this.logService=r;this.urlService=Xd.toService(e.getChannel("url")),e.registerChannel("urlHandler",new HZt(this)),t.registerOpener(this)}create(e){let t=super.create(e),o=t.query;return o?o+=`&windowId=${encodeURIComponent(this.nativeHostService.windowId)}`:o=`windowId=${encodeURIComponent(this.nativeHostService.windowId)}`,t.with({query:o})}async open(e,t){return hc(e,this.productService.urlProtocol)?(typeof e=="string"&&(e=A.parse(e)),await this.urlService.open(e,t)):!1}async handleURL(e,t){let o=await super.open(e,t);return o?(this.logService.trace("URLService#handleURL(): handled",e.toString(!0)),await this.nativeHostService.focusWindow({mode:2,targetWindowId:this.nativeHostService.windowId})):this.logService.trace("URLService#handleURL(): not handled",e.toString(!0)),o}};pgt=I([m(0,rm),m(1,Je),m(2,wo),m(3,Ze),m(4,re)],pgt);Ce(tS,pgt,0);function UZt(a,i){if(a.length===0)return Promise.resolve(!1);let e=[],t=!1;for(let o of a){if(o===!0)return Promise.resolve(!0);aD(o)&&e.push(o.then(n=>{n&&(t=!0)},n=>{i(n),t=!0}))}return vn.settled(e).then(()=>t)}var Sj=class extends k{constructor(e,t){super();this.logService=e;this.storageService=t;this._onBeforeShutdown=this._register(new T);this.onBeforeShutdown=this._onBeforeShutdown.event;this._onWillShutdown=this._register(new T);this.onWillShutdown=this._onWillShutdown.event;this._onDidShutdown=this._register(new T);this.onDidShutdown=this._onDidShutdown.event;this._onBeforeShutdownError=this._register(new T);this.onBeforeShutdownError=this._onBeforeShutdownError.event;this._onShutdownVeto=this._register(new T);this.onShutdownVeto=this._onShutdownVeto.event;this._phase=1;this._willShutdown=!1;this.phaseWhen=new Map;this._startupKind=this.resolveStartupKind(),this._register(this.storageService.onWillSaveState(o=>{o.reason===1&&this.storageService.store(Sj.LAST_SHUTDOWN_REASON_KEY,this.shutdownReason,1,1)}))}static{this.LAST_SHUTDOWN_REASON_KEY="lifecyle.lastShutdownReason"}get startupKind(){return this._startupKind}get phase(){return this._phase}get willShutdown(){return this._willShutdown}resolveStartupKind(){let e=this.doResolveStartupKind()??1;return this.logService.trace(`[lifecycle] starting up (startup kind: ${e})`),e}doResolveStartupKind(){let e=this.storageService.getNumber(Sj.LAST_SHUTDOWN_REASON_KEY,1);this.storageService.remove(Sj.LAST_SHUTDOWN_REASON_KEY,1);let t;switch(e){case 3:t=3;break;case 4:t=4;break}return t}set phase(e){if(e<this.phase)throw new Error("Lifecycle cannot go backwards");if(this._phase===e)return;this.logService.trace(`lifecycle: phase changed (value: ${e})`),this._phase=e,Wo(`code/LifecyclePhase/${xno(e)}`);let t=this.phaseWhen.get(this._phase);t&&(t.open(),this.phaseWhen.delete(this._phase))}async when(e){if(e<=this._phase)return;let t=this.phaseWhen.get(e);t||(t=new ip,this.phaseWhen.set(e,t)),await t.wait()}};Sj=I([m(0,re),m(1,de)],Sj);var Uae=class extends Sj{constructor(e,t,o){super(o,t);this.nativeHostService=e;this.registerListeners()}static{this.BEFORE_SHUTDOWN_WARNING_DELAY=5e3}static{this.WILL_SHUTDOWN_WARNING_DELAY=800}registerListeners(){let e=this.nativeHostService.windowId;Xl.on("vscode:onBeforeUnload",async(t,...o)=>{let n=o[0];this.logService.trace(`[lifecycle] onBeforeUnload (reason: ${n.reason})`),await this.handleBeforeShutdown(n.reason)?(this.logService.trace("[lifecycle] onBeforeUnload prevented via veto"),this._onShutdownVeto.fire(),Xl.send(n.cancelChannel,e)):(this.logService.trace("[lifecycle] onBeforeUnload continues without veto"),this.shutdownReason=n.reason,Xl.send(n.okChannel,e))}),Xl.on("vscode:onWillUnload",async(t,...o)=>{let n=o[0];this.logService.trace(`[lifecycle] onWillUnload (reason: ${n.reason})`),await this.handleWillShutdown(n.reason),this._onDidShutdown.fire(),Xl.send(n.replyChannel,e)})}async handleBeforeShutdown(e){let t=this.logService,o=[],n=new Set,r,s;this._onBeforeShutdown.fire({reason:e,veto(c,u){o.push(c),c===!0?t.info(`[lifecycle]: Shutdown was prevented (id: ${u})`):c instanceof Promise&&(n.add(u),c.then(p=>{p===!0&&t.info(`[lifecycle]: Shutdown was prevented (id: ${u})`)}).finally(()=>n.delete(u)))},finalVeto(c,u){if(!r)r=c,s=u;else throw new Error(`[lifecycle]: Final veto is already defined (id: ${u})`)}});let l=Zo(()=>{t.warn(`[lifecycle] onBeforeShutdown is taking a long time, pending operations: ${Array.from(n).join(", ")}`)},Uae.BEFORE_SHUTDOWN_WARNING_DELAY);try{let c=await UZt(o,u=>this.handleBeforeShutdownError(u,e));if(c)return c;if(r)try{n.add(s),c=await r(),c&&t.info(`[lifecycle]: Shutdown was prevented by final veto (id: ${s})`)}catch(u){c=!0,this.handleBeforeShutdownError(u,e)}return c}finally{l.dispose()}}handleBeforeShutdownError(e,t){this.logService.error(`[lifecycle]: Error during before-shutdown phase (error: ${Mn(e)})`),this._onBeforeShutdownError.fire({reason:t,error:e})}async handleWillShutdown(e){this._willShutdown=!0;let t=[],o=[],n=new Set,r=new qe;this._onWillShutdown.fire({reason:e,token:r.token,joiners:()=>Array.from(n.values()),join(l,c){if(n.add(c),c.order===2){let u=typeof l=="function"?l:()=>l;o.push(()=>u().finally(()=>n.delete(c)))}else{let u=typeof l=="function"?l():l;u.finally(()=>n.delete(c)),t.push(u)}},force:()=>{r.dispose(!0)}});let s=Zo(()=>{this.logService.warn(`[lifecycle] onWillShutdown is taking a long time, pending operations: ${Array.from(n).map(l=>l.id).join(", ")}`)},Uae.WILL_SHUTDOWN_WARNING_DELAY);try{await Ea(vn.settled(t),r.token)}catch(l){this.logService.error(`[lifecycle]: Error during will-shutdown phase in default joiners (error: ${Mn(l)})`)}try{await Ea(vn.settled(o.map(l=>l())),r.token)}catch(l){this.logService.error(`[lifecycle]: Error during will-shutdown phase in last joiners (error: ${Mn(l)})`)}s.dispose()}shutdown(){return this.nativeHostService.closeWindow()}};Uae=I([m(0,wo),m(1,de),m(2,re)],Uae);Ce(to,Uae,0);var VMn="chat.disableAIFeatures",BMn="chat.agentsControl.enabled",H$e=class{constructor(i,e,t,o){this._disposables=new O;this._onDidChangeVisibility=this._disposables.add(new T);this.onDidChangeVisibility=this._onDidChangeVisibility.event;this.element=document.createElement("div");this.element.classList.add("command-center");let n=t.createInstance(pr,this.element,R.CommandCenter,{contextMenu:R.TitleBarContext,hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},telemetrySource:"commandCenter",actionViewItemProvider:(s,l)=>s instanceof id&&s.item.submenu===R.CommandCenterCenter?t.createInstance(rye,s,i,{...l,hoverDelegate:e}):ta(t,s,{...l,hoverDelegate:e})}),r=!1;this._disposables.add(U.filter(o.onShow,()=>Nbt(this.element),this._disposables)(()=>{r=!0,this._setVisibility(o.alignment.get()!=="top")})),this._disposables.add(o.onHide(()=>{r=!1,this._setVisibility(!0)})),this._disposables.add(ve(s=>{let l=o.alignment.read(s);r&&this._setVisibility(l!=="top")})),this._disposables.add(n)}_setVisibility(i){this.element.classList.toggle("hide",!i),this._onDidChangeVisibility.fire()}dispose(){this._disposables.dispose()}};H$e=I([m(2,F),m(3,$e)],H$e);var rye=class extends Ja{constructor(e,t,o,n,r,s,l,c){super(void 0,e.actions.find(u=>u.id==="workbench.action.quickOpenWithModes")??e.actions[0],o);this._submenu=e;this._windowTitle=t;this._hoverService=n;this._keybindingService=r;this._instaService=s;this._editorGroupService=l;this._configurationService=c;this._hoverDelegate=o.hoverDelegate??yi("mouse")}static{this._quickOpenCommandId="workbench.action.quickOpenWithModes"}render(e){super.render(e),e.classList.add("command-center-center"),e.classList.toggle("multiple",this._submenu.actions.length>1);let t=this._store.add(this._hoverService.setupManagedHover(this._hoverDelegate,e,this.getTooltip()));this._store.add(this._windowTitle.onDidChange(()=>{t.update(this.getTooltip())}));let o=[];for(let n of this._submenu.actions)n instanceof sa?o.push(n.actions):o.push([n]);for(let n=0;n<o.length;n++){let r=o[n],s=this._instaService.createInstance(dl,e,{hiddenItemStrategy:-1,telemetrySource:"commandCenterCenter",actionViewItemProvider:(l,c)=>{if(c={...c,hoverDelegate:this._hoverDelegate},l.id!==rye._quickOpenCommandId)return ta(this._instaService,l,c);let u=this;return this._instaService.createInstance(class extends Ja{constructor(){super(void 0,l,c)}render(h){super.render(h),h.classList.toggle("command-center-quick-pick"),h.role="button",h.setAttribute("aria-description",this.getTooltip());let g=u._configurationService.getValue(VMn)===!0,f=u._configurationService.getValue("disableAICustomizations")===!0||u._configurationService.getValue("workbench.disableAICustomizations")===!0,v=g&&f,b=u._configurationService.getValue(BMn),S=!v&&(b===!0||b===void 0||b==="compact");h.classList.toggle("compact-mode",S);let y=this.action,w=document.createElement("span");w.ariaHidden="true",w.className=y.class??"",w.classList.add("search-icon");let x=this._getLabel(),E=document.createElement("span");E.classList.add("search-label"),E.textContent=x,S?Ii(h,E):Ii(h,w,E);let M=this._store.add(u._hoverService.setupManagedHover(u._hoverDelegate,h,this.getTooltip()));this._store.add(u._windowTitle.onDidChange(()=>{M.update(this.getTooltip()),E.textContent=this._getLabel()})),this._store.add(u._editorGroupService.onDidChangeEditorPartOptions(({newPartOptions:N,oldPartOptions:V})=>{N.showTabs!==V.showTabs&&(M.update(this.getTooltip()),E.textContent=this._getLabel())}))}getTooltip(){return u.getTooltip()}_getLabel(){let{prefix:h,suffix:g}=u._windowTitle.getTitleDecorations(),f=u._windowTitle.workspaceName;return u._windowTitle.isCustomTitleFormat()?f=u._windowTitle.getWindowTitle():u._editorGroupService.partOptions.showTabs==="none"&&(f=u._windowTitle.fileName??f),f||(f=d(5105,null)),h&&(f=d(5106,null,h,f)),g&&(f=d(5107,null,f,g)),f.replaceAll(/\r\n|\r|\n/g,"\u23CE")}})}});if(s.setActions(r),this._store.add(s),n<o.length-1){let l=un(L.circleSmallFilled);l.style.padding="0 8px",l.style.height="100%",l.style.opacity="0.5",e.appendChild(l)}}}getTooltip(){let e=this._keybindingService.lookupKeybinding(this.action.id)?.getLabel();return e?d(5108,null,this._windowTitle.workspaceName,e,this._windowTitle.value):d(5109,null,this._windowTitle.workspaceName,this._windowTitle.value)}};rye=I([m(3,ot),m(4,Le),m(5,F),m(6,kt),m(7,B)],rye);be.appendMenuItem(R.CommandCenter,{submenu:R.CommandCenterCenter,title:d(5110,null),icon:L.shield,order:101});var U$e=class extends Fte{constructor(e,t,o){super("workbench.titleService",o,t);this.instantiationService=e;this.properties=void 0;this.variables=new Map;this.mainPart=this._register(this.createMainTitlebarPart()),this.onMenubarVisibilityChange=this.mainPart.onMenubarVisibilityChange,this._register(this.registerPart(this.mainPart)),this.registerActions(),this.registerAPICommands()}createMainTitlebarPart(){return this.instantiationService.createInstance(mgt)}registerActions(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.action.focusTitleBar",title:P(5147,"Focus Title Bar"),category:Fe.View,f1:!0,precondition:w3})}run(){e.getPartByDocument(_m())?.focus()}}))}registerAPICommands(){this._register(Ge.registerCommand({id:"registerWindowTitleVariable",handler:(e,t,o)=>{this.registerVariables([{name:t,contextKey:o}])},metadata:{description:"Registers a new title variable",args:[{name:"name",schema:{type:"string"},description:"The name of the variable to register"},{name:"contextKey",schema:{type:"string"},description:"The context key to use for the value of the variable"}]}}))}createAuxiliaryTitlebarPart(e,t,o){let n=_(".part.titlebar",{role:"none"});n.style.position="relative",e.insertBefore(n,e.firstChild);let r=new O,s=this.doCreateAuxiliaryTitlebarPart(n,t,o);return r.add(this.registerPart(s)),r.add(U.runAndSubscribe(s.onDidChange,()=>n.style.height=`${s.height}px`)),s.create(n),this.properties&&s.updateProperties(this.properties),this.variables.size&&s.registerVariables(Array.from(this.variables.values())),U.once(s.onWillDispose)(()=>r.dispose()),s}doCreateAuxiliaryTitlebarPart(e,t,o){return o.createInstance(sye,e,t,this.mainPart)}updateProperties(e){this.properties=e;for(let t of this.parts)t.updateProperties(e)}registerVariables(e){let t=[];for(let o of e)this.variables.has(o.name)||(this.variables.set(o.name,o),t.push(o));for(let o of this.parts)o.registerVariables(t)}get windowTitle(){return this.mainPart.windowTitle}};U$e=I([m(0,F),m(1,de),m(2,Pe)],U$e);var zae=class extends k_{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,{hasTitle:!1},c,u,p);this.editorGroupsContainer=o;this.contextMenuService=n;this.configurationService=r;this.environmentService=s;this.storageService=u;this.contextKeyService=h;this.hostService=g;this.menuService=v;this.keybindingService=b;this.actionViewItemService=S;this.minimumWidth=0;this.maximumWidth=Number.POSITIVE_INFINITY;this._onMenubarVisibilityChange=this._register(new T);this.onMenubarVisibilityChange=this._onMenubarVisibilityChange.event;this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this.customMenubar=this._register(new ue);this.actionToolBarDisposable=this._register(new O);this.editorActionsChangeDisposable=this._register(new O);this.centerAdjacentToolBarDisposable=this._register(new O);this.globalToolbarMenuDisposables=this._register(new O);this.editorToolbarMenuDisposables=this._register(new O);this.layoutToolbarMenuDisposables=this._register(new O);this.activityToolbarDisposables=this._register(new O);this.titleDisposables=this._register(new O);this.isInactive=!1;this.isCompact=!1;let y=f.createScoped(o,this._store);this.instantiationService=this._register(l.createChild(new Po([ie,y]))),this.isAuxiliary=t.vscodeWindowId!==ut.vscodeWindowId,this.isCompactContextKey=N0.bindTo(this.contextKeyService),this.titleBarStyle=oJ(this.configurationService),this.windowTitle=this._register(this.instantiationService.createInstance(CR,t)),this.hoverDelegate=this._register(Dg()),this.registerListeners(hv(t))}get minimumHeight(){let e=Ft&&_le(),t=this.isCommandCenterVisible||e?nJ:30;return e&&(t=Math.max(t,L3i(Me(this.element))?.height??0)),t/(this.preventZoom?uv(Me(this.element)):1)}get maximumHeight(){return this.minimumHeight}registerListeners(e){this._register(this.hostService.onDidChangeFocus(t=>t?this.onFocus():this.onBlur())),this._register(this.hostService.onDidChangeActiveWindow(t=>t===e?this.onFocus():this.onBlur())),this._register(this.configurationService.onDidChangeConfiguration(t=>this.onConfigurationChanged(t))),this._register(this.editorGroupsContainer.onDidChangeEditorPartOptions(t=>this.onEditorPartConfigurationChange(t)))}onBlur(){this.isInactive=!0,this.updateStyles()}onFocus(){this.isInactive=!1,this.updateStyles()}onEditorPartConfigurationChange({oldPartOptions:e,newPartOptions:t}){(e.editorActionsLocation!==t.editorActionsLocation||e.showTabs!==t.showTabs)&&JF(this.configurationService,this.titleBarStyle)&&this.actionToolBar&&(this.createActionToolBar(),this.createActionToolBarMenus({editorActions:!0}),this._onDidChange.fire(void 0))}onConfigurationChanged(e){if(!this.isAuxiliary&&!XF(this.configurationService,this.titleBarStyle)&&(!et||Ft)&&e.affectsConfiguration("window.menuBarVisibility")&&(this.currentMenubarVisibility==="compact"?this.uninstallMenubar():this.installMenubar()),JF(this.configurationService,this.titleBarStyle)&&this.actionToolBar){let t=e.affectsConfiguration("workbench.layoutControl.enabled"),o=e.affectsConfiguration("workbench.activityBar.location");(t||o)&&(this.createActionToolBarMenus({layoutActions:t,activityActions:o}),this._onDidChange.fire(void 0))}e.affectsConfiguration("window.commandCenter")&&this.recreateTitle()}recreateTitle(){this.createTitle(),this._onDidChange.fire(void 0)}updateOptions(e){let t=this.isCompact;this.isCompact=e.compact,this.isCompactContextKey.set(this.isCompact),t!==this.isCompact&&(this.recreateTitle(),this.createActionToolBarMenus(!0))}installMenubar(){this.menubar||(this.customMenubar.value=this.instantiationService.createInstance(qte),this.menubar=D(this.leftContent,_("div.menubar")),this.menubar.setAttribute("role","menubar"),this._register(this.customMenubar.value.onVisibilityChange(e=>this.onMenubarVisibilityChanged(e))),this.customMenubar.value.create(this.menubar))}uninstallMenubar(){this.customMenubar.value=void 0,this.menubar?.remove(),this.menubar=void 0,this.onMenubarVisibilityChanged(!1)}onMenubarVisibilityChanged(e){(Ft||ii||Sn)&&(this.lastLayoutDimensions&&this.layout(this.lastLayoutDimensions.width,this.lastLayoutDimensions.height),this._onMenubarVisibilityChange.fire(e))}updateProperties(e){this.windowTitle.updateProperties(e)}registerVariables(e){this.windowTitle.registerVariables(e)}createContentArea(e){if(this.element=e,this.rootContainer=D(e,_(".titlebar-container")),this.leftContent=D(this.rootContainer,_(".titlebar-left")),this.centerContent=D(this.rootContainer,_(".titlebar-center")),this.rightContent=D(this.rootContainer,_(".titlebar-right")),(ii||Sn)&&!yx(this.configurationService,this.titleBarStyle)&&(this.appIcon=CI(this.leftContent,_("a.window-appicon"))),this.dragRegion=CI(this.rootContainer,_("div.titlebar-drag-region")),!this.isAuxiliary&&!XF(this.configurationService,this.titleBarStyle)&&(!et||Ft)&&this.currentMenubarVisibility!=="compact"&&this.installMenubar(),this.title=D(this.centerContent,_("div.window-title")),this.createTitle(),JF(this.configurationService,this.titleBarStyle)){let t=D(this.rightContent,_("div.center-adjacent-toolbar-container"));this.centerAdjacentToolBarDisposable.add(this.instantiationService.createInstance(pr,t,R.TitleBarAdjacentCenter,{contextMenu:R.TitleBarContext,hiddenItemStrategy:-1,toolbarOptions:{primaryGroup:()=>!0},actionViewItemProvider:(o,n)=>ta(this.instantiationService,o,n),hoverDelegate:this.hoverDelegate}))}if(JF(this.configurationService,this.titleBarStyle)&&(this.actionToolBarElement=D(this.rightContent,_("div.action-toolbar-container")),this.createActionToolBar(),this.createActionToolBarMenus()),!yx(this.configurationService,this.titleBarStyle)){let t=et?"left":"right";if(et&&Qr){let n=nd.Locale(v3i).value.textInfo;n&&typeof n=="object"&&"direction"in n&&n.direction==="rtl"&&(t="right")}et&&Qr&&t==="left"||_Qe(this.configurationService)==="hidden"||(this.windowControlsContainer=D(t==="left"?this.leftContent:this.rightContent,_("div.window-controls-container")),Ft&&D(t==="left"?this.rightContent:this.leftContent,_("div.window-controls-container")),_le()&&this.windowControlsContainer.classList.add("wco-enabled"))}return this._register($(this.rootContainer,ne.CONTEXT_MENU,t=>{Kt.stop(t);let o;et&&go(t.target)&&ms(t.target,this.title)?o=R.TitleBarTitleContext:o=R.TitleBarContext,this.onContextMenu(t,o)})),et&&this._register($(this.title,ne.MOUSE_DOWN,t=>{t.metaKey&&(Kt.stop(t,!0),this.onContextMenu(t,R.TitleBarTitleContext))},!0)),this.updateStyles(),this.element}createTitle(){this.titleDisposables.clear();let e=yx(this.configurationService,this.titleBarStyle);if(!this.isCommandCenterVisible)e?Ii(this.title):(this.title.textContent=this.windowTitle.value,this.titleDisposables.add(this.windowTitle.onDidChange(()=>{this.title.textContent=this.windowTitle.value,this.lastLayoutDimensions&&this.updateLayout(this.lastLayoutDimensions)})));else{let t=this.instantiationService.createInstance(H$e,this.windowTitle,this.hoverDelegate);Ii(this.title,t.element),this.titleDisposables.add(t)}}actionViewItemProvider(e,t){for(let n of[R.TitleBar,R.LayoutControlMenu]){let r=this.actionViewItemService.lookUp(n,e.id);if(r){let s=r(e,t,this.instantiationService,hv(this.element?Me(this.element):ut));if(s)return s}}if(!this.isAuxiliary){if(e.id===wU)return this.instantiationService.createInstance(WPe,{position:()=>2},t);if(e.id===CU)return this.instantiationService.createInstance(FPe,{position:()=>2},t)}let o=this.editorGroupsContainer.activeGroup?.activeEditorPane;if(o&&o instanceof zs){let n=o.getActionViewItem(e,t);if(n)return n}return ta(this.instantiationService,e,{...t,menuAsChild:!1})}getKeybinding(e){let t=this.editorGroupsContainer.activeGroup?.activeEditorPane?.scopedContextKeyService??this.contextKeyService;return this.keybindingService.lookupKeybinding(e.id,t)}createActionToolBar(){this.actionToolBarDisposable.clear(),this.actionToolBar=this.actionToolBarDisposable.add(this.instantiationService.createInstance(dl,this.actionToolBarElement,{contextMenu:R.TitleBarContext,orientation:0,ariaLabel:d(5146,null),getKeyBinding:e=>this.getKeybinding(e),overflowBehavior:{maxItems:9,exempted:[CU,wU,...JVt]},anchorAlignmentProvider:()=>1,telemetrySource:"titlePart",highlightToggledItems:this.editorActionsEnabled||this.isAuxiliary,actionViewItemProvider:(e,t)=>this.actionViewItemProvider(e,t),hoverDelegate:this.hoverDelegate})),this.editorActionsEnabled&&this.actionToolBarDisposable.add(this.editorGroupsContainer.onDidChangeActiveGroup(()=>this.createActionToolBarMenus({editorActions:!0})))}createActionToolBarMenus(e=!0){e===!0&&(e={editorActions:!0,layoutActions:!0,globalActions:!0,activityActions:!0});let t=()=>{let o={primary:[],secondary:[]};if(this.editorActionsEnabled){this.editorActionsChangeDisposable.clear();let n=this.editorGroupsContainer.activeGroup;if(n){let r=n.createEditorActions(this.editorActionsChangeDisposable,this.isAuxiliary&&this.isCompact?R.CompactWindowEditorTitle:R.EditorTitle);o.primary.push(...r.actions.primary),o.secondary.push(...r.actions.secondary),this.editorActionsChangeDisposable.add(r.onDidChange(()=>t()))}}if(this.globalToolbarMenu){let n={primary:[],secondary:[]};$B(this.globalToolbarMenu.getActions(),n,r=>r===Blt),o.primary.push(...n.primary)}if(this.layoutToolbarMenu&&$B(this.layoutToolbarMenu.getActions(),o,()=>!this.editorActionsEnabled||this.isCompact),this.globalToolbarMenu){let n=this.globalToolbarMenu.getActions().filter(([r])=>r!==Blt);$B(n,o)}this.activityActionsEnabled&&(lit(this.storageService)&&o.primary.push(QRo),o.primary.push(YRo)),this.actionToolBar.setActions(Kk(o.primary),Kk(o.secondary))};if(e.editorActions)if(this.editorToolbarMenuDisposables.clear(),this.editorActionsEnabled&&this.editorGroupsContainer.activeGroup?.activeEditor){let o={groupId:this.editorGroupsContainer.activeGroup.id};this.actionToolBar.actionRunner=this.editorToolbarMenuDisposables.add(new Ute(o)),this.actionToolBar.context=o}else this.actionToolBar.actionRunner=this.editorToolbarMenuDisposables.add(new cs),this.actionToolBar.context=void 0;e.layoutActions&&(this.layoutToolbarMenuDisposables.clear(),this.layoutControlEnabled?(this.layoutToolbarMenu=this.menuService.createMenu(R.LayoutControlMenu,this.contextKeyService),this.layoutToolbarMenuDisposables.add(this.layoutToolbarMenu),this.layoutToolbarMenuDisposables.add(this.layoutToolbarMenu.onDidChange(()=>t()))):this.layoutToolbarMenu=void 0),e.globalActions&&(this.globalToolbarMenuDisposables.clear(),this.globalActionsEnabled?(this.globalToolbarMenu=this.menuService.createMenu(R.TitleBar,this.contextKeyService),this.globalToolbarMenuDisposables.add(this.globalToolbarMenu),this.globalToolbarMenuDisposables.add(this.globalToolbarMenu.onDidChange(()=>t()))):this.globalToolbarMenu=void 0),e.activityActions&&(this.activityToolbarDisposables.clear(),this.activityActionsEnabled&&this.activityToolbarDisposables.add(this.storageService.onDidChangeValue(0,kU.ACCOUNTS_VISIBILITY_PREFERENCE_KEY,this._store)(()=>t()))),t()}updateStyles(){if(super.updateStyles(),this.element){this.isInactive?this.element.classList.add("inactive"):this.element.classList.remove("inactive");let e=this.getColor(this.isInactive?mso:uZ,(n,r)=>n.isOpaque()?n:n.makeOpaque(_0(r)))||"";this.element.style.backgroundColor=e,this.appIconBadge&&(this.appIconBadge.style.backgroundColor=e),e&&Ue.fromHex(e).isLighter()?this.element.classList.add("light"):this.element.classList.remove("light");let t=this.getColor(this.isInactive?xMt:T0);this.element.style.color=t||"";let o=this.getColor(kMt);this.element.style.borderBottom=o?`1px solid ${o}`:""}}onContextMenu(e,t){let o=new Ln(Me(this.element),e);this.contextMenuService.showContextMenu({getAnchor:()=>o,menuId:t,contextKeyService:this.contextKeyService,domForShadowRoot:et&&Qr?o.target:void 0})}get currentMenubarVisibility(){return this.isAuxiliary?"hidden":sM(this.configurationService)}get layoutControlEnabled(){return this.configurationService.getValue("workbench.layoutControl.enabled")!==!1}get isCommandCenterVisible(){return!this.isCompact&&this.configurationService.getValue("window.commandCenter")!==!1}get editorActionsEnabled(){return this.editorGroupsContainer.partOptions.editorActionsLocation==="titleBar"||this.editorGroupsContainer.partOptions.editorActionsLocation==="default"&&this.editorGroupsContainer.partOptions.showTabs==="none"}get activityActionsEnabled(){let e=this.configurationService.getValue("workbench.activityBar.location");return!this.isCompact&&!this.isAuxiliary&&(e==="top"||e==="bottom")}get globalActionsEnabled(){return!this.isCompact}get hasZoomableElements(){let e=!(this.currentMenubarVisibility==="hidden"||this.currentMenubarVisibility==="compact"||!Ft&&et),t=this.isCommandCenterVisible,o=this.globalActionsEnabled||this.layoutControlEnabled||this.editorActionsEnabled||this.activityActionsEnabled;return e||t||o}get preventZoom(){return uv(Me(this.element))<1||!this.hasZoomableElements}layout(e,t){this.updateLayout(new di(e,t)),super.layoutContents(e,t)}updateLayout(e){if(this.lastLayoutDimensions=e,!JF(this.configurationService,this.titleBarStyle))return;let t=uv(Me(this.element));if(this.element.style.setProperty("--zoom-factor",t.toString()),this.rootContainer.classList.toggle("counter-zoom",this.preventZoom),this.customMenubar.value){let n=new di(0,e.height);this.customMenubar.value.layout(n)}let o=this.isCommandCenterVisible||this.title.textContent!=="";this.rootContainer.classList.toggle("has-center",o)}focus(){this.customMenubar.value?this.customMenubar.value.toggleFocus():this.element.querySelector('[tabindex]:not([tabindex="-1"])')?.focus()}toJSON(){return{type:"workbench.parts.titlebar"}}dispose(){this._onWillDispose.fire(),super.dispose()}};zae=I([m(3,Xe),m(4,B),m(5,Od),m(6,F),m(7,Pe),m(8,de),m(9,wi),m(10,X),m(11,ti),m(12,ie),m(13,Yt),m(14,Le),m(15,sh)],zae);var mgt=class extends zae{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){super("workbench.parts.titlebar",ut,u.mainPart,i,e,t,o,n,r,s,l,c,p,h,g,f)}};mgt=I([m(0,Xe),m(1,B),m(2,Od),m(3,F),m(4,Pe),m(5,de),m(6,wi),m(7,X),m(8,ti),m(9,kt),m(10,ie),m(11,Yt),m(12,Le),m(13,sh)],mgt);var sye=class extends zae{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){let w=sye.COUNTER++;super(`workbench.parts.auxiliaryTitle.${w}`,Me(e),t,n,r,s,l,c,u,p,h,g,v,b,S,y);this.container=e;this.mainTitlebar=o}static{this.COUNTER=1}get height(){return this.minimumHeight}get preventZoom(){return uv(Me(this.element))<1||!this.mainTitlebar.hasZoomableElements}};sye=I([m(3,Xe),m(4,B),m(5,Od),m(6,F),m(7,Pe),m(8,de),m(9,wi),m(10,X),m(11,ti),m(12,kt),m(13,ie),m(14,Yt),m(15,Le),m(16,sh)],sye);var z$e=class extends ait{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,t,o,n,r,s,l,c,u,p,h,g,v,S);this.menubarService=f;this.nativeHostService=b;(async()=>(this.recentlyOpened=await this.workspacesService.getRecentlyOpened(),this.doUpdateMenubar()))(),this.registerListeners()}setupMainMenu(){super.setupMainMenu();for(let e of Object.keys(this.topLevelTitles)){let t=this.menus[e];t&&this.mainMenuDisposables.add(t.onDidChange(()=>this.updateMenubar()))}}doUpdateMenubar(){if(!this.hostService.hasFocus)return;let e={menus:{},keybindings:{}};this.getMenubarMenus(e)&&this.menubarService.updateMenubar(this.nativeHostService.windowId,e)}getMenubarMenus(e){if(!e)return!1;e.keybindings=this.getAdditionalKeybindings();for(let t of Object.keys(this.topLevelTitles)){let o=this.menus[t];if(o){let n={items:[]},r=Lu(o.getActions({shouldForwardArgs:!0}));if(this.populateMenuItems(r,n,e.keybindings),n.items.length===0)return!1;e.menus[t]=n}}return!0}populateMenuItems(e,t,o){for(let n of e)if(n instanceof oi)t.items.push({id:"vscode.menubar.separator"});else if(n instanceof Do||n instanceof id){let r=typeof n.item.title=="string"?n.item.title:n.item.title.mnemonicTitle??n.item.title.value;if(n instanceof id){let s={items:[]};if(this.populateMenuItems(n.actions,s,o),s.items.length>0){let l={id:n.id,label:r,submenu:s};t.items.push(l)}}else{if(n.id===yW.ID){let l=this.getOpenRecentActions().map(this.transformOpenRecentAction);t.items.push(...l)}let s={id:n.id,label:r};Uke(n.item.toggled)&&(s.label=n.item.toggled.mnemonicTitle??n.item.toggled.title??r),n.checked&&(s.checked=!0),n.enabled||(s.enabled=!1),o[n.id]=this.getMenubarKeybinding(n.id),t.items.push(s)}}}transformOpenRecentAction(e){return e instanceof oi?{id:"vscode.menubar.separator"}:{id:e.id,uri:e.uri,remoteAuthority:e.remoteAuthority,enabled:e.enabled,label:e.label}}getAdditionalKeybindings(){let e={};if(et){let t=this.getMenubarKeybinding("workbench.action.quit");t&&(e["workbench.action.quit"]=t)}return e}getMenubarKeybinding(e){let t=this.keybindingService.lookupKeybinding(e);if(!t)return;let o=t.getElectronAccelerator();if(o)return{label:o,userSettingsLabel:t.getUserSettingsLabel()??void 0};let n=t.getLabel();if(n)return{label:n,isNative:!1,userSettingsLabel:t.getUserSettingsLabel()??void 0}}};z$e=I([m(0,Yt),m(1,bm),m(2,X),m(3,Le),m(4,B),m(5,nt),m(6,Lp),m(7,de),m(8,Ne),m(9,Qo),m(10,Jr),m(11,Ai),m(12,VZt),m(13,ti),m(14,wo),m(15,fe)],z$e);var K$e=class extends zae{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(e,t,o,n,r,s,l,c,u,p,h,g,b,S,y,w);this.nativeHostService=f;this.tahoeOrNewer=Ovt(s.os.release),this.handleWindowsAlwaysOnTop(t.vscodeWindowId)}get minimumHeight(){return et?(this.isCommandCenterVisible?nJ:this.macTitlebarSize)/(this.preventZoom?uv(Me(this.element)):1):super.minimumHeight}get maximumHeight(){return this.minimumHeight}get macTitlebarSize(){return this.tahoeOrNewer?32:28}async handleWindowsAlwaysOnTop(e){let t=SYe.bindTo(this.contextKeyService);this._register(this.nativeHostService.onDidChangeWindowAlwaysOnTop(({windowId:o,alwaysOnTop:n})=>{o===e&&t.set(n)})),t.set(await this.nativeHostService.isWindowAlwaysOnTop({targetWindowId:e}))}onMenubarVisibilityChanged(e){(ii||Sn)&&this.currentMenubarVisibility==="toggle"&&e&&this.dragRegion&&(Wi(this.dragRegion),setTimeout(()=>Xo(this.dragRegion),50)),super.onMenubarVisibilityChanged(e)}onConfigurationChanged(e){super.onConfigurationChanged(e),e.affectsConfiguration("window.doubleClickIconToClose")&&this.appIcon&&this.onUpdateAppIconDragBehavior()}onUpdateAppIconDragBehavior(){this.configurationService.getValue("window.doubleClickIconToClose")&&this.appIcon?this.appIcon.style["-webkit-app-region"]="no-drag":this.appIcon&&(this.appIcon.style["-webkit-app-region"]="drag")}installMenubar(){super.installMenubar(),!this.menubar&&this.customMenubar.value&&this._register(this.customMenubar.value.onFocusStateChange(e=>this.onMenubarFocusChanged(e)))}onMenubarFocusChanged(e){(ii||Sn)&&this.currentMenubarVisibility!=="compact"&&this.dragRegion&&(e?Wi(this.dragRegion):Xo(this.dragRegion))}createContentArea(e){let t=super.createContentArea(e),o=Me(e),n=hv(o);if((et||XF(this.configurationService))&&this._register(this.instantiationService.createInstance(z$e)),this.appIcon&&(this.onUpdateAppIconDragBehavior(),this._register($(this.appIcon,ne.DBLCLICK,(()=>{this.nativeHostService.closeWindow({targetWindowId:n})})))),!yx(this.configurationService)&&!jke(this.configurationService)&&this.windowControlsContainer){let r=D(this.windowControlsContainer,_("div.window-icon.window-minimize"+q.asCSSSelector(L.chromeMinimize)));this._register($(r,ne.CLICK,()=>{this.nativeHostService.minimizeWindow({targetWindowId:n})})),this.maxRestoreControl=D(this.windowControlsContainer,_("div.window-icon.window-max-restore")),this._register($(this.maxRestoreControl,ne.CLICK,async()=>await this.nativeHostService.isMaximized({targetWindowId:n})?this.nativeHostService.unmaximizeWindow({targetWindowId:n}):this.nativeHostService.maximizeWindow({targetWindowId:n})));let s=D(this.windowControlsContainer,_("div.window-icon.window-close"+q.asCSSSelector(L.chromeClose)));this._register($(s,ne.CLICK,()=>{this.nativeHostService.closeWindow({targetWindowId:n})})),this.resizer=D(this.rootContainer,_("div.resizer")),this._register(U.runAndSubscribe(this.layoutService.onDidChangeWindowMaximized,({windowId:l,maximized:c})=>{l===n&&this.onDidChangeWindowMaximized(c)},{windowId:n,maximized:this.layoutService.isWindowMaximized(o)}))}return ii&&!yx(this.configurationService)&&this._register(this.nativeHostService.onDidTriggerWindowSystemContextMenu(({windowId:r,x:s,y:l})=>{if(n!==r)return;let c=uv(Me(this.element));this.onContextMenu(new MouseEvent(ne.MOUSE_UP,{clientX:s/c,clientY:l/c}),R.TitleBarContext)})),t}onDidChangeWindowMaximized(e){this.maxRestoreControl&&(e?(this.maxRestoreControl.classList.remove(...q.asClassNameArray(L.chromeMaximize)),this.maxRestoreControl.classList.add(...q.asClassNameArray(L.chromeRestore))):(this.maxRestoreControl.classList.remove(...q.asClassNameArray(L.chromeRestore)),this.maxRestoreControl.classList.add(...q.asClassNameArray(L.chromeMaximize)))),this.resizer&&(e?Wi(this.resizer):Xo(this.resizer))}updateStyles(){super.updateStyles(),this.element&&jke(this.configurationService)&&(!this.cachedWindowControlStyles||this.cachedWindowControlStyles.bgColor!==this.element.style.backgroundColor||this.cachedWindowControlStyles.fgColor!==this.element.style.color)&&this.nativeHostService.updateWindowControls({targetWindowId:hv(Me(this.element)),backgroundColor:this.element.style.backgroundColor,foregroundColor:this.element.style.color})}layout(e,t){if(super.layout(e,t),jke(this.configurationService)){let o=Math.round(t*uv(Me(this.element)));o!==this.cachedWindowControlHeight&&(this.cachedWindowControlHeight=o,this.nativeHostService.updateWindowControls({targetWindowId:hv(Me(this.element)),height:o}))}}};K$e=I([m(3,Xe),m(4,B),m(5,Jr),m(6,F),m(7,Pe),m(8,de),m(9,wi),m(10,X),m(11,ti),m(12,wo),m(13,kt),m(14,ie),m(15,Yt),m(16,Le),m(17,sh)],K$e);var hgt=class extends K$e{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v){super("workbench.parts.titlebar",ut,p.mainPart,i,e,t,o,n,r,s,l,c,u,p,h,g,f,v)}};hgt=I([m(0,Xe),m(1,B),m(2,Jr),m(3,F),m(4,Pe),m(5,de),m(6,wi),m(7,X),m(8,ti),m(9,wo),m(10,kt),m(11,ie),m(12,Yt),m(13,Le),m(14,sh)],hgt);var aye=class extends K$e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){let x=aye.COUNTER++;super(`workbench.parts.auxiliaryTitle.${x}`,Me(e),t,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w);this.container=e;this.mainTitlebar=o}static{this.COUNTER=1}get height(){return this.minimumHeight}get preventZoom(){return uv(Me(this.element))<1||!this.mainTitlebar.hasZoomableElements}};aye=I([m(3,Xe),m(4,B),m(5,Jr),m(6,F),m(7,Pe),m(8,de),m(9,wi),m(10,X),m(11,ti),m(12,wo),m(13,kt),m(14,ie),m(15,Yt),m(16,Le),m(17,sh)],aye);var zZt=class extends U$e{createMainTitlebarPart(){return this.instantiationService.createInstance(hgt)}doCreateAuxiliaryTitlebarPart(i,e,t){return t.createInstance(aye,i,e,this.mainPart)}};Ce(aP,zZt,0);var G$e=class{constructor(i,e){this.windowId=i;return Xd.toService(e.getChannel("nativeHost"),{context:i,properties:(()=>{let t=new Map;return t.set("windowId",i),t})()})}};G$e=I([m(1,rm)],G$e);async function XBo(a,i,e){let t=await HMn(i.title,{detail:i.body,sticky:!i.silent});if(!t)return{supported:!1,clicked:!1};let o=new O;a.onDidCreateToast(t);let n=new qe(e);return o.add(ee(()=>{a.onDidDisposeToast(t),t.dispose(),n.dispose(!0)})),new Promise(r=>{let s=l=>{r(l),o.dispose()};o.add(n.token.onCancellationRequested(()=>s({supported:!0,clicked:!1}))),U.once(t.onClick)(()=>s({supported:!0,clicked:!0})),U.once(t.onClose)(()=>s({supported:!0,clicked:!1})),U.once(t.onError)(()=>s({supported:!1,clicked:!1}))})}async function HMn(a,i){if(await Notification.requestPermission()!=="granted")return;let t=new O,o=new Notification(a,{body:i?.detail,requireInteraction:i?.sticky}),n=t.add(new T),r=t.add(new T),s=t.add(new T);return t.add($(o,"click",()=>n.fire())),t.add($(o,"close",()=>r.fire())),t.add($(o,"error",()=>s.fire())),t.add(ee(()=>o.close())),{onClick:n.event,onClose:r.event,onError:s.event,dispose:()=>t.dispose()}}var ggt=class extends G$e{constructor(i,e){super(i.window.id,e)}};ggt=I([m(0,Jr),m(1,rm)],ggt);var q$e=class extends k{constructor(e,t,o){super();this.nativeHostService=e;this.labelService=t;this.environmentService=o;this._nativeWindowHandleCache=new Map;this.activeBrowserToasts=this._register(new Bye);this.onDidChangeFocus=U.latch(U.any(U.map(U.filter(this.nativeHostService.onDidFocusMainOrAuxiliaryWindow,n=>yY(n),this._store),()=>this.hasFocus,this._store),U.map(U.filter(this.nativeHostService.onDidBlurMainOrAuxiliaryWindow,n=>yY(n),this._store),()=>this.hasFocus,this._store),U.map(this.onDidChangeActiveWindow,()=>this.hasFocus,this._store)),void 0,this._store),this.onDidChangeFullScreen=U.filter(this.nativeHostService.onDidChangeWindowFullScreen,n=>yY(n.windowId),this._store),this.registerListeners()}registerListeners(){this._register(this.onDidChangeFocus(e=>{e&&this.clearToasts()}))}get hasFocus(){return _m().hasFocus()}async hadLastFocus(){let e=await this.nativeHostService.getActiveWindowId();return typeof e>"u"?!1:e===this.nativeHostService.windowId}get onDidChangeActiveWindow(){let e=this._register(new T);return this._register(U.filter(this.nativeHostService.onDidFocusMainOrAuxiliaryWindow,t=>yY(t),this._store)(t=>e.fire(t))),this._register(Of(({window:t,disposables:o})=>{o.add(Ly(t,()=>{let n=t.document.hasFocus();return n&&e.fire(t.vscodeWindowId),n},100,20))})),U.latch(e.event,void 0,this._store)}openWindow(e,t){return Array.isArray(e)?this.doOpenWindow(e,t):this.doOpenEmptyWindow(e)}doOpenWindow(e,t){let o=this.environmentService.remoteAuthority;return o&&(e.forEach(n=>n.label=n.label||this.getRecentLabel(n)),t?.remoteAuthority===void 0&&(t=t?{...t,remoteAuthority:o}:{remoteAuthority:o})),this.nativeHostService.openWindow(e,t)}getRecentLabel(e){return beo(e)?this.labelService.getWorkspaceLabel(e.folderUri,{verbose:2}):$ke(e)?this.labelService.getWorkspaceLabel({id:"",configPath:e.workspaceUri},{verbose:2}):this.labelService.getUriLabel(e.fileUri,{appendWorkspaceSuffix:!0})}doOpenEmptyWindow(e){let t=this.environmentService.remoteAuthority;return t&&e?.remoteAuthority===void 0&&(e=e?{...e,remoteAuthority:t}:{remoteAuthority:t}),this.nativeHostService.openWindow(e)}toggleFullScreen(e){return this.nativeHostService.toggleFullScreen({targetWindowId:fI(e)?e.vscodeWindowId:void 0})}async moveTop(e){if(!(Dwe()<=1))return this.nativeHostService.moveWindowTop(fI(e)?{targetWindowId:e.vscodeWindowId}:void 0)}async setWindowDimmed(e,t){return this.nativeHostService.updateWindowControls({dimmed:t,targetWindowId:hv(e)})}getCursorScreenPoint(){return this.nativeHostService.getCursorScreenPoint()}getWindows(e){return e.includeAuxiliaryWindows===!1?this.nativeHostService.getWindows({includeAuxiliaryWindows:!1}):this.nativeHostService.getWindows({includeAuxiliaryWindows:!0})}focus(e,t){return this.nativeHostService.focusWindow({mode:t?.mode,targetWindowId:hv(e)})}restart(){return this.nativeHostService.relaunch()}reload(e){return this.nativeHostService.reload(e)}close(){return this.nativeHostService.closeWindow()}shutdown(){return this.nativeHostService.quit()}async withExpectedShutdown(e){return await e()}getScreenshot(e){return this.nativeHostService.getScreenshot(e)}async getNativeWindowHandle(e){return this._nativeWindowHandleCache.has(e)||this._nativeWindowHandleCache.set(e,this.nativeHostService.getNativeWindowHandle(e)),this._nativeWindowHandleCache.get(e)}async showToast(e,t){let o=ht(),n=t.onCancellationRequested(()=>this.nativeHostService.clearToast(o));try{let r=await this.nativeHostService.showToast({...e,id:o});return r.supported?r:await XBo({onDidCreateToast:s=>this.activeBrowserToasts.add(s),onDidDisposeToast:s=>this.activeBrowserToasts.deleteAndDispose(s)},e,t)}finally{n.dispose()}}async clearToasts(){await this.nativeHostService.clearToasts(),this.activeBrowserToasts.clearAndDisposeAll()}};I([bi],q$e.prototype,"onDidChangeActiveWindow",1),q$e=I([m(0,wo),m(1,nt),m(2,Mt)],q$e);Ce(ti,q$e,1);Ce(wo,ggt,1);var JBo="meteredConnection";var fgt=class extends FWt{constructor(i,e){super(i,eki()),this._channel=e.getChannel(JBo);let t=navigator.connection;if(t){let o=()=>this.setIsBrowserConnectionMetered(eki());t.addEventListener("change",o),this._register(ee(()=>t.removeEventListener("change",o)))}}onChangeBrowserConnection(){super.onChangeBrowserConnection(),this._channel.call("SetIsBrowserConnectionMetered",this.isBrowserConnectionMetered)}};fgt=I([m(0,B),m(1,rm)],fgt);Ce(MG,fgt,1);async function ZBo(a,i,e){if(i.isCancellationRequested)throw wy();let t=new AbortController,o=i.onCancellationRequested(()=>t.abort()),n=a.timeout?AbortSignal.any([t.signal,AbortSignal.timeout(a.timeout)]):t.signal;try{let r={method:a.type||"GET",headers:UMn(a),body:a.data,signal:n};a.disableCache&&(r.cache="no-store");let s=await fetch(a.url||"",r);return{res:{statusCode:s.status,headers:zMn(s)},stream:lD(Ke.wrap(new Uint8Array(await s.arrayBuffer())))}}catch(r){throw e&&!e()?new Hit:r?.name==="AbortError"?wy():r?.name==="TimeoutError"?new Error(`Fetch timeout: ${a.timeout}ms`):r}finally{o.dispose()}}function UMn(a){if(a.headers||a.user||a.password||a.proxyAuthorization){let i=new Headers;e:for(let e in a.headers){switch(e.toLowerCase()){case"user-agent":case"accept-encoding":case"content-length":continue e}let t=a.headers[e];if(typeof t=="string")i.set(e,t);else if(Array.isArray(t))for(let o of t)i.append(e,o)}return(a.user||a.password)&&i.set("Authorization","Basic "+btoa(`${a.user||""}:${a.password||""}`)),a.proxyAuthorization&&i.set("Proxy-Authorization",a.proxyAuthorization),i}}function zMn(a){let i=Object.create(null);return a.headers.forEach((e,t)=>{i[t]?Array.isArray(i[t])?i[t].push(e):i[t]=[i[t],e]:i[t]=e}),i}var vgt=class extends VMt{constructor(e,t,o){let n=o.createLogger("network",{name:d(19249,null),group:eP}),r=new Bae(n);super(r);this.nativeHostService=e;this.configurationService=t;this._register(n),this._register(r)}async request(e,t){return e.proxyAuthorization||(e.proxyAuthorization=this.configurationService.inspect("http.proxyAuthorization").userLocalValue),this.logAndRequest(e,()=>ZBo(e,t,()=>navigator.onLine))}async resolveProxy(e){return this.nativeHostService.resolveProxy(e)}async lookupAuthorization(e){return this.nativeHostService.lookupAuthorization(e)}async lookupKerberosAuthorization(e){return this.nativeHostService.lookupKerberosAuthorization(e)}async loadCertificates(){return this.nativeHostService.loadCertificates()}};vgt=I([m(0,wo),m(1,B),m(2,Ol)],vgt);Ce(Ra,vgt,1);var A7=class{constructor(i,e){this.nativeHostService=i;this.logService=e}static{this.FILE_FORMAT="code/file-list"}async triggerPaste(i){return this.logService.trace("NativeClipboardService#triggerPaste called"),this.nativeHostService.triggerPaste({targetWindowId:i})}async readImage(){return this.nativeHostService.readImage()}async writeText(i,e){return this.logService.trace("NativeClipboardService#writeText called with type:",e," with text.length:",i.length),this.nativeHostService.writeClipboardText(i,e)}async readText(i){return this.logService.trace("NativeClipboardService#readText called with type:",i),this.nativeHostService.readClipboardText(i)}async readFindText(){return et?this.nativeHostService.readClipboardFindText():""}async writeFindText(i){if(et)return this.nativeHostService.writeClipboardFindText(i)}async writeResources(i){if(i.length)return this.nativeHostService.writeClipboardBuffer(A7.FILE_FORMAT,this.resourcesToBuffer(i))}async readResources(){return this.bufferToResources(await this.nativeHostService.readClipboardBuffer(A7.FILE_FORMAT))}async hasResources(){return this.nativeHostService.hasClipboard(A7.FILE_FORMAT)}resourcesToBuffer(i){return Ke.fromString(i.map(e=>e.toString()).join(`
`))}bufferToResources(i){if(!i)return[];let e=i.toString();if(!e)return[];try{return e.split(`
`).map(t=>A.parse(t))}catch{return[]}}};A7=I([m(0,wo),m(1,re)],A7);Ce(Bi,A7,1);var eHo="vscode:contextmenu",tHo="vscode:onCloseContextMenu";var KMn=0;function iHo(a,i,e){let t=[],o=KMn++,n=`vscode:onContextMenu${o}`,r=(s,...l)=>{let c=l[0],u=l[1];t[c].click?.(u)};Xl.once(n,r),Xl.once(tHo,(s,...l)=>{l[0]===o&&(Xl.removeListener(n,r),e?.())}),Xl.send(eHo,o,a.map(s=>oHo(s,t)),n,i)}function oHo(a,i){let e={id:i.length,label:a.label,type:a.type,accelerator:a.accelerator,checked:a.checked,enabled:typeof a.enabled=="boolean"?a.enabled:!0,visible:typeof a.visible=="boolean"?a.visible:!0};return i.push(a),Array.isArray(a.submenu)&&(e.submenu=a.submenu.map(t=>oHo(t,i))),e}var KZt=class{constructor(i,e,t,o){this.contextViewService=i;this.telemetryService=e;this.notificationService=t;this.keybindingService=o;this.focusToReturn=null;this.lastContainer=null;this.block=null;this.blockDisposable=null;this.options={blockMouse:!0}}configure(i){this.options=i}showContextMenu(i){let e=i.getActions();if(!e.length)return;this.focusToReturn=Un();let t,o=go(i.domForShadowRoot)?i.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>i.getAnchor(),canRelayout:!1,anchorAlignment:i.anchorAlignment,anchorAxisAlignment:i.anchorAxisAlignment,layer:i.layer,render:n=>{this.lastContainer=n;let r=i.getMenuClassName?i.getMenuClassName():"";r&&(n.className+=" "+r),this.options.blockMouse&&(this.block=n.appendChild(_(".context-view-block")),this.block.style.position="fixed",this.block.style.cursor="initial",this.block.style.left="0",this.block.style.top="0",this.block.style.width="100%",this.block.style.height="100%",this.block.style.zIndex="-1",this.blockDisposable?.dispose(),this.blockDisposable=$(this.block,ne.MOUSE_DOWN,u=>u.stopPropagation()));let s=new O,l=i.actionRunner||s.add(new cs);l.onWillRun(u=>this.onActionRun(u,!i.skipTelemetry),this,s),l.onDidRun(this.onDidActionRun,this,s),t=new j8(n,e,{actionViewItemProvider:i.getActionViewItem,context:i.getActionsContext?i.getActionsContext():null,actionRunner:l,getKeyBinding:i.getKeyBinding?i.getKeyBinding:u=>this.keybindingService.lookupKeybinding(u.id)},_kt),t.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,s),t.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,s);let c=Me(n);return s.add($(c,ne.BLUR,()=>this.contextViewService.hideContextView(!0))),s.add($(c,ne.MOUSE_DOWN,u=>{if(u.defaultPrevented)return;let p=new Ln(c,u),h=p.target;if(!p.rightButton){for(;h;){if(h===n)return;h=h.parentElement}this.contextViewService.hideContextView(!0)}})),Fn(s,t)},focus:()=>{t?.focus(!!i.autoSelectFirstItem)},onHide:n=>{i.onHide?.(!!n),this.block&&(this.block.remove(),this.block=null),this.blockDisposable?.dispose(),this.blockDisposable=null,this.lastContainer&&(Un()===this.lastContainer||ms(Un(),this.lastContainer))&&this.focusToReturn?.focus(),this.lastContainer=null}},o,!!o)}onActionRun(i,e){e&&this.telemetryService.publicLog2("workbenchActionExecuted",{id:i.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1)}onDidActionRun(i){i.error&&!Yi(i.error)&&this.notificationService.error(i.error)}};var $$e=class extends k{constructor(e,t,o,n,r,s){super();this.telemetryService=e;this.notificationService=t;this.contextViewService=o;this.keybindingService=n;this.menuService=r;this.contextKeyService=s;this._contextMenuHandler=void 0;this._onDidShowContextMenu=this._store.add(new T);this.onDidShowContextMenu=this._onDidShowContextMenu.event;this._onDidHideContextMenu=this._store.add(new T);this.onDidHideContextMenu=this._onDidHideContextMenu.event}get contextMenuHandler(){return this._contextMenuHandler||(this._contextMenuHandler=new KZt(this.contextViewService,this.telemetryService,this.notificationService,this.keybindingService)),this._contextMenuHandler}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){e=GZt.transform(e,this.menuService,this.contextKeyService),this.contextMenuHandler.showContextMenu({...e,onHide:t=>{e.onHide?.(t),this._onDidHideContextMenu.fire()}}),Ab.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};$$e=I([m(0,_e),m(1,Ne),m(2,qn),m(3,Le),m(4,Yt),m(5,X)],$$e);var GZt;(e=>{function a(t){return t&&t.menuId instanceof R}function i(t,o,n){if(!a(t))return t;let{menuId:r,menuActionOptions:s,contextKeyService:l}=t;return{...t,getActions:()=>{let c=[];if(r){let u=o.getMenuActions(r,l??n,s);c=Lu(u)}return t.getActions?oi.join(t.getActions(),c):c}}}e.transform=i})(GZt||={});var bgt=class{get onDidShowContextMenu(){return this.impl.onDidShowContextMenu}get onDidHideContextMenu(){return this.impl.onDidHideContextMenu}constructor(i,e,t,o,n,r,s){function l(u){return u?new Sgt(i,e,t,r,s):new $$e(e,i,n,t,r,s)}let c=BI(o);this.impl=l(c),et&&(this.listener=o.onDidChangeConfiguration(u=>{if(!u.affectsConfiguration("window.menuStyle"))return;let p=BI(o);p!==c&&(this.impl.dispose(),this.impl=l(p),c=p)}))}dispose(){this.listener?.dispose(),this.impl.dispose()}showContextMenu(i){this.impl.showContextMenu(i)}};bgt=I([m(0,Ne),m(1,_e),m(2,Le),m(3,B),m(4,qn),m(5,Yt),m(6,X)],bgt);var Sgt=class extends k{constructor(e,t,o,n,r){super();this.notificationService=e;this.telemetryService=t;this.keybindingService=o;this.menuService=n;this.contextKeyService=r;this._onDidShowContextMenu=this._store.add(new T);this.onDidShowContextMenu=this._onDidShowContextMenu.event;this._onDidHideContextMenu=this._store.add(new T);this.onDidHideContextMenu=this._onDidHideContextMenu.event}showContextMenu(e){e=GZt.transform(e,this.menuService,this.contextKeyService);let t=e.getActions();if(t.length){let o=bd(()=>{e.onHide?.(!1),Ab.getInstance().resetKeyStatus(),this._onDidHideContextMenu.fire()}),n=this.createMenu(e,t,o),r=e.getAnchor(),s,l,c=uv(go(r)?Me(r):zi());if(go(r)){let u=r.getBoundingClientRect(),p={left:u.left,top:u.top,width:u.width,height:u.height},h=Me(r),g=h.innerWidth,f=h.innerHeight,v=u.left<0||u.top<0||u.right>g||u.bottom>f;c*=CY(r),v?(s=Math.min(Math.max(u.right,0),g),l=Math.min(Math.max(u.bottom,0),f)):e.anchorAxisAlignment===1?(e.anchorAlignment===0?(s=p.left,l=p.top):(s=p.left+p.width,l=p.top),et||Me(r).screen.height-l<t.length*(ii?45:32)&&(l+=p.height)):e.anchorAlignment===0?(s=p.left,l=p.top+p.height):(s=p.left+p.width,l=p.top+p.height),et&&(l+=4/c)}else rdi(r)&&(s=r.x,l=r.y);typeof s=="number"&&(s=Math.floor(s*c)),typeof l=="number"&&(l=Math.floor(l*c)),iHo(n,{x:s,y:l,positioningItem:e.autoSelectFirstItem?0:void 0},()=>o()),this._onDidShowContextMenu.fire()}}createMenu(e,t,o,n=new Set){return ui(t.map(r=>this.createMenuItem(e,r,o,n)))}createMenuItem(e,t,o,n){if(t instanceof oi)return{type:"separator"};if(t instanceof sa){if(n.has(t.id)){console.warn(`Found submenu cycle: ${t.id}`);return}return{label:j3e(Du(t.label)).trim(),submenu:this.createMenu(e,t.actions,o,new Set([...n,t.id]))}}else{let r;t.checked&&(typeof e.getCheckedActionsRepresentation=="function"?r=e.getCheckedActionsRepresentation(t):r="checkbox");let s={label:j3e(Du(t.label)).trim(),checked:!!t.checked,type:r,enabled:!!t.enabled,click:c=>{o(),this.runAction(t,e,c)}},l=e.getKeyBinding?e.getKeyBinding(t):this.keybindingService.lookupKeybinding(t.id);if(l){let c=l.getElectronAccelerator();if(c)s.accelerator=c;else{let u=l.getLabel();u&&(s.label=`${s.label} [${u}]`)}}return s}}async runAction(e,t,o){t.skipTelemetry||this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.id,from:"contextMenu"});let n=t.getActionsContext?t.getActionsContext(o):void 0;try{t.actionRunner?await t.actionRunner.run(e,n):e.enabled&&await e.run(n)}catch(r){this.notificationService.error(r)}}};Sgt=I([m(0,Ne),m(1,_e),m(2,Le),m(3,Yt),m(4,X)],Sgt);Ce(Xe,bgt,1);var cji=class{constructor(i,e){this.oldWorkspace=i;this.newWorkspace=e;this.promises=[]}join(i){this.promises.push(i)}async wait(){await vn.settled(this.promises)}},j$e=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this.jsonEditingService=e;this.contextService=t;this.configurationService=o;this.notificationService=n;this.commandService=r;this.fileService=s;this.textFileService=l;this.workspacesService=c;this.environmentService=u;this.fileDialogService=p;this.dialogService=h;this.hostService=g;this.uriIdentityService=f;this.workspaceTrustManagementService=v;this.userDataProfilesService=b;this.userDataProfileService=S;this.logService=y;this._onDidEnterWorkspace=this._register(new T);this.onDidEnterWorkspace=this._onDidEnterWorkspace.event}async pickNewWorkspacePath(){let e=[Q.file];this.environmentService.remoteAuthority&&e.unshift(Q.vscodeRemote);let t=await this.fileDialogService.showSaveDialog({saveLabel:d(19683,null),title:d(19684,null),filters:leo,defaultUri:Ve(await this.fileDialogService.defaultWorkspacePath(),this.getNewWorkspaceName()),availableFileSystems:e});if(t)return jF(t)||(t=t.with({path:`${t.path}.${OT}`})),t}getNewWorkspaceName(){let e=this.getCurrentWorkspaceIdentifier()?.configPath;if(e&&Fde(e,this.environmentService))return Be(e);let t=this.contextService.getWorkspace().folders.at(0);return t?`${Be(t.uri)}.${OT}`:`workspace.${OT}`}async updateFolders(e,t,o,n){let r=this.contextService.getWorkspace().folders,s=[];typeof t=="number"&&(s=r.slice(e,e+t).map(p=>p.uri));let l=[];Array.isArray(o)&&(l=o.map(p=>({uri:Ble(p.uri),name:p.name})));let c=s.length>0,u=l.length>0;if(!(!u&&!c))return u&&!c?this.doAddFolders(l,e,n):c&&!u?this.removeFolders(s):this.includesSingleFolderWorkspace(s)?this.createAndEnterWorkspace(l):this.contextService.getWorkbenchState()!==3?this.doAddFolders(l,e,n):this.doUpdateFolders(l,s,e,n)}async doUpdateFolders(e,t,o,n=!1){try{await this.contextService.updateFolders(e,t,o)}catch(r){if(n)throw r;this.handleWorkspaceConfigurationEditingError(r)}}addFolders(e,t=!1){let o=e.map(n=>({uri:Ble(n.uri),name:n.name}));return this.doAddFolders(o,void 0,t)}async doAddFolders(e,t,o=!1){let n=this.contextService.getWorkbenchState(),r=this.environmentService.remoteAuthority;if(r&&(e=e.filter(s=>s.uri.scheme!==Q.file&&(s.uri.scheme!==Q.vscodeRemote||vB(s.uri.authority,r)))),n!==3){let s=this.contextService.getWorkspace().folders.map(l=>({uri:l.uri}));return s.splice(typeof t=="number"?t:s.length,0,...e),s=jo(s,l=>this.uriIdentityService.extUri.getComparisonKey(l.uri)),n===1&&s.length===0||n===2&&s.length===1?void 0:this.createAndEnterWorkspace(s)}try{await this.contextService.addFolders(e,t)}catch(s){if(o)throw s;this.handleWorkspaceConfigurationEditingError(s)}}async removeFolders(e,t=!1){if(this.includesSingleFolderWorkspace(e))return this.createAndEnterWorkspace([]);try{await this.contextService.removeFolders(e)}catch(o){if(t)throw o;this.handleWorkspaceConfigurationEditingError(o)}}includesSingleFolderWorkspace(e){if(this.contextService.getWorkbenchState()===2){let t=this.contextService.getWorkspace().folders[0];return e.some(o=>this.uriIdentityService.extUri.isEqual(o,t.uri))}return!1}async createAndEnterWorkspace(e,t){if(t&&!await this.isValidTargetWorkspacePath(t))return;let o=this.environmentService.remoteAuthority,n=await this.workspacesService.createUntitledWorkspace(e,o);if(t)try{await this.saveWorkspaceAs(n,t)}finally{await this.workspacesService.deleteUntitledWorkspace(n)}else t=n.configPath,this.userDataProfileService.currentProfile.isDefault||await this.userDataProfilesService.setProfileForWorkspace(n,this.userDataProfileService.currentProfile);return this.enterWorkspace(t)}async saveAndEnterWorkspace(e){let t=this.getCurrentWorkspaceIdentifier();if(t){if(ze(t.configPath,e))return this.saveWorkspace(t);if(await this.isValidTargetWorkspacePath(e))return await this.saveWorkspaceAs(t,e),this.enterWorkspace(e)}}async isValidTargetWorkspacePath(e){return!0}async saveWorkspaceAs(e,t){let o=e.configPath;if(!rM(t,this.environmentService)&&!this.userDataProfileService.currentProfile.isDefault){let c=await this.workspacesService.getWorkspaceIdentifier(t);await this.userDataProfilesService.setProfileForWorkspace(c,this.userDataProfileService.currentProfile)}if(this.uriIdentityService.extUri.isEqual(o,t))return;let r=rM(o,this.environmentService),s=await this.fileService.readFile(o),l=KCi(s.value.toString(),o,r,t,this.uriIdentityService.extUri);await this.textFileService.create([{resource:t,value:l,options:{overwrite:!0}}]),await this.trustWorkspaceConfiguration(t)}async saveWorkspace(e){let t=e.configPath,o=this.textFileService.files.get(t);if(o){await o.save({force:!0,reason:1});return}if(await this.fileService.exists(t))return;let s=KCi(JSON.stringify({folders:[]},null,"	"),t,!1,t,this.uriIdentityService.extUri);await this.textFileService.create([{resource:t,value:s}])}handleWorkspaceConfigurationEditingError(e){e.code===0?this.onInvalidWorkspaceConfigurationFileError():this.notificationService.error(e.message)}onInvalidWorkspaceConfigurationFileError(){let e=d(19681,null);this.askToOpenWorkspaceConfigurationFile(e)}askToOpenWorkspaceConfigurationFile(e){this.notificationService.prompt(ft.Error,e,[{label:d(19682,null),run:()=>this.commandService.executeCommand("workbench.action.openWorkspaceConfigFile")}])}async fireDidEnterWorkspace(e,t){let o=new cji(e,t);this._onDidEnterWorkspace.fire(o);try{await o.wait()}catch(n){this.logService.error("Error while waiting for participants of onDidEnterWorkspace to join:",n)}}async doEnterWorkspace(e){if(this.environmentService.extensionTestsLocationURI)throw new Error("Entering a new workspace is not possible in tests.");let t=await this.workspacesService.getWorkspaceIdentifier(e);return this.contextService.getWorkbenchState()===2&&await this.migrateWorkspaceSettings(t),await this.configurationService.initialize(t),this.workspacesService.enterWorkspace(e)}migrateWorkspaceSettings(e){return this.doCopyWorkspaceSettings(e,t=>t.scope===4)}copyWorkspaceSettings(e){return this.doCopyWorkspaceSettings(e)}doCopyWorkspaceSettings(e,t){let o=oe.as($t.Configuration).getConfigurationProperties(),n={};for(let r of this.configurationService.keys().workspace)if(o[r]){if(t&&!t(o[r]))continue;n[r]=this.configurationService.inspect(r).workspaceValue}return this.jsonEditingService.write(e.configPath,[{path:["settings"],value:n}],!0)}async trustWorkspaceConfiguration(e){this.contextService.getWorkbenchState()!==1&&this.workspaceTrustManagementService.isWorkspaceTrusted()&&await this.workspaceTrustManagementService.setUrisTrust([e],!0)}getCurrentWorkspaceIdentifier(){let e=pf(this.contextService.getWorkspace());if(Gy(e))return e}};j$e=I([m(0,Zg),m(1,Ae),m(2,Yg),m(3,Ne),m(4,fe),m(5,ge),m(6,Uo),m(7,bm),m(8,Mt),m(9,nn),m(10,ct),m(11,ti),m(12,gt),m(13,Or),m(14,hn),m(15,gn),m(16,re)],j$e);var dji=class a{constructor(i,e){this.backupRoot=i;this.fileService=e;this.cache=new dt}static async create(i,e){let t=new a(i,e);return await t.resolve(),t}async resolve(){try{let i=await this.fileService.resolve(this.backupRoot);i.children&&await vn.settled(i.children.filter(e=>e.isDirectory).map(async e=>{let t=await this.fileService.resolve(e.resource);if(t.children)for(let o of t.children)o.isDirectory||this.add(o.resource)}))}catch{}}add(i,e=0,t){this.cache.set(i,{versionId:e,meta:io(t)})}update(i,e){let t=this.cache.get(i);t&&(t.meta=io(e))}count(){return this.cache.size}has(i,e,t){let o=this.cache.get(i);return!(!o||typeof e=="number"&&e!==o.versionId||t&&!Qi(t,o.meta))}get(){return Array.from(this.cache.keys())}remove(i){this.cache.delete(i)}clear(){this.cache.clear()}},Kae=class extends k{constructor(e,t,o){super();this.fileService=t;this.logService=o;this.impl=this._register(this.initialize(e))}initialize(e){return e?new fL(e,this.fileService,this.logService):new qZt}reinitialize(e){this.impl instanceof fL&&(e?this.impl.initialize(e):this.impl=new qZt)}hasBackupSync(e,t,o){return this.impl.hasBackupSync(e,t,o)}backup(e,t,o,n,r){return this.impl.backup(e,t,o,n,r)}discardBackup(e,t){return this.impl.discardBackup(e,t)}discardBackups(e){return this.impl.discardBackups(e)}getBackups(){return this.impl.getBackups()}resolve(e){return this.impl.resolve(e)}toBackupResource(e){return this.impl.toBackupResource(e)}joinBackups(){return this.impl.joinBackups()}};Kae=I([m(1,ge),m(2,re)],Kae);var fL=class extends k{constructor(e,t,o){super();this.backupWorkspaceHome=e;this.fileService=t;this.logService=o;this.ioOperationQueues=this._register(new Tz);this.model=void 0;this.initialize(e)}static{this.PREAMBLE_END_MARKER=`
`}static{this.PREAMBLE_END_MARKER_CHARCODE=10}static{this.PREAMBLE_META_SEPARATOR=" "}static{this.PREAMBLE_MAX_LENGTH=1e4}initialize(e){this.backupWorkspaceHome=e,this.ready=this.doInitialize()}async doInitialize(){return this.model=await dji.create(this.backupWorkspaceHome,this.fileService),this.model}hasBackupSync(e,t,o){if(!this.model)return!1;let n=this.toBackupResource(e);return this.model.has(n,t,o)}async backup(e,t,o,n,r){let s=await this.ready;if(r?.isCancellationRequested)return;let l=this.toBackupResource(e);if(!s.has(l,o,n))return this.ioOperationQueues.queueFor(l,async()=>{if(r?.isCancellationRequested||s.has(l,o,n))return;let c=this.createPreamble(e,n);c.length>=fL.PREAMBLE_MAX_LENGTH&&(c=this.createPreamble(e));let u=Ke.fromString(c),p;fY(t)?p=Hii(u,t):t?p=D8i(u,t):p=Ke.concat([u,Ke.fromString("")]),await this.fileService.writeFile(l,p),s.add(l,o,n)})}createPreamble(e,t){return`${e.resource.toString()}${fL.PREAMBLE_META_SEPARATOR}${JSON.stringify({...t,typeId:e.typeId})}${fL.PREAMBLE_END_MARKER}`}async discardBackups(e){let t=await this.ready,o=e?.except;if(Array.isArray(o)&&o.length>0){let n=new dt;for(let r of o)n.set(this.toBackupResource(r),!0);await vn.settled(t.get().map(async r=>{n.has(r)||await this.doDiscardBackup(r)}))}else await this.deleteIgnoreFileNotFound(this.backupWorkspaceHome),t.clear()}discardBackup(e,t){let o=this.toBackupResource(e);return this.doDiscardBackup(o,t)}async doDiscardBackup(e,t){let o=await this.ready;if(!t?.isCancellationRequested)return this.ioOperationQueues.queueFor(e,async()=>{t?.isCancellationRequested||(await this.deleteIgnoreFileNotFound(e),o.remove(e))})}async deleteIgnoreFileNotFound(e){try{await this.fileService.del(e,{recursive:!0})}catch(t){if(t.fileOperationResult!==1)throw t}}async getBackups(){let e=await this.ready;await this.joinBackups();let t=await Promise.all(e.get().map(o=>this.resolveIdentifier(o,e)));return ui(t)}async resolveIdentifier(e,t){let o;return await this.ioOperationQueues.queueFor(e,async()=>{if(!t.has(e))return;let n=await this.readToMatchingString(e,fL.PREAMBLE_END_MARKER,fL.PREAMBLE_MAX_LENGTH);if(!n)return;let r=n.indexOf(fL.PREAMBLE_META_SEPARATOR),s,l;r>0?(s=n.substring(0,r),l=n.substr(r+1)):(s=n,l=void 0);let{typeId:c,meta:u}=this.parsePreambleMeta(l);t.update(e,u),o={typeId:c??vN,resource:A.parse(s)}}),o}async readToMatchingString(e,t,o){let n=(await this.fileService.readFile(e,{length:o})).value.toString(),r=n.indexOf(t);if(r>=0)return n.substr(0,r)}async resolve(e){let t=this.toBackupResource(e),o=await this.ready,n;return await this.ioOperationQueues.queueFor(t,async()=>{if(!o.has(t))return;let r=await this.fileService.readFileStream(t),s=await hbt(r.value,1),l=Ke.concat(s.buffer),c=l.buffer.indexOf(fL.PREAMBLE_END_MARKER_CHARCODE);if(c===-1){this.logService.trace(`Backup: Could not find meta end marker in ${t}. The file is probably corrupt (filesize: ${r.size}).`);return}let u=l.slice(0,c).toString(),p,h=u.indexOf(fL.PREAMBLE_META_SEPARATOR);h!==-1&&(p=this.parsePreambleMeta(u.substr(h+1)).meta),o.update(t,p);let g=l.slice(c+1),f;s.ended?f=lD(g):f=Hii(g,s.stream),n={value:f,meta:p}}),n}parsePreambleMeta(e){let t,o;if(e)try{o=JSON.parse(e),t=o?.typeId,typeof o?.typeId=="string"&&(delete o.typeId,dv(o)&&(o=void 0))}catch{}return{typeId:t,meta:o}}toBackupResource(e){return Ve(this.backupWorkspaceHome,e.resource.scheme,nHo(e))}joinBackups(){return this.ioOperationQueues.whenDrained()}};fL=I([m(1,ge),m(2,re)],fL);var qZt=class extends k{constructor(){super(...arguments);this.backups=new dt}hasBackupSync(e,t){let o=this.toBackupResource(e);return this.backups.has(o)}async backup(e,t,o,n,r){let s=this.toBackupResource(e);this.backups.set(s,{typeId:e.typeId,content:t instanceof Ke?t:t?fY(t)?await yI(t):vbt(t):Ke.fromString(""),meta:n})}async resolve(e){let t=this.toBackupResource(e),o=this.backups.get(t);if(o)return{value:lD(o.content),meta:o.meta}}async getBackups(){return Array.from(this.backups.entries()).map(([e,t])=>({typeId:t.typeId,resource:e}))}async discardBackup(e){this.backups.delete(this.toBackupResource(e))}async discardBackups(e){let t=e?.except;if(Array.isArray(t)&&t.length>0){let o=new dt;for(let n of t)o.set(this.toBackupResource(n),!0);for(let n of await this.getBackups())o.has(this.toBackupResource(n))||await this.discardBackup(n)}else this.backups.clear()}toBackupResource(e){return A.from({scheme:Q.inMemory,path:nHo(e)})}async joinBackups(){}};function nHo(a){let i;if(a.typeId.length>0){let e=rHo(a.typeId);a.resource.path?i=Ve(a.resource,e):i=a.resource.with({path:e})}else i=a.resource;return GMn(i)}function GMn(a){let i=a.scheme===Q.file||a.scheme===Q.untitled?a.fsPath:a.toString();return rHo(i)}function rHo(a){return Lr(a).toString(16)}var Igt=class extends j$e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V){super(e,t,n,c,u,p,h,g,f,v,b,w,x,E,M,N,V);this.nativeHostService=o;this.storageService=r;this.extensionService=s;this.workingCopyBackupService=l;this.lifecycleService=S;this.labelService=y;this.registerListeners()}registerListeners(){this._register(this.lifecycleService.onBeforeShutdown(e=>{let t=this.saveUntitledBeforeShutdown(e.reason);e.veto(t,"veto.untitledWorkspace")}))}async saveUntitledBeforeShutdown(e){if(e!==4&&e!==1)return!1;let t=this.getCurrentWorkspaceIdentifier();if(!t||!rM(t.configPath,this.environmentService))return!1;let o=await this.nativeHostService.getWindowCount();if(e===1&&!et&&o===1)return!1;if(!(this.configurationService.getValue("window.confirmSaveUntitledWorkspace")!==!1))return await this.workspacesService.deleteUntitledWorkspace(t),!1;let r=!1,{result:s,checkboxChecked:l}=await this.dialogService.prompt({type:ft.Warning,message:d(19692,null),detail:d(19691,null),buttons:[{label:d(19690,null),run:async()=>{let c=await this.pickNewWorkspacePath();if(!c||!jF(c))return!0;try{await this.saveWorkspaceAs(t,c);let u=await this.workspacesService.getWorkspaceIdentifier(c);await this.workspacesService.addRecentlyOpened([{label:this.labelService.getWorkspaceLabel(u,{verbose:2}),workspace:u,remoteAuthority:this.environmentService.remoteAuthority}]),await this.workspacesService.deleteUntitledWorkspace(t)}catch{}return!1}},{label:d(19688,null),run:async()=>(await this.workspacesService.deleteUntitledWorkspace(t),!1)}],cancelButton:{run:()=>(r=!0,!0)},checkbox:{label:d(19687,null)}});return!r&&l&&await this.configurationService.updateValue("window.confirmSaveUntitledWorkspace",!1,2),s}async isValidTargetWorkspacePath(e){return(await this.nativeHostService.getWindows({includeAuxiliaryWindows:!1})).some(o=>Gy(o.workspace)&&this.uriIdentityService.extUri.isEqual(o.workspace.configPath,e))?(await this.dialogService.info(d(19694,null,Be(e)),d(19693,null)),!1):!0}async enterWorkspace(e){if(!await this.extensionService.stopExtensionHosts(d(19689,null)))return;let o=pf(this.contextService.getWorkspace()),n=await this.doEnterWorkspace(e);if(n){if(await this.storageService.switch(n.workspace,!0),this.workingCopyBackupService instanceof Kae){let r=n.backupPath?A.file(n.backupPath).with({scheme:this.environmentService.userRoamingDataHome.scheme}):void 0;this.workingCopyBackupService.reinitialize(r)}await this.fireDidEnterWorkspace(o,n.workspace)}this.environmentService.remoteAuthority?this.hostService.reload():this.extensionService.startExtensionHosts()}};Igt=I([m(0,Zg),m(1,Ae),m(2,wo),m(3,Yg),m(4,de),m(5,lt),m(6,Om),m(7,Ne),m(8,fe),m(9,ge),m(10,Uo),m(11,bm),m(12,Jr),m(13,nn),m(14,ct),m(15,to),m(16,nt),m(17,ti),m(18,gt),m(19,Or),m(20,hn),m(21,gn),m(22,re)],Igt);Ce(iS,Igt,1);var $Zt=class{constructor(i,e,t,o){this._contributedVariables=new Map;this.resolvableVariables=new Set(omo);this._context=i,this._labelService=e,this._userHomePromise=t,o&&(this._envVariablesPromise=o.then(n=>this.prepareEnv(n)))}prepareEnv(i){if(ii){let e=Object.create(null);return Object.keys(i).forEach(t=>{e[t.toLowerCase()]=i[t]}),e}return i}async resolveWithEnvironment(i,e,t){let o=eI.parse(t);for(let n of o.unresolved()){let r=await this.evaluateSingleVariable(n,e?.uri,i);r!==void 0&&o.resolve(n,String(r))}return o.toObject()}async resolveAsync(i,e){let t=eI.parse(e);for(let o of t.unresolved()){let n=await this.evaluateSingleVariable(o,i?.uri);n!==void 0&&t.resolve(o,String(n))}return t.toObject()}resolveWithInteractionReplace(i,e){throw new Error("resolveWithInteractionReplace not implemented.")}resolveWithInteraction(i,e){throw new Error("resolveWithInteraction not implemented.")}contributeVariable(i,e){if(this._contributedVariables.has(i))throw new Error("Variable "+i+" is contributed twice.");this.resolvableVariables.add(i),this._contributedVariables.set(i,e)}fsPath(i){return this._labelService?this._labelService.getUriLabel(i,{noPrefix:!0}):i.fsPath}async evaluateSingleVariable(i,e,t,o){let n={env:t!==void 0?this.prepareEnv(t):await this._envVariablesPromise,userHome:t!==void 0?void 0:await this._userHomePromise},{name:r,arg:s}=i,l=p=>{let h=this._context.getFilePath();if(h)return dm(h);throw new Ev(p,d(18782,null,i.id))},c=p=>{let h=l(p);if(this._context.getWorkspaceFolderPathForFile){let g=this._context.getWorkspaceFolderPathForFile();if(g)return dm(g)}throw new Ev(p,d(18783,null,i.id,Jo(h)))},u=p=>{if(s){let h=this._context.getFolderUri(s);if(h)return h;throw new Ev(p,d(18780,null,p,s))}if(e)return e;throw this._context.getWorkspaceFolderCount()>1?new Ev(p,d(18788,null,p)):new Ev(p,d(18787,null,p))};switch(r){case"env":if(s){if(n.env){let p=n.env[ii?s.toLowerCase():s];if(We(p))return p}return""}throw new Ev("env",d(18793,null,i.id));case"config":if(s){let p=this._context.getConfigurationValue(e,s);if(mr(p))throw new Ev("config",d(18790,null,i.id,s));if(Di(p))throw new Ev("config",d(18789,null,i.id,s));return p}throw new Ev("config",d(18792,null,i.id));case"command":return this.resolveFromMap("command",i.id,s,o,"command");case"input":return this.resolveFromMap("input",i.id,s,o,"input");case"extensionInstallFolder":if(s){let p=await this._context.getExtension(s);if(!p)throw new Ev("extensionInstallFolder",d(18791,null,i.id,s));return this.fsPath(p.extensionLocation)}throw new Ev("extensionInstallFolder",d(18794,null,i.id));default:switch(r){case"workspaceRoot":case"workspaceFolder":{let p=u("workspaceFolder");return p?dm(this.fsPath(p)):void 0}case"cwd":{if(!e&&!s)return Ele();let p=u("cwd");return p?dm(this.fsPath(p)):void 0}case"workspaceRootFolderName":case"workspaceFolderBasename":{let p=u("workspaceFolderBasename");return p?dm(Jo(this.fsPath(p))):void 0}case"userHome":if(n.userHome)return n.userHome;throw new Ev("userHome",d(18786,null,i.id));case"lineNumber":{let p=this._context.getLineNumber();if(p)return p;throw new Ev("lineNumber",d(18784,null,i.id))}case"columnNumber":{let p=this._context.getColumnNumber();if(p)return p;throw new Error(d(18781,null,i.id))}case"selectedText":{let p=this._context.getSelectedText();if(p)return p;throw new Ev("selectedText",d(18785,null,i.id))}case"file":return l("file");case"fileWorkspaceFolder":return c("fileWorkspaceFolder");case"fileWorkspaceFolderBasename":return Jo(c("fileWorkspaceFolderBasename"));case"relativeFile":return e||s?pA(this.fsPath(u("relativeFile")),l("relativeFile")):l("relativeFile");case"relativeFileDirname":{let p=yd(l("relativeFileDirname"));if(e||s){let h=pA(this.fsPath(u("relativeFileDirname")),p);return h.length===0?".":h}return p}case"fileDirname":return yd(l("fileDirname"));case"fileExtname":return km(l("fileExtname"));case"fileBasename":return Jo(l("fileBasename"));case"fileBasenameNoExtension":{let p=Jo(l("fileBasenameNoExtension"));return p.slice(0,p.length-km(p).length)}case"fileDirnameBasename":return Jo(yd(l("fileDirnameBasename")));case"execPath":{let p=this._context.getExecPath();return p||i.id}case"execInstallFolder":{let p=this._context.getAppRoot();return p||i.id}case"pathSeparator":case"/":return Cu;default:try{return this.resolveFromMap("unknown",i.id,s,o,void 0)}catch{return i.id}}}}resolveFromMap(i,e,t,o,n){if(t&&o){let r=n===void 0?o[t]:o[n+":"+t];if(typeof r=="string")return r;throw new Ev(i,d(18795,null,e))}return e}};var sHo="configResolveInputLru",qMn=5,jZt=class extends $Zt{constructor(e,t,o,n,r,s,l,c,u,p,h){super({getFolderUri:g=>{let f=s.getWorkspace().folders.filter(v=>v.name===g).pop();return f?f.uri:void 0},getWorkspaceFolderCount:()=>s.getWorkspace().folders.length,getConfigurationValue:(g,f)=>n.getValue(f,g?{resource:g}:{}),getAppRoot:()=>e.getAppRoot(),getExecPath:()=>e.getExecPath(),getFilePath:()=>{let g=po.getOriginalUri(o.activeEditor,{supportSideBySide:1,filterByScheme:[Q.file,Q.vscodeUserData,this.pathService.defaultUriScheme]});if(g)return this.labelService.getUriLabel(g,{noPrefix:!0})},getWorkspaceFolderPathForFile:()=>{let g=po.getOriginalUri(o.activeEditor,{supportSideBySide:1,filterByScheme:[Q.file,Q.vscodeUserData,this.pathService.defaultUriScheme]});if(!g)return;let f=s.getWorkspaceFolder(g);if(f)return this.labelService.getUriLabel(f.uri,{noPrefix:!0})},getSelectedText:()=>{let g=o.activeTextEditorControl,f=null;if(fn(g))f=g;else if(Lc(g)){let S=g.getOriginalEditor(),y=g.getModifiedEditor();f=S.hasWidgetFocus()?S:y}let v=f?.getModel(),b=f?.getSelection();if(v&&b)return v.getValueInRange(b)},getLineNumber:()=>{let g=o.activeTextEditorControl;if(fn(g)){let f=g.getSelection();if(f){let v=f.positionLineNumber;return String(v)}}},getColumnNumber:()=>{let g=o.activeTextEditorControl;if(fn(g)){let f=g.getSelection();if(f){let v=f.positionColumn;return String(v)}}},getExtension:g=>p.getExtension(g)},c,u.userHome().then(g=>g.path),t);this.configurationService=n;this.commandService=r;this.quickInputService=l;this.labelService=c;this.pathService=u;this.storageService=h;this.userInputAccessQueue=new Hh;this.resolvableVariables.add("command"),this.resolvableVariables.add("input")}static{this.INPUT_OR_COMMAND_VARIABLES_PATTERN=/\${((input|command):(.*?))}/g}async resolveWithInteractionReplace(e,t,o,n,r){let s=eI.parse(t);if(await this.resolveWithInteraction(e,s,o,n,r)!==void 0)return s.toObject()}async resolveWithInteraction(e,t,o,n,r){let s=eI.parse(t);for(let l of s.unresolved()){let c;if(l.name==="command"){let u=(n?n[l.arg]:void 0)||l.arg,p=await this.commandService.executeCommand(u,s.toObject());if(!mr(p)){if(typeof p!="string")throw new Ev("command",d(18758,null,u));c={value:p}}}else if(l.name==="input")c=await this.showUserInput(o,l.arg,await this.resolveInputs(e,o,r),n);else if(this._contributedVariables.has(l.inner))c={value:await this._contributedVariables.get(l.inner)()};else{let u=await this.evaluateSingleVariable(l,e?.uri);if(u===void 0)continue;c=typeof u=="string"?{value:u}:u}if(c===void 0)return;s.resolve(l,c)}return new Map(yt.map(s.resolved(),([l,c])=>[l.inner,c.value]))}async resolveInputs(e,t,o){if(!t)return;let n,r=e?{resource:e.uri}:{},s=this.configurationService.inspect(t,r);if(s)switch(o){case 8:n=s.memoryValue?.inputs;break;case 7:n=s.defaultValue?.inputs;break;case 2:n=s.userValue?.inputs;break;case 3:n=s.userLocalValue?.inputs;break;case 4:n=s.userRemoteValue?.inputs;break;case 1:n=s.applicationValue?.inputs;break;case 5:n=s.workspaceValue?.inputs;break;case 6:default:n=s.workspaceFolderValue?.inputs;break}return n??=this.configurationService.getValue(t,r)?.inputs,n}readInputLru(){let e=this.storageService.get(sHo,1),t=new Ua(qMn);try{e&&t.fromJSON(JSON.parse(e))}catch{}return t}storeInputLru(e){this.storageService.store(sHo,JSON.stringify(e.toJSON()),1,1)}async showUserInput(e,t,o,n){if(!o)throw new Ev("input",d(18762,null,t,"inputs"));let r=o.filter(s=>s.id===t).pop();if(r){let s=p=>{throw new Ev("input",d(18761,null,t,r.type,p))},l=this.readInputLru(),c=`${e}.${t}`,u=l.get(c);switch(r.type){case"promptString":{We(r.description)||s("description");let p={prompt:r.description,ignoreFocusLost:!0,value:n?.[`input:${t}`]??u??r.default};return r.password&&(p.password=r.password),this.userInputAccessQueue.queue(()=>this.quickInputService.input(p)).then(h=>(typeof h=="string"&&!r.password&&this.storeInputLru(l.set(c,h)),h!==void 0?{value:h,input:r}:void 0))}case"pickString":{if(We(r.description)||s("description"),Array.isArray(r.options))for(let g of r.options)!We(g)&&!We(g.value)&&s("value");else s("options");let p=new Array;for(let g of r.options){let f=We(g)?g:g.value,v=We(g)?void 0:g.label,b={label:v?`${v}: ${f}`:f,value:f},S=n?.[`input:${t}`]??u??r.default;f===r.default?(b.description=d(18760,null),p.unshift(b)):f===S?p.unshift(b):p.push(b)}let h={placeHolder:r.description,matchOnDetail:!0,ignoreFocusLost:!0};return this.userInputAccessQueue.queue(()=>this.quickInputService.pick(p,h,void 0)).then(g=>{if(g){let f=g.value;return this.storeInputLru(l.set(c,f)),{value:f,input:r}}})}case"command":return We(r.command)||s("command"),this.userInputAccessQueue.queue(()=>this.commandService.executeCommand(r.command,r.args)).then(p=>{if(typeof p=="string"||mr(p))return{value:p,input:r};throw new Ev("input",d(18759,null,t,r.command))});default:throw new Ev("input",d(18764,null,t))}}throw new Ev("input",d(18763,null,t))}};var lye=le("shellEnvironmentService"),uji=class{getShellEnv(){return JE.shellEnv()}};Ce(lye,uji,1);var ygt=class extends jZt{constructor(i,e,t,o,n,r,s,l,c,u,p){super({getAppRoot:()=>e.appRoot,getExecPath:()=>e.execPath},l.getShellEnv(),i,t,o,n,r,s,c,u,p)}};ygt=I([m(0,ie),m(1,Jr),m(2,B),m(3,fe),m(4,Ae),m(5,$e),m(6,nt),m(7,lye),m(8,Pn),m(9,lt),m(10,de)],ygt);Ce(Xp,ygt,1);var Q$e=class extends k{constructor(e,t,o){super();this._contextKeyService=e;this._layoutService=t;this._configurationService=o;this._accessibilitySupport=0;this._onDidChangeScreenReaderOptimized=this._register(new T);this._onDidChangeReducedMotion=this._register(new T);this._onDidChangeReducedTransparency=this._register(new T);this._onDidChangeLinkUnderline=this._register(new T);this._accessibilityModeEnabledContext=Oa.bindTo(this._contextKeyService);let n=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration("editor.accessibilitySupport")&&(n(),this._onDidChangeScreenReaderOptimized.fire()),l.affectsConfiguration("workbench.reduceMotion")&&(this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._onDidChangeReducedMotion.fire()),l.affectsConfiguration("workbench.reduceTransparency")&&(this._configTransparencyReduced=this._configurationService.getValue("workbench.reduceTransparency"),this._onDidChangeReducedTransparency.fire())})),n(),this._register(this.onDidChangeScreenReaderOptimized(()=>n()));let r=ut.matchMedia("(prefers-reduced-motion: reduce)");this._systemMotionReduced=r.matches,this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion");let s=ut.matchMedia("(prefers-reduced-transparency: reduce)");this._systemTransparencyReduced=s.matches,this._configTransparencyReduced=this._configurationService.getValue("workbench.reduceTransparency"),this._linkUnderlinesEnabled=this._configurationService.getValue("accessibility.underlineLinks"),this.initReducedMotionListeners(r),this.initReducedTransparencyListeners(s),this.initLinkUnderlineListeners()}initReducedMotionListeners(e){this._register($(e,"change",()=>{this._systemMotionReduced=e.matches,this._configMotionReduced==="auto"&&this._onDidChangeReducedMotion.fire()}));let t=()=>{let o=this.isMotionReduced();this._layoutService.mainContainer.classList.toggle("monaco-reduce-motion",o),this._layoutService.mainContainer.classList.toggle("monaco-enable-motion",!o)};t(),this._register(this.onDidChangeReducedMotion(()=>t()))}initReducedTransparencyListeners(e){this._register($(e,"change",()=>{this._systemTransparencyReduced=e.matches,this._configTransparencyReduced==="auto"&&this._onDidChangeReducedTransparency.fire()}));let t=()=>{let o=this.isTransparencyReduced();this._layoutService.mainContainer.classList.toggle("monaco-reduce-transparency",o)};t(),this._register(this.onDidChangeReducedTransparency(()=>t()))}initLinkUnderlineListeners(){this._register(this._configurationService.onDidChangeConfiguration(t=>{if(t.affectsConfiguration("accessibility.underlineLinks")){let o=this._configurationService.getValue("accessibility.underlineLinks");this._linkUnderlinesEnabled=o,this._onDidChangeLinkUnderline.fire()}}));let e=()=>{let t=this._linkUnderlinesEnabled;this._layoutService.mainContainer.classList.toggle("underline-links",t)};e(),this._register(this.onDidChangeLinkUnderlines(()=>e()))}onDidChangeLinkUnderlines(e){return this._onDidChangeLinkUnderline.event(e)}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){let e=this.getAccessibilitySupportConfigurationValue();return e==="on"||e==="auto"&&this._accessibilitySupport===2}getAccessibilitySupportConfigurationValue(){let e=this._configurationService.inspect("editor.accessibilitySupport");return e.policyValue??e.memoryValue??e.workspaceFolderValue??e.workspaceValue??e.userValue??e.applicationValue??e.defaultValue??"auto"}get onDidChangeReducedMotion(){return this._onDidChangeReducedMotion.event}isMotionReduced(){let e=this._configMotionReduced;return e==="on"||e==="auto"&&this._systemMotionReduced}get onDidChangeReducedTransparency(){return this._onDidChangeReducedTransparency.event}isTransparencyReduced(){let e=this._configTransparencyReduced;return e==="on"||e==="auto"&&this._systemTransparencyReduced}alwaysUnderlineAccessKeys(){return Promise.resolve(!1)}getAccessibilitySupport(){return this._accessibilitySupport}setAccessibilitySupport(e){this._accessibilitySupport!==e&&(this._accessibilitySupport=e,this._onDidChangeScreenReaderOptimized.fire())}alert(e){cn(e)}status(e){Er(e)}};Q$e=I([m(0,X),m(1,Kl),m(2,B)],Q$e);var wgt=class extends Q$e{constructor(e,t,o,n,r,s){super(t,n,o);this._telemetryService=r;this.nativeHostService=s;this.didSendTelemetry=!1;this.shouldAlwaysUnderlineAccessKeys=void 0;this.setAccessibilitySupport(e.window.accessibilitySupport?2:1)}async alwaysUnderlineAccessKeys(){if(!ii)return!1;if(typeof this.shouldAlwaysUnderlineAccessKeys!="boolean"){let e=await this.nativeHostService.windowsGetStringRegKey("HKEY_CURRENT_USER","Control Panel\\Accessibility\\Keyboard Preference","On");this.shouldAlwaysUnderlineAccessKeys=e==="1"}return this.shouldAlwaysUnderlineAccessKeys}setAccessibilitySupport(e){super.setAccessibilitySupport(e),!this.didSendTelemetry&&e===2&&(this._telemetryService.publicLog2("accessibility",{enabled:!0}),this.didSendTelemetry=!0)}};wgt=I([m(0,Jr),m(1,X),m(2,B),m(3,Kl),m(4,_e),m(5,wo)],wgt);Ce(Ai,wgt,1);var Y$e=class{static{this.ID="workbench.contrib.linuxAccessibility"}constructor(i,e,t){let o=()=>{e.isScreenReaderOptimized()&&i.write(t.argvResource,[{path:["force-renderer-accessibility"],value:!0}],!0)};o(),e.onDidChangeScreenReaderOptimized(o)}};Y$e=I([m(0,Zg),m(1,Ai),m(2,Jr)],Y$e);Sn&&bt(Y$e.ID,Y$e,vt.BlockRestore);var QZt=class{constructor(i){this._actual=i,this._cache=new Map}dumpDebugInfo(){return this._actual.dumpDebugInfo()}resolveKeyboardEvent(i){return this._actual.resolveKeyboardEvent(i)}resolveKeybinding(i){let e=i.getHashCode(),t=this._cache.get(e);if(!t){let o=this._actual.resolveKeybinding(i);return this._cache.set(e,o),o}return t}};var YZt=class a extends Pie{constructor(i,e){super(e,i)}_keyCodeToUILabel(i){if(this._os===2)switch(i){case 15:return"\u2190";case 16:return"\u2191";case 17:return"\u2192";case 18:return"\u2193"}return sm.toString(i)}_getLabel(i){return i.isDuplicateModifierCase()?"":this._keyCodeToUILabel(i.keyCode)}_getAriaLabel(i){return i.isDuplicateModifierCase()?"":sm.toString(i.keyCode)}_getElectronAccelerator(i){return sm.toElectronAccelerator(i.keyCode)}_getUserSettingsLabel(i){if(i.isDuplicateModifierCase())return"";let e=sm.toUserSettingsUS(i.keyCode);return e&&e.toLowerCase()}_isWYSIWYG(){return!0}_getChordDispatch(i){return a.getDispatchStr(i)}static getDispatchStr(i){if(i.isModifierKey())return null;let e="";return i.ctrlKey&&(e+="ctrl+"),i.shiftKey&&(e+="shift+"),i.altKey&&(e+="alt+"),i.metaKey&&(e+="meta+"),e+=sm.toString(i.keyCode),e}_getSingleModifierChordDispatch(i){return i.keyCode===5&&!i.shiftKey&&!i.altKey&&!i.metaKey?"ctrl":i.keyCode===4&&!i.ctrlKey&&!i.altKey&&!i.metaKey?"shift":i.keyCode===6&&!i.ctrlKey&&!i.shiftKey&&!i.metaKey?"alt":i.keyCode===57&&!i.ctrlKey&&!i.shiftKey&&!i.altKey?"meta":null}static _scanCodeToKeyCode(i){let e=Fw[i];if(e!==-1)return e;switch(i){case 10:return 31;case 11:return 32;case 12:return 33;case 13:return 34;case 14:return 35;case 15:return 36;case 16:return 37;case 17:return 38;case 18:return 39;case 19:return 40;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 45;case 25:return 46;case 26:return 47;case 27:return 48;case 28:return 49;case 29:return 50;case 30:return 51;case 31:return 52;case 32:return 53;case 33:return 54;case 34:return 55;case 35:return 56;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21;case 51:return 88;case 52:return 86;case 53:return 92;case 54:return 94;case 55:return 93;case 56:return 0;case 57:return 85;case 58:return 95;case 59:return 91;case 60:return 87;case 61:return 89;case 62:return 90;case 106:return 97}return 0}static _toKeyCodeChord(i){if(!i)return null;if(i instanceof RS)return i;let e=this._scanCodeToKeyCode(i.scanCode);return e===0?null:new RS(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,e)}static resolveKeybinding(i,e){let t=jPe(i.chords.map(o=>this._toKeyCodeChord(o)));return t.length>0?[new a(t,e)]:[]}};var X$e=class{constructor(i,e){this._mapAltGrToCtrlAlt=i;this._OS=e}dumpDebugInfo(){return"FallbackKeyboardMapper dispatching on keyCode"}resolveKeyboardEvent(i){let e=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,t=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,o=new RS(e,i.shiftKey,t,i.metaKey,i.keyCode);return this.resolveKeybinding(new yz([o]))[0]}resolveKeybinding(i){return YZt.resolveKeybinding(i,this._OS)}};var Cgt=[],XZt=class extends Pie{constructor(i,e,t){super(e,t),this._mapper=i}_getLabel(i){return this._mapper.getUILabelForScanCodeChord(i)}_getAriaLabel(i){return this._mapper.getAriaLabelForScanCodeChord(i)}_getElectronAccelerator(i){return this._mapper.getElectronAcceleratorLabelForScanCodeChord(i)}_getUserSettingsLabel(i){return this._mapper.getUserSettingsLabelForScanCodeChord(i)}_isWYSIWYG(i){if(!i||Fw[i.scanCode]!==-1)return!0;let e=this._mapper.getAriaLabelForScanCodeChord(i),t=this._mapper.getUserSettingsLabelForScanCodeChord(i);return!e&&!t?!0:!e||!t?!1:e.toLowerCase()===t.toLowerCase()}_getChordDispatch(i){return this._mapper.getDispatchStrForScanCodeChord(i)}_getSingleModifierChordDispatch(i){return(i.scanCode===157||i.scanCode===161)&&!i.shiftKey&&!i.altKey&&!i.metaKey?"ctrl":(i.scanCode===159||i.scanCode===163)&&!i.ctrlKey&&!i.shiftKey&&!i.metaKey?"alt":(i.scanCode===158||i.scanCode===162)&&!i.ctrlKey&&!i.altKey&&!i.metaKey?"shift":(i.scanCode===160||i.scanCode===164)&&!i.ctrlKey&&!i.shiftKey&&!i.altKey?"meta":null}},cye=class{constructor(i,e,t,o){this.ctrlKey=i,this.shiftKey=e,this.altKey=t,this.scanCode=o}toString(){return`${this.ctrlKey?"Ctrl+":""}${this.shiftKey?"Shift+":""}${this.altKey?"Alt+":""}${DS.toString(this.scanCode)}`}equals(i){return this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.scanCode===i.scanCode}getProducedCharCode(i){return i?this.ctrlKey&&this.shiftKey&&this.altKey?i.withShiftAltGr:this.ctrlKey&&this.altKey?i.withAltGr:this.shiftKey?i.withShift:i.value:""}getProducedChar(i){let e=Gae.getCharCode(this.getProducedCharCode(i));return e===0?" --- ":e>=768&&e<=879?"U+"+e.toString(16):"  "+String.fromCharCode(e)+"  "}},xgt=class{constructor(i,e,t,o){this.ctrlKey=i,this.shiftKey=e,this.altKey=t,this.keyCode=o}toString(){return`${this.ctrlKey?"Ctrl+":""}${this.shiftKey?"Shift+":""}${this.altKey?"Alt+":""}${sm.toString(this.keyCode)}`}},pji=class{constructor(){this._scanCodeToKeyCode=[];this._keyCodeToScanCode=[];this._scanCodeToKeyCode=[],this._keyCodeToScanCode=[]}registrationComplete(){this._moveToEnd(56),this._moveToEnd(106)}_moveToEnd(i){for(let e=0;e<8;e++){let t=this._scanCodeToKeyCode[(i<<3)+e];if(t)for(let o=0,n=t.length;o<n;o++){let r=this._keyCodeToScanCode[t[o]];if(r.length!==1)for(let s=0,l=r.length;s<l;s++){let c=r[s];if(c>>>3===i){for(let p=s+1;p<l;p++)r[p-1]=r[p];r[l-1]=c}}}}}registerIfUnknown(i,e){if(e.keyCode===0)return;let t=this._encodeScanCodeCombo(i),o=this._encodeKeyCodeCombo(e),n=e.keyCode>=21&&e.keyCode<=30,r=e.keyCode>=31&&e.keyCode<=56,s=this._scanCodeToKeyCode[t];if(n||r){if(s){for(let l=0,c=s.length;l<c;l++)if(s[l]===o)return}}else if(s&&s.length!==0)return;this._scanCodeToKeyCode[t]=this._scanCodeToKeyCode[t]||[],this._scanCodeToKeyCode[t].unshift(o),this._keyCodeToScanCode[o]=this._keyCodeToScanCode[o]||[],this._keyCodeToScanCode[o].unshift(t)}lookupKeyCodeCombo(i){let e=this._encodeKeyCodeCombo(i),t=this._keyCodeToScanCode[e];if(!t||t.length===0)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n],l=!!(s&1),c=!!(s&2),u=!!(s&4),p=s>>>3;o[n]=new cye(l,c,u,p)}return o}lookupScanCodeCombo(i){let e=this._encodeScanCodeCombo(i),t=this._scanCodeToKeyCode[e];if(!t||t.length===0)return[];let o=[];for(let n=0,r=t.length;n<r;n++){let s=t[n],l=!!(s&1),c=!!(s&2),u=!!(s&4),p=s>>>3;o[n]=new xgt(l,c,u,p)}return o}guessStableKeyCode(i){if(i>=36&&i<=45)switch(i){case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21}let e=this.lookupScanCodeCombo(new cye(!1,!1,!1,i)),t=this.lookupScanCodeCombo(new cye(!1,!0,!1,i));if(e.length===1&&t.length===1){let o=e[0].shiftKey,n=e[0].keyCode,r=t[0].shiftKey,s=t[0].keyCode;if(n===s&&o!==r)return n}return-1}_encodeScanCodeCombo(i){return this._encode(i.ctrlKey,i.shiftKey,i.altKey,i.scanCode)}_encodeKeyCodeCombo(i){return this._encode(i.ctrlKey,i.shiftKey,i.altKey,i.keyCode)}_encode(i,e,t,o){return((i?1:0)<<0|(e?1:0)<<1|(t?1:0)<<2|o<<3)>>>0}},Gae=class a{constructor(i,e,t,o){this._isUSStandard=i;this._mapAltGrToCtrlAlt=t;this._OS=o;this._scanCodeToLabel=[];this._scanCodeToDispatch=[];this._codeInfo=[],this._scanCodeKeyCodeMapper=new pji,this._scanCodeToLabel=[],this._scanCodeToDispatch=[];let n=(u,p,h,g,f,v,b,S)=>{this._scanCodeKeyCodeMapper.registerIfUnknown(new cye(!!u,!!p,!!h,g),new xgt(!!f,!!v,!!b,S))},r=(u,p,h,g,f)=>{for(let v=u;v<=1;v++)for(let b=p;b<=1;b++)for(let S=h;S<=1;S++)n(v,b,S,g,v,b,S,f)};for(let u=0;u<193;u++)this._scanCodeToLabel[u]=null;for(let u=0;u<193;u++)this._scanCodeToDispatch[u]=null;for(let u=0;u<193;u++){let p=Fw[u];p!==-1&&(r(0,0,0,u,p),this._scanCodeToLabel[u]=sm.toString(p),p===0||eF(p)?this._scanCodeToDispatch[u]=null:this._scanCodeToDispatch[u]=`[${DS.toString(u)}]`)}let s={};{let u=[];for(let h in e)if(e.hasOwnProperty(h)){let g=DS.toEnum(h);if(g===0||Fw[g]!==-1)continue;let f=e[h],v=a.getCharCode(f.value);if(v>=97&&v<=122){let b=65+(v-97);u[b]=!0}}let p=(h,g,f,v)=>{u[h]||(s[DS.toString(g)]={value:f,withShift:v,withAltGr:"",withShiftAltGr:""})};p(65,10,"a","A"),p(66,11,"b","B"),p(67,12,"c","C"),p(68,13,"d","D"),p(69,14,"e","E"),p(70,15,"f","F"),p(71,16,"g","G"),p(72,17,"h","H"),p(73,18,"i","I"),p(74,19,"j","J"),p(75,20,"k","K"),p(76,21,"l","L"),p(77,22,"m","M"),p(78,23,"n","N"),p(79,24,"o","O"),p(80,25,"p","P"),p(81,26,"q","Q"),p(82,27,"r","R"),p(83,28,"s","S"),p(84,29,"t","T"),p(85,30,"u","U"),p(86,31,"v","V"),p(87,32,"w","W"),p(88,33,"x","X"),p(89,34,"y","Y"),p(90,35,"z","Z")}let l=[],c=0;for(let u in e)if(e.hasOwnProperty(u)){let p=DS.toEnum(u);if(p===0||Fw[p]!==-1)continue;this._codeInfo[p]=e[u];let h=s[u]||e[u],g=a.getCharCode(h.value),f=a.getCharCode(h.withShift),v=a.getCharCode(h.withAltGr),b=a.getCharCode(h.withShiftAltGr),S={scanCode:p,value:g,withShift:f,withAltGr:v,withShiftAltGr:b};if(l[c++]=S,this._scanCodeToDispatch[p]=`[${DS.toString(p)}]`,g>=97&&g<=122){let y=65+(g-97);this._scanCodeToLabel[p]=String.fromCharCode(y)}else g>=65&&g<=90?this._scanCodeToLabel[p]=String.fromCharCode(g):g?this._scanCodeToLabel[p]=String.fromCharCode(g):this._scanCodeToLabel[p]=null}for(let u=l.length-1;u>=0;u--){let p=l[u],h=p.scanCode,g=p.withShiftAltGr;if(g===p.withAltGr||g===p.withShift||g===p.value)continue;let f=a._charCodeToKb(g);if(!f)continue;let v=f.shiftKey,b=f.keyCode;v?n(1,1,1,h,0,1,0,b):n(1,1,1,h,0,0,0,b)}for(let u=l.length-1;u>=0;u--){let p=l[u],h=p.scanCode,g=p.withAltGr;if(g===p.withShift||g===p.value)continue;let f=a._charCodeToKb(g);if(!f)continue;let v=f.shiftKey,b=f.keyCode;v?n(1,0,1,h,0,1,0,b):n(1,0,1,h,0,0,0,b)}for(let u=l.length-1;u>=0;u--){let p=l[u],h=p.scanCode,g=p.withShift;if(g===p.value)continue;let f=a._charCodeToKb(g);if(!f)continue;let v=f.shiftKey,b=f.keyCode;v?(n(0,1,0,h,0,1,0,b),n(0,1,1,h,0,1,1,b),n(1,1,0,h,1,1,0,b),n(1,1,1,h,1,1,1,b)):(n(0,1,0,h,0,0,0,b),n(0,1,0,h,0,1,0,b),n(0,1,1,h,0,0,1,b),n(0,1,1,h,0,1,1,b),n(1,1,0,h,1,0,0,b),n(1,1,0,h,1,1,0,b),n(1,1,1,h,1,0,1,b),n(1,1,1,h,1,1,1,b))}for(let u=l.length-1;u>=0;u--){let p=l[u],h=p.scanCode,g=a._charCodeToKb(p.value);if(!g)continue;let f=g.shiftKey,v=g.keyCode;f?(n(0,0,0,h,0,1,0,v),n(0,0,1,h,0,1,1,v),n(1,0,0,h,1,1,0,v),n(1,0,1,h,1,1,1,v)):(n(0,0,0,h,0,0,0,v),n(0,0,1,h,0,0,1,v),n(0,1,0,h,0,1,0,v),n(0,1,1,h,0,1,1,v),n(1,0,0,h,1,0,0,v),n(1,0,1,h,1,0,1,v),n(1,1,0,h,1,1,0,v),n(1,1,1,h,1,1,1,v))}r(0,0,0,36,22),r(0,0,0,37,23),r(0,0,0,38,24),r(0,0,0,39,25),r(0,0,0,40,26),r(0,0,0,41,27),r(0,0,0,42,28),r(0,0,0,43,29),r(0,0,0,44,30),r(0,0,0,45,21),this._scanCodeKeyCodeMapper.registrationComplete()}dumpDebugInfo(){let i=[],e=[88,104],t=0;i.push(`isUSStandard: ${this._isUSStandard}`),i.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");for(let o=0;o<193;o++){if(Fw[o]!==-1&&e.indexOf(o)===-1)continue;t%4===0&&(i.push("|       HW Code combination      |  Key  |    KeyCode combination    | Pri |          UI label         |         User settings          |    Electron accelerator   |       Dispatching string       | WYSIWYG |"),i.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")),t++;let n=this._codeInfo[o];for(let r=0;r<8;r++){let s=!!(r&1),l=!!(r&2),c=!!(r&4),u=new cye(s,l,c,o),p=this.resolveKeyboardEvent({_standardKeyboardEventBrand:!0,ctrlKey:u.ctrlKey,shiftKey:u.shiftKey,altKey:u.altKey,metaKey:!1,altGraphKey:!1,keyCode:-1,code:DS.toString(o)}),h=u.toString(),g=u.getProducedChar(n),f=p.getAriaLabel(),v=f?f.replace(/Control\+/,"Ctrl+"):null,b=p.getUserSettingsLabel(),S=p.getElectronAccelerator(),y=p.getDispatchChords()[0],x=(p?p.isWYSIWYG():!1)?"       ":"   NO  ",E=this._scanCodeKeyCodeMapper.lookupScanCodeCombo(u);if(E.length===0)i.push(`| ${this._leftPad(h,30)} | ${g} | ${this._leftPad("",25)} | ${this._leftPad("",3)} | ${this._leftPad(v,25)} | ${this._leftPad(b,30)} | ${this._leftPad(S,25)} | ${this._leftPad(y,30)} | ${x} |`);else for(let M=0,N=E.length;M<N;M++){let V=E[M],H,K=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(V);if(K.length===1)H="";else{let J=-1;for(let se=0;se<K.length;se++)if(K[se].equals(u)){J=se+1;break}H=String(J)}let j=V.toString();M===0?i.push(`| ${this._leftPad(h,30)} | ${g} | ${this._leftPad(j,25)} | ${this._leftPad(H,3)} | ${this._leftPad(v,25)} | ${this._leftPad(b,30)} | ${this._leftPad(S,25)} | ${this._leftPad(y,30)} | ${x} |`):i.push(`| ${this._leftPad("",30)} |       | ${this._leftPad(j,25)} | ${this._leftPad(H,3)} | ${this._leftPad("",25)} | ${this._leftPad("",30)} | ${this._leftPad("",25)} | ${this._leftPad("",30)} |         |`)}}i.push("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")}return i.join(`
`)}_leftPad(i,e){for(i===null&&(i="null");i.length<e;)i=" "+i;return i}keyCodeChordToScanCodeChord(i){if(i.keyCode===3)return[new IL(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,46)];let e=this._scanCodeKeyCodeMapper.lookupKeyCodeCombo(new xgt(i.ctrlKey,i.shiftKey,i.altKey,i.keyCode)),t=[];for(let o=0,n=e.length;o<n;o++){let r=e[o];t[o]=new IL(r.ctrlKey,r.shiftKey,r.altKey,i.metaKey,r.scanCode)}return t}getUILabelForScanCodeChord(i){if(!i)return null;if(i.isDuplicateModifierCase())return"";if(this._OS===2)switch(i.scanCode){case 86:return"\u2190";case 88:return"\u2191";case 85:return"\u2192";case 87:return"\u2193"}return this._scanCodeToLabel[i.scanCode]}getAriaLabelForScanCodeChord(i){return i?i.isDuplicateModifierCase()?"":this._scanCodeToLabel[i.scanCode]:null}getDispatchStrForScanCodeChord(i){let e=this._scanCodeToDispatch[i.scanCode];if(!e)return null;let t="";return i.ctrlKey&&(t+="ctrl+"),i.shiftKey&&(t+="shift+"),i.altKey&&(t+="alt+"),i.metaKey&&(t+="meta+"),t+=e,t}getUserSettingsLabelForScanCodeChord(i){if(!i)return null;if(i.isDuplicateModifierCase())return"";let e=Fw[i.scanCode];if(e!==-1)return sm.toUserSettingsUS(e).toLowerCase();let t=this._scanCodeKeyCodeMapper.guessStableKeyCode(i.scanCode);if(t!==-1){let o=this.keyCodeChordToScanCodeChord(new RS(i.ctrlKey,i.shiftKey,i.altKey,i.metaKey,t));for(let n=0,r=o.length;n<r;n++)if(o[n].scanCode===i.scanCode)return sm.toUserSettingsUS(t).toLowerCase()}return this._scanCodeToDispatch[i.scanCode]}getElectronAcceleratorLabelForScanCodeChord(i){if(!i)return null;let e=Fw[i.scanCode];if(e!==-1)return sm.toElectronAccelerator(e);let t=this._scanCodeKeyCodeMapper.guessStableKeyCode(i.scanCode);return this._OS===3&&!this._isUSStandard&&(t===85||t===86||t===87||t===88||t===89||t===90||t===91||t===92||t===93||t===94)?null:t!==-1?sm.toElectronAccelerator(t):null}_toResolvedKeybinding(i){if(i.length===0)return[];let e=[];return this._generateResolvedKeybindings(i,0,[],e),e}_generateResolvedKeybindings(i,e,t,o){let n=i[e],r=e===i.length-1;for(let s=0,l=n.length;s<l;s++){let c=[...t,n[s]];r?o.push(new XZt(this,this._OS,c)):this._generateResolvedKeybindings(i,e+1,c,o)}}resolveKeyboardEvent(i){let e=DS.toEnum(i.code);e===94&&(e=46);let t=i.keyCode;if(t===15||t===16||t===17||t===18||t===20||t===19||t===14||t===13||t===12||t===11||t===1){let s=nwe[t];s!==-1&&(e=s)}else if((e===95||e===96||e===97||e===98||e===99||e===100||e===101||e===102||e===103||e===104||e===105)&&t>=0){let s=nwe[t];s!==-1&&(e=s)}let o=i.ctrlKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,n=i.altKey||this._mapAltGrToCtrlAlt&&i.altGraphKey,r=new IL(o,i.shiftKey,n,i.metaKey,e);return new XZt(this,this._OS,[r])}_resolveChord(i){return i?i instanceof IL?[i]:this.keyCodeChordToScanCodeChord(i):[]}resolveKeybinding(i){let e=i.chords.map(t=>this._resolveChord(t));return this._toResolvedKeybinding(e)}static _redirectCharCode(i){switch(i){case 12290:return 46;case 12300:return 91;case 12301:return 93;case 12304:return 91;case 12305:return 93;case 65307:return 59;case 65292:return 44}return i}static _charCodeToKb(i){return i=this._redirectCharCode(i),i<Cgt.length?Cgt[i]:null}static getCharCode(i){if(i.length===0)return 0;let e=i.charCodeAt(0);switch(e){case 768:return 96;case 769:return 180;case 770:return 94;case 771:return 732;case 772:return 175;case 773:return 8254;case 774:return 728;case 775:return 729;case 776:return 168;case 778:return 730;case 779:return 733}return e}};(function(){function a(i,e,t){for(let o=Cgt.length;o<i;o++)Cgt[o]=null;Cgt[i]={keyCode:e,shiftKey:t}}for(let i=65;i<=90;i++)a(i,31+(i-65),!0);for(let i=97;i<=122;i++)a(i,31+(i-97),!1);a(59,85,!1),a(58,85,!0),a(61,86,!1),a(43,86,!0),a(44,87,!1),a(60,87,!0),a(45,88,!1),a(95,88,!0),a(46,89,!1),a(62,89,!0),a(47,90,!1),a(63,90,!0),a(96,91,!1),a(126,91,!0),a(91,92,!1),a(123,92,!0),a(92,93,!1),a(124,93,!0),a(93,94,!1),a(125,94,!0),a(39,95,!1),a(34,95,!0)})();function aHo(a){let i=a.getValue("keyboard"),e=i?.dispatch==="keyCode"?1:0,t=!!i?.mapAltGrToCtrlAlt;return{dispatch:e,mapAltGrToCtrlAlt:t}}var $Mn=oe.as($t.Configuration),jMn={id:"keyboard",order:15,type:"object",title:d(2372,null),properties:{"keyboard.dispatch":{scope:1,type:"string",enum:["code","keyCode"],default:"code",markdownDescription:d(2371,null),included:Ao===2||Ao===3},"keyboard.mapAltGrToCtrlAlt":{scope:1,type:"boolean",default:!1,markdownDescription:d(2373,null),included:Ao===1}}};$Mn.registerConfiguration(jMn);var kgt=class extends k{constructor(e,t){super();this._nativeKeyboardLayoutService=e;this._configurationService=t;this._onDidChangeKeyboardLayout=this._register(new T);this.onDidChangeKeyboardLayout=this._onDidChangeKeyboardLayout.event;this._keyboardMapper=null,this._register(this._nativeKeyboardLayoutService.onDidChangeKeyboardLayout(async()=>{this._keyboardMapper=null,this._onDidChangeKeyboardLayout.fire()})),this._register(t.onDidChangeConfiguration(async o=>{o.affectsConfiguration("keyboard")&&(this._keyboardMapper=null,this._onDidChangeKeyboardLayout.fire())}))}getRawKeyboardMapping(){return this._nativeKeyboardLayoutService.getRawKeyboardMapping()}getCurrentKeyboardLayout(){return this._nativeKeyboardLayoutService.getCurrentKeyboardLayout()}getAllKeyboardLayouts(){return[]}getKeyboardMapper(){let e=aHo(this._configurationService);return e.dispatch===1?new X$e(e.mapAltGrToCtrlAlt,Ao):(this._keyboardMapper||(this._keyboardMapper=new QZt(QMn(this.getCurrentKeyboardLayout(),this.getRawKeyboardMapping(),e.mapAltGrToCtrlAlt))),this._keyboardMapper)}validateCurrentKeyboardMapping(e){}};kgt=I([m(0,aZt),m(1,B)],kgt);function QMn(a,i,e){let t=YMn(a);return Ao===1?new wNe(t,i,e):!i||Object.keys(i).length===0?new X$e(e,Ao):Ao===2&&a.id==="com.apple.keylayout.DVORAK-QWERTYCMD"?new X$e(e,Ao):new Gae(t,i,e,Ao)}function YMn(a){if(!a)return!1;if(Ao===3){let i=a;return i.layout.split(/,/g)[i.group]==="us"}return Ao===2?a.id==="com.apple.keylayout.US":Ao===1?a.name==="00000409":!1}Ce(GUt,kgt,1);var Egt=class extends fZ{constructor(i,e,t){super(e.userHome,i,e,t)}};Egt=I([m(0,bo),m(1,Jr),m(2,Ae)],Egt);Ce(Pn,Egt,1);var qae=class extends k{constructor(e,t,o,n){super();this.nativeHostService=e;this.storageService=o;this._onDidChangeColorScheme=this._register(new T);this.onDidChangeColorScheme=this._onDidChangeColorScheme.event;this._register(this.nativeHostService.onDidChangeColorScheme(s=>this.update(s)));let r=t.window.colorScheme;n.startupKind===3&&(r=this.getStoredValue(r)),this.dark=r.dark,this.highContrast=r.highContrast,this.nativeHostService.getOSColorScheme().then(s=>this.update(s))}static{this.STORAGE_KEY="HostColorSchemeData"}getStoredValue(e){let t=this.storageService.get(qae.STORAGE_KEY,-1);if(t)try{let o=JSON.parse(t);if(Di(o)&&Xa(o.highContrast)&&Xa(o.dark))return o}catch{}return e}update({highContrast:e,dark:t}){(t!==this.dark||e!==this.highContrast)&&(this.dark=t,this.highContrast=e,this.storageService.store(qae.STORAGE_KEY,JSON.stringify({highContrast:e,dark:t}),-1,1),this._onDidChangeColorScheme.fire())}};qae=I([m(0,wo),m(1,Jr),m(2,de),m(3,to)],qae);Ce(e1t,qae,1);var dye=class extends Error{constructor(e,t){super(e);this.code=t}},$ae=le("IExtensionsProfileScannerService"),J$e=class extends k{constructor(e,t,o,n,r){super();this.extensionsLocation=e;this.fileService=t;this.userDataProfilesService=o;this.uriIdentityService=n;this.logService=r;this._onAddExtensions=this._register(new T);this.onAddExtensions=this._onAddExtensions.event;this._onDidAddExtensions=this._register(new T);this.onDidAddExtensions=this._onDidAddExtensions.event;this._onRemoveExtensions=this._register(new T);this.onRemoveExtensions=this._onRemoveExtensions.event;this._onDidRemoveExtensions=this._register(new T);this.onDidRemoveExtensions=this._onDidRemoveExtensions.event;this.resourcesAccessQueueMap=new dt}scanProfileExtensions(e,t){return this.withProfileExtensions(e,void 0,t)}async addExtensionsToProfile(e,t,o){let n=[],r=[];try{return await this.withProfileExtensions(t,s=>{let l=[];if(o)l.push(...s);else for(let c of s)e.some(([u])=>Ht(u.identifier,c.identifier)&&u.manifest.version!==c.version)?n.push(c):l.push(c);for(let[c,u]of e){let p=l.findIndex(g=>Ht(g.identifier,c.identifier)&&g.version===c.manifest.version),h={identifier:c.identifier,version:c.manifest.version,location:c.location,metadata:u};p===-1?(r.push(h),l.push(h)):l.splice(p,1,h)}return r.length&&this._onAddExtensions.fire({extensions:r,profileLocation:t}),n.length&&this._onRemoveExtensions.fire({extensions:n,profileLocation:t}),l}),r.length&&this._onDidAddExtensions.fire({extensions:r,profileLocation:t}),n.length&&this._onDidRemoveExtensions.fire({extensions:n,profileLocation:t}),r}catch(s){throw r.length&&this._onDidAddExtensions.fire({extensions:r,error:s,profileLocation:t}),n.length&&this._onDidRemoveExtensions.fire({extensions:n,error:s,profileLocation:t}),s}}async updateMetadata(e,t){let o=[];return await this.withProfileExtensions(t,n=>{let r=[];for(let s of n){let l=e.find(([c])=>Ht({id:c.identifier.id},{id:s.identifier.id})&&c.manifest.version===s.version);l&&(s.metadata={...s.metadata,...l[1]},o.push(s)),r.push(s)}return r}),o}async removeExtensionsFromProfile(e,t){let o=[];try{await this.withProfileExtensions(t,n=>{let r=[];for(let s of n)e.some(l=>Ht(s.identifier,l))?o.push(s):r.push(s);return o.length&&this._onRemoveExtensions.fire({extensions:o,profileLocation:t}),r}),o.length&&this._onDidRemoveExtensions.fire({extensions:o,profileLocation:t})}catch(n){throw o.length&&this._onDidRemoveExtensions.fire({extensions:o,error:n,profileLocation:t}),n}}async withProfileExtensions(e,t,o){return this.getResourceAccessQueue(e).queue(async()=>{let n=[],r;try{let s=await this.fileService.readFile(e);r=JSON.parse(s.value.toString().trim()||"[]")}catch(s){if(rp(s)!==1)throw s;if(this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)&&(r=await this.migrateFromOldDefaultProfileExtensionsLocation()),!r&&o?.bailOutWhenFileNotFound)throw new dye(Dn(s),"ERROR_PROFILE_NOT_FOUND")}if(r){Array.isArray(r)||this.throwInvalidConentError(e);let s=!1;for(let l of r){lHo(l)||this.throwInvalidConentError(e);let c;if(We(l.relativeLocation)&&l.relativeLocation)c=this.resolveExtensionLocation(l.relativeLocation);else if(We(l.location)){this.logService.warn(`Extensions profile: Ignoring extension with invalid location: ${l.location}`);continue}else{c=A.revive(l.location);let p=this.toRelativePath(c);p&&(s=!0,l.relativeLocation=p)}bn(l.metadata?.hasPreReleaseVersion)&&l.metadata?.preRelease&&(s=!0,l.metadata.hasPreReleaseVersion=!0);let u=l.metadata?.id??l.identifier.uuid;n.push({identifier:u?{id:l.identifier.id,uuid:u}:{id:l.identifier.id},location:c,version:l.version,metadata:l.metadata})}s&&await this.fileService.writeFile(e,Ke.fromString(JSON.stringify(r)))}if(t){n=t(n);let s=n.map(l=>({identifier:l.identifier,version:l.version,location:l.location.toJSON(),relativeLocation:this.toRelativePath(l.location),metadata:l.metadata}));await this.fileService.writeFile(e,Ke.fromString(JSON.stringify(s)))}return n})}throwInvalidConentError(e){throw new dye(`Invalid extensions content in ${e.toString()}`,"ERROR_INVALID_CONTENT")}toRelativePath(e){return this.uriIdentityService.extUri.isEqual(this.uriIdentityService.extUri.dirname(e),this.extensionsLocation)?this.uriIdentityService.extUri.basename(e):void 0}resolveExtensionLocation(e){return this.uriIdentityService.extUri.joinPath(this.extensionsLocation,e)}async migrateFromOldDefaultProfileExtensionsLocation(){return this._migrationPromise||(this._migrationPromise=(async()=>{let e=this.uriIdentityService.extUri.joinPath(this.userDataProfilesService.defaultProfile.location,"extensions.json"),t=this.uriIdentityService.extUri.joinPath(this.extensionsLocation,".init-default-profile-extensions"),o;try{o=(await this.fileService.readFile(e)).value.toString()}catch(r){if(rp(r)===1)return;throw r}this.logService.info("Migrating extensions from old default profile location",e.toString());let n;try{let r=JSON.parse(o);Array.isArray(r)&&r.every(s=>lHo(s))?n=r:this.logService.warn("Skipping migrating from old default profile locaiton: Found invalid data",r)}catch(r){this.logService.error(r)}if(n)try{await this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource,Ke.fromString(JSON.stringify(n)),{overwrite:!1}),this.logService.info("Migrated extensions from old default profile location to new location",e.toString(),this.userDataProfilesService.defaultProfile.extensionsResource.toString())}catch(r){if(rp(r)===3)this.logService.info("Migration from old default profile location to new location is done by another window",e.toString(),this.userDataProfilesService.defaultProfile.extensionsResource.toString());else throw r}try{await this.fileService.del(e)}catch(r){rp(r)!==1&&this.logService.error(r)}try{await this.fileService.del(t)}catch(r){rp(r)!==1&&this.logService.error(r)}return n})()),this._migrationPromise}getResourceAccessQueue(e){let t=this.resourcesAccessQueueMap.get(e);return t||(t=new Hh,this.resourcesAccessQueueMap.set(e,t)),t}};J$e=I([m(1,ge),m(2,hn),m(3,gt),m(4,re)],J$e);function lHo(a){let i=a;return Di(i)&&Rno(i.identifier)&&(XMn(i.location)||We(i.location)&&!!i.location)&&(bn(i.relativeLocation)||We(i.relativeLocation))&&!!i.version&&We(i.version)}function XMn(a){if(!a)return!1;let i=a;return typeof i?.path=="string"&&typeof i?.scheme=="string"}var cHo;(i=>{function a(e,t){if(e===t)return!0;let o=Object.keys(e),n=new Set;for(let r of Object.keys(t))n.add(r);if(o.length!==n.size)return!1;for(let r of o){if(e[r]!==t[r])return!1;n.delete(r)}return n.size===0}i.equals=a})(cHo||={});function dHo(a,i){let e=new Set;for(let t of a.builtInExtensionsEnabledWithAutoUpdates){let o=t.toLowerCase();i.skipBuiltinExtensions?.some(n=>n.toLowerCase()===o)||e.add(o)}return e}var N7=le("IExtensionsScannerService"),Tgt=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g){super();this.systemExtensionsLocation=e;this.userExtensionsLocation=t;this.extensionsControlLocation=o;this.userDataProfilesService=r;this.extensionsProfileScannerService=s;this.fileService=l;this.logService=c;this.environmentService=u;this.productService=p;this.uriIdentityService=h;this.instantiationService=g;this._onDidChangeCache=this._register(new T);this.onDidChangeCache=this._onDidChangeCache.event;this.initializeDefaultProfileExtensionsPromise=void 0;this.systemExtensionsCachedScanner=this._register(this.instantiationService.createInstance(eje,n)),this.userExtensionsCachedScanner=this._register(this.instantiationService.createInstance(eje,n)),this.extensionsScanner=this._register(this.instantiationService.createInstance(Z$e)),this._register(this.systemExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(0))),this._register(this.userExtensionsCachedScanner.onDidChangeCache(()=>this._onDidChangeCache.fire(1)))}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=$Rt(this.fileService,this.logService)),this._targetPlatformPromise}async scanAllExtensions(e,t){let[o,n]=await Promise.all([this.scanSystemExtensions(e),this.scanUserExtensions(t)]);return this.dedupExtensions(o,n,[],await this.getTargetPlatform(),!0)}async scanSystemExtensions(e){let t=[];t.push(this.scanDefaultSystemExtensions(e.language)),t.push(this.scanDevSystemExtensions(e.language,!!e.checkControlFile));let[o,n]=await Promise.all(t),r=[...o,...n];if(this.environmentService.skipBuiltinExtensions?.length){let s=new Set(this.environmentService.skipBuiltinExtensions.map(l=>l.toLowerCase()));r=r.filter(l=>!s.has(l.identifier.id.toLowerCase()))}return this.applyScanOptions(r,0,{pickLatest:!1})}async scanUserExtensions(e){this.logService.trace("Started scanning user extensions",e.profileLocation);let t=this.uriIdentityService.extUri.isEqual(e.profileLocation,this.userDataProfilesService.defaultProfile.extensionsResource)?{bailOutWhenFileNotFound:!0}:void 0,o=await this.createExtensionScannerInput(e.profileLocation,!0,1,e.language,!0,t,e.productVersion??this.getProductVersion()),n=e.useCache&&!o.devMode?this.userExtensionsCachedScanner:this.extensionsScanner,r;try{r=await n.scanExtensions(o)}catch(s){if(s instanceof dye&&s.code==="ERROR_PROFILE_NOT_FOUND")await this.doInitializeDefaultProfileExtensions(),r=await n.scanExtensions(o);else throw s}return r=await this.applyScanOptions(r,1,{includeInvalid:e.includeInvalid,pickLatest:!0}),this.logService.trace("Scanned user extensions:",r.length),r}async scanAllUserExtensions(e={includeInvalid:!0,includeAllVersions:!0}){let t=await this.createExtensionScannerInput(this.userExtensionsLocation,!1,1,void 0,!0,void 0,this.getProductVersion()),o=await this.extensionsScanner.scanExtensions(t);return this.applyScanOptions(o,1,{includeAllVersions:e.includeAllVersions,includeInvalid:e.includeInvalid})}async scanExtensionsUnderDevelopment(e,t){if(this.environmentService.isExtensionDevelopment&&this.environmentService.extensionDevelopmentLocationURI){let o=(await Promise.all(this.environmentService.extensionDevelopmentLocationURI.filter(n=>n.scheme===Q.file).map(async n=>{let r=await this.createExtensionScannerInput(n,!1,1,t.language,!1,void 0,this.getProductVersion());return(await this.extensionsScanner.scanOneOrMultipleExtensions(r)).map(l=>(l.type=e.find(c=>Ht(c.identifier,l.identifier))?.type??l.type,this.extensionsScanner.validate(l,r)))}))).flat();return this.applyScanOptions(o,"development",{includeInvalid:t.includeInvalid,pickLatest:!0})}return[]}async scanExistingExtension(e,t,o){let n=await this.createExtensionScannerInput(e,!1,t,o.language,!0,void 0,this.getProductVersion()),r=await this.extensionsScanner.scanExtension(n);return!r||!o.includeInvalid&&!r.isValid?null:r}async scanOneOrMultipleExtensions(e,t,o){let n=await this.createExtensionScannerInput(e,!1,t,o.language,!0,void 0,this.getProductVersion()),r=await this.extensionsScanner.scanOneOrMultipleExtensions(n);return this.applyScanOptions(r,t,{includeInvalid:o.includeInvalid,pickLatest:!0})}async scanMultipleExtensions(e,t,o){let n=[];return await Promise.all(e.map(async r=>{let s=await this.scanOneOrMultipleExtensions(r,t,o);n.push(...s)})),this.applyScanOptions(n,t,{includeInvalid:o.includeInvalid,pickLatest:!0})}async updateManifestMetadata(e,t){let o=Ve(e,"package.json"),n=(await this.fileService.readFile(o)).value.toString(),r=JSON.parse(n);r.__metadata={...r.__metadata,...t},await this.fileService.writeFile(Ve(e,"package.json"),Ke.fromString(JSON.stringify(r,null,"	")))}async initializeDefaultProfileExtensions(){try{await this.extensionsProfileScannerService.scanProfileExtensions(this.userDataProfilesService.defaultProfile.extensionsResource,{bailOutWhenFileNotFound:!0})}catch(e){if(e instanceof dye&&e.code==="ERROR_PROFILE_NOT_FOUND")await this.doInitializeDefaultProfileExtensions();else throw e}}async doInitializeDefaultProfileExtensions(){return this.initializeDefaultProfileExtensionsPromise||(this.initializeDefaultProfileExtensionsPromise=(async()=>{try{this.logService.info("Started initializing default profile extensions in extensions installation folder.",this.userExtensionsLocation.toString());let e=await this.scanAllUserExtensions({includeInvalid:!0});if(e.length)await this.extensionsProfileScannerService.addExtensionsToProfile(e.map(t=>[t,t.metadata]),this.userDataProfilesService.defaultProfile.extensionsResource);else try{await this.fileService.createFile(this.userDataProfilesService.defaultProfile.extensionsResource,Ke.fromString(JSON.stringify([])))}catch(t){rp(t)!==1&&this.logService.warn("Failed to create default profile extensions manifest in extensions installation folder.",this.userExtensionsLocation.toString(),Dn(t))}this.logService.info("Completed initializing default profile extensions in extensions installation folder.",this.userExtensionsLocation.toString())}catch(e){this.logService.error(e)}finally{this.initializeDefaultProfileExtensionsPromise=void 0}})()),this.initializeDefaultProfileExtensionsPromise}async applyScanOptions(e,t,o={}){return o.includeAllVersions||(e=this.dedupExtensions(t===0?e:void 0,t===1?e:void 0,t==="development"?e:void 0,await this.getTargetPlatform(),!!o.pickLatest)),o.includeInvalid||(e=e.filter(n=>n.isValid)),e.sort((n,r)=>{let s=Jo(n.location.fsPath),l=Jo(r.location.fsPath);return s<l?-1:s>l?1:0})}dedupExtensions(e,t,o,n,r){let s=(u,p,h)=>{if(!h&&!(u.isBuiltin||p.isBuiltin)){if(u.metadata?.isApplicationScoped&&!p.metadata?.isApplicationScoped)return!1;if(!u.metadata?.isApplicationScoped&&p.metadata?.isApplicationScoped)return!0}if(u.isValid&&!p.isValid)return!1;if(u.isValid===p.isValid){if(r&&BM(u.manifest.version,p.manifest.version))return this.logService.debug(`Skipping extension ${p.location.path} with lower version ${p.manifest.version} in favour of ${u.location.path} with version ${u.manifest.version}`),!1;if(pAt(u.manifest.version,p.manifest.version)){if(u.type===0)return this.logService.debug(`Skipping extension ${p.location.path} in favour of system extension ${u.location.path} with same version`),!1;if(u.targetPlatform===n)return this.logService.debug(`Skipping extension ${p.location.path} from different target platform ${p.targetPlatform}`),!1}}return h?this.logService.warn(`Overwriting user extension ${u.location.path} with ${p.location.path}.`):this.logService.debug(`Overwriting user extension ${u.location.path} with ${p.location.path}.`),!0},l=new uu;e?.forEach(u=>{let p=l.get(u.identifier.id);(!p||s(p,u,!1))&&l.set(u.identifier.id,u)});let c=dHo(this.productService,this.environmentService);return t?.forEach(u=>{let p=l.get(u.identifier.id);if(!p&&e&&u.type===0){this.logService.debug(`Skipping obsolete system extension ${u.location.path}.`);return}if(c.has(u.identifier.id.toLowerCase())&&!u.forceAutoUpdate){this.logService.info(`Skipping user installed builtin extension ${u.identifier.id} with version ${u.manifest.version} because it is not allowed to in the current product quality ${this.productService.quality}`);return}(!p||s(p,u,!1))&&l.set(u.identifier.id,u)}),o?.forEach(u=>{let p=l.get(u.identifier.id);(!p||s(p,u,!0))&&l.set(u.identifier.id,u),l.set(u.identifier.id,u)}),[...l.values()]}async scanDefaultSystemExtensions(e){this.logService.trace("Started scanning system extensions");let t=await this.createExtensionScannerInput(this.systemExtensionsLocation,!1,0,e,!0,void 0,this.getProductVersion()),n=await(t.devMode?this.extensionsScanner:this.systemExtensionsCachedScanner).scanExtensions(t);return this.logService.trace("Scanned system extensions:",n.length),n}async scanDevSystemExtensions(e,t){let o=this.environmentService.isBuilt?[]:this.productService.builtInExtensions;if(!o?.length)return[];this.logService.trace("Started scanning dev system extensions");let n=t?await this.getBuiltInExtensionControl():{},r=[],s=A.file(Vh(td(In.asFileUri("").fsPath,"..",".build","builtInExtensions")));for(let c of o){let u=n[c.name]||"marketplace";switch(u){case"disabled":break;case"marketplace":r.push(Ve(s,c.name));break;default:r.push(A.file(u));break}}let l=await Promise.all(r.map(async c=>this.extensionsScanner.scanExtension(await this.createExtensionScannerInput(c,!1,0,e,!0,void 0,this.getProductVersion()))));return this.logService.trace("Scanned dev system extensions:",l.length),ui(l)}async getBuiltInExtensionControl(){try{let e=await this.fileService.readFile(this.extensionsControlLocation);return JSON.parse(e.value.toString())}catch{return{}}}async createExtensionScannerInput(e,t,o,n,r,s,l){let c=await this.getTranslations(n??Kr),u=await this.getMtime(e),p=t&&!this.uriIdentityService.extUri.isEqual(e,this.userDataProfilesService.defaultProfile.extensionsResource)?this.userDataProfilesService.defaultProfile.extensionsResource:void 0,h=p?await this.getMtime(p):void 0;return new uye(e,u,p,h,t,s,o,r,l.version,l.date,this.productService.commit,!this.environmentService.isBuilt,n,c)}async getMtime(e){try{let t=await this.fileService.stat(e);if(typeof t.mtime=="number")return t.mtime}catch{}}getProductVersion(){return{version:this.productService.version,date:this.productService.date}}};Tgt=I([m(4,hn),m(5,$ae),m(6,ge),m(7,re),m(8,ko),m(9,Ze),m(10,gt),m(11,F)],Tgt);var uye=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f){this.location=i;this.mtime=e;this.applicationExtensionslocation=t;this.applicationExtensionslocationMtime=o;this.profile=n;this.profileScanOptions=r;this.type=s;this.validate=l;this.productVersion=c;this.productDate=u;this.productCommit=p;this.devMode=h;this.language=g;this.translations=f}static createNlsConfiguration(i){return{language:i.language,pseudo:i.language==="pseudo",devMode:i.devMode,translations:i.translations}}static equals(i,e){return ze(i.location,e.location)&&i.mtime===e.mtime&&ze(i.applicationExtensionslocation,e.applicationExtensionslocation)&&i.applicationExtensionslocationMtime===e.applicationExtensionslocationMtime&&i.profile===e.profile&&Qi(i.profileScanOptions,e.profileScanOptions)&&i.type===e.type&&i.validate===e.validate&&i.productVersion===e.productVersion&&i.productDate===e.productDate&&i.productCommit===e.productCommit&&i.devMode===e.devMode&&i.language===e.language&&cHo.equals(i.translations,e.translations)}},Z$e=class extends k{constructor(e,t,o,n,r,s){super();this.extensionsProfileScannerService=e;this.uriIdentityService=t;this.fileService=o;this.environmentService=r;this.logService=s;this.extensionsEnabledWithApiProposalVersion=n.extensionsEnabledWithApiProposalVersion?.map(l=>l.toLowerCase())??[],this.productQuality=n.quality,this.productBuiltInExtensionsEnabledWithAutoUpdates=dHo(n,r)}async scanExtensions(e){return e.profile?this.scanExtensionsFromProfile(e):this.scanExtensionsFromLocation(e)}async scanExtensionsFromLocation(e){let t=await this.fileService.resolve(e.location);if(!t.children?.length)return[];let o=await Promise.all(t.children.map(async n=>{if(!n.isDirectory||e.type===1&&Be(n.resource).indexOf(".")===0)return null;let r=new uye(n.resource,e.mtime,e.applicationExtensionslocation,e.applicationExtensionslocationMtime,e.profile,e.profileScanOptions,e.type,e.validate,e.productVersion,e.productDate,e.productCommit,e.devMode,e.language,e.translations);return this.scanExtension(r)}));return ui(o).sort((n,r)=>n.location.path<r.location.path?-1:1)}async scanExtensionsFromProfile(e){let t=await this.scanExtensionsFromProfileResource(e.location,()=>!0,e);if(e.applicationExtensionslocation&&!this.uriIdentityService.extUri.isEqual(e.location,e.applicationExtensionslocation)){t=t.filter(n=>!n.metadata?.isApplicationScoped);let o=await this.scanExtensionsFromProfileResource(e.applicationExtensionslocation,n=>!!n.metadata?.isBuiltin||!!n.metadata?.isApplicationScoped,e);t.push(...o)}return t}async scanExtensionsFromProfileResource(e,t,o){let n=await this.extensionsProfileScannerService.scanProfileExtensions(e,o.profileScanOptions);if(!n.length)return[];let r=await Promise.all(n.map(async s=>{if(t(s)){let l=new uye(s.location,o.mtime,o.applicationExtensionslocation,o.applicationExtensionslocationMtime,o.profile,o.profileScanOptions,o.type,o.validate,o.productVersion,o.productDate,o.productCommit,o.devMode,o.language,o.translations);return this.scanExtension(l,s)}return null}));return ui(r)}async scanOneOrMultipleExtensions(e){try{if(await this.fileService.exists(Ve(e.location,"package.json"))){let t=await this.scanExtension(e);return t?[t]:[]}else return await this.scanExtensions(e)}catch(t){return this.logService.error(`Error scanning extensions at ${e.location.path}:`,Dn(t)),[]}}async scanExtension(e,t){let o=[],n=!0,r;try{r=await this.scanExtensionManifest(e.location)}catch(g){if(t){o.push([wt.Error,Dn(g)]),n=!1;let[f,v]=t.identifier.id.split(".");r={name:v,publisher:f,version:t.version,engines:{vscode:""}}}else return e.type!==0&&this.logService.error(g),null}r.publisher||(r.publisher=d_t);let s;t?s={...t.metadata,size:r.__metadata?.size}:r.__metadata&&(s={installedTimestamp:r.__metadata.installedTimestamp,size:r.__metadata.size,targetPlatform:r.__metadata.targetPlatform}),delete r.__metadata;let l=gf(r.publisher,r.name),c=s?.id?{id:l,uuid:s.id}:{id:l},u=s?.isSystem?0:e.type,p=u===0||!!s?.isBuiltin;try{r=await this.translateManifest(e.location,r,uye.createNlsConfiguration(e))}catch(g){this.logService.warn("Failed to translate manifest",Dn(g))}let h={type:u,identifier:c,manifest:r,location:e.location,isBuiltin:p,targetPlatform:s?.targetPlatform??"undefined",publisherDisplayName:s?.publisherDisplayName,metadata:s,isValid:n,validations:o,preRelease:!!s?.preRelease,forceAutoUpdate:this.productBuiltInExtensionsEnabledWithAutoUpdates.has(l.toLowerCase())&&this.productQuality==="stable"};return e.validate&&(h=this.validate(h,e)),r.enabledApiProposals&&(!this.environmentService.isBuilt||this.extensionsEnabledWithApiProposalVersion.includes(l.toLowerCase()))&&(r.originalEnabledApiProposals=r.enabledApiProposals,r.enabledApiProposals=Dio([...r.enabledApiProposals])),h}validate(e,t){let o=e.isValid,n=this.environmentService.isBuilt&&this.extensionsEnabledWithApiProposalVersion.includes(e.identifier.id.toLowerCase()),r=Kvo(t.productVersion,t.productDate,t.location,e.manifest,e.isBuiltin,n);for(let[s,l]of r)s===wt.Error&&(o=!1,this.logService.error(this.formatMessage(t.location,l)));return e.isValid=o,e.validations=[...e.validations,...r],e}async scanExtensionManifest(e){let t=Ve(e,"package.json"),o;try{o=(await this.fileService.readFile(t)).value.toString()}catch(r){throw rp(r)!==1&&this.logService.error(this.formatMessage(e,d(2277,null,t.path,r.message))),r}let n;try{n=JSON.parse(o)}catch(r){let s=[];is(o,s);for(let l of s)this.logService.error(this.formatMessage(e,d(2279,null,t.path,l.offset,l.length,x0(l.error))));throw r}if(sE(n)!=="object"){let r=this.formatMessage(e,d(2280,null,t.path));throw this.logService.error(r),new Error(r)}return n}async translateManifest(e,t,o){let n=await this.getLocalizedMessages(e,t,o);if(n)try{let r=[],s=await this.resolveOriginalMessageBundle(n.default,r);if(r.length>0)return r.forEach(c=>{this.logService.error(this.formatMessage(e,d(2281,null,n.default?.path,x0(c.error))))}),t;if(sE(n)!=="object")return this.logService.error(this.formatMessage(e,d(2278,null,n.default?.path))),t;let l=n.values||Object.create(null);return uAe(this.logService,t,l,s)}catch{}return t}async getLocalizedMessages(e,t,o){let n=Ve(e,"package.nls.json"),r=(u,p)=>{p.forEach(h=>{this.logService.error(this.formatMessage(e,d(2281,null,u?.path,x0(h.error))))})},s=u=>{this.logService.error(this.formatMessage(e,d(2278,null,u?.path)))},l=`${t.publisher}.${t.name}`,c=o.translations[l];if(c)try{let u=A.file(c),p=(await this.fileService.readFile(u)).value.toString(),h=[],g=is(p,h);return h.length>0?(r(u,h),{values:void 0,default:n}):sE(g)!=="object"?(s(u),{values:void 0,default:n}):{values:g.contents?g.contents.package:void 0,default:n}}catch{return{values:void 0,default:n}}else{if(!await this.fileService.exists(n))return;let p;try{p=await this.findMessageBundles(e,o)}catch{return}if(!p.localized)return{values:void 0,default:p.original};try{let h=(await this.fileService.readFile(p.localized)).value.toString(),g=[],f=is(h,g);return g.length>0?(r(p.localized,g),{values:void 0,default:p.original}):sE(f)!=="object"?(s(p.localized),{values:void 0,default:p.original}):{values:f,default:p.original}}catch{return{values:void 0,default:p.original}}}}async resolveOriginalMessageBundle(e,t){if(e)try{let o=(await this.fileService.readFile(e)).value.toString();return is(o,t)}catch{}}findMessageBundles(e,t){return new Promise((o,n)=>{let r=s=>{let l=Ve(e,`package.nls.${s}.json`);this.fileService.exists(l).then(c=>{c&&o({localized:l,original:Ve(e,"package.nls.json")});let u=s.lastIndexOf("-");u===-1?o({localized:Ve(e,"package.nls.json"),original:null}):(s=s.substring(0,u),r(s))})};if(t.devMode||t.pseudo||!t.language)return o({localized:Ve(e,"package.nls.json"),original:null});r(t.language)})}formatMessage(e,t){return`[${e.path}]: ${t}`}};Z$e=I([m(0,$ae),m(1,gt),m(2,ge),m(3,Ze),m(4,ko),m(5,re)],Z$e);var eje=class extends Z$e{constructor(e,t,o,n,r,s,l,c){super(o,n,r,s,l,c);this.currentProfile=e;this.userDataProfilesService=t;this.cacheValidatorThrottler=this._register(new Aa(3e3));this._onDidChangeCache=this._register(new T);this.onDidChangeCache=this._onDidChangeCache.event}async scanExtensions(e){let t=this.getCacheFile(e),o=await this.readExtensionCache(t);if(this.input=e,o&&o.input&&uye.equals(o.input,this.input))return this.logService.debug("Using cached extensions scan result",e.type===0?"system":"user",e.location.toString()),this.cacheValidatorThrottler.trigger(()=>this.validateCache()),o.result.map(r=>(r.location=A.revive(r.location),r));let n=await super.scanExtensions(e);return await this.writeExtensionCache(t,{input:e,result:n}),n}async readExtensionCache(e){try{let t=await this.fileService.readFile(e),o=JSON.parse(t.value.toString());return{result:o.result,input:er(o.input)}}catch(t){rp(t)!==1&&this.logService.debug("Error while reading the extension cache file:",e.path,Dn(t))}return null}async writeExtensionCache(e,t){try{await this.fileService.writeFile(e,Ke.fromString(JSON.stringify(t)))}catch(o){this.logService.debug("Error while writing the extension cache file:",e.path,Dn(o))}}async validateCache(){if(!this.input)return;let e=this.getCacheFile(this.input),t=await this.readExtensionCache(e);if(!t)return;let o=t.result,n=JSON.parse(JSON.stringify(await super.scanExtensions(this.input)));if(!Qi(n,o))try{this.logService.info("Invalidating Cache",o,n),await this.fileService.del(e),this._onDidChangeCache.fire()}catch(r){this.logService.error(r)}}getCacheFile(e){let t=this.getProfile(e);return this.uriIdentityService.extUri.joinPath(t.cacheHome,e.type===0?Eio:kio)}getProfile(e){return e.type===0?this.userDataProfilesService.defaultProfile:e.profile?this.uriIdentityService.extUri.isEqual(e.location,this.currentProfile.extensionsResource)?this.currentProfile:this.userDataProfilesService.profiles.find(t=>this.uriIdentityService.extUri.isEqual(e.location,t.extensionsResource))??this.currentProfile:this.userDataProfilesService.defaultProfile}};eje=I([m(1,hn),m(2,$ae),m(3,gt),m(4,ge),m(5,Ze),m(6,ko),m(7,re)],eje);function ZZt(a,i){let e=zS(a.manifest.publisher,a.manifest.name);return{id:e,identifier:new hi(e),isBuiltin:a.type===0,isUserBuiltin:a.type===1&&a.isBuiltin,isUnderDevelopment:i,extensionLocation:a.location,uuid:a.identifier.uuid,targetPlatform:a.targetPlatform,publisherDisplayName:a.publisherDisplayName,preRelease:a.preRelease,...a.manifest}}var JZt=class extends Tgt{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(i,e,Ve(t,".vscode-oss-dev","extensions","control.json"),o,n,r,s,l,c,u,p,h),this.translationsPromise=(async()=>{if(dii)try{let g=await this.fileService.readFile(A.file(dii));return JSON.parse(g.value.toString())}catch{}return Object.create(null)})()}getTranslations(i){return this.translationsPromise}};var O7=class extends k{constructor(e,t){super();this.productService=e;this.allowedExtensionsService=t;this.preferPreReleases=this.productService.quality!=="stable"}async canInstall(e){let t=this.allowedExtensionsService.isAllowed({id:e.identifier.id,publisherDisplayName:e.publisherDisplayName});if(t!==!0)return new he(d(2212,null,t.value));if(!await this.isExtensionPlatformCompatible(e)){let o=Ft?"https://aka.ms/vscode-web-extensions-guide":"https://aka.ms/vscode-platform-specific-extensions";return new he(`${d(2205,null,e.displayName??e.identifier.id,this.productService.nameLong,g7e(await this.getTargetPlatform()))} [${d(2207,null)}](${o})`)}return!0}async isExtensionPlatformCompatible(e){let t=await this.getTargetPlatform();return e.allTargetPlatforms.some(o=>Yue(o,e.allTargetPlatforms,t))}};O7=I([m(0,Ze),m(1,Mm)],O7);var eei=class extends O7{constructor(e,t,o,n,r,s,l){super(r,s);this.galleryService=e;this.telemetryService=t;this.uriIdentityService=o;this.logService=n;this.userDataProfilesService=l;this.lastReportTimestamp=0;this.installingExtensions=new Map;this.uninstallingExtensions=new Map;this._onInstallExtension=this._register(new T);this._onDidInstallExtensions=this._register(new T);this._onUninstallExtension=this._register(new T);this._onDidUninstallExtension=this._register(new T);this._onDidUpdateExtensionMetadata=this._register(new T);this.participants=[];this._register(ee(()=>{this.installingExtensions.forEach(({task:c})=>c.cancel()),this.uninstallingExtensions.forEach(c=>c.cancel()),this.installingExtensions.clear(),this.uninstallingExtensions.clear()}))}get onInstallExtension(){return this._onInstallExtension.event}get onDidInstallExtensions(){return this._onDidInstallExtensions.event}get onUninstallExtension(){return this._onUninstallExtension.event}get onDidUninstallExtension(){return this._onDidUninstallExtension.event}get onDidUpdateExtensionMetadata(){return this._onDidUpdateExtensionMetadata.event}async installFromGallery(e,t={}){try{let o=await this.installGalleryExtensions([{extension:e,options:t}]),n=o.find(({identifier:s})=>Ht(s,e.identifier));if(n?.local)return n.local;if(n?.error)throw n.error;let r=o[0];if(r?.local)return r.local;throw r?.error?r.error:new qh(`Unknown error while installing extension ${e.identifier.id}`,"Unknown")}catch(o){throw tje(o)}}async installGalleryExtensions(e){if(!this.galleryService.isEnabled())throw new qh(d(2209,null),"NotAllowed");let t=[],o=[];return await Promise.allSettled(e.map(async({extension:n,options:r})=>{try{let s=await this.checkAndGetCompatibleVersion(n,!!r?.installGivenVersion,!!r?.installPreReleaseVersion,r.productVersion??{version:this.productService.version,date:this.productService.date});o.push({...s,options:r})}catch(s){t.push({identifier:n.identifier,operation:2,source:n,error:s,profileLocation:r.profileLocation??this.getCurrentExtensionsManifestLocation()})}})),o.length&&t.push(...await this.installExtensions(o)),t}async uninstall(e,t){return this.logService.trace("ExtensionManagementService#uninstall",e.identifier.id),this.uninstallExtensions([{extension:e,options:t}])}async toggleApplicationScope(e,t){if(O4(e.manifest)||e.isBuiltin)return e;if(e.isApplicationScoped){let o=await this.updateMetadata(e,{isApplicationScoped:!1},this.userDataProfilesService.defaultProfile.extensionsResource);this.uriIdentityService.extUri.isEqual(t,this.userDataProfilesService.defaultProfile.extensionsResource)||(o=await this.copyExtension(e,this.userDataProfilesService.defaultProfile.extensionsResource,t));for(let n of this.userDataProfilesService.profiles){let r=(await this.getInstalled(1,n.extensionsResource)).find(s=>Ht(s.identifier,e.identifier));r?this._onDidUpdateExtensionMetadata.fire({local:r,profileLocation:n.extensionsResource}):this._onDidUninstallExtension.fire({identifier:e.identifier,profileLocation:n.extensionsResource})}return o}else{let o=this.uriIdentityService.extUri.isEqual(t,this.userDataProfilesService.defaultProfile.extensionsResource)?await this.updateMetadata(e,{isApplicationScoped:!0},this.userDataProfilesService.defaultProfile.extensionsResource):await this.copyExtension(e,t,this.userDataProfilesService.defaultProfile.extensionsResource,{isApplicationScoped:!0});return this._onDidInstallExtensions.fire([{identifier:o.identifier,operation:2,local:o,profileLocation:this.userDataProfilesService.defaultProfile.extensionsResource,applicationScoped:!0}]),o}}getExtensionsControlManifest(){let e=new Date().getTime();return(!this.extensionsControlManifest||e-this.lastReportTimestamp>1e3*60*5)&&(this.extensionsControlManifest=this.updateControlCache(),this.lastReportTimestamp=e),this.extensionsControlManifest}registerParticipant(e){this.participants.push(e)}async resetPinnedStateForAllUserExtensions(e){try{await this.joinAllSettled(this.userDataProfilesService.profiles.map(async t=>{let o=await this.getInstalled(1,t.extensionsResource);await this.joinAllSettled(o.map(async n=>{n.pinned!==e&&await this.updateMetadata(n,{pinned:e},t.extensionsResource)}))}))}catch(t){throw this.logService.error("Error while resetting pinned state for all user extensions",Dn(t)),t}}async installExtensions(e){let t=new Map,o=new Map,n=[],r=(c,u)=>`${GRt.create(c).toString()}-${u.toString()}`,s=(c,u,p,h)=>{let g;if(!A.isUri(u)){if(o.has(`${u.identifier.id.toLowerCase()}-${p.profileLocation.toString()}`))return;let b=this.installingExtensions.get(r(u,p.profileLocation));if(b){if(h&&this.canWaitForTask(h,b.task)){let S=b.task.identifier;this.logService.info("Waiting for already requested installing extension",S.id,h.identifier.id,p.profileLocation.toString()),b.waitingTasks.push(h);let y=U.toPromise(U.filter(this.onDidInstallExtensions,w=>w.some(x=>Ht(x.identifier,S)))).then(w=>{this.logService.info("Finished waiting for already requested installing extension",S.id,h.identifier.id,p.profileLocation.toString());let x=w.find(E=>Ht(E.identifier,S));if(!x?.local)throw new Error(`Extension ${S.id} is not installed`);return x.local});n.push(y),y.catch(()=>{})}return}g=this.uninstallingExtensions.get(this.getUninstallExtensionTaskKey(u.identifier,p.profileLocation))}let f=this.createInstallExtensionTask(c,u,p),v=`${gf(c.publisher,c.name)}-${p.profileLocation.toString()}`;o.set(v,{task:f,root:h,uninstallTaskToWaitFor:g}),this._onInstallExtension.fire({identifier:f.identifier,source:u,profileLocation:p.profileLocation}),this.logService.info("Installing extension:",f.identifier.id,p),A.isUri(u)||this.installingExtensions.set(r(u,p.profileLocation),{task:f,waitingTasks:[]})};try{let c=await this.getInstalled(0);for(let{manifest:p,extension:h,options:g}of e){let f=gf(p.publisher,p.name),v=c.some(x=>Ht(x.identifier,{id:f})),b=g.isBuiltin||v,S=g.isApplicationScoped||b||O4(p),y={...g,isBuiltin:b,isApplicationScoped:S,profileLocation:S?this.userDataProfilesService.defaultProfile.extensionsResource:g.profileLocation??this.getCurrentExtensionsManifestLocation(),productVersion:g.productVersion??{version:this.productService.version,date:this.productService.date}},w=A.isUri(h)?void 0:this.installingExtensions.get(r(h,y.profileLocation));if(w){let x=w.task;this.logService.info("Extension is already requested to install",x.identifier.id,y.profileLocation.toString());let E=`${x.identifier.id.toLowerCase()}-${y.profileLocation.toString()}`,M=x.waitUntilTaskIsFinished().then(N=>(t.set(E,{local:N,identifier:x.identifier,operation:x.operation,source:x.source,context:y.context,profileLocation:y.profileLocation,applicationScoped:N.isApplicationScoped}),N),N=>{throw t.set(E,{error:tje(N),identifier:x.identifier,operation:x.operation,source:x.source,context:y.context,profileLocation:y.profileLocation}),N});n.push(M),M.catch(()=>{})}else s(p,h,y,void 0)}await Promise.all([...o.values()].map(async({task:p})=>{if(p.options.donotIncludePackAndDependencies)this.logService.info("Installing the extension without checking dependencies and pack",p.identifier.id);else try{let h=this.preferPreReleases;p.options.installPreReleaseVersion?h=!0:!A.isUri(p.source)&&p.source.hasPreReleaseVersion&&(h=!1);let g=await this.getInstalled(void 0,p.options.profileLocation,p.options.productVersion),f=await this.getAllDepsAndPackExtensions(p.identifier,p.manifest,h,p.options.productVersion,g),v={...p.options,pinned:!1,installGivenVersion:!1,context:{...p.options.context,[_Rt]:!0}};for(let{gallery:b,manifest:S}of jo(f,({gallery:y})=>y.identifier.id)){let y=g.find(w=>Ht(w.identifier,b.identifier));y&&y.isApplicationScoped===!!v.isApplicationScoped||s(S,b,v,p)}}catch(h){if(A.isUri(p.source))Rr(p.manifest.extensionDependencies)&&this.logService.warn("Cannot install dependencies of extension:",p.identifier.id,h.message),Rr(p.manifest.extensionPack)&&this.logService.warn("Cannot install packed extensions of extension:",p.identifier.id,h.message);else throw this.logService.error("Error while preparing to install dependencies and extension packs of the extension:",p.identifier.id),h}}));let u=await this.getOtherProfilesToUpdateExtension([...o.values()].map(({task:p})=>p));for(let[p,h]of u)s(h.manifest,h.source,{...h.options,profileLocation:p},void 0);await this.joinAllSettled([...o.entries()].map(async([p,{task:h,uninstallTaskToWaitFor:g}])=>{let f=new Date().getTime(),v;try{if(g){this.logService.info("Waiting for existing uninstall task to complete before installing",h.identifier.id);try{await g.waitUntilTaskIsFinished(),this.logService.info("Finished waiting for uninstall task, proceeding with install",h.identifier.id)}catch(b){this.logService.info("Uninstall task failed, proceeding with install anyway",h.identifier.id,Dn(b))}}v=await h.run(),await this.joinAllSettled(this.participants.map(b=>b.postInstall(v,h.source,h.options,Ie.None)),"PostInstall")}catch(b){let S=tje(b);throw A.isUri(h.source)||mji(this.telemetryService,h.operation===3?"extensionGallery:update":"extensionGallery:install",{extensionData:tpe(h.source),error:S,source:h.options.context?.[bH]}),t.set(p,{error:S,identifier:h.identifier,operation:h.operation,source:h.source,context:h.options.context,profileLocation:h.options.profileLocation,applicationScoped:h.options.isApplicationScoped}),this.logService.error("Error while installing the extension",h.identifier.id,Dn(S),h.options.profileLocation.toString()),S}if(!A.isUri(h.source)){let b=h.operation===3,S=b?void 0:(new Date().getTime()-h.source.lastUpdated)/1e3;mji(this.telemetryService,b?"extensionGallery:update":"extensionGallery:install",{extensionData:tpe(h.source),verificationStatus:h.verificationStatus,duration:new Date().getTime()-f,durationSinceUpdate:S,source:h.options.context?.[bH]})}t.set(p,{local:v,identifier:h.identifier,operation:h.operation,source:h.source,context:h.options.context,profileLocation:h.options.profileLocation,applicationScoped:v.isApplicationScoped})})),n.length&&await this.joinAllSettled(n)}catch(c){let u=(g,f,v)=>{let b=[];g.manifest.extensionDependencies?.length&&b.push(...g.manifest.extensionDependencies),g.manifest.extensionPack?.length&&b.push(...g.manifest.extensionPack);for(let S of b){if(v.includes(S.toLowerCase()))continue;v.push(S.toLowerCase());let y=t.get(`${S.toLowerCase()}-${f.toString()}`);y?.local&&(v=u(y.local,f,v))}return v},p=g=>({identifier:g.identifier,operation:2,source:g.source,context:g.options.context,profileLocation:g.options.profileLocation,error:c}),h=[];for(let[g,{task:f,root:v}]of o){let b=t.get(g);b?b.local&&v&&!t.get(`${v.identifier.id.toLowerCase()}-${f.options.profileLocation.toString()}`)?.local&&(h.push(this.createUninstallExtensionTask(b.local,{versionOnly:!0,profileLocation:f.options.profileLocation})),t.set(g,p(f))):(f.cancel(),t.set(g,p(f)))}for(let[g,{task:f}]of o){let v=t.get(g);if(!v?.local||f.options.donotIncludePackAndDependencies)continue;u(v.local,f.options.profileLocation,[v.local.identifier.id.toLowerCase()]).slice(1).some(S=>o.has(`${S.toLowerCase()}-${f.options.profileLocation.toString()}`)&&!t.get(`${S.toLowerCase()}-${f.options.profileLocation.toString()}`)?.local)&&(h.push(this.createUninstallExtensionTask(v.local,{versionOnly:!0,profileLocation:f.options.profileLocation})),t.set(g,p(f)))}h.length&&await Promise.allSettled(h.map(async g=>{try{await g.run(),this.logService.info("Rollback: Uninstalled extension",g.extension.identifier.id)}catch(f){this.logService.warn("Rollback: Error while uninstalling extension",g.extension.identifier.id,Dn(f))}}))}finally{for(let{task:c}of o.values())c.source&&!A.isUri(c.source)&&this.installingExtensions.delete(r(c.source,c.options.profileLocation))}let l=[...t.values()];for(let c of l)c.local&&this.logService.info("Extension installed successfully:",c.identifier.id,c.profileLocation.toString());return this._onDidInstallExtensions.fire(l),l}async getOtherProfilesToUpdateExtension(e){let t=[],o=new dt;for(let n of e)if(!(n.operation!==3||n.options.isApplicationScoped||n.options.pinned||n.options.installGivenVersion||A.isUri(n.source)))for(let r of this.userDataProfilesService.profiles){if(this.uriIdentityService.extUri.isEqual(r.extensionsResource,n.options.profileLocation))continue;let s=o.get(r.extensionsResource);s||(s=await this.getInstalled(1,r.extensionsResource),o.set(r.extensionsResource,s));let l=s.find(c=>Ht(c.identifier,n.identifier));l&&!l.pinned&&t.push([r.extensionsResource,n])}return t}canWaitForTask(e,t){for(let[,{task:o,waitingTasks:n}]of this.installingExtensions.entries())if(o===e&&(n.includes(t)||n.some(r=>this.canWaitForTask(r,t)))||o===t&&n[0]&&!this.canWaitForTask(e,n[0]))return!1;return!0}async joinAllSettled(e,t){let o=[],n=[],r=await Promise.allSettled(e);for(let l of r)l.status==="fulfilled"?o.push(l.value):n.push(tje(l.reason,t));if(!n.length)return o;if(n.length===1)throw n[0];let s=new qh("","Unknown");for(let l of n)s=new qh(s.message?`${s.message}, ${l.message}`:l.message,l.code!=="Unknown"&&l.code!=="Internal"?l.code:s.code);throw s}async getAllDepsAndPackExtensions(e,t,o,n,r){if(!this.galleryService.isEnabled())return[];let s=[],l=[],c=async(u,p)=>{s.push(u);let h=p.extensionDependencies?p.extensionDependencies.filter(f=>!r.some(v=>Ht(v.identifier,{id:f}))):[],g=[...h];if(p.extensionPack){let f=r.find(v=>Ht(v.identifier,u));for(let v of p.extensionPack)f&&f.manifest.extensionPack&&f.manifest.extensionPack.some(b=>Ht({id:b},{id:v}))||g.every(b=>!Ht({id:b},{id:v}))&&g.push(v)}if(g.length){let f=g.filter(v=>s.every(b=>!Ht(b,{id:v})));if(f.length){let v=await this.galleryService.getExtensions(f.map(b=>({id:b,preRelease:o})),Ie.None);for(let b of v){if(s.find(w=>Ht(w,b.identifier)))continue;let S=h.some(w=>Ht({id:w},b.identifier)),y;try{y=await this.checkAndGetCompatibleVersion(b,!1,o,n)}catch(w){if(S)throw w;this.logService.info("Skipping the packed extension as it cannot be installed",b.identifier.id,Dn(w));continue}l.push({gallery:y.extension,manifest:y.manifest}),await c(y.extension.identifier,y.manifest)}}}};return await c(e,t),l}async checkAndGetCompatibleVersion(e,t,o,n){let r,s=await this.getExtensionsControlManifest();if(jRt(e.identifier,s.malicious))throw new qh(d(2208,null,e.identifier.id),"Malicious");let l=s.deprecated[e.identifier.id.toLowerCase()];if(l?.extension?.autoMigrate){if(this.logService.info(`The '${e.identifier.id}' extension is deprecated, fetching the compatible '${l.extension.id}' extension instead.`),r=(await this.galleryService.getExtensions([{id:l.extension.id,preRelease:l.extension.preRelease}],{targetPlatform:await this.getTargetPlatform(),compatible:!0,productVersion:n},Ie.None))[0],!r)throw new qh(d(2214,null,e.identifier.id,l.extension.id),"Deprecated")}else{if(await this.canInstall(e)!==!0){let u=await this.getTargetPlatform();throw new qh(d(2205,null,e.identifier.id,this.productService.nameLong,g7e(u)),"IncompatibleTargetPlatform")}if(r=await this.getCompatibleVersion(e,t,o,n),!r){let u=[];throw iQ(e.properties.enabledApiProposals??[],u)?!o&&e.hasPreReleaseVersion&&e.properties.isPreReleaseVersion&&(await this.galleryService.getExtensions([e.identifier],Ie.None))[0]?new qh(d(2215,null,e.displayName??e.identifier.id),"ReleaseVersionNotFound"):new qh(d(2213,null,e.identifier.id,this.productService.nameLong,this.productService.version),"Incompatible"):new qh(d(2206,null,e.displayName??e.identifier.id,u[0]),"IncompatibleApi")}}this.logService.info("Getting Manifest...",r.identifier.id);let c=await this.galleryService.getManifest(r,Ie.None);if(c===null)throw new qh(`Missing manifest for extension ${r.identifier.id}`,"Invalid");if(c.version!==r.version)throw new qh(`Cannot install '${r.identifier.id}' extension because of version mismatch in Marketplace`,"Invalid");return{extension:r,manifest:c}}async getCompatibleVersion(e,t,o,n){let r=await this.getTargetPlatform(),s=null;return!t&&e.hasPreReleaseVersion&&e.properties.isPreReleaseVersion!==o&&(s=(await this.galleryService.getExtensions([{...e.identifier,preRelease:o}],{targetPlatform:r,compatible:!0,productVersion:n},Ie.None))[0]||null),!s&&await this.galleryService.isExtensionCompatible(e,o,r,n)&&(s=e),s||(t?s=(await this.galleryService.getExtensions([{...e.identifier,version:e.version}],{targetPlatform:r,compatible:!0,productVersion:n},Ie.None))[0]||null:s=await this.galleryService.getCompatibleExtension(e,o,r,n)),s}getUninstallExtensionTaskKey(e,t,o){return`${e.id.toLowerCase()}${o?`-${o}`:""}@${t.toString()}`}async uninstallExtensions(e){let t=(h,g)=>this.getUninstallExtensionTaskKey(h.identifier,g.profileLocation,g.versionOnly?h.manifest.version:void 0),o=(h,g)=>{let f;for(let{task:b}of this.installingExtensions.values())if(!(b.source instanceof A)&&Ht(b.identifier,h.identifier)&&this.uriIdentityService.extUri.isEqual(b.options.profileLocation,g.profileLocation)){f=b;break}let v=this.createUninstallExtensionTask(h,g);this.uninstallingExtensions.set(t(v.extension,g),v),this.logService.info("Uninstalling extension from the profile:",`${h.identifier.id}@${h.manifest.version}`,g.profileLocation.toString()),this._onUninstallExtension.fire({identifier:h.identifier,profileLocation:g.profileLocation,applicationScoped:h.isApplicationScoped}),r.push({task:v,installTaskToWaitFor:f})},n=(h,g,f)=>{f?this.logService.error("Failed to uninstall extension from the profile:",`${h.identifier.id}@${h.manifest.version}`,g.profileLocation.toString(),f.message):this.logService.info("Successfully uninstalled extension from the profile",`${h.identifier.id}@${h.manifest.version}`,g.profileLocation.toString()),mji(this.telemetryService,"extensionGallery:uninstall",{extensionData:qRt(h),error:f}),this._onDidUninstallExtension.fire({identifier:h.identifier,error:f?.code,profileLocation:g.profileLocation,applicationScoped:h.isApplicationScoped})},r=[],s=[],l=[],c=[],u=new dt,p=async h=>{let g=u.get(h);return g||u.set(h,g=await this.getInstalled(1,h)),g};for(let{extension:h,options:g}of e){let f={...g,profileLocation:h.isApplicationScoped?this.userDataProfilesService.defaultProfile.extensionsResource:g?.profileLocation??this.getCurrentExtensionsManifestLocation()},v=this.uninstallingExtensions.get(t(h,f));if(v?(this.logService.info("Extensions is already requested to uninstall",h.identifier.id),l.push(v.waitUntilTaskIsFinished())):o(h,f),f.remove||h.isApplicationScoped){f.remove&&c.push(h);for(let b of this.userDataProfilesService.profiles){if(this.uriIdentityService.extUri.isEqual(b.extensionsResource,f.profileLocation))continue;let y=(await p(b.extensionsResource)).find(w=>Ht(w.identifier,h.identifier));if(y){let w={...f,profileLocation:b.extensionsResource},x=this.uninstallingExtensions.get(t(y,w));x?(this.logService.info("Extensions is already requested to uninstall",y.identifier.id),l.push(x.waitUntilTaskIsFinished())):o(y,w)}}}}try{for(let{task:h}of r.slice(0)){let g=await p(h.options.profileLocation);if(h.options.donotIncludePack)this.logService.info("Uninstalling the extension without including packed extension",`${h.extension.identifier.id}@${h.extension.manifest.version}`);else{let f=this.getAllPackExtensionsToUninstall(h.extension,g);for(let v of f)this.uninstallingExtensions.has(t(v,h.options))?this.logService.info("Extensions is already requested to uninstall",v.identifier.id):o(v,h.options)}h.options.donotCheckDependents?this.logService.info("Uninstalling the extension without checking dependents",`${h.extension.identifier.id}@${h.extension.manifest.version}`):this.checkForDependents(r.map(({task:f})=>f.extension),g,h.extension)}await this.joinAllSettled(r.map(async({task:h,installTaskToWaitFor:g})=>{try{if(g){this.logService.info("Waiting for existing install task to complete before uninstalling",h.extension.identifier.id);try{await g.waitUntilTaskIsFinished(),this.logService.info("Finished waiting for install task, proceeding with uninstall",h.extension.identifier.id)}catch(f){this.logService.info("Install task failed, proceeding with uninstall anyway",h.extension.identifier.id,Dn(f))}}if(await h.run(),await this.joinAllSettled(this.participants.map(f=>f.postUninstall(h.extension,h.options,Ie.None))),h.extension.identifier.uuid&&!Ft)try{await this.galleryService.reportStatistic(h.extension.manifest.publisher,h.extension.manifest.name,h.extension.manifest.version,"uninstall")}catch{}}catch(f){let v=tje(f);throw n(h.extension,h.options,v),v}finally{s.push(h)}})),l.length&&await this.joinAllSettled(l);for(let{task:h}of r)n(h.extension,h.options);c.length&&await this.joinAllSettled(c.map(h=>this.deleteExtension(h)))}catch(h){let g=tje(h);for(let{task:f}of r){try{f.cancel()}catch{}s.includes(f)||n(f.extension,f.options,g)}throw g}finally{for(let{task:h}of r)this.uninstallingExtensions.delete(t(h.extension,h.options))||this.logService.warn("Uninstallation task is not found in the cache",h.extension.identifier.id)}}checkForDependents(e,t,o){for(let n of e){let r=this.getDependents(n,t);if(r.length){let s=r.filter(l=>!e.some(c=>Ht(c.identifier,l.identifier)));if(s.length)throw new Error(this.getDependentsErrorMessage(n,s,o))}}}getDependentsErrorMessage(e,t,o){return o===e?t.length===1?d(2216,null,o.manifest.displayName||o.manifest.name,t[0].manifest.displayName||t[0].manifest.name):t.length===2?d(2218,null,o.manifest.displayName||o.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):d(2210,null,o.manifest.displayName||o.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):t.length===1?d(2217,null,o.manifest.displayName||o.manifest.name,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name):t.length===2?d(2219,null,o.manifest.displayName||o.manifest.name,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):d(2211,null,o.manifest.displayName||o.manifest.name,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name)}getAllPackExtensionsToUninstall(e,t,o=[]){if(o.indexOf(e)!==-1)return[];if(Ht(e.identifier,{id:this.productService.defaultChatAgent.extensionId}))return[];o.push(e);let n=e.manifest.extensionPack?e.manifest.extensionPack:[];if(n.length){let r=t.filter(l=>!l.isBuiltin&&n.some(c=>Ht({id:c},l.identifier))),s=[];for(let l of r)s.push(...this.getAllPackExtensionsToUninstall(l,t,o));return[...r,...s]}return[]}getDependents(e,t){return t.filter(o=>o.manifest.extensionDependencies&&o.manifest.extensionDependencies.some(n=>Ht({id:n},e.identifier)))}async updateControlCache(){try{return this.logService.trace("ExtensionManagementService.updateControlCache"),await this.galleryService.getExtensionsControlManifest()}catch(e){return this.logService.trace("ExtensionManagementService.refreshControlCache - failed to get extension control manifest",Dn(e)),{malicious:[],deprecated:{},search:[]}}}};eei=I([m(0,ga),m(1,_e),m(2,gt),m(3,re),m(4,Ze),m(5,Mm),m(6,hn)],eei);function tje(a,i){if(a instanceof qh)return a;let e;return a instanceof QT?e=new qh(a.message,a.code==="DownloadFailedWriting"?"DownloadFailedWriting":"Gallery"):e=new qh(a.message,Yi(a)?"Cancelled":i??"Internal"),e.stack=a.stack,e}function mji(a,i,{extensionData:e,verificationStatus:t,duration:o,error:n,source:r,durationSinceUpdate:s}){a.publicLog(i,{...e,source:r,duration:o,durationSinceUpdate:s,success:!n,errorcode:n?.code,verificationStatus:t==="Success"?"Verified":t??"Unverified"})}var tei="extensions.trustedPublishers";function JMn(a){return a.type==="gallery"}var ije=class extends O7{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(s,S);this.extensionManagementServerService=e;this.extensionGalleryService=t;this.userDataProfileService=o;this.userDataProfilesService=n;this.configurationService=r;this.downloadService=l;this.userDataSyncEnablementService=c;this.dialogService=u;this.workspaceTrustRequestService=p;this.extensionManifestPropertiesService=h;this.fileService=g;this.logService=f;this.instantiationService=v;this.extensionsScannerService=b;this.storageService=y;this.telemetryService=w;this._onInstallExtension=this._register(new T);this._onDidInstallExtensions=this._register(new T);this._onUninstallExtension=this._register(new T);this._onDidUninstallExtension=this._register(new T);this._onDidProfileAwareInstallExtensions=this._register(new T);this._onDidProfileAwareUninstallExtension=this._register(new T);this.servers=[];this.defaultTrustedPublishers=s.trustedExtensionPublishers??[],this.workspaceExtensionManagementService=this._register(this.instantiationService.createInstance(F7)),this.onDidEnableExtensions=this.workspaceExtensionManagementService.onDidChangeInvalidExtensions,this.extensionManagementServerService.localExtensionManagementServer&&this.servers.push(this.extensionManagementServerService.localExtensionManagementServer),this.extensionManagementServerService.remoteExtensionManagementServer&&this.servers.push(this.extensionManagementServerService.remoteExtensionManagementServer),this.extensionManagementServerService.webExtensionManagementServer&&this.servers.push(this.extensionManagementServerService.webExtensionManagementServer);let x=this._register(new Cy);this._register(x.add(this._onInstallExtension.event)),this.onInstallExtension=x.event;let E=this._register(new Cy);this._register(E.add(this._onDidInstallExtensions.event)),this.onDidInstallExtensions=E.event;let M=this._register(new Cy);this._register(M.add(this._onDidProfileAwareInstallExtensions.event)),this.onProfileAwareDidInstallExtensions=M.event;let N=this._register(new Cy);this._register(N.add(this._onUninstallExtension.event)),this.onUninstallExtension=N.event;let V=this._register(new Cy);this._register(V.add(this._onDidUninstallExtension.event)),this.onDidUninstallExtension=V.event;let H=this._register(new Cy);this._register(H.add(this._onDidProfileAwareUninstallExtension.event)),this.onProfileAwareDidUninstallExtension=H.event;let K=this._register(new Cy);this.onDidUpdateExtensionMetadata=K.event;let j=this._register(new Cy);this.onProfileAwareDidUpdateExtensionMetadata=j.event;let J=this._register(new Cy);this.onDidChangeProfile=J.event;for(let se of this.servers)this._register(x.add(U.map(se.extensionManagementService.onInstallExtension,ae=>({...ae,server:se})))),this._register(E.add(se.extensionManagementService.onDidInstallExtensions)),this._register(M.add(se.extensionManagementService.onProfileAwareDidInstallExtensions)),this._register(N.add(U.map(se.extensionManagementService.onUninstallExtension,ae=>({...ae,server:se})))),this._register(V.add(U.map(se.extensionManagementService.onDidUninstallExtension,ae=>({...ae,server:se})))),this._register(H.add(U.map(se.extensionManagementService.onProfileAwareDidUninstallExtension,ae=>({...ae,server:se})))),this._register(K.add(se.extensionManagementService.onDidUpdateExtensionMetadata)),this._register(j.add(se.extensionManagementService.onProfileAwareDidUpdateExtensionMetadata)),this._register(J.add(U.map(se.extensionManagementService.onDidChangeProfile,ae=>({...ae,server:se}))));this._register(this.onProfileAwareDidInstallExtensions(se=>{let ae=new Map;for(let ce of se)ce.local&&ce.source&&!A.isUri(ce.source)&&!this.isPublisherTrusted(ce.source)&&ae.set(ce.source.publisher,{publisher:ce.source.publisher,publisherDisplayName:ce.source.publisherDisplayName});ae.size&&this.trustPublishers(...ae.values())}))}async getInstalled(e,t,o){let n=[];return await Promise.all(this.servers.map(async r=>{let s=await r.extensionManagementService.getInstalled(e,t,o);if(r===this.getWorkspaceExtensionsServer()){let l=await this.getInstalledWorkspaceExtensions(!0);s.push(...l)}n.push(...s)})),n}uninstall(e,t){return this.uninstallExtensions([{extension:e,options:t}])}async uninstallExtensions(e){let t=[],o=new Map,n=(c,u,p)=>{let h=o.get(c);h||o.set(c,h=[]),h.push({extension:u,options:p})};for(let{extension:c,options:u}of e){if(c.isWorkspaceScoped){t.push(c);continue}let p=this.getServer(c);if(!p)throw new Error(`Invalid location ${c.location.toString()}`);if(n(p,c,u),this.servers.length>1&&gM(c.manifest)){let h=this.servers.filter(g=>g!==p);for(let g of h){let v=(await g.extensionManagementService.getInstalled()).find(b=>!b.isBuiltin&&Ht(b.identifier,c.identifier));v&&n(g,v,u)}}}let r=[];for(let c of t)r.push(this.uninstallExtensionFromWorkspace(c));for(let[c,u]of o.entries())r.push(this.uninstallInServer(c,u));let l=(await Promise.allSettled(r)).filter(c=>c.status==="rejected").map(c=>c.reason);if(l.length)throw new Error(l.map(c=>c.message).join(`
`))}async uninstallInServer(e,t){if(e===this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer)for(let{extension:o}of t){let r=(await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getInstalled(1)).filter(s=>!this.extensionManifestPropertiesService.prefersExecuteOnUI(s.manifest)&&s.manifest.extensionDependencies&&s.manifest.extensionDependencies.some(l=>Ht({id:l},o.identifier)));if(r.length)throw new Error(this.getDependentsErrorMessage(o,r))}return e.extensionManagementService.uninstallExtensions(t)}getDependentsErrorMessage(e,t){return t.length===1?d(18917,null,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name):t.length===2?d(18921,null,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name):d(18913,null,e.manifest.displayName||e.manifest.name,t[0].manifest.displayName||t[0].manifest.name,t[1].manifest.displayName||t[1].manifest.name)}updateMetadata(e,t){let o=this.getServer(e);if(o){let n=e.isApplicationScoped?this.userDataProfilesService.defaultProfile:this.userDataProfileService.currentProfile;return o.extensionManagementService.updateMetadata(e,t,n.extensionsResource)}return Promise.reject(`Invalid location ${e.location.toString()}`)}async resetPinnedStateForAllUserExtensions(e){await Promise.allSettled(this.servers.map(t=>t.extensionManagementService.resetPinnedStateForAllUserExtensions(e)))}zip(e){let t=this.getServer(e);return t?t.extensionManagementService.zip(e):Promise.reject(`Invalid location ${e.location.toString()}`)}download(e,t,o){if(this.extensionManagementServerService.localExtensionManagementServer)return this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.download(e,t,o);throw new Error("Cannot download extension")}async install(e,t){let o=await this.getManifest(e);return this.installVSIX(e,o,t)}async installVSIX(e,t,o){let n=this.getServersToInstall(t);if(n?.length){await this.checkForWorkspaceTrust(t,!1);let[r]=await vn.settled(n.map(s=>this.installVSIXInServer(e,s,o)));return r}return Promise.reject("No Servers to Install")}getServersToInstall(e){if(this.extensionManagementServerService.localExtensionManagementServer&&this.extensionManagementServerService.remoteExtensionManagementServer)return gM(e)?[this.extensionManagementServerService.localExtensionManagementServer,this.extensionManagementServerService.remoteExtensionManagementServer]:this.extensionManifestPropertiesService.prefersExecuteOnUI(e)?[this.extensionManagementServerService.localExtensionManagementServer]:[this.extensionManagementServerService.remoteExtensionManagementServer];if(this.extensionManagementServerService.localExtensionManagementServer)return[this.extensionManagementServerService.localExtensionManagementServer];if(this.extensionManagementServerService.remoteExtensionManagementServer)return[this.extensionManagementServerService.remoteExtensionManagementServer]}async installFromLocation(e){if(e.scheme===Q.file){if(this.extensionManagementServerService.localExtensionManagementServer)return this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.installFromLocation(e,this.userDataProfileService.currentProfile.extensionsResource);throw new Error("Local extension management server is not found")}if(e.scheme===Q.vscodeRemote){if(this.extensionManagementServerService.remoteExtensionManagementServer)return this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromLocation(e,this.userDataProfileService.currentProfile.extensionsResource);throw new Error("Remote extension management server is not found")}if(!this.extensionManagementServerService.webExtensionManagementServer)throw new Error("Web extension management server is not found");return this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.installFromLocation(e,this.userDataProfileService.currentProfile.extensionsResource)}installVSIXInServer(e,t,o){return t.extensionManagementService.install(e,o)}getManifest(e){return e.scheme===Q.file&&this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getManifest(e):e.scheme===Q.file&&this.extensionManagementServerService.remoteExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getManifest(e):e.scheme===Q.vscodeRemote&&this.extensionManagementServerService.remoteExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getManifest(e):Promise.reject("No Servers")}async canInstall(e){return JMn(e)?this.canInstallGalleryExtension(e):this.canInstallResourceExtension(e)}async canInstallGalleryExtension(e){if(this.extensionManagementServerService.localExtensionManagementServer&&await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.canInstall(e)===!0)return!0;let t=await this.extensionGalleryService.getManifest(e,Ie.None);return t?this.extensionManagementServerService.remoteExtensionManagementServer&&await this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.canInstall(e)===!0&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(t)||this.extensionManagementServerService.webExtensionManagementServer&&await this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.canInstall(e)===!0&&this.extensionManifestPropertiesService.canExecuteOnWeb(t)?!0:new he().appendText(d(18885,null,e.displayName||e.name)):new he().appendText(d(18906,null))}async canInstallResourceExtension(e){return this.extensionManagementServerService.localExtensionManagementServer||this.extensionManagementServerService.remoteExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(e.manifest)||this.extensionManagementServerService.webExtensionManagementServer&&this.extensionManifestPropertiesService.canExecuteOnWeb(e.manifest)?!0:new he().appendText(d(18885,null,e.manifest.displayName??e.identifier.id))}async updateFromGallery(e,t,o){let n=this.getServer(t);if(!n)return Promise.reject(`Invalid location ${t.location.toString()}`);let r=[];return gM(t.manifest)?r.push(...this.servers.filter(s=>s!==this.extensionManagementServerService.webExtensionManagementServer)):r.push(n),o={...o||{},isApplicationScoped:t.isApplicationScoped},vn.settled(r.map(s=>s.extensionManagementService.installFromGallery(e,o))).then(([s])=>s)}async installGalleryExtensions(e){let t=new Map,o=new Map,n=await Promise.all(e.map(async({extension:r})=>{let s=await this.extensionGalleryService.getManifest(r,Ie.None);if(!s)throw new Error(d(18907,null,r.displayName||r.name));return s}));return e.some(r=>r.options?.context?.[CM]!==!0)&&await this.checkForTrustedPublishers(e.map((r,s)=>({extension:r.extension,manifest:n[s],checkForPackAndDependencies:!r.options?.donotIncludePackAndDependencies}))),await Promise.all(e.map(async({extension:r,options:s})=>{try{let l=await this.extensionGalleryService.getManifest(r,Ie.None);if(!l)throw new Error(d(18907,null,r.displayName||r.name));s?.context?.[bH]!=="settingsSync"&&(await this.checkForWorkspaceTrust(l,!1),s?.donotIncludePackAndDependencies||await this.checkInstallingExtensionOnWeb(r,l));let c=await this.getExtensionManagementServersToInstall(r,l);!s.isMachineScoped&&this.isExtensionsSyncEnabled()&&this.extensionManagementServerService.localExtensionManagementServer&&!c.includes(this.extensionManagementServerService.localExtensionManagementServer)&&await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.canInstall(r)===!0&&c.push(this.extensionManagementServerService.localExtensionManagementServer);for(let u of c){let p=o.get(u);p||o.set(u,p=[]),p.push({extension:r,options:s})}}catch(l){t.set(r.identifier.id.toLowerCase(),{identifier:r.identifier,source:r,error:l,operation:2,profileLocation:s.profileLocation??this.userDataProfileService.currentProfile.extensionsResource})}})),await Promise.all([...o.entries()].map(async([r,s])=>{let l=await r.extensionManagementService.installGalleryExtensions(s);for(let c of l)t.set(c.identifier.id.toLowerCase(),c)})),[...t.values()]}async installFromGallery(e,t,o){let n=await this.extensionGalleryService.getManifest(e,Ie.None);if(!n)throw new Error(d(18907,null,e.displayName||e.name));if(t?.context?.[CM]!==!0&&await this.checkForTrustedPublishers([{extension:e,manifest:n,checkForPackAndDependencies:!t?.donotIncludePackAndDependencies}]),t?.context?.[bH]!=="settingsSync"&&(await this.checkForWorkspaceTrust(n,!1),t?.donotIncludePackAndDependencies||await this.checkInstallingExtensionOnWeb(e,n)),o=o?.length?this.validServers(e,n,o):await this.getExtensionManagementServersToInstall(e,n),!t||bn(t.isMachineScoped)){let r=await this.hasToFlagExtensionsMachineScoped([e]);t={...t||{},isMachineScoped:r}}return!t.isMachineScoped&&this.isExtensionsSyncEnabled()&&this.extensionManagementServerService.localExtensionManagementServer&&!o.includes(this.extensionManagementServerService.localExtensionManagementServer)&&await this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.canInstall(e)===!0&&o.push(this.extensionManagementServerService.localExtensionManagementServer),vn.settled(o.map(r=>r.extensionManagementService.installFromGallery(e,t))).then(([r])=>r)}async getExtensions(e){let t=await this.extensionsScannerService.scanMultipleExtensions(e,1,{includeInvalid:!0}),o=[];return await Promise.all(t.map(async n=>{let r=await this.workspaceExtensionManagementService.toLocalWorkspaceExtension(n);r&&o.push({type:"resource",identifier:r.identifier,location:r.location,manifest:r.manifest,changelogUri:r.changelogUrl,readmeUri:r.readmeUrl})})),o}getInstalledWorkspaceExtensionLocations(){return this.workspaceExtensionManagementService.getInstalledWorkspaceExtensionsLocations()}async getInstalledWorkspaceExtensions(e){return this.workspaceExtensionManagementService.getInstalled(e)}async installResourceExtension(e,t){if(!this.canInstallResourceExtension(e))throw new Error("This extension cannot be installed in the current workspace.");if(!t.isWorkspaceScoped)return this.installFromLocation(e.location);this.logService.info(`Installing the extension ${e.identifier.id} from ${e.location.toString()} in workspace`);let o=this.getWorkspaceExtensionsServer();this._onInstallExtension.fire({identifier:e.identifier,source:e.location,server:o,applicationScoped:!1,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,workspaceScoped:!0});try{await this.checkForWorkspaceTrust(e.manifest,!0);let n=await this.workspaceExtensionManagementService.install(e);return this.logService.info(`Successfully installed the extension ${n.identifier.id} from ${e.location.toString()} in the workspace`),this._onDidInstallExtensions.fire([{identifier:n.identifier,source:e.location,operation:2,applicationScoped:!1,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,local:n,workspaceScoped:!0}]),n}catch(n){throw this.logService.error(`Failed to install the extension ${e.identifier.id} from ${e.location.toString()} in the workspace`,Dn(n)),this._onDidInstallExtensions.fire([{identifier:e.identifier,source:e.location,operation:2,applicationScoped:!1,profileLocation:this.userDataProfileService.currentProfile.extensionsResource,error:n,workspaceScoped:!0}]),n}}async getInstallableServers(e){let t=await this.extensionGalleryService.getManifest(e,Ie.None);return t?this.getInstallableExtensionManagementServers(t):Promise.reject(d(18907,null,e.displayName||e.name))}async uninstallExtensionFromWorkspace(e){if(!e.isWorkspaceScoped)throw new Error("The extension is not a workspace extension");this.logService.info(`Uninstalling the workspace extension ${e.identifier.id} from ${e.location.toString()}`);let t=this.getWorkspaceExtensionsServer();this._onUninstallExtension.fire({identifier:e.identifier,server:t,applicationScoped:!1,workspaceScoped:!0,profileLocation:this.userDataProfileService.currentProfile.extensionsResource});try{await this.workspaceExtensionManagementService.uninstall(e),this.logService.info(`Successfully uninstalled the workspace extension ${e.identifier.id} from ${e.location.toString()}`),this.telemetryService.publicLog2("workspaceextension:uninstall"),this._onDidUninstallExtension.fire({identifier:e.identifier,server:t,applicationScoped:!1,workspaceScoped:!0,profileLocation:this.userDataProfileService.currentProfile.extensionsResource})}catch(o){throw this.logService.error(`Failed to uninstall the workspace extension ${e.identifier.id} from ${e.location.toString()}`,Dn(o)),this._onDidUninstallExtension.fire({identifier:e.identifier,server:t,error:o,applicationScoped:!1,workspaceScoped:!0,profileLocation:this.userDataProfileService.currentProfile.extensionsResource}),o}}validServers(e,t,o){let n=this.getInstallableExtensionManagementServers(t);for(let r of o)if(!n.includes(r)){let s=new Error(d(18886,null,e.displayName||e.name,r.label));throw s.name="Unsupported",s}return o}async getExtensionManagementServersToInstall(e,t){let o=[];if(gM(t))o.push(...this.servers.filter(n=>n!==this.extensionManagementServerService.webExtensionManagementServer));else{let[n]=this.getInstallableExtensionManagementServers(t);n&&o.push(n)}if(!o.length){let n=new Error(d(18885,null,e.displayName||e.name));throw n.name="Unsupported",n}return o}getInstallableExtensionManagementServers(e){if(this.servers.length===1&&this.extensionManagementServerService.localExtensionManagementServer)return[this.extensionManagementServerService.localExtensionManagementServer];let t=[],o=this.extensionManifestPropertiesService.getExtensionKind(e);for(let n of o)n==="ui"&&this.extensionManagementServerService.localExtensionManagementServer&&t.push(this.extensionManagementServerService.localExtensionManagementServer),n==="workspace"&&this.extensionManagementServerService.remoteExtensionManagementServer&&t.push(this.extensionManagementServerService.remoteExtensionManagementServer),n==="web"&&this.extensionManagementServerService.webExtensionManagementServer&&t.push(this.extensionManagementServerService.webExtensionManagementServer);return this.extensionManagementServerService.localExtensionManagementServer&&!t.includes(this.extensionManagementServerService.localExtensionManagementServer)&&t.push(this.extensionManagementServerService.localExtensionManagementServer),t}isExtensionsSyncEnabled(){return this.userDataSyncEnablementService.isEnabled()&&this.userDataSyncEnablementService.isResourceEnabled("extensions")}async hasToFlagExtensionsMachineScoped(e){if(this.isExtensionsSyncEnabled()){let{result:t}=await this.dialogService.prompt({type:wt.Info,message:e.length===1?d(18899,null):d(18900,null),detail:e.length===1?d(18902,null,e[0].displayName):d(18901,null),buttons:[{label:d(18896,null),run:()=>!1},{label:d(18897,null),run:()=>!0}],cancelButton:{run:()=>{throw new qi}}});return t}return!1}getExtensionsControlManifest(){return this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.getExtensionsControlManifest():this.extensionManagementServerService.remoteExtensionManagementServer?this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.getExtensionsControlManifest():this.extensionManagementServerService.webExtensionManagementServer?this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.getExtensionsControlManifest():this.extensionGalleryService.getExtensionsControlManifest()}getServer(e){return e.isWorkspaceScoped?this.getWorkspaceExtensionsServer():this.extensionManagementServerService.getExtensionManagementServer(e)}getWorkspaceExtensionsServer(){if(this.extensionManagementServerService.remoteExtensionManagementServer)return this.extensionManagementServerService.remoteExtensionManagementServer;if(this.extensionManagementServerService.localExtensionManagementServer)return this.extensionManagementServerService.localExtensionManagementServer;if(this.extensionManagementServerService.webExtensionManagementServer)return this.extensionManagementServerService.webExtensionManagementServer;throw new Error("No extension server found")}async requestPublisherTrust(e){let t=await Promise.all(e.map(async({extension:o})=>{let n=await this.extensionGalleryService.getManifest(o,Ie.None);if(!n)throw new Error(d(18907,null,o.displayName||o.name));return n}));await this.checkForTrustedPublishers(e.map((o,n)=>({extension:o.extension,manifest:t[n],checkForPackAndDependencies:!o.options?.donotIncludePackAndDependencies})))}async checkForTrustedPublishers(e){let t=[],o=[],n=[];for(let{extension:b,manifest:S,checkForPackAndDependencies:y}of e)!b.private&&!this.isPublisherTrusted(b)&&(t.push(b),o.push(S),y&&n.push(S));if(!t.length)return;let r=n.length?await this.getOtherUntrustedPublishers(n):[],s=[...jo(t,b=>b.publisher),...r],l=s.filter(b=>!b.publisherDomain?.verified),c=s.filter(b=>b.publisherDomain?.verified),u={label:s.length>1?d(18920,null):d(18919,null),run:()=>{this.telemetryService.publicLog2("extensions:trustPublisher",{action:"trust",extensionId:t.map(b=>b.identifier.id).join(",")}),this.trustPublishers(...s.map(b=>({publisher:b.publisher,publisherDisplayName:b.publisherDisplayName})))}},p={label:d(18903,null),run:()=>{throw this.telemetryService.publicLog2("extensions:trustPublisher",{action:"learn",extensionId:t.map(b=>b.identifier.id).join(",")}),this.instantiationService.invokeFunction(b=>b.get(fe).executeCommand("vscode.open",A.parse("https://aka.ms/vscode-extension-security"))),new qi}},h=({publisherDisplayName:b,publisherLink:S})=>S?`[${b}](${S})`:b,g="https://aka.ms/vscode-verify-publisher",f=s.length===1?d(18888,null,s[0].publisherDisplayName):s.length===2?d(18889,null,s[0].publisherDisplayName,s[1].publisherDisplayName):d(18887,null,s[0].publisherDisplayName,s.length-1),v=new he("",{supportThemeIcons:!0,isTrusted:!0});if(t.length===1){let b=t[0],S=o[0];if(r.length){v.appendMarkdown(d(18890,null,`[${b.displayName}](${b.detailsLink})`,h(b))),v.appendMarkdown("&nbsp;");let y=nc("extension.open",b.identifier.id,S.extensionPack?.length?"extensionPack":"dependencies").toString();r.length===1?v.appendMarkdown(d(18918,null,y,h(r[0]))):v.appendMarkdown(d(18910,null,y,r.slice(0,r.length-1).map(w=>h(w)).join(", "),h(r[r.length-1]))),v.appendMarkdown("&nbsp;"),v.appendMarkdown(d(18895,null))}else v.appendMarkdown(d(18908,null,`[${b.displayName}](${b.detailsLink})`,h(b)))}else v.appendMarkdown(d(18912,null,h(s[0]),h(s[s.length-1])));if(c.length||l.length===1){for(let b of c){v.appendText(`
`);let S=d(18924,null,h(b),`[$(link-external) ${A.parse(b.publisherDomain.link).authority}](${b.publisherDomain.link})`);v.appendMarkdown(`$(${dV.id})&nbsp;${S}`)}l.length&&(v.appendText(`
`),l.length===1?v.appendMarkdown(`$(${L.unverified.id})&nbsp;${d(18923,null,h(l[0]),g)}`):v.appendMarkdown(`$(${L.unverified.id})&nbsp;${d(18922,null,l.slice(0,l.length-1).map(b=>h(b)).join(", "),h(l[l.length-1]),g)}`))}else v.appendText(`
`),v.appendMarkdown(`$(${L.unverified.id})&nbsp;${d(18884,null,g)}`);v.appendText(`
`),s.length>1?v.appendMarkdown(d(18911,null,this.productService.nameLong)):v.appendMarkdown(d(18909,null,this.productService.nameLong)),await this.dialogService.prompt({message:f,type:wt.Warning,buttons:[u,p],cancelButton:{run:()=>{throw this.telemetryService.publicLog2("extensions:trustPublisher",{action:"cancel",extensionId:t.map(b=>b.identifier.id).join(",")}),new qi}},custom:{markdownDetails:[{markdown:v,classes:["extensions-management-publisher-trust-dialog"]}]}})}async getOtherUntrustedPublishers(e){let t=new Set;for(let r of e)for(let s of[...r.extensionPack??[],...r.extensionDependencies??[]]){let[l]=s.split(".");l.toLowerCase()!==r.publisher.toLowerCase()&&(this.isPublisherUserTrusted(l.toLowerCase())||t.add(s.toLowerCase()))}if(!t.size)return[];let o=new Map;await this.getDependenciesAndPackedExtensionsRecursively([...t],o,Ie.None);let n=new Map;for(let[,r]of o)r.private||this.isPublisherTrusted(r)||n.set(r.publisherDisplayName,r);return[...n.values()]}async getDependenciesAndPackedExtensionsRecursively(e,t,o){if(e.length===0)return;let n=await this.extensionGalleryService.getExtensions(e.map(r=>({id:r})),o);for(let r=0;r<n.length;r++){let s=n[r];t.set(s.identifier.id.toLowerCase(),s)}e=[];for(let r of n){if(Rr(r.properties.dependencies))for(let s of r.properties.dependencies)t.has(s.toLowerCase())||e.push(s);if(Rr(r.properties.extensionPack))for(let s of r.properties.extensionPack)t.has(s.toLowerCase())||e.push(s)}return this.getDependenciesAndPackedExtensionsRecursively(e,t,o)}async checkForWorkspaceTrust(e,t){if(t||this.extensionManifestPropertiesService.getExtensionUntrustedWorkspaceSupportType(e)===!1){let o=[];if(o.push({label:d(18891,null),type:"ContinueWithTrust"}),t||o.push({label:d(18892,null),type:"ContinueWithoutTrust"}),o.push({label:d(18893,null),type:"Manage"}),await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(18894,null),buttons:o})===void 0)throw new qi}}async checkInstallingExtensionOnWeb(e,t){if(this.servers.length!==1||this.servers[0]!==this.extensionManagementServerService.webExtensionManagementServer)return;let o=[];if(t.extensionPack?.length){let v=await this.extensionGalleryService.getExtensions(t.extensionPack.map(b=>({id:b})),Ie.None);for(let b of v)await this.servers[0].extensionManagementService.canInstall(b)!==!0&&o.push(b);if(o.length&&o.length===v.length)throw new qh("Not supported in Web","Unsupported")}let n=d(18925,null,this.productService.nameLong),r=this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(t),s=Cue(t.capabilities?.virtualWorkspaces),l=r==="limited"||!!s;if(!o.length&&!l)return;let c=d(18904,null,e.displayName||e.identifier.id,n),u,p=[],h,g={label:d(18898,null),run:()=>{}},f={label:d(18916,null),run:()=>this.instantiationService.invokeFunction(v=>v.get(fe).executeCommand("extension.open",e.identifier.id,"extensionPack"))};o.length&&l?(u=c,h=`${s?`${s}
`:""}${d(18915,null)}`,p=[g,f]):l?(u=c,h=s||void 0,p=[g]):(u=d(18914,null,e.displayName||e.identifier.id,n),p=[g,f]),await this.dialogService.prompt({type:wt.Info,message:u,detail:h,buttons:p,cancelButton:{run:()=>{throw new qi}}})}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=$Rt(this.fileService,this.logService)),this._targetPlatformPromise}async cleanUp(){await Promise.allSettled(this.servers.map(e=>e.extensionManagementService.cleanUp()))}toggleApplicationScope(e,t){let o=this.getServer(e);if(o)return o.extensionManagementService.toggleApplicationScope(e,t);throw new Error("Not Supported")}copyExtensions(e,t){if(this.extensionManagementServerService.remoteExtensionManagementServer)throw new Error("Not Supported");return this.extensionManagementServerService.localExtensionManagementServer?this.extensionManagementServerService.localExtensionManagementServer.extensionManagementService.copyExtensions(e,t):this.extensionManagementServerService.webExtensionManagementServer?this.extensionManagementServerService.webExtensionManagementServer.extensionManagementService.copyExtensions(e,t):Promise.resolve()}registerParticipant(){throw new Error("Not Supported")}installExtensionsFromProfile(e,t,o){throw new Error("Not Supported")}isPublisherTrusted(e){let t=e.publisher.toLowerCase();return this.defaultTrustedPublishers.includes(t)||this.defaultTrustedPublishers.includes(e.publisherDisplayName.toLowerCase())||this.allowedExtensionsService.allowedExtensionsConfigValue&&this.allowedExtensionsService.isAllowed(e)?!0:this.isPublisherUserTrusted(t)}isPublisherUserTrusted(e){return!!this.getTrustedPublishersFromStorage()[e]}getTrustedPublishers(){let e=this.getTrustedPublishersFromStorage();return Object.keys(e).map(t=>e[t])}trustPublishers(...e){let t=this.getTrustedPublishersFromStorage();for(let o of e)t[o.publisher.toLowerCase()]=o;this.storageService.store(tei,JSON.stringify(t),-1,0)}untrustPublishers(...e){let t=this.getTrustedPublishersFromStorage();for(let o of e)delete t[o.toLowerCase()];this.storageService.store(tei,JSON.stringify(t),-1,0)}getTrustedPublishersFromStorage(){let e=this.storageService.getObject(tei,-1,{});return Array.isArray(e)?(this.storageService.remove(tei,-1),Object.create(null)):Object.keys(e).reduce((t,o)=>(t[o.toLowerCase()]=e[o],t),Object.create(null))}};ije=I([m(0,$c),m(1,ga),m(2,gn),m(3,hn),m(4,B),m(5,Ze),m(6,aW),m(7,Yl),m(8,ct),m(9,lp),m(10,hm),m(11,ge),m(12,re),m(13,F),m(14,N7),m(15,Mm),m(16,de),m(17,_e)],ije);var F7=class extends k{constructor(e,t,o,n,r,s,l){super();this.fileService=e;this.logService=t;this.workspaceService=o;this.extensionsScannerService=n;this.storageService=r;this.uriIdentityService=s;this.telemetryService=l;this._onDidChangeInvalidExtensions=this._register(new T);this.onDidChangeInvalidExtensions=this._onDidChangeInvalidExtensions.event;this.extensions=[];this.invalidExtensionWatchers=this._register(new O);this._register(U.throttle(this.fileService.onDidFilesChange,(c,u)=>((c=c??[]).push(u),c),1e3,!1)(c=>{let u=this.extensions.filter(p=>!p.isValid&&c.some(h=>h.affects(p.location)));u.length&&this.checkExtensionsValidity(u)})),this.initializePromise=this.initialize()}static{this.WORKSPACE_EXTENSIONS_KEY="workspaceExtensions.locations"}async initialize(){let e=this.getInstalledWorkspaceExtensionsLocations();e.length&&(await Promise.allSettled(e.map(async t=>{if(!this.workspaceService.isInsideWorkspace(t)){this.logService.info(`Removing the workspace extension ${t.toString()} as it is not inside the workspace`);return}if(!await this.fileService.exists(t)){this.logService.info(`Removing the workspace extension ${t.toString()} as it does not exist`);return}try{let o=await this.scanWorkspaceExtension(t);o?this.extensions.push(o):this.logService.info(`Skipping workspace extension ${t.toString()} as it does not exist`)}catch(o){this.logService.error("Skipping the workspace extension",t.toString(),o)}})),this.saveWorkspaceExtensions())}watchInvalidExtensions(){this.invalidExtensionWatchers.clear();for(let e of this.extensions)e.isValid||this.invalidExtensionWatchers.add(this.fileService.watch(e.location))}async checkExtensionsValidity(e){let t=[];await Promise.all(e.map(async n=>{let r=await this.scanWorkspaceExtension(n.location);r?.isValid&&t.push(r)}));let o=!1;for(let n of t){let r=this.extensions.findIndex(s=>this.uriIdentityService.extUri.isEqual(s.location,n.location));r!==-1&&(o=!0,this.extensions.splice(r,1,n))}o&&(this.saveWorkspaceExtensions(),this._onDidChangeInvalidExtensions.fire(t))}async getInstalled(e){return await this.initializePromise,this.extensions.filter(t=>e||t.isValid)}async install(e){await this.initializePromise;let t=await this.scanWorkspaceExtension(e.location);if(!t)throw new Error("Cannot install the extension as it does not exist.");let o=this.extensions.findIndex(n=>Ht(n.identifier,e.identifier));return o===-1?this.extensions.push(t):this.extensions.splice(o,1,t),this.saveWorkspaceExtensions(),this.telemetryService.publicLog2("workspaceextension:install"),t}async uninstall(e){await this.initializePromise;let t=this.extensions.findIndex(o=>Ht(o.identifier,e.identifier));t!==-1&&(this.extensions.splice(t,1),this.saveWorkspaceExtensions()),this.telemetryService.publicLog2("workspaceextension:uninstall")}getInstalledWorkspaceExtensionsLocations(){let e=[];try{let t=JSON.parse(this.storageService.get(F7.WORKSPACE_EXTENSIONS_KEY,1,"[]"));if(Array.isArray(e))for(let o of t)We(o)?this.workspaceService.getWorkbenchState()===2?e.push(this.workspaceService.getWorkspace().folders[0].toResource(o)):this.logService.warn(`Invalid value for 'extensions' in workspace storage: ${o}`):e.push(A.revive(o));else this.logService.warn(`Invalid value for 'extensions' in workspace storage: ${e}`)}catch(t){this.logService.warn(`Error parsing workspace extensions locations: ${Dn(t)}`)}return e}saveWorkspaceExtensions(){let e=this.extensions.map(t=>t.location);this.workspaceService.getWorkbenchState()===2?this.storageService.store(F7.WORKSPACE_EXTENSIONS_KEY,JSON.stringify(ui(e.map(t=>this.uriIdentityService.extUri.relativePath(this.workspaceService.getWorkspace().folders[0].uri,t)))),1,1):this.storageService.store(F7.WORKSPACE_EXTENSIONS_KEY,JSON.stringify(e),1,1),this.watchInvalidExtensions()}async scanWorkspaceExtension(e){let t=await this.extensionsScannerService.scanExistingExtension(e,1,{includeInvalid:!0});return t?this.toLocalWorkspaceExtension(t):null}async toLocalWorkspaceExtension(e){let t=await this.fileService.resolve(e.location),o,n;t.children&&(o=t.children.find(({name:l})=>/^readme(\.txt|\.md|)$/i.test(l))?.resource,n=t.children.find(({name:l})=>/^changelog(\.txt|\.md|)$/i.test(l))?.resource);let r=[...e.validations],s=e.isValid;return e.manifest.main&&(await this.fileService.exists(this.uriIdentityService.extUri.joinPath(e.location,e.manifest.main))||(s=!1,r.push([wt.Error,d(18905,null,e.manifest.main)]))),{identifier:e.identifier,type:e.type,isBuiltin:e.isBuiltin||!!e.metadata?.isBuiltin,location:e.location,manifest:e.manifest,targetPlatform:e.targetPlatform,validations:r,isValid:s,readmeUrl:o,changelogUrl:n,publisherDisplayName:e.metadata?.publisherDisplayName,publisherId:e.metadata?.publisherId||null,isApplicationScoped:!!e.metadata?.isApplicationScoped,isMachineScoped:!!e.metadata?.isMachineScoped,isPreReleaseVersion:!!e.metadata?.isPreReleaseVersion,hasPreReleaseVersion:!!e.metadata?.hasPreReleaseVersion,preRelease:!!e.metadata?.preRelease,installedTimestamp:e.metadata?.installedTimestamp,updated:!!e.metadata?.updated,pinned:!!e.metadata?.pinned,forceAutoUpdate:!1,isWorkspaceScoped:!0,private:!1,source:"resource",size:e.metadata?.size??0}}};F7=I([m(0,ge),m(1,re),m(2,Ae),m(3,N7),m(4,de),m(5,gt),m(6,_e)],F7);var _gt=class extends ije{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super(t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x);this.environmentService=e}async installVSIXInServer(e,t,o){if(e.scheme===Q.vscodeRemote&&t===this.extensionManagementServerService.localExtensionManagementServer){let n=Ve(this.environmentService.tmpDir,ht());await this.downloadService.download(e,n,"extensionManagement.downloadRemoteVsix"),e=n}return super.installVSIXInServer(e,t,o)}};_gt=I([m(0,Jr),m(1,$c),m(2,ga),m(3,gn),m(4,hn),m(5,B),m(6,Ze),m(7,aW),m(8,Yl),m(9,ct),m(10,lp),m(11,hm),m(12,ge),m(13,re),m(14,F),m(15,N7),m(16,Mm),m(17,de),m(18,_e)],_gt);Ce(Dd,_gt,1);var hji=["v0.1","v0"],oje=class extends k{constructor(e,t,o){super();this.productService=e;this.requestService=t;this.logService=o;this.onDidChangeMcpGalleryManifest=U.None;this.onDidChangeMcpGalleryManifestStatus=U.None;this.versionByUrl=new Map}get mcpGalleryManifestStatus(){return this.productService.mcpGallery?.serviceUrl?"available":"unavailable"}async getMcpGalleryManifest(){return this.productService.mcpGallery?this.createMcpGalleryManifest(this.productService.mcpGallery.serviceUrl,hji[0]):null}async createMcpGalleryManifest(e,t){if(e=e.endsWith("/")?e.slice(0,-1):e,!t){let s=this.versionByUrl.get(e);s||this.versionByUrl.set(e,s=this.getVersion(e)),t=await s}let o=this.productService.mcpGallery?.serviceUrl===e,n=`${e}/${t}/servers`,r=[{id:n,type:"McpServersQueryService"},{id:`${n}/{name}/versions/{version}`,type:"McpServerVersionUriTemplate"},{id:`${n}/{name}/versions/latest`,type:"McpServerLatestVersionUriTemplate"}];return o&&(r.push({id:`${n}/by-name/{name}`,type:"McpServerNamedResourceUriTemplate"}),r.push({id:this.productService.mcpGallery.itemWebUrl,type:"McpServerWebUriTemplate"}),r.push({id:this.productService.mcpGallery.publisherUrl,type:"PublisherUriTemplate"}),r.push({id:this.productService.mcpGallery.supportUrl,type:"ContactSupportUri"}),r.push({id:this.productService.mcpGallery.supportUrl,type:"ContactSupportUri"}),r.push({id:this.productService.mcpGallery.privacyPolicyUrl,type:"PrivacyPolicyUri"}),r.push({id:this.productService.mcpGallery.termsOfServiceUrl,type:"TermsOfServiceUri"}),r.push({id:this.productService.mcpGallery.reportUrl,type:"ReportUri"})),t==="v0"&&r.push({id:`${n}/{id}`,type:"McpServerIdUriTemplate"}),{version:t,url:e,resources:r}}async getVersion(e){for(let t of hji)if(await this.checkVersion(e,t))return t;return hji[0]}async checkVersion(e,t){try{let o=await this.requestService.request({type:"GET",url:`${e}/${t}/servers?limit=1`,callSite:"mcpGalleryManifestService.checkVersion"},Ie.None);if(pE(o))return!0;this.logService.info(`The service at ${e} does not support version ${t}. Service returned status ${o.res.statusCode}.`)}catch(o){this.logService.error(o)}return!1}};oje=I([m(0,Ze),m(1,Ra),m(2,re)],oje);var nje=class extends oje{constructor(e,t,o,n,r){super(e,o,n);this.configurationService=r;this.mcpGalleryManifest=null;this._onDidChangeMcpGalleryManifest=this._register(new T);this.onDidChangeMcpGalleryManifest=this._onDidChangeMcpGalleryManifest.event;this.currentStatus="unavailable";this._onDidChangeMcpGalleryManifestStatus=this._register(new T);this.onDidChangeMcpGalleryManifestStatus=this._onDidChangeMcpGalleryManifestStatus.event;let s=t.getConnection();if(s){let l=s.getChannel("mcpGalleryManifest");this.getMcpGalleryManifest().then(c=>{l.call("setMcpGalleryManifest",[c]),this._register(this.onDidChangeMcpGalleryManifest(u=>l.call("setMcpGalleryManifest",[u])))})}}get mcpGalleryManifestStatus(){return this.currentStatus}async getMcpGalleryManifest(){return this.initPromise||(this.initPromise=this.doGetMcpGalleryManifest()),await this.initPromise,this.mcpGalleryManifest}async doGetMcpGalleryManifest(){await this.getAndUpdateMcpGalleryManifest(),this._register(this.configurationService.onDidChangeConfiguration(e=>{(e.affectsConfiguration(gQ)||e.affectsConfiguration("chat.mcp.gallery.version"))&&this.getAndUpdateMcpGalleryManifest()}))}async getAndUpdateMcpGalleryManifest(){let e=this.configurationService.getValue("chat.mcp.gallery");e?.serviceUrl?this.update(await this.createMcpGalleryManifest(e.serviceUrl,e.version)):this.update(await super.getMcpGalleryManifest())}update(e){this.mcpGalleryManifest?.url===e?.url&&this.mcpGalleryManifest?.version===e?.version||(this.mcpGalleryManifest=e,this.mcpGalleryManifest?this.logService.trace("MCP Registry configured:",this.mcpGalleryManifest.url):this.logService.trace("No MCP Registry configured"),this.currentStatus=this.mcpGalleryManifest?"available":"unavailable",this._onDidChangeMcpGalleryManifest.fire(this.mcpGalleryManifest),this._onDidChangeMcpGalleryManifestStatus.fire(this.currentStatus))}};nje=I([m(0,Ze),m(1,bo),m(2,Ra),m(3,re),m(4,B)],nje);var Dgt=class extends nje{constructor(i,e,t,o,n,r){super(i,e,t,o,r);let s=n.getChannel("mcpGalleryManifest");this.getMcpGalleryManifest().then(l=>{s.call("setMcpGalleryManifest",[l]),this._register(this.onDidChangeMcpGalleryManifest(c=>s.call("setMcpGalleryManifest",[c])))})}};Dgt=I([m(0,Ze),m(1,bo),m(2,Ra),m(3,re),m(4,kS),m(5,B)],Dgt);Ce(KH,Dgt,0);var Rgt=class extends HVe{constructor(i,e,t,o,n,r,s,l,c,u){let p=new Hne(u.getChannel("mcpManagement"),i,e);super(p,i,e,t,o,n,r,s,l,c),this._register(p)}};Rgt=I([m(0,fP),m(1,re),m(2,gn),m(3,gt),m(4,Ae),m(5,bo),m(6,hn),m(7,jN),m(8,F),m(9,kS)],Rgt);Ce(V6,Rgt,1);_w(U_e,"encryption");var Lgt=class{async resizeImage(i,e){let t=e==="image/gif";return typeof i=="string"&&(i=this.convertStringToUInt8Array(i)),new Promise((o,n)=>{let r=new Blob([i],{type:e}),s=new Image,l=URL.createObjectURL(r);s.src=l,s.onload=()=>{URL.revokeObjectURL(l);let{width:c,height:u}=s;if((c<=768||u<=768)&&!t){o(i);return}if(c>2048||u>2048){let f=2048/Math.max(c,u);c=Math.round(c*f),u=Math.round(u*f)}let p=768/Math.min(c,u);c=Math.round(c*p),u=Math.round(u*p);let h=document.createElement("canvas");h.width=c,h.height=u;let g=h.getContext("2d");if(g){g.drawImage(s,0,0,c,u);let v=e&&["image/jpeg","image/jpg"].includes(e)?"image/jpeg":"image/png";h.toBlob(b=>{if(b){let S=new FileReader;S.onload=()=>{o(new Uint8Array(S.result))},S.onerror=y=>n(y),S.readAsArrayBuffer(b)}else n(new Error("Failed to create blob from canvas"))},v)}else n(new Error("Failed to get canvas context"))},s.onerror=c=>{URL.revokeObjectURL(l),n(c)}})}convertStringToUInt8Array(i){let e=i.includes(",")?i.split(",")[1]:i;return this.isValidBase64(e)?Ws(e).buffer:new TextEncoder().encode(i)}convertUint8ArrayToString(i){try{return new TextDecoder().decode(i)}catch{return""}}isValidBase64(i){try{return Ws(i),!0}catch{return!1}}async createFileForMedia(i,e,t,o){await i.exists(e)||await i.createFolder(e);let r=o.split("/")[1]||"png",s=`image-${Date.now()}.${r}`,l=Ve(e,s),c=Ke.wrap(t);return await i.writeFile(l,c),l}async cleanupOldImages(i,e,t){if(!await i.exists(t))return;let n=10080*60*1e3,r=await i.resolve(t);r.children&&await Promise.all(r.children.map(async s=>{try{let l=this.getTimestampFromFilename(s.name);l&&Date.now()-l>n&&await i.del(s.resource)}catch(l){e.error("Failed to clean up old images",l)}}))}getTimestampFromFilename(i){let e=i.match(/image-(\d+)\./);if(e)return parseInt(e[1],10)}};Ce(s1e,Lgt,1);Ce(s1e,Lgt,1);var Mgt=class extends z_e{constructor(e,t,o,n,r,s,l,c){super(!!r.useInMemorySecretStorage,s,l,c);this._notificationService=e;this._dialogService=t;this._openerService=o;this._jsonEditingService=n;this._environmentService=r;this.notifyOfNoEncryptionOnce=bd(()=>this.notifyOfNoEncryption())}set(e,t){return this._sequencer.queue(e,async()=>{await this.resolvedStorageService,this.type!=="persisted"&&!this._environmentService.useInMemorySecretStorage&&(this._logService.trace("[NativeSecretStorageService] Notifying user that secrets are not being stored on disk."),await this.notifyOfNoEncryptionOnce())}),super.set(e,t)}async notifyOfNoEncryption(){let e=[],t={label:d(19254,null),run:()=>this._openerService.open("https://go.microsoft.com/fwlink/?linkid=2239490"),keepOpen:!0};e.push(t);let o=d(19251,null);if(!Sn){this._notificationService.prompt(wt.Error,o,e);return}let n=await this._encryptionService.getKeyStorageProvider();if(n==="basic_text"){let r=d(19256,null),s={label:d(19255,null),run:async()=>{await this._encryptionService.setUsePlainTextEncryption(),await this._jsonEditingService.write(this._environmentService.argvResource,[{path:["password-store"],value:"basic"}],!0),this.reinitialize()}};e.unshift(s),await this._dialogService.prompt({type:"error",buttons:e,message:o,detail:r});return}Uso(n)?o=d(19252,null):Hso(n)&&(o=d(19253,null)),this._notificationService.prompt(wt.Error,o,e)}};Mgt=I([m(0,Ne),m(1,ct),m(2,Je),m(3,Zg),m(4,Ix),m(5,de),m(6,U_e),m(7,re)],Mgt);Ce(fC,Mgt,1);lv(m3,"languagePacks");var iei=class{constructor(i){this.channel=i}log(i,e){return this.channel.call("log",{eventName:i,data:e}).then(void 0,t=>`Failed to log telemetry: ${console.warn(t)}`),Promise.resolve(null)}flush(){return Promise.resolve()}};function uHo(a,i,e,t,o,n,r,s,l,c){let{commit:u,version:p,date:h}=i??{},g=zno(t,o,c.arch,u,p,n,r,s,l,h),f=a.get(eSt,-1),v=a.get(HQi,-1);return g["common.version.shell"]=c.versions?.electron,g["common.version.renderer"]=c.versions?.chrome,g["common.firstSessionDate"]=f,g["common.lastSessionDate"]=v||"",g["common.isNewSession"]=v?"0":"1",g["common.remoteAuthority"]=KRt(e.remoteAuthority,i),g["common.cli"]=!!c.env.VSCODE_CLI,e.isSessionsWindow&&(g["common.isAgentsWindow"]=!0),g}var W7=class{constructor(i,e,t){this._configurationService=e;this._productService=t;this._experimentProperties={};this._pendingEvents=[];this._isExperimentPropertySet=!1;this._disposables=new O;this._cleanupPatterns=[];this._appenders=i.appenders,this._commonProperties=i.commonProperties??Object.create(null),this.sessionId=this._commonProperties.sessionID,this.machineId=this._commonProperties["common.machineId"],this.sqmId=this._commonProperties["common.sqmId"],this.devDeviceId=this._commonProperties["common.devDeviceId"],this.firstSessionDate=this._commonProperties["common.firstSessionDate"],this.msftInternal=this._commonProperties["common.msftInternal"],this._piiPaths=i.piiPaths||[],this._telemetryLevel=3,this._sendErrorTelemetry=!!i.sendErrorTelemetry,this._meteredConnectionService=i.meteredConnectionService,this._cleanupPatterns=[/(vscode-)?file:\/\/.*?\/resources\/app\//gi];for(let o of this._piiPaths)this._cleanupPatterns.push(new RegExp(Ss(o),"gi")),o.indexOf("\\")>=0&&this._cleanupPatterns.push(new RegExp(Ss(o.replace(/\\/g,"/")),"gi"));this._updateTelemetryLevel(),this._disposables.add(this._configurationService.onDidChangeConfiguration(o=>{(o.affectsConfiguration(dT)||o.affectsConfiguration(xB)||o.affectsConfiguration(DY))&&this._updateTelemetryLevel()})),i.waitForExperimentProperties?this._flushTimeout=setTimeout(()=>this._flushPendingEvents(),W7.BUFFER_FLUSH_TIMEOUT):this._isExperimentPropertySet=!0}static{this.IDLE_START_EVENT_NAME="UserIdleStart"}static{this.IDLE_STOP_EVENT_NAME="UserIdleStop"}static{this.BUFFER_FLUSH_TIMEOUT=1e4}static{this.MAX_BUFFER_SIZE=1e3}setExperimentProperty(i,e){this._experimentProperties[i]=new lh(e),this._isExperimentPropertySet||this._flushPendingEvents()}setCommonProperty(i,e){this._commonProperties[i]=e}_flushPendingEvents(){if(!this._isExperimentPropertySet){this._isExperimentPropertySet=!0,this._flushTimeout!==void 0&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0);for(let i of this._pendingEvents)this._doLog(i.eventName,i.eventLevel,i.data);this._pendingEvents=[]}}_updateTelemetryLevel(){let i=Yy(this._configurationService),e=this._productService.enabledTelemetryLevels;if(e){this._sendErrorTelemetry=this.sendErrorTelemetry?e.error:!1;let t=e.usage?3:e.error?2:0;i=Math.min(i,t)}this._telemetryLevel=i}get sendErrorTelemetry(){return this._sendErrorTelemetry}get telemetryLevel(){return this._telemetryLevel}dispose(){this._flushPendingEvents(),this._disposables.dispose()}_log(i,e,t){if(!(this._telemetryLevel<e)&&!this._meteredConnectionService?.isConnectionMetered){if(!this._isExperimentPropertySet){this._pendingEvents.length<W7.MAX_BUFFER_SIZE&&this._pendingEvents.push({eventName:i,eventLevel:e,data:t});return}this._doLog(i,e,t)}}_doLog(i,e,t){t=Cp(t,this._experimentProperties),t=Qno(t,this._cleanupPatterns),t=Cp(t,this._commonProperties),e===2&&(t={...t,isError:!0}),this._appenders.forEach(o=>o.log(i,t??{}))}publicLog(i,e){this._log(i,3,e)}publicLog2(i,e){this.publicLog(i,e)}publicLogError(i,e){this._sendErrorTelemetry&&this._log(i,2,e)}publicLogError2(i,e){this.publicLogError(i,e)}};W7=I([m(1,B),m(2,Ze)],W7);function ZMn(){let a=d(2567,null,$i.nameLong),i=$i.privacyStatementUrl?d(2553,null,"https://aka.ms/vscode-telemetry",$i.privacyStatementUrl):d(2554,null,"https://aka.ms/vscode-telemetry"),e=Ft?"":d(2559,null),t=d(2552,null),o=d(2557,null),n=d(2568,null),r=d(2566,null),s=`
|       | ${t} | ${o} | ${n} |
|:------|:-------------:|:---------------:|:----------:|
| all   |       \u2713       |        \u2713        |     \u2713      |
| error |       \u2713       |        \u2713        |     -      |
| crash |       \u2713       |        -        |     -      |
| off   |       -       |        -        |     -      |
`,l=d(2562,null);return`
${a} ${i} ${e}

&nbsp;

${r}
${s}

&nbsp;

${l}
`}var ePn=oe.as($t.Configuration);ePn.registerConfiguration({id:UQi,order:1,type:"object",title:d(2569,null),properties:{[dT]:{type:"string",enum:["all","error","crash","off"],enumDescriptions:[d(2561,null),d(2563,null),d(2560,null),d(2564,null)],markdownDescription:ZMn(),default:"all",restricted:!0,scope:1,tags:["usesOnlineServices","telemetry"],policy:{name:"TelemetryLevel",category:"Telemetry",minimumVersion:"1.99",localization:{description:{key:"telemetry.telemetryLevel.policyDescription",value:d(2565,null)},enumDescriptions:[{key:"telemetry.telemetryLevel.default",value:d(2561,null)},{key:"telemetry.telemetryLevel.error",value:d(2563,null)},{key:"telemetry.telemetryLevel.crash",value:d(2560,null)},{key:"telemetry.telemetryLevel.off",value:d(2564,null)}]}}},"telemetry.feedback.enabled":{type:"boolean",default:!0,description:d(2558,null),policy:{name:"EnableFeedback",category:"Telemetry",minimumVersion:"1.99",localization:{description:{key:"telemetry.feedback.enabled",value:d(2558,null)}}}},[xB]:{type:"boolean",markdownDescription:$i.privacyStatementUrl?d(2556,null,$i.nameLong,$i.privacyStatementUrl):d(2555,null,$i.nameLong),default:!0,restricted:!0,markdownDeprecationMessage:d(2551,null,`\`#${dT}#\``),scope:1,tags:["usesOnlineServices","telemetry"]}}});var Pgt=class extends k{get sessionId(){return this.impl.sessionId}get machineId(){return this.impl.machineId}get sqmId(){return this.impl.sqmId}get devDeviceId(){return this.impl.devDeviceId}get firstSessionDate(){return this.impl.firstSessionDate}get msftInternal(){return this.impl.msftInternal}constructor(i,e,t,o,n,r){if(super(),EM(e,i)){let s=$no(e,n),l=t.getChannel("telemetryAppender"),c={appenders:[new iei(l)],commonProperties:uHo(o,e,i,i.os.release,i.os.hostname,i.machineId,i.sqmId,i.devDeviceId,s,JE),piiPaths:jno(i),sendErrorTelemetry:!0,waitForExperimentProperties:hOt(n,e,i)};this.impl=this._register(new W7(c,n,e))}else this.impl=qno;this.sendErrorTelemetry=this.impl.sendErrorTelemetry,this._register(r.onDidCompleteRequest(s=>{s.callSite===Wso||e.quality==="stable"||this.publicLog2("fetchCall",{callSite:s.callSite,latency:s.latency,statusCode:s.statusCode})}))}setExperimentProperty(i,e){return this.impl.setExperimentProperty(i,e)}setCommonProperty(i,e){this.impl.setCommonProperty(i,e)}get telemetryLevel(){return this.impl.telemetryLevel}publicLog(i,e){this.impl.publicLog(i,e)}publicLog2(i,e){this.publicLog(i,e)}publicLogError(i,e){this.impl.publicLogError(i,e)}publicLogError2(i,e){this.publicLogError(i,e)}};Pgt=I([m(0,Jr),m(1,Ze),m(2,kS),m(3,de),m(4,B),m(5,Ra)],Pgt);Ce(_e,Pgt,1);var oei=le("extensionHostStarter"),pHo="extensionHostStarter",mHo=6e3;_w(oei,pHo);var Agt=class extends JRt{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,s,c);this._requestService=l}async readExtensionResource(e){if(await this.isExtensionGalleryResource(e)){let o=await this.getExtensionGalleryRequestHeaders(),n=await this._requestService.request({url:e.toString(),headers:o,callSite:"extensionResourceLoader.readExtensionResource"},Ie.None);return await gC(n)||""}return(await this._fileService.readFile(e)).value.toString()}};Agt=I([m(0,ge),m(1,de),m(2,Ze),m(3,ko),m(4,B),m(5,tb),m(6,Ra),m(7,re)],Agt);Ce(aE,Agt,1);var tPn="workbench.view.extensions",Ngt=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this.jsonEditingService=i;this.environmentService=e;this.notificationService=t;this.languagePackService=o;this.paneCompositePartService=n;this.extensionManagementService=r;this.progressService=s;this.textFileService=l;this.editorService=c;this.dialogService=u;this.hostService=p;this.productService=h}async validateLocaleFile(){try{let i=await this.textFileService.read(this.environmentService.argvResource,{encoding:"utf8"});A_(i.value)}catch{return this.notificationService.notify({severity:ft.Error,message:d(19164,null),actions:{primary:[li({id:"openArgv",label:d(19166,null),run:()=>this.editorService.openEditor({resource:this.environmentService.argvResource})})]}}),!1}return!0}async writeLocaleValue(i){return await this.validateLocaleFile()?(await this.jsonEditingService.write(this.environmentService.argvResource,[{path:["locale"],value:i}],!0),!0):!1}async setLocale(i,e=!1){let t=i.id;if(t===SI.value()||!t&&SI.isDefaultVariant())return;let o=await this.languagePackService.getInstalledLanguages();try{if(!o.some(n=>n.id===i.id)){if(i.galleryExtension?.publisher.toLowerCase()!=="ms-ceintl"){((await this.paneCompositePartService.openPaneComposite(tPn,0))?.getViewPaneContainer()).search(`@id:${i.extensionId}`);return}await this.progressService.withProgress({location:15,title:d(19165,null,i.label)},n=>this.extensionManagementService.installFromGallery(i.galleryExtension,{isMachineScoped:!1}))}if(!e&&!await this.showRestartDialog(i.label))return;await this.writeLocaleValue(t),await this.hostService.restart()}catch(n){this.notificationService.error(n)}}async clearLocalePreference(){try{await this.writeLocaleValue(void 0),SI.isDefaultVariant()||await this.showRestartDialog("English")}catch(i){this.notificationService.error(i)}}async showRestartDialog(i){let{confirmed:e}=await this.dialogService.confirm({message:d(19169,null,this.productService.nameLong,i),detail:d(19168,null,i,this.productService.nameLong),primaryButton:d(19167,null)});return e}};Ngt=I([m(0,Zg),m(1,ko),m(2,Ne),m(3,m3),m(4,Es),m(5,xs),m(6,Go),m(7,Uo),m(8,ie),m(9,ct),m(10,ti),m(11,Ze)],Ngt);var Ogt=class{constructor(i){this.languagePackService=i}async getExtensionIdProvidingCurrentLocale(){let i=SI.value();return i===fz?void 0:(await this.languagePackService.getInstalledLanguages()).find(o=>o.id===i)?.extensionId}};Ogt=I([m(0,m3)],Ogt);Ce(AU,Ngt,1);Ce(M1t,Ogt,1);var Fgt=class extends JZt{constructor(i,e,t,o,n,r,s,l,c){super(A.file(r.builtinExtensionsPath),A.file(r.extensionsPath),r.userHome,i.currentProfile,e,t,o,n,r,s,l,c)}};Fgt=I([m(0,gn),m(1,hn),m(2,$ae),m(3,ge),m(4,re),m(5,Ix),m(6,Ze),m(7,gt),m(8,F)],Fgt);Ce(N7,Fgt,1);function Ij(a,i){i=i||R1t;let e=a.manifest;return{...L1t({...a,manifest:void 0},i),manifest:e}}var nei=class extends O7{constructor(e,t,o){super(t,o);this.channel=e;this._onInstallExtension=this._register(new T);this._onDidInstallExtensions=this._register(new T);this._onUninstallExtension=this._register(new T);this._onDidUninstallExtension=this._register(new T);this._onDidUpdateExtensionMetadata=this._register(new T);this._register(this.channel.listen("onInstallExtension")(n=>this.onInstallExtensionEvent({...n,source:this.isUriComponents(n.source)?A.revive(n.source):n.source,profileLocation:A.revive(n.profileLocation)}))),this._register(this.channel.listen("onDidInstallExtensions")(n=>this.onDidInstallExtensionsEvent(n.map(r=>({...r,local:r.local?Ij(r.local,null):r.local,source:this.isUriComponents(r.source)?A.revive(r.source):r.source,profileLocation:A.revive(r.profileLocation)}))))),this._register(this.channel.listen("onUninstallExtension")(n=>this.onUninstallExtensionEvent({...n,profileLocation:A.revive(n.profileLocation)}))),this._register(this.channel.listen("onDidUninstallExtension")(n=>this.onDidUninstallExtensionEvent({...n,profileLocation:A.revive(n.profileLocation)}))),this._register(this.channel.listen("onDidUpdateExtensionMetadata")(n=>this.onDidUpdateExtensionMetadataEvent({profileLocation:A.revive(n.profileLocation),local:Ij(n.local,null)})))}get onInstallExtension(){return this._onInstallExtension.event}get onDidInstallExtensions(){return this._onDidInstallExtensions.event}get onUninstallExtension(){return this._onUninstallExtension.event}get onDidUninstallExtension(){return this._onDidUninstallExtension.event}get onDidUpdateExtensionMetadata(){return this._onDidUpdateExtensionMetadata.event}onInstallExtensionEvent(e){this._onInstallExtension.fire(e)}onDidInstallExtensionsEvent(e){this._onDidInstallExtensions.fire(e)}onUninstallExtensionEvent(e){this._onUninstallExtension.fire(e)}onDidUninstallExtensionEvent(e){this._onDidUninstallExtension.fire(e)}onDidUpdateExtensionMetadataEvent(e){this._onDidUpdateExtensionMetadata.fire(e)}isUriComponents(e){if(!e)return!1;let t=e;return typeof t?.path=="string"&&typeof t?.scheme=="string"}getTargetPlatform(){return this._targetPlatformPromise||(this._targetPlatformPromise=this.channel.call("getTargetPlatform")),this._targetPlatformPromise}zip(e){return Promise.resolve(this.channel.call("zip",[e]).then(t=>A.revive(t)))}install(e,t){return Promise.resolve(this.channel.call("install",[e,t])).then(o=>Ij(o,null))}installFromLocation(e,t){return Promise.resolve(this.channel.call("installFromLocation",[e,t])).then(o=>Ij(o,null))}async installExtensionsFromProfile(e,t,o){return(await this.channel.call("installExtensionsFromProfile",[e,t,o])).map(r=>Ij(r,null))}getManifest(e){return Promise.resolve(this.channel.call("getManifest",[e]))}installFromGallery(e,t){return Promise.resolve(this.channel.call("installFromGallery",[e,t])).then(o=>Ij(o,null))}async installGalleryExtensions(e){return(await this.channel.call("installGalleryExtensions",[e])).map(o=>({...o,local:o.local?Ij(o.local,null):o.local,source:this.isUriComponents(o.source)?A.revive(o.source):o.source,profileLocation:A.revive(o.profileLocation)}))}uninstall(e,t){if(e.isWorkspaceScoped)throw new Error("Cannot uninstall a workspace extension");return Promise.resolve(this.channel.call("uninstall",[e,t]))}uninstallExtensions(e){if(e.some(t=>t.extension.isWorkspaceScoped))throw new Error("Cannot uninstall a workspace extension");return Promise.resolve(this.channel.call("uninstallExtensions",[e]))}getInstalled(e=null,t,o){return Promise.resolve(this.channel.call("getInstalled",[e,t,o,Kr])).then(n=>n.map(r=>Ij(r,null)))}updateMetadata(e,t,o){return Promise.resolve(this.channel.call("updateMetadata",[e,t,o])).then(n=>Ij(n,null))}resetPinnedStateForAllUserExtensions(e){return this.channel.call("resetPinnedStateForAllUserExtensions",[e])}toggleApplicationScope(e,t){return this.channel.call("toggleApplicationScope",[e,t]).then(o=>Ij(o,null))}copyExtensions(e,t){return this.channel.call("copyExtensions",[e,t])}getExtensionsControlManifest(){return Promise.resolve(this.channel.call("getExtensionsControlManifest"))}async download(e,t,o){let n=await this.channel.call("download",[e,t,o]);return A.revive(n)}async cleanUp(){return this.channel.call("cleanUp")}registerParticipant(){throw new Error("Not Supported")}};var rje=class extends nei{constructor(e,t,o,n,r){super(e,t,o);this.userDataProfileService=n;this.uriIdentityService=r;this._onDidChangeProfile=this._register(new T);this.onDidChangeProfile=this._onDidChangeProfile.event;this._onDidProfileAwareInstallExtensions=this._register(new T);this._onDidProfileAwareUninstallExtension=this._register(new T);this._onDidProfileAwareUpdateExtensionMetadata=this._register(new T);this._register(n.onDidChangeCurrentProfile(s=>{this.uriIdentityService.extUri.isEqual(s.previous.extensionsResource,s.profile.extensionsResource)||s.join(this.whenProfileChanged(s))}))}get onProfileAwareDidInstallExtensions(){return this._onDidProfileAwareInstallExtensions.event}get onProfileAwareDidUninstallExtension(){return this._onDidProfileAwareUninstallExtension.event}get onProfileAwareDidUpdateExtensionMetadata(){return this._onDidProfileAwareUpdateExtensionMetadata.event}async onInstallExtensionEvent(e){let t=this.filterEvent(e.profileLocation,e.applicationScoped??!1);(t instanceof Promise?await t:t)&&this._onInstallExtension.fire(e)}async onDidInstallExtensionsEvent(e){let t=[];for(let o of e){let n=this.filterEvent(o.profileLocation,o.applicationScoped??o.local?.isApplicationScoped??!1);(n instanceof Promise?await n:n)&&t.push(o)}t.length&&this._onDidInstallExtensions.fire(t),this._onDidProfileAwareInstallExtensions.fire(e)}async onUninstallExtensionEvent(e){let t=this.filterEvent(e.profileLocation,e.applicationScoped??!1);(t instanceof Promise?await t:t)&&this._onUninstallExtension.fire(e)}async onDidUninstallExtensionEvent(e){let t=this.filterEvent(e.profileLocation,e.applicationScoped??!1);(t instanceof Promise?await t:t)&&this._onDidUninstallExtension.fire(e),this._onDidProfileAwareUninstallExtension.fire(e)}async onDidUpdateExtensionMetadataEvent(e){let t=this.filterEvent(e.profileLocation,e.local?.isApplicationScoped??!1);(t instanceof Promise?await t:t)&&this._onDidUpdateExtensionMetadata.fire(e),this._onDidProfileAwareUpdateExtensionMetadata.fire(e)}async install(e,t){return t={...t,profileLocation:await this.getProfileLocation(t?.profileLocation)},super.install(e,t)}async installFromLocation(e,t){return super.installFromLocation(e,await this.getProfileLocation(t))}async installFromGallery(e,t){return t={...t,profileLocation:await this.getProfileLocation(t?.profileLocation)},super.installFromGallery(e,t)}async installGalleryExtensions(e){let t=[];for(let o of e)t.push({...o,options:{...o.options,profileLocation:await this.getProfileLocation(o.options?.profileLocation)}});return super.installGalleryExtensions(t)}async uninstall(e,t){return t={...t,profileLocation:await this.getProfileLocation(t?.profileLocation)},super.uninstall(e,t)}async uninstallExtensions(e){let t=[];for(let{extension:o,options:n}of e)t.push({extension:o,options:{...n,profileLocation:await this.getProfileLocation(n?.profileLocation)}});return super.uninstallExtensions(t)}async getInstalled(e=null,t,o){return super.getInstalled(e,await this.getProfileLocation(t),o)}async updateMetadata(e,t,o){return super.updateMetadata(e,t,await this.getProfileLocation(o))}async toggleApplicationScope(e,t){return super.toggleApplicationScope(e,await this.getProfileLocation(t))}async copyExtensions(e,t){return super.copyExtensions(await this.getProfileLocation(e),await this.getProfileLocation(t))}async whenProfileChanged(e){let t=await this.getProfileLocation(e.previous.extensionsResource),o=await this.getProfileLocation(e.profile.extensionsResource);if(this.uriIdentityService.extUri.isEqual(t,o))return;let n=await this.switchExtensionsProfile(t,o);this._onDidChangeProfile.fire(n)}async switchExtensionsProfile(e,t,o){let n=await this.getInstalled(1,e),r=await this.getInstalled(1,t);if(o?.length){let s=[];for(let l of n)o.some(c=>hi.equals(l.identifier.id,c))&&!r.some(c=>hi.equals(c.identifier.id,l.identifier.id))&&s.push(l.identifier);s.length&&await this.installExtensionsFromProfile(s,e,t)}return dA(n,r,(s,l)=>oc(`${hi.toKey(s.identifier.id)}@${s.manifest.version}`,`${hi.toKey(l.identifier.id)}@${l.manifest.version}`))}async getProfileLocation(e){return e??this.userDataProfileService.currentProfile.extensionsResource}};var sje=class extends rje{constructor(e,t,o,n,r,s,l){super(e,t,o,n,l);this.userDataProfilesService=r;this.remoteUserDataProfilesService=s}async filterEvent(e,t){if(t||!e&&this.userDataProfileService.currentProfile.isDefault)return!0;let o=await this.remoteUserDataProfilesService.getRemoteProfile(this.userDataProfileService.currentProfile);return!!this.uriIdentityService.extUri.isEqual(o.extensionsResource,e)}async getProfileLocation(e){if(!e&&this.userDataProfileService.currentProfile.isDefault)return;e=await super.getProfileLocation(e);let t=this.userDataProfilesService.profiles.find(o=>this.uriIdentityService.extUri.isEqual(o.extensionsResource,e));return t?t=await this.remoteUserDataProfilesService.getRemoteProfile(t):t=(await this.remoteUserDataProfilesService.getRemoteProfiles()).find(o=>this.uriIdentityService.extUri.isEqual(o.extensionsResource,e)),t?.extensionsResource}async switchExtensionsProfile(e,t,o){let n=await this.remoteUserDataProfilesService.getRemoteProfiles(),r=n.find(l=>this.uriIdentityService.extUri.isEqual(l.extensionsResource,e)),s=n.find(l=>this.uriIdentityService.extUri.isEqual(l.extensionsResource,t));return r?.id===s?.id?{added:[],removed:[]}:super.switchExtensionsProfile(e,t,o)}};sje=I([m(1,Ze),m(2,Mm),m(3,gn),m(4,hn),m(5,jN),m(6,gt)],sje);var aje=class extends sje{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,o,h,n,r,s,l);this.localExtensionManagementServer=t;this.logService=c;this.galleryService=u;this.configurationService=p;this.fileService=g;this.extensionManifestPropertiesService=f}async install(e,t){let o=await super.install(e,t);return await this.installUIDependenciesAndPackedExtensions(o),o}async installFromGallery(e,t={}){if(bn(t.donotVerifySignature)){let n=this.configurationService.getValue(JTe);t.donotVerifySignature=Xa(n)?!n:void 0}let o=await this.doInstallFromGallery(e,t);return await this.installUIDependenciesAndPackedExtensions(o),o}async doInstallFromGallery(e,t){if(t.downloadExtensionsLocally||this.configurationService.getValue("remote.downloadExtensionsLocally"))return this.downloadAndInstall(e,t);try{let o=await this.localExtensionManagementServer.extensionManagementService.getTargetPlatform();return await super.installFromGallery(e,{...t,context:{...t?.context,[_no]:o}})}catch(o){switch(o.name){case"Download":case"DownloadSignature":case"Gallery":case"Internal":case"Unknown":try{return this.logService.error(`Error while installing '${e.identifier.id}' extension in the remote server.`,Mn(o)),await this.downloadAndInstall(e,t)}catch(n){throw this.logService.error(n),n}default:throw this.logService.debug("Remote Install Error Name",o.name),o}}}async downloadAndInstall(e,t){this.logService.info(`Downloading the '${e.identifier.id}' extension locally and install`);let o=await this.checkAndGetCompatible(e,!!t.installPreReleaseVersion);t={...t,donotIncludePackAndDependencies:!0};let n=await this.getInstalled(1,void 0,t.productVersion),r=await this.getAllWorkspaceDependenciesAndPackedExtensions(o,Ie.None);if(r.length){this.logService.info(`Downloading the workspace dependencies and packed extensions of '${o.identifier.id}' locally and install`);for(let s of r)await this.downloadCompatibleAndInstall(s,n,t)}return await this.downloadCompatibleAndInstall(o,n,t)}async downloadCompatibleAndInstall(e,t,o){let n=await this.checkAndGetCompatible(e,!!o.installPreReleaseVersion);this.logService.trace("Downloading extension:",n.identifier.id);let r=await this.localExtensionManagementServer.extensionManagementService.download(n,t.filter(s=>Ht(s.identifier,n.identifier))[0]?3:2,!!o.donotVerifySignature);this.logService.info("Downloaded extension:",n.identifier.id,r.path);try{let s=await super.install(r,{...o,keepExisting:!0});return this.logService.info(`Successfully installed '${n.identifier.id}' extension`),s}finally{try{await this.fileService.del(r)}catch(s){this.logService.error(s)}}}async checkAndGetCompatible(e,t){let o=await this.getTargetPlatform(),n=null;if(e.hasPreReleaseVersion&&e.properties.isPreReleaseVersion!==t&&(n=(await this.galleryService.getExtensions([{...e.identifier,preRelease:t}],{targetPlatform:o,compatible:!0},Ie.None))[0]||null),!n&&await this.galleryService.isExtensionCompatible(e,t,o)&&(n=e),n||(n=await this.galleryService.getCompatibleExtension(e,t,o)),!n){let r=[];throw iQ(e.properties.enabledApiProposals??[],r)?!t&&e.properties.isPreReleaseVersion&&(await this.galleryService.getExtensions([e.identifier],Ie.None))[0]?new qh(d(18935,null,e.identifier.id),"ReleaseVersionNotFound"):new qh(d(18934,null,e.identifier.id,this.productService.nameLong,this.productService.version),"Incompatible"):new qh(d(18933,null,e.displayName??e.identifier.id,r[0]),"IncompatibleApi")}return n}async installUIDependenciesAndPackedExtensions(e){let t=await this.getAllUIDependenciesAndPackedExtensions(e.manifest,Ie.None),o=await this.localExtensionManagementServer.extensionManagementService.getInstalled(),n=t.filter(r=>o.every(s=>!Ht(s.identifier,r.identifier)));n.length&&(this.logService.info(`Installing UI dependencies and packed extensions of '${e.identifier.id}' locally`),await vn.settled(n.map(r=>this.localExtensionManagementServer.extensionManagementService.installFromGallery(r))))}async getAllUIDependenciesAndPackedExtensions(e,t){let o=new Map,n=[...e.extensionPack||[],...e.extensionDependencies||[]];return await this.getDependenciesAndPackedExtensionsRecursively(n,o,!0,t),[...o.values()]}async getAllWorkspaceDependenciesAndPackedExtensions(e,t){let o=new Map;o.set(e.identifier.id.toLowerCase(),e);let n=await this.galleryService.getManifest(e,t);if(n){let r=[...n.extensionPack||[],...n.extensionDependencies||[]];await this.getDependenciesAndPackedExtensionsRecursively(r,o,!1,t)}return o.delete(e.identifier.id),[...o.values()]}async getDependenciesAndPackedExtensionsRecursively(e,t,o,n){if(e.length===0)return Promise.resolve();let r=await this.galleryService.getExtensions(e.map(c=>({id:c})),n),s=await Promise.all(r.map(c=>this.galleryService.getManifest(c,n))),l=[];for(let c=0;c<r.length;c++){let u=r[c],p=s[c];p&&this.extensionManifestPropertiesService.prefersExecuteOnUI(p)===o&&(t.set(u.identifier.id.toLowerCase(),u),l.push(p))}e=[];for(let c of l){if(Rr(c.extensionDependencies))for(let u of c.extensionDependencies)t.has(u.toLowerCase())||e.push(u);if(Rr(c.extensionPack))for(let u of c.extensionPack)t.has(u.toLowerCase())||e.push(u)}return this.getDependenciesAndPackedExtensionsRecursively(e,t,o,n)}};aje=I([m(2,Ze),m(3,gn),m(4,hn),m(5,jN),m(6,gt),m(7,re),m(8,ga),m(9,B),m(10,Mm),m(11,ge),m(12,hm)],aje);var lje=class extends rje{constructor(e,t,o,n,r,s,l,c,u){super(e,t,o,n,r);this.fileService=s;this.downloadService=l;this.nativeEnvironmentService=c;this.logService=u}filterEvent(e,t){return t||this.uriIdentityService.extUri.isEqual(this.userDataProfileService.currentProfile.extensionsResource,e)}async install(e,t){let{location:o,cleanup:n}=await this.downloadVsix(e);try{return await super.install(o,t)}finally{await n()}}async downloadVsix(e){if(e.scheme===Q.file)return{location:e,async cleanup(){}};this.logService.trace("Downloading extension from",e.toString());let t=Ve(this.nativeEnvironmentService.extensionsDownloadLocation,ht());return await this.downloadService.download(e,t,"extensionManagement.downloadNativeVsix"),this.logService.info("Downloaded extension to",t.toString()),{location:t,cleanup:async()=>{try{await this.fileService.del(t)}catch(n){this.logService.error(n)}}}}async switchExtensionsProfile(e,t,o){if(this.nativeEnvironmentService.remoteAuthority){let r=(await this.getInstalled(1,e)).find(s=>XEe(s.manifest,this.nativeEnvironmentService.remoteAuthority));r&&(o||(o=[]),o.push(new hi(r.identifier.id)))}return super.switchExtensionsProfile(e,t,o)}};lje=I([m(1,Ze),m(2,Mm),m(3,gn),m(4,gt),m(5,ge),m(6,aW),m(7,Jr),m(8,re)],lje);var Wgt=class extends k{constructor(e,t,o,n){super();this.remoteExtensionManagementServer=null;this.webExtensionManagementServer=null;let r=this._register(n.createInstance(lje,e.getChannel("extensions")));this.localExtensionManagementServer={extensionManagementService:r,id:"local",label:d(18931,null)};let s=t.getConnection();if(s){let l=n.createInstance(aje,s.getChannel("extensions"),this.localExtensionManagementServer);this.remoteExtensionManagementServer={id:"remote",extensionManagementService:l,get label(){return o.getHostLabel(Q.vscodeRemote,s.remoteAuthority)||d(18932,null)}}}}getExtensionManagementServer(e){if(e.location.scheme===Q.file)return this.localExtensionManagementServer;if(this.remoteExtensionManagementServer&&e.location.scheme===Q.vscodeRemote)return this.remoteExtensionManagementServer;throw new Error(`Invalid Extension ${e.location}`)}getExtensionInstallLocation(e){return this.getExtensionManagementServer(e)===this.remoteExtensionManagementServer?2:1}};Wgt=I([m(0,kS),m(1,bo),m(2,nt),m(3,F)],Wgt);Ce($c,Wgt,1);var cje=class extends k{constructor(e){super();this.productService=e;this.onDidChangeExtensionGalleryManifest=U.None;this.onDidChangeExtensionGalleryManifestStatus=U.None}get extensionGalleryManifestStatus(){return this.productService.extensionsGallery?.serviceUrl?"available":"unavailable"}async getExtensionGalleryManifest(){let e=this.productService.extensionsGallery;if(!e?.serviceUrl)return null;let t=[{id:`${e.serviceUrl}/extensionquery`,type:"ExtensionQueryService"},{id:`${e.serviceUrl}/vscode/{publisher}/{name}/latest`,type:"ExtensionLatestVersionUriTemplate"},{id:`${e.serviceUrl}/publishers/{publisher}/extensions/{name}/{version}/stats?statType={statTypeName}`,type:"ExtensionStatisticsUriTemplate"}];e.publisherUrl&&t.push({id:`${e.publisherUrl}/{publisher}`,type:"PublisherViewUriTemplate"}),e.itemUrl&&(t.push({id:`${e.itemUrl}?itemName={publisher}.{name}`,type:"ExtensionDetailsViewUriTemplate"}),t.push({id:`${e.itemUrl}?itemName={publisher}.{name}&ssr=false#review-details`,type:"ExtensionRatingViewUriTemplate"})),e.resourceUrlTemplate&&t.push({id:e.resourceUrlTemplate,type:"ExtensionResourceUriTemplate"});let o=[{name:"Tag",value:1},{name:"ExtensionId",value:4},{name:"Category",value:5},{name:"ExtensionName",value:7},{name:"Target",value:8},{name:"Featured",value:9},{name:"SearchText",value:10},{name:"ExcludeWithFlags",value:12}],n=[{name:"NoneOrRelevance",value:0},{name:"LastUpdatedDate",value:1},{name:"Title",value:2},{name:"PublisherName",value:3},{name:"InstallCount",value:4},{name:"AverageRating",value:6},{name:"PublishedDate",value:10},{name:"WeightedRating",value:12}],r=[{name:"None",value:0},{name:"IncludeVersions",value:1},{name:"IncludeFiles",value:2},{name:"IncludeCategoryAndTags",value:4},{name:"IncludeSharedAccounts",value:8},{name:"IncludeVersionProperties",value:16},{name:"ExcludeNonValidated",value:32},{name:"IncludeInstallationTargets",value:64},{name:"IncludeAssetUri",value:128},{name:"IncludeStatistics",value:256},{name:"IncludeLatestVersionOnly",value:512},{name:"Unpublished",value:4096},{name:"IncludeNameConflictInfo",value:32768},{name:"IncludeLatestPrereleaseAndStableVersionOnly",value:65536}];return{version:"",resources:t,capabilities:{extensionQuery:{filtering:o,sorting:n,flags:r},signing:{allPublicRepositorySigned:!0}}}}};cje=I([m(0,Ze)],cje);var Vgt=class extends cje{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e);this.telemetryService=n;this.configurationService=c;this.requestService=u;this.defaultAccountService=p;this.logService=h;this.dialogService=g;this.hostService=f;this.extensionGalleryManifest=null;this._onDidChangeExtensionGalleryManifest=this._register(new T);this.onDidChangeExtensionGalleryManifest=this._onDidChangeExtensionGalleryManifest.event;this.currentStatus="unavailable";this._onDidChangeExtensionGalleryManifestStatus=this._register(new T);this.onDidChangeExtensionGalleryManifestStatus=this._onDidChangeExtensionGalleryManifestStatus.event;this.commonHeadersPromise=n1t(e.version,e,t,c,o,r,n);let v=[l.getChannel("extensionGalleryManifest")],b=s.getConnection();b&&v.push(b.getChannel("extensionGalleryManifest")),this.getExtensionGalleryManifest().then(S=>{v.forEach(y=>y.call("setExtensionGalleryManifest",[S]))})}get extensionGalleryManifestStatus(){return this.currentStatus}async getExtensionGalleryManifest(){return this.extensionGalleryManifestPromise||(this.extensionGalleryManifestPromise=this.doGetExtensionGalleryManifest()),await this.extensionGalleryManifestPromise,this.extensionGalleryManifest}async doGetExtensionGalleryManifest(){if(!this.productService.extensionsGallery?.serviceUrl)return;let t=this.configurationService.getValue(I7e);if(t)await this.handleDefaultAccountAccess(t),this._register(this.defaultAccountService.onDidChangeDefaultAccount(()=>this.handleDefaultAccountAccess(t)));else{let o=await super.getExtensionGalleryManifest();this.update(o)}this._register(this.configurationService.onDidChangeConfiguration(o=>{o.affectsConfiguration(I7e)&&this.requestRestart()}))}async handleDefaultAccountAccess(e){let t=await this.defaultAccountService.getDefaultAccount();if(!t)this.logService.debug("[Marketplace] Enterprise marketplace configured but user not signed in"),this.update(null,"requiresSignIn");else if(!this.checkAccess(t))this.logService.debug("[Marketplace] User signed in but lacks access to enterprise marketplace"),this.update(null,"accessDenied");else if(this.currentStatus!=="available")try{let o=await this.getExtensionGalleryManifestFromServiceUrl(e);this.update(o),this.telemetryService.publicLog2("galleryservice:custom:marketplace")}catch(o){this.logService.error("[Marketplace] Error retrieving enterprise gallery manifest",o),this.update(null,"accessDenied")}}update(e,t){this.extensionGalleryManifest!==e&&(this.extensionGalleryManifest=e,this._onDidChangeExtensionGalleryManifest.fire(e)),this.updateStatus(t??(this.extensionGalleryManifest?"available":"unavailable"))}updateStatus(e){this.currentStatus!==e&&(this.currentStatus=e,this._onDidChangeExtensionGalleryManifestStatus.fire(e))}checkAccess(e){return this.logService.debug("[Marketplace] Checking Account SKU access for configured gallery",e.entitlementsData?.access_type_sku),e.entitlementsData?.access_type_sku&&this.productService.extensionsGallery?.accessSKUs?.includes(e.entitlementsData.access_type_sku)?(this.logService.debug("[Marketplace] Account has access to configured gallery"),!0):(this.logService.debug("[Marketplace] Checking enterprise account access for configured gallery",e.enterprise),e.enterprise)}async requestRestart(){if((await this.dialogService.confirm({message:d(18929,null,this.productService.nameLong),primaryButton:d(18930,null)})).confirmed)return this.hostService.restart()}async getExtensionGalleryManifestFromServiceUrl(e){let o={...await this.commonHeadersPromise,"Content-Type":"application/json","Accept-Encoding":"gzip"};try{let n=await this.requestService.request({type:"GET",url:e,headers:o,callSite:"extensionGalleryManifestService.fetchManifest"},Ie.None),r=await Th(n);if(!r)throw new Error("Unable to retrieve extension gallery manifest.");return r}catch(n){throw this.logService.error("[Marketplace] Error retrieving extension gallery manifest",n),n}}};Vgt=I([m(0,Ze),m(1,ko),m(2,ge),m(3,_e),m(4,de),m(5,bo),m(6,kS),m(7,B),m(8,Ra),m(9,Nd),m(10,re),m(11,ct),m(12,ti)],Vgt);Ce(tb,Vgt,0);var dje=class extends k{constructor(e,t){super();this.fileService=e;this.productService=t;this.allConfigBasedTips=new Map;this.productService.configBasedExtensionTips&&Object.entries(this.productService.configBasedExtensionTips).forEach(([,o])=>this.allConfigBasedTips.set(o.configPath,o))}getConfigBasedTips(e){return this.getValidConfigBasedTips(e)}async getImportantExecutableBasedTips(){return[]}async getOtherExecutableBasedTips(){return[]}async getValidConfigBasedTips(e){let t=[];for(let[o,n]of this.allConfigBasedTips)if(!(n.configScheme&&n.configScheme!==e.scheme))try{let r=(await this.fileService.readFile(Ve(e,o))).value.toString();for(let[s,l]of Object.entries(n.recommendations))(!l.contentPattern||new RegExp(l.contentPattern,"mig").test(r))&&t.push({extensionId:s,extensionName:l.name,configName:n.configName,important:!!l.important,isExtensionPack:!!l.isExtensionPack,whenNotInstalled:l.whenNotInstalled})}catch{}return t}};dje=I([m(0,ge),m(1,Ze)],dje);var Bgt=class extends dje{constructor(i,e,t){super(i,e),this.channel=t.getChannel("extensionTipsService")}getConfigBasedTips(i){return i.scheme===Q.file?this.channel.call("getConfigBasedTips",[i]):super.getConfigBasedTips(i)}getImportantExecutableBasedTips(){return this.channel.call("getImportantExecutableBasedTips")}getOtherExecutableBasedTips(){return this.channel.call("getOtherExecutableBasedTips")}};Bgt=I([m(0,ge),m(1,Ze),m(2,kS)],Bgt);Ce(XTe,Bgt,1);var uje=class extends k{constructor(e,t){super();this.userDataProfilesService=t;this._status="uninitialized";this._onDidChangeStatus=this._register(new T);this.onDidChangeStatus=this._onDidChangeStatus.event;this._conflicts=[];this._onDidChangeConflicts=this._register(new T);this.onDidChangeConflicts=this._onDidChangeConflicts.event;this._lastSyncTime=void 0;this._onDidChangeLastSyncTime=this._register(new T);this.onDidChangeLastSyncTime=this._onDidChangeLastSyncTime.event;this._onSyncErrors=this._register(new T);this.onSyncErrors=this._onSyncErrors.event;this.channel={call(o,n,r){return e.call(o,n,r).then(null,s=>{throw Cf.toUserDataSyncError(s)})},listen(o,n){return e.listen(o,n)}},this.channel.call("_getInitialData").then(([o,n,r])=>{this.updateStatus(o),this.updateConflicts(n),r&&this.updateLastSyncTime(r),this._register(this.channel.listen("onDidChangeStatus")(s=>this.updateStatus(s))),this._register(this.channel.listen("onDidChangeLastSyncTime")(s=>this.updateLastSyncTime(s)))}),this._register(this.channel.listen("onDidChangeConflicts")(o=>this.updateConflicts(o))),this._register(this.channel.listen("onSyncErrors")(o=>this._onSyncErrors.fire(o.map(n=>({...n,error:Cf.toUserDataSyncError(n.error)})))))}get status(){return this._status}get onDidChangeLocal(){return this.channel.listen("onDidChangeLocal")}get conflicts(){return this._conflicts}get lastSyncTime(){return this._lastSyncTime}get onDidResetLocal(){return this.channel.listen("onDidResetLocal")}get onDidResetRemote(){return this.channel.listen("onDidResetRemote")}createSyncTask(){throw new Error("not supported")}async createManualSyncTask(){let e=await this.channel.call("createManualSyncTask"),t=this;return new gji(e,{async call(n,r,s){return t.channel.call(`manualSync/${n}`,[e,...Array.isArray(r)?r:[r]],s)},listen(){throw new Error("not supported")}})}reset(){return this.channel.call("reset")}resetRemote(){return this.channel.call("resetRemote")}resetLocal(){return this.channel.call("resetLocal")}hasPreviouslySynced(){return this.channel.call("hasPreviouslySynced")}hasLocalData(){return this.channel.call("hasLocalData")}accept(e,t,o,n){return this.channel.call("accept",[e,t,o,n])}resolveContent(e){return this.channel.call("resolveContent",[e])}cleanUpRemoteData(){return this.channel.call("cleanUpRemoteData")}replace(e){return this.channel.call("replace",[e])}saveRemoteActivityData(e){return this.channel.call("getRemoteActivityData",[e])}extractActivityData(e,t){return this.channel.call("extractActivityData",[e,t])}async updateStatus(e){this._status=e,this._onDidChangeStatus.fire(e)}async updateConflicts(e){this._conflicts=e.map(t=>({syncResource:t.syncResource,profile:iC(t.profile,this.userDataProfilesService.profilesHome.scheme),conflicts:t.conflicts.map(o=>({...o,baseResource:A.revive(o.baseResource),localResource:A.revive(o.localResource),remoteResource:A.revive(o.remoteResource),previewResource:A.revive(o.previewResource)}))})),this._onDidChangeConflicts.fire(this._conflicts)}updateLastSyncTime(e){this._lastSyncTime!==e&&(this._lastSyncTime=e,this._onDidChangeLastSyncTime.fire(e))}};uje=I([m(1,hn)],uje);var gji=class extends k{constructor(e,t){super();this.id=e;this.channel=t}async merge(){return this.channel.call("merge")}async apply(){return this.channel.call("apply")}stop(){return this.channel.call("stop")}dispose(){this.channel.call("dispose"),super.dispose()}};var rei=class extends k{constructor(e){super();this.channel=e;this._onDidChangeAccount=this._register(new T);this.onDidChangeAccount=this._onDidChangeAccount.event;this.channel.call("_getInitialData").then(t=>{this._account=t,this._register(this.channel.listen("onDidChangeAccount")(o=>{this._account=o,this._onDidChangeAccount.fire(o)}))})}get account(){return this._account}get onTokenFailed(){return this.channel.listen("onTokenFailed")}updateAccount(e){return this.channel.call("updateAccount",e)}};var pje=class extends fge{constructor(e,t,o,n){super(t,o,n);this.channel=e;this._register(this.channel.listen("onDidChangeUserDataSyncStore")(()=>this.updateUserDataSyncStore()))}async switch(e){return this.channel.call("switch",[e])}async getPreviousUserDataSyncStore(){let e=await this.channel.call("getPreviousUserDataSyncStore");return this.revive(e)}revive(e){return{url:A.revive(e.url),type:e.type,defaultUrl:A.revive(e.defaultUrl),insidersUrl:A.revive(e.insidersUrl),stableUrl:A.revive(e.stableUrl),canSwitch:e.canSwitch,authenticationProviders:e.authenticationProviders}}};pje=I([m(1,Ze),m(2,B),m(3,de)],pje);lv(ny,"userDataSync",{channelClientCtor:uje});lv(cAe,"IUserDataSyncResourceProviderService");lv(mie,"userDataSyncMachines");lv(dAe,"userDataSyncAccount",{channelClientCtor:rei});lv(uP,"userDataSyncStoreManagement",{channelClientCtor:pje});var Hgt=class{get onError(){return U.map(this.channel.listen("onError"),i=>Cf.toUserDataSyncError(i))}constructor(i){this.channel=i.getChannel("userDataAutoSync")}triggerSync(i,e){return this.channel.call("triggerSync",[i,e])}turnOn(){return this.channel.call("turnOn")}turnOff(i){return this.channel.call("turnOff",[i])}};Hgt=I([m(0,kS)],Hgt);Ce(T_,Hgt,1);var zgt=class extends mRe{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(o,n,r,s,l,c,u,p,h);this._nativeHostService=e;this._environmentService=t;this._productService=g;this._storageService=f;this.setPerformanceMarks("main",t.window.perfMarks)}_isInitialStartup(){return!!this._environmentService.window.isInitialStartup}_didUseCachedData(){return iPn(this._productService,this._storageService,this._environmentService)}_getWindowCount(){return this._nativeHostService.getWindowCount()}async _extendStartupInfo(e){try{let[t,o,n,r]=await Promise.all([this._nativeHostService.getOSProperties(),this._nativeHostService.getOSStatistics(),this._nativeHostService.getOSVirtualMachineHint(),this._nativeHostService.isRunningUnderARM64Translation()]);e.totalmem=o.totalmem,e.freemem=o.freemem,e.platform=t.platform,e.release=t.release,e.arch=t.arch,e.loadavg=o.loadavg,e.isARM64Emulated=r;let s=await JE.getProcessMemoryInfo();e.meminfo={workingSetSize:s.residentSet,privateBytes:s.private,sharedBytes:s.shared},e.isVMLikelyhood=Math.round(n*100);let l=t.cpus;l&&l.length>0&&(e.cpus={count:l.length,speed:l[0].speed,model:l[0].model})}catch{}}_shouldReportPerfMarks(){return super._shouldReportPerfMarks()||!!this._environmentService.args["prof-append-timers"]}};zgt=I([m(0,wo),m(1,Jr),m(2,to),m(3,Ae),m(4,lt),m(5,Lp),m(6,Es),m(7,ie),m(8,Ai),m(9,_e),m(10,wi),m(11,Ze),m(12,de)],zgt);Ce(Kx,zgt,1);var hHo="perf/lastRunningCommit",Ugt;function iPn(a,i,e){return typeof Ugt!="boolean"&&(!e.window.isCodeCaching||!a.commit?Ugt=!1:i.get(hHo,-1)===a.commit?Ugt=!0:(i.store(hHo,a.commit,-1,1),Ugt=!1)),Ugt}var sei=le("checksumService");var fji=class a{constructor(i){this.storageService=i;this.value=this._read()}static{this.KEY="integrityService"}_read(){let i=this.storageService.get(a.KEY,-1);if(!i)return null;try{return JSON.parse(i)}catch{return null}}get(){return this.value}set(i){this.value=i,this.storageService.store(a.KEY,JSON.stringify(this.value),-1,1)}},jae=class{constructor(i,e,t,o,n,r,s){this.notificationService=i;this.lifecycleService=t;this.openerService=o;this.productService=n;this.checksumService=r;this.logService=s;this.storage=new fji(e),this.isPurePromise=this._isPure(),this._compute()}isPure(){return this.isPurePromise}async _compute(){let{isPure:i}=await this.isPure();if(i)return;this.logService.warn(`

----------------------------------------------
***	Installation has been modified on disk ***
----------------------------------------------

`);let e=this.storage.get();e?.dontShowPrompt&&e.commit===this.productService.commit||this._showNotification()}async _isPure(){let i=this.productService.checksums||{};await this.lifecycleService.when(4);let e=await Promise.all(Object.keys(i).map(o=>this._resolve(o,i[o]))),t=!0;for(let o=0,n=e.length;o<n;o++)if(!e[o].isPure){t=!1;break}return{isPure:t,proof:e}}async _resolve(i,e){let t=In.asFileUri(i);try{let o=await this.checksumService.checksum(t);return jae._createChecksumPair(t,o,e)}catch{return jae._createChecksumPair(t,"",e)}}static _createChecksumPair(i,e,t){return{uri:i,actual:e,expected:t,isPure:e===t}}_showNotification(){let i=this.productService.checksumFailMoreInfoUrl,e=d(19098,null,this.productService.nameShort);i?this.notificationService.prompt(wt.Warning,e,[{label:d(19097,null),run:()=>this.openerService.open(A.parse(i))},{label:d(19096,null),isSecondary:!0,run:()=>this.storage.set({dontShowPrompt:!0,commit:this.productService.commit})}],{sticky:!0,priority:3}):this.notificationService.notify({severity:wt.Warning,message:e,sticky:!0,priority:3})}};jae=I([m(0,Ne),m(1,de),m(2,to),m(3,Je),m(4,Ze),m(5,sei),m(6,re)],jae);Ce(p$e,jae,1);var aei=class a extends k{constructor(e,t,o,n,r,s,l){super();this.workingCopyBackupService=e;this.workingCopyService=t;this.logService=o;this.lifecycleService=n;this.filesConfigurationService=r;this.workingCopyEditorService=s;this.editorService=l;this.mapWorkingCopyToContentVersion=new Map;this.pendingBackupOperations=new Map;this.suspended=!1;this.unrestoredBackups=new Set;this._isReady=!1;this.whenReady=this.resolveBackupsToRestore();for(let c of this.workingCopyService.modifiedWorkingCopies)this.onDidRegister(c);this.registerListeners()}registerListeners(){this._register(this.workingCopyService.onDidRegister(e=>this.onDidRegister(e))),this._register(this.workingCopyService.onDidUnregister(e=>this.onDidUnregister(e))),this._register(this.workingCopyService.onDidChangeDirty(e=>this.onDidChangeDirty(e))),this._register(this.workingCopyService.onDidChangeContent(e=>this.onDidChangeContent(e))),this._register(this.lifecycleService.onBeforeShutdown(e=>e.finalVeto(()=>this.onFinalBeforeShutdown(e.reason),"veto.backups"))),this._register(this.lifecycleService.onWillShutdown(()=>this.onWillShutdown())),this._register(this.workingCopyEditorService.onDidRegisterHandler(e=>this.restoreBackups(e)))}onWillShutdown(){this.cancelBackupOperations(),this.suspendBackupOperations()}static{this.DEFAULT_BACKUP_SCHEDULE_DELAYS={default:1e3,delayed:2e3}}onDidRegister(e){if(this.suspended){this.logService.warn("[backup tracker] suspended, ignoring register event",e.resource.toString(),e.typeId);return}e.isModified()&&this.scheduleBackup(e)}onDidUnregister(e){if(this.mapWorkingCopyToContentVersion.delete(e),this.suspended){this.logService.warn("[backup tracker] suspended, ignoring unregister event",e.resource.toString(),e.typeId);return}this.discardBackup(e)}onDidChangeDirty(e){if(this.suspended){this.logService.warn("[backup tracker] suspended, ignoring dirty change event",e.resource.toString(),e.typeId);return}e.isDirty()?this.scheduleBackup(e):this.discardBackup(e)}onDidChangeContent(e){let t=this.getContentVersion(e);if(this.mapWorkingCopyToContentVersion.set(e,t+1),this.suspended){this.logService.warn("[backup tracker] suspended, ignoring content change event",e.resource.toString(),e.typeId);return}e.isModified()&&this.scheduleBackup(e)}scheduleBackup(e){this.cancelBackupOperation(e),this.logService.trace("[backup tracker] scheduling backup",e.resource.toString(),e.typeId);let t={resource:e.resource,typeId:e.typeId},o=new qe,n=setTimeout(async()=>{if(!o.token.isCancellationRequested){if(e.isModified()){this.logService.trace("[backup tracker] creating backup",e.resource.toString(),e.typeId);try{let r=await e.backup(o.token);if(o.token.isCancellationRequested)return;e.isModified()&&(this.logService.trace("[backup tracker] storing backup",e.resource.toString(),e.typeId),await this.workingCopyBackupService.backup(e,r.content,this.getContentVersion(e),r.meta,o.token))}catch(r){this.logService.error(r)}}o.token.isCancellationRequested||this.doClearPendingBackupOperation(t)}},this.getBackupScheduleDelay(e));this.pendingBackupOperations.set(t,{cancel:()=>{this.logService.trace("[backup tracker] clearing pending backup creation",e.resource.toString(),e.typeId),o.cancel()},disposable:ee(()=>{o.dispose(),clearTimeout(n)})})}getBackupScheduleDelay(e){if(typeof e.backupDelay=="number")return e.backupDelay;let t;return e.capabilities&2?t="default":t=this.filesConfigurationService.hasShortAutoSaveDelay(e.resource)?"delayed":"default",a.DEFAULT_BACKUP_SCHEDULE_DELAYS[t]}getContentVersion(e){return this.mapWorkingCopyToContentVersion.get(e)||0}discardBackup(e){this.cancelBackupOperation(e);let t={resource:e.resource,typeId:e.typeId},o=new qe;this.doDiscardBackup(t,o),this.pendingBackupOperations.set(t,{cancel:()=>{this.logService.trace("[backup tracker] clearing pending backup discard",e.resource.toString(),e.typeId),o.cancel()},disposable:o})}async doDiscardBackup(e,t){this.logService.trace("[backup tracker] discarding backup",e.resource.toString(),e.typeId);try{await this.workingCopyBackupService.discardBackup(e,t.token)}catch(o){this.logService.error(o)}t.token.isCancellationRequested||this.doClearPendingBackupOperation(e)}cancelBackupOperation(e){let t;for(let[o]of this.pendingBackupOperations)if(o.resource.toString()===e.resource.toString()&&o.typeId===e.typeId){t=o;break}t&&this.doClearPendingBackupOperation(t,{cancel:!0})}doClearPendingBackupOperation(e,t){let o=this.pendingBackupOperations.get(e);o&&(t?.cancel&&o.cancel(),o.disposable.dispose(),this.pendingBackupOperations.delete(e))}cancelBackupOperations(){for(let[,e]of this.pendingBackupOperations)e.cancel(),e.disposable.dispose();this.pendingBackupOperations.clear()}suspendBackupOperations(){return this.suspended=!0,{resume:()=>this.suspended=!1}}get isReady(){return this._isReady}async resolveBackupsToRestore(){await this.lifecycleService.when(3);for(let e of await this.workingCopyBackupService.getBackups())this.unrestoredBackups.add(e);this._isReady=!0}async restoreBackups(e){await this.whenReady;let t=new Set,o=new Set,n=new Set;for(let r of this.unrestoredBackups){if(!await e.handles(r))continue;let l=!1;for(let{editor:c}of this.editorService.getEditors(0))e.isOpen(r,c)&&(t.add(c),l=!0);l||o.add(await e.createEditor(r)),n.add(r)}if(o.size>0){await this.editorService.openEditors([...o].map(r=>({editor:r,options:{pinned:!0,preserveFocus:!0,inactive:!0}})));for(let r of o)t.add(r)}await vn.settled([...t].map(async r=>{if(!this.editorService.isVisible(r))return r.resolve()}));for(let r of n)this.unrestoredBackups.delete(r)}};var pye=class extends aei{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,o,u,n,t,g,f);this.fileDialogService=r;this.dialogService=s;this.contextService=l;this.nativeHostService=c;this.environmentService=p;this.progressService=h}static{this.ID="workbench.contrib.nativeWorkingCopyBackupTracker"}async onFinalBeforeShutdown(e){this.cancelBackupOperations();let{resume:t}=this.suspendBackupOperations();try{let o=this.workingCopyService.modifiedWorkingCopies;return o.length?await this.onBeforeShutdownWithModified(e,o):await this.onBeforeShutdownWithoutModified()}finally{t()}}async onBeforeShutdownWithModified(e,t){let o=t.filter(n=>!(n.capabilities&2)&&this.filesConfigurationService.getAutoSaveMode(n.resource).mode!==0);if(o.length>0){try{await this.doSaveAllBeforeShutdown(o,2)}catch(r){this.logService.error(`[backup tracker] error saving modified working copies: ${r}`)}let n=this.workingCopyService.modifiedWorkingCopies;return n.length?this.handleModifiedBeforeShutdown(n,e):this.noVeto([...t])}return this.handleModifiedBeforeShutdown(t,e)}async handleModifiedBeforeShutdown(e,t){let o=[],n,r=await this.shouldBackupBeforeShutdown(t,e);if(r.length>0)try{let l=await this.backupBeforeShutdown(r);if(o=l.backups,n=l.error,o.length===e.length)return!1}catch(l){n=l}let s=e.filter(l=>!o.includes(l));if(n)return this.environmentService.isExtensionDevelopment?(this.logService.error(`[backup tracker] error creating backups: ${n}`),!1):this.showErrorDialog(d(19672,null),s,n,t);try{return await this.confirmBeforeShutdown(s)}catch(l){return this.environmentService.isExtensionDevelopment?(this.logService.error(`[backup tracker] error saving or reverting modified working copies: ${l}`),!1):this.showErrorDialog(d(19673,null),s,l,t)}}async shouldBackupBeforeShutdown(e,t){if(!this.filesConfigurationService.isHotExitEnabled)return[];if(this.environmentService.isExtensionDevelopment)return t;switch(e){case 1:return this.contextService.getWorkbenchState()!==1&&this.filesConfigurationService.hotExitConfiguration===PI.ON_EXIT_AND_WINDOW_CLOSE?t:et||await this.nativeHostService.getWindowCount()>1?this.contextService.getWorkbenchState()!==1?t.filter(o=>o.capabilities&4):[]:t;case 2:return t;case 3:return t;case 4:return this.contextService.getWorkbenchState()!==1?this.filesConfigurationService.hotExitConfiguration===PI.ON_EXIT_AND_WINDOW_CLOSE?t:t.filter(o=>o.capabilities&4):[]}}async showErrorDialog(e,t,o,n){this.logService.error(`[backup tracker] ${e}: ${o}`);let r=t.filter(u=>u.isModified()),s=d(19671,null),l=r.length?`${fx(r.map(u=>u.name))}
${s}`:s,{result:c}=await this.dialogService.prompt({type:"error",message:e,detail:l,buttons:[{label:d(19675,null),run:()=>!0},{label:this.toForceShutdownLabel(n),run:()=>!1}]});return c??!0}toForceShutdownLabel(e){switch(e){case 1:case 4:return d(19678,null);case 2:return d(19679,null);case 3:return d(19680,null)}}async backupBeforeShutdown(e){let t=[],o;return await this.withProgressAndCancellation(async n=>{try{await vn.settled(e.map(async r=>{let s=this.getContentVersion(r);if(this.workingCopyBackupService.hasBackupSync(r,s))t.push(r);else{let l=await r.backup(n);if(n.isCancellationRequested||(await this.workingCopyBackupService.backup(r,l.content,s,l.meta,n),n.isCancellationRequested))return;t.push(r)}}))}catch(r){o=r}},d(19670,null),d(19669,null)),{backups:t,error:o}}async confirmBeforeShutdown(e){let t=await this.fileDialogService.showSaveConfirm(e.map(o=>o.name));if(t===0){let o=this.workingCopyService.modifiedCount;try{await this.doSaveAllBeforeShutdown(e,1)}catch(r){this.logService.error(`[backup tracker] error saving modified working copies: ${r}`)}return o-this.workingCopyService.modifiedCount<e.length?!0:this.noVeto(e)}else if(t===1){try{await this.doRevertAllBeforeShutdown(e)}catch(o){this.logService.error(`[backup tracker] error reverting modified working copies: ${o}`)}return this.noVeto(e)}return!0}doSaveAllBeforeShutdown(e,t){return this.withProgressAndCancellation(async()=>{let o={skipSaveParticipants:!0,reason:t},n;e.length===this.workingCopyService.modifiedCount&&(n=(await this.editorService.saveAll({includeUntitled:{includeScratchpad:!0},...o})).success),n!==!1&&await vn.settled(e.map(r=>r.isModified()?r.save(o):Promise.resolve(!0)))},d(19677,null),void 0,e.some(o=>o.capabilities&2||o.capabilities&4)?10:20)}doRevertAllBeforeShutdown(e){return this.withProgressAndCancellation(async()=>{let t={soft:!0};e.length===this.workingCopyService.modifiedCount&&await this.editorService.revertAll(t),await vn.settled(e.map(o=>o.isModified()?o.revert(t):Promise.resolve()))},d(19676,null))}onBeforeShutdownWithoutModified(){return this.noVeto({except:this.contextService.getWorkbenchState()===1?[]:Array.from(this.unrestoredBackups)})}async noVeto(e){return await this.discardBackupsBeforeShutdown(e),!1}async discardBackupsBeforeShutdown(e){this.isReady&&await this.withProgressAndCancellation(async()=>{try{Array.isArray(e)?await vn.settled(e.map(t=>this.workingCopyBackupService.discardBackup(t))):await this.workingCopyBackupService.discardBackups(e)}catch(t){this.logService.error(`[backup tracker] error discarding backups: ${t}`)}},d(19674,null))}withProgressAndCancellation(e,t,o,n=20){let r=new qe;return this.progressService.withProgress({location:n,cancellable:!0,delay:800,title:t,detail:o},()=>Ea(e(r.token),r.token),()=>r.dispose(!0))}};pye=I([m(0,Om),m(1,fr),m(2,$a),m(3,to),m(4,nn),m(5,ct),m(6,Ae),m(7,wo),m(8,re),m(9,ko),m(10,Go),m(11,If),m(12,ie)],pye);var Kgt=class extends Kae{constructor(e,t,o,n){super(e.backupPath?A.file(e.backupPath).with({scheme:e.userRoamingDataHome.scheme}):void 0,t,o);this.lifecycleService=n;this.registerListeners()}registerListeners(){this._register(this.lifecycleService.onWillShutdown(e=>e.join(this.joinBackups(),{id:"join.workingCopyBackups",label:d(19668,null)})))}};Kgt=I([m(0,Jr),m(1,ge),m(2,re),m(3,to)],Kgt);Ce(Om,Kgt,0);bt(pye.ID,pye,vt.BlockStartup);lv(sei,"checksum");var Ggt=le("sharedProcessTunnelService"),gHo="sharedProcessTunnel";lv(Ggt,gHo);var qgt=class extends k{constructor(e,t,o,n,r,s,l,c,u){super();this._id=e;this._addressProvider=t;this.tunnelRemoteHost=o;this.tunnelRemotePort=n;this.tunnelLocalPort=r;this.localAddress=s;this._onBeforeDispose=l;this._sharedProcessTunnelService=c;this._remoteAuthorityResolverService=u;this.privacy="private";this.protocol=void 0;this._updateAddress(),this._register(this._remoteAuthorityResolverService.onDidChangeConnectionData(()=>this._updateAddress()))}_updateAddress(){this._addressProvider.getAddress().then(e=>{this._sharedProcessTunnelService.setAddress(this._id,e)})}async dispose(){this._onBeforeDispose(),super.dispose(),await this._sharedProcessTunnelService.destroyTunnel(this._id)}};qgt=I([m(7,Ggt),m(8,dd)],qgt);var $gt=class extends PLe{constructor(e,t,o,n,r,s,l){super(e,l);this._environmentService=t;this._sharedProcessTunnelService=o;this._instantiationService=n;this._nativeWorkbenchEnvironmentService=s;this._activeSharedProcessTunnels=new Set;this._register(r.onDidShutdown(()=>{this._activeSharedProcessTunnels.forEach(c=>{this._sharedProcessTunnelService.destroyTunnel(c)})}))}isPortPrivileged(e){return umo(e,this.defaultTunnelHost,Ao,this._nativeWorkbenchEnvironmentService.os.release)}retainOrCreateTunnel(e,t,o,n,r,s,l,c){let u=this.getTunnelFromMap(t,o);if(u)return++u.refcount,u.value;if(cmo(e))return this.createWithProvider(e,t,o,r,s,l,c);{this.logService.trace(`ForwardedPorts: (TunnelService) Creating tunnel without provider ${t}:${o} on local port ${r}.`);let p=this._createSharedProcessTunnel(e,t,o,n,r,s);return this.logService.trace("ForwardedPorts: (TunnelService) Tunnel created without provider."),this.addTunnelToMap(t,o,p),p}}async _createSharedProcessTunnel(e,t,o,n,r,s){let{id:l}=await this._sharedProcessTunnelService.createTunnel();this._activeSharedProcessTunnels.add(l);let c=this._environmentService.remoteAuthority,u=await this._sharedProcessTunnelService.startTunnel(c,l,t,o,n,r,s);return this._instantiationService.createInstance(qgt,l,e,t,o,u.tunnelLocalPort,u.localAddress,()=>{this._activeSharedProcessTunnels.delete(l)})}canTunnel(e){return super.canTunnel(e)&&!!this._environmentService.remoteAuthority}};$gt=I([m(0,re),m(1,Mt),m(2,Ggt),m(3,F),m(4,to),m(5,Jr),m(6,B)],$gt);Ce(Jp,$gt,1);lv(PAe,"diagnostics");var lei=le("IV8InspectProfilingService"),mje;(e=>{function a(t){return!!(t.samples&&t.timeDeltas)}e.isValidProfile=a;function i(t,o="noAbsolutePaths"){for(let n of t.nodes)n.callFrame&&n.callFrame.url&&(Jl(n.callFrame.url)||/^\w[\w\d+.-]*:\/\/\/?/.test(n.callFrame.url))&&(n.callFrame.url=td(o,Jo(n.callFrame.url)));return t}e.rewriteAbsolutePaths=i})(mje||={});lv(lei,"v8InspectProfiling");lv(Zbt,"customEndpointTelemetry");var cei=le("IRemoteTunnelService"),fHo={active:!1},oPn;(o=>(o.disconnected=n=>({type:"disconnected",onTokenFailed:n}),o.connected=(n,r)=>({type:"connected",info:n,serviceInstallFailed:r}),o.connecting=n=>({type:"connecting",progress:n}),o.uninitialized={type:"uninitialized"}))(oPn||={});var dei="remote.tunnels.access",vHo=dei+".hostNameOverride",bHo=dei+".preventSleep",uei="remoteTunnelService",SHo=d(2522,null);lv(cei,"remoteTunnel");var jgt=class{constructor(i,e,t,o,n){this.nativeHostService=i;this.fileService=e;this.environmentService=t;this.workspaceTrustRequestService=o;this.labelService=n}isSupported(i){return i.scheme===Q.file}async writeFileElevated(i,e,t){if(!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:ii?d(19081,null,this.labelService.getUriLabel(i)):d(19080,null,this.labelService.getUriLabel(i))}))throw new Error(d(19079,null));let n=A.file(hwe(this.environmentService.userDataPath,"code-elevated"));try{await this.fileService.writeFile(n,e,t),await this.nativeHostService.writeElevated(n,i,t)}finally{await this.fileService.del(n)}return this.fileService.resolve(i,{resolveMetadata:!0})}};jgt=I([m(0,wo),m(1,ge),m(2,Jr),m(3,lp),m(4,nt)],jgt);Ce(pW,jgt,1);var hje=class extends k{constructor(e,t,o,n,r,s,l){super();this.modelService=e;this.editorService=t;this.telemetryService=o;this.logService=n;this.extensionService=r;this.fileService=s;this.uriIdentityService=l;this.fileSearchProviders=new Map;this.textSearchProviders=new Map;this.aiTextSearchProviders=new Map;this.deferredFileSearchesByScheme=new Map;this.deferredTextSearchesByScheme=new Map;this.deferredAITextSearchesByScheme=new Map;this.loggedSchemesMissingProviders=new Set}registerSearchResultProvider(e,t,o){let n,r;if(t===0)n=this.fileSearchProviders,r=this.deferredFileSearchesByScheme;else if(t===1)n=this.textSearchProviders,r=this.deferredTextSearchesByScheme;else if(t===2)n=this.aiTextSearchProviders,r=this.deferredAITextSearchesByScheme;else throw new Error("Unknown SearchProviderType");return n.set(e,o),r.has(e)&&(r.get(e).complete(o),r.delete(e)),ee(()=>{n.delete(e)})}async textSearch(e,t,o){let n=this.textSearchSplitSyncAsync(e,t,o),r=n.syncResults,s=await n.asyncResults;return{limitHit:s.limitHit||r.limitHit,results:[...s.results,...r.results],messages:[...s.messages,...r.messages]}}async aiTextSearch(e,t,o){let n=r=>{o&&(ISi(r)||qPt(r),o(r)),ySi(r)&&this.logService.debug("SearchService#search",r.message)};return this.doSearch(e,t,n)}async getAIName(){return await this.getSearchProvider(3).get(Q.file)?.getAIName()}textSearchSplitSyncAsync(e,t,o,n,r){let s=this.getOpenEditorResults(e);return o&&ui([...s.results.values()]).filter(u=>!(n&&n.has(u.resource))).forEach(o),{syncResults:{results:ui([...s.results.values()]),limitHit:s.limitHit??!1,messages:[]},asyncResults:(async()=>{let u=await r??new xn,p=h=>{ISi(h)?!s.results.has(h.resource)&&!u.has(h.resource)&&o&&o(h):o&&o(h),ySi(h)&&this.logService.debug("SearchService#search",h.message)};return await this.doSearch(e,t,p)})()}}fileSearch(e,t){return this.doSearch(e,t)}schemeHasFileSearchProvider(e){return this.fileSearchProviders.has(e)}doSearch(e,t,o){this.logService.trace("SearchService#search",JSON.stringify(e));let n=this.getSchemesInQuery(e),r=[Promise.resolve(null)];n.forEach(l=>r.push(this.extensionService.activateByEvent(`onSearch:${l}`))),r.push(this.extensionService.activateByEvent("onSearch:file"));let s=(async()=>{if(await Promise.all(r),await this.extensionService.whenInstalledExtensionsRegistered(),t&&t.isCancellationRequested)return Promise.reject(new qi);let l=p=>{t&&t.isCancellationRequested||o?.(p)},c=await Promise.all(e.folderQueries.map(p=>this.fileService.exists(p.folder)));e.folderQueries=e.folderQueries.filter((p,h)=>c[h]);let u=await this.searchWithProviders(e,l,t);return u=ui(u),u.length?{limitHit:u[0]&&u[0].limitHit,stats:u[0].stats,messages:ui(u.flatMap(p=>p.messages)).filter(q4i(p=>p.type+p.text+p.trusted)),results:u.flatMap(p=>p.results),aiKeywords:u.flatMap(p=>p.aiKeywords).filter(p=>p!==void 0)}:{limitHit:!1,results:[],messages:[]}})();return t?Ym(s,t):s}getSchemesInQuery(e){let t=new Set;return e.folderQueries?.forEach(o=>t.add(o.folder.scheme)),e.extraFileResources?.forEach(o=>t.add(o.scheme)),t}async waitForProvider(e,t){let o=this.getDeferredTextSearchesByScheme(e);if(o.has(t))return o.get(t).p;{let n=new Mo;return o.set(t,n),n.p}}getSearchProvider(e){switch(e){case 1:return this.fileSearchProviders;case 2:return this.textSearchProviders;case 3:return this.aiTextSearchProviders;default:throw new Error(`Unknown query type: ${e}`)}}getDeferredTextSearchesByScheme(e){switch(e){case 1:return this.deferredFileSearchesByScheme;case 2:return this.deferredTextSearchesByScheme;case 3:return this.deferredAITextSearchesByScheme;default:throw new Error(`Unknown query type: ${e}`)}}async searchWithProviders(e,t,o){let n=On.create(!1),r=[],s=this.groupFolderQueriesByScheme(e),l=[...s.keys()].some(c=>this.getSearchProvider(e.type).has(c));return await Promise.all([...s.keys()].map(async c=>{if(e.onlyFileScheme&&c!==Q.file)return;let u=s.get(c),p=this.getSearchProvider(e.type).get(c);if(!p)if(l){this.loggedSchemesMissingProviders.has(c)||(this.logService.warn(`No search provider registered for scheme: ${c}. Another scheme has a provider, not waiting for ${c}`),this.loggedSchemesMissingProviders.add(c));return}else this.loggedSchemesMissingProviders.has(c)||(this.logService.warn(`No search provider registered for scheme: ${c}, waiting`),this.loggedSchemesMissingProviders.add(c)),p=await this.waitForProvider(e.type,c);let h={...e,folderQueries:u},g=()=>{switch(e.type){case 1:return p.fileSearch(h,o);case 2:return p.textSearch(h,t,o);default:return p.textSearch(h,t,o)}};r.push(g())})),Promise.all(r).then(c=>{let u=n.elapsed();return this.logService.trace(`SearchService#search: ${u}ms`),c.forEach(p=>{this.sendTelemetry(e,u,p)}),c},c=>{let u=n.elapsed();this.logService.trace(`SearchService#search: ${u}ms`);let p=Uao(c);throw this.logService.trace(`SearchService#searchError: ${p.message}`),this.sendTelemetry(e,u,void 0,p),p})}groupFolderQueriesByScheme(e){let t=new Map;return e.folderQueries.forEach(o=>{let n=t.get(o.folder.scheme)||[];n.push(o),t.set(o.folder.scheme,n)}),t}sendTelemetry(e,t,o,n){if(!L8i(5/100))return;let r=e.folderQueries.every(c=>c.folder.scheme===Q.file),s=e.folderQueries.every(c=>c.folder.scheme!==Q.file),l=r?Q.file:s?"other":"mixed";if(e.type===1&&o&&o.stats){let c=o.stats;if(c.fromCache){let u=c.detailStats;this.telemetryService.publicLog2("cachedSearchComplete",{reason:e._reason,resultCount:c.resultCount,workspaceFolderCount:e.folderQueries.length,endToEndTime:t,sortingTime:c.sortingTime,cacheWasResolved:u.cacheWasResolved,cacheLookupTime:u.cacheLookupTime,cacheFilterTime:u.cacheFilterTime,cacheEntryCount:u.cacheEntryCount,scheme:l})}else{let u=c.detailStats;this.telemetryService.publicLog2("searchComplete",{reason:e._reason,resultCount:c.resultCount,workspaceFolderCount:e.folderQueries.length,endToEndTime:t,sortingTime:c.sortingTime,fileWalkTime:u.fileWalkTime,directoriesWalked:u.directoriesWalked,filesWalked:u.filesWalked,cmdTime:u.cmdTime,cmdResultCount:u.cmdResultCount,scheme:l})}}else if(e.type===2){let c;n&&(c=n.code===2?"regex":n.code===1?"encoding":n.code===3?"glob":n.code===4?"literal":n.code===6?"other":n.code===7?"canceled":"unknown"),this.telemetryService.publicLog2("textSearchComplete",{reason:e._reason,workspaceFolderCount:e.folderQueries.length,endToEndTime:t,scheme:l,error:c})}}getOpenEditorResults(e){let t=new dt(n=>this.uriIdentityService.extUri.getComparisonKey(n)),o=!1;if(e.type===2){let n=new dt;for(let s of this.editorService.editors){let l=po.getCanonicalUri(s,{supportSideBySide:1}),c=po.getOriginalUri(s,{supportSideBySide:1});l&&n.set(l,c??l)}this.modelService.getModels().forEach(s=>{let l=s.uri;if(!l||o)return;let c=n.get(l);if(!c||s.getLanguageId()===U2&&!(e.includePattern&&e.includePattern["**/*.code-search"])||c.scheme!==Q.untitled&&!this.fileService.hasProvider(c)||c.scheme==="git"||!this.matches(c,e))return;let u=(on(e.maxResults)?e.maxResults:M3)+1,p=s.findMatches(e.contentPattern.pattern,!1,!!e.contentPattern.isRegExp,!!e.contentPattern.isCaseSensitive,e.contentPattern.isWordMatch?e.contentPattern.wordSeparators:null,!1,u);if(p.length){u&&p.length>=u&&(o=!0,p=p.slice(0,u-1));let h=new zPt(c);t.set(c,h);let g=m3t(p,s,e.previewOptions);h.results=GHe(g,s,e)}else t.set(c,null)})}return{results:t,limitHit:o}}matches(e,t){return Fpe(t,e.fsPath)}async clearCache(e){let t=Array.from(this.fileSearchProviders.values()).map(o=>o&&o.clearCache(e));await Promise.all(t)}};hje=I([m(0,_t),m(1,ie),m(2,_e),m(3,re),m(4,lt),m(5,ge),m(6,gt)],hje);Ce(Gg,hje,1);var nB=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.workingCopyService=e;this.workingCopyHistoryService=t;this.uriIdentityService=o;this.pathService=n;this.configurationService=r;this.undoRedoService=s;this.contextService=l;this.fileService=c;this.limiter=this._register(new _k(Pqe));this.resourceExcludeMatcher=this._register(new i5(()=>this._register(new qI(t=>this.configurationService.getValue(nB.SETTINGS.EXCLUDES,{resource:t}),t=>t.affectsConfiguration(nB.SETTINGS.EXCLUDES),this.contextService,this.configurationService))));this.pendingAddHistoryEntryOperations=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.workingCopyContentVersion=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.historyEntryContentVersion=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.registerListeners()}static{this.SETTINGS={ENABLED:"workbench.localHistory.enabled",SIZE_LIMIT:"workbench.localHistory.maxFileSize",EXCLUDES:"workbench.localHistory.exclude"}}static{this.UNDO_REDO_SAVE_SOURCE=Qh.registerSource("undoRedo.source",d(19667,null))}registerListeners(){this._register(this.fileService.onDidRunOperation(e=>this.onDidRunFileOperation(e))),this._register(this.workingCopyService.onDidChangeContent(e=>this.onDidChangeContent(e))),this._register(this.workingCopyService.onDidSave(e=>this.onDidSave(e)))}async onDidRunFileOperation(e){if(!this.shouldTrackHistoryFromFileOperationEvent(e))return;let t=e.resource,o=e.target.resource,n=await this.workingCopyHistoryService.moveEntries(t,o);for(let r of n){let s=this.getContentVersion(r);this.historyEntryContentVersion.set(r,s)}}onDidChangeContent(e){let t=this.getContentVersion(e.resource);this.workingCopyContentVersion.set(e.resource,t+1)}getContentVersion(e){return this.workingCopyContentVersion.get(e)||0}onDidSave(e){if(!this.shouldTrackHistoryFromSaveEvent(e))return;let t=this.getContentVersion(e.workingCopy.resource);if(this.historyEntryContentVersion.get(e.workingCopy.resource)===t)return;this.pendingAddHistoryEntryOperations.get(e.workingCopy.resource)?.dispose(!0);let o=new qe;this.pendingAddHistoryEntryOperations.set(e.workingCopy.resource,o),this.limiter.queue(async()=>{if(o.token.isCancellationRequested)return;let n=this.getContentVersion(e.workingCopy.resource),r=e.source;e.source||(r=this.resolveSourceFromUndoRedo(e)),await this.workingCopyHistoryService.addEntry({resource:e.workingCopy.resource,source:r,timestamp:e.stat.mtime},o.token),this.historyEntryContentVersion.set(e.workingCopy.resource,n),!o.token.isCancellationRequested&&this.pendingAddHistoryEntryOperations.delete(e.workingCopy.resource)})}resolveSourceFromUndoRedo(e){let t=this.undoRedoService.getLastElement(e.workingCopy.resource);if(t)return t.code==="undoredo.textBufferEdit"?void 0:t.label;let o=this.undoRedoService.getElements(e.workingCopy.resource);if(o.future.length>0||o.past.length>0)return nB.UNDO_REDO_SAVE_SOURCE}shouldTrackHistoryFromSaveEvent(e){return Zpo(e)?this.shouldTrackHistory(e.workingCopy.resource,e.stat):!1}shouldTrackHistoryFromFileOperationEvent(e){return e.isOperation(2)?this.shouldTrackHistory(e.target.resource,e.target):!1}shouldTrackHistory(e,t){if(e.scheme!==this.pathService.defaultUriScheme&&e.scheme!==Q.vscodeUserData&&e.scheme!==Q.inMemory)return!1;let o=1024*this.configurationService.getValue(nB.SETTINGS.SIZE_LIMIT,{resource:e});return t.size>o||this.configurationService.getValue(nB.SETTINGS.ENABLED,{resource:e})===!1?!1:!this.resourceExcludeMatcher.value.matches(e)}};nB=I([m(0,$a),m(1,Tw),m(2,gt),m(3,Pn),m(4,B),m(5,wl),m(6,Ae),m(7,ge)],nB);var pei=class a{constructor(i,e,t,o,n,r,s,l,c,u,p){this.historyHome=e;this.entryAddedEmitter=t;this.entryChangedEmitter=o;this.entryReplacedEmitter=n;this.entryRemovedEmitter=r;this.options=s;this.fileService=l;this.labelService=c;this.logService=u;this.configurationService=p;this.entries=[];this.whenResolved=void 0;this.workingCopyResource=void 0;this.workingCopyName=void 0;this.historyEntriesFolder=void 0;this.historyEntriesListingFile=void 0;this.historyEntriesNameMatcher=void 0;this.versionId=0;this.storedVersionId=this.versionId;this.storeLimiter=new _k(1);this.setWorkingCopy(i)}static{this.ENTRIES_FILE="entries.json"}static{this.FILE_SAVED_SOURCE=Qh.registerSource("default.source",d(19663,null))}static{this.SETTINGS={MAX_ENTRIES:"workbench.localHistory.maxFileEntries",MERGE_PERIOD:"workbench.localHistory.mergeWindow"}}setWorkingCopy(i){this.workingCopyResource=i,this.workingCopyName=this.labelService.getUriBasenameLabel(i),this.historyEntriesNameMatcher=new RegExp(`[A-Za-z0-9]{4}${Ss(Ts(i))}`),this.historyEntriesFolder=this.toHistoryEntriesFolder(this.historyHome,i),this.historyEntriesListingFile=Ve(this.historyEntriesFolder,a.ENTRIES_FILE),this.entries=[],this.whenResolved=void 0}toHistoryEntriesFolder(i,e){return Ve(i,Lr(e.toString()).toString(16))}async addEntry(i=a.FILE_SAVED_SOURCE,e=void 0,t=Date.now(),o){let n,r=this.entries.at(-1);if(r&&r.source===i){let l=this.configurationService.getValue(a.SETTINGS.MERGE_PERIOD,{resource:this.workingCopyResource});t-r.timestamp<=l*1e3&&(n=r)}let s;return n?s=await this.doReplaceEntry(n,i,e,t,o):s=await this.doAddEntry(i,e,t,o),this.options.flushOnChange&&!o.isCancellationRequested&&await this.store(o),s}async doAddEntry(i,e=void 0,t,o){let n=Ti(this.workingCopyResource),r=Ti(this.workingCopyName),s=Ti(this.historyEntriesFolder),l=`${hwe(void 0,void 0,4)}${Ts(n)}`,c=Ve(s,l);await this.fileService.cloneFile(n,c);let u={id:l,workingCopy:{resource:n,name:r},location:c,timestamp:t,source:i,sourceDescription:e};return this.entries.push(u),this.versionId++,this.entryAddedEmitter.fire({entry:u}),u}async doReplaceEntry(i,e,t=void 0,o,n){let r=Ti(this.workingCopyResource);return await this.fileService.cloneFile(r,i.location),i.source=e,i.sourceDescription=t,i.timestamp=o,this.versionId++,this.entryReplacedEmitter.fire({entry:i}),i}async removeEntry(i,e){if(await this.resolveEntriesOnce(),e.isCancellationRequested)return!1;let t=this.entries.indexOf(i);return t===-1?!1:(await this.deleteEntry(i),this.entries.splice(t,1),this.versionId++,this.entryRemovedEmitter.fire({entry:i}),this.options.flushOnChange&&!e.isCancellationRequested&&await this.store(e),!0)}async updateEntry(i,e,t){await this.resolveEntriesOnce(),!(t.isCancellationRequested||this.entries.indexOf(i)===-1)&&(i.source=e.source,this.versionId++,this.entryChangedEmitter.fire({entry:i}),this.options.flushOnChange&&!t.isCancellationRequested&&await this.store(t))}async getEntries(){await this.resolveEntriesOnce();let i=this.configurationService.getValue(a.SETTINGS.MAX_ENTRIES,{resource:this.workingCopyResource});return this.entries.length>i?this.entries.slice(this.entries.length-i):this.entries}async hasEntries(i){return i||await this.resolveEntriesOnce(),this.entries.length>0}resolveEntriesOnce(){return this.whenResolved||(this.whenResolved=this.doResolveEntries()),this.whenResolved}async doResolveEntries(){let i=await this.resolveEntriesFromDisk();for(let e of this.entries)i.set(e.id,e);this.entries=Array.from(i.values()).sort((e,t)=>e.timestamp-t.timestamp)}async resolveEntriesFromDisk(){let i=Ti(this.workingCopyResource),e=Ti(this.workingCopyName),[t,o]=await Promise.all([this.readEntriesFile(),this.readEntriesFolder()]),n=new Map;if(o)for(let r of o)n.set(r.name,{id:r.name,workingCopy:{resource:i,name:e},location:r.resource,timestamp:r.mtime,source:a.FILE_SAVED_SOURCE,sourceDescription:void 0});if(t)for(let r of t.entries){let s=n.get(r.id);s&&n.set(r.id,{...s,timestamp:r.timestamp,source:r.source??s.source,sourceDescription:r.sourceDescription??s.sourceDescription})}return n}async moveEntries(i,e,t){let o=Date.now(),n=this.labelService.getUriLabel(Ti(this.workingCopyResource)),r=Ti(this.historyEntriesFolder),s=Ti(i.historyEntriesFolder);try{for(let p of this.entries)await this.fileService.move(p.location,Ve(s,p.id),!0);await this.fileService.del(r,{recursive:!0})}catch(p){if(!this.isFileNotFound(p))try{await this.fileService.move(r,s,!0)}catch(h){this.isFileNotFound(h)||this.traceError(h)}}let l=jo([...this.entries,...i.entries],p=>p.id).sort((p,h)=>p.timestamp-h.timestamp),c=Ti(i.workingCopyResource);this.setWorkingCopy(c);let u=Ti(i.workingCopyName);for(let p of l)this.entries.push({id:p.id,location:Ve(s,p.id),source:p.source,sourceDescription:p.sourceDescription,timestamp:p.timestamp,workingCopy:{resource:c,name:u}});await this.addEntry(e,n,o,t),await this.store(t)}async store(i){this.shouldStore()&&await this.storeLimiter.queue(async()=>{if(!(i.isCancellationRequested||!this.shouldStore()))return this.doStore(i)})}shouldStore(){return this.storedVersionId!==this.versionId}async doStore(i){let e=Ti(this.historyEntriesFolder);if(await this.resolveEntriesOnce(),i.isCancellationRequested)return;await this.cleanUpEntries();let t=this.versionId;if(this.entries.length===0)try{await this.fileService.del(e,{recursive:!0})}catch(o){this.traceError(o)}else await this.writeEntriesFile();this.storedVersionId=t}async cleanUpEntries(){let i=this.configurationService.getValue(a.SETTINGS.MAX_ENTRIES,{resource:this.workingCopyResource});if(this.entries.length<=i)return;let e=this.entries.slice(0,this.entries.length-i),t=this.entries.slice(this.entries.length-i);for(let o of e)await this.deleteEntry(o);this.entries=t;for(let o of e)this.entryRemovedEmitter.fire({entry:o})}async deleteEntry(i){try{await this.fileService.del(i.location)}catch(e){this.traceError(e)}}async writeEntriesFile(){let i=Ti(this.workingCopyResource),e=Ti(this.historyEntriesListingFile),t={version:1,resource:i.toString(),entries:this.entries.map(o=>({id:o.id,source:o.source!==a.FILE_SAVED_SOURCE?o.source:void 0,sourceDescription:o.sourceDescription,timestamp:o.timestamp}))};await this.fileService.writeFile(e,Ke.fromString(JSON.stringify(t)))}async readEntriesFile(){let i=Ti(this.historyEntriesListingFile),e;try{e=JSON.parse((await this.fileService.readFile(i)).value.toString())}catch(t){this.isFileNotFound(t)||this.traceError(t)}return e}async readEntriesFolder(){let i=Ti(this.historyEntriesFolder),e=Ti(this.historyEntriesNameMatcher),t;try{t=(await this.fileService.resolve(i,{resolveMetadata:!0})).children}catch(o){this.isFileNotFound(o)||this.traceError(o)}if(t)return t.filter(o=>!ze(o.resource,this.historyEntriesListingFile)&&e.test(o.name))}isFileNotFound(i){return i instanceof ua&&i.fileOperationResult===1}traceError(i){this.logService.trace("[Working Copy History Service]",i)}},Qae=class extends k{constructor(e,t,o,n,r,s,l){super();this.fileService=e;this.remoteAgentService=t;this.environmentService=o;this.uriIdentityService=n;this.labelService=r;this.logService=s;this.configurationService=l;this._onDidAddEntry=this._register(new T);this.onDidAddEntry=this._onDidAddEntry.event;this._onDidChangeEntry=this._register(new T);this.onDidChangeEntry=this._onDidChangeEntry.event;this._onDidReplaceEntry=this._register(new T);this.onDidReplaceEntry=this._onDidReplaceEntry.event;this._onDidMoveEntries=this._register(new T);this.onDidMoveEntries=this._onDidMoveEntries.event;this._onDidRemoveEntry=this._register(new T);this.onDidRemoveEntry=this._onDidRemoveEntry.event;this._onDidRemoveEntries=this._register(new T);this.onDidRemoveEntries=this._onDidRemoveEntries.event;this.localHistoryHome=new Mo;this.models=new dt(e=>this.uriIdentityService.extUri.getComparisonKey(e));this.resolveLocalHistoryHome()}static{this.FILE_MOVED_SOURCE=Qh.registerSource("moved.source",d(19665,null))}static{this.FILE_RENAMED_SOURCE=Qh.registerSource("renamed.source",d(19666,null))}async resolveLocalHistoryHome(){let e;try{let t=await this.remoteAgentService.getEnvironment();t&&(e=t.localHistoryHome)}catch(t){this.logService.trace(t)}e||(e=this.environmentService.localHistoryHome),this.localHistoryHome.complete(e)}async moveEntries(e,t){let o=new _k(Pqe),n=[];for(let[s,l]of this.models){if(!this.uriIdentityService.extUri.isEqualOrParent(s,e))continue;let c;if(this.uriIdentityService.extUri.isEqual(e,s))c=t;else{let p=mwe(s.path,e.path);c=Ve(t,s.path.substr(p+e.path.length+1))}let u;this.uriIdentityService.extUri.isEqual(ai(s),ai(c))?u=Qae.FILE_RENAMED_SOURCE:u=Qae.FILE_MOVED_SOURCE,n.push(o.queue(()=>this.doMoveEntries(l,u,s,c)))}if(!n.length)return[];let r=await Promise.all(n);return this._onDidMoveEntries.fire(),r}async doMoveEntries(e,t,o,n){let r=await this.getModel(n);return await e.moveEntries(r,t,Ie.None),this.models.delete(o),this.models.set(n,e),n}async addEntry({resource:e,source:t,timestamp:o},n){if(!this.fileService.hasProvider(e))return;let r=await this.getModel(e);if(!n.isCancellationRequested)return r.addEntry(t,void 0,o,n)}async updateEntry(e,t,o){let n=await this.getModel(e.workingCopy.resource);if(!o.isCancellationRequested)return n.updateEntry(e,t,o)}async removeEntry(e,t){let o=await this.getModel(e.workingCopy.resource);return t.isCancellationRequested?!1:o.removeEntry(e,t)}async removeAll(e){let t=await this.localHistoryHome.p;e.isCancellationRequested||(this.models.clear(),await this.fileService.del(t,{recursive:!0}),this._onDidRemoveEntries.fire())}async getEntries(e,t){let o=await this.getModel(e);return t.isCancellationRequested?[]:await o.getEntries()??[]}async getAll(e){let t=await this.localHistoryHome.p;if(e.isCancellationRequested)return[];let o=new dt;for(let[n,r]of this.models)await r.hasEntries(!0)&&o.set(n,!0);try{let n=await this.fileService.resolve(t);if(n.children){let r=new _k(Pqe),s=[];for(let l of n.children)s.push(r.queue(async()=>{if(!e.isCancellationRequested)try{let c=JSON.parse((await this.fileService.readFile(Ve(l.resource,pei.ENTRIES_FILE))).value.toString());c.entries.length>0&&o.set(A.parse(c.resource),!0)}catch{}}));await Promise.all(s)}}catch{}return Array.from(o.keys())}async getModel(e){let t=await this.localHistoryHome.p,o=this.models.get(e);return o||(o=new pei(e,t,this._onDidAddEntry,this._onDidChangeEntry,this._onDidReplaceEntry,this._onDidRemoveEntry,this.getModelOptions(),this.fileService,this.labelService,this.logService,this.configurationService),this.models.set(e,o)),o}};Qae=I([m(0,ge),m(1,bo),m(2,Mt),m(3,gt),m(4,nt),m(5,re),m(6,B)],Qae);var Yae=class extends Qae{constructor(e,t,o,n,r,s,l,c){super(e,t,o,n,r,l,c);this.lifecycleService=s;this.isRemotelyStored=typeof this.environmentService.remoteAuthority=="string";this.storeAllCts=this._register(new qe);this.storeAllScheduler=this._register(new Dt(()=>this.storeAll(this.storeAllCts.token),Yae.STORE_ALL_INTERVAL));this.registerListeners()}static{this.STORE_ALL_INTERVAL=300*1e3}registerListeners(){this.isRemotelyStored||(this._register(this.lifecycleService.onWillShutdown(e=>this.onWillShutdown(e))),this._register(U.any(this.onDidAddEntry,this.onDidChangeEntry,this.onDidReplaceEntry,this.onDidRemoveEntry)(()=>this.onDidChangeModels())))}getModelOptions(){return{flushOnChange:this.isRemotelyStored}}onWillShutdown(e){this.storeAllScheduler.dispose(),this.storeAllCts.dispose(!0),e.join(this.storeAll(e.token),{id:"join.workingCopyHistory",label:d(19664,null)})}onDidChangeModels(){this.storeAllScheduler.isScheduled()||this.storeAllScheduler.schedule()}async storeAll(e){let t=new _k(Pqe),o=[],n=Array.from(this.models.values());for(let r of n)o.push(t.queue(async()=>{if(!e.isCancellationRequested)try{await r.store(e)}catch(s){this.logService.trace(s)}}));await Promise.all(o)}};Yae=I([m(0,ge),m(1,bo),m(2,Mt),m(3,gt),m(4,nt),m(5,to),m(6,re),m(7,B)],Yae);oe.as(Zi.Workbench).registerWorkbenchContribution(nB,3);Ce(Tw,Yae,1);var vji="sync.enable",gje=class extends k{constructor(e,t,o){super();this.storageService=e;this.environmentService=t;this.userDataSyncStoreManagementService=o;this._onDidChangeEnablement=this._register(new T);this.onDidChangeEnablement=this._onDidChangeEnablement.event;this._onDidChangeResourceEnablement=this._register(new T);this.onDidChangeResourceEnablement=this._onDidChangeResourceEnablement.event;this._register(e.onDidChangeValue(-1,void 0,this._store)(n=>this.onDidStorageChange(n)))}isEnabled(){switch(this.environmentService.sync){case"on":return!0;case"off":return!1}return this.storageService.getBoolean(vji,-1,!1)}canToggleEnablement(){return this.userDataSyncStoreManagementService.userDataSyncStore!==void 0&&this.environmentService.sync===void 0}setEnablement(e){e&&!this.canToggleEnablement()||this.storageService.store(vji,e,-1,1)}isResourceEnabled(e,t){let o=this.storageService.getBoolean(sge(e),-1);return t=t??e!=="prompts",o??t}isResourceEnablementConfigured(e){return this.storageService.getBoolean(sge(e),-1)!==void 0}setResourceEnablement(e,t){if(this.isResourceEnabled(e)!==t){let o=sge(e);this.storeResourceEnablement(o,t)}}getResourceSyncStateVersion(e){}storeResourceEnablement(e,t){this.storageService.store(e,t,-1,Ft?0:1)}onDidStorageChange(e){if(vji===e.key){this._onDidChangeEnablement.fire(this.isEnabled());return}let t=rge.filter(o=>sge(o)===e.key)[0];if(t){this._onDidChangeResourceEnablement.fire([t,this.isResourceEnabled(t)]);return}}};gje=I([m(0,de),m(1,ko),m(2,uP)],gje);var bji=class extends gje{get workbenchEnvironmentService(){return this.environmentService}getResourceSyncStateVersion(i){return i==="extensions"?this.workbenchEnvironmentService.options?.settingsSyncOptions?.extensionsSyncStateVersion:void 0}};Ce(Yl,bji,1);function fje(a){let i=Ke.alloc(1);switch(a){case 0:i.writeUInt8(1,0);break;case 1:i.writeUInt8(2,0);break;case 2:i.writeUInt8(3,0);break}return i}function V7(a,i){if(a.byteLength!==1)return!1;switch(a.readUInt8(0)){case 1:return i===0;case 2:return i===1;case 3:return i===2;default:return!1}}var vje=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this.runningLocation=e;this.startup=t;this._initDataProvider=o;this._telemetryService=n;this._contextService=r;this._labelService=s;this._logService=l;this._loggerService=c;this._environmentService=u;this._userDataProfilesService=p;this._productService=h;this._layoutService=g;this._storageService=f;this._webWorkerService=v;this._defaultLogLevelsService=b;this.pid=null;this.remoteAuthority=null;this.extensions=null;this._onDidExit=this._register(new T);this.onExit=this._onDidExit.event;this._isTerminating=!1,this._protocolPromise=null,this._protocol=null,this._extensionHostLogsLocation=Ve(this._environmentService.extHostLogsPath,"webWorker")}async _getWebWorkerExtensionHostIframeSrc(){let e=new URLSearchParams;this._environmentService.debugExtensionHost&&this._environmentService.debugRenderer&&e.set("debugged","1"),Fle.addSearchParam(e,!0,!0);let t=`?${e.toString()}`,o="vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html";if(Ft){let r=this._productService.webEndpointUrlTemplate,s=this._productService.commit,l=this._productService.quality;if(r&&s&&l){let c="webWorkerExtensionHostIframeStableOriginUUID",u=this._storageService.get(c,1);typeof u>"u"&&(u=ht(),this._storageService.store(c,u,1,1));let p=await Gvt(ut.origin,u),h=r.replace("{{uuid}}",`v--${p}`).replace("{{commit}}",s).replace("{{quality}}",l),g=new URL(`${h}/out/${o}${t}`);return g.searchParams.set("parentOrigin",ut.origin),g.searchParams.set("salt",u),g.toString()}console.warn("The web worker extension host is started in a same-origin iframe!")}return`${this._webWorkerService.getWorkerUrl(new Ak({esmModuleLocation:In.asBrowserUri(o),esmModuleLocationBundler:new URL("../worker/webWorkerExtensionHostIframe.html",import.meta.url),label:"webWorkerExtensionHostIframe"}))}${t}`}async start(){return this._protocolPromise||(this._protocolPromise=this._startInsideIframe(),this._protocolPromise.then(e=>this._protocol=e)),this._protocolPromise}async _startInsideIframe(){let e=await this._getWebWorkerExtensionHostIframeSrc(),t=this._register(new T),o=document.createElement("iframe");o.setAttribute("class","web-worker-ext-host-iframe"),o.setAttribute("sandbox","allow-scripts allow-same-origin"),o.setAttribute("allow","usb; serial; hid; cross-origin-isolated; local-network-access;"),o.setAttribute("aria-hidden","true"),o.style.display="none";let n=ht();o.setAttribute("src",`${e}&vscodeWebWorkerExtHostId=${n}`);let r=new ip,s,l=null,c=!1,u,p=(v,b)=>{l=b,c=!0,mt(l),clearTimeout(u),this._onDidExit.fire([81,l.message]),r.open()},h=v=>{s=v,clearTimeout(u),r.open()};if(u=setTimeout(()=>{console.warn("The Web Worker Extension Host did not start in 60s, that might be a problem.")},6e4),this._register($(ut,"message",v=>{if(v.source!==o.contentWindow||v.data.vscodeWebWorkerExtHostId!==n)return;if(v.data.error){let{name:S,message:y,stack:w}=v.data.error,x=new Error;return x.message=y,x.name=S,x.stack=w,p(81,x)}if(v.data.type==="vscode.bootstrap.nls"){o.contentWindow.postMessage({type:v.data.type,data:{workerUrl:this._webWorkerService.getWorkerUrl(rPn),fileRoot:globalThis._VSCODE_FILE_ROOT,nls:{messages:G5e(),language:ble()}}},"*");return}let{data:b}=v.data;if(r.isOpen()||!(b instanceof MessagePort)){console.warn("UNEXPECTED message",v);let S=new Error("UNEXPECTED message");return p(81,S)}h(b)})),this._layoutService.mainContainer.appendChild(o),this._register(ee(()=>o.remove())),await r.wait(),c)throw l;let g=this._environmentService.options?.messagePorts??new Map;o.contentWindow.postMessage({type:"vscode.init",data:g},"*",[...g.values()]),s.onmessage=v=>{let{data:b}=v;if(!(b instanceof ArrayBuffer)){console.warn("UNKNOWN data received",b),this._onDidExit.fire([77,"UNKNOWN data received"]);return}t.fire(Ke.wrap(new Uint8Array(b,0,b.byteLength)))};let f={onMessage:t.event,send:v=>{let b=v.buffer.buffer.slice(v.buffer.byteOffset,v.buffer.byteOffset+v.buffer.byteLength);s.postMessage(b,[b])}};return this._performHandshake(f)}async _performHandshake(e){if(await U.toPromise(U.filter(e.onMessage,t=>V7(t,1))),this._isTerminating)throw wy();if(e.send(Ke.fromString(JSON.stringify(await this._createExtHostInitData()))),this._isTerminating)throw wy();if(await U.toPromise(U.filter(e.onMessage,t=>V7(t,0))),this._isTerminating)throw wy();return e}dispose(){this._isTerminating||(this._isTerminating=!0,this._protocol?.send(fje(2)),super.dispose())}getInspectPort(){}enableInspectPort(){return Promise.resolve(!1)}async _createExtHostInitData(){let e=await this._initDataProvider.getInitData();this.extensions=e.extensions;let t=this._contextService.getWorkspace(),o=this._productService.extensionsGallery?.nlsBaseUrl,n;return o&&this._productService.commit&&!SI.isDefaultVariant()&&(n=A.joinPath(A.parse(o),this._productService.commit,this._productService.version,SI.value())),{commit:this._productService.commit,version:this._productService.version,quality:this._productService.quality,date:this._productService.date,parentPid:0,environment:{isExtensionDevelopmentDebug:this._environmentService.debugRenderer,appName:this._productService.nameLong,appHost:this._productService.embedderIdentifier??(Ft?"web":"desktop"),appUriScheme:this._productService.urlProtocol,appLanguage:Kr,isExtensionTelemetryLoggingOnly:i_e(this._productService,this._environmentService),isPortable:!1,extensionDevelopmentLocationURI:this._environmentService.extensionDevelopmentLocationURI,extensionTestsLocationURI:this._environmentService.extensionTestsLocationURI,globalStorageHome:this._userDataProfilesService.defaultProfile.globalStorageHome,workspaceStorageHome:this._environmentService.workspaceStorageHome,extensionLogLevel:this._defaultLogLevelsService.defaultLogLevels.extensions,isSessionsWindow:this._environmentService.isSessionsWindow},workspace:this._contextService.getWorkbenchState()===1?void 0:{configuration:t.configuration||void 0,id:t.id,name:this._labelService.getWorkspaceLabel(t),transient:t.transient},consoleForward:{includeStack:!1,logNative:this._environmentService.debugRenderer},extensions:this.extensions.toSnapshot(),nlsBaseUrl:n,telemetryInfo:{sessionId:this._telemetryService.sessionId,machineId:this._telemetryService.machineId,sqmId:this._telemetryService.sqmId,devDeviceId:this._telemetryService.devDeviceId??this._telemetryService.machineId,firstSessionDate:this._telemetryService.firstSessionDate,msftInternal:this._telemetryService.msftInternal},remoteExtensionTips:this._productService.remoteExtensionTips,virtualWorkspaceExtensionTips:this._productService.virtualWorkspaceExtensionTips,logLevel:this._logService.getLevel(),loggers:[...this._loggerService.getRegisteredLoggers()],logsLocation:this._extensionHostLogsLocation,autoStart:this.startup===1||this.startup===3,remote:{authority:this._environmentService.remoteAuthority,connectionData:null,isRemote:!1},uiKind:Ft?2:1}}};vje=I([m(3,_e),m(4,Ae),m(5,nt),m(6,re),m(7,Ol),m(8,Od),m(9,hn),m(10,Ze),m(11,Kl),m(12,de),m(13,Bw),m(14,FR)],vje);var rPn=new Ak({label:"extensionHostWorkerMain",esmModuleLocation:()=>In.asBrowserUri("vs/workbench/api/worker/extensionHostWorkerMain.js"),esmModuleLocationBundler:()=>new URL("../../../api/worker/extensionHostWorkerMain.ts?esm",import.meta.url)});var Sji=class{constructor(i,e){this.versionId=i;this.removedDueToLooping=e}},Iji=class a extends k{constructor(e,t){super();this._activationEventsReader=e;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._versionId=0;this._extensionDescriptions=t,this._initialize()}static isHostExtension(e,t,o){if(t.getExtensionDescription(e))return!1;let n=o.getExtensionDescription(e);return n?!!((n.main||n.browser)&&n.api==="none"):!1}_initialize(){this._extensionDescriptions.sort(sPn),this._extensionsMap=new uu,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 t=this._activationEventsReader.readActivationEvents(e);for(let o of t)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,t){this._extensionDescriptions=wHo(this._extensionDescriptions,t),this._extensionDescriptions=this._extensionDescriptions.concat(e);let o=a._findLoopingExtensions(this._extensionDescriptions);return this._extensionDescriptions=wHo(this._extensionDescriptions,o.map(n=>n.identifier)),this._initialize(),this._versionId++,this._onDidChange.fire(void 0),new Sji(this._versionId,o)}static _findLoopingExtensions(e){let t=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,c){this.addNode(l),this.addNode(c),this._arcs.has(l)?this._arcs.get(l).push(c):this._arcs.set(l,[c])}getArcs(l){return this._arcs.has(l)?this._arcs.get(l):[]}hasOnlyGoodArcs(l,c){let u=t.getArcs(l);for(let p=0;p<u.length;p++)if(!c.has(u[p]))return!1;return!0}getNodes(){return this._nodesArr}},o=new uu;for(let l of e)if(o.set(l.identifier,l),l.extensionDependencies)for(let c of l.extensionDependencies)t.addArc(hi.toKey(l.identifier),hi.toKey(c));let n=new Set;t.getNodes().filter(l=>t.getArcs(l).length===0).forEach(l=>n.add(l));let r=t.getNodes().filter(l=>!n.has(l)),s;do{s=!1;for(let l=0;l<r.length;l++){let c=r[l];t.hasOnlyGoodArcs(c,n)&&(r.splice(l,1),l--,n.add(c),s=!0)}}while(s);return r.map(l=>o.get(l))}containsActivationEvent(e){return this._activationMap.has(e)}containsExtension(e){return this._extensionsMap.has(e)}getExtensionDescriptionsForActivationEvent(e){let t=this._activationMap.get(e);return t?t.slice(0):[]}getAllExtensionDescriptions(){return this._extensionsArr.slice(0)}getSnapshot(){return new yji(this._versionId,this.getAllExtensionDescriptions())}getExtensionDescription(e){let t=this._extensionsMap.get(e);return t||void 0}getExtensionDescriptionByUUID(e){for(let t of this._extensionsArr)if(t.uuid===e)return t}getExtensionDescriptionByIdOrUUID(e,t){return this.getExtensionDescription(e)??(t?this.getExtensionDescriptionByUUID(t):void 0)}},yji=class{constructor(i,e){this.versionId=i;this.extensions=e}},hei=class{constructor(i){this._lock=new xji;this._actual=new Iji(i,[])}async acquireLock(i){let e=await this._lock.acquire(i);return new wji(this,e)}deltaExtensions(i,e,t){if(!i.isAcquiredFor(this))throw new Error("Lock is not held");return this._actual.deltaExtensions(e,t)}containsActivationEvent(i){return this._actual.containsActivationEvent(i)}containsExtension(i){return this._actual.containsExtension(i)}getExtensionDescriptionsForActivationEvent(i){return this._actual.getExtensionDescriptionsForActivationEvent(i)}getAllExtensionDescriptions(){return this._actual.getAllExtensionDescriptions()}getSnapshot(){return this._actual.getSnapshot()}getExtensionDescription(i){return this._actual.getExtensionDescription(i)}getExtensionDescriptionByUUID(i){return this._actual.getExtensionDescriptionByUUID(i)}getExtensionDescriptionByIdOrUUID(i,e){return this._actual.getExtensionDescriptionByIdOrUUID(i,e)}},wji=class extends k{constructor(e,t){super();this._registry=e;this._isDisposed=!1;this._register(t)}isAcquiredFor(e){return!this._isDisposed&&this._registry===e}},Cji=class{constructor(i){this.name=i;let e=Ey();this.promise=e.promise,this._resolve=e.resolve}resolve(i){this._resolve(i)}},xji=class{constructor(){this._pendingCustomers=[];this._isLocked=!1}async acquire(i){let e=new Cji(i);return this._pendingCustomers.push(e),this._advance(),e.promise}_advance(){if(this._isLocked||this._pendingCustomers.length===0)return;let i=this._pendingCustomers.shift();this._isLocked=!0;let e=!0,t=setTimeout(()=>{e&&console.warn(`The customer named ${i.name} has been holding on to the lock for 30s. This might be a problem.`)},30*1e3),o=()=>{e&&(clearTimeout(t),e=!1,this._isLocked=!1,this._advance())};i.resolve(ee(o))}};function sPn(a,i){let e=a.isBuiltin?0:a.isUnderDevelopment?2:1,t=i.isBuiltin?0:i.isUnderDevelopment?2:1;if(e!==t)return e-t;let o=Vo.basename(a.extensionLocation.path),n=Vo.basename(i.extensionLocation.path);return o<n?-1:o>n?1:0}function wHo(a,i){let e=new HS(i);return a.filter(t=>!e.has(t.identifier))}var Qgt=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((i,e)=>{this._actualOk=i,this._actualErr=e,this._hasValue&&this._actualOk(this._value),this._hasErr&&this._actualErr(this._err)})),this._actual}resolveOk(i){this._hasValue||this._hasErr||(this._hasValue=!0,this._value=i,this._actual&&this._actualOk(i))}resolveErr(i){this._hasValue||this._hasErr||(this._hasErr=!0,this._err=i,this._actual?this._actualErr(i):mt(i))}then(i,e){return this._ensureActual().then(i,e)}catch(i){return this._ensureActual().then(void 0,i)}finally(i){return this._ensureActual().finally(i)}},gei=class extends Qgt{constructor(){super(),this._hasErr=!0,this._err=new qi}};function kji(a,i){try{return JSON.stringify(a,i)}catch{return"null"}}var Tji="$$ref$$",aPn={[Tji]:-1};function CHo(a,i=null,e=!1){let t=[];return{jsonString:(e?kji:JSON.stringify)(a,(n,r)=>{if(typeof r>"u")return aPn;if(typeof r=="object"){if(r instanceof Ke){let s=t.push(r)-1;return{[Tji]:s}}if(i)return i(n,r)}return r}),referencedBuffers:t}}function THo(a,i,e){return JSON.parse(a,(t,o)=>{if(o){let n=o[Tji];if(typeof n=="number")return i[n];if(e&&o.$mid===1)return e.transformIncoming(o)}return o})}function xHo(a,i){return JSON.stringify(a,i)}function lPn(a){return a?(i,e)=>e&&e.$mid===1?a.transformOutgoing(e):e:null}var cPn=()=>{},dPn=Symbol.for("rpcProtocol"),uPn=Symbol.for("rpcProxy"),kHo,EHo,fei=class a extends(EHo=k,kHo=dPn,EHo){constructor(e,t=null,o=null){super();this[kHo]=!0;this._onDidChangeResponsiveState=this._register(new T);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._protocol=e,this._logger=t,this._uriTransformer=o,this._uriReplacer=lPn(this._uriTransformer),this._isDisposed=!1,this._locals=[],this._proxies=[];for(let n=0,r=lYe.count;n<r;n++)this._locals[n]=null,this._proxies[n]=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 Dt(()=>this._checkUnresponsive(),1e3)),this._register(this._protocol.onMessage(n=>this._receiveOneMessage(n)))}static{this.UNRESPONSIVE_TIME=3*1e3}dispose(){this._isDisposed=!0,Object.keys(this._pendingRPCReplies).forEach(e=>{let t=this._pendingRPCReplies[e];delete this._pendingRPCReplies[e],t.resolveErr(wy())}),super.dispose()}drain(){return typeof this._protocol.drain=="function"?this._protocol.drain():Promise.resolve()}_onWillSendRequest(e){this._unacknowledgedCount===0&&(this._unresponsiveTime=Date.now()+a.UNRESPONSIVE_TIME),this._unacknowledgedCount++,this._asyncCheckUresponsive.isScheduled()||this._asyncCheckUresponsive.schedule()}_onDidReceiveAcknowledge(e){this._unresponsiveTime=Date.now()+a.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?mge(e,this._uriTransformer):e}getProxy(e){let{nid:t,sid:o}=e;return this._proxies[t]||(this._proxies[t]=this._createProxy(t,o)),this._proxies[t]}_createProxy(e,t){let o={get:(n,r)=>(typeof r=="string"&&!n[r]&&r.charCodeAt(0)===36&&(n[r]=(...s)=>this._remoteCall(e,r,s)),r===uPn?t:n[r])};return new Proxy(Object.create(null),o)}set(e,t){return this._locals[e.nid]=t,t}assertRegistered(e){for(let t=0,o=e.length;t<o;t++){let n=e[t];if(!this._locals[n.nid])throw new Error(`Missing proxy instance ${n.sid}`)}}_receiveOneMessage(e){if(this._isDisposed)return;let t=e.byteLength,o=Fv.read(e,0),n=o.readUInt8(),r=o.readUInt32();switch(n){case 1:case 2:{let{rpcId:s,method:l,args:c}=oA.deserializeRequestJSONArgs(o);this._uriTransformer&&(c=mge(c,this._uriTransformer)),this._receiveRequest(t,r,s,l,c,n===2);break}case 3:case 4:{let{rpcId:s,method:l,args:c}=oA.deserializeRequestMixedArgs(o);this._uriTransformer&&(c=mge(c,this._uriTransformer)),this._receiveRequest(t,r,s,l,c,n===4);break}case 5:{this._logger?.logIncoming(t,r,0,"ack"),this._onDidReceiveAcknowledge(r);break}case 6:{this._receiveCancel(t,r);break}case 7:{this._receiveReply(t,r,void 0);break}case 9:{let s=oA.deserializeReplyOKJSON(o);this._uriTransformer&&(s=mge(s,this._uriTransformer)),this._receiveReply(t,r,s);break}case 10:{let s=oA.deserializeReplyOKJSONWithBuffers(o,this._uriTransformer);this._receiveReply(t,r,s);break}case 8:{let s=oA.deserializeReplyOKVSBuffer(o);this._receiveReply(t,r,s);break}case 11:{let s=oA.deserializeReplyErrError(o);this._uriTransformer&&(s=mge(s,this._uriTransformer)),this._receiveReplyErr(t,r,s);break}case 12:{this._receiveReplyErr(t,r,void 0);break}default:console.error("received unexpected message"),console.error(e)}}_receiveRequest(e,t,o,n,r,s){this._logger?.logIncoming(e,t,1,`receiveRequest ${cYe(o)}.${n}(`,r);let l=String(t),c,u;if(s){let h=new qe;r.push(h.token),c=this._invokeHandler(o,n,r),u=()=>h.cancel()}else c=this._invokeHandler(o,n,r),u=cPn;this._cancelInvokedHandlers[l]=u;let p=oA.serializeAcknowledged(t);this._logger?.logOutgoing(p.byteLength,t,1,"ack"),this._protocol.send(p),c.then(h=>{delete this._cancelInvokedHandlers[l];let g=oA.serializeReplyOK(t,h,this._uriReplacer);this._logger?.logOutgoing(g.byteLength,t,1,"reply:",h),this._protocol.send(g)},h=>{delete this._cancelInvokedHandlers[l];let g=oA.serializeReplyErr(t,h);this._logger?.logOutgoing(g.byteLength,t,1,"replyErr:",h),this._protocol.send(g)})}_receiveCancel(e,t){this._logger?.logIncoming(e,t,1,"receiveCancel");let o=String(t);this._cancelInvokedHandlers[o]?.()}_receiveReply(e,t,o){this._logger?.logIncoming(e,t,0,"receiveReply:",o);let n=String(t);if(!this._pendingRPCReplies.hasOwnProperty(n))return;let r=this._pendingRPCReplies[n];delete this._pendingRPCReplies[n],r.resolveOk(o)}_receiveReplyErr(e,t,o){this._logger?.logIncoming(e,t,0,"receiveReplyErr:",o);let n=String(t);if(!this._pendingRPCReplies.hasOwnProperty(n))return;let r=this._pendingRPCReplies[n];delete this._pendingRPCReplies[n];let s;o&&(o.$isError?(s=new Error,s.name=o.name,s.message=o.message,s.stack=o.stack):s=o),r.resolveErr(s)}_invokeHandler(e,t,o){try{return Promise.resolve(this._doInvokeHandler(e,t,o))}catch(n){return Promise.reject(n)}}_doInvokeHandler(e,t,o){let n=this._locals[e];if(!n)throw new Error("Unknown actor "+cYe(e));let r=n[t];if(typeof r!="function")throw new Error("Unknown method "+t+" on actor "+cYe(e));return r.apply(n,o)}_remoteCall(e,t,o){if(this._isDisposed)return new gei;let n=null;if(o.length>0&&Ie.isCancellationToken(o[o.length-1])&&(n=o.pop()),n&&n.isCancellationRequested)return Promise.reject(wy());let r=oA.serializeRequestArguments(o,this._uriReplacer),s=++this._lastMessageId,l=String(s),c=new Qgt,u=new O;n&&u.add(n.onCancellationRequested(()=>{let h=oA.serializeCancel(s);this._logger?.logOutgoing(h.byteLength,s,0,"cancel"),this._protocol.send(h)})),this._pendingRPCReplies[l]=new Eji(c,u),this._onWillSendRequest(s);let p=oA.serializeRequest(s,e,t,r,!!n);return this._logger?.logOutgoing(p.byteLength,s,0,`request: ${cYe(e)}.${t}(`,o),this._protocol.send(p),c}},Eji=class{constructor(i,e){this._promise=i;this._disposable=e}resolveOk(i){this._promise.resolveOk(i),this._disposable.dispose()}resolveErr(i){this._promise.resolveErr(i),this._disposable.dispose()}},Fv=class a{static alloc(i,e,t){let o=new a(Ke.alloc(t+1+4),0);return o.writeUInt8(i),o.writeUInt32(e),o}static read(i,e){return new a(i,e)}get buffer(){return this._buff}constructor(i,e){this._buff=i,this._offset=e}static sizeUInt8(){return 1}static{this.sizeUInt32=4}writeUInt8(i){this._buff.writeUInt8(i,this._offset),this._offset+=1}readUInt8(){let i=this._buff.readUInt8(this._offset);return this._offset+=1,i}writeUInt32(i){this._buff.writeUInt32BE(i,this._offset),this._offset+=4}readUInt32(){let i=this._buff.readUInt32BE(this._offset);return this._offset+=4,i}static sizeShortString(i){return 1+i.byteLength}writeShortString(i){this._buff.writeUInt8(i.byteLength,this._offset),this._offset+=1,this._buff.set(i,this._offset),this._offset+=i.byteLength}readShortString(){let i=this._buff.readUInt8(this._offset);this._offset+=1;let t=this._buff.slice(this._offset,this._offset+i).toString();return this._offset+=i,t}static sizeLongString(i){return 4+i.byteLength}writeLongString(i){this._buff.writeUInt32BE(i.byteLength,this._offset),this._offset+=4,this._buff.set(i,this._offset),this._offset+=i.byteLength}readLongString(){let i=this._buff.readUInt32BE(this._offset);this._offset+=4;let t=this._buff.slice(this._offset,this._offset+i).toString();return this._offset+=i,t}writeBuffer(i){this._buff.writeUInt32BE(i.byteLength,this._offset),this._offset+=4,this._buff.set(i,this._offset),this._offset+=i.byteLength}static sizeVSBuffer(i){return 4+i.byteLength}writeVSBuffer(i){this._buff.writeUInt32BE(i.byteLength,this._offset),this._offset+=4,this._buff.set(i,this._offset),this._offset+=i.byteLength}readVSBuffer(){let i=this._buff.readUInt32BE(this._offset);this._offset+=4;let e=this._buff.slice(this._offset,this._offset+i);return this._offset+=i,e}static sizeMixedArray(i){let e=0;e+=1;for(let t=0,o=i.length;t<o;t++){let n=i[t];switch(e+=1,n.type){case 1:e+=this.sizeLongString(n.value);break;case 2:e+=this.sizeVSBuffer(n.value);break;case 3:e+=this.sizeUInt32,e+=this.sizeLongString(n.value);for(let r=0;r<n.buffers.length;++r)e+=this.sizeVSBuffer(n.buffers[r]);break;case 4:break}}return e}writeMixedArray(i){this._buff.writeUInt8(i.length,this._offset),this._offset+=1;for(let e=0,t=i.length;e<t;e++){let o=i[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 n=0;n<o.buffers.length;++n)this.writeBuffer(o.buffers[n]);break;case 4:this.writeUInt8(4);break}}}readMixedArray(){let i=this._buff.readUInt8(this._offset);this._offset+=1;let e=new Array(i);for(let t=0;t<i;t++)switch(this.readUInt8()){case 1:e[t]=this.readLongString();break;case 2:e[t]=this.readVSBuffer();break;case 3:{let n=this.readUInt32(),r=this.readLongString(),s=[];for(let l=0;l<n;++l)s.push(this.readVSBuffer());e[t]=new Hg(THo(r,s,null));break}case 4:e[t]=void 0;break}return e}};var oA=class{static _useMixedArgSerialization(i){for(let e=0,t=i.length;e<t;e++)if(i[e]instanceof Ke||i[e]instanceof Hg||typeof i[e]>"u")return!0;return!1}static serializeRequestArguments(i,e){if(this._useMixedArgSerialization(i)){let t=[];for(let o=0,n=i.length;o<n;o++){let r=i[o];if(r instanceof Ke)t[o]={type:2,value:r};else if(typeof r>"u")t[o]={type:4};else if(r instanceof Hg){let{jsonString:s,referencedBuffers:l}=CHo(r.value,e);t[o]={type:3,value:Ke.fromString(s),buffers:l}}else t[o]={type:1,value:Ke.fromString(xHo(r,e))}}return{type:1,args:t}}return{type:0,args:xHo(i,e)}}static serializeRequest(i,e,t,o,n){switch(o.type){case 0:return this._requestJSONArgs(i,e,t,o.args,n);case 1:return this._requestMixedArgs(i,e,t,o.args,n)}}static _requestJSONArgs(i,e,t,o,n){let r=Ke.fromString(t),s=Ke.fromString(o),l=0;l+=Fv.sizeUInt8(),l+=Fv.sizeShortString(r),l+=Fv.sizeLongString(s);let c=Fv.alloc(n?2:1,i,l);return c.writeUInt8(e),c.writeShortString(r),c.writeLongString(s),c.buffer}static deserializeRequestJSONArgs(i){let e=i.readUInt8(),t=i.readShortString(),o=i.readLongString();return{rpcId:e,method:t,args:JSON.parse(o)}}static _requestMixedArgs(i,e,t,o,n){let r=Ke.fromString(t),s=0;s+=Fv.sizeUInt8(),s+=Fv.sizeShortString(r),s+=Fv.sizeMixedArray(o);let l=Fv.alloc(n?4:3,i,s);return l.writeUInt8(e),l.writeShortString(r),l.writeMixedArray(o),l.buffer}static deserializeRequestMixedArgs(i){let e=i.readUInt8(),t=i.readShortString(),o=i.readMixedArray(),n=new Array(o.length);for(let r=0,s=o.length;r<s;r++){let l=o[r];typeof l=="string"?n[r]=JSON.parse(l):n[r]=l}return{rpcId:e,method:t,args:n}}static serializeAcknowledged(i){return Fv.alloc(5,i,0).buffer}static serializeCancel(i){return Fv.alloc(6,i,0).buffer}static serializeReplyOK(i,e,t){if(typeof e>"u")return this._serializeReplyOKEmpty(i);if(e instanceof Ke)return this._serializeReplyOKVSBuffer(i,e);if(e instanceof Hg){let{jsonString:o,referencedBuffers:n}=CHo(e.value,t,!0);return this._serializeReplyOKJSONWithBuffers(i,o,n)}else return this._serializeReplyOKJSON(i,kji(e,t))}static _serializeReplyOKEmpty(i){return Fv.alloc(7,i,0).buffer}static _serializeReplyOKVSBuffer(i,e){let t=0;t+=Fv.sizeVSBuffer(e);let o=Fv.alloc(8,i,t);return o.writeVSBuffer(e),o.buffer}static deserializeReplyOKVSBuffer(i){return i.readVSBuffer()}static _serializeReplyOKJSON(i,e){let t=Ke.fromString(e),o=0;o+=Fv.sizeLongString(t);let n=Fv.alloc(9,i,o);return n.writeLongString(t),n.buffer}static _serializeReplyOKJSONWithBuffers(i,e,t){let o=Ke.fromString(e),n=0;n+=Fv.sizeUInt32,n+=Fv.sizeLongString(o);for(let s of t)n+=Fv.sizeVSBuffer(s);let r=Fv.alloc(10,i,n);r.writeUInt32(t.length),r.writeLongString(o);for(let s of t)r.writeBuffer(s);return r.buffer}static deserializeReplyOKJSON(i){let e=i.readLongString();return JSON.parse(e)}static deserializeReplyOKJSONWithBuffers(i,e){let t=i.readUInt32(),o=i.readLongString(),n=[];for(let r=0;r<t;++r)n.push(i.readVSBuffer());return new Hg(THo(o,n,e))}static serializeReplyErr(i,e){let t=e?kji(Aj(e),null):void 0;if(typeof t!="string")return this._serializeReplyErrEmpty(i);let o=Ke.fromString(t),n=0;n+=Fv.sizeLongString(o);let r=Fv.alloc(11,i,n);return r.writeLongString(o),r.buffer}static deserializeReplyErrError(i){let e=i.readLongString();return JSON.parse(e)}static _serializeReplyErrEmpty(i){return Fv.alloc(12,i,0).buffer}};var pPn=!1,mPn=!0,sz=class extends k{constructor(e,t,o,n,r,s,l){super();this._internalExtensionService=o;this._instantiationService=n;this._environmentService=r;this._telemetryService=s;this._logService=l;this._onDidChangeResponsiveState=this._register(new T);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._hasStarted=!1;this._cachedActivationEvents=new Map,this._resolvedActivationEvents=new Set,this._rpcProtocol=null,this._customers=[],this._extensionHost=e,this.onDidExit=this._extensionHost.onExit;let c={time:Date.now(),action:"starting",kind:SN(this.kind)};this._telemetryService.publicLog2("extensionHostStartup",c),this._proxy=this._extensionHost.start().then(u=>{let p={time:Date.now(),action:"success",kind:SN(this.kind)};return this._telemetryService.publicLog2("extensionHostStartup",p),this._createExtensionHostCustomers(this.kind,u)},u=>{this._logService.error(`Error received from starting extension host (kind: ${SN(this.kind)})`),this._logService.error(u);let p={time:Date.now(),action:"error",kind:SN(this.kind)};return u&&u.name&&(p.errorName=u.name),u&&u.message&&(p.errorMessage=u.message),u&&u.stack&&(p.errorStack=u.stack),this._telemetryService.publicLog2("extensionHostStartup",p),null}),this._proxy.then(()=>{this._hasStarted=!0,t.forEach(u=>this.activateByEvent(u,0)),this._register(fPn({measure:()=>this.measure()}))})}get pid(){return this._extensionHost.pid}get kind(){return this._extensionHost.runningLocation.kind}get startup(){return this._extensionHost.startup}get friendyName(){return Dji(this.kind,this.pid)}async disconnect(){await this._extensionHost?.disconnect?.()}dispose(){this._extensionHost?.dispose(),this._rpcProtocol?.dispose();for(let e=0,t=this._customers.length;e<t;e++){let o=this._customers[e];try{o.dispose()}catch(n){mt(n)}}this._proxy=null,super.dispose()}async measure(){let e=await this._proxy;if(!e)return null;let t=await this._measureLatency(e),o=await this._measureDown(e),n=await this._measureUp(e);return{remoteAuthority:this._extensionHost.remoteAuthority,latency:t,down:o,up:n}}get isReady(){return this._hasStarted}async ready(){await this._proxy}async _measureLatency(e){let o=0;for(let n=0;n<10;n++){let r=On.create();await e.test_latency(n),r.stop(),o+=r.elapsed()}return o/10}static _convert(e,t){return e*1e3*8/t}async _measureUp(e){let o=Ke.alloc(10485760),n=Math.ceil(Math.random()*256);for(let s=0;s<o.byteLength;s++)o.writeUInt8(s,n);let r=On.create();return await e.test_up(o),r.stop(),sz._convert(10485760,r.elapsed())}async _measureDown(e){let o=On.create();return await e.test_down(10485760),o.stop(),sz._convert(10485760,o.elapsed())}_createExtensionHostCustomers(e,t){let o=null;pPn||this._environmentService.logExtensionHostCommunication?o=new _ji(e):bje.isEnabled()&&(o=new bje(this._telemetryService)),this._rpcProtocol=new fei(t,o),this._register(this._rpcProtocol.onDidChangeResponsiveState(u=>this._onDidChangeResponsiveState.fire(u)));let n=null,r=[],s={remoteAuthority:this._extensionHost.remoteAuthority,extensionHostKind:this.kind,getProxy:u=>this._rpcProtocol.getProxy(u),set:(u,p)=>this._rpcProtocol.set(u,p),dispose:()=>this._rpcProtocol.dispose(),assertRegistered:u=>this._rpcProtocol.assertRegistered(u),drain:()=>this._rpcProtocol.drain(),internalExtensionService:this._internalExtensionService,_setExtensionHostProxy:u=>{n=u},_setAllMainProxyIdentifiers:u=>{r=u}},l=TMt.getNamedCustomers();for(let u=0,p=l.length;u<p;u++){let[h,g]=l[u];try{let f=this._instantiationService.createInstance(g,s);this._customers.push(f),this._rpcProtocol.set(h,f)}catch(f){this._logService.error(`Cannot instantiate named customer: '${h.sid}'`),this._logService.error(f),mt(f)}}let c=TMt.getCustomers();for(let u of c)try{let p=this._instantiationService.createInstance(u,s);this._customers.push(p)}catch(p){this._logService.error(p),mt(p)}if(!n)throw new Error("Missing IExtensionHostProxy!");return this._rpcProtocol.assertRegistered(r),n}async activate(e,t){let o=await this._proxy;return o?o.activate(e,t):!1}activateByEvent(e,t){return this._cachedActivationEvents.has(e)||this._cachedActivationEvents.set(e,this._activateByEvent(e,t)),this._cachedActivationEvents.get(e)}activationEventIsDone(e){return this._resolvedActivationEvents.has(e)}async _activateByEvent(e,t){if(!this._proxy)return;let o=await this._proxy;if(o){if(!this._extensionHost.extensions.containsActivationEvent(e)){this._resolvedActivationEvents.add(e);return}await o.activateByEvent(e,t),this._resolvedActivationEvents.add(e)}}async getInspectPort(e){if(this._extensionHost){e&&await this._extensionHost.enableInspectPort();let t=this._extensionHost.getInspectPort();if(t)return t}}async resolveAuthority(e,t){let o=On.create(!1),n=()=>`[${SN(this._extensionHost.runningLocation.kind)}${this._extensionHost.runningLocation.affinity}][resolveAuthority(${E2(e)},${t})][${o.elapsed()}ms] `,r=u=>this._logService.info(`${n()}${u}`),s=(u,p=void 0)=>this._logService.error(`${n()}${u}`,p);r("obtaining proxy...");let l=await this._proxy;if(!l)return s("no proxy"),{type:"error",error:{message:"Cannot resolve authority",code:"Unknown",detail:void 0}};r("invoking...");let c=new ky;try{c.cancelAndSet(()=>r("waiting..."),1e3);let u=await l.resolveAuthority(e,t);return c.dispose(),u.type==="ok"?r(`returned ${u.value.authority.connectTo}`):s("returned an error",u.error),u}catch(u){return c.dispose(),s("returned an error",u),{type:"error",error:{message:u.message,code:"Unknown",detail:u}}}}async getCanonicalURI(e,t){let o=await this._proxy;if(!o)throw new Error("Cannot resolve canonical URI");return o.getCanonicalURI(e,t)}async start(e,t,o){let n=await this._proxy;if(!n)return;let r=this._extensionHost.extensions.set(e,t,o);return n.startExtensionHost(r)}async extensionTestsExecute(){let e=await this._proxy;if(!e)throw new Error("Could not obtain Extension Host Proxy");return e.extensionTestsExecute()}representsRunningLocation(e){return this._extensionHost.runningLocation.equals(e)}async deltaExtensions(e){let t=await this._proxy;if(!t)return;let o=this._extensionHost.extensions.delta(e);if(o)return t.deltaExtensions(o)}containsExtension(e){return this._extensionHost.extensions?.containsExtension(e)??!1}async setRemoteEnvironment(e){let t=await this._proxy;if(t)return t.setRemoteEnvironment(e)}};sz=I([m(3,F),m(4,Mt),m(5,_e),m(6,re)],sz);function Dji(a,i){return i?`${SN(a)} pid: ${i}`:`${SN(a)}`}var hPn=[["#2977B1","#FC802D","#34A13A","#D3282F","#9366BA"],["#8B564C","#E177C0","#7F7F7F","#BBBE3D","#2EBECD"]];function _Ho(a){if(Array.isArray(a))return a;if(a&&typeof a=="object"&&typeof a.toString=="function"){let i=a.toString();if(i!=="[object Object]")return i}return a}function gPn(a){return Array.isArray(a)?a.map(_Ho):_Ho(a)}var _ji=class{constructor(i){this._kind=i;this._totalIncoming=0;this._totalOutgoing=0}_log(i,e,t,o,n,r,s){s=gPn(s);let l=hPn[n],c=mPn?l[o%l.length]:"#000000",u=[`%c[${SN(this._kind)}][${i}]%c[${String(e).padStart(7)}]%c[len: ${String(t).padStart(5)}]%c${String(o).padStart(5)} - ${r}`,"color: darkgreen","color: grey","color: grey",`color: ${c}`];/\($/.test(r)?(u=u.concat(s),u.push(")")):u.push(s),console.log.apply(console,u)}logIncoming(i,e,t,o,n){this._totalIncoming+=i,this._log("Ext \u2192 Win",this._totalIncoming,i,e,t,o,n)}logOutgoing(i,e,t,o,n){this._totalOutgoing+=i,this._log("Win \u2192 Ext",this._totalOutgoing,i,e,t,o,n)}},bje=class{constructor(i){this._telemetryService=i;this._pendingRequests=new Map}static isEnabled(){return Math.random()<1e-4}logIncoming(i,e,t,o){if(t===0&&/^receiveReply(Err)?:/.test(o)){let n=this._pendingRequests.get(e)??"unknown_reply";this._pendingRequests.delete(e),this._telemetryService.publicLog2("extensionhost.incoming",{type:`${o} ${n}`,length:i})}t===1&&/^receiveRequest /.test(o)&&this._telemetryService.publicLog2("extensionhost.incoming",{type:`${o}`,length:i})}logOutgoing(i,e,t,o){t===0&&o.startsWith("request: ")&&(this._pendingRequests.set(e,o),this._telemetryService.publicLog2("extensionhost.outgoing",{type:o,length:i}))}};bje=I([m(0,_e)],bje);var Ygt=[];function fPn(a){return Ygt.push(a),{dispose:()=>{for(let i=0;i<Ygt.length;i++)if(Ygt[i]===a){Ygt.splice(i,1);return}}}}function vPn(){return Ygt.slice(0)}W(class vei extends z{constructor(){super({id:"editor.action.measureExtHostLatency",title:P(18961,"Measure Extension Host Latency"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(ie),t=await Promise.all(vPn().map(o=>o.measure()));e.openEditor({resource:void 0,contents:t.map(vei._print).join(`

`),options:{pinned:!0}})}static _print(i){return i?`${i.remoteAuthority?`Authority: ${i.remoteAuthority}
`:""}Roundtrip latency: ${i.latency.toFixed(3)}ms
Up: ${vei._printSpeed(i.up)}
Down: ${vei._printSpeed(i.down)}
`:""}static _printSpeed(i){return i<=1024?`${i} bps`:i<1024*1024?`${(i/1024).toFixed(1)} kbps`:`${(i/1024/1024).toFixed(1)} Mbps`}});var Xae=class{constructor(i){this.affinity=i;this.kind=1}equals(i){return this.kind===i.kind&&this.affinity===i.affinity}asString(){return this.affinity===0?"LocalProcess":`LocalProcess${this.affinity}`}},yj=class{constructor(i){this.affinity=i;this.kind=2}equals(i){return this.kind===i.kind&&this.affinity===i.affinity}asString(){return this.affinity===0?"LocalWebWorker":`LocalWebWorker${this.affinity}`}},Jae=class{constructor(){this.kind=3;this.affinity=0}equals(i){return this.kind===i.kind}asString(){return"Remote"}};var Sje=class{constructor(i,e,t,o,n,r){this._registry=i;this._extensionHostKindPicker=e;this._environmentService=t;this._configurationService=o;this._logService=n;this._extensionManifestPropertiesService=r;this._runningLocation=new uu;this._maxLocalProcessAffinity=0;this._maxLocalWebWorkerAffinity=0}get maxLocalProcessAffinity(){return this._maxLocalProcessAffinity}get maxLocalWebWorkerAffinity(){return this._maxLocalWebWorkerAffinity}set(i,e){this._runningLocation.set(i,e)}readExtensionKinds(i){return i.isUnderDevelopment&&this._environmentService.extensionDevelopmentKind?this._environmentService.extensionDevelopmentKind:this._extensionManifestPropertiesService.getExtensionKind(i)}getRunningLocation(i){return this._runningLocation.get(i)||null}filterByRunningLocation(i,e){return Xgt(i,this._runningLocation,t=>e.equals(t))}filterByExtensionHostKind(i,e){return Xgt(i,this._runningLocation,t=>t.kind===e)}filterByExtensionHostManager(i,e){return Xgt(i,this._runningLocation,t=>e.representsRunningLocation(t))}_computeAffinity(i,e,t){let o=new uu;for(let p of i)(p.main||p.browser)&&o.set(p.identifier,p);for(let p of this._registry.getAllExtensionDescriptions())if(p.main||p.browser){let h=this._runningLocation.get(p.identifier);h&&h.kind===e&&o.set(p.identifier,p)}let n=new uu,r=0;for(let[p,h]of o)n.set(h.identifier,++r);let s=(p,h)=>{for(let[g,f]of n)f===p&&n.set(g,h)};for(let[p,h]of o){if(!h.extensionDependencies)continue;let g=n.get(h.identifier);for(let f of h.extensionDependencies){let v=n.get(f);v&&v!==g&&s(v,g)}}for(let[p,h]of o){if(!h.extensionAffinity)continue;if(!Va(h,"extensionAffinity")){this._logService.warn(`Extension '${h.identifier.value}' declares 'extensionAffinity' in its package.json but does not enable the 'extensionAffinity' API proposal. Add '"enabledApiProposals": ["extensionAffinity"]' to the extension's package.json to use this feature.`);continue}let g=n.get(h.identifier);for(let f of h.extensionAffinity){let v=n.get(f);v&&v!==g&&s(v,g)}}let l=new Map,c=0;for(let[p,h]of o){let g=this._runningLocation.get(h.identifier);if(g){let f=n.get(h.identifier);l.set(f,g.affinity),c=Math.max(c,g.affinity)}}if(!this._environmentService.isExtensionDevelopment){let p=this._configurationService.getValue("extensions.experimental.affinity")||{},h=Object.keys(p),g=new Map;for(let f of h){let v=p[f];if(typeof v!="number"||v<=0||Math.floor(v)!==v){this._logService.info(`Ignoring configured affinity for '${f}' because the value is not a positive integer.`);continue}let b=n.get(f);if(!b)continue;let S=l.get(b);if(S){g.set(v,S);continue}let y=g.get(v);if(y){l.set(b,y);continue}if(!t){this._logService.info(`Ignoring configured affinity for '${f}' because extension host(s) are already running. Reload window.`);continue}let w=++c;g.set(v,w),l.set(b,w)}}let u=new uu;for(let p of i){let h=n.get(p.identifier)||0,g=l.get(h)||0;u.set(p.identifier,g)}if(c>0&&t)for(let p=1;p<=c;p++){let h=[];for(let g of i)u.get(g.identifier)===p&&h.push(g.identifier);this._logService.info(`Placing extension(s) ${h.map(g=>g.value).join(", ")} on a separate extension host.`)}return{affinities:u,maxAffinity:c}}computeRunningLocation(i,e,t){return this._doComputeRunningLocation(this._runningLocation,i,e,t).runningLocation}_doComputeRunningLocation(i,e,t,o){e=e.filter(f=>!i.has(f.identifier)),t=t.filter(f=>!i.has(f.identifier));let n=xdo(e,t,f=>this.readExtensionKinds(f),(f,v,b,S,y)=>this._extensionHostKindPicker.pickExtensionHostKind(f,v,b,S,y)),r=new uu;for(let f of e)r.set(f.identifier,f);for(let f of t)r.set(f.identifier,f);let s=new uu,l=[],c=[];for(let[f,v]of n){let b=null;if(v===1){let S=r.get(f);S&&l.push(S)}else if(v===2){let S=r.get(f);S&&c.push(S)}else v===3&&(b=new Jae);s.set(f,b)}let{affinities:u,maxAffinity:p}=this._computeAffinity(l,1,o);for(let f of l){let v=u.get(f.identifier)||0;s.set(f.identifier,new Xae(v))}let{affinities:h,maxAffinity:g}=this._computeAffinity(c,2,o);for(let f of c){let v=h.get(f.identifier)||0;s.set(f.identifier,new yj(v))}for(let[f,v]of i)v&&s.set(f,v);return{runningLocation:s,maxLocalProcessAffinity:p,maxLocalWebWorkerAffinity:g}}initializeRunningLocation(i,e){let{runningLocation:t,maxLocalProcessAffinity:o,maxLocalWebWorkerAffinity:n}=this._doComputeRunningLocation(this._runningLocation,i,e,!0);this._runningLocation=t,this._maxLocalProcessAffinity=o,this._maxLocalWebWorkerAffinity=n}deltaExtensions(i,e){let t=new uu;for(let o of e){let n=o;t.set(n,this._runningLocation.get(n)||null),this._runningLocation.delete(n)}return this._updateRunningLocationForAddedExtensions(i),t}_updateRunningLocationForAddedExtensions(i){let e=[],t=[];for(let r of i){let s=this.readExtensionKinds(r),l=r.extensionLocation.scheme===Q.vscodeRemote,c=this._extensionHostKindPicker.pickExtensionHostKind(r.identifier,s,!l,l,0),u=null;c===1?e.push(r):c===2?t.push(r):c===3&&(u=new Jae),this._runningLocation.set(r.identifier,u)}let{affinities:o}=this._computeAffinity(e,1,!1);for(let r of e){let s=o.get(r.identifier)||0;this._runningLocation.set(r.identifier,new Xae(s))}let{affinities:n}=this._computeAffinity(t,2,!1);for(let r of t){let s=n.get(r.identifier)||0;this._runningLocation.set(r.identifier,new yj(s))}}};Sje=I([m(2,Mt),m(3,B),m(4,re),m(5,hm)],Sje);function Xgt(a,i,e){return a.filter(t=>{let o=i.get(t.identifier);return o&&e(o)})}function RHo(a,i,e){return a.filter(t=>{let o=i.get(t);return o&&e(o)})}var Ije=class extends k{constructor(e,t,o,n,r){super();this._initialActivationEvents=t;this._internalExtensionService=o;this._instantiationService=n;this._logService=r;this._onDidChangeResponsiveState=this._register(new T);this.onDidChangeResponsiveState=this._onDidChangeResponsiveState.event;this._extensionHost=e,this.onDidExit=e.onExit,this._startCalled=new ip,this._actual=null}get pid(){return this._actual?this._actual.pid:null}get kind(){return this._extensionHost.runningLocation.kind}get startup(){return this._extensionHost.startup}get friendyName(){return Dji(this.kind,this.pid)}dispose(){this._actual||this._extensionHost.dispose(),super.dispose()}_createActual(e){return this._logService.info(`Creating lazy extension host (${this.friendyName}). Reason: ${e}`),this._actual=this._register(this._instantiationService.createInstance(sz,this._extensionHost,this._initialActivationEvents,this._internalExtensionService)),this._register(this._actual.onDidChangeResponsiveState(t=>this._onDidChangeResponsiveState.fire(t))),this._actual}async _getOrCreateActualAndStart(e){if(this._actual)return this._actual;let t=this._createActual(e);return await t.ready(),t}get isReady(){return this._startCalled.isOpen()&&(this._actual?.isReady??!1)}async ready(){await this._startCalled.wait(),this._actual&&await this._actual.ready()}async disconnect(){await this._actual?.disconnect()}representsRunningLocation(e){return this._extensionHost.runningLocation.equals(e)}async deltaExtensions(e){if(await this._startCalled.wait(),this._actual)return this._actual.deltaExtensions(e);if(e.myToAdd.length>0){await this._createActual(`contains ${e.myToAdd.length} new extension(s) (installed or enabled): ${e.myToAdd.map(o=>o.value)}`).ready();return}}containsExtension(e){return this._extensionHost.extensions?.containsExtension(e)??!1}async activate(e,t){return await this._startCalled.wait(),this._actual?this._actual.activate(e,t):!1}async activateByEvent(e,t){if(t===1)return this._actual?this._actual.activateByEvent(e,t):void 0;if(await this._startCalled.wait(),this._actual)return this._actual.activateByEvent(e,t)}activationEventIsDone(e){return this._startCalled.isOpen()?this._actual?this._actual.activationEventIsDone(e):!0:!1}async getInspectPort(e){return await this._startCalled.wait(),this._actual?.getInspectPort(e)}async resolveAuthority(e,t){return await this._startCalled.wait(),this._actual?this._actual.resolveAuthority(e,t):{type:"error",error:{message:"Cannot resolve authority",code:"Unknown",detail:void 0}}}async getCanonicalURI(e,t){if(await this._startCalled.wait(),this._actual)return this._actual.getCanonicalURI(e,t);throw new Error("Cannot resolve canonical URI")}async start(e,t,o){if(o.length>0){let r=this._createActual(`contains ${o.length} extension(s): ${o.map(s=>s.value)}.`).ready();return this._startCalled.open(),r}this._startCalled.open()}async extensionTestsExecute(){return await this._startCalled.wait(),(await this._getOrCreateActualAndStart("execute tests.")).extensionTestsExecute()}async setRemoteEnvironment(e){if(await this._startCalled.wait(),this._actual)return this._actual.setRemoteEnvironment(e)}};Ije=I([m(3,F),m(4,re)],Ije);var Rji=Object.hasOwnProperty,bPn=Promise.resolve(void 0),ele=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M){super();this._extensionsProposedApi=t;this._extensionHostFactory=o;this._extensionHostKindPicker=n;this._instantiationService=r;this._notificationService=s;this._environmentService=l;this._telemetryService=c;this._extensionEnablementService=u;this._fileService=p;this._productService=h;this._extensionManagementService=g;this._contextService=f;this._configurationService=v;this._extensionManifestPropertiesService=b;this._logService=S;this._remoteAgentService=y;this._remoteExtensionsScannerService=w;this._lifecycleService=x;this._remoteAuthorityResolverService=E;this._dialogService=M;this._onDidRegisterExtensions=this._register(new T);this.onDidRegisterExtensions=this._onDidRegisterExtensions.event;this._onDidChangeExtensionsStatus=this._register(new T);this.onDidChangeExtensionsStatus=this._onDidChangeExtensionsStatus.event;this._onDidChangeExtensions=this._register(new T({leakWarningThreshold:400,leakWarningName:"ExtensionService._onDidChangeExtensions"}));this.onDidChangeExtensions=this._onDidChangeExtensions.event;this._onWillActivateByEvent=this._register(new T);this.onWillActivateByEvent=this._onWillActivateByEvent.event;this._onDidChangeResponsiveChange=this._register(new T);this.onDidChangeResponsiveChange=this._onDidChangeResponsiveChange.event;this._onWillStop=this._register(new T);this.onWillStop=this._onWillStop.event;this._activationEventReader=new Aji;this._registry=new hei(this._activationEventReader);this._installedExtensionsReady=new ip;this._extensionStatus=new uu;this._allRequestedActivateEvents=new Set;this._pendingRemoteActivationEvents=new Set;this._remoteCrashTracker=new ift;this._deltaExtensionsQueue=[];this._inHandleDeltaExtensions=!1;this._extensionHostManagers=this._register(new Lji);this._resolveAuthorityAttempt=0;this._initializePromise=null;this._hasLocalProcess=e.hasLocalProcess,this._allowRemoteExtensionsInLocalWebWorker=e.allowRemoteExtensionsInLocalWebWorker,this._register(this._fileService.onWillActivateFileSystemProvider(N=>{N.scheme!==Q.vscodeRemote&&N.join(this.activateByEvent(`onFileSystem:${N.scheme}`))})),this._runningLocations=new Sje(this._registry,this._extensionHostKindPicker,this._environmentService,this._configurationService,this._logService,this._extensionManifestPropertiesService),this._register(this._extensionEnablementService.onEnablementChanged(N=>{let V=[],H=[];for(let K of N)this._safeInvokeIsEnabled(K)?V.push(K):H.push(K);Pf&&this._logService.info(`AbstractExtensionService.onEnablementChanged fired for ${N.map(K=>K.identifier.id).join(", ")}`),this._handleDeltaExtensions(new Zae(V,H))})),this._register(this._extensionManagementService.onDidChangeProfile(({added:N,removed:V})=>{(N.length||V.length)&&(Pf&&this._logService.info("AbstractExtensionService.onDidChangeProfile fired"),this._handleDeltaExtensions(new Zae(N,V)))})),this._register(this._extensionManagementService.onDidEnableExtensions(N=>{N.length&&(Pf&&this._logService.info("AbstractExtensionService.onDidEnableExtensions fired"),this._handleDeltaExtensions(new Zae(N,[])))})),this._register(this._extensionManagementService.onDidInstallExtensions(N=>{let V=[],H=[];for(let{local:K,operation:j}of N)K&&K.isValid&&j!==4&&this._safeInvokeIsEnabled(K)&&(V.push(K),j===3&&H.push(K.identifier.id));V.length&&(Pf&&this._logService.info(`AbstractExtensionService.onDidInstallExtensions fired for ${V.map(K=>K.identifier.id).join(", ")}`),this._handleDeltaExtensions(new Zae(V,H)))})),this._register(this._extensionManagementService.onDidUninstallExtension(N=>{N.error||(Pf&&this._logService.info(`AbstractExtensionService.onDidUninstallExtension fired for ${N.identifier.id}`),this._handleDeltaExtensions(new Zae([],[N.identifier.id])))})),this._register(this._lifecycleService.onWillShutdown(N=>{this._remoteAgentService.getConnection()?N.join(async()=>{try{await this._remoteAgentService.endConnection(),await this._doStopExtensionHosts(),this._remoteAgentService.getConnection()?.dispose()}catch{this._logService.warn("Error while disconnecting remote agent")}},{id:"join.disconnectRemote",label:d(18951,null),order:2}):N.join(this._doStopExtensionHosts(),{id:"join.stopExtensionHosts",label:d(18960,null)})}))}_getExtensionHostManagers(e){return this._extensionHostManagers.getByKind(e)}async _handleDeltaExtensions(e){if(this._deltaExtensionsQueue.push(e),this._inHandleDeltaExtensions)return;let t=null;try{for(this._inHandleDeltaExtensions=!0,await this._installedExtensionsReady.wait(),t=await this._registry.acquireLock("handleDeltaExtensions");this._deltaExtensionsQueue.length>0;){let o=this._deltaExtensionsQueue.shift();await this._deltaExtensions(t,o.toAdd,o.toRemove)}}finally{this._inHandleDeltaExtensions=!1,t?.dispose()}}async _deltaExtensions(e,t,o){Pf&&this._logService.info(`AbstractExtensionService._deltaExtensions: toAdd: [${t.map(l=>l.identifier.id).join(",")}] toRemove: [${o.map(l=>typeof l=="string"?l:l.identifier.id).join(",")}]`);let n=[];for(let l=0,c=o.length;l<c;l++){let u=o[l],p=typeof u=="string"?u:u.identifier.id,h=typeof u=="string"?null:u,g=this._registry.getExtensionDescription(p);g&&(h&&g.extensionLocation.scheme!==h.location.scheme||this.canRemoveExtension(g)&&n.push(g))}let r=[];for(let l=0,c=t.length;l<c;l++){let u=t[l],p=C0(u,!1);p&&this._canAddExtension(p,n)&&r.push(p)}if(r.length===0&&n.length===0)return;let s=this._registry.deltaExtensions(e,r,n.map(l=>l.identifier));this._onDidChangeExtensions.fire({added:r,removed:n}),n=n.concat(s.removedDueToLooping),s.removedDueToLooping.length>0&&this._notificationService.notify({severity:ft.Error,message:d(18957,null,s.removedDueToLooping.map(l=>`'${l.identifier.value}'`).join(", "))}),this._extensionsProposedApi.updateEnabledApiProposals(r),this._doHandleExtensionPoints([].concat(r).concat(n),!1),await this._updateExtensionsOnExtHosts(s.versionId,r,n.map(l=>l.identifier));for(let l=0;l<r.length;l++)this._activateAddedExtensionIfNeeded(r[l])}async _updateExtensionsOnExtHosts(e,t,o){let n=this._runningLocations.deltaExtensions(t,o),r=this._extensionHostManagers.map(s=>this._updateExtensionsOnExtHost(s,e,t,o,n));await Promise.all(r)}async _updateExtensionsOnExtHost(e,t,o,n,r){let s=this._runningLocations.filterByExtensionHostManager(o,e),l=RHo(n,r,u=>e.representsRunningLocation(u)),c=e3.createActivationEventsMap(o);if(Pf){let u=h=>h.map(g=>g.identifier.value).join(","),p=h=>h.map(g=>g.value).join(",");this._logService.info(`AbstractExtensionService: Calling deltaExtensions: toRemove: [${p(n)}], toAdd: [${u(o)}], myToRemove: [${p(l)}], myToAdd: [${u(s)}],`)}await e.deltaExtensions({versionId:t,toRemove:n,toAdd:o,addActivationEvents:c,myToRemove:l,myToAdd:s.map(u=>u.identifier)})}canAddExtension(e){return this._canAddExtension(e,[])}_canAddExtension(e,t){if(this._registry.getExtensionDescriptionByIdOrUUID(e.identifier,e.id)&&!t.some(c=>hi.equals(e.identifier,c.identifier)))return!1;let n=this._runningLocations.readExtensionKinds(e),r=e.extensionLocation.scheme===Q.vscodeRemote;return this._extensionHostKindPicker.pickExtensionHostKind(e.identifier,n,!r,r,0)!==null}canRemoveExtension(e){let t=this._registry.getExtensionDescription(e.identifier);return!(!t||this._extensionStatus.get(t.identifier)?.activationStarted)}async _activateAddedExtensionIfNeeded(e){let t=null,o=!1,n=this._activationEventReader.readActivationEvents(e);for(let r of n){if(this._allRequestedActivateEvents.has(r)){t=r;break}if(r==="*"){t=r;break}if(/^workspaceContains/.test(r)&&(o=!0),r==="onStartupFinished"){t=r;break}}if(!t&&o){let r=await this._contextService.getCompleteWorkspace(),s=!!this._environmentService.remoteAuthority,l={logService:this._logService,folders:r.folders.map(u=>u.uri),forceUsingSearch:s,exists:u=>this._fileService.exists(u),checkExists:(u,p,h)=>this._instantiationService.invokeFunction(g=>ZRe(g,u,p,h))},c=await ppo(l,e);c&&(t=c.activationEvent)}t&&await Promise.all(this._extensionHostManagers.map(r=>r.activate(e.identifier,{startup:!1,extensionId:e.identifier,activationEvent:t})))}_initializeIfNeeded(){return this._initializePromise||(this._initializePromise=this._initialize()),this._initializePromise}async _initialize(){Wo("code/willLoadExtensions"),this._startExtensionHostsIfNecessary(!0,[]);let e=await this._registry.acquireLock("_initialize");try{await this._resolveAndProcessExtensions(e),this._startOnDemandExtensionHosts()}finally{e.dispose()}this._releaseBarrier(),Wo("code/didLoadExtensions"),this._activateDeferredRemoteEvents(),await this._handleExtensionTests()}async _activateDeferredRemoteEvents(){if(this._pendingRemoteActivationEvents.size===0)return;let e=this._getExtensionHostManagers(3);if(e.length===0){this._pendingRemoteActivationEvents.clear();return}await Promise.all(e.map(t=>t.ready()));for(let t of this._pendingRemoteActivationEvents){let o=Promise.all(e.map(n=>n.activateByEvent(t,0))).then(()=>{});this._onWillActivateByEvent.fire({event:t,activation:o,activationKind:0})}this._pendingRemoteActivationEvents.clear()}async _resolveAndProcessExtensions(e){let t=[],o=[],n=[];for await(let h of this._resolveExtensions())h instanceof Zgt&&(t=Jgt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,h.extensions,!1),this._registry.deltaExtensions(e,t,[]),this._doHandleExtensionPoints(t,!0)),h instanceof eft&&(o=Jgt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,h.extensions,!1)),h instanceof tft&&(n=Jgt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,h.extensions,!1));this._runningLocations.initializeRunningLocation(o,n),this._startExtensionHostsIfNecessary(!0,[]);let r=this._allowRemoteExtensionsInLocalWebWorker?this._runningLocations.filterByExtensionHostKind(n,2):[],s=this._hasLocalProcess?this._runningLocations.filterByExtensionHostKind(o,1):[],l=this._runningLocations.filterByExtensionHostKind(o,2);n=this._runningLocations.filterByExtensionHostKind(n,3);for(let h of r)SPn(l,h.identifier)||l.push(h);let c=n.concat(s).concat(l),u=c;if(t.length&&(u=c.filter(h=>!t.some(g=>hi.equals(g.identifier,h.identifier)&&g.extensionLocation.toString()===h.extensionLocation.toString())),c.length<u.length+t.length)){let h=t.filter(g=>!c.some(f=>hi.equals(f.identifier,g.identifier)&&f.extensionLocation.toString()===g.extensionLocation.toString()));h.length&&(this._registry.deltaExtensions(e,[],h.map(g=>g.identifier)),this._doHandleExtensionPoints(h,!0))}let p=this._registry.deltaExtensions(e,u,[]);p.removedDueToLooping.length>0&&this._notificationService.notify({severity:ft.Error,message:d(18957,null,p.removedDueToLooping.map(h=>`'${h.identifier.value}'`).join(", "))}),this._doHandleExtensionPoints(this._registry.getAllExtensionDescriptions(),!1)}async _handleExtensionTests(){if(!this._environmentService.isExtensionDevelopment||!this._environmentService.extensionTestsLocationURI)return;let e=this.findTestExtensionHost(this._environmentService.extensionTestsLocationURI);if(!e){let o=d(18956,null,this._environmentService.extensionTestsLocationURI.toString());console.error(o),this._notificationService.error(o);return}let t;try{t=await e.extensionTestsExecute(),Pf&&this._logService.info(`Extension host test runner exit code: ${t}`)}catch(o){Pf&&this._logService.error("Extension host test runner error",o),console.error(o),t=1}this._onExtensionHostExit(t)}findTestExtensionHost(e){let t=null;for(let o of this._registry.getAllExtensionDescriptions())if(Yr(e,o.extensionLocation)){t=this._runningLocations.getRunningLocation(o.identifier);break}return t===null&&(e.scheme===Q.vscodeRemote?t=new Jae:t=new Xae(0)),t!==null?this._extensionHostManagers.getByRunningLocation(t):null}_releaseBarrier(){this._installedExtensionsReady.open(),this._onDidRegisterExtensions.fire(void 0),this._onDidChangeExtensionsStatus.fire(this._registry.getAllExtensionDescriptions().map(e=>e.identifier))}async _resolveAuthorityInitial(e){for(let o=1;;o++)try{return this._resolveAuthorityWithLogging(e)}catch(n){if(mC.isNoResolverFound(n)||mC.isNotAvailable(n)||o>=5)throw n}}async _resolveAuthorityAgain(){let e=this._environmentService.remoteAuthority;if(e){this._remoteAuthorityResolverService._clearResolvedAuthority(e);try{let t=await this._resolveAuthorityWithLogging(e);this._remoteAuthorityResolverService._setResolvedAuthority(t.authority,t.options)}catch(t){this._remoteAuthorityResolverService._setResolvedAuthorityError(e,t)}}}async _resolveAuthorityWithLogging(e){let t=E2(e),o=On.create(!1);this._logService.info(`Invoking resolveAuthority(${t})...`);try{Wo(`code/willResolveAuthority/${t}`);let n=await this._resolveAuthority(e);return Wo(`code/didResolveAuthorityOK/${t}`),this._logService.info(`resolveAuthority(${t}) returned '${n.authority.connectTo}' after ${o.elapsed()} ms`),n}catch(n){throw Wo(`code/didResolveAuthorityError/${t}`),this._logService.error(`resolveAuthority(${t}) returned an error after ${o.elapsed()} ms`,n),n}}async _resolveAuthorityOnExtensionHosts(e,t){let o=this._getExtensionHostManagers(e);if(o.length===0)throw new Error("Cannot resolve authority");this._resolveAuthorityAttempt++;let n=await Promise.all(o.map(s=>s.resolveAuthority(t,this._resolveAuthorityAttempt))),r=null;for(let s of n){if(s.type==="ok")return s.value;if(!r){r=s;continue}let l=r.error.code==="Unknown",c=s.error.code==="Unknown";l&&!c&&(r=s)}throw new mC(r.error.message,r.error.code,r.error.detail)}async stopExtensionHosts(e,t){return await this._initializeIfNeeded(),this._doStopExtensionHostsWithVeto(e,t)}async _doStopExtensionHosts(){let e=[];for(let t of this._extensionStatus.values())t.activationStarted&&e.push(t.id);await this._extensionHostManagers.stopAllInReverse();for(let t of this._extensionStatus.values())t.clearRuntimeStatus();e.length>0&&this._onDidChangeExtensionsStatus.fire(e)}async _doStopExtensionHostsWithVeto(e,t=!1){if(t&&this._environmentService.isExtensionDevelopment)return!1;let o=[],n=new Set;this._onWillStop.fire({reason:e,auto:t,veto(s,l){o.push(s),typeof s=="boolean"?s===!0&&n.add(l):s.then(c=>{c&&n.add(l)}).catch(c=>{n.add(d(18954,null,l,Mn(c)))})}});let r=await UZt(o,s=>this._logService.error(s));if(!r)await this._doStopExtensionHosts();else if(!t){let s=Array.from(n);this._logService.warn(`Extension host was not stopped because of veto (stop reason: ${e}, veto reason: ${s.join(", ")})`);let{confirmed:l}=await this._dialogService.confirm({type:ft.Warning,message:d(18955,null),detail:s.length===1?s[0]:s.join(`
 -`),primaryButton:d(18958,null)});if(l)return!0}return!r}_startExtensionHostsIfNecessary(e,t){let o=[];for(let n=0;n<=this._runningLocations.maxLocalProcessAffinity;n++)o.push(new Xae(n));for(let n=0;n<=this._runningLocations.maxLocalWebWorkerAffinity;n++)o.push(new yj(n));o.push(new Jae);for(let n of o){if(this._extensionHostManagers.getByRunningLocation(n))continue;let r=this._createExtensionHostManager(n,e,t);if(r){let[s,l]=r;this._extensionHostManagers.add(s,l)}}}_createExtensionHostManager(e,t,o){let n=this._extensionHostFactory.createExtensionHost(this._runningLocations,e,t);if(!n)return null;let r=this._doCreateExtensionHostManager(n,o),s=new O;return s.add(r.onDidExit(([l,c])=>this._onExtensionHostCrashOrExit(r,l,c))),s.add(r.onDidChangeResponsiveState(l=>{this._logService.info(`Extension host (${r.friendyName}) is ${l===0?"responsive":"unresponsive"}.`),this._onDidChangeResponsiveChange.fire({extensionHostKind:r.kind,isResponsive:l===0,getInspectListener:c=>r.getInspectPort(c)})})),[r,s]}_doCreateExtensionHostManager(e,t){let o=this._acquireInternalAPI(e);return e.startup===3?this._instantiationService.createInstance(Ije,e,t,o):this._instantiationService.createInstance(sz,e,t,o)}_onExtensionHostCrashOrExit(e,t,o){if(!$0(this._environmentService).isExtensionDevHost){this._onExtensionHostCrashed(e,t,o);return}this._onExtensionHostExit(t)}_onExtensionHostCrashed(e,t,o){console.error(`Extension host (${e.friendyName}) terminated unexpectedly. Code: ${t}, Signal: ${o}`),e.kind===1?this._doStopExtensionHosts():e.kind===3&&(o&&this._onRemoteExtensionHostCrashed(e,o),this._extensionHostManagers.stopOne(e))}_getExtensionHostExitInfoWithTimeout(e){return new Promise((t,o)=>{let n=setTimeout(()=>{o(new Error("getExtensionHostExitInfo timed out"))},2e3);this._remoteAgentService.getExtensionHostExitInfo(e).then(r=>{clearTimeout(n),t(r)},o)})}async _onRemoteExtensionHostCrashed(e,t){try{let o=await this._getExtensionHostExitInfoWithTimeout(t);o&&this._logService.error(`Extension host (${e.friendyName}) terminated unexpectedly with code ${o.code}.`),this._logExtensionHostCrash(e),this._remoteCrashTracker.registerCrash(),this._remoteCrashTracker.shouldAutomaticallyRestart()?(this._logService.info("Automatically restarting the remote extension host."),this._notificationService.status(d(18952,null),{hideAfter:5e3}),this._startExtensionHostsIfNecessary(!1,Array.from(this._allRequestedActivateEvents.keys()))):this._notificationService.prompt(ft.Error,d(18953,null),[{label:d(18959,null),run:()=>{this._startExtensionHostsIfNecessary(!1,Array.from(this._allRequestedActivateEvents.keys()))}}])}catch{}}_logExtensionHostCrash(e){let t=[];for(let o of this._extensionStatus.values())o.activationStarted&&e.containsExtension(o.id)&&t.push(o.id);t.length>0?this._logService.error(`Extension host (${e.friendyName}) terminated unexpectedly. The following extensions were running: ${t.map(o=>o.value).join(", ")}`):this._logService.error(`Extension host (${e.friendyName}) terminated unexpectedly. No extensions were activated.`)}async startExtensionHosts(e){await this._doStopExtensionHosts(),e&&await this._handleDeltaExtensions(new Zae(e.toAdd,e.toRemove));let t=await this._registry.acquireLock("startExtensionHosts");try{this._startExtensionHostsIfNecessary(!1,Array.from(this._allRequestedActivateEvents.keys())),this._startOnDemandExtensionHosts();let o=this._getExtensionHostManagers(1);await Promise.all(o.map(n=>n.ready()))}finally{t.dispose()}}_startOnDemandExtensionHosts(){let e=this._registry.getSnapshot();for(let t of this._extensionHostManagers)if(t.startup!==1){let o=this._runningLocations.filterByExtensionHostManager(e.extensions,t);t.start(e.versionId,e.extensions,o.map(n=>n.identifier))}}activateByEvent(e,t=0){return this._installedExtensionsReady.isOpen()?(this._allRequestedActivateEvents.add(e),this._registry.containsActivationEvent(e)?this._activateByEvent(e,t):bPn):(this._allRequestedActivateEvents.add(e),t===1?(this._initializeIfNeeded(),this._activateByEvent(e,t)):this._installedExtensionsReady.wait().then(()=>this._activateByEvent(e,t)))}_activateByEvent(e,t){let o;t===1?(o=this._extensionHostManagers.filter(r=>r.kind===1||r.kind===2||r.isReady),this._pendingRemoteActivationEvents.add(e)):o=[...this._extensionHostManagers];let n=Promise.all(o.map(r=>r.activateByEvent(e,t))).then(()=>{});return this._onWillActivateByEvent.fire({event:e,activation:n,activationKind:t}),n}activateById(e,t){return this._activateById(e,t)}activationEventIsDone(e){return this._installedExtensionsReady.isOpen()?this._registry.containsActivationEvent(e)?this._extensionHostManagers.every(t=>t.activationEventIsDone(e)):!0:!1}whenInstalledExtensionsRegistered(){return this._installedExtensionsReady.wait()}get extensions(){return this._registry.getAllExtensionDescriptions()}_getExtensionRegistrySnapshotWhenReady(){return this._installedExtensionsReady.wait().then(()=>this._registry.getSnapshot())}getExtension(e){return this._installedExtensionsReady.wait().then(()=>this._registry.getExtensionDescription(e))}readExtensionPointContributions(e){return this._installedExtensionsReady.wait().then(()=>{let t=this._registry.getAllExtensionDescriptions(),o=[];for(let n of t)n.contributes&&Rji.call(n.contributes,e.name)&&o.push(new YRt(n,n.contributes[e.name]));return o})}getExtensionsStatus(){let e=Object.create(null);if(this._registry){let t=this._registry.getAllExtensionDescriptions();for(let o of t){let n=this._extensionStatus.get(o.identifier);e[o.identifier.value]={id:o.identifier,messages:n?.messages??[],activationStarted:n?.activationStarted??!1,activationTimes:n?.activationTimes??void 0,runtimeErrors:n?.runtimeErrors??[],runningLocation:this._runningLocations.getRunningLocation(o.identifier)}}}return e}async getInspectPorts(e,t){return(await Promise.all(this._getExtensionHostManagers(e).map(async n=>{let r=await n.getInspectPort(t);return r!==void 0&&(r={...r,devtoolsLabel:n.friendyName}),r}))).filter(so)}async setRemoteEnvironment(e){await this._extensionHostManagers.map(t=>t.setRemoteEnvironment(e))}_safeInvokeIsEnabled(e){try{return this._extensionEnablementService.isEnabled(e)}catch{return!1}}_doHandleExtensionPoints(e,t){let o=Object.create(null);for(let l of e)if(l.contributes)for(let c in l.contributes)Rji.call(l.contributes,c)&&(o[c]=!0);let n=l=>this._handleExtensionPointMessage(l),r=this._registry.getAllExtensionDescriptions(),s=zn.getExtensionPoints();Wo(t?"code/willHandleResolverExtensionPoints":"code/willHandleExtensionPoints");for(let l of s)o[l.name]&&(!t||l.canHandleResolver)&&(Wo(`code/willHandleExtensionPoint/${l.name}`),ele._handleExtensionPoint(l,r,n),Wo(`code/didHandleExtensionPoint/${l.name}`));Wo(t?"code/didHandleResolverExtensionPoints":"code/didHandleExtensionPoints")}_getOrCreateExtensionStatus(e){return this._extensionStatus.has(e)||this._extensionStatus.set(e,new Pji(e)),this._extensionStatus.get(e)}_handleExtensionPointMessage(e){this._getOrCreateExtensionStatus(e.extensionId).addMessage(e);let o=this._registry.getExtensionDescription(e.extensionId),n=`[${e.extensionId.value}]: ${e.message}`;if(e.type===ft.Error?(o&&o.isUnderDevelopment&&this._notificationService.notify({severity:ft.Error,message:n}),this._logService.error(n)):e.type===ft.Warning?(o&&o.isUnderDevelopment&&this._notificationService.notify({severity:ft.Warning,message:n}),this._logService.warn(n)):this._logService.info(n),e.extensionId&&this._environmentService.isBuilt&&!this._environmentService.isExtensionDevelopment){let{type:r,extensionId:s,extensionPointId:l,message:c}=e;this._telemetryService.publicLog2("extensionsMessage",{type:r,extensionId:s.value,extensionPointId:l,message:c})}}static _handleExtensionPoint(e,t,o){let n=[];for(let r of t)r.contributes&&Rji.call(r.contributes,e.name)&&n.push({description:r,value:r.contributes[e.name],collector:new LRt(o,r,e.name)});e.acceptUsers(n)}_acquireInternalAPI(e){return{_activateById:(t,o)=>this._activateById(t,o),_onWillActivateExtension:t=>this._onWillActivateExtension(t,e.runningLocation),_onDidActivateExtension:(t,o,n,r,s)=>this._onDidActivateExtension(t,o,n,r,s),_onDidActivateExtensionError:(t,o)=>this._onDidActivateExtensionError(t,o),_onExtensionRuntimeError:(t,o)=>this._onExtensionRuntimeError(t,o)}}async _activateById(e,t){if(!(await Promise.all(this._extensionHostManagers.map(r=>r.activate(e,t)))).some(r=>r))throw new Error(`Unknown extension ${e.value}`)}_onWillActivateExtension(e,t){this._runningLocations.set(e,t),this._getOrCreateExtensionStatus(e).onWillActivate()}_onDidActivateExtension(e,t,o,n,r){this._getOrCreateExtensionStatus(e).setActivationTimes(new QRt(t,o,n,r)),this._onDidChangeExtensionsStatus.fire([e])}_onDidActivateExtensionError(e,t){this._telemetryService.publicLog2("extensionActivationError",{extensionId:e.value,error:t.message})}_onExtensionRuntimeError(e,t){this._getOrCreateExtensionStatus(e).addRuntimeError(t),this._onDidChangeExtensionsStatus.fire([e])}};ele=I([m(4,F),m(5,Ne),m(6,Mt),m(7,_e),m(8,As),m(9,ge),m(10,Ze),m(11,Dd),m(12,Ae),m(13,B),m(14,hm),m(15,re),m(16,bo),m(17,aq),m(18,to),m(19,dd),m(20,ct)],ele);var Lji=class extends k{constructor(){super(...arguments);this._extensionHostManagers=[]}dispose(){for(let e=this._extensionHostManagers.length-1;e>=0;e--){let t=this._extensionHostManagers[e];t.extensionHost.disconnect(),t.dispose()}this._extensionHostManagers=[],super.dispose()}add(e,t){this._extensionHostManagers.push(new Mji(e,t))}async stopAllInReverse(){for(let e=this._extensionHostManagers.length-1;e>=0;e--){let t=this._extensionHostManagers[e];await t.extensionHost.disconnect(),t.dispose()}this._extensionHostManagers=[]}async stopOne(e){let t=this._extensionHostManagers.findIndex(o=>o.extensionHost===e);t>=0&&(this._extensionHostManagers.splice(t,1),await e.disconnect(),e.dispose())}getByKind(e){return this.filter(t=>t.kind===e)}getByRunningLocation(e){for(let t of this._extensionHostManagers)if(t.extensionHost.representsRunningLocation(e))return t.extensionHost;return null}*[Symbol.iterator](){for(let e of this._extensionHostManagers)yield e.extensionHost}map(e){return this._extensionHostManagers.map(t=>e(t.extensionHost))}every(e){return this._extensionHostManagers.every(t=>e(t.extensionHost))}filter(e){return this._extensionHostManagers.filter(t=>e(t.extensionHost)).map(t=>t.extensionHost)}},Mji=class{constructor(i,e){this.extensionHost=i;this.disposableStore=e}dispose(){this.disposableStore.dispose(),this.extensionHost.dispose()}},Zgt=class{constructor(i){this.extensions=i}},eft=class{constructor(i){this.extensions=i}},tft=class{constructor(i){this.extensions=i}},Zae=class{constructor(i,e){this.toAdd=i;this.toRemove=e}};function LHo(a){return!!a.activationEvents?.some(i=>i.startsWith("onResolveRemoteAuthority:"))}function Jgt(a,i,e,t,o){return e.updateEnabledApiProposals(t),MHo(a,i,t,o)}function MHo(a,i,e,t){let o=[],n=[],r=[];for(let l of e)l.isUnderDevelopment?o.push(l):(n.push(l),r.push(YT(l)));let s=i.getEnablementStates(r,t?{trusted:!0}:void 0);for(let l=0;l<s.length;l++)i.isEnabledEnablementState(s[l])?o.push(n[l]):Pf&&a.info(`filterEnabledExtensions: extension '${n[l].identifier.value}' is disabled`);return o}function PHo(a,i,e,t){return MHo(a,i,[e],t).includes(e)}function SPn(a,i){for(let e of a)if(hi.equals(e.identifier,i))return!0;return!1}var Pji=class{constructor(i){this.id=i;this._messages=[];this._activationTimes=null;this._runtimeErrors=[];this._activationStarted=!1}get messages(){return this._messages}get activationTimes(){return this._activationTimes}get runtimeErrors(){return this._runtimeErrors}get activationStarted(){return this._activationStarted}clearRuntimeStatus(){this._activationStarted=!1,this._activationTimes=null,this._runtimeErrors=[]}addMessage(i){this._messages.push(i)}setActivationTimes(i){this._activationTimes=i}addRuntimeError(i){this._runtimeErrors.push(i)}onWillActivate(){this._activationStarted=!0}},ift=class a{constructor(){this._recentCrashes=[]}static{this._TIME_LIMIT=300*1e3}static{this._CRASH_LIMIT=3}_removeOldCrashes(){let i=Date.now()-a._TIME_LIMIT;for(;this._recentCrashes.length>0&&this._recentCrashes[0].timestamp<i;)this._recentCrashes.shift()}registerCrash(){this._removeOldCrashes(),this._recentCrashes.push({timestamp:Date.now()})}shouldAutomaticallyRestart(){return this._removeOldCrashes(),this._recentCrashes.length<a._CRASH_LIMIT}},Aji=class{readActivationEvents(i){return e3.readActivationEvents(i)}},Nji=class extends k{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.activationEvents}render(e){let t=e.activationEvents||[],o=new he;if(t.length)for(let n of t)o.appendMarkdown(`- \`${n}\`
`);return{data:o,dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"activationEvents",label:d(18950,null),access:{canToggle:!1},renderer:new Vt(Nji)});var yje=class{constructor(i,e,t){this._logService=i;this._environmentService=e;if(this._envEnabledExtensions=new Set((e.extensionEnabledProposedApi??[]).map(o=>hi.toKey(o))),this._envEnablesProposedApiForAll=!e.isBuilt||e.isExtensionDevelopment&&t.quality!=="stable"||this._envEnabledExtensions.size===0&&Array.isArray(e.extensionEnabledProposedApi),this._productEnabledExtensions=new Map,t.extensionEnabledApiProposals)for(let[o,n]of Object.entries(t.extensionEnabledApiProposals)){let r=hi.toKey(o),s=n.filter(l=>k2[l]?!0:(i.warn(`Via 'product.json#extensionEnabledApiProposals' extension '${r}' wants API proposal '${l}' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.`),!1));this._productEnabledExtensions.set(r,s)}}updateEnabledApiProposals(i){for(let e of i)this.doUpdateEnabledApiProposals(e)}doUpdateEnabledApiProposals(i){let e=hi.toKey(i.identifier);if(Rr(i.enabledApiProposals)&&(i.enabledApiProposals=i.enabledApiProposals.filter(t=>{let o=!!k2[t];return o||this._logService.error(`Extension '${e}' wants API proposal '${t}' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.`),o})),this._productEnabledExtensions.has(e)){let t=this._productEnabledExtensions.get(e),o=new Set(t),n=new Set(i.enabledApiProposals),r=new Set([...n].filter(s=>!o.has(s)));r.size>0&&(this._logService.error(`Extension '${e}' appears in product.json but enables LESS API proposals than the extension wants.
package.json (LOSES): ${[...n].join(`
`)}
product.json (WINS): ${[...o].join(`
`)}
DELTA: ${[...r].join(`
`)}`),this._environmentService.isExtensionDevelopment&&(this._logService.error(`Proceeding with EXTRA proposals (${[...r].join(", ")}) because extension is in development mode. Still, this EXTENSION WILL BE BROKEN unless product.json is updated.`),t.push(...r))),i.enabledApiProposals=t;return}this._envEnablesProposedApiForAll||this._envEnabledExtensions.has(e)||!i.isBuiltin&&Rr(i.enabledApiProposals)&&(this._logService.error(`Extension '${i.identifier.value} CANNOT USE these API proposals '${i.enabledApiProposals?.join(", ")||"*"}'. You MUST start in extension development mode or use the --enable-proposed-api command line flag`),i.enabledApiProposals=[])}};yje=I([m(0,re),m(1,Mt),m(2,Ze)],yje);var Oji=class extends k{constructor(){super(...arguments);this.type="markdown"}shouldRender(e){return!!e.originalEnabledApiProposals?.length||!!e.enabledApiProposals?.length}render(e){let t=e.originalEnabledApiProposals??e.enabledApiProposals??[],o=new he;if(t.length)for(let n of t)o.appendMarkdown(`- \`${n}\`
`);return{data:o,dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"enabledApiProposals",label:d(18962,null),access:{canToggle:!1},renderer:new Vt(Oji)});var wje=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.runningLocation=e;this._initDataProvider=t;this.remoteSocketFactoryService=o;this._contextService=n;this._environmentService=r;this._telemetryService=s;this._logService=l;this._loggerService=c;this._labelService=u;this.remoteAuthorityResolverService=p;this._extensionHostDebugService=h;this._productService=g;this._signService=f;this._defaultLogLevelsService=v;this.pid=null;this.startup=1;this.extensions=null;this._onExit=this._register(new T);this.onExit=this._onExit.event;this._hasDisconnected=!1;this.remoteAuthority=this._initDataProvider.remoteAuthority,this._protocol=null,this._hasLostConnection=!1,this._terminating=!1;let b=$0(this._environmentService);this._isExtensionDevHost=b.isExtensionDevHost}start(){let e={commit:this._productService.commit,quality:this._productService.quality,addressProvider:{getAddress:async()=>{let{authority:t}=await this.remoteAuthorityResolverService.resolveAuthority(this._initDataProvider.remoteAuthority);return{connectTo:t.connectTo,connectionToken:t.connectionToken}}},remoteSocketFactoryService:this.remoteSocketFactoryService,signService:this._signService,logService:this._logService,ipcLogger:null};return this.remoteAuthorityResolverService.resolveAuthority(this._initDataProvider.remoteAuthority).then(t=>{let o={language:Kr,debugId:this._environmentService.debugExtensionHost.debugId,break:this._environmentService.debugExtensionHost.break,port:this._environmentService.debugExtensionHost.port,env:{...this._environmentService.debugExtensionHost.env,...t.options?.extensionHostEnv}},n=this._environmentService.extensionDevelopmentLocationURI,r=!0;return n&&n.length>0&&n[0].scheme===Q.file&&(r=!1),r||(o.break=!1),kWo(e,o).then(s=>{this._register(s);let{protocol:l,debugPort:c,reconnectionToken:u}=s,p=typeof c=="number";return r&&this._environmentService.isExtensionDevelopment&&this._environmentService.debugExtensionHost.debugId&&c&&this._extensionHostDebugService.attachSession(this._environmentService.debugExtensionHost.debugId,c,this._initDataProvider.remoteAuthority),l.onDidDispose(()=>{this._onExtHostConnectionLost(u)}),l.onSocketClose(()=>{this._isExtensionDevHost&&this._onExtHostConnectionLost(u)}),new Promise((h,g)=>{let f=setTimeout(()=>{g("The remote extension host took longer than 60s to send its ready message.")},6e4),v=l.onMessage(b=>{if(V7(b,1)){this._createExtHostInitData(p).then(S=>{l.send(Ke.fromString(JSON.stringify(S)))});return}if(V7(b,0)){clearTimeout(f),v.dispose(),this._protocol=l,h(l);return}console.error("received unexpected message during handshake phase from the extension host: ",b)})})})})}_onExtHostConnectionLost(e){this._hasLostConnection||(this._hasLostConnection=!0,this._isExtensionDevHost&&this._environmentService.debugExtensionHost.debugId&&this._extensionHostDebugService.close(this._environmentService.debugExtensionHost.debugId),!this._terminating&&this._onExit.fire([0,e]))}async _createExtHostInitData(e){let t=await this._initDataProvider.getInitData();this.extensions=t.extensions;let o=this._contextService.getWorkspace();return{commit:this._productService.commit,version:this._productService.version,quality:this._productService.quality,date:this._productService.date,parentPid:t.pid,environment:{isExtensionDevelopmentDebug:e,appRoot:t.appRoot,appName:this._productService.nameLong,appHost:this._productService.embedderIdentifier||"desktop",appUriScheme:this._productService.urlProtocol,isExtensionTelemetryLoggingOnly:i_e(this._productService,this._environmentService),appLanguage:Kr,extensionDevelopmentLocationURI:this._environmentService.extensionDevelopmentLocationURI,extensionTestsLocationURI:this._environmentService.extensionTestsLocationURI,globalStorageHome:t.globalStorageHome,workspaceStorageHome:t.workspaceStorageHome,extensionLogLevel:this._defaultLogLevelsService.defaultLogLevels.extensions,isSessionsWindow:this._environmentService.isSessionsWindow},workspace:this._contextService.getWorkbenchState()===1?null:{configuration:o.configuration,id:o.id,name:this._labelService.getWorkspaceLabel(o),transient:o.transient},remote:{isRemote:!0,authority:this._initDataProvider.remoteAuthority,connectionData:t.connectionData},consoleForward:{includeStack:!1,logNative:!!this._environmentService.debugExtensionHost.debugId},extensions:this.extensions.toSnapshot(),telemetryInfo:{sessionId:this._telemetryService.sessionId,machineId:this._telemetryService.machineId,sqmId:this._telemetryService.sqmId,devDeviceId:this._telemetryService.devDeviceId??this._telemetryService.machineId,firstSessionDate:this._telemetryService.firstSessionDate,msftInternal:this._telemetryService.msftInternal},remoteExtensionTips:this._productService.remoteExtensionTips,virtualWorkspaceExtensionTips:this._productService.virtualWorkspaceExtensionTips,logLevel:this._logService.getLevel(),loggers:[...this._loggerService.getRegisteredLoggers()],logsLocation:t.extensionHostLogsPath,autoStart:this.startup===1,uiKind:Ft?2:1}}getInspectPort(){}enableInspectPort(){return Promise.resolve(!1)}async disconnect(){this._protocol&&!this._hasDisconnected&&(this._protocol.send(fje(2)),this._protocol.sendDisconnect(),this._hasDisconnected=!0,await this._protocol.drain())}dispose(){super.dispose(),this._terminating=!0,this.disconnect(),this._protocol&&(this._protocol.getSocket().end(),this._protocol=null)}};wje=I([m(2,pG),m(3,Ae),m(4,Mt),m(5,_e),m(6,re),m(7,Ol),m(8,nt),m(9,dd),m(10,jR),m(11,Ze),m(12,Wae),m(13,FR)],wje);function AHo(a,i,e,t,o){let n=new uu;return a.forEach(r=>{let s=n.get(r.identifier);s&&o.warn(d(19052,null,s.extensionLocation.fsPath,r.extensionLocation.fsPath)),n.set(r.identifier,r)}),i.forEach(r=>{let s=n.get(r.identifier);if(s)if(s.isBuiltin){if(uAt(s.version,r.version)){o.warn(`Skipping extension ${r.extensionLocation.path} in favour of the builtin extension ${s.extensionLocation.path}.`);return}r.isBuiltin=!0}else o.warn(d(19052,null,s.extensionLocation.fsPath,r.extensionLocation.fsPath));else if(r.isBuiltin){o.warn(`Skipping obsolete builtin extension ${r.extensionLocation.path}`);return}n.set(r.identifier,r)}),e.forEach(r=>{let s=n.get(r.identifier);s&&o.warn(d(19053,null,s.extensionLocation.fsPath,r.extensionLocation.fsPath)),n.set(r.identifier,r)}),t.forEach(r=>{o.info(d(19051,null,r.extensionLocation.fsPath));let s=n.get(r.identifier);s&&s.isBuiltin&&(r.isBuiltin=!0),n.set(r.identifier,r)}),Array.from(n.values())}var Cje=class{constructor(i,e,t,o,n,r,s){this._notificationService=i;this._hostService=e;this._extensionsScannerService=t;this._userDataProfileService=o;this._extensionManagementService=n;this._environmentService=r;this._logService=s;this.scannedExtensions=new Promise((l,c)=>{this._scannedExtensionsResolve=l,this._scannedExtensionsReject=c})}async startScanningExtensions(){try{let i=await this._scanInstalledExtensions();this._scannedExtensionsResolve(i)}catch(i){this._scannedExtensionsReject(i)}}async _scanInstalledExtensions(){try{let i=Kr,e=await Promise.allSettled([this._extensionsScannerService.scanSystemExtensions({language:i,checkControlFile:!0}),this._extensionsScannerService.scanUserExtensions({language:i,profileLocation:this._userDataProfileService.currentProfile.extensionsResource,useCache:!0}),this._environmentService.remoteAuthority?[]:this._extensionManagementService.getInstalledWorkspaceExtensions(!1)]),t=!1,o=[];e[0].status==="fulfilled"?o=e[0].value:(t=!0,this._logService.error("Error scanning system extensions:",Dn(e[0].reason)));let n=[];e[1].status==="fulfilled"?n=e[1].value:(t=!0,this._logService.error("Error scanning user extensions:",Dn(e[1].reason)));let r=[];e[2].status==="fulfilled"?r=e[2].value:(t=!0,this._logService.error("Error scanning workspace extensions:",Dn(e[2].reason)));let s=[];try{let g=await this._extensionsScannerService.scanExtensionsUnderDevelopment([...o,...n],{language:i,includeInvalid:!0}),f=[];for(let v of g)v.isValid?s.push(v):f.push(v);f.length>0&&this._notificationService.prompt(wt.Warning,f.length===1?d(19056,null,f[0].location.fsPath,f[0].validations[0][1]):d(19055,null,f.map(v=>`'${v.location.fsPath}'`).join(", "),f.map(v=>`${v.validations[0][1]}`).join(", ")),[])}catch(g){this._logService.error(g)}let l=o.map(g=>ZZt(g,!1)),c=n.map(g=>ZZt(g,!1)),u=r.map(g=>C0(g,!1)),p=s.map(g=>ZZt(g,!0)),h=AHo(l,c,u,p,this._logService);if(!t){let g=this._extensionsScannerService.onDidChangeCache(()=>{g.dispose(),this._notificationService.prompt(wt.Error,d(19054,null),[{label:d(19057,null),run:()=>this._hostService.reload()}])});Li(5e3).then(()=>g.dispose())}return h}catch(i){return this._logService.error("Error scanning installed extensions:"),this._logService.error(i),[]}}};Cje=I([m(0,Ne),m(1,ti),m(2,N7),m(3,gn),m(4,Dd),m(5,Mt),m(6,re)],Cje);var Fji=class a{constructor(i){this.pipeName=i;this.type=1}static{this.ENV_KEY="VSCODE_EXTHOST_IPC_HOOK"}serialize(i){i[a.ENV_KEY]=this.pipeName}},Wji=class a{constructor(){this.type=2}static{this.ENV_KEY="VSCODE_EXTHOST_WILL_SEND_SOCKET"}serialize(i){i[a.ENV_KEY]="1"}},oft=class a{constructor(){this.type=3}static{this.ENV_KEY="VSCODE_WILL_SEND_MESSAGE_PORT"}serialize(i){i[a.ENV_KEY]="1"}};function IPn(a){delete a[Fji.ENV_KEY],delete a[Wji.ENV_KEY],delete a[oft.ENV_KEY]}function NHo(a,i){IPn(i),a.serialize(i)}var Vji=class{constructor(i,e){this._extensionHostStarter=e;this._id=i}get onStdout(){return this._extensionHostStarter.onDynamicStdout(this._id)}get onStderr(){return this._extensionHostStarter.onDynamicStderr(this._id)}get onMessage(){return this._extensionHostStarter.onDynamicMessage(this._id)}get onExit(){return this._extensionHostStarter.onDynamicExit(this._id)}start(i){return this._extensionHostStarter.start(this._id,i)}enableInspectPort(){return this._extensionHostStarter.enableInspectPort(this._id)}waitForExit(i){return this._extensionHostStarter.waitForExit(this._id,i)}kill(){return this._extensionHostStarter.kill(this._id)}},xje=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x){super();this.runningLocation=e;this.startup=t;this._initDataProvider=o;this._contextService=n;this._notificationService=r;this._nativeHostService=s;this._lifecycleService=l;this._environmentService=c;this._userDataProfilesService=u;this._telemetryService=p;this._logService=h;this._loggerService=g;this._labelService=f;this._extensionHostDebugService=v;this._hostService=b;this._productService=S;this._shellEnvironmentService=y;this._extensionHostStarter=w;this._defaultLogLevelsService=x;this.pid=null;this.remoteAuthority=null;this.extensions=null;this._onExit=this._register(new T);this.onExit=this._onExit.event;this._onDidSetInspectPort=this._register(new T);let E=$0(this._environmentService);this._isExtensionDevHost=E.isExtensionDevHost,this._isExtensionDevDebug=E.isExtensionDevDebug,this._isExtensionDevDebugBrk=E.isExtensionDevDebugBrk,this._isExtensionDevTestFromCli=E.isExtensionDevTestFromCli,this._terminating=!1,this._mainProcessHandlesExtHostShutdown=!1,this._inspectListener=null,this._extensionHostProcess=null,this._messageProtocol=null,this._register(this._lifecycleService.onWillShutdown(M=>this._onWillShutdown(M))),this._register(this._extensionHostDebugService.onClose(M=>{this._isExtensionDevHost&&this._environmentService.debugExtensionHost.debugId===M.sessionId&&this._nativeHostService.closeWindow()})),this._register(this._extensionHostDebugService.onReload(M=>{this._isExtensionDevHost&&this._environmentService.debugExtensionHost.debugId===M.sessionId&&this._hostService.reload()}))}dispose(){this._terminating||(this._terminating=!0),super.dispose(),this._messageProtocol=null}async disconnect(){if(this._terminating=!0,this._messageProtocol)try{(await Promise.race([this._messageProtocol.then(t=>t,()=>{}),Li(1e3).then(()=>{})]))?.send(fje(2))}catch{}this._extensionHostProcess&&!this._mainProcessHandlesExtHostShutdown&&this._extensionHostProcess.waitForExit(mHo).catch(()=>{}),this._messageProtocol=null}start(){if(this._terminating)throw new qi;return this._messageProtocol||(this._messageProtocol=this._start()),this._messageProtocol}async _start(){let[e,t,o]=await Promise.all([this._extensionHostStarter.createExtensionHost(),this._tryFindDebugPort(),this._shellEnvironmentService.getShellEnv()]);this._extensionHostProcess=new Vji(e.id,this._extensionHostStarter);let n=Cp(o,{VSCODE_ESM_ENTRYPOINT:"vs/workbench/api/node/extensionHostProcess",VSCODE_HANDLES_UNCAUGHT_ERRORS:!0});this._environmentService.debugExtensionHost.env&&Cp(n,this._environmentService.debugExtensionHost.env),cko(n),this._isExtensionDevHost&&delete n.VSCODE_CODE_CACHE_PATH;let r={responseWindowId:this._nativeHostService.windowId,responseChannel:"vscode:startExtensionHostMessagePortResult",responseNonce:ht(),env:n,detached:!!ii,execArgv:void 0,silent:!0},s="127.0.0.1";t!==0?r.execArgv=["--nolazy",(this._isExtensionDevDebugBrk?"--inspect-brk=":"--inspect=")+`${s}:${t}`]:r.execArgv=["--inspect-port=0"],this._environmentService.extensionTestsLocationURI&&r.execArgv.unshift("--expose-gc"),this._environmentService.args["prof-v8-extensions"]&&r.execArgv.unshift("--prof"),r.execArgv.unshift("--dns-result-order=ipv4first","--experimental-network-inspection");let l=this._register(this._handleProcessOutputStream(this._extensionHostProcess.onStdout)),c=this._register(this._handleProcessOutputStream(this._extensionHostProcess.onStderr)),u=U.any(U.map(l.event,f=>({data:`%c${f}`,format:[""]})),U.map(c.event,f=>({data:`%c${f}`,format:["color: red"]}))),p=U.debounce(u,(f,v)=>f?{data:f.data+v.data,format:[...f.format,...v.format]}:{data:v.data,format:v.format},100);this._register(p(f=>{let v=f.data&&f.data.match(/ws:\/\/([^\s]+):(\d+)\/([^\s]+)/);if(v){let[,b,S,y]=v,w=`devtools://devtools/bundled/js_app.html?v8only=true&ws=${b}:${S}/${y}`;!this._environmentService.isBuilt&&!this._isExtensionDevTestFromCli&&console.debug(`%c[Extension Host] %cdebugger inspector at ${w}`,"color: blue","color:"),(!this._inspectListener||!this._inspectListener.devtoolsUrl)&&(this._inspectListener={host:b,port:Number(S),devtoolsUrl:w},this._onDidSetInspectPort.fire())}else this._isExtensionDevTestFromCli||(console.group("Extension Host"),console.log(f.data,...f.format),console.groupEnd())})),this._register(this._extensionHostProcess.onExit(({code:f,signal:v})=>this._onExtHostProcessExit(f,v))),t&&(this._isExtensionDevHost&&this._isExtensionDevDebug&&this._environmentService.debugExtensionHost.debugId&&this._extensionHostDebugService.attachSession(this._environmentService.debugExtensionHost.debugId,t),this._inspectListener={port:t,host:s},this._onDidSetInspectPort.fire());let h;(!this._environmentService.isBuilt&&!this._environmentService.remoteAuthority||this._isExtensionDevHost)&&(h=setTimeout(()=>{this._logService.error(`[LocalProcessExtensionHost]: Extension host did not start in 10 seconds (debugBrk: ${this._isExtensionDevDebugBrk})`);let f=this._isExtensionDevDebugBrk?d(19059,null):d(19058,null);this._notificationService.prompt(ft.Warning,f,[{label:d(19061,null),run:()=>this._hostService.reload()}],{sticky:!0,priority:3})},1e4));let g=await this._establishProtocol(this._extensionHostProcess,r);return await this._performHandshake(g),clearTimeout(h),g}async _tryFindDebugPort(){if(typeof this._environmentService.debugExtensionHost.port!="number")return 0;let e=this._environmentService.debugExtensionHost.port,t=await this._nativeHostService.findFreePort(e,10,5e3,2048);return this._isExtensionDevTestFromCli||(t?(t!==e&&console.warn(`%c[Extension Host] %cProvided debugging port ${e} is not free, using ${t} instead.`,"color: blue","color:"),this._isExtensionDevDebugBrk?console.warn(`%c[Extension Host] %cSTOPPED on first line for debugging on port ${t}`,"color: blue","color:"):console.debug(`%c[Extension Host] %cdebugger listening on port ${t}`,"color: blue","color:")):console.warn("%c[Extension Host] %cCould not find a free port for debugging","color: blue","color:")),t||0}_establishProtocol(e,t){NHo(new oft,t.env);let o=rz(void 0,t.responseChannel,t.responseNonce);return new Promise((n,r)=>{let s=setTimeout(()=>{r("The local extension host took longer than 60s to connect.")},6e4);o.then(c=>{this._register(ee(()=>{c.close(),c.onmessage=null})),clearTimeout(s);let u=new o8;c.onmessage=(p=>{p.data&&u.fire(Ke.wrap(p.data))}),c.start(),n({onMessage:u.event,send:p=>c.postMessage(p.buffer)})});let l=On.create(!1);e.start(t).then(({pid:c})=>{c&&(this.pid=c),this._logService.info(`Started local extension host with pid ${c}.`);let u=l.elapsed();Pf&&this._logService.info(`IExtensionHostStarter.start() took ${u} ms.`)},c=>{r(c)})})}_performHandshake(e){return new Promise((t,o)=>{let n,r=()=>{n=setTimeout(()=>{o("The local extension host took longer than 60s to send its ready message.")},6e4)},s=()=>{clearTimeout(n)};r();let l=e.onMessage(c=>{if(V7(c,1)){s(),this._createExtHostInitData().then(u=>{r(),e.send(Ke.fromString(JSON.stringify(u)))});return}if(V7(c,0)){s(),l.dispose(),t();return}console.error("received unexpected message during handshake phase from the extension host: ",c)})})}async _createExtHostInitData(){let e=await this._initDataProvider.getInitData();this.extensions=e.extensions;let t=this._contextService.getWorkspace();return{commit:this._productService.commit,version:this._productService.version,quality:this._productService.quality,date:this._productService.date,parentPid:0,environment:{isExtensionDevelopmentDebug:this._isExtensionDevDebug,appRoot:this._environmentService.appRoot?A.file(this._environmentService.appRoot):void 0,appName:this._productService.nameLong,appHost:(this._environmentService.isSessionsWindow?this._productService.agentsTelemetryAppName:void 0)||this._productService.embedderIdentifier||"desktop",appUriScheme:this._productService.urlProtocol,isExtensionTelemetryLoggingOnly:i_e(this._productService,this._environmentService),isPortable:this._environmentService.isPortable,appLanguage:Kr,extensionDevelopmentLocationURI:this._environmentService.extensionDevelopmentLocationURI,extensionTestsLocationURI:this._environmentService.extensionTestsLocationURI,globalStorageHome:this._userDataProfilesService.defaultProfile.globalStorageHome,workspaceStorageHome:this._environmentService.workspaceStorageHome,extensionLogLevel:this._defaultLogLevelsService.defaultLogLevels.extensions,isSessionsWindow:this._environmentService.isSessionsWindow},workspace:this._contextService.getWorkbenchState()===1?void 0:{configuration:t.configuration??void 0,id:t.id,name:this._labelService.getWorkspaceLabel(t),isUntitled:t.configuration?rM(t.configuration,this._environmentService):!1,transient:t.transient},remote:{authority:this._environmentService.remoteAuthority,connectionData:null,isRemote:!1},consoleForward:{includeStack:!this._isExtensionDevTestFromCli&&(this._isExtensionDevHost||!this._environmentService.isBuilt||this._productService.quality!=="stable"||this._environmentService.verbose),logNative:!this._isExtensionDevTestFromCli&&this._isExtensionDevHost},extensions:this.extensions.toSnapshot(),telemetryInfo:{sessionId:this._telemetryService.sessionId,machineId:this._telemetryService.machineId,sqmId:this._telemetryService.sqmId,devDeviceId:this._telemetryService.devDeviceId??this._telemetryService.machineId,firstSessionDate:this._telemetryService.firstSessionDate,msftInternal:this._telemetryService.msftInternal},remoteExtensionTips:this._productService.remoteExtensionTips,virtualWorkspaceExtensionTips:this._productService.virtualWorkspaceExtensionTips,logLevel:this._logService.getLevel(),loggers:[...this._loggerService.getRegisteredLoggers()],logsLocation:this._environmentService.extHostLogsPath,autoStart:this.startup===1,uiKind:1,handle:this._environmentService.window.handle?gc(this._environmentService.window.handle):void 0}}_onExtHostProcessExit(e,t){this._terminating||this._onExit.fire([e,t])}_handleProcessOutputStream(e){let t="",o=!1,n=new T;return e(r=>{t+=r;let s=t.split(/\r?\n/g);t=s.pop(),t.length>1e4&&(s.push(t),t="");for(let l of s)o?l==="END_NATIVE_LOG"&&(o=!1):l==="START_NATIVE_LOG"?o=!0:l.length&&n.fire(l+`
`)},void 0,this._store),n}async enableInspectPort(){return this._inspectListener?!0:!this._extensionHostProcess||!await this._extensionHostProcess.enableInspectPort()?!1:(await Promise.race([U.toPromise(this._onDidSetInspectPort.event),Li(1e3)]),!!this._inspectListener)}getInspectPort(){return this._inspectListener??void 0}_onWillShutdown(e){this._mainProcessHandlesExtHostShutdown=!0,this._isExtensionDevHost&&!this._isExtensionDevTestFromCli&&!this._isExtensionDevDebug&&this._environmentService.debugExtensionHost.debugId&&(this._extensionHostDebugService.terminateSession(this._environmentService.debugExtensionHost.debugId),e.join(Li(100),{id:"join.extensionDevelopment",label:d(19060,null)}))}};xje=I([m(3,Ae),m(4,Ne),m(5,wo),m(6,to),m(7,Jr),m(8,hn),m(9,_e),m(10,re),m(11,Ol),m(12,nt),m(13,jR),m(14,ti),m(15,Ze),m(16,lye),m(17,oei),m(18,FR)],xje);var nft=class extends ele{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N){let V=e.createInstance(yje),H=e.createInstance(Cje),K=new rft(V,H,()=>this._getExtensionRegistrySnapshotWhenReady(),e,o,r,p,f,S,g);super({hasLocalProcess:!0,allowRemoteExtensionsInLocalWebWorker:!1},V,K,new mye(o,p,g),e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,N);this._nativeHostService=y;this._hostService=w;this._remoteExplorerService=x;this._extensionGalleryService=E;this._workspaceTrustManagementService=M;this._localCrashTracker=new ift;this._extensionScanner=H,b.when(2).then(()=>{Ff(ut,()=>{this._initializeIfNeeded()},50)})}async _scanAllLocalExtensions(){return this._extensionScanner.scannedExtensions}_onExtensionHostCrashed(e,t,o){let n=[],r=this.getExtensionsStatus();for(let s of Object.keys(r)){let l=r[s];l.activationStarted&&e.containsExtension(l.id)&&n.push(l.id)}if(super._onExtensionHostCrashed(e,t,o),e.kind===1){if(t===55){this._notificationService.prompt(ft.Error,d(19067,null),[{label:d(19072,null),run:()=>{this._instantiationService.invokeFunction(s=>{s.get(ti).restart()})}}]);return}if(this._logExtensionHostCrash(e),this._sendExtensionHostCrashTelemetry(t,o,n),this._localCrashTracker.registerCrash(),this._localCrashTracker.shouldAutomaticallyRestart())this._logService.info("Automatically restarting the extension host."),this._notificationService.status(d(19065,null),{hideAfter:5e3}),this.startExtensionHosts();else{let s=[];this._environmentService.isBuilt?s.push({label:d(19077,null),run:()=>{this._instantiationService.invokeFunction(l=>{l.get(fe).executeCommand("extension.bisect.start")})}}):s.push({label:d(19062,null),run:()=>this._nativeHostService.openDevTools()}),s.push({label:d(19074,null),run:()=>this.startExtensionHosts()}),this._environmentService.isBuilt&&s.push({label:d(19071,null),run:()=>{this._instantiationService.invokeFunction(l=>{l.get(Je).open("https://aka.ms/vscode-extension-bisect")})}}),this._notificationService.prompt(ft.Error,d(19066,null),s)}}}_sendExtensionHostCrashTelemetry(e,t,o){this._telemetryService.publicLog2("extensionHostCrash",{code:e,signal:t,extensionIds:o.map(n=>n.value)});for(let n of o)this._telemetryService.publicLog2("extensionHostCrashExtension",{code:e,signal:t,extensionId:n.value})}async _resolveAuthority(e){if(e.indexOf("+")===-1){let{host:o,port:n}=xio(e);return{authority:{authority:e,connectTo:{type:0,host:o,port:n},connectionToken:void 0}}}return this._resolveAuthorityOnExtensionHosts(1,e)}async _getCanonicalURI(e,t){if(e.indexOf("+")===-1)return t;let n=this._getExtensionHostManagers(1);if(n.length===0)throw new Error("Cannot resolve canonical URI");let r=await Promise.all(n.map(s=>s.getCanonicalURI(e,t)));for(let s of r)if(s)return s;throw new Error(`Cannot get canonical URI because no extension is installed to resolve ${E2(e)}`)}_resolveExtensions(){return new Fp(e=>this._doResolveExtensions(e))}async _doResolveExtensions(e){this._extensionScanner.startScanningExtensions();let t=this._environmentService.remoteAuthority,o=null,n=[];if(t){this._remoteAuthorityResolverService._setCanonicalURIProvider(async p=>{if(p.scheme!==Q.vscodeRemote||p.authority!==t)return p;Wo(`code/willGetCanonicalURI/${E2(t)}`),Pf&&this._logService.info(`Invoking getCanonicalURI for authority ${E2(t)}...`);try{return this._getCanonicalURI(t,p)}finally{Wo(`code/didGetCanonicalURI/${E2(t)}`),Pf&&this._logService.info(`getCanonicalURI returned for authority ${E2(t)}.`)}}),Pf&&this._logService.info("Starting to wait on IWorkspaceTrustManagementService.workspaceResolved..."),await this._workspaceTrustManagementService.workspaceResolved,Pf&&this._logService.info("Finished waiting on IWorkspaceTrustManagementService.workspaceResolved.");let s=(await this._scanAllLocalExtensions()).filter(p=>LHo(p));s.length&&e.emitOne(new Zgt(s));let l;try{l=await this._resolveAuthorityInitial(t)}catch(p){return mC.isNoResolverFound(p)?p.isHandled=await this._handleNoResolverFound(t):mC.isHandled(p)&&console.log("Error handled: Not showing a notification for the error"),this._remoteAuthorityResolverService._setResolvedAuthorityError(t,p),this._startLocalExtensionHost(e)}this._remoteAuthorityResolverService._setResolvedAuthority(l.authority,l.options),this._remoteExplorerService.setTunnelInformation(l.tunnelInformation);let c=this._remoteAgentService.getConnection();if(c&&(this._register(c.onDidStateChange(async p=>{p.type===0&&this._remoteAuthorityResolverService._clearResolvedAuthority(t)})),this._register(c.onReconnecting(()=>this._resolveAuthorityAgain()))),[o,n]=await Promise.all([this._remoteAgentService.getEnvironment(),this._remoteExtensionsScannerService.scanExtensions()]),!o)return this._notificationService.notify({severity:ft.Error,message:d(19068,null)}),this._startLocalExtensionHost(e);let u=o.useHostProxy;this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("http.useLocalProxyConfiguration")&&Kbi(this._configurationService.getValue("http.useLocalProxyConfiguration"),u)})),Kbi(this._configurationService.getValue("http.useLocalProxyConfiguration"),u)}else this._remoteAuthorityResolverService._setCanonicalURIProvider(async r=>r);return this._startLocalExtensionHost(e,n)}async _startLocalExtensionHost(e,t=[]){await this._workspaceTrustManagementService.workspaceTrustInitialized,t.length&&e.emitOne(new tft(t)),e.emitOne(new eft(await this._scanAllLocalExtensions()))}async _onExtensionHostExit(e){await this._doStopExtensionHosts(),this._remoteAgentService.getConnection()?.dispose(),$0(this._environmentService).isExtensionDevTestFromCli?(Pf&&this._logService.info(`Asking native host service to exit with code ${e}.`),this._nativeHostService.exit(e)):this._nativeHostService.closeWindow()}async _handleNoResolverFound(e){let t=Gb(e),o=this._productService.remoteExtensionTips?.[t];if(!o)return!1;let n=o.extensionId,s=(await this._scanAllLocalExtensions()).filter(l=>l.identifier.value===n)[0];if(s){if(!PHo(this._logService,this._extensionEnablementService,s,!1)){let l=d(19064,null,o.friendlyName);this._notificationService.prompt(ft.Info,l,[{label:d(19063,null),run:async()=>{await this._extensionEnablementService.setEnablement([YT(s)],12),await this._hostService.reload()}}],{sticky:!0,priority:3})}}else{let l=d(19070,null,o.friendlyName);this._notificationService.prompt(ft.Info,l,[{label:d(19069,null),run:async()=>{let[c]=await this._extensionGalleryService.getExtensions([{id:n}],Ie.None);c?(await this._extensionManagementService.installFromGallery(c),await this._hostService.reload()):this._notificationService.error(d(19073,null))}}],{sticky:!0,priority:3})}return!0}};nft=I([m(0,F),m(1,Ne),m(2,Mt),m(3,_e),m(4,As),m(5,ge),m(6,Ze),m(7,Dd),m(8,Ae),m(9,B),m(10,hm),m(11,re),m(12,bo),m(13,aq),m(14,to),m(15,dd),m(16,wo),m(17,ti),m(18,Wu),m(19,ga),m(20,Or),m(21,ct)],nft);var rft=class{constructor(i,e,t,o,n,r,s,l,c,u){this._extensionsProposedApi=i;this._extensionScanner=e;this._getExtensionRegistrySnapshotWhenReady=t;this._instantiationService=o;this._extensionEnablementService=r;this._remoteAgentService=l;this._remoteAuthorityResolverService=c;this._logService=u;this._webWorkerExtHostEnablement=OHo(n,s)}createExtensionHost(i,e,t){switch(e.kind){case 1:{let o=t?2:1;return this._instantiationService.createInstance(xje,e,o,this._createLocalProcessExtensionHostDataProvider(i,t,e))}case 2:{if(this._webWorkerExtHostEnablement!==0){let o=this._webWorkerExtHostEnablement===2?3:2;return this._instantiationService.createInstance(vje,e,o,this._createWebWorkerExtensionHostDataProvider(i,e))}return null}case 3:{let o=this._remoteAgentService.getConnection();return o?this._instantiationService.createInstance(wje,e,this._createRemoteExtensionHostDataProvider(i,o.remoteAuthority)):null}}}_createLocalProcessExtensionHostDataProvider(i,e,t){return{getInitData:async()=>{if(e){let o=await this._extensionScanner.scannedExtensions;Pf&&this._logService.info(`NativeExtensionHostFactory._createLocalProcessExtensionHostDataProvider.scannedExtensions: ${o.map(c=>c.identifier.value).join(",")}`);let n=Jgt(this._logService,this._extensionEnablementService,this._extensionsProposedApi,o,!0);Pf&&this._logService.info(`NativeExtensionHostFactory._createLocalProcessExtensionHostDataProvider.localExtensions: ${n.map(c=>c.identifier.value).join(",")}`);let r=i.computeRunningLocation(n,[],!1),s=Xgt(n,r,c=>t.equals(c)),l=new ope(0,n,s.map(c=>c.identifier));return Pf&&this._logService.info(`NativeExtensionHostFactory._createLocalProcessExtensionHostDataProvider.myExtensions: ${s.map(c=>c.identifier.value).join(",")}`),{extensions:l}}else{let o=await this._getExtensionRegistrySnapshotWhenReady(),n=i.filterByRunningLocation(o.extensions,t);return{extensions:new ope(o.versionId,o.extensions,n.map(s=>s.identifier))}}}}}_createWebWorkerExtensionHostDataProvider(i,e){return{getInitData:async()=>{let t=await this._getExtensionRegistrySnapshotWhenReady(),o=i.filterByRunningLocation(t.extensions,e);return{extensions:new ope(t.versionId,t.extensions,o.map(r=>r.identifier))}}}}_createRemoteExtensionHostDataProvider(i,e){return{remoteAuthority:e,getInitData:async()=>{let t=await this._getExtensionRegistrySnapshotWhenReady(),o=await this._remoteAgentService.getEnvironment();if(!o)throw new Error("Cannot provide init data for remote extension host!");let n=i.filterByExtensionHostKind(t.extensions,3),r=new ope(t.versionId,t.extensions,n.map(s=>s.identifier));return{connectionData:this._remoteAuthorityResolverService.getConnectionData(e),pid:o.pid,appRoot:o.appRoot,extensionHostLogsPath:o.extensionHostLogsPath,globalStorageHome:o.globalStorageHome,workspaceStorageHome:o.workspaceStorageHome,extensions:r}}}}};rft=I([m(3,F),m(4,Mt),m(5,As),m(6,B),m(7,bo),m(8,dd),m(9,re)],rft);function OHo(a,i){if(a.isExtensionDevelopment&&a.extensionDevelopmentKind?.some(e=>e==="web"))return 1;{let e=i.getValue(XRt);return e===!0?1:e==="auto"?2:0}}var mye=class{constructor(i,e,t){this._logService=t;this._hasRemoteExtHost=!!i.remoteAuthority;let o=OHo(i,e);this._hasWebWorkerExtHost=o!==0}pickExtensionHostKind(i,e,t,o,n){let r=mye.pickExtensionHostKind(e,t,o,n,this._hasRemoteExtHost,this._hasWebWorkerExtHost);return this._logService.trace(`pickRunningLocation for ${i.value}, extension kinds: [${e.join(", ")}], isInstalledLocally: ${t}, isInstalledRemotely: ${o}, preference: ${Cdo(n)} => ${SN(r)}`),r}static pickExtensionHostKind(i,e,t,o,n,r){let s=[];for(let l of i){if(l==="ui"&&e){if(o===0||o===1)return 1;s.push(1)}if(l==="workspace"&&t){if(o===0||o===2)return 3;s.push(3)}if(l==="workspace"&&!n){if(o===0||o===1)return 1;s.push(1)}if(l==="web"&&e&&r){if(o===0||o===1)return 2;s.push(2)}}return s.length>0?s[0]:null}};mye=I([m(0,Mt),m(1,B),m(2,re)],mye);var Bji=class extends z{constructor(){super({id:"workbench.action.restartExtensionHost",title:P(19075,"Restart Extension Host"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(lt);await e.stopExtensionHosts(d(19076,null))&&e.startExtensionHosts()}};W(Bji);Ce(lt,nft,0);var sft=class extends k1t{constructor(i,e,t,o){super(!1,i,e,t,o)}};sft=I([m(0,rm),m(1,hn),m(2,de),m(3,re)],sft);Ce(WW,sft,1);var hye=class extends Ohe{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e,t,o,n,l,c,p,h);this.nativeHostService=r;this.instantiationService=s;this.dialogService=u;this.skipUnloadConfirmation=!1;this.maximized=!1;this.alwaysOnTop=!1;et||this.handleMaximizedState(),this.handleFullScreenState(),this.handleAlwaysOnTopState()}handleMaximizedState(){(async()=>this.maximized=await this.nativeHostService.isMaximized({targetWindowId:this.window.vscodeWindowId}))(),this._register(this.nativeHostService.onDidMaximizeWindow(e=>{e===this.window.vscodeWindowId&&(this.maximized=!0)})),this._register(this.nativeHostService.onDidUnmaximizeWindow(e=>{e===this.window.vscodeWindowId&&(this.maximized=!1)}))}handleAlwaysOnTopState(){(async()=>this.alwaysOnTop=await this.nativeHostService.isWindowAlwaysOnTop({targetWindowId:this.window.vscodeWindowId}))(),this._register(this.nativeHostService.onDidChangeWindowAlwaysOnTop(({windowId:e,alwaysOnTop:t})=>{e===this.window.vscodeWindowId&&(this.alwaysOnTop=t)}))}async handleFullScreenState(){await this.nativeHostService.isFullScreen({targetWindowId:this.window.vscodeWindowId})&&Gj(!0,this.window)}async handleVetoBeforeClose(e,t){this.preventUnload(e),await this.dialogService.error(t,d(18696,null))}async confirmBeforeClose(e){if(this.skipUnloadConfirmation)return;this.preventUnload(e),await this.instantiationService.invokeFunction(o=>hye.confirmOnShutdown(o,1))&&(this.skipUnloadConfirmation=!0,this.nativeHostService.closeWindow({targetWindowId:this.window.vscodeWindowId}))}preventUnload(e){e.preventDefault(),e.returnValue=!0}createState(){let e=super.createState(),t=rx(this.window);return{...e,bounds:e.bounds,mode:this.maximized?0:t?2:1,alwaysOnTop:this.alwaysOnTop}}};hye=I([m(3,B),m(4,wo),m(5,F),m(6,ti),m(7,Mt),m(8,ct),m(9,Xe),m(10,wi)],hye);var aft=class extends $8{constructor(e,t,o,n,r,s,l,c,u){super(e,n,t,s,l,c,u);this.nativeHostService=o;this.instantiationService=r}async resolveWindowId(e){Wo("code/auxiliaryWindow/willResolveWindowId");let t=await e.vscode.ipcRenderer.invoke("vscode:registerAuxiliaryWindow",this.nativeHostService.windowId);return Wo("code/auxiliaryWindow/didResolveWindowId"),Aw(typeof t=="number"),t}createContainer(e,t,o){let n;return typeof o?.zoomLevel=="number"?n=o.zoomLevel:n=nx(zi()),gj(n,e),super.createContainer(e,t)}createAuxiliaryWindow(e,t,o){return new hye(e,t,o,this.configurationService,this.nativeHostService,this.instantiationService,this.hostService,this.environmentService,this.dialogService,this.contextMenuService,this.layoutService)}};aft=I([m(0,wi),m(1,B),m(2,wo),m(3,ct),m(4,F),m(5,_e),m(6,ti),m(7,Mt),m(8,Xe)],aft);Ce(RR,aft,1);var lft=class extends J$e{constructor(i,e,t,o,n){super(A.file(i.extensionsPath),e,t,o,n)}};lft=I([m(0,Ix),m(1,ge),m(2,hn),m(3,gt),m(4,re)],lft);Ce($ae,lft,1);_w(Dqt,"sandboxHelper");_w(cFe,"webContentExtractor");lv(foe,"sharedWebContentExtractor");var wPn="ahp",CPn=75*1024*1024,xPn=5,tle=class extends k{constructor(e,t,o){super();this._options=e;this._fileService=t;this._logService=o;this._currentSize=0;this._segment=0;this._queue=Promise.resolve();this._directory=Ve(this._options.logsHome,wPn);let n=EPn(this._options.connectionId).slice(0,64);this._baseName=`ahp-${kPn(new Date)}-${n}.jsonl`,this._maxFileSizeBytes=this._options.maxFileSizeBytes??CPn,this._maxFiles=this._options.maxFiles??xPn,this._currentFile=Ve(this._directory,this._baseName)}get resource(){return this._currentFile}log(e,t,o){let n={...e,_ahpLog:{ts:new Date().toISOString(),dir:t,connectionId:this._options.connectionId,transport:this._options.transport,...typeof o=="number"?{byteLength:o}:{}}},r=`${JSON.stringify(n)}
`,s=Ke.fromString(r);this._queue=this._queue.then(()=>this._appendLine(s)).catch(l=>{this._logService.error("[AHPLog] Failed to write transport log",l)})}async flush(){await this._queue}async _appendLine(e){this._folderCreated||(this._folderCreated=this._fileService.createFolder(this._directory)),await this._folderCreated,this._currentSize===0&&(this._currentSize=await this._getFileSize(this._currentFile)),this._currentSize>0&&this._currentSize+e.byteLength>this._maxFileSizeBytes&&await this._rotate(),await this._fileService.writeFile(this._currentFile,e,{append:!0}),this._currentSize+=e.byteLength}async _rotate(){this._segment++;let e=this._segment-this._maxFiles;e>=0&&await this._fileService.del(this._resourceForSegment(e)).catch(t=>{this._logService.trace("[AHPLog] Failed to delete old transport log",t)}),this._currentFile=this._resourceForSegment(this._segment),this._currentSize=await this._getFileSize(this._currentFile)}_resourceForSegment(e){if(e===0)return Ve(this._directory,this._baseName);let t=this._baseName.slice(0,-6);return Ve(this._directory,`${t}.${e}.jsonl`)}async _getFileSize(e){try{return(await this._fileService.resolve(e)).size??0}catch{return 0}}};tle=I([m(1,ge),m(2,re)],tle);function $O(a){return Ke.fromString(a).byteLength}function kPn(a){return a.toISOString().replace(/[:.]/g,"-")}function EPn(a){return a.replace(/[\\/:\*\?"<>\|\s]+/g,"-").replace(/^-+|-+$/g,"")||"connection"}var TPn="<redacted>",_Pn=new Set(["authenticate","listSessions","createSession","resolveSessionConfig","sessionConfigCompletions","completions","getCompletionTriggerCharacters","disposeSession","createTerminal","disposeTerminal","shutdown","subscribe","resourceList","resourceRead","resourceWrite","resourceCopy","resourceDelete","resourceMove"]),DPn=new Set(["unsubscribe","addSubscriber","dispatchAction"]);function FHo(a,i){let e=1;return new Proxy(a,{get(t,o,n){let r=Reflect.get(t,o,n);if(typeof o!="string"||typeof r!="function")return r;let s=_Pn.has(o),l=!s&&DPn.has(o);if(!s&&!l)return r;let c=o;return function(...u){let p=RPn(c,u);if(l){let v={jsonrpc:"2.0",method:c,params:p};return i.log(v,"c2s",$O(bei(v))),r.apply(t,u)}let h=e++,g={jsonrpc:"2.0",id:h,method:c,params:p};i.log(g,"c2s",$O(bei(g)));let f=r.apply(t,u);return f&&typeof f.then=="function"?f.then(v=>{let b={jsonrpc:"2.0",id:h,result:v??null};return i.log(b,"s2c",$O(bei(b))),v},v=>{let b={jsonrpc:"2.0",id:h,error:{code:-32603,message:v instanceof Error?v.message:String(v)}};throw i.log(b,"s2c",$O(bei(b))),v}):f}}})}function RPn(a,i){if(a!=="authenticate")return i;let[e,...t]=i;return LPn(e)?[{...e,token:TPn},...t]:i}function LPn(a){return typeof a=="object"&&a!==null&&"resource"in a&&"token"in a&&typeof a.resource=="string"&&typeof a.token=="string"}function bei(a){try{return JSON.stringify(a)}catch{return""}}var MPn={"root/agentsChanged":!1,"root/activeSessionsChanged":!1,"root/terminalsChanged":!1,"root/configChanged":!0,"session/ready":!1,"session/creationFailed":!1,"session/turnStarted":!0,"session/delta":!1,"session/responsePart":!1,"session/toolCallStart":!1,"session/toolCallDelta":!1,"session/toolCallReady":!1,"session/toolCallConfirmed":!0,"session/toolCallComplete":!0,"session/toolCallResultConfirmed":!0,"session/toolCallContentChanged":!0,"session/turnComplete":!1,"session/turnCancelled":!0,"session/error":!1,"session/titleChanged":!0,"session/usage":!1,"session/reasoning":!1,"session/modelChanged":!0,"session/serverToolsChanged":!1,"session/activeClientChanged":!0,"session/activeClientToolsChanged":!0,"session/pendingMessageSet":!0,"session/pendingMessageRemoved":!0,"session/queuedMessagesReordered":!0,"session/inputRequested":!1,"session/inputAnswerChanged":!0,"session/inputCompleted":!0,"session/customizationsChanged":!1,"session/customizationToggled":!0,"session/truncated":!0,"session/isReadChanged":!0,"session/isArchivedChanged":!0,"session/activityChanged":!1,"session/diffsChanged":!1,"session/configChanged":!0,"session/metaChanged":!1,"terminal/data":!1,"terminal/input":!0,"terminal/resized":!0,"terminal/claimed":!0,"terminal/titleChanged":!0,"terminal/cwdChanged":!1,"terminal/exited":!1,"terminal/cleared":!0,"terminal/commandDetectionAvailable":!1,"terminal/commandExecuted":!1,"terminal/commandFinished":!1};function yei(a,i){let e=`Unhandled action type: ${JSON.stringify(a)}`;(i??console.warn)(e)}function cft(a){return{toolCallId:a.toolCallId,toolName:a.toolName,displayName:a.displayName,toolClientId:a.toolClientId,_meta:a._meta}}function PPn(a,i){if(!(!i||!a))return a.find(e=>e.id===i)}function APn(a){return a.activeTurn?a.activeTurn.responseParts.some(i=>i.kind==="toolCall"&&(i.toolCall.status==="pending-confirmation"||i.toolCall.status==="pending-result-confirmation")):!1}var NPn=31;function Iei(a,i,e){return e?a|i:a&~i}function Eje(a,i){let e;return i?e=i:(a.inputRequests?.length??0)>0||APn(a)?e=24:a.activeTurn?e=8:e=1,a.summary.status&~NPn|e}function Sei(a){let i=Eje(a);return i===a.summary.status?a:{...a,summary:{...a.summary,status:i}}}function Hji(a,i,e,t,o){if(!a.activeTurn||a.activeTurn.id!==i)return a;let n=a.activeTurn,r=n.responseParts.map(c=>{if(c.kind!=="toolCall")return c;let u=c.toolCall;return u.status==="completed"||u.status==="cancelled"?c:{kind:"toolCall",toolCall:{status:"cancelled",...cft(u),invocationMessage:u.status==="streaming"?u.invocationMessage??"":u.invocationMessage,toolInput:u.status==="streaming"?void 0:u.toolInput,reason:"skipped"}}}),s={id:n.id,userMessage:n.userMessage,responseParts:r,usage:n.usage,state:e,error:o},l={...a,turns:[...a.turns,s],activeTurn:void 0,summary:{...a.summary,modifiedAt:Date.now()}};return delete l.inputRequests,{...l,summary:{...l.summary,status:Eje(l,t)}}}function OPn(a,i){let e=a.inputRequests??[],t=e.findIndex(r=>r.id===i.id),o=[...e];if(t>=0){let r=i.answers??o[t].answers;o[t]={...i,answers:r}}else o.push(i);let n={...a,inputRequests:o};return{...n,summary:{...n.summary,status:Iei(Eje(n),32,!1),modifiedAt:Date.now()}}}function kje(a,i,e,t){let o=a.activeTurn;if(!o||o.id!==i)return a;let n=!1,r=o.responseParts.map(s=>{if(s.kind==="toolCall"&&s.toolCall.toolCallId===e){let l=t(s.toolCall);return l===s.toolCall?s:(n=!0,{...s,toolCall:l})}return s});return n?{...a,activeTurn:{...o,responseParts:r}}:a}function WHo(a,i,e,t){let o=a.activeTurn;if(!o||o.id!==i)return a;let n=!1,r=o.responseParts.map(s=>!n&&(s.kind==="toolCall"?s.toolCall.toolCallId:"id"in s?s.id:void 0)===e?(n=!0,t(s)):s);return n?{...a,activeTurn:{...o,responseParts:r}}:a}function Uji(a,i,e){switch(i.type){case"root/agentsChanged":return{...a,agents:i.agents};case"root/activeSessionsChanged":return{...a,activeSessions:i.activeSessions};case"root/terminalsChanged":return{...a,terminals:i.terminals};case"root/configChanged":return a.config?{...a,config:{...a.config,values:i.replace?{...i.config}:{...a.config.values,...i.config}}}:a;default:return yei(i,e),a}}function dft(a,i,e){switch(i.type){case"session/ready":return{...a,lifecycle:"ready",summary:{...a.summary,status:1}};case"session/creationFailed":return{...a,lifecycle:"creationFailed",creationError:i.error};case"session/turnStarted":{let t={...a,activeTurn:{id:i.turnId,userMessage:i.userMessage,responseParts:[],usage:void 0}};if(t={...t,summary:{...t.summary,status:Iei(Eje(t),32,!1),modifiedAt:Date.now()}},i.queuedMessageId&&(t.steeringMessage?.id===i.queuedMessageId&&(t={...t,steeringMessage:void 0}),t.queuedMessages)){let o=t.queuedMessages.filter(n=>n.id!==i.queuedMessageId);t={...t,queuedMessages:o.length>0?o:void 0}}return t}case"session/delta":return WHo(a,i.turnId,i.partId,t=>t.kind==="markdown"?{...t,content:t.content+i.content}:t);case"session/responsePart":return!a.activeTurn||a.activeTurn.id!==i.turnId?a:{...a,activeTurn:{...a.activeTurn,responseParts:[...a.activeTurn.responseParts,i.part]}};case"session/turnComplete":return Hji(a,i.turnId,"complete");case"session/turnCancelled":return Hji(a,i.turnId,"cancelled");case"session/error":return Hji(a,i.turnId,"error",2,i.error);case"session/toolCallStart":return!a.activeTurn||a.activeTurn.id!==i.turnId?a:{...a,activeTurn:{...a.activeTurn,responseParts:[...a.activeTurn.responseParts,{kind:"toolCall",toolCall:{toolCallId:i.toolCallId,toolName:i.toolName,displayName:i.displayName,toolClientId:i.toolClientId,_meta:i._meta,status:"streaming"}}]}};case"session/toolCallDelta":return kje(a,i.turnId,i.toolCallId,t=>t.status!=="streaming"?t:{...t,partialInput:(t.partialInput??"")+i.content,invocationMessage:i.invocationMessage??t.invocationMessage});case"session/toolCallReady":return Sei(kje(a,i.turnId,i.toolCallId,t=>{if(t.status!=="streaming"&&t.status!=="running")return t;let o=cft(t);return i.confirmed?{status:"running",...o,invocationMessage:i.invocationMessage,toolInput:i.toolInput,confirmed:i.confirmed}:{status:"pending-confirmation",...o,invocationMessage:i.invocationMessage,toolInput:i.toolInput,confirmationTitle:i.confirmationTitle,edits:i.edits,editable:i.editable,...i.options?{options:i.options}:{}}}));case"session/toolCallConfirmed":return Sei(kje(a,i.turnId,i.toolCallId,t=>{if(t.status!=="pending-confirmation")return t;let o=cft(t),n=PPn(t.options,i.selectedOptionId);return i.approved?{status:"running",...o,invocationMessage:t.invocationMessage,toolInput:i.editedToolInput??t.toolInput,confirmed:i.confirmed,...n?{selectedOption:n}:{}}:{status:"cancelled",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,reason:i.reason,reasonMessage:i.reasonMessage,userSuggestion:i.userSuggestion,...n?{selectedOption:n}:{}}}));case"session/toolCallComplete":return Sei(kje(a,i.turnId,i.toolCallId,t=>{if(t.status!=="running"&&t.status!=="pending-confirmation")return t;let o=cft(t),n=t.status==="running"?t.confirmed:"not-needed",r=t.status==="running"?t.selectedOption:void 0;return i.requiresResultConfirmation?{status:"pending-result-confirmation",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,confirmed:n,...r?{selectedOption:r}:{},...i.result}:{status:"completed",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,confirmed:n,...r?{selectedOption:r}:{},...i.result}}));case"session/toolCallResultConfirmed":return Sei(kje(a,i.turnId,i.toolCallId,t=>{if(t.status!=="pending-result-confirmation")return t;let o=cft(t);return i.approved?{status:"completed",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,confirmed:t.confirmed,...t.selectedOption?{selectedOption:t.selectedOption}:{},success:t.success,pastTenseMessage:t.pastTenseMessage,content:t.content,structuredContent:t.structuredContent,error:t.error}:{status:"cancelled",...o,invocationMessage:t.invocationMessage,toolInput:t.toolInput,reason:"result-denied",...t.selectedOption?{selectedOption:t.selectedOption}:{}}}));case"session/toolCallContentChanged":return kje(a,i.turnId,i.toolCallId,t=>t.status!=="running"?t:{...t,content:i.content});case"session/titleChanged":return{...a,summary:{...a.summary,title:i.title,modifiedAt:Date.now()}};case"session/usage":return!a.activeTurn||a.activeTurn.id!==i.turnId?a:{...a,activeTurn:{...a.activeTurn,usage:i.usage}};case"session/reasoning":return WHo(a,i.turnId,i.partId,t=>t.kind==="reasoning"?{...t,content:t.content+i.content}:t);case"session/modelChanged":return{...a,summary:{...a.summary,model:i.model,modifiedAt:Date.now()}};case"session/isReadChanged":return{...a,summary:{...a.summary,status:Iei(a.summary.status,32,i.isRead)}};case"session/isArchivedChanged":return{...a,summary:{...a.summary,status:Iei(a.summary.status,64,i.isArchived)}};case"session/activityChanged":return{...a,summary:{...a.summary,activity:i.activity}};case"session/diffsChanged":return{...a,summary:{...a.summary,diffs:i.diffs}};case"session/configChanged":return a.config?{...a,config:{...a.config,values:i.replace?{...i.config}:{...a.config.values,...i.config}},summary:{...a.summary,modifiedAt:Date.now()}}:a;case"session/metaChanged":return{...a,_meta:i._meta};case"session/serverToolsChanged":return{...a,serverTools:i.tools};case"session/activeClientChanged":return{...a,activeClient:i.activeClient??void 0};case"session/activeClientToolsChanged":return a.activeClient?{...a,activeClient:{...a.activeClient,tools:i.tools}}:a;case"session/customizationsChanged":return{...a,customizations:i.customizations};case"session/customizationToggled":{let t=a.customizations;if(!t)return a;let o=t.findIndex(r=>r.customization.uri===i.uri);if(o<0)return a;let n=[...t];return n[o]={...t[o],enabled:i.enabled},{...a,customizations:n}}case"session/truncated":{let t;if(i.turnId===void 0)t=[];else{let n=a.turns.findIndex(r=>r.id===i.turnId);if(n<0)return a;t=a.turns.slice(0,n+1)}let o={...a,turns:t,activeTurn:void 0,summary:{...a.summary,modifiedAt:Date.now()}};return delete o.inputRequests,{...o,summary:{...o.summary,status:Eje(o)}}}case"session/inputRequested":return OPn(a,i.request);case"session/inputAnswerChanged":{let t=a.inputRequests,o=t?.findIndex(l=>l.id===i.requestId)??-1;if(!t||o<0)return a;let n=t[o],r={...n.answers??{}};i.answer===void 0?delete r[i.questionId]:r[i.questionId]=i.answer;let s=[...t];return s[o]={...n,answers:Object.keys(r).length>0?r:void 0},{...a,inputRequests:s,summary:{...a.summary,modifiedAt:Date.now()}}}case"session/inputCompleted":{let t=a.inputRequests;if(!t?.some(r=>r.id===i.requestId))return a;let o=t.filter(r=>r.id!==i.requestId),n={...a};return o.length>0?n.inputRequests=o:delete n.inputRequests,{...n,summary:{...n.summary,status:Eje(n),modifiedAt:Date.now()}}}case"session/pendingMessageSet":{let t={id:i.id,userMessage:i.userMessage};if(i.kind==="steering")return{...a,steeringMessage:t};let o=a.queuedMessages??[],n=o.findIndex(r=>r.id===i.id);if(n>=0){let r=[...o];return r[n]=t,{...a,queuedMessages:r}}return{...a,queuedMessages:[...o,t]}}case"session/pendingMessageRemoved":{if(i.kind==="steering")return!a.steeringMessage||a.steeringMessage.id!==i.id?a:{...a,steeringMessage:void 0};let t=a.queuedMessages;if(!t)return a;let o=t.filter(n=>n.id!==i.id);return o.length===t.length?a:{...a,queuedMessages:o.length>0?o:void 0}}case"session/queuedMessagesReordered":{let t=a.queuedMessages;if(!t)return a;let o=new Map(t.map(s=>[s.id,s])),n=new Set,r=i.order.filter(s=>o.has(s)&&!n.has(s)?(n.add(s),!0):!1).map(s=>o.get(s));for(let s of t)n.has(s.id)||r.push(s);return{...a,queuedMessages:r}}default:return yei(i,e),a}}function VHo(a,i,e){switch(i.type){case"terminal/data":{let t=[...a.content],o=t.length>0?t[t.length-1]:void 0;return o&&o.type==="command"&&!o.isComplete?t[t.length-1]={...o,output:o.output+i.data}:o&&o.type==="unclassified"?t[t.length-1]={...o,value:o.value+i.data}:t.push({type:"unclassified",value:i.data}),{...a,content:t}}case"terminal/input":return a;case"terminal/resized":return{...a,cols:i.cols,rows:i.rows};case"terminal/claimed":return{...a,claim:i.claim};case"terminal/titleChanged":return{...a,title:i.title};case"terminal/cwdChanged":return{...a,cwd:i.cwd};case"terminal/exited":return{...a,exitCode:i.exitCode};case"terminal/cleared":return{...a,content:[]};case"terminal/commandDetectionAvailable":return{...a,supportsCommandDetection:!0};case"terminal/commandExecuted":{let t={type:"command",commandId:i.commandId,commandLine:i.commandLine,output:"",timestamp:i.timestamp,isComplete:!1};return{...a,content:[...a.content,t],supportsCommandDetection:!0}}case"terminal/commandFinished":{let t=a.content.map(o=>o.type==="command"&&o.commandId===i.commandId?{...o,isComplete:!0,exitCode:i.exitCode,durationMs:i.durationMs}:o);return{...a,content:t}}default:return yei(i,e),a}}function ile(a){return a._meta?.toolKind}var uft=class extends k{constructor(e,t){super();this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._onWillApplyAction=this._register(new T);this.onWillApplyAction=this._onWillApplyAction.event;this._onDidApplyAction=this._register(new T);this.onDidApplyAction=this._onDidApplyAction.event;this._clientId=e,this._log=t}get value(){return this._error?this._error:this._getOptimisticState()??this._confirmedState}get verifiedValue(){return this._confirmedState}handleSnapshot(e,t){this._confirmedState=e,this._error=void 0,this._onSnapshotApplied(t),this._onDidChange.fire(this.value)}setError(e){this._error=e}receiveEnvelope(e){if(!this._isRelevantAction(e.action))return;if(this._confirmedState===void 0){this._bufferedEnvelopes||(this._bufferedEnvelopes=[]),this._bufferedEnvelopes.push(e);return}let t=e.origin?.clientId===this._clientId;this._onWillApplyAction.fire(e),this._reconcile(e,t),this._onDidApplyAction.fire(e)}_getOptimisticState(){}_onSnapshotApplied(e){let t=this._bufferedEnvelopes;if(t){this._bufferedEnvelopes=void 0;for(let o of t)if(o.serverSeq>e){let n=o.origin?.clientId===this._clientId;this._reconcile(o,n)}}}_reconcile(e,t){this._confirmedState=this._applyReducer(this._confirmedState,e.action),this._onDidChange.fire(this.value)}},zji=class extends uft{_applyReducer(i,e){return Uji(i,e,this._log)}_isRelevantAction(i){return i.type.startsWith("root/")}},B7=class extends uft{constructor(e,t,o,n){super(t,n);this._pendingActions=[];this._sessionUri=e,this._seqAllocator=o}applyOptimistic(e){let t=this._seqAllocator();this._pendingActions.push({clientSeq:t,action:e});let o=this._optimisticState??this.verifiedValue;return o&&(this._optimisticState=dft(o,e,this._log),this._onDidChange.fire(this._optimisticState)),t}_getOptimisticState(){return this._optimisticState}_applyReducer(e,t){return dft(e,t,this._log)}_isRelevantAction(e){return GKi(e)&&e.session===this._sessionUri}_onSnapshotApplied(e){super._onSnapshotApplied(e),this._recomputeOptimistic()}_reconcile(e,t){if(t&&e.origin){let o=this._pendingActions.findIndex(n=>n.clientSeq===e.origin.clientSeq);o!==-1?e.rejectionReason?this._pendingActions.splice(o,1):(this._confirmedApply(e.action),this._pendingActions.splice(o,1)):this._confirmedApply(e.action)}else this._confirmedApply(e.action);this._recomputeOptimistic()}_confirmedApply(e){this._confirmedState&&(this._confirmedState=this._applyReducer(this._confirmedState,e))}_recomputeOptimistic(){let e=this._confirmedState;if(!e){this._optimisticState=void 0;return}if(this._pendingActions.length===0){this._optimisticState=void 0,this._onDidChange.fire(e);return}let t=e;for(let o of this._pendingActions)t=dft(t,o.action,this._log);this._optimisticState=t,this._onDidChange.fire(t)}clearPending(){this._pendingActions.length=0,this._optimisticState=void 0}getPendingActions(){return this._pendingActions.map(e=>({clientSeq:e.clientSeq,action:e.action,sessionUri:this._sessionUri}))}dropPendingByClientSeq(e){let t=this._pendingActions.findIndex(o=>o.clientSeq===e);return t===-1?!1:(this._pendingActions.splice(t,1),!0)}},wei=class extends uft{constructor(i,e,t){super(e,t),this._terminalUri=i}_applyReducer(i,e){return VHo(i,e,this._log)}_isRelevantAction(i){return i.type.startsWith("terminal/")&&i.terminal===this._terminalUri}},Tje=class extends k{constructor(e,t,o,n,r){super();this._subscriptions=new dt;this._clientId=e,this._seqAllocator=t,this._log=o,this._subscribe=n,this._unsubscribe=r,this._rootState=this._register(new zji(e,o))}get rootState(){return this._rootState}handleRootSnapshot(e,t){this._rootState.handleSnapshot(e,t)}getSubscriptionUnmanaged(e){return this._subscriptions.get(e)?.sub}getSubscription(e,t){let o=this._subscriptions.get(t);if(o)return o.refCount++,{object:o.sub,dispose:()=>this._releaseSubscription(t)};let n=t.toString(),r=this._createSubscription(e,n),s={sub:r,refCount:1};return this._subscriptions.set(t,s),this._subscribe(t).then(l=>{this._subscriptions.get(t)===s&&r.handleSnapshot(l.state,l.fromSeq)}).catch(l=>{this._subscriptions.get(t)===s&&r.setError(l instanceof Error?l:new Error(String(l)))}),{object:r,dispose:()=>this._releaseSubscription(t)}}receiveEnvelope(e){this._rootState.receiveEnvelope(e);for(let{sub:t}of this._subscriptions.values())t.receiveEnvelope(e)}dispatchOptimistic(e){if(GKi(e)){let t=this._subscriptions.get(A.parse(e.session));if(t?.sub instanceof B7)return t.sub.applyOptimistic(e)}return this._seqAllocator()}currentSubscriptionUris(){return[...this._subscriptions.keys()]}getPendingSessionActions(){let e=[];for(let{sub:t}of this._subscriptions.values())t instanceof B7&&e.push(...t.getPendingActions());return e}dropPendingSessionAction(e,t){let o=this._subscriptions.get(A.parse(e));o?.sub instanceof B7&&o.sub.dropPendingByClientSeq(t)}applyReconnectSnapshot(e,t,o){if(e.toString()===c6){this._rootState.handleSnapshot(t,o);return}let n=this._subscriptions.get(e);n&&(n.sub instanceof B7&&n.sub.clearPending(),n.sub.handleSnapshot(t,o))}markSubscriptionsMissing(e){for(let t of e){let o=this._subscriptions.get(t);o&&(o.sub instanceof B7&&o.sub.clearPending(),o.sub.setError(new Error(`Subscription no longer available after reconnect: ${t.toString()}`)))}}_createSubscription(e,t){switch(e){case 1:return new B7(t,this._clientId,this._seqAllocator,this._log);case 2:return new wei(t,this._clientId,this._log);default:return new wei(t,this._clientId,this._log)}}_releaseSubscription(e){let t=this._subscriptions.get(e);if(t&&(t.refCount--,t.refCount<=0)){this._subscriptions.delete(e);try{this._unsubscribe(e)}catch{}t.sub instanceof B7&&t.sub.clearPending(),t.sub.dispose()}}dispose(){for(let[e,t]of this._subscriptions){try{this._unsubscribe(e)}catch{}t.sub.dispose()}this._subscriptions.clear(),super.dispose()}};function Kji(a,i){return vi(a,i.onDidChange,()=>{let e=i.value;return e instanceof Error?void 0:e})}var BHo="agentHostClientResource",Cei=class{constructor(i,e){this._fileService=i;this._ahpLogger=e}listen(i,e){throw new Error(`No event '${e}' on AgentHostClientResourceChannel`)}async call(i,e,t){let o={jsonrpc:"2.0",method:e,params:t};this._logReverseFrame(o,"s2c");try{let n=await this._call(i,e,t),r={jsonrpc:"2.0",method:e,result:n??null};return this._logReverseFrame(r,"c2s"),n}catch(n){let r={jsonrpc:"2.0",method:e,error:{code:-32603,message:n instanceof Error?n.message:String(n)}};throw this._logReverseFrame(r,"c2s"),n}}_logReverseFrame(i,e){this._ahpLogger?.log(i,e,$O(FPn(i)))}async _call(i,e,t){let o=t??{};switch(e){case"resourceList":{let n=await this._fileService.resolve(A.parse(o.uri));if(!n.isDirectory)throw new Error(`Resource is not a directory: ${o.uri}`);return{entries:(n.children??[]).map(l=>({name:l.name,type:l.isDirectory?"directory":"file"}))}}case"resourceRead":{let n=await this._fileService.readFile(A.parse(o.uri));return{data:gc(n.value),encoding:"base64"}}case"resourceWrite":{let n=o,r=A.parse(n.uri),s=n.encoding==="base64"?Ws(n.data):Ke.fromString(n.data);return n.createOnly?await this._fileService.createFile(r,s,{overwrite:!1}):await this._fileService.writeFile(r,s),{}}case"resourceDelete":{let n=o;return await this._fileService.del(A.parse(n.uri),{recursive:!!n.recursive}),{}}case"resourceMove":{let n=o;return await this._fileService.move(A.parse(n.source),A.parse(n.destination),!n.failIfExists),{}}}throw new Error(`Unknown command '${e}' on AgentHostClientResourceChannel`)}};function FPn(a){try{return JSON.stringify(a)}catch{return""}}function ole(a){let i=Gji(a);return{protocol:a,validate:o=>{try{return i(o,""),!0}catch{return!1}},assertValid:(o,n="")=>i(o,n)}}function xei(a){return{definition:a,toProtocol(){let i={};for(let e of Object.keys(a))i[e]=a[e].protocol;return{type:"object",properties:i}},values(i){let e=i;for(let t of Object.keys(a)){let o=e[t];if(o===void 0)continue;a[t].assertValid(o,t)}return{...e}},validate(i,e){let t=a[i];return t?t.validate(e):!1},assertValid(i,e){let t=a[i];if(!t)throw new $C(LBe.InvalidParams,`Unknown schema key '${i}'`);t.assertValid(e,i)},validateOrDefault(i,e){let t={},o=i??{};for(let n of Object.keys(a)){let r=a[n],s=o[n];s!==void 0&&r.validate(s)?t[n]=s:Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}}}function Gji(a){if(a.type==="object"&&a.properties){let i={};for(let t of Object.keys(a.properties))i[t]=Gji(a.properties[t]);let e=new Set(a.required??[]);return(t,o)=>{if(typeof t!="object"||t===null||Array.isArray(t))throw gye(o,"object",t);let n=t;for(let r of Object.keys(i)){let s=VPn(o,r);if(n[r]===void 0){if(e.has(r))throw new $C(LBe.InvalidParams,`Missing required property at '${s}'`);continue}i[r](n[r],s)}}}if(a.type==="array"&&a.items){let i=Gji(a.items);return(e,t)=>{if(!Array.isArray(e))throw gye(t,"array",e);for(let o=0;o<e.length;o++)i(e[o],`${t}[${o}]`)}}return WPn(a)}function WPn(a){let i=a.enumDynamic===!0;return(e,t)=>{switch(a.type){case"string":if(typeof e!="string")throw gye(t,"string",e);break;case"number":if(typeof e!="number")throw gye(t,"number",e);break;case"boolean":if(typeof e!="boolean")throw gye(t,"boolean",e);break;case"array":if(!Array.isArray(e))throw gye(t,"array",e);break;case"object":if(typeof e!="object"||e===null||Array.isArray(e))throw gye(t,"object",e);break}if(a.enum&&!i&&!a.enum.includes(e))throw new $C(LBe.InvalidParams,`Invalid value at '${t||"<root>"}': ${HHo(e)} is not one of [${a.enum.map(o=>JSON.stringify(o)).join(", ")}]`)}}function gye(a,i,e){return new $C(LBe.InvalidParams,`Invalid value at '${a||"<root>"}': expected ${i}, got ${HHo(e)}`)}function VPn(a,i){return a?`${a}.${i}`:i}function HHo(a){try{return JSON.stringify(a)}catch{return String(a)}}var UHo=ole({type:"object",title:d(1876,null),description:d(1880,null),properties:{allow:{type:"array",title:d(1877,null),items:{type:"string",title:d(1879,null)}},deny:{type:"array",title:d(1878,null),items:{type:"string",title:d(1879,null)}}},default:{allow:[],deny:[]},sessionMutable:!0}),Any=xei({autoApprove:ole({type:"string",title:d(1862,null),description:d(1869,null),enum:["default","autoApprove","autopilot"],enumLabels:[d(1867,null),d(1865,null),d(1863,null)],enumDescriptions:[d(1868,null),d(1866,null),d(1864,null)],default:"default",sessionMutable:!0}),permissions:UHo,mode:ole({type:"string",title:d(1870,null),description:d(1875,null),enum:["interactive","plan"],enumLabels:[d(1871,null),d(1873,null)],enumDescriptions:[d(1872,null),d(1874,null)],default:"interactive",sessionMutable:!0})}),pft="telemetryLevel";function kei(a){switch(a){case 0:return"off";case 1:return"crash";case 2:return"error";case 3:return"all"}}var Nny=xei({permissions:UHo,[pft]:ole({type:"string",title:d(1861,null),description:d(1860,null),enum:["all","error","crash","off"],default:"all"})});var _je=class extends k{constructor(e,t,o,n,r){super();this._logService=e;this._configurationService=t;this._fileService=o;this.clientId=ht();this._clientEventually=new Mo;this._onAgentHostExit=this._register(new T);this.onAgentHostExit=this._onAgentHostExit.event;this._onAgentHostStart=this._register(new T);this.onAgentHostStart=this._onAgentHostStart.event;this._onDidAction=this._register(new T);this.onDidAction=this._onDidAction.event;this._onDidNotification=this._register(new T);this.onDidNotification=this._onDidNotification.event;this._authenticationPending=De("authenticationPending",!0);this.authenticationPending=this._authenticationPending;this._authenticationSettled=!1;this._nextSeq=1;let s=Xd.toService(jH(this._clientEventually.p.then(l=>l.getChannel("agentHost"))));this._ahpLogger=this._configurationService.getValue(MFe)?this._register(r.createInstance(tle,{logsHome:n.logsHome,connectionId:this.clientId,transport:"local"})):void 0,this._proxy=this._ahpLogger?FHo(s,this._ahpLogger):s,this._connectionTracker=Xd.toService(jH(this._clientEventually.p.then(l=>l.getChannel("agentHostConnectionTracker")))),this._subscriptionManager=this._register(new Tje(this.clientId,()=>this.nextClientSeq(),l=>this._logService.warn(`[AgentHost:renderer] ${l}`),l=>this.subscribe(l),l=>this.unsubscribe(l))),this._register(this._configurationService.onDidChangeConfiguration(l=>{(l.affectsConfiguration(dT)||l.affectsConfiguration(xB)||l.affectsConfiguration(DY))&&this._updateTelemetryLevel()})),this._configurationService.getValue(mk)&&this._connect()}setAuthenticationPending(e){this._authenticationSettled||(e||(this._authenticationSettled=!0),this._authenticationPending.set(e,void 0))}async _connect(){this._logService.info("[AgentHost:renderer] Acquiring MessagePort to agent host...");let e=await rz("vscode:createAgentHostMessageChannel","vscode:createAgentHostMessageChannelResult");this._logService.info("[AgentHost:renderer] MessagePort acquired, creating client...");let t=this._register(new O),o=t.add(new fj(e,this.clientId));o.registerChannel(BHo,new Cei(this._fileService,this._ahpLogger)),this._clientEventually.complete(o),this._updateTelemetryLevel(),t.add(this._proxy.onDidAction(n=>{let r=er(n);if(this._ahpLogger){let s={jsonrpc:"2.0",method:"action",params:n};this._ahpLogger.log(s,"s2c",$O(JSON.stringify(s)))}this._subscriptionManager.receiveEnvelope(r),this._onDidAction.fire(r)})),t.add(this._proxy.onDidNotification(n=>{if(this._ahpLogger){let r={jsonrpc:"2.0",method:"notification",params:{notification:n}};this._ahpLogger.log(r,"s2c",$O(JSON.stringify(r)))}this._onDidNotification.fire(er(n))})),this._logService.info("[AgentHost:renderer] Direct MessagePort connection established"),this._onAgentHostStart.fire(),this.subscribe(A.parse(c6)).then(n=>{this._subscriptionManager.handleRootSnapshot(n.state,n.fromSeq)}).catch(n=>{this._logService.error("[AgentHost:renderer] Failed to subscribe to root state",n)})}_updateTelemetryLevel(){this.dispatchAction({type:"root/configChanged",config:{[pft]:kei(Yy(this._configurationService))}},this.clientId,0)}authenticate(e){return this._proxy.authenticate(e)}listSessions(){return this._proxy.listSessions()}createSession(e){return this._proxy.createSession(e)}resolveSessionConfig(e){return this._proxy.resolveSessionConfig(e)}sessionConfigCompletions(e){return this._proxy.sessionConfigCompletions(e)}completions(e){return this._proxy.completions(e)}getCompletionTriggerCharacters(){return this._completionTriggerCharactersOnce??=this._proxy.getCompletionTriggerCharacters()}disposeSession(e){return this._proxy.disposeSession(e)}createTerminal(e){return this._proxy.createTerminal(e)}disposeTerminal(e){return this._proxy.disposeTerminal(e)}shutdown(){return this._proxy.shutdown()}subscribe(e){return this._proxy.subscribe(e,this.clientId)}unsubscribe(e){this._proxy.unsubscribe(e,this.clientId)}dispatchAction(e,t,o){this._proxy.dispatchAction(e,t,o)}nextClientSeq(){return this._nextSeq++}get rootState(){return this._subscriptionManager.rootState}getSubscription(e,t){return this._subscriptionManager.getSubscription(e,t)}getSubscriptionUnmanaged(e,t){return this._subscriptionManager.getSubscriptionUnmanaged(t)}dispatch(e){let t=this._subscriptionManager.dispatchOptimistic(e);this.dispatchAction(e,this.clientId,t)}resourceList(e){return this._proxy.resourceList(e)}resourceRead(e){return this._proxy.resourceRead(e)}resourceWrite(e){return this._proxy.resourceWrite(e)}resourceCopy(e){return this._proxy.resourceCopy(e)}resourceDelete(e){return this._proxy.resourceDelete(e)}resourceMove(e){return this._proxy.resourceMove(e)}async restartAgentHost(){}startWebSocketServer(){return this._connectionTracker.startWebSocketServer()}getInspectInfo(e){return this._connectionTracker.getInspectInfo(e)}};_je=I([m(0,re),m(1,B),m(2,ge),m(3,ko),m(4,F)],_je);var Eei=class extends k{constructor(e){super();this._channel=e;this._onMessage=this._register(new T);this.onMessage=this._onMessage.event;this._onClose=this._register(new T);this.onClose=this._onClose.event;this._isOpen=!1;this._closeFired=!1;this._malformedFrames=0}get isOpen(){return this._isOpen&&!this._closeFired}async connect(){if(this._store.isDisposed)throw new Error("Transport is disposed");this._register(this._channel.listen("frame")(e=>this._handleFrame(e))),this._register(this._channel.listen("close")(()=>this._fireClose())),await this._channel.call("connect"),this._isOpen=!0}send(e){if(!this._isOpen||this._closeFired){this._fireClose();return}this._channel.call("send",JSON.stringify(e)).catch(()=>this._fireClose())}dispose(){this._isOpen&&!this._closeFired&&this._channel.call("close").catch(()=>{}),this._fireClose(),super.dispose()}_handleFrame(e){let t;try{t=JSON.parse(e)}catch(o){if(this._malformedFrames++,this._malformedFrames<=5){let n=e.length>80?e.slice(0,80)+"\u2026":e;console.warn(`[AgentHostIpcChannelTransport] Malformed frame #${this._malformedFrames} (len=${e.length}): ${n}`,o instanceof Error?o.message:String(o))}this._malformedFrames>10&&(console.warn("[AgentHostIpcChannelTransport] Malformed frame threshold exceeded; closing transport."),this._fireClose());return}this._onMessage.fire(t)}_fireClose(){this._closeFired||(this._closeFired=!0,this._isOpen=!1,this._onClose.fire())}};var Dei="0.1.0";var Pry={"root/agentsChanged":"0.1.0","root/activeSessionsChanged":"0.1.0","session/ready":"0.1.0","session/creationFailed":"0.1.0","session/turnStarted":"0.1.0","session/delta":"0.1.0","session/responsePart":"0.1.0","session/toolCallStart":"0.1.0","session/toolCallDelta":"0.1.0","session/toolCallReady":"0.1.0","session/toolCallConfirmed":"0.1.0","session/toolCallComplete":"0.1.0","session/toolCallResultConfirmed":"0.1.0","session/toolCallContentChanged":"0.1.0","session/turnComplete":"0.1.0","session/turnCancelled":"0.1.0","session/error":"0.1.0","session/titleChanged":"0.1.0","session/usage":"0.1.0","session/reasoning":"0.1.0","session/modelChanged":"0.1.0","session/serverToolsChanged":"0.1.0","session/activeClientChanged":"0.1.0","session/activeClientToolsChanged":"0.1.0","session/pendingMessageSet":"0.1.0","session/pendingMessageRemoved":"0.1.0","session/queuedMessagesReordered":"0.1.0","session/inputRequested":"0.1.0","session/inputAnswerChanged":"0.1.0","session/inputCompleted":"0.1.0","session/customizationsChanged":"0.1.0","session/customizationToggled":"0.1.0","session/truncated":"0.1.0","session/isReadChanged":"0.1.0","session/isArchivedChanged":"0.1.0","session/activityChanged":"0.1.0","session/diffsChanged":"0.1.0","session/configChanged":"0.1.0","session/metaChanged":"0.1.0","root/terminalsChanged":"0.1.0","root/configChanged":"0.1.0","terminal/data":"0.1.0","terminal/input":"0.1.0","terminal/resized":"0.1.0","terminal/claimed":"0.1.0","terminal/titleChanged":"0.1.0","terminal/cwdChanged":"0.1.0","terminal/exited":"0.1.0","terminal/cleared":"0.1.0","terminal/commandDetectionAvailable":"0.1.0","terminal/commandExecuted":"0.1.0","terminal/commandFinished":"0.1.0"};var Ary={"notify/sessionAdded":"0.1.0","notify/sessionRemoved":"0.1.0","notify/sessionSummaryChanged":"0.1.0","notify/authRequired":"0.1.0"};function qji(a){return typeof a.connect=="function"}var Rei=-32e3,HPn=1e3,UPn=3e4,$ji=5e3,zPn=2e4;function zHo(a,i){return new $C(Rei,`Connection appears dead: ${a}; no message received for ${i}ms.`)}function jji(a){return new $C(Rei,`Connection closed: ${a}`)}function KPn(a){return new $C(Rei,`Connection disposed: ${a}`)}function KHo(a){return new $C(Rei,`Transport lost (reconnecting): ${a}`)}var nle=class extends k{constructor(e,t,o,n,r,s,l){super();this._logService=n;this._fileService=r;this._permissionService=s;this._configurationService=l;this._clientId=ht();this._transportListeners=this._register(new ue);this._serverSeq=0;this._nextClientSeq=1;this._completionTriggerCharacters=[];this._onDidAction=this._register(new T);this.onDidAction=this._onDidAction.event;this._onDidNotification=this._register(new T);this.onDidNotification=this._onDidNotification.event;this._onDidClose=this._register(new T);this.onDidClose=this._onDidClose.event;this._onDidChangeConnectionState=this._register(new T);this.onDidChangeConnectionState=this._onDidChangeConnectionState.event;this._state={kind:"connecting"};this._pendingRequests=new Map;this._nextRequestId=1;this._lastReadTime=Date.now();this._pingTimer=this._register(new Nl);this._closeTimer=this._register(new Nl);this._grantedCustomizationUris=new Set;this._address=e,this._connectionAuthority=VM(e),this._loadEstimator=o??nZe.getInstance(),typeof t=="function"?(this._transportFactory=t,this._installTransport(t())):(this._transportFactory=void 0,this._installTransport(t)),this._subscriptionManager=this._register(new Tje(this._clientId,()=>this.nextClientSeq(),c=>this._logService.warn(`[RemoteAgentHostProtocolClient] ${c}`),c=>this.subscribe(c),c=>this.unsubscribe(c))),this._register(this.onDidAction(c=>{this._subscriptionManager.receiveEnvelope(c)})),this._register(this._configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration(dT)||c.affectsConfiguration(xB)||c.affectsConfiguration(DY)){if(this._state.kind!=="connected")return;this._updateTelemetryLevel()}})),this._resetLivenessTimers()}get clientId(){return this._clientId}get address(){return this._address}get defaultDirectory(){return this._defaultDirectory}get connectionState(){return this._state.kind}_installTransport(e){let t=new O;t.add(e),t.add(e.onMessage(o=>this._handleMessage(o))),t.add(e.onClose(()=>this._handleTransportClose())),this._transport=e,this._transportListeners.value=t}_transitionTo(e){this._state.kind!==e.kind&&(this._state=e,this._onDidChangeConnectionState.fire(e.kind))}_newReconnectGate(){let e=new Mo;return e.p.then(void 0,()=>{}),e}_newReconnectState(){return{gate:this._newReconnectGate(),outbox:[],attempt:0,timeoutHandle:void 0}}dispose(){this._handleClose(KPn(this._address)),super.dispose()}async connect(){qji(this._transport)&&await this._raceClose(this._transport.connect());let e=await this._sendRequest("initialize",{protocolVersions:[Dei],clientId:this._clientId,initialSubscriptions:[c6]});this._serverSeq=e.serverSeq;for(let t of e.snapshots??[])t.resource===c6&&this._subscriptionManager.handleRootSnapshot(t.state,t.fromSeq);if(e.defaultDirectory){let t=e.defaultDirectory;typeof t=="string"?this._defaultDirectory=A.parse(t).path:this._defaultDirectory=A.revive(t).path}this._completionTriggerCharacters=e.completionTriggerCharacters??[],this._updateTelemetryLevel(),this._transitionTo({kind:"connected"})}_handleTransportClose(){switch(this._state.kind){case"closed":return;case"connecting":this._handleClose(jji(this._address));return;case"connected":{if(!this._transportFactory){this._handleClose(jji(this._address));return}this._logService.info(`[RemoteAgentHostProtocol] Transport lost for ${this._address}; scheduling reconnect.`),this._transitionTo({kind:"reconnecting",reconnect:this._newReconnectState()}),this._cancelLivenessTimers(),this._rejectPendingRequests(KHo(this._address)),this._scheduleReconnect();return}case"reconnecting":this._logService.info(`[RemoteAgentHostProtocol] Transport lost for ${this._address} mid-reconnect; aborting the current attempt.`),this._cancelLivenessTimers(),this._rejectPendingRequests(KHo(this._address));return}}_scheduleReconnect(){if(this._state.kind!=="reconnecting"||!this._transportFactory)return;let e=this._state.reconnect;if(e.timeoutHandle!==void 0)return;let t=e.attempt+1,o=Math.min(HPn*Math.pow(2,t-1),UPn);this._logService.info(`[RemoteAgentHostProtocol] Reconnecting to ${this._address} in ${o}ms (attempt ${t}).`),e.timeoutHandle=setTimeout(()=>{this._state.kind==="reconnecting"&&(this._state.reconnect.timeoutHandle=void 0),this._attemptReconnect()},o)}async _attemptReconnect(){if(this._state.kind!=="reconnecting"||!this._transportFactory)return;let e=this._state.reconnect;e.attempt++;let t;try{if(t=this._transportFactory(),this._installTransport(t),qji(t)&&await t.connect(),this._state.kind!=="reconnecting")return;let o=this._subscriptionManager.currentSubscriptionUris().map(l=>l.toString());o.includes(c6)||o.unshift(c6);let n=this._serverSeq,r=await this._dispatchRequest("reconnect",{clientId:this._clientId,lastSeenServerSeq:n,subscriptions:o},{bypassReconnectGate:!0});if(this._state.kind!=="reconnecting")return;this._applyReconnectResult(r);let{gate:s}=e;this._drainAfterReconnect(e.outbox),this._lastReadTime=Date.now(),this._resetLivenessTimers(),this._transitionTo({kind:"connected"}),s.complete(),this._logService.info(`[RemoteAgentHostProtocol] Reconnected to ${this._address}.`)}catch(o){if(this._logService.warn(`[RemoteAgentHostProtocol] Reconnect attempt failed for ${this._address}: ${o instanceof Error?o.message:String(o)}`),t?.dispose(),this._state.kind!=="reconnecting")return;let n=this._state.reconnect.gate;this._state.reconnect.gate=this._newReconnectGate(),n.error(o),this._scheduleReconnect()}}_applyReconnectResult(e){if(e.type==="replay"){let t=this._serverSeq;for(let o of e.actions)o.origin?.clientId===this._clientId&&o.origin.clientSeq!==void 0&&!o.rejectionReason&&yo(o.action,{session:!0})&&this._subscriptionManager.dropPendingSessionAction(o.action.session,o.origin.clientSeq),o.serverSeq>t&&(t=o.serverSeq),this._onDidAction.fire(o);this._serverSeq=t,e.missing.length>0&&(this._logService.info(`[RemoteAgentHostProtocol] Server cannot resume ${e.missing.length} subscription(s) after reconnect.`),this._subscriptionManager.markSubscriptionsMissing(e.missing.map(o=>A.parse(o))))}else{let t=this._serverSeq;for(let o of e.snapshots)this._subscriptionManager.applyReconnectSnapshot(A.parse(o.resource),o.state,o.fromSeq),o.fromSeq>t&&(t=o.fromSeq);this._serverSeq=t}}_drainAfterReconnect(e){let t=new Set;for(let n of e)yo(n,{method:!0})&&n.method==="dispatchAction"&&t.add(n.params.clientSeq);let o=[];for(let n of this._subscriptionManager.getPendingSessionActions())t.has(n.clientSeq)||(this._grantImplicitReadsForOutgoingAction(n.action),o.push({jsonrpc:"2.0",method:"dispatchAction",params:{clientSeq:n.clientSeq,action:n.action}}));o.length>0&&this._logService.info(`[RemoteAgentHostProtocol] Replaying ${o.length} pending action(s) after reconnect to ${this._address}.`);for(let n of o)this._transport.send(n);for(let n of e)this._transport.send(n)}get rootState(){return this._subscriptionManager.rootState}getSubscription(e,t){return this._subscriptionManager.getSubscription(e,t)}getSubscriptionUnmanaged(e,t){return this._subscriptionManager.getSubscriptionUnmanaged(t)}dispatch(e){let t=this._subscriptionManager.dispatchOptimistic(e);this.dispatchAction(e,this._clientId,t)}async subscribe(e){return(await this._sendRequest("subscribe",{resource:e.toString()})).snapshot}unsubscribe(e){this._sendNotification("unsubscribe",{resource:e.toString()})}dispatchAction(e,t,o){this._grantImplicitReadsForOutgoingAction(e),this._sendNotification("dispatchAction",{clientSeq:o,action:e})}async createSession(e){let t=e?.provider;if(!t)throw new Error("Cannot create remote agent host session without a provider.");let o=e?.session??DP.uri(t,ht());return e?.activeClient?.customizations&&this._grantImplicitReadsForCustomizations(e.activeClient.customizations),await this._sendRequest("createSession",{session:o.toString(),provider:t,model:e?.model,workingDirectory:e?.workingDirectory?NZ(e.workingDirectory).toString():void 0,config:e?.config,activeClient:e?.activeClient}),o}async resolveSessionConfig(e){return this._sendRequest("resolveSessionConfig",{provider:e.provider,workingDirectory:e.workingDirectory?NZ(e.workingDirectory).toString():void 0,config:e.config})}async sessionConfigCompletions(e){return this._sendRequest("sessionConfigCompletions",{provider:e.provider,workingDirectory:e.workingDirectory?NZ(e.workingDirectory).toString():void 0,config:e.config,property:e.property,query:e.query})}async completions(e){return this._sendRequest("completions",e)}async ping(){await this._sendRequest("ping",{})}async getCompletionTriggerCharacters(){return this._completionTriggerCharacters}async authenticate(e){return await this._sendRequest("authenticate",e),{authenticated:!0}}async shutdown(){await this._sendExtensionRequest("shutdown")}async disposeSession(e){await this._sendRequest("disposeSession",{session:e.toString()})}async createTerminal(e){await this._sendRequest("createTerminal",e)}async disposeTerminal(e){await this._sendRequest("disposeTerminal",{terminal:e.toString()})}async listSessions(){return(await this._sendRequest("listSessions",{})).items.map(t=>({session:A.parse(t.resource),startTime:t.createdAt,modifiedTime:t.modifiedAt,...t.project?{project:{uri:this._toLocalProjectUri(A.parse(t.project.uri)),displayName:t.project.displayName}}:{},summary:t.title,status:t.status,activity:t.activity,workingDirectory:typeof t.workingDirectory=="string"?$S(A.parse(t.workingDirectory),this._connectionAuthority):void 0,isRead:!!(t.status&32),isArchived:!!(t.status&64),diffs:t.diffs}))}_toLocalProjectUri(e){return e.scheme===Q.file?$S(e,this._connectionAuthority):e}_grantImplicitReadsForOutgoingAction(e){e.type==="session/activeClientChanged"&&e.activeClient?.customizations&&this._grantImplicitReadsForCustomizations(e.activeClient.customizations)}_grantImplicitReadsForCustomizations(e){for(let t of e){let o;try{o=A.parse(t.uri)}catch{continue}let n=o.toString();this._grantedCustomizationUris.has(n)||(this._grantedCustomizationUris.add(n),this._permissionService.grantImplicitRead(this._address,o))}}async resourceList(e){return await this._sendRequest("resourceList",{uri:e.toString()})}async resourceRead(e){return this._sendRequest("resourceRead",{uri:e.toString()})}async resourceWrite(e){return this._sendRequest("resourceWrite",e)}async resourceCopy(e){return this._sendRequest("resourceCopy",e)}async resourceDelete(e){return this._sendRequest("resourceDelete",e)}async resourceMove(e){return this._sendRequest("resourceMove",e)}triggerVscodeUpgrade(e){return this._dispatchRequest(e,{})}_handleMessage(e){if(this._state.kind!=="closed")if(this._lastReadTime=Date.now(),this._resetLivenessTimers(),cDo(e))this._handleReverseRequest(e.id,e.method,e.params);else if(uDo(e)){let t=this._pendingRequests.get(e.id);t?(this._pendingRequests.delete(e.id),yo(e,{error:!0})?(this._logService.warn(`[RemoteAgentHostProtocol] Request ${e.id} failed:`,e.error),t.deferred.error(this._toProtocolError(e.error))):t.deferred.complete(e.result)):this._logService.warn(`[RemoteAgentHostProtocol] Received response for unknown request id ${e.id}`)}else if(dDo(e))switch(e.method){case"action":{let t=e.params;this._serverSeq=Math.max(this._serverSeq,t.serverSeq),this._onDidAction.fire(t);break}case"notification":{let t=e.params.notification;this._logService.trace(`[RemoteAgentHostProtocol] Notification: ${t.type}`),this._onDidNotification.fire(t);break}default:this._logService.trace(`[RemoteAgentHostProtocol] Unhandled method: ${e.method}`);break}else this._logService.warn("[RemoteAgentHostProtocol] Unrecognized message:",JSON.stringify(e))}_handleClose(e){if(this._state.kind!=="closed"){if(this._cancelLivenessTimers(),this._state.kind==="reconnecting"){let t=this._state.reconnect;t.timeoutHandle!==void 0&&clearTimeout(t.timeoutHandle),t.gate.isSettled||t.gate.error(e)}this._rejectPendingRequests(e),this._permissionService.connectionClosed(this._address),this._grantedCustomizationUris.clear(),this._transitionTo({kind:"closed",error:e}),this._onDidClose.fire()}}async _raceClose(e){if(this._state.kind==="closed")return Promise.reject(this._state.error);let t=k.None,o=new Promise((n,r)=>{t=this.onDidClose(()=>r(this._state.kind==="closed"?this._state.error:jji(this._address)))});try{return await Promise.race([e,o])}finally{t.dispose()}}_handleReverseRequest(e,t,o){let n=this._transport,r=p=>{n.send({jsonrpc:"2.0",id:e,result:p})},s=p=>{let h=O5(p instanceof Error?p:void 0),g=-32e3;switch(h){case"EntryNotFound":g=Qne.NotFound;break;case"NoPermissions":g=Qne.PermissionDenied;break;case"EntryExists":g=Qne.AlreadyExists;break}n.send({jsonrpc:"2.0",id:e,error:{code:g,message:p instanceof Error?p.message:String(p)}})},l=p=>{n.send({jsonrpc:"2.0",id:e,error:{code:Qne.PermissionDenied,message:p?`Access to ${p.uri} is not granted.`:"Access to the requested resource is not granted.",data:p?{request:p}:void 0}})},c=async(p,h,g,f)=>{try{if(!await this._permissionService.check(this._address,p,h)){l(g);return}r(await f())}catch(v){s(v)}},u=o;switch(t){case"resourceList":{if(!u.uri){s(new Error("Missing uri"));return}let p=A.parse(u.uri);return void c(p,"read",{uri:p.toString(),read:!0},async()=>({entries:((await this._fileService.resolve(p)).children??[]).map(g=>({name:g.name,type:g.isDirectory?"directory":"file"}))}))}case"resourceRead":{if(!u.uri){s(new Error("Missing uri"));return}let p=A.parse(u.uri);return void c(p,"read",{uri:p.toString(),read:!0},async()=>{let h=await this._fileService.readFile(p);return{data:gc(h.value),encoding:"base64"}})}case"resourceWrite":{if(!u.uri||!u.data){s(new Error("Missing uri or data"));return}let p=A.parse(u.uri);return void c(p,"write",{uri:p.toString(),write:!0},async()=>{let h=u.encoding==="base64"?Ws(u.data):Ke.fromString(u.data);return u.createOnly?await this._fileService.createFile(p,h,{overwrite:!1}):await this._fileService.writeFile(p,h),{}})}case"resourceDelete":{if(!u.uri){s(new Error("Missing uri"));return}let p=A.parse(u.uri);return void c(p,"write",{uri:p.toString(),write:!0},()=>this._fileService.del(p,{recursive:!!u.recursive}).then(()=>({})))}case"resourceMove":{if(!u.source||!u.destination){s(new Error("Missing source or destination"));return}let p=A.parse(u.source),h=A.parse(u.destination);return void(async()=>{try{let[g,f]=await Promise.all([this._permissionService.check(this._address,p,"write"),this._permissionService.check(this._address,h,"write")]);if(!g){l({uri:p.toString(),write:!0});return}if(!f){l({uri:h.toString(),write:!0});return}await this._fileService.move(p,h,!u.failIfExists),r({})}catch(g){s(g)}})()}case"resourceRequest":{let p=u;this._permissionService.request(this._address,p).then(()=>r({})).catch(h=>{h instanceof qi?l(void 0):s(h)});return}default:this._logService.warn(`[RemoteAgentHostProtocol] Unhandled reverse request: ${t}`),s(new Error(`Unknown method: ${t}`))}}_sendNotification(e,t){if(this._state.kind==="closed")return;let o={jsonrpc:"2.0",method:e,params:t};if(this._state.kind==="reconnecting"){this._state.reconnect.outbox.push(o);return}this._transport.send(o)}_sendRequest(e,t){return this._dispatchRequest(e,t)}_sendExtensionRequest(e,t){return this._dispatchRequest(e,t)}_updateTelemetryLevel(){this.dispatchAction({type:"root/configChanged",config:{[pft]:kei(Yy(this._configurationService))}},this._clientId,0)}async _dispatchRequest(e,t,o={}){for(;!o.bypassReconnectGate&&this._state.kind==="reconnecting";){let l=this._state;if(l.kind!=="reconnecting")break;try{await l.reconnect.gate.p}catch{}}if(this._state.kind==="closed")throw this._state.error;let n=this._nextRequestId++,r=new Mo;this._pendingRequests.set(n,{deferred:r,sentAt:Date.now()});let s={jsonrpc:"2.0",id:n,method:e,params:t};return this._transport.send(s),r.p}_toProtocolError(e){return new $C(e.code,e.message,e.data)}_rejectPendingRequests(e){for(let t of this._pendingRequests.values())t.deferred.error(e);this._pendingRequests.clear()}_resetLivenessTimers(){this._state.kind==="reconnecting"||this._state.kind==="closed"||(this._pingTimer.cancelAndSet(()=>this._onPingTimer(),$ji),this._closeTimer.cancelAndSet(()=>this._onCloseTimer(),$ji+zPn))}_cancelLivenessTimers(){this._pingTimer.cancel(),this._closeTimer.cancel()}_onPingTimer(){this._state.kind==="closed"||this._state.kind==="reconnecting"||this.ping().catch(()=>{})}_onCloseTimer(){if(this._state.kind==="closed"||this._state.kind==="reconnecting")return;if(this._loadEstimator.hasHighLoad()){this._closeTimer.cancelAndSet(()=>this._onCloseTimer(),$ji);return}let e=Date.now()-this._lastReadTime;if(this._logService.info(`[RemoteAgentHostProtocol] Liveness: no message from ${this._address} for ${e}ms; forcing close to trigger reconnect.`),this._transportListeners.clear(),this._transportFactory){this._rejectPendingRequests(zHo(this._address,e)),this._handleTransportClose();return}this._handleClose(zHo(this._address,e))}nextClientSeq(){return this._nextClientSeq++}};nle=I([m(3,re),m(4,ge),m(5,hQ),m(6,B)],nle);var GPn=a=>new Error(`${a} is not supported when the agent host runs on a remote.`),fye="[AgentHost:remote]",Dje=class extends k{constructor(e,t,o,n){super();this._logService=n;this._onAgentHostExit=this._register(new T);this.onAgentHostExit=this._onAgentHostExit.event;this._onAgentHostStart=this._register(new T);this.onAgentHostStart=this._onAgentHostStart.event;this._authenticationPending=De("authenticationPending",!0);this.authenticationPending=this._authenticationPending;this._authenticationSettled=!1;this._connectStarted=!1;let r=t.getValue(mk),s=e.getConnection();if(this._logService.info(`${fye} Initializing (enabled=${r}, remoteAuthority=${s?.remoteAuthority??"none"})`),!r){this._logService.info(`${fye} Disabled via "${mk}". Not connecting.`),this.setAuthenticationPending(!1);return}if(!s){this._logService.warn(`${fye} No remote agent connection available. Not connecting.`),this.setAuthenticationPending(!1);return}let l=s.getChannel("agentHostProxy"),c=new Eei(l),u=`vscode-remote://${s.remoteAuthority}`;this._protocolClient=this._register(o.createInstance(nle,u,c,void 0)),this._register(this._protocolClient.onDidClose(()=>{this._logService.info(`${fye} Protocol client closed`),this._onAgentHostExit.fire(0)})),this._connect().catch(p=>this._logService.warn(`${fye} Connect failed`,p))}async _connect(){this._connectStarted||!this._protocolClient||(this._connectStarted=!0,this._logService.info(`${fye} Connecting to remote agent host...`),await this._protocolClient.connect(),this._logService.info(`${fye} Connected; clientId=${this._protocolClient.clientId}`),this._onAgentHostStart.fire())}_requireClient(){if(!this._protocolClient)throw new Error("Remote agent host is not enabled or no remote connection is available.");return this._protocolClient}setAuthenticationPending(e){this._authenticationSettled||(e||(this._authenticationSettled=!0),this._authenticationPending.set(e,void 0))}async restartAgentHost(){}async startWebSocketServer(){throw GPn("startWebSocketServer")}async getInspectInfo(e){}get clientId(){return this._protocolClient?.clientId??""}get rootState(){return this._requireClient().rootState}get onDidNotification(){return this._protocolClient?.onDidNotification??U.None}get onDidAction(){return this._protocolClient?.onDidAction??U.None}getSubscription(e,t){return this._requireClient().getSubscription(e,t)}getSubscriptionUnmanaged(e,t){return this._protocolClient?.getSubscriptionUnmanaged(e,t)}dispatch(e){this._protocolClient?.dispatch(e)}authenticate(e){return this._requireClient().authenticate(e)}listSessions(){return this._requireClient().listSessions()}createSession(e){return this._requireClient().createSession(e)}resolveSessionConfig(e){return this._requireClient().resolveSessionConfig(e)}sessionConfigCompletions(e){return this._requireClient().sessionConfigCompletions(e)}completions(e){return this._requireClient().completions(e)}getCompletionTriggerCharacters(){return this._requireClient().getCompletionTriggerCharacters()}disposeSession(e){return this._requireClient().disposeSession(e)}createTerminal(e){return this._requireClient().createTerminal(e)}disposeTerminal(e){return this._requireClient().disposeTerminal(e)}resourceList(e){return this._requireClient().resourceList(e)}resourceRead(e){return this._requireClient().resourceRead(e)}resourceWrite(e){return this._requireClient().resourceWrite(e)}resourceCopy(e){return this._requireClient().resourceCopy(e)}resourceDelete(e){return this._requireClient().resourceDelete(e)}resourceMove(e){return this._requireClient().resourceMove(e)}};Dje=I([m(0,bo),m(1,B),m(2,F),m(3,re)],Dje);var mft=class{constructor(i,e){return e.remoteAuthority?i.createInstance(Dje):i.createInstance(_je)}};mft=I([m(0,F),m(1,Mt)],mft);Ce(hk,mft,1);var Rje=class extends k{constructor(e,t,o,n){super();this._address=e;this._connectionToken=t;this._onMessage=this._register(new T);this.onMessage=this._onMessage.event;this._onClose=this._register(new T);this.onClose=this._onClose.event;this._onOpen=this._register(new T);this.onOpen=this._onOpen.event;this._malformedFrames=0;this._closeFired=!1;o&&(this._ahpLogger=this._register(n.createInstance(tle,o)))}get isOpen(){return this._ws?.readyState===WebSocket.OPEN}connect(){return new Promise((e,t)=>{if(this._store.isDisposed){t(new Error("Transport is disposed"));return}let o=this._address.startsWith("ws://")||this._address.startsWith("wss://")?this._address:`ws://${this._address}`;if(this._connectionToken){let u=o.includes("?")?"&":"?";o+=`${u}${rbt}=${encodeURIComponent(this._connectionToken)}`}let n=new WebSocket(o);this._ws=n;let r=()=>{c(),this._onOpen.fire(),e()},s=()=>{c(),t(new Error(`WebSocket connection failed: ${this._address}`))},l=()=>{c(),t(new Error(`WebSocket closed before connection was established: ${this._address}`))},c=()=>{n.removeEventListener("open",r),n.removeEventListener("error",s),n.removeEventListener("close",l)};n.addEventListener("open",r),n.addEventListener("error",s),n.addEventListener("close",l),n.addEventListener("message",u=>{if(typeof u.data!="string"){if(this._malformedFrames++,this._malformedFrames<=5){let g=u.data instanceof ArrayBuffer?"ArrayBuffer":u.data instanceof Blob?"Blob":typeof u.data,f=u.data instanceof ArrayBuffer?u.data.byteLength:u.data instanceof Blob?u.data.size:0;console.warn(`[WebSocketClientTransport] Non-string frame #${this._malformedFrames} (type=${g}, bytes=${f})`)}this._malformedFrames>10&&(console.warn(`[WebSocketClientTransport] Malformed frame threshold exceeded; forcing close of ${this._address}.`),this._ws?.close(4002,"malformed-frames"));return}let p=u.data,h;try{h=JSON.parse(p)}catch(g){if(this._malformedFrames++,this._malformedFrames<=5){let f=p.length>80?p.slice(0,80)+"\u2026":p;console.warn(`[WebSocketClientTransport] Malformed frame #${this._malformedFrames} (len=${p.length}): ${f}`,g instanceof Error?g.message:String(g))}this._malformedFrames>10&&(console.warn(`[WebSocketClientTransport] Malformed frame threshold exceeded; forcing close of ${this._address}.`),this._ws?.close(4002,"malformed-frames"));return}this._ahpLogger?.log(h,"s2c",$O(p)),this._onMessage.fire(h)}),n.addEventListener("close",()=>{this._closeFired||(this._closeFired=!0,this._onClose.fire())}),n.addEventListener("error",()=>{this._closeFired||(this._closeFired=!0,this._onClose.fire())})})}send(e){if(this._ws?.readyState===WebSocket.OPEN){let t=JSON.stringify(e);return this._ahpLogger?.log(e,"c2s",$O(t)),this._ws.send(t),!0}return console.warn(`[WebSocketClientTransport] Message dropped: readyState=${this._ws?.readyState??"no-socket"}`),this._ws?.close(4001,"send-on-dead-socket"),this._closeFired||(this._closeFired=!0,this._onClose.fire()),!1}dispose(){this._ws?.close(),super.dispose()}};Rje=I([m(3,F)],Rje);var Lei="remoteAgentHost.sshConnections";function GHo(a){a.store.dispose(),a.transportDisposable?.dispose()}function qPn(a){if(typeof a!="object"||a===null)return!1;let i=a;return typeof i.address=="string"&&typeof i.name=="string"&&(i.connectionToken===void 0||typeof i.connectionToken=="string")&&(i.sshConfigHost===void 0||typeof i.sshConfigHost=="string")&&(i.sshHostName===void 0||typeof i.sshHostName=="string")&&(i.sshUser===void 0||typeof i.sshUser=="string")&&(i.sshPort===void 0||typeof i.sshPort=="number")}var rB=class extends k{constructor(e,t,o,n,r,s){super();this._configurationService=e;this._instantiationService=t;this._logService=o;this._labelService=n;this._environmentService=r;this._storageService=s;this._onDidChangeConnections=this._register(new T);this.onDidChangeConnections=this._onDidChangeConnections.event;this._entries=new Map;this._names=new Map;this._tokens=new Map;this._registeredEntries=new Map;this._pendingConnectionWaits=new Map;this._reconnectTimeouts=new Map;this._reconnectAttempts=new Map;this._labelFormatters=new Map;this._register(this._configurationService.onDidChangeConfiguration(l=>{(l.affectsConfiguration(Jve)||l.affectsConfiguration(MBe))&&this._reconcileConnections()})),this._register(this._storageService.onDidChangeValue(-1,Lei,this._store)(()=>{this._reconcileConnections(),this._onDidChangeConnections.fire()})),this._migrateSSHEntriesFromSetting(),this._reconcileConnections()}static{this.ConnectionWaitTimeout=1e4}static{this.ReconnectInitialDelay=1e3}static{this.ReconnectMaxDelay=3e4}static{this.UpgradeRequestTimeout=300*1e3}get connections(){let e=[];for(let[t,o]of this._entries)e.push({address:t,name:this._names.get(t)??t,clientId:o.client.clientId,defaultDirectory:o.client.defaultDirectory,status:o.status});return e}get configuredEntries(){return this._getConfiguredEntries().map(e=>e.connection.type==="tunnel"?e:{...e,connection:{...e.connection,address:db(e.connection.address)}})}getConnection(e){let t=db(e),o=this._entries.get(t);return o?.connected?o.client:void 0}getEntryByAddress(e){let t=db(e),o=this._registeredEntries.get(t);return o||this.configuredEntries.find(n=>db(_V(n))===t)}async triggerServerUpgrade(e,t){let o=db(e),n=this._entries.get(o);if(!n)throw new Error(`No remote agent host entry found for ${e}.`);let r=await Uu(n.client.triggerVscodeUpgrade(t),rB.UpgradeRequestTimeout);if(r===void 0)throw new Error(`Server upgrade request timed out after ${rB.UpgradeRequestTimeout}ms.`);return r}reconnect(e){let t=db(e),o=this._getConfiguredEntries().find(s=>db(_V(s))===t);if(o&&o.connection.type!=="websocket")return;let n=this._tokens.get(t);this._cancelReconnect(t),this._reconnectAttempts.delete(t);let r=this._entries.get(t);r&&(this._entries.delete(t),r.store.dispose()),this._connectTo(t,n)}async addRemoteAgentHost(e){if(!this._configurationService.getValue(MBe))throw new Error("Remote agent host connections are not enabled.");let t=e.connection.type==="tunnel"?e:{...e,connection:{...e.connection,address:db(e.connection.address)}},o=_V(t),n=this._getConnectionInfo(o);if(await this._storeConfiguredEntries(this._upsertConfiguredEntry(t)),n)return{...n,name:t.name};if(t.connection.type==="ssh")return{address:o,name:t.name,clientId:"",status:VP.disconnected};let r=this._getConnectionInfo(o);if(r)return r;let s=this._getOrCreateConnectionWait(o),l=await Uu(s.p,rB.ConnectionWaitTimeout,()=>{this._pendingConnectionWaits.delete(o)});if(!l)throw new Error(`Timed out connecting to ${o}`);return l}async addManagedConnection(e,t,o){if(!this._configurationService.getValue(MBe))throw new Error("Remote agent host connections are not enabled.");let n=_V(e),r=this._entries.get(n);r&&(this._entries.delete(n),r.store.dispose());let s=new O,l=t;s.add(l);let c={store:s,client:l,transportDisposable:o,connected:!0,status:VP.connected};return this._entries.set(n,c),this._names.set(n,e.name),this._registeredEntries.set(n,e),this._updateHostLabelFormatter(n,e.name),e.connectionToken&&this._tokens.set(n,e.connectionToken),s.add(l.onDidClose(()=>{this._entries.get(n)===c&&(c.connected=!1,c.status=VP.disconnected,this._onDidChangeConnections.fire())})),await this._storeConfiguredEntries(this._upsertConfiguredEntry(e)),this._onDidChangeConnections.fire(),{address:n,name:e.name,clientId:l.clientId,defaultDirectory:l.defaultDirectory,status:VP.connected}}async removeRemoteAgentHost(e){let t=db(e),o=this._getConfiguredEntries().filter(n=>db(_V(n))!==t);await this._storeConfiguredEntries(o),this._names.delete(t),this._tokens.delete(t),this._registeredEntries.delete(t),this._clearHostLabelFormatter(t),this._cancelReconnect(t),this._reconnectAttempts.delete(t),this._removeConnection(t)}_removeConnection(e){let t=this._entries.get(e);t&&(this._entries.delete(e),GHo(t),this._rejectPendingConnectionWait(e,new Error(`Connection closed: ${e}`)),this._onDidChangeConnections.fire())}_reconcileConnections(){if(!this._configurationService.getValue(MBe)){for(let s of[...this._entries.keys()])this._cancelReconnect(s),this._removeConnection(s);this._names.clear(),this._tokens.clear(),this._reconnectAttempts.clear();for(let s of[...this._labelFormatters.keys()])this._registeredEntries.has(s)||this._clearHostLabelFormatter(s);return}let t=this._getConfiguredEntries().map(s=>({entry:s,address:db(_V(s))})),o=new Set(t.map(s=>s.address));this._logService.info(`[RemoteAgentHost] Reconciling: desired=[${[...o].join(", ")}], current=[${[...this._entries.keys()].map(s=>`${s}(${this._entries.get(s).connected?"connected":"pending"})`).join(", ")}]`);let n=!1,r=new Map(this._names);this._names.clear(),this._tokens.clear();for(let{entry:s,address:l}of t)this._names.set(l,s.name),this._tokens.set(l,s.connectionToken),this._updateHostLabelFormatter(l,s.name),this._entries.has(l)&&r.get(l)!==s.name&&(n=!0);for(let s of[...this._labelFormatters.keys()])!o.has(s)&&!this._registeredEntries.has(s)&&this._clearHostLabelFormatter(s);for(let s of[...this._entries.keys()])o.has(s)||(this._logService.info(`[RemoteAgentHost] Disconnecting from ${s}`),this._cancelReconnect(s),this._reconnectAttempts.delete(s),this._removeConnection(s));for(let{entry:s,address:l}of t)!this._entries.has(l)&&s.connection.type==="websocket"&&this._connectTo(l,s.connectionToken);n&&this._onDidChangeConnections.fire()}_connectTo(e,t){if(!this._configurationService.getValue(MBe))return;let o=this._entries.get(e);o&&(this._entries.delete(e),o.store.dispose());let n=new O,r=!!this._configurationService.getValue(MFe),s=()=>this._instantiationService.createInstance(Rje,e,t,r?{logsHome:this._environmentService.logsHome,connectionId:e,transport:"websocket"}:void 0),l=n.add(this._instantiationService.createInstance(nle,e,s,void 0)),c={store:n,client:l,connected:!1,status:VP.connecting};this._entries.set(e,c);let u=()=>this._entries.get(e)===c;n.add(l.onDidClose(()=>{u()&&(this._logService.warn(`[RemoteAgentHost] Connection closed: ${e}`),c.connected=!1,c.status=VP.disconnected,this._onDidChangeConnections.fire(),this._scheduleReconnect(e,t))})),n.add(l.onDidChangeConnectionState(p=>{if(u())switch(p){case"reconnecting":c.connected=!1,c.status=VP.connecting,this._onDidChangeConnections.fire();break;case"connected":c.connected=!0,c.status=VP.connected,this._onDidChangeConnections.fire();break;default:break}})),this._logService.info(`[RemoteAgentHost] Connecting to ${e}`),this._onDidChangeConnections.fire(),l.connect().then(()=>{n.isDisposed||(this._logService.info(`[RemoteAgentHost] Connected to ${e}`),c.connected=!0,c.status=VP.connected,this._reconnectAttempts.delete(e),this._resolvePendingConnectionWait(e),this._onDidChangeConnections.fire())}).catch(p=>{if(!u())return;let h=VP.fromConnectError(p,[Dei]);if(h){this._logService.warn(`[RemoteAgentHost] Incompatible with ${e}: ${h.kind==="incompatible"?h.message:""}`),c.status=h,this._reconnectAttempts.delete(e),this._rejectPendingConnectionWait(e,p),this._onDidChangeConnections.fire();return}this._logService.error(`[RemoteAgentHost] Failed to connect to ${e}. Verify address and connectionToken`,p),c.status=VP.disconnected,this._entries.delete(e),c.store.dispose(),this._rejectPendingConnectionWait(e,p),this._onDidChangeConnections.fire(),this._scheduleReconnect(e,t)})}_scheduleReconnect(e,t){if(!this._isAddressConfigured(e)){this._logService.info(`[RemoteAgentHost] Not reconnecting to ${e}: no longer configured`);return}let o=(this._reconnectAttempts.get(e)??0)+1;this._reconnectAttempts.set(e,o);let n=Math.min(rB.ReconnectInitialDelay*Math.pow(2,o-1),rB.ReconnectMaxDelay);this._logService.info(`[RemoteAgentHost] Scheduling reconnect to ${e} in ${n}ms (attempt ${o})`),this._cancelReconnect(e);let r=setTimeout(()=>{this._reconnectTimeouts.delete(e),this._isAddressConfigured(e)&&this._connectTo(e,t??this._tokens.get(e))},n);this._reconnectTimeouts.set(e,r)}_cancelReconnect(e){let t=this._reconnectTimeouts.get(e);t!==void 0&&(clearTimeout(t),this._reconnectTimeouts.delete(e))}_isAddressConfigured(e){return this._getConfiguredEntries().some(o=>db(_V(o))===e)}_getConnectionInfo(e){return this.connections.find(t=>t.address===e&&VP.isConnected(t.status))}_getConfiguredEntries(){return this._mergeConfiguredEntries(this._getConfiguredSettingEntries(),this._getStoredSSHEntries())}_upsertConfiguredEntry(e){let t=this._mergeConfiguredEntries(this._getConfiguredSettingEntriesForTarget(),this._getStoredSSHEntries()),o=db(_V(e)),n=t.findIndex(r=>db(_V(r))===o);return n===-1?[...t,e]:t.map((r,s)=>s===n?e:r)}_getConfigurationTarget(){let e=this._configurationService.inspect(Jve);return e.userLocalValue!==void 0?3:e.userRemoteValue!==void 0?4:e.userValue!==void 0?2:2}async _storeConfiguredEntries(e){this._storeStoredSSHEntries(e.filter(o=>o.connection.type==="ssh"));let t=e.filter(o=>o.connection.type!=="ssh").map(M5t).filter(so);await this._configurationService.updateValue(Jve,t,this._getConfigurationTarget())}_getConfiguredSettingEntries(){return(this._configurationService.getValue(Jve)??[]).map(L5t).filter(so)}_getConfiguredSettingEntriesForTarget(){return this._getConfiguredRawEntriesForTarget().map(L5t).filter(so)}_getConfiguredRawEntriesForTarget(){let e=this._getConfigurationTarget(),t=this._configurationService.inspect(Jve);switch(e){case 3:return t.userLocalValue??[];case 4:return t.userRemoteValue??[];default:return t.userValue??[]}}_getStoredSSHEntries(){let e=this._storageService.get(Lei,-1);if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(o=>qPn(o)?L5t(o):void 0).filter(o=>o?.connection.type==="ssh"):[]}catch{return[]}}_storeStoredSSHEntries(e){let t=e.filter(o=>o.connection.type==="ssh").map(M5t).filter(so);t.length===0?this._storageService.remove(Lei,-1):this._storageService.store(Lei,JSON.stringify(t),-1,0)}_migrateSSHEntriesFromSetting(){let e=this._getConfiguredSettingEntriesForTarget(),t=e.filter(s=>s.connection.type==="ssh");if(t.length===0)return;let o=this._mergeConfiguredEntries(this._getStoredSSHEntries(),t);this._storeStoredSSHEntries(o);let r=e.filter(s=>s.connection.type!=="ssh").map(M5t).filter(so);this._configurationService.updateValue(Jve,r,this._getConfigurationTarget()).catch(s=>{this._logService.error("[RemoteAgentHost] Failed to migrate SSH connection details from settings to storage",s)})}_mergeConfiguredEntries(e,t){let o=e;for(let n of t){let r=db(_V(n)),s=o.findIndex(l=>db(_V(l))===r);s===-1?o=[...o,n]:o=o.map((l,c)=>c===s?n:l)}return o}_getOrCreateConnectionWait(e){let t=this._pendingConnectionWaits.get(e);if(t)return t;let o=this._getConnectionInfo(e);if(o){let n=new Mo;return n.complete(o),n}return t=new Mo,this._pendingConnectionWaits.set(e,t),t}_resolvePendingConnectionWait(e){let t=this._pendingConnectionWaits.get(e),o=this._getConnectionInfo(e);!t||!o||(this._pendingConnectionWaits.delete(e),t.complete(o))}_rejectPendingConnectionWait(e,t){let o=this._pendingConnectionWaits.get(e);o&&(this._pendingConnectionWaits.delete(e),o.error(t))}_updateHostLabelFormatter(e,t){this._clearHostLabelFormatter(e);let o=this._labelService.registerFormatter({scheme:IC,authority:VM(e),priority:!0,formatting:{...mDe.formatting,workspaceSuffix:t}});this._labelFormatters.set(e,o)}_clearHostLabelFormatter(e){let t=this._labelFormatters.get(e);t&&(t.dispose(),this._labelFormatters.delete(e))}dispose(){for(let e of this._reconnectTimeouts.values())clearTimeout(e);this._reconnectTimeouts.clear(),this._reconnectAttempts.clear();for(let[e,t]of this._pendingConnectionWaits)t.error(new Error(`Remote agent host service disposed before connecting to ${e}`));this._pendingConnectionWaits.clear();for(let e of this._entries.values())GHo(e);this._entries.clear();for(let e of this._labelFormatters.values())e.dispose();this._labelFormatters.clear(),super.dispose()}};rB=I([m(0,B),m(1,F),m(2,re),m(3,nt),m(4,ko),m(5,de)],rB);Ce(PBe,rB,1);var hft=class{constructor(i,e){return i.call("__initialize",ut.vscodeWindowId).catch(t=>{e.error("Failed to initialize Playwright service",t)}),Xd.toService(i)}};hft=I([m(1,re)],hft);lv(tv,"playwright",{channelClientCtor:hft});var rle=le("processService");_w(rle,"process");var gft=class extends k{constructor(e){super();this.nativeHostService=e;this.onDidSuspend=e.onDidSuspendOS,this.onDidResume=U.map(e.onDidResumeOS,()=>{}),this.onDidChangeOnBatteryPower=e.onDidChangeOnBatteryPower,this.onDidChangeThermalState=e.onDidChangeThermalState,this.onDidChangeSpeedLimit=e.onDidChangeSpeedLimit,this.onWillShutdown=e.onWillShutdownOS,this.onDidLockScreen=e.onDidLockScreen,this.onDidUnlockScreen=e.onDidUnlockScreen}async getSystemIdleState(e){return this.nativeHostService.getSystemIdleState(e)}async getSystemIdleTime(){return this.nativeHostService.getSystemIdleTime()}async getCurrentThermalState(){return this.nativeHostService.getCurrentThermalState()}async isOnBatteryPower(){return this.nativeHostService.isOnBatteryPower()}async startPowerSaveBlocker(e){return this.nativeHostService.startPowerSaveBlocker(e)}async stopPowerSaveBlocker(e){return this.nativeHostService.stopPowerSaveBlocker(e)}async isPowerSaveBlockerStarted(e){return this.nativeHostService.isPowerSaveBlockerStarted(e)}};gft=I([m(0,wo)],gft);Ce(IFt,gft,1);var wj=class extends it{constructor(e,t,o,n){super(e,t);this.environmentService=o;this.nativeHostService=n}static{this.ID="workbench.action.openLogsFolder"}static{this.TITLE=P(12714,"Open Logs Folder")}run(){return this.nativeHostService.showItemInFolder(Ve(this.environmentService.logsHome,"main.log").with({scheme:Q.file}).fsPath)}};wj=I([m(2,Jr),m(3,wo)],wj);var Cj=class extends it{constructor(e,t,o,n,r){super(e,t);this.environmentSerice=o;this.fileService=n;this.nativeHostService=r}static{this.ID="workbench.action.openExtensionLogsFolder"}static{this.TITLE=P(12713,"Open Extension Logs Folder")}async run(){let e=await this.fileService.resolve(this.environmentSerice.extHostLogsPath);if(e.children&&e.children[0])return this.nativeHostService.showItemInFolder(e.children[0].resource.with({scheme:Q.file}).fsPath)}};Cj=I([m(2,Jr),m(3,ge),m(4,wo)],Cj);W(class extends z{constructor(){super({id:wj.ID,title:wj.TITLE,category:Fe.Developer,f1:!0})}run(a){return a.get(F).createInstance(wj,wj.ID,wj.TITLE.value).run()}});W(class extends z{constructor(){super({id:Cj.ID,title:Cj.TITLE,category:Fe.Developer,f1:!0})}run(a){return a.get(F).createInstance(Cj,Cj.ID,Cj.TITLE.value).run()}});var Mei={showLanguagePackExtensions:d(12696,null),searchMarketplace:d(12695,null),installAndRestartMessage:d(12694,null),installAndRestart:d(12693,null)};var Pei=class a extends z{static{this.ID="workbench.action.configureLocale"}constructor(){super({id:a.ID,title:P(12686,"Configure Display Language"),menu:{id:R.CommandPalette},metadata:{description:P(12687,"Changes the locale of VS Code based on installed language packs. Common languages include French, Chinese, Spanish, Japanese, German, Korean, and more.")}})}async run(i){let e=i.get(m3),t=i.get($e),o=i.get(AU),n=i.get(Ui),r=await e.getInstalledLanguages(),s=new O,l=s.add(t.createQuickPick({useSeparators:!0}));if(l.matchOnDescription=!0,l.placeholder=d(12684,null),r?.length){let u=[{type:"separator",label:d(12688,null)}];l.items=u.concat(this.withMoreInfoButton(r))}s.add(l.onDidHide(()=>{s.dispose()}));let c=new Set(r?.map(u=>u.id)??[]);e.getAvailableLanguages().then(u=>{let p=u.filter(h=>h.id&&!c.has(h.id));p.length&&(l.items=[...l.items,{type:"separator",label:d(12683,null)},...this.withMoreInfoButton(p)]),l.busy=!1}),s.add(l.onDidAccept(async()=>{let u=l.activeItems[0];u&&(l.hide(),await o.setLocale(u))})),s.add(l.onDidTriggerItemButton(async u=>{l.hide(),u.item.extensionId&&await n.open(u.item.extensionId)})),l.show(),l.busy=!0}withMoreInfoButton(i){for(let e of i)e.extensionId&&(e.buttons=[{tooltip:d(12689,null),iconClass:"codicon-info"}]);return i}},Aei=class a extends z{static{this.ID="workbench.action.clearLocalePreference"}static{this.LABEL=P(12685,"Clear Display Language Preference")}constructor(){super({id:a.ID,title:a.LABEL,menu:{id:R.CommandPalette}})}async run(i){await i.get(AU).clearLocalePreference()}};var Nei=class extends k{constructor(){super(),W(Pei),W(Aei),zn.registerExtensionPoint({extensionPoint:"localizations",defaultExtensionKind:["ui","workspace"],jsonSchema:{description:d(12675,null),type:"array",default:[],items:{type:"object",required:["languageId","translations"],defaultSnippets:[{body:{languageId:"",languageName:"",localizedLanguageName:"",translations:[{id:"vscode",path:""}]}}],properties:{languageId:{description:d(12676,null),type:"string"},languageName:{description:d(12677,null),type:"string"},localizedLanguageName:{description:d(12678,null),type:"string"},translations:{description:d(12679,null),type:"array",default:[{id:"vscode",path:""}],items:{type:"object",required:["id","path"],properties:{id:{type:"string",description:d(12680,null),pattern:"^((vscode)|([a-z0-9A-Z][a-z0-9A-Z-]*)\\.([a-z0-9A-Z][a-z0-9A-Z-]*))$",patternErrorMessage:d(12681,null)},path:{type:"string",description:d(12682,null)}},defaultSnippets:[{body:{id:"",path:""}}]}}}}}})}},Qji=class extends k{constructor(){super(...arguments);this.type="table"}shouldRender(e){return!!e.contributes?.localizations}render(e){let t=e.contributes?.localizations||[];if(!t.length)return{data:{headers:[],rows:[]},dispose:()=>{}};let o=[d(12671,null),d(12673,null),d(12674,null)],n=t.sort((r,s)=>r.languageId.localeCompare(s.languageId)).map(r=>[r.languageId,r.languageName??"",r.localizedLanguageName??""]);return{data:{headers:o,rows:n},dispose:()=>{}}}};oe.as(qs.ExtensionFeaturesRegistry).registerExtensionFeature({id:"localizations",label:d(12672,null),access:{canToggle:!1},renderer:new Vt(Qji)});var sle=class extends Nei{constructor(e,t,o,n,r,s,l,c){super();this.notificationService=e;this.localeService=t;this.productService=o;this.storageService=n;this.extensionManagementService=r;this.galleryService=s;this.extensionsWorkbenchService=l;this.telemetryService=c;this.checkAndInstall(),this._register(this.extensionManagementService.onDidInstallExtensions(u=>this.onDidInstallExtensions(u))),this._register(this.extensionManagementService.onDidUninstallExtension(u=>this.onDidUninstallExtension(u)))}static{this.LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY="extensionsAssistant/languagePackSuggestionIgnore"}async onDidInstallExtensions(e){for(let t of e)t.operation===2&&t.local&&await this.onDidInstallExtension(t.local,!!t.context?.extensionsSync)}async onDidInstallExtension(e,t){let o=e.manifest.contributes?.localizations?.[0];if(!o||Kr===o.languageId)return;let{languageId:n,languageName:r}=o;this.notificationService.prompt(wt.Info,d(12692,null,this.productService.nameLong,r||n),[{label:d(12690,null),run:async()=>{await this.localeService.setLocale({id:n,label:r??n,extensionId:e.identifier.id},!0)}}],{sticky:!0,priority:3,neverShowAgain:{id:"langugage.update.donotask",isSecondary:!0,scope:2}})}async onDidUninstallExtension(e){await this.isLocaleInstalled(Kr)||this.localeService.setLocale({id:"en",label:"English"})}async checkAndInstall(){let e=Kr,t=Kye??"",o=JSON.parse(this.storageService.get(sle.LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY,-1,"[]"));if(!this.galleryService.isEnabled()||!e||!t||SI.isDefaultVariant()||t.startsWith(e)||o.includes(t)||await this.isLocaleInstalled(t))return;let r=t,s=await this.galleryService.query({text:`tag:lp-${t}`},Ie.None);if(s.total===0&&(t=t.split("-")[0],s=await this.galleryService.query({text:`tag:lp-${t}`},Ie.None),s.total===0))return;let l=s.total===1?s.firstPage[0]:s.firstPage.find(N=>N.publisher==="MS-CEINTL"&&N.name.startsWith("vscode-language-pack")),c=l??s.firstPage[0];if(!c.assets.manifest)return;let[u,p]=await Promise.all([this.galleryService.getManifest(c,Ie.None),this.galleryService.getCoreTranslation(c,t)]),h=u?.contributes?.localizations?.find(N=>t.startsWith(N.languageId.toLowerCase())),g=h&&h.languageName||t,f=h&&(h.localizedLanguageName||h.languageName)||t,v=p?.contents?.["vs/workbench/contrib/localization/electron-browser/minimalTranslations"]??{},b=l?"installAndRestartMessage":"showLanguagePackExtensions",S=!v[b],y={};Object.keys(Mei).forEach(N=>{!v[N]||S?y[N]=Mei[N].replace("{0}",()=>g):y[N]=`${v[N].replace("{0}",()=>f)} (${Mei[N].replace("{0}",()=>g)})`});let w=N=>{this.telemetryService.publicLog("languagePackSuggestion:popup",{userReaction:N,language:t})},x={label:y.searchMarketplace,run:async()=>{w("search"),await this.extensionsWorkbenchService.openSearch(`tag:lp-${t}`)}},E={label:y.installAndRestart,run:async()=>{w("installAndRestart"),await this.localeService.setLocale({id:t,label:g,extensionId:l?.identifier.id,galleryExtension:l},!0)}},M=y[b];this.notificationService.prompt(wt.Info,M,[l?E:x,{label:d(12691,null),isSecondary:!0,run:()=>{o.push(r),this.storageService.store(sle.LANGUAGEPACK_SUGGESTION_IGNORE_STORAGE_KEY,JSON.stringify(o),-1,0),w("neverShowAgain")}}],{priority:1,onCancel:()=>{w("cancelled")}})}async isLocaleInstalled(e){return(await this.extensionManagementService.getInstalled()).some(o=>!!o.manifest.contributes?.localizations?.length&&o.manifest.contributes.localizations.some(n=>e.startsWith(n.languageId.toLowerCase())))}};sle=I([m(0,Ne),m(1,AU),m(2,Ze),m(3,de),m(4,xs),m(5,ga),m(6,Ui),m(7,_e)],sle);var $Pn=oe.as(Zi.Workbench);$Pn.registerWorkbenchContribution(sle,4);function Yji(a,i,e){if(a.length)pbt(a.map(t=>async()=>{let o=qHo(t);o&&i.showItemInFolder(o.fsPath)}));else if(e.getWorkspace().folders.length){let t=qHo(e.getWorkspace().folders[0].uri);t&&i.showItemInFolder(t.fsPath)}}function qHo(a){switch(a.scheme){case Q.file:case Q.vscodeUserData:return a.with({scheme:Q.file});case Q.vscodeRemote:{if(Gb(a.authority)==="wsl"){let e=c_t(a.authority);if(e)return A.from({scheme:Q.file,authority:"wsl$",path:`/${e}${a.path}`})}return}default:return}}var Oei="revealFileInOS",Xji=ii?P(12353,"Reveal in File Explorer"):et?P(12352,"Reveal in Finder"):P(12351,"Open Containing Folder"),Lje=C.or(Ho.Scheme.isEqualTo(Q.file),Ho.Scheme.isEqualTo(Q.vscodeUserData));xt.registerCommandAndKeybindingRule({id:Oei,weight:200,when:me.focus.toNegated(),primary:2608,win:{primary:1584},handler:(a,i)=>{let e=lV(i,a.get(Co),a.get(ie),a.get(kt),a.get(Qa));Yji(e,a.get(wo),a.get(Ae))}});var jPn="workbench.action.files.revealActiveFileInWindows";xt.registerCommandAndKeybindingRule({weight:200,when:void 0,primary:Gi(2089,48),id:jPn,handler:a=>{let e=a.get(ie).activeEditor,t=po.getOriginalUri(e,{filterByScheme:[Q.file],supportSideBySide:1});Yji(t?[t]:[],a.get(wo),a.get(Ae))}});ast(Oei,Xji.value,Lje,"2_files",!1,0);var Fei={id:Oei,title:Xji.value};be.appendMenuItem(R.OpenEditorsContext,{group:"navigation",order:20,command:Fei,when:Lje});be.appendMenuItem(R.OpenEditorsContextShare,{title:d(12350,null),submenu:R.MenubarShare,group:"share",order:3});be.appendMenuItem(R.ExplorerContext,{group:"navigation",order:20,command:Fei,when:Lje});var QPn=P(12349,"File");TP({id:Oei,title:Xji,category:QPn},Lje);be.appendMenuItem(R.ChatAttachmentsContext,{group:"navigation",order:20,command:Fei,when:Lje});be.appendMenuItem(R.ChatInlineResourceAnchorContext,{group:"navigation",order:20,command:Fei,when:Lje});var fft=class extends k{constructor(e){super();this._delayer=this._register(new Aa(2e3));this._register(e.onDidChangeDisplay(()=>{this._delayer.trigger(()=>(zw.clearAllFontInfos(),Promise.resolve()))}))}};fft=I([m(0,wo)],fft);oe.as(Zi.Workbench).registerWorkbenchContribution(fft,4);if(et){let a=function(i){return()=>{zi().document.execCommand(i)}};xt.registerCommandAndKeybindingRule({id:"execCut",primary:2102,handler:a("cut"),weight:0,when:void 0}),xt.registerCommandAndKeybindingRule({id:"execCopy",primary:2081,handler:a("copy"),weight:0,when:void 0}),xt.registerCommandAndKeybindingRule({id:"execPaste",primary:2100,handler:a("paste"),weight:0,when:void 0})}var vye=class extends k{static{this.SELECTION_LENGTH_LIMIT=65536}constructor(i,e){if(super(),Sn){let t=i.getOption(121);this._register(i.onDidChangeConfiguration(n=>{n.hasChanged(121)&&(t=i.getOption(121))}));let o=this._register(new Dt(()=>{if(!i.hasModel())return;let n=i.getModel(),r=i.getSelections();r=r.slice(0),r.sort(G.compareRangesUsingStarts);let s=0;for(let u of r){if(u.isEmpty())return;s+=n.getValueLengthInRange(u)}if(s>vye.SELECTION_LENGTH_LIMIT)return;let l=[];for(let u of r)l.push(n.getValueInRange(u,0));let c=l.join(n.getEOL());e.writeText(c,"selection")},100));this._register(i.onDidChangeCursorSelection(n=>{t&&n.source!=="restoreState"&&o.schedule()}))}}};vye=I([m(1,Bi)],vye);var Mje=class extends k{static{this.ID="workbench.contrib.linuxSelectionClipboardPastePreventer"}constructor(i){super(),this._register(U.runAndSubscribe(Of,({window:e,disposables:t})=>{t.add($(e.document,"mouseup",o=>{o.button===1&&(i.getValue("editor").selectionClipboard||o.preventDefault())}))},{window:ut,disposables:this._store}))}};Mje=I([m(0,B)],Mje);var Jji=class extends Mi{constructor(){super({id:"editor.action.selectionClipboardPaste",label:P(10223,"Paste Selection Clipboard"),precondition:me.writable})}async run(i,e,t){let n=await i.get(Bi).readText("selection");e.trigger("keyboard","paste",{text:n,pasteOnNewLine:!1,multicursorText:null})}};Eo(mw,vye,0);Sn&&(bt(Mje.ID,Mje,vt.BlockRestore),ri(Jji));var vft=class extends k{constructor(i,e){super(),this._register(e.onDidResumeOS(()=>{i.listCodeEditors().forEach(t=>t.render(!0))}))}};vft=I([m(0,Qt),m(1,wo)],vft);oe.as(Zi.Workbench).registerWorkbenchContribution(vft,4);var Zji=class a extends z{static{this.resource=A.parse("inmemory:///tm-log.txt")}constructor(){super({id:"editor.action.startDebugTextMate",title:P(10224,"Start TextMate Syntax Grammar Logging"),category:Fe.Developer,f1:!0})}_getOrCreateModel(i){let e=i.getModel(a.resource);return e||i.createModel("",null,a.resource)}_append(i,e){let t=i.getLineCount();i.applyEdits([{range:new G(t,1073741824,t,1073741824),text:e}])}async run(i){let e=i.get(pQ),t=i.get(_t),o=i.get(ie),n=i.get(Qt),r=i.get(ti),s=i.get(Jr),l=i.get(Ol),c=i.get(ge),u=Ve(s.tmpDir,`vcode-tm-log-${ht()}.txt`);await c.createFile(u);let p=l.createLogger(u,{name:"debug textmate"}),h=this._getOrCreateModel(t),g=b=>{this._append(h,b+`
`),v(),p.info(b),p.flush()};if(await r.openWindow([{fileUri:u}],{forceNewWindow:!0}),!await o.openEditor({resource:h.uri,options:{pinned:!0}}))return;let v=()=>{let b=n.listCodeEditors();for(let S of b)S.hasModel()&&S.getModel().uri.toString()===a.resource.toString()&&S.revealLine(S.getModel().getLineCount())};g("// Open the file you want to test to the side and watch here"),g(`// Output mirrored at ${u}`),e.startDebugMode(b=>{this._append(h,b+`
`),v(),p.info(b),p.flush()},()=>{})}};W(Zji);var Wei=class extends k{constructor(){super(...arguments);this._onCloseEmitter=this._register(new T);this._onReloadEmitter=this._register(new T);this._onTerminateEmitter=this._register(new T);this._onAttachEmitter=this._register(new T)}static{this.ChannelName="extensionhostdebugservice"}call(e,t,o){switch(t){case"close":return Promise.resolve(this._onCloseEmitter.fire({sessionId:o[0]}));case"reload":return Promise.resolve(this._onReloadEmitter.fire({sessionId:o[0]}));case"terminate":return Promise.resolve(this._onTerminateEmitter.fire({sessionId:o[0]}));case"attach":return Promise.resolve(this._onAttachEmitter.fire({sessionId:o[0],port:o[1],subId:o[2]}))}throw new Error("Method not implemented.")}listen(e,t,o){switch(t){case"close":return this._onCloseEmitter.event;case"reload":return this._onReloadEmitter.event;case"terminate":return this._onTerminateEmitter.event;case"attach":return this._onAttachEmitter.event}throw new Error("Method not implemented.")}},Vei=class extends k{constructor(e){super();this.channel=e}reload(e){this.channel.call("reload",[e])}get onReload(){return this.channel.listen("reload")}close(e){this.channel.call("close",[e])}get onClose(){return this.channel.listen("close")}attachSession(e,t,o){this.channel.call("attach",[e,t,o])}get onAttachSession(){return this.channel.listen("attach")}terminateSession(e,t){this.channel.call("terminate",[e,t])}get onTerminateSession(){return this.channel.listen("terminate")}openExtensionDevelopmentHostWindow(e,t){return this.channel.call("openExtensionDevelopmentHostWindow",[e,t])}attachToCurrentWindowRenderer(e){return this.channel.call("attachToCurrentWindowRenderer",[e])}};_w(jR,Wei.ChannelName,{channelClientCtor:Vei});var Bei=class{constructor(i){this.service=i}listen(i,e){throw new Error(`Event not found: ${e}`)}call(i,e,t){if(e==="promptImportantExtensionsInstallNotification")return this.service.promptImportantExtensionsInstallNotification(t[0]);throw new Error(`Call not found: ${e}`)}};var YPn=Oe("runtime-extensions-editor-label-icon",L.extensions,d(11903,null)),sB=class a extends Ls{constructor(){super(...arguments);this.resource=A.from({scheme:"runtime-extensions",path:"default"})}static{this.ID="workbench.runtimeExtensions.input"}get typeId(){return a.ID}get capabilities(){return 10}static get instance(){return(!a._instance||a._instance.isDisposed())&&(a._instance=new a),a._instance}getName(){return d(11902,null)}getIcon(){return YPn}matches(e){return super.matches(e)?!0:e instanceof a}};function Hei(){return 1025+Math.floor(64510*Math.random())}var ale=class extends zs{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(ale.ID,e,t,o,p);this.contextKeyService=n;this._extensionsWorkbenchService=r;this._extensionService=s;this._notificationService=l;this._contextMenuService=c;this._instantiationService=u;this._labelService=h;this._environmentService=g;this._clipboardService=f;this._extensionFeaturesManagementService=v;this._hoverService=b;this._menuService=S;this._list=null,this._elements=null,this._updateSoon=this._register(new Dt(()=>this._updateExtensions(),200)),this._register(this._extensionService.onDidChangeExtensionsStatus(()=>this._updateSoon.schedule())),this._register(this._extensionFeaturesManagementService.onDidChangeAccessData(()=>this._updateSoon.schedule())),this._updateExtensions()}static{this.ID="workbench.editor.runtimeExtensions"}async _updateExtensions(){this._elements=await this._resolveExtensions(),this._list?.splice(0,this._list.length,this._elements)}async _resolveExtensions(){await this._extensionService.whenInstalledExtensionsRegistered();let e=this._extensionService.extensions.filter(h=>!!h.main||!!h.browser),t=new uu,o=await this._extensionsWorkbenchService.queryLocal();for(let h of o)t.set(h.identifier.id,h);let n=this._extensionService.getExtensionsStatus(),r=new uu,s=this._getProfileInfo();if(s){let h=s.startTime;for(let g=0,f=s.deltas.length;g<f;g++){let v=s.ids[g],b=s.deltas[g],S=r.get(v);S||(S=[],r.set(v,S)),S.push(h),h=h+b,S.push(h)}}let l=[];for(let h=0,g=e.length;h<g;h++){let f=e[h],v=null;if(s){let b=r.get(f.identifier)||[],S=0;for(let y=0,w=b.length/2;y<w;y++){let x=b[2*y],E=b[2*y+1];S+=E-x}v={segments:b,totalTime:S}}l[h]={originalIndex:h,description:f,marketplaceInfo:t.get(f.identifier),status:n[f.identifier.value],profileInfo:v||void 0,unresponsiveProfile:this._getUnresponsiveProfile(f.identifier)}}l=l.filter(h=>h.status.activationStarted);let c=h=>h.unresponsiveProfile===s,u=h=>h.profileInfo?.totalTime??0,p=h=>(h.status.activationTimes?.codeLoadingTime??0)+(h.status.activationTimes?.activateCallTime??0);return l=l.sort((h,g)=>c(h)||c(g)?+c(g)-+c(h):u(h)||u(g)?u(g)-u(h):p(h)||p(g)?p(g)-p(h):h.originalIndex-g.originalIndex),l}createEditor(e){e.classList.add("runtime-extensions-editor");let t="runtimeExtensionElementTemplate",o=new class{getHeight(r){return 70}getTemplateId(r){return t}},n={templateId:t,renderTemplate:r=>{let s=D(r,_(".extension")),l=D(s,_(".icon-container")),c=this._instantiationService.createInstance(Hq,l),u=D(s,_("div.desc")),p=D(u,_(".header-container")),h=D(p,_(".header")),g=D(h,_("div.name")),f=D(h,_("span.version")),v=D(u,_("div.msg")),b=new oo(u),S=b.onDidRun(({error:M})=>M&&this._notificationService.error(M)),y=D(s,_(".time")),w=D(y,_("div.activation-time")),x=D(y,_("div.profile-time"));return{root:r,element:s,name:g,version:f,actionbar:b,activationTime:w,profileTime:x,msgContainer:v,set extension(M){c.extension=M||null},disposables:[c,b,S],elementDisposables:[]}},renderElement:(r,s,l)=>{l.elementDisposables=je(l.elementDisposables),l.extension=r.marketplaceInfo,l.root.classList.toggle("odd",s%2===1),l.name.textContent=(r.marketplaceInfo?.displayName||r.description.identifier.value).substr(0,50),l.version.textContent=r.description.version;let c=r.status.activationTimes;if(c){let f=c.codeLoadingTime+c.activateCallTime;l.activationTime.textContent=c.activationReason.startup?`Startup Activation: ${f}ms`:`Activation: ${f}ms`}else l.activationTime.textContent="Activating...";l.actionbar.clear();let u=this._createSlowExtensionAction(r);if(u&&l.actionbar.push(u,{icon:!1,label:!0}),Rr(r.status.runtimeErrors)){let f=this._createReportExtensionIssueAction(r);f&&l.actionbar.push(f,{icon:!1,label:!0})}let p;if(c){let f=c.activationReason.extensionId.value,v=c.activationReason.activationEvent;if(v==="*")p=d(11278,null,f);else if(/^workspaceContains:/.test(v)){let b=v.substr(18);b.indexOf("*")>=0||b.indexOf("?")>=0?p=d(11282,null,b,f):p=d(11281,null,b,f)}else if(/^workspaceContainsTimeout:/.test(v)){let b=v.substr(25);p=d(11283,null,b,f)}else if(v==="onStartupFinished")p=d(11279,null,f);else if(/^onLanguage:/.test(v)){let b=v.substr(11);p=d(11272,null,b,f)}else p=d(11284,null,v,f)}else p=d(11271,null);if(l.elementDisposables.push(this._hoverService.setupManagedHover(yi("mouse"),l.activationTime,p)),St(l.msgContainer),this._getUnresponsiveProfile(r.description.identifier)){let f=_("span",void 0,...ir(" $(alert) Unresponsive")),v=d(11280,null);l.elementDisposables.push(this._hoverService.setupManagedHover(yi("mouse"),f,v)),l.msgContainer.appendChild(f)}if(Rr(r.status.runtimeErrors)){let f=_("span",void 0,...ir(`$(bug) ${d(11270,null,r.status.runtimeErrors.length)}`));l.msgContainer.appendChild(f)}if(r.status.messages&&r.status.messages.length>0){let f=_("span",void 0,...ir(`$(alert) ${r.status.messages[0].message}`));l.msgContainer.appendChild(f)}let h=null;if(r.status.runningLocation&&r.status.runningLocation.equals(new yj(0)))h="$(globe) web worker";else if(r.description.extensionLocation.scheme===Q.vscodeRemote){let f=this._labelService.getHostLabel(Q.vscodeRemote,this._environmentService.remoteAuthority);f?h=`$(remote) ${f}`:h=`$(remote) ${r.description.extensionLocation.authority}`}else r.status.runningLocation&&r.status.runningLocation.affinity>0&&(h=r.status.runningLocation instanceof yj?`$(globe) web worker ${r.status.runningLocation.affinity+1}`:`$(server-process) local process ${r.status.runningLocation.affinity+1}`);if(h){let f=_("span",void 0,...ir(h));l.msgContainer.appendChild(f)}let g=oe.as(qs.ExtensionFeaturesRegistry).getExtensionFeatures();for(let f of g){let v=this._extensionFeaturesManagementService.getAccessData(r.description.identifier,f.id);if(v){let b=v?.current?.status;if(b&&(l.msgContainer.appendChild(_("span",void 0,`${f.label}: `)),l.msgContainer.appendChild(_("span",void 0,...ir(`$(${b.severity===ft.Error?cI.id:fp.id}) ${b.message}`)))),v?.accessTimes.length>0){let S=_("span",void 0,`${d(11273,null,f.label,v.accessTimes.length)}${v.current?d(11276,null,v.current.accessTimes.length):""}`);if(v.current){let y=d(11274,null,ea(v.current.lastAccessed,!0,!0));l.elementDisposables.push(this._hoverService.setupManagedHover(yi("mouse"),S,y))}l.msgContainer.appendChild(S)}}}r.profileInfo?l.profileTime.textContent=`Profile: ${(r.profileInfo.totalTime/1e3).toFixed(2)}ms`:l.profileTime.textContent=""},disposeTemplate:r=>{r.disposables=je(r.disposables)}};this._list=this._instantiationService.createInstance(bc,"RuntimeExtensions",e,o,[n],{multipleSelectionSupport:!1,setRowLineHeight:!1,horizontalScrolling:!1,overrideStyles:{listBackground:Bo},accessibilityProvider:new class{getWidgetAriaLabel(){return d(11275,null)}getAriaLabel(r){return r.description.name}}}),this._list.splice(0,this._list.length,this._elements||void 0),this._register(this._list.onContextMenu(r=>{if(!r.element)return;let s=[];s.push(new it("runtimeExtensionsEditor.action.copyId",d(11267,null,r.element.description.identifier.value),void 0,!0,()=>{this._clipboardService.writeText(r.element.description.identifier.value)}));let l=this._createReportExtensionIssueAction(r.element);l&&s.push(l),s.push(new oi),r.element.marketplaceInfo&&(s.push(new it("runtimeExtensionsEditor.action.disableWorkspace",d(11269,null),void 0,!0,()=>this._extensionsWorkbenchService.setEnablement(r.element.marketplaceInfo,11))),s.push(new it("runtimeExtensionsEditor.action.disable",d(11268,null),void 0,!0,()=>this._extensionsWorkbenchService.setEnablement(r.element.marketplaceInfo,10)))),s.push(new oi);let c=this._menuService.getMenuActions(R.ExtensionEditorContextMenu,this.contextKeyService);s.push(...um(c).secondary),this._contextMenuService.showContextMenu({getAnchor:()=>r.anchor,getActions:()=>s})}))}layout(e){this._list?.layout(e.height)}};ale=I([m(1,_e),m(2,Pe),m(3,X),m(4,Ui),m(5,lt),m(6,Ne),m(7,Xe),m(8,F),m(9,de),m(10,nt),m(11,Mt),m(12,Bi),m(13,Qy),m(14,ot),m(15,Yt)],ale);var Uei=class extends z{constructor(){super({id:"workbench.action.showRuntimeExtensions",title:P(11277,"Show Running Extensions"),category:Fe.Developer,f1:!0,menu:{id:R.ViewContainerTitle,when:C.equals("viewContainer","workbench.view.extensions"),group:"2_enablement",order:3}})}async run(i){await i.get(ie).openEditor(sB.instance,{pinned:!0})}};var H7=class extends it{constructor(e,t){super(H7._id,H7._label,"extension-action report-issue");this.extension=e;this.issueService=t;this.enabled=e.isBuiltin||!!e.repository&&!!e.repository.url}static{this._id="workbench.extensions.action.reportExtensionIssue"}static{this._label=d(11901,null)}async run(){await this.issueService.openReporter({extensionId:this.extension.identifier.value})}};H7=I([m(1,R_)],H7);var zei=class{static fromExtension(i){let e;if(i.bugs&&typeof i.bugs.url=="string"){let t=A.parse(i.bugs.url),o=/\/([^/]+)\/([^/]+)\/issues\/?$/.exec(i.bugs.url);o&&(e={base:t.with({path:null,fragment:null,query:null}).toString(!0),owner:o[1],repo:o[2]})}if(!e&&i.repository&&typeof i.repository.url=="string"){let t=A.parse(i.repository.url),o=/\/([^/]+)\/([^/]+)(\.git)?$/.exec(i.repository.url);o&&(e={base:t.with({path:null,fragment:null,query:null}).toString(!0),owner:o[1],repo:o[2]})}return e&&e.base.indexOf("github")===-1&&(e=void 0),e}},Pje=class extends it{constructor(e,t,o){super("report.slow",d(11935,null),"extension-action report-issue");this.extension=e;this.profile=t;this._instantiationService=o;this.enabled=!!zei.fromExtension(e)}async run(){let e=await this._instantiationService.invokeFunction(e5i,this.extension,this.profile);e&&await e.run()}};Pje=I([m(2,F)],Pje);async function e5i(a,i,e){let t=zei.fromExtension(i);if(!t)return;let o=a.get(Ra),n=a.get(F),r=`https://api.github.com/search/issues?q=is:issue+state:open+in:title+repo:${t.owner}/${t.repo}+%22Extension+causes+high+cpu+load%22`,s;try{s=await o.request({url:r,callSite:"extensionsSlowActions.getSlowExtensionAction"},Ie.None)}catch{return}let l=await jD(s);if(!l)return;let c=JSON.parse(l);if(!(!c||typeof c.total_count!="number"))return c.total_count===0?n.createInstance(bft,i,t,e):n.createInstance(Sft,i,t,e)}var bft=class extends it{constructor(e,t,o,n,r,s,l,c,u){super("report.slow",d(11934,null));this.extension=e;this.repoInfo=t;this.profile=o;this._dialogService=n;this._openerService=r;this._productService=s;this._nativeHostService=l;this._environmentService=c;this._fileService=u}async run(){let e=mje.rewriteAbsolutePaths(this.profile.data,"pii_removed"),t=Ve(this._environmentService.tmpDir,`${this.extension.identifier.value}-unresponsive.cpuprofile.txt`);await this._fileService.writeFile(t,Ke.fromString(JSON.stringify(e,void 0,4)));let o=await this._nativeHostService.getOSProperties(),n=encodeURIComponent("Extension causes high cpu load"),r=`${o.type} ${o.arch} ${o.release}`,s=`:warning: Make sure to **attach** this file from your *home*-directory:
:warning:\`${t}\`

Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load`,l=encodeURIComponent(`- Issue Type: \`Performance\`
- Extension Name: \`${this.extension.name}\`
- Extension Version: \`${this.extension.version}\`
- OS Version: \`${r}\`
- VS Code version: \`${this._productService.version}\`

${s}`),c=`${this.repoInfo.base}/${this.repoInfo.owner}/${this.repoInfo.repo}/issues/new/?body=${l}&title=${n}`;this._openerService.open(A.parse(c)),this._dialogService.info(d(11933,null),d(11931,null,t.fsPath))}};bft=I([m(3,ct),m(4,Je),m(5,Ze),m(6,wo),m(7,Jr),m(8,ge)],bft);var Sft=class extends it{constructor(e,t,o,n,r,s,l){super("show.slow",d(11936,null));this.extension=e;this.repoInfo=t;this.profile=o;this._dialogService=n;this._openerService=r;this._environmentService=s;this._fileService=l}async run(){let e=mje.rewriteAbsolutePaths(this.profile.data,"pii_removed"),t=Ve(this._environmentService.tmpDir,`${this.extension.identifier.value}-unresponsive.cpuprofile.txt`);await this._fileService.writeFile(t,Ke.fromString(JSON.stringify(e,void 0,4)));let o=`${this.repoInfo.base}/${this.repoInfo.owner}/${this.repoInfo.repo}/issues?utf8=\u2713&q=is%3Aissue+state%3Aopen+%22Extension+causes+high+cpu+load%22`;this._openerService.open(A.parse(o)),this._dialogService.info(d(11933,null),d(11932,null,t.fsPath))}};Sft=I([m(3,ct),m(4,Je),m(5,Jr),m(6,ge)],Sft);var U7=le("extensionHostProfileService"),Aje=new Y("profileSessionState","none"),Ift=new Y("extensionHostProfileRecorded",!1),t5i=(o=>(o[o.None=0]="None",o[o.Starting=1]="Starting",o[o.Running=2]="Running",o[o.Stopping=3]="Stopping",o))(t5i||{}),jO=class extends ale{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super(e,t,o,n,r,s,l,c,u,p,h,g,f,b,S,y);this._extensionHostProfileService=v;this._profileInfo=this._extensionHostProfileService.lastProfile,this._extensionsHostRecorded=Ift.bindTo(n),this._profileSessionState=Aje.bindTo(n),this._register(this._extensionHostProfileService.onDidChangeLastProfile(()=>{this._profileInfo=this._extensionHostProfileService.lastProfile,this._extensionsHostRecorded.set(!!this._profileInfo),this._updateExtensions()})),this._register(this._extensionHostProfileService.onDidChangeState(()=>{let w=this._extensionHostProfileService.state;this._profileSessionState.set(t5i[w].toLowerCase())}))}_getProfileInfo(){return this._profileInfo}_getUnresponsiveProfile(e){return this._extensionHostProfileService.getUnresponsiveProfile(e)}_createSlowExtensionAction(e){return e.unresponsiveProfile?this._instantiationService.createInstance(Pje,e.description,e.unresponsiveProfile):null}_createReportExtensionIssueAction(e){return e.marketplaceInfo?this._instantiationService.createInstance(H7,e.description):null}};jO=I([m(1,_e),m(2,Pe),m(3,X),m(4,Ui),m(5,lt),m(6,Ne),m(7,Xe),m(8,F),m(9,de),m(10,nt),m(11,Mt),m(12,Bi),m(13,U7),m(14,Qy),m(15,ot),m(16,Yt)],jO);var Kei=class a extends z{static{this.ID="workbench.extensions.action.extensionHostProfile"}static{this.LABEL=d(11937,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Start Extension Host Profile"},precondition:Aje.isEqualTo("none"),icon:L.circleFilled,menu:[{id:R.EditorTitle,when:C.and(Tr.isEqualTo(jO.ID),Aje.notEqualsTo("running")),group:"navigation"},{id:R.ExtensionEditorContextMenu,when:Aje.notEqualsTo("running"),group:"profiling"}]})}run(i){return i.get(U7).startProfiling(),Promise.resolve()}},Gei=class a extends z{static{this.ID="workbench.extensions.action.stopExtensionHostProfile"}static{this.LABEL=d(11941,null)}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Stop Extension Host Profile"},icon:L.debugStop,menu:[{id:R.EditorTitle,when:C.and(Tr.isEqualTo(jO.ID),Aje.isEqualTo("running")),group:"navigation"},{id:R.ExtensionEditorContextMenu,when:Aje.isEqualTo("running"),group:"profiling"}]})}run(i){return i.get(U7).stopProfiling(),Promise.resolve()}},qei=class a extends z{static{this.LABEL=d(11938,null)}static{this.ID="workbench.extensions.action.openExtensionHostProfile"}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Open Extension Host Profile"},precondition:Ift,icon:L.graph,menu:[{id:R.EditorTitle,when:C.and(Tr.isEqualTo(jO.ID)),group:"navigation"},{id:R.ExtensionEditorContextMenu,when:Ift,group:"profiling"}]})}async run(i){let e=i.get(U7),t=i.get(fe),o=i.get(ie);e.lastProfileSavedTo||await t.executeCommand(yft.ID),e.lastProfileSavedTo&&await o.openEditor({resource:e.lastProfileSavedTo,options:{revealIfOpened:!0,override:"jsProfileVisualizer.cpuprofile.table"}},En)}},yft=class a extends z{static{this.LABEL=d(11939,null)}static{this.ID="workbench.extensions.action.saveExtensionHostProfile"}constructor(){super({id:a.ID,title:{value:a.LABEL,original:"Save Extension Host Profile"},precondition:Ift,icon:L.saveAll,menu:[{id:R.EditorTitle,when:C.and(Tr.isEqualTo(jO.ID)),group:"navigation"},{id:R.ExtensionEditorContextMenu,when:Ift,group:"profiling"}]})}run(i){let e=i.get(Mt),t=i.get(U7),o=i.get(ge),n=i.get(nn);return this._asyncRun(e,t,o,n)}async _asyncRun(i,e,t,o){let n=await o.showSaveDialog({title:d(11940,null),availableFileSystems:[Q.file],defaultUri:Ve(await o.defaultFilePath(),`CPU-${new Date().toISOString().replace(/[\-:]/g,"")}.cpuprofile`),filters:[{name:"CPU Profiles",extensions:["cpuprofile","txt"]}]});if(!n)return;let r=e.lastProfile,s=r?r.data:{},l=n.fsPath;i.isBuilt&&(s=mje.rewriteAbsolutePaths(s,"piiRemoved"),l=l+".txt");let c=A.file(l);return e.lastProfileSavedTo=c,t.writeFile(c,Ke.fromString(JSON.stringify(r?r.data:{},null,"	")))}};async function jHo(a,i,e,t){let o=await a.getInspectPorts(1,!1);if(o.length===0){(await e.confirm({message:d(11915,null),detail:d(11916,null,t.nameLong),primaryButton:d(11917,null)})).confirmed&&await i.relaunch({addArgs:[`--inspect-extensions=${Hei()}`]});return}return o.length>1&&console.warn("There are multiple extension hosts available for debugging. Picking the first one..."),o[0].port}async function QHo(a,i){let e=await a.attachToCurrentWindowRenderer(i);return e.success?e.port:void 0}var $ei=class extends z{constructor(){super({id:"workbench.extensions.action.devtoolsExtensionHost",title:P(11914,"Debug Extension Host In Dev Tools"),category:Fe.Developer,f1:!0,icon:L.debugStart})}async run(i){let e=i.get(lt),t=i.get(wo),o=i.get($e),n=await e.getInspectPorts(1,!0);if(n.length===0){console.log("[devtoolsExtensionHost] No extension host inspect ports found.");return}let r=n.filter(l=>l.devtoolsUrl).map(l=>({label:l.devtoolsLabel??`${l.host}:${l.port}`,detail:`${l.host}:${l.port}`,portInfo:l}));if(r.length===1){let l=r[0].portInfo;t.openDevToolsWindow(l.devtoolsUrl);return}let s=await o.pick(r,{placeHolder:d(11918,null),matchOnDetail:!0});if(s){let l=s.portInfo;t.openDevToolsWindow(l.devtoolsUrl)}}},jei=class extends z{constructor(){super({id:"workbench.extensions.action.debugExtensionHost",title:P(11907,"Debug Extension Host In New Window"),category:Fe.Developer,f1:!0,icon:L.debugStart,menu:{id:R.EditorTitle,when:Tr.isEqualTo(jO.ID),group:"navigation"}})}async run(i){let e=i.get(lt),t=i.get(wo),o=i.get(ct),n=i.get(Ze),r=i.get(F),s=i.get(ti),l=await jHo(e,t,o,n);if(l===void 0)return;r.createInstance(lle).storeDebugOnNewWindow(l),s.openWindow()}},Qei=class extends z{constructor(){super({id:"workbench.action.debugRenderer",title:P(11911,"Debug Renderer In New Window"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(jR),t=i.get(Jr),o=i.get(F),n=i.get(ti),r=await QHo(e,t.window.id);if(r===void 0)return;o.createInstance(lle).storeRendererDebugOnNewWindow(r),n.openWindow({remoteAuthority:null})}},Yei=class extends z{constructor(){super({id:"workbench.action.debugExtensionHostAndRenderer",title:P(11910,"Debug Extension Host and Renderer In New Window"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(lt),t=i.get(wo),o=i.get(ct),n=i.get(Ze),r=i.get(jR),s=i.get(Jr),l=i.get(F),c=i.get(ti),[u,p]=await Promise.all([jHo(e,t,o,n),QHo(r,s.window.id)]);if(u===void 0||p===void 0)return;let h=l.createInstance(lle);h.storeDebugOnNewWindow(u),h.storeRendererDebugOnNewWindow(p),c.openWindow({remoteAuthority:null})}},lle=class{constructor(i){this._storageService=i}storeDebugOnNewWindow(i){this._storageService.store("debugExtensionHost.debugPort",i,-1,1)}getAndDeleteDebugPortIfSet(){let i=this._storageService.getNumber("debugExtensionHost.debugPort",-1);return i!==void 0&&this._storageService.remove("debugExtensionHost.debugPort",-1),i}storeRendererDebugOnNewWindow(i){this._storageService.store("debugRenderer.debugPort",i,-1,1)}getAndDeleteRendererDebugPortIfSet(){let i=this._storageService.getNumber("debugRenderer.debugPort",-1);return i!==void 0&&this._storageService.remove("debugRenderer.debugPort",-1),i}};lle=I([m(0,de)],lle);var $Ho={trace:!0,resolveSourceMapLocations:null,eagerSources:!0,timeouts:{sourceMapMinPause:3e4,sourceMapCumulativePause:3e5}},Nje=class extends k{constructor(e,t,o){super();this._debugService=e;this._instantiationService=t;let n=this._instantiationService.createInstance(lle),r=n.getAndDeleteDebugPortIfSet(),s=n.getAndDeleteRendererDebugPortIfSet(),l=[];r!==void 0&&l.push(o.withProgress({location:15,title:d(11909,null)},async()=>{await this._debugService.startDebugging(void 0,{type:"node",name:d(11908,null),request:"attach",port:r,...$Ho})})),s!==void 0&&l.push(o.withProgress({location:15,title:d(11913,null)},async()=>{await this._debugService.startDebugging(void 0,{type:"chrome",name:d(11912,null),request:"attach",port:s,...$Ho})})),Promise.all(l)}};Nje=I([m(0,Hi),m(1,F),m(2,Go)],Nje);var cle=class{constructor(i,e,t,o){this._host=i;this._port=e;this._extensionService=t;this._profilingService=o}async start(){let i=await this._profilingService.startProfiling({host:this._host,port:this._port});return{stop:bd(async()=>{let e=await this._profilingService.stopProfiling(i);await this._extensionService.whenInstalledExtensionsRegistered();let t=this._extensionService.extensions;return this._distill(e,t)})}}_distill(i,e){let t=Hp.forUris();for(let f of e)f.extensionLocation.scheme===Q.file&&t.set(A.file(f.extensionLocation.fsPath),f);let o=i.nodes,n=new Map,r=new Map;for(let f of o)n.set(f.id,f);function s(f,v){if(v){if(v==="self"&&f.callFrame.url){let b;try{b=t.findSubstr(A.parse(f.callFrame.url))}catch{}b&&(v=b.identifier.value)}}else switch(f.callFrame.functionName){case"(root)":break;case"(program)":v="program";break;case"(garbage collector)":v="gc";break;default:v="self";break}if(r.set(f.id,v),f.children)for(let b of f.children){let S=n.get(b);S&&s(S,v)}}s(o[0],null);let l=i.samples||[],c=i.timeDeltas||[],u=[],p=[],h=0,g;for(let f=0;f<l.length;f++){let v=l[f],b=r.get(v);b!==g&&(g&&(p.push(g),u.push(h)),g=b??void 0,h=0),h+=c[f]}return g&&(p.push(g),u.push(h)),{startTime:i.startTime,endTime:i.endTime,deltas:u,ids:p,data:i,getAggregatedTimes:()=>{let f=new Map;for(let v=0;v<p.length;v++){let b=p[v];f.set(b,(f.get(b)||0)+u[v])}return f}}}};cle=I([m(2,lt),m(3,lei)],cle);var Oje=class extends k{constructor(e,t,o,n,r,s,l){super();this._extensionService=e;this._editorService=t;this._instantiationService=o;this._nativeHostService=n;this._dialogService=r;this._statusbarService=s;this._productService=l;this._onDidChangeState=this._register(new T);this.onDidChangeState=this._onDidChangeState.event;this._onDidChangeLastProfile=this._register(new T);this.onDidChangeLastProfile=this._onDidChangeLastProfile.event;this._unresponsiveProfiles=new uu;this._state=0;this.profilingStatusBarIndicatorLabelUpdater=this._register(new ue);this._profile=null,this._profileSession=null,this._setState(0),Ge.registerCommand("workbench.action.extensionHostProfiler.stop",()=>{this.stopProfiling(),this._editorService.openEditor(sB.instance,{pinned:!0})})}get state(){return this._state}get lastProfile(){return this._profile}_setState(e){this._state!==e&&(this._state=e,this._state===2?this.updateProfilingStatusBarIndicator(!0):this._state===3&&this.updateProfilingStatusBarIndicator(!1),this._onDidChangeState.fire(void 0))}updateProfilingStatusBarIndicator(e){if(this.profilingStatusBarIndicatorLabelUpdater.clear(),e){let t={name:d(11925,null),text:d(11919,null),showProgress:!0,ariaLabel:d(11919,null),tooltip:d(11924,null),command:"workbench.action.extensionHostProfiler.stop"},o=Date.now(),n=Ly(ut,()=>{this.profilingStatusBarIndicator?.update({...t,text:d(11920,null,Math.round((new Date().getTime()-o)/1e3))})},1e3);this.profilingStatusBarIndicatorLabelUpdater.value=n,this.profilingStatusBarIndicator?this.profilingStatusBarIndicator.update(t):this.profilingStatusBarIndicator=this._statusbarService.addEntry(t,"status.profiler",1)}else this.profilingStatusBarIndicator&&(this.profilingStatusBarIndicator.dispose(),this.profilingStatusBarIndicator=void 0)}async startProfiling(){if(this._state!==0)return null;let e=await this._extensionService.getInspectPorts(1,!0);return e.length===0?this._dialogService.confirm({type:"info",message:d(11921,null),detail:d(11922,null,this._productService.nameLong),primaryButton:d(11923,null)}).then(t=>{t.confirmed&&this._nativeHostService.relaunch({addArgs:[`--inspect-extensions=${Hei()}`]})}):(e.length>1&&console.warn("There are multiple extension hosts available for profiling. Picking the first one..."),this._setState(1),this._instantiationService.createInstance(cle,e[0].host,e[0].port).start().then(t=>{this._profileSession=t,this._setState(2)},t=>{mt(t),this._setState(0)}))}stopProfiling(){this._state!==2||!this._profileSession||(this._setState(3),this._profileSession.stop().then(e=>{this._setLastProfile(e),this._setState(0)},e=>{mt(e),this._setState(0)}),this._profileSession=null)}_setLastProfile(e){this._profile=e,this.lastProfileSavedTo=void 0,this._onDidChangeLastProfile.fire(void 0)}getUnresponsiveProfile(e){return this._unresponsiveProfiles.get(e)}setUnresponsiveProfile(e,t){this._unresponsiveProfiles.set(e,t),this._setLastProfile(t)}};Oje=I([m(0,lt),m(1,ie),m(2,F),m(3,wo),m(4,ct),m(5,Fr),m(6,Ze)],Oje);var Xei=class extends z{constructor(){super({id:"workbench.extensions.action.openExtensionsFolder",title:P(11928,"Open Extensions Folder"),category:Fe.Developer,f1:!0})}async run(i){let e=i.get(wo),t=i.get(ge),o=i.get(Jr),n=A.file(o.extensionsPath),r=await t.resolve(n),s;if(r.children&&r.children.length>0?s=r.children[0].resource:s=n,s.scheme===Q.file)return e.showItemInFolder(s.fsPath)}},Jei=class extends z{constructor(){super({id:"_workbench.extensions.action.cleanUpExtensionsFolder",title:P(11927,"Cleanup Extensions Folder"),category:Fe.Developer,f1:!0})}async run(i){return i.get(xs).cleanUp()}};function YHo(a,i,e,t){let{sample:o,perfBaseline:n,source:r}=a;i.publicLog2("unresponsive.sample",{perfBaseline:n,selfTime:o.selfTime,totalTime:o.totalTime,percentage:o.percentage,functionName:o.location,callers:o.caller.map(l=>l.location).join("<"),callersAnnotated:o.caller.map(l=>`${l.percentage}|${l.location}`).join("<"),source:r});let s=new i5i(a);t?J7.onUnexpectedError(s):e.error(s)}var i5i=class extends Error{constructor(i){if(Error.hasOwnProperty("stackTraceLimit")){let t=Error,o=t.stackTraceLimit;t.stackTraceLimit=0,super(`PerfSampleError: by ${i.source} in ${i.sample.location}`),t.stackTraceLimit=o}else super(`PerfSampleError: by ${i.source} in ${i.sample.location}`);this.name="PerfSampleError",this.selfTime=i.sample.selfTime;let e=[i.sample.absLocation,...i.sample.caller.map(t=>t.absLocation)];this.stack=`
	 at ${e.join(`
	 at `)}`}};var Cft=le("IProfileAnalysisWorkerService"),wft=class{constructor(i,e,t){this._telemetryService=i;this._logService=e;this._webWorkerService=t}async _withWorker(i){let e=this._webWorkerService.createWorkerClient(new Ak({esmModuleLocation:In.asBrowserUri("vs/platform/profiling/electron-browser/profileAnalysisWorkerMain.js"),label:"CpuProfileAnalysisWorker"}));try{return await i(e.proxy)}finally{e.dispose()}}async analyseBottomUp(i,e,t,o){return this._withWorker(async n=>{let r=await n.$analyseBottomUp(i);if(r.kind===2)for(let s of r.samples)YHo({sample:s,perfBaseline:t,source:e(s.url)},this._telemetryService,this._logService,o);return r.kind})}async analyseByLocation(i,e){return this._withWorker(async t=>await t.$analyseByUrlCategory(i,e))}};wft=I([m(0,_e),m(1,re),m(2,Bw)],wft);Ce(Cft,wft,1);var Fje=class{constructor(i,e,t,o,n,r,s,l,c,u,p,h){this._extensionService=i;this._extensionProfileService=e;this._telemetryService=t;this._logService=o;this._notificationService=n;this._editorService=r;this._instantiationService=s;this._environmentServie=l;this._profileAnalysisService=c;this._configService=u;this._fileService=p;this._blame=new HS;this._perfBaseline=-1;h.perfBaseline.then(g=>{g<0||(this._perfBaseline=g,this._unresponsiveListener=i.onDidChangeResponsiveChange(this._onDidChangeResponsiveChange,this))})}dispose(){this._unresponsiveListener?.dispose(),this._session?.dispose(!0)}async _onDidChangeResponsiveChange(i){if(i.extensionHostKind!==1)return;let e=await i.getInspectListener(!0);if(e){if(i.isResponsive&&this._session)this._session.cancel(),this._logService.info("UNRESPONSIVE extension host: received responsive event and cancelling profiling session");else if(!i.isResponsive&&!this._session){let t=new qe;this._session=t;let o;try{o=await this._instantiationService.createInstance(cle,e.host,e.port).start()}catch{this._session=void 0;return}this._logService.info("UNRESPONSIVE extension host: starting to profile NOW");try{await Li(5e3,t.token)}catch{}try{this._processCpuProfile(await o.stop())}catch(n){mt(n)}finally{this._session=void 0}}}}async _processCpuProfile(i){if(await this._extensionService.whenInstalledExtensionsRegistered(),this._configService.getValue("application.experimental.rendererProfiling")){let h=Hp.forUris();h.fill(this._extensionService.extensions.map(g=>[g.extensionLocation,g])),await this._profileAnalysisService.analyseBottomUp(i.data,g=>h.findSubstr(A.parse(g))?.identifier.value??"<<not-found>>",this._perfBaseline,!1)}let e=this._extensionService.extensions.filter(h=>h.extensionLocation.scheme===Q.file).map(h=>[h.extensionLocation,hi.toKey(h.identifier)]),t=await this._profileAnalysisService.analyseByLocation(i.data,e),o=0,n="",r=-1;for(let[h,g]of t)o+=g,g>r&&(r=g,n=h);let s=r/(o/100),l=await this._extensionService.getExtension(n);if(!l)return;let c=ht(),u=Ve(this._environmentServie.tmpDir,`exthost-${Math.random().toString(16).slice(2,8)}.cpuprofile`);if(await this._fileService.writeFile(u,Ke.fromString(JSON.stringify(i.data))),this._logService.warn(`UNRESPONSIVE extension host: '${n}' took ${s}% of ${r/1e3}ms, saved PROFILE here: '${u}'`),this._telemetryService.publicLog2("exthostunresponsive",{profilingSessionId:c,duration:o,data:t.map(h=>h[0]).flat(),id:hi.toKey(l.identifier)}),this._extensionProfileService.setUnresponsiveProfile(l.identifier,i),!(s>=95&&r>=5e6))return;let p=await this._instantiationService.invokeFunction(e5i,l,i);p&&(this._blame.has(l.identifier)||this._blame.size>=3||(this._blame.add(l.identifier),this._notificationService.prompt(ft.Warning,d(11930,null,l.displayName||l.name),[{label:d(11929,null),run:()=>this._editorService.openEditor(sB.instance,{pinned:!0})},p],{priority:2})))}};Fje=I([m(0,lt),m(1,U7),m(2,_e),m(3,re),m(4,Ne),m(5,ie),m(6,F),m(7,Jr),m(8,Cft),m(9,B),m(10,ge),m(11,Kx)],Fje);function kft(a,i,e,t,o,n){let r=[],s=[],l=[];if(!i){let V=a.filter(({identifier:H})=>o.every(K=>K.toLowerCase()!==H.id.toLowerCase()));return{local:{added:r,removed:s,updated:l},remote:V.length>0?{added:V,updated:[],removed:[],all:V}:null}}a=a.map(o5i),i=i.map(o5i),e=e?e.map(o5i):null;let c=new Map,u=V=>{V.uuid&&c.set(V.id.toLowerCase(),V.uuid)};a.forEach(({identifier:V})=>u(V)),i.forEach(({identifier:V})=>u(V)),e?.forEach(({identifier:V})=>u(V)),t?.forEach(({identifier:V})=>u(V)),n?.forEach(V=>u(V));let p=V=>{let H=V.identifier.uuid||c.get(V.identifier.id.toLowerCase());return H?`uuid:${H}`:`id:${V.identifier.id.toLowerCase()}`},h=(V,H)=>(V.set(p(H),H),V),g=a.reduce(h,new Map),f=i.reduce(h,new Map),v=i.reduce((V,H)=>h(V,io(H)),new Map),b=e?e.reduce(h,new Map):null,S=t.reduce(h,new Map),y=o.reduce((V,H)=>{let K=c.get(H.toLowerCase());return V.add(K?`uuid:${K}`:`id:${H.toLowerCase()}`)},new Set),w=n?n.reduce((V,{id:H,uuid:K})=>(K=K??c.get(H.toLowerCase()),V.add(K?`uuid:${K}`:`id:${H.toLowerCase()}`)),new Set):null,x=Zei(g,f,y,!1);if(x.added.size>0||x.removed.size>0||x.updated.size>0){let V=Zei(b,g,y,!1),H=Zei(b,f,y,!0),K=(j,J,se,ae)=>{let ce,Se,Re;return J.installed?(ce=ae.pinned,Re=ae.preRelease,ce&&(Se=ae.version)):(ce=se.pinned,Re=se.preRelease,ce&&(Se=se.version)),ce===void 0&&(ce=J.pinned,ce&&(Se=J.version)),Re===void 0&&(Re=J.preRelease),{...ae,installed:J.installed||se.installed,pinned:ce,preRelease:Re,version:Se??(se.version&&(!J.installed||BM(se.version,J.version))?se.version:J.version),state:XPn(J,se,b?.get(j))}};for(let j of H.removed.values()){let J=g.get(j);if(!J)continue;let se=Ti(b?.get(j)),ae=w&&!w.has(j)&&se.installed;J.installed&&ae?s.push(J.identifier):v.set(j,J)}for(let j of H.added.values()){let J=Ti(f.get(j)),se=g.get(j);if(se){if(x.updated.has(j)){let ae=K(j,se,J,J);XHo(se,J,!1,!1)||l.push(xft(ae,j)),v.set(j,ae)}}else J.installed&&r.push(xft(J,j))}for(let j of H.updated.values()){let J=Ti(f.get(j)),se=Ti(b?.get(j)),ae=g.get(j);if(ae)if(w&&!w.has(j)&&se.installed&&ae.installed&&!J.installed)s.push(ae.identifier);else{let Se=K(j,ae,J,J);l.push(xft(Se,j)),v.set(j,Se)}else J.installed&&r.push(xft(J,j))}for(let j of V.added.values())H.added.has(j)||v.set(j,Ti(g.get(j)));for(let j of V.updated.values()){if(H.removed.has(j)||H.updated.has(j))continue;let J=Ti(g.get(j)),se=Ti(f.get(j));v.set(j,K(j,J,se,J))}for(let j of V.removed.values())H.updated.has(j)||H.removed.has(j)||S.has(j)||Ti(f.get(j)).installed&&w&&(w.has(j)||!Ti(b?.get(j)).installed||v.delete(j))}let E=[],M=Zei(f,v,new Set,!0),N=M.added.size>0||M.updated.size>0||M.removed.size>0;return N&&v.forEach((V,H)=>E.push(xft(V,H))),{local:{added:r,removed:s,updated:l},remote:N?{added:[...M.added].map(V=>v.get(V)),updated:[...M.updated].map(V=>v.get(V)),removed:[...M.removed].map(V=>f.get(V)),all:E}:null}}function Zei(a,i,e,t){let o=a?[...a.keys()].filter(c=>!e.has(c)):[],n=[...i.keys()].filter(c=>!e.has(c)),r=n.filter(c=>!o.includes(c)).reduce((c,u)=>(c.add(u),c),new Set),s=o.filter(c=>!n.includes(c)).reduce((c,u)=>(c.add(u),c),new Set),l=new Set;for(let c of o){if(s.has(c))continue;let u=a.get(c),p=i.get(c);(!p||!XHo(u,p,t,!0))&&l.add(c)}return{added:r,removed:s,updated:l}}function XHo(a,i,e,t){return!(a.disabled!==i.disabled||!!a.isApplicationScoped!=!!i.isApplicationScoped||t&&a.installed!==i.installed||a.installed&&i.installed&&(a.preRelease!==i.preRelease||a.pinned!==i.pinned||i.pinned&&a.version!==i.version)||!JPn(a.state,i.state)||e&&a.version!==i.version)}function XPn(a,i,e){let t=a.state,o=i.state,n=e?.state;if(!i.version||t&&BM(a.version,i.version))return t;if(o&&BM(i.version,a.version)||!t)return o;if(!o)return t;let r=io(t),s=n?n5i(n,o):{added:Object.keys(o).reduce((c,u)=>(c.add(u),c),new Set),removed:new Set,updated:new Set},l=n?n5i(n,t):{added:Object.keys(t).reduce((c,u)=>(c.add(u),c),new Set),removed:new Set,updated:new Set};for(let c of[...s.added.values(),...s.updated.values()])r[c]=o[c];for(let c of s.removed.values())l.updated.has(c)||delete r[c];return r}function n5i(a,i){let e=Object.keys(a),t=Object.keys(i),o=t.filter(s=>!e.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),n=e.filter(s=>!t.includes(s)).reduce((s,l)=>(s.add(l),s),new Set),r=new Set;for(let s of e){if(n.has(s))continue;let l=a[s],c=i[s];Qi(l,c)||r.add(s)}return{added:o,removed:n,updated:r}}function JPn(a={},i={}){let{added:e,removed:t,updated:o}=n5i(a,i);return e.size===0&&t.size===0&&o.size===0}function o5i(a){return{...a,disabled:!!a.disabled,installed:!!a.installed}}function xft(a,i){let e={...a,identifier:{id:a.identifier.id,uuid:i.startsWith("uuid:")?i.substring(5):void 0},preRelease:!!a.preRelease,pinned:!!a.pinned};return a.disabled||delete e.disabled,a.installed||delete e.installed,a.state||delete e.state,a.isApplicationScoped||delete e.isApplicationScoped,e}async function tti(a,i){let e=JSON.parse(a.content);if(a.version===1||a.version===2){let t=(await i.getInstalled(0)).filter(o=>o.isBuiltin);for(let o of e)a.version===1&&(o.enabled===!1&&(o.disabled=!0),delete o.enabled),a.version===2&&t.every(n=>!Ht(n.identifier,o.identifier))&&(o.installed=!0)}return e}function ZPn(a,i){return a.sort((e,t)=>!e.identifier.uuid&&t.identifier.uuid?-1:e.identifier.uuid&&!t.identifier.uuid?1:oc(e.identifier.id,t.identifier.id)),i?dW(a,{}):JSON.stringify(a)}var eti=class extends WU{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super({syncResource:"extensions",profile:e},t,n,o,r,s,l,g,f,p,h,b);this.extensionManagementService=c;this.ignoredExtensionsManagementService=u;this.instantiationService=y;this.version=6;this.previewResource=this.extUri.joinPath(this.syncPreviewFolder,"extensions.json");this.baseResource=this.previewResource.with({scheme:lk,authority:"base"});this.localResource=this.previewResource.with({scheme:lk,authority:"local"});this.remoteResource=this.previewResource.with({scheme:lk,authority:"remote"});this.acceptedResource=this.previewResource.with({scheme:lk,authority:"accepted"});this.localExtensionsProvider=this.instantiationService.createInstance(Eft),this._register(U.any(U.filter(this.extensionManagementService.onDidInstallExtensions,(w=>w.some(({local:x})=>!!x))),U.filter(this.extensionManagementService.onDidUninstallExtension,(w=>!w.error)),U.filter(S.onDidChange,w=>w.valueChanges.some(({profile:x,changes:E})=>this.syncResource.profile.id===x.id&&E.some(M=>M.key===JJ))),v.onDidChangeExtensionStorageToSync)(()=>this.triggerLocalChange()))}async generateSyncPreview(e,t){let o=e.syncData?await tti(e.syncData,this.extensionManagementService):null,n=t?.skippedExtensions??[],r=t?.builtinExtensions??null,s=t?.syncData?await tti(t.syncData,this.extensionManagementService):null,{localExtensions:l,ignoredExtensions:c}=await this.localExtensionsProvider.getLocalExtensions(this.syncResource.profile);o?this.logService.trace(`${this.syncResourceLogLabel}: Merging remote extensions with local extensions...`):this.logService.trace(`${this.syncResourceLogLabel}: Remote extensions does not exist. Synchronizing extensions for the first time.`);let{local:u,remote:p}=kft(l,o,s,n,c,r),h={local:u,remote:p,content:this.getPreviewContent(l,u.added,u.updated,u.removed),localChange:u.added.length>0||u.removed.length>0||u.updated.length>0?2:0,remoteChange:p!==null?2:0},g=this.stringify(l,!1);return[{skippedExtensions:n,builtinExtensions:r,baseResource:this.baseResource,baseContent:s?this.stringify(s,!1):g,localResource:this.localResource,localContent:g,localExtensions:l,remoteResource:this.remoteResource,remoteExtensions:o,remoteContent:o?this.stringify(o,!1):null,previewResource:this.previewResource,previewResult:h,localChange:h.localChange,remoteChange:h.remoteChange,acceptedResource:this.acceptedResource}]}async hasRemoteChanged(e){let t=e.syncData?await tti(e.syncData,this.extensionManagementService):null,{localExtensions:o,ignoredExtensions:n}=await this.localExtensionsProvider.getLocalExtensions(this.syncResource.profile),{remote:r}=kft(o,t,t,e.skippedExtensions||[],n,e.builtinExtensions||[]);return r!==null}getPreviewContent(e,t,o,n){let r=[...t,...o],s=new Set,l=c=>{s.add(c.id.toLowerCase()),c.uuid&&s.add(c.uuid)};r.forEach(({identifier:c})=>l(c)),n.forEach(l);for(let c of e)s.has(c.identifier.id.toLowerCase())||c.identifier.uuid&&s.has(c.identifier.uuid)||r.push(c);return this.stringify(r,!1)}async getMergeResult(e,t){return{...e.previewResult,hasConflicts:!1}}async getAcceptResult(e,t,o,n){if(this.extUri.isEqual(t,this.localResource))return this.acceptLocal(e);if(this.extUri.isEqual(t,this.remoteResource))return this.acceptRemote(e);if(this.extUri.isEqual(t,this.previewResource))return e.previewResult;throw new Error(`Invalid Resource: ${t.toString()}`)}async acceptLocal(e){let t=await this.extensionManagementService.getInstalled(void 0,this.syncResource.profile.extensionsResource),o=this.ignoredExtensionsManagementService.getIgnoredExtensions(t),n=e.remoteContent?JSON.parse(e.remoteContent):null,r=kft(e.localExtensions,n,n,e.skippedExtensions,o,e.builtinExtensions),{local:s,remote:l}=r;return{content:e.localContent,local:s,remote:l,localChange:s.added.length>0||s.removed.length>0||s.updated.length>0?2:0,remoteChange:l!==null?2:0}}async acceptRemote(e){let t=await this.extensionManagementService.getInstalled(void 0,this.syncResource.profile.extensionsResource),o=this.ignoredExtensionsManagementService.getIgnoredExtensions(t),n=e.remoteContent?JSON.parse(e.remoteContent):null;if(n!==null){let r=kft(e.localExtensions,n,e.localExtensions,[],o,e.builtinExtensions),{local:s,remote:l}=r;return{content:e.remoteContent,local:s,remote:l,localChange:s.added.length>0||s.removed.length>0||s.updated.length>0?2:0,remoteChange:l!==null?2:0}}else return{content:e.remoteContent,local:{added:[],removed:[],updated:[]},remote:null,localChange:0,remoteChange:0}}async applyResult(e,t,o,n){let{skippedExtensions:r,builtinExtensions:s,localExtensions:l}=o[0][0],{local:c,remote:u,localChange:p,remoteChange:h}=o[0][1];if(p===0&&h===0&&this.logService.info(`${this.syncResourceLogLabel}: No changes found during synchronizing extensions.`),p!==0&&(await this.backupLocal(JSON.stringify(l)),r=await this.localExtensionsProvider.updateLocalExtensions(c.added,c.removed,c.updated,r,this.syncResource.profile)),u){this.logService.trace(`${this.syncResourceLogLabel}: Updating remote extensions...`);let g=JSON.stringify(u.all);e=await this.updateRemoteUserData(g,n?null:e.ref),this.logService.info(`${this.syncResourceLogLabel}: Updated remote extensions.${u.added.length?` Added: ${JSON.stringify(u.added.map(f=>f.identifier.id))}.`:""}${u.updated.length?` Updated: ${JSON.stringify(u.updated.map(f=>f.identifier.id))}.`:""}${u.removed.length?` Removed: ${JSON.stringify(u.removed.map(f=>f.identifier.id))}.`:""}`)}t?.ref!==e.ref&&(this.logService.trace(`${this.syncResourceLogLabel}: Updating last synchronized extensions...`),s=this.computeBuiltinExtensions(l,s),await this.updateLastSyncUserData(e,{skippedExtensions:r,builtinExtensions:s}),this.logService.info(`${this.syncResourceLogLabel}: Updated last synchronized extensions.${r.length?` Skipped: ${JSON.stringify(r.map(g=>g.identifier.id))}.`:""}`))}computeBuiltinExtensions(e,t){let o=new Set,n=[];for(let r of e)o.add(r.identifier.id.toLowerCase()),r.installed||n.push(r.identifier);if(t)for(let r of t)o.has(r.id.toLowerCase())||n.push(r);return n}async resolveContent(e){if(this.extUri.isEqual(this.remoteResource,e)||this.extUri.isEqual(this.baseResource,e)||this.extUri.isEqual(this.localResource,e)||this.extUri.isEqual(this.acceptedResource,e)){let t=await this.resolvePreviewContent(e);return t&&this.stringify(JSON.parse(t),!0)}return null}stringify(e,t){return ZPn(e,t)}async hasLocalData(){try{let{localExtensions:e}=await this.localExtensionsProvider.getLocalExtensions(this.syncResource.profile);if(e.some(t=>t.installed||t.disabled))return!0}catch{}return!1}};eti=I([m(2,ko),m(3,ge),m(4,de),m(5,AW),m(6,tie),m(7,xs),m(8,uq),m(9,vw),m(10,B),m(11,Yl),m(12,_e),m(13,hG),m(14,gt),m(15,WW),m(16,F)],eti);var Eft=class{constructor(i,e,t,o,n,r,s){this.extensionManagementService=i;this.userDataProfileStorageService=e;this.extensionGalleryService=t;this.ignoredExtensionsManagementService=o;this.instantiationService=n;this.logService=r;this.productService=s}async getLocalExtensions(i){let e=await this.extensionManagementService.getInstalled(void 0,i.extensionsResource),t=this.ignoredExtensionsManagementService.getIgnoredExtensions(e);return{localExtensions:await this.withProfileScopedServices(i,async(n,r)=>{let s=n.getDisabledExtensions();return e.map(l=>{let{identifier:c,isBuiltin:u,manifest:p,preRelease:h,pinned:g,isApplicationScoped:f}=l,v={identifier:c,preRelease:h,version:p.version,pinned:!!g};f&&!O4(p)&&(v.isApplicationScoped=f),this.productService.builtInExtensionsEnabledWithAutoUpdates?.some(b=>b.toLowerCase()===c.id.toLowerCase())&&(v.isApplicationScoped=!0),s.some(b=>Ht(b,c))&&(v.disabled=!0),u||(v.installed=!0);try{let b=r.getKeysForSync({id:c.id,version:p.version});if(b){let S=r.getExtensionState(l,!0)||{};v.state=Object.keys(S).reduce((y,w)=>(b.includes(w)&&(y[w]=S[w]),y),{})}}catch(b){this.logService.info(`${_Ae("extensions",i)}: Error while parsing extension state`,Dn(b))}return v})}),ignoredExtensions:t}}async updateLocalExtensions(i,e,t,o,n){let r=_Ae("extensions",n),s=[],l=new Map,c=[],u=[],p=await this.extensionManagementService.getInstalled(void 0,n.extensionsResource);if((i.length||t.length)&&await this.withProfileScopedServices(n,async(f,v)=>{await vn.settled([...i,...t].map(async b=>{let S=p.find(x=>Ht(x.identifier,b.identifier));if(S&&S.isBuiltin){b.state&&S.manifest.version===b.version&&this.updateExtensionState(b.state,S,S.manifest.version,v),f.getDisabledExtensions().some(E=>Ht(E,b.identifier))!==!!b.disabled&&(b.disabled?(this.logService.trace(`${r}: Disabling extension...`,b.identifier.id),await f.disableExtension(b.identifier),this.logService.info(`${r}: Disabled extension`,b.identifier.id)):(this.logService.trace(`${r}: Enabling extension...`,b.identifier.id),await f.enableExtension(b.identifier),this.logService.info(`${r}: Enabled extension`,b.identifier.id))),c.push(b.identifier);return}let y=b.pinned?b.version:void 0,w=(await this.extensionGalleryService.getExtensions([{...b.identifier,version:y,preRelease:y?void 0:b.preRelease}],Ie.None))[0];if(b.state&&(S?S.manifest.version===b.version:w)&&this.updateExtensionState(b.state,S||w,S?.manifest.version,v),w)try{f.getDisabledExtensions().some(E=>Ht(E,b.identifier))!==!!b.disabled&&(b.disabled?(this.logService.trace(`${r}: Disabling extension...`,b.identifier.id,w.version),await f.disableExtension(w.identifier),this.logService.info(`${r}: Disabled extension`,b.identifier.id,w.version)):(this.logService.trace(`${r}: Enabling extension...`,b.identifier.id,w.version),await f.enableExtension(w.identifier),this.logService.info(`${r}: Enabled extension`,b.identifier.id,w.version))),(!S||S.preRelease!==b.preRelease||S.pinned!==b.pinned||y&&S.manifest.version!==y)&&(await this.extensionManagementService.canInstall(w)===!0?(s.push({extension:w,options:{isMachineScoped:!1,donotIncludePackAndDependencies:!0,installGivenVersion:b.pinned&&!!b.version,pinned:b.pinned,installPreReleaseVersion:b.preRelease,preRelease:b.preRelease,profileLocation:n.extensionsResource,isApplicationScoped:b.isApplicationScoped,context:{[vH]:!0,[bH]:"settingsSync",[CM]:!0}}}),l.set(w.identifier.id.toLowerCase(),b)):(this.logService.info(`${r}: Skipped synchronizing extension because it cannot be installed.`,w.displayName||w.identifier.id),u.push(b)))}catch(x){u.push(b),this.logService.error(x),this.logService.info(`${r}: Skipped synchronizing extension`,w.displayName||w.identifier.id)}else u.push(b),this.logService.info(`${r}: Skipped synchronizing extension because the extension is not found.`,b.identifier.id)}))}),e.length){let f=p.filter(({identifier:v,isBuiltin:b})=>!b&&e.some(S=>Ht(v,S)));await vn.settled(f.map(async v=>{this.logService.trace(`${r}: Uninstalling local extension...`,v.identifier.id),await this.extensionManagementService.uninstall(v,{donotIncludePack:!0,donotCheckDependents:!0,profileLocation:n.extensionsResource}),this.logService.info(`${r}: Uninstalled local extension.`,v.identifier.id),c.push(v.identifier)}))}let h=await this.extensionManagementService.installGalleryExtensions(s);for(let{identifier:f,local:v,error:b,source:S}of h){let y=S;if(v)this.logService.info(`${r}: Installed extension.`,f.id,y.version),c.push(f);else{let w=l.get(f.id.toLowerCase());w&&(u.push(w),this.logService.info(`${r}: Skipped synchronizing extension`,y.displayName||y.identifier.id)),b instanceof qh&&["Incompatible","IncompatibleApi","IncompatibleTargetPlatform"].includes(b.code)?this.logService.info(`${r}: Skipped synchronizing extension because the compatible extension is not found.`,y.displayName||y.identifier.id):b&&this.logService.error(b)}}let g=[];for(let f of o)c.some(v=>Ht(v,f.identifier))||g.push(f);for(let f of u)g.some(v=>Ht(v.identifier,f.identifier))||g.push(f);return g}updateExtensionState(i,e,t,o){let n=o.getExtensionState(e,!0)||{},r=t?o.getKeysForSync({id:e.identifier.id,version:t}):void 0;r?r.forEach(s=>{n[s]=i[s]}):Object.keys(i).forEach(s=>n[s]=i[s]),o.setExtensionState(e,n,!0)}async withProfileScopedServices(i,e){return this.userDataProfileStorageService.withProfileScopedStorageService(i,async t=>{let o=new O,n=o.add(this.instantiationService.createChild(new Po([de,t]))),r=o.add(n.createInstance(iq)),s=o.add(n.createInstance(DC));try{return await e(r,s)}finally{o.dispose()}})}};Eft=I([m(0,xs),m(1,WW),m(2,ga),m(3,uq),m(4,F),m(5,vw),m(6,Ze)],Eft);var Wje=class extends pie{constructor(e,t,o,n,r,s,l,c){super("extensions",n,r,s,o,l,c);this.extensionManagementService=e;this.ignoredExtensionsManagementService=t}async parseExtensions(e){return e.syncData?await tti(e.syncData,this.extensionManagementService):null}generatePreview(e,t){let o=[],n=[],r=[];for(let s of e){if(this.ignoredExtensionsManagementService.hasToNeverSyncExtension(s.identifier.id))continue;let l=t.find(c=>Ht(c.identifier,s.identifier));l?(o.push(l),s.disabled&&r.push(s.identifier)):s.installed&&(n.push({...s.identifier,preRelease:!!s.preRelease}),s.disabled&&r.push(s.identifier))}return{installedExtensions:o,newExtensions:n,disabledExtensions:r,remoteExtensions:e}}};Wje=I([m(0,xs),m(1,uq),m(2,ge),m(3,hn),m(4,ko),m(5,re),m(6,de),m(7,gt)],Wje);var Vje=class{constructor(i,e,t,o,n,r,s){this.remoteAgentService=i;this.remoteExtensionsScannerService=e;this.extensionGalleryService=t;this.extensionManagementServerService=o;this.extensionsWorkbenchService=n;this.logService=r;this.configurationService=s;this.installExtensionsIfInstalledLocallyInRemote(),this.installFailedRemoteExtensions()}async installExtensionsIfInstalledLocallyInRemote(){if(!this.remoteAgentService.getConnection())return;if(!this.extensionManagementServerService.remoteExtensionManagementServer){this.logService.error("No remote extension management server available");return}if(!this.extensionManagementServerService.localExtensionManagementServer){this.logService.error("No local extension management server available");return}let i=this.configurationService.getValue(EYt);if(!i?.length)return;let e=await this.extensionsWorkbenchService.queryLocal(this.extensionManagementServerService.localExtensionManagementServer),t=await this.extensionsWorkbenchService.queryLocal(this.extensionManagementServerService.remoteExtensionManagementServer),o=e.filter(n=>i.some(r=>Ht(n.identifier,{id:r}))).filter(n=>!t.some(r=>Ht(r.identifier,n.identifier)));o.length&&await Promise.allSettled(o.map(n=>{this.extensionsWorkbenchService.installInServer(n,this.extensionManagementServerService.remoteExtensionManagementServer,{donotIncludePackAndDependencies:!0})}))}async installFailedRemoteExtensions(){if(!this.remoteAgentService.getConnection())return;let{failed:i}=await this.remoteExtensionsScannerService.whenExtensionsReady();if(i.length===0){this.logService.trace("No extensions relayed from server");return}if(!this.extensionManagementServerService.remoteExtensionManagementServer){this.logService.error("No remote extension management server available");return}this.logService.info(`Installing '${i.length}' extensions relayed from server`);let e=await this.extensionGalleryService.getExtensions(i.map(({id:o})=>({id:o})),Ie.None),t=[];for(let{id:o,installOptions:n}of i){let r=e.find(s=>Ht(s.identifier,{id:o}));r?t.push({extension:r,options:{...n,downloadExtensionsLocally:!0}}):this.logService.warn(`Relayed failed extension '${o}' from server is not found in the gallery`)}t.length&&await Promise.allSettled(t.map(o=>this.extensionManagementServerService.remoteExtensionManagementServer.extensionManagementService.installFromGallery(o.extension,o.options)))}};Vje=I([m(0,bo),m(1,aq),m(2,ga),m(3,$c),m(4,Ui),m(5,re),m(6,B)],Vje);var Bje=class{constructor(i,e,t,o,n,r,s,l,c){this.extensionManagementServerService=i;this.storageService=e;this.remoteAgentService=t;this.userDataSyncStoreManagementService=o;this.instantiationService=n;this.logService=r;this.authenticationService=s;this.remoteAuthorityResolverService=l;this.userDataSyncEnablementService=c;this.initializeRemoteExtensions()}async initializeRemoteExtensions(){let i=this.remoteAgentService.getConnection(),e=this.extensionManagementServerService.localExtensionManagementServer,t=this.extensionManagementServerService.remoteExtensionManagementServer;if(!i||!t||!e||!this.userDataSyncStoreManagementService.userDataSyncStore)return;let o=`${Rdi}.${i.remoteAuthority}`;if(!this.storageService.getBoolean(o,-1,!0)){this.logService.trace("Skipping initializing remote extensions because the window with this remote authority was opened before.");return}if(this.storageService.store(o,!1,-1,1),!this.storageService.isNew(1)){this.logService.trace("Skipping initializing remote extensions because this workspace was opened before.");return}if(!this.userDataSyncEnablementService.isEnabled())return;let n=await this.remoteAuthorityResolverService.resolveAuthority(i.remoteAuthority);if(!n.options?.authenticationSession)return;let s=(await this.authenticationService.getSessions(n.options?.authenticationSession.providerId)).find(g=>g.id===n.options?.authenticationSession?.id);if(!s){this.logService.info("Skipping initializing remote extensions because the account with given session id is not found",n.options.authenticationSession.id);return}let l=this.instantiationService.createInstance(FU,this.userDataSyncStoreManagementService.userDataSyncStore.url);l.setAuthToken(s.accessToken,n.options.authenticationSession.providerId);let c=await l.readResource("extensions",null),u=new Po;u.set(xs,t.extensionManagementService),await this.instantiationService.createChild(u).createInstance(Tft).initialize(c)}};Bje=I([m(0,$c),m(1,de),m(2,bo),m(3,uP),m(4,F),m(5,re),m(6,ks),m(7,dd),m(8,Yl)],Bje);var Tft=class extends Wje{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,o,n,r,s,u,l);this.extensionGalleryService=c;this.extensionManifestPropertiesService=p}async doInitialize(e){let t=await this.parseExtensions(e);if(!t){this.logService.info("No synced extensions exist while initializing remote extensions.");return}let o=await this.extensionManagementService.getInstalled(),{newExtensions:n}=this.generatePreview(t,o);if(!n.length){this.logService.trace("No new remote extensions to install.");return}let r=await this.extensionManagementService.getTargetPlatform(),s=await this.extensionGalleryService.getExtensions(n,{targetPlatform:r,compatible:!0},Ie.None);s.length&&await Promise.allSettled(s.map(async l=>{let c=await this.extensionGalleryService.getManifest(l,Ie.None);if(c&&this.extensionManifestPropertiesService.canExecuteOnWorkspace(c)){let u=t.find(p=>Ht(p.identifier,p.identifier));await this.extensionManagementService.installFromGallery(l,{installPreReleaseVersion:u?.preRelease,donotIncludePackAndDependencies:!0,context:{[CM]:!0}})}}))}};Tft=I([m(0,xs),m(1,uq),m(2,ge),m(3,hn),m(4,ko),m(5,re),m(6,gt),m(7,ga),m(8,de),m(9,hm)],Tft);Ce(U7,Oje,1);oe.as(en.EditorPane).registerEditorPane(os.create(jO,jO.ID,d(11926,null)),[new Vt(sB)]);var r5i=class{canSerialize(i){return!0}serialize(i){return""}deserialize(i){return sB.instance}};oe.as(en.EditorFactory).registerEditorSerializer(sB.ID,r5i);var _ft=class extends k{constructor(i,e){super(),e.registerChannel("extensionRecommendationNotification",new Bei(i)),this._register(W(Xei)),this._register(W(Jei))}};_ft=I([m(0,Pre),m(1,kS)],_ft);var Dft=oe.as(Zi.Workbench);Dft.registerWorkbenchContribution(_ft,3);Dft.registerWorkbenchContribution(Fje,4);Dft.registerWorkbenchContribution(Bje,3);Dft.registerWorkbenchContribution(Vje,3);Dft.registerWorkbenchContribution(Nje,3);W(jei);W(Qei);W(Yei);W(Kei);W(Gei);W(yft);W(qei);W(Uei);W($ei);var z7=class extends cg{constructor(e,t,o,n,r){super(z7.PREFIX,{canAcceptInBackground:!0});this.menuService=e;this.contextKeyService=t;this.commandService=o;this.extensionService=n;this.productService=r}static{this.PREFIX="issue "}_getPicks(e){let t=new Array,o=new Array,n=new Set,r=this.productService.nameLong,s=d(12544,null),l=xh(e,r,!0),c=xh(e,s,!0);return l&&t.push({label:r,ariaLabel:r,highlights:{label:l},accept:()=>this.commandService.executeCommand("workbench.action.openIssueReporter",{issueSource:"vscode"})}),c&&t.push({label:s,ariaLabel:s,highlights:{label:c},accept:()=>this.commandService.executeCommand("workbench.action.openIssueReporter",{issueSource:"marketplace"})}),t.push({type:"separator",label:d(12543,null)}),this.menuService.getMenuActions(R.IssueReporter,this.contextKeyService,{renderShortTitle:!0}).flatMap(p=>p[1]).forEach(p=>{"source"in p.item&&p.item.source&&n.add(p.item.source.id);let h=this._createPick(e,p);h&&o.push(h)}),this.extensionService.extensions.forEach(p=>{if(!p.isBuiltin){let h=this._createPick(e,void 0,p),g=p.identifier.value;h&&!n.has(g)&&o.push(h),n.add(g)}}),o.sort((p,h)=>{let g=p.label??"",f=h.label??"";return g.localeCompare(f)}),[...t,...o]}_createPick(e,t,o){let n=[{iconClass:q.asClassName(L.info),tooltip:d(12542,null)}],r,s,l;if(t&&"source"in t.item&&t.item.source)r=t.item.source?.title,s=()=>("source"in t.item&&t.item.source&&this.commandService.executeCommand("extension.open",t.item.source.id),1),l=()=>{t.run()};else if(o)r=o.displayName??o.name,s=()=>(this.commandService.executeCommand("extension.open",o.identifier.value),1),l=()=>{this.commandService.executeCommand("workbench.action.openIssueReporter",o.identifier.value)};else return;let c=xh(e,r,!0);if(c)return{label:r,highlights:{label:c},buttons:n,trigger:s,accept:l}}};z7=I([m(0,Yt),m(1,X),m(2,fe),m(3,lt),m(4,Ze)],z7);var iti=le("ITroubleshootIssueService");var Hje=class a{constructor(i,e){this.stage=i;this.profile=e}static fromJSON(i){if(i)try{let e=JSON.parse(i);if((e.stage===1||e.stage===2)&&typeof e.profile=="string")return new a(e.stage,e.profile)}catch{}}},xj=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.userDataProfileService=e;this.userDataProfilesService=t;this.userDataProfileManagementService=o;this.userDataProfileImportExportService=n;this.dialogService=r;this.extensionBisectService=s;this.notificationService=l;this.extensionManagementService=c;this.extensionEnablementService=u;this.issueService=p;this.productService=h;this.hostService=g;this.storageService=f;this.openerService=v}static{this.storageKey="issueTroubleshootState"}isActive(){return this.state!==void 0}async start(){if(this.isActive())throw new Error("invalid state");if(!(await this.dialogService.confirm({message:d(12590,null),detail:d(12576,null,this.productService.nameLong),primaryButton:d(12583,null),custom:!0})).confirmed)return;let t=this.userDataProfileService.currentProfile;await this.userDataProfileImportExportService.createTroubleshootProfile(),this.state=new Hje(1,t.id),await this.resume()}async resume(){this.isActive()&&(this.state?.stage===1&&!this.extensionBisectService.isActive&&await this.reproduceIssueWithExtensionsDisabled(),this.state?.stage===2&&await this.reproduceIssueWithEmptyProfile(),await this.stop())}async stop(){if(!this.isActive())return;this.notificationHandle&&(this.notificationHandle.close(),this.notificationHandle=void 0),this.extensionBisectService.isActive&&await this.extensionBisectService.reset();let e=this.userDataProfilesService.profiles.find(t=>t.id===this.state?.profile)??this.userDataProfilesService.defaultProfile;this.state=void 0,await this.userDataProfileManagementService.switchProfile(e)}async reproduceIssueWithExtensionsDisabled(){if(!(await this.extensionManagementService.getInstalled(1)).length){this.state=new Hje(2,this.state.profile);return}let e=await this.askToReproduceIssue(d(12584,null));if(e==="good"){let t=this.userDataProfilesService.profiles.find(o=>o.id===this.state.profile)??this.userDataProfilesService.defaultProfile;await this.reproduceIssueWithExtensionsBisect(t)}e==="bad"&&(this.state=new Hje(2,this.state.profile)),e==="stop"&&await this.stop()}async reproduceIssueWithEmptyProfile(){await this.userDataProfileManagementService.createAndEnterTransientProfile(),this.updateState(this.state);let e=await this.askToReproduceIssue(d(12578,null));e==="stop"&&await this.stop(),e==="good"&&await this.askToReportIssue(d(12582,null)),e==="bad"&&await this.askToReportIssue(d(12581,null,this.productService.nameLong))}async reproduceIssueWithExtensionsBisect(e){await this.userDataProfileManagementService.switchProfile(e);let t=(await this.extensionManagementService.getInstalled(1)).filter(o=>this.extensionEnablementService.isEnabled(o));await this.extensionBisectService.start(t),await this.hostService.reload()}askToReproduceIssue(e){return new Promise((t,o)=>{let n={label:d(12580,null),run:()=>t("good")},r={label:d(12588,null),run:()=>t("bad")},s={label:d(12587,null),run:()=>t("stop")};this.notificationHandle=this.notificationService.prompt(ft.Info,e,[n,r,s],{sticky:!0,priority:3})})}async askToReportIssue(e){let t=!1;if(this.productService.quality==="stable"){let o=await this.askToReproduceIssueWithInsiders();if(o==="good"){await this.dialogService.prompt({type:ft.Info,message:d(12590,null),detail:d(12592,null,this.productService.nameLong),custom:!0});return}if(o==="stop"){await this.stop();return}o==="bad"&&(t=!0)}await this.issueService.openReporter({issueBody:`> ${e} ${t?`It is confirmed that the issue exists in ${this.productService.nameLong} Insiders`:""}`})}async askToReproduceIssueWithInsiders(){return!(await this.dialogService.confirm({type:"info",message:d(12590,null),primaryButton:d(12577,null,this.productService.nameLong),cancelButton:d(12585,null),detail:d(12573,null,this.productService.nameLong),custom:{disableCloseAction:!0}})).confirmed||!await this.openerService.open(A.parse("https://aka.ms/vscode-insiders"))?void 0:(await this.dialogService.prompt({type:"info",message:d(12590,null),buttons:[{label:d(12579,null),run:()=>"good"},{label:d(12575,null),run:()=>"bad"}],cancelButton:{label:d(12586,null),run:()=>"stop"},detail:d(12574,null,this.productService.nameLong),custom:{disableCloseAction:!0}})).result}get state(){if(this._state===void 0){let e=this.storageService.get(xj.storageKey,0);this._state=Hje.fromJSON(e)}return this._state||void 0}set state(e){this._state=e??null,this.updateState(e)}updateState(e){e?this.storageService.store(xj.storageKey,JSON.stringify(e),0,1):this.storageService.remove(xj.storageKey,0)}};xj=I([m(0,gn),m(1,hn),m(2,s_),m(3,MH),m(4,ct),m(5,oQ),m(6,Ne),m(7,xs),m(8,As),m(9,R_),m(10,Ze),m(11,ti),m(12,de),m(13,Je)],xj);var K7=class extends k{constructor(e,t,o){super();this.contextKeyService=e;this.troubleshootIssueService=t;this.updateContext(),t.isActive()&&t.resume(),this._register(o.onDidChangeValue(0,xj.storageKey,this._store)(()=>{this.updateContext()}))}static{this.ctxIsTroubleshootActive=new Y("isIssueTroubleshootActive",!1)}updateContext(){K7.ctxIsTroubleshootActive.bindTo(this.contextKeyService).set(this.troubleshootIssueService.isActive())}};K7=I([m(0,X),m(1,iti),m(2,de)],K7);oe.as(Zi.Workbench).registerWorkbenchContribution(K7,3);W(class extends z{constructor(){super({id:"workbench.action.troubleshootIssue.start",title:P(12591,"Troubleshoot Issue..."),category:Fe.Help,f1:!0,precondition:C.and(K7.ctxIsTroubleshootActive.negate(),Qb.isEqualTo(""),Mu.negate())})}run(i){return i.get(iti).start()}});W(class extends z{constructor(){super({id:"workbench.action.troubleshootIssue.stop",title:P(12589,"Stop Troubleshoot Issue"),category:Fe.Help,f1:!0,precondition:K7.ctxIsTroubleshootActive})}async run(a){return a.get(iti).stop()}});Ce(iti,xj,1);var s5i="workbench.action.openIssueReporter",eAn="vscode.openIssueReporter",JHo={description:"Open the issue reporter and optionally prefill part of the form.",args:[{name:"options",description:"Data to use to prefill the issue reporter with.",isOptional:!0,schema:{oneOf:[{type:"string",description:"The extension id to preselect."},{type:"object",properties:{extensionId:{type:"string"},issueTitle:{type:"string"},issueBody:{type:"string"}}}]}}]},Uje=class extends k{constructor(i,e){if(super(),!e.getValue("telemetry.feedback.enabled")){this._register(Ge.registerCommand({id:"workbench.action.openIssueReporter",handler:function(o){o.get(Ne).info("Feedback is disabled.")}}));return}if(!i.reportIssueUrl)return;this._register(Ge.registerCommand({id:s5i,handler:function(o,n){let r=typeof n=="string"?{extensionId:n}:Array.isArray(n)?{extensionId:n[0]}:n??{};return o.get(R_).openReporter(r)},metadata:JHo})),this._register(Ge.registerCommand({id:eAn,handler:function(o,n){let r=typeof n=="string"?{extensionId:n}:Array.isArray(n)?{extensionId:n[0]}:n??{};return o.get(R_).openReporter(r)},metadata:JHo}));let t={id:s5i,title:P(12594,"Report Issue..."),category:Fe.Help};this._register(be.appendMenuItem(R.CommandPalette,{command:t})),this._register(be.appendMenuItem(R.MenubarHelpMenu,{group:"3_feedback",command:{id:s5i,title:d(12593,null)},order:3}))}};Uje=I([m(0,Ze),m(1,B)],Uje);var bye=class{constructor(i,e,t,o,n,r,s,l,c){this.issueFormService=i;this.themeService=e;this.extensionManagementService=t;this.extensionEnablementService=o;this.workspaceTrustManagementService=n;this.experimentService=r;this.authenticationService=s;this.integrityService=l;this.environmentService=c}async openReporter(i={}){let e=[];try{let c=(await this.extensionManagementService.getInstalled()).filter(u=>this.extensionEnablementService.isEnabled(u)||i.extensionId&&u.identifier.id===i.extensionId);e.push(...c.map(u=>{let{manifest:p}=u,h=p.contributes?Object.keys(p.contributes):[],g=!p.main&&!p.browser&&h.length===1&&h[0]==="themes",f=u.type===0;return{name:p.name,publisher:p.publisher,version:p.version,repositoryUrl:p.repository&&p.repository.url,bugsUrl:p.bugs&&p.bugs.url,displayName:p.displayName,id:u.identifier.id,data:i.data,uri:i.uri,isTheme:g,isBuiltin:f,extensionData:"Extensions data loading"}}))}catch(l){e.push({name:"Workbench Issue Service",publisher:"Unknown",version:"0.0.0",repositoryUrl:void 0,bugsUrl:void 0,extensionData:"Extensions data loading",displayName:`Extensions not loaded: ${l}`,id:"workbench.issue",isTheme:!1,isBuiltin:!0})}let t=await this.experimentService.getCurrentExperiments(),o="";try{o=(await this.authenticationService.getSessions("github")).filter(u=>u.scopes.includes("repo"))[0]?.accessToken}catch{}let n=!1;try{n=!(await this.integrityService.isPure()).isPure}catch{}let r=this.themeService.getColorTheme(),s=Object.assign({styles:tAn(r),zoomLevel:nx(ut),enabledExtensions:e,experiments:t?.join(`
`),restrictedMode:!this.workspaceTrustManagementService.isWorkspaceTrusted(),isUnsupported:n,isSessionsWindow:this.environmentService.isSessionsWindow,githubAccessToken:o},i);return this.issueFormService.openReporter(s)}};bye=I([m(0,yq),m(1,Pe),m(2,xs),m(3,As),m(4,Or),m(5,wN),m(6,ks),m(7,p$e),m(8,Mt)],bye);function tAn(a){return{backgroundColor:ZE(a,ch),color:ZE(a,xo),textLinkColor:ZE(a,AS),textLinkActiveForeground:ZE(a,GIt),inputBackground:ZE(a,Hf),inputForeground:ZE(a,IT),inputBorder:ZE(a,LI),inputActiveBorder:ZE(a,PB),inputErrorBorder:ZE(a,ayt),inputErrorBackground:ZE(a,ryt),inputErrorForeground:ZE(a,syt),buttonBackground:ZE(a,th),buttonForeground:ZE(a,Fk),buttonHoverBackground:ZE(a,T5),sliderActiveColor:ZE(a,Zz),sliderBackgroundColor:ZE(a,ch),sliderHoverColor:ZE(a,Jz)}}function ZE(a,i){let e=a.getColor(i);return e?e.toString():void 0}Ce(R_,bye,1);var ZHo=Cr(d(12567,null)),eUo=Cr(d(12566,null)),tUo=Cr(d(12568,null)),iUo=Cr(d(12565,null)),oUo=Cr(d(12563,null)),nUo=Cr(d(12564,null)),rUo=Cr(d(12545,null)),iAn=d(12562,null),sUo=()=>`
<div id="update-banner" class="issue-reporter-update-banner hidden">
	<span class="update-banner-text" id="update-banner-text">
		<!-- To be dynamically filled -->
	</span>
</div>
<div class="issue-reporter" id="issue-reporter">
	<div id="english" class="input-group hidden">${Cr(d(12547,null))}</div>

	<div id="review-guidance-help-text" class="input-group">${iAn}</div>

	<div class="section">
		<div class="input-group">
			<label class="inline-label" for="issue-type">${Cr(d(12561,null))}</label>
			<select id="issue-type" class="inline-form-control">
				<!-- To be dynamically filled -->
			</select>
		</div>

		<div class="input-group" id="problem-source">
			<label class="inline-label" for="issue-source">${Cr(d(12558,null))} <span class="required-input">*</span></label>
			<select id="issue-source" class="inline-form-control" required>
				<!-- To be dynamically filled -->
			</select>
			<div id="issue-source-empty-error" class="validation-error hidden" role="alert">${Cr(d(12557,null))}</div>
			<div id="problem-source-help-text" class="instructions hidden">${Cr(d(12552,null)).replace("{0}",()=>`<span tabIndex=0 role="button" id="disableExtensions" class="workbenchCommand">${Cr(d(12551,null))}</span>`)}
			</div>

			<div id="extension-selection">
				<label class="inline-label" for="extension-selector">${Cr(d(12546,null))} <span class="required-input">*</span></label>
				<select id="extension-selector" class="inline-form-control">
					<!-- To be dynamically filled -->
				</select>
				<div id="extension-selection-validation-error" class="validation-error hidden" role="alert">${Cr(d(12556,null)).replace("{0}",()=>'<span tabIndex=0 role="button" id="extensionBugsLink" class="workbenchCommand"><!-- To be dynamically filled --></span>')}</div>
				<div id="extension-selection-validation-error-no-url" class="validation-error hidden" role="alert">
					${Cr(d(12555,null))}
				</div>
			</div>
		</div>

		<div id="issue-title-container" class="input-group">
			<label class="inline-label" for="issue-title">${Cr(d(12559,null))} <span class="required-input">*</span></label>
			<input id="issue-title" type="text" class="inline-form-control" placeholder="${Cr(d(12560,null))}" required>
			<div id="issue-title-empty-error" class="validation-error hidden" role="alert">${Cr(d(12570,null))}</div>
			<div id="issue-title-length-validation-error" class="validation-error hidden" role="alert">${Cr(d(12571,null))}</div>
			<small id="similar-issues">
				<!-- To be dynamically filled -->
			</small>
		</div>

	</div>

	<div class="input-group description-section">
		<label for="description" id="issue-description-label">
			<!-- To be dynamically filled -->
		</label>
		<div class="instructions" id="issue-description-subtitle">
			<!-- To be dynamically filled -->
		</div>
		<div class="block-info-text">
			<textarea name="description" id="description" placeholder="${Cr(d(12550,null))}" required></textarea>
		</div>
		<div id="description-empty-error" class="validation-error hidden" role="alert">${Cr(d(12548,null))}</div>
		<div id="description-short-error" class="validation-error hidden" role="alert">${Cr(d(12549,null))}</div>
	</div>

	<div class="system-info" id="block-container">
		<div class="block block-extension-data">
			<input class="send-extension-data" aria-label="${nUo}" type="checkbox" id="includeExtensionData" checked/>
			<label class="extension-caption" id="extension-caption" for="includeExtensionData">
				${nUo}
				<span id="ext-loading" hidden></span>
				<span class="ext-parens" hidden>(</span><a href="#" class="showInfo" id="extension-id">${Cr(d(12569,null))}</a><span class="ext-parens" hidden>)</span>
				<a id="extension-data-download">${Cr(d(12553,null))}</a>
			</label>
			<pre class="block-info" id="extension-data" placeholder="${Cr(d(12554,null))}" style="white-space: pre-wrap; user-select: text;">
				<!-- To be dynamically filled -->
			</pre>
		</div>

		<div class="block block-system">
			<input class="sendData" aria-label="${ZHo}" type="checkbox" id="includeSystemInfo" checked/>
			<label class="caption" for="includeSystemInfo">
				${ZHo}
				(<a href="#" class="showInfo">${Cr(d(12569,null))}</a>)
			</label>
			<div class="block-info hidden" style="user-select: text;">
				<!-- To be dynamically filled -->
		</div>
		</div>
		<div class="block block-process">
			<input class="sendData" aria-label="${eUo}" type="checkbox" id="includeProcessInfo" checked/>
			<label class="caption" for="includeProcessInfo">
				${eUo}
				(<a href="#" class="showInfo">${Cr(d(12569,null))}</a>)
			</label>
			<pre class="block-info hidden" style="user-select: text;">
				<code>
				<!-- To be dynamically filled -->
				</code>
			</pre>
		</div>
		<div class="block block-workspace">
			<input class="sendData" aria-label="${tUo}" type="checkbox" id="includeWorkspaceInfo" checked/>
			<label class="caption" for="includeWorkspaceInfo">
				${tUo}
				(<a href="#" class="showInfo">${Cr(d(12569,null))}</a>)
			</label>
			<pre id="systemInfo" class="block-info hidden" style="user-select: text;">
				<code>
				<!-- To be dynamically filled -->
				</code>
			</pre>
		</div>
		<div class="block block-extensions">
			<input class="sendData" aria-label="${iUo}" type="checkbox" id="includeExtensions" checked/>
			<label class="caption" for="includeExtensions">
				${iUo}
				(<a href="#" class="showInfo">${Cr(d(12569,null))}</a>)
			</label>
			<div id="systemInfo" class="block-info hidden" style="user-select: text;">
				<!-- To be dynamically filled -->
			</div>
		</div>
		<div class="block block-experiments">
			<input class="sendData" aria-label="${oUo}" type="checkbox" id="includeExperiments" checked/>
			<label class="caption" for="includeExperiments">
				${oUo}
				(<a href="#" class="showInfo">${Cr(d(12569,null))}</a>)
			</label>
			<pre class="block-info hidden" style="user-select: text;">
				<!-- To be dynamically filled -->
			</pre>
		</div>
		<div class="block block-acknowledgements hidden" id="version-acknowledgements">
			<input class="sendData" aria-label="${rUo}" type="checkbox" id="includeAcknowledgement"/>
			<label class="caption" for="includeAcknowledgement">
				${rUo}
			</label>
		</div>
	</div>

</div>`;function a5i(a){return a.endsWith(".git")&&(a=a.substr(0,a.length-4)),a=Bh(a,"/"),a.endsWith("/new")&&(a=Bh(a,"/new")),a.endsWith("/issues")&&(a=Bh(a,"/issues")),a}var oti=class{constructor(i){let e={issueType:0,includeSystemInfo:!0,includeWorkspaceInfo:!0,includeProcessInfo:!0,includeExtensions:!0,includeExperiments:!0,includeExtensionData:!0,allExtensions:[]};this._data=i?Object.assign(e,i):e,ut.addEventListener("message",async t=>{t.data&&t.data.sendChannel==="vscode:triggerIssueData"&&ut.postMessage({data:{issueBody:this._data.issueDescription,issueTitle:this._data.issueTitle},replyChannel:"vscode:triggerIssueDataResponse"},"*")})}getData(){return this._data}update(i){Object.assign(this._data,i)}serialize(){let i=[];return this._data.restrictedMode&&i.push("Restricted"),this._data.isUnsupported&&i.push("Unsupported"),`
Type: <b>${this.getIssueTypeTitle()}</b>
${this._data.isSessionsWindow?`
Window: Agents
`:""}
${this._data.issueDescription}
${this.getExtensionVersion()}
VS Code version: ${this._data.versionInfo&&this._data.versionInfo.vscodeVersion}
OS version: ${this._data.versionInfo&&this._data.versionInfo.os}
Modes:${i.length?" "+i.join(", "):""}
${this.getRemoteOSes()}
${this.getInfos()}
<!-- generated by issue reporter -->`}getRemoteOSes(){return this._data.systemInfo&&this._data.systemInfo.remoteData.length?this._data.systemInfo.remoteData.map(i=>UW(i)?i.errorMessage:`Remote OS version: ${i.machineInfo.os}`).join(`
`)+`
`:""}fileOnExtension(){return(this._data.issueType===0||this._data.issueType===1||this._data.issueType===2)&&this._data.fileOnExtension}getExtensionVersion(){return this.fileOnExtension()&&this._data.selectedExtension?`
Extension version: ${this._data.selectedExtension.version}`:""}getIssueTypeTitle(){return this._data.issueType===0?"Bug":this._data.issueType===1?"Performance Issue":"Feature Request"}getInfos(){let i="";if(this._data.fileOnMarketplace)return i;let e=this._data.issueType===0||this._data.issueType===1;return e&&(this._data.includeExtensionData&&this._data.extensionData&&(i+=this.getExtensionData()),this._data.includeSystemInfo&&this._data.systemInfo&&(i+=this.generateSystemInfoMd()),this._data.includeSystemInfo&&this._data.systemInfoWeb&&(i+="System Info: "+this._data.systemInfoWeb)),this._data.issueType===1&&(this._data.includeProcessInfo&&(i+=this.generateProcessInfoMd()),this._data.includeWorkspaceInfo&&(i+=this.generateWorkspaceInfoMd())),e&&(!this._data.fileOnExtension&&this._data.includeExtensions&&(i+=this.generateExtensionsMd()),this._data.includeExperiments&&this._data.experimentInfo&&(i+=this.generateExperimentsInfoMd())),i}getExtensionData(){return this._data.extensionData??""}generateSystemInfoMd(){let i=`<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
`;return this._data.systemInfo&&(i+=`|CPUs|${this._data.systemInfo.cpus}|
|GPU Status|${Object.keys(this._data.systemInfo.gpuStatus).map(e=>`${e}: ${this._data.systemInfo.gpuStatus[e]}`).join("<br>")}|
|Load (avg)|${this._data.systemInfo.load}|
|Memory (System)|${this._data.systemInfo.memory}|
|Process Argv|${this._data.systemInfo.processArgs.replace(/\\/g,"\\\\")}|
|Screen Reader|${this._data.systemInfo.screenReader}|
|VM|${this._data.systemInfo.vmHint}|`,this._data.systemInfo.linuxEnv&&(i+=`
|DESKTOP_SESSION|${this._data.systemInfo.linuxEnv.desktopSession}|
|XDG_CURRENT_DESKTOP|${this._data.systemInfo.linuxEnv.xdgCurrentDesktop}|
|XDG_SESSION_DESKTOP|${this._data.systemInfo.linuxEnv.xdgSessionDesktop}|
|XDG_SESSION_TYPE|${this._data.systemInfo.linuxEnv.xdgSessionType}|`),this._data.systemInfo.remoteData.forEach(e=>{UW(e)?i+=`

${e.errorMessage}`:i+=`

|Item|Value|
|---|---|
|Remote|${e.latency?`${e.hostName} (latency: ${e.latency.current.toFixed(2)}ms last, ${e.latency.average.toFixed(2)}ms average)`:e.hostName}|
|OS|${e.machineInfo.os}|
|CPUs|${e.machineInfo.cpus}|
|Memory (System)|${e.machineInfo.memory}|
|VM|${e.machineInfo.vmHint}|`})),i+=`
</details>`,i}generateProcessInfoMd(){return`<details>
<summary>Process Info</summary>

\`\`\`
${this._data.processInfo}
\`\`\`

</details>
`}generateWorkspaceInfoMd(){return`<details>
<summary>Workspace Info</summary>

\`\`\`
${this._data.workspaceInfo};
\`\`\`

</details>
`}generateExperimentsInfoMd(){return`<details>
<summary>A/B Experiments</summary>

\`\`\`
${this._data.experimentInfo}
\`\`\`

</details>
`}generateExtensionsMd(){if(this._data.extensionsDisabled)return"Extensions disabled";let i=this._data.numberOfThemeExtesions?`
(${this._data.numberOfThemeExtesions} theme extensions excluded)`:"";if(!this._data.enabledNonThemeExtesions)return"Extensions: none"+i;let e=`Extension|Author (truncated)|Version
---|---|---`,t=this._data.enabledNonThemeExtesions.map(o=>`${o.name}|${o.publisher?.substr(0,3)??"N/A"}|${o.version}`).join(`
`);return`<details><summary>Extensions (${this._data.enabledNonThemeExtesions.length})</summary>

${e}
${t}
${i}

</details>`}};var aUo=7500,oAn=6e4;var kj=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super();this.disableExtensions=e;this.data=t;this.os=o;this.product=n;this.window=r;this.isWeb=s;this.issueFormService=l;this.themeService=c;this.fileService=u;this.fileDialogService=p;this.contextMenuService=h;this.authenticationService=g;this.openerService=f;this.receivedSystemInfo=!1;this.numberOfSearchResultsDisplayed=0;this.receivedPerformanceInfo=!1;this.shouldQueueSearch=!1;this.hasBeenSubmitted=!1;this.openReporter=!1;this.loadingExtensionData=!1;this.selectedExtension="";this.delayedSubmit=new rn(300);this.nonGitHubIssueUrl=!1;this.needsUpdate=!1;this.acknowledged=!1;let v=t.extensionId?t.enabledExtensions.find(H=>H.id.toLocaleLowerCase()===t.extensionId?.toLocaleLowerCase()):void 0;this.issueReporterModel=new oti({...t,issueType:t.issueType||0,versionInfo:{vscodeVersion:`${n.nameShort} ${n.darwinUniversalAssetId?`${n.version} (Universal)`:n.version} (${n.commit||"Commit unknown"}, ${n.date||"Date unknown"})`,os:`${this.os.type} ${this.os.arch} ${this.os.release}${Uye?" snap":""}`},extensionsDisabled:!!this.disableExtensions,fileOnExtension:t.extensionId?!v?.isBuiltin:void 0,selectedExtension:v}),this._register(this.authenticationService.onDidChangeSessions(async()=>{let H=!!this.data.githubAccessToken,K="";try{K=(await this.authenticationService.getSessions("github")).filter(ae=>ae.scopes.includes("repo"))[0]?.accessToken}catch{}this.data.githubAccessToken=K,H!==!!K&&this.updateButtonStates()}));let b=t.issueSource==="marketplace",S=t.issueSource==="vscode";this.issueReporterModel.update({fileOnMarketplace:b,fileOnProduct:S}),this.createAction=this._register(new it("issueReporter.create",d(12503,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.setSubmittingState(!0);try{await this.createIssue(!0)}finally{this.setSubmittingState(!1)}})})),this.previewAction=this._register(new it("issueReporter.preview",d(12523,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.setSubmittingState(!0);try{await this.createIssue(!1)}finally{this.setSubmittingState(!1)}})})),this.privateAction=this._register(new it("issueReporter.privateCreate",d(12525,null),void 0,!0,async()=>{this.delayedSubmit.trigger(async()=>{this.setSubmittingState(!0);try{await this.createIssue(!0,!0)}finally{this.setSubmittingState(!1)}})}));let y=t.issueTitle;if(y){let H=this.getElementById("issue-title");H&&(H.value=y)}let w=t.issueBody;if(w){let H=this.getElementById("description");H&&(H.value=w,this.issueReporterModel.update({issueDescription:w}))}this.window.document.documentElement.lang!=="en"&&qm(this.getElementById("english"));let x=Pr();x.id="codiconStyles";let E=this._register(i1t(this.themeService));function M(){x.textContent=E.getCSS()}let N=new Dt(M,0);this._register(E.onDidChange(()=>N.schedule())),N.schedule(),this.handleExtensionData(t.enabledExtensions),this.setUpTypes(),(t.data||t.uri)&&v&&this.updateExtensionStatus(v),this.getElementById("issue-reporter")&&this.updateButtonStates()}render(){this.renderBlocks()}setInitialFocus(){let{fileOnExtension:e}=this.issueReporterModel.getData();e?this.window.document.getElementById("issue-title")?.focus():this.window.document.getElementById("issue-type")?.focus()}updateButtonStates(){let e=this.getElementById("issue-reporter");if(!e)return;let t=this.getElementById("public-elements");t||(t=document.createElement("div"),t.id="public-elements",t.classList.add("public-elements"),e.appendChild(t)),this.updatePublicGithubButton(t),this.updatePublicRepoLink(t);let o=this.getElementById("internal-elements");o||(o=document.createElement("div"),o.id="internal-elements",o.classList.add("internal-elements"),o.classList.add("hidden"),e.appendChild(o));let n=this.getElementById("internal-top-row");n||(n=document.createElement("div"),n.id="internal-top-row",n.classList.add("internal-top-row"),o.appendChild(n)),this.updateInternalFilingNote(n),this.updateInternalGithubButton(n),this.updateInternalElementsVisibility()}updateInternalFilingNote(e){let t=this.getElementById("internal-preview-message");t||(t=document.createElement("span"),t.id="internal-preview-message",t.classList.add("internal-preview-message"),e.appendChild(t)),t.textContent=Cr(d(12515,null))}updatePublicGithubButton(e){if(!this.getElementById("issue-reporter"))return;this.publicGithubButton&&this.publicGithubButton.dispose(),!this.acknowledged&&this.needsUpdate?(this.publicGithubButton=this._register(new Pi(e,nEe)),this.publicGithubButton.label=d(12499,null),this.publicGithubButton.enabled=!1):this.data.githubAccessToken&&this.isPreviewEnabled()?(this.publicGithubButton=this._register(new Jv(e,{contextMenuProvider:this.contextMenuService,actions:[this.previewAction],addPrimaryActionToDropdown:!1,...nEe})),this._register(this.publicGithubButton.onDidClick(()=>{this.createAction.run()})),this.publicGithubButton.label=d(12505,null),this.publicGithubButton.enabled=!0):this.data.githubAccessToken&&!this.isPreviewEnabled()?(this.publicGithubButton=this._register(new Pi(e,nEe)),this._register(this.publicGithubButton.onDidClick(()=>{this.createAction.run()})),this.publicGithubButton.label=d(12505,null),this.publicGithubButton.enabled=!0):(this.publicGithubButton=this._register(new Pi(e,nEe)),this._register(this.publicGithubButton.onDidClick(()=>{this.previewAction.run()})),this.publicGithubButton.label=d(12524,null),this.publicGithubButton.enabled=!0);let o=this.getElementById("show-repo-name");o&&e.insertBefore(this.publicGithubButton.element,o)}updatePublicRepoLink(e){let t=this.getElementById("show-repo-name");t||(t=document.createElement("a"),t.id="show-repo-name",t.classList.add("hidden"),e.appendChild(t));let o=this.issueReporterModel.getData().selectedExtension;if(o&&o.uri){let n=A.revive(o.uri).toString();t.href=n,t.addEventListener("click",s=>this.openLink(s)),t.addEventListener("auxclick",s=>this.openLink(s));let r=this.parseGitHubUrl(n);t.textContent=r?r.owner+"/"+r.repositoryName:n,Object.assign(t.style,{alignSelf:"flex-end",display:"block",fontSize:"13px",padding:"4px 0px",textDecoration:"none",width:"auto"}),qm(t)}else t&&(t.removeAttribute("style"),ES(t))}updateInternalGithubButton(e){this.getElementById("issue-reporter")&&(this.internalGithubButton&&this.internalGithubButton.dispose(),this.data.githubAccessToken&&this.data.privateUri&&(this.internalGithubButton=this._register(new Pi(e,nEe)),this._register(this.internalGithubButton.onDidClick(()=>{this.privateAction.run()})),this.internalGithubButton.element.id="internal-create-btn",this.internalGithubButton.element.classList.add("internal-create-subtle"),this.internalGithubButton.label=d(12504,null),this.internalGithubButton.enabled=!0,this.internalGithubButton.setTitle(this.data.privateUri.path.slice(1))))}updateInternalElementsVisibility(){let e=this.getElementById("internal-elements");e&&(this.data.githubAccessToken&&this.data.privateUri?(qm(e),e.style.display="",this.internalGithubButton&&(this.internalGithubButton.enabled=this.publicGithubButton?.enabled??!1)):(ES(e),e.style.display="none"))}getSubmitButtonElement(){return this.publicGithubButton instanceof Jv?this.publicGithubButton.primaryButton.element:this.publicGithubButton.element}setSubmittingState(e){this.publicGithubButton.enabled=!e,this.internalGithubButton&&(this.internalGithubButton.enabled=!e);let t=this.getSubmitButtonElement();if(e){let o=this.publicGithubButton instanceof Jv?this.publicGithubButton.primaryButton.label:this.publicGithubButton.label;this.preSubmitButtonLabel=typeof o=="string"?o:"",this.publicGithubButton.label=d(12532,null);let n=un(q.modify(L.loading,"spin"));t.prepend(n)}else t.querySelector(".codicon-loading")?.remove(),this.preSubmitButtonLabel!==void 0&&(this.publicGithubButton.label=this.preSubmitButtonLabel,this.preSubmitButtonLabel=void 0)}async updateIssueReporterUri(e){try{if(e.uri){let t=A.revive(e.uri);e.bugsUrl=t.toString()}}catch{this.renderBlocks()}}handleExtensionData(e){let t=e.filter(s=>!s.isBuiltin),{nonThemes:o,themes:n}=yy(t,s=>s.isTheme?"themes":"nonThemes"),r=(n&&n.length)??0;this.issueReporterModel.update({numberOfThemeExtesions:r,enabledNonThemeExtesions:o,allExtensions:t}),this.updateExtensionTable(o??[],r),(this.disableExtensions||t.length===0)&&(this.getElementById("disableExtensions").disabled=!0),this.updateExtensionSelector(t)}updateExtensionSelector(e){let t=e.map(r=>({name:r.displayName||r.name||"",id:r.id}));t.sort((r,s)=>{let l=r.name.toLowerCase(),c=s.name.toLowerCase();return l>c?1:l<c?-1:0});let o=(r,s)=>{let l=s&&r.id===s.id;return _("option",{value:r.id,selected:l||""},r.name)},n=this.getElementById("extension-selector");if(n){let{selectedExtension:r}=this.issueReporterModel.getData();Ii(n,this.makeOption("",d(12527,null),!0),...t.map(s=>o(s,r))),r||(n.selectedIndex=0),this.addEventListener("extension-selector","change",async s=>{this.clearExtensionData();let l=s.target.value;this.selectedExtension=l;let u=this.issueReporterModel.getData().allExtensions.filter(p=>p.id===l);if(u.length){this.issueReporterModel.update({selectedExtension:u[0]});let p=this.issueReporterModel.getData().selectedExtension;if(p){let h=document.createElement("span");h.classList.add(...q.asClassNameArray(L.loading),"codicon-modifier-spin"),this.setLoading(h);let g=await this.sendReporterMenu(p);g?this.selectedExtension===l&&(this.removeLoading(h,!0),this.data=g):(this.loadingExtensionData||h.classList.remove(...q.asClassNameArray(L.loading),"codicon-modifier-spin"),this.removeLoading(h),this.clearExtensionData(),p.data=void 0,p.uri=void 0),this.selectedExtension===l&&(this.updateExtensionStatus(u[0]),this.openReporter=!1)}else this.issueReporterModel.update({selectedExtension:void 0}),this.clearSearchResults(),this.clearExtensionData(),this.validateSelectedExtension(),this.updateExtensionStatus(u[0])}this.updateInternalElementsVisibility()})}this.addEventListener("problem-source","change",r=>{this.clearExtensionData(),this.validateSelectedExtension()})}async sendReporterMenu(e){try{let t=new Promise((n,r)=>setTimeout(()=>r(new Error("sendReporterMenu timed out")),1e4));return await Promise.race([this.issueFormService.sendReporterMenu(e.id),t])}catch(t){console.error(t);return}}updateAcknowledgementState(){let e=this.getElementById("includeAcknowledgement");e&&(this.acknowledged=e.checked,this.updateButtonStates())}setEventHandlers(){["includeSystemInfo","includeProcessInfo","includeWorkspaceInfo","includeExtensions","includeExperiments","includeExtensionData"].forEach(t=>{this.addEventListener(t,"click",o=>{o.stopPropagation(),this.issueReporterModel.update({[t]:!this.issueReporterModel.getData()[t]})})}),this.addEventListener("includeAcknowledgement","click",t=>{t.stopPropagation(),this.updateAcknowledgementState()});let e=this.window.document.getElementsByClassName("showInfo");for(let t=0;t<e.length;t++)e.item(t).addEventListener("click",n=>{n.preventDefault();let r=n.target;if(r){let s=r.parentElement&&r.parentElement.parentElement,l=s&&s.lastElementChild;l&&l.classList.contains("hidden")?(qm(l),r.textContent=d(12514,null)):(ES(l),r.textContent=d(12529,null))}});this.addEventListener("issue-source","change",t=>{let o=t.target.value,n=this.getElementById("problem-source-help-text");if(o===""){this.issueReporterModel.update({fileOnExtension:void 0}),qm(n),this.clearSearchResults(),this.render();return}else ES(n);let r=this.getElementById("issue-title");o==="vscode"?r.placeholder=d(12536,null):o==="extension"?r.placeholder=d(12510,null):o==="marketplace"?r.placeholder=d(12517,null):r.placeholder=d(12533,null);let s,l,c=!1;o==="extension"?s=!0:o==="marketplace"?l=!0:o==="vscode"&&(c=!0),this.issueReporterModel.update({fileOnExtension:s,fileOnMarketplace:l,fileOnProduct:c}),this.render();let u=this.getElementById("issue-title").value;this.searchIssues(u,s,l)}),this.addEventListener("description","input",t=>{let o=t.target.value;if(this.issueReporterModel.update({issueDescription:o}),this.issueReporterModel.fileOnExtension()===!1){let n=this.getElementById("issue-title").value;this.searchVSCodeIssues(n,o)}}),this.addEventListener("issue-title","input",t=>{let o=this.getElementById("issue-title");if(o){let n=o.value;this.issueReporterModel.update({issueTitle:n})}}),this.addEventListener("issue-title","input",t=>{let o=t.target.value,n=this.getElementById("issue-title-length-validation-error"),r=this.getIssueUrl();o&&this.getIssueUrlWithTitle(o,r).length>aUo?qm(n):ES(n);let s=this.getElementById("issue-source");if(!s||s.value==="")return;let{fileOnExtension:l,fileOnMarketplace:c}=this.issueReporterModel.getData();this.searchIssues(o,l,c)}),this.addEventListener("disableExtensions","click",()=>{this.issueFormService.reloadWithExtensionsDisabled()}),this.addEventListener("extensionBugsLink","click",t=>{let o=t.target.innerText;this.openLink(o)}),this.addEventListener("disableExtensions","keydown",t=>{t.stopPropagation(),(t.key==="Enter"||t.key===" ")&&this.issueFormService.reloadWithExtensionsDisabled()}),this.window.document.onkeydown=async t=>{let o=et?t.metaKey:t.ctrlKey;if(o&&t.key==="Enter"&&this.delayedSubmit.trigger(async()=>{this.setSubmittingState(!0);try{await this.createIssue()&&this.close()}finally{this.setSubmittingState(!1)}}),o&&t.key==="w"){t.stopPropagation(),t.preventDefault();let n=this.getElementById("issue-title").value,{issueDescription:r}=this.issueReporterModel.getData();!this.hasBeenSubmitted&&(n||r)?this.issueFormService.showConfirmCloseDialog():this.close()}et&&o&&t.key==="a"&&t.target&&(Xle(t.target)||kY(t.target))&&t.target.select()},this.addEventListener("review-guidance-help-text","click",t=>{let o=t.target;o.tagName==="A"&&o.getAttribute("target")==="_blank"&&this.openLink(t)})}updatePerformanceInfo(e){this.issueReporterModel.update(e),this.receivedPerformanceInfo=!0;let t=this.issueReporterModel.getData();this.updateProcessInfo(t),this.updateWorkspaceInfo(t),this.updateButtonStates()}isPreviewEnabled(){let e=this.issueReporterModel.getData().issueType;if(this.loadingExtensionData)return!1;if(this.isWeb){if(e===2||e===1||e===0)return!0}else if(e===0&&this.receivedSystemInfo||e===1&&this.receivedSystemInfo&&this.receivedPerformanceInfo||e===2)return!0;return!1}getExtensionRepositoryUrl(){let e=this.issueReporterModel.getData().selectedExtension;return e&&e.repositoryUrl}getExtensionBugsUrl(){let e=this.issueReporterModel.getData().selectedExtension;return e&&e.bugsUrl}searchVSCodeIssues(e,t){e?this.searchDuplicates(e,t):this.clearSearchResults()}searchIssues(e,t,o){if(t)return this.searchExtensionIssues(e);if(o)return this.searchMarketplaceIssues(e);let n=this.issueReporterModel.getData().issueDescription;this.searchVSCodeIssues(e,n)}searchExtensionIssues(e){let t=this.getExtensionGitHubUrl();if(e){let o=/^https?:\/\/github\.com\/(.*)/.exec(t);if(o&&o.length){let n=o[1];return this.searchGitHub(n,e)}if(this.issueReporterModel.getData().selectedExtension)return this.clearSearchResults(),this.displaySearchResults([])}this.clearSearchResults()}searchMarketplaceIssues(e){if(e){let t=this.parseGitHubUrl(this.product.reportMarketplaceIssueUrl);if(t)return this.searchGitHub(`${t.owner}/${t.repositoryName}`,e)}}async close(){await this.issueFormService.closeReporter()}clearSearchResults(){let e=this.getElementById("similar-issues");e.innerText="",this.numberOfSearchResultsDisplayed=0}searchGitHub(e,t){let o=`is:issue+repo:${e}+${t}`,n=this.getElementById("similar-issues");fetch(`https://api.github.com/search/issues?q=${o}`).then(r=>{r.json().then(s=>{n.innerText="",s&&s.items&&this.displaySearchResults(s.items)}).catch(s=>{console.warn("Timeout or query limit exceeded")})}).catch(r=>{console.warn("Error fetching GitHub issues")})}searchDuplicates(e,t){let o="https://vscode-probot.westus.cloudapp.azure.com:7890/duplicate_candidates",n={method:"POST",body:JSON.stringify({title:e,body:t}),headers:new Headers({"Content-Type":"application/json"})};fetch(o,n).then(r=>{r.json().then(s=>{if(this.clearSearchResults(),s&&s.candidates)this.displaySearchResults(s.candidates);else throw new Error("Unexpected response, no candidates property")}).catch(s=>{})}).catch(r=>{})}displaySearchResults(e){let t=this.getElementById("similar-issues");if(e.length){let o=_("div.issues-container"),n=_("div.list-title");n.textContent=d(12530,null),this.numberOfSearchResultsDisplayed=e.length<5?e.length:5;for(let r=0;r<this.numberOfSearchResultsDisplayed;r++){let s=e[r],l=_("a.issue-link",{href:s.html_url});l.textContent=s.title,l.title=s.title,l.addEventListener("click",p=>this.openLink(p)),l.addEventListener("auxclick",p=>this.openLink(p));let c,u;if(s.state){c=_("span.issue-state");let p=_("span.issue-icon");p.appendChild(un(s.state==="open"?L.issueOpened:L.issueClosed));let h=_("span.issue-state.label");h.textContent=s.state==="open"?d(12518,null):d(12502,null),c.title=s.state==="open"?d(12518,null):d(12502,null),c.appendChild(p),c.appendChild(h),u=_("div.issue",void 0,c,l)}else u=_("div.issue",void 0,l);o.appendChild(u)}t.appendChild(n),t.appendChild(o)}}setUpTypes(){let e=(n,r)=>_("option",{value:n.valueOf()},Cr(r)),t=this.getElementById("issue-type"),{issueType:o}=this.issueReporterModel.getData();Ii(t,e(0,d(12501,null)),e(2,d(12511,null)),e(1,d(12521,null))),t.value=o.toString(),this.setSourceOptions()}makeOption(e,t,o){let n=document.createElement("option");return n.disabled=o,n.value=e,n.textContent=t,n}setSourceOptions(){let e=this.getElementById("issue-source"),{issueType:t,fileOnExtension:o,selectedExtension:n,fileOnMarketplace:r,fileOnProduct:s}=this.issueReporterModel.getData(),l=e.selectedIndex;l===-1&&(o!==void 0?l=o?2:1:n?.isBuiltin?l=1:r?l=3:s&&(l=1)),e.innerText="",e.append(this.makeOption("",d(12528,null),!0)),e.append(this.makeOption("vscode",d(12535,null),!1)),e.append(this.makeOption("extension",d(12509,null),!1)),this.product.reportMarketplaceIssueUrl&&e.append(this.makeOption("marketplace",d(12516,null),!1)),t!==2&&e.append(this.makeOption("unknown",d(12534,null),!1)),l!==-1&&l<e.options.length?e.selectedIndex=l:(e.selectedIndex=0,ES(this.getElementById("problem-source-help-text")))}async renderBlocks(){let{issueType:e,fileOnExtension:t,fileOnMarketplace:o,selectedExtension:n}=this.issueReporterModel.getData(),r=this.getElementById("block-container"),s=this.window.document.querySelector(".block-system"),l=this.window.document.querySelector(".block-process"),c=this.window.document.querySelector(".block-workspace"),u=this.window.document.querySelector(".block-extensions"),p=this.window.document.querySelector(".block-experiments"),h=this.window.document.querySelector(".block-extension-data"),g=this.getElementById("problem-source"),f=this.getElementById("issue-description-label"),v=this.getElementById("issue-description-subtitle"),b=this.getElementById("extension-selection"),S=this.getElementById("extension-data-download"),y=this.getElementById("issue-title-container"),w=this.getElementById("description"),x=this.getElementById("extension-data");ES(r),ES(s),ES(l),ES(c),ES(u),ES(p),ES(b),ES(x),ES(h),ES(S),qm(g),qm(y),qm(w),t&&qm(b);let E=this.issueReporterModel.getData().extensionData;if(E&&E.length>oAn){qm(S);let M=new Date,N=M.toISOString().split("T")[0],V=M.toTimeString().split(" ")[0].replace(/:/g,"-"),H=`extensionData_${N}_${V}.md`,K=async()=>{let j=await this.fileDialogService.showSaveDialog({title:d(12526,null),availableFileSystems:[Q.file],defaultUri:Ve(await this.fileDialogService.defaultFilePath(Q.file),H)});j&&await this.fileService.writeFile(j,Ke.fromString(E))};S.addEventListener("click",K),this._register({dispose:()=>S.removeEventListener("click",K)})}if(n&&this.nonGitHubIssueUrl){ES(y),ES(w),Ii(f,d(12513,null)),Ii(v,d(12508,null,n.displayName)),this.publicGithubButton.label=d(12519,null);return}if(t&&n?.data){let M=n?.data;x.innerText=M.toString(),x.readOnly=!0,qm(h)}t&&this.openReporter&&(x.readOnly=!0,setTimeout(()=>{this.openReporter&&qm(h)},100),qm(h)),e===0?(o||(qm(r),qm(s),qm(p),t||qm(u)),Ii(f,d(12531,null)+" ",_("span.required-input",void 0,"*")),Ii(v,d(12500,null))):e===1?(o||(qm(r),qm(s),qm(l),qm(c),qm(p)),t?qm(b):o||qm(u),Ii(f,d(12531,null)+" ",_("span.required-input",void 0,"*")),Ii(v,d(12522,null))):e===2&&(Ii(f,d(12506,null)+" ",_("span.required-input",void 0,"*")),Ii(v,d(12512,null)))}validateInput(e){let t=this.getElementById(e),o=this.getElementById(`${e}-empty-error`),n=this.getElementById("description-short-error");return e==="description"&&this.nonGitHubIssueUrl&&this.data.extensionId?!0:t.value?e==="description"&&t.value.length<10?(t.classList.add("invalid-input"),n?.classList.remove("hidden"),o?.classList.add("hidden"),!1):(t.classList.remove("invalid-input"),o?.classList.add("hidden"),e==="description"&&n?.classList.add("hidden"),!0):(t.classList.add("invalid-input"),o?.classList.remove("hidden"),n?.classList.add("hidden"),!1)}validateInputs(){let e=!0;return["issue-title","description","issue-source"].forEach(t=>{e=this.validateInput(t)&&e}),this.issueReporterModel.fileOnExtension()&&(e=this.validateInput("extension-selector")&&e),e}async submitToGitHub(e,t,o){let n=`https://api.github.com/repos/${o.owner}/${o.repositoryName}/issues`,r={method:"POST",body:JSON.stringify({title:e,body:t}),headers:new Headers({"Content-Type":"application/json",Authorization:`Bearer ${this.data.githubAccessToken}`,"User-Agent":"request"})},s=await fetch(n,r);if(!s.ok)return console.error("Invalid GitHub URL provided."),!1;let l=await s.json();return await this.openLink(l.html_url),this.close(),!0}async createIssue(e,t){let o=this.issueReporterModel.getData().selectedExtension;if(this.nonGitHubIssueUrl&&this.getExtensionBugsUrl())return this.hasBeenSubmitted=!0,!0;if(!this.validateInputs()){let p=this.window.document.getElementsByClassName("invalid-input");return p.length&&p[0].focus(),this.addEventListener("issue-title","input",h=>{this.validateInput("issue-title")}),this.addEventListener("description","input",h=>{this.validateInput("description")}),this.addEventListener("issue-source","change",h=>{this.validateInput("issue-source")}),this.issueReporterModel.fileOnExtension()&&this.addEventListener("extension-selector","change",h=>{this.validateInput("extension-selector")}),!1}this.hasBeenSubmitted=!0;let n=this.getElementById("issue-title").value,r=this.issueReporterModel.serialize(),s=t?this.getPrivateIssueUrl():this.getIssueUrl();if(!s)return console.error(`No ${t?"private ":""}issue url found`),!1;o?.uri&&(s=A.revive(o.uri).toString());let l=this.parseGitHubUrl(s);if(this.data.githubAccessToken&&l&&e)return this.submitToGitHub(n,r,l);let c=this.getIssueUrlWithTitle(this.getElementById("issue-title").value,s),u=c+`&body=${encodeURIComponent(r)}`;if(u=this.addTemplateToUrl(u,l?.owner,l?.repositoryName),u.length>aUo)try{u=await this.writeToClipboard(c,r),u=this.addTemplateToUrl(u,l?.owner,l?.repositoryName)}catch{return console.error("Writing to clipboard failed"),!1}return await this.openLink(u),!0}async writeToClipboard(e,t){if(!await this.issueFormService.showClipboardDialog())throw new qi;return e+`&body=${encodeURIComponent(d(12520,null))}`}addTemplateToUrl(e,t,o){let n=this.issueReporterModel.getData().fileOnProduct,r=t?.toLowerCase()==="microsoft";if(n||r&&(o==="vscode"||o==="vscode-python"))try{let l=new URL(e);return l.searchParams.set("template","bug_report.md"),l.toString()}catch{return e+"&template=bug_report.md"}return e}getIssueUrl(){return this.issueReporterModel.fileOnExtension()?this.getExtensionGitHubUrl():this.issueReporterModel.getData().fileOnMarketplace?this.product.reportMarketplaceIssueUrl:this.product.reportIssueUrl}getPrivateIssueUrl(){return A.revive(this.data.privateUri)?.toString()}parseGitHubUrl(e){let t=/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*).*/.exec(e);if(t&&t.length)return{owner:t[1],repositoryName:t[2]};console.error("No GitHub issues match")}getExtensionGitHubUrl(){let e="",t=this.getExtensionBugsUrl(),o=this.getExtensionRepositoryUrl();return t&&t.match(/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*)\/?(\/issues)?$/)?e=a5i(t):o&&o.match(/^https?:\/\/github\.com\/([^\/]*)\/([^\/]*)$/)?e=a5i(o):(this.nonGitHubIssueUrl=!0,e=t||o||""),e}getIssueUrlWithTitle(e,t){this.issueReporterModel.fileOnExtension()&&(t=t+"/issues/new");let o=t.indexOf("?")===-1?"?":"&";return`${t}${o}title=${encodeURIComponent(e)}`}clearExtensionData(){this.nonGitHubIssueUrl=!1,this.issueReporterModel.update({extensionData:void 0}),this.data.issueBody=this.data.issueBody||"",this.data.data=void 0,this.data.uri=void 0,this.data.privateUri=void 0}async updateExtensionStatus(e){this.issueReporterModel.update({selectedExtension:e});let t=this.data.issueBody;if(t){let s=this.getElementById("description"),l=s.value;if(l===""||!l.includes(t.toString())){let c=l+(l===""?"":`
`)+t.toString();s.value=c,this.issueReporterModel.update({issueDescription:c})}}let o=this.data.data;if(o){this.issueReporterModel.update({extensionData:o}),e.data=o;let s=this.window.document.querySelector(".block-extension-data");qm(s),this.renderBlocks()}let n=this.data.uri;n&&(e.uri=n,this.updateIssueReporterUri(e)),this.validateSelectedExtension();let r=this.getElementById("issue-title").value;this.searchExtensionIssues(r),this.updateButtonStates(),this.renderBlocks()}validateSelectedExtension(){let e=this.getElementById("extension-selection-validation-error"),t=this.getElementById("extension-selection-validation-error-no-url");if(ES(e),ES(t),!this.issueReporterModel.getData().selectedExtension){this.publicGithubButton.enabled=!0;return}if(this.loadingExtensionData)return;this.getExtensionGitHubUrl()?this.publicGithubButton.enabled=!0:(this.setExtensionValidationMessage(),this.publicGithubButton.enabled=!1)}setLoading(e){this.openReporter=!0,this.loadingExtensionData=!0,this.updateButtonStates();let t=this.getElementById("extension-id");ES(t),Array.from(this.window.document.querySelectorAll(".ext-parens")).forEach(r=>ES(r));let n=this.getElementById("ext-loading");for(qm(n);n.firstChild;)n.firstChild.remove();n.append(e),this.renderBlocks()}removeLoading(e,t=!1){this.openReporter=t,this.loadingExtensionData=!1,this.updateButtonStates();let o=this.getElementById("extension-id");qm(o),Array.from(this.window.document.querySelectorAll(".ext-parens")).forEach(s=>qm(s));let r=this.getElementById("ext-loading");ES(r),r.firstChild&&e.remove(),this.renderBlocks()}setExtensionValidationMessage(){let e=this.getElementById("extension-selection-validation-error"),t=this.getElementById("extension-selection-validation-error-no-url"),o=this.getExtensionBugsUrl();if(o){qm(e);let r=this.getElementById("extensionBugsLink");r.textContent=o;return}let n=this.getExtensionRepositoryUrl();if(n){qm(e);let r=this.getElementById("extensionBugsLink");r.textContent=n;return}qm(t)}updateProcessInfo(e){let t=this.window.document.querySelector(".block-process .block-info");t&&Ii(t,_("code",void 0,e.processInfo??""))}updateWorkspaceInfo(e){this.window.document.querySelector(".block-workspace .block-info code").textContent=`
`+e.workspaceInfo}updateExtensionTable(e,t){let o=this.window.document.querySelector(".block-extensions .block-info");if(o){if(this.disableExtensions){Ii(o,d(12507,null));return}let n=t?`
(${t} theme extensions excluded)`:"";if(e=e||[],!e.length){o.innerText="Extensions: none"+n;return}Ii(o,this.getExtensionTableHtml(e),document.createTextNode(n))}}getExtensionTableHtml(e){return _("table",void 0,_("tr",void 0,_("th",void 0,"Extension"),_("th",void 0,"Author (truncated)"),_("th",void 0,"Version")),...e.map(t=>_("tr",void 0,_("td",void 0,t.name),_("td",void 0,t.publisher?.substr(0,3)??"N/A"),_("td",void 0,t.version))))}async openLink(e){if(typeof e=="string")await this.openerService.open(e,{openExternal:!0});else{let t=e;t.preventDefault(),t.stopPropagation(),t.which<3&&await this.openerService.open(t.target.href,{openExternal:!0})}}getElementById(e){let t=this.window.document.getElementById(e);if(t)return t}addEventListener(e,t,o){this.getElementById(e)?.addEventListener(t,o)}};I([Tu(300)],kj.prototype,"searchGitHub",1),I([Tu(300)],kj.prototype,"searchDuplicates",1),kj=I([m(6,yq),m(7,Pe),m(8,ge),m(9,nn),m(10,Xe),m(11,ks),m(12,Je)],kj);function ES(a){a?.classList.add("hidden")}function qm(a){a?.classList.remove("hidden")}var zje=class extends kj{constructor(i,e,t,o,n,r,s,l,c,u,p,h){super(i,e,t,o,n,!0,r,s,l,c,u,p,h);let g=this.window.document.querySelector(".block-system .block-info"),f=this.window.navigator.userAgent;f&&(g?.appendChild(this.window.document.createTextNode(f)),this.receivedSystemInfo=!0,this.issueReporterModel.update({systemInfoWeb:f})),this.setEventHandlers()}setEventHandlers(){super.setEventHandlers(),this.addEventListener("issue-type","change",i=>{let e=parseInt(i.target.value);this.issueReporterModel.update({issueType:e});let t=this.getElementById("issue-title");t&&(t.placeholder=d(12572,null)),this.updateButtonStates(),this.setSourceOptions(),this.render()})}};zje=I([m(5,yq),m(6,Pe),m(7,ge),m(8,nn),m(9,Xe),m(10,ks),m(11,Je)],zje);var Kje=class{constructor(i,e,t,o,n,r,s){this.instantiationService=i;this.auxiliaryWindowService=e;this.menuService=t;this.contextKeyService=o;this.logService=n;this.dialogService=r;this.hostService=s;this.issueReporterWindow=null;this.extensionIdentifierSet=new HS;this.arch="";this.release="";this.type=""}async openReporter(i){this.hasToReload(i)||(await this.openAuxIssueReporter(i),this.issueReporterWindow&&this.instantiationService.createInstance(zje,!1,i,{type:this.type,arch:this.arch,release:this.release},$i,this.issueReporterWindow).render())}async openAuxIssueReporter(i,e){let t={width:700,height:800};if(e&&e.x&&e.y){let s=e.x+e.width/2,l=e.y+e.height/2;t={...t,x:s-350,y:l-400}}let o=new O,n=o.add(await this.auxiliaryWindowService.open({mode:1,bounds:t,nativeTitlebar:!0,disableFullscreen:!0})),r=ii?"windows":Sn?"linux":"mac";if(n){if(await n.whenStylesHaveLoaded,n.window.document.title="Issue Reporter",n.window.document.body.classList.add("issue-reporter-body","monaco-workbench",r),n.container.remove(),!j8.globalStyleSheet){let l=Pr(n.window.document.head);l.textContent=JTi(Jfo,!1)}let s=document.createElement("div");s.classList.add("monaco-workbench"),n.window.document.body.appendChild(s),AA(s,sUo(),{allowedTags:{augment:["input","select","checkbox","textarea"]},allowedAttributes:{augment:["id","class","style","textarea"]}}),this.issueReporterWindow=n.window}else console.error("Failed to open auxiliary window"),o.dispose();this.issueReporterWindow?.addEventListener("beforeunload",()=>{n.window.close(),o.dispose(),this.issueReporterWindow=null})}async sendReporterMenu(i){let e=this.menuService.createMenu(R.IssueReporter,this.contextKeyService),t=e.getActions({renderShortTitle:!0}).flatMap(n=>n[1]);for(let n of t)try{n.item&&"source"in n.item&&n.item.source?.id.toLowerCase()===i.toLowerCase()&&(this.extensionIdentifierSet.add(i.toLowerCase()),await n.run())}catch(r){console.error(r)}if(!this.extensionIdentifierSet.has(i))return;this.extensionIdentifierSet.delete(new hi(i)),e.dispose();let o=this.currentData;return this.currentData=void 0,o??void 0}async closeReporter(){this.issueReporterWindow?.close()}async reloadWithExtensionsDisabled(){if(this.issueReporterWindow)try{await this.hostService.reload({disableExtensions:!0})}catch(i){this.logService.error(i)}}async showConfirmCloseDialog(){await this.dialogService.prompt({type:wt.Warning,message:d(12538,null),buttons:[{label:d(12541,null),run:()=>{this.closeReporter(),this.issueReporterWindow=null}},{label:d(12537,null),run:()=>{}}]})}async showClipboardDialog(){let i=!1;return await this.dialogService.prompt({type:wt.Warning,message:d(12539,null),buttons:[{label:d(12540,null),run:()=>{i=!0}},{label:d(12537,null),run:()=>{i=!1}}]}),i}hasToReload(i){return i.extensionId&&this.extensionIdentifierSet.has(i.extensionId)?(this.currentData=i,this.issueReporterWindow?.focus(),!0):this.issueReporterWindow?(this.issueReporterWindow.focus(),!0):!1}};Kje=I([m(0,F),m(1,RR),m(2,Yt),m(3,X),m(4,re),m(5,ct),m(6,ti)],Kje);var nAn=7500,lUo=65500,Gje=class extends kj{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S){super(e,t,o,n,r,!1,l,u,p,h,v,b,S);this.nativeHostService=s;this.updateService=g;this.processService=c,this.processService.getSystemInfo().then(y=>{this.issueReporterModel.update({systemInfo:y}),this.receivedSystemInfo=!0,this.updateSystemInfo(this.issueReporterModel.getData()),this.updateButtonStates()}),this.data.issueType===1&&this.processService.getPerformanceInfo().then(y=>{this.updatePerformanceInfo(y)}),this.checkForUpdates(),this.setEventHandlers(),gj(this.data.zoomLevel,this.window),this.updateExperimentsInfo(this.data.experiments),this.updateRestrictedMode(this.data.restrictedMode),this.updateUnsupportedMode(this.data.isUnsupported)}async checkForUpdates(){let e=this.updateService.state;if(e.type==="ready"||e.type==="downloaded"){this.needsUpdate=!0;let t=this.getElementById("version-acknowledgements"),o=this.getElementById("update-banner");o&&t&&(t.classList.remove("hidden"),o.classList.remove("hidden"),o.textContent=d(12602,null,this.product.nameLong))}}setEventHandlers(){super.setEventHandlers(),this.addEventListener("issue-type","change",e=>{let t=parseInt(e.target.value);this.issueReporterModel.update({issueType:t}),t===1&&!this.receivedPerformanceInfo&&this.processService.getPerformanceInfo().then(n=>{this.updatePerformanceInfo(n)});let o=this.getElementById("issue-title");o&&(o.placeholder=d(12601,null)),this.updateButtonStates(),this.setSourceOptions(),this.render()})}async submitToGitHub(e,t,o){if(t.length>lUo){let c=this.issueReporterModel.getData().extensionData;if(c){t=t.replace(c,"");let u=new Date,p=u.toISOString().split("T")[0],h=u.toTimeString().split(" ")[0].replace(/:/g,"-"),g=`extensionData_${p}_${h}.md`;try{let f=await this.fileDialogService.showSaveDialog({title:d(12600,null),availableFileSystems:[Q.file],defaultUri:Ve(await this.fileDialogService.defaultFilePath(Q.file),g)});f&&await this.fileService.writeFile(f,Ke.fromString(c))}catch{return console.error("Writing extension data to file failed"),!1}}else return console.error("Issue body too large to submit to GitHub"),!1}let n=`https://api.github.com/repos/${o.owner}/${o.repositoryName}/issues`,r={method:"POST",body:JSON.stringify({title:e,body:t}),headers:new Headers({"Content-Type":"application/json",Authorization:`Bearer ${this.data.githubAccessToken}`})},s=await fetch(n,r);if(!s.ok)return console.error("Invalid GitHub URL provided."),!1;let l=await s.json();return await this.openerService.open(l.html_url,{openExternal:!0}),this.close(),!0}async createIssue(e,t){let o=this.issueReporterModel.getData().selectedExtension;if(this.nonGitHubIssueUrl){let p=this.getExtensionBugsUrl();if(p)return this.hasBeenSubmitted=!0,await this.openerService.open(p,{openExternal:!0}),!0}if(!this.validateInputs()){let p=this.window.document.getElementsByClassName("invalid-input");return p.length&&p[0].focus(),this.addEventListener("issue-title","input",h=>{this.validateInput("issue-title")}),this.addEventListener("description","input",h=>{this.validateInput("description")}),this.addEventListener("issue-source","change",h=>{this.validateInput("issue-source")}),this.issueReporterModel.fileOnExtension()&&this.addEventListener("extension-selector","change",h=>{this.validateInput("extension-selector"),this.validateInput("description")}),!1}this.hasBeenSubmitted=!0;let n=this.getElementById("issue-title").value,r=this.issueReporterModel.serialize(),s=t?this.getPrivateIssueUrl():this.getIssueUrl();if(!s&&o?.uri)s=A.revive(o.uri).toString();else if(!s)return console.error(`No ${t?"private ":""}issue url found`),!1;let l=this.parseGitHubUrl(s),c=this.getIssueUrlWithTitle(this.getElementById("issue-title").value,s),u=c+`&body=${encodeURIComponent(r)}`;if(u=this.addTemplateToUrl(u,l?.owner,l?.repositoryName),this.data.githubAccessToken&&l&&e&&await this.submitToGitHub(n,r,l))return!0;try{(u.length>nAn||r.length>lUo)&&(u=await this.writeToClipboard(c,r),u=this.addTemplateToUrl(u,l?.owner,l?.repositoryName))}catch{return console.error("Writing to clipboard failed"),!1}return await this.openerService.open(u,{openExternal:!0}),!0}async writeToClipboard(e,t){if(!await this.issueFormService.showClipboardDialog())throw new qi;return await this.nativeHostService.writeClipboardText(t),e+`&body=${encodeURIComponent(d(12599,null))}`}updateSystemInfo(e){let t=this.window.document.querySelector(".block-system .block-info");if(t){let o=e.systemInfo,n=_("table",void 0,_("tr",void 0,_("td",void 0,"CPUs"),_("td",void 0,o.cpus||"")),_("tr",void 0,_("td",void 0,"GPU Status"),_("td",void 0,Object.keys(o.gpuStatus).map(r=>`${r}: ${o.gpuStatus[r]}`).join(`
`))),_("tr",void 0,_("td",void 0,"Load (avg)"),_("td",void 0,o.load||"")),_("tr",void 0,_("td",void 0,"Memory (System)"),_("td",void 0,o.memory)),_("tr",void 0,_("td",void 0,"Process Argv"),_("td",void 0,o.processArgs)),_("tr",void 0,_("td",void 0,"Screen Reader"),_("td",void 0,o.screenReader)),_("tr",void 0,_("td",void 0,"VM"),_("td",void 0,o.vmHint)));Ii(t,n),o.remoteData.forEach(r=>{if(t.appendChild(_("hr")),UW(r)){let s=_("table",void 0,_("tr",void 0,_("td",void 0,"Remote"),_("td",void 0,r.hostName)),_("tr",void 0,_("td",void 0,""),_("td",void 0,r.errorMessage)));t.appendChild(s)}else{let s=_("table",void 0,_("tr",void 0,_("td",void 0,"Remote"),_("td",void 0,r.latency?`${r.hostName} (latency: ${r.latency.current.toFixed(2)}ms last, ${r.latency.average.toFixed(2)}ms average)`:r.hostName)),_("tr",void 0,_("td",void 0,"OS"),_("td",void 0,r.machineInfo.os)),_("tr",void 0,_("td",void 0,"CPUs"),_("td",void 0,r.machineInfo.cpus||"")),_("tr",void 0,_("td",void 0,"Memory (System)"),_("td",void 0,r.machineInfo.memory)),_("tr",void 0,_("td",void 0,"VM"),_("td",void 0,r.machineInfo.vmHint)));t.appendChild(s)}})}}updateRestrictedMode(e){this.issueReporterModel.update({restrictedMode:e})}updateUnsupportedMode(e){this.issueReporterModel.update({isUnsupported:e})}updateExperimentsInfo(e){this.issueReporterModel.update({experimentInfo:e});let t=this.window.document.querySelector(".block-experiments .block-info");t&&(t.textContent=e||d(12598,null))}};Gje=I([m(5,wo),m(6,yq),m(7,rle),m(8,Pe),m(9,ge),m(10,nn),m(11,Lp),m(12,X),m(13,Xe),m(14,ks),m(15,Je)],Gje);var qje=class extends Kje{constructor(e,t,o,n,r,s,l,c,u){super(e,t,r,s,o,n,l);this.nativeHostService=c;this.environmentService=u;this.store=new O}async openReporter(e){if(this.hasToReload(e))return;let t=await this.nativeHostService.getActiveWindowPosition();if(!t)return;await this.openAuxIssueReporter(e,t);let{arch:o,release:n,type:r}=await this.nativeHostService.getOSProperties();this.arch=o,this.release=n,this.type=r,this.issueReporterWindow?this.store.add(this.instantiationService.createInstance(Gje,!!this.environmentService.disableExtensions,e,{type:this.type,arch:this.arch,release:this.release},$i,this.issueReporterWindow)).render():this.store.dispose()}};qje=I([m(0,F),m(1,RR),m(2,re),m(3,ct),m(4,Yt),m(5,X),m(6,ti),m(7,wo),m(8,Ix)],qje);Ce(R_,bye,1);Ce(yq,qje,1);var Rft=class extends Uje{constructor(i,e){if(super(i,e),!e.getValue("telemetry.feedback.enabled"))return;i.reportIssueUrl&&this._register(W(c5i));let t,o=()=>{t=oe.as(Bu.Quickaccess).registerQuickAccessProvider({ctor:z7,prefix:z7.PREFIX,contextKey:"inReportIssuePicker",placeholder:d(12597,null),helpEntries:[{description:d(12595,null),commandId:"workbench.action.openIssueReporter"}]})};this._register(e.onDidChangeConfiguration(n=>{!e.getValue("extensions.experimental.issueQuickAccess")&&t?(t.dispose(),t=void 0):t||o()})),e.getValue("extensions.experimental.issueQuickAccess")&&o()}};Rft=I([m(0,Ze),m(1,B)],Rft);oe.as(Zi.Workbench).registerWorkbenchContribution(Rft,3);var c5i=class a extends z{static{this.ID="workbench.action.reportPerformanceIssueUsingReporter"}constructor(){super({id:a.ID,title:P(12596,"Report Performance Issue..."),category:Fe.Help,f1:!0})}async run(i){return i.get(R_).openReporter({issueType:1})}};Ge.registerCommand("_issues.getSystemStatus",a=>a.get(rle).getSystemStatus());var cUo=/\s--inspect(?:-brk|port)?=(?<port>\d+)?/,rAn=/\s--inspect-port=(?<port>\d+)/;function nti(a){let i=a;return!!i?.name&&!!i?.rootProcess}function v5i(a){return!!a?.processRoots}function dle(a){return typeof a?.pid=="number"}var d5i=class{getHeight(){return 22}getTemplateId(i){return dle(i)?"process":nti(i)?"machine":UW(i)?"error":v5i(i)?"header":""}},u5i=class{hasChildren(i){return UW(i)?!1:dle(i)?!!i.children?.length:!0}getChildren(i){return dle(i)?i.children??[]:UW(i)?[]:v5i(i)?i.processRoots.length>1?i.processRoots:i.processRoots.length>0?[i.processRoots[0].rootProcess]:[]:nti(i)?[i.rootProcess]:i.processes?[i.processes]:[]}};function rti(a,i){let e=D(a,_(".row"));i&&e.classList.add(i);let t=D(e,_(".cell.name")),o=D(e,_(".cell.cpu")),n=D(e,_(".cell.memory")),r=D(e,_(".cell.pid"));return{name:t,cpu:o,memory:n,pid:r}}var p5i=class{constructor(){this.templateId="header"}renderTemplate(i){return i.previousElementSibling?.classList.add("force-no-twistie"),rti(i,"header")}renderElement(i,e,t){t.name.textContent=d(14465,null),t.cpu.textContent=d(14462,null),t.pid.textContent=d(14466,null),t.memory.textContent=d(14464,null)}disposeTemplate(i){}},m5i=class{constructor(){this.templateId="machine"}renderTemplate(i){return rti(i)}renderElement(i,e,t){t.name.textContent=i.element.name}disposeTemplate(i){}},h5i=class{constructor(){this.templateId="error"}renderTemplate(i){return rti(i)}renderElement(i,e,t){t.name.textContent=i.element.errorMessage}disposeTemplate(i){}},Lft=class extends k{constructor(e,t){super();this.content="";this.hover=this._register(t.setupManagedHover(yi("mouse"),e,this.content))}update(e){this.content!==e&&(this.content=e,this.hover.update(e))}};Lft=I([m(1,ot)],Lft);var Mft=class{constructor(i,e){this.model=i;this.hoverService=e;this.templateId="process"}renderTemplate(i){let e=rti(i);return{name:e.name,cpu:e.cpu,memory:e.memory,pid:e.pid,hover:new Lft(e.name,this.hoverService)}}renderElement(i,e,t){let{element:o}=i,n=o.pid.toFixed(0);t.name.textContent=this.model.getName(o.pid,o.name),t.cpu.textContent=o.load.toFixed(0),t.memory.textContent=(o.mem/Ml.MB).toFixed(0),t.pid.textContent=n,t.pid.parentElement.id=`pid-${n}`,t.hover?.update(o.cmd)}disposeTemplate(i){i.hover?.dispose()}};Mft=I([m(1,ot)],Mft);var g5i=class{getWidgetAriaLabel(){return d(14463,null)}getAriaLabel(i){return dle(i)||nti(i)?i.name:UW(i)?i.hostName:null}},f5i=class{getId(i){return dle(i)?i.pid.toString():UW(i)?i.hostName:v5i(i)?"processes":nti(i)?i.name:"header"}},Sye=class extends k{constructor(e,t,o,n,r){super();this.instantiationService=e;this.productService=t;this.contextMenuService=o;this.commandService=n;this.clipboardService=r;this.dimensions=void 0;this.delayer=this._register(new rn(1e3));this.model=new Pft(this.productService)}create(e){this.createProcessTree(e),this.update()}createProcessTree(e){e.classList.add("process-explorer"),e.id="process-explorer";let t=[this.instantiationService.createInstance(Mft,this.model),new p5i,new m5i,new h5i];this.tree=this._register(this.instantiationService.createInstance(c0,"processExplorer",e,new d5i,t,new u5i,{accessibilityProvider:new g5i,identityProvider:new f5i,expandOnlyOnTwistieClick:!0,renderIndentGuides:"onHover"})),this._register(this.tree.onKeyDown(o=>this.onTreeKeyDown(o))),this._register(this.tree.onContextMenu(o=>this.onTreeContextMenu(e,o))),this.tree.setInput(this.model),this.layoutTree()}async onTreeKeyDown(e){let t=new mi(e);if(t.keyCode===35&&t.altKey){let o=this.getSelectedPids();await Promise.all(o.map(n=>this.killProcess?.(n,"SIGTERM")))}}onTreeContextMenu(e,t){if(!dle(t.element))return;let o=t.element,n=Number(o.pid),r=[];typeof this.killProcess=="function"&&(r.push(li({id:"killProcess",label:d(14461,null),run:()=>this.killProcess?.(n,"SIGTERM")})),r.push(li({id:"forceKillProcess",label:d(14460,null),run:()=>this.killProcess?.(n,"SIGKILL")})),r.push(new oi)),r.push(li({id:"copy",label:d(14457,null),run:()=>{let s=this.getSelectedPids();s?.includes(n)||(s.length=0,s.push(n));let l=s?.map(c=>Qle(e).getElementById(`pid-${c}`)).filter(c=>!!c);if(l){let c=l.map(u=>u.innerText).filter(u=>!!u);this.clipboardService.writeText(c.join(`
`))}}})),r.push(li({id:"copyAll",label:d(14458,null),run:()=>{let s=Qle(e).getElementById("process-explorer");s&&this.clipboardService.writeText(s.innerText)}})),this.isDebuggable(o.cmd)&&(r.push(new oi),r.push(li({id:"debug",label:d(14459,null),run:()=>this.attachTo(o)}))),this.contextMenuService.showContextMenu({getAnchor:()=>t.anchor,getActions:()=>r})}isDebuggable(e){if(Ft)return!1;let t=cUo.exec(e);return t&&t.groups.port!=="0"||e.indexOf("node ")>=0||e.indexOf("node.exe")>=0}attachTo(e){let t={type:"node",request:"attach",name:`process ${e.pid}`},o=cUo.exec(e.cmd);o?t.port=Number(o.groups.port):t.processId=String(e.pid),o=rAn.exec(e.cmd),o&&(t.port=Number(o.groups.port)),this.commandService.executeCommand("debug.startFromConfig",t)}getSelectedPids(){return ui(this.tree?.getSelection()?.map(e=>{if(dle(e))return e.pid})??[])}async update(){let{processes:e,pidToNames:t}=await this.resolveProcesses();this.model.update(e,t),this.tree?.updateChildren(),this.layoutTree(),this.delayer.trigger(()=>this.update())}focus(){this.tree?.domFocus()}layout(e){this.dimensions=e,this.layoutTree()}layoutTree(){this.dimensions&&this.tree&&this.tree.layout(this.dimensions.height,this.dimensions.width)}};Sye=I([m(0,F),m(1,Ze),m(2,Xe),m(3,fe),m(4,Bi)],Sye);var Pft=class{constructor(i){this.productService=i;this.processes={processRoots:[]};this.mapPidToName=new Map}update(i,e){this.mapPidToName.clear();for(let[t,o]of e)this.mapPidToName.set(t,o);i.forEach((t,o)=>{dle(t.rootProcess)&&(t.rootProcess.name=o===0?this.productService.applicationName:"remote-server")}),this.processes={processRoots:i}}getName(i,e){return this.mapPidToName.get(i)??e}};Pft=I([m(0,Ze)],Pft);var $je=class extends Sye{constructor(e,t,o,n,r,s,l,c){super(t,o,n,r,s);this.remoteAgentService=l;this.labelService=c;this.create(e)}async resolveProcesses(){let e=this.remoteAgentService.getConnection();if(!e)return{pidToNames:[],processes:[]};let t=[],o=this.labelService.getHostLabel(Q.vscodeRemote,e.remoteAuthority),n=await this.remoteAgentService.getDiagnosticInfo({includeProcesses:!0});return n&&(UW(n)?t.push({name:n.hostName,rootProcess:n}):n.processes&&t.push({name:o,rootProcess:n.processes})),{pidToNames:[],processes:t}}};$je=I([m(1,F),m(2,Ze),m(3,Xe),m(4,fe),m(5,Bi),m(6,bo),m(7,nt)],$je);var ule=class extends zs{constructor(e,t,o,n,r){super(ule.ID,e,t,o,n);this.instantiationService=r;this.processExplorerControl=void 0}static{this.ID="workbench.editor.processExplorer"}createEditor(e){this.processExplorerControl=this._register(this.instantiationService.createInstance($je,e))}focus(){this.processExplorerControl?.focus()}layout(e){this.processExplorerControl?.layout(e)}};ule=I([m(1,_e),m(2,Pe),m(3,de),m(4,F)],ule);var jje=class extends Sye{constructor(e,t,o,n,r,s,l,c){super(t,o,n,s,c);this.nativeHostService=r;this.processService=l;this.create(e)}killProcess(e,t){return this.nativeHostService.killProcess(e,t)}resolveProcesses(){return this.processService.resolveProcesses()}};jje=I([m(1,F),m(2,Ze),m(3,Xe),m(4,wo),m(5,fe),m(6,rle),m(7,Bi)],jje);var Iye=class extends ule{constructor(i,e,t,o,n){super(i,e,t,o,n)}createEditor(i){this.processExplorerControl=this._register(this.instantiationService.createInstance(jje,i))}};Iye=I([m(1,_e),m(2,Pe),m(3,de),m(4,F)],Iye);oe.as(en.EditorPane).registerEditorPane(os.create(Iye,Iye.ID,d(14469,null)),[new Vt(jV)]);var Aft=class{constructor(i,e){Xl.on("vscode:getDiagnosticInfo",(t,...o)=>{let n=o[0],r=i.getConnection();if(r){let s=e.getHostLabel(Q.vscodeRemote,r.remoteAuthority);i.getDiagnosticInfo(n.args).then(l=>{l&&(l.hostName=s,L0.latency?.high&&(l.latency={average:L0.latency.average,current:L0.latency.current})),Xl.send(n.replyChannel,l)}).catch(l=>{let c=l&&l.message?`Connection to '${s}' could not be established  ${l.message}`:`Connection to '${s}' could not be established `;Xl.send(n.replyChannel,{hostName:s,errorMessage:c})})}else Xl.send(n.replyChannel)})}};Aft=I([m(0,bo),m(1,nt)],Aft);var Nft=class extends k{constructor(i,e,t){super();let o=i.getConnection();o&&this._register(o.onDidStateChange(async n=>{if(n.type===4){let r=await e.resolveAuthority(o.remoteAuthority);r.options&&r.options.extensionHostEnv&&await t.setRemoteEnvironment(r.options.extensionHostEnv)}}))}};Nft=I([m(0,bo),m(1,dd),m(2,lt)],Nft);var Qje=class extends k{constructor(e,t){super();this.remoteAgentService=e;this.configurationService=t;this.updateRemoteTelemetryEnablement(),this._register(t.onDidChangeConfiguration(o=>{o.affectsConfiguration(dT)&&this.updateRemoteTelemetryEnablement()}))}static{this.ID="workbench.contrib.remoteTelemetryEnablementUpdater"}updateRemoteTelemetryEnablement(){return this.remoteAgentService.updateTelemetryLevel(Yy(this.configurationService))}};Qje=I([m(0,bo),m(1,B)],Qje);var Yje=class extends k{static{this.ID="workbench.contrib.remoteEmptyWorkbenchPresentation"}constructor(i,e,t,o,n){super();function r(){let g=t.getValue("workbench.startupEditor");return g!=="welcomePage"&&g!=="welcomePageInEmptyWorkbench"}function s(){return r()}let{remoteAuthority:l,filesToDiff:c,filesToMerge:u,filesToOpenOrCreate:p,filesToWait:h}=i;l&&n.getWorkbenchState()===1&&!c?.length&&!u?.length&&!p?.length&&!h&&e.resolveAuthority(l).then(()=>{r()&&o.executeCommand("workbench.view.explorer"),s()&&o.executeCommand("workbench.action.terminal.toggleTerminal")})}};Yje=I([m(0,Jr),m(1,dd),m(2,B),m(3,fe),m(4,Ae)],Yje);var Xje=class extends k{static{this.ID="workbench.contrib.wslContextKeyInitializer"}constructor(i,e,t,o){super();let n="wslFeatureInstalled",r="remote.wslFeatureInstalled",s=t.getBoolean(r,-1,void 0),c=new Y(n,!!s,d(14695,null)).bindTo(i);s===void 0&&o.when(4).then(async()=>{e.hasWSLFeatureInstalled().then(u=>{u&&(c.set(!0),t.store(r,!0,-1,1))})})}};Xje=I([m(0,X),m(1,wo),m(2,de),m(3,to)],Xje);var dUo=oe.as(Zi.Workbench);dUo.registerWorkbenchContribution(Aft,4);dUo.registerWorkbenchContribution(Nft,4);bt(Qje.ID,Qje,vt.BlockRestore);bt(Yje.ID,Yje,vt.BlockRestore);ii&&bt(Xje.ID,Xje,vt.BlockRestore);oe.as($t.Configuration).registerConfiguration({id:"remote",title:d(14691,null),type:"object",properties:{"remote.downloadExtensionsLocally":{type:"boolean",markdownDescription:d(14694,null),default:!1}}});et?xt.registerCommandAndKeybindingRule({id:F$e.ID,weight:200,primary:2093,when:W$e,metadata:{description:F$e.LABEL,args:[]},handler:F$e.handler()}):(xt.registerCommandAndKeybindingRule({id:A$e.ID,weight:200,primary:2093,when:W$e,metadata:{description:A$e.LABEL,args:[]},handler:A$e.handler()}),xt.registerCommandAndKeybindingRule({id:O$e.ID,weight:200,primary:Gi(2089,2093),when:W$e,metadata:{description:O$e.LABEL,args:[]},handler:O$e.handler()}));xt.registerCommandAndKeybindingRule({id:N$e.ID,weight:200,primary:3121,when:W$e,metadata:{description:N$e.LABEL,args:[]},handler:N$e.handler()});W(class extends z{constructor(){super({id:"workbench.remote.action.closeUnusedPorts",title:d(14692,null),category:d(14693,null),menu:[{id:R.CommandPalette}],precondition:C.and(C.notEquals(`config.${vR}`,tte),Qb)})}async run(a){let i=a.get(Wu),e=[],t=i.tunnelModel.forwarded;for(let[o,n]of t)n.hasRunningProcess===!1&&e.push(n);if(e.length)for(let o of e)await i.close({host:o.remoteHost,port:o.remotePort},"User")}});function uUo(){Wr({id:"workbench.action.terminal.newLocal",title:P(16375,"Create New Integrated Terminal (Local)"),run:async(a,i)=>{let e=i.get(fa),t=i.get(dd),o=i.get(Ix),n;try{let s=e.getLastActiveWorkspaceRoot(Q.vscodeRemote);if(s){let l=await t.getCanonicalURI(s);l.scheme===Q.file&&(n=l)}}catch{}n||(n=o.userHome);let r=await a.service.createTerminal({cwd:n});return r?(a.service.setActiveInstance(r),a.groupService.showPanel(!0)):Promise.resolve(void 0)}})}var Jje=class extends k{constructor(e,t,o,n){super();this._fileService=e;this._terminalService=t;Xl.on("vscode:openFiles",(s,...l)=>{this._onOpenFileRequest(l[0])}),this._register(n.onDidResumeOS(()=>this._onOsResume())),this._terminalService.setNativeDelegate({getWindowCount:()=>n.getWindowCount()});let r=o.getConnection();r&&r.remoteAuthority&&uUo()}_onOsResume(){for(let e of this._terminalService.instances)e.xterm?.forceRedraw()}async _onOpenFileRequest(e){if(e.termProgram==="vscode"&&e.filesToWait){let t=A.revive(e.filesToWait.waitMarkerFileUri);await this._whenFileDeleted(t),this._terminalService.activeInstance?.focus()}}_whenFileDeleted(e){return new Promise(t=>{let o=!1,n=Ly(zi(),async()=>{if(!o){o=!0;let r=await this._fileService.exists(e);o=!1,r||(n.dispose(),t(void 0))}},1e3)})}};Jje=I([m(0,ge),m(1,an),m(2,bo),m(3,wo)],Jje);var pUo="Generated",Zje=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._context=e;this._configurationService=t;this._configurationResolverService=o;this._historyService=n;this._logService=r;this._terminalProfileService=s;this._workspaceContextService=l;this._remoteAgentService=c;this._iconRegistry=Zw();this._remoteAgentService.getConnection()?this._remoteAgentService.getEnvironment().then(u=>this._primaryBackendOs=u?.os||Ao):this._primaryBackendOs=Ao,this._register(this._configurationService.onDidChangeConfiguration(u=>{(u.affectsConfiguration("terminal.integrated.defaultProfile.windows")||u.affectsConfiguration("terminal.integrated.defaultProfile.osx")||u.affectsConfiguration("terminal.integrated.defaultProfile.linux"))&&this._refreshDefaultProfileName()})),this._register(this._terminalProfileService.onDidChangeAvailableProfiles(()=>this._refreshDefaultProfileName()))}get defaultProfileName(){return this._defaultProfileName}async _refreshDefaultProfileName(){this._primaryBackendOs&&(this._defaultProfileName=(await this.getDefaultProfile({remoteAuthority:this._remoteAgentService.getConnection()?.remoteAuthority,os:this._primaryBackendOs}))?.profileName)}resolveIcon(e,t){if(e.icon){e.icon=this._getCustomIcon(e.icon)||this.getDefaultIcon();return}if(e.customPtyImplementation){e.icon=this.getDefaultIcon();return}if(e.executable)return;let o=this._getUnresolvedRealDefaultProfile(t);o&&(e.icon=o.icon),e.icon||(e.icon=this.getDefaultIcon())}getDefaultIcon(e){return this._iconRegistry.getIcon(this._configurationService.getValue("terminal.integrated.tabs.defaultIcon",{resource:e}))||L.terminal}async resolveShellLaunchConfig(e,t){let o;e.executable?o=await this._resolveProfile({path:e.executable,args:e.args,profileName:pUo,isDefault:!1},t):o=await this.getDefaultProfile(t),e.executable=o.path,e.args=o.args,o.env&&(e.env?e.env={...e.env,...o.env}:e.env=o.env);let n=e===void 0||We(e.cwd)?void 0:e.cwd;e.icon=this._getCustomIcon(e.icon)||this._getCustomIcon(o.icon)||this.getDefaultIcon(n),o.overrideName&&(e.name=o.profileName),e.color=e.color||o.color||this._configurationService.getValue("terminal.integrated.tabs.defaultColor",{resource:n}),e.useShellEnvironment===void 0&&(e.useShellEnvironment=this._configurationService.getValue("terminal.integrated.inheritEnv"))}async getDefaultShell(e){return(await this.getDefaultProfile(e)).path}async getDefaultShellArgs(e){return(await this.getDefaultProfile(e)).args||[]}async getDefaultProfile(e){return this._resolveProfile(await this._getUnresolvedDefaultProfile(e),e)}getEnvironment(e){return this._context.getEnvironment(e)}_getCustomIcon(e){if(e){if(We(e))return q.fromId(e);if(q.isThemeIcon(e))return e;if(A.isUri(e)||jm(e))return A.revive(e);if((A.isUri(e.light)||jm(e.light))&&(A.isUri(e.dark)||jm(e.dark)))return{light:A.revive(e.light),dark:A.revive(e.dark)}}}async _getUnresolvedDefaultProfile(e){if(e.allowAgentHostShell){let o=this._configurationService.getValue(`terminal.integrated.agentHostProfile.${this._getOsKey(e.os)}`);We(o)&&await this._terminalProfileService.profilesReady;let n=this._getUnresolvedAgentHostShellProfile(e);if(n)return n}if(e.allowAutomationShell){let o=this._getUnresolvedAutomationShellProfile(e);if(o)return o}await this._terminalProfileService.profilesReady;let t=this._getUnresolvedRealDefaultProfile(e.os);return t?this._setIconForAutomation(e,t):this._setIconForAutomation(e,await this._getUnresolvedFallbackDefaultProfile(e))}_setIconForAutomation(e,t){if(e.allowAutomationShell){let o=io(t);return o.icon=L.tools,o}return t}_getUnresolvedRealDefaultProfile(e){return this._terminalProfileService.getDefaultProfile(e)}async _getUnresolvedFallbackDefaultProfile(e){let t=await this._context.getDefaultSystemShell(e.remoteAuthority,e.os);if(e.os===Ao){let r=this._terminalProfileService.availableProfiles.find(s=>jj(s.path).name===jj(t).name);if(r)return e.allowAutomationShell&&(r=io(r),r.icon=L.tools),r}let o;e.os===2&&jj(t).name.match(/(zsh|bash)/)?o=["--login"]:o=[];let n=this._guessProfileIcon(t);return{profileName:pUo,path:t,args:o,icon:n,isDefault:!1}}_getUnresolvedAutomationShellProfile(e){let t=this._configurationService.getValue(`terminal.integrated.automationProfile.${this._getOsKey(e.os)}`);if(this._isValidAutomationProfile(t,e.os))return t.icon=this._getCustomIcon(t.icon)||L.tools,t}_getUnresolvedAgentHostShellProfile(e){let t=this._configurationService.getValue(`terminal.integrated.agentHostProfile.${this._getOsKey(e.os)}`);if(We(t)){let o=this._terminalProfileService.availableProfiles.find(n=>n.profileName===t&&!n.isAutoDetected);if(o){let n=io(o);return n.icon=this._getCustomIcon(n.icon)||L.tools,n}return}if(this._isValidAutomationProfile(t,e.os))return t.icon=this._getCustomIcon(t.icon)||L.tools,t}async _resolveProfile(e,t){let o=await this._context.getEnvironment(t.remoteAuthority);if(t.os===1){let s=!!o.hasOwnProperty("PROCESSOR_ARCHITEW6432"),l=o.windir;if(!s&&l){let c=td(l,"Sysnative").replace(/\//g,"\\").toLowerCase();e.path&&e.path.toLowerCase().indexOf(c)===0&&(e.path=td(l,"System32",e.path.substr(c.length+1)))}e.path&&(e.path=e.path.replace(/\//g,"\\"))}let n=this._historyService.getLastActiveWorkspaceRoot(t.remoteAuthority?Q.vscodeRemote:Q.file),r=n?this._workspaceContextService.getWorkspaceFolder(n)??void 0:void 0;return e.path=await this._resolveVariables(e.path,o,r),e.args&&(We(e.args)?e.args=await this._resolveVariables(e.args,o,r):e.args=await Promise.all(e.args.map(s=>this._resolveVariables(s,o,r)))),e}async _resolveVariables(e,t,o){try{e=await this._configurationResolverService.resolveWithEnvironment(t,o,e)}catch(n){this._logService.error("Could not resolve shell",n)}return e}_getOsKey(e){switch(e){case 3:return"linux";case 2:return"osx";case 1:return"windows"}}_guessProfileIcon(e){switch(jj(e).name){case"bash":return L.terminalBash;case"pwsh":case"powershell":return L.terminalPowershell;case"tmux":return L.terminalTmux;case"cmd":return L.terminalCmd;default:return}}_isValidAutomationProfile(e,t){return e==null||typeof e!="object"?!1:!!("path"in e&&We(e.path))}};I([Tu(200)],Zje.prototype,"_refreshDefaultProfileName",1);var sti=class extends Zje{constructor(i,e,t,o,n,r,s,l){super({getDefaultSystemShell:async(c,u)=>{let p=await n.getBackend(c);return!c||!p?u===1?"pwsh":"bash":p.getDefaultSystemShell(u)},getEnvironment:async c=>{let u=await n.getBackend(c);return!c||!u?Sp:u.getEnvironment()}},e,i,t,o,r,s,l)}};sti=I([m(0,Xp),m(1,B),m(2,fa),m(3,wa),m(4,uh),m(5,fb),m(6,Ae),m(7,bo)],sti);var e5e=class extends Zje{constructor(i,e,t,o,n,r,s,l){super({getDefaultSystemShell:async(c,u)=>{let p=await l.getBackend(c);if(!p)throw new ka(`Cannot get default system shell when there is no backend for remote authority '${c}'`);return p.getDefaultSystemShell(u)},getEnvironment:async c=>{let u=await l.getBackend(c);if(!u)throw new ka(`Cannot get environment when there is no backend for remote authority '${c}'`);return u.getEnvironment()}},e,i,t,o,r,n,s)}};e5e=I([m(0,Xp),m(1,B),m(2,fa),m(3,wa),m(4,Ae),m(5,fb),m(6,bo),m(7,uh)],e5e);var Oft=class extends zse{constructor(e,t,o){super(e,t);this._proxy=o}start(){return this._proxy.start(this.id)}detach(e){return this._proxy.detachFromProcess(this.id,e)}shutdown(e){this._proxy.shutdown(this.id,e)}async processBinary(e){if(!this._inReplay)return this._proxy.processBinary(this.id,e)}input(e){this._inReplay||this._proxy.input(this.id,e)}sendSignal(e){this._inReplay||this._proxy.sendSignal(this.id,e)}resize(e,t,o,n){this._inReplay||this._lastDimensions.cols===e&&this._lastDimensions.rows===t||(this._lastDimensions.cols=e,this._lastDimensions.rows=t,this._proxy.resize(this.id,e,t,o,n))}async clearBuffer(){this._proxy.clearBuffer?.(this.id)}freePortKillProcess(e){if(!this._proxy.freePortKillProcess)throw new Error("freePortKillProcess does not exist on the local pty service");return this._proxy.freePortKillProcess(e)}async refreshProperty(e){return this._proxy.refreshProperty(this.id,e)}async updateProperty(e,t){return this._proxy.updateProperty(this.id,e,t)}acknowledgeDataEvent(e){this._inReplay||this._proxy.acknowledgeDataEvent(this.id,e)}setUnicodeVersion(e){return this._proxy.setUnicodeVersion(this.id,e)}handleOrphanQuestion(){this._proxy.orphanQuestionReply(this.id)}};var wye=class{static{this.ID="workbench.contrib.localTerminalBackend"}constructor(i,e){let t=i.createInstance(yye);oe.as(HH.Backend).registerTerminalBackend(t),e.didRegisterBackend(t)}};wye=I([m(0,F),m(1,uh)],wye);var yye=class extends r2e{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w){super(n,o,v,c,S,e);this._lifecycleService=t;this._localPtyService=n;this._labelService=r;this._shellEnvironmentService=s;this._storageService=l;this._configurationResolverService=c;this._configurationService=u;this._productService=p;this._historyService=h;this._terminalProfileResolverService=g;this._environmentVariableService=f;this._nativeHostService=b;this._remoteAgentService=y;this._environmentService=w;this.remoteAuthority=void 0;this._ptys=new Map;this._directProxyDisposables=this._register(new ue);this._whenReady=new Mo;this._onDidRequestDetach=this._register(new T);this.onDidRequestDetach=this._onDidRequestDetach.event;this._register(this.onPtyHostRestart(()=>{this._directProxy=void 0,this._directProxyClientEventually=void 0,this._connectToDirectProxy()}))}get _proxy(){return this._directProxy||this._localPtyService}get whenReady(){return this._whenReady.p}setReady(){this._whenReady.complete()}async _connectToDirectProxy(){if(this._directProxyClientEventually){await this._directProxyClientEventually.p;return}this._logService.debug("Starting pty host");let e=new Mo;this._directProxyClientEventually=e;let t=Xd.toService(jH(this._directProxyClientEventually.p.then(o=>o.getChannel("ptyHostWindow"))));this._directProxy=t,this._directProxyDisposables.clear(),this._remoteAgentService.getConnection()?.remoteAuthority||await this._lifecycleService.when(3),Wo("code/terminal/willConnectPtyHost"),this._logService.trace("Renderer->PtyHost#connect: before acquirePort"),rz("vscode:createPtyHostMessageChannel","vscode:createPtyHostMessageChannelResult").then(o=>{Wo("code/terminal/didConnectPtyHost"),this._logService.trace("Renderer->PtyHost#connect: connection established");let n=new O;this._directProxyDisposables.value=n;let r=n.add(new fj(o,`window:${this._nativeHostService.windowId}`));e.complete(r),this._onPtyHostConnected.fire(),n.add(t.onProcessData(s=>this._ptys.get(s.id)?.handleData(s.event))),n.add(t.onDidChangeProperty(s=>this._ptys.get(s.id)?.handleDidChangeProperty(s.property))),n.add(t.onProcessExit(s=>{let l=this._ptys.get(s.id);l&&(l.handleExit(s.event),l.dispose(),this._ptys.delete(s.id))})),n.add(t.onProcessReady(s=>this._ptys.get(s.id)?.handleReady(s.event))),n.add(t.onProcessReplay(s=>this._ptys.get(s.id)?.handleReplay(s.event))),n.add(t.onProcessOrphanQuestion(s=>this._ptys.get(s.id)?.handleOrphanQuestion())),n.add(t.onDidRequestDetach(s=>this._onDidRequestDetach.fire(s))),this.getEnvironment()})}async requestDetachInstance(e,t){return this._proxy.requestDetachInstance(e,t)}async acceptDetachInstanceReply(e,t){if(!t){this._logService.warn("Cannot attach to feature terminals, custom pty terminals, or those without a persistentProcessId");return}return this._proxy.acceptDetachInstanceReply(e,t)}async persistTerminalState(){let e=Array.from(this._ptys.keys()),t=await this._proxy.serializeTerminalState(e);this._storageService.store("terminal.integrated.bufferState",t,1,1)}async updateTitle(e,t,o){await this._proxy.updateTitle(e,t,o)}async updateIcon(e,t,o,n){await this._proxy.updateIcon(e,t,o,n)}async setNextCommandId(e,t,o){await this._proxy.setNextCommandId(e,t,o)}async updateProperty(e,t,o){return this._proxy.updateProperty(e,t,o)}async createProcess(e,t,o,n,r,s,l,c){await this._connectToDirectProxy();let u=await this._shellEnvironmentService.getShellEnv(),p=await this._proxy.createProcess(e,t,o,n,r,s,u,l,c,this._getWorkspaceId(),this._getWorkspaceName()),h=new Oft(p,c,this._proxy);return this._ptys.set(p,h),h}async attachToProcess(e){await this._connectToDirectProxy();try{await this._proxy.attachToProcess(e);let t=new Oft(e,!0,this._proxy);return this._ptys.set(e,t),t}catch(t){this._logService.warn(`Couldn't attach to process ${t.message}`)}}async attachToRevivedProcess(e){await this._connectToDirectProxy();try{let t=await this._proxy.getRevivedPtyNewId(this._getWorkspaceId(),e)??e;return await this.attachToProcess(t)}catch(t){this._logService.warn(`Couldn't attach to process ${t.message}`)}}async listProcesses(){return await this._connectToDirectProxy(),this._proxy.listProcesses()}async getLatency(){let e=[],t=new On;this._directProxy&&(await this._directProxy.getLatency(),t.stop(),e.push({label:"window<->ptyhost (message port)",latency:t.elapsed()}),t.reset());let o=await this._localPtyService.getLatency();return t.stop(),e.push({label:"window<->ptyhostservice<->ptyhost",latency:t.elapsed()}),[...e,...o]}async getPerformanceMarks(){return this._proxy.getPerformanceMarks()}async reduceConnectionGraceTime(){this._proxy.reduceConnectionGraceTime()}async getDefaultSystemShell(e){return this._proxy.getDefaultSystemShell(e)}async getProfiles(e,t,o){return this._localPtyService.getProfiles(this._workspaceContextService.getWorkspace().id,e,t,o)||[]}async getEnvironment(){return this._proxy.getEnvironment()}async getShellEnvironment(){let e={...await this._shellEnvironmentService.getShellEnv()};return this._environmentService.debugExtensionHost.env&&S0e(e,this._environmentService.debugExtensionHost.env),e}async getWslPath(e,t){return this._proxy.getWslPath(e,t)}async setTerminalLayoutInfo(e){let t={workspaceId:this._getWorkspaceId(),tabs:e?e.tabs:[],background:e?e.background:null};await this._proxy.setTerminalLayoutInfo(t),this._storageService.store("terminal.integrated.layoutInfo",JSON.stringify(t),1,1)}async getTerminalLayoutInfo(){let e=this._getWorkspaceId(),t={workspaceId:e},o=this._storageService.get("terminal.integrated.bufferState",1),n=this._deserializeTerminalState(o);if(n&&n.length>0)try{let r=this._historyService.getLastActiveWorkspaceRoot(),s=r?this._workspaceContextService.getWorkspaceFolder(r)??void 0:void 0,l=Fqt(s,await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority),this._configurationResolverService);Wo("code/terminal/willGetReviveEnvironments"),await Promise.all(n.map(u=>new Promise(p=>{this._resolveEnvironmentForRevive(l,u.shellLaunchConfig).then(h=>{u.processLaunchConfig.env=h,p()})}))),Wo("code/terminal/didGetReviveEnvironments"),Wo("code/terminal/willReviveTerminalProcesses"),await this._proxy.reviveTerminalProcesses(e,n,Intl.DateTimeFormat().resolvedOptions().locale),Wo("code/terminal/didReviveTerminalProcesses"),this._storageService.remove("terminal.integrated.bufferState",1);let c=this._storageService.get("terminal.integrated.layoutInfo",1);c&&(Wo("code/terminal/willSetTerminalLayoutInfo"),await this._proxy.setTerminalLayoutInfo(JSON.parse(c)),Wo("code/terminal/didSetTerminalLayoutInfo"),this._storageService.remove("terminal.integrated.layoutInfo",1))}catch(r){this._logService.warn("LocalTerminalBackend#getTerminalLayoutInfo Error",r.message??r)}return this._proxy.getTerminalLayoutInfo(t)}async _resolveEnvironmentForRevive(e,t){let o=ii?"windows":et?"osx":"linux",n=this._configurationService.getValue(`terminal.integrated.env.${o}`),r=await(t.useShellEnvironment?this.getShellEnvironment():this.getEnvironment()),s=await Wqt(t,n,e,this._productService.version,this._configurationService.getValue("terminal.integrated.detectLocale"),r);if(Oqt(t)){let l=g6(t.cwd,this._workspaceContextService,this._historyService);await this._environmentVariableService.mergedCollection.applyToProcessEnvironment(s,{workspaceFolder:l},e)}return s}_getWorkspaceName(){return this._labelService.getWorkspaceLabel(this._workspaceContextService.getWorkspace())}installAutoReply(e,t){return this._proxy.installAutoReply(e,t)}uninstallAllAutoReplies(){return this._proxy.uninstallAllAutoReplies()}};I([bi],yye.prototype,"getEnvironment",1),I([bi],yye.prototype,"getShellEnvironment",1),yye=I([m(0,Ae),m(1,to),m(2,wa),m(3,PNt),m(4,nt),m(5,lye),m(6,de),m(7,Xp),m(8,B),m(9,Ze),m(10,fa),m(11,ig),m(12,gG),m(13,fa),m(14,wo),m(15,Fr),m(16,bo),m(17,Jr)],yye);_w(PNt,"localPty");Ce(ig,e5e,1);var aAn=oe.as(Zi.Workbench);bt(wye.ID,wye,vt.BlockStartup);aAn.registerWorkbenchContribution(Jje,3);var ati=class{constructor(i){this._theme=i,this._cache=Object.create(null),this._defaultColor="#000000";for(let e=0,t=this._theme.tokenColors.length;e<t;e++){let o=this._theme.tokenColors[e];o.scope||(this._defaultColor=o.settings.foreground)}}_generateExplanation(i,e){return`${i}: ${Ue.Format.CSS.formatHexA(e,!0).toUpperCase()}`}explainTokenColor(i,e){let t=this._findMatchingThemeRule(i);if(!t){let n=Ue.fromHex(this._defaultColor);if(!e.equals(n))throw new Error(`[${this._theme.label}]: Unexpected color ${Ue.Format.CSS.formatHexA(e)} for ${i}. Expected default ${Ue.Format.CSS.formatHexA(n)}`);return this._generateExplanation("default",e)}let o=Ue.fromHex(t.settings.foreground);if(!e.equals(o))throw new Error(`[${this._theme.label}]: Unexpected color ${Ue.Format.CSS.formatHexA(e)} for ${i}. Expected ${Ue.Format.CSS.formatHexA(o)} coming in from ${t.rawSelector}`);return this._generateExplanation(t.rawSelector,e)}_findMatchingThemeRule(i){return this._cache[i]||(this._cache[i]=uqt(this._theme,i.split(" "))),this._cache[i]}},Fft=class{constructor(i,e,t,o){this.languageService=i;this.themeService=e;this.textMateService=t;this.modelService=o}_themedTokenize(i,e){let t=vc.getColorMap(),o=null,n=[],r=0;for(let s=0,l=e.length;s<l;s++){let c=e[s],u=i.tokenizeLine2(c,o);for(let p=0,h=u.tokens.length>>>1;p<h;p++){let g=u.tokens[p<<1],f=u.tokens[(p<<1)+1],v=p+1<h?u.tokens[p+1<<1]:c.length,b=c.substring(g,v),S=Vp.getForeground(f);n[r++]={text:b,color:t[S]}}o=u.ruleStack}return n}_themedTokenizeTreeSitter(i,e){let t=vc.getColorMap(),o=Array(i.length),n=this.themeService.getColorTheme();for(let r=0,s=i.length;r<s;r++){let l=i[r],c=l.t.split(" "),u=$Ut(n,c,this.languageService.languageIdCodec.encodeLanguageId(e),!1),p=Vp.getForeground(u);o[r]={text:l.c,color:t[p]}}return o}_tokenize(i,e){let t=null,o=[],n=0;for(let r=0,s=e.length;r<s;r++){let l=e[r],c=i.tokenizeLine(l,t),u=null;for(let p=0,h=c.tokens.length;p<h;p++){let g=c.tokens[p],f=l.substring(g.startIndex,g.endIndex),v=g.scopes.join(" ");u===v?o[n-1].c+=f:(u=v,o[n++]={c:f,t:v,r:{dark_plus:void 0,light_plus:void 0,dark_vs:void 0,light_vs:void 0,hc_black:void 0}})}t=c.ruleStack}return o}async _getThemesResult(i,e){let t=this.themeService.getColorTheme(),o=l=>{let c="vscode-theme-defaults-themes-",u=l.indexOf(c);if(u!==-1)return l.substring(u+c.length,l.length-5)},n={},s=(await this.themeService.getColorThemes()).filter(l=>!!o(l.id));for(let l of s){let c=l.id;if(await this.themeService.setColorTheme(c,void 0)){let p=o(c);n[p]={document:new ati(this.themeService.getColorTheme()),tokens:this._themedTokenize(i,e)}}}return await this.themeService.setColorTheme(t.id,void 0),n}async _getTreeSitterThemesResult(i,e){let t=this.themeService.getColorTheme(),o=l=>{let c="vscode-theme-defaults-themes-",u=l.indexOf(c);if(u!==-1)return l.substring(u+c.length,l.length-5)},n={},s=(await this.themeService.getColorThemes()).filter(l=>!!o(l.id));for(let l of s){let c=l.id;if(await this.themeService.setColorTheme(c,void 0)){let p=o(c);n[p]={document:new ati(this.themeService.getColorTheme()),tokens:this._themedTokenizeTreeSitter(i,e)}}}return await this.themeService.setColorTheme(t.id,void 0),n}_enrichResult(i,e){let t={},o=Object.keys(e);for(let n of o)t[n]=0;for(let n=0,r=i.length;n<r;n++){let s=i[n];for(let l of o){let c=e[l].tokens[t[l]];c.text=c.text.substr(s.c.length),c.color&&(s.r[l]=e[l].document.explainTokenColor(s.t,c.color)),c.text.length===0&&t[l]++}}}_moveInjectionCursorToRange(i,e){let t=i.gotoFirstChild();for(;(i.startIndex<e.startIndex||i.endIndex>e.endIndex)&&t;)i.endIndex<e.startIndex?t=i.gotoNextSibling():t=i.gotoFirstChild()}async _treeSitterTokenize(i,e,t){let o=await yh(i.tree);if(!o)return[];let n=o.walk();n.gotoFirstChild();let r=!0,s=[],l=[{cursor:n,languageId:t,startOffset:0,endOffset:i.textModel.getValueLength()}];do{let c=l[l.length-1],u=c.cursor,p=c.languageId,h=u.currentNode.endIndex>c.endOffset;if(!h&&u.currentNode.childCount===0){let g=new G(u.currentNode.startPosition.row+1,u.currentNode.startPosition.column+1,u.currentNode.endPosition.row+1,u.currentNode.endPosition.column+1),f=i.getInjectionTrees(u.currentNode.startIndex,p),v=f?.ranges.find(y=>y.startIndex<=u.currentNode.startIndex&&y.endIndex>=u.currentNode.endIndex),b=f?.tree.get(),S=f?.languageId;if(b&&S&&v&&v.startIndex===u.currentNode.startIndex){let y=b.walk();for(this._moveInjectionCursorToRange(y,v),l.push({cursor:y,languageId:S,startOffset:v.startIndex,endOffset:v.endIndex});u.endIndex<=v.endIndex&&(u.gotoNextSibling()||u.gotoParent()););}else{let y=e.captureAtRangeTree(g);for(s.push({c:u.currentNode.text.replace(/\r/g,""),t:y?.map(w=>w.name).join(" ")??"",r:{dark_plus:void 0,light_plus:void 0,dark_vs:void 0,light_vs:void 0,hc_black:void 0}});!(r=u.gotoNextSibling())&&(r=u.gotoParent()););}}else r=u.gotoFirstChild();l.length>1&&(!r&&u===l[l.length-1].cursor||h)&&(c.cursor.delete(),l.pop(),r=!0)}while(r);return n.delete(),s}captureSyntaxTokens(i,e){let t=this.languageService.guessLanguageIdByFilepathOrFirstLine(A.file(i));return this.textMateService.createTokenizer(t).then(o=>{if(!o)return[];let n=Hc(e),r=this._tokenize(o,n);return this._getThemesResult(o,n).then(s=>(this._enrichResult(r,s),r.filter(l=>l.c.length>0)))})}async captureTreeSitterSyntaxTokens(i,e){let t=this.languageService.guessLanguageIdByFilepathOrFirstLine(i);if(!t)return[];let n=(this.modelService.getModel(i)??this.modelService.createModel(e,{languageId:t,onDidChange:U.None},i)).tokenization.tokens.get();if(!(n instanceof wK))return[];let r=n.tree,s=n.tokenizationImpl,l=r.get()??await yh(r),c=s.get()??await yh(s);if(!l)return[];let u=(await this._treeSitterTokenize(l,c,t)).filter(h=>h.c.length>0),p=await this._getTreeSitterThemesResult(u,t);return this._enrichResult(u,p),u}};Fft=I([m(0,Rt),m(1,ep),m(2,pQ),m(3,_t)],Fft);async function mUo(a,i,e=!1){let t=o=>{let n=a.get(ge),r=Be(o),s=a.get(F).createInstance(Fft);return n.readFile(o).then(l=>e?s.captureTreeSitterSyntaxTokens(o,l.value.toString()):s.captureSyntaxTokens(r,l.value.toString()))};if(i)return await t(i);{let o=a.get(ie),n=o.activeEditor?po.getCanonicalUri(o.activeEditor,{filterByScheme:Q.file}):null;n?t(n).then(r=>{console.log(r)}):console.log("No file editor active")}}Ge.registerCommand("_workbench.captureSyntaxTokens",function(a,i){return mUo(a,i)});Ge.registerCommand("_workbench.captureTreeSitterSyntaxTokens",function(a,i){return i||(i=a.get(ie).activeEditor?.resource),mUo(a,i,!0)});var lAn=oe.as($t.Configuration);lAn.registerConfiguration({properties:{"window.systemColorTheme":{type:"string",enum:["default","auto","light","dark"],enumDescriptions:[d(19517,null),d(19515,null),d(19518,null),d(19516,null)],markdownDescription:d(19514,null,GN("workbench.colorTheme"),GN("window.autoDetectColorScheme")),default:"default",included:!Sn,scope:1,tags:[eQ]}}});var t5e=class extends k{static{this.ID="workbench.contrib.userDataSyncServices"}constructor(i,e){super(),e.registerChannel("userDataSyncUtil",Xd.fromService(i,this._store))}};t5e=I([m(0,iie),m(1,kS)],t5e);bt(t5e.ID,t5e,vt.BlockStartup);W(class extends z{constructor(){super({id:"workbench.userData.actions.openSyncBackupsFolder",title:P(17791,"Open Local Backups Folder"),category:ug,menu:{id:R.CommandPalette,when:bw.notEqualsTo("uninitialized")}})}async run(i){let e=i.get(ko).userDataSyncHome,t=i.get(wo),o=i.get(ge),n=i.get(Ne);if(await o.exists(e)){let r=await o.resolve(e),s=r.children&&r.children[0]?r.children[0].resource:e;return t.showItemInFolder(s.with({scheme:Q.file}).fsPath)}else n.info(d(17789,null))}});W(class extends z{constructor(){super(z1t)}async run(i){let e=i.get(ry),t=i.get(Ne),o=i.get(wo),n=await e.downloadSyncActivity();n&&t.prompt(ft.Info,d(17788,null),[{label:d(17790,null),run:()=>o.showItemInFolder(n.fsPath)}])}});async function hUo(a,i=!1){return zVo(a,i,bB)}var ple=class{constructor(i,e,t,o,n,r,s,l,c){this.fileService=i;this.contextService=e;this.telemetryService=t;this.requestService=o;this.textFileService=n;this.workspaceTagsService=r;this.diagnosticsService=s;this.productService=l;this.nativeHostService=c;this.telemetryService.telemetryLevel===3&&this.report()}async report(){this.reportWindowsEdition(),this.workspaceTagsService.getTags().then(i=>this.reportWorkspaceTags(i),i=>mt(i)),this.reportCloudStats(),this.reportProxyStats(),this.getWorkspaceInformation().then(i=>this.diagnosticsService.reportWorkspaceStats(i))}async reportWindowsEdition(){if(!ii)return;let i=await this.nativeHostService.windowsGetStringRegKey("HKEY_LOCAL_MACHINE","SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion","EditionID");i===void 0&&(i="Unknown"),this.telemetryService.publicLog2("windowsEdition",{edition:i})}async getWorkspaceInformation(){let i=this.contextService.getWorkspace(),e=this.contextService.getWorkbenchState(),t=await this.workspaceTagsService.getTelemetryWorkspaceId(i,e);return{id:i.id,telemetryId:t,rendererSessionId:this.telemetryService.sessionId,folders:i.folders,transient:i.transient,configuration:i.configuration}}reportWorkspaceTags(i){this.telemetryService.publicLog("workspce.tags",i)}reportRemoteDomains(i){Promise.all(i.map(e=>{let t=e.path,o=e.with({path:`${t!=="/"?t:""}/.git/config`});return this.fileService.exists(o).then(n=>n?this.textFileService.read(o,{acceptTextOnly:!0}).then(r=>HVo(r.value,BVo),r=>[]):[])})).then(e=>{let t=e.reduce((n,r)=>r.reduce((s,l)=>s.add(l),n),new Set),o=[];t.forEach(n=>o.push(n)),this.telemetryService.publicLog("workspace.remotes",{domains:o.sort()})},mt)}reportRemotes(i){Promise.all(i.map(e=>this.workspaceTagsService.getHashedRemotesFromUri(e,!0))).then(()=>{},mt)}reportAzureNode(i,e){let t=i.map(o=>{let n=o.path;return o.with({path:`${n!=="/"?n:""}/node_modules`})});return this.fileService.resolveAll(t.map(o=>({resource:o}))).then(o=>{let n=[].concat(...o.map(s=>s.success?s.stat.children||[]:[])).map(s=>s.name);return ple.searchArray(n,/azure/i)&&(e.node=!0),e},o=>e)}static searchArray(i,e){return i.some(t=>t.search(e)>-1)||void 0}reportAzureJava(i,e){return Promise.all(i.map(t=>{let o=t.path,n=t.with({path:`${o!=="/"?o:""}/pom.xml`});return this.fileService.exists(n).then(r=>r?this.textFileService.read(n,{acceptTextOnly:!0}).then(s=>!!s.value.match(/azure/i),s=>!1):!1)})).then(t=>(t.indexOf(!0)!==-1&&(e.java=!0),e))}reportAzure(i){let e=Object.create(null);this.reportAzureNode(i,e).then(t=>this.reportAzureJava(i,t)).then(t=>{Object.keys(t).length&&this.telemetryService.publicLog("workspace.azure",t)}).then(void 0,mt)}reportCloudStats(){let i=this.contextService.getWorkspace().folders.map(e=>e.uri);i.length&&this.fileService&&(this.reportRemoteDomains(i),this.reportRemotes(i),this.reportAzure(i))}reportProxyStats(){let i=this.productService.downloadUrl;i&&this.requestService.resolveProxy(i).then(e=>{let t=e?String(e).trim().split(/\s+/,1)[0]:"EMPTY";["DIRECT","PROXY","HTTPS","SOCKS","EMPTY"].indexOf(t)===-1&&(t="UNKNOWN")}).then(void 0,mt)}};ple=I([m(0,ge),m(1,Ae),m(2,_e),m(3,Ra),m(4,Uo),m(5,yqe),m(6,PAe),m(7,Ze),m(8,wo)],ple);var gUo=/group\s*:\s*[\'\"](.*?)[\'\"]\s*,\s*name\s*:\s*[\'\"](.*?)[\'\"]\s*,\s*version\s*:\s*[\'\"](.*?)[\'\"]/g,fUo=/[\'\"]([^\'\"\s]*?)\:([^\'\"\s]*?)\:([^\'\"\s]*?)[\'\"]/g,vUo=/<dependencies>([\s\S]*?)<\/dependencies>/g,bUo=/<dependency>([\s\S]*?)<\/dependency>/g,SUo=/<groupId>([\s\S]*?)<\/groupId>/,IUo=/<artifactId>([\s\S]*?)<\/artifactId>/,yUo=[{predicate:(a,i)=>a==="com.microsoft.azure"&&i==="azure",tag:"azure"},{predicate:(a,i)=>a==="com.microsoft.azure"&&i.startsWith("azure-mgmt-"),tag:"azure"},{predicate:(a,i)=>a.startsWith("com.microsoft.azure")&&i.startsWith("azure-mgmt-"),tag:"azure"},{predicate:(a,i)=>a==="com.azure.resourcemanager"&&i.startsWith("azure-resourcemanager"),tag:"azure"},{predicate:(a,i)=>a==="javax"&&i==="javaee-api",tag:"javaee"},{predicate:(a,i)=>a==="javax.xml.bind"&&i==="jaxb-api",tag:"javaee"},{predicate:(a,i)=>a==="mysql"&&i==="mysql-connector-java",tag:"jdbc"},{predicate:(a,i)=>a==="com.microsoft.sqlserver"&&i==="mssql-jdbc",tag:"jdbc"},{predicate:(a,i)=>a==="com.oracle.database.jdbc"&&i.startsWith("ojdbc"),tag:"jdbc"},{predicate:(a,i)=>a==="org.hibernate",tag:"jpa"},{predicate:(a,i)=>a==="org.eclipse.persistence"&&i==="eclipselink",tag:"jpa"},{predicate:(a,i)=>a==="org.projectlombok",tag:"lombok"},{predicate:(a,i)=>a==="org.springframework.data"&&i==="spring-data-redis",tag:"redis"},{predicate:(a,i)=>a==="redis.clients"&&i==="jedis",tag:"redis"},{predicate:(a,i)=>a==="org.redisson",tag:"redis"},{predicate:(a,i)=>a==="io.lettuce"&&i==="lettuce-core",tag:"redis"},{predicate:(a,i)=>a==="org.springframework.boot",tag:"springboot"},{predicate:(a,i)=>a==="org.jooq",tag:"sql"},{predicate:(a,i)=>a==="org.mybatis",tag:"sql"},{predicate:(a,i)=>a==="org.junit.jupiter"&&i==="junit-jupiter-api",tag:"unitTest"},{predicate:(a,i)=>a==="junit"&&i==="junit",tag:"unitTest"},{predicate:(a,i)=>a==="org.testng"&&i==="testng",tag:"unitTest"},{predicate:(a,i)=>a==="com.azure"&&i.includes("cosmos"),tag:"azure-cosmos"},{predicate:(a,i)=>a==="com.azure.spring"&&i.includes("cosmos"),tag:"azure-cosmos"},{predicate:(a,i)=>a==="com.azure"&&i.includes("azure-storage"),tag:"azure-storage"},{predicate:(a,i)=>a==="com.azure.spring"&&i.includes("storage"),tag:"azure-storage"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-messaging-servicebus",tag:"azure-servicebus"},{predicate:(a,i)=>a==="com.azure.spring"&&i.includes("servicebus"),tag:"azure-servicebus"},{predicate:(a,i)=>a==="com.azure"&&i.startsWith("azure-messaging-eventhubs"),tag:"azure-eventhubs"},{predicate:(a,i)=>a==="com.azure.spring"&&i.includes("eventhubs"),tag:"azure-eventhubs"},{predicate:(a,i)=>a==="dev.langchain4j",tag:"langchain4j"},{predicate:(a,i)=>a==="io.springboot.ai",tag:"springboot-ai"},{predicate:(a,i)=>a==="com.microsoft.semantic-kernel",tag:"semantic-kernel"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-anomalydetector",tag:"azure-ai-anomalydetector"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-formrecognizer",tag:"azure-ai-formrecognizer"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-documentintelligence",tag:"azure-ai-documentintelligence"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-translation-document",tag:"azure-ai-translation-document"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-personalizer",tag:"azure-ai-personalizer"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-translation-text",tag:"azure-ai-translation-text"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-contentsafety",tag:"azure-ai-contentsafety"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-vision-imageanalysis",tag:"azure-ai-vision-imageanalysis"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-textanalytics",tag:"azure-ai-textanalytics"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-search-documents",tag:"azure-search-documents"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-documenttranslator",tag:"azure-ai-documenttranslator"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-vision-face",tag:"azure-ai-vision-face"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-openai-assistants",tag:"azure-ai-openai-assistants"},{predicate:(a,i)=>a==="com.microsoft.azure.cognitiveservices",tag:"azure-cognitiveservices"},{predicate:(a,i)=>a==="com.microsoft.cognitiveservices.speech",tag:"azure-cognitiveservices-speech"},{predicate:(a,i)=>a==="com.theokanning.openai-gpt3-java",tag:"openai"},{predicate:(a,i)=>a==="com.azure"&&i==="azure-ai-openai",tag:"azure-openai"},{predicate:(a,i)=>a==="com.microsoft.azure.functions"&&i==="azure-functions-java-library",tag:"azure-functions"},{predicate:(a,i)=>a==="io.quarkus",tag:"quarkus"},{predicate:(a,i)=>a.startsWith("org.eclipse.microprofile"),tag:"microprofile"},{predicate:(a,i)=>a==="io.micronaut",tag:"micronaut"},{predicate:(a,i)=>a.startsWith("org.graalvm"),tag:"graalvm"}];var cAn=["@azure","@azure/ai","@azure/core","@azure/cosmos","@azure/event","@azure/identity","@azure/keyvault","@azure/search","@azure/storage"],dAn=["@types/vscode","@vscode/dts","@types/node","@types/bun","bun-types","@types/web","express","sails","koa","hapi","socket.io","restify","next","nuxt","@nestjs/core","strapi","gatsby","fastify","hono","react","react-native","react-native-macos","react-native-windows","rnpm-plugin-windows","@types/react","@angular/core","@ionic","vue","tns-core-modules","@nativescript/core","electron","@remix-run/react","@remix-run/express","@remix-run/node","@remix-run/dev","@sveltejs/kit","preact","@preact/signals","@builder.io/qwik","alpinejs","astro","htmx.org","solid-js","svelte","lit-html","vuepress","aws-sdk","aws-amplify","azure","azure-storage","chroma","deepseek-js","docusaurus","faiss","firebase","@google-cloud/common","heroku-cli","langchain","milvus","openai","pinecone","praisonai","qdrant","typescript","@typescript/native-preview","tslib","eslint","oxlint","oxfmt","typescript-eslint","prettier","dprint","@dprint/formatter","@babel/cli","@babel/core","@swc/cli","@swc/core","vite","esbuild","rollup","rolldown","nx","turbo","webpack","parcel","@biomejs/biome","@rspack/core","@rspack/cli","@trpc/client","@trpc/server","zod","pyright","ts-morph","oxc-minify","oxc-transform","oxc-resolver","vue-tsc","svelte-check","tsup","tsdown","@microsoft/teams-js","@microsoft/office-js","@microsoft/office-js-helpers","@types/office-js","@types/office-runtime","office-ui-fabric-react","@uifabric/icons","@uifabric/merge-styles","@uifabric/styling","@uifabric/experiments","@uifabric/utilities","@microsoft/rush","lerna","just-task","beachball","playwright","playwright-cli","@playwright/test","playwright-core","playwright-chromium","playwright-firefox","playwright-webkit","chai","cypress","gherkin","jest","mocha","nightwatch","protractor","puppeteer","selenium-webdriver","vitest","webdriverio","@azure/app-configuration","@azure/cosmos-sign","@azure/cosmos-language-service","@azure/synapse-spark","@azure/synapse-monitoring","@azure/synapse-managed-private-endpoints","@azure/synapse-artifacts","@azure/synapse-access-control","@azure/ai-metrics-advisor","@azure/service-bus","@azure/keyvault-secrets","@azure/keyvault-keys","@azure/keyvault-certificates","@azure/keyvault-admin","@azure/digital-twins-core","@azure/cognitiveservices-anomalydetector","@azure/ai-anomaly-detector","@azure/core-xml","@azure/core-tracing","@azure/core-paging","@azure/core-https","@azure/core-client","@azure/core-asynciterator-polyfill","@azure/core-arm","@azure/amqp-common","@azure/core-lro","@azure/logger","@azure/core-http","@azure/core-auth","@azure/core-amqp","@azure/abort-controller","@azure/eventgrid","@azure/storage-file-datalake","@azure/search-documents","@azure/storage-file","@azure/storage-datalake","@azure/storage-queue","@azure/storage-file-share","@azure/storage-blob-changefeed","@azure/storage-blob","@azure/cognitiveservices-formrecognizer","@azure/ai-form-recognizer","@azure/cognitiveservices-textanalytics","@azure/ai-text-analytics","@azure/event-processor-host","@azure/schema-registry-avro","@azure/schema-registry","@azure/eventhubs-checkpointstore-blob","@azure/event-hubs","@azure/communication-signaling","@azure/communication-calling","@azure/communication-sms","@azure/communication-common","@azure/communication-chat","@azure/communication-administration","@azure/attestation","@azure/data-tables","@azure/arm-appservice","@azure-rest/ai-inference","@azure-rest/arm-appservice","@azure/arm-appcontainers","@azure/arm-rediscache","@azure/arm-redisenterprisecache","@azure/arm-apimanagement","@azure/arm-logic","@azure/app-configuration","@azure/arm-appconfiguration","@azure/arm-dashboard","@azure/arm-signalr","@azure/arm-securitydevops","@azure/arm-labservices","@azure/web-pubsub","@azure/web-pubsub-client","@azure/web-pubsub-client-protobuf","@azure/web-pubsub-express","@azure/openai","@azure/arm-hybridkubernetes","@azure/arm-kubernetesconfiguration","ai","@anthropic-ai/sdk","@anthropic-ai/tokenizer","@arizeai/openinference-instrumentation-langchain","@arizeai/openinference-instrumentation-openai","@aws-sdk-client-bedrock-runtime","@aws-sdk/client-bedrock","@datastax/astra-db-ts","fireworks-js","@google-cloud/aiplatform","@huggingface/inference","humanloop","@langchain/anthropic","langsmith","llamaindex","@google-cloud/aiplatform","@mistralai/mistralai","mongodb","neo4j-driver","ollama","onnxruntime-node","onnxruntime-web","pg","postgresql","redis","@supabase/supabase-js","@tensorflow/tfjs","@xenova/transformers","tika","weaviate-client","@zilliz/milvus2-sdk-node","@azure-rest/ai-anomaly-detector","@azure-rest/ai-content-safety","@azure-rest/ai-document-intelligence","@azure-rest/ai-document-translator","@azure-rest/ai-personalizer","@azure-rest/ai-translation-text","@azure-rest/ai-vision-image-analysis","@azure/ai-anomaly-detector","@azure/ai-form-recognizer","@azure/ai-language-conversations","@azure/ai-language-text","@azure/ai-text-analytics","@azure/arm-botservice","@azure/arm-cognitiveservices","@azure/arm-machinelearning","@azure/cognitiveservices-contentmoderator","@azure/cognitiveservices-customvision-prediction","@azure/cognitiveservices-customvision-training","@azure/cognitiveservices-face","@azure/cognitiveservices-translatortext","microsoft-cognitiveservices-speech-sdk","@google/generative-ai"],uAn=["azure-ai","azure-cognitiveservices","azure-core","azure-cosmos","azure-event","azure-identity","azure-keyvault","azure-mgmt","azure-ml","azure-search","azure-storage"],pAn=["azure","azure-ai-agents","azure-ai-inference","azure-ai-language-conversations","azure-ai-language-questionanswering","azure-ai-ml","azure-ai-projects","azure-ai-translation-document","azure-appconfiguration","azure-appconfiguration-provider","azure-loganalytics","azure-synapse-nspkg","azure-synapse-spark","azure-synapse-artifacts","azure-synapse-accesscontrol","azure-synapse","azure-cognitiveservices-vision-nspkg","azure-cognitiveservices-search-nspkg","azure-cognitiveservices-nspkg","azure-cognitiveservices-language-nspkg","azure-cognitiveservices-knowledge-nspkg","azure-containerregistry","azure-communication-identity","azure-communication-phonenumbers","azure-communication-email","azure-communication-rooms","azure-communication-callautomation","azure-confidentialledger","azure-containerregistry","azure-developer-loadtesting","azure-iot-deviceupdate","azure-messaging-webpubsubservice","azure-monitor","azure-monitor-query","azure-monitor-ingestion","azure-mgmt-appcontainers","azure-mgmt-apimanagement","azure-mgmt-web","azure-mgmt-redis","azure-mgmt-redisenterprise","azure-mgmt-logic","azure-appconfiguration","azure-appconfiguration-provider","azure-mgmt-appconfiguration","azure-mgmt-dashboard","azure-mgmt-signalr","azure-messaging-webpubsubservice","azure-mgmt-webpubsub","azure-mgmt-securitydevops","azure-mgmt-labservices","azure-ai-metricsadvisor","azure-servicebus","azureml-sdk","azure-keyvault-nspkg","azure-keyvault-secrets","azure-keyvault-keys","azure-keyvault-certificates","azure-keyvault-administration","azure-digitaltwins-nspkg","azure-digitaltwins-core","azure-cognitiveservices-anomalydetector","azure-ai-anomalydetector","azure-applicationinsights","azure-core-tracing-opentelemetry","azure-core-tracing-opencensus","azure-nspkg","azure-common","azure-eventgrid","azure-storage-file-datalake","azure-search-nspkg","azure-search-documents","azure-storage-nspkg","azure-storage-file","azure-storage-common","azure-storage-queue","azure-storage-file-share","azure-storage-blob-changefeed","azure-storage-blob","azure-cognitiveservices-formrecognizer","azure-ai-formrecognizer","azure-ai-nspkg","azure-cognitiveservices-language-textanalytics","azure-ai-textanalytics","azure-schemaregistry-avroencoder","azure-schemaregistry-avroserializer","azure-schemaregistry","azure-eventhub-checkpointstoreblob-aio","azure-eventhub-checkpointstoreblob","azure-eventhub","azure-servicefabric","azure-communication-nspkg","azure-communication-sms","azure-communication-chat","azure-communication-administration","azure-security-attestation","azure-data-nspkg","azure-data-tables","azure-devtools","azure-elasticluster","azure-functions","azure-graphrbac","azure-iothub-device-client","azure-shell","azure-translator","azure-mgmt-hybridkubernetes","azure-mgmt-kubernetesconfiguration","a2a-sdk","adal","agents","pydocumentdb","botbuilder-core","botbuilder-schema","botframework-connector","codegen","deepseek","fabric-data-agent-sdk","google-adk","playwright","praisonai","pydantic-ai","python-rai","transformers","langchain","llama-index","google-cloud-aiplatform","guidance","openai","semantic-kernel","sentence-transformers","smolagents","stripe-agent-toolkit","anthropic","aporia","arize","deepchecks","fireworks-ai","langchain-fireworks","humanloop","pymongo","langchain-anthropic","langchain-huggingface","langchain-fireworks","ollama","onnxruntime","pgvector","sentence-transformers","tika","trulens","trulens-eval","wandb","azure-ai-contentsafety","azure-ai-documentintelligence","azure-ai-translation-text","azure-ai-vision","azure-cognitiveservices-language-luis","azure-cognitiveservices-speech","azure-cognitiveservices-vision-contentmoderator","azure-cognitiveservices-vision-face","azure-mgmt-cognitiveservices","azure-mgmt-search","google-generativeai"],mAn=["github.com/Azure/azure-sdk-for-go/sdk/storage/azblob","github.com/Azure/azure-sdk-for-go/sdk/storage/azfile","github.com/Azure/azure-sdk-for-go/sdk/storage/azqueue","github.com/Azure/azure-sdk-for-go/sdk/storage/azdatalake","github.com/Azure/azure-sdk-for-go/sdk/tracing/azotel","github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azadmin","github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azcertificates","github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys","github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets","github.com/Azure/azure-sdk-for-go/sdk/monitor/azquery","github.com/Azure/azure-sdk-for-go/sdk/monitor/azingest","github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs","github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus","github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig","github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos","github.com/Azure/azure-sdk-for-go/sdk/data/aztables","github.com/Azure/azure-sdk-for-go/sdk/containers/azcontainerregistry","github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai","github.com/Azure/azure-sdk-for-go/sdk/azidentity","github.com/Azure/azure-sdk-for-go/sdk/azcore","github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/"],Wft=class{constructor(i,e,t,o){this.fileService=i;this.contextService=e;this.environmentService=t;this.textFileService=o}async getTags(){return this._tags||(this._tags=await this.resolveWorkspaceTags()),this._tags}async getTelemetryWorkspaceId(i,e){function t(n){return bB(n.scheme===Q.file?n.fsPath:n.toString())}let o;switch(e){case 1:o=void 0;break;case 2:o=await t(i.folders[0].uri);break;case 3:i.configuration&&(o=await t(i.configuration))}return o}getHashedRemotesFromUri(i,e=!1){let t=i.path,o=i.with({path:`${t!=="/"?t:""}/.git/config`});return this.fileService.exists(o).then(n=>n?this.textFileService.read(o,{acceptTextOnly:!0}).then(r=>hUo(r.value,e),r=>[]):[])}async resolveWorkspaceTags(){let i=Object.create(null),e=this.contextService.getWorkbenchState(),t=this.contextService.getWorkspace();i["workspace.id"]=await this.getTelemetryWorkspaceId(t,e);let{filesToOpenOrCreate:o,filesToDiff:n,filesToMerge:r}=this.environmentService;i["workbench.filesToOpenOrCreate"]=o&&o.length||0,i["workbench.filesToDiff"]=n&&n.length||0,i["workbench.filesToMerge"]=r&&r.length||0;let s=e===1;i["workspace.roots"]=s?0:t.folders.length,i["workspace.empty"]=s;let l=s?void 0:t.folders.map(u=>u.uri);if(!l||!l.length)return Promise.resolve(i);let c=A.joinPath(this.environmentService.workspaceStorageHome,"aiGeneratedWorkspaces.json");return await this.fileService.exists(c).then(async u=>{if(u)try{let p=await this.fileService.readFile(c);JSON.parse(p.value.toString()).indexOf(t.folders[0].uri.toString())>-1&&(i.aiGenerated=!0)}catch{}}),this.fileService.resolveAll(l.map(u=>({resource:u}))).then(u=>{let p=[].concat(...u.map(ce=>ce.success?ce.stat.children||[]:[])).map(ce=>ce.name),h=p.reduce((ce,Se)=>ce.add(Se.toLowerCase()),new Set);i["workspace.grunt"]=h.has("gruntfile.js"),i["workspace.gulp"]=h.has("gulpfile.js"),i["workspace.jake"]=h.has("jakefile.js"),i["workspace.tsconfig"]=h.has("tsconfig.json"),i["workspace.jsconfig"]=h.has("jsconfig.json"),i["workspace.config.xml"]=h.has("config.xml"),i["workspace.vsc.extension"]=h.has("vsc-extension-quickstart.md"),i["workspace.ASP5"]=h.has("project.json")&&this.searchArray(p,/^.+\.cs$/i),i["workspace.sln"]=this.searchArray(p,/^.+\.sln$|^.+\.csproj$/i),i["workspace.unity"]=h.has("assets")&&h.has("library")&&h.has("projectsettings"),i["workspace.npm"]=h.has("package.json")||h.has("node_modules"),i["workspace.bower"]=h.has("bower.json")||h.has("bower_components"),i["workspace.azure.yaml"]=h.has("azure.yaml")||h.has("azure.yml"),i["workspace.java.pom"]=h.has("pom.xml"),i["workspace.java.gradle"]=h.has("build.gradle")||h.has("settings.gradle")||h.has("build.gradle.kts")||h.has("settings.gradle.kts")||h.has("gradlew")||h.has("gradlew.bat"),i["workspace.yeoman.code.ext"]=h.has("vsc-extension-quickstart.md"),i["workspace.py.requirements"]=h.has("requirements.txt"),i["workspace.py.requirements.star"]=this.searchArray(p,/^(.*)requirements(.*)\.txt$/i),i["workspace.py.Pipfile"]=h.has("pipfile"),i["workspace.py.conda"]=this.searchArray(p,/^environment(\.yml$|\.yaml$)/i),i["workspace.py.setup"]=h.has("setup.py"),i["workspace.py.manage"]=h.has("manage.py"),i["workspace.py.setupcfg"]=h.has("setup.cfg"),i["workspace.py.app"]=h.has("app.py"),i["workspace.py.pyproject"]=h.has("pyproject.toml"),i["workspace.go.mod"]=h.has("go.mod");let g=h.has("mainactivity.cs")||h.has("mainactivity.fs"),f=h.has("appdelegate.cs")||h.has("appdelegate.fs"),v=h.has("androidmanifest.xml"),b=h.has("platforms"),S=h.has("plugins"),y=h.has("www"),w=h.has("properties"),x=h.has("resources"),E=h.has("jni");i["workspace.config.xml"]&&!i["workspace.language.cs"]&&!i["workspace.language.vb"]&&!i["workspace.language.aspx"]&&(b&&S&&y?i["workspace.cordova.high"]=!0:i["workspace.cordova.low"]=!0),i["workspace.config.xml"]&&!i["workspace.language.cs"]&&!i["workspace.language.vb"]&&!i["workspace.language.aspx"]&&h.has("ionic.config.json")&&(i["workspace.ionic"]=!0),g&&w&&x&&(i["workspace.xamarin.android"]=!0),f&&x&&(i["workspace.xamarin.ios"]=!0),v&&E&&(i["workspace.android.cpp"]=!0);function M(ce,Se,Re,xe){return h.has(ce)?l.map(He=>{let Ee=He.with({path:`${He.path!=="/"?He.path:""}/${ce}`});return Se.exists(Ee).then(Te=>{if(Te)return Re.read(Ee,{acceptTextOnly:!0}).then(xe)},Te=>{})}):[]}function N(ce){pAn.indexOf(ce)>-1&&(i["workspace.py."+ce]=!0);for(let Se of uAn)ce.startsWith(Se)&&(i["workspace.py."+Se]=!0);i["workspace.py.any-azure"]||(i["workspace.py.any-azure"]=/azure/i.test(ce))}let V=M("requirements.txt",this.fileService,this.textFileService,ce=>{let Se=Hc(ce.value);for(let Re of Se){let xe=Re.split("=="),He=Re.split(">="),Ee=(xe.length===2?xe[0]:He[0]).trim();N(Ee)}}),H=M("pipfile",this.fileService,this.textFileService,ce=>{let Se=Hc(ce.value);Se=Se.slice(Se.indexOf("[packages]")+1);for(let Re of Se){if(Re.trim().indexOf("[")>-1)break;if(Re.indexOf("=")===-1)continue;let xe=Re.split("=")[0].trim();N(xe)}}),K=M("package.json",this.fileService,this.textFileService,ce=>{try{let Se=JSON.parse(ce.value),Re=Object.keys(Se.dependencies||{}).concat(Object.keys(Se.devDependencies||{}));for(let xe of Re)if(xe.startsWith("react-native"))i["workspace.reactNative"]=!0;else if(xe==="tns-core-modules"||xe==="@nativescript/core")i["workspace.nativescript"]=!0;else if(dAn.indexOf(xe)>-1)i["workspace.npm."+xe]=!0;else for(let He of cAn)xe.startsWith(He)&&(i["workspace.npm."+He]=!0)}catch{}}),j=M("go.mod",this.fileService,this.textFileService,ce=>{try{let Se=Hc(ce.value),Re=!1;for(let xe=0;xe<Se.length;xe++){let He=Se[xe].trim();if(He.startsWith("require (")){if(Re)break;Re=!0;continue}if(He.startsWith(")"))break;if(Re&&He!==""){let Ee=He.split(" ")[0].trim();for(let Te of mAn)Ee.startsWith(Te)&&(i["workspace.go.mod."+Ee]=!0)}}}catch{}}),J=M("pom.xml",this.fileService,this.textFileService,ce=>{try{let Se;for(;Se=vUo.exec(ce.value);){let Re;for(;Re=bUo.exec(Se[1]);){let xe=SUo.exec(Re[1]),He=IUo.exec(Re[1]);xe&&He&&this.tagJavaDependency(xe[1],He[1],"workspace.pom.",i)}}}catch{}}),se=M("build.gradle",this.fileService,this.textFileService,ce=>{try{this.processGradleDependencies(ce.value,gUo,i),this.processGradleDependencies(ce.value,fUo,i)}catch{}}),ae=l.map(ce=>{let Se=A.joinPath(ce,"/app/src/main/AndroidManifest.xml");return this.fileService.exists(Se).then(Re=>{Re&&(i["workspace.java.android"]=!0)},Re=>{})});return Promise.all([...K,...V,...H,...J,...se,...ae,...j]).then(()=>i)})}processGradleDependencies(i,e,t){let o;for(;o=e.exec(i);){let n=o[1],r=o[2];n&&r&&this.tagJavaDependency(n,r,"workspace.gradle.",t)}}tagJavaDependency(i,e,t,o){for(let n of yUo)if(n.predicate(i,e)){o[t+n.tag]=!0;return}}searchArray(i,e){return i.some(t=>t.search(e)>-1)||void 0}};Wft=I([m(0,ge),m(1,Ae),m(2,Mt),m(3,Uo)],Wft);Ce(yqe,Wft,1);oe.as(Zi.Workbench).registerWorkbenchContribution(ple,4);var i5e=class{constructor(i,e,t,o,n,r,s,l,c,u,p){this._dialogService=i;this._environmentService=e;this._textModelResolverService=t;this._clipboardService=o;this._openerService=s;this._nativeHostService=l;this._productService=c;this._fileService=u;this._labelService=p;Promise.all([n.when(4),r.whenInstalledExtensionsRegistered()]).then(()=>{this._stopProfiling()})}_stopProfiling(){if(!this._environmentService.args["prof-startup-prefix"])return;let i=A.file(this._environmentService.args["prof-startup-prefix"]),e=ai(i),t=Be(i),o=["--prof-startup"];this._fileService.readFile(i).then(r=>o.push(...r.toString().split("|"))).then(()=>this._fileService.del(i,{recursive:!0})).then(()=>new Promise(r=>{let s=()=>{this._fileService.exists(i).then(l=>{l?r():setTimeout(s,500)})};s()})).then(()=>this._fileService.del(i,{recursive:!0})).then(()=>this._fileService.resolve(e).then(r=>(r.children?r.children.filter(s=>s.resource.path.includes(t)):[]).map(s=>s.resource))).then(r=>{let s=r.reduce((l,c)=>`${l}${this._labelService.getUriLabel(c)}
`,`
`);return this._dialogService.confirm({type:"info",message:d(14107,null),detail:d(14105,null,s),primaryButton:d(14110,null),cancelButton:d(14108,null)}).then(l=>{l.confirmed?Promise.all([this._nativeHostService.showItemInFolder(r[0].fsPath),this._createPerfIssue(r.map(c=>Be(c)))]).then(()=>this._dialogService.confirm({type:"info",message:d(14111,null),detail:d(14106,null,this._productService.nameLong),primaryButton:d(14109,null)}).then(c=>{c.confirmed&&this._nativeHostService.relaunch({removeArgs:o})})):this._nativeHostService.relaunch({removeArgs:o})})})}async _createPerfIssue(i){let e=this._productService.reportIssueUrl;if(!e)return;let t=JN.get(),o=await this._textModelResolverService.createModelReference(t.getInputUri());try{await this._clipboardService.writeText(o.object.textEditorModel.getValue())}finally{o.dispose()}let n=`
1. :warning: We have copied additional data to your clipboard. Make sure to **paste** here. :warning:
1. :warning: Make sure to **attach** these files from your *home*-directory: :warning:
${i.map(l=>`-\`${l}\``).join(`
`)}
`,r=e,s=r.indexOf("?")===-1?"?":"&";this._openerService.open(A.parse(`${r}${s}body=${encodeURIComponent(n)}`))}};i5e=I([m(0,ct),m(1,Jr),m(2,Bt),m(3,Bi),m(4,to),m(5,lt),m(6,Je),m(7,wo),m(8,Ze),m(9,ge),m(10,nt)],i5e);var Cye=class{constructor(i,e,t,o,n){this._editorService=i;this._paneCompositeService=e;this._lifecycleService=t;this._updateService=o;this._workspaceTrustService=n}async _isStandardStartup(){if(this._lifecycleService.startupKind!==1)return xRt(this._lifecycleService.startupKind);if(!this._workspaceTrustService.isWorkspaceTrusted())return"Workspace not trusted";let i=this._paneCompositeService.getActivePaneComposite(0);if(!i||i.getId()!==Dv)return"Explorer viewlet not visible";let e=this._editorService.visibleEditorPanes;if(e.length!==1)return`Expected text editor count : 1, Actual : ${e.length}`;if(!fn(e[0].getControl()))return"Active editor is not a text editor";let t=this._paneCompositeService.getActivePaneComposite(1);if(t)return`Current active panel : ${this._paneCompositeService.getPaneComposite(t.getId(),1)?.name}`;if(await this._updateService.isLatestVersion()===!1)return"Not on latest version, updates available"}};Cye=I([m(0,ie),m(1,Es),m(2,to),m(3,Lp),m(4,Or)],Cye);var lti=class extends Cye{constructor(e,t,o,n,r,s,l,c,u,p){super(e,t,o,n,r);this.timerService=s;this.logService=l;this.environmentService=c;this.telemetryService=u;this.productService=p;this.logPerfMarks()}async logPerfMarks(){if(!this.environmentService.profDurationMarkers)return;await this.timerService.whenReady();let e=await this._isStandardStartup(),t=await this.timerService.perfBaseline,[o,n]=this.environmentService.profDurationMarkers,r=`${this.timerService.getDuration(o,n)}	${this.productService.nameShort}	${(this.productService.commit||"").slice(0,10)||"0000000000"}	${this.telemetryService.sessionId}	${e===void 0?"standard_start":"NO_standard_start : "+e}	${String(t).padStart(4,"0")}ms
`;this.logService.info(`[prof-timers] ${r}`)}};lti=I([m(0,ie),m(1,Es),m(2,to),m(3,Lp),m(4,Or),m(5,Kx),m(6,re),m(7,Od),m(8,_e),m(9,Ze)],lti);var cti=class{constructor(i){for(let e of performance.getEntriesByType("resource"))try{let t=new URL(e.name),o=Vo.basename(t.pathname);i.publicLog2("startup.resource.perf",{hosthash:`H${Lr(t.host).toString(16)}`,name:o,duration:e.duration})}catch{}}};cti=I([m(0,_e)],cti);var o5e=class extends Cye{constructor(e,t,o,n,r,s,l,c,u,p,h){super(n,r,l,c,h);this._fileService=e;this._timerService=t;this._nativeHostService=o;this._telemetryService=s;this._environmentService=u;this._productService=p;this._report().catch(mt)}async _report(){let e=await this._isStandardStartup();this._appendStartupTimes(e).catch(mt)}async _appendStartupTimes(e){let t=this._environmentService.args["prof-append-timers"],o=this._environmentService.args["prof-duration-markers"],n=this._environmentService.args["prof-duration-markers-file"];if(!(!t&&!o))try{await Promise.all([this._timerService.whenReady(),Li(15e3)]);let r=await this._timerService.perfBaseline,s=await this._resolveStartupHeapStatistics();if(s&&this._telemetryLogHeapStatistics(s),t){let l=ui([this._timerService.startupMetrics.ellapsed,this._productService.nameShort,(this._productService.commit||"").slice(0,10)||"0000000000",this._telemetryService.sessionId,e===void 0?"standard_start":`NO_standard_start : ${e}`,`${String(r).padStart(4,"0")}ms`,s?this._printStartupHeapStatistics(s):void 0]).join("	")+`
`;await this._appendContent(A.file(t),l)}if(o?.length){let l=[];for(let u of o){let p=0;if(u==="ellapsed")p=this._timerService.startupMetrics.ellapsed;else if(u.indexOf("-")!==-1){let h=u.split("-");h.length===2&&(p=this._timerService.getDuration(h[0],h[1]))}p&&(l.push(u),l.push(`${p}`))}let c=`${l.join("	")}
`;n?await this._appendContent(A.file(n),c):console.log(c)}}catch(r){console.error(r)}finally{this._nativeHostService.exit(0)}}async _isStandardStartup(){let e=await this._nativeHostService.getWindowCount();return e!==1?`Expected window count : 1, Actual : ${e}`:super._isStandardStartup()}async _appendContent(e,t){let o=[];await this._fileService.exists(e)&&o.push((await this._fileService.readFile(e)).value),o.push(Ke.fromString(t)),await this._fileService.writeFile(e,Ke.concat(o))}async _resolveStartupHeapStatistics(){if(!this._environmentService.args["enable-tracing"]||!this._environmentService.args["trace-startup-file"]||this._environmentService.args["trace-startup-format"]!=="json"||!this._environmentService.args["trace-startup-duration"])return;let e=await this._nativeHostService.getProcessId(),t=performance.memory?.usedJSHeapSize??0,o=0,n=0,r=0,s=0;try{let l=JSON.parse((await this._fileService.readFile(A.file(this._environmentService.args["trace-startup-file"]))).value.toString());for(let c of l.traceEvents)if(c.pid===e){switch(c.name){case"MinorGC":o++;break;case"MajorGC":n++;break;case"V8.GCFinalizeMC":case"V8.GCScavenger":s+=c.dur;break}(c.name==="MajorGC"||c.name==="MinorGC")&&typeof c.args?.usedHeapSizeAfter=="number"&&typeof c.args.usedHeapSizeBefore=="number"&&(r+=c.args.usedHeapSizeBefore-c.args.usedHeapSizeAfter)}return{minorGCs:o,majorGCs:n,used:t,garbage:r,duration:Math.round(s/1e3)}}catch(l){console.error(l)}}_telemetryLogHeapStatistics({used:e,garbage:t,majorGCs:o,minorGCs:n,duration:r}){this._telemetryService.publicLog2("startupHeapStatistics",{heapUsed:e,heapGarbage:t,majorGCs:o,minorGCs:n,gcsDuration:r})}_printStartupHeapStatistics({used:e,garbage:t,majorGCs:o,minorGCs:n,duration:r}){return`Heap: ${Math.round(e/1048576)}MB (used) ${Math.round(t/1048576)}MB (garbage) ${o} (MajorGC) ${n} (MinorGC) ${r}ms (GC duration)`}};o5e=I([m(0,ge),m(1,Kx),m(2,wo),m(3,ie),m(4,Es),m(5,_e),m(6,to),m(7,Lp),m(8,Jr),m(9,Ze),m(10,Or)],o5e);var n5e=class{constructor(i,e,t,o,n,r,s){this._environmentService=i;this._fileService=e;this._logService=t;$0(i).isExtensionDevTestFromCli||n.perfBaseline.then(c=>{if((i.isBuilt?t.info:t.trace).apply(t,[`[perf] Render performance baseline is ${c}ms`]),c<0)return;let u=c*10,p=new PerformanceObserver(async h=>{p.takeRecords();let g=h.getEntries().map(v=>v.duration).reduce((v,b)=>Math.max(v,b),0);if(g<u)return;if(!r.getValue("application.experimental.rendererProfiling")){t.debug(`[perf] SLOW task detected (${g}ms) but renderer profiling is disabled via 'application.experimental.rendererProfiling'`);return}let f=ht();t.warn(`[perf] Renderer reported VERY LONG TASK (${g}ms), starting profiling session '${f}'`),p.disconnect();for(let v=0;v<3;v++)try{let b=await o.profileRenderer(f,5e3);if(await s.analyseBottomUp(b,y=>"<<renderer>>",c,!0)===2){this._store(b,f);break}Li(15e3)}catch(b){t.error(b);break}p.observe({entryTypes:["longtask"]})});p.observe({entryTypes:["longtask"]}),this._observer=p})}dispose(){this._observer?.disconnect()}async _store(i,e){let t=Ve(this._environmentService.tmpDir,`renderer-${Math.random().toString(16).slice(2,8)}.cpuprofile.json`);await this._fileService.writeFile(t,Ke.fromString(JSON.stringify(i))),this._logService.info(`[perf] stored profile to DISK '${t}'`,e)}};n5e=I([m(0,Jr),m(1,ge),m(2,re),m(3,wo),m(4,Kx),m(5,B),m(6,Cft)],n5e);oe.as(Zi.Workbench).registerWorkbenchContribution(n5e,4);oe.as(Zi.Workbench).registerWorkbenchContribution(i5e,3);oe.as(Zi.Workbench).registerWorkbenchContribution(o5e,4);oe.as($t.Configuration).registerConfiguration({...uNt,properties:{"application.experimental.rendererProfiling":{type:"boolean",default:!1,tags:["experimental"],markdownDescription:d(14104,null),experiment:{mode:"startup"}}}});var Vft=class extends CS{constructor(i,e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce,Se,Re,xe,He,Ee,Te,It,tt,Oi){super(i,e,t,o,n,r,s,l,c,u,p,g,f,v,b,S,y,w,x,E,M,N,V,H,K,j,J,se,ae,ce,Se,Re,xe,h,Ee,He,It,tt,Oi),this._register(h.onBeforeShutdown(zt=>zt.veto(this.beforeShutdown(),"veto.tasks")))}_getTaskSystem(){if(this._taskSystem)return this._taskSystem;let i=this._createTerminalTaskSystem();return this._taskSystem=i,this._taskSystemListeners=[this._taskSystem.onDidStateChange(e=>{this._taskRunningState.set(this._taskSystem.isActiveSync()),this._onDidStateChange.fire(e)})],this._taskSystem}_computeLegacyConfiguration(i){let{config:e,hasParseErrors:t}=this._getConfiguration(i);return t?Promise.resolve({workspaceFolder:i,hasErrors:!0,config:void 0}):e?Promise.resolve({workspaceFolder:i,config:e,hasErrors:!1}):Promise.resolve({workspaceFolder:i,hasErrors:!0,config:void 0})}_versionAndEngineCompatible(i){let e=i&&i.version?i.version:void 0,t=this.executionEngine;return e===void 0||pXe("0.1.0",e)&&t===1||pXe("2.0.0",e)&&t===2}beforeShutdown(){if(!this._taskSystem||!this._taskSystem.isActiveSync()||this._taskSystem instanceof uae)return!1;let i;return this._taskSystem.canAutoTerminate()?i=Promise.resolve({confirmed:!0}):i=this._dialogService.confirm({message:d(15910,null),primaryButton:d(15911,null)}),i.then(e=>e.confirmed?this._taskSystem.terminateAll().then(t=>{let o=!0,n;for(let r of t)o=o&&r.success,n===void 0&&r.code!==void 0&&(n=r.code);return o?(this._taskSystem=void 0,this._disposeTaskSystemListeners(),!1):n&&n===3?this._dialogService.confirm({message:d(15909,null),primaryButton:d(15908,null),type:"info"}).then(r=>!r.confirmed):!0},t=>!0):!0)}};Vft=I([m(0,B),m(1,ha),m(2,Tl),m(3,Es),m(4,Gt),m(5,fe),m(6,ie),m(7,ge),m(8,Ae),m(9,_e),m(10,Uo),m(11,to),m(12,_t),m(13,lt),m(14,$e),m(15,Xp),m(16,an),m(17,Cc),m(18,de),m(19,Go),m(20,Je),m(21,ct),m(22,Ne),m(23,X),m(24,Mt),m(25,ig),m(26,Pn),m(27,Bt),m(28,Qo),m(29,ji),m(30,lp),m(31,Or),m(32,re),m(33,Pe),m(34,F),m(35,bo),m(36,br),m(37,si),m(38,gr),m(39,ti)],Vft);Ce(yf,Vft,1);var dti=le("externalTerminal");_w(dti,"externalTerminal");var wUo="workbench.action.terminal.openNativeConsole";xt.registerCommandAndKeybindingRule({id:wUo,primary:3105,when:C.and(pt.notFocus,qo.negate()),weight:200,handler:async a=>{let i=a.get(fa),e=a.get(dti),t=a.get(B),o=a.get(dd),n=a.get(Ae),r=a.get($e),s=a.get(nt),l=t.getValue("terminal.external"),c=n.getWorkspace().folders,u;if(c.length>1){let h=c.map(f=>({label:f.name,description:s.getUriLabel(f.uri,{relative:!0})})),g=await r.pick(h,{placeHolder:d(11947,null)});if(!g)return;u=c[h.indexOf(g)].uri}else u=i.getLastActiveWorkspaceRoot();if(u?.scheme===Q.file){e.openTerminal(l,u.fsPath);return}try{if(u?.scheme===Q.vscodeRemote){let h=await o.getCanonicalURI(u);if(h.scheme===Q.file){e.openTerminal(l,h.fsPath);return}}}catch{}let p=i.getLastActiveFile(Q.file);if(p?.scheme===Q.file){e.openTerminal(l,yd(p.fsPath));return}try{if(p?.scheme===Q.vscodeRemote){let h=await o.getCanonicalURI(p);if(h.scheme===Q.file){e.openTerminal(l,h.fsPath);return}}}catch{}e.openTerminal(l,void 0)}});be.appendMenuItem(R.CommandPalette,{command:{id:wUo,title:P(11946,"Open New External Terminal")}});var Bft=class{constructor(i){this._externalTerminalService=i;this._updateConfiguration()}async _updateConfiguration(){let i=await this._externalTerminalService.getDefaultTerminalForPlatforms(),e=oe.as($t.Configuration),t={type:"string",enum:["integrated","external","both"],enumDescriptions:[d(11954,null),d(11953,null),d(11952,null)],default:"integrated"};e.registerConfiguration({id:"externalTerminal",order:100,title:d(11955,null),type:"object",properties:{"terminal.explorerKind":{...t,description:d(11945,null)},"terminal.sourceControlRepositoriesKind":{...t,description:d(11948,null)},"terminal.external.windowsExec":{type:"string",description:d(11951,null),default:i.windows,scope:1},"terminal.external.osxExec":{type:"string",description:d(11950,null),default:i.osx,scope:1},"terminal.external.linuxExec":{type:"string",description:d(11949,null),default:i.linux,scope:1}}})}};Bft=I([m(0,dti)],Bft);var hAn=oe.as(Zi.Workbench);hAn.registerWorkbenchContribution(Bft,3);var uti=class extends z{constructor(){super({id:"workbench.action.webview.openDeveloperTools",title:P(17828,"Open Webview Developer Tools"),category:Fe.Developer,metadata:{description:d(17827,null)},f1:!0})}async run(i){let e=i.get(wo);zi().document.querySelectorAll("iframe.webview.ready").length&&(console.info(d(17826,null)),e.openDevTools())}};var r5e=class extends k{constructor(e,t){super();this._themeService=e;this._configurationService=t;this._cachedWebViewThemeData=void 0;this._onThemeDataChanged=this._register(new T);this.onThemeDataChanged=this._onThemeDataChanged.event;this._register(this._themeService.onDidColorThemeChange(()=>{this._reset()}));let o=["editor.fontFamily","editor.fontWeight","editor.fontSize","editor.fontLigatures","accessibility.underlineLinks"];this._register(this._configurationService.onDidChangeConfiguration(n=>{o.some(r=>n.affectsConfiguration(r))&&this._reset()}))}getTheme(){return this._themeService.getColorTheme()}getWebviewThemeData(){if(!this._cachedWebViewThemeData){let e=this._configurationService.getValue("editor"),t=e.fontFamily||Ku.fontFamily,o=e.fontWeight||Ku.fontWeight,n=e.fontSize||Ku.fontSize,r=new Mk().validate(e.fontLigatures),s=this._configurationService.getValue("accessibility.underlineLinks"),l=this._themeService.getColorTheme(),c=DCe().getColors().reduce((f,v)=>{let b=l.getColor(v.id);return b&&(f["vscode-"+v.id.replace(".","-")]=b.toString()),f},{}),u=rtt(),p=u.getSizes().reduce((f,v)=>{let b=u.resolveDefaultSize(v.id,l);return b&&(f["vscode-"+v.id.replace(/\./g,"-")]=ott(b)),f},{}),h={"vscode-font-family":WF,"vscode-font-weight":"normal","vscode-font-size":"13px","vscode-editor-font-family":t,"vscode-editor-font-weight":o,"vscode-editor-font-size":n+"px","text-link-decoration":s?"underline":"none",...c,...p,"vscode-editor-font-feature-settings":r},g=pti.fromTheme(l);this._cachedWebViewThemeData={styles:h,activeTheme:g,themeLabel:l.label,themeId:l.settingsId}}return this._cachedWebViewThemeData}_reset(){this._cachedWebViewThemeData=void 0,this._onThemeDataChanged.fire()}};r5e=I([m(0,ep),m(1,B)],r5e);var pti=(o=>(o.light="vscode-light",o.dark="vscode-dark",o.highContrast="vscode-high-contrast",o.highContrastLight="vscode-high-contrast-light",o))(pti||{});(i=>{function a(e){switch(e.type){case"light":return"vscode-light";case"dark":return"vscode-dark";case"hcDark":return"vscode-high-contrast";case"hcLight":return"vscode-high-contrast-light"}}i.fromTheme=a})(pti||={});var mti=class{constructor(i,e,t){this._getExtensionLocation=i;this._getMappings=e;this.tunnelService=t;this._tunnels=new Map}async getRedirect(i,e){let t=A.parse(e),o=NLe(t);if(o){for(let n of this._getMappings())if(n.webviewPort===o.port){let r=this._getExtensionLocation();if(r&&r.scheme===Q.vscodeRemote){let s=i&&await this.getOrCreateTunnel(i,n.extensionHostPort);if(s)return s.tunnelLocalPort===n.webviewPort?void 0:encodeURI(t.with({authority:`127.0.0.1:${s.tunnelLocalPort}`}).toString(!0))}if(n.webviewPort!==n.extensionHostPort)return encodeURI(t.with({authority:`${o.address}:${n.extensionHostPort}`}).toString(!0))}}}async dispose(){for(let i of this._tunnels.values())await i.dispose();this._tunnels.clear()}async getOrCreateTunnel(i,e){let t=this._tunnels.get(e);if(t)return t;let o=await this.tunnelService.openTunnel({getAddress:async()=>i},void 0,e),n;return typeof o=="string"&&(n=void 0),n&&this._tunnels.set(e,n),n}};var fAn=new Map([[".svg","image/svg+xml"],[".txt",cr.text],[".css","text/css"],[".js","application/javascript"],[".cjs","application/javascript"],[".mjs","application/javascript"],[".json","application/json"],[".html","text/html"],[".htm","text/html"],[".xhtml","application/xhtml+xml"],[".oft","font/otf"],[".xml","application/xml"],[".wasm","application/wasm"]]);function CUo(a){let i=km(a.fsPath).toLowerCase();return fAn.get(i)||Py(a.fsPath)||cr.unknown}var Ej;(n=>{let a;(u=>(u[u.Success=0]="Success",u[u.Failed=1]="Failed",u[u.AccessDenied=2]="AccessDenied",u[u.NotModified=3]="NotModified"))(a=n.Type||={});class i{constructor(s,l,c,u,p){this.stream=s;this.etag=l;this.mtime=c;this.mimeType=u;this.size=p;this.type=0}}n.StreamSuccess=i,n.Failed={type:1},n.AccessDenied={type:2};class o{constructor(s,l){this.mimeType=s;this.mtime=l;this.type=3}}n.NotModified=o})(Ej||={});async function xUo(a,i,e,t){let o=a.get(gt),n=a.get(ge),r=a.get(re),s=vAn(i,e.roots,o);if(r.trace(`Webview.loadLocalResource - trying to load resource. requestUri=${i}, resourceToLoad=${s}`),!s)return r.trace(`Webview.loadLocalResource - access denied. requestUri=${i}, resourceToLoad=${s}`),Ej.AccessDenied;let l=CUo(i);try{let c={etag:e.ifNoneMatch};if(e.range&&(c.position=e.range.start,e.range.end!==void 0)){if(e.range.end<e.range.start)return Ej.Failed;c.length=e.range.end-e.range.start+1}let u=await n.readFileStream(s,c,t);return r.trace(`Webview.loadLocalResource - Loaded. requestUri=${i}, resourceToLoad=${s}`),new Ej.StreamSuccess(u.value,u.etag,u.mtime,l,u.size)}catch(c){return c instanceof ua&&c.fileOperationResult===2?(r.trace(`Webview.loadLocalResource - not modified. requestUri=${i}, resourceToLoad=${s}`),new Ej.NotModified(l,c.options?.mtime)):(r.error(`Webview.loadLocalResource - Error using fileReader. requestUri=${i}, resourceToLoad=${s}`),Ej.Failed)}}function vAn(a,i,e){let t=a.with({query:""});for(let o of i)if(bAn(o,t,e))return SAn(a)}function bAn(a,i,e){return e.extUri.isEqual(a,i,!0)?!1:a.scheme===Q.file&&Xj(a.fsPath)?i.scheme===Q.file&&Xj(i.fsPath)?e.extUri.isEqualOrParent(i.with({path:i.path.toLowerCase(),authority:i.authority.toLowerCase()}),a.with({path:a.path.toLowerCase(),authority:a.authority.toLowerCase()}),!0):!1:e.extUri.isEqualOrParent(i,a,!0)}function SAn(a){return a.scheme===Q.vscodeRemote?A.from({scheme:Q.vscodeRemote,authority:a.authority,path:"/vscode-resource",query:JSON.stringify({requestResourcePath:a.path})}):a}var s5e=class extends Jse{constructor(e,t,o,n,r,s,l){super({showCommonFindToggles:!1,checkImeCompletionState:e.checkImeCompletionState,enableSash:!0},t,o,n,r,s,l);this._delegate=e;this._findWidgetFocused=K2.bindTo(o),this._register(e.hasFindResult(c=>{this.updateButtons(c),this.focusFindBox()})),this._register(e.onDidStopFind(()=>{this.updateButtons(!1)}))}async _getResultCount(e){}find(e){let t=this.inputValue;t&&this._delegate.find(t,e)}hide(e=!0){super.hide(e),this._delegate.stopFind(!0),this._delegate.focus()}_onInputChanged(){let e=this.inputValue;return e?this._delegate.updateFind(e):this._delegate.stopFind(!1),!1}_onFocusTrackerFocus(){this._findWidgetFocused.set(!0)}_onFocusTrackerBlur(){this._findWidgetFocused.reset()}_onFindInputFocusTrackerFocus(){}_onFindInputFocusTrackerBlur(){}findFirst(){}};s5e=I([m(1,qn),m(2,X),m(3,ot),m(4,Le),m(5,B),m(6,Ai)],s5e);var hti;(t=>{let a;(r=>(r[r.Initializing=0]="Initializing",r[r.Ready=1]="Ready"))(a=t.Type||={});class i{constructor(n){this.pendingMessages=n;this.type=0}}t.Initializing=i,t.Ready={type:1}})(hti||={});var IAn="webviewId",Tj=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.webviewThemeDataProvider=t;this._environmentService=s;this._logService=l;this._remoteAuthorityResolverService=c;this._tunnelService=u;this._accessibilityService=p;this._instantiationService=h;this.id=ht();this._windowId=void 0;this._expectedServiceWorkerVersion=5;this._state=new hti.Initializing([]);this._resourceLoadingCts=this._register(new qe);this._activeStreamControllers=new Set;this._focusDelayer=this._register(new Aa(50));this._onDidHtmlChange=this._register(new T);this.onDidHtmlChange=this._onDidHtmlChange.event;this._messageHandlers=new Map;this.checkImeCompletionState=!0;this.intrinsicContentSize=De("WebviewIntrinsicContentSize",void 0);this._disposed=!1;this._onMissingCsp=this._register(new T);this.onMissingCsp=this._onMissingCsp.event;this._onDidClickLink=this._register(new T);this.onDidClickLink=this._onDidClickLink.event;this._onMessage=this._register(new T);this.onMessage=this._onMessage.event;this._onDidScroll=this._register(new T);this.onDidScroll=this._onDidScroll.event;this._onDidWheel=this._register(new T);this.onDidWheel=this._onDidWheel.event;this._onDidUpdateState=this._register(new T);this.onDidUpdateState=this._onDidUpdateState.event;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new T);this.onDidBlur=this._onDidBlur.event;this._onFatalError=this._register(new T);this.onFatalError=this._onFatalError.event;this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event;this._hasAlertedAboutMissingCsp=!1;this._hasFindResult=this._register(new T);this.hasFindResult=this._hasFindResult.event;this._onDidStopFind=this._register(new T);this.onDidStopFind=this._onDidStopFind.event;this.providedViewType=e.providedViewType,this.origin=e.origin??this.id,this._options=e.options,this.extension=e.extension,this._content={html:"",title:e.title,options:e.contentOptions,state:void 0},this._portMappingManager=this._register(new mti(()=>this.extension?.location,()=>this._content.options.portMapping||[],this._tunnelService)),this._element=this._createElement(e.options,e.contentOptions),this._register(this.on("no-csp-found",()=>{this.handleNoCspFound()})),this._register(this.on("did-click-link",({uri:g})=>{this._onDidClickLink.fire(g)})),this._register(this.on("onmessage",({message:g,transfer:f})=>{this._onMessage.fire({message:g,transfer:f})})),this._register(this.on("did-scroll",({scrollYPercentage:g})=>{this._onDidScroll.fire({scrollYPercentage:g})})),this._register(this.on("do-reload",()=>{this.reload()})),this._register(this.on("do-update-state",g=>{this.state=g,this._onDidUpdateState.fire(g)})),this._register(this.on("did-focus",()=>{this.handleFocusChange(!0)})),this._register(this.on("did-blur",()=>{this.handleFocusChange(!1)})),this._register(this.on("did-scroll-wheel",g=>{this._onDidWheel.fire(g)})),this._register(this.on("did-find",({didFind:g})=>{this._hasFindResult.fire(g)})),this._register(this.on("fatal-error",g=>{r.error(d(17795,null,g.message)),this._onFatalError.fire({message:g.message})})),this._register(this.on("did-keydown",g=>{this.handleKeyEvent("keydown",g)})),this._register(this.on("did-keyup",g=>{this.handleKeyEvent("keyup",g)})),this._register(this.on("did-context-menu",g=>{if(!this.element||!this._contextKeyService)return;let f=this.element.getBoundingClientRect(),v=this._contextKeyService.createOverlay([...Object.entries(g.context),[IAn,this.providedViewType]]);n.showContextMenu({menuId:R.WebviewContext,menuActionOptions:{shouldForwardArgs:!0},contextKeyService:v,getActionsContext:()=>({...g.context,webview:this.providedViewType}),getAnchor:()=>({x:f.x+g.clientX,y:f.y+g.clientY})}),this._send("set-context-menu-visible",{visible:!0})})),this._register(this.on("load-resource",async g=>{try{let f=_yo(g.authority),v=A.from({scheme:g.scheme,authority:f,path:decodeURIComponent(g.path),query:g.query?decodeURIComponent(g.query):g.query});this.loadResource(g.id,v,{ifNoneMatch:g.ifNoneMatch,range:g.range},this._resourceLoadingCts.token)}catch{this._send("did-load-resource",{id:g.id,status:404,path:g.path})}})),this._register(this.on("load-localhost",g=>{this.localLocalhost(g.id,g.origin)})),this._register(U.runAndSubscribe(t.onThemeDataChanged,()=>this.style())),this._register(p.onDidChangeReducedMotion(()=>this.style())),this._register(p.onDidChangeScreenReaderOptimized(()=>this.style())),this._register(n.onDidHideContextMenu(()=>this._send("set-context-menu-visible",{visible:!1}))),this._confirmBeforeClose=o.getValue("window.confirmBeforeClose"),this._register(o.onDidChangeConfiguration(g=>{g.affectsConfiguration("window.confirmBeforeClose")&&(this._confirmBeforeClose=o.getValue("window.confirmBeforeClose"),this._send("set-confirm-before-close",this._confirmBeforeClose))})),this._register(this.on("drag-start",()=>{this._startBlockingIframeDragEvents()})),this._register(this.on("drag",g=>{this.handleDragEvent("drag",g)})),this._register(this.on("updated-intrinsic-content-size",g=>{this.intrinsicContentSize.set({width:g.width,height:g.height},void 0,void 0)})),e.options.enableFindWidget&&(this._webviewFindWidget=this._register(this._instantiationService.createInstance(s5e,this)))}get window(){return typeof this._windowId=="number"?gv(this._windowId)?.window:void 0}get platform(){return"browser"}static{this._supportsTransferableStreams=new uo(()=>{try{let e=new ReadableStream,t=new MessageChannel;return t.port1.postMessage(e,[e]),t.port1.close(),t.port2.close(),!0}catch{return!1}})}get element(){return this._element}get isFocused(){return!(!this._focused||!this.window||this.window.document.activeElement&&this.window.document.activeElement!==this.element)}dispose(){if(this._disposed=!0,this.element?.remove(),this._element=void 0,this._messagePort=void 0,this._state.type===0){for(let e of this._state.pendingMessages)e.resolve(!1);this._state.pendingMessages=[]}this._onDidDispose.fire();for(let e of this._activeStreamControllers)try{e.close()}catch{}this._activeStreamControllers.clear(),this._resourceLoadingCts.dispose(!0),super.dispose()}setContextKeyService(e){this._contextKeyService=e}postMessage(e,t){return this._send("message",{message:e,transfer:t})}async _send(e,t,o=[]){if(this._state.type===0){let{promise:n,resolve:r}=Ey();return this._state.pendingMessages.push({channel:e,data:t,transferable:o,resolve:r}),n}else return this.doPostMessage(e,t,o)}_createElement(e,t){let o=document.createElement("iframe");o.name=this.id,o.className=`webview ${e.customClasses||""}`,o.sandbox.add("allow-scripts","allow-same-origin","allow-forms","allow-pointer-lock","allow-downloads");let n=["cross-origin-isolated","autoplay","local-network-access"];return ed||n.push("clipboard-read","clipboard-write"),o.setAttribute("allow",n.join("; ")),o.style.border="none",o.style.width="100%",o.style.height="100%",o.focus=()=>{this._doFocus()},o}_initElement(e,t,o,n){let r={id:this.id,parentId:n.vscodeWindowId.toString(),origin:this.origin,swVersion:String(this._expectedServiceWorkerVersion),extensionId:t?.id.value??"",platform:this.platform,"vscode-resource-base-authority":zLi,parentOrigin:n.origin};this._options.disableServiceWorker&&(r.disableServiceWorker="true"),this._environmentService.remoteAuthority&&(r.remoteAuthority=this._environmentService.remoteAuthority),o.purpose&&(r.purpose=o.purpose),Fle.addSearchParam(r,!0,!0);let s=new URLSearchParams(r).toString();this.perfMark("init/set-src"),this.element.setAttribute("src",`${this.webviewContentEndpoint(e)}/index.html?${s}`)}mountTo(e,t){if(this.element){this._windowId=t.vscodeWindowId,this._encodedWebviewOriginPromise=Gvt(t.origin,this.origin).then(o=>this._encodedWebviewOrigin=o),this._encodedWebviewOriginPromise.then(o=>{this._disposed||this._initElement(o,this.extension,this._options,t)}),this._registerMessageHandler(t),this._webviewFindWidget&&e.appendChild(this._webviewFindWidget.getDomNode());for(let o of[ne.MOUSE_DOWN,ne.MOUSE_MOVE,ne.DROP])this._register($(e,o,()=>{this._stopBlockingIframeDragEvents()}));for(let o of[e,t])this._register($(o,ne.DRAG_END,()=>{this._stopBlockingIframeDragEvents()}));e.id=this.id,this.perfMark("mounted"),e.appendChild(this.element)}}_registerMessageHandler(e){let t=this._register($(e,"message",o=>{if(!(!this._encodedWebviewOrigin||o?.data?.target!==this.id)){if(o.origin!==this._webviewContentOrigin(this._encodedWebviewOrigin)){console.log(`Skipped renderer receiving message due to mismatched origins: ${o.origin} ${this._webviewContentOrigin}`);return}if(o.data.channel==="webview-ready"){if(this._messagePort)return;this.perfMark("webview-ready"),this._logService.trace(`Webview(${this.id}): webview ready`),this._messagePort=o.ports[0],this._messagePort.onmessage=n=>{let r=this._messageHandlers.get(n.data.channel);if(!r){console.log(`No handlers found for '${n.data.channel}'`);return}r?.forEach(s=>s(n.data.data,n))},this.element?.classList.add("ready"),this._state.type===0&&this._state.pendingMessages.forEach(({channel:n,data:r,resolve:s})=>s(this.doPostMessage(n,r))),this._state=hti.Ready,t.dispose()}}}))}perfMark(e){performance.mark(`webview/webviewElement/${e}`,{detail:{id:this.id}})}_startBlockingIframeDragEvents(){this.element&&(this.element.style.pointerEvents="none")}_stopBlockingIframeDragEvents(){this.element&&(this.element.style.pointerEvents="auto")}webviewContentEndpoint(e){let t=this._environmentService.webviewExternalEndpoint;if(!t)throw new Error("'webviewExternalEndpoint' has not been configured. Webviews will not work!");let o=t.replace("{{uuid}}",e);return o[o.length-1]==="/"?o.slice(0,o.length-1):o}_webviewContentOrigin(e){let t=A.parse(this.webviewContentEndpoint(e));return t.scheme+"://"+t.authority.toLowerCase()}doPostMessage(e,t,o=[]){return this.element&&this._messagePort?(this._messagePort.postMessage({channel:e,args:t},o),!0):!1}on(e,t){let o=this._messageHandlers.get(e);return o||(o=new Set,this._messageHandlers.set(e,o)),o.add(t),ee(()=>{this._messageHandlers.get(e)?.delete(t)})}handleNoCspFound(){this._hasAlertedAboutMissingCsp||(this._hasAlertedAboutMissingCsp=!0,this.extension?.id&&this._environmentService.isExtensionDevelopment&&this._onMissingCsp.fire(this.extension.id))}reload(){this.doUpdateContent(this._content)}reinitializeAfterDismount(){this._state=new hti.Initializing([]),this._messagePort=void 0,this.mountTo(this.element.parentElement,Me(this.element)),this.style(),this.reload()}setHtml(e){this.doUpdateContent({...this._content,html:e}),this._onDidHtmlChange.fire(e)}setTitle(e){this._content={...this._content,title:e},this._send("set-title",e)}set contentOptions(e){if(this._logService.debug(`Webview(${this.id}): will update content options`),ylo(e,this._content.options)){this._logService.debug(`Webview(${this.id}): skipping content options update`);return}this.doUpdateContent({...this._content,options:e})}set localResourcesRoot(e){this._content={...this._content,options:{...this._content.options,localResourceRoots:e}}}set state(e){this._content={...this._content,state:e}}set initialScrollProgress(e){this._send("initial-scroll-position",e)}doUpdateContent(e){this._logService.debug(`Webview(${this.id}): will update content`),this._content=e;let t=!!this._content.options.allowScripts;this.perfMark("set-content"),this._send("content",{contents:this._content.html,title:this._content.title,options:{allowMultipleAPIAcquire:!!this._content.options.allowMultipleAPIAcquire,allowScripts:t,allowForms:this._content.options.allowForms??t},state:this._content.state,cspSource:afe,confirmBeforeClose:this._confirmBeforeClose})}style(){let{styles:e,activeTheme:t,themeLabel:o,themeId:n}=this.webviewThemeDataProvider.getWebviewThemeData();this._options.transformCssVariables&&(e=this._options.transformCssVariables(e));let r=this._accessibilityService.isMotionReduced(),s=this._accessibilityService.isScreenReaderOptimized();this._send("styles",{styles:e,activeTheme:t,themeId:n,themeLabel:o,reduceMotion:r,screenReader:s})}handleFocusChange(e){this._focused=e,e?this._onDidFocus.fire():this._onDidBlur.fire()}handleKeyEvent(e,t){let o=new KeyboardEvent(e,t);Object.defineProperty(o,"target",{get:()=>this.element}),this.window?.dispatchEvent(o)}handleDragEvent(e,t){let o=new DragEvent(e,t);Object.defineProperty(o,"target",{get:()=>this.element}),this.window?.dispatchEvent(o)}windowDidDragStart(){this._startBlockingIframeDragEvents()}windowDidDragEnd(){this._stopBlockingIframeDragEvents()}selectAll(){this.execCommand("selectAll")}copy(){this.execCommand("copy")}paste(){this.execCommand("paste")}cut(){this.execCommand("cut")}undo(){this.execCommand("undo")}redo(){this.execCommand("redo")}execCommand(e){this.element&&this._send("execCommand",e)}async loadResource(e,t,o,n){if(!this._disposed){try{let r=await this._instantiationService.invokeFunction(xUo,t,{ifNoneMatch:o.ifNoneMatch,roots:this._content.options.localResourceRoots||[],range:o.range},n);if(this._disposed)return;switch(r.type){case Ej.Type.Success:{let s=o.range,l=s?.end!==void 0?s.end:r.size-1,c=Math.min(l,r.size-1),u=s?`bytes ${s.start}-${c}/${r.size}`:void 0;if(Tj._supportsTransferableStreams.value){let p=new ReadableStream({start:h=>{this._activeStreamControllers.add(h);let g=!1,f=()=>{if(!g){g=!0,this._activeStreamControllers.delete(h);try{h.close()}catch{}}};_L(r.stream,{onData:v=>{if(!g)try{h.enqueue(new Uint8Array(v.buffer.buffer,v.buffer.byteOffset,v.buffer.byteLength))}catch{g=!0,this._activeStreamControllers.delete(h)}},onError:v=>{if(!g){g=!0,this._activeStreamControllers.delete(h);try{h.error(v)}catch{}}},onEnd:()=>f()},n)}});this._send("did-load-resource",{id:e,status:s?206:200,path:t.path,mime:r.mimeType,etag:r.etag,mtime:r.mtime,range:u,stream:p},[p])}else this._send("did-load-resource",{id:e,status:s?206:200,path:t.path,mime:r.mimeType,etag:r.etag,mtime:r.mtime,range:u}),_L(r.stream,{onData:p=>{let h=new Uint8Array(p.buffer.buffer,p.buffer.byteOffset,p.buffer.byteLength);this._send("did-load-resource-chunk",{id:e,data:h},[h.buffer])},onError:()=>{this._send("did-load-resource-end",{id:e,error:!0})},onEnd:()=>{this._send("did-load-resource-end",{id:e})}},n);return}case Ej.Type.NotModified:return this._send("did-load-resource",{id:e,status:304,path:t.path,mime:r.mimeType,mtime:r.mtime});case Ej.Type.AccessDenied:return this._send("did-load-resource",{id:e,status:401,path:t.path})}}catch{}return this._send("did-load-resource",{id:e,status:404,path:t.path})}}async localLocalhost(e,t){let o=this._environmentService.remoteAuthority,n=o?await this._remoteAuthorityResolverService.resolveAuthority(o):void 0,r=n?await this._portMappingManager.getRedirect(n.authority,t):void 0;return this._send("did-load-localhost",{id:e,origin:t,location:r})}focus(){this._doFocus(),this.handleFocusChange(!0)}_doFocus(){if(this.element){try{this.element.contentWindow?.focus()}catch{}this._focusDelayer.trigger(async()=>{!this.isFocused||!this.element||this.window?.document.activeElement&&this.window.document.activeElement!==this.element&&this.window.document.activeElement?.tagName!=="BODY"||(this.window?.document.body?.focus(),this._send("focus",void 0))})}}find(e,t){this.element&&this._send("find",{value:e,previous:t})}updateFind(e){!e||!this.element||this._send("find",{value:e})}stopFind(e){this.element&&(this._send("find-stop",{clearSelection:!e}),this._onDidStopFind.fire())}showFind(e=!0){this._webviewFindWidget?.reveal(void 0,e)}hideFind(e=!0){this._webviewFindWidget?.hide(e)}runFindAction(e){this._webviewFindWidget?.find(e)}};Tj=I([m(2,B),m(3,Xe),m(4,Ne),m(5,Mt),m(6,re),m(7,dd),m(8,Jp),m(9,Ai),m(10,F)],Tj);var a5e=class extends k{constructor(e,t,o,n){super();this._layoutService=t;this._webviewService=o;this._baseContextKeyService=n;this._isFirstLoad=!0;this._firstLoadPendingMessages=new Set;this._webview=this._register(new ue);this._webviewEvents=this._register(new O);this._html="";this._initialScrollProgress=0;this._state=void 0;this._owner=void 0;this._windowId=void 0;this._scopedContextKeyService=this._register(new ue);this._shouldShowFindWidgetOnRestore=!1;this._isDisposed=!1;this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event;this._onDidFocus=this._register(new T);this.onDidFocus=this._onDidFocus.event;this._onDidBlur=this._register(new T);this.onDidBlur=this._onDidBlur.event;this._onDidClickLink=this._register(new T);this.onDidClickLink=this._onDidClickLink.event;this._onDidScroll=this._register(new T);this.onDidScroll=this._onDidScroll.event;this._onDidUpdateState=this._register(new T);this.onDidUpdateState=this._onDidUpdateState.event;this._onMessage=this._register(new T);this.onMessage=this._onMessage.event;this._onMissingCsp=this._register(new T);this.onMissingCsp=this._onMissingCsp.event;this._onDidWheel=this._register(new T);this.onDidWheel=this._onDidWheel.event;this._onFatalError=this._register(new T);this.onFatalError=this._onFatalError.event;this.intrinsicContentSize=De("WebviewIntrinsicContentSize",void 0);this.providedViewType=e.providedViewType,this.origin=e.origin??ht(),this._title=e.title,this._extension=e.extension,this._options=e.options,this._contentOptions=e.contentOptions}get window(){return gv(this._windowId,!0).window}get isFocused(){return!!this._webview.value?.isFocused}dispose(){this._isDisposed=!0,this._overlayLayout?.dispose(),this._overlayLayout=void 0;for(let e of this._firstLoadPendingMessages)e.resolve(!1);this._firstLoadPendingMessages.clear(),this._onDidDispose.fire(),super.dispose()}get container(){if(this._isDisposed)throw new Error("OverlayWebview has been disposed");return this.overlayLayout.content}get overlayLayout(){return this._overlayLayout||(this._overlayLayout=new QNe,this._overlayLayout.content.style.visibility="hidden",this._layoutService.getContainer(this.window).appendChild(this._overlayLayout.root)),this._overlayLayout}claim(e,t,o){if(this._isDisposed)return;let n=this._owner;if(this._windowId!==t.vscodeWindowId&&(this.release(n),this._webview.clear(),this._webviewEvents.clear(),this._overlayLayout?.dispose(),this._overlayLayout=void 0),this._owner=e,this._windowId=t.vscodeWindowId,this._show(t),this._anchorState&&this.overlayLayout.setAnchorElement(this._anchorState.anchorElement,{clippingContainer:this._anchorState.clippingContainer}),n!==e){let r=o||this._baseContextKeyService;this._scopedContextKeyService.clear(),this._scopedContextKeyService.value=r.createScoped(this.container);let s=this._findWidgetVisible?.get();this._findWidgetVisible?.reset(),this._findWidgetVisible=aAt.bindTo(r),this._findWidgetVisible.set(!!s),this._findWidgetEnabled?.reset(),this._findWidgetEnabled=lAt.bindTo(r),this._findWidgetEnabled.set(!!this.options.enableFindWidget),this._webview.value?.setContextKeyService(this._scopedContextKeyService.value)}}release(e){this._owner===e&&(this._scopedContextKeyService.clear(),this._owner=void 0,this._overlayLayout&&(this._overlayLayout.content.style.visibility="hidden"),this._options.retainContextWhenHidden?(this._shouldShowFindWidgetOnRestore=!!this._findWidgetVisible?.get(),this.hideFind(!1)):(this._webview.clear(),this._webviewEvents.clear()))}setAnchorElement(e,t){this._anchorState={anchorElement:e,clippingContainer:t},this.overlayLayout.setAnchorElement(e,{clippingContainer:t})}_show(e){if(this._isDisposed)throw new Error("OverlayWebview is disposed");if(!this._webview.value){let t=this._webviewService.createWebviewElement({providedViewType:this.providedViewType,origin:this.origin,title:this._title,options:this._options,contentOptions:this._contentOptions,extension:this.extension});this._webview.value=t,t.state=this._state,this._scopedContextKeyService.value&&this._webview.value.setContextKeyService(this._scopedContextKeyService.value),this._html&&t.setHtml(this._html),this._options.tryRestoreScrollPosition&&(t.initialScrollProgress=this._initialScrollProgress),this._findWidgetEnabled?.set(!!this.options.enableFindWidget),t.mountTo(this.container,e),this._webviewEvents.clear(),this._webviewEvents.add(t.onDidFocus(()=>{this._onDidFocus.fire()})),this._webviewEvents.add(t.onDidBlur(()=>{this._onDidBlur.fire()})),this._webviewEvents.add(t.onDidClickLink(o=>{this._onDidClickLink.fire(o)})),this._webviewEvents.add(t.onMessage(o=>{this._onMessage.fire(o)})),this._webviewEvents.add(t.onMissingCsp(o=>{this._onMissingCsp.fire(o)})),this._webviewEvents.add(t.onDidWheel(o=>{this._onDidWheel.fire(o)})),this._webviewEvents.add(t.onFatalError(o=>{this._onFatalError.fire(o)})),this._webviewEvents.add(ve(o=>{this.intrinsicContentSize.set(o.readObservable(t.intrinsicContentSize),void 0,void 0)})),this._webviewEvents.add(t.onDidScroll(o=>{this._initialScrollProgress=o.scrollYPercentage,this._onDidScroll.fire(o)})),this._webviewEvents.add(t.onDidUpdateState(o=>{this._state=o,this._onDidUpdateState.fire(o)})),this._isFirstLoad&&this._firstLoadPendingMessages.forEach(async o=>{o.resolve(await t.postMessage(o.message,o.transfer))}),this._isFirstLoad=!1,this._firstLoadPendingMessages.clear()}this.options.retainContextWhenHidden&&this._shouldShowFindWidgetOnRestore&&(this.showFind(!1),this._shouldShowFindWidgetOnRestore=!1),this._overlayLayout&&(this._overlayLayout.content.style.visibility="visible")}setHtml(e){this._html=e,this._withWebview(t=>t.setHtml(e))}setTitle(e){this._title=e,this._withWebview(t=>t.setTitle(e))}get initialScrollProgress(){return this._initialScrollProgress}set initialScrollProgress(e){this._initialScrollProgress=e,this._withWebview(t=>t.initialScrollProgress=e)}get state(){return this._state}set state(e){this._state=e,this._withWebview(t=>t.state=e)}get extension(){return this._extension}set extension(e){this._extension=e,this._withWebview(t=>t.extension=e)}get options(){return this._options}set options(e){this._options={customClasses:this._options.customClasses,...e}}get contentOptions(){return this._contentOptions}set contentOptions(e){this._contentOptions=e,this._withWebview(t=>t.contentOptions=e)}set localResourcesRoot(e){this._withWebview(t=>t.localResourcesRoot=e)}async postMessage(e,t){if(this._webview.value)return this._webview.value.postMessage(e,t);if(this._isFirstLoad){let o,n=new Promise(r=>o=r);return this._firstLoadPendingMessages.add({message:e,transfer:t,resolve:o}),n}return!1}focus(){this._webview.value?.focus()}reload(){this._webview.value?.reload()}selectAll(){this._webview.value?.selectAll()}copy(){this._webview.value?.copy()}paste(){this._webview.value?.paste()}cut(){this._webview.value?.cut()}undo(){this._webview.value?.undo()}redo(){this._webview.value?.redo()}showFind(e=!0){this._webview.value&&(this._webview.value.showFind(e),this._findWidgetVisible?.set(!0))}hideFind(e=!0){this._findWidgetVisible?.reset(),this._webview.value?.hideFind(e)}runFindAction(e){this._webview.value?.runFindAction(e)}_withWebview(e){this._webview.value&&e(this._webview.value)}windowDidDragStart(){this._webview.value?.windowDidDragStart()}windowDidDragEnd(){this._webview.value?.windowDidDragEnd()}setContextKeyService(e){this._webview.value?.setContextKeyService(e)}};a5e=I([m(1,wi),m(2,Pu),m(3,X)],a5e);var l5e=class extends k{constructor(e){super();this._instantiationService=e;this._webviews=new Set;this._onDidChangeActiveWebview=this._register(new T);this.onDidChangeActiveWebview=this._onDidChangeActiveWebview.event;this._webviewThemeDataProvider=this._instantiationService.createInstance(r5e)}get activeWebview(){return this._activeWebview}_updateActiveWebview(e){e!==this._activeWebview&&(this._activeWebview=e,this._onDidChangeActiveWebview.fire(e))}get webviews(){return this._webviews.values()}createWebviewElement(e){let t=this._instantiationService.createInstance(Tj,e,this._webviewThemeDataProvider);return this.registerNewWebview(t),t}createWebviewOverlay(e){let t=this._instantiationService.createInstance(a5e,e);return this.registerNewWebview(t),t}registerNewWebview(e){this._webviews.add(e);let t=new O;t.add(e.onDidFocus(()=>{this._updateActiveWebview(e)}));let o=()=>{this._activeWebview===e&&this._updateActiveWebview(void 0)};t.add(e.onDidBlur(o)),t.add(e.onDidDispose(()=>{o(),t.dispose(),this._webviews.delete(e)}))}};l5e=I([m(0,F)],l5e);var gti=class{constructor(i,e,t){this._nativeHostService=t;this._isUsingNativeTitleBars=yx(i),this._webviewMainService=Xd.toService(e.getChannel("webview"))}didFocus(){this.setIgnoreMenuShortcuts(!0)}didBlur(){this.setIgnoreMenuShortcuts(!1)}get _shouldToggleMenuShortcutsEnablement(){return et||this._isUsingNativeTitleBars}setIgnoreMenuShortcuts(i){this._shouldToggleMenuShortcutsEnablement&&this._webviewMainService.setIgnoreMenuShortcuts({windowId:this._nativeHostService.windowId},i)}};var c5e=class extends Tj{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f){super(e,t,c,o,p,r,l,s,n,f,g);this._nativeHostService=h;this._findStarted=!1;this._iframeDelayer=this._register(new rn(200));this._webviewKeyboardHandler=new gti(c,u,h),this._webviewMainService=Xd.toService(u.getChannel("webview")),e.options.enableFindWidget&&(this._register(this.onDidHtmlChange(v=>{this._findStarted&&this._cachedHtmlContent!==v&&(this.stopFind(!1),this._cachedHtmlContent=v)})),this._register(this._webviewMainService.onFoundInFrame(v=>{this._hasFindResult.fire(v.matches>0)})))}get platform(){return"electron"}dispose(){this._webviewKeyboardHandler.didBlur(),super.dispose()}webviewContentEndpoint(e){return`${Q.vscodeWebview}://${e}`}find(e,t){if(this.element)if(!this._findStarted)this.updateFind(e);else{let o={forward:!t,findNext:!1,matchCase:!1};this._webviewMainService.findInFrame({windowId:this._nativeHostService.windowId},this.id,e,o)}}updateFind(e){if(!e||!this.element)return;let t={forward:!0,findNext:!0,matchCase:!1};this._iframeDelayer.trigger(()=>{this._findStarted=!0,this._webviewMainService.findInFrame({windowId:this._nativeHostService.windowId},this.id,e,t)})}stopFind(e){this.element&&(this._iframeDelayer.cancel(),this._findStarted=!1,this._webviewMainService.stopFindInFrame({windowId:this._nativeHostService.windowId},this.id,{keepSelection:e}),this._onDidStopFind.fire())}handleFocusChange(e){super.handleFocusChange(e),e?this._webviewKeyboardHandler.didFocus():this._webviewKeyboardHandler.didBlur()}};c5e=I([m(2,Xe),m(3,Jp),m(4,Mt),m(5,dd),m(6,re),m(7,B),m(8,rm),m(9,Ne),m(10,wo),m(11,F),m(12,Ai)],c5e);var fti=class extends l5e{createWebviewElement(i){let e=this._instantiationService.createInstance(c5e,i,this._webviewThemeDataProvider);return this.registerNewWebview(e),e}};Ce(Pu,fti,1);W(uti);var kUo=[{className:"monaco-menu-container",type:"menu"},{className:"action-list-submenu-panel",type:"menu"},{className:"quick-input-widget",type:"quickInput"},{className:"monaco-hover",type:"hover"},{className:"editor-widget",type:"hover"},{className:"suggest-details-container",type:"hover"},{className:"monaco-dialog-modal-block",type:"dialog"},{className:"monaco-modal-editor-block",type:"dialog"},{className:"notifications-center",type:"notification"},{className:"notification-toast-container",type:"notification"},{className:"context-view",type:"unknown"}],lPy=le("browserOverlayManager"),vti=class extends k{constructor(e){super();this.targetWindow=e;this._onDidChangeOverlayState=this._register(new aY({onWillAddFirstListener:()=>{this._observerIsConnected=!0,this._structuralObserver.observe(this.targetWindow.document.body,{childList:!0,subtree:!0}),this.updateTrackedElements()},onDidRemoveLastListener:()=>{this._observerIsConnected=!1,this._structuralObserver.disconnect(),this.stopTrackingElements()},merge:()=>{}}));this.onDidChangeOverlayState=this._onDidChangeOverlayState.event;this._overlayCollections=new Map;this._overlayRectangles=new WeakMap;this._elementObservers=new WeakMap;this._observerIsConnected=!1;this._shadowRootObservers=new WeakMap;this._shadowRootOverlayCache=new WeakMap;for(let t of kUo)this._overlayCollections.set(t.className,{type:t.type,collection:this.targetWindow.document.getElementsByClassName(t.className)});this._shadowRootHostCollection=this.targetWindow.document.getElementsByClassName("shadow-root-host"),this._structuralObserver=new e.MutationObserver(t=>{let o=!1;for(let n of t)for(let r of n.removedNodes){this._elementObservers.has(r)&&(this._elementObservers.get(r)?.disconnect(),this._elementObservers.delete(r),o=!0),this._overlayRectangles.delete(r)&&(o=!0);let s=r;if(s.shadowRoot){let l=s.shadowRoot,c=this._shadowRootObservers.get(l);c&&(c.disconnect(),this._shadowRootObservers.delete(l),this._shadowRootOverlayCache.delete(l),o=!0)}}this.updateTrackedElements(o)})}*overlays(){for(let e of this._overlayCollections.values())for(let t of e.collection)yield{element:t,type:e.type};for(let e of this._shadowRootHostCollection){let t=e.shadowRoot;if(t){let o=this._shadowRootOverlayCache.get(t);if(!o){o=[];for(let n of kUo){let r=t.querySelectorAll(`.${n.className}`);for(let s of r)o.push({element:s,type:n.type})}this._shadowRootOverlayCache.set(t,o)}yield*o}}}updateTrackedElements(e=!1){for(let t of this._shadowRootHostCollection){let n=t.shadowRoot;if(n&&!this._shadowRootObservers.has(n)){let r=new this.targetWindow.MutationObserver(()=>{this._shadowRootOverlayCache.delete(n),this._onDidChangeOverlayState.fire()});r.observe(n,{childList:!0,subtree:!0}),this._shadowRootObservers.set(n,r),e=!0}}for(let t of this.overlays())if(!this._elementObservers.has(t.element)){let o=new this.targetWindow.MutationObserver(n=>{n.every(r=>r.target.parentElement?.closest(".browser-container"))||(this._overlayRectangles.delete(t.element),this._onDidChangeOverlayState.fire())});this._elementObservers.set(t.element,o),o.observe(t.element,{attributes:!0,attributeFilter:["style","class"],childList:!0,subtree:!0}),e=!0}e&&this._onDidChangeOverlayState.fire()}getRect(e){if(!this._overlayRectangles.has(e)){let t=ur(e);if(!this._observerIsConnected)return t;this._overlayRectangles.set(e,t)}return this._overlayRectangles.get(e)}getOverlappingOverlays(e){let t=ur(e),o=[];for(let n of this.overlays()){if(n.element.contains(e))continue;let r=this.getRect(n.element),s=yAn(t,r);if(s){let l=s.x-this.targetWindow.scrollX,c=s.y-this.targetWindow.scrollY,u=this.targetWindow.document.elementFromPoint(l,c);u?.shadowRoot&&!n.element.contains(u)&&(u=u.shadowRoot.elementFromPoint(l,c)),u&&n.element.contains(u)&&o.push({type:n.type,rect:r})}}return o}stopTrackingElements(){for(let e of this.overlays())this._elementObservers.get(e.element)?.disconnect();for(let e of this._shadowRootHostCollection){let t=e.shadowRoot;this._shadowRootObservers.get(t)?.disconnect()}this._shadowRootObservers=new WeakMap,this._shadowRootOverlayCache=new WeakMap,this._overlayRectangles=new WeakMap,this._elementObservers=new WeakMap}dispose(){this._observerIsConnected=!1,this._structuralObserver.disconnect(),this.stopTrackingElements(),super.dispose()}};function yAn(a,i){let e=Math.max(a.left,i.left),t=Math.min(a.left+a.width,i.left+i.width),o=Math.max(a.top,i.top),n=Math.min(a.top+a.height,i.top+i.height);return t>e&&n>o?{x:(e+t)/2,y:(o+n)/2}:null}var d5e=class extends k{constructor(e,t,o){super();this.editor=t;this.hoverService=o;this._container=_(".browser-site-info-container"),this._container.style.display="none",this._indicator=_(".browser-site-info-indicator"),this._indicator.tabIndex=0,this._indicator.role="button",this._indicator.ariaLabel=d(6121,null),this._indicator.appendChild(un(L.workspaceUntrusted)),this._container.appendChild(this._indicator),e.appendChild(this._container),this._register($(this._indicator,ne.CLICK,()=>this._showHover())),this._register($(this._indicator,ne.KEY_DOWN,n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),this._showHover())}))}setCertificateError(e){this._container.style.display=e?"":"none"}_showHover(){let e=this.editor.getCertificateError();if(!e)return;let t=document.createElement("div");t.classList.add("browser-site-info-hover-content");let o=document.createElement("div");o.classList.add("browser-site-info-hover-heading"),o.textContent=d(6119,null),t.appendChild(o);let n=document.createElement("div");if(n.classList.add("browser-site-info-hover-detail"),n.textContent=d(6117,null),t.appendChild(n),e.hasTrustedException){let s=document.createElement("div");s.classList.add("browser-site-info-hover-detail"),s.textContent=d(6118,null,e.host,e.error),t.appendChild(s);let l=document.createElement("a");l.classList.add("browser-site-info-hover-revoke"),l.textContent=d(6120,null),l.role="button",l.tabIndex=0,l.addEventListener("click",()=>{r?.dispose(),this.editor.revokeAndClose(e)}),l.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),r?.dispose(),this.editor.revokeAndClose(e))}),t.appendChild(l)}let r=this.hoverService.showInstantHover({content:t,target:this._indicator,container:this._container,position:{hoverPosition:2},persistence:{sticky:!0}},!0)}};d5e=I([m(2,ot)],d5e);var S5i=new Y("browserCanGoBack",!1,d(6018,null)),I5i=new Y("browserCanGoForward",!1,d(6019,null)),mle=new Y("browserFocused",!0,d(6032,null)),rA=new Y("browserHasUrl",!1,d(6035,null)),aB=new Y("browserHasError",!1,d(6034,null)),wAn=HTMLElement.prototype.focus,nA=class extends k{constructor(e){super();this.editor=e;this._modelStore=this._register(new O);this._register(e.onDidChangeModel(({model:t,isNew:o})=>{this._modelStore.clear(),t?this.subscribeToModel(t,this._modelStore,o):this.clear()}))}subscribeToModel(e,t,o){}clear(){}get urlBarWidgets(){return[]}get toolbarElements(){return[]}layout(e){}},b5i=class extends k{constructor(i,e,t,o){super();let n=this._register(t.createInstance(Kf,"element",void 0,{position:{hoverPosition:3}})),r=_(".browser-nav-toolbar"),s=t.createChild(new Po([X,o])),l=this._register(s.createInstance(pr,r,R.BrowserNavigationToolbar,{hoverDelegate:n,highlightToggledItems:!0,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0},menuOptions:{shouldForwardArgs:!0}})),c=_(".browser-url-container"),u=_(".browser-site-info-slot");this._siteInfoWidget=this._register(t.createInstance(d5e,u,i)),this._urlInput=_("input.browser-url-input"),this._urlInput.type="text",this._urlInput.placeholder=d(6039,null),this._urlInput.style.display="none";let p=_(".browser-url-input-wrapper");this._urlDisplay=_("span.browser-url-display"),this._urlDisplay.tabIndex=0,p.appendChild(this._urlDisplay),p.appendChild(this._urlInput),this._urlBarWidgetsContainer=_(".browser-url-bar-widgets"),c.appendChild(u),c.appendChild(p),c.appendChild(this._urlBarWidgetsContainer);let h=_(".browser-actions-toolbar"),g=this._register(s.createInstance(pr,h,R.BrowserActionsToolbar,{hoverDelegate:n,highlightToggledItems:!0,toolbarOptions:{primaryGroup:f=>f.startsWith("actions"),useSeparatorsInPrimaryActions:!0},menuOptions:{shouldForwardArgs:!0}}));l.context=i,g.context=i,e.appendChild(r),e.appendChild(c),e.appendChild(h),this._register($(this._urlInput,ne.KEY_DOWN,f=>{if(f.key==="Enter"){let v=this._urlInput.value.trim();v&&i.navigateToUrl(v)}})),this._register($(this._urlInput,ne.FOCUS,()=>{this._urlInput.select()})),this._register($(this._urlInput,ne.BLUR,()=>{this._showDisplay()})),this._register($(this._urlDisplay,ne.FOCUS,()=>{this._showInput()}))}updateFromNavigationEvent(i){this._urlInput.value=i.url,this._updateDisplay()}focusUrlInput(){this._showInput()}setCertificateError(i){this._siteInfoWidget.setCertificateError(i),this._urlInput.classList.toggle("cert-error",!!i),this._updateDisplay()}_showInput(){this._urlDisplay.style.display="none",this._urlInput.style.display="",this._urlInput.select(),this._urlInput.focus()}addUrlBarWidgets(i){let e=i.slice().sort((t,o)=>t.order-o.order);for(let t of e)this._urlBarWidgetsContainer.appendChild(t.element)}_showDisplay(){this._urlInput.style.display="none",this._urlDisplay.style.display="",this._updateDisplay()}_updateDisplay(){let i=this._urlInput.value,e=this._urlInput.classList.contains("cert-error"),t="https:";if(this._urlDisplay.textContent="",this._urlDisplay.classList.toggle("placeholder",!i),e&&i.startsWith(t)){let o=document.createElement("span");o.className="browser-url-display-protocol-bad",o.textContent=t,this._urlDisplay.appendChild(o);let n=document.createElement("span");n.textContent=i.slice(t.length),this._urlDisplay.appendChild(n)}else this._urlDisplay.textContent=i||d(6039,null)}clear(){this._urlInput.value="",this._siteInfoWidget.setCertificateError(void 0),this._updateDisplay()}},Iu=class extends zs{constructor(e,t,o,n,r,s,l,c,u){super(gd.EDITOR_ID,e,t,o,n);this.keybindingService=r;this.logService=s;this.instantiationService=l;this.contextKeyService=c;this.layoutService=u;this._contributionInstances=new Map;this._onDidChangeModel=this._register(new T);this.onDidChangeModel=this._onDidChangeModel.event;this._overlayVisible=!1;this._editorVisible=!1;this._inputDisposables=this._register(new O);this._certActionButton=this._register(new ue)}static{this._contributions=[]}static registerContribution(e){Iu._contributions.push(e)}getContribution(e){return this._contributionInstances.get(e)}get model(){return this._model}get browserContainer(){return this._browserContainer}createEditor(e){let t=this._register(this.contextKeyService.createScoped(e));this.overlayManager=this._register(new vti(this.window)),this._canGoBackContext=S5i.bindTo(t),this._canGoForwardContext=I5i.bindTo(t),this._hasUrlContext=rA.bindTo(t),this._hasErrorContext=aB.bindTo(t),mle.bindTo(t);let o=this._register(this.instantiationService.createChild(new Po([X,t])));for(let h of Iu._contributions){let g=this._register(o.createInstance(h,this));this._contributionInstances.set(h,g)}let n=_(".browser-root");e.appendChild(n);let r=_(".browser-navbar");this._navigationBar=this._register(new b5i(this,r,this.instantiationService,t));let s=[];for(let h of this._contributionInstances.values())s.push(...h.urlBarWidgets);this._navigationBar.addUrlBarWidgets(s),n.appendChild(r);for(let h of this._contributionInstances.values())for(let g of h.toolbarElements)n.appendChild(g);this._browserContainerWrapper=_(".browser-container-wrapper"),this._browserContainerWrapper.style.setProperty("--zoom-factor",String(uv(this.window))),n.appendChild(this._browserContainerWrapper),this._browserContainer=_(".browser-container"),this._browserContainer.tabIndex=0,this._browserContainerWrapper.appendChild(this._browserContainer);let l=_(".browser-placeholder-contents");this._browserContainer.appendChild(l),this._placeholderScreenshot=_(".browser-placeholder-screenshot"),l.appendChild(this._placeholderScreenshot),this._overlayPauseContainer=_(".browser-overlay-paused");let c=_(".browser-overlay-paused-message"),u=_(".browser-overlay-paused-heading"),p=_(".browser-overlay-paused-detail");u.textContent=d(6038,null),p.textContent=d(6037,null),c.appendChild(u),c.appendChild(p),this._overlayPauseContainer.appendChild(c),l.appendChild(this._overlayPauseContainer),this._errorContainer=_(".browser-error-container"),this._errorContainer.style.display="none",l.appendChild(this._errorContainer),this._welcomeContainer=this.createWelcomeContainer(),l.appendChild(this._welcomeContainer),this._register($(this._browserContainer,ne.FOCUS,h=>{h.relatedTarget&&this._model&&this.shouldShowView&&this.requestFocus()})),this._register($(this._browserContainer,ne.BLUR,()=>{this.cancelFocus()})),this._register(rQi(()=>({hasFocus:this._model?.focused??!1,window:this._model?.focused?this.window:void 0})))}focus(){this._model?.url&&!this._model.error?this.requestFocus():this.focusUrlInput()}requestFocus(){this.ensureBrowserFocus(),!this._focusTimeout&&(this._focusTimeout=setTimeout(()=>{this._focusTimeout=void 0,this._model&&this._model.focus()},0))}cancelFocus(){this._focusTimeout&&(clearTimeout(this._focusTimeout),this._focusTimeout=void 0)}async setInput(e,t,o,n){if(await super.setInput(e,t,o,n),n.isCancellationRequested)return;this._inputDisposables.clear();let r=e.model,s=!r;r||(this.updateNavigationState({url:e.url||"",title:e.title||"",canGoBack:!1,canGoForward:!1,certificateError:void 0}),r=await e.resolve()),!(n.isCancellationRequested||this.input!==e)&&(this._model=r,this._onDidChangeModel.fire({model:r,isNew:s}),this.updateNavigationState({url:this._model.url,title:this._model.title,canGoBack:this._model.canGoBack,canGoForward:this._model.canGoForward,certificateError:this._model.certificateError}),this.setBackgroundImage(this._model.screenshot),this._inputDisposables.add(this._model.onWillDispose(()=>{this._model=void 0})),this._inputDisposables.add(this._model.onDidChangeVisibility(()=>this.doScreenshot())),this._inputDisposables.add(this._model.onDidKeyCommand(l=>{this.handleKeyEventFromBrowserView(l)})),this._inputDisposables.add(this._model.onDidNavigate(l=>{this.group.pinEditor(this.input),this.updateNavigationState(l)})),this._inputDisposables.add(this._model.onDidChangeLoadingState(()=>{this.updateErrorDisplay()})),this._inputDisposables.add(this._model.onDidChangeFocus(({focused:l})=>{l&&(this._onDidFocus?.fire(),this.ensureBrowserFocus())})),this._inputDisposables.add(this.overlayManager.onDidChangeOverlayState(()=>{this.checkOverlays()})),this._inputDisposables.add(twe(l=>{l===this.window.vscodeWindowId&&this._browserContainerWrapper.style.setProperty("--zoom-factor",String(uv(this.window)))})),this.updateErrorDisplay(),this.layout(),this.updateVisibility(),this.doScreenshot())}setEditorVisible(e){this._editorVisible=e,this.updateVisibility()}ensureBrowserFocus(){wAn.call(this._browserContainer)}updateVisibility(){let e=!!this._model?.url,t=!!this._model?.error,o=!t&&e,n=o&&this._editorVisible&&this._overlayVisible;if(this._welcomeContainer.style.display=e?"none":"",this._errorContainer.style.display=t?"":"none",this._placeholderScreenshot.style.display=o?"":"none",this._overlayPauseContainer.classList.toggle("visible",n),this._model){let r=this.shouldShowView;if(r===this._model.visible)return;r?(this._model.setVisible(!0),this._browserContainer.ownerDocument.hasFocus()&&this._browserContainer.ownerDocument.activeElement===this._browserContainer&&this.requestFocus()):(this.doScreenshot(),this.window.requestAnimationFrame(()=>this._model?.setVisible(!1)))}}get shouldShowView(){return this._editorVisible&&!this._overlayVisible&&!this._model?.error&&!!this._model?.url}checkOverlays(){if(!this.overlayManager)return;let e=this.overlayManager.getOverlappingOverlays(this._browserContainer),t=e.length>0;this.updateOverlayPauseMessage(e),t!==this._overlayVisible&&(this._overlayVisible=t,this.updateVisibility())}updateOverlayPauseMessage(e){let t=e.some(o=>o.type==="notification");this._overlayPauseContainer.classList.toggle("show-message",t)}updateErrorDisplay(){if(!this._model)return;let e=this._model.error;if(this._hasErrorContext.set(!!e),this._navigationBar.setCertificateError(this._model.certificateError??e?.certificateError),e){for(this._certActionButton.clear();this._errorContainer.firstChild;)this._errorContainer.removeChild(this._errorContainer.firstChild);let t=_(".browser-error-content"),o=!!e.certificateError,n=_(".browser-error-icon");n.classList.toggle("cert-error",o),n.appendChild(un(o?L.workspaceUntrusted:L.globe));let r=_(".browser-error-title");r.textContent=o?d(6025,null):d(6036,null);let s=_(".browser-error-detail"),l=_("span");l.textContent=o?d(6023,null):`${e.errorDescription} (${e.errorCode})`,s.appendChild(l);let c=_(".browser-error-detail"),u=_("strong");u.textContent=d(6033,null);let p=_("code");if(p.textContent=e.url,c.appendChild(u),c.appendChild(document.createTextNode(" ")),c.appendChild(p),t.appendChild(n),t.appendChild(r),t.appendChild(s),e.certificateError){let h=_("b.browser-error-detail");h.textContent=d(6024,null),s.appendChild(h)}if(t.appendChild(c),e.certificateError){let h=e.certificateError,g=_(".browser-cert-details-table"),f=_(".browser-cert-details-heading");f.textContent=d(6021,null),g.appendChild(f);let v=(M,N)=>{let V=_(".browser-cert-details-row"),H=_(".browser-cert-details-label");H.textContent=M;let K=_(".browser-cert-details-value");K.textContent=N,V.appendChild(H),V.appendChild(K),g.appendChild(V)};v(d(6022,null),h.error),v(d(6028,null),h.issuerName),v(d(6030,null),h.subjectName);let b=M=>new Date(M*1e3).toLocaleDateString();v(d(6031,null),`${b(h.validStart)} - ${b(h.validExpiry)}`),v(d(6026,null),h.fingerprint),t.appendChild(g);let S=_(".browser-cert-action");S.classList.toggle("reverse",et||Sn);let y=this._model.canGoBack,w=new sC(S);this._certActionButton.value=w;let x=w.addButton({...Ro});x.label=y?d(6027,null):d(6020,null),x.onDidClick(()=>{y?this.goBack():this.group?.closeEditor(this.input)});let E=w.addButton({...Ro,secondary:!0});E.label=d(6029,null),E.onDidClick(()=>{this._model?.trustCertificate(h.host,h.fingerprint)}),t.appendChild(S)}this._errorContainer.appendChild(t),this.setBackgroundImage(void 0)}else this.setBackgroundImage(this._model.screenshot);this.updateVisibility()}getUrl(){return this._model?.url}getCertificateError(){return this._model?.certificateError}revokeAndClose(e){this._model?.untrustCertificate(e.host,e.fingerprint)}async navigateToUrl(e){this._model&&(this.group.pinEditor(this.input),/^localhost(:|\/|$)/i.test(e)?e="http://"+e:URL.parse(e)?.protocol||(e="http://"+e),this.ensureBrowserFocus(),await this._model.loadURL(e))}focusUrlInput(){this._navigationBar.focusUrlInput()}async goBack(){return this._model?.goBack()}async goForward(){return this._model?.goForward()}async reload(e){return this._model?.reload(e)}async toggleDevTools(){return this._model?.toggleDevTools()}async clearStorage(){return this._model?.clearStorage()}updateNavigationState(e){this._navigationBar.updateFromNavigationEvent(e),this._navigationBar.setCertificateError(e.certificateError),this._canGoBackContext.set(e.canGoBack),this._canGoForwardContext.set(e.canGoForward),this._hasUrlContext.set(!!e.url),this.updateVisibility()}createWelcomeContainer(){let e=_(".browser-welcome-container"),t=_(".browser-welcome-content"),o=_(".browser-welcome-icon");o.appendChild(un(L.globe)),t.appendChild(o);let n=_(".browser-welcome-title");n.textContent=d(6042,null),t.appendChild(n);let r=_(".browser-welcome-subtitle"),s=this.contextKeyService.getContextKeyValue(Z.enabled.key);return r.textContent=s?d(6041,null):d(6040,null),t.appendChild(r),e.appendChild(t),e}setBackgroundImage(e){if(e){let t=`data:image/jpeg;base64,${gc(e)}`;this._placeholderScreenshot.style.backgroundImage=`url('${t}')`}else this._placeholderScreenshot.style.backgroundImage=""}async doScreenshot(){if(this._model&&(this.cancelScheduledScreenshot(),!!this._model.visible)){try{let e=await this._model.captureScreenshot({quality:80});this.setBackgroundImage(e)}catch(e){this.logService.error("Failed to capture browser view screenshot",e)}this._screenshotTimeout=setTimeout(()=>this.doScreenshot(),1e3)}}cancelScheduledScreenshot(){this._screenshotTimeout&&(clearTimeout(this._screenshotTimeout),this._screenshotTimeout=void 0)}async handleKeyEventFromBrowserView(e){try{let t=new KeyboardEvent("keydown",e),o=new mi(t);this.keybindingService.dispatchEvent(o,this._browserContainer)}catch(t){this.logService.error("BrowserEditor.handleKeyEventFromBrowserView: Error dispatching key event",t)}}layout(e,t){if(e)for(let n of this._contributionInstances.values())n.layout(e.width);let o=this.layoutService.whenContainerStylesLoaded(this.window);o?o.then(()=>this.layoutBrowserContainer()):this.layoutBrowserContainer()}layoutBrowserContainer(e=2){if(this._model){this.checkOverlays();let t=this._browserContainer.getBoundingClientRect(),o=this.window.getComputedStyle(this._browserContainer).borderTopLeftRadius??"0";if((t.width===0||t.height===0)&&e>0){this.window.requestAnimationFrame(()=>this.layoutBrowserContainer(e-1));return}this._model.layout({windowId:this.group.windowId,x:t.left,y:t.top,width:t.width,height:t.height,zoomFactor:uv(this.window),cornerRadius:parseFloat(o)})}}clearInput(){this._inputDisposables.clear(),this.cancelScheduledScreenshot(),this.cancelFocus(),this._model?.setVisible(!1),this._model=void 0,this._onDidChangeModel.fire({model:void 0,isNew:!1}),this._canGoBackContext.reset(),this._canGoForwardContext.reset(),this._hasUrlContext.reset(),this._hasErrorContext.reset(),this._navigationBar.clear(),this.setBackgroundImage(void 0),super.clearInput()}};Iu=I([m(1,_e),m(2,Pe),m(3,de),m(4,Le),m(5,re),m(6,F),m(7,X),m(8,Kl)],Iu);var Hft="workbench.browser.agentHostChatToolsEnabled",CAn=[Ld.GoBack,Ld.GoForward,Ld.Reload],_j=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h){super();this.instantiationService=t;this.workspaceContextService=o;this.keybindingService=n;this.editorService=r;this.editorGroupsService=s;this.configurationService=l;this.workspaceTrustManagementService=c;this.logService=u;this.contextKeyService=p;this.themeService=h;this._known=new Map;this._onDidChangeBrowserViews=this._register(new T);this.onDidChangeBrowserViews=this._onDidChangeBrowserViews.event;this._isSharingAvailable=!1;this._onDidChangeSharingAvailable=this._register(new T);this.onDidChangeSharingAvailable=this._onDidChangeSharingAvailable.event;let g=e.getChannel(uho);this._browserViewService=Xd.toService(g),this._mainWindowId=ut.vscodeWindowId,this.sendKeybindings(),this._register(this.keybindingService.onDidUpdateKeybindings(()=>this.sendKeybindings())),this.sendTheme(),this._register(this.themeService.onDidColorThemeChange(()=>this.sendTheme())),this.sendConfiguration();let f=new Set(Z.enabled.keys());this._register(this.contextKeyService.onDidChangeContext(b=>{b.affectsSome(f)&&this.sendConfiguration()})),this._isSharingAvailable=this.contextKeyService.contextMatchesRules(_j._sharingAvailableContext);let v=new Set(_j._sharingAvailableContext.keys());this._register(this.contextKeyService.onDidChangeContext(b=>{if(b.affectsSome(v)){let S=this._isSharingAvailable;this._isSharingAvailable=this.contextKeyService.contextMatchesRules(_j._sharingAvailableContext),S!==this._isSharingAvailable&&this._onDidChangeSharingAvailable.fire(this._isSharingAvailable)}})),this._initializeExistingViews().catch(b=>{this.logService.error("[BrowserViewWorkbenchService] Failed to initialize existing browser views.",b)}),this._register(this._browserViewService.onDidCreateBrowserView(b=>{if(b.info.owner.mainWindowId!==this._mainWindowId)return;this._createModel(b.info.id,b.info.owner,b.info.state);let S=this._known.get(b.info.id);S&&b.openOptions&&this._openEditorForCreatedView(S,b.openOptions)}))}static{this._sharingAvailableContext=C.and(Z.enabled,C.has("config.chat.agent.enabled"),C.has("config.workbench.browser.enableChatTools"),C.or(qo.negate(),C.and(qo,C.has(`config.${mk}`),C.has(`config.${Hft}`))))}get isSharingAvailable(){return this._isSharingAvailable}getKnownBrowserViews(){return this._known}getOrCreateLazy(e,t,o){if(!this._known.has(e)){let n=this.instantiationService.createInstance(gd,{id:e,...t},async()=>{let r=await this._browserViewService.getOrCreateBrowserView(e,{owner:this._getDefaultOwner(),scope:await this._resolveStorageScope(),initialState:{url:t?.url,title:t?.title,lastFavicon:t?.favicon}});return this._createModel(e,this._getDefaultOwner(),r)});n.onWillDispose(()=>{this._known.delete(e),this._onDidChangeBrowserViews.fire()}),o&&(n.model=o),this._known.set(e,n),this._onDidChangeBrowserViews.fire()}return this._known.get(e)}async clearGlobalStorage(){return this._browserViewService.clearGlobalStorage()}async clearWorkspaceStorage(){let e=this.workspaceContextService.getWorkspace().id;return this._browserViewService.clearWorkspaceStorage(e)}_getDefaultOwner(){return{mainWindowId:this._mainWindowId}}async _resolveStorageScope(){let e=this.configurationService.getValue("workbench.browser.dataStorage")??"global";return await this.workspaceTrustManagementService.workspaceTrustInitialized,this.workspaceContextService.getWorkbenchState()!==1&&!this.workspaceTrustManagementService.isWorkspaceTrusted()?"ephemeral":e}async _initializeExistingViews(){let e=await this._browserViewService.getBrowserViews(this._mainWindowId);for(let t of e)this._createModel(t.id,t.owner,t.state)}_createModel(e,t,o){let n=this._known.get(e)?.model;if(n)return n;let r=this.instantiationService.createInstance(L8,e,t,o,this._browserViewService);return this.getOrCreateLazy(e,{},r).model=r,this._onDidChangeBrowserViews.fire(),r}_openEditorForCreatedView(e,t){let o=t,n;if(o.auxiliaryWindow)n=ff;else if(o.parentViewId&&(n=this._findEditorGroupForView(o.parentViewId),n===void 0))return;this.editorService.openEditor(e,{inactive:o.background,preserveFocus:o.preserveFocus,pinned:o.pinned,auxiliary:o.auxiliaryWindow?{bounds:o.auxiliaryWindow,compact:!0}:void 0},n)}_findEditorGroupForView(e){for(let t of this.editorGroupsService.groups)for(let o of t.editors)if(o instanceof gd&&o.id===e)return t.id}sendKeybindings(){let e=Object.create(null);for(let t of CAn){let n=this.keybindingService.lookupKeybinding(t)?.getElectronAccelerator();n&&(e[t]=n)}this._browserViewService.updateKeybindings(e)}sendTheme(){let e=this.themeService.getColorTheme();this._browserViewService.updateTheme({focusBorder:e.getColor(Kc)?.toString(),buttonBackground:e.getColor(th)?.toString(),buttonForeground:e.getColor(Fk)?.toString(),font:WF})}sendConfiguration(){this._browserViewService.updateConfiguration({aiFeaturesDisabled:!this.contextKeyService.contextMatchesRules(Z.enabled)})}};_j=I([m(0,rm),m(1,F),m(2,Ae),m(3,Le),m(4,ie),m(5,kt),m(6,B),m(7,Or),m(8,re),m(9,X),m(10,Pe)],_j);var EUo="browserViewGroup";var u5e=class extends k{constructor(i){super();let e=i.getChannel(EUo);this._groupService=Xd.toService(e)}async createSessionGroup(i){let e=await this._groupService.createGroup({mainWindowId:ut.vscodeWindowId});return await this._groupService.addViewToGroup(e,i),e}async destroySessionGroup(i){await this._groupService.destroyGroup(i)}async sendCDPMessage(i,e){await this._groupService.sendCDPMessage(i,e)}onCDPMessage(i){return this._groupService.onDynamicCDPMessage(i)}onDidDestroy(i){return this._groupService.onDynamicDidDestroy(i)}};u5e=I([m(0,rm)],u5e);var gI=C.equals("activeEditor",gd.EDITOR_ID),Sh=P(6051,"Browser");var y5i=class a extends z{static{this.ID=Ld.GoBack}constructor(){super({id:a.ID,title:P(6045,"Go Back"),category:Sh,icon:L.arrowLeft,f1:!0,precondition:C.and(gI,S5i),menu:{id:R.BrowserNavigationToolbar,group:"navigation",order:1},keybinding:{weight:250,primary:527,secondary:[122],mac:{primary:2140,secondary:[122,2063]}}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.goBack()}},w5i=class a extends z{static{this.ID=Ld.GoForward}constructor(){super({id:a.ID,title:P(6046,"Go Forward"),category:Sh,icon:L.arrowRight,f1:!0,precondition:C.and(gI,I5i),menu:{id:R.BrowserNavigationToolbar,group:"navigation",order:2},keybinding:{weight:250,primary:529,secondary:[123],mac:{primary:2142,secondary:[123,2065]}}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.goForward()}},C5i=class a extends z{static{this.ID=Ld.Reload}constructor(){super({id:a.ID,title:P(6050,"Reload"),category:Sh,icon:L.refresh,f1:!0,precondition:gI,menu:{id:R.BrowserNavigationToolbar,group:"navigation",order:3,alt:{id:bti.ID,title:P(6047,"Hard Reload"),icon:L.refresh}},keybinding:{when:mle,weight:275,primary:2096,secondary:[63],mac:{primary:2096,secondary:[]}}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.reload()}},bti=class a extends z{static{this.ID=Ld.HardReload}constructor(){super({id:a.ID,title:P(6047,"Hard Reload"),category:Sh,icon:L.refresh,f1:!0,precondition:gI,keybinding:{when:mle,weight:275,primary:3120,secondary:[2111],mac:{primary:3120,secondary:[]}}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.reload(!0)}},x5i=class a extends z{static{this.ID=Ld.FocusUrlInput}constructor(){super({id:a.ID,title:P(6044,"Focus URL Input"),category:Sh,f1:!0,precondition:gI,keybinding:{weight:200,primary:2090}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.focusUrlInput()}},k5i=class a extends z{static{this.ID=Ld.OpenExternal}constructor(){super({id:a.ID,title:P(6048,"Open in External Browser"),category:Sh,icon:L.linkExternal,f1:!0,precondition:C.and(gI,rA),menu:{id:R.BrowserActionsToolbar,group:"3_page",order:10}})}async run(i,e=i.get(ie).activeEditorPane){if(e instanceof Iu){let t=e.getUrl();t&&await i.get(Je).open(t,{openExternal:!0,allowContributedOpeners:!1})}}},E5i=class a extends z{static{this.ID=Ld.OpenSettings}constructor(){super({id:a.ID,title:P(6049,"Open Browser Settings"),category:Sh,icon:L.settingsGear,f1:!1,menu:{id:R.BrowserActionsToolbar,group:"4_settings",order:2}})}async run(i){let e=i.get(Qo),t=i.get(X),o=["workbench.browser.*","chat.sendElementsToChat.*"];qo.getValue(t)&&o.push(Hft),await e.openSettings({query:`@id:${o.join(",")}`})}};W(y5i);W(w5i);W(C5i);W(bti);W(x5i);W(k5i);W(E5i);var zft=new Y("browserStorageScope","",d(6059,null)),Uft=class extends nA{constructor(i,e){super(i),this._storageScopeContext=zft.bindTo(e)}subscribeToModel(i,e){this._storageScopeContext.set(i.storageScope)}clear(){this._storageScopeContext.reset()}};Uft=I([m(1,X)],Uft);Iu.registerContribution(Uft);var T5i=class a extends z{static{this.ID=Ld.ClearGlobalStorage}constructor(){super({id:a.ID,title:P(6053,"Clear Storage (Global)"),category:Sh,icon:L.clearAll,f1:!0,menu:{id:R.BrowserActionsToolbar,group:"4_settings",order:1,when:C.equals(zft.key,"global")}})}async run(i){await i.get(Bm).clearGlobalStorage()}},_5i=class a extends z{static{this.ID=Ld.ClearWorkspaceStorage}constructor(){super({id:a.ID,title:P(6054,"Clear Storage (Workspace)"),category:Sh,icon:L.clearAll,f1:!0,menu:{id:R.BrowserActionsToolbar,group:"4_settings",order:1,when:C.equals(zft.key,"workspace")}})}async run(i){await i.get(Bm).clearWorkspaceStorage()}},D5i=class a extends z{static{this.ID=Ld.ClearEphemeralStorage}constructor(){super({id:a.ID,title:P(6052,"Clear Storage (Ephemeral)"),category:Sh,icon:L.clearAll,f1:!0,precondition:C.equals(zft.key,"ephemeral"),menu:{id:R.BrowserActionsToolbar,group:"4_settings",order:1,when:C.equals(zft.key,"ephemeral")}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.clearStorage()}};W(T5i);W(_5i);W(D5i);oe.as($t.Configuration).registerConfiguration({...jd,properties:{"workbench.browser.dataStorage":{type:"string",enum:["global","workspace","ephemeral"],markdownEnumDescriptions:[d(6057,null),d(6058,null),d(6056,null)],restricted:!0,default:"global",markdownDescription:d(6055,null),scope:4,order:100}}});var TUo=new Y("browserDevToolsOpen",!1,d(6060,null)),Kft=class extends nA{constructor(i,e){super(i),this._devToolsOpenContext=TUo.bindTo(e)}subscribeToModel(i,e){this._devToolsOpenContext.set(i.isDevToolsOpen),e.add(i.onDidChangeDevToolsState(t=>{this._devToolsOpenContext.set(t.isDevToolsOpen)}))}clear(){this._devToolsOpenContext.reset()}};Kft=I([m(1,X)],Kft);Iu.registerContribution(Kft);var L5i=class a extends z{static{this.ID=Ld.ToggleDevTools}constructor(){super({id:a.ID,title:P(6061,"Toggle Developer Tools"),category:Sh,icon:L.terminal,f1:!0,precondition:C.and(gI,rA,aB.negate()),toggled:C.equals(TUo.key,!0),menu:{id:R.BrowserActionsToolbar,group:"actions",order:3},keybinding:{weight:200,primary:70}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.toggleDevTools()}};W(L5i);var xye=d(6123,null);function Sy(a){return a.context?.sessionResource?.toString()??"<default>"}function M5i(a,i,e){let t=a.activeEditor,o=new Set(a.visibleEditors),n=e?.indent??"",r=e?.agentNetworkFilterService;return i.map((s,l)=>{let c=s.url||"about:blank",u=!1;if(r&&c!=="about:blank")try{u=!r.isUriAllowed(A.parse(c))}catch{}let p=u?d(6122,null):s.title||"Untitled",h=u?"":` (${c})`,g=s===t?" (active)":o.has(s)?" (visible)":" (not visible)",f=e?.excludeIds?"":`[${s.id}] `,v=e?.numbered??e?.excludeIds?`${l+1}. `:"- ";return`${n}${v}${f}${p}${h}${g}`}).join(`
`)}function Dw(a){return typeof a=="string"&&(a=cS.forId(a)),`[${gd.DEFAULT_LABEL}](${a.toString()}?vscodeLinkType=browser)`}async function _Uo(a,i,e,t,...o){return a.invokeFunctionRaw(i,e,t.toString(),...o)}async function eT(a,i,e,t,...o){try{let n=await a.invokeFunction(i,e,t.toString(),o);return Sti(n)}catch(n){return $m(n instanceof Error?n.message:String(n))}}function Sti(a,i){let e=[];return a.result!==void 0&&e.push({kind:"text",value:`Result: ${JSON.stringify(a.result)}`}),a.error&&e.push({kind:"text",value:a.error}),a.deferredResultId&&e.push({kind:"text",value:`[deferredResultId=${a.deferredResultId}] The code has not finished executing yet. Call run_playwright_code again with this deferredResultId and the same pageId (no code) to continue waiting.`}),e.push({kind:"text",value:a.summary}),{content:e,...i?{toolResultDetails:{input:i,inputLanguage:"javascript",output:a.result||a.error?[{type:"embed",isText:!0,value:JSON.stringify(a.result??a.error,null,2)}]:[],isError:!!a.error}}:{}}}function $m(a){return{content:[{kind:"text",value:a}],toolResultError:a}}function Gft(a,i,e){let t=URL.parse(i);if(!t||t.protocol!=="file:"&&!t.host)return[];let o=[];for(let n of a.getKnownBrowserViews().values()){if(!(n instanceof gd)||e?.sharingState&&n.model?.sharingState!==e.sharingState)continue;let r=URL.parse(n.url||"");(e?.includeBlank&&(!n.url||n.url==="about:blank")||r?.host===t.host||t.protocol==="file:"&&r?.protocol==="file:"||r?.host&&t.host&&(r.host.endsWith("."+t.host)||t.host.endsWith("."+r.host)))&&o.push(n)}return o}async function Iti(a,i,e){if(i.length===0)return;let t=M5i(a,i,{indent:"  ",...e}),o=i.map(n=>Dw(n.id));return{content:[{kind:"text",value:`At least one similar page is already open:
${t}

Use an existing page or pass \`forceNew: true\` to open a new one.`}],toolResultMessage:new he(d(6124,null,o.join(", ")))}}var ex="open_browser_page",m5e={id:ex,toolReferenceName:fy.OpenBrowserPage,displayName:d(6174,null),userDescription:d(6175,null),modelDescription:`Open a new browser page in the integrated browser at the given URL.
May prompt the user to share a page if there is a similar one already open, unless "forceNew" is true.
Returns a page ID that must be used with other browser tools to interact with the page, as well as an accessibility snapshot of the page.

Important: Prefer to reuse existing pages whenever possible and only call this tool if you do not already have access to a tab you can reuse.`,icon:L.openInProduct,source:wn.Internal,inputSchema:{type:"object",properties:{url:{type:"string",description:"The URL to open in the browser. Must be an absolute URI with a scheme such as file:, http:, or https:. For local files, use the canonical absolute form, for example file:///path/to/file."},forceNew:{type:"boolean",description:"Whether to force opening a new page even if a page with the same host already exists. Default is false."}},$comment:'If you omit "url", the user will be prompted to share an existing page instead. Use this if there are unshared pages that the user may be interested in sharing with you.'}},yti="__decline__",p5e=class{constructor(i,e,t,o,n,r,s){this.playwrightService=i;this.editorService=e;this.browserViewService=t;this.agentNetworkFilterService=o;this.chatService=n;this.configService=r;this.logService=s}async prepareToolInvocation(i,e){let t=i.parameters;if(!t.url)return{invocationMessage:d(6167,null),pastTenseMessage:d(6168,null)};let o=URL.parse(t.url);if(!o)throw new Error("You must provide a complete, valid URL.");t.url=o.href;let n=A.parse(t.url);if(!this.agentNetworkFilterService.isUriAllowed(n))throw new Error(this.agentNetworkFilterService.formatError(n));return{invocationMessage:d(6163,null,o.href),pastTenseMessage:d(6166,null,o.href),confirmationMessages:{title:d(6162,null),message:d(6161,null,o.href),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.url){let s=[...this.browserViewService.getKnownBrowserViews().values()];if(s.length===0)return{content:[{kind:"text",value:"No browser pages are currently open."}]};let l=await this._promptForUnsharedPages(i,s,n,o);return l||{content:[{kind:"text",value:"The user opted not to share an existing page."}]}}if(!n.forceNew){let s=Gft(this.browserViewService,n.url,{includeBlank:!0,sharingState:"shared"}),l=await Iti(this.editorService,s,{agentNetworkFilterService:this.agentNetworkFilterService});if(l)return l;let c=Gft(this.browserViewService,n.url,{includeBlank:!1,sharingState:"notShared"});if(c.length>0){let u=await this._promptForUnsharedPages(i,c,n,o);if(u)return u}}return this._openNewPage(r,n.url)}async _promptForUnsharedPages(i,e,t,o){let n=i.context?.sessionResource,r=i.chatRequestId,s=this._getRequest(n,r);if(!s||s.modeInfo?.permissionLevel==="autopilot"||this.configService.getValue("chat.autoReply"))return;let l=this._buildShareCarousel(e,t.url,i.chatStreamToolCallId??i.callId);this.chatService.appendProgress(s,l);let c=this.chatService.onDidReceiveQuestionCarouselAnswer(g=>{g.resolveId!==l.resolveId||l.isUsed||l.dismiss(g.answers)}),u;try{u=await Ea(l.completion.p,o)}catch(g){throw g instanceof qi&&l.dismiss(void 0),g}finally{c.dispose()}if(!u||o.isCancellationRequested)throw l.dismiss(void 0),new qi;let p=this._extractSelectedOption(u.answers);if(!p||p===yti)return;let h=this.browserViewService.getKnownBrowserViews().get(p);if(!h){this.logService.warn(`[OpenBrowserTool] Selected option '${p}' not found.`);return}return this._shareExistingPage(Sy(i),h)}_buildShareCarousel(i,e,t){let o=[];for(let r of i){let s=(r.title||r.getName()).replaceAll(" - ","\xA0-\xA0"),l=r.url||"about:blank",c=l.length>40?l.substring(0,40)+"\u2026":l;o.push({id:r.id,label:d(6171,null,s,c),value:r.id})}o.push({id:yti,label:e?d(6164,null,e):d(6165,null),value:yti});let n={id:`${t}:0`,type:"singleSelect",title:d(6173,null),message:d(6172,null),options:o,defaultValue:yti,allowFreeformInput:!1};return new nI([n],!0,t)}_extractSelectedOption(i){if(i)for(let e of Object.values(i)){if(typeof e=="string")return e;if(typeof e=="object"&&e!==null&&yo(e,{selectedValue:!0}))return e.selectedValue}}async _openNewPage(i,e){let{pageId:t,summary:o}=await this.playwrightService.openPage(i,e);return this._pageResult(t,o,d(6169,null,Dw(t)))}async _shareExistingPage(i,e){let t=await e.resolve();if(t.sharingState!=="shared"&&!await t.setSharedWithAgent(!0))return{content:[{kind:"text",value:"The user declined to share the page."}]};let o=await this.playwrightService.getSummary(i,e.id);return this._pageResult(e.id,o,d(6170,null,Dw(e.id)))}_pageResult(i,e,t){return{content:[{kind:"text",value:`Page ID: ${i}

Summary:
`},{kind:"text",value:e}],toolResultMessage:new he(t)}}_getRequest(i,e){if(!i)return;let t=this.chatService.getSession(i);if(t){if(e){let o=t.getRequests().find(n=>n.id===e);if(o)return o}return t.getRequests().at(-1)}}};p5e=I([m(0,tv),m(1,ie),m(2,Bm),m(3,bW),m(4,si),m(5,B),m(6,re)],p5e);var P5i={id:"click_element",toolReferenceName:fy.ClickElement,displayName:d(6135,null),userDescription:d(6136,null),modelDescription:"Click on an element in a browser page.",icon:L.cursor,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},ref:{type:"string",description:"Element reference to click."},selector:{type:"string",description:'Playwright selector of the element to click when "ref" is not available.'},element:{type:"string",description:'Human-readable description of the element to click (e.g., "submit button", "search icon").'},dblClick:{type:"boolean",description:"Set to true for double clicks. Default is false."},button:{type:"string",enum:["left","right","middle"],description:'Mouse button to click with. Default is "left".'}},required:["pageId","element"],$comment:'One of "ref" or "selector" is required.'}},h5e=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters,o=Dw(t.pageId),n=Ru(t.element??xye);return{invocationMessage:t.button==="right"?new he(d(6129,null,n,o)):t.button==="middle"?new he(d(6128,null,n,o)):t.dblClick?new he(d(6133,null,n,o)):new he(d(6127,null,n,o)),pastTenseMessage:t.button==="right"?new he(d(6132,null,n,o)):t.button==="middle"?new he(d(6131,null,n,o)):t.dblClick?new he(d(6134,null,n,o)):new he(d(6130,null,n,o))}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);let s=n.selector;if(n.ref&&(s=`aria-ref=${n.ref}`),!s)return $m('Either a "ref" or "selector" parameter is required.');let l=n.button??"left";return n.dblClick?eT(this.playwrightService,r,n.pageId,(c,u,p)=>c.locator(u).dblclick({button:p}),s,l):eT(this.playwrightService,r,n.pageId,(c,u,p)=>c.locator(u).click({button:p}),s,l)}};h5e=I([m(0,tv)],h5e);var A5i={id:"drag_element",toolReferenceName:fy.DragElement,displayName:d(6139,null),userDescription:d(6140,null),modelDescription:"Drag an element over another element in a browser page.",icon:L.move,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},fromRef:{type:"string",description:"Element reference of the element to drag."},fromSelector:{type:"string",description:'Playwright selector of the element to drag when "fromRef" is not available.'},fromElement:{type:"string",description:'Human-readable description of the element to drag (e.g., "file item", "draggable card").'},toRef:{type:"string",description:"Element reference of the element to drop onto."},toSelector:{type:"string",description:'Playwright selector of the element to drop onto when "toRef" is not available.'},toElement:{type:"string",description:'Human-readable description of the element to drop onto (e.g., "drop zone", "target folder").'}},required:["pageId","fromElement","toElement"],$comment:'One of "fromRef" or "fromSelector" is required, and one of "toRef" or "toSelector" is required.'}},g5e=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters,o=Dw(t.pageId),n=Ru(t.fromElement??xye),r=Ru(t.toElement??xye);return{invocationMessage:new he(d(6137,null,n,r,o)),pastTenseMessage:new he(d(6138,null,n,r,o))}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);let s=n.fromSelector;if(n.fromRef&&(s=`aria-ref=${n.fromRef}`),!s)return $m('Either a "fromRef" or "fromSelector" parameter is required for the source element.');let l=n.toSelector;return n.toRef&&(l=`aria-ref=${n.toRef}`),l?eT(this.playwrightService,r,n.pageId,(c,u,p)=>c.dragAndDrop(u,p),s,l):$m('Either a "toRef" or "toSelector" parameter is required for the target element.')}};g5e=I([m(0,tv)],g5e);var N5i={id:"handle_dialog",toolReferenceName:fy.HandleDialog,displayName:d(6143,null),userDescription:d(6144,null),modelDescription:"Respond to a pending modal (alert, confirm, prompt) or file chooser dialog on a browser page.",icon:L.comment,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},acceptModal:{type:"boolean",description:"Whether to accept (true) or dismiss (false) a modal dialog."},promptText:{type:"string",description:"Text to enter into a prompt dialog."},selectFiles:{type:"array",items:{type:"string"},description:"Absolute paths of files to select, or empty to dismiss. Required for file chooser dialogs."}},required:["pageId"]}},f5e=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=Dw(i.parameters.pageId);return{invocationMessage:new he(d(6141,null,t)),pastTenseMessage:new he(d(6142,null,t))}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);if(n.selectFiles!==void 0&&(n.acceptModal!==void 0||n.promptText!==void 0))return $m("Invalid parameters. 'selectFiles' cannot be used with 'acceptModal' or 'promptText'.");if(!Array.isArray(n.selectFiles)&&(n.acceptModal===void 0||n.acceptModal===null))return $m("Invalid parameters. Either 'selectFiles' or 'acceptModal' must be provided.");try{let s;return n.selectFiles!==void 0?s=await this.playwrightService.replyToFileChooser(r,n.pageId,n.selectFiles):s=await this.playwrightService.replyToDialog(r,n.pageId,n.acceptModal,n.promptText),{content:[{kind:"text",value:s.summary}]}}catch(s){return $m(s instanceof Error?s.message:String(s))}}};f5e=I([m(0,tv)],f5e);var O5i={id:"hover_element",toolReferenceName:fy.HoverElement,displayName:d(6147,null),userDescription:d(6148,null),modelDescription:"Hover over an element in a browser page. Provide either a Playwright selector or an element reference.",icon:L.cursor,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},ref:{type:"string",description:"Element reference to hover over."},selector:{type:"string",description:'Playwright selector of the element to hover over when "ref" is not available.'},element:{type:"string",description:'Human-readable description of the element to hover over (e.g., "navigation menu", "tooltip trigger").'}},required:["pageId","element"],$comment:'One of "ref" or "selector" is required.'}},v5e=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters,o=Dw(t.pageId),n=Ru(t.element??xye);return{invocationMessage:new he(d(6145,null,n,o)),pastTenseMessage:new he(d(6146,null,n,o))}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);let s=n.selector;return n.ref&&(s=`aria-ref=${n.ref}`),s?eT(this.playwrightService,r,n.pageId,(l,c)=>l.locator(c).hover(),s):$m('Either a "ref" or "selector" parameter is required.')}};v5e=I([m(0,tv)],v5e);var F5i={id:"navigate_page",toolReferenceName:fy.NavigatePage,displayName:d(6159,null),userDescription:d(6160,null),modelDescription:"Navigate a browser page by URL, history, or reload.",icon:L.arrowRight,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID to navigate, acquired from context or the open tool."},type:{type:"string",enum:["url","back","forward","reload"],description:'Navigation type: "url" to navigate to a URL (default, requires "url" param), "back" or "forward" for history, "reload" to refresh.'},url:{type:"string",description:'The URL to navigate to. Required when type is "url".'}},required:["pageId"]}},b5e=class{constructor(i,e){this.playwrightService=i;this.agentNetworkFilterService=e}async prepareToolInvocation(i,e){let t=i.parameters,o=Dw(t.pageId);switch(t.type){case"reload":return{invocationMessage:new he(d(6157,null,o)),pastTenseMessage:new he(d(6158,null,o)),icon:L.refresh};case"back":return{invocationMessage:new he(d(6149,null,o)),pastTenseMessage:new he(d(6150,null,o)),icon:L.arrowLeft};case"forward":return{invocationMessage:new he(d(6151,null,o)),pastTenseMessage:new he(d(6152,null,o)),icon:L.arrowRight};default:{if(!t.url)throw new Error('The "url" parameter is required when type is "url".');let n=URL.parse(t.url);if(!n)throw new Error("You must provide a complete, valid URL.");let r=A.parse(t.url);if(!this.agentNetworkFilterService.isUriAllowed(r))throw new Error(this.agentNetworkFilterService.formatError(r));return{invocationMessage:new he(d(6155,null,n.href,o)),pastTenseMessage:new he(d(6156,null,n.href,o)),confirmationMessages:{title:d(6154,null),message:d(6153,null,n.href),allowAutoConfirm:!0}}}}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);switch(n.type){case"reload":return eT(this.playwrightService,r,n.pageId,s=>s.reload({waitUntil:"domcontentloaded"}));case"back":return eT(this.playwrightService,r,n.pageId,s=>s.goBack({waitUntil:"domcontentloaded"}));case"forward":return eT(this.playwrightService,r,n.pageId,s=>s.goForward({waitUntil:"domcontentloaded"}));default:return eT(this.playwrightService,r,n.pageId,(s,l)=>s.goto(l,{waitUntil:"domcontentloaded"}),n.url)}}};b5e=I([m(0,tv),m(1,bW)],b5e);var W5i={...m5e,modelDescription:"Open a new browser page in the integrated browser at the given URL.",inputSchema:{...m5e.inputSchema,required:["url"],$comment:void 0}},S5e=class{constructor(i,e,t){this.telemetryService=i;this.editorService=e;this.browserViewService=t}async prepareToolInvocation(i,e){let t=i.parameters;if(!t.url)throw new Error('The "url" parameter is required.');let o=URL.parse(t.url);if(!o)throw new Error("You must provide a complete, valid URL.");return{invocationMessage:d(6178,null,o.href),pastTenseMessage:d(6179,null,o.href),confirmationMessages:{title:d(6177,null),message:d(6176,null,o.href),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters;if(!n.forceNew){let s=Gft(this.browserViewService,n.url),l=await Iti(this.editorService,s,{excludeIds:!0});if(l)return l}PG(this.telemetryService,"chatTool");let r=cS.forId(ht());return await this.editorService.openEditor({resource:r,options:{pinned:!0,preserveFocus:!0,viewState:{url:n.url}}}),{content:[{kind:"text",value:"Page opened successfully. Note that you do not have access to the page contents unless the user enables agentic tools via the `workbench.browser.enableChatTools` setting."}],toolResultMessage:new he(d(6180,null,Dw(r)))}}};S5e=I([m(0,_e),m(1,ie),m(2,Bm)],S5e);var qft={id:"read_page",toolReferenceName:fy.ReadPage,displayName:d(6183,null),userDescription:d(6184,null),modelDescription:"Get a snapshot of the current browser page state. This is better than screenshot.",icon:L.fileText,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID to read, acquired from context or the open tool."}},required:["pageId"]}},I5e=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=Dw(i.parameters.pageId);return{invocationMessage:new he(d(6181,null,t)),pastTenseMessage:new he(d(6182,null,t))}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);let s=await this.playwrightService.getSummary(r,n.pageId);return s?{content:[{kind:"text",value:s}]}:$m("No page summary available.")}};I5e=I([m(0,tv)],I5e);var V5i={id:"run_playwright_code",toolReferenceName:fy.RunPlaywrightCode,displayName:d(6191,null),userDescription:d(6192,null),modelDescription:"Run a Playwright code snippet to control a browser page. Only use this if other browser tools are insufficient.",icon:L.terminal,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},code:{type:"string",description:'The Playwright code to execute. The code must be concise, serve one clear purpose, and be self-contained. You **must not** directly access `document` or `window` using this tool. You must access it via the provided `page` object, e.g. "return page.evaluate(() => document.title)". Omit this when resuming a deferred execution via deferredResultId.'},deferredResultId:{type:"string",description:"If a previous call returned a deferredResultId, pass it here to continue waiting for that execution to complete."},timeoutMs:{type:"number",description:"Maximum time in milliseconds to wait for the code to complete. Defaults to 5000 (5 seconds)."}},required:["pageId"],$comment:'Either "code" or "deferredResultId" must be provided.'}},y5e=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters;if(t.deferredResultId)return{invocationMessage:new he(d(6189,null)),pastTenseMessage:new he(d(6190,null))};let o=t.code??"";return{invocationMessage:new he(d(6187,null)),pastTenseMessage:new he(d(6188,null)),confirmationMessages:{title:d(6186,null),message:new he(`\`\`\`javascript
${o.trim()}
\`\`\``),disclaimer:d(6185,null),allowAutoConfirm:!0}}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);if(n.deferredResultId)try{let l=await this.playwrightService.waitForDeferredResult(r,n.deferredResultId,n.timeoutMs??5e3);return Sti(l)}catch(l){return $m(l instanceof Error?l.message:String(l))}if(!n.code)return $m('Either "code" or "deferredResultId" must be provided.');let s;try{s=await this.playwrightService.invokeFunction(r,n.pageId,`async (page) => { ${n.code} }`,void 0,n.timeoutMs??5e3)}catch(l){let c=l instanceof Error?l.message:String(l);return $m(`Code execution failed: ${c}`)}return Sti(s,n.code.trim())}};y5e=I([m(0,tv)],y5e);function DUo(a){let i=a.buffer;if(!(i.length<12)){if(i[0]===255&&i[1]===216)return xAn(i);if(i[0]===137&&i[1]===80&&i[2]===78&&i[3]===71&&i[4]===13&&i[5]===10&&i[6]===26&&i[7]===10)return kAn(i);if(i[0]===71&&i[1]===73&&i[2]===70&&i[3]===56&&(i[4]===55||i[4]===57)&&i[5]===97)return EAn(i);if(i[0]===82&&i[1]===73&&i[2]===70&&i[3]===70&&i[8]===87&&i[9]===69&&i[10]===66&&i[11]===80)return TAn(i)}}function xAn(a){let i=2;for(;i<a.length-9;){for(;i<a.length&&a[i]===255;)i++;if(i>=a.length)return;let e=a[i];if(i++,e===216||e===217||e===1||e>=208&&e<=215)continue;if(i+1>=a.length)return;let t=a[i]<<8|a[i+1];if(t<2)return;if(e>=192&&e<=207&&e!==196&&e!==200&&e!==204){if(i+6>=a.length)return;let o=a[i+3]<<8|a[i+4];return{width:a[i+5]<<8|a[i+6],height:o}}i+=t}}function kAn(a){if(a.length<24||a[12]!==73||a[13]!==72||a[14]!==68||a[15]!==82)return;let i=(a[16]<<24|a[17]<<16|a[18]<<8|a[19])>>>0,e=(a[20]<<24|a[21]<<16|a[22]<<8|a[23])>>>0;return{width:i,height:e}}function EAn(a){if(a.length<10)return;let i=a[6]|a[7]<<8,e=a[8]|a[9]<<8;return{width:i,height:e}}function TAn(a){if(a.length<30)return;let i=(a[16]|a[17]<<8|a[18]<<16|a[19]<<24)>>>0;if(!(i>a.length-20)){if(a[12]===86&&a[13]===80&&a[14]===56&&a[15]===32){if(i<10||a[23]!==157||a[24]!==1||a[25]!==42)return;let e=(a[26]|a[27]<<8)&16383,t=(a[28]|a[29]<<8)&16383;return{width:e,height:t}}if(a[12]===86&&a[13]===80&&a[14]===56&&a[15]===76){if(i<5||a[20]!==47)return;let e=((a[21]|a[22]<<8)&16383)+1,t=((a[22]>>6|a[23]<<2|(a[24]&15)<<10)&16383)+1;return{width:e,height:t}}if(a[12]===86&&a[13]===80&&a[14]===56&&a[15]===88){if(i<10)return;let e=((a[24]|a[25]<<8|a[26]<<16)&16777215)+1,t=((a[27]|a[28]<<8|a[29]<<16)&16777215)+1;return{width:e,height:t}}}}var B5i={id:"screenshot_page",toolReferenceName:fy.ScreenshotPage,displayName:d(6197,null),userDescription:d(6198,null),modelDescription:`Capture a screenshot of the current browser page. You can't perform actions based on the screenshot; use ${qft.id} for actions.`,icon:L.deviceCamera,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID to capture, acquired from context or the open tool."},ref:{type:"string",description:"Element reference to capture. If omitted, captures the whole viewport."},selector:{type:"string",description:'Playwright selector of an element to capture when "ref" is not available. If omitted, captures the whole viewport.'},element:{type:"string",description:'Human-readable description of the element to capture (e.g., "chart diagram", "product image").'},scrollIntoViewIfNeeded:{type:"boolean",description:"Whether to scroll the element into view before capturing. Defaults to false."}},required:["pageId"]}},w5e=class{constructor(i,e,t,o){this.browserViewWorkbenchService=i;this.playwrightService=e;this.telemetryService=t;this.editorGroupsService=o}async prepareToolInvocation(i,e){let t=i.parameters;if(t.element){let o=Ru(t.element);return{invocationMessage:new he(d(6194,null,o)),pastTenseMessage:new he(d(6196,null,o))}}return{invocationMessage:d(6193,null),pastTenseMessage:d(6195,null)}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);let s=n.selector;n.ref&&(s=`aria-ref=${n.ref}`);let l=await this.browserViewWorkbenchService.getKnownBrowserViews().get(n.pageId)?.resolve();if(!l)return $m(`No browser page found with ID ${n.pageId}`);let c=s&&await _Uo(this.playwrightService,r,n.pageId,async(g,f,v)=>{let b=g.locator(f);return v&&await b.scrollIntoViewIfNeeded(),b.boundingBox()},s,n.scrollIntoViewIfNeeded)||void 0,u=await l.captureScreenshot({pageRect:c}),p=DUo(u),h=this.findBrowserViewHostWindow(l);return this.telemetryService.publicLog2("integratedBrowser.tools.screenshot.captured",{screenshotType:c?"element":"viewport",selectorSource:n.ref?"ref":n.selector?"selector":"none",scrollIntoViewIfNeeded:!!n.scrollIntoViewIfNeeded,imageWidth:p?.width,imageHeight:p?.height,byteLength:u.byteLength,windowZoomFactor:h&&uv(h),windowDevicePixelRatio:h?.devicePixelRatio,browserZoomFactor:l.zoomFactor,windowInnerWidth:h?.innerWidth,windowInnerHeight:h?.innerHeight,isInAuxiliaryWindow:h&&fI(h),isBrowserViewVisible:l.visible,screenWidth:h?.screen.width,screenHeight:h?.screen.height,screenAvailWidth:h?.screen.availWidth,screenAvailHeight:h?.screen.availHeight}),{content:[{kind:"data",value:{mimeType:"image/jpeg",data:u}}]}}findBrowserViewHostWindow(i){for(let e of this.editorGroupsService.getGroups(1))for(let t of e.editors)if(t instanceof gd&&t.id===i.id)return gv(e.windowId,!0).window}};w5e=I([m(0,Bm),m(1,tv),m(2,_e),m(3,kt)],w5e);var H5i={id:"type_in_page",toolReferenceName:fy.TypeInPage,displayName:d(6207,null),userDescription:d(6208,null),modelDescription:"Type text or press keys in a browser page.",icon:L.symbolText,source:wn.Internal,inputSchema:{type:"object",properties:{pageId:{type:"string",description:"The browser page ID, acquired from context or the open tool."},text:{type:"string",description:'The text to type. One of "text" or "key" must be provided.'},key:{type:"string",description:'A key or key combination to press (e.g., "Enter", "Tab", "Control+c"). One of "text" or "key" must be provided.'},ref:{type:"string",description:"Element reference to target. If omitted, types into the focused element."},selector:{type:"string",description:'Playwright selector of element to target when "ref" is not available. If omitted, types into the focused element.'},element:{type:"string",description:'Human-readable description of the element to type into (e.g., "search box", "comment field"). Required when "ref" or "selector" is specified.'}},required:["pageId"],$comment:'If "ref" or "selector" is provided, then "element" is required.'}},C5e=class{constructor(i){this.playwrightService=i}async prepareToolInvocation(i,e){let t=i.parameters,o=Dw(t.pageId),n=t.ref||t.selector;if(t.key){let r=Ru(t.key);if(n&&t.element){let s=Ru(t.element);return{invocationMessage:new he(d(6200,null,r,s,o)),pastTenseMessage:new he(d(6202,null,r,s,o))}}return{invocationMessage:new he(d(6199,null,r,o)),pastTenseMessage:new he(d(6201,null,r,o))}}if(n&&t.element){let r=Ru(t.element);return{invocationMessage:new he(d(6204,null,r,o)),pastTenseMessage:new he(d(6206,null,r,o))}}return{invocationMessage:new he(d(6203,null,o)),pastTenseMessage:new he(d(6205,null,o))}}async invoke(i,e,t,o){let n=i.parameters,r=Sy(i);if(!n.pageId)return $m(`No page ID provided. Use '${ex}' first.`);let s=n.selector;return n.ref&&(s=`aria-ref=${n.ref}`),!n.text&&!n.key?$m('Either a "text" or "key" parameter is required.'):n.key?s?eT(this.playwrightService,r,n.pageId,(l,c,u)=>l.locator(c).press(u),s,n.key):eT(this.playwrightService,r,n.pageId,(l,c)=>l.keyboard.press(c),n.key):s?eT(this.playwrightService,r,n.pageId,(l,c,u)=>l.locator(c).fill(u),s,n.text):eT(this.playwrightService,r,n.pageId,(l,c)=>l.keyboard.type(c),n.text)}};C5e=I([m(0,tv)],C5e);var Dj=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.instantiationService=e;this.toolsService=t;this.chatContextService=o;this.editorService=n;this.browserViewService=r;this.agentNetworkFilterService=s;this.chatService=l;this.playwrightService=c;this._toolsStore=this._register(new O);this._modelListeners=this._register(new Ot);this._browserToolSet=this._register(this.toolsService.createToolSet(wn.Internal,"browser","browser",{icon:L.globe,description:d(6126,null)})),this._updateToolRegistrations(),this._register(this.browserViewService.onDidChangeSharingAvailable(()=>{this._updateToolRegistrations()})),this._register(this.chatService.onDidDisposeSession(u=>{for(let p of u.sessionResources)this.playwrightService.disposeSession(p.toString()).catch(()=>{})}))}static{this.ID="browserView.chatAgentTools"}static{this.CONTEXT_ID="browserView.trackedPages"}_updateToolRegistrations(){if(this._toolsStore.clear(),this._modelListeners.clearAndDisposeAll(),!this.browserViewService.isSharingAvailable){this._toolsStore.add(this.toolsService.registerTool(W5i,this.instantiationService.createInstance(S5e))),this._toolsStore.add(this._browserToolSet.addTool(W5i)),this.chatContextService.updateWorkspaceContextItems(Dj.CONTEXT_ID,[]);return}this._toolsStore.add(this.toolsService.registerTool(m5e,this.instantiationService.createInstance(p5e))),this._toolsStore.add(this.toolsService.registerTool(qft,this.instantiationService.createInstance(I5e))),this._toolsStore.add(this.toolsService.registerTool(B5i,this.instantiationService.createInstance(w5e))),this._toolsStore.add(this.toolsService.registerTool(F5i,this.instantiationService.createInstance(b5e))),this._toolsStore.add(this.toolsService.registerTool(P5i,this.instantiationService.createInstance(h5e))),this._toolsStore.add(this.toolsService.registerTool(A5i,this.instantiationService.createInstance(g5e))),this._toolsStore.add(this.toolsService.registerTool(O5i,this.instantiationService.createInstance(v5e))),this._toolsStore.add(this.toolsService.registerTool(H5i,this.instantiationService.createInstance(C5e))),this._toolsStore.add(this.toolsService.registerTool(V5i,this.instantiationService.createInstance(y5e))),this._toolsStore.add(this.toolsService.registerTool(N5i,this.instantiationService.createInstance(f5e))),this._toolsStore.add(this._browserToolSet.addTool(m5e)),this._toolsStore.add(this._browserToolSet.addTool(qft)),this._toolsStore.add(this._browserToolSet.addTool(B5i)),this._toolsStore.add(this._browserToolSet.addTool(F5i)),this._toolsStore.add(this._browserToolSet.addTool(P5i)),this._toolsStore.add(this._browserToolSet.addTool(A5i)),this._toolsStore.add(this._browserToolSet.addTool(O5i)),this._toolsStore.add(this._browserToolSet.addTool(H5i)),this._toolsStore.add(this._browserToolSet.addTool(V5i)),this._toolsStore.add(this._browserToolSet.addTool(N5i)),this._syncModelListeners(),this._toolsStore.add(this.browserViewService.onDidChangeBrowserViews(()=>{this._syncModelListeners(),this._updateBrowserContext()})),this._toolsStore.add(this.editorService.onDidActiveEditorChange(()=>this._updateBrowserContext())),this._toolsStore.add(this.editorService.onDidVisibleEditorsChange(()=>this._updateBrowserContext())),this._toolsStore.add(this.agentNetworkFilterService.onDidChange(()=>this._updateBrowserContext())),this._updateBrowserContext()}_syncModelListeners(){let e=this.browserViewService.getKnownBrowserViews();for(let t of this._modelListeners.keys())e.has(t)||this._modelListeners.deleteAndDispose(t);for(let[t,o]of e)if(!this._modelListeners.has(t)&&o.model){let n=new O;n.add(o.model.onDidChangeSharingState(()=>this._updateBrowserContext())),this._modelListeners.set(t,n)}}_updateBrowserContext(){let e=[...this.browserViewService.getKnownBrowserViews().values()],t=e.filter(r=>r.model?.sharingState==="shared"),o=e.length-t.length;if(t.length===0&&o===0){this.chatContextService.updateWorkspaceContextItems(Dj.CONTEXT_ID,[]);return}let n="";t.length>0?(n="The following browser pages are currently shared with you and can be interacted with using the browser tools:",n+=`
`+M5i(this.editorService,t,{agentNetworkFilterService:this.agentNetworkFilterService})):n="No browser pages are currently shared with you.",o>0&&(n&&(n+=`

`),n+=`${o} ${o===1?"page is":"pages are"} open but not shared.`,n+=`
Use the 'open_browser_page' tool to open a new page or to help the user share an existing page.`),this.chatContextService.updateWorkspaceContextItems(Dj.CONTEXT_ID,[{handle:0,label:d(6125,null),value:n}])}};Dj=I([m(0,F),m(1,Wn),m(2,SR),m(3,ie),m(4,Bm),m(5,bW),m(6,si),m(7,tv)],Dj);bt(Dj.ID,Dj,vt.AfterRestored);function _An(a){if(!(!a||a.length===0))return a.map(i=>{let e=i.classNames?.length?`.${i.classNames.join(".")}`:"",t=i.id?`#${i.id}`:"";return`${i.tagName}${t}${e}`}).join(" > ")}function DAn(a,i){let e=[];e.push("Attached Element Context from Integrated Browser"),e.push(`Element: ${i}`),a.url&&e.push(`URL: ${a.url}`);let t=_An(a.ancestors);if(t&&e.push(`HTML Path: ${t}`),e.push(`Outer HTML:
\`\`\`html
${a.outerHTML}
\`\`\``),a.dimensions){let{top:o,left:n,width:r,height:s}=a.dimensions;e.push(`Dimensions:
- top: ${Math.round(o)}px
- left: ${Math.round(n)}px
- width: ${Math.round(r)}px
- height: ${Math.round(s)}px`)}return e.push(`CSS:
\`\`\`css
${a.computedStyle}
\`\`\``),e.join(`

`)}var RUo=C.equals("activeEditor",gd.EDITOR_ID),RAn=P(6073,"Browser"),U5i=new Y("browserElementSelectionActive",!1,d(6068,null)),G7=class extends nA{constructor(e,t,o,n,r,s,l,c,u,p,h){super(e);this.telemetryService=n;this.logService=r;this.chatWidgetService=s;this.chatService=l;this.configurationService=c;this.dialogService=u;this.storageService=p;this.workspaceTrustManagementService=h;this._elementSelectionActiveContext=U5i.bindTo(t);let g=this._register(o.createInstance(Kf,"element",void 0,{position:{hoverPosition:3}}));this._shareButtonContainer=_(".browser-share-toggle-container"),this._shareButton=this._register(new Pi(this._shareButtonContainer,{supportIcons:!0,title:d(6070,null),small:!0,hoverDelegate:g})),this._shareButton.element.classList.add("browser-share-toggle"),this._shareButton.label="$(share-window)",this._register(this._shareButton.onDidClick(()=>{this._toggleShareWithAgent()})),this._register(this.chatService.onDidSubmitRequest(()=>{this.editor.model?.isElementSelectionActive&&this.editor.model.toggleElementSelection(!1)}))}get urlBarWidgets(){return[{element:this._shareButtonContainer,order:50}]}subscribeToModel(e,t){this._updateSharingState(!0),t.add(e.onDidChangeSharingState(()=>{this._updateSharingState(!1)})),t.add(e.onDidSelectElement(async o=>{try{await this._attachElementDataToChat(o,e)}catch(n){this.logService.error("BrowserEditor.addElementToChat: Failed to attach element",n)}})),this._elementSelectionActiveContext.set(e.isElementSelectionActive),t.add(e.onDidChangeElementSelectionActive(o=>{this._elementSelectionActiveContext.set(o)}))}clear(){this._elementSelectionActiveContext.reset()}_toggleShareWithAgent(){let e=this.editor.model;e&&e.setSharedWithAgent(e.sharingState!=="shared")}_updateSharingState(e){let t=this.editor.model,o=t?.sharingState==="shared",n=!t||t.sharingState==="unavailable";this.editor.browserContainer.classList.toggle("animate",!e),this.editor.browserContainer.classList.toggle("shared",o),this._shareButtonContainer.style.display=n?"none":"",this._shareButton.checked=o,this._shareButton.label=o?d(6071,null)+" $(share-window)":"$(share-window)";let r=o?d(6072,null):d(6070,null);this._shareButton.setTitle(r),this._shareButton.element.setAttribute("aria-label",r)}static{this.SHARING_CONTENT_WARNING_DONT_ASK_KEY="browserView.agentSharingContentWarning.dontAskAgain"}async _confirmContentAttachmentRisk(e){if(this.storageService.getBoolean(G7.SHARING_CONTENT_WARNING_DONT_ASK_KEY,0))return!0;try{let o=new URL(e);if(o.protocol==="file:"){if((await this.workspaceTrustManagementService.getUriTrustInfo(A.file(o.pathname))).trusted)return!0}else if(o.hostname==="localhost"||o.hostname==="127.0.0.1"||o.hostname==="::1")return!0}catch{}let t=await this.dialogService.confirm({type:"warning",message:d(6066,null),detail:d(6064,null),primaryButton:d(6067,null),checkbox:{label:d(6065,null),checked:!1}});return t.confirmed&&t.checkboxChecked&&this.storageService.store(G7.SHARING_CONTENT_WARNING_DONT_ASK_KEY,!0,0,0),t.confirmed}async _attachElementDataToChat(e,t){let o=e.bounds,n=[],r=document.createElement("div");AA(r,e.outerHTML);let s=r.firstElementChild,l=r.textContent,c=s?`${s.tagName.toLowerCase()}${s.id?`#${s.id}`:""}`:"",u=s?`${c}${s.classList.length?`.${[...s.classList].join(".")}`:""}`:"";if(e.ancestors&&e.ancestors.length>0){let f=e.ancestors[e.ancestors.length-1],v="";f.tagName.startsWith("::")&&e.ancestors.length>1&&(v=f.tagName,f=e.ancestors[e.ancestors.length-2]),c=`${f.tagName.toLowerCase()}${f.id?`#${f.id}`:""}${v}`,u=`${f.tagName.toLowerCase()}${f.id?`#${f.id}`:""}${f.classNames&&f.classNames.length?`.${f.classNames.join(".")}`:""}${v}`}let p=DAn(e,u);n.push({id:"element-"+Date.now(),name:c,fullName:u,value:p,modelDescription:"Structured browser element context with HTML path, outer HTML, dimensions, and computed styles.",kind:"element",icon:q.fromId(L.layout.id),ancestors:e.ancestors,attributes:e.attributes,computedStyles:e.computedStyles,dimensions:e.dimensions,innerText:l});let h=this.configurationService.getValue("chat.sendElementsToChat.attachImages");if(h){let f=await t.captureScreenshot({quality:90,pageRect:o});n.push({id:"element-screenshot-"+Date.now(),name:"Element Screenshot",fullName:"Element Screenshot",kind:"image",value:f.buffer})}if(!await this._confirmContentAttachmentRisk(e.url??t.url))return;(await this.chatWidgetService.revealWidget()??this.chatWidgetService.lastFocusedWidget)?.attachmentModel?.addContext(...n),this.telemetryService.publicLog2("integratedBrowser.addElementToChat.added",{attachImages:h})}async addConsoleLogsToChat(){let e=this.editor.model;if(e)try{let t=await e.getConsoleLogs();if(!t||!await this._confirmContentAttachmentRisk(e.url))return;let o=[];o.push({id:"console-logs-"+Date.now(),name:d(6074,null),fullName:d(6074,null),value:t,modelDescription:"Console logs captured from Integrated Browser.",kind:"element",icon:q.fromId(L.terminal.id)}),(await this.chatWidgetService.revealWidget()??this.chatWidgetService.lastFocusedWidget)?.attachmentModel?.addContext(...o)}catch(t){this.logService.error("BrowserEditor.addConsoleLogsToChat: Failed to get console logs",t)}}};G7=I([m(1,X),m(2,F),m(3,_e),m(4,re),m(5,Lt),m(6,si),m(7,B),m(8,ct),m(9,de),m(10,Or)],G7);Iu.registerContribution(G7);var z5i=class a extends z{static{this.ID=Ld.AddElementToChat}constructor(){super({id:a.ID,title:P(6063,"Add Element to Chat"),category:RAn,icon:L.inspect,f1:!0,precondition:C.and(RUo,rA,aB.negate(),Z.enabled),toggled:U5i,menu:{id:R.BrowserActionsToolbar,group:"actions",order:1,when:Z.enabled},keybinding:[{weight:250,primary:3105},{when:U5i,weight:200,primary:9}]})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&(e.ensureBrowserFocus(),e.model?.toggleElementSelection(void 0))}},K5i=class a extends z{static{this.ID=Ld.AddConsoleLogsToChat}constructor(){super({id:a.ID,title:P(6062,"Add Console Logs to Chat"),category:Sh,icon:L.output,f1:!0,precondition:C.and(RUo,rA,aB.negate(),Z.enabled),menu:{id:R.BrowserActionsToolbar,group:"actions",order:2,when:Z.enabled}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.getContribution(G7)?.addConsoleLogsToChat()}};W(z5i);W(K5i);oe.as($t.Configuration).registerConfiguration({...jd,properties:{"workbench.browser.enableChatTools":{type:"boolean",default:!1,experiment:{mode:"startup"},tags:["experimental"],markdownDescription:d(6069,null),policy:{name:"BrowserChatTools",category:"InteractiveSession",minimumVersion:"1.110",value:a=>a.chat_preview_features_enabled===!1?!1:void 0,localization:{description:{key:"browser.enableChatTools",value:d(6069,null)}}},agentsWindow:{default:!0}},[Hft]:{type:"boolean",markdownDescription:d(6075,null,`\`#${mk}#\``,"`#workbench.browser.enableChatTools#`"),default:!1,experiment:{mode:"startup"},tags:["experimental","advanced"],included:$i.quality!=="stable"}}});var LUo=new Y("browserCanZoomIn",!0,d(6082,null)),MUo=new Y("browserCanZoomOut",!0,d(6083,null)),G5i=class extends k{constructor(){super();this._timeout=this._register(new ue);this.element=_(".browser-zoom-pill"),this.element.setAttribute("aria-hidden","true"),this._icon=_("span"),this._label=_("span"),this.element.appendChild(this._icon),this.element.appendChild(this._label)}show(e,t){this._icon.className=q.asClassName(t?L.zoomIn:L.zoomOut),this._label.textContent=e,this.element.classList.add("visible"),this._timeout.value=Zo(()=>{this.element.classList.remove("visible")},750)}},hle=class extends nA{constructor(e,t,o,n){super(e);this.browserZoomService=o;this.accessibilityService=n;this._canZoomInContext=LUo.bindTo(t),this._canZoomOutContext=MUo.bindTo(t),this._zoomPill=this._register(new G5i)}get urlBarWidgets(){return[{element:this._zoomPill.element,order:0}]}subscribeToModel(e,t){this._updateZoomContext(e),t.add(e.onDidChangeZoom(()=>{this._updateZoomContext(e)}))}clear(){this._canZoomInContext.reset(),this._canZoomOutContext.reset()}async zoomIn(){await this.editor.model?.zoomIn(),this._showZoomPill()}async zoomOut(){await this.editor.model?.zoomOut(),this._showZoomPill()}async resetZoom(){await this.editor.model?.resetZoom(),this._showZoomPill()}_updateZoomContext(e){this._canZoomInContext.set(e.canZoomIn),this._canZoomOutContext.set(e.canZoomOut)}_showZoomPill(){let e=this.editor.model;if(!e)return;let t=this.browserZoomService.getEffectiveZoomIndex(void 0,!1),o=wR[t],n=e.zoomFactor,r=pho(n);this._zoomPill.show(r,n>=o),this.accessibilityService.status(mho(n))}};hle=I([m(1,X),m(2,mMe),m(3,Ai)],hle);Iu.registerContribution(hle);var q5i=class a extends z{static{this.ID="workbench.action.browser.zoomIn"}constructor(){super({id:a.ID,title:P(6087,"Zoom In"),category:Sh,icon:L.zoomIn,f1:!0,precondition:C.and(gI,rA,aB.negate()),menu:{id:R.BrowserActionsToolbar,group:"2_zoom",order:1,when:LUo},keybinding:{when:mle,weight:275,primary:2134,secondary:[3158,2157]}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.getContribution(hle)?.zoomIn()}},$5i=class a extends z{static{this.ID="workbench.action.browser.zoomOut"}constructor(){super({id:a.ID,title:P(6088,"Zoom Out"),category:Sh,icon:L.zoomOut,f1:!0,precondition:C.and(gI,rA,aB.negate()),menu:{id:R.BrowserActionsToolbar,group:"2_zoom",order:2,when:MUo},keybinding:{when:mle,weight:275,primary:2136,secondary:[3160,2159],linux:{primary:2136,secondary:[2159]}}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.getContribution(hle)?.zoomOut()}},j5i=class a extends z{static{this.ID="workbench.action.browser.resetZoom"}constructor(){super({id:a.ID,title:P(6086,"Reset Zoom"),category:Sh,icon:L.screenNormal,f1:!0,precondition:C.and(gI,rA,aB.negate()),menu:{id:R.BrowserActionsToolbar,group:"2_zoom",order:3},keybinding:{when:mle,weight:275,primary:2146}})}async run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&await e.getContribution(hle)?.resetZoom()}};W(q5i);W($5i);W(j5i);var x5e=class extends k{static{this.ID="workbench.contrib.browserView.windowZoomSynchronizer"}constructor(i){super(),i.notifyWindowZoomChanged(Bde(nx(ut))),this._register(twe(()=>{i.notifyWindowZoomChanged(Bde(nx(ut)))}))}};x5e=I([m(0,mMe)],x5e);bt(x5e.ID,x5e,vt.BlockRestore);Ce(mMe,pMe,1);oe.as($t.Configuration).registerConfiguration({...jd,properties:{"workbench.browser.pageZoom":{type:"string",enum:[zet,...wR.map(a=>`${Math.round(a*100)}%`)],markdownEnumDescriptions:[d(6084,null),...wR.map(()=>"")],default:zet,markdownDescription:d(6085,null),scope:2}}});var wti=new Y("browserFindWidgetVisible",!1,d(6079,null)),Z5i=new Y("browserFindWidgetFocused",!1,d(6078,null)),$ft=class extends Jse{constructor(e,t,o,n,r,s,l){super({showCommonFindToggles:!0,checkImeCompletionState:!0,showResultCount:!0,enableSash:!0,initialWidth:350,previousMatchActionId:Ld.FindPrevious,nextMatchActionId:Ld.FindNext,closeWidgetActionId:Ld.HideFind},t,o,n,r,s,l);this._modelDisposables=this._register(new O);this._hasFoundMatch=!1;this._onDidChangeHeight=this._register(new T);this.onDidChangeHeight=this._onDidChangeHeight.event;this._findWidgetVisible=wti.bindTo(o),this._findWidgetFocused=Z5i.bindTo(o);let c=this.getDomNode();e.appendChild(c);let u=c.offsetHeight,p=this._register(new zu("BrowserEditorFindFeature.heightChange",()=>{let h=c.offsetHeight;h!==u&&(u=h,this._onDidChangeHeight.fire())},Me(e)));this._register(p.observe(c))}setModel(e){this._modelDisposables.clear(),this._model=e,this._lastFindResult=void 0,this._hasFoundMatch=!1,e&&(this._modelDisposables.add(e.onDidFindInPage(t=>{this._lastFindResult={resultIndex:t.activeMatchOrdinal-1,resultCount:t.matches},this._hasFoundMatch=t.matches>0,this.updateButtons(this._hasFoundMatch),this.updateResultCount()})),this._modelDisposables.add(e.onWillDispose(()=>{this.setModel(void 0)})))}reveal(e){let t=this.isVisible();super.reveal(e),this._findWidgetVisible.set(!0),this.focusFindBox(),this.inputValue&&!t&&this._onInputChanged()}hide(){super.hide(!1),this._findWidgetVisible.reset(),this._model?.stopFindInPage(!0),this._model?.focus(),this._lastFindResult=void 0,this._hasFoundMatch=!1}find(e){let t=this.inputValue;t&&this._model&&this._model.findInPage(t,{forward:!e,recompute:!1,matchCase:this._getCaseSensitiveValue()})}findFirst(){let e=this.inputValue;e&&this._model&&this._model.findInPage(e,{forward:!0,recompute:!0,matchCase:this._getCaseSensitiveValue()})}clear(){this._model&&(this._model.stopFindInPage(!1),this._lastFindResult=void 0,this._hasFoundMatch=!1)}_onInputChanged(){return this.inputValue?this.findFirst():this._model&&this.clear(),!1}async _getResultCount(){return this._lastFindResult}_onFocusTrackerFocus(){this._findWidgetFocused.set(!0)}_onFocusTrackerBlur(){this._findWidgetFocused.reset()}_onFindInputFocusTrackerFocus(){}_onFindInputFocusTrackerBlur(){}};$ft=I([m(1,qn),m(2,X),m(3,ot),m(4,Le),m(5,B),m(6,Ai)],$ft);var q7=class extends nA{constructor(e,t){super(e);this.instantiationService=t;this._findWidgetContainer=_(".browser-find-widget-wrapper"),this._findWidget=new uo(()=>{let o=this.instantiationService.createInstance($ft,this._findWidgetContainer);return e.model&&o.setModel(e.model),o.onDidChangeHeight(()=>{e.layoutBrowserContainer()}),o}),this._register(ee(()=>this._findWidget.rawValue?.dispose()))}get toolbarElements(){return[this._findWidgetContainer]}subscribeToModel(e,t){this._findWidget.rawValue?.setModel(e)}clear(){this._findWidget.rawValue?.setModel(void 0),this._findWidget.rawValue?.hide()}layout(e){this._findWidget.rawValue?.layout(e)}async showFind(){let e=(await this.editor.model?.getSelectedText())?.trim(),t=e&&!/[\r\n]/.test(e)?e:void 0;this._findWidget.value.reveal(t),this._findWidget.value.layout(this._findWidgetContainer.clientWidth)}hideFind(){this._findWidget.rawValue?.hide()}findNext(){this._findWidget.rawValue?.find(!1)}findPrevious(){this._findWidget.rawValue?.find(!0)}};q7=I([m(1,F)],q7);Iu.registerContribution(q7);var Q5i=class a extends z{static{this.ID=Ld.ShowFind}constructor(){super({id:a.ID,title:P(6081,"Find in Page"),category:Sh,f1:!0,precondition:C.and(gI,rA,aB.negate()),menu:{id:R.BrowserActionsToolbar,group:"3_page",order:1},keybinding:{weight:100,primary:2084}})}run(i,e=i.get(ie).activeEditorPane){e instanceof Iu&&e.getContribution(q7)?.showFind()}},Y5i=class a extends z{static{this.ID=Ld.HideFind}constructor(){super({id:a.ID,title:P(6080,"Close Find Widget"),category:Sh,f1:!1,precondition:C.and(gI,wti),keybinding:{weight:105,primary:9}})}run(i){let e=i.get(ie).activeEditorPane;e instanceof Iu&&e.getContribution(q7)?.hideFind()}},X5i=class a extends z{static{this.ID=Ld.FindNext}constructor(){super({id:a.ID,title:P(6076,"Find Next"),category:Sh,f1:!1,precondition:gI,keybinding:[{when:Z5i,weight:100,primary:3},{when:wti,weight:100,primary:61,mac:{primary:2085}}]})}run(i){let e=i.get(ie).activeEditorPane;e instanceof Iu&&e.getContribution(q7)?.findNext()}},J5i=class a extends z{static{this.ID=Ld.FindPrevious}constructor(){super({id:a.ID,title:P(6077,"Find Previous"),category:Sh,f1:!1,precondition:gI,keybinding:[{when:Z5i,weight:100,primary:1027},{when:wti,weight:100,primary:1085,mac:{primary:3109}}]})}run(i){let e=i.get(ie).activeEditorPane;e instanceof Iu&&e.getContribution(q7)?.findPrevious()}};W(Q5i);W(Y5i);W(X5i);W(J5i);var a4i=new Y("browserEditorOpen",!1,d(6095,null)),LAn={iconClass:q.asClassName(L.close),tooltip:d(6094,null)},MAn={iconClass:q.asClassName(L.closeAll),tooltip:d(6093,null),location:2},jft=class extends k{constructor(e,t,o,n,r){super();this._editorService=e;this._editorGroupsService=t;this._browserViewService=r;this._itemListeners=this._register(new O);this._openNewTabPick={groupId:-1,editor:void 0,label:d(6105,null),iconClass:q.asClassName(L.add),alwaysShow:!0};this._quickPick=this._register(o.createQuickPick({useSeparators:!0})),this._quickPick.placeholder=d(6108,null),this._quickPick.matchOnDescription=!0,this._quickPick.sortByLabel=!1,this._quickPick.buttons=[MAn],this._register(this._quickPick.onDidTriggerItemButton(async({item:s})=>{s.editor?.dispose(!0)})),this._register(this._quickPick.onDidTriggerButton(async()=>{for(let s of this._browserViewService.getKnownBrowserViews().values())s.dispose(!0)})),this._register(this._quickPick.onDidAccept(async()=>{let[s]=this._quickPick.selectedItems;s&&(s===this._openNewTabPick?(PG(n,"quickOpenWithoutUrl"),this._quickPick.hide(),await this._editorService.openEditor({resource:cS.forId(ht())})):await this._editorService.openEditor(s.editor,s.groupId))})),this._register(this._quickPick.onDidHide(()=>this.dispose()))}show(){this._buildItems();let e=this._editorService.activeEditor;if(e instanceof gd){let t=this._quickPick.items.find(o=>o.type!=="separator"&&o.editor===e);t&&(this._quickPick.activeItems=[t])}this._quickPick.show()}_buildItems(){this._itemListeners.clear();let e=this._quickPick.activeItems[0]?.editor,t=[],n=this._editorGroupsService.getGroups(2).map(h=>({group:h,browserEditors:h.editors.filter(g=>g instanceof gd)})).filter(({browserEditors:h})=>h.length>0),r=new Set;for(let{browserEditors:h}of n)for(let g of h)r.add(g.id);let s=[...this._browserViewService.getKnownBrowserViews().values()].filter(h=>!r.has(h.id)),l=d(6089,null),c=n.map(({group:h,browserEditors:g})=>({label:h.label,ariaLabel:h.ariaLabel,groupId:h.id,editors:g,isPinned:f=>h.isPinned(f)}));s.length>0&&c.push({label:l,ariaLabel:l,groupId:tr,editors:s});for(let{group:h}of n)this._itemListeners.add(h.onDidModelChange(()=>this._buildItems()));this._itemListeners.add(this._browserViewService.onDidChangeBrowserViews(()=>this._buildItems()));let u=c.length>1,p;for(let h of c){u&&t.push({type:"separator",label:h.label});for(let g of h.editors){let f=g.getIcon(),v=g.getDescription(),b=v?`${g.getName()} ${v}`:g.getName(),S={groupId:h.groupId,editor:g,label:g.getName(),ariaLabel:u?d(6113,null,b,h.ariaLabel):b,description:v,buttons:[LAn],italic:h.isPinned?!h.isPinned(g):void 0};f instanceof A?S.iconPath={dark:f}:f&&(S.iconClass=q.asClassName(f)),t.push(S),g===e&&(p=S),this._itemListeners.add(g.onDidChangeLabel(()=>this._buildItems()))}}t.push({type:"separator"}),t.push(this._openNewTabPick),this._quickPick.keepScrollPosition=!0,this._quickPick.items=t,p&&(this._quickPick.activeItems=[p])}};jft=I([m(0,ie),m(1,kt),m(2,$e),m(3,_e),m(4,Bm)],jft);var e4i=class extends z{constructor(){super({id:Ld.QuickOpen,title:P(6107,"Quick Open Browser Tab..."),icon:L.globe,category:Sh,f1:!0,keybinding:{weight:200,primary:3103,when:gI}})}run(i){i.get(F).createInstance(jft).show()}},t4i=class extends z{constructor(){super({id:Ld.Open,title:P(6102,"Open Integrated Browser"),category:Sh,icon:L.globe,f1:!0})}async run(i,e){let t=i.get(ie),o=i.get(_e),n=i.get(Bm),r=typeof e=="string"?{url:e}:e??{},s=cS.forId(ht()),l=r.openToSide?En:tr;if(r.reuseUrlFilter){let u=A.parse(r.reuseUrlFilter),p=[...n.getKnownBrowserViews().values()].find(h=>{let g=A.parse(h.url||"");if(u.scheme&&r.reuseUrlFilter.startsWith(`${u.scheme}:`)&&u.scheme!==g.scheme||u.authority&&!qd(u.authority,g.authority)||u.path&&!qd(u.path,g.path))return!1;if(u.query){let f=new URLSearchParams(u.query),v=new URLSearchParams(g.query);if(![...f].every(([b,S])=>qd(S,v.get(b)??"")))return!1}return!0});if(p){r.url&&p.navigate(r.url),await t.openEditor(p);return}}PG(o,r.url?"commandWithUrl":"commandWithoutUrl");let c=await t.openEditor({resource:s,options:{viewState:{url:r.url}}},l);r.openToSide&&c?.group&&c.group.lock(!0)}},i4i=class extends z{constructor(){let i=C.and(Ho.Scheme.isEqualTo(Q.file),C.regex(Ho.Extension.key,/\.html?$/i));super({id:Ld.OpenFile,title:P(6103,"Open in Integrated Browser"),category:Sh,icon:L.globe,f1:!0,precondition:i,menu:[{id:R.ExplorerContext,group:"navigation",order:29,when:i},{id:R.EditorTitleContext,group:"1_open",order:5,when:i},{id:R.EditorTitle,group:"navigation",order:99,when:i}]})}async run(i,e){let t=i.get(ie),o=i.get(_e),n=e??po.getOriginalUri(t.activeEditor,{filterByScheme:[Q.file],supportSideBySide:1});if(!n)return;PG(o,"openFileCommand");let r=cS.forId(ht());await t.openEditor({resource:r,options:{viewState:{url:n.toString()}}})}},o4i=class extends z{constructor(){super({id:Ld.NewTab,title:P(6101,"New Tab"),category:Sh,f1:!0,precondition:gI,menu:{id:R.BrowserActionsToolbar,group:"1_tabs",order:1},keybinding:{weight:250,primary:2098}})}async run(i,e=i.get(ie).activeEditorPane){let t=i.get(ie),o=i.get(_e),n=cS.forId(ht());PG(o,"newTabCommand"),await t.openEditor({resource:n})}},n4i=class extends z{constructor(){super({id:Ld.CloseAll,title:P(6090,"Close All Browser Tabs"),category:Sh,f1:!0,precondition:a4i})}async run(i){let e=i.get(kt);for(let t of e.getGroups(2)){let o=t.getEditors(1).filter(n=>n instanceof gd);o.length>0&&await t.closeEditors(o)}}},r4i=class extends z{constructor(){super({id:Ld.CloseAllInGroup,title:P(6091,"Close All Browser Tabs in Group"),category:Sh,f1:!0,precondition:gI})}async run(i){let e=i.get(kt),t=i.get(ie),o=e.getGroup(t.activeEditorPane?.group?.id??e.activeGroup.id);if(!o)return;let n=o.getEditors(1).filter(r=>r instanceof gd);n.length>0&&await o.closeEditors(n)}},s4i=class extends z{constructor(){super({id:Ld.OpenOrList,title:P(6106,"Browser"),icon:L.globe,f1:!1,keybinding:{weight:200,primary:2650},menu:{id:R.TitleBar,group:"navigation",order:10,when:C.and(C.equals("config.workbench.browser.showInTitleBar",!1).negate(),C.or(a4i,C.equals("config.workbench.browser.showInTitleBar",1)))}})}async run(i){let e=i.get(Bm),t=i.get(fe);if(e.getKnownBrowserViews().size>0){await t.executeCommand(Ld.QuickOpen);return}await t.executeCommand(Ld.Open)}};be.appendMenuItem(R.MenubarViewMenu,{group:"4_auxbar",command:{id:Ld.OpenOrList,title:d(6114,null)},order:2});be.appendMenuItem(R.EditorTitleContext,{command:{id:Ld.CloseAllInGroup,title:d(6092,null)},group:"1_close",order:55,when:gI});W(e4i);W(t4i);W(i4i);W(s4i);W(o4i);W(n4i);W(r4i);W(class extends UP{constructor(){super("workbench.browser.showInTitleBar",d(6115,null),d(6116,null),8)}});var k5e=class extends k{static{this.ID="workbench.contrib.browserEditorOpenContextKey"}constructor(i,e){super();let t=a4i.bindTo(i),o=()=>t.set(e.getKnownBrowserViews().size>0);o(),this._register(e.onDidChangeBrowserViews(()=>o()))}};k5e=I([m(0,X),m(1,Bm)],k5e);bt(k5e.ID,k5e,vt.AfterRestored);var E5e=class extends k{constructor(e,t,o,n){super();this.configurationService=t;this.editorService=o;this.telemetryService=n;this._register(e.registerExternalOpener(this))}static{this.ID="workbench.contrib.localhostLinkOpener"}async openExternal(e,t,o){if(!this.configurationService.getValue("workbench.browser.openLocalhostLinks"))return!1;try{let s=new URL(e);if(s.protocol!=="http:"&&s.protocol!=="https:"||!bZe(s.host)&&!spo(s.host))return!1}catch{return!1}PG(this.telemetryService,"localhostLinkOpener");let n=!m5(this.configurationService.inspect("workbench.browser.openLocalhostLinks")),r=cS.forId(ht());return await this.editorService.openEditor({resource:r,options:{pinned:!0,viewState:{url:e,isDefaultLinkOpen:n}}}),!0}};E5e=I([m(0,Je),m(1,B),m(2,ie),m(3,_e)],E5e);bt(E5e.ID,E5e,vt.BlockStartup);var PUo="workbench.browser.linkOpenedHintDismissed",Qft=class extends nA{constructor(e,t,o,n,r){super(e);this.hoverService=t;this.storageService=o;this.preferencesService=n;this.contextKeyService=r;this._attentionTimeout=this._register(new ue);this._pill=_(".browser-link-opened-hint-pill"),this._pill.tabIndex=0,this._pill.role="button",this._pill.ariaLabel=d(6096,null),this._pill.ariaHidden="true";let s=_("span");s.className=q.asClassName(L.info);let l=_("span");l.textContent=d(6099,null),this._pill.appendChild(s),this._pill.appendChild(l);let c=()=>({content:new he(d(6097,null)),actions:[{label:d(6100,null),commandId:"workbench.action.openSettings",iconClass:q.asClassName(L.settingsGear),run:()=>{this.preferencesService.openUserSettings({query:"workbench.browser.openLocalhostLinks"})}},{label:d(6098,null),commandId:"",run:()=>{this._dismiss()}}],position:{hoverPosition:2}});this._register(this.hoverService.setupDelayedHover(this._pill,c,{setupKeyboardEvents:!0})),this._register($(this._pill,ne.CLICK,()=>{this.hoverService.showInstantHover({...c(),target:this._pill,persistence:{sticky:!0}},!0)}))}get urlBarWidgets(){return[{element:this._pill,order:100}]}subscribeToModel(e,t,o){if(qo.getValue(this.contextKeyService)){this._setVisible(!1);return}let n=this.editor.input;if(n instanceof gd&&n.isDefaultLinkOpen){let r=this.storageService.getBoolean(PUo,-1,!1);this._setVisible(!r),!r&&o&&this._callAttention()}else this._setVisible(!1)}clear(){this._attentionTimeout.clear(),this._setVisible(!1)}_setVisible(e){e||(this._attentionTimeout.clear(),this._pill.classList.remove("attention")),this._pill.classList.toggle("visible",e),this._pill.ariaHidden=e?"false":"true"}_callAttention(){this._attentionTimeout.clear(),this._pill.classList.remove("attention"),this._attentionTimeout.value=Zo(()=>{this._pill.classList.add("attention"),this._attentionTimeout.value=Zo(()=>{this._pill.classList.remove("attention")},2e3)},300)}_dismiss(){this.storageService.store(PUo,!0,-1,0),this._setVisible(!1)}};Qft=I([m(1,ot),m(2,de),m(3,Qo),m(4,X)],Qft);Iu.registerContribution(Qft);oe.as($t.Configuration).registerConfiguration({...jd,properties:{"workbench.browser.showInTitleBar":{type:["boolean","string"],enum:[!0,!1,"whenOpen"],enumDescriptions:[d(6111,null),d(6110,null),d(6112,null)],default:"whenOpen",experiment:{mode:"startup"},description:d(6109,null)},"workbench.browser.openLocalhostLinks":{type:"boolean",default:!1,experiment:{mode:"startup"},markdownDescription:d(6104,null),agentsWindow:{default:!0}}}});oe.as(en.EditorPane).registerEditorPane(os.create(Iu,gd.EDITOR_ID,d(6043,null)),[new Vt(gd)]);oe.as(en.EditorFactory).registerEditorSerializer(gd.ID,zWt);var T5e=class{static{this.ID="workbench.contrib.browserEditorResolver"}constructor(i,e){i.registerEditor(`${Q.vscodeBrowser}:/**`,{id:gd.EDITOR_ID,label:d(6043,null),priority:"exclusive"},{canSupportResource:t=>t.scheme===Q.vscodeBrowser,singlePerResource:!0},{createEditorInput:({resource:t,options:o})=>{let n=cS.parse(t);if(!n)throw new Error(`Invalid browser view resource: ${t.toString()}`);let r=e.getOrCreateLazy(n.id,o?.viewState);return r.resolve(),{editor:r,options:{pinned:!!r.url,...o}}}})}};T5e=I([m(0,il),m(1,Bm)],T5e);bt(T5e.ID,T5e,vt.BlockStartup);Ce(Bm,_j,1);Ce(UWt,u5e,1);var Cti=le("ISplashStorageService");var $7=class{constructor(i,e,t,o,n,r,s){this._themeService=i;this._layoutService=e;this._environmentService=t;this._configService=o;this._partSplashService=n;this._disposables=new O;U.once(e.onDidLayoutMainContainer)(()=>{this._removePartsSplash(),Wo("code/didRemovePartsSplash")},void 0,this._disposables);let l=this._disposables.add(new ue),c=()=>{l.value=Ff(ut,()=>this._savePartsSplash(),2500)};s.when(3).then(()=>{U.any(U.filter(ZO,u=>u===ut.vscodeWindowId),r.mainPart.onDidLayout,i.onDidColorThemeChange)(c,void 0,this._disposables),c()}),o.onDidChangeConfiguration(u=>{u.affectsConfiguration("window.titleBarStyle")&&(this._didChangeTitleBarStyle=!0,this._savePartsSplash())},this,this._disposables)}static{this.ID="workbench.contrib.partsSplash"}static{this._splashElementId="monaco-parts-splash"}dispose(){this._disposables.dispose()}_savePartsSplash(){let i=this._themeService.getColorTheme();this._partSplashService.saveWindowSplash({zoomLevel:this._configService.getValue("window.zoomLevel"),baseTheme:V5(i.type),colorInfo:{foreground:i.getColor(xo)?.toString(),background:Ue.Format.CSS.formatHex(i.getColor(Bo)||_0(i)),editorBackground:i.getColor(Bo)?.toString(),titleBarBackground:i.getColor(uZ)?.toString(),titleBarBorder:i.getColor(kMt)?.toString(),activityBarBackground:i.getColor(hMt)?.toString(),activityBarBorder:i.getColor(gMt)?.toString(),sideBarBackground:i.getColor(ch)?.toString(),sideBarBorder:i.getColor(R2)?.toString(),statusBarBackground:i.getColor(pMt)?.toString(),statusBarBorder:i.getColor(fpe)?.toString(),statusBarNoFolderBackground:i.getColor(mMt)?.toString(),windowBorder:i.getColor(T_e)?.toString()??i.getColor(__e)?.toString()},layoutInfo:this._shouldSaveLayoutInfo()?{sideBarSide:this._layoutService.getSideBarPosition()===1?"right":"left",editorPartMinWidth:c_.width,titleBarHeight:this._layoutService.isVisible("workbench.parts.titlebar",ut)?Uh(Ti(this._layoutService.getContainer(ut,"workbench.parts.titlebar"))):0,activityBarWidth:this._layoutService.isVisible("workbench.parts.activitybar")?Dc(Ti(this._layoutService.getContainer(ut,"workbench.parts.activitybar"))):0,sideBarWidth:this._layoutService.isVisible("workbench.parts.sidebar")?Dc(Ti(this._layoutService.getContainer(ut,"workbench.parts.sidebar"))):0,auxiliaryBarWidth:this._layoutService.isAuxiliaryBarMaximized()?Number.MAX_SAFE_INTEGER:this._layoutService.isVisible("workbench.parts.auxiliarybar")?Dc(Ti(this._layoutService.getContainer(ut,"workbench.parts.auxiliarybar"))):0,statusBarHeight:this._layoutService.isVisible("workbench.parts.statusbar",ut)?Uh(Ti(this._layoutService.getContainer(ut,"workbench.parts.statusbar"))):0,windowBorder:this._layoutService.hasMainWindowBorder(),windowBorderRadius:this._layoutService.getMainWindowBorderRadius()}:void 0})}_shouldSaveLayoutInfo(){return!rx(ut)&&!this._environmentService.isExtensionDevelopment&&!this._didChangeTitleBarStyle}_removePartsSplash(){let i=ut.document.getElementById($7._splashElementId);i&&(i.style.display="none"),ut.document.head.getElementsByClassName("initialShellColors")[0]?.remove()}};$7=I([m(0,Pe),m(1,wi),m(2,Mt),m(3,B),m(4,Cti),m(5,kt),m(6,to)],$7);var Yft=class{constructor(i){this.saveWindowSplash=i.saveWindowSplash.bind(i)}};Yft=I([m(0,wo)],Yft);Ce(Cti,Yft,1);bt($7.ID,$7,vt.BlockStartup);W(class extends z{constructor(){super({id:"workbench.action.localHistory.revealInOS",title:ii?P(12670,"Reveal in File Explorer"):et?P(12669,"Reveal in Finder"):P(12668,"Open Containing Folder"),menu:{id:R.TimelineItemContext,group:"4_reveal",order:1,when:C.and(iz,Ho.Scheme.isEqualTo(Q.file))}})}async run(a,i){let e=a.get(Tw),t=a.get(wo),{entry:o}=await oz(e,i);o&&await t.showItemInFolder(o.location.with({scheme:Q.file}).fsPath)}});var AUo=P(13425,"Merge Editor (Dev)"),Xft=class extends z{constructor(){super({id:"merge.dev.openContentsJson",category:AUo,title:P(13424,"Open Merge Editor State from JSON"),icon:L.layoutCentered,f1:!0})}async run(i,e){let t=i.get($e),o=i.get(Bi),n=i.get(ie),r=i.get(Rt),s=i.get(Ix),l=i.get(ge);e||(e={});let c;if(e.data)c=e.data;else{let x=await t.input({prompt:d(13426,null),value:await o.readText()});if(x===void 0)return;c=x!==""?JSON.parse(x):{base:"",input1:"",input2:"",result:"",languageId:"plaintext"}}let u=A.joinPath(s.tmpDir,hwe()),p=r.getExtensions(c.languageId)[0]||"",h=A.joinPath(u,`/base${p}`),g=A.joinPath(u,`/input1${p}`),f=A.joinPath(u,`/input2${p}`),v=A.joinPath(u,`/result${p}`),b=A.joinPath(u,`/initialResult${p}`);async function S(x,E){await l.writeFile(x,Ke.fromString(E))}let y=await PAn(t,e.resultState);await Promise.all([S(h,c.base),S(g,c.input1),S(f,c.input2),S(v,y?c.initialResult||"":c.result),S(b,c.initialResult||"")]);let w={base:{resource:h},input1:{resource:g,label:"Input 1",description:"Input 1",detail:"(from JSON)"},input2:{resource:f,label:"Input 2",description:"Input 2",detail:"(from JSON)"},result:{resource:v}};n.openEditor(w)}};async function PAn(a,i){return i?i==="initial":(await a.pick([{label:"result",result:!1},{label:"initial result",result:!0}],{canPickMany:!1}))?.result}var l4i=class extends z{constructor(i){super(i)}run(i){let{activeEditorPane:e}=i.get(ie);if(e instanceof _b){let t=e.viewModel.get();if(!t)return;this.runWithViewModel(t,i)}}},xti=class extends l4i{constructor(){super({id:"merge.dev.openSelectionInTemporaryMergeEditor",category:AUo,title:P(13423,"Open Selection In Temporary Merge Editor"),icon:L.layoutCentered,f1:!0})}async runWithViewModel(i,e){let t=i.selectionInBase.get()?.rangesInBase;if(!t||t.length===0)return;let o=t.map(l=>i.model.base.getValueInRange(l)).join(`
`),n=t.map(l=>i.inputCodeEditorView1.editor.getModel().getValueInRange(i.model.translateBaseRangeToInput(1,l))).join(`
`),r=t.map(l=>i.inputCodeEditorView2.editor.getModel().getValueInRange(i.model.translateBaseRangeToInput(2,l))).join(`
`),s=t.map(l=>i.resultCodeEditorView.editor.getModel().getValueInRange(i.model.translateBaseRangeToResult(l))).join(`
`);new Xft().run(e,{data:{base:o,input1:n,input2:r,result:s,languageId:i.resultCodeEditorView.editor.getModel().getLanguageId()}})}};W(Xft);W(xti);var gle=P(14727,"Remote Tunnels"),az="remoteTunnelConnection",AAn=new Y(az,"disconnected"),c4i="remoteTunnelServiceUsed",NUo="remoteTunnelServicePromptedPreview",OUo="remoteTunnelExtensionRecommended",FUo="remoteTunnelHasUsed",NAn=240*1e3,OAn=2;var Rj;(r=>(r.turnOn=d(14726,null),r.turnOff=d(14725,null),r.showLog=d(14724,null),r.configure=d(14719,null),r.copyToClipboard=d(14720,null),r.learnMore=d(14721,null)))(Rj||={});var Jft=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v){super();this.authenticationService=e;this.dialogService=t;this.extensionService=o;this.contextKeyService=n;this.storageService=s;this.quickInputService=c;this.environmentService=u;this.remoteTunnelService=p;this.commandService=h;this.workspaceContextService=g;this.progressService=f;this.notificationService=v;this.expiredSessions=new Set;this.logger=this._register(l.createLogger(Ve(u.logsHome,`${uei}.log`),{id:uei,name:SHo})),this.connectionStateContext=AAn.bindTo(this.contextKeyService);let b=r.tunnelApplicationConfig;if(!b||!r.tunnelApplicationName){this.logger.error("Missing 'tunnelApplicationConfig' or 'tunnelApplicationName' in product.json. Remote tunneling is not available."),this.serverConfiguration={authenticationProviders:{},editorWebUrl:"",extension:{extensionId:"",friendlyName:""}};return}this.serverConfiguration=b,this._register(this.remoteTunnelService.onDidChangeTunnelStatus(S=>this.handleTunnelStatusUpdate(S))),this.registerCommands(),this.initialize(),this.recommendRemoteExtensionIfNeeded()}handleTunnelStatusUpdate(e){this.connectionInfo=void 0,e.type==="disconnected"?(e.onTokenFailed&&this.expiredSessions.add(e.onTokenFailed.sessionId),this.connectionStateContext.set("disconnected")):e.type==="connecting"?this.connectionStateContext.set("connecting"):e.type==="connected"&&(this.connectionInfo=e.info,this.connectionStateContext.set("connected"))}async recommendRemoteExtensionIfNeeded(){await this.extensionService.whenInstalledExtensionsRegistered();let e=this.serverConfiguration.extension,t=async()=>{if(this.storageService.getBoolean(OUo,-1)||await this.extensionService.getExtension(e.extensionId))return!1;let n=this.storageService.get(c4i,-1);if(!n)return!1;let r;try{let l=JSON.parse(n);if(!Di(l))return!1;let{hostName:c,timeStamp:u}=l;if(!We(c)||!on(u)||new Date().getTime()>u+NAn)return!1;r=c}catch{return!1}let s=await this.remoteTunnelService.getTunnelName();return!s||s===r?!1:r},o=async()=>{let n=await t();return n?(this.notificationService.notify({severity:ft.Info,priority:1,message:d(14718,null,n,e.friendlyName),actions:{primary:[li({id:"showExtension",label:d(14706,null),run:()=>this.commandService.executeCommand("workbench.extensions.action.showExtensionsWithIds",[e.extensionId])}),li({id:"doNotShowAgain",label:d(14705,null),run:()=>{this.storageService.store(OUo,!0,-1,0)}})]}}),!0):!1};if(await t()){let n=this._register(new O);n.add(this.storageService.onDidChangeValue(-1,c4i,n)(async()=>{await o()&&n.dispose()}))}}async initialize(){let[e,t]=await Promise.all([this.remoteTunnelService.getMode(),this.remoteTunnelService.getTunnelStatus()]);if(this.handleTunnelStatusUpdate(t),e.active&&e.session.token)return;let o=async r=>{let s=r&&this.remoteTunnelService.onDidChangeTunnelStatus(u=>{u.type==="connecting"&&u.progress&&r.report({message:u.progress})}),l;if(e.active){let u=await this.getSessionToken(e.session);u&&(l={...e.session,token:u})}let c=await this.remoteTunnelService.initialize(e.active&&l?{...e,session:l}:fHo);if(s?.dispose(),c.type==="connected"){this.connectionInfo=c.info,this.connectionStateContext.set("connected");return}};this.storageService.getBoolean(FUo,-1,!1)?await this.progressService.withProgress({location:10,title:d(14708,null,"workbench.remoteTunnel.actions.showLog")},o):o(void 0)}getPreferredTokenFromSession(e){return e.session.accessToken||e.session.idToken}async startTunnel(e){if(this.connectionInfo)return this.connectionInfo;this.storageService.store(FUo,!0,-1,1);let t=!1;for(let o=0;o<OAn;o++){t=!1;let n=await this.getAuthenticationSession();if(n===void 0){this.logger.info("No authentication session available, not starting tunnel");return}let r=await this.progressService.withProgress({location:15,title:d(14736,null,"workbench.remoteTunnel.actions.showLog")},s=>new Promise((l,c)=>{let u=!1,p=this.remoteTunnelService.onDidChangeTunnelStatus(f=>{switch(f.type){case"connecting":f.progress&&s.report({message:f.progress});break;case"connected":p.dispose(),u=!0,l(f.info),f.serviceInstallFailed&&this.notificationService.notify({severity:ft.Warning,message:d(14728,null,"workbench.remoteTunnel.actions.showLog")});break;case"disconnected":p.dispose(),u=!0,t=!!f.onTokenFailed,l(void 0);break}}),h=this.getPreferredTokenFromSession(n),g={sessionId:n.session.id,token:h,providerId:n.providerId,accountLabel:n.session.account.label};this.remoteTunnelService.startTunnel({active:!0,asService:e,session:g}).then(f=>{!u&&(f.type==="connected"||f.type==="disconnected")&&(p.dispose(),f.type==="connected"?l(f.info):(t=!!f.onTokenFailed,l(void 0)))})}));if(r||!t)return r}}async getAuthenticationSession(){let e=await this.getAllSessions(),t=new O,o=t.add(this.quickInputService.createQuickPick({useSeparators:!0}));return o.ok=!1,o.placeholder=d(14703,null),o.ignoreFocusOut=!0,o.items=await this.createQuickpickItems(e),new Promise((n,r)=>{t.add(o.onDidHide(s=>{n(void 0),t.dispose()})),t.add(o.onDidAccept(async s=>{let l=o.selectedItems[0];if("provider"in l){let c=await this.authenticationService.createSession(l.provider.id,l.provider.scopes);n(this.createExistingSessionItem(c,l.provider.id))}else"session"in l?n(l):n(void 0);o.hide()})),o.show()})}createExistingSessionItem(e,t){return{label:e.account.label,description:this.authenticationService.getProvider(t).label,session:e,providerId:t}}async createQuickpickItems(e){let t=[];e.length&&(t.push({type:"separator",label:d(14735,null)}),t.push(...e),t.push({type:"separator",label:d(14715,null)}));for(let o of await this.getAuthenticationProviders()){let n=e.some(s=>s.providerId===o.id),r=this.authenticationService.getProvider(o.id);(!n||r.supportsMultipleAccounts)&&t.push({label:d(14734,null,r.label),provider:o})}return t}async getAllSessions(){let e=await this.getAuthenticationProviders(),t=new Map,o=await this.remoteTunnelService.getMode(),n;for(let r of e){let s=await this.authenticationService.getSessions(r.id,r.scopes);for(let l of s)if(!this.expiredSessions.has(l.id)){let c=this.createExistingSessionItem(l,r.id);t.set(c.session.account.id,c),o.active&&o.session.sessionId===l.id&&(n=c)}}return n!==void 0&&t.set(n.session.account.id,n),[...t.values()]}async getSessionToken(e){if(e){let t=(await this.getAllSessions()).find(o=>o.session.id===e.sessionId);if(t)return this.getPreferredTokenFromSession(t)}}async getAuthenticationProviders(){let e=this.serverConfiguration.authenticationProviders,t=Object.keys(e).reduce((n,r)=>(n.push({id:r,scopes:e[r].scopes}),n),[]),o=this.authenticationService.declaredProviders;return t.filter(({id:n})=>o.some(r=>r.id===n))}registerCommands(){let e=this;this._register(W(class extends z{constructor(){super({id:"workbench.remoteTunnel.actions.turnOn",title:Rj.turnOn,category:gle,precondition:C.equals(az,"disconnected"),menu:[{id:R.CommandPalette},{id:R.AccountsContext,group:"2_remoteTunnel",when:C.equals(az,"disconnected")}]})}async run(t){let o=t.get(Ne),n=t.get(Bi),r=t.get(fe),s=t.get(de),l=t.get(ct),c=t.get($e),u=t.get(Ze);if(!s.getBoolean(NUo,-1,!1)){let{confirmed:b}=await l.confirm({message:d(14742,null),primaryButton:d(14707,null)});if(!b)return;s.store(NUo,!0,-1,0)}let h=new O,g=c.createQuickPick();g.placeholder=d(14737,null),g.items=[{service:!1,label:d(14740,null),description:d(14741,null,u.nameShort)},{service:!0,label:d(14738,null),description:d(14739,null)}];let f=await new Promise(b=>{h.add(g.onDidAccept(()=>b(g.selectedItems[0]?.service))),h.add(g.onDidHide(()=>b(void 0))),g.show()});if(g.dispose(),f===void 0)return;let v=await e.startTunnel(f);if(v){let b=e.getLinkToOpen(v),S=e.serverConfiguration.extension,y=b.toString(!1).replace(/\)/g,"%29");o.notify({severity:ft.Info,message:d(14717,null,v.tunnelName,v.domain,y,"workbench.remoteTunnel.actions.manage","workbench.remoteTunnel.actions.configure","workbench.remoteTunnel.actions.turnOff",S.friendlyName,"https://code.visualstudio.com/docs/remote/tunnels"),actions:{primary:[li({id:"copyToClipboard",label:d(14704,null),run:()=>n.writeText(b.toString(!0))}),li({id:"showExtension",label:d(14706,null),run:()=>r.executeCommand("workbench.extensions.action.showExtensionsWithIds",[S.extensionId])})]}});let w={hostName:v.tunnelName,timeStamp:new Date().getTime()};s.store(c4i,JSON.stringify(w),-1,0)}else o.notify({severity:ft.Info,message:d(14716,null)}),await r.executeCommand("workbench.remoteTunnel.actions.showLog")}})),this._register(W(class extends z{constructor(){super({id:"workbench.remoteTunnel.actions.manage",title:d(14723,null),category:gle,menu:[{id:R.AccountsContext,group:"2_remoteTunnel",when:C.equals(az,"connected")}]})}async run(){e.showManageOptions()}})),this._register(W(class extends z{constructor(){super({id:"workbench.remoteTunnel.actions.connecting",title:d(14722,null),category:gle,menu:[{id:R.AccountsContext,group:"2_remoteTunnel",when:C.equals(az,"connecting")}]})}async run(){e.showManageOptions()}})),this._register(W(class extends z{constructor(){super({id:"workbench.remoteTunnel.actions.turnOff",title:Rj.turnOff,category:gle,precondition:C.notEquals(az,"disconnected"),menu:[{id:R.CommandPalette,when:C.notEquals(az,"")}]})}async run(){let t=e.connectionInfo?.isAttached?d(14730,null):d(14729,null),{confirmed:o}=await e.dialogService.confirm({message:t});o&&e.remoteTunnelService.stopTunnel()}})),this._register(W(class extends z{constructor(){super({id:"workbench.remoteTunnel.actions.showLog",title:Rj.showLog,category:gle,menu:[{id:R.CommandPalette,when:C.notEquals(az,"")}]})}async run(t){t.get(Tl).showChannel(uei)}})),this._register(W(class extends z{constructor(){super({id:"workbench.remoteTunnel.actions.configure",title:Rj.configure,category:gle,menu:[{id:R.CommandPalette,when:C.notEquals(az,"")}]})}async run(t){t.get(Qo).openSettings({query:dei})}})),this._register(W(class extends z{constructor(){super({id:"workbench.remoteTunnel.actions.copyToClipboard",title:Rj.copyToClipboard,category:gle,precondition:C.equals(az,"connected"),menu:[{id:R.CommandPalette,when:C.equals(az,"connected")}]})}async run(t){let o=t.get(Bi);if(e.connectionInfo){let n=e.getLinkToOpen(e.connectionInfo);o.writeText(n.toString(!0))}}})),this._register(W(class extends z{constructor(){super({id:"workbench.remoteTunnel.actions.learnMore",title:Rj.learnMore,category:gle,menu:[]})}async run(t){await t.get(Je).open("https://aka.ms/vscode-server-doc")}}))}getLinkToOpen(e){let t=this.workspaceContextService.getWorkspace(),o=t.folders,n;o.length===1?n=o[0].uri:t.configuration&&!rM(t.configuration,this.environmentService)&&(n=t.configuration);let r=A.parse(e.link);return n?.scheme===Q.file?Ve(r,n.path):Ve(r,this.environmentService.userHome.path)}async showManageOptions(){let e=await this.remoteTunnelService.getMode();return new Promise((t,o)=>{let n=new O,r=this.quickInputService.createQuickPick({useSeparators:!0});r.placeholder=d(14709,null),n.add(r);let s=[];s.push({id:"workbench.remoteTunnel.actions.learnMore",label:Rj.learnMore}),this.connectionInfo?(r.title=this.connectionInfo.isAttached?d(14711,null,this.connectionInfo.tunnelName):d(14713,null,this.connectionInfo.tunnelName),s.push({id:"workbench.remoteTunnel.actions.copyToClipboard",label:Rj.copyToClipboard,description:this.connectionInfo.domain})):r.title=d(14712,null),s.push({id:"workbench.remoteTunnel.actions.showLog",label:d(14710,null)}),s.push({type:"separator"}),s.push({id:"workbench.remoteTunnel.actions.configure",label:d(14714,null),description:this.connectionInfo?.tunnelName}),s.push({id:"workbench.remoteTunnel.actions.turnOff",label:Rj.turnOff,description:e.active?`${e.session.accountLabel} (${e.session.providerId})`:void 0}),r.items=s,n.add(r.onDidAccept(()=>{r.selectedItems[0]&&r.selectedItems[0].id&&this.commandService.executeCommand(r.selectedItems[0].id),r.hide()})),n.add(r.onDidHide(()=>{n.dispose(),t()})),r.show()})}};Jft=I([m(0,ks),m(1,ct),m(2,lt),m(3,X),m(4,Ze),m(5,de),m(6,Ol),m(7,$e),m(8,Ix),m(9,cei),m(10,fe),m(11,Ae),m(12,Go),m(13,Ne)],Jft);var FAn=oe.as(Zi.Workbench);FAn.registerWorkbenchContribution(Jft,3);oe.as($t.Configuration).registerConfiguration({type:"object",properties:{[vHo]:{description:d(14731,null),type:"string",scope:1,ignoreSync:!0,pattern:"^(\\w[\\w-]*)?$",patternErrorMessage:d(14732,null),maxLength:20,default:""},[bHo]:{description:d(14733,null),type:"boolean",scope:1,default:!1}}});var kti=le("localGitService");var WAn=xei({customizations:ole({type:"array",title:d(1854,null),description:d(1850,null),default:[],items:{type:"object",title:d(1853,null),properties:{uri:{type:"string",title:d(1855,null)},displayName:{type:"string",title:d(1852,null)},description:{type:"string",title:d(1851,null)}},required:["uri","displayName"]}}),defaultShell:ole({type:"string",title:d(1857,null),description:d(1856,null)}),disableCustomTerminalTool:ole({type:"boolean",title:d(1859,null),description:d(1858,null),default:!1})}),VAn={customizations:[]};function WUo(a){let i=a?.customizations;return WAn.validate("customizations",i)?i:VAn.customizations}var d4i="remote-host",VUo="remote-client",Eti=class extends k{constructor(e,t,o,n,r,s){super();this._agentInfo=e;this._connectionAuthority=o;this._fileService=n;this._logService=r;this._getItemActions=s;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._expansionCache=new dt;let l=t.rootState;this._agentCustomizations=this._readRootCustomizations(l.value)??this._agentInfo.customizations??[],this._register(l.onDidChange(c=>{let u=this._readRootCustomizations(c)??this._readAgentCustomizations(c)??this._agentCustomizations;u!==this._agentCustomizations&&(this._agentCustomizations=u,this._onDidChange.fire())})),this._register(t.onDidAction(c=>{if(c.action.type==="session/customizationsChanged"){let u=c.action.customizations;u!==this._sessionCustomizations&&(this._sessionCustomizations=u,this._onDidChange.fire())}}))}_readRootCustomizations(e){if(!(!e||e instanceof Error||!e.config))return WUo(e.config?.values)}_readAgentCustomizations(e){if(!(!e||e instanceof Error))return e.agents.find(t=>t.provider===this._agentInfo.provider)?.customizations}toRemoteUri(e){let t=A.parse(e.uri);return t.scheme===T$?t:$S(t,this._connectionAuthority)}toBadge(e,t){return t?{groupKey:VUo}:{groupKey:d4i}}toItem(e,t){let o=t?.clientId,n=this.toBadge(e,o!==void 0),r=this.toRemoteUri(e);return{itemKey:u4i(e,o),uri:r,type:"plugin",name:e.displayName,description:e.description,storage:"plugin",status:BUo(t?.status),statusMessage:t?.statusMessage,enabled:t?.enabled??!0,badge:n.badge,badgeTooltip:n.badgeTooltip,groupKey:n.groupKey,extensionId:void 0,pluginUri:r,userInvocable:void 0,actions:this._getItemActions?.(e,o)}}async provideChatSessionCustomizations(e){let t=new Map,o=[];for(let r of this._agentCustomizations){let s=this.toItem(r);t.set(u4i(r,void 0),s),o.push({item:s,nonce:r.nonce,status:void 0,statusMessage:void 0,enabled:void 0,childGroupKey:d4i,isBundleItem:!1})}for(let r of this._sessionCustomizations??[]){let s=BAn(r.customization),c=r.clientId!==void 0?VUo:d4i,u;s?u={uri:this.toRemoteUri(r.customization),type:"plugin",name:"",storage:"plugin",groupKey:c,extensionId:void 0,pluginUri:void 0}:(u=this.toItem(r.customization,r),t.set(u4i(r.customization,r.clientId),u)),o.push({item:u,nonce:r.customization.nonce,status:BUo(r.status),statusMessage:r.statusMessage,enabled:r.enabled,childGroupKey:c,isBundleItem:s})}let n=await Promise.all(o.map(r=>this._expandPluginContents(r.item.uri,r.nonce,r.childGroupKey,r.isBundleItem,e)));if(e.isCancellationRequested)return[];for(let r=0;r<o.length;r++){let s=o[r];for(let l of n[r])t.set(`${s.item.itemKey??s.item.uri.toString()}::${l.type}::${l.name}`,{...l,status:s.status,statusMessage:s.statusMessage,enabled:s.enabled})}return[...t.values()]}async _expandPluginContents(e,t,o,n,r){let s=this._expansionCache.get(e);if(s&&s.nonce===t)return s.children;let l=e,c=[];try{if(!await this._fileService.canHandleResource(l))return[];if(r.isCancellationRequested)return[];let p=["agents","skills","commands","rules"].map(g=>({name:g,resource:A.joinPath(l,g)})),h=await this._fileService.resolveAll(p.map(g=>({resource:g.resource})));if(r.isCancellationRequested)return[];for(let g=0;g<p.length;g++){let f=h[g];if(!f.success||!f.stat?.isDirectory||!f.stat.children)continue;let v=HAn(p[g].name);v&&c.push(...await this._collectFromTypeDir(f.stat.children,e,v,o,n,r))}c.sort((g,f)=>`${g.type}:${g.name}`.localeCompare(`${f.type}:${f.name}`))}catch(u){return this._logService.trace(`[AgentCustomizationItemProvider] Failed to expand plugin ${e.toString()}: ${u}`),[]}return this._expansionCache.set(e,{nonce:t,children:c}),c}async _collectFromTypeDir(e,t,o,n,r,s){let l=[];for(let p of e)p.name.startsWith(".")||o!=="skill"&&p.isDirectory||l.push(p);let c=o==="skill"?await Promise.all(l.map(p=>this._readSkillMetadata(p,s))):void 0;if(s.isCancellationRequested)return[];let u=[];for(let p=0;p<l.length;p++){let h=l[p],g,f,v=h.resource,b;if(o==="skill"){let S=c[p];if(h.isDirectory){if(!S)continue;v=Ve(h.resource,LH)}let y=h.isDirectory?h.name:UUo(h.name);g=S?.name??y,f=S?.description,b=S?.userInvocable}else g=UUo(h.name);u.push({uri:v,type:o,name:g,description:f,storage:"plugin",groupKey:n,extensionId:void 0,pluginUri:r?void 0:t,userInvocable:b})}return u}async _readSkillMetadata(e,t){let o=e.isDirectory?Ve(e.resource,LH):e.resource;try{let n=await this._fileService.readFile(o);if(t.isCancellationRequested)return;let r=new z2().parse(o,n.value.toString());return{name:r.header?.name,description:r.header?.description,userInvocable:r.header?.userInvocable}}catch(n){this._logService.trace(`[RemoteAgentCustomizationItemProvider] Failed to read skill metadata ${o.toString()}: ${n}`);return}}};function BUo(a){switch(a){case"loading":return"loading";case"loaded":return"loaded";case"degraded":return"degraded";case"error":return"error";default:return}}function HUo(a){return a.uri}function u4i(a,i){return i!==void 0?`${HUo(a)}::${i}`:HUo(a)}function BAn(a){try{return A.parse(a.uri).scheme===T$}catch{return!1}}function HAn(a){switch(a){case"rules":return"instructions";case"commands":return"prompt";case"agents":return"agent";case"skills":return"skill";default:return}}function UUo(a){let i=km(a);if(!i)return a;let e=a.slice(0,-i.length),t=e.lastIndexOf(".");return t>0?e.slice(0,t):e}var UAn="customizationSync.disabled.",Tti=class extends k{constructor(e,t){super();this._storageService=t;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._storageKey=UAn+e,this._disabled=this._load()}isDisabled(e){return this._disabled.has(e.toString())}setDisabled(e,t){let o=e.toString(),n=this._disabled.has(o);if(t&&!n)this._disabled.add(o);else if(!t&&n)this._disabled.delete(o);else return;this._persist(),this._onDidChange.fire()}_load(){let e=this._storageService.get(this._storageKey,0);if(!e)return new Set;try{let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(o=>typeof o=="string"))}catch{}return new Set}_persist(){this._storageService.store(this._storageKey,JSON.stringify([...this._disabled]),0,1)}};var zAn=["agent","skill","instructions","prompt"],zUo=["plugin","extension"];async function KAn(a,i,e,t){let o=[];for(let r of zAn){let s=await Promise.all(zUo.map(l=>a.listPromptFilesForStorage(r,l,t)));for(let l=0;l<s.length;l++){let c=zUo[l];for(let u of s[l])lb(u.sessionTypes,e)&&o.push({uri:u.uri,type:r,storage:c,pluginUri:u.pluginUri,extensionId:u.extension?.identifier.value,disabled:i.isDisabled(u.uri)})}}let n=[];try{n=await a.listPromptFilesForStorage("skill",sc,t)}catch{n=[]}for(let r of n)lb(r.sessionTypes,e)&&o.push({uri:r.uri,type:"skill",storage:sc,disabled:i.isDisabled(r.uri)});return o}async function KUo(a,i,e,t,o){let r=(await KAn(a,i,o,Ie.None)).filter(p=>!p.disabled);if(r.length===0)return[];let s=e.plugins.get(),l=new Map,c=[];for(let p of r)if(p.storage==="plugin"){let h=s.find(f=>Yr(p.uri,f.uri));if(!h||i.isDisabled(h.uri))continue;let g=h.uri.toString();l.has(g)||l.set(g,{uri:g,displayName:h.label})}else c.push({uri:p.uri,type:p.type});let u=[...l.values()];if(c.length>0){let p=await t.bundle(c);p&&u.push(p.ref)}return u}var _ti=class{constructor(){this._lastTokens=new Map}updateAndIsChanged(i,e){return this._lastTokens.get(i)===e?!1:(this._lastTokens.set(i,e),!0)}clear(i){i!==void 0?this._lastTokens.delete(i):this._lastTokens.clear()}};async function GUo(a,i,e,t,o,n){for(let r of i){let s=A.parse(r),l=await t.getOrActivateProviderIdForServer(s,a);if(!l){o.trace(`${n} No auth provider found for server: ${r}`);continue}o.trace(`${n} Resolved auth provider '${l}' for server: ${r}`);let c=await t.getSessions(l,[...e],{authorizationServer:s},!0);if(c.length>0)return c[0].accessToken;let u=await t.getSessions(l,void 0,{authorizationServer:s},!0),p=new Set(e),h,g=1/0;for(let f of u){let v=new Set(f.scopes),b=!0;for(let S of p)if(!v.has(S)){b=!1;break}if(b){let S=v.size-p.size;S<g&&(g=S,h=f.accessToken)}}if(h)return h}}async function qUo(a,i){for(let e of a)for(let t of e.protectedResources??[]){let o=A.parse(t.resource),n=await GUo(o,t.authorization_servers??[],t.scopes_supported??[],i.authenticationService,i.logService,i.logPrefix);if(!n){i.logService.info(`${i.logPrefix} No token resolved for resource: ${t.resource}`);continue}if(i.authTokenCache&&!i.authTokenCache.updateAndIsChanged(t.resource,n)){i.logService.trace(`${i.logPrefix} Auth token for ${t.resource} unchanged; skipping authenticate RPC`);continue}i.logService.info(`${i.logPrefix} Authenticating for resource: ${t.resource}`);try{await i.authenticate({resource:t.resource,token:n})}catch(r){throw i.authTokenCache?.clear(t.resource),r}}}async function $Uo(a,i){for(let e of a){let t=A.parse(e.resource),o=await GUo(t,e.authorization_servers??[],e.scopes_supported??[],i.authenticationService,i.logService,i.logPrefix);if(o)return await i.authenticate({resource:e.resource,token:o}),i.authTokenCache?.updateAndIsChanged(e.resource,o),i.logService.info(`${i.logPrefix} Interactive authentication succeeded for ${e.resource}`),!0;for(let n of e.authorization_servers??[]){let r=A.parse(n),s=await i.authenticationService.getOrActivateProviderIdForServer(r,t);if(!s)continue;let l=[...e.scopes_supported??[]],c=await i.authenticationService.createSession(s,l,{activateImmediate:!0,authorizationServer:r});return await i.authenticate({resource:e.resource,token:c.accessToken}),i.authTokenCache?.updateAndIsChanged(e.resource,c.accessToken),i.logService.info(`${i.logPrefix} Interactive authentication succeeded for ${e.resource}`),!0}}return!1}var Dti=class extends k{constructor(e,t){super();this._sessionType=e;this._vendor=t;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this._models=[]}updateModels(e){this._models=e,this._onDidChange.fire()}async provideLanguageModelChatInfo(e,t){return this._models.filter(o=>o.policyState!=="disabled").map(o=>{let n=typeof o._meta?.multiplierNumeric=="number"?o._meta.multiplierNumeric:void 0;return{identifier:`${this._vendor}:${o.id}`,metadata:{extension:o_e.identifier,name:o.name,id:o.id,vendor:this._vendor,version:"1.0",family:o.id,maxInputTokens:o.maxContextWindow??0,maxOutputTokens:0,isDefaultForLocation:{},isUserSelectable:!0,pricing:n!==void 0?`${n}x`:void 0,multiplierNumeric:n,targetChatSessionType:this._sessionType,capabilities:{vision:o.supportsVision??!1,toolCalling:!0,agentMode:!0},configurationSchema:this._toLanguageModelConfigurationSchema(o.configSchema)}}})}_toLanguageModelConfigurationSchema(e){if(e)return{type:e.type,required:e.required,properties:Object.fromEntries(Object.entries(e.properties).map(([t,o])=>[t,{type:o.type,title:o.title,description:o.description,default:o.default,enum:o.enum,enumItemLabels:o.enumLabels,enumDescriptions:o.enumDescriptions,readOnly:o.readOnly,group:t==="thinkingLevel"?"navigation":void 0}]))}}async sendChatRequest(){throw new Error("Agent-host models do not support direct chat requests")}async provideTokenCount(){return 0}};var p4i="agentFeedback",m4i="agentFeedback";function h4i(a){return a.type==="simple"&&a.displayKind===p4i}function QUo(a){if(!h4i(a))return;let i=a._meta?.[m4i];if(!Zft(i)||!We(i.sessionResource)||!Array.isArray(i.feedbackItems))return;let e=[];for(let t of i.feedbackItems){let o=GAn(t);o&&e.push(o)}return{sessionResource:i.sessionResource,feedbackItems:e}}function GAn(a){if(!Zft(a)||!We(a.id)||!We(a.text)||!We(a.resourceUri))return;let i=qAn(a.range);if(i)return{id:a.id,text:a.text,resourceUri:a.resourceUri,range:i}}function qAn(a){if(!Zft(a)||!Zft(a.start)||!Zft(a.end))return;let i=jUo(a.start),e=jUo(a.end);if(!(!i||!e))return{start:i,end:e}}function jUo(a){if(!(typeof a.line!="number"||typeof a.character!="number"))return{line:a.line,character:a.character}}function Zft(a){return typeof a=="object"&&a!==null}function evt(a,i){return JSON.stringify({terminal:a,session:i.toString()})}function XUo(a){try{let i=JSON.parse(a);if(typeof i?.terminal=="string"&&typeof i?.session=="string")return i}catch{}}function _5e(a){let i=a._meta?.subagentDescription;return typeof i=="string"&&i.length>0?i:void 0}function Mti(a){let i=a._meta?.subagentAgentName;return typeof i=="string"&&i.length>0?i:void 0}var jAn=new Set(["task"]);function QAn(a){return jAn.has(a)}function Pti(a){return ile(a)==="subagent"||QAn(a.toolName)}function tvt(a){if(a){for(let i of a)if(i.type==="terminal")return i.resource}}function Ati(a){if(!(typeof a?.inputTokens!="number"&&typeof a?.outputTokens!="number"))return{kind:"usage",promptTokens:a.inputTokens??0,completionTokens:a.outputTokens??0}}function JUo(a,i,e,t,o){let n=[];for(let r of i){let s=r.usage?.model,l=o?.toLanguageModelId(s),c=o?.toResponseDetails(s,r.usage),u=Nti(r.userMessage,t);n.push({id:r.id,type:"request",prompt:r.userMessage.text,participant:e,modelId:l,variableData:u});let p=[],h=Ati(r.usage);h&&p.push(h);for(let g of r.responseParts)switch(g.kind){case"markdown":g.content&&p.push({kind:"markdownContent",content:D5e(g.content,t,{supportHtml:!0})});break;case"toolCall":{let f=g.toolCall,v=f4i(f),b=Oti(f,void 0,a,t);v.length>0&&(b.presentation="hidden"),p.push(b),p.push(...v);break}case"reasoning":g.content&&p.push({kind:"thinking",value:g.content});break;case"contentRef":break}r.state==="error"&&r.error&&p.push({kind:"markdownContent",content:new he(`

Error: (${r.error.errorType}) ${r.error.message}`)}),n.push({type:"response",parts:p,participant:e,details:c})}return n}function Nti(a,i){return YAn(a.attachments,i)}function YAn(a,i){if(!a?.length)return;let e=[];for(let t of a){let o=XAn(t,i);o&&e.push(o)}return e.length>0?{variables:e}:void 0}function XAn(a,i){if(h4i(a)){let e=QUo(a);if(e)return{kind:"agentFeedback",id:ht(),name:a.label,value:a.modelRepresentation||a.label,sessionResource:A.parse(e.sessionResource),feedbackItems:e.feedbackItems.map(t=>({id:t.id,text:t.text,resourceUri:$S(A.parse(t.resourceUri),i),range:YUo(t.range)})),_meta:a._meta}}if(a.type==="resource"){let e=$S(A.parse(a.uri),i),t=a.label,o=e.toString()+(a.selection?`:${a.selection.range.start.line}-${a.selection.range.end.line}`:""),n=a._meta;return a.displayKind==="directory"?{kind:"directory",id:o,name:t,value:e,_meta:n}:a.displayKind==="image"?{kind:"image",id:o,name:t,value:e,isURL:!0,references:[{kind:"reference",reference:e}],_meta:n}:a.selection?{kind:"file",id:o,name:t,value:{uri:e,range:YUo(a.selection.range)},_meta:n}:{kind:"file",id:o,name:t,value:e,_meta:n}}return a.type==="embeddedResource"?a.contentType.startsWith("image/")?{kind:"image",id:ht(),name:a.label||"image",value:Ws(a.data).buffer,mimeType:a.contentType,isURL:!1,_meta:a._meta}:{kind:"generic",id:ht(),name:a.label,value:Ws(a.data).buffer,_meta:a._meta}:{kind:"generic",id:ht(),name:a.label,value:a.modelRepresentation||a.label,_meta:a._meta}}function YUo(a){return{startLineNumber:a.start.line+1,startColumn:a.start.character+1,endLineNumber:a.end.line+1,endColumn:a.end.character+1}}function ZUo(a,i,e){let t=[],o=Ati(i.usage);o&&t.push(o);for(let n of i.responseParts)switch(n.kind){case"markdown":n.content&&t.push({kind:"markdownContent",content:D5e(n.content,e)});break;case"reasoning":n.content&&t.push({kind:"thinking",value:n.content});break;case"toolCall":{let r=n.toolCall;r.status==="completed"||r.status==="cancelled"?t.push(Oti(r,void 0,a,e)):(r.status==="running"||r.status==="streaming"||r.status==="pending-confirmation")&&t.push(Fti(r,void 0,a,e));break}case"contentRef":break}return t}function Rti(a){if(a.status!=="streaming"&&a.toolInput)try{return JSON.parse(a.toolInput).command||a.toolInput}catch{return a.toolInput}}function g4i(a){let i=a.status==="completed"||a.status==="running"?a.content?.find(e=>e.type==="text")?.text:void 0;return i?{text:i}:void 0}function Lti(a){return a.toolName==="powershell"?"powershell":"shellscript"}function e1o(a,i,e){let t=a.status==="streaming"?void 0:a.toolInput;if(!t)return;let o=[];if(a.status==="completed"||a.status==="running")for(let n of a.content??[])switch(n.type){case"text":o.push({type:"embed",value:n.text,isText:!0,mimeType:"text/plain"});break;case"embeddedResource":o.push({type:"embed",value:n.data,mimeType:n.contentType});break;case"resource":o.push({type:"ref",uri:A.parse(n.uri),mimeType:n.contentType});break}return o.length===0&&e&&o.push({type:"embed",value:e,isText:!0,mimeType:"text/plain"}),{input:t,inputLanguage:"json",output:o,isError:i}}function JAn(a){if(a.status==="completed")return a.error?.message;if(a.status==="cancelled")return typeof a.reasonMessage=="string"?a.reasonMessage:a.reasonMessage?.markdown}function Oti(a,i,e,t){let o=a.status==="completed"?tvt(a.content):void 0,n=!!o,r=a.status==="completed"&&a.success,s=lB(a.invocationMessage,t)??d(6743,null,a.displayName),l=a.status==="completed"?Wfe(a):void 0;if((l||Pti(a))&&a.status==="completed"){let g=QGt(a),f=r?lB(a.pastTenseMessage,t)??s:s;return{kind:"toolInvocationSerialized",toolCallId:a.toolCallId,toolId:a.toolName,source:wn.Internal,invocationMessage:s,originMessage:void 0,pastTenseMessage:f,isConfirmed:r?{type:1}:{type:0},isComplete:!0,presentation:void 0,subAgentInvocationId:i,toolSpecificData:{kind:"subagent",description:_5e(a)??a.displayName,agentName:l?.agentName??Mti(a),result:g}}}let u;n||ile(a)==="terminal"?u={kind:"terminal",commandLine:{original:Rti(a)??""},language:Lti(a),terminalToolSessionId:o?evt(o,e):void 0,terminalCommandUri:o?A.parse(o):void 0,terminalCommandOutput:g4i(a),terminalCommandState:{exitCode:r?0:1}}:ile(a)==="search"&&(u={kind:"search"});let p=r?lB(a.pastTenseMessage,t)??s:s,h=!u&&(a.status!=="completed"||PFe(a).length===0)?e1o(a,!r,JAn(a)):void 0;return{kind:"toolInvocationSerialized",toolCallId:a.toolCallId,toolId:a.toolName,source:wn.Internal,invocationMessage:s,originMessage:void 0,pastTenseMessage:n?void 0:p,isConfirmed:r?{type:1}:{type:0},isComplete:!0,presentation:void 0,subAgentInvocationId:i,toolSpecificData:u,resultDetails:h}}function f4i(a){if(a.status!=="completed")return[];let i=PFe(a);if(i.length===0)return[];let e=[];for(let t of i){let o=t.after?.uri?A.parse(t.after.uri):t.before?.uri?A.parse(t.before.uri):void 0;if(!o)continue;let n=!t.before&&!!t.after,r=!!t.before&&!t.after,s=!!t.before&&!!t.after&&!ze(A.parse(t.before.uri),A.parse(t.after.uri));(n||r||s)&&e.push({kind:"workspaceEdit",edits:[{oldResource:t.before?.uri?A.parse(t.before.uri):void 0,newResource:t.after?.uri?A.parse(t.after.uri):void 0}]}),t.after?.content&&(e.push({kind:"markdownContent",content:new he("\n````\n")}),e.push({kind:"codeblockUri",uri:o,isEdit:!0,undoStopId:a.toolCallId}),e.push({kind:"textEdit",uri:o,edits:[],done:!1,isExternalEdit:!0}),e.push({kind:"textEdit",uri:o,edits:[],done:!0,isExternalEdit:!0}),e.push({kind:"markdownContent",content:new he("\n````\n")}))}return e}var ZAn=new Set(["http","https","mailto","ws","wss","ftp","ftps","data","blob","javascript","command","vscode","vscode-insiders",IC]);function eNn(a,i){let e;try{e=zl.lexer(a)}catch{return a}let t=[];if(zl.walkTokens(e,r=>{if(r.type!=="link"&&r.type!=="image")return;let s=tNn(r,i);s!==void 0&&t.push({raw:r.raw,replacement:s})}),t.length===0)return a;let o="",n=0;for(let{raw:r,replacement:s}of t){let l=a.indexOf(r,n);l<0||(o+=a.substring(n,l)+s,n=l+r.length)}return o+a.substring(n)}function tNn(a,i){let e;try{e=A.parse(a.href,!0)}catch{return}let t=e.scheme.toLowerCase();if(!t||ZAn.has(t))return;let o=$S(e,i),n=iNn(e);if(n&&!o.query.includes("vscodeLinkType=")){let l=o.query;o=o.with({query:l?`${l}&vscodeLinkType=skill`:"vscodeLinkType=skill"})}let r=a.type==="image"?"![":"[",s=n||a.type==="image"?KJi(a.text??""):"";return`${r}${s}](${o.toString()})`}function iNn(a){return Be(a).toLowerCase()==="skill.md"}function D5e(a,i,e){let t=i?eNn(a,i):a;return new he(t,e)}function lB(a,i){if(a!==void 0)return typeof a=="string"?a:D5e(a.markdown,i)}function Fti(a,i,e,t){let o={id:a.toolName,source:wn.Internal,displayName:a.displayName,modelDescription:a.toolName};if(a.status==="pending-confirmation"){let s={title:lB(a.confirmationTitle,t)??a.displayName,message:lB(a.invocationMessage,t)};a.options&&(s.customOptions=a.options);let l,c=a.edits?.items;if(c?.length){let u=h=>t?$S(h,t):h,p=o1o(c,a.toolCallId);l={kind:"modifiedFilesConfirmation",options:["Allow"],modifiedFiles:p.map(h=>{let g=u(h.resource),f=h.originalResource?u(h.originalResource):void 0,v=h.afterContentUri?u(h.afterContentUri):void 0,b=h.beforeContentUri?u(h.beforeContentUri):void 0;return{uri:g,originalUri:f,modifiedContentUri:v,originalContentUri:b,insertions:h.diff?.added,deletions:h.diff?.removed,title:Be(h.resource),description:h.resource.path}})}}else if(ile(a)==="terminal"&&a.toolInput)l={kind:"terminal",commandLine:{original:Rti(a)||""},language:Lti(a)};else if(a.toolInput){let u;try{u=JSON.parse(a.toolInput)}catch{u={input:a.toolInput}}l={kind:"input",rawInput:u}}return new ZM({invocationMessage:lB(a.invocationMessage,t),confirmationMessages:s,presentation:"hiddenAfterComplete",toolSpecificData:l},o,a.toolCallId,i,void 0)}let n=new ZM(void 0,o,a.toolCallId,i,void 0);n.invocationMessage=lB(a.invocationMessage,t)??d(6743,null,a.displayName);let r=a.status==="running"||a.status==="completed"?tvt(a.content):void 0;if(r)n.toolSpecificData={kind:"terminal",commandLine:{original:Rti(a)||""},language:Lti(a),terminalToolSessionId:evt(r,e),terminalCommandUri:A.parse(r),terminalCommandOutput:g4i(a)};else if(Pti(a)){let s=a.status==="running"||a.status==="completed"?Wfe(a):void 0;n.toolSpecificData={kind:"subagent",description:_5e(a),agentName:s?.agentName??Mti(a)}}else ile(a)==="search"&&(n.toolSpecificData={kind:"search"});return n}function t1o(a,i,e){if(i.status!=="running")return;a.invocationMessage=lB(i.invocationMessage,e)??a.invocationMessage;let t=Wfe(i);if(t){a.toolSpecificData={kind:"subagent",description:_5e(i),agentName:t.agentName},a.notifyToolSpecificDataChanged();return}if(a.toolSpecificData?.kind==="subagent"){let o=_5e(i)??a.toolSpecificData.description,n=Mti(i)??a.toolSpecificData.agentName;(o!==a.toolSpecificData.description||n!==a.toolSpecificData.agentName)&&(a.toolSpecificData={kind:"subagent",description:o,agentName:n},a.notifyToolSpecificDataChanged())}}function i1o(a,i,e,t){let o=i.status==="completed",n=i.status==="cancelled",r=i.status==="running"||i.status==="completed"?tvt(i.content):void 0,s=a.toolSpecificData?.kind==="terminal"||!!r||ile(i)==="terminal";if((o||n)&&yo(i,{invocationMessage:!0})&&(a.invocationMessage=lB(i.invocationMessage,t)??a.invocationMessage),o){let f=Wfe(i);if(f){let v=QGt(i);a.toolSpecificData={kind:"subagent",description:_5e(i),agentName:f.agentName,result:v}}else a.toolSpecificData?.kind==="subagent"&&(a.toolSpecificData={kind:"subagent",description:_5e(i)??a.toolSpecificData.description,agentName:Mti(i)??a.toolSpecificData.agentName,result:QGt(i)})}if(s&&(o||n)){let f=a.toolSpecificData;a.presentation=void 0,a.toolSpecificData={kind:"terminal",commandLine:f?.commandLine||{original:Rti(i)||""},language:Lti(i),terminalToolSessionId:r?evt(r,e):f?.terminalToolSessionId,terminalCommandOutput:g4i(i),terminalCommandState:{exitCode:o&&i.success?0:1},terminalCommandUri:r?A.parse(r):f?.terminalCommandUri}}else o&&i.pastTenseMessage&&(a.pastTenseMessage=lB(i.pastTenseMessage,t));let l=o&&!i.success||n,c=o?i.error?.message:n?i.reasonMessage:void 0,u=typeof c=="string"?c:c?.markdown,p=o?v4i(i):[];p.length>0&&!l&&(a.presentation="hidden");let h=!s&&a.toolSpecificData?.kind!=="subagent"&&ile(i)!=="search"&&p.length===0?e1o(i,l,u):void 0,g=l||h?{content:[],toolResultError:l?u:void 0,toolResultDetails:h}:void 0;return a.didExecuteTool(g),p}function v4i(a){if(a.status!=="completed")return[];let i=PFe(a);return i.length===0?[]:o1o(i,a.toolCallId)}function o1o(a,i){let e=[];for(let t of a){let o=!t.before&&!!t.after,n=!!t.before&&!t.after,r=!!t.before&&!!t.after&&!ze(A.parse(t.before.uri),A.parse(t.after.uri)),s;o?s="create":n?s="delete":r?s="rename":s="edit";let l=t.after?.uri?A.parse(t.after.uri):t.before?.uri?A.parse(t.before.uri):void 0;l&&e.push({kind:s,resource:l,originalResource:r?A.parse(t.before.uri):void 0,beforeContentUri:t.before?.content.uri?A.parse(t.before.content.uri):void 0,afterContentUri:t.after?.content.uri?A.parse(t.after.content.uri):void 0,undoStopId:i,diff:t.diff})}return e}var b4i=class{constructor(i,e,t,o,n){this.state=Fo(1);this.isCurrentlyBeingModifiedBy=Fo(void 0);this.lastModifyingResponse=Fo(void 0);this.rewriteRatio=Fo(1);this.waitsForLastEdits=Fo(!1);this.reviewMode=Fo(!1);this.autoAcceptController=Fo(void 0);this.changesCount=Fo(0);this.entryId=`agenthost-${i.toString()}`,this.modifiedURI=i,this.originalURI=e,this.lastModifyingRequestId=t,(o>0||n>0)&&(this.linesAdded=Fo(o),this.linesRemoved=Fo(n))}async accept(){}async reject(){}enableReviewModeUntilSettled(){}getEditorIntegration(i){return{currentIndex:De("currentIndex",0),reveal(){},next(){return!1},previous(){return!1},enableAccessibleDiffView(){},async acceptNearestChange(e){},async rejectNearestChange(e){},async toggleDiff(e,t){},dispose(){}}}},kye=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.chatSessionResource=e;this._connectionAuthority=t;this._editorService=o;this._instantiationService=n;this._logService=r;this._fileService=s;this._textModelService=l;this._editorWorkerService=c;this.supportsKeepUndo=!0;this.isGlobalEditingSession=!1;this._state=De(this,2);this.state=this._state;this._entriesObs=De(this,[]);this.entries=this._entriesObs;this.requestDisablement=Js({equalsFn:(e,t)=>e.length===t.length&&e.every((o,n)=>o.requestId===t[n].requestId&&o.afterUndoStop===t[n].afterUndoStop)},e=>{let t=this._currentCheckpointIndex.read(e);if(t>=this._checkpoints.length-1)return[];let o=new Map;for(let n=t+1;n<this._checkpoints.length;n++){let r=this._checkpoints[n];o.has(r.requestId)||o.set(r.requestId,r.undoStopId)}return[...o].map(([n,r])=>({requestId:n,afterUndoStop:r}))});this._onDidDispose=this._register(new T);this.onDidDispose=this._onDidDispose.event;this._checkpoints=[];this._currentCheckpointIndex=De(this,-1);this._diffCache=new Map;this._undoRedoSequencer=new Tm;this._hasExplanations=!1;this.canUndo=ke(this,e=>this._currentCheckpointIndex.read(e)>=0);this.canRedo=ke(this,e=>this._currentCheckpointIndex.read(e)<this._checkpoints.length-1)}ensureRequestCheckpoint(e){let t=this._currentCheckpointIndex.get();t<this._checkpoints.length-1&&this._checkpoints.splice(t+1),this._checkpoints.some(o=>o.requestId===e)||this._checkpoints.push({requestId:e,undoStopId:void 0,edits:[]})}addToolCallEdits(e,t){if(t.status!=="completed")return[];if(this._checkpoints.some(c=>c.undoStopId===t.toolCallId))return[];this.ensureRequestCheckpoint(e);let o=v4i(t);if(o.length===0)return[];let n=this._connectionAuthority,r=o.map(c=>({kind:c.kind,resource:$S(c.resource,n),originalResource:c.originalResource?$S(c.originalResource,n):void 0,beforeContentUri:c.beforeContentUri?$S(c.beforeContentUri,n):void 0,afterContentUri:c.afterContentUri?$S(c.afterContentUri,n):void 0,undoStopId:c.undoStopId,diff:c.diff})),s={requestId:e,undoStopId:t.toolCallId,edits:r};this._checkpoints.push(s),Ki(c=>{this._currentCheckpointIndex.set(this._checkpoints.length-1,c),this._state.get()===0&&this._state.set(2,c)}),this._rebuildEntries();let l=[];for(let c of r)(c.kind==="create"||c.kind==="delete"||c.kind==="rename")&&l.push({kind:"workspaceEdit",edits:[{oldResource:c.originalResource??(c.kind==="delete"?c.resource:void 0),newResource:c.kind==="delete"?void 0:c.resource}]}),c.afterContentUri&&(l.push({kind:"markdownContent",content:new he("\n````\n")}),l.push({kind:"codeblockUri",uri:c.resource,isEdit:!0,undoStopId:t.toolCallId}),l.push({kind:"textEdit",uri:c.resource,edits:[],done:!1,isExternalEdit:!0}),l.push({kind:"textEdit",uri:c.resource,edits:[],done:!0,isExternalEdit:!0}),l.push({kind:"markdownContent",content:new he("\n````\n")}));return l}async show(e){if(this._editorPane?.isVisible())return;if(this._editorPane?.input){await this._editorService.openEditor(this._editorPane.input,{pinned:!0,activation:1});return}let t=Ou.fromResourceMultiDiffEditorInput({multiDiffSource:JAt(this,e),label:d(6724,null)},this._instantiationService);this._editorPane=await this._editorService.openEditor(t,{pinned:!0,activation:1})}getEntry(e){return this._entriesObs.get().find(t=>ze(t.modifiedURI,e))}readEntry(e,t){return this._entriesObs.read(t).find(o=>ze(o.modifiedURI,e))}async accept(...e){}async reject(...e){}_findCheckpointIndex(e,t){return t!==void 0?this._checkpoints.findIndex(o=>o.requestId===e&&o.undoStopId===t):this._checkpoints.findIndex(o=>o.requestId===e&&o.undoStopId===void 0)}_findCheckpoint(e,t){if(t!==void 0){let o=this._findCheckpointIndex(e,t);return o>=0?this._checkpoints[o]:void 0}for(let o=this._checkpoints.length-1;o>=0;o--){let n=this._checkpoints[o];if(n.requestId===e&&n.undoStopId!==void 0)return n}}async restoreSnapshot(e,t){let o=this._findCheckpointIndex(e,t);if(o<0){this._logService.warn(`[AgentHostEditingSession] No checkpoint found for requestId=${e}${t?`, stopId=${t}`:""}`);return}let n=t===void 0?o-1:o,r=this._currentCheckpointIndex.get();if(n<r)for(let s=r;s>n;s--)await this._writeCheckpointContent(this._checkpoints[s],"before");else if(n>r)for(let s=r+1;s<=n;s++)await this._writeCheckpointContent(this._checkpoints[s],"after");Ki(s=>{this._currentCheckpointIndex.set(n,s)}),this._rebuildEntries()}getSnapshotUri(e,t,o){let n=this._findCheckpoint(e,o);if(!n)return;let r=t.toString();if(n.edits.find(l=>l.resource.toString()===r))return A.from({scheme:Q.chatEditingSnapshotScheme,path:t.path,query:JSON.stringify({session:this.chatSessionResource.toString(),requestId:e,undoStop:o??""})})}async getSnapshotContents(e,t,o){let n=this._findCheckpoint(e,o);if(!n)return;let r=t.toString(),s=n.edits.find(l=>l.resource.toString()===r);if(s)try{return s.afterContentUri?(await this._fileService.readFile(s.afterContentUri)).value:Ke.fromByteArray([])}catch(l){this._logService.warn("[AgentHostEditingSession] Failed to fetch snapshot content",l);return}}async getSnapshotModel(e,t,o){return null}getEntryDiffBetweenStops(e,t,o){let n=t!==void 0?this._checkpoints.findIndex(l=>l.requestId===t&&(o===void 0||l.undoStopId===o)):-1;if(n<0&&t!==void 0)return;let r=t!==void 0?n-1:-1,s=t!==void 0?n:this._checkpoints.length>0?0:-1;if(!(s<0))return this._getFileDiffObservable(e,r,s)}getEntryDiffBetweenRequests(e,t,o){let n=this._checkpoints.map((c,u)=>c.requestId===t?u:-1).filter(c=>c>=0),r=this._checkpoints.map((c,u)=>c.requestId===o?u:-1).filter(c=>c>=0);if(n.length===0||r.length===0)return Fo(void 0);let s=n[0],l=r[r.length-1];return this._getFileDiffObservable(e,s-1,l)}_getFileDiffObservable(e,t,o){let n=e.toString(),r;if(t>=0)for(let l=t;l>=0;l--){for(let c of this._checkpoints[l].edits)if(c.resource.toString()===n){r=c.afterContentUri;break}if(r)break}let s;for(let l=Math.max(0,t);l<=o&&l<this._checkpoints.length;l++)for(let c of this._checkpoints[l].edits)c.resource.toString()===n&&(r||(r=c.beforeContentUri),l>t&&(s=c.afterContentUri));return!r||!s?Fo(void 0):this._computeFileDiffObservable(r,s,e)}_computeFileDiffObservable(e,t,o){let n=`${e.toString()}\0${t.toString()}`,r=this._diffCache.get(n);if(r)return Fo(r);let s=new Uc(this._computeFileDiff(e,t,o));return Js({owner:this},l=>{let c=s.promiseResult.read(l);return c?c.data?(this._diffCache.set(n,c.data),c.data):oee(e,t):{...oee(e,t),isBusy:!0}})}async _computeFileDiff(e,t,o){let n=new O;try{let r=await this._textModelService.createModelReference(e);n.add(r);let s=await this._textModelService.createModelReference(t);n.add(s);let l=await this._editorWorkerService.computeDiff(r.object.textEditorModel.uri,s.object.textEditorModel.uri,{ignoreTrimWhitespace:!1,computeMoves:!1,maxComputationTimeMs:3e3},"advanced"),c={originalURI:e,modifiedURI:o,identical:!!l?.identical,isFinal:!0,quitEarly:!l||l.quitEarly,added:0,removed:0,isBusy:!1};if(l)for(let u of l.changes)c.removed+=u.original.endLineNumberExclusive-u.original.startLineNumber,c.added+=u.modified.endLineNumberExclusive-u.modified.startLineNumber;return c}catch(r){return this._logService.warn("[AgentHostEditingSession] diff computation failed",r),{...oee(e,t),isFinal:!0}}finally{n.dispose()}}getDiffsForFilesInSession(){return ke(this,e=>{let t=this._currentCheckpointIndex.read(e);return this._readDiffsFromCheckpoints(-1,t)}).map((e,t)=>e.read(t))}getDiffsForFilesInRequest(e){return ke(this,t=>{let o=this._currentCheckpointIndex.read(t),n=[];for(let r=0;r<=o&&r<this._checkpoints.length;r++)this._checkpoints[r].requestId===e&&n.push(r);if(n.length!==0)return this._readDiffsFromCheckpoints(n[0]-1,n[n.length-1])}).map((t,o)=>t?.read(o)||[])}hasEditsInRequest(e,t){return this._checkpoints.some(o=>o.requestId===e)}getDiffForSession(){let e=this.getDiffsForFilesInSession();return ke(this,t=>{let o=e.read(t),n=0,r=0;for(let s of o)n+=s.added,r+=s.removed;return{added:n,removed:r}})}async undoInteraction(){return this._undoRedoSequencer.queue(()=>this._undoInteractionImpl())}async redoInteraction(){return this._undoRedoSequencer.queue(()=>this._redoInteractionImpl())}async _undoInteractionImpl(){let e=this._currentCheckpointIndex.get();if(e<0)return;await this._writeCheckpointContent(this._checkpoints[e],"before");let t=e-1;for(;t>=0&&this._checkpoints[t].undoStopId===void 0;)t--;Ki(o=>{this._currentCheckpointIndex.set(t,o)}),this._rebuildEntries()}async _redoInteractionImpl(){let e=this._currentCheckpointIndex.get();if(e>=this._checkpoints.length-1)return;let t=e+1;for(;t<this._checkpoints.length&&this._checkpoints[t].undoStopId===void 0;)t++;t>=this._checkpoints.length||(await this._writeCheckpointContent(this._checkpoints[t],"after"),Ki(o=>{this._currentCheckpointIndex.set(t,o)}),this._rebuildEntries())}async triggerExplanationGeneration(){this._hasExplanations=!0}clearExplanations(){this._hasExplanations=!1}hasExplanations(){return this._hasExplanations}startStreamingEdits(e,t,o){throw new Error("Not supported for agent host sessions")}applyWorkspaceEdit(e,t,o){throw new Error("Not supported for agent host sessions")}async startExternalEdits(e,t,o,n,r){throw new Error("Not supported for agent host sessions")}async stopExternalEdits(e,t,o){throw new Error("Not supported for agent host sessions")}async stop(e){this.dispose()}dispose(){this._state.set(3,void 0),this._onDidDispose.fire(),this._diffCache.clear(),super.dispose()}_rebuildEntries(){let e=this._currentCheckpointIndex.get(),t=new Map;for(let n=0;n<=e&&n<this._checkpoints.length;n++){let r=this._checkpoints[n];for(let s of r.edits){let l=s.resource.toString(),c=t.get(l);c?(s.afterContentUri&&(c.afterContentUri=s.afterContentUri),c.requestId=r.requestId,c.added+=s.diff?.added??0,c.removed+=s.diff?.removed??0):t.set(l,{resource:s.resource,beforeContentUri:s.beforeContentUri,afterContentUri:s.afterContentUri,requestId:r.requestId,added:s.diff?.added??0,removed:s.diff?.removed??0})}}let o=[...t.values()].filter(n=>n.beforeContentUri&&n.afterContentUri).map(n=>new b4i(n.resource,n.beforeContentUri,n.requestId,n.added,n.removed));this._entriesObs.set(o,void 0)}async _writeCheckpointContent(e,t){let o=e.edits.map(async n=>{try{if(t==="before")switch(n.kind){case"create":await this._fileService.del(n.resource);break;case"delete":if(n.beforeContentUri){let r=await this._fileService.readFile(n.beforeContentUri);await this._fileService.writeFile(n.resource,r.value)}break;case"rename":if(n.originalResource&&await this._fileService.move(n.resource,n.originalResource,!0),n.beforeContentUri&&n.originalResource){let r=await this._fileService.readFile(n.beforeContentUri);await this._fileService.writeFile(n.originalResource,r.value)}break;case"edit":if(n.beforeContentUri){let r=await this._fileService.readFile(n.beforeContentUri);await this._fileService.writeFile(n.resource,r.value)}break}else switch(n.kind){case"create":if(n.afterContentUri){let r=await this._fileService.readFile(n.afterContentUri);await this._fileService.writeFile(n.resource,r.value)}break;case"delete":await this._fileService.del(n.resource);break;case"rename":if(n.originalResource&&await this._fileService.move(n.originalResource,n.resource,!0),n.afterContentUri){let r=await this._fileService.readFile(n.afterContentUri);await this._fileService.writeFile(n.resource,r.value)}break;case"edit":if(n.afterContentUri){let r=await this._fileService.readFile(n.afterContentUri);await this._fileService.writeFile(n.resource,r.value)}break}}catch(r){this._logService.warn(`[AgentHostEditingSession] Failed to ${t==="before"?"undo":"redo"} ${n.kind} for ${n.resource.toString()}`,r)}});await Promise.all(o)}_readDiffsFromCheckpoints(e,t){let o=new Set,n=[];for(let s=Math.max(0,e+1);s<=t&&s<this._checkpoints.length;s++)for(let l of this._checkpoints[s].edits){let c=l.resource.toString();o.has(c)||(o.add(c),n.push(l.resource))}let r=n.map(s=>this._getFileDiffObservable(s,e,t));return ke(s=>r.flatMap(l=>l.read(s)).filter(so))}};kye=I([m(2,ie),m(3,F),m(4,re),m(5,ge),m(6,Bt),m(7,Qs)],kye);function oNn(a){let i=a?._meta?.copilotUsage;if(i&&typeof i=="object"&&yo(i,{totalNanoAiu:!0})){let t=Object.getOwnPropertyDescriptor(i,"totalNanoAiu")?.value;if(typeof t=="number"&&t>0)return t/1e9}let e=a?._meta?.cost;return typeof e=="number"&&e>0?e:void 0}function nNn(a){switch(a?.type){case 1:return"not-needed";case 2:case 3:return"setting";default:return"user-action"}}function rNn(a){let i={};for(let[e,t]of Object.entries(a))if(typeof t=="string")i[e]={state:"submitted",value:{kind:"text",value:t}};else if(t&&typeof t=="object"){let o=t,n=t;Array.isArray(o.selectedValues)?i[e]={state:"submitted",value:{kind:"selected-many",value:o.selectedValues,freeformValues:o.freeformValue?[o.freeformValue]:void 0}}:n.selectedValue?i[e]={state:"submitted",value:{kind:"selected",value:n.selectedValue,freeformValues:n.freeformValue?[n.freeformValue]:void 0}}:n.freeformValue&&(i[e]={state:"submitted",value:{kind:"text",value:n.freeformValue}})}return i}function sNn(a){if(a.state==="submitted")switch(a.value.kind){case"text":return a.value.value;case"number":case"boolean":return String(a.value.value);case"selected":return{selectedValue:a.value.value,freeformValue:a.value.freeformValues?.[0]};case"selected-many":return{selectedValues:a.value.value,freeformValue:a.value.freeformValues?.[0]}}}function n1o(a){if(!a)return;let i={};for(let[e,t]of Object.entries(a)){let o=sNn(t);o!==void 0&&(i[e]=o)}return Object.keys(i).length>0?i:void 0}var ivt=class extends k{constructor(e,t,o,n,r,s,l){super();this.sessionResource=e;this.history=t;this._forkSession=o;this._logService=l;this.progressObs=De("agentHostProgress",[]);this.isCompleteObs=De("agentHostComplete",!0);this._onWillDispose=this._register(new T);this.onWillDispose=this._onWillDispose.event;this._onDidStartServerRequest=this._register(new T);this.onDidStartServerRequest=this._onDidStartServerRequest.event;n!==void 0&&(this.isCompleteObs.set(!1,void 0),this.progressObs.set(n,void 0)),this._register(ee(r)),this.interruptActiveResponseCallback=async()=>s(),this.forkSession=this._forkSession}dispose(){this._store.isDisposed||this._onWillDispose.fire(),super.dispose()}registerDisposable(e){return this._register(e)}appendProgress(e){let t=this.progressObs.get();this.progressObs.set([...t,...e],void 0)}complete(){this.isCompleteObs.set(!0,void 0)}startServerRequest(e,t){this._logService.info("[AgentHost] Server-initiated request started"),Ki(o=>{this.progressObs.set([],o),this.isCompleteObs.set(!1,o)}),this._onDidStartServerRequest.fire({prompt:e,variableData:t})}};ivt=I([m(6,re)],ivt);function r1o(a,i){let e=1,t=1,o=Math.min(i,a.length);for(let n=0;n<o;n++)a.charCodeAt(n)===10?(e++,t=1):t++;return{lineNumber:e,column:t}}var Eye=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b,S,y){super();this._chatAgentService=t;this._chatService=o;this._chatEditingService=n;this._logService=r;this._productService=s;this._workspaceContextService=l;this._instantiationService=c;this._terminalChatService=u;this._agentHostTerminalService=p;this._workingDirectoryResolver=h;this._provisionalService=g;this._toolsService=f;this._configurationService=v;this._chatWidgetService=b;this._languageModelsService=S;this._openerService=y;this._activeSessions=new dt;this._pendingMessageSubscriptions=this._register(new bI);this._serverTurnWatchers=this._register(new bI);this._pendingHistoryTurns=new dt;this._clientDispatchedTurnIds=new Set;this._sessionSubscriptions=new Map;this._config=e;let w=this._toolsService.observeTools(void 0),x=hr("chat.agentHost.clientTools",[],this._configurationService);this._clientToolsObs=ke(E=>{let M=new Set(x.read(E));return w.read(E).filter(V=>V.toolReferenceName!==void 0&&M.has(V.toolReferenceName))}),this._register(ve(E=>{let N=this._clientToolsObs.read(E).map(S4i);for(let[V]of this._activeSessions){let H=this._resolveSessionUri(V);this._getSessionState(H.toString())?.activeClient?.clientId===this._config.connection.clientId&&this._dispatchAction({type:"session/activeClientToolsChanged",session:H.toString(),tools:N})}})),this._register(this._terminalChatService.onDidContinueInBackground(E=>{let M=XUo(E);M&&(this._logService.info(`[AgentHost] Continue in background: terminal=${M.terminal}, session=${M.session}`),this._config.connection.dispatch({type:"terminal/claimed",terminal:M.terminal,claim:{kind:"session",session:M.session}}))})),this._register(this._chatEditingService.registerEditingSessionProvider(e.sessionType,{createEditingSession:E=>this._instantiationService.createInstance(kye,E,e.connectionAuthority)})),e.customizations&&this._register(ve(E=>{let M=e.customizations.read(E);for(let[N]of this._activeSessions){let V=this._resolveSessionUri(N);this._getSessionState(V.toString())?.activeClient?.clientId===this._config.connection.clientId&&this._dispatchActiveClient(V,M)}})),this._registerAgent()}async provideChatInputCompletions(e,t,o){let n=this._resolveSessionUri(e),r=await this._config.connection.completions({kind:"userMessage",session:n.toString(),text:t.text,offset:t.offset});if(o.isCancellationRequested)return;let s=[];for(let l of r.items){let c=this._toChatInputCompletionItem(l,t.text);c&&s.push(c)}return{items:s}}provideChatInputCompletionTriggerCharacters(){return this._config.connection.getCompletionTriggerCharacters()}_createCompletionItem(e,t,o){let n={insertText:e.insertText,attachment:o};return e.rangeStart!==void 0&&(n.start=r1o(t,e.rangeStart)),e.rangeEnd!==void 0&&(n.end=r1o(t,e.rangeEnd)),n}_toChatInputCompletionItem(e,t){let o=e.attachment;switch(o.type){case"simple":return typeof o._meta?.command=="string"?this._createCompletionItem(e,t,{kind:"command",command:o._meta.command,description:typeof o._meta.description=="string"?o._meta.description:"",...o._meta!==void 0&&{_meta:o._meta}}):typeof o._meta?.uri=="string"?this._createCompletionItem(e,t,{kind:"skill",uri:A.parse(o._meta.uri),...typeof o._meta.displayName=="string"?{displayName:o._meta.displayName}:{},...typeof o._meta.description=="string"?{description:o._meta.description}:{},...o._meta!==void 0&&{_meta:o._meta}}):void 0;case"resource":{let n=typeof o.uri=="string"?A.parse(o.uri):A.from(o.uri);return this._createCompletionItem(e,t,{kind:"resource",uri:n,displayName:o.label,isDirectory:o.displayKind==="directory",...o._meta!==void 0&&{_meta:o._meta}})}default:return}}async provideChatSessionContent(e,t){if(e.path.substring(1).startsWith("untitled-"))throw new Error(`Agent host chat sessions must be created by the sessions provider: ${e.toString()}`);let o=this._resolveSessionUri(e),n=this._isNewSessionResource(e),r=[],s,l;if(!n){try{let p=this._ensureSessionSubscription(o.toString());this._getSessionState(o.toString())||await new Promise(g=>{let f=p.onDidChange(()=>{f.dispose(),g()})});let h=this._getSessionState(o.toString());if(h){let g=h.summary.model?.id,f=this._createTurnModelLookup(e,g);if(r.push(...JUo(o,h.turns,this._config.agentId,this._config.connectionAuthority,f)),await this._enrichHistoryWithSubagentCalls(r,o),h.turns.some(b=>b.responseParts.some(S=>S.kind==="toolCall"&&S.toolCall.status==="completed"&&PFe(S.toolCall).length>0))&&this._pendingHistoryTurns.set(e,h.turns),h.activeTurn){l=h.activeTurn.id;let b=h.activeTurn.usage?.model??g;r.push({type:"request",prompt:h.activeTurn.userMessage.text,participant:this._config.agentId,modelId:f.toLanguageModelId(b),variableData:Nti(h.activeTurn.userMessage,this._config.connectionAuthority)}),r.push({type:"response",parts:[],participant:this._config.agentId,details:f.toResponseDetails(b,h.activeTurn.usage)}),s=ZUo(o,h.activeTurn,this._config.connectionAuthority),this._logService.info(`[AgentHost] Reconnecting to active turn ${l} for session ${o.toString()}`)}}}catch(p){this._logService.warn(`[AgentHost] Failed to subscribe to existing session: ${o.toString()}`,p)}let u=this._config.customizations?.get()??[];this._dispatchActiveClient(o,u)}let c=this._instantiationService.createInstance(ivt,e,r,(u,p)=>{if(!this._getSessionState(o.toString()))throw new Error("Cannot fork session before the initial request");return this._forkSession(e,o,u,p)},s,()=>{this._activeSessions.delete(e),this._pendingMessageSubscriptions.deleteAndDispose(e),this._serverTurnWatchers.deleteAndDispose(e),this._pendingHistoryTurns.delete(e),this._releaseSessionSubscription(o.toString())},()=>{let u=o.toString(),p=this._getSessionState(u)?.activeTurn?.id;return p&&(this._logService.info(`[AgentHost] Cancellation requested for ${u}, dispatching turnCancelled`),this._config.connection.dispatch({type:"session/turnCancelled",session:u,turnId:p})),!0});return this._activeSessions.set(e,c),n||(this._ensurePendingMessageSubscription(e,o),this._pendingHistoryTurns.has(e)&&c.registerDisposable(U.once(this._chatService.onDidCreateModel)(u=>{ze(u.sessionResource,e)&&this._ensureEditingSession(e)})),l&&s!==void 0&&this._reconnectToActiveTurn(o,l,c,s),this._watchForServerInitiatedTurns(o,e)),c}_registerAgent(){let e={id:this._config.agentId,name:this._config.agentId,fullName:this._config.fullName,description:this._config.description,extensionId:new hi(this._config.extensionId??"vscode.agent-host"),extensionVersion:void 0,extensionPublisherId:"vscode",extensionDisplayName:this._config.extensionDisplayName??"Agent Host",isDefault:!1,isDynamic:!0,isCore:!0,metadata:{themeIcon:MYe(this._productService)},slashCommands:[],locations:["panel"],modes:["agent"],disambiguation:[]},t={invoke:async(o,n,r,s)=>this._invokeAgent(o,n,s)};this._register(this._chatAgentService.registerDynamicAgent(e,t))}async _invokeAgent(e,t,o){this._logService.info(`[AgentHost] _invokeAgent called for resource: ${e.sessionResource.toString()}`);let n=this._resolveSessionUri(e.sessionResource),r=n.toString();this._provisionalService.get(e.sessionResource)&&this._ensureSessionSubscription(r),this._readEagerlyCreatedSessionState(n)?(this._ensureSessionSubscription(r),this._ensurePendingMessageSubscription(e.sessionResource,n),this._watchForServerInitiatedTurns(n,e.sessionResource),e.agentHostSessionConfig&&Object.keys(e.agentHostSessionConfig).length>0&&this._dispatchAction({type:"session/configChanged",session:r,config:e.agentHostSessionConfig}),this._dispatchActiveClient(n,this._config.customizations?.get()??[])):await this._createAndSubscribe(e.sessionResource,this._createModelSelection(e.userSelectedModelId,e.modelConfiguration),void 0,e.agentHostSessionConfig);let c=await this._handleTurn(n,e,t,o),u=this._getTurnResponseDetails(e.sessionResource,n,c);return u?{details:u}:{}}_readEagerlyCreatedSessionState(e){let t=this._config.connection.getSubscriptionUnmanaged(1,e);if(!t)return;let o=t.value;return o&&!(o instanceof Error)?o:void 0}_syncPendingMessages(e,t){let o=this._chatService.getSession(e);if(!o)return;let n=t.toString(),r=o.getPendingRequests(),s=this._getSessionState(n),l=s?.steeringMessage,c=s?.queuedMessages??[],u,p=[];for(let b of r){let S=b.request.variableData?.variables??[],y=this._variableEntriesToAttachments(S,e),w=y.length>0?y:void 0,x={id:b.request.id,text:b.request.message.text,attachments:w};b.kind==="steering"?u=x:p.push(x)}u?(u.id!==l?.id||u.text!==l.userMessage.text)&&this._dispatchAction({type:"session/pendingMessageSet",session:n,kind:"steering",id:u.id,userMessage:{text:u.text,attachments:u.attachments}}):l&&this._dispatchAction({type:"session/pendingMessageRemoved",session:n,kind:"steering",id:l.id});let h=new Set(p.map(b=>b.id));for(let b of c)h.has(b.id)||this._dispatchAction({type:"session/pendingMessageRemoved",session:n,kind:"queued",id:b.id});let g=new Map(c.map(b=>[b.id,b]));for(let b of p){let S=g.get(b.id);(!S||b.text!==S.userMessage.text)&&this._dispatchAction({type:"session/pendingMessageSet",session:n,kind:"queued",id:b.id,userMessage:{text:b.text,attachments:b.attachments}})}let v=this._getSessionState(n)?.queuedMessages??[];v.length>1&&p.length===v.length&&p.some((S,y)=>S.id!==v[y].id)&&this._dispatchAction({type:"session/queuedMessagesReordered",session:n,order:p.map(S=>S.id)})}_dispatchAction(e){this._config.connection.dispatch(e)}_dispatchActiveClient(e,t){this._dispatchAction({type:"session/activeClientChanged",session:e.toString(),activeClient:{clientId:this._config.connection.clientId,tools:this._clientToolsObs.get().map(S4i),customizations:t}})}_watchForServerInitiatedTurns(e,t){let o=e.toString(),n=this._getSessionState(o),r=n?.activeTurn?.id,s,l=n?.steeringMessage?.id,c=new O,u=new ue;c.add(u);let p=this._ensureSessionSubscription(o);c.add(p.onDidChange(h=>{let g={session:o,state:h},f=new Set((g.state.queuedMessages??[]).map(w=>w.id)),v=g.state.steeringMessage?.id;l&&l!==v&&this._chatService.removePendingRequest(t,l),l=v;let b=g.state.activeTurn;if(!b||b.id===r){s=f;return}if(r=b.id,this._clientDispatchedTurnIds.has(b.id)){s=f;return}let S=this._activeSessions.get(t);if(!S){s=f;return}if(this._logService.info(`[AgentHost] Server-initiated turn detected: ${b.id}`),s)for(let w of s)f.has(w)||this._chatService.removePendingRequest(t,w);s=f,S.startServerRequest(b.userMessage.text,Nti(b.userMessage,this._config.connectionAuthority));let y=new O;u.value=y,this._trackServerTurnProgress(e,b.id,S,y)})),this._serverTurnWatchers.set(t,c)}_trackServerTurnProgress(e,t,o,n){let r=new qe;n.add(ee(()=>r.dispose(!0))),n.add(this._observeTurn({backendSession:e,sessionResource:o.sessionResource,turnId:t,sink:s=>o.appendProgress(s),cancellationToken:r.token,onTurnEnded:()=>o.isCompleteObs.set(!0,void 0)}))}async _handleTurn(e,t,o,n){if(n.isCancellationRequested)return;let r=t.requestId;this._clientDispatchedTurnIds.add(r);let s=await this._convertVariablesToAttachments(t);if(n.isCancellationRequested)return;let l=this._createModelSelection(t.userSelectedModelId,t.modelConfiguration);if(l){let h=this._getSessionState(e.toString())?.summary.model;this._modelSelectionsEqual(h,l)||this._config.connection.dispatch({type:"session/modelChanged",session:e.toString(),model:l})}let c=this._chatService.getSession(t.sessionResource),u=this._getSessionState(e.toString());if(c&&u?.turns.length){let h=c.getRequests().findIndex(f=>f.id===t.requestId)-1,g=h>=0?c.getRequests()[h]:void 0;if(!g&&u.turns.length>0){let f={type:"session/truncated",session:e.toString()};this._config.connection.dispatch(f)}else{let f=u.turns.findIndex(v=>v.id===g.id);if(f!==-1&&f<u.turns.length-1){let v={type:"session/truncated",session:e.toString(),turnId:g.id};this._config.connection.dispatch(v)}}}let p={type:"session/turnStarted",session:e.toString(),turnId:r,userMessage:{text:t.message,attachments:s.length>0?s:void 0}};return this._config.connection.dispatch(p),this._ensureEditingSession(t.sessionResource)?.ensureRequestCheckpoint(t.requestId),new Promise(h=>{let g=new O,f=g.add(n.onCancellationRequested(()=>{f.dispose(),this._logService.info(`[AgentHost] Cancellation requested for ${e.toString()}, dispatching turnCancelled`),this._config.connection.dispatch({type:"session/turnCancelled",session:e.toString(),turnId:r})}));g.add(this._observeTurn({backendSession:e,sessionResource:t.sessionResource,turnId:r,sink:o,cancellationToken:n,onTurnEnded:v=>{g.dispose(),this._clientDispatchedTurnIds.delete(r),this._activeSessions.get(t.sessionResource)?.isCompleteObs.set(!0,void 0),h(v)},onFileEdits:v=>{let b=this._hydrateFileEdits(t.sessionResource,t.requestId,v);b.length>0&&o(b)}}))})}_awaitToolConfirmation(e,t,o,n,r,s){pi.awaitConfirmation(e,r).then(l=>{let c;l.type===4&&l.selectedButton&&s&&(c=s.find(p=>p.id===l.selectedButton));let u=c?c.kind==="approve":l.type!==0&&l.type!==5;this._logService.info(`[AgentHost] Tool confirmation: toolCallId=${t}, approved=${u}, selectedOptionId=${c?.id}`),u?this._config.connection.dispatch({type:"session/toolCallConfirmed",session:o.toString(),turnId:n,toolCallId:t,approved:!0,confirmed:"user-action",...c?{selectedOptionId:c.id}:{}}):this._config.connection.dispatch({type:"session/toolCallConfirmed",session:o.toString(),turnId:n,toolCallId:t,approved:!1,reason:"denied",...c?{selectedOptionId:c.id}:{}})}).catch(l=>{this._logService.warn(`[AgentHost] Tool confirmation failed for toolCallId=${t}`,l)})}_observeTurn(e){let t=e.backendSession.toString(),o=new O,n=this._ensureSessionSubscription(t),r=Kji(this,n),s=ke(v=>{let b=r.read(v);if(b)return b.activeTurn?.id===e.turnId?b.activeTurn:b.turns.find(S=>S.id===e.turnId)}),l=ke(v=>s.read(v)?.responseParts??[]),c=ke(v=>r.read(v)?.inputRequests??[]),u=ke(v=>s.read(v)?.usage),p=new Set;if(o.add(I4e(l,v=>v.kind==="toolCall"?`tc:${v.toolCall.toolCallId}`:v.kind==="markdown"?`md:${v.id}`:v.kind==="reasoning"?`rs:${v.id}`:`other:${l.get().indexOf(v)}`,(v,b,S)=>{switch(b.get().kind){case"markdown":if(e.subAgentInvocationId!==void 0)break;this._setupMarkdownPart(b,S,e);break;case"reasoning":if(e.subAgentInvocationId!==void 0)break;this._setupReasoningPart(b,S,e);break;case"toolCall":this._setupToolCallPart(b,S,e,p);break}})),e.subAgentInvocationId===void 0){let v;o.add(ve(b=>{let S=Ati(u.read(b));S&&(v&&v.promptTokens===S.promptTokens&&v.completionTokens===S.completionTokens&&v.outputBuffer===S.outputBuffer&&Qi(v.promptTokenDetails,S.promptTokenDetails)||(v=S,e.sink([S])))})),o.add(I4e(c,b=>b.id,(b,S,y)=>{this._setupInputRequest(S.get(),y,e)}))}let h=!1,g=!1,f=v=>{h||(h=!0,queueMicrotask(()=>{try{e.onTurnEnded?.(v)}finally{o.dispose()}}))};return o.add(ve(v=>{if(h)return;let b=r.read(v);if(!b)return;if(b.activeTurn?.id===e.turnId){g=!0;return}let S=b.turns.find(y=>y.id===e.turnId);S&&(g=!0),g&&(S?.state==="error"&&S.error&&e.sink([{kind:"markdownContent",content:new he(`

Error: (${S.error.errorType}) ${S.error.message}`)}]),f(S))})),o.add(e.cancellationToken.onCancellationRequested(()=>f(void 0))),o}_setupMarkdownPart(e,t,o){let n=o.seedEmittedLengths?.get(e.get().id)??0;t.add(ve(r=>{let s=e.read(r).content;if(s.length<=n)return;let l=s.substring(n);n=s.length,o.sink([{kind:"markdownContent",content:D5e(l,this._config.connectionAuthority,{supportHtml:!0})}])}))}_setupReasoningPart(e,t,o){let n=o.seedEmittedLengths?.get(e.get().id)??0;t.add(ve(r=>{let s=e.read(r).content;if(s.length<=n)return;let l=s.substring(n);n=s.length,o.sink([{kind:"thinking",value:l}])}))}_setupToolCallPart(e,t,o,n){let r=e.get().toolCall;r.toolClientId===this._config.connection.clientId?this._setupClientToolCall(r,e,t,o):this._setupServerToolCall(r,e,t,o,n)}_setupServerToolCall(e,t,o,n,r){let s=e.toolCallId,l=n.subAgentInvocationId,c=n.adoptInvocations?.get(s),u=c??Fti(e,l,n.backendSession,this._config.connectionAuthority);c||n.sink([u]);let p=g=>{l!==void 0||r.has(s)||!(Pti(g)||(g.status==="running"||g.status==="completed")&&Wfe(g))||(r.add(s),this._observeSubagentSession(n.sessionResource,n.backendSession,s,n.sink,o,r))};e.status==="pending-confirmation"&&!pi.isComplete(u)&&this._awaitToolConfirmation(u,s,n.backendSession,n.turnId,n.cancellationToken,e.options),p(e);let h;o.add(ve(g=>{let f=t.read(g).toolCall,v=f.status,b=h!==void 0&&h!=="pending-confirmation"&&v==="pending-confirmation";if(h=v,b){u.didExecuteTool(void 0);let S=Fti(f,l,n.backendSession,this._config.connectionAuthority);n.sink([S]),this._awaitToolConfirmation(S,s,n.backendSession,n.turnId,n.cancellationToken,f.options),u=S}else(v==="running"||v==="pending-result-confirmation")&&(u.invocationMessage=lB(f.invocationMessage,this._config.connectionAuthority),this._reviveTerminalIfNeeded(u,f,n.backendSession),t1o(u,f,this._config.connectionAuthority));if((v==="completed"||v==="cancelled")&&!pi.isComplete(u)){this._reviveTerminalIfNeeded(u,f,n.backendSession);let S=i1o(u,f,n.backendSession,this._config.connectionAuthority);S.length>0&&n.onFileEdits?.(f,S)}p(f)})),o.add(ee(()=>{pi.isComplete(u)||u.didExecuteTool(void 0)}))}_setupClientToolCall(e,t,o,n){let r=e.toolCallId,s=e.toolName,l=n.adoptInvocations?.get(r);l&&!pi.isComplete(l)&&l.didExecuteTool(void 0);let c=this._toolsService.getToolByName(s);if(!c){this._logService.warn(`[AgentHost] Client tool call for unknown tool: ${s}`),this._dispatchAction({type:"session/toolCallComplete",session:n.backendSession.toString(),turnId:n.turnId,toolCallId:r,result:{success:!1,pastTenseMessage:`Tool "${s}" is not available`,error:{message:`Tool "${s}" is not available on this client`}}});return}let u=this._toolsService.beginToolCall({toolCallId:r,toolId:c.id,sessionResource:n.sessionResource,force:!0});if(!u){this._logService.warn(`[AgentHost] Failed to begin client tool invocation: ${s}`),this._dispatchAction({type:"session/toolCallComplete",session:n.backendSession.toString(),turnId:n.turnId,toolCallId:r,result:{success:!1,pastTenseMessage:`Failed to start ${s}`,error:{message:`Could not create invocation for client tool "${s}"`}}});return}let p=new qe;o.add(ee(()=>p.dispose(!0)));let h=!1,g=!1,f=!1;o.add(ve(b=>{let S=u.state.read(b);if(!f){if(S.type===pi.StateKind.Executing){if(f=!0,p.token.isCancellationRequested)return;g=!0,this._dispatchAction({type:"session/toolCallConfirmed",session:n.backendSession.toString(),turnId:n.turnId,toolCallId:r,approved:!0,confirmed:nNn(S.confirmed)})}else if(S.type===pi.StateKind.Cancelled){if(f=!0,p.token.isCancellationRequested)return;this._dispatchAction({type:"session/toolCallConfirmed",session:n.backendSession.toString(),turnId:n.turnId,toolCallId:r,approved:!1,reason:"denied"})}}}));let v=(b,S)=>{if(!p.token.isCancellationRequested){if(!g){S!==void 0&&!Yi(S)&&this._logService.warn(`[AgentHost] Client tool rejected pre-execution: ${s}`,S);return}if(S!==void 0){Yi(S)||this._logService.warn(`[AgentHost] Client tool invocation failed: ${s}`,S);let y=S instanceof Error?S.message:String(S);b={content:[],toolResultError:y}}this._dispatchAction({type:"session/toolCallComplete",session:n.backendSession.toString(),turnId:n.turnId,toolCallId:r,result:aNn(b??{content:[]},s)})}};o.add(ve(b=>{let S=t.read(b).toolCall;if(S.status==="cancelled"){if(p.token.isCancellationRequested)return;p.cancel(),h||u.cancelFromStreaming(5);return}if(h||p.token.isCancellationRequested)return;let y="toolInput"in S?S.toolInput:void 0;if(y===void 0){if(S.status==="streaming")return;y="{}"}h=!0;let w={};try{let M=JSON.parse(y);if(!M||typeof M!="object"||Array.isArray(M))throw new Error("expected JSON object");w=M}catch{this._logService.warn(`[AgentHost] Failed to parse tool input for ${s}`),this._dispatchAction({type:"session/toolCallComplete",session:n.backendSession.toString(),turnId:n.turnId,toolCallId:r,result:{success:!1,pastTenseMessage:`Failed to execute ${s}`,error:{message:`Invalid tool input for "${s}": expected JSON object parameters`}}});return}let x={callId:r,toolId:u.toolId,parameters:w,context:{sessionResource:n.sessionResource},chatStreamToolCallId:r},E=async()=>0;this._logService.info(`[AgentHost] Invoking client tool: ${s} (callId=${r})`),this._toolsService.invokeTool(x,E,p.token).then(M=>v(M,void 0),M=>v(void 0,M))}))}_setupInputRequest(e,t,o){if(e.url){this._setupUrlInputRequest(e,e.url,t,o);return}let n=(e.questions??[]).map(c=>{switch(c.kind){case"single-select":return{id:c.id,type:"singleSelect",title:c.title??c.message,description:c.title!==void 0?c.message:void 0,required:c.required,allowFreeformInput:c.allowFreeformInput??!0,options:c.options.map(u=>({id:u.id,label:u.label,value:u.id}))};case"multi-select":return{id:c.id,type:"multiSelect",title:c.title??c.message,description:c.title!==void 0?c.message:void 0,required:c.required,allowFreeformInput:c.allowFreeformInput??!0,options:c.options.map(u=>({id:u.id,label:u.label,value:u.id}))};case"text":return{id:c.id,type:"text",title:c.title??c.message,description:c.title!==void 0?c.message:void 0,required:c.required,defaultValue:c.defaultValue};default:return{id:c.id,type:"text",title:c.title??c.message,description:c.title!==void 0?c.message:void 0,required:c.required}}});n.length===0&&n.push({id:"answer",type:"text",title:e.message??"",required:!0});let r=new nI(n,!0,e.id,void 0,void 0,e.message?D5e(e.message,this._config.connectionAuthority):void 0);o.sink([r]);let s=e.answers,l=this._ensureSessionSubscription(o.backendSession.toString());if(t.add(l.onWillApplyAction(c=>{let u=c.action;if(u.type!=="session/inputCompleted"||u.requestId!==e.id)return;s=u.response==="accept"?u.answers??s:void 0;let p=n1o(s);r.data=p??{},r.draftAnswers=void 0,r.draftCurrentIndex=void 0,r.draftCollapsed=void 0})),r.completion.p.then(c=>{if(!t.isDisposed)if(!c.answers)this._config.connection.dispatch({type:"session/inputCompleted",session:o.backendSession.toString(),requestId:e.id,response:"cancel"});else{let u=rNn(c.answers);this._config.connection.dispatch({type:"session/inputCompleted",session:o.backendSession.toString(),requestId:e.id,response:"accept",answers:u})}}),o.cancellationToken.isCancellationRequested)r.completion.complete({answers:void 0});else{let c=o.cancellationToken.onCancellationRequested(()=>{r.completion.complete({answers:void 0})});r.completion.p.finally(()=>c.dispose())}t.add(ee(()=>{if(r.isUsed)return;let c=n1o(s);r.data=c??{},r.isUsed=!0,r.draftAnswers=void 0,r.draftCurrentIndex=void 0,r.draftCollapsed=void 0,r.completion.complete({answers:c}),this._chatWidgetService.getWidgetBySessionResource(o.sessionResource)?.input.clearQuestionCarousel(void 0,e.id)}))}_setupUrlInputRequest(e,t,o,n){let r=!1,s=h=>{r||(r=!0,this._config.connection.dispatch({type:"session/inputCompleted",session:n.backendSession.toString(),requestId:e.id,response:h}))},l=t;try{l=A.parse(t).authority||t}catch{}let c=new he;e.message&&(c.appendText(e.message),c.appendMarkdown(`

`)),c.appendMarkdown(d(6734,null)),c.appendCodeblock("",t);let u=new gV(d(6736,null),c,"",d(6735,null,l),d(6733,null),async()=>{try{return await this._openerService.open(t,{allowCommands:!1})?(s("accept"),"accepted"):(s("decline"),"rejected")}catch{return s("decline"),"rejected"}},async()=>(s("decline"),"rejected"));n.sink([u]);let p=this._ensureSessionSubscription(n.backendSession.toString());if(o.add(p.onWillApplyAction(h=>{let g=h.action;g.type==="session/inputCompleted"&&g.requestId===e.id&&(r=!0,g.response==="accept"?u.state.set("accepted",void 0):u.state.set("rejected",void 0),u.hide())})),n.cancellationToken.isCancellationRequested)s("cancel"),u.hide();else{let h=n.cancellationToken.onCancellationRequested(()=>{s("cancel"),u.hide()});o.add(ee(()=>h.dispose()))}o.add(ee(()=>{s("cancel"),u.hide()}))}_reviveTerminalIfNeeded(e,t,o){if(t.status!=="running"&&t.status!=="completed"&&t.status!=="pending-result-confirmation")return;let n=tvt(t.content);if(!n||!t.toolInput)return;e.presentation=void 0;let r=t.toolInput;this._ensureTerminalInstance(n,o).then(s=>{let l=e.toolSpecificData?.kind==="terminal"?e.toolSpecificData:void 0,c=l?.terminalCommandId;if(!c){let u=this._terminalChatService.getAhpCommandSource(s);u&&(c=(u.executingCommandObject??u.commands[u.commands.length-1])?.id)}e.toolSpecificData={...l,kind:"terminal",commandLine:{original:r},language:"shellscript",terminalToolSessionId:s,terminalCommandUri:A.parse(n),terminalCommandId:c}})}async _enrichHistoryWithSubagentCalls(e,t){let o=t.toString();for(let n of e){if(n.type!=="response")continue;let r=[];for(let s=0;s<n.parts.length;s++){let l=n.parts[s];l.kind==="toolInvocationSerialized"&&l.toolSpecificData?.kind==="subagent"&&r.push({index:s,toolCallId:l.toolCallId})}for(let s=r.length-1;s>=0;s--){let{index:l,toolCallId:c}=r[s],u=YPi(o,c);try{let p=this._ensureSessionSubscription(u),h=this._getSessionState(u);if(!h){if(p.value instanceof Error||(await new Promise(g=>{let f=p.onDidChange(()=>{f.dispose(),g()})}),p.value instanceof Error))throw p.value;h=this._getSessionState(u)}if(h){let g=[];for(let f of h.turns)for(let v of f.responseParts)if(v.kind==="toolCall"){let b=v.toolCall;if(b.status==="completed"||b.status==="cancelled"){let S=b,y=f4i(S),w=Oti(S,c,A.parse(u),this._config.connectionAuthority);y.length>0&&(w.presentation="hidden"),g.push(w),g.push(...y)}}g.length>0&&n.parts.splice(l+1,0,...g)}}catch(p){this._logService.warn(`[AgentHost] Failed to enrich history with subagent calls: ${u}`,p)}finally{this._releaseSessionSubscription(u)}}}}_observeSubagentSession(e,t,o,n,r,s){let l=YPi(t.toString(),o),c=A.parse(l),u=new qe;r.add(ee(()=>u.dispose(!0)));try{let p=this._ensureSessionSubscription(l);r.add(ee(()=>this._releaseSessionSubscription(l)));let h=Kji(this,p),g=ke(f=>{let v=h.read(f);if(!v)return[];let b=v.turns.map(y=>({id:y.id})),S=v.activeTurn?.id;return S!==void 0&&!v.turns.some(y=>y.id===S)&&b.push({id:S}),b});r.add(I4e(g,f=>f.id,(f,v,b)=>{b.add(this._observeTurn({backendSession:c,sessionResource:e,turnId:f,sink:n,cancellationToken:u.token,subAgentInvocationId:o}))}))}catch(p){s.delete(o),this._logService.warn(`[AgentHost] Failed to subscribe to subagent session: ${l}`,p)}}_reconnectToActiveTurn(e,t,o,n){let r=e.toString(),s=new Map;for(let h of n)h instanceof ZM&&s.set(h.toolCallId,h);let l=new Map,c=this._getSessionState(r);if(c?.activeTurn)for(let h of c.activeTurn.responseParts)(h.kind==="markdown"||h.kind==="reasoning")&&l.set(h.id,h.content.length);let u=new qe,p=o.registerDisposable(new O);p.add(ee(()=>u.dispose(!0))),p.add(this._observeTurn({backendSession:e,sessionResource:o.sessionResource,turnId:t,sink:h=>o.appendProgress(h),cancellationToken:u.token,adoptInvocations:s,seedEmittedLengths:l,onTurnEnded:()=>{o.complete(),p.dispose()}}))}_ensureEditingSession(e){let t=this._chatService.getSession(e);if(!t)return;t.editingSession||t.startEditingSession();let o=t.editingSession;if(!(o instanceof kye))return;let n=this._pendingHistoryTurns.get(e);if(n){this._pendingHistoryTurns.delete(e);for(let r of n)for(let s of r.responseParts)s.kind==="toolCall"&&o.addToolCallEdits(r.id,s.toolCall)}return o}_hydrateFileEdits(e,t,o){let n=this._ensureEditingSession(e);return n?n.addToolCallEdits(t,o):[]}async _ensureTerminalInstance(e,t){let o=evt(e,t),n=A.parse(e);return await this._agentHostTerminalService.reviveTerminal(this._config.connection,n,o),o}_resolveSessionUri(e){let t=e.path.substring(1);return DP.uri(this._config.provider,t)}_isNewSessionResource(e){return!!this._config.isNewSession?.(e)||this._workingDirectoryResolver.isNewSession(e)}async _forkSession(e,t,o,n){if(n.isCancellationRequested)throw new Error("Cancelled");let r=this._getSessionState(t.toString()),s;if(o){let f=r?.turns.findIndex(v=>v.id===o.id);if(f===void 0||f<0)throw new Error(`Cannot fork: turn for request ${o.id} not found in protocol state`);if(s=f-1,s<0)throw new Error("Cannot fork: cannot fork before the first request")}else r?.turns.length&&(s=r.turns.length-1);if(s===void 0)throw new Error("Cannot fork: no turns to fork from");let l=r.turns[s].id,c=this._chatService.getSession(e),u=await this._createAndSubscribe(e,r?.summary.model,{session:t,turnIndex:s,turnId:l}),p=DP.id(u),h=A.from({scheme:this._config.sessionType,path:`/${p}`}),g=Date.now();return{resource:h,label:c?.title?d(6740,null,c.title):d(6739,null),iconPath:MYe(this._productService),timing:{created:g,lastRequestStarted:g,lastRequestEnded:g}}}async _createAndSubscribe(e,t,o,n){let r=this._resolveRequestedWorkingDirectory(e),s=o?void 0:this._resolveSessionUri(e);this._logService.trace(`[AgentHost] Creating new session, model=${t?.id??"(default)"}, provider=${this._config.provider}${o?`, fork from ${o.session.toString()} at index ${o.turnIndex}`:""}`);let c=this._getRootState()?.agents.find(f=>f.provider===this._config.provider)?.protectedResources??[];if(c.some(f=>f.required!==!1)&&this._config.resolveAuthentication&&!await this._config.resolveAuthentication(c))throw new Error(d(6732,null));let p={clientId:this._config.connection.clientId,tools:this._clientToolsObs.get().map(S4i),customizations:this._config.customizations?.get()??[]},h;try{h=await this._config.connection.createSession({session:s,model:t,provider:this._config.provider,workingDirectory:r,fork:o,config:n,activeClient:p})}catch(f){if(this._isAuthRequiredError(f)&&this._config.resolveAuthentication)if(this._logService.info("[AgentHost] Authentication required, prompting user..."),await this._config.resolveAuthentication(c))h=await this._config.connection.createSession({session:s,model:t,provider:this._config.provider,workingDirectory:r,fork:o,config:n,activeClient:p});else throw new Error(d(6732,null));else throw f}if(s&&!ze(h,s))throw new Error(`Agent host returned unexpected session URI. Expected ${s.toString()}, got ${h.toString()}`);this._logService.trace(`[AgentHost] Created session: ${h.toString()}`);let g=this._ensureSessionSubscription(h.toString());return this._getSessionState(h.toString())||await new Promise(f=>{let v=g.onDidChange(()=>{v.dispose(),f()});this._getSessionState(h.toString())&&(v.dispose(),f())}),this._ensurePendingMessageSubscription(e,h),this._watchForServerInitiatedTurns(h,e),h}_ensurePendingMessageSubscription(e,t){if(this._pendingMessageSubscriptions.has(e))return;let o=this._chatService?.getSession(e);if(o){this._pendingMessageSubscriptions.set(e,o.onDidChangePendingRequests(()=>{this._syncPendingMessages(e,t)})),this._syncPendingMessages(e,t);return}this._pendingMessageSubscriptions.set(e,this._chatService.onDidCreateModel(n=>{ze(n.sessionResource,e)&&(this._pendingMessageSubscriptions.deleteAndDispose(e),this._ensurePendingMessageSubscription(e,t))}))}_isAuthRequiredError(e){return!!(e instanceof $C&&e.code===lDo||e instanceof Error&&e.message.includes("Authentication required"))}_createModelSelection(e,t){let o=this._extractRawModelId(e);if(!o)return;let n={};for(let[r,s]of Object.entries(t??{}))typeof s=="string"&&(n[r]=s);return Object.keys(n).length>0?{id:o,config:n}:{id:o}}_modelSelectionsEqual(e,t){if(e?.id!==t?.id)return!1;let o=e?.config??{},n=t?.config??{},r=Object.keys(o),s=Object.keys(n);return r.length===s.length&&r.every(l=>o[l]===n[l])}_extractRawModelId(e){if(!e)return;let t=this._config.sessionType+":";return e.startsWith(t)?e.substring(t.length):e}_toLanguageModelId(e,t){if(!t)return;let o=`${yn(e)}:`;return t.startsWith(o)?t:`${o}${t}`}_getTurnResponseDetails(e,t,o){let n=this._getSessionState(t.toString())?.summary.model?.id;return this._createTurnModelLookup(e,n).toResponseDetails(o?.usage?.model,o?.usage)}_createTurnModelLookup(e,t){let o=n=>n??t;return{toLanguageModelId:n=>this._toLanguageModelId(e,o(n)),toResponseDetails:(n,r)=>{let s=this._toLanguageModelId(e,o(n));if(!s)return;let l=this._languageModelsService.lookupLanguageModel(s);if(!l)return;let c=oNn(r);if(c!==void 0){let u=c%1===0?c.toString():c.toFixed(1),p=c===1?d(6737,null,u):d(6738,null,u);return[l.name,p].join(" \u2022 ")}return[l.name,l.pricing].filter(Boolean).join(" \xB7 ")}}}_resolveRequestedWorkingDirectory(e){return this._config.resolveWorkingDirectory?.(e)??this._workingDirectoryResolver.resolve(e)??this._workspaceContextService.getWorkspace().folders[0]?.uri}_convertVariablesToAttachments(e){return this._variableEntriesToAttachments(e.variables.variables,e.sessionResource)}_variableEntriesToAttachments(e,t){let o=[];for(let n of e){let r=this._convertVariableToAttachment(n,t);r&&o.push(r)}return o.length>0&&this._logService.trace(`[AgentHost] Converted ${o.length} attachments from ${e.length} variables`),o}_convertVariableToAttachment(e,t){if((e.kind==="file"||e.kind==="implicit"&&e.isSelection)&&Bp(e.value))return this._toSelectionAttachment(e.value,e.name,"selection",t,e._meta);if((e.kind==="file"||e.kind==="implicit")&&e.value instanceof A)return this._toResourceAttachment(e.value,e.name,"document",t,e._meta);if(e.kind==="directory"&&e.value instanceof A)return this._toResourceAttachment(e.value,e.name,"directory",t,e._meta);if(e.kind==="symbol"&&Bp(e.value))return this._toSelectionAttachment(e.value,e.name,"symbol",t,e._meta);if(e.kind==="promptFile"&&e.value instanceof A)return this._toResourceAttachment(e.value,e.name,"document",t,e._meta);if(SC(e))return this._toImageAttachment(e,t);if(wao(e))return this._toAgentFeedbackAttachment(e,t);if(e.kind==="paste")return this._toSimpleAttachment(e.name,e.code,e._meta);if(e.kind==="promptText")return this._toSimpleAttachment(e.name,e.value,e._meta);if(e.kind==="string"&&typeof e.value=="string")return this._toSimpleAttachment(e.name,e.value,e._meta)}_toResourceAttachment(e,t,o,n,r){if(e.scheme!=="file")return;let s=this._rebaseAttachmentUri(e,n),l={type:"resource",uri:s.toString(),label:t,displayKind:o};return r&&(l._meta=r),l}_toSelectionAttachment(e,t,o,n,r){if(e.uri.scheme!=="file")return;let s=this._rebaseAttachmentUri(e.uri,n),l={type:"resource",uri:s.toString(),label:t,displayKind:o,selection:{range:this._toTextRange(e.range)}};return r&&(l._meta=r),l}_toImageAttachment(e,t){let o=ust(e.value),n=e.mimeType??"image/png";if(o){let s={type:"embeddedResource",label:e.name,displayKind:"image",data:gc(Ke.wrap(o)),contentType:n};return e._meta&&(s._meta=e._meta),s}let r=e.references?.find(s=>A.isUri(s.reference))?.reference;if(A.isUri(r))return this._toResourceAttachment(r,e.name,"image",t,e._meta)}_toAgentFeedbackAttachment(e,t){let o=e.feedbackItems.map(n=>({id:n.id,text:n.text,resourceUri:n.resourceUri.toString(),range:this._toTextRange(n.range)}));return this._toSimpleAttachment(e.name,typeof e.value=="string"?e.value:void 0,{...e._meta??{},[m4i]:{sessionResource:e.sessionResource.toString(),feedbackItems:o}},p4i)}_toSimpleAttachment(e,t,o,n){let r={type:"simple",label:e,modelRepresentation:t};return n&&(r.displayKind=n),o&&(r._meta=o),r}_toTextRange(e){return{start:{line:e.startLineNumber-1,character:e.startColumn-1},end:{line:e.endLineNumber-1,character:e.endColumn-1}}}_rebaseAttachmentUri(e,t){let o=this._resolveRequestedWorkingDirectory(t);if(!o||o.scheme!=="file")return e;let n=this._resolveSessionUri(t),r=this._getSessionState(n.toString())?.summary.workingDirectory,s=typeof r=="string"?A.parse(r):r;if(!s||s.scheme!=="file"||kL.isEqual(o,s)||!kL.isEqualOrParent(e,o))return e;let l=kL.relativePath(o,e);return l===void 0?e:l===""?s:A.joinPath(s,...l.split("/"))}_ensureSessionSubscription(e){let t=this._sessionSubscriptions.get(e);return t?.object.value instanceof Error&&(this._sessionSubscriptions.delete(e),t.dispose(),t=void 0),t||(t=this._config.connection.getSubscription(1,A.parse(e)),this._sessionSubscriptions.set(e,t)),t.object}_releaseSessionSubscription(e){let t=this._sessionSubscriptions.get(e);t&&(this._sessionSubscriptions.delete(e),t.dispose())}_getSessionState(e){let t=this._sessionSubscriptions.get(e);if(!t)return;let o=t.object.value;return o&&!(o instanceof Error)?o:void 0}_getRootState(){let e=this._config.connection.rootState.value;return e&&!(e instanceof Error)?e:void 0}dispose(){for(let[,e]of this._activeSessions)e.dispose();this._activeSessions.clear();for(let e of this._sessionSubscriptions.values())e.dispose();this._sessionSubscriptions.clear(),super.dispose()}};Eye=I([m(1,gr),m(2,si),m(3,mu),m(4,re),m(5,Ze),m(6,Ae),m(7,F),m(8,tg),m(9,T2e),m(10,Vfe),m(11,d6),m(12,Wn),m(13,B),m(14,Lt),m(15,Gr),m(16,Je)],Eye);function S4i(a){return{name:a.toolReferenceName??a.id,title:a.displayName,description:a.modelDescription,inputSchema:a.inputSchema?.type==="object"?a.inputSchema:void 0}}function aNn(a,i){let e=!!a.toolResultError,t=typeof a.toolResultMessage=="string"?a.toolResultMessage:a.toolResultMessage?.value??(e?`${i} failed`:`Ran ${i}`),o=[];for(let n of a.content)n.kind==="text"?o.push({type:"text",text:n.value}):n.kind==="data"&&o.push({type:"embeddedResource",data:gc(n.value.data),contentType:n.value.mimeType});return{success:!e,pastTenseMessage:t,content:o.length>0?o:void 0,error:e?{message:typeof a.toolResultError=="string"?a.toolResultError:`${i} encountered an error`}:void 0}}function lNn(a,i){if(!a||a.length===0)return;let e=[];for(let t of a){let o=t.after?.uri??t.before?.uri;o&&e.push({uri:$S(A.parse(o),i),insertions:t.diff?.added??0,deletions:t.diff?.removed??0})}return e.length>0?e:void 0}function cNn(a){return a!==void 0&&(a&24)===24?3:a!==void 0&&a&8?2:a!==void 0&&a&2?0:1}var Tye=class extends k{constructor(e,t,o,n,r,s,l,c){super();this._sessionType=e;this._provider=t;this._connection=o;this._description=n;this._connectionAuthority=r;this._productService=s;this._provisional=l;this._workspaceContextService=c;this._onDidChangeChatSessionItems=this._register(new T);this.onDidChangeChatSessionItems=this._onDidChangeChatSessionItems.event;this._items=[];this._cachedSummaries=new Map;this._pendingNewSessions=new Set;this._cacheValid=!1;this._register(this._connection.onDidNotification(u=>{if(u.type==="notify/sessionAdded"&&u.summary.provider===this._provider){let p=DP.id(u.summary.resource);this._pendingNewSessions.delete(p),this._cachedSummaries.set(p,u.summary);let h=this._makeItemFromSummary(p,u.summary,u.summary.diffs),g=this._items.findIndex(f=>f.resource.path===`/${p}`);g>=0?this._items[g]=h:this._items.push(h),this._onDidChangeChatSessionItems.fire({addedOrUpdated:[h]})}else if(u.type==="notify/sessionRemoved"&&DP.provider(u.session)===this._provider){let p=DP.id(u.session);this._pendingNewSessions.delete(p);let h=this._items.findIndex(g=>g.resource.path===`/${p}`);if(h>=0){let[g]=this._items.splice(h,1);this._cachedSummaries.delete(p),this._onDidChangeChatSessionItems.fire({removed:[g.resource]})}}else if(u.type==="notify/sessionSummaryChanged"&&DP.provider(u.session)===this._provider){let p=DP.id(u.session),h=this._cachedSummaries.get(p);if(!h)return;let g={...h,...u.changes};this._cachedSummaries.set(p,g);let f=this._makeItemFromSummary(p,g,g.diffs),v=this._items.findIndex(b=>b.resource.path===`/${p}`);v>=0?this._items[v]=f:this._items.unshift(f),this._onDidChangeChatSessionItems.fire({addedOrUpdated:[f]})}}))}resetCache(){this._cacheValid=!1}get items(){return this._items}isNewSession(e){return e.scheme===this._sessionType&&this._pendingNewSessions.has(e.path.substring(1))}async newChatSessionItem(e,t){if(t.isCancellationRequested)return;let o=ht();this._pendingNewSessions.add(o);let n=Date.now(),r=this._makeItem(o,{title:e.prompt.trim(),status:8,createdAt:n,modifiedAt:n});if(e.untitledResource){let s=this._workspaceContextService.getWorkspace().folders[0]?.uri;await this._provisional.tryRebind(e.untitledResource,r.resource,this._provider,s)}return r}async refresh(e){if(this._cacheValid){this._onDidChangeChatSessionItems.fire({addedOrUpdated:this._items});return}try{let o=(await this._connection.listSessions()).filter(n=>DP.provider(n.session)===this._provider);this._cachedSummaries.clear(),this._items=o.map(n=>{let r=DP.id(n.session);this._pendingNewSessions.delete(r);let s=n.status??1;return n.isRead&&(s|=32),n.isArchived&&(s|=64),this._cachedSummaries.set(r,{resource:n.session.toString(),provider:this._provider,title:n.summary??`Session ${r.substring(0,8)}`,status:s,activity:n.activity,createdAt:n.startTime,modifiedAt:n.modifiedTime,workingDirectory:n.workingDirectory?.toString()}),this._makeItem(r,{title:n.summary,status:s,activity:n.activity,workingDirectory:n.workingDirectory,createdAt:n.startTime,modifiedAt:n.modifiedTime,diffs:n.diffs})}),this._cacheValid=!0}catch{this._cachedSummaries.clear(),this._items=[]}this._onDidChangeChatSessionItems.fire({addedOrUpdated:this._items})}_makeItemFromSummary(e,t,o){let n=typeof t.workingDirectory=="string"?A.parse(t.workingDirectory):t.workingDirectory;return this._makeItem(e,{title:t.title,status:t.status,activity:t.activity,workingDirectory:n,createdAt:t.createdAt,modifiedAt:t.modifiedAt,diffs:o})}_makeItem(e,t){let n=t.status!==void 0&&(t.status&8)!==0&&t.activity?t.activity:this._description;return{resource:A.from({scheme:this._sessionType,path:`/${e}`}),label:t.title||`Session ${e.substring(0,8)}`,description:n,iconPath:MYe(this._productService),status:cNn(t.status),archived:t.status!==void 0&&(t.status&64)===64,metadata:this._buildMetadata(t.workingDirectory),timing:{created:t.createdAt,lastRequestStarted:t.modifiedAt,lastRequestEnded:t.modifiedAt},changes:lNn(t.diffs,this._connectionAuthority)}}_buildMetadata(e){if(!this._description&&!e)return;let t={};return this._description&&(t.remoteAgentHost=this._description),e&&(t.workingDirectoryPath=e.fsPath),Object.keys(t).length>0?t:void 0}};Tye=I([m(5,Ze),m(6,d6),m(7,Ae)],Tye);function dNn(a,i){return i&&typeof i=="object"&&i.$mid!==void 0&&i.scheme!==void 0?A.revive(i).toString():i}function uNn(a){if(a===void 0)return"";try{return JSON.stringify(a,dNn,2)}catch{return String(a)}}var I4i=class extends k{constructor(e,t,o,n){super();this._label=e;this._inner=t;this._log=n;this._onDidChange=this._register(new T);this.onDidChange=this._onDidChange.event;this.onWillApplyAction=t.onWillApplyAction,this.onDidApplyAction=t.onDidApplyAction,o&&t.value!==void 0&&this._log("**",`${this._label}.current`,t.value),this._register(t.onDidChange(r=>{this._log("**",`${this._label}.onDidChange`,r),this._onDidChange.fire(r)}))}get value(){return this._inner.value}get verifiedValue(){return this._inner.verifiedValue}},Rw=class extends k{constructor(e,t,o,n,r){super();this._inner=e;this.channelId=t;this._channelLabel=o;this._outputService=n;this.clientId=e.clientId,this._enabled=!!r.getValue(GGt);let s=`${this.channelId}:rootState.current`,l=!1;if(this._enabled){let c=oe.as(bb.OutputChannels),u=Rw._channelRefCounts.get(this.channelId)??0;if(u===0){c.registerChannel({id:this.channelId,label:this._channelLabel,log:!1,languageId:"log"});let p=new O;p.add(e.onDidAction(h=>this._log("**","onDidAction",h))),p.add(e.onDidNotification(h=>this._log("**","onDidNotification",h))),Rw._sharedEventLog.set(this.channelId,p)}Rw._channelRefCounts.set(this.channelId,u+1),l=!Rw._currentRootStateLogKeys.has(s),l&&Rw._currentRootStateLogKeys.add(s),this._register(ee(()=>{let p=Rw._channelRefCounts.get(this.channelId)-1;p<=0?(Rw._channelRefCounts.delete(this.channelId),Rw._currentRootStateLogKeys.delete(s),Rw._sharedEventLog.get(this.channelId)?.dispose(),Rw._sharedEventLog.delete(this.channelId),c.removeChannel(this.channelId)):Rw._channelRefCounts.set(this.channelId,p)}))}this.onDidAction=e.onDidAction,this.onDidNotification=e.onDidNotification,this._rootState=this._register(new I4i("rootState",e.rootState,l,(c,u,p)=>this._log(c,u,p)))}static{this._channelRefCounts=new Map}static{this._currentRootStateLogKeys=new Set}static{this._sharedEventLog=new Map}async authenticate(e){return this._logCall("authenticate",e,()=>this._inner.authenticate(e))}async listSessions(){return this._logCall("listSessions",void 0,()=>this._inner.listSessions())}async createSession(e){return this._logCall("createSession",e,()=>this._inner.createSession(e))}async resolveSessionConfig(e){return this._logCall("resolveSessionConfig",e,()=>this._inner.resolveSessionConfig(e))}async sessionConfigCompletions(e){return this._logCall("sessionConfigCompletions",e,()=>this._inner.sessionConfigCompletions(e))}async completions(e){return this._logCall("completions",e,()=>this._inner.completions(e))}async getCompletionTriggerCharacters(){return this._inner.getCompletionTriggerCharacters()}async disposeSession(e){return this._logCall("disposeSession",e,()=>this._inner.disposeSession(e))}async createTerminal(e){return this._logCall("createTerminal",e,()=>this._inner.createTerminal(e))}async disposeTerminal(e){return this._logCall("disposeTerminal",e,()=>this._inner.disposeTerminal(e))}get rootState(){return this._rootState}getSubscription(e,t){return this._inner.getSubscription(e,t)}getSubscriptionUnmanaged(e,t){return this._inner.getSubscriptionUnmanaged(e,t)}dispatch(e){this._log(">>","dispatch",e),this._inner.dispatch(e)}async resourceList(e){return this._logCall("resourceList",e,()=>this._inner.resourceList(e))}async resourceRead(e){return this._logCall("resourceRead",e,()=>this._inner.resourceRead(e))}async resourceWrite(e){return this._logCall("resourceWrite",e,()=>this._inner.resourceWrite(e))}async resourceCopy(e){return this._logCall("resourceCopy",e,()=>this._inner.resourceCopy(e))}async resourceDelete(e){return this._logCall("resourceDelete",e,()=>this._inner.resourceDelete(e))}async resourceMove(e){return this._logCall("resourceMove",e,()=>this._inner.resourceMove(e))}logError(e,t){this._log("!!",e,t instanceof Error?t.message:String(t))}async _logCall(e,t,o){this._log(">>",e,t);try{let n=await o();return this._log("<<",e,n),n}catch(n){throw this._log("!!",e,n instanceof Error?n.message:String(n)),n}}_log(e,t,o){if(!this._enabled||!this._outputChannel&&(this._outputChannel=this._outputService.getChannel(this.channelId),!this._outputChannel))return;let n=new Date().toISOString(),r=uNn(o);this._outputChannel.append(`[${n}] ${e} ${t}${r?`
${r}`:""}
`)}};Rw=I([m(3,Tl),m(4,B)],Rw);var a1o="VS Code Synced Data",pNn=JSON.stringify({name:a1o,description:"Customization data synced from VS Code"},null,"	");function s1o(a){switch(a){case"instructions":return"rules";case"prompt":return"commands";case"agent":return"agents";case"skill":return"skills";case"hook":return}}var R5e=class extends k{constructor(e,t,o){super();this._fileService=t;this._authority=e,o.ensureSyncedCustomizationProvider()}get _rootUri(){return A.from({scheme:T$,path:`/${this._authority}`})}async bundle(e){let t=e.filter(s=>s1o(s.type)!==void 0);if(t.length===0)return;try{await this._fileService.del(this._rootUri,{recursive:!0})}catch{}let o=A.joinPath(this._rootUri,".plugin","plugin.json");await this._fileService.writeFile(o,Ke.fromString(pNn));let n=[];for(let s of t){let l=s1o(s.type),c=Be(s.uri),u,p;if(s.type==="skill"&&c.toLowerCase()==="skill.md"){let g=Be(ai(s.uri));u=A.joinPath(this._rootUri,l,g,c),p=`${l}/${g}/${c}`}else u=A.joinPath(this._rootUri,l,c),p=`${l}/${c}`;let h=await this._fileService.readFile(s.uri);await this._fileService.writeFile(u,h.value),n.push(`${p}:${h.value.toString()}`)}n.sort();let r=String(Lr(n.join(`
`)));return this._lastNonce=r,{ref:{uri:this._rootUri.toString(),displayName:a1o,description:`${t.length} customization(s) synced from VS Code`,nonce:r}}}get lastNonce(){return this._lastNonce}};R5e=I([m(1,ge),m(2,oct)],R5e);var _ye=class extends k{constructor(e,t,o,n,r,s,l,c,u,p,h,g,f,v,b){super();this._agentHostService=e;this._chatSessionsService=t;this._defaultAccountService=o;this._authenticationService=n;this._logService=r;this._languageModelsService=s;this._instantiationService=l;this._customizationHarnessService=p;this._storageService=h;this._agentPluginService=g;this._promptsService=f;this._fileService=v;this._agentRegistrations=this._register(new Ot);this._modelProviders=new Map;this._listControllers=new Map;this._authTokenCache=new _ti;if(this._isSessionsWindow=b.isSessionsWindow,!u.getValue(mk))return;this._loggedConnection=this._register(this._instantiationService.createInstance(Rw,this._agentHostService,`agenthost.${this._agentHostService.clientId}`,"Agent Host (Local)")),this._register(c.registerAuthority("local",this._agentHostService)),this._register(this._agentHostService.rootState.onDidChange(y=>{this._handleRootStateChange(y)})),this._register(this._agentHostService.onAgentHostStart(()=>{this._authTokenCache.clear();for(let y of this._listControllers.values())y.resetCache()}));let S=this._agentHostService.rootState.value;S&&!(S instanceof Error)&&this._handleRootStateChange(S)}static{this.ID="workbench.contrib.agentHostContribution"}_handleRootStateChange(e){let t=new Set(e.agents.map(o=>o.provider));for(let[o]of this._agentRegistrations)t.has(o)||(this._agentRegistrations.deleteAndDispose(o),this._modelProviders.delete(o));this._authenticateWithServer(e.agents).catch(()=>{});for(let o of e.agents)this._agentRegistrations.has(o.provider)?this._modelProviders.get(o.provider)?.updateModels(o.models):this._registerAgent(o)}_registerAgent(e){let t=new O;this._agentRegistrations.set(e.provider,t);let o=`agent-host-${e.provider}`,n=o,r=o,s=this._isSessionsWindow?e.displayName:d(6711,null,e.displayName);t.add(this._chatSessionsService.registerChatSessionContribution({type:o,name:n,displayName:s,description:e.description,canDelegate:!0,requiresCustomModels:!0,supportsDelegation:!this._isSessionsWindow,capabilities:{supportsCheckpoints:!0,supportsPromptAttachments:!0}}));let l=t.add(this._instantiationService.createInstance(Tye,o,e.provider,this._loggedConnection,void 0,"local"));this._listControllers.set(e.provider,l),t.add({dispose:()=>this._listControllers.delete(e.provider)}),t.add(this._chatSessionsService.registerChatSessionItemController(o,l));let c=t.add(new Tti(o,this._storageService)),u=t.add(new Eti(e,this._loggedConnection,"local",this._fileService,this._logService)),p=t.add(this._instantiationService.createInstance(R5e,o));t.add(this._customizationHarnessService.registerExternalHarness({id:o,label:d(6712,null,e.displayName),icon:q.fromId(L.server.id),hiddenSections:[],hideGenerateButton:!0,getStorageSourceFilter:()=>({sources:["local","user","plugin"]}),syncProvider:c,itemProvider:u}));let h=De("agentCustomizations",[]),g=async()=>{let S=await KUo(this._promptsService,c,this._agentPluginService,p,o);h.set(S,void 0)};t.add(c.onDidChange(()=>g())),t.add(U.any(this._promptsService.onDidChangeCustomAgents,this._promptsService.onDidChangeSlashCommands,this._promptsService.onDidChangeSkills,this._promptsService.onDidChangeInstructions)(()=>g())),g();let f=t.add(this._instantiationService.createInstance(Eye,{provider:e.provider,agentId:n,sessionType:o,fullName:e.displayName,description:e.description,connection:this._loggedConnection,connectionAuthority:"local",isNewSession:S=>l.isNewSession(S),resolveAuthentication:S=>this._resolveAuthenticationInteractively(S),customizations:h}));t.add(this._chatSessionsService.registerChatSessionContentProvider(o,f));let v={vendor:r,displayName:e.displayName,configuration:void 0,managementCommand:void 0,when:void 0};this._languageModelsService.deltaLanguageModelChatProviderDescriptors([v],[]),t.add(ee(()=>this._languageModelsService.deltaLanguageModelChatProviderDescriptors([],[v])));let b=t.add(new Dti(o,r));this._modelProviders.set(e.provider,b),t.add(ee(()=>this._modelProviders.delete(e.provider))),t.add(this._languageModelsService.registerLanguageModelProvider(r,b)),b.updateModels(e.models),t.add(this._defaultAccountService.onDidChangeDefaultAccount(()=>{let S=this._getRootAgents();this._authenticateWithServer(S).catch(()=>{})})),t.add(this._authenticationService.onDidChangeSessions(()=>{let S=this._getRootAgents();this._authenticateWithServer(S).catch(()=>{})}))}_getRootAgents(){let e=this._agentHostService.rootState.value;return e&&!(e instanceof Error)?e.agents:[]}async _authenticateWithServer(e){this._agentHostService.setAuthenticationPending(!0);try{await qUo(e,{authTokenCache:this._authTokenCache,authenticationService:this._authenticationService,logPrefix:"[AgentHost]",logService:this._logService,authenticate:t=>this._loggedConnection.authenticate(t)})}catch(t){this._logService.error("[AgentHost] Failed to authenticate with server",t),this._loggedConnection.logError("authenticateWithServer",t)}finally{this._agentHostService.setAuthenticationPending(!1)}}async _resolveAuthenticationInteractively(e){try{return await $Uo(e,{authTokenCache:this._authTokenCache,authenticationService:this._authenticationService,logPrefix:"[AgentHost]",logService:this._logService,authenticate:t=>this._loggedConnection.authenticate(t)})}catch(t){this._logService.error("[AgentHost] Interactive authentication failed",t),this._loggedConnection.logError("resolveAuthenticationInteractively",t)}return!1}};_ye=I([m(0,hk),m(1,Ms),m(2,Nd),m(3,ks),m(4,re),m(5,Gr),m(6,F),m(7,oct),m(8,B),m(9,dh),m(10,de),m(11,mm),m(12,jr),m(13,ge),m(14,Mt)],_ye);var mNn=["terminal.integrated.agentHostProfile.linux","terminal.integrated.agentHostProfile.osx","terminal.integrated.agentHostProfile.windows","terminal.integrated.defaultProfile.linux","terminal.integrated.defaultProfile.osx","terminal.integrated.defaultProfile.windows","terminal.integrated.profiles.linux","terminal.integrated.profiles.osx","terminal.integrated.profiles.windows"],Dye=class extends k{constructor(e,t,o,n,r,s){super();this._agentHostService=e;this._agentHostTerminalService=t;this._instantiationService=o;this._configurationService=n;this._terminalProfileService=r;this._terminalProfileResolverService=s;this._localEntry=this._register(new ue);this._conditionalListeners=this._register(new ue);this._register(this._configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(mk)&&this._updateEnabled()})),this._updateEnabled()}static{this.ID="workbench.contrib.agentHostTerminal"}_updateEnabled(){if(this._configurationService.getValue(mk)){if(!this._conditionalListeners.value){let e=new O;e.add(this._agentHostService.onAgentHostStart(()=>this._reconcile())),e.add(this._configurationService.onDidChangeConfiguration(t=>{mNn.some(o=>t.affectsConfiguration(o))&&this._pushDefaultShell(),t.affectsConfiguration(mst)&&this._pushCustomTerminalToolEnabled()})),e.add(this._terminalProfileService.onDidChangeAvailableProfiles(()=>this._pushDefaultShell())),e.add(this._agentHostService.rootState.onDidChange(()=>{this._pushDefaultShell(),this._pushCustomTerminalToolEnabled()})),this._conditionalListeners.value=e,this._reconcile()}}else this._conditionalListeners.value=void 0,this._localEntry.value=void 0}_reconcile(){this._localEntry.value||(this._localEntry.value=this._agentHostTerminalService.registerEntry({name:d(6742,null),address:"__local__",getConnection:()=>this._instantiationService.createInstance(Rw,this._agentHostService,`agenthost.${this._agentHostService.clientId}`,d(6741,null))})),this._pushDefaultShell(),this._pushCustomTerminalToolEnabled()}async _pushDefaultShell(){let e=this._agentHostService.rootState.value;if(!e||e instanceof Error||!e.config?.schema.properties.defaultShell)return;let t;try{t=await this._terminalProfileResolverService.getDefaultProfile({remoteAuthority:void 0,os:Ao,allowAgentHostShell:!0})}catch{return}if(!t.path)return;let o=this._agentHostService.rootState.value;!o||o instanceof Error||e.config.values.defaultShell!==t.path&&this._agentHostService.dispatch({type:"root/configChanged",config:{defaultShell:t.path}})}_pushCustomTerminalToolEnabled(){let e=this._agentHostService.rootState.value;if(!e||e instanceof Error||!e.config?.schema.properties.disableCustomTerminalTool)return;let t=!this._configurationService.getValue(mst);e.config.values.disableCustomTerminalTool!==t&&this._agentHostService.dispatch({type:"root/configChanged",config:{disableCustomTerminalTool:t}})}};Dye=I([m(0,hk),m(1,T2e),m(2,F),m(3,B),m(4,fb),m(5,ig)],Dye);var Wti=class a extends z{static{this.ID="workbench.action.chat.debugAgentHostInDevTools"}constructor(){super({id:a.ID,title:P(9879,"Debug Local Agent Host Process In Dev Tools"),category:Fe.Developer,f1:!0,icon:L.debugStart,precondition:Z.enabled})}async run(i){let e=i.get(hk),t=i.get(wo),o=i.get(Ne),n=await e.getInspectInfo(!0);if(!n){o.warn(d(9878,null));return}t.openDevToolsWindow(n.devtoolsUrl)}};var ovt=class{constructor(i,e){this.fileDialogService=i;this.nativeHostService=e}async save(i,e){let t=Ve(await this.fileDialogService.defaultFilePath(Q.file),`${i}.zip`),o=await this.fileDialogService.showSaveDialog({title:d(9880,null),defaultUri:t,filters:[{name:d(9881,null),extensions:["zip"]}],availableFileSystems:[Q.file]});o&&await this.nativeHostService.createZipFile(o,[...e])}};ovt=I([m(0,nn),m(1,wo)],ovt);Ce(a0i,ovt,1);function l1o(){W(y4i),W(Wti)}var y4i=class a extends z{static{this.ID="workbench.action.chat.openStorageFolder"}constructor(){super({id:a.ID,title:P(9874,"Open Chat Storage Folder"),icon:L.attach,category:Fe.Developer,f1:!0,precondition:Z.enabled})}async run(i,...e){let t=i.get(si),o=i.get(wo),n=t.getChatStorageFolder();o.showItemInFolder(n.fsPath)}};function c1o(){W(class extends z{constructor(){super({id:"workbench.action.chat.exportAsZip",category:fi,title:P(9875,"Export Chat as Zip..."),precondition:C.and(Z.enabled,Xn.Entitlement.internal),f1:!0})}async run(i){let e=i.get(Lt),t=i.get(nn),o=i.get(si),n=i.get(wo),r=i.get(Ne),s=i.get(lc),l=i.get(ge),c=e.lastFocusedWidget;if(!c||!c.viewModel)return;let u=Ve(await t.defaultFilePath(),"chat.zip"),p=await t.showSaveDialog({defaultUri:u,filters:[{name:"Zip Archive",extensions:["zip"]}]});if(!p)return;let h=o.getSession(c.viewModel.sessionResource);if(!h)return;let g=[{path:"chat.json",contents:JSON.stringify(h.toExport(),void 0,2)}];if(h.getRequests().length>0){h.repoData&&g.push({path:"chat.repo.begin.json",contents:JSON.stringify(h.repoData,void 0,2)});let v=await tBi(s,l);v&&g.push({path:"chat.repo.end.json",contents:JSON.stringify(v,void 0,2)}),!h.repoData&&!v&&r.notify({severity:ft.Warning,message:d(9877,null)})}else{let v=await tBi(s,l);v?g.push({path:"chat.repo.begin.json",contents:JSON.stringify(v,void 0,2)}):r.notify({severity:ft.Warning,message:d(9877,null)})}try{await n.createZipFile(p,g)}catch(v){r.notify({severity:ft.Error,message:d(9876,null,v instanceof Error?v.message:String(v))})}}})}function d1o(){W(class extends z{constructor(){super({id:"workbench.action.chat.agentHost.otel.exportAgentTracesDB",category:fi,title:P(9883,"Export Agent Host Traces Database..."),precondition:C.equals(`config.${qGt}`,!0),f1:!0})}async run(i){let e=i.get(nn),t=i.get(ge),o=i.get(Ne),n=i.get(Jr),r=Ve(A.file(n.userDataPath),...UCo.split("/"));if(!await t.exists(r)){o.notify({severity:ft.Info,message:d(9884,null)});return}let s=Ve(await e.defaultFilePath(),"agent-host-traces.db"),l=await e.showSaveDialog({defaultUri:s,filters:[{name:"SQLite Database",extensions:["db","sqlite"]}]});if(l)try{await t.copy(r,l,!0)}catch(c){o.notify({severity:ft.Error,message:d(9882,null,c instanceof Error?c.message:String(c))})}}})}var hNn=["view","inline","quick","editor"],fle=C.and(Z.enabled,YH),w4i=C.or(Nq,Z.inChatInput),u1o=new Y("scopedVoiceChatGettingReady",!1,{type:"boolean",description:d(9890,null)}),p1o=new Y("scopedVoiceChatInProgress",void 0,{type:"string",description:d(9891,null)}),Vti=C.or(...hNn.map(a=>p1o.isEqualTo(a)));var Bti=class a{static async create(i,e){let t=i.get(Lt),o=i.get(JD),n=i.get(wi),r=i.get(ie);switch(e){case"focused":return a.doCreateForFocusedChat(t,n)??a.create(i,"view");case"view":{let s=await t.revealWidget();if(s)return a.doCreateForChatWidget("view",s);break}case"inline":{let s=da(r.activeTextEditorControl);if(s){let l=fu.get(s);if(l)return l.isActive||l.run(),a.doCreateForChatWidget("inline",l.widget.chatWidget)}break}case"quick":return o.open(),a.create(i,"focused")}}static doCreateForFocusedChat(i,e){let t=i.lastFocusedWidget;if(t?.hasInputFocus()){let o;return e.hasFocus("workbench.parts.editor")?o=t.location==="panel"?"editor":"inline":["workbench.parts.sidebar","workbench.parts.panel","workbench.parts.auxiliarybar","workbench.parts.titlebar","workbench.parts.statusbar","workbench.parts.banner","workbench.parts.activitybar"].some(n=>e.hasFocus(n))?o="view":o="quick",a.doCreateForChatWidget(o,t)}}static createChatContextKeyController(i,e){let t=u1o.bindTo(i),o=p1o.bindTo(i);return n=>{switch(n){case 2:t.set(!0),o.reset();break;case 3:t.reset(),o.set(e);break;case 1:t.reset(),o.reset();break}}}static doCreateForChatWidget(i,e){return{context:i,scopedContextKeyService:e.scopedContextKeyService,onDidAcceptInput:e.onDidAcceptInput,onDidHideInput:e.onDidHide,focusInput:()=>e.focusInput(),acceptInput:()=>e.acceptInput(void 0,{isVoiceInput:!0}),updateInput:t=>e.setInput(t),getInput:()=>e.getInput(),setInputPlaceholder:t=>e.setInputPlaceholder(t),clearInputPlaceholder:()=>e.resetInputPlaceholder(),updateState:a.createChatContextKeyController(e.scopedContextKeyService,i)}}},sA=class{constructor(i,e,t,o){this.voiceChatService=i;this.configurationService=e;this.instantiationService=t;this.accessibilityService=o;this.currentVoiceChatSession=void 0;this.voiceChatSessionIds=0}static{this.instance=void 0}static getInstance(i){return sA.instance||(sA.instance=i.createInstance(sA)),sA.instance}async start(i,e){this.stop(),aA.getInstance(this.instantiationService).stop();let t=!1,o=++this.voiceChatSessionIds,n=this.currentVoiceChatSession={id:o,controller:i,hasRecognizedInput:!1,disposables:new O,setTimeoutDisabled:p=>{t=p},accept:()=>this.accept(o),stop:()=>this.stop(o,i.context)},r=new qe;n.disposables.add(ee(()=>r.dispose(!0))),n.disposables.add(i.onDidAcceptInput(()=>this.stop(o,i.context))),n.disposables.add(i.onDidHideInput(()=>this.stop(o,i.context))),i.focusInput(),i.updateState(2);let s=await this.voiceChatService.createVoiceChatSession(r.token,{usesAgents:i.context!=="inline",model:e?.widget?.viewModel?.model}),l=i.getInput(),c=this.configurationService.getValue("accessibility.voice.speechTimeout");(!on(c)||c<0)&&(c=VZe);let u=n.disposables.add(new Dt(()=>this.accept(o),c));return n.disposables.add(s.onDidChange(({status:p,text:h,waitingForInput:g})=>{if(!r.token.isCancellationRequested)switch(p){case 1:this.onDidSpeechToTextSessionStart(i,n.disposables);break;case 2:h&&(n.hasRecognizedInput=!0,n.controller.updateInput(l?[l,h].join(" "):h),c>0&&e?.voice?.disableTimeout!==!0&&!t&&u.cancel());break;case 3:h&&(n.hasRecognizedInput=!0,l=l?[l,h].join(" "):h,n.controller.updateInput(l),c>0&&e?.voice?.disableTimeout!==!0&&!g&&!t&&u.schedule());break;case 4:this.stop(n.id,i.context);break}})),n}onDidSpeechToTextSessionStart(i,e){i.updateState(3);let t=0,o=()=>{t=(t+1)%4,i.setInputPlaceholder(`${d(9888,null)}${".".repeat(t)}`),n.schedule()},n=e.add(new Dt(o,500));o()}stop(i=this.voiceChatSessionIds,e){!this.currentVoiceChatSession||this.voiceChatSessionIds!==i||e&&this.currentVoiceChatSession.controller.context!==e||(this.currentVoiceChatSession.controller.clearInputPlaceholder(),this.currentVoiceChatSession.controller.updateState(1),this.currentVoiceChatSession.disposables.dispose(),this.currentVoiceChatSession=void 0)}async accept(i=this.voiceChatSessionIds){if(!this.currentVoiceChatSession||this.voiceChatSessionIds!==i)return;if(!this.currentVoiceChatSession.hasRecognizedInput){this.stop(i,this.currentVoiceChatSession.controller.context);return}let e=this.currentVoiceChatSession.controller,t=await e.acceptInput();if(!t)return;let o=this.configurationService.getValue("accessibility.voice.autoSynthesize");if(o==="on"||o!=="off"&&!this.accessibilityService.isScreenReaderOptimized()){let n;e.context==="inline"?n="focused":n=e,aA.getInstance(this.instantiationService).start(this.instantiationService.invokeFunction(r=>Gti.create(r,n,t)))}}};sA=I([m(0,Cjt),m(1,B),m(2,F),m(3,Ai)],sA);var m1o=500;async function h1o(a,i,e,t){let o=i.get(F),r=i.get(Le).enableKeybindingHoldMode(a),s=await Bti.create(i,e);if(!s)return;let l=await sA.getInstance(o).start(s,t),c=!1,u=Zo(()=>{c=!0,l?.setTimeoutDisabled(!0)},m1o);await r,u.dispose(),c&&l.accept()}var nvt=class extends z{constructor(e,t){super(e);this.target=t}run(e,t){return h1o(this.desc.id,e,this.target,t)}},rvt=class a extends nvt{static{this.ID="workbench.action.chat.voiceChatInChatView"}constructor(){super({id:a.ID,title:P(9906,"Voice Chat in Chat View"),category:fi,precondition:fle,f1:!0},"view")}},Hti=class a extends z{static{this.ID="workbench.action.chat.holdToVoiceChatInChatView"}constructor(){super({id:a.ID,title:P(9898,"Hold to Voice Chat in Chat View"),keybinding:{weight:200,when:C.and(fle,Z.requestInProgress.negate(),w4i?.negate(),me.focus.negate(),wr.negate(),Ri.SearchViewFocusedKey.negate(),WR.negate()),primary:2087}})}async run(i,e){let t=i.get(F),o=i.get(Le),n=i.get(Lt),r=o.enableKeybindingHoldMode(a.ID),s,l=Zo(async()=>{let c=await Bti.create(i,"view");c&&(s=await sA.getInstance(t).start(c,e),s.setTimeoutDisabled(!0))},m1o);(await n.revealWidget())?.focusInput(),await r,l.dispose(),s&&s.accept()}},L5e=class a extends nvt{static{this.ID="workbench.action.chat.inlineVoiceChat"}constructor(){super({id:a.ID,title:P(9899,"Inline Voice Chat"),category:fi,precondition:C.and(fle,Tr),f1:!0},"inline")}},svt=class a extends nvt{static{this.ID="workbench.action.chat.quickVoiceChat"}constructor(){super({id:a.ID,title:P(9900,"Quick Voice Chat"),category:fi,precondition:fle,f1:!0},"quick")}},C4i=a=>[{id:R.ChatExecute,when:C.and(Z.location.isEqualTo("panel"),a),group:"navigation",order:3},{id:R.ChatExecute,when:C.and(Z.location.isEqualTo("panel").negate(),a),group:"navigation",order:2}],Uti=class a extends z{static{this.ID="workbench.action.chat.startVoiceChat"}constructor(){super({id:a.ID,title:P(9902,"Start Voice Chat"),category:fi,f1:!0,keybinding:{weight:200,when:C.and(w4i,me.focus.negate(),wr.negate()),primary:2087},icon:L.mic,precondition:C.and(fle,u1o.negate(),Aee.negate()),menu:C4i(C.and(YH,j7.negate(),Vti?.negate()))})}async run(i,e){let t=e?.widget;return t&&t.focusInput(),h1o(this.desc.id,i,"focused",e)}},zti=class a extends z{static{this.ID="workbench.action.chat.stopListening"}constructor(){super({id:a.ID,title:P(9903,"Stop Listening"),category:fi,f1:!0,keybinding:{weight:300,primary:9,when:Vti},icon:PT,precondition:xjt,menu:C4i(Vti)})}async run(i){sA.getInstance(i.get(F)).stop()}},Kti=class a extends z{static{this.ID="workbench.action.chat.stopListeningAndSubmit"}constructor(){super({id:a.ID,title:P(9904,"Stop Listening and Submit"),category:fi,f1:!0,keybinding:{weight:200,when:C.and(w4i,Vti),primary:2087},precondition:xjt})}run(i){sA.getInstance(i.get(F)).accept()}},j7=new Y("scopedChatSynthesisInProgress",!1,{type:"boolean",description:d(9889,null)}),Gti=class a{static create(i,e,t){return e==="focused"?a.doCreateForFocusedChat(i,t):{onDidHideChat:e.onDidHideInput,contextKeyService:e.scopedContextKeyService,response:t}}static doCreateForFocusedChat(i,e){let t=i.get(Lt),o=i.get(X),n=t.getWidgetBySessionResource(e.session.sessionResource);return n?.location==="editor"&&(n=t.lastFocusedWidget),{onDidHideChat:n?.onDidHide??U.None,contextKeyService:n?.scopedContextKeyService??o,response:e}}},aA=class{constructor(i,e,t){this.speechService=i;this.configurationService=e;this.instantiationService=t;this.activeSession=void 0}static{this.instance=void 0}static getInstance(i){return aA.instance||(aA.instance=i.createInstance(aA)),aA.instance}async start(i){this.stop(),sA.getInstance(this.instantiationService).stop();let e=this.activeSession=new qe,t=new O;t.add(e.token.onCancellationRequested(()=>t.dispose()));let o=await this.speechService.createTextToSpeechSession(e.token,"chat");if(e.token.isCancellationRequested)return;t.add(i.onDidHideChat(()=>this.stop()));let n=j7.bindTo(i.contextKeyService);t.add(ee(()=>n.reset())),t.add(o.onDidChange(r=>{switch(r.status){case 1:n.set(!0);break;case 2:n.reset();break}}));for await(let r of this.nextChatResponseChunk(i.response,e.token)){if(e.token.isCancellationRequested)return;await Ea(o.synthesize(r),e.token)}}async*nextChatResponseChunk(i,e){let t={ignoreCodeBlocks:this.configurationService.getValue("accessibility.voice.ignoreCodeBlocks"),insideCodeBlock:!1},o=0,n=!1;do{let r=i.response.toString().length,{chunk:s,offset:l}=this.parseNextChatResponseChunk(i,o,t);if(o=l,n=i.isComplete,s&&(yield s),e.isCancellationRequested)return;!n&&r===i.response.toString().length&&await Ea(U.toPromise(i.onDidChange),e)}while(!e.isCancellationRequested&&!n)}parseNextChatResponseChunk(i,e,t){let o,n=i.response.toString();if(i.isComplete)o=n.substring(e),e=n.length+1;else{let r=bNn(n,e);o=r.chunk,e=r.offset}return o&&t.ignoreCodeBlocks&&(o=this.filterCodeBlocks(o,t)),{chunk:o&&ma({value:o}),offset:e}}filterCodeBlocks(i,e){return i.split(`
`).filter(t=>t.trimStart().startsWith("```")?(e.insideCodeBlock=!e.insideCodeBlock,!1):!e.insideCodeBlock).join(`
`)}stop(){this.activeSession?.dispose(!0),this.activeSession=void 0}};aA=I([m(0,Gx),m(1,B),m(2,F)],aA);var gNn=[".","!","?",":"],fNn=`
`,vNn=" ";function bNn(a,i){let e;for(let t=a.length-1;t>=i;t--){let o=a[t],n=a[t+1];if(gNn.includes(o)&&n===vNn||fNn===o){e=a.substring(i,t+1).trim(),i=t+1;break}}return{chunk:e,offset:i}}var qti=class extends z{constructor(){super({id:"workbench.action.chat.readChatResponseAloud",title:P(9901,"Read Aloud"),icon:L.unmute,precondition:fle,menu:[{id:R.ChatMessageFooter,when:C.and(fle,Z.isResponse,j7.negate(),Z.responseIsFiltered.negate()),group:"navigation",order:-10},{id:JU,when:C.and(fle,Z.isResponse,j7.negate(),Z.responseIsFiltered.negate()),group:"navigation",order:-10}]})}run(i,...e){let t=i.get(F),o=i.get(Lt),n;if(e.length>0){let s=e[0];Ni(s)&&(n=s)}else{let s=o.lastFocusedWidget;if(s){let l=s.getFocus();if(l instanceof k8)n=l;else{let c=s.viewModel;if(c){let u=c.getItems();for(let p=u.length-1;p>=0;p--){let h=u[p];if(Ni(h)){n=h;break}}}}}}if(!n)return;let r=Gti.create(i,"focused",n.model);aA.getInstance(t).start(r)}},$ti=class a extends z{static{this.ID="workbench.action.speech.stopReadAloud"}constructor(){super({id:a.ID,icon:uQe,title:P(9907,"Stop Reading Aloud"),f1:!0,category:fi,precondition:qOt,keybinding:{weight:300,primary:9,when:j7},menu:C4i(j7)})}async run(i){aA.getInstance(i.get(F)).stop()}},jti=class a extends z{static{this.ID="workbench.action.chat.stopReadChatItemAloud"}constructor(){super({id:a.ID,icon:L.mute,title:P(9905,"Stop Reading Aloud"),precondition:j7,keybinding:{weight:300,primary:9},menu:[{id:R.ChatMessageFooter,when:C.and(j7,Z.isResponse,Z.responseIsFiltered.negate()),group:"navigation",order:-10},{id:JU,when:C.and(j7,Z.isResponse,Z.responseIsFiltered.negate()),group:"navigation",order:-10}]})}async run(i,...e){aA.getInstance(i.get(F)).stop()}};function g1o(a,i,e){if(!i.hasSpeechProvider||!e.getDefaultAgent("panel"))return!1;let t=a.getValue(Ope);return typeof t=="string"&&t!==tT.SETTINGS_VALUE.OFF}var tT=class extends k{constructor(e,t,o,n,r,s,l){super();this.speechService=e;this.configurationService=t;this.commandService=o;this.editorService=r;this.hostService=s;this.chatAgentService=l;this.activeSession=void 0;this._register(n.createInstance(QO)),this.registerListeners()}static{this.ID="workbench.contrib.keywordActivation"}static{this.SETTINGS_VALUE={OFF:"off",INLINE_CHAT:"inlineChat",QUICK_CHAT:"quickChat",VIEW_CHAT:"chatInView",CHAT_IN_CONTEXT:"chatInContext"}}registerListeners(){this._register(U.runAndSubscribe(this.speechService.onDidChangeHasSpeechProvider,()=>{this.updateConfiguration(),this.handleKeywordActivation()}));let e=this._register(this.chatAgentService.onDidChangeAgents(()=>{this.chatAgentService.getDefaultAgent("panel")&&(this.updateConfiguration(),this.handleKeywordActivation(),e.dispose())}));this._register(this.speechService.onDidStartSpeechToTextSession(()=>this.handleKeywordActivation())),this._register(this.speechService.onDidEndSpeechToTextSession(()=>this.handleKeywordActivation())),this._register(this.configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(Ope)&&this.handleKeywordActivation()}))}updateConfiguration(){if(!this.speechService.hasSpeechProvider||!this.chatAgentService.getDefaultAgent("panel"))return;oe.as($t.Configuration).registerConfiguration({...qFt,properties:{[Ope]:{type:"string",enum:[tT.SETTINGS_VALUE.OFF,tT.SETTINGS_VALUE.VIEW_CHAT,tT.SETTINGS_VALUE.QUICK_CHAT,tT.SETTINGS_VALUE.INLINE_CHAT,tT.SETTINGS_VALUE.CHAT_IN_CONTEXT],enumDescriptions:[d(9896,null),d(9894,null),d(9897,null),d(9895,null),d(9893,null)],description:d(9892,null),default:"off",tags:["accessibility"]}}})}handleKeywordActivation(){let e=g1o(this.configurationService,this.speechService,this.chatAgentService)&&!this.speechService.hasActiveSpeechToTextSession;e&&this.activeSession||!e&&!this.activeSession||(e?this.enableKeywordActivation():this.disableKeywordActivation())}async enableKeywordActivation(){let e=this.activeSession=new qe,t=await this.speechService.recognizeKeyword(e.token);e.token.isCancellationRequested||e!==this.activeSession||(this.activeSession=void 0,t===1&&(this.hostService.hasFocus&&this.commandService.executeCommand(this.getKeywordCommand()),this.handleKeywordActivation()))}getKeywordCommand(){switch(this.configurationService.getValue(Ope)){case tT.SETTINGS_VALUE.INLINE_CHAT:return L5e.ID;case tT.SETTINGS_VALUE.QUICK_CHAT:return svt.ID;case tT.SETTINGS_VALUE.CHAT_IN_CONTEXT:if(da(this.editorService.activeTextEditorControl)?.hasWidgetFocus())return L5e.ID;default:return rvt.ID}}disableKeywordActivation(){this.activeSession?.dispose(!0),this.activeSession=void 0}dispose(){this.activeSession?.dispose(),super.dispose()}};tT=I([m(0,Gx),m(1,B),m(2,fe),m(3,F),m(4,ie),m(5,ti),m(6,gr)],tT);var QO=class extends k{constructor(e,t,o,n,r){super();this.speechService=e;this.statusbarService=t;this.commandService=o;this.configurationService=n;this.chatAgentService=r;this.entry=this._register(new ue);this._register(Ge.registerCommand(QO.STATUS_COMMAND,()=>this.commandService.executeCommand("workbench.action.openSettings",Ope))),this.registerListeners(),this.updateStatusEntry()}static{this.STATUS_NAME=d(9887,null)}static{this.STATUS_COMMAND="keywordActivation.status.command"}static{this.STATUS_ACTIVE=d(9885,null)}static{this.STATUS_INACTIVE=d(9886,null)}registerListeners(){this._register(this.speechService.onDidStartKeywordRecognition(()=>this.updateStatusEntry())),this._register(this.speechService.onDidEndKeywordRecognition(()=>this.updateStatusEntry())),this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(Ope)&&this.updateStatusEntry()}))}updateStatusEntry(){g1o(this.configurationService,this.speechService,this.chatAgentService)?(this.entry.value||this.createStatusEntry(),this.updateStatusLabel()):this.entry.clear()}createStatusEntry(){this.entry.value=this.statusbarService.addEntry(this.getStatusEntryProperties(),"status.voiceKeywordActivation",1,103)}getStatusEntryProperties(){return{name:QO.STATUS_NAME,text:this.speechService.hasActiveKeywordRecognition?"$(mic-filled)":"$(mic)",tooltip:this.speechService.hasActiveKeywordRecognition?QO.STATUS_ACTIVE:QO.STATUS_INACTIVE,ariaLabel:this.speechService.hasActiveKeywordRecognition?QO.STATUS_ACTIVE:QO.STATUS_INACTIVE,command:QO.STATUS_COMMAND,kind:"prominent",showInAllWindows:!0}}updateStatusLabel(){this.entry.value?.update(this.getStatusEntryProperties())}};QO=I([m(0,Gx),m(1,Fr),m(2,fe),m(3,B),m(4,gr)],QO);hs((a,i)=>{let e,t;Uf(a.type)?(e=a.getColor(Ei),t=a.getColor(Ei)):(e=a.getColor(D2)??a.getColor(Kc),t=e?.transparent(.38)),i.addRule(`
		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-sync.codicon-modifier-spin:not(.disabled),
		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled) {
			color: ${e};
			outline: 1px solid ${e};
			outline-offset: -1px;
			animation: pulseAnimation 1s infinite;
			border-radius: 50%;
		}

		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-sync.codicon-modifier-spin:not(.disabled)::before,
		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before {
			position: absolute;
			outline: 1px solid ${e};
			outline-offset: 2px;
			border-radius: 50%;
			width: 16px;
			height: 16px;
		}

		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-sync.codicon-modifier-spin:not(.disabled)::after,
		.monaco-workbench.monaco-enable-motion .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::after {
			outline: 2px solid ${e};
			outline-offset: -1px;
			animation: pulseAnimation 1500ms cubic-bezier(0.75, 0, 0.25, 1) infinite;
		}

		@keyframes pulseAnimation {
			0% {
				outline-width: 2px;
			}
			62% {
				outline-width: 5px;
				outline-color: ${t};
			}
			100% {
				outline-width: 2px;
			}
		}
	`)});var Qti=class extends z{constructor(){super({id:Y_e,title:P(9910,"Open in Agents"),category:fi,precondition:_Ye,f1:!0,menu:[{id:R.ChatTitleBarMenu,group:"c_sessions",order:1,when:_Ye},{id:R.TitleBar,group:Blt,order:-1e3,when:_Ye}]})}async run(i){let e=i.get(wo),o=i.get(Ae).getWorkspace().folders[0]?.uri;await e.openAgentsWindow({folderUri:o?.scheme===Q.file?o:void 0})}},Yti=class extends z{constructor(){super({id:rao,title:P(9908,"Open Agents Window"),category:fi,precondition:_Ye,f1:!0,keybinding:[{primary:3103,weight:200,when:C.and(qo.toNegated(),Oa.toNegated())},{primary:3615,weight:200,when:C.and(qo.toNegated(),Oa)}]})}async run(i){await i.get(wo).openAgentsWindow()}},avt=class extends Ja{constructor(e,t,o){super(void 0,e,t);this.hoverService=o}render(e){super.render(e),e.classList.add("open-in-agents-titlebar-widget"),e.setAttribute("role","button");let t=this.action.label,o=d(9909,null);e.setAttribute("aria-label",o),this._register(this.hoverService.setupManagedHover(yi("element"),e,o)),D(e,_("span.open-in-agents-titlebar-widget-icon")).setAttribute("aria-hidden","true");let r=D(e,_("span.open-in-agents-titlebar-widget-label"));r.textContent=t}};avt=I([m(2,ot)],avt);var Rye=class extends k{static{this.ID="workbench.contrib.openWorkspaceInAgents.desktop"}constructor(i,e,t,o){super(),this._register(i.register(R.TitleBar,Y_e,(n,r)=>e.createInstance(avt,n,r),void 0))}};Rye=I([m(0,sh),m(1,F),m(2,X),m(3,Ze)],Rye);var SNn=sN({key:"chat.externalPath.workspaceAllowlist",defaultValue:[],toStorage:a=>JSON.stringify(a),fromStorage:a=>{let i=JSON.parse(a);return Array.isArray(i)?i:[]}}),Xti=class{constructor(i,e,t,o,n){this._getPathInfo=i;this._labelService=e;this._findGitRoot=t;this._pickFolder=n;this.canUseDefaultApprovals=!1;this._sessionFolderAllowlist=new dt;this._gitRootCache=new dt;o&&(this._workspaceAllowlist=SNn(1,1,o))}dispose(){this._workspaceAllowlist?.dispose()}_getWorkspaceFolders(){if(!this._workspaceAllowlist)return new xn;let i=new xn;for(let e of this._workspaceAllowlist.get())try{i.add(A.parse(e))}catch{}return i}_setWorkspaceFolders(i){if(!this._workspaceAllowlist)return;let e=[];for(let t of i)e.push(t.toString());this._workspaceAllowlist.set(e,void 0)}getPreConfirmAction(i){let e=this._getPathInfo(i);if(!e)return;let t;try{t=A.file(e.path)}catch{return}if(i.workingDirectory){if(kL.isEqualOrParent(t,i.workingDirectory))return{type:4}}else{let o=this._getWorkspaceFolders();for(let n of o)if(kL.isEqualOrParent(t,n))return{type:4}}if(i.chatSessionResource){let o=this._sessionFolderAllowlist.get(i.chatSessionResource);if(o){for(let n of o)if(kL.isEqualOrParent(t,n))return{type:4}}}}getPreConfirmActions(i){let e=this._getPathInfo(i);if(!e||!i.chatSessionResource)return[];let t;try{t=A.file(e.path)}catch{return[]}let o=e.isDirectory?t:ai(t),n=i.chatSessionResource,r=[{label:d(9775,null),detail:d(9776,null),select:async()=>{let s=this._sessionFolderAllowlist.get(n);return s||(s=new xn,this._sessionFolderAllowlist.set(n,s)),s.add(o),!0}}];if(this._findGitRoot){let s=this._findGitRoot,l=this._gitRootCache,c=this._sessionFolderAllowlist,u=l.get(t);u===null||(u?r.push({label:d(9777,null),detail:d(9778,null,u.fsPath),select:async()=>{let p=c.get(n);return p||(p=new xn,c.set(n,p)),p.add(u),!0}}):r.push({label:d(9777,null),detail:d(9779,null),select:async()=>{let p=await s(t);l.set(t,p??null);let h=c.get(n);return h||(h=new xn,c.set(n,h)),h.add(p??o),!0}}))}return r}getManageActions(){let i=[],e=this._getWorkspaceFolders();for(let o of e)i.push({label:this._labelService.getUriLabel(o),description:d(9781,null),checked:!0,onDidChangeChecked:n=>{n?(e.add(o),this._setWorkspaceFolders(e)):(e.delete(o),this._setWorkspaceFolders(e))}});let t=new xn;for(let[,o]of this._sessionFolderAllowlist)for(let n of o)t.add(n);for(let o of t){let n=[...this._sessionFolderAllowlist].filter(([,r])=>r.has(o));i.push({label:this._labelService.getUriLabel(o),description:d(9780,null),checked:!0,onDidChangeChecked:r=>{if(r)for(let[,s]of n)s.add(o);else for(let[,s]of n)s.delete(o)}})}if(this._pickFolder){let o=this._pickFolder;i.push({pickable:!1,label:d(9773,null),description:d(9774,null),onDidOpen:async()=>{let n=await o();if(n){let r=this._getWorkspaceFolders();r.add(n),this._setWorkspaceFolders(r)}}})}return i}reset(){this._sessionFolderAllowlist.clear(),this._gitRootCache.clear(),this._workspaceAllowlist&&this._workspaceAllowlist.set([],void 0)}};function f1o(a){let i=vZe(a),e=A.parse(i),t=new Set,o=e.toString(!0);t.add(o);let n=e.with({path:"",query:"",fragment:""}).toString(!0);t.add(n);let r=e.authority,s=r.split("."),l=s.length===4&&s.every(h=>Number.isInteger(+h)),c=r.includes(":")&&r.match(/^(\[)?[0-9a-fA-F:]+(\])?(?::\d+)?$/);if(!(l||c)&&s.length>2)for(let h=0;h<s.length-2;h++){let g="*."+s.slice(h+1).join("."),f=e.with({authority:g,path:"",query:"",fragment:""}).toString(!0);t.add(f)}let p=e.path.split("/").filter(h=>h.length>0);if(p.length>0)for(let h=p.length-1;h>=0;h--){let g=p.slice(0,h).join("/"),f=e.with({path:(h>0?"/":"")+g,query:"",fragment:""}).toString(!0);t.add(f)}return[...t].map(h=>h.replace(/\/+$/,""))}function x4i(a,i){let e=i;return e.startsWith("https://")?e=e.substring(8):e.startsWith("http://")&&(e=e.substring(7)),e.replace(/\/+$/,"")}function v1o(a,i,e){let t=vZe(a),o=A.parse(t);for(let[n,r]of Object.entries(i))if(BRe(o,n)){if(typeof r=="boolean")return r;if(e&&r.approveRequest!==void 0)return r.approveRequest;if(!e&&r.approveResponse!==void 0)return r.approveResponse}return!1}var INn={iconClass:q.asClassName(L.trash),tooltip:d(9788,null)},M5e=class{constructor(i,e,t,o){this._getURLS=i;this._configurationService=e;this._quickInputService=t;this._preferencesService=o;this.canUseDefaultApprovals=!1}getPreConfirmAction(i){return this._checkApproval(i,!0)}getPostConfirmAction(i){return this._checkApproval(i,!1)}_checkApproval(i,e){let t=this._getURLS(i.parameters);if(!t||t.length===0)return;let o=this._getApprovedUrls();if(t.every(r=>{try{let s=A.parse(r);return v1o(s,o,e)}catch{return!1}}))return{type:2,id:"chat.tools.urls.autoApprove"}}getPreConfirmActions(i){return this._getConfirmActions(i,!0)}getPostConfirmActions(i){return this._getConfirmActions(i,!1)}_getConfirmActions(i,e){let t=this._getURLS(i.parameters);if(!t||t.length===0)return[];let o=t.map(l=>l.split("?")[0]),n=[],r=Array.from(new Set(o)).map(l=>A.parse(l)),s=new dt(r.map(l=>[l,f1o(l)]));if(s.size===1){let l=r[0],c=s.get(l),u=c.slice(0,2);for(let p of u){let h=x4i(l,p);n.push({label:e?d(9785,null,h):d(9786,null,h),select:async()=>(await this._approvePattern(p,e,!e),!0)})}n.push({label:d(9790,null),select:async()=>await this._showMoreOptions(i,[{uri:l,patterns:c}],e)})}else n.push({label:d(9792,null),select:async()=>(await this._showMoreOptions(i,[...s].map(([l,c])=>({uri:l,patterns:c})),e),!0)});return n}async _showMoreOptions(i,e,t){return new Promise(o=>{let n=new O,r=n.add(this._quickInputService.createQuickTree());r.ignoreFocusOut=!0,r.sortByLabel=!1,r.placeholder=d(9797,null);let s=[],l=this._getApprovedUrls(),c=new Set;for(let{uri:p,patterns:h}of e)for(let g of h.slice().sort((f,v)=>v.length-f.length)){if(c.has(g))continue;c.add(g);let f=l[g],v=typeof f=="boolean"?f:f?.approveRequest??!1,b=typeof f=="boolean"?f:f?.approveResponse??!1;s.push({label:x4i(p,g),pattern:g,checked:v&&b?!0:!v&&!b?!1:"mixed",collapsed:!0,children:[{label:d(9782,null),pattern:g,approvalType:"request",checked:v},{label:d(9783,null),pattern:g,approvalType:"response",checked:b}]})}r.setItemTree(s);let u=()=>{let p={...this._getApprovedUrls()};for(let h of r.itemTree){let g=h.children?.find(v=>v.approvalType==="request")?.checked,f=h.children?.find(v=>v.approvalType==="response")?.checked;f&&g?p[h.pattern]=!0:!f&&!g?delete p[h.pattern]:p[h.pattern]={approveRequest:!!g||void 0,approveResponse:!!f||void 0}}return this._configurationService.updateValue("chat.tools.urls.autoApprove",p)};n.add(r.onDidAccept(async()=>{r.busy=!0,await u(),o(!!this._checkApproval(i,t)),r.hide()})),n.add(r.onDidHide(()=>{u(),n.dispose(),o(!1)})),r.show()})}async _approvePattern(i,e,t){let o={...this._getApprovedUrls()},n=o[i],r=!1,s=!1;typeof n=="boolean"?(r=n,s=n):n&&(r=n.approveRequest??!1,s=n.approveResponse??!1);let l=e||r,c=t||s,u;l===c?u=l:u={approveRequest:l,approveResponse:c},o[i]=u,await this._configurationService.updateValue("chat.tools.urls.autoApprove",o)}getManageActions(){let i={...this._getApprovedUrls()},e=[];for(let[t,o]of Object.entries(i)){let n=t,r;if(typeof o=="boolean")r=o?d(9784,null):d(9789,null);else{let l=[];o.approveRequest&&l.push(d(9795,null)),o.approveResponse&&l.push(d(9796,null)),r=l.length>0?d(9787,null,l.join(", ")):d(9793,null)}let s={label:n,description:r,buttons:[INn],checked:!0,onDidChangeChecked:l=>{l?i[t]=o:delete i[t],this._configurationService.updateValue("chat.tools.urls.autoApprove",i)}};e.push(s)}return e.push({pickable:!1,label:d(9791,null),description:d(9794,null),onDidOpen:()=>{this._preferencesService.openUserSettings({query:"chat.tools.urls.autoApprove"})}}),e}async reset(){await this._configurationService.updateValue("chat.tools.urls.autoApprove",{})}_getApprovedUrls(){return this._configurationService.getValue("chat.tools.urls.autoApprove")||{}}};M5e=I([m(1,B),m(2,$e),m(3,Qo)],M5e);var b1o={id:clt,displayName:"Fetch Web Page",canBeReferencedInPrompt:!1,modelDescription:"Fetches the main content from a web page. This tool is useful for summarizing or analyzing the content of a webpage.",source:wn.Internal,canRequestPostApproval:!0,canRequestPreApproval:!0,inputSchema:{type:"object",properties:{urls:{type:"array",items:{type:"string"},description:d(9927,null)}},required:["urls"]}},P5e=class{constructor(i,e,t,o,n,r){this._readerModeService=i;this._fileService=e;this._trustedDomainService=t;this._chatService=o;this._workspaceContextService=n;this._agentNetworkFilterService=r}async invoke(i,e,t,o){let n=i.parameters.urls||[],{webUris:r,fileUris:s,invalidUris:l,blockedUris:c}=this._parseUris(n);if(![...r.values(),...s.values()].length&&l.size===0&&c.size===0)return{content:[{kind:"text",value:d(9920,null)}]};let p=[];if(r.size>0){let w=this._trustedDomainService.trustedDomains;p=await this._readerModeService.extract([...r.values()],{trustedDomains:w})}let h=[],g=[];for(let w of s.values())try{let x=await this._fileService.readFile(w,void 0,o),E=this._getSupportedImageMimeType(w);E?h.push({type:"tooldata",value:{kind:"data",value:{mimeType:E,data:x.value}}}):YDe({buffer:x.value,bytesRead:x.value.byteLength}).seemsBinary?h.push(d(9911,null)):h.push(x.value.toString()),g.push(w)}catch{h.push(void 0)}let f=[],v=0,b=0;for(let w of n)c.has(w)?f.push(this._agentNetworkFilterService.formatError(A.parse(w))):l.has(w)?f.push(void 0):r.has(w)?(f.push({type:"extracted",value:p[v]}),v++):s.has(w)?(f.push(h[b]),b++):f.push(void 0);let S;p.every(w=>w.status==="error"||w.status==="redirect")&&(S=!1);let y=[...r.values(),...g];return{content:this._getPromptPartsForResults(n,f),toolResultDetails:y,confirmResults:S}}async prepareToolInvocation(i,e){let{webUris:t,fileUris:o,invalidUris:n,blockedUris:r}=this._parseUris(i.parameters.urls),s=[],l=[];for(let[E,M]of o.entries())try{await this._fileService.stat(M),s.push(M)}catch{l.push(E)}let c=[...Array.from(n),...l,...Array.from(r)],u=new xn([...t.values(),...s]),p=new hBe(this._workspaceContextService,i.workingDirectory),h=s.filter(E=>!p.getFolder(E)),g=new xn([...t.values(),...h]),f=c.length?c.length>1?new he(d(9921,null,u.size,c.map(E=>`- ${E}`).join(`
`))):new he(d(9922,null,c[0])):new he,v=new he;if(u.size>1)f.appendMarkdown(d(9923,null,u.size)),v.appendMarkdown(d(9917,null,u.size));else if(u.size===1){let E=yt.first(u).toString(!0);E.length>400||s.length===1?(f.appendMarkdown(d(9925,null,E)),v.appendMarkdown(d(9919,null,E))):(f.appendMarkdown(d(9924,null,E)),v.appendMarkdown(d(9918,null,E)))}let b;if(i.chatSessionResource){let M=this._chatService.getSession(i.chatSessionResource)?.getRequests().map(V=>V.message.text.toLowerCase()),N=!1;for(let V of g){let H=V.toString(!0).toLowerCase().replace(/\/$/,"");M?.some(K=>K.includes(H))&&(g.delete(V),N=!0)}N&&g.size===0&&(b=d(9926,null))}let S={invocationMessage:v,pastTenseMessage:f},y=yt.every(g,E=>this._trustedDomainService.isValid(E)),w,x;return g.size&&!y&&(g.size===1?(w=d(9914,null),x=new he(yt.first(g).toString(!0),{supportThemeIcons:!0})):(w=d(9913,null),x=new he([...g].map(E=>`- ${E.toString(!0)}`).join(`
`),{supportThemeIcons:!0}))),S.confirmationMessages={title:w,message:x,confirmResults:g.size>0,allowAutoConfirm:!0,disclaimer:new he("$(info) "+d(9912,null),{supportThemeIcons:!0}),confirmationNotNeededReason:b},S}_parseUris(i){let e=new Map,t=new Map,o=new Set,n=new Set;return i?.forEach(r=>{try{let s=A.parse(r);s.scheme==="http"||s.scheme==="https"?this._agentNetworkFilterService.isUriAllowed(s)?e.set(r,s):n.add(r):t.set(r,s)}catch{o.add(r)}}),{webUris:e,fileUris:t,invalidUris:o,blockedUris:n}}_getPromptPartsForResults(i,e){return e.map((t,o)=>{let n=e.length>1?d(9915,null,i[o]):void 0;if(t){if(typeof t=="string")return{kind:"text",title:n,value:t};if(t.type==="tooldata")return{...t.value,title:n};if(t.type==="extracted")switch(t.value.status){case"ok":return{kind:"text",title:n,value:t.value.result};case"redirect":return{kind:"text",title:n,value:`The webpage has redirected to "${t.value.toURI.toString(!0)}". Use the ${clt} again to get its contents.`};case"error":return{kind:"text",title:n,value:`An error occurred retrieving the fetch result: ${t.value.error}`};default:bs(t.value)}else throw new Error("unreachable")}else return{kind:"text",title:n,value:d(9916,null)}})}_getSupportedImageMimeType(i){switch(km(i.path).toLowerCase()){case".png":return"image/png";case".jpg":case".jpeg":return"image/jpeg";case".gif":return"image/gif";case".webp":return"image/webp";case".bmp":return"image/bmp";default:return}}};P5e=I([m(0,cFe),m(1,ge),m(2,s8),m(3,si),m(4,Ae),m(5,bW)],P5e);var Lye=class extends k{static{this.ID="chat.nativeBuiltinTools"}constructor(i,e,t,o,n,r,s){super();let l=e.createInstance(P5e);this._register(i.registerTool(b1o,l)),this._register(t.registerConfirmationContribution(clt,e.createInstance(M5e,u=>u.urls)));let c=new Xti(u=>{let p=u.parameters;if(p?.filePath)return{path:p.filePath,isDirectory:!1};if(p?.path)return{path:p.path,isDirectory:!0}},s,async u=>{let p=ai(u);for(let h=0;h<100;h++){try{if(await o.exists(A.joinPath(p,".git")))return p}catch{}let g=ai(p);if(kL.isEqual(g,p))return;p=g}},n,async()=>(await r.showOpenDialog({canSelectFolders:!0,canSelectFiles:!1,canSelectMany:!1}))?.[0]);this._register(c),this._register(t.registerConfirmationContribution("copilot_readFile",c)),this._register(t.registerConfirmationContribution("copilot_listDirectory",c))}};Lye=I([m(0,Wn),m(1,F),m(2,IR),m(3,ge),m(4,de),m(5,nn),m(6,nt)],Lye);var A5e=class{constructor(i){this._localGitService=i}_withCancel(i,e){let t=ht(),o=i?.onCancellationRequested(()=>{this._localGitService.cancel(t).catch(()=>{})});return e(t).finally(()=>o?.dispose())}async cloneRepository(i,e,t,o){await this._withCancel(o,n=>this._localGitService.clone(n,i,e.fsPath,t))}async pull(i,e){return this._withCancel(e,t=>this._localGitService.pull(t,i.fsPath))}async checkout(i,e,t,o){await this._withCancel(o,n=>this._localGitService.checkout(n,i.fsPath,e,t))}async revParse(i,e){return this._localGitService.revParse(i.fsPath,e)}async fetch(i,e){await this._withCancel(e,t=>this._localGitService.fetch(t,i.fsPath))}async fetchRepository(i,e){await this._withCancel(e,t=>this._localGitService.fetch(t,i.fsPath))}async revListCount(i,e,t){return this._localGitService.revListCount(i.fsPath,e,t)}};A5e=I([m(0,kti)],A5e);Ce(Lre,A5e,1);lv(kti,"localGit");var N5e=class extends k{constructor(e,t,o,n,r,s,l){super();this.environmentService=e;this.commandService=t;this.workspaceTrustRequestService=o;this.logService=n;this.layoutService=r;this.contextKeyService=s;this.chatWidgetService=l;this.registerListeners()}static{this.ID="workbench.contrib.chatCommandLineHandler"}registerListeners(){Xl.on("vscode:handleChatRequest",(e,...t)=>{let o=t[0];this.logService.trace("vscode:handleChatRequest",o),this.prompt(o)}),Xl.on("vscode:openChatSession",(e,...t)=>{let o=t[0];this.logService.trace("vscode:openChatSession",o);let n=A.parse(o);this.chatWidgetService.openSession(n,XD)})}async prompt(e){if(!Array.isArray(e?._)||!await this.workspaceTrustRequestService.requestWorkspaceTrust({message:d(9933,null)}))return;let o={query:e._.length>0?e._.join(" "):"",mode:e.mode??"agent",attachFiles:e["add-file"]?.map(n=>A.file(uA(n)))};if(e.maximize){let n=this.contextKeyService.getContextKeyValue(Z.panelLocation.key);n===2?this.layoutService.setAuxiliaryBarMaximized(!0):n===1&&!this.layoutService.isPanelMaximized()&&this.layoutService.toggleMaximizedPanel()}await this.commandService.executeCommand(Mh),await this.commandService.executeCommand(tk,o)}};N5e=I([m(0,Jr),m(1,fe),m(2,lp),m(3,re),m(4,wi),m(5,X),m(6,Lt)],N5e);var O5e=class extends k{static{this.ID="workbench.contrib.chatSuspendThrottlingHandler"}constructor(i,e){super(),this._register(ve(t=>{let o=e.requestInProgressObs.read(t);i.setBackgroundThrottling(!o)}))}};O5e=I([m(0,wo),m(1,si)],O5e);var F5e=class extends k{constructor(e,t,o,n,r,s,l,c){super();this.agentSessionsService=t;this.dialogService=o;this.widgetService=n;this.contextKeyService=r;this.environmentService=l;this.chatEntitlementService=c;this._register(e.onBeforeShutdown(u=>{u.veto(this.shouldVetoShutdown(u.reason),"veto.chat")})),this._register(s.onWillStop(u=>{u.veto(this.hasNonCloudSessionInProgress(),d(9930,null))}))}static{this.ID="workbench.contrib.chatLifecycleHandler"}hasNonCloudSessionInProgress(){return this.chatEntitlementService.sentiment.hidden?!1:this.agentSessionsService.model.sessions.some(e=>Rx(e.status)&&e.providerType!==zo.Cloud&&!e.isArchived())}shouldVetoShutdown(e){return this.environmentService.enableSmokeTestDriver||!this.hasNonCloudSessionInProgress()||Z.skipChatRequestInProgressMessage.getValue(this.contextKeyService)===!0?!1:this.doShouldVetoShutdown(e)}async doShouldVetoShutdown(e){this.widgetService.revealWidget();let t,o;switch(e){case 1:t=d(9932,null),o=d(9931,null);break;case 4:t=d(9929,null),o=d(9928,null);break;case 3:t=d(9939,null),o=d(9938,null);break;default:t=et?d(9937,null):d(9935,null),o=et?d(9936,null):d(9934,null);break}return!(await this.dialogService.confirm({message:t,detail:o})).confirmed}};F5e=I([m(0,to),m(1,Vc),m(2,ct),m(3,Lt),m(4,X),m(5,lt),m(6,Jr),m(7,dr)],F5e);W(Qti);W(Yti);W(Uti);W(rvt);W(Hti);W(svt);W(L5e);W(zti);W(Kti);W(qti);W(jti);W($ti);l1o();c1o();d1o();bt(tT.ID,tT,vt.AfterRestored);bt(Lye.ID,Lye,vt.AfterRestored);bt(N5e.ID,N5e,vt.BlockRestore);bt(O5e.ID,O5e,vt.AfterRestored);bt(F5e.ID,F5e,vt.AfterRestored);bt(_ye.ID,_ye,vt.AfterRestored);bt(Dye.ID,Dye,vt.AfterRestored);bt(Rye.ID,Rye,vt.BlockRestore);var yNn=3e4;function S1o(a){if(!(!a||a instanceof Error))return a.agents.find(i=>i.provider==="copilotcli")}async function wNn(a){let i=S1o(a.rootState.value);if(i)return`agent-host-${i.provider}`;let e=new qe,t=new Promise(n=>{let r=a.rootState.onDidChange(s=>{let l=S1o(s);l&&(r.dispose(),n(l))});e.token.onCancellationRequested(()=>{r.dispose(),n(void 0)})}),o=await Promise.race([t,Li(yNn).then(()=>{e.cancel(),e.dispose()})]);if(!o)throw new Error("Agent host did not register a copilotcli agent within the timeout period. Ensure the agent host is enabled and running.");return`agent-host-${o.provider}`}async function k4i(a,i){let e=a.get(hk),t=a.get(F),o=await wNn(e);return t.invokeFunction(n=>Aet(n,{type:o,displayName:sb(o),position:i}))}Ge.registerCommand(`workbench.action.chat.openNewChatSessionInPlace.${zo.AgentHostCopilot}`,(a,i)=>k4i(a,i==="editor"?"editor":"sidebar"));Ge.registerCommand(`workbench.action.chat.openNewSessionSidebar.${zo.AgentHostCopilot}`,a=>k4i(a,"sidebar"));Ge.registerCommand(`workbench.action.chat.openNewSessionEditor.${zo.AgentHostCopilot}`,a=>k4i(a,"editor"));var lvt=class{constructor(i,e,t,o){this.jsonEditingService=i;this.environmentService=e;this.fileService=t;this.storageService=o;this.migrateToGnomeLibsecret()}async migrateToGnomeLibsecret(){if(!(!Sn||this.storageService.getBoolean("encryption.migratedToGnomeLibsecret",-1,!1)))try{let i=await this.fileService.readFile(this.environmentService.argvResource),e=A_(i.value.toString());(e["password-store"]==="gnome"||e["password-store"]==="gnome-keyring")&&this.jsonEditingService.write(this.environmentService.argvResource,[{path:["password-store"],value:"gnome-libsecret"}],!0),this.storageService.store("encryption.migratedToGnomeLibsecret",!0,-1,0)}catch(i){console.error(i)}}};lvt=I([m(0,Zg),m(1,ko),m(2,ge),m(3,de)],lvt);oe.as(Zi.Workbench).registerWorkbenchContribution(lvt,4);var CNn=3600*1e3,I1o="emergencyAlert.banner",W5e=class extends k{constructor(e,t,o,n){super();this.bannerService=e;this.requestService=t;this.productService=o;this.logService=n;let r=o.emergencyAlertUrl;if(!r)return;this.fetchAlerts(r),this._register(new ky).cancelAndSet(()=>this.fetchAlerts(r),CNn,ut)}static{this.ID="workbench.contrib.emergencyAlert"}async fetchAlerts(e){try{await this.doFetchAlerts(e)}catch(t){this.logService.error(t)}}async doFetchAlerts(e){let t=await this.requestService.request({type:"GET",url:e,disableCache:!0,timeout:2e4,callSite:"emergencyAlert.doFetchAlerts"},Ie.None);if(t.res.statusCode!==200)throw new Error(`Failed to fetch emergency alerts: HTTP ${t.res.statusCode}`);let o=await Th(t);if(!o||!Array.isArray(o.alerts)){this.dismissAlert();return}let n=o.alerts.find(r=>r.commit===this.productService.commit&&(!r.platform||r.platform===XO)&&(!r.arch||r.arch===jye));if(!n){this.dismissAlert();return}this.currentAlertMessage===n.message&&eo(this.currentAlertActions??[],n.actions??[],(r,s)=>r.label===s.label&&r.href===s.href)||(this.currentAlertMessage=n.message,this.currentAlertActions=n.actions,this.bannerService.show({id:I1o,icon:L.warning,message:n.message,actions:n.actions}))}dismissAlert(){this.currentAlertMessage!==void 0&&(this.currentAlertMessage=void 0,this.currentAlertActions=void 0,this.bannerService.hide(I1o))}};W5e=I([m(0,LR),m(1,Ra),m(2,Ze),m(3,re)],W5e);bt(W5e.ID,W5e,vt.Eventually);var V5e=class extends mne{constructor(e,t,o){super(e,t);this._nativeHostService=o}async ensureListeningOnPort(e){let t=Date.now()+3e4;for(;await this._nativeHostService.isPortFree(e)&&Date.now()<t;)await Li(50)}getDebugPort(){return this._nativeHostService.findFreePort(5e3,10,5e3,2048)}};V5e=I([m(0,Hi),m(1,fe),m(2,wo)],V5e);var B5e=class extends Fre{constructor(e,t,o,n,r,s,l){super(null,o,n,r,s,l);this.mainProcess=e;this.logService=t}start(){Xd.toService(this.mainProcess.getChannel(x8t)).load().then(t=>this.setDetails(t),t=>{this.logService.warn("Error getting main process MCP environment",t),this.setDetails(void 0)})}};B5e=I([m(0,rm),m(1,re),m(2,nt),m(3,ge),m(4,F),m(5,xc),m(6,B)],B5e);var H5e=class{constructor(i,e,t){this._remoteAgentService=e;this._logService=t;this._localChannel=i.getChannel(edt),this._localPlatformService=Xd.toService(this._localChannel)}async createGateway(i,e){return this._logService.debug(`[McpGateway][Workbench] createGateway requested (inRemote=${i})`),i?this._createRemoteGateway(e):this._createLocalGateway(e)}async _createLocalGateway(i){this._logService.info("[McpGateway][Workbench] Creating local gateway via main process");let e=await this._localChannel.call("createGateway",i?{chatSessionResource:i.toString()}:void 0),t=Jti(e.servers);this._logService.info(`[McpGateway][Workbench] Local gateway created with ${t.length} server(s)`);let o=U.map(U.filter(this._localChannel.listen("onDidChangeGatewayServers"),n=>n.gatewayId===e.gatewayId),n=>Jti(n.servers));return{servers:t,onDidChangeServers:o,dispose:()=>{this._logService.info(`[McpGateway][Workbench] Disposing local gateway: ${e.gatewayId}`),this._localPlatformService.disposeGateway(e.gatewayId)}}}async _createRemoteGateway(i){let e=this._remoteAgentService.getConnection();if(!e){this._logService.info("[McpGateway][Workbench] No remote connection available for remote gateway");return}return this._logService.info("[McpGateway][Workbench] Creating remote gateway via remote server"),e.withChannel(edt,async t=>{let o=await t.call("createGateway",i?{chatSessionResource:i.toString()}:void 0),n=Jti(o.servers);this._logService.info(`[McpGateway][Workbench] Remote gateway created with ${n.length} server(s)`);let r=U.map(U.filter(t.listen("onDidChangeGatewayServers"),s=>s.gatewayId===o.gatewayId),s=>Jti(s.servers));return{servers:n,onDidChangeServers:r,dispose:()=>{this._logService.info(`[McpGateway][Workbench] Disposing remote gateway: ${o.gatewayId}`),t.call("disposeGateway",o.gatewayId).catch(s=>{this._logService.warn(`[McpGateway][Workbench] Failed to dispose remote gateway: ${o.gatewayId}`,s)})}}})}};H5e=I([m(0,rm),m(1,bo),m(2,re)],H5e);function Jti(a){return a.map(i=>({label:i.label,address:A.revive(i.address)}))}var U5e=class{constructor(i,e,t){i.registerChannel(R8t,new h1e(e,t))}};U5e=I([m(0,rm),m(1,Vs),m(2,re)],U5e);R1.register(new Vt(B5e));Ce(xWe,V5e,1);Ce(zLe,H5e,1);bt("mcpGatewayToolBrokerLocal",U5e,vt.AfterRestored);var Q7=class extends k{constructor(e,t,o,n,r,s,l){super();this.nativeEnvironmentService=e;this.extensionService=t;this.fileService=o;this.configurationService=n;this.nativeHostService=r;this.progressService=s;this.logService=l;if(this.nativeEnvironmentService.isBuilt)return;let c=this.nativeEnvironmentService.exportPolicyData;if(c!==void 0){let u=td(this.nativeEnvironmentService.appRoot,Q7.DEFAULT_POLICY_EXPORT_PATH);this.exportPolicyDataAndQuit(c||u)}}static{this.ID="workbench.contrib.policyExport"}static{this.DEFAULT_POLICY_EXPORT_PATH="build/lib/policies/policyData.jsonc"}log(e,...t){this.logService.info(`[${Q7.ID}]`,e,...t)}async exportPolicyDataAndQuit(e){try{await this.progressService.withProgress({location:15,title:`Exporting policy data to ${e}`},async t=>{this.log("Export started. Waiting for configurations to load."),await this.extensionService.whenInstalledExtensionsRegistered(),await this.configurationService.whenRemoteConfigurationLoaded(),this.log("Extensions and configuration loaded.");let o=oe.as($t.Configuration),n={...o.getExcludedConfigurationProperties(),...o.getConfigurationProperties()},r={categories:Object.values(w2).map(p=>({key:p,name:Tno[p].name})),policies:[]};for(let[p,h]of Object.entries(n))h.policy?.localization&&r.policies.push({key:p,name:h.policy.name,category:h.policy.category,minimumVersion:h.policy.minimumVersion,localization:{description:h.policy.localization.description,enumDescriptions:h.policy.localization.enumDescriptions},type:h.type,default:h.default,enum:h.enum,included:h.included!==!1});this.log(`Discovered ${r.policies.length} policies to export.`);let l=(await this.getDistroProductJson()).extensionConfigurationPolicy;if(l){let p=new Set(r.policies.map(g=>g.key)),h=0;for(let[g,f]of Object.entries(l))if(!p.has(g)){if(!f.description||!f.category)throw new Error(`Extension policy '${g}' is missing required 'description' or 'category' field.`);r.policies.push({key:g,name:f.name,category:f.category,minimumVersion:f.minimumVersion,localization:{description:{key:g,value:f.description}},type:"boolean",default:!0,included:!0}),h++}this.log(`Merged ${h} extension configuration policies.`)}let u=`/** THIS FILE IS AUTOMATICALLY GENERATED USING \`npm run export-policy-data\`. DO NOT MODIFY IT MANUALLY. **/
${JSON.stringify(r,null,4)}
`;await this.fileService.writeFile(A.file(e),Ke.fromString(u)),this.log(`Successfully exported ${r.policies.length} policies to ${e}.`)}),await this.nativeHostService.exit(0)}catch(t){this.log("Failed to export policy",t),await this.nativeHostService.exit(1)}}async getDistroProductJson(){let e=this.nativeEnvironmentService.appRoot,t=JE.env.DISTRO_PRODUCT_JSON;if(t){this.log(`Reading distro product.json from DISTRO_PRODUCT_JSON=${t}`);let g=(await this.fileService.readFile(A.file(t))).value.toString();return JSON.parse(g)}let o=td(e,"package.json"),n=(await this.fileService.readFile(A.file(o))).value.toString(),s=JSON.parse(n).distro;if(!s)throw new Error("No distro commit found in package.json. Use `npm run export-policy-data` which sets up the required environment.");let l=JE.env.GITHUB_TOKEN;if(!l)throw new Error("GITHUB_TOKEN is required to fetch distro product.json. Use `npm run export-policy-data` which sets up the required environment.");this.log(`Fetching distro product.json for commit ${s} from GitHub...`);let c=`https://api.github.com/repos/microsoft/vscode-distro/contents/mixin/stable/product.json?ref=${encodeURIComponent(s)}`,u=await fetch(c,{headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${l}`,"X-GitHub-Api-Version":"2022-11-28","User-Agent":"VSCode Build"}});if(!u.ok)throw new Error(`Failed to fetch distro product.json: ${u.status} ${u.statusText}`);let p=await u.json();if(p.encoding!=="base64")throw new Error(`Unexpected encoding from GitHub API: ${p.encoding}`);let h=Ke.wrap(Uint8Array.from(atob(p.content),g=>g.charCodeAt(0))).toString();return JSON.parse(h)}};Q7=I([m(0,Ix),m(1,lt),m(2,ge),m(3,Yg),m(4,wo),m(5,Go),m(6,re)],Q7);bt(Q7.ID,Q7,vt.Eventually);function xNn(a){let i=a,e={};for(let t in i){let o=i[t];if(o.length){let n=o[0],r=o[1],s=o[2],l=o[3],c=Number(o[4]),u=o.length===6?o[5]:void 0;e[t]={value:n,vkey:u,withShift:r,withAltGr:s,withShiftAltGr:l,valueIsDeadKey:(c&1)>0,withShiftIsDeadKey:(c&2)>0,withAltGrIsDeadKey:(c&4)>0,withShiftAltGrIsDeadKey:(c&8)>0}}else e[t]={value:"",valueIsDeadKey:!1,withShift:"",withShiftIsDeadKey:!1,withAltGr:"",withAltGrIsDeadKey:!1,withShiftAltGr:"",withShiftAltGrIsDeadKey:!1}}return e}var Zti=class a{constructor(i,e,t,o){this.layout=i;this.secondaryLayouts=e;this.mapping=xNn(t),this.isUserKeyboardLayout=!!o,this.layout.isUserKeyboardLayout=!!o}static createKeyboardLayoutFromDebugInfo(i,e,t){let o=new a(i,[],{},!0);return o.mapping=e,o}update(i){this.layout=i.layout,this.secondaryLayouts=i.secondaryLayouts,this.mapping=i.mapping,this.isUserKeyboardLayout=i.isUserKeyboardLayout,this.layout.isUserKeyboardLayout=i.isUserKeyboardLayout}getScore(i){let e=0;for(let t in i){if(ii&&(t==="Backslash"||t==="KeyQ")||Sn&&(t==="Backspace"||t==="Escape"))continue;let o=this.mapping[t];o===void 0&&(e-=1);let n=i[t];o&&n&&o.value!==n.value&&(e-=1)}return e}equal(i){return this.isUserKeyboardLayout!==i.isUserKeyboardLayout||y_i(this.layout)!==y_i(i.layout)?!1:this.fuzzyEqual(i.mapping)}fuzzyEqual(i){for(let e in i){if(ii&&(e==="Backslash"||e==="KeyQ"))continue;if(this.mapping[e]===void 0)return!1;let t=this.mapping[e],o=i[e];if(t.value!==o.value)return!1}return!0}};var vle=class a{constructor(){this._layoutInfos=[]}static{this.INSTANCE=new a}get layoutInfos(){return this._layoutInfos}registerKeyboardLayout(i){this._layoutInfos.push(i)}};var E4i={layout:{name:"00000409",id:"",text:"US",isUSStandard:!0},secondaryLayouts:[{name:"00000804",id:"",text:"Chinese (Simplified) - US Keyboard"},{name:"00000411",id:"",text:"Japanese"},{name:"00000412",id:"",text:"Korean"},{name:"00000404",id:"",text:"Chinese (Traditional) - US Keyboard"}],mapping:{Sleep:[],WakeUp:[],KeyA:["a","A","","",0,"VK_A"],KeyB:["b","B","","",0,"VK_B"],KeyC:["c","C","","",0,"VK_C"],KeyD:["d","D","","",0,"VK_D"],KeyE:["e","E","","",0,"VK_E"],KeyF:["f","F","","",0,"VK_F"],KeyG:["g","G","","",0,"VK_G"],KeyH:["h","H","","",0,"VK_H"],KeyI:["i","I","","",0,"VK_I"],KeyJ:["j","J","","",0,"VK_J"],KeyK:["k","K","","",0,"VK_K"],KeyL:["l","L","","",0,"VK_L"],KeyM:["m","M","","",0,"VK_M"],KeyN:["n","N","","",0,"VK_N"],KeyO:["o","O","","",0,"VK_O"],KeyP:["p","P","","",0,"VK_P"],KeyQ:["q","Q","","",0,"VK_Q"],KeyR:["r","R","","",0,"VK_R"],KeyS:["s","S","","",0,"VK_S"],KeyT:["t","T","","",0,"VK_T"],KeyU:["u","U","","",0,"VK_U"],KeyV:["v","V","","",0,"VK_V"],KeyW:["w","W","","",0,"VK_W"],KeyX:["x","X","","",0,"VK_X"],KeyY:["y","Y","","",0,"VK_Y"],KeyZ:["z","Z","","",0,"VK_Z"],Digit1:["1","!","","",0,"VK_1"],Digit2:["2","@","","",0,"VK_2"],Digit3:["3","#","","",0,"VK_3"],Digit4:["4","$","","",0,"VK_4"],Digit5:["5","%","","",0,"VK_5"],Digit6:["6","^","","",0,"VK_6"],Digit7:["7","&","","",0,"VK_7"],Digit8:["8","*","","",0,"VK_8"],Digit9:["9","(","","",0,"VK_9"],Digit0:["0",")","","",0,"VK_0"],Enter:[],Escape:[],Backspace:[],Tab:[],Space:[" "," ","","",0,"VK_SPACE"],Minus:["-","_","","",0,"VK_OEM_MINUS"],Equal:["=","+","","",0,"VK_OEM_PLUS"],BracketLeft:["[","{","","",0,"VK_OEM_4"],BracketRight:["]","}","","",0,"VK_OEM_6"],Backslash:["\\","|","","",0,"VK_OEM_5"],Semicolon:[";",":","","",0,"VK_OEM_1"],Quote:["'",'"',"","",0,"VK_OEM_7"],Backquote:["`","~","","",0,"VK_OEM_3"],Comma:[",","<","","",0,"VK_OEM_COMMA"],Period:[".",">","","",0,"VK_OEM_PERIOD"],Slash:["/","?","","",0,"VK_OEM_2"],CapsLock:[],F1:[],F2:[],F3:[],F4:[],F5:[],F6:[],F7:[],F8:[],F9:[],F10:[],F11:[],F12:[],PrintScreen:[],ScrollLock:[],Pause:[],Insert:[],Home:[],PageUp:[],Delete:[],End:[],PageDown:[],ArrowRight:[],ArrowLeft:[],ArrowDown:[],ArrowUp:[],NumLock:[],NumpadDivide:["/","/","","",0,"VK_DIVIDE"],NumpadMultiply:["*","*","","",0,"VK_MULTIPLY"],NumpadSubtract:["-","-","","",0,"VK_SUBTRACT"],NumpadAdd:["+","+","","",0,"VK_ADD"],NumpadEnter:[],Numpad1:[],Numpad2:[],Numpad3:[],Numpad4:[],Numpad5:[],Numpad6:[],Numpad7:[],Numpad8:[],Numpad9:[],Numpad0:[],NumpadDecimal:[],IntlBackslash:["\\","|","","",0,"VK_OEM_102"],ContextMenu:[],Power:[],NumpadEqual:[],F13:[],F14:[],F15:[],F16:[],F17:[],F18:[],F19:[],F20:[],F21:[],F22:[],F23:[],F24:[],Help:[],Undo:[],Cut:[],Copy:[],Paste:[],AudioVolumeMute:[],AudioVolumeUp:[],AudioVolumeDown:[],NumpadComma:[],IntlRo:[],KanaMode:[],IntlYen:[],Convert:[],NonConvert:[],Lang1:[],Lang2:[],Lang3:[],Lang4:[],ControlLeft:[],ShiftLeft:[],AltLeft:[],MetaLeft:[],ControlRight:[],ShiftRight:[],AltRight:[],MetaRight:[],MediaTrackNext:[],MediaTrackPrevious:[],MediaStop:[],Eject:[],MediaPlayPause:[],MediaSelect:[],LaunchMail:[],LaunchApp2:[],LaunchApp1:[],BrowserSearch:[],BrowserHome:[],BrowserBack:[],BrowserForward:[],BrowserStop:[],BrowserRefresh:[],BrowserFavorites:[]}};vle.INSTANCE.registerKeyboardLayout(E4i);var T4i={layout:{id:"com.apple.keylayout.US",lang:"en",localizedName:"U.S.",isUSStandard:!0},secondaryLayouts:[{id:"com.apple.keylayout.ABC",lang:"en",localizedName:"ABC"},{id:"com.sogou.inputmethod.sogou.pinyin",lang:"zh-Hans",localizedName:"Pinyin - Simplified"},{id:"com.apple.inputmethod.Kotoeri.Roman",lang:"en",localizedName:"Romaji"},{id:"com.apple.inputmethod.Kotoeri.Japanese",lang:"ja",localizedName:"Hiragana"},{id:"com.apple.keylayout.Australian",lang:"en",localizedName:"Australian"},{id:"com.apple.keylayout.Canadian",lang:"en",localizedName:"Canadian English"},{id:"com.apple.keylayout.Brazilian",lang:"pt",localizedName:"Brazilian"}],mapping:{KeyA:["a","A","\xE5","\xC5",0],KeyB:["b","B","\u222B","\u0131",0],KeyC:["c","C","\xE7","\xC7",0],KeyD:["d","D","\u2202","\xCE",0],KeyE:["e","E","\xB4","\xB4",4],KeyF:["f","F","\u0192","\xCF",0],KeyG:["g","G","\xA9","\u02DD",0],KeyH:["h","H","\u02D9","\xD3",0],KeyI:["i","I","\u02C6","\u02C6",4],KeyJ:["j","J","\u2206","\xD4",0],KeyK:["k","K","\u02DA","\uF8FF",0],KeyL:["l","L","\xAC","\xD2",0],KeyM:["m","M","\xB5","\xC2",0],KeyN:["n","N","\u02DC","\u02DC",4],KeyO:["o","O","\xF8","\xD8",0],KeyP:["p","P","\u03C0","\u220F",0],KeyQ:["q","Q","\u0153","\u0152",0],KeyR:["r","R","\xAE","\u2030",0],KeyS:["s","S","\xDF","\xCD",0],KeyT:["t","T","\u2020","\u02C7",0],KeyU:["u","U","\xA8","\xA8",4],KeyV:["v","V","\u221A","\u25CA",0],KeyW:["w","W","\u2211","\u201E",0],KeyX:["x","X","\u2248","\u02DB",0],KeyY:["y","Y","\xA5","\xC1",0],KeyZ:["z","Z","\u03A9","\xB8",0],Digit1:["1","!","\xA1","\u2044",0],Digit2:["2","@","\u2122","\u20AC",0],Digit3:["3","#","\xA3","\u2039",0],Digit4:["4","$","\xA2","\u203A",0],Digit5:["5","%","\u221E","\uFB01",0],Digit6:["6","^","\xA7","\uFB02",0],Digit7:["7","&","\xB6","\u2021",0],Digit8:["8","*","\u2022","\xB0",0],Digit9:["9","(","\xAA","\xB7",0],Digit0:["0",")","\xBA","\u201A",0],Enter:[],Escape:[],Backspace:[],Tab:[],Space:[" "," "," "," ",0],Minus:["-","_","\u2013","\u2014",0],Equal:["=","+","\u2260","\xB1",0],BracketLeft:["[","{","\u201C","\u201D",0],BracketRight:["]","}","\u2018","\u2019",0],Backslash:["\\","|","\xAB","\xBB",0],Semicolon:[";",":","\u2026","\xDA",0],Quote:["'",'"',"\xE6","\xC6",0],Backquote:["`","~","`","`",4],Comma:[",","<","\u2264","\xAF",0],Period:[".",">","\u2265","\u02D8",0],Slash:["/","?","\xF7","\xBF",0],CapsLock:[],F1:[],F2:[],F3:[],F4:[],F5:[],F6:[],F7:[],F8:[],F9:[],F10:[],F11:[],F12:[],Insert:[],Home:[],PageUp:[],Delete:[],End:[],PageDown:[],ArrowRight:[],ArrowLeft:[],ArrowDown:[],ArrowUp:[],NumLock:[],NumpadDivide:["/","/","/","/",0],NumpadMultiply:["*","*","*","*",0],NumpadSubtract:["-","-","-","-",0],NumpadAdd:["+","+","+","+",0],NumpadEnter:[],Numpad1:["1","1","1","1",0],Numpad2:["2","2","2","2",0],Numpad3:["3","3","3","3",0],Numpad4:["4","4","4","4",0],Numpad5:["5","5","5","5",0],Numpad6:["6","6","6","6",0],Numpad7:["7","7","7","7",0],Numpad8:["8","8","8","8",0],Numpad9:["9","9","9","9",0],Numpad0:["0","0","0","0",0],NumpadDecimal:[".",".",".",".",0],IntlBackslash:["\xA7","\xB1","\xA7","\xB1",0],ContextMenu:[],NumpadEqual:["=","=","=","=",0],F13:[],F14:[],F15:[],F16:[],F17:[],F18:[],F19:[],F20:[],AudioVolumeMute:[],AudioVolumeUp:["","=","","=",0],AudioVolumeDown:[],NumpadComma:[],IntlRo:[],KanaMode:[],IntlYen:[],ControlLeft:[],ShiftLeft:[],AltLeft:[],MetaLeft:[],ControlRight:[],ShiftRight:[],AltRight:[],MetaRight:[]}};vle.INSTANCE.registerKeyboardLayout(T4i);var _4i={layout:{model:"pc105",group:0,layout:"us",variant:"",options:"",rules:"evdev",isUSStandard:!0},secondaryLayouts:[{model:"pc105",group:0,layout:"cn",variant:"",options:"",rules:"evdev"}],mapping:{Sleep:[],WakeUp:[],KeyA:["a","A","a","A",0],KeyB:["b","B","b","B",0],KeyC:["c","C","c","C",0],KeyD:["d","D","d","D",0],KeyE:["e","E","e","E",0],KeyF:["f","F","f","F",0],KeyG:["g","G","g","G",0],KeyH:["h","H","h","H",0],KeyI:["i","I","i","I",0],KeyJ:["j","J","j","J",0],KeyK:["k","K","k","K",0],KeyL:["l","L","l","L",0],KeyM:["m","M","m","M",0],KeyN:["n","N","n","N",0],KeyO:["o","O","o","O",0],KeyP:["p","P","p","P",0],KeyQ:["q","Q","q","Q",0],KeyR:["r","R","r","R",0],KeyS:["s","S","s","S",0],KeyT:["t","T","t","T",0],KeyU:["u","U","u","U",0],KeyV:["v","V","v","V",0],KeyW:["w","W","w","W",0],KeyX:["x","X","x","X",0],KeyY:["y","Y","y","Y",0],KeyZ:["z","Z","z","Z",0],Digit1:["1","!","1","!",0],Digit2:["2","@","2","@",0],Digit3:["3","#","3","#",0],Digit4:["4","$","4","$",0],Digit5:["5","%","5","%",0],Digit6:["6","^","6","^",0],Digit7:["7","&","7","&",0],Digit8:["8","*","8","*",0],Digit9:["9","(","9","(",0],Digit0:["0",")","0",")",0],Enter:["\r","\r","\r","\r",0],Escape:["\x1B","\x1B","\x1B","\x1B",0],Backspace:["\b","\b","\b","\b",0],Tab:["	","","	","",0],Space:[" "," "," "," ",0],Minus:["-","_","-","_",0],Equal:["=","+","=","+",0],BracketLeft:["[","{","[","{",0],BracketRight:["]","}","]","}",0],Backslash:["\\","|","\\","|",0],Semicolon:[";",":",";",":",0],Quote:["'",'"',"'",'"',0],Backquote:["`","~","`","~",0],Comma:[",","<",",","<",0],Period:[".",">",".",">",0],Slash:["/","?","/","?",0],CapsLock:[],F1:[],F2:[],F3:[],F4:[],F5:[],F6:[],F7:[],F8:[],F9:[],F10:[],F11:[],F12:[],PrintScreen:[],ScrollLock:[],Pause:[],Insert:[],Home:[],PageUp:[],Delete:["","","","",0],End:[],PageDown:[],ArrowRight:[],ArrowLeft:[],ArrowDown:[],ArrowUp:[],NumLock:[],NumpadDivide:["/","/","/","/",0],NumpadMultiply:["*","*","*","*",0],NumpadSubtract:["-","-","-","-",0],NumpadAdd:["+","+","+","+",0],NumpadEnter:["\r","\r","\r","\r",0],Numpad1:["","1","","1",0],Numpad2:["","2","","2",0],Numpad3:["","3","","3",0],Numpad4:["","4","","4",0],Numpad5:["","5","","5",0],Numpad6:["","6","","6",0],Numpad7:["","7","","7",0],Numpad8:["","8","","8",0],Numpad9:["","9","","9",0],Numpad0:["","0","","0",0],NumpadDecimal:["",".","",".",0],IntlBackslash:["<",">","|","\xA6",0],ContextMenu:[],Power:[],NumpadEqual:["=","=","=","=",0],F13:[],F14:[],F15:[],F16:[],F17:[],F18:[],F19:[],F20:[],F21:[],F22:[],F23:[],F24:[],Open:[],Help:[],Select:[],Again:[],Undo:[],Cut:[],Copy:[],Paste:[],Find:[],AudioVolumeMute:[],AudioVolumeUp:[],AudioVolumeDown:[],NumpadComma:[".",".",".",".",0],IntlRo:[],KanaMode:[],IntlYen:[],Convert:[],NonConvert:[],Lang1:[],Lang2:[],Lang3:[],Lang4:[],Lang5:[],NumpadParenLeft:["(","(","(","(",0],NumpadParenRight:[")",")",")",")",0],ControlLeft:[],ShiftLeft:[],AltLeft:[],MetaLeft:[],ControlRight:[],ShiftRight:[],AltRight:[],MetaRight:[],BrightnessUp:[],BrightnessDown:[],MediaPlay:[],MediaRecord:[],MediaFastForward:[],MediaRewind:[],MediaTrackNext:[],MediaTrackPrevious:[],MediaStop:[],Eject:[],MediaPlayPause:[],MediaSelect:[],LaunchMail:[],LaunchApp2:[],LaunchApp1:[],SelectTask:[],LaunchScreenSaver:[],BrowserSearch:[],BrowserHome:[],BrowserBack:[],BrowserForward:[],BrowserStop:[],BrowserRefresh:[],BrowserFavorites:[],MailReply:[],MailForward:[],MailSend:[]}};vle.INSTANCE.registerKeyboardLayout(_4i);var iT=class extends k{constructor(e,t,o,n,r,s){super();this.nativeEnvironmentService=e;this.fileService=t;this.nativeHostService=o;this.productService=n;this.extensionService=r;this.logService=s;if(this.productService.quality==="stable")return;let l=this.nativeEnvironmentService.exportDefaultKeybindings;if(l!==void 0){let c=td(this.nativeEnvironmentService.appRoot,"doc");this.extensionService.whenInstalledExtensionsRegistered().then(()=>this.exportDefaultKeybindingsAndQuit(l||c)).catch(async u=>{this.logService.error(`[${iT.ID}] Failed to register installed extensions before exporting default keybindings`,u),await this.nativeHostService.closeWindow()})}}static{this.ID="workbench.contrib.keybindingsExport"}async exportDefaultKeybindingsAndQuit(e){try{let t=[{os:1,filename:"doc.keybindings.win.json"},{os:2,filename:"doc.keybindings.osx.json"},{os:3,filename:"doc.keybindings.linux.json"}],o=this.extensionService.extensions;for(let{os:n,filename:r}of t){let s=iT._getDefaultKeybindingsContentForOS(n,o),l=td(e,r);await this.fileService.writeFile(A.file(l),Ke.fromString(s)),this.logService.info(`[${iT.ID}] Wrote ${l}`)}await this.nativeHostService.closeWindow()}catch(t){this.logService.error(`[${iT.ID}] Failed to generate default keybindings`,t),await this.nativeHostService.closeWindow()}}static _getDefaultKeybindingsContentForOS(e,t){let o=xt.getDefaultKeybindingsForOS(e),n=iT._getExtensionKeybindingsForOS(t,e),r=o.concat(n),s=iT._createKeyboardMapperForOS(e),l=iT._resolveKeybindingItemsWithMapper(r,s),c=new gEe(l,[],()=>{}),u=c.getDefaultKeybindings(),p=c.getDefaultBoundCommands();return iT._formatDefaultKeybindings(u)+`

`+iT._formatAllCommandsAsComment(p)}static _getExtensionKeybindingsForOS(e,t){let o=[];for(let n of e){if(!n.isBuiltin)continue;let r=n.contributes?.keybindings;if(!r)continue;let s=Array.isArray(r)?r:[r];for(let l=0;l<s.length;l++){let c=s[l],u=iT._bindToOS(c.key,c.mac,c.linux,c.win,t);if(!u)continue;let p=dP.parseKeybinding(u);if(!p)continue;let g=be.getCommand(c.command)?.precondition,f=c.when?C.deserialize(c.when):void 0;f&&g?f=C.and(g,f)??void 0:g&&(f=g),o.push({keybinding:p,command:c.command,commandArgs:void 0,when:f??null,weight1:300+l,weight2:0,extensionId:n.identifier.value,isBuiltinExtension:!0})}}return o}static _bindToOS(e,t,o,n,r){return r===1&&n?n:r===2&&t?t:r===3&&o?o:e}static _createKeyboardMapperForOS(e){let o={1:E4i,2:T4i,3:_4i}[e],n=new Zti(o.layout,o.secondaryLayouts,o.mapping);switch(e){case 1:return new wNe(!0,n.mapping,!1);case 2:return new Gae(!0,n.mapping,!1,2);case 3:return new Gae(!0,n.mapping,!1,3)}}static _resolveKeybindingItemsWithMapper(e,t){let o=[];for(let n of e){let r=n.when||void 0,s=n.keybinding;if(!s)o.push(new zN(void 0,n.command,n.commandArgs,r,!0,n.extensionId,n.isBuiltinExtension));else{let l=t.resolveKeybinding(s);for(let c=l.length-1;c>=0;c--)o.push(new zN(l[c],n.command,n.commandArgs,r,!0,n.extensionId,n.isBuiltinExtension))}}return o}static _formatDefaultKeybindings(e){let t=new oAe;t.writeLine("[");let o=e.length-1;return e.forEach((n,r)=>{Yhe.writeKeybindingItem(t,n),r!==o?t.writeLine(","):t.writeLine()}),t.writeLine("]"),t.toString()}static _formatAllCommandsAsComment(e){return`// Here are other available commands: 
// - `+QPe(e).sort().join(`
// - `)}};iT=I([m(0,Ix),m(1,ge),m(2,wo),m(3,Ze),m(4,lt),m(5,re)],iT);bt(iT.ID,iT,vt.Eventually);Ce(tQ,new Vt(t1t,[[]],!0));export{WMn as main};
/**
 * Copyright (c) 2022 The xterm.js authors. All rights reserved.
 * @license MIT
 */
/*! @license DOMPurify 3.2.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.7/LICENSE */
//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/f6cfa2ea2403534de03f069bdf160d06451ed282/core/vs/workbench/workbench.desktop.main.js.map
